The wire finally says what the model has said since the normalization commit: a world is collections of features, each collection declared point, path, or area. The payload's groups and zones keys are gone; one flat collections array replaces them, points leading so the packed payload's owner column indexes it directly, shape collections after with their features inline. The manifest counts every kind -- points, paths, areas -- where it used to count only pins, and Validate holds a bundle to the new shape: geometry agreeing with its collection's declared kind, every path collection carrying its stroke width, label policy only where labels draw on ground, point collections never inlining, and every packed location owned by a point collection that exists. The location payload moves to version 3 without moving a byte: owner indexes the collections array, and the region column reads as Member. Shape collections claim numeric identities from the same FNV scheme every other pipeline id comes from. What the registry said all along now rides where it said it: the stroke width lives on the path collection alone -- arcgismap stops spelling it on each zone -- every collection's attributes mirror its kind, displayType is off the wire entirely, and the manifest stamps the registry's own conventions version again. The ledger drops the legacy donorPins spelling; donorFeatures is the account, and measure keeps its fallback for the bundles already in the wild. The frontend reads the new wire whole: real collections drive the legend's sections by their group strings, ungrouped shape collections gather in the viewer's own Zones section so the pre-collapse behaviour keeps a place to land, the hide and unfold and label-override sets key by real collection ids, and the AND filter conjoins across the collections the wire names instead of one synthetic bucket. A shape feature's card now measures its ground -- area and the locations inside it, or length -- where the world declares a geographic mapping, and shows the attributes the feature carries in its own right, HUC-12 finally surfaced. Search lists named shape features beside the locations. The parity tour runs green on the regenerated Westminster bundle with the same 45 pins and 118 zones; the cross-format diff is structural key renames and the first zone row changing identity, with no pin drift. The full corpus rebuilds and validates as v3.
- commit
- 4c0ba8638e3ee9fb2fe2ea2f3a3756ee8a4f143a
- parent
- 5368a47867cdb84faec13468a2d07c987c63585b
- author
- Dami <dami.etoile@gmail.com>
@@ -1,19 +1,19 @@
1-(()=>{var Yue=Object.create;var TL=Object.defineProperty;var Zue=Object.getOwnPropertyDescriptor;var Kue=Object.getOwnPropertyNames;var Que=Object.getPrototypeOf,Jue=Object.prototype.hasOwnProperty;var Tq=(i,e)=>()=>{try{return e||i((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}},ehe=(i,e)=>{for(var t in e)TL(i,t,{get:e[t],enumerable:!0})},the=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Kue(e))!Jue.call(i,r)&&r!==t&&TL(i,r,{get:()=>e[r],enumerable:!(n=Zue(e,r))||n.enumerable});return i};var Eq=(i,e,t)=>(t=i!=null?Yue(Que(i)):{},the(e||!i||!i.__esModule?TL(t,"default",{value:i,enumerable:!0}):t,i));var Lq=Tq((AT,Pq)=>{(function(i,e){typeof AT=="object"&&typeof Pq<"u"?e(AT):typeof define=="function"&&define.amd?define(["exports"],e):e(i.bigfloat={})})(AT,(function(i){"use strict";var e=Math.pow(2,32),t=Math.pow(2,-32),n=Math.log(10)/(32*Math.log(2));function r(D){return new Array(D+1).join("0")}var s=(function(){function D(L){this.base=L,this.limbDigitsExact=Math.log(e)/Math.log(this.base),this.limbDigits=~~this.limbDigitsExact,this.limbBase=Math.pow(this.base,this.limbDigits),this.pad=r(this.limbDigits)}return D.init=function(L){return D.baseTbl[L]||(D.baseTbl[L]=new D(L))},D.baseTbl={},D})();function o(D){return D.replace(/^(-?)0+([1-9a-z]|0(\.|$))/,"$1$2").replace(/(\.|(\.[0-9a-z]*[1-9a-z]))0+$/,"$2")}function a(D,L){L===void 0&&(L=10);var C=s.init(L),B=C.pad,k=C.limbBase,z="",G="",W,Y;if(isNaN(D))return"NaN";if(D<0&&(z="-",D=-D),!isFinite(D))return z+"Inf";if(D<1)G+="0";else{var H=Math.floor(D);for(D-=H;H;)W=H%k,H=(H-W)/k,Y=W.toString(L),G=Y+G,H&&(G=B.substr(Y.length)+G)}if(D>0)for(G+=".",k!=e&&(k=L,B="");D;)D*=k,W=D>>>0,D-=W,Y=W.toString(L),G+=B.substr(Y.length)+Y;return z+G.replace(/(\.[0-9a-z]*[1-9a-z])0+$/,"$1")}var l=(function(){function D(L,C){this.limbList=[],L?this.setValue(L,C):this.setZero()}return D.prototype.clone=function(){return new D().setBig(this)},D.prototype.setZero=function(){return this.sign=1,this.fractionLen=0,this.len=0,this},D.prototype.setValue=function(L,C){return typeof L=="number"?this.setNumber(L):L instanceof D?this.setBig(L):this.setString(L.toString(),C||10)},D.prototype.setBig=function(L){var C=L.len;this.sign=L.sign,this.fractionLen=L.fractionLen,this.len=C;for(var B=0;B<C;++B)this.limbList[B]=L.limbList[B];return this},D.prototype.setNumber=function(L){L<0?(L=-L,this.sign=-1):this.sign=1;for(var C=Math.floor(L),B=L-C,k=0,z=this.limbList,G,W=0;B;)B*=e,G=B>>>0,B-=G,z[W++]=G,++k;for(var Y=0;--W>Y;)G=z[Y],z[Y++]=z[W],z[W]=G;for(W+=Y+1;C;)G=C%e,C=(C-G)/e,z[W++]=G;return this.limbList=z,this.fractionLen=k,this.len=W,this},D.prototype.parseFraction=function(L,C,B,k,z,G){for(var W=this.limbList,Y=L.length,H=k-1;H;)W[--H]=0;var $=Y-((Y-B+G-1)%G+1);for(W[k-1]=parseInt(L.substr($,Y-$),C),this.divInt(Math.pow(C,Y-$),k),Y=$;Y>B;)Y-=G,W[k-1]=parseInt(L.substr(Y,G),C),this.divInt(z,k)},D.prototype.setString=function(L,C){var B=s.init(C),k=B.limbBase,z=B.limbDigits,G=B.limbDigitsExact,W=this.limbList,Y=-1,H;for(this.sign=1;;){switch(H=L.charAt(++Y),H){case"-":this.sign=-1;case"+":case"0":continue}break}var $=(L.indexOf(".",Y)+1||L.length+1)-1;if($<L.length-1){var J=~~((L.length-$-1)/G)+1;this.parseFraction(L,C,$+1,J+1,k,z),this.fractionLen=J,this.len=J,this.trimLeast()}else this.fractionLen=0,this.len=0;var te=this.fractionLen;if($>Y){var ce=Y+($-Y+z-1)%z+1;for(++this.len,W[te]=parseInt(L.substr(Y,ce-Y),C),Y=ce;Y<$;)this.mulInt(k,W,te,te,0)&&++this.len,W[te]+=parseInt(L.substr(Y,z),C),Y+=z}return this},D.prototype.trimMost=function(){for(var L=this.limbList,C=this.fractionLen,B=this.len;B>C&&!L[B-1];)--B;this.len=B},D.prototype.trimLeast=function(){for(var L=this.limbList,C=this.fractionLen,B=0;B<C&&!L[B];)++B;B&&this.truncate(C-B)},D.prototype.mulInt=function(L,C,B,k,z){if(!L)return 0;for(var G=this.limbList,W=this.len,Y,H,$=0;B<W;)Y=G[B++],$+=L*(Y&65535),H=$&65535,$=($-H)/65536,$+=L*(Y>>>16),H|=$<<16,Y=(C[k]&z)+H>>>0,C[k++]=Y,$=$/65536>>>0,$+=(H^(Y-H^H)&~(Y^H))>>>31;return $&&(C[k]=$),$},D.prototype.mulBig=function(L,C){if(this.isZero()||L.isZero())return C.setZero();var B=L.limbList,k=L.len,z=C.limbList,G=this.len+k;for(C.len=G;G--;)z[G]=0;this.mulInt(B[0],z,0,0,0);for(var W=1;W<k;++W)this.mulInt(B[W],z,0,W,4294967295);return C.sign=this.sign*L.sign,C.fractionLen=this.fractionLen+L.fractionLen,C.trimMost(),C.trimLeast(),C},D.prototype.mul=function(L,C){if(C=C||new D,typeof L=="number"&&(L=c.setNumber(L)),C==this)throw new Error("Multiplication in place is unsupported");return this.mulBig(L,C)},D.prototype.absDeltaFrom=function(L){typeof L=="number"&&(L=c.setNumber(L));for(var C=this.limbList,B=L.limbList,k=this.len,z=L.len,G=k-this.fractionLen-(z-L.fractionLen);!G&&k&&z;)G=C[--k]-B[--z];if(G)return G;if(k)do G=C[--k];while(!G&&k);else if(z)do G=-B[--z];while(!G&&z);return G},D.prototype.isZero=function(){return this.len==0},D.prototype.getSign=function(){return this.len&&this.sign},D.prototype.deltaFrom=function(L){return typeof L=="number"&&(L=c.setNumber(L)),this.len+L.len&&(this.sign-L.sign||this.absDeltaFrom(L)*this.sign)},D.prototype.addBig=function(L,C){var B=this,k=B.fractionLen,z=k-L.fractionLen;z<0&&(z=-z,k+=z,B=L,L=this),C.sign=this.sign,C.fractionLen=k;for(var G=C.limbList,W=B.limbList,Y=L.limbList,H=0,$=0,J=0,te;H<z;)G[H]=W[H],++H;var ce=L.len;for(z=B.len-H,z>ce&&(z=ce);$<z;)J+=W[H]+Y[$++],te=J>>>0,J=J-te&&1,G[H++]=te;var he=H;for(z<ce?(z=ce,B=L,H=$,W=Y):z=B.len;H<z;)J+=W[H++],te=J>>>0,J=J-te&&1,G[he++]=te;return J&&(G[he++]=J),C.len=he,C.trimLeast(),C},D.prototype.subBig=function(L,C){var B=this;C.sign=this.sign,B.absDeltaFrom(L)<0&&(B=L,L=this,C.sign=-this.sign);var k=B.fractionLen,z=k-L.fractionLen,G=C.limbList,W=B.limbList,Y=L.limbList,H=B.len,$=L.len,J=H,te=0,ce=0,he=0,ve=0,Re;if(z>=0){for(;te<z;)G[te]=W[te],++te;z+=$,z>H&&(z=H),he=te}else{for(z=-z,k+=z,J+=z;ce<z;)ve-=Y[ce],Re=ve>>>0,ve=-(ve<0),G[ce++]=Re;z+=H,z>$&&(z=$),he=ce}for(C.fractionLen=k;he<z;)ve+=W[te++]-Y[ce++],Re=ve>>>0,ve=-(ve<0),G[he++]=Re;for(;he<J;)ve+=W[te++],Re=ve>>>0,ve=-(ve<0),G[he++]=Re;return C.len=he,C.trimMost(),C.trimLeast(),C},D.prototype.addSub=function(L,C,B){if(B=B||new D,B==this)throw new Error("Addition and subtraction in place is unsupported");return typeof L=="number"&&(L=c.setNumber(L)),this.sign*L.sign*C<0?this.subBig(L,B):this.addBig(L,B)},D.prototype.add=function(L,C){return this.addSub(L,1,C)},D.prototype.sub=function(L,C){return this.addSub(L,-1,C)},D.prototype.truncate=function(L){var C=this.fractionLen-L;if(C>0){this.fractionLen=L,this.len-=C;for(var B=this.len,k=this.limbList,z=0;z<B;++z)k[z]=k[z+C]}return this},D.prototype.round=function(L){return this.truncate(1+~~(L*n))},D.prototype.divInt=function(L,C){var B=this.limbList,k,z,G,W=0;for(B[C-1]<L&&(W=B[--C],this.len=C);C--;)k=B[C],W=W*65536+(k>>>16),z=W/L>>>0,W=W-z*L,W=W*65536+(k&65535),G=W/L>>>0,W=W-G*L,B[C]=(z<<16|G)>>>0;return W},D.prototype.fractionToString=function(L,C){var B=s.init(L),k=B.pad,z=B.limbBase,G=this.limbList,W=this.fractionLen,Y=0,H;if(L&1)throw new Error("Conversion of floating point values to odd bases is unsupported");for(;Y<W&&!G[Y];)++Y;if(!(Y>=W)){C.push(".");var $=c;for($.limbList=G.slice(Y,W),$.len=W-Y,Y=0;Y<$.len;)if($.limbList[Y]){var J=$.mulInt(z,$.limbList,Y,Y,0);H=J.toString(L),C.push(k.substr(H.length)+H)}else++Y}},D.prototype.getExpansion=function(L){for(var C=this.limbList,B=this.len,k=this.sign,z=this.fractionLen;z--;)k*=t;for(;++z<B;)L[z]=C[z]*k,k*=e;return B},D.prototype.valueOf=function(){for(var L=this.limbList,C=0,B=t*this.sign,k=this.fractionLen,z=0;z<k;)C=C*t+L[z++];for(k=this.len;z<k;)C=C*t+L[z++],B*=e;return C*B},D.prototype.toString=function(L){L===void 0&&(L=10);var C=s.init(L),B=C.pad,k=C.limbBase,z=[],G=this.limbList,W;if(k!=e){var Y=c;for(Y.limbList=G.slice(this.fractionLen,this.len),Y.len=this.len-this.fractionLen;Y.len>1;)W=Y.divInt(k,Y.len).toString(L),z.push(B.substr(W.length)+W);z.push(""+(Y.limbList[0]||0)),this.sign<0&&z.push("-"),z.reverse(),this.fractionToString(L,z)}else{var H=this.len,$=this.fractionLen;for(this.sign<0&&z.push("-"),H==$&&z.push("0");H--;)W=G[H].toString(L),H==$-1&&z.push("."),z.push(B.substr(W.length)+W)}return o(z.join(""))},D})();l.prototype.cmp=l.prototype.deltaFrom;var c=new l,u=(1<<27)+1,f=Math.log(10)/(53*Math.log(2));function d(D,L,C){var B=D+L,k=B-D,z=B-k;return C[0]=D-z+(L-k),C[1]=B,C}function A(D,L){w=D*L;var C=D*u,B=C-(C-D),k=D-B,z=L*u,G=z-(z-L),W=L-G;return k*W-(w-B*G-k*G-B*W)}var y=(function(){function D(L,C){this.limbList=[],L&&this.setValue(L,C)}return D.prototype.clone=function(){return new D().setBig(this)},D.prototype.setZero=function(){return this.len=0,this},D.prototype.setValue=function(L,C){return typeof L=="number"?this.setNumber(L):L instanceof D?this.setBig(L):this.setString(L.toString(),C||10)},D.prototype.setBig=function(L){var C=L.len;this.len=C;for(var B=0;B<C;++B)this.limbList[B]=L.limbList[B];return this},D.prototype.setNumber=function(L){return this.limbList[0]=L,this.len=L&&1,this},D.prototype.setString=function(L,C){return S[0].setValue(L,C),this.len=S[0].getExpansion(this.limbList),this.normalize(),this},D.prototype.setSum=function(L,C){return this.len=2,d(L,C,this.limbList),this},D.prototype.setProduct=function(L,C){return this.len=2,this.limbList[0]=A(L,C),this.limbList[1]=w,this},D.prototype.normalize=function(){var L=this.limbList,C=this.len,B;if(C){for(var k=C-1,z=C-1,G=L[k],W=void 0;k;)B=L[--k],W=G,G+=B,W=B-(G-W),L[z]=G,z-=W&&1,G=W||G;for(L[z]=G;++z<C;)B=L[z],W=G,G+=B,W-=G-B,L[k]=W,k+=W&&1;L[k]=G,this.len=k+(G&&1)}return this},D.prototype.mulSmall=function(L,C){var B=this.limbList,k=C.limbList,z=this.len,G,W,Y,H=0,$=0;function J(ce){k[$]=ce,$+=ce&&1}J(A(B[H++],L));for(var te=w;H<z;)G=A(B[H++],L),W=te+G,Y=W-te,J(te-(W-Y)+(G-Y)),te=w+W,J(W-(te-w));return k[$]=te,C.len=$+(te&&1),C},D.prototype.mulBig=function(L,C){var B=L.limbList,k=L.len;if(!k)return C.setZero();for(--k,this.mulSmall(B[k],k?T[k&1]:C);k;)--k,this.mulSmall(B[k],C).addBig(T[~k&1],1,k?T[k&1]:C);return C},D.prototype.mul=function(L,C){if(C=C||new D,typeof L=="number")return this.mulSmall(L,C);if(C==this)throw new Error("Cannot multiply in place");return this.mulBig(L,C)},D.prototype.isZero=function(){for(var L=this.limbList,C=this.len;C--;)if(L[C])return!1;return!0},D.prototype.getSign=function(){var L=this.len;return L&&(L=this.limbList[L-1])&&(L>0?1:-1)},D.prototype.deltaFrom=function(L){var C=this.len,B=this.getSign(),k=B;if(typeof L!="number"){if(C=L.len,k-=C&&(C=L.limbList[C-1])&&(C>0?1:-1),k||!B)return k;this.addBig(L,-1,T[0])}else{if(k-=L&&(L>0?1:-1),k||!B)return k;this.addSmall(-L,T[0])}return C=T[0].len,C&&T[0].limbList[C-1]},D.prototype.addSmall=function(L,C){for(var B=this.limbList,k=C.limbList,z=this.len,G,W,Y,H,$=0,J=0;$<z;)W=B[$++],G=W+L,Y=G-W,W-=G-Y,H=W+(L-Y),k[J]=H,J+=H&&1,L=G;return k[J]=L,C.len=J+(L&&1),C},D.prototype.addBig=function(L,C,B){var k=this.limbList,z=L.limbList,G=B.limbList,W=this.len+L.len,Y=0,H=0,$=0,J=k[Y++],te=z[H++]*C,ce=J<0?-J:J,he=te<0?-te:te,ve,Re,Qe,Fe;if(!W)return B.setZero();k[this.len]=1/0,z[L.len]=1/0;function mt(){var Ve;return ce<he?(Ve=J,J=k[Y++],ce=J<0?-J:J):(Ve=te,te=z[H++]*C,he=te<0?-te:te),Ve}for(var Ee=mt();--W;)ve=mt(),Qe=Ee,Ee+=ve,Re=Ee-Qe,Fe=Qe-(Ee-Re)+(ve-Re),G[$]=Fe,$+=Fe&&1;return G[$]=Ee,B.len=$+(Ee&&1),B},D.prototype.addSub=function(L,C,B){return B=B||new D,typeof L=="number"?this.addSmall(C*L,B):this.addBig(L,C,B)},D.prototype.add=function(L,C){return this.addSub(L,1,C)},D.prototype.sub=function(L,C){return this.addSub(L,-1,C)},D.prototype.truncate=function(L){this.normalize();for(var C=this.limbList,B=this.len,k=0,z=B,G=0,W=0;k<z;)G=k+z>>1,W=C[G],W>-1&&W<1?k=G+1:z=G;if(G&&(W<=-1||W>=1)&&(W=C[--G]),G-=L-1,G>0){this.len-=G,B=this.len;for(var Y=0;Y<B;++Y)C[Y]=C[Y+G]}return this},D.prototype.round=function(L){return this.truncate(1+~~(L*f))},D.prototype.valueOf=function(){for(var L=this.limbList,C=this.len,B=0,k=0;k<C;++k)B+=L[k];return B},D.prototype.toString=function(L){var C=this.limbList,B=this.len;for(S[B&1].setZero();B--;)S[~B&1].add(C[B],S[B&1]);return S[~B&1].toString(L)},D})();y.prototype.cmp=y.prototype.deltaFrom;var w=0,S=[new l,new l],T=[new y,new y];function R(D,L){function C(){this.constructor=D}C.prototype=L.prototype,D.prototype=new C}var P=(function(){function D(L,C,B){this.real=typeof L=="object"?L:new this.Base(L,B),this.imag=typeof C=="object"?C:new this.Base(C,B)}return D.prototype.clone=function(){var L=new this.constructor(this.real.clone(),this.imag.clone());return L},D.prototype.setZero=function(){return this.real.setZero(),this.imag.setZero(),this},D.prototype.setValue=function(L){return this.real.setValue(L.real),this.imag.setValue(L.imag),this},D.prototype.mul=function(L,C){return C=C||new this.constructor,L instanceof D?(this.real.mul(L.real,this.temp1),this.imag.mul(L.imag,this.temp2),this.temp1.sub(this.temp2,C.real),this.real.mul(L.imag,this.temp1),this.imag.mul(L.real,this.temp2),this.temp1.add(this.temp2,C.imag)):(this.real.mul(L,C.real),this.imag.mul(L,C.imag)),C},D.prototype.sqr=function(L){return L=L||new this.constructor,this.real.mul(this.real,this.temp1),this.imag.mul(this.imag,this.temp2),this.temp1.sub(this.temp2,L.real),this.real.mul(this.imag,this.temp1),this.temp1.add(this.temp1,L.imag),L},D.prototype.add=function(L,C){return C=C||new this.constructor,L instanceof D?(this.real.add(L.real,C.real),this.imag.add(L.imag,C.imag)):this.real.add(L,C.real),C},D.prototype.sub=function(L,C){return C=C||new this.constructor,L instanceof D?(this.real.sub(L.real,C.real),this.imag.sub(L.imag,C.imag)):this.real.sub(L,C.real),C},D.prototype.truncate=function(L){return this.real.truncate(L),this.imag.truncate(L),this},D})(),I=(function(D){R(L,D);function L(){return D!==null&&D.apply(this,arguments)||this}return L})(P),F=(function(D){R(L,D);function L(){return D!==null&&D.apply(this,arguments)||this}return L})(P);I.prototype.Base=l,I.prototype.temp1=new l,I.prototype.temp2=new l,F.prototype.Base=y,F.prototype.temp1=new y,F.prototype.temp2=new y,i.BigFloat32=l,i.BigFloat53=y,i.BigComplex32=I,i.BigComplex53=F,i.trimNumber=o,i.numberToString=a,Object.defineProperty(i,"__esModule",{value:!0})}))});var GJ=Tq((Sw,oO)=>{(function(i,e){typeof Sw=="object"&&typeof oO=="object"?oO.exports=e():typeof define=="function"&&define.amd?define("FrameTicker",[],e):typeof Sw=="object"?Sw.FrameTicker=e():i.FrameTicker=e()})(Sw,function(){return(function(i){function e(n){if(t[n])return t[n].exports;var r=t[n]={exports:{},id:n,loaded:!1};return i[n].call(r.exports,r,r.exports,e),r.loaded=!0,r.exports}var t={};return e.m=i,e.c=t,e.p="",e(0)})([function(i,e,t){"use strict";var n=t(1),r=(function(){function s(o,a,l){o===void 0&&(o=NaN),a===void 0&&(a=NaN),l===void 0&&(l=!1),this._minFPS=a,this._maxFPS=o,this._timeScale=1,this._currentTick=0,this._currentTime=0,this._tickDeltaTime=0,this._isRunning=!1,this._maxInterval=isNaN(this._minFPS)?NaN:1e3/this._minFPS,this._minInterval=isNaN(this._maxFPS)?NaN:1e3/this._maxFPS,this._onResume=new n.default,this._onPause=new n.default,this._onTick=new n.default,this._onTickOncePerFrame=new n.default,l||this.resume()}return s.prototype.updateOnce=function(o){o(this.currentTimeSeconds,this.tickDeltaTimeSeconds,this.currentTick)},s.prototype.resume=function(){this._isRunning||(this._isRunning=!0,this._lastTimeUpdated=this.getTimer(),this._onResume.dispatch(),this.animateOnce())},s.prototype.pause=function(){this._isRunning&&(this._isRunning=!1,this._onPause.dispatch(),window.cancelAnimationFrame(this._animationFrameHandle))},s.prototype.dispose=function(){this.pause(),this._onResume.removeAll(),this._onPause.removeAll(),this._onTick.removeAll()},Object.defineProperty(s.prototype,"currentTick",{get:function(){return this._currentTick},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"currentTimeSeconds",{get:function(){return this._currentTime/1e3},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"tickDeltaTimeSeconds",{get:function(){return this._tickDeltaTime/1e3},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"timeScale",{get:function(){return this._timeScale},set:function(o){this._timeScale!==o&&(this._timeScale=o)},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"onResume",{get:function(){return this._onResume},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"onPause",{get:function(){return this._onPause},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"onTick",{get:function(){return this._onTick},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"onTickOncePerFrame",{get:function(){return this._onTickOncePerFrame},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"isRunning",{get:function(){return this._isRunning},enumerable:!0,configurable:!0}),s.prototype.animateOnce=function(){var o=this;this._animationFrameHandle=window.requestAnimationFrame(function(){return o.onFrame()})},s.prototype.onFrame=function(){if(this._now=this.getTimer(),this._frameDeltaTime=this._now-this._lastTimeUpdated,isNaN(this._minInterval)||this._frameDeltaTime>=this._minInterval)if(isNaN(this._maxInterval))this.update(this._frameDeltaTime*this._timeScale,!0),this._lastTimeUpdated=this._now;else for(this._interval=Math.min(this._frameDeltaTime,this._maxInterval);this._now>=this._lastTimeUpdated+this._interval;)this.update(this._interval*this._timeScale,this._now<=this._lastTimeUpdated+2*this._maxInterval),this._lastTimeUpdated+=this._interval;this._isRunning&&this.animateOnce()},s.prototype.update=function(o,a){a===void 0&&(a=!0),this._currentTick++,this._currentTime+=o,this._tickDeltaTime=o,this._onTick.dispatch(this.currentTimeSeconds,this.tickDeltaTimeSeconds,this.currentTick),a&&this._onTickOncePerFrame.dispatch(this.currentTimeSeconds,this.tickDeltaTimeSeconds,this.currentTick)},s.prototype.getTimer=function(){return Date.now()},s})();Object.defineProperty(e,"__esModule",{value:!0}),e.default=r},function(i,e,t){(function(n,r){i.exports=r()})(this,function(){return(function(n){function r(o){if(s[o])return s[o].exports;var a=s[o]={exports:{},id:o,loaded:!1};return n[o].call(a.exports,a,a.exports,r),a.loaded=!0,a.exports}var s={};return r.m=n,r.c=s,r.p="",r(0)})([function(n,r){"use strict";var s=(function(){function o(){this.functions=[]}return o.prototype.add=function(a){return this.functions.indexOf(a)===-1&&(this.functions.push(a),!0)},o.prototype.remove=function(a){var l=this.functions.indexOf(a);return l>-1&&(this.functions.splice(l,1),!0)},o.prototype.removeAll=function(){return this.functions.length>0&&(this.functions.length=0,!0)},o.prototype.dispatch=function(){for(var a=[],l=0;l<arguments.length;l++)a[l]=arguments[l];var c=this.functions.concat();c.forEach(function(u){u.apply(void 0,a)})},Object.defineProperty(o.prototype,"numItems",{get:function(){return this.functions.length},enumerable:!0,configurable:!0}),o})();Object.defineProperty(r,"__esModule",{value:!0}),r.default=s}])})}])})});var Mq=i=>new Promise(e=>setTimeout(e,i)),Ss=i=>document.querySelector(i);async function nhe(){for(let i=0;i<300&&!(window.__atlasDebug&&!Ss("#map-loading")?.checkVisibility?.());i+=1)await Mq(100)}async function ihe(){let i="";for(let e=0;e<100;e+=1){await Mq(120),await new Promise(r=>requestAnimationFrame(r)),window.advanceTime?.();let t=window.__atlasDebug.snapshot(),n=JSON.stringify([t.zoom,t.center,t.resolution,t.tileStats]);if(n===i)return;i=n}}function dp(i,e={}){window.dispatchEvent(new KeyboardEvent("keydown",{key:i,bubbles:!0,cancelable:!0,...e}))}function rhe(i,e={}){window.dispatchEvent(new KeyboardEvent("keyup",{key:i,bubbles:!0,cancelable:!0,...e}))}function she(i){Ss("#map").dispatchEvent(new KeyboardEvent("keydown",{key:i,bubbles:!0,cancelable:!0}))}function qm(i,e){i.value=e,i.dispatchEvent(new Event("change",{bubbles:!0}))}function EL(i,e){let t=Ss(i);t.value=e,t.dispatchEvent(new Event("input",{bubbles:!0}))}function ML(i,e=!1){let t=Ss("#parity-badge");t||(t=document.createElement("div"),t.id="parity-badge",t.style.cssText="position:fixed;top:8px;right:8px;z-index:9999;padding:6px 12px;font:700 13px monospace;border-radius:6px;color:#fff;pointer-events:none;",document.body.append(t)),t.style.background=e?"#b3261e":"#1a7f37",t.textContent=i}async function ohe(){let i=[],e=async d=>{await ihe(),i.push({name:d,snapshot:JSON.parse(window.render_game_to_text())})};await nhe(),localStorage.clear();let t=Ss("#volume-select"),n=t.options[0].value;qm(t,n),await e("initial"),EL("#pin-search","a"),await e("search-a");let r=Ss(".search-result");r&&(r.click(),await e("search-select-first"),Ss("#close-detail").click(),await e("detail-closed")),EL("#pin-search",""),await e("search-cleared");let s=Ss(".category-row input");s&&(s.click(),await e("category-hidden"),s.click(),await e("category-restored"));let o=Ss(".only-button");if(o){o.click(),await e("solo-first");let d=Ss("#solo-chip");d&&!d.hidden&&d.click(),await e("solo-cleared")}let a=Ss("#legend .layer-title");a&&(a.click(),await e("section-folded"),Ss("#expand-all").click(),await e("sections-unfolded")),Ss("#hide-all").click(),await e("all-hidden"),Ss("#show-all").click(),await e("all-shown");let l=Ss(".zone-index-item");l&&(l.click(),await e("zone-jumped"),l.dispatchEvent(new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0})),await e("zone-highlighted"),l.dispatchEvent(new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0})),await e("zone-unhighlighted")),dp("g"),await e("grid-open"),EL("#grid-input","m"),await e("grid-descended"),dp(" "),await e("subgrid-hidden"),dp(" "),dp("Escape"),await e("grid-ascended"),dp("Escape"),await e("grid-closed"),dp("z"),await e("labels-on"),rhe("z"),await e("labels-off"),dp("b",{metaKey:!0}),await e("sidebar-collapsed"),dp("b",{metaKey:!0}),await e("sidebar-restored"),Ss("#zoom-in").click(),await e("zoomed-in");let c=Ss("#overview-dock");c&&!Ss("#overview-shelf").hidden&&(c.click(),await e("overview-docked"),c.click(),await e("overview-undocked")),Ss("#zoom-out").click(),await e("zoomed-out"),she("Escape"),await e("viewport-escape");let u=Ss("#lens-select");u.options.length>1&&(qm(u,u.options[1].value),await e("variant-second"),qm(u,u.options[0].value),await e("variant-first"));let f=Ss("#world-select");return f.options.length>1&&(qm(f,f.options[1].value),await e("map-second"),qm(f,f.options[0].value),await e("map-first")),t.options.length>1&&(qm(t,t.options[1].value),await e("game-second"),qm(t,n),await e("game-first")),localStorage.clear(),{viewport:[window.innerWidth,window.innerHeight],steps:i}}var CL=!1;async function Cq(){if(!CL){CL=!0,ML("parity tour running\u2026");try{let i=await ohe(),e=await fetch("/parity/result",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i,null,2)}),t=(await e.text()).trim();if(!e.ok)throw new Error(`saving failed: ${e.status} ${t}`);ML(`parity tour complete \u2713 ${i.steps.length} steps`),console.log("parity tour saved to",t)}catch(i){ML(`parity tour failed: ${i}`,!0),console.error("parity tour failed",i)}finally{CL=!1}}}window.__atlasTour=Cq;window.addEventListener("keydown",i=>{i.key==="F9"&&Cq()});var on=i=>document.querySelector(i),ge={volume:on("#volume-select"),world:on("#world-select"),lens:on("#lens-select"),lensField:on("#lens-field"),legend:on("#legend"),search:on("#pin-search"),searchResults:on("#dock-results"),dock:on("#dock"),dockCount:on("#dock-count"),dockFlag:on("#dock-flag"),dockFold:on("#dock-fold"),dockRailName:on("#dock-rail-name"),visibleCount:on("#visible-count"),viewport:on("#map"),globe:on("#globe"),globeToggle:on("#globe-toggle"),layers:on("#layers"),loading:on("#map-loading"),labelsHint:on("#labels-hint"),gridHint:on("#grid-hint"),soloChip:on("#solo-chip"),overview:on("#overview"),overviewShelf:on("#overview-shelf"),overviewDock:on("#overview-dock"),overviewCanvas:on("#overview-canvas"),overviewViewport:on("#overview-viewport"),gridNavigator:on("#grid-navigator"),gridSystem:on("#grid-system"),gridSystemName:on("#grid-system-name"),gridInput:on("#grid-input"),gridBack:on("#grid-back"),subgridToggle:on("#subgrid-toggle"),detail:on("#pin-detail"),detailTitle:on("#detail-title"),detailCategory:on("#detail-category"),detailDescription:on("#detail-description"),detailID:on("#detail-id"),detailCoordinates:on("#detail-coordinates"),detailCoordinatesField:on("#detail-coordinates-field"),detailCell:on("#detail-cell"),detailCellField:on("#detail-cell-field"),detailSource:on("#detail-source"),detailSourceField:on("#detail-source-field"),detailLinks:on("#detail-links"),detailDot:on("#detail-dot"),sidebar:on("#sidebar"),mobileLegend:on("#mobile-legend"),fatal:on("#fatal-error"),fatalMessage:on("#fatal-message"),emptyState:on("#empty-state"),emptyPath:on("#empty-path"),emptyOpen:on("#empty-open"),addBundles:on("#add-bundles")};function Hm(i,e,t,n){i.replaceChildren(),e.forEach((r,s)=>{let o=document.createElement("option");o.value=n?String(r[n]):r.slug||String(s),o.textContent=r[t],i.append(o)})}var O={catalog:null,volume:null,world:null,lens:null,engine:null,projection:null,layers:null,sources:null,hiddenCollections:new Set,collapsedSections:new Set,expandedCollections:new Set,pins:[],pinByID:new Map,selectedPin:null,selectedZone:null,hoveredPin:null,labelsHeld:!1,gridEnabled:!1,gridSystem:"geohash",globeActive:!1,subgridVisible:!0,gridCell:"",zoneRecords:new Map,highlightedZones:new Set,focusedZoneID:null,labelOverrides:new Map,search:"",fitZoom:0,zoneTitleCount:0,eligibleLocations:0,tileRun:0,tileStats:{requested:0,loaded:0,errors:0,peakPending:0},overviewRun:0,overviewKey:"",overviewPointer:null,overviewDocked:!1,dockFolded:!0,dockDismissed:!1,renderedShard:0,worldRun:0,textByWorld:new Map,restore:null,settling:!1,styleCache:new Map,markerIcons:new Map};var Wf=["#4fb3d5","#c9924b","#82b56a","#c96a6a","#9581cc","#4bc9a9","#d4b04a","#6a92c9","#b08a5a","#8fb3a2"],Wm="0123456789bcdefghjkmnpqrstuvwxyz";var RL="atlas.session.v3";var Rq={light:"rgba(255, 255, 255, 0.96)",dark:"rgba(7, 9, 7, 0.98)"},Vi={labelSizePx:11,neighborLabelSizePx:10,labelInsetPx:5,labelFont:"ui-monospace, SFMono-Regular, Menlo, monospace",prefixAlpha:.55,chip:"rgba(12, 15, 22, 0.76)",neighborChip:"rgba(8, 11, 18, 0.88)",lineWhite:"#ffffff",widths:{leaf:2.5,scope:2.5,scopeBare:1.8,child:1.4,neighbor:1},childLineAlpha:.82,neighborLineAlpha:.44,leafFillAlpha:.14,childFillAlpha:.055,neighborTextAlpha:.72,dimColor:"#050810",dimBase:.3,dimStep:.06,dimCap:.52};function mT(i){let e=[...jf()],t=!0;for(let n of i){let r=Wm.indexOf(n);if(!(r<0))for(let s of[16,8,4,2,1]){if(t){let o=(e[0]+e[2])/2;r&s?e[0]=o:e[2]=o}else{let o=(e[1]+e[3])/2;r&s?e[1]=o:e[3]=o}t=!t}}return e}function PL(i,e){let t=[...jf()],[n,r]=i;if(n<t[0]||n>t[2]||r<t[1]||r>t[3])return"";let s=!0,o="";for(let a=0;a<e;a++){let l=0;for(let c of[16,8,4,2,1]){if(s){let u=(t[0]+t[2])/2;n>=u?(l|=c,t[0]=u):t[2]=u}else{let u=(t[1]+t[3])/2;r>=u?(l|=c,t[1]=u):t[3]=u}s=!s}o+=Wm[l]}return o}var IL={key:null,extent:null};function ahe(i){let t=`${jf().join(",")}|${i}`;return IL.key!==t&&(IL={key:t,extent:mT(i)}),IL.extent}var LL={slug:"geohash",name:"Geohash",short:"G",appliesTo(){return!0},maxLevel(){return 3},inputLength(){return 3},level(i){return i.length},parent(i){return i.slice(0,-1)},children(i){return[...Wm].map(e=>i+e)},childIndex(i){return Math.max(0,Wm.indexOf(i[i.length-1]))},contains(i,e){let t=ahe(i),[n,r]=e;return n>=t[0]&&n<=t[2]&&r>=t[1]&&r<=t[3]},descendTarget(i,e){return PL(e,i.length+1)},bbox:mT,center(i){let e=mT(i);return[(e[0]+e[2])/2,(e[1]+e[3])/2]},ring(i){let[e,t,n,r]=mT(i);return[[e,t],[e,r],[n,r],[n,t],[e,t]]},poleContained(){return null},label(i){return{context:i.slice(0,-1),principal:i.slice(-1)}},colorKey(i){return Math.max(0,Wm.indexOf(i[i.length-1]))%Wf.length},normalizeInput(i){return[...i.toLocaleLowerCase()].filter(e=>Wm.includes(e)).slice(0,3).join("")},parseInput(i){return i},locate(i){let e=PL(i,3);return e?{label:"Geohash",value:e}:null}};function Iq(i,e=3){return PL(i,e)}var M1=Eq(Lq());function Dq(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function sy(i,e,t){if(uH())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var r=new(i.bind.apply(i,n));return t&&oy(r,t.prototype),r}function Nq(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,hhe(n.key),n)}}function lhe(i,e,t){return e&&Nq(i.prototype,e),t&&Nq(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}function Ct(i,e){var t=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t)return(t=t.call(i)).next.bind(t);if(Array.isArray(i)||(t=fhe(i))||e&&i&&typeof i.length=="number"){t&&(i=t);var n=0;return function(){return n>=i.length?{done:!0}:{done:!1,value:i[n++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.2-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function xT(){return xT=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)({}).hasOwnProperty.call(t,n)&&(i[n]=t[n])}return i},xT.apply(null,arguments)}function GL(i){return GL=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},GL(i)}function hy(i,e){i.prototype=Object.create(e.prototype),i.prototype.constructor=i,oy(i,e)}function che(i){try{return Function.toString.call(i).indexOf("[native code]")!==-1}catch{return typeof i=="function"}}function uH(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(uH=function(){return!!i})()}function oy(i,e){return oy=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},oy(i,e)}function uhe(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function hhe(i){var e=uhe(i,"string");return typeof e=="symbol"?e:e+""}function fhe(i,e){if(i){if(typeof i=="string")return Dq(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Dq(i,e):void 0}}function D1(i){var e=typeof Map=="function"?new Map:void 0;return D1=function(t){if(t===null||!che(t))return t;if(typeof t!="function")throw new TypeError("Super expression must either be null or a function");if(e!==void 0){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return sy(t,arguments,GL(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),oy(n,t)},D1(i)}var Li=(function(){function i(t,n){this.lo=0,this.hi=0,this.lo=t,this.hi=n}var e=i.prototype;return e.isEmpty=function(){return this.lo>this.hi},e.equals=function(n){return this.lo==n.lo&&this.hi==n.hi||this.isEmpty()&&n.isEmpty()},e.center=function(){return .5*(this.lo+this.hi)},e.length=function(){return this.hi-this.lo},e.contains=function(n){return this.lo<=n&&n<=this.hi},e.containsInterval=function(n){return n.isEmpty()?!0:this.lo<=n.lo&&n.hi<=this.hi},e.interiorContains=function(n){return this.lo<n&&n<this.hi},e.interiorContainsInterval=function(n){return n.isEmpty()?!0:this.lo<n.lo&&n.hi<this.hi},e.intersects=function(n){return this.lo<=n.lo?n.lo<=this.hi&&n.lo<=n.hi:this.lo<=n.hi&&this.lo<=this.hi},e.interiorIntersects=function(n){return n.lo<this.hi&&this.lo<n.hi&&this.lo<this.hi&&n.lo<=n.hi},e.intersection=function(n){return new i(Math.max(this.lo,n.lo),Math.min(this.hi,n.hi))},e.union=function(n){return this.isEmpty()?n:n.isEmpty()?this:new i(Math.min(this.lo,n.lo),Math.max(this.hi,n.hi))},e.addPoint=function(n){return this.isEmpty()?new i(n,n):n<this.lo?new i(n,this.hi):n>this.hi?new i(this.lo,n):this},e.clampPoint=function(n){return Math.max(this.lo,Math.min(this.hi,n))},e.expanded=function(n){return this.isEmpty()?this:new i(this.lo-n,this.hi+n)},e.approxEqual=function(n,r){return r===void 0&&(r=1e-15),this.isEmpty()?n.length()<=2*r:n.isEmpty()?this.length()<=2*r:Math.abs(n.lo-this.lo)<=r&&Math.abs(n.hi-this.hi)<=r},e.directedHausdorffDistance=function(n){return this.isEmpty()?0:n.isEmpty()?1/0:Math.max(0,Math.max(this.hi-n.hi,n.lo-this.lo))},e.trunc=function(n){n===void 0&&(n=15);var r=+("1e"+n),s=function(a){return Math.round(a*r)/r};return new i(s(this.lo),s(this.hi))},e.toString=function(){var n=this.trunc(7);return"["+n.lo.toFixed(7)+", "+n.hi.toFixed(7)+"]"},i.empty=function(){return new i(1,0)},i.fromPoint=function(n){return new i(n,n)},i})();var Ci=(function(){function i(t,n){t===void 0&&(t=0),n===void 0&&(n=0),this.x=0,this.y=0,this.x=t,this.y=n}var e=i.prototype;return e.add=function(n){return new i(this.x+n.x,this.y+n.y)},e.sub=function(n){return new i(this.x-n.x,this.y-n.y)},e.mul=function(n){return new i(this.x*n,this.y*n)},e.ortho=function(){return new i(-this.y,this.x)},e.dot=function(n){return this.x*n.x+this.y*n.y},e.cross=function(n){return this.x*n.y-this.y*n.x},e.norm=function(){return Math.hypot(this.x,this.y)},e.normalize=function(){return this.x==0&&this.y==0?this:this.mul(1/this.norm())},e.trunc=function(n){n===void 0&&(n=15);var r=+("1e"+n),s=function(a){return Math.round(a*r)/r};return new i(s(this.x),s(this.y))},e.equals=function(n){return this.x===n.x&&this.y===n.y},e.toString=function(){var n=this.trunc(12);return"("+n.x.toFixed(12)+", "+n.y.toFixed(12)+")"},i})(),Hr=(function(){function i(t,n){t===void 0&&(t=new Li(0,0)),n===void 0&&(n=new Li(0,0)),this.x=t,this.y=n}var e=i.prototype;return e.isValid=function(){return this.x.isEmpty()==this.y.isEmpty()},e.isEmpty=function(){return this.x.isEmpty()},e.vertices=function(){return[new Ci(this.x.lo,this.y.lo),new Ci(this.x.hi,this.y.lo),new Ci(this.x.hi,this.y.hi),new Ci(this.x.lo,this.y.hi)]},e.vertexIJ=function(n,r){var s=this.x.lo;n==1&&(s=this.x.hi);var o=this.y.lo;return r==1&&(o=this.y.hi),new Ci(s,o)},e.lo=function(){return new Ci(this.x.lo,this.y.lo)},e.hi=function(){return new Ci(this.x.hi,this.y.hi)},e.center=function(){return new Ci(this.x.center(),this.y.center())},e.size=function(){return new Ci(this.x.length(),this.y.length())},e.containsPoint=function(n){return this.x.contains(n.x)&&this.y.contains(n.y)},e.interiorContainsPoint=function(n){return this.x.interiorContains(n.x)&&this.y.interiorContains(n.y)},e.contains=function(n){return this.x.containsInterval(n.x)&&this.y.containsInterval(n.y)},e.interiorContains=function(n){return this.x.interiorContainsInterval(n.x)&&this.y.interiorContainsInterval(n.y)},e.intersects=function(n){return this.x.intersects(n.x)&&this.y.intersects(n.y)},e.interiorIntersects=function(n){return this.x.interiorIntersects(n.x)&&this.y.interiorIntersects(n.y)},e.addPoint=function(n){return new i(this.x.addPoint(n.x),this.y.addPoint(n.y))},e.addRect=function(n){return new i(this.x.union(n.x),this.y.union(n.y))},e.clampPoint=function(n){return new Ci(this.x.clampPoint(n.x),this.y.clampPoint(n.y))},e.expanded=function(n){var r=this.x.expanded(n.x),s=this.y.expanded(n.y);return r.isEmpty()||s.isEmpty()?i.empty():new i(r,s)},e.expandedByMargin=function(n){return this.expanded(new Ci(n,n))},e.union=function(n){return new i(this.x.union(n.x),this.y.union(n.y))},e.intersection=function(n){var r=this.x.intersection(n.x),s=this.y.intersection(n.y);return r.isEmpty()||s.isEmpty()?i.empty():new i(r,s)},e.approxEqual=function(n){return this.x.approxEqual(n.x)&&this.y.approxEqual(n.y)},e.string=function(){return"["+this.lo().toString()+", "+this.hi.toString()+"]"},i.fromPoints=function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];if(r.length==0)return new i;for(var o=new i(new Li(r[0].x,r[0].x),new Li(r[0].y,r[0].y)),a=1;a<r.length;a++)o=o.addPoint(r[a]);return o},i.fromCenterSize=function(n,r){return new i(new Li(n.x-r.x/2,n.x+r.x/2),new Li(n.y-r.y/2,n.y+r.y/2))},i.fromRect=function(n){return new i(new Li(n.x.lo,n.x.hi),new Li(n.y.lo,n.y.hi))},i.empty=function(){return new i(Li.empty(),Li.empty())},i})();var Wt=(function(){function i(t,n,r){this.x=0,this.y=0,this.z=0,this.x=t,this.y=n,this.z=r}var e=i.prototype;return e.approxEqual=function(n){var r=1e-16;return Math.abs(this.x-n.x)<r&&Math.abs(this.y-n.y)<r&&Math.abs(this.z-n.z)<r},e.toString=function(){return"("+this.x.toFixed(24)+", "+this.y.toFixed(24)+", "+this.z.toFixed(24)+")"},e.norm=function(){return Math.sqrt(this.dot(this))},e.norm2=function(){return this.dot(this)},e.normalize=function(){var n=this.norm2();return n==0?new i(0,0,0):this.mul(1/Math.sqrt(n))},e.isUnit=function(){var n=5e-14;return Math.abs(this.norm2()-1)<=n},e.abs=function(){return new i(Math.abs(this.x),Math.abs(this.y),Math.abs(this.z))},e.add=function(n){return new i(this.x+n.x,this.y+n.y,this.z+n.z)},e.sub=function(n){return new i(this.x-n.x,this.y-n.y,this.z-n.z)},e.mul=function(n){return new i(n*this.x,n*this.y,n*this.z)},e.dot=function(n){return this.x*n.x+this.y*n.y+this.z*n.z||0},e.cross=function(n){return new i(this.y*n.z-this.z*n.y,this.z*n.x-this.x*n.z,this.x*n.y-this.y*n.x)},e.distance=function(n){return this.sub(n).norm()},e.angle=function(n){return Math.atan2(this.cross(n).norm(),this.dot(n))},e.ortho=function(){var n=new i(0,0,0),r=this.largestComponent();return r===i.X_AXIS?n.z=1:r===i.Y_AXIS?n.x=1:n.y=1,this.cross(n).normalize()},e.largestComponent=function(){var n=this.abs();return n.x>n.y?n.x>n.z?i.X_AXIS:i.Z_AXIS:n.y>n.z?i.Y_AXIS:i.Z_AXIS},e.smallestComponent=function(){var n=this.abs();return n.x<n.y?n.x<n.z?i.X_AXIS:i.Z_AXIS:n.y<n.z?i.Y_AXIS:i.Z_AXIS},e.equals=function(n){return this.x==n.x&&this.y==n.y&&this.z==n.z},e.cmp=function(n){return this.x<n.x?-1:this.x>n.x?1:this.y<n.y?-1:this.y>n.y?1:this.z<n.z?-1:this.z>n.z?1:0},i})();Wt.X_AXIS=0;Wt.Y_AXIS=1;Wt.Z_AXIS=2;var DL=(function(){function i(t,n,r){this.x=t,this.y=n,this.z=r}i.fromVector=function(n){return new i(new M1.BigFloat32(n.x),new M1.BigFloat32(n.y),new M1.BigFloat32(n.z))};var e=i.prototype;return e.vector=function(){return new Wt(this.x.valueOf(),this.y.valueOf(),this.z.valueOf()).normalize()},e.equals=function(n){return this.x.cmp(n.x)===0&&this.y.cmp(n.y)===0&&this.z.cmp(n.z)===0},e.toString=function(){return"("+this.x.toString()+", "+this.y.toString()+", "+this.z.toString()+")"},e.norm2=function(){return this.dot(this)},e.isUnit=function(){return this.norm2().cmp(new M1.BigFloat32(1))===0},e.abs=function(){var n=this.x.mul(this.x.getSign()),r=this.y.mul(this.y.getSign()),s=this.z.mul(this.z.getSign());return new i(n,r,s)},e.add=function(n){return new i(this.x.add(n.x),this.y.add(n.y),this.z.add(n.z))},e.sub=function(n){return new i(this.x.sub(n.x),this.y.sub(n.y),this.z.sub(n.z))},e.mul=function(n){return new i(this.x.mul(n),this.y.mul(n),this.z.mul(n))},e.mulByFloat64=function(n){return this.mul(new M1.BigFloat32(n))},e.dot=function(n){return this.x.mul(n.x).add(this.y.mul(n.y).add(this.z.mul(n.z)))},e.cross=function(n){return new i(this.y.mul(n.z).sub(this.z.mul(n.y)),this.z.mul(n.x).sub(this.x.mul(n.z)),this.x.mul(n.y).sub(this.y.mul(n.x)))},e.largestComponent=function(){var n=this.abs();return n.x.cmp(n.y)>0?n.x.cmp(n.z)>0?Wt.X_AXIS:Wt.Z_AXIS:n.y.cmp(n.z)>0?Wt.Y_AXIS:Wt.Z_AXIS},e.smallestComponent=function(){var n=this.abs();return n.x.cmp(n.y)<0?n.x.cmp(n.z)<0?Wt.X_AXIS:Wt.Z_AXIS:n.y.cmp(n.z)<0?Wt.Y_AXIS:Wt.Z_AXIS},e.isZero=function(){return this.x.isZero()&&this.y.isZero()&&this.z.isZero()},i})();var qL=Math.PI/180,pp=function(e,t){if(isNaN(e)||isNaN(t)||!isFinite(e)||t===0)return NaN;var n=e/t,r=Math.round(n);Math.abs(n-r)===.5&&(r=2*Math.round(n/2));var s=e-r*t;return s||Math.sign(e)*0},hH=function(e,t){if(isNaN(e)||isNaN(t))return NaN;if(e===t)return t;if(e===0)return t>0?Number.MIN_VALUE:-Number.MIN_VALUE;var n=new ArrayBuffer(8),r=new DataView(n);r.setFloat64(0,e,!0);var s=r.getBigUint64(0,!0);return e>0==t>e?s+=1n:s-=1n,r.setBigUint64(0,s,!0),r.getFloat64(0,!0)},dhe=function(e){var t=e&-e&0xffffffffffffffffn;if(t===0n)return 64;var n=Math.clz32(Number(t&0xffffffffn));if(n<32)return 31-n;var r=Math.clz32(Number(t>>32n&0xffffffffn));return 63-r},fH=function(e){var t=e&0xffffffffffffffffn;if(t===0n)return 64;var n=Math.clz32(Number(t>>32n&0xffffffffn));if(n<32)return 63-n;var r=Math.clz32(Number(t&0xffffffffn));return 31-r},HL=function(e,t){return e*Math.pow(2,t)},Fq=function(e){return isNaN(e)?NaN:e===0?-1/0:isFinite(e)?(e=Math.abs(e),e<Number.MIN_VALUE?-1074:Math.floor(Math.log2(e))):1/0},bc=function(e){return e},dH=function(e){return e/qL||0};var phe=function(){return 1/0},mhe=function(e){return e==1/0};var Bq=function(e){return dH(e).toFixed(7)},Oq=function(e,t,n){return n===void 0&&(n=1e-15),Math.abs(e-t)<=n};var yT=-1,N1=2,Sc=4,aD=4,jm=1e-15,ry=2220446049e-25,vT=function(e){if(e<0)return yT;if(mhe(e))return Cc();var t=2*Math.sin(.5*Math.min(Math.PI,bc(e)));return t*t},WL=function(e){return e>aD?Sc:e},PT=function(e,t){return Ahe(e)?e:Math.max(0,Math.min(aD,e+t))},bT=function(e){return e<0?-1:pH(e)?phe():2*Math.asin(.5*Math.sqrt(e))},Cc=function(){return 1/0},pH=function(e){return e==1/0},Ahe=function(e){return e<0||pH(e)};var F1=function(e){return e>=aD?Cc():e<0?0:hH(e,10)};var lD=function(e){return 4.5*ry*e+16*ry*ry};var ey=function(e,t){return vT(bT(e)+bT(t))},ghe=function(e,t){if(t==0)return e;if(e<=t)return 0;var n=e*(1-.25*t),r=t*(1-.25*e);return Math.max(0,n+r-2*Math.sqrt(n*r))},vhe=function(e){return Math.sqrt(mH(e))||0},mH=function(e){return e*(1-.25*e)||0};var to=(function(){function i(t,n){this.lo=t,this.hi=n}i.fromEndpoints=function(n,r){var s=new i(n,r);return n===-Math.PI&&r!==Math.PI&&(s.lo=Math.PI),r===-Math.PI&&n!==Math.PI&&(s.hi=Math.PI),s},i.fromPointPair=function(n,r){return n===-Math.PI&&(n=Math.PI),r===-Math.PI&&(r=Math.PI),i.positiveDistance(n,r)<=Math.PI?new i(n,r):new i(r,n)},i.emptyInterval=function(){return new i(Math.PI,-Math.PI)},i.fullInterval=function(){return new i(-Math.PI,Math.PI)};var e=i.prototype;return e.isValid=function(){return Math.abs(this.lo)<=Math.PI&&Math.abs(this.hi)<=Math.PI&&!(this.lo===-Math.PI&&this.hi!==Math.PI)&&!(this.hi===-Math.PI&&this.lo!==Math.PI)},e.isFull=function(){return this.lo===-Math.PI&&this.hi===Math.PI},e.isEmpty=function(){return this.lo===Math.PI&&this.hi===-Math.PI},e.isInverted=function(){return this.lo>this.hi},e.equals=function(n){return this.lo==n.lo&&this.hi==n.hi||this.isEmpty()&&n.isEmpty()},e.invert=function(){return new i(this.hi,this.lo)},e.center=function(){var n=.5*(this.lo+this.hi);return this.isInverted()?n<=0?n+Math.PI:n-Math.PI:n},e.length=function(){var n=this.hi-this.lo;return n>=0||(n+=2*Math.PI,n>0)?n:-1},e.fastContains=function(n){return this.isInverted()?(n>=this.lo||n<=this.hi)&&!this.isEmpty():n>=this.lo&&n<=this.hi},e.contains=function(n){return n===-Math.PI&&(n=Math.PI),this.fastContains(n)},e.containsInterval=function(n){return this.isInverted()?n.isInverted()?n.lo>=this.lo&&n.hi<=this.hi:(n.lo>=this.lo||n.hi<=this.hi)&&!this.isEmpty():n.isInverted()?this.isFull()||n.isEmpty():n.lo>=this.lo&&n.hi<=this.hi},e.interiorContains=function(n){return n===-Math.PI&&(n=Math.PI),this.isInverted()?n>this.lo||n<this.hi:n>this.lo&&n<this.hi||this.isFull()},e.interiorContainsInterval=function(n){return this.isInverted()?n.isInverted()?n.lo>this.lo&&n.hi<this.hi||n.isEmpty():n.lo>this.lo||n.hi<this.hi:n.isInverted()?this.isFull()||n.isEmpty():n.lo>this.lo&&n.hi<this.hi||this.isFull()},e.intersects=function(n){return this.isEmpty()||n.isEmpty()?!1:this.isInverted()?n.isInverted()||n.lo<=this.hi||n.hi>=this.lo:n.isInverted()?n.lo<=this.hi||n.hi>=this.lo:n.lo<=this.hi&&n.hi>=this.lo},e.interiorIntersects=function(n){return this.isEmpty()||n.isEmpty()||this.lo===this.hi?!1:this.isInverted()?n.isInverted()||n.lo<this.hi||n.hi>this.lo:n.isInverted()?n.lo<this.hi||n.hi>this.lo:n.lo<this.hi&&n.hi>this.lo||this.isFull()},i.positiveDistance=function(n,r){var s=r-n;return s>=0?s:r+Math.PI-(n-Math.PI)},e.union=function(n){return n.isEmpty()?this:this.fastContains(n.lo)?this.fastContains(n.hi)?this.containsInterval(n)?this:i.fullInterval():new i(this.lo,n.hi):this.fastContains(n.hi)?new i(n.lo,this.hi):this.isEmpty()||n.fastContains(this.lo)?n:i.positiveDistance(n.hi,this.lo)<i.positiveDistance(this.hi,n.lo)?new i(n.lo,this.hi):new i(this.lo,n.hi)},e.intersection=function(n){return n.isEmpty()?i.emptyInterval():this.fastContains(n.lo)?this.fastContains(n.hi)?n.length()<this.length()?n:this:new i(n.lo,this.hi):this.fastContains(n.hi)?new i(this.lo,n.hi):n.fastContains(this.lo)?this:i.emptyInterval()},e.addPoint=function(n){return Math.abs(n)>Math.PI?this:(n===-Math.PI&&(n=Math.PI),this.fastContains(n)?this:this.isEmpty()?new i(n,n):i.positiveDistance(n,this.lo)<i.positiveDistance(this.hi,n)?new i(n,this.hi):new i(this.lo,n))},e.expanded=function(n){if(n>=0){if(this.isEmpty())return this;if(this.length()+2*n+2*ry>=2*Math.PI)return i.fullInterval()}else{if(this.isFull())return this;if(this.length()+2*n-2*ry<=0)return i.emptyInterval()}var r=i.fromEndpoints(pp(this.lo-n,2*Math.PI),pp(this.hi+n,2*Math.PI));return r.lo<=-Math.PI&&(r.lo=Math.PI),r},e.approxEqual=function(n){return this.isEmpty()?n.length()<=2*jm:n.isEmpty()?this.length()<=2*jm:this.isFull()?n.length()>=2*(Math.PI-jm):n.isFull()?this.length()>=2*(Math.PI-jm):Math.abs(pp(n.lo-this.lo,2*Math.PI))<=jm&&Math.abs(pp(n.hi-this.hi,2*Math.PI))<=jm&&Math.abs(this.length()-n.length())<=2*jm},e.toString=function(){return"["+this.lo.toFixed(7)+", "+this.hi.toFixed(7)+"]"},e.complement=function(){return this.lo===this.hi?i.fullInterval():new i(this.hi,this.lo)},e.complementCenter=function(){return this.lo!==this.hi?this.complement().center():this.hi<=0?this.hi+Math.PI:this.hi-Math.PI},e.directedHausdorffDistance=function(n){if(n.containsInterval(this))return 0;if(n.isEmpty())return Math.PI;var r=n.complementCenter();if(this.contains(r))return i.positiveDistance(n.hi,r);var s=0;i.fromEndpoints(n.hi,r).contains(this.hi)&&(s=i.positiveDistance(n.hi,this.hi));var o=0;return i.fromEndpoints(r,n.lo).contains(this.lo)&&(o=i.positiveDistance(this.lo,n.lo)),Math.max(s,o)},e.project=function(n){if(n===-Math.PI&&(n=Math.PI),this.fastContains(n))return n;var r=i.positiveDistance(n,this.lo),s=i.positiveDistance(this.hi,n);return r<s?this.lo:this.hi},i})();var cl=4,Mc=1,$f=2,_he=[[0,1,3,2],[0,3,1,2],[2,3,1,0],[2,1,3,0]],cD=[[0,1,3,2],[0,2,3,1],[3,2,0,1],[3,1,0,2]],R1=[Mc,0,0,$f|Mc],AH=[],gH=[];mp(0,0,0,0,0,0);mp(0,0,0,Mc,0,Mc);mp(0,0,0,$f,0,$f);mp(0,0,0,Mc|$f,0,Mc|$f);function mp(i,e,t,n,r,s){if(i==cl){var o=(e<<cl)+t;gH[(o<<2)+n]=(r<<2)+s,AH[(r<<2)+n]=(o<<2)+s;return}i++,e<<=1,t<<=1,r<<=2;var a=cD[s];mp(i,e+(a[0]>>1),t+(a[0]&1),n,r,s^R1[0]),mp(i,e+(a[1]>>1),t+(a[1]&1),n,r+1,s^R1[1]),mp(i,e+(a[2]>>1),t+(a[2]&1),n,r+2,s^R1[2]),mp(i,e+(a[3]>>1),t+(a[3]&1),n,r+3,s^R1[3])}var xhe=3,vH=6,_i=30,fy=2*_i+1,ul=Number(1n<<BigInt(_i)),vp=BigInt(vH)<<BigInt(fy),Uq=Number(BigInt(ul)<<1n),Ap=function(e){return e>Uq?1:e/Uq},Tc=function(e){return e>=.5?1/3*(4*e*e-1):1/3*(1-4*(1-e)*(1-e))},sh=function(e){return e>=0?.5*Math.sqrt(1+3*e):1-.5*Math.sqrt(1-3*e)},ay=function(e){var t=e.largestComponent();switch(t){case Wt.X_AXIS:e.x<0&&(t+=3);break;case Wt.Y_AXIS:e.y<0&&(t+=3);break;case Wt.Z_AXIS:e.z<0&&(t+=3);break}return t},Ym=function(e,t){switch(e){case 0:return[t.y/t.x,t.z/t.x];case 1:return[-t.x/t.y,t.z/t.y];case 2:return[-t.x/t.z,-t.y/t.z];case 3:return[t.z/t.x,t.y/t.x];case 4:return[t.z/t.y,-t.x/t.y];default:return[-t.y/t.z,-t.x/t.z]}},wT=function(e){var t=ay(e),n=Ym(t,e),r=n[0],s=n[1];return[t,r,s]},oh=function(e,t,n){switch(e){case 0:return new Wt(1,t,n);case 1:return new Wt(-t,1,n);case 2:return new Wt(-t,-n,1);case 3:return new Wt(-1,-n,-t);case 4:return new Wt(n,-1,-t);default:return new Wt(n,t,-1)}},yhe=function(e,t){switch(e){case 0:if(t.x<=0)return[0,0,!1];break;case 1:if(t.y<=0)return[0,0,!1];break;case 2:if(t.z<=0)return[0,0,!1];break;case 3:if(t.x>=0)return[0,0,!1];break;case 4:if(t.y>=0)return[0,0,!1];break;default:if(t.z>=0)return[0,0,!1];break}var n=Ym(e,t),r=n[0],s=n[1];return[r,s,!0]},_p=function(e,t){switch(e){case 0:return new Wt(t.y,t.z,t.x);case 1:return new Wt(-t.x,t.z,t.y);case 2:return new Wt(-t.x,-t.y,t.z);case 3:return new Wt(-t.z,-t.y,-t.x);case 4:return new Wt(-t.z,t.x,-t.y);default:return new Wt(t.y,t.x,-t.z)}},_T=function(e,t,n){return oh(e,Tc(Ap(t)),Tc(Ap(n)))},kq=function(e,t){switch(e){case 0:return new Wt(t,-1,0);case 1:return new Wt(1,t,0);case 2:return new Wt(1,0,t);case 3:return new Wt(-t,0,1);case 4:return new Wt(0,-t,1);default:return new Wt(0,-1,-t)}},zq=function(e,t){switch(e){case 0:return new Wt(-t,0,1);case 1:return new Wt(0,-t,1);case 2:return new Wt(0,-1,-t);case 3:return new Wt(t,-1,0);case 4:return new Wt(1,t,0);default:return new Wt(1,0,t)}},bhe=[[new Wt(0,1,0),new Wt(0,0,1),new Wt(1,0,0)],[new Wt(-1,0,0),new Wt(0,0,1),new Wt(0,1,0)],[new Wt(-1,0,0),new Wt(0,-1,0),new Wt(0,0,1)],[new Wt(0,0,-1),new Wt(0,-1,0),new Wt(-1,0,0)],[new Wt(0,0,-1),new Wt(1,0,0),new Wt(0,-1,0)],[new Wt(0,1,0),new Wt(1,0,0),new Wt(0,0,-1)]],whe=[[[4,1],[5,2],[3,0]],[[0,3],[5,2],[4,1]],[[0,3],[1,4],[5,2]],[[2,5],[1,4],[0,3]],[[2,5],[3,0],[1,4]],[[4,1],[3,0],[2,5]]],_H=function(e,t){return bhe[e][t]},ST=function(e,t,n){return whe[e][t][n]},She=function(e){return _H(e,0)},The=function(e){return _H(e,1)},jL=Math.PI/2,Vq=-jL,ar=(function(){function i(t,n){this.lat=t,this.lng=n}i.fromDegrees=function(n,r){return new i(n*qL,r*qL)},i.latitude=function(n){var r=n.vector;return Math.atan2(r.z,Math.sqrt(r.x*r.x+r.y*r.y))},i.longitude=function(n){return Math.atan2(n.vector.y,n.vector.x)},i.fromPoint=function(n){return new i(this.latitude(n),this.longitude(n))};var e=i.prototype;return e.isValid=function(){return Math.abs(this.lat)<=Math.PI/2&&Math.abs(this.lng)<=Math.PI},e.normalized=function(){var n=this.lat;n>jL?n=jL:n<Vq&&(n=Vq);var r=pp(this.lng,2*Math.PI);return new i(n,r)},e.toString=function(){return"["+Bq(this.lat)+", "+Bq(this.lng)+"]"},e.distance=function(n){var r=Math.sin(.5*(n.lat-this.lat)),s=Math.sin(.5*(n.lng-this.lng)),o=r*r+s*s*Math.cos(this.lat)*Math.cos(n.lat);return 2*Math.atan2(Math.sqrt(o),Math.sqrt(Math.max(0,1-o)))},e.approxEqual=function(n){return Oq(this.lat,n.lat)&&Oq(this.lng,n.lng)},i})(),Ehe=function(e,t){return new We(e[0][t],e[1][t],e[2][t])},NL=function(e,t,n){return e[0][t]=n.x,e[1][t]=n.y,e[2][t]=n.z,e},xH=function(e,t){return new We(e[0][0]*t.x+e[0][1]*t.y+e[0][2]*t.z,e[1][0]*t.x+e[1][1]*t.y+e[1][2]*t.z,e[2][0]*t.x+e[2][1]*t.y+e[2][2]*t.z)},Mhe=function(e){return[[e[0][0],e[1][0],e[2][0]],[e[0][1],e[1][1],e[2][1]],[e[0][2],e[1][2],e[2][2]]]},uD=function(e){var t=[[0,0,0],[0,0,0],[0,0,0]];return NL(t,2,e),NL(t,1,We.ortho(e)),NL(t,0,We.fromVector(Ehe(t,1).vector.cross(e.vector))),t},Che=function(e,t){return xH(Mhe(e),t)},Rhe=function(e,t){return xH(e,t)},TT=-1,Xf=0,k1=1,yH=1e-15,Ki=2220446049250313e-31,Gq=1.8274*Ki,Ihe=3.2321*Ki,XL=function(e,t,n){return n.vector.cross(e.vector).dot(t.vector)>0},Xm=function(e,t,n){var r=$L(e,t,n);return r===Xf&&(r=YL(e,t,n)),r},Phe=function(e,t,n){var r=t.vector.sub(e.vector),s=r.norm2(),o=n.vector.sub(t.vector),a=o.norm2(),l=e.vector.sub(n.vector),c=l.norm2(),u,f,d;s>=a&&s>=c?(u=l,f=o,d=n.vector):a>=c?(u=r,f=l,d=e.vector):(u=o,f=r,d=t.vector);var A=-u.cross(f).dot(d),y=Ihe*Math.sqrt(u.norm2()*f.norm2());return A>y?k1:A<-y?TT:Xf},$L=function(e,t,n){var r=e.vector.cross(t.vector).dot(n.vector);return r>Gq?k1:r<-Gq?TT:Xf},YL=function(e,t,n){if(e.equals(t)||t.equals(n)||n.equals(e))return Xf;var r=Phe(e,t,n);return r!==Xf?r:Lhe(e,t,n,!0)},Lhe=function(e,t,n,r){var s=k1,o=e,a=t,l=n;if(o.vector.cmp(a.vector)>0){var c=[a,o];o=c[0],a=c[1],s=-s}if(a.vector.cmp(l.vector)>0){var u=[l,a];a=u[0],l=u[1],s=-s}if(o.vector.cmp(a.vector)>0){var f=[a,o];o=f[0],a=f[1],s=-s}var d=DL.fromVector(o.vector),A=DL.fromVector(a.vector),y=DL.fromVector(l.vector),w=A.cross(y),S=d.dot(w),T=S.getSign();return T===Xf&&r&&(T=Dhe(d,A,y,w)),s*T},Dhe=function(e,t,n,r){var s=r.z.getSign();return s!==0||(s=r.y.getSign(),s!==0)||(s=r.x.getSign(),s!==0)||(s=n.x.mul(e.y).sub(n.y.mul(e.x)).getSign(),s!==0)||(s=n.x.getSign(),s!==0)||(s=-n.y.getSign(),s!==0)||(s=n.z.mul(e.x).sub(n.x.mul(e.z)).getSign(),s!==0)||(s=n.z.getSign(),s!==0)||(s=e.x.mul(t.y).sub(e.y.mul(t.x)).getSign(),s!==0)||(s=-t.x.getSign(),s!==0)||(s=t.y.getSign(),s!==0)||(s=e.x.getSign(),s!==0)?s:k1},We=(function(){function i(t,n,r){this.vector=new Wt(t,n,r)}i.fromVector=function(n){return new i(n.x,n.y,n.z)},i.fromLatLng=function(n){var r=n.lat,s=n.lng,o=Math.cos(r);return new i(Math.cos(s)*o,Math.sin(s)*o,Math.sin(r))},i.fromCoords=function(n,r,s){return n===0&&r===0&&s===0?this.originPoint():i.fromVector(new Wt(n,r,s).normalize())},i.originPoint=function(){return new i(-.00999946643502502,.002592454260932412,.999946643502502)};var e=i.prototype;return e.pointCross=function(n){var r=this.vector.add(n.vector).cross(n.vector.sub(this.vector));return r.x===0&&r.y===0&&r.z===0&&(r=this.vector.ortho()),i.fromVector(r)},i.orderedCCW=function(n,r,s,o){var a=0;return Xm(r,o,n)!==TT&&a++,Xm(s,o,r)!==TT&&a++,Xm(n,o,s)===k1&&a++,a>=2},e.distance=function(n){return this.vector.angle(n.vector)},e.equals=function(n){return this.vector.equals(n.vector)},e.approxEqual=function(n,r){return r===void 0&&(r=yH),this.vector.angle(n.vector)<=r},e.stableAngle=function(n){return 2*Math.atan2(this.vector.sub(n.vector).norm(),this.vector.add(n.vector).norm())},i.chordAngleBetweenPoints=function(n,r){return Math.min(4,n.vector.sub(r.vector).norm2())},i.regularPoints=function(n,r,s){return this.regularPointsForFrame(uD(n),r,s)},i.regularPointsForFrame=function(n,r,s){for(var o=Math.cos(r),a=Math.sin(r),l=2*Math.PI/s,c=[],u=0;u<s;u++){var f=u*l,d=new i(a*Math.cos(f),a*Math.sin(f),o);c.push(i.fromVector(Rhe(n,d).vector.normalize()))}return c},e.containsCell=function(n){return!1},e.intersectsCell=function(n){return n.containsPoint(this)},e.containsPoint=function(n){return this.contains(n)},e.cellUnionBound=function(){return[V1(this)]},e.contains=function(n){return this.equals(n)},e.referenceDir=function(){return i.ortho(this)},e.toString=function(){return this.vector.toString()},i.ortho=function(n){var r=n.vector.largestComponent(),s=new Wt(.012,.0053,.00457);return r===Wt.X_AXIS?s.z=1:r===Wt.Y_AXIS?s.x=1:s.y=1,i.fromVector(n.vector.cross(s).normalize())},i.sortPoints=function(n){n.sort(function(r,s){return r.vector.cmp(s.vector)})},lhe(i,[{key:"x",get:function(){return this.vector.x}},{key:"y",get:function(){return this.vector.y}},{key:"z",get:function(){return this.vector.z}}])})(),ET=function(e,t,n){return e<t?t:e>n?n:e},Nhe=function(e){for(var t=e,n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];for(var o=0,a=r;o<a.length;o++){var l=a[o];l>t&&(t=l)}return t},Fhe=function(e){for(var t=e,n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];for(var o=0,a=r;o<a.length;o++){var l=a[o];l<t&&(t=l)}return t},Bhe=function(e){return e<0n?-e:e},ZL=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return Nhe.apply(void 0,[e].concat(n))},FL=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return Fhe.apply(void 0,[e].concat(n))},KL=function(e,t){for(var n=0,r=e;n<r;){var s=Math.floor((n+r)/2);t(s)?r=s:n=s+1}return n},hl=(1n<<64n)-1n,fu=function(e){return Number(e>>BigInt(fy))},Ohe=function(e){return e&hl>>BigInt(xhe)},no=function(e){return _i-(dhe(e)>>>1)},Sr=function(e,t){var n=Zm(t);return e&-n|n},hD=function(e){var t=as(e)<<2n;return e&-t|t},dy=function(e){return(e&Zm(0)-1n)===0n},ly=function(e){return typeof e!="bigint"||BigInt.asUintN(64,e)!=e?!1:fu(e)<=vH&&(as(e)&0x1555555555555555n)!=0n},fD=function(e){return(e&1n)!=0n},bH=function(e,t){return Number(e>>2n*BigInt(_i-t)+1n)&3},as=function(e){return e&-e},Zm=function(e){return 1n<<BigInt(2*(_i-e))},z1=function(e){var t=[e,e,e,e],n=as(e);return t[0]=e-n+(n>>2n),n>>=1n,t[1]=t[0]+n,t[2]=t[1]+n,t[3]=t[2]+n,t},wH=function(e,t){var n=[],r=Sp(e),s=r.f,o=r.i,a=r.j,l=Ca(no(e));o&=-l,a&=-l;for(var c=Ca(t),u=-c;;u+=c){var f=void 0;if(u<0?f=a+u>=0:u>=l?f=a+u<ul:(f=!0,n.push(Sr(gp(s,o+u,a-c,a-l>=0),t)),n.push(Sr(gp(s,o+u,a+l,a+l<ul),t))),n.push(Sr(gp(s,o-c,a+u,f&&o-l>=0),t)),n.push(Sr(gp(s,o+l,a+u,f&&o+l<ul),t)),u>=l)break}return n},qi=function(e){return e-(as(e)-1n)},Gi=function(e){return e+(as(e)-1n)},$m=function(e,t){return qi(e)<=t&&t<=Gi(e)},SH=function(e,t){return qi(t)<=Gi(e)&&Gi(t)>=qi(e)},Uhe=function(e){var t=e.toString(16).padStart(16,"0").replace(/0+$/,"");return t.length===0?"X":t},khe=function(e){if(e.length>16||!/^[A-F0-9]+$/i.test(e))return 0n;var t=BigInt("0x"+e);return e.length<16&&(t=t<<BigInt(4*(16-e.length))),t},zhe=function(e){if(!ly(e))return"Invalid: "+e.toString(16);for(var t=fu(e)+"/",n=1;n<=no(e);n++)t+=bH(e,n);return t},Vhe=function(e){var t=e.length-2;if(t<0||t>_i)return 0n;var n=parseInt(e[0],10);if(isNaN(n)||n<0||n>5||e[1]!=="/")return 0n;for(var r=yp(n),s=2;s<e.length;s++){var o=parseInt(e[s],10);if(isNaN(o)||o<0||o>3)return 0n;r=z1(r)[o]}return r},Ghe=function(e,t,n){return Sr((BigInt(e)<<BigInt(fy))+(t||1n),n)},yp=function(e){return(BigInt(e)<<BigInt(fy))+Zm(0)},V1=function(e){var t=wT(e.vector),n=t[0],r=t[1],s=t[2],o=zl(sh(r)),a=zl(sh(s));return py(n,o,a)},TH=function(e){return V1(We.fromLatLng(e))},zl=function(e){return ET(Math.floor(ul*e),0,ul-1)},Ca=function(e){return 1<<ET(_i-e,0,_i)},EH=function(e){return I1(Ca(e))},I1=function(e){return e/ul},MH=function(e){var t=dD(e),n=t.si,r=t.ti;return new Ci(Tc(Ap(n)),Tc(Ap(r)))},qhe=function(e){var t=Sp(e),n=t.i,r=t.j;return LT(n,r,no(e))},py=function(e,t,n){for(var r=BigInt(e)<<BigInt(fy-1),s=e&Mc,o=7;o>=0;o--){var a=(1<<cl)-1;s+=(t>>o*cl&a)<<cl+2,s+=(n>>o*cl&a)<<2,s=gH[s],r|=BigInt(s>>2)<<BigInt(o*2*cl),s&=Mc|$f}return r*2n+1n},P1=function(e,t,n){t=ET(t,-1,ul),n=ET(n,-1,ul);var r=1/ul,s=hH(1,2),o=Math.max(-s,Math.min(s,r*(Number(BigInt(t)<<1n)+1-ul))),a=Math.max(-s,Math.min(s,r*(Number(BigInt(n)<<1n)+1-ul))),l=wT(oh(e,o,a));return e=l[0],o=l[1],a=l[2],py(e,zl(.5*(o+1)),zl(.5*(a+1)))},gp=function(e,t,n,r){return r?py(e,t,n):P1(e,t,n)},Sp=function(e){for(var t=fu(e),n=t&Mc,r=_i-7*cl,s=0,o=0,a=7;a>=0;a--)n+=Number((e>>BigInt(a*2*cl+1)&(1n<<BigInt(2*r))-1n)<<2n),n=AH[n],s+=n>>cl+2<<a*cl,o+=(n>>2&(1<<cl)-1)<<a*cl,n&=Mc|$f,r=cl;return(as(e)&BigInt("0x1111111111111110"))!=0n&&(n^=Mc),{f:t,i:s,j:o,orientation:n}},dD=function(e){var t=Sp(e),n=t.f,r=t.i,s=t.j,o=0;return fD(e)?o=1:((BigInt(r)^e>>2n)&1n)!=0n&&(o=2),{face:n,si:2*r+o,ti:2*s+o}},LT=function(e,t,n){var r=Ca(n),s=e&-r,o=t&-r;return new Hr(new Li(Tc(I1(s)),Tc(I1(s+r))),new Li(Tc(I1(o)),Tc(I1(o+r))))},Hhe=function(e){return e>>2n*BigInt(_i-no(e))+1n},my=function(e){var t=dD(e),n=t.face,r=t.si,s=t.ti;return _T(n,r,s)},pD=function(e){return We.fromVector(my(e).normalize())},Whe=function(e){return ar.fromPoint(We.fromVector(my(e)))},jhe=function(e){var t=no(e),n=Ca(t),r=Sp(e),s=r.f,o=r.i,a=r.j;return[Sr(P1(s,o,a-n),t),Sr(P1(s,o+n,a),t),Sr(P1(s,o,a+n),t),Sr(P1(s,o-n,a),t)]},CH=function(e,t){var n=Ca(t+1),r=n<<1,s=Sp(e),o=s.f,a=s.i,l=s.j,c=!1,u=!1,f=0,d=0;(a&n)!=0?(f=r,c=a+r<ul):(f=-r,c=a-r>=0),(l&n)!=0?(d=r,u=l+r<ul):(d=-r,u=l-r>=0);var A=[Sr(e,t),Sr(gp(o,a+f,l,c),t),Sr(gp(o,a,l+d,u),t)];return(c||u)&&A.push(Sr(gp(o,a+f,l+d,c&&u),t)),A},mD=function(e){var t=as(e);return e-t+(t>>2n)},Ay=function(e,t){return e-as(e)+Zm(t)},RH=function(e){var t=as(e);return e+t+(t>>2n)},DT=function(e,t){return e+as(e)+Zm(t)},Ia=function(e){return e+(as(e)<<1n)&hl},IH=function(e){return e-(as(e)<<1n)&hl},Xhe=function(e){var t=Ia(e);return t<vp?t:t-vp&hl},$he=function(e){var t=IH(e);return t<vp?t:t+vp&hl},Yhe=function(e,t){if(t===0n)return e;var n=BigInt(2*(_i-no(e))+1);if(t<0n){var r=-(e>>n);if(t<r){var s=vp>>n;t%=s,t<r&&(t+=s)}}else{var o=vp-e>>n;if(t>o){var a=vp>>n;t%=a,t>o&&(t-=a)}}return e+(t<<Bhe(n))},cy=function(e,t){var n=e^t;n<as(e)&&(n=as(e)),n<as(t)&&(n=as(t));var r=fH(n);return r>60?[0,!1]:[60-r>>1,!0]},QL=function(e,t){var n=qi(e);if(n>=qi(t))return t;if(Gi(e)>=t){for(;e=z1(e)[0],!(Gi(e)<t););return e}for(;!dy(e);){var r=hD(e);if(qi(r)!==n||Gi(r)>=t)break;e=r}return e},Zhe=function(e,t){if(t===0n)return e;var n=BigInt(2*(_i-no(e))+1);if(t<0n){var r=-(e>>n);t<r&&(t=r)}else{var s=vp+as(e)-e>>n;t>s&&(t=s)}return e+(t<<n)},JL=function(e,t){return e<t?-1:e>t?1:0},Khe=function(e,t){return e>t?-1:e<t?1:0},Qhe={__proto__:null,SentinelCellID:hl,face:fu,pos:Ohe,level:no,parent:Sr,immediateParent:hD,isFace:dy,valid:ly,isLeaf:fD,childPosition:bH,lsb:as,lsbForLevel:Zm,children:z1,allNeighbors:wH,rangeMin:qi,rangeMax:Gi,contains:$m,intersects:SH,toToken:Uhe,fromToken:khe,toString:zhe,fromString:Vhe,fromFacePosLevel:Ghe,fromFace:yp,fromPoint:V1,fromLatLng:TH,stToIJ:zl,sizeIJ:Ca,sizeST:EH,ijToSTMin:I1,centerUV:MH,boundUV:qhe,fromFaceIJ:py,fromFaceIJWrap:P1,fromFaceIJSame:gp,faceIJOrientation:Sp,faceSiTi:dD,ijLevelToBoundUV:LT,distanceFromBegin:Hhe,rawPoint:my,point:pD,latLng:Whe,edgeNeighbors:jhe,vertexNeighbors:CH,childBegin:mD,childBeginAtLevel:Ay,childEnd:RH,childEndAtLevel:DT,next:Ia,prev:IH,nextWrap:Xhe,prevWrap:$he,advanceWrap:Yhe,commonAncestorLevel:cy,maxTile:QL,advance:Zhe,ascending:JL,descending:Khe},Gl=(function(){function i(t,n){var r=t.pointCross(n);this.a=t,this.b=n,this.aXb=We.fromVector(t.vector.cross(n.vector)),this.aTangent=We.fromVector(t.vector.cross(r.vector)),this.bTangent=We.fromVector(r.vector.cross(n.vector)),this.c=new We(0,0,0),this.acb=Ec}i.newChainEdgeCrosser=function(n,r,s){var o=new i(n,r);return o.restartAt(s),o};var e=i.prototype;return e.crossingSign=function(n,r){return n.equals(this.c)||this.restartAt(n),this.chainCrossingSign(r)},e.edgeOrVertexCrossing=function(n,r){return n.equals(this.c)||this.restartAt(n),this.edgeOrVertexChainCrossing(r)},e.restartAt=function(n){this.c=n,this.acb=-$L(this.a,this.b,this.c)},e.chainCrossingSign=function(n){var r=$L(this.a,this.b,n);return this.acb===-r&&r!==Xf?(this.c=n,this.acb=-r,Vl):this._crossingSign(n,r)},e.edgeOrVertexChainCrossing=function(n){var r=We.fromVector(this.c.vector);switch(this.chainCrossingSign(n)){case Vl:return!1;case Ec:return!0}return LH(this.a,this.b,r,n)},e._crossingSign=function(n,r){var s=(1.5+1/Math.sqrt(3))*Ki;if(this.c.vector.dot(this.aTangent.vector)>s&&n.vector.dot(this.aTangent.vector)>s||this.c.vector.dot(this.bTangent.vector)>s&&n.vector.dot(this.bTangent.vector)>s)return this.c=n,this.acb=-r,Vl;if(this.a.equals(this.c)||this.a.equals(n)||this.b.equals(this.c)||this.b.equals(n))return this.c=n,this.acb=-r,MT;if(this.a.equals(this.b)||this.c.equals(n))return this.c=n,this.acb=-r,Vl;if(this.acb===Xf&&(this.acb=-YL(this.a,this.b,this.c)),r===Xf&&(r=YL(this.a,this.b,n)),r!==this.acb)return this.c=n,this.acb=-r,Vl;var o=-Xm(this.c,n,this.b);if(o!==this.acb)return this.c=n,this.acb=-r,Vl;var a=Xm(this.c,n,this.a);return a!==this.acb?(this.c=n,this.acb=-r,Vl):(this.c=n,this.acb=-r,Ec)},i})(),Ec=0,MT=1,Vl=2,PH=function(e,t,n,r){var s=Gl.newChainEdgeCrosser(e,t,n);return s.chainCrossingSign(r)},LH=function(e,t,n,r){if(e.equals(t)||n.equals(r))return!1;switch(!0){case e.equals(n):return t.equals(r)||We.orderedCCW(e.referenceDir(),r,t,e);case t.equals(r):return We.orderedCCW(t.referenceDir(),n,e,t);case e.equals(r):return t.equals(n)||We.orderedCCW(e.referenceDir(),n,t,e);case t.equals(n):return We.orderedCCW(t.referenceDir(),r,e,t)}return!1},Jhe=function(e,t,n){return!We.orderedCCW(t.referenceDir(),n,e,t)},Ri=(function(){function i(t,n){this.lat=t,this.lng=n}i.emptyRect=function(){return new i(Li.empty(),to.emptyInterval())},i.fullRect=function(){return new i(i.validRectLatRange,i.validRectLngRange)},i.fromLatLng=function(n){return new i(new Li(bc(n.lat),bc(n.lat)),new to(bc(n.lng),bc(n.lng)))},i.fromCenterSize=function(n,r){var s=new ar(r.lat/2,r.lng/2);return i.fromLatLng(n).expanded(s)};var e=i.prototype;return e.equals=function(n){return this.lat.equals(n.lat)&&this.lng.equals(n.lng)},e.isValid=function(){return Math.abs(this.lat.lo)<=Math.PI/2&&Math.abs(this.lat.hi)<=Math.PI/2&&this.lng.isValid()&&this.lat.isEmpty()===this.lng.isEmpty()},e.isEmpty=function(){return this.lat.isEmpty()},e.isFull=function(){return this.lat.equals(i.validRectLatRange)&&this.lng.isFull()},e.isPoint=function(){return this.lat.lo===this.lat.hi&&this.lng.lo===this.lng.hi},e.vertex=function(n){var r,s;switch(n){case 0:r=this.lat.lo,s=this.lng.lo;break;case 1:r=this.lat.lo,s=this.lng.hi;break;case 2:r=this.lat.hi,s=this.lng.hi;break;default:r=this.lat.hi,s=this.lng.lo;break}return new ar(r,s)},e.lo=function(){return new ar(this.lat.lo,this.lng.lo)},e.hi=function(){return new ar(this.lat.hi,this.lng.hi)},e.center=function(){return new ar(this.lat.center(),this.lng.center())},e.size=function(){return new ar(this.lat.length(),this.lng.length())},e.area=function(){if(this.isEmpty())return 0;var n=Math.abs(Math.sin(this.lat.hi)-Math.sin(this.lat.lo));return this.lng.length()*n},e.addPoint=function(n){return n.isValid()?new i(this.lat.addPoint(bc(n.lat)),this.lng.addPoint(bc(n.lng))):this},e.expanded=function(n){var r=this.lat.expanded(bc(n.lat)),s=this.lng.expanded(bc(n.lng));return r.isEmpty()||s.isEmpty()?i.emptyRect():new i(r.intersection(i.validRectLatRange),s)},e.toString=function(){return"[Lo"+this.lo()+", Hi"+this.hi()+"]"},e.polarClosure=function(){return this.lat.lo===-Math.PI/2||this.lat.hi===Math.PI/2?new i(this.lat,to.fullInterval()):this},e.union=function(n){return new i(this.lat.union(n.lat),this.lng.union(n.lng))},e.intersection=function(n){var r=this.lat.intersection(n.lat),s=this.lng.intersection(n.lng);return r.isEmpty()||s.isEmpty()?i.emptyRect():new i(r,s)},e.intersects=function(n){return this.lat.intersects(n.lat)&&this.lng.intersects(n.lng)},e.capBound=function(){if(this.isEmpty())return xp.emptyCap();var n,r;this.lat.hi+this.lat.lo<0?(n=-1,r=Math.PI/2+this.lat.hi):(n=1,r=Math.PI/2-this.lat.lo);var s=xp.fromCenterAngle(new We(0,0,n),r);if(pp(this.lng.hi-this.lng.lo,2*Math.PI)>=0&&this.lng.hi-this.lng.lo<2*Math.PI){var o=xp.fromPoint(We.fromLatLng(this.center())).addPoint(We.fromLatLng(this.lo())).addPoint(We.fromLatLng(this.hi()));if(o.height()<s.height())return o}return s},e.rectBound=function(){return this},e.contains=function(n){return this.lat.containsInterval(n.lat)&&this.lng.containsInterval(n.lng)},e.containsCell=function(n){return this.contains(n.rectBound())},e.containsLatLng=function(n){return n.isValid()?this.lat.contains(bc(n.lat))&&this.lng.contains(bc(n.lng)):!1},e.containsPoint=function(n){return this.containsLatLng(ar.fromPoint(n))},e.cellUnionBound=function(){return this.capBound().cellUnionBound()},e.approxEqual=function(n){return this.lat.approxEqual(n.lat)&&this.lng.approxEqual(n.lng)},i.bisectorIntersection=function(n,r){r=Math.abs(r);var s=n.center(),o=new ar(s-Math.PI/2,r);s<0&&(o=new ar(-s-Math.PI/2,r-Math.PI));var a=new We(0,-1,0);return a.pointCross(We.fromLatLng(o))},e.centroid=function(){if(this.isEmpty())return new We(0,0,0);var n=Math.sin(this.lat.lo),r=Math.sin(this.lat.hi),s=Math.cos(this.lat.lo),o=Math.cos(this.lat.hi),a=.5*this.lng.length(),l=Math.sin(a)*(o*r-s*n+this.lat.length()),c=this.lng.center(),u=a*(r+n)*(r-n);return new We(l*Math.cos(c),l*Math.sin(c),u)},e.intersectsCell=function(n){if(this.isEmpty())return!1;if(this.containsPoint(We.fromVector(my(n.id)))||n.containsPoint(We.fromLatLng(this.center())))return!0;if(!this.intersects(n.rectBound()))return!1;for(var r=[],s=[],o=0;o<4;o++){var a=n.vertex(o);r.push(a);var l=ar.fromPoint(a);if(s.push(l),this.containsLatLng(l)||n.containsPoint(We.fromLatLng(this.vertex(o))))return!0}for(var c=0;c<4;c++){var u=to.fromEndpoints(s[c].lng,s[c+1&3].lng);if(this.lng.intersects(u)){var f=r[c],d=r[c+1&3];if(u.contains(this.lng.lo)&&Hq(f,d,this.lat,this.lng.lo)||u.contains(this.lng.hi)&&Hq(f,d,this.lat,this.lng.hi)||qq(f,d,this.lat.lo,this.lng)||qq(f,d,this.lat.hi,this.lng))return!0}}return!1},i})();Ri.validRectLatRange=new Li(-Math.PI/2,Math.PI/2);Ri.validRectLngRange=to.fullInterval();var qq=function(e,t,n,r){var s=e.vector.cross(t.vector).normalize();s.z<0&&(s=s.mul(-1));var o=s.cross(We.fromCoords(0,0,1).vector).normalize(),a=o.cross(s),l=Math.sin(bc(n));if(Math.abs(l)>=a.z)return!1;var c=l/a.z,u=Math.sqrt(1-c*c),f=Math.atan2(u,c),d=to.fromPointPair(Math.atan2(e.vector.dot(o),e.vector.dot(a)),Math.atan2(t.vector.dot(o),t.vector.dot(a)));if(d.contains(f)){var A=a.mul(c).add(o.mul(u));if(r.contains(Math.atan2(A.y,A.x)))return!0}if(d.contains(-f)){var y=a.mul(c).sub(o.mul(u));if(r.contains(Math.atan2(y.y,y.x)))return!0}return!1},Hq=function(e,t,n,r){return PH(e,t,We.fromLatLng(new ar(n.lo,r)),We.fromLatLng(new ar(n.hi,r)))===Ec},AD=(function(){function i(t,n){this.dim=t,this.deriv=n}var e=i.prototype;return e.value=function(n){return HL(this.deriv,-this.dim*n)},e.minLevel=function(n){if(n<=0)return _i;var r=-(Fq(n/this.deriv)>>this.dim-1);return r>_i&&(r=_i),r<0&&(r=0),r||0},e.maxLevel=function(n){if(n<=0)return _i;var r=Fq(this.deriv/n)>>this.dim-1;return r>_i&&(r=_i),r<0&&(r=0),r||0},e.closestLevel=function(n){var r=Math.SQRT2;return this.dim===2&&(r=2),this.minLevel(r*n)},i})(),eD=new AD(1,2*Math.SQRT2/3),efe=new AD(1,1.4592137463861061),tD=new AD(2,4*Math.PI/6),tfe=function(e,t,n){return bT(gD(e,t,n,0,!0).dist)},du=function(e,t,n,r){return gD(e,t,n,r,!1)},Wq=function(e,t,n,r){var s=ZL(We.chordAngleBetweenPoints(e,t),We.chordAngleBetweenPoints(e,n));if(s>N1){var o=gD(We.fromVector(e.vector.mul(-1)),t,n,s,!0);s=o.dist,s=Sc-s}return r<s?{dist:s,less:!0}:{dist:r,less:!1}},DH=function(e,t,n){var r=t.pointCross(n),s=e.vector.sub(r.vector.mul(e.vector.dot(r.vector)/r.vector.norm2()));return XL(r,t,We.fromVector(s))&&XL(We.fromVector(s),n,r)?We.fromVector(s.normalize()):e.vector.sub(t.vector).norm2()<=e.vector.sub(n.vector).norm2()?t:n},NH=function(e,t,n){var r=e,s=t.pointCross(n),o=s.vector.cross(t.vector);return We.fromVector(t.vector.mul(Math.cos(r)).add(o.mul(Math.sin(r)/o.norm())).normalize())},nfe=function(e){return Math.max(ife(e),lD(e))},ife=function(e){if(e>=N1)return 0;var t=Math.min(1,.5*e),n=Math.sqrt(t*(2-t));return((2.5+2*Math.sqrt(3)+8.5*n)*n+(2+2*Math.sqrt(3)/3+6.5*(1-t))*t+(23+16/Math.sqrt(3))*Ki)*Ki},gD=function(e,t,n,r,s){var o=rfe(e,t,n,r,s),a=o.dist,l=o.less;if(l)return{dist:a,less:!0};var c=e.vector.sub(t.vector).norm2(),u=e.vector.sub(n.vector).norm2(),f=Math.min(c,u);return!s&&f>=r?{dist:r,less:!1}:{dist:f,less:!0}},rfe=function(e,t,n,r,s){var o=e.vector.sub(t.vector).norm2(),a=e.vector.sub(n.vector).norm2(),l=t.vector.sub(n.vector).norm2(),c=4.75*Ki*(o+a+l)+8*Ki*Ki;if(Math.abs(o-a)>=l+c)return{dist:r,less:!1};var u=t.pointCross(n),f=u.vector.norm2(),d=e.vector.dot(u.vector),A=d*d;if(!s&&A>f*r)return{dist:r,less:!1};var y=u.vector.cross(e.vector);if(t.vector.sub(e.vector).dot(y)>=0||n.vector.sub(e.vector).dot(y)<=0)return{dist:r,less:!1};var w=1-Math.sqrt(y.norm2()/f),S=A/f+w*w;return!s&&S>=r?{dist:r,less:!1}:{dist:S,less:!0}},jq=We.fromCoords(1,0,0),xp=(function(){function i(t,n){this.center=t,this.rad=n}i.fromPoint=function(n){return i.fromCenterChordAngle(n,0)},i.fromCenterAngle=function(n,r){return i.fromCenterChordAngle(n,vT(r))},i.fromCenterChordAngle=function(n,r){return new i(n,r)},i.fromCenterHeight=function(n,r){return i.fromCenterChordAngle(n,WL(2*r))},i.fromCenterArea=function(n,r){return i.fromCenterChordAngle(n,WL(r/Math.PI))},i.fromCap=function(n){return new i(We.fromVector(n.center.vector),n.rad)},i.emptyCap=function(){return i.fromCenterChordAngle(jq,yT)},i.fullCap=function(){return i.fromCenterChordAngle(jq,Sc)};var e=i.prototype;return e.isValid=function(){return this.center.vector.isUnit()&&this.rad<=Sc},e.isEmpty=function(){return this.rad<0},e.isFull=function(){return this.rad==Sc},e.centerPoint=function(){return this.center},e.height=function(){return .5*this.rad},e.radius=function(){return bT(this.rad)},e.area=function(){return 2*Math.PI*Math.max(0,this.height())},e.contains=function(n){return this.isFull()||n.isEmpty()?!0:this.rad>=ey(We.chordAngleBetweenPoints(this.center,n.center),n.rad)},e.intersects=function(n){return this.isEmpty()||n.isEmpty()?!1:ey(this.rad,n.rad)>=We.chordAngleBetweenPoints(this.center,n.center)},e.interiorIntersects=function(n){return this.rad<=0||n.isEmpty()?!1:ey(this.rad,n.rad)>We.chordAngleBetweenPoints(this.center,n.center)},e.intersectsCell=function(n){for(var r=[],s=0;s<4;s++)if(r[s]=n.vertex(s),this.containsPoint(r[s]))return!0;return this._intersects(n,r)},e._intersects=function(n,r){if(this.rad>=N1||this.isEmpty())return!1;if(n.containsPoint(this.center))return!0;for(var s=mH(this.rad),o=0;o<4;o++){var a=n.edge(o).vector,l=this.center.vector.dot(a);if(!(l>0)){if(l*l>s*a.norm2())return!1;var c=a.cross(this.center.vector);if(c.dot(r[o].vector)<0&&c.dot(r[o+1&3].vector)>0)return!0}}return!1},e.containsPoint=function(n){return We.chordAngleBetweenPoints(this.center,n)<=this.rad},e.containsCell=function(n){for(var r=[],s=0;s<4;s++)if(r[s]=n.vertex(s),!this.containsPoint(r[s]))return!1;return!this.complement()._intersects(n,r)},e.interiorContainsPoint=function(n){return this.isFull()||We.chordAngleBetweenPoints(this.center,n)<this.rad},e.complement=function(){return this.isFull()?i.emptyCap():this.isEmpty()?i.fullCap():i.fromCenterChordAngle(We.fromVector(this.center.vector.mul(-1)),ghe(Sc,this.rad))},e.capBound=function(){return this},e.rectBound=function(){if(this.isEmpty())return Ri.emptyRect();var n=this.radius(),r=!1,s=new Li(ar.latitude(this.center)-n,ar.latitude(this.center)+n),o=to.fullInterval();if(s.lo<=-Math.PI/2&&(s.lo=-Math.PI/2,r=!0),s.hi>=Math.PI/2&&(s.hi=Math.PI/2,r=!0),!r){var a=vhe(this.rad),l=Math.cos(ar.latitude(this.center));if(a<=l){var c=Math.asin(a/l);o.lo=pp(ar.longitude(this.center)-c,Math.PI*2),o.hi=pp(ar.longitude(this.center)+c,Math.PI*2)}}return new Ri(s,o)},e.equals=function(n){return this.rad===n.rad&&this.center.equals(n.center)||this.isEmpty()&&n.isEmpty()||this.isFull()&&n.isFull()},e.approxEqual=function(n){var r=1e-14,s=this.rad,o=n.rad;return this.center.approxEqual(n.center)&&Math.abs(s-o)<=r||this.isEmpty()&&o<=r||n.isEmpty()&&s<=r||this.isFull()&&o>=2-r||n.isFull()&&s>=2-r},e.addPoint=function(n){if(this.isEmpty())return new i(n,0);var r=We.chordAngleBetweenPoints(this.center,n);return r>this.rad&&(this.rad=r),this},e.addCap=function(n){if(this.isEmpty())return n;if(n.isEmpty())return this;var r=ey(We.chordAngleBetweenPoints(this.center,n.center),n.rad),s=PT(r,Ki*r);return s>this.rad&&(this.rad=s),this},e.expanded=function(n){return this.isEmpty()?i.emptyCap():i.fromCenterChordAngle(this.center,ey(this.rad,vT(n)))},e.toString=function(){return"[Center="+this.center.vector+", Radius="+dH(this.radius())+"]"},i.radiusToHeight=function(n){return n<0?yT:n>=Math.PI?N1:.5*vT(n)},e.cellUnionBound=function(){var n=eD.maxLevel(this.radius())-1;if(n<0){for(var r=[],s=0;s<6;s++)r[s]=yp(s);return r}return CH(V1(this.center),n)},e.centroid=function(){if(this.isEmpty())return new We(0,0,0);var n=1-.5*this.height();return We.fromVector(this.center.vector.mul(n*this.area()))},e.union=function(n){var r=this;if(r.rad<n.rad){var s=[n,r];r=s[0],n=s[1]}if(r.isFull()||n.isEmpty())return r;var o=r.radius(),a=n.radius(),l=r.center.distance(n.center);if(o>=l+a)return r;var c=.5*(l+o+a),u=NH(.5*(l-o+a),r.center,n.center);return i.fromCenterAngle(u,c)},i})(),nD=function(e,t,n){var r=t.stableAngle(n),s=n.stableAngle(e),o=e.stableAngle(t),a=.5*(r+s+o);if(a>=3e-4){var l=a-Math.max(r,s,o);if(l<.01*a*a*a*a*a){var c=sfe(e,t,n);if(l<a*.1*(c+5e-15))return c}}return 4*Math.atan(Math.sqrt(Math.max(0,Math.tan(.5*a)*Math.tan(.5*(a-r))*Math.tan(.5*(a-s))*Math.tan(.5*(a-o)))))},sfe=function(e,t,n){var r=e.pointCross(t),s=t.pointCross(n),o=e.pointCross(n),a=r.vector.angle(o.vector)-r.vector.angle(s.vector)+s.vector.angle(o.vector);return a<0&&(a=0),a},ofe=function(e,t,n){return Xm(e,t,n)*nD(e,t,n)},Xq=function(e,t,n){var r=e.pointCross(t).vector.angle(t.pointCross(n).vector);return Xm(e,t,n)===k1?r:-r},$q=Math.asin(Math.sqrt(1/3))-.5*Ki,Ra=(function(){function i(t,n,r,s,o){this.face=t,this.level=n,this.orientation=r,this.id=s,this.uv=o}i.fromCellID=function(n){var r=Sp(n),s=r.f,o=r.i,a=r.j,l=r.orientation,c=no(n);return new i(s,c,l,n,LT(o,a,c))},i.fromPoint=function(n){return i.fromCellID(V1(n))},i.fromLatLng=function(n){return i.fromCellID(TH(n))},i.oppositeFace=function(n){return(n+3)%6};var e=i.prototype;return e.isLeaf=function(){return this.level===_i},e.sizeIJ=function(){return Ca(this.level)},e.sizeST=function(){return EH(this.level)},e.vertex=function(n){var r=this.uv.vertices()[n];return We.fromVector(oh(this.face,r.x,r.y).normalize())},e.edge=function(n){switch(n){case 0:return We.fromVector(zq(this.face,this.uv.y.lo).normalize());case 1:return We.fromVector(kq(this.face,this.uv.x.hi).normalize());case 2:return We.fromVector(zq(this.face,this.uv.y.hi).mul(-1).normalize());default:return We.fromVector(kq(this.face,this.uv.x.lo).mul(-1).normalize())}},e.boundUV=function(){return this.uv},e.center=function(){return We.fromVector(my(this.id).normalize())},e.children=function(){var n=[];if(fD(this.id))return n;for(var r=MH(this.id),s=mD(this.id),o=0;o<4;o++){var a=new i(this.face,this.level+1,this.orientation^R1[o],s,Hr.empty()),l=cD[this.orientation][o],c=l>>1,u=l&1;c===1?(a.uv.x.hi=this.uv.x.hi,a.uv.x.lo=r.x):(a.uv.x.lo=this.uv.x.lo,a.uv.x.hi=r.x),u===1?(a.uv.y.hi=this.uv.y.hi,a.uv.y.lo=r.y):(a.uv.y.lo=this.uv.y.lo,a.uv.y.hi=r.y),s=Ia(s),n.push(a)}return n},e.exactArea=function(){var n=this.vertex(0),r=this.vertex(1),s=this.vertex(2),o=this.vertex(3);return nD(n,r,s)+nD(n,s,o)},e.approxArea=function(){if(this.level<2)return this.averageArea();var n=.5*this.vertex(2).vector.sub(this.vertex(0).vector).cross(this.vertex(3).vector.sub(this.vertex(1).vector)).norm();return n*2/(1+Math.sqrt(1-Math.min(1/Math.PI*n,1)))},e.averageArea=function(){return tD.value(this.level)},e.intersectsCell=function(n){return SH(this.id,n.id)},e.containsCell=function(n){return $m(this.id,n.id)},e.cellUnionBound=function(){return this.capBound().cellUnionBound()},e.latitude=function(n,r){var s,o;switch(!0){case(n===0&&r===0):s=this.uv.x.lo,o=this.uv.y.lo;break;case(n===0&&r===1):s=this.uv.x.lo,o=this.uv.y.hi;break;case(n===1&&r===0):s=this.uv.x.hi,o=this.uv.y.lo;break;case(n===1&&r===1):s=this.uv.x.hi,o=this.uv.y.hi;break;default:throw new Error("i and/or j is out of bounds")}return ar.latitude(We.fromVector(oh(this.face,s,o)))},e.longitude=function(n,r){var s,o;switch(!0){case(n===0&&r===0):s=this.uv.x.lo,o=this.uv.y.lo;break;case(n===0&&r===1):s=this.uv.x.lo,o=this.uv.y.hi;break;case(n===1&&r===0):s=this.uv.x.hi,o=this.uv.y.lo;break;case(n===1&&r===1):s=this.uv.x.hi,o=this.uv.y.hi;break;default:throw new Error("i and/or j is out of bounds")}return ar.longitude(We.fromVector(oh(this.face,s,o)))},e.rectBound=function(){if(this.level>0){var n=this.uv.x.lo+this.uv.x.hi,r=this.uv.y.lo+this.uv.y.hi,s,o;She(this.face).z===0?s=n<0?1:0:s=n>0?1:0,The(this.face).z===0?o=r<0?1:0:o=r>0?1:0;var a=Li.fromPoint(this.latitude(s,o)).addPoint(this.latitude(1-s,1-o)),l=to.emptyInterval().addPoint(this.longitude(s,1-o)).addPoint(this.longitude(1-s,o));return new Ri(a,l).expanded(new ar(2*Ki,2*Ki)).polarClosure()}var c;switch(this.face){case 0:c=new Ri(new Li(-Math.PI/4,Math.PI/4),new to(-Math.PI/4,Math.PI/4));break;case 1:c=new Ri(new Li(-Math.PI/4,Math.PI/4),new to(Math.PI/4,3*Math.PI/4));break;case 2:c=new Ri(new Li($q,Math.PI/2),to.fullInterval());break;case 3:c=new Ri(new Li(-Math.PI/4,Math.PI/4),new to(3*Math.PI/4,-3*Math.PI/4));break;case 4:c=new Ri(new Li(-Math.PI/4,Math.PI/4),new to(-3*Math.PI/4,-Math.PI/4));break;default:c=new Ri(new Li(-Math.PI/2,-$q),to.fullInterval())}return c.expanded(new ar(Ki,0))},e.capBound=function(){for(var n=xp.fromPoint(We.fromVector(oh(this.face,this.uv.center().x,this.uv.center().y).normalize())),r=0;r<4;r++)n=n.addPoint(this.vertex(r));return n},e.containsPoint=function(n){var r=yhe(this.face,n.vector),s=r[0],o=r[1],a=r[2];return a?this.uv.expandedByMargin(Ki).containsPoint(new Ci(s,o)):!1},e.vertexChordDist2=function(n,r,s){var o=this.uv.x.lo,a=this.uv.y.lo;return r&&(o=this.uv.x.hi),s&&(a=this.uv.y.hi),We.chordAngleBetweenPoints(n,We.fromCoords(o,a,1))},e.uEdgeIsClosest=function(n,r){var s=this.uv.x.lo,o=this.uv.x.hi,a=this.uv.y.lo;r&&(a=this.uv.y.hi);var l=new Wt(a*a+1,-s*a,-s),c=new Wt(a*a+1,-o*a,-o);return n.vector.dot(l)>0&&n.vector.dot(c)<0},e.vEdgeIsClosest=function(n,r){var s=this.uv.y.lo,o=this.uv.y.hi,a=this.uv.x.lo;r&&(a=this.uv.x.hi);var l=new Wt(-a*s,a*a+1,-s),c=new Wt(-a*o,a*a+1,-o);return n.vector.dot(l)>0&&n.vector.dot(c)<0},i.edgeDistance=function(n,r){var s=n*n/(1+r*r),o=1-Math.sqrt(1-s);return WL(s+o*o)},e.distanceInternal=function(n,r){var s=We.fromVector(_p(this.face,n.vector)),o=s.x-s.z*this.uv.x.lo,a=s.x-s.z*this.uv.x.hi,l=s.y-s.z*this.uv.y.lo,c=s.y-s.z*this.uv.y.hi,u=!0;return o<0&&(u=!1,this.vEdgeIsClosest(s,!1))?i.edgeDistance(-o,this.uv.x.lo):a>0&&(u=!1,this.vEdgeIsClosest(s,!0))?i.edgeDistance(a,this.uv.x.hi):l<0&&(u=!1,this.uEdgeIsClosest(s,!1))?i.edgeDistance(-l,this.uv.y.lo):c>0&&(u=!1,this.uEdgeIsClosest(s,!0))?i.edgeDistance(c,this.uv.y.hi):u?r?0:FL(i.edgeDistance(-o,this.uv.x.lo),i.edgeDistance(a,this.uv.x.hi),i.edgeDistance(-l,this.uv.y.lo),i.edgeDistance(c,this.uv.y.hi)):FL(this.vertexChordDist2(s,!1,!1),this.vertexChordDist2(s,!0,!1),this.vertexChordDist2(s,!1,!0),this.vertexChordDist2(s,!0,!0))},e.distance=function(n){return this.distanceInternal(n,!0)},e.maxDistance=function(n){var r=We.fromVector(_p(this.face,n.vector)),s=ZL(this.vertexChordDist2(r,!1,!1),this.vertexChordDist2(r,!0,!1),this.vertexChordDist2(r,!1,!0),this.vertexChordDist2(r,!0,!0));return s<=N1?s:Sc-this.distance(We.fromVector(n.vector.mul(-1)))},e.boundaryDistance=function(n){return this.distanceInternal(n,!1)},e.distanceToEdge=function(n,r){var s=FL(this.distance(n),this.distance(r));if(s===0)return s;for(var o=Gl.newChainEdgeCrosser(n,r,this.vertex(3)),a=0;a<4;a++)if(o.chainCrossingSign(this.vertex(a))!==Vl)return 0;for(var l=0;l<4;l++)s=du(this.vertex(l),n,r,s).dist;return s},e.maxDistanceToEdge=function(n,r){var s=ZL(this.maxDistance(n),this.maxDistance(r));return s<=N1?s:Sc-this.distanceToEdge(We.fromVector(n.vector.mul(-1)),We.fromVector(r.vector.mul(-1)))},e.distanceToCell=function(n){if(this.face===n.face&&this.uv.intersects(n.uv))return 0;for(var r=[],s=[],o=0;o<4;o++)r.push(this.vertex(o)),s.push(n.vertex(o));for(var a=Cc(),l=0;l<4;l++)for(var c=0;c<4;c++)a=du(r[l],s[c],s[c+1&3],a).dist,a=du(s[l],r[c],r[c+1&3],a).dist;return a},e.maxDistanceToCell=function(n){var r=new Hr(n.uv.y,n.uv.x);if(this.face===i.oppositeFace(n.face)&&this.uv.intersects(r))return Sc;for(var s=[],o=[],a=0;a<4;a++)s.push(this.vertex(a)),o.push(n.vertex(a));for(var l=yT,c=0;c<4;c++)for(var u=0;u<4;u++)l=Wq(s[c],o[u],o[u+1&3],l).dist,l=Wq(o[c],s[u],s[u+1&3],l).dist;return l},i})(),C1=-1,FH=(function(){function i(t,n){n===void 0&&(n=!1),this.nonEmpty=n,this.rangeNodes=t.rangeNodes,this.pos=0}var e=i.prototype;return e.startID=function(){return this.rangeNodes[this.pos].startID},e.limitID=function(){return this.rangeNodes[this.pos+1].startID},e.isEmpty=function(){return this.rangeNodes[this.pos].contents===C1},e.begin=function(){for(this.pos=0;this.nonEmpty&&this.isEmpty()&&!this.done();)this.pos++},e.internalPrev=function(){return this.pos===0?!1:(this.pos--,!0)},e.nonEmptyPrev=function(){for(;this.internalPrev();)if(!this.isEmpty())return!0;return this.isEmpty()&&!this.done()&&this.next(),!1},e.prev=function(){return this.nonEmpty?this.nonEmptyPrev():this.internalPrev()},e.next=function(){for(this.pos++;this.nonEmpty&&this.isEmpty()&&!this.done();)this.pos++},e.advance=function(n){return n>=this.rangeNodes.length-1-this.pos?!1:(this.pos+=n,!0)},e.finish=function(){this.pos=this.rangeNodes.length-1},e.done=function(){return this.pos>=this.rangeNodes.length-1},e.seek=function(n){for(var r=0,s=this.rangeNodes.length;r<s;){var o=r+s>>>1;this.rangeNodes[o].startID>n?s=o:r=o+1}for(this.pos=Math.max(r-1,0);this.nonEmpty&&this.isEmpty()&&!this.done();)this.pos++},i})(),BH=(function(){function i(t){this.cellTree=t.cellTree,this.prevStartID=0n,this.nodeCutoff=-1,this.nextNodeCutoff=-1,this.node={cellID:0n,label:C1,parent:-1}}var e=i.prototype;return e.clear=function(){this.prevStartID=0n,this.nodeCutoff=-1,this.nextNodeCutoff=-1,this.node.label=C1},e.cellID=function(){return this.node.cellID},e.label=function(){return this.node.label},e.next=function(){this.node.parent<=this.nodeCutoff?(this.nodeCutoff=this.nextNodeCutoff,this.node.label=C1):this.node=xT({},this.cellTree[this.node.parent])},e.done=function(){return this.node.label===C1},e.startUnion=function(n){n.startID()<this.prevStartID&&(this.nodeCutoff=-1),this.prevStartID=n.startID();var r=n.rangeNodes[n.pos].contents;r<=this.nodeCutoff?this.node.label=C1:this.node=xT({},this.cellTree[r]),this.nextNodeCutoff=r},i})(),afe=(function(){function i(){this.cellTree=[],this.rangeNodes=[]}var e=i.prototype;return e.add=function(n,r){if(r<0)throw new Error("labels must be non-negative");this.cellTree.push({cellID:n,label:r,parent:-1})},e.addCellUnion=function(n,r){if(r<0)throw new Error("labels must be non-negative");for(var s=Ct(n),o;!(o=s()).done;){var a=o.value;this.add(a,r)}},e.build=function(){for(var n=[],r=Ct(this.cellTree),s;!(s=r()).done;){var o=s.value;n.push({startID:qi(o.cellID),cellID:o.cellID,label:o.label}),n.push({startID:Ia(Gi(o.cellID)),cellID:hl,label:-1})}n.push({startID:Ay(yp(0),_i),cellID:0n,label:-1}),n.push({startID:DT(yp(5),_i),cellID:0n,label:-1}),n.sort(function(u,f){return u.startID!==f.startID?u.startID<f.startID?-1:1:u.cellID!==f.cellID?u.cellID>f.cellID?-1:1:u.label<f.label?-1:u.label>f.label?1:0}),this.cellTree=[],this.rangeNodes=[];for(var a=-1,l=0;l<n.length;){for(var c=n[l].startID;l<n.length&&n[l].startID===c;)n[l].label>=0?(this.cellTree.push({cellID:n[l].cellID,label:n[l].label,parent:a}),a=this.cellTree.length-1):n[l].cellID===hl&&(a=this.cellTree[a].parent),l++;this.rangeNodes.push({startID:c,contents:a})}},i})(),B1=(function(i){function e(){return i.apply(this,arguments)||this}hy(e,i),e.fromRange=function(r,s){for(var o=new e,a=QL(r,s);a!==s;a=QL(Ia(a),s))o.push(a);return o},e.fromUnion=function(){for(var r=arguments.length,s=new Array(r),o=0;o<r;o++)s[o]=arguments[o];var a=sy(e,s.flat(1));return a.normalize(),a},e.fromIntersection=function(r,s){for(var o=new e,a=0,l=0;a<r.length&&l<s.length;){var c=qi(r[a]),u=qi(s[l]);c>u?r[a]<=Gi(s[l])?(o.push(r[a]),a++):(l=s.lowerBound(l+1,s.length,c),r[a]<=Gi(s[l-1])&&l--):u>c?s[l]<=Gi(r[a])?(o.push(s[l]),l++):(a=r.lowerBound(a+1,r.length,u),s[l]<=Gi(r[a-1])&&a--):r[a]<s[l]?(o.push(r[a]),a++):(o.push(s[l]),l++)}return o.normalize(),o},e.fromIntersectionWithCellID=function(r,s){var o=new e;if(r.containsCellID(s))return o.push(s),o.normalize(),o;for(var a=Gi(s),l=r.lowerBound(0,r.length,qi(s));l<r.length&&r[l]<=a;l++)o.push(r[l]);return o.normalize(),o},e.fromDifference=function(r,s){for(var o=new e,a=Ct(r),l;!(l=a()).done;){var c=l.value;o.cellUnionDifferenceInternal(c,s)}return o};var t=e.prototype;return t.isValid=function(){for(var r=0;r<this.length;r++){var s=this[r];if(!ly(s)||r>0&&Gi(this[r-1])>=qi(s))return!1}return!0},t.isNormalized=function(){for(var r=0;r<this.length;r++){var s=this[r];if(!ly(s)||r>0&&Gi(this[r-1])>=qi(s)||r>=3&&e.areSiblings(this[r-3],this[r-2],this[r-1],s))return!1}return!0},t.normalize=function(){this.sort(JL);for(var r=[],s=Ct(this),o;!(o=s()).done;){var a=o.value;if(!(r.length>0&&$m(r[r.length-1],a))){for(var l=r.length-1;l>=0&&$m(a,r[l]);)l--;for(r.length=l+1;r.length>=3&&e.areSiblings(r[r.length-3],r[r.length-2],r[r.length-1],a);)r.length-=3,a=hD(a);r.push(a)}}this.length=0,this.push.apply(this,r)},t.intersectsCellID=function(r){var s=this.lowerBound(0,this.length,r);return s!==this.length&&qi(this[s])<=Gi(r)?!0:s!==0&&Gi(this[s-1])>=qi(r)},t.containsCellID=function(r){var s=this.lowerBound(0,this.length,r);return s!==this.length&&qi(this[s])<=r?!0:s!==0&&Gi(this[s-1])>=r},t.denormalize=function(r,s){for(var o=new e,a=Ct(this),l;!(l=a()).done;){var c=l.value,u=no(c),f=u;if(f<r&&(f=r),s>1&&(f+=(_i-(f-r))%s,f>_i&&(f=_i)),f===u)o.push(c);else for(var d=DT(c,f),A=Ay(c,f);A!==d;A=Ia(A))o.push(A)}this.length=0,this.push.apply(this,o)},t.rectBound=function(){for(var r=Ri.emptyRect(),s=Ct(this),o;!(o=s()).done;){var a=o.value;r=r.union(Ra.fromCellID(a).rectBound())}return r},t.capBound=function(){if(this.length===0)return xp.emptyCap();for(var r=new We(0,0,0),s=Ct(this),o;!(o=s()).done;){var a=o.value,l=tD.value(no(a));r=We.fromVector(r.vector.add(pD(a).vector.mul(l)))}r.equals(new We(0,0,0))?r=We.fromCoords(1,0,0):r=We.fromVector(r.vector.normalize());for(var c=xp.fromPoint(r),u=Ct(this),f;!(f=u()).done;){var d=f.value;c=c.addCap(Ra.fromCellID(d).capBound())}return c},t.containsCell=function(r){return this.containsCellID(r.id)},t.intersectsCell=function(r){return this.intersectsCellID(r.id)},t.containsPoint=function(r){return this.containsCell(Ra.fromPoint(r))},t.cellUnionBound=function(){return this.capBound().cellUnionBound()},t.leafCellsCovered=function(){for(var r=0n,s=Ct(this),o;!(o=s()).done;){var a=o.value;r+=1n<<BigInt(_i-no(a)<<1)}return r},e.areSiblings=function(r,s,o,a){if((r^s^o)!==a)return!1;var l=as(a)<<1n;l=~(l+(l<<1n));var c=a&l;return(r&l)===c&&(s&l)===c&&(o&l)===c&&!dy(a)},t.contains=function(r){for(var s=Ct(r),o;!(o=s()).done;){var a=o.value;if(!this.containsCellID(a))return!1}return!0},t.intersects=function(r){for(var s=Ct(this),o;!(o=s()).done;){var a=o.value;if(r.intersectsCellID(a))return!0}return!1},t.lowerBound=function(r,s,o){for(var a=r;a<s;a++)if(this[a]>=o)return a;return s},t.cellUnionDifferenceInternal=function(r,s){if(!s.intersectsCellID(r)){this.push(r);return}if(!s.containsCellID(r))for(var o=Ct(z1(r)),a;!(a=o()).done;){var l=a.value;this.cellUnionDifferenceInternal(l,s)}},t.expandAtLevel=function(r){for(var s=new e,o=Zm(r),a=this.length-1;a>=0;a--){var l=this[a];if(as(l)<o)for(l=Sr(l,r);a>0&&$m(l,this[a-1]);)a--;s.push(l),s.push.apply(s,wH(l,r))}s.sort(JL),this.length=0,this.push.apply(this,s),this.normalize()},t.expandByRadius=function(r,s){for(var o=_i,a=Ct(this),l;!(l=a()).done;){var c=l.value;o=Math.min(o,no(c))}var u=eD.maxLevel(r);u===0&&r>eD.value(0)&&this.expandAtLevel(0),this.expandAtLevel(Math.min(o+s,u))},t.equals=function(r){if(this.length!==r.length)return!1;for(var s=0;s<this.length;s++)if(this[s]!==r[s])return!1;return!0},t.averageArea=function(){return tD.value(_i)*Number(this.leafCellsCovered())},t.approxArea=function(){for(var r=0,s=Ct(this),o;!(o=s()).done;){var a=o.value;r+=Ra.fromCellID(a).approxArea()}return r},t.exactArea=function(){for(var r=0,s=Ct(this),o;!(o=s()).done;){var a=o.value;r+=Ra.fromCellID(a).exactArea()}return r},e})(D1(Array)),ah=(function(){function i(t,n){this.v0=t,this.v1=n}var e=i.prototype;return e.cmp=function(n){var r=this.v0.vector.cmp(n.v0.vector);return r!==0?r:this.v1.vector.cmp(n.v1.vector)},e.equals=function(n){return this.v0.equals(n.v0)&&this.v1.equals(n.v1)},i})(),L1=function(e,t){this.start=e,this.length=t},NT=function(e,t){this.chainID=e,this.offset=t},lfe=function(e,t){this.point=e,this.contained=t},FT=function(e){return new lfe(We.originPoint(),e)},OH=0,cfe=1,ufe=2,hfe=function(e){return e.numEdges()===0&&(e.dimension()!==2||e.numChains()===0)},ffe=function(e){return e.numEdges()===0&&e.dimension()===2&&e.numChains()>0},ny=(function(){function i(){}var e=i.prototype;return e.numEdges=function(){return 0},e.edge=function(n){return new ah(We.originPoint(),We.originPoint())},e.referencePoint=function(){return FT(!1)},e.numChains=function(){return 0},e.chain=function(n){return new L1(0,0)},e.chainEdge=function(n,r){return new ah(We.originPoint(),We.originPoint())},e.chainPosition=function(n){return new NT(0,0)},e.dimension=function(){return-1},e.isEmpty=function(){return!0},e.isFull=function(){return!1},e.typeTag=function(){return OH},e.privateInterface=function(){},i})(),Yq=(function(){function i(t,n){this.containsCenter=!1,this.shapeID=t,this.containsCenter=!1,this.edges=new Array(n)}var e=i.prototype;return e.numEdges=function(){return this.edges.length},e.containsEdge=function(n){for(var r=Ct(this.edges),s;!(s=r()).done;){var o=s.value;if(o===n)return!0}return!1},i})(),UH=(function(){function i(){this.shapeID=0,this.containsCenter=!1,this.edges=[]}var e=i.prototype;return e.numEdges=function(){return 0},e.containsEdge=function(n){return!1},i})(),dfe=(function(){function i(t){this.shapes=new Array(t)}var e=i.prototype;return e.numEdges=function(){for(var n=0,r=Ct(this.shapes),s;!(s=r()).done;){var o=s.value;n+=o.numEdges()}return n},e.add=function(n){this.shapes.push(n)},e.findByShapeID=function(n){for(var r=Ct(this.shapes),s;!(s=r()).done;){var o=s.value;if(o.shapeID===n)return o}return new UH},i})(),BL=(function(){function i(){this.shapes=[]}var e=i.prototype;return e.numEdges=function(){return 0},e.add=function(n){},e.findByShapeID=function(n){return new UH},i})(),iD=0,kH=0,OL=(function(){function i(t,n){if(this.index=t,this.position=0,this.id=hl,this.cell=new BL,n!==void 0)switch(n){case iD:this.begin();break;case kH:this.end();break;default:throw new Error("unknown ShapeIndexIteratorPos value")}}var e=i.prototype;return e.clone=function(){var n=new i(this.index);return n.position=this.position,n.id=this.id,n.cell=this.cell,n},e.cellID=function(){return this.id},e.indexCell=function(){return this.cell},e.center=function(){return pD(this.cellID())},e.begin=function(){this.index.isFresh()||this.index.maybeApplyUpdates(),this.position=0,this.refresh()},e.next=function(){this.position++,this.refresh()},e.prev=function(){return this.position<=0?!1:(this.position--,this.refresh(),!0)},e.end=function(){this.position=this.index.cells.length,this.refresh()},e.done=function(){return this.id===hl},e.refresh=function(){this.position<this.index.cells.length?(this.id=this.index.cells[this.position],this.cell=this.index.cellMap.get(this.cellID())||new BL):(this.id=hl,this.cell=new BL)},e.seek=function(n){var r=this;this.position=KL(this.index.cells.length,function(s){return r.index.cells[s]>=n}),this.refresh()},e.locatePoint=function(n){var r=V1(n);return this.seek(r),!!(!this.done()&&qi(this.cellID())<=r||this.prev()&&Gi(this.cellID())>=r)},e.locateCellID=function(n){if(this.seek(qi(n)),!this.done()){if(this.cellID()>=n&&qi(this.cellID())<=n)return wp;if(this.cellID()<=Gi(n))return vy}return this.prev()&&Gi(this.cellID())>=n?wp:BT},i})(),pfe=(function(){function i(){this.isActive=!1,this.a=this.b=i.trackerOrigin(),this.nextCellID=Ay(yp(0),_i),this.crosser=null,this.shapeIDs=[],this.savedIDs=[],this.drawTo(We.fromVector(oh(0,-1,-1).normalize()))}i.trackerOrigin=function(){return We.fromVector(oh(0,-1,-1).normalize())};var e=i.prototype;return e.focus=function(){return this.b},e.addShape=function(n,r){this.isActive=!0,r&&this.toggleShape(n)},e.moveTo=function(n){this.b=n},e.drawTo=function(n){this.a=this.b,this.b=n,this.crosser=new Gl(this.a,this.b)},e.testEdge=function(n,r){var s;(s=this.crosser)!=null&&s.edgeOrVertexCrossing(r.v0,r.v1)&&this.toggleShape(n)},e.setNextCellID=function(n){this.nextCellID=qi(n)},e.atCellID=function(n){return qi(n)===this.nextCellID},e.toggleShape=function(n){if(this.shapeIDs.length===0){this.shapeIDs.push(n);return}if(this.shapeIDs[0]===n){this.shapeIDs.shift();return}for(var r=0;r<this.shapeIDs.length;r++){var s=this.shapeIDs[r];if(!(s<n)){if(s===n){this.shapeIDs.splice(r,1);return}this.shapeIDs.splice(r,0,n);return}}this.shapeIDs.push(n)},e.saveAndClearStateBefore=function(n){var r=this.lowerBound(n);this.savedIDs=this.shapeIDs.slice(0,r),this.shapeIDs=this.shapeIDs.slice(r)},e.restoreStateBefore=function(n){var r=this.lowerBound(n);this.shapeIDs=this.savedIDs.concat(this.shapeIDs.slice(r)),this.savedIDs=[]},e.lowerBound=function(n){for(var r=0;r<this.shapeIDs.length;r++)if(this.shapeIDs[r]>=n)return r;return this.shapeIDs.length},i})(),Yf=1,Zq=2,bp=(function(){function i(t,n){this.index=t,this.model=n,this.iter=t.iterator()}var e=i.prototype;return e.contains=function(n){if(!this.iter.locatePoint(n))return!1;for(var r=this.iter.indexCell(),s=Ct(r.shapes),o;!(o=s()).done;){var a=o.value;if(this._shapeContains(a,this.iter.center(),n))return!0}return!1},e._shapeContains=function(n,r,s){var o=n.containsCenter,a=n.numEdges();if(a<=0)return o;var l=this.index.shape(n.shapeID);if(l.dimension()!==2){if(this.model!==Zq)return!1;for(var c=Ct(n.edges),u;!(u=c()).done;){var f=u.value,d=l.edge(f);if(d.v0.equals(s)||d.v1.equals(s))return!0}return!1}for(var A=new Gl(r,s),y=Ct(n.edges),w;!(w=y()).done;){var S=w.value,T=l.edge(S),R=A.crossingSign(T.v0,T.v1);if(R!==Vl){if(R===MT){if(this.model!==Yf&&(T.v0.equals(s)||T.v1.equals(s)))return this.model===Zq;LH(A.a,A.b,T.v0,T.v1)?R=Ec:R=Vl}o=o!==(R===Ec)}}return o},e.shapeContains=function(n,r){if(!n||n instanceof ny||!this.iter.locatePoint(r))return!1;var s=this.iter.indexCell(),o=s.findByShapeID(this.index.idForShape(n));return o?this._shapeContains(o,this.iter.center(),r):!1},e.shapeVisitorFunc=function(n){return!0},e.visitContainingShapes=function(n,r){if(!this.iter.locatePoint(n))return!0;for(var s=this.iter.indexCell(),o=Ct(s.shapes),a;!(a=o()).done;){var l=a.value;if(this._shapeContains(l,this.iter.center(),n)&&!r(this.index.shape(l.shapeID)))return!1}return!0},e.containingShapes=function(n){var r=[];return this.visitContainingShapes(n,function(s){return r.push(s),!0}),r},i})(),mfe=(function(){function i(t,n){n===void 0&&(n=new bp(t,Yf)),this.index=t,this.containsQuery=n,this.iter=t.iterator()}var e=i.prototype;return e.capBound=function(){var n=sy(B1,this.cellUnionBound());return n.capBound()},e.rectBound=function(){var n=sy(B1,this.cellUnionBound());return n.rectBound()},e.cellUnionBound=function(){var n=[];if(this.iter.end(),!this.iter.prev())return n;var r=this.iter.cellID();if(this.iter.begin(),this.iter.cellID()!==r){var s=cy(this.iter.cellID(),r),o=s[0];o===void 0&&(o=-1),o++;for(var a=Sr(r,o),l=Sr(this.iter.cellID(),o);l!=a;l=Ia(l))if(!(Gi(l)<this.iter.cellID())){var c=this.iter.cellID();this.iter.seek(Ia(Gi(l))),this.iter.prev(),n.push.apply(n,this.coverRange(c,this.iter.cellID(),[])),this.iter.next()}}return this.coverRange(this.iter.cellID(),r,n)},e.coverRange=function(n,r,s){if(n==r)return s.concat([n]);var o=cy(n,r),a=o[0],l=o[1];return l||s.concat([0n]),s.concat([Sr(n,a)])},i})(),Afe=2.25*Ki,gfe=3*Ki,gy=9*(1/Math.SQRT2)*Ki,zH=3*Math.SQRT2*Ki,vfe=function(e,t,n){return uy(e,t,n,0)},uy=function(e,t,n,r){if(ay(e.vector)===n&&ay(t.vector)===n){var s=Ym(n,e.vector),o=s[0],a=s[1],l=Ym(n,t.vector),c=l[0],u=l[1];return[new Ci(o,a),new Ci(c,u),!0]}var f=new wc(_p(n,e.pointCross(t).vector)),d=new wc(_p(n,e.vector)),A=new wc(_p(n,t.vector)),y=1+r,w=new wc(new We(y*f.x,y*f.y,f.z));if(!w.intersectsFace())return[null,null,!1];Math.max(Math.abs(f.x),Math.max(Math.abs(f.y),Math.abs(f.z)))<HL(1,-511)&&(f=new wc(We.fromVector(f.vector.mul(HL(1,563)))));var S=new wc(We.fromVector(f.vector.normalize())),T=new wc(We.fromVector(S.vector.cross(d.vector))),R=new wc(We.fromVector(A.vector.cross(S.vector))),P=Kq(A,d,new wc(We.fromVector(w.vector.mul(-1))),R,T,y),I=P[0],F=P[1],D=Kq(d,A,w,T,R,y),L=D[0],C=D[1];return[I,L,F+C<3]},_fe=function(e,t,n){return e+t===n&&e===n-t&&t===n-e},UL=0,rD=1,wc=(function(i){function e(n){return i.call(this,n.x,n.y,n.z)||this}hy(e,i);var t=e.prototype;return t.intersectsFace=function(){var r=Math.abs(this.x),s=Math.abs(this.y),o=Math.abs(this.z);return s>=o-r&&r>=o-s},t.intersectsOppositeEdges=function(){var r=Math.abs(this.x),s=Math.abs(this.y),o=Math.abs(this.z);return Math.abs(r-s)!==o?Math.abs(r-s)>=o:r>=s?r-o>=s:s-o>=r},t.exitAxis=function(){if(this.intersectsOppositeEdges())return Math.abs(this.x)>=Math.abs(this.y)?rD:UL;var r=0,s=0,o=0;return Math.sign(this.x)<0&&(r=1),Math.sign(this.y)<0&&(s=1),Math.sign(this.z)<0&&(o=1),(r^s^o)===0?rD:UL},t.exitPoint=function(r){if(r===UL){var s=this.y>0?1:-1;return new Ci(s,(-s*this.x-this.z)/this.y)}var o=this.x<0?1:-1;return new Ci((-o*this.y-this.z)/this.x,o)},e})(We),Kq=function(e,t,n,r,s,o){var a=1-gy;if(t.z>0){var l=new Ci(t.x/t.z,t.y/t.z);if(Math.max(Math.abs(l.x),Math.abs(l.y))<=a)return[l,0]}var c=n.exitPoint(n.exitAxis()).mul(o),u=new wc(new We(c.x,c.y,1)),f=0;return u.vector.sub(e.vector).dot(r.vector)<0?f=2:u.vector.sub(t.vector).dot(s.vector)<0&&(f=1),f>0&&(t.z<=0?f=3:c=new Ci(t.x/t.z,t.y/t.z)),[c,f]},Qq=function(e,t,n){return t?e.lo>n?[e,!1]:(e.hi>n&&(e.hi=n),[e,!0]):e.hi<n?[e,!1]:(e.lo<n&&(e.lo=n),[e,!0])},Jq=function(e,t,n,r,s,o,a,l){var c=!1;if(n.lo<l.lo){if(n.hi<l.lo)return[n,o,!1];n.lo=l.lo;var u=Qq(o,a,O1(l.lo,e,t,r,s));if(o=u[0],c=u[1],!c)return[n,o,!1]}if(n.hi>l.hi){if(n.lo>l.hi)return[n,o,!1];n.hi=l.hi;var f=Qq(o,!a,O1(l.hi,e,t,r,s));if(o=f[0],c=f[1],!c)return[n,o,!1]}return[n,o,!0]},VH=function(e,t,n){if(!n.intersects(Hr.fromPoints(e,t)))return!1;var r=t.sub(e).ortho(),s=r.x>=0?1:0,o=r.y>=0?1:0,a=r.dot(n.vertexIJ(s,o).sub(e)),l=r.dot(n.vertexIJ(1-s,1-o).sub(e));return a>=0&&l<=0},xfe=function(e,t,n){var r=Hr.fromPoints(e,t),s=yfe(e,t,n,r),o=s[0],a=s[1];return a?o:Hr.empty()},yfe=function(e,t,n,r){var s=e.x>t.x!=e.y>t.y,o=Jq(e.x,t.x,r.x,e.y,t.y,r.y,s,n.x),a=o[0],l=o[1],c=o[2];if(!c)return[r,!1];var u=Jq(e.y,t.y,l,e.x,t.x,a,s,n.y),f=u[0],d=u[1],A=u[2];return A?[new Hr(d,f),!0]:[new Hr(a,l),!1]},O1=function(e,t,n,r,s){return Math.abs(t-e)<=Math.abs(n-e)?r+(s-r)*(e-t)/(n-t):s+(r-s)*(e-n)/(t-n)},bfe=(function(){function i(t,n,r){this.face=t,this.a=n,this.b=r}var e=i.prototype;return e.clone=function(){return new i(this.face,new Ci(this.a.x,this.a.y),new Ci(this.b.x,this.b.y))},i})(),wfe=function(e,t){var n=new bfe(0,new Ci(0,0),new Ci(0,0)),r=wT(e.vector),s=r[0],o=r[1],a=r[2],l=wT(t.vector),c=l[0],u=l[1],f=l[2];if(n.a.x=o,n.a.y=a,n.b.x=u,n.b.y=f,s===c)return n.face=s,[n];var d=e.pointCross(t),A=eH(s,e,d,n.a),y=A[0],w=A[1],S=eH(c,t,We.fromVector(d.vector.mul(-1)),n.b),T=S[0],R=S[1];n.a=w,n.b=R;var P=[];n.face=y;for(var I=n.b,F=y;F!==T;){var D=_p(F,d.vector),L=new wc(D),C=L.exitAxis();n.b=L.exitPoint(C),P.push(n.clone());var B=oh(F,n.b.x,n.b.y);F=Sfe(F,n.b,C,L,T);var k=_p(F,B);n.face=F,n.a=new Ci(k.x,k.y)}return n.b=I,P.push(n),P},eH=function(e,t,n,r){var s=1-gy;if(Math.max(Math.abs(r.x),Math.abs(r.y))<=s)return[e,r];var o=_p(e,n.vector),a=new wc(o);if(a.intersectsFace()){var l=a.exitPoint(a.exitAxis()),c=oh(e,l.x,l.y),u=n.vector.normalize().cross(t.vector);if(c.sub(t.vector).dot(u)>=-gfe)return[e,r]}var f=0;Math.abs(r.x)>=Math.abs(r.y)?(r.x>0&&(f=1),e=ST(e,0,f)):(r.y>0&&(f=1),e=ST(e,1,f));var d=Ym(e,t.vector);return r.x=d[0],r.y=d[1],r.x=Math.max(-1,Math.min(1,r.x)),r.y=Math.max(-1,Math.min(1,r.y)),[e,r]},Sfe=function(e,t,n,r,s){var o=t.x,a=t.y;n==rD&&(o=t.y,a=t.x);var l=0;o>0&&(l=1);var c=0;return a>0&&(c=1),Math.abs(a)===1&&ST(e,1-n,c)===s&&_fe(t.x*r.x,t.y*r.y,-r.z)?s:ST(e,n,l)},gT=1,tH=(function(){function i(t){this.rangeMin=hl,this.rangeMax=hl,this.it=t.iterator(),this.refresh()}var e=i.prototype;return e.cellID=function(){return this.it.cellID()},e.indexCell=function(){return this.it.indexCell()},e.next=function(){this.it.next(),this.refresh()},e.done=function(){return this.it.done()},e.seekTo=function(n){this.it.seek(n.rangeMin),(this.it.done()||qi(this.it.cellID())>n.rangeMax)&&this.it.prev()&&Gi(this.it.cellID())<n.cellID()&&this.it.next(),this.refresh()},e.seekBeyond=function(n){this.it.seek(Ia(n.rangeMax)),!this.it.done()&&qi(this.it.cellID())<=n.rangeMax&&this.it.next(),this.refresh()},e.refresh=function(){this.rangeMin=qi(this.cellID()),this.rangeMax=Gi(this.cellID())},i})(),Tfe=function(e,t){if(e.dimension()!==2)return!1;var n=e.referencePoint();if(n.point===t)return n.contained;for(var r=new Gl(n.point,t),s=n.contained,o=0;o<e.numEdges();o++){var a=e.edge(o);s=s!==r.edgeOrVertexCrossing(a.v0,a.v1)}return s},Ma=(function(){function i(){this.id=0n,this.padding=0,this.boundRect=Hr.empty(),this.middleRect=Hr.empty(),this.iLo=0,this.jLo=0,this.orientation=0,this.level=0}i.fromCellID=function(n,r){var s=new i;if(s.id=n,s.padding=r,s.middleRect=Hr.empty(),dy(n)){var o=r+1;return s.boundRect=new Hr(new Li(-o,o),new Li(-o,o)),s.middleRect=new Hr(new Li(-r,r),new Li(-r,r)),s.orientation=fu(n)&1,s}var a=Sp(n),l=a.i,c=a.j,u=a.orientation;s.iLo=l,s.jLo=c,s.orientation=u,s.level=no(n),s.boundRect=LT(l,c,s.level).expandedByMargin(r);var f=Ca(s.level);return s.iLo&=-f,s.jLo&=-f,s},i.fromParentIJ=function(n,r,s){var o=_he[n.orientation][2*r+s],a=new i;a.id=z1(n.id)[o],a.padding=n.padding,a.boundRect=Hr.fromRect(n.boundRect),a.orientation=n.orientation^R1[o],a.level=n.level+1,a.middleRect=Hr.empty();var l=Ca(a.level);a.iLo=n.iLo+r*l,a.jLo=n.jLo+s*l;var c=n.middle();return r===1?a.boundRect.x.lo=c.x.lo:a.boundRect.x.hi=c.x.hi,s===1?a.boundRect.y.lo=c.y.lo:a.boundRect.y.hi=c.y.hi,a};var e=i.prototype;return e.cellID=function(){return this.id},e.paddingValue=function(){return this.padding},e.levelValue=function(){return this.level},e.center=function(){var n=Ca(this.level),r=2*this.iLo+n,s=2*this.jLo+n;return We.fromVector(_T(fu(this.id),r,s).normalize())},e.middle=function(){if(this.middleRect.isEmpty()){var n=Ca(this.level),r=Tc(Ap(2*this.iLo+n)),s=Tc(Ap(2*this.jLo+n));this.middleRect=new Hr(new Li(r-this.padding,r+this.padding),new Li(s-this.padding,s+this.padding))}return this.middleRect},e.bound=function(){return this.boundRect},e.childIJ=function(n){var r=cD[this.orientation][n];return[r>>1,r&1]},e.entryVertex=function(){var n=this.iLo,r=this.jLo;if(this.orientation&$f){var s=Ca(this.level);n+=s,r+=s}return We.fromVector(_T(fu(this.id),2*n,2*r).normalize())},e.exitVertex=function(){var n=this.iLo,r=this.jLo,s=Ca(this.level);return this.orientation===0||this.orientation===Mc+$f?n+=s:r+=s,We.fromVector(_T(fu(this.id),2*n,2*r).normalize())},e.shrinkToFit=function(n){if(this.level===0&&(n.x.contains(0)||n.y.contains(0)))return this.id;var r=Ca(this.level);if(n.x.contains(Tc(Ap(2*this.iLo+r)))||n.y.contains(Tc(Ap(2*this.jLo+r))))return this.id;var s=n.expandedByMargin(this.padding+1.5*Ki),o=this.iLo,a=this.jLo,l=0,c=0;o<zl(sh(s.x.lo))&&(o=zl(sh(s.x.lo))),this.iLo+r-1<=zl(sh(s.x.hi))?l=o^this.iLo+r-1:l=o^zl(sh(s.x.hi)),a<zl(sh(s.y.lo))&&(a=zl(sh(s.y.lo))),this.jLo+r-1<=zl(sh(s.y.hi))?c=a^this.jLo+r-1:c=a^zl(sh(s.y.hi));var u=BigInt((l|c)<<1)+1n,f=_i-fH(u);return f<=this.level?this.id:Sr(py(fu(this.id),o,a),f)},i})(),wp=0,vy=1,BT=2,nH=0,ty=2,E1=2*(gy+Afe),Efe=1,iH=(function(){function i(t,n,r,s,o,a,l){t===void 0&&(t=0),n===void 0&&(n=0),r===void 0&&(r=0),s===void 0&&(s=!1),o===void 0&&(o=new Ci(0,0)),a===void 0&&(a=new Ci(0,0)),l===void 0&&(l=new ah(new We(0,0,0),new We(0,0,0))),this.shapeID=t,this.edgeID=n,this.maxLevel=r,this.hasInterior=s,this.a=o,this.b=a,this.edge=l}var e=i.prototype;return e.copy=function(){return new i(this.shapeID,this.edgeID,this.maxLevel,this.hasInterior,new Ci(this.a.x,this.a.y),new Ci(this.b.x,this.b.y),new ah(We.fromVector(this.edge.v0.vector),We.fromVector(this.edge.v1.vector)))},i})(),kL=function(e,t){this.faceEdge=e,this.bound=t},CT=(function(){function i(){var t=this;this.iterator=function(){return t.maybeApplyUpdates(),new OL(t,iD)},this.begin=function(){return t.maybeApplyUpdates(),new OL(t,iD)},this.end=function(){return t.maybeApplyUpdates(),new OL(t,kH)},this.region=function(){return new mfe(t,new bp(t,Yf))},this.len=function(){return t.shapes.size},this.reset=function(){t.shapes.clear(),t.nextID=0,t.cellMap.clear(),t.cells=[],t.status=ty},this.numEdges=function(){var n=0;return t.shapes.forEach(function(r){n+=r.numEdges()}),n},this.numEdgesUpTo=function(n){for(var r=0,s=0;s<=t.nextID;s++){var o=t.shape(s);if(!(o instanceof ny)&&(r+=o.numEdges(),r>=n))break}return r},this.shape=function(n){return t.shapes.get(n)||new ny},this.idForShape=function(n){for(var r=Ct(t.shapes.entries()),s;!(s=r()).done;){var o=s.value,a=o[0],l=o[1];if(l===n)return a}return-1},this.add=function(n){return t.shapes.set(t.nextID,n),t.nextID++,t.status=nH,t.nextID-1},this.remove=function(n){var r=t.idForShape(n);if(t.shapes.has(r)&&(t.shapes.delete(r),!(r>=t.pendingAdditionsPos))){for(var s=n.numEdges(),o=new Mfe(r,n.dimension()===2,n.referencePoint().contained,new Array(s)),a=0;a<s;a++)o.edges[a]=n.edge(a);t.pendingRemovals.push(o),t.status=nH}},this.build=function(){return t.maybeApplyUpdates()},this.isFresh=function(){return t.status===ty},this.isFirstUpdate=function(){return t.pendingAdditionsPos===0},this.isShapeBeingRemoved=function(n){return n<t.pendingAdditionsPos},this.maybeApplyUpdates=function(){t.status!==ty&&(t.applyUpdatesInternal(),t.status=ty)},this.applyUpdatesInternal=function(){for(var n=new pfe,r=Array.from({length:6},function(){return[]}),s=Ct(t.pendingRemovals),o;!(o=s()).done;){var a=o.value;t.removeShapeInternal(a,r,n)}for(var l=t.pendingAdditionsPos;l<t.shapes.size;l++)t.addShapeInternal(l,r,n);for(var c=0;c<6;c++)t.updateFaceEdges(c,r[c],n);t.pendingRemovals.length=0,t.pendingAdditionsPos=t.shapes.size},this.addShapeInternal=function(n,r,s){var o=t.shapes.get(n)||new ny;if(!(o instanceof ny)){var a=new iH(n,void 0,void 0,o.dimension()===2);a.hasInterior&&s.addShape(n,Tfe(o,s.focus()));for(var l=o.numEdges(),c=0;c<l;c++){var u=o.edge(c);a.edgeID=c,a.edge=u,a.maxLevel=rH(u),t.addFaceEdge(a,r)}}},this.addFaceEdge=function(n,r){var s=n.copy(),o=ay(s.edge.v0.vector);if(o===ay(s.edge.v1.vector)){var a=Ym(o,s.edge.v0.vector),l=a[0],c=a[1];s.a=new Ci(l,c);var u=Ym(o,s.edge.v1.vector);l=u[0],c=u[1],s.b=new Ci(l,c);var f=1-E1;if(Math.abs(s.a.x)<=f&&Math.abs(s.a.y)<=f&&Math.abs(s.b.x)<=f&&Math.abs(s.b.y)<=f){r[o].push(s);return}}for(var d=0;d<6;d++){var A=uy(s.edge.v0,s.edge.v1,d,E1),y=A[0],w=A[1],S=A[2];if(S){var T=n.copy();T.a=y,T.b=w,r[d].push(T)}}},this.updateFaceEdges=function(n,r,s){var o=r.length;if(!(o===0&&s.shapeIDs.length===0)){for(var a=Array(o),l=Hr.empty(),c=0;c<o;c++){var u=new kL(r[c],Hr.fromPoints(r[c].a,r[c].b));a[c]=u,l=l.addRect(u.bound)}var f=yp(n),d=Ma.fromCellID(f,E1),A=t.isFirstUpdate();if(o>0){var y=t.shrinkToFit(d,l);if(y!==d.id){t.skipCellRange(qi(f),qi(y),s,A),d=Ma.fromCellID(y,E1),t.updateEdges(d,a,s,A),t.skipCellRange(Ia(Gi(y)),Ia(Gi(f)),s,A);return}}t.updateEdges(d,a,s,A)}},this.shrinkToFit=function(n,r){var s=n.shrinkToFit(r);if(!t.isFirstUpdate()&&s!==n.id){var o=t.iterator();o.locateCellID(s)===wp&&(s=o.cellID())}return s},this.skipCellRange=function(n,r,s,o){if(s.shapeIDs.length!==0)for(var a=B1.fromRange(n,r),l=Ct(a),c;!(c=l()).done;){var u=c.value,f=[];t.updateEdges(Ma.fromCellID(u,E1),f,s,o)}},this.updateEdges=function(n,r,s,o){var a=!1;if(!o){var l=t.iterator(),c=l.locateCellID(n.id);c===BT?o=!0:c===wp&&(t.absorbIndexCell(n,l,r,s),a=!0,o=!0)}if(!o||!t.makeIndexCell(n,r,s)){for(var u=[[[],[]],[[],[]]],f=n.middle(),d=Ct(r),A;!(A=d()).done;){var y=A.value;if(y.bound.x.hi<=f.x.lo){var w=t.clipVAxis(y,f.y),S=w[0],T=w[1];S&&u[0][0].push(S),T&&u[0][1].push(T)}else if(y.bound.x.lo>=f.x.hi){var R=t.clipVAxis(y,f.y),P=R[0],I=R[1];P&&u[1][0].push(P),I&&u[1][1].push(I)}else if(y.bound.y.hi<=f.y.lo){var F=t.clipUBound(y,1,f.x.hi);F&&u[0][0].push(F);var D=t.clipUBound(y,0,f.x.lo);D&&u[1][0].push(D)}else if(y.bound.y.lo>=f.y.hi){var L=t.clipUBound(y,1,f.x.hi);L&&u[0][1].push(L);var C=t.clipUBound(y,0,f.x.lo);C&&u[1][1].push(C)}else{var B=t.clipUBound(y,1,f.x.hi),k=t.clipVAxis(B,f.y),z=k[0],G=k[1];z&&u[0][0].push(z),G&&u[0][1].push(G);var W=t.clipUBound(y,0,f.x.lo),Y=t.clipVAxis(W,f.y);z=Y[0],G=Y[1],z&&u[1][0].push(z),G&&u[1][1].push(G)}}for(var H=0;H<4;H++){var $=n.childIJ(H),J=$[0],te=$[1];(u[J][te].length>0||s.shapeIDs.length>0)&&t.updateEdges(Ma.fromParentIJ(n,J,te),u[J][te],s,o)}}a&&s.restoreStateBefore(t.pendingAdditionsPos)},this.makeIndexCell=function(n,r,s){if(r.length===0&&s.shapeIDs.length===0)return!0;for(var o=0,a=Ct(r),l;!(l=a()).done;){var c=l.value;if(n.level<c.faceEdge.maxLevel&&o++,o>t.maxEdgesPerCell)return!1}s.isActive&&r.length!==0&&(s.atCellID(n.id)||s.moveTo(n.entryVertex()),s.drawTo(n.center()),t.testAllEdges(r,s));for(var u=s.shapeIDs,f=t.countShapes(r,u),d=new dfe(f),A=0,y=0,w=0;w<f;w++){var S=void 0,T=t.shapes.size,R=T;A!==r.length&&(T=r[A].faceEdge.shapeID),y<u.length&&(R=u[y]);var P=A;if(R<T)S=new Yq(R,0),S.containsCenter=!0,y++;else{for(;A<r.length&&r[A].faceEdge.shapeID===T;)A++;S=new Yq(T,A-P);for(var I=P;I<A;I++)S.edges[I-P]=r[I].faceEdge.edgeID;R===T&&(S.containsCenter=!0,y++)}d.shapes[w]=S}return t.cellMap.set(n.id,d),t.cells.push(n.id),s.isActive&&r.length!==0&&(s.drawTo(n.exitVertex()),t.testAllEdges(r,s),s.setNextCellID(Ia(n.id))),!0},this.updateBound=function(n,r,s,o,a){var l=new kL(n.faceEdge,new Hr);return r===0?(l.bound.x.lo=s,l.bound.x.hi=n.bound.x.hi):(l.bound.x.lo=n.bound.x.lo,l.bound.x.hi=s),o===0?(l.bound.y.lo=a,l.bound.y.hi=n.bound.y.hi):(l.bound.y.lo=n.bound.y.lo,l.bound.y.hi=a),l},this.clipUBound=function(n,r,s){if(r===0&&n.bound.x.lo>=s||r===1&&n.bound.x.hi<=s)return n;var o=n.faceEdge,a=n.bound.y.clampPoint(O1(s,o.a.x,o.b.x,o.a.y,o.b.y)),l=o.a.x>o.b.x==o.a.y>o.b.y,c=r===1===l?1:0;return t.updateBound(n,r,s,c,a)},this.clipVBound=function(n,r,s){if(r===0&&n.bound.y.lo>=s||r===1&&n.bound.y.hi<=s)return n;var o=n.faceEdge,a=n.bound.x.clampPoint(O1(s,o.a.y,o.b.y,o.a.x,o.b.x)),l=o.a.x>o.b.x==o.a.y>o.b.y,c=r===1===l?1:0;return t.updateBound(n,c,a,r,s)},this.clipVAxis=function(n,r){return n.bound.y.hi<=r.lo?[n,void 0]:n.bound.y.lo>=r.hi?[void 0,n]:[t.clipVBound(n,1,r.hi),t.clipVBound(n,0,r.lo)]},this.absorbIndexCell=function(n,r,s,o){if(o.isActive&&s.length!==0&&t.isShapeBeingRemoved(s[0].faceEdge.shapeID)){o.atCellID(n.id)||o.moveTo(n.entryVertex()),o.drawTo(n.exitVertex()),o.setNextCellID(Ia(n.id));for(var a=Ct(s),l;!(l=a()).done;){var c=l.value,u=c.faceEdge;if(!t.isShapeBeingRemoved(u.shapeID))break;u.hasInterior&&o.testEdge(u.shapeID,u.edge)}}o.saveAndClearStateBefore(t.pendingAdditionsPos);var f=[],d=!1,A=r.indexCell();if(A)for(var y=Ct(A.shapes),w;!(w=y()).done;){var S=w.value,T=S.shapeID,R=t.shape(T);if(R){var P=S.numEdges(),I=new iH(T,void 0,void 0,R.dimension()===2);I.hasInterior&&(o.addShape(T,S.containsCenter),!d&&P>0&&(o.moveTo(n.center()),o.drawTo(n.entryVertex()),o.setNextCellID(n.id),d=!0));for(var F=0;F<P;F++){var D=S.edges[F];I.edgeID=D,I.edge=R.edge(D),I.maxLevel=rH(I.edge),I.hasInterior&&o.testEdge(T,I.edge);var L=uy(I.edge.v0,I.edge.v1,fu(n.id),E1),C=L[0],B=L[1],k=L[2];if(!k)throw new Error("invariant failure in ShapeIndex");I.a=C,I.b=B,f.push(I)}}}for(var z=f.map(function(H){return new kL(H,xfe(H.a,H.b,n.bound()))}),G=Ct(s),W;!(W=G()).done;){var Y=W.value;if(!t.isShapeBeingRemoved(Y.faceEdge.shapeID)){z.push.apply(z,s.slice(s.indexOf(Y)));break}}s=z,t.cellMap.delete(n.id)},this.testAllEdges=function(n,r){for(var s=Ct(n),o;!(o=s()).done;){var a=o.value;a.faceEdge.hasInterior&&r.testEdge(a.faceEdge.shapeID,a.faceEdge.edge)}},this.countShapes=function(n,r){for(var s=0,o=-1,a=0,l=0,c=Ct(n),u;!(u=c()).done;){var f=u.value;if(f.faceEdge.shapeID!==o)for(s++,o=f.faceEdge.shapeID;l<r.length&&(a=r[l],!(a>o));)a<o&&s++,l++}return s+=r.length-l,s},this.maxEdgesPerCell=10,this.nextID=0,this.shapes=new Map,this.cellMap=new Map,this.cells=[],this.status=ty,this.pendingAdditionsPos=0,this.pendingRemovals=[]}var e=i.prototype;return e.removeShapeInternal=function(n,r,s){},i})(),rH=function(e){var t=e.v0.vector.sub(e.v1.vector).norm()*Efe;return efe.minLevel(t)},Mfe=function(e,t,n,r){this.shapeID=e,this.hasInterior=t,this.containsTrackerOrigin=n,this.edges=r};function Cfe(){return{distance:Cc(),shapeID:-1,edgeID:-1}}function zL(i,e){return i.distance<e.distance?-1:i.distance>e.distance?1:i.shapeID<e.shapeID?-1:i.shapeID>e.shapeID?1:i.edgeID<e.edgeID?-1:i.edgeID>e.edgeID?1:0}var GH=(function(){function i(){this.maxResults=1/0,this.maxDistance=Cc(),this.maxError=0,this.includeInteriors=!0,this.useBruteForce=!1}var e=i.prototype;return e.setInclusiveMaxDistance=function(n){this.maxDistance=F1(n)},e.setConservativeMaxDistance=function(n){this.maxDistance=F1(PT(n,nfe(n)))},e.clone=function(){var n=new i;return n.maxResults=this.maxResults,n.maxDistance=this.maxDistance,n.maxError=this.maxError,n.includeInteriors=this.includeInteriors,n.useBruteForce=this.useBruteForce,n},i})(),Rfe=(function(){function i(t){this._includeInteriors=!0,this.point=t}var e=i.prototype;return e.maxBruteForceIndexSize=function(){return 120},e.updateMinDistanceToEdge=function(n,r,s){var o=du(this.point,n,r,s);return{distance:o.dist,updated:o.less}},e.updateMinDistanceToPoint=function(n,r){var s=We.chordAngleBetweenPoints(this.point,n);return s<r?{distance:s,updated:!0}:{distance:r,updated:!1}},e.updateMinDistanceToCell=function(n,r){var s=n.distance(this.point);return s<r?{distance:s,updated:!0}:{distance:r,updated:!1}},e.includeInteriors=function(){return this._includeInteriors},e.setIncludeInteriors=function(n){this._includeInteriors=n},e.setMaxError=function(n){return!1},e.visitContainingShapeIds=function(n,r){var s=this,o=new bp(n,Yf);return o.visitContainingShapes(this.point,function(a){var l=n.idForShape(a);return l>=0?r(l,s.point):!0})},e.getCapBound=function(){return{center:this.point,radius:0}},i})(),Ife=(function(){function i(t,n){this._includeInteriors=!0,this.a=t,this.b=n}var e=i.prototype;return e.maxBruteForceIndexSize=function(){return 60},e.updateMinDistanceToEdge=function(n,r,s){return HH(this.a,this.b,n,r,s)},e.updateMinDistanceToPoint=function(n,r){var s=du(n,this.a,this.b,r);return{distance:s.dist,updated:s.less}},e.updateMinDistanceToCell=function(n,r){var s=n.distanceToEdge(this.a,this.b);return s<r?{distance:s,updated:!0}:{distance:r,updated:!1}},e.includeInteriors=function(){return this._includeInteriors},e.setIncludeInteriors=function(n){this._includeInteriors=n},e.setMaxError=function(n){return!1},e.visitContainingShapeIds=function(n,r){for(var s=new bp(n,Yf),o=new Set,a=function(){var d=u[c],A=s.visitContainingShapes(d,function(y){var w=n.idForShape(y);return w>=0&&!o.has(w)?(o.add(w),r(w,d)):!0});if(!A)return{v:!1}},l,c=0,u=[this.a,this.b];c<u.length;c++)if(l=a(),l)return l.v;return!0},e.getCapBound=function(){var n=We.fromVector(this.a.vector.add(this.b.vector).normalize()),r=Math.max(We.chordAngleBetweenPoints(n,this.a),We.chordAngleBetweenPoints(n,this.b));return{center:n,radius:r}},i})(),Pfe=(function(){function i(t){this._includeInteriors=!0,this.cell=t}var e=i.prototype;return e.maxBruteForceIndexSize=function(){return 30},e.updateMinDistanceToEdge=function(n,r,s){var o=this.cell.distanceToEdge(n,r);return o<s?{distance:o,updated:!0}:{distance:s,updated:!1}},e.updateMinDistanceToPoint=function(n,r){var s=this.cell.distance(n);return s<r?{distance:s,updated:!0}:{distance:r,updated:!1}},e.updateMinDistanceToCell=function(n,r){var s=this.cell.distanceToCell(n);return s<r?{distance:s,updated:!0}:{distance:r,updated:!1}},e.includeInteriors=function(){return this._includeInteriors},e.setIncludeInteriors=function(n){this._includeInteriors=n},e.setMaxError=function(n){return!1},e.visitContainingShapeIds=function(n,r){var s=new bp(n,Yf),o=this.cell.center();return s.visitContainingShapes(o,function(a){var l=n.idForShape(a);return l>=0?r(l,o):!0})},e.getCapBound=function(){for(var n=this.cell.center(),r=0,s=0;s<4;s++){var o=We.chordAngleBetweenPoints(n,this.cell.vertex(s));o>r&&(r=o)}return{center:n,radius:r}},i})(),qH=(function(){function i(t){this._includeInteriors=!0,this.index=t,this.query=new bp(t,Yf)}var e=i.prototype;return e.maxBruteForceIndexSize=function(){return 25},e.updateMinDistanceToEdge=function(n,r,s){if(this._includeInteriors&&(this.query.contains(n)||this.query.contains(r)))return{distance:0,updated:s>0};for(var o=!1,a=Ct(this.index.shapes),l;!(l=a()).done;){var c=l.value,u=c[1];if(u)for(var f=u.numEdges(),d=0;d<f;d++){var A=u.edge(d),y=HH(n,r,A.v0,A.v1,s);if(y.updated&&(s=y.distance,o=!0),s===0)return{distance:0,updated:o}}}return{distance:s,updated:o}},e.updateMinDistanceToPoint=function(n,r){if(this._includeInteriors&&this.query.contains(n))return{distance:0,updated:r>0};for(var s=!1,o=Ct(this.index.shapes),a;!(a=o()).done;){var l=a.value,c=l[1];if(c)for(var u=c.numEdges(),f=0;f<u;f++){var d=c.edge(f),A=du(n,d.v0,d.v1,r);if(A.less&&(r=A.dist,s=!0),r===0)return{distance:0,updated:s}}}return{distance:r,updated:s}},e.updateMinDistanceToCell=function(n,r){if(this._includeInteriors&&this.query.contains(n.center()))return{distance:0,updated:r>0};for(var s=!1,o=Ct(this.index.shapes),a;!(a=o()).done;){var l=a.value,c=l[1];if(c)for(var u=c.numEdges(),f=0;f<u;f++){var d=c.edge(f),A=n.distanceToEdge(d.v0,d.v1);if(A<r&&(r=A,s=!0),r===0)return{distance:0,updated:s}}}return{distance:r,updated:s}},e.includeInteriors=function(){return this._includeInteriors},e.setIncludeInteriors=function(n){this._includeInteriors=n},e.setMaxError=function(n){return!1},e.visitContainingShapeIds=function(n,r){for(var s=new bp(n,Yf),o=new Set,a=Ct(this.index.shapes),l;!(l=a()).done;){var c=l.value,u=c[1];if(u){for(var f=u.numEdges(),d=0;d<f;d++)for(var A=u.edge(d),y=function(){var P=T[S],I=s.visitContainingShapes(P,function(F){var D=n.idForShape(F);return D>=0&&!o.has(D)?(o.add(D),r(D,P)):!0});if(!I)return{v:!1}},w,S=0,T=[A.v0,A.v1];S<T.length;S++)if(w=y(),w)return w.v}}return!0},e.getCapBound=function(){if(this.index.len()===0)return null;for(var n=null,r=0,s=Ct(this.index.shapes),o;!(o=s()).done;){var a=o.value,l=a[1];if(l)for(var c=l.numEdges(),u=0;u<c;u++){var f=l.edge(u);n===null&&(n=f.v0);var d=We.chordAngleBetweenPoints(n,f.v0),A=We.chordAngleBetweenPoints(n,f.v1);r=Math.max(r,d,A)}}return n===null?null:{center:n,radius:r}},i})();function HH(i,e,t,n,r){if(r===0)return{distance:0,updated:!1};if(PH(i,e,t,n)===Ec)return{distance:0,updated:!0};var s=!1,o=du(i,t,n,r);return o.less&&(r=o.dist,s=!0),o=du(e,t,n,r),o.less&&(r=o.dist,s=!0),o=du(t,i,e,r),o.less&&(r=o.dist,s=!0),o=du(n,i,e,r),o.less&&(r=o.dist,s=!0),{distance:r,updated:s}}var Lfe=(function(){function i(t,n){n===void 0&&(n=new GH),this.indexNumEdges=0,this.indexNumEdgesLimit=0,this.index=t,this.options=n,this.iter=t.iterator()}var e=i.prototype;return e.reInit=function(){this.indexNumEdges=0,this.indexNumEdgesLimit=0,this.iter=this.index.iterator()},e.findClosestEdges=function(n,r){return this.findClosestEdgesInternal(n,this.options,r)},e.visitClosestEdges=function(n,r,s,o){for(var a=this.findClosestEdgesInternal(n,r,o),l=Ct(a),c;!(c=l()).done;){var u=c.value;if(!s(u))break}},e.visitClosestShapes=function(n,r,s,o){for(var a=this.findClosestEdgesInternal(n,r,o),l=new Set,c=-1,u=Ct(a),f;!(f=u()).done;){var d=f.value,A=d.shapeID;if(A!==c&&!l.has(A)&&(l.add(A),c=A,!s(d)))break}},e.findClosestEdge=function(n,r){var s=this.options.clone();s.maxResults=1;var o=this.findClosestEdgesInternal(n,s,r);return o.length===0?Cfe():o[0]},e.getDistance=function(n,r){return this.findClosestEdge(n,r).distance},e.isDistanceLess=function(n,r,s){var o=this.options.clone();o.maxResults=1,o.maxDistance=r,o.maxError=Sc;var a=this.findClosestEdgesInternal(n,o,s);return a.length>0},e.isDistanceLessOrEqual=function(n,r,s){var o=this.options.clone();o.maxResults=1,o.setInclusiveMaxDistance(r),o.maxError=Sc;var a=this.findClosestEdgesInternal(n,o,s);return a.length>0},e.isConservativeDistanceLessOrEqual=function(n,r,s){var o=this.options.clone();o.maxResults=1,o.setConservativeMaxDistance(r),o.maxError=Sc;var a=this.findClosestEdgesInternal(n,o,s);return a.length>0},e.getEdge=function(n){var r=this.index.shape(n.shapeID);return r.edge(n.edgeID)},e.project=function(n,r){if(r.edgeID<0)return n;var s=this.getEdge(r);return DH(n,s.v0,s.v1)},e.findClosestEdgesInternal=function(n,r,s){var o=r.maxDistance,a=[];if(o===0)return a;if(r.includeInteriors){var l=new Set;n.visitContainingShapeIds(this.index,function(T,R){return(!s||s(T))&&l.add(T),l.size<r.maxResults});for(var c=Ct(l),u;!(u=c()).done;){var f=u.value;a.push({distance:0,shapeID:f,edgeID:-1})}if(o===0)return a}var d=n.maxBruteForceIndexSize()+1;d>this.indexNumEdgesLimit&&this.indexNumEdges>=this.indexNumEdgesLimit&&(this.indexNumEdges=this.countEdgesUpTo(d),this.indexNumEdgesLimit=d),r.useBruteForce||this.indexNumEdges<d?this.findClosestEdgesBruteForce(n,r,s,o,a):this.findClosestEdgesOptimized(n,r,s,o,a),a.sort(zL);for(var A=[],y=0,w=a;y<w.length;y++){var S=w[y];(A.length===0||A[A.length-1].shapeID!==S.shapeID||A[A.length-1].edgeID!==S.edgeID)&&A.push(S)}return A.length>r.maxResults&&(A.length=r.maxResults),A},e.findClosestEdgesBruteForce=function(n,r,s,o,a){for(var l=Ct(this.index.shapes),c;!(c=l()).done;){var u=c.value,f=u[0],d=u[1];if(d&&!(s&&!s(f)))for(var A=d.numEdges(),y=0;y<A;y++){var w=d.edge(y),S=n.updateMinDistanceToEdge(w.v0,w.v1,o);if(S.updated){var T={distance:S.distance,shapeID:f,edgeID:y};r.maxResults===1?(a.length===0?a.push(T):a[0]=T,o=S.distance-r.maxError):r.maxResults===1/0?a.push(T):(a.push(T),a.length>r.maxResults&&(a.sort(zL),a.length=r.maxResults,o=a[a.length-1].distance-r.maxError))}}}},e.findClosestEdgesOptimized=function(n,r,s,o,a){var l=n.getCapBound();if(l){if(this.iter=this.index.iterator(),r.maxResults===1&&this.iter.locatePoint(l.center)){var c=this.iter.indexCell();if(o=this.processIndexCell(n,r,s,c,o,a),o===0)return}var u=[];for(this.iter.begin();!this.iter.done();){var f=this.iter.cellID(),d=Ra.fromCellID(f),A=n.updateMinDistanceToCell(d,o);A.distance<o&&u.push({distance:A.distance,id:f,indexCell:this.iter.indexCell()}),this.iter.next()}for(u.sort(function(C,B){return C.distance-B.distance});u.length>0;){var y=u.shift();if(y.distance>=o)break;if(y.indexCell!==null)o=this.processIndexCell(n,r,s,y.indexCell,o,a);else{console.log("HEYYYY");for(var w=z1(y.id),S=Ct(w),T;!(T=S()).done;){var R=T.value,P=this.iter.locateCellID(R);if(P===wp){var I=Ra.fromCellID(this.iter.cellID()),F=n.updateMinDistanceToCell(I,o);F.distance<o&&u.push({distance:F.distance,id:this.iter.cellID(),indexCell:this.iter.indexCell()})}else if(P===vy){var D=Ra.fromCellID(R),L=n.updateMinDistanceToCell(D,o);L.distance<o&&u.push({distance:L.distance,id:R,indexCell:null})}}u.sort(function(C,B){return C.distance-B.distance})}}}},e.processIndexCell=function(n,r,s,o,a,l){for(var c=Ct(o.shapes),u;!(u=c()).done;){var f=u.value,d=f.shapeID;if(!(s&&!s(d))){var A=this.index.shape(d);if(A)for(var y=Ct(f.edges),w;!(w=y()).done;){var S=w.value,T=A.edge(S),R=n.updateMinDistanceToEdge(T.v0,T.v1,a);if(R.updated){var P={distance:R.distance,shapeID:d,edgeID:S};r.maxResults===1?(l.length===0?l.push(P):l[0]=P,a=R.distance-r.maxError):r.maxResults===1/0?l.push(P):(l.push(P),l.length>r.maxResults&&(l.sort(zL),l.length=r.maxResults,a=l[l.length-1].distance-r.maxError))}}}}return a},e.countEdgesUpTo=function(n){for(var r=0,s=Ct(this.index.shapes),o;!(o=s()).done;){var a=o.value,l=a[1];if(l&&(r+=l.numEdges(),r>=n))break}return r},i})();function Dfe(){return{distance:Cc(),cellID:0n,label:-1}}function Nfe(i){return i.label<0}var WH=(function(){function i(){this.maxResults=1/0,this.maxDistance=Cc(),this.maxError=0}var e=i.prototype;return e.setInclusiveMaxDistance=function(n){this.maxDistance=F1(n)},e.setConservativeMaxDistance=function(n){this.maxDistance=F1(PT(n,this.computeMaxDistanceError(n)))},e.computeMaxDistanceError=function(n){return lD(n)},i})(),Ffe=(function(){function i(t){this.point=t}var e=i.prototype;return e.maxBruteForceIndexSize=function(){return 100},e.distanceToCell=function(n){return n.distance(this.point)},e.distanceToPoint=function(n){return We.chordAngleBetweenPoints(this.point,n)},i})(),Bfe=(function(){function i(t,n){this.a=t,this.b=n}var e=i.prototype;return e.maxBruteForceIndexSize=function(){return 100},e.distanceToCell=function(n){return n.distanceToEdge(this.a,this.b)},e.distanceToPoint=function(n){return du(n,this.a,this.b,Cc()).dist},i})(),Ofe=(function(){function i(t){this.cell=t}var e=i.prototype;return e.maxBruteForceIndexSize=function(){return 100},e.distanceToCell=function(n){return this.cell.distanceToCell(n)},e.distanceToPoint=function(n){return this.cell.distance(n)},i})(),Ufe=(function(){function i(t){this.cellUnion=t}var e=i.prototype;return e.maxBruteForceIndexSize=function(){return 100},e.distanceToCell=function(n){for(var r=Cc(),s=Ct(this.cellUnion),o;!(o=s()).done;){var a=o.value,l=Ra.fromCellID(a),c=l.distanceToCell(n);if(c<r&&(r=c),r===0)break}return r},e.distanceToPoint=function(n){for(var r=Cc(),s=Ct(this.cellUnion),o;!(o=s()).done;){var a=o.value,l=Ra.fromCellID(a),c=l.distance(n);if(c<r&&(r=c),r===0)break}return r},i})(),kfe=(function(){function i(t){this.index=t,this.edgeTarget=new qH(t)}var e=i.prototype;return e.setIncludeInteriors=function(n){this.edgeTarget.setIncludeInteriors(n)},e.maxBruteForceIndexSize=function(){return this.edgeTarget.maxBruteForceIndexSize()},e.distanceToCell=function(n){var r=this.edgeTarget.updateMinDistanceToCell(n,Cc());return r.distance},e.distanceToPoint=function(n){var r=this.edgeTarget.updateMinDistanceToPoint(n,Cc());return r.distance},i})(),zfe=(function(){function i(t,n){n===void 0&&(n=new WH),this.index=t,this.options=n}var e=i.prototype;return e.findClosestCells=function(n){var r=new FH(this.index,!0),s=new BH(this.index),o=[];for(r.begin();!r.done();r.next())for(s.startUnion(r);!s.done();){var a=s.cellID(),l=s.label(),c=Ra.fromCellID(a);if(this.options.region&&!this.options.region.intersectsCell(c)){s.next();continue}var u=n.distanceToCell(c);u<this.options.maxDistance&&o.push({cellID:a,label:l,distance:u}),s.next()}o.sort(function(d,A){return d.distance-A.distance});var f=Math.min(o.length,this.options.maxResults);return o.slice(0,f)},e.findClosestCell=function(n){var r=this.options.maxResults;this.options.maxResults=1;var s=this.findClosestCells(n);return this.options.maxResults=r,s.length===0?Dfe():s[0]},e.getDistance=function(n){return this.findClosestCell(n).distance},e.isDistanceLess=function(n,r){var s=this.options.maxResults,o=this.options.maxDistance;this.options.maxResults=1,this.options.maxDistance=r;var a=this.findClosestCell(n);return this.options.maxResults=s,this.options.maxDistance=o,!Nfe(a)},e.isDistanceLessOrEqual=function(n,r){return this.isDistanceLess(n,F1(r))},e.isConservativeDistanceLessOrEqual=function(n,r){return this.isDistanceLess(n,F1(PT(r,lD(r))))},i})(),U1=(function(){function i(){this.a=new We(0,0,0),this.aLL=new ar(0,0),this.bound=Ri.emptyRect()}i.maxErrorForTests=function(){return new ar(10*Ki,1*Ki)};var e=i.prototype;return e.addPoint=function(n){var r=ar.fromPoint(n);if(this.bound.isEmpty()){this.a=n,this.aLL=r,this.bound=this.bound.addPoint(r);return}var s=this.a.vector.sub(n.vector).cross(this.a.vector.add(n.vector)),o=s.norm();if(o<191346e-20){this.a.vector.dot(n.vector)<0?this.bound=Ri.fullRect():this.bound=this.bound.union(Ri.fromLatLng(this.aLL).addPoint(r)),this.a=n,this.aLL=r;return}var a=to.emptyInterval().addPoint(this.aLL.lng).addPoint(r.lng);a.length()>=Math.PI-2*Ki&&(a=to.fullInterval());var l=Li.fromPoint(this.aLL.lat).addPoint(r.lat),c=s.cross(new Wt(0,0,1)),u=c.dot(this.a.vector),f=c.dot(n.vector),d=606638e-21*o+683174e-36;if(u*f<0||Math.abs(u)<=d||Math.abs(f)<=d){var A=Math.min(Math.atan2(Math.sqrt(s.x*s.x+s.y*s.y),Math.abs(s.z))+3*Ki,Math.PI/2),y=2*Math.asin(.5*this.a.vector.sub(n.vector).norm()*Math.sin(A)),w=.5*(y-l.length())+Ki;u<=d&&f>=-d&&(l.hi=Math.min(A,l.hi+w)),f<=d&&u>=-d&&(l.lo=Math.max(-A,l.lo-w))}this.a=n,this.aLL=r,this.bound=this.bound.union(new Ri(l,a))},e.rectBound=function(){return this.bound.expanded(new ar(2*Ki,0)).polarClosure()},i})();U1.expandForSubregions=function(i){if(i.isEmpty())return i;var e=Math.max(0,Math.PI-i.lng.length()-2.5*Ki),t=Math.max(i.lat.lo,-i.lat.hi),n=Math.PI/2+i.lat.lo,r=Math.PI/2-i.lat.hi;if(t>=0){if(2*t+e<1354e-18)return Ri.fullRect()}else if(e>=Math.PI/2){if(n+r<1687e-18)return Ri.fullRect()}else if(Math.max(n,r)*e<1765e-18)return Ri.fullRect();var s=9*Ki,o=0;return e<=0&&(o=Math.PI),i.expanded(new ar(s,o)).polarClosure()};var jH=function(e,t,n,r,s){return We.orderedCCW(n,s,r,t)&&We.orderedCCW(r,e,n,t)},Vfe=function(e,t,n,r,s){return!(We.orderedCCW(e,s,r,t)&&We.orderedCCW(r,n,e,t))},Gfe=(function(){function i(t){this.a=new Ci(0,0),this.b=new Ci(0,0),this.index=t,this.iter=t.iterator(),this.cells=[]}var e=i.prototype;return e.crossings=function(n,r,s,o){var a=this.candidates(n,r,s);if(a.length===0)return[];for(var l=new Gl(n,r),c=0,u=a.length,f=0;f<u;f++){var d=s.edge(a[f]),A=l.crossingSign(d.v0,d.v1);(o===gT&&(A===MT||A===Ec)||o!==gT&&A===Ec)&&(a[c]=a[f],c++)}return c<u&&(a=a.slice(0,c)),a},e.crossingsEdgeMap=function(n,r,s){var o=this.candidatesEdgeMap(n,r);if(o.size===0)return o;var a=new Gl(n,r);return o.forEach(function(l,c){for(var u=l.length,f=0,d=0;d<u;d++){var A=c.edge(l[d]),y=a.crossingSign(A.v0,A.v1);(s===gT&&(y===MT||y===Ec)||s!==gT&&y===Ec)&&(l[f]=l[d],o.set(c,l),f++)}f===0?o.delete(c):f<u&&o.set(c,o.get(c).slice(0,f))}),o},e.candidates=function(n,r,s){var o=[],a=27,l=s.numEdges();if(l<=a)return o=Array.from({length:l},function(w,S){return S}),o;if(this.getCellsForEdge(n,r),this.cells.length===0)return[];var c=-1;this.index.shapes.forEach(function(w,S){w===s&&(c=S)});for(var u=Ct(this.cells),f;!(f=u()).done;){var d,A=f.value;if(A){var y=A.findByShapeID(c);y&&(d=o).push.apply(d,y.edges)}}return this.cells.length>1&&(o=i.uniqueInts(o)),o},i.uniqueInts=function(n){for(var r=[],s={},o=Ct(n),a;!(a=o()).done;){var l=a.value;s[l]||(s[l]=!0,r.push(l))}return r.sort(function(c,u){return c-u}),r},e.candidatesEdgeMap=function(n,r){var s=new qfe;if(this.index.shapes.size===1){var o=this.index.shape(0);return s.set(o,this.candidates(n,r,o)),s}if(this.getCellsForEdge(n,r),this.cells.length===0)return s;for(var a=Ct(this.cells),l;!(l=a()).done;)for(var c=l.value,u=Ct(c.shapes),f;!(f=u()).done;)for(var d=f.value,A=this.index.shape(d.shapeID),y=0;y<d.numEdges();y++)s.set(A,(s.get(A)||[]).concat([d.edges[y]]));return this.cells.length>1&&s.forEach(function(w,S){s.set(S,i.uniqueInts(w))}),s},e.getCells=function(n,r,s){var o=vfe(n,r,fu(s.id)),a=o[0],l=o[1],c=o[2];if(c){this.a=a,this.b=l;var u=Hr.fromPoints(this.a,this.b);s.bound().intersects(u)&&this.computeCellsIntersected(s,u)}return this.cells.length===0?[]:this.cells},e.getCellsForEdge=function(n,r){this.cells=[];for(var s=wfe(n,r),o=Ct(s),a;!(a=o()).done;){var l=a.value;this.a=l.a,this.b=l.b;var c=Hr.fromPoints(this.a,this.b),u=Ma.fromCellID(yp(l.face),0),f=u.shrinkToFit(c),d=this.iter.locateCellID(f);d===wp?this.cells.push(this.iter.indexCell()):d===vy&&(dy(f)||(u=Ma.fromCellID(f,0)),this.computeCellsIntersected(u,c))}},e.computeCellsIntersected=function(n,r){if(this.iter.seek(qi(n.id)),!(this.iter.done()||this.iter.cellID()>Gi(n.id))){if(this.iter.cellID()===n.id){this.cells.push(this.iter.indexCell());return}var s=n.middle().lo();if(r.x.hi<s.x){this.clipVAxis(r,s.y,0,n);return}else if(r.x.lo>=s.x){this.clipVAxis(r,s.y,1,n);return}var o=this.splitUBound(r,s.x);r.y.hi<s.y?(this.computeCellsIntersected(Ma.fromParentIJ(n,0,0),o[0]),this.computeCellsIntersected(Ma.fromParentIJ(n,1,0),o[1])):r.y.lo>=s.y?(this.computeCellsIntersected(Ma.fromParentIJ(n,0,1),o[0]),this.computeCellsIntersected(Ma.fromParentIJ(n,1,1),o[1])):(this.clipVAxis(o[0],s.y,0,n),this.clipVAxis(o[1],s.y,1,n))}},e.clipVAxis=function(n,r,s,o){if(n.y.hi<r)this.computeCellsIntersected(Ma.fromParentIJ(o,s,0),n);else if(n.y.lo>=r)this.computeCellsIntersected(Ma.fromParentIJ(o,s,1),n);else{var a=this.splitVBound(n,r);this.computeCellsIntersected(Ma.fromParentIJ(o,s,0),a[0]),this.computeCellsIntersected(Ma.fromParentIJ(o,s,1),a[1])}},e.splitUBound=function(n,r){var s=n.y.clampPoint(O1(r,this.a.x,this.b.x,this.a.y,this.b.y)),o=this.a.x>this.b.x!=this.a.y>this.b.y?1:0;return this.splitBound(n,0,o,r,s)},e.splitVBound=function(n,r){var s=n.x.clampPoint(O1(r,this.a.y,this.b.y,this.a.x,this.b.x)),o=this.a.x>this.b.x!=this.a.y>this.b.y?1:0;return this.splitBound(n,o,0,s,r)},e.splitBound=function(n,r,s,o,a){var l=[Hr.fromRect(n),Hr.fromRect(n)];return r===1?(l[0].x.lo=o,l[1].x.hi=o):(l[0].x.hi=o,l[1].x.lo=o),s===1?(l[0].y.lo=a,l[1].y.hi=a):(l[0].y.hi=a,l[1].y.lo=a),l},i})(),qfe=(function(i){function e(){return i.apply(this,arguments)||this}return hy(e,i),e})(D1(Map)),Hfe=function(e,t,n){var r=1,s=t.distance(n);s!==0&&(r=s/Math.sin(s));var o=1,a=n.distance(e);a!==0&&(o=a/Math.sin(a));var l=1,c=e.distance(t);c!==0&&(l=c/Math.sin(c));var u=new Wt(e.x,t.x-e.x,n.x-e.x),f=new Wt(e.y,t.y-e.y,n.y-e.y),d=new Wt(e.z,t.z-e.z,n.z-e.z),A=new Wt(r,o-r,l-r);return We.fromVector(new Wt(f.cross(d).dot(A),d.cross(u).dot(A),u.cross(f).dot(A)).mul(.5))},sH=new We(0,0,1),oH=new We(0,0,-1),sD=(function(){function i(t){this.originInside=!1,this.depth=0,this.bound=Ri.emptyRect(),this.subregionBound=Ri.emptyRect(),this.vertices=t,this.index=new CT,this.initOriginAndBound()}i.fromCell=function(n){var r=[n.vertex(0),n.vertex(1),n.vertex(2),n.vertex(3)];return new i(r)},i.fromLoop=function(n){return new i(n.vertices.map(function(r){return We.fromVector(r.vector)}))},i.emptyLoop=function(){return new i([sH])},i.fullLoop=function(){return new i([oH])};var e=i.prototype;return e.initOriginAndBound=function(){if(this.vertices.length<3){if(!this.isEmptyOrFull()){this.originInside=!1;return}this.originInside=this.vertices[0].z<0}else{var n=this.vertices[0]!==this.vertices[1]&&this.vertices[2]!==this.vertices[1]&&Jhe(this.vertices[0],this.vertices[1],this.vertices[2]);this.originInside=!1,n!==this.containsPoint(this.vertices[1])&&(this.originInside=!0)}this.initBound(),this.index.add(this)},e.copyFrom=function(n){this.vertices=n.vertices,this.originInside=n.originInside,this.depth=n.depth,this.bound=n.bound,this.subregionBound=n.subregionBound,this.index=n.index},e.initBound=function(){if(this.vertices.length===0){this.copyFrom(i.emptyLoop());return}if(this.isEmptyOrFull()){this.isEmpty()?this.bound=Ri.emptyRect():this.bound=Ri.fullRect(),this.subregionBound=this.bound;return}for(var n=new U1,r=0;r<=this.vertices.length;r++)n.addPoint(this.vertex(r));var s=n.rectBound();this.containsPoint(new We(0,0,1))&&(s=new Ri(new Li(s.lat.lo,Math.PI/2),to.fullInterval())),s.lng.isFull()&&this.containsPoint(new We(0,0,-1))&&(s.lat.lo=-Math.PI/2),this.bound=s,this.subregionBound=U1.expandForSubregions(this.bound)},e.validate=function(){var n=this.findValidationErrorNoIndex();return n||null},e.findValidationErrorNoIndex=function(){for(var n=0;n<this.vertices.length;n++){var r=this.vertices[n];if(!r.vector.isUnit())return new Error("vertex "+n+" is not unit length")}if(this.vertices.length<3)return this.isEmptyOrFull()?null:new Error("non-empty, non-full loops must have at least 3 vertices");for(var s=0;s<this.vertices.length;s++){if(this.vertices[s].equals(this.vertex(s+1)))return new Error("edge "+s+" is degenerate (duplicate vertex)");var o=We.fromVector(this.vertex(s+1).vector.mul(-1));if(this.vertices[s].equals(o))return new Error("vertices "+s+" and "+(s+1)%this.vertices.length+" are antipodal")}return null},e.contains=function(n){if(!this.subregionBound.contains(n.bound))return!1;if(this.isEmptyOrFull()||n.isEmptyOrFull())return this.isFull()||n.isEmpty();var r=new Wfe;return VL(this,n,r)?!1:r.foundSharedVertex?!0:!(!this.containsPoint(n.vertex(0))||(n.subregionBound.contains(this.bound)||n.bound.union(this.bound).isFull())&&n.containsPoint(this.vertex(0)))},e.intersects=function(n){if(!this.bound.intersects(n.bound))return!1;var r=new jfe;return VL(this,n,r)?!0:r.foundSharedVertex?!1:!!((this.subregionBound.contains(n.bound)||this.bound.union(n.bound).isFull())&&this.containsPoint(n.vertex(0))||n.subregionBound.contains(this.bound)&&n.containsPoint(this.vertex(0)))},e.equal=function(n){if(this.vertices.length!==n.vertices.length)return!1;for(var r=0;r<this.vertices.length;r++)if(this.vertices[r]!==n.vertex(r))return!1;return!0},e.boundaryEqual=function(n){if(this.vertices.length!==n.vertices.length)return!1;if(this.isEmptyOrFull())return this.isEmpty()===n.isEmpty();for(var r=0;r<this.vertices.length;r++)if(this.vertices[r].equals(n.vertex(0))){for(var s=0;s<this.vertices.length;s++)if(this.vertex(s+r)!==n.vertex(s))return!1;return!0}return!1},e.compareBoundary=function(n){if(!this.bound.intersects(n.bound))return-1;if(this.isFull())return 1;if(n.isFull())return-1;var r=new Xfe(n.isHole());return VL(this,n,r)?0:r.foundSharedVertex?r.containsEdge?1:-1:this.containsPoint(n.vertex(0))?1:-1},e.containsOrigin=function(){return this.originInside},e.referencePoint=function(){return FT(this.originInside)},e.numEdges=function(){return this.isEmptyOrFull()?0:this.vertices.length},e.edge=function(n){return new ah(this.vertex(n),this.vertex(n+1))},e.numChains=function(){return this.isEmpty()?0:1},e.chain=function(n){return new L1(0,this.numEdges())},e.chainEdge=function(n,r){return new ah(this.vertex(r),this.vertex(r+1))},e.chainPosition=function(n){return new NT(0,n)},e.dimension=function(){return 2},e.typeTag=function(){return OH},e.privateInterface=function(){},e.isEmpty=function(){return this.isEmptyOrFull()&&!this.containsOrigin()},e.isFull=function(){return this.isEmptyOrFull()&&this.containsOrigin()},e.isEmptyOrFull=function(){return this.vertices.length===1},e.rectBound=function(){return this.bound},e.capBound=function(){return this.bound.capBound()},e.vertex=function(n){return this.vertices[n%this.vertices.length]},e.orientedVertex=function(n){var r=n-this.vertices.length;return r<0&&(r=n),this.isHole()&&(r=this.vertices.length-1-r),this.vertex(r)},e.numVertices=function(){return this.vertices.length},e.bruteForceContainsPoint=function(n){for(var r=We.originPoint(),s=this.originInside,o=Gl.newChainEdgeCrosser(r,n,this.vertex(0)),a=1;a<=this.vertices.length;a++)s=s!==o.edgeOrVertexChainCrossing(this.vertex(a));return s},e.containsPoint=function(n){if(!this.index.isFresh()&&!this.bound.containsPoint(n))return!1;var r=32;if(this.index.shapes.size===0||this.vertices.length<=r)return this.bruteForceContainsPoint(n);var s=this.index.iterator();return s.locatePoint(n)?this.iteratorContainsPoint(s,n):!1},e.containsCell=function(n){var r=this.index.iterator(),s=r.locateCellID(n.id);return s!==wp||this.boundaryApproxIntersects(r,n)?!1:this.iteratorContainsPoint(r,n.center())},e.intersectsCell=function(n){var r=this.index.iterator(),s=r.locateCellID(n.id);return s===BT?!1:s===vy||r.cellID()===n.id||this.boundaryApproxIntersects(r,n)?!0:this.iteratorContainsPoint(r,n.center())},e.cellUnionBound=function(){return this.capBound().cellUnionBound()},e.boundaryApproxIntersects=function(n,r){var s=n.indexCell().findByShapeID(0);if(s.edges.length===0)return!1;if(n.cellID()===r.id)return!0;for(var o=gy+zH,a=r.boundUV().expandedByMargin(o),l=Ct(s.edges),c;!(c=l()).done;){var u=c.value,f=uy(this.vertex(u),this.vertex(u+1),r.face,o),d=f[0],A=f[1],y=f[2];if(y&&VH(d,A,a))return!0}return!1},e.iteratorContainsPoint=function(n,r){var s,o=(s=n.indexCell())==null?void 0:s.findByShapeID(0),a=o?.containsCenter||!1;if(o&&o.edges.length>0)for(var l=n.center(),c=new Gl(l,r),u=-2,f=Ct(o.edges),d;!(d=f()).done;){var A=d.value;A!==u+1&&c.restartAt(this.vertex(A)),u=A,a=a!==c.edgeOrVertexChainCrossing(this.vertex(A+1))}return a},i.regularLoop=function(n,r,s){return i.regularLoopForFrame(uD(n),r,s)},i.regularLoopForFrame=function(n,r,s){return new i(We.regularPointsForFrame(n,r,s))},e.canonicalFirstVertex=function(){for(var n=0,r=this.vertices.length,s=1;s<r;s++)this.vertex(s).vector.cmp(this.vertex(n).vector)===-1&&(n=s);return this.vertex(n+1).vector.cmp(this.vertex(n+r-1).vector)===-1?[n,1]:(n+=r,[n,-1])},e.turningAngle=function(){if(this.isEmptyOrFull())return this.containsOrigin()?-2*Math.PI:2*Math.PI;if(this.vertices.length<3)return 0;for(var n=this.canonicalFirstVertex(),r=n[0],s=n[1],o=Xq(this.vertex((r+this.vertices.length-s)%this.vertices.length),this.vertex(r),this.vertex((r+s)%this.vertices.length)),a=0,l=this.vertices.length-1;l>0;l--){r+=s;var c=Xq(this.vertex(r-s),this.vertex(r),this.vertex(r+s)),u=o;o+=c+a,a=u-o+c}var f=2*Math.PI-4*Ki;return Math.max(-f,Math.min(f,s*(o+a)))},e.turningAngleMaxError=function(){var n=11.25*Ki;return n*this.vertices.length},e.isHole=function(){return(this.depth&1)!==0},e.sign=function(){return this.isHole()?-1:1},e.isNormalized=function(){return this.bound.lng.length()<Math.PI?!0:this.turningAngle()>=-this.turningAngleMaxError()},e.normalize=function(){this.isNormalized()||this.invert()},e.invert=function(){if(this.index.reset(),this.isEmptyOrFull())this.vertices[0]=this.isFull()?sH:oH;else for(var n=Math.floor(this.vertices.length/2)-1;n>=0;n--){var r=this.vertices.length-1-n,s=[this.vertices[r],this.vertices[n]];this.vertices[n]=s[0],this.vertices[r]=s[1]}this.originInside=!this.originInside,this.bound.lat.lo>-Math.PI/2&&this.bound.lat.hi<Math.PI/2?(this.bound=Ri.fullRect(),this.subregionBound=this.bound):this.initBound(),this.index.add(this)},e.findVertex=function(n){var r=0;if(this.vertices.length<10){for(var s=1;s<=this.vertices.length;s++)if(this.vertex(s).equals(n))return[s,!0];return[r,!1]}var o=this.index.iterator();if(!o.locatePoint(n))return[r,!1];for(var a=o.indexCell().findByShapeID(0),l=a.numEdges()-1;l>=0;l--){var c=a.edges[l];if(this.vertex(c).equals(n))return c===0?[this.vertices.length,!0]:[c,!0];if(this.vertex(c+1).equals(n))return[c+1,!0]}return[r,!1]},e.containsNested=function(n){if(!this.subregionBound.contains(n.bound))return!1;if(this.isEmptyOrFull()||n.numVertices()<2)return this.isFull()||n.isEmpty();var r=this.findVertex(n.vertex(1)),s=r[0],o=r[1];return o?jH(this.vertex(s-1),this.vertex(s),this.vertex(s+1),n.vertex(0),n.vertex(2)):this.containsPoint(n.vertex(1))},e.surfaceIntegralFloat64=function(n){for(var r=Math.PI-1e-5,s=0,o=this.vertex(0),a=1;a+1<this.vertices.length;a++){if(this.vertex(a+1).vector.angle(o.vector)>r){var l=o;o.equals(this.vertex(0))?o=We.fromVector(this.vertex(0).pointCross(this.vertex(a)).vector.normalize()):this.vertex(a).vector.angle(this.vertex(0).vector)<r?o=this.vertex(0):(o=We.fromVector(this.vertex(0).vector.cross(l.vector)),s+=n(this.vertex(0),l,o)),s+=n(l,this.vertex(a),o)}s+=n(o,this.vertex(a),this.vertex(a+1))}return o!==this.vertex(0)&&(s+=n(o,this.vertex(this.vertices.length-1),this.vertex(0))),s},e.surfaceIntegralPoint=function(n){for(var r=Math.PI-1e-5,s=new We(0,0,0).vector,o=this.vertex(0),a=1;a+1<this.vertices.length;a++){if(this.vertex(a+1).vector.angle(o.vector)>r){var l=o;o.equals(this.vertex(0))?o=We.fromVector(this.vertex(0).pointCross(this.vertex(a)).vector.normalize()):this.vertex(a).vector.angle(this.vertex(0).vector)<r?o=this.vertex(0):(o=We.fromVector(this.vertex(0).vector.cross(l.vector)),s=s.add(n(this.vertex(0),l,o).vector)),s=s.add(n(l,this.vertex(a),o).vector)}s=s.add(n(o,this.vertex(a),this.vertex(a+1)).vector)}return o!==this.vertex(0)&&(s=s.add(n(o,this.vertex(this.vertices.length-1),this.vertex(0)).vector)),We.fromVector(s)},e.area=function(){if(this.isEmptyOrFull())return this.containsOrigin()?4*Math.PI:0;var n=this.surfaceIntegralFloat64(ofe),r=this.turningAngleMaxError();return n<0&&(n+=4*Math.PI),n>4*Math.PI&&(n=4*Math.PI),n<0&&(n=0),n<r&&!this.isNormalized()?4*Math.PI:n>4*Math.PI-r&&this.isNormalized()?0:n},e.centroid=function(){return this.surfaceIntegralPoint(Hfe)},e.containsNonCrossingBoundary=function(n,r){if(!this.bound.intersects(n.bound))return!1;if(this.isFull())return!0;if(n.isFull())return!1;var s=this.findVertex(n.vertex(0)),o=s[0],a=s[1];return a?$H(this.vertex(o-1),this.vertex(o),this.vertex(o+1),n.vertex(1),r):this.containsPoint(n.vertex(0))},i})(),RT=function(e,t){return!e.containsCenter&&t===XH||e.containsCenter&&t===IT},VL=function(e,t,n){for(var r=new tH(e.index),s=new tH(t.index),o=new lH(e,t,n,!1),a=new lH(t,e,n,!0);!r.done()||!s.done();)if(r.rangeMax<s.rangeMin)r.seekTo(s);else if(s.rangeMax<r.rangeMin)s.seekTo(r);else{var l=as(r.it.cellID())-as(s.it.cellID());if(l>0){if(o.hasCrossingRelation(r,s))return!0}else if(l<0){if(a.hasCrossingRelation(s,r))return!0}else{var c=r.it.indexCell().shapes[0],u=s.it.indexCell().shapes[0];if(RT(c,o.aCrossingTarget)&&RT(u,o.bCrossingTarget)||c.numEdges()>0&&u.numEdges()>0&&o.cellCrossesCell(c,u))return!0;r.next(),s.next()}}return!1},aH=0,XH=1,IT=2,Wfe=(function(){function i(){this.foundSharedVertex=!1}var e=i.prototype;return e.aCrossingTarget=function(){return XH},e.bCrossingTarget=function(){return IT},e.wedgesCross=function(n,r,s,o,a){return this.foundSharedVertex=!0,!jH(n,r,s,o,a)},i})(),jfe=(function(){function i(){this.foundSharedVertex=!1}var e=i.prototype;return e.aCrossingTarget=function(){return IT},e.bCrossingTarget=function(){return IT},e.wedgesCross=function(n,r,s,o,a){return this.foundSharedVertex=!0,Vfe(n,r,s,o,a)},i})(),Xfe=(function(){function i(t){this.foundSharedVertex=!1,this.containsEdge=!1,this.excludesEdge=!1,this.reverse=t}var e=i.prototype;return e.aCrossingTarget=function(){return aH},e.bCrossingTarget=function(){return aH},e.wedgesCross=function(n,r,s,o,a){return this.foundSharedVertex=!0,$H(n,r,s,a,this.reverse)?this.containsEdge=!0:this.excludesEdge=!0,this.containsEdge&&this.excludesEdge},i})(),$H=function(e,t,n,r,s){return r.equals(e)||r.equals(n)?r.equals(e)===s:We.orderedCCW(e,n,r,t)},lH=(function(){function i(t,n,r,s){if(this.crosser=null,this.aj=0,this.bjPrev=-2,this.bCells=[],this.a=t,this.b=n,this.relation=r,this.swapped=s,this.aCrossingTarget=r.aCrossingTarget(),this.bCrossingTarget=r.bCrossingTarget(),this.bQuery=new Gfe(n.index),s){var o=[this.bCrossingTarget,this.aCrossingTarget];this.aCrossingTarget=o[0],this.bCrossingTarget=o[1]}}var e=i.prototype;return e.startEdge=function(n){this.crosser=new Gl(this.a.vertex(n),this.a.vertex(n+1)),this.aj=n,this.bjPrev=-2},e.edgeCrossesCell=function(n){for(var r=n.numEdges(),s=0;s<r;s++){var o,a=n.edges[s];if(a!==this.bjPrev+1){var l;(l=this.crosser)==null||l.restartAt(this.b.vertex(a))}this.bjPrev=a;var c=(o=this.crosser)==null?void 0:o.chainCrossingSign(this.b.vertex(a+1));if(c!==Vl){if(c===Ec)return!0;if(this.a.vertex(this.aj+1).equals(this.b.vertex(a+1))){if(this.swapped){if(this.relation.wedgesCross(this.b.vertex(a),this.b.vertex(a+1),this.b.vertex(a+2),this.a.vertex(this.aj),this.a.vertex(this.aj+2)))return!0}else if(this.relation.wedgesCross(this.a.vertex(this.aj),this.a.vertex(this.aj+1),this.a.vertex(this.aj+2),this.b.vertex(a),this.b.vertex(a+2)))return!0}}}return!1},e.cellCrossesCell=function(n,r){for(var s=Ct(n.edges),o;!(o=s()).done;){var a=o.value;if(this.startEdge(a),this.edgeCrossesCell(r))return!0}return!1},e.cellCrossesAnySubcell=function(n,r){for(var s=Ma.fromCellID(r,0),o=Ct(n.edges),a;!(a=o()).done;){var l=a.value;if(this.bCells=this.bQuery.getCells(this.a.vertex(l),this.a.vertex(l+1),s),this.bCells.length!==0){this.startEdge(l);for(var c=Ct(this.bCells),u;!(u=c()).done;){var f=u.value;if(this.edgeCrossesCell(f.shapes[0]))return!0}}}return!1},e.hasCrossing=function(n,r){var s=20,o=0;for(this.bCells=[];;){var a=r.it.indexCell().shapes[0].numEdges();if(a>0){if(o+=a,o>=s)return this.cellCrossesAnySubcell(n.it.indexCell().shapes[0],n.cellID())?!0:(r.seekBeyond(n),!1);this.bCells.push(r.indexCell())}if(r.next(),r.cellID()>n.rangeMax)break}for(var l=Ct(this.bCells),c;!(c=l()).done;){var u=c.value;if(this.cellCrossesCell(n.it.indexCell().shapes[0],u.shapes[0]))return!0}return!1},e.hasCrossingRelation=function(n,r){var s=n.it.indexCell().shapes[0];if(s.numEdges()!==0)return this.hasCrossing(n,r)?!0:(n.next(),!1);if(RT(s,this.aCrossingTarget))return r.seekBeyond(n),n.next(),!1;for(;r.cellID()<=n.rangeMax;){var o=r.it.indexCell().shapes[0];if(RT(o,this.bCrossingTarget))return!0;r.next()}return n.next(),!1},i})(),$fe=(function(){function i(t){var n=this;if(t===void 0&&(t=[]),this.loops=[],this.index=new CT,this.hasHoles=!1,this.numVertices=0,this.nEdges=0,this.bound=Ri.emptyRect(),this.subregionBound=Ri.emptyRect(),this.cumulativeEdges=[],this.initLoops=function(r){var s=new Array;s.push(null);for(var o=-1;s.length>0;){var a=s.pop();a!=null&&(o=a.depth,n.loops.push(a));for(var l=r.get(a)||[],c=l.length-1;c>=0;c--){var u=l[c];u.depth=o+1,s.push(u)}}},t.length===1&&t[0].isEmpty()){this.initLoopProperties();return}this.loops=t,this.initNested()}i.fromOrientedLoops=function(n){for(var r=new Map,s=Ct(n),o;!(o=s()).done;){var a=o.value;r.set(a,a.containsOrigin())}for(var l=Ct(n),c;!(c=l()).done;){var u=c.value,f=u.turningAngle();Math.abs(f)>u.turningAngleMaxError()?f<0&&u.invert():u.containsOrigin()&&u.invert()}var d=new i(n);if(d.numLoops()>0){for(var A=d.loop(0),y=!1,w=Ct(d.loops),S;!(S=w()).done;){var T=S.value;T.containsOrigin()&&(y=!y,A=T)}r.get(A)!==y&&d.invert()}return d};var e=i.prototype;return e.invert=function(){if(this.isEmpty()){Object.assign(this,i.fullPolygon()),this.initLoopProperties();return}if(this.isFull()){Object.assign(this,new i),this.initLoopProperties();return}for(var n=0,r=10,s=r,o=1;o<this.numLoops();o++)if(this.loop(o).depth===0){s===r&&(s=this.loop(n).turningAngle());var a=this.loop(o).turningAngle();(a<s||a===s&&this.compareLoops(this.loop(o),this.loop(n))<0)&&(n=o,s=a)}this.loop(n).invert();var l=[],c=this.lastDescendant(n);l.push(this.loop(n));for(var u=0;u<this.loops.length;u++)(u<n||u>c)&&(this.loop(u).depth++,l.push(this.loop(u)));for(var f=0;f<this.loops.length;f++)f>n&&f<=c&&(this.loop(f).depth--,l.push(this.loop(f)));this.loops=l,this.initLoopProperties()},e.compareLoops=function(n,r){if(n.numVertices()!==r.numVertices())return n.numVertices()-r.numVertices();var s=n.canonicalFirstVertex(),o=s[0],a=s[1],l=r.canonicalFirstVertex(),c=l[0],u=l[1];if(a!==u)return a-u;for(var f=n.numVertices()-1;f>=0;f--,o+=a,c+=u){var d=n.vertex(o).vector.cmp(r.vertex(c).vector);if(d!==0)return d}return 0},i.fromCell=function(n){return new i([sD.fromCell(n)])},e.initNested=function(){if(this.loops.length===1){this.initOneLoop();return}var n=new Yfe;this.loops.forEach(function(r){n.insertLoop(r,null)}),this.loops=[],this.initLoops(n),this.initLoopProperties()},e.initOneLoop=function(){this.hasHoles=!1,this.numVertices=this.loops[0].vertices.length,this.bound=this.loops[0].rectBound(),this.subregionBound=U1.expandForSubregions(this.bound),this.loops[0].depth=0,this.initEdgesAndIndex()},e.initLoopProperties=function(){this.numVertices=0,this.bound=Ri.emptyRect(),this.hasHoles=!1;for(var n=Ct(this.loops),r;!(r=n()).done;){var s=r.value;s.isHole()?this.hasHoles=!0:this.bound=this.bound.union(s.rectBound()),this.numVertices+=s.numVertices()}this.subregionBound=U1.expandForSubregions(this.bound),this.initEdgesAndIndex()},e.initEdgesAndIndex=function(){if(this.nEdges=0,this.cumulativeEdges=[],!this.isFull()){var n=12;this.loops.length>n&&(this.cumulativeEdges=[]);for(var r=Ct(this.loops),s;!(s=r()).done;){var o=s.value;this.cumulativeEdges.length>0&&this.cumulativeEdges.push(this.nEdges),this.nEdges+=o.vertices.length}this.index=new CT,this.index.add(this)}},i.fullPolygon=function(){var n=sD.fullLoop(),r=new i;return r.loops=[n],r.numVertices=n.vertices.length,r.bound=Ri.fullRect(),r.subregionBound=Ri.fullRect(),r.initEdgesAndIndex(),r},e.validate=function(){for(var n=0;n<this.loops.length;n++){var r=this.loops[n],s=r.findValidationErrorNoIndex();if(s)return new Error("loop "+n+": "+s.message);if(r.isEmpty())return new Error("loop "+n+": empty loops are not allowed");if(r.isFull()&&this.loops.length>1)return new Error("loop "+n+": full loop appears in non-full polygon")}return this.findLoopNestingError()},e.findLoopNestingError=function(){for(var n=-1,r=0;r<this.loops.length;r++){var s=this.loops[r].depth;if(s<0||s>n+1)return new Error("loop "+r+": invalid loop depth ("+s+")");n=s}for(var o=0;o<this.loops.length;o++)for(var a=this.loops[o],l=this.lastDescendant(o),c=0;c<this.loops.length;c++)if(o!==c){var u=c>=o+1&&c<=l,f=!1;if(a.containsNonCrossingBoundary(this.loops[c],f)!==u){var d=u?"":"not ";return new Error("invalid nesting: loop "+o+" should "+d+"contain loop "+c)}}return null},e.isEmpty=function(){return this.loops.length===0},e.isFull=function(){return this.loops.length===1&&this.loops[0].isFull()},e.numLoops=function(){return this.loops.length},e.loop=function(n){return this.loops[n]},e.parent=function(n){var r,s=((r=this.loops[n])==null?void 0:r.depth)||0;if(s===0)return[-1,!1];for(n--;n>=0&&this.loops[n].depth<=s;n--);return[n,!0]},e.lastDescendant=function(n){var r;if(n<0)return this.loops.length-1;var s=((r=this.loops[n])==null?void 0:r.depth)||0;for(n++;n<this.loops.length&&this.loops[n].depth>s;n++);return n-1},e.capBound=function(){return this.bound.capBound()},e.rectBound=function(){return this.bound},e.containsPoint=function(n){if(!this.index.isFresh()&&!this.bound.containsPoint(n))return!1;var r=32;if(this.numVertices<r||this.index==null){for(var s=!1,o=Ct(this.loops),a;!(a=o()).done;){var l=a.value;s=s!==l.bruteForceContainsPoint(n)}return s}return new bp(this.index,Yf).contains(n)},e.containsCell=function(n){var r=this.index.iterator(),s=r.locateCellID(n.id);return s!==wp||this.boundaryApproxIntersects(r,n)?!1:this.iteratorContainsPoint(r,n.center())},e.intersectsCell=function(n){var r=this.index.iterator(),s=r.locateCellID(n.id);return s===BT?!1:s===vy||r.cellID()===n.id||this.boundaryApproxIntersects(r,n)?!0:this.iteratorContainsPoint(r,n.center())},e.cellUnionBound=function(){return this.capBound().cellUnionBound()},e.boundaryApproxIntersects=function(n,r){var s=n.indexCell().findByShapeID(0);if(s.edges.length===0)return!1;if(n.cellID()===r.id)return!0;for(var o=gy+zH,a=r.boundUV().expandedByMargin(o),l=Ct(s.edges),c;!(c=l()).done;){var u=c.value,f=this.index.shape(0).edge(u),d=uy(f.v0,f.v1,r.face,o),A=d[0],y=d[1],w=d[2];if(w&&VH(A,y,a))return!0}return!1},e.iteratorContainsPoint=function(n,r){var s=n.indexCell().findByShapeID(0),o=s.containsCenter;if(s.edges.length===0)return o;for(var a=new Gl(n.center(),r),l=this.index.shape(0),c=Ct(s.edges),u;!(u=c()).done;){var f=u.value,d=l.edge(f);o=o!==a.edgeOrVertexCrossing(d.v0,d.v1)}return o},e.numEdges=function(){return this.nEdges},e.edge=function(n){var r=0;if(this.cumulativeEdges.length>0){for(r=0;r<this.cumulativeEdges.length;r++)if(r+1>=this.cumulativeEdges.length||n<this.cumulativeEdges[r+1]){n-=this.cumulativeEdges[r];break}}else for(r=0;n>=this.loop(r).vertices.length;r++)n-=this.loop(r).vertices.length;return new ah(this.loop(r).orientedVertex(n),this.loop(r).orientedVertex(n+1))},e.referencePoint=function(){for(var n=!1,r=Ct(this.loops),s;!(s=r()).done;){var o=s.value;n=n!==o.containsOrigin()}return FT(n)},e.numChains=function(){return this.numLoops()},e.chain=function(n){if(this.cumulativeEdges.length>0)return new L1(this.cumulativeEdges[n],this.loop(n).vertices.length);for(var r=0,s=0;s<n;s++)r+=this.loop(s).vertices.length;var o=this.loop(n).numVertices();return o!==1?new L1(r,o):new L1(r,0)},e.chainEdge=function(n,r){return new ah(this.loop(n).orientedVertex(r),this.loop(n).orientedVertex(r+1))},e.chainPosition=function(n){var r=0;if(this.cumulativeEdges.length>0){for(r=0;r<this.cumulativeEdges.length;r++)if(r+1>=this.cumulativeEdges.length||n<this.cumulativeEdges[r+1]){n-=this.cumulativeEdges[r];break}}else for(r=0;n>=this.loop(r).vertices.length;r++)n-=this.loop(r).vertices.length;return new NT(r,n)},e.dimension=function(){return 2},e.typeTag=function(){return cfe},e.privateInterface=function(){},e.contains=function(n){if(this.loops.length===1&&n.loops.length===1)return this.loops[0].contains(n.loops[0]);if(!this.subregionBound.contains(n.bound)&&!this.bound.lng.union(n.bound.lng).isFull())return!1;if(!this.hasHoles&&!n.hasHoles){for(var r=Ct(n.loops),s;!(s=r()).done;){var o=s.value;if(!this.anyLoopContains(o))return!1}return!0}return this.containsBoundary(n)&&n.excludesNonCrossingComplementShells(this)},e.intersects=function(n){if(this.loops.length===1&&n.loops.length===1)return this.loops[0].intersects(n.loops[0]);if(!this.bound.intersects(n.bound))return!1;if(!this.hasHoles&&!n.hasHoles){for(var r=Ct(n.loops),s;!(s=r()).done;){var o=s.value;if(this.anyLoopIntersects(o))return!0}return!1}return!this.excludesBoundary(n)||!n.excludesNonCrossingShells(this)},e.compareBoundary=function(n){for(var r=-1,s=0;s<this.loops.length&&r!==0;s++)r*=-this.loops[s].compareBoundary(n);return r},e.containsBoundary=function(n){for(var r=Ct(n.loops),s;!(s=r()).done;){var o=s.value;if(this.compareBoundary(o)<=0)return!1}return!0},e.excludesBoundary=function(n){for(var r=Ct(n.loops),s;!(s=r()).done;){var o=s.value;if(this.compareBoundary(o)>=0)return!1}return!0},e.containsNonCrossingBoundary=function(n,r){for(var s=!1,o=Ct(this.loops),a;!(a=o()).done;){var l=a.value,c=l.containsNonCrossingBoundary(n,r);s=s!=c}return s},e.excludesNonCrossingShells=function(n){for(var r=Ct(n.loops),s;!(s=r()).done;){var o=s.value;if(!o.isHole()&&this.containsNonCrossingBoundary(o,!1))return!1}return!0},e.excludesNonCrossingComplementShells=function(n){if(n.isEmpty())return!this.isFull();if(n.isFull())return!0;for(var r=0;r<n.loops.length;r++){var s=n.loops[r];if(!(r>0&&!s.isHole())&&this.containsNonCrossingBoundary(s,r===0))return!1}return!0},e.anyLoopContains=function(n){for(var r=Ct(this.loops),s;!(s=r()).done;){var o=s.value;if(o.contains(n))return!0}return!1},e.anyLoopIntersects=function(n){for(var r=Ct(this.loops),s;!(s=r()).done;){var o=s.value;if(o.intersects(n))return!0}return!1},e.area=function(){for(var n=0,r=Ct(this.loops),s;!(s=r()).done;){var o=s.value;n+=o.sign()*o.area()}return n},e.centroid=function(){for(var n=new We(0,0,0).vector,r=Ct(this.loops),s;!(s=r()).done;){var o=s.value,a=o.centroid().vector;o.sign()<0?n=n.sub(a):n=n.add(a)}return We.fromVector(n)},i})(),Yfe=(function(i){function e(){return i.apply(this,arguments)||this}hy(e,i);var t=e.prototype;return t.insertLoop=function(r,s){for(var o=[],a=!1;!a;){o=i.prototype.get.call(this,s)||[],a=!0;for(var l=Ct(o),c;!(c=l()).done;){var u=c.value;if(u.containsNested(r)){s=u,a=!1;break}}}for(var f=i.prototype.get.call(this,r)||[],d=0;d<o.length;){var A=o[d];r.containsNested(A)?(f.push(A),o.splice(d,1)):d++}i.prototype.set.call(this,r,f),i.prototype.set.call(this,s,[].concat(o,[r]))},e})(D1(Map)),Zfe=(function(){function i(t){t===void 0&&(t=[]),this.points=t}i.fromLatLngs=function(n){return new i(n.map(We.fromLatLng))};var e=i.prototype;return e.reverse=function(){for(var n=this.points.length,r=0;r<n/2;r++){var s=n-r-1,o=[this.points[s],this.points[r]];this.points[r]=o[0],this.points[s]=o[1]}},e.length=function(){for(var n=0,r=1;r<this.points.length;r++)n+=this.points[r-1].distance(this.points[r]);return n},e.centroid=function(){for(var n=new We(0,0,0),r=1;r<this.points.length;r++){var s=this.points[r-1].vector.add(this.points[r].vector),o=this.points[r-1].vector.sub(this.points[r].vector);n=We.fromVector(n.vector.add(s.mul(Math.sqrt(o.norm2()/s.norm2()))))}return n},e.equal=function(n){if(this.points.length!==n.points.length)return!1;for(var r=0;r<this.points.length;r++)if(!this.points[r].equals(n.points[r]))return!1;return!0},e.approxEqual=function(n,r){if(r===void 0&&(r=yH),this.points.length!==n.points.length)return!1;for(var s=0;s<this.points.length;s++)if(!this.points[s].approxEqual(n.points[s],r))return!1;return!0},e.capBound=function(){return this.rectBound().capBound()},e.rectBound=function(){for(var n=new U1,r=Ct(this.points),s;!(s=r()).done;){var o=s.value;n.addPoint(o)}return n.rectBound()},e.containsCell=function(n){return!1},e.intersectsCell=function(n){if(this.points.length===0)return!1;for(var r=Ct(this.points),s;!(s=r()).done;){var o=s.value;if(n.containsPoint(o))return!0}for(var a=[n.vertex(0),n.vertex(1),n.vertex(2),n.vertex(3)],l=0;l<4;l++)for(var c=Gl.newChainEdgeCrosser(a[l],a[l+1&3],this.points[0]),u=1;u<this.points.length;u++)if(c.chainCrossingSign(this.points[u])!==Vl)return!0;return!1},e.containsPoint=function(n){return!1},e.cellUnionBound=function(){return this.capBound().cellUnionBound()},e.numEdges=function(){return this.points.length===0?0:this.points.length-1},e.edge=function(n){return new ah(this.points[n],this.points[n+1])},e.referencePoint=function(){return FT(!1)},e.numChains=function(){return Math.min(1,this.numEdges())},e.chain=function(n){return new L1(0,this.numEdges())},e.chainEdge=function(n,r){return new ah(this.points[r],this.points[r+1])},e.chainPosition=function(n){return new NT(0,n)},e.dimension=function(){return 1},e.isEmpty=function(){return hfe(this)},e.isFull=function(){return ffe(this)},e.typeTag=function(){return ufe},e.privateInterface=function(){},i.findEndVertex=function(n,r,s){var o=n.points[s],a=uD(o),l=to.fullInterval(),c=0;for(s++;s<n.points.length;s++){var u=n.points[s],f=o.distance(u);if(f>Math.PI/2&&c>0||f<c&&c>r)break;if(c=f,!(f<=r)){var d=Che(a,u),A=Math.atan2(d.y,d.x);if(!l.contains(A))break;var y=Math.asin(Math.sin(r)/Math.sin(f)),w=to.fromPointPair(A,A).expanded(y);l=l.intersection(w)}}return s-1},e.subsampleVertices=function(n){var r=[];if(this.points.length<1)return r;r.push(0);for(var s=Math.max(n,0),o=0;o+1<this.points.length;){var a=i.findEndVertex(this,s,o);this.points[a].equals(this.points[o])||r.push(a),o=a}return r},e.project=function(n){if(this.points.length===1)return[this.points[0],1];for(var r=10,s=-1,o=1;o<this.points.length;o++){var a=tfe(n,this.points[o-1],this.points[o]);a<r&&(r=a,s=o)}var l=DH(n,this.points[s-1],this.points[s]);return l.equals(this.points[s])&&s++,[l,s]},e.isOnRight=function(n){var r=this.project(n),s=r[0],o=r[1];return s.equals(this.points[o-1])&&o>1&&o<this.points.length?n.equals(this.points[o-1])?!1:We.orderedCCW(this.points[o-2],n,this.points[o],this.points[o-1]):(o===this.points.length&&o--,XL(n,this.points[o],this.points[o-1]))},e.validate=function(){for(var n=0;n<this.points.length;n++)if(!this.points[n].vector.isUnit())return new Error("vertex "+n+" is not unit length");for(var r=1;r<this.points.length;r++){var s=this.points[r-1],o=this.points[r];if(s.equals(o))return new Error("vertices "+(r-1)+" and "+r+" are identical");if(s.equals(We.fromVector(o.vector.mul(-1))))return new Error("vertices "+(r-1)+" and "+r+" are antipodal")}return null},e.intersects=function(n){if(this.points.length===0||n.points.length===0||!this.rectBound().intersects(n.rectBound()))return!1;for(var r=1;r<this.points.length;r++)for(var s=Gl.newChainEdgeCrosser(this.points[r-1],this.points[r],n.points[0]),o=1;o<n.points.length;o++)if(s.chainCrossingSign(n.points[o])!==Vl)return!0;return!1},e.interpolate=function(n){if(n<=0)return[this.points[0],1];for(var r=n*this.length(),s=1;s<this.points.length;s++){var o=this.points[s-1].distance(this.points[s]);if(r<o){var a=NH(r,this.points[s-1],this.points[s]);return a.equals(this.points[s])?[a,s+1]:[a,s]}r-=o}return[this.points[this.points.length-1],this.points.length]},e.uninterpolate=function(n,r){if(this.points.length<2)return 0;for(var s=0,o=1;o<r;o++)s+=this.points[o-1].distance(this.points[o]);for(var a=s+this.points[r-1].distance(n),l=r;l<this.points.length;l++)s+=this.points[l-1].distance(this.points[l]);return Math.min(1,a/s)},i})(),cH=(function(){function i(){}var e=i.prototype;return e.capBound=function(){return xp.emptyCap()},e.rectBound=function(){return Ri.emptyRect()},e.containsCell=function(n){return!1},e.intersectsCell=function(n){return!1},e.containsPoint=function(n){return!1},e.cellUnionBound=function(){return[]},i})(),oD=(function(){function i(t){var n=t===void 0?{}:t,r=n.minLevel,s=r===void 0?0:r,o=n.maxLevel,a=o===void 0?_i:o,l=n.levelMod,c=l===void 0?1:l,u=n.maxCells,f=u===void 0?8:u;this.minLevel=s,this.maxLevel=a,this.levelMod=c,this.maxCells=f}var e=i.prototype;return e.coverer=function(){return new YH(Math.max(0,Math.min(_i,this.minLevel)),Math.max(0,Math.min(_i,this.maxLevel)),Math.max(1,Math.min(3,this.levelMod)),this.maxCells)},e.covering=function(n){var r=this.cellUnion(n);return r.denormalize(Math.max(0,Math.min(_i,this.minLevel)),Math.max(1,Math.min(3,this.levelMod))),r},e.interiorCovering=function(n){var r=this.interiorCellUnion(n);return r.denormalize(Math.max(0,Math.min(_i,this.minLevel)),Math.max(1,Math.min(3,this.levelMod))),r},e.cellUnion=function(n){var r=this.coverer();r.coveringInternal(n);var s=r.result;return s.normalize(),s},e.interiorCellUnion=function(n){var r=this.coverer();r.interiorCovering=!0,r.coveringInternal(n);var s=r.result;return s.normalize(),s},e.fastCovering=function(n){var r=this.coverer(),s=sy(B1,n.cellUnionBound());return r.normalizeCovering(s),s},e.isCanonical=function(n){return this.coverer().isCanonical(n)},i})(),YH=(function(){function i(t,n,r,s){this.region=new cH,this.result=new B1,this.pq=new Qfe,this.interiorCovering=!1,this.minLevel=t,this.maxLevel=n,this.levelMod=r,this.maxCells=s}var e=i.prototype;return e.newCandidate=function(n){if(!this.region.intersectsCell(n))return new iy;var r=new Kfe(n),s=n.level;if(s>=this.minLevel)if(this.interiorCovering){if(this.region.containsCell(n))r.terminal=!0;else if(s+this.levelMod>this.maxLevel)return new iy}else(s+this.levelMod>this.maxLevel||this.region.containsCell(n))&&(r.terminal=!0);return r},e.expandChildren=function(n,r,s){s--;for(var o=0,a=RH(r.id),l=mD(r.id);l!==a;l=Ia(l)){var c=Ra.fromCellID(l);if(s>0){this.region.intersectsCell(c)&&(o+=this.expandChildren(n,c,s));continue}var u=this.newCandidate(c);u instanceof iy||(n.children.push(u),n.numChildren++,u.terminal&&o++)}return o},e.addCandidate=function(n){if(!(n instanceof iy)){if(n.terminal){this.result.push(n.cell.id);return}var r=this.levelMod,s=n.cell.level;s<this.minLevel&&(r=1);var o=this.expandChildren(n,n.cell,r),a=2*this.levelMod;n.numChildren!==0&&(!this.interiorCovering&&o===1<<a&&s>=this.minLevel?(n.terminal=!0,this.addCandidate(n)):(n.priority=-((s<<a)+n.numChildren<<a+o),this.pq.push(n)))}},e.adjustLevel=function(n){return this.levelMod>1&&n>this.minLevel&&(n-=(n-this.minLevel)%this.levelMod),n},e.adjustCellLevels=function(n){if(this.levelMod!==1){for(var r=0,s=Ct(n),o;!(o=s()).done;){var a=o.value,l=no(a),c=this.adjustLevel(l);if(c!==l&&(a=Sr(a,c)),!(r>0&&$m(n[r-1],a))){for(;r>0&&$m(a,n[r-1]);)r--;n[r]=a,r++}}n.length=r}},e.initialCandidates=function(n){var r=new oD;r.maxLevel=this.maxLevel,r.levelMod=1,r.maxCells=Math.min(4,this.maxCells);var s=r.fastCovering(n);this.adjustCellLevels(s);for(var o=Ct(s),a;!(a=o()).done;){var l=a.value;this.addCandidate(this.newCandidate(Ra.fromCellID(l)))}},e.coveringInternal=function(n){for(this.region=n,this.initialCandidates(n);this.pq.length>0&&(!this.interiorCovering||this.result.length<this.maxCells);){var r=this.pq.pop();if(this.interiorCovering||r.cell.level<this.minLevel||r.numChildren===1||this.result.length+this.pq.length+r.numChildren<=this.maxCells)for(var s=Ct(r.children),o;!(o=s()).done;){var a=o.value;(!this.interiorCovering||this.result.length<this.maxCells)&&this.addCandidate(a)}else r.terminal=!0,this.addCandidate(r)}this.region=new cH,this.pq.reset(),this.result.normalize(),(this.minLevel>0||this.levelMod>1)&&this.result.denormalize(this.minLevel,this.levelMod)},e.normalizeCovering=function(n){if(this.maxLevel<_i||this.levelMod>1)for(var r=0;r<n.length;r++){var s=no(n[r]),o=this.adjustLevel(Math.min(s,this.maxLevel));o!==s&&(n[r]=Sr(n[r],o))}n.normalize(),(this.minLevel>0||this.levelMod>1)&&n.denormalize(this.minLevel,this.levelMod);var a=n.length-this.maxCells;if(!(a<=0||this.isCanonical(n))){if(a*n.length>1e4){var l=new oD,c=l.covering(n);n.length=0,n.push.apply(n,c);return}for(;n.length>this.maxCells;){for(var u=-1,f=-1,d=0;d+1<n.length;d++){var A=cy(n[d],n[d+1]),y=A[0],w=A[1];if(w){var S=this.adjustLevel(y);S>f&&(f=S,u=d)}}if(f<this.minLevel)break;var T=Sr(n[u],f),R=this.replaceCellsWithAncestor(n,T);for(n.length=0,n.push.apply(n,R);f>this.minLevel&&(f-=this.levelMod,T=Sr(T,f),!!this.containsAllChildren(n,T));){var P=this.replaceCellsWithAncestor(n,T);n.length=0,n.push.apply(n,P)}}}},e.isCanonical=function(n){var r=this.maxLevel;this.levelMod!==1&&(r=this.maxLevel-(this.maxLevel-this.minLevel)%this.levelMod);for(var s=n.length>this.maxCells,o=1,a=0n,l=Ct(n),c;!(c=l()).done;){var u=c.value;if(!ly(u))return!1;var f=no(u);if(f<this.minLevel||f>r||this.levelMod>1&&(f-this.minLevel)%this.levelMod!==0)return!1;if(a!==0n){if(Gi(a)>=qi(u))return!1;var d=cy(u,a),A=d[0],y=d[1];if(s&&y&&A>=this.minLevel)return!1;var w=f-this.levelMod;if(w<this.minLevel||f!==no(a)||Sr(u,w)!==Sr(a,w))o=1;else if(o++,o===1<<2*this.levelMod)return!1}a=u}return!0},e.containsAllChildren=function(n,r){for(var s=n.findIndex(function(l){return l>=qi(r)}),o=no(r)+this.levelMod,a=Ay(r,o);a!==DT(r,o);a=Ia(a)){if(s===-1||n[s]!==a)return!1;s++}return!0},e.replaceCellsWithAncestor=function(n,r){var s=KL(n.length,function(a){return n[a]>qi(r)}),o=KL(n.length,function(a){return n[a]>Gi(r)});return[].concat(n.slice(0,s),[r],n.slice(o))},i})(),Kfe=function(e){this.terminal=!1,this.numChildren=0,this.children=[],this.priority=0,this.cell=e},iy=function(){this.cell=Ra.fromCellID(hl),this.terminal=!1,this.numChildren=0,this.children=[],this.priority=0},Qfe=(function(i){function e(){return i.apply(this,arguments)||this}hy(e,i);var t=e.prototype;return t.len=function(){return this.length},t.swap=function(r,s){var o=[this[s],this[r]];this[r]=o[0],this[s]=o[1]},t.push=function(){for(var r,s=arguments.length,o=new Array(s),a=0;a<s;a++)o[a]=arguments[a];var l=(r=i.prototype.push).call.apply(r,[this].concat(o));return this.sort(e.ascending),l},t.pop=function(){var r=i.prototype.pop.call(this);return r||new iy},t.reset=function(){this.length=0},e.ascending=function(r,s){return r.priority<s.priority?-1:r.priority>s.priority?1:0},e})(D1(Array)),Gn={__proto__:null,cellid:Qhe,Cap:xp,Cell:Ra,CellIndex:afe,CellIndexRangeIterator:FH,CellIndexContentsIterator:BH,CellUnion:B1,ClosestCellQuery:zfe,ClosestCellQueryOptions:WH,PointTarget:Ffe,EdgeTarget:Bfe,CellTarget:Ofe,CellUnionTarget:Ufe,ShapeIndexTarget:kfe,ClosestEdgeQuery:Lfe,ClosestEdgeQueryOptions:GH,EdgeQueryPointTarget:Rfe,EdgeQueryEdgeTarget:Ife,EdgeQueryCellTarget:Pfe,EdgeQueryShapeIndexTarget:qH,LatLng:ar,Loop:sD,Point:We,Polygon:$fe,Polyline:Zfe,Rect:Ri,RegionCoverer:oD,Coverer:YH,ShapeIndex:CT};function lh(i){return"zones"}function fl(i){return O.hiddenCollections.has(i)}function ZH(i){let e=new Map;for(let t of i){let n=lh(t.zone);e.has(n)||e.set(n,[]),e.get(n).push(t)}return e}function KH(i,e){for(let t of i.values())if(!t.some(r=>r.geometries.some(s=>Jfe(s,e))))return!1;return!0}function Jfe(i,e){if(i.intersectsCoordinate(e))return!0;let t=i.getClosestPoint(e),n=t[0]-e[0],r=t[1]-e[1];return n*n+r*r<=1}function Zf(i,e){return O.labelOverrides.get(e?.id??lh(i))??e?.attrs?.["atlas.label.policy"]??i?.attrs?.["atlas.label.policy"]??"always"}function ch(i){let e=i.attrs?.["atlas.render.as"];return e||(i.displayType==="text"?"text":"pin")}function OT(i){return i?.attrs?.["atlas.geometry.surface"]||"plane"}function vD(i){let e=uh(i);return e||ede(i)}function ede(i){let e=i?.attrs||{};if(e["atlas.geometry.projection"]!=="mercator")return null;let t=(e["atlas.geometry.mercator.px"]||"").split(",").map(Number),n=(e["atlas.geometry.mercator.deg"]||"").split(",").map(Number);if(t.length!==4||n.length!==4||t.some(Number.isNaN)||n.some(Number.isNaN))return null;let[r,s,o,a]=t,[l,c,u,f]=n;if(!o||!a||c===f||l===u)return null;let d=S=>Math.asinh(Math.tan(S*Math.PI/180)),A=S=>Math.atan(Math.sinh(S))*180/Math.PI,y=d(c),w=d(f);return{toLatLng(S,T){return[A(y-(T-s)/a*(y-w)),l+(S-r)/o*(u-l)]},toWorld(S,T){return[r+(T-l)/(u-l)*o,s+(y-d(S))/(y-w)*a]}}}function uh(i){let e=i?.attrs||{};if(e["atlas.geometry.projection"]!=="equirect")return null;let t=(e["atlas.geometry.equirect.px"]||"").split(",").map(Number),n=(e["atlas.geometry.equirect.deg"]||"").split(",").map(Number);if(t.length!==4||n.length!==4||t.some(Number.isNaN)||n.some(Number.isNaN))return null;let[r,s,o,a]=t,[l,c,u,f]=n;return!o||!a||c===f||l===u?null:{toLatLng(d,A){return[c-(A-s)/a*(c-f),l+(d-r)/o*(u-l)]},toWorld(d,A){return[r+(A-l)/(u-l)*o,s+(c-d)/(c-f)*a]}}}var _y=10,QH=i=>i+1,JH=i=>Gn.cellid.level(Gn.cellid.fromToken(i)),_D={map:null,mapping:null};function UT(){return _D.map!==O.world&&(_D={map:O.world,mapping:vD(O.world)}),_D.mapping}function tde(i){let e=UT();if(!e)return null;let[t,n]=e.toLatLng(i[0],-i[1]);return Gn.LatLng.fromDegrees(t,n)}function eW(i){let e=Gn.LatLng.fromPoint(i);return[e.lat*180/Math.PI,e.lng*180/Math.PI]}var tW=new WeakMap;function xD(i){let e=UT();if(!e)return 0n;let t=tW.get(i);if(t&&t.mapping===e)return t.leaf;let n=tde(i),r=n?Gn.cellid.fromLatLng(n):0n;return typeof i=="object"&&tW.set(i,{mapping:e,leaf:r}),r}var nW={slug:"s2",name:"S2",short:"S2",appliesTo(i){return OT(i)==="sphere"&&vD(i)!==null},maxLevel(){return QH(_y)},inputLength(){return 6},level(i){return i===""?0:QH(JH(i))},parent(i){let e=Gn.cellid.fromToken(i),t=Gn.cellid.level(e);return t===0?"":Gn.cellid.toToken(Gn.cellid.parent(e,t-1))},children(i){return i===""?[0,1,2,3,4,5].map(e=>Gn.cellid.toToken(Gn.cellid.fromFace(e))):Gn.cellid.children(Gn.cellid.fromToken(i)).map(Gn.cellid.toToken)},childIndex(i){let e=Gn.cellid.fromToken(i),t=Gn.cellid.level(e);return t===0?Gn.cellid.face(e):Gn.cellid.childPosition(e,t)},contains(i,e){return Gn.cellid.contains(Gn.cellid.fromToken(i),xD(e))},descendTarget(i,e){let t=xD(e);if(t===0n)return"";let n=i===""?0:JH(i)+1;return n>_y?"":Gn.cellid.toToken(Gn.cellid.parent(t,n))},bbox(i){if(i==="")return jf();let e=this.ring(i),t=1/0,n=1/0,r=-1/0,s=-1/0;for(let[o,a]of e)t=Math.min(t,o),n=Math.min(n,a),r=Math.max(r,o),s=Math.max(s,a);return[t,n,r,s]},center(i){let e=UT(),[t,n]=eW(Gn.Cell.fromCellID(Gn.cellid.fromToken(i)).center()),[r,s]=e.toWorld(t,n);return[r,-s]},ring(i){let e=UT(),t=Gn.Cell.fromCellID(Gn.cellid.fromToken(i)),n=Gn.cellid.level(Gn.cellid.fromToken(i)),r=Math.max(2,Math.min(16,2**(4-n)*2)),s=jf(),o=s[2]-s[0],a=[];for(let u=0;u<4;u++){let f=t.vertex(u).vector,d=t.vertex((u+1)%4).vector;for(let A=0;A<r;A++){let y=A/r,w=f.x+(d.x-f.x)*y,S=f.y+(d.y-f.y)*y,T=f.z+(d.z-f.z)*y,R=Math.hypot(w,S,T)||1,[P,I]=eW(new Gn.Point(w/R,S/R,T/R)),[F,D]=e.toWorld(P,I);a.push([F,-D])}}for(let u=1;u<a.length;u++){let f=a[u][0]-a[u-1][0];f>o/2?a[u][0]-=o:f<-o/2&&(a[u][0]+=o)}let l=[...a[0]],c=l[0]-a[a.length-1][0];return c>o/2?l[0]-=o:c<-o/2&&(l[0]+=o),a.push(l),a},poleContained(i){let e=Gn.cellid.fromToken(i);return Gn.cellid.contains(e,Gn.cellid.fromLatLng(Gn.LatLng.fromDegrees(90,0)))?"north":Gn.cellid.contains(e,Gn.cellid.fromLatLng(Gn.LatLng.fromDegrees(-90,0)))?"south":null},label(i){return{context:i.slice(0,-1),principal:i.slice(-1)}},colorKey(i){return this.childIndex(i)%Wf.length},normalizeInput(i){return[...i.toLocaleLowerCase()].filter(e=>"0123456789abcdef".includes(e)).slice(0,6).join("")},parseInput(i){if(i==="")return"";let e=Gn.cellid.fromToken(i);return e===0n||!Gn.cellid.valid(e)?null:Gn.cellid.level(e)>_y?Gn.cellid.toToken(Gn.cellid.parent(e,_y)):Gn.cellid.toToken(e)},locate(i){let e=xD(i);return e===0n?null:{label:"S2",value:Gn.cellid.toToken(Gn.cellid.parent(e,_y))}}};function jf(){let i=O.lens?.surface;if(i)return[i.x,-(i.y+i.height),i.x+i.width,-i.y];let e=O.volume?.tileGrid.size??0,t=O.lens?.bounds||{x:0,y:0,width:e,height:e};return[t.x,-(t.y+t.height),t.x+t.width,-t.y]}var rW=[LL,nW];function xy(i){return rW.filter(e=>e.appliesTo(i))}function Ts(){return rW.find(i=>i.slug===O.gridSystem)||LL}function sW(i,e,t,n){if(!t)return"";let r=i.center(t),s=iW(i.bbox(t)),o="",a="",l=1/0;for(;e.level(o)<e.maxLevel(n);){let c=e.descendTarget(o,r);if(!c)break;let u=iW(e.bbox(c)),f=Math.abs(Math.log(u/s));if(f<l&&(a=c,l=f),u<=s)break;o=c}return a}function iW([i,e,t,n]){return(t-i)*(n-e)}function oW(i,e,t){let n=i[0]===i[i.length-1]||nde(i[0],i[i.length-1])?i.slice(0,-1):[...i];for(let[r,s]of[[e,([o])=>o>=e],[t,([o])=>o<=t]]){let o=[];for(let a=0;a<n.length;a++){let l=n[a],c=n[(a+n.length-1)%n.length],u=s(l),f=s(c);if(u!==f){let d=(r-c[0])/(l[0]-c[0]);o.push([r,c[1]+d*(l[1]-c[1])])}u&&o.push(l)}if(n=o,n.length===0)return[]}return[...n,n[0]]}function nde(i,e){return i[0]===e[0]&&i[1]===e[1]}var Us={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function yD(i){let e=Wr();for(let t=0,n=i.length;t<n;++t)Jm(e,i[t]);return e}function ide(i,e,t){let n=Math.min.apply(null,i),r=Math.min.apply(null,e),s=Math.max.apply(null,i),o=Math.max.apply(null,e);return ql(n,r,s,o,t)}function G1(i,e,t){return t?(t[0]=i[0]-e,t[1]=i[1]-e,t[2]=i[2]+e,t[3]=i[3]+e,t):[i[0]-e,i[1]-e,i[2]+e,i[3]+e]}function zT(i,e){return e?(e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e):i.slice()}function Rc(i,e,t){let n,r;return e<i[0]?n=i[0]-e:i[2]<e?n=e-i[2]:n=0,t<i[1]?r=i[1]-t:i[3]<t?r=t-i[3]:r=0,n*n+r*r}function pu(i,e){return yy(i,e[0],e[1])}function hh(i,e){return i[0]<=e[0]&&e[2]<=i[2]&&i[1]<=e[1]&&e[3]<=i[3]}function yy(i,e,t){return i[0]<=e&&e<=i[2]&&i[1]<=t&&t<=i[3]}function kT(i,e){let t=i[0],n=i[1],r=i[2],s=i[3],o=e[0],a=e[1],l=Us.UNKNOWN;return o<t?l=l|Us.LEFT:o>r&&(l=l|Us.RIGHT),a<n?l=l|Us.BELOW:a>s&&(l=l|Us.ABOVE),l===Us.UNKNOWN&&(l=Us.INTERSECTING),l}function Wr(){return[1/0,1/0,-1/0,-1/0]}function ql(i,e,t,n,r){return r?(r[0]=i,r[1]=e,r[2]=t,r[3]=n,r):[i,e,t,n]}function Km(i){return ql(1/0,1/0,-1/0,-1/0,i)}function VT(i,e){let t=i[0],n=i[1];return ql(t,n,t,n,e)}function q1(i,e,t,n,r){let s=Km(r);return bD(s,i,e,t,n)}function Qm(i,e){return i[0]==e[0]&&i[2]==e[2]&&i[1]==e[1]&&i[3]==e[3]}function GT(i,e){return e[0]<i[0]&&(i[0]=e[0]),e[2]>i[2]&&(i[2]=e[2]),e[1]<i[1]&&(i[1]=e[1]),e[3]>i[3]&&(i[3]=e[3]),i}function Jm(i,e){e[0]<i[0]&&(i[0]=e[0]),e[0]>i[2]&&(i[2]=e[0]),e[1]<i[1]&&(i[1]=e[1]),e[1]>i[3]&&(i[3]=e[1])}function bD(i,e,t,n,r){for(;t<n;t+=r)rde(i,e[t],e[t+1]);return i}function rde(i,e,t){i[0]=Math.min(i[0],e),i[1]=Math.min(i[1],t),i[2]=Math.max(i[2],e),i[3]=Math.max(i[3],t)}function qT(i,e){let t;return t=e(H1(i)),t||(t=e(W1(i)),t)||(t=e(j1(i)),t)||(t=e(Ic(i)),t)?t:!1}function by(i){let e=0;return dh(i)||(e=Kn(i)*Dr(i)),e}function H1(i){return[i[0],i[1]]}function W1(i){return[i[2],i[1]]}function dl(i){return[(i[0]+i[2])/2,(i[1]+i[3])/2]}function aW(i,e){let t;if(e==="bottom-left")t=H1(i);else if(e==="bottom-right")t=W1(i);else if(e==="top-left")t=Ic(i);else if(e==="top-right")t=j1(i);else throw new Error("Invalid corner");return t}function wy(i,e,t,n,r){let[s,o,a,l,c,u,f,d]=wD(i,e,t,n);return ql(Math.min(s,a,c,f),Math.min(o,l,u,d),Math.max(s,a,c,f),Math.max(o,l,u,d),r)}function wD(i,e,t,n){let r=e*n[0]/2,s=e*n[1]/2,o=Math.cos(t),a=Math.sin(t),l=r*o,c=r*a,u=s*o,f=s*a,d=i[0],A=i[1];return[d-l+f,A-c-u,d-l-f,A-c+u,d+l-f,A+c+u,d+l+f,A+c-u,d-l+f,A-c-u]}function Dr(i){return i[3]-i[1]}function fh(i,e,t){let n=t||Wr();return Ar(i,e)?(i[0]>e[0]?n[0]=i[0]:n[0]=e[0],i[1]>e[1]?n[1]=i[1]:n[1]=e[1],i[2]<e[2]?n[2]=i[2]:n[2]=e[2],i[3]<e[3]?n[3]=i[3]:n[3]=e[3]):Km(n),n}function SD(i,e){if(!Ar(i,e))return[i.slice()];if(hh(e,i))return[];let[t,n,r,s]=i,o=Math.max(t,e[0]),a=Math.max(n,e[1]),l=Math.min(r,e[2]),c=Math.min(s,e[3]),u=[];return o>t&&u.push([t,n,o,s]),l<r&&u.push([l,n,r,s]),a>n&&u.push([o,n,l,a]),c<s&&u.push([o,c,l,s]),u}function Ic(i){return[i[0],i[3]]}function j1(i){return[i[2],i[3]]}function Kn(i){return i[2]-i[0]}function Ar(i,e){return i[0]<=e[2]&&i[2]>=e[0]&&i[1]<=e[3]&&i[3]>=e[1]}function dh(i){return i[2]<i[0]||i[3]<i[1]}function lW(i,e){return e?(e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e):i}function cW(i,e,t){let n=!1,r=kT(i,e),s=kT(i,t);if(r===Us.INTERSECTING||s===Us.INTERSECTING)n=!0;else{let o=i[0],a=i[1],l=i[2],c=i[3],u=e[0],f=e[1],d=t[0],A=t[1],y=(A-f)/(d-u),w,S;s&Us.ABOVE&&!(r&Us.ABOVE)&&(w=d-(A-c)/y,n=w>=o&&w<=l),!n&&s&Us.RIGHT&&!(r&Us.RIGHT)&&(S=A-(d-l)*y,n=S>=a&&S<=c),!n&&s&Us.BELOW&&!(r&Us.BELOW)&&(w=d-(A-a)/y,n=w>=o&&w<=l),!n&&s&Us.LEFT&&!(r&Us.LEFT)&&(S=A-(d-o)*y,n=S>=a&&S<=c)}return n}function uW(i,e,t,n){if(dh(i))return Km(t);let r=[];if(n>1){let a=i[2]-i[0],l=i[3]-i[1];for(let c=0;c<n;++c)r.push(i[0]+a*c/n,i[1],i[2],i[1]+l*c/n,i[2]-a*c/n,i[3],i[0],i[3]-l*c/n)}else r=[i[0],i[1],i[2],i[1],i[2],i[3],i[0],i[3]];e(r,r,2);let s=[],o=[];for(let a=0,l=r.length;a<l;a+=2)s.push(r[a]),o.push(r[a+1]);return ide(s,o,t)}function TD(i,e){let t=e.getExtent(),n=dl(i);if(e.canWrapX()&&(n[0]<t[0]||n[0]>=t[2])){let r=Kn(t),o=Math.floor((n[0]-t[0])/r)*r;i[0]-=o,i[2]-=o}return i}function HT(i,e,t){if(e.canWrapX()){let n=e.getExtent();if(!isFinite(i[0])||!isFinite(i[2]))return[[n[0],i[1],n[2],i[3]]];TD(i,e);let r=Kn(n);if(Kn(i)>r&&!t)return[[n[0],i[1],n[2],i[3]]];if(i[0]<n[0])return[[i[0]+r,i[1],n[2],i[3]],[n[0],i[1],i[2],i[3]]];if(i[2]>n[2])return[[i[0],i[1],n[2],i[3]],[n[0],i[1],i[2]-r,i[3]]]}return[i]}function hW(i,e){let t=[i];for(let n=0,r=e.length;n<r&&t.length>0;++n){let s=[];for(let o=0,a=t.length;o<a;++o)s.push(...SD(t[o],e[n]));t=s}return t}var fW={info:1,warn:2,error:3,none:4},sde=fW.info;function WT(...i){sde>fW.warn||console.warn(...i)}function Si(i,e,t){return Math.min(Math.max(i,e),t)}function dW(i,e,t,n,r,s){let o=r-t,a=s-n;if(o!==0||a!==0){let l=((i-t)*o+(e-n)*a)/(o*o+a*a);l>1?(t=r,n=s):l>0&&(t+=o*l,n+=a*l)}return mu(i,e,t,n)}function mu(i,e,t,n){let r=t-i,s=n-e;return r*r+s*s}function pW(i){let e=i.length;for(let n=0;n<e;n++){let r=n,s=Math.abs(i[n][n]);for(let a=n+1;a<e;a++){let l=Math.abs(i[a][n]);l>s&&(s=l,r=a)}if(s===0)return null;let o=i[r];i[r]=i[n],i[n]=o;for(let a=n+1;a<e;a++){let l=-i[a][n]/i[n][n];for(let c=n;c<e+1;c++)n==c?i[a][c]=0:i[a][c]+=l*i[n][c]}}let t=new Array(e);for(let n=e-1;n>=0;n--){t[n]=i[n][e]/i[n][n];for(let r=n-1;r>=0;r--)i[r][e]-=i[r][n]*t[n]}return t}function jT(i){return i*180/Math.PI}function Au(i){return i*Math.PI/180}function ph(i,e){let t=i%e;return t*e<0?t+e:t}function Po(i,e,t){return i+t*(e-i)}function eA(i,e){let t=Math.pow(10,e);return Math.round(i*t)/t}function Sy(i,e){return Math.floor(eA(i,e))}function Ty(i,e){return Math.ceil(eA(i,e))}function XT(i,e,t){if(i>=e&&i<t)return i;let n=t-e;return((i-e)%n+n)%n+e}function mW(i,e){return i[0]+=+e[0],i[1]+=+e[1],i}function tA(i,e){let t=!0;for(let n=i.length-1;n>=0;--n)if(i[n]!=e[n]){t=!1;break}return t}function X1(i,e){let t=Math.cos(e),n=Math.sin(e),r=i[0]*t-i[1]*n,s=i[1]*t+i[0]*n;return i[0]=r,i[1]=s,i}function AW(i,e){return i[0]*=e,i[1]*=e,i}function $T(i,e){if(e.canWrapX()){let t=Kn(e.getExtent()),n=gW(i,e,t);n&&(i[0]-=n*t)}return i}function gW(i,e,t){let n=e.getExtent(),r=0;return e.canWrapX()&&(i[0]<n[0]||i[0]>n[2])&&(t=t||Kn(n),r=Math.floor((i[0]-n[0])/t)),r}function vW(i,e,t){let n=Math.sqrt((e[0]-i[0])*(e[0]-i[0])+(e[1]-i[1])*(e[1]-i[1])),r=[(e[0]-i[0])/n,(e[1]-i[1])/n],s=[-r[1],r[0]],o=Math.sqrt((t[0]-i[0])*(t[0]-i[0])+(t[1]-i[1])*(t[1]-i[1])),a=[(t[0]-i[0])/o,(t[1]-i[1])/o],l=n===0||o===0?0:Math.acos(Si(a[0]*r[0]+a[1]*r[1],-1,1));return l=Math.max(l,1e-5),a[0]*s[0]+a[1]*s[1]>0?l:Math.PI*2-l}var Kf={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};var ED=class{constructor(e){this.code_=e.code,this.units_=e.units,this.extent_=e.extent!==void 0?e.extent:null,this.worldExtent_=e.worldExtent!==void 0?e.worldExtent:null,this.axisOrientation_=e.axisOrientation!==void 0?e.axisOrientation:"enu",this.global_=e.global!==void 0?e.global:!1,this.canWrapX_=!!(this.global_&&this.extent_),this.getPointResolutionFunc_=e.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=e.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||Kf[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(e){this.global_=e,this.canWrapX_=!!(e&&this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(e){this.defaultTileGrid_=e}setExtent(e){this.extent_=e,this.canWrapX_=!!(this.global_&&e)}setWorldExtent(e){this.worldExtent_=e}setGetPointResolution(e){this.getPointResolutionFunc_=e}getPointResolutionFunc(){return this.getPointResolutionFunc_}},Tp=ED;var Ey=6378137,$1=Math.PI*Ey,ode=[-$1,-$1,$1,$1],ade=[-180,-85,180,85],YT=Ey*Math.log(Math.tan(Math.PI/2)),Ep=class extends Tp{constructor(e){super({code:e,units:"m",extent:ode,global:!0,worldExtent:ade,getPointResolution:function(t,n){return t/Math.cosh(n[1]/Ey)}})}},MD=[new Ep("EPSG:3857"),new Ep("EPSG:102100"),new Ep("EPSG:102113"),new Ep("EPSG:900913"),new Ep("http://www.opengis.net/def/crs/EPSG/0/3857"),new Ep("http://www.opengis.net/gml/srs/epsg.xml#3857")];function _W(i,e,t,n){let r=i.length;t=t>1?t:2,n=n??t,e===void 0&&(t>2?e=i.slice():e=new Array(r));for(let s=0;s<r;s+=n){e[s]=$1*i[s]/180;let o=Ey*Math.log(Math.tan(Math.PI*(+i[s+1]+90)/360));o>YT?o=YT:o<-YT&&(o=-YT),e[s+1]=o}return e}function xW(i,e,t,n){let r=i.length;t=t>1?t:2,n=n??t,e===void 0&&(t>2?e=i.slice():e=new Array(r));for(let s=0;s<r;s+=n)e[s]=180*i[s]/$1,e[s+1]=360*Math.atan(Math.exp(i[s+1]/Ey))/Math.PI-90;return e}var lde=6378137,yW=[-180,-90,180,90],cde=Math.PI*lde/180,Qf=class extends Tp{constructor(e,t){super({code:e,units:"degrees",extent:yW,axisOrientation:t,global:!0,metersPerUnit:cde,worldExtent:yW})}},CD=[new Qf("CRS:84"),new Qf("EPSG:4326","neu"),new Qf("urn:ogc:def:crs:OGC:1.3:CRS84"),new Qf("urn:ogc:def:crs:OGC:2:84"),new Qf("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new Qf("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new Qf("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];var RD={};function bW(i){return RD[i]||RD[i.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function wW(i,e){RD[i]=e}function mh(i){for(let e in i)delete i[e]}function gu(i){let e;for(e in i)return!1;return!e}var Y1={};function Z1(i,e,t){let n=i.getCode(),r=e.getCode();n in Y1||(Y1[n]={}),Y1[n][r]=t}function ZT(i,e){return i in Y1&&e in Y1[i]?Y1[i][e]:null}var KT=.9996,Pc=.00669438,JT=Pc*Pc,eE=JT*Pc,nA=Pc/(1-Pc),SW=Math.sqrt(1-Pc),K1=(1-SW)/(1+SW),CW=K1*K1,ID=CW*K1,PD=ID*K1,RW=PD*K1,IW=1-Pc/4-3*JT/64-5*eE/256,ude=3*Pc/8+3*JT/32+45*eE/1024,hde=15*JT/256+45*eE/1024,fde=35*eE/3072,dde=3/2*K1-27/32*ID+269/512*RW,pde=21/16*CW-55/32*PD,mde=151/96*ID-417/128*RW,Ade=1097/512*PD,QT=6378137;function gde(i,e,t){let n=i-5e5,o=(t.north?e:e-1e7)/KT/(QT*IW),a=o+dde*Math.sin(2*o)+pde*Math.sin(4*o)+mde*Math.sin(6*o)+Ade*Math.sin(8*o),l=Math.sin(a),c=l*l,u=Math.cos(a),f=l/u,d=f*f,A=d*d,y=1-Pc*c,w=Math.sqrt(1-Pc*c),S=QT/w,T=(1-Pc)/y,R=nA*u**2,P=R*R,I=n/(S*KT),F=I*I,D=F*I,L=D*I,C=L*I,B=C*I,k=a-f/T*(F/2-L/24*(5+3*d+10*R-4*P-9*nA))+B/720*(61+90*d+298*R+45*A-252*nA-3*P),z=(I-D/6*(1+2*d+R)+C/120*(5-2*R+28*d-3*P+8*nA+24*A))/u;return z=XT(z+Au(PW(t.number)),-Math.PI,Math.PI),[jT(z),jT(k)]}var TW=-80,EW=84,vde=-180,_de=180;function xde(i,e,t){i=XT(i,vde,_de),e<TW?e=TW:e>EW&&(e=EW);let n=Au(e),r=Math.sin(n),s=Math.cos(n),o=r/s,a=o*o,l=a*a,c=Au(i),u=PW(t.number),f=Au(u),d=QT/Math.sqrt(1-Pc*r**2),A=nA*s**2,y=s*XT(c-f,-Math.PI,Math.PI),w=y*y,S=w*y,T=S*y,R=T*y,P=R*y,I=QT*(IW*n-ude*Math.sin(2*n)+hde*Math.sin(4*n)-fde*Math.sin(6*n)),F=KT*d*(y+S/6*(1-a+A)+R/120*(5-18*a+l+72*A-58*nA))+5e5,D=KT*(I+d*o*(w/2+T/24*(5-a+9*A+4*A**2)+P/720*(61-58*a+l+600*A-330*nA)));return t.north||(D+=1e7),[F,D]}function PW(i){return(i-1)*6-180+3}var yde=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function LW(i){let e=0;for(let r of yde){let s=i.match(r);if(s){e=parseInt(s[1]);break}}if(!e)return null;let t=0,n=!1;return e>32700&&e<32761?t=e-32700:e>32600&&e<32661&&(n=!0,t=e-32600),t?{number:t,north:n}:null}function MW(i,e){return function(t,n,r,s){let o=t.length;r=r>1?r:2,s=s??r,n||(r>2?n=t.slice():n=new Array(o));for(let a=0;a<o;a+=s){let l=t[a],c=t[a+1],u=i(l,c,e);n[a]=u[0],n[a+1]=u[1]}return n}}function DW(i){return LW(i)?new Tp({code:i,units:"m"}):null}function NW(i){let e=LW(i.getCode());return e?{forward:MW(xde,e),inverse:MW(gde,e)}:null}var bde=63710088e-1;function LD(i,e,t){t=t||bde;let n=Au(i[1]),r=Au(e[1]),s=(r-n)/2,o=Au(e[0]-i[0])/2,a=Math.sin(s)*Math.sin(s)+Math.sin(o)*Math.sin(o)*Math.cos(n)*Math.cos(r);return 2*t*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}var wde=[NW],Sde=[DW];var ND=!0;function BW(i){ND=!(i===void 0?!0:i)}function BD(i,e){if(e!==void 0){for(let t=0,n=i.length;t<n;++t)e[t]=i[t];e=e}else e=i.slice();return e}function FD(i){wW(i.getCode(),i),Z1(i,i,BD)}function Tde(i){i.forEach(FD)}function ks(i){if(typeof i!="string")return i;let e=bW(i);if(e)return e;for(let t of Sde){let n=t(i);if(n)return n}return null}function OD(i,e,t,n){i=ks(i);let r,s=i.getPointResolutionFunc();if(s){if(r=s(e,t),n&&n!==i.getUnits()){let o=i.getMetersPerUnit();o&&(r=r*o/Kf[n])}}else{let o=i.getUnits();if(o=="degrees"&&!n||n=="degrees")r=e;else{let a=iA(i,ks("EPSG:4326"));if(!a&&o!=="degrees")r=e*i.getMetersPerUnit();else{let c=[t[0]-e/2,t[1],t[0]+e/2,t[1],t[0],t[1]-e/2,t[0],t[1]+e/2];c=a(c,c,2);let u=LD(c.slice(0,2),c.slice(2,4)),f=LD(c.slice(4,6),c.slice(6,8));r=(u+f)/2}let l=n?Kf[n]:i.getMetersPerUnit();l!==void 0&&(r/=l)}}return r}function FW(i){Tde(i),i.forEach(function(e){i.forEach(function(t){e!==t&&Z1(e,t,BD)})})}function Ede(i,e,t,n){i.forEach(function(r){e.forEach(function(s){Z1(r,s,t),Z1(s,r,n)})})}function tE(i,e){return i?typeof i=="string"?ks(i):i:ks(e)}function OW(i){return(function(e,t,n,r){let s=e.length;n=n!==void 0?n:2,r=r??n,t=t!==void 0?t:new Array(s);for(let o=0;o<s;o+=r){let a=i(e.slice(o,o+n)),l=a.length;for(let c=0,u=r;c<u;++c)t[o+c]=c>=l?e[o+c]:a[c]}return t})}function Q1(i,e){if(i===e)return!0;let t=i.getUnits()===e.getUnits();return(i.getCode()===e.getCode()||iA(i,e)===BD)&&t}function iA(i,e){let t=i.getCode(),n=e.getCode(),r=ZT(t,n);if(r)return r;let s=null,o=null;for(let l of wde)s||(s=l(i)),o||(o=l(e));if(!s&&!o)return null;let a="EPSG:4326";if(o)if(s)r=DD(s.inverse,o.forward);else{let l=ZT(t,a);l&&(r=DD(l,o.forward))}else{let l=ZT(a,n);l&&(r=DD(s.inverse,l))}return r&&(FD(i),FD(e),Z1(i,e,r)),r}function DD(i,e){return function(t,n,r,s){return n=i(t,n,r,s),e(n,n,r,s)}}function rA(i,e){let t=ks(i),n=ks(e);return iA(t,n)}function J1(i,e,t){let n=rA(e,t);if(!n){let r=ks(e).getCode(),s=ks(t).getCode();throw new Error(`No transform available between ${r} and ${s}`)}return n(i,void 0,i.length)}function UW(i,e,t,n){let r=rA(e,t);return uW(i,r,void 0,n)}var vu=null;function sA(){return vu}function My(i,e){return vu?J1(i,e,vu):i}function _u(i,e){return vu?J1(i,vu,e):(ND&&!tA(i,[0,0])&&i[0]>=-180&&i[0]<=180&&i[1]>=-90&&i[1]<=90&&(ND=!1,WT("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),i)}function Mp(i,e){return vu?UW(i,e,vu):i}function xu(i,e){return vu?UW(i,vu,e):i}function kW(i,e){if(!vu)return i;let t=ks(e).getMetersPerUnit(),n=vu.getMetersPerUnit();return t&&n?i*t/n:i}function Mde(){FW(MD),FW(CD),Ede(CD,MD,_W,xW)}Mde();function UD(i){return i[0]>0&&i[1]>0}function zW(i,e,t){return t===void 0&&(t=[0,0]),t[0]=i[0]*e+.5|0,t[1]=i[1]*e+.5|0,t}function ls(i,e){return Array.isArray(i)?i:(e===void 0?e=[i,i]:(e[0]=i,e[1]=i),e)}var nE=class{constructor(e,t,n,r){this.minX=e,this.maxX=t,this.minY=n,this.maxY=r}contains(e){return this.containsXY(e[1],e[2])}containsTileRange(e){return this.minX<=e.minX&&e.maxX<=this.maxX&&this.minY<=e.minY&&e.maxY<=this.maxY}containsXY(e,t){return this.minX<=e&&e<=this.maxX&&this.minY<=t&&t<=this.maxY}equals(e){return this.minX==e.minX&&this.minY==e.minY&&this.maxX==e.maxX&&this.maxY==e.maxY}extend(e){e.minX<this.minX&&(this.minX=e.minX),e.maxX>this.maxX&&(this.maxX=e.maxX),e.minY<this.minY&&(this.minY=e.minY),e.maxY>this.maxY&&(this.maxY=e.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(e){return this.minX<=e.maxX&&this.maxX>=e.minX&&this.minY<=e.maxY&&this.maxY>=e.minY}};function oA(i,e,t,n,r){return r!==void 0?(r.minX=i,r.maxX=e,r.minY=t,r.maxY=n,r):new nE(i,e,t,n)}var iE=nE;function VW(i,e,t){let n,r;t=t||pl;let s=0,o=i.length,a=!1;for(;s<o;)n=s+(o-s>>1),r=+t(i[n],e),r<0?s=n+1:(o=n,a=!r);return a?s:~s}function pl(i,e){return i>e?1:i<e?-1:0}function GW(i,e){return i<e?1:i>e?-1:0}function ev(i,e,t){if(i[0]<=e)return 0;let n=i.length;if(e<=i[n-1])return n-1;if(typeof t=="function"){for(let r=1;r<n;++r){let s=i[r];if(s===e)return r;if(s<e)return t(e,i[r-1],s)>0?r-1:r}return n-1}if(t>0){for(let r=1;r<n;++r)if(i[r]<e)return r-1;return n-1}if(t<0){for(let r=1;r<n;++r)if(i[r]<=e)return r;return n-1}for(let r=1;r<n;++r){if(i[r]==e)return r;if(i[r]<e)return i[r-1]-e<e-i[r]?r-1:r}return n-1}function qW(i,e,t){for(;e<t;){let n=i[e];i[e]=i[t],i[t]=n,++e,--t}}function Lo(i,e){let t=Array.isArray(e)?e:[e],n=t.length;for(let r=0;r<n;r++)i[i.length]=t[r]}function ea(i,e){let t=i.length;if(t!==e.length)return!1;for(let n=0;n<t;n++)if(i[n]!==e[n])return!1;return!0}function HW(i,e,t){let n=e||pl;return i.every(function(r,s){if(s===0)return!0;let o=n(i[s-1],r);return!(o>0||t&&o===0)})}function jn(i,e){if(!i)throw new Error(e)}function WW(i,e,t,n,r){return!qT(r,function(o){return!Cp(i,e,t,n,o[0],o[1])})}function Cp(i,e,t,n,r,s){let o=0,a=i[t-n],l=i[t-n+1];for(;e<t;e+=n){let c=i[e],u=i[e+1];l<=s?u>s&&(c-a)*(s-l)-(r-a)*(u-l)>0&&o++:u<=s&&(c-a)*(s-l)-(r-a)*(u-l)<0&&o--,a=c,l=u}return o!==0}function Cy(i,e,t,n,r,s){if(t.length===0||!Cp(i,e,t[0],n,r,s))return!1;for(let o=1,a=t.length;o<a;++o)if(Cp(i,t[o-1],t[o],n,r,s))return!1;return!0}function jW(i,e,t,n,r,s){if(t.length===0)return!1;for(let o=0,a=t.length;o<a;++o){let l=t[o];if(Cy(i,e,l,n,r,s))return!0;e=l[l.length-1]}return!1}function rE(i,e,t,n,r){let s;for(e+=n;e<t;e+=n)if(s=r(i.slice(e-n,e),i.slice(e,e+n)),s)return s;return!1}function aA(i,e,t,n,r,s){return s=s??bD(Wr(),i,e,t,n),Ar(r,s)?s[0]>=r[0]&&s[2]<=r[2]||s[1]>=r[1]&&s[3]<=r[3]?!0:rE(i,e,t,n,function(o,a){return cW(r,o,a)}):!1}function XW(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){if(aA(i,e,t[s],n,r))return!0;e=t[s]}return!1}function kD(i,e,t,n,r){return!!(aA(i,e,t,n,r)||Cp(i,e,t,n,r[0],r[1])||Cp(i,e,t,n,r[0],r[3])||Cp(i,e,t,n,r[2],r[1])||Cp(i,e,t,n,r[2],r[3]))}function zD(i,e,t,n,r){if(!kD(i,e,t[0],n,r))return!1;if(t.length===1)return!0;for(let s=1,o=t.length;s<o;++s)if(WW(i,t[s-1],t[s],n,r)&&!aA(i,t[s-1],t[s],n,r))return!1;return!0}function $W(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];if(zD(i,e,a,n,r))return!0;e=a[a.length-1]}return!1}function ei(){throw new Error("Unimplemented abstract method.")}var Cde=0;function Bn(i){return i.ol_uid||(i.ol_uid=String(++Cde))}function tv(i,e,t,n){return n!==void 0?(n[0]=i,n[1]=e,n[2]=t,n):[i,e,t]}function Rde(i,e,t){return i+"/"+e+"/"+t}function nv(i,e,t,n,r){return`${Bn(i)},${e},${Rde(t,n,r)}`}function YW(i){return Ide(i[0],i[1],i[2])}function Ide(i,e,t){return(e<<i)+t}function ZW(i,e){let t=i[0],n=i[1],r=i[2];if(e.getMinZoom()>t||t>e.getMaxZoom())return!1;let s=e.getFullTileRange(t);return s?s.containsXY(n,r):!0}var iv=[0,0,0],Rp=5,VD=class{constructor(e){let t=e.minZoom,n=e.resolutions;t===void 0&&n&&(t=n.findIndex(o=>o!==void 0)),this.minZoom=t!==void 0?t:0,this.resolutions_=n,jn(HW(this.resolutions_,(o,a)=>a-o,!0),"`resolutions` must be sorted in descending order");let r;if(!e.origins){for(let o=0,a=this.resolutions_.length-1;o<a;++o)if(!r)r=this.resolutions_[o]/this.resolutions_[o+1];else if(this.resolutions_[o]/this.resolutions_[o+1]!==r){r=void 0;break}}this.zoomFactor_=r,this.maxZoom=this.resolutions_.length-1,this.origin_=e.origin!==void 0?e.origin:null,this.origins_=null,e.origins!==void 0&&(this.origins_=e.origins,jn(this.origins_.length==this.resolutions_.length,"Number of `origins` and `resolutions` must be equal"));let s=e.extent;s!==void 0&&!this.origin_&&!this.origins_&&(this.origin_=Ic(s)),jn(!this.origin_&&this.origins_||this.origin_&&!this.origins_,"Either `origin` or `origins` must be configured, never both"),this.tileSizes_=null,e.tileSizes!==void 0&&(this.tileSizes_=e.tileSizes,jn(this.tileSizes_.length==this.resolutions_.length,"Number of `tileSizes` and `resolutions` must be equal")),this.tileSize_=e.tileSize!==void 0?e.tileSize:this.tileSizes_?null:256,jn(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,"Either `tileSize` or `tileSizes` must be configured, never both"),this.extent_=s!==void 0?s:null,this.fullTileRanges_=null,this.tmpSize_=[0,0],this.tmpExtent_=[0,0,0,0],e.tileRanges!==void 0?this.fullTileRanges_=e.tileRanges:e.sizes!==void 0?this.fullTileRanges_=e.sizes.map((o,a)=>{let l=new iE(Math.min(0,o[0]),Math.max(o[0]-1,-1),Math.min(0,o[1]),Math.max(o[1]-1,-1));if(s){let c=this.getTileRangeForExtentAndZ(s,a);l.minX=Math.max(c.minX,l.minX),l.maxX=Math.min(c.maxX,l.maxX),l.minY=Math.max(c.minY,l.minY),l.maxY=Math.min(c.maxY,l.maxY)}return l}):s&&this.calculateTileRanges_(s)}forEachTileCoord(e,t,n){let r=this.getTileRangeForExtentAndZ(e,t);for(let s=r.minX,o=r.maxX;s<=o;++s)for(let a=r.minY,l=r.maxY;a<=l;++a)n([t,s,a])}forEachTileCoordParentTileRange(e,t,n,r){let s,o,a,l=null,c=e[0]-1;for(this.zoomFactor_===2?(o=e[1],a=e[2]):l=this.getTileCoordExtent(e,r);c>=this.minZoom;){if(o!==void 0&&a!==void 0?(o=Math.floor(o/2),a=Math.floor(a/2),s=oA(o,o,a,a,n)):s=this.getTileRangeForExtentAndZ(l,c,n),t(c,s))return!0;--c}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(e){return this.origin_?this.origin_:this.origins_[e]}getOrigins(){return this.origins_}getResolution(e){return this.resolutions_[e]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(e,t,n){if(e[0]<this.maxZoom){if(this.zoomFactor_===2){let s=e[1]*2,o=e[2]*2;return oA(s,s+1,o,o+1,t)}let r=this.getTileCoordExtent(e,n||this.tmpExtent_);return this.getTileRangeForExtentAndZ(r,e[0]+1,t)}return null}getTileRangeForTileCoordAndZ(e,t,n){if(t>this.maxZoom||t<this.minZoom)return null;let r=e[0],s=e[1],o=e[2];if(t===r)return oA(s,o,s,o,n);if(this.zoomFactor_){let l=Math.pow(this.zoomFactor_,t-r),c=Math.floor(s*l),u=Math.floor(o*l);if(t<r)return oA(c,c,u,u,n);let f=Math.floor(l*(s+1))-1,d=Math.floor(l*(o+1))-1;return oA(c,f,u,d,n)}let a=this.getTileCoordExtent(e,this.tmpExtent_);return this.getTileRangeForExtentAndZ(a,t,n)}getTileRangeForExtentAndZ(e,t,n){this.getTileCoordForXYAndZ_(e[0],e[3],t,!1,iv);let r=iv[1],s=iv[2];this.getTileCoordForXYAndZ_(e[2],e[1],t,!0,iv);let o=iv[1],a=iv[2];return oA(r,o,s,a,n)}getTileCoordCenter(e){let t=this.getOrigin(e[0]),n=this.getResolution(e[0]),r=ls(this.getTileSize(e[0]),this.tmpSize_);return[t[0]+(e[1]+.5)*r[0]*n,t[1]-(e[2]+.5)*r[1]*n]}getTileCoordExtent(e,t){let n=this.getOrigin(e[0]),r=this.getResolution(e[0]),s=ls(this.getTileSize(e[0]),this.tmpSize_),o=n[0]+e[1]*s[0]*r,a=n[1]-(e[2]+1)*s[1]*r,l=o+s[0]*r,c=a+s[1]*r;return ql(o,a,l,c,t)}getTileCoordForCoordAndResolution(e,t,n){return this.getTileCoordForXYAndResolution_(e[0],e[1],t,!1,n)}getTileCoordForXYAndResolution_(e,t,n,r,s){let o=this.getZForResolution(n),a=n/this.getResolution(o),l=this.getOrigin(o),c=ls(this.getTileSize(o),this.tmpSize_),u=a*(e-l[0])/n/c[0],f=a*(l[1]-t)/n/c[1];return r?(u=Ty(u,Rp)-1,f=Ty(f,Rp)-1):(u=Sy(u,Rp),f=Sy(f,Rp)),tv(o,u,f,s)}getTileCoordForXYAndZ_(e,t,n,r,s){let o=this.getOrigin(n),a=this.getResolution(n),l=ls(this.getTileSize(n),this.tmpSize_),c=(e-o[0])/a/l[0],u=(o[1]-t)/a/l[1];return r?(c=Ty(c,Rp)-1,u=Ty(u,Rp)-1):(c=Sy(c,Rp),u=Sy(u,Rp)),tv(n,c,u,s)}getTileCoordForCoordAndZ(e,t,n){return this.getTileCoordForXYAndZ_(e[0],e[1],t,!1,n)}getTileCoordResolution(e){return this.resolutions_[e[0]]}getTileSize(e){return this.tileSize_?this.tileSize_:this.tileSizes_[e]}getFullTileRange(e){return this.fullTileRanges_?this.fullTileRanges_[e]:this.extent_?this.getTileRangeForExtentAndZ(this.extent_,e):null}getZForResolution(e,t){let n=ev(this.resolutions_,e,t||0);return Si(n,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(e,t){return kD(t,0,t.length,2,this.getTileCoordExtent(e))}calculateTileRanges_(e){let t=this.resolutions_.length,n=new Array(t);for(let r=this.minZoom;r<t;++r)n[r]=this.getTileRangeForExtentAndZ(e,r);this.fullTileRanges_=n}},Ry=VD;function sE(i){let e=i.getDefaultTileGrid();return e||(e=Lde(i),i.setDefaultTileGrid(e)),e}function QW(i,e,t){let n=e[0],r=i.getTileCoordCenter(e),s=oE(t);if(!pu(s,r)){let o=Kn(s),a=Math.ceil((s[0]-r[0])/o);return r[0]+=o*a,i.getTileCoordForCoordAndZ(r,n)}return e}function Pde(i,e,t,n){n=n!==void 0?n:"top-left";let r=ej(i,e,t);return new Ry({extent:i,origin:aW(i,n),resolutions:r,tileSize:t})}function JW(i){let e=i||{},t=e.extent||ks("EPSG:3857").getExtent(),n={extent:t,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:ej(t,e.maxZoom,e.tileSize,e.maxResolution)};return new Ry(n)}function ej(i,e,t,n){e=e!==void 0?e:42,t=ls(t!==void 0?t:256);let r=Dr(i),s=Kn(i);n=n>0?n:Math.max(s/t[0],r/t[1]);let o=e+1,a=new Array(o);for(let l=0;l<o;++l)a[l]=n/Math.pow(2,l);return a}function Lde(i,e,t,n){let r=oE(i);return Pde(r,e,t,n)}function oE(i){i=ks(i);let e=i.getExtent();if(!e){let t=180*Kf.degrees/i.getMetersPerUnit();e=ql(-t,-t,t,t)}return e}var In={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function qn(i,e,t,n,r){if(r){let o=t;t=function(a){return i.removeEventListener(e,t),o.call(n??this,a)}}else n&&n!==i&&(t=t.bind(n));let s={target:i,type:e,listener:t};return i.addEventListener(e,t),s}function rv(i,e,t,n){return qn(i,e,t,n,!0)}function li(i){i&&i.target&&(i.target.removeEventListener(i.type,i.listener),mh(i))}var nn={CHANGE:"change",ERROR:"error",BLUR:"blur",CLEAR:"clear",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",DRAGENTER:"dragenter",DRAGOVER:"dragover",DROP:"drop",FOCUS:"focus",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",RESIZE:"resize",TOUCHMOVE:"touchmove",WHEEL:"wheel"};var GD=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}},Ip=GD;function Jf(){return!0}function ed(){return!1}function td(){}function aE(i){let e,t,n;return function(){let r=Array.prototype.slice.call(arguments);return(!t||this!==n||!ea(r,t))&&(n=this,t=r,e=i.apply(this,arguments)),e}}function tj(i){function e(){let t;try{t=i()}catch(n){return Promise.reject(n)}return t instanceof Promise?t:Promise.resolve(t)}return e()}var qD=class{constructor(e){this.propagationStopped,this.defaultPrevented,this.type=e,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}};var Ao=qD;var HD=class extends Ip{constructor(e){super(),this.eventTarget_=e,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(e,t){if(!e||!t)return;let n=this.listeners_||(this.listeners_={}),r=n[e]||(n[e]=[]);r.includes(t)||r.push(t)}dispatchEvent(e){let t=typeof e=="string",n=t?e:e.type,r=this.listeners_&&this.listeners_[n];if(!r)return;let s=t?new Ao(e):e;s.target||(s.target=this.eventTarget_||this);let o=this.dispatching_||(this.dispatching_={}),a=this.pendingRemovals_||(this.pendingRemovals_={});n in o||(o[n]=0,a[n]=0),++o[n];let l;for(let c=0,u=r.length;c<u;++c)if("handleEvent"in r[c]?l=r[c].handleEvent(s):l=r[c].call(this,s),l===!1||s.propagationStopped){l=!1;break}if(--o[n]===0){let c=a[n];for(delete a[n];c--;)this.removeEventListener(n,td);delete o[n]}return l}disposeInternal(){this.listeners_&&mh(this.listeners_)}getListeners(e){return this.listeners_&&this.listeners_[e]||void 0}hasListener(e){return this.listeners_?e?e in this.listeners_:Object.keys(this.listeners_).length>0:!1}removeEventListener(e,t){if(!this.listeners_)return;let n=this.listeners_[e];if(!n)return;let r=n.indexOf(t);r!==-1&&(this.pendingRemovals_&&e in this.pendingRemovals_?(n[r]=td,++this.pendingRemovals_[e]):(n.splice(r,1),n.length===0&&delete this.listeners_[e]))}},Pp=HD;var lA=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"",Dde=lA.includes("safari")&&!lA.includes("chrom"),NBe=Dde&&(lA.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(lA)),nj=lA.includes("webkit")&&!lA.includes("edge"),WD=lA.includes("macintosh"),ij=typeof devicePixelRatio<"u"?devicePixelRatio:1,io=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,jD=typeof Image<"u"&&Image.prototype.decode;var lE=(function(){let i=!1;try{let e=Object.defineProperty({},"passive",{get:function(){i=!0}});window.addEventListener("_",null,e),window.removeEventListener("_",null,e)}catch{}return i})();function rj(i,e,t){let n=i,r=!0,s=!1,o=!1,a=[rv(n,nn.LOAD,function(){o=!0,s||e()})];return n.src&&jD?(s=!0,n.decode().then(function(){r&&e()}).catch(function(l){r&&(o?e():t())})):a.push(rv(n,nn.ERROR,t)),function(){r=!1,a.forEach(li)}}function Nde(i,e){return new Promise((t,n)=>{function r(){o(),t(i)}function s(){o(),n(new Error("Image load error"))}function o(){i.removeEventListener("load",r),i.removeEventListener("error",s)}i.addEventListener("load",r),i.addEventListener("error",s),e&&(i.src=e)})}function sj(i,e){return e&&(i.src=e),i.src&&jD?new Promise((t,n)=>i.decode().then(()=>t(i)).catch(r=>i.complete&&i.width?t(i):n(r))):Nde(i)}var an={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function XD(i){return Math.pow(i,3)}function Lc(i){return 1-XD(1-i)}function oj(i){return 3*i*i-2*i*i*i}function aj(i){return i}var $D=class extends Pp{constructor(e,t,n){super(),n=n||{},this.tileCoord=e,this.state=t,this.key="",this.transition_=n.transition===void 0?250:n.transition,this.transitionStarts_={},this.interpolate=!!n.interpolate}changed(){this.dispatchEvent(nn.CHANGE)}release(){this.setState(an.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(e){if(this.state!==an.EMPTY){if(this.state!==an.ERROR&&this.state>e)throw new Error("Tile load sequence violation");this.state=e,this.changed()}}load(){ei()}getAlpha(e,t){if(!this.transition_)return 1;let n=this.transitionStarts_[e];if(!n)n=t,this.transitionStarts_[e]=n;else if(n===-1)return 1;let r=t-n+1e3/60;return r>=this.transition_?1:XD(r/this.transition_)}inTransition(e){return this.transition_?this.transitionStarts_[e]!==-1:!1}endTransition(e){this.transition_&&(this.transitionStarts_[e]=-1)}disposeInternal(){this.release(),super.disposeInternal()}},sv=$D;function Di(i,e,t,n){let r;return t&&t.length?r=t.shift():io?r=new class extends OffscreenCanvas{style={}}(i??300,e??150):r=document.createElement("canvas"),i&&(r.width=i),e&&(r.height=e),r.getContext("2d",n)}var YD;function Iy(){return YD||(YD=Di(1,1)),YD}function cA(i){let e=i.canvas;e.width=1,e.height=1,i.clearRect(0,0,1,1)}function ZD(i,e){let t=e.parentNode;t&&t.replaceChild(i,e)}function lj(i){for(;i.lastChild;)i.lastChild.remove()}function cj(i,e){let t=i.childNodes;for(let n=0;;++n){let r=t[n],s=e[n];if(!r&&!s)break;if(r!==s){if(!r){i.appendChild(s);continue}if(!s){i.removeChild(r),--n;continue}i.insertBefore(s,r)}}}function cE(){return new Proxy({childNodes:[],appendChild:function(e){return this.childNodes.push(e),e},remove:function(){},removeChild:function(e){let t=this.childNodes.indexOf(e);if(t===-1)throw new Error("Node to remove was not found");return this.childNodes.splice(t,1),e},insertBefore:function(e,t){let n=this.childNodes.indexOf(t);if(n===-1)throw new Error("Reference node not found");return this.childNodes.splice(n,0,e),e},style:{}},{get(e,t,n){return t==="firstElementChild"?e.childNodes.length>0?e.childNodes[0]:null:Reflect.get(e,t,n)}})}function Hl(i){return typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas}var KD=class extends sv{constructor(e,t,n,r,s,o){super(e,t,o),this.crossOrigin_=r?.crossOrigin,this.referrerPolicy_=r?.referrerPolicy,this.src_=n,this.key=n,this.image_,io?this.image_=new OffscreenCanvas(1,1):(this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.unlisten_=null,this.tileLoadFunction_=s}getImage(){return this.image_}setImage(e){this.image_=e,this.state=an.LOADED,this.unlistenImage_(),this.changed()}getCrossOrigin(){return this.crossOrigin_}getReferrerPolicy(){return this.referrerPolicy_}handleImageError_(){this.state=an.ERROR,this.unlistenImage_(),this.image_=Fde(),this.changed()}handleImageLoad_(){if(io)this.state=an.LOADED;else{let e=this.image_;e.naturalWidth&&e.naturalHeight?this.state=an.LOADED:this.state=an.EMPTY}this.unlistenImage_(),this.changed()}load(){this.state==an.ERROR&&(this.state=an.IDLE,this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.state==an.IDLE&&(this.state=an.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=rj(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}disposeInternal(){this.unlistenImage_(),this.image_=null,super.disposeInternal()}};function Fde(){let i=Di(1,1);return i.fillStyle="rgba(0,0,0,0)",i.fillRect(0,0,1,1),i.canvas}var uE=KD;var QD,uA=[];function uj(i,e,t,n,r){i.beginPath(),i.moveTo(0,0),i.lineTo(e,t),i.lineTo(n,r),i.closePath(),i.save(),i.clip(),i.fillRect(0,0,Math.max(e,n)+1,Math.max(t,r)),i.restore()}function JD(i,e){return Math.abs(i[e*4]-210)>2||Math.abs(i[e*4+3]-.75*255)>2}function Bde(){if(QD===void 0){let i=Di(6,6,uA);i.globalCompositeOperation="lighter",i.fillStyle="rgba(210, 0, 0, 0.75)",uj(i,4,5,4,0),uj(i,4,5,0,5);let e=i.getImageData(0,0,3,3).data;QD=JD(e,0)||JD(e,4)||JD(e,8),cA(i),uA.push(i.canvas)}return QD}function hj(i,e,t,n){let r=J1(t,e,i),s=OD(e,n,t),o=e.getMetersPerUnit();o!==void 0&&(s*=o);let a=i.getMetersPerUnit();a!==void 0&&(s/=a);let l=i.getExtent();if(!l||pu(l,r)){let c=OD(i,s,r)/s;isFinite(c)&&c>0&&(s/=c)}return s}function fj(i,e,t,n){let r=dl(t),s=hj(i,e,r,n);return(!isFinite(s)||s<=0)&&qT(t,function(o){return s=hj(i,e,o,n),isFinite(s)&&s>0}),s}function dj(i,e,t,n,r,s,o,a,l,c,u,f,d,A){let y=Di(Math.round(t*i),Math.round(t*e),uA);if(f||(y.imageSmoothingEnabled=!1),l.length===0)return y.canvas;y.scale(t,t);function w(F){return Math.round(F*t)/t}y.globalCompositeOperation="lighter";let S=Wr();l.forEach(function(F,D,L){GT(S,F.extent)});let T,R=t/n,P=(f?1:1+Math.pow(2,-24))/R;if(!d||l.length!==1||c!==0){if(T=Di(Math.round(Kn(S)*R),Math.round(Dr(S)*R),uA),f||(T.imageSmoothingEnabled=!1),r&&A){let F=(r[0]-S[0])*R,D=-(r[3]-S[3])*R,L=Kn(r)*R,C=Dr(r)*R;T.rect(F,D,L,C),T.clip()}l.forEach(function(F,D,L){if(F.image.width>0&&F.image.height>0){if(F.clipExtent){T.save();let G=(F.clipExtent[0]-S[0])*R,W=-(F.clipExtent[3]-S[3])*R,Y=Kn(F.clipExtent)*R,H=Dr(F.clipExtent)*R;T.rect(f?G:Math.round(G),f?W:Math.round(W),f?Y:Math.round(G+Y)-Math.round(G),f?H:Math.round(W+H)-Math.round(W)),T.clip()}let C=(F.extent[0]-S[0])*R,B=-(F.extent[3]-S[3])*R,k=Kn(F.extent)*R,z=Dr(F.extent)*R;T.drawImage(F.image,c,c,F.image.width-2*c,F.image.height-2*c,f?C:Math.round(C),f?B:Math.round(B),f?k:Math.round(C+k)-Math.round(C),f?z:Math.round(B+z)-Math.round(B)),F.clipExtent&&T.restore()}})}let I=Ic(o);return a.getTriangles().forEach(function(F,D,L){let C=F.source,B=F.target,k=C[0][0],z=C[0][1],G=C[1][0],W=C[1][1],Y=C[2][0],H=C[2][1],$=w((B[0][0]-I[0])/s),J=w(-(B[0][1]-I[1])/s),te=w((B[1][0]-I[0])/s),ce=w(-(B[1][1]-I[1])/s),he=w((B[2][0]-I[0])/s),ve=w(-(B[2][1]-I[1])/s),Re=k,Qe=z;k=0,z=0,G-=Re,W-=Qe,Y-=Re,H-=Qe;let Fe=[[G,W,0,0,te-$],[Y,H,0,0,he-$],[0,0,G,W,ce-J],[0,0,Y,H,ve-J]],mt=pW(Fe);if(!mt)return;if(y.save(),y.beginPath(),Bde()||!f){y.moveTo(te,ce);let Ve=4,Ye=$-te,Mt=J-ce;for(let Et=0;Et<Ve;Et++)y.lineTo(te+w((Et+1)*Ye/Ve),ce+w(Et*Mt/(Ve-1))),Et!=Ve-1&&y.lineTo(te+w((Et+1)*Ye/Ve),ce+w((Et+1)*Mt/(Ve-1)));y.lineTo(he,ve)}else y.moveTo(te,ce),y.lineTo($,J),y.lineTo(he,ve);y.clip(),y.transform(mt[0],mt[2],mt[1],mt[3],$,J),y.translate(S[0]-Re,S[3]-Qe);let Ee;if(T)Ee=T.canvas,y.scale(P,-P);else{let Ve=l[0],Ye=Ve.extent;Ee=Ve.image,y.scale(Kn(Ye)/Ee.width,-Dr(Ye)/Ee.height)}y.drawImage(Ee,0,0),y.restore()}),T&&(cA(T),uA.push(T.canvas)),u&&(y.save(),y.globalCompositeOperation="source-over",y.strokeStyle="black",y.lineWidth=1,a.getTriangles().forEach(function(F,D,L){let C=F.target,B=(C[0][0]-I[0])/s,k=-(C[0][1]-I[1])/s,z=(C[1][0]-I[0])/s,G=-(C[1][1]-I[1])/s,W=(C[2][0]-I[0])/s,Y=-(C[2][1]-I[1])/s;y.beginPath(),y.moveTo(z,G),y.lineTo(B,k),y.lineTo(W,Y),y.closePath(),y.stroke()}),y.restore()),y.canvas}var Ode=[1,0,0,1,0,0],uOe=new Array(6);function go(){return Ode.slice(0)}function pj(i,e){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i}function jr(i,e){let t=e[0],n=e[1];return e[0]=i[0]*t+i[2]*n+i[4],e[1]=i[1]*t+i[3]*n+i[5],e}function Do(i,e,t,n,r,s,o,a){let l=Math.sin(s),c=Math.cos(s);return i[0]=n*c,i[1]=r*l,i[2]=-n*l,i[3]=r*c,i[4]=o*n*c-a*n*l+e,i[5]=o*r*l+a*r*c+t,i}function fE(i,e){let t=Ude(e);jn(t!==0,"Transformation matrix cannot be inverted");let n=e[0],r=e[1],s=e[2],o=e[3],a=e[4],l=e[5];return i[0]=o/t,i[1]=-r/t,i[2]=-s/t,i[3]=n/t,i[4]=(s*l-o*a)/t,i[5]=-(n*l-r*a)/t,i}function Ude(i){return i[0]*i[3]-i[1]*i[2]}var kde=[1e5,1e5,1e5,1e5,2,2];function mj(i){return"matrix("+i.join(", ")+")"}function hE(i){return i.substring(7,i.length-1).split(",").map(parseFloat)}function Aj(i,e){let t=hE(i),n=hE(e);for(let r=0;r<6;++r)if(Math.round((t[r]-n[r])*kde[r])!==0)return!1;return!0}var zde=10,gj=.25,eN=class{constructor(e,t,n,r,s,o,a){this.sourceProj_=e,this.targetProj_=t;let l={},c=a?OW(P=>jr(a,J1(P,this.targetProj_,this.sourceProj_))):rA(this.targetProj_,this.sourceProj_);this.transformInv_=function(P){let I=P[0]+"/"+P[1];return l[I]||(l[I]=c(P)),l[I]},this.maxSourceExtent_=r,this.errorThresholdSquared_=s*s,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!r&&!!this.sourceProj_.getExtent()&&Kn(r)>=Kn(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?Kn(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?Kn(this.targetProj_.getExtent()):null;let u=Ic(n),f=j1(n),d=W1(n),A=H1(n),y=this.transformInv_(u),w=this.transformInv_(f),S=this.transformInv_(d),T=this.transformInv_(A),R=zde+(o?Math.max(0,Math.ceil(Math.log2(by(n)/(o*o*256*256)))):0);if(this.addQuad_(u,f,d,A,y,w,S,T,R),this.wrapsXInSource_){let P=1/0;this.triangles_.forEach(function(I,F,D){P=Math.min(P,I.source[0][0],I.source[1][0],I.source[2][0])}),this.triangles_.forEach(I=>{if(Math.max(I.source[0][0],I.source[1][0],I.source[2][0])-P>this.sourceWorldWidth_/2){let F=[[I.source[0][0],I.source[0][1]],[I.source[1][0],I.source[1][1]],[I.source[2][0],I.source[2][1]]];F[0][0]-P>this.sourceWorldWidth_/2&&(F[0][0]-=this.sourceWorldWidth_),F[1][0]-P>this.sourceWorldWidth_/2&&(F[1][0]-=this.sourceWorldWidth_),F[2][0]-P>this.sourceWorldWidth_/2&&(F[2][0]-=this.sourceWorldWidth_);let D=Math.min(F[0][0],F[1][0],F[2][0]);Math.max(F[0][0],F[1][0],F[2][0])-D<this.sourceWorldWidth_/2&&(I.source=F)}})}l={}}addTriangle_(e,t,n,r,s,o){this.triangles_.push({source:[r,s,o],target:[e,t,n]})}addQuad_(e,t,n,r,s,o,a,l,c){let u=yD([s,o,a,l]),f=this.sourceWorldWidth_?Kn(u)/this.sourceWorldWidth_:null,d=this.sourceWorldWidth_,A=this.sourceProj_.canWrapX()&&f>.5&&f<1,y=!1;if(c>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){let S=yD([e,t,n,r]);y=Kn(S)/this.targetWorldWidth_>gj||y}!A&&this.sourceProj_.isGlobal()&&f&&(y=f>gj||y)}if(!y&&this.maxSourceExtent_&&isFinite(u[0])&&isFinite(u[1])&&isFinite(u[2])&&isFinite(u[3])&&!Ar(u,this.maxSourceExtent_))return;let w=0;if(!y&&(!isFinite(s[0])||!isFinite(s[1])||!isFinite(o[0])||!isFinite(o[1])||!isFinite(a[0])||!isFinite(a[1])||!isFinite(l[0])||!isFinite(l[1]))){if(c>0)y=!0;else if(w=(!isFinite(s[0])||!isFinite(s[1])?8:0)+(!isFinite(o[0])||!isFinite(o[1])?4:0)+(!isFinite(a[0])||!isFinite(a[1])?2:0)+(!isFinite(l[0])||!isFinite(l[1])?1:0),w!=1&&w!=2&&w!=4&&w!=8)return}if(c>0){if(!y){let S=[(e[0]+n[0])/2,(e[1]+n[1])/2],T=this.transformInv_(S),R;A?R=(ph(s[0],d)+ph(a[0],d))/2-ph(T[0],d):R=(s[0]+a[0])/2-T[0];let P=(s[1]+a[1])/2-T[1];y=R*R+P*P>this.errorThresholdSquared_}if(y){if(Math.abs(e[0]-n[0])<=Math.abs(e[1]-n[1])){let S=[(t[0]+n[0])/2,(t[1]+n[1])/2],T=this.transformInv_(S),R=[(r[0]+e[0])/2,(r[1]+e[1])/2],P=this.transformInv_(R);this.addQuad_(e,t,S,R,s,o,T,P,c-1),this.addQuad_(R,S,n,r,P,T,a,l,c-1)}else{let S=[(e[0]+t[0])/2,(e[1]+t[1])/2],T=this.transformInv_(S),R=[(n[0]+r[0])/2,(n[1]+r[1])/2],P=this.transformInv_(R);this.addQuad_(e,S,R,r,s,T,P,l,c-1),this.addQuad_(S,t,n,R,T,o,a,P,c-1)}return}}if(A){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}(w&11)==0&&this.addTriangle_(e,n,r,s,a,l),(w&14)==0&&this.addTriangle_(e,n,t,s,a,o),w&&((w&13)==0&&this.addTriangle_(t,r,e,o,l,s),(w&7)==0&&this.addTriangle_(t,r,n,o,l,a))}calculateSourceExtent(){let e=Wr();return this.triangles_.forEach(function(t,n,r){let s=t.source;Jm(e,s[0]),Jm(e,s[1]),Jm(e,s[2])}),e}getTriangles(){return this.triangles_}},vj=eN;var tN=class extends sv{constructor(e,t,n,r,s,o,a,l,c,u,f,d){super(s,an.IDLE,d),this.renderEdges_=f!==void 0?f:!1,this.pixelRatio_=a,this.gutter_=l,this.canvas_=null,this.sourceTileGrid_=t,this.targetTileGrid_=r,this.wrappedTileCoord_=o||s,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=e.canWrapX()?e.getExtent():void 0;let A=r.getTileCoordExtent(this.wrappedTileCoord_),y=this.targetTileGrid_.getExtent(),w=this.sourceTileGrid_.getExtent(),S=y?fh(A,y):A;if(by(S)===0){this.state=an.EMPTY;return}let T=e.getExtent();T&&(w?w=fh(w,T):w=T);let R=r.getResolution(this.wrappedTileCoord_[0]),P=fj(e,n,S,R);if(!isFinite(P)||P<=0){this.state=an.EMPTY;return}let I=u!==void 0?u:.5;if(this.triangulation_=new vj(e,n,S,w,P*I,R),this.triangulation_.getTriangles().length===0){this.state=an.EMPTY;return}this.sourceZ_=t.getZForResolution(P);let F=this.triangulation_.calculateSourceExtent();if(w&&(e.canWrapX()?(F[1]=Si(F[1],w[1],w[3]),F[3]=Si(F[3],w[1],w[3])):F=fh(F,w)),!by(F))this.state=an.EMPTY;else{let D=0,L=0;e.canWrapX()&&(D=Kn(T),L=Math.floor((F[0]-T[0])/D)),HT(F.slice(),e,!0).forEach(B=>{let k=t.getTileRangeForExtentAndZ(B,this.sourceZ_);for(let z=k.minX;z<=k.maxX;z++)for(let G=k.minY;G<=k.maxY;G++){let W=L*D;this.sourceTiles_.push({getTile:()=>c(this.sourceZ_,z,G,a),offset:W})}++L}),this.sourceTiles_.length===0&&(this.state=an.EMPTY)}}getImage(){return this.canvas_}reproject_(){let e=[];if(this.sourceTiles_.forEach(t=>{let n=t.tile;if(n&&n.getState()==an.LOADED){let r=this.sourceTileGrid_.getTileCoordExtent(n.tileCoord);r[0]+=t.offset,r[2]+=t.offset;let s=this.clipExtent_?.slice();s&&(s[0]+=t.offset,s[2]+=t.offset),e.push({extent:r,clipExtent:s,image:n.getImage()})}}),this.sourceTiles_.length=0,e.length===0)this.state=an.ERROR;else{let t=this.wrappedTileCoord_[0],n=this.targetTileGrid_.getTileSize(t),r=typeof n=="number"?n:n[0],s=typeof n=="number"?n:n[1],o=this.targetTileGrid_.getResolution(t),a=this.sourceTileGrid_.getResolution(this.sourceZ_),l=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=dj(r,s,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),o,l,this.triangulation_,e,this.gutter_,this.renderEdges_,this.interpolate),this.state=an.LOADED}this.changed()}load(){for(let e of this.sourceTiles_)e.tile=e.getTile();if(this.state==an.IDLE){this.state=an.LOADING,this.changed();let e=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:t})=>{let n=t.getState();if(n==an.IDLE||n==an.LOADING){e++;let r=qn(t,nn.CHANGE,s=>{let o=t.getState();(o==an.LOADED||o==an.ERROR||o==an.EMPTY)&&(li(r),e--,e===0&&(this.unlistenSources_(),this.reproject_()))});this.sourcesListenerKeys_.push(r)}}),e===0?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function({tile:t},n,r){t.getState()==an.IDLE&&t.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(li),this.sourcesListenerKeys_=null}release(){this.canvas_&&(cA(this.canvas_.getContext("2d")),uA.push(this.canvas_),this.canvas_=null),this.sourceTiles_.length=0,super.release()}},dE=tN;var Vde=/\{z\}/g,Gde=/\{x\}/g,qde=/\{y\}/g,Hde=/\{-y\}/g;function _j(i,e,t,n,r){return i.replace(Vde,e.toString()).replace(Gde,t.toString()).replace(qde,n.toString()).replace(Hde,function(){if(r===void 0)throw new Error("If the URL template has a {-y} placeholder, the grid extent must be known");return(r-n).toString()})}function xj(i){let e=[],t=/\{([a-z])-([a-z])\}/.exec(i);if(t){let n=t[1].charCodeAt(0),r=t[2].charCodeAt(0),s;for(s=n;s<=r;++s)e.push(i.replace(t[0],String.fromCharCode(s)));return e}if(t=/\{(\d+)-(\d+)\}/.exec(i),t){let n=parseInt(t[2],10);for(let r=parseInt(t[1],10);r<=n;r++)e.push(i.replace(t[0],r.toString()));return e}return e.push(i),e}function Wde(i,e){return(function(t,n,r){if(!t)return;let s,o=t[0];if(e){let a=e.getFullTileRange(o);a&&(s=a.getHeight()-1)}return _j(i,o,t[1],t[2],s)})}function yj(i,e){let t=i.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Wde(i[r],e);return jde(n)}function jde(i){return i.length===1?i[0]:(function(e,t,n){if(!e)return;let r=YW(e),s=ph(r,i.length);return i[s](e,t,n)})}var yu={PROPERTYCHANGE:"propertychange"};var ov=class extends Pp{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(nn.CHANGE)}getRevision(){return this.revision_}onInternal(e,t){if(Array.isArray(e)){let n=e.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=qn(this,e[s],t);return r}return qn(this,e,t)}onceInternal(e,t){let n;if(Array.isArray(e)){let r=e.length;n=new Array(r);for(let s=0;s<r;++s)n[s]=rv(this,e[s],t)}else n=rv(this,e,t);return t.ol_key=n,n}unInternal(e,t){let n=t.ol_key;if(n)Xde(n);else if(Array.isArray(e))for(let r=0,s=e.length;r<s;++r)this.removeEventListener(e[r],t);else this.removeEventListener(e,t)}};ov.prototype.on;ov.prototype.once;ov.prototype.un;function Xde(i){if(Array.isArray(i))for(let e=0,t=i.length;e<t;++e)li(i[e]);else li(i)}var pE=ov;var mE=class extends Ao{constructor(e,t,n){super(e),this.key=t,this.oldValue=n}},nN=class extends pE{constructor(e){super(),this.on,this.once,this.un,Bn(this),this.values_=null,e!==void 0&&this.setProperties(e)}get(e){let t;return this.values_&&this.values_.hasOwnProperty(e)&&(t=this.values_[e]),t}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}getPropertiesInternal(){return this.values_}hasProperties(){return!!this.values_}notify(e,t){let n;n=`change:${e}`,this.hasListener(n)&&this.dispatchEvent(new mE(n,e,t)),n=yu.PROPERTYCHANGE,this.hasListener(n)&&this.dispatchEvent(new mE(n,e,t))}addChangeListener(e,t){this.addEventListener(`change:${e}`,t)}removeChangeListener(e,t){this.removeEventListener(`change:${e}`,t)}set(e,t,n){let r=this.values_||(this.values_={});if(n)r[e]=t;else{let s=r[e];r[e]=t,s!==t&&this.notify(e,s)}}setProperties(e,t){for(let n in e)this.set(n,e[n],t)}applyProperties(e){e.values_&&Object.assign(this.values_||(this.values_={}),e.values_)}unset(e,t){if(this.values_&&e in this.values_){let n=this.values_[e];delete this.values_[e],gu(this.values_)&&(this.values_=null),t||this.notify(e,n)}}},zs=nN;var iN=class extends zs{constructor(e){super(),this.projection=ks(e.projection),this.attributions_=bj(e.attributions),this.attributionsCollapsible_=e.attributionsCollapsible??!0,this.loading=!1,this.state_=e.state!==void 0?e.state:"ready",this.wrapX_=e.wrapX!==void 0?e.wrapX:!1,this.interpolate_=!!e.interpolate,this.viewResolver=null,this.viewRejector=null;let t=this;this.viewPromise_=new Promise(function(n,r){t.viewResolver=n,t.viewRejector=r})}getAttributions(){return this.attributions_}getAttributionsCollapsible(){return this.attributionsCollapsible_}getProjection(){return this.projection}getResolutions(e){return null}getView(){return this.viewPromise_}ready(){let e=this.getState();return e==="ready"?Promise.resolve():e==="error"?Promise.reject(new Error("Source failed to load")):new Promise((t,n)=>{let r=()=>{let s=this.getState();s==="ready"?(this.un("change",r),t()):s==="error"&&(this.un("change",r),n(new Error("Source failed to load")))};this.on("change",r)})}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(e){this.attributions_=bj(e),this.changed()}setState(e){this.state_=e,this.changed()}};function bj(i){return i?typeof i=="function"?i:(Array.isArray(i)||(i=[i]),e=>i):null}var AE=iN;var rN=class extends AE{constructor(e){super({attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,projection:e.projection,state:e.state,wrapX:e.wrapX,interpolate:e.interpolate}),this.on,this.once,this.un,this.tilePixelRatio_=e.tilePixelRatio!==void 0?e.tilePixelRatio:1,this.tileGrid=e.tileGrid!==void 0?e.tileGrid:null;let t=[256,256];this.tileGrid&&ls(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),t),this.tmpSize=[0,0],this.key_=e.key||Bn(this),this.tileOptions={transition:e.transition,interpolate:e.interpolate},this.zDirection=e.zDirection?e.zDirection:0}getGutterForProjection(e){return 0}getKey(){return this.key_}setKey(e){this.key_!==e&&(this.key_=e,this.changed())}getResolutions(e){let t=e?this.getTileGridForProjection(e):this.tileGrid;return t?t.getResolutions():null}getTile(e,t,n,r,s,o){return ei()}getTileGrid(){return this.tileGrid}getTileGridForProjection(e){return this.tileGrid?this.tileGrid:sE(e)}getTilePixelRatio(e){return this.tilePixelRatio_}getTilePixelSize(e,t,n){let r=this.getTileGridForProjection(n),s=this.getTilePixelRatio(t),o=ls(r.getTileSize(e),this.tmpSize);return s==1?o:zW(o,s,this.tmpSize)}getTileCoordForTileUrlFunction(e,t){let n=t!==void 0?t:this.getProjection(),r=t!==void 0?this.getTileGridForProjection(n):this.tileGrid||this.getTileGridForProjection(n);return this.getWrapX()&&n.isGlobal()&&(e=QW(r,e,n)),ZW(e,r)?e:null}clear(){}refresh(){this.clear(),super.refresh()}},gE=class extends Ao{constructor(e,t){super(e),this.tile=t}},wj=rN;var vE={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};var sN=class i extends wj{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tilePixelRatio:e.tilePixelRatio,wrapX:e.wrapX,transition:e.transition,interpolate:e.interpolate,key:e.key,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.generateTileUrlFunction_=this.tileUrlFunction===i.prototype.tileUrlFunction,this.tileLoadFunction=e.tileLoadFunction,e.tileUrlFunction&&(this.tileUrlFunction=e.tileUrlFunction),this.urls=null,e.urls?this.setUrls(e.urls):e.url&&this.setUrl(e.url),this.tileLoadingKeys_={}}getTileLoadFunction(){return this.tileLoadFunction}getTileUrlFunction(){return Object.getPrototypeOf(this).tileUrlFunction===this.tileUrlFunction?this.tileUrlFunction.bind(this):this.tileUrlFunction}getUrls(){return this.urls}handleTileChange(e){let t=e.target,n=Bn(t),r=t.getState(),s;r==an.LOADING?(this.tileLoadingKeys_[n]=!0,s=vE.TILELOADSTART):n in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[n],s=r==an.ERROR?vE.TILELOADERROR:r==an.LOADED?vE.TILELOADEND:void 0),s!=null&&this.dispatchEvent(new gE(s,t))}setTileLoadFunction(e){this.tileLoadFunction=e,this.changed()}setTileUrlFunction(e,t){this.tileUrlFunction=e,typeof t<"u"?this.setKey(t):this.changed()}setUrl(e){let t=xj(e);this.urls=t,this.setUrls(t)}setUrls(e){this.urls=e;let t=e.join(`3-`);this.generateTileUrlFunction_?this.setTileUrlFunction(yj(e,this.tileGrid),t):this.setKey(t)}tileUrlFunction(e,t,n){}},Sj=sN;var oN=class extends Sj{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:$de,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX,transition:e.transition,interpolate:e.interpolate!==void 0?e.interpolate:!0,key:e.key,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.crossOrigin=e.crossOrigin!==void 0?e.crossOrigin:null,this.referrerPolicy=e.referrerPolicy,this.tileClass=e.tileClass!==void 0?e.tileClass:uE,this.tileGridForProjection={},this.reprojectionErrorThreshold_=e.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(e){return this.getProjection()&&e&&!Q1(this.getProjection(),e)?0:this.getGutter()}getGutter(){return 0}getKey(){let e=super.getKey();return this.getInterpolate()||(e+=":disable-interpolation"),e}getTileGridForProjection(e){let t=this.getProjection();if(this.tileGrid&&(!t||Q1(t,e)))return this.tileGrid;let n=Bn(e);return n in this.tileGridForProjection||(this.tileGridForProjection[n]=sE(e)),this.tileGridForProjection[n]}createTile_(e,t,n,r,s,o){let a=[e,t,n],l=this.getTileCoordForTileUrlFunction(a,s),c=l?this.tileUrlFunction(l,r,s):void 0,u=new this.tileClass(a,c!==void 0?an.IDLE:an.EMPTY,c!==void 0?c:"",{crossOrigin:this.crossOrigin,referrerPolicy:this.referrerPolicy},this.tileLoadFunction,this.tileOptions);return u.key=o,u.addEventListener(nn.CHANGE,this.handleTileChange.bind(this)),u}getTile(e,t,n,r,s,o){let a=this.getProjection();if(!a||!s||Q1(a,s))return this.getTileInternal(e,t,n,r,a||s);let l=[e,t,n],c=this.getKey(),u=this.getTileGridForProjection(a),f=this.getTileGridForProjection(s),d=this.getTileCoordForTileUrlFunction(l,s),A=new dE(a,u,s,f,l,d,this.getTilePixelRatio(r),this.getGutter(),(y,w,S,T)=>this.getTileInternal(y,w,S,T,a,o),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return A.key=c,A}getTileInternal(e,t,n,r,s,o){let a=this.getKey(),l=nv(this,a,e,t,n);if(o&&o.containsKey(l))return o.get(l);let c=this.createTile_(e,t,n,r,s,a);return o?.set(l,c),c}setRenderReprojectionEdges(e){this.renderReprojectionEdges_!=e&&(this.renderReprojectionEdges_=e,this.changed())}setTileGridForProjection(e,t){let n=ks(e);if(n){let r=Bn(n);r in this.tileGridForProjection||(this.tileGridForProjection[r]=t)}}};function $de(i,e){if(io){let t=i.getCrossOrigin(),n="same-origin",r="same-origin";t==="anonymous"||t===""?(n="cors",r="omit"):t==="use-credentials"&&(n="cors",r="include");let s={mode:n,credentials:r,referrerPolicy:i.getReferrerPolicy()};fetch(e,s).then(o=>{if(!o.ok)throw new Error(`HTTP ${o.status}`);return o.blob()}).then(o=>createImageBitmap(o)).then(o=>{let a=i.getImage();a.width=o.width,a.height=o.height,a.getContext("2d").drawImage(o,0,0),o.close?.(),a.dispatchEvent(new Event("load"))}).catch(()=>{i.getImage().dispatchEvent(new Event("error"))});return}i.getImage().src=e}var Tj=oN;var aN=class extends Tj{constructor(e){e=e||{};let t=e.projection!==void 0?e.projection:"EPSG:3857",n=e.tileGrid!==void 0?e.tileGrid:JW({extent:oE(t),maxResolution:e.maxResolution,maxZoom:e.maxZoom,minZoom:e.minZoom,tileSize:e.tileSize});super({attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,referrerPolicy:e.referrerPolicy,interpolate:e.interpolate,projection:t,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileGrid:n,tileLoadFunction:e.tileLoadFunction,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX!==void 0?e.wrapX:!0,transition:e.transition,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.gutter_=e.gutter!==void 0?e.gutter:0}getGutter(){return this.gutter_}},Ej=aN;function Wl(){if(!O.world||!O.lens||O.settling)return;let i=O.engine?.getView();try{let e=Mj();e.last=O.volume.slug,e.volumes[O.volume.slug]={volume:O.volume.slug,world:O.world.slug,lens:O.world.lenses.indexOf(O.lens),center:i?.getCenter(),zoom:i?.getZoom(),hidden:[...O.hiddenCollections],collapsed:[...O.collapsedSections],expanded:[...O.expandedCollections],labels:[...O.labelOverrides],overviewDocked:O.overviewDocked,dockFolded:O.dockFolded,dockDismissed:O.dockDismissed},localStorage.setItem(RL,JSON.stringify(e))}catch{}}function Mj(){try{let i=JSON.parse(localStorage.getItem(RL)||"null");if(i&&i.volumes)return i}catch{}return{last:"",volumes:{}}}function av(i){let e=Mj(),t=i||e.last,n=t&&e.volumes[t];return n&&n.volume&&n.world?n:null}function lv(){let[i,e]=decodeURIComponent(location.hash.replace(/^#\/?/,"")).split("/").map(t=>t.trim());return{volume:i,world:e}}function Cj(){if(!O.volume||!O.world)return;let i=`#${O.volume.slug}/${O.world.slug}`;location.hash!==i&&history.replaceState(null,"",i)}var lN=class i extends zs{constructor(e){if(super(),this.on,this.once,this.un,this.id_=void 0,this.geometryName_="geometry",this.style_=null,this.styleFunction_=void 0,this.geometryChangeKey_=null,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),e)if(typeof e.getSimplifiedGeometry=="function"){let t=e;this.setGeometry(t)}else{let t=e;this.setProperties(t)}}clone(){let e=new i,t=this.geometryName_;e.setGeometryName(t);let n=this.getPropertiesInternal();if(n){let s=this.getGeometry();for(let o in n)o===t&&s?e.set(o,s.clone()):e.set(o,n[o],!0)}let r=this.getStyle();return r&&e.setStyle(r),e}getGeometry(){return this.get(this.geometryName_)}getId(){return this.id_}getGeometryName(){return this.geometryName_}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}handleGeometryChange_(){this.changed()}handleGeometryChanged_(){this.geometryChangeKey_&&(li(this.geometryChangeKey_),this.geometryChangeKey_=null);let e=this.getGeometry();e&&(this.geometryChangeKey_=qn(e,nn.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(e){this.set(this.geometryName_,e)}setStyle(e){this.style_=e,this.styleFunction_=e?Yde(e):void 0,this.changed()}setId(e){this.id_=e,this.changed()}setGeometryName(e){e!==this.geometryName_&&(this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=e,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_())}};function Yde(i){if(typeof i=="function")return i;let e;return Array.isArray(i)?e=i:(jn(typeof i.getZIndex=="function","Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),e=[i]),function(){return e}}var Lp=lN;function ml(i,e,t,n,r,s,o){s=s||[],o=o||2;let a=0;for(let l=e;l<t;l+=n){let c=i[l],u=i[l+1];s[a++]=r[0]*c+r[2]*u+r[4],s[a++]=r[1]*c+r[3]*u+r[5];for(let f=2;f<o;f++)s[a++]=i[l+f]}return s&&s.length!=a&&(s.length=a),s}function _E(i,e,t,n,r,s,o){o=o||[];let a=Math.cos(r),l=Math.sin(r),c=s[0],u=s[1],f=0;for(let d=e;d<t;d+=n){let A=i[d]-c,y=i[d+1]-u;o[f++]=c+A*a-y*l,o[f++]=u+A*l+y*a;for(let w=d+2;w<d+n;++w)o[f++]=i[w]}return o&&o.length!=f&&(o.length=f),o}function Rj(i,e,t,n,r,s,o,a){a=a||[];let l=o[0],c=o[1],u=0;for(let f=e;f<t;f+=n){let d=i[f]-l,A=i[f+1]-c;a[u++]=l+r*d,a[u++]=c+s*A;for(let y=f+2;y<f+n;++y)a[u++]=i[y]}return a&&a.length!=u&&(a.length=u),a}function Ij(i,e,t,n,r,s,o){o=o||[];let a=0;for(let l=e;l<t;l+=n){o[a++]=i[l]+r,o[a++]=i[l+1]+s;for(let c=l+2;c<l+n;++c)o[a++]=i[c]}return o&&o.length!=a&&(o.length=a),o}var Pj=go(),Zde=[NaN,NaN],cN=class extends zs{constructor(){super(),this.extent_=Wr(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=aE((e,t,n)=>{if(!n)return this.getSimplifiedGeometry(t);let r=this.clone();return r.applyTransform(n),r.getSimplifiedGeometry(t)})}simplifyTransformed(e,t){return this.simplifyTransformedInternal(this.getRevision(),e,t)}clone(){return ei()}closestPointXY(e,t,n,r){return ei()}containsXY(e,t){return this.closestPointXY(e,t,Zde,Number.MIN_VALUE)===0}getClosestPoint(e,t){return t=t||[NaN,NaN],this.closestPointXY(e[0],e[1],t,1/0),t}intersectsCoordinate(e){return this.containsXY(e[0],e[1])}computeExtent(e){return ei()}getExtent(e){if(this.extentRevision_!=this.getRevision()){let t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&Km(t),this.extentRevision_=this.getRevision()}return lW(this.extent_,e)}rotate(e,t){ei()}scale(e,t,n){ei()}simplify(e){return this.getSimplifiedGeometry(e*e)}getSimplifiedGeometry(e){return ei()}getType(){return ei()}applyTransform(e){ei()}intersectsExtent(e){return ei()}translate(e,t){ei()}transform(e,t){let n=ks(e),r=n.getUnits()=="tile-pixels"?function(s,o,a){let l=n.getExtent(),c=n.getWorldExtent(),u=Dr(c)/Dr(l);Do(Pj,c[0],c[3],u,-u,0,0,0);let f=ml(s,0,s.length,a,Pj,o),d=rA(n,t);return d?d(f,f,a):f}:rA(n,t);return this.applyTransform(r),this}},Lj=cN;var uN=class extends Lj{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(e){return q1(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinates(){return ei()}getFirstCoordinate(){return this.flatCoordinates.slice(0,this.stride)}getFlatCoordinates(){return this.flatCoordinates}getLastCoordinate(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)}getLayout(){return this.layout}getSimplifiedGeometry(e){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),e<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&e<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;let t=this.getSimplifiedGeometryInternal(e);return t.getFlatCoordinates().length<this.flatCoordinates.length?t:(this.simplifiedGeometryMaxMinSquaredTolerance=e,this)}getSimplifiedGeometryInternal(e){return this}getStride(){return this.stride}setFlatCoordinates(e,t){this.stride=Dj(e),this.layout=e,this.flatCoordinates=t}setCoordinates(e,t){ei()}setLayout(e,t,n){let r;if(e)r=Dj(e);else{for(let s=0;s<n;++s){if(t.length===0){this.layout="XY",this.stride=2;return}t=t[0]}r=t.length,e=Kde(r)}this.layout=e,this.stride=r}applyTransform(e){this.flatCoordinates&&(e(this.flatCoordinates,this.flatCoordinates,this.layout.startsWith("XYZ")?3:2,this.stride),this.changed())}rotate(e,t){let n=this.getFlatCoordinates();if(n){let r=this.getStride();_E(n,0,n.length,r,e,t,n),this.changed()}}scale(e,t,n){t===void 0&&(t=e),n||(n=dl(this.getExtent()));let r=this.getFlatCoordinates();if(r){let s=this.getStride();Rj(r,0,r.length,s,e,t,n,r),this.changed()}}translate(e,t){let n=this.getFlatCoordinates();if(n){let r=this.getStride();Ij(n,0,n.length,r,e,t,n),this.changed()}}};function Kde(i){let e;return i==2?e="XY":i==3?e="XYZ":i==4&&(e="XYZM"),e}function Dj(i){let e;return i=="XY"?e=2:i=="XYZ"||i=="XYM"?e=3:i=="XYZM"&&(e=4),e}function Nj(i,e,t){let n=i.getFlatCoordinates();if(!n)return null;let r=i.getStride();return ml(n,0,n.length,r,e,t)}var Al=uN;function Fj(i,e,t,n){for(let r=0,s=t.length;r<s;++r)i[e++]=t[r];return e}function hA(i,e,t,n){for(let r=0,s=t.length;r<s;++r){let o=t[r];for(let a=0;a<n;++a)i[e++]=o[a]}return e}function Py(i,e,t,n,r){r=r||[];let s=0;for(let o=0,a=t.length;o<a;++o){let l=hA(i,e,t[o],n);r[s++]=l,e=l}return r.length=s,r}function Bj(i,e,t,n,r){r=r||[];let s=0;for(let o=0,a=t.length;o<a;++o){let l=Py(i,e,t[o],n,r[s]);l.length===0&&(l[0]=e),r[s++]=l,e=l[l.length-1]}return r.length=s,r}var hN=class i extends Al{constructor(e,t){super(),this.setCoordinates(e,t)}clone(){let e=new i(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(e,t,n,r){let s=this.flatCoordinates,o=mu(e,t,s[0],s[1]);if(o<r){let a=this.stride;for(let l=0;l<a;++l)n[l]=s[l];return n.length=a,o}return r}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(e){return VT(this.flatCoordinates,e)}getType(){return"Point"}intersectsExtent(e){return yy(e,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(e,t){this.setLayout(t,e,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Fj(this.flatCoordinates,0,e,this.stride),this.changed()}},bu=hN;function fA(){return Rq[O.world?.iconOutset==="dark"?"dark":"light"]}function Qde(i){let e=O.world?.iconOutset==="dark",t=epe(i);return(e?t>.3:t<.88)?i:Jde(i,e?.74:.42)}function Jde(i,e){let t=String(i).replace("#","");if(t.length!==6)return i;let[n,r,s]=[0,2,4].map(P=>parseInt(t.slice(P,P+2),16)/255),o=Math.max(n,r,s),a=Math.min(n,r,s),l=(o+a)/2,c=0,u=o-a,f=u===0?0:u/(1-Math.abs(2*l-1));u!==0&&(o===n?c=(r-s)/u%6:o===r?c=(s-n)/u+2:c=(n-r)/u+4,c*=60,c<0&&(c+=360));let d=(1-Math.abs(2*e-1))*f,A=d*(1-Math.abs(c/60%2-1)),y=e-d/2,[w,S,T]=c<60?[d,A,0]:c<120?[A,d,0]:c<180?[0,d,A]:c<240?[0,A,d]:c<300?[A,0,d]:[d,0,A],R=P=>Math.round((P+y)*255).toString(16).padStart(2,"0");return`#${R(w)}${R(S)}${R(T)}`}function epe(i){let e=String(i).replace("#","");if(e.length!==6)return .5;let t=n=>parseInt(e.slice(n,n+2),16)/255;return .2126*t(0)+.7152*t(2)+.0722*t(4)}function cv(i){let e=Math.abs(Number(i)||0);return Wf[(Math.imul(e,2654435761)>>>0)%Wf.length]}function Dc(i,e){let t=String(i||"#ffffff").replace("#",""),n=t.length===3?t.split("").map(s=>s+s).join(""):t.slice(0,6).padEnd(6,"f"),r=Number.parseInt(n,16);return`rgba(${r>>16&255}, ${r>>8&255}, ${r&255}, ${e})`}function dA(i,e){i.style.setProperty("--pin-color",pA(e))}function pA(i){return Qde(i.color||cv(i.id))}function uv(i,e,t){if(i.classList.remove("has-source-icon"),i.style.removeProperty("--pin-icon"),i.textContent="",!e.iconAsset){i.textContent=t;return}i.style.setProperty("--pin-icon",`url("${fN(e.iconAsset)}")`),i.classList.add("has-source-icon")}function fN(i){let e=i.split("/").map(t=>encodeURIComponent(t)).join("/");return`${O.volume.base}/icons/${e}`}function wu(i){return i.split(/\s+/).slice(0,2).map(e=>e[0]||"").join("")}function Oj(i){return Math.imul(Number(i)||0,2654435761)>>>0}function dN(i){return String(i||"").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/[*_`>#]/g,"").replace(/\r/g,"").replace(/\n{3,}/g,`4-5-`).trim()}function nd(i){return new Intl.NumberFormat().format(i)}function cs(i,e,t){return Math.min(t,Math.max(e,i))}function xE(i){return i instanceof HTMLElement&&(i.matches("input, textarea, select")||i.isContentEditable)}var tpe=100;function id(){if(!ge.searchResults)return;let i=O.pins.filter(n=>!n.filteredHidden).sort((n,r)=>n.location.title.localeCompare(r.location.title)),e=i.slice(0,tpe),t=document.createDocumentFragment();if(!e.length){let n=document.createElement("p");n.className="search-empty",n.textContent=O.search?"No visible locations match.":"Nothing is enabled. Show a category to list its locations.",t.append(n)}for(let n of e){let r=document.createElement("button");r.type="button",r.className="search-result",O.selectedPin===n&&r.classList.add("is-selected"),r.dataset.location=String(n.location.id),dA(r,n.category);let s=document.createElement("span");s.className="result-dot",uv(s,n.category,wu(n.category.title));let o=document.createElement("span"),a=document.createElement("strong");a.textContent=n.location.title;let l=document.createElement("small");l.textContent=`${n.category.title} \xB7 ${n.group.title}`,o.append(a,l),r.append(s,o),t.append(r)}if(i.length>e.length){let n=document.createElement("p");n.className="dock-note",n.textContent=`First ${e.length} of ${nd(i.length)} \u2014 search or filter to narrow the list.`,t.append(n)}ge.searchResults.replaceChildren(t),ipe(i.length),npe()}var Uj=28;function npe(){let i=O.selectedPin?.location.title||"",e=i.length>Uj?`${i.slice(0,Uj-1).trimEnd()}\u2026`:i;ge.dockRailName.textContent=e?` \xB7 ${e}`:"",ge.dockRailName.hidden=!e}function ipe(i){ge.dockCount.textContent=`${nd(i)} ${i===1?"location":"locations"}`,O.search?(ge.dockFlag.textContent=`\u201C${O.search}\u201D`,ge.dockFlag.hidden=!1):O.hiddenCollections.size>0?(ge.dockFlag.textContent="filtered",ge.dockFlag.hidden=!1):ge.dockFlag.hidden=!0}function Ly(){!O.dockFolded||O.dockDismissed||yE(!1)}function pN(i){O.dockDismissed=i,yE(i)}function yE(i,e=!0){O.dockFolded=i,ge.dock.classList.toggle("is-folded",i),ge.dockFold.setAttribute("aria-expanded",String(!i));let t=i?"Bring the panel back (\u2318\u2325B)":"Put the panel away (\u2318\u2325B)";ge.dockFold.setAttribute("aria-label",t),ge.dockFold.setAttribute("title",t),e&&Wl()}function mN(i){O.hiddenCollections.delete(i.category.id),mA(),Nc(),Ah(),Dy(i,!0)}function Dy(i,e=!1){O.selectedPin=i,O.selectedZone=null,ge.detailCoordinatesField.hidden=!1,document.dispatchEvent(new Event("atlas:selection")),Fc(),O.layers.pins.changed(),O.layers.pinLabels.changed(),O.layers.text.changed(),O.layers.textDetail.changed(),O.layers.priority.changed(),ge.detailTitle.textContent=i.location.title,ge.detailCategory.textContent=`${i.group.title} / ${i.category.title}`,ge.detailDescription.textContent="",ge.detailLinks.hidden=!0,ope(i),ge.detailID.textContent=String(i.location.id),ge.detailCoordinates.textContent=`${i.location.lat.toFixed(6)}, ${i.location.lng.toFixed(6)}`;let t=Iq(i.coordinate);ge.detailCell.textContent=t,ge.detailCellField.hidden=!t;for(let r of ge.detail.querySelectorAll("[data-cell-system-row]"))r.remove();for(let r of xy(O.world)){if(r.slug==="geohash")continue;let s=r.locate(i.coordinate,O.world);if(!s)continue;let o=document.createElement("div");o.dataset.cellSystemRow=r.slug;let a=document.createElement("dt");a.textContent=s.label;let l=document.createElement("dd");l.textContent=s.value,o.append(a,l),ge.detailCellField.after(o)}let n=spe(i);if(ge.detailSource.textContent=n,ge.detailSourceField.hidden=!n,dA(ge.detailDot,i.category),uv(ge.detailDot,i.category,wu(i.category.title)),ge.detail.hidden=!1,Ly(),id(),e){let r=O.engine.getView();r.animate({center:i.coordinate,zoom:Math.min(gh(O.lens),Math.max(r.getZoom()||0,4)),duration:220})}}function kj(i){O.selectedPin=null,O.selectedZone=i,document.dispatchEvent(new Event("atlas:selection")),Fc(),O.layers.pins.changed(),O.layers.priority.changed(),O.layers.zoneTitles.changed(),O.layers.zoneTitleDetail.changed(),ge.detailTitle.textContent=i.title,ge.detailCategory.textContent=i.subtitle||"Zone",ge.detailDescription.textContent="",ge.detailLinks.hidden=!0,ge.detailLinks.replaceChildren(),ge.detailID.textContent=String(i.id),ge.detailCoordinatesField.hidden=!0,ge.detailCellField.hidden=!0;for(let t of ge.detail.querySelectorAll("[data-cell-system-row]"))t.remove();let e=O.world?.merged?.find(t=>t.origin)?.source||"";ge.detailSource.textContent=e,ge.detailSourceField.hidden=!e,ge.detailDot.textContent="",ge.detailDot.removeAttribute("style"),ge.detailDot.style.setProperty("background",cv(i.id)),i.hasText?rpe(i):ge.detailDescription.textContent="No description is included in the archive.",ge.detail.hidden=!1,Ly(),id()}async function rpe(i){let e=await AN();if(O.selectedZone!==i)return;let t=e[String(i.id)]||{};ge.detailDescription.textContent=dN(t.d)||"No description is included in the archive."}function spe(i){let e=O.world?.merged;if(!e?.length)return"";let t=e.find(n=>n.origin)?.source||"";if(O.pinSourceIndex?.world!==O.world){let n=new Map;for(let r of e){for(let s of r.adopted||[])n.set(s.d,r.source);for(let s of r.matched||[]){let o=`confirmed by ${r.source}`;n.set(s.w,t?`${t} \xB7 ${o}`:o)}}O.pinSourceIndex={world:O.world,byID:n}}for(let n of e)if(!n.origin&&i.group.title===n.source)return n.source;return O.pinSourceIndex.byID.get(i.location.id)||t}async function ope(i){let e=await AN();if(O.selectedPin!==i)return;let t=e[String(i.location.id)]||{};i.location.description=t.d||"",i.location.links=t.l||[],ge.detailDescription.textContent=dN(t.d)||"No description is included in the archive.",ape(i)}function ape(i){let e=(i.location.links||[]).filter(n=>O.pinByID.has(n.locationId));if(ge.detailLinks.hidden=e.length===0,!e.length){ge.detailLinks.replaceChildren();return}let t=document.createDocumentFragment();for(let n of e){let r=document.createElement("button");r.type="button",r.className="detail-link",r.dataset.location=String(n.locationId),r.textContent=n.title,t.append(r)}ge.detailLinks.replaceChildren(t)}function rd(){let i=O.selectedPin!==null||O.selectedZone!==null;O.selectedPin=null,O.selectedZone=null,document.dispatchEvent(new Event("atlas:selection")),O.sources&&(Fc(),O.layers.pins.changed(),O.layers.pinLabels.changed(),O.layers.text.changed(),O.layers.textDetail.changed(),O.layers.priority.changed(),O.layers.zoneTitles.changed(),O.layers.zoneTitleDetail.changed()),ge.detail.hidden=!0,i&&id()}function Bc(i,e,t,n,r){r=r!==void 0?r:[];let s=0;for(let o=e;o<t;o+=n)r[s++]=i.slice(o,o+n);return r.length=s,r}function Dp(i,e,t,n,r){r=r!==void 0?r:[];let s=0;for(let o=0,a=t.length;o<a;++o){let l=t[o];r[s++]=Bc(i,e,l,n,r[s]),e=l}return r.length=s,r}function Ny(i,e,t,n,r){r=r!==void 0?r:[];let s=0;for(let o=0,a=t.length;o<a;++o){let l=t[o];r[s++]=l.length===1&&l[0]===e?[]:Dp(i,e,l,n,r[s]),e=l[l.length-1]}return r.length=s,r}var gN=class i extends Al{constructor(e,t){super(),t&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendPoint(e){Lo(this.flatCoordinates,e.getFlatCoordinates()),this.changed()}clone(){let e=new i(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(e,t,n,r){if(r<Rc(this.getExtent(),e,t))return r;let s=this.flatCoordinates,o=this.stride;for(let a=0,l=s.length;a<l;a+=o){let c=mu(e,t,s[a],s[a+1]);if(c<r){r=c;for(let u=0;u<o;++u)n[u]=s[a+u];n.length=o}}return r}getCoordinates(){return Bc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(e){let t=this.flatCoordinates.length/this.stride;return e<0||t<=e?null:new bu(this.flatCoordinates.slice(e*this.stride,(e+1)*this.stride),this.layout)}getPoints(){let e=this.flatCoordinates,t=this.layout,n=this.stride,r=[];for(let s=0,o=e.length;s<o;s+=n){let a=new bu(e.slice(s,s+n),t);r.push(a)}return r}getType(){return"MultiPoint"}intersectsExtent(e){let t=this.flatCoordinates,n=this.stride;for(let r=0,s=t.length;r<s;r+=n){let o=t[r],a=t[r+1];if(yy(e,o,a))return!0}return!1}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=hA(this.flatCoordinates,0,e,this.stride),this.changed()}},zj=gN;function vN(i,e,t,n){let r=0,s=i[t-n],o=i[t-n+1],a=0,l=0;for(;e<t;e+=n){let c=i[e]-s,u=i[e+1]-o;r+=l*c-a*u,a=c,l=u}return r/2}function _N(i,e,t,n){let r=0;for(let s=0,o=t.length;s<o;++s){let a=t[s];r+=vN(i,e,a,n),e=a}return r}function Vj(i,e,t,n){let r=0;for(let s=0,o=t.length;s<o;++s){let a=t[s];r+=_N(i,e,a,n),e=a[a.length-1]}return r}function Gj(i,e,t,n,r,s,o){let a=i[e],l=i[e+1],c=i[t]-a,u=i[t+1]-l,f;if(c===0&&u===0)f=e;else{let d=((r-a)*c+(s-l)*u)/(c*c+u*u);if(d>1)f=t;else if(d>0){for(let A=0;A<n;++A)o[A]=Po(i[e+A],i[t+A],d);o.length=n;return}else f=e}for(let d=0;d<n;++d)o[d]=i[f+d];o.length=n}function Fy(i,e,t,n,r){let s=i[e],o=i[e+1];for(e+=n;e<t;e+=n){let a=i[e],l=i[e+1],c=mu(s,o,a,l);c>r&&(r=c),s=a,o=l}return r}function By(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];r=Fy(i,e,a,n,r),e=a}return r}function qj(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];r=By(i,e,a,n,r),e=a[a.length-1]}return r}function Oy(i,e,t,n,r,s,o,a,l,c,u){if(e==t)return c;let f,d;if(r===0){if(d=mu(o,a,i[e],i[e+1]),d<c){for(f=0;f<n;++f)l[f]=i[e+f];return l.length=n,d}return c}u=u||[NaN,NaN];let A=e+n;for(;A<t;)if(Gj(i,A-n,A,n,o,a,u),d=mu(o,a,u[0],u[1]),d<c){for(c=d,f=0;f<n;++f)l[f]=u[f];l.length=n,A+=n}else A+=n*Math.max((Math.sqrt(d)-Math.sqrt(c))/r|0,1);if(s&&(Gj(i,t-n,e,n,o,a,u),d=mu(o,a,u[0],u[1]),d<c)){for(c=d,f=0;f<n;++f)l[f]=u[f];l.length=n}return c}function Uy(i,e,t,n,r,s,o,a,l,c,u){u=u||[NaN,NaN];for(let f=0,d=t.length;f<d;++f){let A=t[f];c=Oy(i,e,A,n,r,s,o,a,l,c,u),e=A}return c}function Hj(i,e,t,n,r,s,o,a,l,c,u){u=u||[NaN,NaN];for(let f=0,d=t.length;f<d;++f){let A=t[f];c=Uy(i,e,A,n,r,s,o,a,l,c,u),e=A[A.length-1]}return c}function AA(i,e,t,n,r,s,o){let a=(t-e)/n;if(a<3){for(;e<t;e+=n)s[o++]=i[e],s[o++]=i[e+1];return o}let l=new Array(a);l[0]=1,l[a-1]=1;let c=[e,t-n],u=0;for(;c.length>0;){let f=c.pop(),d=c.pop(),A=0,y=i[d],w=i[d+1],S=i[f],T=i[f+1];for(let R=d+n;R<f;R+=n){let P=i[R],I=i[R+1],F=dW(P,I,y,w,S,T);F>A&&(u=R,A=F)}A>r&&(l[(u-e)/n]=1,d+n<u&&c.push(d,u),u+n<f&&c.push(u,f))}for(let f=0;f<a;++f)l[f]&&(s[o++]=i[e+f*n],s[o++]=i[e+f*n+1]);return o}function bE(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){let u=t[l];o=AA(i,e,u,n,r,s,o),a.push(o),e=u}return o}function Np(i,e){return e*Math.round(i/e)}function lpe(i,e,t,n,r,s,o){if(e==t)return o;let a=Np(i[e],r),l=Np(i[e+1],r);e+=n,s[o++]=a,s[o++]=l;let c,u;do if(c=Np(i[e],r),u=Np(i[e+1],r),e+=n,e==t)return s[o++]=c,s[o++]=u,o;while(c==a&&u==l);for(;e<t;){let f=Np(i[e],r),d=Np(i[e+1],r);if(e+=n,f==c&&d==u)continue;let A=c-a,y=u-l,w=f-a,S=d-l;if(A*S==y*w&&(A<0&&w<A||A==w||A>0&&w>A)&&(y<0&&S<y||y==S||y>0&&S>y)){c=f,u=d;continue}s[o++]=c,s[o++]=u,a=c,l=u,c=f,u=d}return s[o++]=c,s[o++]=u,o}function ky(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){let u=t[l];o=lpe(i,e,u,n,r,s,o),a.push(o),e=u}return o}function Wj(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){let u=t[l],f=[];o=ky(i,e,u,n,r,s,o,f),a.push(f),e=u[u.length-1]}return o}var xN=class i extends Al{constructor(e,t){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,t!==void 0&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}clone(){return new i(this.flatCoordinates.slice(),this.layout)}closestPointXY(e,t,n,r){return r<Rc(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Fy(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Oy(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,e,t,n,r))}getArea(){return vN(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return Bc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(e){let t=[];return t.length=AA(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,0),new i(t,"XY")}getType(){return"LinearRing"}intersectsExtent(e){return aA(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=hA(this.flatCoordinates,0,e,this.stride),this.changed()}},yN=xN;function zy(i,e,t,n,r,s,o){let a,l,c,u,f,d,A,y=r[s+1],w=[];for(let R=0,P=t.length;R<P;++R){let I=t[R];for(u=i[I-n],d=i[I-n+1],a=e;a<I;a+=n)f=i[a],A=i[a+1],(y<=d&&A<=y||d<=y&&y<=A)&&(c=(y-d)/(A-d)*(f-u)+u,w.push(c)),u=f,d=A}let S=NaN,T=-1/0;for(w.sort(pl),u=w[0],a=1,l=w.length;a<l;++a){f=w[a];let R=Math.abs(f-u);R>T&&(c=(u+f)/2,Cy(i,e,t,n,c,y)&&(S=c,T=R)),u=f}return isNaN(S)&&(S=r[s]),o?(o.push(S,y,T),o):[S,y,T]}function wE(i,e,t,n,r){let s=[];for(let o=0,a=t.length;o<a;++o){let l=t[o];s=zy(i,e,l,n,r,2*o,s),e=l[l.length-1]}return s}function jj(i,e,t,n){for(;e<t-n;){for(let r=0;r<n;++r){let s=i[e+r];i[e+r]=i[t-n+r],i[t-n+r]=s}e+=n,t-=n}}function bN(i,e,t,n){let r=0,s=i[t-n],o=i[t-n+1];for(;e<t;e+=n){let a=i[e],l=i[e+1];r+=(a-s)*(l+o),s=a,o=l}return r===0?void 0:r>0}function wN(i,e,t,n,r){r=r!==void 0?r:!1;for(let s=0,o=t.length;s<o;++s){let a=t[s],l=bN(i,e,a,n);if(s===0){if(r&&l||!r&&!l)return!1}else if(r&&!l||!r&&l)return!1;e=a}return!0}function Xj(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];if(!wN(i,e,a,n,r))return!1;a.length&&(e=a[a.length-1])}return!0}function SE(i,e,t,n,r){r=r!==void 0?r:!1;for(let s=0,o=t.length;s<o;++s){let a=t[s],l=bN(i,e,a,n);(s===0?r&&l||!r&&!l:r&&!l||!r&&l)&&jj(i,e,a,n),e=a}return e}function SN(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s)e=SE(i,e,t[s],n,r);return e}function $j(i,e){let t=[],n=0,r=0,s;for(let o=0,a=e.length;o<a;++o){let l=e[o],c=bN(i,n,l,2);if(s===void 0&&(s=c),c===s)t.push(e.slice(r,o+1));else{if(t.length===0)continue;t[t.length-1].push(e[r])}r=o+1,n=l}return t}var TE=class i extends Al{constructor(e,t,n){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,t!==void 0&&n?(this.setFlatCoordinates(t,e),this.ends_=n):this.setCoordinates(e,t)}appendLinearRing(e){this.flatCoordinates?Lo(this.flatCoordinates,e.getFlatCoordinates()):this.flatCoordinates=e.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){let e=new i(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return e.applyProperties(this),e}closestPointXY(e,t,n,r){return r<Rc(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(By(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Uy(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,e,t,n,r))}containsXY(e,t){return Cy(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,t)}getArea(){return _N(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(e){let t;return e!==void 0?(t=this.getOrientedFlatCoordinates().slice(),SE(t,0,this.ends_,this.stride,e)):t=this.flatCoordinates,Dp(t,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){let e=dl(this.getExtent());this.flatInteriorPoint_=zy(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new bu(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(e){return e<0||this.ends_.length<=e?null:new yN(this.flatCoordinates.slice(e===0?0:this.ends_[e-1],this.ends_[e]),this.layout)}getLinearRings(){let e=this.layout,t=this.flatCoordinates,n=this.ends_,r=[],s=0;for(let o=0,a=n.length;o<a;++o){let l=n[o],c=new yN(t.slice(s,l),e);r.push(c),s=l}return r}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let e=this.flatCoordinates;wN(e,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=SE(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){let t=[],n=[];return t.length=ky(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(e),t,0,n),new i(t,"XY",n)}getType(){return"Polygon"}intersectsExtent(e){return zD(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||(this.flatCoordinates=[]);let n=Py(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=n.length===0?0:n[n.length-1],this.changed()}},vh=TE;function TN(i){if(dh(i))throw new Error("Cannot create polygon from empty extent");let e=i[0],t=i[1],n=i[2],r=i[3],s=[e,t,e,r,n,r,n,t,e,t];return new TE(s,"XY",[s.length])}function EE(i,e,t,n){let r=[],s=Wr();for(let o=0,a=t.length;o<a;++o){let l=t[o];s=q1(i,e,l[0],n),r.push((s[0]+s[2])/2,(s[1]+s[3])/2),e=l[l.length-1]}return r}var EN=class i extends Al{constructor(e,t,n){if(super(),this.endss_=[],this.flatInteriorPointsRevision_=-1,this.flatInteriorPoints_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,!n&&!Array.isArray(e[0])){let r=e,s=[],o=[];for(let a=0,l=r.length;a<l;++a){let c=r[a],u=s.length,f=c.getEnds();for(let d=0,A=f.length;d<A;++d)f[d]+=u;Lo(s,c.getFlatCoordinates()),o.push(f)}t=r.length===0?this.getLayout():r[0].getLayout(),e=s,n=o}t!==void 0&&n?(this.setFlatCoordinates(t,e),this.endss_=n):this.setCoordinates(e,t)}appendPolygon(e){let t;if(!this.flatCoordinates)this.flatCoordinates=e.getFlatCoordinates().slice(),t=e.getEnds().slice(),this.endss_.push();else{let n=this.flatCoordinates.length;Lo(this.flatCoordinates,e.getFlatCoordinates()),t=e.getEnds().slice();for(let r=0,s=t.length;r<s;++r)t[r]+=n}this.endss_.push(t),this.changed()}clone(){let e=this.endss_.length,t=new Array(e);for(let r=0;r<e;++r)t[r]=this.endss_[r].slice();let n=new i(this.flatCoordinates.slice(),this.layout,t);return n.applyProperties(this),n}closestPointXY(e,t,n,r){return r<Rc(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(qj(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Hj(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,e,t,n,r))}containsXY(e,t){return jW(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e,t)}getArea(){return Vj(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(e){let t;return e!==void 0?(t=this.getOrientedFlatCoordinates().slice(),SN(t,0,this.endss_,this.stride,e)):t=this.flatCoordinates,Ny(t,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){let e=EE(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=wE(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new zj(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let e=this.flatCoordinates;Xj(e,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=SN(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){let t=[],n=[];return t.length=Wj(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(e),t,0,n),new i(t,"XY",n)}getPolygon(e){if(e<0||this.endss_.length<=e)return null;let t;if(e===0)t=0;else{let s=this.endss_[e-1];t=s[s.length-1]}let n=this.endss_[e].slice(),r=n[n.length-1];if(t!==0)for(let s=0,o=n.length;s<o;++s)n[s]-=t;return new vh(this.flatCoordinates.slice(t,r),this.layout,n)}getPolygons(){let e=this.layout,t=this.flatCoordinates,n=this.endss_,r=[],s=0;for(let o=0,a=n.length;o<a;++o){let l=n[o].slice(),c=l[l.length-1];if(s!==0)for(let f=0,d=l.length;f<d;++f)l[f]-=s;let u=new vh(t.slice(s,c),e,l);r.push(u),s=c}return r}getType(){return"MultiPolygon"}intersectsExtent(e){return $W(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,3),this.flatCoordinates||(this.flatCoordinates=[]);let n=Bj(this.flatCoordinates,0,e,this.stride,this.endss_);if(n.length===0)this.flatCoordinates.length=0;else{let r=n[n.length-1];this.flatCoordinates.length=r.length===0?0:r[r.length-1]}this.changed()}},ME=EN;function Yj(i){return i.key.toLocaleLowerCase()==="g"?(i.preventDefault(),Zj(),O.gridEnabled?(ge.gridInput.focus(),ge.gridInput.select()):ge.viewport.focus({preventScroll:!0}),!0):i.key===" "&&O.gridEnabled&&i.target!==ge.subgridToggle?(i.preventDefault(),Vy(!O.subgridVisible),!0):i.key==="Escape"&&O.gridEnabled?(i.preventDefault(),MN(),!0):!1}function Zj(i=!O.gridEnabled){O.gridEnabled=i,i&&Vy(!0),Gy(),Fc(),O.layers.pins.changed(),O.layers.text.changed(),O.layers.priority.changed()}function Vy(i){O.subgridVisible=i,O.layers.grid.changed(),O.layers.gridContext.changed(),ge.subgridToggle.setAttribute("aria-pressed",String(i)),ge.subgridToggle.setAttribute("aria-label",i?"Hide the subgrid":"Show the subgrid"),Kj(),document.dispatchEvent(new Event("atlas:grid"))}function Kj(){if(!O.gridEnabled){ge.gridHint.textContent="G \xB7 grid off";return}ge.gridHint.textContent=`G-${O.gridCell||"root"}`+(O.subgridVisible?"":" no subgrid")}function gA(i){let e=Ts(),t=e.parseInput(e.normalizeInput(i));if(t===null)return;let n=t!==O.gridCell;O.gridCell=t,O.gridEnabled||(O.gridEnabled=!0),Gy(),Fc(),O.layers.pins.changed(),O.layers.text.changed(),O.layers.priority.changed(),n&&(rd(),O.engine.getView().fit(RN(),{size:O.engine.getSize(),padding:[52,52,52,52],maxZoom:gh(O.lens),duration:180}))}function MN(){if(O.gridEnabled){if(!O.gridCell){Zj(!1);return}gA(Ts().parent(O.gridCell))}}function Gy(){if(O.sources){if(O.sources.grid.clear(),O.sources.gridContext.clear(),ge.gridNavigator.hidden=!O.gridEnabled,Kj(),cpe(),O.gridEnabled&&O.lens){let i=Ts();ge.gridInput.maxLength=i.inputLength(O.world),ge.gridInput.value=O.gridCell,ge.gridBack.title=O.gridCell?`Back one ${i.slug} level`:`Close ${i.slug} grid`;for(let e of IE())dpe(e)}document.dispatchEvent(new Event("atlas:grid"))}}function cpe(){let i=xy(O.world),e=Ts();if(ge.gridSystemName.textContent=e.name,ge.gridSystem.hidden=i.length<2,i.length<2)return;let t=i[(i.indexOf(e)+1)%i.length];ge.gridSystem.textContent=e.short,ge.gridSystem.title=`Dividing by ${e.name} \xB7 \u2318G for ${t.name}`,ge.gridSystem.setAttribute("aria-label",`Cell system: ${e.name}. Switch to ${t.name}`)}function CN(){let i=xy(O.world);if(i.length<2)return;let e=i.indexOf(Ts());upe(i[(e+1)%i.length].slug)}function upe(i){if(i===O.gridSystem)return;let e=Ts(),t=O.gridCell;O.gridSystem=i,O.gridCell=t?sW(e,Ts(),t,O.world):"",Gy(),Fc(),O.layers.pins.changed(),O.layers.text.changed(),O.layers.priority.changed()}function hpe(i){return Wf[Ts().colorKey(i)]}function RE(i,{subgridVisible:e,labelled:t}){let{role:n,contextDistance:r}=i;if(n==="child"&&(!t||!e))return null;let s=hpe(i.hash),o=n==="leaf"||n==="scope",a=n==="scope"&&e,l={color:o?Vi.lineWhite:s,opacity:n==="neighbor"?Vi.neighborLineAlpha:n==="child"?Vi.childLineAlpha:1,widthPx:a?Vi.widths.scopeBare:Vi.widths[n]},c=null;n==="neighbor"?c={color:Vi.dimColor,opacity:Math.min(Vi.dimCap,Vi.dimBase+r*Vi.dimStep)}:n==="leaf"?c={color:s,opacity:Vi.leafFillAlpha}:n==="child"&&(c={color:s,opacity:Vi.childFillAlpha});let u=null;if(t&&!a){let{context:f,principal:d}=Ts().label(i.hash);u={prefix:f,final:d,color:o?Vi.lineWhite:s,textAlpha:n==="neighbor"?Vi.neighborTextAlpha:1,chip:n==="neighbor"?Vi.neighborChip:Vi.chip,sizePx:n==="neighbor"?Vi.neighborLabelSizePx:Vi.labelSizePx}}return{line:l,fill:c,label:u,bare:a}}function IE(){let i=Ts(),e=[],t=fpe(i,O.gridCell);for(let n=0;n<t.length-1;n++){let r=t[n+1];for(let s of i.children(t[n]))s!==r&&e.push(CE(i,s,"neighbor",t.length-1-n))}if(O.gridCell&&i.level(O.gridCell)>=i.maxLevel(O.world))return e.push(CE(i,O.gridCell,"leaf",0)),e;O.gridCell&&e.push(CE(i,O.gridCell,"scope",0));for(let n of i.children(O.gridCell))e.push(CE(i,n,"child",0));return e}function fpe(i,e){let t=[e],n=e;for(;n;)n=i.parent(n),t.unshift(n);return t}function CE(i,e,t,n){return{hash:e,extent:i.bbox(e),ring:i.ring(e),pole:i.poleContained(e),childIndex:i.childIndex(e),role:t,contextDistance:n}}function dpe(i){let e=Ts(),t=O.pins.filter(s=>!s.filteredHidden&&e.contains(i.hash,s.coordinate)).length,n=new Lp({geometry:ppe(i),gridCell:{hash:i.hash,extent:i.extent,role:i.role,count:t,contextDistance:i.contextDistance},priority:i.role==="neighbor"?-i.contextDistance*100+i.childIndex:i.childIndex});(i.role==="neighbor"?O.sources.gridContext:O.sources.grid).addFeature(n)}function ppe(i){let e=jf(),t=i.ring;if(i.pole){let o=i.pole==="north"?e[3]:e[1];t=[...t,[t[t.length-1][0],o],[t[0][0],o],t[0]]}if(t.every(([o])=>o>=e[0]&&o<=e[2]))return new vh([t]);let r=e[2]-e[0],s=[];for(let o of[0,-r,r]){let a=oW(t.map(([l,c])=>[l+o,c]),e[0],e[2]);a.length>=4&&s.push([a])}return new ME(s)}function RN(){return Ts().bbox(O.gridCell)}function Qj(){return Ts().maxLevel(O.world)}function Fp(i){return!O.gridEnabled||!O.gridCell?!1:Ts().contains(O.gridCell,i.coordinate)}var LE=[NaN,NaN,NaN,0],IN;function mpe(){return IN||(IN=Di(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),IN}var Ape=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,gpe=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,vpe=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,_pe=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function PE(i,e){return i.endsWith("%")?Number(i.substring(0,i.length-1))/e:Number(i)}function Hy(i){throw new Error('failed to parse "'+i+'" as color')}function Jj(i){if(i.toLowerCase().startsWith("rgb")){let s=i.match(gpe)||i.match(Ape)||i.match(vpe);if(s){let o=s[4],a=100/255;return[Si(PE(s[1],a)+.5|0,0,255),Si(PE(s[2],a)+.5|0,0,255),Si(PE(s[3],a)+.5|0,0,255),o!==void 0?Si(PE(o,100),0,1):1]}Hy(i)}if(i.startsWith("#")){if(_pe.test(i)){let s=i.substring(1),o=s.length<=4?1:2,a=[0,0,0,255];for(let l=0,c=s.length;l<c;l+=o){let u=parseInt(s.substring(l,l+o),16);o===1&&(u+=u<<4),a[l/o]=u}return a[3]=a[3]/255,a}Hy(i)}let e=mpe();e.fillStyle="#abcdef";let t=e.fillStyle;e.fillStyle=i,e.fillStyle===t&&(e.fillStyle="#fedcba",t=e.fillStyle,e.fillStyle=i,e.fillStyle===t&&Hy(i));let n=e.fillStyle;if(n.startsWith("#")||n.startsWith("rgba"))return Jj(n);e.clearRect(0,0,1,1),e.fillRect(0,0,1,1);let r=Array.from(e.getImageData(0,0,1,1).data);return r[3]=eA(r[3]/255,3),r}function eX(i){return typeof i=="string"?i:jy(i)}var xpe=1024,qy={},PN=0;function tX(i){if(i.length===4)return i;let e=i.slice();return e[3]=1,e}function LN(i){return i>.0031308?Math.pow(i,1/2.4)*269.025-14.025:i*3294.6}function DN(i){return i>.2068965?Math.pow(i,3):(i-4/29)*(108/841)}function NN(i){return i>10.314724?Math.pow((i+14.025)/269.025,2.4):i/3294.6}function FN(i){return i>.0088564?Math.pow(i,1/3):i/(108/841)+4/29}function BN(i){let e=NN(i[0]),t=NN(i[1]),n=NN(i[2]),r=FN(e*.222488403+t*.716873169+n*.06060791),s=500*(FN(e*.452247074+t*.399439023+n*.148375274)-r),o=200*(r-FN(e*.016863605+t*.117638439+n*.865350722)),a=Math.atan2(o,s)*(180/Math.PI);return[116*r-16,Math.sqrt(s*s+o*o),a<0?a+360:a,i[3]]}function nX(i){let e=(i[0]+16)/116,t=i[1],n=i[2]*Math.PI/180,r=DN(e),s=DN(e+t/500*Math.cos(n)),o=DN(e-t/200*Math.sin(n)),a=LN(s*3.021973625-r*1.617392459-o*.404875592),l=LN(s*-.943766287+r*1.916279586+o*.027607165),c=LN(s*.069407491-r*.22898585+o*1.159737864);return[Si(a+.5|0,0,255),Si(l+.5|0,0,255),Si(c+.5|0,0,255),i[3]]}function Wy(i){if(i==="none")return LE;if(qy.hasOwnProperty(i))return qy[i];if(PN>=xpe){let t=0;for(let n in qy)(t++&3)===0&&(delete qy[n],--PN)}let e=Jj(i);e.length!==4&&Hy(i);for(let t of e)isNaN(t)&&Hy(i);return qy[i]=e,++PN,e}function Oc(i){return Array.isArray(i)?i:Wy(i)}function jy(i){let e=i[0];e!=(e|0)&&(e=e+.5|0);let t=i[1];t!=(t|0)&&(t=t+.5|0);let n=i[2];n!=(n|0)&&(n=n+.5|0);let r=i[3]===void 0?1:Math.round(i[3]*1e3)/1e3;return"rgba("+e+","+t+","+n+","+r+")"}var UN=class{constructor(){this.cache_={},this.patternCache_={},this.cacheSize_=0,this.maxCacheSize_=1024}clear(){this.cache_={},this.patternCache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let e=0;for(let t in this.cache_){let n=this.cache_[t];(e++&3)===0&&!n.hasListener()&&(delete this.cache_[t],delete this.patternCache_[t],--this.cacheSize_)}}}get(e,t){let n=ON(e,t);return n in this.cache_?this.cache_[n]:null}getPattern(e,t){let n=ON(e,t);return n in this.patternCache_?this.patternCache_[n]:null}set(e,t,n,r){let s=ON(e,t),o=s in this.cache_;this.cache_[s]=n,r&&(n.getImageState()===In.IDLE&&n.load(),n.getImageState()===In.LOADING?n.ready().then(()=>{this.patternCache_[s]=Iy().createPattern(n.getImage(1),"repeat")}):this.patternCache_[s]=Iy().createPattern(n.getImage(1),"repeat")),o||++this.cacheSize_}setSize(e){this.maxCacheSize_=e,this.expire()}};function ON(i,e){let t=e?Oc(e):"null";return i+":"+t}var ta=new UN;var Xy=null,DE=class extends Pp{constructor(e,t,n,r,s){super(),this.hitDetectionImage_=null,this.image_=e,this.crossOrigin_=n?.crossOrigin,this.referrerPolicy_=n?.referrerPolicy,this.canvas_={},this.color_=s,this.imageState_=r===void 0?In.IDLE:r,this.size_=e&&e.width&&e.height?[e.width,e.height]:null,this.src_=t,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)}isTainted_(){if(this.tainted_===void 0&&this.imageState_===In.LOADED){Xy||(Xy=Di(1,1,void 0,{willReadFrequently:!0})),Xy.drawImage(this.image_,0,0);try{Xy.getImageData(0,0,1,1),this.tainted_=!1}catch{Xy=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(nn.CHANGE)}handleImageError_(){this.imageState_=In.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=In.LOADED,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(e){return this.image_||this.initializeImage_(),this.replaceColor_(e),this.canvas_[e]?this.canvas_[e]:this.image_}setImage(e){this.image_=e}getPixelRatio(e){return this.replaceColor_(e),this.canvas_[e]?e:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){let e=this.size_[0],t=this.size_[1],n=Di(e,t);n.fillRect(0,0,e,t),this.hitDetectionImage_=n.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===In.IDLE){this.image_||this.initializeImage_(),this.imageState_=In.LOADING;try{this.src_!==void 0&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&sj(this.image_,this.src_).then(e=>{this.image_=e,this.handleImageLoad_()}).catch(this.handleImageError_.bind(this))}}replaceColor_(e){if(!this.color_||this.canvas_[e]||this.imageState_!==In.LOADED)return;let t=this.image_,n=Di(Math.ceil(t.width*e),Math.ceil(t.height*e)),r=n.canvas;n.scale(e,e),n.drawImage(t,0,0),n.globalCompositeOperation="multiply",n.fillStyle=eX(this.color_),n.fillRect(0,0,r.width/e,r.height/e),n.globalCompositeOperation="destination-in",n.drawImage(t,0,0),this.canvas_[e]=r}ready(){return this.ready_||(this.ready_=new Promise(e=>{if(this.imageState_===In.LOADED||this.imageState_===In.ERROR)e();else{let t=()=>{(this.imageState_===In.LOADED||this.imageState_===In.ERROR)&&(this.removeEventListener(nn.CHANGE,t),e())};this.addEventListener(nn.CHANGE,t)}})),this.ready_}};function Bp(i,e,t,n,r,s){let o=e===void 0?void 0:ta.get(e,r);return o||(o=new DE(i,i&&"src"in i?i.src||void 0:e,t,n,r),ta.set(e,r,o,s)),s&&o&&!ta.getPattern(e,r)&&ta.set(e,r,o,s),o}var iX=DE;function gl(i){return i?Array.isArray(i)?jy(i):typeof i=="object"&&"src"in i?ype(i):i:null}function ype(i){if(!i.offset||!i.size)return ta.getPattern(i.src,i.color);let e=i.src+":"+i.offset,t=ta.getPattern(e,i.color);if(t)return t;let n=ta.get(i.src,null);if(n.getImageState()!==In.LOADED)return null;let r=Di(i.size[0],i.size[1]);return r.drawImage(n.getImage(1),i.offset[0],i.offset[1],i.size[0],i.size[1],0,0,i.size[0],i.size[1]),Bp(r.canvas,e,void 0,In.LOADED,i.color,!0),ta.getPattern(e,i.color)}var $y="ol-hidden";var Op="ol-unselectable";var hv="ol-control",kN="ol-collapsed",bpe=new RegExp(["^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)","(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?","(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))","(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))",`?\\s*([-,\\"\\'\\sa-z0-9]+?)\\s*$`].join(""),"i"),rX=["style","variant","weight","size","lineHeight","family"],NE={normal:400,bold:700},FE=function(i){let e=i.match(bpe);if(!e)return null;let t={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let n=0,r=rX.length;n<r;++n){let s=e[n+1];s!==void 0&&(t[rX[n]]=typeof s=="string"?s.trim():s)}return isNaN(Number(t.weight))&&t.weight in NE&&(t.weight=NE[t.weight]),t.families=t.family.split(/,\s?/).map(n=>n.trim().replace(/^['"]|['"]$/g,"")),t};var BE="10px sans-serif",ro="#000",_h="round",vl=[],_l=0,xh="round",sd=10,oX=0,na="#000",Up="center",_A="middle",od=[0,0,0,0],ad=1,vA=new zs,Yy=null,sX,zN={},wpe=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function Spe(i,e,t){return`${i} ${e} 16px "${t}"`}var aX=(function(){let e,t;async function n(s){await t.ready;let o=FE(s),a=o.families[0].toLowerCase(),l=o.weight,c=[];return t.forEach(f=>{let d=f.family.replace(/^['"]|['"]$/g,"").toLowerCase(),A=NE[f.weight]||f.weight;d===a&&f.style===o.style&&A==l&&c.push(f)}),c.length===0?!1:(await Promise.all(c.map(f=>f.load().then(()=>!0,()=>!1)))).some(f=>f)}async function r(){await t.ready;let s=!0,o=vA.getProperties(),a=Object.keys(o).filter(l=>o[l]<100);for(let l=a.length-1;l>=0;--l){let c=a[l],u=o[c];u<100&&(await n(c)?(mh(zN),vA.set(c,100)):(u+=10,vA.set(c,u,!0),u<100&&(s=!1)))}e=void 0,s||(e=setTimeout(r,100))}return async function(s){t||(t=io?self.fonts:document.fonts);let o=FE(s);if(!o)return;let a=o.families,l=!1;for(let c of a){if(wpe.has(c))continue;let u=Spe(o.style,o.weight,c);vA.get(u)===void 0&&(vA.set(u,0,!0),l=!0)}l&&(clearTimeout(e),e=setTimeout(r,100))}})(),Tpe=(function(){let i;return function(e){let t=zN[e];if(t==null){if(io){let n=FE(e),r=lX(e,"\u017Dg");t=(isNaN(Number(n.lineHeight))?1.2:Number(n.lineHeight))*(r.actualBoundingBoxAscent+r.actualBoundingBoxDescent)}else i||(i=document.createElement("div"),i.innerHTML="M",i.style.minHeight="0",i.style.maxHeight="none",i.style.height="auto",i.style.padding="0",i.style.border="none",i.style.position="absolute",i.style.display="block",i.style.left="-99999px"),i.style.font=e,document.body.appendChild(i),t=i.offsetHeight,document.body.removeChild(i);zN[e]=t}return t}})();function lX(i,e){return Yy||(Yy=Di(1,1)),i!=sX&&(Yy.font=i,sX=Yy.font),Yy.measureText(e)}function cX(i,e){return lX(i,e).width}function VN(i,e,t){if(e in t)return t[e];let n=e.split(`6-`).reduce((r,s)=>Math.max(r,cX(i,s)),0);return t[e]=n,n}function uX(i,e){let t=[],n=[],r=[],s=0,o=0,a=0,l=0;for(let c=0,u=e.length;c<=u;c+=2){let f=e[c];if(f===`7-`||c===u){s=Math.max(s,o),r.push(o),o=0,a+=l,l=0;continue}let d=e[c+1]||i.font,A=cX(d,f);t.push(A),o+=A;let y=Tpe(d);n.push(y),l=Math.max(l,y)}return{width:s,height:a,widths:t,heights:n,lineWidths:r}}function hX(i,e,t,n,r,s,o,a,l,c,u){i.save(),t!==1&&(i.globalAlpha===void 0?i.globalAlpha=f=>f.globalAlpha*=t:i.globalAlpha*=t),e&&i.transform.apply(i,e),n.contextInstructions?(i.translate(l,c),i.scale(u[0],u[1]),Epe(n,i)):u[0]<0||u[1]<0?(i.translate(l,c),i.scale(u[0],u[1]),i.drawImage(n,r,s,o,a,0,0,o,a)):i.drawImage(n,r,s,o,a,l,c,o*u[0],a*u[1]),i.restore()}function Epe(i,e){let t=i.contextInstructions;for(let n=0,r=t.length;n<r;n+=2)Array.isArray(t[n+1])?e[t[n]].apply(e,t[n+1]):e[t[n]]=t[n+1]}var GN=class i{constructor(e){this.opacity_=e.opacity,this.rotateWithView_=e.rotateWithView,this.rotation_=e.rotation,this.scale_=e.scale,this.scaleArray_=ls(e.scale),this.displacement_=e.displacement,this.declutterMode_=e.declutterMode}clone(){let e=this.getScale();return new i({opacity:this.getOpacity(),scale:Array.isArray(e)?e.slice():e,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getOpacity(){return this.opacity_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getDisplacement(){return this.displacement_}getDeclutterMode(){return this.declutterMode_}getAnchor(){return ei()}getImage(e){return ei()}getHitDetectionImage(){return ei()}getPixelRatio(e){return 1}getImageState(){return ei()}getImageSize(){return ei()}getOrigin(){return ei()}getSize(){return ei()}setDisplacement(e){this.displacement_=e}setOpacity(e){this.opacity_=e}setRotateWithView(e){this.rotateWithView_=e}setRotation(e){this.rotation_=e}setScale(e){this.scale_=e,this.scaleArray_=ls(e)}listenImageChange(e){ei()}load(){ei()}unlistenImageChange(e){ei()}ready(){return Promise.resolve()}},OE=GN;var qN=class i extends OE{constructor(e){super({opacity:1,rotateWithView:e.rotateWithView!==void 0?e.rotateWithView:!1,rotation:e.rotation!==void 0?e.rotation:0,scale:e.scale!==void 0?e.scale:1,displacement:e.displacement!==void 0?e.displacement:[0,0],declutterMode:e.declutterMode}),this.hitDetectionCanvas_=null,this.fill_=e.fill!==void 0?e.fill:null,this.origin_=[0,0],this.points_=e.points,this.radius=e.radius,this.radius2_=e.radius2,this.angle_=e.angle!==void 0?e.angle:0,this.stroke_=e.stroke!==void 0?e.stroke:null,this.size_,this.renderOptions_,this.imageState_=this.fill_&&this.fill_.loading()?In.LOADING:In.LOADED,this.imageState_===In.LOADING&&this.ready().then(()=>this.imageState_=In.LOADED),this.render()}clone(){let e=this.getScale(),t=new i({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(e)?e.slice():e,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return t.setOpacity(this.getOpacity()),t}getAnchor(){let e=this.size_,t=this.getDisplacement(),n=this.getScaleArray();return[e[0]/2-t[0]/n[0],e[1]/2+t[1]/n[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(e){this.fill_=e,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(e){let t=this.fill_?.getKey(),n=`${e},${this.angle_},${this.radius},${this.radius2_},${this.points_},${t}`+Object.values(this.renderOptions_).join(","),r=ta.get(n,null)?.getImage(1);if(!r){let s=this.renderOptions_,o=Math.ceil(s.size*e),a=Di(o,o);this.draw_(s,a,e),r=a.canvas;let l=new iX(r,void 0,null,In.LOADED,null);ta.set(n,null,l),createImageBitmap(r).then(c=>{l.setImage(c)})}return r}getPixelRatio(e){return e}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius}setRadius(e){this.radius!==e&&(this.radius=e,this.render())}getRadius2(){return this.radius2_}setRadius2(e){this.radius2_!==e&&(this.radius2_=e,this.render())}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(e){this.stroke_=e,this.render()}listenImageChange(e){}load(){}unlistenImageChange(e){}calculateLineJoinSize_(e,t,n){if(t===0||this.points_===1/0||e!=="bevel"&&e!=="miter")return t;let r=this.radius,s=this.radius2_===void 0?r:this.radius2_;if(r<s){let D=r;r=s,s=D}let o=this.radius2_===void 0?this.points_:this.points_*2,a=2*Math.PI/o,l=s*Math.sin(a),c=Math.sqrt(s*s-l*l),u=r-c,f=Math.sqrt(l*l+u*u),d=f/l;if(e==="miter"&&d<=n)return d*t;let A=t/2/d,y=t/2*(u/f),S=Math.sqrt((r+A)*(r+A)+y*y)-r;if(this.radius2_===void 0||e==="bevel")return S*2;let T=r*Math.sin(a),R=Math.sqrt(r*r-T*T),P=s-R,F=Math.sqrt(T*T+P*P)/T;if(F<=n){let D=F*t/2-s-r;return 2*Math.max(S,D)}return S*2}createRenderOptions(){let e=_h,t=xh,n=0,r=null,s=0,o,a=0;this.stroke_&&(o=gl(this.stroke_.getColor()??na),a=this.stroke_.getWidth()??ad,r=this.stroke_.getLineDash(),s=this.stroke_.getLineDashOffset()??0,t=this.stroke_.getLineJoin()??xh,e=this.stroke_.getLineCap()??_h,n=this.stroke_.getMiterLimit()??sd);let l=this.calculateLineJoinSize_(t,a,n),c=Math.max(this.radius,this.radius2_||0),u=Math.ceil(2*c+l);return{strokeStyle:o,strokeWidth:a,size:u,lineCap:e,lineDash:r,lineDashOffset:s,lineJoin:t,miterLimit:n}}render(){this.renderOptions_=this.createRenderOptions();let e=this.renderOptions_.size;this.hitDetectionCanvas_=null,this.size_=[e,e]}draw_(e,t,n){if(t.scale(n,n),t.translate(e.size/2,e.size/2),this.createPath_(t),this.fill_){let r=this.fill_.getColor();r===null&&(r=ro),t.fillStyle=gl(r),t.fill()}e.strokeStyle&&(t.strokeStyle=e.strokeStyle,t.lineWidth=e.strokeWidth,e.lineDash&&(t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset),t.lineCap=e.lineCap,t.lineJoin=e.lineJoin,t.miterLimit=e.miterLimit,t.stroke())}createHitDetectionCanvas_(e){let t;if(this.fill_){let n=this.fill_.getColor(),r=0;typeof n=="string"&&(n=Oc(n)),n===null?r=1:Array.isArray(n)&&(r=n.length===4?n[3]:1),r===0&&(t=Di(e.size,e.size),this.drawHitDetectionCanvas_(e,t))}return t?t.canvas:this.getImage(1)}createPath_(e){let t=this.points_,n=this.radius;if(t===1/0)e.arc(0,0,n,0,2*Math.PI);else{let r=this.radius2_===void 0?n:this.radius2_;this.radius2_!==void 0&&(t*=2);let s=this.angle_-Math.PI/2,o=2*Math.PI/t;for(let a=0;a<t;a++){let l=s+a*o,c=a%2===0?n:r;e.lineTo(c*Math.cos(l),c*Math.sin(l))}e.closePath()}}drawHitDetectionCanvas_(e,t){t.translate(e.size/2,e.size/2),this.createPath_(t),t.fillStyle=ro,t.fill(),e.strokeStyle&&(t.strokeStyle=e.strokeStyle,t.lineWidth=e.strokeWidth,e.lineDash&&(t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset),t.lineJoin=e.lineJoin,t.miterLimit=e.miterLimit,t.stroke())}ready(){return this.fill_?this.fill_.ready():Promise.resolve()}},UE=qN;var HN=class i extends UE{constructor(e){e=e||{radius:5},super({points:1/0,fill:e.fill,radius:e.radius,stroke:e.stroke,scale:e.scale!==void 0?e.scale:1,rotation:e.rotation!==void 0?e.rotation:0,rotateWithView:e.rotateWithView!==void 0?e.rotateWithView:!1,displacement:e.displacement!==void 0?e.displacement:[0,0],declutterMode:e.declutterMode})}clone(){let e=this.getScale(),t=new i({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),scale:Array.isArray(e)?e.slice():e,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return t.setOpacity(this.getOpacity()),t}},kE=HN;var WN=class i{constructor(e){e=e||{},this.patternImage_=null,this.color_=null,e.color!==void 0&&this.setColor(e.color)}clone(){let e=this.getColor();return new i({color:Array.isArray(e)?e.slice():e||void 0})}getColor(){return this.color_}setColor(e){if(e!==null&&typeof e=="object"&&"src"in e){let t=Bp(null,e.src,{crossOrigin:"anonymous"},void 0,e.offset?null:e.color?e.color:null,!(e.offset&&e.size));t.ready().then(()=>{this.patternImage_=null}),t.getImageState()===In.IDLE&&t.load(),t.getImageState()===In.LOADING&&(this.patternImage_=t)}this.color_=e}getKey(){let e=this.getColor();return e?e instanceof CanvasPattern||e instanceof CanvasGradient?Bn(e):typeof e=="object"&&"src"in e?e.src+":"+e.offset:Oc(e).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}},us=WN;function fX(i,e,t,n){return t!==void 0&&n!==void 0?[t/i,n/e]:t!==void 0?t/i:n!==void 0?n/e:1}var jN=class i extends OE{constructor(e){e=e||{};let t=e.opacity!==void 0?e.opacity:1,n=e.rotation!==void 0?e.rotation:0,r=e.scale!==void 0?e.scale:1,s=e.rotateWithView!==void 0?e.rotateWithView:!1;super({opacity:t,rotation:n,scale:r,displacement:e.displacement!==void 0?e.displacement:[0,0],rotateWithView:s,declutterMode:e.declutterMode}),this.anchor_=e.anchor!==void 0?e.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=e.anchorOrigin!==void 0?e.anchorOrigin:"top-left",this.anchorXUnits_=e.anchorXUnits!==void 0?e.anchorXUnits:"fraction",this.anchorYUnits_=e.anchorYUnits!==void 0?e.anchorYUnits:"fraction",this.crossOrigin_=e.crossOrigin!==void 0?e.crossOrigin:null,this.referrerPolicy_=e.referrerPolicy;let o=e.img!==void 0?e.img:null,a=e.src;jn(!(a!==void 0&&o),"`image` and `src` cannot be provided at the same time"),(a===void 0||a.length===0)&&o&&(a=o.src||Bn(o)),jn(a!==void 0&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),jn(!((e.width!==void 0||e.height!==void 0)&&e.scale!==void 0),"`width` or `height` cannot be provided together with `scale`");let l;if(e.src!==void 0?l=In.IDLE:o!==void 0&&("complete"in o?o.complete?l=o.src?In.LOADED:In.IDLE:l=In.LOADING:l=In.LOADED),this.color_=e.color!==void 0?Oc(e.color):null,this.iconImage_=Bp(o,a,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},l,this.color_),this.offset_=e.offset!==void 0?e.offset:[0,0],this.offsetOrigin_=e.offsetOrigin!==void 0?e.offsetOrigin:"top-left",this.origin_=null,this.size_=e.size!==void 0?e.size:null,this.initialOptions_,e.width!==void 0||e.height!==void 0){let c,u;if(e.size)[c,u]=e.size;else{let f=this.getImage(1);if(f.width&&f.height)c=f.width,u=f.height;else if(f instanceof HTMLImageElement){this.initialOptions_=e;let d=()=>{if(this.unlistenImageChange(d),!this.initialOptions_)return;let A=this.iconImage_.getSize();this.setScale(fX(A[0],A[1],e.width,e.height))};this.listenImageChange(d);return}}c!==void 0&&this.setScale(fX(c,u,e.width,e.height))}}clone(){let e,t,n;return this.initialOptions_?(t=this.initialOptions_.width,n=this.initialOptions_.height):(e=this.getScale(),e=Array.isArray(e)?e.slice():e),new i({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:e,width:t,height:n,size:this.size_!==null?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let e=this.normalizedAnchor_;if(!e){e=this.anchor_;let r=this.getSize();if(this.anchorXUnits_=="fraction"||this.anchorYUnits_=="fraction"){if(!r)return null;e=this.anchor_.slice(),this.anchorXUnits_=="fraction"&&(e[0]*=r[0]),this.anchorYUnits_=="fraction"&&(e[1]*=r[1])}if(this.anchorOrigin_!="top-left"){if(!r)return null;e===this.anchor_&&(e=this.anchor_.slice()),(this.anchorOrigin_=="top-right"||this.anchorOrigin_=="bottom-right")&&(e[0]=-e[0]+r[0]),(this.anchorOrigin_=="bottom-left"||this.anchorOrigin_=="bottom-right")&&(e[1]=-e[1]+r[1])}this.normalizedAnchor_=e}let t=this.getDisplacement(),n=this.getScaleArray();return[e[0]-t[0]/n[0],e[1]+t[1]/n[1]]}setAnchor(e){this.anchor_=e,this.normalizedAnchor_=null}getColor(){return this.color_}setColor(e){let t=e?Oc(e):null;if(this.color_===t||this.color_&&t&&this.color_.length===t.length&&this.color_.every((o,a)=>o===t[a]))return;this.color_=t;let n=this.getSrc(),r=n!==void 0?null:this.getHitDetectionImage(),s=n!==void 0?In.IDLE:this.iconImage_.getImageState();this.iconImage_=Bp(r,n,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},s,this.color_)}getImage(e){return this.iconImage_.getImage(e)}getPixelRatio(e){return this.iconImage_.getPixelRatio(e)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let e=this.offset_;if(this.offsetOrigin_!="top-left"){let t=this.getSize(),n=this.iconImage_.getSize();if(!t||!n)return null;e=e.slice(),(this.offsetOrigin_=="top-right"||this.offsetOrigin_=="bottom-right")&&(e[0]=n[0]-t[0]-e[0]),(this.offsetOrigin_=="bottom-left"||this.offsetOrigin_=="bottom-right")&&(e[1]=n[1]-t[1]-e[1])}return this.origin_=e,this.origin_}getSrc(){return this.iconImage_.getSrc()}setSrc(e){this.iconImage_=Bp(null,e,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},In.IDLE,this.color_)}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){let e=this.getScaleArray();if(this.size_)return this.size_[0]*e[0];if(this.iconImage_.getImageState()==In.LOADED)return this.iconImage_.getSize()[0]*e[0]}getHeight(){let e=this.getScaleArray();if(this.size_)return this.size_[1]*e[1];if(this.iconImage_.getImageState()==In.LOADED)return this.iconImage_.getSize()[1]*e[1]}setScale(e){delete this.initialOptions_,super.setScale(e)}listenImageChange(e){this.iconImage_.addEventListener(nn.CHANGE,e)}load(){this.iconImage_.load()}unlistenImageChange(e){this.iconImage_.removeEventListener(nn.CHANGE,e)}ready(){return this.iconImage_.ready()}},xA=jN;var XN=class i{constructor(e){e=e||{},this.color_=e.color!==void 0?e.color:null,this.lineCap_=e.lineCap,this.lineDash_=e.lineDash!==void 0?e.lineDash:null,this.lineDashOffset_=e.lineDashOffset,this.lineJoin_=e.lineJoin,this.miterLimit_=e.miterLimit,this.offset_=e.offset,this.width_=e.width}clone(){let e=this.getColor();return new i({color:Array.isArray(e)?e.slice():e||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),offset:this.getOffset(),width:this.getWidth()})}getColor(){return this.color_}getLineCap(){return this.lineCap_}getLineDash(){return this.lineDash_}getLineDashOffset(){return this.lineDashOffset_}getLineJoin(){return this.lineJoin_}getMiterLimit(){return this.miterLimit_}getOffset(){return this.offset_}getWidth(){return this.width_}setColor(e){this.color_=e}setLineCap(e){this.lineCap_=e}setLineDash(e){this.lineDash_=e}setLineDashOffset(e){this.lineDashOffset_=e}setLineJoin(e){this.lineJoin_=e}setMiterLimit(e){this.miterLimit_=e}setOffset(e){this.offset_=e}setWidth(e){this.width_=e}},Es=XN;var zE=class i{constructor(e){e=e||{},this.geometry_=null,this.geometryFunction_=dX,e.geometry!==void 0&&this.setGeometry(e.geometry),this.fill_=e.fill!==void 0?e.fill:null,this.image_=e.image!==void 0?e.image:null,this.renderer_=e.renderer!==void 0?e.renderer:null,this.hitDetectionRenderer_=e.hitDetectionRenderer!==void 0?e.hitDetectionRenderer:null,this.stroke_=e.stroke!==void 0?e.stroke:null,this.text_=e.text!==void 0?e.text:null,this.zIndex_=e.zIndex}clone(){let e=this.getGeometry();return e&&typeof e=="object"&&(e=e.clone()),new i({geometry:e??void 0,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer()??void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})}getRenderer(){return this.renderer_}setRenderer(e){this.renderer_=e}setHitDetectionRenderer(e){this.hitDetectionRenderer_=e}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(e){this.fill_=e}getImage(){return this.image_}setImage(e){this.image_=e}getStroke(){return this.stroke_}setStroke(e){this.stroke_=e}getText(){return this.text_}setText(e){this.text_=e}getZIndex(){return this.zIndex_}setGeometry(e){typeof e=="function"?this.geometryFunction_=e:typeof e=="string"?this.geometryFunction_=function(t){return t.get(e)}:e?e!==void 0&&(this.geometryFunction_=function(){return e}):this.geometryFunction_=dX,this.geometry_=e}setZIndex(e){this.zIndex_=e}};function pX(i){let e;if(typeof i=="function")e=i;else{let t;Array.isArray(i)?t=i:(jn(typeof i.getZIndex=="function","Expected an `Style` or an array of `Style`"),t=[i]),e=function(){return t}}return e}var $N=null;function YN(i,e){if(!$N){let t=new us({color:"rgba(255,255,255,0.4)"}),n=new Es({color:"#3399CC",width:1.25});$N=[new zE({image:new kE({fill:t,stroke:n,radius:5}),fill:t,stroke:n})]}return $N}function dX(i){return i.getGeometry()}var Nr=zE;var Mpe="#333",ZN=class i{constructor(e){e=e||{},this.font_=e.font,this.rotation_=e.rotation,this.rotateWithView_=e.rotateWithView,this.keepUpright_=e.keepUpright,this.scale_=e.scale,this.scaleArray_=ls(e.scale!==void 0?e.scale:1),this.text_=e.text,this.textAlign_=e.textAlign,this.justify_=e.justify,this.repeat_=e.repeat,this.textBaseline_=e.textBaseline,this.fill_=e.fill!==void 0?e.fill:new us({color:Mpe}),this.maxAngle_=e.maxAngle!==void 0?e.maxAngle:Math.PI/4,this.placement_=e.placement!==void 0?e.placement:"point",this.overflow_=!!e.overflow,this.stroke_=e.stroke!==void 0?e.stroke:null,this.offsetX_=e.offsetX!==void 0?e.offsetX:0,this.offsetY_=e.offsetY!==void 0?e.offsetY:0,this.backgroundFill_=e.backgroundFill?e.backgroundFill:null,this.backgroundStroke_=e.backgroundStroke?e.backgroundStroke:null,this.padding_=e.padding===void 0?null:e.padding,this.declutterMode_=e.declutterMode}clone(){let e=this.getScale();return new i({font:this.getFont(),placement:this.getPlacement(),repeat:this.getRepeat(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),keepUpright:this.getKeepUpright(),scale:Array.isArray(e)?e.slice():e,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()instanceof us?this.getFill().clone():this.getFill(),stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()||void 0,declutterMode:this.getDeclutterMode()})}getOverflow(){return this.overflow_}getFont(){return this.font_}getMaxAngle(){return this.maxAngle_}getPlacement(){return this.placement_}getRepeat(){return this.repeat_}getOffsetX(){return this.offsetX_}getOffsetY(){return this.offsetY_}getFill(){return this.fill_}getRotateWithView(){return this.rotateWithView_}getKeepUpright(){return this.keepUpright_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getStroke(){return this.stroke_}getText(){return this.text_}getTextAlign(){return this.textAlign_}getJustify(){return this.justify_}getTextBaseline(){return this.textBaseline_}getBackgroundFill(){return this.backgroundFill_}getBackgroundStroke(){return this.backgroundStroke_}getPadding(){return this.padding_}getDeclutterMode(){return this.declutterMode_}setOverflow(e){this.overflow_=e}setFont(e){this.font_=e}setMaxAngle(e){this.maxAngle_=e}setOffsetX(e){this.offsetX_=e}setOffsetY(e){this.offsetY_=e}setPlacement(e){this.placement_=e}setRepeat(e){this.repeat_=e}setRotateWithView(e){this.rotateWithView_=e}setKeepUpright(e){this.keepUpright_=e}setFill(e){this.fill_=e}setRotation(e){this.rotation_=e}setScale(e){this.scale_=e,this.scaleArray_=ls(e!==void 0?e:1)}setStroke(e){this.stroke_=e}setText(e){this.text_=e}setTextAlign(e){this.textAlign_=e}setJustify(e){this.justify_=e}setTextBaseline(e){this.textBaseline_=e}setBackgroundFill(e){this.backgroundFill_=e}setBackgroundStroke(e){this.backgroundStroke_=e}setPadding(e){this.padding_=e}},ld=ZN;function Uc(i,e){return(i.get("priority")||0)-(e.get("priority")||0)}function gX(i){let e=i.get("pin");return!e||kc(e)||e.passesZoneFilters||fv(e)?null:QN(e,!1)}function vX(i){let e=i.get("pin");return!e||!O.highlightedZones.size||!e.passesZoneFilters||kc(e)||fv(e)?null:QN(e,!1)}function _X(i){let e=i.get("pin");return!e||kc(e)||!O.labelsHeld?null:SX(e)}function xX(i){let e=i.get("pin");if(!e||kc(e)||e.passesZoneFilters||fv(e)||Qy())return null;if(O.labelsHeld)return Zy(e,!1);let t=O.fitZoom+Math.log2(LX(e.category));return(O.engine.getView().getZoom()||0)<t?null:Zy(e,!1)}function yX(i){let e=i.get("pin");return!e||kc(e)||e.passesZoneFilters||fv(e)||!Qy()?null:Zy(e,!1)}function bX(i){let e=i.get("pin");return!e||!O.highlightedZones.size||!e.passesZoneFilters||kc(e)||fv(e)?null:Zy(e,!1)}function wX(i){let e=i.get("pin");if(!e||kc(e))return null;if(ch(e.category)==="text")return Zy(e,e===O.selectedPin);let t=QN(e,e===O.selectedPin);return e===O.hoveredPin||e===O.selectedPin?[t,SX(e)]:t}function QN(i,e){let t=`marker:${i.category.id}:${e?1:0}`;if(O.styleCache.has(t))return O.styleCache.get(t);let n=pA(i.category),r=e?2e7:i.priority,s=O.markerIcons.get(Ky(i.category)),o;return s?o=new Nr({image:new xA({src:s,width:e?36:31,height:e?36:31}),zIndex:r}):o=new Nr({text:new ld({text:wu(i.category.title),font:`900 ${e?15:13}px Inter, sans-serif`,fill:new us({color:n}),stroke:new Es({color:fA(),width:e?4:3})}),zIndex:r}),O.styleCache.set(t,o),o}function SX(i){let e=`marker-label:${i.location.id}`;if(O.styleCache.has(e))return O.styleCache.get(e);let t=new Nr({text:new ld({text:i.location.title,offsetY:21,font:'700 10px "Arial Narrow", "Roboto Condensed", sans-serif',fill:new us({color:"#f2ece0"}),stroke:new Es({color:"rgba(0,0,0,0.98)",width:3}),backgroundFill:new us({color:"rgba(10,12,17,0.72)"}),padding:[2,4,2,4],overflow:!0}),zIndex:i.priority});return O.styleCache.set(e,t),t}function TX(i){if(!i.iconAsset)return;let e=Ky(i);if(O.markerIcons.has(e))return;O.markerIcons.set(e,null);let t=new Image;t.onload=()=>{let n=document.createElement("canvas");n.width=64,n.height=64;let r=n.getContext("2d"),s=pA(i),o=document.createElement("canvas");o.width=64,o.height=64;let a=o.getContext("2d");a.imageSmoothingEnabled=!i.iconPicture,a.drawImage(t,6,6,52,52),i.iconPicture||(a.globalCompositeOperation="source-in",a.fillStyle=s,a.fillRect(0,0,64,64));let l=document.createElement("canvas");l.width=64,l.height=64;let c=l.getContext("2d");c.drawImage(t,6,6,52,52),c.globalCompositeOperation="source-in",c.fillStyle=fA(),c.fillRect(0,0,64,64);for(let u=-3;u<=3;u++)for(let f=-3;f<=3;f++)f*f+u*u<=10&&r.drawImage(l,f,u);r.drawImage(o,0,0),O.markerIcons.set(e,n.toDataURL("image/png")),Cpe(),O.layers.pins.changed(),O.layers.zonePins.changed(),O.layers.priority.changed()},t.onerror=()=>O.markerIcons.set(e,!1),t.src=fN(i.iconAsset)}function Cpe(){for(let i of O.styleCache.keys())i.startsWith("marker:")&&O.styleCache.delete(i)}function Ky(i){return`${i.iconAsset||""}:${pA(i)}:${O.world?.iconOutset||"light"}`}function Zy(i,e){let t=`text:${i.location.id}:${e?1:0}`;if(O.styleCache.has(t))return O.styleCache.get(t);let r=[new Nr({text:new ld({text:i.location.title,font:`${e?"900":"800"} 14px "Arial Narrow", "Roboto Condensed", sans-serif`,fill:new us({color:e?"#7fd0ea":"#f2ece0"}),stroke:new Es({color:"rgba(0,0,0,0.95)",width:4}),backgroundFill:new us({color:e?"rgba(13,16,23,0.9)":"rgba(10,12,17,0.58)"}),backgroundStroke:e?new Es({color:"#3aa5c9",width:1}):void 0,padding:[3,6,3,6],overflow:!0}),zIndex:e?2e7:i.priority+3e6})];return O.styleCache.set(t,r),r}function VE(i,e){return`${i} ${e}px ${Vi.labelFont}`}function JN(i,e){let t=i.get("gridCell");if(!t)return null;let n=t.role==="neighbor",r=n?Vi.neighborLabelSizePx:Vi.labelSizePx,s=VE(900,r),o=n?[2,4,2,4]:[3,5,3,5],a=Ipe(t,s,r,o,e),l=RE(t,{subgridVisible:O.subgridVisible,labelled:a});if(!l)return null;let c=`grid:${O.gridSystem}:${t.hash}:${t.role}:${t.contextDistance}:${a?1:0}:${l.bare?1:0}`;if(O.styleCache.has(c))return O.styleCache.get(c);let u=t.role==="leaf"||t.role==="scope"?100:i.get("priority"),f=[new Nr({fill:l.fill?new us({color:Dc(l.fill.color,l.fill.opacity)}):void 0,stroke:new Es({color:Dc(l.line.color,l.line.opacity),width:l.line.widthPx}),zIndex:u})];if(l.label){let d=l.label.prefix?[l.label.prefix,VE(500,r),l.label.final,VE(900,r)]:l.label.final,A=Vi.labelInsetPx*e,y=Rpe(i.getGeometry());y&&f.push(new Nr({geometry:new bu([y[0]-A,y[1]+A]),text:new ld({text:d,font:VE(900,r),textAlign:"right",textBaseline:"bottom",fill:new us({color:Dc(l.label.color,l.label.textAlpha)}),backgroundFill:new us({color:l.label.chip}),padding:o,overflow:!0}),zIndex:u+1}))}return O.styleCache.set(c,f),f}function Rpe(i){let e=i.getType()==="MultiPolygon"?i.getCoordinates():[i.getCoordinates()],t=null;for(let n of e)for(let[r,s]of n[0]||[])(!t||r-s>t[0]-t[1])&&(t=[r,s]);return t}function Ipe(i,e,t,n,r){if(!r)return!0;let s=e5(i.hash,e)+n[1]+n[3],o=t+n[0]+n[2];return s<=(i.extent[2]-i.extent[0])/r&&o<=(i.extent[3]-i.extent[1])/r}var mX=document.createElement("canvas").getContext("2d"),AX=new Map;function e5(i,e){let t=`${e}|${i}`,n=AX.get(t);return n===void 0&&(mX.font=e,n=mX.measureText(i).width,AX.set(t,n)),n}var Ppe=new Nr({fill:new us({color:"rgba(5, 8, 16, 0.62)"})});function EX(){return fl("zones")?null:Ppe}function MX(i,e){let t=i.get("zone");if(fl(lh(t)))return null;let n=i.get("child"),r=O.highlightedZones.has(t.id),s=PX(t.id),o=Number(t.attrs?.["atlas.stroke.width_px"])||0;if(o>0&&i.getGeometry()?.getType()==="MultiLineString")return Lpe(t,i.get("color"),o/e,r,s);let a=`zone:${t.id}:${n?1:0}:${r?1:s?2:0}`;if(O.styleCache.has(a))return O.styleCache.get(a);let l=i.get("color");if(s){let f=new Nr({stroke:new Es({color:Dc(l,n?.34:.44),width:n?1:1.3,lineDash:n?[3,4]:[7,5]}),zIndex:n?101:100});return O.styleCache.set(a,f),f}let c=new Nr({fill:new us({color:Dc(l,n?.035:.07)}),stroke:new Es({color:Dc(l,n?.5:.72),width:n?1.2:1.8,lineDash:n?[3,4]:[7,5]})});if(!r)return O.styleCache.set(a,c),c;let u=[new Nr({stroke:new Es({color:"rgba(255,255,255,0.94)",width:5}),zIndex:9e3}),new Nr({fill:new us({color:Dc(l,.22)}),stroke:new Es({color:l,width:2.6}),zIndex:9001})];return O.styleCache.set(a,u),u}function Lpe(i,e,t,n,r){let s=Math.max(t,1.5);return n?[new Nr({stroke:new Es({color:"rgba(255,255,255,0.94)",width:s+4,lineCap:"round",lineJoin:"round"}),zIndex:9e3}),new Nr({stroke:new Es({color:Dc(e,.9),width:s,lineCap:"round",lineJoin:"round"}),zIndex:9001})]:[new Nr({stroke:new Es({color:Dc(e,r?.14:.3),width:s,lineCap:"round",lineJoin:"round"})}),new Nr({stroke:new Es({color:Dc(e,r?.4:.8),width:Math.min(1.6,s),lineDash:[7,5]})})]}function CX(i){if(Qy())return null;let e=i.get("zone");if(fl(lh(e))||IX(e))return null;let t=O.highlightedZones.has(e.id);if(Zf(e)==="quiet")return KN(i);let n=i.get("child"),r=O.engine.getView().getZoom()||0;if(!t&&n&&r<O.fitZoom+3)return null;let s=i.get("span")/O.engine.getView().getResolution();return!t&&O.zoneTitleCount>40&&s<52?null:KN(i)}function RX(i){if(!Qy())return null;let e=i.get("zone");return fl(lh(e))||IX(e)?null:KN(i)}function IX(i){return Zf(i)!=="quiet"?!1:!O.highlightedZones.has(i.id)&&O.selectedZone!==i&&!O.labelsHeld}function KN(i){let e=i.get("child"),t=i.get("zone"),n=O.highlightedZones.has(t.id),r=PX(t.id),s=`zone-title:${t.id}:${e?1:0}:${n?1:r?2:0}`;if(O.styleCache.has(s))return O.styleCache.get(s);let o=i.get("color"),a=new Nr({text:new ld({text:t.title.toLocaleUpperCase(),font:`${e?"700 12px":"800 14px"} "Arial Narrow", "Roboto Condensed", sans-serif`,fill:new us({color:n?"#10131a":r?"rgba(196,191,177,0.56)":e?"#c8c2b4":"#f2ece0"}),stroke:new Es({color:n?"rgba(255,255,255,0.96)":r?"rgba(0,0,0,0.82)":"rgba(0,0,0,0.95)",width:n?2:r?3:4}),backgroundFill:new us({color:n?o:r?"rgba(8,11,18,0.84)":"rgba(13,16,23,0.72)"}),backgroundStroke:new Es({color:n?"#ffffff":Dc(o,r?.24:.55),width:n?2:1}),padding:[5,8,5,8],overflow:!0}),zIndex:n?91e5:i.get("priority")});return O.styleCache.set(s,a),a}function PX(i){if(!O.highlightedZones.size||O.highlightedZones.has(i))return!1;for(let e of O.highlightedZones)if(Dpe(i,e))return!1;return!0}function Dpe(i,e){let t=new Set,n=O.zoneRecords.get(e)?.zone.parentRegionId;for(;n!=null&&!t.has(n);){if(n===i)return!0;t.add(n),n=O.zoneRecords.get(n)?.zone.parentRegionId}return!1}function yA(i,e,t,n,r,s,o){let a,l,c=(t-e)/n;if(c===1)a=e;else if(c===2)a=e,l=r;else if(c!==0){let u=i[e],f=i[e+1],d=0,A=[0];for(let S=e+n;S<t;S+=n){let T=i[S],R=i[S+1];d+=Math.sqrt((T-u)*(T-u)+(R-f)*(R-f)),A.push(d),u=T,f=R}let y=r*d,w=VW(A,y);w<0?(l=(y-A[-w-2])/(A[-w-1]-A[-w-2]),a=e+(-w-2)*n):a=e+w*n}o=o>1?o:2,s=s||new Array(o);for(let u=0;u<o;++u)s[u]=a===void 0?NaN:l===void 0?i[a+u]:Po(i[a+u],i[a+n+u],l);return s}function GE(i,e,t,n,r,s){if(t==e)return null;let o;if(r<i[e+n-1])return s?(o=i.slice(e,e+n),o[n-1]=r,o):null;if(i[t-1]<r)return s?(o=i.slice(t-n,t),o[n-1]=r,o):null;if(r==i[e+n-1])return i.slice(e,e+n);let a=e/n,l=t/n;for(;a<l;){let d=a+l>>1;r<i[(d+1)*n-1]?l=d:a=d+1}let c=i[a*n-1];if(r==c)return i.slice((a-1)*n,(a-1)*n+n);let u=i[(a+1)*n-1],f=(r-c)/(u-c);o=[];for(let d=0;d<n-1;++d)o.push(Po(i[(a-1)*n+d],i[a*n+d],f));return o.push(r),o}function DX(i,e,t,n,r,s,o){if(o)return GE(i,e,t[t.length-1],n,r,s);let a;if(r<i[n-1])return s?(a=i.slice(0,n),a[n-1]=r,a):null;if(i[i.length-1]<r)return s?(a=i.slice(i.length-n),a[n-1]=r,a):null;for(let l=0,c=t.length;l<c;++l){let u=t[l];if(e!=u){if(r<i[e+n-1])return null;if(r<=i[u-1])return GE(i,e,u,n,r,!1);e=u}}return null}function dv(i,e,t,n){let r=i[e],s=i[e+1],o=0;for(let a=e+n;a<t;a+=n){let l=i[a],c=i[a+1];o+=Math.sqrt((l-r)*(l-r)+(c-s)*(c-s)),r=l,s=c}return o}var t5=class i extends Al{constructor(e,t){super(),this.flatMidpoint_=null,this.flatMidpointRevision_=-1,this.maxDelta_=-1,this.maxDeltaRevision_=-1,t!==void 0&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendCoordinate(e){Lo(this.flatCoordinates,e),this.changed()}clone(){let e=new i(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(e,t,n,r){return r<Rc(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Fy(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Oy(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,e,t,n,r))}forEachSegment(e){return rE(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinateAtM(e,t){return this.layout!="XYM"&&this.layout!="XYZM"?null:(t=t!==void 0?t:!1,GE(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t))}getCoordinates(){return Bc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(e,t){return yA(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,this.stride)}getLength(){return dv(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getFlatMidpoint(){return this.flatMidpointRevision_!=this.getRevision()&&(this.flatMidpoint_=this.getCoordinateAt(.5,this.flatMidpoint_??void 0),this.flatMidpointRevision_=this.getRevision()),this.flatMidpoint_}getSimplifiedGeometryInternal(e){let t=[];return t.length=AA(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,0),new i(t,"XY")}getType(){return"LineString"}intersectsExtent(e){return aA(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,this.getExtent())}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=hA(this.flatCoordinates,0,e,this.stride),this.changed()}},n5=t5;var i5=class i extends Al{constructor(e,t,n){if(super(),this.ends_=[],this.maxDelta_=-1,this.maxDeltaRevision_=-1,Array.isArray(e[0]))this.setCoordinates(e,t);else if(t!==void 0&&n)this.setFlatCoordinates(t,e),this.ends_=n;else{let r=e,s=[],o=[];for(let l=0,c=r.length;l<c;++l){let u=r[l];Lo(s,u.getFlatCoordinates()),o.push(s.length)}let a=r.length===0?this.getLayout():r[0].getLayout();this.setFlatCoordinates(a,s),this.ends_=o}}appendLineString(e){Lo(this.flatCoordinates,e.getFlatCoordinates().slice()),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){let e=new i(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return e.applyProperties(this),e}closestPointXY(e,t,n,r){return r<Rc(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(By(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Uy(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,e,t,n,r))}getCoordinateAtM(e,t,n){return this.layout!="XYM"&&this.layout!="XYZM"||this.flatCoordinates.length===0?null:(t=t!==void 0?t:!1,n=n!==void 0?n:!1,DX(this.flatCoordinates,0,this.ends_,this.stride,e,t,n))}getCoordinates(){return Dp(this.flatCoordinates,0,this.ends_,this.stride)}getEnds(){return this.ends_}getLineString(e){return e<0||this.ends_.length<=e?null:new n5(this.flatCoordinates.slice(e===0?0:this.ends_[e-1],this.ends_[e]),this.layout)}getLineStrings(){let e=this.flatCoordinates,t=this.ends_,n=this.layout,r=[],s=0;for(let o=0,a=t.length;o<a;++o){let l=t[o],c=new n5(e.slice(s,l),n);r.push(c),s=l}return r}getLength(){let e=this.ends_,t=0,n=0;for(let r=0,s=e.length;r<s;++r)n+=dv(this.flatCoordinates,t,e[r],this.stride),t=e[r];return n}getFlatMidpoints(){let e=[],t=this.flatCoordinates,n=0,r=this.ends_,s=this.stride;for(let o=0,a=r.length;o<a;++o){let l=r[o],c=yA(t,n,l,s,.5);Lo(e,c),n=l}return e}getSimplifiedGeometryInternal(e){let t=[],n=[];return t.length=bE(this.flatCoordinates,0,this.ends_,this.stride,e,t,0,n),new i(t,"XY",n)}getType(){return"MultiLineString"}intersectsExtent(e){return XW(this.flatCoordinates,0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||(this.flatCoordinates=[]);let n=Py(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=n.length===0?0:n[n.length-1],this.changed()}},NX=i5;function r5(){let i=(O.world.zones||[]).filter(c5);O.renderedShard=O.lens?.shard||0,O.sources.zones.clear(),O.sources.zoneTitles.clear(),O.zoneRecords.clear(),O.highlightedZones.clear(),O.focusedZoneID=null,O.zoneTitleCount=0,kp();for(let e of i){let t=Wr(),n=[],r=!1;for(let l of e.features||[]){let c=Bpe(l);c&&(r=!0,n.push(c),GT(t,c.getExtent()),O.sources.zones.addFeature(new Lp({geometry:c,zone:e,color:cv(e.id),child:e.parentRegionId!=null})))}if(!r)continue;let s=cv(e.id),o=e.center?pv(e.center.lat,e.center.lng):dl(t),a=Math.max(t[2]-t[0],t[3]-t[1]);O.sources.zoneTitles.addFeature(new Lp({geometry:new bu(o),zone:e,color:s,child:e.parentRegionId!=null,span:a,priority:(e.parentRegionId==null?2e6:1e6)+Math.round(a)})),O.zoneRecords.set(e.id,{zone:e,extent:t.slice(),geometries:n,color:s})}s5(),o5(),Npe()}function s5(){O.zoneTitleCount=O.sources.zoneTitles.getFeatures().filter(i=>Zf(i.get("zone"))!=="quiet").length}function o5(){if(O.sources.zoneScrim.clear(),!O.highlightedZones.size)return;let[i,e,t,n]=O.projection.getExtent(),r=[FX([[i,e],[t,e],[t,n],[i,n],[i,e]],!0)];for(let s of O.highlightedZones)for(let o of O.zoneRecords.get(s)?.geometries||[]){if(o.getType()==="MultiLineString")continue;let a=o.getType()==="MultiPolygon"?o.getPolygons():[o];for(let l of a)l.getLinearRings().forEach((c,u)=>{r.push(FX(c.getCoordinates(),u>0))})}O.sources.zoneScrim.addFeature(new Lp({geometry:new vh(r)}))}function FX(i,e){let t=0;for(let n=0,r=i.length-1;n<i.length;r=n++)t+=i[r][0]*i[n][1]-i[n][0]*i[r][1];return t<0===e?i:i.slice().reverse()}function Npe(){for(let i of ge.legend.querySelectorAll(".feature-index")){let e=document.createDocumentFragment();for(let{zone:t,depth:n}of Fpe()){let r=O.zoneRecords.get(t.id);if(!r)continue;let s=document.createElement("button");s.type="button",s.className="zone-index-item",s.dataset.zone=String(t.id),s.style.setProperty("--zone-color",r.color),s.style.setProperty("--zone-depth",String(n)),s.setAttribute("aria-pressed","false"),s.title=`${t.title}: click to jump; right-click to toggle highlight`;let o=document.createElement("span");o.className="zone-index-marker",o.setAttribute("aria-hidden","true");let a=document.createElement("span");a.textContent=t.title,s.append(o,a),e.append(s)}i.replaceChildren(e)}}function Fpe(){let i=[...O.zoneRecords.values()].map(o=>o.zone),e=new Set(i.map(o=>o.id)),t=new Map;for(let o of i){let a=e.has(o.parentRegionId)?o.parentRegionId:null;t.has(a)||t.set(a,[]),t.get(a).push(o)}for(let o of t.values())o.sort((a,l)=>a.title.localeCompare(l.title,void 0,{numeric:!0,sensitivity:"base"}));let n=[],r=new Set,s=(o,a)=>{if(!r.has(o.id)){r.add(o.id),n.push({zone:o,depth:a});for(let l of t.get(o.id)||[])s(l,a+1)}};for(let o of t.get(null)||[])s(o,0);for(let o of i)s(o,0);return n}function kp(){let i=!fl("zones");O.layers.zoneScrim.setVisible(i),O.layers.zones.setVisible(i),O.layers.zoneTitles.setVisible(i),O.layers.zoneTitleDetail.setVisible(i);let e=!1;for(let t of[...O.highlightedZones]){let n=O.zoneRecords.get(t);(!n||fl(lh(n.zone)))&&(O.highlightedZones.delete(t),e=!0)}e&&(qE(),o5(),a5())}function BX(i){let e=O.zoneRecords.get(i);e&&(O.focusedZoneID=i,a5(),kj(e.zone),O.engine.getView().fit(e.extent,{size:O.engine.getSize(),padding:[54,54,54,54],maxZoom:gh(O.lens),duration:220}),ge.sidebar.classList.remove("is-open"),ge.mobileLegend.setAttribute("aria-expanded","false"))}function OX(i){let e=O.zoneRecords.get(i);e&&(O.highlightedZones.has(i)?O.highlightedZones.delete(i):(O.highlightedZones.add(i),O.hiddenCollections.delete(lh(e.zone))&&(mA(),Ah()),kp()),O.hoveredPin=null,qE(),l5(),a5(),o5(),O.layers.zones.changed(),O.layers.zoneTitles.changed(),O.layers.zoneTitleDetail.changed())}function a5(){for(let i of ge.legend.querySelectorAll(".feature-index"))i.classList.toggle("has-highlights",O.highlightedZones.size>0);for(let i of ge.legend.querySelectorAll("[data-zone]")){let e=Number(i.dataset.zone),t=O.highlightedZones.has(e);i.classList.toggle("is-highlighted",t),i.classList.toggle("is-current",O.focusedZoneID===e),i.setAttribute("aria-pressed",String(t))}}function Bpe(i){if(!i?.coordinates)return null;let e=([t,n])=>pv(n,t);return i.type==="Polygon"?new vh(i.coordinates.map(t=>t.map(e))):i.type==="MultiPolygon"?new ME(i.coordinates.map(t=>t.map(n=>n.map(e)))):i.type==="MultiLineString"?new NX(i.coordinates.map(t=>t.map(e))):null}function pv(i,e){let t=Ope(),n=2**t.sourceZoom,r=(e+180)/360*n,s=i*Math.PI/180,o=(1-Math.asinh(Math.tan(s))/Math.PI)/2*n;return[(r-t.firstTile)*t.tileSize,-(o-t.firstTile)*t.tileSize]}function Ope(){let i=O.volume.tileGrid,e=O.world?.grid;return e?{...i,...e}:i}function UX(){O.sources.pins.clear(),O.sources.text.clear(),O.sources.priority.clear(),O.pins=[],O.pinByID.clear();for(let i of O.world.groups)for(let e of i.categories){ch(e)!=="text"&&TX(e);for(let t of e.locations){let n={location:t,category:e,group:i,coordinate:pv(t.lat,t.lng),filteredHidden:!1,priority:zpe(e,t),feature:null};n.feature=new Lp({geometry:new bu(n.coordinate),pin:n,priority:n.priority}),O.pins.push(n),O.pinByID.set(t.id,n),ch(e)==="text"?O.sources.text.addFeature(n.feature):O.sources.pins.addFeature(n.feature)}}Nc()}function Nc(){for(let i of O.pins){let e=fl(i.category.id),t=O.search&&!i.location.title.toLocaleLowerCase().includes(O.search);i.filteredHidden=!!(e||t)}qE(),l5(),O.selectedPin?.filteredHidden&&rd(),id(),document.dispatchEvent(new Event("atlas:filters"))}function qE(){if(!O.highlightedZones.size){for(let e of O.pins)e.passesZoneFilters=!1;return}let i=ZH([...O.highlightedZones].map(e=>O.zoneRecords.get(e)).filter(Boolean));for(let e of O.pins)e.passesZoneFilters=KH(i,e.coordinate)}function l5(){O.eligibleLocations=O.pins.filter(i=>!kc(i)).length,Fc(),O.layers.pins.changed(),O.layers.zonePins.changed(),O.layers.pinLabels.changed(),O.layers.text.changed(),O.layers.zoneText.changed(),O.layers.textDetail.changed(),O.layers.priority.changed(),bA()}function Fc(){O.sources.priority.clear();for(let i of O.pins){if(kc(i))continue;let e=!!O.search&&i.location.title.toLocaleLowerCase().includes(O.search);(i===O.selectedPin||i===O.hoveredPin||e||Fp(i))&&O.sources.priority.addFeature(i.feature)}}function mv(i){O.hoveredPin!==i&&(O.hoveredPin=i,O.sources&&(Fc(),O.layers.pins.changed(),O.layers.priority.changed()))}function HE(i){O.labelsHeld!==i&&(O.labelsHeld=i,ge.labelsHint.textContent=i?"Z \xB7 labels shown":"Z \xB7 hold for labels",O.layers.pinLabels.changed(),O.layers.text.changed(),O.layers.zoneTitles.changed(),O.layers.zoneTitleDetail.changed(),document.dispatchEvent(new Event("atlas:labels")))}function fv(i){return i===O.selectedPin||i===O.hoveredPin||Fp(i)||!!O.search&&i.location.title.toLocaleLowerCase().includes(O.search)}function kc(i){return i.filteredHidden||Upe(i)||kpe(i)||!c5(i.location)}function c5(i){let e=O.lens?.shard;return!e||!i.shard||i.shard===e}function Upe(i){return!O.highlightedZones.size||i.passesZoneFilters||i===O.selectedPin?!1:!(O.search&&i.location.title.toLocaleLowerCase().includes(O.search))}function kpe(i){return!O.gridEnabled||!O.gridCell||Fp(i)||i===O.selectedPin?!1:!(O.search&&i.location.title.toLocaleLowerCase().includes(O.search))}function zpe(i,e){return Math.max(0,1e6-Math.min(i.locations.length,999)*1e3)+Oj(e.id)%1e3}function LX(i){return i.locations.length>200?4:i.locations.length>75?2.5:1}function Qy(){return(O.engine?.getView().getZoom()||0)>=(O.lens?.maxZoom||0)-.05}function kX(i,e=[]){let t=[],n=[];for(let r of i){let s=[];for(let o of r.categories)(ch(o)==="text"?n:s).push(o);s.length&&t.push({key:`group-${r.id}`,title:r.title,collections:s})}return n.length&&t.unshift({key:"text",title:"Text",collections:n}),e.length&&t.unshift({key:"zones",title:"Zones",collections:[{id:"zones",title:"Zones",kind:"area",features:e}]}),t}function zX(i){return i.kind||"point"}function VX(i){return(i.features||i.locations).length}function cd(i){return/^\d+$/.test(i)?Number(i):i}function GX(i){for(let e of O.world?.sections||[])for(let t of e.collections)if(t.id===i)return t;return null}function qX(){let i=document.createDocumentFragment();for(let e of O.world.sections){let t=document.createElement("section");t.className="layer-section",t.dataset.layerSection=e.key;let n=e.collections.reduce((s,o)=>s+VX(o),0);t.append(Vpe(e.key,e.title,n));let r=document.createElement("div");r.className="category-toggles";for(let s of e.collections)if(r.append(Gpe(s)),zX(s)!=="point"){let o=document.createElement("div");o.className="feature-index",o.dataset.featureIndex=String(s.id),r.append(o)}t.append(r),i.append(t)}ge.legend.replaceChildren(i),WE(),jX(),Ah()}function Vpe(i,e,t){let n=document.createElement("div");n.className="layer-header";let r=document.createElement("button");r.type="button",r.className="layer-title",r.dataset.section=i;let s=document.createElement("span");s.className="layer-chevron",s.setAttribute("aria-hidden","true"),s.innerHTML='<svg viewBox="0 0 24 24"><path d="m9 6 6 6-6 6"/></svg>';let o=document.createElement("span");o.textContent=e;let a=document.createElement("span");a.className="layer-count",a.textContent=nd(t),r.append(s,o,a);let l=HX(`Show only ${e}`);l.dataset.onlySection=i;let c=document.createElement("label");c.className="layer-switch";let u=document.createElement("input");u.type="checkbox",u.dataset.sectionToggle=i,u.setAttribute("aria-label",`Show ${e}`);let f=document.createElement("span");return f.setAttribute("aria-hidden","true"),c.append(u,f),n.append(r,l,c),n}function HX(i){let e=document.createElement("button");return e.type="button",e.className="only-button",e.dataset.label=i,e.setAttribute("aria-label",i),e.innerHTML='<svg viewBox="0 0 16 16" aria-hidden="true"><circle cx="8" cy="8" r="4.6"/><circle cx="8" cy="8" r="1.3" fill="currentColor" stroke="none"/><path d="M8 1v2M8 13v2M1 8h2M13 8h2"/></svg>',e}function Gpe(i){let e=zX(i),t=document.createElement("label");t.className="category-row";let n=document.createElement("input");n.type="checkbox",n.dataset.collection=String(i.id),n.checked=!O.hiddenCollections.has(i.id);let r;e!=="point"?(r=document.createElement("button"),r.type="button",r.className="collection-expand",r.dataset.expandCollection=String(i.id),r.setAttribute("aria-label",`Unfold the ${i.title} index`),r.innerHTML='<svg class="collection-chevron" viewBox="0 0 16 16" aria-hidden="true"><path d="m6 4 4 4-4 4"/></svg>'+(e==="path"?'<svg class="collection-kind" viewBox="0 0 16 16" aria-hidden="true"><path d="M2.5 12.5c3-6 8-2 11-9"/></svg>':'<svg class="collection-kind" viewBox="0 0 16 16" aria-hidden="true"><path d="M3.5 4.5h9v7h-9z"/></svg>')):ch(i)==="text"?(r=document.createElement("span"),r.className="text-symbol",r.textContent="Tt",r.title="Drawn as a text label",dA(t,i)):(r=document.createElement("span"),r.className="category-icon",dA(t,i),uv(r,i,wu(i.title)),r.title=i.icon||i.title);let s=document.createElement("span");s.className="category-name",s.textContent=i.title;let o=HX(`Show only ${i.title}`);o.dataset.onlyCollection=String(i.id);let a;e==="area"?(a=document.createElement("button"),a.type="button",a.className="label-toggle",a.dataset.labelToggle=String(i.id),a.dataset.label=`Label ${i.title} on the map`,a.setAttribute("aria-label",`Label ${i.title} on the map`),a.setAttribute("aria-pressed",String(Zf(null,i)==="always")),a.innerHTML='<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M3.5 3.5h9M8 3.5v9"/></svg>'):(a=document.createElement("span"),a.className="label-toggle-spacer");let l=document.createElement("span");return l.className="category-count",l.textContent=nd(VX(i)),t.append(n,r,s,o,a,l),t}function u5(i){if(O.collapsedSections.clear(),i)for(let e of ge.layers.querySelectorAll("[data-section]"))O.collapsedSections.add(e.dataset.section);WE()}function WE(){for(let i of ge.layers.querySelectorAll("[data-section]")){let e=O.collapsedSections.has(i.dataset.section);i.setAttribute("aria-expanded",String(!e)),i.closest(".layer-section").classList.toggle("is-collapsed",e)}Wl()}function WX(i){O.expandedCollections.has(i)?O.expandedCollections.delete(i):O.expandedCollections.add(i),jX()}function jX(){for(let i of ge.legend.querySelectorAll("[data-expand-collection]")){let e=O.expandedCollections.has(cd(i.dataset.expandCollection));i.setAttribute("aria-expanded",String(e)),i.closest(".category-row").classList.toggle("is-expanded",e)}for(let i of ge.legend.querySelectorAll(".feature-index"))i.hidden=!O.expandedCollections.has(cd(i.dataset.featureIndex));Wl()}function XX(i){let e=GX(i);if(!e)return;let t=Zf(null,e)==="always"?"quiet":"always",n=e.attrs?.["atlas.label.policy"]??"always";t===n?O.labelOverrides.delete(e.id):O.labelOverrides.set(e.id,t),qpe(),s5(),O.layers.zoneTitles.changed(),O.layers.zoneTitleDetail.changed(),Wl()}function qpe(){for(let i of ge.legend.querySelectorAll("[data-label-toggle]")){let e=GX(cd(i.dataset.labelToggle));e&&i.setAttribute("aria-pressed",String(Zf(null,e)==="always"))}}function Jy(i){if(O.hiddenCollections.clear(),!i)for(let e of O.world.sections)for(let t of e.collections)O.hiddenCollections.add(t.id);mA(),kp(),Nc(),id(),Ah()}function mA(){for(let i of document.querySelectorAll("[data-collection]"))i.checked=!O.hiddenCollections.has(cd(i.dataset.collection))}function $X(i){let e=O.world.sections.find(n=>n.key===i);if(!e)return;let t=e.collections.some(n=>!O.hiddenCollections.has(n.id));for(let n of e.collections)t?O.hiddenCollections.add(n.id):O.hiddenCollections.delete(n.id);mA(),kp(),Nc(),Ah()}function YX(i){if(O.world){if(Hpe(i)){Jy(!0);return}O.hiddenCollections.clear();for(let e of O.world.sections){let t=i.section===e.key;for(let n of e.collections)!t&&i.collection!==n.id&&O.hiddenCollections.add(n.id)}mA(),kp(),Nc(),id(),Ah()}}function Hpe(i){for(let e of O.world.sections)for(let t of e.collections)if((i.section===e.key||i.collection===t.id)===O.hiddenCollections.has(t.id))return!1;return!0}function Wpe(){let i=ge.soloChip;if(!O.world){i.hidden=!0;return}let e=null,t=0,n=null,r=0;for(let o of O.world.sections){let a=0;for(let l of o.collections)O.hiddenCollections.has(l.id)||(a++,t++,e=l);a>0&&(r++,n=a===o.collections.length?o:null)}let s="";t===1&&e?s=e.title:r===1&&n&&(s=n.title),i.hidden=!s,i.textContent=s?`only: ${s}`:"",i.title=s?`Showing only ${s} \u2014 click to show everything`:""}function Ah(){if(O.world){for(let i of O.world.sections){let e=ge.legend.querySelector(`input[data-section-toggle="${i.key}"]`);e&&(e.checked=i.collections.some(t=>!O.hiddenCollections.has(t.id)))}Wpe(),Wl()}}async function ZX(i){let[e,t]=await Promise.all([fetch(`${O.volume.base}/worlds/${i.slug}.json`),fetch(`${O.volume.base}/worlds/${i.slug}.bin`)]);if(!e.ok||!t.ok)throw new Error(`world ${i.slug} is not served under this catalog any more`);let[n,r]=await Promise.all([e.json(),t.arrayBuffer()]),s=n.groups.flatMap(a=>a.categories);jpe(r,s);let o=kX(n.groups,n.zones||[]);return{...i,grid:n.grid,lenses:n.lenses,groups:n.groups,zones:n.zones||[],attrs:n.attrs||{},merged:n.merged||[],sections:o}}function jpe(i,e){let t=new DataView(i);if(String.fromCharCode(...new Uint8Array(i,0,8))!=="ATLASLOC")throw new Error("location payload is not in the expected form");let r=t.getUint16(8,!0);if(r!==2)throw new Error(`location payload is version ${r}, and this reads 2`);let s=t.getUint32(10,!0),o=16,a=new Int32Array(i,o,s),l=new Float32Array(i,o+=s*4,s),c=new Float32Array(i,o+=s*4,s),u=new Int32Array(i,o+=s*4,s),f=new Int32Array(i,o+=s*4,s),d=new Uint32Array(i,o+=s*4,s+1),A=new Uint16Array(i,o+=(s+1)*4,s),y=new Uint8Array(i,o+s*2),w=new TextDecoder;for(let S of e)S.locations=[];for(let S=0;S<s;S++)e[A[S]].locations.push({id:a[S],title:w.decode(y.subarray(d[S],d[S+1])),lat:l[S],lng:c[S],regionId:u[S]||void 0,shard:f[S]||void 0})}async function AN(){let i=`${O.volume.base}/${O.world.slug}`;return O.textByWorld.has(i)||O.textByWorld.set(i,fetch(`${O.volume.base}/worlds/${O.world.slug}.text`).then(e=>e.json()).catch(()=>({}))),O.textByWorld.get(i)}var jE=null;function wA(){return jE||(jE=Xpe().finally(()=>{jE=null})),jE}async function Xpe(){let i=await fetch("/data/catalog.json");if(!i.ok)return;let e=O.volume;if(O.catalog=await i.json(),Hm(ge.volume,O.catalog.volumes,"title"),h5(),!O.catalog.volumes.length)return;let t=e&&O.catalog.volumes.find(n=>n.slug===e.slug);if(!t){let n=lv();await ud(n.volume||av()?.volume||O.catalog.volumes[0].slug,n.volume?n.world:void 0);return}if(t.stamp!==e.stamp){for(let r of O.textByWorld.keys())r.startsWith(e.base+"/")&&O.textByWorld.delete(r);let n=O.engine?.getView();O.restore={volume:t.slug,world:O.world?.slug,lens:O.world?O.world.lenses.indexOf(O.lens):0,center:n?.getCenter(),zoom:n?.getZoom(),hidden:[...O.hiddenCollections],collapsed:[...O.collapsedSections],expanded:[...O.expandedCollections],labels:[...O.labelOverrides],overviewDocked:O.overviewDocked,dockFolded:O.dockFolded,dockDismissed:O.dockDismissed},await ud(t.slug,O.world?.slug);return}O.volume=t,ge.volume.value=t.slug}function h5(){let i=!O.catalog?.volumes?.length;ge.emptyState.hidden=!i,O.catalog?.bundlesDir&&(ge.emptyPath.textContent=O.catalog.bundlesDir)}async function f5(){for(let i of[ge.emptyOpen,ge.addBundles])i.disabled=!0;try{let e=await(await fetch("/data/bundles/import",{method:"POST"})).json().catch(()=>({}));await wA();let t=e.imported?.[0];t&&O.catalog.volumes.some(n=>n.slug===t)&&await ud(t)}finally{for(let i of[ge.emptyOpen,ge.addBundles])i.disabled=!1}}var vo={ADD:"add",REMOVE:"remove"};var KX={LENGTH:"length"},Av=class extends Ao{constructor(e,t,n){super(e),this.element=t,this.index=n}},d5=class extends zs{constructor(e,t){if(super(),this.on,this.once,this.un,t=t||{},this.unique_=!!t.unique,this.array_=e??[],this.unique_)for(let n=1,r=this.array_.length;n<r;++n)this.assertUnique_(this.array_[n],n);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(e){for(let t=0,n=e.length;t<n;++t)this.push(e[t]);return this}forEach(e){let t=this.array_;for(let n=0,r=t.length;n<r;++n)e(t[n],n,t)}getArray(){return this.array_}item(e){return this.array_[e]}getLength(){return this.get(KX.LENGTH)}insertAt(e,t){if(e<0||e>this.getLength())throw new Error("Index out of bounds: "+e);this.unique_&&this.assertUnique_(t),this.array_.splice(e,0,t),this.updateLength_(),this.dispatchEvent(new Av(vo.ADD,t,e))}pop(){return this.removeAt(this.getLength()-1)}push(e){let t=this.getLength();return this.insertAt(t,e),this.getLength()}remove(e){let t=this.array_;for(let n=0,r=t.length;n<r;++n)if(t[n]===e)return this.removeAt(n)}removeAt(e){if(e<0||e>=this.getLength())return;let t=this.array_[e];return this.array_.splice(e,1),this.updateLength_(),this.dispatchEvent(new Av(vo.REMOVE,t,e)),t}setAt(e,t){let n=this.getLength();if(e>=n){this.insertAt(e,t);return}if(e<0)throw new Error("Index out of bounds: "+e);this.unique_&&this.assertUnique_(t,e);let r=this.array_[e];this.array_[e]=t,this.dispatchEvent(new Av(vo.REMOVE,r,e)),this.dispatchEvent(new Av(vo.ADD,t,e))}updateLength_(){this.set(KX.LENGTH,this.array_.length)}assertUnique_(e,t){let n=this.array_;for(let r=0,s=n.length;r<s;++r)if(n[r]===e&&r!==t)throw new Error("Duplicate item added to a unique collection")}},No=d5;var p5=class extends Ao{constructor(e,t,n){super(e),this.map=t,this.frameState=n!==void 0?n:null}},zp=p5;var m5=class extends zp{constructor(e,t,n,r,s,o){super(e,t,s),this.originalEvent=n,this.pixel_=null,this.coordinate_=null,this.dragging=r!==void 0?r:!1,this.activePointers=o}get pixel(){return this.pixel_||(this.pixel_=this.map.getEventPixel(this.originalEvent)),this.pixel_}set pixel(e){this.pixel_=e}get coordinate(){return this.coordinate_||(this.coordinate_=this.map.getCoordinateFromPixel(this.pixel)),this.coordinate_}set coordinate(e){this.coordinate_=e}preventDefault(){super.preventDefault(),"preventDefault"in this.originalEvent&&this.originalEvent.preventDefault()}stopPropagation(){super.stopPropagation(),"stopPropagation"in this.originalEvent&&this.originalEvent.stopPropagation()}},yh=m5;var gr={SINGLECLICK:"singleclick",CLICK:nn.CLICK,DBLCLICK:nn.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var e2={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var A5=class extends Pp{constructor(e,t){super(e),this.map_=e,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=t===void 0?1:t,this.down_=null;let n=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=n,this.pointerdownListenerKey_=qn(n,e2.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=qn(n,e2.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(nn.TOUCHMOVE,this.boundHandleTouchMove_,lE?{passive:!1}:!1)}emulateClick_(e){let t=new yh(gr.CLICK,this.map_,e);this.dispatchEvent(t),this.clickTimeoutId_!==void 0?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,t=new yh(gr.DBLCLICK,this.map_,e),this.dispatchEvent(t)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;let n=new yh(gr.SINGLECLICK,this.map_,e);this.dispatchEvent(n)},250)}updateActivePointers_(e){let t=e,n=t.pointerId;if(t.type==gr.POINTERUP||t.type==gr.POINTERCANCEL){delete this.trackedTouches_[n];for(let r in this.trackedTouches_)if(this.trackedTouches_[r].target!==t.target){delete this.trackedTouches_[r];break}}else(t.type==gr.POINTERDOWN||t.type==gr.POINTERMOVE)&&(this.trackedTouches_[n]=t);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(e){this.updateActivePointers_(e);let t=new yh(gr.POINTERUP,this.map_,e,void 0,void 0,this.activePointers_);this.dispatchEvent(t),this.emulateClicks_&&!t.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(e)&&this.emulateClick_(this.down_),this.activePointers_.length===0&&(this.dragListenerKeys_.forEach(li),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(e){return e.button===0}handlePointerDown_(e){this.emulateClicks_=this.activePointers_.length===0,this.updateActivePointers_(e);let t=new yh(gr.POINTERDOWN,this.map_,e,void 0,void 0,this.activePointers_);if(this.dispatchEvent(t),this.down_=new PointerEvent(e.type,e),Object.defineProperty(this.down_,"target",{writable:!1,value:e.target}),this.dragListenerKeys_.length===0){let n=this.map_.getOwnerDocument();this.dragListenerKeys_.push(qn(n,gr.POINTERMOVE,this.handlePointerMove_,this),qn(n,gr.POINTERUP,this.handlePointerUp_,this),qn(this.element_,gr.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==n&&this.dragListenerKeys_.push(qn(this.element_.getRootNode(),gr.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(e){if(this.isMoving_(e)){this.updateActivePointers_(e),this.dragging_=!0;let t=new yh(gr.POINTERDRAG,this.map_,e,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(t)}}relayMoveEvent_(e){this.originalPointerMoveEvent_=e;let t=!!(this.down_&&this.isMoving_(e));this.dispatchEvent(new yh(gr.POINTERMOVE,this.map_,e,t))}handleTouchMove_(e){let t=this.originalPointerMoveEvent_;(!t||t.defaultPrevented)&&(typeof e.cancelable!="boolean"||e.cancelable===!0)&&e.preventDefault()}isMoving_(e){return this.dragging_||Math.abs(e.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(e.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&(li(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(nn.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(li(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(li),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}},QX=A5;var bh={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"};var Fo={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"};var t2=1/0,g5=class{constructor(e,t){this.priorityFunction_=e,this.keyFunction_=t,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,mh(this.queuedElements_)}dequeue(){let e=this.elements_,t=this.priorities_,n=e[0];e.length==1?(e.length=0,t.length=0):(e[0]=e.pop(),t[0]=t.pop(),this.siftUp_(0));let r=this.keyFunction_(n);return delete this.queuedElements_[r],n}enqueue(e){jn(!(this.keyFunction_(e)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");let t=this.priorityFunction_(e);return t!=t2?(this.elements_.push(e),this.priorities_.push(t),this.queuedElements_[this.keyFunction_(e)]=!0,this.siftDown_(0,this.elements_.length-1),!0):!1}getCount(){return this.elements_.length}getLeftChildIndex_(e){return e*2+1}getRightChildIndex_(e){return e*2+2}getParentIndex_(e){return e-1>>1}heapify_(){let e;for(e=(this.elements_.length>>1)-1;e>=0;e--)this.siftUp_(e)}isEmpty(){return this.elements_.length===0}isKeyQueued(e){return e in this.queuedElements_}isQueued(e){return this.isKeyQueued(this.keyFunction_(e))}siftUp_(e){let t=this.elements_,n=this.priorities_,r=t.length,s=t[e],o=n[e],a=e;for(;e<r>>1;){let l=this.getLeftChildIndex_(e),c=this.getRightChildIndex_(e),u=c<r&&n[c]<n[l]?c:l;t[e]=t[u],n[e]=n[u],e=u}t[e]=s,n[e]=o,this.siftDown_(a,e)}siftDown_(e,t){let n=this.elements_,r=this.priorities_,s=n[t],o=r[t];for(;t>e;){let a=this.getParentIndex_(t);if(r[a]>o)n[t]=n[a],r[t]=r[a],t=a;else break}n[t]=s,r[t]=o}reprioritize(){let e=this.priorityFunction_,t=this.elements_,n=this.priorities_,r=0,s=t.length,o,a,l;for(a=0;a<s;++a)o=t[a],l=e(o),l==t2?delete this.queuedElements_[this.keyFunction_(o)]:(n[r]=l,t[r++]=o);t.length=r,n.length=r,this.heapify_()}},JX=g5;var v5=class extends JX{constructor(e,t){super(n=>e.apply(null,n),n=>n[0].getKey()),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=t,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(e){let t=super.enqueue(e);return t&&e[0].addEventListener(nn.CHANGE,this.boundHandleTileChange_),t}getTilesLoading(){return this.tilesLoading_}handleTileChange(e){let t=e.target,n=t.getState();if(n===an.LOADED||n===an.ERROR||n===an.EMPTY){n!==an.ERROR&&t.removeEventListener(nn.CHANGE,this.boundHandleTileChange_);let r=t.getKey();r in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[r],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(e,t){let n=0;for(;this.tilesLoading_<e&&n<t&&this.getCount()>0;){let r=this.dequeue()[0],s=r.getKey();r.getState()===an.IDLE&&!(s in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[s]=!0,++this.tilesLoading_,++n,r.load())}}},e$=v5;function t$(i,e,t,n,r){if(!i||!(t in i.wantedTiles))return t2;if(!i.wantedTiles[t][e.getKey()])return t2;let s=i.viewState.center,o=n[0]-s[0],a=n[1]-s[1];return 65536*Math.log(r)+Math.sqrt(o*o+a*a)/r}var so={ANIMATING:0,INTERACTING:1};var zc={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function _5(i,e,t){return(function(n,r,s,o,a){if(!n)return;if(!r&&!e)return n;let l=e?0:s[0]*r,c=e?0:s[1]*r,u=a?a[0]:0,f=a?a[1]:0,d=i[0]+l/2+u,A=i[2]-l/2+u,y=i[1]+c/2+f,w=i[3]-c/2+f;d>A&&(d=(A+d)/2,A=d),y>w&&(y=(w+y)/2,w=y);let S=Si(n[0],d,A),T=Si(n[1],y,w);if(o&&t&&r){let R=30*r;S+=-R*Math.log(1+Math.max(0,d-n[0])/R)+R*Math.log(1+Math.max(0,n[0]-A)/R),T+=-R*Math.log(1+Math.max(0,y-n[1])/R)+R*Math.log(1+Math.max(0,n[1]-w)/R)}return[S,T]})}function n$(i){return i}function x5(i,e,t,n){let r=Kn(e)/t[0],s=Dr(e)/t[1];return n?Math.min(i,Math.max(r,s)):Math.min(i,Math.min(r,s))}function y5(i,e,t){let n=Math.min(i,e),r=50;return n*=Math.log(1+r*Math.max(0,i/e-1))/r+1,t&&(n=Math.max(n,t),n/=Math.log(1+r*Math.max(0,t/i-1))/r+1),Si(n,t/2,e*2)}function i$(i,e,t,n){return e=e!==void 0?e:!0,(function(r,s,o,a){if(r!==void 0){let l=i[0],c=i[i.length-1],u=t?x5(l,t,o,n):l;if(a)return e?y5(r,u,c):Si(r,c,u);let f=Math.min(u,r),d=Math.floor(ev(i,f,s));return i[d]>u&&d<i.length-1?i[d+1]:i[d]}})}function r$(i,e,t,n,r,s){return n=n!==void 0?n:!0,t=t!==void 0?t:0,(function(o,a,l,c){if(o!==void 0){let u=r?x5(e,r,l,s):e;if(c)return n?y5(o,u,t):Si(o,t,u);let f=1e-9,d=Math.ceil(Math.log(e/u)/Math.log(i)-f),A=-a*(.5-f)+.5,y=Math.min(u,o),w=Math.floor(Math.log(e/y)/Math.log(i)+A),S=Math.max(d,w),T=e/Math.pow(i,S);return Si(T,t,u)}})}function b5(i,e,t,n,r){return t=t!==void 0?t:!0,(function(s,o,a,l){if(s!==void 0){let c=n?x5(i,n,a,r):i;return!t||!l?Si(s,e,c):y5(s,c,e)}})}function gv(i){if(i!==void 0)return 0}function w5(i){if(i!==void 0)return i}function s$(i){let e=2*Math.PI/i;return(function(t,n){if(n)return t;if(t!==void 0)return t=Math.floor(t/e+.5)*e,t})}function o$(i){let e=i===void 0?Au(5):i;return(function(t,n){return n||t===void 0?t:Math.abs(t)<=e?0:t})}var S5=0,E5=class extends zs{constructor(e){super(),this.on,this.once,this.un,e=Object.assign({},e),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=tE(e.projection,"EPSG:3857"),this.viewportSize_=[100,100],this.targetCenter_=null,this.targetResolution_,this.targetRotation_,this.nextCenter_=null,this.nextResolution_,this.nextRotation_,this.cancelAnchor_=void 0,e.projection&&BW(),e.center&&(e.center=_u(e.center,this.projection_)),e.extent&&(e.extent=xu(e.extent,this.projection_)),this.applyOptions_(e)}applyOptions_(e){let t=Object.assign({},e);for(let a in zc)delete t[a];this.setProperties(t,!0);let n=Ype(e);this.maxResolution_=n.maxResolution,this.minResolution_=n.minResolution,this.zoomFactor_=n.zoomFactor,this.resolutions_=e.resolutions,this.padding_=e.padding,this.minZoom_=n.minZoom;let r=$pe(e),s=n.constraint,o=Zpe(e);this.constraints_={center:r,resolution:s,rotation:o},this.setRotation(e.rotation!==void 0?e.rotation:0),this.setCenterInternal(e.center!==void 0?e.center:null),e.resolution!==void 0?this.setResolution(e.resolution):e.zoom!==void 0&&this.setZoom(e.zoom)}get padding(){return this.padding_}set padding(e){let t=this.padding_;this.padding_=e;let n=this.getCenterInternal();if(n){let r=e||[0,0,0,0];t=t||[0,0,0,0];let s=this.getResolution(),o=s/2*(r[3]-t[3]+t[1]-r[1]),a=s/2*(r[0]-t[0]+t[2]-r[2]);this.setCenterInternal([n[0]+o,n[1]-a])}}getUpdatedOptions_(e){let t=this.getProperties();return t.resolution!==void 0?t.resolution=this.getResolution():t.zoom=this.getZoom(),t.center=this.getCenterInternal(),t.rotation=this.getRotation(),Object.assign({},t,e)}animate(e){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);let t=new Array(arguments.length);for(let n=0;n<t.length;++n){let r=arguments[n];r.center&&(r=Object.assign({},r),r.center=_u(r.center,this.getProjection())),r.anchor&&(r=Object.assign({},r),r.anchor=_u(r.anchor,this.getProjection())),t[n]=r}this.animateInternal.apply(this,t)}animateInternal(e){let t=arguments.length,n;t>1&&typeof arguments[t-1]=="function"&&(n=arguments[t-1],--t);let r=0;for(;r<t&&!this.isDef();++r){let u=arguments[r];u.center&&this.setCenterInternal(u.center),u.zoom!==void 0?this.setZoom(u.zoom):u.resolution&&this.setResolution(u.resolution),u.rotation!==void 0&&this.setRotation(u.rotation)}if(r===t){n&&XE(n,!0);return}let s=Date.now(),o=this.targetCenter_.slice(),a=this.targetResolution_,l=this.targetRotation_,c=[];for(;r<t;++r){let u=arguments[r],f={start:s,complete:!1,anchor:u.anchor,duration:u.duration!==void 0?u.duration:1e3,easing:u.easing||oj,callback:n};if(u.center&&(f.sourceCenter=o,f.targetCenter=u.center.slice(),o=f.targetCenter),u.zoom!==void 0?(f.sourceResolution=a,f.targetResolution=this.getResolutionForZoom(u.zoom),a=f.targetResolution):u.resolution&&(f.sourceResolution=a,f.targetResolution=u.resolution,a=f.targetResolution),u.rotation!==void 0){f.sourceRotation=l;let d=ph(u.rotation-l+Math.PI,2*Math.PI)-Math.PI;f.targetRotation=l+d,l=f.targetRotation}Kpe(f)?f.complete=!0:s+=f.duration,c.push(f)}this.animations_.push(c),this.setHint(so.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[so.ANIMATING]>0}getInteracting(){return this.hints_[so.INTERACTING]>0}cancelAnimations(){this.setHint(so.ANIMATING,-this.hints_[so.ANIMATING]);let e;for(let t=0,n=this.animations_.length;t<n;++t){let r=this.animations_[t];if(r[0].callback&&XE(r[0].callback,!1),!e)for(let s=0,o=r.length;s<o;++s){let a=r[s];if(!a.complete){e=a.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=e,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(this.updateAnimationKey_!==void 0&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;let e=Date.now(),t=!1;for(let n=this.animations_.length-1;n>=0;--n){let r=this.animations_[n],s=!0;for(let o=0,a=r.length;o<a;++o){let l=r[o];if(l.complete)continue;let c=e-l.start,u=l.duration>0?c/l.duration:1;u>=1?(l.complete=!0,u=1):s=!1;let f=l.easing(u);if(l.sourceCenter){let d=l.sourceCenter[0],A=l.sourceCenter[1],y=l.targetCenter[0],w=l.targetCenter[1];this.nextCenter_=l.targetCenter;let S=d+f*(y-d),T=A+f*(w-A);this.targetCenter_=[S,T]}if(l.sourceResolution&&l.targetResolution){let d=f===1?l.targetResolution:l.sourceResolution+f*(l.targetResolution-l.sourceResolution);if(l.anchor){let A=this.getViewportSize_(this.getRotation()),y=this.constraints_.resolution(d,0,A,!0);this.targetCenter_=this.calculateCenterZoom(y,l.anchor)}this.nextResolution_=l.targetResolution,this.targetResolution_=d,this.applyTargetState_(!0)}if(l.sourceRotation!==void 0&&l.targetRotation!==void 0){let d=f===1?ph(l.targetRotation+Math.PI,2*Math.PI)-Math.PI:l.sourceRotation+f*(l.targetRotation-l.sourceRotation);if(l.anchor){let A=this.constraints_.rotation(d,!0);this.targetCenter_=this.calculateCenterRotate(A,l.anchor)}this.nextRotation_=l.targetRotation,this.targetRotation_=d}if(this.applyTargetState_(!0),t=!0,!l.complete)break}if(s){this.animations_[n]=null,this.setHint(so.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;let o=r[0].callback;o&&XE(o,!0)}}this.animations_=this.animations_.filter(Boolean),t&&this.updateAnimationKey_===void 0&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(e,t){let n,r=this.getCenterInternal();return r!==void 0&&(n=[r[0]-t[0],r[1]-t[1]],X1(n,e-this.getRotation()),mW(n,t)),n}calculateCenterZoom(e,t){let n,r=this.getCenterInternal(),s=this.getResolution();if(r!==void 0&&s!==void 0){let o=t[0]-e*(t[0]-r[0])/s,a=t[1]-e*(t[1]-r[1])/s;n=[o,a]}return n}getViewportSize_(e){let t=this.viewportSize_;if(e){let n=t[0],r=t[1];return[Math.abs(n*Math.cos(e))+Math.abs(r*Math.sin(e)),Math.abs(n*Math.sin(e))+Math.abs(r*Math.cos(e))]}return t}setViewportSize(e){this.viewportSize_=Array.isArray(e)?e.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){let e=this.getCenterInternal();return e&&My(e,this.getProjection())}getCenterInternal(){return this.get(zc.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(e){return e!==void 0?(e[0]=this.hints_[0],e[1]=this.hints_[1],e):this.hints_.slice()}calculateExtent(e){let t=this.calculateExtentInternal(e);return Mp(t,this.getProjection())}calculateExtentInternal(e){e=e||this.getViewportSizeMinusPadding_();let t=this.getCenterInternal();jn(t,"The view center is not defined");let n=this.getResolution();jn(n!==void 0,"The view resolution is not defined");let r=this.getRotation();return jn(r!==void 0,"The view rotation is not defined"),wy(t,n,r,e)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(e){this.applyOptions_(this.getUpdatedOptions_({maxZoom:e}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(e){this.applyOptions_(this.getUpdatedOptions_({minZoom:e}))}setConstrainResolution(e){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:e}))}getProjection(){return this.projection_}getResolution(){return this.get(zc.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(e,t){return this.getResolutionForExtentInternal(xu(e,this.getProjection()),t)}getResolutionForExtentInternal(e,t){t=t||this.getViewportSizeMinusPadding_();let n=Kn(e)/t[0],r=Dr(e)/t[1];return Math.max(n,r)}getResolutionForValueFunction(e){e=e||2;let t=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,r=Math.log(t/n)/Math.log(e);return(function(s){return t/Math.pow(e,s*r)})}getRotation(){return this.get(zc.ROTATION)}getValueForResolutionFunction(e){let t=Math.log(e||2),n=this.getConstrainedResolution(this.maxResolution_),r=this.minResolution_,s=Math.log(n/r)/t;return(function(o){return Math.log(n/o)/t/s})}getViewportSizeMinusPadding_(e){let t=this.getViewportSize_(e),n=this.padding_;return n&&(t=[t[0]-n[1]-n[3],t[1]-n[0]-n[2]]),t}getState(){let e=this.getProjection(),t=this.getResolution(),n=this.getRotation(),r=this.getCenterInternal(),s=this.padding_;if(s){let o=this.getViewportSizeMinusPadding_();r=T5(r,this.getViewportSize_(),[o[0]/2+s[3],o[1]/2+s[0]],t,n)}return{center:r.slice(0),projection:e!==void 0?e:null,resolution:t,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:n,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let e,t=this.getResolution();return t!==void 0&&(e=this.getZoomForResolution(t)),e}getZoomForResolution(e){let t=this.minZoom_||0,n,r;if(this.resolutions_){let s=ev(this.resolutions_,e,1);t=s,n=this.resolutions_[s],s==this.resolutions_.length-1?r=2:r=n/this.resolutions_[s+1]}else n=this.maxResolution_,r=this.zoomFactor_;return t+Math.log(n/e)/Math.log(r)}getResolutionForZoom(e){if(this.resolutions_?.length){if(this.resolutions_.length===1)return this.resolutions_[0];let t=Si(Math.floor(e),0,this.resolutions_.length-2),n=this.resolutions_[t]/this.resolutions_[t+1];return this.resolutions_[t]/Math.pow(n,Si(e-t,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,e-this.minZoom_)}fit(e,t){let n;if(jn(Array.isArray(e)||typeof e.getSimplifiedGeometry=="function","Invalid extent or geometry provided as `geometry`"),Array.isArray(e)){jn(!dh(e),"Cannot fit empty extent provided as `geometry`");let r=xu(e,this.getProjection());n=TN(r)}else if(e.getType()==="Circle"){let r=xu(e.getExtent(),this.getProjection());n=TN(r),n.rotate(this.getRotation(),dl(r))}else{let r=sA();r?n=e.clone().transform(r,this.getProjection()):n=e}this.fitInternal(n,t)}rotatedExtentForGeometry(e){let t=this.getRotation(),n=Math.cos(t),r=Math.sin(-t),s=e.getFlatCoordinates(),o=e.getStride(),a=1/0,l=1/0,c=-1/0,u=-1/0;for(let f=0,d=s.length;f<d;f+=o){let A=s[f]*n-s[f+1]*r,y=s[f]*r+s[f+1]*n;a=Math.min(a,A),l=Math.min(l,y),c=Math.max(c,A),u=Math.max(u,y)}return[a,l,c,u]}fitInternal(e,t){t=t||{};let n=t.size;n||(n=this.getViewportSizeMinusPadding_());let r=t.padding!==void 0?t.padding:[0,0,0,0],s=t.nearest!==void 0?t.nearest:!1,o;t.minResolution!==void 0?o=t.minResolution:t.maxZoom!==void 0?o=this.getResolutionForZoom(t.maxZoom):o=0;let a=this.rotatedExtentForGeometry(e),l=this.getResolutionForExtentInternal(a,[n[0]-r[1]-r[3],n[1]-r[0]-r[2]]);l=isNaN(l)?o:Math.max(l,o),l=this.getConstrainedResolution(l,s?0:1);let c=this.getRotation(),u=Math.sin(c),f=Math.cos(c),d=dl(a);d[0]+=(r[1]-r[3])/2*l,d[1]+=(r[0]-r[2])/2*l;let A=d[0]*f-d[1]*u,y=d[1]*f+d[0]*u,w=this.getConstrainedCenter([A,y],l),S=t.callback?t.callback:td;t.duration!==void 0?this.animateInternal({resolution:l,center:w,duration:t.duration,easing:t.easing},S):(this.targetResolution_=l,this.targetCenter_=w,this.applyTargetState_(!1,!0),XE(S,!0))}centerOn(e,t,n){this.centerOnInternal(_u(e,this.getProjection()),t,n)}centerOnInternal(e,t,n){this.setCenterInternal(T5(e,t,n,this.getResolution(),this.getRotation()))}calculateCenterShift(e,t,n,r){let s,o=this.padding_;if(o&&e){let a=this.getViewportSizeMinusPadding_(-n),l=T5(e,r,[a[0]/2+o[3],a[1]/2+o[0]],t,n);s=[e[0]-l[0],e[1]-l[1]]}return s}isDef(){return!!this.getCenterInternal()&&this.getResolution()!==void 0}adjustCenter(e){let t=My(this.targetCenter_,this.getProjection());this.setCenter([t[0]+e[0],t[1]+e[1]])}adjustCenterInternal(e){let t=this.targetCenter_;this.setCenterInternal([t[0]+e[0],t[1]+e[1]])}adjustResolution(e,t){t=t&&_u(t,this.getProjection()),this.adjustResolutionInternal(e,t)}adjustResolutionInternal(e,t){let n=this.getAnimating()||this.getInteracting(),r=this.getViewportSize_(this.getRotation()),s=this.constraints_.resolution(this.targetResolution_*e,0,r,n);t&&(this.targetCenter_=this.calculateCenterZoom(s,t)),this.targetResolution_*=e,this.applyTargetState_()}adjustZoom(e,t){this.adjustResolution(Math.pow(this.zoomFactor_,-e),t)}adjustRotation(e,t){t&&(t=_u(t,this.getProjection())),this.adjustRotationInternal(e,t)}adjustRotationInternal(e,t){let n=this.getAnimating()||this.getInteracting(),r=this.constraints_.rotation(this.targetRotation_+e,n);t&&(this.targetCenter_=this.calculateCenterRotate(r,t)),this.targetRotation_+=e,this.applyTargetState_()}setCenter(e){this.setCenterInternal(e&&_u(e,this.getProjection()))}setCenterInternal(e){this.targetCenter_=e,this.applyTargetState_()}setHint(e,t){return this.hints_[e]+=t,this.changed(),this.hints_[e]}setResolution(e){this.targetResolution_=e,this.applyTargetState_()}setRotation(e){this.targetRotation_=e,this.applyTargetState_()}setZoom(e){this.setResolution(this.getResolutionForZoom(e))}applyTargetState_(e,t){let n=this.getAnimating()||this.getInteracting()||t,r=this.constraints_.rotation(this.targetRotation_,n),s=this.getViewportSize_(r),o=this.constraints_.resolution(this.targetResolution_,0,s,n),a=this.constraints_.center(this.targetCenter_,o,s,n,this.calculateCenterShift(this.targetCenter_,o,r,s));this.get(zc.ROTATION)!==r&&this.set(zc.ROTATION,r),this.get(zc.RESOLUTION)!==o&&(this.set(zc.RESOLUTION,o),this.set("zoom",this.getZoom(),!0)),(!a||!this.get(zc.CENTER)||!tA(this.get(zc.CENTER),a))&&this.set(zc.CENTER,a),this.getAnimating()&&!e&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(e,t,n){e=e!==void 0?e:200;let r=t||0,s=this.constraints_.rotation(this.targetRotation_),o=this.getViewportSize_(s),a=this.constraints_.resolution(this.targetResolution_,r,o),l=this.constraints_.center(this.targetCenter_,a,o,!1,this.calculateCenterShift(this.targetCenter_,a,s,o));if(e===0&&!this.cancelAnchor_){this.targetResolution_=a,this.targetRotation_=s,this.targetCenter_=l,this.applyTargetState_();return}n=n||(e===0?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,(this.getResolution()!==a||this.getRotation()!==s||!this.getCenterInternal()||!tA(this.getCenterInternal(),l))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:s,center:l,resolution:a,duration:e,easing:Lc,anchor:n}))}beginInteraction(){this.resolveConstraints(0),this.setHint(so.INTERACTING,1)}endInteraction(e,t,n){n=n&&_u(n,this.getProjection()),this.endInteractionInternal(e,t,n)}endInteractionInternal(e,t,n){this.getInteracting()&&(this.setHint(so.INTERACTING,-1),this.resolveConstraints(e,t,n))}getConstrainedCenter(e,t){let n=this.getViewportSize_(this.getRotation());return this.constraints_.center(e,t||this.getResolution(),n)}getConstrainedZoom(e,t){let n=this.getResolutionForZoom(e);return this.getZoomForResolution(this.getConstrainedResolution(n,t))}getConstrainedResolution(e,t){t=t||0;let n=this.getViewportSize_(this.getRotation());return this.constraints_.resolution(e,t,n)}};function XE(i,e){setTimeout(function(){i(e)},0)}function $pe(i){if(i.extent!==void 0){let t=i.smoothExtentConstraint!==void 0?i.smoothExtentConstraint:!0;return _5(i.extent,i.constrainOnlyCenter,t)}let e=tE(i.projection,"EPSG:3857");if(i.multiWorld!==!0&&e.isGlobal()){let t=e.getExtent().slice();return t[0]=-1/0,t[2]=1/0,_5(t,!1,!1)}return n$}function Ype(i){let e,t,n,o=i.minZoom!==void 0?i.minZoom:S5,a=i.maxZoom!==void 0?i.maxZoom:28,l=i.zoomFactor!==void 0?i.zoomFactor:2,c=i.multiWorld!==void 0?i.multiWorld:!1,u=i.smoothResolutionConstraint!==void 0?i.smoothResolutionConstraint:!0,f=i.showFullExtent!==void 0?i.showFullExtent:!1,d=tE(i.projection,"EPSG:3857"),A=d.getExtent(),y=i.constrainOnlyCenter,w=i.extent;if(!c&&!w&&d.isGlobal()&&(y=!1,w=A),i.resolutions!==void 0){let S=i.resolutions;t=S[o],n=S[a]!==void 0?S[a]:S[S.length-1],i.constrainResolution?e=i$(S,u,!y&&w,f):e=b5(t,n,u,!y&&w,f)}else{let T=(A?Math.max(Kn(A),Dr(A)):360*Kf.degrees/d.getMetersPerUnit())/256/Math.pow(2,S5),R=T/Math.pow(2,28-S5);t=i.maxResolution,t!==void 0?o=0:t=T/Math.pow(l,o),n=i.minResolution,n===void 0&&(i.maxZoom!==void 0?i.maxResolution!==void 0?n=t/Math.pow(l,a):n=T/Math.pow(l,a):n=R),a=o+Math.floor(Math.log(t/n)/Math.log(l)),n=t/Math.pow(l,a-o),i.constrainResolution?e=r$(l,t,n,u,!y&&w,f):e=b5(t,n,u,!y&&w,f)}return{constraint:e,maxResolution:t,minResolution:n,minZoom:o,zoomFactor:l}}function Zpe(i){if(i.enableRotation!==void 0?i.enableRotation:!0){let t=i.constrainRotation;return t===void 0||t===!0?o$():t===!1?w5:typeof t=="number"?s$(t):w5}return gv}function Kpe(i){return!(i.sourceCenter&&i.targetCenter&&!tA(i.sourceCenter,i.targetCenter)||i.sourceResolution!==i.targetResolution||i.sourceRotation!==i.targetRotation)}function T5(i,e,t,n,r){let s=Math.cos(-r),o=Math.sin(-r),a=i[0]*s-i[1]*o,l=i[1]*s+i[0]*o;a+=(e[0]/2-t[0])*n,l+=(t[1]-e[1]/2)*n,o=-o;let c=a*s-l*o,u=l*s+a*o;return[c,u]}var jl=E5;var M5=class extends zs{constructor(e){super();let t=e.element;t&&!e.target&&!t.style.pointerEvents&&(t.style.pointerEvents="auto"),this.element=t||null,this.target_=null,this.map_=null,this.listenerKeys=[],e.render&&(this.render=e.render),e.target&&this.setTarget(e.target)}disposeInternal(){this.element?.remove(),super.disposeInternal()}getMap(){return this.map_}setMap(e){this.map_&&this.element?.remove();for(let t=0,n=this.listenerKeys.length;t<n;++t)li(this.listenerKeys[t]);if(this.listenerKeys.length=0,this.map_=e,e){let t=this.target_??e.getOverlayContainerStopEvent();this.element&&t.appendChild(this.element),this.render!==td&&this.listenerKeys.push(qn(e,bh.POSTRENDER,this.render,this)),e.render()}}render(e){}setTarget(e){this.target_=typeof e=="string"?document.getElementById(e):e}},vv=M5;var C5=class extends vv{constructor(e){e=e||{},super({element:document.createElement("div"),render:e.render,target:e.target}),this.ulElement_=document.createElement("ul"),this.collapsed_=e.collapsed!==void 0?e.collapsed:!0,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=e.collapsible!==void 0,this.collapsible_=e.collapsible!==void 0?e.collapsible:!0,this.collapsible_||(this.collapsed_=!1),this.attributions_=e.attributions;let t=e.className!==void 0?e.className:"ol-attribution",n=e.tipLabel!==void 0?e.tipLabel:"Attributions",r=e.expandClassName!==void 0?e.expandClassName:t+"-expand",s=e.collapseLabel!==void 0?e.collapseLabel:"\u203A",o=e.collapseClassName!==void 0?e.collapseClassName:t+"-collapse";typeof s=="string"?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=s,this.collapseLabel_.className=o):this.collapseLabel_=s;let a=e.label!==void 0?e.label:"i";typeof a=="string"?(this.label_=document.createElement("span"),this.label_.textContent=a,this.label_.className=r):this.label_=a;let l=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_;this.toggleButton_=document.createElement("button"),this.toggleButton_.setAttribute("type","button"),this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_)),this.toggleButton_.title=n,this.toggleButton_.appendChild(l),this.toggleButton_.addEventListener(nn.CLICK,this.handleClick_.bind(this),!1);let c=t+" "+Op+" "+hv+(this.collapsed_&&this.collapsible_?" "+kN:"")+(this.collapsible_?"":" ol-uncollapsible"),u=this.element;u.className=c,u.appendChild(this.toggleButton_),u.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(e){let t=this.getMap().getAllLayers(),n=new Set(t.flatMap(r=>r.getAttributions(e)));if(this.attributions_!==void 0&&(Array.isArray(this.attributions_)?this.attributions_.forEach(r=>n.add(r)):n.add(this.attributions_)),!this.overrideCollapsible_){let r=!t.some(s=>s.getSource()?.getAttributionsCollapsible()===!1);this.setCollapsible(r)}return Array.from(n)}async updateElement_(e){if(!e){this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1);return}let t=await Promise.all(this.collectSourceAttributions_(e).map(r=>tj(()=>r))),n=t.length>0;if(this.renderedVisible_!=n&&(this.element.style.display=n?"":"none",this.renderedVisible_=n),!ea(t,this.renderedAttributions_)){lj(this.ulElement_);for(let r=0,s=t.length;r<s;++r){let o=document.createElement("li");o.innerHTML=t[r],this.ulElement_.appendChild(o)}this.renderedAttributions_=t}}handleClick_(e){e.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){this.element.classList.toggle(kN),this.collapsed_?ZD(this.collapseLabel_,this.label_):ZD(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_,this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_))}getCollapsible(){return this.collapsible_}setCollapsible(e){this.collapsible_!==e&&(this.collapsible_=e,this.element.classList.toggle("ol-uncollapsible"),this.userCollapsed_&&this.handleToggle_())}setCollapsed(e){this.userCollapsed_=e,!(!this.collapsible_||this.collapsed_===e)&&this.handleToggle_()}getCollapsed(){return this.collapsed_}render(e){this.updateElement_(e.frameState)}},a$=C5;var R5=class extends vv{constructor(e){e=e||{},super({element:document.createElement("div"),render:e.render,target:e.target});let t=e.className!==void 0?e.className:"ol-rotate",n=e.label!==void 0?e.label:"\u21E7",r=e.compassClassName!==void 0?e.compassClassName:"ol-compass";this.label_=null,typeof n=="string"?(this.label_=document.createElement("span"),this.label_.className=r,this.label_.textContent=n):(this.label_=n,this.label_.classList.add(r));let s=e.tipLabel?e.tipLabel:"Reset rotation",o=document.createElement("button");o.className=t+"-reset",o.setAttribute("type","button"),o.title=s,o.appendChild(this.label_),o.addEventListener(nn.CLICK,this.handleClick_.bind(this),!1);let a=t+" "+Op+" "+hv,l=this.element;l.className=a,l.appendChild(o),this.callResetNorth_=e.resetNorth?e.resetNorth:void 0,this.duration_=e.duration!==void 0?e.duration:250,this.autoHide_=e.autoHide!==void 0?e.autoHide:!0,this.rotation_=void 0,this.autoHide_&&this.element.classList.add($y)}handleClick_(e){e.preventDefault(),this.callResetNorth_!==void 0?this.callResetNorth_():this.resetNorth_()}resetNorth_(){let t=this.getMap().getView();if(!t)return;let n=t.getRotation();n!==void 0&&(this.duration_>0&&n%(2*Math.PI)!==0?t.animate({rotation:0,duration:this.duration_,easing:Lc}):t.setRotation(0))}render(e){let t=e.frameState;if(!t)return;let n=t.viewState.rotation;if(n!=this.rotation_){let r="rotate("+n+"rad)";if(this.autoHide_){let s=this.element.classList.contains($y);!s&&n===0?this.element.classList.add($y):s&&n!==0&&this.element.classList.remove($y)}this.label_.style.transform=r}this.rotation_=n}},l$=R5;var I5=class extends vv{constructor(e){e=e||{},super({element:document.createElement("div"),target:e.target});let t=e.className!==void 0?e.className:"ol-zoom",n=e.delta!==void 0?e.delta:1,r=e.zoomInClassName!==void 0?e.zoomInClassName:t+"-in",s=e.zoomOutClassName!==void 0?e.zoomOutClassName:t+"-out",o=e.zoomInLabel!==void 0?e.zoomInLabel:"+",a=e.zoomOutLabel!==void 0?e.zoomOutLabel:"\u2013",l=e.zoomInTipLabel!==void 0?e.zoomInTipLabel:"Zoom in",c=e.zoomOutTipLabel!==void 0?e.zoomOutTipLabel:"Zoom out",u=document.createElement("button");u.className=r,u.setAttribute("type","button"),u.title=l,u.appendChild(typeof o=="string"?document.createTextNode(o):o),u.addEventListener(nn.CLICK,this.handleClick_.bind(this,n),!1);let f=document.createElement("button");f.className=s,f.setAttribute("type","button"),f.title=c,f.appendChild(typeof a=="string"?document.createTextNode(a):a),f.addEventListener(nn.CLICK,this.handleClick_.bind(this,-n),!1);let d=t+" "+Op+" "+hv,A=this.element;A.className=d,A.appendChild(u),A.appendChild(f),this.duration_=e.duration!==void 0?e.duration:250}handleClick_(e,t){t.preventDefault(),this.zoomByDelta_(e)}zoomByDelta_(e){let n=this.getMap().getView();if(!n)return;let r=n.getZoom();if(r!==void 0){let s=n.getConstrainedZoom(r+e);this.duration_>0?(n.getAnimating()&&n.cancelAnimations(),n.animate({zoom:s,duration:this.duration_,easing:Lc})):n.setZoom(s)}}},c$=I5;function $E(i){i=i||{};let e=new No;return(i.zoom===void 0||i.zoom)&&e.push(new c$(i.zoomOptions)),(i.rotate===void 0||i.rotate)&&e.push(new l$(i.rotateOptions)),(i.attribution===void 0||i.attribution)&&e.push(new a$(i.attributionOptions)),e}var P5=class{constructor(e,t,n){this.decay_=e,this.minVelocity_=t,this.delay_=n,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(e,t){this.points_.push(e,t,Date.now())}end(){if(this.points_.length<6)return!1;let e=Date.now()-this.delay_,t=this.points_.length-3;if(this.points_[t+2]<e)return!1;let n=t-3;for(;n>0&&this.points_[n+2]>e;)n-=3;let r=this.points_[t+2]-this.points_[n+2];if(r<1e3/60)return!1;let s=this.points_[t]-this.points_[n],o=this.points_[t+1]-this.points_[n+1];return this.angle_=Math.atan2(o,s),this.initialVelocity_=Math.sqrt(s*s+o*o)/r,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}},u$=P5;var L5={ACTIVE:"active"};var D5=class extends zs{constructor(e){super(),this.on,this.once,this.un,e&&e.handleEvent&&(this.handleEvent=e.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get(L5.ACTIVE)}getMap(){return this.map_}handleEvent(e){return!0}setActive(e){this.set(L5.ACTIVE,e)}setMap(e){this.map_=e}};function h$(i,e,t){let n=i.getCenterInternal();if(n){let r=[n[0]+e[0],n[1]+e[1]];i.animateInternal({duration:t!==void 0?t:250,easing:aj,center:i.getConstrainedCenter(r)})}}function _v(i,e,t,n){let r=i.getZoom();if(r===void 0)return;let s=i.getConstrainedZoom(r+e),o=i.getResolutionForZoom(s);i.getAnimating()&&i.cancelAnimations(),i.animate({resolution:o,anchor:t,duration:n!==void 0?n:250,easing:Lc})}var wh=D5;var N5=class extends wh{constructor(e){super(),e=e||{},this.delta_=e.delta?e.delta:1,this.duration_=e.duration!==void 0?e.duration:250}handleEvent(e){let t=!1;if(e.type==gr.DBLCLICK){let n=e.originalEvent,r=e.map,s=e.coordinate,o=n.shiftKey?-this.delta_:this.delta_,a=r.getView();_v(a,o,s,this.duration_),n.preventDefault(),t=!0}return!t}},f$=N5;function n2(i){let e=arguments;return function(t){let n=!0;for(let r=0,s=e.length;r<s&&(n=n&&e[r](t),!!n);++r);return n}}var d$=function(i){let e=i.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},Qpe=function(i){let e=i.map.getTargetElement(),t=e.getRootNode(),n=i.map.getOwnerDocument().activeElement;return t instanceof ShadowRoot?t.host.contains(n):e.contains(n)},YE=function(i){let e=i.map.getTargetElement(),t=e.getRootNode();return(t instanceof ShadowRoot?t.host:e).hasAttribute("tabindex")?Qpe(i):!0},p$=Jf;var ZE=function(i){let e=i.originalEvent;return"pointerId"in e&&e.button==0&&!(nj&&WD&&e.ctrlKey)};var KE=function(i){let e=i.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey};var m$=function(i){let e=i.originalEvent;return WD?e.metaKey:e.ctrlKey},A$=function(i){let e=i.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},QE=function(i){let e=i.originalEvent,t=e.target.tagName;return t!=="INPUT"&&t!=="SELECT"&&t!=="TEXTAREA"&&!e.target.isContentEditable},JE=function(i){let e=i.originalEvent;return"pointerId"in e&&e.pointerType=="mouse"};var g$=function(i){let e=i.originalEvent;return"pointerId"in e&&e.isPrimary&&e.button===0};var F5=class extends wh{constructor(e){e=e||{},super(e),e.handleDownEvent&&(this.handleDownEvent=e.handleDownEvent),e.handleDragEvent&&(this.handleDragEvent=e.handleDragEvent),e.handleMoveEvent&&(this.handleMoveEvent=e.handleMoveEvent),e.handleUpEvent&&(this.handleUpEvent=e.handleUpEvent),e.stopDown&&(this.stopDown=e.stopDown),this.handlingDownUpSequence=!1,this.targetPointers=[]}getPointerCount(){return this.targetPointers.length}handleDownEvent(e){return!1}handleDragEvent(e){}handleEvent(e){if(!e.originalEvent)return!0;let t=!1;if(this.updateTrackedPointers_(e),this.handlingDownUpSequence){if(e.type==gr.POINTERDRAG)this.handleDragEvent(e),e.originalEvent.preventDefault();else if(e.type==gr.POINTERUP){let n=this.handleUpEvent(e);this.handlingDownUpSequence=n&&this.targetPointers.length>0}}else if(e.type==gr.POINTERDOWN){let n=this.handleDownEvent(e);this.handlingDownUpSequence=n,t=this.stopDown(n)}else e.type==gr.POINTERMOVE&&this.handleMoveEvent(e);return!t}handleMoveEvent(e){}handleUpEvent(e){return!1}stopDown(e){return e}updateTrackedPointers_(e){e.activePointers&&(this.targetPointers=e.activePointers)}};function xv(i){let e=i.length,t=0,n=0;for(let r=0;r<e;r++)t+=i[r].clientX,n+=i[r].clientY;return{clientX:t/e,clientY:n/e}}var Sh=F5;var B5=class extends Sh{constructor(e){super({stopDown:ed}),e=e||{},this.kinetic_=e.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;let t=e.condition?e.condition:n2(KE,g$);this.condition_=e.onFocusOnly?n2(YE,t):t,this.noKinetic_=!1}handleDragEvent(e){let t=e.map;this.panning_||(this.panning_=!0,t.getView().beginInteraction());let n=this.targetPointers,r=t.getEventPixel(xv(n));if(n.length==this.lastPointersCount_){if(this.kinetic_&&this.kinetic_.update(r[0],r[1]),this.lastCentroid){let s=[this.lastCentroid[0]-r[0],r[1]-this.lastCentroid[1]],a=e.map.getView();AW(s,a.getResolution()),X1(s,a.getRotation()),a.adjustCenterInternal(s)}}else this.kinetic_&&this.kinetic_.begin();this.lastCentroid=r,this.lastPointersCount_=n.length,e.originalEvent.preventDefault()}handleUpEvent(e){let t=e.map,n=t.getView();if(this.targetPointers.length===0){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){let r=this.kinetic_.getDistance(),s=this.kinetic_.getAngle(),o=n.getCenterInternal(),a=t.getPixelFromCoordinateInternal(o),l=t.getCoordinateFromPixelInternal([a[0]-r*Math.cos(s),a[1]-r*Math.sin(s)]);n.animateInternal({center:n.getConstrainedCenter(l),duration:500,easing:Lc})}return this.panning_&&(this.panning_=!1,n.endInteraction()),!1}return this.kinetic_&&this.kinetic_.begin(),this.lastCentroid=null,!0}handleDownEvent(e){if(this.targetPointers.length>0&&this.condition_(e)){let n=e.map.getView();return this.lastCentroid=null,n.getAnimating()&&n.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}},v$=B5;var O5=class extends Sh{constructor(e){e=e||{},super({stopDown:ed}),this.condition_=e.condition?e.condition:d$,this.lastAngle_=void 0,this.duration_=e.duration!==void 0?e.duration:250}handleDragEvent(e){if(!JE(e))return;let t=e.map,n=t.getView();if(n.getConstraints().rotation===gv)return;let r=t.getSize(),s=e.pixel,o=Math.atan2(r[1]/2-s[1],s[0]-r[0]/2);if(this.lastAngle_!==void 0){let a=o-this.lastAngle_;n.adjustRotationInternal(-a)}this.lastAngle_=o}handleUpEvent(e){return JE(e)?(e.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(e){return JE(e)&&ZE(e)&&this.condition_(e)?(e.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}},_$=O5;var U5=class extends Ip{constructor(e){super(),this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.style.pointerEvents="auto",this.element_.className="ol-box "+e,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){let e=this.startPixel_,t=this.endPixel_,n="px",r=this.element_.style;r.left=Math.min(e[0],t[0])+n,r.top=Math.min(e[1],t[1])+n,r.width=Math.abs(t[0]-e[0])+n,r.height=Math.abs(t[1]-e[1])+n}setMap(e){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);let t=this.element_.style;t.left="inherit",t.top="inherit",t.width="inherit",t.height="inherit"}this.map_=e,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)}setPixels(e,t){this.startPixel_=e,this.endPixel_=t,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){if(!this.map_)return;let e=this.startPixel_,t=this.endPixel_,r=[e,[e[0],t[1]],t,[t[0],e[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);r[4]=r[0].slice(),this.geometry_?this.geometry_.setCoordinates([r]):this.geometry_=new vh([r])}getGeometry(){return this.geometry_}},x$=U5;var yv={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"},SA=class extends Ao{constructor(e,t,n){super(e),this.coordinate=t,this.mapBrowserEvent=n}},k5=class extends Sh{constructor(e){super(),this.on,this.once,this.un,e=e??{},this.box_=new x$(e.className||"ol-dragbox"),this.minArea_=e.minArea??64,e.onBoxEnd&&(this.onBoxEnd=e.onBoxEnd),this.startPixel_=null,this.condition_=e.condition??ZE,this.boxEndCondition_=e.boxEndCondition??this.defaultBoxEndCondition}defaultBoxEndCondition(e,t,n){let r=n[0]-t[0],s=n[1]-t[1];return r*r+s*s>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(e){this.startPixel_&&(this.box_.setPixels(this.startPixel_,e.pixel),this.dispatchEvent(new SA(yv.BOXDRAG,e.coordinate,e)))}handleUpEvent(e){if(!this.startPixel_)return!1;let t=this.boxEndCondition_(e,this.startPixel_,e.pixel);return t&&this.onBoxEnd(e),this.dispatchEvent(new SA(t?yv.BOXEND:yv.BOXCANCEL,e.coordinate,e)),this.box_.setMap(null),this.startPixel_=null,!1}handleDownEvent(e){return this.condition_(e)?(this.startPixel_=e.pixel,this.box_.setMap(e.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new SA(yv.BOXSTART,e.coordinate,e)),!0):!1}onBoxEnd(e){}setActive(e){e||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new SA(yv.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setActive(e)}setMap(e){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new SA(yv.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setMap(e)}},y$=k5;var z5=class extends y${constructor(e){e=e||{};let t=e.condition?e.condition:A$;super({condition:t,className:e.className||"ol-dragzoom",minArea:e.minArea}),this.duration_=e.duration!==void 0?e.duration:200,this.out_=e.out!==void 0?e.out:!1}onBoxEnd(e){let n=this.getMap().getView(),r=this.getGeometry();if(this.out_){let s=n.rotatedExtentForGeometry(r),o=n.getResolutionForExtentInternal(s),a=n.getResolution()/o;r=r.clone(),r.scale(a*a)}n.fitInternal(r,{duration:this.duration_,easing:Lc})}},b$=z5;var Vp={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown"};var V5=class extends wh{constructor(e){super(),e=e||{},this.defaultCondition_=function(t){return KE(t)&&QE(t)},this.condition_=e.condition!==void 0?e.condition:this.defaultCondition_,this.duration_=e.duration!==void 0?e.duration:100,this.pixelDelta_=e.pixelDelta!==void 0?e.pixelDelta:128}handleEvent(e){let t=!1;if(e.type==nn.KEYDOWN){let n=e.originalEvent,r=n.key;if(this.condition_(e)&&(r==Vp.DOWN||r==Vp.LEFT||r==Vp.RIGHT||r==Vp.UP)){let o=e.map.getView(),a=o.getResolution()*this.pixelDelta_,l=0,c=0;r==Vp.DOWN?c=-a:r==Vp.LEFT?l=-a:r==Vp.RIGHT?l=a:c=a;let u=[l,c];X1(u,o.getRotation()),h$(o,u,this.duration_),n.preventDefault(),t=!0}}return!t}},w$=V5;var G5=class extends wh{constructor(e){super(),e=e||{},this.condition_=e.condition?e.condition:function(t){return!m$(t)&&QE(t)},this.delta_=e.delta?e.delta:1,this.duration_=e.duration!==void 0?e.duration:100}handleEvent(e){let t=!1;if(e.type==nn.KEYDOWN||e.type==nn.KEYPRESS){let n=e.originalEvent,r=n.key;if(this.condition_(e)&&(r==="+"||r==="-")){let s=e.map,o=r==="+"?this.delta_:-this.delta_,a=s.getView();_v(a,o,void 0,this.duration_),n.preventDefault(),t=!0}}return!t}},S$=G5;var Jpe=40,e0e=300,t0e=3,q5=class extends wh{constructor(e){e=e||{},super(e),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=e.maxDelta!==void 0?e.maxDelta:1,this.duration_=e.duration!==void 0?e.duration:250,this.timeout_=e.timeout!==void 0?e.timeout:80,this.useAnchor_=e.useAnchor!==void 0?e.useAnchor:!0,this.constrainResolution_=e.constrainResolution!==void 0?e.constrainResolution:!1;let t=e.condition?e.condition:p$;this.condition_=e.onFocusOnly?n2(YE,t):t,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300,this.ctrlKeyPressed_=!1,this.ctrlKeyListenerKeys_=[]}setMap(e){if(this.ctrlKeyListenerKeys_.forEach(li),this.ctrlKeyListenerKeys_.length=0,this.ctrlKeyPressed_=!1,super.setMap(e),e){let t=e.getOwnerDocument();this.ctrlKeyListenerKeys_.push(qn(t,"keydown",n=>{n.key==="Control"&&(this.ctrlKeyPressed_=!0)}),qn(t,"keyup",n=>{n.key==="Control"&&(this.ctrlKeyPressed_=!1)}))}}endInteraction_(){this.trackpadTimeoutId_=void 0;let e=this.getMap();if(!e)return;let t=e.getView(),n=this.lastDelta_?this.lastDelta_>0?1:-1:0;t.endInteraction(this.constrainResolution_||t.getConstrainResolution()?100:void 0,n,this.lastAnchor_?e.getCoordinateFromPixel(this.lastAnchor_):null)}handleEvent(e){if(!this.condition_(e)||e.type!==nn.WHEEL)return!0;let n=e.map,r=e.originalEvent;r.preventDefault();let s=r.ctrlKey&&!this.ctrlKeyPressed_;r.ctrlKey||(this.ctrlKeyPressed_=!1),this.useAnchor_&&(this.lastAnchor_=e.pixel);let o=r.deltaY;switch(r.deltaMode){case WheelEvent.DOM_DELTA_LINE:o*=Jpe;break;case WheelEvent.DOM_DELTA_PAGE:o*=e0e;break;default:}if(o===0)return!1;this.lastDelta_=o;let a=Date.now();this.startTime_===void 0&&(this.startTime_=a),(!this.mode_||a-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(o)<4?"trackpad":"wheel");let l=n.getView();if(this.mode_==="trackpad")return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(l.getAnimating()&&l.cancelAnimations(),l.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),s&&(o=o*t0e),l.adjustZoom(-o/this.deltaPerZoom_,this.lastAnchor_?n.getCoordinateFromPixel(this.lastAnchor_):null),this.startTime_=a,!1;this.totalDelta_+=o;let c=Math.max(this.timeout_-(a-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,n),c),!1}handleWheelZoom_(e){let t=e.getView();t.getAnimating()&&t.cancelAnimations();let n=-Si(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(t.getConstrainResolution()||this.constrainResolution_)&&(n=n?n>0?1:-1:0),_v(t,n,this.lastAnchor_?e.getCoordinateFromPixel(this.lastAnchor_):null,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(e){this.useAnchor_=e,e||(this.lastAnchor_=null)}},T$=q5;var H5=class extends Sh{constructor(e){e=e||{};let t=e;t.stopDown||(t.stopDown=ed),super(t),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=e.threshold!==void 0?e.threshold:.3,this.duration_=e.duration!==void 0?e.duration:250}handleDragEvent(e){let t=0,n=this.targetPointers[0],r=this.targetPointers[1],s=Math.atan2(r.clientY-n.clientY,r.clientX-n.clientX);if(this.lastAngle_!==void 0){let l=s-this.lastAngle_;this.rotationDelta_+=l,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),t=l}this.lastAngle_=s;let o=e.map,a=o.getView();a.getConstraints().rotation!==gv&&(this.anchor_=o.getCoordinateFromPixelInternal(o.getEventPixel(xv(this.targetPointers))),this.rotating_&&(o.render(),a.adjustRotationInternal(t,this.anchor_)))}handleUpEvent(e){return this.targetPointers.length<2?(e.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(e){if(this.targetPointers.length>=2){let t=e.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||t.getView().beginInteraction(),!0}return!1}},E$=H5;var W5=class extends Sh{constructor(e){e=e||{};let t=e;t.stopDown||(t.stopDown=ed),super(t),this.anchor_=null,this.duration_=e.duration!==void 0?e.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(e){let t=1,n=this.targetPointers[0],r=this.targetPointers[1],s=n.clientX-r.clientX,o=n.clientY-r.clientY,a=Math.sqrt(s*s+o*o);this.lastDistance_!==void 0&&(t=this.lastDistance_/a),this.lastDistance_=a;let l=e.map,c=l.getView();t!=1&&(this.lastScaleDelta_=t),this.anchor_=l.getCoordinateFromPixelInternal(l.getEventPixel(xv(this.targetPointers))),l.render(),c.adjustResolutionInternal(t,this.anchor_)}handleUpEvent(e){if(this.targetPointers.length<2){let n=e.map.getView(),r=this.lastScaleDelta_>1?1:-1;return n.endInteraction(this.duration_,r),!1}return!0}handleDownEvent(e){if(this.targetPointers.length>=2){let t=e.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||t.getView().beginInteraction(),!0}return!1}},M$=W5;function e3(i){i=i||{};let e=new No,t=new u$(-.005,.05,100);return(i.altShiftDragRotate===void 0||i.altShiftDragRotate)&&e.push(new _$),(i.doubleClickZoom===void 0||i.doubleClickZoom)&&e.push(new f$({delta:i.zoomDelta,duration:i.zoomDuration})),(i.dragPan===void 0||i.dragPan)&&e.push(new v$({onFocusOnly:i.onFocusOnly,kinetic:t})),(i.pinchRotate===void 0||i.pinchRotate)&&e.push(new E$),(i.pinchZoom===void 0||i.pinchZoom)&&e.push(new M$({duration:i.zoomDuration})),(i.keyboard===void 0||i.keyboard)&&(e.push(new w$),e.push(new S$({delta:i.zoomDelta,duration:i.zoomDuration}))),(i.mouseWheelZoom===void 0||i.mouseWheelZoom)&&e.push(new T$({onFocusOnly:i.onFocusOnly,duration:i.zoomDuration})),(i.shiftDragZoom===void 0||i.shiftDragZoom)&&e.push(new b$({duration:i.zoomDuration})),e}var Ni={OPACITY:"opacity",VISIBLE:"visible",EXTENT:"extent",Z_INDEX:"zIndex",MAX_RESOLUTION:"maxResolution",MIN_RESOLUTION:"minResolution",MAX_ZOOM:"maxZoom",MIN_ZOOM:"minZoom",SOURCE:"source",MAP:"map"};var j5=class extends zs{constructor(e){super(),this.on,this.once,this.un,this.background_=e.background;let t=Object.assign({},e);typeof e.properties=="object"&&(delete t.properties,Object.assign(t,e.properties)),t[Ni.OPACITY]=e.opacity!==void 0?e.opacity:1,jn(typeof t[Ni.OPACITY]=="number","Layer opacity must be a number"),t[Ni.VISIBLE]=e.visible!==void 0?e.visible:!0,t[Ni.Z_INDEX]=e.zIndex,t[Ni.MAX_RESOLUTION]=e.maxResolution!==void 0?e.maxResolution:1/0,t[Ni.MIN_RESOLUTION]=e.minResolution!==void 0?e.minResolution:0,t[Ni.MIN_ZOOM]=e.minZoom!==void 0?e.minZoom:-1/0,t[Ni.MAX_ZOOM]=e.maxZoom!==void 0?e.maxZoom:1/0,this.className_=t.className!==void 0?t.className:"ol-layer",delete t.className,this.setProperties(t),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(e){let t=this.state_||{layer:this,managed:e===void 0?!0:e},n=this.getZIndex();return t.opacity=Si(Math.round(this.getOpacity()*100)/100,0,1),t.visible=this.getVisible(),t.extent=this.getExtent(),t.zIndex=n===void 0&&!t.managed?1/0:n,t.maxResolution=this.getMaxResolution(),t.minResolution=Math.max(this.getMinResolution(),0),t.minZoom=this.getMinZoom(),t.maxZoom=this.getMaxZoom(),this.state_=t,t}getLayersArray(e){return ei()}getLayerStatesArray(e){return ei()}getExtent(){return this.get(Ni.EXTENT)}getMaxResolution(){return this.get(Ni.MAX_RESOLUTION)}getMinResolution(){return this.get(Ni.MIN_RESOLUTION)}getMinZoom(){return this.get(Ni.MIN_ZOOM)}getMaxZoom(){return this.get(Ni.MAX_ZOOM)}getOpacity(){return this.get(Ni.OPACITY)}getSourceState(){return ei()}getVisible(){return this.get(Ni.VISIBLE)}getZIndex(){return this.get(Ni.Z_INDEX)}setBackground(e){this.background_=e,this.changed()}setExtent(e){this.set(Ni.EXTENT,e)}setMaxResolution(e){this.set(Ni.MAX_RESOLUTION,e)}setMinResolution(e){this.set(Ni.MIN_RESOLUTION,e)}setMaxZoom(e){this.set(Ni.MAX_ZOOM,e)}setMinZoom(e){this.set(Ni.MIN_ZOOM,e)}setOpacity(e){jn(typeof e=="number","Layer opacity must be a number"),this.set(Ni.OPACITY,e)}setVisible(e){this.set(Ni.VISIBLE,e)}setZIndex(e){this.set(Ni.Z_INDEX,e)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}},t3=j5;var Gp={ADDLAYER:"addlayer",REMOVELAYER:"removelayer"},Su=class extends Ao{constructor(e,t){super(e),this.layer=t}},X5={LAYERS:"layers"},$5=class i extends t3{constructor(e){e=e||{};let t=Object.assign({},e);delete t.layers;let n=e.layers;super(t),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(X5.LAYERS,this.handleLayersChanged_),n?Array.isArray(n)?n=new No(n.slice(),{unique:!0}):jn(typeof n.getArray=="function","Expected `layers` to be an array or a `Collection`"):n=new No(void 0,{unique:!0}),this.setLayers(n)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(li),this.layersListenerKeys_.length=0;let e=this.getLayers();this.layersListenerKeys_.push(qn(e,vo.ADD,this.handleLayersAdd_,this),qn(e,vo.REMOVE,this.handleLayersRemove_,this));for(let n in this.listenerKeys_)this.listenerKeys_[n].forEach(li);mh(this.listenerKeys_);let t=e.getArray();for(let n=0,r=t.length;n<r;n++){let s=t[n];this.registerLayerListeners_(s),this.dispatchEvent(new Su(Gp.ADDLAYER,s))}this.changed()}registerLayerListeners_(e){let t=[qn(e,yu.PROPERTYCHANGE,this.handleLayerChange_,this),qn(e,nn.CHANGE,this.handleLayerChange_,this)];e instanceof i&&t.push(qn(e,Gp.ADDLAYER,this.handleLayerGroupAdd_,this),qn(e,Gp.REMOVELAYER,this.handleLayerGroupRemove_,this)),this.listenerKeys_[Bn(e)]=t}handleLayerGroupAdd_(e){this.dispatchEvent(new Su(Gp.ADDLAYER,e.layer))}handleLayerGroupRemove_(e){this.dispatchEvent(new Su(Gp.REMOVELAYER,e.layer))}handleLayersAdd_(e){let t=e.element;this.registerLayerListeners_(t),this.dispatchEvent(new Su(Gp.ADDLAYER,t)),this.changed()}handleLayersRemove_(e){let t=e.element,n=Bn(t);this.listenerKeys_[n].forEach(li),delete this.listenerKeys_[n],this.dispatchEvent(new Su(Gp.REMOVELAYER,t)),this.changed()}getLayers(){return this.get(X5.LAYERS)}setLayers(e){let t=this.getLayers();if(t){let n=t.getArray();for(let r=0,s=n.length;r<s;++r)this.dispatchEvent(new Su(Gp.REMOVELAYER,n[r]))}this.set(X5.LAYERS,e)}getLayersArray(e){return e=e!==void 0?e:[],this.getLayers().forEach(function(t){t.getLayersArray(e)}),e}getLayerStatesArray(e){let t=e!==void 0?e:[],n=t.length;this.getLayers().forEach(function(o){o.getLayerStatesArray(t)});let r=this.getLayerState(),s=r.zIndex;!e&&r.zIndex===void 0&&(s=0);for(let o=n,a=t.length;o<a;o++){let l=t[o];l.opacity*=r.opacity,l.visible=l.visible&&r.visible,l.maxResolution=Math.min(l.maxResolution,r.maxResolution),l.minResolution=Math.max(l.minResolution,r.minResolution),l.minZoom=Math.max(l.minZoom,r.minZoom),l.maxZoom=Math.min(l.maxZoom,r.maxZoom),r.extent!==void 0&&(l.extent!==void 0?l.extent=fh(l.extent,r.extent):l.extent=r.extent),l.zIndex===void 0&&(l.zIndex=s)}return t}getSourceState(){return"ready"}},i2=$5;var Bo={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"};var Y5=class extends t3{constructor(e){let t=Object.assign({},e);delete t.source,super(t),this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.sourceReady_=!1,this.rendered=!1,e.render&&(this.render=e.render),e.map&&this.setMap(e.map),this.addChangeListener(Ni.SOURCE,this.handleSourcePropertyChange_);let n=e.source?e.source:null;this.setSource(n)}getLayersArray(e){return e=e||[],e.push(this),e}getLayerStatesArray(e){return e=e||[],e.push(this.getLayerState()),e}getSource(){return this.get(Ni.SOURCE)||null}getRenderSource(){return this.getSource()}getSourceState(){let e=this.getSource();return e?e.getState():"undefined"}handleSourceChange_(){this.changed(),!(this.sourceReady_||this.getSource().getState()!=="ready")&&(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(li(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;let e=this.getSource();e&&(this.sourceChangeKey_=qn(e,nn.CHANGE,this.handleSourceChange_,this),e.getState()==="ready"&&(this.sourceReady_=!0,setTimeout(()=>{this.dispatchEvent("sourceready")},0))),this.changed()}getFeatures(e){return this.renderer_?this.renderer_.getFeatures(e):Promise.resolve([])}getData(e){return!this.renderer_||!this.rendered?null:this.renderer_.getData(e)}isVisible(e){let t,n=this.getMapInternal();!e&&n&&(e=n.getView()),e instanceof jl?t={viewState:e.getState(),extent:e.calculateExtent()}:t=e,!t.layerStatesArray&&n&&(t.layerStatesArray=n.getLayerGroup().getLayerStatesArray());let r;if(t.layerStatesArray){if(r=t.layerStatesArray.find(o=>o.layer===this),!r)return!1}else r=this.getLayerState();let s=this.getExtent();return r2(r,t.viewState)&&(!s||Ar(s,t.extent))}getAttributions(e){if(!this.isVisible(e))return[];let t=this.getSource()?.getAttributions();if(!t)return[];let n=e instanceof jl?e.getViewStateAndExtent():e,r=t(n);return Array.isArray(r)||(r=[r]),r}render(e,t){let n=this.getRenderer();return n.prepareFrame(e)?(this.rendered=!0,n.renderFrame(e,t)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(e,t){}renderDeferred(e){let t=this.getRenderer();t&&t.renderDeferred(e)}setMapInternal(e){e||this.unrender(),this.set(Ni.MAP,e)}getMapInternal(){return this.get(Ni.MAP)}setMap(e){this.mapPrecomposeKey_&&(li(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),e||this.changed(),this.mapRenderKey_&&(li(this.mapRenderKey_),this.mapRenderKey_=null),e&&(this.mapPrecomposeKey_=qn(e,Bo.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=qn(this,nn.CHANGE,e.render,e),this.changed())}handlePrecompose_(e){let t=e.frameState.layerStatesArray,n=this.getLayerState(!1);jn(!t.some(r=>r.layer===n.layer),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),t.push(n)}setSource(e){this.set(Ni.SOURCE,e)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}clearRenderer(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_)}disposeInternal(){this.clearRenderer(),this.setSource(null),super.disposeInternal()}};function r2(i,e){if(!i.visible)return!1;let t=e.resolution;if(t<i.minResolution||t>=i.maxResolution)return!1;let n=e.zoom;return n>i.minZoom&&n<=i.maxZoom}var TA=Y5;function n3(i,e,t=0,n=i.length-1,r=n0e){for(;n>t;){if(n-t>600){let l=n-t+1,c=e-t+1,u=Math.log(l),f=.5*Math.exp(2*u/3),d=.5*Math.sqrt(u*f*(l-f)/l)*(c-l/2<0?-1:1),A=Math.max(t,Math.floor(e-c*f/l+d)),y=Math.min(n,Math.floor(e+(l-c)*f/l+d));n3(i,e,A,y,r)}let s=i[e],o=t,a=n;for(s2(i,t,e),r(i[n],s)>0&&s2(i,t,n);o<a;){for(s2(i,o,a),o++,a--;r(i[o],s)<0;)o++;for(;r(i[a],s)>0;)a--}r(i[t],s)===0?s2(i,t,a):(a++,s2(i,a,n)),a<=e&&(t=a+1),e<=a&&(n=a-1)}}function s2(i,e,t){let n=i[e];i[e]=i[t],i[t]=n}function n0e(i,e){return i<e?-1:i>e?1:0}var EA=class{constructor(e=9){this._maxEntries=Math.max(4,e),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(e){let t=this.data,n=[];if(!r3(e,t))return n;let r=this.toBBox,s=[];for(;t;){for(let o=0;o<t.children.length;o++){let a=t.children[o],l=t.leaf?r(a):a;r3(e,l)&&(t.leaf?n.push(a):K5(e,l)?this._all(a,n):s.push(a))}t=s.pop()}return n}collides(e){let t=this.data;if(!r3(e,t))return!1;let n=[];for(;t;){for(let r=0;r<t.children.length;r++){let s=t.children[r],o=t.leaf?this.toBBox(s):s;if(r3(e,o)){if(t.leaf||K5(e,o))return!0;n.push(s)}}t=n.pop()}return!1}load(e){if(!(e&&e.length))return this;if(e.length<this._minEntries){for(let n=0;n<e.length;n++)this.insert(e[n]);return this}let t=this._build(e.slice(),0,e.length-1,0);if(!this.data.children.length)this.data=t;else if(this.data.height===t.height)this._splitRoot(this.data,t);else{if(this.data.height<t.height){let n=this.data;this.data=t,t=n}this._insert(t,this.data.height-t.height-1,!0)}return this}insert(e){return e&&this._insert(e,this.data.height-1),this}clear(){return this.data=wv([]),this}remove(e,t){if(!e)return this;let n=this.data,r=this.toBBox(e),s=[],o=[],a,l,c;for(;n||s.length;){if(n||(n=s.pop(),l=s[s.length-1],a=o.pop(),c=!0),n.leaf){let u=i0e(e,n.children,t);if(u!==-1)return n.children.splice(u,1),s.push(n),this._condense(s),this}!c&&!n.leaf&&K5(n,r)?(s.push(n),o.push(a),a=0,l=n,n=n.children[0]):l?(a++,n=l.children[a],c=!1):n=null}return this}toBBox(e){return e}compareMinX(e,t){return e.minX-t.minX}compareMinY(e,t){return e.minY-t.minY}toJSON(){return this.data}fromJSON(e){return this.data=e,this}_all(e,t){let n=[];for(;e;)e.leaf?t.push(...e.children):n.push(...e.children),e=n.pop();return t}_build(e,t,n,r){let s=n-t+1,o=this._maxEntries,a;if(s<=o)return a=wv(e.slice(t,n+1)),bv(a,this.toBBox),a;r||(r=Math.ceil(Math.log(s)/Math.log(o)),o=Math.ceil(s/Math.pow(o,r-1))),a=wv([]),a.leaf=!1,a.height=r;let l=Math.ceil(s/o),c=l*Math.ceil(Math.sqrt(o));C$(e,t,n,c,this.compareMinX);for(let u=t;u<=n;u+=c){let f=Math.min(u+c-1,n);C$(e,u,f,l,this.compareMinY);for(let d=u;d<=f;d+=l){let A=Math.min(d+l-1,f);a.children.push(this._build(e,d,A,r-1))}}return bv(a,this.toBBox),a}_chooseSubtree(e,t,n,r){for(;r.push(t),!(t.leaf||r.length-1===n);){let s=1/0,o=1/0,a;for(let l=0;l<t.children.length;l++){let c=t.children[l],u=Z5(c),f=o0e(e,c)-u;f<o?(o=f,s=u<s?u:s,a=c):f===o&&u<s&&(s=u,a=c)}t=a||t.children[0]}return t}_insert(e,t,n){let r=n?e:this.toBBox(e),s=[],o=this._chooseSubtree(r,this.data,t,s);for(o.children.push(e),a2(o,r);t>=0&&s[t].children.length>this._maxEntries;)this._split(s,t),t--;this._adjustParentBBoxes(r,s,t)}_split(e,t){let n=e[t],r=n.children.length,s=this._minEntries;this._chooseSplitAxis(n,s,r);let o=this._chooseSplitIndex(n,s,r),a=wv(n.children.splice(o,n.children.length-o));a.height=n.height,a.leaf=n.leaf,bv(n,this.toBBox),bv(a,this.toBBox),t?e[t-1].children.push(a):this._splitRoot(n,a)}_splitRoot(e,t){this.data=wv([e,t]),this.data.height=e.height+1,this.data.leaf=!1,bv(this.data,this.toBBox)}_chooseSplitIndex(e,t,n){let r,s=1/0,o=1/0;for(let a=t;a<=n-t;a++){let l=o2(e,0,a,this.toBBox),c=o2(e,a,n,this.toBBox),u=a0e(l,c),f=Z5(l)+Z5(c);u<s?(s=u,r=a,o=f<o?f:o):u===s&&f<o&&(o=f,r=a)}return r||n-t}_chooseSplitAxis(e,t,n){let r=e.leaf?this.compareMinX:r0e,s=e.leaf?this.compareMinY:s0e,o=this._allDistMargin(e,t,n,r),a=this._allDistMargin(e,t,n,s);o<a&&e.children.sort(r)}_allDistMargin(e,t,n,r){e.children.sort(r);let s=this.toBBox,o=o2(e,0,t,s),a=o2(e,n-t,n,s),l=i3(o)+i3(a);for(let c=t;c<n-t;c++){let u=e.children[c];a2(o,e.leaf?s(u):u),l+=i3(o)}for(let c=n-t-1;c>=t;c--){let u=e.children[c];a2(a,e.leaf?s(u):u),l+=i3(a)}return l}_adjustParentBBoxes(e,t,n){for(let r=n;r>=0;r--)a2(t[r],e)}_condense(e){for(let t=e.length-1,n;t>=0;t--)e[t].children.length===0?t>0?(n=e[t-1].children,n.splice(n.indexOf(e[t]),1)):this.clear():bv(e[t],this.toBBox)}};function i0e(i,e,t){if(!t)return e.indexOf(i);for(let n=0;n<e.length;n++)if(t(i,e[n]))return n;return-1}function bv(i,e){o2(i,0,i.children.length,e,i)}function o2(i,e,t,n,r){r||(r=wv(null)),r.minX=1/0,r.minY=1/0,r.maxX=-1/0,r.maxY=-1/0;for(let s=e;s<t;s++){let o=i.children[s];a2(r,i.leaf?n(o):o)}return r}function a2(i,e){return i.minX=Math.min(i.minX,e.minX),i.minY=Math.min(i.minY,e.minY),i.maxX=Math.max(i.maxX,e.maxX),i.maxY=Math.max(i.maxY,e.maxY),i}function r0e(i,e){return i.minX-e.minX}function s0e(i,e){return i.minY-e.minY}function Z5(i){return(i.maxX-i.minX)*(i.maxY-i.minY)}function i3(i){return i.maxX-i.minX+(i.maxY-i.minY)}function o0e(i,e){return(Math.max(e.maxX,i.maxX)-Math.min(e.minX,i.minX))*(Math.max(e.maxY,i.maxY)-Math.min(e.minY,i.minY))}function a0e(i,e){let t=Math.max(i.minX,e.minX),n=Math.max(i.minY,e.minY),r=Math.min(i.maxX,e.maxX),s=Math.min(i.maxY,e.maxY);return Math.max(0,r-t)*Math.max(0,s-n)}function K5(i,e){return i.minX<=e.minX&&i.minY<=e.minY&&e.maxX<=i.maxX&&e.maxY<=i.maxY}function r3(i,e){return e.minX<=i.maxX&&e.minY<=i.maxY&&e.maxX>=i.minX&&e.maxY>=i.minY}function wv(i){return{children:i,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function C$(i,e,t,n,r){let s=[e,t];for(;s.length;){if(t=s.pop(),e=s.pop(),t-e<=n)continue;let o=e+Math.ceil((t-e)/n/2)*n;n3(i,o,e,t,r),s.push(e,o,o,t)}}var CA=0,o3=0,ia=1<<CA++,ci=1<<CA++,ra=1<<CA++,Pa=1<<CA++,fd=1<<CA++,MA=1<<CA++,a3=Math.pow(2,CA)-1,J5={[ia]:"boolean",[ci]:"number",[ra]:"string",[Pa]:"color",[fd]:"number[]",[MA]:"size"},l0e=Object.keys(J5).map(Number).sort(pl);function c0e(i){return i in J5}function hd(i){let e=[];for(let t of l0e)l2(i,t)&&e.push(J5[t]);return e.length===0?"untyped":e.length<3?e.join(" or "):e.slice(0,-1).join(", ")+", or "+e[e.length-1]}function l2(i,e){return(i&e)===e}function s3(i,e){return!!(i&e)}function qp(i,e){return i===e}var Xr=class{constructor(e,t){if(!c0e(e))throw new Error(`literal expressions must have a specific type, got ${hd(e)}`);this.type=e,this.value=t}},l3=class{constructor(e,t,...n){this.type=e,this.operator=t,this.args=n}};function c3(i){return{variables:new Map,properties:new Map,featureId:!1,geometryType:!1,mCoordinate:!1,mapState:!1,inputVariables:i}}function hs(i,e,t){switch(typeof i){case"boolean":{if(qp(e,ra))return new Xr(ra,i?"true":"false");if(!l2(e,ia))throw new Error(`got a boolean, but expected ${hd(e)}`);return new Xr(ia,i)}case"number":{if(qp(e,MA))return new Xr(MA,ls(i));if(qp(e,ia))return new Xr(ia,!!i);if(qp(e,ra))return new Xr(ra,i.toString());if(!l2(e,ci))throw new Error(`got a number, but expected ${hd(e)}`);return new Xr(ci,i)}case"string":{if(qp(e,Pa))return new Xr(Pa,Wy(i));if(qp(e,ia))return new Xr(ia,!!i);if(!l2(e,ra))throw new Error(`got a string, but expected ${hd(e)}`);return new Xr(ra,i)}default:}if(!Array.isArray(i))throw new Error("expression must be an array or a primitive value");if(i.length===0)throw new Error("empty expression");if(typeof i[0]=="string")return y0e(i,e,t);for(let n of i)if(typeof n!="number")throw new Error("expected an array of numbers");if(qp(e,MA)){if(i.length!==2)throw new Error(`expected an array of two values for a size, got ${i.length}`);return new Xr(MA,i)}if(qp(e,Pa)){if(i.length===3)return new Xr(Pa,[...i,1]);if(i.length===4)return new Xr(Pa,i);throw new Error(`expected an array of 3 or 4 values for a color, got ${i.length}`)}if(!l2(e,fd))throw new Error(`got an array of numbers, but expected ${hd(e)}`);return new Xr(fd,i)}var et={Get:"get",Var:"var",Concat:"concat",GeometryType:"geometry-type",LineMetric:"line-metric",Any:"any",All:"all",Not:"!",Resolution:"resolution",Zoom:"zoom",Time:"time",Equal:"==",NotEqual:"!=",GreaterThan:">",GreaterThanOrEqualTo:">=",LessThan:"<",LessThanOrEqualTo:"<=",Multiply:"*",Divide:"/",Add:"+",Subtract:"-",Clamp:"clamp",Mod:"%",Pow:"^",Abs:"abs",Floor:"floor",Ceil:"ceil",Round:"round",Sin:"sin",Cos:"cos",Atan:"atan",Sqrt:"sqrt",Match:"match",Between:"between",Interpolate:"interpolate",Coalesce:"coalesce",Case:"case",In:"in",Number:"number",String:"string",Array:"array",Color:"color",Id:"id",Band:"band",Palette:"palette",ToString:"to-string",Has:"has"},u0e={[et.Get]:Un(ti(1,1/0),R$),[et.Var]:h0e(),[et.Has]:Un(ti(1,1/0),R$),[et.Id]:Un(f0e,Sv),[et.Concat]:Un(ti(2,1/0),Qi(ra)),[et.GeometryType]:Un(d0e,Sv),[et.LineMetric]:Un(p0e,Sv),[et.Resolution]:Un(Q5,Sv),[et.Zoom]:Un(Q5,Sv),[et.Time]:Un(Q5,Sv),[et.Any]:Un(ti(2,1/0),Qi(ia)),[et.All]:Un(ti(2,1/0),Qi(ia)),[et.Not]:Un(ti(1,1),Qi(ia)),[et.Equal]:Un(ti(2,2),P$()),[et.NotEqual]:Un(ti(2,2),P$()),[et.GreaterThan]:Un(ti(2,2),Qi(ci)),[et.GreaterThanOrEqualTo]:Un(ti(2,2),Qi(ci)),[et.LessThan]:Un(ti(2,2),Qi(ci)),[et.LessThanOrEqualTo]:Un(ti(2,2),Qi(ci)),[et.Multiply]:Un(ti(2,1/0),I$),[et.Coalesce]:Un(ti(2,1/0),I$),[et.Divide]:Un(ti(2,2),Qi(ci)),[et.Add]:Un(ti(2,1/0),Qi(ci)),[et.Subtract]:Un(ti(2,2),Qi(ci)),[et.Clamp]:Un(ti(3,3),Qi(ci)),[et.Mod]:Un(ti(2,2),Qi(ci)),[et.Pow]:Un(ti(2,2),Qi(ci)),[et.Abs]:Un(ti(1,1),Qi(ci)),[et.Floor]:Un(ti(1,1),Qi(ci)),[et.Ceil]:Un(ti(1,1),Qi(ci)),[et.Round]:Un(ti(1,1),Qi(ci)),[et.Sin]:Un(ti(1,1),Qi(ci)),[et.Cos]:Un(ti(1,1),Qi(ci)),[et.Atan]:Un(ti(1,2),Qi(ci)),[et.Sqrt]:Un(ti(1,1),Qi(ci)),[et.Match]:Un(ti(4,1/0),L$,A0e),[et.Between]:Un(ti(3,3),Qi(ci)),[et.Interpolate]:Un(ti(6,1/0),L$,g0e),[et.Case]:Un(ti(3,1/0),m0e,v0e),[et.In]:Un(ti(2,2),_0e),[et.Number]:Un(ti(1,1/0),Qi(a3)),[et.String]:Un(ti(1,1/0),Qi(a3)),[et.Array]:Un(ti(1,1/0),Qi(ci)),[et.Color]:Un(ti(1,4),Qi(ci)),[et.Band]:Un(ti(1,3),Qi(ci)),[et.Palette]:Un(ti(2,2),x0e),[et.ToString]:Un(ti(1,1),Qi(ia|ci|ra|Pa))};function R$(i,e,t){let n=i.length-1,r=new Array(n);for(let s=0;s<n;++s){let o=i[s+1];switch(typeof o){case"number":{r[s]=new Xr(ci,o);break}case"string":{r[s]=new Xr(ra,o);break}default:throw new Error(`expected a string key or numeric array index for a get operation, got ${o}`)}s===0&&t.properties.set(String(o),e)}return r}function h0e(){return function(i,e,t){let n=i[1];if(typeof n!="string")throw new Error("expected a string argument for var operation");let r=e,s=t.inputVariables?.[n];if(s!==void 0){let o=hs(s,a3,t);if(!(o instanceof Xr))throw new Error(`style variables should only be literal values (no expressions!), variable name: ${n}`);let a=o.type;if(typeof s=="string"&&s3(r,Pa)&&!s3(r,ra)?a=Pa:Array.isArray(s)&&s.length===2&&s3(r,MA)&&!s3(r,fd)&&(a=MA),r&=a,r===o3)throw new Error(`the type expected from the var operator (${hd(e)}) did not have any overlap with the type of the corresponding style variables (${hd(a)}), variable name: ${n}`)}if(t.variables.has(n)){let o=t.variables.get(n);if(r&=o,r===o3)throw new Error(`a new type expected from the var operator (${hd(e)}) did not have any overlap with the previous type expected for it (${hd(o)}), variable name: ${n}`)}return t.variables.set(n,r),new l3(r,"var",new Xr(ra,n))}}function f0e(i,e,t){t.featureId=!0}function d0e(i,e,t){t.geometryType=!0}function p0e(i,e,t){t.mCoordinate=!0}function Q5(i,e,t){t.mapState=!0}function Sv(i,e,t){let n=i[0];if(i.length!==1)throw new Error(`expected no arguments for ${n} operation`);return[]}function ti(i,e){return function(t,n,r){let s=t[0],o=t.length-1;if(i===e){if(o!==i){let a=i===1?"":"s";throw new Error(`expected ${i} argument${a} for ${s}, got ${o}`)}}else if(o<i||o>e){let a=e===1/0?`${i} or more`:`${i} to ${e}`;throw new Error(`expected ${a} arguments for ${s}, got ${o}`)}}}function I$(i,e,t){let n=i.length-1,r=new Array(n);for(let s=0;s<n;++s){let o=hs(i[s+1],e,t);r[s]=o}return r}function Qi(i){return function(e,t,n){let r=e.length-1,s=new Array(r);for(let o=0;o<r;++o){let a=hs(e[o+1],i,n);s[o]=a}return s}}function P$(){return function(i,e,t){let n=i[0],r=i.length-1,s=new Array(r),o=a3;for(let a=0;a<r;++a){let l=hs(i[a+1],o,t);o&=l.type}if(o===o3)throw new Error(`no common type was found among the arguments of ${n}`);for(let a=0;a<r;++a){let l=hs(i[a+1],o,t);s[a]=l}return s}}function m0e(i,e,t){let n=i[0],r=i.length-1;if(r%2===0)throw new Error(`expected an odd number of arguments for ${n}, got ${r} instead`)}function L$(i,e,t){let n=i[0],r=i.length-1;if(r%2===1)throw new Error(`expected an even number of arguments for operation ${n}, got ${r} instead`)}function A0e(i,e,t){let n=i.length-1,r=hs(i[i.length-1],e,t),s=ra|ci|ia,o=new Array(n-2);for(let l=0;l<n-2;l+=2){try{let c=hs(i[l+2],s,t);s&=c.type}catch(c){throw new Error(`failed to parse argument ${l+1} of match expression: ${c.message}`)}if(s===o3)throw new Error("no common type was found among the arguments of match expression")}for(let l=0;l<n-2;l+=2){try{let c=hs(i[l+2],s,t);o[l]=c}catch(c){throw new Error(`failed to parse argument ${l+1} of match expression: ${c.message}`)}try{let c=hs(i[l+3],r.type,t);o[l+1]=c}catch(c){throw new Error(`failed to parse argument ${l+2} of match expression: ${c.message}`)}}return[hs(i[1],s,t),...o,r]}function g0e(i,e,t){let n=i[1],r;switch(n[0]){case"linear":r=1;break;case"exponential":let l=n[1];if(typeof l!="number"||l<=0)throw new Error(`expected a number base for exponential interpolation, got ${JSON.stringify(l)} instead`);r=l;break;default:throw new Error(`invalid interpolation type: ${JSON.stringify(n)}`)}let s=new Xr(ci,r),o;try{o=hs(i[2],ci,t)}catch(l){throw new Error(`failed to parse argument 1 in interpolate expression: ${l.message}`)}let a=new Array(i.length-3);for(let l=0;l<a.length;l+=2){try{let c=hs(i[l+3],ci,t);a[l]=c}catch(c){throw new Error(`failed to parse argument ${l+2} for interpolate expression: ${c.message}`)}try{let c=hs(i[l+4],e,t);a[l+1]=c}catch(c){throw new Error(`failed to parse argument ${l+3} for interpolate expression: ${c.message}`)}}return[s,o,...a]}function v0e(i,e,t){let n=hs(i[i.length-1],e,t),r=new Array(i.length-1);for(let s=0;s<r.length-1;s+=2){try{let o=hs(i[s+1],ia,t);r[s]=o}catch(o){throw new Error(`failed to parse argument ${s} of case expression: ${o.message}`)}try{let o=hs(i[s+2],n.type,t);r[s+1]=o}catch(o){throw new Error(`failed to parse argument ${s+1} of case expression: ${o.message}`)}}return r[r.length-1]=n,r}function _0e(i,e,t){let n=i[2];if(!Array.isArray(n))throw new Error('the second argument for the "in" operator must be an array');let r;if(n[0]==="literal"){if(n=n[1],!Array.isArray(n))throw new Error('failed to parse "in" expression: the literal operator must be followed by an array')}else if(typeof n[0]=="string")throw new Error('for the "in" operator, a string array should be wrapped in a "literal" operator to disambiguate from expressions');typeof n[0]=="string"?r=ra:r=ci;let s=new Array(n.length);for(let a=0;a<s.length;a++)try{let l=hs(n[a],r,t);s[a]=l}catch(l){throw new Error(`failed to parse haystack item ${a} for "in" expression: ${l.message}`)}return[hs(i[1],r,t),...s]}function x0e(i,e,t){let n;try{n=hs(i[1],ci,t)}catch(o){throw new Error(`failed to parse first argument in palette expression: ${o.message}`)}let r=i[2];if(!Array.isArray(r))throw new Error("the second argument of palette must be an array");let s=new Array(r.length);for(let o=0;o<s.length;o++){let a;try{a=hs(r[o],Pa,t)}catch(l){throw new Error(`failed to parse color at index ${o} in palette expression: ${l.message}`)}if(!(a instanceof Xr))throw new Error(`the palette color at index ${o} must be a literal value`);s[o]=a}return[n,...s]}function Un(...i){return function(e,t,n){let r=e[0],s;for(let o=0;o<i.length;o++){let a=i[o](e,t,n);if(o==i.length-1){if(!a)throw new Error("expected last argument validator to return the parsed args");s=a}}return new l3(t,r,...s)}}function y0e(i,e,t){let n=i[0],r=u0e[n];if(!r)throw new Error(`unknown operator: ${n}`);return r(i,e,t)}function u3(i){if(!i)return"";let e=i.getType();switch(e){case"Point":case"LineString":case"Polygon":return e;case"MultiPoint":case"MultiLineString":case"MultiPolygon":return e.substring(5);case"Circle":return"Polygon";case"GeometryCollection":return u3(i.getGeometries()[0]);default:return""}}function e6(){return{variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""}}function Eu(i,e,t){let n=hs(i,e,t);return Tu(n,t)}function Tu(i,e){if(i instanceof Xr){if(i.type===Pa&&typeof i.value=="string"){let n=Wy(i.value);return function(){return n}}return function(){return i.value}}let t=i.operator;switch(t){case et.Number:case et.String:case et.Coalesce:return b0e(i,e);case et.Get:case et.Var:case et.Has:return w0e(i,e);case et.Id:return n=>n.featureId;case et.GeometryType:return n=>n.geometryType;case et.Concat:{let n=i.args.map(r=>Tu(r,e));return r=>"".concat(...n.map(s=>s(r).toString()))}case et.Resolution:return n=>n.resolution;case et.Any:case et.All:case et.Between:case et.In:case et.Not:return T0e(i,e);case et.Equal:case et.NotEqual:case et.LessThan:case et.LessThanOrEqualTo:case et.GreaterThan:case et.GreaterThanOrEqualTo:return S0e(i,e);case et.Multiply:case et.Divide:case et.Add:case et.Subtract:case et.Clamp:case et.Mod:case et.Pow:case et.Abs:case et.Floor:case et.Ceil:case et.Round:case et.Sin:case et.Cos:case et.Atan:case et.Sqrt:return E0e(i,e);case et.Case:return M0e(i,e);case et.Match:return C0e(i,e);case et.Interpolate:return R0e(i,e);case et.ToString:return I0e(i,e);default:throw new Error(`Unsupported operator ${t}`)}}function b0e(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Tu(i.args[s],e);switch(t){case et.Coalesce:return s=>{for(let o=0;o<n;++o){let a=r[o](s);if(typeof a<"u"&&a!==null)return a}throw new Error("Expected one of the values to be non-null")};case et.Number:case et.String:return s=>{for(let o=0;o<n;++o){let a=r[o](s);if(typeof a===t)return a}throw new Error(`Expected one of the values to be a ${t}`)};default:throw new Error(`Unsupported assertion operator ${t}`)}}function w0e(i,e){let n=i.args[0].value;switch(i.operator){case et.Get:return r=>{let s=i.args,o=r.properties[n];for(let a=1,l=s.length;a<l;++a){let u=s[a].value;o=o[u]}return o};case et.Var:return r=>r.variables[n];case et.Has:return r=>{let s=i.args;if(!(n in r.properties))return!1;let o=r.properties[n];for(let a=1,l=s.length;a<l;++a){let u=s[a].value;if(!o||!Object.hasOwn(o,u))return!1;o=o[u]}return!0};default:throw new Error(`Unsupported accessor operator ${i.operator}`)}}function S0e(i,e){let t=i.operator,n=Tu(i.args[0],e),r=Tu(i.args[1],e);switch(t){case et.Equal:return s=>n(s)===r(s);case et.NotEqual:return s=>n(s)!==r(s);case et.LessThan:return s=>n(s)<r(s);case et.LessThanOrEqualTo:return s=>n(s)<=r(s);case et.GreaterThan:return s=>n(s)>r(s);case et.GreaterThanOrEqualTo:return s=>n(s)>=r(s);default:throw new Error(`Unsupported comparison operator ${t}`)}}function T0e(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Tu(i.args[s],e);switch(t){case et.Any:return s=>{for(let o=0;o<n;++o)if(r[o](s))return!0;return!1};case et.All:return s=>{for(let o=0;o<n;++o)if(!r[o](s))return!1;return!0};case et.Between:return s=>{let o=r[0](s),a=r[1](s),l=r[2](s);return o>=a&&o<=l};case et.In:return s=>{let o=r[0](s);for(let a=1;a<n;++a)if(o===r[a](s))return!0;return!1};case et.Not:return s=>!r[0](s);default:throw new Error(`Unsupported logical operator ${t}`)}}function E0e(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Tu(i.args[s],e);switch(t){case et.Multiply:return s=>{let o=1;for(let a=0;a<n;++a)o*=r[a](s);return o};case et.Divide:return s=>r[0](s)/r[1](s);case et.Add:return s=>{let o=0;for(let a=0;a<n;++a)o+=r[a](s);return o};case et.Subtract:return s=>r[0](s)-r[1](s);case et.Clamp:return s=>{let o=r[0](s),a=r[1](s);if(o<a)return a;let l=r[2](s);return o>l?l:o};case et.Mod:return s=>r[0](s)%r[1](s);case et.Pow:return s=>Math.pow(r[0](s),r[1](s));case et.Abs:return s=>Math.abs(r[0](s));case et.Floor:return s=>Math.floor(r[0](s));case et.Ceil:return s=>Math.ceil(r[0](s));case et.Round:return s=>Math.round(r[0](s));case et.Sin:return s=>Math.sin(r[0](s));case et.Cos:return s=>Math.cos(r[0](s));case et.Atan:return n===2?s=>Math.atan2(r[0](s),r[1](s)):s=>Math.atan(r[0](s));case et.Sqrt:return s=>Math.sqrt(r[0](s));default:throw new Error(`Unsupported numeric operator ${t}`)}}function M0e(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Tu(i.args[r],e);return r=>{for(let s=0;s<t-1;s+=2)if(n[s](r))return n[s+1](r);return n[t-1](r)}}function C0e(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Tu(i.args[r],e);return r=>{let s=n[0](r);for(let o=1;o<t-1;o+=2)if(s===n[o](r))return n[o+1](r);return n[t-1](r)}}function R0e(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Tu(i.args[r],e);return r=>{let s=n[0](r),o=n[1](r),a,l;for(let c=2;c<t;c+=2){let u=n[c](r),f=n[c+1](r),d=Array.isArray(f);if(d&&(f=tX(f)),u>=o)return c===2?f:d?P0e(s,o,a,l,u,f):c2(s,o,a,l,u,f);a=u,l=f}return l}}function I0e(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Tu(i.args[s],e);if(t===et.ToString)return s=>{let o=r[0](s);return i.args[0].type===Pa?jy(o):o.toString()};throw new Error(`Unsupported convert operator ${t}`)}function c2(i,e,t,n,r,s){let o=r-t;if(o===0)return n;let a=e-t,l=i===1?a/o:(Math.pow(i,a)-1)/(Math.pow(i,o)-1);return n+l*(s-n)}function P0e(i,e,t,n,r,s){if(r-t===0)return n;let a=BN(n),l=BN(s),c=l[2]-a[2];c>180?c-=360:c<-180&&(c+=360);let u=[c2(i,e,t,a[0],r,l[0]),c2(i,e,t,a[1],r,l[1]),a[2]+c2(i,e,t,0,r,c),c2(i,e,t,n[3],r,s[3])];return nX(u)}function L0e(i){return!0}function D0e(i,e){e=e??c3();let t=N0e(i,e),n=e6();return function(r,s){if(n.properties=r.getPropertiesInternal(),n.resolution=s,e.featureId){let o=r.getId();o!==void 0?n.featureId=o:n.featureId=null}return e.geometryType&&(n.geometryType=u3(r.getGeometry())),t(n)}}function D$(i,e){e=e??c3();let t=i.length,n=new Array(t);for(let o=0;o<t;++o)n[o]=t6(i[o],e);let r=e6(),s=new Array(t);return function(o,a){if(r.properties=o.getPropertiesInternal(),r.resolution=a,e.featureId){let c=o.getId();c!==void 0?r.featureId=c:r.featureId=null}e.geometryType&&(r.geometryType=u3(o.getGeometry()));let l=0;for(let c=0;c<t;++c){let u=n[c](r);u&&(s[l]=u,l+=1)}return s.length=l,s}}function O$(i,e){if(e=e??c3(),!Array.isArray(i))return D$([i],e);let t=i.length;if("style"in i[0]){let s=new Array(t);for(let o=0;o<t;++o){let a=i[o];if(!("style"in a))throw new Error("Expected a list of rules with a style property");s[o]=a}return D0e(s,e)}return D$(i,e)}function N0e(i,e){let t=i.length,n=new Array(t);for(let r=0;r<t;++r){let s=i[r],o="filter"in s?Eu(s.filter,ia,e):L0e,a;if(Array.isArray(s.style)){let l=s.style.length;a=new Array(l);for(let c=0;c<l;++c)a[c]=t6(s.style[c],e)}else a=[t6(s.style,e)];n[r]={filter:o,styles:a}}return function(r){let s=[],o=!1;for(let a=0;a<t;++a){let l=n[a].filter;if(l(r)&&!(i[a].else&&o)){o=!0;for(let c of n[a].styles){let u=c(r);u&&s.push(u)}}}return s}}function t6(i,e){let t=u2(i,"",e),n=h2(i,"",e),r=F0e(i,e),s=B0e(i,e),o=Oo(i,"z-index",e);if(!t&&!n&&!r&&!s&&!gu(i))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(i));let a=new Nr;return function(l){let c=!0;if(t){let u=t(l);u&&(c=!1),a.setFill(u)}if(n){let u=n(l);u&&(c=!1),a.setStroke(u)}if(r){let u=r(l);u&&(c=!1),a.setText(u)}if(s){let u=s(l);u&&(c=!1),a.setImage(u)}return o&&a.setZIndex(o(l)),c?null:a}}function u2(i,e,t){let n;if(e+"fill-pattern-src"in i)n=z0e(i,e+"fill-",t);else{if(i[e+"fill-color"]==="none")return s=>null;n=f3(i,e+"fill-color",t)}if(!n)return null;let r=new us;return function(s){let o=n(s);return o===LE?null:(r.setColor(o),r)}}function h2(i,e,t){let n=Oo(i,e+"stroke-width",t),r=f3(i,e+"stroke-color",t);if(!n&&!r)return null;let s=dd(i,e+"stroke-line-cap",t),o=dd(i,e+"stroke-line-join",t),a=U$(i,e+"stroke-line-dash",t),l=Oo(i,e+"stroke-line-dash-offset",t),c=Oo(i,e+"stroke-miter-limit",t),u=Oo(i,e+"stroke-offset",t),f=new Es;return function(d){if(r){let A=r(d);if(A===LE)return null;f.setColor(A)}if(n&&f.setWidth(n(d)),s){let A=s(d);if(A!=="butt"&&A!=="round"&&A!=="square")throw new Error("Expected butt, round, or square line cap");f.setLineCap(A)}if(o){let A=o(d);if(A!=="bevel"&&A!=="round"&&A!=="miter")throw new Error("Expected bevel, round, or miter line join");f.setLineJoin(A)}return a&&f.setLineDash(a(d)),l&&f.setLineDashOffset(l(d)),c&&f.setMiterLimit(c(d)),u&&f.setOffset(u(d)),f}}function F0e(i,e){let t="text-",n=dd(i,t+"value",e);if(!n)return null;let r=u2(i,t,e),s=u2(i,t+"background-",e),o=h2(i,t,e),a=h2(i,t+"background-",e),l=dd(i,t+"font",e),c=Oo(i,t+"max-angle",e),u=Oo(i,t+"offset-x",e),f=Oo(i,t+"offset-y",e),d=Tv(i,t+"overflow",e),A=dd(i,t+"placement",e),y=Oo(i,t+"repeat",e),w=d3(i,t+"scale",e),S=Tv(i,t+"rotate-with-view",e),T=Oo(i,t+"rotation",e),R=dd(i,t+"align",e),P=dd(i,t+"justify",e),I=dd(i,t+"baseline",e),F=Tv(i,t+"keep-upright",e),D=U$(i,t+"padding",e),L=p3(i,t+"declutter-mode"),C=new ld({declutterMode:L});return function(B){if(C.setText(n(B)),r&&C.setFill(r(B)),s&&C.setBackgroundFill(s(B)),o&&C.setStroke(o(B)),a&&C.setBackgroundStroke(a(B)),l&&C.setFont(l(B)),c&&C.setMaxAngle(c(B)),u&&C.setOffsetX(u(B)),f&&C.setOffsetY(f(B)),d&&C.setOverflow(d(B)),A){let k=A(B);if(k!=="point"&&k!=="line")throw new Error("Expected point or line for text-placement");C.setPlacement(k)}if(y&&C.setRepeat(y(B)),w&&C.setScale(w(B)),S&&C.setRotateWithView(S(B)),T&&C.setRotation(T(B)),R){let k=R(B);if(k!=="left"&&k!=="center"&&k!=="right"&&k!=="end"&&k!=="start")throw new Error("Expected left, right, center, start, or end for text-align");C.setTextAlign(k)}if(P){let k=P(B);if(k!=="left"&&k!=="right"&&k!=="center")throw new Error("Expected left, right, or center for text-justify");C.setJustify(k)}if(I){let k=I(B);if(k!=="bottom"&&k!=="top"&&k!=="middle"&&k!=="alphabetic"&&k!=="hanging")throw new Error("Expected bottom, top, middle, alphabetic, or hanging for text-baseline");C.setTextBaseline(k)}return D&&C.setPadding(D(B)),F&&C.setKeepUpright(F(B)),C}}function B0e(i,e){return"icon-src"in i?O0e(i,e):"shape-points"in i?U0e(i,e):"circle-radius"in i?k0e(i,e):null}function O0e(i,e){let t="icon-",n=t+"src",r=k$(i[n],n),s=h3(i,t+"anchor",e),o=d3(i,t+"scale",e),a=Oo(i,t+"opacity",e),l=h3(i,t+"displacement",e),c=Oo(i,t+"rotation",e),u=Tv(i,t+"rotate-with-view",e),f=F$(i,t+"anchor-origin"),d=B$(i,t+"anchor-x-units"),A=B$(i,t+"anchor-y-units"),y=pd(i,t+"color"),w,S=null;y!==void 0&&(Array.isArray(y)&&y.length>0&&typeof y[0]=="string"?S=f3(i,t+"color",e):w=z$(y,t+"color"));let T=G0e(i,t+"cross-origin"),R=q0e(i,t+"offset"),P=F$(i,t+"offset-origin"),I=n6(i,t+"width"),F=n6(i,t+"height"),D=V0e(i,t+"size"),L=p3(i,t+"declutter-mode"),C={src:r,anchorOrigin:f,anchorXUnits:d,anchorYUnits:A,crossOrigin:T,offset:R,offsetOrigin:P,height:F,width:I,size:D,declutterMode:L},B=null;return function(k){if(B)S&&B.setColor(S(k));else{let z=S?S(k):w;B=new xA(z!==void 0?Object.assign({},C,{color:z}):Object.assign({},C))}return a&&B.setOpacity(a(k)),l&&B.setDisplacement(l(k)),c&&B.setRotation(c(k)),u&&B.setRotateWithView(u(k)),o&&B.setScale(o(k)),s&&B.setAnchor(s(k)),B}}function U0e(i,e){let t="shape-",n=t+"points",r=t+"radius",s=i6(i[n],n);if(!(r in i))throw new Error(`Expected a number for ${r}`);let o=Oo(i,r,e),a=typeof i[r]=="number"?i[r]:5,l=t+"radius2",c=Oo(i,l,e),u=typeof i[l]=="number"?i[l]:void 0,f=u2(i,t,e),d=h2(i,t,e),A=d3(i,t+"scale",e),y=h3(i,t+"displacement",e),w=Oo(i,t+"rotation",e),S=Tv(i,t+"rotate-with-view",e),T=n6(i,t+"angle"),R=p3(i,t+"declutter-mode"),P=new UE({points:s,radius:a,radius2:u,angle:T,declutterMode:R});return function(I){return o&&P.setRadius(o(I)),c&&P.setRadius2(c(I)),f&&P.setFill(f(I)),d&&P.setStroke(d(I)),y&&P.setDisplacement(y(I)),w&&P.setRotation(w(I)),S&&P.setRotateWithView(S(I)),A&&P.setScale(A(I)),P}}function k0e(i,e){let t="circle-",n=u2(i,t,e),r=h2(i,t,e),s=Oo(i,t+"radius",e),o=d3(i,t+"scale",e),a=h3(i,t+"displacement",e),l=Oo(i,t+"rotation",e),c=Tv(i,t+"rotate-with-view",e),u=p3(i,t+"declutter-mode"),f=new kE({radius:5,declutterMode:u});return function(d){return s&&f.setRadius(s(d)),n&&f.setFill(n(d)),r&&f.setStroke(r(d)),a&&f.setDisplacement(a(d)),l&&f.setRotation(l(d)),c&&f.setRotateWithView(c(d)),o&&f.setScale(o(d)),f}}function pd(i,e){if(!(e in i))return;let t=i[e];return t===void 0?void 0:t}function Oo(i,e,t){let n=pd(i,e);if(n===void 0)return;let r=Eu(n,ci,t);return function(s){return i6(r(s),e)}}function dd(i,e,t){let n=pd(i,e);if(n===void 0)return null;let r=Eu(n,ra,t);return function(s){return k$(r(s),e)}}function z0e(i,e,t){let n=dd(i,e+"pattern-src",t),r=N$(i,e+"pattern-offset",t),s=N$(i,e+"pattern-size",t),o=f3(i,e+"color",t);return function(a){return{src:n(a),offset:r&&r(a),size:s&&s(a),color:o&&o(a)}}}function Tv(i,e,t){let n=pd(i,e);if(n===void 0)return null;let r=Eu(n,ia,t);return function(s){let o=r(s);if(typeof o!="boolean")throw new Error(`Expected a boolean for ${e}`);return o}}function f3(i,e,t){let n=pd(i,e);if(n===void 0)return null;let r=Eu(n,Pa,t);return function(s){return z$(r(s),e)}}function U$(i,e,t){let n=pd(i,e);if(n===void 0)return null;if(Array.isArray(n)&&(n.length===0||typeof n[0]!="string")){let s=n.map((o,a)=>{if(typeof o=="number")return()=>o;let l=Eu(o,ci,t);return function(c){return i6(l(c),`${e}[${a}]`)}});return function(o){let a=new Array(s.length);for(let l=0;l<s.length;++l)a[l]=s[l](o);return a}}let r=Eu(n,fd,t);return function(s){return f2(r(s),e)}}function h3(i,e,t){let n=pd(i,e);if(n===void 0)return null;let r=Eu(n,fd,t);return function(s){let o=f2(r(s),e);if(o.length!==2)throw new Error(`Expected two numbers for ${e}`);return o}}function N$(i,e,t){let n=pd(i,e);if(n===void 0)return null;let r=Eu(n,fd,t);return function(s){return V$(r(s),e)}}function d3(i,e,t){let n=pd(i,e);if(n===void 0)return null;let r=Eu(n,fd|ci,t);return function(s){return H0e(r(s),e)}}function n6(i,e){let t=i[e];if(t!==void 0){if(typeof t!="number")throw new Error(`Expected a number for ${e}`);return t}}function V0e(i,e){let t=i[e];if(t!==void 0){if(typeof t=="number")return ls(t);if(!Array.isArray(t))throw new Error(`Expected a number or size array for ${e}`);if(t.length!==2||typeof t[0]!="number"||typeof t[1]!="number")throw new Error(`Expected a number or size array for ${e}`);return t}}function G0e(i,e){let t=i[e];if(t!==void 0){if(typeof t!="string")throw new Error(`Expected a string for ${e}`);return t}}function F$(i,e){let t=i[e];if(t!==void 0){if(t!=="bottom-left"&&t!=="bottom-right"&&t!=="top-left"&&t!=="top-right")throw new Error(`Expected bottom-left, bottom-right, top-left, or top-right for ${e}`);return t}}function B$(i,e){let t=i[e];if(t!==void 0){if(t!=="pixels"&&t!=="fraction")throw new Error(`Expected pixels or fraction for ${e}`);return t}}function q0e(i,e){let t=i[e];if(t!==void 0)return f2(t,e)}function p3(i,e){let t=i[e];if(t!==void 0){if(typeof t!="string")throw new Error(`Expected a string for ${e}`);if(t!=="declutter"&&t!=="obstacle"&&t!=="none")throw new Error(`Expected declutter, obstacle, or none for ${e}`);return t}}function f2(i,e){if(!Array.isArray(i))throw new Error(`Expected an array for ${e}`);let t=i.length;for(let n=0;n<t;++n)if(typeof i[n]!="number")throw new Error(`Expected an array of numbers for ${e}`);return i}function k$(i,e){if(typeof i!="string")throw new Error(`Expected a string for ${e}`);return i}function i6(i,e){if(typeof i!="number")throw new Error(`Expected a number for ${e}`);return i}function z$(i,e){if(typeof i=="string")return i;let t=f2(i,e),n=t.length;if(n<3||n>4)throw new Error(`Expected a color with 3 or 4 values for ${e}`);return t}function V$(i,e){let t=f2(i,e);if(t.length!==2)throw new Error(`Expected an array of two numbers for ${e}`);return t}function H0e(i,e){return typeof i=="number"?i:V$(i,e)}var G$={RENDER_ORDER:"renderOrder"},r6=class extends TA{constructor(e){e=e||{};let t=Object.assign({},e);delete t.style,delete t.renderBuffer,delete t.updateWhileAnimating,delete t.updateWhileInteracting,super(t),this.declutter_=e.declutter?String(e.declutter):void 0,this.renderBuffer_=e.renderBuffer!==void 0?e.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(e.style),this.updateWhileAnimating_=e.updateWhileAnimating!==void 0?e.updateWhileAnimating:!1,this.updateWhileInteracting_=e.updateWhileInteracting!==void 0?e.updateWhileInteracting:!1}getDeclutter(){return this.declutter_}getFeatures(e){return super.getFeatures(e)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(G$.RENDER_ORDER)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(e,t){let n=this.getDeclutter();n in e.declutter||(e.declutter[n]=new EA(9)),this.getRenderer().renderDeclutter(e,t)}setRenderOrder(e){this.set(G$.RENDER_ORDER,e)}setStyle(e){this.style_=e===void 0?YN:e;let t=W0e(e);this.styleFunction_=e===null?void 0:pX(t),this.changed()}setDeclutter(e){this.declutter_=e?String(e):void 0,this.changed()}};function W0e(i){if(i===void 0)return YN;if(!i)return null;if(typeof i=="function"||i instanceof Nr)return i;if(Array.isArray(i)&&i.length===0)return[];if(Array.isArray(i)&&i[0]instanceof Nr){let t=i.length,n=new Array(t);for(let r=0;r<t;++r){let s=i[r];if(!(s instanceof Nr))throw new Error("Expected a list of style instances");n[r]=s}return n}return O$(i)}var m3=r6;var s6=class extends Ao{constructor(e,t,n,r){super(e),this.inversePixelTransform=t,this.frameState=n,this.context=r}},A3=s6;var o6=class extends Ip{constructor(e){super(),this.map_=e}dispatchRenderEvent(e,t){ei()}calculateMatrices2D(e){let t=e.viewState,n=e.coordinateToPixelTransform,r=e.pixelToCoordinateTransform;Do(n,e.size[0]/2,e.size[1]/2,1/t.resolution,-1/t.resolution,-t.rotation,-t.center[0],-t.center[1]),fE(r,n)}forEachFeatureAtCoordinate(e,t,n,r,s,o,a,l){let c,u=t.viewState;function f(I,F,D,L){return s.call(o,F,I?D:null,L)}let d=u.projection,A=$T(e.slice(),d),y=[[0,0]];if(d.canWrapX()&&r){let I=d.getExtent(),F=Kn(I);y.push([-F,0],[F,0])}let w=t.layerStatesArray,S=w.length,T=[],R=[];for(let I=0;I<y.length;I++)for(let F=S-1;F>=0;--F){let D=w[F],L=D.layer;if(L.hasRenderer()&&r2(D,u)&&a.call(l,L)){let C=L.getRenderer(),B=L.getSource();if(C&&B){let k=B.getWrapX()?A:e,z=f.bind(null,D.managed);R[0]=k[0]+y[I][0],R[1]=k[1]+y[I][1],c=C.forEachFeatureAtCoordinate(R,t,n,z,T)}if(c)return c}}if(T.length===0)return;let P=1/T.length;return T.forEach((I,F)=>I.distanceSq+=F*P),T.sort((I,F)=>I.distanceSq-F.distanceSq),T.some(I=>c=I.callback(I.feature,I.layer,I.geometry)),c}hasFeatureAtCoordinate(e,t,n,r,s,o){return this.forEachFeatureAtCoordinate(e,t,n,r,Jf,this,s,o)!==void 0}getMap(){return this.map_}renderFrame(e){ei()}scheduleExpireIconCache(e){ta.canExpireCache()&&e.postRenderFunctions.push(j0e)}};function j0e(i,e){ta.expire()}var q$=o6;var a6=class extends q${constructor(e){super(e),this.fontChangeListenerKey_=qn(vA,yu.PROPERTYCHANGE,e.redrawText,e),this.element_=io?cE():document.createElement("div");let t=this.element_.style;t.position="absolute",t.width="100%",t.height="100%",t.zIndex="0",this.element_.className=Op+" ol-layers";let n=e.getViewport();n&&n.insertBefore(this.element_,n.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(e,t){let n=this.getMap();if(n.hasListener(e)){let r=new A3(e,void 0,t);n.dispatchEvent(r)}}disposeInternal(){li(this.fontChangeListenerKey_),this.element_.remove(),super.disposeInternal()}renderFrame(e){if(!e){this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1);return}this.calculateMatrices2D(e),this.dispatchRenderEvent(Bo.PRECOMPOSE,e);let t=e.layerStatesArray.sort((u,f)=>u.zIndex-f.zIndex);t.some(u=>u.layer instanceof m3&&u.layer.getDeclutter())&&(e.declutter={});let r=e.viewState;this.children_.length=0;let o=this.getMap().getTargetElement(),a;Hl(o)&&(a=o.getContext("2d"),a.setTransform(1,0,0,1,0,0),a.clearRect(0,0,o.width,o.height));let l=[],c=a?o:null;for(let u=0,f=t.length;u<f;++u){let d=t[u];e.layerIndex=u;let A=d.layer,y=A.getSourceState();if(!r2(d,r)||y!="ready"&&y!="undefined"){A.unrender();continue}let w=A.render(e,c);w&&(w!==c&&(this.children_.push(w),c=w),l.push(d))}this.declutter(e,l),cj(this.element_,this.children_);for(let u of a?this.children_:[]){let f=u.firstElementChild||u,d=u.style.backgroundColor;if(d&&(!Hl(f)||f.width>0)&&(a.fillStyle=d,a.fillRect(0,0,a.canvas.width,a.canvas.height)),!Hl(f)||f.width===0)continue;a.save();let A=u.style.opacity||f.style.opacity;a.globalAlpha=A===""?1:Number(A);let y=f.style.transform;if(y)a.transform(...hE(y));else{let w=parseFloat(f.style.width)/f.width,S=parseFloat(f.style.height)/f.height;a.transform(w,0,0,S,0,0)}a.drawImage(f,0,0),a.restore()}this.dispatchRenderEvent(Bo.POSTCOMPOSE,e),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(e)}declutter(e,t){if(e.declutter){for(let n=t.length-1;n>=0;--n){let r=t[n],s=r.layer;s.getDeclutter()&&s.renderDeclutter(e,r)}t.forEach(n=>n.layer.renderDeferred(e))}}},H$=a6;function W$(i){if(i instanceof TA){i.setMapInternal(null);return}i instanceof i2&&i.getLayers().forEach(W$)}function j$(i,e){if(i instanceof TA){i.setMapInternal(e);return}if(i instanceof i2){let t=i.getLayers().getArray();for(let n=0,r=t.length;n<r;++n)j$(t[n],e)}}var l6=class extends zs{constructor(e){super(),e=e||{},this.on,this.once,this.un;let t=X0e(e);this.renderComplete_=!1,this.loaded_=!0,this.boundHandleBrowserEvent_=this.handleBrowserEvent.bind(this),this.maxTilesLoading_=e.maxTilesLoading!==void 0?e.maxTilesLoading:16,this.pixelRatio_=e.pixelRatio!==void 0?e.pixelRatio:ij,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=go(),this.pixelToCoordinateTransform_=go(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,io||(this.viewport_=document.createElement("div"),this.viewport_.className="ol-viewport"+("ontouchstart"in window?" ol-touch":""),this.viewport_.style.position="relative",this.viewport_.style.overflow="hidden",this.viewport_.style.width="100%",this.viewport_.style.height="100%",this.overlayContainer_=document.createElement("div"),this.overlayContainer_.style.position="absolute",this.overlayContainer_.style.zIndex="0",this.overlayContainer_.style.width="100%",this.overlayContainer_.style.height="100%",this.overlayContainer_.style.pointerEvents="none",this.overlayContainer_.className="ol-overlaycontainer",this.viewport_.appendChild(this.overlayContainer_),this.overlayContainerStopEvent_=document.createElement("div"),this.overlayContainerStopEvent_.style.position="absolute",this.overlayContainerStopEvent_.style.zIndex="0",this.overlayContainerStopEvent_.style.width="100%",this.overlayContainerStopEvent_.style.height="100%",this.overlayContainerStopEvent_.style.pointerEvents="none",this.overlayContainerStopEvent_.className="ol-overlaycontainer-stopevent",this.viewport_.appendChild(this.overlayContainerStopEvent_)),this.mapBrowserEventHandler_=null,this.moveTolerance_=e.moveTolerance,this.keyboardEventTarget_=t.keyboardEventTarget,this.targetChangeHandlerKeys_=null,this.targetElement_=null,io||(this.resizeObserver_=new ResizeObserver(()=>this.updateSize())),this.controls=t.controls||(io?new No:$E()),this.interactions=t.interactions||(io?new No:e3({onFocusOnly:!0})),this.overlays_=t.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new e$(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(Fo.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(Fo.VIEW,this.handleViewChanged_),this.addChangeListener(Fo.SIZE,this.handleSizeChanged_),this.addChangeListener(Fo.TARGET,this.handleTargetChanged_),this.setProperties(t.values);let n=this;e.view&&!(e.view instanceof jl)&&e.view.then(function(r){n.setView(new jl(r))}),this.controls.addEventListener(vo.ADD,r=>{r.element.setMap(this)}),this.controls.addEventListener(vo.REMOVE,r=>{r.element.setMap(null)}),this.interactions.addEventListener(vo.ADD,r=>{r.element.setMap(this)}),this.interactions.addEventListener(vo.REMOVE,r=>{r.element.setMap(null)}),this.overlays_.addEventListener(vo.ADD,r=>{this.addOverlayInternal_(r.element)}),this.overlays_.addEventListener(vo.REMOVE,r=>{let s=r.element.getId();s!==void 0&&delete this.overlayIdIndex_[s.toString()],r.element.setMap(null)}),this.controls.forEach(r=>{r.setMap(this)}),this.interactions.forEach(r=>{r.setMap(this)}),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(e){this.getControls().push(e)}addInteraction(e){this.getInteractions().push(e)}addLayer(e){this.getLayerGroup().getLayers().push(e)}handleLayerAdd_(e){j$(e.layer,this)}addOverlay(e){this.getOverlays().push(e)}addOverlayInternal_(e){let t=e.getId();t!==void 0&&(this.overlayIdIndex_[t.toString()]=e),e.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_?.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(e,t,n){if(!this.frameState_||!this.renderer_)return;let r=this.getCoordinateFromPixelInternal(e);n=n!==void 0?n:{};let s=n.hitTolerance!==void 0?n.hitTolerance:0,o=n.layerFilter!==void 0?n.layerFilter:Jf,a=n.checkWrapped!==!1;return this.renderer_.forEachFeatureAtCoordinate(r,this.frameState_,s,a,t,null,o,null)}getFeaturesAtPixel(e,t){let n=[];return this.forEachFeatureAtPixel(e,function(r){n.push(r)},t),n}getAllLayers(){let e=[];function t(n){n.forEach(function(r){r instanceof i2?t(r.getLayers()):e.push(r)})}return t(this.getLayers()),e}hasFeatureAtPixel(e,t){if(!this.frameState_||!this.renderer_)return!1;let n=this.getCoordinateFromPixelInternal(e);t=t!==void 0?t:{};let r=t.layerFilter!==void 0?t.layerFilter:Jf,s=t.hitTolerance!==void 0?t.hitTolerance:0,o=t.checkWrapped!==!1;return this.renderer_.hasFeatureAtCoordinate(n,this.frameState_,s,o,r,null)}getEventCoordinate(e){return this.getCoordinateFromPixel(this.getEventPixel(e))}getEventCoordinateInternal(e){return this.getCoordinateFromPixelInternal(this.getEventPixel(e))}getEventPixel(e){let n=this.viewport_.getBoundingClientRect(),r=this.getSize(),s=n.width/r[0],o=n.height/r[1],a="changedTouches"in e?e.changedTouches[0]:e;return[(a.clientX-n.left)/s,(a.clientY-n.top)/o]}getTarget(){return this.get(Fo.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(e){return My(this.getCoordinateFromPixelInternal(e),this.getView().getProjection())}getCoordinateFromPixelInternal(e){let t=this.frameState_;return t?jr(t.pixelToCoordinateTransform,e.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(e){let t=this.overlayIdIndex_[e.toString()];return t!==void 0?t:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(Fo.LAYERGROUP)}setLayers(e){let t=this.getLayerGroup();if(e instanceof No){t.setLayers(e);return}let n=t.getLayers();n.clear(),n.extend(e)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){let e=this.getLayerGroup().getLayerStatesArray();for(let t=0,n=e.length;t<n;++t){let r=e[t];if(!r.visible)continue;let s=r.layer.getRenderer();if(s&&!s.ready)return!0;let o=r.layer.getSource();if(o&&o.loading)return!0}return!1}getPixelFromCoordinate(e){let t=_u(e,this.getView().getProjection());return this.getPixelFromCoordinateInternal(t)}getPixelFromCoordinateInternal(e){let t=this.frameState_;return t?jr(t.coordinateToPixelTransform,e.slice(0,2)):null}getPixelRatio(){return this.pixelRatio_}setPixelRatio(e){this.pixelRatio_!==e&&(this.pixelRatio_=e,this.render())}getRenderer(){return this.renderer_}getSize(){return this.get(Fo.SIZE)}getView(){return this.get(Fo.VIEW)}getViewport(){return this.viewport_}getOverlayContainer(){return this.overlayContainer_}getOverlayContainerStopEvent(){return this.overlayContainerStopEvent_}getOwnerDocument(){let e=this.getTargetElement();return e?e.ownerDocument:document}getTilePriority(e,t,n,r){return t$(this.frameState_,e,t,n,r)}handleBrowserEvent(e,t){t=t||e.type;let n=new yh(t,this,e);this.handleMapBrowserEvent(n)}handleMapBrowserEvent(e){if(!this.frameState_)return;let t=e.originalEvent,n=t.type;if(n===e2.POINTERDOWN||n===nn.WHEEL||n===nn.KEYDOWN){let r=this.getOwnerDocument(),s=this.viewport_.getRootNode?this.viewport_.getRootNode():r,o=t.target,a=s instanceof ShadowRoot?s.host===o?s.host.ownerDocument:s:s===r?r.documentElement:s;if(this.overlayContainerStopEvent_.contains(o)||!a.contains(o))return}if(e.frameState=this.frameState_,this.dispatchEvent(e)!==!1){let r=this.getInteractions().getArray().slice();for(let s=r.length-1;s>=0;s--){let o=r[s];if(o.getMap()!==this||!o.getActive()||!this.getTargetElement())continue;if(!o.handleEvent(e)||e.propagationStopped)break}}}handlePostRender(){let e=this.frameState_,t=this.tileQueue_;if(!t.isEmpty()){let r=this.maxTilesLoading_,s=r,o=e?e.viewHints:void 0,a=o?o[so.ANIMATING]||o[so.INTERACTING]:!1;if(a){let l=Date.now()-e.time>8;r=l?0:8,s=l?0:2}t.getTilesLoading()<r&&(a&&t.reprioritize(),t.loadMoreTiles(r,s))}e&&this.renderer_&&!e.animate&&(this.renderComplete_?(this.hasListener(Bo.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(Bo.RENDERCOMPLETE,e),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new zp(bh.LOADEND,this,e)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new zp(bh.LOADSTART,this,e))));let n=this.postRenderFunctions_;if(e)for(let r=0,s=n.length;r<s;++r)n[r](this,e);n.length=0}handleSizeChanged_(){this.getView()&&!this.getView().getAnimating()&&this.getView().resolveConstraints(0),this.render()}handleTargetChanged_(){if(this.mapBrowserEventHandler_){for(let n=0,r=this.targetChangeHandlerKeys_.length;n<r;++n)li(this.targetChangeHandlerKeys_[n]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(nn.CONTEXTMENU,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(nn.WHEEL,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(this.targetElement_&&!Hl(this.targetElement_)){this.resizeObserver_?.unobserve(this.targetElement_);let n=this.targetElement_.getRootNode();n instanceof ShadowRoot&&this.resizeObserver_.unobserve(n.host),this.setSize(void 0)}let e=this.getTarget(),t=typeof e=="string"?document.getElementById(e):e;if(this.targetElement_=t,!t)this.renderer_&&(clearTimeout(this.postRenderTimeoutHandle_),this.postRenderTimeoutHandle_=void 0,this.postRenderFunctions_.length=0,this.renderer_.dispose(),this.renderer_=null),this.animationDelayKey_&&(cancelAnimationFrame(this.animationDelayKey_),this.animationDelayKey_=void 0);else{if(Hl(t)||t.appendChild(this.viewport_),this.renderer_||(this.renderer_=new H$(this)),!Hl(t)){this.mapBrowserEventHandler_=new QX(this,this.moveTolerance_);for(let r in gr)this.mapBrowserEventHandler_.addEventListener(gr[r],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(nn.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(nn.WHEEL,this.boundHandleBrowserEvent_,lE?{passive:!1}:!1);let n;if(this.keyboardEventTarget_)n=this.keyboardEventTarget_;else{let r=t.getRootNode();n=r instanceof ShadowRoot?r.host:t}if(this.targetChangeHandlerKeys_=[qn(n,nn.KEYDOWN,this.handleBrowserEvent,this),qn(n,nn.KEYPRESS,this.handleBrowserEvent,this)],!Hl(t)){let r=t.getRootNode();r instanceof ShadowRoot&&this.resizeObserver_.observe(r.host),this.resizeObserver_?.observe(t)}}this.updateSize()}}handleTileChange_(){this.render()}handleViewPropertyChanged_(){this.render()}handleViewChanged_(){this.viewPropertyListenerKey_&&(li(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(li(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);let e=this.getView();e&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=qn(e,yu.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=qn(e,nn.CHANGE,this.handleViewPropertyChanged_,this),e.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(li),this.layerGroupPropertyListenerKeys_=null);let e=this.getLayerGroup();e&&(this.handleLayerAdd_(new Su("addlayer",e)),this.layerGroupPropertyListenerKeys_=[qn(e,yu.PROPERTYCHANGE,this.render,this),qn(e,nn.CHANGE,this.render,this),qn(e,"addlayer",this.handleLayerAdd_,this),qn(e,"removelayer",this.handleLayerRemove_,this)]),this.render()}isRendered(){return!!this.frameState_}animationDelay_(){this.animationDelayKey_=void 0,this.renderFrame_(Date.now())}renderSync(){this.animationDelayKey_&&cancelAnimationFrame(this.animationDelayKey_),this.animationDelay_()}redrawText(){if(!this.frameState_)return;let e=this.frameState_.layerStatesArray;for(let t=0,n=e.length;t<n;++t){let r=e[t].layer;r.hasRenderer()&&r.getRenderer().handleFontsChanged()}}render(){this.renderer_&&this.animationDelayKey_===void 0&&(this.animationDelayKey_=requestAnimationFrame(this.animationDelay_))}removeControl(e){return this.getControls().remove(e)}removeInteraction(e){return this.getInteractions().remove(e)}removeLayer(e){return this.getLayerGroup().getLayers().remove(e)}handleLayerRemove_(e){W$(e.layer)}removeOverlay(e){return this.getOverlays().remove(e)}renderFrame_(e){let t=this.getSize(),n=this.getView(),r=this.frameState_,s=null;if(t!==void 0&&UD(t)&&n&&n.isDef()){let o=n.getHints(this.frameState_?this.frameState_.viewHints:void 0),a=n.getState();if(s={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutter:null,extent:wy(a.center,a.resolution,a.rotation,t),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:t,tileQueue:this.tileQueue_,time:e,usedTiles:{},viewState:a,viewHints:o,wantedTiles:{},mapId:Bn(this),renderTargets:{}},a.nextCenter&&a.nextResolution){let l=isNaN(a.nextRotation)?a.rotation:a.nextRotation;s.nextExtent=wy(a.nextCenter,a.nextResolution,l,t)}}this.frameState_=s,this.renderer_.renderFrame(s),s&&(s.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,s.postRenderFunctions),r&&(!this.previousExtent_||!dh(this.previousExtent_)&&!Qm(s.extent,this.previousExtent_))&&(this.dispatchEvent(new zp(bh.MOVESTART,this,r)),this.previousExtent_=Km(this.previousExtent_)),this.previousExtent_&&!s.viewHints[so.ANIMATING]&&!s.viewHints[so.INTERACTING]&&!Qm(s.extent,this.previousExtent_)&&(this.dispatchEvent(new zp(bh.MOVEEND,this,s)),zT(s.extent,this.previousExtent_))),this.dispatchEvent(new zp(bh.POSTRENDER,this,s)),this.renderComplete_=(this.hasListener(bh.LOADSTART)||this.hasListener(bh.LOADEND)||this.hasListener(Bo.RENDERCOMPLETE))&&!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady(),this.postRenderTimeoutHandle_||(this.postRenderTimeoutHandle_=setTimeout(()=>{this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(e){let t=this.getLayerGroup();t&&this.handleLayerRemove_(new Su("removelayer",t)),this.set(Fo.LAYERGROUP,e)}setSize(e){this.set(Fo.SIZE,e)}setTarget(e){this.set(Fo.TARGET,e)}setView(e){if(!e||e instanceof jl){this.set(Fo.VIEW,e);return}this.set(Fo.VIEW,new jl);let t=this;e.then(function(n){t.setView(new jl(n))})}updateSize(){let e=this.getTargetElement(),t;if(e){let r,s;if(Hl(e)){let o=e.getContext("2d").getTransform();r=e.width/o.a,s=e.height/o.d}else{let o=getComputedStyle(e);r=e.offsetWidth-parseFloat(o.borderLeftWidth)-parseFloat(o.paddingLeft)-parseFloat(o.paddingRight)-parseFloat(o.borderRightWidth),s=e.offsetHeight-parseFloat(o.borderTopWidth)-parseFloat(o.paddingTop)-parseFloat(o.paddingBottom)-parseFloat(o.borderBottomWidth)}!isNaN(r)&&!isNaN(s)&&(t=[Math.max(0,r),Math.max(0,s)],!UD(t)&&(e.offsetWidth||e.offsetHeight||e.getClientRects().length)&&WT("No map visible because the map container's width or height are 0."))}let n=this.getSize();t&&(!n||!ea(t,n))&&(this.updateViewportSize_(t),this.setSize(t))}updateViewportSize_(e){let t=this.getView();t&&t.setViewportSize(e)}};function X0e(i){let e=null;i.keyboardEventTarget!==void 0&&(e=typeof i.keyboardEventTarget=="string"?document.getElementById(i.keyboardEventTarget):i.keyboardEventTarget);let t={},n=i.layers&&typeof i.layers.getLayers=="function"?i.layers:new i2({layers:i.layers});t[Fo.LAYERGROUP]=n,t[Fo.TARGET]=i.target,t[Fo.VIEW]=i.view instanceof jl?i.view:new jl;let r;i.controls!==void 0&&(Array.isArray(i.controls)?r=new No(i.controls.slice()):(jn(typeof i.controls.getArray=="function","Expected `controls` to be an array or an `ol/Collection.js`"),r=i.controls));let s;i.interactions!==void 0&&(Array.isArray(i.interactions)?s=new No(i.interactions.slice()):(jn(typeof i.interactions.getArray=="function","Expected `interactions` to be an array or an `ol/Collection.js`"),s=i.interactions));let o;return i.overlays!==void 0?Array.isArray(i.overlays)?o=new No(i.overlays.slice()):(jn(typeof i.overlays.getArray=="function","Expected `overlays` to be an array or an `ol/Collection.js`"),o=i.overlays):o=new No,{controls:r,interactions:s,keyboardEventTarget:e,overlays:o,values:t}}var X$=l6;function g3(i){return i instanceof Image||i instanceof HTMLCanvasElement||i instanceof HTMLVideoElement||i instanceof ImageBitmap?i:null}var $0e=new Error("disposed");var Y0e=[256,256],c6=class extends sv{constructor(e){let t=an.IDLE;super(e.tileCoord,t,{transition:e.transition,interpolate:e.interpolate}),this.loader_=e.loader,this.data_=null,this.error_=null,this.size_=e.size||null,this.controller_=e.controller||null}getSize(){if(this.size_)return this.size_;let e=g3(this.data_);return e?[e.width,e.height]:Y0e}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==an.IDLE&&this.state!==an.ERROR)return;this.state=an.LOADING,this.changed();let e=this;this.loader_().then(function(t){e.data_=t,e.state=an.LOADED,e.changed()}).catch(function(t){e.error_=t,e.state=an.ERROR,e.changed()})}disposeInternal(){this.controller_&&(this.controller_.abort($0e),this.controller_=null),super.disposeInternal()}},u6=c6;var h6=class{constructor(e){this.highWaterMark=e!==void 0?e:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}deleteOldest(){let e=this.pop();e instanceof Ip&&e.dispose()}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(e){for(;this.canExpireCache();)this.deleteOldest()}clear(){for(;this.oldest_;)this.deleteOldest()}containsKey(e){return this.entries_.hasOwnProperty(e)}forEach(e){let t=this.oldest_;for(;t;)e(t.value_,t.key_,this),t=t.newer}get(e,t){let n=this.entries_[e];return jn(n!==void 0,"Tried to get a value for a key that does not exist in the cache"),n===this.newest_||(n===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(n.newer.older=n.older,n.older.newer=n.newer),n.newer=null,n.older=this.newest_,this.newest_.newer=n,this.newest_=n),n.value_}remove(e){let t=this.entries_[e];return jn(t!==void 0,"Tried to get a value for a key that does not exist in the cache"),t===this.newest_?(this.newest_=t.older,this.newest_&&(this.newest_.newer=null)):t===this.oldest_?(this.oldest_=t.newer,this.oldest_&&(this.oldest_.older=null)):(t.newer.older=t.older,t.older.newer=t.newer),delete this.entries_[e],--this.count_,t.value_}getCount(){return this.count_}getKeys(){let e=new Array(this.count_),t=0,n;for(n=this.newest_;n;n=n.older)e[t++]=n.key_;return e}getValues(){let e=new Array(this.count_),t=0,n;for(n=this.newest_;n;n=n.older)e[t++]=n.value_;return e}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(e){return this.entries_[e]?.value_}pop(){let e=this.oldest_;return delete this.entries_[e.key_],e.newer&&(e.newer.older=null),this.oldest_=e.newer,this.oldest_||(this.newest_=null),--this.count_,e.value_}replace(e,t){this.get(e),this.entries_[e].value_=t}set(e,t){jn(!(e in this.entries_),"Tried to set a value for a key that is used already");let n={key_:e,newer:null,older:this.newest_,value_:t};this.newest_?this.newest_.newer=n:this.oldest_=n,this.newest_=n,this.entries_[e]=n,++this.count_}setSize(e){this.highWaterMark=e}},f6=h6;var d6=class{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.pendingMethod_,this.context_=new Proxy(Iy(),{get:(e,t)=>{if(typeof e[t]=="function")return this.pendingMethod_=t,this.pushMethodArgs_},set:(e,t,n)=>(this.push_(t,n),!0)})}push_(...e){let t=this.instructions_,n=this.zIndex+this.offset_;t[n]||(t[n]=[]),t[n].push(...e)}pushMethodArgs_=(...e)=>{this.push_(this.pendingMethod_,e)};pushFunction(e){this.push_(e)}getContext(){return this.context_}draw(e){this.instructions_.forEach(t=>{for(let n=0,r=t.length;n<r;++n){let s=t[n];if(typeof s=="function"){s(e);continue}let o=t[++n];typeof e[s]=="function"?e[s](...o):typeof o=="function"?e[s]=o(e):e[s]=o}})}clear(){this.instructions_.length=0,this.zIndex=0,this.offset_=0}offset(){this.offset_=this.instructions_.length,this.zIndex=0}},v3=d6;var Z0e=5,p6=class extends pE{constructor(e){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=e,this.staleKeys_=new Array,this.maxStaleKeys=Z0e,this.renderedSourceKey_}getStaleKeys(){return this.staleKeys_}prependStaleKey(e){this.staleKeys_.unshift(e),this.staleKeys_.length>this.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}updateStaleKeys(e){this.renderedSourceKey_?this.renderedSourceKey_!==e&&(this.prependStaleKey(this.renderedSourceKey_),this.renderedSourceKey_=e):this.renderedSourceKey_=e}getFeatures(e){return ei()}getData(e){return null}prepareFrame(e){return ei()}renderFrame(e,t){return ei()}forEachFeatureAtCoordinate(e,t,n,r,s){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(e){let t=e.target;(t.getState()===In.LOADED||t.getState()===In.ERROR)&&this.renderIfReadyAndVisible()}loadImage(e){let t=e.getState();return t!=In.LOADED&&t!=In.ERROR&&e.addEventListener(nn.CHANGE,this.boundHandleImageChange_),t==In.IDLE&&(e.load(),t=e.getState()),t==In.LOADED}renderIfReadyAndVisible(){let e=this.getLayer();e&&e.getVisible()&&e.getSourceState()==="ready"&&e.changed()}renderDeferred(e){}disposeInternal(){delete this.layer_,super.disposeInternal()}},$$=p6;var A6=[],Ev=null;function K0e(){Ev=Di(1,1,void 0,{willReadFrequently:!0})}var m6=class extends $${constructor(e){super(e),this.container=null,this.renderedResolution,this.tempTransform=go(),this.pixelTransform=go(),this.inversePixelTransform=go(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(e,t,n){Ev||K0e(),Ev.clearRect(0,0,1,1);let r;try{Ev.drawImage(e,t,n,1,1,0,0,1,1),r=Ev.getImageData(0,0,1,1).data}catch{return Ev=null,null}return r}getBackground(e){let n=this.getLayer().getBackground();return typeof n=="function"&&(n=n(e.viewState.resolution)),n||void 0}useContainer(e,t,n,r,s){if(Hl(e)&&this.pixelTransform[1]===0&&this.pixelTransform[2]===0&&this.pixelTransform[4]===0&&this.pixelTransform[5]===0&&e.width===r&&e.height===s){let c=e,u=c.getContext("2d");if(u){this.container=e,this.context=u,this.containerReused=!0,n&&(u.fillStyle=n,u.fillRect(0,0,c.width,c.height));return}}let o=this.getLayer().getClassName(),a,l;if(e&&e.className===o&&(!n||e&&e.style.backgroundColor&&ea(Oc(e.style.backgroundColor),Oc(n)))){let c=e.firstElementChild;Hl(c)&&(l=c.getContext("2d"))}if(l&&Aj(l.canvas.style.transform,t)?(this.container=e,this.context=l,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){a=io?cE():document.createElement("div"),a.className=o;let c=a.style;c.position="absolute",c.width="100%",c.height="100%",l=Di();let u=l.canvas;a.appendChild(u),c=u.style,c.position="absolute",c.left="0",c.transformOrigin="top left",this.container=a,this.context=l}!this.containerReused&&n&&!this.container.style.backgroundColor&&(this.container.style.backgroundColor=n)}clipUnrotated(e,t,n){let r=Ic(n),s=j1(n),o=W1(n),a=H1(n);jr(t.coordinateToPixelTransform,r),jr(t.coordinateToPixelTransform,s),jr(t.coordinateToPixelTransform,o),jr(t.coordinateToPixelTransform,a);let l=this.inversePixelTransform;jr(l,r),jr(l,s),jr(l,o),jr(l,a),e.save(),e.beginPath(),e.moveTo(Math.round(r[0]),Math.round(r[1])),e.lineTo(Math.round(s[0]),Math.round(s[1])),e.lineTo(Math.round(o[0]),Math.round(o[1])),e.lineTo(Math.round(a[0]),Math.round(a[1])),e.clip()}prepareContainer(e,t){let n=e.extent,r=e.viewState.resolution,s=e.viewState.rotation,o=e.pixelRatio,a=Math.round(Kn(n)/r*o),l=Math.round(Dr(n)/r*o);Do(this.pixelTransform,e.size[0]/2,e.size[1]/2,1/o,1/o,s,-a/2,-l/2),fE(this.inversePixelTransform,this.pixelTransform);let c=mj(this.pixelTransform),u=this.getBackground(e);if(this.useContainer(t,c,u,a,l),!this.containerReused){let f=this.context.canvas;f.width!=a||f.height!=l?(f.width=a,f.height=l):this.context.clearRect(0,0,a,l),c!==f.style.transform&&(f.style.transform=c)}}dispatchRenderEvent_(e,t,n){let r=this.getLayer();if(r.hasListener(e)){let s=new A3(e,this.inversePixelTransform,n,t);r.dispatchEvent(s)}}preRender(e,t){this.frameState=t,!t.declutter&&this.dispatchRenderEvent_(Bo.PRERENDER,e,t)}postRender(e,t){t.declutter||this.dispatchRenderEvent_(Bo.POSTRENDER,e,t)}renderDeferredInternal(e){}getRenderContext(e){return e.declutter&&!this.deferredContext_&&(this.deferredContext_=new v3),e.declutter?this.deferredContext_.getContext():this.context}renderDeferred(e){e.declutter&&(this.dispatchRenderEvent_(Bo.PRERENDER,this.context,e),e.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(e),this.dispatchRenderEvent_(Bo.POSTRENDER,this.context,e))}getRenderTransform(e,t,n,r,s,o,a){let l=s/2,c=o/2,u=r/t,f=-u,d=-e[0]+a,A=-e[1];return Do(this.tempTransform,l,c,u,f,-n,d,A)}disposeInternal(){delete this.frameState,super.disposeInternal()}},_3=m6;function g6(i,e,t){if(!(t in i))return i[t]=new Set([e]),!0;let n=i[t],r=n.has(e);return r||n.add(e),!r}function Q0e(i,e,t){let n=i[t];return n?n.delete(e):!1}function Y$(i,e){let t=i.layerStatesArray[i.layerIndex];t.extent&&(e=fh(e,xu(t.extent,i.viewState.projection)));let n=t.layer.getRenderSource();if(!n.getWrapX()){let r=n.getTileGridForProjection(i.viewState.projection).getExtent();r&&(e=fh(e,r))}return e}var v6=class extends _3{constructor(e,t){super(e),t=t||{},this.extentChanged=!0,this.renderComplete=!1,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedTiles=[],this.renderedSourceRevision_,this.tempExtent=Wr(),this.tempTileRange_=new iE(0,0,0,0),this.tempTileCoord_=tv(0,0,0);let n=t.cacheSize!==void 0?t.cacheSize:512;this.tileCache_=new f6(n),this.sourceTileCache_=null,this.layerExtent=null,this.maxStaleKeys=n*.5}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new f6(512)),this.sourceTileCache_}getOrCreateTile(e,t,n,r){let s=this.tileCache_,a=this.getLayer().getSource(),l=nv(a,a.getKey(),e,t,n),c;if(s.containsKey(l))c=s.get(l);else{let u=r.viewState.projection,f=a.getProjection();if(c=a.getTile(e,t,n,r.pixelRatio,u,!f||Q1(f,u)?void 0:this.getSourceTileCache()),!c)return null;s.set(l,c)}return c}getTile(e,t,n,r){let s=this.getOrCreateTile(e,t,n,r);return s||null}getData(e){let t=this.frameState;if(!t)return null;let n=this.getLayer(),r=jr(t.pixelToCoordinateTransform,e.slice()),s=n.getExtent();if(s&&!pu(s,r))return null;let o=t.viewState,a=n.getRenderSource(),l=a.getTileGridForProjection(o.projection),c=a.getTilePixelRatio(t.pixelRatio);for(let u=l.getZForResolution(o.resolution);u>=l.getMinZoom();--u){let f=l.getTileCoordForCoordAndZ(r,u),d=this.getTile(u,f[1],f[2],t);if(!d||d.getState()!==an.LOADED)continue;let A=l.getOrigin(u),y=ls(l.getTileSize(u)),w=l.getResolution(u),S;if(d instanceof uE||d instanceof dE)S=d.getImage();else if(d instanceof u6){if(S=g3(d.getData()),!S)continue}else continue;let T=Math.floor(c*((r[0]-A[0])/w-f[1]*y[0])),R=Math.floor(c*((A[1]-r[1])/w-f[2]*y[1])),P=Math.round(c*a.getGutterForProjection(o.projection));return this.getImageData(S,T+P,R+P)}return null}prepareFrame(e){this.renderedProjection?e.viewState.projection!==this.renderedProjection&&(this.tileCache_.clear(),this.renderedProjection=e.viewState.projection):this.renderedProjection=e.viewState.projection;let t=this.getLayer().getSource();if(!t)return!1;let n=t.getRevision();return this.renderedSourceRevision_?this.renderedSourceRevision_!==n&&(this.renderedSourceRevision_=n,this.renderedSourceKey_===t.getKey()&&(this.tileCache_.clear(),this.sourceTileCache_?.clear())):this.renderedSourceRevision_=n,!0}enqueueTilesForNextExtent(){return!0}enqueueTiles(e,t,n,r,s){let o=e.viewState,a=this.getLayer(),l=a.getRenderSource(),c=l.getTileGridForProjection(o.projection),u=Bn(l);u in e.wantedTiles||(e.wantedTiles[u]={});let f=e.wantedTiles[u],d=a.getMapInternal(),A=Math.max(n-s,c.getMinZoom(),c.getZForResolution(Math.min(a.getMaxResolution(),d?d.getView().getResolutionForZoom(Math.max(a.getMinZoom(),0)):c.getResolution(0)),l.zDirection)),y=o.rotation,w=y?wD(o.center,o.resolution,y,e.size):void 0;for(let S=n;S>=A;--S){let T=c.getTileRangeForExtentAndZ(t,S,this.tempTileRange_),R=c.getResolution(S);for(let P=T.minX;P<=T.maxX;++P)for(let I=T.minY;I<=T.maxY;++I){if(y&&!c.tileCoordIntersectsViewport([S,P,I],w))continue;let F=this.getTile(S,P,I,e);if(!F||!g6(r,F,S))continue;let L=F.getKey();if(f[L]=!0,F.getState()===an.IDLE&&!e.tileQueue.isKeyQueued(L)){let C=tv(S,P,I,this.tempTileCoord_);e.tileQueue.enqueue([F,u,c.getTileCoordCenter(C),R])}}}}findStaleTile_(e,t){let n=this.tileCache_,r=e[0],s=e[1],o=e[2],a=this.getStaleKeys();for(let l=0;l<a.length;++l){let c=nv(this.getLayer().getSource(),a[l],r,s,o);if(n.containsKey(c)){let u=n.peek(c);if(u.getState()===an.LOADED)return u.endTransition(Bn(this)),g6(t,u,r),!0}}return!1}findAltTiles_(e,t,n,r){let s=e.getTileRangeForTileCoordAndZ(t,n,this.tempTileRange_);if(!s)return!1;let o=!0,a=this.tileCache_,l=this.getLayer().getRenderSource(),c=l.getKey();for(let u=s.minX;u<=s.maxX;++u)for(let f=s.minY;f<=s.maxY;++f){let d=nv(l,c,n,u,f),A=!1;if(a.containsKey(d)){let y=a.peek(d);y.getState()===an.LOADED&&(g6(r,y,n),A=!0)}A||(o=!1)}return o}renderFrame(e,t){this.renderComplete=!0;let n=e.layerStatesArray[e.layerIndex],r=e.viewState,s=r.projection,o=r.resolution,a=r.center,l=e.pixelRatio,c=this.getLayer(),u=c.getSource(),f=u.getTileGridForProjection(s),d=f.getZForResolution(o,u.zDirection),A=f.getResolution(d);this.updateStaleKeys(u.getKey());let y=e.extent,w=u.getTilePixelRatio(l);this.prepareContainer(e,t);let S=this.context.canvas.width,T=this.context.canvas.height;this.layerExtent=n.extent?xu(n.extent,s):null,this.layerExtent&&(y=fh(y,this.layerExtent));let R=A*S/2/w,P=A*T/2/w,I=[a[0]-R,a[1]-P,a[0]+R,a[1]+P],F={};this.renderedTiles.length=0;let D=c.getPreload();if(e.nextExtent&&this.enqueueTilesForNextExtent()){let $=f.getZForResolution(r.nextResolution,u.zDirection),J=Y$(e,e.nextExtent);this.enqueueTiles(e,J,$,F,D)}let L=Y$(e,y);if(this.enqueueTiles(e,L,d,F,0),D>0&&setTimeout(()=>{this.enqueueTiles(e,L,d-1,F,D-1)},0),!(d in F))return this.container;let C=Bn(this),B=e.time;for(let $ of F[d]){let J=$.getState();if(J===an.EMPTY)continue;let te=$.tileCoord;if(J===an.LOADED&&$.getAlpha(C,B)===1){$.endTransition(C);continue}if(J!==an.ERROR&&(this.renderComplete=!1),this.findStaleTile_(te,F)){Q0e(F,$,d),e.animate=!0;continue}if(this.findAltTiles_(f,te,d+1,F))continue;let ve=f.getMinZoom();for(let Re=d-1;Re>=ve&&!this.findAltTiles_(f,te,Re,F);--Re);}let k=A/o*l/w,z=this.getRenderContext(e);Do(this.tempTransform,S/2,T/2,k,k,0,-S/2,-T/2),this.layerExtent&&this.clipUnrotated(z,e,this.layerExtent),u.getInterpolate()||(z.imageSmoothingEnabled=!1),this.preRender(z,e);let G=Object.keys(F).map(Number);G.sort(pl);let W=[],Y=[],H=[];for(let $=G.length-1;$>=0;--$){let J=G[$],te=u.getTilePixelSize(J,l,s),he=f.getResolution(J)/A,ve=te[0]*he*k,Re=te[1]*he*k,Qe=f.getTileCoordForCoordAndZ(Ic(I),J),Fe=f.getTileCoordExtent(Qe),mt=jr(this.tempTransform,[w*(Fe[0]-I[0])/A,w*(I[3]-Fe[3])/A]),Ee=w*u.getGutterForProjection(s);for(let Ve of F[J]){if(Ve.getState()!==an.LOADED)continue;let Ye=Ve.tileCoord,Mt=Qe[1]-Ye[1],Et=Math.round(mt[0]-(Mt-1)*ve),It=Qe[2]-Ye[2],dn=Math.round(mt[1]-(It-1)*Re),Gt=Math.round(mt[0]-Mt*ve),$e=Math.round(mt[1]-It*Re),ot=Et-Gt,nt=dn-$e,bt=J===d;if(bt&&Ve.inTransition(C)){H.push({tile:Ve,x:Gt,y:$e,w:ot,h:nt,gutter:Ee}),this.renderedTiles.unshift(Ve),this.updateUsedTiles(e.usedTiles,u,Ve);continue}let yt=[Gt,$e,Gt+ot,$e+nt],hn=[];for(let tn=0,bn=W.length;tn<bn;++tn)J<Y[tn]&&Ar(yt,W[tn])&&hn.push(W[tn]);let en;hn.length>0&&(en=hW(yt,hn)),W.push(yt),Y.push(J),this.drawTile(Ve,e,Gt,$e,ot,nt,Ee,bt,en),this.renderedTiles.unshift(Ve),this.updateUsedTiles(e.usedTiles,u,Ve)}}for(let $=0,J=H.length;$<J;++$){let{tile:te,x:ce,y:he,w:ve,h:Re,gutter:Qe}=H[$];this.drawTile(te,e,ce,he,ve,Re,Qe,!0,void 0)}if(this.renderedResolution=A,this.extentChanged=!this.renderedExtent_||!Qm(this.renderedExtent_,I),this.renderedExtent_=I,this.renderedPixelRatio=l,this.postRender(this.context,e),this.layerExtent&&z.restore(),z.imageSmoothingEnabled=!0,this.renderComplete){let $=(J,te)=>{let ce=Bn(u),he=te.wantedTiles[ce],ve=he?Object.keys(he).length:0;this.updateCacheSize(ve),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache()};e.postRenderFunctions.push($)}return this.container}updateCacheSize(e){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,e*2)}drawTile(e,t,n,r,s,o,a,l,c){let u;if(e instanceof u6){if(u=g3(e.getData()),!u)throw new Error("Rendering array data is not yet supported")}else u=this.getTileImage(e);if(!u)return;let f=this.getRenderContext(t),d=Bn(this),A=t.layerStatesArray[t.layerIndex],y=A.opacity*(l?e.getAlpha(d,t.time):1),w=y!==f.globalAlpha;w&&(f.save(),f.globalAlpha=y);let S=u.width-2*a,T=u.height-2*a;if(c){let R=S/s,P=T/o;for(let I=0,F=c.length;I<F;++I){let D=c[I],L=D[0],C=D[1],B=D[2]-D[0],k=D[3]-D[1];f.drawImage(u,a+(L-n)*R,a+(C-r)*P,B*R,k*P,L,C,B,k)}}else f.drawImage(u,a,a,S,T,n,r,s,o);w&&f.restore(),y!==A.opacity?t.animate=!0:l&&e.endTransition(d)}getImage(){let e=this.context;return e?e.canvas:null}getTileImage(e){return e.getImage()}updateUsedTiles(e,t,n){let r=Bn(t);r in e||(e[r]={}),e[r][n.getKey()]=!0}},Z$=v6;var d2={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};var _6=class extends TA{constructor(e){e=e||{};let t=Object.assign({},e),n=e.cacheSize;delete e.cacheSize,delete t.preload,delete t.useInterimTilesOnError,super(t),this.on,this.once,this.un,this.cacheSize_=n,this.setPreload(e.preload!==void 0?e.preload:0),this.setUseInterimTilesOnError(e.useInterimTilesOnError!==void 0?e.useInterimTilesOnError:!0)}getCacheSize(){return this.cacheSize_}getPreload(){return this.get(d2.PRELOAD)}setPreload(e){this.set(d2.PRELOAD,e)}getUseInterimTilesOnError(){return this.get(d2.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(e){this.set(d2.USE_INTERIM_TILES_ON_ERROR,e)}getData(e){return super.getData(e)}},K$=_6;var x6=class extends K${constructor(e){super(e)}createRenderer(){return new Z$(this,{cacheSize:this.getCacheSize()})}},y6=x6;var b6=class{drawCustom(e,t,n,r,s){}drawGeometry(e){}setStyle(e){}drawCircle(e,t,n){}drawFeature(e,t,n){}drawGeometryCollection(e,t,n){}drawLineString(e,t,n){}drawMultiLineString(e,t,n){}drawMultiPoint(e,t,n){}drawMultiPolygon(e,t,n){}drawPoint(e,t,n){}drawPolygon(e,t,n){}drawText(e,t,n){}setFillStrokeStyle(e,t){}setImageStyle(e,t){}setTextStyle(e,t){}},x3=b6;var p2={BEGIN_GEOMETRY:0,BEGIN_PATH:1,CIRCLE:2,CLOSE_PATH:3,CUSTOM:4,DRAW_CHARS:5,DRAW_IMAGE:6,END_GEOMETRY:7,FILL:8,MOVE_TO_LINE_TO:9,SET_FILL_STYLE:10,SET_STROKE_STYLE:11,STROKE:12},m2=[p2.FILL],Th=[p2.STROKE],md=[p2.BEGIN_PATH],w6=[p2.CLOSE_PATH],vn=p2;var S6=class extends x3{constructor(e,t,n,r){super(),this.tolerance=e,this.maxExtent=t,this.pixelRatio=r,this.maxLineWidth=0,this.resolution=n,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(e){let t=this.pixelRatio;return t==1?e:e.map(function(n){return n*t})}appendFlatPointCoordinates(e,t){let n=this.getBufferedMaxExtent(),r=this.tmpCoordinate_,s=this.coordinates,o=s.length;for(let a=0,l=e.length;a<l;a+=t)r[0]=e[a],r[1]=e[a+1],pu(n,r)&&(s[o++]=r[0],s[o++]=r[1]);return o}appendFlatLineCoordinates(e,t,n,r,s,o){let a=this.coordinates,l=a.length,c=this.getBufferedMaxExtent();o&&(t+=r);let u=e[t],f=e[t+1],d=this.tmpCoordinate_,A=!0,y,w,S;for(y=t+r;y<n;y+=r)d[0]=e[y],d[1]=e[y+1],S=kT(c,d),S!==w?(A&&(a[l++]=u,a[l++]=f,A=!1),a[l++]=d[0],a[l++]=d[1]):S===Us.INTERSECTING?(a[l++]=d[0],a[l++]=d[1],A=!1):A=!0,u=d[0],f=d[1],w=S;return(s&&A||y===t+r)&&(a[l++]=u,a[l++]=f),l}drawCustomCoordinates_(e,t,n,r,s){for(let o=0,a=n.length;o<a;++o){let l=n[o],c=this.appendFlatLineCoordinates(e,t,l,r,!1,!1);s.push(c),t=l}return t}drawCustom(e,t,n,r,s){this.beginGeometry(e,t,s);let o=e.getType(),a=e.getStride(),l=this.coordinates.length,c,u,f,d,A;switch(o){case"MultiPolygon":c=e.getOrientedFlatCoordinates(),d=[];let y=e.getEndss();A=0;for(let w=0,S=y.length;w<S;++w){let T=[];A=this.drawCustomCoordinates_(c,A,y[w],a,T),d.push(T)}this.instructions.push([vn.CUSTOM,l,d,e,n,Ny,s]),this.hitDetectionInstructions.push([vn.CUSTOM,l,d,e,r||n,Ny,s]);break;case"Polygon":case"MultiLineString":f=[],c=o=="Polygon"?e.getOrientedFlatCoordinates():e.getFlatCoordinates(),A=this.drawCustomCoordinates_(c,0,e.getEnds(),a,f),this.instructions.push([vn.CUSTOM,l,f,e,n,Dp,s]),this.hitDetectionInstructions.push([vn.CUSTOM,l,f,e,r||n,Dp,s]);break;case"LineString":case"Circle":c=e.getFlatCoordinates(),u=this.appendFlatLineCoordinates(c,0,c.length,a,!1,!1),this.instructions.push([vn.CUSTOM,l,u,e,n,Bc,s]),this.hitDetectionInstructions.push([vn.CUSTOM,l,u,e,r||n,Bc,s]);break;case"MultiPoint":c=e.getFlatCoordinates(),u=this.appendFlatPointCoordinates(c,a),u>l&&(this.instructions.push([vn.CUSTOM,l,u,e,n,Bc,s]),this.hitDetectionInstructions.push([vn.CUSTOM,l,u,e,r||n,Bc,s]));break;case"Point":c=e.getFlatCoordinates(),this.coordinates.push(c[0],c[1]),u=this.coordinates.length,this.instructions.push([vn.CUSTOM,l,u,e,n,void 0,s]),this.hitDetectionInstructions.push([vn.CUSTOM,l,u,e,r||n,void 0,s]);break;default:}this.endGeometry(t)}beginGeometry(e,t,n){this.beginGeometryInstruction1_=[vn.BEGIN_GEOMETRY,t,0,e,n],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[vn.BEGIN_GEOMETRY,t,0,e,n],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){let e=this.hitDetectionInstructions;e.reverse();let t,n=e.length,r,s,o=-1;for(t=0;t<n;++t)r=e[t],s=r[0],s==vn.END_GEOMETRY?o=t:s==vn.BEGIN_GEOMETRY&&(r[2]=t,qW(this.hitDetectionInstructions,o,t),o=-1)}fillStyleToState(e,t={}){if(e){let n=e.getColor();t.fillPatternScale=n&&typeof n=="object"&&"src"in n?this.pixelRatio:1,t.fillStyle=gl(n||ro)??void 0}else t.fillStyle=void 0;return t}strokeStyleToState(e,t={}){if(e){let n=e.getColor();t.strokeStyle=gl(n||na);let r=e.getLineCap();t.lineCap=r!==void 0?r:_h;let s=e.getLineDash();t.lineDash=s?s.slice():vl;let o=e.getLineDashOffset();t.lineDashOffset=o||_l;let a=e.getLineJoin();t.lineJoin=a!==void 0?a:xh;let l=e.getWidth();t.lineWidth=l!==void 0?l:ad;let c=e.getMiterLimit();t.miterLimit=c!==void 0?c:sd;let u=e.getOffset();t.strokeOffset=u??oX,t.lineWidth>this.maxLineWidth&&(this.maxLineWidth=t.lineWidth,this.bufferedMaxExtent_=null)}else t.strokeStyle=void 0,t.lineCap=void 0,t.lineDash=null,t.lineDashOffset=void 0,t.lineJoin=void 0,t.lineWidth=void 0,t.miterLimit=void 0,t.strokeOffset=void 0;return t}setFillStrokeStyle(e,t){let n=this.state;this.fillStyleToState(e,n),this.strokeStyleToState(t,n)}createFill(e){let t=e.fillStyle,n=[vn.SET_FILL_STYLE,t];return typeof t!="string"&&n.push(e.fillPatternScale),n}applyStroke(e){this.instructions.push(this.createStroke(e))}createStroke(e){return[vn.SET_STROKE_STYLE,e.strokeStyle,e.lineWidth*this.pixelRatio,e.lineCap,e.lineJoin,e.miterLimit,e.lineDash?this.applyPixelRatio(e.lineDash):null,e.lineDashOffset*this.pixelRatio]}updateFillStyle(e,t){let n=e.fillStyle;(n!==void 0&&typeof n!="string"||e.currentFillStyle!=n)&&(this.instructions.push(t.call(this,e)),e.currentFillStyle=n)}updateStrokeStyle(e,t){let n=e.strokeStyle,r=e.lineCap,s=e.lineDash,o=e.lineDashOffset,a=e.lineJoin,l=e.lineWidth,c=e.miterLimit,u=e.strokeOffset;(e.currentStrokeStyle!=n||e.currentLineCap!=r||s!=e.currentLineDash&&!ea(e.currentLineDash,s)||e.currentLineDashOffset!=o||e.currentLineJoin!=a||e.currentLineWidth!=l||e.currentMiterLimit!=c||e.currentStrokeOffset!=u)&&(t.call(this,e),e.currentStrokeStyle=n,e.currentLineCap=r,e.currentLineDash=s,e.currentLineDashOffset=o,e.currentLineJoin=a,e.currentLineWidth=l,e.currentMiterLimit=c,e.currentStrokeOffset=u)}endGeometry(e){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;let t=[vn.END_GEOMETRY,e];this.instructions.push(t),this.hitDetectionInstructions.push(t)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=zT(this.maxExtent),this.maxLineWidth>0)){let e=this.resolution*(this.maxLineWidth+1)/2;G1(this.bufferedMaxExtent_,e,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}},Eh=S6;var T6=class extends Eh{constructor(e,t,n,r){super(e,t,n,r),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(e,t,n){if(!this.image_||this.maxExtent&&!pu(this.maxExtent,e.getFlatCoordinates()))return;this.beginGeometry(e,t,n);let r=e.getFlatCoordinates(),s=e.getStride(),o=this.coordinates.length,a=this.appendFlatPointCoordinates(r,s);this.instructions.push([vn.DRAW_IMAGE,o,a,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([vn.DRAW_IMAGE,o,a,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(t)}drawMultiPoint(e,t,n){if(!this.image_)return;this.beginGeometry(e,t,n);let r=e.getFlatCoordinates(),s=[];for(let l=0,c=r.length;l<c;l+=e.getStride())(!this.maxExtent||pu(this.maxExtent,r.slice(l,l+2)))&&s.push(r[l],r[l+1]);let o=this.coordinates.length,a=this.appendFlatPointCoordinates(s,2);this.instructions.push([vn.DRAW_IMAGE,o,a,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([vn.DRAW_IMAGE,o,a,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(t)}finish(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,super.finish()}setImageStyle(e,t){let n=e.getAnchor(),r=e.getSize(),s=e.getOrigin();this.imagePixelRatio_=e.getPixelRatio(this.pixelRatio),this.anchorX_=n[0],this.anchorY_=n[1],this.hitDetectionImage_=e.getHitDetectionImage(),this.image_=e.getImage(this.pixelRatio),this.height_=r[1],this.opacity_=e.getOpacity(),this.originX_=s[0],this.originY_=s[1],this.rotateWithView_=e.getRotateWithView(),this.rotation_=e.getRotation(),this.scale_=e.getScaleArray(),this.width_=r[0],this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}},Q$=T6;var E6=class extends Eh{constructor(e,t,n,r){super(e,t,n,r)}drawFlatCoordinates_(e,t,n,r,s){let o=this.coordinates.length,a=this.appendFlatLineCoordinates(e,t,n,r,!1,!1);return this.instructions.push([vn.MOVE_TO_LINE_TO,o,a,s*this.pixelRatio]),this.hitDetectionInstructions.push([vn.MOVE_TO_LINE_TO,o,a,s]),n}drawLineString(e,t,n){let r=this.state,s=r.strokeStyle,o=r.lineWidth,a=r.strokeOffset;if(s===void 0||o===void 0)return;this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(e,t,n),this.hitDetectionInstructions.push([vn.SET_STROKE_STYLE,na,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,vl,_l],md);let l=e.getFlatCoordinates(),c=e.getStride();this.drawFlatCoordinates_(l,0,l.length,c,a),this.hitDetectionInstructions.push(Th),this.endGeometry(t)}drawMultiLineString(e,t,n){let r=this.state,s=r.strokeStyle,o=r.lineWidth,a=r.strokeOffset;if(s===void 0||o===void 0)return;this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(e,t,n),this.hitDetectionInstructions.push([vn.SET_STROKE_STYLE,na,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,vl,_l],md);let l=e.getEnds(),c=e.getFlatCoordinates(),u=e.getStride(),f=0;for(let d=0,A=l.length;d<A;++d)f=this.drawFlatCoordinates_(c,f,l[d],u,a);this.hitDetectionInstructions.push(Th),this.endGeometry(t)}finish(){let e=this.state;return e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&this.instructions.push(Th),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(e){e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&(this.instructions.push(Th),e.lastStroke=this.coordinates.length),e.lastStroke=0,super.applyStroke(e),this.instructions.push(md)}},J$=E6;var M6=class extends Eh{constructor(e,t,n,r){super(e,t,n,r)}drawFlatCoordinatess_(e,t,n,r,s){let o=this.state,a=o.fillStyle!==void 0,l=o.strokeStyle!==void 0,c=n.length;this.instructions.push(md),this.hitDetectionInstructions.push(md);for(let u=0;u<c;++u){let f=n[u],d=this.coordinates.length,A=this.appendFlatLineCoordinates(e,t,f,r,!0,!l);this.instructions.push([vn.MOVE_TO_LINE_TO,d,A,s*this.pixelRatio,!0]),this.hitDetectionInstructions.push([vn.MOVE_TO_LINE_TO,d,A,s,!0]),l&&(this.instructions.push(w6),this.hitDetectionInstructions.push(w6)),t=f}return a&&(this.instructions.push(m2),this.hitDetectionInstructions.push(m2)),l&&(this.instructions.push(Th),this.hitDetectionInstructions.push(Th)),t}drawCircle(e,t,n){let r=this.state,s=r.fillStyle,o=r.strokeStyle,a=r.strokeOffset;if(s===void 0&&o===void 0||this.handleStrokeOffset_(()=>this.drawCircle(e,t,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([vn.SET_FILL_STYLE,ro]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([vn.SET_STROKE_STYLE,na,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,vl,_l]);let l=e.getFlatCoordinates(),c=e.getStride(),u=this.coordinates.length;this.appendFlatLineCoordinates(l,0,l.length,c,!1,!1);let f=[vn.CIRCLE,u,a];this.instructions.push(md,f),this.hitDetectionInstructions.push(md,f),r.fillStyle!==void 0&&(this.instructions.push(m2),this.hitDetectionInstructions.push(m2)),r.strokeStyle!==void 0&&(this.instructions.push(Th),this.hitDetectionInstructions.push(Th)),this.endGeometry(t)}drawPolygon(e,t,n){let r=this.state,s=r.fillStyle,o=r.strokeStyle,a=r.strokeOffset;if(s===void 0&&o===void 0||this.handleStrokeOffset_(()=>this.drawPolygon(e,t,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([vn.SET_FILL_STYLE,ro]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([vn.SET_STROKE_STYLE,na,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,vl,_l]);let l=e.getEnds(),c=e.getOrientedFlatCoordinates(),u=e.getStride();this.drawFlatCoordinatess_(c,0,l,u,a),this.endGeometry(t)}drawMultiPolygon(e,t,n){let r=this.state,s=r.fillStyle,o=r.strokeStyle,a=r.strokeOffset;if(s===void 0&&o===void 0||this.handleStrokeOffset_(()=>this.drawMultiPolygon(e,t,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([vn.SET_FILL_STYLE,ro]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([vn.SET_STROKE_STYLE,na,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,vl,_l]);let l=e.getEndss(),c=e.getOrientedFlatCoordinates(),u=e.getStride(),f=0;for(let d=0,A=l.length;d<A;++d)f=this.drawFlatCoordinatess_(c,f,l[d],u,a);this.endGeometry(t)}finish(){this.reverseHitDetectionInstructions(),this.state=null;let e=this.tolerance;if(e!==0){let t=this.coordinates;for(let n=0,r=t.length;n<r;++n)t[n]=Np(t[n],e)}return super.finish()}setFillStrokeStyles_(){let e=this.state;this.updateFillStyle(e,this.createFill),this.updateStrokeStyle(e,this.applyStroke)}handleStrokeOffset_(e){let t=this.state,n=t.fillStyle,r=t.strokeStyle,s=t.strokeOffset;return Math.abs(s)>0&&n!==void 0&&r!==void 0?(t.strokeStyle=void 0,t.strokeOffset=0,e(),t.fillStyle=void 0,t.strokeStyle=r,t.strokeOffset=s,e(),t.fillStyle=n,!0):!1}},C6=M6;var R6=0,I6=1;function J0e(i,e,t,n,r,s,o,a){let l=o-r,c=a-s,u=0,f=1;if(l===0){if(r<i||r>t)return!1}else{let d=(i-r)/l,A=(t-r)/l;if(d>A){let y=d;d=A,A=y}if(d>u&&(u=d),A<f&&(f=A),u>f)return!1}if(c===0){if(s<e||s>n)return!1}else{let d=(e-s)/c,A=(n-s)/c;if(d>A){let y=d;d=A,A=y}if(d>u&&(u=d),A<f&&(f=A),u>f)return!1}return R6=u,I6=f,!0}function eY(i,e,t,n){let r=n[0],s=n[1],o=n[2],a=n[3],l=[],c=[],u=!1,f,d,A=0;for(let y=0,w=e.length;y<w;++y){let S=e[y],T=i[A],R=i[A+1],P=!1;for(let I=A+t;I<S;I+=t){let F=i[I],D=i[I+1];if(J0e(r,s,o,a,T,R,F,D)){let L=F-T,C=D-R,B=T+R6*L,k=R+R6*C,z=T+I6*L,G=R+I6*C;u&&P&&B===f&&k===d?l.push(z,G):(u&&c.push(l.length),l.push(B,k,z,G),u=!0),f=z,d=G,P=!0}T=F,R=D}A=S}return u&&c.push(l.length),{flatCoordinates:l,ends:c}}function tY(i,e,t,n,r){let s=[],o=t,a=0,l=e.slice(t,2);for(;a<i&&o+r<n;){let[c,u]=l.slice(-2),f=e[o+r],d=e[o+r+1],A=Math.sqrt((f-c)*(f-c)+(d-u)*(d-u));if(a+=A,a>=i){let y=(i-a+A)/A,w=Po(c,f,y),S=Po(u,d,y);l.push(w,S),s.push(l),l=[w,S],a==i&&(o+=r),a=0}else if(a<i)l.push(e[o+r],e[o+r+1]),o+=r;else{let y=A-a,w=Po(c,f,y/A),S=Po(u,d,y/A);l.push(w,S),s.push(l),l=[w,S],a=0,o+=r}}return a>0&&s.push(l),s}function nY(i,e,t,n,r){let s=t,o=t,a=0,l=0,c=t,u,f,d,A,y,w,S,T,R,P;for(f=t;f<n;f+=r){let I=e[f],F=e[f+1];y!==void 0&&(R=I-y,P=F-w,A=Math.sqrt(R*R+P*P),S!==void 0&&(l+=d,u=Math.acos((S*R+T*P)/(d*A)),u>i&&(l>a&&(a=l,s=c,o=f),l=0,c=f-r)),d=A,S=R,T=P),y=I,w=F}return l+=A,l>a?[c,f]:[s,o]}var A2={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},P6=class extends Eh{constructor(e,t,n,r){super(e,t,n,r),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textKeepUpright_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[ro]={fillStyle:ro},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterMode_=void 0,this.declutterImageWithText_=void 0}finish(){let e=super.finish();return e.textStates=this.textStates,e.fillStates=this.fillStates,e.strokeStates=this.strokeStates,e}drawText(e,t,n){let r=this.textFillState_,s=this.textStrokeState_,o=this.textState_;if(this.text_===""||!o||!r&&!s)return;let a=this.coordinates,l=a.length,c=e.getType(),u=null,f=e.getStride();if(o.placement==="line"&&(c=="LineString"||c=="MultiLineString"||c=="Polygon"||c=="MultiPolygon")){let d=e.getExtent();if(!Ar(this.maxExtent,d))return;let A;if(u=e.getFlatCoordinates(),c=="LineString")A=[u.length];else if(c=="MultiLineString")A=e.getEnds();else if(c=="Polygon")A=e.getEnds().slice(0,1);else if(c=="MultiPolygon"){let T=e.getEndss();A=[];for(let R=0,P=T.length;R<P;++R)A.push(T[R][0])}if((c=="LineString"||c=="MultiLineString")&&!hh(this.getBufferedMaxExtent(),d)){let T=eY(u,A,f,this.getBufferedMaxExtent());if(u=T.flatCoordinates,A=T.ends,f=2,A.length===0)return}this.beginGeometry(e,t,n);let y=o.repeat,w=y?void 0:o.textAlign,S=0;for(let T=0,R=A.length;T<R;++T){let P;y?P=tY(y*this.resolution,u,S,A[T],f):P=[u.slice(S,A[T])];for(let I=0,F=P.length;I<F;++I){let D=P[I],L=0,C=D.length;if(w==null){let k=nY(o.maxAngle,D,0,D.length,2);L=k[0],C=k[1]}for(let k=L;k<C;k+=f)a.push(D[k],D[k+1]);let B=a.length;S=A[T],this.drawChars_(l,B),l=B}}this.endGeometry(t)}else{let d=o.overflow?null:[];switch(c){case"Point":case"MultiPoint":u=e.getFlatCoordinates();break;case"LineString":u=e.getFlatMidpoint();break;case"Circle":u=e.getCenter();break;case"MultiLineString":u=e.getFlatMidpoints(),f=2;break;case"Polygon":u=e.getFlatInteriorPoint(),o.overflow||d.push(u[2]/this.resolution),f=3;break;case"MultiPolygon":let I=e.getFlatInteriorPoints();u=[];for(let F=0,D=I.length;F<D;F+=3)o.overflow||d.push(I[F+2]/this.resolution),u.push(I[F],I[F+1]);if(u.length===0)return;f=2;break;default:}let A=this.appendFlatPointCoordinates(u,f);if(A===l)return;if(d&&(A-l)/2!==u.length/f){let I=l/2;d=d.filter((F,D)=>{let L=a[(I+D)*2]===u[D*f]&&a[(I+D)*2+1]===u[D*f+1];return L||--I,L})}this.saveTextStates_();let y=o.backgroundFill?this.createFill(this.fillStyleToState(o.backgroundFill)):null,w=o.backgroundStroke?this.createStroke(this.strokeStyleToState(o.backgroundStroke)):null;this.beginGeometry(e,t,n);let S=o.padding;if(S!=od&&(o.scale[0]<0||o.scale[1]<0)){let I=o.padding[0],F=o.padding[1],D=o.padding[2],L=o.padding[3];o.scale[0]<0&&(F=-F,L=-L),o.scale[1]<0&&(I=-I,D=-D),S=[I,F,D,L]}let T=this.pixelRatio;this.instructions.push([vn.DRAW_IMAGE,l,A,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,S==od?od:S.map(function(I){return I*T}),y,w,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,d]);let R=1/T,P=y?y.slice(0):null;P&&(P[1]=ro),this.hitDetectionInstructions.push([vn.DRAW_IMAGE,l,A,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[R,R],NaN,this.declutterMode_,this.declutterImageWithText_,S,P,w,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?ro:this.fillKey_,this.textOffsetX_,this.textOffsetY_,d]),this.endGeometry(t)}}saveTextStates_(){let e=this.textStrokeState_,t=this.textState_,n=this.textFillState_,r=this.strokeKey_;e&&(r in this.strokeStates||(this.strokeStates[r]={strokeStyle:e.strokeStyle,lineCap:e.lineCap,lineDashOffset:e.lineDashOffset,lineWidth:e.lineWidth,lineJoin:e.lineJoin,miterLimit:e.miterLimit,lineDash:e.lineDash}));let s=this.textKey_;s in this.textStates||(this.textStates[s]={font:t.font,textAlign:t.textAlign||Up,justify:t.justify,textBaseline:t.textBaseline||_A,scale:t.scale});let o=this.fillKey_;n&&(o in this.fillStates||(this.fillStates[o]={fillStyle:n.fillStyle}))}drawChars_(e,t){let n=this.textStrokeState_,r=this.textState_,s=this.strokeKey_,o=this.textKey_,a=this.fillKey_;this.saveTextStates_();let l=this.pixelRatio,c=A2[r.textBaseline],u=this.textOffsetX_*l,f=this.textOffsetY_*l,d=this.text_,A=n?n.lineWidth*Math.abs(r.scale[0])/2:0;this.instructions.push([vn.DRAW_CHARS,e,t,c,r.overflow,a,r.maxAngle,l,f,s,A*l,d,o,1,this.declutterMode_,this.textKeepUpright_,u]),this.hitDetectionInstructions.push([vn.DRAW_CHARS,e,t,c,r.overflow,a&&ro,r.maxAngle,l,f,s,A*l,d,o,1/l,this.declutterMode_,this.textKeepUpright_,u])}setTextStyle(e,t){let n,r,s;if(!e)this.text_="";else{let o=e.getFill();o?(r=this.textFillState_,r||(r={},this.textFillState_=r),r.fillStyle=gl(o.getColor()||ro)):(r=null,this.textFillState_=r);let a=e.getStroke();if(!a)s=null,this.textStrokeState_=s;else{s=this.textStrokeState_,s||(s={},this.textStrokeState_=s);let w=a.getLineDash(),S=a.getLineDashOffset(),T=a.getWidth(),R=a.getMiterLimit();s.lineCap=a.getLineCap()||_h,s.lineDash=w?w.slice():vl,s.lineDashOffset=S===void 0?_l:S,s.lineJoin=a.getLineJoin()||xh,s.lineWidth=T===void 0?ad:T,s.miterLimit=R===void 0?sd:R,s.strokeStyle=gl(a.getColor()||na)}n=this.textState_;let l=e.getFont()||BE;aX(l);let c=e.getScaleArray();n.overflow=e.getOverflow(),n.font=l,n.maxAngle=e.getMaxAngle(),n.placement=e.getPlacement(),n.textAlign=e.getTextAlign(),n.repeat=e.getRepeat(),n.justify=e.getJustify(),n.textBaseline=e.getTextBaseline()||_A,n.backgroundFill=e.getBackgroundFill(),n.backgroundStroke=e.getBackgroundStroke(),n.padding=e.getPadding()||od,n.scale=c===void 0?[1,1]:c;let u=e.getOffsetX(),f=e.getOffsetY(),d=e.getRotateWithView(),A=e.getKeepUpright(),y=e.getRotation();this.text_=e.getText()||"",this.textOffsetX_=u===void 0?0:u,this.textOffsetY_=f===void 0?0:f,this.textRotateWithView_=d===void 0?!1:d,this.textKeepUpright_=A===void 0?!0:A,this.textRotation_=y===void 0?0:y,this.strokeKey_=s?(typeof s.strokeStyle=="string"?s.strokeStyle:Bn(s.strokeStyle))+s.lineCap+s.lineDashOffset+"|"+s.lineWidth+s.lineJoin+s.miterLimit+"["+s.lineDash.join()+"]":"",this.textKey_=n.font+n.scale+(n.textAlign||"?")+(n.repeat||"?")+(n.justify||"?")+(n.textBaseline||"?"),this.fillKey_=r&&r.fillStyle?typeof r.fillStyle=="string"?r.fillStyle:"|"+Bn(r.fillStyle):""}this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}},iY=P6;var eme={Circle:C6,Default:Eh,Image:Q$,LineString:J$,Polygon:C6,Text:iY},L6=class{constructor(e,t,n,r){this.tolerance_=e,this.maxExtent_=t,this.pixelRatio_=r,this.resolution_=n,this.buildersByZIndex_={}}finish(){let e={};for(let t in this.buildersByZIndex_){e[t]=e[t]||{};let n=this.buildersByZIndex_[t];for(let r in n){let s=n[r].finish();e[t][r]=s}}return e}getBuilder(e,t){let n=e!==void 0?e.toString():"0",r=this.buildersByZIndex_[n];r===void 0&&(r={},this.buildersByZIndex_[n]=r);let s=r[t];if(s===void 0){let o=eme[t];s=new o(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),r[t]=s}return s}},rY=L6;function y3(i,e,t,n,r,s,o,a){o=o??[],a=a??n;let l=i[e+n],c=i[e+n+1],u=i[t-2*n],f=i[t-2*n+1],d,A,y,w,S,T,R,P,I=0;for(let F=e;F<t;F+=n){y=d,w=A,S=void 0,T=void 0,F+n<t&&(S=i[F+n],T=i[F+n+1]),s&&F===e&&(y=u,w=f),s&&F===t-n&&(S=l,T=c),d=i[F],A=i[F+1],[R,P]=tme(d,A,y,w,S,T,r),o[I++]=R,o[I++]=P;for(let D=2;D<a;D++)o[I++]=i[F+D]}return o.length!=I&&(o.length=I),o}function tme(i,e,t,n,r,s,o){let a,l;t!==void 0&&n!==void 0?(a=i-t,l=e-n):r!==void 0&&s!==void 0?(a=r-i,l=s-e):(a=1,l=0);let c=Math.hypot(a,l),u=a/c,f=l/c;if(a=-f,l=u,t===void 0||n===void 0)return[i+a*o,e+l*o];if(r===void 0||s===void 0)return[i+a*o,e+l*o];let d=vW([i,e],[t,n],[r,s]);if(Math.cos(d)>.998)return[i+u*o,e+f*o];let A=Math.cos(d/2),y=Math.sin(d/2),w=y*a+A*l,S=-A*a+y*l,T=w*(1/y),R=S*(1/y);return[i+T*o,e+R*o]}function b3(i,e,t=!1){for(let n=0,r=i.length-2;n<r;n+=e){let s=t&&n===0?i.length-3*e:i.length-2*e;for(let o=s;o>n+e;o-=e){let a=i[n],l=i[n+1],c=i[n+e],u=i[n+e+1],f=i[o],d=i[o+1],A=i[o+e],y=i[o+e+1],w=(y-d)*(c-a)-(A-f)*(u-l);if(w===0)continue;let S=((A-f)*(l-d)-(y-d)*(a-f))/w,T=((c-a)*(l-d)-(u-l)*(a-f))/w;if(S>0&&S<1&&T>0&&T<1){let R=a+S*(c-a),P=l+S*(u-l);i[n+e]=R,i[n+e+1]=P,i.splice(n+2*e,o-n-e);break}}}return i}var D6;function nme(){return D6||(D6=new Intl.Segmenter(void 0,{granularity:"grapheme"})),D6}function sY(i,e,t,n,r,s,o,a,l,c,u,f,d=!0){let A=i[e],y=i[e+1],w=0,S=0,T=0,R=0;function P(){w=A,S=y,e+=n,A=i[e],y=i[e+1],R+=T,T=Math.sqrt((A-w)*(A-w)+(y-S)*(y-S))}do P();while(e<t-n&&R+T<s);let I=T===0?0:(s-R)/T,F=Po(w,A,I),D=Po(S,y,I),L=e-n,C=R,B=s+a*l(c,r,u);for(;e<t-n&&R+T<B;)P();I=T===0?0:(B-R)/T;let k=Po(w,A,I),z=Po(S,y,I),G=!1;if(d)if(f){let te=[F,D,k,z];_E(te,0,4,2,f,te,te),G=te[0]>te[2]}else G=F>k;let W=Math.PI,Y=[],H=L+n===e;e=L,T=0,R=C,A=i[e],y=i[e+1];let $;if(H){P(),$=Math.atan2(y-S,A-w),G&&($+=$>0?-W:W);let te=(k+F)/2,ce=(z+D)/2;return Y[0]=[te,ce,(B-s)/2,$,r],Y}r=r.replace(/\n/g," ");let J=Array.from(nme().segment(r),te=>te.segment);for(let te=0,ce=J.length;te<ce;){P();let he=Math.atan2(y-S,A-w);if(G&&(he+=he>0?-W:W),$!==void 0){let Ee=he-$;if(Ee+=Ee>W?-2*W:Ee<-W?2*W:0,Math.abs(Ee)>o)return null}$=he;let ve=te,Re=0;for(;te<ce;++te){let Ee=G?ce-te-1:te,Ve=a*l(c,J[Ee],u);if(e+n<t&&R+T<s+Re+Ve/2)break;Re+=Ve}if(te===ve)continue;let Qe=(G?J.slice(ce-te,ce-ve):J.slice(ve,te)).join("");I=T===0?0:(s+Re/2-R)/T;let Fe=Po(w,A,I),mt=Po(S,y,I);Y.push([Fe,mt,Re/2,he,Qe]),s+=Re}return Y}var Mv=Wr(),Hp=[],Ad=[],gd=[],Wp=[];function oY(i){return i[3].declutterBox}var aY=new RegExp("[\u0591-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFC\u0800-\u0FFF\uE800-\uEFFF]");function N6(i,e){return e==="start"?e=aY.test(i)?"right":"left":e==="end"&&(e=aY.test(i)?"left":"right"),A2[e]}function ime(i,e,t){return t>0&&i.push(`8-`,""),i.push(e,""),i}function rme(i,e,t){return t%2===0&&(i+=e),i}var F6=class{constructor(e,t,n,r,s){this.overlaps=n,this.pixelRatio=t,this.resolution=e,this.alignAndScaleFill_,this.instructions=r.instructions,this.coordinates=r.coordinates,this.coordinateCache_={},this.renderedTransform_=go(),this.hitDetectionInstructions=r.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=r.fillStates||{},this.strokeStates=r.strokeStates||{},this.textStates=r.textStates||{},this.widths_={},this.labels_={},this.zIndexContext_=s?new v3:null}getZIndexContext(){return this.zIndexContext_}createLabel(e,t,n,r){let s=e+t+n+r;if(this.labels_[s])return this.labels_[s];let o=r?this.strokeStates[r]:null,a=n?this.fillStates[n]:null,l=this.textStates[t],c=this.pixelRatio,u=[l.scale[0]*c,l.scale[1]*c],f=l.justify?A2[l.justify]:N6(Array.isArray(e)?e[0]:e,l.textAlign||Up),d=r&&o.lineWidth?o.lineWidth:0,A=Array.isArray(e)?e:String(e).split(`9-`).reduce(ime,[]),{width:y,height:w,widths:S,heights:T,lineWidths:R}=uX(l,A),P=y+d,I=[],F=(P+2)*u[0],D=(w+d)*u[1],L={width:F<0?Math.floor(F):Math.ceil(F),height:D<0?Math.floor(D):Math.ceil(D),contextInstructions:I};(u[0]!=1||u[1]!=1)&&I.push("scale",u),r&&(I.push("strokeStyle",o.strokeStyle),I.push("lineWidth",d),I.push("lineCap",o.lineCap),I.push("lineJoin",o.lineJoin),I.push("miterLimit",o.miterLimit),I.push("setLineDash",[o.lineDash]),I.push("lineDashOffset",o.lineDashOffset)),n&&I.push("fillStyle",a.fillStyle),I.push("textBaseline","middle"),I.push("textAlign","center");let C=.5-f,B=f*P+C*d,k=[],z=[],G=0,W=0,Y=0,H=0,$;for(let J=0,te=A.length;J<te;J+=2){let ce=A[J];if(ce===`10-`){W+=G,G=0,B=f*P+C*d,++H;continue}let he=A[J+1]||l.font;he!==$&&(r&&k.push("font",he),n&&z.push("font",he),$=he),G=Math.max(G,T[Y]);let ve=[ce,B+C*S[Y]+f*(S[Y]-R[H]),.5*(d+G)+W];B+=S[Y],r&&k.push("strokeText",ve),n&&z.push("fillText",ve),++Y}return Array.prototype.push.apply(I,k),Array.prototype.push.apply(I,z),this.labels_[s]=L,L}replayTextBackground_(e,t,n,r,s,o,a){e.beginPath(),e.moveTo.apply(e,t),e.lineTo.apply(e,n),e.lineTo.apply(e,r),e.lineTo.apply(e,s),e.lineTo.apply(e,t),o&&(this.alignAndScaleFill_=o[2],e.fillStyle=o[1],this.fill_(e)),a&&(this.setStrokeStyle_(e,a),e.stroke())}calculateImageOrLabelDimensions_(e,t,n,r,s,o,a,l,c,u,f,d,A,y,w,S){a*=d[0],l*=d[1];let T=n-a,R=r-l,P=s+c>e?e-c:s,I=o+u>t?t-u:o,F=y[3]+P*d[0]+y[1],D=y[0]+I*d[1]+y[2],L=T-y[3],C=R-y[0];(w||f!==0)&&(Hp[0]=L,Wp[0]=L,Hp[1]=C,Ad[1]=C,Ad[0]=L+F,gd[0]=Ad[0],gd[1]=C+D,Wp[1]=gd[1]);let B;return f!==0?(B=Do(go(),n,r,1,1,f,-n,-r),jr(B,Hp),jr(B,Ad),jr(B,gd),jr(B,Wp),ql(Math.min(Hp[0],Ad[0],gd[0],Wp[0]),Math.min(Hp[1],Ad[1],gd[1],Wp[1]),Math.max(Hp[0],Ad[0],gd[0],Wp[0]),Math.max(Hp[1],Ad[1],gd[1],Wp[1]),Mv)):ql(Math.min(L,L+F),Math.min(C,C+D),Math.max(L,L+F),Math.max(C,C+D),Mv),A&&(T=Math.round(T),R=Math.round(R)),{drawImageX:T,drawImageY:R,drawImageW:P,drawImageH:I,originX:c,originY:u,declutterBox:{minX:Mv[0],minY:Mv[1],maxX:Mv[2],maxY:Mv[3],value:S},canvasTransform:B,scale:d}}replayImageOrLabel_(e,t,n,r,s,o,a){let l=!!(o||a),c=r.declutterBox,u=a?a[2]*r.scale[0]/2:0;return c.minX-u<=t[0]&&c.maxX+u>=0&&c.minY-u<=t[1]&&c.maxY+u>=0&&(l&&this.replayTextBackground_(e,Hp,Ad,gd,Wp,o,a),hX(e,r.canvasTransform,s,n,r.originX,r.originY,r.drawImageW,r.drawImageH,r.drawImageX,r.drawImageY,r.scale)),!0}fill_(e){let t=this.alignAndScaleFill_;if(t){let n=jr(this.renderedTransform_,[0,0]),r=512*this.pixelRatio;e.save(),e.translate(n[0]%r,n[1]%r),t!==1&&e.scale(t,t)}e.fill(),t&&e.restore()}setStrokeStyle_(e,t){e.strokeStyle=t[1],t[1]&&(e.lineWidth=t[2],e.lineCap=t[3],e.lineJoin=t[4],e.miterLimit=t[5],e.lineDashOffset=t[7],e.setLineDash(t[6]))}drawLabelWithPointPlacement_(e,t,n,r){let s=this.textStates[t],o=this.createLabel(e,t,r,n),a=this.strokeStates[n],l=this.pixelRatio,c=N6(Array.isArray(e)?e[0]:e,s.textAlign||Up),u=A2[s.textBaseline||_A],f=a&&a.lineWidth?a.lineWidth:0,d=o.width/l-2*s.scale[0],A=c*d+2*(.5-c)*f,y=u*o.height/l+2*(.5-u)*f;return{label:o,anchorX:A,anchorY:y}}execute_(e,t,n,r,s,o,a,l){let c=this.zIndexContext_,u;this.pixelCoordinates_&&ea(n,this.renderedTransform_)?u=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),u=ml(this.coordinates,0,this.coordinates.length,2,n,this.pixelCoordinates_),pj(this.renderedTransform_,n));let f=0,d=r.length,A=0,y,w=[],S,T,R,P,I,F,D,L,C,B,k,z,G,W=0,Y=0,H=this.coordinateCache_,$=this.viewRotation_,J=Math.round(Math.atan2(-n[1],n[0])*1e12)/1e12,te={context:e,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:$},ce=this.instructions!=r||this.overlaps?0:200,he,ve,Re,Qe;for(;f<d;){let Fe=r[f];switch(Fe[0]){case vn.BEGIN_GEOMETRY:he=Fe[1],Qe=Fe[3],he.getGeometry()?a!==void 0&&!Ar(a,Qe.getExtent())?f=Fe[2]+1:++f:f=Fe[2],c&&(c.zIndex=Fe[4]);break;case vn.BEGIN_PATH:W>ce&&(this.fill_(e),W=0),Y>ce&&(e.stroke(),Y=0),!W&&!Y&&(e.beginPath(),I=NaN,F=NaN),++f;break;case vn.CIRCLE:A=Fe[1],R=Fe[2]??0;let Ee=u[A],Ve=u[A+1],Ye=u[A+2]-R,Mt=u[A+3]-R,Et=Ye-Ee,It=Mt-Ve,dn=Math.sqrt(Et*Et+It*It);e.moveTo(Ee+dn,Ve),e.arc(Ee,Ve,dn,0,2*Math.PI,!0),++f;break;case vn.CLOSE_PATH:e.closePath(),++f;break;case vn.CUSTOM:A=Fe[1],y=Fe[2];let Gt=Fe[3],$e=Fe[4],ot=Fe[5];te.geometry=Gt,te.feature=he,f in H||(H[f]=[]);let nt=H[f];ot?ot(u,A,y,2,nt):(nt[0]=u[A],nt[1]=u[A+1],nt.length=2),c&&(c.zIndex=Fe[6]),$e(nt,te),++f;break;case vn.DRAW_IMAGE:A=Fe[1],y=Fe[2],C=Fe[3],S=Fe[4],T=Fe[5];let bt=Fe[6],yt=Fe[7],hn=Fe[8],en=Fe[9],tn=Fe[10],bn=Fe[11],_e=Fe[12],vi=Fe[13];P=Fe[14]||"declutter";let zn=Fe[15];if(!C&&Fe.length>=20){B=Fe[19],k=Fe[20],z=Fe[21],G=Fe[22];let Fn=this.drawLabelWithPointPlacement_(B,k,z,G);C=Fn.label,Fe[3]=C;let is=Fe[23];S=(Fn.anchorX-is)*this.pixelRatio,Fe[4]=S;let Lr=Fe[24];T=(Fn.anchorY-Lr)*this.pixelRatio,Fe[5]=T,bt=C.height,Fe[6]=bt,vi=C.width,Fe[13]=vi}let le;Fe.length>25&&(le=Fe[25]);let Z,Te,Pe;Fe.length>17?(Z=Fe[16],Te=Fe[17],Pe=Fe[18]):(Z=od,Te=null,Pe=null),tn&&J?bn+=$:!tn&&!J&&(bn-=$);let Ge=0;for(;A<y;A+=2){if(le&&le[Ge++]<vi/this.pixelRatio)continue;let Fn=this.calculateImageOrLabelDimensions_(C.width,C.height,u[A],u[A+1],vi,bt,S,T,hn,en,bn,_e,s,Z,!!Te||!!Pe,he),is=[e,t,C,Fn,yt,Te,Pe];if(l){let Lr,Fl,wa;if(zn){let xr=y-A;if(!zn[xr]){zn[xr]={args:is,declutterMode:P};continue}let Ks=zn[xr];Lr=Ks.args,Fl=Ks.declutterMode,delete zn[xr],wa=oY(Lr)}let Bl,il;if(Lr&&(Fl!=="declutter"||!l.collides(wa))&&(Bl=!0),(P!=="declutter"||!l.collides(Fn.declutterBox))&&(il=!0),Fl==="declutter"&&P==="declutter"){let xr=Bl&&il;Bl=xr,il=xr}Bl&&(Fl!=="none"&&l.insert(wa),this.replayImageOrLabel_.apply(this,Lr)),il&&(P!=="none"&&l.insert(Fn.declutterBox),this.replayImageOrLabel_.apply(this,is))}else this.replayImageOrLabel_.apply(this,is)}++f;break;case vn.DRAW_CHARS:let vt=Fe[1],Tt=Fe[2],qe=Fe[3],Je=Fe[4];G=Fe[5];let Pt=Fe[6],rn=Fe[7],Lt=Fe[8];z=Fe[9];let Rt=Fe[10];B=Fe[11],Array.isArray(B)&&(B=B.reduce(rme,"")),k=Fe[12];let fn=[Fe[13],Fe[13]];P=Fe[14]||"declutter";let wn=Fe[15],Dn=Fe[16],ye=this.textStates[k],wt=ye.font,Ze=[ye.scale[0]*rn,ye.scale[1]*rn],St;wt in this.widths_?St=this.widths_[wt]:(St={},this.widths_[wt]=St);let Bt=dv(u,vt,Tt,2),ut=Math.abs(Ze[0])*VN(wt,B,St);if(Je||ut<=Bt){let Fn=this.textStates[k].textAlign,is=(Bt-ut)*N6(B,Fn),Lr=sY(u,vt,Tt,2,B,is,Pt,Math.abs(Ze[0]),VN,wt,St,J?0:this.viewRotation_,wn);e:if(Lr){let Fl=[],wa,Bl,il,xr,Ks;if(z)for(wa=0,Bl=Lr.length;wa<Bl;++wa){Ks=Lr[wa],il=Ks[4],xr=this.createLabel(il,k,"",z),S=Ks[2]+(Ze[0]<0?-Rt:Rt)-Dn,T=qe*xr.height+(.5-qe)*2*Rt*Ze[1]/Ze[0]-Lt;let Ol=this.calculateImageOrLabelDimensions_(xr.width,xr.height,Ks[0],Ks[1],xr.width,xr.height,S,T,0,0,Ks[3],fn,!1,od,!1,he);if(l&&P==="declutter"&&l.collides(Ol.declutterBox))break e;Fl.push([e,t,xr,Ol,1,null,null])}if(G)for(wa=0,Bl=Lr.length;wa<Bl;++wa){Ks=Lr[wa],il=Ks[4],xr=this.createLabel(il,k,G,""),S=Ks[2]-Dn,T=qe*xr.height-Lt;let Ol=this.calculateImageOrLabelDimensions_(xr.width,xr.height,Ks[0],Ks[1],xr.width,xr.height,S,T,0,0,Ks[3],fn,!1,od,!1,he);if(l&&P==="declutter"&&l.collides(Ol.declutterBox))break e;Fl.push([e,t,xr,Ol,1,null,null])}l&&P!=="none"&&l.load(Fl.map(oY));for(let Ol=0,nh=Fl.length;Ol<nh;++Ol)this.replayImageOrLabel_.apply(this,Fl[Ol])}}++f;break;case vn.END_GEOMETRY:if(o!==void 0){he=Fe[1];let Fn=o(he,Qe,P);if(Fn)return Fn}++f;break;case vn.FILL:ce?W++:this.fill_(e),++f;break;case vn.MOVE_TO_LINE_TO:A=Fe[1],y=Fe[2],R=Fe[3];let Ce,Yt,nr;if(R){let is=(Fe[4]??!1)||Math.abs(u[A]-u[y-2])<1e-6&&Math.abs(u[A+1]-u[y-1])<1e-6;y3(u,A,y,2,R,is,w),b3(w,2,is),Ce=w,Yt=0,nr=Ce.length}else Ce=u,Yt=A,nr=y;ve=Ce[Yt],Re=Ce[Yt+1],e.moveTo(ve,Re),I=ve+.5|0,F=Re+.5|0;for(let Fn=Yt+2;Fn<nr;Fn+=2)ve=Ce[Fn],Re=Ce[Fn+1],D=ve+.5|0,L=Re+.5|0,(Fn==nr-2||D!==I||L!==F)&&(e.lineTo(ve,Re),I=D,F=L);++f;break;case vn.SET_FILL_STYLE:this.alignAndScaleFill_=Fe[2],W?(this.fill_(e),W=0,Y&&(e.stroke(),Y=0)):Y&&Fe[1]&&(e.stroke(),Y=0),e.fillStyle=Fe[1],++f;break;case vn.SET_STROKE_STYLE:W&&Fe[1]&&(this.fill_(e),W=0),Y&&(e.stroke(),Y=0),this.setStrokeStyle_(e,Fe),++f;break;case vn.STROKE:ce?Y++:e.stroke(),++f;break;default:++f;break}}W&&this.fill_(e),Y&&e.stroke()}execute(e,t,n,r,s,o){this.viewRotation_=r,this.execute_(e,t,n,this.instructions,s,void 0,void 0,o)}executeHitDetection(e,t,n,r,s){return this.viewRotation_=n,this.execute_(e,[e.canvas.width,e.canvas.height],t,this.hitDetectionInstructions,!0,r,s)}},lY=F6;var jp=["Polygon","Circle","LineString","Image","Text","Default"],U6=["Image","Text"],cY=jp.filter(i=>!U6.includes(i)),uY=!1,hY=!1;function sme(){let i=0,e=n=>{let r=Di(1,1,null,{willReadFrequently:n}),s=0,o=performance.now();for(;performance.now()-o<50;++s)r.fillStyle=`rgba(255,0,${s%256},1)`,r.fillRect(0,0,1,1),r.getImageData(0,0,1,1);return i=s>i?s:i,s};uY={[e(!0)]:!0,[e(!1)]:!1,[e(void 0)]:void 0}[i],hY=!0}var O6=class{constructor(e,t,n,r,s,o,a){this.maxExtent_=e,this.overlaps_=r,this.pixelRatio_=n,this.resolution_=t,this.renderBuffer_=o,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=go(),this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(s,a)}clip(e,t){let n=this.getClipCoords(t);e.beginPath(),e.moveTo(n[0],n[1]),e.lineTo(n[2],n[3]),e.lineTo(n[4],n[5]),e.lineTo(n[6],n[7]),e.clip()}createExecutors_(e,t){for(let n in e){let r=this.executorsByZIndex_[n];r===void 0&&(r={},this.executorsByZIndex_[n]=r);let s=e[n];for(let o in s){let a=s[o];r[o]=new lY(this.resolution_,this.pixelRatio_,this.overlaps_,a,t)}}}hasExecutors(e){for(let t in this.executorsByZIndex_){let n=this.executorsByZIndex_[t];for(let r=0,s=e.length;r<s;++r)if(e[r]in n)return!0}return!1}forEachFeatureAtCoordinate(e,t,n,r,s,o){hY===!1&&sme(),r=Math.round(r);let a=r*2+1,l=Do(this.hitDetectionTransform_,r+.5,r+.5,1/t,-1/t,-n,-e[0],-e[1]),c=!this.hitDetectionContext_;c&&(this.hitDetectionContext_=Di(a,a,null,{willReadFrequently:uY}));let u=this.hitDetectionContext_;u.canvas.width!==a||u.canvas.height!==a?(u.canvas.width=a,u.canvas.height=a):c||u.clearRect(0,0,a,a);let f;this.renderBuffer_!==void 0&&(f=Wr(),Jm(f,e),G1(f,t*(this.renderBuffer_+r),f));let d=ome(r),A;function y(F,D,L){let C=u.getImageData(0,0,a,a).data;for(let B=0,k=d.length;B<k;B++)if(C[d[B]]>0){if(!o||L==="none"||A!=="Image"&&A!=="Text"||o.includes(F)){let z=(d[B]-3)/4,G=r-z%a,W=r-(z/a|0),Y=s(F,D,G*G+W*W);if(Y)return Y}u.clearRect(0,0,a,a);break}}let w=Object.keys(this.executorsByZIndex_).map(Number);w.sort(pl);let S,T,R,P,I;for(S=w.length-1;S>=0;--S){let F=w[S].toString();for(R=this.executorsByZIndex_[F],T=jp.length-1;T>=0;--T)if(A=jp[T],P=R[A],P!==void 0&&(I=P.executeHitDetection(u,l,n,y,f),I))return I}}getClipCoords(e){let t=this.maxExtent_;if(!t)return null;let n=t[0],r=t[1],s=t[2],o=t[3],a=[n,r,n,o,s,o,s,r];return ml(a,0,8,2,e,a),a}isEmpty(){return gu(this.executorsByZIndex_)}execute(e,t,n,r,s,o,a){let l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(a?GW:pl),o=o||jp;let c=jp.length;for(let u=0,f=l.length;u<f;++u){let d=l[u].toString(),A=this.executorsByZIndex_[d];for(let y=0,w=o.length;y<w;++y){let S=o[y],T=A[S];if(T!==void 0){let R=a===null?void 0:T.getZIndexContext(),P=R?R.getContext():e,I=this.maxExtent_&&S!=="Image"&&S!=="Text";if(I&&(P.save(),this.clip(P,n)),!R||S==="Text"||S==="Image"?T.execute(P,t,n,r,s,a):R.pushFunction(F=>T.execute(F,t,n,r,s,a)),I&&P.restore(),R){R.offset();let F=l[u]*c+jp.indexOf(S);this.deferredZIndexContexts_[F]||(this.deferredZIndexContexts_[F]=[]),this.deferredZIndexContexts_[F].push(R)}}}}this.renderedContext_=e}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){let e=this.deferredZIndexContexts_,t=Object.keys(e).map(Number).sort(pl);for(let n=0,r=t.length;n<r;++n)e[t[n]].forEach(s=>{s.draw(this.renderedContext_),s.clear()}),e[t[n]].length=0}},B6={};function ome(i){if(B6[i]!==void 0)return B6[i];let e=i*2+1,t=i*i,n=new Array(t+1);for(let s=0;s<=i;++s)for(let o=0;o<=i;++o){let a=s*s+o*o;if(a>t)break;let l=n[a];l||(l=[],n[a]=l),l.push(((i+s)*e+(i+o))*4+3),s>0&&l.push(((i-s)*e+(i+o))*4+3),o>0&&(l.push(((i+s)*e+(i-o))*4+3),s>0&&l.push(((i-s)*e+(i-o))*4+3))}let r=[];for(let s=0,o=n.length;s<o;++s)n[s]&&r.push(...n[s]);return B6[i]=r,r}var fY=O6;var k6=class extends x3{constructor(e,t,n,r,s,o,a){super(),this.context_=e,this.pixelRatio_=t,this.extent_=n,this.transform_=r,this.transformRotation_=r?eA(Math.atan2(r[1],r[0]),10):0,this.viewRotation_=s,this.squaredTolerance_=o,this.userTransform_=a,this.contextFillState_=null,this.contextStrokeState_=null,this.contextTextState_=null,this.fillState_=null,this.strokeState_=null,this.image_=null,this.imageAnchorX_=0,this.imageAnchorY_=0,this.imageHeight_=0,this.imageOpacity_=0,this.imageOriginX_=0,this.imageOriginY_=0,this.imageRotateWithView_=!1,this.imageRotation_=0,this.imageScale_=[0,0],this.imageWidth_=0,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=!1,this.textRotation_=0,this.textScale_=[0,0],this.textFillState_=null,this.textStrokeState_=null,this.textState_=null,this.pixelCoordinates_=[],this.tmpLocalTransform_=go()}drawImages_(e,t,n,r){if(!this.image_)return;let s=ml(e,t,n,r,this.transform_,this.pixelCoordinates_),o=this.context_,a=this.tmpLocalTransform_,l=o.globalAlpha;this.imageOpacity_!=1&&(o.globalAlpha=l*this.imageOpacity_);let c=this.imageRotation_;this.transformRotation_===0&&(c-=this.viewRotation_),this.imageRotateWithView_&&(c+=this.viewRotation_);for(let u=0,f=s.length;u<f;u+=2){let d=s[u]-this.imageAnchorX_,A=s[u+1]-this.imageAnchorY_;if(c!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){let y=d+this.imageAnchorX_,w=A+this.imageAnchorY_;Do(a,y,w,1,1,c,-y,-w),o.save(),o.transform.apply(o,a),o.translate(y,w),o.scale(this.imageScale_[0],this.imageScale_[1]),o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),o.restore()}else o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,d,A,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(o.globalAlpha=l)}drawText_(e,t,n,r){if(!this.textState_||this.text_==="")return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);let s=ml(e,t,n,r,this.transform_,this.pixelCoordinates_),o=this.context_,a=this.textRotation_;for(this.transformRotation_===0&&(a-=this.viewRotation_),this.textRotateWithView_&&(a+=this.viewRotation_);t<n;t+=r){let l=s[t]+this.textOffsetX_,c=s[t+1]+this.textOffsetY_;a!==0||this.textScale_[0]!=1||this.textScale_[1]!=1?(o.save(),o.translate(l-this.textOffsetX_,c-this.textOffsetY_),o.rotate(a),o.translate(this.textOffsetX_,this.textOffsetY_),o.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&o.strokeText(this.text_,0,0),this.textFillState_&&o.fillText(this.text_,0,0),o.restore()):(this.textStrokeState_&&o.strokeText(this.text_,l,c),this.textFillState_&&o.fillText(this.text_,l,c))}}moveToLineTo_(e,t,n,r,s,o){let a=this.context_,l=ml(e,t,n,r,this.transform_,this.pixelCoordinates_);if(Math.abs(o)>0){let u=l.length,f=s||Math.abs(l[0]-l[u-2])<1e-6&&Math.abs(l[1]-l[u-1])<1e-6;l=y3(l,0,u,2,o,f,l),b3(l,2,f)}a.moveTo(l[0],l[1]);let c=l.length;s&&(c-=2);for(let u=2;u<c;u+=2)a.lineTo(l[u],l[u+1]);return s&&a.closePath(),n}drawRings_(e,t,n,r,s){for(let o=0,a=n.length;o<a;++o)t=this.moveToLineTo_(e,t,n[o],r,!0,s);return t}drawCircle(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ar(this.extent_,e.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let t=Nj(e,this.transform_,this.pixelCoordinates_),n=t[2]-t[0],r=t[3]-t[1],s=Math.sqrt(n*n+r*r),o=this.context_;o.beginPath(),o.arc(t[0],t[1],s,0,2*Math.PI),this.fillState_&&o.fill(),this.strokeState_&&o.stroke()}this.text_!==""&&this.drawText_(e.getCenter(),0,2,2)}}setStyle(e){this.setFillStrokeStyle(e.getFill(),e.getStroke()),this.setImageStyle(e.getImage()),this.setTextStyle(e.getText())}setTransform(e){this.transform_=e}drawGeometry(e){switch(e.getType()){case"Point":this.drawPoint(e);break;case"LineString":this.drawLineString(e);break;case"Polygon":this.drawPolygon(e);break;case"MultiPoint":this.drawMultiPoint(e);break;case"MultiLineString":this.drawMultiLineString(e);break;case"MultiPolygon":this.drawMultiPolygon(e);break;case"GeometryCollection":this.drawGeometryCollection(e);break;case"Circle":this.drawCircle(e);break;default:}}drawFeature(e,t){let n=t.getGeometryFunction()(e);n&&(this.setStyle(t),this.drawGeometry(n))}drawGeometryCollection(e){let t=e.getGeometriesArray();for(let n=0,r=t.length;n<r;++n)this.drawGeometry(t[n])}drawPoint(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let t=e.getFlatCoordinates(),n=e.getStride();this.image_&&this.drawImages_(t,0,t.length,n),this.text_!==""&&this.drawText_(t,0,t.length,n)}drawMultiPoint(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let t=e.getFlatCoordinates(),n=e.getStride();this.image_&&this.drawImages_(t,0,t.length,n),this.text_!==""&&this.drawText_(t,0,t.length,n)}drawLineString(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ar(this.extent_,e.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);let t=this.context_,n=e.getFlatCoordinates();t.beginPath(),this.moveToLineTo_(n,0,n.length,e.getStride(),!1,this.strokeState_.strokeOffset),t.stroke()}if(this.text_!==""){let t=e.getFlatMidpoint();this.drawText_(t,0,2,2)}}}drawMultiLineString(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let t=e.getExtent();if(Ar(this.extent_,t)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);let n=this.context_,r=e.getFlatCoordinates(),s=0,o=e.getEnds(),a=e.getStride();n.beginPath();for(let l=0,c=o.length;l<c;++l)s=this.moveToLineTo_(r,s,o[l],a,!1,this.strokeState_.strokeOffset);n.stroke()}if(this.text_!==""){let n=e.getFlatMidpoints();this.drawText_(n,0,n.length,2)}}}drawPolygon(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ar(this.extent_,e.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let t=this.context_;t.beginPath(),this.drawRings_(e.getOrientedFlatCoordinates(),0,e.getEnds(),e.getStride(),this.strokeState_?.strokeOffset),this.fillState_&&t.fill(),this.strokeState_&&t.stroke()}if(this.text_!==""){let t=e.getFlatInteriorPoint();this.drawText_(t,0,2,2)}}}drawMultiPolygon(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ar(this.extent_,e.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let t=this.context_,n=e.getOrientedFlatCoordinates(),r=0,s=e.getEndss(),o=e.getStride();t.beginPath();for(let a=0,l=s.length;a<l;++a){let c=s[a];r=this.drawRings_(n,r,c,o,this.strokeState_?.strokeOffset)}this.fillState_&&t.fill(),this.strokeState_&&t.stroke()}if(this.text_!==""){let t=e.getFlatInteriorPoints();this.drawText_(t,0,t.length,2)}}}setContextFillState_(e){let t=this.context_,n=this.contextFillState_;n?n.fillStyle!=e.fillStyle&&(n.fillStyle=e.fillStyle,t.fillStyle=e.fillStyle):(t.fillStyle=e.fillStyle,this.contextFillState_={fillStyle:e.fillStyle})}setContextStrokeState_(e){let t=this.context_,n=this.contextStrokeState_;n?(n.lineCap!=e.lineCap&&(n.lineCap=e.lineCap,t.lineCap=e.lineCap),ea(n.lineDash,e.lineDash)||t.setLineDash(n.lineDash=e.lineDash),n.lineDashOffset!=e.lineDashOffset&&(n.lineDashOffset=e.lineDashOffset,t.lineDashOffset=e.lineDashOffset),n.lineJoin!=e.lineJoin&&(n.lineJoin=e.lineJoin,t.lineJoin=e.lineJoin),n.lineWidth!=e.lineWidth&&(n.lineWidth=e.lineWidth,t.lineWidth=e.lineWidth),n.miterLimit!=e.miterLimit&&(n.miterLimit=e.miterLimit,t.miterLimit=e.miterLimit),n.strokeStyle!=e.strokeStyle&&(n.strokeStyle=e.strokeStyle,t.strokeStyle=e.strokeStyle)):(t.lineCap=e.lineCap,t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset,t.lineJoin=e.lineJoin,t.lineWidth=e.lineWidth,t.miterLimit=e.miterLimit,t.strokeStyle=e.strokeStyle,this.contextStrokeState_={lineCap:e.lineCap,lineDash:e.lineDash,lineDashOffset:e.lineDashOffset,lineJoin:e.lineJoin,lineWidth:e.lineWidth,miterLimit:e.miterLimit,strokeStyle:e.strokeStyle})}setContextTextState_(e){let t=this.context_,n=this.contextTextState_,r=e.textAlign?e.textAlign:Up;n?(n.font!=e.font&&(n.font=e.font,t.font=e.font),n.textAlign!=r&&(n.textAlign=r,t.textAlign=r),n.textBaseline!=e.textBaseline&&(n.textBaseline=e.textBaseline,t.textBaseline=e.textBaseline)):(t.font=e.font,t.textAlign=r,t.textBaseline=e.textBaseline,this.contextTextState_={font:e.font,textAlign:r,textBaseline:e.textBaseline})}setFillStrokeStyle(e,t){if(!e)this.fillState_=null;else{let n=e.getColor();this.fillState_={fillStyle:gl(n||ro)}}if(!t)this.strokeState_=null;else{let n=t.getColor(),r=t.getLineCap(),s=t.getLineDash(),o=t.getLineDashOffset(),a=t.getLineJoin(),l=t.getWidth(),c=t.getMiterLimit(),u=s||vl,f=t.getOffset();this.strokeState_={lineCap:r!==void 0?r:_h,lineDash:this.pixelRatio_===1?u:u.map(d=>d*this.pixelRatio_),lineDashOffset:(o||_l)*this.pixelRatio_,lineJoin:a!==void 0?a:xh,lineWidth:(l!==void 0?l:ad)*this.pixelRatio_,miterLimit:c!==void 0?c:sd,strokeStyle:gl(n||na),strokeOffset:(f??0)*this.pixelRatio_}}}setImageStyle(e){let t;if(!e||!(t=e.getSize())){this.image_=null;return}let n=e.getPixelRatio(this.pixelRatio_),r=e.getAnchor(),s=e.getOrigin();this.image_=e.getImage(this.pixelRatio_),this.imageAnchorX_=r[0]*n,this.imageAnchorY_=r[1]*n,this.imageHeight_=t[1]*n,this.imageOpacity_=e.getOpacity(),this.imageOriginX_=s[0],this.imageOriginY_=s[1],this.imageRotateWithView_=e.getRotateWithView(),this.imageRotation_=e.getRotation();let o=e.getScaleArray();this.imageScale_=[o[0]*this.pixelRatio_/n,o[1]*this.pixelRatio_/n],this.imageWidth_=t[0]*n}setTextStyle(e){if(!e)this.text_="";else{let t=e.getFill();if(!t)this.textFillState_=null;else{let A=t.getColor();this.textFillState_={fillStyle:gl(A||ro)}}let n=e.getStroke();if(!n)this.textStrokeState_=null;else{let A=n.getColor(),y=n.getLineCap(),w=n.getLineDash(),S=n.getLineDashOffset(),T=n.getLineJoin(),R=n.getWidth(),P=n.getMiterLimit();this.textStrokeState_={lineCap:y!==void 0?y:_h,lineDash:w||vl,lineDashOffset:S||_l,lineJoin:T!==void 0?T:xh,lineWidth:R!==void 0?R:ad,miterLimit:P!==void 0?P:sd,strokeStyle:gl(A||na)}}let r=e.getFont(),s=e.getOffsetX(),o=e.getOffsetY(),a=e.getRotateWithView(),l=e.getRotation(),c=e.getScaleArray(),u=e.getText(),f=e.getTextAlign(),d=e.getTextBaseline();this.textState_={font:r!==void 0?r:BE,textAlign:f!==void 0?f:Up,textBaseline:d!==void 0?d:_A},this.text_=u!==void 0?Array.isArray(u)?u.reduce((A,y,w)=>A+=w%2?" ":y,""):u:"",this.textOffsetX_=s!==void 0?this.pixelRatio_*s:0,this.textOffsetY_=o!==void 0?this.pixelRatio_*o:0,this.textRotateWithView_=a!==void 0?a:!1,this.textRotation_=l!==void 0?l:0,this.textScale_=[this.pixelRatio_*c[0],this.pixelRatio_*c[1]]}}},dY=k6;var Mu=.5;function pY(i,e,t,n,r,s,o,a,l){let c=l?Mp(r,l):r,u=i[0]*Mu,f=i[1]*Mu,d=Di(u,f);d.imageSmoothingEnabled=!1;let A=d.canvas,y=new dY(d,Mu,r,null,o,a,l?iA(sA(),l):null),w=t.length,S=Math.floor((256*256*256-1)/w),T={};for(let P=1;P<=w;++P){let I=t[P-1],F=I.getStyleFunction()||n;if(!F)continue;let D=F(I,s);if(!D)continue;Array.isArray(D)||(D=[D]);let C=(P*S).toString(16).padStart(7,"#00000");for(let B=0,k=D.length;B<k;++B){let z=D[B],G=z.getGeometryFunction()(I);if(!G||!Ar(c,G.getExtent()))continue;let W=z.clone(),Y=W.getFill();Y&&Y.setColor(C);let H=W.getStroke();H&&(H.setColor(C),H.setLineDash(null)),W.setText(void 0);let $=z.getImage();if($){let he=$.getImageSize();if(!he)continue;let ve=Di(he[0],he[1],void 0,{alpha:!1}),Re=ve.canvas;ve.fillStyle=C,ve.fillRect(0,0,Re.width,Re.height),W.setImage(new xA({img:Re,anchor:$.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:$.getOrigin(),opacity:1,size:$.getSize(),scale:$.getScale(),rotation:$.getRotation(),rotateWithView:$.getRotateWithView()}))}let J=W.getZIndex()||0,te=T[J];te||(te={},T[J]=te,te.Polygon=[],te.Circle=[],te.LineString=[],te.Point=[]);let ce=G.getType();if(ce==="GeometryCollection"){let he=G.getGeometriesArrayRecursive();for(let ve=0,Re=he.length;ve<Re;++ve){let Qe=he[ve];te[Qe.getType().replace("Multi","")].push(Qe,W)}}else te[ce.replace("Multi","")].push(G,W)}}let R=Object.keys(T).map(Number).sort(pl);for(let P=0,I=R.length;P<I;++P){let F=T[R[P]];for(let D in F){let L=F[D];for(let C=0,B=L.length;C<B;C+=2){y.setStyle(L[C+1]);for(let k=0,z=e.length;k<z;++k)y.setTransform(e[k]),y.drawGeometry(L[C])}}}return d.getImageData(0,0,A.width,A.height)}function mY(i,e,t){let n=[];if(t){let r=Math.floor(Math.round(i[0])*Mu),s=Math.floor(Math.round(i[1])*Mu),o=(Si(r,0,t.width-1)+Si(s,0,t.height-1)*t.width)*4,a=t.data[o],l=t.data[o+1],u=t.data[o+2]+256*(l+256*a),f=Math.floor((256*256*256-1)/e.length);u&&u%f===0&&n.push(e[u/f-1])}return n}var ame=.5,AY={Point:pme,LineString:hme,Polygon:Ame,MultiPoint:mme,MultiLineString:fme,MultiPolygon:dme,GeometryCollection:ume,Circle:lme};function gY(i,e){return parseInt(Bn(i),10)-parseInt(Bn(e),10)}function z6(i,e){let t=V6(i,e);return t*t}function V6(i,e){return ame*i/e}function lme(i,e,t,n,r){let s=t.getFill(),o=t.getStroke();if(s||o){let l=i.getBuilder(t.getZIndex(),"Circle");l.setFillStrokeStyle(s,o),l.drawCircle(e,n,r)}let a=t.getText();if(a&&a.getText()){let l=i.getBuilder(t.getZIndex(),"Text");l.setTextStyle(a),l.drawText(e,n,r)}}function G6(i,e,t,n,r,s,o,a){let l=[],c=t.getImage();if(c){let d=!0,A=c.getImageState();A==In.LOADED||A==In.ERROR?d=!1:A==In.IDLE&&c.load(),d&&l.push(c.ready())}let u=t.getFill();u&&u.loading()&&l.push(u.ready());let f=l.length>0;return f&&Promise.all(l).then(()=>r(null)),cme(i,e,t,n,s,o,a),f}function cme(i,e,t,n,r,s,o){let a=t.getGeometryFunction()(e);if(!a)return;let l=a.simplifyTransformed(n,r);if(t.getRenderer())vY(i,l,t,e,o);else{let u=AY[l.getType()];u(i,l,t,e,o,s)}}function vY(i,e,t,n,r){if(e.getType()=="GeometryCollection"){let o=e.getGeometries();for(let a=0,l=o.length;a<l;++a)vY(i,o[a],t,n,r);return}i.getBuilder(t.getZIndex(),"Default").drawCustom(e,n,t.getRenderer(),t.getHitDetectionRenderer(),r)}function ume(i,e,t,n,r,s){let o=e.getGeometriesArray(),a,l;for(a=0,l=o.length;a<l;++a){let c=AY[o[a].getType()];c(i,o[a],t,n,r,s)}}function hme(i,e,t,n,r){let s=t.getStroke();if(s){let a=i.getBuilder(t.getZIndex(),"LineString");a.setFillStrokeStyle(null,s),a.drawLineString(e,n,r)}let o=t.getText();if(o&&o.getText()){let a=i.getBuilder(t.getZIndex(),"Text");a.setTextStyle(o),a.drawText(e,n,r)}}function fme(i,e,t,n,r){let s=t.getStroke();if(s){let a=i.getBuilder(t.getZIndex(),"LineString");a.setFillStrokeStyle(null,s),a.drawMultiLineString(e,n,r)}let o=t.getText();if(o&&o.getText()){let a=i.getBuilder(t.getZIndex(),"Text");a.setTextStyle(o),a.drawText(e,n,r)}}function dme(i,e,t,n,r){let s=t.getFill(),o=t.getStroke();if(o||s){let l=i.getBuilder(t.getZIndex(),"Polygon");l.setFillStrokeStyle(s,o),l.drawMultiPolygon(e,n,r)}let a=t.getText();if(a&&a.getText()){let l=i.getBuilder(t.getZIndex(),"Text");l.setTextStyle(a),l.drawText(e,n,r)}}function pme(i,e,t,n,r,s){let o=t.getImage(),a=t.getText(),l=a&&a.getText(),c=s&&o&&l?{}:void 0;if(o){if(o.getImageState()!=In.LOADED)return;let u=i.getBuilder(t.getZIndex(),"Image");u.setImageStyle(o,c),u.drawPoint(e,n,r)}if(l){let u=i.getBuilder(t.getZIndex(),"Text");u.setTextStyle(a,c),u.drawText(e,n,r)}}function mme(i,e,t,n,r,s){let o=t.getImage(),a=o&&o.getOpacity()!==0,l=t.getText(),c=l&&l.getText(),u=s&&a&&c?{}:void 0;if(a){if(o.getImageState()!=In.LOADED)return;let f=i.getBuilder(t.getZIndex(),"Image");f.setImageStyle(o,u),f.drawMultiPoint(e,n,r)}if(c){let f=i.getBuilder(t.getZIndex(),"Text");f.setTextStyle(l,u),f.drawText(e,n,r)}}function Ame(i,e,t,n,r){let s=t.getFill(),o=t.getStroke();if(s||o){let l=i.getBuilder(t.getZIndex(),"Polygon");l.setFillStrokeStyle(s,o),l.drawPolygon(e,n,r)}let a=t.getText();if(a&&a.getText()){let l=i.getBuilder(t.getZIndex(),"Text");l.setTextStyle(a),l.drawText(e,n,r)}}var q6=class extends _3{constructor(e){super(e),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.clipExtent_=null,this.extendX_=!1,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=Wr(),this.wrappedRenderedExtent_=Wr(),this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedPixelRatio_=1,this.renderedRenderOrder_=null,this.renderedFrameDeclutter_,this.replayGroup_=null,this.replayGroupChanged=!0,this.clipping=!0,this.targetContext_=null,this.opacity_=1}renderWorlds(e,t,n){let r=t.extent,s=t.viewState,o=s.center,a=s.resolution,l=s.projection,c=s.rotation,u=l.getExtent(),f=this.getLayer().getSource(),d=this.getLayer().getDeclutter(),A=t.pixelRatio,y=t.viewHints,w=!(y[so.ANIMATING]||y[so.INTERACTING]),S=this.context,T=Math.round(Kn(r)/a*A),R=Math.round(Dr(r)/a*A),P=f.getWrapX()&&l.canWrapX(),I=P?Kn(u):null,F=P?Math.ceil((r[2]-u[2])/I)+(this.extendX_?2:1):1,D=P?Math.floor((r[0]-u[0])/I)-(this.extendX_?1:0):0;do{let L=this.getRenderTransform(o,a,0,A,T,R,D*I);t.declutter&&(L=L.slice(0)),e.execute(S,[S.canvas.width,S.canvas.height],L,c,w,n===void 0?jp:n?U6:cY,n?d&&t.declutter[d]:void 0)}while(++D<F)}setDrawContext_(){this.opacity_!==1&&(this.targetContext_=this.context,this.context=Di(this.context.canvas.width,this.context.canvas.height,A6))}resetDrawContext_(){if(this.opacity_!==1&&this.targetContext_){let e=this.targetContext_.globalAlpha;this.targetContext_.globalAlpha=this.opacity_,this.targetContext_.drawImage(this.context.canvas,0,0),this.targetContext_.globalAlpha=e,cA(this.context),A6.push(this.context.canvas),this.context=this.targetContext_,this.targetContext_=null}}renderDeclutter(e){!this.replayGroup_||!this.getLayer().getDeclutter()||this.renderWorlds(this.replayGroup_,e,!0)}renderDeferredInternal(e){this.replayGroup_&&(this.clipExtent_&&this.clipUnrotated(this.context,e,this.clipExtent_),this.replayGroup_.renderDeferred(),this.clipExtent_&&(this.context.restore(),this.clipExtent_=null),this.resetDrawContext_())}renderFrame(e,t){let n=e.layerStatesArray[e.layerIndex];this.opacity_=n.opacity;let r=e.viewState;this.prepareContainer(e,t);let s=this.context,o=this.replayGroup_,a=o&&!o.isEmpty();if(!a&&!(this.getLayer().hasListener(Bo.PRERENDER)||this.getLayer().hasListener(Bo.POSTRENDER)))return this.container;this.setDrawContext_(),this.preRender(s,e);let l=r.projection;this.clipExtent_=null;let c=!1;if(a&&n.extent&&this.clipping){let u=xu(n.extent,l);a=Ar(u,e.extent),a&&!hh(u,e.extent)&&(e.declutter?this.clipExtent_=u:(this.clipUnrotated(s,e,u),c=!0))}return a&&this.renderWorlds(o,e,this.getLayer().getDeclutter()?!1:void 0),c&&s.restore(),this.postRender(s,e),this.renderedRotation_!==r.rotation&&(this.renderedRotation_=r.rotation,this.hitDetectionImageData_=null),e.declutter||this.resetDrawContext_(),this.container}getFeatures(e){return new Promise(t=>{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){let n=this.frameState.size.slice(),r=this.renderedCenter_,s=this.renderedResolution_,o=this.renderedRotation_,a=this.renderedProjection_,l=this.wrappedRenderedExtent_,c=this.getLayer(),u=[],f=n[0]*Mu,d=n[1]*Mu;u.push(this.getRenderTransform(r,s,o,Mu,f,d,0).slice());let A=c.getSource(),y=a.getExtent();if(A.getWrapX()&&a.canWrapX()&&!hh(y,l)){let S=l[0],T=Kn(y),R=0,P;for(;S<y[0];)--R,P=T*R,u.push(this.getRenderTransform(r,s,o,Mu,f,d,P).slice()),S+=T;for(R=0,S=l[2];S>y[2];)++R,P=T*R,u.push(this.getRenderTransform(r,s,o,Mu,f,d,P).slice()),S-=T}let w=sA();this.hitDetectionImageData_=pY(n,u,this.renderedFeatures_,c.getStyleFunction(),l,s,o,z6(s,this.renderedPixelRatio_),w?a:null)}t(mY(e,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(e,t,n,r,s){if(!this.replayGroup_)return;let o=t.viewState.resolution,a=t.viewState.rotation,l=this.getLayer(),c={},u=function(d,A,y){let w=Bn(d),S=c[w];if(S){if(S!==!0&&y<S.distanceSq){if(y===0)return c[w]=!0,s.splice(s.lastIndexOf(S),1),r(d,l,A);S.geometry=A,S.distanceSq=y}}else{if(y===0)return c[w]=!0,r(d,l,A);s.push(c[w]={feature:d,layer:l,geometry:A,distanceSq:y,callback:r})}},f=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(e,o,a,n,u,f?t.declutter?.[f]?.all().map(d=>d.value):null)}handleFontsChanged(){let e=this.getLayer();e.getVisible()&&this.replayGroup_&&e.changed()}handleStyleImageChange_(e){this.renderIfReadyAndVisible()}prepareFrame(e){let t=this.getLayer(),n=t.getSource();if(!n)return!1;let r=e.viewHints[so.ANIMATING],s=e.viewHints[so.INTERACTING],o=t.getUpdateWhileAnimating(),a=t.getUpdateWhileInteracting();if(this.ready&&!o&&r||!a&&s)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;let l=e.extent,c=e.viewState,u=c.projection,f=c.resolution,d=e.pixelRatio,A=t.getRevision(),y=t.getRenderBuffer(),w=t.getRenderOrder();w===void 0&&(w=gY);let S=c.center.slice(),T=G1(l,y*f),R=T.slice(),P=[T.slice()],I=u.getExtent(),F=n.getWrapX()&&u.canWrapX();if(this.extendX_=!1,F){let $=n.getExtent();$&&!dh($)&&(this.extendX_=$[0]<I[0]||$[2]>I[2])}if(F&&(!hh(I,e.extent)||this.extendX_)){let $=Kn(I),J=Math.max(Kn(T)/2,$),te=I[0],ce=I[2];this.extendX_&&(te-=$,ce+=$),T[0]=te-J,T[2]=ce+J,$T(S,u);let he=TD(P[0],u);he[0]<I[0]&&he[2]<I[2]?P.push([he[0]+$,he[1],he[2]+$,he[3]]):he[0]>I[0]&&he[2]>I[2]&&P.push([he[0]-$,he[1],he[2]-$,he[3]])}if(this.ready&&this.renderedResolution_==f&&this.renderedPixelRatio_===d&&this.renderedRevision_==A&&this.renderedRenderOrder_==w&&this.renderedFrameDeclutter_===!!e.declutter&&hh(this.wrappedRenderedExtent_,T))return ea(this.renderedExtent_,R)||(this.hitDetectionImageData_=null,this.renderedExtent_=R),this.renderedCenter_=S,this.replayGroupChanged=!1,!0;this.replayGroup_=null;let D=new rY(V6(f,d),T,f,d),L=sA(),C;if(L){for(let $=0,J=P.length;$<J;++$){let te=P[$],ce=Mp(te,u);n.loadFeatures(ce,kW(f,u),L)}C=iA(L,u)}else for(let $=0,J=P.length;$<J;++$)n.loadFeatures(P[$],f,u);let B=z6(f,d),k=!0,z=($,J)=>{let te,ce=$.getStyleFunction()||t.getStyleFunction();if(ce&&(te=ce($,f)),te){let he=this.renderFeature($,B,te,D,C,this.getLayer().getDeclutter(),J);k=k&&!he}},G=Mp(T,u),W=n.getFeaturesInExtent(G);w&&W.sort(w);for(let $=0,J=W.length;$<J;++$)z(W[$],$);this.renderedFeatures_=W,this.ready=k;let Y=D.finish(),H=new fY(T,f,d,n.getOverlaps(),Y,t.getRenderBuffer(),!!e.declutter);return this.renderedResolution_=f,this.renderedRevision_=A,this.renderedRenderOrder_=w,this.renderedFrameDeclutter_=!!e.declutter,this.renderedExtent_=R,this.wrappedRenderedExtent_=T,this.renderedCenter_=S,this.renderedProjection_=u,this.renderedPixelRatio_=d,this.replayGroup_=H,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(e,t,n,r,s,o,a){if(!n)return!1;let l=!1;if(Array.isArray(n))for(let c=0,u=n.length;c<u;++c)l=G6(r,e,n[c],t,this.boundHandleStyleImageChange_,s,o,a)||l;else l=G6(r,e,n,t,this.boundHandleStyleImageChange_,s,o,a);return l}},_Y=q6;var H6=class extends m3{constructor(e){super(e)}createRenderer(){return new _Y(this)}},xY=H6;var gme=!1;function vme(i,e,t,n,r,s,o){let a=new XMLHttpRequest;a.open("GET",typeof i=="function"?i(t,n,r):i,!0),e.getType()=="arraybuffer"&&(a.responseType="arraybuffer"),a.withCredentials=gme,a.onload=function(l){if(!a.status||a.status>=200&&a.status<300){let c=e.getType();try{let u;c=="text"||c=="json"?u=a.responseText:c=="xml"?u=a.responseXML||a.responseText:c=="arraybuffer"&&(u=a.response),u?s(e.readFeatures(u,{extent:t,featureProjection:r}),e.readProjection(u)):o()}catch{o()}}else o()},a.onerror=o,a.send()}function W6(i,e){return function(t,n,r,s,o){vme(i,e,t,n,r,(a,l)=>{this.addFeatures(a),s!==void 0&&s(a)},()=>{this.changed(),o!==void 0&&o()})}}function yY(i,e){return[[-1/0,-1/0,1/0,1/0]]}var bY=go(),g2=class i{constructor(e,t,n,r,s,o){this.styleFunction,this.extent_,this.id_=o,this.type_=e,this.flatCoordinates_=t,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=n||null,this.properties_=s,this.squaredTolerance_,this.stride_=r,this.simplifiedGeometry_}get(e){return this.properties_[e]}getExtent(){return this.extent_||(this.extent_=this.type_==="Point"?VT(this.flatCoordinates_):q1(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){let e=dl(this.getExtent());this.flatInteriorPoints_=zy(this.flatCoordinates_,0,this.ends_,this.stride_,e,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){let e=$j(this.flatCoordinates_,this.ends_),t=EE(this.flatCoordinates_,0,e,this.stride_);this.flatInteriorPoints_=wE(this.flatCoordinates_,0,e,this.stride_,t)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=yA(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,.5)),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];let e=this.flatCoordinates_,t=0,n=this.ends_;for(let r=0,s=n.length;r<s;++r){let o=n[r],a=yA(e,t,o,this.stride_,.5);Lo(this.flatMidpoints_,a),t=o}}return this.flatMidpoints_}getId(){return this.id_}getOrientedFlatCoordinates(){return this.flatCoordinates_}getGeometry(){return this}getSimplifiedGeometry(e){return this}simplifyTransformed(e,t){return this}getProperties(){return this.properties_}getPropertiesInternal(){return this.properties_}getStride(){return this.stride_}getStyleFunction(){return this.styleFunction}getType(){return this.type_}transform(e){e=ks(e);let t=e.getExtent(),n=e.getWorldExtent();if(t&&n){let r=Dr(n)/Dr(t);Do(bY,n[0],n[3],r,-r,0,0,0),ml(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,bY,this.flatCoordinates_)}}applyTransform(e){e(this.flatCoordinates_,this.flatCoordinates_,this.stride_)}clone(){return new i(this.type_,this.flatCoordinates_.slice(),this.ends_?.slice(),this.stride_,Object.assign({},this.properties_),this.id_)}getEnds(){return this.ends_}enableSimplifyTransformed(){return this.simplifyTransformed=aE((e,t)=>{if(e===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),t&&this.simplifiedGeometry_.applyTransform(t);let n=this.simplifiedGeometry_.getFlatCoordinates(),r;switch(this.type_){case"LineString":n.length=AA(n,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,e,n,0),r=[n.length];break;case"MultiLineString":r=[],n.length=bE(n,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,e,n,0,r);break;case"Polygon":r=[],n.length=ky(n,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(e),n,0,r);break;default:}return r&&(this.simplifiedGeometry_=new i(this.type_,n,r,this.stride_,this.properties_,this.id_)),this.squaredTolerance_=e,this.simplifiedGeometry_}),this}};g2.prototype.getFlatCoordinates=g2.prototype.getOrientedFlatCoordinates;var RA=g2;var j6=class{constructor(e){this.rbush_=new EA(e),this.items_={}}insert(e,t){let n={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3],value:t};this.rbush_.insert(n),this.items_[Bn(t)]=n}load(e,t){let n=new Array(t.length);for(let r=0,s=t.length;r<s;r++){let o=e[r],a=t[r],l={minX:o[0],minY:o[1],maxX:o[2],maxY:o[3],value:a};n[r]=l,this.items_[Bn(a)]=l}this.rbush_.load(n)}remove(e){let t=Bn(e),n=this.items_[t];return delete this.items_[t],this.rbush_.remove(n)!==null}update(e,t){let n=this.items_[Bn(t)],r=[n.minX,n.minY,n.maxX,n.maxY];Qm(r,e)||(this.remove(t),this.insert(e,t))}getAll(){return this.rbush_.all().map(function(t){return t.value})}getInExtent(e){let t={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]};return this.rbush_.search(t).map(function(r){return r.value})}forEach(e){return this.forEach_(this.getAll(),e)}forEachInExtent(e,t){return this.forEach_(this.getInExtent(e),t)}forEach_(e,t){let n;for(let r=0,s=e.length;r<s;r++)if(n=t(e[r]),n)return n;return n}isEmpty(){return gu(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(e){let t=this.rbush_.toJSON();return ql(t.minX,t.minY,t.maxX,t.maxY,e)}concat(e){this.rbush_.load(e.rbush_.all());for(let t in e.items_)this.items_[t]=e.items_[t]}},X6=j6;var Xl={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};var Mh=class extends Ao{constructor(e,t,n){super(e),this.feature=t,this.features=n}},$6=class extends AE{constructor(e){e=e||{},super({attributions:e.attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:e.wrapX!==void 0?e.wrapX:!0}),this.on,this.once,this.un,this.loader_=td,this.format_=e.format||null,this.overlaps_=e.overlaps===void 0?!0:e.overlaps,this.url_=e.url,e.loader!==void 0?this.loader_=e.loader:this.url_!==void 0&&(jn(this.format_,"`format` must be set when `url` is set"),this.loader_=W6(this.url_,this.format_)),this.strategy_=e.strategy!==void 0?e.strategy:yY;let t=e.useSpatialIndex!==void 0?e.useSpatialIndex:!0;this.featuresRtree_=t?new X6:null,this.loadedExtentsRtree_=new X6,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null;let n,r;Array.isArray(e.features)?r=e.features:e.features&&(n=e.features,r=n.getArray()),!t&&n===void 0&&(n=new No(r)),r!==void 0&&this.addFeaturesInternal(r),n!==void 0&&this.bindFeaturesCollection_(n)}addFeature(e){this.addFeatureInternal(e),this.changed()}addFeatureInternal(e){let t=Bn(e);if(!this.addToIndex_(t,e)){this.featuresCollection_&&this.featuresCollection_.remove(e);return}this.setupChangeEvents_(t,e);let n=e.getGeometry();if(n){let r=n.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(r,e)}else this.nullGeometryFeatures_[t]=e;this.dispatchEvent(new Mh(Xl.ADDFEATURE,e))}setupChangeEvents_(e,t){t instanceof RA||(this.featureChangeKeys_[e]=[qn(t,nn.CHANGE,this.handleFeatureChange_,this),qn(t,yu.PROPERTYCHANGE,this.handleFeatureChange_,this)])}addToIndex_(e,t){let n=!0;if(t.getId()!==void 0){let r=String(t.getId());if(!(r in this.idIndex_))this.idIndex_[r]=t;else if(t instanceof RA){let s=this.idIndex_[r];s instanceof RA?Array.isArray(s)?s.push(t):this.idIndex_[r]=[s,t]:n=!1}else n=!1}return n&&(jn(!(e in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[e]=t),n}addFeatures(e){this.addFeaturesInternal(e),this.changed()}addFeaturesInternal(e){let t=[],n=[],r=[];for(let s=0,o=e.length;s<o;s++){let a=e[s],l=Bn(a);this.addToIndex_(l,a)&&n.push(a)}for(let s=0,o=n.length;s<o;s++){let a=n[s],l=Bn(a);this.setupChangeEvents_(l,a);let c=a.getGeometry();if(c){let u=c.getExtent();t.push(u),r.push(a)}else this.nullGeometryFeatures_[l]=a}if(this.featuresRtree_&&this.featuresRtree_.load(t,r),this.hasListener(Xl.ADDFEATURE))for(let s=0,o=n.length;s<o;s++)this.dispatchEvent(new Mh(Xl.ADDFEATURE,n[s]))}bindFeaturesCollection_(e){let t=!1;this.addEventListener(Xl.ADDFEATURE,function(n){t||(t=!0,e.push(n.feature),t=!1)}),this.addEventListener(Xl.REMOVEFEATURE,function(n){t||(t=!0,e.remove(n.feature),t=!1)}),e.addEventListener(vo.ADD,n=>{t||(t=!0,this.addFeature(n.element),t=!1)}),e.addEventListener(vo.REMOVE,n=>{t||(t=!0,this.removeFeature(n.element),t=!1)}),this.featuresCollection_=e}clear(e){if(e){for(let n in this.featureChangeKeys_)this.featureChangeKeys_[n].forEach(li);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){this.featuresRtree_.forEach(n=>{this.removeFeatureInternal(n)});for(let n in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[n])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};let t=new Mh(Xl.CLEAR);this.dispatchEvent(t),this.changed()}forEachFeature(e){if(this.featuresRtree_)return this.featuresRtree_.forEach(e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureAtCoordinateDirect(e,t){let n=[e[0],e[1],e[0],e[1]];return this.forEachFeatureInExtent(n,function(r){let s=r.getGeometry();if(s instanceof RA||s.intersectsCoordinate(e))return t(r)})}forEachFeatureInExtent(e,t){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(e,t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureIntersectingExtent(e,t){return this.forEachFeatureInExtent(e,function(n){let r=n.getGeometry();if(r instanceof RA||r.intersectsExtent(e)){let s=t(n);if(s)return s}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let e;return this.featuresCollection_?e=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(e=this.featuresRtree_.getAll(),gu(this.nullGeometryFeatures_)||Lo(e,Object.values(this.nullGeometryFeatures_))),e}getFeaturesAtCoordinate(e){let t=[];return this.forEachFeatureAtCoordinateDirect(e,function(n){t.push(n)}),t}getFeaturesInExtent(e,t){if(this.featuresRtree_){if(!(t&&t.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(e);let r=HT(e,t);return[].concat(...r.map(s=>this.featuresRtree_.getInExtent(s)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(e,t){let n=e[0],r=e[1],s=null,o=[NaN,NaN],a=1/0,l=[-1/0,-1/0,1/0,1/0];return t=t||Jf,this.featuresRtree_.forEachInExtent(l,function(c){if(t(c)){let u=c.getGeometry(),f=a;if(a=u instanceof RA?0:u.closestPointXY(n,r,o,a),a<f){s=c;let d=Math.sqrt(a);l[0]=n-d,l[1]=r-d,l[2]=n+d,l[3]=r+d}}}),s}getExtent(e){return this.featuresRtree_?.getExtent(e)??null}getFeatureById(e){let t=this.idIndex_[e.toString()];return t!==void 0?t:null}getFeatureByUid(e){let t=this.uidIndex_[e];return t!==void 0?t:null}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(e){let t=e.target,n=Bn(t),r=t.getGeometry();if(!r)n in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(t),this.nullGeometryFeatures_[n]=t);else{let o=r.getExtent();n in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[n],this.featuresRtree_&&this.featuresRtree_.insert(o,t)):this.featuresRtree_&&this.featuresRtree_.update(o,t)}let s=t.getId();if(s!==void 0){let o=s.toString();this.idIndex_[o]!==t&&(this.removeFromIdIndex_(t),this.idIndex_[o]=t)}else this.removeFromIdIndex_(t),this.uidIndex_[n]=t;this.changed(),this.dispatchEvent(new Mh(Xl.CHANGEFEATURE,t))}hasFeature(e){let t=e.getId();if(t!==void 0){let n=this.idIndex_[String(t)];return Array.isArray(n)?n.includes(e):n===e}return Bn(e)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&gu(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0}loadFeatures(e,t,n){let r=this.loadedExtentsRtree_,s=this.strategy_(e,t,n);for(let o=0,a=s.length;o<a;++o){let l=s[o];if(!r.forEachInExtent(l,function(u){return hh(u.extent,l)})){this.loading=Number(this.loading)+1,this.dispatchEvent(new Mh(Xl.FEATURESLOADSTART));let u=y=>{this.loading=Number(this.loading)-1,this.dispatchEvent(new Mh(Xl.FEATURESLOADEND,void 0,y))},f=()=>{this.changed(),this.loading=Number(this.loading)-1,this.dispatchEvent(new Mh(Xl.FEATURESLOADERROR))},d=!1,A=this.loader_.call(this,l,t,n,y=>d||u(y),()=>d||f());A instanceof Promise?(d=!0,A.then(y=>{this.addFeatures(y),u(y)}).catch(f)):this.loader_.length<4&&(this.loading=!1),r.insert(l,{extent:l.slice()})}}}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(e){let t=this.loadedExtentsRtree_,n=[];t.forEachInExtent(e,function(r){n.push(r)}),n.forEach(r=>{t.remove(r);let s=SD(r.extent,e);for(let o of s)t.insert(o,{extent:o})})}removeFeatures(e){let t=!1;for(let n=0,r=e.length;n<r;++n)t=this.removeFeatureInternal(e[n])||t;t&&this.changed()}removeFeature(e){if(!e)return;this.removeFeatureInternal(e)&&this.changed()}removeFeatureInternal(e){let t=Bn(e);if(!(t in this.uidIndex_))return!1;t in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[t]:this.featuresRtree_&&this.featuresRtree_.remove(e),this.featureChangeKeys_[t]?.forEach(li),delete this.featureChangeKeys_[t];let r=e.getId();if(r!==void 0){let s=r.toString(),o=this.idIndex_[s];o===e?delete this.idIndex_[s]:Array.isArray(o)&&(o.splice(o.indexOf(e),1),o.length===1&&(this.idIndex_[s]=o[0]))}return delete this.uidIndex_[t],this.hasListener(Xl.REMOVEFEATURE)&&this.dispatchEvent(new Mh(Xl.REMOVEFEATURE,e)),!0}removeFromIdIndex_(e){for(let t in this.idIndex_)if(this.idIndex_[t]===e){delete this.idIndex_[t];break}}setLoader(e){this.loader_=e}setUrl(e){jn(this.format_,"`format` must be set when `url` is set"),this.url_=e,this.setLoader(W6(e,this.format_))}setOverlaps(e){this.overlaps_=e,this.changed()}},vd=$6;var Ga={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},d0={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},CM=0,ub=1,RM=2;var B8=0,p0=1,IM=2,qc=3,ko=0,mi=1,vr=2,ps=0,Ms=1,Fh=2,Bh=3,Oh=4,Fd=5,hb=6,oo=100,fb=101,db=102,PM=103,LM=104,Nu=200,pb=201,mb=202,Ab=203,e0=204,t0=205,gb=206,vb=207,_b=208,xb=209,yb=210,hZ=211,fZ=212,dZ=213,pZ=214,NA=0,FA=1,BA=2,Ih=3,OA=4,UA=5,kA=6,zA=7,ig=0,DM=1,NM=2,ao=0,bb=1,wb=2,Sb=3,Tb=4,O8=5,Eb=6,Mb=7;var Cb=300,Jl=301,Hc=302,m0=303,A0=304,Uh=306,Cd=1e3,aa=1001,Rd=1002,Ti=1003,Rb=1004;var Wc=1005;var Mi=1006,g0=1007;var Vo=1008,U8=1008,Ji=1009,kh=1010,zh=1011,wl=1012,Zr=1013,xi=1014,cr=1015,Wi=1016,rg=1017,sg=1018,ca=1020,og=35902,ag=35899,u_=1021,Bd=1022,Or=1023,Gs=1026,xo=1027,Od=1028,Vh=1029,js=1030,Gh=1031,Ib=1032,v0=1033,qh=33776,Hh=33777,Wh=33778,jh=33779,lg=35840,cg=35841,ug=35842,hg=35843,_0=36196,x0=37492,y0=37496,b0=37488,w0=37489,Xh=37490,S0=37491,T0=37808,E0=37809,M0=37810,C0=37811,R0=37812,I0=37813,P0=37814,L0=37815,D0=37816,N0=37817,F0=37818,B0=37819,O0=37820,U0=37821,k0=36492,z0=36494,V0=36495,G0=36283,q0=36284,$h=36285,H0=36286;var P2=2300,nM=2301,eM=2302,w8=2303,S8=2400,T8=2401,E8=2402;var k8=0,z8=1,FM=2,mZ=3200;var ec=0,BM=1,ua="",Fr="srgb",n0="srgb-linear",i0="linear",kt="srgb",Pb="",OM="rg",V8="ga",G8=0,Sd=7680,q8=7681,H8=7682,W8=7683,j8=34055,X8=34056,$8=5386,Y8=512,Z8=513,K8=514,Q8=515,J8=516,eF=517,tF=518,L2=519,Lb=512,h_=513,Db=514,Yh=515,fg=516,Nb=517,Fu=518,Fb=519,r0=35044,dg=35048;var nF="300 es",Uo=2e3,xl=2001,jc={COMPUTE:"compute",RENDER:"render"};var Ud={TEXTURE_COMPARE:"depthTextureCompare"};function _me(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function f_(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function $v(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function UM(){let i=$v("canvas");return i.style.display="block",i}var wY={},Yv=null;function VA(...i){let e="THREE."+i.shift();Yv?Yv("log",e,...i):console.log(e,...i)}function AZ(i){let e=i[0];if(typeof e=="string"&&e.startsWith("TSL:")){let t=i[1];t&&t.isStackTrace?i[0]+=" "+t.getLocation():i[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return i}function Xe(...i){i=AZ(i);let e="THREE."+i.shift();if(Yv)Yv("warn",e,...i);else{let t=i[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...i)}}function ze(...i){i=AZ(i);let e="THREE."+i.shift();if(Yv)Yv("error",e,...i);else{let t=i[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...i)}}function ni(...i){let e=i.join(" ");e in wY||(wY[e]=!0,Xe(...i))}function iF(){return typeof self<"u"&&typeof self.scheduler<"u"&&typeof self.scheduler.yield<"u"?self.scheduler.yield():new Promise(i=>{requestAnimationFrame(i)})}function gZ(i,e,t){return new Promise(function(n,r){function s(){switch(i.clientWaitSync(e,i.SYNC_FLUSH_COMMANDS_BIT,0)){case i.WAIT_FAILED:r();break;case i.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:n()}}setTimeout(s,t)})}var Bb={[NA]:FA,[BA]:kA,[OA]:zA,[Ih]:UA,[FA]:NA,[kA]:BA,[zA]:OA,[UA]:Ih},la=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){let n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){let n=this._listeners;if(n===void 0)return;let r=n[e];if(r!==void 0){let s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let n=t[e.type];if(n!==void 0){e.target=this;let r=n.slice(0);for(let s=0,o=r.length;s<o;s++)r[s].call(this,e);e.target=null}}},sa=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],SY=1234567,M2=Math.PI/180,Id=180/Math.PI;function Rh(){let i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(sa[i&255]+sa[i>>8&255]+sa[i>>16&255]+sa[i>>24&255]+"-"+sa[e&255]+sa[e>>8&255]+"-"+sa[e>>16&15|64]+sa[e>>24&255]+"-"+sa[t&63|128]+sa[t>>8&255]+"-"+sa[t>>16&255]+sa[t>>24&255]+sa[n&255]+sa[n>>8&255]+sa[n>>16&255]+sa[n>>24&255]).toLowerCase()}function Nn(i,e,t){return Math.max(e,Math.min(t,i))}function rF(i,e){return(i%e+e)%e}function xme(i,e,t,n,r){return n+(i-e)*(r-n)/(t-e)}function yme(i,e,t){return i!==e?(t-i)/(e-i):0}function C2(i,e,t){return(1-t)*i+t*e}function bme(i,e,t,n){return C2(i,e,1-Math.exp(-t*n))}function wme(i,e=1){return e-Math.abs(rF(i,e*2)-e)}function Sme(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*(3-2*i))}function Tme(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*i*(i*(i*6-15)+10))}function Eme(i,e){return i+Math.floor(Math.random()*(e-i+1))}function Mme(i,e){return i+Math.random()*(e-i)}function Cme(i){return i*(.5-Math.random())}function Rme(i){i!==void 0&&(SY=i);let e=SY+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function Ime(i){return i*M2}function Pme(i){return i*Id}function Lme(i){return(i&i-1)===0&&i!==0}function Dme(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function Nme(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function Fme(i,e,t,n,r){let s=Math.cos,o=Math.sin,a=s(t/2),l=o(t/2),c=s((e+n)/2),u=o((e+n)/2),f=s((e-n)/2),d=o((e-n)/2),A=s((n-e)/2),y=o((n-e)/2);switch(r){case"XYX":i.set(a*u,l*f,l*d,a*c);break;case"YZY":i.set(l*d,a*u,l*f,a*c);break;case"ZXZ":i.set(l*f,l*d,a*u,a*c);break;case"XZX":i.set(a*u,l*y,l*A,a*c);break;case"YXY":i.set(l*A,a*u,l*y,a*c);break;case"ZYZ":i.set(l*y,l*A,a*u,a*c);break;default:Xe("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function Na(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("THREE.MathUtils: Invalid component type.")}}function Zn(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("THREE.MathUtils: Invalid component type.")}}var Bu={DEG2RAD:M2,RAD2DEG:Id,generateUUID:Rh,clamp:Nn,euclideanModulo:rF,mapLinear:xme,inverseLerp:yme,lerp:C2,damp:bme,pingpong:wme,smoothstep:Sme,smootherstep:Tme,randInt:Eme,randFloat:Mme,randFloatSpread:Cme,seededRandom:Rme,degToRad:Ime,radToDeg:Pme,isPowerOfTwo:Lme,ceilPowerOfTwo:Dme,floorPowerOfTwo:Nme,setQuaternionFromProperEuler:Fme,normalize:Zn,denormalize:Na},cF=class cF{constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("THREE.Vector2: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("THREE.Vector2: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Nn(this.x,e.x,t.x),this.y=Nn(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=Nn(this.x,e,t),this.y=Nn(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Nn(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(Nn(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),r=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*n-o*r+e.x,this.y=s*r+o*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};cF.prototype.isVector2=!0;var Oe=cF,qs=class{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,s,o,a){let l=n[r+0],c=n[r+1],u=n[r+2],f=n[r+3],d=s[o+0],A=s[o+1],y=s[o+2],w=s[o+3];if(f!==w||l!==d||c!==A||u!==y){let S=l*d+c*A+u*y+f*w;S<0&&(d=-d,A=-A,y=-y,w=-w,S=-S);let T=1-a;if(S<.9995){let R=Math.acos(S),P=Math.sin(R);T=Math.sin(T*R)/P,a=Math.sin(a*R)/P,l=l*T+d*a,c=c*T+A*a,u=u*T+y*a,f=f*T+w*a}else{l=l*T+d*a,c=c*T+A*a,u=u*T+y*a,f=f*T+w*a;let R=1/Math.sqrt(l*l+c*c+u*u+f*f);l*=R,c*=R,u*=R,f*=R}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=f}static multiplyQuaternionsFlat(e,t,n,r,s,o){let a=n[r],l=n[r+1],c=n[r+2],u=n[r+3],f=s[o],d=s[o+1],A=s[o+2],y=s[o+3];return e[t]=a*y+u*f+l*A-c*d,e[t+1]=l*y+u*d+c*f-a*A,e[t+2]=c*y+u*A+a*d-l*f,e[t+3]=u*y-a*f-l*d-c*A,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let n=e._x,r=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(n/2),u=a(r/2),f=a(s/2),d=l(n/2),A=l(r/2),y=l(s/2);switch(o){case"XYZ":this._x=d*u*f+c*A*y,this._y=c*A*f-d*u*y,this._z=c*u*y+d*A*f,this._w=c*u*f-d*A*y;break;case"YXZ":this._x=d*u*f+c*A*y,this._y=c*A*f-d*u*y,this._z=c*u*y-d*A*f,this._w=c*u*f+d*A*y;break;case"ZXY":this._x=d*u*f-c*A*y,this._y=c*A*f+d*u*y,this._z=c*u*y+d*A*f,this._w=c*u*f-d*A*y;break;case"ZYX":this._x=d*u*f-c*A*y,this._y=c*A*f+d*u*y,this._z=c*u*y-d*A*f,this._w=c*u*f+d*A*y;break;case"YZX":this._x=d*u*f+c*A*y,this._y=c*A*f+d*u*y,this._z=c*u*y-d*A*f,this._w=c*u*f-d*A*y;break;case"XZY":this._x=d*u*f-c*A*y,this._y=c*A*f-d*u*y,this._z=c*u*y+d*A*f,this._w=c*u*f+d*A*y;break;default:Xe("Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],r=t[4],s=t[8],o=t[1],a=t[5],l=t[9],c=t[2],u=t[6],f=t[10],d=n+a+f;if(d>0){let A=.5/Math.sqrt(d+1);this._w=.25/A,this._x=(u-l)*A,this._y=(s-c)*A,this._z=(o-r)*A}else if(n>a&&n>f){let A=2*Math.sqrt(1+n-a-f);this._w=(u-l)/A,this._x=.25*A,this._y=(r+o)/A,this._z=(s+c)/A}else if(a>f){let A=2*Math.sqrt(1+a-n-f);this._w=(s-c)/A,this._x=(r+o)/A,this._y=.25*A,this._z=(l+u)/A}else{let A=2*Math.sqrt(1+f-n-a);this._w=(o-r)/A,this._x=(s+c)/A,this._y=(l+u)/A,this._z=.25*A}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Nn(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let n=e._x,r=e._y,s=e._z,o=e._w,a=t._x,l=t._y,c=t._z,u=t._w;return this._x=n*u+o*a+r*c-s*l,this._y=r*u+o*l+s*a-n*c,this._z=s*u+o*c+n*l-r*a,this._w=o*u-n*a-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){let n=e._x,r=e._y,s=e._z,o=e._w,a=this.dot(e);a<0&&(n=-n,r=-r,s=-s,o=-o,a=-a);let l=1-t;if(a<.9995){let c=Math.acos(a),u=Math.sin(c);l=Math.sin(l*c)/u,t=Math.sin(t*c)/u,this._x=this._x*l+n*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+o*t,this._onChangeCallback()}else this._x=this._x*l+n*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+o*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},uF=class uF{constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("THREE.Vector3: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("THREE.Vector3: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(TY.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(TY.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*r,this.y=s[1]*t+s[4]*n+s[7]*r,this.z=s[2]*t+s[5]*n+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,s=e.elements,o=1/(s[3]*t+s[7]*n+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*r+s[12])*o,this.y=(s[1]*t+s[5]*n+s[9]*r+s[13])*o,this.z=(s[2]*t+s[6]*n+s[10]*r+s[14])*o,this}applyQuaternion(e){let t=this.x,n=this.y,r=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*r-a*n),u=2*(a*t-s*r),f=2*(s*n-o*t);return this.x=t+l*c+o*f-a*u,this.y=n+l*u+a*c-s*f,this.z=r+l*f+s*u-o*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*r,this.y=s[1]*t+s[5]*n+s[9]*r,this.z=s[2]*t+s[6]*n+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Nn(this.x,e.x,t.x),this.y=Nn(this.y,e.y,t.y),this.z=Nn(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=Nn(this.x,e,t),this.y=Nn(this.y,e,t),this.z=Nn(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Nn(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,r=e.y,s=e.z,o=t.x,a=t.y,l=t.z;return this.x=r*l-s*a,this.y=s*o-n*l,this.z=n*a-r*o,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Y6.copy(this).projectOnVector(e),this.sub(Y6)}reflect(e){return this.sub(Y6.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(Nn(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};uF.prototype.isVector3=!0;var re=uF,Y6=new re,TY=new qs,hF=class hF{constructor(e,t,n,r,s,o,a,l,c){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,o,a,l,c)}set(e,t,n,r,s,o,a,l,c){let u=this.elements;return u[0]=e,u[1]=r,u[2]=a,u[3]=t,u[4]=s,u[5]=l,u[6]=n,u[7]=o,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,s=this.elements,o=n[0],a=n[3],l=n[6],c=n[1],u=n[4],f=n[7],d=n[2],A=n[5],y=n[8],w=r[0],S=r[3],T=r[6],R=r[1],P=r[4],I=r[7],F=r[2],D=r[5],L=r[8];return s[0]=o*w+a*R+l*F,s[3]=o*S+a*P+l*D,s[6]=o*T+a*I+l*L,s[1]=c*w+u*R+f*F,s[4]=c*S+u*P+f*D,s[7]=c*T+u*I+f*L,s[2]=d*w+A*R+y*F,s[5]=d*S+A*P+y*D,s[8]=d*T+A*I+y*L,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8];return t*o*u-t*a*c-n*s*u+n*a*l+r*s*c-r*o*l}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],f=u*o-a*c,d=a*l-u*s,A=c*s-o*l,y=t*f+n*d+r*A;if(y===0)return this.set(0,0,0,0,0,0,0,0,0);let w=1/y;return e[0]=f*w,e[1]=(r*c-u*n)*w,e[2]=(a*n-r*o)*w,e[3]=d*w,e[4]=(u*t-r*l)*w,e[5]=(r*s-a*t)*w,e[6]=A*w,e[7]=(n*l-c*t)*w,e[8]=(o*t-n*s)*w,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,s,o,a){let l=Math.cos(s),c=Math.sin(s);return this.set(n*l,n*c,-n*(l*o+c*a)+o+e,-r*c,r*l,-r*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){return ni("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(Z6.makeScale(e,t)),this}rotate(e){return ni("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(Z6.makeRotation(-e)),this}translate(e,t){return ni("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(Z6.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,n=e.elements;for(let r=0;r<9;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}};hF.prototype.isMatrix3=!0;var Mn=hF,Z6=new Mn,EY=new Mn().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),MY=new Mn().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Bme(){let i={enabled:!0,workingColorSpace:n0,spaces:{},convert:function(r,s,o){return this.enabled===!1||s===o||!s||!o||(this.spaces[s].transfer===kt&&(r.r=Md(r.r),r.g=Md(r.g),r.b=Md(r.b)),this.spaces[s].primaries!==this.spaces[o].primaries&&(r.applyMatrix3(this.spaces[s].toXYZ),r.applyMatrix3(this.spaces[o].fromXYZ)),this.spaces[o].transfer===kt&&(r.r=Xv(r.r),r.g=Xv(r.g),r.b=Xv(r.b))),r},workingToColorSpace:function(r,s){return this.convert(r,this.workingColorSpace,s)},colorSpaceToWorking:function(r,s){return this.convert(r,s,this.workingColorSpace)},getPrimaries:function(r){return this.spaces[r].primaries},getTransfer:function(r){return r===ua?i0:this.spaces[r].transfer},getToneMappingMode:function(r){return this.spaces[r].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(r,s=this.workingColorSpace){return r.fromArray(this.spaces[s].luminanceCoefficients)},define:function(r){Object.assign(this.spaces,r)},_getMatrix:function(r,s,o){return r.copy(this.spaces[s].toXYZ).multiply(this.spaces[o].fromXYZ)},_getDrawingBufferColorSpace:function(r){return this.spaces[r].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(r=this.workingColorSpace){return this.spaces[r].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(r,s){return ni("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),i.workingToColorSpace(r,s)},toWorkingColorSpace:function(r,s){return ni("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),i.colorSpaceToWorking(r,s)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return i.define({[n0]:{primaries:e,whitePoint:n,transfer:i0,toXYZ:EY,fromXYZ:MY,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Fr},outputColorSpaceConfig:{drawingBufferColorSpace:Fr}},[Fr]:{primaries:e,whitePoint:n,transfer:kt,toXYZ:EY,fromXYZ:MY,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Fr}}}),i}var ln=Bme();function Md(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function Xv(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}var Cv,iM=class{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{Cv===void 0&&(Cv=$v("canvas")),Cv.width=e.width,Cv.height=e.height;let r=Cv.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),n=Cv}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){let t=$v("canvas");t.width=e.width,t.height=e.height;let n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);let r=n.getImageData(0,0,e.width,e.height),s=r.data;for(let o=0;o<s.length;o++)s[o]=Md(s[o]/255)*255;return n.putImageData(r,0,0),t}else if(e.data){let t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(Md(t[n]/255)*255):t[n]=Md(t[n]);return{data:t,width:e.width,height:e.height}}else return Xe("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}},Ome=0,Zv=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Ome++}),this.uuid=Rh(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){let t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<"u"&&t instanceof VideoFrame?e.set(t.displayWidth,t.displayHeight,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];let n={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let o=0,a=r.length;o<a;o++)r[o].isDataTexture?s.push(K6(r[o].image)):s.push(K6(r[o]))}else s=K6(r);n.url=s}return t||(e.images[this.uuid]=n),n}};function K6(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?iM.getDataURL(i):i.data?{data:Array.from(i.data),width:i.width,height:i.height,type:i.data.constructor.name}:(Xe("Texture: Unable to serialize Texture."),{})}var Ume=0,Q6=new re,Hs=class i extends la{constructor(e=i.DEFAULT_IMAGE,t=i.DEFAULT_MAPPING,n=aa,r=aa,s=Mi,o=Vo,a=Or,l=Ji,c=i.DEFAULT_ANISOTROPY,u=ua){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Ume++}),this.uuid=Rh(),this.name="",this.source=new Zv(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=r,this.magFilter=s,this.minFilter=o,this.anisotropy=c,this.format=a,this.internalFormat=null,this.type=l,this.offset=new Oe(0,0),this.repeat=new Oe(1,1),this.center=new Oe(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Mn,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(Q6).x}get height(){return this.source.getSize(Q6).y}get depth(){return this.source.getSize(Q6).z}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let n=e[t];if(n===void 0){Xe(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){Xe(`Texture.setValues(): property '${t}' does not exist.`);continue}r&&n&&r.isVector2&&n.isVector2||r&&n&&r.isVector3&&n.isVector3||r&&n&&r.isMatrix3&&n.isMatrix3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Cb)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Cd:e.x=e.x-Math.floor(e.x);break;case aa:e.x=e.x<0?0:1;break;case Rd:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Cd:e.y=e.y-Math.floor(e.y);break;case aa:e.y=e.y<0?0:1;break;case Rd:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}};Hs.DEFAULT_IMAGE=null;Hs.DEFAULT_MAPPING=Cb;Hs.DEFAULT_ANISOTROPY=1;var fF=class fF{constructor(e=0,t=0,n=0,r=1){this.x=e,this.y=t,this.z=n,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("THREE.Vector4: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("THREE.Vector4: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*r+o[12]*s,this.y=o[1]*t+o[5]*n+o[9]*r+o[13]*s,this.z=o[2]*t+o[6]*n+o[10]*r+o[14]*s,this.w=o[3]*t+o[7]*n+o[11]*r+o[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,s,l=e.elements,c=l[0],u=l[4],f=l[8],d=l[1],A=l[5],y=l[9],w=l[2],S=l[6],T=l[10];if(Math.abs(u-d)<.01&&Math.abs(f-w)<.01&&Math.abs(y-S)<.01){if(Math.abs(u+d)<.1&&Math.abs(f+w)<.1&&Math.abs(y+S)<.1&&Math.abs(c+A+T-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;let P=(c+1)/2,I=(A+1)/2,F=(T+1)/2,D=(u+d)/4,L=(f+w)/4,C=(y+S)/4;return P>I&&P>F?P<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(P),r=D/n,s=L/n):I>F?I<.01?(n=.707106781,r=0,s=.707106781):(r=Math.sqrt(I),n=D/r,s=C/r):F<.01?(n=.707106781,r=.707106781,s=0):(s=Math.sqrt(F),n=L/s,r=C/s),this.set(n,r,s,t),this}let R=Math.sqrt((S-y)*(S-y)+(f-w)*(f-w)+(d-u)*(d-u));return Math.abs(R)<.001&&(R=1),this.x=(S-y)/R,this.y=(f-w)/R,this.z=(d-u)/R,this.w=Math.acos((c+A+T-1)/2),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Nn(this.x,e.x,t.x),this.y=Nn(this.y,e.y,t.y),this.z=Nn(this.z,e.z,t.z),this.w=Nn(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=Nn(this.x,e,t),this.y=Nn(this.y,e,t),this.z=Nn(this.z,e,t),this.w=Nn(this.w,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Nn(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}};fF.prototype.isVector4=!0;var xn=fF,Fa=class extends la{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Mi,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new xn(0,0,e,t),this.scissorTest=!1,this.viewport=new xn(0,0,e,t),this.textures=[];let r={width:e,height:t,depth:n.depth},s=new Hs(r),o=n.count;for(let a=0;a<o;a++)this.textures[a]=s.clone(),this.textures[a].isRenderTargetTexture=!0,this.textures[a].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview,this.useArrayDepthTexture=n.useArrayDepthTexture}_setTextureOptions(e={}){let t={minFilter:Mi,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let r=0,s=this.textures.length;r<s;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=n,this.textures[r].isData3DTexture!==!0&&(this.textures[r].isArrayTexture=this.textures[r].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;let r=Object.assign({},e.textures[t].image);this.textures[t].source=new Zv(r)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this.multiview=e.multiview,this.useArrayDepthTexture=e.useArrayDepthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}},Ba=class extends Fa{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}},GA=class extends Hs{constructor(e=null,t=1,n=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=Ti,this.minFilter=Ti,this.wrapR=aa,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}};var rM=class extends Hs{constructor(e=null,t=1,n=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=Ti,this.minFilter=Ti,this.wrapR=aa,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var MM=class MM{constructor(e,t,n,r,s,o,a,l,c,u,f,d,A,y,w,S){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,o,a,l,c,u,f,d,A,y,w,S)}set(e,t,n,r,s,o,a,l,c,u,f,d,A,y,w,S){let T=this.elements;return T[0]=e,T[4]=t,T[8]=n,T[12]=r,T[1]=s,T[5]=o,T[9]=a,T[13]=l,T[2]=c,T[6]=u,T[10]=f,T[14]=d,T[3]=A,T[7]=y,T[11]=w,T[15]=S,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new MM().fromArray(this.elements)}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return this.determinantAffine()===0?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(e.determinantAffine()===0)return this.identity();let t=this.elements,n=e.elements,r=1/Rv.setFromMatrixColumn(e,0).length(),s=1/Rv.setFromMatrixColumn(e,1).length(),o=1/Rv.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*o,t[9]=n[9]*o,t[10]=n[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,n=e.x,r=e.y,s=e.z,o=Math.cos(n),a=Math.sin(n),l=Math.cos(r),c=Math.sin(r),u=Math.cos(s),f=Math.sin(s);if(e.order==="XYZ"){let d=o*u,A=o*f,y=a*u,w=a*f;t[0]=l*u,t[4]=-l*f,t[8]=c,t[1]=A+y*c,t[5]=d-w*c,t[9]=-a*l,t[2]=w-d*c,t[6]=y+A*c,t[10]=o*l}else if(e.order==="YXZ"){let d=l*u,A=l*f,y=c*u,w=c*f;t[0]=d+w*a,t[4]=y*a-A,t[8]=o*c,t[1]=o*f,t[5]=o*u,t[9]=-a,t[2]=A*a-y,t[6]=w+d*a,t[10]=o*l}else if(e.order==="ZXY"){let d=l*u,A=l*f,y=c*u,w=c*f;t[0]=d-w*a,t[4]=-o*f,t[8]=y+A*a,t[1]=A+y*a,t[5]=o*u,t[9]=w-d*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){let d=o*u,A=o*f,y=a*u,w=a*f;t[0]=l*u,t[4]=y*c-A,t[8]=d*c+w,t[1]=l*f,t[5]=w*c+d,t[9]=A*c-y,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){let d=o*l,A=o*c,y=a*l,w=a*c;t[0]=l*u,t[4]=w-d*f,t[8]=y*f+A,t[1]=f,t[5]=o*u,t[9]=-a*u,t[2]=-c*u,t[6]=A*f+y,t[10]=d-w*f}else if(e.order==="XZY"){let d=o*l,A=o*c,y=a*l,w=a*c;t[0]=l*u,t[4]=-f,t[8]=c*u,t[1]=d*f+w,t[5]=o*u,t[9]=A*f-y,t[2]=y*f-A,t[6]=a*u,t[10]=w*f+d}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(kme,e,zme)}lookAt(e,t,n){let r=this.elements;return $l.subVectors(e,t),$l.lengthSq()===0&&($l.z=1),$l.normalize(),Xp.crossVectors(n,$l),Xp.lengthSq()===0&&(Math.abs(n.z)===1?$l.x+=1e-4:$l.z+=1e-4,$l.normalize(),Xp.crossVectors(n,$l)),Xp.normalize(),w3.crossVectors($l,Xp),r[0]=Xp.x,r[4]=w3.x,r[8]=$l.x,r[1]=Xp.y,r[5]=w3.y,r[9]=$l.y,r[2]=Xp.z,r[6]=w3.z,r[10]=$l.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,s=this.elements,o=n[0],a=n[4],l=n[8],c=n[12],u=n[1],f=n[5],d=n[9],A=n[13],y=n[2],w=n[6],S=n[10],T=n[14],R=n[3],P=n[7],I=n[11],F=n[15],D=r[0],L=r[4],C=r[8],B=r[12],k=r[1],z=r[5],G=r[9],W=r[13],Y=r[2],H=r[6],$=r[10],J=r[14],te=r[3],ce=r[7],he=r[11],ve=r[15];return s[0]=o*D+a*k+l*Y+c*te,s[4]=o*L+a*z+l*H+c*ce,s[8]=o*C+a*G+l*$+c*he,s[12]=o*B+a*W+l*J+c*ve,s[1]=u*D+f*k+d*Y+A*te,s[5]=u*L+f*z+d*H+A*ce,s[9]=u*C+f*G+d*$+A*he,s[13]=u*B+f*W+d*J+A*ve,s[2]=y*D+w*k+S*Y+T*te,s[6]=y*L+w*z+S*H+T*ce,s[10]=y*C+w*G+S*$+T*he,s[14]=y*B+w*W+S*J+T*ve,s[3]=R*D+P*k+I*Y+F*te,s[7]=R*L+P*z+I*H+F*ce,s[11]=R*C+P*G+I*$+F*he,s[15]=R*B+P*W+I*J+F*ve,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[4],r=e[8],s=e[12],o=e[1],a=e[5],l=e[9],c=e[13],u=e[2],f=e[6],d=e[10],A=e[14],y=e[3],w=e[7],S=e[11],T=e[15],R=l*A-c*d,P=a*A-c*f,I=a*d-l*f,F=o*A-c*u,D=o*d-l*u,L=o*f-a*u;return t*(w*R-S*P+T*I)-n*(y*R-S*F+T*D)+r*(y*P-w*F+T*L)-s*(y*I-w*D+S*L)}determinantAffine(){let e=this.elements,t=e[0],n=e[4],r=e[8],s=e[1],o=e[5],a=e[9],l=e[2],c=e[6],u=e[10];return t*(o*u-a*c)-n*(s*u-a*l)+r*(s*c-o*l)}transpose(){let e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){let r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],f=e[9],d=e[10],A=e[11],y=e[12],w=e[13],S=e[14],T=e[15],R=t*a-n*o,P=t*l-r*o,I=t*c-s*o,F=n*l-r*a,D=n*c-s*a,L=r*c-s*l,C=u*w-f*y,B=u*S-d*y,k=u*T-A*y,z=f*S-d*w,G=f*T-A*w,W=d*T-A*S,Y=R*W-P*G+I*z+F*k-D*B+L*C;if(Y===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let H=1/Y;return e[0]=(a*W-l*G+c*z)*H,e[1]=(r*G-n*W-s*z)*H,e[2]=(w*L-S*D+T*F)*H,e[3]=(d*D-f*L-A*F)*H,e[4]=(l*k-o*W-c*B)*H,e[5]=(t*W-r*k+s*B)*H,e[6]=(S*I-y*L-T*P)*H,e[7]=(u*L-d*I+A*P)*H,e[8]=(o*G-a*k+c*C)*H,e[9]=(n*k-t*G-s*C)*H,e[10]=(y*D-w*I+T*R)*H,e[11]=(f*I-u*D-A*R)*H,e[12]=(a*B-o*z-l*C)*H,e[13]=(t*z-n*B+r*C)*H,e[14]=(w*P-y*F-S*R)*H,e[15]=(u*F-f*P+d*R)*H,this}scale(e){let t=this.elements,n=e.x,r=e.y,s=e.z;return t[0]*=n,t[4]*=r,t[8]*=s,t[1]*=n,t[5]*=r,t[9]*=s,t[2]*=n,t[6]*=r,t[10]*=s,t[3]*=n,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let n=Math.cos(t),r=Math.sin(t),s=1-n,o=e.x,a=e.y,l=e.z,c=s*o,u=s*a;return this.set(c*o+n,c*a-r*l,c*l+r*a,0,c*a+r*l,u*a+n,u*l-r*o,0,c*l-r*a,u*l+r*o,s*l*l+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,s,o){return this.set(1,n,s,0,e,1,o,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){let r=this.elements,s=t._x,o=t._y,a=t._z,l=t._w,c=s+s,u=o+o,f=a+a,d=s*c,A=s*u,y=s*f,w=o*u,S=o*f,T=a*f,R=l*c,P=l*u,I=l*f,F=n.x,D=n.y,L=n.z;return r[0]=(1-(w+T))*F,r[1]=(A+I)*F,r[2]=(y-P)*F,r[3]=0,r[4]=(A-I)*D,r[5]=(1-(d+T))*D,r[6]=(S+R)*D,r[7]=0,r[8]=(y+P)*L,r[9]=(S-R)*L,r[10]=(1-(d+w))*L,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){let r=this.elements;e.x=r[12],e.y=r[13],e.z=r[14];let s=this.determinantAffine();if(s===0)return n.set(1,1,1),t.identity(),this;let o=Rv.set(r[0],r[1],r[2]).length(),a=Rv.set(r[4],r[5],r[6]).length(),l=Rv.set(r[8],r[9],r[10]).length();s<0&&(o=-o),Cu.copy(this);let c=1/o,u=1/a,f=1/l;return Cu.elements[0]*=c,Cu.elements[1]*=c,Cu.elements[2]*=c,Cu.elements[4]*=u,Cu.elements[5]*=u,Cu.elements[6]*=u,Cu.elements[8]*=f,Cu.elements[9]*=f,Cu.elements[10]*=f,t.setFromRotationMatrix(Cu),n.x=o,n.y=a,n.z=l,this}makePerspective(e,t,n,r,s,o,a=Uo,l=!1){let c=this.elements,u=2*s/(t-e),f=2*s/(n-r),d=(t+e)/(t-e),A=(n+r)/(n-r),y,w;if(l)y=s/(o-s),w=o*s/(o-s);else if(a===Uo)y=-(o+s)/(o-s),w=-2*o*s/(o-s);else if(a===xl)y=-o/(o-s),w=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return c[0]=u,c[4]=0,c[8]=d,c[12]=0,c[1]=0,c[5]=f,c[9]=A,c[13]=0,c[2]=0,c[6]=0,c[10]=y,c[14]=w,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,r,s,o,a=Uo,l=!1){let c=this.elements,u=2/(t-e),f=2/(n-r),d=-(t+e)/(t-e),A=-(n+r)/(n-r),y,w;if(l)y=1/(o-s),w=o/(o-s);else if(a===Uo)y=-2/(o-s),w=-(o+s)/(o-s);else if(a===xl)y=-1/(o-s),w=-s/(o-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return c[0]=u,c[4]=0,c[8]=0,c[12]=d,c[1]=0,c[5]=f,c[9]=0,c[13]=A,c[2]=0,c[6]=0,c[10]=y,c[14]=w,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let r=0;r<16;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}};MM.prototype.isMatrix4=!0;var cn=MM,Rv=new re,Cu=new cn,kme=new re(0,0,0),zme=new re(1,1,1),Xp=new re,w3=new re,$l=new re,CY=new cn,RY=new qs,Oa=class i{constructor(e=0,t=0,n=0,r=i.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){let r=e.elements,s=r[0],o=r[4],a=r[8],l=r[1],c=r[5],u=r[9],f=r[2],d=r[6],A=r[10];switch(t){case"XYZ":this._y=Math.asin(Nn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,A),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(d,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Nn(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,A),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-f,s),this._z=0);break;case"ZXY":this._x=Math.asin(Nn(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-f,A),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-Nn(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(d,A),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(Nn(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-f,s)):(this._x=0,this._y=Math.atan2(a,A));break;case"XZY":this._z=Math.asin(-Nn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-u,A),this._y=0);break;default:Xe("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return CY.makeRotationFromQuaternion(e),this.setFromRotationMatrix(CY,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return RY.setFromEuler(this),this.setFromQuaternion(RY,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};Oa.DEFAULT_ORDER="XYZ";var Kv=class{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}},Vme=0,IY=new re,Iv=new qs,_d=new cn,S3=new re,v2=new re,Gme=new re,qme=new qs,PY=new re(1,0,0),LY=new re(0,1,0),DY=new re(0,0,1),NY={type:"added"},Hme={type:"removed"},Pv={type:"childadded",child:null},J6={type:"childremoved",child:null},lr=class i extends la{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Vme++}),this.uuid=Rh(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=i.DEFAULT_UP.clone();let e=new re,t=new Oa,n=new qs,r=new re(1,1,1);function s(){n.setFromEuler(t,!1)}function o(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new cn},normalMatrix:{value:new Mn}}),this.matrix=new cn,this.matrixWorld=new cn,this.matrixAutoUpdate=i.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=i.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Kv,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Iv.setFromAxisAngle(e,t),this.quaternion.multiply(Iv),this}rotateOnWorldAxis(e,t){return Iv.setFromAxisAngle(e,t),this.quaternion.premultiply(Iv),this}rotateX(e){return this.rotateOnAxis(PY,e)}rotateY(e){return this.rotateOnAxis(LY,e)}rotateZ(e){return this.rotateOnAxis(DY,e)}translateOnAxis(e,t){return IY.copy(e).applyQuaternion(this.quaternion),this.position.add(IY.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(PY,e)}translateY(e){return this.translateOnAxis(LY,e)}translateZ(e){return this.translateOnAxis(DY,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(_d.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?S3.copy(e):S3.set(e,t,n);let r=this.parent;this.updateWorldMatrix(!0,!1),v2.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?_d.lookAt(v2,S3,this.up):_d.lookAt(S3,v2,this.up),this.quaternion.setFromRotationMatrix(_d),r&&(_d.extractRotation(r.matrixWorld),Iv.setFromRotationMatrix(_d),this.quaternion.premultiply(Iv.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(ze("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(NY),Pv.child=e,this.dispatchEvent(Pv),Pv.child=null):ze("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}let t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(Hme),J6.child=e,this.dispatchEvent(J6),J6.child=null),this}removeFromParent(){let e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),_d.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),_d.multiply(e.parent.matrixWorld)),e.applyMatrix4(_d),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(NY),Pv.child=e,this.dispatchEvent(Pv),Pv.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,r=this.children.length;n<r;n++){let o=this.children[n].getObjectByProperty(e,t);if(o!==void 0)return o}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);let r=this.children;for(let s=0,o=r.length;s<o;s++)r[s].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(v2,e,Gme),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(v2,qme,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}traverseAncestors(e){let t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);let e=this.pivot;if(e!==null){let t=e.x,n=e.y,r=e.z,s=this.matrix.elements;s[12]+=t-s[0]*t-s[4]*n-s[8]*r,s[13]+=n-s[1]*t-s[5]*n-s[9]*r,s[14]+=r-s[2]*t-s[6]*n-s[10]*r}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t,n=!1){let r=this.parent;if(e===!0&&r!==null&&r.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||n)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,n=!0),t===!0){let s=this.children;for(let o=0,a=s.length;o<a;o++)s[o].updateWorldMatrix(!1,!0,n)}}toJSON(e){let t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});let r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),this.static!==!1&&(r.static=this.static),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.pivot!==null&&(r.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(r.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(r.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(a=>({...a,boundingBox:a.boundingBox?a.boundingBox.toJSON():void 0,boundingSphere:a.boundingSphere?a.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(a=>({...a})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function s(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);let a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){let l=a.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c<u;c++){let f=l[c];s(e.shapes,f)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let a=[];for(let l=0,c=this.material.length;l<c;l++)a.push(s(e.materials,this.material[l]));r.material=a}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let a=0;a<this.children.length;a++)r.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let a=0;a<this.animations.length;a++){let l=this.animations[a];r.animations.push(s(e.animations,l))}}if(t){let a=o(e.geometries),l=o(e.materials),c=o(e.textures),u=o(e.images),f=o(e.shapes),d=o(e.skeletons),A=o(e.animations),y=o(e.nodes);a.length>0&&(n.geometries=a),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),u.length>0&&(n.images=u),f.length>0&&(n.shapes=f),d.length>0&&(n.skeletons=d),A.length>0&&(n.animations=A),y.length>0&&(n.nodes=y)}return n.object=r,n;function o(a){let l=[];for(let c in a){let u=a[c];delete u.metadata,l.push(u)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.pivot=e.pivot!==null?e.pivot.clone():null,this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){let r=e.children[n];this.add(r.clone())}return this}};lr.DEFAULT_UP=new re(0,1,0);lr.DEFAULT_MATRIX_AUTO_UPDATE=!0;lr.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var Br=class extends lr{constructor(){super(),this.isGroup=!0,this.type="Group"}},Wme={type:"move"},s0=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Br,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Br,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new re,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new re),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Br,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new re,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new re,this._grip.eventsEnabled=!1),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){let t=this._hand;if(t)for(let n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let r=null,s=null,o=null,a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(let w of e.hand.values()){let S=t.getJointPose(w,n),T=this._getHandJoint(c,w);S!==null&&(T.matrix.fromArray(S.transform.matrix),T.matrix.decompose(T.position,T.rotation,T.scale),T.matrixWorldNeedsUpdate=!0,T.jointRadius=S.radius),T.visible=S!==null}let u=c.joints["index-finger-tip"],f=c.joints["thumb-tip"],d=u.position.distanceTo(f.position),A=.02,y=.005;c.inputState.pinching&&d>A+y?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&d<=A-y&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1,l.eventsEnabled&&l.dispatchEvent({type:"gripUpdated",data:e,target:this})));a!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&s!==null&&(r=s),r!==null&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(Wme)))}return a!==null&&(a.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){let n=new Br;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}},vZ={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},$p={h:0,s:0,l:0},T3={h:0,s:0,l:0};function e8(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*6*(2/3-t):i}var zt=class{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){let r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Fr){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,ln.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=ln.workingColorSpace){return this.r=e,this.g=t,this.b=n,ln.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=ln.workingColorSpace){if(e=rF(e,1),t=Nn(t,0,1),n=Nn(n,0,1),t===0)this.r=this.g=this.b=n;else{let s=n<=.5?n*(1+t):n+t-n*t,o=2*n-s;this.r=e8(o,s,e+1/3),this.g=e8(o,s,e),this.b=e8(o,s,e-1/3)}return ln.colorSpaceToWorking(this,r),this}setStyle(e,t=Fr){function n(s){s!==void 0&&parseFloat(s)<1&&Xe("Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s,o=r[1],a=r[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:Xe("Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){let s=r[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(s,16),t);Xe("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Fr){let n=vZ[e.toLowerCase()];return n!==void 0?this.setHex(n,t):Xe("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Md(e.r),this.g=Md(e.g),this.b=Md(e.b),this}copyLinearToSRGB(e){return this.r=Xv(e.r),this.g=Xv(e.g),this.b=Xv(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Fr){return ln.workingToColorSpace(oa.copy(this),e),Math.round(Nn(oa.r*255,0,255))*65536+Math.round(Nn(oa.g*255,0,255))*256+Math.round(Nn(oa.b*255,0,255))}getHexString(e=Fr){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=ln.workingColorSpace){ln.workingToColorSpace(oa.copy(this),t);let n=oa.r,r=oa.g,s=oa.b,o=Math.max(n,r,s),a=Math.min(n,r,s),l,c,u=(a+o)/2;if(a===o)l=0,c=0;else{let f=o-a;switch(c=u<=.5?f/(o+a):f/(2-o-a),o){case n:l=(r-s)/f+(r<s?6:0);break;case r:l=(s-n)/f+2;break;case s:l=(n-r)/f+4;break}l/=6}return e.h=l,e.s=c,e.l=u,e}getRGB(e,t=ln.workingColorSpace){return ln.workingToColorSpace(oa.copy(this),t),e.r=oa.r,e.g=oa.g,e.b=oa.b,e}getStyle(e=Fr){ln.workingToColorSpace(oa.copy(this),e);let t=oa.r,n=oa.g,r=oa.b;return e!==Fr?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(r*255)})`}offsetHSL(e,t,n){return this.getHSL($p),this.setHSL($p.h+e,$p.s+t,$p.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL($p),e.getHSL(T3);let n=C2($p.h,T3.h,t),r=C2($p.s,T3.s,t),s=C2($p.l,T3.l,t);return this.setHSL(n,r,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,n=this.g,r=this.b,s=e.elements;return this.r=s[0]*t+s[3]*n+s[6]*r,this.g=s[1]*t+s[4]*n+s[7]*r,this.b=s[2]*t+s[5]*n+s[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},oa=new zt;zt.NAMES=vZ;var o0=class extends lr{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Oa,this.environmentIntensity=1,this.environmentRotation=new Oa,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}},Ru=new re,xd=new re,t8=new re,yd=new re,Lv=new re,Dv=new re,FY=new re,n8=new re,i8=new re,r8=new re,s8=new xn,o8=new xn,a8=new xn,Td=class i{constructor(e=new re,t=new re,n=new re){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),Ru.subVectors(e,t),r.cross(Ru);let s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,n,r,s){Ru.subVectors(r,t),xd.subVectors(n,t),t8.subVectors(e,t);let o=Ru.dot(Ru),a=Ru.dot(xd),l=Ru.dot(t8),c=xd.dot(xd),u=xd.dot(t8),f=o*c-a*a;if(f===0)return s.set(0,0,0),null;let d=1/f,A=(c*l-a*u)*d,y=(o*u-a*l)*d;return s.set(1-A-y,y,A)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,yd)===null?!1:yd.x>=0&&yd.y>=0&&yd.x+yd.y<=1}static getInterpolation(e,t,n,r,s,o,a,l){return this.getBarycoord(e,t,n,r,yd)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,yd.x),l.addScaledVector(o,yd.y),l.addScaledVector(a,yd.z),l)}static getInterpolatedAttribute(e,t,n,r,s,o){return s8.setScalar(0),o8.setScalar(0),a8.setScalar(0),s8.fromBufferAttribute(e,t),o8.fromBufferAttribute(e,n),a8.fromBufferAttribute(e,r),o.setScalar(0),o.addScaledVector(s8,s.x),o.addScaledVector(o8,s.y),o.addScaledVector(a8,s.z),o}static isFrontFacing(e,t,n,r){return Ru.subVectors(n,t),xd.subVectors(e,t),Ru.cross(xd).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Ru.subVectors(this.c,this.b),xd.subVectors(this.a,this.b),Ru.cross(xd).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return i.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return i.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,r,s){return i.getInterpolation(e,this.a,this.b,this.c,t,n,r,s)}containsPoint(e){return i.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return i.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n=this.a,r=this.b,s=this.c,o,a;Lv.subVectors(r,n),Dv.subVectors(s,n),n8.subVectors(e,n);let l=Lv.dot(n8),c=Dv.dot(n8);if(l<=0&&c<=0)return t.copy(n);i8.subVectors(e,r);let u=Lv.dot(i8),f=Dv.dot(i8);if(u>=0&&f<=u)return t.copy(r);let d=l*f-u*c;if(d<=0&&l>=0&&u<=0)return o=l/(l-u),t.copy(n).addScaledVector(Lv,o);r8.subVectors(e,s);let A=Lv.dot(r8),y=Dv.dot(r8);if(y>=0&&A<=y)return t.copy(s);let w=A*c-l*y;if(w<=0&&c>=0&&y<=0)return a=c/(c-y),t.copy(n).addScaledVector(Dv,a);let S=u*y-A*f;if(S<=0&&f-u>=0&&A-y>=0)return FY.subVectors(s,r),a=(f-u)/(f-u+(A-y)),t.copy(r).addScaledVector(FY,a);let T=1/(S+w+d);return o=w*T,a=d*T,t.copy(n).addScaledVector(Lv,o).addScaledVector(Dv,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},Ua=class{constructor(e=new re(1/0,1/0,1/0),t=new re(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(Iu.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Iu.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=Iu.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let n=e.geometry;if(n!==void 0){let s=n.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let o=0,a=s.count;o<a;o++)e.isMesh===!0?e.getVertexPosition(o,Iu):Iu.fromBufferAttribute(s,o),Iu.applyMatrix4(e.matrixWorld),this.expandByPoint(Iu);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),E3.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),E3.copy(n.boundingBox)),E3.applyMatrix4(e.matrixWorld),this.union(E3)}let r=e.children;for(let s=0,o=r.length;s<o;s++)this.expandByObject(r[s],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Iu),Iu.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(_2),M3.subVectors(this.max,_2),Nv.subVectors(e.a,_2),Fv.subVectors(e.b,_2),Bv.subVectors(e.c,_2),Yp.subVectors(Fv,Nv),Zp.subVectors(Bv,Fv),IA.subVectors(Nv,Bv);let t=[0,-Yp.z,Yp.y,0,-Zp.z,Zp.y,0,-IA.z,IA.y,Yp.z,0,-Yp.x,Zp.z,0,-Zp.x,IA.z,0,-IA.x,-Yp.y,Yp.x,0,-Zp.y,Zp.x,0,-IA.y,IA.x,0];return!l8(t,Nv,Fv,Bv,M3)||(t=[1,0,0,0,1,0,0,0,1],!l8(t,Nv,Fv,Bv,M3))?!1:(C3.crossVectors(Yp,Zp),t=[C3.x,C3.y,C3.z],l8(t,Nv,Fv,Bv,M3))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Iu).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Iu).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(bd[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),bd[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),bd[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),bd[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),bd[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),bd[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),bd[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),bd[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(bd),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}},bd=[new re,new re,new re,new re,new re,new re,new re,new re],Iu=new re,E3=new Ua,Nv=new re,Fv=new re,Bv=new re,Yp=new re,Zp=new re,IA=new re,_2=new re,M3=new re,C3=new re,PA=new re;function l8(i,e,t,n,r){for(let s=0,o=i.length-3;s<=o;s+=3){PA.fromArray(i,s);let a=r.x*Math.abs(PA.x)+r.y*Math.abs(PA.y)+r.z*Math.abs(PA.z),l=e.dot(PA),c=t.dot(PA),u=n.dot(PA);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}var Ed=jme();function jme(){let i=new ArrayBuffer(4),e=new Float32Array(i),t=new Uint32Array(i),n=new Uint32Array(512),r=new Uint32Array(512);for(let l=0;l<256;++l){let c=l-127;c<-27?(n[l]=0,n[l|256]=32768,r[l]=24,r[l|256]=24):c<-14?(n[l]=1024>>-c-14,n[l|256]=1024>>-c-14|32768,r[l]=-c-1,r[l|256]=-c-1):c<=15?(n[l]=c+15<<10,n[l|256]=c+15<<10|32768,r[l]=13,r[l|256]=13):c<128?(n[l]=31744,n[l|256]=64512,r[l]=24,r[l|256]=24):(n[l]=31744,n[l|256]=64512,r[l]=13,r[l|256]=13)}let s=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,u=0;for(;(c&8388608)===0;)c<<=1,u-=8388608;c&=-8388609,u+=947912704,s[l]=c|u}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)o[l]=l<<23;o[31]=1199570944,o[32]=2147483648;for(let l=33;l<63;++l)o[l]=2147483648+(l-32<<23);o[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(a[l]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:r,mantissaTable:s,exponentTable:o,offsetTable:a}}function Yl(i){Math.abs(i)>65504&&Xe("DataUtils.toHalfFloat(): Value out of range."),i=Nn(i,-65504,65504),Ed.floatView[0]=i;let e=Ed.uint32View[0],t=e>>23&511;return Ed.baseTable[t]+((e&8388607)>>Ed.shiftTable[t])}function R3(i){let e=i>>10;return Ed.uint32View[0]=Ed.mantissaTable[Ed.offsetTable[e]+(i&1023)]+Ed.exponentTable[e],Ed.floatView[0]}var Vs=new re,I3=new Oe,Xme=0,Hi=class extends la{constructor(e,t,n=!1){if(super(),Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:Xme++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=r0,this.updateRanges=[],this.gpuType=cr,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[n+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)I3.fromBufferAttribute(this,t),I3.applyMatrix3(e),this.setXY(t,I3.x,I3.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)Vs.fromBufferAttribute(this,t),Vs.applyMatrix3(e),this.setXYZ(t,Vs.x,Vs.y,Vs.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)Vs.fromBufferAttribute(this,t),Vs.applyMatrix4(e),this.setXYZ(t,Vs.x,Vs.y,Vs.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Vs.fromBufferAttribute(this,t),Vs.applyNormalMatrix(e),this.setXYZ(t,Vs.x,Vs.y,Vs.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Vs.fromBufferAttribute(this,t),Vs.transformDirection(e),this.setXYZ(t,Vs.x,Vs.y,Vs.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=Na(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Zn(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Na(t,this.array)),t}setX(e,t){return this.normalized&&(t=Zn(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Na(t,this.array)),t}setY(e,t){return this.normalized&&(t=Zn(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=Na(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Zn(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=Na(t,this.array)),t}setW(e,t){return this.normalized&&(t=Zn(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Zn(t,this.array),n=Zn(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=Zn(t,this.array),n=Zn(n,this.array),r=Zn(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this}setXYZW(e,t,n,r,s){return e*=this.itemSize,this.normalized&&(t=Zn(t,this.array),n=Zn(n,this.array),r=Zn(r,this.array),s=Zn(s,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==r0&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:"dispose"})}};var qA=class extends Hi{constructor(e,t,n){super(new Uint16Array(e),t,n)}};var HA=class extends Hi{constructor(e,t,n){super(new Uint32Array(e),t,n)}},Qv=class extends Hi{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=R3(this.array[e*this.itemSize]);return this.normalized&&(t=Na(t,this.array)),t}setX(e,t){return this.normalized&&(t=Zn(t,this.array)),this.array[e*this.itemSize]=Yl(t),this}getY(e){let t=R3(this.array[e*this.itemSize+1]);return this.normalized&&(t=Na(t,this.array)),t}setY(e,t){return this.normalized&&(t=Zn(t,this.array)),this.array[e*this.itemSize+1]=Yl(t),this}getZ(e){let t=R3(this.array[e*this.itemSize+2]);return this.normalized&&(t=Na(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Zn(t,this.array)),this.array[e*this.itemSize+2]=Yl(t),this}getW(e){let t=R3(this.array[e*this.itemSize+3]);return this.normalized&&(t=Na(t,this.array)),t}setW(e,t){return this.normalized&&(t=Zn(t,this.array)),this.array[e*this.itemSize+3]=Yl(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Zn(t,this.array),n=Zn(n,this.array)),this.array[e+0]=Yl(t),this.array[e+1]=Yl(n),this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=Zn(t,this.array),n=Zn(n,this.array),r=Zn(r,this.array)),this.array[e+0]=Yl(t),this.array[e+1]=Yl(n),this.array[e+2]=Yl(r),this}setXYZW(e,t,n,r,s){return e*=this.itemSize,this.normalized&&(t=Zn(t,this.array),n=Zn(n,this.array),r=Zn(r,this.array),s=Zn(s,this.array)),this.array[e+0]=Yl(t),this.array[e+1]=Yl(n),this.array[e+2]=Yl(r),this.array[e+3]=Yl(s),this}},Ln=class extends Hi{constructor(e,t,n){super(new Float32Array(e),t,n)}},$me=new Ua,x2=new re,c8=new re,yl=class{constructor(e=new re,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let n=this.center;t!==void 0?n.copy(t):$me.setFromPoints(e).getCenter(n);let r=0;for(let s=0,o=e.length;s<o;s++)r=Math.max(r,n.distanceToSquared(e[s]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;x2.subVectors(e,this.center);let t=x2.lengthSq();if(t>this.radius*this.radius){let n=Math.sqrt(t),r=(n-this.radius)*.5;this.center.addScaledVector(x2,r/n),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(c8.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(x2.copy(e.center).add(c8)),this.expandByPoint(x2.copy(e.center).sub(c8))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}},Yme=0,Vc=new cn,u8=new lr,Ov=new re,Zl=new Ua,y2=new Ua,_o=new re,Xn=class i extends la{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Yme++}),this.uuid=Rh(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={},this._transformed=!1}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(_me(e)?HA:qA)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);let n=this.attributes.normal;if(n!==void 0){let s=new Mn().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}let r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this._transformed=!0,this}applyQuaternion(e){return Vc.makeRotationFromQuaternion(e),this.applyMatrix4(Vc),this}rotateX(e){return Vc.makeRotationX(e),this.applyMatrix4(Vc),this}rotateY(e){return Vc.makeRotationY(e),this.applyMatrix4(Vc),this}rotateZ(e){return Vc.makeRotationZ(e),this.applyMatrix4(Vc),this}translate(e,t,n){return Vc.makeTranslation(e,t,n),this.applyMatrix4(Vc),this}scale(e,t,n){return Vc.makeScale(e,t,n),this.applyMatrix4(Vc),this}lookAt(e){return u8.lookAt(e),u8.updateMatrix(),this.applyMatrix4(u8.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ov).negate(),this.translate(Ov.x,Ov.y,Ov.z),this}setFromPoints(e){let t=this.getAttribute("position");if(t===void 0){let n=[];for(let r=0,s=e.length;r<s;r++){let o=e[r];n.push(o.x,o.y,o.z||0)}this.setAttribute("position",new Ln(n,3))}else{let n=Math.min(e.length,t.count);for(let r=0;r<n;r++){let s=e[r];t.setXYZ(r,s.x,s.y,s.z||0)}e.length>t.count&&Xe("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Ua);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){ze("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new re(-1/0,-1/0,-1/0),new re(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,r=t.length;n<r;n++){let s=t[n];Zl.setFromBufferAttribute(s),this.morphTargetsRelative?(_o.addVectors(this.boundingBox.min,Zl.min),this.boundingBox.expandByPoint(_o),_o.addVectors(this.boundingBox.max,Zl.max),this.boundingBox.expandByPoint(_o)):(this.boundingBox.expandByPoint(Zl.min),this.boundingBox.expandByPoint(Zl.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&ze('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new yl);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){ze("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new re,1/0);return}if(e){let n=this.boundingSphere.center;if(Zl.setFromBufferAttribute(e),t)for(let s=0,o=t.length;s<o;s++){let a=t[s];y2.setFromBufferAttribute(a),this.morphTargetsRelative?(_o.addVectors(Zl.min,y2.min),Zl.expandByPoint(_o),_o.addVectors(Zl.max,y2.max),Zl.expandByPoint(_o)):(Zl.expandByPoint(y2.min),Zl.expandByPoint(y2.max))}Zl.getCenter(n);let r=0;for(let s=0,o=e.count;s<o;s++)_o.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(_o));if(t)for(let s=0,o=t.length;s<o;s++){let a=t[s],l=this.morphTargetsRelative;for(let c=0,u=a.count;c<u;c++)_o.fromBufferAttribute(a,c),l&&(Ov.fromBufferAttribute(e,c),_o.add(Ov)),r=Math.max(r,n.distanceToSquared(_o))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&ze('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){ze("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let n=t.position,r=t.normal,s=t.uv,o=this.getAttribute("tangent");(o===void 0||o.count!==n.count)&&(o=new Hi(new Float32Array(4*n.count),4),this.setAttribute("tangent",o));let a=[],l=[];for(let C=0;C<n.count;C++)a[C]=new re,l[C]=new re;let c=new re,u=new re,f=new re,d=new Oe,A=new Oe,y=new Oe,w=new re,S=new re;function T(C,B,k){c.fromBufferAttribute(n,C),u.fromBufferAttribute(n,B),f.fromBufferAttribute(n,k),d.fromBufferAttribute(s,C),A.fromBufferAttribute(s,B),y.fromBufferAttribute(s,k),u.sub(c),f.sub(c),A.sub(d),y.sub(d);let z=1/(A.x*y.y-y.x*A.y);isFinite(z)&&(w.copy(u).multiplyScalar(y.y).addScaledVector(f,-A.y).multiplyScalar(z),S.copy(f).multiplyScalar(A.x).addScaledVector(u,-y.x).multiplyScalar(z),a[C].add(w),a[B].add(w),a[k].add(w),l[C].add(S),l[B].add(S),l[k].add(S))}let R=this.groups;R.length===0&&(R=[{start:0,count:e.count}]);for(let C=0,B=R.length;C<B;++C){let k=R[C],z=k.start,G=k.count;for(let W=z,Y=z+G;W<Y;W+=3)T(e.getX(W+0),e.getX(W+1),e.getX(W+2))}let P=new re,I=new re,F=new re,D=new re;function L(C){F.fromBufferAttribute(r,C),D.copy(F);let B=a[C];P.copy(B),P.sub(F.multiplyScalar(F.dot(B))).normalize(),I.crossVectors(D,B);let z=I.dot(l[C])<0?-1:1;o.setXYZW(C,P.x,P.y,P.z,z)}for(let C=0,B=R.length;C<B;++C){let k=R[C],z=k.start,G=k.count;for(let W=z,Y=z+G;W<Y;W+=3)L(e.getX(W+0)),L(e.getX(W+1)),L(e.getX(W+2))}this._transformed=!0}computeVertexNormals(){let e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0||n.count!==t.count)n=new Hi(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let d=0,A=n.count;d<A;d++)n.setXYZ(d,0,0,0);let r=new re,s=new re,o=new re,a=new re,l=new re,c=new re,u=new re,f=new re;if(e)for(let d=0,A=e.count;d<A;d+=3){let y=e.getX(d+0),w=e.getX(d+1),S=e.getX(d+2);r.fromBufferAttribute(t,y),s.fromBufferAttribute(t,w),o.fromBufferAttribute(t,S),u.subVectors(o,s),f.subVectors(r,s),u.cross(f),a.fromBufferAttribute(n,y),l.fromBufferAttribute(n,w),c.fromBufferAttribute(n,S),a.add(u),l.add(u),c.add(u),n.setXYZ(y,a.x,a.y,a.z),n.setXYZ(w,l.x,l.y,l.z),n.setXYZ(S,c.x,c.y,c.z)}else for(let d=0,A=t.count;d<A;d+=3)r.fromBufferAttribute(t,d+0),s.fromBufferAttribute(t,d+1),o.fromBufferAttribute(t,d+2),u.subVectors(o,s),f.subVectors(r,s),u.cross(f),n.setXYZ(d+0,u.x,u.y,u.z),n.setXYZ(d+1,u.x,u.y,u.z),n.setXYZ(d+2,u.x,u.y,u.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){let e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)_o.fromBufferAttribute(e,t),_o.normalize(),e.setXYZ(t,_o.x,_o.y,_o.z)}toNonIndexed(){function e(a,l){let c=a.array,u=a.itemSize,f=a.normalized,d=new c.constructor(l.length*u),A=0,y=0;for(let w=0,S=l.length;w<S;w++){a.isInterleavedBufferAttribute?A=l[w]*a.data.stride+a.offset:A=l[w]*u;for(let T=0;T<u;T++)d[y++]=c[A++]}return new Hi(d,u,f)}if(this.index===null)return Xe("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new i,n=this.index.array,r=this.attributes;for(let a in r){let l=r[a],c=e(l,n);t.setAttribute(a,c)}let s=this.morphAttributes;for(let a in s){let l=[],c=s[a];for(let u=0,f=c.length;u<f;u++){let d=c[u],A=e(d,n);l.push(A)}t.morphAttributes[a]=l}t.morphTargetsRelative=this.morphTargetsRelative;let o=this.groups;for(let a=0,l=o.length;a<l;a++){let c=o[a];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){let e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.parameters!==void 0&&this._transformed===!0?"BufferGeometry":this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0&&this._transformed!==!0){let l=this.parameters;for(let c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let n=this.attributes;for(let l in n){let c=n[l];e.data.attributes[l]=c.toJSON(e.data)}let r={},s=!1;for(let l in this.morphAttributes){let c=this.morphAttributes[l],u=[];for(let f=0,d=c.length;f<d;f++){let A=c[f];u.push(A.toJSON(e.data))}u.length>0&&(r[l]=u,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);let o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));let a=this.boundingSphere;return a!==null&&(e.data.boundingSphere=a.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;n!==null&&this.setIndex(n.clone());let r=e.attributes;for(let c in r){let u=r[c];this.setAttribute(c,u.clone(t))}let s=e.morphAttributes;for(let c in s){let u=[],f=s[c];for(let d=0,A=f.length;d<A;d++)u.push(f[d].clone(t));this.morphAttributes[c]=u}this.morphTargetsRelative=e.morphTargetsRelative;let o=e.groups;for(let c=0,u=o.length;c<u;c++){let f=o[c];this.addGroup(f.start,f.count,f.materialIndex)}let a=e.boundingBox;a!==null&&(this.boundingBox=a.clone());let l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this._transformed=e._transformed,this}dispose(){this.dispatchEvent({type:"dispose"})}},Pd=class{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=r0,this.updateRanges=[],this.version=0,this.uuid=Rh()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let r=0,s=this.stride;r<s;r++)this.array[e+r]=t.array[n+r];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Rh()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Rh()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}},La=new re,zo=class i{constructor(e,t,n,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=r}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)La.fromBufferAttribute(this,t),La.applyMatrix4(e),this.setXYZ(t,La.x,La.y,La.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)La.fromBufferAttribute(this,t),La.applyNormalMatrix(e),this.setXYZ(t,La.x,La.y,La.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)La.fromBufferAttribute(this,t),La.transformDirection(e),this.setXYZ(t,La.x,La.y,La.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=Na(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Zn(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=Zn(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Zn(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Zn(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Zn(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=Na(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=Na(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=Na(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=Na(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=Zn(t,this.array),n=Zn(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=Zn(t,this.array),n=Zn(n,this.array),r=Zn(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this}setXYZW(e,t,n,r,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=Zn(t,this.array),n=Zn(n,this.array),r=Zn(r,this.array),s=Zn(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this.data.array[e+3]=s,this}clone(e){if(e===void 0){VA("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");let t=[];for(let n=0;n<this.count;n++){let r=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return new Hi(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new i(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){VA("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");let t=[];for(let n=0;n<this.count;n++){let r=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}},Zme=0,Ws=class extends la{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Zme++}),this.uuid=Rh(),this.name="",this.type="Material",this.blending=Ms,this.side=ko,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=e0,this.blendDst=t0,this.blendEquation=oo,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new zt(0,0,0),this.blendAlpha=0,this.depthFunc=Ih,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=L2,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Sd,this.stencilZFail=Sd,this.stencilZPass=Sd,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let n=e[t];if(n===void 0){Xe(`Material: parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){Xe(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector2&&n&&n.isVector2||r&&r.isEuler&&n&&n.isEuler||r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});let n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==Ms&&(n.blending=this.blending),this.side!==ko&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==e0&&(n.blendSrc=this.blendSrc),this.blendDst!==t0&&(n.blendDst=this.blendDst),this.blendEquation!==oo&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==Ih&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==L2&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Sd&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Sd&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Sd&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(s){let o=[];for(let a in s){let l=s[a];delete l.metadata,o.push(l)}return o}if(t){let s=r(e.textures),o=r(e.images);s.length>0&&(n.textures=s),o.length>0&&(n.images=o)}return n}fromJSON(e,t){if(e.uuid!==void 0&&(this.uuid=e.uuid),e.name!==void 0&&(this.name=e.name),e.color!==void 0&&this.color!==void 0&&this.color.setHex(e.color),e.roughness!==void 0&&(this.roughness=e.roughness),e.metalness!==void 0&&(this.metalness=e.metalness),e.sheen!==void 0&&(this.sheen=e.sheen),e.sheenColor!==void 0&&(this.sheenColor=new zt().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(this.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&this.emissive!==void 0&&this.emissive.setHex(e.emissive),e.specular!==void 0&&this.specular!==void 0&&this.specular.setHex(e.specular),e.specularIntensity!==void 0&&(this.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&this.specularColor!==void 0&&this.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(this.shininess=e.shininess),e.clearcoat!==void 0&&(this.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(this.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(this.dispersion=e.dispersion),e.iridescence!==void 0&&(this.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(this.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(this.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(this.transmission=e.transmission),e.thickness!==void 0&&(this.thickness=e.thickness),e.attenuationDistance!==void 0&&(this.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&this.attenuationColor!==void 0&&this.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(this.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(this.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(this.fog=e.fog),e.flatShading!==void 0&&(this.flatShading=e.flatShading),e.blending!==void 0&&(this.blending=e.blending),e.combine!==void 0&&(this.combine=e.combine),e.side!==void 0&&(this.side=e.side),e.shadowSide!==void 0&&(this.shadowSide=e.shadowSide),e.opacity!==void 0&&(this.opacity=e.opacity),e.transparent!==void 0&&(this.transparent=e.transparent),e.alphaTest!==void 0&&(this.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(this.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(this.depthFunc=e.depthFunc),e.depthTest!==void 0&&(this.depthTest=e.depthTest),e.depthWrite!==void 0&&(this.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(this.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(this.blendSrc=e.blendSrc),e.blendDst!==void 0&&(this.blendDst=e.blendDst),e.blendEquation!==void 0&&(this.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(this.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(this.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(this.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&this.blendColor!==void 0&&this.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(this.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(this.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(this.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(this.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(this.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(this.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(this.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(this.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(this.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(this.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(this.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(this.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(this.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(this.rotation=e.rotation),e.linewidth!==void 0&&(this.linewidth=e.linewidth),e.dashSize!==void 0&&(this.dashSize=e.dashSize),e.gapSize!==void 0&&(this.gapSize=e.gapSize),e.scale!==void 0&&(this.scale=e.scale),e.polygonOffset!==void 0&&(this.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(this.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(this.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(this.dithering=e.dithering),e.alphaToCoverage!==void 0&&(this.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(this.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(this.forceSinglePass=e.forceSinglePass),e.allowOverride!==void 0&&(this.allowOverride=e.allowOverride),e.visible!==void 0&&(this.visible=e.visible),e.toneMapped!==void 0&&(this.toneMapped=e.toneMapped),e.userData!==void 0&&(this.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?this.vertexColors=e.vertexColors>0:this.vertexColors=e.vertexColors),e.size!==void 0&&(this.size=e.size),e.sizeAttenuation!==void 0&&(this.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(this.map=t[e.map]||null),e.matcap!==void 0&&(this.matcap=t[e.matcap]||null),e.alphaMap!==void 0&&(this.alphaMap=t[e.alphaMap]||null),e.bumpMap!==void 0&&(this.bumpMap=t[e.bumpMap]||null),e.bumpScale!==void 0&&(this.bumpScale=e.bumpScale),e.normalMap!==void 0&&(this.normalMap=t[e.normalMap]||null),e.normalMapType!==void 0&&(this.normalMapType=e.normalMapType),e.normalScale!==void 0){let n=e.normalScale;Array.isArray(n)===!1&&(n=[n,n]),this.normalScale=new Oe().fromArray(n)}return e.displacementMap!==void 0&&(this.displacementMap=t[e.displacementMap]||null),e.displacementScale!==void 0&&(this.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(this.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(this.roughnessMap=t[e.roughnessMap]||null),e.metalnessMap!==void 0&&(this.metalnessMap=t[e.metalnessMap]||null),e.emissiveMap!==void 0&&(this.emissiveMap=t[e.emissiveMap]||null),e.emissiveIntensity!==void 0&&(this.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(this.specularMap=t[e.specularMap]||null),e.specularIntensityMap!==void 0&&(this.specularIntensityMap=t[e.specularIntensityMap]||null),e.specularColorMap!==void 0&&(this.specularColorMap=t[e.specularColorMap]||null),e.envMap!==void 0&&(this.envMap=t[e.envMap]||null),e.envMapRotation!==void 0&&this.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(this.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(this.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(this.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(this.lightMap=t[e.lightMap]||null),e.lightMapIntensity!==void 0&&(this.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(this.aoMap=t[e.aoMap]||null),e.aoMapIntensity!==void 0&&(this.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(this.gradientMap=t[e.gradientMap]||null),e.clearcoatMap!==void 0&&(this.clearcoatMap=t[e.clearcoatMap]||null),e.clearcoatRoughnessMap!==void 0&&(this.clearcoatRoughnessMap=t[e.clearcoatRoughnessMap]||null),e.clearcoatNormalMap!==void 0&&(this.clearcoatNormalMap=t[e.clearcoatNormalMap]||null),e.clearcoatNormalScale!==void 0&&(this.clearcoatNormalScale=new Oe().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(this.iridescenceMap=t[e.iridescenceMap]||null),e.iridescenceThicknessMap!==void 0&&(this.iridescenceThicknessMap=t[e.iridescenceThicknessMap]||null),e.transmissionMap!==void 0&&(this.transmissionMap=t[e.transmissionMap]||null),e.thicknessMap!==void 0&&(this.thicknessMap=t[e.thicknessMap]||null),e.anisotropyMap!==void 0&&(this.anisotropyMap=t[e.anisotropyMap]||null),e.sheenColorMap!==void 0&&(this.sheenColorMap=t[e.sheenColorMap]||null),e.sheenRoughnessMap!==void 0&&(this.sheenRoughnessMap=t[e.sheenRoughnessMap]||null),this}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(t!==null){let r=t.length;n=new Array(r);for(let s=0;s!==r;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}},Ph=class extends Ws{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new zt(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}},Uv,b2=new re,kv=new re,zv=new re,Vv=new Oe,w2=new Oe,_Z=new cn,P3=new re,S2=new re,L3=new re,BY=new Oe,h8=new Oe,OY=new Oe,WA=class extends lr{constructor(e=new Ph){if(super(),this.isSprite=!0,this.type="Sprite",Uv===void 0){Uv=new Xn;let t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new Pd(t,5);Uv.setIndex([0,1,2,0,2,3]),Uv.setAttribute("position",new zo(n,3,0,!1)),Uv.setAttribute("uv",new zo(n,2,3,!1))}this.geometry=Uv,this.material=e,this.center=new Oe(.5,.5),this.count=1}raycast(e,t){e.camera===null&&ze('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),kv.setFromMatrixScale(this.matrixWorld),_Z.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),zv.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&kv.multiplyScalar(-zv.z);let n=this.material.rotation,r,s;n!==0&&(s=Math.cos(n),r=Math.sin(n));let o=this.center;D3(P3.set(-.5,-.5,0),zv,o,kv,r,s),D3(S2.set(.5,-.5,0),zv,o,kv,r,s),D3(L3.set(.5,.5,0),zv,o,kv,r,s),BY.set(0,0),h8.set(1,0),OY.set(1,1);let a=e.ray.intersectTriangle(P3,S2,L3,!1,b2);if(a===null&&(D3(S2.set(-.5,.5,0),zv,o,kv,r,s),h8.set(0,1),a=e.ray.intersectTriangle(P3,L3,S2,!1,b2),a===null))return;let l=e.ray.origin.distanceTo(b2);l<e.near||l>e.far||t.push({distance:l,point:b2.clone(),uv:Td.getInterpolation(b2,P3,S2,L3,BY,h8,OY,new Oe),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}};function D3(i,e,t,n,r,s){Vv.subVectors(i,t).addScalar(.5).multiply(n),r!==void 0?(w2.x=s*Vv.x-r*Vv.y,w2.y=r*Vv.x+s*Vv.y):w2.copy(Vv),i.copy(e),i.x+=w2.x,i.y+=w2.y,i.applyMatrix4(_Z)}var wd=new re,f8=new re,N3=new re,Kp=new re,d8=new re,F3=new re,p8=new re,Ld=class{constructor(e=new re,t=new re(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,wd)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=wd.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(wd.copy(this.origin).addScaledVector(this.direction,t),wd.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){f8.copy(e).add(t).multiplyScalar(.5),N3.copy(t).sub(e).normalize(),Kp.copy(this.origin).sub(f8);let s=e.distanceTo(t)*.5,o=-this.direction.dot(N3),a=Kp.dot(this.direction),l=-Kp.dot(N3),c=Kp.lengthSq(),u=Math.abs(1-o*o),f,d,A,y;if(u>0)if(f=o*l-a,d=o*a-l,y=s*u,f>=0)if(d>=-y)if(d<=y){let w=1/u;f*=w,d*=w,A=f*(f+o*d+2*a)+d*(o*f+d+2*l)+c}else d=s,f=Math.max(0,-(o*d+a)),A=-f*f+d*(d+2*l)+c;else d=-s,f=Math.max(0,-(o*d+a)),A=-f*f+d*(d+2*l)+c;else d<=-y?(f=Math.max(0,-(-o*s+a)),d=f>0?-s:Math.min(Math.max(-s,-l),s),A=-f*f+d*(d+2*l)+c):d<=y?(f=0,d=Math.min(Math.max(-s,-l),s),A=d*(d+2*l)+c):(f=Math.max(0,-(o*s+a)),d=f>0?s:Math.min(Math.max(-s,-l),s),A=-f*f+d*(d+2*l)+c);else d=o>0?-s:s,f=Math.max(0,-(o*d+a)),A=-f*f+d*(d+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,f),r&&r.copy(f8).addScaledVector(N3,d),A}intersectSphere(e,t){wd.subVectors(e.center,this.origin);let n=wd.dot(this.direction),r=wd.dot(wd)-n*n,s=e.radius*e.radius;if(r>s)return null;let o=Math.sqrt(s-r),a=n-o,l=n+o;return l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,s,o,a,l,c=1/this.direction.x,u=1/this.direction.y,f=1/this.direction.z,d=this.origin;return c>=0?(n=(e.min.x-d.x)*c,r=(e.max.x-d.x)*c):(n=(e.max.x-d.x)*c,r=(e.min.x-d.x)*c),u>=0?(s=(e.min.y-d.y)*u,o=(e.max.y-d.y)*u):(s=(e.max.y-d.y)*u,o=(e.min.y-d.y)*u),n>o||s>r||((s>n||isNaN(n))&&(n=s),(o<r||isNaN(r))&&(r=o),f>=0?(a=(e.min.z-d.z)*f,l=(e.max.z-d.z)*f):(a=(e.max.z-d.z)*f,l=(e.min.z-d.z)*f),n>l||a>r)||((a>n||n!==n)&&(n=a),(l<r||r!==r)&&(r=l),r<0)?null:this.at(n>=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,wd)!==null}intersectTriangle(e,t,n,r,s){d8.subVectors(t,e),F3.subVectors(n,e),p8.crossVectors(d8,F3);let o=this.direction.dot(p8),a;if(o>0){if(r)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Kp.subVectors(this.origin,e);let l=a*this.direction.dot(F3.crossVectors(Kp,F3));if(l<0)return null;let c=a*this.direction.dot(d8.cross(Kp));if(c<0||l+c>o)return null;let u=-a*Kp.dot(p8);return u<0?null:this.at(u/o,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},fs=class extends Ws{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new zt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Oa,this.combine=ig,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}},UY=new cn,LA=new Ld,B3=new yl,kY=new re,O3=new re,U3=new re,k3=new re,m8=new re,z3=new re,zY=new re,V3=new re,Hn=class extends lr{constructor(e=new Xn,t=new fs){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){let a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}getVertexPosition(e,t){let n=this.geometry,r=n.attributes.position,s=n.morphAttributes.position,o=n.morphTargetsRelative;t.fromBufferAttribute(r,e);let a=this.morphTargetInfluences;if(s&&a){z3.set(0,0,0);for(let l=0,c=s.length;l<c;l++){let u=a[l],f=s[l];u!==0&&(m8.fromBufferAttribute(f,e),o?z3.addScaledVector(m8,u):z3.addScaledVector(m8.sub(t),u))}t.add(z3)}return t}raycast(e,t){let n=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),B3.copy(n.boundingSphere),B3.applyMatrix4(s),LA.copy(e.ray).recast(e.near),!(B3.containsPoint(LA.origin)===!1&&(LA.intersectSphere(B3,kY)===null||LA.origin.distanceToSquared(kY)>(e.far-e.near)**2))&&(UY.copy(s).invert(),LA.copy(e.ray).applyMatrix4(UY),!(n.boundingBox!==null&&LA.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,LA)))}_computeIntersections(e,t,n){let r,s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,u=s.attributes.uv1,f=s.attributes.normal,d=s.groups,A=s.drawRange;if(a!==null)if(Array.isArray(o))for(let y=0,w=d.length;y<w;y++){let S=d[y],T=o[S.materialIndex],R=Math.max(S.start,A.start),P=Math.min(a.count,Math.min(S.start+S.count,A.start+A.count));for(let I=R,F=P;I<F;I+=3){let D=a.getX(I),L=a.getX(I+1),C=a.getX(I+2);r=G3(this,T,e,n,c,u,f,D,L,C),r&&(r.faceIndex=Math.floor(I/3),r.face.materialIndex=S.materialIndex,t.push(r))}}else{let y=Math.max(0,A.start),w=Math.min(a.count,A.start+A.count);for(let S=y,T=w;S<T;S+=3){let R=a.getX(S),P=a.getX(S+1),I=a.getX(S+2);r=G3(this,o,e,n,c,u,f,R,P,I),r&&(r.faceIndex=Math.floor(S/3),t.push(r))}}else if(l!==void 0)if(Array.isArray(o))for(let y=0,w=d.length;y<w;y++){let S=d[y],T=o[S.materialIndex],R=Math.max(S.start,A.start),P=Math.min(l.count,Math.min(S.start+S.count,A.start+A.count));for(let I=R,F=P;I<F;I+=3){let D=I,L=I+1,C=I+2;r=G3(this,T,e,n,c,u,f,D,L,C),r&&(r.faceIndex=Math.floor(I/3),r.face.materialIndex=S.materialIndex,t.push(r))}}else{let y=Math.max(0,A.start),w=Math.min(l.count,A.start+A.count);for(let S=y,T=w;S<T;S+=3){let R=S,P=S+1,I=S+2;r=G3(this,o,e,n,c,u,f,R,P,I),r&&(r.faceIndex=Math.floor(S/3),t.push(r))}}}};function Kme(i,e,t,n,r,s,o,a){let l;if(e.side===mi?l=n.intersectTriangle(o,s,r,!0,a):l=n.intersectTriangle(r,s,o,e.side===ko,a),l===null)return null;V3.copy(a),V3.applyMatrix4(i.matrixWorld);let c=t.ray.origin.distanceTo(V3);return c<t.near||c>t.far?null:{distance:c,point:V3.clone(),object:i}}function G3(i,e,t,n,r,s,o,a,l,c){i.getVertexPosition(a,O3),i.getVertexPosition(l,U3),i.getVertexPosition(c,k3);let u=Kme(i,e,t,n,O3,U3,k3,zY);if(u){let f=new re;Td.getBarycoord(zY,O3,U3,k3,f),r&&(u.uv=Td.getInterpolatedAttribute(r,a,l,c,f,new Oe)),s&&(u.uv1=Td.getInterpolatedAttribute(s,a,l,c,f,new Oe)),o&&(u.normal=Td.getInterpolatedAttribute(o,a,l,c,f,new re),u.normal.dot(n.direction)>0&&u.normal.multiplyScalar(-1));let d={a,b:l,c,normal:new re,materialIndex:0};Td.getNormal(O3,U3,k3,d.normal),u.face=d,u.barycoord=f}return u}var jA=class extends Hs{constructor(e=null,t=1,n=1,r,s,o,a,l,c=Ti,u=Ti,f,d){super(null,o,a,l,c,u,r,s,f,d),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var Kl=class extends Hi{constructor(e,t,n,r=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){let e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}};var A8=new re,Qme=new re,Jme=new Mn,Da=class{constructor(e=new re(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){let r=A8.subVectors(n,t).cross(Qme.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t,n=!0){let r=e.delta(A8),s=this.normal.dot(r);if(s===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;let o=-(e.start.dot(this.normal)+this.constant)/s;return n===!0&&(o<0||o>1)?null:t.copy(e.start).addScaledVector(r,o)}intersectsLine(e){let t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let n=t||Jme.getNormalMatrix(e),r=this.coplanarPoint(A8).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}},DA=new yl,eAe=new Oe(.5,.5),q3=new re,Gc=class{constructor(e=new Da,t=new Da,n=new Da,r=new Da,s=new Da,o=new Da){this.planes=[e,t,n,r,s,o]}set(e,t,n,r,s,o){let a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(n),a[3].copy(r),a[4].copy(s),a[5].copy(o),this}copy(e){let t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=Uo,n=!1){let r=this.planes,s=e.elements,o=s[0],a=s[1],l=s[2],c=s[3],u=s[4],f=s[5],d=s[6],A=s[7],y=s[8],w=s[9],S=s[10],T=s[11],R=s[12],P=s[13],I=s[14],F=s[15];if(r[0].setComponents(c-o,A-u,T-y,F-R).normalize(),r[1].setComponents(c+o,A+u,T+y,F+R).normalize(),r[2].setComponents(c+a,A+f,T+w,F+P).normalize(),r[3].setComponents(c-a,A-f,T-w,F-P).normalize(),n)r[4].setComponents(l,d,S,I).normalize(),r[5].setComponents(c-l,A-d,T-S,F-I).normalize();else if(r[4].setComponents(c-l,A-d,T-S,F-I).normalize(),t===Uo)r[5].setComponents(c+l,A+d,T+S,F+I).normalize();else if(t===xl)r[5].setComponents(l,d,S,I).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),DA.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),DA.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(DA)}intersectsSprite(e){DA.center.set(0,0,0);let t=eAe.distanceTo(e.center);return DA.radius=.7071067811865476+t,DA.applyMatrix4(e.matrixWorld),this.intersectsSphere(DA)}intersectsSphere(e){let t=this.planes,n=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)<r)return!1;return!0}intersectsBox(e){let t=this.planes;for(let n=0;n<6;n++){let r=t[n];if(q3.x=r.normal.x>0?e.max.x:e.min.x,q3.y=r.normal.y>0?e.max.y:e.min.y,q3.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(q3)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}},VY=new cn,D2=class i{constructor(){this.coordinateSystem=Uo,this._frustums=[],this._count=0}setFromArrayCamera(e){let t=e.cameras,n=this._frustums;for(let r=0;r<t.length;r++){let s=t[r];VY.multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse),n[r]===void 0&&(n[r]=new Gc),n[r].setFromProjectionMatrix(VY,s.coordinateSystem,s.reversedDepth)}return this._count=t.length,this}intersectsObject(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsObject(e))return!0;return!1}intersectsSprite(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsSprite(e))return!0;return!1}intersectsSphere(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsSphere(e))return!0;return!1}intersectsBox(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsBox(e))return!0;return!1}containsPoint(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].containsPoint(e))return!0;return!1}copy(e){this.coordinateSystem=e.coordinateSystem;let t=this._frustums,n=e._frustums;for(let r=0;r<e._count;r++)t[r]===void 0&&(t[r]=new Gc),t[r].copy(n[r]);return this._count=e._count,this}clone(){return new i().copy(this)}};var Pu=class extends Ws{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new zt(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}},sM=new re,oM=new re,GY=new cn,T2=new Ld,H3=new yl,g8=new re,qY=new re,a0=class extends lr{constructor(e=new Xn,t=new Pu){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[0];for(let r=1,s=t.count;r<s;r++)sM.fromBufferAttribute(t,r-1),oM.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=sM.distanceTo(oM);e.setAttribute("lineDistance",new Ln(n,1))}else Xe("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){let n=this.geometry,r=this.matrixWorld,s=e.params.Line.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),H3.copy(n.boundingSphere),H3.applyMatrix4(r),H3.radius+=s,e.ray.intersectsSphere(H3)===!1)return;GY.copy(r).invert(),T2.copy(e.ray).applyMatrix4(GY);let a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=this.isLineSegments?2:1,u=n.index,d=n.attributes.position;if(u!==null){let A=Math.max(0,o.start),y=Math.min(u.count,o.start+o.count);for(let w=A,S=y-1;w<S;w+=c){let T=u.getX(w),R=u.getX(w+1),P=W3(this,e,T2,l,T,R,w);P&&t.push(P)}if(this.isLineLoop){let w=u.getX(y-1),S=u.getX(A),T=W3(this,e,T2,l,w,S,y-1);T&&t.push(T)}}else{let A=Math.max(0,o.start),y=Math.min(d.count,o.start+o.count);for(let w=A,S=y-1;w<S;w+=c){let T=W3(this,e,T2,l,w,w+1,w);T&&t.push(T)}if(this.isLineLoop){let w=W3(this,e,T2,l,y-1,A,y-1);w&&t.push(w)}}}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){let a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}};function W3(i,e,t,n,r,s,o){let a=i.geometry.attributes.position;if(sM.fromBufferAttribute(a,r),oM.fromBufferAttribute(a,s),t.distanceSqToSegment(sM,oM,g8,qY)>n)return;g8.applyMatrix4(i.matrixWorld);let c=e.ray.origin.distanceTo(g8);if(!(c<e.near||c>e.far))return{distance:c,point:qY.clone().applyMatrix4(i.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:i}}var HY=new re,WY=new re,Jv=class extends a0{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[];for(let r=0,s=t.count;r<s;r+=2)HY.fromBufferAttribute(t,r),WY.fromBufferAttribute(t,r+1),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+HY.distanceTo(WY);e.setAttribute("lineDistance",new Ln(n,1))}else Xe("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}};var l0=class extends Ws{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new zt(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}},jY=new cn,M8=new Ld,j3=new yl,X3=new re,N2=class extends lr{constructor(e=new Xn,t=new l0){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){let n=this.geometry,r=this.matrixWorld,s=e.params.Points.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),j3.copy(n.boundingSphere),j3.applyMatrix4(r),j3.radius+=s,e.ray.intersectsSphere(j3)===!1)return;jY.copy(r).invert(),M8.copy(e.ray).applyMatrix4(jY);let a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=n.index,f=n.attributes.position;if(c!==null){let d=Math.max(0,o.start),A=Math.min(c.count,o.start+o.count);for(let y=d,w=A;y<w;y++){let S=c.getX(y);X3.fromBufferAttribute(f,S),XY(X3,S,l,r,e,t,this)}}else{let d=Math.max(0,o.start),A=Math.min(f.count,o.start+o.count);for(let y=d,w=A;y<w;y++)X3.fromBufferAttribute(f,y),XY(X3,y,l,r,e,t,this)}}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){let a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}};function XY(i,e,t,n,r,s,o){let a=M8.distanceSqToPoint(i);if(a<t){let l=new re;M8.closestPointToPoint(i,l),l.applyMatrix4(n);let c=r.ray.origin.distanceTo(l);if(c<r.near||c>r.far)return;s.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:o})}}var XA=class extends Hs{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=Ti,this.minFilter=Ti,this.generateMipmaps=!1,this.needsUpdate=!0}};var Lh=class extends Hs{constructor(e=[],t=Jl,n,r,s,o,a,l,c,u){super(e,t,n,r,s,o,a,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}};var Cs=class extends Hs{constructor(e,t,n=xi,r,s,o,a=Ti,l=Ti,c,u=Gs,f=1){if(u!==Gs&&u!==xo)throw new Error("THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat");let d={width:e,height:t,depth:f};super(d,r,s,o,a,l,u,n,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new Zv(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}},e_=class extends Cs{constructor(e,t=xi,n=Jl,r,s,o=Ti,a=Ti,l,c=Gs){let u={width:e,height:e,depth:1},f=[u,u,u,u,u,u];super(e,e,t,n,r,s,o,a,l,c),this.image=f,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}},F2=class extends Hs{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}},Lu=class i extends Xn{constructor(e=1,t=1,n=1,r=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:s,depthSegments:o};let a=this;r=Math.floor(r),s=Math.floor(s),o=Math.floor(o);let l=[],c=[],u=[],f=[],d=0,A=0;y("z","y","x",-1,-1,n,t,e,o,s,0),y("z","y","x",1,-1,n,t,-e,o,s,1),y("x","z","y",1,1,e,n,t,r,o,2),y("x","z","y",1,-1,e,n,-t,r,o,3),y("x","y","z",1,-1,e,t,n,r,s,4),y("x","y","z",-1,-1,e,t,-n,r,s,5),this.setIndex(l),this.setAttribute("position",new Ln(c,3)),this.setAttribute("normal",new Ln(u,3)),this.setAttribute("uv",new Ln(f,2));function y(w,S,T,R,P,I,F,D,L,C,B){let k=I/L,z=F/C,G=I/2,W=F/2,Y=D/2,H=L+1,$=C+1,J=0,te=0,ce=new re;for(let he=0;he<$;he++){let ve=he*z-W;for(let Re=0;Re<H;Re++){let Qe=Re*k-G;ce[w]=Qe*R,ce[S]=ve*P,ce[T]=Y,c.push(ce.x,ce.y,ce.z),ce[w]=0,ce[S]=0,ce[T]=D>0?1:-1,u.push(ce.x,ce.y,ce.z),f.push(Re/L),f.push(1-he/C),J+=1}}for(let he=0;he<C;he++)for(let ve=0;ve<L;ve++){let Re=d+ve+H*he,Qe=d+ve+H*(he+1),Fe=d+(ve+1)+H*(he+1),mt=d+(ve+1)+H*he;l.push(Re,Qe,mt),l.push(Qe,Fe,mt),te+=6}a.addGroup(A,te,B),A+=te,d+=J}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}};var t_=class i extends Xn{constructor(e=1,t=32,n=0,r=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},t=Math.max(3,t);let s=[],o=[],a=[],l=[],c=new re,u=new Oe;o.push(0,0,0),a.push(0,0,1),l.push(.5,.5);for(let f=0,d=3;f<=t;f++,d+=3){let A=n+f/t*r;c.x=e*Math.cos(A),c.y=e*Math.sin(A),o.push(c.x,c.y,c.z),a.push(0,0,1),u.x=(o[d]/e+1)/2,u.y=(o[d+1]/e+1)/2,l.push(u.x,u.y)}for(let f=1;f<=t;f++)s.push(f,f+1,0);this.setIndex(s),this.setAttribute("position",new Ln(o,3)),this.setAttribute("normal",new Ln(a,3)),this.setAttribute("uv",new Ln(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i(e.radius,e.segments,e.thetaStart,e.thetaLength)}},$A=class i extends Xn{constructor(e=1,t=1,n=1,r=32,s=1,o=!1,a=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l};let c=this;r=Math.floor(r),s=Math.floor(s);let u=[],f=[],d=[],A=[],y=0,w=[],S=n/2,T=0;R(),o===!1&&(e>0&&P(!0),t>0&&P(!1)),this.setIndex(u),this.setAttribute("position",new Ln(f,3)),this.setAttribute("normal",new Ln(d,3)),this.setAttribute("uv",new Ln(A,2));function R(){let I=new re,F=new re,D=0,L=(t-e)/n;for(let C=0;C<=s;C++){let B=[],k=C/s,z=k*(t-e)+e;for(let G=0;G<=r;G++){let W=G/r,Y=W*l+a,H=Math.sin(Y),$=Math.cos(Y);F.x=z*H,F.y=-k*n+S,F.z=z*$,f.push(F.x,F.y,F.z),I.set(H,L,$).normalize(),d.push(I.x,I.y,I.z),A.push(W,1-k),B.push(y++)}w.push(B)}for(let C=0;C<r;C++)for(let B=0;B<s;B++){let k=w[B][C],z=w[B+1][C],G=w[B+1][C+1],W=w[B][C+1];(e>0||B!==0)&&(u.push(k,z,W),D+=3),(t>0||B!==s-1)&&(u.push(z,G,W),D+=3)}c.addGroup(T,D,0),T+=D}function P(I){let F=y,D=new Oe,L=new re,C=0,B=I===!0?e:t,k=I===!0?1:-1;for(let G=1;G<=r;G++)f.push(0,S*k,0),d.push(0,k,0),A.push(.5,.5),y++;let z=y;for(let G=0;G<=r;G++){let Y=G/r*l+a,H=Math.cos(Y),$=Math.sin(Y);L.x=B*$,L.y=S*k,L.z=B*H,f.push(L.x,L.y,L.z),d.push(0,k,0),D.x=H*.5+.5,D.y=$*.5*k+.5,A.push(D.x,D.y),y++}for(let G=0;G<r;G++){let W=F+G,Y=z+G;I===!0?u.push(Y,Y+1,W):u.push(Y+1,Y,W),C+=3}c.addGroup(T,C,I===!0?1:2),T+=C}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}};var ka=class{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){Xe("Curve: .getPoint() not implemented.")}getPointAt(e,t){let n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){let t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){let t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){let e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let t=[],n,r=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)n=this.getPoint(o/e),s+=n.distanceTo(r),t.push(s),r=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){let n=this.getLengths(),r=0,s=n.length,o;t?o=t:o=e*n[s-1];let a=0,l=s-1,c;for(;a<=l;)if(r=Math.floor(a+(l-a)/2),c=n[r]-o,c<0)a=r+1;else if(c>0)l=r-1;else{l=r;break}if(r=l,n[r]===o)return r/(s-1);let u=n[r],d=n[r+1]-u,A=(o-u)/d;return(r+A)/(s-1)}getTangent(e,t){let r=e-1e-4,s=e+1e-4;r<0&&(r=0),s>1&&(s=1);let o=this.getPoint(r),a=this.getPoint(s),l=t||(o.isVector2?new Oe:new re);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,t){let n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){let n=new re,r=[],s=[],o=[],a=new re,l=new cn;for(let A=0;A<=e;A++){let y=A/e;r[A]=this.getTangentAt(y,new re)}s[0]=new re,o[0]=new re;let c=Number.MAX_VALUE,u=Math.abs(r[0].x),f=Math.abs(r[0].y),d=Math.abs(r[0].z);u<=c&&(c=u,n.set(1,0,0)),f<=c&&(c=f,n.set(0,1,0)),d<=c&&n.set(0,0,1),a.crossVectors(r[0],n).normalize(),s[0].crossVectors(r[0],a),o[0].crossVectors(r[0],s[0]);for(let A=1;A<=e;A++){if(s[A]=s[A-1].clone(),o[A]=o[A-1].clone(),a.crossVectors(r[A-1],r[A]),a.length()>Number.EPSILON){a.normalize();let y=Math.acos(Nn(r[A-1].dot(r[A]),-1,1));s[A].applyMatrix4(l.makeRotationAxis(a,y))}o[A].crossVectors(r[A],s[A])}if(t===!0){let A=Math.acos(Nn(s[0].dot(s[e]),-1,1));A/=e,r[0].dot(a.crossVectors(s[0],s[e]))>0&&(A=-A);for(let y=1;y<=e;y++)s[y].applyMatrix4(l.makeRotationAxis(r[y],A*y)),o[y].crossVectors(r[y],s[y])}return{tangents:r,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}},n_=class extends ka{constructor(e=0,t=0,n=1,r=1,s=0,o=Math.PI*2,a=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=r,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,t=new Oe){let n=t,r=Math.PI*2,s=this.aEndAngle-this.aStartAngle,o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=r;for(;s>r;)s-=r;s<Number.EPSILON&&(o?s=0:s=r),this.aClockwise===!0&&!o&&(s===r?s=-r:s=s-r);let a=this.aStartAngle+e*s,l=this.aX+this.xRadius*Math.cos(a),c=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){let u=Math.cos(this.aRotation),f=Math.sin(this.aRotation),d=l-this.aX,A=c-this.aY;l=d*u-A*f+this.aX,c=d*f+A*u+this.aY}return n.set(l,c)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){let e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}},aM=class extends n_{constructor(e,t,n,r,s,o){super(e,t,n,n,r,s,o),this.isArcCurve=!0,this.type="ArcCurve"}};function sF(){let i=0,e=0,t=0,n=0;function r(s,o,a,l){i=s,e=a,t=-3*s+3*o-2*a-l,n=2*s-2*o+a+l}return{initCatmullRom:function(s,o,a,l,c){r(o,a,c*(a-s),c*(l-o))},initNonuniformCatmullRom:function(s,o,a,l,c,u,f){let d=(o-s)/c-(a-s)/(c+u)+(a-o)/u,A=(a-o)/u-(l-o)/(u+f)+(l-a)/f;d*=u,A*=u,r(o,a,d,A)},calc:function(s){let o=s*s,a=o*s;return i+e*s+t*o+n*a}}}var $Y=new re,YY=new re,v8=new sF,_8=new sF,x8=new sF,lM=class extends ka{constructor(e=[],t=!1,n="centripetal",r=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=r}getPoint(e,t=new re){let n=t,r=this.points,s=r.length,o=(s-(this.closed?0:1))*e,a=Math.floor(o),l=o-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/s)+1)*s:l===0&&a===s-1&&(a=s-2,l=1);let c,u;this.closed||a>0?c=r[(a-1)%s]:(YY.subVectors(r[0],r[1]).add(r[0]),c=YY);let f=r[a%s],d=r[(a+1)%s];if(this.closed||a+2<s?u=r[(a+2)%s]:($Y.subVectors(r[s-1],r[s-2]).add(r[s-1]),u=$Y),this.curveType==="centripetal"||this.curveType==="chordal"){let A=this.curveType==="chordal"?.5:.25,y=Math.pow(c.distanceToSquared(f),A),w=Math.pow(f.distanceToSquared(d),A),S=Math.pow(d.distanceToSquared(u),A);w<1e-4&&(w=1),y<1e-4&&(y=w),S<1e-4&&(S=w),v8.initNonuniformCatmullRom(c.x,f.x,d.x,u.x,y,w,S),_8.initNonuniformCatmullRom(c.y,f.y,d.y,u.y,y,w,S),x8.initNonuniformCatmullRom(c.z,f.z,d.z,u.z,y,w,S)}else this.curveType==="catmullrom"&&(v8.initCatmullRom(c.x,f.x,d.x,u.x,this.tension),_8.initCatmullRom(c.y,f.y,d.y,u.y,this.tension),x8.initCatmullRom(c.z,f.z,d.z,u.z,this.tension));return n.set(v8.calc(l),_8.calc(l),x8.calc(l)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let r=e.points[t];this.points.push(r.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){let r=this.points[t];e.points.push(r.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let r=e.points[t];this.points.push(new re().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}};function ZY(i,e,t,n,r){let s=(n-e)*.5,o=(r-t)*.5,a=i*i,l=i*a;return(2*t-2*n+s+o)*l+(-3*t+3*n-2*s-o)*a+s*i+t}function tAe(i,e){let t=1-i;return t*t*e}function nAe(i,e){return 2*(1-i)*i*e}function iAe(i,e){return i*i*e}function R2(i,e,t,n){return tAe(i,e)+nAe(i,t)+iAe(i,n)}function rAe(i,e){let t=1-i;return t*t*t*e}function sAe(i,e){let t=1-i;return 3*t*t*i*e}function oAe(i,e){return 3*(1-i)*i*i*e}function aAe(i,e){return i*i*i*e}function I2(i,e,t,n,r){return rAe(i,e)+sAe(i,t)+oAe(i,n)+aAe(i,r)}var B2=class extends ka{constructor(e=new Oe,t=new Oe,n=new Oe,r=new Oe){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new Oe){let n=t,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return n.set(I2(e,r.x,s.x,o.x,a.x),I2(e,r.y,s.y,o.y,a.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}},i_=class extends ka{constructor(e=new re,t=new re,n=new re,r=new re){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new re){let n=t,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return n.set(I2(e,r.x,s.x,o.x,a.x),I2(e,r.y,s.y,o.y,a.y),I2(e,r.z,s.z,o.z,a.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}},O2=class extends ka{constructor(e=new Oe,t=new Oe){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new Oe){let n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new Oe){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},cM=class extends ka{constructor(e=new re,t=new re){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new re){let n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new re){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},U2=class extends ka{constructor(e=new Oe,t=new Oe,n=new Oe){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new Oe){let n=t,r=this.v0,s=this.v1,o=this.v2;return n.set(R2(e,r.x,s.x,o.x),R2(e,r.y,s.y,o.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},k2=class extends ka{constructor(e=new re,t=new re,n=new re){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new re){let n=t,r=this.v0,s=this.v1,o=this.v2;return n.set(R2(e,r.x,s.x,o.x),R2(e,r.y,s.y,o.y),R2(e,r.z,s.z,o.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},z2=class extends ka{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new Oe){let n=t,r=this.points,s=(r.length-1)*e,o=Math.floor(s),a=s-o,l=r[o===0?o:o-1],c=r[o],u=r[o>r.length-2?r.length-1:o+1],f=r[o>r.length-3?r.length-1:o+2];return n.set(ZY(a,l.x,c.x,u.x,f.x),ZY(a,l.y,c.y,u.y,f.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let r=e.points[t];this.points.push(r.clone())}return this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){let r=this.points[t];e.points.push(r.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let r=e.points[t];this.points.push(new Oe().fromArray(r))}return this}},uM=Object.freeze({__proto__:null,ArcCurve:aM,CatmullRomCurve3:lM,CubicBezierCurve:B2,CubicBezierCurve3:i_,EllipseCurve:n_,LineCurve:O2,LineCurve3:cM,QuadraticBezierCurve:U2,QuadraticBezierCurve3:k2,SplineCurve:z2}),hM=class extends ka{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){let e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){let n=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new uM[n](t,e))}return this}getPoint(e,t){let n=e*this.getLength(),r=this.getCurveLengths(),s=0;for(;s<r.length;){if(r[s]>=n){let o=r[s]-n,a=this.curves[s],l=a.getLength(),c=l===0?0:1-o/l;return a.getPointAt(c,t)}s++}return null}getLength(){let e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let e=[],t=0;for(let n=0,r=this.curves.length;n<r;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){let t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){let t=[],n;for(let r=0,s=this.curves;r<s.length;r++){let o=s[r],a=o.isEllipseCurve?e*2:o.isLineCurve||o.isLineCurve3?1:o.isSplineCurve?e*o.points.length:e,l=o.getPoints(a);for(let c=0;c<l.length;c++){let u=l[c];n&&n.equals(u)||(t.push(u),n=u)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){let r=e.curves[t];this.curves.push(r.clone())}return this.autoClose=e.autoClose,this}toJSON(){let e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){let r=this.curves[t];e.curves.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){let r=e.curves[t];this.curves.push(new uM[r.type]().fromJSON(r))}return this}},YA=class extends hM{constructor(e){super(),this.type="Path",this.currentPoint=new Oe,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){let n=new O2(this.currentPoint.clone(),new Oe(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,r){let s=new U2(this.currentPoint.clone(),new Oe(e,t),new Oe(n,r));return this.curves.push(s),this.currentPoint.set(n,r),this}bezierCurveTo(e,t,n,r,s,o){let a=new B2(this.currentPoint.clone(),new Oe(e,t),new Oe(n,r),new Oe(s,o));return this.curves.push(a),this.currentPoint.set(s,o),this}splineThru(e){let t=[this.currentPoint.clone()].concat(e),n=new z2(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,r,s,o){let a=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+a,t+l,n,r,s,o),this}absarc(e,t,n,r,s,o){return this.absellipse(e,t,n,n,r,s,o),this}ellipse(e,t,n,r,s,o,a,l){let c=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(e+c,t+u,n,r,s,o,a,l),this}absellipse(e,t,n,r,s,o,a,l){let c=new n_(e,t,n,r,s,o,a,l);if(this.curves.length>0){let f=c.getPoint(0);f.equals(this.currentPoint)||this.lineTo(f.x,f.y)}this.curves.push(c);let u=c.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){let e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}},V2=class extends YA{constructor(e){super(e),this.uuid=Rh(),this.type="Shape",this.holes=[]}getPointsHoles(e){let t=[];for(let n=0,r=this.holes.length;n<r;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){let r=e.holes[t];this.holes.push(r.clone())}return this}toJSON(){let e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){let r=this.holes[t];e.holes.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){let r=e.holes[t];this.holes.push(new YA().fromJSON(r))}return this}};function lAe(i,e,t=2){let n=e&&e.length,r=n?e[0]*t:i.length,s=xZ(i,0,r,t,!0),o=[];if(!s||s.next===s.prev)return o;let a,l,c;if(n&&(s=dAe(i,e,s,t)),i.length>80*t){a=i[0],l=i[1];let u=a,f=l;for(let d=t;d<r;d+=t){let A=i[d],y=i[d+1];A<a&&(a=A),y<l&&(l=y),A>u&&(u=A),y>f&&(f=y)}c=Math.max(u-a,f-l),c=c!==0?32767/c:0}return G2(s,o,t,a,l,c,0),o}function xZ(i,e,t,n,r){let s;if(r===SAe(i,e,t,n)>0)for(let o=e;o<t;o+=n)s=KY(o/n|0,i[o],i[o+1],s);else for(let o=t-n;o>=e;o-=n)s=KY(o/n|0,i[o],i[o+1],s);return s&&r_(s,s.next)&&(H2(s),s=s.next),s}function ZA(i,e){if(!i)return i;e||(e=i);let t=i,n;do if(n=!1,!t.steiner&&(r_(t,t.next)||Yr(t.prev,t,t.next)===0)){if(H2(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function G2(i,e,t,n,r,s,o){if(!i)return;!o&&s&&vAe(i,n,r,s);let a=i;for(;i.prev!==i.next;){let l=i.prev,c=i.next;if(s?uAe(i,n,r,s):cAe(i)){e.push(l.i,i.i,c.i),H2(i),i=c.next,a=c.next;continue}if(i=c,i===a){o?o===1?(i=hAe(ZA(i),e),G2(i,e,t,n,r,s,2)):o===2&&fAe(i,e,t,n,r,s):G2(ZA(i),e,t,n,r,s,1);break}}}function cAe(i){let e=i.prev,t=i,n=i.next;if(Yr(e,t,n)>=0)return!1;let r=e.x,s=t.x,o=n.x,a=e.y,l=t.y,c=n.y,u=Math.min(r,s,o),f=Math.min(a,l,c),d=Math.max(r,s,o),A=Math.max(a,l,c),y=n.next;for(;y!==e;){if(y.x>=u&&y.x<=d&&y.y>=f&&y.y<=A&&E2(r,a,s,l,o,c,y.x,y.y)&&Yr(y.prev,y,y.next)>=0)return!1;y=y.next}return!0}function uAe(i,e,t,n){let r=i.prev,s=i,o=i.next;if(Yr(r,s,o)>=0)return!1;let a=r.x,l=s.x,c=o.x,u=r.y,f=s.y,d=o.y,A=Math.min(a,l,c),y=Math.min(u,f,d),w=Math.max(a,l,c),S=Math.max(u,f,d),T=C8(A,y,e,t,n),R=C8(w,S,e,t,n),P=i.prevZ,I=i.nextZ;for(;P&&P.z>=T&&I&&I.z<=R;){if(P.x>=A&&P.x<=w&&P.y>=y&&P.y<=S&&P!==r&&P!==o&&E2(a,u,l,f,c,d,P.x,P.y)&&Yr(P.prev,P,P.next)>=0||(P=P.prevZ,I.x>=A&&I.x<=w&&I.y>=y&&I.y<=S&&I!==r&&I!==o&&E2(a,u,l,f,c,d,I.x,I.y)&&Yr(I.prev,I,I.next)>=0))return!1;I=I.nextZ}for(;P&&P.z>=T;){if(P.x>=A&&P.x<=w&&P.y>=y&&P.y<=S&&P!==r&&P!==o&&E2(a,u,l,f,c,d,P.x,P.y)&&Yr(P.prev,P,P.next)>=0)return!1;P=P.prevZ}for(;I&&I.z<=R;){if(I.x>=A&&I.x<=w&&I.y>=y&&I.y<=S&&I!==r&&I!==o&&E2(a,u,l,f,c,d,I.x,I.y)&&Yr(I.prev,I,I.next)>=0)return!1;I=I.nextZ}return!0}function hAe(i,e){let t=i;do{let n=t.prev,r=t.next.next;!r_(n,r)&&bZ(n,t,t.next,r)&&q2(n,r)&&q2(r,n)&&(e.push(n.i,t.i,r.i),H2(t),H2(t.next),t=i=r),t=t.next}while(t!==i);return ZA(t)}function fAe(i,e,t,n,r,s){let o=i;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&yAe(o,a)){let l=wZ(o,a);o=ZA(o,o.next),l=ZA(l,l.next),G2(o,e,t,n,r,s,0),G2(l,e,t,n,r,s,0);return}a=a.next}o=o.next}while(o!==i)}function dAe(i,e,t,n){let r=[];for(let s=0,o=e.length;s<o;s++){let a=e[s]*n,l=s<o-1?e[s+1]*n:i.length,c=xZ(i,a,l,n,!1);c===c.next&&(c.steiner=!0),r.push(xAe(c))}r.sort(pAe);for(let s=0;s<r.length;s++)t=mAe(r[s],t);return t}function pAe(i,e){let t=i.x-e.x;if(t===0&&(t=i.y-e.y,t===0)){let n=(i.next.y-i.y)/(i.next.x-i.x),r=(e.next.y-e.y)/(e.next.x-e.x);t=n-r}return t}function mAe(i,e){let t=AAe(i,e);if(!t)return e;let n=wZ(t,i);return ZA(n,n.next),ZA(t,t.next)}function AAe(i,e){let t=e,n=i.x,r=i.y,s=-1/0,o;if(r_(i,t))return t;do{if(r_(i,t.next))return t.next;if(r<=t.y&&r>=t.next.y&&t.next.y!==t.y){let f=t.x+(r-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(f<=n&&f>s&&(s=f,o=t.x<t.next.x?t:t.next,f===n))return o}t=t.next}while(t!==e);if(!o)return null;let a=o,l=o.x,c=o.y,u=1/0;t=o;do{if(n>=t.x&&t.x>=l&&n!==t.x&&yZ(r<c?n:s,r,l,c,r<c?s:n,r,t.x,t.y)){let f=Math.abs(r-t.y)/(n-t.x);q2(t,i)&&(f<u||f===u&&(t.x>o.x||t.x===o.x&&gAe(o,t)))&&(o=t,u=f)}t=t.next}while(t!==a);return o}function gAe(i,e){return Yr(i.prev,i,e.prev)<0&&Yr(e.next,i,i.next)<0}function vAe(i,e,t,n){let r=i;do r.z===0&&(r.z=C8(r.x,r.y,e,t,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==i);r.prevZ.nextZ=null,r.prevZ=null,_Ae(r)}function _Ae(i){let e,t=1;do{let n=i,r;i=null;let s=null;for(e=0;n;){e++;let o=n,a=0;for(let c=0;c<t&&(a++,o=o.nextZ,!!o);c++);let l=t;for(;a>0||l>0&&o;)a!==0&&(l===0||!o||n.z<=o.z)?(r=n,n=n.nextZ,a--):(r=o,o=o.nextZ,l--),s?s.nextZ=r:i=r,r.prevZ=s,s=r;n=o}s.nextZ=null,t*=2}while(e>1);return i}function C8(i,e,t,n,r){return i=(i-t)*r|0,e=(e-n)*r|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,i|e<<1}function xAe(i){let e=i,t=i;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==i);return t}function yZ(i,e,t,n,r,s,o,a){return(r-o)*(e-a)>=(i-o)*(s-a)&&(i-o)*(n-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(r-o)*(n-a)}function E2(i,e,t,n,r,s,o,a){return!(i===o&&e===a)&&yZ(i,e,t,n,r,s,o,a)}function yAe(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!bAe(i,e)&&(q2(i,e)&&q2(e,i)&&wAe(i,e)&&(Yr(i.prev,i,e.prev)||Yr(i,e.prev,e))||r_(i,e)&&Yr(i.prev,i,i.next)>0&&Yr(e.prev,e,e.next)>0)}function Yr(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function r_(i,e){return i.x===e.x&&i.y===e.y}function bZ(i,e,t,n){let r=Y3(Yr(i,e,t)),s=Y3(Yr(i,e,n)),o=Y3(Yr(t,n,i)),a=Y3(Yr(t,n,e));return!!(r!==s&&o!==a||r===0&&$3(i,t,e)||s===0&&$3(i,n,e)||o===0&&$3(t,i,n)||a===0&&$3(t,e,n))}function $3(i,e,t){return e.x<=Math.max(i.x,t.x)&&e.x>=Math.min(i.x,t.x)&&e.y<=Math.max(i.y,t.y)&&e.y>=Math.min(i.y,t.y)}function Y3(i){return i>0?1:i<0?-1:0}function bAe(i,e){let t=i;do{if(t.i!==i.i&&t.next.i!==i.i&&t.i!==e.i&&t.next.i!==e.i&&bZ(t,t.next,i,e))return!0;t=t.next}while(t!==i);return!1}function q2(i,e){return Yr(i.prev,i,i.next)<0?Yr(i,e,i.next)>=0&&Yr(i,i.prev,e)>=0:Yr(i,e,i.prev)<0||Yr(i,i.next,e)<0}function wAe(i,e){let t=i,n=!1,r=(i.x+e.x)/2,s=(i.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&r<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==i);return n}function wZ(i,e){let t=R8(i.i,i.x,i.y),n=R8(e.i,e.x,e.y),r=i.next,s=e.prev;return i.next=e,e.prev=i,t.next=r,r.prev=t,n.next=t,t.prev=n,s.next=n,n.prev=s,n}function KY(i,e,t,n){let r=R8(i,e,t);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function H2(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function R8(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function SAe(i,e,t,n){let r=0;for(let s=e,o=t-n;s<t;s+=n)r+=(i[o]-i[s])*(i[s+1]+i[o+1]),o=s;return r}var I8=class{static triangulate(e,t,n=2){return lAe(e,t,n)}},Jp=class i{static area(e){let t=e.length,n=0;for(let r=t-1,s=0;s<t;r=s++)n+=e[r].x*e[s].y-e[s].x*e[r].y;return n*.5}static isClockWise(e){return i.area(e)<0}static triangulateShape(e,t){let n=[],r=[],s=[];QY(e),JY(n,e);let o=e.length;t.forEach(QY);for(let l=0;l<t.length;l++)r.push(o),o+=t[l].length,JY(n,t[l]);let a=I8.triangulate(n,r);for(let l=0;l<a.length;l+=3)s.push(a.slice(l,l+3));return s}};function QY(i){let e=i.length;e>2&&i[e-1].equals(i[0])&&i.pop()}function JY(i,e){for(let t=0;t<e.length;t++)i.push(e[t].x),i.push(e[t].y)}var W2=class i extends Xn{constructor(e=new V2([new Oe(.5,.5),new Oe(-.5,.5),new Oe(-.5,-.5),new Oe(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];let n=this,r=[],s=[];for(let a=0,l=e.length;a<l;a++){let c=e[a];o(c)}this.setAttribute("position",new Ln(r,3)),this.setAttribute("uv",new Ln(s,2)),this.computeVertexNormals();function o(a){let l=[],c=t.curveSegments!==void 0?t.curveSegments:12,u=t.steps!==void 0?t.steps:1,f=t.depth!==void 0?t.depth:1,d=t.bevelEnabled!==void 0?t.bevelEnabled:!0,A=t.bevelThickness!==void 0?t.bevelThickness:.2,y=t.bevelSize!==void 0?t.bevelSize:A-.1,w=t.bevelOffset!==void 0?t.bevelOffset:0,S=t.bevelSegments!==void 0?t.bevelSegments:3,T=t.extrudePath,R=t.UVGenerator!==void 0?t.UVGenerator:TAe,P,I=!1,F,D,L,C;if(T){P=T.getSpacedPoints(u),I=!0,d=!1;let $e=T.isCatmullRomCurve3?T.closed:!1;F=T.computeFrenetFrames(u,$e),D=new re,L=new re,C=new re}d||(S=0,A=0,y=0,w=0);let B=a.extractPoints(c),k=B.shape,z=B.holes;if(!Jp.isClockWise(k)){k=k.reverse();for(let $e=0,ot=z.length;$e<ot;$e++){let nt=z[$e];Jp.isClockWise(nt)&&(z[$e]=nt.reverse())}}function W($e){let nt=10000000000000001e-36,bt=$e[0];for(let yt=1;yt<=$e.length;yt++){let hn=yt%$e.length,en=$e[hn],tn=en.x-bt.x,bn=en.y-bt.y,_e=tn*tn+bn*bn,vi=Math.max(Math.abs(en.x),Math.abs(en.y),Math.abs(bt.x),Math.abs(bt.y)),zn=nt*vi*vi;if(_e<=zn){$e.splice(hn,1),yt--;continue}bt=en}}W(k),z.forEach(W);let Y=z.length,H=k;for(let $e=0;$e<Y;$e++){let ot=z[$e];k=k.concat(ot)}function $($e,ot,nt){return ot||ze("ExtrudeGeometry: vec does not exist"),$e.clone().addScaledVector(ot,nt)}let J=k.length;function te($e,ot,nt){let bt,yt,hn,en=$e.x-ot.x,tn=$e.y-ot.y,bn=nt.x-$e.x,_e=nt.y-$e.y,vi=en*en+tn*tn,zn=en*_e-tn*bn;if(Math.abs(zn)>Number.EPSILON){let le=Math.sqrt(vi),Z=Math.sqrt(bn*bn+_e*_e),Te=ot.x-tn/le,Pe=ot.y+en/le,Ge=nt.x-_e/Z,vt=nt.y+bn/Z,Tt=((Ge-Te)*_e-(vt-Pe)*bn)/(en*_e-tn*bn);bt=Te+en*Tt-$e.x,yt=Pe+tn*Tt-$e.y;let qe=bt*bt+yt*yt;if(qe<=2)return new Oe(bt,yt);hn=Math.sqrt(qe/2)}else{let le=!1;en>Number.EPSILON?bn>Number.EPSILON&&(le=!0):en<-Number.EPSILON?bn<-Number.EPSILON&&(le=!0):Math.sign(tn)===Math.sign(_e)&&(le=!0),le?(bt=-tn,yt=en,hn=Math.sqrt(vi)):(bt=en,yt=tn,hn=Math.sqrt(vi/2))}return new Oe(bt/hn,yt/hn)}let ce=[];for(let $e=0,ot=H.length,nt=ot-1,bt=$e+1;$e<ot;$e++,nt++,bt++)nt===ot&&(nt=0),bt===ot&&(bt=0),ce[$e]=te(H[$e],H[nt],H[bt]);let he=[],ve,Re=ce.concat();for(let $e=0,ot=Y;$e<ot;$e++){let nt=z[$e];ve=[];for(let bt=0,yt=nt.length,hn=yt-1,en=bt+1;bt<yt;bt++,hn++,en++)hn===yt&&(hn=0),en===yt&&(en=0),ve[bt]=te(nt[bt],nt[hn],nt[en]);he.push(ve),Re=Re.concat(ve)}let Qe;if(S===0)Qe=Jp.triangulateShape(H,z);else{let $e=[],ot=[];for(let nt=0;nt<S;nt++){let bt=nt/S,yt=A*Math.cos(bt*Math.PI/2),hn=y*Math.sin(bt*Math.PI/2)+w;for(let en=0,tn=H.length;en<tn;en++){let bn=$(H[en],ce[en],hn);Mt(bn.x,bn.y,-yt),bt===0&&$e.push(bn)}for(let en=0,tn=Y;en<tn;en++){let bn=z[en];ve=he[en];let _e=[];for(let vi=0,zn=bn.length;vi<zn;vi++){let le=$(bn[vi],ve[vi],hn);Mt(le.x,le.y,-yt),bt===0&&_e.push(le)}bt===0&&ot.push(_e)}}Qe=Jp.triangulateShape($e,ot)}let Fe=Qe.length,mt=y+w;for(let $e=0;$e<J;$e++){let ot=d?$(k[$e],Re[$e],mt):k[$e];I?(L.copy(F.normals[0]).multiplyScalar(ot.x),D.copy(F.binormals[0]).multiplyScalar(ot.y),C.copy(P[0]).add(L).add(D),Mt(C.x,C.y,C.z)):Mt(ot.x,ot.y,0)}for(let $e=1;$e<=u;$e++)for(let ot=0;ot<J;ot++){let nt=d?$(k[ot],Re[ot],mt):k[ot];I?(L.copy(F.normals[$e]).multiplyScalar(nt.x),D.copy(F.binormals[$e]).multiplyScalar(nt.y),C.copy(P[$e]).add(L).add(D),Mt(C.x,C.y,C.z)):Mt(nt.x,nt.y,f/u*$e)}for(let $e=S-1;$e>=0;$e--){let ot=$e/S,nt=A*Math.cos(ot*Math.PI/2),bt=y*Math.sin(ot*Math.PI/2)+w;for(let yt=0,hn=H.length;yt<hn;yt++){let en=$(H[yt],ce[yt],bt);Mt(en.x,en.y,f+nt)}for(let yt=0,hn=z.length;yt<hn;yt++){let en=z[yt];ve=he[yt];for(let tn=0,bn=en.length;tn<bn;tn++){let _e=$(en[tn],ve[tn],bt);I?Mt(_e.x,_e.y+P[u-1].y,P[u-1].x+nt):Mt(_e.x,_e.y,f+nt)}}}Ee(),Ve();function Ee(){let $e=r.length/3;if(d){let ot=0,nt=J*ot;for(let bt=0;bt<Fe;bt++){let yt=Qe[bt];Et(yt[2]+nt,yt[1]+nt,yt[0]+nt)}ot=u+S*2,nt=J*ot;for(let bt=0;bt<Fe;bt++){let yt=Qe[bt];Et(yt[0]+nt,yt[1]+nt,yt[2]+nt)}}else{for(let ot=0;ot<Fe;ot++){let nt=Qe[ot];Et(nt[2],nt[1],nt[0])}for(let ot=0;ot<Fe;ot++){let nt=Qe[ot];Et(nt[0]+J*u,nt[1]+J*u,nt[2]+J*u)}}n.addGroup($e,r.length/3-$e,0)}function Ve(){let $e=r.length/3,ot=0;Ye(H,ot),ot+=H.length;for(let nt=0,bt=z.length;nt<bt;nt++){let yt=z[nt];Ye(yt,ot),ot+=yt.length}n.addGroup($e,r.length/3-$e,1)}function Ye($e,ot){let nt=$e.length;for(;--nt>=0;){let bt=nt,yt=nt-1;yt<0&&(yt=$e.length-1);for(let hn=0,en=u+S*2;hn<en;hn++){let tn=J*hn,bn=J*(hn+1),_e=ot+bt+tn,vi=ot+yt+tn,zn=ot+yt+bn,le=ot+bt+bn;It(_e,vi,zn,le)}}}function Mt($e,ot,nt){l.push($e),l.push(ot),l.push(nt)}function Et($e,ot,nt){dn($e),dn(ot),dn(nt);let bt=r.length/3,yt=R.generateTopUV(n,r,bt-3,bt-2,bt-1);Gt(yt[0]),Gt(yt[1]),Gt(yt[2])}function It($e,ot,nt,bt){dn($e),dn(ot),dn(bt),dn(ot),dn(nt),dn(bt);let yt=r.length/3,hn=R.generateSideWallUV(n,r,yt-6,yt-3,yt-2,yt-1);Gt(hn[0]),Gt(hn[1]),Gt(hn[3]),Gt(hn[1]),Gt(hn[2]),Gt(hn[3])}function dn($e){r.push(l[$e*3+0]),r.push(l[$e*3+1]),r.push(l[$e*3+2])}function Gt($e){s.push($e.x),s.push($e.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON(),t=this.parameters.shapes,n=this.parameters.options;return EAe(t,n,e)}static fromJSON(e,t){let n=[];for(let s=0,o=e.shapes.length;s<o;s++){let a=t[e.shapes[s]];n.push(a)}let r=e.options.extrudePath;return r!==void 0&&(e.options.extrudePath=new uM[r.type]().fromJSON(r)),new i(n,e.options)}},TAe={generateTopUV:function(i,e,t,n,r){let s=e[t*3],o=e[t*3+1],a=e[n*3],l=e[n*3+1],c=e[r*3],u=e[r*3+1];return[new Oe(s,o),new Oe(a,l),new Oe(c,u)]},generateSideWallUV:function(i,e,t,n,r,s){let o=e[t*3],a=e[t*3+1],l=e[t*3+2],c=e[n*3],u=e[n*3+1],f=e[n*3+2],d=e[r*3],A=e[r*3+1],y=e[r*3+2],w=e[s*3],S=e[s*3+1],T=e[s*3+2];return Math.abs(a-u)<Math.abs(o-c)?[new Oe(o,1-l),new Oe(c,1-f),new Oe(d,1-y),new Oe(w,1-T)]:[new Oe(a,1-l),new Oe(u,1-f),new Oe(A,1-y),new Oe(S,1-T)]}};function EAe(i,e,t){if(t.shapes=[],Array.isArray(i))for(let n=0,r=i.length;n<r;n++){let s=i[n];t.shapes.push(s.uuid)}else t.shapes.push(i.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}var KA=class i extends Xn{constructor(e=1,t=1,n=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r};let s=e/2,o=t/2,a=Math.floor(n),l=Math.floor(r),c=a+1,u=l+1,f=e/a,d=t/l,A=[],y=[],w=[],S=[];for(let T=0;T<u;T++){let R=T*d-o;for(let P=0;P<c;P++){let I=P*f-s;y.push(I,-R,0),w.push(0,0,1),S.push(P/a),S.push(1-T/l)}}for(let T=0;T<l;T++)for(let R=0;R<a;R++){let P=R+c*T,I=R+c*(T+1),F=R+1+c*(T+1),D=R+1+c*T;A.push(P,I,D),A.push(I,F,D)}this.setIndex(A),this.setAttribute("position",new Ln(y,3)),this.setAttribute("normal",new Ln(w,3)),this.setAttribute("uv",new Ln(S,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i(e.width,e.height,e.widthSegments,e.heightSegments)}};var za=class i extends Xn{constructor(e=1,t=32,n=16,r=0,s=Math.PI*2,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:s,thetaStart:o,thetaLength:a},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));let l=Math.min(o+a,Math.PI),c=0,u=[],f=new re,d=new re,A=[],y=[],w=[],S=[];for(let T=0;T<=n;T++){let R=[],P=T/n,I=o+P*a,F=e*Math.cos(I),D=Math.sqrt(e*e-F*F),L=0;T===0&&o===0?L=.5/t:T===n&&l===Math.PI&&(L=-.5/t);for(let C=0;C<=t;C++){let B=C/t,k=r+B*s;f.x=-D*Math.cos(k),f.y=F,f.z=D*Math.sin(k),y.push(f.x,f.y,f.z),d.copy(f).normalize(),w.push(d.x,d.y,d.z),S.push(B+L,1-P),R.push(c++)}u.push(R)}for(let T=0;T<n;T++)for(let R=0;R<t;R++){let P=u[T][R+1],I=u[T][R],F=u[T+1][R],D=u[T+1][R+1];(T!==0||o>0)&&A.push(P,I,D),(T!==n-1||l<Math.PI)&&A.push(I,F,D)}this.setIndex(A),this.setAttribute("position",new Ln(y,3)),this.setAttribute("normal",new Ln(w,3)),this.setAttribute("uv",new Ln(S,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}};var j2=class i extends Xn{constructor(e=new k2(new re(-1,-1,0),new re(-1,1,0),new re(1,1,0)),t=64,n=1,r=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:r,closed:s};let o=e.computeFrenetFrames(t,s);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;let a=new re,l=new re,c=new Oe,u=new re,f=[],d=[],A=[],y=[];w(),this.setIndex(y),this.setAttribute("position",new Ln(f,3)),this.setAttribute("normal",new Ln(d,3)),this.setAttribute("uv",new Ln(A,2));function w(){for(let P=0;P<t;P++)S(P);S(s===!1?t:0),R(),T()}function S(P){u=e.getPointAt(P/t,u);let I=o.normals[P],F=o.binormals[P];for(let D=0;D<=r;D++){let L=D/r*Math.PI*2,C=Math.sin(L),B=-Math.cos(L);l.x=B*I.x+C*F.x,l.y=B*I.y+C*F.y,l.z=B*I.z+C*F.z,l.normalize(),d.push(l.x,l.y,l.z),a.x=u.x+n*l.x,a.y=u.y+n*l.y,a.z=u.z+n*l.z,f.push(a.x,a.y,a.z)}}function T(){for(let P=1;P<=t;P++)for(let I=1;I<=r;I++){let F=(r+1)*(P-1)+(I-1),D=(r+1)*P+(I-1),L=(r+1)*P+I,C=(r+1)*(P-1)+I;y.push(F,D,C),y.push(D,L,C)}}function R(){for(let P=0;P<=t;P++)for(let I=0;I<=r;I++)c.x=P/t,c.y=I/r,A.push(c.x,c.y)}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new i(new uM[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}},X2=class extends Xn{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){let t=[],n=new Set,r=new re,s=new re;if(e.index!==null){let o=e.attributes.position,a=e.index,l=e.groups;l.length===0&&(l=[{start:0,count:a.count,materialIndex:0}]);for(let c=0,u=l.length;c<u;++c){let f=l[c],d=f.start,A=f.count;for(let y=d,w=d+A;y<w;y+=3)for(let S=0;S<3;S++){let T=a.getX(y+S),R=a.getX(y+(S+1)%3);r.fromBufferAttribute(o,T),s.fromBufferAttribute(o,R),eZ(r,s,n)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}}else{let o=e.attributes.position;for(let a=0,l=o.count/3;a<l;a++)for(let c=0;c<3;c++){let u=3*a+c,f=3*a+(c+1)%3;r.fromBufferAttribute(o,u),s.fromBufferAttribute(o,f),eZ(r,s,n)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new Ln(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}};function eZ(i,e,t){let n=`${i.x},${i.y},${i.z}-${e.x},${e.y},${e.z}`,r=`${e.x},${e.y},${e.z}-${i.x},${i.y},${i.z}`;return t.has(n)===!0||t.has(r)===!0?!1:(t.add(n),t.add(r),!0)}var $2=class extends Ws{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new zt(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}};function pg(i){let e={};for(let t in i){e[t]={};for(let n in i[t]){let r=i[t][n];if(tZ(r))r.isRenderTargetTexture?(Xe("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=r.clone();else if(Array.isArray(r))if(tZ(r[0])){let s=[];for(let o=0,a=r.length;o<a;o++)s[o]=r[o].clone();e[t][n]=s}else e[t][n]=r.slice();else e[t][n]=r}}return e}function ha(i){let e={};for(let t=0;t<i.length;t++){let n=pg(i[t]);for(let r in n)e[r]=n[r]}return e}function tZ(i){return i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)}function MAe(i){let e=[];for(let t=0;t<i.length;t++)e.push(i[t].clone());return e}function oF(i){let e=i.getRenderTarget();return e===null?i.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:ln.workingColorSpace}var mg={clone:pg,merge:ha},CAe=`void main() {1+(()=>{var rhe=Object.create;var RL=Object.defineProperty;var she=Object.getOwnPropertyDescriptor;var ohe=Object.getOwnPropertyNames;var ahe=Object.getPrototypeOf,lhe=Object.prototype.hasOwnProperty;var Dq=(i,e)=>()=>{try{return e||i((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}},che=(i,e)=>{for(var t in e)RL(i,t,{get:e[t],enumerable:!0})},uhe=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of ohe(e))!lhe.call(i,r)&&r!==t&&RL(i,r,{get:()=>e[r],enumerable:!(n=she(e,r))||n.enumerable});return i};var Nq=(i,e,t)=>(t=i!=null?rhe(ahe(i)):{},uhe(e||!i||!i.__esModule?RL(t,"default",{value:i,enumerable:!0}):t,i));var zq=Dq((xT,kq)=>{(function(i,e){typeof xT=="object"&&typeof kq<"u"?e(xT):typeof define=="function"&&define.amd?define(["exports"],e):e(i.bigfloat={})})(xT,(function(i){"use strict";var e=Math.pow(2,32),t=Math.pow(2,-32),n=Math.log(10)/(32*Math.log(2));function r(D){return new Array(D+1).join("0")}var s=(function(){function D(L){this.base=L,this.limbDigitsExact=Math.log(e)/Math.log(this.base),this.limbDigits=~~this.limbDigitsExact,this.limbBase=Math.pow(this.base,this.limbDigits),this.pad=r(this.limbDigits)}return D.init=function(L){return D.baseTbl[L]||(D.baseTbl[L]=new D(L))},D.baseTbl={},D})();function o(D){return D.replace(/^(-?)0+([1-9a-z]|0(\.|$))/,"$1$2").replace(/(\.|(\.[0-9a-z]*[1-9a-z]))0+$/,"$2")}function a(D,L){L===void 0&&(L=10);var C=s.init(L),B=C.pad,k=C.limbBase,z="",G="",W,Y;if(isNaN(D))return"NaN";if(D<0&&(z="-",D=-D),!isFinite(D))return z+"Inf";if(D<1)G+="0";else{var H=Math.floor(D);for(D-=H;H;)W=H%k,H=(H-W)/k,Y=W.toString(L),G=Y+G,H&&(G=B.substr(Y.length)+G)}if(D>0)for(G+=".",k!=e&&(k=L,B="");D;)D*=k,W=D>>>0,D-=W,Y=W.toString(L),G+=B.substr(Y.length)+Y;return z+G.replace(/(\.[0-9a-z]*[1-9a-z])0+$/,"$1")}var l=(function(){function D(L,C){this.limbList=[],L?this.setValue(L,C):this.setZero()}return D.prototype.clone=function(){return new D().setBig(this)},D.prototype.setZero=function(){return this.sign=1,this.fractionLen=0,this.len=0,this},D.prototype.setValue=function(L,C){return typeof L=="number"?this.setNumber(L):L instanceof D?this.setBig(L):this.setString(L.toString(),C||10)},D.prototype.setBig=function(L){var C=L.len;this.sign=L.sign,this.fractionLen=L.fractionLen,this.len=C;for(var B=0;B<C;++B)this.limbList[B]=L.limbList[B];return this},D.prototype.setNumber=function(L){L<0?(L=-L,this.sign=-1):this.sign=1;for(var C=Math.floor(L),B=L-C,k=0,z=this.limbList,G,W=0;B;)B*=e,G=B>>>0,B-=G,z[W++]=G,++k;for(var Y=0;--W>Y;)G=z[Y],z[Y++]=z[W],z[W]=G;for(W+=Y+1;C;)G=C%e,C=(C-G)/e,z[W++]=G;return this.limbList=z,this.fractionLen=k,this.len=W,this},D.prototype.parseFraction=function(L,C,B,k,z,G){for(var W=this.limbList,Y=L.length,H=k-1;H;)W[--H]=0;var $=Y-((Y-B+G-1)%G+1);for(W[k-1]=parseInt(L.substr($,Y-$),C),this.divInt(Math.pow(C,Y-$),k),Y=$;Y>B;)Y-=G,W[k-1]=parseInt(L.substr(Y,G),C),this.divInt(z,k)},D.prototype.setString=function(L,C){var B=s.init(C),k=B.limbBase,z=B.limbDigits,G=B.limbDigitsExact,W=this.limbList,Y=-1,H;for(this.sign=1;;){switch(H=L.charAt(++Y),H){case"-":this.sign=-1;case"+":case"0":continue}break}var $=(L.indexOf(".",Y)+1||L.length+1)-1;if($<L.length-1){var J=~~((L.length-$-1)/G)+1;this.parseFraction(L,C,$+1,J+1,k,z),this.fractionLen=J,this.len=J,this.trimLeast()}else this.fractionLen=0,this.len=0;var te=this.fractionLen;if($>Y){var ce=Y+($-Y+z-1)%z+1;for(++this.len,W[te]=parseInt(L.substr(Y,ce-Y),C),Y=ce;Y<$;)this.mulInt(k,W,te,te,0)&&++this.len,W[te]+=parseInt(L.substr(Y,z),C),Y+=z}return this},D.prototype.trimMost=function(){for(var L=this.limbList,C=this.fractionLen,B=this.len;B>C&&!L[B-1];)--B;this.len=B},D.prototype.trimLeast=function(){for(var L=this.limbList,C=this.fractionLen,B=0;B<C&&!L[B];)++B;B&&this.truncate(C-B)},D.prototype.mulInt=function(L,C,B,k,z){if(!L)return 0;for(var G=this.limbList,W=this.len,Y,H,$=0;B<W;)Y=G[B++],$+=L*(Y&65535),H=$&65535,$=($-H)/65536,$+=L*(Y>>>16),H|=$<<16,Y=(C[k]&z)+H>>>0,C[k++]=Y,$=$/65536>>>0,$+=(H^(Y-H^H)&~(Y^H))>>>31;return $&&(C[k]=$),$},D.prototype.mulBig=function(L,C){if(this.isZero()||L.isZero())return C.setZero();var B=L.limbList,k=L.len,z=C.limbList,G=this.len+k;for(C.len=G;G--;)z[G]=0;this.mulInt(B[0],z,0,0,0);for(var W=1;W<k;++W)this.mulInt(B[W],z,0,W,4294967295);return C.sign=this.sign*L.sign,C.fractionLen=this.fractionLen+L.fractionLen,C.trimMost(),C.trimLeast(),C},D.prototype.mul=function(L,C){if(C=C||new D,typeof L=="number"&&(L=c.setNumber(L)),C==this)throw new Error("Multiplication in place is unsupported");return this.mulBig(L,C)},D.prototype.absDeltaFrom=function(L){typeof L=="number"&&(L=c.setNumber(L));for(var C=this.limbList,B=L.limbList,k=this.len,z=L.len,G=k-this.fractionLen-(z-L.fractionLen);!G&&k&&z;)G=C[--k]-B[--z];if(G)return G;if(k)do G=C[--k];while(!G&&k);else if(z)do G=-B[--z];while(!G&&z);return G},D.prototype.isZero=function(){return this.len==0},D.prototype.getSign=function(){return this.len&&this.sign},D.prototype.deltaFrom=function(L){return typeof L=="number"&&(L=c.setNumber(L)),this.len+L.len&&(this.sign-L.sign||this.absDeltaFrom(L)*this.sign)},D.prototype.addBig=function(L,C){var B=this,k=B.fractionLen,z=k-L.fractionLen;z<0&&(z=-z,k+=z,B=L,L=this),C.sign=this.sign,C.fractionLen=k;for(var G=C.limbList,W=B.limbList,Y=L.limbList,H=0,$=0,J=0,te;H<z;)G[H]=W[H],++H;var ce=L.len;for(z=B.len-H,z>ce&&(z=ce);$<z;)J+=W[H]+Y[$++],te=J>>>0,J=J-te&&1,G[H++]=te;var he=H;for(z<ce?(z=ce,B=L,H=$,W=Y):z=B.len;H<z;)J+=W[H++],te=J>>>0,J=J-te&&1,G[he++]=te;return J&&(G[he++]=J),C.len=he,C.trimLeast(),C},D.prototype.subBig=function(L,C){var B=this;C.sign=this.sign,B.absDeltaFrom(L)<0&&(B=L,L=this,C.sign=-this.sign);var k=B.fractionLen,z=k-L.fractionLen,G=C.limbList,W=B.limbList,Y=L.limbList,H=B.len,$=L.len,J=H,te=0,ce=0,he=0,ve=0,Re;if(z>=0){for(;te<z;)G[te]=W[te],++te;z+=$,z>H&&(z=H),he=te}else{for(z=-z,k+=z,J+=z;ce<z;)ve-=Y[ce],Re=ve>>>0,ve=-(ve<0),G[ce++]=Re;z+=H,z>$&&(z=$),he=ce}for(C.fractionLen=k;he<z;)ve+=W[te++]-Y[ce++],Re=ve>>>0,ve=-(ve<0),G[he++]=Re;for(;he<J;)ve+=W[te++],Re=ve>>>0,ve=-(ve<0),G[he++]=Re;return C.len=he,C.trimMost(),C.trimLeast(),C},D.prototype.addSub=function(L,C,B){if(B=B||new D,B==this)throw new Error("Addition and subtraction in place is unsupported");return typeof L=="number"&&(L=c.setNumber(L)),this.sign*L.sign*C<0?this.subBig(L,B):this.addBig(L,B)},D.prototype.add=function(L,C){return this.addSub(L,1,C)},D.prototype.sub=function(L,C){return this.addSub(L,-1,C)},D.prototype.truncate=function(L){var C=this.fractionLen-L;if(C>0){this.fractionLen=L,this.len-=C;for(var B=this.len,k=this.limbList,z=0;z<B;++z)k[z]=k[z+C]}return this},D.prototype.round=function(L){return this.truncate(1+~~(L*n))},D.prototype.divInt=function(L,C){var B=this.limbList,k,z,G,W=0;for(B[C-1]<L&&(W=B[--C],this.len=C);C--;)k=B[C],W=W*65536+(k>>>16),z=W/L>>>0,W=W-z*L,W=W*65536+(k&65535),G=W/L>>>0,W=W-G*L,B[C]=(z<<16|G)>>>0;return W},D.prototype.fractionToString=function(L,C){var B=s.init(L),k=B.pad,z=B.limbBase,G=this.limbList,W=this.fractionLen,Y=0,H;if(L&1)throw new Error("Conversion of floating point values to odd bases is unsupported");for(;Y<W&&!G[Y];)++Y;if(!(Y>=W)){C.push(".");var $=c;for($.limbList=G.slice(Y,W),$.len=W-Y,Y=0;Y<$.len;)if($.limbList[Y]){var J=$.mulInt(z,$.limbList,Y,Y,0);H=J.toString(L),C.push(k.substr(H.length)+H)}else++Y}},D.prototype.getExpansion=function(L){for(var C=this.limbList,B=this.len,k=this.sign,z=this.fractionLen;z--;)k*=t;for(;++z<B;)L[z]=C[z]*k,k*=e;return B},D.prototype.valueOf=function(){for(var L=this.limbList,C=0,B=t*this.sign,k=this.fractionLen,z=0;z<k;)C=C*t+L[z++];for(k=this.len;z<k;)C=C*t+L[z++],B*=e;return C*B},D.prototype.toString=function(L){L===void 0&&(L=10);var C=s.init(L),B=C.pad,k=C.limbBase,z=[],G=this.limbList,W;if(k!=e){var Y=c;for(Y.limbList=G.slice(this.fractionLen,this.len),Y.len=this.len-this.fractionLen;Y.len>1;)W=Y.divInt(k,Y.len).toString(L),z.push(B.substr(W.length)+W);z.push(""+(Y.limbList[0]||0)),this.sign<0&&z.push("-"),z.reverse(),this.fractionToString(L,z)}else{var H=this.len,$=this.fractionLen;for(this.sign<0&&z.push("-"),H==$&&z.push("0");H--;)W=G[H].toString(L),H==$-1&&z.push("."),z.push(B.substr(W.length)+W)}return o(z.join(""))},D})();l.prototype.cmp=l.prototype.deltaFrom;var c=new l,u=(1<<27)+1,f=Math.log(10)/(53*Math.log(2));function d(D,L,C){var B=D+L,k=B-D,z=B-k;return C[0]=D-z+(L-k),C[1]=B,C}function A(D,L){w=D*L;var C=D*u,B=C-(C-D),k=D-B,z=L*u,G=z-(z-L),W=L-G;return k*W-(w-B*G-k*G-B*W)}var y=(function(){function D(L,C){this.limbList=[],L&&this.setValue(L,C)}return D.prototype.clone=function(){return new D().setBig(this)},D.prototype.setZero=function(){return this.len=0,this},D.prototype.setValue=function(L,C){return typeof L=="number"?this.setNumber(L):L instanceof D?this.setBig(L):this.setString(L.toString(),C||10)},D.prototype.setBig=function(L){var C=L.len;this.len=C;for(var B=0;B<C;++B)this.limbList[B]=L.limbList[B];return this},D.prototype.setNumber=function(L){return this.limbList[0]=L,this.len=L&&1,this},D.prototype.setString=function(L,C){return S[0].setValue(L,C),this.len=S[0].getExpansion(this.limbList),this.normalize(),this},D.prototype.setSum=function(L,C){return this.len=2,d(L,C,this.limbList),this},D.prototype.setProduct=function(L,C){return this.len=2,this.limbList[0]=A(L,C),this.limbList[1]=w,this},D.prototype.normalize=function(){var L=this.limbList,C=this.len,B;if(C){for(var k=C-1,z=C-1,G=L[k],W=void 0;k;)B=L[--k],W=G,G+=B,W=B-(G-W),L[z]=G,z-=W&&1,G=W||G;for(L[z]=G;++z<C;)B=L[z],W=G,G+=B,W-=G-B,L[k]=W,k+=W&&1;L[k]=G,this.len=k+(G&&1)}return this},D.prototype.mulSmall=function(L,C){var B=this.limbList,k=C.limbList,z=this.len,G,W,Y,H=0,$=0;function J(ce){k[$]=ce,$+=ce&&1}J(A(B[H++],L));for(var te=w;H<z;)G=A(B[H++],L),W=te+G,Y=W-te,J(te-(W-Y)+(G-Y)),te=w+W,J(W-(te-w));return k[$]=te,C.len=$+(te&&1),C},D.prototype.mulBig=function(L,C){var B=L.limbList,k=L.len;if(!k)return C.setZero();for(--k,this.mulSmall(B[k],k?T[k&1]:C);k;)--k,this.mulSmall(B[k],C).addBig(T[~k&1],1,k?T[k&1]:C);return C},D.prototype.mul=function(L,C){if(C=C||new D,typeof L=="number")return this.mulSmall(L,C);if(C==this)throw new Error("Cannot multiply in place");return this.mulBig(L,C)},D.prototype.isZero=function(){for(var L=this.limbList,C=this.len;C--;)if(L[C])return!1;return!0},D.prototype.getSign=function(){var L=this.len;return L&&(L=this.limbList[L-1])&&(L>0?1:-1)},D.prototype.deltaFrom=function(L){var C=this.len,B=this.getSign(),k=B;if(typeof L!="number"){if(C=L.len,k-=C&&(C=L.limbList[C-1])&&(C>0?1:-1),k||!B)return k;this.addBig(L,-1,T[0])}else{if(k-=L&&(L>0?1:-1),k||!B)return k;this.addSmall(-L,T[0])}return C=T[0].len,C&&T[0].limbList[C-1]},D.prototype.addSmall=function(L,C){for(var B=this.limbList,k=C.limbList,z=this.len,G,W,Y,H,$=0,J=0;$<z;)W=B[$++],G=W+L,Y=G-W,W-=G-Y,H=W+(L-Y),k[J]=H,J+=H&&1,L=G;return k[J]=L,C.len=J+(L&&1),C},D.prototype.addBig=function(L,C,B){var k=this.limbList,z=L.limbList,G=B.limbList,W=this.len+L.len,Y=0,H=0,$=0,J=k[Y++],te=z[H++]*C,ce=J<0?-J:J,he=te<0?-te:te,ve,Re,Qe,Fe;if(!W)return B.setZero();k[this.len]=1/0,z[L.len]=1/0;function mt(){var Ve;return ce<he?(Ve=J,J=k[Y++],ce=J<0?-J:J):(Ve=te,te=z[H++]*C,he=te<0?-te:te),Ve}for(var Ee=mt();--W;)ve=mt(),Qe=Ee,Ee+=ve,Re=Ee-Qe,Fe=Qe-(Ee-Re)+(ve-Re),G[$]=Fe,$+=Fe&&1;return G[$]=Ee,B.len=$+(Ee&&1),B},D.prototype.addSub=function(L,C,B){return B=B||new D,typeof L=="number"?this.addSmall(C*L,B):this.addBig(L,C,B)},D.prototype.add=function(L,C){return this.addSub(L,1,C)},D.prototype.sub=function(L,C){return this.addSub(L,-1,C)},D.prototype.truncate=function(L){this.normalize();for(var C=this.limbList,B=this.len,k=0,z=B,G=0,W=0;k<z;)G=k+z>>1,W=C[G],W>-1&&W<1?k=G+1:z=G;if(G&&(W<=-1||W>=1)&&(W=C[--G]),G-=L-1,G>0){this.len-=G,B=this.len;for(var Y=0;Y<B;++Y)C[Y]=C[Y+G]}return this},D.prototype.round=function(L){return this.truncate(1+~~(L*f))},D.prototype.valueOf=function(){for(var L=this.limbList,C=this.len,B=0,k=0;k<C;++k)B+=L[k];return B},D.prototype.toString=function(L){var C=this.limbList,B=this.len;for(S[B&1].setZero();B--;)S[~B&1].add(C[B],S[B&1]);return S[~B&1].toString(L)},D})();y.prototype.cmp=y.prototype.deltaFrom;var w=0,S=[new l,new l],T=[new y,new y];function R(D,L){function C(){this.constructor=D}C.prototype=L.prototype,D.prototype=new C}var P=(function(){function D(L,C,B){this.real=typeof L=="object"?L:new this.Base(L,B),this.imag=typeof C=="object"?C:new this.Base(C,B)}return D.prototype.clone=function(){var L=new this.constructor(this.real.clone(),this.imag.clone());return L},D.prototype.setZero=function(){return this.real.setZero(),this.imag.setZero(),this},D.prototype.setValue=function(L){return this.real.setValue(L.real),this.imag.setValue(L.imag),this},D.prototype.mul=function(L,C){return C=C||new this.constructor,L instanceof D?(this.real.mul(L.real,this.temp1),this.imag.mul(L.imag,this.temp2),this.temp1.sub(this.temp2,C.real),this.real.mul(L.imag,this.temp1),this.imag.mul(L.real,this.temp2),this.temp1.add(this.temp2,C.imag)):(this.real.mul(L,C.real),this.imag.mul(L,C.imag)),C},D.prototype.sqr=function(L){return L=L||new this.constructor,this.real.mul(this.real,this.temp1),this.imag.mul(this.imag,this.temp2),this.temp1.sub(this.temp2,L.real),this.real.mul(this.imag,this.temp1),this.temp1.add(this.temp1,L.imag),L},D.prototype.add=function(L,C){return C=C||new this.constructor,L instanceof D?(this.real.add(L.real,C.real),this.imag.add(L.imag,C.imag)):this.real.add(L,C.real),C},D.prototype.sub=function(L,C){return C=C||new this.constructor,L instanceof D?(this.real.sub(L.real,C.real),this.imag.sub(L.imag,C.imag)):this.real.sub(L,C.real),C},D.prototype.truncate=function(L){return this.real.truncate(L),this.imag.truncate(L),this},D})(),I=(function(D){R(L,D);function L(){return D!==null&&D.apply(this,arguments)||this}return L})(P),F=(function(D){R(L,D);function L(){return D!==null&&D.apply(this,arguments)||this}return L})(P);I.prototype.Base=l,I.prototype.temp1=new l,I.prototype.temp2=new l,F.prototype.Base=y,F.prototype.temp1=new y,F.prototype.temp2=new y,i.BigFloat32=l,i.BigFloat53=y,i.BigComplex32=I,i.BigComplex53=F,i.trimNumber=o,i.numberToString=a,Object.defineProperty(i,"__esModule",{value:!0})}))});var KJ=Dq((Cw,pO)=>{(function(i,e){typeof Cw=="object"&&typeof pO=="object"?pO.exports=e():typeof define=="function"&&define.amd?define("FrameTicker",[],e):typeof Cw=="object"?Cw.FrameTicker=e():i.FrameTicker=e()})(Cw,function(){return(function(i){function e(n){if(t[n])return t[n].exports;var r=t[n]={exports:{},id:n,loaded:!1};return i[n].call(r.exports,r,r.exports,e),r.loaded=!0,r.exports}var t={};return e.m=i,e.c=t,e.p="",e(0)})([function(i,e,t){"use strict";var n=t(1),r=(function(){function s(o,a,l){o===void 0&&(o=NaN),a===void 0&&(a=NaN),l===void 0&&(l=!1),this._minFPS=a,this._maxFPS=o,this._timeScale=1,this._currentTick=0,this._currentTime=0,this._tickDeltaTime=0,this._isRunning=!1,this._maxInterval=isNaN(this._minFPS)?NaN:1e3/this._minFPS,this._minInterval=isNaN(this._maxFPS)?NaN:1e3/this._maxFPS,this._onResume=new n.default,this._onPause=new n.default,this._onTick=new n.default,this._onTickOncePerFrame=new n.default,l||this.resume()}return s.prototype.updateOnce=function(o){o(this.currentTimeSeconds,this.tickDeltaTimeSeconds,this.currentTick)},s.prototype.resume=function(){this._isRunning||(this._isRunning=!0,this._lastTimeUpdated=this.getTimer(),this._onResume.dispatch(),this.animateOnce())},s.prototype.pause=function(){this._isRunning&&(this._isRunning=!1,this._onPause.dispatch(),window.cancelAnimationFrame(this._animationFrameHandle))},s.prototype.dispose=function(){this.pause(),this._onResume.removeAll(),this._onPause.removeAll(),this._onTick.removeAll()},Object.defineProperty(s.prototype,"currentTick",{get:function(){return this._currentTick},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"currentTimeSeconds",{get:function(){return this._currentTime/1e3},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"tickDeltaTimeSeconds",{get:function(){return this._tickDeltaTime/1e3},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"timeScale",{get:function(){return this._timeScale},set:function(o){this._timeScale!==o&&(this._timeScale=o)},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"onResume",{get:function(){return this._onResume},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"onPause",{get:function(){return this._onPause},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"onTick",{get:function(){return this._onTick},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"onTickOncePerFrame",{get:function(){return this._onTickOncePerFrame},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"isRunning",{get:function(){return this._isRunning},enumerable:!0,configurable:!0}),s.prototype.animateOnce=function(){var o=this;this._animationFrameHandle=window.requestAnimationFrame(function(){return o.onFrame()})},s.prototype.onFrame=function(){if(this._now=this.getTimer(),this._frameDeltaTime=this._now-this._lastTimeUpdated,isNaN(this._minInterval)||this._frameDeltaTime>=this._minInterval)if(isNaN(this._maxInterval))this.update(this._frameDeltaTime*this._timeScale,!0),this._lastTimeUpdated=this._now;else for(this._interval=Math.min(this._frameDeltaTime,this._maxInterval);this._now>=this._lastTimeUpdated+this._interval;)this.update(this._interval*this._timeScale,this._now<=this._lastTimeUpdated+2*this._maxInterval),this._lastTimeUpdated+=this._interval;this._isRunning&&this.animateOnce()},s.prototype.update=function(o,a){a===void 0&&(a=!0),this._currentTick++,this._currentTime+=o,this._tickDeltaTime=o,this._onTick.dispatch(this.currentTimeSeconds,this.tickDeltaTimeSeconds,this.currentTick),a&&this._onTickOncePerFrame.dispatch(this.currentTimeSeconds,this.tickDeltaTimeSeconds,this.currentTick)},s.prototype.getTimer=function(){return Date.now()},s})();Object.defineProperty(e,"__esModule",{value:!0}),e.default=r},function(i,e,t){(function(n,r){i.exports=r()})(this,function(){return(function(n){function r(o){if(s[o])return s[o].exports;var a=s[o]={exports:{},id:o,loaded:!1};return n[o].call(a.exports,a,a.exports,r),a.loaded=!0,a.exports}var s={};return r.m=n,r.c=s,r.p="",r(0)})([function(n,r){"use strict";var s=(function(){function o(){this.functions=[]}return o.prototype.add=function(a){return this.functions.indexOf(a)===-1&&(this.functions.push(a),!0)},o.prototype.remove=function(a){var l=this.functions.indexOf(a);return l>-1&&(this.functions.splice(l,1),!0)},o.prototype.removeAll=function(){return this.functions.length>0&&(this.functions.length=0,!0)},o.prototype.dispatch=function(){for(var a=[],l=0;l<arguments.length;l++)a[l]=arguments[l];var c=this.functions.concat();c.forEach(function(u){u.apply(void 0,a)})},Object.defineProperty(o.prototype,"numItems",{get:function(){return this.functions.length},enumerable:!0,configurable:!0}),o})();Object.defineProperty(r,"__esModule",{value:!0}),r.default=s}])})}])})});var Fq=i=>new Promise(e=>setTimeout(e,i)),Ss=i=>document.querySelector(i);async function hhe(){for(let i=0;i<300&&!(window.__atlasDebug&&!Ss("#map-loading")?.checkVisibility?.());i+=1)await Fq(100)}async function fhe(){let i="";for(let e=0;e<100;e+=1){await Fq(120),await new Promise(r=>requestAnimationFrame(r)),window.advanceTime?.();let t=window.__atlasDebug.snapshot(),n=JSON.stringify([t.zoom,t.center,t.resolution,t.tileStats]);if(n===i)return;i=n}}function fp(i,e={}){window.dispatchEvent(new KeyboardEvent("keydown",{key:i,bubbles:!0,cancelable:!0,...e}))}function dhe(i,e={}){window.dispatchEvent(new KeyboardEvent("keyup",{key:i,bubbles:!0,cancelable:!0,...e}))}function phe(i){Ss("#map").dispatchEvent(new KeyboardEvent("keydown",{key:i,bubbles:!0,cancelable:!0}))}function qm(i,e){i.value=e,i.dispatchEvent(new Event("change",{bubbles:!0}))}function IL(i,e){let t=Ss(i);t.value=e,t.dispatchEvent(new Event("input",{bubbles:!0}))}function PL(i,e=!1){let t=Ss("#parity-badge");t||(t=document.createElement("div"),t.id="parity-badge",t.style.cssText="position:fixed;top:8px;right:8px;z-index:9999;padding:6px 12px;font:700 13px monospace;border-radius:6px;color:#fff;pointer-events:none;",document.body.append(t)),t.style.background=e?"#b3261e":"#1a7f37",t.textContent=i}async function mhe(){let i=[],e=async d=>{await fhe(),i.push({name:d,snapshot:JSON.parse(window.render_game_to_text())})};await hhe(),localStorage.clear();let t=Ss("#volume-select"),n=t.options[0].value;qm(t,n),await e("initial"),IL("#pin-search","a"),await e("search-a");let r=Ss(".search-result");r&&(r.click(),await e("search-select-first"),Ss("#close-detail").click(),await e("detail-closed")),IL("#pin-search",""),await e("search-cleared");let s=Ss(".category-row input");s&&(s.click(),await e("category-hidden"),s.click(),await e("category-restored"));let o=Ss(".only-button");if(o){o.click(),await e("solo-first");let d=Ss("#solo-chip");d&&!d.hidden&&d.click(),await e("solo-cleared")}let a=Ss("#legend .layer-title");a&&(a.click(),await e("section-folded"),Ss("#expand-all").click(),await e("sections-unfolded")),Ss("#hide-all").click(),await e("all-hidden"),Ss("#show-all").click(),await e("all-shown");let l=Ss(".zone-index-item");l&&(l.click(),await e("zone-jumped"),l.dispatchEvent(new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0})),await e("zone-highlighted"),l.dispatchEvent(new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0})),await e("zone-unhighlighted")),fp("g"),await e("grid-open"),IL("#grid-input","m"),await e("grid-descended"),fp(" "),await e("subgrid-hidden"),fp(" "),fp("Escape"),await e("grid-ascended"),fp("Escape"),await e("grid-closed"),fp("z"),await e("labels-on"),dhe("z"),await e("labels-off"),fp("b",{metaKey:!0}),await e("sidebar-collapsed"),fp("b",{metaKey:!0}),await e("sidebar-restored"),Ss("#zoom-in").click(),await e("zoomed-in");let c=Ss("#overview-dock");c&&!Ss("#overview-shelf").hidden&&(c.click(),await e("overview-docked"),c.click(),await e("overview-undocked")),Ss("#zoom-out").click(),await e("zoomed-out"),phe("Escape"),await e("viewport-escape");let u=Ss("#lens-select");u.options.length>1&&(qm(u,u.options[1].value),await e("variant-second"),qm(u,u.options[0].value),await e("variant-first"));let f=Ss("#world-select");return f.options.length>1&&(qm(f,f.options[1].value),await e("map-second"),qm(f,f.options[0].value),await e("map-first")),t.options.length>1&&(qm(t,t.options[1].value),await e("game-second"),qm(t,n),await e("game-first")),localStorage.clear(),{viewport:[window.innerWidth,window.innerHeight],steps:i}}var LL=!1;async function Bq(){if(!LL){LL=!0,PL("parity tour running\u2026");try{let i=await mhe(),e=await fetch("/parity/result",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i,null,2)}),t=(await e.text()).trim();if(!e.ok)throw new Error(`saving failed: ${e.status} ${t}`);PL(`parity tour complete \u2713 ${i.steps.length} steps`),console.log("parity tour saved to",t)}catch(i){PL(`parity tour failed: ${i}`,!0),console.error("parity tour failed",i)}finally{LL=!1}}}window.__atlasTour=Bq;window.addEventListener("keydown",i=>{i.key==="F9"&&Bq()});var on=i=>document.querySelector(i),ge={volume:on("#volume-select"),world:on("#world-select"),lens:on("#lens-select"),lensField:on("#lens-field"),legend:on("#legend"),search:on("#pin-search"),searchResults:on("#dock-results"),dock:on("#dock"),dockCount:on("#dock-count"),dockFlag:on("#dock-flag"),dockFold:on("#dock-fold"),dockRailName:on("#dock-rail-name"),visibleCount:on("#visible-count"),viewport:on("#map"),globe:on("#globe"),globeToggle:on("#globe-toggle"),layers:on("#layers"),loading:on("#map-loading"),labelsHint:on("#labels-hint"),gridHint:on("#grid-hint"),soloChip:on("#solo-chip"),overview:on("#overview"),overviewShelf:on("#overview-shelf"),overviewDock:on("#overview-dock"),overviewCanvas:on("#overview-canvas"),overviewViewport:on("#overview-viewport"),gridNavigator:on("#grid-navigator"),gridSystem:on("#grid-system"),gridSystemName:on("#grid-system-name"),gridInput:on("#grid-input"),gridBack:on("#grid-back"),subgridToggle:on("#subgrid-toggle"),detail:on("#pin-detail"),detailTitle:on("#detail-title"),detailCategory:on("#detail-category"),detailDescription:on("#detail-description"),detailID:on("#detail-id"),detailCoordinates:on("#detail-coordinates"),detailCoordinatesField:on("#detail-coordinates-field"),detailCell:on("#detail-cell"),detailCellField:on("#detail-cell-field"),detailSource:on("#detail-source"),detailSourceField:on("#detail-source-field"),detailLinks:on("#detail-links"),detailDot:on("#detail-dot"),sidebar:on("#sidebar"),mobileLegend:on("#mobile-legend"),fatal:on("#fatal-error"),fatalMessage:on("#fatal-message"),emptyState:on("#empty-state"),emptyPath:on("#empty-path"),emptyOpen:on("#empty-open"),addBundles:on("#add-bundles")};function Hm(i,e,t,n){i.replaceChildren(),e.forEach((r,s)=>{let o=document.createElement("option");o.value=n?String(r[n]):r.slug||String(s),o.textContent=r[t],i.append(o)})}var O={catalog:null,volume:null,world:null,lens:null,engine:null,projection:null,layers:null,sources:null,hiddenCollections:new Set,collapsedSections:new Set,expandedCollections:new Set,pins:[],pinByID:new Map,selectedPin:null,selectedZone:null,hoveredPin:null,labelsHeld:!1,gridEnabled:!1,gridSystem:"geohash",globeActive:!1,subgridVisible:!0,gridCell:"",zoneRecords:new Map,highlightedZones:new Set,focusedZoneID:null,labelOverrides:new Map,search:"",fitZoom:0,zoneTitleCount:0,eligibleLocations:0,tileRun:0,tileStats:{requested:0,loaded:0,errors:0,peakPending:0},overviewRun:0,overviewKey:"",overviewPointer:null,overviewDocked:!1,dockFolded:!0,dockDismissed:!1,renderedShard:0,worldRun:0,textByWorld:new Map,restore:null,settling:!1,styleCache:new Map,markerIcons:new Map};var jf=["#4fb3d5","#c9924b","#82b56a","#c96a6a","#9581cc","#4bc9a9","#d4b04a","#6a92c9","#b08a5a","#8fb3a2"],Wm="0123456789bcdefghjkmnpqrstuvwxyz";var DL="atlas.session.v3";var Oq={light:"rgba(255, 255, 255, 0.96)",dark:"rgba(7, 9, 7, 0.98)"},Vi={labelSizePx:11,neighborLabelSizePx:10,labelInsetPx:5,labelFont:"ui-monospace, SFMono-Regular, Menlo, monospace",prefixAlpha:.55,chip:"rgba(12, 15, 22, 0.76)",neighborChip:"rgba(8, 11, 18, 0.88)",lineWhite:"#ffffff",widths:{leaf:2.5,scope:2.5,scopeBare:1.8,child:1.4,neighbor:1},childLineAlpha:.82,neighborLineAlpha:.44,leafFillAlpha:.14,childFillAlpha:.055,neighborTextAlpha:.72,dimColor:"#050810",dimBase:.3,dimStep:.06,dimCap:.52};function _T(i){let e=[...Xf()],t=!0;for(let n of i){let r=Wm.indexOf(n);if(!(r<0))for(let s of[16,8,4,2,1]){if(t){let o=(e[0]+e[2])/2;r&s?e[0]=o:e[2]=o}else{let o=(e[1]+e[3])/2;r&s?e[1]=o:e[3]=o}t=!t}}return e}function FL(i,e){let t=[...Xf()],[n,r]=i;if(n<t[0]||n>t[2]||r<t[1]||r>t[3])return"";let s=!0,o="";for(let a=0;a<e;a++){let l=0;for(let c of[16,8,4,2,1]){if(s){let u=(t[0]+t[2])/2;n>=u?(l|=c,t[0]=u):t[2]=u}else{let u=(t[1]+t[3])/2;r>=u?(l|=c,t[1]=u):t[3]=u}s=!s}o+=Wm[l]}return o}var NL={key:null,extent:null};function Ahe(i){let t=`${Xf().join(",")}|${i}`;return NL.key!==t&&(NL={key:t,extent:_T(i)}),NL.extent}var BL={slug:"geohash",name:"Geohash",short:"G",appliesTo(){return!0},maxLevel(){return 3},inputLength(){return 3},level(i){return i.length},parent(i){return i.slice(0,-1)},children(i){return[...Wm].map(e=>i+e)},childIndex(i){return Math.max(0,Wm.indexOf(i[i.length-1]))},contains(i,e){let t=Ahe(i),[n,r]=e;return n>=t[0]&&n<=t[2]&&r>=t[1]&&r<=t[3]},descendTarget(i,e){return FL(e,i.length+1)},bbox:_T,center(i){let e=_T(i);return[(e[0]+e[2])/2,(e[1]+e[3])/2]},ring(i){let[e,t,n,r]=_T(i);return[[e,t],[e,r],[n,r],[n,t],[e,t]]},poleContained(){return null},label(i){return{context:i.slice(0,-1),principal:i.slice(-1)}},colorKey(i){return Math.max(0,Wm.indexOf(i[i.length-1]))%jf.length},normalizeInput(i){return[...i.toLocaleLowerCase()].filter(e=>Wm.includes(e)).slice(0,3).join("")},parseInput(i){return i},locate(i){let e=FL(i,3);return e?{label:"Geohash",value:e}:null}};function Uq(i,e=3){return FL(i,e)}var M1=Nq(zq());function Vq(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function ay(i,e,t){if(vH())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var r=new(i.bind.apply(i,n));return t&&ly(r,t.prototype),r}function Gq(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,xhe(n.key),n)}}function ghe(i,e,t){return e&&Gq(i.prototype,e),t&&Gq(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}function Ct(i,e){var t=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t)return(t=t.call(i)).next.bind(t);if(Array.isArray(i)||(t=yhe(i))||e&&i&&typeof i.length=="number"){t&&(i=t);var n=0;return function(){return n>=i.length?{done:!0}:{done:!1,value:i[n++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.2+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ST(){return ST=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)({}).hasOwnProperty.call(t,n)&&(i[n]=t[n])}return i},ST.apply(null,arguments)}function jL(i){return jL=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},jL(i)}function dy(i,e){i.prototype=Object.create(e.prototype),i.prototype.constructor=i,ly(i,e)}function vhe(i){try{return Function.toString.call(i).indexOf("[native code]")!==-1}catch{return typeof i=="function"}}function vH(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(vH=function(){return!!i})()}function ly(i,e){return ly=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},ly(i,e)}function _he(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function xhe(i){var e=_he(i,"string");return typeof e=="symbol"?e:e+""}function yhe(i,e){if(i){if(typeof i=="string")return Vq(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Vq(i,e):void 0}}function D1(i){var e=typeof Map=="function"?new Map:void 0;return D1=function(t){if(t===null||!vhe(t))return t;if(typeof t!="function")throw new TypeError("Super expression must either be null or a function");if(e!==void 0){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return ay(t,arguments,jL(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),ly(n,t)},D1(i)}var Li=(function(){function i(t,n){this.lo=0,this.hi=0,this.lo=t,this.hi=n}var e=i.prototype;return e.isEmpty=function(){return this.lo>this.hi},e.equals=function(n){return this.lo==n.lo&&this.hi==n.hi||this.isEmpty()&&n.isEmpty()},e.center=function(){return .5*(this.lo+this.hi)},e.length=function(){return this.hi-this.lo},e.contains=function(n){return this.lo<=n&&n<=this.hi},e.containsInterval=function(n){return n.isEmpty()?!0:this.lo<=n.lo&&n.hi<=this.hi},e.interiorContains=function(n){return this.lo<n&&n<this.hi},e.interiorContainsInterval=function(n){return n.isEmpty()?!0:this.lo<n.lo&&n.hi<this.hi},e.intersects=function(n){return this.lo<=n.lo?n.lo<=this.hi&&n.lo<=n.hi:this.lo<=n.hi&&this.lo<=this.hi},e.interiorIntersects=function(n){return n.lo<this.hi&&this.lo<n.hi&&this.lo<this.hi&&n.lo<=n.hi},e.intersection=function(n){return new i(Math.max(this.lo,n.lo),Math.min(this.hi,n.hi))},e.union=function(n){return this.isEmpty()?n:n.isEmpty()?this:new i(Math.min(this.lo,n.lo),Math.max(this.hi,n.hi))},e.addPoint=function(n){return this.isEmpty()?new i(n,n):n<this.lo?new i(n,this.hi):n>this.hi?new i(this.lo,n):this},e.clampPoint=function(n){return Math.max(this.lo,Math.min(this.hi,n))},e.expanded=function(n){return this.isEmpty()?this:new i(this.lo-n,this.hi+n)},e.approxEqual=function(n,r){return r===void 0&&(r=1e-15),this.isEmpty()?n.length()<=2*r:n.isEmpty()?this.length()<=2*r:Math.abs(n.lo-this.lo)<=r&&Math.abs(n.hi-this.hi)<=r},e.directedHausdorffDistance=function(n){return this.isEmpty()?0:n.isEmpty()?1/0:Math.max(0,Math.max(this.hi-n.hi,n.lo-this.lo))},e.trunc=function(n){n===void 0&&(n=15);var r=+("1e"+n),s=function(a){return Math.round(a*r)/r};return new i(s(this.lo),s(this.hi))},e.toString=function(){var n=this.trunc(7);return"["+n.lo.toFixed(7)+", "+n.hi.toFixed(7)+"]"},i.empty=function(){return new i(1,0)},i.fromPoint=function(n){return new i(n,n)},i})();var Ci=(function(){function i(t,n){t===void 0&&(t=0),n===void 0&&(n=0),this.x=0,this.y=0,this.x=t,this.y=n}var e=i.prototype;return e.add=function(n){return new i(this.x+n.x,this.y+n.y)},e.sub=function(n){return new i(this.x-n.x,this.y-n.y)},e.mul=function(n){return new i(this.x*n,this.y*n)},e.ortho=function(){return new i(-this.y,this.x)},e.dot=function(n){return this.x*n.x+this.y*n.y},e.cross=function(n){return this.x*n.y-this.y*n.x},e.norm=function(){return Math.hypot(this.x,this.y)},e.normalize=function(){return this.x==0&&this.y==0?this:this.mul(1/this.norm())},e.trunc=function(n){n===void 0&&(n=15);var r=+("1e"+n),s=function(a){return Math.round(a*r)/r};return new i(s(this.x),s(this.y))},e.equals=function(n){return this.x===n.x&&this.y===n.y},e.toString=function(){var n=this.trunc(12);return"("+n.x.toFixed(12)+", "+n.y.toFixed(12)+")"},i})(),Hr=(function(){function i(t,n){t===void 0&&(t=new Li(0,0)),n===void 0&&(n=new Li(0,0)),this.x=t,this.y=n}var e=i.prototype;return e.isValid=function(){return this.x.isEmpty()==this.y.isEmpty()},e.isEmpty=function(){return this.x.isEmpty()},e.vertices=function(){return[new Ci(this.x.lo,this.y.lo),new Ci(this.x.hi,this.y.lo),new Ci(this.x.hi,this.y.hi),new Ci(this.x.lo,this.y.hi)]},e.vertexIJ=function(n,r){var s=this.x.lo;n==1&&(s=this.x.hi);var o=this.y.lo;return r==1&&(o=this.y.hi),new Ci(s,o)},e.lo=function(){return new Ci(this.x.lo,this.y.lo)},e.hi=function(){return new Ci(this.x.hi,this.y.hi)},e.center=function(){return new Ci(this.x.center(),this.y.center())},e.size=function(){return new Ci(this.x.length(),this.y.length())},e.containsPoint=function(n){return this.x.contains(n.x)&&this.y.contains(n.y)},e.interiorContainsPoint=function(n){return this.x.interiorContains(n.x)&&this.y.interiorContains(n.y)},e.contains=function(n){return this.x.containsInterval(n.x)&&this.y.containsInterval(n.y)},e.interiorContains=function(n){return this.x.interiorContainsInterval(n.x)&&this.y.interiorContainsInterval(n.y)},e.intersects=function(n){return this.x.intersects(n.x)&&this.y.intersects(n.y)},e.interiorIntersects=function(n){return this.x.interiorIntersects(n.x)&&this.y.interiorIntersects(n.y)},e.addPoint=function(n){return new i(this.x.addPoint(n.x),this.y.addPoint(n.y))},e.addRect=function(n){return new i(this.x.union(n.x),this.y.union(n.y))},e.clampPoint=function(n){return new Ci(this.x.clampPoint(n.x),this.y.clampPoint(n.y))},e.expanded=function(n){var r=this.x.expanded(n.x),s=this.y.expanded(n.y);return r.isEmpty()||s.isEmpty()?i.empty():new i(r,s)},e.expandedByMargin=function(n){return this.expanded(new Ci(n,n))},e.union=function(n){return new i(this.x.union(n.x),this.y.union(n.y))},e.intersection=function(n){var r=this.x.intersection(n.x),s=this.y.intersection(n.y);return r.isEmpty()||s.isEmpty()?i.empty():new i(r,s)},e.approxEqual=function(n){return this.x.approxEqual(n.x)&&this.y.approxEqual(n.y)},e.string=function(){return"["+this.lo().toString()+", "+this.hi.toString()+"]"},i.fromPoints=function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];if(r.length==0)return new i;for(var o=new i(new Li(r[0].x,r[0].x),new Li(r[0].y,r[0].y)),a=1;a<r.length;a++)o=o.addPoint(r[a]);return o},i.fromCenterSize=function(n,r){return new i(new Li(n.x-r.x/2,n.x+r.x/2),new Li(n.y-r.y/2,n.y+r.y/2))},i.fromRect=function(n){return new i(new Li(n.x.lo,n.x.hi),new Li(n.y.lo,n.y.hi))},i.empty=function(){return new i(Li.empty(),Li.empty())},i})();var Wt=(function(){function i(t,n,r){this.x=0,this.y=0,this.z=0,this.x=t,this.y=n,this.z=r}var e=i.prototype;return e.approxEqual=function(n){var r=1e-16;return Math.abs(this.x-n.x)<r&&Math.abs(this.y-n.y)<r&&Math.abs(this.z-n.z)<r},e.toString=function(){return"("+this.x.toFixed(24)+", "+this.y.toFixed(24)+", "+this.z.toFixed(24)+")"},e.norm=function(){return Math.sqrt(this.dot(this))},e.norm2=function(){return this.dot(this)},e.normalize=function(){var n=this.norm2();return n==0?new i(0,0,0):this.mul(1/Math.sqrt(n))},e.isUnit=function(){var n=5e-14;return Math.abs(this.norm2()-1)<=n},e.abs=function(){return new i(Math.abs(this.x),Math.abs(this.y),Math.abs(this.z))},e.add=function(n){return new i(this.x+n.x,this.y+n.y,this.z+n.z)},e.sub=function(n){return new i(this.x-n.x,this.y-n.y,this.z-n.z)},e.mul=function(n){return new i(n*this.x,n*this.y,n*this.z)},e.dot=function(n){return this.x*n.x+this.y*n.y+this.z*n.z||0},e.cross=function(n){return new i(this.y*n.z-this.z*n.y,this.z*n.x-this.x*n.z,this.x*n.y-this.y*n.x)},e.distance=function(n){return this.sub(n).norm()},e.angle=function(n){return Math.atan2(this.cross(n).norm(),this.dot(n))},e.ortho=function(){var n=new i(0,0,0),r=this.largestComponent();return r===i.X_AXIS?n.z=1:r===i.Y_AXIS?n.x=1:n.y=1,this.cross(n).normalize()},e.largestComponent=function(){var n=this.abs();return n.x>n.y?n.x>n.z?i.X_AXIS:i.Z_AXIS:n.y>n.z?i.Y_AXIS:i.Z_AXIS},e.smallestComponent=function(){var n=this.abs();return n.x<n.y?n.x<n.z?i.X_AXIS:i.Z_AXIS:n.y<n.z?i.Y_AXIS:i.Z_AXIS},e.equals=function(n){return this.x==n.x&&this.y==n.y&&this.z==n.z},e.cmp=function(n){return this.x<n.x?-1:this.x>n.x?1:this.y<n.y?-1:this.y>n.y?1:this.z<n.z?-1:this.z>n.z?1:0},i})();Wt.X_AXIS=0;Wt.Y_AXIS=1;Wt.Z_AXIS=2;var OL=(function(){function i(t,n,r){this.x=t,this.y=n,this.z=r}i.fromVector=function(n){return new i(new M1.BigFloat32(n.x),new M1.BigFloat32(n.y),new M1.BigFloat32(n.z))};var e=i.prototype;return e.vector=function(){return new Wt(this.x.valueOf(),this.y.valueOf(),this.z.valueOf()).normalize()},e.equals=function(n){return this.x.cmp(n.x)===0&&this.y.cmp(n.y)===0&&this.z.cmp(n.z)===0},e.toString=function(){return"("+this.x.toString()+", "+this.y.toString()+", "+this.z.toString()+")"},e.norm2=function(){return this.dot(this)},e.isUnit=function(){return this.norm2().cmp(new M1.BigFloat32(1))===0},e.abs=function(){var n=this.x.mul(this.x.getSign()),r=this.y.mul(this.y.getSign()),s=this.z.mul(this.z.getSign());return new i(n,r,s)},e.add=function(n){return new i(this.x.add(n.x),this.y.add(n.y),this.z.add(n.z))},e.sub=function(n){return new i(this.x.sub(n.x),this.y.sub(n.y),this.z.sub(n.z))},e.mul=function(n){return new i(this.x.mul(n),this.y.mul(n),this.z.mul(n))},e.mulByFloat64=function(n){return this.mul(new M1.BigFloat32(n))},e.dot=function(n){return this.x.mul(n.x).add(this.y.mul(n.y).add(this.z.mul(n.z)))},e.cross=function(n){return new i(this.y.mul(n.z).sub(this.z.mul(n.y)),this.z.mul(n.x).sub(this.x.mul(n.z)),this.x.mul(n.y).sub(this.y.mul(n.x)))},e.largestComponent=function(){var n=this.abs();return n.x.cmp(n.y)>0?n.x.cmp(n.z)>0?Wt.X_AXIS:Wt.Z_AXIS:n.y.cmp(n.z)>0?Wt.Y_AXIS:Wt.Z_AXIS},e.smallestComponent=function(){var n=this.abs();return n.x.cmp(n.y)<0?n.x.cmp(n.z)<0?Wt.X_AXIS:Wt.Z_AXIS:n.y.cmp(n.z)<0?Wt.Y_AXIS:Wt.Z_AXIS},e.isZero=function(){return this.x.isZero()&&this.y.isZero()&&this.z.isZero()},i})();var XL=Math.PI/180,dp=function(e,t){if(isNaN(e)||isNaN(t)||!isFinite(e)||t===0)return NaN;var n=e/t,r=Math.round(n);Math.abs(n-r)===.5&&(r=2*Math.round(n/2));var s=e-r*t;return s||Math.sign(e)*0},_H=function(e,t){if(isNaN(e)||isNaN(t))return NaN;if(e===t)return t;if(e===0)return t>0?Number.MIN_VALUE:-Number.MIN_VALUE;var n=new ArrayBuffer(8),r=new DataView(n);r.setFloat64(0,e,!0);var s=r.getBigUint64(0,!0);return e>0==t>e?s+=1n:s-=1n,r.setBigUint64(0,s,!0),r.getFloat64(0,!0)},bhe=function(e){var t=e&-e&0xffffffffffffffffn;if(t===0n)return 64;var n=Math.clz32(Number(t&0xffffffffn));if(n<32)return 31-n;var r=Math.clz32(Number(t>>32n&0xffffffffn));return 63-r},xH=function(e){var t=e&0xffffffffffffffffn;if(t===0n)return 64;var n=Math.clz32(Number(t>>32n&0xffffffffn));if(n<32)return 63-n;var r=Math.clz32(Number(t&0xffffffffn));return 31-r},$L=function(e,t){return e*Math.pow(2,t)},qq=function(e){return isNaN(e)?NaN:e===0?-1/0:isFinite(e)?(e=Math.abs(e),e<Number.MIN_VALUE?-1074:Math.floor(Math.log2(e))):1/0},wc=function(e){return e},yH=function(e){return e/XL||0};var whe=function(){return 1/0},She=function(e){return e==1/0};var Hq=function(e){return yH(e).toFixed(7)},Wq=function(e,t,n){return n===void 0&&(n=1e-15),Math.abs(e-t)<=n};var TT=-1,N1=2,Tc=4,hD=4,jm=1e-15,oy=2220446049e-25,bT=function(e){if(e<0)return TT;if(She(e))return Rc();var t=2*Math.sin(.5*Math.min(Math.PI,wc(e)));return t*t},YL=function(e){return e>hD?Tc:e},FT=function(e,t){return The(e)?e:Math.max(0,Math.min(hD,e+t))},ET=function(e){return e<0?-1:bH(e)?whe():2*Math.asin(.5*Math.sqrt(e))},Rc=function(){return 1/0},bH=function(e){return e==1/0},The=function(e){return e<0||bH(e)};var F1=function(e){return e>=hD?Rc():e<0?0:_H(e,10)};var fD=function(e){return 4.5*oy*e+16*oy*oy};var ny=function(e,t){return bT(ET(e)+ET(t))},Ehe=function(e,t){if(t==0)return e;if(e<=t)return 0;var n=e*(1-.25*t),r=t*(1-.25*e);return Math.max(0,n+r-2*Math.sqrt(n*r))},Mhe=function(e){return Math.sqrt(wH(e))||0},wH=function(e){return e*(1-.25*e)||0};var to=(function(){function i(t,n){this.lo=t,this.hi=n}i.fromEndpoints=function(n,r){var s=new i(n,r);return n===-Math.PI&&r!==Math.PI&&(s.lo=Math.PI),r===-Math.PI&&n!==Math.PI&&(s.hi=Math.PI),s},i.fromPointPair=function(n,r){return n===-Math.PI&&(n=Math.PI),r===-Math.PI&&(r=Math.PI),i.positiveDistance(n,r)<=Math.PI?new i(n,r):new i(r,n)},i.emptyInterval=function(){return new i(Math.PI,-Math.PI)},i.fullInterval=function(){return new i(-Math.PI,Math.PI)};var e=i.prototype;return e.isValid=function(){return Math.abs(this.lo)<=Math.PI&&Math.abs(this.hi)<=Math.PI&&!(this.lo===-Math.PI&&this.hi!==Math.PI)&&!(this.hi===-Math.PI&&this.lo!==Math.PI)},e.isFull=function(){return this.lo===-Math.PI&&this.hi===Math.PI},e.isEmpty=function(){return this.lo===Math.PI&&this.hi===-Math.PI},e.isInverted=function(){return this.lo>this.hi},e.equals=function(n){return this.lo==n.lo&&this.hi==n.hi||this.isEmpty()&&n.isEmpty()},e.invert=function(){return new i(this.hi,this.lo)},e.center=function(){var n=.5*(this.lo+this.hi);return this.isInverted()?n<=0?n+Math.PI:n-Math.PI:n},e.length=function(){var n=this.hi-this.lo;return n>=0||(n+=2*Math.PI,n>0)?n:-1},e.fastContains=function(n){return this.isInverted()?(n>=this.lo||n<=this.hi)&&!this.isEmpty():n>=this.lo&&n<=this.hi},e.contains=function(n){return n===-Math.PI&&(n=Math.PI),this.fastContains(n)},e.containsInterval=function(n){return this.isInverted()?n.isInverted()?n.lo>=this.lo&&n.hi<=this.hi:(n.lo>=this.lo||n.hi<=this.hi)&&!this.isEmpty():n.isInverted()?this.isFull()||n.isEmpty():n.lo>=this.lo&&n.hi<=this.hi},e.interiorContains=function(n){return n===-Math.PI&&(n=Math.PI),this.isInverted()?n>this.lo||n<this.hi:n>this.lo&&n<this.hi||this.isFull()},e.interiorContainsInterval=function(n){return this.isInverted()?n.isInverted()?n.lo>this.lo&&n.hi<this.hi||n.isEmpty():n.lo>this.lo||n.hi<this.hi:n.isInverted()?this.isFull()||n.isEmpty():n.lo>this.lo&&n.hi<this.hi||this.isFull()},e.intersects=function(n){return this.isEmpty()||n.isEmpty()?!1:this.isInverted()?n.isInverted()||n.lo<=this.hi||n.hi>=this.lo:n.isInverted()?n.lo<=this.hi||n.hi>=this.lo:n.lo<=this.hi&&n.hi>=this.lo},e.interiorIntersects=function(n){return this.isEmpty()||n.isEmpty()||this.lo===this.hi?!1:this.isInverted()?n.isInverted()||n.lo<this.hi||n.hi>this.lo:n.isInverted()?n.lo<this.hi||n.hi>this.lo:n.lo<this.hi&&n.hi>this.lo||this.isFull()},i.positiveDistance=function(n,r){var s=r-n;return s>=0?s:r+Math.PI-(n-Math.PI)},e.union=function(n){return n.isEmpty()?this:this.fastContains(n.lo)?this.fastContains(n.hi)?this.containsInterval(n)?this:i.fullInterval():new i(this.lo,n.hi):this.fastContains(n.hi)?new i(n.lo,this.hi):this.isEmpty()||n.fastContains(this.lo)?n:i.positiveDistance(n.hi,this.lo)<i.positiveDistance(this.hi,n.lo)?new i(n.lo,this.hi):new i(this.lo,n.hi)},e.intersection=function(n){return n.isEmpty()?i.emptyInterval():this.fastContains(n.lo)?this.fastContains(n.hi)?n.length()<this.length()?n:this:new i(n.lo,this.hi):this.fastContains(n.hi)?new i(this.lo,n.hi):n.fastContains(this.lo)?this:i.emptyInterval()},e.addPoint=function(n){return Math.abs(n)>Math.PI?this:(n===-Math.PI&&(n=Math.PI),this.fastContains(n)?this:this.isEmpty()?new i(n,n):i.positiveDistance(n,this.lo)<i.positiveDistance(this.hi,n)?new i(n,this.hi):new i(this.lo,n))},e.expanded=function(n){if(n>=0){if(this.isEmpty())return this;if(this.length()+2*n+2*oy>=2*Math.PI)return i.fullInterval()}else{if(this.isFull())return this;if(this.length()+2*n-2*oy<=0)return i.emptyInterval()}var r=i.fromEndpoints(dp(this.lo-n,2*Math.PI),dp(this.hi+n,2*Math.PI));return r.lo<=-Math.PI&&(r.lo=Math.PI),r},e.approxEqual=function(n){return this.isEmpty()?n.length()<=2*jm:n.isEmpty()?this.length()<=2*jm:this.isFull()?n.length()>=2*(Math.PI-jm):n.isFull()?this.length()>=2*(Math.PI-jm):Math.abs(dp(n.lo-this.lo,2*Math.PI))<=jm&&Math.abs(dp(n.hi-this.hi,2*Math.PI))<=jm&&Math.abs(this.length()-n.length())<=2*jm},e.toString=function(){return"["+this.lo.toFixed(7)+", "+this.hi.toFixed(7)+"]"},e.complement=function(){return this.lo===this.hi?i.fullInterval():new i(this.hi,this.lo)},e.complementCenter=function(){return this.lo!==this.hi?this.complement().center():this.hi<=0?this.hi+Math.PI:this.hi-Math.PI},e.directedHausdorffDistance=function(n){if(n.containsInterval(this))return 0;if(n.isEmpty())return Math.PI;var r=n.complementCenter();if(this.contains(r))return i.positiveDistance(n.hi,r);var s=0;i.fromEndpoints(n.hi,r).contains(this.hi)&&(s=i.positiveDistance(n.hi,this.hi));var o=0;return i.fromEndpoints(r,n.lo).contains(this.lo)&&(o=i.positiveDistance(this.lo,n.lo)),Math.max(s,o)},e.project=function(n){if(n===-Math.PI&&(n=Math.PI),this.fastContains(n))return n;var r=i.positiveDistance(n,this.lo),s=i.positiveDistance(this.hi,n);return r<s?this.lo:this.hi},i})();var ul=4,Cc=1,Yf=2,Che=[[0,1,3,2],[0,3,1,2],[2,3,1,0],[2,1,3,0]],dD=[[0,1,3,2],[0,2,3,1],[3,2,0,1],[3,1,0,2]],R1=[Cc,0,0,Yf|Cc],SH=[],TH=[];pp(0,0,0,0,0,0);pp(0,0,0,Cc,0,Cc);pp(0,0,0,Yf,0,Yf);pp(0,0,0,Cc|Yf,0,Cc|Yf);function pp(i,e,t,n,r,s){if(i==ul){var o=(e<<ul)+t;TH[(o<<2)+n]=(r<<2)+s,SH[(r<<2)+n]=(o<<2)+s;return}i++,e<<=1,t<<=1,r<<=2;var a=dD[s];pp(i,e+(a[0]>>1),t+(a[0]&1),n,r,s^R1[0]),pp(i,e+(a[1]>>1),t+(a[1]&1),n,r+1,s^R1[1]),pp(i,e+(a[2]>>1),t+(a[2]&1),n,r+2,s^R1[2]),pp(i,e+(a[3]>>1),t+(a[3]&1),n,r+3,s^R1[3])}var Rhe=3,EH=6,_i=30,py=2*_i+1,hl=Number(1n<<BigInt(_i)),gp=BigInt(EH)<<BigInt(py),jq=Number(BigInt(hl)<<1n),mp=function(e){return e>jq?1:e/jq},Ec=function(e){return e>=.5?1/3*(4*e*e-1):1/3*(1-4*(1-e)*(1-e))},ah=function(e){return e>=0?.5*Math.sqrt(1+3*e):1-.5*Math.sqrt(1-3*e)},cy=function(e){var t=e.largestComponent();switch(t){case Wt.X_AXIS:e.x<0&&(t+=3);break;case Wt.Y_AXIS:e.y<0&&(t+=3);break;case Wt.Z_AXIS:e.z<0&&(t+=3);break}return t},Ym=function(e,t){switch(e){case 0:return[t.y/t.x,t.z/t.x];case 1:return[-t.x/t.y,t.z/t.y];case 2:return[-t.x/t.z,-t.y/t.z];case 3:return[t.z/t.x,t.y/t.x];case 4:return[t.z/t.y,-t.x/t.y];default:return[-t.y/t.z,-t.x/t.z]}},MT=function(e){var t=cy(e),n=Ym(t,e),r=n[0],s=n[1];return[t,r,s]},lh=function(e,t,n){switch(e){case 0:return new Wt(1,t,n);case 1:return new Wt(-t,1,n);case 2:return new Wt(-t,-n,1);case 3:return new Wt(-1,-n,-t);case 4:return new Wt(n,-1,-t);default:return new Wt(n,t,-1)}},Ihe=function(e,t){switch(e){case 0:if(t.x<=0)return[0,0,!1];break;case 1:if(t.y<=0)return[0,0,!1];break;case 2:if(t.z<=0)return[0,0,!1];break;case 3:if(t.x>=0)return[0,0,!1];break;case 4:if(t.y>=0)return[0,0,!1];break;default:if(t.z>=0)return[0,0,!1];break}var n=Ym(e,t),r=n[0],s=n[1];return[r,s,!0]},vp=function(e,t){switch(e){case 0:return new Wt(t.y,t.z,t.x);case 1:return new Wt(-t.x,t.z,t.y);case 2:return new Wt(-t.x,-t.y,t.z);case 3:return new Wt(-t.z,-t.y,-t.x);case 4:return new Wt(-t.z,t.x,-t.y);default:return new Wt(t.y,t.x,-t.z)}},wT=function(e,t,n){return lh(e,Ec(mp(t)),Ec(mp(n)))},Xq=function(e,t){switch(e){case 0:return new Wt(t,-1,0);case 1:return new Wt(1,t,0);case 2:return new Wt(1,0,t);case 3:return new Wt(-t,0,1);case 4:return new Wt(0,-t,1);default:return new Wt(0,-1,-t)}},$q=function(e,t){switch(e){case 0:return new Wt(-t,0,1);case 1:return new Wt(0,-t,1);case 2:return new Wt(0,-1,-t);case 3:return new Wt(t,-1,0);case 4:return new Wt(1,t,0);default:return new Wt(1,0,t)}},Phe=[[new Wt(0,1,0),new Wt(0,0,1),new Wt(1,0,0)],[new Wt(-1,0,0),new Wt(0,0,1),new Wt(0,1,0)],[new Wt(-1,0,0),new Wt(0,-1,0),new Wt(0,0,1)],[new Wt(0,0,-1),new Wt(0,-1,0),new Wt(-1,0,0)],[new Wt(0,0,-1),new Wt(1,0,0),new Wt(0,-1,0)],[new Wt(0,1,0),new Wt(1,0,0),new Wt(0,0,-1)]],Lhe=[[[4,1],[5,2],[3,0]],[[0,3],[5,2],[4,1]],[[0,3],[1,4],[5,2]],[[2,5],[1,4],[0,3]],[[2,5],[3,0],[1,4]],[[4,1],[3,0],[2,5]]],MH=function(e,t){return Phe[e][t]},CT=function(e,t,n){return Lhe[e][t][n]},Dhe=function(e){return MH(e,0)},Nhe=function(e){return MH(e,1)},ZL=Math.PI/2,Yq=-ZL,ar=(function(){function i(t,n){this.lat=t,this.lng=n}i.fromDegrees=function(n,r){return new i(n*XL,r*XL)},i.latitude=function(n){var r=n.vector;return Math.atan2(r.z,Math.sqrt(r.x*r.x+r.y*r.y))},i.longitude=function(n){return Math.atan2(n.vector.y,n.vector.x)},i.fromPoint=function(n){return new i(this.latitude(n),this.longitude(n))};var e=i.prototype;return e.isValid=function(){return Math.abs(this.lat)<=Math.PI/2&&Math.abs(this.lng)<=Math.PI},e.normalized=function(){var n=this.lat;n>ZL?n=ZL:n<Yq&&(n=Yq);var r=dp(this.lng,2*Math.PI);return new i(n,r)},e.toString=function(){return"["+Hq(this.lat)+", "+Hq(this.lng)+"]"},e.distance=function(n){var r=Math.sin(.5*(n.lat-this.lat)),s=Math.sin(.5*(n.lng-this.lng)),o=r*r+s*s*Math.cos(this.lat)*Math.cos(n.lat);return 2*Math.atan2(Math.sqrt(o),Math.sqrt(Math.max(0,1-o)))},e.approxEqual=function(n){return Wq(this.lat,n.lat)&&Wq(this.lng,n.lng)},i})(),Fhe=function(e,t){return new We(e[0][t],e[1][t],e[2][t])},UL=function(e,t,n){return e[0][t]=n.x,e[1][t]=n.y,e[2][t]=n.z,e},CH=function(e,t){return new We(e[0][0]*t.x+e[0][1]*t.y+e[0][2]*t.z,e[1][0]*t.x+e[1][1]*t.y+e[1][2]*t.z,e[2][0]*t.x+e[2][1]*t.y+e[2][2]*t.z)},Bhe=function(e){return[[e[0][0],e[1][0],e[2][0]],[e[0][1],e[1][1],e[2][1]],[e[0][2],e[1][2],e[2][2]]]},pD=function(e){var t=[[0,0,0],[0,0,0],[0,0,0]];return UL(t,2,e),UL(t,1,We.ortho(e)),UL(t,0,We.fromVector(Fhe(t,1).vector.cross(e.vector))),t},Ohe=function(e,t){return CH(Bhe(e),t)},Uhe=function(e,t){return CH(e,t)},RT=-1,$f=0,k1=1,RH=1e-15,Ki=2220446049250313e-31,Zq=1.8274*Ki,khe=3.2321*Ki,KL=function(e,t,n){return n.vector.cross(e.vector).dot(t.vector)>0},Xm=function(e,t,n){var r=QL(e,t,n);return r===$f&&(r=JL(e,t,n)),r},zhe=function(e,t,n){var r=t.vector.sub(e.vector),s=r.norm2(),o=n.vector.sub(t.vector),a=o.norm2(),l=e.vector.sub(n.vector),c=l.norm2(),u,f,d;s>=a&&s>=c?(u=l,f=o,d=n.vector):a>=c?(u=r,f=l,d=e.vector):(u=o,f=r,d=t.vector);var A=-u.cross(f).dot(d),y=khe*Math.sqrt(u.norm2()*f.norm2());return A>y?k1:A<-y?RT:$f},QL=function(e,t,n){var r=e.vector.cross(t.vector).dot(n.vector);return r>Zq?k1:r<-Zq?RT:$f},JL=function(e,t,n){if(e.equals(t)||t.equals(n)||n.equals(e))return $f;var r=zhe(e,t,n);return r!==$f?r:Vhe(e,t,n,!0)},Vhe=function(e,t,n,r){var s=k1,o=e,a=t,l=n;if(o.vector.cmp(a.vector)>0){var c=[a,o];o=c[0],a=c[1],s=-s}if(a.vector.cmp(l.vector)>0){var u=[l,a];a=u[0],l=u[1],s=-s}if(o.vector.cmp(a.vector)>0){var f=[a,o];o=f[0],a=f[1],s=-s}var d=OL.fromVector(o.vector),A=OL.fromVector(a.vector),y=OL.fromVector(l.vector),w=A.cross(y),S=d.dot(w),T=S.getSign();return T===$f&&r&&(T=Ghe(d,A,y,w)),s*T},Ghe=function(e,t,n,r){var s=r.z.getSign();return s!==0||(s=r.y.getSign(),s!==0)||(s=r.x.getSign(),s!==0)||(s=n.x.mul(e.y).sub(n.y.mul(e.x)).getSign(),s!==0)||(s=n.x.getSign(),s!==0)||(s=-n.y.getSign(),s!==0)||(s=n.z.mul(e.x).sub(n.x.mul(e.z)).getSign(),s!==0)||(s=n.z.getSign(),s!==0)||(s=e.x.mul(t.y).sub(e.y.mul(t.x)).getSign(),s!==0)||(s=-t.x.getSign(),s!==0)||(s=t.y.getSign(),s!==0)||(s=e.x.getSign(),s!==0)?s:k1},We=(function(){function i(t,n,r){this.vector=new Wt(t,n,r)}i.fromVector=function(n){return new i(n.x,n.y,n.z)},i.fromLatLng=function(n){var r=n.lat,s=n.lng,o=Math.cos(r);return new i(Math.cos(s)*o,Math.sin(s)*o,Math.sin(r))},i.fromCoords=function(n,r,s){return n===0&&r===0&&s===0?this.originPoint():i.fromVector(new Wt(n,r,s).normalize())},i.originPoint=function(){return new i(-.00999946643502502,.002592454260932412,.999946643502502)};var e=i.prototype;return e.pointCross=function(n){var r=this.vector.add(n.vector).cross(n.vector.sub(this.vector));return r.x===0&&r.y===0&&r.z===0&&(r=this.vector.ortho()),i.fromVector(r)},i.orderedCCW=function(n,r,s,o){var a=0;return Xm(r,o,n)!==RT&&a++,Xm(s,o,r)!==RT&&a++,Xm(n,o,s)===k1&&a++,a>=2},e.distance=function(n){return this.vector.angle(n.vector)},e.equals=function(n){return this.vector.equals(n.vector)},e.approxEqual=function(n,r){return r===void 0&&(r=RH),this.vector.angle(n.vector)<=r},e.stableAngle=function(n){return 2*Math.atan2(this.vector.sub(n.vector).norm(),this.vector.add(n.vector).norm())},i.chordAngleBetweenPoints=function(n,r){return Math.min(4,n.vector.sub(r.vector).norm2())},i.regularPoints=function(n,r,s){return this.regularPointsForFrame(pD(n),r,s)},i.regularPointsForFrame=function(n,r,s){for(var o=Math.cos(r),a=Math.sin(r),l=2*Math.PI/s,c=[],u=0;u<s;u++){var f=u*l,d=new i(a*Math.cos(f),a*Math.sin(f),o);c.push(i.fromVector(Uhe(n,d).vector.normalize()))}return c},e.containsCell=function(n){return!1},e.intersectsCell=function(n){return n.containsPoint(this)},e.containsPoint=function(n){return this.contains(n)},e.cellUnionBound=function(){return[V1(this)]},e.contains=function(n){return this.equals(n)},e.referenceDir=function(){return i.ortho(this)},e.toString=function(){return this.vector.toString()},i.ortho=function(n){var r=n.vector.largestComponent(),s=new Wt(.012,.0053,.00457);return r===Wt.X_AXIS?s.z=1:r===Wt.Y_AXIS?s.x=1:s.y=1,i.fromVector(n.vector.cross(s).normalize())},i.sortPoints=function(n){n.sort(function(r,s){return r.vector.cmp(s.vector)})},ghe(i,[{key:"x",get:function(){return this.vector.x}},{key:"y",get:function(){return this.vector.y}},{key:"z",get:function(){return this.vector.z}}])})(),IT=function(e,t,n){return e<t?t:e>n?n:e},qhe=function(e){for(var t=e,n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];for(var o=0,a=r;o<a.length;o++){var l=a[o];l>t&&(t=l)}return t},Hhe=function(e){for(var t=e,n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];for(var o=0,a=r;o<a.length;o++){var l=a[o];l<t&&(t=l)}return t},Whe=function(e){return e<0n?-e:e},eD=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return qhe.apply(void 0,[e].concat(n))},kL=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return Hhe.apply(void 0,[e].concat(n))},tD=function(e,t){for(var n=0,r=e;n<r;){var s=Math.floor((n+r)/2);t(s)?r=s:n=s+1}return n},fl=(1n<<64n)-1n,du=function(e){return Number(e>>BigInt(py))},jhe=function(e){return e&fl>>BigInt(Rhe)},no=function(e){return _i-(bhe(e)>>>1)},Sr=function(e,t){var n=Zm(t);return e&-n|n},mD=function(e){var t=as(e)<<2n;return e&-t|t},my=function(e){return(e&Zm(0)-1n)===0n},uy=function(e){return typeof e!="bigint"||BigInt.asUintN(64,e)!=e?!1:du(e)<=EH&&(as(e)&0x1555555555555555n)!=0n},AD=function(e){return(e&1n)!=0n},IH=function(e,t){return Number(e>>2n*BigInt(_i-t)+1n)&3},as=function(e){return e&-e},Zm=function(e){return 1n<<BigInt(2*(_i-e))},z1=function(e){var t=[e,e,e,e],n=as(e);return t[0]=e-n+(n>>2n),n>>=1n,t[1]=t[0]+n,t[2]=t[1]+n,t[3]=t[2]+n,t},PH=function(e,t){var n=[],r=wp(e),s=r.f,o=r.i,a=r.j,l=Ca(no(e));o&=-l,a&=-l;for(var c=Ca(t),u=-c;;u+=c){var f=void 0;if(u<0?f=a+u>=0:u>=l?f=a+u<hl:(f=!0,n.push(Sr(Ap(s,o+u,a-c,a-l>=0),t)),n.push(Sr(Ap(s,o+u,a+l,a+l<hl),t))),n.push(Sr(Ap(s,o-c,a+u,f&&o-l>=0),t)),n.push(Sr(Ap(s,o+l,a+u,f&&o+l<hl),t)),u>=l)break}return n},qi=function(e){return e-(as(e)-1n)},Gi=function(e){return e+(as(e)-1n)},$m=function(e,t){return qi(e)<=t&&t<=Gi(e)},LH=function(e,t){return qi(t)<=Gi(e)&&Gi(t)>=qi(e)},Xhe=function(e){var t=e.toString(16).padStart(16,"0").replace(/0+$/,"");return t.length===0?"X":t},$he=function(e){if(e.length>16||!/^[A-F0-9]+$/i.test(e))return 0n;var t=BigInt("0x"+e);return e.length<16&&(t=t<<BigInt(4*(16-e.length))),t},Yhe=function(e){if(!uy(e))return"Invalid: "+e.toString(16);for(var t=du(e)+"/",n=1;n<=no(e);n++)t+=IH(e,n);return t},Zhe=function(e){var t=e.length-2;if(t<0||t>_i)return 0n;var n=parseInt(e[0],10);if(isNaN(n)||n<0||n>5||e[1]!=="/")return 0n;for(var r=xp(n),s=2;s<e.length;s++){var o=parseInt(e[s],10);if(isNaN(o)||o<0||o>3)return 0n;r=z1(r)[o]}return r},Khe=function(e,t,n){return Sr((BigInt(e)<<BigInt(py))+(t||1n),n)},xp=function(e){return(BigInt(e)<<BigInt(py))+Zm(0)},V1=function(e){var t=MT(e.vector),n=t[0],r=t[1],s=t[2],o=zl(ah(r)),a=zl(ah(s));return Ay(n,o,a)},DH=function(e){return V1(We.fromLatLng(e))},zl=function(e){return IT(Math.floor(hl*e),0,hl-1)},Ca=function(e){return 1<<IT(_i-e,0,_i)},NH=function(e){return I1(Ca(e))},I1=function(e){return e/hl},FH=function(e){var t=gD(e),n=t.si,r=t.ti;return new Ci(Ec(mp(n)),Ec(mp(r)))},Qhe=function(e){var t=wp(e),n=t.i,r=t.j;return BT(n,r,no(e))},Ay=function(e,t,n){for(var r=BigInt(e)<<BigInt(py-1),s=e&Cc,o=7;o>=0;o--){var a=(1<<ul)-1;s+=(t>>o*ul&a)<<ul+2,s+=(n>>o*ul&a)<<2,s=TH[s],r|=BigInt(s>>2)<<BigInt(o*2*ul),s&=Cc|Yf}return r*2n+1n},P1=function(e,t,n){t=IT(t,-1,hl),n=IT(n,-1,hl);var r=1/hl,s=_H(1,2),o=Math.max(-s,Math.min(s,r*(Number(BigInt(t)<<1n)+1-hl))),a=Math.max(-s,Math.min(s,r*(Number(BigInt(n)<<1n)+1-hl))),l=MT(lh(e,o,a));return e=l[0],o=l[1],a=l[2],Ay(e,zl(.5*(o+1)),zl(.5*(a+1)))},Ap=function(e,t,n,r){return r?Ay(e,t,n):P1(e,t,n)},wp=function(e){for(var t=du(e),n=t&Cc,r=_i-7*ul,s=0,o=0,a=7;a>=0;a--)n+=Number((e>>BigInt(a*2*ul+1)&(1n<<BigInt(2*r))-1n)<<2n),n=SH[n],s+=n>>ul+2<<a*ul,o+=(n>>2&(1<<ul)-1)<<a*ul,n&=Cc|Yf,r=ul;return(as(e)&BigInt("0x1111111111111110"))!=0n&&(n^=Cc),{f:t,i:s,j:o,orientation:n}},gD=function(e){var t=wp(e),n=t.f,r=t.i,s=t.j,o=0;return AD(e)?o=1:((BigInt(r)^e>>2n)&1n)!=0n&&(o=2),{face:n,si:2*r+o,ti:2*s+o}},BT=function(e,t,n){var r=Ca(n),s=e&-r,o=t&-r;return new Hr(new Li(Ec(I1(s)),Ec(I1(s+r))),new Li(Ec(I1(o)),Ec(I1(o+r))))},Jhe=function(e){return e>>2n*BigInt(_i-no(e))+1n},gy=function(e){var t=gD(e),n=t.face,r=t.si,s=t.ti;return wT(n,r,s)},vD=function(e){return We.fromVector(gy(e).normalize())},efe=function(e){return ar.fromPoint(We.fromVector(gy(e)))},tfe=function(e){var t=no(e),n=Ca(t),r=wp(e),s=r.f,o=r.i,a=r.j;return[Sr(P1(s,o,a-n),t),Sr(P1(s,o+n,a),t),Sr(P1(s,o,a+n),t),Sr(P1(s,o-n,a),t)]},BH=function(e,t){var n=Ca(t+1),r=n<<1,s=wp(e),o=s.f,a=s.i,l=s.j,c=!1,u=!1,f=0,d=0;(a&n)!=0?(f=r,c=a+r<hl):(f=-r,c=a-r>=0),(l&n)!=0?(d=r,u=l+r<hl):(d=-r,u=l-r>=0);var A=[Sr(e,t),Sr(Ap(o,a+f,l,c),t),Sr(Ap(o,a,l+d,u),t)];return(c||u)&&A.push(Sr(Ap(o,a+f,l+d,c&&u),t)),A},_D=function(e){var t=as(e);return e-t+(t>>2n)},vy=function(e,t){return e-as(e)+Zm(t)},OH=function(e){var t=as(e);return e+t+(t>>2n)},OT=function(e,t){return e+as(e)+Zm(t)},Ia=function(e){return e+(as(e)<<1n)&fl},UH=function(e){return e-(as(e)<<1n)&fl},nfe=function(e){var t=Ia(e);return t<gp?t:t-gp&fl},ife=function(e){var t=UH(e);return t<gp?t:t+gp&fl},rfe=function(e,t){if(t===0n)return e;var n=BigInt(2*(_i-no(e))+1);if(t<0n){var r=-(e>>n);if(t<r){var s=gp>>n;t%=s,t<r&&(t+=s)}}else{var o=gp-e>>n;if(t>o){var a=gp>>n;t%=a,t>o&&(t-=a)}}return e+(t<<Whe(n))},hy=function(e,t){var n=e^t;n<as(e)&&(n=as(e)),n<as(t)&&(n=as(t));var r=xH(n);return r>60?[0,!1]:[60-r>>1,!0]},nD=function(e,t){var n=qi(e);if(n>=qi(t))return t;if(Gi(e)>=t){for(;e=z1(e)[0],!(Gi(e)<t););return e}for(;!my(e);){var r=mD(e);if(qi(r)!==n||Gi(r)>=t)break;e=r}return e},sfe=function(e,t){if(t===0n)return e;var n=BigInt(2*(_i-no(e))+1);if(t<0n){var r=-(e>>n);t<r&&(t=r)}else{var s=gp+as(e)-e>>n;t>s&&(t=s)}return e+(t<<n)},iD=function(e,t){return e<t?-1:e>t?1:0},ofe=function(e,t){return e>t?-1:e<t?1:0},afe={__proto__:null,SentinelCellID:fl,face:du,pos:jhe,level:no,parent:Sr,immediateParent:mD,isFace:my,valid:uy,isLeaf:AD,childPosition:IH,lsb:as,lsbForLevel:Zm,children:z1,allNeighbors:PH,rangeMin:qi,rangeMax:Gi,contains:$m,intersects:LH,toToken:Xhe,fromToken:$he,toString:Yhe,fromString:Zhe,fromFacePosLevel:Khe,fromFace:xp,fromPoint:V1,fromLatLng:DH,stToIJ:zl,sizeIJ:Ca,sizeST:NH,ijToSTMin:I1,centerUV:FH,boundUV:Qhe,fromFaceIJ:Ay,fromFaceIJWrap:P1,fromFaceIJSame:Ap,faceIJOrientation:wp,faceSiTi:gD,ijLevelToBoundUV:BT,distanceFromBegin:Jhe,rawPoint:gy,point:vD,latLng:efe,edgeNeighbors:tfe,vertexNeighbors:BH,childBegin:_D,childBeginAtLevel:vy,childEnd:OH,childEndAtLevel:OT,next:Ia,prev:UH,nextWrap:nfe,prevWrap:ife,advanceWrap:rfe,commonAncestorLevel:hy,maxTile:nD,advance:sfe,ascending:iD,descending:ofe},Gl=(function(){function i(t,n){var r=t.pointCross(n);this.a=t,this.b=n,this.aXb=We.fromVector(t.vector.cross(n.vector)),this.aTangent=We.fromVector(t.vector.cross(r.vector)),this.bTangent=We.fromVector(r.vector.cross(n.vector)),this.c=new We(0,0,0),this.acb=Mc}i.newChainEdgeCrosser=function(n,r,s){var o=new i(n,r);return o.restartAt(s),o};var e=i.prototype;return e.crossingSign=function(n,r){return n.equals(this.c)||this.restartAt(n),this.chainCrossingSign(r)},e.edgeOrVertexCrossing=function(n,r){return n.equals(this.c)||this.restartAt(n),this.edgeOrVertexChainCrossing(r)},e.restartAt=function(n){this.c=n,this.acb=-QL(this.a,this.b,this.c)},e.chainCrossingSign=function(n){var r=QL(this.a,this.b,n);return this.acb===-r&&r!==$f?(this.c=n,this.acb=-r,Vl):this._crossingSign(n,r)},e.edgeOrVertexChainCrossing=function(n){var r=We.fromVector(this.c.vector);switch(this.chainCrossingSign(n)){case Vl:return!1;case Mc:return!0}return zH(this.a,this.b,r,n)},e._crossingSign=function(n,r){var s=(1.5+1/Math.sqrt(3))*Ki;if(this.c.vector.dot(this.aTangent.vector)>s&&n.vector.dot(this.aTangent.vector)>s||this.c.vector.dot(this.bTangent.vector)>s&&n.vector.dot(this.bTangent.vector)>s)return this.c=n,this.acb=-r,Vl;if(this.a.equals(this.c)||this.a.equals(n)||this.b.equals(this.c)||this.b.equals(n))return this.c=n,this.acb=-r,PT;if(this.a.equals(this.b)||this.c.equals(n))return this.c=n,this.acb=-r,Vl;if(this.acb===$f&&(this.acb=-JL(this.a,this.b,this.c)),r===$f&&(r=JL(this.a,this.b,n)),r!==this.acb)return this.c=n,this.acb=-r,Vl;var o=-Xm(this.c,n,this.b);if(o!==this.acb)return this.c=n,this.acb=-r,Vl;var a=Xm(this.c,n,this.a);return a!==this.acb?(this.c=n,this.acb=-r,Vl):(this.c=n,this.acb=-r,Mc)},i})(),Mc=0,PT=1,Vl=2,kH=function(e,t,n,r){var s=Gl.newChainEdgeCrosser(e,t,n);return s.chainCrossingSign(r)},zH=function(e,t,n,r){if(e.equals(t)||n.equals(r))return!1;switch(!0){case e.equals(n):return t.equals(r)||We.orderedCCW(e.referenceDir(),r,t,e);case t.equals(r):return We.orderedCCW(t.referenceDir(),n,e,t);case e.equals(r):return t.equals(n)||We.orderedCCW(e.referenceDir(),n,t,e);case t.equals(n):return We.orderedCCW(t.referenceDir(),r,e,t)}return!1},lfe=function(e,t,n){return!We.orderedCCW(t.referenceDir(),n,e,t)},Ri=(function(){function i(t,n){this.lat=t,this.lng=n}i.emptyRect=function(){return new i(Li.empty(),to.emptyInterval())},i.fullRect=function(){return new i(i.validRectLatRange,i.validRectLngRange)},i.fromLatLng=function(n){return new i(new Li(wc(n.lat),wc(n.lat)),new to(wc(n.lng),wc(n.lng)))},i.fromCenterSize=function(n,r){var s=new ar(r.lat/2,r.lng/2);return i.fromLatLng(n).expanded(s)};var e=i.prototype;return e.equals=function(n){return this.lat.equals(n.lat)&&this.lng.equals(n.lng)},e.isValid=function(){return Math.abs(this.lat.lo)<=Math.PI/2&&Math.abs(this.lat.hi)<=Math.PI/2&&this.lng.isValid()&&this.lat.isEmpty()===this.lng.isEmpty()},e.isEmpty=function(){return this.lat.isEmpty()},e.isFull=function(){return this.lat.equals(i.validRectLatRange)&&this.lng.isFull()},e.isPoint=function(){return this.lat.lo===this.lat.hi&&this.lng.lo===this.lng.hi},e.vertex=function(n){var r,s;switch(n){case 0:r=this.lat.lo,s=this.lng.lo;break;case 1:r=this.lat.lo,s=this.lng.hi;break;case 2:r=this.lat.hi,s=this.lng.hi;break;default:r=this.lat.hi,s=this.lng.lo;break}return new ar(r,s)},e.lo=function(){return new ar(this.lat.lo,this.lng.lo)},e.hi=function(){return new ar(this.lat.hi,this.lng.hi)},e.center=function(){return new ar(this.lat.center(),this.lng.center())},e.size=function(){return new ar(this.lat.length(),this.lng.length())},e.area=function(){if(this.isEmpty())return 0;var n=Math.abs(Math.sin(this.lat.hi)-Math.sin(this.lat.lo));return this.lng.length()*n},e.addPoint=function(n){return n.isValid()?new i(this.lat.addPoint(wc(n.lat)),this.lng.addPoint(wc(n.lng))):this},e.expanded=function(n){var r=this.lat.expanded(wc(n.lat)),s=this.lng.expanded(wc(n.lng));return r.isEmpty()||s.isEmpty()?i.emptyRect():new i(r.intersection(i.validRectLatRange),s)},e.toString=function(){return"[Lo"+this.lo()+", Hi"+this.hi()+"]"},e.polarClosure=function(){return this.lat.lo===-Math.PI/2||this.lat.hi===Math.PI/2?new i(this.lat,to.fullInterval()):this},e.union=function(n){return new i(this.lat.union(n.lat),this.lng.union(n.lng))},e.intersection=function(n){var r=this.lat.intersection(n.lat),s=this.lng.intersection(n.lng);return r.isEmpty()||s.isEmpty()?i.emptyRect():new i(r,s)},e.intersects=function(n){return this.lat.intersects(n.lat)&&this.lng.intersects(n.lng)},e.capBound=function(){if(this.isEmpty())return _p.emptyCap();var n,r;this.lat.hi+this.lat.lo<0?(n=-1,r=Math.PI/2+this.lat.hi):(n=1,r=Math.PI/2-this.lat.lo);var s=_p.fromCenterAngle(new We(0,0,n),r);if(dp(this.lng.hi-this.lng.lo,2*Math.PI)>=0&&this.lng.hi-this.lng.lo<2*Math.PI){var o=_p.fromPoint(We.fromLatLng(this.center())).addPoint(We.fromLatLng(this.lo())).addPoint(We.fromLatLng(this.hi()));if(o.height()<s.height())return o}return s},e.rectBound=function(){return this},e.contains=function(n){return this.lat.containsInterval(n.lat)&&this.lng.containsInterval(n.lng)},e.containsCell=function(n){return this.contains(n.rectBound())},e.containsLatLng=function(n){return n.isValid()?this.lat.contains(wc(n.lat))&&this.lng.contains(wc(n.lng)):!1},e.containsPoint=function(n){return this.containsLatLng(ar.fromPoint(n))},e.cellUnionBound=function(){return this.capBound().cellUnionBound()},e.approxEqual=function(n){return this.lat.approxEqual(n.lat)&&this.lng.approxEqual(n.lng)},i.bisectorIntersection=function(n,r){r=Math.abs(r);var s=n.center(),o=new ar(s-Math.PI/2,r);s<0&&(o=new ar(-s-Math.PI/2,r-Math.PI));var a=new We(0,-1,0);return a.pointCross(We.fromLatLng(o))},e.centroid=function(){if(this.isEmpty())return new We(0,0,0);var n=Math.sin(this.lat.lo),r=Math.sin(this.lat.hi),s=Math.cos(this.lat.lo),o=Math.cos(this.lat.hi),a=.5*this.lng.length(),l=Math.sin(a)*(o*r-s*n+this.lat.length()),c=this.lng.center(),u=a*(r+n)*(r-n);return new We(l*Math.cos(c),l*Math.sin(c),u)},e.intersectsCell=function(n){if(this.isEmpty())return!1;if(this.containsPoint(We.fromVector(gy(n.id)))||n.containsPoint(We.fromLatLng(this.center())))return!0;if(!this.intersects(n.rectBound()))return!1;for(var r=[],s=[],o=0;o<4;o++){var a=n.vertex(o);r.push(a);var l=ar.fromPoint(a);if(s.push(l),this.containsLatLng(l)||n.containsPoint(We.fromLatLng(this.vertex(o))))return!0}for(var c=0;c<4;c++){var u=to.fromEndpoints(s[c].lng,s[c+1&3].lng);if(this.lng.intersects(u)){var f=r[c],d=r[c+1&3];if(u.contains(this.lng.lo)&&Qq(f,d,this.lat,this.lng.lo)||u.contains(this.lng.hi)&&Qq(f,d,this.lat,this.lng.hi)||Kq(f,d,this.lat.lo,this.lng)||Kq(f,d,this.lat.hi,this.lng))return!0}}return!1},i})();Ri.validRectLatRange=new Li(-Math.PI/2,Math.PI/2);Ri.validRectLngRange=to.fullInterval();var Kq=function(e,t,n,r){var s=e.vector.cross(t.vector).normalize();s.z<0&&(s=s.mul(-1));var o=s.cross(We.fromCoords(0,0,1).vector).normalize(),a=o.cross(s),l=Math.sin(wc(n));if(Math.abs(l)>=a.z)return!1;var c=l/a.z,u=Math.sqrt(1-c*c),f=Math.atan2(u,c),d=to.fromPointPair(Math.atan2(e.vector.dot(o),e.vector.dot(a)),Math.atan2(t.vector.dot(o),t.vector.dot(a)));if(d.contains(f)){var A=a.mul(c).add(o.mul(u));if(r.contains(Math.atan2(A.y,A.x)))return!0}if(d.contains(-f)){var y=a.mul(c).sub(o.mul(u));if(r.contains(Math.atan2(y.y,y.x)))return!0}return!1},Qq=function(e,t,n,r){return kH(e,t,We.fromLatLng(new ar(n.lo,r)),We.fromLatLng(new ar(n.hi,r)))===Mc},xD=(function(){function i(t,n){this.dim=t,this.deriv=n}var e=i.prototype;return e.value=function(n){return $L(this.deriv,-this.dim*n)},e.minLevel=function(n){if(n<=0)return _i;var r=-(qq(n/this.deriv)>>this.dim-1);return r>_i&&(r=_i),r<0&&(r=0),r||0},e.maxLevel=function(n){if(n<=0)return _i;var r=qq(this.deriv/n)>>this.dim-1;return r>_i&&(r=_i),r<0&&(r=0),r||0},e.closestLevel=function(n){var r=Math.SQRT2;return this.dim===2&&(r=2),this.minLevel(r*n)},i})(),rD=new xD(1,2*Math.SQRT2/3),cfe=new xD(1,1.4592137463861061),sD=new xD(2,4*Math.PI/6),ufe=function(e,t,n){return ET(yD(e,t,n,0,!0).dist)},pu=function(e,t,n,r){return yD(e,t,n,r,!1)},Jq=function(e,t,n,r){var s=eD(We.chordAngleBetweenPoints(e,t),We.chordAngleBetweenPoints(e,n));if(s>N1){var o=yD(We.fromVector(e.vector.mul(-1)),t,n,s,!0);s=o.dist,s=Tc-s}return r<s?{dist:s,less:!0}:{dist:r,less:!1}},VH=function(e,t,n){var r=t.pointCross(n),s=e.vector.sub(r.vector.mul(e.vector.dot(r.vector)/r.vector.norm2()));return KL(r,t,We.fromVector(s))&&KL(We.fromVector(s),n,r)?We.fromVector(s.normalize()):e.vector.sub(t.vector).norm2()<=e.vector.sub(n.vector).norm2()?t:n},GH=function(e,t,n){var r=e,s=t.pointCross(n),o=s.vector.cross(t.vector);return We.fromVector(t.vector.mul(Math.cos(r)).add(o.mul(Math.sin(r)/o.norm())).normalize())},hfe=function(e){return Math.max(ffe(e),fD(e))},ffe=function(e){if(e>=N1)return 0;var t=Math.min(1,.5*e),n=Math.sqrt(t*(2-t));return((2.5+2*Math.sqrt(3)+8.5*n)*n+(2+2*Math.sqrt(3)/3+6.5*(1-t))*t+(23+16/Math.sqrt(3))*Ki)*Ki},yD=function(e,t,n,r,s){var o=dfe(e,t,n,r,s),a=o.dist,l=o.less;if(l)return{dist:a,less:!0};var c=e.vector.sub(t.vector).norm2(),u=e.vector.sub(n.vector).norm2(),f=Math.min(c,u);return!s&&f>=r?{dist:r,less:!1}:{dist:f,less:!0}},dfe=function(e,t,n,r,s){var o=e.vector.sub(t.vector).norm2(),a=e.vector.sub(n.vector).norm2(),l=t.vector.sub(n.vector).norm2(),c=4.75*Ki*(o+a+l)+8*Ki*Ki;if(Math.abs(o-a)>=l+c)return{dist:r,less:!1};var u=t.pointCross(n),f=u.vector.norm2(),d=e.vector.dot(u.vector),A=d*d;if(!s&&A>f*r)return{dist:r,less:!1};var y=u.vector.cross(e.vector);if(t.vector.sub(e.vector).dot(y)>=0||n.vector.sub(e.vector).dot(y)<=0)return{dist:r,less:!1};var w=1-Math.sqrt(y.norm2()/f),S=A/f+w*w;return!s&&S>=r?{dist:r,less:!1}:{dist:S,less:!0}},eH=We.fromCoords(1,0,0),_p=(function(){function i(t,n){this.center=t,this.rad=n}i.fromPoint=function(n){return i.fromCenterChordAngle(n,0)},i.fromCenterAngle=function(n,r){return i.fromCenterChordAngle(n,bT(r))},i.fromCenterChordAngle=function(n,r){return new i(n,r)},i.fromCenterHeight=function(n,r){return i.fromCenterChordAngle(n,YL(2*r))},i.fromCenterArea=function(n,r){return i.fromCenterChordAngle(n,YL(r/Math.PI))},i.fromCap=function(n){return new i(We.fromVector(n.center.vector),n.rad)},i.emptyCap=function(){return i.fromCenterChordAngle(eH,TT)},i.fullCap=function(){return i.fromCenterChordAngle(eH,Tc)};var e=i.prototype;return e.isValid=function(){return this.center.vector.isUnit()&&this.rad<=Tc},e.isEmpty=function(){return this.rad<0},e.isFull=function(){return this.rad==Tc},e.centerPoint=function(){return this.center},e.height=function(){return .5*this.rad},e.radius=function(){return ET(this.rad)},e.area=function(){return 2*Math.PI*Math.max(0,this.height())},e.contains=function(n){return this.isFull()||n.isEmpty()?!0:this.rad>=ny(We.chordAngleBetweenPoints(this.center,n.center),n.rad)},e.intersects=function(n){return this.isEmpty()||n.isEmpty()?!1:ny(this.rad,n.rad)>=We.chordAngleBetweenPoints(this.center,n.center)},e.interiorIntersects=function(n){return this.rad<=0||n.isEmpty()?!1:ny(this.rad,n.rad)>We.chordAngleBetweenPoints(this.center,n.center)},e.intersectsCell=function(n){for(var r=[],s=0;s<4;s++)if(r[s]=n.vertex(s),this.containsPoint(r[s]))return!0;return this._intersects(n,r)},e._intersects=function(n,r){if(this.rad>=N1||this.isEmpty())return!1;if(n.containsPoint(this.center))return!0;for(var s=wH(this.rad),o=0;o<4;o++){var a=n.edge(o).vector,l=this.center.vector.dot(a);if(!(l>0)){if(l*l>s*a.norm2())return!1;var c=a.cross(this.center.vector);if(c.dot(r[o].vector)<0&&c.dot(r[o+1&3].vector)>0)return!0}}return!1},e.containsPoint=function(n){return We.chordAngleBetweenPoints(this.center,n)<=this.rad},e.containsCell=function(n){for(var r=[],s=0;s<4;s++)if(r[s]=n.vertex(s),!this.containsPoint(r[s]))return!1;return!this.complement()._intersects(n,r)},e.interiorContainsPoint=function(n){return this.isFull()||We.chordAngleBetweenPoints(this.center,n)<this.rad},e.complement=function(){return this.isFull()?i.emptyCap():this.isEmpty()?i.fullCap():i.fromCenterChordAngle(We.fromVector(this.center.vector.mul(-1)),Ehe(Tc,this.rad))},e.capBound=function(){return this},e.rectBound=function(){if(this.isEmpty())return Ri.emptyRect();var n=this.radius(),r=!1,s=new Li(ar.latitude(this.center)-n,ar.latitude(this.center)+n),o=to.fullInterval();if(s.lo<=-Math.PI/2&&(s.lo=-Math.PI/2,r=!0),s.hi>=Math.PI/2&&(s.hi=Math.PI/2,r=!0),!r){var a=Mhe(this.rad),l=Math.cos(ar.latitude(this.center));if(a<=l){var c=Math.asin(a/l);o.lo=dp(ar.longitude(this.center)-c,Math.PI*2),o.hi=dp(ar.longitude(this.center)+c,Math.PI*2)}}return new Ri(s,o)},e.equals=function(n){return this.rad===n.rad&&this.center.equals(n.center)||this.isEmpty()&&n.isEmpty()||this.isFull()&&n.isFull()},e.approxEqual=function(n){var r=1e-14,s=this.rad,o=n.rad;return this.center.approxEqual(n.center)&&Math.abs(s-o)<=r||this.isEmpty()&&o<=r||n.isEmpty()&&s<=r||this.isFull()&&o>=2-r||n.isFull()&&s>=2-r},e.addPoint=function(n){if(this.isEmpty())return new i(n,0);var r=We.chordAngleBetweenPoints(this.center,n);return r>this.rad&&(this.rad=r),this},e.addCap=function(n){if(this.isEmpty())return n;if(n.isEmpty())return this;var r=ny(We.chordAngleBetweenPoints(this.center,n.center),n.rad),s=FT(r,Ki*r);return s>this.rad&&(this.rad=s),this},e.expanded=function(n){return this.isEmpty()?i.emptyCap():i.fromCenterChordAngle(this.center,ny(this.rad,bT(n)))},e.toString=function(){return"[Center="+this.center.vector+", Radius="+yH(this.radius())+"]"},i.radiusToHeight=function(n){return n<0?TT:n>=Math.PI?N1:.5*bT(n)},e.cellUnionBound=function(){var n=rD.maxLevel(this.radius())-1;if(n<0){for(var r=[],s=0;s<6;s++)r[s]=xp(s);return r}return BH(V1(this.center),n)},e.centroid=function(){if(this.isEmpty())return new We(0,0,0);var n=1-.5*this.height();return We.fromVector(this.center.vector.mul(n*this.area()))},e.union=function(n){var r=this;if(r.rad<n.rad){var s=[n,r];r=s[0],n=s[1]}if(r.isFull()||n.isEmpty())return r;var o=r.radius(),a=n.radius(),l=r.center.distance(n.center);if(o>=l+a)return r;var c=.5*(l+o+a),u=GH(.5*(l-o+a),r.center,n.center);return i.fromCenterAngle(u,c)},i})(),oD=function(e,t,n){var r=t.stableAngle(n),s=n.stableAngle(e),o=e.stableAngle(t),a=.5*(r+s+o);if(a>=3e-4){var l=a-Math.max(r,s,o);if(l<.01*a*a*a*a*a){var c=pfe(e,t,n);if(l<a*.1*(c+5e-15))return c}}return 4*Math.atan(Math.sqrt(Math.max(0,Math.tan(.5*a)*Math.tan(.5*(a-r))*Math.tan(.5*(a-s))*Math.tan(.5*(a-o)))))},pfe=function(e,t,n){var r=e.pointCross(t),s=t.pointCross(n),o=e.pointCross(n),a=r.vector.angle(o.vector)-r.vector.angle(s.vector)+s.vector.angle(o.vector);return a<0&&(a=0),a},mfe=function(e,t,n){return Xm(e,t,n)*oD(e,t,n)},tH=function(e,t,n){var r=e.pointCross(t).vector.angle(t.pointCross(n).vector);return Xm(e,t,n)===k1?r:-r},nH=Math.asin(Math.sqrt(1/3))-.5*Ki,Ra=(function(){function i(t,n,r,s,o){this.face=t,this.level=n,this.orientation=r,this.id=s,this.uv=o}i.fromCellID=function(n){var r=wp(n),s=r.f,o=r.i,a=r.j,l=r.orientation,c=no(n);return new i(s,c,l,n,BT(o,a,c))},i.fromPoint=function(n){return i.fromCellID(V1(n))},i.fromLatLng=function(n){return i.fromCellID(DH(n))},i.oppositeFace=function(n){return(n+3)%6};var e=i.prototype;return e.isLeaf=function(){return this.level===_i},e.sizeIJ=function(){return Ca(this.level)},e.sizeST=function(){return NH(this.level)},e.vertex=function(n){var r=this.uv.vertices()[n];return We.fromVector(lh(this.face,r.x,r.y).normalize())},e.edge=function(n){switch(n){case 0:return We.fromVector($q(this.face,this.uv.y.lo).normalize());case 1:return We.fromVector(Xq(this.face,this.uv.x.hi).normalize());case 2:return We.fromVector($q(this.face,this.uv.y.hi).mul(-1).normalize());default:return We.fromVector(Xq(this.face,this.uv.x.lo).mul(-1).normalize())}},e.boundUV=function(){return this.uv},e.center=function(){return We.fromVector(gy(this.id).normalize())},e.children=function(){var n=[];if(AD(this.id))return n;for(var r=FH(this.id),s=_D(this.id),o=0;o<4;o++){var a=new i(this.face,this.level+1,this.orientation^R1[o],s,Hr.empty()),l=dD[this.orientation][o],c=l>>1,u=l&1;c===1?(a.uv.x.hi=this.uv.x.hi,a.uv.x.lo=r.x):(a.uv.x.lo=this.uv.x.lo,a.uv.x.hi=r.x),u===1?(a.uv.y.hi=this.uv.y.hi,a.uv.y.lo=r.y):(a.uv.y.lo=this.uv.y.lo,a.uv.y.hi=r.y),s=Ia(s),n.push(a)}return n},e.exactArea=function(){var n=this.vertex(0),r=this.vertex(1),s=this.vertex(2),o=this.vertex(3);return oD(n,r,s)+oD(n,s,o)},e.approxArea=function(){if(this.level<2)return this.averageArea();var n=.5*this.vertex(2).vector.sub(this.vertex(0).vector).cross(this.vertex(3).vector.sub(this.vertex(1).vector)).norm();return n*2/(1+Math.sqrt(1-Math.min(1/Math.PI*n,1)))},e.averageArea=function(){return sD.value(this.level)},e.intersectsCell=function(n){return LH(this.id,n.id)},e.containsCell=function(n){return $m(this.id,n.id)},e.cellUnionBound=function(){return this.capBound().cellUnionBound()},e.latitude=function(n,r){var s,o;switch(!0){case(n===0&&r===0):s=this.uv.x.lo,o=this.uv.y.lo;break;case(n===0&&r===1):s=this.uv.x.lo,o=this.uv.y.hi;break;case(n===1&&r===0):s=this.uv.x.hi,o=this.uv.y.lo;break;case(n===1&&r===1):s=this.uv.x.hi,o=this.uv.y.hi;break;default:throw new Error("i and/or j is out of bounds")}return ar.latitude(We.fromVector(lh(this.face,s,o)))},e.longitude=function(n,r){var s,o;switch(!0){case(n===0&&r===0):s=this.uv.x.lo,o=this.uv.y.lo;break;case(n===0&&r===1):s=this.uv.x.lo,o=this.uv.y.hi;break;case(n===1&&r===0):s=this.uv.x.hi,o=this.uv.y.lo;break;case(n===1&&r===1):s=this.uv.x.hi,o=this.uv.y.hi;break;default:throw new Error("i and/or j is out of bounds")}return ar.longitude(We.fromVector(lh(this.face,s,o)))},e.rectBound=function(){if(this.level>0){var n=this.uv.x.lo+this.uv.x.hi,r=this.uv.y.lo+this.uv.y.hi,s,o;Dhe(this.face).z===0?s=n<0?1:0:s=n>0?1:0,Nhe(this.face).z===0?o=r<0?1:0:o=r>0?1:0;var a=Li.fromPoint(this.latitude(s,o)).addPoint(this.latitude(1-s,1-o)),l=to.emptyInterval().addPoint(this.longitude(s,1-o)).addPoint(this.longitude(1-s,o));return new Ri(a,l).expanded(new ar(2*Ki,2*Ki)).polarClosure()}var c;switch(this.face){case 0:c=new Ri(new Li(-Math.PI/4,Math.PI/4),new to(-Math.PI/4,Math.PI/4));break;case 1:c=new Ri(new Li(-Math.PI/4,Math.PI/4),new to(Math.PI/4,3*Math.PI/4));break;case 2:c=new Ri(new Li(nH,Math.PI/2),to.fullInterval());break;case 3:c=new Ri(new Li(-Math.PI/4,Math.PI/4),new to(3*Math.PI/4,-3*Math.PI/4));break;case 4:c=new Ri(new Li(-Math.PI/4,Math.PI/4),new to(-3*Math.PI/4,-Math.PI/4));break;default:c=new Ri(new Li(-Math.PI/2,-nH),to.fullInterval())}return c.expanded(new ar(Ki,0))},e.capBound=function(){for(var n=_p.fromPoint(We.fromVector(lh(this.face,this.uv.center().x,this.uv.center().y).normalize())),r=0;r<4;r++)n=n.addPoint(this.vertex(r));return n},e.containsPoint=function(n){var r=Ihe(this.face,n.vector),s=r[0],o=r[1],a=r[2];return a?this.uv.expandedByMargin(Ki).containsPoint(new Ci(s,o)):!1},e.vertexChordDist2=function(n,r,s){var o=this.uv.x.lo,a=this.uv.y.lo;return r&&(o=this.uv.x.hi),s&&(a=this.uv.y.hi),We.chordAngleBetweenPoints(n,We.fromCoords(o,a,1))},e.uEdgeIsClosest=function(n,r){var s=this.uv.x.lo,o=this.uv.x.hi,a=this.uv.y.lo;r&&(a=this.uv.y.hi);var l=new Wt(a*a+1,-s*a,-s),c=new Wt(a*a+1,-o*a,-o);return n.vector.dot(l)>0&&n.vector.dot(c)<0},e.vEdgeIsClosest=function(n,r){var s=this.uv.y.lo,o=this.uv.y.hi,a=this.uv.x.lo;r&&(a=this.uv.x.hi);var l=new Wt(-a*s,a*a+1,-s),c=new Wt(-a*o,a*a+1,-o);return n.vector.dot(l)>0&&n.vector.dot(c)<0},i.edgeDistance=function(n,r){var s=n*n/(1+r*r),o=1-Math.sqrt(1-s);return YL(s+o*o)},e.distanceInternal=function(n,r){var s=We.fromVector(vp(this.face,n.vector)),o=s.x-s.z*this.uv.x.lo,a=s.x-s.z*this.uv.x.hi,l=s.y-s.z*this.uv.y.lo,c=s.y-s.z*this.uv.y.hi,u=!0;return o<0&&(u=!1,this.vEdgeIsClosest(s,!1))?i.edgeDistance(-o,this.uv.x.lo):a>0&&(u=!1,this.vEdgeIsClosest(s,!0))?i.edgeDistance(a,this.uv.x.hi):l<0&&(u=!1,this.uEdgeIsClosest(s,!1))?i.edgeDistance(-l,this.uv.y.lo):c>0&&(u=!1,this.uEdgeIsClosest(s,!0))?i.edgeDistance(c,this.uv.y.hi):u?r?0:kL(i.edgeDistance(-o,this.uv.x.lo),i.edgeDistance(a,this.uv.x.hi),i.edgeDistance(-l,this.uv.y.lo),i.edgeDistance(c,this.uv.y.hi)):kL(this.vertexChordDist2(s,!1,!1),this.vertexChordDist2(s,!0,!1),this.vertexChordDist2(s,!1,!0),this.vertexChordDist2(s,!0,!0))},e.distance=function(n){return this.distanceInternal(n,!0)},e.maxDistance=function(n){var r=We.fromVector(vp(this.face,n.vector)),s=eD(this.vertexChordDist2(r,!1,!1),this.vertexChordDist2(r,!0,!1),this.vertexChordDist2(r,!1,!0),this.vertexChordDist2(r,!0,!0));return s<=N1?s:Tc-this.distance(We.fromVector(n.vector.mul(-1)))},e.boundaryDistance=function(n){return this.distanceInternal(n,!1)},e.distanceToEdge=function(n,r){var s=kL(this.distance(n),this.distance(r));if(s===0)return s;for(var o=Gl.newChainEdgeCrosser(n,r,this.vertex(3)),a=0;a<4;a++)if(o.chainCrossingSign(this.vertex(a))!==Vl)return 0;for(var l=0;l<4;l++)s=pu(this.vertex(l),n,r,s).dist;return s},e.maxDistanceToEdge=function(n,r){var s=eD(this.maxDistance(n),this.maxDistance(r));return s<=N1?s:Tc-this.distanceToEdge(We.fromVector(n.vector.mul(-1)),We.fromVector(r.vector.mul(-1)))},e.distanceToCell=function(n){if(this.face===n.face&&this.uv.intersects(n.uv))return 0;for(var r=[],s=[],o=0;o<4;o++)r.push(this.vertex(o)),s.push(n.vertex(o));for(var a=Rc(),l=0;l<4;l++)for(var c=0;c<4;c++)a=pu(r[l],s[c],s[c+1&3],a).dist,a=pu(s[l],r[c],r[c+1&3],a).dist;return a},e.maxDistanceToCell=function(n){var r=new Hr(n.uv.y,n.uv.x);if(this.face===i.oppositeFace(n.face)&&this.uv.intersects(r))return Tc;for(var s=[],o=[],a=0;a<4;a++)s.push(this.vertex(a)),o.push(n.vertex(a));for(var l=TT,c=0;c<4;c++)for(var u=0;u<4;u++)l=Jq(s[c],o[u],o[u+1&3],l).dist,l=Jq(o[c],s[u],s[u+1&3],l).dist;return l},i})(),C1=-1,qH=(function(){function i(t,n){n===void 0&&(n=!1),this.nonEmpty=n,this.rangeNodes=t.rangeNodes,this.pos=0}var e=i.prototype;return e.startID=function(){return this.rangeNodes[this.pos].startID},e.limitID=function(){return this.rangeNodes[this.pos+1].startID},e.isEmpty=function(){return this.rangeNodes[this.pos].contents===C1},e.begin=function(){for(this.pos=0;this.nonEmpty&&this.isEmpty()&&!this.done();)this.pos++},e.internalPrev=function(){return this.pos===0?!1:(this.pos--,!0)},e.nonEmptyPrev=function(){for(;this.internalPrev();)if(!this.isEmpty())return!0;return this.isEmpty()&&!this.done()&&this.next(),!1},e.prev=function(){return this.nonEmpty?this.nonEmptyPrev():this.internalPrev()},e.next=function(){for(this.pos++;this.nonEmpty&&this.isEmpty()&&!this.done();)this.pos++},e.advance=function(n){return n>=this.rangeNodes.length-1-this.pos?!1:(this.pos+=n,!0)},e.finish=function(){this.pos=this.rangeNodes.length-1},e.done=function(){return this.pos>=this.rangeNodes.length-1},e.seek=function(n){for(var r=0,s=this.rangeNodes.length;r<s;){var o=r+s>>>1;this.rangeNodes[o].startID>n?s=o:r=o+1}for(this.pos=Math.max(r-1,0);this.nonEmpty&&this.isEmpty()&&!this.done();)this.pos++},i})(),HH=(function(){function i(t){this.cellTree=t.cellTree,this.prevStartID=0n,this.nodeCutoff=-1,this.nextNodeCutoff=-1,this.node={cellID:0n,label:C1,parent:-1}}var e=i.prototype;return e.clear=function(){this.prevStartID=0n,this.nodeCutoff=-1,this.nextNodeCutoff=-1,this.node.label=C1},e.cellID=function(){return this.node.cellID},e.label=function(){return this.node.label},e.next=function(){this.node.parent<=this.nodeCutoff?(this.nodeCutoff=this.nextNodeCutoff,this.node.label=C1):this.node=ST({},this.cellTree[this.node.parent])},e.done=function(){return this.node.label===C1},e.startUnion=function(n){n.startID()<this.prevStartID&&(this.nodeCutoff=-1),this.prevStartID=n.startID();var r=n.rangeNodes[n.pos].contents;r<=this.nodeCutoff?this.node.label=C1:this.node=ST({},this.cellTree[r]),this.nextNodeCutoff=r},i})(),Afe=(function(){function i(){this.cellTree=[],this.rangeNodes=[]}var e=i.prototype;return e.add=function(n,r){if(r<0)throw new Error("labels must be non-negative");this.cellTree.push({cellID:n,label:r,parent:-1})},e.addCellUnion=function(n,r){if(r<0)throw new Error("labels must be non-negative");for(var s=Ct(n),o;!(o=s()).done;){var a=o.value;this.add(a,r)}},e.build=function(){for(var n=[],r=Ct(this.cellTree),s;!(s=r()).done;){var o=s.value;n.push({startID:qi(o.cellID),cellID:o.cellID,label:o.label}),n.push({startID:Ia(Gi(o.cellID)),cellID:fl,label:-1})}n.push({startID:vy(xp(0),_i),cellID:0n,label:-1}),n.push({startID:OT(xp(5),_i),cellID:0n,label:-1}),n.sort(function(u,f){return u.startID!==f.startID?u.startID<f.startID?-1:1:u.cellID!==f.cellID?u.cellID>f.cellID?-1:1:u.label<f.label?-1:u.label>f.label?1:0}),this.cellTree=[],this.rangeNodes=[];for(var a=-1,l=0;l<n.length;){for(var c=n[l].startID;l<n.length&&n[l].startID===c;)n[l].label>=0?(this.cellTree.push({cellID:n[l].cellID,label:n[l].label,parent:a}),a=this.cellTree.length-1):n[l].cellID===fl&&(a=this.cellTree[a].parent),l++;this.rangeNodes.push({startID:c,contents:a})}},i})(),B1=(function(i){function e(){return i.apply(this,arguments)||this}dy(e,i),e.fromRange=function(r,s){for(var o=new e,a=nD(r,s);a!==s;a=nD(Ia(a),s))o.push(a);return o},e.fromUnion=function(){for(var r=arguments.length,s=new Array(r),o=0;o<r;o++)s[o]=arguments[o];var a=ay(e,s.flat(1));return a.normalize(),a},e.fromIntersection=function(r,s){for(var o=new e,a=0,l=0;a<r.length&&l<s.length;){var c=qi(r[a]),u=qi(s[l]);c>u?r[a]<=Gi(s[l])?(o.push(r[a]),a++):(l=s.lowerBound(l+1,s.length,c),r[a]<=Gi(s[l-1])&&l--):u>c?s[l]<=Gi(r[a])?(o.push(s[l]),l++):(a=r.lowerBound(a+1,r.length,u),s[l]<=Gi(r[a-1])&&a--):r[a]<s[l]?(o.push(r[a]),a++):(o.push(s[l]),l++)}return o.normalize(),o},e.fromIntersectionWithCellID=function(r,s){var o=new e;if(r.containsCellID(s))return o.push(s),o.normalize(),o;for(var a=Gi(s),l=r.lowerBound(0,r.length,qi(s));l<r.length&&r[l]<=a;l++)o.push(r[l]);return o.normalize(),o},e.fromDifference=function(r,s){for(var o=new e,a=Ct(r),l;!(l=a()).done;){var c=l.value;o.cellUnionDifferenceInternal(c,s)}return o};var t=e.prototype;return t.isValid=function(){for(var r=0;r<this.length;r++){var s=this[r];if(!uy(s)||r>0&&Gi(this[r-1])>=qi(s))return!1}return!0},t.isNormalized=function(){for(var r=0;r<this.length;r++){var s=this[r];if(!uy(s)||r>0&&Gi(this[r-1])>=qi(s)||r>=3&&e.areSiblings(this[r-3],this[r-2],this[r-1],s))return!1}return!0},t.normalize=function(){this.sort(iD);for(var r=[],s=Ct(this),o;!(o=s()).done;){var a=o.value;if(!(r.length>0&&$m(r[r.length-1],a))){for(var l=r.length-1;l>=0&&$m(a,r[l]);)l--;for(r.length=l+1;r.length>=3&&e.areSiblings(r[r.length-3],r[r.length-2],r[r.length-1],a);)r.length-=3,a=mD(a);r.push(a)}}this.length=0,this.push.apply(this,r)},t.intersectsCellID=function(r){var s=this.lowerBound(0,this.length,r);return s!==this.length&&qi(this[s])<=Gi(r)?!0:s!==0&&Gi(this[s-1])>=qi(r)},t.containsCellID=function(r){var s=this.lowerBound(0,this.length,r);return s!==this.length&&qi(this[s])<=r?!0:s!==0&&Gi(this[s-1])>=r},t.denormalize=function(r,s){for(var o=new e,a=Ct(this),l;!(l=a()).done;){var c=l.value,u=no(c),f=u;if(f<r&&(f=r),s>1&&(f+=(_i-(f-r))%s,f>_i&&(f=_i)),f===u)o.push(c);else for(var d=OT(c,f),A=vy(c,f);A!==d;A=Ia(A))o.push(A)}this.length=0,this.push.apply(this,o)},t.rectBound=function(){for(var r=Ri.emptyRect(),s=Ct(this),o;!(o=s()).done;){var a=o.value;r=r.union(Ra.fromCellID(a).rectBound())}return r},t.capBound=function(){if(this.length===0)return _p.emptyCap();for(var r=new We(0,0,0),s=Ct(this),o;!(o=s()).done;){var a=o.value,l=sD.value(no(a));r=We.fromVector(r.vector.add(vD(a).vector.mul(l)))}r.equals(new We(0,0,0))?r=We.fromCoords(1,0,0):r=We.fromVector(r.vector.normalize());for(var c=_p.fromPoint(r),u=Ct(this),f;!(f=u()).done;){var d=f.value;c=c.addCap(Ra.fromCellID(d).capBound())}return c},t.containsCell=function(r){return this.containsCellID(r.id)},t.intersectsCell=function(r){return this.intersectsCellID(r.id)},t.containsPoint=function(r){return this.containsCell(Ra.fromPoint(r))},t.cellUnionBound=function(){return this.capBound().cellUnionBound()},t.leafCellsCovered=function(){for(var r=0n,s=Ct(this),o;!(o=s()).done;){var a=o.value;r+=1n<<BigInt(_i-no(a)<<1)}return r},e.areSiblings=function(r,s,o,a){if((r^s^o)!==a)return!1;var l=as(a)<<1n;l=~(l+(l<<1n));var c=a&l;return(r&l)===c&&(s&l)===c&&(o&l)===c&&!my(a)},t.contains=function(r){for(var s=Ct(r),o;!(o=s()).done;){var a=o.value;if(!this.containsCellID(a))return!1}return!0},t.intersects=function(r){for(var s=Ct(this),o;!(o=s()).done;){var a=o.value;if(r.intersectsCellID(a))return!0}return!1},t.lowerBound=function(r,s,o){for(var a=r;a<s;a++)if(this[a]>=o)return a;return s},t.cellUnionDifferenceInternal=function(r,s){if(!s.intersectsCellID(r)){this.push(r);return}if(!s.containsCellID(r))for(var o=Ct(z1(r)),a;!(a=o()).done;){var l=a.value;this.cellUnionDifferenceInternal(l,s)}},t.expandAtLevel=function(r){for(var s=new e,o=Zm(r),a=this.length-1;a>=0;a--){var l=this[a];if(as(l)<o)for(l=Sr(l,r);a>0&&$m(l,this[a-1]);)a--;s.push(l),s.push.apply(s,PH(l,r))}s.sort(iD),this.length=0,this.push.apply(this,s),this.normalize()},t.expandByRadius=function(r,s){for(var o=_i,a=Ct(this),l;!(l=a()).done;){var c=l.value;o=Math.min(o,no(c))}var u=rD.maxLevel(r);u===0&&r>rD.value(0)&&this.expandAtLevel(0),this.expandAtLevel(Math.min(o+s,u))},t.equals=function(r){if(this.length!==r.length)return!1;for(var s=0;s<this.length;s++)if(this[s]!==r[s])return!1;return!0},t.averageArea=function(){return sD.value(_i)*Number(this.leafCellsCovered())},t.approxArea=function(){for(var r=0,s=Ct(this),o;!(o=s()).done;){var a=o.value;r+=Ra.fromCellID(a).approxArea()}return r},t.exactArea=function(){for(var r=0,s=Ct(this),o;!(o=s()).done;){var a=o.value;r+=Ra.fromCellID(a).exactArea()}return r},e})(D1(Array)),ch=(function(){function i(t,n){this.v0=t,this.v1=n}var e=i.prototype;return e.cmp=function(n){var r=this.v0.vector.cmp(n.v0.vector);return r!==0?r:this.v1.vector.cmp(n.v1.vector)},e.equals=function(n){return this.v0.equals(n.v0)&&this.v1.equals(n.v1)},i})(),L1=function(e,t){this.start=e,this.length=t},UT=function(e,t){this.chainID=e,this.offset=t},gfe=function(e,t){this.point=e,this.contained=t},kT=function(e){return new gfe(We.originPoint(),e)},WH=0,vfe=1,_fe=2,xfe=function(e){return e.numEdges()===0&&(e.dimension()!==2||e.numChains()===0)},yfe=function(e){return e.numEdges()===0&&e.dimension()===2&&e.numChains()>0},ry=(function(){function i(){}var e=i.prototype;return e.numEdges=function(){return 0},e.edge=function(n){return new ch(We.originPoint(),We.originPoint())},e.referencePoint=function(){return kT(!1)},e.numChains=function(){return 0},e.chain=function(n){return new L1(0,0)},e.chainEdge=function(n,r){return new ch(We.originPoint(),We.originPoint())},e.chainPosition=function(n){return new UT(0,0)},e.dimension=function(){return-1},e.isEmpty=function(){return!0},e.isFull=function(){return!1},e.typeTag=function(){return WH},e.privateInterface=function(){},i})(),iH=(function(){function i(t,n){this.containsCenter=!1,this.shapeID=t,this.containsCenter=!1,this.edges=new Array(n)}var e=i.prototype;return e.numEdges=function(){return this.edges.length},e.containsEdge=function(n){for(var r=Ct(this.edges),s;!(s=r()).done;){var o=s.value;if(o===n)return!0}return!1},i})(),jH=(function(){function i(){this.shapeID=0,this.containsCenter=!1,this.edges=[]}var e=i.prototype;return e.numEdges=function(){return 0},e.containsEdge=function(n){return!1},i})(),bfe=(function(){function i(t){this.shapes=new Array(t)}var e=i.prototype;return e.numEdges=function(){for(var n=0,r=Ct(this.shapes),s;!(s=r()).done;){var o=s.value;n+=o.numEdges()}return n},e.add=function(n){this.shapes.push(n)},e.findByShapeID=function(n){for(var r=Ct(this.shapes),s;!(s=r()).done;){var o=s.value;if(o.shapeID===n)return o}return new jH},i})(),zL=(function(){function i(){this.shapes=[]}var e=i.prototype;return e.numEdges=function(){return 0},e.add=function(n){},e.findByShapeID=function(n){return new jH},i})(),aD=0,XH=0,VL=(function(){function i(t,n){if(this.index=t,this.position=0,this.id=fl,this.cell=new zL,n!==void 0)switch(n){case aD:this.begin();break;case XH:this.end();break;default:throw new Error("unknown ShapeIndexIteratorPos value")}}var e=i.prototype;return e.clone=function(){var n=new i(this.index);return n.position=this.position,n.id=this.id,n.cell=this.cell,n},e.cellID=function(){return this.id},e.indexCell=function(){return this.cell},e.center=function(){return vD(this.cellID())},e.begin=function(){this.index.isFresh()||this.index.maybeApplyUpdates(),this.position=0,this.refresh()},e.next=function(){this.position++,this.refresh()},e.prev=function(){return this.position<=0?!1:(this.position--,this.refresh(),!0)},e.end=function(){this.position=this.index.cells.length,this.refresh()},e.done=function(){return this.id===fl},e.refresh=function(){this.position<this.index.cells.length?(this.id=this.index.cells[this.position],this.cell=this.index.cellMap.get(this.cellID())||new zL):(this.id=fl,this.cell=new zL)},e.seek=function(n){var r=this;this.position=tD(this.index.cells.length,function(s){return r.index.cells[s]>=n}),this.refresh()},e.locatePoint=function(n){var r=V1(n);return this.seek(r),!!(!this.done()&&qi(this.cellID())<=r||this.prev()&&Gi(this.cellID())>=r)},e.locateCellID=function(n){if(this.seek(qi(n)),!this.done()){if(this.cellID()>=n&&qi(this.cellID())<=n)return bp;if(this.cellID()<=Gi(n))return xy}return this.prev()&&Gi(this.cellID())>=n?bp:zT},i})(),wfe=(function(){function i(){this.isActive=!1,this.a=this.b=i.trackerOrigin(),this.nextCellID=vy(xp(0),_i),this.crosser=null,this.shapeIDs=[],this.savedIDs=[],this.drawTo(We.fromVector(lh(0,-1,-1).normalize()))}i.trackerOrigin=function(){return We.fromVector(lh(0,-1,-1).normalize())};var e=i.prototype;return e.focus=function(){return this.b},e.addShape=function(n,r){this.isActive=!0,r&&this.toggleShape(n)},e.moveTo=function(n){this.b=n},e.drawTo=function(n){this.a=this.b,this.b=n,this.crosser=new Gl(this.a,this.b)},e.testEdge=function(n,r){var s;(s=this.crosser)!=null&&s.edgeOrVertexCrossing(r.v0,r.v1)&&this.toggleShape(n)},e.setNextCellID=function(n){this.nextCellID=qi(n)},e.atCellID=function(n){return qi(n)===this.nextCellID},e.toggleShape=function(n){if(this.shapeIDs.length===0){this.shapeIDs.push(n);return}if(this.shapeIDs[0]===n){this.shapeIDs.shift();return}for(var r=0;r<this.shapeIDs.length;r++){var s=this.shapeIDs[r];if(!(s<n)){if(s===n){this.shapeIDs.splice(r,1);return}this.shapeIDs.splice(r,0,n);return}}this.shapeIDs.push(n)},e.saveAndClearStateBefore=function(n){var r=this.lowerBound(n);this.savedIDs=this.shapeIDs.slice(0,r),this.shapeIDs=this.shapeIDs.slice(r)},e.restoreStateBefore=function(n){var r=this.lowerBound(n);this.shapeIDs=this.savedIDs.concat(this.shapeIDs.slice(r)),this.savedIDs=[]},e.lowerBound=function(n){for(var r=0;r<this.shapeIDs.length;r++)if(this.shapeIDs[r]>=n)return r;return this.shapeIDs.length},i})(),Zf=1,rH=2,yp=(function(){function i(t,n){this.index=t,this.model=n,this.iter=t.iterator()}var e=i.prototype;return e.contains=function(n){if(!this.iter.locatePoint(n))return!1;for(var r=this.iter.indexCell(),s=Ct(r.shapes),o;!(o=s()).done;){var a=o.value;if(this._shapeContains(a,this.iter.center(),n))return!0}return!1},e._shapeContains=function(n,r,s){var o=n.containsCenter,a=n.numEdges();if(a<=0)return o;var l=this.index.shape(n.shapeID);if(l.dimension()!==2){if(this.model!==rH)return!1;for(var c=Ct(n.edges),u;!(u=c()).done;){var f=u.value,d=l.edge(f);if(d.v0.equals(s)||d.v1.equals(s))return!0}return!1}for(var A=new Gl(r,s),y=Ct(n.edges),w;!(w=y()).done;){var S=w.value,T=l.edge(S),R=A.crossingSign(T.v0,T.v1);if(R!==Vl){if(R===PT){if(this.model!==Zf&&(T.v0.equals(s)||T.v1.equals(s)))return this.model===rH;zH(A.a,A.b,T.v0,T.v1)?R=Mc:R=Vl}o=o!==(R===Mc)}}return o},e.shapeContains=function(n,r){if(!n||n instanceof ry||!this.iter.locatePoint(r))return!1;var s=this.iter.indexCell(),o=s.findByShapeID(this.index.idForShape(n));return o?this._shapeContains(o,this.iter.center(),r):!1},e.shapeVisitorFunc=function(n){return!0},e.visitContainingShapes=function(n,r){if(!this.iter.locatePoint(n))return!0;for(var s=this.iter.indexCell(),o=Ct(s.shapes),a;!(a=o()).done;){var l=a.value;if(this._shapeContains(l,this.iter.center(),n)&&!r(this.index.shape(l.shapeID)))return!1}return!0},e.containingShapes=function(n){var r=[];return this.visitContainingShapes(n,function(s){return r.push(s),!0}),r},i})(),Sfe=(function(){function i(t,n){n===void 0&&(n=new yp(t,Zf)),this.index=t,this.containsQuery=n,this.iter=t.iterator()}var e=i.prototype;return e.capBound=function(){var n=ay(B1,this.cellUnionBound());return n.capBound()},e.rectBound=function(){var n=ay(B1,this.cellUnionBound());return n.rectBound()},e.cellUnionBound=function(){var n=[];if(this.iter.end(),!this.iter.prev())return n;var r=this.iter.cellID();if(this.iter.begin(),this.iter.cellID()!==r){var s=hy(this.iter.cellID(),r),o=s[0];o===void 0&&(o=-1),o++;for(var a=Sr(r,o),l=Sr(this.iter.cellID(),o);l!=a;l=Ia(l))if(!(Gi(l)<this.iter.cellID())){var c=this.iter.cellID();this.iter.seek(Ia(Gi(l))),this.iter.prev(),n.push.apply(n,this.coverRange(c,this.iter.cellID(),[])),this.iter.next()}}return this.coverRange(this.iter.cellID(),r,n)},e.coverRange=function(n,r,s){if(n==r)return s.concat([n]);var o=hy(n,r),a=o[0],l=o[1];return l||s.concat([0n]),s.concat([Sr(n,a)])},i})(),Tfe=2.25*Ki,Efe=3*Ki,_y=9*(1/Math.SQRT2)*Ki,$H=3*Math.SQRT2*Ki,Mfe=function(e,t,n){return fy(e,t,n,0)},fy=function(e,t,n,r){if(cy(e.vector)===n&&cy(t.vector)===n){var s=Ym(n,e.vector),o=s[0],a=s[1],l=Ym(n,t.vector),c=l[0],u=l[1];return[new Ci(o,a),new Ci(c,u),!0]}var f=new Sc(vp(n,e.pointCross(t).vector)),d=new Sc(vp(n,e.vector)),A=new Sc(vp(n,t.vector)),y=1+r,w=new Sc(new We(y*f.x,y*f.y,f.z));if(!w.intersectsFace())return[null,null,!1];Math.max(Math.abs(f.x),Math.max(Math.abs(f.y),Math.abs(f.z)))<$L(1,-511)&&(f=new Sc(We.fromVector(f.vector.mul($L(1,563)))));var S=new Sc(We.fromVector(f.vector.normalize())),T=new Sc(We.fromVector(S.vector.cross(d.vector))),R=new Sc(We.fromVector(A.vector.cross(S.vector))),P=sH(A,d,new Sc(We.fromVector(w.vector.mul(-1))),R,T,y),I=P[0],F=P[1],D=sH(d,A,w,T,R,y),L=D[0],C=D[1];return[I,L,F+C<3]},Cfe=function(e,t,n){return e+t===n&&e===n-t&&t===n-e},GL=0,lD=1,Sc=(function(i){function e(n){return i.call(this,n.x,n.y,n.z)||this}dy(e,i);var t=e.prototype;return t.intersectsFace=function(){var r=Math.abs(this.x),s=Math.abs(this.y),o=Math.abs(this.z);return s>=o-r&&r>=o-s},t.intersectsOppositeEdges=function(){var r=Math.abs(this.x),s=Math.abs(this.y),o=Math.abs(this.z);return Math.abs(r-s)!==o?Math.abs(r-s)>=o:r>=s?r-o>=s:s-o>=r},t.exitAxis=function(){if(this.intersectsOppositeEdges())return Math.abs(this.x)>=Math.abs(this.y)?lD:GL;var r=0,s=0,o=0;return Math.sign(this.x)<0&&(r=1),Math.sign(this.y)<0&&(s=1),Math.sign(this.z)<0&&(o=1),(r^s^o)===0?lD:GL},t.exitPoint=function(r){if(r===GL){var s=this.y>0?1:-1;return new Ci(s,(-s*this.x-this.z)/this.y)}var o=this.x<0?1:-1;return new Ci((-o*this.y-this.z)/this.x,o)},e})(We),sH=function(e,t,n,r,s,o){var a=1-_y;if(t.z>0){var l=new Ci(t.x/t.z,t.y/t.z);if(Math.max(Math.abs(l.x),Math.abs(l.y))<=a)return[l,0]}var c=n.exitPoint(n.exitAxis()).mul(o),u=new Sc(new We(c.x,c.y,1)),f=0;return u.vector.sub(e.vector).dot(r.vector)<0?f=2:u.vector.sub(t.vector).dot(s.vector)<0&&(f=1),f>0&&(t.z<=0?f=3:c=new Ci(t.x/t.z,t.y/t.z)),[c,f]},oH=function(e,t,n){return t?e.lo>n?[e,!1]:(e.hi>n&&(e.hi=n),[e,!0]):e.hi<n?[e,!1]:(e.lo<n&&(e.lo=n),[e,!0])},aH=function(e,t,n,r,s,o,a,l){var c=!1;if(n.lo<l.lo){if(n.hi<l.lo)return[n,o,!1];n.lo=l.lo;var u=oH(o,a,O1(l.lo,e,t,r,s));if(o=u[0],c=u[1],!c)return[n,o,!1]}if(n.hi>l.hi){if(n.lo>l.hi)return[n,o,!1];n.hi=l.hi;var f=oH(o,!a,O1(l.hi,e,t,r,s));if(o=f[0],c=f[1],!c)return[n,o,!1]}return[n,o,!0]},YH=function(e,t,n){if(!n.intersects(Hr.fromPoints(e,t)))return!1;var r=t.sub(e).ortho(),s=r.x>=0?1:0,o=r.y>=0?1:0,a=r.dot(n.vertexIJ(s,o).sub(e)),l=r.dot(n.vertexIJ(1-s,1-o).sub(e));return a>=0&&l<=0},Rfe=function(e,t,n){var r=Hr.fromPoints(e,t),s=Ife(e,t,n,r),o=s[0],a=s[1];return a?o:Hr.empty()},Ife=function(e,t,n,r){var s=e.x>t.x!=e.y>t.y,o=aH(e.x,t.x,r.x,e.y,t.y,r.y,s,n.x),a=o[0],l=o[1],c=o[2];if(!c)return[r,!1];var u=aH(e.y,t.y,l,e.x,t.x,a,s,n.y),f=u[0],d=u[1],A=u[2];return A?[new Hr(d,f),!0]:[new Hr(a,l),!1]},O1=function(e,t,n,r,s){return Math.abs(t-e)<=Math.abs(n-e)?r+(s-r)*(e-t)/(n-t):s+(r-s)*(e-n)/(t-n)},Pfe=(function(){function i(t,n,r){this.face=t,this.a=n,this.b=r}var e=i.prototype;return e.clone=function(){return new i(this.face,new Ci(this.a.x,this.a.y),new Ci(this.b.x,this.b.y))},i})(),Lfe=function(e,t){var n=new Pfe(0,new Ci(0,0),new Ci(0,0)),r=MT(e.vector),s=r[0],o=r[1],a=r[2],l=MT(t.vector),c=l[0],u=l[1],f=l[2];if(n.a.x=o,n.a.y=a,n.b.x=u,n.b.y=f,s===c)return n.face=s,[n];var d=e.pointCross(t),A=lH(s,e,d,n.a),y=A[0],w=A[1],S=lH(c,t,We.fromVector(d.vector.mul(-1)),n.b),T=S[0],R=S[1];n.a=w,n.b=R;var P=[];n.face=y;for(var I=n.b,F=y;F!==T;){var D=vp(F,d.vector),L=new Sc(D),C=L.exitAxis();n.b=L.exitPoint(C),P.push(n.clone());var B=lh(F,n.b.x,n.b.y);F=Dfe(F,n.b,C,L,T);var k=vp(F,B);n.face=F,n.a=new Ci(k.x,k.y)}return n.b=I,P.push(n),P},lH=function(e,t,n,r){var s=1-_y;if(Math.max(Math.abs(r.x),Math.abs(r.y))<=s)return[e,r];var o=vp(e,n.vector),a=new Sc(o);if(a.intersectsFace()){var l=a.exitPoint(a.exitAxis()),c=lh(e,l.x,l.y),u=n.vector.normalize().cross(t.vector);if(c.sub(t.vector).dot(u)>=-Efe)return[e,r]}var f=0;Math.abs(r.x)>=Math.abs(r.y)?(r.x>0&&(f=1),e=CT(e,0,f)):(r.y>0&&(f=1),e=CT(e,1,f));var d=Ym(e,t.vector);return r.x=d[0],r.y=d[1],r.x=Math.max(-1,Math.min(1,r.x)),r.y=Math.max(-1,Math.min(1,r.y)),[e,r]},Dfe=function(e,t,n,r,s){var o=t.x,a=t.y;n==lD&&(o=t.y,a=t.x);var l=0;o>0&&(l=1);var c=0;return a>0&&(c=1),Math.abs(a)===1&&CT(e,1-n,c)===s&&Cfe(t.x*r.x,t.y*r.y,-r.z)?s:CT(e,n,l)},yT=1,cH=(function(){function i(t){this.rangeMin=fl,this.rangeMax=fl,this.it=t.iterator(),this.refresh()}var e=i.prototype;return e.cellID=function(){return this.it.cellID()},e.indexCell=function(){return this.it.indexCell()},e.next=function(){this.it.next(),this.refresh()},e.done=function(){return this.it.done()},e.seekTo=function(n){this.it.seek(n.rangeMin),(this.it.done()||qi(this.it.cellID())>n.rangeMax)&&this.it.prev()&&Gi(this.it.cellID())<n.cellID()&&this.it.next(),this.refresh()},e.seekBeyond=function(n){this.it.seek(Ia(n.rangeMax)),!this.it.done()&&qi(this.it.cellID())<=n.rangeMax&&this.it.next(),this.refresh()},e.refresh=function(){this.rangeMin=qi(this.cellID()),this.rangeMax=Gi(this.cellID())},i})(),Nfe=function(e,t){if(e.dimension()!==2)return!1;var n=e.referencePoint();if(n.point===t)return n.contained;for(var r=new Gl(n.point,t),s=n.contained,o=0;o<e.numEdges();o++){var a=e.edge(o);s=s!==r.edgeOrVertexCrossing(a.v0,a.v1)}return s},Ma=(function(){function i(){this.id=0n,this.padding=0,this.boundRect=Hr.empty(),this.middleRect=Hr.empty(),this.iLo=0,this.jLo=0,this.orientation=0,this.level=0}i.fromCellID=function(n,r){var s=new i;if(s.id=n,s.padding=r,s.middleRect=Hr.empty(),my(n)){var o=r+1;return s.boundRect=new Hr(new Li(-o,o),new Li(-o,o)),s.middleRect=new Hr(new Li(-r,r),new Li(-r,r)),s.orientation=du(n)&1,s}var a=wp(n),l=a.i,c=a.j,u=a.orientation;s.iLo=l,s.jLo=c,s.orientation=u,s.level=no(n),s.boundRect=BT(l,c,s.level).expandedByMargin(r);var f=Ca(s.level);return s.iLo&=-f,s.jLo&=-f,s},i.fromParentIJ=function(n,r,s){var o=Che[n.orientation][2*r+s],a=new i;a.id=z1(n.id)[o],a.padding=n.padding,a.boundRect=Hr.fromRect(n.boundRect),a.orientation=n.orientation^R1[o],a.level=n.level+1,a.middleRect=Hr.empty();var l=Ca(a.level);a.iLo=n.iLo+r*l,a.jLo=n.jLo+s*l;var c=n.middle();return r===1?a.boundRect.x.lo=c.x.lo:a.boundRect.x.hi=c.x.hi,s===1?a.boundRect.y.lo=c.y.lo:a.boundRect.y.hi=c.y.hi,a};var e=i.prototype;return e.cellID=function(){return this.id},e.paddingValue=function(){return this.padding},e.levelValue=function(){return this.level},e.center=function(){var n=Ca(this.level),r=2*this.iLo+n,s=2*this.jLo+n;return We.fromVector(wT(du(this.id),r,s).normalize())},e.middle=function(){if(this.middleRect.isEmpty()){var n=Ca(this.level),r=Ec(mp(2*this.iLo+n)),s=Ec(mp(2*this.jLo+n));this.middleRect=new Hr(new Li(r-this.padding,r+this.padding),new Li(s-this.padding,s+this.padding))}return this.middleRect},e.bound=function(){return this.boundRect},e.childIJ=function(n){var r=dD[this.orientation][n];return[r>>1,r&1]},e.entryVertex=function(){var n=this.iLo,r=this.jLo;if(this.orientation&Yf){var s=Ca(this.level);n+=s,r+=s}return We.fromVector(wT(du(this.id),2*n,2*r).normalize())},e.exitVertex=function(){var n=this.iLo,r=this.jLo,s=Ca(this.level);return this.orientation===0||this.orientation===Cc+Yf?n+=s:r+=s,We.fromVector(wT(du(this.id),2*n,2*r).normalize())},e.shrinkToFit=function(n){if(this.level===0&&(n.x.contains(0)||n.y.contains(0)))return this.id;var r=Ca(this.level);if(n.x.contains(Ec(mp(2*this.iLo+r)))||n.y.contains(Ec(mp(2*this.jLo+r))))return this.id;var s=n.expandedByMargin(this.padding+1.5*Ki),o=this.iLo,a=this.jLo,l=0,c=0;o<zl(ah(s.x.lo))&&(o=zl(ah(s.x.lo))),this.iLo+r-1<=zl(ah(s.x.hi))?l=o^this.iLo+r-1:l=o^zl(ah(s.x.hi)),a<zl(ah(s.y.lo))&&(a=zl(ah(s.y.lo))),this.jLo+r-1<=zl(ah(s.y.hi))?c=a^this.jLo+r-1:c=a^zl(ah(s.y.hi));var u=BigInt((l|c)<<1)+1n,f=_i-xH(u);return f<=this.level?this.id:Sr(Ay(du(this.id),o,a),f)},i})(),bp=0,xy=1,zT=2,uH=0,iy=2,E1=2*(_y+Tfe),Ffe=1,hH=(function(){function i(t,n,r,s,o,a,l){t===void 0&&(t=0),n===void 0&&(n=0),r===void 0&&(r=0),s===void 0&&(s=!1),o===void 0&&(o=new Ci(0,0)),a===void 0&&(a=new Ci(0,0)),l===void 0&&(l=new ch(new We(0,0,0),new We(0,0,0))),this.shapeID=t,this.edgeID=n,this.maxLevel=r,this.hasInterior=s,this.a=o,this.b=a,this.edge=l}var e=i.prototype;return e.copy=function(){return new i(this.shapeID,this.edgeID,this.maxLevel,this.hasInterior,new Ci(this.a.x,this.a.y),new Ci(this.b.x,this.b.y),new ch(We.fromVector(this.edge.v0.vector),We.fromVector(this.edge.v1.vector)))},i})(),qL=function(e,t){this.faceEdge=e,this.bound=t},LT=(function(){function i(){var t=this;this.iterator=function(){return t.maybeApplyUpdates(),new VL(t,aD)},this.begin=function(){return t.maybeApplyUpdates(),new VL(t,aD)},this.end=function(){return t.maybeApplyUpdates(),new VL(t,XH)},this.region=function(){return new Sfe(t,new yp(t,Zf))},this.len=function(){return t.shapes.size},this.reset=function(){t.shapes.clear(),t.nextID=0,t.cellMap.clear(),t.cells=[],t.status=iy},this.numEdges=function(){var n=0;return t.shapes.forEach(function(r){n+=r.numEdges()}),n},this.numEdgesUpTo=function(n){for(var r=0,s=0;s<=t.nextID;s++){var o=t.shape(s);if(!(o instanceof ry)&&(r+=o.numEdges(),r>=n))break}return r},this.shape=function(n){return t.shapes.get(n)||new ry},this.idForShape=function(n){for(var r=Ct(t.shapes.entries()),s;!(s=r()).done;){var o=s.value,a=o[0],l=o[1];if(l===n)return a}return-1},this.add=function(n){return t.shapes.set(t.nextID,n),t.nextID++,t.status=uH,t.nextID-1},this.remove=function(n){var r=t.idForShape(n);if(t.shapes.has(r)&&(t.shapes.delete(r),!(r>=t.pendingAdditionsPos))){for(var s=n.numEdges(),o=new Bfe(r,n.dimension()===2,n.referencePoint().contained,new Array(s)),a=0;a<s;a++)o.edges[a]=n.edge(a);t.pendingRemovals.push(o),t.status=uH}},this.build=function(){return t.maybeApplyUpdates()},this.isFresh=function(){return t.status===iy},this.isFirstUpdate=function(){return t.pendingAdditionsPos===0},this.isShapeBeingRemoved=function(n){return n<t.pendingAdditionsPos},this.maybeApplyUpdates=function(){t.status!==iy&&(t.applyUpdatesInternal(),t.status=iy)},this.applyUpdatesInternal=function(){for(var n=new wfe,r=Array.from({length:6},function(){return[]}),s=Ct(t.pendingRemovals),o;!(o=s()).done;){var a=o.value;t.removeShapeInternal(a,r,n)}for(var l=t.pendingAdditionsPos;l<t.shapes.size;l++)t.addShapeInternal(l,r,n);for(var c=0;c<6;c++)t.updateFaceEdges(c,r[c],n);t.pendingRemovals.length=0,t.pendingAdditionsPos=t.shapes.size},this.addShapeInternal=function(n,r,s){var o=t.shapes.get(n)||new ry;if(!(o instanceof ry)){var a=new hH(n,void 0,void 0,o.dimension()===2);a.hasInterior&&s.addShape(n,Nfe(o,s.focus()));for(var l=o.numEdges(),c=0;c<l;c++){var u=o.edge(c);a.edgeID=c,a.edge=u,a.maxLevel=fH(u),t.addFaceEdge(a,r)}}},this.addFaceEdge=function(n,r){var s=n.copy(),o=cy(s.edge.v0.vector);if(o===cy(s.edge.v1.vector)){var a=Ym(o,s.edge.v0.vector),l=a[0],c=a[1];s.a=new Ci(l,c);var u=Ym(o,s.edge.v1.vector);l=u[0],c=u[1],s.b=new Ci(l,c);var f=1-E1;if(Math.abs(s.a.x)<=f&&Math.abs(s.a.y)<=f&&Math.abs(s.b.x)<=f&&Math.abs(s.b.y)<=f){r[o].push(s);return}}for(var d=0;d<6;d++){var A=fy(s.edge.v0,s.edge.v1,d,E1),y=A[0],w=A[1],S=A[2];if(S){var T=n.copy();T.a=y,T.b=w,r[d].push(T)}}},this.updateFaceEdges=function(n,r,s){var o=r.length;if(!(o===0&&s.shapeIDs.length===0)){for(var a=Array(o),l=Hr.empty(),c=0;c<o;c++){var u=new qL(r[c],Hr.fromPoints(r[c].a,r[c].b));a[c]=u,l=l.addRect(u.bound)}var f=xp(n),d=Ma.fromCellID(f,E1),A=t.isFirstUpdate();if(o>0){var y=t.shrinkToFit(d,l);if(y!==d.id){t.skipCellRange(qi(f),qi(y),s,A),d=Ma.fromCellID(y,E1),t.updateEdges(d,a,s,A),t.skipCellRange(Ia(Gi(y)),Ia(Gi(f)),s,A);return}}t.updateEdges(d,a,s,A)}},this.shrinkToFit=function(n,r){var s=n.shrinkToFit(r);if(!t.isFirstUpdate()&&s!==n.id){var o=t.iterator();o.locateCellID(s)===bp&&(s=o.cellID())}return s},this.skipCellRange=function(n,r,s,o){if(s.shapeIDs.length!==0)for(var a=B1.fromRange(n,r),l=Ct(a),c;!(c=l()).done;){var u=c.value,f=[];t.updateEdges(Ma.fromCellID(u,E1),f,s,o)}},this.updateEdges=function(n,r,s,o){var a=!1;if(!o){var l=t.iterator(),c=l.locateCellID(n.id);c===zT?o=!0:c===bp&&(t.absorbIndexCell(n,l,r,s),a=!0,o=!0)}if(!o||!t.makeIndexCell(n,r,s)){for(var u=[[[],[]],[[],[]]],f=n.middle(),d=Ct(r),A;!(A=d()).done;){var y=A.value;if(y.bound.x.hi<=f.x.lo){var w=t.clipVAxis(y,f.y),S=w[0],T=w[1];S&&u[0][0].push(S),T&&u[0][1].push(T)}else if(y.bound.x.lo>=f.x.hi){var R=t.clipVAxis(y,f.y),P=R[0],I=R[1];P&&u[1][0].push(P),I&&u[1][1].push(I)}else if(y.bound.y.hi<=f.y.lo){var F=t.clipUBound(y,1,f.x.hi);F&&u[0][0].push(F);var D=t.clipUBound(y,0,f.x.lo);D&&u[1][0].push(D)}else if(y.bound.y.lo>=f.y.hi){var L=t.clipUBound(y,1,f.x.hi);L&&u[0][1].push(L);var C=t.clipUBound(y,0,f.x.lo);C&&u[1][1].push(C)}else{var B=t.clipUBound(y,1,f.x.hi),k=t.clipVAxis(B,f.y),z=k[0],G=k[1];z&&u[0][0].push(z),G&&u[0][1].push(G);var W=t.clipUBound(y,0,f.x.lo),Y=t.clipVAxis(W,f.y);z=Y[0],G=Y[1],z&&u[1][0].push(z),G&&u[1][1].push(G)}}for(var H=0;H<4;H++){var $=n.childIJ(H),J=$[0],te=$[1];(u[J][te].length>0||s.shapeIDs.length>0)&&t.updateEdges(Ma.fromParentIJ(n,J,te),u[J][te],s,o)}}a&&s.restoreStateBefore(t.pendingAdditionsPos)},this.makeIndexCell=function(n,r,s){if(r.length===0&&s.shapeIDs.length===0)return!0;for(var o=0,a=Ct(r),l;!(l=a()).done;){var c=l.value;if(n.level<c.faceEdge.maxLevel&&o++,o>t.maxEdgesPerCell)return!1}s.isActive&&r.length!==0&&(s.atCellID(n.id)||s.moveTo(n.entryVertex()),s.drawTo(n.center()),t.testAllEdges(r,s));for(var u=s.shapeIDs,f=t.countShapes(r,u),d=new bfe(f),A=0,y=0,w=0;w<f;w++){var S=void 0,T=t.shapes.size,R=T;A!==r.length&&(T=r[A].faceEdge.shapeID),y<u.length&&(R=u[y]);var P=A;if(R<T)S=new iH(R,0),S.containsCenter=!0,y++;else{for(;A<r.length&&r[A].faceEdge.shapeID===T;)A++;S=new iH(T,A-P);for(var I=P;I<A;I++)S.edges[I-P]=r[I].faceEdge.edgeID;R===T&&(S.containsCenter=!0,y++)}d.shapes[w]=S}return t.cellMap.set(n.id,d),t.cells.push(n.id),s.isActive&&r.length!==0&&(s.drawTo(n.exitVertex()),t.testAllEdges(r,s),s.setNextCellID(Ia(n.id))),!0},this.updateBound=function(n,r,s,o,a){var l=new qL(n.faceEdge,new Hr);return r===0?(l.bound.x.lo=s,l.bound.x.hi=n.bound.x.hi):(l.bound.x.lo=n.bound.x.lo,l.bound.x.hi=s),o===0?(l.bound.y.lo=a,l.bound.y.hi=n.bound.y.hi):(l.bound.y.lo=n.bound.y.lo,l.bound.y.hi=a),l},this.clipUBound=function(n,r,s){if(r===0&&n.bound.x.lo>=s||r===1&&n.bound.x.hi<=s)return n;var o=n.faceEdge,a=n.bound.y.clampPoint(O1(s,o.a.x,o.b.x,o.a.y,o.b.y)),l=o.a.x>o.b.x==o.a.y>o.b.y,c=r===1===l?1:0;return t.updateBound(n,r,s,c,a)},this.clipVBound=function(n,r,s){if(r===0&&n.bound.y.lo>=s||r===1&&n.bound.y.hi<=s)return n;var o=n.faceEdge,a=n.bound.x.clampPoint(O1(s,o.a.y,o.b.y,o.a.x,o.b.x)),l=o.a.x>o.b.x==o.a.y>o.b.y,c=r===1===l?1:0;return t.updateBound(n,c,a,r,s)},this.clipVAxis=function(n,r){return n.bound.y.hi<=r.lo?[n,void 0]:n.bound.y.lo>=r.hi?[void 0,n]:[t.clipVBound(n,1,r.hi),t.clipVBound(n,0,r.lo)]},this.absorbIndexCell=function(n,r,s,o){if(o.isActive&&s.length!==0&&t.isShapeBeingRemoved(s[0].faceEdge.shapeID)){o.atCellID(n.id)||o.moveTo(n.entryVertex()),o.drawTo(n.exitVertex()),o.setNextCellID(Ia(n.id));for(var a=Ct(s),l;!(l=a()).done;){var c=l.value,u=c.faceEdge;if(!t.isShapeBeingRemoved(u.shapeID))break;u.hasInterior&&o.testEdge(u.shapeID,u.edge)}}o.saveAndClearStateBefore(t.pendingAdditionsPos);var f=[],d=!1,A=r.indexCell();if(A)for(var y=Ct(A.shapes),w;!(w=y()).done;){var S=w.value,T=S.shapeID,R=t.shape(T);if(R){var P=S.numEdges(),I=new hH(T,void 0,void 0,R.dimension()===2);I.hasInterior&&(o.addShape(T,S.containsCenter),!d&&P>0&&(o.moveTo(n.center()),o.drawTo(n.entryVertex()),o.setNextCellID(n.id),d=!0));for(var F=0;F<P;F++){var D=S.edges[F];I.edgeID=D,I.edge=R.edge(D),I.maxLevel=fH(I.edge),I.hasInterior&&o.testEdge(T,I.edge);var L=fy(I.edge.v0,I.edge.v1,du(n.id),E1),C=L[0],B=L[1],k=L[2];if(!k)throw new Error("invariant failure in ShapeIndex");I.a=C,I.b=B,f.push(I)}}}for(var z=f.map(function(H){return new qL(H,Rfe(H.a,H.b,n.bound()))}),G=Ct(s),W;!(W=G()).done;){var Y=W.value;if(!t.isShapeBeingRemoved(Y.faceEdge.shapeID)){z.push.apply(z,s.slice(s.indexOf(Y)));break}}s=z,t.cellMap.delete(n.id)},this.testAllEdges=function(n,r){for(var s=Ct(n),o;!(o=s()).done;){var a=o.value;a.faceEdge.hasInterior&&r.testEdge(a.faceEdge.shapeID,a.faceEdge.edge)}},this.countShapes=function(n,r){for(var s=0,o=-1,a=0,l=0,c=Ct(n),u;!(u=c()).done;){var f=u.value;if(f.faceEdge.shapeID!==o)for(s++,o=f.faceEdge.shapeID;l<r.length&&(a=r[l],!(a>o));)a<o&&s++,l++}return s+=r.length-l,s},this.maxEdgesPerCell=10,this.nextID=0,this.shapes=new Map,this.cellMap=new Map,this.cells=[],this.status=iy,this.pendingAdditionsPos=0,this.pendingRemovals=[]}var e=i.prototype;return e.removeShapeInternal=function(n,r,s){},i})(),fH=function(e){var t=e.v0.vector.sub(e.v1.vector).norm()*Ffe;return cfe.minLevel(t)},Bfe=function(e,t,n,r){this.shapeID=e,this.hasInterior=t,this.containsTrackerOrigin=n,this.edges=r};function Ofe(){return{distance:Rc(),shapeID:-1,edgeID:-1}}function HL(i,e){return i.distance<e.distance?-1:i.distance>e.distance?1:i.shapeID<e.shapeID?-1:i.shapeID>e.shapeID?1:i.edgeID<e.edgeID?-1:i.edgeID>e.edgeID?1:0}var ZH=(function(){function i(){this.maxResults=1/0,this.maxDistance=Rc(),this.maxError=0,this.includeInteriors=!0,this.useBruteForce=!1}var e=i.prototype;return e.setInclusiveMaxDistance=function(n){this.maxDistance=F1(n)},e.setConservativeMaxDistance=function(n){this.maxDistance=F1(FT(n,hfe(n)))},e.clone=function(){var n=new i;return n.maxResults=this.maxResults,n.maxDistance=this.maxDistance,n.maxError=this.maxError,n.includeInteriors=this.includeInteriors,n.useBruteForce=this.useBruteForce,n},i})(),Ufe=(function(){function i(t){this._includeInteriors=!0,this.point=t}var e=i.prototype;return e.maxBruteForceIndexSize=function(){return 120},e.updateMinDistanceToEdge=function(n,r,s){var o=pu(this.point,n,r,s);return{distance:o.dist,updated:o.less}},e.updateMinDistanceToPoint=function(n,r){var s=We.chordAngleBetweenPoints(this.point,n);return s<r?{distance:s,updated:!0}:{distance:r,updated:!1}},e.updateMinDistanceToCell=function(n,r){var s=n.distance(this.point);return s<r?{distance:s,updated:!0}:{distance:r,updated:!1}},e.includeInteriors=function(){return this._includeInteriors},e.setIncludeInteriors=function(n){this._includeInteriors=n},e.setMaxError=function(n){return!1},e.visitContainingShapeIds=function(n,r){var s=this,o=new yp(n,Zf);return o.visitContainingShapes(this.point,function(a){var l=n.idForShape(a);return l>=0?r(l,s.point):!0})},e.getCapBound=function(){return{center:this.point,radius:0}},i})(),kfe=(function(){function i(t,n){this._includeInteriors=!0,this.a=t,this.b=n}var e=i.prototype;return e.maxBruteForceIndexSize=function(){return 60},e.updateMinDistanceToEdge=function(n,r,s){return QH(this.a,this.b,n,r,s)},e.updateMinDistanceToPoint=function(n,r){var s=pu(n,this.a,this.b,r);return{distance:s.dist,updated:s.less}},e.updateMinDistanceToCell=function(n,r){var s=n.distanceToEdge(this.a,this.b);return s<r?{distance:s,updated:!0}:{distance:r,updated:!1}},e.includeInteriors=function(){return this._includeInteriors},e.setIncludeInteriors=function(n){this._includeInteriors=n},e.setMaxError=function(n){return!1},e.visitContainingShapeIds=function(n,r){for(var s=new yp(n,Zf),o=new Set,a=function(){var d=u[c],A=s.visitContainingShapes(d,function(y){var w=n.idForShape(y);return w>=0&&!o.has(w)?(o.add(w),r(w,d)):!0});if(!A)return{v:!1}},l,c=0,u=[this.a,this.b];c<u.length;c++)if(l=a(),l)return l.v;return!0},e.getCapBound=function(){var n=We.fromVector(this.a.vector.add(this.b.vector).normalize()),r=Math.max(We.chordAngleBetweenPoints(n,this.a),We.chordAngleBetweenPoints(n,this.b));return{center:n,radius:r}},i})(),zfe=(function(){function i(t){this._includeInteriors=!0,this.cell=t}var e=i.prototype;return e.maxBruteForceIndexSize=function(){return 30},e.updateMinDistanceToEdge=function(n,r,s){var o=this.cell.distanceToEdge(n,r);return o<s?{distance:o,updated:!0}:{distance:s,updated:!1}},e.updateMinDistanceToPoint=function(n,r){var s=this.cell.distance(n);return s<r?{distance:s,updated:!0}:{distance:r,updated:!1}},e.updateMinDistanceToCell=function(n,r){var s=this.cell.distanceToCell(n);return s<r?{distance:s,updated:!0}:{distance:r,updated:!1}},e.includeInteriors=function(){return this._includeInteriors},e.setIncludeInteriors=function(n){this._includeInteriors=n},e.setMaxError=function(n){return!1},e.visitContainingShapeIds=function(n,r){var s=new yp(n,Zf),o=this.cell.center();return s.visitContainingShapes(o,function(a){var l=n.idForShape(a);return l>=0?r(l,o):!0})},e.getCapBound=function(){for(var n=this.cell.center(),r=0,s=0;s<4;s++){var o=We.chordAngleBetweenPoints(n,this.cell.vertex(s));o>r&&(r=o)}return{center:n,radius:r}},i})(),KH=(function(){function i(t){this._includeInteriors=!0,this.index=t,this.query=new yp(t,Zf)}var e=i.prototype;return e.maxBruteForceIndexSize=function(){return 25},e.updateMinDistanceToEdge=function(n,r,s){if(this._includeInteriors&&(this.query.contains(n)||this.query.contains(r)))return{distance:0,updated:s>0};for(var o=!1,a=Ct(this.index.shapes),l;!(l=a()).done;){var c=l.value,u=c[1];if(u)for(var f=u.numEdges(),d=0;d<f;d++){var A=u.edge(d),y=QH(n,r,A.v0,A.v1,s);if(y.updated&&(s=y.distance,o=!0),s===0)return{distance:0,updated:o}}}return{distance:s,updated:o}},e.updateMinDistanceToPoint=function(n,r){if(this._includeInteriors&&this.query.contains(n))return{distance:0,updated:r>0};for(var s=!1,o=Ct(this.index.shapes),a;!(a=o()).done;){var l=a.value,c=l[1];if(c)for(var u=c.numEdges(),f=0;f<u;f++){var d=c.edge(f),A=pu(n,d.v0,d.v1,r);if(A.less&&(r=A.dist,s=!0),r===0)return{distance:0,updated:s}}}return{distance:r,updated:s}},e.updateMinDistanceToCell=function(n,r){if(this._includeInteriors&&this.query.contains(n.center()))return{distance:0,updated:r>0};for(var s=!1,o=Ct(this.index.shapes),a;!(a=o()).done;){var l=a.value,c=l[1];if(c)for(var u=c.numEdges(),f=0;f<u;f++){var d=c.edge(f),A=n.distanceToEdge(d.v0,d.v1);if(A<r&&(r=A,s=!0),r===0)return{distance:0,updated:s}}}return{distance:r,updated:s}},e.includeInteriors=function(){return this._includeInteriors},e.setIncludeInteriors=function(n){this._includeInteriors=n},e.setMaxError=function(n){return!1},e.visitContainingShapeIds=function(n,r){for(var s=new yp(n,Zf),o=new Set,a=Ct(this.index.shapes),l;!(l=a()).done;){var c=l.value,u=c[1];if(u){for(var f=u.numEdges(),d=0;d<f;d++)for(var A=u.edge(d),y=function(){var P=T[S],I=s.visitContainingShapes(P,function(F){var D=n.idForShape(F);return D>=0&&!o.has(D)?(o.add(D),r(D,P)):!0});if(!I)return{v:!1}},w,S=0,T=[A.v0,A.v1];S<T.length;S++)if(w=y(),w)return w.v}}return!0},e.getCapBound=function(){if(this.index.len()===0)return null;for(var n=null,r=0,s=Ct(this.index.shapes),o;!(o=s()).done;){var a=o.value,l=a[1];if(l)for(var c=l.numEdges(),u=0;u<c;u++){var f=l.edge(u);n===null&&(n=f.v0);var d=We.chordAngleBetweenPoints(n,f.v0),A=We.chordAngleBetweenPoints(n,f.v1);r=Math.max(r,d,A)}}return n===null?null:{center:n,radius:r}},i})();function QH(i,e,t,n,r){if(r===0)return{distance:0,updated:!1};if(kH(i,e,t,n)===Mc)return{distance:0,updated:!0};var s=!1,o=pu(i,t,n,r);return o.less&&(r=o.dist,s=!0),o=pu(e,t,n,r),o.less&&(r=o.dist,s=!0),o=pu(t,i,e,r),o.less&&(r=o.dist,s=!0),o=pu(n,i,e,r),o.less&&(r=o.dist,s=!0),{distance:r,updated:s}}var Vfe=(function(){function i(t,n){n===void 0&&(n=new ZH),this.indexNumEdges=0,this.indexNumEdgesLimit=0,this.index=t,this.options=n,this.iter=t.iterator()}var e=i.prototype;return e.reInit=function(){this.indexNumEdges=0,this.indexNumEdgesLimit=0,this.iter=this.index.iterator()},e.findClosestEdges=function(n,r){return this.findClosestEdgesInternal(n,this.options,r)},e.visitClosestEdges=function(n,r,s,o){for(var a=this.findClosestEdgesInternal(n,r,o),l=Ct(a),c;!(c=l()).done;){var u=c.value;if(!s(u))break}},e.visitClosestShapes=function(n,r,s,o){for(var a=this.findClosestEdgesInternal(n,r,o),l=new Set,c=-1,u=Ct(a),f;!(f=u()).done;){var d=f.value,A=d.shapeID;if(A!==c&&!l.has(A)&&(l.add(A),c=A,!s(d)))break}},e.findClosestEdge=function(n,r){var s=this.options.clone();s.maxResults=1;var o=this.findClosestEdgesInternal(n,s,r);return o.length===0?Ofe():o[0]},e.getDistance=function(n,r){return this.findClosestEdge(n,r).distance},e.isDistanceLess=function(n,r,s){var o=this.options.clone();o.maxResults=1,o.maxDistance=r,o.maxError=Tc;var a=this.findClosestEdgesInternal(n,o,s);return a.length>0},e.isDistanceLessOrEqual=function(n,r,s){var o=this.options.clone();o.maxResults=1,o.setInclusiveMaxDistance(r),o.maxError=Tc;var a=this.findClosestEdgesInternal(n,o,s);return a.length>0},e.isConservativeDistanceLessOrEqual=function(n,r,s){var o=this.options.clone();o.maxResults=1,o.setConservativeMaxDistance(r),o.maxError=Tc;var a=this.findClosestEdgesInternal(n,o,s);return a.length>0},e.getEdge=function(n){var r=this.index.shape(n.shapeID);return r.edge(n.edgeID)},e.project=function(n,r){if(r.edgeID<0)return n;var s=this.getEdge(r);return VH(n,s.v0,s.v1)},e.findClosestEdgesInternal=function(n,r,s){var o=r.maxDistance,a=[];if(o===0)return a;if(r.includeInteriors){var l=new Set;n.visitContainingShapeIds(this.index,function(T,R){return(!s||s(T))&&l.add(T),l.size<r.maxResults});for(var c=Ct(l),u;!(u=c()).done;){var f=u.value;a.push({distance:0,shapeID:f,edgeID:-1})}if(o===0)return a}var d=n.maxBruteForceIndexSize()+1;d>this.indexNumEdgesLimit&&this.indexNumEdges>=this.indexNumEdgesLimit&&(this.indexNumEdges=this.countEdgesUpTo(d),this.indexNumEdgesLimit=d),r.useBruteForce||this.indexNumEdges<d?this.findClosestEdgesBruteForce(n,r,s,o,a):this.findClosestEdgesOptimized(n,r,s,o,a),a.sort(HL);for(var A=[],y=0,w=a;y<w.length;y++){var S=w[y];(A.length===0||A[A.length-1].shapeID!==S.shapeID||A[A.length-1].edgeID!==S.edgeID)&&A.push(S)}return A.length>r.maxResults&&(A.length=r.maxResults),A},e.findClosestEdgesBruteForce=function(n,r,s,o,a){for(var l=Ct(this.index.shapes),c;!(c=l()).done;){var u=c.value,f=u[0],d=u[1];if(d&&!(s&&!s(f)))for(var A=d.numEdges(),y=0;y<A;y++){var w=d.edge(y),S=n.updateMinDistanceToEdge(w.v0,w.v1,o);if(S.updated){var T={distance:S.distance,shapeID:f,edgeID:y};r.maxResults===1?(a.length===0?a.push(T):a[0]=T,o=S.distance-r.maxError):r.maxResults===1/0?a.push(T):(a.push(T),a.length>r.maxResults&&(a.sort(HL),a.length=r.maxResults,o=a[a.length-1].distance-r.maxError))}}}},e.findClosestEdgesOptimized=function(n,r,s,o,a){var l=n.getCapBound();if(l){if(this.iter=this.index.iterator(),r.maxResults===1&&this.iter.locatePoint(l.center)){var c=this.iter.indexCell();if(o=this.processIndexCell(n,r,s,c,o,a),o===0)return}var u=[];for(this.iter.begin();!this.iter.done();){var f=this.iter.cellID(),d=Ra.fromCellID(f),A=n.updateMinDistanceToCell(d,o);A.distance<o&&u.push({distance:A.distance,id:f,indexCell:this.iter.indexCell()}),this.iter.next()}for(u.sort(function(C,B){return C.distance-B.distance});u.length>0;){var y=u.shift();if(y.distance>=o)break;if(y.indexCell!==null)o=this.processIndexCell(n,r,s,y.indexCell,o,a);else{console.log("HEYYYY");for(var w=z1(y.id),S=Ct(w),T;!(T=S()).done;){var R=T.value,P=this.iter.locateCellID(R);if(P===bp){var I=Ra.fromCellID(this.iter.cellID()),F=n.updateMinDistanceToCell(I,o);F.distance<o&&u.push({distance:F.distance,id:this.iter.cellID(),indexCell:this.iter.indexCell()})}else if(P===xy){var D=Ra.fromCellID(R),L=n.updateMinDistanceToCell(D,o);L.distance<o&&u.push({distance:L.distance,id:R,indexCell:null})}}u.sort(function(C,B){return C.distance-B.distance})}}}},e.processIndexCell=function(n,r,s,o,a,l){for(var c=Ct(o.shapes),u;!(u=c()).done;){var f=u.value,d=f.shapeID;if(!(s&&!s(d))){var A=this.index.shape(d);if(A)for(var y=Ct(f.edges),w;!(w=y()).done;){var S=w.value,T=A.edge(S),R=n.updateMinDistanceToEdge(T.v0,T.v1,a);if(R.updated){var P={distance:R.distance,shapeID:d,edgeID:S};r.maxResults===1?(l.length===0?l.push(P):l[0]=P,a=R.distance-r.maxError):r.maxResults===1/0?l.push(P):(l.push(P),l.length>r.maxResults&&(l.sort(HL),l.length=r.maxResults,a=l[l.length-1].distance-r.maxError))}}}}return a},e.countEdgesUpTo=function(n){for(var r=0,s=Ct(this.index.shapes),o;!(o=s()).done;){var a=o.value,l=a[1];if(l&&(r+=l.numEdges(),r>=n))break}return r},i})();function Gfe(){return{distance:Rc(),cellID:0n,label:-1}}function qfe(i){return i.label<0}var JH=(function(){function i(){this.maxResults=1/0,this.maxDistance=Rc(),this.maxError=0}var e=i.prototype;return e.setInclusiveMaxDistance=function(n){this.maxDistance=F1(n)},e.setConservativeMaxDistance=function(n){this.maxDistance=F1(FT(n,this.computeMaxDistanceError(n)))},e.computeMaxDistanceError=function(n){return fD(n)},i})(),Hfe=(function(){function i(t){this.point=t}var e=i.prototype;return e.maxBruteForceIndexSize=function(){return 100},e.distanceToCell=function(n){return n.distance(this.point)},e.distanceToPoint=function(n){return We.chordAngleBetweenPoints(this.point,n)},i})(),Wfe=(function(){function i(t,n){this.a=t,this.b=n}var e=i.prototype;return e.maxBruteForceIndexSize=function(){return 100},e.distanceToCell=function(n){return n.distanceToEdge(this.a,this.b)},e.distanceToPoint=function(n){return pu(n,this.a,this.b,Rc()).dist},i})(),jfe=(function(){function i(t){this.cell=t}var e=i.prototype;return e.maxBruteForceIndexSize=function(){return 100},e.distanceToCell=function(n){return this.cell.distanceToCell(n)},e.distanceToPoint=function(n){return this.cell.distance(n)},i})(),Xfe=(function(){function i(t){this.cellUnion=t}var e=i.prototype;return e.maxBruteForceIndexSize=function(){return 100},e.distanceToCell=function(n){for(var r=Rc(),s=Ct(this.cellUnion),o;!(o=s()).done;){var a=o.value,l=Ra.fromCellID(a),c=l.distanceToCell(n);if(c<r&&(r=c),r===0)break}return r},e.distanceToPoint=function(n){for(var r=Rc(),s=Ct(this.cellUnion),o;!(o=s()).done;){var a=o.value,l=Ra.fromCellID(a),c=l.distance(n);if(c<r&&(r=c),r===0)break}return r},i})(),$fe=(function(){function i(t){this.index=t,this.edgeTarget=new KH(t)}var e=i.prototype;return e.setIncludeInteriors=function(n){this.edgeTarget.setIncludeInteriors(n)},e.maxBruteForceIndexSize=function(){return this.edgeTarget.maxBruteForceIndexSize()},e.distanceToCell=function(n){var r=this.edgeTarget.updateMinDistanceToCell(n,Rc());return r.distance},e.distanceToPoint=function(n){var r=this.edgeTarget.updateMinDistanceToPoint(n,Rc());return r.distance},i})(),Yfe=(function(){function i(t,n){n===void 0&&(n=new JH),this.index=t,this.options=n}var e=i.prototype;return e.findClosestCells=function(n){var r=new qH(this.index,!0),s=new HH(this.index),o=[];for(r.begin();!r.done();r.next())for(s.startUnion(r);!s.done();){var a=s.cellID(),l=s.label(),c=Ra.fromCellID(a);if(this.options.region&&!this.options.region.intersectsCell(c)){s.next();continue}var u=n.distanceToCell(c);u<this.options.maxDistance&&o.push({cellID:a,label:l,distance:u}),s.next()}o.sort(function(d,A){return d.distance-A.distance});var f=Math.min(o.length,this.options.maxResults);return o.slice(0,f)},e.findClosestCell=function(n){var r=this.options.maxResults;this.options.maxResults=1;var s=this.findClosestCells(n);return this.options.maxResults=r,s.length===0?Gfe():s[0]},e.getDistance=function(n){return this.findClosestCell(n).distance},e.isDistanceLess=function(n,r){var s=this.options.maxResults,o=this.options.maxDistance;this.options.maxResults=1,this.options.maxDistance=r;var a=this.findClosestCell(n);return this.options.maxResults=s,this.options.maxDistance=o,!qfe(a)},e.isDistanceLessOrEqual=function(n,r){return this.isDistanceLess(n,F1(r))},e.isConservativeDistanceLessOrEqual=function(n,r){return this.isDistanceLess(n,F1(FT(r,fD(r))))},i})(),U1=(function(){function i(){this.a=new We(0,0,0),this.aLL=new ar(0,0),this.bound=Ri.emptyRect()}i.maxErrorForTests=function(){return new ar(10*Ki,1*Ki)};var e=i.prototype;return e.addPoint=function(n){var r=ar.fromPoint(n);if(this.bound.isEmpty()){this.a=n,this.aLL=r,this.bound=this.bound.addPoint(r);return}var s=this.a.vector.sub(n.vector).cross(this.a.vector.add(n.vector)),o=s.norm();if(o<191346e-20){this.a.vector.dot(n.vector)<0?this.bound=Ri.fullRect():this.bound=this.bound.union(Ri.fromLatLng(this.aLL).addPoint(r)),this.a=n,this.aLL=r;return}var a=to.emptyInterval().addPoint(this.aLL.lng).addPoint(r.lng);a.length()>=Math.PI-2*Ki&&(a=to.fullInterval());var l=Li.fromPoint(this.aLL.lat).addPoint(r.lat),c=s.cross(new Wt(0,0,1)),u=c.dot(this.a.vector),f=c.dot(n.vector),d=606638e-21*o+683174e-36;if(u*f<0||Math.abs(u)<=d||Math.abs(f)<=d){var A=Math.min(Math.atan2(Math.sqrt(s.x*s.x+s.y*s.y),Math.abs(s.z))+3*Ki,Math.PI/2),y=2*Math.asin(.5*this.a.vector.sub(n.vector).norm()*Math.sin(A)),w=.5*(y-l.length())+Ki;u<=d&&f>=-d&&(l.hi=Math.min(A,l.hi+w)),f<=d&&u>=-d&&(l.lo=Math.max(-A,l.lo-w))}this.a=n,this.aLL=r,this.bound=this.bound.union(new Ri(l,a))},e.rectBound=function(){return this.bound.expanded(new ar(2*Ki,0)).polarClosure()},i})();U1.expandForSubregions=function(i){if(i.isEmpty())return i;var e=Math.max(0,Math.PI-i.lng.length()-2.5*Ki),t=Math.max(i.lat.lo,-i.lat.hi),n=Math.PI/2+i.lat.lo,r=Math.PI/2-i.lat.hi;if(t>=0){if(2*t+e<1354e-18)return Ri.fullRect()}else if(e>=Math.PI/2){if(n+r<1687e-18)return Ri.fullRect()}else if(Math.max(n,r)*e<1765e-18)return Ri.fullRect();var s=9*Ki,o=0;return e<=0&&(o=Math.PI),i.expanded(new ar(s,o)).polarClosure()};var eW=function(e,t,n,r,s){return We.orderedCCW(n,s,r,t)&&We.orderedCCW(r,e,n,t)},Zfe=function(e,t,n,r,s){return!(We.orderedCCW(e,s,r,t)&&We.orderedCCW(r,n,e,t))},Kfe=(function(){function i(t){this.a=new Ci(0,0),this.b=new Ci(0,0),this.index=t,this.iter=t.iterator(),this.cells=[]}var e=i.prototype;return e.crossings=function(n,r,s,o){var a=this.candidates(n,r,s);if(a.length===0)return[];for(var l=new Gl(n,r),c=0,u=a.length,f=0;f<u;f++){var d=s.edge(a[f]),A=l.crossingSign(d.v0,d.v1);(o===yT&&(A===PT||A===Mc)||o!==yT&&A===Mc)&&(a[c]=a[f],c++)}return c<u&&(a=a.slice(0,c)),a},e.crossingsEdgeMap=function(n,r,s){var o=this.candidatesEdgeMap(n,r);if(o.size===0)return o;var a=new Gl(n,r);return o.forEach(function(l,c){for(var u=l.length,f=0,d=0;d<u;d++){var A=c.edge(l[d]),y=a.crossingSign(A.v0,A.v1);(s===yT&&(y===PT||y===Mc)||s!==yT&&y===Mc)&&(l[f]=l[d],o.set(c,l),f++)}f===0?o.delete(c):f<u&&o.set(c,o.get(c).slice(0,f))}),o},e.candidates=function(n,r,s){var o=[],a=27,l=s.numEdges();if(l<=a)return o=Array.from({length:l},function(w,S){return S}),o;if(this.getCellsForEdge(n,r),this.cells.length===0)return[];var c=-1;this.index.shapes.forEach(function(w,S){w===s&&(c=S)});for(var u=Ct(this.cells),f;!(f=u()).done;){var d,A=f.value;if(A){var y=A.findByShapeID(c);y&&(d=o).push.apply(d,y.edges)}}return this.cells.length>1&&(o=i.uniqueInts(o)),o},i.uniqueInts=function(n){for(var r=[],s={},o=Ct(n),a;!(a=o()).done;){var l=a.value;s[l]||(s[l]=!0,r.push(l))}return r.sort(function(c,u){return c-u}),r},e.candidatesEdgeMap=function(n,r){var s=new Qfe;if(this.index.shapes.size===1){var o=this.index.shape(0);return s.set(o,this.candidates(n,r,o)),s}if(this.getCellsForEdge(n,r),this.cells.length===0)return s;for(var a=Ct(this.cells),l;!(l=a()).done;)for(var c=l.value,u=Ct(c.shapes),f;!(f=u()).done;)for(var d=f.value,A=this.index.shape(d.shapeID),y=0;y<d.numEdges();y++)s.set(A,(s.get(A)||[]).concat([d.edges[y]]));return this.cells.length>1&&s.forEach(function(w,S){s.set(S,i.uniqueInts(w))}),s},e.getCells=function(n,r,s){var o=Mfe(n,r,du(s.id)),a=o[0],l=o[1],c=o[2];if(c){this.a=a,this.b=l;var u=Hr.fromPoints(this.a,this.b);s.bound().intersects(u)&&this.computeCellsIntersected(s,u)}return this.cells.length===0?[]:this.cells},e.getCellsForEdge=function(n,r){this.cells=[];for(var s=Lfe(n,r),o=Ct(s),a;!(a=o()).done;){var l=a.value;this.a=l.a,this.b=l.b;var c=Hr.fromPoints(this.a,this.b),u=Ma.fromCellID(xp(l.face),0),f=u.shrinkToFit(c),d=this.iter.locateCellID(f);d===bp?this.cells.push(this.iter.indexCell()):d===xy&&(my(f)||(u=Ma.fromCellID(f,0)),this.computeCellsIntersected(u,c))}},e.computeCellsIntersected=function(n,r){if(this.iter.seek(qi(n.id)),!(this.iter.done()||this.iter.cellID()>Gi(n.id))){if(this.iter.cellID()===n.id){this.cells.push(this.iter.indexCell());return}var s=n.middle().lo();if(r.x.hi<s.x){this.clipVAxis(r,s.y,0,n);return}else if(r.x.lo>=s.x){this.clipVAxis(r,s.y,1,n);return}var o=this.splitUBound(r,s.x);r.y.hi<s.y?(this.computeCellsIntersected(Ma.fromParentIJ(n,0,0),o[0]),this.computeCellsIntersected(Ma.fromParentIJ(n,1,0),o[1])):r.y.lo>=s.y?(this.computeCellsIntersected(Ma.fromParentIJ(n,0,1),o[0]),this.computeCellsIntersected(Ma.fromParentIJ(n,1,1),o[1])):(this.clipVAxis(o[0],s.y,0,n),this.clipVAxis(o[1],s.y,1,n))}},e.clipVAxis=function(n,r,s,o){if(n.y.hi<r)this.computeCellsIntersected(Ma.fromParentIJ(o,s,0),n);else if(n.y.lo>=r)this.computeCellsIntersected(Ma.fromParentIJ(o,s,1),n);else{var a=this.splitVBound(n,r);this.computeCellsIntersected(Ma.fromParentIJ(o,s,0),a[0]),this.computeCellsIntersected(Ma.fromParentIJ(o,s,1),a[1])}},e.splitUBound=function(n,r){var s=n.y.clampPoint(O1(r,this.a.x,this.b.x,this.a.y,this.b.y)),o=this.a.x>this.b.x!=this.a.y>this.b.y?1:0;return this.splitBound(n,0,o,r,s)},e.splitVBound=function(n,r){var s=n.x.clampPoint(O1(r,this.a.y,this.b.y,this.a.x,this.b.x)),o=this.a.x>this.b.x!=this.a.y>this.b.y?1:0;return this.splitBound(n,o,0,s,r)},e.splitBound=function(n,r,s,o,a){var l=[Hr.fromRect(n),Hr.fromRect(n)];return r===1?(l[0].x.lo=o,l[1].x.hi=o):(l[0].x.hi=o,l[1].x.lo=o),s===1?(l[0].y.lo=a,l[1].y.hi=a):(l[0].y.hi=a,l[1].y.lo=a),l},i})(),Qfe=(function(i){function e(){return i.apply(this,arguments)||this}return dy(e,i),e})(D1(Map)),Jfe=function(e,t,n){var r=1,s=t.distance(n);s!==0&&(r=s/Math.sin(s));var o=1,a=n.distance(e);a!==0&&(o=a/Math.sin(a));var l=1,c=e.distance(t);c!==0&&(l=c/Math.sin(c));var u=new Wt(e.x,t.x-e.x,n.x-e.x),f=new Wt(e.y,t.y-e.y,n.y-e.y),d=new Wt(e.z,t.z-e.z,n.z-e.z),A=new Wt(r,o-r,l-r);return We.fromVector(new Wt(f.cross(d).dot(A),d.cross(u).dot(A),u.cross(f).dot(A)).mul(.5))},dH=new We(0,0,1),pH=new We(0,0,-1),cD=(function(){function i(t){this.originInside=!1,this.depth=0,this.bound=Ri.emptyRect(),this.subregionBound=Ri.emptyRect(),this.vertices=t,this.index=new LT,this.initOriginAndBound()}i.fromCell=function(n){var r=[n.vertex(0),n.vertex(1),n.vertex(2),n.vertex(3)];return new i(r)},i.fromLoop=function(n){return new i(n.vertices.map(function(r){return We.fromVector(r.vector)}))},i.emptyLoop=function(){return new i([dH])},i.fullLoop=function(){return new i([pH])};var e=i.prototype;return e.initOriginAndBound=function(){if(this.vertices.length<3){if(!this.isEmptyOrFull()){this.originInside=!1;return}this.originInside=this.vertices[0].z<0}else{var n=this.vertices[0]!==this.vertices[1]&&this.vertices[2]!==this.vertices[1]&&lfe(this.vertices[0],this.vertices[1],this.vertices[2]);this.originInside=!1,n!==this.containsPoint(this.vertices[1])&&(this.originInside=!0)}this.initBound(),this.index.add(this)},e.copyFrom=function(n){this.vertices=n.vertices,this.originInside=n.originInside,this.depth=n.depth,this.bound=n.bound,this.subregionBound=n.subregionBound,this.index=n.index},e.initBound=function(){if(this.vertices.length===0){this.copyFrom(i.emptyLoop());return}if(this.isEmptyOrFull()){this.isEmpty()?this.bound=Ri.emptyRect():this.bound=Ri.fullRect(),this.subregionBound=this.bound;return}for(var n=new U1,r=0;r<=this.vertices.length;r++)n.addPoint(this.vertex(r));var s=n.rectBound();this.containsPoint(new We(0,0,1))&&(s=new Ri(new Li(s.lat.lo,Math.PI/2),to.fullInterval())),s.lng.isFull()&&this.containsPoint(new We(0,0,-1))&&(s.lat.lo=-Math.PI/2),this.bound=s,this.subregionBound=U1.expandForSubregions(this.bound)},e.validate=function(){var n=this.findValidationErrorNoIndex();return n||null},e.findValidationErrorNoIndex=function(){for(var n=0;n<this.vertices.length;n++){var r=this.vertices[n];if(!r.vector.isUnit())return new Error("vertex "+n+" is not unit length")}if(this.vertices.length<3)return this.isEmptyOrFull()?null:new Error("non-empty, non-full loops must have at least 3 vertices");for(var s=0;s<this.vertices.length;s++){if(this.vertices[s].equals(this.vertex(s+1)))return new Error("edge "+s+" is degenerate (duplicate vertex)");var o=We.fromVector(this.vertex(s+1).vector.mul(-1));if(this.vertices[s].equals(o))return new Error("vertices "+s+" and "+(s+1)%this.vertices.length+" are antipodal")}return null},e.contains=function(n){if(!this.subregionBound.contains(n.bound))return!1;if(this.isEmptyOrFull()||n.isEmptyOrFull())return this.isFull()||n.isEmpty();var r=new ede;return WL(this,n,r)?!1:r.foundSharedVertex?!0:!(!this.containsPoint(n.vertex(0))||(n.subregionBound.contains(this.bound)||n.bound.union(this.bound).isFull())&&n.containsPoint(this.vertex(0)))},e.intersects=function(n){if(!this.bound.intersects(n.bound))return!1;var r=new tde;return WL(this,n,r)?!0:r.foundSharedVertex?!1:!!((this.subregionBound.contains(n.bound)||this.bound.union(n.bound).isFull())&&this.containsPoint(n.vertex(0))||n.subregionBound.contains(this.bound)&&n.containsPoint(this.vertex(0)))},e.equal=function(n){if(this.vertices.length!==n.vertices.length)return!1;for(var r=0;r<this.vertices.length;r++)if(this.vertices[r]!==n.vertex(r))return!1;return!0},e.boundaryEqual=function(n){if(this.vertices.length!==n.vertices.length)return!1;if(this.isEmptyOrFull())return this.isEmpty()===n.isEmpty();for(var r=0;r<this.vertices.length;r++)if(this.vertices[r].equals(n.vertex(0))){for(var s=0;s<this.vertices.length;s++)if(this.vertex(s+r)!==n.vertex(s))return!1;return!0}return!1},e.compareBoundary=function(n){if(!this.bound.intersects(n.bound))return-1;if(this.isFull())return 1;if(n.isFull())return-1;var r=new nde(n.isHole());return WL(this,n,r)?0:r.foundSharedVertex?r.containsEdge?1:-1:this.containsPoint(n.vertex(0))?1:-1},e.containsOrigin=function(){return this.originInside},e.referencePoint=function(){return kT(this.originInside)},e.numEdges=function(){return this.isEmptyOrFull()?0:this.vertices.length},e.edge=function(n){return new ch(this.vertex(n),this.vertex(n+1))},e.numChains=function(){return this.isEmpty()?0:1},e.chain=function(n){return new L1(0,this.numEdges())},e.chainEdge=function(n,r){return new ch(this.vertex(r),this.vertex(r+1))},e.chainPosition=function(n){return new UT(0,n)},e.dimension=function(){return 2},e.typeTag=function(){return WH},e.privateInterface=function(){},e.isEmpty=function(){return this.isEmptyOrFull()&&!this.containsOrigin()},e.isFull=function(){return this.isEmptyOrFull()&&this.containsOrigin()},e.isEmptyOrFull=function(){return this.vertices.length===1},e.rectBound=function(){return this.bound},e.capBound=function(){return this.bound.capBound()},e.vertex=function(n){return this.vertices[n%this.vertices.length]},e.orientedVertex=function(n){var r=n-this.vertices.length;return r<0&&(r=n),this.isHole()&&(r=this.vertices.length-1-r),this.vertex(r)},e.numVertices=function(){return this.vertices.length},e.bruteForceContainsPoint=function(n){for(var r=We.originPoint(),s=this.originInside,o=Gl.newChainEdgeCrosser(r,n,this.vertex(0)),a=1;a<=this.vertices.length;a++)s=s!==o.edgeOrVertexChainCrossing(this.vertex(a));return s},e.containsPoint=function(n){if(!this.index.isFresh()&&!this.bound.containsPoint(n))return!1;var r=32;if(this.index.shapes.size===0||this.vertices.length<=r)return this.bruteForceContainsPoint(n);var s=this.index.iterator();return s.locatePoint(n)?this.iteratorContainsPoint(s,n):!1},e.containsCell=function(n){var r=this.index.iterator(),s=r.locateCellID(n.id);return s!==bp||this.boundaryApproxIntersects(r,n)?!1:this.iteratorContainsPoint(r,n.center())},e.intersectsCell=function(n){var r=this.index.iterator(),s=r.locateCellID(n.id);return s===zT?!1:s===xy||r.cellID()===n.id||this.boundaryApproxIntersects(r,n)?!0:this.iteratorContainsPoint(r,n.center())},e.cellUnionBound=function(){return this.capBound().cellUnionBound()},e.boundaryApproxIntersects=function(n,r){var s=n.indexCell().findByShapeID(0);if(s.edges.length===0)return!1;if(n.cellID()===r.id)return!0;for(var o=_y+$H,a=r.boundUV().expandedByMargin(o),l=Ct(s.edges),c;!(c=l()).done;){var u=c.value,f=fy(this.vertex(u),this.vertex(u+1),r.face,o),d=f[0],A=f[1],y=f[2];if(y&&YH(d,A,a))return!0}return!1},e.iteratorContainsPoint=function(n,r){var s,o=(s=n.indexCell())==null?void 0:s.findByShapeID(0),a=o?.containsCenter||!1;if(o&&o.edges.length>0)for(var l=n.center(),c=new Gl(l,r),u=-2,f=Ct(o.edges),d;!(d=f()).done;){var A=d.value;A!==u+1&&c.restartAt(this.vertex(A)),u=A,a=a!==c.edgeOrVertexChainCrossing(this.vertex(A+1))}return a},i.regularLoop=function(n,r,s){return i.regularLoopForFrame(pD(n),r,s)},i.regularLoopForFrame=function(n,r,s){return new i(We.regularPointsForFrame(n,r,s))},e.canonicalFirstVertex=function(){for(var n=0,r=this.vertices.length,s=1;s<r;s++)this.vertex(s).vector.cmp(this.vertex(n).vector)===-1&&(n=s);return this.vertex(n+1).vector.cmp(this.vertex(n+r-1).vector)===-1?[n,1]:(n+=r,[n,-1])},e.turningAngle=function(){if(this.isEmptyOrFull())return this.containsOrigin()?-2*Math.PI:2*Math.PI;if(this.vertices.length<3)return 0;for(var n=this.canonicalFirstVertex(),r=n[0],s=n[1],o=tH(this.vertex((r+this.vertices.length-s)%this.vertices.length),this.vertex(r),this.vertex((r+s)%this.vertices.length)),a=0,l=this.vertices.length-1;l>0;l--){r+=s;var c=tH(this.vertex(r-s),this.vertex(r),this.vertex(r+s)),u=o;o+=c+a,a=u-o+c}var f=2*Math.PI-4*Ki;return Math.max(-f,Math.min(f,s*(o+a)))},e.turningAngleMaxError=function(){var n=11.25*Ki;return n*this.vertices.length},e.isHole=function(){return(this.depth&1)!==0},e.sign=function(){return this.isHole()?-1:1},e.isNormalized=function(){return this.bound.lng.length()<Math.PI?!0:this.turningAngle()>=-this.turningAngleMaxError()},e.normalize=function(){this.isNormalized()||this.invert()},e.invert=function(){if(this.index.reset(),this.isEmptyOrFull())this.vertices[0]=this.isFull()?dH:pH;else for(var n=Math.floor(this.vertices.length/2)-1;n>=0;n--){var r=this.vertices.length-1-n,s=[this.vertices[r],this.vertices[n]];this.vertices[n]=s[0],this.vertices[r]=s[1]}this.originInside=!this.originInside,this.bound.lat.lo>-Math.PI/2&&this.bound.lat.hi<Math.PI/2?(this.bound=Ri.fullRect(),this.subregionBound=this.bound):this.initBound(),this.index.add(this)},e.findVertex=function(n){var r=0;if(this.vertices.length<10){for(var s=1;s<=this.vertices.length;s++)if(this.vertex(s).equals(n))return[s,!0];return[r,!1]}var o=this.index.iterator();if(!o.locatePoint(n))return[r,!1];for(var a=o.indexCell().findByShapeID(0),l=a.numEdges()-1;l>=0;l--){var c=a.edges[l];if(this.vertex(c).equals(n))return c===0?[this.vertices.length,!0]:[c,!0];if(this.vertex(c+1).equals(n))return[c+1,!0]}return[r,!1]},e.containsNested=function(n){if(!this.subregionBound.contains(n.bound))return!1;if(this.isEmptyOrFull()||n.numVertices()<2)return this.isFull()||n.isEmpty();var r=this.findVertex(n.vertex(1)),s=r[0],o=r[1];return o?eW(this.vertex(s-1),this.vertex(s),this.vertex(s+1),n.vertex(0),n.vertex(2)):this.containsPoint(n.vertex(1))},e.surfaceIntegralFloat64=function(n){for(var r=Math.PI-1e-5,s=0,o=this.vertex(0),a=1;a+1<this.vertices.length;a++){if(this.vertex(a+1).vector.angle(o.vector)>r){var l=o;o.equals(this.vertex(0))?o=We.fromVector(this.vertex(0).pointCross(this.vertex(a)).vector.normalize()):this.vertex(a).vector.angle(this.vertex(0).vector)<r?o=this.vertex(0):(o=We.fromVector(this.vertex(0).vector.cross(l.vector)),s+=n(this.vertex(0),l,o)),s+=n(l,this.vertex(a),o)}s+=n(o,this.vertex(a),this.vertex(a+1))}return o!==this.vertex(0)&&(s+=n(o,this.vertex(this.vertices.length-1),this.vertex(0))),s},e.surfaceIntegralPoint=function(n){for(var r=Math.PI-1e-5,s=new We(0,0,0).vector,o=this.vertex(0),a=1;a+1<this.vertices.length;a++){if(this.vertex(a+1).vector.angle(o.vector)>r){var l=o;o.equals(this.vertex(0))?o=We.fromVector(this.vertex(0).pointCross(this.vertex(a)).vector.normalize()):this.vertex(a).vector.angle(this.vertex(0).vector)<r?o=this.vertex(0):(o=We.fromVector(this.vertex(0).vector.cross(l.vector)),s=s.add(n(this.vertex(0),l,o).vector)),s=s.add(n(l,this.vertex(a),o).vector)}s=s.add(n(o,this.vertex(a),this.vertex(a+1)).vector)}return o!==this.vertex(0)&&(s=s.add(n(o,this.vertex(this.vertices.length-1),this.vertex(0)).vector)),We.fromVector(s)},e.area=function(){if(this.isEmptyOrFull())return this.containsOrigin()?4*Math.PI:0;var n=this.surfaceIntegralFloat64(mfe),r=this.turningAngleMaxError();return n<0&&(n+=4*Math.PI),n>4*Math.PI&&(n=4*Math.PI),n<0&&(n=0),n<r&&!this.isNormalized()?4*Math.PI:n>4*Math.PI-r&&this.isNormalized()?0:n},e.centroid=function(){return this.surfaceIntegralPoint(Jfe)},e.containsNonCrossingBoundary=function(n,r){if(!this.bound.intersects(n.bound))return!1;if(this.isFull())return!0;if(n.isFull())return!1;var s=this.findVertex(n.vertex(0)),o=s[0],a=s[1];return a?nW(this.vertex(o-1),this.vertex(o),this.vertex(o+1),n.vertex(1),r):this.containsPoint(n.vertex(0))},i})(),DT=function(e,t){return!e.containsCenter&&t===tW||e.containsCenter&&t===NT},WL=function(e,t,n){for(var r=new cH(e.index),s=new cH(t.index),o=new AH(e,t,n,!1),a=new AH(t,e,n,!0);!r.done()||!s.done();)if(r.rangeMax<s.rangeMin)r.seekTo(s);else if(s.rangeMax<r.rangeMin)s.seekTo(r);else{var l=as(r.it.cellID())-as(s.it.cellID());if(l>0){if(o.hasCrossingRelation(r,s))return!0}else if(l<0){if(a.hasCrossingRelation(s,r))return!0}else{var c=r.it.indexCell().shapes[0],u=s.it.indexCell().shapes[0];if(DT(c,o.aCrossingTarget)&&DT(u,o.bCrossingTarget)||c.numEdges()>0&&u.numEdges()>0&&o.cellCrossesCell(c,u))return!0;r.next(),s.next()}}return!1},mH=0,tW=1,NT=2,ede=(function(){function i(){this.foundSharedVertex=!1}var e=i.prototype;return e.aCrossingTarget=function(){return tW},e.bCrossingTarget=function(){return NT},e.wedgesCross=function(n,r,s,o,a){return this.foundSharedVertex=!0,!eW(n,r,s,o,a)},i})(),tde=(function(){function i(){this.foundSharedVertex=!1}var e=i.prototype;return e.aCrossingTarget=function(){return NT},e.bCrossingTarget=function(){return NT},e.wedgesCross=function(n,r,s,o,a){return this.foundSharedVertex=!0,Zfe(n,r,s,o,a)},i})(),nde=(function(){function i(t){this.foundSharedVertex=!1,this.containsEdge=!1,this.excludesEdge=!1,this.reverse=t}var e=i.prototype;return e.aCrossingTarget=function(){return mH},e.bCrossingTarget=function(){return mH},e.wedgesCross=function(n,r,s,o,a){return this.foundSharedVertex=!0,nW(n,r,s,a,this.reverse)?this.containsEdge=!0:this.excludesEdge=!0,this.containsEdge&&this.excludesEdge},i})(),nW=function(e,t,n,r,s){return r.equals(e)||r.equals(n)?r.equals(e)===s:We.orderedCCW(e,n,r,t)},AH=(function(){function i(t,n,r,s){if(this.crosser=null,this.aj=0,this.bjPrev=-2,this.bCells=[],this.a=t,this.b=n,this.relation=r,this.swapped=s,this.aCrossingTarget=r.aCrossingTarget(),this.bCrossingTarget=r.bCrossingTarget(),this.bQuery=new Kfe(n.index),s){var o=[this.bCrossingTarget,this.aCrossingTarget];this.aCrossingTarget=o[0],this.bCrossingTarget=o[1]}}var e=i.prototype;return e.startEdge=function(n){this.crosser=new Gl(this.a.vertex(n),this.a.vertex(n+1)),this.aj=n,this.bjPrev=-2},e.edgeCrossesCell=function(n){for(var r=n.numEdges(),s=0;s<r;s++){var o,a=n.edges[s];if(a!==this.bjPrev+1){var l;(l=this.crosser)==null||l.restartAt(this.b.vertex(a))}this.bjPrev=a;var c=(o=this.crosser)==null?void 0:o.chainCrossingSign(this.b.vertex(a+1));if(c!==Vl){if(c===Mc)return!0;if(this.a.vertex(this.aj+1).equals(this.b.vertex(a+1))){if(this.swapped){if(this.relation.wedgesCross(this.b.vertex(a),this.b.vertex(a+1),this.b.vertex(a+2),this.a.vertex(this.aj),this.a.vertex(this.aj+2)))return!0}else if(this.relation.wedgesCross(this.a.vertex(this.aj),this.a.vertex(this.aj+1),this.a.vertex(this.aj+2),this.b.vertex(a),this.b.vertex(a+2)))return!0}}}return!1},e.cellCrossesCell=function(n,r){for(var s=Ct(n.edges),o;!(o=s()).done;){var a=o.value;if(this.startEdge(a),this.edgeCrossesCell(r))return!0}return!1},e.cellCrossesAnySubcell=function(n,r){for(var s=Ma.fromCellID(r,0),o=Ct(n.edges),a;!(a=o()).done;){var l=a.value;if(this.bCells=this.bQuery.getCells(this.a.vertex(l),this.a.vertex(l+1),s),this.bCells.length!==0){this.startEdge(l);for(var c=Ct(this.bCells),u;!(u=c()).done;){var f=u.value;if(this.edgeCrossesCell(f.shapes[0]))return!0}}}return!1},e.hasCrossing=function(n,r){var s=20,o=0;for(this.bCells=[];;){var a=r.it.indexCell().shapes[0].numEdges();if(a>0){if(o+=a,o>=s)return this.cellCrossesAnySubcell(n.it.indexCell().shapes[0],n.cellID())?!0:(r.seekBeyond(n),!1);this.bCells.push(r.indexCell())}if(r.next(),r.cellID()>n.rangeMax)break}for(var l=Ct(this.bCells),c;!(c=l()).done;){var u=c.value;if(this.cellCrossesCell(n.it.indexCell().shapes[0],u.shapes[0]))return!0}return!1},e.hasCrossingRelation=function(n,r){var s=n.it.indexCell().shapes[0];if(s.numEdges()!==0)return this.hasCrossing(n,r)?!0:(n.next(),!1);if(DT(s,this.aCrossingTarget))return r.seekBeyond(n),n.next(),!1;for(;r.cellID()<=n.rangeMax;){var o=r.it.indexCell().shapes[0];if(DT(o,this.bCrossingTarget))return!0;r.next()}return n.next(),!1},i})(),ide=(function(){function i(t){var n=this;if(t===void 0&&(t=[]),this.loops=[],this.index=new LT,this.hasHoles=!1,this.numVertices=0,this.nEdges=0,this.bound=Ri.emptyRect(),this.subregionBound=Ri.emptyRect(),this.cumulativeEdges=[],this.initLoops=function(r){var s=new Array;s.push(null);for(var o=-1;s.length>0;){var a=s.pop();a!=null&&(o=a.depth,n.loops.push(a));for(var l=r.get(a)||[],c=l.length-1;c>=0;c--){var u=l[c];u.depth=o+1,s.push(u)}}},t.length===1&&t[0].isEmpty()){this.initLoopProperties();return}this.loops=t,this.initNested()}i.fromOrientedLoops=function(n){for(var r=new Map,s=Ct(n),o;!(o=s()).done;){var a=o.value;r.set(a,a.containsOrigin())}for(var l=Ct(n),c;!(c=l()).done;){var u=c.value,f=u.turningAngle();Math.abs(f)>u.turningAngleMaxError()?f<0&&u.invert():u.containsOrigin()&&u.invert()}var d=new i(n);if(d.numLoops()>0){for(var A=d.loop(0),y=!1,w=Ct(d.loops),S;!(S=w()).done;){var T=S.value;T.containsOrigin()&&(y=!y,A=T)}r.get(A)!==y&&d.invert()}return d};var e=i.prototype;return e.invert=function(){if(this.isEmpty()){Object.assign(this,i.fullPolygon()),this.initLoopProperties();return}if(this.isFull()){Object.assign(this,new i),this.initLoopProperties();return}for(var n=0,r=10,s=r,o=1;o<this.numLoops();o++)if(this.loop(o).depth===0){s===r&&(s=this.loop(n).turningAngle());var a=this.loop(o).turningAngle();(a<s||a===s&&this.compareLoops(this.loop(o),this.loop(n))<0)&&(n=o,s=a)}this.loop(n).invert();var l=[],c=this.lastDescendant(n);l.push(this.loop(n));for(var u=0;u<this.loops.length;u++)(u<n||u>c)&&(this.loop(u).depth++,l.push(this.loop(u)));for(var f=0;f<this.loops.length;f++)f>n&&f<=c&&(this.loop(f).depth--,l.push(this.loop(f)));this.loops=l,this.initLoopProperties()},e.compareLoops=function(n,r){if(n.numVertices()!==r.numVertices())return n.numVertices()-r.numVertices();var s=n.canonicalFirstVertex(),o=s[0],a=s[1],l=r.canonicalFirstVertex(),c=l[0],u=l[1];if(a!==u)return a-u;for(var f=n.numVertices()-1;f>=0;f--,o+=a,c+=u){var d=n.vertex(o).vector.cmp(r.vertex(c).vector);if(d!==0)return d}return 0},i.fromCell=function(n){return new i([cD.fromCell(n)])},e.initNested=function(){if(this.loops.length===1){this.initOneLoop();return}var n=new rde;this.loops.forEach(function(r){n.insertLoop(r,null)}),this.loops=[],this.initLoops(n),this.initLoopProperties()},e.initOneLoop=function(){this.hasHoles=!1,this.numVertices=this.loops[0].vertices.length,this.bound=this.loops[0].rectBound(),this.subregionBound=U1.expandForSubregions(this.bound),this.loops[0].depth=0,this.initEdgesAndIndex()},e.initLoopProperties=function(){this.numVertices=0,this.bound=Ri.emptyRect(),this.hasHoles=!1;for(var n=Ct(this.loops),r;!(r=n()).done;){var s=r.value;s.isHole()?this.hasHoles=!0:this.bound=this.bound.union(s.rectBound()),this.numVertices+=s.numVertices()}this.subregionBound=U1.expandForSubregions(this.bound),this.initEdgesAndIndex()},e.initEdgesAndIndex=function(){if(this.nEdges=0,this.cumulativeEdges=[],!this.isFull()){var n=12;this.loops.length>n&&(this.cumulativeEdges=[]);for(var r=Ct(this.loops),s;!(s=r()).done;){var o=s.value;this.cumulativeEdges.length>0&&this.cumulativeEdges.push(this.nEdges),this.nEdges+=o.vertices.length}this.index=new LT,this.index.add(this)}},i.fullPolygon=function(){var n=cD.fullLoop(),r=new i;return r.loops=[n],r.numVertices=n.vertices.length,r.bound=Ri.fullRect(),r.subregionBound=Ri.fullRect(),r.initEdgesAndIndex(),r},e.validate=function(){for(var n=0;n<this.loops.length;n++){var r=this.loops[n],s=r.findValidationErrorNoIndex();if(s)return new Error("loop "+n+": "+s.message);if(r.isEmpty())return new Error("loop "+n+": empty loops are not allowed");if(r.isFull()&&this.loops.length>1)return new Error("loop "+n+": full loop appears in non-full polygon")}return this.findLoopNestingError()},e.findLoopNestingError=function(){for(var n=-1,r=0;r<this.loops.length;r++){var s=this.loops[r].depth;if(s<0||s>n+1)return new Error("loop "+r+": invalid loop depth ("+s+")");n=s}for(var o=0;o<this.loops.length;o++)for(var a=this.loops[o],l=this.lastDescendant(o),c=0;c<this.loops.length;c++)if(o!==c){var u=c>=o+1&&c<=l,f=!1;if(a.containsNonCrossingBoundary(this.loops[c],f)!==u){var d=u?"":"not ";return new Error("invalid nesting: loop "+o+" should "+d+"contain loop "+c)}}return null},e.isEmpty=function(){return this.loops.length===0},e.isFull=function(){return this.loops.length===1&&this.loops[0].isFull()},e.numLoops=function(){return this.loops.length},e.loop=function(n){return this.loops[n]},e.parent=function(n){var r,s=((r=this.loops[n])==null?void 0:r.depth)||0;if(s===0)return[-1,!1];for(n--;n>=0&&this.loops[n].depth<=s;n--);return[n,!0]},e.lastDescendant=function(n){var r;if(n<0)return this.loops.length-1;var s=((r=this.loops[n])==null?void 0:r.depth)||0;for(n++;n<this.loops.length&&this.loops[n].depth>s;n++);return n-1},e.capBound=function(){return this.bound.capBound()},e.rectBound=function(){return this.bound},e.containsPoint=function(n){if(!this.index.isFresh()&&!this.bound.containsPoint(n))return!1;var r=32;if(this.numVertices<r||this.index==null){for(var s=!1,o=Ct(this.loops),a;!(a=o()).done;){var l=a.value;s=s!==l.bruteForceContainsPoint(n)}return s}return new yp(this.index,Zf).contains(n)},e.containsCell=function(n){var r=this.index.iterator(),s=r.locateCellID(n.id);return s!==bp||this.boundaryApproxIntersects(r,n)?!1:this.iteratorContainsPoint(r,n.center())},e.intersectsCell=function(n){var r=this.index.iterator(),s=r.locateCellID(n.id);return s===zT?!1:s===xy||r.cellID()===n.id||this.boundaryApproxIntersects(r,n)?!0:this.iteratorContainsPoint(r,n.center())},e.cellUnionBound=function(){return this.capBound().cellUnionBound()},e.boundaryApproxIntersects=function(n,r){var s=n.indexCell().findByShapeID(0);if(s.edges.length===0)return!1;if(n.cellID()===r.id)return!0;for(var o=_y+$H,a=r.boundUV().expandedByMargin(o),l=Ct(s.edges),c;!(c=l()).done;){var u=c.value,f=this.index.shape(0).edge(u),d=fy(f.v0,f.v1,r.face,o),A=d[0],y=d[1],w=d[2];if(w&&YH(A,y,a))return!0}return!1},e.iteratorContainsPoint=function(n,r){var s=n.indexCell().findByShapeID(0),o=s.containsCenter;if(s.edges.length===0)return o;for(var a=new Gl(n.center(),r),l=this.index.shape(0),c=Ct(s.edges),u;!(u=c()).done;){var f=u.value,d=l.edge(f);o=o!==a.edgeOrVertexCrossing(d.v0,d.v1)}return o},e.numEdges=function(){return this.nEdges},e.edge=function(n){var r=0;if(this.cumulativeEdges.length>0){for(r=0;r<this.cumulativeEdges.length;r++)if(r+1>=this.cumulativeEdges.length||n<this.cumulativeEdges[r+1]){n-=this.cumulativeEdges[r];break}}else for(r=0;n>=this.loop(r).vertices.length;r++)n-=this.loop(r).vertices.length;return new ch(this.loop(r).orientedVertex(n),this.loop(r).orientedVertex(n+1))},e.referencePoint=function(){for(var n=!1,r=Ct(this.loops),s;!(s=r()).done;){var o=s.value;n=n!==o.containsOrigin()}return kT(n)},e.numChains=function(){return this.numLoops()},e.chain=function(n){if(this.cumulativeEdges.length>0)return new L1(this.cumulativeEdges[n],this.loop(n).vertices.length);for(var r=0,s=0;s<n;s++)r+=this.loop(s).vertices.length;var o=this.loop(n).numVertices();return o!==1?new L1(r,o):new L1(r,0)},e.chainEdge=function(n,r){return new ch(this.loop(n).orientedVertex(r),this.loop(n).orientedVertex(r+1))},e.chainPosition=function(n){var r=0;if(this.cumulativeEdges.length>0){for(r=0;r<this.cumulativeEdges.length;r++)if(r+1>=this.cumulativeEdges.length||n<this.cumulativeEdges[r+1]){n-=this.cumulativeEdges[r];break}}else for(r=0;n>=this.loop(r).vertices.length;r++)n-=this.loop(r).vertices.length;return new UT(r,n)},e.dimension=function(){return 2},e.typeTag=function(){return vfe},e.privateInterface=function(){},e.contains=function(n){if(this.loops.length===1&&n.loops.length===1)return this.loops[0].contains(n.loops[0]);if(!this.subregionBound.contains(n.bound)&&!this.bound.lng.union(n.bound.lng).isFull())return!1;if(!this.hasHoles&&!n.hasHoles){for(var r=Ct(n.loops),s;!(s=r()).done;){var o=s.value;if(!this.anyLoopContains(o))return!1}return!0}return this.containsBoundary(n)&&n.excludesNonCrossingComplementShells(this)},e.intersects=function(n){if(this.loops.length===1&&n.loops.length===1)return this.loops[0].intersects(n.loops[0]);if(!this.bound.intersects(n.bound))return!1;if(!this.hasHoles&&!n.hasHoles){for(var r=Ct(n.loops),s;!(s=r()).done;){var o=s.value;if(this.anyLoopIntersects(o))return!0}return!1}return!this.excludesBoundary(n)||!n.excludesNonCrossingShells(this)},e.compareBoundary=function(n){for(var r=-1,s=0;s<this.loops.length&&r!==0;s++)r*=-this.loops[s].compareBoundary(n);return r},e.containsBoundary=function(n){for(var r=Ct(n.loops),s;!(s=r()).done;){var o=s.value;if(this.compareBoundary(o)<=0)return!1}return!0},e.excludesBoundary=function(n){for(var r=Ct(n.loops),s;!(s=r()).done;){var o=s.value;if(this.compareBoundary(o)>=0)return!1}return!0},e.containsNonCrossingBoundary=function(n,r){for(var s=!1,o=Ct(this.loops),a;!(a=o()).done;){var l=a.value,c=l.containsNonCrossingBoundary(n,r);s=s!=c}return s},e.excludesNonCrossingShells=function(n){for(var r=Ct(n.loops),s;!(s=r()).done;){var o=s.value;if(!o.isHole()&&this.containsNonCrossingBoundary(o,!1))return!1}return!0},e.excludesNonCrossingComplementShells=function(n){if(n.isEmpty())return!this.isFull();if(n.isFull())return!0;for(var r=0;r<n.loops.length;r++){var s=n.loops[r];if(!(r>0&&!s.isHole())&&this.containsNonCrossingBoundary(s,r===0))return!1}return!0},e.anyLoopContains=function(n){for(var r=Ct(this.loops),s;!(s=r()).done;){var o=s.value;if(o.contains(n))return!0}return!1},e.anyLoopIntersects=function(n){for(var r=Ct(this.loops),s;!(s=r()).done;){var o=s.value;if(o.intersects(n))return!0}return!1},e.area=function(){for(var n=0,r=Ct(this.loops),s;!(s=r()).done;){var o=s.value;n+=o.sign()*o.area()}return n},e.centroid=function(){for(var n=new We(0,0,0).vector,r=Ct(this.loops),s;!(s=r()).done;){var o=s.value,a=o.centroid().vector;o.sign()<0?n=n.sub(a):n=n.add(a)}return We.fromVector(n)},i})(),rde=(function(i){function e(){return i.apply(this,arguments)||this}dy(e,i);var t=e.prototype;return t.insertLoop=function(r,s){for(var o=[],a=!1;!a;){o=i.prototype.get.call(this,s)||[],a=!0;for(var l=Ct(o),c;!(c=l()).done;){var u=c.value;if(u.containsNested(r)){s=u,a=!1;break}}}for(var f=i.prototype.get.call(this,r)||[],d=0;d<o.length;){var A=o[d];r.containsNested(A)?(f.push(A),o.splice(d,1)):d++}i.prototype.set.call(this,r,f),i.prototype.set.call(this,s,[].concat(o,[r]))},e})(D1(Map)),sde=(function(){function i(t){t===void 0&&(t=[]),this.points=t}i.fromLatLngs=function(n){return new i(n.map(We.fromLatLng))};var e=i.prototype;return e.reverse=function(){for(var n=this.points.length,r=0;r<n/2;r++){var s=n-r-1,o=[this.points[s],this.points[r]];this.points[r]=o[0],this.points[s]=o[1]}},e.length=function(){for(var n=0,r=1;r<this.points.length;r++)n+=this.points[r-1].distance(this.points[r]);return n},e.centroid=function(){for(var n=new We(0,0,0),r=1;r<this.points.length;r++){var s=this.points[r-1].vector.add(this.points[r].vector),o=this.points[r-1].vector.sub(this.points[r].vector);n=We.fromVector(n.vector.add(s.mul(Math.sqrt(o.norm2()/s.norm2()))))}return n},e.equal=function(n){if(this.points.length!==n.points.length)return!1;for(var r=0;r<this.points.length;r++)if(!this.points[r].equals(n.points[r]))return!1;return!0},e.approxEqual=function(n,r){if(r===void 0&&(r=RH),this.points.length!==n.points.length)return!1;for(var s=0;s<this.points.length;s++)if(!this.points[s].approxEqual(n.points[s],r))return!1;return!0},e.capBound=function(){return this.rectBound().capBound()},e.rectBound=function(){for(var n=new U1,r=Ct(this.points),s;!(s=r()).done;){var o=s.value;n.addPoint(o)}return n.rectBound()},e.containsCell=function(n){return!1},e.intersectsCell=function(n){if(this.points.length===0)return!1;for(var r=Ct(this.points),s;!(s=r()).done;){var o=s.value;if(n.containsPoint(o))return!0}for(var a=[n.vertex(0),n.vertex(1),n.vertex(2),n.vertex(3)],l=0;l<4;l++)for(var c=Gl.newChainEdgeCrosser(a[l],a[l+1&3],this.points[0]),u=1;u<this.points.length;u++)if(c.chainCrossingSign(this.points[u])!==Vl)return!0;return!1},e.containsPoint=function(n){return!1},e.cellUnionBound=function(){return this.capBound().cellUnionBound()},e.numEdges=function(){return this.points.length===0?0:this.points.length-1},e.edge=function(n){return new ch(this.points[n],this.points[n+1])},e.referencePoint=function(){return kT(!1)},e.numChains=function(){return Math.min(1,this.numEdges())},e.chain=function(n){return new L1(0,this.numEdges())},e.chainEdge=function(n,r){return new ch(this.points[r],this.points[r+1])},e.chainPosition=function(n){return new UT(0,n)},e.dimension=function(){return 1},e.isEmpty=function(){return xfe(this)},e.isFull=function(){return yfe(this)},e.typeTag=function(){return _fe},e.privateInterface=function(){},i.findEndVertex=function(n,r,s){var o=n.points[s],a=pD(o),l=to.fullInterval(),c=0;for(s++;s<n.points.length;s++){var u=n.points[s],f=o.distance(u);if(f>Math.PI/2&&c>0||f<c&&c>r)break;if(c=f,!(f<=r)){var d=Ohe(a,u),A=Math.atan2(d.y,d.x);if(!l.contains(A))break;var y=Math.asin(Math.sin(r)/Math.sin(f)),w=to.fromPointPair(A,A).expanded(y);l=l.intersection(w)}}return s-1},e.subsampleVertices=function(n){var r=[];if(this.points.length<1)return r;r.push(0);for(var s=Math.max(n,0),o=0;o+1<this.points.length;){var a=i.findEndVertex(this,s,o);this.points[a].equals(this.points[o])||r.push(a),o=a}return r},e.project=function(n){if(this.points.length===1)return[this.points[0],1];for(var r=10,s=-1,o=1;o<this.points.length;o++){var a=ufe(n,this.points[o-1],this.points[o]);a<r&&(r=a,s=o)}var l=VH(n,this.points[s-1],this.points[s]);return l.equals(this.points[s])&&s++,[l,s]},e.isOnRight=function(n){var r=this.project(n),s=r[0],o=r[1];return s.equals(this.points[o-1])&&o>1&&o<this.points.length?n.equals(this.points[o-1])?!1:We.orderedCCW(this.points[o-2],n,this.points[o],this.points[o-1]):(o===this.points.length&&o--,KL(n,this.points[o],this.points[o-1]))},e.validate=function(){for(var n=0;n<this.points.length;n++)if(!this.points[n].vector.isUnit())return new Error("vertex "+n+" is not unit length");for(var r=1;r<this.points.length;r++){var s=this.points[r-1],o=this.points[r];if(s.equals(o))return new Error("vertices "+(r-1)+" and "+r+" are identical");if(s.equals(We.fromVector(o.vector.mul(-1))))return new Error("vertices "+(r-1)+" and "+r+" are antipodal")}return null},e.intersects=function(n){if(this.points.length===0||n.points.length===0||!this.rectBound().intersects(n.rectBound()))return!1;for(var r=1;r<this.points.length;r++)for(var s=Gl.newChainEdgeCrosser(this.points[r-1],this.points[r],n.points[0]),o=1;o<n.points.length;o++)if(s.chainCrossingSign(n.points[o])!==Vl)return!0;return!1},e.interpolate=function(n){if(n<=0)return[this.points[0],1];for(var r=n*this.length(),s=1;s<this.points.length;s++){var o=this.points[s-1].distance(this.points[s]);if(r<o){var a=GH(r,this.points[s-1],this.points[s]);return a.equals(this.points[s])?[a,s+1]:[a,s]}r-=o}return[this.points[this.points.length-1],this.points.length]},e.uninterpolate=function(n,r){if(this.points.length<2)return 0;for(var s=0,o=1;o<r;o++)s+=this.points[o-1].distance(this.points[o]);for(var a=s+this.points[r-1].distance(n),l=r;l<this.points.length;l++)s+=this.points[l-1].distance(this.points[l]);return Math.min(1,a/s)},i})(),gH=(function(){function i(){}var e=i.prototype;return e.capBound=function(){return _p.emptyCap()},e.rectBound=function(){return Ri.emptyRect()},e.containsCell=function(n){return!1},e.intersectsCell=function(n){return!1},e.containsPoint=function(n){return!1},e.cellUnionBound=function(){return[]},i})(),uD=(function(){function i(t){var n=t===void 0?{}:t,r=n.minLevel,s=r===void 0?0:r,o=n.maxLevel,a=o===void 0?_i:o,l=n.levelMod,c=l===void 0?1:l,u=n.maxCells,f=u===void 0?8:u;this.minLevel=s,this.maxLevel=a,this.levelMod=c,this.maxCells=f}var e=i.prototype;return e.coverer=function(){return new iW(Math.max(0,Math.min(_i,this.minLevel)),Math.max(0,Math.min(_i,this.maxLevel)),Math.max(1,Math.min(3,this.levelMod)),this.maxCells)},e.covering=function(n){var r=this.cellUnion(n);return r.denormalize(Math.max(0,Math.min(_i,this.minLevel)),Math.max(1,Math.min(3,this.levelMod))),r},e.interiorCovering=function(n){var r=this.interiorCellUnion(n);return r.denormalize(Math.max(0,Math.min(_i,this.minLevel)),Math.max(1,Math.min(3,this.levelMod))),r},e.cellUnion=function(n){var r=this.coverer();r.coveringInternal(n);var s=r.result;return s.normalize(),s},e.interiorCellUnion=function(n){var r=this.coverer();r.interiorCovering=!0,r.coveringInternal(n);var s=r.result;return s.normalize(),s},e.fastCovering=function(n){var r=this.coverer(),s=ay(B1,n.cellUnionBound());return r.normalizeCovering(s),s},e.isCanonical=function(n){return this.coverer().isCanonical(n)},i})(),iW=(function(){function i(t,n,r,s){this.region=new gH,this.result=new B1,this.pq=new ade,this.interiorCovering=!1,this.minLevel=t,this.maxLevel=n,this.levelMod=r,this.maxCells=s}var e=i.prototype;return e.newCandidate=function(n){if(!this.region.intersectsCell(n))return new sy;var r=new ode(n),s=n.level;if(s>=this.minLevel)if(this.interiorCovering){if(this.region.containsCell(n))r.terminal=!0;else if(s+this.levelMod>this.maxLevel)return new sy}else(s+this.levelMod>this.maxLevel||this.region.containsCell(n))&&(r.terminal=!0);return r},e.expandChildren=function(n,r,s){s--;for(var o=0,a=OH(r.id),l=_D(r.id);l!==a;l=Ia(l)){var c=Ra.fromCellID(l);if(s>0){this.region.intersectsCell(c)&&(o+=this.expandChildren(n,c,s));continue}var u=this.newCandidate(c);u instanceof sy||(n.children.push(u),n.numChildren++,u.terminal&&o++)}return o},e.addCandidate=function(n){if(!(n instanceof sy)){if(n.terminal){this.result.push(n.cell.id);return}var r=this.levelMod,s=n.cell.level;s<this.minLevel&&(r=1);var o=this.expandChildren(n,n.cell,r),a=2*this.levelMod;n.numChildren!==0&&(!this.interiorCovering&&o===1<<a&&s>=this.minLevel?(n.terminal=!0,this.addCandidate(n)):(n.priority=-((s<<a)+n.numChildren<<a+o),this.pq.push(n)))}},e.adjustLevel=function(n){return this.levelMod>1&&n>this.minLevel&&(n-=(n-this.minLevel)%this.levelMod),n},e.adjustCellLevels=function(n){if(this.levelMod!==1){for(var r=0,s=Ct(n),o;!(o=s()).done;){var a=o.value,l=no(a),c=this.adjustLevel(l);if(c!==l&&(a=Sr(a,c)),!(r>0&&$m(n[r-1],a))){for(;r>0&&$m(a,n[r-1]);)r--;n[r]=a,r++}}n.length=r}},e.initialCandidates=function(n){var r=new uD;r.maxLevel=this.maxLevel,r.levelMod=1,r.maxCells=Math.min(4,this.maxCells);var s=r.fastCovering(n);this.adjustCellLevels(s);for(var o=Ct(s),a;!(a=o()).done;){var l=a.value;this.addCandidate(this.newCandidate(Ra.fromCellID(l)))}},e.coveringInternal=function(n){for(this.region=n,this.initialCandidates(n);this.pq.length>0&&(!this.interiorCovering||this.result.length<this.maxCells);){var r=this.pq.pop();if(this.interiorCovering||r.cell.level<this.minLevel||r.numChildren===1||this.result.length+this.pq.length+r.numChildren<=this.maxCells)for(var s=Ct(r.children),o;!(o=s()).done;){var a=o.value;(!this.interiorCovering||this.result.length<this.maxCells)&&this.addCandidate(a)}else r.terminal=!0,this.addCandidate(r)}this.region=new gH,this.pq.reset(),this.result.normalize(),(this.minLevel>0||this.levelMod>1)&&this.result.denormalize(this.minLevel,this.levelMod)},e.normalizeCovering=function(n){if(this.maxLevel<_i||this.levelMod>1)for(var r=0;r<n.length;r++){var s=no(n[r]),o=this.adjustLevel(Math.min(s,this.maxLevel));o!==s&&(n[r]=Sr(n[r],o))}n.normalize(),(this.minLevel>0||this.levelMod>1)&&n.denormalize(this.minLevel,this.levelMod);var a=n.length-this.maxCells;if(!(a<=0||this.isCanonical(n))){if(a*n.length>1e4){var l=new uD,c=l.covering(n);n.length=0,n.push.apply(n,c);return}for(;n.length>this.maxCells;){for(var u=-1,f=-1,d=0;d+1<n.length;d++){var A=hy(n[d],n[d+1]),y=A[0],w=A[1];if(w){var S=this.adjustLevel(y);S>f&&(f=S,u=d)}}if(f<this.minLevel)break;var T=Sr(n[u],f),R=this.replaceCellsWithAncestor(n,T);for(n.length=0,n.push.apply(n,R);f>this.minLevel&&(f-=this.levelMod,T=Sr(T,f),!!this.containsAllChildren(n,T));){var P=this.replaceCellsWithAncestor(n,T);n.length=0,n.push.apply(n,P)}}}},e.isCanonical=function(n){var r=this.maxLevel;this.levelMod!==1&&(r=this.maxLevel-(this.maxLevel-this.minLevel)%this.levelMod);for(var s=n.length>this.maxCells,o=1,a=0n,l=Ct(n),c;!(c=l()).done;){var u=c.value;if(!uy(u))return!1;var f=no(u);if(f<this.minLevel||f>r||this.levelMod>1&&(f-this.minLevel)%this.levelMod!==0)return!1;if(a!==0n){if(Gi(a)>=qi(u))return!1;var d=hy(u,a),A=d[0],y=d[1];if(s&&y&&A>=this.minLevel)return!1;var w=f-this.levelMod;if(w<this.minLevel||f!==no(a)||Sr(u,w)!==Sr(a,w))o=1;else if(o++,o===1<<2*this.levelMod)return!1}a=u}return!0},e.containsAllChildren=function(n,r){for(var s=n.findIndex(function(l){return l>=qi(r)}),o=no(r)+this.levelMod,a=vy(r,o);a!==OT(r,o);a=Ia(a)){if(s===-1||n[s]!==a)return!1;s++}return!0},e.replaceCellsWithAncestor=function(n,r){var s=tD(n.length,function(a){return n[a]>qi(r)}),o=tD(n.length,function(a){return n[a]>Gi(r)});return[].concat(n.slice(0,s),[r],n.slice(o))},i})(),ode=function(e){this.terminal=!1,this.numChildren=0,this.children=[],this.priority=0,this.cell=e},sy=function(){this.cell=Ra.fromCellID(fl),this.terminal=!1,this.numChildren=0,this.children=[],this.priority=0},ade=(function(i){function e(){return i.apply(this,arguments)||this}dy(e,i);var t=e.prototype;return t.len=function(){return this.length},t.swap=function(r,s){var o=[this[s],this[r]];this[r]=o[0],this[s]=o[1]},t.push=function(){for(var r,s=arguments.length,o=new Array(s),a=0;a<s;a++)o[a]=arguments[a];var l=(r=i.prototype.push).call.apply(r,[this].concat(o));return this.sort(e.ascending),l},t.pop=function(){var r=i.prototype.pop.call(this);return r||new sy},t.reset=function(){this.length=0},e.ascending=function(r,s){return r.priority<s.priority?-1:r.priority>s.priority?1:0},e})(D1(Array)),Gn={__proto__:null,cellid:afe,Cap:_p,Cell:Ra,CellIndex:Afe,CellIndexRangeIterator:qH,CellIndexContentsIterator:HH,CellUnion:B1,ClosestCellQuery:Yfe,ClosestCellQueryOptions:JH,PointTarget:Hfe,EdgeTarget:Wfe,CellTarget:jfe,CellUnionTarget:Xfe,ShapeIndexTarget:$fe,ClosestEdgeQuery:Vfe,ClosestEdgeQueryOptions:ZH,EdgeQueryPointTarget:Ufe,EdgeQueryEdgeTarget:kfe,EdgeQueryCellTarget:zfe,EdgeQueryShapeIndexTarget:KH,LatLng:ar,Loop:cD,Point:We,Polygon:ide,Polyline:sde,Rect:Ri,RegionCoverer:uD,Coverer:iW,ShapeIndex:LT};function Sp(i){return i?.collectionId}function G1(i){return O.world?.collectionsById?.get(i?.collectionId)}function q1(){return(O.world?.collections||[]).some(i=>i.kind!=="point"&&!Pa(i.id))}function Pa(i){return O.hiddenCollections.has(i)}function rW(i){let e=new Map;for(let t of i){let n=Sp(t.zone);e.has(n)||e.set(n,[]),e.get(n).push(t)}return e}function sW(i,e){for(let t of i.values())if(!t.some(r=>r.geometries.some(s=>bD(s,e))))return!1;return!0}function bD(i,e){if(i.intersectsCoordinate(e))return!0;let t=i.getClosestPoint(e),n=t[0]-e[0],r=t[1]-e[1];return n*n+r*r<=1}var lde=Object.freeze({point:"point",path:"path",area:"area"}),oW=Object.freeze({always:"always",quiet:"quiet"});function Kf(i,e){let t=e??G1(i),n=O.labelOverrides.get(t?.id);if(n)return n;let r=t?.attrs?.["atlas.label.policy"];return r||(t?.kind===lde.path?oW.quiet:oW.always)}function uh(i){return i.attrs?.["atlas.render.as"]||"pin"}var cde={"atlas.hydro.huc12":"HUC-12"},ude=new Set(["atlas.geo.lat","atlas.geo.lon"]),hde=["atlas.render.","atlas.label.","atlas.stroke.","atlas.geometry."];function wD(i){let e=[];for(let[t,n]of Object.entries(i||{}))ude.has(t)||hde.some(r=>t.startsWith(r))||e.push({label:cde[t]||t,value:n});return e.sort((t,n)=>t.label.localeCompare(n.label))}function VT(i){return i?.attrs?.["atlas.geometry.surface"]||"plane"}function yy(i){let e=hh(i);return e||fde(i)}function fde(i){let e=i?.attrs||{};if(e["atlas.geometry.projection"]!=="mercator")return null;let t=(e["atlas.geometry.mercator.px"]||"").split(",").map(Number),n=(e["atlas.geometry.mercator.deg"]||"").split(",").map(Number);if(t.length!==4||n.length!==4||t.some(Number.isNaN)||n.some(Number.isNaN))return null;let[r,s,o,a]=t,[l,c,u,f]=n;if(!o||!a||c===f||l===u)return null;let d=S=>Math.asinh(Math.tan(S*Math.PI/180)),A=S=>Math.atan(Math.sinh(S))*180/Math.PI,y=d(c),w=d(f);return{toLatLng(S,T){return[A(y-(T-s)/a*(y-w)),l+(S-r)/o*(u-l)]},toWorld(S,T){return[r+(T-l)/(u-l)*o,s+(y-d(S))/(y-w)*a]}}}function hh(i){let e=i?.attrs||{};if(e["atlas.geometry.projection"]!=="equirect")return null;let t=(e["atlas.geometry.equirect.px"]||"").split(",").map(Number),n=(e["atlas.geometry.equirect.deg"]||"").split(",").map(Number);if(t.length!==4||n.length!==4||t.some(Number.isNaN)||n.some(Number.isNaN))return null;let[r,s,o,a]=t,[l,c,u,f]=n;return!o||!a||c===f||l===u?null:{toLatLng(d,A){return[c-(A-s)/a*(c-f),l+(d-r)/o*(u-l)]},toWorld(d,A){return[r+(A-l)/(u-l)*o,s+(c-d)/(c-f)*a]}}}var by=10,aW=i=>i+1,lW=i=>Gn.cellid.level(Gn.cellid.fromToken(i)),SD={map:null,mapping:null};function GT(){return SD.map!==O.world&&(SD={map:O.world,mapping:yy(O.world)}),SD.mapping}function dde(i){let e=GT();if(!e)return null;let[t,n]=e.toLatLng(i[0],-i[1]);return Gn.LatLng.fromDegrees(t,n)}function cW(i){let e=Gn.LatLng.fromPoint(i);return[e.lat*180/Math.PI,e.lng*180/Math.PI]}var uW=new WeakMap;function TD(i){let e=GT();if(!e)return 0n;let t=uW.get(i);if(t&&t.mapping===e)return t.leaf;let n=dde(i),r=n?Gn.cellid.fromLatLng(n):0n;return typeof i=="object"&&uW.set(i,{mapping:e,leaf:r}),r}var hW={slug:"s2",name:"S2",short:"S2",appliesTo(i){return VT(i)==="sphere"&&yy(i)!==null},maxLevel(){return aW(by)},inputLength(){return 6},level(i){return i===""?0:aW(lW(i))},parent(i){let e=Gn.cellid.fromToken(i),t=Gn.cellid.level(e);return t===0?"":Gn.cellid.toToken(Gn.cellid.parent(e,t-1))},children(i){return i===""?[0,1,2,3,4,5].map(e=>Gn.cellid.toToken(Gn.cellid.fromFace(e))):Gn.cellid.children(Gn.cellid.fromToken(i)).map(Gn.cellid.toToken)},childIndex(i){let e=Gn.cellid.fromToken(i),t=Gn.cellid.level(e);return t===0?Gn.cellid.face(e):Gn.cellid.childPosition(e,t)},contains(i,e){return Gn.cellid.contains(Gn.cellid.fromToken(i),TD(e))},descendTarget(i,e){let t=TD(e);if(t===0n)return"";let n=i===""?0:lW(i)+1;return n>by?"":Gn.cellid.toToken(Gn.cellid.parent(t,n))},bbox(i){if(i==="")return Xf();let e=this.ring(i),t=1/0,n=1/0,r=-1/0,s=-1/0;for(let[o,a]of e)t=Math.min(t,o),n=Math.min(n,a),r=Math.max(r,o),s=Math.max(s,a);return[t,n,r,s]},center(i){let e=GT(),[t,n]=cW(Gn.Cell.fromCellID(Gn.cellid.fromToken(i)).center()),[r,s]=e.toWorld(t,n);return[r,-s]},ring(i){let e=GT(),t=Gn.Cell.fromCellID(Gn.cellid.fromToken(i)),n=Gn.cellid.level(Gn.cellid.fromToken(i)),r=Math.max(2,Math.min(16,2**(4-n)*2)),s=Xf(),o=s[2]-s[0],a=[];for(let u=0;u<4;u++){let f=t.vertex(u).vector,d=t.vertex((u+1)%4).vector;for(let A=0;A<r;A++){let y=A/r,w=f.x+(d.x-f.x)*y,S=f.y+(d.y-f.y)*y,T=f.z+(d.z-f.z)*y,R=Math.hypot(w,S,T)||1,[P,I]=cW(new Gn.Point(w/R,S/R,T/R)),[F,D]=e.toWorld(P,I);a.push([F,-D])}}for(let u=1;u<a.length;u++){let f=a[u][0]-a[u-1][0];f>o/2?a[u][0]-=o:f<-o/2&&(a[u][0]+=o)}let l=[...a[0]],c=l[0]-a[a.length-1][0];return c>o/2?l[0]-=o:c<-o/2&&(l[0]+=o),a.push(l),a},poleContained(i){let e=Gn.cellid.fromToken(i);return Gn.cellid.contains(e,Gn.cellid.fromLatLng(Gn.LatLng.fromDegrees(90,0)))?"north":Gn.cellid.contains(e,Gn.cellid.fromLatLng(Gn.LatLng.fromDegrees(-90,0)))?"south":null},label(i){return{context:i.slice(0,-1),principal:i.slice(-1)}},colorKey(i){return this.childIndex(i)%jf.length},normalizeInput(i){return[...i.toLocaleLowerCase()].filter(e=>"0123456789abcdef".includes(e)).slice(0,6).join("")},parseInput(i){if(i==="")return"";let e=Gn.cellid.fromToken(i);return e===0n||!Gn.cellid.valid(e)?null:Gn.cellid.level(e)>by?Gn.cellid.toToken(Gn.cellid.parent(e,by)):Gn.cellid.toToken(e)},locate(i){let e=TD(i);return e===0n?null:{label:"S2",value:Gn.cellid.toToken(Gn.cellid.parent(e,by))}}};function Xf(){let i=O.lens?.surface;if(i)return[i.x,-(i.y+i.height),i.x+i.width,-i.y];let e=O.volume?.tileGrid.size??0,t=O.lens?.bounds||{x:0,y:0,width:e,height:e};return[t.x,-(t.y+t.height),t.x+t.width,-t.y]}var dW=[BL,hW];function wy(i){return dW.filter(e=>e.appliesTo(i))}function Ts(){return dW.find(i=>i.slug===O.gridSystem)||BL}function pW(i,e,t,n){if(!t)return"";let r=i.center(t),s=fW(i.bbox(t)),o="",a="",l=1/0;for(;e.level(o)<e.maxLevel(n);){let c=e.descendTarget(o,r);if(!c)break;let u=fW(e.bbox(c)),f=Math.abs(Math.log(u/s));if(f<l&&(a=c,l=f),u<=s)break;o=c}return a}function fW([i,e,t,n]){return(t-i)*(n-e)}function mW(i,e,t){let n=i[0]===i[i.length-1]||pde(i[0],i[i.length-1])?i.slice(0,-1):[...i];for(let[r,s]of[[e,([o])=>o>=e],[t,([o])=>o<=t]]){let o=[];for(let a=0;a<n.length;a++){let l=n[a],c=n[(a+n.length-1)%n.length],u=s(l),f=s(c);if(u!==f){let d=(r-c[0])/(l[0]-c[0]);o.push([r,c[1]+d*(l[1]-c[1])])}u&&o.push(l)}if(n=o,n.length===0)return[]}return[...n,n[0]]}function pde(i,e){return i[0]===e[0]&&i[1]===e[1]}var Us={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function ED(i){let e=Wr();for(let t=0,n=i.length;t<n;++t)Jm(e,i[t]);return e}function mde(i,e,t){let n=Math.min.apply(null,i),r=Math.min.apply(null,e),s=Math.max.apply(null,i),o=Math.max.apply(null,e);return ql(n,r,s,o,t)}function H1(i,e,t){return t?(t[0]=i[0]-e,t[1]=i[1]-e,t[2]=i[2]+e,t[3]=i[3]+e,t):[i[0]-e,i[1]-e,i[2]+e,i[3]+e]}function HT(i,e){return e?(e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e):i.slice()}function Ic(i,e,t){let n,r;return e<i[0]?n=i[0]-e:i[2]<e?n=e-i[2]:n=0,t<i[1]?r=i[1]-t:i[3]<t?r=t-i[3]:r=0,n*n+r*r}function mu(i,e){return Sy(i,e[0],e[1])}function fh(i,e){return i[0]<=e[0]&&e[2]<=i[2]&&i[1]<=e[1]&&e[3]<=i[3]}function Sy(i,e,t){return i[0]<=e&&e<=i[2]&&i[1]<=t&&t<=i[3]}function qT(i,e){let t=i[0],n=i[1],r=i[2],s=i[3],o=e[0],a=e[1],l=Us.UNKNOWN;return o<t?l=l|Us.LEFT:o>r&&(l=l|Us.RIGHT),a<n?l=l|Us.BELOW:a>s&&(l=l|Us.ABOVE),l===Us.UNKNOWN&&(l=Us.INTERSECTING),l}function Wr(){return[1/0,1/0,-1/0,-1/0]}function ql(i,e,t,n,r){return r?(r[0]=i,r[1]=e,r[2]=t,r[3]=n,r):[i,e,t,n]}function Km(i){return ql(1/0,1/0,-1/0,-1/0,i)}function WT(i,e){let t=i[0],n=i[1];return ql(t,n,t,n,e)}function W1(i,e,t,n,r){let s=Km(r);return MD(s,i,e,t,n)}function Qm(i,e){return i[0]==e[0]&&i[2]==e[2]&&i[1]==e[1]&&i[3]==e[3]}function jT(i,e){return e[0]<i[0]&&(i[0]=e[0]),e[2]>i[2]&&(i[2]=e[2]),e[1]<i[1]&&(i[1]=e[1]),e[3]>i[3]&&(i[3]=e[3]),i}function Jm(i,e){e[0]<i[0]&&(i[0]=e[0]),e[0]>i[2]&&(i[2]=e[0]),e[1]<i[1]&&(i[1]=e[1]),e[1]>i[3]&&(i[3]=e[1])}function MD(i,e,t,n,r){for(;t<n;t+=r)Ade(i,e[t],e[t+1]);return i}function Ade(i,e,t){i[0]=Math.min(i[0],e),i[1]=Math.min(i[1],t),i[2]=Math.max(i[2],e),i[3]=Math.max(i[3],t)}function XT(i,e){let t;return t=e(j1(i)),t||(t=e(X1(i)),t)||(t=e($1(i)),t)||(t=e(Pc(i)),t)?t:!1}function Ty(i){let e=0;return ph(i)||(e=Kn(i)*Dr(i)),e}function j1(i){return[i[0],i[1]]}function X1(i){return[i[2],i[1]]}function dl(i){return[(i[0]+i[2])/2,(i[1]+i[3])/2]}function AW(i,e){let t;if(e==="bottom-left")t=j1(i);else if(e==="bottom-right")t=X1(i);else if(e==="top-left")t=Pc(i);else if(e==="top-right")t=$1(i);else throw new Error("Invalid corner");return t}function Ey(i,e,t,n,r){let[s,o,a,l,c,u,f,d]=CD(i,e,t,n);return ql(Math.min(s,a,c,f),Math.min(o,l,u,d),Math.max(s,a,c,f),Math.max(o,l,u,d),r)}function CD(i,e,t,n){let r=e*n[0]/2,s=e*n[1]/2,o=Math.cos(t),a=Math.sin(t),l=r*o,c=r*a,u=s*o,f=s*a,d=i[0],A=i[1];return[d-l+f,A-c-u,d-l-f,A-c+u,d+l-f,A+c+u,d+l+f,A+c-u,d-l+f,A-c-u]}function Dr(i){return i[3]-i[1]}function dh(i,e,t){let n=t||Wr();return Ar(i,e)?(i[0]>e[0]?n[0]=i[0]:n[0]=e[0],i[1]>e[1]?n[1]=i[1]:n[1]=e[1],i[2]<e[2]?n[2]=i[2]:n[2]=e[2],i[3]<e[3]?n[3]=i[3]:n[3]=e[3]):Km(n),n}function RD(i,e){if(!Ar(i,e))return[i.slice()];if(fh(e,i))return[];let[t,n,r,s]=i,o=Math.max(t,e[0]),a=Math.max(n,e[1]),l=Math.min(r,e[2]),c=Math.min(s,e[3]),u=[];return o>t&&u.push([t,n,o,s]),l<r&&u.push([l,n,r,s]),a>n&&u.push([o,n,l,a]),c<s&&u.push([o,c,l,s]),u}function Pc(i){return[i[0],i[3]]}function $1(i){return[i[2],i[3]]}function Kn(i){return i[2]-i[0]}function Ar(i,e){return i[0]<=e[2]&&i[2]>=e[0]&&i[1]<=e[3]&&i[3]>=e[1]}function ph(i){return i[2]<i[0]||i[3]<i[1]}function gW(i,e){return e?(e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e):i}function vW(i,e,t){let n=!1,r=qT(i,e),s=qT(i,t);if(r===Us.INTERSECTING||s===Us.INTERSECTING)n=!0;else{let o=i[0],a=i[1],l=i[2],c=i[3],u=e[0],f=e[1],d=t[0],A=t[1],y=(A-f)/(d-u),w,S;s&Us.ABOVE&&!(r&Us.ABOVE)&&(w=d-(A-c)/y,n=w>=o&&w<=l),!n&&s&Us.RIGHT&&!(r&Us.RIGHT)&&(S=A-(d-l)*y,n=S>=a&&S<=c),!n&&s&Us.BELOW&&!(r&Us.BELOW)&&(w=d-(A-a)/y,n=w>=o&&w<=l),!n&&s&Us.LEFT&&!(r&Us.LEFT)&&(S=A-(d-o)*y,n=S>=a&&S<=c)}return n}function _W(i,e,t,n){if(ph(i))return Km(t);let r=[];if(n>1){let a=i[2]-i[0],l=i[3]-i[1];for(let c=0;c<n;++c)r.push(i[0]+a*c/n,i[1],i[2],i[1]+l*c/n,i[2]-a*c/n,i[3],i[0],i[3]-l*c/n)}else r=[i[0],i[1],i[2],i[1],i[2],i[3],i[0],i[3]];e(r,r,2);let s=[],o=[];for(let a=0,l=r.length;a<l;a+=2)s.push(r[a]),o.push(r[a+1]);return mde(s,o,t)}function ID(i,e){let t=e.getExtent(),n=dl(i);if(e.canWrapX()&&(n[0]<t[0]||n[0]>=t[2])){let r=Kn(t),o=Math.floor((n[0]-t[0])/r)*r;i[0]-=o,i[2]-=o}return i}function $T(i,e,t){if(e.canWrapX()){let n=e.getExtent();if(!isFinite(i[0])||!isFinite(i[2]))return[[n[0],i[1],n[2],i[3]]];ID(i,e);let r=Kn(n);if(Kn(i)>r&&!t)return[[n[0],i[1],n[2],i[3]]];if(i[0]<n[0])return[[i[0]+r,i[1],n[2],i[3]],[n[0],i[1],i[2],i[3]]];if(i[2]>n[2])return[[i[0],i[1],n[2],i[3]],[n[0],i[1],i[2]-r,i[3]]]}return[i]}function xW(i,e){let t=[i];for(let n=0,r=e.length;n<r&&t.length>0;++n){let s=[];for(let o=0,a=t.length;o<a;++o)s.push(...RD(t[o],e[n]));t=s}return t}var yW={info:1,warn:2,error:3,none:4},gde=yW.info;function YT(...i){gde>yW.warn||console.warn(...i)}function Si(i,e,t){return Math.min(Math.max(i,e),t)}function bW(i,e,t,n,r,s){let o=r-t,a=s-n;if(o!==0||a!==0){let l=((i-t)*o+(e-n)*a)/(o*o+a*a);l>1?(t=r,n=s):l>0&&(t+=o*l,n+=a*l)}return Au(i,e,t,n)}function Au(i,e,t,n){let r=t-i,s=n-e;return r*r+s*s}function wW(i){let e=i.length;for(let n=0;n<e;n++){let r=n,s=Math.abs(i[n][n]);for(let a=n+1;a<e;a++){let l=Math.abs(i[a][n]);l>s&&(s=l,r=a)}if(s===0)return null;let o=i[r];i[r]=i[n],i[n]=o;for(let a=n+1;a<e;a++){let l=-i[a][n]/i[n][n];for(let c=n;c<e+1;c++)n==c?i[a][c]=0:i[a][c]+=l*i[n][c]}}let t=new Array(e);for(let n=e-1;n>=0;n--){t[n]=i[n][e]/i[n][n];for(let r=n-1;r>=0;r--)i[r][e]-=i[r][n]*t[n]}return t}function ZT(i){return i*180/Math.PI}function gu(i){return i*Math.PI/180}function mh(i,e){let t=i%e;return t*e<0?t+e:t}function Po(i,e,t){return i+t*(e-i)}function eA(i,e){let t=Math.pow(10,e);return Math.round(i*t)/t}function My(i,e){return Math.floor(eA(i,e))}function Cy(i,e){return Math.ceil(eA(i,e))}function KT(i,e,t){if(i>=e&&i<t)return i;let n=t-e;return((i-e)%n+n)%n+e}function SW(i,e){return i[0]+=+e[0],i[1]+=+e[1],i}function tA(i,e){let t=!0;for(let n=i.length-1;n>=0;--n)if(i[n]!=e[n]){t=!1;break}return t}function Y1(i,e){let t=Math.cos(e),n=Math.sin(e),r=i[0]*t-i[1]*n,s=i[1]*t+i[0]*n;return i[0]=r,i[1]=s,i}function TW(i,e){return i[0]*=e,i[1]*=e,i}function QT(i,e){if(e.canWrapX()){let t=Kn(e.getExtent()),n=EW(i,e,t);n&&(i[0]-=n*t)}return i}function EW(i,e,t){let n=e.getExtent(),r=0;return e.canWrapX()&&(i[0]<n[0]||i[0]>n[2])&&(t=t||Kn(n),r=Math.floor((i[0]-n[0])/t)),r}function MW(i,e,t){let n=Math.sqrt((e[0]-i[0])*(e[0]-i[0])+(e[1]-i[1])*(e[1]-i[1])),r=[(e[0]-i[0])/n,(e[1]-i[1])/n],s=[-r[1],r[0]],o=Math.sqrt((t[0]-i[0])*(t[0]-i[0])+(t[1]-i[1])*(t[1]-i[1])),a=[(t[0]-i[0])/o,(t[1]-i[1])/o],l=n===0||o===0?0:Math.acos(Si(a[0]*r[0]+a[1]*r[1],-1,1));return l=Math.max(l,1e-5),a[0]*s[0]+a[1]*s[1]>0?l:Math.PI*2-l}var Qf={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};var PD=class{constructor(e){this.code_=e.code,this.units_=e.units,this.extent_=e.extent!==void 0?e.extent:null,this.worldExtent_=e.worldExtent!==void 0?e.worldExtent:null,this.axisOrientation_=e.axisOrientation!==void 0?e.axisOrientation:"enu",this.global_=e.global!==void 0?e.global:!1,this.canWrapX_=!!(this.global_&&this.extent_),this.getPointResolutionFunc_=e.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=e.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||Qf[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(e){this.global_=e,this.canWrapX_=!!(e&&this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(e){this.defaultTileGrid_=e}setExtent(e){this.extent_=e,this.canWrapX_=!!(this.global_&&e)}setWorldExtent(e){this.worldExtent_=e}setGetPointResolution(e){this.getPointResolutionFunc_=e}getPointResolutionFunc(){return this.getPointResolutionFunc_}},Tp=PD;var Ry=6378137,Z1=Math.PI*Ry,vde=[-Z1,-Z1,Z1,Z1],_de=[-180,-85,180,85],JT=Ry*Math.log(Math.tan(Math.PI/2)),Ep=class extends Tp{constructor(e){super({code:e,units:"m",extent:vde,global:!0,worldExtent:_de,getPointResolution:function(t,n){return t/Math.cosh(n[1]/Ry)}})}},LD=[new Ep("EPSG:3857"),new Ep("EPSG:102100"),new Ep("EPSG:102113"),new Ep("EPSG:900913"),new Ep("http://www.opengis.net/def/crs/EPSG/0/3857"),new Ep("http://www.opengis.net/gml/srs/epsg.xml#3857")];function CW(i,e,t,n){let r=i.length;t=t>1?t:2,n=n??t,e===void 0&&(t>2?e=i.slice():e=new Array(r));for(let s=0;s<r;s+=n){e[s]=Z1*i[s]/180;let o=Ry*Math.log(Math.tan(Math.PI*(+i[s+1]+90)/360));o>JT?o=JT:o<-JT&&(o=-JT),e[s+1]=o}return e}function RW(i,e,t,n){let r=i.length;t=t>1?t:2,n=n??t,e===void 0&&(t>2?e=i.slice():e=new Array(r));for(let s=0;s<r;s+=n)e[s]=180*i[s]/Z1,e[s+1]=360*Math.atan(Math.exp(i[s+1]/Ry))/Math.PI-90;return e}var xde=6378137,IW=[-180,-90,180,90],yde=Math.PI*xde/180,Jf=class extends Tp{constructor(e,t){super({code:e,units:"degrees",extent:IW,axisOrientation:t,global:!0,metersPerUnit:yde,worldExtent:IW})}},DD=[new Jf("CRS:84"),new Jf("EPSG:4326","neu"),new Jf("urn:ogc:def:crs:OGC:1.3:CRS84"),new Jf("urn:ogc:def:crs:OGC:2:84"),new Jf("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new Jf("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new Jf("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];var ND={};function PW(i){return ND[i]||ND[i.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function LW(i,e){ND[i]=e}function Ah(i){for(let e in i)delete i[e]}function vu(i){let e;for(e in i)return!1;return!e}var K1={};function Q1(i,e,t){let n=i.getCode(),r=e.getCode();n in K1||(K1[n]={}),K1[n][r]=t}function eE(i,e){return i in K1&&e in K1[i]?K1[i][e]:null}var tE=.9996,Lc=.00669438,iE=Lc*Lc,rE=iE*Lc,nA=Lc/(1-Lc),DW=Math.sqrt(1-Lc),J1=(1-DW)/(1+DW),OW=J1*J1,FD=OW*J1,BD=FD*J1,UW=BD*J1,kW=1-Lc/4-3*iE/64-5*rE/256,bde=3*Lc/8+3*iE/32+45*rE/1024,wde=15*iE/256+45*rE/1024,Sde=35*rE/3072,Tde=3/2*J1-27/32*FD+269/512*UW,Ede=21/16*OW-55/32*BD,Mde=151/96*FD-417/128*UW,Cde=1097/512*BD,nE=6378137;function Rde(i,e,t){let n=i-5e5,o=(t.north?e:e-1e7)/tE/(nE*kW),a=o+Tde*Math.sin(2*o)+Ede*Math.sin(4*o)+Mde*Math.sin(6*o)+Cde*Math.sin(8*o),l=Math.sin(a),c=l*l,u=Math.cos(a),f=l/u,d=f*f,A=d*d,y=1-Lc*c,w=Math.sqrt(1-Lc*c),S=nE/w,T=(1-Lc)/y,R=nA*u**2,P=R*R,I=n/(S*tE),F=I*I,D=F*I,L=D*I,C=L*I,B=C*I,k=a-f/T*(F/2-L/24*(5+3*d+10*R-4*P-9*nA))+B/720*(61+90*d+298*R+45*A-252*nA-3*P),z=(I-D/6*(1+2*d+R)+C/120*(5-2*R+28*d-3*P+8*nA+24*A))/u;return z=KT(z+gu(zW(t.number)),-Math.PI,Math.PI),[ZT(z),ZT(k)]}var NW=-80,FW=84,Ide=-180,Pde=180;function Lde(i,e,t){i=KT(i,Ide,Pde),e<NW?e=NW:e>FW&&(e=FW);let n=gu(e),r=Math.sin(n),s=Math.cos(n),o=r/s,a=o*o,l=a*a,c=gu(i),u=zW(t.number),f=gu(u),d=nE/Math.sqrt(1-Lc*r**2),A=nA*s**2,y=s*KT(c-f,-Math.PI,Math.PI),w=y*y,S=w*y,T=S*y,R=T*y,P=R*y,I=nE*(kW*n-bde*Math.sin(2*n)+wde*Math.sin(4*n)-Sde*Math.sin(6*n)),F=tE*d*(y+S/6*(1-a+A)+R/120*(5-18*a+l+72*A-58*nA))+5e5,D=tE*(I+d*o*(w/2+T/24*(5-a+9*A+4*A**2)+P/720*(61-58*a+l+600*A-330*nA)));return t.north||(D+=1e7),[F,D]}function zW(i){return(i-1)*6-180+3}var Dde=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function VW(i){let e=0;for(let r of Dde){let s=i.match(r);if(s){e=parseInt(s[1]);break}}if(!e)return null;let t=0,n=!1;return e>32700&&e<32761?t=e-32700:e>32600&&e<32661&&(n=!0,t=e-32600),t?{number:t,north:n}:null}function BW(i,e){return function(t,n,r,s){let o=t.length;r=r>1?r:2,s=s??r,n||(r>2?n=t.slice():n=new Array(o));for(let a=0;a<o;a+=s){let l=t[a],c=t[a+1],u=i(l,c,e);n[a]=u[0],n[a+1]=u[1]}return n}}function GW(i){return VW(i)?new Tp({code:i,units:"m"}):null}function qW(i){let e=VW(i.getCode());return e?{forward:BW(Lde,e),inverse:BW(Rde,e)}:null}var Nde=63710088e-1;function OD(i,e,t){t=t||Nde;let n=gu(i[1]),r=gu(e[1]),s=(r-n)/2,o=gu(e[0]-i[0])/2,a=Math.sin(s)*Math.sin(s)+Math.sin(o)*Math.sin(o)*Math.cos(n)*Math.cos(r);return 2*t*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}var Fde=[qW],Bde=[GW];var kD=!0;function WW(i){kD=!(i===void 0?!0:i)}function VD(i,e){if(e!==void 0){for(let t=0,n=i.length;t<n;++t)e[t]=i[t];e=e}else e=i.slice();return e}function zD(i){LW(i.getCode(),i),Q1(i,i,VD)}function Ode(i){i.forEach(zD)}function ks(i){if(typeof i!="string")return i;let e=PW(i);if(e)return e;for(let t of Bde){let n=t(i);if(n)return n}return null}function GD(i,e,t,n){i=ks(i);let r,s=i.getPointResolutionFunc();if(s){if(r=s(e,t),n&&n!==i.getUnits()){let o=i.getMetersPerUnit();o&&(r=r*o/Qf[n])}}else{let o=i.getUnits();if(o=="degrees"&&!n||n=="degrees")r=e;else{let a=iA(i,ks("EPSG:4326"));if(!a&&o!=="degrees")r=e*i.getMetersPerUnit();else{let c=[t[0]-e/2,t[1],t[0]+e/2,t[1],t[0],t[1]-e/2,t[0],t[1]+e/2];c=a(c,c,2);let u=OD(c.slice(0,2),c.slice(2,4)),f=OD(c.slice(4,6),c.slice(6,8));r=(u+f)/2}let l=n?Qf[n]:i.getMetersPerUnit();l!==void 0&&(r/=l)}}return r}function HW(i){Ode(i),i.forEach(function(e){i.forEach(function(t){e!==t&&Q1(e,t,VD)})})}function Ude(i,e,t,n){i.forEach(function(r){e.forEach(function(s){Q1(r,s,t),Q1(s,r,n)})})}function sE(i,e){return i?typeof i=="string"?ks(i):i:ks(e)}function jW(i){return(function(e,t,n,r){let s=e.length;n=n!==void 0?n:2,r=r??n,t=t!==void 0?t:new Array(s);for(let o=0;o<s;o+=r){let a=i(e.slice(o,o+n)),l=a.length;for(let c=0,u=r;c<u;++c)t[o+c]=c>=l?e[o+c]:a[c]}return t})}function ev(i,e){if(i===e)return!0;let t=i.getUnits()===e.getUnits();return(i.getCode()===e.getCode()||iA(i,e)===VD)&&t}function iA(i,e){let t=i.getCode(),n=e.getCode(),r=eE(t,n);if(r)return r;let s=null,o=null;for(let l of Fde)s||(s=l(i)),o||(o=l(e));if(!s&&!o)return null;let a="EPSG:4326";if(o)if(s)r=UD(s.inverse,o.forward);else{let l=eE(t,a);l&&(r=UD(l,o.forward))}else{let l=eE(a,n);l&&(r=UD(s.inverse,l))}return r&&(zD(i),zD(e),Q1(i,e,r)),r}function UD(i,e){return function(t,n,r,s){return n=i(t,n,r,s),e(n,n,r,s)}}function rA(i,e){let t=ks(i),n=ks(e);return iA(t,n)}function tv(i,e,t){let n=rA(e,t);if(!n){let r=ks(e).getCode(),s=ks(t).getCode();throw new Error(`No transform available between ${r} and ${s}`)}return n(i,void 0,i.length)}function XW(i,e,t,n){let r=rA(e,t);return _W(i,r,void 0,n)}var _u=null;function sA(){return _u}function Iy(i,e){return _u?tv(i,e,_u):i}function xu(i,e){return _u?tv(i,_u,e):(kD&&!tA(i,[0,0])&&i[0]>=-180&&i[0]<=180&&i[1]>=-90&&i[1]<=90&&(kD=!1,YT("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),i)}function Mp(i,e){return _u?XW(i,e,_u):i}function yu(i,e){return _u?XW(i,_u,e):i}function $W(i,e){if(!_u)return i;let t=ks(e).getMetersPerUnit(),n=_u.getMetersPerUnit();return t&&n?i*t/n:i}function kde(){HW(LD),HW(DD),Ude(DD,LD,CW,RW)}kde();function qD(i){return i[0]>0&&i[1]>0}function YW(i,e,t){return t===void 0&&(t=[0,0]),t[0]=i[0]*e+.5|0,t[1]=i[1]*e+.5|0,t}function ls(i,e){return Array.isArray(i)?i:(e===void 0?e=[i,i]:(e[0]=i,e[1]=i),e)}var oE=class{constructor(e,t,n,r){this.minX=e,this.maxX=t,this.minY=n,this.maxY=r}contains(e){return this.containsXY(e[1],e[2])}containsTileRange(e){return this.minX<=e.minX&&e.maxX<=this.maxX&&this.minY<=e.minY&&e.maxY<=this.maxY}containsXY(e,t){return this.minX<=e&&e<=this.maxX&&this.minY<=t&&t<=this.maxY}equals(e){return this.minX==e.minX&&this.minY==e.minY&&this.maxX==e.maxX&&this.maxY==e.maxY}extend(e){e.minX<this.minX&&(this.minX=e.minX),e.maxX>this.maxX&&(this.maxX=e.maxX),e.minY<this.minY&&(this.minY=e.minY),e.maxY>this.maxY&&(this.maxY=e.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(e){return this.minX<=e.maxX&&this.maxX>=e.minX&&this.minY<=e.maxY&&this.maxY>=e.minY}};function oA(i,e,t,n,r){return r!==void 0?(r.minX=i,r.maxX=e,r.minY=t,r.maxY=n,r):new oE(i,e,t,n)}var aE=oE;function ZW(i,e,t){let n,r;t=t||pl;let s=0,o=i.length,a=!1;for(;s<o;)n=s+(o-s>>1),r=+t(i[n],e),r<0?s=n+1:(o=n,a=!r);return a?s:~s}function pl(i,e){return i>e?1:i<e?-1:0}function KW(i,e){return i<e?1:i>e?-1:0}function nv(i,e,t){if(i[0]<=e)return 0;let n=i.length;if(e<=i[n-1])return n-1;if(typeof t=="function"){for(let r=1;r<n;++r){let s=i[r];if(s===e)return r;if(s<e)return t(e,i[r-1],s)>0?r-1:r}return n-1}if(t>0){for(let r=1;r<n;++r)if(i[r]<e)return r-1;return n-1}if(t<0){for(let r=1;r<n;++r)if(i[r]<=e)return r;return n-1}for(let r=1;r<n;++r){if(i[r]==e)return r;if(i[r]<e)return i[r-1]-e<e-i[r]?r-1:r}return n-1}function QW(i,e,t){for(;e<t;){let n=i[e];i[e]=i[t],i[t]=n,++e,--t}}function Lo(i,e){let t=Array.isArray(e)?e:[e],n=t.length;for(let r=0;r<n;r++)i[i.length]=t[r]}function ea(i,e){let t=i.length;if(t!==e.length)return!1;for(let n=0;n<t;n++)if(i[n]!==e[n])return!1;return!0}function JW(i,e,t){let n=e||pl;return i.every(function(r,s){if(s===0)return!0;let o=n(i[s-1],r);return!(o>0||t&&o===0)})}function jn(i,e){if(!i)throw new Error(e)}function ej(i,e,t,n,r){return!XT(r,function(o){return!Cp(i,e,t,n,o[0],o[1])})}function Cp(i,e,t,n,r,s){let o=0,a=i[t-n],l=i[t-n+1];for(;e<t;e+=n){let c=i[e],u=i[e+1];l<=s?u>s&&(c-a)*(s-l)-(r-a)*(u-l)>0&&o++:u<=s&&(c-a)*(s-l)-(r-a)*(u-l)<0&&o--,a=c,l=u}return o!==0}function Py(i,e,t,n,r,s){if(t.length===0||!Cp(i,e,t[0],n,r,s))return!1;for(let o=1,a=t.length;o<a;++o)if(Cp(i,t[o-1],t[o],n,r,s))return!1;return!0}function tj(i,e,t,n,r,s){if(t.length===0)return!1;for(let o=0,a=t.length;o<a;++o){let l=t[o];if(Py(i,e,l,n,r,s))return!0;e=l[l.length-1]}return!1}function lE(i,e,t,n,r){let s;for(e+=n;e<t;e+=n)if(s=r(i.slice(e-n,e),i.slice(e,e+n)),s)return s;return!1}function aA(i,e,t,n,r,s){return s=s??MD(Wr(),i,e,t,n),Ar(r,s)?s[0]>=r[0]&&s[2]<=r[2]||s[1]>=r[1]&&s[3]<=r[3]?!0:lE(i,e,t,n,function(o,a){return vW(r,o,a)}):!1}function nj(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){if(aA(i,e,t[s],n,r))return!0;e=t[s]}return!1}function HD(i,e,t,n,r){return!!(aA(i,e,t,n,r)||Cp(i,e,t,n,r[0],r[1])||Cp(i,e,t,n,r[0],r[3])||Cp(i,e,t,n,r[2],r[1])||Cp(i,e,t,n,r[2],r[3]))}function WD(i,e,t,n,r){if(!HD(i,e,t[0],n,r))return!1;if(t.length===1)return!0;for(let s=1,o=t.length;s<o;++s)if(ej(i,t[s-1],t[s],n,r)&&!aA(i,t[s-1],t[s],n,r))return!1;return!0}function ij(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];if(WD(i,e,a,n,r))return!0;e=a[a.length-1]}return!1}function ei(){throw new Error("Unimplemented abstract method.")}var zde=0;function Bn(i){return i.ol_uid||(i.ol_uid=String(++zde))}function iv(i,e,t,n){return n!==void 0?(n[0]=i,n[1]=e,n[2]=t,n):[i,e,t]}function Vde(i,e,t){return i+"/"+e+"/"+t}function rv(i,e,t,n,r){return`${Bn(i)},${e},${Vde(t,n,r)}`}function rj(i){return Gde(i[0],i[1],i[2])}function Gde(i,e,t){return(e<<i)+t}function sj(i,e){let t=i[0],n=i[1],r=i[2];if(e.getMinZoom()>t||t>e.getMaxZoom())return!1;let s=e.getFullTileRange(t);return s?s.containsXY(n,r):!0}var sv=[0,0,0],Rp=5,jD=class{constructor(e){let t=e.minZoom,n=e.resolutions;t===void 0&&n&&(t=n.findIndex(o=>o!==void 0)),this.minZoom=t!==void 0?t:0,this.resolutions_=n,jn(JW(this.resolutions_,(o,a)=>a-o,!0),"`resolutions` must be sorted in descending order");let r;if(!e.origins){for(let o=0,a=this.resolutions_.length-1;o<a;++o)if(!r)r=this.resolutions_[o]/this.resolutions_[o+1];else if(this.resolutions_[o]/this.resolutions_[o+1]!==r){r=void 0;break}}this.zoomFactor_=r,this.maxZoom=this.resolutions_.length-1,this.origin_=e.origin!==void 0?e.origin:null,this.origins_=null,e.origins!==void 0&&(this.origins_=e.origins,jn(this.origins_.length==this.resolutions_.length,"Number of `origins` and `resolutions` must be equal"));let s=e.extent;s!==void 0&&!this.origin_&&!this.origins_&&(this.origin_=Pc(s)),jn(!this.origin_&&this.origins_||this.origin_&&!this.origins_,"Either `origin` or `origins` must be configured, never both"),this.tileSizes_=null,e.tileSizes!==void 0&&(this.tileSizes_=e.tileSizes,jn(this.tileSizes_.length==this.resolutions_.length,"Number of `tileSizes` and `resolutions` must be equal")),this.tileSize_=e.tileSize!==void 0?e.tileSize:this.tileSizes_?null:256,jn(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,"Either `tileSize` or `tileSizes` must be configured, never both"),this.extent_=s!==void 0?s:null,this.fullTileRanges_=null,this.tmpSize_=[0,0],this.tmpExtent_=[0,0,0,0],e.tileRanges!==void 0?this.fullTileRanges_=e.tileRanges:e.sizes!==void 0?this.fullTileRanges_=e.sizes.map((o,a)=>{let l=new aE(Math.min(0,o[0]),Math.max(o[0]-1,-1),Math.min(0,o[1]),Math.max(o[1]-1,-1));if(s){let c=this.getTileRangeForExtentAndZ(s,a);l.minX=Math.max(c.minX,l.minX),l.maxX=Math.min(c.maxX,l.maxX),l.minY=Math.max(c.minY,l.minY),l.maxY=Math.min(c.maxY,l.maxY)}return l}):s&&this.calculateTileRanges_(s)}forEachTileCoord(e,t,n){let r=this.getTileRangeForExtentAndZ(e,t);for(let s=r.minX,o=r.maxX;s<=o;++s)for(let a=r.minY,l=r.maxY;a<=l;++a)n([t,s,a])}forEachTileCoordParentTileRange(e,t,n,r){let s,o,a,l=null,c=e[0]-1;for(this.zoomFactor_===2?(o=e[1],a=e[2]):l=this.getTileCoordExtent(e,r);c>=this.minZoom;){if(o!==void 0&&a!==void 0?(o=Math.floor(o/2),a=Math.floor(a/2),s=oA(o,o,a,a,n)):s=this.getTileRangeForExtentAndZ(l,c,n),t(c,s))return!0;--c}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(e){return this.origin_?this.origin_:this.origins_[e]}getOrigins(){return this.origins_}getResolution(e){return this.resolutions_[e]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(e,t,n){if(e[0]<this.maxZoom){if(this.zoomFactor_===2){let s=e[1]*2,o=e[2]*2;return oA(s,s+1,o,o+1,t)}let r=this.getTileCoordExtent(e,n||this.tmpExtent_);return this.getTileRangeForExtentAndZ(r,e[0]+1,t)}return null}getTileRangeForTileCoordAndZ(e,t,n){if(t>this.maxZoom||t<this.minZoom)return null;let r=e[0],s=e[1],o=e[2];if(t===r)return oA(s,o,s,o,n);if(this.zoomFactor_){let l=Math.pow(this.zoomFactor_,t-r),c=Math.floor(s*l),u=Math.floor(o*l);if(t<r)return oA(c,c,u,u,n);let f=Math.floor(l*(s+1))-1,d=Math.floor(l*(o+1))-1;return oA(c,f,u,d,n)}let a=this.getTileCoordExtent(e,this.tmpExtent_);return this.getTileRangeForExtentAndZ(a,t,n)}getTileRangeForExtentAndZ(e,t,n){this.getTileCoordForXYAndZ_(e[0],e[3],t,!1,sv);let r=sv[1],s=sv[2];this.getTileCoordForXYAndZ_(e[2],e[1],t,!0,sv);let o=sv[1],a=sv[2];return oA(r,o,s,a,n)}getTileCoordCenter(e){let t=this.getOrigin(e[0]),n=this.getResolution(e[0]),r=ls(this.getTileSize(e[0]),this.tmpSize_);return[t[0]+(e[1]+.5)*r[0]*n,t[1]-(e[2]+.5)*r[1]*n]}getTileCoordExtent(e,t){let n=this.getOrigin(e[0]),r=this.getResolution(e[0]),s=ls(this.getTileSize(e[0]),this.tmpSize_),o=n[0]+e[1]*s[0]*r,a=n[1]-(e[2]+1)*s[1]*r,l=o+s[0]*r,c=a+s[1]*r;return ql(o,a,l,c,t)}getTileCoordForCoordAndResolution(e,t,n){return this.getTileCoordForXYAndResolution_(e[0],e[1],t,!1,n)}getTileCoordForXYAndResolution_(e,t,n,r,s){let o=this.getZForResolution(n),a=n/this.getResolution(o),l=this.getOrigin(o),c=ls(this.getTileSize(o),this.tmpSize_),u=a*(e-l[0])/n/c[0],f=a*(l[1]-t)/n/c[1];return r?(u=Cy(u,Rp)-1,f=Cy(f,Rp)-1):(u=My(u,Rp),f=My(f,Rp)),iv(o,u,f,s)}getTileCoordForXYAndZ_(e,t,n,r,s){let o=this.getOrigin(n),a=this.getResolution(n),l=ls(this.getTileSize(n),this.tmpSize_),c=(e-o[0])/a/l[0],u=(o[1]-t)/a/l[1];return r?(c=Cy(c,Rp)-1,u=Cy(u,Rp)-1):(c=My(c,Rp),u=My(u,Rp)),iv(n,c,u,s)}getTileCoordForCoordAndZ(e,t,n){return this.getTileCoordForXYAndZ_(e[0],e[1],t,!1,n)}getTileCoordResolution(e){return this.resolutions_[e[0]]}getTileSize(e){return this.tileSize_?this.tileSize_:this.tileSizes_[e]}getFullTileRange(e){return this.fullTileRanges_?this.fullTileRanges_[e]:this.extent_?this.getTileRangeForExtentAndZ(this.extent_,e):null}getZForResolution(e,t){let n=nv(this.resolutions_,e,t||0);return Si(n,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(e,t){return HD(t,0,t.length,2,this.getTileCoordExtent(e))}calculateTileRanges_(e){let t=this.resolutions_.length,n=new Array(t);for(let r=this.minZoom;r<t;++r)n[r]=this.getTileRangeForExtentAndZ(e,r);this.fullTileRanges_=n}},Ly=jD;function cE(i){let e=i.getDefaultTileGrid();return e||(e=Hde(i),i.setDefaultTileGrid(e)),e}function aj(i,e,t){let n=e[0],r=i.getTileCoordCenter(e),s=uE(t);if(!mu(s,r)){let o=Kn(s),a=Math.ceil((s[0]-r[0])/o);return r[0]+=o*a,i.getTileCoordForCoordAndZ(r,n)}return e}function qde(i,e,t,n){n=n!==void 0?n:"top-left";let r=cj(i,e,t);return new Ly({extent:i,origin:AW(i,n),resolutions:r,tileSize:t})}function lj(i){let e=i||{},t=e.extent||ks("EPSG:3857").getExtent(),n={extent:t,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:cj(t,e.maxZoom,e.tileSize,e.maxResolution)};return new Ly(n)}function cj(i,e,t,n){e=e!==void 0?e:42,t=ls(t!==void 0?t:256);let r=Dr(i),s=Kn(i);n=n>0?n:Math.max(s/t[0],r/t[1]);let o=e+1,a=new Array(o);for(let l=0;l<o;++l)a[l]=n/Math.pow(2,l);return a}function Hde(i,e,t,n){let r=uE(i);return qde(r,e,t,n)}function uE(i){i=ks(i);let e=i.getExtent();if(!e){let t=180*Qf.degrees/i.getMetersPerUnit();e=ql(-t,-t,t,t)}return e}var In={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function qn(i,e,t,n,r){if(r){let o=t;t=function(a){return i.removeEventListener(e,t),o.call(n??this,a)}}else n&&n!==i&&(t=t.bind(n));let s={target:i,type:e,listener:t};return i.addEventListener(e,t),s}function ov(i,e,t,n){return qn(i,e,t,n,!0)}function li(i){i&&i.target&&(i.target.removeEventListener(i.type,i.listener),Ah(i))}var nn={CHANGE:"change",ERROR:"error",BLUR:"blur",CLEAR:"clear",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",DRAGENTER:"dragenter",DRAGOVER:"dragover",DROP:"drop",FOCUS:"focus",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",RESIZE:"resize",TOUCHMOVE:"touchmove",WHEEL:"wheel"};var XD=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}},Ip=XD;function ed(){return!0}function td(){return!1}function nd(){}function hE(i){let e,t,n;return function(){let r=Array.prototype.slice.call(arguments);return(!t||this!==n||!ea(r,t))&&(n=this,t=r,e=i.apply(this,arguments)),e}}function uj(i){function e(){let t;try{t=i()}catch(n){return Promise.reject(n)}return t instanceof Promise?t:Promise.resolve(t)}return e()}var $D=class{constructor(e){this.propagationStopped,this.defaultPrevented,this.type=e,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}};var Ao=$D;var YD=class extends Ip{constructor(e){super(),this.eventTarget_=e,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(e,t){if(!e||!t)return;let n=this.listeners_||(this.listeners_={}),r=n[e]||(n[e]=[]);r.includes(t)||r.push(t)}dispatchEvent(e){let t=typeof e=="string",n=t?e:e.type,r=this.listeners_&&this.listeners_[n];if(!r)return;let s=t?new Ao(e):e;s.target||(s.target=this.eventTarget_||this);let o=this.dispatching_||(this.dispatching_={}),a=this.pendingRemovals_||(this.pendingRemovals_={});n in o||(o[n]=0,a[n]=0),++o[n];let l;for(let c=0,u=r.length;c<u;++c)if("handleEvent"in r[c]?l=r[c].handleEvent(s):l=r[c].call(this,s),l===!1||s.propagationStopped){l=!1;break}if(--o[n]===0){let c=a[n];for(delete a[n];c--;)this.removeEventListener(n,nd);delete o[n]}return l}disposeInternal(){this.listeners_&&Ah(this.listeners_)}getListeners(e){return this.listeners_&&this.listeners_[e]||void 0}hasListener(e){return this.listeners_?e?e in this.listeners_:Object.keys(this.listeners_).length>0:!1}removeEventListener(e,t){if(!this.listeners_)return;let n=this.listeners_[e];if(!n)return;let r=n.indexOf(t);r!==-1&&(this.pendingRemovals_&&e in this.pendingRemovals_?(n[r]=nd,++this.pendingRemovals_[e]):(n.splice(r,1),n.length===0&&delete this.listeners_[e]))}},Pp=YD;var lA=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"",Wde=lA.includes("safari")&&!lA.includes("chrom"),eOe=Wde&&(lA.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(lA)),hj=lA.includes("webkit")&&!lA.includes("edge"),ZD=lA.includes("macintosh"),fj=typeof devicePixelRatio<"u"?devicePixelRatio:1,io=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,KD=typeof Image<"u"&&Image.prototype.decode;var fE=(function(){let i=!1;try{let e=Object.defineProperty({},"passive",{get:function(){i=!0}});window.addEventListener("_",null,e),window.removeEventListener("_",null,e)}catch{}return i})();function dj(i,e,t){let n=i,r=!0,s=!1,o=!1,a=[ov(n,nn.LOAD,function(){o=!0,s||e()})];return n.src&&KD?(s=!0,n.decode().then(function(){r&&e()}).catch(function(l){r&&(o?e():t())})):a.push(ov(n,nn.ERROR,t)),function(){r=!1,a.forEach(li)}}function jde(i,e){return new Promise((t,n)=>{function r(){o(),t(i)}function s(){o(),n(new Error("Image load error"))}function o(){i.removeEventListener("load",r),i.removeEventListener("error",s)}i.addEventListener("load",r),i.addEventListener("error",s),e&&(i.src=e)})}function pj(i,e){return e&&(i.src=e),i.src&&KD?new Promise((t,n)=>i.decode().then(()=>t(i)).catch(r=>i.complete&&i.width?t(i):n(r))):jde(i)}var an={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function QD(i){return Math.pow(i,3)}function Dc(i){return 1-QD(1-i)}function mj(i){return 3*i*i-2*i*i*i}function Aj(i){return i}var JD=class extends Pp{constructor(e,t,n){super(),n=n||{},this.tileCoord=e,this.state=t,this.key="",this.transition_=n.transition===void 0?250:n.transition,this.transitionStarts_={},this.interpolate=!!n.interpolate}changed(){this.dispatchEvent(nn.CHANGE)}release(){this.setState(an.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(e){if(this.state!==an.EMPTY){if(this.state!==an.ERROR&&this.state>e)throw new Error("Tile load sequence violation");this.state=e,this.changed()}}load(){ei()}getAlpha(e,t){if(!this.transition_)return 1;let n=this.transitionStarts_[e];if(!n)n=t,this.transitionStarts_[e]=n;else if(n===-1)return 1;let r=t-n+1e3/60;return r>=this.transition_?1:QD(r/this.transition_)}inTransition(e){return this.transition_?this.transitionStarts_[e]!==-1:!1}endTransition(e){this.transition_&&(this.transitionStarts_[e]=-1)}disposeInternal(){this.release(),super.disposeInternal()}},av=JD;function Di(i,e,t,n){let r;return t&&t.length?r=t.shift():io?r=new class extends OffscreenCanvas{style={}}(i??300,e??150):r=document.createElement("canvas"),i&&(r.width=i),e&&(r.height=e),r.getContext("2d",n)}var eN;function Dy(){return eN||(eN=Di(1,1)),eN}function cA(i){let e=i.canvas;e.width=1,e.height=1,i.clearRect(0,0,1,1)}function tN(i,e){let t=e.parentNode;t&&t.replaceChild(i,e)}function gj(i){for(;i.lastChild;)i.lastChild.remove()}function vj(i,e){let t=i.childNodes;for(let n=0;;++n){let r=t[n],s=e[n];if(!r&&!s)break;if(r!==s){if(!r){i.appendChild(s);continue}if(!s){i.removeChild(r),--n;continue}i.insertBefore(s,r)}}}function dE(){return new Proxy({childNodes:[],appendChild:function(e){return this.childNodes.push(e),e},remove:function(){},removeChild:function(e){let t=this.childNodes.indexOf(e);if(t===-1)throw new Error("Node to remove was not found");return this.childNodes.splice(t,1),e},insertBefore:function(e,t){let n=this.childNodes.indexOf(t);if(n===-1)throw new Error("Reference node not found");return this.childNodes.splice(n,0,e),e},style:{}},{get(e,t,n){return t==="firstElementChild"?e.childNodes.length>0?e.childNodes[0]:null:Reflect.get(e,t,n)}})}function Hl(i){return typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas}var nN=class extends av{constructor(e,t,n,r,s,o){super(e,t,o),this.crossOrigin_=r?.crossOrigin,this.referrerPolicy_=r?.referrerPolicy,this.src_=n,this.key=n,this.image_,io?this.image_=new OffscreenCanvas(1,1):(this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.unlisten_=null,this.tileLoadFunction_=s}getImage(){return this.image_}setImage(e){this.image_=e,this.state=an.LOADED,this.unlistenImage_(),this.changed()}getCrossOrigin(){return this.crossOrigin_}getReferrerPolicy(){return this.referrerPolicy_}handleImageError_(){this.state=an.ERROR,this.unlistenImage_(),this.image_=Xde(),this.changed()}handleImageLoad_(){if(io)this.state=an.LOADED;else{let e=this.image_;e.naturalWidth&&e.naturalHeight?this.state=an.LOADED:this.state=an.EMPTY}this.unlistenImage_(),this.changed()}load(){this.state==an.ERROR&&(this.state=an.IDLE,this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.state==an.IDLE&&(this.state=an.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=dj(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}disposeInternal(){this.unlistenImage_(),this.image_=null,super.disposeInternal()}};function Xde(){let i=Di(1,1);return i.fillStyle="rgba(0,0,0,0)",i.fillRect(0,0,1,1),i.canvas}var pE=nN;var iN,uA=[];function _j(i,e,t,n,r){i.beginPath(),i.moveTo(0,0),i.lineTo(e,t),i.lineTo(n,r),i.closePath(),i.save(),i.clip(),i.fillRect(0,0,Math.max(e,n)+1,Math.max(t,r)),i.restore()}function rN(i,e){return Math.abs(i[e*4]-210)>2||Math.abs(i[e*4+3]-.75*255)>2}function $de(){if(iN===void 0){let i=Di(6,6,uA);i.globalCompositeOperation="lighter",i.fillStyle="rgba(210, 0, 0, 0.75)",_j(i,4,5,4,0),_j(i,4,5,0,5);let e=i.getImageData(0,0,3,3).data;iN=rN(e,0)||rN(e,4)||rN(e,8),cA(i),uA.push(i.canvas)}return iN}function xj(i,e,t,n){let r=tv(t,e,i),s=GD(e,n,t),o=e.getMetersPerUnit();o!==void 0&&(s*=o);let a=i.getMetersPerUnit();a!==void 0&&(s/=a);let l=i.getExtent();if(!l||mu(l,r)){let c=GD(i,s,r)/s;isFinite(c)&&c>0&&(s/=c)}return s}function yj(i,e,t,n){let r=dl(t),s=xj(i,e,r,n);return(!isFinite(s)||s<=0)&&XT(t,function(o){return s=xj(i,e,o,n),isFinite(s)&&s>0}),s}function bj(i,e,t,n,r,s,o,a,l,c,u,f,d,A){let y=Di(Math.round(t*i),Math.round(t*e),uA);if(f||(y.imageSmoothingEnabled=!1),l.length===0)return y.canvas;y.scale(t,t);function w(F){return Math.round(F*t)/t}y.globalCompositeOperation="lighter";let S=Wr();l.forEach(function(F,D,L){jT(S,F.extent)});let T,R=t/n,P=(f?1:1+Math.pow(2,-24))/R;if(!d||l.length!==1||c!==0){if(T=Di(Math.round(Kn(S)*R),Math.round(Dr(S)*R),uA),f||(T.imageSmoothingEnabled=!1),r&&A){let F=(r[0]-S[0])*R,D=-(r[3]-S[3])*R,L=Kn(r)*R,C=Dr(r)*R;T.rect(F,D,L,C),T.clip()}l.forEach(function(F,D,L){if(F.image.width>0&&F.image.height>0){if(F.clipExtent){T.save();let G=(F.clipExtent[0]-S[0])*R,W=-(F.clipExtent[3]-S[3])*R,Y=Kn(F.clipExtent)*R,H=Dr(F.clipExtent)*R;T.rect(f?G:Math.round(G),f?W:Math.round(W),f?Y:Math.round(G+Y)-Math.round(G),f?H:Math.round(W+H)-Math.round(W)),T.clip()}let C=(F.extent[0]-S[0])*R,B=-(F.extent[3]-S[3])*R,k=Kn(F.extent)*R,z=Dr(F.extent)*R;T.drawImage(F.image,c,c,F.image.width-2*c,F.image.height-2*c,f?C:Math.round(C),f?B:Math.round(B),f?k:Math.round(C+k)-Math.round(C),f?z:Math.round(B+z)-Math.round(B)),F.clipExtent&&T.restore()}})}let I=Pc(o);return a.getTriangles().forEach(function(F,D,L){let C=F.source,B=F.target,k=C[0][0],z=C[0][1],G=C[1][0],W=C[1][1],Y=C[2][0],H=C[2][1],$=w((B[0][0]-I[0])/s),J=w(-(B[0][1]-I[1])/s),te=w((B[1][0]-I[0])/s),ce=w(-(B[1][1]-I[1])/s),he=w((B[2][0]-I[0])/s),ve=w(-(B[2][1]-I[1])/s),Re=k,Qe=z;k=0,z=0,G-=Re,W-=Qe,Y-=Re,H-=Qe;let Fe=[[G,W,0,0,te-$],[Y,H,0,0,he-$],[0,0,G,W,ce-J],[0,0,Y,H,ve-J]],mt=wW(Fe);if(!mt)return;if(y.save(),y.beginPath(),$de()||!f){y.moveTo(te,ce);let Ve=4,Ye=$-te,Mt=J-ce;for(let Et=0;Et<Ve;Et++)y.lineTo(te+w((Et+1)*Ye/Ve),ce+w(Et*Mt/(Ve-1))),Et!=Ve-1&&y.lineTo(te+w((Et+1)*Ye/Ve),ce+w((Et+1)*Mt/(Ve-1)));y.lineTo(he,ve)}else y.moveTo(te,ce),y.lineTo($,J),y.lineTo(he,ve);y.clip(),y.transform(mt[0],mt[2],mt[1],mt[3],$,J),y.translate(S[0]-Re,S[3]-Qe);let Ee;if(T)Ee=T.canvas,y.scale(P,-P);else{let Ve=l[0],Ye=Ve.extent;Ee=Ve.image,y.scale(Kn(Ye)/Ee.width,-Dr(Ye)/Ee.height)}y.drawImage(Ee,0,0),y.restore()}),T&&(cA(T),uA.push(T.canvas)),u&&(y.save(),y.globalCompositeOperation="source-over",y.strokeStyle="black",y.lineWidth=1,a.getTriangles().forEach(function(F,D,L){let C=F.target,B=(C[0][0]-I[0])/s,k=-(C[0][1]-I[1])/s,z=(C[1][0]-I[0])/s,G=-(C[1][1]-I[1])/s,W=(C[2][0]-I[0])/s,Y=-(C[2][1]-I[1])/s;y.beginPath(),y.moveTo(z,G),y.lineTo(B,k),y.lineTo(W,Y),y.closePath(),y.stroke()}),y.restore()),y.canvas}var Yde=[1,0,0,1,0,0],IOe=new Array(6);function go(){return Yde.slice(0)}function wj(i,e){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i}function jr(i,e){let t=e[0],n=e[1];return e[0]=i[0]*t+i[2]*n+i[4],e[1]=i[1]*t+i[3]*n+i[5],e}function Do(i,e,t,n,r,s,o,a){let l=Math.sin(s),c=Math.cos(s);return i[0]=n*c,i[1]=r*l,i[2]=-n*l,i[3]=r*c,i[4]=o*n*c-a*n*l+e,i[5]=o*r*l+a*r*c+t,i}function AE(i,e){let t=Zde(e);jn(t!==0,"Transformation matrix cannot be inverted");let n=e[0],r=e[1],s=e[2],o=e[3],a=e[4],l=e[5];return i[0]=o/t,i[1]=-r/t,i[2]=-s/t,i[3]=n/t,i[4]=(s*l-o*a)/t,i[5]=-(n*l-r*a)/t,i}function Zde(i){return i[0]*i[3]-i[1]*i[2]}var Kde=[1e5,1e5,1e5,1e5,2,2];function Sj(i){return"matrix("+i.join(", ")+")"}function mE(i){return i.substring(7,i.length-1).split(",").map(parseFloat)}function Tj(i,e){let t=mE(i),n=mE(e);for(let r=0;r<6;++r)if(Math.round((t[r]-n[r])*Kde[r])!==0)return!1;return!0}var Qde=10,Ej=.25,sN=class{constructor(e,t,n,r,s,o,a){this.sourceProj_=e,this.targetProj_=t;let l={},c=a?jW(P=>jr(a,tv(P,this.targetProj_,this.sourceProj_))):rA(this.targetProj_,this.sourceProj_);this.transformInv_=function(P){let I=P[0]+"/"+P[1];return l[I]||(l[I]=c(P)),l[I]},this.maxSourceExtent_=r,this.errorThresholdSquared_=s*s,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!r&&!!this.sourceProj_.getExtent()&&Kn(r)>=Kn(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?Kn(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?Kn(this.targetProj_.getExtent()):null;let u=Pc(n),f=$1(n),d=X1(n),A=j1(n),y=this.transformInv_(u),w=this.transformInv_(f),S=this.transformInv_(d),T=this.transformInv_(A),R=Qde+(o?Math.max(0,Math.ceil(Math.log2(Ty(n)/(o*o*256*256)))):0);if(this.addQuad_(u,f,d,A,y,w,S,T,R),this.wrapsXInSource_){let P=1/0;this.triangles_.forEach(function(I,F,D){P=Math.min(P,I.source[0][0],I.source[1][0],I.source[2][0])}),this.triangles_.forEach(I=>{if(Math.max(I.source[0][0],I.source[1][0],I.source[2][0])-P>this.sourceWorldWidth_/2){let F=[[I.source[0][0],I.source[0][1]],[I.source[1][0],I.source[1][1]],[I.source[2][0],I.source[2][1]]];F[0][0]-P>this.sourceWorldWidth_/2&&(F[0][0]-=this.sourceWorldWidth_),F[1][0]-P>this.sourceWorldWidth_/2&&(F[1][0]-=this.sourceWorldWidth_),F[2][0]-P>this.sourceWorldWidth_/2&&(F[2][0]-=this.sourceWorldWidth_);let D=Math.min(F[0][0],F[1][0],F[2][0]);Math.max(F[0][0],F[1][0],F[2][0])-D<this.sourceWorldWidth_/2&&(I.source=F)}})}l={}}addTriangle_(e,t,n,r,s,o){this.triangles_.push({source:[r,s,o],target:[e,t,n]})}addQuad_(e,t,n,r,s,o,a,l,c){let u=ED([s,o,a,l]),f=this.sourceWorldWidth_?Kn(u)/this.sourceWorldWidth_:null,d=this.sourceWorldWidth_,A=this.sourceProj_.canWrapX()&&f>.5&&f<1,y=!1;if(c>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){let S=ED([e,t,n,r]);y=Kn(S)/this.targetWorldWidth_>Ej||y}!A&&this.sourceProj_.isGlobal()&&f&&(y=f>Ej||y)}if(!y&&this.maxSourceExtent_&&isFinite(u[0])&&isFinite(u[1])&&isFinite(u[2])&&isFinite(u[3])&&!Ar(u,this.maxSourceExtent_))return;let w=0;if(!y&&(!isFinite(s[0])||!isFinite(s[1])||!isFinite(o[0])||!isFinite(o[1])||!isFinite(a[0])||!isFinite(a[1])||!isFinite(l[0])||!isFinite(l[1]))){if(c>0)y=!0;else if(w=(!isFinite(s[0])||!isFinite(s[1])?8:0)+(!isFinite(o[0])||!isFinite(o[1])?4:0)+(!isFinite(a[0])||!isFinite(a[1])?2:0)+(!isFinite(l[0])||!isFinite(l[1])?1:0),w!=1&&w!=2&&w!=4&&w!=8)return}if(c>0){if(!y){let S=[(e[0]+n[0])/2,(e[1]+n[1])/2],T=this.transformInv_(S),R;A?R=(mh(s[0],d)+mh(a[0],d))/2-mh(T[0],d):R=(s[0]+a[0])/2-T[0];let P=(s[1]+a[1])/2-T[1];y=R*R+P*P>this.errorThresholdSquared_}if(y){if(Math.abs(e[0]-n[0])<=Math.abs(e[1]-n[1])){let S=[(t[0]+n[0])/2,(t[1]+n[1])/2],T=this.transformInv_(S),R=[(r[0]+e[0])/2,(r[1]+e[1])/2],P=this.transformInv_(R);this.addQuad_(e,t,S,R,s,o,T,P,c-1),this.addQuad_(R,S,n,r,P,T,a,l,c-1)}else{let S=[(e[0]+t[0])/2,(e[1]+t[1])/2],T=this.transformInv_(S),R=[(n[0]+r[0])/2,(n[1]+r[1])/2],P=this.transformInv_(R);this.addQuad_(e,S,R,r,s,T,P,l,c-1),this.addQuad_(S,t,n,R,T,o,a,P,c-1)}return}}if(A){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}(w&11)==0&&this.addTriangle_(e,n,r,s,a,l),(w&14)==0&&this.addTriangle_(e,n,t,s,a,o),w&&((w&13)==0&&this.addTriangle_(t,r,e,o,l,s),(w&7)==0&&this.addTriangle_(t,r,n,o,l,a))}calculateSourceExtent(){let e=Wr();return this.triangles_.forEach(function(t,n,r){let s=t.source;Jm(e,s[0]),Jm(e,s[1]),Jm(e,s[2])}),e}getTriangles(){return this.triangles_}},Mj=sN;var oN=class extends av{constructor(e,t,n,r,s,o,a,l,c,u,f,d){super(s,an.IDLE,d),this.renderEdges_=f!==void 0?f:!1,this.pixelRatio_=a,this.gutter_=l,this.canvas_=null,this.sourceTileGrid_=t,this.targetTileGrid_=r,this.wrappedTileCoord_=o||s,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=e.canWrapX()?e.getExtent():void 0;let A=r.getTileCoordExtent(this.wrappedTileCoord_),y=this.targetTileGrid_.getExtent(),w=this.sourceTileGrid_.getExtent(),S=y?dh(A,y):A;if(Ty(S)===0){this.state=an.EMPTY;return}let T=e.getExtent();T&&(w?w=dh(w,T):w=T);let R=r.getResolution(this.wrappedTileCoord_[0]),P=yj(e,n,S,R);if(!isFinite(P)||P<=0){this.state=an.EMPTY;return}let I=u!==void 0?u:.5;if(this.triangulation_=new Mj(e,n,S,w,P*I,R),this.triangulation_.getTriangles().length===0){this.state=an.EMPTY;return}this.sourceZ_=t.getZForResolution(P);let F=this.triangulation_.calculateSourceExtent();if(w&&(e.canWrapX()?(F[1]=Si(F[1],w[1],w[3]),F[3]=Si(F[3],w[1],w[3])):F=dh(F,w)),!Ty(F))this.state=an.EMPTY;else{let D=0,L=0;e.canWrapX()&&(D=Kn(T),L=Math.floor((F[0]-T[0])/D)),$T(F.slice(),e,!0).forEach(B=>{let k=t.getTileRangeForExtentAndZ(B,this.sourceZ_);for(let z=k.minX;z<=k.maxX;z++)for(let G=k.minY;G<=k.maxY;G++){let W=L*D;this.sourceTiles_.push({getTile:()=>c(this.sourceZ_,z,G,a),offset:W})}++L}),this.sourceTiles_.length===0&&(this.state=an.EMPTY)}}getImage(){return this.canvas_}reproject_(){let e=[];if(this.sourceTiles_.forEach(t=>{let n=t.tile;if(n&&n.getState()==an.LOADED){let r=this.sourceTileGrid_.getTileCoordExtent(n.tileCoord);r[0]+=t.offset,r[2]+=t.offset;let s=this.clipExtent_?.slice();s&&(s[0]+=t.offset,s[2]+=t.offset),e.push({extent:r,clipExtent:s,image:n.getImage()})}}),this.sourceTiles_.length=0,e.length===0)this.state=an.ERROR;else{let t=this.wrappedTileCoord_[0],n=this.targetTileGrid_.getTileSize(t),r=typeof n=="number"?n:n[0],s=typeof n=="number"?n:n[1],o=this.targetTileGrid_.getResolution(t),a=this.sourceTileGrid_.getResolution(this.sourceZ_),l=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=bj(r,s,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),o,l,this.triangulation_,e,this.gutter_,this.renderEdges_,this.interpolate),this.state=an.LOADED}this.changed()}load(){for(let e of this.sourceTiles_)e.tile=e.getTile();if(this.state==an.IDLE){this.state=an.LOADING,this.changed();let e=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:t})=>{let n=t.getState();if(n==an.IDLE||n==an.LOADING){e++;let r=qn(t,nn.CHANGE,s=>{let o=t.getState();(o==an.LOADED||o==an.ERROR||o==an.EMPTY)&&(li(r),e--,e===0&&(this.unlistenSources_(),this.reproject_()))});this.sourcesListenerKeys_.push(r)}}),e===0?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function({tile:t},n,r){t.getState()==an.IDLE&&t.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(li),this.sourcesListenerKeys_=null}release(){this.canvas_&&(cA(this.canvas_.getContext("2d")),uA.push(this.canvas_),this.canvas_=null),this.sourceTiles_.length=0,super.release()}},gE=oN;var Jde=/\{z\}/g,epe=/\{x\}/g,tpe=/\{y\}/g,npe=/\{-y\}/g;function Cj(i,e,t,n,r){return i.replace(Jde,e.toString()).replace(epe,t.toString()).replace(tpe,n.toString()).replace(npe,function(){if(r===void 0)throw new Error("If the URL template has a {-y} placeholder, the grid extent must be known");return(r-n).toString()})}function Rj(i){let e=[],t=/\{([a-z])-([a-z])\}/.exec(i);if(t){let n=t[1].charCodeAt(0),r=t[2].charCodeAt(0),s;for(s=n;s<=r;++s)e.push(i.replace(t[0],String.fromCharCode(s)));return e}if(t=/\{(\d+)-(\d+)\}/.exec(i),t){let n=parseInt(t[2],10);for(let r=parseInt(t[1],10);r<=n;r++)e.push(i.replace(t[0],r.toString()));return e}return e.push(i),e}function ipe(i,e){return(function(t,n,r){if(!t)return;let s,o=t[0];if(e){let a=e.getFullTileRange(o);a&&(s=a.getHeight()-1)}return Cj(i,o,t[1],t[2],s)})}function Ij(i,e){let t=i.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=ipe(i[r],e);return rpe(n)}function rpe(i){return i.length===1?i[0]:(function(e,t,n){if(!e)return;let r=rj(e),s=mh(r,i.length);return i[s](e,t,n)})}var bu={PROPERTYCHANGE:"propertychange"};var lv=class extends Pp{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(nn.CHANGE)}getRevision(){return this.revision_}onInternal(e,t){if(Array.isArray(e)){let n=e.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=qn(this,e[s],t);return r}return qn(this,e,t)}onceInternal(e,t){let n;if(Array.isArray(e)){let r=e.length;n=new Array(r);for(let s=0;s<r;++s)n[s]=ov(this,e[s],t)}else n=ov(this,e,t);return t.ol_key=n,n}unInternal(e,t){let n=t.ol_key;if(n)spe(n);else if(Array.isArray(e))for(let r=0,s=e.length;r<s;++r)this.removeEventListener(e[r],t);else this.removeEventListener(e,t)}};lv.prototype.on;lv.prototype.once;lv.prototype.un;function spe(i){if(Array.isArray(i))for(let e=0,t=i.length;e<t;++e)li(i[e]);else li(i)}var vE=lv;var _E=class extends Ao{constructor(e,t,n){super(e),this.key=t,this.oldValue=n}},aN=class extends vE{constructor(e){super(),this.on,this.once,this.un,Bn(this),this.values_=null,e!==void 0&&this.setProperties(e)}get(e){let t;return this.values_&&this.values_.hasOwnProperty(e)&&(t=this.values_[e]),t}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}getPropertiesInternal(){return this.values_}hasProperties(){return!!this.values_}notify(e,t){let n;n=`change:${e}`,this.hasListener(n)&&this.dispatchEvent(new _E(n,e,t)),n=bu.PROPERTYCHANGE,this.hasListener(n)&&this.dispatchEvent(new _E(n,e,t))}addChangeListener(e,t){this.addEventListener(`change:${e}`,t)}removeChangeListener(e,t){this.removeEventListener(`change:${e}`,t)}set(e,t,n){let r=this.values_||(this.values_={});if(n)r[e]=t;else{let s=r[e];r[e]=t,s!==t&&this.notify(e,s)}}setProperties(e,t){for(let n in e)this.set(n,e[n],t)}applyProperties(e){e.values_&&Object.assign(this.values_||(this.values_={}),e.values_)}unset(e,t){if(this.values_&&e in this.values_){let n=this.values_[e];delete this.values_[e],vu(this.values_)&&(this.values_=null),t||this.notify(e,n)}}},zs=aN;var lN=class extends zs{constructor(e){super(),this.projection=ks(e.projection),this.attributions_=Pj(e.attributions),this.attributionsCollapsible_=e.attributionsCollapsible??!0,this.loading=!1,this.state_=e.state!==void 0?e.state:"ready",this.wrapX_=e.wrapX!==void 0?e.wrapX:!1,this.interpolate_=!!e.interpolate,this.viewResolver=null,this.viewRejector=null;let t=this;this.viewPromise_=new Promise(function(n,r){t.viewResolver=n,t.viewRejector=r})}getAttributions(){return this.attributions_}getAttributionsCollapsible(){return this.attributionsCollapsible_}getProjection(){return this.projection}getResolutions(e){return null}getView(){return this.viewPromise_}ready(){let e=this.getState();return e==="ready"?Promise.resolve():e==="error"?Promise.reject(new Error("Source failed to load")):new Promise((t,n)=>{let r=()=>{let s=this.getState();s==="ready"?(this.un("change",r),t()):s==="error"&&(this.un("change",r),n(new Error("Source failed to load")))};this.on("change",r)})}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(e){this.attributions_=Pj(e),this.changed()}setState(e){this.state_=e,this.changed()}};function Pj(i){return i?typeof i=="function"?i:(Array.isArray(i)||(i=[i]),e=>i):null}var xE=lN;var cN=class extends xE{constructor(e){super({attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,projection:e.projection,state:e.state,wrapX:e.wrapX,interpolate:e.interpolate}),this.on,this.once,this.un,this.tilePixelRatio_=e.tilePixelRatio!==void 0?e.tilePixelRatio:1,this.tileGrid=e.tileGrid!==void 0?e.tileGrid:null;let t=[256,256];this.tileGrid&&ls(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),t),this.tmpSize=[0,0],this.key_=e.key||Bn(this),this.tileOptions={transition:e.transition,interpolate:e.interpolate},this.zDirection=e.zDirection?e.zDirection:0}getGutterForProjection(e){return 0}getKey(){return this.key_}setKey(e){this.key_!==e&&(this.key_=e,this.changed())}getResolutions(e){let t=e?this.getTileGridForProjection(e):this.tileGrid;return t?t.getResolutions():null}getTile(e,t,n,r,s,o){return ei()}getTileGrid(){return this.tileGrid}getTileGridForProjection(e){return this.tileGrid?this.tileGrid:cE(e)}getTilePixelRatio(e){return this.tilePixelRatio_}getTilePixelSize(e,t,n){let r=this.getTileGridForProjection(n),s=this.getTilePixelRatio(t),o=ls(r.getTileSize(e),this.tmpSize);return s==1?o:YW(o,s,this.tmpSize)}getTileCoordForTileUrlFunction(e,t){let n=t!==void 0?t:this.getProjection(),r=t!==void 0?this.getTileGridForProjection(n):this.tileGrid||this.getTileGridForProjection(n);return this.getWrapX()&&n.isGlobal()&&(e=aj(r,e,n)),sj(e,r)?e:null}clear(){}refresh(){this.clear(),super.refresh()}},yE=class extends Ao{constructor(e,t){super(e),this.tile=t}},Lj=cN;var bE={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};var uN=class i extends Lj{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tilePixelRatio:e.tilePixelRatio,wrapX:e.wrapX,transition:e.transition,interpolate:e.interpolate,key:e.key,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.generateTileUrlFunction_=this.tileUrlFunction===i.prototype.tileUrlFunction,this.tileLoadFunction=e.tileLoadFunction,e.tileUrlFunction&&(this.tileUrlFunction=e.tileUrlFunction),this.urls=null,e.urls?this.setUrls(e.urls):e.url&&this.setUrl(e.url),this.tileLoadingKeys_={}}getTileLoadFunction(){return this.tileLoadFunction}getTileUrlFunction(){return Object.getPrototypeOf(this).tileUrlFunction===this.tileUrlFunction?this.tileUrlFunction.bind(this):this.tileUrlFunction}getUrls(){return this.urls}handleTileChange(e){let t=e.target,n=Bn(t),r=t.getState(),s;r==an.LOADING?(this.tileLoadingKeys_[n]=!0,s=bE.TILELOADSTART):n in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[n],s=r==an.ERROR?bE.TILELOADERROR:r==an.LOADED?bE.TILELOADEND:void 0),s!=null&&this.dispatchEvent(new yE(s,t))}setTileLoadFunction(e){this.tileLoadFunction=e,this.changed()}setTileUrlFunction(e,t){this.tileUrlFunction=e,typeof t<"u"?this.setKey(t):this.changed()}setUrl(e){let t=Rj(e);this.urls=t,this.setUrls(t)}setUrls(e){this.urls=e;let t=e.join(`3+`);this.generateTileUrlFunction_?this.setTileUrlFunction(Ij(e,this.tileGrid),t):this.setKey(t)}tileUrlFunction(e,t,n){}},Dj=uN;var hN=class extends Dj{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:ope,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX,transition:e.transition,interpolate:e.interpolate!==void 0?e.interpolate:!0,key:e.key,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.crossOrigin=e.crossOrigin!==void 0?e.crossOrigin:null,this.referrerPolicy=e.referrerPolicy,this.tileClass=e.tileClass!==void 0?e.tileClass:pE,this.tileGridForProjection={},this.reprojectionErrorThreshold_=e.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(e){return this.getProjection()&&e&&!ev(this.getProjection(),e)?0:this.getGutter()}getGutter(){return 0}getKey(){let e=super.getKey();return this.getInterpolate()||(e+=":disable-interpolation"),e}getTileGridForProjection(e){let t=this.getProjection();if(this.tileGrid&&(!t||ev(t,e)))return this.tileGrid;let n=Bn(e);return n in this.tileGridForProjection||(this.tileGridForProjection[n]=cE(e)),this.tileGridForProjection[n]}createTile_(e,t,n,r,s,o){let a=[e,t,n],l=this.getTileCoordForTileUrlFunction(a,s),c=l?this.tileUrlFunction(l,r,s):void 0,u=new this.tileClass(a,c!==void 0?an.IDLE:an.EMPTY,c!==void 0?c:"",{crossOrigin:this.crossOrigin,referrerPolicy:this.referrerPolicy},this.tileLoadFunction,this.tileOptions);return u.key=o,u.addEventListener(nn.CHANGE,this.handleTileChange.bind(this)),u}getTile(e,t,n,r,s,o){let a=this.getProjection();if(!a||!s||ev(a,s))return this.getTileInternal(e,t,n,r,a||s);let l=[e,t,n],c=this.getKey(),u=this.getTileGridForProjection(a),f=this.getTileGridForProjection(s),d=this.getTileCoordForTileUrlFunction(l,s),A=new gE(a,u,s,f,l,d,this.getTilePixelRatio(r),this.getGutter(),(y,w,S,T)=>this.getTileInternal(y,w,S,T,a,o),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return A.key=c,A}getTileInternal(e,t,n,r,s,o){let a=this.getKey(),l=rv(this,a,e,t,n);if(o&&o.containsKey(l))return o.get(l);let c=this.createTile_(e,t,n,r,s,a);return o?.set(l,c),c}setRenderReprojectionEdges(e){this.renderReprojectionEdges_!=e&&(this.renderReprojectionEdges_=e,this.changed())}setTileGridForProjection(e,t){let n=ks(e);if(n){let r=Bn(n);r in this.tileGridForProjection||(this.tileGridForProjection[r]=t)}}};function ope(i,e){if(io){let t=i.getCrossOrigin(),n="same-origin",r="same-origin";t==="anonymous"||t===""?(n="cors",r="omit"):t==="use-credentials"&&(n="cors",r="include");let s={mode:n,credentials:r,referrerPolicy:i.getReferrerPolicy()};fetch(e,s).then(o=>{if(!o.ok)throw new Error(`HTTP ${o.status}`);return o.blob()}).then(o=>createImageBitmap(o)).then(o=>{let a=i.getImage();a.width=o.width,a.height=o.height,a.getContext("2d").drawImage(o,0,0),o.close?.(),a.dispatchEvent(new Event("load"))}).catch(()=>{i.getImage().dispatchEvent(new Event("error"))});return}i.getImage().src=e}var Nj=hN;var fN=class extends Nj{constructor(e){e=e||{};let t=e.projection!==void 0?e.projection:"EPSG:3857",n=e.tileGrid!==void 0?e.tileGrid:lj({extent:uE(t),maxResolution:e.maxResolution,maxZoom:e.maxZoom,minZoom:e.minZoom,tileSize:e.tileSize});super({attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,referrerPolicy:e.referrerPolicy,interpolate:e.interpolate,projection:t,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileGrid:n,tileLoadFunction:e.tileLoadFunction,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX!==void 0?e.wrapX:!0,transition:e.transition,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.gutter_=e.gutter!==void 0?e.gutter:0}getGutter(){return this.gutter_}},Fj=fN;function Wl(){if(!O.world||!O.lens||O.settling)return;let i=O.engine?.getView();try{let e=Bj();e.last=O.volume.slug,e.volumes[O.volume.slug]={volume:O.volume.slug,world:O.world.slug,lens:O.world.lenses.indexOf(O.lens),center:i?.getCenter(),zoom:i?.getZoom(),hidden:[...O.hiddenCollections],collapsed:[...O.collapsedSections],expanded:[...O.expandedCollections],labels:[...O.labelOverrides],overviewDocked:O.overviewDocked,dockFolded:O.dockFolded,dockDismissed:O.dockDismissed},localStorage.setItem(DL,JSON.stringify(e))}catch{}}function Bj(){try{let i=JSON.parse(localStorage.getItem(DL)||"null");if(i&&i.volumes)return i}catch{}return{last:"",volumes:{}}}function cv(i){let e=Bj(),t=i||e.last,n=t&&e.volumes[t];return n&&n.volume&&n.world?n:null}function uv(){let[i,e]=decodeURIComponent(location.hash.replace(/^#\/?/,"")).split("/").map(t=>t.trim());return{volume:i,world:e}}function Oj(){if(!O.volume||!O.world)return;let i=`#${O.volume.slug}/${O.world.slug}`;location.hash!==i&&history.replaceState(null,"",i)}var dN=class i extends zs{constructor(e){if(super(),this.on,this.once,this.un,this.id_=void 0,this.geometryName_="geometry",this.style_=null,this.styleFunction_=void 0,this.geometryChangeKey_=null,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),e)if(typeof e.getSimplifiedGeometry=="function"){let t=e;this.setGeometry(t)}else{let t=e;this.setProperties(t)}}clone(){let e=new i,t=this.geometryName_;e.setGeometryName(t);let n=this.getPropertiesInternal();if(n){let s=this.getGeometry();for(let o in n)o===t&&s?e.set(o,s.clone()):e.set(o,n[o],!0)}let r=this.getStyle();return r&&e.setStyle(r),e}getGeometry(){return this.get(this.geometryName_)}getId(){return this.id_}getGeometryName(){return this.geometryName_}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}handleGeometryChange_(){this.changed()}handleGeometryChanged_(){this.geometryChangeKey_&&(li(this.geometryChangeKey_),this.geometryChangeKey_=null);let e=this.getGeometry();e&&(this.geometryChangeKey_=qn(e,nn.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(e){this.set(this.geometryName_,e)}setStyle(e){this.style_=e,this.styleFunction_=e?ape(e):void 0,this.changed()}setId(e){this.id_=e,this.changed()}setGeometryName(e){e!==this.geometryName_&&(this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=e,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_())}};function ape(i){if(typeof i=="function")return i;let e;return Array.isArray(i)?e=i:(jn(typeof i.getZIndex=="function","Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),e=[i]),function(){return e}}var Lp=dN;function ml(i,e,t,n,r,s,o){s=s||[],o=o||2;let a=0;for(let l=e;l<t;l+=n){let c=i[l],u=i[l+1];s[a++]=r[0]*c+r[2]*u+r[4],s[a++]=r[1]*c+r[3]*u+r[5];for(let f=2;f<o;f++)s[a++]=i[l+f]}return s&&s.length!=a&&(s.length=a),s}function wE(i,e,t,n,r,s,o){o=o||[];let a=Math.cos(r),l=Math.sin(r),c=s[0],u=s[1],f=0;for(let d=e;d<t;d+=n){let A=i[d]-c,y=i[d+1]-u;o[f++]=c+A*a-y*l,o[f++]=u+A*l+y*a;for(let w=d+2;w<d+n;++w)o[f++]=i[w]}return o&&o.length!=f&&(o.length=f),o}function Uj(i,e,t,n,r,s,o,a){a=a||[];let l=o[0],c=o[1],u=0;for(let f=e;f<t;f+=n){let d=i[f]-l,A=i[f+1]-c;a[u++]=l+r*d,a[u++]=c+s*A;for(let y=f+2;y<f+n;++y)a[u++]=i[y]}return a&&a.length!=u&&(a.length=u),a}function kj(i,e,t,n,r,s,o){o=o||[];let a=0;for(let l=e;l<t;l+=n){o[a++]=i[l]+r,o[a++]=i[l+1]+s;for(let c=l+2;c<l+n;++c)o[a++]=i[c]}return o&&o.length!=a&&(o.length=a),o}var zj=go(),lpe=[NaN,NaN],pN=class extends zs{constructor(){super(),this.extent_=Wr(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=hE((e,t,n)=>{if(!n)return this.getSimplifiedGeometry(t);let r=this.clone();return r.applyTransform(n),r.getSimplifiedGeometry(t)})}simplifyTransformed(e,t){return this.simplifyTransformedInternal(this.getRevision(),e,t)}clone(){return ei()}closestPointXY(e,t,n,r){return ei()}containsXY(e,t){return this.closestPointXY(e,t,lpe,Number.MIN_VALUE)===0}getClosestPoint(e,t){return t=t||[NaN,NaN],this.closestPointXY(e[0],e[1],t,1/0),t}intersectsCoordinate(e){return this.containsXY(e[0],e[1])}computeExtent(e){return ei()}getExtent(e){if(this.extentRevision_!=this.getRevision()){let t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&Km(t),this.extentRevision_=this.getRevision()}return gW(this.extent_,e)}rotate(e,t){ei()}scale(e,t,n){ei()}simplify(e){return this.getSimplifiedGeometry(e*e)}getSimplifiedGeometry(e){return ei()}getType(){return ei()}applyTransform(e){ei()}intersectsExtent(e){return ei()}translate(e,t){ei()}transform(e,t){let n=ks(e),r=n.getUnits()=="tile-pixels"?function(s,o,a){let l=n.getExtent(),c=n.getWorldExtent(),u=Dr(c)/Dr(l);Do(zj,c[0],c[3],u,-u,0,0,0);let f=ml(s,0,s.length,a,zj,o),d=rA(n,t);return d?d(f,f,a):f}:rA(n,t);return this.applyTransform(r),this}},Vj=pN;var mN=class extends Vj{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(e){return W1(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinates(){return ei()}getFirstCoordinate(){return this.flatCoordinates.slice(0,this.stride)}getFlatCoordinates(){return this.flatCoordinates}getLastCoordinate(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)}getLayout(){return this.layout}getSimplifiedGeometry(e){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),e<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&e<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;let t=this.getSimplifiedGeometryInternal(e);return t.getFlatCoordinates().length<this.flatCoordinates.length?t:(this.simplifiedGeometryMaxMinSquaredTolerance=e,this)}getSimplifiedGeometryInternal(e){return this}getStride(){return this.stride}setFlatCoordinates(e,t){this.stride=Gj(e),this.layout=e,this.flatCoordinates=t}setCoordinates(e,t){ei()}setLayout(e,t,n){let r;if(e)r=Gj(e);else{for(let s=0;s<n;++s){if(t.length===0){this.layout="XY",this.stride=2;return}t=t[0]}r=t.length,e=cpe(r)}this.layout=e,this.stride=r}applyTransform(e){this.flatCoordinates&&(e(this.flatCoordinates,this.flatCoordinates,this.layout.startsWith("XYZ")?3:2,this.stride),this.changed())}rotate(e,t){let n=this.getFlatCoordinates();if(n){let r=this.getStride();wE(n,0,n.length,r,e,t,n),this.changed()}}scale(e,t,n){t===void 0&&(t=e),n||(n=dl(this.getExtent()));let r=this.getFlatCoordinates();if(r){let s=this.getStride();Uj(r,0,r.length,s,e,t,n,r),this.changed()}}translate(e,t){let n=this.getFlatCoordinates();if(n){let r=this.getStride();kj(n,0,n.length,r,e,t,n),this.changed()}}};function cpe(i){let e;return i==2?e="XY":i==3?e="XYZ":i==4&&(e="XYZM"),e}function Gj(i){let e;return i=="XY"?e=2:i=="XYZ"||i=="XYM"?e=3:i=="XYZM"&&(e=4),e}function qj(i,e,t){let n=i.getFlatCoordinates();if(!n)return null;let r=i.getStride();return ml(n,0,n.length,r,e,t)}var Al=mN;function Hj(i,e,t,n){for(let r=0,s=t.length;r<s;++r)i[e++]=t[r];return e}function hA(i,e,t,n){for(let r=0,s=t.length;r<s;++r){let o=t[r];for(let a=0;a<n;++a)i[e++]=o[a]}return e}function Ny(i,e,t,n,r){r=r||[];let s=0;for(let o=0,a=t.length;o<a;++o){let l=hA(i,e,t[o],n);r[s++]=l,e=l}return r.length=s,r}function Wj(i,e,t,n,r){r=r||[];let s=0;for(let o=0,a=t.length;o<a;++o){let l=Ny(i,e,t[o],n,r[s]);l.length===0&&(l[0]=e),r[s++]=l,e=l[l.length-1]}return r.length=s,r}var AN=class i extends Al{constructor(e,t){super(),this.setCoordinates(e,t)}clone(){let e=new i(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(e,t,n,r){let s=this.flatCoordinates,o=Au(e,t,s[0],s[1]);if(o<r){let a=this.stride;for(let l=0;l<a;++l)n[l]=s[l];return n.length=a,o}return r}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(e){return WT(this.flatCoordinates,e)}getType(){return"Point"}intersectsExtent(e){return Sy(e,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(e,t){this.setLayout(t,e,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Hj(this.flatCoordinates,0,e,this.stride),this.changed()}},wu=AN;function fA(){return Oq[O.world?.iconOutset==="dark"?"dark":"light"]}function upe(i){let e=O.world?.iconOutset==="dark",t=fpe(i);return(e?t>.3:t<.88)?i:hpe(i,e?.74:.42)}function hpe(i,e){let t=String(i).replace("#","");if(t.length!==6)return i;let[n,r,s]=[0,2,4].map(P=>parseInt(t.slice(P,P+2),16)/255),o=Math.max(n,r,s),a=Math.min(n,r,s),l=(o+a)/2,c=0,u=o-a,f=u===0?0:u/(1-Math.abs(2*l-1));u!==0&&(o===n?c=(r-s)/u%6:o===r?c=(s-n)/u+2:c=(n-r)/u+4,c*=60,c<0&&(c+=360));let d=(1-Math.abs(2*e-1))*f,A=d*(1-Math.abs(c/60%2-1)),y=e-d/2,[w,S,T]=c<60?[d,A,0]:c<120?[A,d,0]:c<180?[0,d,A]:c<240?[0,A,d]:c<300?[A,0,d]:[d,0,A],R=P=>Math.round((P+y)*255).toString(16).padStart(2,"0");return`#${R(w)}${R(S)}${R(T)}`}function fpe(i){let e=String(i).replace("#","");if(e.length!==6)return .5;let t=n=>parseInt(e.slice(n,n+2),16)/255;return .2126*t(0)+.7152*t(2)+.0722*t(4)}function hv(i){let e=Math.abs(Number(i)||0);return jf[(Math.imul(e,2654435761)>>>0)%jf.length]}function Nc(i,e){let t=String(i||"#ffffff").replace("#",""),n=t.length===3?t.split("").map(s=>s+s).join(""):t.slice(0,6).padEnd(6,"f"),r=Number.parseInt(n,16);return`rgba(${r>>16&255}, ${r>>8&255}, ${r&255}, ${e})`}function dA(i,e){i.style.setProperty("--pin-color",pA(e))}function pA(i){return upe(i.color||hv(i.id))}function fv(i,e,t){if(i.classList.remove("has-source-icon"),i.style.removeProperty("--pin-icon"),i.textContent="",!e.iconAsset){i.textContent=t;return}i.style.setProperty("--pin-icon",`url("${gN(e.iconAsset)}")`),i.classList.add("has-source-icon")}function gN(i){let e=i.split("/").map(t=>encodeURIComponent(t)).join("/");return`${O.volume.base}/icons/${e}`}function Su(i){return i.split(/\s+/).slice(0,2).map(e=>e[0]||"").join("")}function jj(i){return Math.imul(Number(i)||0,2654435761)>>>0}function vN(i){return String(i||"").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/[*_`>#]/g,"").replace(/\r/g,"").replace(/\n{3,}/g,`4+5+`).trim()}function jl(i){return new Intl.NumberFormat().format(i)}function cs(i,e,t){return Math.min(t,Math.max(e,i))}function SE(i){return i instanceof HTMLElement&&(i.matches("input, textarea, select")||i.isContentEditable)}var dpe=100;function id(){if(!ge.searchResults)return;let i=[...O.pins.filter(n=>!n.filteredHidden).map(n=>({title:n.location.title,pin:n})),...[...O.zoneRecords.values()].filter(n=>n.zone.title&&!Pa(n.zone.collectionId)&&(!O.search||n.zone.title.toLocaleLowerCase().includes(O.search))).map(n=>({title:n.zone.title,record:n}))].sort((n,r)=>n.title.localeCompare(r.title)),e=i.slice(0,dpe),t=document.createDocumentFragment();if(!e.length){let n=document.createElement("p");n.className="search-empty",n.textContent=O.search?"No visible features match.":"Nothing is enabled. Show a collection to list its features.",t.append(n)}for(let n of e)t.append(n.pin?ppe(n.pin):mpe(n.record));if(i.length>e.length){let n=document.createElement("p");n.className="dock-note",n.textContent=`First ${e.length} of ${jl(i.length)} \u2014 search or filter to narrow the list.`,t.append(n)}ge.searchResults.replaceChildren(t),gpe(i.length),Ape()}function ppe(i){let e=document.createElement("button");e.type="button",e.className="search-result",O.selectedPin===i&&e.classList.add("is-selected"),e.dataset.location=String(i.location.id),dA(e,i.category);let t=document.createElement("span");t.className="result-dot",fv(t,i.category,Su(i.category.title));let n=document.createElement("span"),r=document.createElement("strong");r.textContent=i.location.title;let s=document.createElement("small");return s.textContent=[i.category.title,i.category.group].filter(Boolean).join(" \xB7 "),n.append(r,s),e.append(t,n),e}function mpe(i){let e=document.createElement("button");e.type="button",e.className="search-result",O.selectedZone===i.zone&&e.classList.add("is-selected"),e.dataset.zone=String(i.zone.id);let t=document.createElement("span");t.className="result-dot",t.style.setProperty("background",i.color);let n=document.createElement("span"),r=document.createElement("strong");r.textContent=i.zone.title;let s=document.createElement("small");return s.textContent=i.collection?.title||"Zone",n.append(r,s),e.append(t,n),e}var Xj=28;function Ape(){let i=O.selectedPin?.location.title||"",e=i.length>Xj?`${i.slice(0,Xj-1).trimEnd()}\u2026`:i;ge.dockRailName.textContent=e?` \xB7 ${e}`:"",ge.dockRailName.hidden=!e}function gpe(i){ge.dockCount.textContent=`${jl(i)} ${i===1?"feature":"features"}`,O.search?(ge.dockFlag.textContent=`\u201C${O.search}\u201D`,ge.dockFlag.hidden=!1):O.hiddenCollections.size>0?(ge.dockFlag.textContent="filtered",ge.dockFlag.hidden=!1):ge.dockFlag.hidden=!0}function Fy(){!O.dockFolded||O.dockDismissed||TE(!1)}function _N(i){O.dockDismissed=i,TE(i)}function TE(i,e=!0){O.dockFolded=i,ge.dock.classList.toggle("is-folded",i),ge.dockFold.setAttribute("aria-expanded",String(!i));let t=i?"Bring the panel back (\u2318\u2325B)":"Put the panel away (\u2318\u2325B)";ge.dockFold.setAttribute("aria-label",t),ge.dockFold.setAttribute("title",t),e&&Wl()}function bN(i){O.hiddenCollections.delete(i.category.id),mA(),Fc(),gh(),By(i,!0)}function By(i,e=!1){O.selectedPin=i,O.selectedZone=null,ge.detailCoordinatesField.hidden=!1,document.dispatchEvent(new Event("atlas:selection")),Bc(),O.layers.pins.changed(),O.layers.pinLabels.changed(),O.layers.text.changed(),O.layers.textDetail.changed(),O.layers.priority.changed(),ge.detailTitle.textContent=i.location.title,ge.detailCategory.textContent=[i.category.group,i.category.title].filter(Boolean).join(" / "),ge.detailDescription.textContent="",ge.detailLinks.hidden=!0,wN(),Epe(i),ge.detailID.textContent=String(i.location.id),ge.detailCoordinates.textContent=`${i.location.lat.toFixed(6)}, ${i.location.lng.toFixed(6)}`;let t=Uq(i.coordinate);ge.detailCell.textContent=t,ge.detailCellField.hidden=!t;for(let r of ge.detail.querySelectorAll("[data-cell-system-row]"))r.remove();for(let r of wy(O.world)){if(r.slug==="geohash")continue;let s=r.locate(i.coordinate,O.world);if(!s)continue;let o=document.createElement("div");o.dataset.cellSystemRow=r.slug;let a=document.createElement("dt");a.textContent=s.label;let l=document.createElement("dd");l.textContent=s.value,o.append(a,l),ge.detailCellField.after(o)}let n=Tpe(i);if(ge.detailSource.textContent=n,ge.detailSourceField.hidden=!n,dA(ge.detailDot,i.category),fv(ge.detailDot,i.category,Su(i.category.title)),ge.detail.hidden=!1,Fy(),id(),e){let r=O.engine.getView();r.animate({center:i.coordinate,zoom:Math.min(vh(O.lens),Math.max(r.getZoom()||0,4)),duration:220})}}function $j(i){O.selectedPin=null,O.selectedZone=i,document.dispatchEvent(new Event("atlas:selection")),Bc(),O.layers.pins.changed(),O.layers.priority.changed(),O.layers.zoneTitles.changed(),O.layers.zoneTitleDetail.changed();let e=G1(i);ge.detailTitle.textContent=i.title,ge.detailCategory.textContent=[e?.group,e?.title].filter(Boolean).join(" / ")||i.subtitle||"Zone",ge.detailDescription.textContent="",ge.detailLinks.hidden=!0,ge.detailLinks.replaceChildren(),ge.detailID.textContent=String(i.id),ge.detailCoordinatesField.hidden=!0,ge.detailCellField.hidden=!0;for(let n of ge.detail.querySelectorAll("[data-cell-system-row]"))n.remove();let t=O.world?.merged?.find(n=>n.origin)?.source||"";ge.detailSource.textContent=t,ge.detailSourceField.hidden=!t,ge.detailDot.textContent="",ge.detailDot.removeAttribute("style"),ge.detailDot.style.setProperty("background",hv(i.id)),wN(),Yj([...vpe(i,e),...wD(i.attrs)]),i.hasText?Spe(i):ge.detailDescription.textContent="No description is included in the archive.",ge.detail.hidden=!1,Fy(),id()}function vpe(i,e){let t=O.zoneRecords.get(i.id);if(!t||!e)return[];let n=[],r=yy(O.world);if(e.kind==="area"){if(r){let o=t.geometries.reduce((a,l)=>a+xpe(l,r),0);o>0&&n.push({label:"Area",value:bpe(o)})}let s=O.pins.filter(o=>!o.filteredHidden&&Oy(o.location)&&t.geometries.some(a=>bD(a,o.coordinate))).length;n.push({label:"Locations inside",value:jl(s)})}if(e.kind==="path"&&r){let s=t.geometries.reduce((o,a)=>o+ype(a,r),0);s>0&&n.push({label:"Length",value:wpe(s)})}return n}var xN=110.574;function yN(i,[e,t]){return i.toLatLng(e,-t)}function _pe(i,e){let t=i.map(o=>yN(e,o));if(t.length<3)return 0;let n=t.reduce((o,a)=>o+a[0],0)/t.length,r=111.32*Math.cos(n*Math.PI/180),s=0;for(let o=0,a=t.length-1;o<t.length;a=o++){let[l,c]=t[a],[u,f]=t[o];s+=c*r*u*xN-f*r*l*xN}return Math.abs(s)/2}function xpe(i,e){let t=i.getType()==="MultiPolygon"?i.getPolygons():i.getType()==="Polygon"?[i]:[],n=0;for(let r of t)r.getLinearRings().forEach((s,o)=>{let a=_pe(s.getCoordinates(),e);n+=o===0?a:-a});return Math.max(0,n)}function ype(i,e){let t=i.getType()==="MultiLineString"?i.getCoordinates():i.getType()==="LineString"?[i.getCoordinates()]:[],n=0;for(let r of t)for(let s=1;s<r.length;s++){let[o,a]=yN(e,r[s-1]),[l,c]=yN(e,r[s]),u=(o+l)/2*(Math.PI/180),f=(c-a)*111.32*Math.cos(u),d=(l-o)*xN;n+=Math.hypot(f,d)}return n}function bpe(i){return`${i>=10?jl(Math.round(i)):i.toFixed(2)} km\xB2`}function wpe(i){return i<1?`${Math.round(i*1e3)} m`:`${i>=10?jl(Math.round(i)):i.toFixed(1)} km`}function wN(){for(let i of ge.detail.querySelectorAll("[data-feature-row]"))i.remove()}function Yj(i){let e=ge.detailSourceField;for(let t of i){let n=document.createElement("div");n.dataset.featureRow="";let r=document.createElement("dt");r.textContent=t.label;let s=document.createElement("dd");s.textContent=t.value,n.append(r,s),e.after(n),e=n}}async function Spe(i){let e=await SN();if(O.selectedZone!==i)return;let t=e[String(i.id)]||{};ge.detailDescription.textContent=vN(t.d)||"No description is included in the archive."}function Tpe(i){let e=O.world?.merged;if(!e?.length)return"";let t=e.find(n=>n.origin)?.source||"";if(O.pinSourceIndex?.world!==O.world){let n=new Map;for(let r of e){for(let s of r.adopted||[])n.set(s.d,r.source);for(let s of r.matched||[]){let o=`confirmed by ${r.source}`;n.set(s.w,t?`${t} \xB7 ${o}`:o)}}O.pinSourceIndex={world:O.world,byID:n}}for(let n of e)if(!n.origin&&i.category.group===n.source)return n.source;return O.pinSourceIndex.byID.get(i.location.id)||t}async function Epe(i){let e=await SN();if(O.selectedPin!==i)return;let t=e[String(i.location.id)]||{};i.location.description=t.d||"",i.location.links=t.l||[],ge.detailDescription.textContent=vN(t.d)||"No description is included in the archive.",wN(),Yj(wD(t.a)),Mpe(i)}function Mpe(i){let e=(i.location.links||[]).filter(n=>O.pinByID.has(n.locationId));if(ge.detailLinks.hidden=e.length===0,!e.length){ge.detailLinks.replaceChildren();return}let t=document.createDocumentFragment();for(let n of e){let r=document.createElement("button");r.type="button",r.className="detail-link",r.dataset.location=String(n.locationId),r.textContent=n.title,t.append(r)}ge.detailLinks.replaceChildren(t)}function rd(){let i=O.selectedPin!==null||O.selectedZone!==null;O.selectedPin=null,O.selectedZone=null,document.dispatchEvent(new Event("atlas:selection")),O.sources&&(Bc(),O.layers.pins.changed(),O.layers.pinLabels.changed(),O.layers.text.changed(),O.layers.textDetail.changed(),O.layers.priority.changed(),O.layers.zoneTitles.changed(),O.layers.zoneTitleDetail.changed()),ge.detail.hidden=!0,i&&id()}function Oc(i,e,t,n,r){r=r!==void 0?r:[];let s=0;for(let o=e;o<t;o+=n)r[s++]=i.slice(o,o+n);return r.length=s,r}function Dp(i,e,t,n,r){r=r!==void 0?r:[];let s=0;for(let o=0,a=t.length;o<a;++o){let l=t[o];r[s++]=Oc(i,e,l,n,r[s]),e=l}return r.length=s,r}function Uy(i,e,t,n,r){r=r!==void 0?r:[];let s=0;for(let o=0,a=t.length;o<a;++o){let l=t[o];r[s++]=l.length===1&&l[0]===e?[]:Dp(i,e,l,n,r[s]),e=l[l.length-1]}return r.length=s,r}var TN=class i extends Al{constructor(e,t){super(),t&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendPoint(e){Lo(this.flatCoordinates,e.getFlatCoordinates()),this.changed()}clone(){let e=new i(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(e,t,n,r){if(r<Ic(this.getExtent(),e,t))return r;let s=this.flatCoordinates,o=this.stride;for(let a=0,l=s.length;a<l;a+=o){let c=Au(e,t,s[a],s[a+1]);if(c<r){r=c;for(let u=0;u<o;++u)n[u]=s[a+u];n.length=o}}return r}getCoordinates(){return Oc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(e){let t=this.flatCoordinates.length/this.stride;return e<0||t<=e?null:new wu(this.flatCoordinates.slice(e*this.stride,(e+1)*this.stride),this.layout)}getPoints(){let e=this.flatCoordinates,t=this.layout,n=this.stride,r=[];for(let s=0,o=e.length;s<o;s+=n){let a=new wu(e.slice(s,s+n),t);r.push(a)}return r}getType(){return"MultiPoint"}intersectsExtent(e){let t=this.flatCoordinates,n=this.stride;for(let r=0,s=t.length;r<s;r+=n){let o=t[r],a=t[r+1];if(Sy(e,o,a))return!0}return!1}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=hA(this.flatCoordinates,0,e,this.stride),this.changed()}},Zj=TN;function EN(i,e,t,n){let r=0,s=i[t-n],o=i[t-n+1],a=0,l=0;for(;e<t;e+=n){let c=i[e]-s,u=i[e+1]-o;r+=l*c-a*u,a=c,l=u}return r/2}function MN(i,e,t,n){let r=0;for(let s=0,o=t.length;s<o;++s){let a=t[s];r+=EN(i,e,a,n),e=a}return r}function Kj(i,e,t,n){let r=0;for(let s=0,o=t.length;s<o;++s){let a=t[s];r+=MN(i,e,a,n),e=a[a.length-1]}return r}function Qj(i,e,t,n,r,s,o){let a=i[e],l=i[e+1],c=i[t]-a,u=i[t+1]-l,f;if(c===0&&u===0)f=e;else{let d=((r-a)*c+(s-l)*u)/(c*c+u*u);if(d>1)f=t;else if(d>0){for(let A=0;A<n;++A)o[A]=Po(i[e+A],i[t+A],d);o.length=n;return}else f=e}for(let d=0;d<n;++d)o[d]=i[f+d];o.length=n}function ky(i,e,t,n,r){let s=i[e],o=i[e+1];for(e+=n;e<t;e+=n){let a=i[e],l=i[e+1],c=Au(s,o,a,l);c>r&&(r=c),s=a,o=l}return r}function zy(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];r=ky(i,e,a,n,r),e=a}return r}function Jj(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];r=zy(i,e,a,n,r),e=a[a.length-1]}return r}function Vy(i,e,t,n,r,s,o,a,l,c,u){if(e==t)return c;let f,d;if(r===0){if(d=Au(o,a,i[e],i[e+1]),d<c){for(f=0;f<n;++f)l[f]=i[e+f];return l.length=n,d}return c}u=u||[NaN,NaN];let A=e+n;for(;A<t;)if(Qj(i,A-n,A,n,o,a,u),d=Au(o,a,u[0],u[1]),d<c){for(c=d,f=0;f<n;++f)l[f]=u[f];l.length=n,A+=n}else A+=n*Math.max((Math.sqrt(d)-Math.sqrt(c))/r|0,1);if(s&&(Qj(i,t-n,e,n,o,a,u),d=Au(o,a,u[0],u[1]),d<c)){for(c=d,f=0;f<n;++f)l[f]=u[f];l.length=n}return c}function Gy(i,e,t,n,r,s,o,a,l,c,u){u=u||[NaN,NaN];for(let f=0,d=t.length;f<d;++f){let A=t[f];c=Vy(i,e,A,n,r,s,o,a,l,c,u),e=A}return c}function eX(i,e,t,n,r,s,o,a,l,c,u){u=u||[NaN,NaN];for(let f=0,d=t.length;f<d;++f){let A=t[f];c=Gy(i,e,A,n,r,s,o,a,l,c,u),e=A[A.length-1]}return c}function AA(i,e,t,n,r,s,o){let a=(t-e)/n;if(a<3){for(;e<t;e+=n)s[o++]=i[e],s[o++]=i[e+1];return o}let l=new Array(a);l[0]=1,l[a-1]=1;let c=[e,t-n],u=0;for(;c.length>0;){let f=c.pop(),d=c.pop(),A=0,y=i[d],w=i[d+1],S=i[f],T=i[f+1];for(let R=d+n;R<f;R+=n){let P=i[R],I=i[R+1],F=bW(P,I,y,w,S,T);F>A&&(u=R,A=F)}A>r&&(l[(u-e)/n]=1,d+n<u&&c.push(d,u),u+n<f&&c.push(u,f))}for(let f=0;f<a;++f)l[f]&&(s[o++]=i[e+f*n],s[o++]=i[e+f*n+1]);return o}function EE(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){let u=t[l];o=AA(i,e,u,n,r,s,o),a.push(o),e=u}return o}function Np(i,e){return e*Math.round(i/e)}function Cpe(i,e,t,n,r,s,o){if(e==t)return o;let a=Np(i[e],r),l=Np(i[e+1],r);e+=n,s[o++]=a,s[o++]=l;let c,u;do if(c=Np(i[e],r),u=Np(i[e+1],r),e+=n,e==t)return s[o++]=c,s[o++]=u,o;while(c==a&&u==l);for(;e<t;){let f=Np(i[e],r),d=Np(i[e+1],r);if(e+=n,f==c&&d==u)continue;let A=c-a,y=u-l,w=f-a,S=d-l;if(A*S==y*w&&(A<0&&w<A||A==w||A>0&&w>A)&&(y<0&&S<y||y==S||y>0&&S>y)){c=f,u=d;continue}s[o++]=c,s[o++]=u,a=c,l=u,c=f,u=d}return s[o++]=c,s[o++]=u,o}function qy(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){let u=t[l];o=Cpe(i,e,u,n,r,s,o),a.push(o),e=u}return o}function tX(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){let u=t[l],f=[];o=qy(i,e,u,n,r,s,o,f),a.push(f),e=u[u.length-1]}return o}var CN=class i extends Al{constructor(e,t){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,t!==void 0&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}clone(){return new i(this.flatCoordinates.slice(),this.layout)}closestPointXY(e,t,n,r){return r<Ic(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(ky(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Vy(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,e,t,n,r))}getArea(){return EN(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return Oc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(e){let t=[];return t.length=AA(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,0),new i(t,"XY")}getType(){return"LinearRing"}intersectsExtent(e){return aA(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=hA(this.flatCoordinates,0,e,this.stride),this.changed()}},RN=CN;function Hy(i,e,t,n,r,s,o){let a,l,c,u,f,d,A,y=r[s+1],w=[];for(let R=0,P=t.length;R<P;++R){let I=t[R];for(u=i[I-n],d=i[I-n+1],a=e;a<I;a+=n)f=i[a],A=i[a+1],(y<=d&&A<=y||d<=y&&y<=A)&&(c=(y-d)/(A-d)*(f-u)+u,w.push(c)),u=f,d=A}let S=NaN,T=-1/0;for(w.sort(pl),u=w[0],a=1,l=w.length;a<l;++a){f=w[a];let R=Math.abs(f-u);R>T&&(c=(u+f)/2,Py(i,e,t,n,c,y)&&(S=c,T=R)),u=f}return isNaN(S)&&(S=r[s]),o?(o.push(S,y,T),o):[S,y,T]}function ME(i,e,t,n,r){let s=[];for(let o=0,a=t.length;o<a;++o){let l=t[o];s=Hy(i,e,l,n,r,2*o,s),e=l[l.length-1]}return s}function nX(i,e,t,n){for(;e<t-n;){for(let r=0;r<n;++r){let s=i[e+r];i[e+r]=i[t-n+r],i[t-n+r]=s}e+=n,t-=n}}function IN(i,e,t,n){let r=0,s=i[t-n],o=i[t-n+1];for(;e<t;e+=n){let a=i[e],l=i[e+1];r+=(a-s)*(l+o),s=a,o=l}return r===0?void 0:r>0}function PN(i,e,t,n,r){r=r!==void 0?r:!1;for(let s=0,o=t.length;s<o;++s){let a=t[s],l=IN(i,e,a,n);if(s===0){if(r&&l||!r&&!l)return!1}else if(r&&!l||!r&&l)return!1;e=a}return!0}function iX(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];if(!PN(i,e,a,n,r))return!1;a.length&&(e=a[a.length-1])}return!0}function CE(i,e,t,n,r){r=r!==void 0?r:!1;for(let s=0,o=t.length;s<o;++s){let a=t[s],l=IN(i,e,a,n);(s===0?r&&l||!r&&!l:r&&!l||!r&&l)&&nX(i,e,a,n),e=a}return e}function LN(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s)e=CE(i,e,t[s],n,r);return e}function rX(i,e){let t=[],n=0,r=0,s;for(let o=0,a=e.length;o<a;++o){let l=e[o],c=IN(i,n,l,2);if(s===void 0&&(s=c),c===s)t.push(e.slice(r,o+1));else{if(t.length===0)continue;t[t.length-1].push(e[r])}r=o+1,n=l}return t}var RE=class i extends Al{constructor(e,t,n){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,t!==void 0&&n?(this.setFlatCoordinates(t,e),this.ends_=n):this.setCoordinates(e,t)}appendLinearRing(e){this.flatCoordinates?Lo(this.flatCoordinates,e.getFlatCoordinates()):this.flatCoordinates=e.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){let e=new i(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return e.applyProperties(this),e}closestPointXY(e,t,n,r){return r<Ic(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(zy(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Gy(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,e,t,n,r))}containsXY(e,t){return Py(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,t)}getArea(){return MN(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(e){let t;return e!==void 0?(t=this.getOrientedFlatCoordinates().slice(),CE(t,0,this.ends_,this.stride,e)):t=this.flatCoordinates,Dp(t,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){let e=dl(this.getExtent());this.flatInteriorPoint_=Hy(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new wu(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(e){return e<0||this.ends_.length<=e?null:new RN(this.flatCoordinates.slice(e===0?0:this.ends_[e-1],this.ends_[e]),this.layout)}getLinearRings(){let e=this.layout,t=this.flatCoordinates,n=this.ends_,r=[],s=0;for(let o=0,a=n.length;o<a;++o){let l=n[o],c=new RN(t.slice(s,l),e);r.push(c),s=l}return r}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let e=this.flatCoordinates;PN(e,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=CE(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){let t=[],n=[];return t.length=qy(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(e),t,0,n),new i(t,"XY",n)}getType(){return"Polygon"}intersectsExtent(e){return WD(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||(this.flatCoordinates=[]);let n=Ny(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=n.length===0?0:n[n.length-1],this.changed()}},_h=RE;function DN(i){if(ph(i))throw new Error("Cannot create polygon from empty extent");let e=i[0],t=i[1],n=i[2],r=i[3],s=[e,t,e,r,n,r,n,t,e,t];return new RE(s,"XY",[s.length])}function IE(i,e,t,n){let r=[],s=Wr();for(let o=0,a=t.length;o<a;++o){let l=t[o];s=W1(i,e,l[0],n),r.push((s[0]+s[2])/2,(s[1]+s[3])/2),e=l[l.length-1]}return r}var NN=class i extends Al{constructor(e,t,n){if(super(),this.endss_=[],this.flatInteriorPointsRevision_=-1,this.flatInteriorPoints_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,!n&&!Array.isArray(e[0])){let r=e,s=[],o=[];for(let a=0,l=r.length;a<l;++a){let c=r[a],u=s.length,f=c.getEnds();for(let d=0,A=f.length;d<A;++d)f[d]+=u;Lo(s,c.getFlatCoordinates()),o.push(f)}t=r.length===0?this.getLayout():r[0].getLayout(),e=s,n=o}t!==void 0&&n?(this.setFlatCoordinates(t,e),this.endss_=n):this.setCoordinates(e,t)}appendPolygon(e){let t;if(!this.flatCoordinates)this.flatCoordinates=e.getFlatCoordinates().slice(),t=e.getEnds().slice(),this.endss_.push();else{let n=this.flatCoordinates.length;Lo(this.flatCoordinates,e.getFlatCoordinates()),t=e.getEnds().slice();for(let r=0,s=t.length;r<s;++r)t[r]+=n}this.endss_.push(t),this.changed()}clone(){let e=this.endss_.length,t=new Array(e);for(let r=0;r<e;++r)t[r]=this.endss_[r].slice();let n=new i(this.flatCoordinates.slice(),this.layout,t);return n.applyProperties(this),n}closestPointXY(e,t,n,r){return r<Ic(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Jj(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),eX(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,e,t,n,r))}containsXY(e,t){return tj(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e,t)}getArea(){return Kj(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(e){let t;return e!==void 0?(t=this.getOrientedFlatCoordinates().slice(),LN(t,0,this.endss_,this.stride,e)):t=this.flatCoordinates,Uy(t,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){let e=IE(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=ME(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new Zj(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let e=this.flatCoordinates;iX(e,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=LN(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){let t=[],n=[];return t.length=tX(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(e),t,0,n),new i(t,"XY",n)}getPolygon(e){if(e<0||this.endss_.length<=e)return null;let t;if(e===0)t=0;else{let s=this.endss_[e-1];t=s[s.length-1]}let n=this.endss_[e].slice(),r=n[n.length-1];if(t!==0)for(let s=0,o=n.length;s<o;++s)n[s]-=t;return new _h(this.flatCoordinates.slice(t,r),this.layout,n)}getPolygons(){let e=this.layout,t=this.flatCoordinates,n=this.endss_,r=[],s=0;for(let o=0,a=n.length;o<a;++o){let l=n[o].slice(),c=l[l.length-1];if(s!==0)for(let f=0,d=l.length;f<d;++f)l[f]-=s;let u=new _h(t.slice(s,c),e,l);r.push(u),s=c}return r}getType(){return"MultiPolygon"}intersectsExtent(e){return ij(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,3),this.flatCoordinates||(this.flatCoordinates=[]);let n=Wj(this.flatCoordinates,0,e,this.stride,this.endss_);if(n.length===0)this.flatCoordinates.length=0;else{let r=n[n.length-1];this.flatCoordinates.length=r.length===0?0:r[r.length-1]}this.changed()}},PE=NN;function sX(i){return i.key.toLocaleLowerCase()==="g"?(i.preventDefault(),oX(),O.gridEnabled?(ge.gridInput.focus(),ge.gridInput.select()):ge.viewport.focus({preventScroll:!0}),!0):i.key===" "&&O.gridEnabled&&i.target!==ge.subgridToggle?(i.preventDefault(),Wy(!O.subgridVisible),!0):i.key==="Escape"&&O.gridEnabled?(i.preventDefault(),FN(),!0):!1}function oX(i=!O.gridEnabled){O.gridEnabled=i,i&&Wy(!0),jy(),Bc(),O.layers.pins.changed(),O.layers.text.changed(),O.layers.priority.changed()}function Wy(i){O.subgridVisible=i,O.layers.grid.changed(),O.layers.gridContext.changed(),ge.subgridToggle.setAttribute("aria-pressed",String(i)),ge.subgridToggle.setAttribute("aria-label",i?"Hide the subgrid":"Show the subgrid"),aX(),document.dispatchEvent(new Event("atlas:grid"))}function aX(){if(!O.gridEnabled){ge.gridHint.textContent="G \xB7 grid off";return}ge.gridHint.textContent=`G-${O.gridCell||"root"}`+(O.subgridVisible?"":" no subgrid")}function gA(i){let e=Ts(),t=e.parseInput(e.normalizeInput(i));if(t===null)return;let n=t!==O.gridCell;O.gridCell=t,O.gridEnabled||(O.gridEnabled=!0),jy(),Bc(),O.layers.pins.changed(),O.layers.text.changed(),O.layers.priority.changed(),n&&(rd(),O.engine.getView().fit(ON(),{size:O.engine.getSize(),padding:[52,52,52,52],maxZoom:vh(O.lens),duration:180}))}function FN(){if(O.gridEnabled){if(!O.gridCell){oX(!1);return}gA(Ts().parent(O.gridCell))}}function jy(){if(O.sources){if(O.sources.grid.clear(),O.sources.gridContext.clear(),ge.gridNavigator.hidden=!O.gridEnabled,aX(),Rpe(),O.gridEnabled&&O.lens){let i=Ts();ge.gridInput.maxLength=i.inputLength(O.world),ge.gridInput.value=O.gridCell,ge.gridBack.title=O.gridCell?`Back one ${i.slug} level`:`Close ${i.slug} grid`;for(let e of NE())Dpe(e)}document.dispatchEvent(new Event("atlas:grid"))}}function Rpe(){let i=wy(O.world),e=Ts();if(ge.gridSystemName.textContent=e.name,ge.gridSystem.hidden=i.length<2,i.length<2)return;let t=i[(i.indexOf(e)+1)%i.length];ge.gridSystem.textContent=e.short,ge.gridSystem.title=`Dividing by ${e.name} \xB7 \u2318G for ${t.name}`,ge.gridSystem.setAttribute("aria-label",`Cell system: ${e.name}. Switch to ${t.name}`)}function BN(){let i=wy(O.world);if(i.length<2)return;let e=i.indexOf(Ts());Ipe(i[(e+1)%i.length].slug)}function Ipe(i){if(i===O.gridSystem)return;let e=Ts(),t=O.gridCell;O.gridSystem=i,O.gridCell=t?pW(e,Ts(),t,O.world):"",jy(),Bc(),O.layers.pins.changed(),O.layers.text.changed(),O.layers.priority.changed()}function Ppe(i){return jf[Ts().colorKey(i)]}function DE(i,{subgridVisible:e,labelled:t}){let{role:n,contextDistance:r}=i;if(n==="child"&&(!t||!e))return null;let s=Ppe(i.hash),o=n==="leaf"||n==="scope",a=n==="scope"&&e,l={color:o?Vi.lineWhite:s,opacity:n==="neighbor"?Vi.neighborLineAlpha:n==="child"?Vi.childLineAlpha:1,widthPx:a?Vi.widths.scopeBare:Vi.widths[n]},c=null;n==="neighbor"?c={color:Vi.dimColor,opacity:Math.min(Vi.dimCap,Vi.dimBase+r*Vi.dimStep)}:n==="leaf"?c={color:s,opacity:Vi.leafFillAlpha}:n==="child"&&(c={color:s,opacity:Vi.childFillAlpha});let u=null;if(t&&!a){let{context:f,principal:d}=Ts().label(i.hash);u={prefix:f,final:d,color:o?Vi.lineWhite:s,textAlpha:n==="neighbor"?Vi.neighborTextAlpha:1,chip:n==="neighbor"?Vi.neighborChip:Vi.chip,sizePx:n==="neighbor"?Vi.neighborLabelSizePx:Vi.labelSizePx}}return{line:l,fill:c,label:u,bare:a}}function NE(){let i=Ts(),e=[],t=Lpe(i,O.gridCell);for(let n=0;n<t.length-1;n++){let r=t[n+1];for(let s of i.children(t[n]))s!==r&&e.push(LE(i,s,"neighbor",t.length-1-n))}if(O.gridCell&&i.level(O.gridCell)>=i.maxLevel(O.world))return e.push(LE(i,O.gridCell,"leaf",0)),e;O.gridCell&&e.push(LE(i,O.gridCell,"scope",0));for(let n of i.children(O.gridCell))e.push(LE(i,n,"child",0));return e}function Lpe(i,e){let t=[e],n=e;for(;n;)n=i.parent(n),t.unshift(n);return t}function LE(i,e,t,n){return{hash:e,extent:i.bbox(e),ring:i.ring(e),pole:i.poleContained(e),childIndex:i.childIndex(e),role:t,contextDistance:n}}function Dpe(i){let e=Ts(),t=O.pins.filter(s=>!s.filteredHidden&&e.contains(i.hash,s.coordinate)).length,n=new Lp({geometry:Npe(i),gridCell:{hash:i.hash,extent:i.extent,role:i.role,count:t,contextDistance:i.contextDistance},priority:i.role==="neighbor"?-i.contextDistance*100+i.childIndex:i.childIndex});(i.role==="neighbor"?O.sources.gridContext:O.sources.grid).addFeature(n)}function Npe(i){let e=Xf(),t=i.ring;if(i.pole){let o=i.pole==="north"?e[3]:e[1];t=[...t,[t[t.length-1][0],o],[t[0][0],o],t[0]]}if(t.every(([o])=>o>=e[0]&&o<=e[2]))return new _h([t]);let r=e[2]-e[0],s=[];for(let o of[0,-r,r]){let a=mW(t.map(([l,c])=>[l+o,c]),e[0],e[2]);a.length>=4&&s.push([a])}return new PE(s)}function ON(){return Ts().bbox(O.gridCell)}function lX(){return Ts().maxLevel(O.world)}function Fp(i){return!O.gridEnabled||!O.gridCell?!1:Ts().contains(O.gridCell,i.coordinate)}var BE=[NaN,NaN,NaN,0],UN;function Fpe(){return UN||(UN=Di(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),UN}var Bpe=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Ope=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Upe=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,kpe=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function FE(i,e){return i.endsWith("%")?Number(i.substring(0,i.length-1))/e:Number(i)}function $y(i){throw new Error('failed to parse "'+i+'" as color')}function cX(i){if(i.toLowerCase().startsWith("rgb")){let s=i.match(Ope)||i.match(Bpe)||i.match(Upe);if(s){let o=s[4],a=100/255;return[Si(FE(s[1],a)+.5|0,0,255),Si(FE(s[2],a)+.5|0,0,255),Si(FE(s[3],a)+.5|0,0,255),o!==void 0?Si(FE(o,100),0,1):1]}$y(i)}if(i.startsWith("#")){if(kpe.test(i)){let s=i.substring(1),o=s.length<=4?1:2,a=[0,0,0,255];for(let l=0,c=s.length;l<c;l+=o){let u=parseInt(s.substring(l,l+o),16);o===1&&(u+=u<<4),a[l/o]=u}return a[3]=a[3]/255,a}$y(i)}let e=Fpe();e.fillStyle="#abcdef";let t=e.fillStyle;e.fillStyle=i,e.fillStyle===t&&(e.fillStyle="#fedcba",t=e.fillStyle,e.fillStyle=i,e.fillStyle===t&&$y(i));let n=e.fillStyle;if(n.startsWith("#")||n.startsWith("rgba"))return cX(n);e.clearRect(0,0,1,1),e.fillRect(0,0,1,1);let r=Array.from(e.getImageData(0,0,1,1).data);return r[3]=eA(r[3]/255,3),r}function uX(i){return typeof i=="string"?i:Zy(i)}var zpe=1024,Xy={},kN=0;function hX(i){if(i.length===4)return i;let e=i.slice();return e[3]=1,e}function zN(i){return i>.0031308?Math.pow(i,1/2.4)*269.025-14.025:i*3294.6}function VN(i){return i>.2068965?Math.pow(i,3):(i-4/29)*(108/841)}function GN(i){return i>10.314724?Math.pow((i+14.025)/269.025,2.4):i/3294.6}function qN(i){return i>.0088564?Math.pow(i,1/3):i/(108/841)+4/29}function HN(i){let e=GN(i[0]),t=GN(i[1]),n=GN(i[2]),r=qN(e*.222488403+t*.716873169+n*.06060791),s=500*(qN(e*.452247074+t*.399439023+n*.148375274)-r),o=200*(r-qN(e*.016863605+t*.117638439+n*.865350722)),a=Math.atan2(o,s)*(180/Math.PI);return[116*r-16,Math.sqrt(s*s+o*o),a<0?a+360:a,i[3]]}function fX(i){let e=(i[0]+16)/116,t=i[1],n=i[2]*Math.PI/180,r=VN(e),s=VN(e+t/500*Math.cos(n)),o=VN(e-t/200*Math.sin(n)),a=zN(s*3.021973625-r*1.617392459-o*.404875592),l=zN(s*-.943766287+r*1.916279586+o*.027607165),c=zN(s*.069407491-r*.22898585+o*1.159737864);return[Si(a+.5|0,0,255),Si(l+.5|0,0,255),Si(c+.5|0,0,255),i[3]]}function Yy(i){if(i==="none")return BE;if(Xy.hasOwnProperty(i))return Xy[i];if(kN>=zpe){let t=0;for(let n in Xy)(t++&3)===0&&(delete Xy[n],--kN)}let e=cX(i);e.length!==4&&$y(i);for(let t of e)isNaN(t)&&$y(i);return Xy[i]=e,++kN,e}function Uc(i){return Array.isArray(i)?i:Yy(i)}function Zy(i){let e=i[0];e!=(e|0)&&(e=e+.5|0);let t=i[1];t!=(t|0)&&(t=t+.5|0);let n=i[2];n!=(n|0)&&(n=n+.5|0);let r=i[3]===void 0?1:Math.round(i[3]*1e3)/1e3;return"rgba("+e+","+t+","+n+","+r+")"}var jN=class{constructor(){this.cache_={},this.patternCache_={},this.cacheSize_=0,this.maxCacheSize_=1024}clear(){this.cache_={},this.patternCache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let e=0;for(let t in this.cache_){let n=this.cache_[t];(e++&3)===0&&!n.hasListener()&&(delete this.cache_[t],delete this.patternCache_[t],--this.cacheSize_)}}}get(e,t){let n=WN(e,t);return n in this.cache_?this.cache_[n]:null}getPattern(e,t){let n=WN(e,t);return n in this.patternCache_?this.patternCache_[n]:null}set(e,t,n,r){let s=WN(e,t),o=s in this.cache_;this.cache_[s]=n,r&&(n.getImageState()===In.IDLE&&n.load(),n.getImageState()===In.LOADING?n.ready().then(()=>{this.patternCache_[s]=Dy().createPattern(n.getImage(1),"repeat")}):this.patternCache_[s]=Dy().createPattern(n.getImage(1),"repeat")),o||++this.cacheSize_}setSize(e){this.maxCacheSize_=e,this.expire()}};function WN(i,e){let t=e?Uc(e):"null";return i+":"+t}var ta=new jN;var Ky=null,OE=class extends Pp{constructor(e,t,n,r,s){super(),this.hitDetectionImage_=null,this.image_=e,this.crossOrigin_=n?.crossOrigin,this.referrerPolicy_=n?.referrerPolicy,this.canvas_={},this.color_=s,this.imageState_=r===void 0?In.IDLE:r,this.size_=e&&e.width&&e.height?[e.width,e.height]:null,this.src_=t,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)}isTainted_(){if(this.tainted_===void 0&&this.imageState_===In.LOADED){Ky||(Ky=Di(1,1,void 0,{willReadFrequently:!0})),Ky.drawImage(this.image_,0,0);try{Ky.getImageData(0,0,1,1),this.tainted_=!1}catch{Ky=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(nn.CHANGE)}handleImageError_(){this.imageState_=In.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=In.LOADED,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(e){return this.image_||this.initializeImage_(),this.replaceColor_(e),this.canvas_[e]?this.canvas_[e]:this.image_}setImage(e){this.image_=e}getPixelRatio(e){return this.replaceColor_(e),this.canvas_[e]?e:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){let e=this.size_[0],t=this.size_[1],n=Di(e,t);n.fillRect(0,0,e,t),this.hitDetectionImage_=n.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===In.IDLE){this.image_||this.initializeImage_(),this.imageState_=In.LOADING;try{this.src_!==void 0&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&pj(this.image_,this.src_).then(e=>{this.image_=e,this.handleImageLoad_()}).catch(this.handleImageError_.bind(this))}}replaceColor_(e){if(!this.color_||this.canvas_[e]||this.imageState_!==In.LOADED)return;let t=this.image_,n=Di(Math.ceil(t.width*e),Math.ceil(t.height*e)),r=n.canvas;n.scale(e,e),n.drawImage(t,0,0),n.globalCompositeOperation="multiply",n.fillStyle=uX(this.color_),n.fillRect(0,0,r.width/e,r.height/e),n.globalCompositeOperation="destination-in",n.drawImage(t,0,0),this.canvas_[e]=r}ready(){return this.ready_||(this.ready_=new Promise(e=>{if(this.imageState_===In.LOADED||this.imageState_===In.ERROR)e();else{let t=()=>{(this.imageState_===In.LOADED||this.imageState_===In.ERROR)&&(this.removeEventListener(nn.CHANGE,t),e())};this.addEventListener(nn.CHANGE,t)}})),this.ready_}};function Bp(i,e,t,n,r,s){let o=e===void 0?void 0:ta.get(e,r);return o||(o=new OE(i,i&&"src"in i?i.src||void 0:e,t,n,r),ta.set(e,r,o,s)),s&&o&&!ta.getPattern(e,r)&&ta.set(e,r,o,s),o}var dX=OE;function gl(i){return i?Array.isArray(i)?Zy(i):typeof i=="object"&&"src"in i?Vpe(i):i:null}function Vpe(i){if(!i.offset||!i.size)return ta.getPattern(i.src,i.color);let e=i.src+":"+i.offset,t=ta.getPattern(e,i.color);if(t)return t;let n=ta.get(i.src,null);if(n.getImageState()!==In.LOADED)return null;let r=Di(i.size[0],i.size[1]);return r.drawImage(n.getImage(1),i.offset[0],i.offset[1],i.size[0],i.size[1],0,0,i.size[0],i.size[1]),Bp(r.canvas,e,void 0,In.LOADED,i.color,!0),ta.getPattern(e,i.color)}var Qy="ol-hidden";var Op="ol-unselectable";var dv="ol-control",XN="ol-collapsed",Gpe=new RegExp(["^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)","(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?","(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))","(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))",`?\\s*([-,\\"\\'\\sa-z0-9]+?)\\s*$`].join(""),"i"),pX=["style","variant","weight","size","lineHeight","family"],UE={normal:400,bold:700},kE=function(i){let e=i.match(Gpe);if(!e)return null;let t={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let n=0,r=pX.length;n<r;++n){let s=e[n+1];s!==void 0&&(t[pX[n]]=typeof s=="string"?s.trim():s)}return isNaN(Number(t.weight))&&t.weight in UE&&(t.weight=UE[t.weight]),t.families=t.family.split(/,\s?/).map(n=>n.trim().replace(/^['"]|['"]$/g,"")),t};var zE="10px sans-serif",ro="#000",xh="round",vl=[],_l=0,yh="round",sd=10,AX=0,na="#000",Up="center",_A="middle",od=[0,0,0,0],ad=1,vA=new zs,Jy=null,mX,$N={},qpe=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function Hpe(i,e,t){return`${i} ${e} 16px "${t}"`}var gX=(function(){let e,t;async function n(s){await t.ready;let o=kE(s),a=o.families[0].toLowerCase(),l=o.weight,c=[];return t.forEach(f=>{let d=f.family.replace(/^['"]|['"]$/g,"").toLowerCase(),A=UE[f.weight]||f.weight;d===a&&f.style===o.style&&A==l&&c.push(f)}),c.length===0?!1:(await Promise.all(c.map(f=>f.load().then(()=>!0,()=>!1)))).some(f=>f)}async function r(){await t.ready;let s=!0,o=vA.getProperties(),a=Object.keys(o).filter(l=>o[l]<100);for(let l=a.length-1;l>=0;--l){let c=a[l],u=o[c];u<100&&(await n(c)?(Ah($N),vA.set(c,100)):(u+=10,vA.set(c,u,!0),u<100&&(s=!1)))}e=void 0,s||(e=setTimeout(r,100))}return async function(s){t||(t=io?self.fonts:document.fonts);let o=kE(s);if(!o)return;let a=o.families,l=!1;for(let c of a){if(qpe.has(c))continue;let u=Hpe(o.style,o.weight,c);vA.get(u)===void 0&&(vA.set(u,0,!0),l=!0)}l&&(clearTimeout(e),e=setTimeout(r,100))}})(),Wpe=(function(){let i;return function(e){let t=$N[e];if(t==null){if(io){let n=kE(e),r=vX(e,"\u017Dg");t=(isNaN(Number(n.lineHeight))?1.2:Number(n.lineHeight))*(r.actualBoundingBoxAscent+r.actualBoundingBoxDescent)}else i||(i=document.createElement("div"),i.innerHTML="M",i.style.minHeight="0",i.style.maxHeight="none",i.style.height="auto",i.style.padding="0",i.style.border="none",i.style.position="absolute",i.style.display="block",i.style.left="-99999px"),i.style.font=e,document.body.appendChild(i),t=i.offsetHeight,document.body.removeChild(i);$N[e]=t}return t}})();function vX(i,e){return Jy||(Jy=Di(1,1)),i!=mX&&(Jy.font=i,mX=Jy.font),Jy.measureText(e)}function _X(i,e){return vX(i,e).width}function YN(i,e,t){if(e in t)return t[e];let n=e.split(`6+`).reduce((r,s)=>Math.max(r,_X(i,s)),0);return t[e]=n,n}function xX(i,e){let t=[],n=[],r=[],s=0,o=0,a=0,l=0;for(let c=0,u=e.length;c<=u;c+=2){let f=e[c];if(f===`7+`||c===u){s=Math.max(s,o),r.push(o),o=0,a+=l,l=0;continue}let d=e[c+1]||i.font,A=_X(d,f);t.push(A),o+=A;let y=Wpe(d);n.push(y),l=Math.max(l,y)}return{width:s,height:a,widths:t,heights:n,lineWidths:r}}function yX(i,e,t,n,r,s,o,a,l,c,u){i.save(),t!==1&&(i.globalAlpha===void 0?i.globalAlpha=f=>f.globalAlpha*=t:i.globalAlpha*=t),e&&i.transform.apply(i,e),n.contextInstructions?(i.translate(l,c),i.scale(u[0],u[1]),jpe(n,i)):u[0]<0||u[1]<0?(i.translate(l,c),i.scale(u[0],u[1]),i.drawImage(n,r,s,o,a,0,0,o,a)):i.drawImage(n,r,s,o,a,l,c,o*u[0],a*u[1]),i.restore()}function jpe(i,e){let t=i.contextInstructions;for(let n=0,r=t.length;n<r;n+=2)Array.isArray(t[n+1])?e[t[n]].apply(e,t[n+1]):e[t[n]]=t[n+1]}var ZN=class i{constructor(e){this.opacity_=e.opacity,this.rotateWithView_=e.rotateWithView,this.rotation_=e.rotation,this.scale_=e.scale,this.scaleArray_=ls(e.scale),this.displacement_=e.displacement,this.declutterMode_=e.declutterMode}clone(){let e=this.getScale();return new i({opacity:this.getOpacity(),scale:Array.isArray(e)?e.slice():e,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getOpacity(){return this.opacity_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getDisplacement(){return this.displacement_}getDeclutterMode(){return this.declutterMode_}getAnchor(){return ei()}getImage(e){return ei()}getHitDetectionImage(){return ei()}getPixelRatio(e){return 1}getImageState(){return ei()}getImageSize(){return ei()}getOrigin(){return ei()}getSize(){return ei()}setDisplacement(e){this.displacement_=e}setOpacity(e){this.opacity_=e}setRotateWithView(e){this.rotateWithView_=e}setRotation(e){this.rotation_=e}setScale(e){this.scale_=e,this.scaleArray_=ls(e)}listenImageChange(e){ei()}load(){ei()}unlistenImageChange(e){ei()}ready(){return Promise.resolve()}},VE=ZN;var KN=class i extends VE{constructor(e){super({opacity:1,rotateWithView:e.rotateWithView!==void 0?e.rotateWithView:!1,rotation:e.rotation!==void 0?e.rotation:0,scale:e.scale!==void 0?e.scale:1,displacement:e.displacement!==void 0?e.displacement:[0,0],declutterMode:e.declutterMode}),this.hitDetectionCanvas_=null,this.fill_=e.fill!==void 0?e.fill:null,this.origin_=[0,0],this.points_=e.points,this.radius=e.radius,this.radius2_=e.radius2,this.angle_=e.angle!==void 0?e.angle:0,this.stroke_=e.stroke!==void 0?e.stroke:null,this.size_,this.renderOptions_,this.imageState_=this.fill_&&this.fill_.loading()?In.LOADING:In.LOADED,this.imageState_===In.LOADING&&this.ready().then(()=>this.imageState_=In.LOADED),this.render()}clone(){let e=this.getScale(),t=new i({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(e)?e.slice():e,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return t.setOpacity(this.getOpacity()),t}getAnchor(){let e=this.size_,t=this.getDisplacement(),n=this.getScaleArray();return[e[0]/2-t[0]/n[0],e[1]/2+t[1]/n[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(e){this.fill_=e,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(e){let t=this.fill_?.getKey(),n=`${e},${this.angle_},${this.radius},${this.radius2_},${this.points_},${t}`+Object.values(this.renderOptions_).join(","),r=ta.get(n,null)?.getImage(1);if(!r){let s=this.renderOptions_,o=Math.ceil(s.size*e),a=Di(o,o);this.draw_(s,a,e),r=a.canvas;let l=new dX(r,void 0,null,In.LOADED,null);ta.set(n,null,l),createImageBitmap(r).then(c=>{l.setImage(c)})}return r}getPixelRatio(e){return e}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius}setRadius(e){this.radius!==e&&(this.radius=e,this.render())}getRadius2(){return this.radius2_}setRadius2(e){this.radius2_!==e&&(this.radius2_=e,this.render())}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(e){this.stroke_=e,this.render()}listenImageChange(e){}load(){}unlistenImageChange(e){}calculateLineJoinSize_(e,t,n){if(t===0||this.points_===1/0||e!=="bevel"&&e!=="miter")return t;let r=this.radius,s=this.radius2_===void 0?r:this.radius2_;if(r<s){let D=r;r=s,s=D}let o=this.radius2_===void 0?this.points_:this.points_*2,a=2*Math.PI/o,l=s*Math.sin(a),c=Math.sqrt(s*s-l*l),u=r-c,f=Math.sqrt(l*l+u*u),d=f/l;if(e==="miter"&&d<=n)return d*t;let A=t/2/d,y=t/2*(u/f),S=Math.sqrt((r+A)*(r+A)+y*y)-r;if(this.radius2_===void 0||e==="bevel")return S*2;let T=r*Math.sin(a),R=Math.sqrt(r*r-T*T),P=s-R,F=Math.sqrt(T*T+P*P)/T;if(F<=n){let D=F*t/2-s-r;return 2*Math.max(S,D)}return S*2}createRenderOptions(){let e=xh,t=yh,n=0,r=null,s=0,o,a=0;this.stroke_&&(o=gl(this.stroke_.getColor()??na),a=this.stroke_.getWidth()??ad,r=this.stroke_.getLineDash(),s=this.stroke_.getLineDashOffset()??0,t=this.stroke_.getLineJoin()??yh,e=this.stroke_.getLineCap()??xh,n=this.stroke_.getMiterLimit()??sd);let l=this.calculateLineJoinSize_(t,a,n),c=Math.max(this.radius,this.radius2_||0),u=Math.ceil(2*c+l);return{strokeStyle:o,strokeWidth:a,size:u,lineCap:e,lineDash:r,lineDashOffset:s,lineJoin:t,miterLimit:n}}render(){this.renderOptions_=this.createRenderOptions();let e=this.renderOptions_.size;this.hitDetectionCanvas_=null,this.size_=[e,e]}draw_(e,t,n){if(t.scale(n,n),t.translate(e.size/2,e.size/2),this.createPath_(t),this.fill_){let r=this.fill_.getColor();r===null&&(r=ro),t.fillStyle=gl(r),t.fill()}e.strokeStyle&&(t.strokeStyle=e.strokeStyle,t.lineWidth=e.strokeWidth,e.lineDash&&(t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset),t.lineCap=e.lineCap,t.lineJoin=e.lineJoin,t.miterLimit=e.miterLimit,t.stroke())}createHitDetectionCanvas_(e){let t;if(this.fill_){let n=this.fill_.getColor(),r=0;typeof n=="string"&&(n=Uc(n)),n===null?r=1:Array.isArray(n)&&(r=n.length===4?n[3]:1),r===0&&(t=Di(e.size,e.size),this.drawHitDetectionCanvas_(e,t))}return t?t.canvas:this.getImage(1)}createPath_(e){let t=this.points_,n=this.radius;if(t===1/0)e.arc(0,0,n,0,2*Math.PI);else{let r=this.radius2_===void 0?n:this.radius2_;this.radius2_!==void 0&&(t*=2);let s=this.angle_-Math.PI/2,o=2*Math.PI/t;for(let a=0;a<t;a++){let l=s+a*o,c=a%2===0?n:r;e.lineTo(c*Math.cos(l),c*Math.sin(l))}e.closePath()}}drawHitDetectionCanvas_(e,t){t.translate(e.size/2,e.size/2),this.createPath_(t),t.fillStyle=ro,t.fill(),e.strokeStyle&&(t.strokeStyle=e.strokeStyle,t.lineWidth=e.strokeWidth,e.lineDash&&(t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset),t.lineJoin=e.lineJoin,t.miterLimit=e.miterLimit,t.stroke())}ready(){return this.fill_?this.fill_.ready():Promise.resolve()}},GE=KN;var QN=class i extends GE{constructor(e){e=e||{radius:5},super({points:1/0,fill:e.fill,radius:e.radius,stroke:e.stroke,scale:e.scale!==void 0?e.scale:1,rotation:e.rotation!==void 0?e.rotation:0,rotateWithView:e.rotateWithView!==void 0?e.rotateWithView:!1,displacement:e.displacement!==void 0?e.displacement:[0,0],declutterMode:e.declutterMode})}clone(){let e=this.getScale(),t=new i({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),scale:Array.isArray(e)?e.slice():e,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return t.setOpacity(this.getOpacity()),t}},qE=QN;var JN=class i{constructor(e){e=e||{},this.patternImage_=null,this.color_=null,e.color!==void 0&&this.setColor(e.color)}clone(){let e=this.getColor();return new i({color:Array.isArray(e)?e.slice():e||void 0})}getColor(){return this.color_}setColor(e){if(e!==null&&typeof e=="object"&&"src"in e){let t=Bp(null,e.src,{crossOrigin:"anonymous"},void 0,e.offset?null:e.color?e.color:null,!(e.offset&&e.size));t.ready().then(()=>{this.patternImage_=null}),t.getImageState()===In.IDLE&&t.load(),t.getImageState()===In.LOADING&&(this.patternImage_=t)}this.color_=e}getKey(){let e=this.getColor();return e?e instanceof CanvasPattern||e instanceof CanvasGradient?Bn(e):typeof e=="object"&&"src"in e?e.src+":"+e.offset:Uc(e).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}},us=JN;function bX(i,e,t,n){return t!==void 0&&n!==void 0?[t/i,n/e]:t!==void 0?t/i:n!==void 0?n/e:1}var e5=class i extends VE{constructor(e){e=e||{};let t=e.opacity!==void 0?e.opacity:1,n=e.rotation!==void 0?e.rotation:0,r=e.scale!==void 0?e.scale:1,s=e.rotateWithView!==void 0?e.rotateWithView:!1;super({opacity:t,rotation:n,scale:r,displacement:e.displacement!==void 0?e.displacement:[0,0],rotateWithView:s,declutterMode:e.declutterMode}),this.anchor_=e.anchor!==void 0?e.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=e.anchorOrigin!==void 0?e.anchorOrigin:"top-left",this.anchorXUnits_=e.anchorXUnits!==void 0?e.anchorXUnits:"fraction",this.anchorYUnits_=e.anchorYUnits!==void 0?e.anchorYUnits:"fraction",this.crossOrigin_=e.crossOrigin!==void 0?e.crossOrigin:null,this.referrerPolicy_=e.referrerPolicy;let o=e.img!==void 0?e.img:null,a=e.src;jn(!(a!==void 0&&o),"`image` and `src` cannot be provided at the same time"),(a===void 0||a.length===0)&&o&&(a=o.src||Bn(o)),jn(a!==void 0&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),jn(!((e.width!==void 0||e.height!==void 0)&&e.scale!==void 0),"`width` or `height` cannot be provided together with `scale`");let l;if(e.src!==void 0?l=In.IDLE:o!==void 0&&("complete"in o?o.complete?l=o.src?In.LOADED:In.IDLE:l=In.LOADING:l=In.LOADED),this.color_=e.color!==void 0?Uc(e.color):null,this.iconImage_=Bp(o,a,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},l,this.color_),this.offset_=e.offset!==void 0?e.offset:[0,0],this.offsetOrigin_=e.offsetOrigin!==void 0?e.offsetOrigin:"top-left",this.origin_=null,this.size_=e.size!==void 0?e.size:null,this.initialOptions_,e.width!==void 0||e.height!==void 0){let c,u;if(e.size)[c,u]=e.size;else{let f=this.getImage(1);if(f.width&&f.height)c=f.width,u=f.height;else if(f instanceof HTMLImageElement){this.initialOptions_=e;let d=()=>{if(this.unlistenImageChange(d),!this.initialOptions_)return;let A=this.iconImage_.getSize();this.setScale(bX(A[0],A[1],e.width,e.height))};this.listenImageChange(d);return}}c!==void 0&&this.setScale(bX(c,u,e.width,e.height))}}clone(){let e,t,n;return this.initialOptions_?(t=this.initialOptions_.width,n=this.initialOptions_.height):(e=this.getScale(),e=Array.isArray(e)?e.slice():e),new i({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:e,width:t,height:n,size:this.size_!==null?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let e=this.normalizedAnchor_;if(!e){e=this.anchor_;let r=this.getSize();if(this.anchorXUnits_=="fraction"||this.anchorYUnits_=="fraction"){if(!r)return null;e=this.anchor_.slice(),this.anchorXUnits_=="fraction"&&(e[0]*=r[0]),this.anchorYUnits_=="fraction"&&(e[1]*=r[1])}if(this.anchorOrigin_!="top-left"){if(!r)return null;e===this.anchor_&&(e=this.anchor_.slice()),(this.anchorOrigin_=="top-right"||this.anchorOrigin_=="bottom-right")&&(e[0]=-e[0]+r[0]),(this.anchorOrigin_=="bottom-left"||this.anchorOrigin_=="bottom-right")&&(e[1]=-e[1]+r[1])}this.normalizedAnchor_=e}let t=this.getDisplacement(),n=this.getScaleArray();return[e[0]-t[0]/n[0],e[1]+t[1]/n[1]]}setAnchor(e){this.anchor_=e,this.normalizedAnchor_=null}getColor(){return this.color_}setColor(e){let t=e?Uc(e):null;if(this.color_===t||this.color_&&t&&this.color_.length===t.length&&this.color_.every((o,a)=>o===t[a]))return;this.color_=t;let n=this.getSrc(),r=n!==void 0?null:this.getHitDetectionImage(),s=n!==void 0?In.IDLE:this.iconImage_.getImageState();this.iconImage_=Bp(r,n,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},s,this.color_)}getImage(e){return this.iconImage_.getImage(e)}getPixelRatio(e){return this.iconImage_.getPixelRatio(e)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let e=this.offset_;if(this.offsetOrigin_!="top-left"){let t=this.getSize(),n=this.iconImage_.getSize();if(!t||!n)return null;e=e.slice(),(this.offsetOrigin_=="top-right"||this.offsetOrigin_=="bottom-right")&&(e[0]=n[0]-t[0]-e[0]),(this.offsetOrigin_=="bottom-left"||this.offsetOrigin_=="bottom-right")&&(e[1]=n[1]-t[1]-e[1])}return this.origin_=e,this.origin_}getSrc(){return this.iconImage_.getSrc()}setSrc(e){this.iconImage_=Bp(null,e,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},In.IDLE,this.color_)}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){let e=this.getScaleArray();if(this.size_)return this.size_[0]*e[0];if(this.iconImage_.getImageState()==In.LOADED)return this.iconImage_.getSize()[0]*e[0]}getHeight(){let e=this.getScaleArray();if(this.size_)return this.size_[1]*e[1];if(this.iconImage_.getImageState()==In.LOADED)return this.iconImage_.getSize()[1]*e[1]}setScale(e){delete this.initialOptions_,super.setScale(e)}listenImageChange(e){this.iconImage_.addEventListener(nn.CHANGE,e)}load(){this.iconImage_.load()}unlistenImageChange(e){this.iconImage_.removeEventListener(nn.CHANGE,e)}ready(){return this.iconImage_.ready()}},xA=e5;var t5=class i{constructor(e){e=e||{},this.color_=e.color!==void 0?e.color:null,this.lineCap_=e.lineCap,this.lineDash_=e.lineDash!==void 0?e.lineDash:null,this.lineDashOffset_=e.lineDashOffset,this.lineJoin_=e.lineJoin,this.miterLimit_=e.miterLimit,this.offset_=e.offset,this.width_=e.width}clone(){let e=this.getColor();return new i({color:Array.isArray(e)?e.slice():e||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),offset:this.getOffset(),width:this.getWidth()})}getColor(){return this.color_}getLineCap(){return this.lineCap_}getLineDash(){return this.lineDash_}getLineDashOffset(){return this.lineDashOffset_}getLineJoin(){return this.lineJoin_}getMiterLimit(){return this.miterLimit_}getOffset(){return this.offset_}getWidth(){return this.width_}setColor(e){this.color_=e}setLineCap(e){this.lineCap_=e}setLineDash(e){this.lineDash_=e}setLineDashOffset(e){this.lineDashOffset_=e}setLineJoin(e){this.lineJoin_=e}setMiterLimit(e){this.miterLimit_=e}setOffset(e){this.offset_=e}setWidth(e){this.width_=e}},Es=t5;var HE=class i{constructor(e){e=e||{},this.geometry_=null,this.geometryFunction_=wX,e.geometry!==void 0&&this.setGeometry(e.geometry),this.fill_=e.fill!==void 0?e.fill:null,this.image_=e.image!==void 0?e.image:null,this.renderer_=e.renderer!==void 0?e.renderer:null,this.hitDetectionRenderer_=e.hitDetectionRenderer!==void 0?e.hitDetectionRenderer:null,this.stroke_=e.stroke!==void 0?e.stroke:null,this.text_=e.text!==void 0?e.text:null,this.zIndex_=e.zIndex}clone(){let e=this.getGeometry();return e&&typeof e=="object"&&(e=e.clone()),new i({geometry:e??void 0,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer()??void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})}getRenderer(){return this.renderer_}setRenderer(e){this.renderer_=e}setHitDetectionRenderer(e){this.hitDetectionRenderer_=e}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(e){this.fill_=e}getImage(){return this.image_}setImage(e){this.image_=e}getStroke(){return this.stroke_}setStroke(e){this.stroke_=e}getText(){return this.text_}setText(e){this.text_=e}getZIndex(){return this.zIndex_}setGeometry(e){typeof e=="function"?this.geometryFunction_=e:typeof e=="string"?this.geometryFunction_=function(t){return t.get(e)}:e?e!==void 0&&(this.geometryFunction_=function(){return e}):this.geometryFunction_=wX,this.geometry_=e}setZIndex(e){this.zIndex_=e}};function SX(i){let e;if(typeof i=="function")e=i;else{let t;Array.isArray(i)?t=i:(jn(typeof i.getZIndex=="function","Expected an `Style` or an array of `Style`"),t=[i]),e=function(){return t}}return e}var n5=null;function i5(i,e){if(!n5){let t=new us({color:"rgba(255,255,255,0.4)"}),n=new Es({color:"#3399CC",width:1.25});n5=[new HE({image:new qE({fill:t,stroke:n,radius:5}),fill:t,stroke:n})]}return n5}function wX(i){return i.getGeometry()}var Nr=HE;var Xpe="#333",r5=class i{constructor(e){e=e||{},this.font_=e.font,this.rotation_=e.rotation,this.rotateWithView_=e.rotateWithView,this.keepUpright_=e.keepUpright,this.scale_=e.scale,this.scaleArray_=ls(e.scale!==void 0?e.scale:1),this.text_=e.text,this.textAlign_=e.textAlign,this.justify_=e.justify,this.repeat_=e.repeat,this.textBaseline_=e.textBaseline,this.fill_=e.fill!==void 0?e.fill:new us({color:Xpe}),this.maxAngle_=e.maxAngle!==void 0?e.maxAngle:Math.PI/4,this.placement_=e.placement!==void 0?e.placement:"point",this.overflow_=!!e.overflow,this.stroke_=e.stroke!==void 0?e.stroke:null,this.offsetX_=e.offsetX!==void 0?e.offsetX:0,this.offsetY_=e.offsetY!==void 0?e.offsetY:0,this.backgroundFill_=e.backgroundFill?e.backgroundFill:null,this.backgroundStroke_=e.backgroundStroke?e.backgroundStroke:null,this.padding_=e.padding===void 0?null:e.padding,this.declutterMode_=e.declutterMode}clone(){let e=this.getScale();return new i({font:this.getFont(),placement:this.getPlacement(),repeat:this.getRepeat(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),keepUpright:this.getKeepUpright(),scale:Array.isArray(e)?e.slice():e,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()instanceof us?this.getFill().clone():this.getFill(),stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()||void 0,declutterMode:this.getDeclutterMode()})}getOverflow(){return this.overflow_}getFont(){return this.font_}getMaxAngle(){return this.maxAngle_}getPlacement(){return this.placement_}getRepeat(){return this.repeat_}getOffsetX(){return this.offsetX_}getOffsetY(){return this.offsetY_}getFill(){return this.fill_}getRotateWithView(){return this.rotateWithView_}getKeepUpright(){return this.keepUpright_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getStroke(){return this.stroke_}getText(){return this.text_}getTextAlign(){return this.textAlign_}getJustify(){return this.justify_}getTextBaseline(){return this.textBaseline_}getBackgroundFill(){return this.backgroundFill_}getBackgroundStroke(){return this.backgroundStroke_}getPadding(){return this.padding_}getDeclutterMode(){return this.declutterMode_}setOverflow(e){this.overflow_=e}setFont(e){this.font_=e}setMaxAngle(e){this.maxAngle_=e}setOffsetX(e){this.offsetX_=e}setOffsetY(e){this.offsetY_=e}setPlacement(e){this.placement_=e}setRepeat(e){this.repeat_=e}setRotateWithView(e){this.rotateWithView_=e}setKeepUpright(e){this.keepUpright_=e}setFill(e){this.fill_=e}setRotation(e){this.rotation_=e}setScale(e){this.scale_=e,this.scaleArray_=ls(e!==void 0?e:1)}setStroke(e){this.stroke_=e}setText(e){this.text_=e}setTextAlign(e){this.textAlign_=e}setJustify(e){this.justify_=e}setTextBaseline(e){this.textBaseline_=e}setBackgroundFill(e){this.backgroundFill_=e}setBackgroundStroke(e){this.backgroundStroke_=e}setPadding(e){this.padding_=e}},ld=r5;function kc(i,e){return(i.get("priority")||0)-(e.get("priority")||0)}function MX(i){let e=i.get("pin");return!e||zc(e)||e.passesZoneFilters||pv(e)?null:o5(e,!1)}function CX(i){let e=i.get("pin");return!e||!O.highlightedZones.size||!e.passesZoneFilters||zc(e)||pv(e)?null:o5(e,!1)}function RX(i){let e=i.get("pin");return!e||zc(e)||!O.labelsHeld?null:NX(e)}function IX(i){let e=i.get("pin");if(!e||zc(e)||e.passesZoneFilters||pv(e)||n2())return null;if(O.labelsHeld)return e2(e,!1);let t=O.fitZoom+Math.log2(GX(e.category));return(O.engine.getView().getZoom()||0)<t?null:e2(e,!1)}function PX(i){let e=i.get("pin");return!e||zc(e)||e.passesZoneFilters||pv(e)||!n2()?null:e2(e,!1)}function LX(i){let e=i.get("pin");return!e||!O.highlightedZones.size||!e.passesZoneFilters||zc(e)||pv(e)?null:e2(e,!1)}function DX(i){let e=i.get("pin");if(!e||zc(e))return null;if(uh(e.category)==="text")return e2(e,e===O.selectedPin);let t=o5(e,e===O.selectedPin);return e===O.hoveredPin||e===O.selectedPin?[t,NX(e)]:t}function o5(i,e){let t=`marker:${i.category.id}:${e?1:0}`;if(O.styleCache.has(t))return O.styleCache.get(t);let n=pA(i.category),r=e?2e7:i.priority,s=O.markerIcons.get(t2(i.category)),o;return s?o=new Nr({image:new xA({src:s,width:e?36:31,height:e?36:31}),zIndex:r}):o=new Nr({text:new ld({text:Su(i.category.title),font:`900 ${e?15:13}px Inter, sans-serif`,fill:new us({color:n}),stroke:new Es({color:fA(),width:e?4:3})}),zIndex:r}),O.styleCache.set(t,o),o}function NX(i){let e=`marker-label:${i.location.id}`;if(O.styleCache.has(e))return O.styleCache.get(e);let t=new Nr({text:new ld({text:i.location.title,offsetY:21,font:'700 10px "Arial Narrow", "Roboto Condensed", sans-serif',fill:new us({color:"#f2ece0"}),stroke:new Es({color:"rgba(0,0,0,0.98)",width:3}),backgroundFill:new us({color:"rgba(10,12,17,0.72)"}),padding:[2,4,2,4],overflow:!0}),zIndex:i.priority});return O.styleCache.set(e,t),t}function FX(i){if(!i.iconAsset)return;let e=t2(i);if(O.markerIcons.has(e))return;O.markerIcons.set(e,null);let t=new Image;t.onload=()=>{let n=document.createElement("canvas");n.width=64,n.height=64;let r=n.getContext("2d"),s=pA(i),o=document.createElement("canvas");o.width=64,o.height=64;let a=o.getContext("2d");a.imageSmoothingEnabled=!i.iconPicture,a.drawImage(t,6,6,52,52),i.iconPicture||(a.globalCompositeOperation="source-in",a.fillStyle=s,a.fillRect(0,0,64,64));let l=document.createElement("canvas");l.width=64,l.height=64;let c=l.getContext("2d");c.drawImage(t,6,6,52,52),c.globalCompositeOperation="source-in",c.fillStyle=fA(),c.fillRect(0,0,64,64);for(let u=-3;u<=3;u++)for(let f=-3;f<=3;f++)f*f+u*u<=10&&r.drawImage(l,f,u);r.drawImage(o,0,0),O.markerIcons.set(e,n.toDataURL("image/png")),$pe(),O.layers.pins.changed(),O.layers.zonePins.changed(),O.layers.priority.changed()},t.onerror=()=>O.markerIcons.set(e,!1),t.src=gN(i.iconAsset)}function $pe(){for(let i of O.styleCache.keys())i.startsWith("marker:")&&O.styleCache.delete(i)}function t2(i){return`${i.iconAsset||""}:${pA(i)}:${O.world?.iconOutset||"light"}`}function e2(i,e){let t=`text:${i.location.id}:${e?1:0}`;if(O.styleCache.has(t))return O.styleCache.get(t);let r=[new Nr({text:new ld({text:i.location.title,font:`${e?"900":"800"} 14px "Arial Narrow", "Roboto Condensed", sans-serif`,fill:new us({color:e?"#7fd0ea":"#f2ece0"}),stroke:new Es({color:"rgba(0,0,0,0.95)",width:4}),backgroundFill:new us({color:e?"rgba(13,16,23,0.9)":"rgba(10,12,17,0.58)"}),backgroundStroke:e?new Es({color:"#3aa5c9",width:1}):void 0,padding:[3,6,3,6],overflow:!0}),zIndex:e?2e7:i.priority+3e6})];return O.styleCache.set(t,r),r}function WE(i,e){return`${i} ${e}px ${Vi.labelFont}`}function a5(i,e){let t=i.get("gridCell");if(!t)return null;let n=t.role==="neighbor",r=n?Vi.neighborLabelSizePx:Vi.labelSizePx,s=WE(900,r),o=n?[2,4,2,4]:[3,5,3,5],a=Zpe(t,s,r,o,e),l=DE(t,{subgridVisible:O.subgridVisible,labelled:a});if(!l)return null;let c=`grid:${O.gridSystem}:${t.hash}:${t.role}:${t.contextDistance}:${a?1:0}:${l.bare?1:0}`;if(O.styleCache.has(c))return O.styleCache.get(c);let u=t.role==="leaf"||t.role==="scope"?100:i.get("priority"),f=[new Nr({fill:l.fill?new us({color:Nc(l.fill.color,l.fill.opacity)}):void 0,stroke:new Es({color:Nc(l.line.color,l.line.opacity),width:l.line.widthPx}),zIndex:u})];if(l.label){let d=l.label.prefix?[l.label.prefix,WE(500,r),l.label.final,WE(900,r)]:l.label.final,A=Vi.labelInsetPx*e,y=Ype(i.getGeometry());y&&f.push(new Nr({geometry:new wu([y[0]-A,y[1]+A]),text:new ld({text:d,font:WE(900,r),textAlign:"right",textBaseline:"bottom",fill:new us({color:Nc(l.label.color,l.label.textAlpha)}),backgroundFill:new us({color:l.label.chip}),padding:o,overflow:!0}),zIndex:u+1}))}return O.styleCache.set(c,f),f}function Ype(i){let e=i.getType()==="MultiPolygon"?i.getCoordinates():[i.getCoordinates()],t=null;for(let n of e)for(let[r,s]of n[0]||[])(!t||r-s>t[0]-t[1])&&(t=[r,s]);return t}function Zpe(i,e,t,n,r){if(!r)return!0;let s=l5(i.hash,e)+n[1]+n[3],o=t+n[0]+n[2];return s<=(i.extent[2]-i.extent[0])/r&&o<=(i.extent[3]-i.extent[1])/r}var TX=document.createElement("canvas").getContext("2d"),EX=new Map;function l5(i,e){let t=`${e}|${i}`,n=EX.get(t);return n===void 0&&(TX.font=e,n=TX.measureText(i).width,EX.set(t,n)),n}var Kpe=new Nr({fill:new us({color:"rgba(5, 8, 16, 0.62)"})});function BX(){return q1()?Kpe:null}function OX(i,e){let t=i.get("zone");if(Pa(Sp(t)))return null;let n=i.get("child"),r=O.highlightedZones.has(t.id),s=VX(t.id),o=Number(t.attrs?.["atlas.stroke.width_px"])||Number(G1(t)?.attrs?.["atlas.stroke.width_px"])||0;if(o>0&&i.getGeometry()?.getType()==="MultiLineString")return Qpe(t,i.get("color"),o/e,r,s);let a=`zone:${t.id}:${n?1:0}:${r?1:s?2:0}`;if(O.styleCache.has(a))return O.styleCache.get(a);let l=i.get("color");if(s){let f=new Nr({stroke:new Es({color:Nc(l,n?.34:.44),width:n?1:1.3,lineDash:n?[3,4]:[7,5]}),zIndex:n?101:100});return O.styleCache.set(a,f),f}let c=new Nr({fill:new us({color:Nc(l,n?.035:.07)}),stroke:new Es({color:Nc(l,n?.5:.72),width:n?1.2:1.8,lineDash:n?[3,4]:[7,5]})});if(!r)return O.styleCache.set(a,c),c;let u=[new Nr({stroke:new Es({color:"rgba(255,255,255,0.94)",width:5}),zIndex:9e3}),new Nr({fill:new us({color:Nc(l,.22)}),stroke:new Es({color:l,width:2.6}),zIndex:9001})];return O.styleCache.set(a,u),u}function Qpe(i,e,t,n,r){let s=Math.max(t,1.5);return n?[new Nr({stroke:new Es({color:"rgba(255,255,255,0.94)",width:s+4,lineCap:"round",lineJoin:"round"}),zIndex:9e3}),new Nr({stroke:new Es({color:Nc(e,.9),width:s,lineCap:"round",lineJoin:"round"}),zIndex:9001})]:[new Nr({stroke:new Es({color:Nc(e,r?.14:.3),width:s,lineCap:"round",lineJoin:"round"})}),new Nr({stroke:new Es({color:Nc(e,r?.4:.8),width:Math.min(1.6,s),lineDash:[7,5]})})]}function UX(i){if(n2())return null;let e=i.get("zone");if(Pa(Sp(e))||zX(e))return null;let t=O.highlightedZones.has(e.id);if(Kf(e)==="quiet")return s5(i);let n=i.get("child"),r=O.engine.getView().getZoom()||0;if(!t&&n&&r<O.fitZoom+3)return null;let s=i.get("span")/O.engine.getView().getResolution();return!t&&O.zoneTitleCount>40&&s<52?null:s5(i)}function kX(i){if(!n2())return null;let e=i.get("zone");return Pa(Sp(e))||zX(e)?null:s5(i)}function zX(i){return Kf(i)!=="quiet"?!1:!O.highlightedZones.has(i.id)&&O.selectedZone!==i&&!O.labelsHeld}function s5(i){let e=i.get("child"),t=i.get("zone"),n=O.highlightedZones.has(t.id),r=VX(t.id),s=`zone-title:${t.id}:${e?1:0}:${n?1:r?2:0}`;if(O.styleCache.has(s))return O.styleCache.get(s);let o=i.get("color"),a=new Nr({text:new ld({text:t.title.toLocaleUpperCase(),font:`${e?"700 12px":"800 14px"} "Arial Narrow", "Roboto Condensed", sans-serif`,fill:new us({color:n?"#10131a":r?"rgba(196,191,177,0.56)":e?"#c8c2b4":"#f2ece0"}),stroke:new Es({color:n?"rgba(255,255,255,0.96)":r?"rgba(0,0,0,0.82)":"rgba(0,0,0,0.95)",width:n?2:r?3:4}),backgroundFill:new us({color:n?o:r?"rgba(8,11,18,0.84)":"rgba(13,16,23,0.72)"}),backgroundStroke:new Es({color:n?"#ffffff":Nc(o,r?.24:.55),width:n?2:1}),padding:[5,8,5,8],overflow:!0}),zIndex:n?91e5:i.get("priority")});return O.styleCache.set(s,a),a}function VX(i){if(!O.highlightedZones.size||O.highlightedZones.has(i))return!1;for(let e of O.highlightedZones)if(Jpe(i,e))return!1;return!0}function Jpe(i,e){let t=new Set,n=O.zoneRecords.get(e)?.zone.parent;for(;n!=null&&!t.has(n);){if(n===i)return!0;t.add(n),n=O.zoneRecords.get(n)?.zone.parent}return!1}function yA(i,e,t,n,r,s,o){let a,l,c=(t-e)/n;if(c===1)a=e;else if(c===2)a=e,l=r;else if(c!==0){let u=i[e],f=i[e+1],d=0,A=[0];for(let S=e+n;S<t;S+=n){let T=i[S],R=i[S+1];d+=Math.sqrt((T-u)*(T-u)+(R-f)*(R-f)),A.push(d),u=T,f=R}let y=r*d,w=ZW(A,y);w<0?(l=(y-A[-w-2])/(A[-w-1]-A[-w-2]),a=e+(-w-2)*n):a=e+w*n}o=o>1?o:2,s=s||new Array(o);for(let u=0;u<o;++u)s[u]=a===void 0?NaN:l===void 0?i[a+u]:Po(i[a+u],i[a+n+u],l);return s}function jE(i,e,t,n,r,s){if(t==e)return null;let o;if(r<i[e+n-1])return s?(o=i.slice(e,e+n),o[n-1]=r,o):null;if(i[t-1]<r)return s?(o=i.slice(t-n,t),o[n-1]=r,o):null;if(r==i[e+n-1])return i.slice(e,e+n);let a=e/n,l=t/n;for(;a<l;){let d=a+l>>1;r<i[(d+1)*n-1]?l=d:a=d+1}let c=i[a*n-1];if(r==c)return i.slice((a-1)*n,(a-1)*n+n);let u=i[(a+1)*n-1],f=(r-c)/(u-c);o=[];for(let d=0;d<n-1;++d)o.push(Po(i[(a-1)*n+d],i[a*n+d],f));return o.push(r),o}function qX(i,e,t,n,r,s,o){if(o)return jE(i,e,t[t.length-1],n,r,s);let a;if(r<i[n-1])return s?(a=i.slice(0,n),a[n-1]=r,a):null;if(i[i.length-1]<r)return s?(a=i.slice(i.length-n),a[n-1]=r,a):null;for(let l=0,c=t.length;l<c;++l){let u=t[l];if(e!=u){if(r<i[e+n-1])return null;if(r<=i[u-1])return jE(i,e,u,n,r,!1);e=u}}return null}function mv(i,e,t,n){let r=i[e],s=i[e+1],o=0;for(let a=e+n;a<t;a+=n){let l=i[a],c=i[a+1];o+=Math.sqrt((l-r)*(l-r)+(c-s)*(c-s)),r=l,s=c}return o}var c5=class i extends Al{constructor(e,t){super(),this.flatMidpoint_=null,this.flatMidpointRevision_=-1,this.maxDelta_=-1,this.maxDeltaRevision_=-1,t!==void 0&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendCoordinate(e){Lo(this.flatCoordinates,e),this.changed()}clone(){let e=new i(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(e,t,n,r){return r<Ic(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(ky(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Vy(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,e,t,n,r))}forEachSegment(e){return lE(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinateAtM(e,t){return this.layout!="XYM"&&this.layout!="XYZM"?null:(t=t!==void 0?t:!1,jE(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t))}getCoordinates(){return Oc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(e,t){return yA(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,this.stride)}getLength(){return mv(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getFlatMidpoint(){return this.flatMidpointRevision_!=this.getRevision()&&(this.flatMidpoint_=this.getCoordinateAt(.5,this.flatMidpoint_??void 0),this.flatMidpointRevision_=this.getRevision()),this.flatMidpoint_}getSimplifiedGeometryInternal(e){let t=[];return t.length=AA(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,0),new i(t,"XY")}getType(){return"LineString"}intersectsExtent(e){return aA(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,this.getExtent())}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=hA(this.flatCoordinates,0,e,this.stride),this.changed()}},u5=c5;var h5=class i extends Al{constructor(e,t,n){if(super(),this.ends_=[],this.maxDelta_=-1,this.maxDeltaRevision_=-1,Array.isArray(e[0]))this.setCoordinates(e,t);else if(t!==void 0&&n)this.setFlatCoordinates(t,e),this.ends_=n;else{let r=e,s=[],o=[];for(let l=0,c=r.length;l<c;++l){let u=r[l];Lo(s,u.getFlatCoordinates()),o.push(s.length)}let a=r.length===0?this.getLayout():r[0].getLayout();this.setFlatCoordinates(a,s),this.ends_=o}}appendLineString(e){Lo(this.flatCoordinates,e.getFlatCoordinates().slice()),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){let e=new i(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return e.applyProperties(this),e}closestPointXY(e,t,n,r){return r<Ic(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(zy(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Gy(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,e,t,n,r))}getCoordinateAtM(e,t,n){return this.layout!="XYM"&&this.layout!="XYZM"||this.flatCoordinates.length===0?null:(t=t!==void 0?t:!1,n=n!==void 0?n:!1,qX(this.flatCoordinates,0,this.ends_,this.stride,e,t,n))}getCoordinates(){return Dp(this.flatCoordinates,0,this.ends_,this.stride)}getEnds(){return this.ends_}getLineString(e){return e<0||this.ends_.length<=e?null:new u5(this.flatCoordinates.slice(e===0?0:this.ends_[e-1],this.ends_[e]),this.layout)}getLineStrings(){let e=this.flatCoordinates,t=this.ends_,n=this.layout,r=[],s=0;for(let o=0,a=t.length;o<a;++o){let l=t[o],c=new u5(e.slice(s,l),n);r.push(c),s=l}return r}getLength(){let e=this.ends_,t=0,n=0;for(let r=0,s=e.length;r<s;++r)n+=mv(this.flatCoordinates,t,e[r],this.stride),t=e[r];return n}getFlatMidpoints(){let e=[],t=this.flatCoordinates,n=0,r=this.ends_,s=this.stride;for(let o=0,a=r.length;o<a;++o){let l=r[o],c=yA(t,n,l,s,.5);Lo(e,c),n=l}return e}getSimplifiedGeometryInternal(e){let t=[],n=[];return t.length=EE(this.flatCoordinates,0,this.ends_,this.stride,e,t,0,n),new i(t,"XY",n)}getType(){return"MultiLineString"}intersectsExtent(e){return nj(this.flatCoordinates,0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||(this.flatCoordinates=[]);let n=Ny(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=n.length===0?0:n[n.length-1],this.changed()}},HX=h5;function f5(){O.renderedShard=O.lens?.shard||0,O.sources.zones.clear(),O.sources.zoneTitles.clear(),O.zoneRecords.clear(),O.highlightedZones.clear(),O.focusedZoneID=null,O.zoneTitleCount=0,kp();for(let i of O.world.collections)if(i.kind!=="point")for(let e of i.features||[]){if(!Oy(e))continue;e.collectionId=i.id;let t=Wr(),n=[],r=!1;for(let l of e.geometry||[]){let c=n0e(l);c&&(r=!0,n.push(c),jT(t,c.getExtent()),O.sources.zones.addFeature(new Lp({geometry:c,zone:e,color:hv(e.id),child:e.parent!=null})))}if(!r)continue;let s=hv(e.id),o=e.center?Av(e.center.lat,e.center.lng):dl(t),a=Math.max(t[2]-t[0],t[3]-t[1]);O.sources.zoneTitles.addFeature(new Lp({geometry:new wu(o),zone:e,color:s,child:e.parent!=null,span:a,priority:(e.parent==null?2e6:1e6)+Math.round(a)})),O.zoneRecords.set(e.id,{zone:e,collection:i,extent:t.slice(),geometries:n,color:s})}d5(),p5(),e0e()}function d5(){O.zoneTitleCount=O.sources.zoneTitles.getFeatures().filter(i=>Kf(i.get("zone"))!=="quiet").length}function p5(){if(O.sources.zoneScrim.clear(),!O.highlightedZones.size)return;let[i,e,t,n]=O.projection.getExtent(),r=[WX([[i,e],[t,e],[t,n],[i,n],[i,e]],!0)];for(let s of O.highlightedZones)for(let o of O.zoneRecords.get(s)?.geometries||[]){if(o.getType()==="MultiLineString")continue;let a=o.getType()==="MultiPolygon"?o.getPolygons():[o];for(let l of a)l.getLinearRings().forEach((c,u)=>{r.push(WX(c.getCoordinates(),u>0))})}O.sources.zoneScrim.addFeature(new Lp({geometry:new _h(r)}))}function WX(i,e){let t=0;for(let n=0,r=i.length-1;n<i.length;r=n++)t+=i[r][0]*i[n][1]-i[n][0]*i[r][1];return t<0===e?i:i.slice().reverse()}function e0e(){for(let i of ge.legend.querySelectorAll(".feature-index")){let e=document.createDocumentFragment();for(let{zone:t,depth:n}of t0e(Tu(i.dataset.featureIndex))){let r=O.zoneRecords.get(t.id);if(!r)continue;let s=document.createElement("button");s.type="button",s.className="zone-index-item",s.dataset.zone=String(t.id),s.style.setProperty("--zone-color",r.color),s.style.setProperty("--zone-depth",String(n)),s.setAttribute("aria-pressed","false"),s.title=`${t.title}: click to jump; right-click to toggle highlight`;let o=document.createElement("span");o.className="zone-index-marker",o.setAttribute("aria-hidden","true");let a=document.createElement("span");a.textContent=t.title,s.append(o,a),e.append(s)}i.replaceChildren(e)}}function t0e(i){let e=[...O.zoneRecords.values()].filter(a=>a.zone.collectionId===i).map(a=>a.zone),t=new Set(e.map(a=>a.id)),n=new Map;for(let a of e){let l=t.has(a.parent)?a.parent:null;n.has(l)||n.set(l,[]),n.get(l).push(a)}for(let a of n.values())a.sort((l,c)=>l.title.localeCompare(c.title,void 0,{numeric:!0,sensitivity:"base"}));let r=[],s=new Set,o=(a,l)=>{if(!s.has(a.id)){s.add(a.id),r.push({zone:a,depth:l});for(let c of n.get(a.id)||[])o(c,l+1)}};for(let a of n.get(null)||[])o(a,0);for(let a of e)o(a,0);return r}function kp(){let i=q1();O.layers.zoneScrim.setVisible(i),O.layers.zones.setVisible(i),O.layers.zoneTitles.setVisible(i),O.layers.zoneTitleDetail.setVisible(i);let e=!1;for(let t of[...O.highlightedZones]){let n=O.zoneRecords.get(t);(!n||Pa(Sp(n.zone)))&&(O.highlightedZones.delete(t),e=!0)}e&&(XE(),p5(),A5())}function m5(i){let e=O.zoneRecords.get(i);e&&(O.focusedZoneID=i,A5(),$j(e.zone),O.engine.getView().fit(e.extent,{size:O.engine.getSize(),padding:[54,54,54,54],maxZoom:vh(O.lens),duration:220}),ge.sidebar.classList.remove("is-open"),ge.mobileLegend.setAttribute("aria-expanded","false"))}function jX(i){let e=O.zoneRecords.get(i);e&&(O.highlightedZones.has(i)?O.highlightedZones.delete(i):(O.highlightedZones.add(i),O.hiddenCollections.delete(Sp(e.zone))&&(mA(),gh()),kp()),O.hoveredPin=null,XE(),g5(),A5(),p5(),O.layers.zones.changed(),O.layers.zoneTitles.changed(),O.layers.zoneTitleDetail.changed())}function A5(){for(let i of ge.legend.querySelectorAll(".feature-index"))i.classList.toggle("has-highlights",O.highlightedZones.size>0);for(let i of ge.legend.querySelectorAll("[data-zone]")){let e=Number(i.dataset.zone),t=O.highlightedZones.has(e);i.classList.toggle("is-highlighted",t),i.classList.toggle("is-current",O.focusedZoneID===e),i.setAttribute("aria-pressed",String(t))}}function n0e(i){if(!i?.coordinates)return null;let e=([t,n])=>Av(n,t);return i.type==="Polygon"?new _h(i.coordinates.map(t=>t.map(e))):i.type==="MultiPolygon"?new PE(i.coordinates.map(t=>t.map(n=>n.map(e)))):i.type==="MultiLineString"?new HX(i.coordinates.map(t=>t.map(e))):null}function Av(i,e){let t=i0e(),n=2**t.sourceZoom,r=(e+180)/360*n,s=i*Math.PI/180,o=(1-Math.asinh(Math.tan(s))/Math.PI)/2*n;return[(r-t.firstTile)*t.tileSize,-(o-t.firstTile)*t.tileSize]}function i0e(){let i=O.volume.tileGrid,e=O.world?.grid;return e?{...i,...e}:i}function XX(){O.sources.pins.clear(),O.sources.text.clear(),O.sources.priority.clear(),O.pins=[],O.pinByID.clear();for(let i of O.world.collections)if(i.kind==="point"){uh(i)!=="text"&&FX(i);for(let e of i.locations){let t={location:e,category:i,coordinate:Av(e.lat,e.lng),filteredHidden:!1,priority:o0e(i,e),feature:null};t.feature=new Lp({geometry:new wu(t.coordinate),pin:t,priority:t.priority}),O.pins.push(t),O.pinByID.set(e.id,t),uh(i)==="text"?O.sources.text.addFeature(t.feature):O.sources.pins.addFeature(t.feature)}}Fc()}function Fc(){for(let i of O.pins){let e=Pa(i.category.id),t=O.search&&!i.location.title.toLocaleLowerCase().includes(O.search);i.filteredHidden=!!(e||t)}XE(),g5(),O.selectedPin?.filteredHidden&&rd(),id(),document.dispatchEvent(new Event("atlas:filters"))}function XE(){if(!O.highlightedZones.size){for(let e of O.pins)e.passesZoneFilters=!1;return}let i=rW([...O.highlightedZones].map(e=>O.zoneRecords.get(e)).filter(Boolean));for(let e of O.pins)e.passesZoneFilters=sW(i,e.coordinate)}function g5(){O.eligibleLocations=O.pins.filter(i=>!zc(i)).length,Bc(),O.layers.pins.changed(),O.layers.zonePins.changed(),O.layers.pinLabels.changed(),O.layers.text.changed(),O.layers.zoneText.changed(),O.layers.textDetail.changed(),O.layers.priority.changed(),bA()}function Bc(){O.sources.priority.clear();for(let i of O.pins){if(zc(i))continue;let e=!!O.search&&i.location.title.toLocaleLowerCase().includes(O.search);(i===O.selectedPin||i===O.hoveredPin||e||Fp(i))&&O.sources.priority.addFeature(i.feature)}}function gv(i){O.hoveredPin!==i&&(O.hoveredPin=i,O.sources&&(Bc(),O.layers.pins.changed(),O.layers.priority.changed()))}function $E(i){O.labelsHeld!==i&&(O.labelsHeld=i,ge.labelsHint.textContent=i?"Z \xB7 labels shown":"Z \xB7 hold for labels",O.layers.pinLabels.changed(),O.layers.text.changed(),O.layers.zoneTitles.changed(),O.layers.zoneTitleDetail.changed(),document.dispatchEvent(new Event("atlas:labels")))}function pv(i){return i===O.selectedPin||i===O.hoveredPin||Fp(i)||!!O.search&&i.location.title.toLocaleLowerCase().includes(O.search)}function zc(i){return i.filteredHidden||r0e(i)||s0e(i)||!Oy(i.location)}function Oy(i){let e=O.lens?.shard;return!e||!i.shard||i.shard===e}function r0e(i){return!O.highlightedZones.size||i.passesZoneFilters||i===O.selectedPin?!1:!(O.search&&i.location.title.toLocaleLowerCase().includes(O.search))}function s0e(i){return!O.gridEnabled||!O.gridCell||Fp(i)||i===O.selectedPin?!1:!(O.search&&i.location.title.toLocaleLowerCase().includes(O.search))}function o0e(i,e){return Math.max(0,1e6-Math.min(i.locations.length,999)*1e3)+jj(e.id)%1e3}function GX(i){return i.locations.length>200?4:i.locations.length>75?2.5:1}function n2(){return(O.engine?.getView().getZoom()||0)>=(O.lens?.maxZoom||0)-.05}function $X(i){let e=[],t=new Map,n=(o,a,l)=>{t.has(o)||(t.set(o,e.length),e.push({key:o,title:a,collections:[]})),e[t.get(o)].collections.push(l)},r=[],s=[];for(let o of i)o.kind==="point"&&uh(o)==="text"?r.push(o):o.kind!=="point"&&!o.group?s.push(o):n(`group-${o.group}`,o.group,o);return r.length&&e.unshift({key:"text",title:"Text",collections:r}),s.length&&e.unshift({key:"zones",title:"Zones",collections:s}),e}function YX(i){return i.kind||"point"}function ZX(i){return(i.features||i.locations||[]).length}function Tu(i){return/^\d+$/.test(i)?Number(i):i}function KX(i){for(let e of O.world?.sections||[])for(let t of e.collections)if(t.id===i)return t;return null}function QX(){let i=document.createDocumentFragment();for(let e of O.world.sections){let t=document.createElement("section");t.className="layer-section",t.dataset.layerSection=e.key;let n=e.collections.reduce((s,o)=>s+ZX(o),0);t.append(a0e(e.key,e.title,n));let r=document.createElement("div");r.className="category-toggles";for(let s of e.collections)if(r.append(l0e(s)),YX(s)!=="point"){let o=document.createElement("div");o.className="feature-index",o.dataset.featureIndex=String(s.id),r.append(o)}t.append(r),i.append(t)}ge.legend.replaceChildren(i),YE(),t$(),gh()}function a0e(i,e,t){let n=document.createElement("div");n.className="layer-header";let r=document.createElement("button");r.type="button",r.className="layer-title",r.dataset.section=i;let s=document.createElement("span");s.className="layer-chevron",s.setAttribute("aria-hidden","true"),s.innerHTML='<svg viewBox="0 0 24 24"><path d="m9 6 6 6-6 6"/></svg>';let o=document.createElement("span");o.textContent=e;let a=document.createElement("span");a.className="layer-count",a.textContent=jl(t),r.append(s,o,a);let l=JX(`Show only ${e}`);l.dataset.onlySection=i;let c=document.createElement("label");c.className="layer-switch";let u=document.createElement("input");u.type="checkbox",u.dataset.sectionToggle=i,u.setAttribute("aria-label",`Show ${e}`);let f=document.createElement("span");return f.setAttribute("aria-hidden","true"),c.append(u,f),n.append(r,l,c),n}function JX(i){let e=document.createElement("button");return e.type="button",e.className="only-button",e.dataset.label=i,e.setAttribute("aria-label",i),e.innerHTML='<svg viewBox="0 0 16 16" aria-hidden="true"><circle cx="8" cy="8" r="4.6"/><circle cx="8" cy="8" r="1.3" fill="currentColor" stroke="none"/><path d="M8 1v2M8 13v2M1 8h2M13 8h2"/></svg>',e}function l0e(i){let e=YX(i),t=document.createElement("label");t.className="category-row";let n=document.createElement("input");n.type="checkbox",n.dataset.collection=String(i.id),n.checked=!O.hiddenCollections.has(i.id);let r;e!=="point"?(r=document.createElement("button"),r.type="button",r.className="collection-expand",r.dataset.expandCollection=String(i.id),r.setAttribute("aria-label",`Unfold the ${i.title} index`),r.innerHTML='<svg class="collection-chevron" viewBox="0 0 16 16" aria-hidden="true"><path d="m6 4 4 4-4 4"/></svg>'+(e==="path"?'<svg class="collection-kind" viewBox="0 0 16 16" aria-hidden="true"><path d="M2.5 12.5c3-6 8-2 11-9"/></svg>':'<svg class="collection-kind" viewBox="0 0 16 16" aria-hidden="true"><path d="M3.5 4.5h9v7h-9z"/></svg>')):uh(i)==="text"?(r=document.createElement("span"),r.className="text-symbol",r.textContent="Tt",r.title="Drawn as a text label",dA(t,i)):(r=document.createElement("span"),r.className="category-icon",dA(t,i),fv(r,i,Su(i.title)),r.title=i.icon||i.title);let s=document.createElement("span");s.className="category-name",s.textContent=i.title;let o=JX(`Show only ${i.title}`);o.dataset.onlyCollection=String(i.id);let a;e==="area"?(a=document.createElement("button"),a.type="button",a.className="label-toggle",a.dataset.labelToggle=String(i.id),a.dataset.label=`Label ${i.title} on the map`,a.setAttribute("aria-label",`Label ${i.title} on the map`),a.setAttribute("aria-pressed",String(Kf(null,i)==="always")),a.innerHTML='<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M3.5 3.5h9M8 3.5v9"/></svg>'):(a=document.createElement("span"),a.className="label-toggle-spacer");let l=document.createElement("span");return l.className="category-count",l.textContent=jl(ZX(i)),t.append(n,r,s,o,a,l),t}function v5(i){if(O.collapsedSections.clear(),i)for(let e of ge.layers.querySelectorAll("[data-section]"))O.collapsedSections.add(e.dataset.section);YE()}function YE(){for(let i of ge.layers.querySelectorAll("[data-section]")){let e=O.collapsedSections.has(i.dataset.section);i.setAttribute("aria-expanded",String(!e)),i.closest(".layer-section").classList.toggle("is-collapsed",e)}Wl()}function e$(i){O.expandedCollections.has(i)?O.expandedCollections.delete(i):O.expandedCollections.add(i),t$()}function t$(){for(let i of ge.legend.querySelectorAll("[data-expand-collection]")){let e=O.expandedCollections.has(Tu(i.dataset.expandCollection));i.setAttribute("aria-expanded",String(e)),i.closest(".category-row").classList.toggle("is-expanded",e)}for(let i of ge.legend.querySelectorAll(".feature-index"))i.hidden=!O.expandedCollections.has(Tu(i.dataset.featureIndex));Wl()}function n$(i){let e=KX(i);if(!e)return;let t=Kf(null,e)==="always"?"quiet":"always",n=e.attrs?.["atlas.label.policy"]??"always";t===n?O.labelOverrides.delete(e.id):O.labelOverrides.set(e.id,t),c0e(),d5(),O.layers.zoneTitles.changed(),O.layers.zoneTitleDetail.changed(),Wl()}function c0e(){for(let i of ge.legend.querySelectorAll("[data-label-toggle]")){let e=KX(Tu(i.dataset.labelToggle));e&&i.setAttribute("aria-pressed",String(Kf(null,e)==="always"))}}function i2(i){if(O.hiddenCollections.clear(),!i)for(let e of O.world.sections)for(let t of e.collections)O.hiddenCollections.add(t.id);mA(),kp(),Fc(),id(),gh()}function mA(){for(let i of document.querySelectorAll("[data-collection]"))i.checked=!O.hiddenCollections.has(Tu(i.dataset.collection))}function i$(i){let e=O.world.sections.find(n=>n.key===i);if(!e)return;let t=e.collections.some(n=>!O.hiddenCollections.has(n.id));for(let n of e.collections)t?O.hiddenCollections.add(n.id):O.hiddenCollections.delete(n.id);mA(),kp(),Fc(),gh()}function r$(i){if(O.world){if(u0e(i)){i2(!0);return}O.hiddenCollections.clear();for(let e of O.world.sections){let t=i.section===e.key;for(let n of e.collections)!t&&i.collection!==n.id&&O.hiddenCollections.add(n.id)}mA(),kp(),Fc(),id(),gh()}}function u0e(i){for(let e of O.world.sections)for(let t of e.collections)if((i.section===e.key||i.collection===t.id)===O.hiddenCollections.has(t.id))return!1;return!0}function h0e(){let i=ge.soloChip;if(!O.world){i.hidden=!0;return}let e=null,t=0,n=null,r=0;for(let o of O.world.sections){let a=0;for(let l of o.collections)O.hiddenCollections.has(l.id)||(a++,t++,e=l);a>0&&(r++,n=a===o.collections.length?o:null)}let s="";t===1&&e?s=e.title:r===1&&n&&(s=n.title),i.hidden=!s,i.textContent=s?`only: ${s}`:"",i.title=s?`Showing only ${s} \u2014 click to show everything`:""}function gh(){if(O.world){for(let i of O.world.sections){let e=ge.legend.querySelector(`input[data-section-toggle="${i.key}"]`);e&&(e.checked=i.collections.some(t=>!O.hiddenCollections.has(t.id)))}h0e(),Wl()}}async function s$(i){let[e,t]=await Promise.all([fetch(`${O.volume.base}/worlds/${i.slug}.json`),fetch(`${O.volume.base}/worlds/${i.slug}.bin`)]);if(!e.ok||!t.ok)throw new Error(`world ${i.slug} is not served under this catalog any more`);let[n,r]=await Promise.all([e.json(),t.arrayBuffer()]),s=n.collections||[];f0e(r,s);let o=$X(s);return{...i,grid:n.grid,lenses:n.lenses,collections:s,collectionsById:new Map(s.map(a=>[a.id,a])),attrs:n.attrs||{},merged:n.merged||[],sections:o}}function f0e(i,e){let t=new DataView(i);if(String.fromCharCode(...new Uint8Array(i,0,8))!=="ATLASLOC")throw new Error("location payload is not in the expected form");let r=t.getUint16(8,!0);if(r!==3)throw new Error(`location payload is version ${r}, and this reads 3`);let s=t.getUint32(10,!0),o=16,a=new Int32Array(i,o,s),l=new Float32Array(i,o+=s*4,s),c=new Float32Array(i,o+=s*4,s),u=new Int32Array(i,o+=s*4,s),f=new Int32Array(i,o+=s*4,s),d=new Uint32Array(i,o+=s*4,s+1),A=new Uint16Array(i,o+=(s+1)*4,s),y=new Uint8Array(i,o+s*2),w=new TextDecoder;for(let S of e)S.kind==="point"&&(S.locations=[]);for(let S=0;S<s;S++){let T=e[A[S]];if(!T||T.kind!=="point")throw new Error(`location ${a[S]} names collection ${A[S]}, which is no point collection`);T.locations.push({id:a[S],title:w.decode(y.subarray(d[S],d[S+1])),lat:l[S],lng:c[S],memberId:u[S]||void 0,shard:f[S]||void 0})}}async function SN(){let i=`${O.volume.base}/${O.world.slug}`;return O.textByWorld.has(i)||O.textByWorld.set(i,fetch(`${O.volume.base}/worlds/${O.world.slug}.text`).then(e=>e.json()).catch(()=>({}))),O.textByWorld.get(i)}var ZE=null;function wA(){return ZE||(ZE=d0e().finally(()=>{ZE=null})),ZE}async function d0e(){let i=await fetch("/data/catalog.json");if(!i.ok)return;let e=O.volume;if(O.catalog=await i.json(),Hm(ge.volume,O.catalog.volumes,"title"),_5(),!O.catalog.volumes.length)return;let t=e&&O.catalog.volumes.find(n=>n.slug===e.slug);if(!t){let n=uv();await cd(n.volume||cv()?.volume||O.catalog.volumes[0].slug,n.volume?n.world:void 0);return}if(t.stamp!==e.stamp){for(let r of O.textByWorld.keys())r.startsWith(e.base+"/")&&O.textByWorld.delete(r);let n=O.engine?.getView();O.restore={volume:t.slug,world:O.world?.slug,lens:O.world?O.world.lenses.indexOf(O.lens):0,center:n?.getCenter(),zoom:n?.getZoom(),hidden:[...O.hiddenCollections],collapsed:[...O.collapsedSections],expanded:[...O.expandedCollections],labels:[...O.labelOverrides],overviewDocked:O.overviewDocked,dockFolded:O.dockFolded,dockDismissed:O.dockDismissed},await cd(t.slug,O.world?.slug);return}O.volume=t,ge.volume.value=t.slug}function _5(){let i=!O.catalog?.volumes?.length;ge.emptyState.hidden=!i,O.catalog?.bundlesDir&&(ge.emptyPath.textContent=O.catalog.bundlesDir)}async function x5(){for(let i of[ge.emptyOpen,ge.addBundles])i.disabled=!0;try{let e=await(await fetch("/data/bundles/import",{method:"POST"})).json().catch(()=>({}));await wA();let t=e.imported?.[0];t&&O.catalog.volumes.some(n=>n.slug===t)&&await cd(t)}finally{for(let i of[ge.emptyOpen,ge.addBundles])i.disabled=!1}}var vo={ADD:"add",REMOVE:"remove"};var o$={LENGTH:"length"},vv=class extends Ao{constructor(e,t,n){super(e),this.element=t,this.index=n}},y5=class extends zs{constructor(e,t){if(super(),this.on,this.once,this.un,t=t||{},this.unique_=!!t.unique,this.array_=e??[],this.unique_)for(let n=1,r=this.array_.length;n<r;++n)this.assertUnique_(this.array_[n],n);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(e){for(let t=0,n=e.length;t<n;++t)this.push(e[t]);return this}forEach(e){let t=this.array_;for(let n=0,r=t.length;n<r;++n)e(t[n],n,t)}getArray(){return this.array_}item(e){return this.array_[e]}getLength(){return this.get(o$.LENGTH)}insertAt(e,t){if(e<0||e>this.getLength())throw new Error("Index out of bounds: "+e);this.unique_&&this.assertUnique_(t),this.array_.splice(e,0,t),this.updateLength_(),this.dispatchEvent(new vv(vo.ADD,t,e))}pop(){return this.removeAt(this.getLength()-1)}push(e){let t=this.getLength();return this.insertAt(t,e),this.getLength()}remove(e){let t=this.array_;for(let n=0,r=t.length;n<r;++n)if(t[n]===e)return this.removeAt(n)}removeAt(e){if(e<0||e>=this.getLength())return;let t=this.array_[e];return this.array_.splice(e,1),this.updateLength_(),this.dispatchEvent(new vv(vo.REMOVE,t,e)),t}setAt(e,t){let n=this.getLength();if(e>=n){this.insertAt(e,t);return}if(e<0)throw new Error("Index out of bounds: "+e);this.unique_&&this.assertUnique_(t,e);let r=this.array_[e];this.array_[e]=t,this.dispatchEvent(new vv(vo.REMOVE,r,e)),this.dispatchEvent(new vv(vo.ADD,t,e))}updateLength_(){this.set(o$.LENGTH,this.array_.length)}assertUnique_(e,t){let n=this.array_;for(let r=0,s=n.length;r<s;++r)if(n[r]===e&&r!==t)throw new Error("Duplicate item added to a unique collection")}},No=y5;var b5=class extends Ao{constructor(e,t,n){super(e),this.map=t,this.frameState=n!==void 0?n:null}},zp=b5;var w5=class extends zp{constructor(e,t,n,r,s,o){super(e,t,s),this.originalEvent=n,this.pixel_=null,this.coordinate_=null,this.dragging=r!==void 0?r:!1,this.activePointers=o}get pixel(){return this.pixel_||(this.pixel_=this.map.getEventPixel(this.originalEvent)),this.pixel_}set pixel(e){this.pixel_=e}get coordinate(){return this.coordinate_||(this.coordinate_=this.map.getCoordinateFromPixel(this.pixel)),this.coordinate_}set coordinate(e){this.coordinate_=e}preventDefault(){super.preventDefault(),"preventDefault"in this.originalEvent&&this.originalEvent.preventDefault()}stopPropagation(){super.stopPropagation(),"stopPropagation"in this.originalEvent&&this.originalEvent.stopPropagation()}},bh=w5;var gr={SINGLECLICK:"singleclick",CLICK:nn.CLICK,DBLCLICK:nn.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var r2={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var S5=class extends Pp{constructor(e,t){super(e),this.map_=e,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=t===void 0?1:t,this.down_=null;let n=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=n,this.pointerdownListenerKey_=qn(n,r2.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=qn(n,r2.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(nn.TOUCHMOVE,this.boundHandleTouchMove_,fE?{passive:!1}:!1)}emulateClick_(e){let t=new bh(gr.CLICK,this.map_,e);this.dispatchEvent(t),this.clickTimeoutId_!==void 0?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,t=new bh(gr.DBLCLICK,this.map_,e),this.dispatchEvent(t)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;let n=new bh(gr.SINGLECLICK,this.map_,e);this.dispatchEvent(n)},250)}updateActivePointers_(e){let t=e,n=t.pointerId;if(t.type==gr.POINTERUP||t.type==gr.POINTERCANCEL){delete this.trackedTouches_[n];for(let r in this.trackedTouches_)if(this.trackedTouches_[r].target!==t.target){delete this.trackedTouches_[r];break}}else(t.type==gr.POINTERDOWN||t.type==gr.POINTERMOVE)&&(this.trackedTouches_[n]=t);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(e){this.updateActivePointers_(e);let t=new bh(gr.POINTERUP,this.map_,e,void 0,void 0,this.activePointers_);this.dispatchEvent(t),this.emulateClicks_&&!t.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(e)&&this.emulateClick_(this.down_),this.activePointers_.length===0&&(this.dragListenerKeys_.forEach(li),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(e){return e.button===0}handlePointerDown_(e){this.emulateClicks_=this.activePointers_.length===0,this.updateActivePointers_(e);let t=new bh(gr.POINTERDOWN,this.map_,e,void 0,void 0,this.activePointers_);if(this.dispatchEvent(t),this.down_=new PointerEvent(e.type,e),Object.defineProperty(this.down_,"target",{writable:!1,value:e.target}),this.dragListenerKeys_.length===0){let n=this.map_.getOwnerDocument();this.dragListenerKeys_.push(qn(n,gr.POINTERMOVE,this.handlePointerMove_,this),qn(n,gr.POINTERUP,this.handlePointerUp_,this),qn(this.element_,gr.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==n&&this.dragListenerKeys_.push(qn(this.element_.getRootNode(),gr.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(e){if(this.isMoving_(e)){this.updateActivePointers_(e),this.dragging_=!0;let t=new bh(gr.POINTERDRAG,this.map_,e,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(t)}}relayMoveEvent_(e){this.originalPointerMoveEvent_=e;let t=!!(this.down_&&this.isMoving_(e));this.dispatchEvent(new bh(gr.POINTERMOVE,this.map_,e,t))}handleTouchMove_(e){let t=this.originalPointerMoveEvent_;(!t||t.defaultPrevented)&&(typeof e.cancelable!="boolean"||e.cancelable===!0)&&e.preventDefault()}isMoving_(e){return this.dragging_||Math.abs(e.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(e.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&(li(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(nn.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(li(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(li),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}},a$=S5;var wh={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"};var Fo={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"};var s2=1/0,T5=class{constructor(e,t){this.priorityFunction_=e,this.keyFunction_=t,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,Ah(this.queuedElements_)}dequeue(){let e=this.elements_,t=this.priorities_,n=e[0];e.length==1?(e.length=0,t.length=0):(e[0]=e.pop(),t[0]=t.pop(),this.siftUp_(0));let r=this.keyFunction_(n);return delete this.queuedElements_[r],n}enqueue(e){jn(!(this.keyFunction_(e)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");let t=this.priorityFunction_(e);return t!=s2?(this.elements_.push(e),this.priorities_.push(t),this.queuedElements_[this.keyFunction_(e)]=!0,this.siftDown_(0,this.elements_.length-1),!0):!1}getCount(){return this.elements_.length}getLeftChildIndex_(e){return e*2+1}getRightChildIndex_(e){return e*2+2}getParentIndex_(e){return e-1>>1}heapify_(){let e;for(e=(this.elements_.length>>1)-1;e>=0;e--)this.siftUp_(e)}isEmpty(){return this.elements_.length===0}isKeyQueued(e){return e in this.queuedElements_}isQueued(e){return this.isKeyQueued(this.keyFunction_(e))}siftUp_(e){let t=this.elements_,n=this.priorities_,r=t.length,s=t[e],o=n[e],a=e;for(;e<r>>1;){let l=this.getLeftChildIndex_(e),c=this.getRightChildIndex_(e),u=c<r&&n[c]<n[l]?c:l;t[e]=t[u],n[e]=n[u],e=u}t[e]=s,n[e]=o,this.siftDown_(a,e)}siftDown_(e,t){let n=this.elements_,r=this.priorities_,s=n[t],o=r[t];for(;t>e;){let a=this.getParentIndex_(t);if(r[a]>o)n[t]=n[a],r[t]=r[a],t=a;else break}n[t]=s,r[t]=o}reprioritize(){let e=this.priorityFunction_,t=this.elements_,n=this.priorities_,r=0,s=t.length,o,a,l;for(a=0;a<s;++a)o=t[a],l=e(o),l==s2?delete this.queuedElements_[this.keyFunction_(o)]:(n[r]=l,t[r++]=o);t.length=r,n.length=r,this.heapify_()}},l$=T5;var E5=class extends l${constructor(e,t){super(n=>e.apply(null,n),n=>n[0].getKey()),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=t,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(e){let t=super.enqueue(e);return t&&e[0].addEventListener(nn.CHANGE,this.boundHandleTileChange_),t}getTilesLoading(){return this.tilesLoading_}handleTileChange(e){let t=e.target,n=t.getState();if(n===an.LOADED||n===an.ERROR||n===an.EMPTY){n!==an.ERROR&&t.removeEventListener(nn.CHANGE,this.boundHandleTileChange_);let r=t.getKey();r in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[r],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(e,t){let n=0;for(;this.tilesLoading_<e&&n<t&&this.getCount()>0;){let r=this.dequeue()[0],s=r.getKey();r.getState()===an.IDLE&&!(s in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[s]=!0,++this.tilesLoading_,++n,r.load())}}},c$=E5;function u$(i,e,t,n,r){if(!i||!(t in i.wantedTiles))return s2;if(!i.wantedTiles[t][e.getKey()])return s2;let s=i.viewState.center,o=n[0]-s[0],a=n[1]-s[1];return 65536*Math.log(r)+Math.sqrt(o*o+a*a)/r}var so={ANIMATING:0,INTERACTING:1};var Vc={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function M5(i,e,t){return(function(n,r,s,o,a){if(!n)return;if(!r&&!e)return n;let l=e?0:s[0]*r,c=e?0:s[1]*r,u=a?a[0]:0,f=a?a[1]:0,d=i[0]+l/2+u,A=i[2]-l/2+u,y=i[1]+c/2+f,w=i[3]-c/2+f;d>A&&(d=(A+d)/2,A=d),y>w&&(y=(w+y)/2,w=y);let S=Si(n[0],d,A),T=Si(n[1],y,w);if(o&&t&&r){let R=30*r;S+=-R*Math.log(1+Math.max(0,d-n[0])/R)+R*Math.log(1+Math.max(0,n[0]-A)/R),T+=-R*Math.log(1+Math.max(0,y-n[1])/R)+R*Math.log(1+Math.max(0,n[1]-w)/R)}return[S,T]})}function h$(i){return i}function C5(i,e,t,n){let r=Kn(e)/t[0],s=Dr(e)/t[1];return n?Math.min(i,Math.max(r,s)):Math.min(i,Math.min(r,s))}function R5(i,e,t){let n=Math.min(i,e),r=50;return n*=Math.log(1+r*Math.max(0,i/e-1))/r+1,t&&(n=Math.max(n,t),n/=Math.log(1+r*Math.max(0,t/i-1))/r+1),Si(n,t/2,e*2)}function f$(i,e,t,n){return e=e!==void 0?e:!0,(function(r,s,o,a){if(r!==void 0){let l=i[0],c=i[i.length-1],u=t?C5(l,t,o,n):l;if(a)return e?R5(r,u,c):Si(r,c,u);let f=Math.min(u,r),d=Math.floor(nv(i,f,s));return i[d]>u&&d<i.length-1?i[d+1]:i[d]}})}function d$(i,e,t,n,r,s){return n=n!==void 0?n:!0,t=t!==void 0?t:0,(function(o,a,l,c){if(o!==void 0){let u=r?C5(e,r,l,s):e;if(c)return n?R5(o,u,t):Si(o,t,u);let f=1e-9,d=Math.ceil(Math.log(e/u)/Math.log(i)-f),A=-a*(.5-f)+.5,y=Math.min(u,o),w=Math.floor(Math.log(e/y)/Math.log(i)+A),S=Math.max(d,w),T=e/Math.pow(i,S);return Si(T,t,u)}})}function I5(i,e,t,n,r){return t=t!==void 0?t:!0,(function(s,o,a,l){if(s!==void 0){let c=n?C5(i,n,a,r):i;return!t||!l?Si(s,e,c):R5(s,c,e)}})}function _v(i){if(i!==void 0)return 0}function P5(i){if(i!==void 0)return i}function p$(i){let e=2*Math.PI/i;return(function(t,n){if(n)return t;if(t!==void 0)return t=Math.floor(t/e+.5)*e,t})}function m$(i){let e=i===void 0?gu(5):i;return(function(t,n){return n||t===void 0?t:Math.abs(t)<=e?0:t})}var L5=0,N5=class extends zs{constructor(e){super(),this.on,this.once,this.un,e=Object.assign({},e),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=sE(e.projection,"EPSG:3857"),this.viewportSize_=[100,100],this.targetCenter_=null,this.targetResolution_,this.targetRotation_,this.nextCenter_=null,this.nextResolution_,this.nextRotation_,this.cancelAnchor_=void 0,e.projection&&WW(),e.center&&(e.center=xu(e.center,this.projection_)),e.extent&&(e.extent=yu(e.extent,this.projection_)),this.applyOptions_(e)}applyOptions_(e){let t=Object.assign({},e);for(let a in Vc)delete t[a];this.setProperties(t,!0);let n=m0e(e);this.maxResolution_=n.maxResolution,this.minResolution_=n.minResolution,this.zoomFactor_=n.zoomFactor,this.resolutions_=e.resolutions,this.padding_=e.padding,this.minZoom_=n.minZoom;let r=p0e(e),s=n.constraint,o=A0e(e);this.constraints_={center:r,resolution:s,rotation:o},this.setRotation(e.rotation!==void 0?e.rotation:0),this.setCenterInternal(e.center!==void 0?e.center:null),e.resolution!==void 0?this.setResolution(e.resolution):e.zoom!==void 0&&this.setZoom(e.zoom)}get padding(){return this.padding_}set padding(e){let t=this.padding_;this.padding_=e;let n=this.getCenterInternal();if(n){let r=e||[0,0,0,0];t=t||[0,0,0,0];let s=this.getResolution(),o=s/2*(r[3]-t[3]+t[1]-r[1]),a=s/2*(r[0]-t[0]+t[2]-r[2]);this.setCenterInternal([n[0]+o,n[1]-a])}}getUpdatedOptions_(e){let t=this.getProperties();return t.resolution!==void 0?t.resolution=this.getResolution():t.zoom=this.getZoom(),t.center=this.getCenterInternal(),t.rotation=this.getRotation(),Object.assign({},t,e)}animate(e){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);let t=new Array(arguments.length);for(let n=0;n<t.length;++n){let r=arguments[n];r.center&&(r=Object.assign({},r),r.center=xu(r.center,this.getProjection())),r.anchor&&(r=Object.assign({},r),r.anchor=xu(r.anchor,this.getProjection())),t[n]=r}this.animateInternal.apply(this,t)}animateInternal(e){let t=arguments.length,n;t>1&&typeof arguments[t-1]=="function"&&(n=arguments[t-1],--t);let r=0;for(;r<t&&!this.isDef();++r){let u=arguments[r];u.center&&this.setCenterInternal(u.center),u.zoom!==void 0?this.setZoom(u.zoom):u.resolution&&this.setResolution(u.resolution),u.rotation!==void 0&&this.setRotation(u.rotation)}if(r===t){n&&KE(n,!0);return}let s=Date.now(),o=this.targetCenter_.slice(),a=this.targetResolution_,l=this.targetRotation_,c=[];for(;r<t;++r){let u=arguments[r],f={start:s,complete:!1,anchor:u.anchor,duration:u.duration!==void 0?u.duration:1e3,easing:u.easing||mj,callback:n};if(u.center&&(f.sourceCenter=o,f.targetCenter=u.center.slice(),o=f.targetCenter),u.zoom!==void 0?(f.sourceResolution=a,f.targetResolution=this.getResolutionForZoom(u.zoom),a=f.targetResolution):u.resolution&&(f.sourceResolution=a,f.targetResolution=u.resolution,a=f.targetResolution),u.rotation!==void 0){f.sourceRotation=l;let d=mh(u.rotation-l+Math.PI,2*Math.PI)-Math.PI;f.targetRotation=l+d,l=f.targetRotation}g0e(f)?f.complete=!0:s+=f.duration,c.push(f)}this.animations_.push(c),this.setHint(so.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[so.ANIMATING]>0}getInteracting(){return this.hints_[so.INTERACTING]>0}cancelAnimations(){this.setHint(so.ANIMATING,-this.hints_[so.ANIMATING]);let e;for(let t=0,n=this.animations_.length;t<n;++t){let r=this.animations_[t];if(r[0].callback&&KE(r[0].callback,!1),!e)for(let s=0,o=r.length;s<o;++s){let a=r[s];if(!a.complete){e=a.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=e,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(this.updateAnimationKey_!==void 0&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;let e=Date.now(),t=!1;for(let n=this.animations_.length-1;n>=0;--n){let r=this.animations_[n],s=!0;for(let o=0,a=r.length;o<a;++o){let l=r[o];if(l.complete)continue;let c=e-l.start,u=l.duration>0?c/l.duration:1;u>=1?(l.complete=!0,u=1):s=!1;let f=l.easing(u);if(l.sourceCenter){let d=l.sourceCenter[0],A=l.sourceCenter[1],y=l.targetCenter[0],w=l.targetCenter[1];this.nextCenter_=l.targetCenter;let S=d+f*(y-d),T=A+f*(w-A);this.targetCenter_=[S,T]}if(l.sourceResolution&&l.targetResolution){let d=f===1?l.targetResolution:l.sourceResolution+f*(l.targetResolution-l.sourceResolution);if(l.anchor){let A=this.getViewportSize_(this.getRotation()),y=this.constraints_.resolution(d,0,A,!0);this.targetCenter_=this.calculateCenterZoom(y,l.anchor)}this.nextResolution_=l.targetResolution,this.targetResolution_=d,this.applyTargetState_(!0)}if(l.sourceRotation!==void 0&&l.targetRotation!==void 0){let d=f===1?mh(l.targetRotation+Math.PI,2*Math.PI)-Math.PI:l.sourceRotation+f*(l.targetRotation-l.sourceRotation);if(l.anchor){let A=this.constraints_.rotation(d,!0);this.targetCenter_=this.calculateCenterRotate(A,l.anchor)}this.nextRotation_=l.targetRotation,this.targetRotation_=d}if(this.applyTargetState_(!0),t=!0,!l.complete)break}if(s){this.animations_[n]=null,this.setHint(so.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;let o=r[0].callback;o&&KE(o,!0)}}this.animations_=this.animations_.filter(Boolean),t&&this.updateAnimationKey_===void 0&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(e,t){let n,r=this.getCenterInternal();return r!==void 0&&(n=[r[0]-t[0],r[1]-t[1]],Y1(n,e-this.getRotation()),SW(n,t)),n}calculateCenterZoom(e,t){let n,r=this.getCenterInternal(),s=this.getResolution();if(r!==void 0&&s!==void 0){let o=t[0]-e*(t[0]-r[0])/s,a=t[1]-e*(t[1]-r[1])/s;n=[o,a]}return n}getViewportSize_(e){let t=this.viewportSize_;if(e){let n=t[0],r=t[1];return[Math.abs(n*Math.cos(e))+Math.abs(r*Math.sin(e)),Math.abs(n*Math.sin(e))+Math.abs(r*Math.cos(e))]}return t}setViewportSize(e){this.viewportSize_=Array.isArray(e)?e.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){let e=this.getCenterInternal();return e&&Iy(e,this.getProjection())}getCenterInternal(){return this.get(Vc.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(e){return e!==void 0?(e[0]=this.hints_[0],e[1]=this.hints_[1],e):this.hints_.slice()}calculateExtent(e){let t=this.calculateExtentInternal(e);return Mp(t,this.getProjection())}calculateExtentInternal(e){e=e||this.getViewportSizeMinusPadding_();let t=this.getCenterInternal();jn(t,"The view center is not defined");let n=this.getResolution();jn(n!==void 0,"The view resolution is not defined");let r=this.getRotation();return jn(r!==void 0,"The view rotation is not defined"),Ey(t,n,r,e)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(e){this.applyOptions_(this.getUpdatedOptions_({maxZoom:e}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(e){this.applyOptions_(this.getUpdatedOptions_({minZoom:e}))}setConstrainResolution(e){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:e}))}getProjection(){return this.projection_}getResolution(){return this.get(Vc.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(e,t){return this.getResolutionForExtentInternal(yu(e,this.getProjection()),t)}getResolutionForExtentInternal(e,t){t=t||this.getViewportSizeMinusPadding_();let n=Kn(e)/t[0],r=Dr(e)/t[1];return Math.max(n,r)}getResolutionForValueFunction(e){e=e||2;let t=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,r=Math.log(t/n)/Math.log(e);return(function(s){return t/Math.pow(e,s*r)})}getRotation(){return this.get(Vc.ROTATION)}getValueForResolutionFunction(e){let t=Math.log(e||2),n=this.getConstrainedResolution(this.maxResolution_),r=this.minResolution_,s=Math.log(n/r)/t;return(function(o){return Math.log(n/o)/t/s})}getViewportSizeMinusPadding_(e){let t=this.getViewportSize_(e),n=this.padding_;return n&&(t=[t[0]-n[1]-n[3],t[1]-n[0]-n[2]]),t}getState(){let e=this.getProjection(),t=this.getResolution(),n=this.getRotation(),r=this.getCenterInternal(),s=this.padding_;if(s){let o=this.getViewportSizeMinusPadding_();r=D5(r,this.getViewportSize_(),[o[0]/2+s[3],o[1]/2+s[0]],t,n)}return{center:r.slice(0),projection:e!==void 0?e:null,resolution:t,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:n,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let e,t=this.getResolution();return t!==void 0&&(e=this.getZoomForResolution(t)),e}getZoomForResolution(e){let t=this.minZoom_||0,n,r;if(this.resolutions_){let s=nv(this.resolutions_,e,1);t=s,n=this.resolutions_[s],s==this.resolutions_.length-1?r=2:r=n/this.resolutions_[s+1]}else n=this.maxResolution_,r=this.zoomFactor_;return t+Math.log(n/e)/Math.log(r)}getResolutionForZoom(e){if(this.resolutions_?.length){if(this.resolutions_.length===1)return this.resolutions_[0];let t=Si(Math.floor(e),0,this.resolutions_.length-2),n=this.resolutions_[t]/this.resolutions_[t+1];return this.resolutions_[t]/Math.pow(n,Si(e-t,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,e-this.minZoom_)}fit(e,t){let n;if(jn(Array.isArray(e)||typeof e.getSimplifiedGeometry=="function","Invalid extent or geometry provided as `geometry`"),Array.isArray(e)){jn(!ph(e),"Cannot fit empty extent provided as `geometry`");let r=yu(e,this.getProjection());n=DN(r)}else if(e.getType()==="Circle"){let r=yu(e.getExtent(),this.getProjection());n=DN(r),n.rotate(this.getRotation(),dl(r))}else{let r=sA();r?n=e.clone().transform(r,this.getProjection()):n=e}this.fitInternal(n,t)}rotatedExtentForGeometry(e){let t=this.getRotation(),n=Math.cos(t),r=Math.sin(-t),s=e.getFlatCoordinates(),o=e.getStride(),a=1/0,l=1/0,c=-1/0,u=-1/0;for(let f=0,d=s.length;f<d;f+=o){let A=s[f]*n-s[f+1]*r,y=s[f]*r+s[f+1]*n;a=Math.min(a,A),l=Math.min(l,y),c=Math.max(c,A),u=Math.max(u,y)}return[a,l,c,u]}fitInternal(e,t){t=t||{};let n=t.size;n||(n=this.getViewportSizeMinusPadding_());let r=t.padding!==void 0?t.padding:[0,0,0,0],s=t.nearest!==void 0?t.nearest:!1,o;t.minResolution!==void 0?o=t.minResolution:t.maxZoom!==void 0?o=this.getResolutionForZoom(t.maxZoom):o=0;let a=this.rotatedExtentForGeometry(e),l=this.getResolutionForExtentInternal(a,[n[0]-r[1]-r[3],n[1]-r[0]-r[2]]);l=isNaN(l)?o:Math.max(l,o),l=this.getConstrainedResolution(l,s?0:1);let c=this.getRotation(),u=Math.sin(c),f=Math.cos(c),d=dl(a);d[0]+=(r[1]-r[3])/2*l,d[1]+=(r[0]-r[2])/2*l;let A=d[0]*f-d[1]*u,y=d[1]*f+d[0]*u,w=this.getConstrainedCenter([A,y],l),S=t.callback?t.callback:nd;t.duration!==void 0?this.animateInternal({resolution:l,center:w,duration:t.duration,easing:t.easing},S):(this.targetResolution_=l,this.targetCenter_=w,this.applyTargetState_(!1,!0),KE(S,!0))}centerOn(e,t,n){this.centerOnInternal(xu(e,this.getProjection()),t,n)}centerOnInternal(e,t,n){this.setCenterInternal(D5(e,t,n,this.getResolution(),this.getRotation()))}calculateCenterShift(e,t,n,r){let s,o=this.padding_;if(o&&e){let a=this.getViewportSizeMinusPadding_(-n),l=D5(e,r,[a[0]/2+o[3],a[1]/2+o[0]],t,n);s=[e[0]-l[0],e[1]-l[1]]}return s}isDef(){return!!this.getCenterInternal()&&this.getResolution()!==void 0}adjustCenter(e){let t=Iy(this.targetCenter_,this.getProjection());this.setCenter([t[0]+e[0],t[1]+e[1]])}adjustCenterInternal(e){let t=this.targetCenter_;this.setCenterInternal([t[0]+e[0],t[1]+e[1]])}adjustResolution(e,t){t=t&&xu(t,this.getProjection()),this.adjustResolutionInternal(e,t)}adjustResolutionInternal(e,t){let n=this.getAnimating()||this.getInteracting(),r=this.getViewportSize_(this.getRotation()),s=this.constraints_.resolution(this.targetResolution_*e,0,r,n);t&&(this.targetCenter_=this.calculateCenterZoom(s,t)),this.targetResolution_*=e,this.applyTargetState_()}adjustZoom(e,t){this.adjustResolution(Math.pow(this.zoomFactor_,-e),t)}adjustRotation(e,t){t&&(t=xu(t,this.getProjection())),this.adjustRotationInternal(e,t)}adjustRotationInternal(e,t){let n=this.getAnimating()||this.getInteracting(),r=this.constraints_.rotation(this.targetRotation_+e,n);t&&(this.targetCenter_=this.calculateCenterRotate(r,t)),this.targetRotation_+=e,this.applyTargetState_()}setCenter(e){this.setCenterInternal(e&&xu(e,this.getProjection()))}setCenterInternal(e){this.targetCenter_=e,this.applyTargetState_()}setHint(e,t){return this.hints_[e]+=t,this.changed(),this.hints_[e]}setResolution(e){this.targetResolution_=e,this.applyTargetState_()}setRotation(e){this.targetRotation_=e,this.applyTargetState_()}setZoom(e){this.setResolution(this.getResolutionForZoom(e))}applyTargetState_(e,t){let n=this.getAnimating()||this.getInteracting()||t,r=this.constraints_.rotation(this.targetRotation_,n),s=this.getViewportSize_(r),o=this.constraints_.resolution(this.targetResolution_,0,s,n),a=this.constraints_.center(this.targetCenter_,o,s,n,this.calculateCenterShift(this.targetCenter_,o,r,s));this.get(Vc.ROTATION)!==r&&this.set(Vc.ROTATION,r),this.get(Vc.RESOLUTION)!==o&&(this.set(Vc.RESOLUTION,o),this.set("zoom",this.getZoom(),!0)),(!a||!this.get(Vc.CENTER)||!tA(this.get(Vc.CENTER),a))&&this.set(Vc.CENTER,a),this.getAnimating()&&!e&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(e,t,n){e=e!==void 0?e:200;let r=t||0,s=this.constraints_.rotation(this.targetRotation_),o=this.getViewportSize_(s),a=this.constraints_.resolution(this.targetResolution_,r,o),l=this.constraints_.center(this.targetCenter_,a,o,!1,this.calculateCenterShift(this.targetCenter_,a,s,o));if(e===0&&!this.cancelAnchor_){this.targetResolution_=a,this.targetRotation_=s,this.targetCenter_=l,this.applyTargetState_();return}n=n||(e===0?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,(this.getResolution()!==a||this.getRotation()!==s||!this.getCenterInternal()||!tA(this.getCenterInternal(),l))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:s,center:l,resolution:a,duration:e,easing:Dc,anchor:n}))}beginInteraction(){this.resolveConstraints(0),this.setHint(so.INTERACTING,1)}endInteraction(e,t,n){n=n&&xu(n,this.getProjection()),this.endInteractionInternal(e,t,n)}endInteractionInternal(e,t,n){this.getInteracting()&&(this.setHint(so.INTERACTING,-1),this.resolveConstraints(e,t,n))}getConstrainedCenter(e,t){let n=this.getViewportSize_(this.getRotation());return this.constraints_.center(e,t||this.getResolution(),n)}getConstrainedZoom(e,t){let n=this.getResolutionForZoom(e);return this.getZoomForResolution(this.getConstrainedResolution(n,t))}getConstrainedResolution(e,t){t=t||0;let n=this.getViewportSize_(this.getRotation());return this.constraints_.resolution(e,t,n)}};function KE(i,e){setTimeout(function(){i(e)},0)}function p0e(i){if(i.extent!==void 0){let t=i.smoothExtentConstraint!==void 0?i.smoothExtentConstraint:!0;return M5(i.extent,i.constrainOnlyCenter,t)}let e=sE(i.projection,"EPSG:3857");if(i.multiWorld!==!0&&e.isGlobal()){let t=e.getExtent().slice();return t[0]=-1/0,t[2]=1/0,M5(t,!1,!1)}return h$}function m0e(i){let e,t,n,o=i.minZoom!==void 0?i.minZoom:L5,a=i.maxZoom!==void 0?i.maxZoom:28,l=i.zoomFactor!==void 0?i.zoomFactor:2,c=i.multiWorld!==void 0?i.multiWorld:!1,u=i.smoothResolutionConstraint!==void 0?i.smoothResolutionConstraint:!0,f=i.showFullExtent!==void 0?i.showFullExtent:!1,d=sE(i.projection,"EPSG:3857"),A=d.getExtent(),y=i.constrainOnlyCenter,w=i.extent;if(!c&&!w&&d.isGlobal()&&(y=!1,w=A),i.resolutions!==void 0){let S=i.resolutions;t=S[o],n=S[a]!==void 0?S[a]:S[S.length-1],i.constrainResolution?e=f$(S,u,!y&&w,f):e=I5(t,n,u,!y&&w,f)}else{let T=(A?Math.max(Kn(A),Dr(A)):360*Qf.degrees/d.getMetersPerUnit())/256/Math.pow(2,L5),R=T/Math.pow(2,28-L5);t=i.maxResolution,t!==void 0?o=0:t=T/Math.pow(l,o),n=i.minResolution,n===void 0&&(i.maxZoom!==void 0?i.maxResolution!==void 0?n=t/Math.pow(l,a):n=T/Math.pow(l,a):n=R),a=o+Math.floor(Math.log(t/n)/Math.log(l)),n=t/Math.pow(l,a-o),i.constrainResolution?e=d$(l,t,n,u,!y&&w,f):e=I5(t,n,u,!y&&w,f)}return{constraint:e,maxResolution:t,minResolution:n,minZoom:o,zoomFactor:l}}function A0e(i){if(i.enableRotation!==void 0?i.enableRotation:!0){let t=i.constrainRotation;return t===void 0||t===!0?m$():t===!1?P5:typeof t=="number"?p$(t):P5}return _v}function g0e(i){return!(i.sourceCenter&&i.targetCenter&&!tA(i.sourceCenter,i.targetCenter)||i.sourceResolution!==i.targetResolution||i.sourceRotation!==i.targetRotation)}function D5(i,e,t,n,r){let s=Math.cos(-r),o=Math.sin(-r),a=i[0]*s-i[1]*o,l=i[1]*s+i[0]*o;a+=(e[0]/2-t[0])*n,l+=(t[1]-e[1]/2)*n,o=-o;let c=a*s-l*o,u=l*s+a*o;return[c,u]}var Xl=N5;var F5=class extends zs{constructor(e){super();let t=e.element;t&&!e.target&&!t.style.pointerEvents&&(t.style.pointerEvents="auto"),this.element=t||null,this.target_=null,this.map_=null,this.listenerKeys=[],e.render&&(this.render=e.render),e.target&&this.setTarget(e.target)}disposeInternal(){this.element?.remove(),super.disposeInternal()}getMap(){return this.map_}setMap(e){this.map_&&this.element?.remove();for(let t=0,n=this.listenerKeys.length;t<n;++t)li(this.listenerKeys[t]);if(this.listenerKeys.length=0,this.map_=e,e){let t=this.target_??e.getOverlayContainerStopEvent();this.element&&t.appendChild(this.element),this.render!==nd&&this.listenerKeys.push(qn(e,wh.POSTRENDER,this.render,this)),e.render()}}render(e){}setTarget(e){this.target_=typeof e=="string"?document.getElementById(e):e}},xv=F5;var B5=class extends xv{constructor(e){e=e||{},super({element:document.createElement("div"),render:e.render,target:e.target}),this.ulElement_=document.createElement("ul"),this.collapsed_=e.collapsed!==void 0?e.collapsed:!0,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=e.collapsible!==void 0,this.collapsible_=e.collapsible!==void 0?e.collapsible:!0,this.collapsible_||(this.collapsed_=!1),this.attributions_=e.attributions;let t=e.className!==void 0?e.className:"ol-attribution",n=e.tipLabel!==void 0?e.tipLabel:"Attributions",r=e.expandClassName!==void 0?e.expandClassName:t+"-expand",s=e.collapseLabel!==void 0?e.collapseLabel:"\u203A",o=e.collapseClassName!==void 0?e.collapseClassName:t+"-collapse";typeof s=="string"?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=s,this.collapseLabel_.className=o):this.collapseLabel_=s;let a=e.label!==void 0?e.label:"i";typeof a=="string"?(this.label_=document.createElement("span"),this.label_.textContent=a,this.label_.className=r):this.label_=a;let l=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_;this.toggleButton_=document.createElement("button"),this.toggleButton_.setAttribute("type","button"),this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_)),this.toggleButton_.title=n,this.toggleButton_.appendChild(l),this.toggleButton_.addEventListener(nn.CLICK,this.handleClick_.bind(this),!1);let c=t+" "+Op+" "+dv+(this.collapsed_&&this.collapsible_?" "+XN:"")+(this.collapsible_?"":" ol-uncollapsible"),u=this.element;u.className=c,u.appendChild(this.toggleButton_),u.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(e){let t=this.getMap().getAllLayers(),n=new Set(t.flatMap(r=>r.getAttributions(e)));if(this.attributions_!==void 0&&(Array.isArray(this.attributions_)?this.attributions_.forEach(r=>n.add(r)):n.add(this.attributions_)),!this.overrideCollapsible_){let r=!t.some(s=>s.getSource()?.getAttributionsCollapsible()===!1);this.setCollapsible(r)}return Array.from(n)}async updateElement_(e){if(!e){this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1);return}let t=await Promise.all(this.collectSourceAttributions_(e).map(r=>uj(()=>r))),n=t.length>0;if(this.renderedVisible_!=n&&(this.element.style.display=n?"":"none",this.renderedVisible_=n),!ea(t,this.renderedAttributions_)){gj(this.ulElement_);for(let r=0,s=t.length;r<s;++r){let o=document.createElement("li");o.innerHTML=t[r],this.ulElement_.appendChild(o)}this.renderedAttributions_=t}}handleClick_(e){e.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){this.element.classList.toggle(XN),this.collapsed_?tN(this.collapseLabel_,this.label_):tN(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_,this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_))}getCollapsible(){return this.collapsible_}setCollapsible(e){this.collapsible_!==e&&(this.collapsible_=e,this.element.classList.toggle("ol-uncollapsible"),this.userCollapsed_&&this.handleToggle_())}setCollapsed(e){this.userCollapsed_=e,!(!this.collapsible_||this.collapsed_===e)&&this.handleToggle_()}getCollapsed(){return this.collapsed_}render(e){this.updateElement_(e.frameState)}},A$=B5;var O5=class extends xv{constructor(e){e=e||{},super({element:document.createElement("div"),render:e.render,target:e.target});let t=e.className!==void 0?e.className:"ol-rotate",n=e.label!==void 0?e.label:"\u21E7",r=e.compassClassName!==void 0?e.compassClassName:"ol-compass";this.label_=null,typeof n=="string"?(this.label_=document.createElement("span"),this.label_.className=r,this.label_.textContent=n):(this.label_=n,this.label_.classList.add(r));let s=e.tipLabel?e.tipLabel:"Reset rotation",o=document.createElement("button");o.className=t+"-reset",o.setAttribute("type","button"),o.title=s,o.appendChild(this.label_),o.addEventListener(nn.CLICK,this.handleClick_.bind(this),!1);let a=t+" "+Op+" "+dv,l=this.element;l.className=a,l.appendChild(o),this.callResetNorth_=e.resetNorth?e.resetNorth:void 0,this.duration_=e.duration!==void 0?e.duration:250,this.autoHide_=e.autoHide!==void 0?e.autoHide:!0,this.rotation_=void 0,this.autoHide_&&this.element.classList.add(Qy)}handleClick_(e){e.preventDefault(),this.callResetNorth_!==void 0?this.callResetNorth_():this.resetNorth_()}resetNorth_(){let t=this.getMap().getView();if(!t)return;let n=t.getRotation();n!==void 0&&(this.duration_>0&&n%(2*Math.PI)!==0?t.animate({rotation:0,duration:this.duration_,easing:Dc}):t.setRotation(0))}render(e){let t=e.frameState;if(!t)return;let n=t.viewState.rotation;if(n!=this.rotation_){let r="rotate("+n+"rad)";if(this.autoHide_){let s=this.element.classList.contains(Qy);!s&&n===0?this.element.classList.add(Qy):s&&n!==0&&this.element.classList.remove(Qy)}this.label_.style.transform=r}this.rotation_=n}},g$=O5;var U5=class extends xv{constructor(e){e=e||{},super({element:document.createElement("div"),target:e.target});let t=e.className!==void 0?e.className:"ol-zoom",n=e.delta!==void 0?e.delta:1,r=e.zoomInClassName!==void 0?e.zoomInClassName:t+"-in",s=e.zoomOutClassName!==void 0?e.zoomOutClassName:t+"-out",o=e.zoomInLabel!==void 0?e.zoomInLabel:"+",a=e.zoomOutLabel!==void 0?e.zoomOutLabel:"\u2013",l=e.zoomInTipLabel!==void 0?e.zoomInTipLabel:"Zoom in",c=e.zoomOutTipLabel!==void 0?e.zoomOutTipLabel:"Zoom out",u=document.createElement("button");u.className=r,u.setAttribute("type","button"),u.title=l,u.appendChild(typeof o=="string"?document.createTextNode(o):o),u.addEventListener(nn.CLICK,this.handleClick_.bind(this,n),!1);let f=document.createElement("button");f.className=s,f.setAttribute("type","button"),f.title=c,f.appendChild(typeof a=="string"?document.createTextNode(a):a),f.addEventListener(nn.CLICK,this.handleClick_.bind(this,-n),!1);let d=t+" "+Op+" "+dv,A=this.element;A.className=d,A.appendChild(u),A.appendChild(f),this.duration_=e.duration!==void 0?e.duration:250}handleClick_(e,t){t.preventDefault(),this.zoomByDelta_(e)}zoomByDelta_(e){let n=this.getMap().getView();if(!n)return;let r=n.getZoom();if(r!==void 0){let s=n.getConstrainedZoom(r+e);this.duration_>0?(n.getAnimating()&&n.cancelAnimations(),n.animate({zoom:s,duration:this.duration_,easing:Dc})):n.setZoom(s)}}},v$=U5;function QE(i){i=i||{};let e=new No;return(i.zoom===void 0||i.zoom)&&e.push(new v$(i.zoomOptions)),(i.rotate===void 0||i.rotate)&&e.push(new g$(i.rotateOptions)),(i.attribution===void 0||i.attribution)&&e.push(new A$(i.attributionOptions)),e}var k5=class{constructor(e,t,n){this.decay_=e,this.minVelocity_=t,this.delay_=n,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(e,t){this.points_.push(e,t,Date.now())}end(){if(this.points_.length<6)return!1;let e=Date.now()-this.delay_,t=this.points_.length-3;if(this.points_[t+2]<e)return!1;let n=t-3;for(;n>0&&this.points_[n+2]>e;)n-=3;let r=this.points_[t+2]-this.points_[n+2];if(r<1e3/60)return!1;let s=this.points_[t]-this.points_[n],o=this.points_[t+1]-this.points_[n+1];return this.angle_=Math.atan2(o,s),this.initialVelocity_=Math.sqrt(s*s+o*o)/r,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}},_$=k5;var z5={ACTIVE:"active"};var V5=class extends zs{constructor(e){super(),this.on,this.once,this.un,e&&e.handleEvent&&(this.handleEvent=e.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get(z5.ACTIVE)}getMap(){return this.map_}handleEvent(e){return!0}setActive(e){this.set(z5.ACTIVE,e)}setMap(e){this.map_=e}};function x$(i,e,t){let n=i.getCenterInternal();if(n){let r=[n[0]+e[0],n[1]+e[1]];i.animateInternal({duration:t!==void 0?t:250,easing:Aj,center:i.getConstrainedCenter(r)})}}function yv(i,e,t,n){let r=i.getZoom();if(r===void 0)return;let s=i.getConstrainedZoom(r+e),o=i.getResolutionForZoom(s);i.getAnimating()&&i.cancelAnimations(),i.animate({resolution:o,anchor:t,duration:n!==void 0?n:250,easing:Dc})}var Sh=V5;var G5=class extends Sh{constructor(e){super(),e=e||{},this.delta_=e.delta?e.delta:1,this.duration_=e.duration!==void 0?e.duration:250}handleEvent(e){let t=!1;if(e.type==gr.DBLCLICK){let n=e.originalEvent,r=e.map,s=e.coordinate,o=n.shiftKey?-this.delta_:this.delta_,a=r.getView();yv(a,o,s,this.duration_),n.preventDefault(),t=!0}return!t}},y$=G5;function o2(i){let e=arguments;return function(t){let n=!0;for(let r=0,s=e.length;r<s&&(n=n&&e[r](t),!!n);++r);return n}}var b$=function(i){let e=i.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},v0e=function(i){let e=i.map.getTargetElement(),t=e.getRootNode(),n=i.map.getOwnerDocument().activeElement;return t instanceof ShadowRoot?t.host.contains(n):e.contains(n)},JE=function(i){let e=i.map.getTargetElement(),t=e.getRootNode();return(t instanceof ShadowRoot?t.host:e).hasAttribute("tabindex")?v0e(i):!0},w$=ed;var e3=function(i){let e=i.originalEvent;return"pointerId"in e&&e.button==0&&!(hj&&ZD&&e.ctrlKey)};var t3=function(i){let e=i.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey};var S$=function(i){let e=i.originalEvent;return ZD?e.metaKey:e.ctrlKey},T$=function(i){let e=i.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},n3=function(i){let e=i.originalEvent,t=e.target.tagName;return t!=="INPUT"&&t!=="SELECT"&&t!=="TEXTAREA"&&!e.target.isContentEditable},i3=function(i){let e=i.originalEvent;return"pointerId"in e&&e.pointerType=="mouse"};var E$=function(i){let e=i.originalEvent;return"pointerId"in e&&e.isPrimary&&e.button===0};var q5=class extends Sh{constructor(e){e=e||{},super(e),e.handleDownEvent&&(this.handleDownEvent=e.handleDownEvent),e.handleDragEvent&&(this.handleDragEvent=e.handleDragEvent),e.handleMoveEvent&&(this.handleMoveEvent=e.handleMoveEvent),e.handleUpEvent&&(this.handleUpEvent=e.handleUpEvent),e.stopDown&&(this.stopDown=e.stopDown),this.handlingDownUpSequence=!1,this.targetPointers=[]}getPointerCount(){return this.targetPointers.length}handleDownEvent(e){return!1}handleDragEvent(e){}handleEvent(e){if(!e.originalEvent)return!0;let t=!1;if(this.updateTrackedPointers_(e),this.handlingDownUpSequence){if(e.type==gr.POINTERDRAG)this.handleDragEvent(e),e.originalEvent.preventDefault();else if(e.type==gr.POINTERUP){let n=this.handleUpEvent(e);this.handlingDownUpSequence=n&&this.targetPointers.length>0}}else if(e.type==gr.POINTERDOWN){let n=this.handleDownEvent(e);this.handlingDownUpSequence=n,t=this.stopDown(n)}else e.type==gr.POINTERMOVE&&this.handleMoveEvent(e);return!t}handleMoveEvent(e){}handleUpEvent(e){return!1}stopDown(e){return e}updateTrackedPointers_(e){e.activePointers&&(this.targetPointers=e.activePointers)}};function bv(i){let e=i.length,t=0,n=0;for(let r=0;r<e;r++)t+=i[r].clientX,n+=i[r].clientY;return{clientX:t/e,clientY:n/e}}var Th=q5;var H5=class extends Th{constructor(e){super({stopDown:td}),e=e||{},this.kinetic_=e.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;let t=e.condition?e.condition:o2(t3,E$);this.condition_=e.onFocusOnly?o2(JE,t):t,this.noKinetic_=!1}handleDragEvent(e){let t=e.map;this.panning_||(this.panning_=!0,t.getView().beginInteraction());let n=this.targetPointers,r=t.getEventPixel(bv(n));if(n.length==this.lastPointersCount_){if(this.kinetic_&&this.kinetic_.update(r[0],r[1]),this.lastCentroid){let s=[this.lastCentroid[0]-r[0],r[1]-this.lastCentroid[1]],a=e.map.getView();TW(s,a.getResolution()),Y1(s,a.getRotation()),a.adjustCenterInternal(s)}}else this.kinetic_&&this.kinetic_.begin();this.lastCentroid=r,this.lastPointersCount_=n.length,e.originalEvent.preventDefault()}handleUpEvent(e){let t=e.map,n=t.getView();if(this.targetPointers.length===0){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){let r=this.kinetic_.getDistance(),s=this.kinetic_.getAngle(),o=n.getCenterInternal(),a=t.getPixelFromCoordinateInternal(o),l=t.getCoordinateFromPixelInternal([a[0]-r*Math.cos(s),a[1]-r*Math.sin(s)]);n.animateInternal({center:n.getConstrainedCenter(l),duration:500,easing:Dc})}return this.panning_&&(this.panning_=!1,n.endInteraction()),!1}return this.kinetic_&&this.kinetic_.begin(),this.lastCentroid=null,!0}handleDownEvent(e){if(this.targetPointers.length>0&&this.condition_(e)){let n=e.map.getView();return this.lastCentroid=null,n.getAnimating()&&n.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}},M$=H5;var W5=class extends Th{constructor(e){e=e||{},super({stopDown:td}),this.condition_=e.condition?e.condition:b$,this.lastAngle_=void 0,this.duration_=e.duration!==void 0?e.duration:250}handleDragEvent(e){if(!i3(e))return;let t=e.map,n=t.getView();if(n.getConstraints().rotation===_v)return;let r=t.getSize(),s=e.pixel,o=Math.atan2(r[1]/2-s[1],s[0]-r[0]/2);if(this.lastAngle_!==void 0){let a=o-this.lastAngle_;n.adjustRotationInternal(-a)}this.lastAngle_=o}handleUpEvent(e){return i3(e)?(e.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(e){return i3(e)&&e3(e)&&this.condition_(e)?(e.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}},C$=W5;var j5=class extends Ip{constructor(e){super(),this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.style.pointerEvents="auto",this.element_.className="ol-box "+e,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){let e=this.startPixel_,t=this.endPixel_,n="px",r=this.element_.style;r.left=Math.min(e[0],t[0])+n,r.top=Math.min(e[1],t[1])+n,r.width=Math.abs(t[0]-e[0])+n,r.height=Math.abs(t[1]-e[1])+n}setMap(e){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);let t=this.element_.style;t.left="inherit",t.top="inherit",t.width="inherit",t.height="inherit"}this.map_=e,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)}setPixels(e,t){this.startPixel_=e,this.endPixel_=t,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){if(!this.map_)return;let e=this.startPixel_,t=this.endPixel_,r=[e,[e[0],t[1]],t,[t[0],e[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);r[4]=r[0].slice(),this.geometry_?this.geometry_.setCoordinates([r]):this.geometry_=new _h([r])}getGeometry(){return this.geometry_}},R$=j5;var wv={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"},SA=class extends Ao{constructor(e,t,n){super(e),this.coordinate=t,this.mapBrowserEvent=n}},X5=class extends Th{constructor(e){super(),this.on,this.once,this.un,e=e??{},this.box_=new R$(e.className||"ol-dragbox"),this.minArea_=e.minArea??64,e.onBoxEnd&&(this.onBoxEnd=e.onBoxEnd),this.startPixel_=null,this.condition_=e.condition??e3,this.boxEndCondition_=e.boxEndCondition??this.defaultBoxEndCondition}defaultBoxEndCondition(e,t,n){let r=n[0]-t[0],s=n[1]-t[1];return r*r+s*s>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(e){this.startPixel_&&(this.box_.setPixels(this.startPixel_,e.pixel),this.dispatchEvent(new SA(wv.BOXDRAG,e.coordinate,e)))}handleUpEvent(e){if(!this.startPixel_)return!1;let t=this.boxEndCondition_(e,this.startPixel_,e.pixel);return t&&this.onBoxEnd(e),this.dispatchEvent(new SA(t?wv.BOXEND:wv.BOXCANCEL,e.coordinate,e)),this.box_.setMap(null),this.startPixel_=null,!1}handleDownEvent(e){return this.condition_(e)?(this.startPixel_=e.pixel,this.box_.setMap(e.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new SA(wv.BOXSTART,e.coordinate,e)),!0):!1}onBoxEnd(e){}setActive(e){e||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new SA(wv.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setActive(e)}setMap(e){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new SA(wv.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setMap(e)}},I$=X5;var $5=class extends I${constructor(e){e=e||{};let t=e.condition?e.condition:T$;super({condition:t,className:e.className||"ol-dragzoom",minArea:e.minArea}),this.duration_=e.duration!==void 0?e.duration:200,this.out_=e.out!==void 0?e.out:!1}onBoxEnd(e){let n=this.getMap().getView(),r=this.getGeometry();if(this.out_){let s=n.rotatedExtentForGeometry(r),o=n.getResolutionForExtentInternal(s),a=n.getResolution()/o;r=r.clone(),r.scale(a*a)}n.fitInternal(r,{duration:this.duration_,easing:Dc})}},P$=$5;var Vp={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown"};var Y5=class extends Sh{constructor(e){super(),e=e||{},this.defaultCondition_=function(t){return t3(t)&&n3(t)},this.condition_=e.condition!==void 0?e.condition:this.defaultCondition_,this.duration_=e.duration!==void 0?e.duration:100,this.pixelDelta_=e.pixelDelta!==void 0?e.pixelDelta:128}handleEvent(e){let t=!1;if(e.type==nn.KEYDOWN){let n=e.originalEvent,r=n.key;if(this.condition_(e)&&(r==Vp.DOWN||r==Vp.LEFT||r==Vp.RIGHT||r==Vp.UP)){let o=e.map.getView(),a=o.getResolution()*this.pixelDelta_,l=0,c=0;r==Vp.DOWN?c=-a:r==Vp.LEFT?l=-a:r==Vp.RIGHT?l=a:c=a;let u=[l,c];Y1(u,o.getRotation()),x$(o,u,this.duration_),n.preventDefault(),t=!0}}return!t}},L$=Y5;var Z5=class extends Sh{constructor(e){super(),e=e||{},this.condition_=e.condition?e.condition:function(t){return!S$(t)&&n3(t)},this.delta_=e.delta?e.delta:1,this.duration_=e.duration!==void 0?e.duration:100}handleEvent(e){let t=!1;if(e.type==nn.KEYDOWN||e.type==nn.KEYPRESS){let n=e.originalEvent,r=n.key;if(this.condition_(e)&&(r==="+"||r==="-")){let s=e.map,o=r==="+"?this.delta_:-this.delta_,a=s.getView();yv(a,o,void 0,this.duration_),n.preventDefault(),t=!0}}return!t}},D$=Z5;var _0e=40,x0e=300,y0e=3,K5=class extends Sh{constructor(e){e=e||{},super(e),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=e.maxDelta!==void 0?e.maxDelta:1,this.duration_=e.duration!==void 0?e.duration:250,this.timeout_=e.timeout!==void 0?e.timeout:80,this.useAnchor_=e.useAnchor!==void 0?e.useAnchor:!0,this.constrainResolution_=e.constrainResolution!==void 0?e.constrainResolution:!1;let t=e.condition?e.condition:w$;this.condition_=e.onFocusOnly?o2(JE,t):t,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300,this.ctrlKeyPressed_=!1,this.ctrlKeyListenerKeys_=[]}setMap(e){if(this.ctrlKeyListenerKeys_.forEach(li),this.ctrlKeyListenerKeys_.length=0,this.ctrlKeyPressed_=!1,super.setMap(e),e){let t=e.getOwnerDocument();this.ctrlKeyListenerKeys_.push(qn(t,"keydown",n=>{n.key==="Control"&&(this.ctrlKeyPressed_=!0)}),qn(t,"keyup",n=>{n.key==="Control"&&(this.ctrlKeyPressed_=!1)}))}}endInteraction_(){this.trackpadTimeoutId_=void 0;let e=this.getMap();if(!e)return;let t=e.getView(),n=this.lastDelta_?this.lastDelta_>0?1:-1:0;t.endInteraction(this.constrainResolution_||t.getConstrainResolution()?100:void 0,n,this.lastAnchor_?e.getCoordinateFromPixel(this.lastAnchor_):null)}handleEvent(e){if(!this.condition_(e)||e.type!==nn.WHEEL)return!0;let n=e.map,r=e.originalEvent;r.preventDefault();let s=r.ctrlKey&&!this.ctrlKeyPressed_;r.ctrlKey||(this.ctrlKeyPressed_=!1),this.useAnchor_&&(this.lastAnchor_=e.pixel);let o=r.deltaY;switch(r.deltaMode){case WheelEvent.DOM_DELTA_LINE:o*=_0e;break;case WheelEvent.DOM_DELTA_PAGE:o*=x0e;break;default:}if(o===0)return!1;this.lastDelta_=o;let a=Date.now();this.startTime_===void 0&&(this.startTime_=a),(!this.mode_||a-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(o)<4?"trackpad":"wheel");let l=n.getView();if(this.mode_==="trackpad")return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(l.getAnimating()&&l.cancelAnimations(),l.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),s&&(o=o*y0e),l.adjustZoom(-o/this.deltaPerZoom_,this.lastAnchor_?n.getCoordinateFromPixel(this.lastAnchor_):null),this.startTime_=a,!1;this.totalDelta_+=o;let c=Math.max(this.timeout_-(a-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,n),c),!1}handleWheelZoom_(e){let t=e.getView();t.getAnimating()&&t.cancelAnimations();let n=-Si(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(t.getConstrainResolution()||this.constrainResolution_)&&(n=n?n>0?1:-1:0),yv(t,n,this.lastAnchor_?e.getCoordinateFromPixel(this.lastAnchor_):null,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(e){this.useAnchor_=e,e||(this.lastAnchor_=null)}},N$=K5;var Q5=class extends Th{constructor(e){e=e||{};let t=e;t.stopDown||(t.stopDown=td),super(t),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=e.threshold!==void 0?e.threshold:.3,this.duration_=e.duration!==void 0?e.duration:250}handleDragEvent(e){let t=0,n=this.targetPointers[0],r=this.targetPointers[1],s=Math.atan2(r.clientY-n.clientY,r.clientX-n.clientX);if(this.lastAngle_!==void 0){let l=s-this.lastAngle_;this.rotationDelta_+=l,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),t=l}this.lastAngle_=s;let o=e.map,a=o.getView();a.getConstraints().rotation!==_v&&(this.anchor_=o.getCoordinateFromPixelInternal(o.getEventPixel(bv(this.targetPointers))),this.rotating_&&(o.render(),a.adjustRotationInternal(t,this.anchor_)))}handleUpEvent(e){return this.targetPointers.length<2?(e.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(e){if(this.targetPointers.length>=2){let t=e.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||t.getView().beginInteraction(),!0}return!1}},F$=Q5;var J5=class extends Th{constructor(e){e=e||{};let t=e;t.stopDown||(t.stopDown=td),super(t),this.anchor_=null,this.duration_=e.duration!==void 0?e.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(e){let t=1,n=this.targetPointers[0],r=this.targetPointers[1],s=n.clientX-r.clientX,o=n.clientY-r.clientY,a=Math.sqrt(s*s+o*o);this.lastDistance_!==void 0&&(t=this.lastDistance_/a),this.lastDistance_=a;let l=e.map,c=l.getView();t!=1&&(this.lastScaleDelta_=t),this.anchor_=l.getCoordinateFromPixelInternal(l.getEventPixel(bv(this.targetPointers))),l.render(),c.adjustResolutionInternal(t,this.anchor_)}handleUpEvent(e){if(this.targetPointers.length<2){let n=e.map.getView(),r=this.lastScaleDelta_>1?1:-1;return n.endInteraction(this.duration_,r),!1}return!0}handleDownEvent(e){if(this.targetPointers.length>=2){let t=e.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||t.getView().beginInteraction(),!0}return!1}},B$=J5;function r3(i){i=i||{};let e=new No,t=new _$(-.005,.05,100);return(i.altShiftDragRotate===void 0||i.altShiftDragRotate)&&e.push(new C$),(i.doubleClickZoom===void 0||i.doubleClickZoom)&&e.push(new y$({delta:i.zoomDelta,duration:i.zoomDuration})),(i.dragPan===void 0||i.dragPan)&&e.push(new M$({onFocusOnly:i.onFocusOnly,kinetic:t})),(i.pinchRotate===void 0||i.pinchRotate)&&e.push(new F$),(i.pinchZoom===void 0||i.pinchZoom)&&e.push(new B$({duration:i.zoomDuration})),(i.keyboard===void 0||i.keyboard)&&(e.push(new L$),e.push(new D$({delta:i.zoomDelta,duration:i.zoomDuration}))),(i.mouseWheelZoom===void 0||i.mouseWheelZoom)&&e.push(new N$({onFocusOnly:i.onFocusOnly,duration:i.zoomDuration})),(i.shiftDragZoom===void 0||i.shiftDragZoom)&&e.push(new P$({duration:i.zoomDuration})),e}var Ni={OPACITY:"opacity",VISIBLE:"visible",EXTENT:"extent",Z_INDEX:"zIndex",MAX_RESOLUTION:"maxResolution",MIN_RESOLUTION:"minResolution",MAX_ZOOM:"maxZoom",MIN_ZOOM:"minZoom",SOURCE:"source",MAP:"map"};var e6=class extends zs{constructor(e){super(),this.on,this.once,this.un,this.background_=e.background;let t=Object.assign({},e);typeof e.properties=="object"&&(delete t.properties,Object.assign(t,e.properties)),t[Ni.OPACITY]=e.opacity!==void 0?e.opacity:1,jn(typeof t[Ni.OPACITY]=="number","Layer opacity must be a number"),t[Ni.VISIBLE]=e.visible!==void 0?e.visible:!0,t[Ni.Z_INDEX]=e.zIndex,t[Ni.MAX_RESOLUTION]=e.maxResolution!==void 0?e.maxResolution:1/0,t[Ni.MIN_RESOLUTION]=e.minResolution!==void 0?e.minResolution:0,t[Ni.MIN_ZOOM]=e.minZoom!==void 0?e.minZoom:-1/0,t[Ni.MAX_ZOOM]=e.maxZoom!==void 0?e.maxZoom:1/0,this.className_=t.className!==void 0?t.className:"ol-layer",delete t.className,this.setProperties(t),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(e){let t=this.state_||{layer:this,managed:e===void 0?!0:e},n=this.getZIndex();return t.opacity=Si(Math.round(this.getOpacity()*100)/100,0,1),t.visible=this.getVisible(),t.extent=this.getExtent(),t.zIndex=n===void 0&&!t.managed?1/0:n,t.maxResolution=this.getMaxResolution(),t.minResolution=Math.max(this.getMinResolution(),0),t.minZoom=this.getMinZoom(),t.maxZoom=this.getMaxZoom(),this.state_=t,t}getLayersArray(e){return ei()}getLayerStatesArray(e){return ei()}getExtent(){return this.get(Ni.EXTENT)}getMaxResolution(){return this.get(Ni.MAX_RESOLUTION)}getMinResolution(){return this.get(Ni.MIN_RESOLUTION)}getMinZoom(){return this.get(Ni.MIN_ZOOM)}getMaxZoom(){return this.get(Ni.MAX_ZOOM)}getOpacity(){return this.get(Ni.OPACITY)}getSourceState(){return ei()}getVisible(){return this.get(Ni.VISIBLE)}getZIndex(){return this.get(Ni.Z_INDEX)}setBackground(e){this.background_=e,this.changed()}setExtent(e){this.set(Ni.EXTENT,e)}setMaxResolution(e){this.set(Ni.MAX_RESOLUTION,e)}setMinResolution(e){this.set(Ni.MIN_RESOLUTION,e)}setMaxZoom(e){this.set(Ni.MAX_ZOOM,e)}setMinZoom(e){this.set(Ni.MIN_ZOOM,e)}setOpacity(e){jn(typeof e=="number","Layer opacity must be a number"),this.set(Ni.OPACITY,e)}setVisible(e){this.set(Ni.VISIBLE,e)}setZIndex(e){this.set(Ni.Z_INDEX,e)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}},s3=e6;var Gp={ADDLAYER:"addlayer",REMOVELAYER:"removelayer"},Eu=class extends Ao{constructor(e,t){super(e),this.layer=t}},t6={LAYERS:"layers"},n6=class i extends s3{constructor(e){e=e||{};let t=Object.assign({},e);delete t.layers;let n=e.layers;super(t),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(t6.LAYERS,this.handleLayersChanged_),n?Array.isArray(n)?n=new No(n.slice(),{unique:!0}):jn(typeof n.getArray=="function","Expected `layers` to be an array or a `Collection`"):n=new No(void 0,{unique:!0}),this.setLayers(n)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(li),this.layersListenerKeys_.length=0;let e=this.getLayers();this.layersListenerKeys_.push(qn(e,vo.ADD,this.handleLayersAdd_,this),qn(e,vo.REMOVE,this.handleLayersRemove_,this));for(let n in this.listenerKeys_)this.listenerKeys_[n].forEach(li);Ah(this.listenerKeys_);let t=e.getArray();for(let n=0,r=t.length;n<r;n++){let s=t[n];this.registerLayerListeners_(s),this.dispatchEvent(new Eu(Gp.ADDLAYER,s))}this.changed()}registerLayerListeners_(e){let t=[qn(e,bu.PROPERTYCHANGE,this.handleLayerChange_,this),qn(e,nn.CHANGE,this.handleLayerChange_,this)];e instanceof i&&t.push(qn(e,Gp.ADDLAYER,this.handleLayerGroupAdd_,this),qn(e,Gp.REMOVELAYER,this.handleLayerGroupRemove_,this)),this.listenerKeys_[Bn(e)]=t}handleLayerGroupAdd_(e){this.dispatchEvent(new Eu(Gp.ADDLAYER,e.layer))}handleLayerGroupRemove_(e){this.dispatchEvent(new Eu(Gp.REMOVELAYER,e.layer))}handleLayersAdd_(e){let t=e.element;this.registerLayerListeners_(t),this.dispatchEvent(new Eu(Gp.ADDLAYER,t)),this.changed()}handleLayersRemove_(e){let t=e.element,n=Bn(t);this.listenerKeys_[n].forEach(li),delete this.listenerKeys_[n],this.dispatchEvent(new Eu(Gp.REMOVELAYER,t)),this.changed()}getLayers(){return this.get(t6.LAYERS)}setLayers(e){let t=this.getLayers();if(t){let n=t.getArray();for(let r=0,s=n.length;r<s;++r)this.dispatchEvent(new Eu(Gp.REMOVELAYER,n[r]))}this.set(t6.LAYERS,e)}getLayersArray(e){return e=e!==void 0?e:[],this.getLayers().forEach(function(t){t.getLayersArray(e)}),e}getLayerStatesArray(e){let t=e!==void 0?e:[],n=t.length;this.getLayers().forEach(function(o){o.getLayerStatesArray(t)});let r=this.getLayerState(),s=r.zIndex;!e&&r.zIndex===void 0&&(s=0);for(let o=n,a=t.length;o<a;o++){let l=t[o];l.opacity*=r.opacity,l.visible=l.visible&&r.visible,l.maxResolution=Math.min(l.maxResolution,r.maxResolution),l.minResolution=Math.max(l.minResolution,r.minResolution),l.minZoom=Math.max(l.minZoom,r.minZoom),l.maxZoom=Math.min(l.maxZoom,r.maxZoom),r.extent!==void 0&&(l.extent!==void 0?l.extent=dh(l.extent,r.extent):l.extent=r.extent),l.zIndex===void 0&&(l.zIndex=s)}return t}getSourceState(){return"ready"}},a2=n6;var Bo={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"};var i6=class extends s3{constructor(e){let t=Object.assign({},e);delete t.source,super(t),this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.sourceReady_=!1,this.rendered=!1,e.render&&(this.render=e.render),e.map&&this.setMap(e.map),this.addChangeListener(Ni.SOURCE,this.handleSourcePropertyChange_);let n=e.source?e.source:null;this.setSource(n)}getLayersArray(e){return e=e||[],e.push(this),e}getLayerStatesArray(e){return e=e||[],e.push(this.getLayerState()),e}getSource(){return this.get(Ni.SOURCE)||null}getRenderSource(){return this.getSource()}getSourceState(){let e=this.getSource();return e?e.getState():"undefined"}handleSourceChange_(){this.changed(),!(this.sourceReady_||this.getSource().getState()!=="ready")&&(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(li(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;let e=this.getSource();e&&(this.sourceChangeKey_=qn(e,nn.CHANGE,this.handleSourceChange_,this),e.getState()==="ready"&&(this.sourceReady_=!0,setTimeout(()=>{this.dispatchEvent("sourceready")},0))),this.changed()}getFeatures(e){return this.renderer_?this.renderer_.getFeatures(e):Promise.resolve([])}getData(e){return!this.renderer_||!this.rendered?null:this.renderer_.getData(e)}isVisible(e){let t,n=this.getMapInternal();!e&&n&&(e=n.getView()),e instanceof Xl?t={viewState:e.getState(),extent:e.calculateExtent()}:t=e,!t.layerStatesArray&&n&&(t.layerStatesArray=n.getLayerGroup().getLayerStatesArray());let r;if(t.layerStatesArray){if(r=t.layerStatesArray.find(o=>o.layer===this),!r)return!1}else r=this.getLayerState();let s=this.getExtent();return l2(r,t.viewState)&&(!s||Ar(s,t.extent))}getAttributions(e){if(!this.isVisible(e))return[];let t=this.getSource()?.getAttributions();if(!t)return[];let n=e instanceof Xl?e.getViewStateAndExtent():e,r=t(n);return Array.isArray(r)||(r=[r]),r}render(e,t){let n=this.getRenderer();return n.prepareFrame(e)?(this.rendered=!0,n.renderFrame(e,t)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(e,t){}renderDeferred(e){let t=this.getRenderer();t&&t.renderDeferred(e)}setMapInternal(e){e||this.unrender(),this.set(Ni.MAP,e)}getMapInternal(){return this.get(Ni.MAP)}setMap(e){this.mapPrecomposeKey_&&(li(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),e||this.changed(),this.mapRenderKey_&&(li(this.mapRenderKey_),this.mapRenderKey_=null),e&&(this.mapPrecomposeKey_=qn(e,Bo.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=qn(this,nn.CHANGE,e.render,e),this.changed())}handlePrecompose_(e){let t=e.frameState.layerStatesArray,n=this.getLayerState(!1);jn(!t.some(r=>r.layer===n.layer),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),t.push(n)}setSource(e){this.set(Ni.SOURCE,e)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}clearRenderer(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_)}disposeInternal(){this.clearRenderer(),this.setSource(null),super.disposeInternal()}};function l2(i,e){if(!i.visible)return!1;let t=e.resolution;if(t<i.minResolution||t>=i.maxResolution)return!1;let n=e.zoom;return n>i.minZoom&&n<=i.maxZoom}var TA=i6;function o3(i,e,t=0,n=i.length-1,r=b0e){for(;n>t;){if(n-t>600){let l=n-t+1,c=e-t+1,u=Math.log(l),f=.5*Math.exp(2*u/3),d=.5*Math.sqrt(u*f*(l-f)/l)*(c-l/2<0?-1:1),A=Math.max(t,Math.floor(e-c*f/l+d)),y=Math.min(n,Math.floor(e+(l-c)*f/l+d));o3(i,e,A,y,r)}let s=i[e],o=t,a=n;for(c2(i,t,e),r(i[n],s)>0&&c2(i,t,n);o<a;){for(c2(i,o,a),o++,a--;r(i[o],s)<0;)o++;for(;r(i[a],s)>0;)a--}r(i[t],s)===0?c2(i,t,a):(a++,c2(i,a,n)),a<=e&&(t=a+1),e<=a&&(n=a-1)}}function c2(i,e,t){let n=i[e];i[e]=i[t],i[t]=n}function b0e(i,e){return i<e?-1:i>e?1:0}var EA=class{constructor(e=9){this._maxEntries=Math.max(4,e),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(e){let t=this.data,n=[];if(!l3(e,t))return n;let r=this.toBBox,s=[];for(;t;){for(let o=0;o<t.children.length;o++){let a=t.children[o],l=t.leaf?r(a):a;l3(e,l)&&(t.leaf?n.push(a):s6(e,l)?this._all(a,n):s.push(a))}t=s.pop()}return n}collides(e){let t=this.data;if(!l3(e,t))return!1;let n=[];for(;t;){for(let r=0;r<t.children.length;r++){let s=t.children[r],o=t.leaf?this.toBBox(s):s;if(l3(e,o)){if(t.leaf||s6(e,o))return!0;n.push(s)}}t=n.pop()}return!1}load(e){if(!(e&&e.length))return this;if(e.length<this._minEntries){for(let n=0;n<e.length;n++)this.insert(e[n]);return this}let t=this._build(e.slice(),0,e.length-1,0);if(!this.data.children.length)this.data=t;else if(this.data.height===t.height)this._splitRoot(this.data,t);else{if(this.data.height<t.height){let n=this.data;this.data=t,t=n}this._insert(t,this.data.height-t.height-1,!0)}return this}insert(e){return e&&this._insert(e,this.data.height-1),this}clear(){return this.data=Tv([]),this}remove(e,t){if(!e)return this;let n=this.data,r=this.toBBox(e),s=[],o=[],a,l,c;for(;n||s.length;){if(n||(n=s.pop(),l=s[s.length-1],a=o.pop(),c=!0),n.leaf){let u=w0e(e,n.children,t);if(u!==-1)return n.children.splice(u,1),s.push(n),this._condense(s),this}!c&&!n.leaf&&s6(n,r)?(s.push(n),o.push(a),a=0,l=n,n=n.children[0]):l?(a++,n=l.children[a],c=!1):n=null}return this}toBBox(e){return e}compareMinX(e,t){return e.minX-t.minX}compareMinY(e,t){return e.minY-t.minY}toJSON(){return this.data}fromJSON(e){return this.data=e,this}_all(e,t){let n=[];for(;e;)e.leaf?t.push(...e.children):n.push(...e.children),e=n.pop();return t}_build(e,t,n,r){let s=n-t+1,o=this._maxEntries,a;if(s<=o)return a=Tv(e.slice(t,n+1)),Sv(a,this.toBBox),a;r||(r=Math.ceil(Math.log(s)/Math.log(o)),o=Math.ceil(s/Math.pow(o,r-1))),a=Tv([]),a.leaf=!1,a.height=r;let l=Math.ceil(s/o),c=l*Math.ceil(Math.sqrt(o));O$(e,t,n,c,this.compareMinX);for(let u=t;u<=n;u+=c){let f=Math.min(u+c-1,n);O$(e,u,f,l,this.compareMinY);for(let d=u;d<=f;d+=l){let A=Math.min(d+l-1,f);a.children.push(this._build(e,d,A,r-1))}}return Sv(a,this.toBBox),a}_chooseSubtree(e,t,n,r){for(;r.push(t),!(t.leaf||r.length-1===n);){let s=1/0,o=1/0,a;for(let l=0;l<t.children.length;l++){let c=t.children[l],u=r6(c),f=E0e(e,c)-u;f<o?(o=f,s=u<s?u:s,a=c):f===o&&u<s&&(s=u,a=c)}t=a||t.children[0]}return t}_insert(e,t,n){let r=n?e:this.toBBox(e),s=[],o=this._chooseSubtree(r,this.data,t,s);for(o.children.push(e),h2(o,r);t>=0&&s[t].children.length>this._maxEntries;)this._split(s,t),t--;this._adjustParentBBoxes(r,s,t)}_split(e,t){let n=e[t],r=n.children.length,s=this._minEntries;this._chooseSplitAxis(n,s,r);let o=this._chooseSplitIndex(n,s,r),a=Tv(n.children.splice(o,n.children.length-o));a.height=n.height,a.leaf=n.leaf,Sv(n,this.toBBox),Sv(a,this.toBBox),t?e[t-1].children.push(a):this._splitRoot(n,a)}_splitRoot(e,t){this.data=Tv([e,t]),this.data.height=e.height+1,this.data.leaf=!1,Sv(this.data,this.toBBox)}_chooseSplitIndex(e,t,n){let r,s=1/0,o=1/0;for(let a=t;a<=n-t;a++){let l=u2(e,0,a,this.toBBox),c=u2(e,a,n,this.toBBox),u=M0e(l,c),f=r6(l)+r6(c);u<s?(s=u,r=a,o=f<o?f:o):u===s&&f<o&&(o=f,r=a)}return r||n-t}_chooseSplitAxis(e,t,n){let r=e.leaf?this.compareMinX:S0e,s=e.leaf?this.compareMinY:T0e,o=this._allDistMargin(e,t,n,r),a=this._allDistMargin(e,t,n,s);o<a&&e.children.sort(r)}_allDistMargin(e,t,n,r){e.children.sort(r);let s=this.toBBox,o=u2(e,0,t,s),a=u2(e,n-t,n,s),l=a3(o)+a3(a);for(let c=t;c<n-t;c++){let u=e.children[c];h2(o,e.leaf?s(u):u),l+=a3(o)}for(let c=n-t-1;c>=t;c--){let u=e.children[c];h2(a,e.leaf?s(u):u),l+=a3(a)}return l}_adjustParentBBoxes(e,t,n){for(let r=n;r>=0;r--)h2(t[r],e)}_condense(e){for(let t=e.length-1,n;t>=0;t--)e[t].children.length===0?t>0?(n=e[t-1].children,n.splice(n.indexOf(e[t]),1)):this.clear():Sv(e[t],this.toBBox)}};function w0e(i,e,t){if(!t)return e.indexOf(i);for(let n=0;n<e.length;n++)if(t(i,e[n]))return n;return-1}function Sv(i,e){u2(i,0,i.children.length,e,i)}function u2(i,e,t,n,r){r||(r=Tv(null)),r.minX=1/0,r.minY=1/0,r.maxX=-1/0,r.maxY=-1/0;for(let s=e;s<t;s++){let o=i.children[s];h2(r,i.leaf?n(o):o)}return r}function h2(i,e){return i.minX=Math.min(i.minX,e.minX),i.minY=Math.min(i.minY,e.minY),i.maxX=Math.max(i.maxX,e.maxX),i.maxY=Math.max(i.maxY,e.maxY),i}function S0e(i,e){return i.minX-e.minX}function T0e(i,e){return i.minY-e.minY}function r6(i){return(i.maxX-i.minX)*(i.maxY-i.minY)}function a3(i){return i.maxX-i.minX+(i.maxY-i.minY)}function E0e(i,e){return(Math.max(e.maxX,i.maxX)-Math.min(e.minX,i.minX))*(Math.max(e.maxY,i.maxY)-Math.min(e.minY,i.minY))}function M0e(i,e){let t=Math.max(i.minX,e.minX),n=Math.max(i.minY,e.minY),r=Math.min(i.maxX,e.maxX),s=Math.min(i.maxY,e.maxY);return Math.max(0,r-t)*Math.max(0,s-n)}function s6(i,e){return i.minX<=e.minX&&i.minY<=e.minY&&e.maxX<=i.maxX&&e.maxY<=i.maxY}function l3(i,e){return e.minX<=i.maxX&&e.minY<=i.maxY&&e.maxX>=i.minX&&e.maxY>=i.minY}function Tv(i){return{children:i,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function O$(i,e,t,n,r){let s=[e,t];for(;s.length;){if(t=s.pop(),e=s.pop(),t-e<=n)continue;let o=e+Math.ceil((t-e)/n/2)*n;o3(i,o,e,t,r),s.push(e,o,o,t)}}var CA=0,u3=0,ia=1<<CA++,ci=1<<CA++,ra=1<<CA++,La=1<<CA++,hd=1<<CA++,MA=1<<CA++,h3=Math.pow(2,CA)-1,a6={[ia]:"boolean",[ci]:"number",[ra]:"string",[La]:"color",[hd]:"number[]",[MA]:"size"},C0e=Object.keys(a6).map(Number).sort(pl);function R0e(i){return i in a6}function ud(i){let e=[];for(let t of C0e)f2(i,t)&&e.push(a6[t]);return e.length===0?"untyped":e.length<3?e.join(" or "):e.slice(0,-1).join(", ")+", or "+e[e.length-1]}function f2(i,e){return(i&e)===e}function c3(i,e){return!!(i&e)}function qp(i,e){return i===e}var Xr=class{constructor(e,t){if(!R0e(e))throw new Error(`literal expressions must have a specific type, got ${ud(e)}`);this.type=e,this.value=t}},f3=class{constructor(e,t,...n){this.type=e,this.operator=t,this.args=n}};function d3(i){return{variables:new Map,properties:new Map,featureId:!1,geometryType:!1,mCoordinate:!1,mapState:!1,inputVariables:i}}function hs(i,e,t){switch(typeof i){case"boolean":{if(qp(e,ra))return new Xr(ra,i?"true":"false");if(!f2(e,ia))throw new Error(`got a boolean, but expected ${ud(e)}`);return new Xr(ia,i)}case"number":{if(qp(e,MA))return new Xr(MA,ls(i));if(qp(e,ia))return new Xr(ia,!!i);if(qp(e,ra))return new Xr(ra,i.toString());if(!f2(e,ci))throw new Error(`got a number, but expected ${ud(e)}`);return new Xr(ci,i)}case"string":{if(qp(e,La))return new Xr(La,Yy(i));if(qp(e,ia))return new Xr(ia,!!i);if(!f2(e,ra))throw new Error(`got a string, but expected ${ud(e)}`);return new Xr(ra,i)}default:}if(!Array.isArray(i))throw new Error("expression must be an array or a primitive value");if(i.length===0)throw new Error("empty expression");if(typeof i[0]=="string")return V0e(i,e,t);for(let n of i)if(typeof n!="number")throw new Error("expected an array of numbers");if(qp(e,MA)){if(i.length!==2)throw new Error(`expected an array of two values for a size, got ${i.length}`);return new Xr(MA,i)}if(qp(e,La)){if(i.length===3)return new Xr(La,[...i,1]);if(i.length===4)return new Xr(La,i);throw new Error(`expected an array of 3 or 4 values for a color, got ${i.length}`)}if(!f2(e,hd))throw new Error(`got an array of numbers, but expected ${ud(e)}`);return new Xr(hd,i)}var et={Get:"get",Var:"var",Concat:"concat",GeometryType:"geometry-type",LineMetric:"line-metric",Any:"any",All:"all",Not:"!",Resolution:"resolution",Zoom:"zoom",Time:"time",Equal:"==",NotEqual:"!=",GreaterThan:">",GreaterThanOrEqualTo:">=",LessThan:"<",LessThanOrEqualTo:"<=",Multiply:"*",Divide:"/",Add:"+",Subtract:"-",Clamp:"clamp",Mod:"%",Pow:"^",Abs:"abs",Floor:"floor",Ceil:"ceil",Round:"round",Sin:"sin",Cos:"cos",Atan:"atan",Sqrt:"sqrt",Match:"match",Between:"between",Interpolate:"interpolate",Coalesce:"coalesce",Case:"case",In:"in",Number:"number",String:"string",Array:"array",Color:"color",Id:"id",Band:"band",Palette:"palette",ToString:"to-string",Has:"has"},I0e={[et.Get]:Un(ti(1,1/0),U$),[et.Var]:P0e(),[et.Has]:Un(ti(1,1/0),U$),[et.Id]:Un(L0e,Ev),[et.Concat]:Un(ti(2,1/0),Qi(ra)),[et.GeometryType]:Un(D0e,Ev),[et.LineMetric]:Un(N0e,Ev),[et.Resolution]:Un(o6,Ev),[et.Zoom]:Un(o6,Ev),[et.Time]:Un(o6,Ev),[et.Any]:Un(ti(2,1/0),Qi(ia)),[et.All]:Un(ti(2,1/0),Qi(ia)),[et.Not]:Un(ti(1,1),Qi(ia)),[et.Equal]:Un(ti(2,2),z$()),[et.NotEqual]:Un(ti(2,2),z$()),[et.GreaterThan]:Un(ti(2,2),Qi(ci)),[et.GreaterThanOrEqualTo]:Un(ti(2,2),Qi(ci)),[et.LessThan]:Un(ti(2,2),Qi(ci)),[et.LessThanOrEqualTo]:Un(ti(2,2),Qi(ci)),[et.Multiply]:Un(ti(2,1/0),k$),[et.Coalesce]:Un(ti(2,1/0),k$),[et.Divide]:Un(ti(2,2),Qi(ci)),[et.Add]:Un(ti(2,1/0),Qi(ci)),[et.Subtract]:Un(ti(2,2),Qi(ci)),[et.Clamp]:Un(ti(3,3),Qi(ci)),[et.Mod]:Un(ti(2,2),Qi(ci)),[et.Pow]:Un(ti(2,2),Qi(ci)),[et.Abs]:Un(ti(1,1),Qi(ci)),[et.Floor]:Un(ti(1,1),Qi(ci)),[et.Ceil]:Un(ti(1,1),Qi(ci)),[et.Round]:Un(ti(1,1),Qi(ci)),[et.Sin]:Un(ti(1,1),Qi(ci)),[et.Cos]:Un(ti(1,1),Qi(ci)),[et.Atan]:Un(ti(1,2),Qi(ci)),[et.Sqrt]:Un(ti(1,1),Qi(ci)),[et.Match]:Un(ti(4,1/0),V$,B0e),[et.Between]:Un(ti(3,3),Qi(ci)),[et.Interpolate]:Un(ti(6,1/0),V$,O0e),[et.Case]:Un(ti(3,1/0),F0e,U0e),[et.In]:Un(ti(2,2),k0e),[et.Number]:Un(ti(1,1/0),Qi(h3)),[et.String]:Un(ti(1,1/0),Qi(h3)),[et.Array]:Un(ti(1,1/0),Qi(ci)),[et.Color]:Un(ti(1,4),Qi(ci)),[et.Band]:Un(ti(1,3),Qi(ci)),[et.Palette]:Un(ti(2,2),z0e),[et.ToString]:Un(ti(1,1),Qi(ia|ci|ra|La))};function U$(i,e,t){let n=i.length-1,r=new Array(n);for(let s=0;s<n;++s){let o=i[s+1];switch(typeof o){case"number":{r[s]=new Xr(ci,o);break}case"string":{r[s]=new Xr(ra,o);break}default:throw new Error(`expected a string key or numeric array index for a get operation, got ${o}`)}s===0&&t.properties.set(String(o),e)}return r}function P0e(){return function(i,e,t){let n=i[1];if(typeof n!="string")throw new Error("expected a string argument for var operation");let r=e,s=t.inputVariables?.[n];if(s!==void 0){let o=hs(s,h3,t);if(!(o instanceof Xr))throw new Error(`style variables should only be literal values (no expressions!), variable name: ${n}`);let a=o.type;if(typeof s=="string"&&c3(r,La)&&!c3(r,ra)?a=La:Array.isArray(s)&&s.length===2&&c3(r,MA)&&!c3(r,hd)&&(a=MA),r&=a,r===u3)throw new Error(`the type expected from the var operator (${ud(e)}) did not have any overlap with the type of the corresponding style variables (${ud(a)}), variable name: ${n}`)}if(t.variables.has(n)){let o=t.variables.get(n);if(r&=o,r===u3)throw new Error(`a new type expected from the var operator (${ud(e)}) did not have any overlap with the previous type expected for it (${ud(o)}), variable name: ${n}`)}return t.variables.set(n,r),new f3(r,"var",new Xr(ra,n))}}function L0e(i,e,t){t.featureId=!0}function D0e(i,e,t){t.geometryType=!0}function N0e(i,e,t){t.mCoordinate=!0}function o6(i,e,t){t.mapState=!0}function Ev(i,e,t){let n=i[0];if(i.length!==1)throw new Error(`expected no arguments for ${n} operation`);return[]}function ti(i,e){return function(t,n,r){let s=t[0],o=t.length-1;if(i===e){if(o!==i){let a=i===1?"":"s";throw new Error(`expected ${i} argument${a} for ${s}, got ${o}`)}}else if(o<i||o>e){let a=e===1/0?`${i} or more`:`${i} to ${e}`;throw new Error(`expected ${a} arguments for ${s}, got ${o}`)}}}function k$(i,e,t){let n=i.length-1,r=new Array(n);for(let s=0;s<n;++s){let o=hs(i[s+1],e,t);r[s]=o}return r}function Qi(i){return function(e,t,n){let r=e.length-1,s=new Array(r);for(let o=0;o<r;++o){let a=hs(e[o+1],i,n);s[o]=a}return s}}function z$(){return function(i,e,t){let n=i[0],r=i.length-1,s=new Array(r),o=h3;for(let a=0;a<r;++a){let l=hs(i[a+1],o,t);o&=l.type}if(o===u3)throw new Error(`no common type was found among the arguments of ${n}`);for(let a=0;a<r;++a){let l=hs(i[a+1],o,t);s[a]=l}return s}}function F0e(i,e,t){let n=i[0],r=i.length-1;if(r%2===0)throw new Error(`expected an odd number of arguments for ${n}, got ${r} instead`)}function V$(i,e,t){let n=i[0],r=i.length-1;if(r%2===1)throw new Error(`expected an even number of arguments for operation ${n}, got ${r} instead`)}function B0e(i,e,t){let n=i.length-1,r=hs(i[i.length-1],e,t),s=ra|ci|ia,o=new Array(n-2);for(let l=0;l<n-2;l+=2){try{let c=hs(i[l+2],s,t);s&=c.type}catch(c){throw new Error(`failed to parse argument ${l+1} of match expression: ${c.message}`)}if(s===u3)throw new Error("no common type was found among the arguments of match expression")}for(let l=0;l<n-2;l+=2){try{let c=hs(i[l+2],s,t);o[l]=c}catch(c){throw new Error(`failed to parse argument ${l+1} of match expression: ${c.message}`)}try{let c=hs(i[l+3],r.type,t);o[l+1]=c}catch(c){throw new Error(`failed to parse argument ${l+2} of match expression: ${c.message}`)}}return[hs(i[1],s,t),...o,r]}function O0e(i,e,t){let n=i[1],r;switch(n[0]){case"linear":r=1;break;case"exponential":let l=n[1];if(typeof l!="number"||l<=0)throw new Error(`expected a number base for exponential interpolation, got ${JSON.stringify(l)} instead`);r=l;break;default:throw new Error(`invalid interpolation type: ${JSON.stringify(n)}`)}let s=new Xr(ci,r),o;try{o=hs(i[2],ci,t)}catch(l){throw new Error(`failed to parse argument 1 in interpolate expression: ${l.message}`)}let a=new Array(i.length-3);for(let l=0;l<a.length;l+=2){try{let c=hs(i[l+3],ci,t);a[l]=c}catch(c){throw new Error(`failed to parse argument ${l+2} for interpolate expression: ${c.message}`)}try{let c=hs(i[l+4],e,t);a[l+1]=c}catch(c){throw new Error(`failed to parse argument ${l+3} for interpolate expression: ${c.message}`)}}return[s,o,...a]}function U0e(i,e,t){let n=hs(i[i.length-1],e,t),r=new Array(i.length-1);for(let s=0;s<r.length-1;s+=2){try{let o=hs(i[s+1],ia,t);r[s]=o}catch(o){throw new Error(`failed to parse argument ${s} of case expression: ${o.message}`)}try{let o=hs(i[s+2],n.type,t);r[s+1]=o}catch(o){throw new Error(`failed to parse argument ${s+1} of case expression: ${o.message}`)}}return r[r.length-1]=n,r}function k0e(i,e,t){let n=i[2];if(!Array.isArray(n))throw new Error('the second argument for the "in" operator must be an array');let r;if(n[0]==="literal"){if(n=n[1],!Array.isArray(n))throw new Error('failed to parse "in" expression: the literal operator must be followed by an array')}else if(typeof n[0]=="string")throw new Error('for the "in" operator, a string array should be wrapped in a "literal" operator to disambiguate from expressions');typeof n[0]=="string"?r=ra:r=ci;let s=new Array(n.length);for(let a=0;a<s.length;a++)try{let l=hs(n[a],r,t);s[a]=l}catch(l){throw new Error(`failed to parse haystack item ${a} for "in" expression: ${l.message}`)}return[hs(i[1],r,t),...s]}function z0e(i,e,t){let n;try{n=hs(i[1],ci,t)}catch(o){throw new Error(`failed to parse first argument in palette expression: ${o.message}`)}let r=i[2];if(!Array.isArray(r))throw new Error("the second argument of palette must be an array");let s=new Array(r.length);for(let o=0;o<s.length;o++){let a;try{a=hs(r[o],La,t)}catch(l){throw new Error(`failed to parse color at index ${o} in palette expression: ${l.message}`)}if(!(a instanceof Xr))throw new Error(`the palette color at index ${o} must be a literal value`);s[o]=a}return[n,...s]}function Un(...i){return function(e,t,n){let r=e[0],s;for(let o=0;o<i.length;o++){let a=i[o](e,t,n);if(o==i.length-1){if(!a)throw new Error("expected last argument validator to return the parsed args");s=a}}return new f3(t,r,...s)}}function V0e(i,e,t){let n=i[0],r=I0e[n];if(!r)throw new Error(`unknown operator: ${n}`);return r(i,e,t)}function p3(i){if(!i)return"";let e=i.getType();switch(e){case"Point":case"LineString":case"Polygon":return e;case"MultiPoint":case"MultiLineString":case"MultiPolygon":return e.substring(5);case"Circle":return"Polygon";case"GeometryCollection":return p3(i.getGeometries()[0]);default:return""}}function l6(){return{variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""}}function Cu(i,e,t){let n=hs(i,e,t);return Mu(n,t)}function Mu(i,e){if(i instanceof Xr){if(i.type===La&&typeof i.value=="string"){let n=Yy(i.value);return function(){return n}}return function(){return i.value}}let t=i.operator;switch(t){case et.Number:case et.String:case et.Coalesce:return G0e(i,e);case et.Get:case et.Var:case et.Has:return q0e(i,e);case et.Id:return n=>n.featureId;case et.GeometryType:return n=>n.geometryType;case et.Concat:{let n=i.args.map(r=>Mu(r,e));return r=>"".concat(...n.map(s=>s(r).toString()))}case et.Resolution:return n=>n.resolution;case et.Any:case et.All:case et.Between:case et.In:case et.Not:return W0e(i,e);case et.Equal:case et.NotEqual:case et.LessThan:case et.LessThanOrEqualTo:case et.GreaterThan:case et.GreaterThanOrEqualTo:return H0e(i,e);case et.Multiply:case et.Divide:case et.Add:case et.Subtract:case et.Clamp:case et.Mod:case et.Pow:case et.Abs:case et.Floor:case et.Ceil:case et.Round:case et.Sin:case et.Cos:case et.Atan:case et.Sqrt:return j0e(i,e);case et.Case:return X0e(i,e);case et.Match:return $0e(i,e);case et.Interpolate:return Y0e(i,e);case et.ToString:return Z0e(i,e);default:throw new Error(`Unsupported operator ${t}`)}}function G0e(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Mu(i.args[s],e);switch(t){case et.Coalesce:return s=>{for(let o=0;o<n;++o){let a=r[o](s);if(typeof a<"u"&&a!==null)return a}throw new Error("Expected one of the values to be non-null")};case et.Number:case et.String:return s=>{for(let o=0;o<n;++o){let a=r[o](s);if(typeof a===t)return a}throw new Error(`Expected one of the values to be a ${t}`)};default:throw new Error(`Unsupported assertion operator ${t}`)}}function q0e(i,e){let n=i.args[0].value;switch(i.operator){case et.Get:return r=>{let s=i.args,o=r.properties[n];for(let a=1,l=s.length;a<l;++a){let u=s[a].value;o=o[u]}return o};case et.Var:return r=>r.variables[n];case et.Has:return r=>{let s=i.args;if(!(n in r.properties))return!1;let o=r.properties[n];for(let a=1,l=s.length;a<l;++a){let u=s[a].value;if(!o||!Object.hasOwn(o,u))return!1;o=o[u]}return!0};default:throw new Error(`Unsupported accessor operator ${i.operator}`)}}function H0e(i,e){let t=i.operator,n=Mu(i.args[0],e),r=Mu(i.args[1],e);switch(t){case et.Equal:return s=>n(s)===r(s);case et.NotEqual:return s=>n(s)!==r(s);case et.LessThan:return s=>n(s)<r(s);case et.LessThanOrEqualTo:return s=>n(s)<=r(s);case et.GreaterThan:return s=>n(s)>r(s);case et.GreaterThanOrEqualTo:return s=>n(s)>=r(s);default:throw new Error(`Unsupported comparison operator ${t}`)}}function W0e(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Mu(i.args[s],e);switch(t){case et.Any:return s=>{for(let o=0;o<n;++o)if(r[o](s))return!0;return!1};case et.All:return s=>{for(let o=0;o<n;++o)if(!r[o](s))return!1;return!0};case et.Between:return s=>{let o=r[0](s),a=r[1](s),l=r[2](s);return o>=a&&o<=l};case et.In:return s=>{let o=r[0](s);for(let a=1;a<n;++a)if(o===r[a](s))return!0;return!1};case et.Not:return s=>!r[0](s);default:throw new Error(`Unsupported logical operator ${t}`)}}function j0e(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Mu(i.args[s],e);switch(t){case et.Multiply:return s=>{let o=1;for(let a=0;a<n;++a)o*=r[a](s);return o};case et.Divide:return s=>r[0](s)/r[1](s);case et.Add:return s=>{let o=0;for(let a=0;a<n;++a)o+=r[a](s);return o};case et.Subtract:return s=>r[0](s)-r[1](s);case et.Clamp:return s=>{let o=r[0](s),a=r[1](s);if(o<a)return a;let l=r[2](s);return o>l?l:o};case et.Mod:return s=>r[0](s)%r[1](s);case et.Pow:return s=>Math.pow(r[0](s),r[1](s));case et.Abs:return s=>Math.abs(r[0](s));case et.Floor:return s=>Math.floor(r[0](s));case et.Ceil:return s=>Math.ceil(r[0](s));case et.Round:return s=>Math.round(r[0](s));case et.Sin:return s=>Math.sin(r[0](s));case et.Cos:return s=>Math.cos(r[0](s));case et.Atan:return n===2?s=>Math.atan2(r[0](s),r[1](s)):s=>Math.atan(r[0](s));case et.Sqrt:return s=>Math.sqrt(r[0](s));default:throw new Error(`Unsupported numeric operator ${t}`)}}function X0e(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Mu(i.args[r],e);return r=>{for(let s=0;s<t-1;s+=2)if(n[s](r))return n[s+1](r);return n[t-1](r)}}function $0e(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Mu(i.args[r],e);return r=>{let s=n[0](r);for(let o=1;o<t-1;o+=2)if(s===n[o](r))return n[o+1](r);return n[t-1](r)}}function Y0e(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Mu(i.args[r],e);return r=>{let s=n[0](r),o=n[1](r),a,l;for(let c=2;c<t;c+=2){let u=n[c](r),f=n[c+1](r),d=Array.isArray(f);if(d&&(f=hX(f)),u>=o)return c===2?f:d?K0e(s,o,a,l,u,f):d2(s,o,a,l,u,f);a=u,l=f}return l}}function Z0e(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Mu(i.args[s],e);if(t===et.ToString)return s=>{let o=r[0](s);return i.args[0].type===La?Zy(o):o.toString()};throw new Error(`Unsupported convert operator ${t}`)}function d2(i,e,t,n,r,s){let o=r-t;if(o===0)return n;let a=e-t,l=i===1?a/o:(Math.pow(i,a)-1)/(Math.pow(i,o)-1);return n+l*(s-n)}function K0e(i,e,t,n,r,s){if(r-t===0)return n;let a=HN(n),l=HN(s),c=l[2]-a[2];c>180?c-=360:c<-180&&(c+=360);let u=[d2(i,e,t,a[0],r,l[0]),d2(i,e,t,a[1],r,l[1]),a[2]+d2(i,e,t,0,r,c),d2(i,e,t,n[3],r,s[3])];return fX(u)}function Q0e(i){return!0}function J0e(i,e){e=e??d3();let t=eme(i,e),n=l6();return function(r,s){if(n.properties=r.getPropertiesInternal(),n.resolution=s,e.featureId){let o=r.getId();o!==void 0?n.featureId=o:n.featureId=null}return e.geometryType&&(n.geometryType=p3(r.getGeometry())),t(n)}}function G$(i,e){e=e??d3();let t=i.length,n=new Array(t);for(let o=0;o<t;++o)n[o]=c6(i[o],e);let r=l6(),s=new Array(t);return function(o,a){if(r.properties=o.getPropertiesInternal(),r.resolution=a,e.featureId){let c=o.getId();c!==void 0?r.featureId=c:r.featureId=null}e.geometryType&&(r.geometryType=p3(o.getGeometry()));let l=0;for(let c=0;c<t;++c){let u=n[c](r);u&&(s[l]=u,l+=1)}return s.length=l,s}}function j$(i,e){if(e=e??d3(),!Array.isArray(i))return G$([i],e);let t=i.length;if("style"in i[0]){let s=new Array(t);for(let o=0;o<t;++o){let a=i[o];if(!("style"in a))throw new Error("Expected a list of rules with a style property");s[o]=a}return J0e(s,e)}return G$(i,e)}function eme(i,e){let t=i.length,n=new Array(t);for(let r=0;r<t;++r){let s=i[r],o="filter"in s?Cu(s.filter,ia,e):Q0e,a;if(Array.isArray(s.style)){let l=s.style.length;a=new Array(l);for(let c=0;c<l;++c)a[c]=c6(s.style[c],e)}else a=[c6(s.style,e)];n[r]={filter:o,styles:a}}return function(r){let s=[],o=!1;for(let a=0;a<t;++a){let l=n[a].filter;if(l(r)&&!(i[a].else&&o)){o=!0;for(let c of n[a].styles){let u=c(r);u&&s.push(u)}}}return s}}function c6(i,e){let t=p2(i,"",e),n=m2(i,"",e),r=tme(i,e),s=nme(i,e),o=Oo(i,"z-index",e);if(!t&&!n&&!r&&!s&&!vu(i))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(i));let a=new Nr;return function(l){let c=!0;if(t){let u=t(l);u&&(c=!1),a.setFill(u)}if(n){let u=n(l);u&&(c=!1),a.setStroke(u)}if(r){let u=r(l);u&&(c=!1),a.setText(u)}if(s){let u=s(l);u&&(c=!1),a.setImage(u)}return o&&a.setZIndex(o(l)),c?null:a}}function p2(i,e,t){let n;if(e+"fill-pattern-src"in i)n=ome(i,e+"fill-",t);else{if(i[e+"fill-color"]==="none")return s=>null;n=A3(i,e+"fill-color",t)}if(!n)return null;let r=new us;return function(s){let o=n(s);return o===BE?null:(r.setColor(o),r)}}function m2(i,e,t){let n=Oo(i,e+"stroke-width",t),r=A3(i,e+"stroke-color",t);if(!n&&!r)return null;let s=fd(i,e+"stroke-line-cap",t),o=fd(i,e+"stroke-line-join",t),a=X$(i,e+"stroke-line-dash",t),l=Oo(i,e+"stroke-line-dash-offset",t),c=Oo(i,e+"stroke-miter-limit",t),u=Oo(i,e+"stroke-offset",t),f=new Es;return function(d){if(r){let A=r(d);if(A===BE)return null;f.setColor(A)}if(n&&f.setWidth(n(d)),s){let A=s(d);if(A!=="butt"&&A!=="round"&&A!=="square")throw new Error("Expected butt, round, or square line cap");f.setLineCap(A)}if(o){let A=o(d);if(A!=="bevel"&&A!=="round"&&A!=="miter")throw new Error("Expected bevel, round, or miter line join");f.setLineJoin(A)}return a&&f.setLineDash(a(d)),l&&f.setLineDashOffset(l(d)),c&&f.setMiterLimit(c(d)),u&&f.setOffset(u(d)),f}}function tme(i,e){let t="text-",n=fd(i,t+"value",e);if(!n)return null;let r=p2(i,t,e),s=p2(i,t+"background-",e),o=m2(i,t,e),a=m2(i,t+"background-",e),l=fd(i,t+"font",e),c=Oo(i,t+"max-angle",e),u=Oo(i,t+"offset-x",e),f=Oo(i,t+"offset-y",e),d=Mv(i,t+"overflow",e),A=fd(i,t+"placement",e),y=Oo(i,t+"repeat",e),w=g3(i,t+"scale",e),S=Mv(i,t+"rotate-with-view",e),T=Oo(i,t+"rotation",e),R=fd(i,t+"align",e),P=fd(i,t+"justify",e),I=fd(i,t+"baseline",e),F=Mv(i,t+"keep-upright",e),D=X$(i,t+"padding",e),L=v3(i,t+"declutter-mode"),C=new ld({declutterMode:L});return function(B){if(C.setText(n(B)),r&&C.setFill(r(B)),s&&C.setBackgroundFill(s(B)),o&&C.setStroke(o(B)),a&&C.setBackgroundStroke(a(B)),l&&C.setFont(l(B)),c&&C.setMaxAngle(c(B)),u&&C.setOffsetX(u(B)),f&&C.setOffsetY(f(B)),d&&C.setOverflow(d(B)),A){let k=A(B);if(k!=="point"&&k!=="line")throw new Error("Expected point or line for text-placement");C.setPlacement(k)}if(y&&C.setRepeat(y(B)),w&&C.setScale(w(B)),S&&C.setRotateWithView(S(B)),T&&C.setRotation(T(B)),R){let k=R(B);if(k!=="left"&&k!=="center"&&k!=="right"&&k!=="end"&&k!=="start")throw new Error("Expected left, right, center, start, or end for text-align");C.setTextAlign(k)}if(P){let k=P(B);if(k!=="left"&&k!=="right"&&k!=="center")throw new Error("Expected left, right, or center for text-justify");C.setJustify(k)}if(I){let k=I(B);if(k!=="bottom"&&k!=="top"&&k!=="middle"&&k!=="alphabetic"&&k!=="hanging")throw new Error("Expected bottom, top, middle, alphabetic, or hanging for text-baseline");C.setTextBaseline(k)}return D&&C.setPadding(D(B)),F&&C.setKeepUpright(F(B)),C}}function nme(i,e){return"icon-src"in i?ime(i,e):"shape-points"in i?rme(i,e):"circle-radius"in i?sme(i,e):null}function ime(i,e){let t="icon-",n=t+"src",r=$$(i[n],n),s=m3(i,t+"anchor",e),o=g3(i,t+"scale",e),a=Oo(i,t+"opacity",e),l=m3(i,t+"displacement",e),c=Oo(i,t+"rotation",e),u=Mv(i,t+"rotate-with-view",e),f=H$(i,t+"anchor-origin"),d=W$(i,t+"anchor-x-units"),A=W$(i,t+"anchor-y-units"),y=dd(i,t+"color"),w,S=null;y!==void 0&&(Array.isArray(y)&&y.length>0&&typeof y[0]=="string"?S=A3(i,t+"color",e):w=Y$(y,t+"color"));let T=lme(i,t+"cross-origin"),R=cme(i,t+"offset"),P=H$(i,t+"offset-origin"),I=u6(i,t+"width"),F=u6(i,t+"height"),D=ame(i,t+"size"),L=v3(i,t+"declutter-mode"),C={src:r,anchorOrigin:f,anchorXUnits:d,anchorYUnits:A,crossOrigin:T,offset:R,offsetOrigin:P,height:F,width:I,size:D,declutterMode:L},B=null;return function(k){if(B)S&&B.setColor(S(k));else{let z=S?S(k):w;B=new xA(z!==void 0?Object.assign({},C,{color:z}):Object.assign({},C))}return a&&B.setOpacity(a(k)),l&&B.setDisplacement(l(k)),c&&B.setRotation(c(k)),u&&B.setRotateWithView(u(k)),o&&B.setScale(o(k)),s&&B.setAnchor(s(k)),B}}function rme(i,e){let t="shape-",n=t+"points",r=t+"radius",s=h6(i[n],n);if(!(r in i))throw new Error(`Expected a number for ${r}`);let o=Oo(i,r,e),a=typeof i[r]=="number"?i[r]:5,l=t+"radius2",c=Oo(i,l,e),u=typeof i[l]=="number"?i[l]:void 0,f=p2(i,t,e),d=m2(i,t,e),A=g3(i,t+"scale",e),y=m3(i,t+"displacement",e),w=Oo(i,t+"rotation",e),S=Mv(i,t+"rotate-with-view",e),T=u6(i,t+"angle"),R=v3(i,t+"declutter-mode"),P=new GE({points:s,radius:a,radius2:u,angle:T,declutterMode:R});return function(I){return o&&P.setRadius(o(I)),c&&P.setRadius2(c(I)),f&&P.setFill(f(I)),d&&P.setStroke(d(I)),y&&P.setDisplacement(y(I)),w&&P.setRotation(w(I)),S&&P.setRotateWithView(S(I)),A&&P.setScale(A(I)),P}}function sme(i,e){let t="circle-",n=p2(i,t,e),r=m2(i,t,e),s=Oo(i,t+"radius",e),o=g3(i,t+"scale",e),a=m3(i,t+"displacement",e),l=Oo(i,t+"rotation",e),c=Mv(i,t+"rotate-with-view",e),u=v3(i,t+"declutter-mode"),f=new qE({radius:5,declutterMode:u});return function(d){return s&&f.setRadius(s(d)),n&&f.setFill(n(d)),r&&f.setStroke(r(d)),a&&f.setDisplacement(a(d)),l&&f.setRotation(l(d)),c&&f.setRotateWithView(c(d)),o&&f.setScale(o(d)),f}}function dd(i,e){if(!(e in i))return;let t=i[e];return t===void 0?void 0:t}function Oo(i,e,t){let n=dd(i,e);if(n===void 0)return;let r=Cu(n,ci,t);return function(s){return h6(r(s),e)}}function fd(i,e,t){let n=dd(i,e);if(n===void 0)return null;let r=Cu(n,ra,t);return function(s){return $$(r(s),e)}}function ome(i,e,t){let n=fd(i,e+"pattern-src",t),r=q$(i,e+"pattern-offset",t),s=q$(i,e+"pattern-size",t),o=A3(i,e+"color",t);return function(a){return{src:n(a),offset:r&&r(a),size:s&&s(a),color:o&&o(a)}}}function Mv(i,e,t){let n=dd(i,e);if(n===void 0)return null;let r=Cu(n,ia,t);return function(s){let o=r(s);if(typeof o!="boolean")throw new Error(`Expected a boolean for ${e}`);return o}}function A3(i,e,t){let n=dd(i,e);if(n===void 0)return null;let r=Cu(n,La,t);return function(s){return Y$(r(s),e)}}function X$(i,e,t){let n=dd(i,e);if(n===void 0)return null;if(Array.isArray(n)&&(n.length===0||typeof n[0]!="string")){let s=n.map((o,a)=>{if(typeof o=="number")return()=>o;let l=Cu(o,ci,t);return function(c){return h6(l(c),`${e}[${a}]`)}});return function(o){let a=new Array(s.length);for(let l=0;l<s.length;++l)a[l]=s[l](o);return a}}let r=Cu(n,hd,t);return function(s){return A2(r(s),e)}}function m3(i,e,t){let n=dd(i,e);if(n===void 0)return null;let r=Cu(n,hd,t);return function(s){let o=A2(r(s),e);if(o.length!==2)throw new Error(`Expected two numbers for ${e}`);return o}}function q$(i,e,t){let n=dd(i,e);if(n===void 0)return null;let r=Cu(n,hd,t);return function(s){return Z$(r(s),e)}}function g3(i,e,t){let n=dd(i,e);if(n===void 0)return null;let r=Cu(n,hd|ci,t);return function(s){return ume(r(s),e)}}function u6(i,e){let t=i[e];if(t!==void 0){if(typeof t!="number")throw new Error(`Expected a number for ${e}`);return t}}function ame(i,e){let t=i[e];if(t!==void 0){if(typeof t=="number")return ls(t);if(!Array.isArray(t))throw new Error(`Expected a number or size array for ${e}`);if(t.length!==2||typeof t[0]!="number"||typeof t[1]!="number")throw new Error(`Expected a number or size array for ${e}`);return t}}function lme(i,e){let t=i[e];if(t!==void 0){if(typeof t!="string")throw new Error(`Expected a string for ${e}`);return t}}function H$(i,e){let t=i[e];if(t!==void 0){if(t!=="bottom-left"&&t!=="bottom-right"&&t!=="top-left"&&t!=="top-right")throw new Error(`Expected bottom-left, bottom-right, top-left, or top-right for ${e}`);return t}}function W$(i,e){let t=i[e];if(t!==void 0){if(t!=="pixels"&&t!=="fraction")throw new Error(`Expected pixels or fraction for ${e}`);return t}}function cme(i,e){let t=i[e];if(t!==void 0)return A2(t,e)}function v3(i,e){let t=i[e];if(t!==void 0){if(typeof t!="string")throw new Error(`Expected a string for ${e}`);if(t!=="declutter"&&t!=="obstacle"&&t!=="none")throw new Error(`Expected declutter, obstacle, or none for ${e}`);return t}}function A2(i,e){if(!Array.isArray(i))throw new Error(`Expected an array for ${e}`);let t=i.length;for(let n=0;n<t;++n)if(typeof i[n]!="number")throw new Error(`Expected an array of numbers for ${e}`);return i}function $$(i,e){if(typeof i!="string")throw new Error(`Expected a string for ${e}`);return i}function h6(i,e){if(typeof i!="number")throw new Error(`Expected a number for ${e}`);return i}function Y$(i,e){if(typeof i=="string")return i;let t=A2(i,e),n=t.length;if(n<3||n>4)throw new Error(`Expected a color with 3 or 4 values for ${e}`);return t}function Z$(i,e){let t=A2(i,e);if(t.length!==2)throw new Error(`Expected an array of two numbers for ${e}`);return t}function ume(i,e){return typeof i=="number"?i:Z$(i,e)}var K$={RENDER_ORDER:"renderOrder"},f6=class extends TA{constructor(e){e=e||{};let t=Object.assign({},e);delete t.style,delete t.renderBuffer,delete t.updateWhileAnimating,delete t.updateWhileInteracting,super(t),this.declutter_=e.declutter?String(e.declutter):void 0,this.renderBuffer_=e.renderBuffer!==void 0?e.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(e.style),this.updateWhileAnimating_=e.updateWhileAnimating!==void 0?e.updateWhileAnimating:!1,this.updateWhileInteracting_=e.updateWhileInteracting!==void 0?e.updateWhileInteracting:!1}getDeclutter(){return this.declutter_}getFeatures(e){return super.getFeatures(e)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(K$.RENDER_ORDER)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(e,t){let n=this.getDeclutter();n in e.declutter||(e.declutter[n]=new EA(9)),this.getRenderer().renderDeclutter(e,t)}setRenderOrder(e){this.set(K$.RENDER_ORDER,e)}setStyle(e){this.style_=e===void 0?i5:e;let t=hme(e);this.styleFunction_=e===null?void 0:SX(t),this.changed()}setDeclutter(e){this.declutter_=e?String(e):void 0,this.changed()}};function hme(i){if(i===void 0)return i5;if(!i)return null;if(typeof i=="function"||i instanceof Nr)return i;if(Array.isArray(i)&&i.length===0)return[];if(Array.isArray(i)&&i[0]instanceof Nr){let t=i.length,n=new Array(t);for(let r=0;r<t;++r){let s=i[r];if(!(s instanceof Nr))throw new Error("Expected a list of style instances");n[r]=s}return n}return j$(i)}var _3=f6;var d6=class extends Ao{constructor(e,t,n,r){super(e),this.inversePixelTransform=t,this.frameState=n,this.context=r}},x3=d6;var p6=class extends Ip{constructor(e){super(),this.map_=e}dispatchRenderEvent(e,t){ei()}calculateMatrices2D(e){let t=e.viewState,n=e.coordinateToPixelTransform,r=e.pixelToCoordinateTransform;Do(n,e.size[0]/2,e.size[1]/2,1/t.resolution,-1/t.resolution,-t.rotation,-t.center[0],-t.center[1]),AE(r,n)}forEachFeatureAtCoordinate(e,t,n,r,s,o,a,l){let c,u=t.viewState;function f(I,F,D,L){return s.call(o,F,I?D:null,L)}let d=u.projection,A=QT(e.slice(),d),y=[[0,0]];if(d.canWrapX()&&r){let I=d.getExtent(),F=Kn(I);y.push([-F,0],[F,0])}let w=t.layerStatesArray,S=w.length,T=[],R=[];for(let I=0;I<y.length;I++)for(let F=S-1;F>=0;--F){let D=w[F],L=D.layer;if(L.hasRenderer()&&l2(D,u)&&a.call(l,L)){let C=L.getRenderer(),B=L.getSource();if(C&&B){let k=B.getWrapX()?A:e,z=f.bind(null,D.managed);R[0]=k[0]+y[I][0],R[1]=k[1]+y[I][1],c=C.forEachFeatureAtCoordinate(R,t,n,z,T)}if(c)return c}}if(T.length===0)return;let P=1/T.length;return T.forEach((I,F)=>I.distanceSq+=F*P),T.sort((I,F)=>I.distanceSq-F.distanceSq),T.some(I=>c=I.callback(I.feature,I.layer,I.geometry)),c}hasFeatureAtCoordinate(e,t,n,r,s,o){return this.forEachFeatureAtCoordinate(e,t,n,r,ed,this,s,o)!==void 0}getMap(){return this.map_}renderFrame(e){ei()}scheduleExpireIconCache(e){ta.canExpireCache()&&e.postRenderFunctions.push(fme)}};function fme(i,e){ta.expire()}var Q$=p6;var m6=class extends Q${constructor(e){super(e),this.fontChangeListenerKey_=qn(vA,bu.PROPERTYCHANGE,e.redrawText,e),this.element_=io?dE():document.createElement("div");let t=this.element_.style;t.position="absolute",t.width="100%",t.height="100%",t.zIndex="0",this.element_.className=Op+" ol-layers";let n=e.getViewport();n&&n.insertBefore(this.element_,n.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(e,t){let n=this.getMap();if(n.hasListener(e)){let r=new x3(e,void 0,t);n.dispatchEvent(r)}}disposeInternal(){li(this.fontChangeListenerKey_),this.element_.remove(),super.disposeInternal()}renderFrame(e){if(!e){this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1);return}this.calculateMatrices2D(e),this.dispatchRenderEvent(Bo.PRECOMPOSE,e);let t=e.layerStatesArray.sort((u,f)=>u.zIndex-f.zIndex);t.some(u=>u.layer instanceof _3&&u.layer.getDeclutter())&&(e.declutter={});let r=e.viewState;this.children_.length=0;let o=this.getMap().getTargetElement(),a;Hl(o)&&(a=o.getContext("2d"),a.setTransform(1,0,0,1,0,0),a.clearRect(0,0,o.width,o.height));let l=[],c=a?o:null;for(let u=0,f=t.length;u<f;++u){let d=t[u];e.layerIndex=u;let A=d.layer,y=A.getSourceState();if(!l2(d,r)||y!="ready"&&y!="undefined"){A.unrender();continue}let w=A.render(e,c);w&&(w!==c&&(this.children_.push(w),c=w),l.push(d))}this.declutter(e,l),vj(this.element_,this.children_);for(let u of a?this.children_:[]){let f=u.firstElementChild||u,d=u.style.backgroundColor;if(d&&(!Hl(f)||f.width>0)&&(a.fillStyle=d,a.fillRect(0,0,a.canvas.width,a.canvas.height)),!Hl(f)||f.width===0)continue;a.save();let A=u.style.opacity||f.style.opacity;a.globalAlpha=A===""?1:Number(A);let y=f.style.transform;if(y)a.transform(...mE(y));else{let w=parseFloat(f.style.width)/f.width,S=parseFloat(f.style.height)/f.height;a.transform(w,0,0,S,0,0)}a.drawImage(f,0,0),a.restore()}this.dispatchRenderEvent(Bo.POSTCOMPOSE,e),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(e)}declutter(e,t){if(e.declutter){for(let n=t.length-1;n>=0;--n){let r=t[n],s=r.layer;s.getDeclutter()&&s.renderDeclutter(e,r)}t.forEach(n=>n.layer.renderDeferred(e))}}},J$=m6;function eY(i){if(i instanceof TA){i.setMapInternal(null);return}i instanceof a2&&i.getLayers().forEach(eY)}function tY(i,e){if(i instanceof TA){i.setMapInternal(e);return}if(i instanceof a2){let t=i.getLayers().getArray();for(let n=0,r=t.length;n<r;++n)tY(t[n],e)}}var A6=class extends zs{constructor(e){super(),e=e||{},this.on,this.once,this.un;let t=dme(e);this.renderComplete_=!1,this.loaded_=!0,this.boundHandleBrowserEvent_=this.handleBrowserEvent.bind(this),this.maxTilesLoading_=e.maxTilesLoading!==void 0?e.maxTilesLoading:16,this.pixelRatio_=e.pixelRatio!==void 0?e.pixelRatio:fj,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=go(),this.pixelToCoordinateTransform_=go(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,io||(this.viewport_=document.createElement("div"),this.viewport_.className="ol-viewport"+("ontouchstart"in window?" ol-touch":""),this.viewport_.style.position="relative",this.viewport_.style.overflow="hidden",this.viewport_.style.width="100%",this.viewport_.style.height="100%",this.overlayContainer_=document.createElement("div"),this.overlayContainer_.style.position="absolute",this.overlayContainer_.style.zIndex="0",this.overlayContainer_.style.width="100%",this.overlayContainer_.style.height="100%",this.overlayContainer_.style.pointerEvents="none",this.overlayContainer_.className="ol-overlaycontainer",this.viewport_.appendChild(this.overlayContainer_),this.overlayContainerStopEvent_=document.createElement("div"),this.overlayContainerStopEvent_.style.position="absolute",this.overlayContainerStopEvent_.style.zIndex="0",this.overlayContainerStopEvent_.style.width="100%",this.overlayContainerStopEvent_.style.height="100%",this.overlayContainerStopEvent_.style.pointerEvents="none",this.overlayContainerStopEvent_.className="ol-overlaycontainer-stopevent",this.viewport_.appendChild(this.overlayContainerStopEvent_)),this.mapBrowserEventHandler_=null,this.moveTolerance_=e.moveTolerance,this.keyboardEventTarget_=t.keyboardEventTarget,this.targetChangeHandlerKeys_=null,this.targetElement_=null,io||(this.resizeObserver_=new ResizeObserver(()=>this.updateSize())),this.controls=t.controls||(io?new No:QE()),this.interactions=t.interactions||(io?new No:r3({onFocusOnly:!0})),this.overlays_=t.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new c$(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(Fo.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(Fo.VIEW,this.handleViewChanged_),this.addChangeListener(Fo.SIZE,this.handleSizeChanged_),this.addChangeListener(Fo.TARGET,this.handleTargetChanged_),this.setProperties(t.values);let n=this;e.view&&!(e.view instanceof Xl)&&e.view.then(function(r){n.setView(new Xl(r))}),this.controls.addEventListener(vo.ADD,r=>{r.element.setMap(this)}),this.controls.addEventListener(vo.REMOVE,r=>{r.element.setMap(null)}),this.interactions.addEventListener(vo.ADD,r=>{r.element.setMap(this)}),this.interactions.addEventListener(vo.REMOVE,r=>{r.element.setMap(null)}),this.overlays_.addEventListener(vo.ADD,r=>{this.addOverlayInternal_(r.element)}),this.overlays_.addEventListener(vo.REMOVE,r=>{let s=r.element.getId();s!==void 0&&delete this.overlayIdIndex_[s.toString()],r.element.setMap(null)}),this.controls.forEach(r=>{r.setMap(this)}),this.interactions.forEach(r=>{r.setMap(this)}),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(e){this.getControls().push(e)}addInteraction(e){this.getInteractions().push(e)}addLayer(e){this.getLayerGroup().getLayers().push(e)}handleLayerAdd_(e){tY(e.layer,this)}addOverlay(e){this.getOverlays().push(e)}addOverlayInternal_(e){let t=e.getId();t!==void 0&&(this.overlayIdIndex_[t.toString()]=e),e.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_?.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(e,t,n){if(!this.frameState_||!this.renderer_)return;let r=this.getCoordinateFromPixelInternal(e);n=n!==void 0?n:{};let s=n.hitTolerance!==void 0?n.hitTolerance:0,o=n.layerFilter!==void 0?n.layerFilter:ed,a=n.checkWrapped!==!1;return this.renderer_.forEachFeatureAtCoordinate(r,this.frameState_,s,a,t,null,o,null)}getFeaturesAtPixel(e,t){let n=[];return this.forEachFeatureAtPixel(e,function(r){n.push(r)},t),n}getAllLayers(){let e=[];function t(n){n.forEach(function(r){r instanceof a2?t(r.getLayers()):e.push(r)})}return t(this.getLayers()),e}hasFeatureAtPixel(e,t){if(!this.frameState_||!this.renderer_)return!1;let n=this.getCoordinateFromPixelInternal(e);t=t!==void 0?t:{};let r=t.layerFilter!==void 0?t.layerFilter:ed,s=t.hitTolerance!==void 0?t.hitTolerance:0,o=t.checkWrapped!==!1;return this.renderer_.hasFeatureAtCoordinate(n,this.frameState_,s,o,r,null)}getEventCoordinate(e){return this.getCoordinateFromPixel(this.getEventPixel(e))}getEventCoordinateInternal(e){return this.getCoordinateFromPixelInternal(this.getEventPixel(e))}getEventPixel(e){let n=this.viewport_.getBoundingClientRect(),r=this.getSize(),s=n.width/r[0],o=n.height/r[1],a="changedTouches"in e?e.changedTouches[0]:e;return[(a.clientX-n.left)/s,(a.clientY-n.top)/o]}getTarget(){return this.get(Fo.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(e){return Iy(this.getCoordinateFromPixelInternal(e),this.getView().getProjection())}getCoordinateFromPixelInternal(e){let t=this.frameState_;return t?jr(t.pixelToCoordinateTransform,e.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(e){let t=this.overlayIdIndex_[e.toString()];return t!==void 0?t:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(Fo.LAYERGROUP)}setLayers(e){let t=this.getLayerGroup();if(e instanceof No){t.setLayers(e);return}let n=t.getLayers();n.clear(),n.extend(e)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){let e=this.getLayerGroup().getLayerStatesArray();for(let t=0,n=e.length;t<n;++t){let r=e[t];if(!r.visible)continue;let s=r.layer.getRenderer();if(s&&!s.ready)return!0;let o=r.layer.getSource();if(o&&o.loading)return!0}return!1}getPixelFromCoordinate(e){let t=xu(e,this.getView().getProjection());return this.getPixelFromCoordinateInternal(t)}getPixelFromCoordinateInternal(e){let t=this.frameState_;return t?jr(t.coordinateToPixelTransform,e.slice(0,2)):null}getPixelRatio(){return this.pixelRatio_}setPixelRatio(e){this.pixelRatio_!==e&&(this.pixelRatio_=e,this.render())}getRenderer(){return this.renderer_}getSize(){return this.get(Fo.SIZE)}getView(){return this.get(Fo.VIEW)}getViewport(){return this.viewport_}getOverlayContainer(){return this.overlayContainer_}getOverlayContainerStopEvent(){return this.overlayContainerStopEvent_}getOwnerDocument(){let e=this.getTargetElement();return e?e.ownerDocument:document}getTilePriority(e,t,n,r){return u$(this.frameState_,e,t,n,r)}handleBrowserEvent(e,t){t=t||e.type;let n=new bh(t,this,e);this.handleMapBrowserEvent(n)}handleMapBrowserEvent(e){if(!this.frameState_)return;let t=e.originalEvent,n=t.type;if(n===r2.POINTERDOWN||n===nn.WHEEL||n===nn.KEYDOWN){let r=this.getOwnerDocument(),s=this.viewport_.getRootNode?this.viewport_.getRootNode():r,o=t.target,a=s instanceof ShadowRoot?s.host===o?s.host.ownerDocument:s:s===r?r.documentElement:s;if(this.overlayContainerStopEvent_.contains(o)||!a.contains(o))return}if(e.frameState=this.frameState_,this.dispatchEvent(e)!==!1){let r=this.getInteractions().getArray().slice();for(let s=r.length-1;s>=0;s--){let o=r[s];if(o.getMap()!==this||!o.getActive()||!this.getTargetElement())continue;if(!o.handleEvent(e)||e.propagationStopped)break}}}handlePostRender(){let e=this.frameState_,t=this.tileQueue_;if(!t.isEmpty()){let r=this.maxTilesLoading_,s=r,o=e?e.viewHints:void 0,a=o?o[so.ANIMATING]||o[so.INTERACTING]:!1;if(a){let l=Date.now()-e.time>8;r=l?0:8,s=l?0:2}t.getTilesLoading()<r&&(a&&t.reprioritize(),t.loadMoreTiles(r,s))}e&&this.renderer_&&!e.animate&&(this.renderComplete_?(this.hasListener(Bo.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(Bo.RENDERCOMPLETE,e),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new zp(wh.LOADEND,this,e)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new zp(wh.LOADSTART,this,e))));let n=this.postRenderFunctions_;if(e)for(let r=0,s=n.length;r<s;++r)n[r](this,e);n.length=0}handleSizeChanged_(){this.getView()&&!this.getView().getAnimating()&&this.getView().resolveConstraints(0),this.render()}handleTargetChanged_(){if(this.mapBrowserEventHandler_){for(let n=0,r=this.targetChangeHandlerKeys_.length;n<r;++n)li(this.targetChangeHandlerKeys_[n]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(nn.CONTEXTMENU,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(nn.WHEEL,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(this.targetElement_&&!Hl(this.targetElement_)){this.resizeObserver_?.unobserve(this.targetElement_);let n=this.targetElement_.getRootNode();n instanceof ShadowRoot&&this.resizeObserver_.unobserve(n.host),this.setSize(void 0)}let e=this.getTarget(),t=typeof e=="string"?document.getElementById(e):e;if(this.targetElement_=t,!t)this.renderer_&&(clearTimeout(this.postRenderTimeoutHandle_),this.postRenderTimeoutHandle_=void 0,this.postRenderFunctions_.length=0,this.renderer_.dispose(),this.renderer_=null),this.animationDelayKey_&&(cancelAnimationFrame(this.animationDelayKey_),this.animationDelayKey_=void 0);else{if(Hl(t)||t.appendChild(this.viewport_),this.renderer_||(this.renderer_=new J$(this)),!Hl(t)){this.mapBrowserEventHandler_=new a$(this,this.moveTolerance_);for(let r in gr)this.mapBrowserEventHandler_.addEventListener(gr[r],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(nn.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(nn.WHEEL,this.boundHandleBrowserEvent_,fE?{passive:!1}:!1);let n;if(this.keyboardEventTarget_)n=this.keyboardEventTarget_;else{let r=t.getRootNode();n=r instanceof ShadowRoot?r.host:t}if(this.targetChangeHandlerKeys_=[qn(n,nn.KEYDOWN,this.handleBrowserEvent,this),qn(n,nn.KEYPRESS,this.handleBrowserEvent,this)],!Hl(t)){let r=t.getRootNode();r instanceof ShadowRoot&&this.resizeObserver_.observe(r.host),this.resizeObserver_?.observe(t)}}this.updateSize()}}handleTileChange_(){this.render()}handleViewPropertyChanged_(){this.render()}handleViewChanged_(){this.viewPropertyListenerKey_&&(li(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(li(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);let e=this.getView();e&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=qn(e,bu.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=qn(e,nn.CHANGE,this.handleViewPropertyChanged_,this),e.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(li),this.layerGroupPropertyListenerKeys_=null);let e=this.getLayerGroup();e&&(this.handleLayerAdd_(new Eu("addlayer",e)),this.layerGroupPropertyListenerKeys_=[qn(e,bu.PROPERTYCHANGE,this.render,this),qn(e,nn.CHANGE,this.render,this),qn(e,"addlayer",this.handleLayerAdd_,this),qn(e,"removelayer",this.handleLayerRemove_,this)]),this.render()}isRendered(){return!!this.frameState_}animationDelay_(){this.animationDelayKey_=void 0,this.renderFrame_(Date.now())}renderSync(){this.animationDelayKey_&&cancelAnimationFrame(this.animationDelayKey_),this.animationDelay_()}redrawText(){if(!this.frameState_)return;let e=this.frameState_.layerStatesArray;for(let t=0,n=e.length;t<n;++t){let r=e[t].layer;r.hasRenderer()&&r.getRenderer().handleFontsChanged()}}render(){this.renderer_&&this.animationDelayKey_===void 0&&(this.animationDelayKey_=requestAnimationFrame(this.animationDelay_))}removeControl(e){return this.getControls().remove(e)}removeInteraction(e){return this.getInteractions().remove(e)}removeLayer(e){return this.getLayerGroup().getLayers().remove(e)}handleLayerRemove_(e){eY(e.layer)}removeOverlay(e){return this.getOverlays().remove(e)}renderFrame_(e){let t=this.getSize(),n=this.getView(),r=this.frameState_,s=null;if(t!==void 0&&qD(t)&&n&&n.isDef()){let o=n.getHints(this.frameState_?this.frameState_.viewHints:void 0),a=n.getState();if(s={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutter:null,extent:Ey(a.center,a.resolution,a.rotation,t),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:t,tileQueue:this.tileQueue_,time:e,usedTiles:{},viewState:a,viewHints:o,wantedTiles:{},mapId:Bn(this),renderTargets:{}},a.nextCenter&&a.nextResolution){let l=isNaN(a.nextRotation)?a.rotation:a.nextRotation;s.nextExtent=Ey(a.nextCenter,a.nextResolution,l,t)}}this.frameState_=s,this.renderer_.renderFrame(s),s&&(s.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,s.postRenderFunctions),r&&(!this.previousExtent_||!ph(this.previousExtent_)&&!Qm(s.extent,this.previousExtent_))&&(this.dispatchEvent(new zp(wh.MOVESTART,this,r)),this.previousExtent_=Km(this.previousExtent_)),this.previousExtent_&&!s.viewHints[so.ANIMATING]&&!s.viewHints[so.INTERACTING]&&!Qm(s.extent,this.previousExtent_)&&(this.dispatchEvent(new zp(wh.MOVEEND,this,s)),HT(s.extent,this.previousExtent_))),this.dispatchEvent(new zp(wh.POSTRENDER,this,s)),this.renderComplete_=(this.hasListener(wh.LOADSTART)||this.hasListener(wh.LOADEND)||this.hasListener(Bo.RENDERCOMPLETE))&&!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady(),this.postRenderTimeoutHandle_||(this.postRenderTimeoutHandle_=setTimeout(()=>{this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(e){let t=this.getLayerGroup();t&&this.handleLayerRemove_(new Eu("removelayer",t)),this.set(Fo.LAYERGROUP,e)}setSize(e){this.set(Fo.SIZE,e)}setTarget(e){this.set(Fo.TARGET,e)}setView(e){if(!e||e instanceof Xl){this.set(Fo.VIEW,e);return}this.set(Fo.VIEW,new Xl);let t=this;e.then(function(n){t.setView(new Xl(n))})}updateSize(){let e=this.getTargetElement(),t;if(e){let r,s;if(Hl(e)){let o=e.getContext("2d").getTransform();r=e.width/o.a,s=e.height/o.d}else{let o=getComputedStyle(e);r=e.offsetWidth-parseFloat(o.borderLeftWidth)-parseFloat(o.paddingLeft)-parseFloat(o.paddingRight)-parseFloat(o.borderRightWidth),s=e.offsetHeight-parseFloat(o.borderTopWidth)-parseFloat(o.paddingTop)-parseFloat(o.paddingBottom)-parseFloat(o.borderBottomWidth)}!isNaN(r)&&!isNaN(s)&&(t=[Math.max(0,r),Math.max(0,s)],!qD(t)&&(e.offsetWidth||e.offsetHeight||e.getClientRects().length)&&YT("No map visible because the map container's width or height are 0."))}let n=this.getSize();t&&(!n||!ea(t,n))&&(this.updateViewportSize_(t),this.setSize(t))}updateViewportSize_(e){let t=this.getView();t&&t.setViewportSize(e)}};function dme(i){let e=null;i.keyboardEventTarget!==void 0&&(e=typeof i.keyboardEventTarget=="string"?document.getElementById(i.keyboardEventTarget):i.keyboardEventTarget);let t={},n=i.layers&&typeof i.layers.getLayers=="function"?i.layers:new a2({layers:i.layers});t[Fo.LAYERGROUP]=n,t[Fo.TARGET]=i.target,t[Fo.VIEW]=i.view instanceof Xl?i.view:new Xl;let r;i.controls!==void 0&&(Array.isArray(i.controls)?r=new No(i.controls.slice()):(jn(typeof i.controls.getArray=="function","Expected `controls` to be an array or an `ol/Collection.js`"),r=i.controls));let s;i.interactions!==void 0&&(Array.isArray(i.interactions)?s=new No(i.interactions.slice()):(jn(typeof i.interactions.getArray=="function","Expected `interactions` to be an array or an `ol/Collection.js`"),s=i.interactions));let o;return i.overlays!==void 0?Array.isArray(i.overlays)?o=new No(i.overlays.slice()):(jn(typeof i.overlays.getArray=="function","Expected `overlays` to be an array or an `ol/Collection.js`"),o=i.overlays):o=new No,{controls:r,interactions:s,keyboardEventTarget:e,overlays:o,values:t}}var nY=A6;function y3(i){return i instanceof Image||i instanceof HTMLCanvasElement||i instanceof HTMLVideoElement||i instanceof ImageBitmap?i:null}var pme=new Error("disposed");var mme=[256,256],g6=class extends av{constructor(e){let t=an.IDLE;super(e.tileCoord,t,{transition:e.transition,interpolate:e.interpolate}),this.loader_=e.loader,this.data_=null,this.error_=null,this.size_=e.size||null,this.controller_=e.controller||null}getSize(){if(this.size_)return this.size_;let e=y3(this.data_);return e?[e.width,e.height]:mme}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==an.IDLE&&this.state!==an.ERROR)return;this.state=an.LOADING,this.changed();let e=this;this.loader_().then(function(t){e.data_=t,e.state=an.LOADED,e.changed()}).catch(function(t){e.error_=t,e.state=an.ERROR,e.changed()})}disposeInternal(){this.controller_&&(this.controller_.abort(pme),this.controller_=null),super.disposeInternal()}},v6=g6;var _6=class{constructor(e){this.highWaterMark=e!==void 0?e:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}deleteOldest(){let e=this.pop();e instanceof Ip&&e.dispose()}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(e){for(;this.canExpireCache();)this.deleteOldest()}clear(){for(;this.oldest_;)this.deleteOldest()}containsKey(e){return this.entries_.hasOwnProperty(e)}forEach(e){let t=this.oldest_;for(;t;)e(t.value_,t.key_,this),t=t.newer}get(e,t){let n=this.entries_[e];return jn(n!==void 0,"Tried to get a value for a key that does not exist in the cache"),n===this.newest_||(n===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(n.newer.older=n.older,n.older.newer=n.newer),n.newer=null,n.older=this.newest_,this.newest_.newer=n,this.newest_=n),n.value_}remove(e){let t=this.entries_[e];return jn(t!==void 0,"Tried to get a value for a key that does not exist in the cache"),t===this.newest_?(this.newest_=t.older,this.newest_&&(this.newest_.newer=null)):t===this.oldest_?(this.oldest_=t.newer,this.oldest_&&(this.oldest_.older=null)):(t.newer.older=t.older,t.older.newer=t.newer),delete this.entries_[e],--this.count_,t.value_}getCount(){return this.count_}getKeys(){let e=new Array(this.count_),t=0,n;for(n=this.newest_;n;n=n.older)e[t++]=n.key_;return e}getValues(){let e=new Array(this.count_),t=0,n;for(n=this.newest_;n;n=n.older)e[t++]=n.value_;return e}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(e){return this.entries_[e]?.value_}pop(){let e=this.oldest_;return delete this.entries_[e.key_],e.newer&&(e.newer.older=null),this.oldest_=e.newer,this.oldest_||(this.newest_=null),--this.count_,e.value_}replace(e,t){this.get(e),this.entries_[e].value_=t}set(e,t){jn(!(e in this.entries_),"Tried to set a value for a key that is used already");let n={key_:e,newer:null,older:this.newest_,value_:t};this.newest_?this.newest_.newer=n:this.oldest_=n,this.newest_=n,this.entries_[e]=n,++this.count_}setSize(e){this.highWaterMark=e}},x6=_6;var y6=class{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.pendingMethod_,this.context_=new Proxy(Dy(),{get:(e,t)=>{if(typeof e[t]=="function")return this.pendingMethod_=t,this.pushMethodArgs_},set:(e,t,n)=>(this.push_(t,n),!0)})}push_(...e){let t=this.instructions_,n=this.zIndex+this.offset_;t[n]||(t[n]=[]),t[n].push(...e)}pushMethodArgs_=(...e)=>{this.push_(this.pendingMethod_,e)};pushFunction(e){this.push_(e)}getContext(){return this.context_}draw(e){this.instructions_.forEach(t=>{for(let n=0,r=t.length;n<r;++n){let s=t[n];if(typeof s=="function"){s(e);continue}let o=t[++n];typeof e[s]=="function"?e[s](...o):typeof o=="function"?e[s]=o(e):e[s]=o}})}clear(){this.instructions_.length=0,this.zIndex=0,this.offset_=0}offset(){this.offset_=this.instructions_.length,this.zIndex=0}},b3=y6;var Ame=5,b6=class extends vE{constructor(e){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=e,this.staleKeys_=new Array,this.maxStaleKeys=Ame,this.renderedSourceKey_}getStaleKeys(){return this.staleKeys_}prependStaleKey(e){this.staleKeys_.unshift(e),this.staleKeys_.length>this.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}updateStaleKeys(e){this.renderedSourceKey_?this.renderedSourceKey_!==e&&(this.prependStaleKey(this.renderedSourceKey_),this.renderedSourceKey_=e):this.renderedSourceKey_=e}getFeatures(e){return ei()}getData(e){return null}prepareFrame(e){return ei()}renderFrame(e,t){return ei()}forEachFeatureAtCoordinate(e,t,n,r,s){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(e){let t=e.target;(t.getState()===In.LOADED||t.getState()===In.ERROR)&&this.renderIfReadyAndVisible()}loadImage(e){let t=e.getState();return t!=In.LOADED&&t!=In.ERROR&&e.addEventListener(nn.CHANGE,this.boundHandleImageChange_),t==In.IDLE&&(e.load(),t=e.getState()),t==In.LOADED}renderIfReadyAndVisible(){let e=this.getLayer();e&&e.getVisible()&&e.getSourceState()==="ready"&&e.changed()}renderDeferred(e){}disposeInternal(){delete this.layer_,super.disposeInternal()}},iY=b6;var S6=[],Cv=null;function gme(){Cv=Di(1,1,void 0,{willReadFrequently:!0})}var w6=class extends iY{constructor(e){super(e),this.container=null,this.renderedResolution,this.tempTransform=go(),this.pixelTransform=go(),this.inversePixelTransform=go(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(e,t,n){Cv||gme(),Cv.clearRect(0,0,1,1);let r;try{Cv.drawImage(e,t,n,1,1,0,0,1,1),r=Cv.getImageData(0,0,1,1).data}catch{return Cv=null,null}return r}getBackground(e){let n=this.getLayer().getBackground();return typeof n=="function"&&(n=n(e.viewState.resolution)),n||void 0}useContainer(e,t,n,r,s){if(Hl(e)&&this.pixelTransform[1]===0&&this.pixelTransform[2]===0&&this.pixelTransform[4]===0&&this.pixelTransform[5]===0&&e.width===r&&e.height===s){let c=e,u=c.getContext("2d");if(u){this.container=e,this.context=u,this.containerReused=!0,n&&(u.fillStyle=n,u.fillRect(0,0,c.width,c.height));return}}let o=this.getLayer().getClassName(),a,l;if(e&&e.className===o&&(!n||e&&e.style.backgroundColor&&ea(Uc(e.style.backgroundColor),Uc(n)))){let c=e.firstElementChild;Hl(c)&&(l=c.getContext("2d"))}if(l&&Tj(l.canvas.style.transform,t)?(this.container=e,this.context=l,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){a=io?dE():document.createElement("div"),a.className=o;let c=a.style;c.position="absolute",c.width="100%",c.height="100%",l=Di();let u=l.canvas;a.appendChild(u),c=u.style,c.position="absolute",c.left="0",c.transformOrigin="top left",this.container=a,this.context=l}!this.containerReused&&n&&!this.container.style.backgroundColor&&(this.container.style.backgroundColor=n)}clipUnrotated(e,t,n){let r=Pc(n),s=$1(n),o=X1(n),a=j1(n);jr(t.coordinateToPixelTransform,r),jr(t.coordinateToPixelTransform,s),jr(t.coordinateToPixelTransform,o),jr(t.coordinateToPixelTransform,a);let l=this.inversePixelTransform;jr(l,r),jr(l,s),jr(l,o),jr(l,a),e.save(),e.beginPath(),e.moveTo(Math.round(r[0]),Math.round(r[1])),e.lineTo(Math.round(s[0]),Math.round(s[1])),e.lineTo(Math.round(o[0]),Math.round(o[1])),e.lineTo(Math.round(a[0]),Math.round(a[1])),e.clip()}prepareContainer(e,t){let n=e.extent,r=e.viewState.resolution,s=e.viewState.rotation,o=e.pixelRatio,a=Math.round(Kn(n)/r*o),l=Math.round(Dr(n)/r*o);Do(this.pixelTransform,e.size[0]/2,e.size[1]/2,1/o,1/o,s,-a/2,-l/2),AE(this.inversePixelTransform,this.pixelTransform);let c=Sj(this.pixelTransform),u=this.getBackground(e);if(this.useContainer(t,c,u,a,l),!this.containerReused){let f=this.context.canvas;f.width!=a||f.height!=l?(f.width=a,f.height=l):this.context.clearRect(0,0,a,l),c!==f.style.transform&&(f.style.transform=c)}}dispatchRenderEvent_(e,t,n){let r=this.getLayer();if(r.hasListener(e)){let s=new x3(e,this.inversePixelTransform,n,t);r.dispatchEvent(s)}}preRender(e,t){this.frameState=t,!t.declutter&&this.dispatchRenderEvent_(Bo.PRERENDER,e,t)}postRender(e,t){t.declutter||this.dispatchRenderEvent_(Bo.POSTRENDER,e,t)}renderDeferredInternal(e){}getRenderContext(e){return e.declutter&&!this.deferredContext_&&(this.deferredContext_=new b3),e.declutter?this.deferredContext_.getContext():this.context}renderDeferred(e){e.declutter&&(this.dispatchRenderEvent_(Bo.PRERENDER,this.context,e),e.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(e),this.dispatchRenderEvent_(Bo.POSTRENDER,this.context,e))}getRenderTransform(e,t,n,r,s,o,a){let l=s/2,c=o/2,u=r/t,f=-u,d=-e[0]+a,A=-e[1];return Do(this.tempTransform,l,c,u,f,-n,d,A)}disposeInternal(){delete this.frameState,super.disposeInternal()}},w3=w6;function T6(i,e,t){if(!(t in i))return i[t]=new Set([e]),!0;let n=i[t],r=n.has(e);return r||n.add(e),!r}function vme(i,e,t){let n=i[t];return n?n.delete(e):!1}function rY(i,e){let t=i.layerStatesArray[i.layerIndex];t.extent&&(e=dh(e,yu(t.extent,i.viewState.projection)));let n=t.layer.getRenderSource();if(!n.getWrapX()){let r=n.getTileGridForProjection(i.viewState.projection).getExtent();r&&(e=dh(e,r))}return e}var E6=class extends w3{constructor(e,t){super(e),t=t||{},this.extentChanged=!0,this.renderComplete=!1,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedTiles=[],this.renderedSourceRevision_,this.tempExtent=Wr(),this.tempTileRange_=new aE(0,0,0,0),this.tempTileCoord_=iv(0,0,0);let n=t.cacheSize!==void 0?t.cacheSize:512;this.tileCache_=new x6(n),this.sourceTileCache_=null,this.layerExtent=null,this.maxStaleKeys=n*.5}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new x6(512)),this.sourceTileCache_}getOrCreateTile(e,t,n,r){let s=this.tileCache_,a=this.getLayer().getSource(),l=rv(a,a.getKey(),e,t,n),c;if(s.containsKey(l))c=s.get(l);else{let u=r.viewState.projection,f=a.getProjection();if(c=a.getTile(e,t,n,r.pixelRatio,u,!f||ev(f,u)?void 0:this.getSourceTileCache()),!c)return null;s.set(l,c)}return c}getTile(e,t,n,r){let s=this.getOrCreateTile(e,t,n,r);return s||null}getData(e){let t=this.frameState;if(!t)return null;let n=this.getLayer(),r=jr(t.pixelToCoordinateTransform,e.slice()),s=n.getExtent();if(s&&!mu(s,r))return null;let o=t.viewState,a=n.getRenderSource(),l=a.getTileGridForProjection(o.projection),c=a.getTilePixelRatio(t.pixelRatio);for(let u=l.getZForResolution(o.resolution);u>=l.getMinZoom();--u){let f=l.getTileCoordForCoordAndZ(r,u),d=this.getTile(u,f[1],f[2],t);if(!d||d.getState()!==an.LOADED)continue;let A=l.getOrigin(u),y=ls(l.getTileSize(u)),w=l.getResolution(u),S;if(d instanceof pE||d instanceof gE)S=d.getImage();else if(d instanceof v6){if(S=y3(d.getData()),!S)continue}else continue;let T=Math.floor(c*((r[0]-A[0])/w-f[1]*y[0])),R=Math.floor(c*((A[1]-r[1])/w-f[2]*y[1])),P=Math.round(c*a.getGutterForProjection(o.projection));return this.getImageData(S,T+P,R+P)}return null}prepareFrame(e){this.renderedProjection?e.viewState.projection!==this.renderedProjection&&(this.tileCache_.clear(),this.renderedProjection=e.viewState.projection):this.renderedProjection=e.viewState.projection;let t=this.getLayer().getSource();if(!t)return!1;let n=t.getRevision();return this.renderedSourceRevision_?this.renderedSourceRevision_!==n&&(this.renderedSourceRevision_=n,this.renderedSourceKey_===t.getKey()&&(this.tileCache_.clear(),this.sourceTileCache_?.clear())):this.renderedSourceRevision_=n,!0}enqueueTilesForNextExtent(){return!0}enqueueTiles(e,t,n,r,s){let o=e.viewState,a=this.getLayer(),l=a.getRenderSource(),c=l.getTileGridForProjection(o.projection),u=Bn(l);u in e.wantedTiles||(e.wantedTiles[u]={});let f=e.wantedTiles[u],d=a.getMapInternal(),A=Math.max(n-s,c.getMinZoom(),c.getZForResolution(Math.min(a.getMaxResolution(),d?d.getView().getResolutionForZoom(Math.max(a.getMinZoom(),0)):c.getResolution(0)),l.zDirection)),y=o.rotation,w=y?CD(o.center,o.resolution,y,e.size):void 0;for(let S=n;S>=A;--S){let T=c.getTileRangeForExtentAndZ(t,S,this.tempTileRange_),R=c.getResolution(S);for(let P=T.minX;P<=T.maxX;++P)for(let I=T.minY;I<=T.maxY;++I){if(y&&!c.tileCoordIntersectsViewport([S,P,I],w))continue;let F=this.getTile(S,P,I,e);if(!F||!T6(r,F,S))continue;let L=F.getKey();if(f[L]=!0,F.getState()===an.IDLE&&!e.tileQueue.isKeyQueued(L)){let C=iv(S,P,I,this.tempTileCoord_);e.tileQueue.enqueue([F,u,c.getTileCoordCenter(C),R])}}}}findStaleTile_(e,t){let n=this.tileCache_,r=e[0],s=e[1],o=e[2],a=this.getStaleKeys();for(let l=0;l<a.length;++l){let c=rv(this.getLayer().getSource(),a[l],r,s,o);if(n.containsKey(c)){let u=n.peek(c);if(u.getState()===an.LOADED)return u.endTransition(Bn(this)),T6(t,u,r),!0}}return!1}findAltTiles_(e,t,n,r){let s=e.getTileRangeForTileCoordAndZ(t,n,this.tempTileRange_);if(!s)return!1;let o=!0,a=this.tileCache_,l=this.getLayer().getRenderSource(),c=l.getKey();for(let u=s.minX;u<=s.maxX;++u)for(let f=s.minY;f<=s.maxY;++f){let d=rv(l,c,n,u,f),A=!1;if(a.containsKey(d)){let y=a.peek(d);y.getState()===an.LOADED&&(T6(r,y,n),A=!0)}A||(o=!1)}return o}renderFrame(e,t){this.renderComplete=!0;let n=e.layerStatesArray[e.layerIndex],r=e.viewState,s=r.projection,o=r.resolution,a=r.center,l=e.pixelRatio,c=this.getLayer(),u=c.getSource(),f=u.getTileGridForProjection(s),d=f.getZForResolution(o,u.zDirection),A=f.getResolution(d);this.updateStaleKeys(u.getKey());let y=e.extent,w=u.getTilePixelRatio(l);this.prepareContainer(e,t);let S=this.context.canvas.width,T=this.context.canvas.height;this.layerExtent=n.extent?yu(n.extent,s):null,this.layerExtent&&(y=dh(y,this.layerExtent));let R=A*S/2/w,P=A*T/2/w,I=[a[0]-R,a[1]-P,a[0]+R,a[1]+P],F={};this.renderedTiles.length=0;let D=c.getPreload();if(e.nextExtent&&this.enqueueTilesForNextExtent()){let $=f.getZForResolution(r.nextResolution,u.zDirection),J=rY(e,e.nextExtent);this.enqueueTiles(e,J,$,F,D)}let L=rY(e,y);if(this.enqueueTiles(e,L,d,F,0),D>0&&setTimeout(()=>{this.enqueueTiles(e,L,d-1,F,D-1)},0),!(d in F))return this.container;let C=Bn(this),B=e.time;for(let $ of F[d]){let J=$.getState();if(J===an.EMPTY)continue;let te=$.tileCoord;if(J===an.LOADED&&$.getAlpha(C,B)===1){$.endTransition(C);continue}if(J!==an.ERROR&&(this.renderComplete=!1),this.findStaleTile_(te,F)){vme(F,$,d),e.animate=!0;continue}if(this.findAltTiles_(f,te,d+1,F))continue;let ve=f.getMinZoom();for(let Re=d-1;Re>=ve&&!this.findAltTiles_(f,te,Re,F);--Re);}let k=A/o*l/w,z=this.getRenderContext(e);Do(this.tempTransform,S/2,T/2,k,k,0,-S/2,-T/2),this.layerExtent&&this.clipUnrotated(z,e,this.layerExtent),u.getInterpolate()||(z.imageSmoothingEnabled=!1),this.preRender(z,e);let G=Object.keys(F).map(Number);G.sort(pl);let W=[],Y=[],H=[];for(let $=G.length-1;$>=0;--$){let J=G[$],te=u.getTilePixelSize(J,l,s),he=f.getResolution(J)/A,ve=te[0]*he*k,Re=te[1]*he*k,Qe=f.getTileCoordForCoordAndZ(Pc(I),J),Fe=f.getTileCoordExtent(Qe),mt=jr(this.tempTransform,[w*(Fe[0]-I[0])/A,w*(I[3]-Fe[3])/A]),Ee=w*u.getGutterForProjection(s);for(let Ve of F[J]){if(Ve.getState()!==an.LOADED)continue;let Ye=Ve.tileCoord,Mt=Qe[1]-Ye[1],Et=Math.round(mt[0]-(Mt-1)*ve),It=Qe[2]-Ye[2],dn=Math.round(mt[1]-(It-1)*Re),Gt=Math.round(mt[0]-Mt*ve),$e=Math.round(mt[1]-It*Re),ot=Et-Gt,nt=dn-$e,bt=J===d;if(bt&&Ve.inTransition(C)){H.push({tile:Ve,x:Gt,y:$e,w:ot,h:nt,gutter:Ee}),this.renderedTiles.unshift(Ve),this.updateUsedTiles(e.usedTiles,u,Ve);continue}let yt=[Gt,$e,Gt+ot,$e+nt],hn=[];for(let tn=0,bn=W.length;tn<bn;++tn)J<Y[tn]&&Ar(yt,W[tn])&&hn.push(W[tn]);let en;hn.length>0&&(en=xW(yt,hn)),W.push(yt),Y.push(J),this.drawTile(Ve,e,Gt,$e,ot,nt,Ee,bt,en),this.renderedTiles.unshift(Ve),this.updateUsedTiles(e.usedTiles,u,Ve)}}for(let $=0,J=H.length;$<J;++$){let{tile:te,x:ce,y:he,w:ve,h:Re,gutter:Qe}=H[$];this.drawTile(te,e,ce,he,ve,Re,Qe,!0,void 0)}if(this.renderedResolution=A,this.extentChanged=!this.renderedExtent_||!Qm(this.renderedExtent_,I),this.renderedExtent_=I,this.renderedPixelRatio=l,this.postRender(this.context,e),this.layerExtent&&z.restore(),z.imageSmoothingEnabled=!0,this.renderComplete){let $=(J,te)=>{let ce=Bn(u),he=te.wantedTiles[ce],ve=he?Object.keys(he).length:0;this.updateCacheSize(ve),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache()};e.postRenderFunctions.push($)}return this.container}updateCacheSize(e){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,e*2)}drawTile(e,t,n,r,s,o,a,l,c){let u;if(e instanceof v6){if(u=y3(e.getData()),!u)throw new Error("Rendering array data is not yet supported")}else u=this.getTileImage(e);if(!u)return;let f=this.getRenderContext(t),d=Bn(this),A=t.layerStatesArray[t.layerIndex],y=A.opacity*(l?e.getAlpha(d,t.time):1),w=y!==f.globalAlpha;w&&(f.save(),f.globalAlpha=y);let S=u.width-2*a,T=u.height-2*a;if(c){let R=S/s,P=T/o;for(let I=0,F=c.length;I<F;++I){let D=c[I],L=D[0],C=D[1],B=D[2]-D[0],k=D[3]-D[1];f.drawImage(u,a+(L-n)*R,a+(C-r)*P,B*R,k*P,L,C,B,k)}}else f.drawImage(u,a,a,S,T,n,r,s,o);w&&f.restore(),y!==A.opacity?t.animate=!0:l&&e.endTransition(d)}getImage(){let e=this.context;return e?e.canvas:null}getTileImage(e){return e.getImage()}updateUsedTiles(e,t,n){let r=Bn(t);r in e||(e[r]={}),e[r][n.getKey()]=!0}},sY=E6;var g2={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};var M6=class extends TA{constructor(e){e=e||{};let t=Object.assign({},e),n=e.cacheSize;delete e.cacheSize,delete t.preload,delete t.useInterimTilesOnError,super(t),this.on,this.once,this.un,this.cacheSize_=n,this.setPreload(e.preload!==void 0?e.preload:0),this.setUseInterimTilesOnError(e.useInterimTilesOnError!==void 0?e.useInterimTilesOnError:!0)}getCacheSize(){return this.cacheSize_}getPreload(){return this.get(g2.PRELOAD)}setPreload(e){this.set(g2.PRELOAD,e)}getUseInterimTilesOnError(){return this.get(g2.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(e){this.set(g2.USE_INTERIM_TILES_ON_ERROR,e)}getData(e){return super.getData(e)}},oY=M6;var C6=class extends oY{constructor(e){super(e)}createRenderer(){return new sY(this,{cacheSize:this.getCacheSize()})}},R6=C6;var I6=class{drawCustom(e,t,n,r,s){}drawGeometry(e){}setStyle(e){}drawCircle(e,t,n){}drawFeature(e,t,n){}drawGeometryCollection(e,t,n){}drawLineString(e,t,n){}drawMultiLineString(e,t,n){}drawMultiPoint(e,t,n){}drawMultiPolygon(e,t,n){}drawPoint(e,t,n){}drawPolygon(e,t,n){}drawText(e,t,n){}setFillStrokeStyle(e,t){}setImageStyle(e,t){}setTextStyle(e,t){}},S3=I6;var v2={BEGIN_GEOMETRY:0,BEGIN_PATH:1,CIRCLE:2,CLOSE_PATH:3,CUSTOM:4,DRAW_CHARS:5,DRAW_IMAGE:6,END_GEOMETRY:7,FILL:8,MOVE_TO_LINE_TO:9,SET_FILL_STYLE:10,SET_STROKE_STYLE:11,STROKE:12},_2=[v2.FILL],Eh=[v2.STROKE],pd=[v2.BEGIN_PATH],P6=[v2.CLOSE_PATH],vn=v2;var L6=class extends S3{constructor(e,t,n,r){super(),this.tolerance=e,this.maxExtent=t,this.pixelRatio=r,this.maxLineWidth=0,this.resolution=n,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(e){let t=this.pixelRatio;return t==1?e:e.map(function(n){return n*t})}appendFlatPointCoordinates(e,t){let n=this.getBufferedMaxExtent(),r=this.tmpCoordinate_,s=this.coordinates,o=s.length;for(let a=0,l=e.length;a<l;a+=t)r[0]=e[a],r[1]=e[a+1],mu(n,r)&&(s[o++]=r[0],s[o++]=r[1]);return o}appendFlatLineCoordinates(e,t,n,r,s,o){let a=this.coordinates,l=a.length,c=this.getBufferedMaxExtent();o&&(t+=r);let u=e[t],f=e[t+1],d=this.tmpCoordinate_,A=!0,y,w,S;for(y=t+r;y<n;y+=r)d[0]=e[y],d[1]=e[y+1],S=qT(c,d),S!==w?(A&&(a[l++]=u,a[l++]=f,A=!1),a[l++]=d[0],a[l++]=d[1]):S===Us.INTERSECTING?(a[l++]=d[0],a[l++]=d[1],A=!1):A=!0,u=d[0],f=d[1],w=S;return(s&&A||y===t+r)&&(a[l++]=u,a[l++]=f),l}drawCustomCoordinates_(e,t,n,r,s){for(let o=0,a=n.length;o<a;++o){let l=n[o],c=this.appendFlatLineCoordinates(e,t,l,r,!1,!1);s.push(c),t=l}return t}drawCustom(e,t,n,r,s){this.beginGeometry(e,t,s);let o=e.getType(),a=e.getStride(),l=this.coordinates.length,c,u,f,d,A;switch(o){case"MultiPolygon":c=e.getOrientedFlatCoordinates(),d=[];let y=e.getEndss();A=0;for(let w=0,S=y.length;w<S;++w){let T=[];A=this.drawCustomCoordinates_(c,A,y[w],a,T),d.push(T)}this.instructions.push([vn.CUSTOM,l,d,e,n,Uy,s]),this.hitDetectionInstructions.push([vn.CUSTOM,l,d,e,r||n,Uy,s]);break;case"Polygon":case"MultiLineString":f=[],c=o=="Polygon"?e.getOrientedFlatCoordinates():e.getFlatCoordinates(),A=this.drawCustomCoordinates_(c,0,e.getEnds(),a,f),this.instructions.push([vn.CUSTOM,l,f,e,n,Dp,s]),this.hitDetectionInstructions.push([vn.CUSTOM,l,f,e,r||n,Dp,s]);break;case"LineString":case"Circle":c=e.getFlatCoordinates(),u=this.appendFlatLineCoordinates(c,0,c.length,a,!1,!1),this.instructions.push([vn.CUSTOM,l,u,e,n,Oc,s]),this.hitDetectionInstructions.push([vn.CUSTOM,l,u,e,r||n,Oc,s]);break;case"MultiPoint":c=e.getFlatCoordinates(),u=this.appendFlatPointCoordinates(c,a),u>l&&(this.instructions.push([vn.CUSTOM,l,u,e,n,Oc,s]),this.hitDetectionInstructions.push([vn.CUSTOM,l,u,e,r||n,Oc,s]));break;case"Point":c=e.getFlatCoordinates(),this.coordinates.push(c[0],c[1]),u=this.coordinates.length,this.instructions.push([vn.CUSTOM,l,u,e,n,void 0,s]),this.hitDetectionInstructions.push([vn.CUSTOM,l,u,e,r||n,void 0,s]);break;default:}this.endGeometry(t)}beginGeometry(e,t,n){this.beginGeometryInstruction1_=[vn.BEGIN_GEOMETRY,t,0,e,n],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[vn.BEGIN_GEOMETRY,t,0,e,n],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){let e=this.hitDetectionInstructions;e.reverse();let t,n=e.length,r,s,o=-1;for(t=0;t<n;++t)r=e[t],s=r[0],s==vn.END_GEOMETRY?o=t:s==vn.BEGIN_GEOMETRY&&(r[2]=t,QW(this.hitDetectionInstructions,o,t),o=-1)}fillStyleToState(e,t={}){if(e){let n=e.getColor();t.fillPatternScale=n&&typeof n=="object"&&"src"in n?this.pixelRatio:1,t.fillStyle=gl(n||ro)??void 0}else t.fillStyle=void 0;return t}strokeStyleToState(e,t={}){if(e){let n=e.getColor();t.strokeStyle=gl(n||na);let r=e.getLineCap();t.lineCap=r!==void 0?r:xh;let s=e.getLineDash();t.lineDash=s?s.slice():vl;let o=e.getLineDashOffset();t.lineDashOffset=o||_l;let a=e.getLineJoin();t.lineJoin=a!==void 0?a:yh;let l=e.getWidth();t.lineWidth=l!==void 0?l:ad;let c=e.getMiterLimit();t.miterLimit=c!==void 0?c:sd;let u=e.getOffset();t.strokeOffset=u??AX,t.lineWidth>this.maxLineWidth&&(this.maxLineWidth=t.lineWidth,this.bufferedMaxExtent_=null)}else t.strokeStyle=void 0,t.lineCap=void 0,t.lineDash=null,t.lineDashOffset=void 0,t.lineJoin=void 0,t.lineWidth=void 0,t.miterLimit=void 0,t.strokeOffset=void 0;return t}setFillStrokeStyle(e,t){let n=this.state;this.fillStyleToState(e,n),this.strokeStyleToState(t,n)}createFill(e){let t=e.fillStyle,n=[vn.SET_FILL_STYLE,t];return typeof t!="string"&&n.push(e.fillPatternScale),n}applyStroke(e){this.instructions.push(this.createStroke(e))}createStroke(e){return[vn.SET_STROKE_STYLE,e.strokeStyle,e.lineWidth*this.pixelRatio,e.lineCap,e.lineJoin,e.miterLimit,e.lineDash?this.applyPixelRatio(e.lineDash):null,e.lineDashOffset*this.pixelRatio]}updateFillStyle(e,t){let n=e.fillStyle;(n!==void 0&&typeof n!="string"||e.currentFillStyle!=n)&&(this.instructions.push(t.call(this,e)),e.currentFillStyle=n)}updateStrokeStyle(e,t){let n=e.strokeStyle,r=e.lineCap,s=e.lineDash,o=e.lineDashOffset,a=e.lineJoin,l=e.lineWidth,c=e.miterLimit,u=e.strokeOffset;(e.currentStrokeStyle!=n||e.currentLineCap!=r||s!=e.currentLineDash&&!ea(e.currentLineDash,s)||e.currentLineDashOffset!=o||e.currentLineJoin!=a||e.currentLineWidth!=l||e.currentMiterLimit!=c||e.currentStrokeOffset!=u)&&(t.call(this,e),e.currentStrokeStyle=n,e.currentLineCap=r,e.currentLineDash=s,e.currentLineDashOffset=o,e.currentLineJoin=a,e.currentLineWidth=l,e.currentMiterLimit=c,e.currentStrokeOffset=u)}endGeometry(e){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;let t=[vn.END_GEOMETRY,e];this.instructions.push(t),this.hitDetectionInstructions.push(t)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=HT(this.maxExtent),this.maxLineWidth>0)){let e=this.resolution*(this.maxLineWidth+1)/2;H1(this.bufferedMaxExtent_,e,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}},Mh=L6;var D6=class extends Mh{constructor(e,t,n,r){super(e,t,n,r),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(e,t,n){if(!this.image_||this.maxExtent&&!mu(this.maxExtent,e.getFlatCoordinates()))return;this.beginGeometry(e,t,n);let r=e.getFlatCoordinates(),s=e.getStride(),o=this.coordinates.length,a=this.appendFlatPointCoordinates(r,s);this.instructions.push([vn.DRAW_IMAGE,o,a,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([vn.DRAW_IMAGE,o,a,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(t)}drawMultiPoint(e,t,n){if(!this.image_)return;this.beginGeometry(e,t,n);let r=e.getFlatCoordinates(),s=[];for(let l=0,c=r.length;l<c;l+=e.getStride())(!this.maxExtent||mu(this.maxExtent,r.slice(l,l+2)))&&s.push(r[l],r[l+1]);let o=this.coordinates.length,a=this.appendFlatPointCoordinates(s,2);this.instructions.push([vn.DRAW_IMAGE,o,a,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([vn.DRAW_IMAGE,o,a,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(t)}finish(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,super.finish()}setImageStyle(e,t){let n=e.getAnchor(),r=e.getSize(),s=e.getOrigin();this.imagePixelRatio_=e.getPixelRatio(this.pixelRatio),this.anchorX_=n[0],this.anchorY_=n[1],this.hitDetectionImage_=e.getHitDetectionImage(),this.image_=e.getImage(this.pixelRatio),this.height_=r[1],this.opacity_=e.getOpacity(),this.originX_=s[0],this.originY_=s[1],this.rotateWithView_=e.getRotateWithView(),this.rotation_=e.getRotation(),this.scale_=e.getScaleArray(),this.width_=r[0],this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}},aY=D6;var N6=class extends Mh{constructor(e,t,n,r){super(e,t,n,r)}drawFlatCoordinates_(e,t,n,r,s){let o=this.coordinates.length,a=this.appendFlatLineCoordinates(e,t,n,r,!1,!1);return this.instructions.push([vn.MOVE_TO_LINE_TO,o,a,s*this.pixelRatio]),this.hitDetectionInstructions.push([vn.MOVE_TO_LINE_TO,o,a,s]),n}drawLineString(e,t,n){let r=this.state,s=r.strokeStyle,o=r.lineWidth,a=r.strokeOffset;if(s===void 0||o===void 0)return;this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(e,t,n),this.hitDetectionInstructions.push([vn.SET_STROKE_STYLE,na,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,vl,_l],pd);let l=e.getFlatCoordinates(),c=e.getStride();this.drawFlatCoordinates_(l,0,l.length,c,a),this.hitDetectionInstructions.push(Eh),this.endGeometry(t)}drawMultiLineString(e,t,n){let r=this.state,s=r.strokeStyle,o=r.lineWidth,a=r.strokeOffset;if(s===void 0||o===void 0)return;this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(e,t,n),this.hitDetectionInstructions.push([vn.SET_STROKE_STYLE,na,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,vl,_l],pd);let l=e.getEnds(),c=e.getFlatCoordinates(),u=e.getStride(),f=0;for(let d=0,A=l.length;d<A;++d)f=this.drawFlatCoordinates_(c,f,l[d],u,a);this.hitDetectionInstructions.push(Eh),this.endGeometry(t)}finish(){let e=this.state;return e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&this.instructions.push(Eh),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(e){e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&(this.instructions.push(Eh),e.lastStroke=this.coordinates.length),e.lastStroke=0,super.applyStroke(e),this.instructions.push(pd)}},lY=N6;var F6=class extends Mh{constructor(e,t,n,r){super(e,t,n,r)}drawFlatCoordinatess_(e,t,n,r,s){let o=this.state,a=o.fillStyle!==void 0,l=o.strokeStyle!==void 0,c=n.length;this.instructions.push(pd),this.hitDetectionInstructions.push(pd);for(let u=0;u<c;++u){let f=n[u],d=this.coordinates.length,A=this.appendFlatLineCoordinates(e,t,f,r,!0,!l);this.instructions.push([vn.MOVE_TO_LINE_TO,d,A,s*this.pixelRatio,!0]),this.hitDetectionInstructions.push([vn.MOVE_TO_LINE_TO,d,A,s,!0]),l&&(this.instructions.push(P6),this.hitDetectionInstructions.push(P6)),t=f}return a&&(this.instructions.push(_2),this.hitDetectionInstructions.push(_2)),l&&(this.instructions.push(Eh),this.hitDetectionInstructions.push(Eh)),t}drawCircle(e,t,n){let r=this.state,s=r.fillStyle,o=r.strokeStyle,a=r.strokeOffset;if(s===void 0&&o===void 0||this.handleStrokeOffset_(()=>this.drawCircle(e,t,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([vn.SET_FILL_STYLE,ro]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([vn.SET_STROKE_STYLE,na,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,vl,_l]);let l=e.getFlatCoordinates(),c=e.getStride(),u=this.coordinates.length;this.appendFlatLineCoordinates(l,0,l.length,c,!1,!1);let f=[vn.CIRCLE,u,a];this.instructions.push(pd,f),this.hitDetectionInstructions.push(pd,f),r.fillStyle!==void 0&&(this.instructions.push(_2),this.hitDetectionInstructions.push(_2)),r.strokeStyle!==void 0&&(this.instructions.push(Eh),this.hitDetectionInstructions.push(Eh)),this.endGeometry(t)}drawPolygon(e,t,n){let r=this.state,s=r.fillStyle,o=r.strokeStyle,a=r.strokeOffset;if(s===void 0&&o===void 0||this.handleStrokeOffset_(()=>this.drawPolygon(e,t,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([vn.SET_FILL_STYLE,ro]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([vn.SET_STROKE_STYLE,na,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,vl,_l]);let l=e.getEnds(),c=e.getOrientedFlatCoordinates(),u=e.getStride();this.drawFlatCoordinatess_(c,0,l,u,a),this.endGeometry(t)}drawMultiPolygon(e,t,n){let r=this.state,s=r.fillStyle,o=r.strokeStyle,a=r.strokeOffset;if(s===void 0&&o===void 0||this.handleStrokeOffset_(()=>this.drawMultiPolygon(e,t,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([vn.SET_FILL_STYLE,ro]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([vn.SET_STROKE_STYLE,na,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,vl,_l]);let l=e.getEndss(),c=e.getOrientedFlatCoordinates(),u=e.getStride(),f=0;for(let d=0,A=l.length;d<A;++d)f=this.drawFlatCoordinatess_(c,f,l[d],u,a);this.endGeometry(t)}finish(){this.reverseHitDetectionInstructions(),this.state=null;let e=this.tolerance;if(e!==0){let t=this.coordinates;for(let n=0,r=t.length;n<r;++n)t[n]=Np(t[n],e)}return super.finish()}setFillStrokeStyles_(){let e=this.state;this.updateFillStyle(e,this.createFill),this.updateStrokeStyle(e,this.applyStroke)}handleStrokeOffset_(e){let t=this.state,n=t.fillStyle,r=t.strokeStyle,s=t.strokeOffset;return Math.abs(s)>0&&n!==void 0&&r!==void 0?(t.strokeStyle=void 0,t.strokeOffset=0,e(),t.fillStyle=void 0,t.strokeStyle=r,t.strokeOffset=s,e(),t.fillStyle=n,!0):!1}},B6=F6;var O6=0,U6=1;function _me(i,e,t,n,r,s,o,a){let l=o-r,c=a-s,u=0,f=1;if(l===0){if(r<i||r>t)return!1}else{let d=(i-r)/l,A=(t-r)/l;if(d>A){let y=d;d=A,A=y}if(d>u&&(u=d),A<f&&(f=A),u>f)return!1}if(c===0){if(s<e||s>n)return!1}else{let d=(e-s)/c,A=(n-s)/c;if(d>A){let y=d;d=A,A=y}if(d>u&&(u=d),A<f&&(f=A),u>f)return!1}return O6=u,U6=f,!0}function cY(i,e,t,n){let r=n[0],s=n[1],o=n[2],a=n[3],l=[],c=[],u=!1,f,d,A=0;for(let y=0,w=e.length;y<w;++y){let S=e[y],T=i[A],R=i[A+1],P=!1;for(let I=A+t;I<S;I+=t){let F=i[I],D=i[I+1];if(_me(r,s,o,a,T,R,F,D)){let L=F-T,C=D-R,B=T+O6*L,k=R+O6*C,z=T+U6*L,G=R+U6*C;u&&P&&B===f&&k===d?l.push(z,G):(u&&c.push(l.length),l.push(B,k,z,G),u=!0),f=z,d=G,P=!0}T=F,R=D}A=S}return u&&c.push(l.length),{flatCoordinates:l,ends:c}}function uY(i,e,t,n,r){let s=[],o=t,a=0,l=e.slice(t,2);for(;a<i&&o+r<n;){let[c,u]=l.slice(-2),f=e[o+r],d=e[o+r+1],A=Math.sqrt((f-c)*(f-c)+(d-u)*(d-u));if(a+=A,a>=i){let y=(i-a+A)/A,w=Po(c,f,y),S=Po(u,d,y);l.push(w,S),s.push(l),l=[w,S],a==i&&(o+=r),a=0}else if(a<i)l.push(e[o+r],e[o+r+1]),o+=r;else{let y=A-a,w=Po(c,f,y/A),S=Po(u,d,y/A);l.push(w,S),s.push(l),l=[w,S],a=0,o+=r}}return a>0&&s.push(l),s}function hY(i,e,t,n,r){let s=t,o=t,a=0,l=0,c=t,u,f,d,A,y,w,S,T,R,P;for(f=t;f<n;f+=r){let I=e[f],F=e[f+1];y!==void 0&&(R=I-y,P=F-w,A=Math.sqrt(R*R+P*P),S!==void 0&&(l+=d,u=Math.acos((S*R+T*P)/(d*A)),u>i&&(l>a&&(a=l,s=c,o=f),l=0,c=f-r)),d=A,S=R,T=P),y=I,w=F}return l+=A,l>a?[c,f]:[s,o]}var x2={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},k6=class extends Mh{constructor(e,t,n,r){super(e,t,n,r),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textKeepUpright_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[ro]={fillStyle:ro},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterMode_=void 0,this.declutterImageWithText_=void 0}finish(){let e=super.finish();return e.textStates=this.textStates,e.fillStates=this.fillStates,e.strokeStates=this.strokeStates,e}drawText(e,t,n){let r=this.textFillState_,s=this.textStrokeState_,o=this.textState_;if(this.text_===""||!o||!r&&!s)return;let a=this.coordinates,l=a.length,c=e.getType(),u=null,f=e.getStride();if(o.placement==="line"&&(c=="LineString"||c=="MultiLineString"||c=="Polygon"||c=="MultiPolygon")){let d=e.getExtent();if(!Ar(this.maxExtent,d))return;let A;if(u=e.getFlatCoordinates(),c=="LineString")A=[u.length];else if(c=="MultiLineString")A=e.getEnds();else if(c=="Polygon")A=e.getEnds().slice(0,1);else if(c=="MultiPolygon"){let T=e.getEndss();A=[];for(let R=0,P=T.length;R<P;++R)A.push(T[R][0])}if((c=="LineString"||c=="MultiLineString")&&!fh(this.getBufferedMaxExtent(),d)){let T=cY(u,A,f,this.getBufferedMaxExtent());if(u=T.flatCoordinates,A=T.ends,f=2,A.length===0)return}this.beginGeometry(e,t,n);let y=o.repeat,w=y?void 0:o.textAlign,S=0;for(let T=0,R=A.length;T<R;++T){let P;y?P=uY(y*this.resolution,u,S,A[T],f):P=[u.slice(S,A[T])];for(let I=0,F=P.length;I<F;++I){let D=P[I],L=0,C=D.length;if(w==null){let k=hY(o.maxAngle,D,0,D.length,2);L=k[0],C=k[1]}for(let k=L;k<C;k+=f)a.push(D[k],D[k+1]);let B=a.length;S=A[T],this.drawChars_(l,B),l=B}}this.endGeometry(t)}else{let d=o.overflow?null:[];switch(c){case"Point":case"MultiPoint":u=e.getFlatCoordinates();break;case"LineString":u=e.getFlatMidpoint();break;case"Circle":u=e.getCenter();break;case"MultiLineString":u=e.getFlatMidpoints(),f=2;break;case"Polygon":u=e.getFlatInteriorPoint(),o.overflow||d.push(u[2]/this.resolution),f=3;break;case"MultiPolygon":let I=e.getFlatInteriorPoints();u=[];for(let F=0,D=I.length;F<D;F+=3)o.overflow||d.push(I[F+2]/this.resolution),u.push(I[F],I[F+1]);if(u.length===0)return;f=2;break;default:}let A=this.appendFlatPointCoordinates(u,f);if(A===l)return;if(d&&(A-l)/2!==u.length/f){let I=l/2;d=d.filter((F,D)=>{let L=a[(I+D)*2]===u[D*f]&&a[(I+D)*2+1]===u[D*f+1];return L||--I,L})}this.saveTextStates_();let y=o.backgroundFill?this.createFill(this.fillStyleToState(o.backgroundFill)):null,w=o.backgroundStroke?this.createStroke(this.strokeStyleToState(o.backgroundStroke)):null;this.beginGeometry(e,t,n);let S=o.padding;if(S!=od&&(o.scale[0]<0||o.scale[1]<0)){let I=o.padding[0],F=o.padding[1],D=o.padding[2],L=o.padding[3];o.scale[0]<0&&(F=-F,L=-L),o.scale[1]<0&&(I=-I,D=-D),S=[I,F,D,L]}let T=this.pixelRatio;this.instructions.push([vn.DRAW_IMAGE,l,A,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,S==od?od:S.map(function(I){return I*T}),y,w,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,d]);let R=1/T,P=y?y.slice(0):null;P&&(P[1]=ro),this.hitDetectionInstructions.push([vn.DRAW_IMAGE,l,A,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[R,R],NaN,this.declutterMode_,this.declutterImageWithText_,S,P,w,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?ro:this.fillKey_,this.textOffsetX_,this.textOffsetY_,d]),this.endGeometry(t)}}saveTextStates_(){let e=this.textStrokeState_,t=this.textState_,n=this.textFillState_,r=this.strokeKey_;e&&(r in this.strokeStates||(this.strokeStates[r]={strokeStyle:e.strokeStyle,lineCap:e.lineCap,lineDashOffset:e.lineDashOffset,lineWidth:e.lineWidth,lineJoin:e.lineJoin,miterLimit:e.miterLimit,lineDash:e.lineDash}));let s=this.textKey_;s in this.textStates||(this.textStates[s]={font:t.font,textAlign:t.textAlign||Up,justify:t.justify,textBaseline:t.textBaseline||_A,scale:t.scale});let o=this.fillKey_;n&&(o in this.fillStates||(this.fillStates[o]={fillStyle:n.fillStyle}))}drawChars_(e,t){let n=this.textStrokeState_,r=this.textState_,s=this.strokeKey_,o=this.textKey_,a=this.fillKey_;this.saveTextStates_();let l=this.pixelRatio,c=x2[r.textBaseline],u=this.textOffsetX_*l,f=this.textOffsetY_*l,d=this.text_,A=n?n.lineWidth*Math.abs(r.scale[0])/2:0;this.instructions.push([vn.DRAW_CHARS,e,t,c,r.overflow,a,r.maxAngle,l,f,s,A*l,d,o,1,this.declutterMode_,this.textKeepUpright_,u]),this.hitDetectionInstructions.push([vn.DRAW_CHARS,e,t,c,r.overflow,a&&ro,r.maxAngle,l,f,s,A*l,d,o,1/l,this.declutterMode_,this.textKeepUpright_,u])}setTextStyle(e,t){let n,r,s;if(!e)this.text_="";else{let o=e.getFill();o?(r=this.textFillState_,r||(r={},this.textFillState_=r),r.fillStyle=gl(o.getColor()||ro)):(r=null,this.textFillState_=r);let a=e.getStroke();if(!a)s=null,this.textStrokeState_=s;else{s=this.textStrokeState_,s||(s={},this.textStrokeState_=s);let w=a.getLineDash(),S=a.getLineDashOffset(),T=a.getWidth(),R=a.getMiterLimit();s.lineCap=a.getLineCap()||xh,s.lineDash=w?w.slice():vl,s.lineDashOffset=S===void 0?_l:S,s.lineJoin=a.getLineJoin()||yh,s.lineWidth=T===void 0?ad:T,s.miterLimit=R===void 0?sd:R,s.strokeStyle=gl(a.getColor()||na)}n=this.textState_;let l=e.getFont()||zE;gX(l);let c=e.getScaleArray();n.overflow=e.getOverflow(),n.font=l,n.maxAngle=e.getMaxAngle(),n.placement=e.getPlacement(),n.textAlign=e.getTextAlign(),n.repeat=e.getRepeat(),n.justify=e.getJustify(),n.textBaseline=e.getTextBaseline()||_A,n.backgroundFill=e.getBackgroundFill(),n.backgroundStroke=e.getBackgroundStroke(),n.padding=e.getPadding()||od,n.scale=c===void 0?[1,1]:c;let u=e.getOffsetX(),f=e.getOffsetY(),d=e.getRotateWithView(),A=e.getKeepUpright(),y=e.getRotation();this.text_=e.getText()||"",this.textOffsetX_=u===void 0?0:u,this.textOffsetY_=f===void 0?0:f,this.textRotateWithView_=d===void 0?!1:d,this.textKeepUpright_=A===void 0?!0:A,this.textRotation_=y===void 0?0:y,this.strokeKey_=s?(typeof s.strokeStyle=="string"?s.strokeStyle:Bn(s.strokeStyle))+s.lineCap+s.lineDashOffset+"|"+s.lineWidth+s.lineJoin+s.miterLimit+"["+s.lineDash.join()+"]":"",this.textKey_=n.font+n.scale+(n.textAlign||"?")+(n.repeat||"?")+(n.justify||"?")+(n.textBaseline||"?"),this.fillKey_=r&&r.fillStyle?typeof r.fillStyle=="string"?r.fillStyle:"|"+Bn(r.fillStyle):""}this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}},fY=k6;var xme={Circle:B6,Default:Mh,Image:aY,LineString:lY,Polygon:B6,Text:fY},z6=class{constructor(e,t,n,r){this.tolerance_=e,this.maxExtent_=t,this.pixelRatio_=r,this.resolution_=n,this.buildersByZIndex_={}}finish(){let e={};for(let t in this.buildersByZIndex_){e[t]=e[t]||{};let n=this.buildersByZIndex_[t];for(let r in n){let s=n[r].finish();e[t][r]=s}}return e}getBuilder(e,t){let n=e!==void 0?e.toString():"0",r=this.buildersByZIndex_[n];r===void 0&&(r={},this.buildersByZIndex_[n]=r);let s=r[t];if(s===void 0){let o=xme[t];s=new o(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),r[t]=s}return s}},dY=z6;function T3(i,e,t,n,r,s,o,a){o=o??[],a=a??n;let l=i[e+n],c=i[e+n+1],u=i[t-2*n],f=i[t-2*n+1],d,A,y,w,S,T,R,P,I=0;for(let F=e;F<t;F+=n){y=d,w=A,S=void 0,T=void 0,F+n<t&&(S=i[F+n],T=i[F+n+1]),s&&F===e&&(y=u,w=f),s&&F===t-n&&(S=l,T=c),d=i[F],A=i[F+1],[R,P]=yme(d,A,y,w,S,T,r),o[I++]=R,o[I++]=P;for(let D=2;D<a;D++)o[I++]=i[F+D]}return o.length!=I&&(o.length=I),o}function yme(i,e,t,n,r,s,o){let a,l;t!==void 0&&n!==void 0?(a=i-t,l=e-n):r!==void 0&&s!==void 0?(a=r-i,l=s-e):(a=1,l=0);let c=Math.hypot(a,l),u=a/c,f=l/c;if(a=-f,l=u,t===void 0||n===void 0)return[i+a*o,e+l*o];if(r===void 0||s===void 0)return[i+a*o,e+l*o];let d=MW([i,e],[t,n],[r,s]);if(Math.cos(d)>.998)return[i+u*o,e+f*o];let A=Math.cos(d/2),y=Math.sin(d/2),w=y*a+A*l,S=-A*a+y*l,T=w*(1/y),R=S*(1/y);return[i+T*o,e+R*o]}function E3(i,e,t=!1){for(let n=0,r=i.length-2;n<r;n+=e){let s=t&&n===0?i.length-3*e:i.length-2*e;for(let o=s;o>n+e;o-=e){let a=i[n],l=i[n+1],c=i[n+e],u=i[n+e+1],f=i[o],d=i[o+1],A=i[o+e],y=i[o+e+1],w=(y-d)*(c-a)-(A-f)*(u-l);if(w===0)continue;let S=((A-f)*(l-d)-(y-d)*(a-f))/w,T=((c-a)*(l-d)-(u-l)*(a-f))/w;if(S>0&&S<1&&T>0&&T<1){let R=a+S*(c-a),P=l+S*(u-l);i[n+e]=R,i[n+e+1]=P,i.splice(n+2*e,o-n-e);break}}}return i}var V6;function bme(){return V6||(V6=new Intl.Segmenter(void 0,{granularity:"grapheme"})),V6}function pY(i,e,t,n,r,s,o,a,l,c,u,f,d=!0){let A=i[e],y=i[e+1],w=0,S=0,T=0,R=0;function P(){w=A,S=y,e+=n,A=i[e],y=i[e+1],R+=T,T=Math.sqrt((A-w)*(A-w)+(y-S)*(y-S))}do P();while(e<t-n&&R+T<s);let I=T===0?0:(s-R)/T,F=Po(w,A,I),D=Po(S,y,I),L=e-n,C=R,B=s+a*l(c,r,u);for(;e<t-n&&R+T<B;)P();I=T===0?0:(B-R)/T;let k=Po(w,A,I),z=Po(S,y,I),G=!1;if(d)if(f){let te=[F,D,k,z];wE(te,0,4,2,f,te,te),G=te[0]>te[2]}else G=F>k;let W=Math.PI,Y=[],H=L+n===e;e=L,T=0,R=C,A=i[e],y=i[e+1];let $;if(H){P(),$=Math.atan2(y-S,A-w),G&&($+=$>0?-W:W);let te=(k+F)/2,ce=(z+D)/2;return Y[0]=[te,ce,(B-s)/2,$,r],Y}r=r.replace(/\n/g," ");let J=Array.from(bme().segment(r),te=>te.segment);for(let te=0,ce=J.length;te<ce;){P();let he=Math.atan2(y-S,A-w);if(G&&(he+=he>0?-W:W),$!==void 0){let Ee=he-$;if(Ee+=Ee>W?-2*W:Ee<-W?2*W:0,Math.abs(Ee)>o)return null}$=he;let ve=te,Re=0;for(;te<ce;++te){let Ee=G?ce-te-1:te,Ve=a*l(c,J[Ee],u);if(e+n<t&&R+T<s+Re+Ve/2)break;Re+=Ve}if(te===ve)continue;let Qe=(G?J.slice(ce-te,ce-ve):J.slice(ve,te)).join("");I=T===0?0:(s+Re/2-R)/T;let Fe=Po(w,A,I),mt=Po(S,y,I);Y.push([Fe,mt,Re/2,he,Qe]),s+=Re}return Y}var Rv=Wr(),Hp=[],md=[],Ad=[],Wp=[];function mY(i){return i[3].declutterBox}var AY=new RegExp("[\u0591-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFC\u0800-\u0FFF\uE800-\uEFFF]");function G6(i,e){return e==="start"?e=AY.test(i)?"right":"left":e==="end"&&(e=AY.test(i)?"left":"right"),x2[e]}function wme(i,e,t){return t>0&&i.push(`8+`,""),i.push(e,""),i}function Sme(i,e,t){return t%2===0&&(i+=e),i}var q6=class{constructor(e,t,n,r,s){this.overlaps=n,this.pixelRatio=t,this.resolution=e,this.alignAndScaleFill_,this.instructions=r.instructions,this.coordinates=r.coordinates,this.coordinateCache_={},this.renderedTransform_=go(),this.hitDetectionInstructions=r.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=r.fillStates||{},this.strokeStates=r.strokeStates||{},this.textStates=r.textStates||{},this.widths_={},this.labels_={},this.zIndexContext_=s?new b3:null}getZIndexContext(){return this.zIndexContext_}createLabel(e,t,n,r){let s=e+t+n+r;if(this.labels_[s])return this.labels_[s];let o=r?this.strokeStates[r]:null,a=n?this.fillStates[n]:null,l=this.textStates[t],c=this.pixelRatio,u=[l.scale[0]*c,l.scale[1]*c],f=l.justify?x2[l.justify]:G6(Array.isArray(e)?e[0]:e,l.textAlign||Up),d=r&&o.lineWidth?o.lineWidth:0,A=Array.isArray(e)?e:String(e).split(`9+`).reduce(wme,[]),{width:y,height:w,widths:S,heights:T,lineWidths:R}=xX(l,A),P=y+d,I=[],F=(P+2)*u[0],D=(w+d)*u[1],L={width:F<0?Math.floor(F):Math.ceil(F),height:D<0?Math.floor(D):Math.ceil(D),contextInstructions:I};(u[0]!=1||u[1]!=1)&&I.push("scale",u),r&&(I.push("strokeStyle",o.strokeStyle),I.push("lineWidth",d),I.push("lineCap",o.lineCap),I.push("lineJoin",o.lineJoin),I.push("miterLimit",o.miterLimit),I.push("setLineDash",[o.lineDash]),I.push("lineDashOffset",o.lineDashOffset)),n&&I.push("fillStyle",a.fillStyle),I.push("textBaseline","middle"),I.push("textAlign","center");let C=.5-f,B=f*P+C*d,k=[],z=[],G=0,W=0,Y=0,H=0,$;for(let J=0,te=A.length;J<te;J+=2){let ce=A[J];if(ce===`10+`){W+=G,G=0,B=f*P+C*d,++H;continue}let he=A[J+1]||l.font;he!==$&&(r&&k.push("font",he),n&&z.push("font",he),$=he),G=Math.max(G,T[Y]);let ve=[ce,B+C*S[Y]+f*(S[Y]-R[H]),.5*(d+G)+W];B+=S[Y],r&&k.push("strokeText",ve),n&&z.push("fillText",ve),++Y}return Array.prototype.push.apply(I,k),Array.prototype.push.apply(I,z),this.labels_[s]=L,L}replayTextBackground_(e,t,n,r,s,o,a){e.beginPath(),e.moveTo.apply(e,t),e.lineTo.apply(e,n),e.lineTo.apply(e,r),e.lineTo.apply(e,s),e.lineTo.apply(e,t),o&&(this.alignAndScaleFill_=o[2],e.fillStyle=o[1],this.fill_(e)),a&&(this.setStrokeStyle_(e,a),e.stroke())}calculateImageOrLabelDimensions_(e,t,n,r,s,o,a,l,c,u,f,d,A,y,w,S){a*=d[0],l*=d[1];let T=n-a,R=r-l,P=s+c>e?e-c:s,I=o+u>t?t-u:o,F=y[3]+P*d[0]+y[1],D=y[0]+I*d[1]+y[2],L=T-y[3],C=R-y[0];(w||f!==0)&&(Hp[0]=L,Wp[0]=L,Hp[1]=C,md[1]=C,md[0]=L+F,Ad[0]=md[0],Ad[1]=C+D,Wp[1]=Ad[1]);let B;return f!==0?(B=Do(go(),n,r,1,1,f,-n,-r),jr(B,Hp),jr(B,md),jr(B,Ad),jr(B,Wp),ql(Math.min(Hp[0],md[0],Ad[0],Wp[0]),Math.min(Hp[1],md[1],Ad[1],Wp[1]),Math.max(Hp[0],md[0],Ad[0],Wp[0]),Math.max(Hp[1],md[1],Ad[1],Wp[1]),Rv)):ql(Math.min(L,L+F),Math.min(C,C+D),Math.max(L,L+F),Math.max(C,C+D),Rv),A&&(T=Math.round(T),R=Math.round(R)),{drawImageX:T,drawImageY:R,drawImageW:P,drawImageH:I,originX:c,originY:u,declutterBox:{minX:Rv[0],minY:Rv[1],maxX:Rv[2],maxY:Rv[3],value:S},canvasTransform:B,scale:d}}replayImageOrLabel_(e,t,n,r,s,o,a){let l=!!(o||a),c=r.declutterBox,u=a?a[2]*r.scale[0]/2:0;return c.minX-u<=t[0]&&c.maxX+u>=0&&c.minY-u<=t[1]&&c.maxY+u>=0&&(l&&this.replayTextBackground_(e,Hp,md,Ad,Wp,o,a),yX(e,r.canvasTransform,s,n,r.originX,r.originY,r.drawImageW,r.drawImageH,r.drawImageX,r.drawImageY,r.scale)),!0}fill_(e){let t=this.alignAndScaleFill_;if(t){let n=jr(this.renderedTransform_,[0,0]),r=512*this.pixelRatio;e.save(),e.translate(n[0]%r,n[1]%r),t!==1&&e.scale(t,t)}e.fill(),t&&e.restore()}setStrokeStyle_(e,t){e.strokeStyle=t[1],t[1]&&(e.lineWidth=t[2],e.lineCap=t[3],e.lineJoin=t[4],e.miterLimit=t[5],e.lineDashOffset=t[7],e.setLineDash(t[6]))}drawLabelWithPointPlacement_(e,t,n,r){let s=this.textStates[t],o=this.createLabel(e,t,r,n),a=this.strokeStates[n],l=this.pixelRatio,c=G6(Array.isArray(e)?e[0]:e,s.textAlign||Up),u=x2[s.textBaseline||_A],f=a&&a.lineWidth?a.lineWidth:0,d=o.width/l-2*s.scale[0],A=c*d+2*(.5-c)*f,y=u*o.height/l+2*(.5-u)*f;return{label:o,anchorX:A,anchorY:y}}execute_(e,t,n,r,s,o,a,l){let c=this.zIndexContext_,u;this.pixelCoordinates_&&ea(n,this.renderedTransform_)?u=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),u=ml(this.coordinates,0,this.coordinates.length,2,n,this.pixelCoordinates_),wj(this.renderedTransform_,n));let f=0,d=r.length,A=0,y,w=[],S,T,R,P,I,F,D,L,C,B,k,z,G,W=0,Y=0,H=this.coordinateCache_,$=this.viewRotation_,J=Math.round(Math.atan2(-n[1],n[0])*1e12)/1e12,te={context:e,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:$},ce=this.instructions!=r||this.overlaps?0:200,he,ve,Re,Qe;for(;f<d;){let Fe=r[f];switch(Fe[0]){case vn.BEGIN_GEOMETRY:he=Fe[1],Qe=Fe[3],he.getGeometry()?a!==void 0&&!Ar(a,Qe.getExtent())?f=Fe[2]+1:++f:f=Fe[2],c&&(c.zIndex=Fe[4]);break;case vn.BEGIN_PATH:W>ce&&(this.fill_(e),W=0),Y>ce&&(e.stroke(),Y=0),!W&&!Y&&(e.beginPath(),I=NaN,F=NaN),++f;break;case vn.CIRCLE:A=Fe[1],R=Fe[2]??0;let Ee=u[A],Ve=u[A+1],Ye=u[A+2]-R,Mt=u[A+3]-R,Et=Ye-Ee,It=Mt-Ve,dn=Math.sqrt(Et*Et+It*It);e.moveTo(Ee+dn,Ve),e.arc(Ee,Ve,dn,0,2*Math.PI,!0),++f;break;case vn.CLOSE_PATH:e.closePath(),++f;break;case vn.CUSTOM:A=Fe[1],y=Fe[2];let Gt=Fe[3],$e=Fe[4],ot=Fe[5];te.geometry=Gt,te.feature=he,f in H||(H[f]=[]);let nt=H[f];ot?ot(u,A,y,2,nt):(nt[0]=u[A],nt[1]=u[A+1],nt.length=2),c&&(c.zIndex=Fe[6]),$e(nt,te),++f;break;case vn.DRAW_IMAGE:A=Fe[1],y=Fe[2],C=Fe[3],S=Fe[4],T=Fe[5];let bt=Fe[6],yt=Fe[7],hn=Fe[8],en=Fe[9],tn=Fe[10],bn=Fe[11],_e=Fe[12],vi=Fe[13];P=Fe[14]||"declutter";let zn=Fe[15];if(!C&&Fe.length>=20){B=Fe[19],k=Fe[20],z=Fe[21],G=Fe[22];let Fn=this.drawLabelWithPointPlacement_(B,k,z,G);C=Fn.label,Fe[3]=C;let is=Fe[23];S=(Fn.anchorX-is)*this.pixelRatio,Fe[4]=S;let Lr=Fe[24];T=(Fn.anchorY-Lr)*this.pixelRatio,Fe[5]=T,bt=C.height,Fe[6]=bt,vi=C.width,Fe[13]=vi}let le;Fe.length>25&&(le=Fe[25]);let Z,Te,Pe;Fe.length>17?(Z=Fe[16],Te=Fe[17],Pe=Fe[18]):(Z=od,Te=null,Pe=null),tn&&J?bn+=$:!tn&&!J&&(bn-=$);let Ge=0;for(;A<y;A+=2){if(le&&le[Ge++]<vi/this.pixelRatio)continue;let Fn=this.calculateImageOrLabelDimensions_(C.width,C.height,u[A],u[A+1],vi,bt,S,T,hn,en,bn,_e,s,Z,!!Te||!!Pe,he),is=[e,t,C,Fn,yt,Te,Pe];if(l){let Lr,Fl,wa;if(zn){let xr=y-A;if(!zn[xr]){zn[xr]={args:is,declutterMode:P};continue}let Ks=zn[xr];Lr=Ks.args,Fl=Ks.declutterMode,delete zn[xr],wa=mY(Lr)}let Bl,rl;if(Lr&&(Fl!=="declutter"||!l.collides(wa))&&(Bl=!0),(P!=="declutter"||!l.collides(Fn.declutterBox))&&(rl=!0),Fl==="declutter"&&P==="declutter"){let xr=Bl&&rl;Bl=xr,rl=xr}Bl&&(Fl!=="none"&&l.insert(wa),this.replayImageOrLabel_.apply(this,Lr)),rl&&(P!=="none"&&l.insert(Fn.declutterBox),this.replayImageOrLabel_.apply(this,is))}else this.replayImageOrLabel_.apply(this,is)}++f;break;case vn.DRAW_CHARS:let vt=Fe[1],Tt=Fe[2],qe=Fe[3],Je=Fe[4];G=Fe[5];let Pt=Fe[6],rn=Fe[7],Lt=Fe[8];z=Fe[9];let Rt=Fe[10];B=Fe[11],Array.isArray(B)&&(B=B.reduce(Sme,"")),k=Fe[12];let fn=[Fe[13],Fe[13]];P=Fe[14]||"declutter";let wn=Fe[15],Dn=Fe[16],ye=this.textStates[k],wt=ye.font,Ze=[ye.scale[0]*rn,ye.scale[1]*rn],St;wt in this.widths_?St=this.widths_[wt]:(St={},this.widths_[wt]=St);let Bt=mv(u,vt,Tt,2),ut=Math.abs(Ze[0])*YN(wt,B,St);if(Je||ut<=Bt){let Fn=this.textStates[k].textAlign,is=(Bt-ut)*G6(B,Fn),Lr=pY(u,vt,Tt,2,B,is,Pt,Math.abs(Ze[0]),YN,wt,St,J?0:this.viewRotation_,wn);e:if(Lr){let Fl=[],wa,Bl,rl,xr,Ks;if(z)for(wa=0,Bl=Lr.length;wa<Bl;++wa){Ks=Lr[wa],rl=Ks[4],xr=this.createLabel(rl,k,"",z),S=Ks[2]+(Ze[0]<0?-Rt:Rt)-Dn,T=qe*xr.height+(.5-qe)*2*Rt*Ze[1]/Ze[0]-Lt;let Ol=this.calculateImageOrLabelDimensions_(xr.width,xr.height,Ks[0],Ks[1],xr.width,xr.height,S,T,0,0,Ks[3],fn,!1,od,!1,he);if(l&&P==="declutter"&&l.collides(Ol.declutterBox))break e;Fl.push([e,t,xr,Ol,1,null,null])}if(G)for(wa=0,Bl=Lr.length;wa<Bl;++wa){Ks=Lr[wa],rl=Ks[4],xr=this.createLabel(rl,k,G,""),S=Ks[2]-Dn,T=qe*xr.height-Lt;let Ol=this.calculateImageOrLabelDimensions_(xr.width,xr.height,Ks[0],Ks[1],xr.width,xr.height,S,T,0,0,Ks[3],fn,!1,od,!1,he);if(l&&P==="declutter"&&l.collides(Ol.declutterBox))break e;Fl.push([e,t,xr,Ol,1,null,null])}l&&P!=="none"&&l.load(Fl.map(mY));for(let Ol=0,rh=Fl.length;Ol<rh;++Ol)this.replayImageOrLabel_.apply(this,Fl[Ol])}}++f;break;case vn.END_GEOMETRY:if(o!==void 0){he=Fe[1];let Fn=o(he,Qe,P);if(Fn)return Fn}++f;break;case vn.FILL:ce?W++:this.fill_(e),++f;break;case vn.MOVE_TO_LINE_TO:A=Fe[1],y=Fe[2],R=Fe[3];let Ce,Yt,nr;if(R){let is=(Fe[4]??!1)||Math.abs(u[A]-u[y-2])<1e-6&&Math.abs(u[A+1]-u[y-1])<1e-6;T3(u,A,y,2,R,is,w),E3(w,2,is),Ce=w,Yt=0,nr=Ce.length}else Ce=u,Yt=A,nr=y;ve=Ce[Yt],Re=Ce[Yt+1],e.moveTo(ve,Re),I=ve+.5|0,F=Re+.5|0;for(let Fn=Yt+2;Fn<nr;Fn+=2)ve=Ce[Fn],Re=Ce[Fn+1],D=ve+.5|0,L=Re+.5|0,(Fn==nr-2||D!==I||L!==F)&&(e.lineTo(ve,Re),I=D,F=L);++f;break;case vn.SET_FILL_STYLE:this.alignAndScaleFill_=Fe[2],W?(this.fill_(e),W=0,Y&&(e.stroke(),Y=0)):Y&&Fe[1]&&(e.stroke(),Y=0),e.fillStyle=Fe[1],++f;break;case vn.SET_STROKE_STYLE:W&&Fe[1]&&(this.fill_(e),W=0),Y&&(e.stroke(),Y=0),this.setStrokeStyle_(e,Fe),++f;break;case vn.STROKE:ce?Y++:e.stroke(),++f;break;default:++f;break}}W&&this.fill_(e),Y&&e.stroke()}execute(e,t,n,r,s,o){this.viewRotation_=r,this.execute_(e,t,n,this.instructions,s,void 0,void 0,o)}executeHitDetection(e,t,n,r,s){return this.viewRotation_=n,this.execute_(e,[e.canvas.width,e.canvas.height],t,this.hitDetectionInstructions,!0,r,s)}},gY=q6;var jp=["Polygon","Circle","LineString","Image","Text","Default"],j6=["Image","Text"],vY=jp.filter(i=>!j6.includes(i)),_Y=!1,xY=!1;function Tme(){let i=0,e=n=>{let r=Di(1,1,null,{willReadFrequently:n}),s=0,o=performance.now();for(;performance.now()-o<50;++s)r.fillStyle=`rgba(255,0,${s%256},1)`,r.fillRect(0,0,1,1),r.getImageData(0,0,1,1);return i=s>i?s:i,s};_Y={[e(!0)]:!0,[e(!1)]:!1,[e(void 0)]:void 0}[i],xY=!0}var W6=class{constructor(e,t,n,r,s,o,a){this.maxExtent_=e,this.overlaps_=r,this.pixelRatio_=n,this.resolution_=t,this.renderBuffer_=o,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=go(),this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(s,a)}clip(e,t){let n=this.getClipCoords(t);e.beginPath(),e.moveTo(n[0],n[1]),e.lineTo(n[2],n[3]),e.lineTo(n[4],n[5]),e.lineTo(n[6],n[7]),e.clip()}createExecutors_(e,t){for(let n in e){let r=this.executorsByZIndex_[n];r===void 0&&(r={},this.executorsByZIndex_[n]=r);let s=e[n];for(let o in s){let a=s[o];r[o]=new gY(this.resolution_,this.pixelRatio_,this.overlaps_,a,t)}}}hasExecutors(e){for(let t in this.executorsByZIndex_){let n=this.executorsByZIndex_[t];for(let r=0,s=e.length;r<s;++r)if(e[r]in n)return!0}return!1}forEachFeatureAtCoordinate(e,t,n,r,s,o){xY===!1&&Tme(),r=Math.round(r);let a=r*2+1,l=Do(this.hitDetectionTransform_,r+.5,r+.5,1/t,-1/t,-n,-e[0],-e[1]),c=!this.hitDetectionContext_;c&&(this.hitDetectionContext_=Di(a,a,null,{willReadFrequently:_Y}));let u=this.hitDetectionContext_;u.canvas.width!==a||u.canvas.height!==a?(u.canvas.width=a,u.canvas.height=a):c||u.clearRect(0,0,a,a);let f;this.renderBuffer_!==void 0&&(f=Wr(),Jm(f,e),H1(f,t*(this.renderBuffer_+r),f));let d=Eme(r),A;function y(F,D,L){let C=u.getImageData(0,0,a,a).data;for(let B=0,k=d.length;B<k;B++)if(C[d[B]]>0){if(!o||L==="none"||A!=="Image"&&A!=="Text"||o.includes(F)){let z=(d[B]-3)/4,G=r-z%a,W=r-(z/a|0),Y=s(F,D,G*G+W*W);if(Y)return Y}u.clearRect(0,0,a,a);break}}let w=Object.keys(this.executorsByZIndex_).map(Number);w.sort(pl);let S,T,R,P,I;for(S=w.length-1;S>=0;--S){let F=w[S].toString();for(R=this.executorsByZIndex_[F],T=jp.length-1;T>=0;--T)if(A=jp[T],P=R[A],P!==void 0&&(I=P.executeHitDetection(u,l,n,y,f),I))return I}}getClipCoords(e){let t=this.maxExtent_;if(!t)return null;let n=t[0],r=t[1],s=t[2],o=t[3],a=[n,r,n,o,s,o,s,r];return ml(a,0,8,2,e,a),a}isEmpty(){return vu(this.executorsByZIndex_)}execute(e,t,n,r,s,o,a){let l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(a?KW:pl),o=o||jp;let c=jp.length;for(let u=0,f=l.length;u<f;++u){let d=l[u].toString(),A=this.executorsByZIndex_[d];for(let y=0,w=o.length;y<w;++y){let S=o[y],T=A[S];if(T!==void 0){let R=a===null?void 0:T.getZIndexContext(),P=R?R.getContext():e,I=this.maxExtent_&&S!=="Image"&&S!=="Text";if(I&&(P.save(),this.clip(P,n)),!R||S==="Text"||S==="Image"?T.execute(P,t,n,r,s,a):R.pushFunction(F=>T.execute(F,t,n,r,s,a)),I&&P.restore(),R){R.offset();let F=l[u]*c+jp.indexOf(S);this.deferredZIndexContexts_[F]||(this.deferredZIndexContexts_[F]=[]),this.deferredZIndexContexts_[F].push(R)}}}}this.renderedContext_=e}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){let e=this.deferredZIndexContexts_,t=Object.keys(e).map(Number).sort(pl);for(let n=0,r=t.length;n<r;++n)e[t[n]].forEach(s=>{s.draw(this.renderedContext_),s.clear()}),e[t[n]].length=0}},H6={};function Eme(i){if(H6[i]!==void 0)return H6[i];let e=i*2+1,t=i*i,n=new Array(t+1);for(let s=0;s<=i;++s)for(let o=0;o<=i;++o){let a=s*s+o*o;if(a>t)break;let l=n[a];l||(l=[],n[a]=l),l.push(((i+s)*e+(i+o))*4+3),s>0&&l.push(((i-s)*e+(i+o))*4+3),o>0&&(l.push(((i+s)*e+(i-o))*4+3),s>0&&l.push(((i-s)*e+(i-o))*4+3))}let r=[];for(let s=0,o=n.length;s<o;++s)n[s]&&r.push(...n[s]);return H6[i]=r,r}var yY=W6;var X6=class extends S3{constructor(e,t,n,r,s,o,a){super(),this.context_=e,this.pixelRatio_=t,this.extent_=n,this.transform_=r,this.transformRotation_=r?eA(Math.atan2(r[1],r[0]),10):0,this.viewRotation_=s,this.squaredTolerance_=o,this.userTransform_=a,this.contextFillState_=null,this.contextStrokeState_=null,this.contextTextState_=null,this.fillState_=null,this.strokeState_=null,this.image_=null,this.imageAnchorX_=0,this.imageAnchorY_=0,this.imageHeight_=0,this.imageOpacity_=0,this.imageOriginX_=0,this.imageOriginY_=0,this.imageRotateWithView_=!1,this.imageRotation_=0,this.imageScale_=[0,0],this.imageWidth_=0,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=!1,this.textRotation_=0,this.textScale_=[0,0],this.textFillState_=null,this.textStrokeState_=null,this.textState_=null,this.pixelCoordinates_=[],this.tmpLocalTransform_=go()}drawImages_(e,t,n,r){if(!this.image_)return;let s=ml(e,t,n,r,this.transform_,this.pixelCoordinates_),o=this.context_,a=this.tmpLocalTransform_,l=o.globalAlpha;this.imageOpacity_!=1&&(o.globalAlpha=l*this.imageOpacity_);let c=this.imageRotation_;this.transformRotation_===0&&(c-=this.viewRotation_),this.imageRotateWithView_&&(c+=this.viewRotation_);for(let u=0,f=s.length;u<f;u+=2){let d=s[u]-this.imageAnchorX_,A=s[u+1]-this.imageAnchorY_;if(c!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){let y=d+this.imageAnchorX_,w=A+this.imageAnchorY_;Do(a,y,w,1,1,c,-y,-w),o.save(),o.transform.apply(o,a),o.translate(y,w),o.scale(this.imageScale_[0],this.imageScale_[1]),o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),o.restore()}else o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,d,A,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(o.globalAlpha=l)}drawText_(e,t,n,r){if(!this.textState_||this.text_==="")return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);let s=ml(e,t,n,r,this.transform_,this.pixelCoordinates_),o=this.context_,a=this.textRotation_;for(this.transformRotation_===0&&(a-=this.viewRotation_),this.textRotateWithView_&&(a+=this.viewRotation_);t<n;t+=r){let l=s[t]+this.textOffsetX_,c=s[t+1]+this.textOffsetY_;a!==0||this.textScale_[0]!=1||this.textScale_[1]!=1?(o.save(),o.translate(l-this.textOffsetX_,c-this.textOffsetY_),o.rotate(a),o.translate(this.textOffsetX_,this.textOffsetY_),o.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&o.strokeText(this.text_,0,0),this.textFillState_&&o.fillText(this.text_,0,0),o.restore()):(this.textStrokeState_&&o.strokeText(this.text_,l,c),this.textFillState_&&o.fillText(this.text_,l,c))}}moveToLineTo_(e,t,n,r,s,o){let a=this.context_,l=ml(e,t,n,r,this.transform_,this.pixelCoordinates_);if(Math.abs(o)>0){let u=l.length,f=s||Math.abs(l[0]-l[u-2])<1e-6&&Math.abs(l[1]-l[u-1])<1e-6;l=T3(l,0,u,2,o,f,l),E3(l,2,f)}a.moveTo(l[0],l[1]);let c=l.length;s&&(c-=2);for(let u=2;u<c;u+=2)a.lineTo(l[u],l[u+1]);return s&&a.closePath(),n}drawRings_(e,t,n,r,s){for(let o=0,a=n.length;o<a;++o)t=this.moveToLineTo_(e,t,n[o],r,!0,s);return t}drawCircle(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ar(this.extent_,e.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let t=qj(e,this.transform_,this.pixelCoordinates_),n=t[2]-t[0],r=t[3]-t[1],s=Math.sqrt(n*n+r*r),o=this.context_;o.beginPath(),o.arc(t[0],t[1],s,0,2*Math.PI),this.fillState_&&o.fill(),this.strokeState_&&o.stroke()}this.text_!==""&&this.drawText_(e.getCenter(),0,2,2)}}setStyle(e){this.setFillStrokeStyle(e.getFill(),e.getStroke()),this.setImageStyle(e.getImage()),this.setTextStyle(e.getText())}setTransform(e){this.transform_=e}drawGeometry(e){switch(e.getType()){case"Point":this.drawPoint(e);break;case"LineString":this.drawLineString(e);break;case"Polygon":this.drawPolygon(e);break;case"MultiPoint":this.drawMultiPoint(e);break;case"MultiLineString":this.drawMultiLineString(e);break;case"MultiPolygon":this.drawMultiPolygon(e);break;case"GeometryCollection":this.drawGeometryCollection(e);break;case"Circle":this.drawCircle(e);break;default:}}drawFeature(e,t){let n=t.getGeometryFunction()(e);n&&(this.setStyle(t),this.drawGeometry(n))}drawGeometryCollection(e){let t=e.getGeometriesArray();for(let n=0,r=t.length;n<r;++n)this.drawGeometry(t[n])}drawPoint(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let t=e.getFlatCoordinates(),n=e.getStride();this.image_&&this.drawImages_(t,0,t.length,n),this.text_!==""&&this.drawText_(t,0,t.length,n)}drawMultiPoint(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let t=e.getFlatCoordinates(),n=e.getStride();this.image_&&this.drawImages_(t,0,t.length,n),this.text_!==""&&this.drawText_(t,0,t.length,n)}drawLineString(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ar(this.extent_,e.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);let t=this.context_,n=e.getFlatCoordinates();t.beginPath(),this.moveToLineTo_(n,0,n.length,e.getStride(),!1,this.strokeState_.strokeOffset),t.stroke()}if(this.text_!==""){let t=e.getFlatMidpoint();this.drawText_(t,0,2,2)}}}drawMultiLineString(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let t=e.getExtent();if(Ar(this.extent_,t)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);let n=this.context_,r=e.getFlatCoordinates(),s=0,o=e.getEnds(),a=e.getStride();n.beginPath();for(let l=0,c=o.length;l<c;++l)s=this.moveToLineTo_(r,s,o[l],a,!1,this.strokeState_.strokeOffset);n.stroke()}if(this.text_!==""){let n=e.getFlatMidpoints();this.drawText_(n,0,n.length,2)}}}drawPolygon(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ar(this.extent_,e.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let t=this.context_;t.beginPath(),this.drawRings_(e.getOrientedFlatCoordinates(),0,e.getEnds(),e.getStride(),this.strokeState_?.strokeOffset),this.fillState_&&t.fill(),this.strokeState_&&t.stroke()}if(this.text_!==""){let t=e.getFlatInteriorPoint();this.drawText_(t,0,2,2)}}}drawMultiPolygon(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Ar(this.extent_,e.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let t=this.context_,n=e.getOrientedFlatCoordinates(),r=0,s=e.getEndss(),o=e.getStride();t.beginPath();for(let a=0,l=s.length;a<l;++a){let c=s[a];r=this.drawRings_(n,r,c,o,this.strokeState_?.strokeOffset)}this.fillState_&&t.fill(),this.strokeState_&&t.stroke()}if(this.text_!==""){let t=e.getFlatInteriorPoints();this.drawText_(t,0,t.length,2)}}}setContextFillState_(e){let t=this.context_,n=this.contextFillState_;n?n.fillStyle!=e.fillStyle&&(n.fillStyle=e.fillStyle,t.fillStyle=e.fillStyle):(t.fillStyle=e.fillStyle,this.contextFillState_={fillStyle:e.fillStyle})}setContextStrokeState_(e){let t=this.context_,n=this.contextStrokeState_;n?(n.lineCap!=e.lineCap&&(n.lineCap=e.lineCap,t.lineCap=e.lineCap),ea(n.lineDash,e.lineDash)||t.setLineDash(n.lineDash=e.lineDash),n.lineDashOffset!=e.lineDashOffset&&(n.lineDashOffset=e.lineDashOffset,t.lineDashOffset=e.lineDashOffset),n.lineJoin!=e.lineJoin&&(n.lineJoin=e.lineJoin,t.lineJoin=e.lineJoin),n.lineWidth!=e.lineWidth&&(n.lineWidth=e.lineWidth,t.lineWidth=e.lineWidth),n.miterLimit!=e.miterLimit&&(n.miterLimit=e.miterLimit,t.miterLimit=e.miterLimit),n.strokeStyle!=e.strokeStyle&&(n.strokeStyle=e.strokeStyle,t.strokeStyle=e.strokeStyle)):(t.lineCap=e.lineCap,t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset,t.lineJoin=e.lineJoin,t.lineWidth=e.lineWidth,t.miterLimit=e.miterLimit,t.strokeStyle=e.strokeStyle,this.contextStrokeState_={lineCap:e.lineCap,lineDash:e.lineDash,lineDashOffset:e.lineDashOffset,lineJoin:e.lineJoin,lineWidth:e.lineWidth,miterLimit:e.miterLimit,strokeStyle:e.strokeStyle})}setContextTextState_(e){let t=this.context_,n=this.contextTextState_,r=e.textAlign?e.textAlign:Up;n?(n.font!=e.font&&(n.font=e.font,t.font=e.font),n.textAlign!=r&&(n.textAlign=r,t.textAlign=r),n.textBaseline!=e.textBaseline&&(n.textBaseline=e.textBaseline,t.textBaseline=e.textBaseline)):(t.font=e.font,t.textAlign=r,t.textBaseline=e.textBaseline,this.contextTextState_={font:e.font,textAlign:r,textBaseline:e.textBaseline})}setFillStrokeStyle(e,t){if(!e)this.fillState_=null;else{let n=e.getColor();this.fillState_={fillStyle:gl(n||ro)}}if(!t)this.strokeState_=null;else{let n=t.getColor(),r=t.getLineCap(),s=t.getLineDash(),o=t.getLineDashOffset(),a=t.getLineJoin(),l=t.getWidth(),c=t.getMiterLimit(),u=s||vl,f=t.getOffset();this.strokeState_={lineCap:r!==void 0?r:xh,lineDash:this.pixelRatio_===1?u:u.map(d=>d*this.pixelRatio_),lineDashOffset:(o||_l)*this.pixelRatio_,lineJoin:a!==void 0?a:yh,lineWidth:(l!==void 0?l:ad)*this.pixelRatio_,miterLimit:c!==void 0?c:sd,strokeStyle:gl(n||na),strokeOffset:(f??0)*this.pixelRatio_}}}setImageStyle(e){let t;if(!e||!(t=e.getSize())){this.image_=null;return}let n=e.getPixelRatio(this.pixelRatio_),r=e.getAnchor(),s=e.getOrigin();this.image_=e.getImage(this.pixelRatio_),this.imageAnchorX_=r[0]*n,this.imageAnchorY_=r[1]*n,this.imageHeight_=t[1]*n,this.imageOpacity_=e.getOpacity(),this.imageOriginX_=s[0],this.imageOriginY_=s[1],this.imageRotateWithView_=e.getRotateWithView(),this.imageRotation_=e.getRotation();let o=e.getScaleArray();this.imageScale_=[o[0]*this.pixelRatio_/n,o[1]*this.pixelRatio_/n],this.imageWidth_=t[0]*n}setTextStyle(e){if(!e)this.text_="";else{let t=e.getFill();if(!t)this.textFillState_=null;else{let A=t.getColor();this.textFillState_={fillStyle:gl(A||ro)}}let n=e.getStroke();if(!n)this.textStrokeState_=null;else{let A=n.getColor(),y=n.getLineCap(),w=n.getLineDash(),S=n.getLineDashOffset(),T=n.getLineJoin(),R=n.getWidth(),P=n.getMiterLimit();this.textStrokeState_={lineCap:y!==void 0?y:xh,lineDash:w||vl,lineDashOffset:S||_l,lineJoin:T!==void 0?T:yh,lineWidth:R!==void 0?R:ad,miterLimit:P!==void 0?P:sd,strokeStyle:gl(A||na)}}let r=e.getFont(),s=e.getOffsetX(),o=e.getOffsetY(),a=e.getRotateWithView(),l=e.getRotation(),c=e.getScaleArray(),u=e.getText(),f=e.getTextAlign(),d=e.getTextBaseline();this.textState_={font:r!==void 0?r:zE,textAlign:f!==void 0?f:Up,textBaseline:d!==void 0?d:_A},this.text_=u!==void 0?Array.isArray(u)?u.reduce((A,y,w)=>A+=w%2?" ":y,""):u:"",this.textOffsetX_=s!==void 0?this.pixelRatio_*s:0,this.textOffsetY_=o!==void 0?this.pixelRatio_*o:0,this.textRotateWithView_=a!==void 0?a:!1,this.textRotation_=l!==void 0?l:0,this.textScale_=[this.pixelRatio_*c[0],this.pixelRatio_*c[1]]}}},bY=X6;var Ru=.5;function wY(i,e,t,n,r,s,o,a,l){let c=l?Mp(r,l):r,u=i[0]*Ru,f=i[1]*Ru,d=Di(u,f);d.imageSmoothingEnabled=!1;let A=d.canvas,y=new bY(d,Ru,r,null,o,a,l?iA(sA(),l):null),w=t.length,S=Math.floor((256*256*256-1)/w),T={};for(let P=1;P<=w;++P){let I=t[P-1],F=I.getStyleFunction()||n;if(!F)continue;let D=F(I,s);if(!D)continue;Array.isArray(D)||(D=[D]);let C=(P*S).toString(16).padStart(7,"#00000");for(let B=0,k=D.length;B<k;++B){let z=D[B],G=z.getGeometryFunction()(I);if(!G||!Ar(c,G.getExtent()))continue;let W=z.clone(),Y=W.getFill();Y&&Y.setColor(C);let H=W.getStroke();H&&(H.setColor(C),H.setLineDash(null)),W.setText(void 0);let $=z.getImage();if($){let he=$.getImageSize();if(!he)continue;let ve=Di(he[0],he[1],void 0,{alpha:!1}),Re=ve.canvas;ve.fillStyle=C,ve.fillRect(0,0,Re.width,Re.height),W.setImage(new xA({img:Re,anchor:$.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:$.getOrigin(),opacity:1,size:$.getSize(),scale:$.getScale(),rotation:$.getRotation(),rotateWithView:$.getRotateWithView()}))}let J=W.getZIndex()||0,te=T[J];te||(te={},T[J]=te,te.Polygon=[],te.Circle=[],te.LineString=[],te.Point=[]);let ce=G.getType();if(ce==="GeometryCollection"){let he=G.getGeometriesArrayRecursive();for(let ve=0,Re=he.length;ve<Re;++ve){let Qe=he[ve];te[Qe.getType().replace("Multi","")].push(Qe,W)}}else te[ce.replace("Multi","")].push(G,W)}}let R=Object.keys(T).map(Number).sort(pl);for(let P=0,I=R.length;P<I;++P){let F=T[R[P]];for(let D in F){let L=F[D];for(let C=0,B=L.length;C<B;C+=2){y.setStyle(L[C+1]);for(let k=0,z=e.length;k<z;++k)y.setTransform(e[k]),y.drawGeometry(L[C])}}}return d.getImageData(0,0,A.width,A.height)}function SY(i,e,t){let n=[];if(t){let r=Math.floor(Math.round(i[0])*Ru),s=Math.floor(Math.round(i[1])*Ru),o=(Si(r,0,t.width-1)+Si(s,0,t.height-1)*t.width)*4,a=t.data[o],l=t.data[o+1],u=t.data[o+2]+256*(l+256*a),f=Math.floor((256*256*256-1)/e.length);u&&u%f===0&&n.push(e[u/f-1])}return n}var Mme=.5,TY={Point:Nme,LineString:Pme,Polygon:Bme,MultiPoint:Fme,MultiLineString:Lme,MultiPolygon:Dme,GeometryCollection:Ime,Circle:Cme};function EY(i,e){return parseInt(Bn(i),10)-parseInt(Bn(e),10)}function $6(i,e){let t=Y6(i,e);return t*t}function Y6(i,e){return Mme*i/e}function Cme(i,e,t,n,r){let s=t.getFill(),o=t.getStroke();if(s||o){let l=i.getBuilder(t.getZIndex(),"Circle");l.setFillStrokeStyle(s,o),l.drawCircle(e,n,r)}let a=t.getText();if(a&&a.getText()){let l=i.getBuilder(t.getZIndex(),"Text");l.setTextStyle(a),l.drawText(e,n,r)}}function Z6(i,e,t,n,r,s,o,a){let l=[],c=t.getImage();if(c){let d=!0,A=c.getImageState();A==In.LOADED||A==In.ERROR?d=!1:A==In.IDLE&&c.load(),d&&l.push(c.ready())}let u=t.getFill();u&&u.loading()&&l.push(u.ready());let f=l.length>0;return f&&Promise.all(l).then(()=>r(null)),Rme(i,e,t,n,s,o,a),f}function Rme(i,e,t,n,r,s,o){let a=t.getGeometryFunction()(e);if(!a)return;let l=a.simplifyTransformed(n,r);if(t.getRenderer())MY(i,l,t,e,o);else{let u=TY[l.getType()];u(i,l,t,e,o,s)}}function MY(i,e,t,n,r){if(e.getType()=="GeometryCollection"){let o=e.getGeometries();for(let a=0,l=o.length;a<l;++a)MY(i,o[a],t,n,r);return}i.getBuilder(t.getZIndex(),"Default").drawCustom(e,n,t.getRenderer(),t.getHitDetectionRenderer(),r)}function Ime(i,e,t,n,r,s){let o=e.getGeometriesArray(),a,l;for(a=0,l=o.length;a<l;++a){let c=TY[o[a].getType()];c(i,o[a],t,n,r,s)}}function Pme(i,e,t,n,r){let s=t.getStroke();if(s){let a=i.getBuilder(t.getZIndex(),"LineString");a.setFillStrokeStyle(null,s),a.drawLineString(e,n,r)}let o=t.getText();if(o&&o.getText()){let a=i.getBuilder(t.getZIndex(),"Text");a.setTextStyle(o),a.drawText(e,n,r)}}function Lme(i,e,t,n,r){let s=t.getStroke();if(s){let a=i.getBuilder(t.getZIndex(),"LineString");a.setFillStrokeStyle(null,s),a.drawMultiLineString(e,n,r)}let o=t.getText();if(o&&o.getText()){let a=i.getBuilder(t.getZIndex(),"Text");a.setTextStyle(o),a.drawText(e,n,r)}}function Dme(i,e,t,n,r){let s=t.getFill(),o=t.getStroke();if(o||s){let l=i.getBuilder(t.getZIndex(),"Polygon");l.setFillStrokeStyle(s,o),l.drawMultiPolygon(e,n,r)}let a=t.getText();if(a&&a.getText()){let l=i.getBuilder(t.getZIndex(),"Text");l.setTextStyle(a),l.drawText(e,n,r)}}function Nme(i,e,t,n,r,s){let o=t.getImage(),a=t.getText(),l=a&&a.getText(),c=s&&o&&l?{}:void 0;if(o){if(o.getImageState()!=In.LOADED)return;let u=i.getBuilder(t.getZIndex(),"Image");u.setImageStyle(o,c),u.drawPoint(e,n,r)}if(l){let u=i.getBuilder(t.getZIndex(),"Text");u.setTextStyle(a,c),u.drawText(e,n,r)}}function Fme(i,e,t,n,r,s){let o=t.getImage(),a=o&&o.getOpacity()!==0,l=t.getText(),c=l&&l.getText(),u=s&&a&&c?{}:void 0;if(a){if(o.getImageState()!=In.LOADED)return;let f=i.getBuilder(t.getZIndex(),"Image");f.setImageStyle(o,u),f.drawMultiPoint(e,n,r)}if(c){let f=i.getBuilder(t.getZIndex(),"Text");f.setTextStyle(l,u),f.drawText(e,n,r)}}function Bme(i,e,t,n,r){let s=t.getFill(),o=t.getStroke();if(s||o){let l=i.getBuilder(t.getZIndex(),"Polygon");l.setFillStrokeStyle(s,o),l.drawPolygon(e,n,r)}let a=t.getText();if(a&&a.getText()){let l=i.getBuilder(t.getZIndex(),"Text");l.setTextStyle(a),l.drawText(e,n,r)}}var K6=class extends w3{constructor(e){super(e),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.clipExtent_=null,this.extendX_=!1,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=Wr(),this.wrappedRenderedExtent_=Wr(),this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedPixelRatio_=1,this.renderedRenderOrder_=null,this.renderedFrameDeclutter_,this.replayGroup_=null,this.replayGroupChanged=!0,this.clipping=!0,this.targetContext_=null,this.opacity_=1}renderWorlds(e,t,n){let r=t.extent,s=t.viewState,o=s.center,a=s.resolution,l=s.projection,c=s.rotation,u=l.getExtent(),f=this.getLayer().getSource(),d=this.getLayer().getDeclutter(),A=t.pixelRatio,y=t.viewHints,w=!(y[so.ANIMATING]||y[so.INTERACTING]),S=this.context,T=Math.round(Kn(r)/a*A),R=Math.round(Dr(r)/a*A),P=f.getWrapX()&&l.canWrapX(),I=P?Kn(u):null,F=P?Math.ceil((r[2]-u[2])/I)+(this.extendX_?2:1):1,D=P?Math.floor((r[0]-u[0])/I)-(this.extendX_?1:0):0;do{let L=this.getRenderTransform(o,a,0,A,T,R,D*I);t.declutter&&(L=L.slice(0)),e.execute(S,[S.canvas.width,S.canvas.height],L,c,w,n===void 0?jp:n?j6:vY,n?d&&t.declutter[d]:void 0)}while(++D<F)}setDrawContext_(){this.opacity_!==1&&(this.targetContext_=this.context,this.context=Di(this.context.canvas.width,this.context.canvas.height,S6))}resetDrawContext_(){if(this.opacity_!==1&&this.targetContext_){let e=this.targetContext_.globalAlpha;this.targetContext_.globalAlpha=this.opacity_,this.targetContext_.drawImage(this.context.canvas,0,0),this.targetContext_.globalAlpha=e,cA(this.context),S6.push(this.context.canvas),this.context=this.targetContext_,this.targetContext_=null}}renderDeclutter(e){!this.replayGroup_||!this.getLayer().getDeclutter()||this.renderWorlds(this.replayGroup_,e,!0)}renderDeferredInternal(e){this.replayGroup_&&(this.clipExtent_&&this.clipUnrotated(this.context,e,this.clipExtent_),this.replayGroup_.renderDeferred(),this.clipExtent_&&(this.context.restore(),this.clipExtent_=null),this.resetDrawContext_())}renderFrame(e,t){let n=e.layerStatesArray[e.layerIndex];this.opacity_=n.opacity;let r=e.viewState;this.prepareContainer(e,t);let s=this.context,o=this.replayGroup_,a=o&&!o.isEmpty();if(!a&&!(this.getLayer().hasListener(Bo.PRERENDER)||this.getLayer().hasListener(Bo.POSTRENDER)))return this.container;this.setDrawContext_(),this.preRender(s,e);let l=r.projection;this.clipExtent_=null;let c=!1;if(a&&n.extent&&this.clipping){let u=yu(n.extent,l);a=Ar(u,e.extent),a&&!fh(u,e.extent)&&(e.declutter?this.clipExtent_=u:(this.clipUnrotated(s,e,u),c=!0))}return a&&this.renderWorlds(o,e,this.getLayer().getDeclutter()?!1:void 0),c&&s.restore(),this.postRender(s,e),this.renderedRotation_!==r.rotation&&(this.renderedRotation_=r.rotation,this.hitDetectionImageData_=null),e.declutter||this.resetDrawContext_(),this.container}getFeatures(e){return new Promise(t=>{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){let n=this.frameState.size.slice(),r=this.renderedCenter_,s=this.renderedResolution_,o=this.renderedRotation_,a=this.renderedProjection_,l=this.wrappedRenderedExtent_,c=this.getLayer(),u=[],f=n[0]*Ru,d=n[1]*Ru;u.push(this.getRenderTransform(r,s,o,Ru,f,d,0).slice());let A=c.getSource(),y=a.getExtent();if(A.getWrapX()&&a.canWrapX()&&!fh(y,l)){let S=l[0],T=Kn(y),R=0,P;for(;S<y[0];)--R,P=T*R,u.push(this.getRenderTransform(r,s,o,Ru,f,d,P).slice()),S+=T;for(R=0,S=l[2];S>y[2];)++R,P=T*R,u.push(this.getRenderTransform(r,s,o,Ru,f,d,P).slice()),S-=T}let w=sA();this.hitDetectionImageData_=wY(n,u,this.renderedFeatures_,c.getStyleFunction(),l,s,o,$6(s,this.renderedPixelRatio_),w?a:null)}t(SY(e,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(e,t,n,r,s){if(!this.replayGroup_)return;let o=t.viewState.resolution,a=t.viewState.rotation,l=this.getLayer(),c={},u=function(d,A,y){let w=Bn(d),S=c[w];if(S){if(S!==!0&&y<S.distanceSq){if(y===0)return c[w]=!0,s.splice(s.lastIndexOf(S),1),r(d,l,A);S.geometry=A,S.distanceSq=y}}else{if(y===0)return c[w]=!0,r(d,l,A);s.push(c[w]={feature:d,layer:l,geometry:A,distanceSq:y,callback:r})}},f=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(e,o,a,n,u,f?t.declutter?.[f]?.all().map(d=>d.value):null)}handleFontsChanged(){let e=this.getLayer();e.getVisible()&&this.replayGroup_&&e.changed()}handleStyleImageChange_(e){this.renderIfReadyAndVisible()}prepareFrame(e){let t=this.getLayer(),n=t.getSource();if(!n)return!1;let r=e.viewHints[so.ANIMATING],s=e.viewHints[so.INTERACTING],o=t.getUpdateWhileAnimating(),a=t.getUpdateWhileInteracting();if(this.ready&&!o&&r||!a&&s)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;let l=e.extent,c=e.viewState,u=c.projection,f=c.resolution,d=e.pixelRatio,A=t.getRevision(),y=t.getRenderBuffer(),w=t.getRenderOrder();w===void 0&&(w=EY);let S=c.center.slice(),T=H1(l,y*f),R=T.slice(),P=[T.slice()],I=u.getExtent(),F=n.getWrapX()&&u.canWrapX();if(this.extendX_=!1,F){let $=n.getExtent();$&&!ph($)&&(this.extendX_=$[0]<I[0]||$[2]>I[2])}if(F&&(!fh(I,e.extent)||this.extendX_)){let $=Kn(I),J=Math.max(Kn(T)/2,$),te=I[0],ce=I[2];this.extendX_&&(te-=$,ce+=$),T[0]=te-J,T[2]=ce+J,QT(S,u);let he=ID(P[0],u);he[0]<I[0]&&he[2]<I[2]?P.push([he[0]+$,he[1],he[2]+$,he[3]]):he[0]>I[0]&&he[2]>I[2]&&P.push([he[0]-$,he[1],he[2]-$,he[3]])}if(this.ready&&this.renderedResolution_==f&&this.renderedPixelRatio_===d&&this.renderedRevision_==A&&this.renderedRenderOrder_==w&&this.renderedFrameDeclutter_===!!e.declutter&&fh(this.wrappedRenderedExtent_,T))return ea(this.renderedExtent_,R)||(this.hitDetectionImageData_=null,this.renderedExtent_=R),this.renderedCenter_=S,this.replayGroupChanged=!1,!0;this.replayGroup_=null;let D=new dY(Y6(f,d),T,f,d),L=sA(),C;if(L){for(let $=0,J=P.length;$<J;++$){let te=P[$],ce=Mp(te,u);n.loadFeatures(ce,$W(f,u),L)}C=iA(L,u)}else for(let $=0,J=P.length;$<J;++$)n.loadFeatures(P[$],f,u);let B=$6(f,d),k=!0,z=($,J)=>{let te,ce=$.getStyleFunction()||t.getStyleFunction();if(ce&&(te=ce($,f)),te){let he=this.renderFeature($,B,te,D,C,this.getLayer().getDeclutter(),J);k=k&&!he}},G=Mp(T,u),W=n.getFeaturesInExtent(G);w&&W.sort(w);for(let $=0,J=W.length;$<J;++$)z(W[$],$);this.renderedFeatures_=W,this.ready=k;let Y=D.finish(),H=new yY(T,f,d,n.getOverlaps(),Y,t.getRenderBuffer(),!!e.declutter);return this.renderedResolution_=f,this.renderedRevision_=A,this.renderedRenderOrder_=w,this.renderedFrameDeclutter_=!!e.declutter,this.renderedExtent_=R,this.wrappedRenderedExtent_=T,this.renderedCenter_=S,this.renderedProjection_=u,this.renderedPixelRatio_=d,this.replayGroup_=H,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(e,t,n,r,s,o,a){if(!n)return!1;let l=!1;if(Array.isArray(n))for(let c=0,u=n.length;c<u;++c)l=Z6(r,e,n[c],t,this.boundHandleStyleImageChange_,s,o,a)||l;else l=Z6(r,e,n,t,this.boundHandleStyleImageChange_,s,o,a);return l}},CY=K6;var Q6=class extends _3{constructor(e){super(e)}createRenderer(){return new CY(this)}},RY=Q6;var Ome=!1;function Ume(i,e,t,n,r,s,o){let a=new XMLHttpRequest;a.open("GET",typeof i=="function"?i(t,n,r):i,!0),e.getType()=="arraybuffer"&&(a.responseType="arraybuffer"),a.withCredentials=Ome,a.onload=function(l){if(!a.status||a.status>=200&&a.status<300){let c=e.getType();try{let u;c=="text"||c=="json"?u=a.responseText:c=="xml"?u=a.responseXML||a.responseText:c=="arraybuffer"&&(u=a.response),u?s(e.readFeatures(u,{extent:t,featureProjection:r}),e.readProjection(u)):o()}catch{o()}}else o()},a.onerror=o,a.send()}function J6(i,e){return function(t,n,r,s,o){Ume(i,e,t,n,r,(a,l)=>{this.addFeatures(a),s!==void 0&&s(a)},()=>{this.changed(),o!==void 0&&o()})}}function IY(i,e){return[[-1/0,-1/0,1/0,1/0]]}var PY=go(),y2=class i{constructor(e,t,n,r,s,o){this.styleFunction,this.extent_,this.id_=o,this.type_=e,this.flatCoordinates_=t,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=n||null,this.properties_=s,this.squaredTolerance_,this.stride_=r,this.simplifiedGeometry_}get(e){return this.properties_[e]}getExtent(){return this.extent_||(this.extent_=this.type_==="Point"?WT(this.flatCoordinates_):W1(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){let e=dl(this.getExtent());this.flatInteriorPoints_=Hy(this.flatCoordinates_,0,this.ends_,this.stride_,e,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){let e=rX(this.flatCoordinates_,this.ends_),t=IE(this.flatCoordinates_,0,e,this.stride_);this.flatInteriorPoints_=ME(this.flatCoordinates_,0,e,this.stride_,t)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=yA(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,.5)),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];let e=this.flatCoordinates_,t=0,n=this.ends_;for(let r=0,s=n.length;r<s;++r){let o=n[r],a=yA(e,t,o,this.stride_,.5);Lo(this.flatMidpoints_,a),t=o}}return this.flatMidpoints_}getId(){return this.id_}getOrientedFlatCoordinates(){return this.flatCoordinates_}getGeometry(){return this}getSimplifiedGeometry(e){return this}simplifyTransformed(e,t){return this}getProperties(){return this.properties_}getPropertiesInternal(){return this.properties_}getStride(){return this.stride_}getStyleFunction(){return this.styleFunction}getType(){return this.type_}transform(e){e=ks(e);let t=e.getExtent(),n=e.getWorldExtent();if(t&&n){let r=Dr(n)/Dr(t);Do(PY,n[0],n[3],r,-r,0,0,0),ml(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,PY,this.flatCoordinates_)}}applyTransform(e){e(this.flatCoordinates_,this.flatCoordinates_,this.stride_)}clone(){return new i(this.type_,this.flatCoordinates_.slice(),this.ends_?.slice(),this.stride_,Object.assign({},this.properties_),this.id_)}getEnds(){return this.ends_}enableSimplifyTransformed(){return this.simplifyTransformed=hE((e,t)=>{if(e===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),t&&this.simplifiedGeometry_.applyTransform(t);let n=this.simplifiedGeometry_.getFlatCoordinates(),r;switch(this.type_){case"LineString":n.length=AA(n,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,e,n,0),r=[n.length];break;case"MultiLineString":r=[],n.length=EE(n,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,e,n,0,r);break;case"Polygon":r=[],n.length=qy(n,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(e),n,0,r);break;default:}return r&&(this.simplifiedGeometry_=new i(this.type_,n,r,this.stride_,this.properties_,this.id_)),this.squaredTolerance_=e,this.simplifiedGeometry_}),this}};y2.prototype.getFlatCoordinates=y2.prototype.getOrientedFlatCoordinates;var RA=y2;var e8=class{constructor(e){this.rbush_=new EA(e),this.items_={}}insert(e,t){let n={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3],value:t};this.rbush_.insert(n),this.items_[Bn(t)]=n}load(e,t){let n=new Array(t.length);for(let r=0,s=t.length;r<s;r++){let o=e[r],a=t[r],l={minX:o[0],minY:o[1],maxX:o[2],maxY:o[3],value:a};n[r]=l,this.items_[Bn(a)]=l}this.rbush_.load(n)}remove(e){let t=Bn(e),n=this.items_[t];return delete this.items_[t],this.rbush_.remove(n)!==null}update(e,t){let n=this.items_[Bn(t)],r=[n.minX,n.minY,n.maxX,n.maxY];Qm(r,e)||(this.remove(t),this.insert(e,t))}getAll(){return this.rbush_.all().map(function(t){return t.value})}getInExtent(e){let t={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]};return this.rbush_.search(t).map(function(r){return r.value})}forEach(e){return this.forEach_(this.getAll(),e)}forEachInExtent(e,t){return this.forEach_(this.getInExtent(e),t)}forEach_(e,t){let n;for(let r=0,s=e.length;r<s;r++)if(n=t(e[r]),n)return n;return n}isEmpty(){return vu(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(e){let t=this.rbush_.toJSON();return ql(t.minX,t.minY,t.maxX,t.maxY,e)}concat(e){this.rbush_.load(e.rbush_.all());for(let t in e.items_)this.items_[t]=e.items_[t]}},t8=e8;var $l={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};var Ch=class extends Ao{constructor(e,t,n){super(e),this.feature=t,this.features=n}},n8=class extends xE{constructor(e){e=e||{},super({attributions:e.attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:e.wrapX!==void 0?e.wrapX:!0}),this.on,this.once,this.un,this.loader_=nd,this.format_=e.format||null,this.overlaps_=e.overlaps===void 0?!0:e.overlaps,this.url_=e.url,e.loader!==void 0?this.loader_=e.loader:this.url_!==void 0&&(jn(this.format_,"`format` must be set when `url` is set"),this.loader_=J6(this.url_,this.format_)),this.strategy_=e.strategy!==void 0?e.strategy:IY;let t=e.useSpatialIndex!==void 0?e.useSpatialIndex:!0;this.featuresRtree_=t?new t8:null,this.loadedExtentsRtree_=new t8,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null;let n,r;Array.isArray(e.features)?r=e.features:e.features&&(n=e.features,r=n.getArray()),!t&&n===void 0&&(n=new No(r)),r!==void 0&&this.addFeaturesInternal(r),n!==void 0&&this.bindFeaturesCollection_(n)}addFeature(e){this.addFeatureInternal(e),this.changed()}addFeatureInternal(e){let t=Bn(e);if(!this.addToIndex_(t,e)){this.featuresCollection_&&this.featuresCollection_.remove(e);return}this.setupChangeEvents_(t,e);let n=e.getGeometry();if(n){let r=n.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(r,e)}else this.nullGeometryFeatures_[t]=e;this.dispatchEvent(new Ch($l.ADDFEATURE,e))}setupChangeEvents_(e,t){t instanceof RA||(this.featureChangeKeys_[e]=[qn(t,nn.CHANGE,this.handleFeatureChange_,this),qn(t,bu.PROPERTYCHANGE,this.handleFeatureChange_,this)])}addToIndex_(e,t){let n=!0;if(t.getId()!==void 0){let r=String(t.getId());if(!(r in this.idIndex_))this.idIndex_[r]=t;else if(t instanceof RA){let s=this.idIndex_[r];s instanceof RA?Array.isArray(s)?s.push(t):this.idIndex_[r]=[s,t]:n=!1}else n=!1}return n&&(jn(!(e in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[e]=t),n}addFeatures(e){this.addFeaturesInternal(e),this.changed()}addFeaturesInternal(e){let t=[],n=[],r=[];for(let s=0,o=e.length;s<o;s++){let a=e[s],l=Bn(a);this.addToIndex_(l,a)&&n.push(a)}for(let s=0,o=n.length;s<o;s++){let a=n[s],l=Bn(a);this.setupChangeEvents_(l,a);let c=a.getGeometry();if(c){let u=c.getExtent();t.push(u),r.push(a)}else this.nullGeometryFeatures_[l]=a}if(this.featuresRtree_&&this.featuresRtree_.load(t,r),this.hasListener($l.ADDFEATURE))for(let s=0,o=n.length;s<o;s++)this.dispatchEvent(new Ch($l.ADDFEATURE,n[s]))}bindFeaturesCollection_(e){let t=!1;this.addEventListener($l.ADDFEATURE,function(n){t||(t=!0,e.push(n.feature),t=!1)}),this.addEventListener($l.REMOVEFEATURE,function(n){t||(t=!0,e.remove(n.feature),t=!1)}),e.addEventListener(vo.ADD,n=>{t||(t=!0,this.addFeature(n.element),t=!1)}),e.addEventListener(vo.REMOVE,n=>{t||(t=!0,this.removeFeature(n.element),t=!1)}),this.featuresCollection_=e}clear(e){if(e){for(let n in this.featureChangeKeys_)this.featureChangeKeys_[n].forEach(li);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){this.featuresRtree_.forEach(n=>{this.removeFeatureInternal(n)});for(let n in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[n])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};let t=new Ch($l.CLEAR);this.dispatchEvent(t),this.changed()}forEachFeature(e){if(this.featuresRtree_)return this.featuresRtree_.forEach(e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureAtCoordinateDirect(e,t){let n=[e[0],e[1],e[0],e[1]];return this.forEachFeatureInExtent(n,function(r){let s=r.getGeometry();if(s instanceof RA||s.intersectsCoordinate(e))return t(r)})}forEachFeatureInExtent(e,t){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(e,t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureIntersectingExtent(e,t){return this.forEachFeatureInExtent(e,function(n){let r=n.getGeometry();if(r instanceof RA||r.intersectsExtent(e)){let s=t(n);if(s)return s}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let e;return this.featuresCollection_?e=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(e=this.featuresRtree_.getAll(),vu(this.nullGeometryFeatures_)||Lo(e,Object.values(this.nullGeometryFeatures_))),e}getFeaturesAtCoordinate(e){let t=[];return this.forEachFeatureAtCoordinateDirect(e,function(n){t.push(n)}),t}getFeaturesInExtent(e,t){if(this.featuresRtree_){if(!(t&&t.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(e);let r=$T(e,t);return[].concat(...r.map(s=>this.featuresRtree_.getInExtent(s)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(e,t){let n=e[0],r=e[1],s=null,o=[NaN,NaN],a=1/0,l=[-1/0,-1/0,1/0,1/0];return t=t||ed,this.featuresRtree_.forEachInExtent(l,function(c){if(t(c)){let u=c.getGeometry(),f=a;if(a=u instanceof RA?0:u.closestPointXY(n,r,o,a),a<f){s=c;let d=Math.sqrt(a);l[0]=n-d,l[1]=r-d,l[2]=n+d,l[3]=r+d}}}),s}getExtent(e){return this.featuresRtree_?.getExtent(e)??null}getFeatureById(e){let t=this.idIndex_[e.toString()];return t!==void 0?t:null}getFeatureByUid(e){let t=this.uidIndex_[e];return t!==void 0?t:null}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(e){let t=e.target,n=Bn(t),r=t.getGeometry();if(!r)n in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(t),this.nullGeometryFeatures_[n]=t);else{let o=r.getExtent();n in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[n],this.featuresRtree_&&this.featuresRtree_.insert(o,t)):this.featuresRtree_&&this.featuresRtree_.update(o,t)}let s=t.getId();if(s!==void 0){let o=s.toString();this.idIndex_[o]!==t&&(this.removeFromIdIndex_(t),this.idIndex_[o]=t)}else this.removeFromIdIndex_(t),this.uidIndex_[n]=t;this.changed(),this.dispatchEvent(new Ch($l.CHANGEFEATURE,t))}hasFeature(e){let t=e.getId();if(t!==void 0){let n=this.idIndex_[String(t)];return Array.isArray(n)?n.includes(e):n===e}return Bn(e)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&vu(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0}loadFeatures(e,t,n){let r=this.loadedExtentsRtree_,s=this.strategy_(e,t,n);for(let o=0,a=s.length;o<a;++o){let l=s[o];if(!r.forEachInExtent(l,function(u){return fh(u.extent,l)})){this.loading=Number(this.loading)+1,this.dispatchEvent(new Ch($l.FEATURESLOADSTART));let u=y=>{this.loading=Number(this.loading)-1,this.dispatchEvent(new Ch($l.FEATURESLOADEND,void 0,y))},f=()=>{this.changed(),this.loading=Number(this.loading)-1,this.dispatchEvent(new Ch($l.FEATURESLOADERROR))},d=!1,A=this.loader_.call(this,l,t,n,y=>d||u(y),()=>d||f());A instanceof Promise?(d=!0,A.then(y=>{this.addFeatures(y),u(y)}).catch(f)):this.loader_.length<4&&(this.loading=!1),r.insert(l,{extent:l.slice()})}}}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(e){let t=this.loadedExtentsRtree_,n=[];t.forEachInExtent(e,function(r){n.push(r)}),n.forEach(r=>{t.remove(r);let s=RD(r.extent,e);for(let o of s)t.insert(o,{extent:o})})}removeFeatures(e){let t=!1;for(let n=0,r=e.length;n<r;++n)t=this.removeFeatureInternal(e[n])||t;t&&this.changed()}removeFeature(e){if(!e)return;this.removeFeatureInternal(e)&&this.changed()}removeFeatureInternal(e){let t=Bn(e);if(!(t in this.uidIndex_))return!1;t in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[t]:this.featuresRtree_&&this.featuresRtree_.remove(e),this.featureChangeKeys_[t]?.forEach(li),delete this.featureChangeKeys_[t];let r=e.getId();if(r!==void 0){let s=r.toString(),o=this.idIndex_[s];o===e?delete this.idIndex_[s]:Array.isArray(o)&&(o.splice(o.indexOf(e),1),o.length===1&&(this.idIndex_[s]=o[0]))}return delete this.uidIndex_[t],this.hasListener($l.REMOVEFEATURE)&&this.dispatchEvent(new Ch($l.REMOVEFEATURE,e)),!0}removeFromIdIndex_(e){for(let t in this.idIndex_)if(this.idIndex_[t]===e){delete this.idIndex_[t];break}}setLoader(e){this.loader_=e}setUrl(e){jn(this.format_,"`format` must be set when `url` is set"),this.url_=e,this.setLoader(J6(e,this.format_))}setOverlaps(e){this.overlaps_=e,this.changed()}},gd=n8;var qa={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},d0={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},LM=0,pb=1,DM=2;var H8=0,p0=1,NM=2,Hc=3,ko=0,mi=1,vr=2,ps=0,Ms=1,Bh=2,Oh=3,Uh=4,Nd=5,mb=6,oo=100,Ab=101,gb=102,FM=103,BM=104,Bu=200,vb=201,_b=202,xb=203,e0=204,t0=205,yb=206,bb=207,wb=208,Sb=209,Tb=210,xZ=211,yZ=212,bZ=213,wZ=214,NA=0,FA=1,BA=2,Ph=3,OA=4,UA=5,kA=6,zA=7,ig=0,OM=1,UM=2,ao=0,Eb=1,Mb=2,Cb=3,Rb=4,W8=5,Ib=6,Pb=7;var Lb=300,ec=301,Wc=302,m0=303,A0=304,kh=306,Md=1e3,aa=1001,Cd=1002,Ti=1003,Db=1004;var jc=1005;var Mi=1006,g0=1007;var Vo=1008,j8=1008,Ji=1009,zh=1010,Vh=1011,wl=1012,Zr=1013,xi=1014,cr=1015,Wi=1016,rg=1017,sg=1018,ca=1020,og=35902,ag=35899,f_=1021,Fd=1022,Or=1023,Gs=1026,xo=1027,Bd=1028,Gh=1029,js=1030,qh=1031,Nb=1032,v0=1033,Hh=33776,Wh=33777,jh=33778,Xh=33779,lg=35840,cg=35841,ug=35842,hg=35843,_0=36196,x0=37492,y0=37496,b0=37488,w0=37489,$h=37490,S0=37491,T0=37808,E0=37809,M0=37810,C0=37811,R0=37812,I0=37813,P0=37814,L0=37815,D0=37816,N0=37817,F0=37818,B0=37819,O0=37820,U0=37821,k0=36492,z0=36494,V0=36495,G0=36283,q0=36284,Yh=36285,H0=36286;var F2=2300,oM=2301,rM=2302,P8=2303,L8=2400,D8=2401,N8=2402;var X8=0,$8=1,kM=2,SZ=3200;var tc=0,zM=1,ua="",Fr="srgb",n0="srgb-linear",i0="linear",kt="srgb",Fb="",VM="rg",Y8="ga",Z8=0,wd=7680,K8=7681,Q8=7682,J8=7683,eF=34055,tF=34056,nF=5386,iF=512,rF=513,sF=514,oF=515,aF=516,lF=517,cF=518,B2=519,Bb=512,d_=513,Ob=514,Zh=515,fg=516,Ub=517,Ou=518,kb=519,r0=35044,dg=35048;var uF="300 es",Uo=2e3,xl=2001,Xc={COMPUTE:"compute",RENDER:"render"};var Od={TEXTURE_COMPARE:"depthTextureCompare"};function kme(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function p_(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function Zv(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function GM(){let i=Zv("canvas");return i.style.display="block",i}var LY={},Kv=null;function VA(...i){let e="THREE."+i.shift();Kv?Kv("log",e,...i):console.log(e,...i)}function TZ(i){let e=i[0];if(typeof e=="string"&&e.startsWith("TSL:")){let t=i[1];t&&t.isStackTrace?i[0]+=" "+t.getLocation():i[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return i}function Xe(...i){i=TZ(i);let e="THREE."+i.shift();if(Kv)Kv("warn",e,...i);else{let t=i[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...i)}}function ze(...i){i=TZ(i);let e="THREE."+i.shift();if(Kv)Kv("error",e,...i);else{let t=i[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...i)}}function ni(...i){let e=i.join(" ");e in LY||(LY[e]=!0,Xe(...i))}function hF(){return typeof self<"u"&&typeof self.scheduler<"u"&&typeof self.scheduler.yield<"u"?self.scheduler.yield():new Promise(i=>{requestAnimationFrame(i)})}function EZ(i,e,t){return new Promise(function(n,r){function s(){switch(i.clientWaitSync(e,i.SYNC_FLUSH_COMMANDS_BIT,0)){case i.WAIT_FAILED:r();break;case i.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:n()}}setTimeout(s,t)})}var zb={[NA]:FA,[BA]:kA,[OA]:zA,[Ph]:UA,[FA]:NA,[kA]:BA,[zA]:OA,[UA]:Ph},la=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){let n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){let n=this._listeners;if(n===void 0)return;let r=n[e];if(r!==void 0){let s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let n=t[e.type];if(n!==void 0){e.target=this;let r=n.slice(0);for(let s=0,o=r.length;s<o;s++)r[s].call(this,e);e.target=null}}},sa=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],DY=1234567,P2=Math.PI/180,Rd=180/Math.PI;function Ih(){let i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(sa[i&255]+sa[i>>8&255]+sa[i>>16&255]+sa[i>>24&255]+"-"+sa[e&255]+sa[e>>8&255]+"-"+sa[e>>16&15|64]+sa[e>>24&255]+"-"+sa[t&63|128]+sa[t>>8&255]+"-"+sa[t>>16&255]+sa[t>>24&255]+sa[n&255]+sa[n>>8&255]+sa[n>>16&255]+sa[n>>24&255]).toLowerCase()}function Nn(i,e,t){return Math.max(e,Math.min(t,i))}function fF(i,e){return(i%e+e)%e}function zme(i,e,t,n,r){return n+(i-e)*(r-n)/(t-e)}function Vme(i,e,t){return i!==e?(t-i)/(e-i):0}function L2(i,e,t){return(1-t)*i+t*e}function Gme(i,e,t,n){return L2(i,e,1-Math.exp(-t*n))}function qme(i,e=1){return e-Math.abs(fF(i,e*2)-e)}function Hme(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*(3-2*i))}function Wme(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*i*(i*(i*6-15)+10))}function jme(i,e){return i+Math.floor(Math.random()*(e-i+1))}function Xme(i,e){return i+Math.random()*(e-i)}function $me(i){return i*(.5-Math.random())}function Yme(i){i!==void 0&&(DY=i);let e=DY+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function Zme(i){return i*P2}function Kme(i){return i*Rd}function Qme(i){return(i&i-1)===0&&i!==0}function Jme(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function eAe(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function tAe(i,e,t,n,r){let s=Math.cos,o=Math.sin,a=s(t/2),l=o(t/2),c=s((e+n)/2),u=o((e+n)/2),f=s((e-n)/2),d=o((e-n)/2),A=s((n-e)/2),y=o((n-e)/2);switch(r){case"XYX":i.set(a*u,l*f,l*d,a*c);break;case"YZY":i.set(l*d,a*u,l*f,a*c);break;case"ZXZ":i.set(l*f,l*d,a*u,a*c);break;case"XZX":i.set(a*u,l*y,l*A,a*c);break;case"YXY":i.set(l*A,a*u,l*y,a*c);break;case"ZYZ":i.set(l*y,l*A,a*u,a*c);break;default:Xe("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function Fa(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("THREE.MathUtils: Invalid component type.")}}function Zn(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("THREE.MathUtils: Invalid component type.")}}var Uu={DEG2RAD:P2,RAD2DEG:Rd,generateUUID:Ih,clamp:Nn,euclideanModulo:fF,mapLinear:zme,inverseLerp:Vme,lerp:L2,damp:Gme,pingpong:qme,smoothstep:Hme,smootherstep:Wme,randInt:jme,randFloat:Xme,randFloatSpread:$me,seededRandom:Yme,degToRad:Zme,radToDeg:Kme,isPowerOfTwo:Qme,ceilPowerOfTwo:Jme,floorPowerOfTwo:eAe,setQuaternionFromProperEuler:tAe,normalize:Zn,denormalize:Fa},gF=class gF{constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("THREE.Vector2: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("THREE.Vector2: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Nn(this.x,e.x,t.x),this.y=Nn(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=Nn(this.x,e,t),this.y=Nn(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Nn(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(Nn(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),r=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*n-o*r+e.x,this.y=s*r+o*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};gF.prototype.isVector2=!0;var Oe=gF,qs=class{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,s,o,a){let l=n[r+0],c=n[r+1],u=n[r+2],f=n[r+3],d=s[o+0],A=s[o+1],y=s[o+2],w=s[o+3];if(f!==w||l!==d||c!==A||u!==y){let S=l*d+c*A+u*y+f*w;S<0&&(d=-d,A=-A,y=-y,w=-w,S=-S);let T=1-a;if(S<.9995){let R=Math.acos(S),P=Math.sin(R);T=Math.sin(T*R)/P,a=Math.sin(a*R)/P,l=l*T+d*a,c=c*T+A*a,u=u*T+y*a,f=f*T+w*a}else{l=l*T+d*a,c=c*T+A*a,u=u*T+y*a,f=f*T+w*a;let R=1/Math.sqrt(l*l+c*c+u*u+f*f);l*=R,c*=R,u*=R,f*=R}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=f}static multiplyQuaternionsFlat(e,t,n,r,s,o){let a=n[r],l=n[r+1],c=n[r+2],u=n[r+3],f=s[o],d=s[o+1],A=s[o+2],y=s[o+3];return e[t]=a*y+u*f+l*A-c*d,e[t+1]=l*y+u*d+c*f-a*A,e[t+2]=c*y+u*A+a*d-l*f,e[t+3]=u*y-a*f-l*d-c*A,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let n=e._x,r=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(n/2),u=a(r/2),f=a(s/2),d=l(n/2),A=l(r/2),y=l(s/2);switch(o){case"XYZ":this._x=d*u*f+c*A*y,this._y=c*A*f-d*u*y,this._z=c*u*y+d*A*f,this._w=c*u*f-d*A*y;break;case"YXZ":this._x=d*u*f+c*A*y,this._y=c*A*f-d*u*y,this._z=c*u*y-d*A*f,this._w=c*u*f+d*A*y;break;case"ZXY":this._x=d*u*f-c*A*y,this._y=c*A*f+d*u*y,this._z=c*u*y+d*A*f,this._w=c*u*f-d*A*y;break;case"ZYX":this._x=d*u*f-c*A*y,this._y=c*A*f+d*u*y,this._z=c*u*y-d*A*f,this._w=c*u*f+d*A*y;break;case"YZX":this._x=d*u*f+c*A*y,this._y=c*A*f+d*u*y,this._z=c*u*y-d*A*f,this._w=c*u*f-d*A*y;break;case"XZY":this._x=d*u*f-c*A*y,this._y=c*A*f-d*u*y,this._z=c*u*y+d*A*f,this._w=c*u*f+d*A*y;break;default:Xe("Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],r=t[4],s=t[8],o=t[1],a=t[5],l=t[9],c=t[2],u=t[6],f=t[10],d=n+a+f;if(d>0){let A=.5/Math.sqrt(d+1);this._w=.25/A,this._x=(u-l)*A,this._y=(s-c)*A,this._z=(o-r)*A}else if(n>a&&n>f){let A=2*Math.sqrt(1+n-a-f);this._w=(u-l)/A,this._x=.25*A,this._y=(r+o)/A,this._z=(s+c)/A}else if(a>f){let A=2*Math.sqrt(1+a-n-f);this._w=(s-c)/A,this._x=(r+o)/A,this._y=.25*A,this._z=(l+u)/A}else{let A=2*Math.sqrt(1+f-n-a);this._w=(o-r)/A,this._x=(s+c)/A,this._y=(l+u)/A,this._z=.25*A}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Nn(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let n=e._x,r=e._y,s=e._z,o=e._w,a=t._x,l=t._y,c=t._z,u=t._w;return this._x=n*u+o*a+r*c-s*l,this._y=r*u+o*l+s*a-n*c,this._z=s*u+o*c+n*l-r*a,this._w=o*u-n*a-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){let n=e._x,r=e._y,s=e._z,o=e._w,a=this.dot(e);a<0&&(n=-n,r=-r,s=-s,o=-o,a=-a);let l=1-t;if(a<.9995){let c=Math.acos(a),u=Math.sin(c);l=Math.sin(l*c)/u,t=Math.sin(t*c)/u,this._x=this._x*l+n*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+o*t,this._onChangeCallback()}else this._x=this._x*l+n*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+o*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},vF=class vF{constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("THREE.Vector3: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("THREE.Vector3: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(NY.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(NY.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*r,this.y=s[1]*t+s[4]*n+s[7]*r,this.z=s[2]*t+s[5]*n+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,s=e.elements,o=1/(s[3]*t+s[7]*n+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*r+s[12])*o,this.y=(s[1]*t+s[5]*n+s[9]*r+s[13])*o,this.z=(s[2]*t+s[6]*n+s[10]*r+s[14])*o,this}applyQuaternion(e){let t=this.x,n=this.y,r=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*r-a*n),u=2*(a*t-s*r),f=2*(s*n-o*t);return this.x=t+l*c+o*f-a*u,this.y=n+l*u+a*c-s*f,this.z=r+l*f+s*u-o*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*r,this.y=s[1]*t+s[5]*n+s[9]*r,this.z=s[2]*t+s[6]*n+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Nn(this.x,e.x,t.x),this.y=Nn(this.y,e.y,t.y),this.z=Nn(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=Nn(this.x,e,t),this.y=Nn(this.y,e,t),this.z=Nn(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Nn(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,r=e.y,s=e.z,o=t.x,a=t.y,l=t.z;return this.x=r*l-s*a,this.y=s*o-n*l,this.z=n*a-r*o,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return i8.copy(this).projectOnVector(e),this.sub(i8)}reflect(e){return this.sub(i8.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(Nn(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};vF.prototype.isVector3=!0;var re=vF,i8=new re,NY=new qs,_F=class _F{constructor(e,t,n,r,s,o,a,l,c){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,o,a,l,c)}set(e,t,n,r,s,o,a,l,c){let u=this.elements;return u[0]=e,u[1]=r,u[2]=a,u[3]=t,u[4]=s,u[5]=l,u[6]=n,u[7]=o,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,s=this.elements,o=n[0],a=n[3],l=n[6],c=n[1],u=n[4],f=n[7],d=n[2],A=n[5],y=n[8],w=r[0],S=r[3],T=r[6],R=r[1],P=r[4],I=r[7],F=r[2],D=r[5],L=r[8];return s[0]=o*w+a*R+l*F,s[3]=o*S+a*P+l*D,s[6]=o*T+a*I+l*L,s[1]=c*w+u*R+f*F,s[4]=c*S+u*P+f*D,s[7]=c*T+u*I+f*L,s[2]=d*w+A*R+y*F,s[5]=d*S+A*P+y*D,s[8]=d*T+A*I+y*L,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8];return t*o*u-t*a*c-n*s*u+n*a*l+r*s*c-r*o*l}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],f=u*o-a*c,d=a*l-u*s,A=c*s-o*l,y=t*f+n*d+r*A;if(y===0)return this.set(0,0,0,0,0,0,0,0,0);let w=1/y;return e[0]=f*w,e[1]=(r*c-u*n)*w,e[2]=(a*n-r*o)*w,e[3]=d*w,e[4]=(u*t-r*l)*w,e[5]=(r*s-a*t)*w,e[6]=A*w,e[7]=(n*l-c*t)*w,e[8]=(o*t-n*s)*w,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,s,o,a){let l=Math.cos(s),c=Math.sin(s);return this.set(n*l,n*c,-n*(l*o+c*a)+o+e,-r*c,r*l,-r*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){return ni("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(r8.makeScale(e,t)),this}rotate(e){return ni("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(r8.makeRotation(-e)),this}translate(e,t){return ni("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(r8.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,n=e.elements;for(let r=0;r<9;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}};_F.prototype.isMatrix3=!0;var Mn=_F,r8=new Mn,FY=new Mn().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),BY=new Mn().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function nAe(){let i={enabled:!0,workingColorSpace:n0,spaces:{},convert:function(r,s,o){return this.enabled===!1||s===o||!s||!o||(this.spaces[s].transfer===kt&&(r.r=Ed(r.r),r.g=Ed(r.g),r.b=Ed(r.b)),this.spaces[s].primaries!==this.spaces[o].primaries&&(r.applyMatrix3(this.spaces[s].toXYZ),r.applyMatrix3(this.spaces[o].fromXYZ)),this.spaces[o].transfer===kt&&(r.r=Yv(r.r),r.g=Yv(r.g),r.b=Yv(r.b))),r},workingToColorSpace:function(r,s){return this.convert(r,this.workingColorSpace,s)},colorSpaceToWorking:function(r,s){return this.convert(r,s,this.workingColorSpace)},getPrimaries:function(r){return this.spaces[r].primaries},getTransfer:function(r){return r===ua?i0:this.spaces[r].transfer},getToneMappingMode:function(r){return this.spaces[r].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(r,s=this.workingColorSpace){return r.fromArray(this.spaces[s].luminanceCoefficients)},define:function(r){Object.assign(this.spaces,r)},_getMatrix:function(r,s,o){return r.copy(this.spaces[s].toXYZ).multiply(this.spaces[o].fromXYZ)},_getDrawingBufferColorSpace:function(r){return this.spaces[r].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(r=this.workingColorSpace){return this.spaces[r].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(r,s){return ni("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),i.workingToColorSpace(r,s)},toWorkingColorSpace:function(r,s){return ni("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),i.colorSpaceToWorking(r,s)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return i.define({[n0]:{primaries:e,whitePoint:n,transfer:i0,toXYZ:FY,fromXYZ:BY,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Fr},outputColorSpaceConfig:{drawingBufferColorSpace:Fr}},[Fr]:{primaries:e,whitePoint:n,transfer:kt,toXYZ:FY,fromXYZ:BY,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Fr}}}),i}var ln=nAe();function Ed(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function Yv(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}var Iv,aM=class{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{Iv===void 0&&(Iv=Zv("canvas")),Iv.width=e.width,Iv.height=e.height;let r=Iv.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),n=Iv}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){let t=Zv("canvas");t.width=e.width,t.height=e.height;let n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);let r=n.getImageData(0,0,e.width,e.height),s=r.data;for(let o=0;o<s.length;o++)s[o]=Ed(s[o]/255)*255;return n.putImageData(r,0,0),t}else if(e.data){let t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(Ed(t[n]/255)*255):t[n]=Ed(t[n]);return{data:t,width:e.width,height:e.height}}else return Xe("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}},iAe=0,Qv=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:iAe++}),this.uuid=Ih(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){let t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<"u"&&t instanceof VideoFrame?e.set(t.displayWidth,t.displayHeight,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];let n={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let o=0,a=r.length;o<a;o++)r[o].isDataTexture?s.push(s8(r[o].image)):s.push(s8(r[o]))}else s=s8(r);n.url=s}return t||(e.images[this.uuid]=n),n}};function s8(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?aM.getDataURL(i):i.data?{data:Array.from(i.data),width:i.width,height:i.height,type:i.data.constructor.name}:(Xe("Texture: Unable to serialize Texture."),{})}var rAe=0,o8=new re,Hs=class i extends la{constructor(e=i.DEFAULT_IMAGE,t=i.DEFAULT_MAPPING,n=aa,r=aa,s=Mi,o=Vo,a=Or,l=Ji,c=i.DEFAULT_ANISOTROPY,u=ua){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:rAe++}),this.uuid=Ih(),this.name="",this.source=new Qv(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=r,this.magFilter=s,this.minFilter=o,this.anisotropy=c,this.format=a,this.internalFormat=null,this.type=l,this.offset=new Oe(0,0),this.repeat=new Oe(1,1),this.center=new Oe(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Mn,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(o8).x}get height(){return this.source.getSize(o8).y}get depth(){return this.source.getSize(o8).z}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let n=e[t];if(n===void 0){Xe(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){Xe(`Texture.setValues(): property '${t}' does not exist.`);continue}r&&n&&r.isVector2&&n.isVector2||r&&n&&r.isVector3&&n.isVector3||r&&n&&r.isMatrix3&&n.isMatrix3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Lb)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Md:e.x=e.x-Math.floor(e.x);break;case aa:e.x=e.x<0?0:1;break;case Cd:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Md:e.y=e.y-Math.floor(e.y);break;case aa:e.y=e.y<0?0:1;break;case Cd:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}};Hs.DEFAULT_IMAGE=null;Hs.DEFAULT_MAPPING=Lb;Hs.DEFAULT_ANISOTROPY=1;var xF=class xF{constructor(e=0,t=0,n=0,r=1){this.x=e,this.y=t,this.z=n,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("THREE.Vector4: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("THREE.Vector4: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*r+o[12]*s,this.y=o[1]*t+o[5]*n+o[9]*r+o[13]*s,this.z=o[2]*t+o[6]*n+o[10]*r+o[14]*s,this.w=o[3]*t+o[7]*n+o[11]*r+o[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,s,l=e.elements,c=l[0],u=l[4],f=l[8],d=l[1],A=l[5],y=l[9],w=l[2],S=l[6],T=l[10];if(Math.abs(u-d)<.01&&Math.abs(f-w)<.01&&Math.abs(y-S)<.01){if(Math.abs(u+d)<.1&&Math.abs(f+w)<.1&&Math.abs(y+S)<.1&&Math.abs(c+A+T-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;let P=(c+1)/2,I=(A+1)/2,F=(T+1)/2,D=(u+d)/4,L=(f+w)/4,C=(y+S)/4;return P>I&&P>F?P<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(P),r=D/n,s=L/n):I>F?I<.01?(n=.707106781,r=0,s=.707106781):(r=Math.sqrt(I),n=D/r,s=C/r):F<.01?(n=.707106781,r=.707106781,s=0):(s=Math.sqrt(F),n=L/s,r=C/s),this.set(n,r,s,t),this}let R=Math.sqrt((S-y)*(S-y)+(f-w)*(f-w)+(d-u)*(d-u));return Math.abs(R)<.001&&(R=1),this.x=(S-y)/R,this.y=(f-w)/R,this.z=(d-u)/R,this.w=Math.acos((c+A+T-1)/2),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Nn(this.x,e.x,t.x),this.y=Nn(this.y,e.y,t.y),this.z=Nn(this.z,e.z,t.z),this.w=Nn(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=Nn(this.x,e,t),this.y=Nn(this.y,e,t),this.z=Nn(this.z,e,t),this.w=Nn(this.w,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Nn(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}};xF.prototype.isVector4=!0;var xn=xF,Ba=class extends la{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Mi,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new xn(0,0,e,t),this.scissorTest=!1,this.viewport=new xn(0,0,e,t),this.textures=[];let r={width:e,height:t,depth:n.depth},s=new Hs(r),o=n.count;for(let a=0;a<o;a++)this.textures[a]=s.clone(),this.textures[a].isRenderTargetTexture=!0,this.textures[a].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview,this.useArrayDepthTexture=n.useArrayDepthTexture}_setTextureOptions(e={}){let t={minFilter:Mi,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let r=0,s=this.textures.length;r<s;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=n,this.textures[r].isData3DTexture!==!0&&(this.textures[r].isArrayTexture=this.textures[r].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;let r=Object.assign({},e.textures[t].image);this.textures[t].source=new Qv(r)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this.multiview=e.multiview,this.useArrayDepthTexture=e.useArrayDepthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}},Oa=class extends Ba{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}},GA=class extends Hs{constructor(e=null,t=1,n=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=Ti,this.minFilter=Ti,this.wrapR=aa,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}};var lM=class extends Hs{constructor(e=null,t=1,n=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=Ti,this.minFilter=Ti,this.wrapR=aa,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var PM=class PM{constructor(e,t,n,r,s,o,a,l,c,u,f,d,A,y,w,S){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,o,a,l,c,u,f,d,A,y,w,S)}set(e,t,n,r,s,o,a,l,c,u,f,d,A,y,w,S){let T=this.elements;return T[0]=e,T[4]=t,T[8]=n,T[12]=r,T[1]=s,T[5]=o,T[9]=a,T[13]=l,T[2]=c,T[6]=u,T[10]=f,T[14]=d,T[3]=A,T[7]=y,T[11]=w,T[15]=S,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new PM().fromArray(this.elements)}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return this.determinantAffine()===0?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(e.determinantAffine()===0)return this.identity();let t=this.elements,n=e.elements,r=1/Pv.setFromMatrixColumn(e,0).length(),s=1/Pv.setFromMatrixColumn(e,1).length(),o=1/Pv.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*o,t[9]=n[9]*o,t[10]=n[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,n=e.x,r=e.y,s=e.z,o=Math.cos(n),a=Math.sin(n),l=Math.cos(r),c=Math.sin(r),u=Math.cos(s),f=Math.sin(s);if(e.order==="XYZ"){let d=o*u,A=o*f,y=a*u,w=a*f;t[0]=l*u,t[4]=-l*f,t[8]=c,t[1]=A+y*c,t[5]=d-w*c,t[9]=-a*l,t[2]=w-d*c,t[6]=y+A*c,t[10]=o*l}else if(e.order==="YXZ"){let d=l*u,A=l*f,y=c*u,w=c*f;t[0]=d+w*a,t[4]=y*a-A,t[8]=o*c,t[1]=o*f,t[5]=o*u,t[9]=-a,t[2]=A*a-y,t[6]=w+d*a,t[10]=o*l}else if(e.order==="ZXY"){let d=l*u,A=l*f,y=c*u,w=c*f;t[0]=d-w*a,t[4]=-o*f,t[8]=y+A*a,t[1]=A+y*a,t[5]=o*u,t[9]=w-d*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){let d=o*u,A=o*f,y=a*u,w=a*f;t[0]=l*u,t[4]=y*c-A,t[8]=d*c+w,t[1]=l*f,t[5]=w*c+d,t[9]=A*c-y,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){let d=o*l,A=o*c,y=a*l,w=a*c;t[0]=l*u,t[4]=w-d*f,t[8]=y*f+A,t[1]=f,t[5]=o*u,t[9]=-a*u,t[2]=-c*u,t[6]=A*f+y,t[10]=d-w*f}else if(e.order==="XZY"){let d=o*l,A=o*c,y=a*l,w=a*c;t[0]=l*u,t[4]=-f,t[8]=c*u,t[1]=d*f+w,t[5]=o*u,t[9]=A*f-y,t[2]=y*f-A,t[6]=a*u,t[10]=w*f+d}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(sAe,e,oAe)}lookAt(e,t,n){let r=this.elements;return Yl.subVectors(e,t),Yl.lengthSq()===0&&(Yl.z=1),Yl.normalize(),Xp.crossVectors(n,Yl),Xp.lengthSq()===0&&(Math.abs(n.z)===1?Yl.x+=1e-4:Yl.z+=1e-4,Yl.normalize(),Xp.crossVectors(n,Yl)),Xp.normalize(),M3.crossVectors(Yl,Xp),r[0]=Xp.x,r[4]=M3.x,r[8]=Yl.x,r[1]=Xp.y,r[5]=M3.y,r[9]=Yl.y,r[2]=Xp.z,r[6]=M3.z,r[10]=Yl.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,s=this.elements,o=n[0],a=n[4],l=n[8],c=n[12],u=n[1],f=n[5],d=n[9],A=n[13],y=n[2],w=n[6],S=n[10],T=n[14],R=n[3],P=n[7],I=n[11],F=n[15],D=r[0],L=r[4],C=r[8],B=r[12],k=r[1],z=r[5],G=r[9],W=r[13],Y=r[2],H=r[6],$=r[10],J=r[14],te=r[3],ce=r[7],he=r[11],ve=r[15];return s[0]=o*D+a*k+l*Y+c*te,s[4]=o*L+a*z+l*H+c*ce,s[8]=o*C+a*G+l*$+c*he,s[12]=o*B+a*W+l*J+c*ve,s[1]=u*D+f*k+d*Y+A*te,s[5]=u*L+f*z+d*H+A*ce,s[9]=u*C+f*G+d*$+A*he,s[13]=u*B+f*W+d*J+A*ve,s[2]=y*D+w*k+S*Y+T*te,s[6]=y*L+w*z+S*H+T*ce,s[10]=y*C+w*G+S*$+T*he,s[14]=y*B+w*W+S*J+T*ve,s[3]=R*D+P*k+I*Y+F*te,s[7]=R*L+P*z+I*H+F*ce,s[11]=R*C+P*G+I*$+F*he,s[15]=R*B+P*W+I*J+F*ve,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[4],r=e[8],s=e[12],o=e[1],a=e[5],l=e[9],c=e[13],u=e[2],f=e[6],d=e[10],A=e[14],y=e[3],w=e[7],S=e[11],T=e[15],R=l*A-c*d,P=a*A-c*f,I=a*d-l*f,F=o*A-c*u,D=o*d-l*u,L=o*f-a*u;return t*(w*R-S*P+T*I)-n*(y*R-S*F+T*D)+r*(y*P-w*F+T*L)-s*(y*I-w*D+S*L)}determinantAffine(){let e=this.elements,t=e[0],n=e[4],r=e[8],s=e[1],o=e[5],a=e[9],l=e[2],c=e[6],u=e[10];return t*(o*u-a*c)-n*(s*u-a*l)+r*(s*c-o*l)}transpose(){let e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){let r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],f=e[9],d=e[10],A=e[11],y=e[12],w=e[13],S=e[14],T=e[15],R=t*a-n*o,P=t*l-r*o,I=t*c-s*o,F=n*l-r*a,D=n*c-s*a,L=r*c-s*l,C=u*w-f*y,B=u*S-d*y,k=u*T-A*y,z=f*S-d*w,G=f*T-A*w,W=d*T-A*S,Y=R*W-P*G+I*z+F*k-D*B+L*C;if(Y===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let H=1/Y;return e[0]=(a*W-l*G+c*z)*H,e[1]=(r*G-n*W-s*z)*H,e[2]=(w*L-S*D+T*F)*H,e[3]=(d*D-f*L-A*F)*H,e[4]=(l*k-o*W-c*B)*H,e[5]=(t*W-r*k+s*B)*H,e[6]=(S*I-y*L-T*P)*H,e[7]=(u*L-d*I+A*P)*H,e[8]=(o*G-a*k+c*C)*H,e[9]=(n*k-t*G-s*C)*H,e[10]=(y*D-w*I+T*R)*H,e[11]=(f*I-u*D-A*R)*H,e[12]=(a*B-o*z-l*C)*H,e[13]=(t*z-n*B+r*C)*H,e[14]=(w*P-y*F-S*R)*H,e[15]=(u*F-f*P+d*R)*H,this}scale(e){let t=this.elements,n=e.x,r=e.y,s=e.z;return t[0]*=n,t[4]*=r,t[8]*=s,t[1]*=n,t[5]*=r,t[9]*=s,t[2]*=n,t[6]*=r,t[10]*=s,t[3]*=n,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let n=Math.cos(t),r=Math.sin(t),s=1-n,o=e.x,a=e.y,l=e.z,c=s*o,u=s*a;return this.set(c*o+n,c*a-r*l,c*l+r*a,0,c*a+r*l,u*a+n,u*l-r*o,0,c*l-r*a,u*l+r*o,s*l*l+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,s,o){return this.set(1,n,s,0,e,1,o,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){let r=this.elements,s=t._x,o=t._y,a=t._z,l=t._w,c=s+s,u=o+o,f=a+a,d=s*c,A=s*u,y=s*f,w=o*u,S=o*f,T=a*f,R=l*c,P=l*u,I=l*f,F=n.x,D=n.y,L=n.z;return r[0]=(1-(w+T))*F,r[1]=(A+I)*F,r[2]=(y-P)*F,r[3]=0,r[4]=(A-I)*D,r[5]=(1-(d+T))*D,r[6]=(S+R)*D,r[7]=0,r[8]=(y+P)*L,r[9]=(S-R)*L,r[10]=(1-(d+w))*L,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){let r=this.elements;e.x=r[12],e.y=r[13],e.z=r[14];let s=this.determinantAffine();if(s===0)return n.set(1,1,1),t.identity(),this;let o=Pv.set(r[0],r[1],r[2]).length(),a=Pv.set(r[4],r[5],r[6]).length(),l=Pv.set(r[8],r[9],r[10]).length();s<0&&(o=-o),Iu.copy(this);let c=1/o,u=1/a,f=1/l;return Iu.elements[0]*=c,Iu.elements[1]*=c,Iu.elements[2]*=c,Iu.elements[4]*=u,Iu.elements[5]*=u,Iu.elements[6]*=u,Iu.elements[8]*=f,Iu.elements[9]*=f,Iu.elements[10]*=f,t.setFromRotationMatrix(Iu),n.x=o,n.y=a,n.z=l,this}makePerspective(e,t,n,r,s,o,a=Uo,l=!1){let c=this.elements,u=2*s/(t-e),f=2*s/(n-r),d=(t+e)/(t-e),A=(n+r)/(n-r),y,w;if(l)y=s/(o-s),w=o*s/(o-s);else if(a===Uo)y=-(o+s)/(o-s),w=-2*o*s/(o-s);else if(a===xl)y=-o/(o-s),w=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return c[0]=u,c[4]=0,c[8]=d,c[12]=0,c[1]=0,c[5]=f,c[9]=A,c[13]=0,c[2]=0,c[6]=0,c[10]=y,c[14]=w,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,r,s,o,a=Uo,l=!1){let c=this.elements,u=2/(t-e),f=2/(n-r),d=-(t+e)/(t-e),A=-(n+r)/(n-r),y,w;if(l)y=1/(o-s),w=o/(o-s);else if(a===Uo)y=-2/(o-s),w=-(o+s)/(o-s);else if(a===xl)y=-1/(o-s),w=-s/(o-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return c[0]=u,c[4]=0,c[8]=0,c[12]=d,c[1]=0,c[5]=f,c[9]=0,c[13]=A,c[2]=0,c[6]=0,c[10]=y,c[14]=w,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let r=0;r<16;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}};PM.prototype.isMatrix4=!0;var cn=PM,Pv=new re,Iu=new cn,sAe=new re(0,0,0),oAe=new re(1,1,1),Xp=new re,M3=new re,Yl=new re,OY=new cn,UY=new qs,Ua=class i{constructor(e=0,t=0,n=0,r=i.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){let r=e.elements,s=r[0],o=r[4],a=r[8],l=r[1],c=r[5],u=r[9],f=r[2],d=r[6],A=r[10];switch(t){case"XYZ":this._y=Math.asin(Nn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,A),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(d,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Nn(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,A),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-f,s),this._z=0);break;case"ZXY":this._x=Math.asin(Nn(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-f,A),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-Nn(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(d,A),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(Nn(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-f,s)):(this._x=0,this._y=Math.atan2(a,A));break;case"XZY":this._z=Math.asin(-Nn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-u,A),this._y=0);break;default:Xe("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return OY.makeRotationFromQuaternion(e),this.setFromRotationMatrix(OY,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return UY.setFromEuler(this),this.setFromQuaternion(UY,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};Ua.DEFAULT_ORDER="XYZ";var Jv=class{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}},aAe=0,kY=new re,Lv=new qs,vd=new cn,C3=new re,b2=new re,lAe=new re,cAe=new qs,zY=new re(1,0,0),VY=new re(0,1,0),GY=new re(0,0,1),qY={type:"added"},uAe={type:"removed"},Dv={type:"childadded",child:null},a8={type:"childremoved",child:null},lr=class i extends la{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:aAe++}),this.uuid=Ih(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=i.DEFAULT_UP.clone();let e=new re,t=new Ua,n=new qs,r=new re(1,1,1);function s(){n.setFromEuler(t,!1)}function o(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new cn},normalMatrix:{value:new Mn}}),this.matrix=new cn,this.matrixWorld=new cn,this.matrixAutoUpdate=i.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=i.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Jv,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Lv.setFromAxisAngle(e,t),this.quaternion.multiply(Lv),this}rotateOnWorldAxis(e,t){return Lv.setFromAxisAngle(e,t),this.quaternion.premultiply(Lv),this}rotateX(e){return this.rotateOnAxis(zY,e)}rotateY(e){return this.rotateOnAxis(VY,e)}rotateZ(e){return this.rotateOnAxis(GY,e)}translateOnAxis(e,t){return kY.copy(e).applyQuaternion(this.quaternion),this.position.add(kY.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(zY,e)}translateY(e){return this.translateOnAxis(VY,e)}translateZ(e){return this.translateOnAxis(GY,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(vd.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?C3.copy(e):C3.set(e,t,n);let r=this.parent;this.updateWorldMatrix(!0,!1),b2.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?vd.lookAt(b2,C3,this.up):vd.lookAt(C3,b2,this.up),this.quaternion.setFromRotationMatrix(vd),r&&(vd.extractRotation(r.matrixWorld),Lv.setFromRotationMatrix(vd),this.quaternion.premultiply(Lv.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(ze("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(qY),Dv.child=e,this.dispatchEvent(Dv),Dv.child=null):ze("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}let t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(uAe),a8.child=e,this.dispatchEvent(a8),a8.child=null),this}removeFromParent(){let e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),vd.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),vd.multiply(e.parent.matrixWorld)),e.applyMatrix4(vd),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(qY),Dv.child=e,this.dispatchEvent(Dv),Dv.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,r=this.children.length;n<r;n++){let o=this.children[n].getObjectByProperty(e,t);if(o!==void 0)return o}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);let r=this.children;for(let s=0,o=r.length;s<o;s++)r[s].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(b2,e,lAe),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(b2,cAe,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}traverseAncestors(e){let t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);let e=this.pivot;if(e!==null){let t=e.x,n=e.y,r=e.z,s=this.matrix.elements;s[12]+=t-s[0]*t-s[4]*n-s[8]*r,s[13]+=n-s[1]*t-s[5]*n-s[9]*r,s[14]+=r-s[2]*t-s[6]*n-s[10]*r}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t,n=!1){let r=this.parent;if(e===!0&&r!==null&&r.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||n)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,n=!0),t===!0){let s=this.children;for(let o=0,a=s.length;o<a;o++)s[o].updateWorldMatrix(!1,!0,n)}}toJSON(e){let t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});let r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),this.static!==!1&&(r.static=this.static),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.pivot!==null&&(r.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(r.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(r.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(a=>({...a,boundingBox:a.boundingBox?a.boundingBox.toJSON():void 0,boundingSphere:a.boundingSphere?a.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(a=>({...a})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function s(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);let a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){let l=a.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c<u;c++){let f=l[c];s(e.shapes,f)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let a=[];for(let l=0,c=this.material.length;l<c;l++)a.push(s(e.materials,this.material[l]));r.material=a}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let a=0;a<this.children.length;a++)r.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let a=0;a<this.animations.length;a++){let l=this.animations[a];r.animations.push(s(e.animations,l))}}if(t){let a=o(e.geometries),l=o(e.materials),c=o(e.textures),u=o(e.images),f=o(e.shapes),d=o(e.skeletons),A=o(e.animations),y=o(e.nodes);a.length>0&&(n.geometries=a),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),u.length>0&&(n.images=u),f.length>0&&(n.shapes=f),d.length>0&&(n.skeletons=d),A.length>0&&(n.animations=A),y.length>0&&(n.nodes=y)}return n.object=r,n;function o(a){let l=[];for(let c in a){let u=a[c];delete u.metadata,l.push(u)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.pivot=e.pivot!==null?e.pivot.clone():null,this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){let r=e.children[n];this.add(r.clone())}return this}};lr.DEFAULT_UP=new re(0,1,0);lr.DEFAULT_MATRIX_AUTO_UPDATE=!0;lr.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var Br=class extends lr{constructor(){super(),this.isGroup=!0,this.type="Group"}},hAe={type:"move"},s0=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Br,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Br,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new re,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new re),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Br,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new re,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new re,this._grip.eventsEnabled=!1),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){let t=this._hand;if(t)for(let n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let r=null,s=null,o=null,a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(let w of e.hand.values()){let S=t.getJointPose(w,n),T=this._getHandJoint(c,w);S!==null&&(T.matrix.fromArray(S.transform.matrix),T.matrix.decompose(T.position,T.rotation,T.scale),T.matrixWorldNeedsUpdate=!0,T.jointRadius=S.radius),T.visible=S!==null}let u=c.joints["index-finger-tip"],f=c.joints["thumb-tip"],d=u.position.distanceTo(f.position),A=.02,y=.005;c.inputState.pinching&&d>A+y?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&d<=A-y&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1,l.eventsEnabled&&l.dispatchEvent({type:"gripUpdated",data:e,target:this})));a!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&s!==null&&(r=s),r!==null&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(hAe)))}return a!==null&&(a.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){let n=new Br;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}},MZ={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},$p={h:0,s:0,l:0},R3={h:0,s:0,l:0};function l8(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*6*(2/3-t):i}var zt=class{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){let r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Fr){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,ln.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=ln.workingColorSpace){return this.r=e,this.g=t,this.b=n,ln.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=ln.workingColorSpace){if(e=fF(e,1),t=Nn(t,0,1),n=Nn(n,0,1),t===0)this.r=this.g=this.b=n;else{let s=n<=.5?n*(1+t):n+t-n*t,o=2*n-s;this.r=l8(o,s,e+1/3),this.g=l8(o,s,e),this.b=l8(o,s,e-1/3)}return ln.colorSpaceToWorking(this,r),this}setStyle(e,t=Fr){function n(s){s!==void 0&&parseFloat(s)<1&&Xe("Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s,o=r[1],a=r[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:Xe("Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){let s=r[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(s,16),t);Xe("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Fr){let n=MZ[e.toLowerCase()];return n!==void 0?this.setHex(n,t):Xe("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Ed(e.r),this.g=Ed(e.g),this.b=Ed(e.b),this}copyLinearToSRGB(e){return this.r=Yv(e.r),this.g=Yv(e.g),this.b=Yv(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Fr){return ln.workingToColorSpace(oa.copy(this),e),Math.round(Nn(oa.r*255,0,255))*65536+Math.round(Nn(oa.g*255,0,255))*256+Math.round(Nn(oa.b*255,0,255))}getHexString(e=Fr){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=ln.workingColorSpace){ln.workingToColorSpace(oa.copy(this),t);let n=oa.r,r=oa.g,s=oa.b,o=Math.max(n,r,s),a=Math.min(n,r,s),l,c,u=(a+o)/2;if(a===o)l=0,c=0;else{let f=o-a;switch(c=u<=.5?f/(o+a):f/(2-o-a),o){case n:l=(r-s)/f+(r<s?6:0);break;case r:l=(s-n)/f+2;break;case s:l=(n-r)/f+4;break}l/=6}return e.h=l,e.s=c,e.l=u,e}getRGB(e,t=ln.workingColorSpace){return ln.workingToColorSpace(oa.copy(this),t),e.r=oa.r,e.g=oa.g,e.b=oa.b,e}getStyle(e=Fr){ln.workingToColorSpace(oa.copy(this),e);let t=oa.r,n=oa.g,r=oa.b;return e!==Fr?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(r*255)})`}offsetHSL(e,t,n){return this.getHSL($p),this.setHSL($p.h+e,$p.s+t,$p.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL($p),e.getHSL(R3);let n=L2($p.h,R3.h,t),r=L2($p.s,R3.s,t),s=L2($p.l,R3.l,t);return this.setHSL(n,r,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,n=this.g,r=this.b,s=e.elements;return this.r=s[0]*t+s[3]*n+s[6]*r,this.g=s[1]*t+s[4]*n+s[7]*r,this.b=s[2]*t+s[5]*n+s[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},oa=new zt;zt.NAMES=MZ;var o0=class extends lr{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Ua,this.environmentIntensity=1,this.environmentRotation=new Ua,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}},Pu=new re,_d=new re,c8=new re,xd=new re,Nv=new re,Fv=new re,HY=new re,u8=new re,h8=new re,f8=new re,d8=new xn,p8=new xn,m8=new xn,Sd=class i{constructor(e=new re,t=new re,n=new re){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),Pu.subVectors(e,t),r.cross(Pu);let s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,n,r,s){Pu.subVectors(r,t),_d.subVectors(n,t),c8.subVectors(e,t);let o=Pu.dot(Pu),a=Pu.dot(_d),l=Pu.dot(c8),c=_d.dot(_d),u=_d.dot(c8),f=o*c-a*a;if(f===0)return s.set(0,0,0),null;let d=1/f,A=(c*l-a*u)*d,y=(o*u-a*l)*d;return s.set(1-A-y,y,A)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,xd)===null?!1:xd.x>=0&&xd.y>=0&&xd.x+xd.y<=1}static getInterpolation(e,t,n,r,s,o,a,l){return this.getBarycoord(e,t,n,r,xd)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,xd.x),l.addScaledVector(o,xd.y),l.addScaledVector(a,xd.z),l)}static getInterpolatedAttribute(e,t,n,r,s,o){return d8.setScalar(0),p8.setScalar(0),m8.setScalar(0),d8.fromBufferAttribute(e,t),p8.fromBufferAttribute(e,n),m8.fromBufferAttribute(e,r),o.setScalar(0),o.addScaledVector(d8,s.x),o.addScaledVector(p8,s.y),o.addScaledVector(m8,s.z),o}static isFrontFacing(e,t,n,r){return Pu.subVectors(n,t),_d.subVectors(e,t),Pu.cross(_d).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Pu.subVectors(this.c,this.b),_d.subVectors(this.a,this.b),Pu.cross(_d).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return i.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return i.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,r,s){return i.getInterpolation(e,this.a,this.b,this.c,t,n,r,s)}containsPoint(e){return i.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return i.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n=this.a,r=this.b,s=this.c,o,a;Nv.subVectors(r,n),Fv.subVectors(s,n),u8.subVectors(e,n);let l=Nv.dot(u8),c=Fv.dot(u8);if(l<=0&&c<=0)return t.copy(n);h8.subVectors(e,r);let u=Nv.dot(h8),f=Fv.dot(h8);if(u>=0&&f<=u)return t.copy(r);let d=l*f-u*c;if(d<=0&&l>=0&&u<=0)return o=l/(l-u),t.copy(n).addScaledVector(Nv,o);f8.subVectors(e,s);let A=Nv.dot(f8),y=Fv.dot(f8);if(y>=0&&A<=y)return t.copy(s);let w=A*c-l*y;if(w<=0&&c>=0&&y<=0)return a=c/(c-y),t.copy(n).addScaledVector(Fv,a);let S=u*y-A*f;if(S<=0&&f-u>=0&&A-y>=0)return HY.subVectors(s,r),a=(f-u)/(f-u+(A-y)),t.copy(r).addScaledVector(HY,a);let T=1/(S+w+d);return o=w*T,a=d*T,t.copy(n).addScaledVector(Nv,o).addScaledVector(Fv,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},ka=class{constructor(e=new re(1/0,1/0,1/0),t=new re(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(Lu.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Lu.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=Lu.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let n=e.geometry;if(n!==void 0){let s=n.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let o=0,a=s.count;o<a;o++)e.isMesh===!0?e.getVertexPosition(o,Lu):Lu.fromBufferAttribute(s,o),Lu.applyMatrix4(e.matrixWorld),this.expandByPoint(Lu);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),I3.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),I3.copy(n.boundingBox)),I3.applyMatrix4(e.matrixWorld),this.union(I3)}let r=e.children;for(let s=0,o=r.length;s<o;s++)this.expandByObject(r[s],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Lu),Lu.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(w2),P3.subVectors(this.max,w2),Bv.subVectors(e.a,w2),Ov.subVectors(e.b,w2),Uv.subVectors(e.c,w2),Yp.subVectors(Ov,Bv),Zp.subVectors(Uv,Ov),IA.subVectors(Bv,Uv);let t=[0,-Yp.z,Yp.y,0,-Zp.z,Zp.y,0,-IA.z,IA.y,Yp.z,0,-Yp.x,Zp.z,0,-Zp.x,IA.z,0,-IA.x,-Yp.y,Yp.x,0,-Zp.y,Zp.x,0,-IA.y,IA.x,0];return!A8(t,Bv,Ov,Uv,P3)||(t=[1,0,0,0,1,0,0,0,1],!A8(t,Bv,Ov,Uv,P3))?!1:(L3.crossVectors(Yp,Zp),t=[L3.x,L3.y,L3.z],A8(t,Bv,Ov,Uv,P3))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Lu).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Lu).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(yd[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),yd[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),yd[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),yd[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),yd[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),yd[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),yd[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),yd[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(yd),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}},yd=[new re,new re,new re,new re,new re,new re,new re,new re],Lu=new re,I3=new ka,Bv=new re,Ov=new re,Uv=new re,Yp=new re,Zp=new re,IA=new re,w2=new re,P3=new re,L3=new re,PA=new re;function A8(i,e,t,n,r){for(let s=0,o=i.length-3;s<=o;s+=3){PA.fromArray(i,s);let a=r.x*Math.abs(PA.x)+r.y*Math.abs(PA.y)+r.z*Math.abs(PA.z),l=e.dot(PA),c=t.dot(PA),u=n.dot(PA);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}var Td=fAe();function fAe(){let i=new ArrayBuffer(4),e=new Float32Array(i),t=new Uint32Array(i),n=new Uint32Array(512),r=new Uint32Array(512);for(let l=0;l<256;++l){let c=l-127;c<-27?(n[l]=0,n[l|256]=32768,r[l]=24,r[l|256]=24):c<-14?(n[l]=1024>>-c-14,n[l|256]=1024>>-c-14|32768,r[l]=-c-1,r[l|256]=-c-1):c<=15?(n[l]=c+15<<10,n[l|256]=c+15<<10|32768,r[l]=13,r[l|256]=13):c<128?(n[l]=31744,n[l|256]=64512,r[l]=24,r[l|256]=24):(n[l]=31744,n[l|256]=64512,r[l]=13,r[l|256]=13)}let s=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,u=0;for(;(c&8388608)===0;)c<<=1,u-=8388608;c&=-8388609,u+=947912704,s[l]=c|u}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)o[l]=l<<23;o[31]=1199570944,o[32]=2147483648;for(let l=33;l<63;++l)o[l]=2147483648+(l-32<<23);o[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(a[l]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:r,mantissaTable:s,exponentTable:o,offsetTable:a}}function Zl(i){Math.abs(i)>65504&&Xe("DataUtils.toHalfFloat(): Value out of range."),i=Nn(i,-65504,65504),Td.floatView[0]=i;let e=Td.uint32View[0],t=e>>23&511;return Td.baseTable[t]+((e&8388607)>>Td.shiftTable[t])}function D3(i){let e=i>>10;return Td.uint32View[0]=Td.mantissaTable[Td.offsetTable[e]+(i&1023)]+Td.exponentTable[e],Td.floatView[0]}var Vs=new re,N3=new Oe,dAe=0,Hi=class extends la{constructor(e,t,n=!1){if(super(),Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:dAe++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=r0,this.updateRanges=[],this.gpuType=cr,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[n+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)N3.fromBufferAttribute(this,t),N3.applyMatrix3(e),this.setXY(t,N3.x,N3.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)Vs.fromBufferAttribute(this,t),Vs.applyMatrix3(e),this.setXYZ(t,Vs.x,Vs.y,Vs.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)Vs.fromBufferAttribute(this,t),Vs.applyMatrix4(e),this.setXYZ(t,Vs.x,Vs.y,Vs.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Vs.fromBufferAttribute(this,t),Vs.applyNormalMatrix(e),this.setXYZ(t,Vs.x,Vs.y,Vs.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Vs.fromBufferAttribute(this,t),Vs.transformDirection(e),this.setXYZ(t,Vs.x,Vs.y,Vs.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=Fa(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Zn(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Fa(t,this.array)),t}setX(e,t){return this.normalized&&(t=Zn(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Fa(t,this.array)),t}setY(e,t){return this.normalized&&(t=Zn(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=Fa(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Zn(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=Fa(t,this.array)),t}setW(e,t){return this.normalized&&(t=Zn(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Zn(t,this.array),n=Zn(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=Zn(t,this.array),n=Zn(n,this.array),r=Zn(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this}setXYZW(e,t,n,r,s){return e*=this.itemSize,this.normalized&&(t=Zn(t,this.array),n=Zn(n,this.array),r=Zn(r,this.array),s=Zn(s,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==r0&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:"dispose"})}};var qA=class extends Hi{constructor(e,t,n){super(new Uint16Array(e),t,n)}};var HA=class extends Hi{constructor(e,t,n){super(new Uint32Array(e),t,n)}},e_=class extends Hi{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=D3(this.array[e*this.itemSize]);return this.normalized&&(t=Fa(t,this.array)),t}setX(e,t){return this.normalized&&(t=Zn(t,this.array)),this.array[e*this.itemSize]=Zl(t),this}getY(e){let t=D3(this.array[e*this.itemSize+1]);return this.normalized&&(t=Fa(t,this.array)),t}setY(e,t){return this.normalized&&(t=Zn(t,this.array)),this.array[e*this.itemSize+1]=Zl(t),this}getZ(e){let t=D3(this.array[e*this.itemSize+2]);return this.normalized&&(t=Fa(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Zn(t,this.array)),this.array[e*this.itemSize+2]=Zl(t),this}getW(e){let t=D3(this.array[e*this.itemSize+3]);return this.normalized&&(t=Fa(t,this.array)),t}setW(e,t){return this.normalized&&(t=Zn(t,this.array)),this.array[e*this.itemSize+3]=Zl(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Zn(t,this.array),n=Zn(n,this.array)),this.array[e+0]=Zl(t),this.array[e+1]=Zl(n),this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=Zn(t,this.array),n=Zn(n,this.array),r=Zn(r,this.array)),this.array[e+0]=Zl(t),this.array[e+1]=Zl(n),this.array[e+2]=Zl(r),this}setXYZW(e,t,n,r,s){return e*=this.itemSize,this.normalized&&(t=Zn(t,this.array),n=Zn(n,this.array),r=Zn(r,this.array),s=Zn(s,this.array)),this.array[e+0]=Zl(t),this.array[e+1]=Zl(n),this.array[e+2]=Zl(r),this.array[e+3]=Zl(s),this}},Ln=class extends Hi{constructor(e,t,n){super(new Float32Array(e),t,n)}},pAe=new ka,S2=new re,g8=new re,yl=class{constructor(e=new re,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let n=this.center;t!==void 0?n.copy(t):pAe.setFromPoints(e).getCenter(n);let r=0;for(let s=0,o=e.length;s<o;s++)r=Math.max(r,n.distanceToSquared(e[s]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;S2.subVectors(e,this.center);let t=S2.lengthSq();if(t>this.radius*this.radius){let n=Math.sqrt(t),r=(n-this.radius)*.5;this.center.addScaledVector(S2,r/n),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(g8.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(S2.copy(e.center).add(g8)),this.expandByPoint(S2.copy(e.center).sub(g8))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}},mAe=0,Gc=new cn,v8=new lr,kv=new re,Kl=new ka,T2=new ka,_o=new re,Xn=class i extends la{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:mAe++}),this.uuid=Ih(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={},this._transformed=!1}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(kme(e)?HA:qA)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);let n=this.attributes.normal;if(n!==void 0){let s=new Mn().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}let r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this._transformed=!0,this}applyQuaternion(e){return Gc.makeRotationFromQuaternion(e),this.applyMatrix4(Gc),this}rotateX(e){return Gc.makeRotationX(e),this.applyMatrix4(Gc),this}rotateY(e){return Gc.makeRotationY(e),this.applyMatrix4(Gc),this}rotateZ(e){return Gc.makeRotationZ(e),this.applyMatrix4(Gc),this}translate(e,t,n){return Gc.makeTranslation(e,t,n),this.applyMatrix4(Gc),this}scale(e,t,n){return Gc.makeScale(e,t,n),this.applyMatrix4(Gc),this}lookAt(e){return v8.lookAt(e),v8.updateMatrix(),this.applyMatrix4(v8.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(kv).negate(),this.translate(kv.x,kv.y,kv.z),this}setFromPoints(e){let t=this.getAttribute("position");if(t===void 0){let n=[];for(let r=0,s=e.length;r<s;r++){let o=e[r];n.push(o.x,o.y,o.z||0)}this.setAttribute("position",new Ln(n,3))}else{let n=Math.min(e.length,t.count);for(let r=0;r<n;r++){let s=e[r];t.setXYZ(r,s.x,s.y,s.z||0)}e.length>t.count&&Xe("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new ka);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){ze("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new re(-1/0,-1/0,-1/0),new re(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,r=t.length;n<r;n++){let s=t[n];Kl.setFromBufferAttribute(s),this.morphTargetsRelative?(_o.addVectors(this.boundingBox.min,Kl.min),this.boundingBox.expandByPoint(_o),_o.addVectors(this.boundingBox.max,Kl.max),this.boundingBox.expandByPoint(_o)):(this.boundingBox.expandByPoint(Kl.min),this.boundingBox.expandByPoint(Kl.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&ze('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new yl);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){ze("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new re,1/0);return}if(e){let n=this.boundingSphere.center;if(Kl.setFromBufferAttribute(e),t)for(let s=0,o=t.length;s<o;s++){let a=t[s];T2.setFromBufferAttribute(a),this.morphTargetsRelative?(_o.addVectors(Kl.min,T2.min),Kl.expandByPoint(_o),_o.addVectors(Kl.max,T2.max),Kl.expandByPoint(_o)):(Kl.expandByPoint(T2.min),Kl.expandByPoint(T2.max))}Kl.getCenter(n);let r=0;for(let s=0,o=e.count;s<o;s++)_o.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(_o));if(t)for(let s=0,o=t.length;s<o;s++){let a=t[s],l=this.morphTargetsRelative;for(let c=0,u=a.count;c<u;c++)_o.fromBufferAttribute(a,c),l&&(kv.fromBufferAttribute(e,c),_o.add(kv)),r=Math.max(r,n.distanceToSquared(_o))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&ze('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){ze("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let n=t.position,r=t.normal,s=t.uv,o=this.getAttribute("tangent");(o===void 0||o.count!==n.count)&&(o=new Hi(new Float32Array(4*n.count),4),this.setAttribute("tangent",o));let a=[],l=[];for(let C=0;C<n.count;C++)a[C]=new re,l[C]=new re;let c=new re,u=new re,f=new re,d=new Oe,A=new Oe,y=new Oe,w=new re,S=new re;function T(C,B,k){c.fromBufferAttribute(n,C),u.fromBufferAttribute(n,B),f.fromBufferAttribute(n,k),d.fromBufferAttribute(s,C),A.fromBufferAttribute(s,B),y.fromBufferAttribute(s,k),u.sub(c),f.sub(c),A.sub(d),y.sub(d);let z=1/(A.x*y.y-y.x*A.y);isFinite(z)&&(w.copy(u).multiplyScalar(y.y).addScaledVector(f,-A.y).multiplyScalar(z),S.copy(f).multiplyScalar(A.x).addScaledVector(u,-y.x).multiplyScalar(z),a[C].add(w),a[B].add(w),a[k].add(w),l[C].add(S),l[B].add(S),l[k].add(S))}let R=this.groups;R.length===0&&(R=[{start:0,count:e.count}]);for(let C=0,B=R.length;C<B;++C){let k=R[C],z=k.start,G=k.count;for(let W=z,Y=z+G;W<Y;W+=3)T(e.getX(W+0),e.getX(W+1),e.getX(W+2))}let P=new re,I=new re,F=new re,D=new re;function L(C){F.fromBufferAttribute(r,C),D.copy(F);let B=a[C];P.copy(B),P.sub(F.multiplyScalar(F.dot(B))).normalize(),I.crossVectors(D,B);let z=I.dot(l[C])<0?-1:1;o.setXYZW(C,P.x,P.y,P.z,z)}for(let C=0,B=R.length;C<B;++C){let k=R[C],z=k.start,G=k.count;for(let W=z,Y=z+G;W<Y;W+=3)L(e.getX(W+0)),L(e.getX(W+1)),L(e.getX(W+2))}this._transformed=!0}computeVertexNormals(){let e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0||n.count!==t.count)n=new Hi(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let d=0,A=n.count;d<A;d++)n.setXYZ(d,0,0,0);let r=new re,s=new re,o=new re,a=new re,l=new re,c=new re,u=new re,f=new re;if(e)for(let d=0,A=e.count;d<A;d+=3){let y=e.getX(d+0),w=e.getX(d+1),S=e.getX(d+2);r.fromBufferAttribute(t,y),s.fromBufferAttribute(t,w),o.fromBufferAttribute(t,S),u.subVectors(o,s),f.subVectors(r,s),u.cross(f),a.fromBufferAttribute(n,y),l.fromBufferAttribute(n,w),c.fromBufferAttribute(n,S),a.add(u),l.add(u),c.add(u),n.setXYZ(y,a.x,a.y,a.z),n.setXYZ(w,l.x,l.y,l.z),n.setXYZ(S,c.x,c.y,c.z)}else for(let d=0,A=t.count;d<A;d+=3)r.fromBufferAttribute(t,d+0),s.fromBufferAttribute(t,d+1),o.fromBufferAttribute(t,d+2),u.subVectors(o,s),f.subVectors(r,s),u.cross(f),n.setXYZ(d+0,u.x,u.y,u.z),n.setXYZ(d+1,u.x,u.y,u.z),n.setXYZ(d+2,u.x,u.y,u.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){let e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)_o.fromBufferAttribute(e,t),_o.normalize(),e.setXYZ(t,_o.x,_o.y,_o.z)}toNonIndexed(){function e(a,l){let c=a.array,u=a.itemSize,f=a.normalized,d=new c.constructor(l.length*u),A=0,y=0;for(let w=0,S=l.length;w<S;w++){a.isInterleavedBufferAttribute?A=l[w]*a.data.stride+a.offset:A=l[w]*u;for(let T=0;T<u;T++)d[y++]=c[A++]}return new Hi(d,u,f)}if(this.index===null)return Xe("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new i,n=this.index.array,r=this.attributes;for(let a in r){let l=r[a],c=e(l,n);t.setAttribute(a,c)}let s=this.morphAttributes;for(let a in s){let l=[],c=s[a];for(let u=0,f=c.length;u<f;u++){let d=c[u],A=e(d,n);l.push(A)}t.morphAttributes[a]=l}t.morphTargetsRelative=this.morphTargetsRelative;let o=this.groups;for(let a=0,l=o.length;a<l;a++){let c=o[a];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){let e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.parameters!==void 0&&this._transformed===!0?"BufferGeometry":this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0&&this._transformed!==!0){let l=this.parameters;for(let c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let n=this.attributes;for(let l in n){let c=n[l];e.data.attributes[l]=c.toJSON(e.data)}let r={},s=!1;for(let l in this.morphAttributes){let c=this.morphAttributes[l],u=[];for(let f=0,d=c.length;f<d;f++){let A=c[f];u.push(A.toJSON(e.data))}u.length>0&&(r[l]=u,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);let o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));let a=this.boundingSphere;return a!==null&&(e.data.boundingSphere=a.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;n!==null&&this.setIndex(n.clone());let r=e.attributes;for(let c in r){let u=r[c];this.setAttribute(c,u.clone(t))}let s=e.morphAttributes;for(let c in s){let u=[],f=s[c];for(let d=0,A=f.length;d<A;d++)u.push(f[d].clone(t));this.morphAttributes[c]=u}this.morphTargetsRelative=e.morphTargetsRelative;let o=e.groups;for(let c=0,u=o.length;c<u;c++){let f=o[c];this.addGroup(f.start,f.count,f.materialIndex)}let a=e.boundingBox;a!==null&&(this.boundingBox=a.clone());let l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this._transformed=e._transformed,this}dispose(){this.dispatchEvent({type:"dispose"})}},Id=class{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=r0,this.updateRanges=[],this.version=0,this.uuid=Ih()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let r=0,s=this.stride;r<s;r++)this.array[e+r]=t.array[n+r];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Ih()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Ih()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}},Da=new re,zo=class i{constructor(e,t,n,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=r}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)Da.fromBufferAttribute(this,t),Da.applyMatrix4(e),this.setXYZ(t,Da.x,Da.y,Da.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Da.fromBufferAttribute(this,t),Da.applyNormalMatrix(e),this.setXYZ(t,Da.x,Da.y,Da.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Da.fromBufferAttribute(this,t),Da.transformDirection(e),this.setXYZ(t,Da.x,Da.y,Da.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=Fa(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Zn(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=Zn(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Zn(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Zn(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Zn(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=Fa(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=Fa(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=Fa(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=Fa(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=Zn(t,this.array),n=Zn(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=Zn(t,this.array),n=Zn(n,this.array),r=Zn(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this}setXYZW(e,t,n,r,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=Zn(t,this.array),n=Zn(n,this.array),r=Zn(r,this.array),s=Zn(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this.data.array[e+3]=s,this}clone(e){if(e===void 0){VA("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");let t=[];for(let n=0;n<this.count;n++){let r=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return new Hi(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new i(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){VA("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");let t=[];for(let n=0;n<this.count;n++){let r=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}},AAe=0,Ws=class extends la{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:AAe++}),this.uuid=Ih(),this.name="",this.type="Material",this.blending=Ms,this.side=ko,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=e0,this.blendDst=t0,this.blendEquation=oo,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new zt(0,0,0),this.blendAlpha=0,this.depthFunc=Ph,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=B2,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=wd,this.stencilZFail=wd,this.stencilZPass=wd,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let n=e[t];if(n===void 0){Xe(`Material: parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){Xe(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector2&&n&&n.isVector2||r&&r.isEuler&&n&&n.isEuler||r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});let n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==Ms&&(n.blending=this.blending),this.side!==ko&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==e0&&(n.blendSrc=this.blendSrc),this.blendDst!==t0&&(n.blendDst=this.blendDst),this.blendEquation!==oo&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==Ph&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==B2&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==wd&&(n.stencilFail=this.stencilFail),this.stencilZFail!==wd&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==wd&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(s){let o=[];for(let a in s){let l=s[a];delete l.metadata,o.push(l)}return o}if(t){let s=r(e.textures),o=r(e.images);s.length>0&&(n.textures=s),o.length>0&&(n.images=o)}return n}fromJSON(e,t){if(e.uuid!==void 0&&(this.uuid=e.uuid),e.name!==void 0&&(this.name=e.name),e.color!==void 0&&this.color!==void 0&&this.color.setHex(e.color),e.roughness!==void 0&&(this.roughness=e.roughness),e.metalness!==void 0&&(this.metalness=e.metalness),e.sheen!==void 0&&(this.sheen=e.sheen),e.sheenColor!==void 0&&(this.sheenColor=new zt().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(this.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&this.emissive!==void 0&&this.emissive.setHex(e.emissive),e.specular!==void 0&&this.specular!==void 0&&this.specular.setHex(e.specular),e.specularIntensity!==void 0&&(this.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&this.specularColor!==void 0&&this.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(this.shininess=e.shininess),e.clearcoat!==void 0&&(this.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(this.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(this.dispersion=e.dispersion),e.iridescence!==void 0&&(this.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(this.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(this.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(this.transmission=e.transmission),e.thickness!==void 0&&(this.thickness=e.thickness),e.attenuationDistance!==void 0&&(this.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&this.attenuationColor!==void 0&&this.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(this.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(this.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(this.fog=e.fog),e.flatShading!==void 0&&(this.flatShading=e.flatShading),e.blending!==void 0&&(this.blending=e.blending),e.combine!==void 0&&(this.combine=e.combine),e.side!==void 0&&(this.side=e.side),e.shadowSide!==void 0&&(this.shadowSide=e.shadowSide),e.opacity!==void 0&&(this.opacity=e.opacity),e.transparent!==void 0&&(this.transparent=e.transparent),e.alphaTest!==void 0&&(this.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(this.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(this.depthFunc=e.depthFunc),e.depthTest!==void 0&&(this.depthTest=e.depthTest),e.depthWrite!==void 0&&(this.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(this.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(this.blendSrc=e.blendSrc),e.blendDst!==void 0&&(this.blendDst=e.blendDst),e.blendEquation!==void 0&&(this.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(this.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(this.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(this.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&this.blendColor!==void 0&&this.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(this.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(this.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(this.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(this.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(this.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(this.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(this.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(this.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(this.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(this.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(this.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(this.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(this.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(this.rotation=e.rotation),e.linewidth!==void 0&&(this.linewidth=e.linewidth),e.dashSize!==void 0&&(this.dashSize=e.dashSize),e.gapSize!==void 0&&(this.gapSize=e.gapSize),e.scale!==void 0&&(this.scale=e.scale),e.polygonOffset!==void 0&&(this.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(this.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(this.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(this.dithering=e.dithering),e.alphaToCoverage!==void 0&&(this.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(this.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(this.forceSinglePass=e.forceSinglePass),e.allowOverride!==void 0&&(this.allowOverride=e.allowOverride),e.visible!==void 0&&(this.visible=e.visible),e.toneMapped!==void 0&&(this.toneMapped=e.toneMapped),e.userData!==void 0&&(this.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?this.vertexColors=e.vertexColors>0:this.vertexColors=e.vertexColors),e.size!==void 0&&(this.size=e.size),e.sizeAttenuation!==void 0&&(this.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(this.map=t[e.map]||null),e.matcap!==void 0&&(this.matcap=t[e.matcap]||null),e.alphaMap!==void 0&&(this.alphaMap=t[e.alphaMap]||null),e.bumpMap!==void 0&&(this.bumpMap=t[e.bumpMap]||null),e.bumpScale!==void 0&&(this.bumpScale=e.bumpScale),e.normalMap!==void 0&&(this.normalMap=t[e.normalMap]||null),e.normalMapType!==void 0&&(this.normalMapType=e.normalMapType),e.normalScale!==void 0){let n=e.normalScale;Array.isArray(n)===!1&&(n=[n,n]),this.normalScale=new Oe().fromArray(n)}return e.displacementMap!==void 0&&(this.displacementMap=t[e.displacementMap]||null),e.displacementScale!==void 0&&(this.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(this.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(this.roughnessMap=t[e.roughnessMap]||null),e.metalnessMap!==void 0&&(this.metalnessMap=t[e.metalnessMap]||null),e.emissiveMap!==void 0&&(this.emissiveMap=t[e.emissiveMap]||null),e.emissiveIntensity!==void 0&&(this.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(this.specularMap=t[e.specularMap]||null),e.specularIntensityMap!==void 0&&(this.specularIntensityMap=t[e.specularIntensityMap]||null),e.specularColorMap!==void 0&&(this.specularColorMap=t[e.specularColorMap]||null),e.envMap!==void 0&&(this.envMap=t[e.envMap]||null),e.envMapRotation!==void 0&&this.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(this.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(this.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(this.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(this.lightMap=t[e.lightMap]||null),e.lightMapIntensity!==void 0&&(this.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(this.aoMap=t[e.aoMap]||null),e.aoMapIntensity!==void 0&&(this.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(this.gradientMap=t[e.gradientMap]||null),e.clearcoatMap!==void 0&&(this.clearcoatMap=t[e.clearcoatMap]||null),e.clearcoatRoughnessMap!==void 0&&(this.clearcoatRoughnessMap=t[e.clearcoatRoughnessMap]||null),e.clearcoatNormalMap!==void 0&&(this.clearcoatNormalMap=t[e.clearcoatNormalMap]||null),e.clearcoatNormalScale!==void 0&&(this.clearcoatNormalScale=new Oe().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(this.iridescenceMap=t[e.iridescenceMap]||null),e.iridescenceThicknessMap!==void 0&&(this.iridescenceThicknessMap=t[e.iridescenceThicknessMap]||null),e.transmissionMap!==void 0&&(this.transmissionMap=t[e.transmissionMap]||null),e.thicknessMap!==void 0&&(this.thicknessMap=t[e.thicknessMap]||null),e.anisotropyMap!==void 0&&(this.anisotropyMap=t[e.anisotropyMap]||null),e.sheenColorMap!==void 0&&(this.sheenColorMap=t[e.sheenColorMap]||null),e.sheenRoughnessMap!==void 0&&(this.sheenRoughnessMap=t[e.sheenRoughnessMap]||null),this}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(t!==null){let r=t.length;n=new Array(r);for(let s=0;s!==r;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}},Lh=class extends Ws{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new zt(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}},zv,E2=new re,Vv=new re,Gv=new re,qv=new Oe,M2=new Oe,CZ=new cn,F3=new re,C2=new re,B3=new re,WY=new Oe,_8=new Oe,jY=new Oe,WA=class extends lr{constructor(e=new Lh){if(super(),this.isSprite=!0,this.type="Sprite",zv===void 0){zv=new Xn;let t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new Id(t,5);zv.setIndex([0,1,2,0,2,3]),zv.setAttribute("position",new zo(n,3,0,!1)),zv.setAttribute("uv",new zo(n,2,3,!1))}this.geometry=zv,this.material=e,this.center=new Oe(.5,.5),this.count=1}raycast(e,t){e.camera===null&&ze('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Vv.setFromMatrixScale(this.matrixWorld),CZ.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Gv.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Vv.multiplyScalar(-Gv.z);let n=this.material.rotation,r,s;n!==0&&(s=Math.cos(n),r=Math.sin(n));let o=this.center;O3(F3.set(-.5,-.5,0),Gv,o,Vv,r,s),O3(C2.set(.5,-.5,0),Gv,o,Vv,r,s),O3(B3.set(.5,.5,0),Gv,o,Vv,r,s),WY.set(0,0),_8.set(1,0),jY.set(1,1);let a=e.ray.intersectTriangle(F3,C2,B3,!1,E2);if(a===null&&(O3(C2.set(-.5,.5,0),Gv,o,Vv,r,s),_8.set(0,1),a=e.ray.intersectTriangle(F3,B3,C2,!1,E2),a===null))return;let l=e.ray.origin.distanceTo(E2);l<e.near||l>e.far||t.push({distance:l,point:E2.clone(),uv:Sd.getInterpolation(E2,F3,C2,B3,WY,_8,jY,new Oe),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}};function O3(i,e,t,n,r,s){qv.subVectors(i,t).addScalar(.5).multiply(n),r!==void 0?(M2.x=s*qv.x-r*qv.y,M2.y=r*qv.x+s*qv.y):M2.copy(qv),i.copy(e),i.x+=M2.x,i.y+=M2.y,i.applyMatrix4(CZ)}var bd=new re,x8=new re,U3=new re,Kp=new re,y8=new re,k3=new re,b8=new re,Pd=class{constructor(e=new re,t=new re(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,bd)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=bd.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(bd.copy(this.origin).addScaledVector(this.direction,t),bd.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){x8.copy(e).add(t).multiplyScalar(.5),U3.copy(t).sub(e).normalize(),Kp.copy(this.origin).sub(x8);let s=e.distanceTo(t)*.5,o=-this.direction.dot(U3),a=Kp.dot(this.direction),l=-Kp.dot(U3),c=Kp.lengthSq(),u=Math.abs(1-o*o),f,d,A,y;if(u>0)if(f=o*l-a,d=o*a-l,y=s*u,f>=0)if(d>=-y)if(d<=y){let w=1/u;f*=w,d*=w,A=f*(f+o*d+2*a)+d*(o*f+d+2*l)+c}else d=s,f=Math.max(0,-(o*d+a)),A=-f*f+d*(d+2*l)+c;else d=-s,f=Math.max(0,-(o*d+a)),A=-f*f+d*(d+2*l)+c;else d<=-y?(f=Math.max(0,-(-o*s+a)),d=f>0?-s:Math.min(Math.max(-s,-l),s),A=-f*f+d*(d+2*l)+c):d<=y?(f=0,d=Math.min(Math.max(-s,-l),s),A=d*(d+2*l)+c):(f=Math.max(0,-(o*s+a)),d=f>0?s:Math.min(Math.max(-s,-l),s),A=-f*f+d*(d+2*l)+c);else d=o>0?-s:s,f=Math.max(0,-(o*d+a)),A=-f*f+d*(d+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,f),r&&r.copy(x8).addScaledVector(U3,d),A}intersectSphere(e,t){bd.subVectors(e.center,this.origin);let n=bd.dot(this.direction),r=bd.dot(bd)-n*n,s=e.radius*e.radius;if(r>s)return null;let o=Math.sqrt(s-r),a=n-o,l=n+o;return l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,s,o,a,l,c=1/this.direction.x,u=1/this.direction.y,f=1/this.direction.z,d=this.origin;return c>=0?(n=(e.min.x-d.x)*c,r=(e.max.x-d.x)*c):(n=(e.max.x-d.x)*c,r=(e.min.x-d.x)*c),u>=0?(s=(e.min.y-d.y)*u,o=(e.max.y-d.y)*u):(s=(e.max.y-d.y)*u,o=(e.min.y-d.y)*u),n>o||s>r||((s>n||isNaN(n))&&(n=s),(o<r||isNaN(r))&&(r=o),f>=0?(a=(e.min.z-d.z)*f,l=(e.max.z-d.z)*f):(a=(e.max.z-d.z)*f,l=(e.min.z-d.z)*f),n>l||a>r)||((a>n||n!==n)&&(n=a),(l<r||r!==r)&&(r=l),r<0)?null:this.at(n>=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,bd)!==null}intersectTriangle(e,t,n,r,s){y8.subVectors(t,e),k3.subVectors(n,e),b8.crossVectors(y8,k3);let o=this.direction.dot(b8),a;if(o>0){if(r)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Kp.subVectors(this.origin,e);let l=a*this.direction.dot(k3.crossVectors(Kp,k3));if(l<0)return null;let c=a*this.direction.dot(y8.cross(Kp));if(c<0||l+c>o)return null;let u=-a*Kp.dot(b8);return u<0?null:this.at(u/o,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},fs=class extends Ws{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new zt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ua,this.combine=ig,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}},XY=new cn,LA=new Pd,z3=new yl,$Y=new re,V3=new re,G3=new re,q3=new re,w8=new re,H3=new re,YY=new re,W3=new re,Hn=class extends lr{constructor(e=new Xn,t=new fs){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){let a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}getVertexPosition(e,t){let n=this.geometry,r=n.attributes.position,s=n.morphAttributes.position,o=n.morphTargetsRelative;t.fromBufferAttribute(r,e);let a=this.morphTargetInfluences;if(s&&a){H3.set(0,0,0);for(let l=0,c=s.length;l<c;l++){let u=a[l],f=s[l];u!==0&&(w8.fromBufferAttribute(f,e),o?H3.addScaledVector(w8,u):H3.addScaledVector(w8.sub(t),u))}t.add(H3)}return t}raycast(e,t){let n=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),z3.copy(n.boundingSphere),z3.applyMatrix4(s),LA.copy(e.ray).recast(e.near),!(z3.containsPoint(LA.origin)===!1&&(LA.intersectSphere(z3,$Y)===null||LA.origin.distanceToSquared($Y)>(e.far-e.near)**2))&&(XY.copy(s).invert(),LA.copy(e.ray).applyMatrix4(XY),!(n.boundingBox!==null&&LA.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,LA)))}_computeIntersections(e,t,n){let r,s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,u=s.attributes.uv1,f=s.attributes.normal,d=s.groups,A=s.drawRange;if(a!==null)if(Array.isArray(o))for(let y=0,w=d.length;y<w;y++){let S=d[y],T=o[S.materialIndex],R=Math.max(S.start,A.start),P=Math.min(a.count,Math.min(S.start+S.count,A.start+A.count));for(let I=R,F=P;I<F;I+=3){let D=a.getX(I),L=a.getX(I+1),C=a.getX(I+2);r=j3(this,T,e,n,c,u,f,D,L,C),r&&(r.faceIndex=Math.floor(I/3),r.face.materialIndex=S.materialIndex,t.push(r))}}else{let y=Math.max(0,A.start),w=Math.min(a.count,A.start+A.count);for(let S=y,T=w;S<T;S+=3){let R=a.getX(S),P=a.getX(S+1),I=a.getX(S+2);r=j3(this,o,e,n,c,u,f,R,P,I),r&&(r.faceIndex=Math.floor(S/3),t.push(r))}}else if(l!==void 0)if(Array.isArray(o))for(let y=0,w=d.length;y<w;y++){let S=d[y],T=o[S.materialIndex],R=Math.max(S.start,A.start),P=Math.min(l.count,Math.min(S.start+S.count,A.start+A.count));for(let I=R,F=P;I<F;I+=3){let D=I,L=I+1,C=I+2;r=j3(this,T,e,n,c,u,f,D,L,C),r&&(r.faceIndex=Math.floor(I/3),r.face.materialIndex=S.materialIndex,t.push(r))}}else{let y=Math.max(0,A.start),w=Math.min(l.count,A.start+A.count);for(let S=y,T=w;S<T;S+=3){let R=S,P=S+1,I=S+2;r=j3(this,o,e,n,c,u,f,R,P,I),r&&(r.faceIndex=Math.floor(S/3),t.push(r))}}}};function gAe(i,e,t,n,r,s,o,a){let l;if(e.side===mi?l=n.intersectTriangle(o,s,r,!0,a):l=n.intersectTriangle(r,s,o,e.side===ko,a),l===null)return null;W3.copy(a),W3.applyMatrix4(i.matrixWorld);let c=t.ray.origin.distanceTo(W3);return c<t.near||c>t.far?null:{distance:c,point:W3.clone(),object:i}}function j3(i,e,t,n,r,s,o,a,l,c){i.getVertexPosition(a,V3),i.getVertexPosition(l,G3),i.getVertexPosition(c,q3);let u=gAe(i,e,t,n,V3,G3,q3,YY);if(u){let f=new re;Sd.getBarycoord(YY,V3,G3,q3,f),r&&(u.uv=Sd.getInterpolatedAttribute(r,a,l,c,f,new Oe)),s&&(u.uv1=Sd.getInterpolatedAttribute(s,a,l,c,f,new Oe)),o&&(u.normal=Sd.getInterpolatedAttribute(o,a,l,c,f,new re),u.normal.dot(n.direction)>0&&u.normal.multiplyScalar(-1));let d={a,b:l,c,normal:new re,materialIndex:0};Sd.getNormal(V3,G3,q3,d.normal),u.face=d,u.barycoord=f}return u}var jA=class extends Hs{constructor(e=null,t=1,n=1,r,s,o,a,l,c=Ti,u=Ti,f,d){super(null,o,a,l,c,u,r,s,f,d),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var Ql=class extends Hi{constructor(e,t,n,r=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){let e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}};var S8=new re,vAe=new re,_Ae=new Mn,Na=class{constructor(e=new re(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){let r=S8.subVectors(n,t).cross(vAe.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t,n=!0){let r=e.delta(S8),s=this.normal.dot(r);if(s===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;let o=-(e.start.dot(this.normal)+this.constant)/s;return n===!0&&(o<0||o>1)?null:t.copy(e.start).addScaledVector(r,o)}intersectsLine(e){let t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let n=t||_Ae.getNormalMatrix(e),r=this.coplanarPoint(S8).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}},DA=new yl,xAe=new Oe(.5,.5),X3=new re,qc=class{constructor(e=new Na,t=new Na,n=new Na,r=new Na,s=new Na,o=new Na){this.planes=[e,t,n,r,s,o]}set(e,t,n,r,s,o){let a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(n),a[3].copy(r),a[4].copy(s),a[5].copy(o),this}copy(e){let t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=Uo,n=!1){let r=this.planes,s=e.elements,o=s[0],a=s[1],l=s[2],c=s[3],u=s[4],f=s[5],d=s[6],A=s[7],y=s[8],w=s[9],S=s[10],T=s[11],R=s[12],P=s[13],I=s[14],F=s[15];if(r[0].setComponents(c-o,A-u,T-y,F-R).normalize(),r[1].setComponents(c+o,A+u,T+y,F+R).normalize(),r[2].setComponents(c+a,A+f,T+w,F+P).normalize(),r[3].setComponents(c-a,A-f,T-w,F-P).normalize(),n)r[4].setComponents(l,d,S,I).normalize(),r[5].setComponents(c-l,A-d,T-S,F-I).normalize();else if(r[4].setComponents(c-l,A-d,T-S,F-I).normalize(),t===Uo)r[5].setComponents(c+l,A+d,T+S,F+I).normalize();else if(t===xl)r[5].setComponents(l,d,S,I).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),DA.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),DA.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(DA)}intersectsSprite(e){DA.center.set(0,0,0);let t=xAe.distanceTo(e.center);return DA.radius=.7071067811865476+t,DA.applyMatrix4(e.matrixWorld),this.intersectsSphere(DA)}intersectsSphere(e){let t=this.planes,n=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)<r)return!1;return!0}intersectsBox(e){let t=this.planes;for(let n=0;n<6;n++){let r=t[n];if(X3.x=r.normal.x>0?e.max.x:e.min.x,X3.y=r.normal.y>0?e.max.y:e.min.y,X3.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(X3)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}},ZY=new cn,O2=class i{constructor(){this.coordinateSystem=Uo,this._frustums=[],this._count=0}setFromArrayCamera(e){let t=e.cameras,n=this._frustums;for(let r=0;r<t.length;r++){let s=t[r];ZY.multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse),n[r]===void 0&&(n[r]=new qc),n[r].setFromProjectionMatrix(ZY,s.coordinateSystem,s.reversedDepth)}return this._count=t.length,this}intersectsObject(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsObject(e))return!0;return!1}intersectsSprite(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsSprite(e))return!0;return!1}intersectsSphere(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsSphere(e))return!0;return!1}intersectsBox(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsBox(e))return!0;return!1}containsPoint(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].containsPoint(e))return!0;return!1}copy(e){this.coordinateSystem=e.coordinateSystem;let t=this._frustums,n=e._frustums;for(let r=0;r<e._count;r++)t[r]===void 0&&(t[r]=new qc),t[r].copy(n[r]);return this._count=e._count,this}clone(){return new i().copy(this)}};var Du=class extends Ws{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new zt(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}},cM=new re,uM=new re,KY=new cn,R2=new Pd,$3=new yl,T8=new re,QY=new re,a0=class extends lr{constructor(e=new Xn,t=new Du){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[0];for(let r=1,s=t.count;r<s;r++)cM.fromBufferAttribute(t,r-1),uM.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=cM.distanceTo(uM);e.setAttribute("lineDistance",new Ln(n,1))}else Xe("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){let n=this.geometry,r=this.matrixWorld,s=e.params.Line.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),$3.copy(n.boundingSphere),$3.applyMatrix4(r),$3.radius+=s,e.ray.intersectsSphere($3)===!1)return;KY.copy(r).invert(),R2.copy(e.ray).applyMatrix4(KY);let a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=this.isLineSegments?2:1,u=n.index,d=n.attributes.position;if(u!==null){let A=Math.max(0,o.start),y=Math.min(u.count,o.start+o.count);for(let w=A,S=y-1;w<S;w+=c){let T=u.getX(w),R=u.getX(w+1),P=Y3(this,e,R2,l,T,R,w);P&&t.push(P)}if(this.isLineLoop){let w=u.getX(y-1),S=u.getX(A),T=Y3(this,e,R2,l,w,S,y-1);T&&t.push(T)}}else{let A=Math.max(0,o.start),y=Math.min(d.count,o.start+o.count);for(let w=A,S=y-1;w<S;w+=c){let T=Y3(this,e,R2,l,w,w+1,w);T&&t.push(T)}if(this.isLineLoop){let w=Y3(this,e,R2,l,y-1,A,y-1);w&&t.push(w)}}}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){let a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}};function Y3(i,e,t,n,r,s,o){let a=i.geometry.attributes.position;if(cM.fromBufferAttribute(a,r),uM.fromBufferAttribute(a,s),t.distanceSqToSegment(cM,uM,T8,QY)>n)return;T8.applyMatrix4(i.matrixWorld);let c=e.ray.origin.distanceTo(T8);if(!(c<e.near||c>e.far))return{distance:c,point:QY.clone().applyMatrix4(i.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:i}}var JY=new re,eZ=new re,t_=class extends a0{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[];for(let r=0,s=t.count;r<s;r+=2)JY.fromBufferAttribute(t,r),eZ.fromBufferAttribute(t,r+1),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+JY.distanceTo(eZ);e.setAttribute("lineDistance",new Ln(n,1))}else Xe("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}};var l0=class extends Ws{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new zt(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}},tZ=new cn,F8=new Pd,Z3=new yl,K3=new re,U2=class extends lr{constructor(e=new Xn,t=new l0){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){let n=this.geometry,r=this.matrixWorld,s=e.params.Points.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Z3.copy(n.boundingSphere),Z3.applyMatrix4(r),Z3.radius+=s,e.ray.intersectsSphere(Z3)===!1)return;tZ.copy(r).invert(),F8.copy(e.ray).applyMatrix4(tZ);let a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=n.index,f=n.attributes.position;if(c!==null){let d=Math.max(0,o.start),A=Math.min(c.count,o.start+o.count);for(let y=d,w=A;y<w;y++){let S=c.getX(y);K3.fromBufferAttribute(f,S),nZ(K3,S,l,r,e,t,this)}}else{let d=Math.max(0,o.start),A=Math.min(f.count,o.start+o.count);for(let y=d,w=A;y<w;y++)K3.fromBufferAttribute(f,y),nZ(K3,y,l,r,e,t,this)}}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){let a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}};function nZ(i,e,t,n,r,s,o){let a=F8.distanceSqToPoint(i);if(a<t){let l=new re;F8.closestPointToPoint(i,l),l.applyMatrix4(n);let c=r.ray.origin.distanceTo(l);if(c<r.near||c>r.far)return;s.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:o})}}var XA=class extends Hs{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=Ti,this.minFilter=Ti,this.generateMipmaps=!1,this.needsUpdate=!0}};var Dh=class extends Hs{constructor(e=[],t=ec,n,r,s,o,a,l,c,u){super(e,t,n,r,s,o,a,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}};var Cs=class extends Hs{constructor(e,t,n=xi,r,s,o,a=Ti,l=Ti,c,u=Gs,f=1){if(u!==Gs&&u!==xo)throw new Error("THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat");let d={width:e,height:t,depth:f};super(d,r,s,o,a,l,u,n,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new Qv(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}},n_=class extends Cs{constructor(e,t=xi,n=ec,r,s,o=Ti,a=Ti,l,c=Gs){let u={width:e,height:e,depth:1},f=[u,u,u,u,u,u];super(e,e,t,n,r,s,o,a,l,c),this.image=f,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}},k2=class extends Hs{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}},Nu=class i extends Xn{constructor(e=1,t=1,n=1,r=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:s,depthSegments:o};let a=this;r=Math.floor(r),s=Math.floor(s),o=Math.floor(o);let l=[],c=[],u=[],f=[],d=0,A=0;y("z","y","x",-1,-1,n,t,e,o,s,0),y("z","y","x",1,-1,n,t,-e,o,s,1),y("x","z","y",1,1,e,n,t,r,o,2),y("x","z","y",1,-1,e,n,-t,r,o,3),y("x","y","z",1,-1,e,t,n,r,s,4),y("x","y","z",-1,-1,e,t,-n,r,s,5),this.setIndex(l),this.setAttribute("position",new Ln(c,3)),this.setAttribute("normal",new Ln(u,3)),this.setAttribute("uv",new Ln(f,2));function y(w,S,T,R,P,I,F,D,L,C,B){let k=I/L,z=F/C,G=I/2,W=F/2,Y=D/2,H=L+1,$=C+1,J=0,te=0,ce=new re;for(let he=0;he<$;he++){let ve=he*z-W;for(let Re=0;Re<H;Re++){let Qe=Re*k-G;ce[w]=Qe*R,ce[S]=ve*P,ce[T]=Y,c.push(ce.x,ce.y,ce.z),ce[w]=0,ce[S]=0,ce[T]=D>0?1:-1,u.push(ce.x,ce.y,ce.z),f.push(Re/L),f.push(1-he/C),J+=1}}for(let he=0;he<C;he++)for(let ve=0;ve<L;ve++){let Re=d+ve+H*he,Qe=d+ve+H*(he+1),Fe=d+(ve+1)+H*(he+1),mt=d+(ve+1)+H*he;l.push(Re,Qe,mt),l.push(Qe,Fe,mt),te+=6}a.addGroup(A,te,B),A+=te,d+=J}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}};var i_=class i extends Xn{constructor(e=1,t=32,n=0,r=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},t=Math.max(3,t);let s=[],o=[],a=[],l=[],c=new re,u=new Oe;o.push(0,0,0),a.push(0,0,1),l.push(.5,.5);for(let f=0,d=3;f<=t;f++,d+=3){let A=n+f/t*r;c.x=e*Math.cos(A),c.y=e*Math.sin(A),o.push(c.x,c.y,c.z),a.push(0,0,1),u.x=(o[d]/e+1)/2,u.y=(o[d+1]/e+1)/2,l.push(u.x,u.y)}for(let f=1;f<=t;f++)s.push(f,f+1,0);this.setIndex(s),this.setAttribute("position",new Ln(o,3)),this.setAttribute("normal",new Ln(a,3)),this.setAttribute("uv",new Ln(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i(e.radius,e.segments,e.thetaStart,e.thetaLength)}},$A=class i extends Xn{constructor(e=1,t=1,n=1,r=32,s=1,o=!1,a=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l};let c=this;r=Math.floor(r),s=Math.floor(s);let u=[],f=[],d=[],A=[],y=0,w=[],S=n/2,T=0;R(),o===!1&&(e>0&&P(!0),t>0&&P(!1)),this.setIndex(u),this.setAttribute("position",new Ln(f,3)),this.setAttribute("normal",new Ln(d,3)),this.setAttribute("uv",new Ln(A,2));function R(){let I=new re,F=new re,D=0,L=(t-e)/n;for(let C=0;C<=s;C++){let B=[],k=C/s,z=k*(t-e)+e;for(let G=0;G<=r;G++){let W=G/r,Y=W*l+a,H=Math.sin(Y),$=Math.cos(Y);F.x=z*H,F.y=-k*n+S,F.z=z*$,f.push(F.x,F.y,F.z),I.set(H,L,$).normalize(),d.push(I.x,I.y,I.z),A.push(W,1-k),B.push(y++)}w.push(B)}for(let C=0;C<r;C++)for(let B=0;B<s;B++){let k=w[B][C],z=w[B+1][C],G=w[B+1][C+1],W=w[B][C+1];(e>0||B!==0)&&(u.push(k,z,W),D+=3),(t>0||B!==s-1)&&(u.push(z,G,W),D+=3)}c.addGroup(T,D,0),T+=D}function P(I){let F=y,D=new Oe,L=new re,C=0,B=I===!0?e:t,k=I===!0?1:-1;for(let G=1;G<=r;G++)f.push(0,S*k,0),d.push(0,k,0),A.push(.5,.5),y++;let z=y;for(let G=0;G<=r;G++){let Y=G/r*l+a,H=Math.cos(Y),$=Math.sin(Y);L.x=B*$,L.y=S*k,L.z=B*H,f.push(L.x,L.y,L.z),d.push(0,k,0),D.x=H*.5+.5,D.y=$*.5*k+.5,A.push(D.x,D.y),y++}for(let G=0;G<r;G++){let W=F+G,Y=z+G;I===!0?u.push(Y,Y+1,W):u.push(Y+1,Y,W),C+=3}c.addGroup(T,C,I===!0?1:2),T+=C}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}};var za=class{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){Xe("Curve: .getPoint() not implemented.")}getPointAt(e,t){let n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){let t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){let t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){let e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let t=[],n,r=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)n=this.getPoint(o/e),s+=n.distanceTo(r),t.push(s),r=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){let n=this.getLengths(),r=0,s=n.length,o;t?o=t:o=e*n[s-1];let a=0,l=s-1,c;for(;a<=l;)if(r=Math.floor(a+(l-a)/2),c=n[r]-o,c<0)a=r+1;else if(c>0)l=r-1;else{l=r;break}if(r=l,n[r]===o)return r/(s-1);let u=n[r],d=n[r+1]-u,A=(o-u)/d;return(r+A)/(s-1)}getTangent(e,t){let r=e-1e-4,s=e+1e-4;r<0&&(r=0),s>1&&(s=1);let o=this.getPoint(r),a=this.getPoint(s),l=t||(o.isVector2?new Oe:new re);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,t){let n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){let n=new re,r=[],s=[],o=[],a=new re,l=new cn;for(let A=0;A<=e;A++){let y=A/e;r[A]=this.getTangentAt(y,new re)}s[0]=new re,o[0]=new re;let c=Number.MAX_VALUE,u=Math.abs(r[0].x),f=Math.abs(r[0].y),d=Math.abs(r[0].z);u<=c&&(c=u,n.set(1,0,0)),f<=c&&(c=f,n.set(0,1,0)),d<=c&&n.set(0,0,1),a.crossVectors(r[0],n).normalize(),s[0].crossVectors(r[0],a),o[0].crossVectors(r[0],s[0]);for(let A=1;A<=e;A++){if(s[A]=s[A-1].clone(),o[A]=o[A-1].clone(),a.crossVectors(r[A-1],r[A]),a.length()>Number.EPSILON){a.normalize();let y=Math.acos(Nn(r[A-1].dot(r[A]),-1,1));s[A].applyMatrix4(l.makeRotationAxis(a,y))}o[A].crossVectors(r[A],s[A])}if(t===!0){let A=Math.acos(Nn(s[0].dot(s[e]),-1,1));A/=e,r[0].dot(a.crossVectors(s[0],s[e]))>0&&(A=-A);for(let y=1;y<=e;y++)s[y].applyMatrix4(l.makeRotationAxis(r[y],A*y)),o[y].crossVectors(r[y],s[y])}return{tangents:r,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}},r_=class extends za{constructor(e=0,t=0,n=1,r=1,s=0,o=Math.PI*2,a=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=r,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,t=new Oe){let n=t,r=Math.PI*2,s=this.aEndAngle-this.aStartAngle,o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=r;for(;s>r;)s-=r;s<Number.EPSILON&&(o?s=0:s=r),this.aClockwise===!0&&!o&&(s===r?s=-r:s=s-r);let a=this.aStartAngle+e*s,l=this.aX+this.xRadius*Math.cos(a),c=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){let u=Math.cos(this.aRotation),f=Math.sin(this.aRotation),d=l-this.aX,A=c-this.aY;l=d*u-A*f+this.aX,c=d*f+A*u+this.aY}return n.set(l,c)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){let e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}},hM=class extends r_{constructor(e,t,n,r,s,o){super(e,t,n,n,r,s,o),this.isArcCurve=!0,this.type="ArcCurve"}};function dF(){let i=0,e=0,t=0,n=0;function r(s,o,a,l){i=s,e=a,t=-3*s+3*o-2*a-l,n=2*s-2*o+a+l}return{initCatmullRom:function(s,o,a,l,c){r(o,a,c*(a-s),c*(l-o))},initNonuniformCatmullRom:function(s,o,a,l,c,u,f){let d=(o-s)/c-(a-s)/(c+u)+(a-o)/u,A=(a-o)/u-(l-o)/(u+f)+(l-a)/f;d*=u,A*=u,r(o,a,d,A)},calc:function(s){let o=s*s,a=o*s;return i+e*s+t*o+n*a}}}var iZ=new re,rZ=new re,E8=new dF,M8=new dF,C8=new dF,fM=class extends za{constructor(e=[],t=!1,n="centripetal",r=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=r}getPoint(e,t=new re){let n=t,r=this.points,s=r.length,o=(s-(this.closed?0:1))*e,a=Math.floor(o),l=o-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/s)+1)*s:l===0&&a===s-1&&(a=s-2,l=1);let c,u;this.closed||a>0?c=r[(a-1)%s]:(rZ.subVectors(r[0],r[1]).add(r[0]),c=rZ);let f=r[a%s],d=r[(a+1)%s];if(this.closed||a+2<s?u=r[(a+2)%s]:(iZ.subVectors(r[s-1],r[s-2]).add(r[s-1]),u=iZ),this.curveType==="centripetal"||this.curveType==="chordal"){let A=this.curveType==="chordal"?.5:.25,y=Math.pow(c.distanceToSquared(f),A),w=Math.pow(f.distanceToSquared(d),A),S=Math.pow(d.distanceToSquared(u),A);w<1e-4&&(w=1),y<1e-4&&(y=w),S<1e-4&&(S=w),E8.initNonuniformCatmullRom(c.x,f.x,d.x,u.x,y,w,S),M8.initNonuniformCatmullRom(c.y,f.y,d.y,u.y,y,w,S),C8.initNonuniformCatmullRom(c.z,f.z,d.z,u.z,y,w,S)}else this.curveType==="catmullrom"&&(E8.initCatmullRom(c.x,f.x,d.x,u.x,this.tension),M8.initCatmullRom(c.y,f.y,d.y,u.y,this.tension),C8.initCatmullRom(c.z,f.z,d.z,u.z,this.tension));return n.set(E8.calc(l),M8.calc(l),C8.calc(l)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let r=e.points[t];this.points.push(r.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){let r=this.points[t];e.points.push(r.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let r=e.points[t];this.points.push(new re().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}};function sZ(i,e,t,n,r){let s=(n-e)*.5,o=(r-t)*.5,a=i*i,l=i*a;return(2*t-2*n+s+o)*l+(-3*t+3*n-2*s-o)*a+s*i+t}function yAe(i,e){let t=1-i;return t*t*e}function bAe(i,e){return 2*(1-i)*i*e}function wAe(i,e){return i*i*e}function D2(i,e,t,n){return yAe(i,e)+bAe(i,t)+wAe(i,n)}function SAe(i,e){let t=1-i;return t*t*t*e}function TAe(i,e){let t=1-i;return 3*t*t*i*e}function EAe(i,e){return 3*(1-i)*i*i*e}function MAe(i,e){return i*i*i*e}function N2(i,e,t,n,r){return SAe(i,e)+TAe(i,t)+EAe(i,n)+MAe(i,r)}var z2=class extends za{constructor(e=new Oe,t=new Oe,n=new Oe,r=new Oe){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new Oe){let n=t,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return n.set(N2(e,r.x,s.x,o.x,a.x),N2(e,r.y,s.y,o.y,a.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}},s_=class extends za{constructor(e=new re,t=new re,n=new re,r=new re){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new re){let n=t,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return n.set(N2(e,r.x,s.x,o.x,a.x),N2(e,r.y,s.y,o.y,a.y),N2(e,r.z,s.z,o.z,a.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}},V2=class extends za{constructor(e=new Oe,t=new Oe){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new Oe){let n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new Oe){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},dM=class extends za{constructor(e=new re,t=new re){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new re){let n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new re){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},G2=class extends za{constructor(e=new Oe,t=new Oe,n=new Oe){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new Oe){let n=t,r=this.v0,s=this.v1,o=this.v2;return n.set(D2(e,r.x,s.x,o.x),D2(e,r.y,s.y,o.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},q2=class extends za{constructor(e=new re,t=new re,n=new re){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new re){let n=t,r=this.v0,s=this.v1,o=this.v2;return n.set(D2(e,r.x,s.x,o.x),D2(e,r.y,s.y,o.y),D2(e,r.z,s.z,o.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},H2=class extends za{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new Oe){let n=t,r=this.points,s=(r.length-1)*e,o=Math.floor(s),a=s-o,l=r[o===0?o:o-1],c=r[o],u=r[o>r.length-2?r.length-1:o+1],f=r[o>r.length-3?r.length-1:o+2];return n.set(sZ(a,l.x,c.x,u.x,f.x),sZ(a,l.y,c.y,u.y,f.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let r=e.points[t];this.points.push(r.clone())}return this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){let r=this.points[t];e.points.push(r.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let r=e.points[t];this.points.push(new Oe().fromArray(r))}return this}},pM=Object.freeze({__proto__:null,ArcCurve:hM,CatmullRomCurve3:fM,CubicBezierCurve:z2,CubicBezierCurve3:s_,EllipseCurve:r_,LineCurve:V2,LineCurve3:dM,QuadraticBezierCurve:G2,QuadraticBezierCurve3:q2,SplineCurve:H2}),mM=class extends za{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){let e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){let n=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new pM[n](t,e))}return this}getPoint(e,t){let n=e*this.getLength(),r=this.getCurveLengths(),s=0;for(;s<r.length;){if(r[s]>=n){let o=r[s]-n,a=this.curves[s],l=a.getLength(),c=l===0?0:1-o/l;return a.getPointAt(c,t)}s++}return null}getLength(){let e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let e=[],t=0;for(let n=0,r=this.curves.length;n<r;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){let t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){let t=[],n;for(let r=0,s=this.curves;r<s.length;r++){let o=s[r],a=o.isEllipseCurve?e*2:o.isLineCurve||o.isLineCurve3?1:o.isSplineCurve?e*o.points.length:e,l=o.getPoints(a);for(let c=0;c<l.length;c++){let u=l[c];n&&n.equals(u)||(t.push(u),n=u)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){let r=e.curves[t];this.curves.push(r.clone())}return this.autoClose=e.autoClose,this}toJSON(){let e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){let r=this.curves[t];e.curves.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){let r=e.curves[t];this.curves.push(new pM[r.type]().fromJSON(r))}return this}},YA=class extends mM{constructor(e){super(),this.type="Path",this.currentPoint=new Oe,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){let n=new V2(this.currentPoint.clone(),new Oe(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,r){let s=new G2(this.currentPoint.clone(),new Oe(e,t),new Oe(n,r));return this.curves.push(s),this.currentPoint.set(n,r),this}bezierCurveTo(e,t,n,r,s,o){let a=new z2(this.currentPoint.clone(),new Oe(e,t),new Oe(n,r),new Oe(s,o));return this.curves.push(a),this.currentPoint.set(s,o),this}splineThru(e){let t=[this.currentPoint.clone()].concat(e),n=new H2(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,r,s,o){let a=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+a,t+l,n,r,s,o),this}absarc(e,t,n,r,s,o){return this.absellipse(e,t,n,n,r,s,o),this}ellipse(e,t,n,r,s,o,a,l){let c=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(e+c,t+u,n,r,s,o,a,l),this}absellipse(e,t,n,r,s,o,a,l){let c=new r_(e,t,n,r,s,o,a,l);if(this.curves.length>0){let f=c.getPoint(0);f.equals(this.currentPoint)||this.lineTo(f.x,f.y)}this.curves.push(c);let u=c.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){let e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}},W2=class extends YA{constructor(e){super(e),this.uuid=Ih(),this.type="Shape",this.holes=[]}getPointsHoles(e){let t=[];for(let n=0,r=this.holes.length;n<r;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){let r=e.holes[t];this.holes.push(r.clone())}return this}toJSON(){let e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){let r=this.holes[t];e.holes.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){let r=e.holes[t];this.holes.push(new YA().fromJSON(r))}return this}};function CAe(i,e,t=2){let n=e&&e.length,r=n?e[0]*t:i.length,s=RZ(i,0,r,t,!0),o=[];if(!s||s.next===s.prev)return o;let a,l,c;if(n&&(s=DAe(i,e,s,t)),i.length>80*t){a=i[0],l=i[1];let u=a,f=l;for(let d=t;d<r;d+=t){let A=i[d],y=i[d+1];A<a&&(a=A),y<l&&(l=y),A>u&&(u=A),y>f&&(f=y)}c=Math.max(u-a,f-l),c=c!==0?32767/c:0}return j2(s,o,t,a,l,c,0),o}function RZ(i,e,t,n,r){let s;if(r===HAe(i,e,t,n)>0)for(let o=e;o<t;o+=n)s=oZ(o/n|0,i[o],i[o+1],s);else for(let o=t-n;o>=e;o-=n)s=oZ(o/n|0,i[o],i[o+1],s);return s&&o_(s,s.next)&&($2(s),s=s.next),s}function ZA(i,e){if(!i)return i;e||(e=i);let t=i,n;do if(n=!1,!t.steiner&&(o_(t,t.next)||Yr(t.prev,t,t.next)===0)){if($2(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function j2(i,e,t,n,r,s,o){if(!i)return;!o&&s&&UAe(i,n,r,s);let a=i;for(;i.prev!==i.next;){let l=i.prev,c=i.next;if(s?IAe(i,n,r,s):RAe(i)){e.push(l.i,i.i,c.i),$2(i),i=c.next,a=c.next;continue}if(i=c,i===a){o?o===1?(i=PAe(ZA(i),e),j2(i,e,t,n,r,s,2)):o===2&&LAe(i,e,t,n,r,s):j2(ZA(i),e,t,n,r,s,1);break}}}function RAe(i){let e=i.prev,t=i,n=i.next;if(Yr(e,t,n)>=0)return!1;let r=e.x,s=t.x,o=n.x,a=e.y,l=t.y,c=n.y,u=Math.min(r,s,o),f=Math.min(a,l,c),d=Math.max(r,s,o),A=Math.max(a,l,c),y=n.next;for(;y!==e;){if(y.x>=u&&y.x<=d&&y.y>=f&&y.y<=A&&I2(r,a,s,l,o,c,y.x,y.y)&&Yr(y.prev,y,y.next)>=0)return!1;y=y.next}return!0}function IAe(i,e,t,n){let r=i.prev,s=i,o=i.next;if(Yr(r,s,o)>=0)return!1;let a=r.x,l=s.x,c=o.x,u=r.y,f=s.y,d=o.y,A=Math.min(a,l,c),y=Math.min(u,f,d),w=Math.max(a,l,c),S=Math.max(u,f,d),T=B8(A,y,e,t,n),R=B8(w,S,e,t,n),P=i.prevZ,I=i.nextZ;for(;P&&P.z>=T&&I&&I.z<=R;){if(P.x>=A&&P.x<=w&&P.y>=y&&P.y<=S&&P!==r&&P!==o&&I2(a,u,l,f,c,d,P.x,P.y)&&Yr(P.prev,P,P.next)>=0||(P=P.prevZ,I.x>=A&&I.x<=w&&I.y>=y&&I.y<=S&&I!==r&&I!==o&&I2(a,u,l,f,c,d,I.x,I.y)&&Yr(I.prev,I,I.next)>=0))return!1;I=I.nextZ}for(;P&&P.z>=T;){if(P.x>=A&&P.x<=w&&P.y>=y&&P.y<=S&&P!==r&&P!==o&&I2(a,u,l,f,c,d,P.x,P.y)&&Yr(P.prev,P,P.next)>=0)return!1;P=P.prevZ}for(;I&&I.z<=R;){if(I.x>=A&&I.x<=w&&I.y>=y&&I.y<=S&&I!==r&&I!==o&&I2(a,u,l,f,c,d,I.x,I.y)&&Yr(I.prev,I,I.next)>=0)return!1;I=I.nextZ}return!0}function PAe(i,e){let t=i;do{let n=t.prev,r=t.next.next;!o_(n,r)&&PZ(n,t,t.next,r)&&X2(n,r)&&X2(r,n)&&(e.push(n.i,t.i,r.i),$2(t),$2(t.next),t=i=r),t=t.next}while(t!==i);return ZA(t)}function LAe(i,e,t,n,r,s){let o=i;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&VAe(o,a)){let l=LZ(o,a);o=ZA(o,o.next),l=ZA(l,l.next),j2(o,e,t,n,r,s,0),j2(l,e,t,n,r,s,0);return}a=a.next}o=o.next}while(o!==i)}function DAe(i,e,t,n){let r=[];for(let s=0,o=e.length;s<o;s++){let a=e[s]*n,l=s<o-1?e[s+1]*n:i.length,c=RZ(i,a,l,n,!1);c===c.next&&(c.steiner=!0),r.push(zAe(c))}r.sort(NAe);for(let s=0;s<r.length;s++)t=FAe(r[s],t);return t}function NAe(i,e){let t=i.x-e.x;if(t===0&&(t=i.y-e.y,t===0)){let n=(i.next.y-i.y)/(i.next.x-i.x),r=(e.next.y-e.y)/(e.next.x-e.x);t=n-r}return t}function FAe(i,e){let t=BAe(i,e);if(!t)return e;let n=LZ(t,i);return ZA(n,n.next),ZA(t,t.next)}function BAe(i,e){let t=e,n=i.x,r=i.y,s=-1/0,o;if(o_(i,t))return t;do{if(o_(i,t.next))return t.next;if(r<=t.y&&r>=t.next.y&&t.next.y!==t.y){let f=t.x+(r-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(f<=n&&f>s&&(s=f,o=t.x<t.next.x?t:t.next,f===n))return o}t=t.next}while(t!==e);if(!o)return null;let a=o,l=o.x,c=o.y,u=1/0;t=o;do{if(n>=t.x&&t.x>=l&&n!==t.x&&IZ(r<c?n:s,r,l,c,r<c?s:n,r,t.x,t.y)){let f=Math.abs(r-t.y)/(n-t.x);X2(t,i)&&(f<u||f===u&&(t.x>o.x||t.x===o.x&&OAe(o,t)))&&(o=t,u=f)}t=t.next}while(t!==a);return o}function OAe(i,e){return Yr(i.prev,i,e.prev)<0&&Yr(e.next,i,i.next)<0}function UAe(i,e,t,n){let r=i;do r.z===0&&(r.z=B8(r.x,r.y,e,t,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==i);r.prevZ.nextZ=null,r.prevZ=null,kAe(r)}function kAe(i){let e,t=1;do{let n=i,r;i=null;let s=null;for(e=0;n;){e++;let o=n,a=0;for(let c=0;c<t&&(a++,o=o.nextZ,!!o);c++);let l=t;for(;a>0||l>0&&o;)a!==0&&(l===0||!o||n.z<=o.z)?(r=n,n=n.nextZ,a--):(r=o,o=o.nextZ,l--),s?s.nextZ=r:i=r,r.prevZ=s,s=r;n=o}s.nextZ=null,t*=2}while(e>1);return i}function B8(i,e,t,n,r){return i=(i-t)*r|0,e=(e-n)*r|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,i|e<<1}function zAe(i){let e=i,t=i;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==i);return t}function IZ(i,e,t,n,r,s,o,a){return(r-o)*(e-a)>=(i-o)*(s-a)&&(i-o)*(n-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(r-o)*(n-a)}function I2(i,e,t,n,r,s,o,a){return!(i===o&&e===a)&&IZ(i,e,t,n,r,s,o,a)}function VAe(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!GAe(i,e)&&(X2(i,e)&&X2(e,i)&&qAe(i,e)&&(Yr(i.prev,i,e.prev)||Yr(i,e.prev,e))||o_(i,e)&&Yr(i.prev,i,i.next)>0&&Yr(e.prev,e,e.next)>0)}function Yr(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function o_(i,e){return i.x===e.x&&i.y===e.y}function PZ(i,e,t,n){let r=J3(Yr(i,e,t)),s=J3(Yr(i,e,n)),o=J3(Yr(t,n,i)),a=J3(Yr(t,n,e));return!!(r!==s&&o!==a||r===0&&Q3(i,t,e)||s===0&&Q3(i,n,e)||o===0&&Q3(t,i,n)||a===0&&Q3(t,e,n))}function Q3(i,e,t){return e.x<=Math.max(i.x,t.x)&&e.x>=Math.min(i.x,t.x)&&e.y<=Math.max(i.y,t.y)&&e.y>=Math.min(i.y,t.y)}function J3(i){return i>0?1:i<0?-1:0}function GAe(i,e){let t=i;do{if(t.i!==i.i&&t.next.i!==i.i&&t.i!==e.i&&t.next.i!==e.i&&PZ(t,t.next,i,e))return!0;t=t.next}while(t!==i);return!1}function X2(i,e){return Yr(i.prev,i,i.next)<0?Yr(i,e,i.next)>=0&&Yr(i,i.prev,e)>=0:Yr(i,e,i.prev)<0||Yr(i,i.next,e)<0}function qAe(i,e){let t=i,n=!1,r=(i.x+e.x)/2,s=(i.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&r<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==i);return n}function LZ(i,e){let t=O8(i.i,i.x,i.y),n=O8(e.i,e.x,e.y),r=i.next,s=e.prev;return i.next=e,e.prev=i,t.next=r,r.prev=t,n.next=t,t.prev=n,s.next=n,n.prev=s,n}function oZ(i,e,t,n){let r=O8(i,e,t);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function $2(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function O8(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function HAe(i,e,t,n){let r=0;for(let s=e,o=t-n;s<t;s+=n)r+=(i[o]-i[s])*(i[s+1]+i[o+1]),o=s;return r}var U8=class{static triangulate(e,t,n=2){return CAe(e,t,n)}},Jp=class i{static area(e){let t=e.length,n=0;for(let r=t-1,s=0;s<t;r=s++)n+=e[r].x*e[s].y-e[s].x*e[r].y;return n*.5}static isClockWise(e){return i.area(e)<0}static triangulateShape(e,t){let n=[],r=[],s=[];aZ(e),lZ(n,e);let o=e.length;t.forEach(aZ);for(let l=0;l<t.length;l++)r.push(o),o+=t[l].length,lZ(n,t[l]);let a=U8.triangulate(n,r);for(let l=0;l<a.length;l+=3)s.push(a.slice(l,l+3));return s}};function aZ(i){let e=i.length;e>2&&i[e-1].equals(i[0])&&i.pop()}function lZ(i,e){for(let t=0;t<e.length;t++)i.push(e[t].x),i.push(e[t].y)}var Y2=class i extends Xn{constructor(e=new W2([new Oe(.5,.5),new Oe(-.5,.5),new Oe(-.5,-.5),new Oe(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];let n=this,r=[],s=[];for(let a=0,l=e.length;a<l;a++){let c=e[a];o(c)}this.setAttribute("position",new Ln(r,3)),this.setAttribute("uv",new Ln(s,2)),this.computeVertexNormals();function o(a){let l=[],c=t.curveSegments!==void 0?t.curveSegments:12,u=t.steps!==void 0?t.steps:1,f=t.depth!==void 0?t.depth:1,d=t.bevelEnabled!==void 0?t.bevelEnabled:!0,A=t.bevelThickness!==void 0?t.bevelThickness:.2,y=t.bevelSize!==void 0?t.bevelSize:A-.1,w=t.bevelOffset!==void 0?t.bevelOffset:0,S=t.bevelSegments!==void 0?t.bevelSegments:3,T=t.extrudePath,R=t.UVGenerator!==void 0?t.UVGenerator:WAe,P,I=!1,F,D,L,C;if(T){P=T.getSpacedPoints(u),I=!0,d=!1;let $e=T.isCatmullRomCurve3?T.closed:!1;F=T.computeFrenetFrames(u,$e),D=new re,L=new re,C=new re}d||(S=0,A=0,y=0,w=0);let B=a.extractPoints(c),k=B.shape,z=B.holes;if(!Jp.isClockWise(k)){k=k.reverse();for(let $e=0,ot=z.length;$e<ot;$e++){let nt=z[$e];Jp.isClockWise(nt)&&(z[$e]=nt.reverse())}}function W($e){let nt=10000000000000001e-36,bt=$e[0];for(let yt=1;yt<=$e.length;yt++){let hn=yt%$e.length,en=$e[hn],tn=en.x-bt.x,bn=en.y-bt.y,_e=tn*tn+bn*bn,vi=Math.max(Math.abs(en.x),Math.abs(en.y),Math.abs(bt.x),Math.abs(bt.y)),zn=nt*vi*vi;if(_e<=zn){$e.splice(hn,1),yt--;continue}bt=en}}W(k),z.forEach(W);let Y=z.length,H=k;for(let $e=0;$e<Y;$e++){let ot=z[$e];k=k.concat(ot)}function $($e,ot,nt){return ot||ze("ExtrudeGeometry: vec does not exist"),$e.clone().addScaledVector(ot,nt)}let J=k.length;function te($e,ot,nt){let bt,yt,hn,en=$e.x-ot.x,tn=$e.y-ot.y,bn=nt.x-$e.x,_e=nt.y-$e.y,vi=en*en+tn*tn,zn=en*_e-tn*bn;if(Math.abs(zn)>Number.EPSILON){let le=Math.sqrt(vi),Z=Math.sqrt(bn*bn+_e*_e),Te=ot.x-tn/le,Pe=ot.y+en/le,Ge=nt.x-_e/Z,vt=nt.y+bn/Z,Tt=((Ge-Te)*_e-(vt-Pe)*bn)/(en*_e-tn*bn);bt=Te+en*Tt-$e.x,yt=Pe+tn*Tt-$e.y;let qe=bt*bt+yt*yt;if(qe<=2)return new Oe(bt,yt);hn=Math.sqrt(qe/2)}else{let le=!1;en>Number.EPSILON?bn>Number.EPSILON&&(le=!0):en<-Number.EPSILON?bn<-Number.EPSILON&&(le=!0):Math.sign(tn)===Math.sign(_e)&&(le=!0),le?(bt=-tn,yt=en,hn=Math.sqrt(vi)):(bt=en,yt=tn,hn=Math.sqrt(vi/2))}return new Oe(bt/hn,yt/hn)}let ce=[];for(let $e=0,ot=H.length,nt=ot-1,bt=$e+1;$e<ot;$e++,nt++,bt++)nt===ot&&(nt=0),bt===ot&&(bt=0),ce[$e]=te(H[$e],H[nt],H[bt]);let he=[],ve,Re=ce.concat();for(let $e=0,ot=Y;$e<ot;$e++){let nt=z[$e];ve=[];for(let bt=0,yt=nt.length,hn=yt-1,en=bt+1;bt<yt;bt++,hn++,en++)hn===yt&&(hn=0),en===yt&&(en=0),ve[bt]=te(nt[bt],nt[hn],nt[en]);he.push(ve),Re=Re.concat(ve)}let Qe;if(S===0)Qe=Jp.triangulateShape(H,z);else{let $e=[],ot=[];for(let nt=0;nt<S;nt++){let bt=nt/S,yt=A*Math.cos(bt*Math.PI/2),hn=y*Math.sin(bt*Math.PI/2)+w;for(let en=0,tn=H.length;en<tn;en++){let bn=$(H[en],ce[en],hn);Mt(bn.x,bn.y,-yt),bt===0&&$e.push(bn)}for(let en=0,tn=Y;en<tn;en++){let bn=z[en];ve=he[en];let _e=[];for(let vi=0,zn=bn.length;vi<zn;vi++){let le=$(bn[vi],ve[vi],hn);Mt(le.x,le.y,-yt),bt===0&&_e.push(le)}bt===0&&ot.push(_e)}}Qe=Jp.triangulateShape($e,ot)}let Fe=Qe.length,mt=y+w;for(let $e=0;$e<J;$e++){let ot=d?$(k[$e],Re[$e],mt):k[$e];I?(L.copy(F.normals[0]).multiplyScalar(ot.x),D.copy(F.binormals[0]).multiplyScalar(ot.y),C.copy(P[0]).add(L).add(D),Mt(C.x,C.y,C.z)):Mt(ot.x,ot.y,0)}for(let $e=1;$e<=u;$e++)for(let ot=0;ot<J;ot++){let nt=d?$(k[ot],Re[ot],mt):k[ot];I?(L.copy(F.normals[$e]).multiplyScalar(nt.x),D.copy(F.binormals[$e]).multiplyScalar(nt.y),C.copy(P[$e]).add(L).add(D),Mt(C.x,C.y,C.z)):Mt(nt.x,nt.y,f/u*$e)}for(let $e=S-1;$e>=0;$e--){let ot=$e/S,nt=A*Math.cos(ot*Math.PI/2),bt=y*Math.sin(ot*Math.PI/2)+w;for(let yt=0,hn=H.length;yt<hn;yt++){let en=$(H[yt],ce[yt],bt);Mt(en.x,en.y,f+nt)}for(let yt=0,hn=z.length;yt<hn;yt++){let en=z[yt];ve=he[yt];for(let tn=0,bn=en.length;tn<bn;tn++){let _e=$(en[tn],ve[tn],bt);I?Mt(_e.x,_e.y+P[u-1].y,P[u-1].x+nt):Mt(_e.x,_e.y,f+nt)}}}Ee(),Ve();function Ee(){let $e=r.length/3;if(d){let ot=0,nt=J*ot;for(let bt=0;bt<Fe;bt++){let yt=Qe[bt];Et(yt[2]+nt,yt[1]+nt,yt[0]+nt)}ot=u+S*2,nt=J*ot;for(let bt=0;bt<Fe;bt++){let yt=Qe[bt];Et(yt[0]+nt,yt[1]+nt,yt[2]+nt)}}else{for(let ot=0;ot<Fe;ot++){let nt=Qe[ot];Et(nt[2],nt[1],nt[0])}for(let ot=0;ot<Fe;ot++){let nt=Qe[ot];Et(nt[0]+J*u,nt[1]+J*u,nt[2]+J*u)}}n.addGroup($e,r.length/3-$e,0)}function Ve(){let $e=r.length/3,ot=0;Ye(H,ot),ot+=H.length;for(let nt=0,bt=z.length;nt<bt;nt++){let yt=z[nt];Ye(yt,ot),ot+=yt.length}n.addGroup($e,r.length/3-$e,1)}function Ye($e,ot){let nt=$e.length;for(;--nt>=0;){let bt=nt,yt=nt-1;yt<0&&(yt=$e.length-1);for(let hn=0,en=u+S*2;hn<en;hn++){let tn=J*hn,bn=J*(hn+1),_e=ot+bt+tn,vi=ot+yt+tn,zn=ot+yt+bn,le=ot+bt+bn;It(_e,vi,zn,le)}}}function Mt($e,ot,nt){l.push($e),l.push(ot),l.push(nt)}function Et($e,ot,nt){dn($e),dn(ot),dn(nt);let bt=r.length/3,yt=R.generateTopUV(n,r,bt-3,bt-2,bt-1);Gt(yt[0]),Gt(yt[1]),Gt(yt[2])}function It($e,ot,nt,bt){dn($e),dn(ot),dn(bt),dn(ot),dn(nt),dn(bt);let yt=r.length/3,hn=R.generateSideWallUV(n,r,yt-6,yt-3,yt-2,yt-1);Gt(hn[0]),Gt(hn[1]),Gt(hn[3]),Gt(hn[1]),Gt(hn[2]),Gt(hn[3])}function dn($e){r.push(l[$e*3+0]),r.push(l[$e*3+1]),r.push(l[$e*3+2])}function Gt($e){s.push($e.x),s.push($e.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON(),t=this.parameters.shapes,n=this.parameters.options;return jAe(t,n,e)}static fromJSON(e,t){let n=[];for(let s=0,o=e.shapes.length;s<o;s++){let a=t[e.shapes[s]];n.push(a)}let r=e.options.extrudePath;return r!==void 0&&(e.options.extrudePath=new pM[r.type]().fromJSON(r)),new i(n,e.options)}},WAe={generateTopUV:function(i,e,t,n,r){let s=e[t*3],o=e[t*3+1],a=e[n*3],l=e[n*3+1],c=e[r*3],u=e[r*3+1];return[new Oe(s,o),new Oe(a,l),new Oe(c,u)]},generateSideWallUV:function(i,e,t,n,r,s){let o=e[t*3],a=e[t*3+1],l=e[t*3+2],c=e[n*3],u=e[n*3+1],f=e[n*3+2],d=e[r*3],A=e[r*3+1],y=e[r*3+2],w=e[s*3],S=e[s*3+1],T=e[s*3+2];return Math.abs(a-u)<Math.abs(o-c)?[new Oe(o,1-l),new Oe(c,1-f),new Oe(d,1-y),new Oe(w,1-T)]:[new Oe(a,1-l),new Oe(u,1-f),new Oe(A,1-y),new Oe(S,1-T)]}};function jAe(i,e,t){if(t.shapes=[],Array.isArray(i))for(let n=0,r=i.length;n<r;n++){let s=i[n];t.shapes.push(s.uuid)}else t.shapes.push(i.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}var KA=class i extends Xn{constructor(e=1,t=1,n=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r};let s=e/2,o=t/2,a=Math.floor(n),l=Math.floor(r),c=a+1,u=l+1,f=e/a,d=t/l,A=[],y=[],w=[],S=[];for(let T=0;T<u;T++){let R=T*d-o;for(let P=0;P<c;P++){let I=P*f-s;y.push(I,-R,0),w.push(0,0,1),S.push(P/a),S.push(1-T/l)}}for(let T=0;T<l;T++)for(let R=0;R<a;R++){let P=R+c*T,I=R+c*(T+1),F=R+1+c*(T+1),D=R+1+c*T;A.push(P,I,D),A.push(I,F,D)}this.setIndex(A),this.setAttribute("position",new Ln(y,3)),this.setAttribute("normal",new Ln(w,3)),this.setAttribute("uv",new Ln(S,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i(e.width,e.height,e.widthSegments,e.heightSegments)}};var Va=class i extends Xn{constructor(e=1,t=32,n=16,r=0,s=Math.PI*2,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:s,thetaStart:o,thetaLength:a},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));let l=Math.min(o+a,Math.PI),c=0,u=[],f=new re,d=new re,A=[],y=[],w=[],S=[];for(let T=0;T<=n;T++){let R=[],P=T/n,I=o+P*a,F=e*Math.cos(I),D=Math.sqrt(e*e-F*F),L=0;T===0&&o===0?L=.5/t:T===n&&l===Math.PI&&(L=-.5/t);for(let C=0;C<=t;C++){let B=C/t,k=r+B*s;f.x=-D*Math.cos(k),f.y=F,f.z=D*Math.sin(k),y.push(f.x,f.y,f.z),d.copy(f).normalize(),w.push(d.x,d.y,d.z),S.push(B+L,1-P),R.push(c++)}u.push(R)}for(let T=0;T<n;T++)for(let R=0;R<t;R++){let P=u[T][R+1],I=u[T][R],F=u[T+1][R],D=u[T+1][R+1];(T!==0||o>0)&&A.push(P,I,D),(T!==n-1||l<Math.PI)&&A.push(I,F,D)}this.setIndex(A),this.setAttribute("position",new Ln(y,3)),this.setAttribute("normal",new Ln(w,3)),this.setAttribute("uv",new Ln(S,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}};var Z2=class i extends Xn{constructor(e=new q2(new re(-1,-1,0),new re(-1,1,0),new re(1,1,0)),t=64,n=1,r=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:r,closed:s};let o=e.computeFrenetFrames(t,s);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;let a=new re,l=new re,c=new Oe,u=new re,f=[],d=[],A=[],y=[];w(),this.setIndex(y),this.setAttribute("position",new Ln(f,3)),this.setAttribute("normal",new Ln(d,3)),this.setAttribute("uv",new Ln(A,2));function w(){for(let P=0;P<t;P++)S(P);S(s===!1?t:0),R(),T()}function S(P){u=e.getPointAt(P/t,u);let I=o.normals[P],F=o.binormals[P];for(let D=0;D<=r;D++){let L=D/r*Math.PI*2,C=Math.sin(L),B=-Math.cos(L);l.x=B*I.x+C*F.x,l.y=B*I.y+C*F.y,l.z=B*I.z+C*F.z,l.normalize(),d.push(l.x,l.y,l.z),a.x=u.x+n*l.x,a.y=u.y+n*l.y,a.z=u.z+n*l.z,f.push(a.x,a.y,a.z)}}function T(){for(let P=1;P<=t;P++)for(let I=1;I<=r;I++){let F=(r+1)*(P-1)+(I-1),D=(r+1)*P+(I-1),L=(r+1)*P+I,C=(r+1)*(P-1)+I;y.push(F,D,C),y.push(D,L,C)}}function R(){for(let P=0;P<=t;P++)for(let I=0;I<=r;I++)c.x=P/t,c.y=I/r,A.push(c.x,c.y)}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new i(new pM[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}},K2=class extends Xn{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){let t=[],n=new Set,r=new re,s=new re;if(e.index!==null){let o=e.attributes.position,a=e.index,l=e.groups;l.length===0&&(l=[{start:0,count:a.count,materialIndex:0}]);for(let c=0,u=l.length;c<u;++c){let f=l[c],d=f.start,A=f.count;for(let y=d,w=d+A;y<w;y+=3)for(let S=0;S<3;S++){let T=a.getX(y+S),R=a.getX(y+(S+1)%3);r.fromBufferAttribute(o,T),s.fromBufferAttribute(o,R),cZ(r,s,n)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}}else{let o=e.attributes.position;for(let a=0,l=o.count/3;a<l;a++)for(let c=0;c<3;c++){let u=3*a+c,f=3*a+(c+1)%3;r.fromBufferAttribute(o,u),s.fromBufferAttribute(o,f),cZ(r,s,n)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new Ln(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}};function cZ(i,e,t){let n=`${i.x},${i.y},${i.z}-${e.x},${e.y},${e.z}`,r=`${e.x},${e.y},${e.z}-${i.x},${i.y},${i.z}`;return t.has(n)===!0||t.has(r)===!0?!1:(t.add(n),t.add(r),!0)}var Q2=class extends Ws{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new zt(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}};function pg(i){let e={};for(let t in i){e[t]={};for(let n in i[t]){let r=i[t][n];if(uZ(r))r.isRenderTargetTexture?(Xe("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=r.clone();else if(Array.isArray(r))if(uZ(r[0])){let s=[];for(let o=0,a=r.length;o<a;o++)s[o]=r[o].clone();e[t][n]=s}else e[t][n]=r.slice();else e[t][n]=r}}return e}function ha(i){let e={};for(let t=0;t<i.length;t++){let n=pg(i[t]);for(let r in n)e[r]=n[r]}return e}function uZ(i){return i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)}function XAe(i){let e=[];for(let t=0;t<i.length;t++)e.push(i[t].clone());return e}function pF(i){let e=i.getRenderTarget();return e===null?i.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:ln.workingColorSpace}var mg={clone:pg,merge:ha},$Ae=`void main() {1111 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );12-}`,RAe=`void main() {12+}`,YAe=`void main() {1313 gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );14-}`,ds=class extends Ws{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=CAe,this.fragmentShader=RAe,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=pg(e.uniforms),this.uniformsGroups=MAe(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){let t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(let r in this.uniforms){let o=this.uniforms[r].value;o&&o.isTexture?t.uniforms[r]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[r]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[r]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[r]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[r]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[r]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[r]={type:"m4",value:o.toArray()}:t.uniforms[r]={value:o}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let n={};for(let r in this.extensions)this.extensions[r]===!0&&(n[r]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}fromJSON(e,t){if(super.fromJSON(e,t),e.uniforms!==void 0)for(let n in e.uniforms){let r=e.uniforms[n];switch(this.uniforms[n]={},r.type){case"t":this.uniforms[n].value=t[r.value]||null;break;case"c":this.uniforms[n].value=new zt().setHex(r.value);break;case"v2":this.uniforms[n].value=new Oe().fromArray(r.value);break;case"v3":this.uniforms[n].value=new re().fromArray(r.value);break;case"v4":this.uniforms[n].value=new xn().fromArray(r.value);break;case"m3":this.uniforms[n].value=new Mn().fromArray(r.value);break;case"m4":this.uniforms[n].value=new cn().fromArray(r.value);break;default:this.uniforms[n].value=r.value}}if(e.defines!==void 0&&(this.defines=e.defines),e.vertexShader!==void 0&&(this.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(this.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(this.glslVersion=e.glslVersion),e.extensions!==void 0)for(let n in e.extensions)this.extensions[n]=e.extensions[n];return e.lights!==void 0&&(this.lights=e.lights),e.clipping!==void 0&&(this.clipping=e.clipping),this}},fM=class extends ds{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}},s_=class extends Ws{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new zt(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new zt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ec,this.normalScale=new Oe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Oa,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},Y2=class extends s_{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Oe(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Nn(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new zt(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new zt(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new zt(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}},QA=class extends Ws{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new zt(16777215),this.specular=new zt(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new zt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ec,this.normalScale=new Oe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Oa,this.combine=ig,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},Z2=class extends Ws{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new zt(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new zt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ec,this.normalScale=new Oe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}},K2=class extends Ws{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ec,this.normalScale=new Oe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}},Va=class extends Ws{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new zt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new zt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ec,this.normalScale=new Oe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Oa,this.combine=ig,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},dM=class extends Ws{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=mZ,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}},pM=class extends Ws{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}},Q2=class extends Ws{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new zt(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ec,this.normalScale=new Oe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this.fog=e.fog,this}},J2=class extends Pu{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}};function Z3(i,e){return!i||i.constructor===e?i:typeof e.BYTES_PER_ELEMENT=="number"?new e(i):Array.prototype.slice.call(i)}var c0=class{constructor(e,t,n,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r!==void 0?r:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,n=this._cachedIndex,r=t[n],s=t[n-1];e:{t:{let o;n:{i:if(!(e<r)){for(let a=n+2;;){if(r===void 0){if(e<s)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===a)break;if(s=r,r=t[++n],e<r)break t}o=t.length;break n}if(!(e>=s)){let a=t[1];e<a&&(n=2,s=a);for(let l=n-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===l)break;if(r=s,s=t[--n-1],e>=s)break t}o=n,n=0;break n}break e}for(;n<o;){let a=n+o>>>1;e<t[a]?o=a:n=a+1}if(r=t[n],s=t[n-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,s,r)}return this.interpolate_(n,s,e,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,s=e*r;for(let o=0;o!==r;++o)t[o]=n[s+o];return t}interpolate_(){throw new Error("THREE.Interpolant: Call to abstract method.")}intervalChanged_(){}},mM=class extends c0{constructor(e,t,n,r){super(e,t,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:S8,endingEnd:S8}}intervalChanged_(e,t,n){let r=this.parameterPositions,s=e-2,o=e+1,a=r[s],l=r[o];if(a===void 0)switch(this.getSettings_().endingStart){case T8:s=e,a=2*t-n;break;case E8:s=r.length-2,a=t+r[s]-r[s+1];break;default:s=e,a=n}if(l===void 0)switch(this.getSettings_().endingEnd){case T8:o=e,l=2*n-t;break;case E8:o=1,l=n+r[1]-r[0];break;default:o=e-1,l=t}let c=(n-t)*.5,u=this.valueSize;this._weightPrev=c/(t-a),this._weightNext=c/(l-n),this._offsetPrev=s*u,this._offsetNext=o*u}interpolate_(e,t,n,r){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=this._offsetPrev,f=this._offsetNext,d=this._weightPrev,A=this._weightNext,y=(n-t)/(r-t),w=y*y,S=w*y,T=-d*S+2*d*w-d*y,R=(1+d)*S+(-1.5-2*d)*w+(-.5+d)*y+1,P=(-1-A)*S+(1.5+A)*w+.5*y,I=A*S-A*w;for(let F=0;F!==a;++F)s[F]=T*o[u+F]+R*o[c+F]+P*o[l+F]+I*o[f+F];return s}},AM=class extends c0{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=(n-t)/(r-t),f=1-u;for(let d=0;d!==a;++d)s[d]=o[c+d]*f+o[l+d]*u;return s}},gM=class extends c0{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e){return this.copySampleValue_(e-1)}},vM=class extends c0{interpolate_(e,t,n,r){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=this.inTangents,f=this.outTangents;if(!u||!f){let y=(n-t)/(r-t),w=1-y;for(let S=0;S!==a;++S)s[S]=o[c+S]*w+o[l+S]*y;return s}let d=a*2,A=e-1;for(let y=0;y!==a;++y){let w=o[c+y],S=o[l+y],T=A*d+y*2,R=f[T],P=f[T+1],I=e*d+y*2,F=u[I],D=u[I+1],L=(n-t)/(r-t),C,B,k,z,G;for(let W=0;W<8;W++){C=L*L,B=C*L,k=1-L,z=k*k,G=z*k;let H=G*t+3*z*L*R+3*k*C*F+B*r-n;if(Math.abs(H)<1e-10)break;let $=3*z*(R-t)+6*k*L*(F-R)+3*C*(r-F);if(Math.abs($)<1e-10)break;L=L-H/$,L=Math.max(0,Math.min(1,L))}s[y]=G*w+3*z*L*P+3*k*C*D+B*S}return s}},Ql=class{constructor(e,t,n,r){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=Z3(t,this.TimeBufferType),this.values=Z3(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(e){let t=e.constructor,n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:Z3(e.times,Array),values:Z3(e.values,Array)};let r=e.getInterpolation();r!==e.DefaultInterpolation&&(n.interpolation=r)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new gM(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new AM(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new mM(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){let t=new vM(this.times,this.values,this.getValueSize(),e);return this.settings&&(t.inTangents=this.settings.inTangents,t.outTangents=this.settings.outTangents),t}setInterpolation(e){let t;switch(e){case P2:t=this.InterpolantFactoryMethodDiscrete;break;case nM:t=this.InterpolantFactoryMethodLinear;break;case eM:t=this.InterpolantFactoryMethodSmooth;break;case w8:t=this.InterpolantFactoryMethodBezier;break}if(t===void 0){let n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return Xe("KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return P2;case this.InterpolantFactoryMethodLinear:return nM;case this.InterpolantFactoryMethodSmooth:return eM;case this.InterpolantFactoryMethodBezier:return w8}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]+=e}return this}scale(e){if(e!==1){let t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]*=e}return this}trim(e,t){let n=this.times,r=n.length,s=0,o=r-1;for(;s!==r&&n[s]<e;)++s;for(;o!==-1&&n[o]>t;)--o;if(++o,s!==0||o!==r){s>=o&&(o=Math.max(o,1),s=o-1);let a=this.getValueSize();this.times=n.slice(s,o),this.values=this.values.slice(s*a,o*a)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(ze("KeyframeTrack: Invalid value size in track.",this),e=!1);let n=this.times,r=this.values,s=n.length;s===0&&(ze("KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){let l=n[a];if(typeof l=="number"&&isNaN(l)){ze("KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){ze("KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(r!==void 0&&f_(r))for(let a=0,l=r.length;a!==l;++a){let c=r[a];if(isNaN(c)){ze("KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),r=this.getInterpolation()===eM,s=e.length-1,o=1;for(let a=1;a<s;++a){let l=!1,c=e[a],u=e[a+1];if(c!==u&&(a!==1||c!==e[0]))if(r)l=!0;else{let f=a*n,d=f-n,A=f+n;for(let y=0;y!==n;++y){let w=t[f+y];if(w!==t[d+y]||w!==t[A+y]){l=!0;break}}}if(l){if(a!==o){e[o]=e[a];let f=a*n,d=o*n;for(let A=0;A!==n;++A)t[d+A]=t[f+A]}++o}}if(s>0){e[o]=e[s];for(let a=s*n,l=o*n,c=0;c!==n;++c)t[l+c]=t[a+c];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*n)):(this.times=e,this.values=t),this}clone(){let e=this.times.slice(),t=this.values.slice(),n=this.constructor,r=new n(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}};Ql.prototype.ValueTypeName="";Ql.prototype.TimeBufferType=Float32Array;Ql.prototype.ValueBufferType=Float32Array;Ql.prototype.DefaultInterpolation=nM;var u0=class extends Ql{constructor(e,t,n){super(e,t,n)}};u0.prototype.ValueTypeName="bool";u0.prototype.ValueBufferType=Array;u0.prototype.DefaultInterpolation=P2;u0.prototype.InterpolantFactoryMethodLinear=void 0;u0.prototype.InterpolantFactoryMethodSmooth=void 0;var _M=class extends Ql{constructor(e,t,n,r){super(e,t,n,r)}};_M.prototype.ValueTypeName="color";var xM=class extends Ql{constructor(e,t,n,r){super(e,t,n,r)}};xM.prototype.ValueTypeName="number";var yM=class extends c0{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(n-t)/(r-t),c=e*a;for(let u=c+a;c!==u;c+=4)qs.slerpFlat(s,0,o,c-a,o,c,l);return s}},eb=class extends Ql{constructor(e,t,n,r){super(e,t,n,r)}InterpolantFactoryMethodLinear(e){return new yM(this.times,this.values,this.getValueSize(),e)}};eb.prototype.ValueTypeName="quaternion";eb.prototype.InterpolantFactoryMethodSmooth=void 0;var h0=class extends Ql{constructor(e,t,n){super(e,t,n)}};h0.prototype.ValueTypeName="string";h0.prototype.ValueBufferType=Array;h0.prototype.DefaultInterpolation=P2;h0.prototype.InterpolantFactoryMethodLinear=void 0;h0.prototype.InterpolantFactoryMethodSmooth=void 0;var bM=class extends Ql{constructor(e,t,n,r){super(e,t,n,r)}};bM.prototype.ValueTypeName="vector";var tM={enabled:!1,files:{},add:function(i,e){this.enabled!==!1&&(nZ(i)||(this.files[i]=e))},get:function(i){if(this.enabled!==!1&&!nZ(i))return this.files[i]},remove:function(i){delete this.files[i]},clear:function(){this.files={}}};function nZ(i){try{let e=i.slice(i.indexOf(":")+1);return new URL(e).protocol==="blob:"}catch{return!1}}var wM=class{constructor(e,t,n){let r=this,s=!1,o=0,a=0,l,c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this._abortController=null,this.itemStart=function(u){a++,s===!1&&r.onStart!==void 0&&r.onStart(u,o,a),s=!0},this.itemEnd=function(u){o++,r.onProgress!==void 0&&r.onProgress(u,o,a),o===a&&(s=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(u){r.onError!==void 0&&r.onError(u)},this.resolveURL=function(u){return u=u.normalize("NFC"),l?l(u):u},this.setURLModifier=function(u){return l=u,this},this.addHandler=function(u,f){return c.push(u,f),this},this.removeHandler=function(u){let f=c.indexOf(u);return f!==-1&&c.splice(f,2),this},this.getHandler=function(u){for(let f=0,d=c.length;f<d;f+=2){let A=c[f],y=c[f+1];if(A.global&&(A.lastIndex=0),A.test(u))return y}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}},SZ=new wM,f0=class{constructor(e){this.manager=e!==void 0?e:SZ,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}load(){}loadAsync(e,t){let n=this;return new Promise(function(r,s){n.load(e,r,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}};f0.DEFAULT_MATERIAL_NAME="__DEFAULT";var Gv=new WeakMap,SM=class extends f0{constructor(e){super(e)}load(e,t,n,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let s=this,o=tM.get(`image:${e}`);if(o!==void 0){if(o.complete===!0)s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0);else{let f=Gv.get(o);f===void 0&&(f=[],Gv.set(o,f)),f.push({onLoad:t,onError:r})}return o}let a=$v("img");function l(){u(),t&&t(this);let f=Gv.get(this)||[];for(let d=0;d<f.length;d++){let A=f[d];A.onLoad&&A.onLoad(this)}Gv.delete(this),s.manager.itemEnd(e)}function c(f){u(),r&&r(f),tM.remove(`image:${e}`);let d=Gv.get(this)||[];for(let A=0;A<d.length;A++){let y=d[A];y.onError&&y.onError(f)}Gv.delete(this),s.manager.itemError(e),s.manager.itemEnd(e)}function u(){a.removeEventListener("load",l,!1),a.removeEventListener("error",c,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),tM.add(`image:${e}`,a),s.manager.itemStart(e),a.src=e,a}};var bl=class extends f0{constructor(e){super(e)}load(e,t,n,r){let s=new Hs,o=new SM(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){s.image=a,s.needsUpdate=!0,t!==void 0&&t(s)},n,r),s}},Dh=class extends lr{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new zt(e),this.intensity=t}dispose(){this.dispatchEvent({type:"dispose"})}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}},tb=class extends Dh{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(lr.DEFAULT_UP),this.updateMatrix(),this.groundColor=new zt(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}toJSON(e){let t=super.toJSON(e);return t.object.groundColor=this.groundColor.getHex(),t}},y8=new cn,iZ=new re,rZ=new re,nb=class{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Oe(512,512),this.mapType=Ji,this.map=null,this.mapPass=null,this.matrix=new cn,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Gc,this._frameExtents=new Oe(1,1),this._viewportCount=1,this._viewports=[new xn(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,n=this.matrix;iZ.setFromMatrixPosition(e.matrixWorld),t.position.copy(iZ),rZ.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(rZ),t.updateMatrixWorld(),y8.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(y8,t.coordinateSystem,t.reversedDepth),t.coordinateSystem===xl||t.reversedDepth?n.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(y8)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this.biasNode=e.biasNode,this}clone(){return new this.constructor().copy(this)}toJSON(){let e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}},K3=new re,Q3=new qs,Ch=new re,Dd=class extends lr{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new cn,this.projectionMatrix=new cn,this.projectionMatrixInverse=new cn,this.coordinateSystem=Uo,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorld.decompose(K3,Q3,Ch),Ch.x===1&&Ch.y===1&&Ch.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(K3,Q3,Ch.set(1,1,1)).invert()}updateWorldMatrix(e,t,n=!1){super.updateWorldMatrix(e,t,n),this.matrixWorld.decompose(K3,Q3,Ch),Ch.x===1&&Ch.y===1&&Ch.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(K3,Q3,Ch.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}},Qp=new re,sZ=new Oe,oZ=new Oe,$r=class extends Dd{constructor(e=50,t=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=Id*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(M2*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Id*2*Math.atan(Math.tan(M2*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){Qp.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Qp.x,Qp.y).multiplyScalar(-e/Qp.z),Qp.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Qp.x,Qp.y).multiplyScalar(-e/Qp.z)}getViewSize(e,t){return this.getViewBounds(e,sZ,oZ),t.subVectors(oZ,sZ)}setViewOffset(e,t,n,r,s,o){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(M2*.5*this.fov)/this.zoom,n=2*t,r=this.aspect*n,s=-.5*r,o=this.view;if(this.view!==null&&this.view.enabled){let l=o.fullWidth,c=o.fullHeight;s+=o.offsetX*r/l,t-=o.offsetY*n/c,r*=o.width/l,n*=o.height/c}let a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-n,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}},P8=class extends nb{constructor(){super(new $r(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){let t=this.camera,n=Id*2*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height*this.aspect,s=e.distance||t.far;(n!==t.fov||r!==t.aspect||s!==t.far)&&(t.fov=n,t.aspect=r,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}},JA=class extends Dh{constructor(e,t,n=0,r=Math.PI/3,s=0,o=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(lr.DEFAULT_UP),this.updateMatrix(),this.target=new lr,this.distance=n,this.angle=r,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new P8}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.map=e.map,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.distance=this.distance,t.object.angle=this.angle,t.object.decay=this.decay,t.object.penumbra=this.penumbra,t.object.target=this.target.uuid,this.map&&this.map.isTexture&&(t.object.map=this.map.toJSON(e).uuid),t.object.shadow=this.shadow.toJSON(),t}},L8=class extends nb{constructor(){super(new $r(90,1,.5,500)),this.isPointLightShadow=!0}},ib=class extends Dh{constructor(e,t,n=0,r=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=r,this.shadow=new L8}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.distance=this.distance,t.object.decay=this.decay,t.object.shadow=this.shadow.toJSON(),t}},Du=class extends Dd{constructor(e=-1,t=1,n=1,r=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=r,this.near=s,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,r,s,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2,s=n-e,o=n+e,a=r+t,l=r-t;if(this.view!==null&&this.view.enabled){let c=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,o=s+c*this.view.width,a-=u*this.view.offsetY,l=a-u*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,l,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}},D8=class extends nb{constructor(){super(new Du(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}},eg=class extends Dh{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(lr.DEFAULT_UP),this.updateMatrix(),this.target=new lr,this.shadow=new D8}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}},tg=class extends Dh{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}},rb=class extends Dh{constructor(e,t,n=10,r=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=r}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){let t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}},TM=class{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new re)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){let n=e.x,r=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.282095),t.addScaledVector(o[1],.488603*r),t.addScaledVector(o[2],.488603*s),t.addScaledVector(o[3],.488603*n),t.addScaledVector(o[4],1.092548*(n*r)),t.addScaledVector(o[5],1.092548*(r*s)),t.addScaledVector(o[6],.315392*(3*s*s-1)),t.addScaledVector(o[7],1.092548*(n*s)),t.addScaledVector(o[8],.546274*(n*n-r*r)),t}getIrradianceAt(e,t){let n=e.x,r=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.886227),t.addScaledVector(o[1],2*.511664*r),t.addScaledVector(o[2],2*.511664*s),t.addScaledVector(o[3],2*.511664*n),t.addScaledVector(o[4],2*.429043*n*r),t.addScaledVector(o[5],2*.429043*r*s),t.addScaledVector(o[6],.743125*s*s-.247708),t.addScaledVector(o[7],2*.429043*n*s),t.addScaledVector(o[8],.429043*(n*n-r*r)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){let n=this.coefficients;for(let r=0;r<9;r++)n[r].fromArray(e,t+r*3);return this}toArray(e=[],t=0){let n=this.coefficients;for(let r=0;r<9;r++)n[r].toArray(e,t+r*3);return e}static getBasisAt(e,t){let n=e.x,r=e.y,s=e.z;t[0]=.282095,t[1]=.488603*r,t[2]=.488603*s,t[3]=.488603*n,t[4]=1.092548*n*r,t[5]=1.092548*r*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*n*s,t[8]=.546274*(n*n-r*r)}},sb=class extends Dh{constructor(e=new TM,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}toJSON(e){let t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}};var ob=class extends Xn{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){let e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}};var qv=-90,Hv=1,o_=class extends lr{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;let r=new $r(qv,Hv,e,t);r.layers=this.layers,this.add(r);let s=new $r(qv,Hv,e,t);s.layers=this.layers,this.add(s);let o=new $r(qv,Hv,e,t);o.layers=this.layers,this.add(o);let a=new $r(qv,Hv,e,t);a.layers=this.layers,this.add(a);let l=new $r(qv,Hv,e,t);l.layers=this.layers,this.add(l);let c=new $r(qv,Hv,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[n,r,s,o,a,l]=t;for(let c of t)this.remove(c);if(e===Uo)n.up.set(0,1,0),n.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===xl)n.up.set(0,-1,0),n.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(let c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();let{renderTarget:n,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());let[s,o,a,l,c,u]=this.children,f=e.getRenderTarget(),d=e.getActiveCubeFace(),A=e.getActiveMipmapLevel(),y=e.xr.enabled;e.xr.enabled=!1;let w=n.texture.generateMipmaps;n.texture.generateMipmaps=!1;let S=!1;e.isWebGLRenderer===!0?S=e.state.buffers.depth.getReversed():S=e.reversedDepthBuffer,e.setRenderTarget(n,0,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,s),e.setRenderTarget(n,1,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(n,2,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,a),e.setRenderTarget(n,3,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),e.setRenderTarget(n,4,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),n.texture.generateMipmaps=w,e.setRenderTarget(n,5,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,u),e.setRenderTarget(f,d,A),e.xr.enabled=y,n.texture.needsPMREMUpdate=!0}},a_=class extends $r{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}},ng=class{constructor(){this._previousTime=0,this._currentTime=0,this._startTime=performance.now(),this._delta=0,this._elapsed=0,this._timescale=1,this._document=null,this._pageVisibilityHandler=null}connect(e){this._document=e,e.hidden!==void 0&&(this._pageVisibilityHandler=IAe.bind(this),e.addEventListener("visibilitychange",this._pageVisibilityHandler,!1))}disconnect(){this._pageVisibilityHandler!==null&&(this._document.removeEventListener("visibilitychange",this._pageVisibilityHandler),this._pageVisibilityHandler=null),this._document=null}getDelta(){return this._delta/1e3}getElapsed(){return this._elapsed/1e3}getTimescale(){return this._timescale}setTimescale(e){return this._timescale=e,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(e){return this._pageVisibilityHandler!==null&&this._document.hidden===!0?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(e!==void 0?e:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}};function IAe(){this._document.hidden===!1&&this.reset()}var aF="\\[\\]\\.:\\/",PAe=new RegExp("["+aF+"]","g"),lF="[^"+aF+"]",LAe="[^"+aF.replace("\\.","")+"]",DAe=/((?:WC+[\/:])*)/.source.replace("WC",lF),NAe=/(WCOD+)?/.source.replace("WCOD",LAe),FAe=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",lF),BAe=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",lF),OAe=new RegExp("^"+DAe+NAe+FAe+BAe+"$"),UAe=["material","materials","bones","map"],N8=class{constructor(e,t,n){let r=n||Tr.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();let n=this._targetGroup.nCachedObjects_,r=this._bindings[n];r!==void 0&&r.getValue(e,t)}setValue(e,t){let n=this._bindings;for(let r=this._targetGroup.nCachedObjects_,s=n.length;r!==s;++r)n[r].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}},Tr=class i{constructor(e,t,n){this.path=t,this.parsedPath=n||i.parseTrackName(t),this.node=i.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new i.Composite(e,t,n):new i(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(PAe,"")}static parseTrackName(e){let t=OAe.exec(e);if(t===null)throw new Error("THREE.PropertyBinding: Cannot parse trackName: "+e);let n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){let s=n.nodeName.substring(r+1);UAe.indexOf(s)!==-1&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=s)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("THREE.PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){let n=function(s){for(let o=0;o<s.length;o++){let a=s[o];if(a.name===t||a.uuid===t)return a;let l=n(a.children);if(l)return l}return null},r=n(e.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)e[t++]=n[r]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[r]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[r]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node,t=this.parsedPath,n=t.objectName,r=t.propertyName,s=t.propertyIndex;if(e||(e=i.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){Xe("PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let c=t.objectIndex;switch(n){case"materials":if(!e.material){ze("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){ze("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){ze("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let u=0;u<e.length;u++)if(e[u].name===c){c=u;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){ze("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){ze("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[n]===void 0){ze("PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(c!==void 0){if(e[c]===void 0){ze("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[c]}}let o=e[r];if(o===void 0){let c=t.nodeName;ze("PropertyBinding: Trying to update property for track: "+c+"."+r+" but it wasn't found.",e);return}let a=this.Versioning.None;this.targetObject=e,e.isMaterial===!0?a=this.Versioning.NeedsUpdate:e.isObject3D===!0&&(a=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(s!==void 0){if(r==="morphTargetInfluences"){if(!e.geometry){ze("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){ze("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}l=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=s}else o.fromArray!==void 0&&o.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(l=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=r;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};Tr.Composite=N8;Tr.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Tr.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Tr.prototype.GetterByBindingType=[Tr.prototype._getValue_direct,Tr.prototype._getValue_array,Tr.prototype._getValue_arrayElement,Tr.prototype._getValue_toArray];Tr.prototype.SetterByBindingTypeAndVersioning=[[Tr.prototype._setValue_direct,Tr.prototype._setValue_direct_setNeedsUpdate,Tr.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Tr.prototype._setValue_array,Tr.prototype._setValue_array_setNeedsUpdate,Tr.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Tr.prototype._setValue_arrayElement,Tr.prototype._setValue_arrayElement_setNeedsUpdate,Tr.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Tr.prototype._setValue_fromArray,Tr.prototype._setValue_fromArray_setNeedsUpdate,Tr.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var hZe=new Float32Array(1);var Nh=class extends Pd{constructor(e,t,n=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){let t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){let t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}};var aZ=new cn,ab=class{constructor(e,t,n=0,r=1/0){this.ray=new Ld(e,t),this.near=n,this.far=r,this.camera=null,this.layers=new Kv,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,t.projectionMatrix.elements[14]).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):ze("Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return aZ.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(aZ),this}intersectObject(e,t=!0,n=[]){return F8(e,this,n,t),n.sort(lZ),n}intersectObjects(e,t=!0,n=[]){for(let r=0,s=e.length;r<s;r++)F8(e[r],this,n,t);return n.sort(lZ),n}};function lZ(i,e){return i.distance-e.distance}function F8(i,e,t,n){let r=!0;if(i.layers.test(e.layers)&&i.raycast(e,t)===!1&&(r=!1),r===!0&&n===!0){let s=i.children;for(let o=0,a=s.length;o<a;o++)F8(s[o],e,t,!0)}}var l_=class{constructor(e=1,t=0,n=0){this.radius=e,this.phi=t,this.theta=n}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Nn(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(Nn(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}};var dF=class dF{constructor(e,t,n,r){this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,n,r)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,r){let s=this.elements;return s[0]=e,s[2]=t,s[1]=n,s[3]=r,this}};dF.prototype.isMatrix2=!0;var c_=dF,cZ=new Oe,EM=class{constructor(e=new Oe(1/0,1/0),t=new Oe(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=cZ.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,cZ).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}},uZ=new re,J3=new re,Wv=new re,jv=new re,b8=new re,kAe=new re,zAe=new re,lb=class{constructor(e=new re,t=new re){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){uZ.subVectors(e,this.start),J3.subVectors(this.end,this.start);let n=J3.dot(J3);if(n===0)return 0;let s=J3.dot(uZ)/n;return t&&(s=Nn(s,0,1)),s}closestPointToPoint(e,t,n){let r=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(r).add(this.start)}distanceSqToLine3(e,t=kAe,n=zAe){let r=10000000000000001e-32,s,o,a=this.start,l=e.start,c=this.end,u=e.end;Wv.subVectors(c,a),jv.subVectors(u,l),b8.subVectors(a,l);let f=Wv.dot(Wv),d=jv.dot(jv),A=jv.dot(b8);if(f<=r&&d<=r)return t.copy(a),n.copy(l),t.sub(n),t.dot(t);if(f<=r)s=0,o=A/d,o=Nn(o,0,1);else{let y=Wv.dot(b8);if(d<=r)o=0,s=Nn(-y/f,0,1);else{let w=Wv.dot(jv),S=f*d-w*w;S!==0?s=Nn((w*A-y*d)/S,0,1):s=0,o=(w*s+A)/d,o<0?(o=0,s=Nn(-y/f,0,1)):o>1&&(o=1,s=Nn((w-y)/f,0,1))}}return t.copy(a).addScaledVector(Wv,s),n.copy(l).addScaledVector(jv,o),t.distanceToSquared(n)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}};var cb=class{constructor(){this.type="ShapePath",this.color=new zt,this.subPaths=[],this.currentPath=null,this.userData={}}moveTo(e,t){return this.currentPath=new YA,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,r){return this.currentPath.quadraticCurveTo(e,t,n,r),this}bezierCurveTo(e,t,n,r,s,o){return this.currentPath.bezierCurveTo(e,t,n,r,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(){function e(l,c){let u=!1,f=c.length;for(let d=0,A=f-1;d<f;A=d++){let y=c[d],w=c[A];y.y>l.y!=w.y>l.y&&l.x<(w.x-y.x)*(l.y-y.y)/(w.y-y.y)+y.x&&(u=!u)}return u}function t(l,c){let u=c.getCenter(new Oe);if(e(u,l))return u;let f=u.y,d=[],A=l.length;for(let y=0;y<A;y++){let w=l[y],S=l[(y+1)%A];if(w.y>f!=S.y>f){let T=w.x+(f-w.y)*(S.x-w.x)/(S.y-w.y);d.push(T)}}return d.length>1&&(d.sort((y,w)=>y-w),u.x=(d[0]+d[1])/2),u}let n=this.userData.style&&this.userData.style.fillRule||"nonzero";n!=="nonzero"&&n!=="evenodd"&&(Xe('Fill-rule "'+n+'" is not supported, falling back to "nonzero".'),n="nonzero");let r=n==="nonzero"?(l=>l!==0):(l=>(l&1)!==0),s=[];for(let l of this.subPaths){let c=l.getPoints();if(c.length<3)continue;let u=Jp.area(c);if(u===0)continue;let f=new EM;for(let d=0;d<c.length;d++)f.expandByPoint(c[d]);s.push({subPath:l,points:c,boundingBox:f,interiorPoint:t(c,f),absArea:Math.abs(u),winding:u<0?-1:1,container:null,exclude:!1,role:null})}s.sort((l,c)=>c.absArea-l.absArea);for(let l=0;l<s.length;l++){let c=s[l],u=0;for(let f=l-1;f>=0;f--){let d=s[f];if(d.boundingBox.containsBox(c.boundingBox)&&e(c.interiorPoint,d.points)){c.container=d.exclude?d.container:d,u=d.winding,c.winding+=u;break}}r(c.winding)===r(u)&&(c.exclude=!0)}for(let l of s)l.exclude||(l.role=l.container===null||l.container.role==="hole"?"outer":"hole");let o=[],a=new Map;for(let l of s){if(l.exclude||l.role!=="outer")continue;let c=new V2;c.curves=l.subPath.curves,o.push(c),a.set(l,c)}for(let l of s){if(l.exclude||l.role!=="hole")continue;let c=a.get(l.container);if(!c)continue;let u=new YA;u.curves=l.subPath.curves,c.holes.push(u)}return o}},Nd=class extends la{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){Xe("Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}};function Ob(i,e,t,n){let r=VAe(n);switch(t){case u_:return i*e;case Od:return i*e/r.components*r.byteLength;case Vh:return i*e/r.components*r.byteLength;case js:return i*e*2/r.components*r.byteLength;case Gh:return i*e*2/r.components*r.byteLength;case Bd:return i*e*3/r.components*r.byteLength;case Or:return i*e*4/r.components*r.byteLength;case v0:return i*e*4/r.components*r.byteLength;case qh:case Hh:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case Wh:case jh:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case cg:case hg:return Math.max(i,16)*Math.max(e,8)/4;case lg:case ug:return Math.max(i,8)*Math.max(e,8)/2;case _0:case x0:case b0:case w0:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case y0:case Xh:case S0:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case T0:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case E0:return Math.floor((i+4)/5)*Math.floor((e+3)/4)*16;case M0:return Math.floor((i+4)/5)*Math.floor((e+4)/5)*16;case C0:return Math.floor((i+5)/6)*Math.floor((e+4)/5)*16;case R0:return Math.floor((i+5)/6)*Math.floor((e+5)/6)*16;case I0:return Math.floor((i+7)/8)*Math.floor((e+4)/5)*16;case P0:return Math.floor((i+7)/8)*Math.floor((e+5)/6)*16;case L0:return Math.floor((i+7)/8)*Math.floor((e+7)/8)*16;case D0:return Math.floor((i+9)/10)*Math.floor((e+4)/5)*16;case N0:return Math.floor((i+9)/10)*Math.floor((e+5)/6)*16;case F0:return Math.floor((i+9)/10)*Math.floor((e+7)/8)*16;case B0:return Math.floor((i+9)/10)*Math.floor((e+9)/10)*16;case O0:return Math.floor((i+11)/12)*Math.floor((e+9)/10)*16;case U0:return Math.floor((i+11)/12)*Math.floor((e+11)/12)*16;case k0:case z0:case V0:return Math.ceil(i/4)*Math.ceil(e/4)*16;case G0:case q0:return Math.ceil(i/4)*Math.ceil(e/4)*8;case $h:case H0:return Math.ceil(i/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function VAe(i){switch(i){case Ji:case kh:return{byteLength:1,components:1};case wl:case zh:case Wi:return{byteLength:2,components:1};case rg:case sg:return{byteLength:2,components:4};case xi:case Zr:case cr:return{byteLength:4,components:1};case og:case ag:return{byteLength:4,components:3}}throw new Error(`THREE.TextureUtils: Unknown texture type ${i}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"185"}}));typeof window<"u"&&(window.__THREE__?Xe("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="185");function $Z(){let i=null,e=!1,t=null,n=null;function r(s,o){t(s,o),n=i.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&i!==null&&(n=i.requestAnimationFrame(r),e=!0)},stop:function(){i!==null&&i.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){i=s}}}function HAe(i){let e=new WeakMap;function t(a,l){let c=a.array,u=a.usage,f=c.byteLength,d=i.createBuffer();i.bindBuffer(l,d),i.bufferData(l,c,u),a.onUploadCallback();let A;if(c instanceof Float32Array)A=i.FLOAT;else if(typeof Float16Array<"u"&&c instanceof Float16Array)A=i.HALF_FLOAT;else if(c instanceof Uint16Array)a.isFloat16BufferAttribute?A=i.HALF_FLOAT:A=i.UNSIGNED_SHORT;else if(c instanceof Int16Array)A=i.SHORT;else if(c instanceof Uint32Array)A=i.UNSIGNED_INT;else if(c instanceof Int32Array)A=i.INT;else if(c instanceof Int8Array)A=i.BYTE;else if(c instanceof Uint8Array)A=i.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)A=i.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:d,type:A,bytesPerElement:c.BYTES_PER_ELEMENT,version:a.version,size:f}}function n(a,l,c){let u=l.array,f=l.updateRanges;if(i.bindBuffer(c,a),f.length===0)i.bufferSubData(c,0,u);else{f.sort((A,y)=>A.start-y.start);let d=0;for(let A=1;A<f.length;A++){let y=f[d],w=f[A];w.start<=y.start+y.count+1?y.count=Math.max(y.count,w.start+w.count-y.start):(++d,f[d]=w)}f.length=d+1;for(let A=0,y=f.length;A<y;A++){let w=f[A];i.bufferSubData(c,w.start*u.BYTES_PER_ELEMENT,u,w.start,w.count)}l.clearUpdateRanges()}l.onUploadCallback()}function r(a){return a.isInterleavedBufferAttribute&&(a=a.data),e.get(a)}function s(a){a.isInterleavedBufferAttribute&&(a=a.data);let l=e.get(a);l&&(i.deleteBuffer(l.buffer),e.delete(a))}function o(a,l){if(a.isInterleavedBufferAttribute&&(a=a.data),a.isGLBufferAttribute){let u=e.get(a);(!u||u.version<a.version)&&e.set(a,{buffer:a.buffer,type:a.type,bytesPerElement:a.elementSize,version:a.version});return}let c=e.get(a);if(c===void 0)e.set(a,t(a,l));else if(c.version<a.version){if(c.size!==a.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");n(c.buffer,a,l),c.version=a.version}}return{get:r,remove:s,update:o}}var WAe=`#ifdef USE_ALPHAHASH14+}`,ds=class extends Ws{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=$Ae,this.fragmentShader=YAe,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=pg(e.uniforms),this.uniformsGroups=XAe(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){let t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(let r in this.uniforms){let o=this.uniforms[r].value;o&&o.isTexture?t.uniforms[r]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[r]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[r]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[r]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[r]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[r]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[r]={type:"m4",value:o.toArray()}:t.uniforms[r]={value:o}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let n={};for(let r in this.extensions)this.extensions[r]===!0&&(n[r]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}fromJSON(e,t){if(super.fromJSON(e,t),e.uniforms!==void 0)for(let n in e.uniforms){let r=e.uniforms[n];switch(this.uniforms[n]={},r.type){case"t":this.uniforms[n].value=t[r.value]||null;break;case"c":this.uniforms[n].value=new zt().setHex(r.value);break;case"v2":this.uniforms[n].value=new Oe().fromArray(r.value);break;case"v3":this.uniforms[n].value=new re().fromArray(r.value);break;case"v4":this.uniforms[n].value=new xn().fromArray(r.value);break;case"m3":this.uniforms[n].value=new Mn().fromArray(r.value);break;case"m4":this.uniforms[n].value=new cn().fromArray(r.value);break;default:this.uniforms[n].value=r.value}}if(e.defines!==void 0&&(this.defines=e.defines),e.vertexShader!==void 0&&(this.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(this.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(this.glslVersion=e.glslVersion),e.extensions!==void 0)for(let n in e.extensions)this.extensions[n]=e.extensions[n];return e.lights!==void 0&&(this.lights=e.lights),e.clipping!==void 0&&(this.clipping=e.clipping),this}},AM=class extends ds{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}},a_=class extends Ws{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new zt(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new zt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=tc,this.normalScale=new Oe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ua,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},J2=class extends a_{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Oe(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Nn(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new zt(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new zt(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new zt(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}},QA=class extends Ws{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new zt(16777215),this.specular=new zt(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new zt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=tc,this.normalScale=new Oe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ua,this.combine=ig,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},eb=class extends Ws{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new zt(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new zt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=tc,this.normalScale=new Oe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}},tb=class extends Ws{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=tc,this.normalScale=new Oe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}},Ga=class extends Ws{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new zt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new zt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=tc,this.normalScale=new Oe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ua,this.combine=ig,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},gM=class extends Ws{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=SZ,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}},vM=class extends Ws{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}},nb=class extends Ws{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new zt(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=tc,this.normalScale=new Oe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this.fog=e.fog,this}},ib=class extends Du{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}};function eM(i,e){return!i||i.constructor===e?i:typeof e.BYTES_PER_ELEMENT=="number"?new e(i):Array.prototype.slice.call(i)}var c0=class{constructor(e,t,n,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r!==void 0?r:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,n=this._cachedIndex,r=t[n],s=t[n-1];e:{t:{let o;n:{i:if(!(e<r)){for(let a=n+2;;){if(r===void 0){if(e<s)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===a)break;if(s=r,r=t[++n],e<r)break t}o=t.length;break n}if(!(e>=s)){let a=t[1];e<a&&(n=2,s=a);for(let l=n-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===l)break;if(r=s,s=t[--n-1],e>=s)break t}o=n,n=0;break n}break e}for(;n<o;){let a=n+o>>>1;e<t[a]?o=a:n=a+1}if(r=t[n],s=t[n-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,s,r)}return this.interpolate_(n,s,e,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,s=e*r;for(let o=0;o!==r;++o)t[o]=n[s+o];return t}interpolate_(){throw new Error("THREE.Interpolant: Call to abstract method.")}intervalChanged_(){}},_M=class extends c0{constructor(e,t,n,r){super(e,t,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:L8,endingEnd:L8}}intervalChanged_(e,t,n){let r=this.parameterPositions,s=e-2,o=e+1,a=r[s],l=r[o];if(a===void 0)switch(this.getSettings_().endingStart){case D8:s=e,a=2*t-n;break;case N8:s=r.length-2,a=t+r[s]-r[s+1];break;default:s=e,a=n}if(l===void 0)switch(this.getSettings_().endingEnd){case D8:o=e,l=2*n-t;break;case N8:o=1,l=n+r[1]-r[0];break;default:o=e-1,l=t}let c=(n-t)*.5,u=this.valueSize;this._weightPrev=c/(t-a),this._weightNext=c/(l-n),this._offsetPrev=s*u,this._offsetNext=o*u}interpolate_(e,t,n,r){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=this._offsetPrev,f=this._offsetNext,d=this._weightPrev,A=this._weightNext,y=(n-t)/(r-t),w=y*y,S=w*y,T=-d*S+2*d*w-d*y,R=(1+d)*S+(-1.5-2*d)*w+(-.5+d)*y+1,P=(-1-A)*S+(1.5+A)*w+.5*y,I=A*S-A*w;for(let F=0;F!==a;++F)s[F]=T*o[u+F]+R*o[c+F]+P*o[l+F]+I*o[f+F];return s}},xM=class extends c0{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=(n-t)/(r-t),f=1-u;for(let d=0;d!==a;++d)s[d]=o[c+d]*f+o[l+d]*u;return s}},yM=class extends c0{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e){return this.copySampleValue_(e-1)}},bM=class extends c0{interpolate_(e,t,n,r){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=this.inTangents,f=this.outTangents;if(!u||!f){let y=(n-t)/(r-t),w=1-y;for(let S=0;S!==a;++S)s[S]=o[c+S]*w+o[l+S]*y;return s}let d=a*2,A=e-1;for(let y=0;y!==a;++y){let w=o[c+y],S=o[l+y],T=A*d+y*2,R=f[T],P=f[T+1],I=e*d+y*2,F=u[I],D=u[I+1],L=(n-t)/(r-t),C,B,k,z,G;for(let W=0;W<8;W++){C=L*L,B=C*L,k=1-L,z=k*k,G=z*k;let H=G*t+3*z*L*R+3*k*C*F+B*r-n;if(Math.abs(H)<1e-10)break;let $=3*z*(R-t)+6*k*L*(F-R)+3*C*(r-F);if(Math.abs($)<1e-10)break;L=L-H/$,L=Math.max(0,Math.min(1,L))}s[y]=G*w+3*z*L*P+3*k*C*D+B*S}return s}},Jl=class{constructor(e,t,n,r){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=eM(t,this.TimeBufferType),this.values=eM(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(e){let t=e.constructor,n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:eM(e.times,Array),values:eM(e.values,Array)};let r=e.getInterpolation();r!==e.DefaultInterpolation&&(n.interpolation=r)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new yM(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new xM(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new _M(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){let t=new bM(this.times,this.values,this.getValueSize(),e);return this.settings&&(t.inTangents=this.settings.inTangents,t.outTangents=this.settings.outTangents),t}setInterpolation(e){let t;switch(e){case F2:t=this.InterpolantFactoryMethodDiscrete;break;case oM:t=this.InterpolantFactoryMethodLinear;break;case rM:t=this.InterpolantFactoryMethodSmooth;break;case P8:t=this.InterpolantFactoryMethodBezier;break}if(t===void 0){let n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return Xe("KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return F2;case this.InterpolantFactoryMethodLinear:return oM;case this.InterpolantFactoryMethodSmooth:return rM;case this.InterpolantFactoryMethodBezier:return P8}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]+=e}return this}scale(e){if(e!==1){let t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]*=e}return this}trim(e,t){let n=this.times,r=n.length,s=0,o=r-1;for(;s!==r&&n[s]<e;)++s;for(;o!==-1&&n[o]>t;)--o;if(++o,s!==0||o!==r){s>=o&&(o=Math.max(o,1),s=o-1);let a=this.getValueSize();this.times=n.slice(s,o),this.values=this.values.slice(s*a,o*a)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(ze("KeyframeTrack: Invalid value size in track.",this),e=!1);let n=this.times,r=this.values,s=n.length;s===0&&(ze("KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){let l=n[a];if(typeof l=="number"&&isNaN(l)){ze("KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){ze("KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(r!==void 0&&p_(r))for(let a=0,l=r.length;a!==l;++a){let c=r[a];if(isNaN(c)){ze("KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),r=this.getInterpolation()===rM,s=e.length-1,o=1;for(let a=1;a<s;++a){let l=!1,c=e[a],u=e[a+1];if(c!==u&&(a!==1||c!==e[0]))if(r)l=!0;else{let f=a*n,d=f-n,A=f+n;for(let y=0;y!==n;++y){let w=t[f+y];if(w!==t[d+y]||w!==t[A+y]){l=!0;break}}}if(l){if(a!==o){e[o]=e[a];let f=a*n,d=o*n;for(let A=0;A!==n;++A)t[d+A]=t[f+A]}++o}}if(s>0){e[o]=e[s];for(let a=s*n,l=o*n,c=0;c!==n;++c)t[l+c]=t[a+c];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*n)):(this.times=e,this.values=t),this}clone(){let e=this.times.slice(),t=this.values.slice(),n=this.constructor,r=new n(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}};Jl.prototype.ValueTypeName="";Jl.prototype.TimeBufferType=Float32Array;Jl.prototype.ValueBufferType=Float32Array;Jl.prototype.DefaultInterpolation=oM;var u0=class extends Jl{constructor(e,t,n){super(e,t,n)}};u0.prototype.ValueTypeName="bool";u0.prototype.ValueBufferType=Array;u0.prototype.DefaultInterpolation=F2;u0.prototype.InterpolantFactoryMethodLinear=void 0;u0.prototype.InterpolantFactoryMethodSmooth=void 0;var wM=class extends Jl{constructor(e,t,n,r){super(e,t,n,r)}};wM.prototype.ValueTypeName="color";var SM=class extends Jl{constructor(e,t,n,r){super(e,t,n,r)}};SM.prototype.ValueTypeName="number";var TM=class extends c0{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(n-t)/(r-t),c=e*a;for(let u=c+a;c!==u;c+=4)qs.slerpFlat(s,0,o,c-a,o,c,l);return s}},rb=class extends Jl{constructor(e,t,n,r){super(e,t,n,r)}InterpolantFactoryMethodLinear(e){return new TM(this.times,this.values,this.getValueSize(),e)}};rb.prototype.ValueTypeName="quaternion";rb.prototype.InterpolantFactoryMethodSmooth=void 0;var h0=class extends Jl{constructor(e,t,n){super(e,t,n)}};h0.prototype.ValueTypeName="string";h0.prototype.ValueBufferType=Array;h0.prototype.DefaultInterpolation=F2;h0.prototype.InterpolantFactoryMethodLinear=void 0;h0.prototype.InterpolantFactoryMethodSmooth=void 0;var EM=class extends Jl{constructor(e,t,n,r){super(e,t,n,r)}};EM.prototype.ValueTypeName="vector";var sM={enabled:!1,files:{},add:function(i,e){this.enabled!==!1&&(hZ(i)||(this.files[i]=e))},get:function(i){if(this.enabled!==!1&&!hZ(i))return this.files[i]},remove:function(i){delete this.files[i]},clear:function(){this.files={}}};function hZ(i){try{let e=i.slice(i.indexOf(":")+1);return new URL(e).protocol==="blob:"}catch{return!1}}var MM=class{constructor(e,t,n){let r=this,s=!1,o=0,a=0,l,c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this._abortController=null,this.itemStart=function(u){a++,s===!1&&r.onStart!==void 0&&r.onStart(u,o,a),s=!0},this.itemEnd=function(u){o++,r.onProgress!==void 0&&r.onProgress(u,o,a),o===a&&(s=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(u){r.onError!==void 0&&r.onError(u)},this.resolveURL=function(u){return u=u.normalize("NFC"),l?l(u):u},this.setURLModifier=function(u){return l=u,this},this.addHandler=function(u,f){return c.push(u,f),this},this.removeHandler=function(u){let f=c.indexOf(u);return f!==-1&&c.splice(f,2),this},this.getHandler=function(u){for(let f=0,d=c.length;f<d;f+=2){let A=c[f],y=c[f+1];if(A.global&&(A.lastIndex=0),A.test(u))return y}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}},DZ=new MM,f0=class{constructor(e){this.manager=e!==void 0?e:DZ,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}load(){}loadAsync(e,t){let n=this;return new Promise(function(r,s){n.load(e,r,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}};f0.DEFAULT_MATERIAL_NAME="__DEFAULT";var Hv=new WeakMap,CM=class extends f0{constructor(e){super(e)}load(e,t,n,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let s=this,o=sM.get(`image:${e}`);if(o!==void 0){if(o.complete===!0)s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0);else{let f=Hv.get(o);f===void 0&&(f=[],Hv.set(o,f)),f.push({onLoad:t,onError:r})}return o}let a=Zv("img");function l(){u(),t&&t(this);let f=Hv.get(this)||[];for(let d=0;d<f.length;d++){let A=f[d];A.onLoad&&A.onLoad(this)}Hv.delete(this),s.manager.itemEnd(e)}function c(f){u(),r&&r(f),sM.remove(`image:${e}`);let d=Hv.get(this)||[];for(let A=0;A<d.length;A++){let y=d[A];y.onError&&y.onError(f)}Hv.delete(this),s.manager.itemError(e),s.manager.itemEnd(e)}function u(){a.removeEventListener("load",l,!1),a.removeEventListener("error",c,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),sM.add(`image:${e}`,a),s.manager.itemStart(e),a.src=e,a}};var bl=class extends f0{constructor(e){super(e)}load(e,t,n,r){let s=new Hs,o=new CM(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){s.image=a,s.needsUpdate=!0,t!==void 0&&t(s)},n,r),s}},Nh=class extends lr{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new zt(e),this.intensity=t}dispose(){this.dispatchEvent({type:"dispose"})}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}},sb=class extends Nh{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(lr.DEFAULT_UP),this.updateMatrix(),this.groundColor=new zt(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}toJSON(e){let t=super.toJSON(e);return t.object.groundColor=this.groundColor.getHex(),t}},R8=new cn,fZ=new re,dZ=new re,ob=class{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Oe(512,512),this.mapType=Ji,this.map=null,this.mapPass=null,this.matrix=new cn,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new qc,this._frameExtents=new Oe(1,1),this._viewportCount=1,this._viewports=[new xn(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,n=this.matrix;fZ.setFromMatrixPosition(e.matrixWorld),t.position.copy(fZ),dZ.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(dZ),t.updateMatrixWorld(),R8.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(R8,t.coordinateSystem,t.reversedDepth),t.coordinateSystem===xl||t.reversedDepth?n.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(R8)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this.biasNode=e.biasNode,this}clone(){return new this.constructor().copy(this)}toJSON(){let e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}},tM=new re,nM=new qs,Rh=new re,Ld=class extends lr{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new cn,this.projectionMatrix=new cn,this.projectionMatrixInverse=new cn,this.coordinateSystem=Uo,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorld.decompose(tM,nM,Rh),Rh.x===1&&Rh.y===1&&Rh.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(tM,nM,Rh.set(1,1,1)).invert()}updateWorldMatrix(e,t,n=!1){super.updateWorldMatrix(e,t,n),this.matrixWorld.decompose(tM,nM,Rh),Rh.x===1&&Rh.y===1&&Rh.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(tM,nM,Rh.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}},Qp=new re,pZ=new Oe,mZ=new Oe,$r=class extends Ld{constructor(e=50,t=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=Rd*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(P2*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Rd*2*Math.atan(Math.tan(P2*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){Qp.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Qp.x,Qp.y).multiplyScalar(-e/Qp.z),Qp.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Qp.x,Qp.y).multiplyScalar(-e/Qp.z)}getViewSize(e,t){return this.getViewBounds(e,pZ,mZ),t.subVectors(mZ,pZ)}setViewOffset(e,t,n,r,s,o){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(P2*.5*this.fov)/this.zoom,n=2*t,r=this.aspect*n,s=-.5*r,o=this.view;if(this.view!==null&&this.view.enabled){let l=o.fullWidth,c=o.fullHeight;s+=o.offsetX*r/l,t-=o.offsetY*n/c,r*=o.width/l,n*=o.height/c}let a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-n,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}},k8=class extends ob{constructor(){super(new $r(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){let t=this.camera,n=Rd*2*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height*this.aspect,s=e.distance||t.far;(n!==t.fov||r!==t.aspect||s!==t.far)&&(t.fov=n,t.aspect=r,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}},JA=class extends Nh{constructor(e,t,n=0,r=Math.PI/3,s=0,o=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(lr.DEFAULT_UP),this.updateMatrix(),this.target=new lr,this.distance=n,this.angle=r,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new k8}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.map=e.map,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.distance=this.distance,t.object.angle=this.angle,t.object.decay=this.decay,t.object.penumbra=this.penumbra,t.object.target=this.target.uuid,this.map&&this.map.isTexture&&(t.object.map=this.map.toJSON(e).uuid),t.object.shadow=this.shadow.toJSON(),t}},z8=class extends ob{constructor(){super(new $r(90,1,.5,500)),this.isPointLightShadow=!0}},ab=class extends Nh{constructor(e,t,n=0,r=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=r,this.shadow=new z8}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.distance=this.distance,t.object.decay=this.decay,t.object.shadow=this.shadow.toJSON(),t}},Fu=class extends Ld{constructor(e=-1,t=1,n=1,r=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=r,this.near=s,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,r,s,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2,s=n-e,o=n+e,a=r+t,l=r-t;if(this.view!==null&&this.view.enabled){let c=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,o=s+c*this.view.width,a-=u*this.view.offsetY,l=a-u*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,l,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}},V8=class extends ob{constructor(){super(new Fu(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}},eg=class extends Nh{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(lr.DEFAULT_UP),this.updateMatrix(),this.target=new lr,this.shadow=new V8}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}},tg=class extends Nh{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}},lb=class extends Nh{constructor(e,t,n=10,r=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=r}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){let t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}},RM=class{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new re)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){let n=e.x,r=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.282095),t.addScaledVector(o[1],.488603*r),t.addScaledVector(o[2],.488603*s),t.addScaledVector(o[3],.488603*n),t.addScaledVector(o[4],1.092548*(n*r)),t.addScaledVector(o[5],1.092548*(r*s)),t.addScaledVector(o[6],.315392*(3*s*s-1)),t.addScaledVector(o[7],1.092548*(n*s)),t.addScaledVector(o[8],.546274*(n*n-r*r)),t}getIrradianceAt(e,t){let n=e.x,r=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.886227),t.addScaledVector(o[1],2*.511664*r),t.addScaledVector(o[2],2*.511664*s),t.addScaledVector(o[3],2*.511664*n),t.addScaledVector(o[4],2*.429043*n*r),t.addScaledVector(o[5],2*.429043*r*s),t.addScaledVector(o[6],.743125*s*s-.247708),t.addScaledVector(o[7],2*.429043*n*s),t.addScaledVector(o[8],.429043*(n*n-r*r)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){let n=this.coefficients;for(let r=0;r<9;r++)n[r].fromArray(e,t+r*3);return this}toArray(e=[],t=0){let n=this.coefficients;for(let r=0;r<9;r++)n[r].toArray(e,t+r*3);return e}static getBasisAt(e,t){let n=e.x,r=e.y,s=e.z;t[0]=.282095,t[1]=.488603*r,t[2]=.488603*s,t[3]=.488603*n,t[4]=1.092548*n*r,t[5]=1.092548*r*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*n*s,t[8]=.546274*(n*n-r*r)}},cb=class extends Nh{constructor(e=new RM,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}toJSON(e){let t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}};var ub=class extends Xn{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){let e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}};var Wv=-90,jv=1,l_=class extends lr{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;let r=new $r(Wv,jv,e,t);r.layers=this.layers,this.add(r);let s=new $r(Wv,jv,e,t);s.layers=this.layers,this.add(s);let o=new $r(Wv,jv,e,t);o.layers=this.layers,this.add(o);let a=new $r(Wv,jv,e,t);a.layers=this.layers,this.add(a);let l=new $r(Wv,jv,e,t);l.layers=this.layers,this.add(l);let c=new $r(Wv,jv,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[n,r,s,o,a,l]=t;for(let c of t)this.remove(c);if(e===Uo)n.up.set(0,1,0),n.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===xl)n.up.set(0,-1,0),n.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(let c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();let{renderTarget:n,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());let[s,o,a,l,c,u]=this.children,f=e.getRenderTarget(),d=e.getActiveCubeFace(),A=e.getActiveMipmapLevel(),y=e.xr.enabled;e.xr.enabled=!1;let w=n.texture.generateMipmaps;n.texture.generateMipmaps=!1;let S=!1;e.isWebGLRenderer===!0?S=e.state.buffers.depth.getReversed():S=e.reversedDepthBuffer,e.setRenderTarget(n,0,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,s),e.setRenderTarget(n,1,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(n,2,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,a),e.setRenderTarget(n,3,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),e.setRenderTarget(n,4,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),n.texture.generateMipmaps=w,e.setRenderTarget(n,5,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,u),e.setRenderTarget(f,d,A),e.xr.enabled=y,n.texture.needsPMREMUpdate=!0}},c_=class extends $r{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}},ng=class{constructor(){this._previousTime=0,this._currentTime=0,this._startTime=performance.now(),this._delta=0,this._elapsed=0,this._timescale=1,this._document=null,this._pageVisibilityHandler=null}connect(e){this._document=e,e.hidden!==void 0&&(this._pageVisibilityHandler=ZAe.bind(this),e.addEventListener("visibilitychange",this._pageVisibilityHandler,!1))}disconnect(){this._pageVisibilityHandler!==null&&(this._document.removeEventListener("visibilitychange",this._pageVisibilityHandler),this._pageVisibilityHandler=null),this._document=null}getDelta(){return this._delta/1e3}getElapsed(){return this._elapsed/1e3}getTimescale(){return this._timescale}setTimescale(e){return this._timescale=e,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(e){return this._pageVisibilityHandler!==null&&this._document.hidden===!0?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(e!==void 0?e:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}};function ZAe(){this._document.hidden===!1&&this.reset()}var mF="\\[\\]\\.:\\/",KAe=new RegExp("["+mF+"]","g"),AF="[^"+mF+"]",QAe="[^"+mF.replace("\\.","")+"]",JAe=/((?:WC+[\/:])*)/.source.replace("WC",AF),ege=/(WCOD+)?/.source.replace("WCOD",QAe),tge=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",AF),nge=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",AF),ige=new RegExp("^"+JAe+ege+tge+nge+"$"),rge=["material","materials","bones","map"],G8=class{constructor(e,t,n){let r=n||Tr.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();let n=this._targetGroup.nCachedObjects_,r=this._bindings[n];r!==void 0&&r.getValue(e,t)}setValue(e,t){let n=this._bindings;for(let r=this._targetGroup.nCachedObjects_,s=n.length;r!==s;++r)n[r].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}},Tr=class i{constructor(e,t,n){this.path=t,this.parsedPath=n||i.parseTrackName(t),this.node=i.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new i.Composite(e,t,n):new i(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(KAe,"")}static parseTrackName(e){let t=ige.exec(e);if(t===null)throw new Error("THREE.PropertyBinding: Cannot parse trackName: "+e);let n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){let s=n.nodeName.substring(r+1);rge.indexOf(s)!==-1&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=s)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("THREE.PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){let n=function(s){for(let o=0;o<s.length;o++){let a=s[o];if(a.name===t||a.uuid===t)return a;let l=n(a.children);if(l)return l}return null},r=n(e.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)e[t++]=n[r]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[r]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[r]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node,t=this.parsedPath,n=t.objectName,r=t.propertyName,s=t.propertyIndex;if(e||(e=i.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){Xe("PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let c=t.objectIndex;switch(n){case"materials":if(!e.material){ze("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){ze("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){ze("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let u=0;u<e.length;u++)if(e[u].name===c){c=u;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){ze("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){ze("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[n]===void 0){ze("PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(c!==void 0){if(e[c]===void 0){ze("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[c]}}let o=e[r];if(o===void 0){let c=t.nodeName;ze("PropertyBinding: Trying to update property for track: "+c+"."+r+" but it wasn't found.",e);return}let a=this.Versioning.None;this.targetObject=e,e.isMaterial===!0?a=this.Versioning.NeedsUpdate:e.isObject3D===!0&&(a=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(s!==void 0){if(r==="morphTargetInfluences"){if(!e.geometry){ze("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){ze("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}l=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=s}else o.fromArray!==void 0&&o.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(l=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=r;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};Tr.Composite=G8;Tr.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Tr.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Tr.prototype.GetterByBindingType=[Tr.prototype._getValue_direct,Tr.prototype._getValue_array,Tr.prototype._getValue_arrayElement,Tr.prototype._getValue_toArray];Tr.prototype.SetterByBindingTypeAndVersioning=[[Tr.prototype._setValue_direct,Tr.prototype._setValue_direct_setNeedsUpdate,Tr.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Tr.prototype._setValue_array,Tr.prototype._setValue_array_setNeedsUpdate,Tr.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Tr.prototype._setValue_arrayElement,Tr.prototype._setValue_arrayElement_setNeedsUpdate,Tr.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Tr.prototype._setValue_fromArray,Tr.prototype._setValue_fromArray_setNeedsUpdate,Tr.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var NZe=new Float32Array(1);var Fh=class extends Id{constructor(e,t,n=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){let t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){let t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}};var AZ=new cn,hb=class{constructor(e,t,n=0,r=1/0){this.ray=new Pd(e,t),this.near=n,this.far=r,this.camera=null,this.layers=new Jv,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,t.projectionMatrix.elements[14]).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):ze("Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return AZ.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(AZ),this}intersectObject(e,t=!0,n=[]){return q8(e,this,n,t),n.sort(gZ),n}intersectObjects(e,t=!0,n=[]){for(let r=0,s=e.length;r<s;r++)q8(e[r],this,n,t);return n.sort(gZ),n}};function gZ(i,e){return i.distance-e.distance}function q8(i,e,t,n){let r=!0;if(i.layers.test(e.layers)&&i.raycast(e,t)===!1&&(r=!1),r===!0&&n===!0){let s=i.children;for(let o=0,a=s.length;o<a;o++)q8(s[o],e,t,!0)}}var u_=class{constructor(e=1,t=0,n=0){this.radius=e,this.phi=t,this.theta=n}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Nn(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(Nn(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}};var yF=class yF{constructor(e,t,n,r){this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,n,r)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,r){let s=this.elements;return s[0]=e,s[2]=t,s[1]=n,s[3]=r,this}};yF.prototype.isMatrix2=!0;var h_=yF,vZ=new Oe,IM=class{constructor(e=new Oe(1/0,1/0),t=new Oe(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=vZ.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,vZ).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}},_Z=new re,iM=new re,Xv=new re,$v=new re,I8=new re,sge=new re,oge=new re,fb=class{constructor(e=new re,t=new re){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){_Z.subVectors(e,this.start),iM.subVectors(this.end,this.start);let n=iM.dot(iM);if(n===0)return 0;let s=iM.dot(_Z)/n;return t&&(s=Nn(s,0,1)),s}closestPointToPoint(e,t,n){let r=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(r).add(this.start)}distanceSqToLine3(e,t=sge,n=oge){let r=10000000000000001e-32,s,o,a=this.start,l=e.start,c=this.end,u=e.end;Xv.subVectors(c,a),$v.subVectors(u,l),I8.subVectors(a,l);let f=Xv.dot(Xv),d=$v.dot($v),A=$v.dot(I8);if(f<=r&&d<=r)return t.copy(a),n.copy(l),t.sub(n),t.dot(t);if(f<=r)s=0,o=A/d,o=Nn(o,0,1);else{let y=Xv.dot(I8);if(d<=r)o=0,s=Nn(-y/f,0,1);else{let w=Xv.dot($v),S=f*d-w*w;S!==0?s=Nn((w*A-y*d)/S,0,1):s=0,o=(w*s+A)/d,o<0?(o=0,s=Nn(-y/f,0,1)):o>1&&(o=1,s=Nn((w-y)/f,0,1))}}return t.copy(a).addScaledVector(Xv,s),n.copy(l).addScaledVector($v,o),t.distanceToSquared(n)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}};var db=class{constructor(){this.type="ShapePath",this.color=new zt,this.subPaths=[],this.currentPath=null,this.userData={}}moveTo(e,t){return this.currentPath=new YA,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,r){return this.currentPath.quadraticCurveTo(e,t,n,r),this}bezierCurveTo(e,t,n,r,s,o){return this.currentPath.bezierCurveTo(e,t,n,r,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(){function e(l,c){let u=!1,f=c.length;for(let d=0,A=f-1;d<f;A=d++){let y=c[d],w=c[A];y.y>l.y!=w.y>l.y&&l.x<(w.x-y.x)*(l.y-y.y)/(w.y-y.y)+y.x&&(u=!u)}return u}function t(l,c){let u=c.getCenter(new Oe);if(e(u,l))return u;let f=u.y,d=[],A=l.length;for(let y=0;y<A;y++){let w=l[y],S=l[(y+1)%A];if(w.y>f!=S.y>f){let T=w.x+(f-w.y)*(S.x-w.x)/(S.y-w.y);d.push(T)}}return d.length>1&&(d.sort((y,w)=>y-w),u.x=(d[0]+d[1])/2),u}let n=this.userData.style&&this.userData.style.fillRule||"nonzero";n!=="nonzero"&&n!=="evenodd"&&(Xe('Fill-rule "'+n+'" is not supported, falling back to "nonzero".'),n="nonzero");let r=n==="nonzero"?(l=>l!==0):(l=>(l&1)!==0),s=[];for(let l of this.subPaths){let c=l.getPoints();if(c.length<3)continue;let u=Jp.area(c);if(u===0)continue;let f=new IM;for(let d=0;d<c.length;d++)f.expandByPoint(c[d]);s.push({subPath:l,points:c,boundingBox:f,interiorPoint:t(c,f),absArea:Math.abs(u),winding:u<0?-1:1,container:null,exclude:!1,role:null})}s.sort((l,c)=>c.absArea-l.absArea);for(let l=0;l<s.length;l++){let c=s[l],u=0;for(let f=l-1;f>=0;f--){let d=s[f];if(d.boundingBox.containsBox(c.boundingBox)&&e(c.interiorPoint,d.points)){c.container=d.exclude?d.container:d,u=d.winding,c.winding+=u;break}}r(c.winding)===r(u)&&(c.exclude=!0)}for(let l of s)l.exclude||(l.role=l.container===null||l.container.role==="hole"?"outer":"hole");let o=[],a=new Map;for(let l of s){if(l.exclude||l.role!=="outer")continue;let c=new W2;c.curves=l.subPath.curves,o.push(c),a.set(l,c)}for(let l of s){if(l.exclude||l.role!=="hole")continue;let c=a.get(l.container);if(!c)continue;let u=new YA;u.curves=l.subPath.curves,c.holes.push(u)}return o}},Dd=class extends la{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){Xe("Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}};function Vb(i,e,t,n){let r=age(n);switch(t){case f_:return i*e;case Bd:return i*e/r.components*r.byteLength;case Gh:return i*e/r.components*r.byteLength;case js:return i*e*2/r.components*r.byteLength;case qh:return i*e*2/r.components*r.byteLength;case Fd:return i*e*3/r.components*r.byteLength;case Or:return i*e*4/r.components*r.byteLength;case v0:return i*e*4/r.components*r.byteLength;case Hh:case Wh:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case jh:case Xh:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case cg:case hg:return Math.max(i,16)*Math.max(e,8)/4;case lg:case ug:return Math.max(i,8)*Math.max(e,8)/2;case _0:case x0:case b0:case w0:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case y0:case $h:case S0:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case T0:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case E0:return Math.floor((i+4)/5)*Math.floor((e+3)/4)*16;case M0:return Math.floor((i+4)/5)*Math.floor((e+4)/5)*16;case C0:return Math.floor((i+5)/6)*Math.floor((e+4)/5)*16;case R0:return Math.floor((i+5)/6)*Math.floor((e+5)/6)*16;case I0:return Math.floor((i+7)/8)*Math.floor((e+4)/5)*16;case P0:return Math.floor((i+7)/8)*Math.floor((e+5)/6)*16;case L0:return Math.floor((i+7)/8)*Math.floor((e+7)/8)*16;case D0:return Math.floor((i+9)/10)*Math.floor((e+4)/5)*16;case N0:return Math.floor((i+9)/10)*Math.floor((e+5)/6)*16;case F0:return Math.floor((i+9)/10)*Math.floor((e+7)/8)*16;case B0:return Math.floor((i+9)/10)*Math.floor((e+9)/10)*16;case O0:return Math.floor((i+11)/12)*Math.floor((e+9)/10)*16;case U0:return Math.floor((i+11)/12)*Math.floor((e+11)/12)*16;case k0:case z0:case V0:return Math.ceil(i/4)*Math.ceil(e/4)*16;case G0:case q0:return Math.ceil(i/4)*Math.ceil(e/4)*8;case Yh:case H0:return Math.ceil(i/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function age(i){switch(i){case Ji:case zh:return{byteLength:1,components:1};case wl:case Vh:case Wi:return{byteLength:2,components:1};case rg:case sg:return{byteLength:2,components:4};case xi:case Zr:case cr:return{byteLength:4,components:1};case og:case ag:return{byteLength:4,components:3}}throw new Error(`THREE.TextureUtils: Unknown texture type ${i}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"185"}}));typeof window<"u"&&(window.__THREE__?Xe("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="185");function iK(){let i=null,e=!1,t=null,n=null;function r(s,o){t(s,o),n=i.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&i!==null&&(n=i.requestAnimationFrame(r),e=!0)},stop:function(){i!==null&&i.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){i=s}}}function uge(i){let e=new WeakMap;function t(a,l){let c=a.array,u=a.usage,f=c.byteLength,d=i.createBuffer();i.bindBuffer(l,d),i.bufferData(l,c,u),a.onUploadCallback();let A;if(c instanceof Float32Array)A=i.FLOAT;else if(typeof Float16Array<"u"&&c instanceof Float16Array)A=i.HALF_FLOAT;else if(c instanceof Uint16Array)a.isFloat16BufferAttribute?A=i.HALF_FLOAT:A=i.UNSIGNED_SHORT;else if(c instanceof Int16Array)A=i.SHORT;else if(c instanceof Uint32Array)A=i.UNSIGNED_INT;else if(c instanceof Int32Array)A=i.INT;else if(c instanceof Int8Array)A=i.BYTE;else if(c instanceof Uint8Array)A=i.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)A=i.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:d,type:A,bytesPerElement:c.BYTES_PER_ELEMENT,version:a.version,size:f}}function n(a,l,c){let u=l.array,f=l.updateRanges;if(i.bindBuffer(c,a),f.length===0)i.bufferSubData(c,0,u);else{f.sort((A,y)=>A.start-y.start);let d=0;for(let A=1;A<f.length;A++){let y=f[d],w=f[A];w.start<=y.start+y.count+1?y.count=Math.max(y.count,w.start+w.count-y.start):(++d,f[d]=w)}f.length=d+1;for(let A=0,y=f.length;A<y;A++){let w=f[A];i.bufferSubData(c,w.start*u.BYTES_PER_ELEMENT,u,w.start,w.count)}l.clearUpdateRanges()}l.onUploadCallback()}function r(a){return a.isInterleavedBufferAttribute&&(a=a.data),e.get(a)}function s(a){a.isInterleavedBufferAttribute&&(a=a.data);let l=e.get(a);l&&(i.deleteBuffer(l.buffer),e.delete(a))}function o(a,l){if(a.isInterleavedBufferAttribute&&(a=a.data),a.isGLBufferAttribute){let u=e.get(a);(!u||u.version<a.version)&&e.set(a,{buffer:a.buffer,type:a.type,bytesPerElement:a.elementSize,version:a.version});return}let c=e.get(a);if(c===void 0)e.set(a,t(a,l));else if(c.version<a.version){if(c.size!==a.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");n(c.buffer,a,l),c.version=a.version}}return{get:r,remove:s,update:o}}var hge=`#ifdef USE_ALPHAHASH1515 if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;16-#endif`,jAe=`#ifdef USE_ALPHAHASH16+#endif`,fge=`#ifdef USE_ALPHAHASH1717 const float ALPHA_HASH_SCALE = 0.05;1818 float hash2D( vec2 value ) {1919 return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );@@ -48,20 +48,20 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
4848 : cases.z;4949 return clamp( threshold , 1.0e-6, 1.0 );5050 }51-#endif`,XAe=`#ifdef USE_ALPHAMAP51+#endif`,dge=`#ifdef USE_ALPHAMAP5252 diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;53-#endif`,$Ae=`#ifdef USE_ALPHAMAP53+#endif`,pge=`#ifdef USE_ALPHAMAP5454 uniform sampler2D alphaMap;55-#endif`,YAe=`#ifdef USE_ALPHATEST55+#endif`,mge=`#ifdef USE_ALPHATEST5656 #ifdef ALPHA_TO_COVERAGE5757 diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );5858 if ( diffuseColor.a == 0.0 ) discard;5959 #else6060 if ( diffuseColor.a < alphaTest ) discard;6161 #endif62-#endif`,ZAe=`#ifdef USE_ALPHATEST62+#endif`,Age=`#ifdef USE_ALPHATEST6363 uniform float alphaTest;64-#endif`,KAe=`#ifdef USE_AOMAP64+#endif`,gge=`#ifdef USE_AOMAP6565 float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;6666 reflectedLight.indirectDiffuse *= ambientOcclusion;6767 #if defined( USE_CLEARCOAT ) @@ -74,10 +74,10 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
7474 float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );7575 reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );7676 #endif77-#endif`,QAe=`#ifdef USE_AOMAP77+#endif`,vge=`#ifdef USE_AOMAP7878 uniform sampler2D aoMap;7979 uniform float aoMapIntensity;80-#endif`,JAe=`#ifdef USE_BATCHING80+#endif`,_ge=`#ifdef USE_BATCHING8181 #if ! defined( GL_ANGLE_multi_draw )8282 #define gl_DrawID _gl_DrawID8383 uniform int _gl_DrawID;@@ -111,15 +111,15 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
111111 int y = j / size;112112 return texelFetch( batchingColorTexture, ivec2( x, y ), 0 );113113 }114-#endif`,ege=`#ifdef USE_BATCHING114+#endif`,xge=`#ifdef USE_BATCHING115115 mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );116-#endif`,tge=`vec3 transformed = vec3( position );116+#endif`,yge=`vec3 transformed = vec3( position );117117 #ifdef USE_ALPHAHASH118118 vPosition = vec3( position );119-#endif`,nge=`vec3 objectNormal = vec3( normal );119+#endif`,bge=`vec3 objectNormal = vec3( normal );120120 #ifdef USE_TANGENT121121 vec3 objectTangent = vec3( tangent.xyz );122-#endif`,ige=`float G_BlinnPhong_Implicit( ) {122+#endif`,wge=`float G_BlinnPhong_Implicit( ) {123123 return 0.25;124124 }125125 float D_BlinnPhong( const in float shininess, const in float dotNH ) {@@ -133,7 +133,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
133133 float G = G_BlinnPhong_Implicit( );134134 float D = D_BlinnPhong( shininess, dotNH );135135 return F * ( G * D );136-} // validated`,rge=`#ifdef USE_IRIDESCENCE136+} // validated`,Sge=`#ifdef USE_IRIDESCENCE137137 const mat3 XYZ_TO_REC709 = mat3(138138 3.2404542, -0.9692660, 0.0556434,139139 -1.5371385, 1.8760108, -0.2040259,@@ -196,7 +196,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
196196 }197197 return max( I, vec3( 0.0 ) );198198 }199-#endif`,sge=`#ifdef USE_BUMPMAP199+#endif`,Tge=`#ifdef USE_BUMPMAP200200 uniform sampler2D bumpMap;201201 uniform float bumpScale;202202 vec2 dHdxy_fwd() {@@ -217,7 +217,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
217217 vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );218218 return normalize( abs( fDet ) * surf_norm - vGrad );219219 }220-#endif`,oge=`#if NUM_CLIPPING_PLANES > 0220+#endif`,Ege=`#if NUM_CLIPPING_PLANES > 0221221 vec4 plane;222222 #ifdef ALPHA_TO_COVERAGE223223 float distanceToPlane, distanceGradient;@@ -263,20 +263,20 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
263263 if ( clipped ) discard;264264 #endif265265 #endif266-#endif`,age=`#if NUM_CLIPPING_PLANES > 0266+#endif`,Mge=`#if NUM_CLIPPING_PLANES > 0267267 varying vec3 vClipPosition;268268 uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];269-#endif`,lge=`#if NUM_CLIPPING_PLANES > 0269+#endif`,Cge=`#if NUM_CLIPPING_PLANES > 0270270 varying vec3 vClipPosition;271-#endif`,cge=`#if NUM_CLIPPING_PLANES > 0271+#endif`,Rge=`#if NUM_CLIPPING_PLANES > 0272272 vClipPosition = - mvPosition.xyz;273-#endif`,uge=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )273+#endif`,Ige=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )274274 diffuseColor *= vColor;275-#endif`,hge=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )275+#endif`,Pge=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )276276 varying vec4 vColor;277-#endif`,fge=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )277+#endif`,Lge=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )278278 varying vec4 vColor;279-#endif`,dge=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )279+#endif`,Dge=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )280280 vColor = vec4( 1.0 );281281 #endif282282 #ifdef USE_COLOR_ALPHA@@ -289,7 +289,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
289289 #endif290290 #ifdef USE_BATCHING_COLOR291291 vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) );292-#endif`,pge=`#define PI 3.141592653589793292+#endif`,Nge=`#define PI 3.141592653589793293293 #define PI2 6.283185307179586294294 #define PI_HALF 1.5707963267948966295295 #define RECIPROCAL_PI 0.3183098861837907@@ -360,7 +360,7 @@ vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
360360 float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {361361 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );362362 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );363-} // validated`,mge=`#ifdef ENVMAP_TYPE_CUBE_UV363+} // validated`,Fge=`#ifdef ENVMAP_TYPE_CUBE_UV364364 #define cubeUV_minMipLevel 4.0365365 #define cubeUV_minTileSize 16.0366366 float getFace( vec3 direction ) {@@ -453,7 +453,7 @@ float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
453453 return vec4( mix( color0, color1, mipF ), 1.0 );454454 }455455 }456-#endif`,Age=`vec3 transformedNormal = objectNormal;456+#endif`,Bge=`vec3 transformedNormal = objectNormal;457457 #ifdef USE_TANGENT458458 vec3 transformedTangent = objectTangent;459459 #endif@@ -479,21 +479,21 @@ transformedNormal = normalMatrix * transformedNormal;
479479 #endif480480 #ifdef USE_TANGENT481481 transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;482-#endif`,gge=`#ifdef USE_DISPLACEMENTMAP482+#endif`,Oge=`#ifdef USE_DISPLACEMENTMAP483483 uniform sampler2D displacementMap;484484 uniform float displacementScale;485485 uniform float displacementBias;486-#endif`,vge=`#ifdef USE_DISPLACEMENTMAP486+#endif`,Uge=`#ifdef USE_DISPLACEMENTMAP487487 transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );488-#endif`,_ge=`#ifdef USE_EMISSIVEMAP488+#endif`,kge=`#ifdef USE_EMISSIVEMAP489489 vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );490490 #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE491491 emissiveColor = sRGBTransferEOTF( emissiveColor );492492 #endif493493 totalEmissiveRadiance *= emissiveColor.rgb;494-#endif`,xge=`#ifdef USE_EMISSIVEMAP494+#endif`,zge=`#ifdef USE_EMISSIVEMAP495495 uniform sampler2D emissiveMap;496-#endif`,yge="gl_FragColor = linearToOutputTexel( gl_FragColor );",bge=`vec4 LinearTransferOETF( in vec4 value ) {496+#endif`,Vge="gl_FragColor = linearToOutputTexel( gl_FragColor );",Gge=`vec4 LinearTransferOETF( in vec4 value ) {497497 return value;498498 }499499 vec4 sRGBTransferEOTF( in vec4 value ) {@@ -501,7 +501,7 @@ vec4 sRGBTransferEOTF( in vec4 value ) {
501501 }502502 vec4 sRGBTransferOETF( in vec4 value ) {503503 return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );504-}`,wge=`#ifdef USE_ENVMAP504+}`,qge=`#ifdef USE_ENVMAP505505 #ifdef ENV_WORLDPOS506506 vec3 cameraToFrag;507507 if ( isOrthographic ) {@@ -528,7 +528,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
528528 outgoingLight += envColor.xyz * specularStrength * reflectivity;529529 #endif530530 #endif531-#endif`,Sge=`#ifdef USE_ENVMAP531+#endif`,Hge=`#ifdef USE_ENVMAP532532 uniform float envMapIntensity;533533 uniform mat3 envMapRotation;534534 #ifdef ENVMAP_TYPE_CUBE@@ -536,7 +536,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
536536 #else537537 uniform sampler2D envMap;538538 #endif539-#endif`,Tge=`#ifdef USE_ENVMAP539+#endif`,Wge=`#ifdef USE_ENVMAP540540 uniform float reflectivity;541541 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )542542 #define ENV_WORLDPOS@@ -547,7 +547,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
547547 #else548548 varying vec3 vReflect;549549 #endif550-#endif`,Ege=`#ifdef USE_ENVMAP550+#endif`,jge=`#ifdef USE_ENVMAP551551 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )552552 #define ENV_WORLDPOS553553 #endif@@ -558,7 +558,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
558558 varying vec3 vReflect;559559 uniform float refractionRatio;560560 #endif561-#endif`,Mge=`#ifdef USE_ENVMAP561+#endif`,Xge=`#ifdef USE_ENVMAP562562 #ifdef ENV_WORLDPOS563563 vWorldPosition = worldPosition.xyz;564564 #else@@ -575,18 +575,18 @@ vec4 sRGBTransferOETF( in vec4 value ) {
575575 vReflect = refract( cameraToVertex, worldNormal, refractionRatio );576576 #endif577577 #endif578-#endif`,Cge=`#ifdef USE_FOG578+#endif`,$ge=`#ifdef USE_FOG579579 vFogDepth = - mvPosition.z;580-#endif`,Rge=`#ifdef USE_FOG580+#endif`,Yge=`#ifdef USE_FOG581581 varying float vFogDepth;582-#endif`,Ige=`#ifdef USE_FOG582+#endif`,Zge=`#ifdef USE_FOG583583 #ifdef FOG_EXP2584584 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );585585 #else586586 float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );587587 #endif588588 gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );589-#endif`,Pge=`#ifdef USE_FOG589+#endif`,Kge=`#ifdef USE_FOG590590 uniform vec3 fogColor;591591 varying float vFogDepth;592592 #ifdef FOG_EXP2@@ -595,7 +595,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
595595 uniform float fogNear;596596 uniform float fogFar;597597 #endif598-#endif`,Lge=`#ifdef USE_GRADIENTMAP598+#endif`,Qge=`#ifdef USE_GRADIENTMAP599599 uniform sampler2D gradientMap;600600 #endif601601 vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {@@ -607,12 +607,12 @@ vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
607607 vec2 fw = fwidth( coord ) * 0.5;608608 return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );609609 #endif610-}`,Dge=`#ifdef USE_LIGHTMAP610+}`,Jge=`#ifdef USE_LIGHTMAP611611 uniform sampler2D lightMap;612612 uniform float lightMapIntensity;613-#endif`,Nge=`LambertMaterial material;613+#endif`,e1e=`LambertMaterial material;614614 material.diffuseColor = diffuseColor.rgb;615-material.specularStrength = specularStrength;`,Fge=`varying vec3 vViewPosition;615+material.specularStrength = specularStrength;`,t1e=`varying vec3 vViewPosition;616616 struct LambertMaterial {617617 vec3 diffuseColor;618618 float specularStrength;@@ -626,7 +626,7 @@ void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometr
626626 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );627627 }628628 #define RE_Direct RE_Direct_Lambert629-#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,Bge=`uniform bool receiveShadow;629+#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,n1e=`uniform bool receiveShadow;630630 uniform vec3 ambientLightColor;631631 #if defined( USE_LIGHT_PROBES )632632 uniform vec3 lightProbe[ 9 ];@@ -743,7 +743,7 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
743743 return irradiance;744744 }745745 #endif746-#include <lightprobes_pars_fragment>`,Oge=`#ifdef USE_ENVMAP746+#include <lightprobes_pars_fragment>`,i1e=`#ifdef USE_ENVMAP747747 vec3 getIBLIrradiance( const in vec3 normal ) {748748 #ifdef ENVMAP_TYPE_CUBE_UV749749 vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );@@ -776,8 +776,8 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
776776 #endif777777 }778778 #endif779-#endif`,Uge=`ToonMaterial material;780-material.diffuseColor = diffuseColor.rgb;`,kge=`varying vec3 vViewPosition;779+#endif`,r1e=`ToonMaterial material;780+material.diffuseColor = diffuseColor.rgb;`,s1e=`varying vec3 vViewPosition;781781 struct ToonMaterial {782782 vec3 diffuseColor;783783 };@@ -789,11 +789,11 @@ void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPo
789789 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );790790 }791791 #define RE_Direct RE_Direct_Toon792-#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,zge=`BlinnPhongMaterial material;792+#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,o1e=`BlinnPhongMaterial material;793793 material.diffuseColor = diffuseColor.rgb;794794 material.specularColor = specular;795795 material.specularShininess = shininess;796-material.specularStrength = specularStrength;`,Vge=`varying vec3 vViewPosition;796+material.specularStrength = specularStrength;`,a1e=`varying vec3 vViewPosition;797797 struct BlinnPhongMaterial {798798 vec3 diffuseColor;799799 vec3 specularColor;@@ -810,7 +810,7 @@ void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geom
810810 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );811811 }812812 #define RE_Direct RE_Direct_BlinnPhong813-#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,Gge=`PhysicalMaterial material;813+#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,l1e=`PhysicalMaterial material;814814 material.diffuseColor = diffuseColor.rgb;815815 material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );816816 material.metalness = metalnessFactor;@@ -900,7 +900,7 @@ material.roughness = min( material.roughness, 1.0 );
900900 material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );901901 material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;902902 material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;903-#endif`,qge=`uniform sampler2D dfgLUT;903+#endif`,c1e=`uniform sampler2D dfgLUT;904904 struct PhysicalMaterial {905905 vec3 diffuseColor;906906 vec3 diffuseContribution;@@ -1260,7 +1260,7 @@ void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradia
12601260 #define RE_IndirectSpecular RE_IndirectSpecular_Physical12611261 float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {12621262 return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );1263-}`,Hge=`1263+}`,u1e=`12641264 vec3 geometryPosition = - vViewPosition;12651265 vec3 geometryNormal = normal;12661266 vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );@@ -1382,7 +1382,7 @@ IncidentLight directLight;
13821382 #if defined( RE_IndirectSpecular )13831383 vec3 radiance = vec3( 0.0 );13841384 vec3 clearcoatRadiance = vec3( 0.0 );1385-#endif`,Wge=`#if defined( RE_IndirectDiffuse )1385+#endif`,h1e=`#if defined( RE_IndirectDiffuse )13861386 #ifdef USE_LIGHTMAP13871387 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );13881388 vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;@@ -1403,7 +1403,7 @@ IncidentLight directLight;
14031403 #ifdef USE_CLEARCOAT14041404 clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );14051405 #endif1406-#endif`,jge=`#if defined( RE_IndirectDiffuse )1406+#endif`,f1e=`#if defined( RE_IndirectDiffuse )14071407 #if defined( LAMBERT ) || defined( PHONG )14081408 irradiance += iblIrradiance;14091409 #endif@@ -1411,7 +1411,7 @@ IncidentLight directLight;
14111411 #endif14121412 #if defined( RE_IndirectSpecular )14131413 RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );1414-#endif`,Xge=`#ifdef USE_LIGHT_PROBES_GRID1414+#endif`,d1e=`#ifdef USE_LIGHT_PROBES_GRID14151415 uniform highp sampler3D probesSH;14161416 uniform vec3 probesMin;14171417 uniform vec3 probesMax;@@ -1456,27 +1456,27 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
14561456 result += c8 * 0.429043 * ( x * x - y * y );14571457 return max( result, vec3( 0.0 ) );14581458 }1459-#endif`,$ge=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )1459+#endif`,p1e=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )14601460 gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;1461-#endif`,Yge=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )1461+#endif`,m1e=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )14621462 uniform float logDepthBufFC;14631463 varying float vFragDepth;14641464 varying float vIsPerspective;1465-#endif`,Zge=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER1465+#endif`,A1e=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER14661466 varying float vFragDepth;14671467 varying float vIsPerspective;1468-#endif`,Kge=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER1468+#endif`,g1e=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER14691469 vFragDepth = 1.0 + gl_Position.w;14701470 vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );1471-#endif`,Qge=`#ifdef USE_MAP1471+#endif`,v1e=`#ifdef USE_MAP14721472 vec4 sampledDiffuseColor = texture2D( map, vMapUv );14731473 #ifdef DECODE_VIDEO_TEXTURE14741474 sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );14751475 #endif14761476 diffuseColor *= sampledDiffuseColor;1477-#endif`,Jge=`#ifdef USE_MAP1477+#endif`,_1e=`#ifdef USE_MAP14781478 uniform sampler2D map;1479-#endif`,e1e=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )1479+#endif`,x1e=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )14801480 #if defined( USE_POINTS_UV )14811481 vec2 uv = vUv;14821482 #else@@ -1488,7 +1488,7 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
14881488 #endif14891489 #ifdef USE_ALPHAMAP14901490 diffuseColor.a *= texture2D( alphaMap, uv ).g;1491-#endif`,t1e=`#if defined( USE_POINTS_UV )1491+#endif`,y1e=`#if defined( USE_POINTS_UV )14921492 varying vec2 vUv;14931493 #else14941494 #if defined( USE_MAP ) || defined( USE_ALPHAMAP )@@ -1500,19 +1500,19 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
15001500 #endif15011501 #ifdef USE_ALPHAMAP15021502 uniform sampler2D alphaMap;1503-#endif`,n1e=`float metalnessFactor = metalness;1503+#endif`,b1e=`float metalnessFactor = metalness;15041504 #ifdef USE_METALNESSMAP15051505 vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );15061506 metalnessFactor *= texelMetalness.b;1507-#endif`,i1e=`#ifdef USE_METALNESSMAP1507+#endif`,w1e=`#ifdef USE_METALNESSMAP15081508 uniform sampler2D metalnessMap;1509-#endif`,r1e=`#ifdef USE_INSTANCING_MORPH1509+#endif`,S1e=`#ifdef USE_INSTANCING_MORPH15101510 float morphTargetInfluences[ MORPHTARGETS_COUNT ];15111511 float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;15121512 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {15131513 morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;15141514 }1515-#endif`,s1e=`#if defined( USE_MORPHCOLORS )1515+#endif`,T1e=`#if defined( USE_MORPHCOLORS )15161516 vColor *= morphTargetBaseInfluence;15171517 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {15181518 #if defined( USE_COLOR_ALPHA )@@ -1521,12 +1521,12 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
15211521 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];15221522 #endif15231523 }1524-#endif`,o1e=`#ifdef USE_MORPHNORMALS1524+#endif`,E1e=`#ifdef USE_MORPHNORMALS15251525 objectNormal *= morphTargetBaseInfluence;15261526 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {15271527 if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];15281528 }1529-#endif`,a1e=`#ifdef USE_MORPHTARGETS1529+#endif`,M1e=`#ifdef USE_MORPHTARGETS15301530 #ifndef USE_INSTANCING_MORPH15311531 uniform float morphTargetBaseInfluence;15321532 uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];@@ -1540,12 +1540,12 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
15401540 ivec3 morphUV = ivec3( x, y, morphTargetIndex );15411541 return texelFetch( morphTargetsTexture, morphUV, 0 );15421542 }1543-#endif`,l1e=`#ifdef USE_MORPHTARGETS1543+#endif`,C1e=`#ifdef USE_MORPHTARGETS15441544 transformed *= morphTargetBaseInfluence;15451545 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {15461546 if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];15471547 }1548-#endif`,c1e=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;1548+#endif`,R1e=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;15491549 #ifdef FLAT_SHADED15501550 vec3 fdx = dFdx( vViewPosition );15511551 vec3 fdy = dFdy( vViewPosition );@@ -1586,7 +1586,7 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
15861586 tbn2[1] *= faceDirection;15871587 #endif15881588 #endif1589-vec3 nonPerturbedNormal = normal;`,u1e=`#ifdef USE_NORMALMAP_OBJECTSPACE1589+vec3 nonPerturbedNormal = normal;`,I1e=`#ifdef USE_NORMALMAP_OBJECTSPACE15901590 normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;15911591 #ifdef FLIP_SIDED15921592 normal = - normal;@@ -1604,19 +1604,19 @@ vec3 nonPerturbedNormal = normal;`,u1e=`#ifdef USE_NORMALMAP_OBJECTSPACE
16041604 normal = normalize( tbn * mapN );16051605 #elif defined( USE_BUMPMAP )16061606 normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );1607-#endif`,h1e=`#ifndef FLAT_SHADED1607+#endif`,P1e=`#ifndef FLAT_SHADED16081608 varying vec3 vNormal;16091609 #ifdef USE_TANGENT16101610 varying vec3 vTangent;16111611 varying vec3 vBitangent;16121612 #endif1613-#endif`,f1e=`#ifndef FLAT_SHADED1613+#endif`,L1e=`#ifndef FLAT_SHADED16141614 varying vec3 vNormal;16151615 #ifdef USE_TANGENT16161616 varying vec3 vTangent;16171617 varying vec3 vBitangent;16181618 #endif1619-#endif`,d1e=`#ifndef FLAT_SHADED1619+#endif`,D1e=`#ifndef FLAT_SHADED16201620 vNormal = normalize( transformedNormal );16211621 #ifdef USE_TANGENT16221622 vTangent = normalize( transformedTangent );@@ -1625,7 +1625,7 @@ vec3 nonPerturbedNormal = normal;`,u1e=`#ifdef USE_NORMALMAP_OBJECTSPACE
16251625 vBitangent = - vBitangent;16261626 #endif16271627 #endif1628-#endif`,p1e=`#ifdef USE_NORMALMAP1628+#endif`,N1e=`#ifdef USE_NORMALMAP16291629 uniform sampler2D normalMap;16301630 uniform vec2 normalScale;16311631 #endif@@ -1647,13 +1647,13 @@ vec3 nonPerturbedNormal = normal;`,u1e=`#ifdef USE_NORMALMAP_OBJECTSPACE
16471647 float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );16481648 return mat3( T * scale, B * scale, N );16491649 }1650-#endif`,m1e=`#ifdef USE_CLEARCOAT1650+#endif`,F1e=`#ifdef USE_CLEARCOAT16511651 vec3 clearcoatNormal = nonPerturbedNormal;1652-#endif`,A1e=`#ifdef USE_CLEARCOAT_NORMALMAP1652+#endif`,B1e=`#ifdef USE_CLEARCOAT_NORMALMAP16531653 vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;16541654 clearcoatMapN.xy *= clearcoatNormalScale;16551655 clearcoatNormal = normalize( tbn2 * clearcoatMapN );1656-#endif`,g1e=`#ifdef USE_CLEARCOATMAP1656+#endif`,O1e=`#ifdef USE_CLEARCOATMAP16571657 uniform sampler2D clearcoatMap;16581658 #endif16591659 #ifdef USE_CLEARCOAT_NORMALMAP@@ -1662,18 +1662,18 @@ vec3 nonPerturbedNormal = normal;`,u1e=`#ifdef USE_NORMALMAP_OBJECTSPACE
16621662 #endif16631663 #ifdef USE_CLEARCOAT_ROUGHNESSMAP16641664 uniform sampler2D clearcoatRoughnessMap;1665-#endif`,v1e=`#ifdef USE_IRIDESCENCEMAP1665+#endif`,U1e=`#ifdef USE_IRIDESCENCEMAP16661666 uniform sampler2D iridescenceMap;16671667 #endif16681668 #ifdef USE_IRIDESCENCE_THICKNESSMAP16691669 uniform sampler2D iridescenceThicknessMap;1670-#endif`,_1e=`#ifdef OPAQUE1670+#endif`,k1e=`#ifdef OPAQUE16711671 diffuseColor.a = 1.0;16721672 #endif16731673 #ifdef USE_TRANSMISSION16741674 diffuseColor.a *= material.transmissionAlpha;16751675 #endif1676-gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,x1e=`vec3 packNormalToRGB( const in vec3 normal ) {1676+gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,z1e=`vec3 packNormalToRGB( const in vec3 normal ) {16771677 return normalize( normal ) * 0.5 + 0.5;16781678 }16791679 vec3 unpackRGBToNormal( const in vec3 rgb ) {@@ -1752,9 +1752,9 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const
17521752 #else17531753 return ( near * far ) / ( ( far - near ) * depth - far );17541754 #endif1755-}`,y1e=`#ifdef PREMULTIPLIED_ALPHA1755+}`,V1e=`#ifdef PREMULTIPLIED_ALPHA17561756 gl_FragColor.rgb *= gl_FragColor.a;1757-#endif`,b1e=`vec4 mvPosition = vec4( transformed, 1.0 );1757+#endif`,G1e=`vec4 mvPosition = vec4( transformed, 1.0 );17581758 #ifdef USE_BATCHING17591759 mvPosition = batchingMatrix * mvPosition;17601760 #endif@@ -1762,22 +1762,22 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const
17621762 mvPosition = instanceMatrix * mvPosition;17631763 #endif17641764 mvPosition = modelViewMatrix * mvPosition;1765-gl_Position = projectionMatrix * mvPosition;`,w1e=`#ifdef DITHERING1765+gl_Position = projectionMatrix * mvPosition;`,q1e=`#ifdef DITHERING17661766 gl_FragColor.rgb = dithering( gl_FragColor.rgb );1767-#endif`,S1e=`#ifdef DITHERING1767+#endif`,H1e=`#ifdef DITHERING17681768 vec3 dithering( vec3 color ) {17691769 float grid_position = rand( gl_FragCoord.xy );17701770 vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );17711771 dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );17721772 return color + dither_shift_RGB;17731773 }1774-#endif`,T1e=`float roughnessFactor = roughness;1774+#endif`,W1e=`float roughnessFactor = roughness;17751775 #ifdef USE_ROUGHNESSMAP17761776 vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );17771777 roughnessFactor *= texelRoughness.g;1778-#endif`,E1e=`#ifdef USE_ROUGHNESSMAP1778+#endif`,j1e=`#ifdef USE_ROUGHNESSMAP17791779 uniform sampler2D roughnessMap;1780-#endif`,M1e=`#if NUM_SPOT_LIGHT_COORDS > 01780+#endif`,X1e=`#if NUM_SPOT_LIGHT_COORDS > 017811781 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];17821782 #endif17831783 #if NUM_SPOT_LIGHT_MAPS > 0@@ -1977,7 +1977,7 @@ gl_Position = projectionMatrix * mvPosition;`,w1e=`#ifdef DITHERING
19771977 }19781978 #endif19791979 #endif1980-#endif`,C1e=`#if NUM_SPOT_LIGHT_COORDS > 01980+#endif`,$1e=`#if NUM_SPOT_LIGHT_COORDS > 019811981 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];19821982 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];19831983 #endif@@ -2018,7 +2018,7 @@ gl_Position = projectionMatrix * mvPosition;`,w1e=`#ifdef DITHERING
20182018 };20192019 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];20202020 #endif2021-#endif`,R1e=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )2021+#endif`,Y1e=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )20222022 #ifdef HAS_NORMAL20232023 vec3 shadowWorldNormal = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix );20242024 #else@@ -2054,7 +2054,7 @@ gl_Position = projectionMatrix * mvPosition;`,w1e=`#ifdef DITHERING
20542054 vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;20552055 }20562056 #pragma unroll_loop_end2057-#endif`,I1e=`float getShadowMask() {2057+#endif`,Z1e=`float getShadowMask() {20582058 float shadow = 1.0;20592059 #ifdef USE_SHADOWMAP20602060 #if NUM_DIR_LIGHT_SHADOWS > 0@@ -2086,12 +2086,12 @@ gl_Position = projectionMatrix * mvPosition;`,w1e=`#ifdef DITHERING
20862086 #endif20872087 #endif20882088 return shadow;2089-}`,P1e=`#ifdef USE_SKINNING2089+}`,K1e=`#ifdef USE_SKINNING20902090 mat4 boneMatX = getBoneMatrix( skinIndex.x );20912091 mat4 boneMatY = getBoneMatrix( skinIndex.y );20922092 mat4 boneMatZ = getBoneMatrix( skinIndex.z );20932093 mat4 boneMatW = getBoneMatrix( skinIndex.w );2094-#endif`,L1e=`#ifdef USE_SKINNING2094+#endif`,Q1e=`#ifdef USE_SKINNING20952095 uniform mat4 bindMatrix;20962096 uniform mat4 bindMatrixInverse;20972097 uniform highp sampler2D boneTexture;@@ -2106,7 +2106,7 @@ gl_Position = projectionMatrix * mvPosition;`,w1e=`#ifdef DITHERING
21062106 vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );21072107 return mat4( v1, v2, v3, v4 );21082108 }2109-#endif`,D1e=`#ifdef USE_SKINNING2109+#endif`,J1e=`#ifdef USE_SKINNING21102110 vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );21112111 vec4 skinned = vec4( 0.0 );21122112 skinned += boneMatX * skinVertex * skinWeight.x;@@ -2114,7 +2114,7 @@ gl_Position = projectionMatrix * mvPosition;`,w1e=`#ifdef DITHERING
21142114 skinned += boneMatZ * skinVertex * skinWeight.z;21152115 skinned += boneMatW * skinVertex * skinWeight.w;21162116 transformed = ( bindMatrixInverse * skinned ).xyz;2117-#endif`,N1e=`#ifdef USE_SKINNING2117+#endif`,eve=`#ifdef USE_SKINNING21182118 mat4 skinMatrix = mat4( 0.0 );21192119 skinMatrix += skinWeight.x * boneMatX;21202120 skinMatrix += skinWeight.y * boneMatY;@@ -2125,17 +2125,17 @@ gl_Position = projectionMatrix * mvPosition;`,w1e=`#ifdef DITHERING
21252125 #ifdef USE_TANGENT21262126 objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;21272127 #endif2128-#endif`,F1e=`float specularStrength;2128+#endif`,tve=`float specularStrength;21292129 #ifdef USE_SPECULARMAP21302130 vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );21312131 specularStrength = texelSpecular.r;21322132 #else21332133 specularStrength = 1.0;2134-#endif`,B1e=`#ifdef USE_SPECULARMAP2134+#endif`,nve=`#ifdef USE_SPECULARMAP21352135 uniform sampler2D specularMap;2136-#endif`,O1e=`#if defined( TONE_MAPPING )2136+#endif`,ive=`#if defined( TONE_MAPPING )21372137 gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );2138-#endif`,U1e=`#ifndef saturate2138+#endif`,rve=`#ifndef saturate21392139 #define saturate( a ) clamp( a, 0.0, 1.0 )21402140 #endif21412141 uniform float toneMappingExposure;@@ -2232,7 +2232,7 @@ vec3 NeutralToneMapping( vec3 color ) {
22322232 float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );22332233 return mix( color, vec3( newPeak ), g );22342234 }2235-vec3 CustomToneMapping( vec3 color ) { return color; }`,k1e=`#ifdef USE_TRANSMISSION2235+vec3 CustomToneMapping( vec3 color ) { return color; }`,sve=`#ifdef USE_TRANSMISSION22362236 material.transmission = transmission;22372237 material.transmissionAlpha = 1.0;22382238 material.thickness = thickness;@@ -2253,7 +2253,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,k1e=`#ifdef USE_TRANSMIS
22532253 material.attenuationColor, material.attenuationDistance );22542254 material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );22552255 totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );2256-#endif`,z1e=`#ifdef USE_TRANSMISSION2256+#endif`,ove=`#ifdef USE_TRANSMISSION22572257 uniform float transmission;22582258 uniform float thickness;22592259 uniform float attenuationDistance;@@ -2379,7 +2379,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,k1e=`#ifdef USE_TRANSMIS
23792379 float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;23802380 return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );23812381 }2382-#endif`,V1e=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )2382+#endif`,ave=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )23832383 varying vec2 vUv;23842384 #endif23852385 #ifdef USE_MAP@@ -2449,7 +2449,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,k1e=`#ifdef USE_TRANSMIS
24492449 #ifdef USE_THICKNESSMAP24502450 uniform mat3 thicknessMapTransform;24512451 varying vec2 vThicknessMapUv;2452-#endif`,G1e=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )2452+#endif`,lve=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )24532453 varying vec2 vUv;24542454 #endif24552455 #ifdef USE_MAP@@ -2543,7 +2543,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,k1e=`#ifdef USE_TRANSMIS
25432543 #ifdef USE_THICKNESSMAP25442544 uniform mat3 thicknessMapTransform;25452545 varying vec2 vThicknessMapUv;2546-#endif`,q1e=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )2546+#endif`,cve=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )25472547 vUv = vec3( uv, 1 ).xy;25482548 #endif25492549 #ifdef USE_MAP@@ -2614,7 +2614,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,k1e=`#ifdef USE_TRANSMIS
26142614 #endif26152615 #ifdef USE_THICKNESSMAP26162616 vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;2617-#endif`,H1e=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 02617+#endif`,uve=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 026182618 vec4 worldPosition = vec4( transformed, 1.0 );26192619 #ifdef USE_BATCHING26202620 worldPosition = batchingMatrix * worldPosition;@@ -2623,12 +2623,12 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,k1e=`#ifdef USE_TRANSMIS
26232623 worldPosition = instanceMatrix * worldPosition;26242624 #endif26252625 worldPosition = modelMatrix * worldPosition;2626-#endif`,W1e=`varying vec2 vUv;2626+#endif`,hve=`varying vec2 vUv;26272627 uniform mat3 uvTransform;26282628 void main() {26292629 vUv = ( uvTransform * vec3( uv, 1 ) ).xy;26302630 gl_Position = vec4( position.xy, 1.0, 1.0 );2631-}`,j1e=`uniform sampler2D t2D;2631+}`,fve=`uniform sampler2D t2D;26322632 uniform float backgroundIntensity;26332633 varying vec2 vUv;26342634 void main() {@@ -2640,14 +2640,14 @@ void main() {
26402640 gl_FragColor = texColor;26412641 #include <tonemapping_fragment>26422642 #include <colorspace_fragment>2643-}`,X1e=`varying vec3 vWorldDirection;2643+}`,dve=`varying vec3 vWorldDirection;26442644 #include <common>26452645 void main() {26462646 vWorldDirection = transformDirection( position, modelMatrix );26472647 #include <begin_vertex>26482648 #include <project_vertex>26492649 gl_Position.z = gl_Position.w;2650-}`,$1e=`#ifdef ENVMAP_TYPE_CUBE2650+}`,pve=`#ifdef ENVMAP_TYPE_CUBE26512651 uniform samplerCube envMap;26522652 #elif defined( ENVMAP_TYPE_CUBE_UV )26532653 uniform sampler2D envMap;@@ -2669,14 +2669,14 @@ void main() {
26692669 gl_FragColor = texColor;26702670 #include <tonemapping_fragment>26712671 #include <colorspace_fragment>2672-}`,Y1e=`varying vec3 vWorldDirection;2672+}`,mve=`varying vec3 vWorldDirection;26732673 #include <common>26742674 void main() {26752675 vWorldDirection = transformDirection( position, modelMatrix );26762676 #include <begin_vertex>26772677 #include <project_vertex>26782678 gl_Position.z = gl_Position.w;2679-}`,Z1e=`uniform samplerCube tCube;2679+}`,Ave=`uniform samplerCube tCube;26802680 uniform float tFlip;26812681 uniform float opacity;26822682 varying vec3 vWorldDirection;@@ -2686,7 +2686,7 @@ void main() {
26862686 gl_FragColor.a *= opacity;26872687 #include <tonemapping_fragment>26882688 #include <colorspace_fragment>2689-}`,K1e=`#include <common>2689+}`,gve=`#include <common>26902690 #include <batching_pars_vertex>26912691 #include <uv_pars_vertex>26922692 #include <displacementmap_pars_vertex>@@ -2713,7 +2713,7 @@ void main() {
27132713 #include <logdepthbuf_vertex>27142714 #include <clipping_planes_vertex>27152715 vHighPrecisionZW = gl_Position.zw;2716-}`,Q1e=`#if DEPTH_PACKING == 32002716+}`,vve=`#if DEPTH_PACKING == 320027172717 uniform float opacity;27182718 #endif27192719 #include <common>@@ -2751,7 +2751,7 @@ void main() {
27512751 #elif DEPTH_PACKING == 320327522752 gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );27532753 #endif2754-}`,J1e=`#define DISTANCE2754+}`,_ve=`#define DISTANCE27552755 varying vec3 vWorldPosition;27562756 #include <common>27572757 #include <batching_pars_vertex>@@ -2778,7 +2778,7 @@ void main() {
27782778 #include <worldpos_vertex>27792779 #include <clipping_planes_vertex>27802780 vWorldPosition = worldPosition.xyz;2781-}`,eve=`#define DISTANCE2781+}`,xve=`#define DISTANCE27822782 uniform vec3 referencePosition;27832783 uniform float nearDistance;27842784 uniform float farDistance;@@ -2801,13 +2801,13 @@ void main() {
28012801 dist = ( dist - nearDistance ) / ( farDistance - nearDistance );28022802 dist = saturate( dist );28032803 gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );2804-}`,tve=`varying vec3 vWorldDirection;2804+}`,yve=`varying vec3 vWorldDirection;28052805 #include <common>28062806 void main() {28072807 vWorldDirection = transformDirection( position, modelMatrix );28082808 #include <begin_vertex>28092809 #include <project_vertex>2810-}`,nve=`uniform sampler2D tEquirect;2810+}`,bve=`uniform sampler2D tEquirect;28112811 varying vec3 vWorldDirection;28122812 #include <common>28132813 void main() {@@ -2816,7 +2816,7 @@ void main() {
28162816 gl_FragColor = texture2D( tEquirect, sampleUV );28172817 #include <tonemapping_fragment>28182818 #include <colorspace_fragment>2819-}`,ive=`uniform float scale;2819+}`,wve=`uniform float scale;28202820 attribute float lineDistance;28212821 varying float vLineDistance;28222822 #include <common>@@ -2838,7 +2838,7 @@ void main() {
28382838 #include <logdepthbuf_vertex>28392839 #include <clipping_planes_vertex>28402840 #include <fog_vertex>2841-}`,rve=`uniform vec3 diffuse;2841+}`,Sve=`uniform vec3 diffuse;28422842 uniform float opacity;28432843 uniform float dashSize;28442844 uniform float totalSize;@@ -2866,7 +2866,7 @@ void main() {
28662866 #include <colorspace_fragment>28672867 #include <fog_fragment>28682868 #include <premultiplied_alpha_fragment>2869-}`,sve=`#include <common>2869+}`,Tve=`#include <common>28702870 #include <batching_pars_vertex>28712871 #include <uv_pars_vertex>28722872 #include <envmap_pars_vertex>@@ -2898,7 +2898,7 @@ void main() {
28982898 #include <worldpos_vertex>28992899 #include <envmap_vertex>29002900 #include <fog_vertex>2901-}`,ove=`uniform vec3 diffuse;2901+}`,Eve=`uniform vec3 diffuse;29022902 uniform float opacity;29032903 #ifndef FLAT_SHADED29042904 varying vec3 vNormal;@@ -2946,7 +2946,7 @@ void main() {
29462946 #include <fog_fragment>29472947 #include <premultiplied_alpha_fragment>29482948 #include <dithering_fragment>2949-}`,ave=`#define LAMBERT2949+}`,Mve=`#define LAMBERT29502950 varying vec3 vViewPosition;29512951 #include <common>29522952 #include <batching_pars_vertex>@@ -2985,7 +2985,7 @@ void main() {
29852985 #include <envmap_vertex>29862986 #include <shadowmap_vertex>29872987 #include <fog_vertex>2988-}`,lve=`#define LAMBERT2988+}`,Cve=`#define LAMBERT29892989 uniform vec3 diffuse;29902990 uniform vec3 emissive;29912991 uniform float opacity;@@ -3043,7 +3043,7 @@ void main() {
30433043 #include <fog_fragment>30443044 #include <premultiplied_alpha_fragment>30453045 #include <dithering_fragment>3046-}`,cve=`#define MATCAP3046+}`,Rve=`#define MATCAP30473047 varying vec3 vViewPosition;30483048 #include <common>30493049 #include <batching_pars_vertex>@@ -3077,7 +3077,7 @@ void main() {
30773077 #include <clipping_planes_vertex>30783078 #include <fog_vertex>30793079 vViewPosition = - mvPosition.xyz;3080-}`,uve=`#define MATCAP3080+}`,Ive=`#define MATCAP30813081 uniform vec3 diffuse;30823082 uniform float opacity;30833083 uniform sampler2D matcap;@@ -3123,7 +3123,7 @@ void main() {
31233123 #include <fog_fragment>31243124 #include <premultiplied_alpha_fragment>31253125 #include <dithering_fragment>3126-}`,hve=`#define NORMAL3126+}`,Pve=`#define NORMAL31273127 #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )31283128 varying vec3 vViewPosition;31293129 #endif@@ -3156,7 +3156,7 @@ void main() {
31563156 #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )31573157 vViewPosition = - mvPosition.xyz;31583158 #endif3159-}`,fve=`#define NORMAL3159+}`,Lve=`#define NORMAL31603160 uniform float opacity;31613161 #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )31623162 varying vec3 vViewPosition;@@ -3177,7 +3177,7 @@ void main() {
31773177 #ifdef OPAQUE31783178 gl_FragColor.a = 1.0;31793179 #endif3180-}`,dve=`#define PHONG3180+}`,Dve=`#define PHONG31813181 varying vec3 vViewPosition;31823182 #include <common>31833183 #include <batching_pars_vertex>@@ -3216,7 +3216,7 @@ void main() {
32163216 #include <envmap_vertex>32173217 #include <shadowmap_vertex>32183218 #include <fog_vertex>3219-}`,pve=`#define PHONG3219+}`,Nve=`#define PHONG32203220 uniform vec3 diffuse;32213221 uniform vec3 emissive;32223222 uniform vec3 specular;@@ -3276,7 +3276,7 @@ void main() {
32763276 #include <fog_fragment>32773277 #include <premultiplied_alpha_fragment>32783278 #include <dithering_fragment>3279-}`,mve=`#define STANDARD3279+}`,Fve=`#define STANDARD32803280 varying vec3 vViewPosition;32813281 #ifdef USE_TRANSMISSION32823282 varying vec3 vWorldPosition;@@ -3319,7 +3319,7 @@ void main() {
33193319 #ifdef USE_TRANSMISSION33203320 vWorldPosition = worldPosition.xyz;33213321 #endif3322-}`,Ave=`#define STANDARD3322+}`,Bve=`#define STANDARD33233323 #ifdef PHYSICAL33243324 #define IOR33253325 #define USE_SPECULAR@@ -3444,7 +3444,7 @@ void main() {
34443444 #include <fog_fragment>34453445 #include <premultiplied_alpha_fragment>34463446 #include <dithering_fragment>3447-}`,gve=`#define TOON3447+}`,Ove=`#define TOON34483448 varying vec3 vViewPosition;34493449 #include <common>34503450 #include <batching_pars_vertex>@@ -3481,7 +3481,7 @@ void main() {
34813481 #include <worldpos_vertex>34823482 #include <shadowmap_vertex>34833483 #include <fog_vertex>3484-}`,vve=`#define TOON3484+}`,Uve=`#define TOON34853485 uniform vec3 diffuse;34863486 uniform vec3 emissive;34873487 uniform float opacity;@@ -3533,7 +3533,7 @@ void main() {
35333533 #include <fog_fragment>35343534 #include <premultiplied_alpha_fragment>35353535 #include <dithering_fragment>3536-}`,_ve=`uniform float size;3536+}`,kve=`uniform float size;35373537 uniform float scale;35383538 #include <common>35393539 #include <color_pars_vertex>@@ -3564,7 +3564,7 @@ void main() {
35643564 #include <clipping_planes_vertex>35653565 #include <worldpos_vertex>35663566 #include <fog_vertex>3567-}`,xve=`uniform vec3 diffuse;3567+}`,zve=`uniform vec3 diffuse;35683568 uniform float opacity;35693569 #include <common>35703570 #include <color_pars_fragment>@@ -3589,7 +3589,7 @@ void main() {
35893589 #include <colorspace_fragment>35903590 #include <fog_fragment>35913591 #include <premultiplied_alpha_fragment>3592-}`,yve=`#include <common>3592+}`,Vve=`#include <common>35933593 #include <batching_pars_vertex>35943594 #include <fog_pars_vertex>35953595 #include <morphtarget_pars_vertex>@@ -3612,7 +3612,7 @@ void main() {
36123612 #include <worldpos_vertex>36133613 #include <shadowmap_vertex>36143614 #include <fog_vertex>3615-}`,bve=`uniform vec3 color;3615+}`,Gve=`uniform vec3 color;36163616 uniform float opacity;36173617 #include <common>36183618 #include <fog_pars_fragment>@@ -3628,7 +3628,7 @@ void main() {
36283628 #include <colorspace_fragment>36293629 #include <fog_fragment>36303630 #include <premultiplied_alpha_fragment>3631-}`,wve=`uniform float rotation;3631+}`,qve=`uniform float rotation;36323632 uniform vec2 center;36333633 #include <common>36343634 #include <uv_pars_vertex>@@ -3652,7 +3652,7 @@ void main() {
36523652 #include <logdepthbuf_vertex>36533653 #include <clipping_planes_vertex>36543654 #include <fog_vertex>3655-}`,Sve=`uniform vec3 diffuse;3655+}`,Hve=`uniform vec3 diffuse;36563656 uniform float opacity;36573657 #include <common>36583658 #include <uv_pars_fragment>@@ -3677,7 +3677,7 @@ void main() {
36773677 #include <tonemapping_fragment>36783678 #include <colorspace_fragment>36793679 #include <fog_fragment>3680-}`,kn={alphahash_fragment:WAe,alphahash_pars_fragment:jAe,alphamap_fragment:XAe,alphamap_pars_fragment:$Ae,alphatest_fragment:YAe,alphatest_pars_fragment:ZAe,aomap_fragment:KAe,aomap_pars_fragment:QAe,batching_pars_vertex:JAe,batching_vertex:ege,begin_vertex:tge,beginnormal_vertex:nge,bsdfs:ige,iridescence_fragment:rge,bumpmap_pars_fragment:sge,clipping_planes_fragment:oge,clipping_planes_pars_fragment:age,clipping_planes_pars_vertex:lge,clipping_planes_vertex:cge,color_fragment:uge,color_pars_fragment:hge,color_pars_vertex:fge,color_vertex:dge,common:pge,cube_uv_reflection_fragment:mge,defaultnormal_vertex:Age,displacementmap_pars_vertex:gge,displacementmap_vertex:vge,emissivemap_fragment:_ge,emissivemap_pars_fragment:xge,colorspace_fragment:yge,colorspace_pars_fragment:bge,envmap_fragment:wge,envmap_common_pars_fragment:Sge,envmap_pars_fragment:Tge,envmap_pars_vertex:Ege,envmap_physical_pars_fragment:Oge,envmap_vertex:Mge,fog_vertex:Cge,fog_pars_vertex:Rge,fog_fragment:Ige,fog_pars_fragment:Pge,gradientmap_pars_fragment:Lge,lightmap_pars_fragment:Dge,lights_lambert_fragment:Nge,lights_lambert_pars_fragment:Fge,lights_pars_begin:Bge,lights_toon_fragment:Uge,lights_toon_pars_fragment:kge,lights_phong_fragment:zge,lights_phong_pars_fragment:Vge,lights_physical_fragment:Gge,lights_physical_pars_fragment:qge,lights_fragment_begin:Hge,lights_fragment_maps:Wge,lights_fragment_end:jge,lightprobes_pars_fragment:Xge,logdepthbuf_fragment:$ge,logdepthbuf_pars_fragment:Yge,logdepthbuf_pars_vertex:Zge,logdepthbuf_vertex:Kge,map_fragment:Qge,map_pars_fragment:Jge,map_particle_fragment:e1e,map_particle_pars_fragment:t1e,metalnessmap_fragment:n1e,metalnessmap_pars_fragment:i1e,morphinstance_vertex:r1e,morphcolor_vertex:s1e,morphnormal_vertex:o1e,morphtarget_pars_vertex:a1e,morphtarget_vertex:l1e,normal_fragment_begin:c1e,normal_fragment_maps:u1e,normal_pars_fragment:h1e,normal_pars_vertex:f1e,normal_vertex:d1e,normalmap_pars_fragment:p1e,clearcoat_normal_fragment_begin:m1e,clearcoat_normal_fragment_maps:A1e,clearcoat_pars_fragment:g1e,iridescence_pars_fragment:v1e,opaque_fragment:_1e,packing:x1e,premultiplied_alpha_fragment:y1e,project_vertex:b1e,dithering_fragment:w1e,dithering_pars_fragment:S1e,roughnessmap_fragment:T1e,roughnessmap_pars_fragment:E1e,shadowmap_pars_fragment:M1e,shadowmap_pars_vertex:C1e,shadowmap_vertex:R1e,shadowmask_pars_fragment:I1e,skinbase_vertex:P1e,skinning_pars_vertex:L1e,skinning_vertex:D1e,skinnormal_vertex:N1e,specularmap_fragment:F1e,specularmap_pars_fragment:B1e,tonemapping_fragment:O1e,tonemapping_pars_fragment:U1e,transmission_fragment:k1e,transmission_pars_fragment:z1e,uv_pars_fragment:V1e,uv_pars_vertex:G1e,uv_vertex:q1e,worldpos_vertex:H1e,background_vert:W1e,background_frag:j1e,backgroundCube_vert:X1e,backgroundCube_frag:$1e,cube_vert:Y1e,cube_frag:Z1e,depth_vert:K1e,depth_frag:Q1e,distance_vert:J1e,distance_frag:eve,equirect_vert:tve,equirect_frag:nve,linedashed_vert:ive,linedashed_frag:rve,meshbasic_vert:sve,meshbasic_frag:ove,meshlambert_vert:ave,meshlambert_frag:lve,meshmatcap_vert:cve,meshmatcap_frag:uve,meshnormal_vert:hve,meshnormal_frag:fve,meshphong_vert:dve,meshphong_frag:pve,meshphysical_vert:mve,meshphysical_frag:Ave,meshtoon_vert:gve,meshtoon_frag:vve,points_vert:_ve,points_frag:xve,shadow_vert:yve,shadow_frag:bve,sprite_vert:wve,sprite_frag:Sve},Nt={common:{diffuse:{value:new zt(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Mn},alphaMap:{value:null},alphaMapTransform:{value:new Mn},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Mn}},envmap:{envMap:{value:null},envMapRotation:{value:new Mn},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Mn}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Mn}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Mn},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Mn},normalScale:{value:new Oe(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Mn},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Mn}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Mn}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Mn}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new zt(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null},probesSH:{value:null},probesMin:{value:new re},probesMax:{value:new re},probesResolution:{value:new re}},points:{diffuse:{value:new zt(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Mn},alphaTest:{value:0},uvTransform:{value:new Mn}},sprite:{diffuse:{value:new zt(16777215)},opacity:{value:1},center:{value:new Oe(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Mn},alphaMap:{value:null},alphaMapTransform:{value:new Mn},alphaTest:{value:0}}},qa={basic:{uniforms:ha([Nt.common,Nt.specularmap,Nt.envmap,Nt.aomap,Nt.lightmap,Nt.fog]),vertexShader:kn.meshbasic_vert,fragmentShader:kn.meshbasic_frag},lambert:{uniforms:ha([Nt.common,Nt.specularmap,Nt.envmap,Nt.aomap,Nt.lightmap,Nt.emissivemap,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,Nt.fog,Nt.lights,{emissive:{value:new zt(0)},envMapIntensity:{value:1}}]),vertexShader:kn.meshlambert_vert,fragmentShader:kn.meshlambert_frag},phong:{uniforms:ha([Nt.common,Nt.specularmap,Nt.envmap,Nt.aomap,Nt.lightmap,Nt.emissivemap,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,Nt.fog,Nt.lights,{emissive:{value:new zt(0)},specular:{value:new zt(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:kn.meshphong_vert,fragmentShader:kn.meshphong_frag},standard:{uniforms:ha([Nt.common,Nt.envmap,Nt.aomap,Nt.lightmap,Nt.emissivemap,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,Nt.roughnessmap,Nt.metalnessmap,Nt.fog,Nt.lights,{emissive:{value:new zt(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:kn.meshphysical_vert,fragmentShader:kn.meshphysical_frag},toon:{uniforms:ha([Nt.common,Nt.aomap,Nt.lightmap,Nt.emissivemap,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,Nt.gradientmap,Nt.fog,Nt.lights,{emissive:{value:new zt(0)}}]),vertexShader:kn.meshtoon_vert,fragmentShader:kn.meshtoon_frag},matcap:{uniforms:ha([Nt.common,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,Nt.fog,{matcap:{value:null}}]),vertexShader:kn.meshmatcap_vert,fragmentShader:kn.meshmatcap_frag},points:{uniforms:ha([Nt.points,Nt.fog]),vertexShader:kn.points_vert,fragmentShader:kn.points_frag},dashed:{uniforms:ha([Nt.common,Nt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:kn.linedashed_vert,fragmentShader:kn.linedashed_frag},depth:{uniforms:ha([Nt.common,Nt.displacementmap]),vertexShader:kn.depth_vert,fragmentShader:kn.depth_frag},normal:{uniforms:ha([Nt.common,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,{opacity:{value:1}}]),vertexShader:kn.meshnormal_vert,fragmentShader:kn.meshnormal_frag},sprite:{uniforms:ha([Nt.sprite,Nt.fog]),vertexShader:kn.sprite_vert,fragmentShader:kn.sprite_frag},background:{uniforms:{uvTransform:{value:new Mn},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:kn.background_vert,fragmentShader:kn.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Mn}},vertexShader:kn.backgroundCube_vert,fragmentShader:kn.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:kn.cube_vert,fragmentShader:kn.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:kn.equirect_vert,fragmentShader:kn.equirect_frag},distance:{uniforms:ha([Nt.common,Nt.displacementmap,{referencePosition:{value:new re},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:kn.distance_vert,fragmentShader:kn.distance_frag},shadow:{uniforms:ha([Nt.lights,Nt.fog,{color:{value:new zt(0)},opacity:{value:1}}]),vertexShader:kn.shadow_vert,fragmentShader:kn.shadow_frag}};qa.physical={uniforms:ha([qa.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Mn},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Mn},clearcoatNormalScale:{value:new Oe(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Mn},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Mn},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Mn},sheen:{value:0},sheenColor:{value:new zt(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Mn},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Mn},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Mn},transmissionSamplerSize:{value:new Oe},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Mn},attenuationDistance:{value:0},attenuationColor:{value:new zt(0)},specularColor:{value:new zt(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Mn},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Mn},anisotropyVector:{value:new Oe},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Mn}}]),vertexShader:kn.meshphysical_vert,fragmentShader:kn.meshphysical_frag};var kM={r:0,b:0,g:0},Tve=new cn,YZ=new Mn;YZ.set(-1,0,0,0,1,0,0,0,1);function Eve(i,e,t,n,r,s){let o=new zt(0),a=r===!0?0:1,l,c,u=null,f=0,d=null;function A(R){let P=R.isScene===!0?R.background:null;if(P&&P.isTexture){let I=R.backgroundBlurriness>0;P=e.get(P,I)}return P}function y(R){let P=!1,I=A(R);I===null?S(o,a):I&&I.isColor&&(S(I,1),P=!0);let F=i.xr.getEnvironmentBlendMode();F==="additive"?t.buffers.color.setClear(0,0,0,1,s):F==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,s),(i.autoClear||P)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil))}function w(R,P){let I=A(P);I&&(I.isCubeTexture||I.mapping===Uh)?(c===void 0&&(c=new Hn(new Lu(1,1,1),new ds({name:"BackgroundCubeMaterial",uniforms:pg(qa.backgroundCube.uniforms),vertexShader:qa.backgroundCube.vertexShader,fragmentShader:qa.backgroundCube.fragmentShader,side:mi,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(F,D,L){this.matrixWorld.copyPosition(L.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(c)),c.material.uniforms.envMap.value=I,c.material.uniforms.backgroundBlurriness.value=P.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=P.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(Tve.makeRotationFromEuler(P.backgroundRotation)).transpose(),I.isCubeTexture&&I.isRenderTargetTexture===!1&&c.material.uniforms.backgroundRotation.value.premultiply(YZ),c.material.toneMapped=ln.getTransfer(I.colorSpace)!==kt,(u!==I||f!==I.version||d!==i.toneMapping)&&(c.material.needsUpdate=!0,u=I,f=I.version,d=i.toneMapping),c.layers.enableAll(),R.unshift(c,c.geometry,c.material,0,0,null)):I&&I.isTexture&&(l===void 0&&(l=new Hn(new KA(2,2),new ds({name:"BackgroundMaterial",uniforms:pg(qa.background.uniforms),vertexShader:qa.background.vertexShader,fragmentShader:qa.background.fragmentShader,side:ko,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(l)),l.material.uniforms.t2D.value=I,l.material.uniforms.backgroundIntensity.value=P.backgroundIntensity,l.material.toneMapped=ln.getTransfer(I.colorSpace)!==kt,I.matrixAutoUpdate===!0&&I.updateMatrix(),l.material.uniforms.uvTransform.value.copy(I.matrix),(u!==I||f!==I.version||d!==i.toneMapping)&&(l.material.needsUpdate=!0,u=I,f=I.version,d=i.toneMapping),l.layers.enableAll(),R.unshift(l,l.geometry,l.material,0,0,null))}function S(R,P){R.getRGB(kM,oF(i)),t.buffers.color.setClear(kM.r,kM.g,kM.b,P,s)}function T(){c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0),l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}return{getClearColor:function(){return o},setClearColor:function(R,P=1){o.set(R),a=P,S(o,a)},getClearAlpha:function(){return a},setClearAlpha:function(R){a=R,S(o,a)},render:y,addToRenderList:w,dispose:T}}function Mve(i,e){let t=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},r=d(null),s=r,o=!1;function a(z,G,W,Y,H){let $=!1,J=f(z,Y,W,G);s!==J&&(s=J,c(s.object)),$=A(z,Y,W,H),$&&y(z,Y,W,H),H!==null&&e.update(H,i.ELEMENT_ARRAY_BUFFER),($||o)&&(o=!1,I(z,G,W,Y),H!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.get(H).buffer))}function l(){return i.createVertexArray()}function c(z){return i.bindVertexArray(z)}function u(z){return i.deleteVertexArray(z)}function f(z,G,W,Y){let H=Y.wireframe===!0,$=n[G.id];$===void 0&&($={},n[G.id]=$);let J=z.isInstancedMesh===!0?z.id:0,te=$[J];te===void 0&&(te={},$[J]=te);let ce=te[W.id];ce===void 0&&(ce={},te[W.id]=ce);let he=ce[H];return he===void 0&&(he=d(l()),ce[H]=he),he}function d(z){let G=[],W=[],Y=[];for(let H=0;H<t;H++)G[H]=0,W[H]=0,Y[H]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:G,enabledAttributes:W,attributeDivisors:Y,object:z,attributes:{},index:null}}function A(z,G,W,Y){let H=s.attributes,$=G.attributes,J=0,te=W.getAttributes();for(let ce in te)if(te[ce].location>=0){let ve=H[ce],Re=$[ce];if(Re===void 0&&(ce==="instanceMatrix"&&z.instanceMatrix&&(Re=z.instanceMatrix),ce==="instanceColor"&&z.instanceColor&&(Re=z.instanceColor)),ve===void 0||ve.attribute!==Re||Re&&ve.data!==Re.data)return!0;J++}return s.attributesNum!==J||s.index!==Y}function y(z,G,W,Y){let H={},$=G.attributes,J=0,te=W.getAttributes();for(let ce in te)if(te[ce].location>=0){let ve=$[ce];ve===void 0&&(ce==="instanceMatrix"&&z.instanceMatrix&&(ve=z.instanceMatrix),ce==="instanceColor"&&z.instanceColor&&(ve=z.instanceColor));let Re={};Re.attribute=ve,ve&&ve.data&&(Re.data=ve.data),H[ce]=Re,J++}s.attributes=H,s.attributesNum=J,s.index=Y}function w(){let z=s.newAttributes;for(let G=0,W=z.length;G<W;G++)z[G]=0}function S(z){T(z,0)}function T(z,G){let W=s.newAttributes,Y=s.enabledAttributes,H=s.attributeDivisors;W[z]=1,Y[z]===0&&(i.enableVertexAttribArray(z),Y[z]=1),H[z]!==G&&(i.vertexAttribDivisor(z,G),H[z]=G)}function R(){let z=s.newAttributes,G=s.enabledAttributes;for(let W=0,Y=G.length;W<Y;W++)G[W]!==z[W]&&(i.disableVertexAttribArray(W),G[W]=0)}function P(z,G,W,Y,H,$,J){J===!0?i.vertexAttribIPointer(z,G,W,H,$):i.vertexAttribPointer(z,G,W,Y,H,$)}function I(z,G,W,Y){w();let H=Y.attributes,$=W.getAttributes(),J=G.defaultAttributeValues;for(let te in $){let ce=$[te];if(ce.location>=0){let he=H[te];if(he===void 0&&(te==="instanceMatrix"&&z.instanceMatrix&&(he=z.instanceMatrix),te==="instanceColor"&&z.instanceColor&&(he=z.instanceColor)),he!==void 0){let ve=he.normalized,Re=he.itemSize,Qe=e.get(he);if(Qe===void 0)continue;let Fe=Qe.buffer,mt=Qe.type,Ee=Qe.bytesPerElement,Ve=mt===i.INT||mt===i.UNSIGNED_INT||he.gpuType===Zr;if(he.isInterleavedBufferAttribute){let Ye=he.data,Mt=Ye.stride,Et=he.offset;if(Ye.isInstancedInterleavedBuffer){for(let It=0;It<ce.locationSize;It++)T(ce.location+It,Ye.meshPerAttribute);z.isInstancedMesh!==!0&&Y._maxInstanceCount===void 0&&(Y._maxInstanceCount=Ye.meshPerAttribute*Ye.count)}else for(let It=0;It<ce.locationSize;It++)S(ce.location+It);i.bindBuffer(i.ARRAY_BUFFER,Fe);for(let It=0;It<ce.locationSize;It++)P(ce.location+It,Re/ce.locationSize,mt,ve,Mt*Ee,(Et+Re/ce.locationSize*It)*Ee,Ve)}else{if(he.isInstancedBufferAttribute){for(let Ye=0;Ye<ce.locationSize;Ye++)T(ce.location+Ye,he.meshPerAttribute);z.isInstancedMesh!==!0&&Y._maxInstanceCount===void 0&&(Y._maxInstanceCount=he.meshPerAttribute*he.count)}else for(let Ye=0;Ye<ce.locationSize;Ye++)S(ce.location+Ye);i.bindBuffer(i.ARRAY_BUFFER,Fe);for(let Ye=0;Ye<ce.locationSize;Ye++)P(ce.location+Ye,Re/ce.locationSize,mt,ve,Re*Ee,Re/ce.locationSize*Ye*Ee,Ve)}}else if(J!==void 0){let ve=J[te];if(ve!==void 0)switch(ve.length){case 2:i.vertexAttrib2fv(ce.location,ve);break;case 3:i.vertexAttrib3fv(ce.location,ve);break;case 4:i.vertexAttrib4fv(ce.location,ve);break;default:i.vertexAttrib1fv(ce.location,ve)}}}}R()}function F(){B();for(let z in n){let G=n[z];for(let W in G){let Y=G[W];for(let H in Y){let $=Y[H];for(let J in $)u($[J].object),delete $[J];delete Y[H]}}delete n[z]}}function D(z){if(n[z.id]===void 0)return;let G=n[z.id];for(let W in G){let Y=G[W];for(let H in Y){let $=Y[H];for(let J in $)u($[J].object),delete $[J];delete Y[H]}}delete n[z.id]}function L(z){for(let G in n){let W=n[G];for(let Y in W){let H=W[Y];if(H[z.id]===void 0)continue;let $=H[z.id];for(let J in $)u($[J].object),delete $[J];delete H[z.id]}}}function C(z){for(let G in n){let W=n[G],Y=z.isInstancedMesh===!0?z.id:0,H=W[Y];if(H!==void 0){for(let $ in H){let J=H[$];for(let te in J)u(J[te].object),delete J[te];delete H[$]}delete W[Y],Object.keys(W).length===0&&delete n[G]}}}function B(){k(),o=!0,s!==r&&(s=r,c(s.object))}function k(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:a,reset:B,resetDefaultState:k,dispose:F,releaseStatesOfGeometry:D,releaseStatesOfObject:C,releaseStatesOfProgram:L,initAttributes:w,enableAttribute:S,disableUnusedAttributes:R}}function Cve(i,e,t){let n;function r(l){n=l}function s(l,c){i.drawArrays(n,l,c),t.update(c,n,1)}function o(l,c,u){u!==0&&(i.drawArraysInstanced(n,l,c,u),t.update(c,n,u))}function a(l,c,u){if(u===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,l,0,c,0,u);let d=0;for(let A=0;A<u;A++)d+=c[A];t.update(d,n,1)}this.setMode=r,this.render=s,this.renderInstances=o,this.renderMultiDraw=a}function Rve(i,e,t,n){let r;function s(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){let L=e.get("EXT_texture_filter_anisotropic");r=i.getParameter(L.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function o(L){return!(L!==Or&&n.convert(L)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_FORMAT))}function a(L){let C=L===Wi&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(L!==Ji&&n.convert(L)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_TYPE)&&L!==cr&&!C)}function l(L){if(L==="highp"){if(i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.HIGH_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";L="mediump"}return L==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp",u=l(c);u!==c&&(Xe("WebGLRenderer:",c,"not supported, using",u,"instead."),c=u);let f=t.logarithmicDepthBuffer===!0,d=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control");t.reversedDepthBuffer===!0&&d===!1&&Xe("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");let A=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),y=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),w=i.getParameter(i.MAX_TEXTURE_SIZE),S=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),T=i.getParameter(i.MAX_VERTEX_ATTRIBS),R=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),P=i.getParameter(i.MAX_VARYING_VECTORS),I=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),F=i.getParameter(i.MAX_SAMPLES),D=i.getParameter(i.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:o,textureTypeReadable:a,precision:c,logarithmicDepthBuffer:f,reversedDepthBuffer:d,maxTextures:A,maxVertexTextures:y,maxTextureSize:w,maxCubemapSize:S,maxAttributes:T,maxVertexUniforms:R,maxVaryings:P,maxFragmentUniforms:I,maxSamples:F,samples:D}}function Ive(i){let e=this,t=null,n=0,r=!1,s=!1,o=new Da,a=new Mn,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(f,d){let A=f.length!==0||d||n!==0||r;return r=d,n=f.length,A},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(f,d){t=u(f,d,0)},this.setState=function(f,d,A){let y=f.clippingPlanes,w=f.clipIntersection,S=f.clipShadows,T=i.get(f);if(!r||y===null||y.length===0||s&&!S)s?u(null):c();else{let R=s?0:n,P=R*4,I=T.clippingState||null;l.value=I,I=u(y,d,P,A);for(let F=0;F!==P;++F)I[F]=t[F];T.clippingState=I,this.numIntersection=w?this.numPlanes:0,this.numPlanes+=R}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function u(f,d,A,y){let w=f!==null?f.length:0,S=null;if(w!==0){if(S=l.value,y!==!0||S===null){let T=A+w*4,R=d.matrixWorldInverse;a.getNormalMatrix(R),(S===null||S.length<T)&&(S=new Float32Array(T));for(let P=0,I=A;P!==w;++P,I+=4)o.copy(f[P]).applyMatrix4(R,a),o.normal.toArray(S,I),S[I+3]=o.constant}l.value=S,l.needsUpdate=!0}return e.numPlanes=w,e.numIntersection=0,S}}var W0=4,TZ=[.125,.215,.35,.446,.526,.582],Ag=20,Pve=256,Ub=new Du,EZ=new zt,pF=null,mF=0,AF=0,gF=!1,Lve=new re,VM=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,n=.1,r=100,s={}){let{size:o=256,position:a=Lve}=s;pF=this._renderer.getRenderTarget(),mF=this._renderer.getActiveCubeFace(),AF=this._renderer.getActiveMipmapLevel(),gF=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(o);let l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(e,n,r,l,a),t>0&&this._blur(l,0,0,t),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=RZ(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=CZ(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(pF,mF,AF),this._renderer.xr.enabled=gF,e.scissorTest=!1,d_(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Jl||e.mapping===Hc?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),pF=this._renderer.getRenderTarget(),mF=this._renderer.getActiveCubeFace(),AF=this._renderer.getActiveMipmapLevel(),gF=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;let n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){let e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:Mi,minFilter:Mi,generateMipmaps:!1,type:Wi,format:Or,colorSpace:n0,depthBuffer:!1},r=MZ(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=MZ(e,t,n);let{_lodMax:s}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=Dve(s)),this._blurMaterial=Fve(s,e,t),this._ggxMaterial=Nve(s,e,t)}return r}_compileMaterial(e){let t=new Hn(new Xn,e);this._renderer.compile(t,Ub)}_sceneToCubeUV(e,t,n,r,s){let l=new $r(90,1,t,n),c=[1,-1,1,1,1,1],u=[1,1,1,-1,-1,-1],f=this._renderer,d=f.autoClear,A=f.toneMapping;f.getClearColor(EZ),f.toneMapping=ao,f.autoClear=!1,f.state.buffers.depth.getReversed()&&(f.setRenderTarget(r),f.clearDepth(),f.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new Hn(new Lu,new fs({name:"PMREM.Background",side:mi,depthWrite:!1,depthTest:!1})));let w=this._backgroundBox,S=w.material,T=!1,R=e.background;R?R.isColor&&(S.color.copy(R),e.background=null,T=!0):(S.color.copy(EZ),T=!0);for(let P=0;P<6;P++){let I=P%3;I===0?(l.up.set(0,c[P],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x+u[P],s.y,s.z)):I===1?(l.up.set(0,0,c[P]),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y+u[P],s.z)):(l.up.set(0,c[P],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y,s.z+u[P]));let F=this._cubeSize;d_(r,I*F,P>2?F:0,F,F),f.setRenderTarget(r),T&&f.render(w,l),f.render(e,l)}f.toneMapping=A,f.autoClear=d,e.background=R}_textureToCubeUV(e,t){let n=this._renderer,r=e.mapping===Jl||e.mapping===Hc;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=RZ()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=CZ());let s=r?this._cubemapMaterial:this._equirectMaterial,o=this._lodMeshes[0];o.material=s;let a=s.uniforms;a.envMap.value=e;let l=this._cubeSize;d_(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(o,Ub)}_applyPMREM(e){let t=this._renderer,n=t.autoClear;t.autoClear=!1;let r=this._lodMeshes.length;for(let s=1;s<r;s++)this._applyGGXFilter(e,s-1,s);t.autoClear=n}_applyGGXFilter(e,t,n){let r=this._renderer,s=this._pingPongRenderTarget,o=this._ggxMaterial,a=this._lodMeshes[n];a.material=o;let l=o.uniforms,c=n/(this._lodMeshes.length-1),u=t/(this._lodMeshes.length-1),f=Math.sqrt(c*c-u*u),d=0+c*1.25,A=f*d,{_lodMax:y}=this,w=this._sizeLods[n],S=3*w*(n>y-W0?n-y+W0:0),T=4*(this._cubeSize-w);l.envMap.value=e.texture,l.roughness.value=A,l.mipInt.value=y-t,d_(s,S,T,3*w,2*w),r.setRenderTarget(s),r.render(a,Ub),l.envMap.value=s.texture,l.roughness.value=0,l.mipInt.value=y-n,d_(e,S,T,3*w,2*w),r.setRenderTarget(e),r.render(a,Ub)}_blur(e,t,n,r,s){let o=this._pingPongRenderTarget;this._halfBlur(e,o,t,n,r,"latitudinal",s),this._halfBlur(o,e,n,n,r,"longitudinal",s)}_halfBlur(e,t,n,r,s,o,a){let l=this._renderer,c=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&ze("blur direction must be either latitudinal or longitudinal!");let u=3,f=this._lodMeshes[r];f.material=c;let d=c.uniforms,A=this._sizeLods[n]-1,y=isFinite(s)?Math.PI/(2*A):2*Math.PI/(2*Ag-1),w=s/y,S=isFinite(s)?1+Math.floor(u*w):Ag;S>Ag&&Xe(`sigmaRadians, ${s}, is too large and will clip, as it requested ${S} samples when the maximum is set to ${Ag}`);let T=[],R=0;for(let L=0;L<Ag;++L){let C=L/w,B=Math.exp(-C*C/2);T.push(B),L===0?R+=B:L<S&&(R+=2*B)}for(let L=0;L<T.length;L++)T[L]=T[L]/R;d.envMap.value=e.texture,d.samples.value=S,d.weights.value=T,d.latitudinal.value=o==="latitudinal",a&&(d.poleAxis.value=a);let{_lodMax:P}=this;d.dTheta.value=y,d.mipInt.value=P-n;let I=this._sizeLods[r],F=3*I*(r>P-W0?r-P+W0:0),D=4*(this._cubeSize-I);d_(t,F,D,3*I,2*I),l.setRenderTarget(t),l.render(f,Ub)}};function Dve(i){let e=[],t=[],n=[],r=i,s=i-W0+1+TZ.length;for(let o=0;o<s;o++){let a=Math.pow(2,r);e.push(a);let l=1/a;o>i-W0?l=TZ[o-i+W0-1]:o===0&&(l=0),t.push(l);let c=1/(a-2),u=-c,f=1+c,d=[u,u,f,u,f,f,u,u,f,f,u,f],A=6,y=6,w=3,S=2,T=1,R=new Float32Array(w*y*A),P=new Float32Array(S*y*A),I=new Float32Array(T*y*A);for(let D=0;D<A;D++){let L=D%3*2/3-1,C=D>2?0:-1,B=[L,C,0,L+2/3,C,0,L+2/3,C+1,0,L,C,0,L+2/3,C+1,0,L,C+1,0];R.set(B,w*y*D),P.set(d,S*y*D);let k=[D,D,D,D,D,D];I.set(k,T*y*D)}let F=new Xn;F.setAttribute("position",new Hi(R,w)),F.setAttribute("uv",new Hi(P,S)),F.setAttribute("faceIndex",new Hi(I,T)),n.push(new Hn(F,null)),r>W0&&r--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function MZ(i,e,t){let n=new Ba(i,e,t);return n.texture.mapping=Uh,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function d_(i,e,t,n,r){i.viewport.set(e,t,n,r),i.scissor.set(e,t,n,r)}function Nve(i,e,t){return new ds({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:Pve,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:HM(),fragmentShader:`3680+}`,kn={alphahash_fragment:hge,alphahash_pars_fragment:fge,alphamap_fragment:dge,alphamap_pars_fragment:pge,alphatest_fragment:mge,alphatest_pars_fragment:Age,aomap_fragment:gge,aomap_pars_fragment:vge,batching_pars_vertex:_ge,batching_vertex:xge,begin_vertex:yge,beginnormal_vertex:bge,bsdfs:wge,iridescence_fragment:Sge,bumpmap_pars_fragment:Tge,clipping_planes_fragment:Ege,clipping_planes_pars_fragment:Mge,clipping_planes_pars_vertex:Cge,clipping_planes_vertex:Rge,color_fragment:Ige,color_pars_fragment:Pge,color_pars_vertex:Lge,color_vertex:Dge,common:Nge,cube_uv_reflection_fragment:Fge,defaultnormal_vertex:Bge,displacementmap_pars_vertex:Oge,displacementmap_vertex:Uge,emissivemap_fragment:kge,emissivemap_pars_fragment:zge,colorspace_fragment:Vge,colorspace_pars_fragment:Gge,envmap_fragment:qge,envmap_common_pars_fragment:Hge,envmap_pars_fragment:Wge,envmap_pars_vertex:jge,envmap_physical_pars_fragment:i1e,envmap_vertex:Xge,fog_vertex:$ge,fog_pars_vertex:Yge,fog_fragment:Zge,fog_pars_fragment:Kge,gradientmap_pars_fragment:Qge,lightmap_pars_fragment:Jge,lights_lambert_fragment:e1e,lights_lambert_pars_fragment:t1e,lights_pars_begin:n1e,lights_toon_fragment:r1e,lights_toon_pars_fragment:s1e,lights_phong_fragment:o1e,lights_phong_pars_fragment:a1e,lights_physical_fragment:l1e,lights_physical_pars_fragment:c1e,lights_fragment_begin:u1e,lights_fragment_maps:h1e,lights_fragment_end:f1e,lightprobes_pars_fragment:d1e,logdepthbuf_fragment:p1e,logdepthbuf_pars_fragment:m1e,logdepthbuf_pars_vertex:A1e,logdepthbuf_vertex:g1e,map_fragment:v1e,map_pars_fragment:_1e,map_particle_fragment:x1e,map_particle_pars_fragment:y1e,metalnessmap_fragment:b1e,metalnessmap_pars_fragment:w1e,morphinstance_vertex:S1e,morphcolor_vertex:T1e,morphnormal_vertex:E1e,morphtarget_pars_vertex:M1e,morphtarget_vertex:C1e,normal_fragment_begin:R1e,normal_fragment_maps:I1e,normal_pars_fragment:P1e,normal_pars_vertex:L1e,normal_vertex:D1e,normalmap_pars_fragment:N1e,clearcoat_normal_fragment_begin:F1e,clearcoat_normal_fragment_maps:B1e,clearcoat_pars_fragment:O1e,iridescence_pars_fragment:U1e,opaque_fragment:k1e,packing:z1e,premultiplied_alpha_fragment:V1e,project_vertex:G1e,dithering_fragment:q1e,dithering_pars_fragment:H1e,roughnessmap_fragment:W1e,roughnessmap_pars_fragment:j1e,shadowmap_pars_fragment:X1e,shadowmap_pars_vertex:$1e,shadowmap_vertex:Y1e,shadowmask_pars_fragment:Z1e,skinbase_vertex:K1e,skinning_pars_vertex:Q1e,skinning_vertex:J1e,skinnormal_vertex:eve,specularmap_fragment:tve,specularmap_pars_fragment:nve,tonemapping_fragment:ive,tonemapping_pars_fragment:rve,transmission_fragment:sve,transmission_pars_fragment:ove,uv_pars_fragment:ave,uv_pars_vertex:lve,uv_vertex:cve,worldpos_vertex:uve,background_vert:hve,background_frag:fve,backgroundCube_vert:dve,backgroundCube_frag:pve,cube_vert:mve,cube_frag:Ave,depth_vert:gve,depth_frag:vve,distance_vert:_ve,distance_frag:xve,equirect_vert:yve,equirect_frag:bve,linedashed_vert:wve,linedashed_frag:Sve,meshbasic_vert:Tve,meshbasic_frag:Eve,meshlambert_vert:Mve,meshlambert_frag:Cve,meshmatcap_vert:Rve,meshmatcap_frag:Ive,meshnormal_vert:Pve,meshnormal_frag:Lve,meshphong_vert:Dve,meshphong_frag:Nve,meshphysical_vert:Fve,meshphysical_frag:Bve,meshtoon_vert:Ove,meshtoon_frag:Uve,points_vert:kve,points_frag:zve,shadow_vert:Vve,shadow_frag:Gve,sprite_vert:qve,sprite_frag:Hve},Nt={common:{diffuse:{value:new zt(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Mn},alphaMap:{value:null},alphaMapTransform:{value:new Mn},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Mn}},envmap:{envMap:{value:null},envMapRotation:{value:new Mn},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Mn}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Mn}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Mn},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Mn},normalScale:{value:new Oe(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Mn},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Mn}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Mn}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Mn}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new zt(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null},probesSH:{value:null},probesMin:{value:new re},probesMax:{value:new re},probesResolution:{value:new re}},points:{diffuse:{value:new zt(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Mn},alphaTest:{value:0},uvTransform:{value:new Mn}},sprite:{diffuse:{value:new zt(16777215)},opacity:{value:1},center:{value:new Oe(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Mn},alphaMap:{value:null},alphaMapTransform:{value:new Mn},alphaTest:{value:0}}},Ha={basic:{uniforms:ha([Nt.common,Nt.specularmap,Nt.envmap,Nt.aomap,Nt.lightmap,Nt.fog]),vertexShader:kn.meshbasic_vert,fragmentShader:kn.meshbasic_frag},lambert:{uniforms:ha([Nt.common,Nt.specularmap,Nt.envmap,Nt.aomap,Nt.lightmap,Nt.emissivemap,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,Nt.fog,Nt.lights,{emissive:{value:new zt(0)},envMapIntensity:{value:1}}]),vertexShader:kn.meshlambert_vert,fragmentShader:kn.meshlambert_frag},phong:{uniforms:ha([Nt.common,Nt.specularmap,Nt.envmap,Nt.aomap,Nt.lightmap,Nt.emissivemap,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,Nt.fog,Nt.lights,{emissive:{value:new zt(0)},specular:{value:new zt(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:kn.meshphong_vert,fragmentShader:kn.meshphong_frag},standard:{uniforms:ha([Nt.common,Nt.envmap,Nt.aomap,Nt.lightmap,Nt.emissivemap,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,Nt.roughnessmap,Nt.metalnessmap,Nt.fog,Nt.lights,{emissive:{value:new zt(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:kn.meshphysical_vert,fragmentShader:kn.meshphysical_frag},toon:{uniforms:ha([Nt.common,Nt.aomap,Nt.lightmap,Nt.emissivemap,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,Nt.gradientmap,Nt.fog,Nt.lights,{emissive:{value:new zt(0)}}]),vertexShader:kn.meshtoon_vert,fragmentShader:kn.meshtoon_frag},matcap:{uniforms:ha([Nt.common,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,Nt.fog,{matcap:{value:null}}]),vertexShader:kn.meshmatcap_vert,fragmentShader:kn.meshmatcap_frag},points:{uniforms:ha([Nt.points,Nt.fog]),vertexShader:kn.points_vert,fragmentShader:kn.points_frag},dashed:{uniforms:ha([Nt.common,Nt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:kn.linedashed_vert,fragmentShader:kn.linedashed_frag},depth:{uniforms:ha([Nt.common,Nt.displacementmap]),vertexShader:kn.depth_vert,fragmentShader:kn.depth_frag},normal:{uniforms:ha([Nt.common,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,{opacity:{value:1}}]),vertexShader:kn.meshnormal_vert,fragmentShader:kn.meshnormal_frag},sprite:{uniforms:ha([Nt.sprite,Nt.fog]),vertexShader:kn.sprite_vert,fragmentShader:kn.sprite_frag},background:{uniforms:{uvTransform:{value:new Mn},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:kn.background_vert,fragmentShader:kn.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Mn}},vertexShader:kn.backgroundCube_vert,fragmentShader:kn.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:kn.cube_vert,fragmentShader:kn.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:kn.equirect_vert,fragmentShader:kn.equirect_frag},distance:{uniforms:ha([Nt.common,Nt.displacementmap,{referencePosition:{value:new re},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:kn.distance_vert,fragmentShader:kn.distance_frag},shadow:{uniforms:ha([Nt.lights,Nt.fog,{color:{value:new zt(0)},opacity:{value:1}}]),vertexShader:kn.shadow_vert,fragmentShader:kn.shadow_frag}};Ha.physical={uniforms:ha([Ha.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Mn},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Mn},clearcoatNormalScale:{value:new Oe(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Mn},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Mn},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Mn},sheen:{value:0},sheenColor:{value:new zt(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Mn},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Mn},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Mn},transmissionSamplerSize:{value:new Oe},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Mn},attenuationDistance:{value:0},attenuationColor:{value:new zt(0)},specularColor:{value:new zt(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Mn},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Mn},anisotropyVector:{value:new Oe},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Mn}}]),vertexShader:kn.meshphysical_vert,fragmentShader:kn.meshphysical_frag};var qM={r:0,b:0,g:0},Wve=new cn,rK=new Mn;rK.set(-1,0,0,0,1,0,0,0,1);function jve(i,e,t,n,r,s){let o=new zt(0),a=r===!0?0:1,l,c,u=null,f=0,d=null;function A(R){let P=R.isScene===!0?R.background:null;if(P&&P.isTexture){let I=R.backgroundBlurriness>0;P=e.get(P,I)}return P}function y(R){let P=!1,I=A(R);I===null?S(o,a):I&&I.isColor&&(S(I,1),P=!0);let F=i.xr.getEnvironmentBlendMode();F==="additive"?t.buffers.color.setClear(0,0,0,1,s):F==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,s),(i.autoClear||P)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil))}function w(R,P){let I=A(P);I&&(I.isCubeTexture||I.mapping===kh)?(c===void 0&&(c=new Hn(new Nu(1,1,1),new ds({name:"BackgroundCubeMaterial",uniforms:pg(Ha.backgroundCube.uniforms),vertexShader:Ha.backgroundCube.vertexShader,fragmentShader:Ha.backgroundCube.fragmentShader,side:mi,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(F,D,L){this.matrixWorld.copyPosition(L.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(c)),c.material.uniforms.envMap.value=I,c.material.uniforms.backgroundBlurriness.value=P.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=P.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(Wve.makeRotationFromEuler(P.backgroundRotation)).transpose(),I.isCubeTexture&&I.isRenderTargetTexture===!1&&c.material.uniforms.backgroundRotation.value.premultiply(rK),c.material.toneMapped=ln.getTransfer(I.colorSpace)!==kt,(u!==I||f!==I.version||d!==i.toneMapping)&&(c.material.needsUpdate=!0,u=I,f=I.version,d=i.toneMapping),c.layers.enableAll(),R.unshift(c,c.geometry,c.material,0,0,null)):I&&I.isTexture&&(l===void 0&&(l=new Hn(new KA(2,2),new ds({name:"BackgroundMaterial",uniforms:pg(Ha.background.uniforms),vertexShader:Ha.background.vertexShader,fragmentShader:Ha.background.fragmentShader,side:ko,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(l)),l.material.uniforms.t2D.value=I,l.material.uniforms.backgroundIntensity.value=P.backgroundIntensity,l.material.toneMapped=ln.getTransfer(I.colorSpace)!==kt,I.matrixAutoUpdate===!0&&I.updateMatrix(),l.material.uniforms.uvTransform.value.copy(I.matrix),(u!==I||f!==I.version||d!==i.toneMapping)&&(l.material.needsUpdate=!0,u=I,f=I.version,d=i.toneMapping),l.layers.enableAll(),R.unshift(l,l.geometry,l.material,0,0,null))}function S(R,P){R.getRGB(qM,pF(i)),t.buffers.color.setClear(qM.r,qM.g,qM.b,P,s)}function T(){c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0),l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}return{getClearColor:function(){return o},setClearColor:function(R,P=1){o.set(R),a=P,S(o,a)},getClearAlpha:function(){return a},setClearAlpha:function(R){a=R,S(o,a)},render:y,addToRenderList:w,dispose:T}}function Xve(i,e){let t=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},r=d(null),s=r,o=!1;function a(z,G,W,Y,H){let $=!1,J=f(z,Y,W,G);s!==J&&(s=J,c(s.object)),$=A(z,Y,W,H),$&&y(z,Y,W,H),H!==null&&e.update(H,i.ELEMENT_ARRAY_BUFFER),($||o)&&(o=!1,I(z,G,W,Y),H!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.get(H).buffer))}function l(){return i.createVertexArray()}function c(z){return i.bindVertexArray(z)}function u(z){return i.deleteVertexArray(z)}function f(z,G,W,Y){let H=Y.wireframe===!0,$=n[G.id];$===void 0&&($={},n[G.id]=$);let J=z.isInstancedMesh===!0?z.id:0,te=$[J];te===void 0&&(te={},$[J]=te);let ce=te[W.id];ce===void 0&&(ce={},te[W.id]=ce);let he=ce[H];return he===void 0&&(he=d(l()),ce[H]=he),he}function d(z){let G=[],W=[],Y=[];for(let H=0;H<t;H++)G[H]=0,W[H]=0,Y[H]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:G,enabledAttributes:W,attributeDivisors:Y,object:z,attributes:{},index:null}}function A(z,G,W,Y){let H=s.attributes,$=G.attributes,J=0,te=W.getAttributes();for(let ce in te)if(te[ce].location>=0){let ve=H[ce],Re=$[ce];if(Re===void 0&&(ce==="instanceMatrix"&&z.instanceMatrix&&(Re=z.instanceMatrix),ce==="instanceColor"&&z.instanceColor&&(Re=z.instanceColor)),ve===void 0||ve.attribute!==Re||Re&&ve.data!==Re.data)return!0;J++}return s.attributesNum!==J||s.index!==Y}function y(z,G,W,Y){let H={},$=G.attributes,J=0,te=W.getAttributes();for(let ce in te)if(te[ce].location>=0){let ve=$[ce];ve===void 0&&(ce==="instanceMatrix"&&z.instanceMatrix&&(ve=z.instanceMatrix),ce==="instanceColor"&&z.instanceColor&&(ve=z.instanceColor));let Re={};Re.attribute=ve,ve&&ve.data&&(Re.data=ve.data),H[ce]=Re,J++}s.attributes=H,s.attributesNum=J,s.index=Y}function w(){let z=s.newAttributes;for(let G=0,W=z.length;G<W;G++)z[G]=0}function S(z){T(z,0)}function T(z,G){let W=s.newAttributes,Y=s.enabledAttributes,H=s.attributeDivisors;W[z]=1,Y[z]===0&&(i.enableVertexAttribArray(z),Y[z]=1),H[z]!==G&&(i.vertexAttribDivisor(z,G),H[z]=G)}function R(){let z=s.newAttributes,G=s.enabledAttributes;for(let W=0,Y=G.length;W<Y;W++)G[W]!==z[W]&&(i.disableVertexAttribArray(W),G[W]=0)}function P(z,G,W,Y,H,$,J){J===!0?i.vertexAttribIPointer(z,G,W,H,$):i.vertexAttribPointer(z,G,W,Y,H,$)}function I(z,G,W,Y){w();let H=Y.attributes,$=W.getAttributes(),J=G.defaultAttributeValues;for(let te in $){let ce=$[te];if(ce.location>=0){let he=H[te];if(he===void 0&&(te==="instanceMatrix"&&z.instanceMatrix&&(he=z.instanceMatrix),te==="instanceColor"&&z.instanceColor&&(he=z.instanceColor)),he!==void 0){let ve=he.normalized,Re=he.itemSize,Qe=e.get(he);if(Qe===void 0)continue;let Fe=Qe.buffer,mt=Qe.type,Ee=Qe.bytesPerElement,Ve=mt===i.INT||mt===i.UNSIGNED_INT||he.gpuType===Zr;if(he.isInterleavedBufferAttribute){let Ye=he.data,Mt=Ye.stride,Et=he.offset;if(Ye.isInstancedInterleavedBuffer){for(let It=0;It<ce.locationSize;It++)T(ce.location+It,Ye.meshPerAttribute);z.isInstancedMesh!==!0&&Y._maxInstanceCount===void 0&&(Y._maxInstanceCount=Ye.meshPerAttribute*Ye.count)}else for(let It=0;It<ce.locationSize;It++)S(ce.location+It);i.bindBuffer(i.ARRAY_BUFFER,Fe);for(let It=0;It<ce.locationSize;It++)P(ce.location+It,Re/ce.locationSize,mt,ve,Mt*Ee,(Et+Re/ce.locationSize*It)*Ee,Ve)}else{if(he.isInstancedBufferAttribute){for(let Ye=0;Ye<ce.locationSize;Ye++)T(ce.location+Ye,he.meshPerAttribute);z.isInstancedMesh!==!0&&Y._maxInstanceCount===void 0&&(Y._maxInstanceCount=he.meshPerAttribute*he.count)}else for(let Ye=0;Ye<ce.locationSize;Ye++)S(ce.location+Ye);i.bindBuffer(i.ARRAY_BUFFER,Fe);for(let Ye=0;Ye<ce.locationSize;Ye++)P(ce.location+Ye,Re/ce.locationSize,mt,ve,Re*Ee,Re/ce.locationSize*Ye*Ee,Ve)}}else if(J!==void 0){let ve=J[te];if(ve!==void 0)switch(ve.length){case 2:i.vertexAttrib2fv(ce.location,ve);break;case 3:i.vertexAttrib3fv(ce.location,ve);break;case 4:i.vertexAttrib4fv(ce.location,ve);break;default:i.vertexAttrib1fv(ce.location,ve)}}}}R()}function F(){B();for(let z in n){let G=n[z];for(let W in G){let Y=G[W];for(let H in Y){let $=Y[H];for(let J in $)u($[J].object),delete $[J];delete Y[H]}}delete n[z]}}function D(z){if(n[z.id]===void 0)return;let G=n[z.id];for(let W in G){let Y=G[W];for(let H in Y){let $=Y[H];for(let J in $)u($[J].object),delete $[J];delete Y[H]}}delete n[z.id]}function L(z){for(let G in n){let W=n[G];for(let Y in W){let H=W[Y];if(H[z.id]===void 0)continue;let $=H[z.id];for(let J in $)u($[J].object),delete $[J];delete H[z.id]}}}function C(z){for(let G in n){let W=n[G],Y=z.isInstancedMesh===!0?z.id:0,H=W[Y];if(H!==void 0){for(let $ in H){let J=H[$];for(let te in J)u(J[te].object),delete J[te];delete H[$]}delete W[Y],Object.keys(W).length===0&&delete n[G]}}}function B(){k(),o=!0,s!==r&&(s=r,c(s.object))}function k(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:a,reset:B,resetDefaultState:k,dispose:F,releaseStatesOfGeometry:D,releaseStatesOfObject:C,releaseStatesOfProgram:L,initAttributes:w,enableAttribute:S,disableUnusedAttributes:R}}function $ve(i,e,t){let n;function r(l){n=l}function s(l,c){i.drawArrays(n,l,c),t.update(c,n,1)}function o(l,c,u){u!==0&&(i.drawArraysInstanced(n,l,c,u),t.update(c,n,u))}function a(l,c,u){if(u===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,l,0,c,0,u);let d=0;for(let A=0;A<u;A++)d+=c[A];t.update(d,n,1)}this.setMode=r,this.render=s,this.renderInstances=o,this.renderMultiDraw=a}function Yve(i,e,t,n){let r;function s(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){let L=e.get("EXT_texture_filter_anisotropic");r=i.getParameter(L.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function o(L){return!(L!==Or&&n.convert(L)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_FORMAT))}function a(L){let C=L===Wi&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(L!==Ji&&n.convert(L)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_TYPE)&&L!==cr&&!C)}function l(L){if(L==="highp"){if(i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.HIGH_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";L="mediump"}return L==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp",u=l(c);u!==c&&(Xe("WebGLRenderer:",c,"not supported, using",u,"instead."),c=u);let f=t.logarithmicDepthBuffer===!0,d=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control");t.reversedDepthBuffer===!0&&d===!1&&Xe("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");let A=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),y=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),w=i.getParameter(i.MAX_TEXTURE_SIZE),S=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),T=i.getParameter(i.MAX_VERTEX_ATTRIBS),R=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),P=i.getParameter(i.MAX_VARYING_VECTORS),I=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),F=i.getParameter(i.MAX_SAMPLES),D=i.getParameter(i.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:o,textureTypeReadable:a,precision:c,logarithmicDepthBuffer:f,reversedDepthBuffer:d,maxTextures:A,maxVertexTextures:y,maxTextureSize:w,maxCubemapSize:S,maxAttributes:T,maxVertexUniforms:R,maxVaryings:P,maxFragmentUniforms:I,maxSamples:F,samples:D}}function Zve(i){let e=this,t=null,n=0,r=!1,s=!1,o=new Na,a=new Mn,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(f,d){let A=f.length!==0||d||n!==0||r;return r=d,n=f.length,A},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(f,d){t=u(f,d,0)},this.setState=function(f,d,A){let y=f.clippingPlanes,w=f.clipIntersection,S=f.clipShadows,T=i.get(f);if(!r||y===null||y.length===0||s&&!S)s?u(null):c();else{let R=s?0:n,P=R*4,I=T.clippingState||null;l.value=I,I=u(y,d,P,A);for(let F=0;F!==P;++F)I[F]=t[F];T.clippingState=I,this.numIntersection=w?this.numPlanes:0,this.numPlanes+=R}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function u(f,d,A,y){let w=f!==null?f.length:0,S=null;if(w!==0){if(S=l.value,y!==!0||S===null){let T=A+w*4,R=d.matrixWorldInverse;a.getNormalMatrix(R),(S===null||S.length<T)&&(S=new Float32Array(T));for(let P=0,I=A;P!==w;++P,I+=4)o.copy(f[P]).applyMatrix4(R,a),o.normal.toArray(S,I),S[I+3]=o.constant}l.value=S,l.needsUpdate=!0}return e.numPlanes=w,e.numIntersection=0,S}}var W0=4,NZ=[.125,.215,.35,.446,.526,.582],Ag=20,Kve=256,Gb=new Fu,FZ=new zt,bF=null,wF=0,SF=0,TF=!1,Qve=new re,WM=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,n=.1,r=100,s={}){let{size:o=256,position:a=Qve}=s;bF=this._renderer.getRenderTarget(),wF=this._renderer.getActiveCubeFace(),SF=this._renderer.getActiveMipmapLevel(),TF=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(o);let l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(e,n,r,l,a),t>0&&this._blur(l,0,0,t),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=UZ(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=OZ(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(bF,wF,SF),this._renderer.xr.enabled=TF,e.scissorTest=!1,m_(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===ec||e.mapping===Wc?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),bF=this._renderer.getRenderTarget(),wF=this._renderer.getActiveCubeFace(),SF=this._renderer.getActiveMipmapLevel(),TF=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;let n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){let e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:Mi,minFilter:Mi,generateMipmaps:!1,type:Wi,format:Or,colorSpace:n0,depthBuffer:!1},r=BZ(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=BZ(e,t,n);let{_lodMax:s}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=Jve(s)),this._blurMaterial=t_e(s,e,t),this._ggxMaterial=e_e(s,e,t)}return r}_compileMaterial(e){let t=new Hn(new Xn,e);this._renderer.compile(t,Gb)}_sceneToCubeUV(e,t,n,r,s){let l=new $r(90,1,t,n),c=[1,-1,1,1,1,1],u=[1,1,1,-1,-1,-1],f=this._renderer,d=f.autoClear,A=f.toneMapping;f.getClearColor(FZ),f.toneMapping=ao,f.autoClear=!1,f.state.buffers.depth.getReversed()&&(f.setRenderTarget(r),f.clearDepth(),f.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new Hn(new Nu,new fs({name:"PMREM.Background",side:mi,depthWrite:!1,depthTest:!1})));let w=this._backgroundBox,S=w.material,T=!1,R=e.background;R?R.isColor&&(S.color.copy(R),e.background=null,T=!0):(S.color.copy(FZ),T=!0);for(let P=0;P<6;P++){let I=P%3;I===0?(l.up.set(0,c[P],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x+u[P],s.y,s.z)):I===1?(l.up.set(0,0,c[P]),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y+u[P],s.z)):(l.up.set(0,c[P],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y,s.z+u[P]));let F=this._cubeSize;m_(r,I*F,P>2?F:0,F,F),f.setRenderTarget(r),T&&f.render(w,l),f.render(e,l)}f.toneMapping=A,f.autoClear=d,e.background=R}_textureToCubeUV(e,t){let n=this._renderer,r=e.mapping===ec||e.mapping===Wc;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=UZ()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=OZ());let s=r?this._cubemapMaterial:this._equirectMaterial,o=this._lodMeshes[0];o.material=s;let a=s.uniforms;a.envMap.value=e;let l=this._cubeSize;m_(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(o,Gb)}_applyPMREM(e){let t=this._renderer,n=t.autoClear;t.autoClear=!1;let r=this._lodMeshes.length;for(let s=1;s<r;s++)this._applyGGXFilter(e,s-1,s);t.autoClear=n}_applyGGXFilter(e,t,n){let r=this._renderer,s=this._pingPongRenderTarget,o=this._ggxMaterial,a=this._lodMeshes[n];a.material=o;let l=o.uniforms,c=n/(this._lodMeshes.length-1),u=t/(this._lodMeshes.length-1),f=Math.sqrt(c*c-u*u),d=0+c*1.25,A=f*d,{_lodMax:y}=this,w=this._sizeLods[n],S=3*w*(n>y-W0?n-y+W0:0),T=4*(this._cubeSize-w);l.envMap.value=e.texture,l.roughness.value=A,l.mipInt.value=y-t,m_(s,S,T,3*w,2*w),r.setRenderTarget(s),r.render(a,Gb),l.envMap.value=s.texture,l.roughness.value=0,l.mipInt.value=y-n,m_(e,S,T,3*w,2*w),r.setRenderTarget(e),r.render(a,Gb)}_blur(e,t,n,r,s){let o=this._pingPongRenderTarget;this._halfBlur(e,o,t,n,r,"latitudinal",s),this._halfBlur(o,e,n,n,r,"longitudinal",s)}_halfBlur(e,t,n,r,s,o,a){let l=this._renderer,c=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&ze("blur direction must be either latitudinal or longitudinal!");let u=3,f=this._lodMeshes[r];f.material=c;let d=c.uniforms,A=this._sizeLods[n]-1,y=isFinite(s)?Math.PI/(2*A):2*Math.PI/(2*Ag-1),w=s/y,S=isFinite(s)?1+Math.floor(u*w):Ag;S>Ag&&Xe(`sigmaRadians, ${s}, is too large and will clip, as it requested ${S} samples when the maximum is set to ${Ag}`);let T=[],R=0;for(let L=0;L<Ag;++L){let C=L/w,B=Math.exp(-C*C/2);T.push(B),L===0?R+=B:L<S&&(R+=2*B)}for(let L=0;L<T.length;L++)T[L]=T[L]/R;d.envMap.value=e.texture,d.samples.value=S,d.weights.value=T,d.latitudinal.value=o==="latitudinal",a&&(d.poleAxis.value=a);let{_lodMax:P}=this;d.dTheta.value=y,d.mipInt.value=P-n;let I=this._sizeLods[r],F=3*I*(r>P-W0?r-P+W0:0),D=4*(this._cubeSize-I);m_(t,F,D,3*I,2*I),l.setRenderTarget(t),l.render(f,Gb)}};function Jve(i){let e=[],t=[],n=[],r=i,s=i-W0+1+NZ.length;for(let o=0;o<s;o++){let a=Math.pow(2,r);e.push(a);let l=1/a;o>i-W0?l=NZ[o-i+W0-1]:o===0&&(l=0),t.push(l);let c=1/(a-2),u=-c,f=1+c,d=[u,u,f,u,f,f,u,u,f,f,u,f],A=6,y=6,w=3,S=2,T=1,R=new Float32Array(w*y*A),P=new Float32Array(S*y*A),I=new Float32Array(T*y*A);for(let D=0;D<A;D++){let L=D%3*2/3-1,C=D>2?0:-1,B=[L,C,0,L+2/3,C,0,L+2/3,C+1,0,L,C,0,L+2/3,C+1,0,L,C+1,0];R.set(B,w*y*D),P.set(d,S*y*D);let k=[D,D,D,D,D,D];I.set(k,T*y*D)}let F=new Xn;F.setAttribute("position",new Hi(R,w)),F.setAttribute("uv",new Hi(P,S)),F.setAttribute("faceIndex",new Hi(I,T)),n.push(new Hn(F,null)),r>W0&&r--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function BZ(i,e,t){let n=new Oa(i,e,t);return n.texture.mapping=kh,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function m_(i,e,t,n,r){i.viewport.set(e,t,n,r),i.scissor.set(e,t,n,r)}function e_e(i,e,t){return new ds({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:Kve,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:$M(),fragmentShader:`36813681 36823682 precision highp float;36833683 precision highp int;@@ -3781,7 +3781,7 @@ void main() {
37813781 37823782 gl_FragColor = vec4(prefilteredColor, 1.0);37833783 }3784- `,blending:ps,depthTest:!1,depthWrite:!1})}function Fve(i,e,t){let n=new Float32Array(Ag),r=new re(0,1,0);return new ds({name:"SphericalGaussianBlur",defines:{n:Ag,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:HM(),fragmentShader:`3784+ `,blending:ps,depthTest:!1,depthWrite:!1})}function t_e(i,e,t){let n=new Float32Array(Ag),r=new re(0,1,0);return new ds({name:"SphericalGaussianBlur",defines:{n:Ag,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:$M(),fragmentShader:`37853785 37863786 precision mediump float;37873787 precision mediump int;@@ -3841,7 +3841,7 @@ void main() {
38413841 }38423842 38433843 }3844- `,blending:ps,depthTest:!1,depthWrite:!1})}function CZ(){return new ds({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:HM(),fragmentShader:`3844+ `,blending:ps,depthTest:!1,depthWrite:!1})}function OZ(){return new ds({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:$M(),fragmentShader:`38453845 38463846 precision mediump float;38473847 precision mediump int;@@ -3860,7 +3860,7 @@ void main() {
38603860 gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );38613861 38623862 }3863- `,blending:ps,depthTest:!1,depthWrite:!1})}function RZ(){return new ds({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:HM(),fragmentShader:`3863+ `,blending:ps,depthTest:!1,depthWrite:!1})}function UZ(){return new ds({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:$M(),fragmentShader:`38643864 38653865 precision mediump float;38663866 precision mediump int;@@ -3876,7 +3876,7 @@ void main() {
38763876 gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );38773877 38783878 }3879- `,blending:ps,depthTest:!1,depthWrite:!1})}function HM(){return`3879+ `,blending:ps,depthTest:!1,depthWrite:!1})}function $M(){return`38803880 38813881 precision mediump float;38823882 precision mediump int;@@ -3931,7 +3931,7 @@ void main() {
39313931 gl_Position = vec4( position, 1.0 );39323932 39333933 }3934- `}var GM=class extends Ba{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;let n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new Lh(r),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let n={uniforms:{tEquirect:{value:null}},vertexShader:`3934+ `}var jM=class extends Oa{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;let n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new Dh(r),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let n={uniforms:{tEquirect:{value:null}},vertexShader:`39353935 39363936 varying vec3 vWorldDirection;39373937 @@ -3966,7 +3966,7 @@ void main() {
39663966 gl_FragColor = texture2D( tEquirect, sampleUV );39673967 39683968 }3969- `},r=new Lu(5,5,5),s=new ds({name:"CubemapFromEquirect",uniforms:pg(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:mi,blending:ps});s.uniforms.tEquirect.value=t;let o=new Hn(r,s),a=t.minFilter;return t.minFilter===Vo&&(t.minFilter=Mi),new o_(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t=!0,n=!0,r=!0){let s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,n,r);e.setRenderTarget(s)}};function Bve(i){let e=new WeakMap,t=new WeakMap,n=null;function r(d,A=!1){return d==null?null:A?o(d):s(d)}function s(d){if(d&&d.isTexture){let A=d.mapping;if(A===m0||A===A0)if(e.has(d)){let y=e.get(d).texture;return a(y,d.mapping)}else{let y=d.image;if(y&&y.height>0){let w=new GM(y.height);return w.fromEquirectangularTexture(i,d),e.set(d,w),d.addEventListener("dispose",c),a(w.texture,d.mapping)}else return null}}return d}function o(d){if(d&&d.isTexture){let A=d.mapping,y=A===m0||A===A0,w=A===Jl||A===Hc;if(y||w){let S=t.get(d),T=S!==void 0?S.texture.pmremVersion:0;if(d.isRenderTargetTexture&&d.pmremVersion!==T)return n===null&&(n=new VM(i)),S=y?n.fromEquirectangular(d,S):n.fromCubemap(d,S),S.texture.pmremVersion=d.pmremVersion,t.set(d,S),S.texture;if(S!==void 0)return S.texture;{let R=d.image;return y&&R&&R.height>0||w&&R&&l(R)?(n===null&&(n=new VM(i)),S=y?n.fromEquirectangular(d):n.fromCubemap(d),S.texture.pmremVersion=d.pmremVersion,t.set(d,S),d.addEventListener("dispose",u),S.texture):null}}}return d}function a(d,A){return A===m0?d.mapping=Jl:A===A0&&(d.mapping=Hc),d}function l(d){let A=0,y=6;for(let w=0;w<y;w++)d[w]!==void 0&&A++;return A===y}function c(d){let A=d.target;A.removeEventListener("dispose",c);let y=e.get(A);y!==void 0&&(e.delete(A),y.dispose())}function u(d){let A=d.target;A.removeEventListener("dispose",u);let y=t.get(A);y!==void 0&&(t.delete(A),y.dispose())}function f(){e=new WeakMap,t=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:r,dispose:f}}function Ove(i){let e={};function t(n){if(e[n]!==void 0)return e[n];let r=i.getExtension(n);return e[n]=r,r}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){let r=t(n);return r===null&&ni("WebGLRenderer: "+n+" extension not supported."),r}}}function Uve(i,e,t,n){let r={},s=new WeakMap;function o(f){let d=f.target;d.index!==null&&e.remove(d.index);for(let y in d.attributes)e.remove(d.attributes[y]);d.removeEventListener("dispose",o),delete r[d.id];let A=s.get(d);A&&(e.remove(A),s.delete(d)),n.releaseStatesOfGeometry(d),d.isInstancedBufferGeometry===!0&&delete d._maxInstanceCount,t.memory.geometries--}function a(f,d){return r[d.id]===!0||(d.addEventListener("dispose",o),r[d.id]=!0,t.memory.geometries++),d}function l(f){let d=f.attributes;for(let A in d)e.update(d[A],i.ARRAY_BUFFER)}function c(f){let d=[],A=f.index,y=f.attributes.position,w=0;if(y===void 0)return;if(A!==null){let R=A.array;w=A.version;for(let P=0,I=R.length;P<I;P+=3){let F=R[P+0],D=R[P+1],L=R[P+2];d.push(F,D,D,L,L,F)}}else{let R=y.array;w=y.version;for(let P=0,I=R.length/3-1;P<I;P+=3){let F=P+0,D=P+1,L=P+2;d.push(F,D,D,L,L,F)}}let S=new(y.count>=65535?HA:qA)(d,1);S.version=w;let T=s.get(f);T&&e.remove(T),s.set(f,S)}function u(f){let d=s.get(f);if(d){let A=f.index;A!==null&&d.version<A.version&&c(f)}else c(f);return s.get(f)}return{get:a,update:l,getWireframeAttribute:u}}function kve(i,e,t){let n;function r(f){n=f}let s,o;function a(f){s=f.type,o=f.bytesPerElement}function l(f,d){i.drawElements(n,d,s,f*o),t.update(d,n,1)}function c(f,d,A){A!==0&&(i.drawElementsInstanced(n,d,s,f*o,A),t.update(d,n,A))}function u(f,d,A){if(A===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,d,0,s,f,0,A);let w=0;for(let S=0;S<A;S++)w+=d[S];t.update(w,n,1)}this.setMode=r,this.setIndex=a,this.render=l,this.renderInstances=c,this.renderMultiDraw=u}function zve(i){let e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,o,a){switch(t.calls++,o){case i.TRIANGLES:t.triangles+=a*(s/3);break;case i.LINES:t.lines+=a*(s/2);break;case i.LINE_STRIP:t.lines+=a*(s-1);break;case i.LINE_LOOP:t.lines+=a*s;break;case i.POINTS:t.points+=a*s;break;default:ze("WebGLInfo: Unknown draw mode:",o);break}}function r(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:r,update:n}}function Vve(i,e,t){let n=new WeakMap,r=new xn;function s(o,a,l){let c=o.morphTargetInfluences,u=a.morphAttributes.position||a.morphAttributes.normal||a.morphAttributes.color,f=u!==void 0?u.length:0,d=n.get(a);if(d===void 0||d.count!==f){let B=function(){L.dispose(),n.delete(a),a.removeEventListener("dispose",B)};d!==void 0&&d.texture.dispose();let A=a.morphAttributes.position!==void 0,y=a.morphAttributes.normal!==void 0,w=a.morphAttributes.color!==void 0,S=a.morphAttributes.position||[],T=a.morphAttributes.normal||[],R=a.morphAttributes.color||[],P=0;A===!0&&(P=1),y===!0&&(P=2),w===!0&&(P=3);let I=a.attributes.position.count*P,F=1;I>e.maxTextureSize&&(F=Math.ceil(I/e.maxTextureSize),I=e.maxTextureSize);let D=new Float32Array(I*F*4*f),L=new GA(D,I,F,f);L.type=cr,L.needsUpdate=!0;let C=P*4;for(let k=0;k<f;k++){let z=S[k],G=T[k],W=R[k],Y=I*F*4*k;for(let H=0;H<z.count;H++){let $=H*C;A===!0&&(r.fromBufferAttribute(z,H),D[Y+$+0]=r.x,D[Y+$+1]=r.y,D[Y+$+2]=r.z,D[Y+$+3]=0),y===!0&&(r.fromBufferAttribute(G,H),D[Y+$+4]=r.x,D[Y+$+5]=r.y,D[Y+$+6]=r.z,D[Y+$+7]=0),w===!0&&(r.fromBufferAttribute(W,H),D[Y+$+8]=r.x,D[Y+$+9]=r.y,D[Y+$+10]=r.z,D[Y+$+11]=W.itemSize===4?r.w:1)}}d={count:f,texture:L,size:new Oe(I,F)},n.set(a,d),a.addEventListener("dispose",B)}if(o.isInstancedMesh===!0&&o.morphTexture!==null)l.getUniforms().setValue(i,"morphTexture",o.morphTexture,t);else{let A=0;for(let w=0;w<c.length;w++)A+=c[w];let y=a.morphTargetsRelative?1:1-A;l.getUniforms().setValue(i,"morphTargetBaseInfluence",y),l.getUniforms().setValue(i,"morphTargetInfluences",c)}l.getUniforms().setValue(i,"morphTargetsTexture",d.texture,t),l.getUniforms().setValue(i,"morphTargetsTextureSize",d.size)}return{update:s}}function Gve(i,e,t,n,r){let s=new WeakMap;function o(c){let u=r.render.frame,f=c.geometry,d=e.get(c,f);if(s.get(d)!==u&&(e.update(d),s.set(d,u)),c.isInstancedMesh&&(c.hasEventListener("dispose",l)===!1&&c.addEventListener("dispose",l),s.get(c)!==u&&(t.update(c.instanceMatrix,i.ARRAY_BUFFER),c.instanceColor!==null&&t.update(c.instanceColor,i.ARRAY_BUFFER),s.set(c,u))),c.isSkinnedMesh){let A=c.skeleton;s.get(A)!==u&&(A.update(),s.set(A,u))}return d}function a(){s=new WeakMap}function l(c){let u=c.target;u.removeEventListener("dispose",l),n.releaseStatesOfObject(u),t.remove(u.instanceMatrix),u.instanceColor!==null&&t.remove(u.instanceColor)}return{update:o,dispose:a}}var qve={[bb]:"LINEAR_TONE_MAPPING",[wb]:"REINHARD_TONE_MAPPING",[Sb]:"CINEON_TONE_MAPPING",[Tb]:"ACES_FILMIC_TONE_MAPPING",[Eb]:"AGX_TONE_MAPPING",[Mb]:"NEUTRAL_TONE_MAPPING",[O8]:"CUSTOM_TONE_MAPPING"};function Hve(i,e,t,n,r,s){let o=new Ba(e,t,{type:i,depthBuffer:r,stencilBuffer:s,samples:n?4:0,depthTexture:r?new Cs(e,t):void 0}),a=new Ba(e,t,{type:Wi,depthBuffer:!1,stencilBuffer:!1}),l=new Xn;l.setAttribute("position",new Ln([-1,3,0,-1,-1,0,3,-1,0],3)),l.setAttribute("uv",new Ln([0,2,0,0,2,0],2));let c=new fM({uniforms:{tDiffuse:{value:null}},vertexShader:`3969+ `},r=new Nu(5,5,5),s=new ds({name:"CubemapFromEquirect",uniforms:pg(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:mi,blending:ps});s.uniforms.tEquirect.value=t;let o=new Hn(r,s),a=t.minFilter;return t.minFilter===Vo&&(t.minFilter=Mi),new l_(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t=!0,n=!0,r=!0){let s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,n,r);e.setRenderTarget(s)}};function n_e(i){let e=new WeakMap,t=new WeakMap,n=null;function r(d,A=!1){return d==null?null:A?o(d):s(d)}function s(d){if(d&&d.isTexture){let A=d.mapping;if(A===m0||A===A0)if(e.has(d)){let y=e.get(d).texture;return a(y,d.mapping)}else{let y=d.image;if(y&&y.height>0){let w=new jM(y.height);return w.fromEquirectangularTexture(i,d),e.set(d,w),d.addEventListener("dispose",c),a(w.texture,d.mapping)}else return null}}return d}function o(d){if(d&&d.isTexture){let A=d.mapping,y=A===m0||A===A0,w=A===ec||A===Wc;if(y||w){let S=t.get(d),T=S!==void 0?S.texture.pmremVersion:0;if(d.isRenderTargetTexture&&d.pmremVersion!==T)return n===null&&(n=new WM(i)),S=y?n.fromEquirectangular(d,S):n.fromCubemap(d,S),S.texture.pmremVersion=d.pmremVersion,t.set(d,S),S.texture;if(S!==void 0)return S.texture;{let R=d.image;return y&&R&&R.height>0||w&&R&&l(R)?(n===null&&(n=new WM(i)),S=y?n.fromEquirectangular(d):n.fromCubemap(d),S.texture.pmremVersion=d.pmremVersion,t.set(d,S),d.addEventListener("dispose",u),S.texture):null}}}return d}function a(d,A){return A===m0?d.mapping=ec:A===A0&&(d.mapping=Wc),d}function l(d){let A=0,y=6;for(let w=0;w<y;w++)d[w]!==void 0&&A++;return A===y}function c(d){let A=d.target;A.removeEventListener("dispose",c);let y=e.get(A);y!==void 0&&(e.delete(A),y.dispose())}function u(d){let A=d.target;A.removeEventListener("dispose",u);let y=t.get(A);y!==void 0&&(t.delete(A),y.dispose())}function f(){e=new WeakMap,t=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:r,dispose:f}}function i_e(i){let e={};function t(n){if(e[n]!==void 0)return e[n];let r=i.getExtension(n);return e[n]=r,r}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){let r=t(n);return r===null&&ni("WebGLRenderer: "+n+" extension not supported."),r}}}function r_e(i,e,t,n){let r={},s=new WeakMap;function o(f){let d=f.target;d.index!==null&&e.remove(d.index);for(let y in d.attributes)e.remove(d.attributes[y]);d.removeEventListener("dispose",o),delete r[d.id];let A=s.get(d);A&&(e.remove(A),s.delete(d)),n.releaseStatesOfGeometry(d),d.isInstancedBufferGeometry===!0&&delete d._maxInstanceCount,t.memory.geometries--}function a(f,d){return r[d.id]===!0||(d.addEventListener("dispose",o),r[d.id]=!0,t.memory.geometries++),d}function l(f){let d=f.attributes;for(let A in d)e.update(d[A],i.ARRAY_BUFFER)}function c(f){let d=[],A=f.index,y=f.attributes.position,w=0;if(y===void 0)return;if(A!==null){let R=A.array;w=A.version;for(let P=0,I=R.length;P<I;P+=3){let F=R[P+0],D=R[P+1],L=R[P+2];d.push(F,D,D,L,L,F)}}else{let R=y.array;w=y.version;for(let P=0,I=R.length/3-1;P<I;P+=3){let F=P+0,D=P+1,L=P+2;d.push(F,D,D,L,L,F)}}let S=new(y.count>=65535?HA:qA)(d,1);S.version=w;let T=s.get(f);T&&e.remove(T),s.set(f,S)}function u(f){let d=s.get(f);if(d){let A=f.index;A!==null&&d.version<A.version&&c(f)}else c(f);return s.get(f)}return{get:a,update:l,getWireframeAttribute:u}}function s_e(i,e,t){let n;function r(f){n=f}let s,o;function a(f){s=f.type,o=f.bytesPerElement}function l(f,d){i.drawElements(n,d,s,f*o),t.update(d,n,1)}function c(f,d,A){A!==0&&(i.drawElementsInstanced(n,d,s,f*o,A),t.update(d,n,A))}function u(f,d,A){if(A===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,d,0,s,f,0,A);let w=0;for(let S=0;S<A;S++)w+=d[S];t.update(w,n,1)}this.setMode=r,this.setIndex=a,this.render=l,this.renderInstances=c,this.renderMultiDraw=u}function o_e(i){let e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,o,a){switch(t.calls++,o){case i.TRIANGLES:t.triangles+=a*(s/3);break;case i.LINES:t.lines+=a*(s/2);break;case i.LINE_STRIP:t.lines+=a*(s-1);break;case i.LINE_LOOP:t.lines+=a*s;break;case i.POINTS:t.points+=a*s;break;default:ze("WebGLInfo: Unknown draw mode:",o);break}}function r(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:r,update:n}}function a_e(i,e,t){let n=new WeakMap,r=new xn;function s(o,a,l){let c=o.morphTargetInfluences,u=a.morphAttributes.position||a.morphAttributes.normal||a.morphAttributes.color,f=u!==void 0?u.length:0,d=n.get(a);if(d===void 0||d.count!==f){let B=function(){L.dispose(),n.delete(a),a.removeEventListener("dispose",B)};d!==void 0&&d.texture.dispose();let A=a.morphAttributes.position!==void 0,y=a.morphAttributes.normal!==void 0,w=a.morphAttributes.color!==void 0,S=a.morphAttributes.position||[],T=a.morphAttributes.normal||[],R=a.morphAttributes.color||[],P=0;A===!0&&(P=1),y===!0&&(P=2),w===!0&&(P=3);let I=a.attributes.position.count*P,F=1;I>e.maxTextureSize&&(F=Math.ceil(I/e.maxTextureSize),I=e.maxTextureSize);let D=new Float32Array(I*F*4*f),L=new GA(D,I,F,f);L.type=cr,L.needsUpdate=!0;let C=P*4;for(let k=0;k<f;k++){let z=S[k],G=T[k],W=R[k],Y=I*F*4*k;for(let H=0;H<z.count;H++){let $=H*C;A===!0&&(r.fromBufferAttribute(z,H),D[Y+$+0]=r.x,D[Y+$+1]=r.y,D[Y+$+2]=r.z,D[Y+$+3]=0),y===!0&&(r.fromBufferAttribute(G,H),D[Y+$+4]=r.x,D[Y+$+5]=r.y,D[Y+$+6]=r.z,D[Y+$+7]=0),w===!0&&(r.fromBufferAttribute(W,H),D[Y+$+8]=r.x,D[Y+$+9]=r.y,D[Y+$+10]=r.z,D[Y+$+11]=W.itemSize===4?r.w:1)}}d={count:f,texture:L,size:new Oe(I,F)},n.set(a,d),a.addEventListener("dispose",B)}if(o.isInstancedMesh===!0&&o.morphTexture!==null)l.getUniforms().setValue(i,"morphTexture",o.morphTexture,t);else{let A=0;for(let w=0;w<c.length;w++)A+=c[w];let y=a.morphTargetsRelative?1:1-A;l.getUniforms().setValue(i,"morphTargetBaseInfluence",y),l.getUniforms().setValue(i,"morphTargetInfluences",c)}l.getUniforms().setValue(i,"morphTargetsTexture",d.texture,t),l.getUniforms().setValue(i,"morphTargetsTextureSize",d.size)}return{update:s}}function l_e(i,e,t,n,r){let s=new WeakMap;function o(c){let u=r.render.frame,f=c.geometry,d=e.get(c,f);if(s.get(d)!==u&&(e.update(d),s.set(d,u)),c.isInstancedMesh&&(c.hasEventListener("dispose",l)===!1&&c.addEventListener("dispose",l),s.get(c)!==u&&(t.update(c.instanceMatrix,i.ARRAY_BUFFER),c.instanceColor!==null&&t.update(c.instanceColor,i.ARRAY_BUFFER),s.set(c,u))),c.isSkinnedMesh){let A=c.skeleton;s.get(A)!==u&&(A.update(),s.set(A,u))}return d}function a(){s=new WeakMap}function l(c){let u=c.target;u.removeEventListener("dispose",l),n.releaseStatesOfObject(u),t.remove(u.instanceMatrix),u.instanceColor!==null&&t.remove(u.instanceColor)}return{update:o,dispose:a}}var c_e={[Eb]:"LINEAR_TONE_MAPPING",[Mb]:"REINHARD_TONE_MAPPING",[Cb]:"CINEON_TONE_MAPPING",[Rb]:"ACES_FILMIC_TONE_MAPPING",[Ib]:"AGX_TONE_MAPPING",[Pb]:"NEUTRAL_TONE_MAPPING",[W8]:"CUSTOM_TONE_MAPPING"};function u_e(i,e,t,n,r,s){let o=new Oa(e,t,{type:i,depthBuffer:r,stencilBuffer:s,samples:n?4:0,depthTexture:r?new Cs(e,t):void 0}),a=new Oa(e,t,{type:Wi,depthBuffer:!1,stencilBuffer:!1}),l=new Xn;l.setAttribute("position",new Ln([-1,3,0,-1,-1,0,3,-1,0],3)),l.setAttribute("uv",new Ln([0,2,0,0,2,0],2));let c=new AM({uniforms:{tDiffuse:{value:null}},vertexShader:`39703970 precision highp float;39713971 39723972 uniform mat4 modelViewMatrix;@@ -4012,17 +4012,17 @@ void main() {
40124012 #ifdef SRGB_TRANSFER40134013 gl_FragColor = sRGBTransferOETF( gl_FragColor );40144014 #endif4015- }`,depthTest:!1,depthWrite:!1}),u=new Hn(l,c),f=new Du(-1,1,1,-1,0,1),d=null,A=null,y=!1,w,S=null,T=[],R=!1;this.setSize=function(P,I){o.setSize(P,I),a.setSize(P,I);for(let F=0;F<T.length;F++){let D=T[F];D.setSize&&D.setSize(P,I)}},this.setEffects=function(P){T=P,R=T.length>0&&T[0].isRenderPass===!0;let I=o.width,F=o.height;for(let D=0;D<T.length;D++){let L=T[D];L.setSize&&L.setSize(I,F)}},this.begin=function(P,I){if(y||P.toneMapping===ao&&T.length===0)return!1;if(S=I,I!==null){let F=I.width,D=I.height;(o.width!==F||o.height!==D)&&this.setSize(F,D)}return R===!1&&P.setRenderTarget(o),w=P.toneMapping,P.toneMapping=ao,!0},this.hasRenderPass=function(){return R},this.end=function(P,I){P.toneMapping=w,y=!0;let F=o,D=a;for(let L=0;L<T.length;L++){let C=T[L];if(C.enabled!==!1&&(C.render(P,D,F,I),C.needsSwap!==!1)){let B=F;F=D,D=B}}if(d!==P.outputColorSpace||A!==P.toneMapping){d=P.outputColorSpace,A=P.toneMapping,c.defines={},ln.getTransfer(d)===kt&&(c.defines.SRGB_TRANSFER="");let L=qve[A];L&&(c.defines[L]=""),c.needsUpdate=!0}c.uniforms.tDiffuse.value=F.texture,P.setRenderTarget(S),P.render(u,f),S=null,y=!1},this.isCompositing=function(){return y},this.dispose=function(){o.depthTexture&&o.depthTexture.dispose(),o.dispose(),a.dispose(),l.dispose(),c.dispose()}}var ZZ=new Hs,xF=new Cs(1,1),KZ=new GA,QZ=new rM,JZ=new Lh,IZ=[],PZ=[],LZ=new Float32Array(16),DZ=new Float32Array(9),NZ=new Float32Array(4);function m_(i,e,t){let n=i[0];if(n<=0||n>0)return i;let r=e*t,s=IZ[r];if(s===void 0&&(s=new Float32Array(r),IZ[r]=s),e!==0){n.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,i[o].toArray(s,a)}return s}function lo(i,e){if(i.length!==e.length)return!1;for(let t=0,n=i.length;t<n;t++)if(i[t]!==e[t])return!1;return!0}function co(i,e){for(let t=0,n=e.length;t<n;t++)i[t]=e[t]}function WM(i,e){let t=PZ[e];t===void 0&&(t=new Int32Array(e),PZ[e]=t);for(let n=0;n!==e;++n)t[n]=i.allocateTextureUnit();return t}function Wve(i,e){let t=this.cache;t[0]!==e&&(i.uniform1f(this.addr,e),t[0]=e)}function jve(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(lo(t,e))return;i.uniform2fv(this.addr,e),co(t,e)}}function Xve(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(i.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(lo(t,e))return;i.uniform3fv(this.addr,e),co(t,e)}}function $ve(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(lo(t,e))return;i.uniform4fv(this.addr,e),co(t,e)}}function Yve(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(lo(t,e))return;i.uniformMatrix2fv(this.addr,!1,e),co(t,e)}else{if(lo(t,n))return;NZ.set(n),i.uniformMatrix2fv(this.addr,!1,NZ),co(t,n)}}function Zve(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(lo(t,e))return;i.uniformMatrix3fv(this.addr,!1,e),co(t,e)}else{if(lo(t,n))return;DZ.set(n),i.uniformMatrix3fv(this.addr,!1,DZ),co(t,n)}}function Kve(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(lo(t,e))return;i.uniformMatrix4fv(this.addr,!1,e),co(t,e)}else{if(lo(t,n))return;LZ.set(n),i.uniformMatrix4fv(this.addr,!1,LZ),co(t,n)}}function Qve(i,e){let t=this.cache;t[0]!==e&&(i.uniform1i(this.addr,e),t[0]=e)}function Jve(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(lo(t,e))return;i.uniform2iv(this.addr,e),co(t,e)}}function e_e(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(lo(t,e))return;i.uniform3iv(this.addr,e),co(t,e)}}function t_e(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(lo(t,e))return;i.uniform4iv(this.addr,e),co(t,e)}}function n_e(i,e){let t=this.cache;t[0]!==e&&(i.uniform1ui(this.addr,e),t[0]=e)}function i_e(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(lo(t,e))return;i.uniform2uiv(this.addr,e),co(t,e)}}function r_e(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(lo(t,e))return;i.uniform3uiv(this.addr,e),co(t,e)}}function s_e(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(lo(t,e))return;i.uniform4uiv(this.addr,e),co(t,e)}}function o_e(i,e,t){let n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r);let s;this.type===i.SAMPLER_2D_SHADOW?(xF.compareFunction=t.isReversedDepthBuffer()?Fu:Yh,s=xF):s=ZZ,t.setTexture2D(e||s,r)}function a_e(i,e,t){let n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture3D(e||QZ,r)}function l_e(i,e,t){let n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTextureCube(e||JZ,r)}function c_e(i,e,t){let n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture2DArray(e||KZ,r)}function u_e(i){switch(i){case 5126:return Wve;case 35664:return jve;case 35665:return Xve;case 35666:return $ve;case 35674:return Yve;case 35675:return Zve;case 35676:return Kve;case 5124:case 35670:return Qve;case 35667:case 35671:return Jve;case 35668:case 35672:return e_e;case 35669:case 35673:return t_e;case 5125:return n_e;case 36294:return i_e;case 36295:return r_e;case 36296:return s_e;case 35678:case 36198:case 36298:case 36306:case 35682:return o_e;case 35679:case 36299:case 36307:return a_e;case 35680:case 36300:case 36308:case 36293:return l_e;case 36289:case 36303:case 36311:case 36292:return c_e}}function h_e(i,e){i.uniform1fv(this.addr,e)}function f_e(i,e){let t=m_(e,this.size,2);i.uniform2fv(this.addr,t)}function d_e(i,e){let t=m_(e,this.size,3);i.uniform3fv(this.addr,t)}function p_e(i,e){let t=m_(e,this.size,4);i.uniform4fv(this.addr,t)}function m_e(i,e){let t=m_(e,this.size,4);i.uniformMatrix2fv(this.addr,!1,t)}function A_e(i,e){let t=m_(e,this.size,9);i.uniformMatrix3fv(this.addr,!1,t)}function g_e(i,e){let t=m_(e,this.size,16);i.uniformMatrix4fv(this.addr,!1,t)}function v_e(i,e){i.uniform1iv(this.addr,e)}function __e(i,e){i.uniform2iv(this.addr,e)}function x_e(i,e){i.uniform3iv(this.addr,e)}function y_e(i,e){i.uniform4iv(this.addr,e)}function b_e(i,e){i.uniform1uiv(this.addr,e)}function w_e(i,e){i.uniform2uiv(this.addr,e)}function S_e(i,e){i.uniform3uiv(this.addr,e)}function T_e(i,e){i.uniform4uiv(this.addr,e)}function E_e(i,e,t){let n=this.cache,r=e.length,s=WM(t,r);lo(n,s)||(i.uniform1iv(this.addr,s),co(n,s));let o;this.type===i.SAMPLER_2D_SHADOW?o=xF:o=ZZ;for(let a=0;a!==r;++a)t.setTexture2D(e[a]||o,s[a])}function M_e(i,e,t){let n=this.cache,r=e.length,s=WM(t,r);lo(n,s)||(i.uniform1iv(this.addr,s),co(n,s));for(let o=0;o!==r;++o)t.setTexture3D(e[o]||QZ,s[o])}function C_e(i,e,t){let n=this.cache,r=e.length,s=WM(t,r);lo(n,s)||(i.uniform1iv(this.addr,s),co(n,s));for(let o=0;o!==r;++o)t.setTextureCube(e[o]||JZ,s[o])}function R_e(i,e,t){let n=this.cache,r=e.length,s=WM(t,r);lo(n,s)||(i.uniform1iv(this.addr,s),co(n,s));for(let o=0;o!==r;++o)t.setTexture2DArray(e[o]||KZ,s[o])}function I_e(i){switch(i){case 5126:return h_e;case 35664:return f_e;case 35665:return d_e;case 35666:return p_e;case 35674:return m_e;case 35675:return A_e;case 35676:return g_e;case 5124:case 35670:return v_e;case 35667:case 35671:return __e;case 35668:case 35672:return x_e;case 35669:case 35673:return y_e;case 5125:return b_e;case 36294:return w_e;case 36295:return S_e;case 36296:return T_e;case 35678:case 36198:case 36298:case 36306:case 35682:return E_e;case 35679:case 36299:case 36307:return M_e;case 35680:case 36300:case 36308:case 36293:return C_e;case 36289:case 36303:case 36311:case 36292:return R_e}}var yF=class{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=u_e(t.type)}},bF=class{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=I_e(t.type)}},wF=class{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){let r=this.seq;for(let s=0,o=r.length;s!==o;++s){let a=r[s];a.setValue(e,t[a.id],n)}}},vF=/(\w+)(\])?(\[|\.)?/g;function FZ(i,e){i.seq.push(e),i.map[e.id]=e}function P_e(i,e,t){let n=i.name,r=n.length;for(vF.lastIndex=0;;){let s=vF.exec(n),o=vF.lastIndex,a=s[1],l=s[2]==="]",c=s[3];if(l&&(a=a|0),c===void 0||c==="["&&o+2===r){FZ(t,c===void 0?new yF(a,i,e):new bF(a,i,e));break}else{let f=t.map[a];f===void 0&&(f=new wF(a),FZ(t,f)),t=f}}}var p_=class{constructor(e,t){this.seq=[],this.map={};let n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let o=0;o<n;++o){let a=e.getActiveUniform(t,o),l=e.getUniformLocation(t,a.name);P_e(a,l,this)}let r=[],s=[];for(let o of this.seq)o.type===e.SAMPLER_2D_SHADOW||o.type===e.SAMPLER_CUBE_SHADOW||o.type===e.SAMPLER_2D_ARRAY_SHADOW?r.push(o):s.push(o);r.length>0&&(this.seq=r.concat(s))}setValue(e,t,n,r){let s=this.map[t];s!==void 0&&s.setValue(e,n,r)}setOptional(e,t,n){let r=t[n];r!==void 0&&this.setValue(e,n,r)}static upload(e,t,n,r){for(let s=0,o=t.length;s!==o;++s){let a=t[s],l=n[a.id];l.needsUpdate!==!1&&a.setValue(e,l.value,r)}}static seqWithValue(e,t){let n=[];for(let r=0,s=e.length;r!==s;++r){let o=e[r];o.id in t&&n.push(o)}return n}};function BZ(i,e,t){let n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}var L_e=37297,D_e=0;function N_e(i,e){let t=i.split(`4015+ }`,depthTest:!1,depthWrite:!1}),u=new Hn(l,c),f=new Fu(-1,1,1,-1,0,1),d=null,A=null,y=!1,w,S=null,T=[],R=!1;this.setSize=function(P,I){o.setSize(P,I),a.setSize(P,I);for(let F=0;F<T.length;F++){let D=T[F];D.setSize&&D.setSize(P,I)}},this.setEffects=function(P){T=P,R=T.length>0&&T[0].isRenderPass===!0;let I=o.width,F=o.height;for(let D=0;D<T.length;D++){let L=T[D];L.setSize&&L.setSize(I,F)}},this.begin=function(P,I){if(y||P.toneMapping===ao&&T.length===0)return!1;if(S=I,I!==null){let F=I.width,D=I.height;(o.width!==F||o.height!==D)&&this.setSize(F,D)}return R===!1&&P.setRenderTarget(o),w=P.toneMapping,P.toneMapping=ao,!0},this.hasRenderPass=function(){return R},this.end=function(P,I){P.toneMapping=w,y=!0;let F=o,D=a;for(let L=0;L<T.length;L++){let C=T[L];if(C.enabled!==!1&&(C.render(P,D,F,I),C.needsSwap!==!1)){let B=F;F=D,D=B}}if(d!==P.outputColorSpace||A!==P.toneMapping){d=P.outputColorSpace,A=P.toneMapping,c.defines={},ln.getTransfer(d)===kt&&(c.defines.SRGB_TRANSFER="");let L=c_e[A];L&&(c.defines[L]=""),c.needsUpdate=!0}c.uniforms.tDiffuse.value=F.texture,P.setRenderTarget(S),P.render(u,f),S=null,y=!1},this.isCompositing=function(){return y},this.dispose=function(){o.depthTexture&&o.depthTexture.dispose(),o.dispose(),a.dispose(),l.dispose(),c.dispose()}}var sK=new Hs,CF=new Cs(1,1),oK=new GA,aK=new lM,lK=new Dh,kZ=[],zZ=[],VZ=new Float32Array(16),GZ=new Float32Array(9),qZ=new Float32Array(4);function g_(i,e,t){let n=i[0];if(n<=0||n>0)return i;let r=e*t,s=kZ[r];if(s===void 0&&(s=new Float32Array(r),kZ[r]=s),e!==0){n.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,i[o].toArray(s,a)}return s}function lo(i,e){if(i.length!==e.length)return!1;for(let t=0,n=i.length;t<n;t++)if(i[t]!==e[t])return!1;return!0}function co(i,e){for(let t=0,n=e.length;t<n;t++)i[t]=e[t]}function YM(i,e){let t=zZ[e];t===void 0&&(t=new Int32Array(e),zZ[e]=t);for(let n=0;n!==e;++n)t[n]=i.allocateTextureUnit();return t}function h_e(i,e){let t=this.cache;t[0]!==e&&(i.uniform1f(this.addr,e),t[0]=e)}function f_e(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(lo(t,e))return;i.uniform2fv(this.addr,e),co(t,e)}}function d_e(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(i.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(lo(t,e))return;i.uniform3fv(this.addr,e),co(t,e)}}function p_e(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(lo(t,e))return;i.uniform4fv(this.addr,e),co(t,e)}}function m_e(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(lo(t,e))return;i.uniformMatrix2fv(this.addr,!1,e),co(t,e)}else{if(lo(t,n))return;qZ.set(n),i.uniformMatrix2fv(this.addr,!1,qZ),co(t,n)}}function A_e(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(lo(t,e))return;i.uniformMatrix3fv(this.addr,!1,e),co(t,e)}else{if(lo(t,n))return;GZ.set(n),i.uniformMatrix3fv(this.addr,!1,GZ),co(t,n)}}function g_e(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(lo(t,e))return;i.uniformMatrix4fv(this.addr,!1,e),co(t,e)}else{if(lo(t,n))return;VZ.set(n),i.uniformMatrix4fv(this.addr,!1,VZ),co(t,n)}}function v_e(i,e){let t=this.cache;t[0]!==e&&(i.uniform1i(this.addr,e),t[0]=e)}function __e(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(lo(t,e))return;i.uniform2iv(this.addr,e),co(t,e)}}function x_e(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(lo(t,e))return;i.uniform3iv(this.addr,e),co(t,e)}}function y_e(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(lo(t,e))return;i.uniform4iv(this.addr,e),co(t,e)}}function b_e(i,e){let t=this.cache;t[0]!==e&&(i.uniform1ui(this.addr,e),t[0]=e)}function w_e(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(lo(t,e))return;i.uniform2uiv(this.addr,e),co(t,e)}}function S_e(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(lo(t,e))return;i.uniform3uiv(this.addr,e),co(t,e)}}function T_e(i,e){let t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(lo(t,e))return;i.uniform4uiv(this.addr,e),co(t,e)}}function E_e(i,e,t){let n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r);let s;this.type===i.SAMPLER_2D_SHADOW?(CF.compareFunction=t.isReversedDepthBuffer()?Ou:Zh,s=CF):s=sK,t.setTexture2D(e||s,r)}function M_e(i,e,t){let n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture3D(e||aK,r)}function C_e(i,e,t){let n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTextureCube(e||lK,r)}function R_e(i,e,t){let n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture2DArray(e||oK,r)}function I_e(i){switch(i){case 5126:return h_e;case 35664:return f_e;case 35665:return d_e;case 35666:return p_e;case 35674:return m_e;case 35675:return A_e;case 35676:return g_e;case 5124:case 35670:return v_e;case 35667:case 35671:return __e;case 35668:case 35672:return x_e;case 35669:case 35673:return y_e;case 5125:return b_e;case 36294:return w_e;case 36295:return S_e;case 36296:return T_e;case 35678:case 36198:case 36298:case 36306:case 35682:return E_e;case 35679:case 36299:case 36307:return M_e;case 35680:case 36300:case 36308:case 36293:return C_e;case 36289:case 36303:case 36311:case 36292:return R_e}}function P_e(i,e){i.uniform1fv(this.addr,e)}function L_e(i,e){let t=g_(e,this.size,2);i.uniform2fv(this.addr,t)}function D_e(i,e){let t=g_(e,this.size,3);i.uniform3fv(this.addr,t)}function N_e(i,e){let t=g_(e,this.size,4);i.uniform4fv(this.addr,t)}function F_e(i,e){let t=g_(e,this.size,4);i.uniformMatrix2fv(this.addr,!1,t)}function B_e(i,e){let t=g_(e,this.size,9);i.uniformMatrix3fv(this.addr,!1,t)}function O_e(i,e){let t=g_(e,this.size,16);i.uniformMatrix4fv(this.addr,!1,t)}function U_e(i,e){i.uniform1iv(this.addr,e)}function k_e(i,e){i.uniform2iv(this.addr,e)}function z_e(i,e){i.uniform3iv(this.addr,e)}function V_e(i,e){i.uniform4iv(this.addr,e)}function G_e(i,e){i.uniform1uiv(this.addr,e)}function q_e(i,e){i.uniform2uiv(this.addr,e)}function H_e(i,e){i.uniform3uiv(this.addr,e)}function W_e(i,e){i.uniform4uiv(this.addr,e)}function j_e(i,e,t){let n=this.cache,r=e.length,s=YM(t,r);lo(n,s)||(i.uniform1iv(this.addr,s),co(n,s));let o;this.type===i.SAMPLER_2D_SHADOW?o=CF:o=sK;for(let a=0;a!==r;++a)t.setTexture2D(e[a]||o,s[a])}function X_e(i,e,t){let n=this.cache,r=e.length,s=YM(t,r);lo(n,s)||(i.uniform1iv(this.addr,s),co(n,s));for(let o=0;o!==r;++o)t.setTexture3D(e[o]||aK,s[o])}function $_e(i,e,t){let n=this.cache,r=e.length,s=YM(t,r);lo(n,s)||(i.uniform1iv(this.addr,s),co(n,s));for(let o=0;o!==r;++o)t.setTextureCube(e[o]||lK,s[o])}function Y_e(i,e,t){let n=this.cache,r=e.length,s=YM(t,r);lo(n,s)||(i.uniform1iv(this.addr,s),co(n,s));for(let o=0;o!==r;++o)t.setTexture2DArray(e[o]||oK,s[o])}function Z_e(i){switch(i){case 5126:return P_e;case 35664:return L_e;case 35665:return D_e;case 35666:return N_e;case 35674:return F_e;case 35675:return B_e;case 35676:return O_e;case 5124:case 35670:return U_e;case 35667:case 35671:return k_e;case 35668:case 35672:return z_e;case 35669:case 35673:return V_e;case 5125:return G_e;case 36294:return q_e;case 36295:return H_e;case 36296:return W_e;case 35678:case 36198:case 36298:case 36306:case 35682:return j_e;case 35679:case 36299:case 36307:return X_e;case 35680:case 36300:case 36308:case 36293:return $_e;case 36289:case 36303:case 36311:case 36292:return Y_e}}var RF=class{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=I_e(t.type)}},IF=class{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=Z_e(t.type)}},PF=class{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){let r=this.seq;for(let s=0,o=r.length;s!==o;++s){let a=r[s];a.setValue(e,t[a.id],n)}}},EF=/(\w+)(\])?(\[|\.)?/g;function HZ(i,e){i.seq.push(e),i.map[e.id]=e}function K_e(i,e,t){let n=i.name,r=n.length;for(EF.lastIndex=0;;){let s=EF.exec(n),o=EF.lastIndex,a=s[1],l=s[2]==="]",c=s[3];if(l&&(a=a|0),c===void 0||c==="["&&o+2===r){HZ(t,c===void 0?new RF(a,i,e):new IF(a,i,e));break}else{let f=t.map[a];f===void 0&&(f=new PF(a),HZ(t,f)),t=f}}}var A_=class{constructor(e,t){this.seq=[],this.map={};let n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let o=0;o<n;++o){let a=e.getActiveUniform(t,o),l=e.getUniformLocation(t,a.name);K_e(a,l,this)}let r=[],s=[];for(let o of this.seq)o.type===e.SAMPLER_2D_SHADOW||o.type===e.SAMPLER_CUBE_SHADOW||o.type===e.SAMPLER_2D_ARRAY_SHADOW?r.push(o):s.push(o);r.length>0&&(this.seq=r.concat(s))}setValue(e,t,n,r){let s=this.map[t];s!==void 0&&s.setValue(e,n,r)}setOptional(e,t,n){let r=t[n];r!==void 0&&this.setValue(e,n,r)}static upload(e,t,n,r){for(let s=0,o=t.length;s!==o;++s){let a=t[s],l=n[a.id];l.needsUpdate!==!1&&a.setValue(e,l.value,r)}}static seqWithValue(e,t){let n=[];for(let r=0,s=e.length;r!==s;++r){let o=e[r];o.id in t&&n.push(o)}return n}};function WZ(i,e,t){let n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}var Q_e=37297,J_e=0;function exe(i,e){let t=i.split(`40164016 `),n=[],r=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let o=r;o<s;o++){let a=o+1;n.push(`${a===e?">":" "} ${a}: ${t[o]}`)}return n.join(`4017-`)}var OZ=new Mn;function F_e(i){ln._getMatrix(OZ,ln.workingColorSpace,i);let e=`mat3( ${OZ.elements.map(t=>t.toFixed(4))} )`;switch(ln.getTransfer(i)){case i0:return[e,"LinearTransferOETF"];case kt:return[e,"sRGBTransferOETF"];default:return Xe("WebGLProgram: Unsupported color space: ",i),[e,"LinearTransferOETF"]}}function UZ(i,e,t){let n=i.getShaderParameter(e,i.COMPILE_STATUS),s=(i.getShaderInfoLog(e)||"").trim();if(n&&s==="")return"";let o=/ERROR: 0:(\d+)/.exec(s);if(o){let a=parseInt(o[1]);return t.toUpperCase()+`4017+`)}var jZ=new Mn;function txe(i){ln._getMatrix(jZ,ln.workingColorSpace,i);let e=`mat3( ${jZ.elements.map(t=>t.toFixed(4))} )`;switch(ln.getTransfer(i)){case i0:return[e,"LinearTransferOETF"];case kt:return[e,"sRGBTransferOETF"];default:return Xe("WebGLProgram: Unsupported color space: ",i),[e,"LinearTransferOETF"]}}function XZ(i,e,t){let n=i.getShaderParameter(e,i.COMPILE_STATUS),s=(i.getShaderInfoLog(e)||"").trim();if(n&&s==="")return"";let o=/ERROR: 0:(\d+)/.exec(s);if(o){let a=parseInt(o[1]);return t.toUpperCase()+`40184018 40194019 `+s+`40204020 4021-`+N_e(i.getShaderSource(e),a)}else return s}function B_e(i,e){let t=F_e(e);return[`vec4 ${i}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`4022-`)}var O_e={[bb]:"Linear",[wb]:"Reinhard",[Sb]:"Cineon",[Tb]:"ACESFilmic",[Eb]:"AgX",[Mb]:"Neutral",[O8]:"Custom"};function U_e(i,e){let t=O_e[e];return t===void 0?(Xe("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+i+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+i+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}var zM=new re;function k_e(){ln.getLuminanceCoefficients(zM);let i=zM.x.toFixed(4),e=zM.y.toFixed(4),t=zM.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${i}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(`4023-`)}function z_e(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(zb).join(`4024-`)}function V_e(i){let e=[];for(let t in i){let n=i[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`4025-`)}function G_e(i,e){let t={},n=i.getProgramParameter(e,i.ACTIVE_ATTRIBUTES);for(let r=0;r<n;r++){let s=i.getActiveAttrib(e,r),o=s.name,a=1;s.type===i.FLOAT_MAT2&&(a=2),s.type===i.FLOAT_MAT3&&(a=3),s.type===i.FLOAT_MAT4&&(a=4),t[o]={type:s.type,location:i.getAttribLocation(e,o),locationSize:a}}return t}function zb(i){return i!==""}function kZ(i,e){let t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return i.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function zZ(i,e){return i.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}var q_e=/^[ \t]*#include +<([\w\d./]+)>/gm;function SF(i){return i.replace(q_e,W_e)}var H_e=new Map;function W_e(i,e){let t=kn[e];if(t===void 0){let n=H_e.get(e);if(n!==void 0)t=kn[n],Xe('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("THREE.WebGLProgram: Can not resolve #include <"+e+">")}return SF(t)}var j_e=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function VZ(i){return i.replace(j_e,X_e)}function X_e(i,e,t,n){let r="";for(let s=parseInt(e);s<parseInt(t);s++)r+=n.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return r}function GZ(i){let e=`precision ${i.precision} float;4021+`+exe(i.getShaderSource(e),a)}else return s}function nxe(i,e){let t=txe(e);return[`vec4 ${i}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`4022+`)}var ixe={[Eb]:"Linear",[Mb]:"Reinhard",[Cb]:"Cineon",[Rb]:"ACESFilmic",[Ib]:"AgX",[Pb]:"Neutral",[W8]:"Custom"};function rxe(i,e){let t=ixe[e];return t===void 0?(Xe("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+i+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+i+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}var HM=new re;function sxe(){ln.getLuminanceCoefficients(HM);let i=HM.x.toFixed(4),e=HM.y.toFixed(4),t=HM.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${i}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(`4023+`)}function oxe(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Hb).join(`4024+`)}function axe(i){let e=[];for(let t in i){let n=i[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`4025+`)}function lxe(i,e){let t={},n=i.getProgramParameter(e,i.ACTIVE_ATTRIBUTES);for(let r=0;r<n;r++){let s=i.getActiveAttrib(e,r),o=s.name,a=1;s.type===i.FLOAT_MAT2&&(a=2),s.type===i.FLOAT_MAT3&&(a=3),s.type===i.FLOAT_MAT4&&(a=4),t[o]={type:s.type,location:i.getAttribLocation(e,o),locationSize:a}}return t}function Hb(i){return i!==""}function $Z(i,e){let t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return i.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function YZ(i,e){return i.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}var cxe=/^[ \t]*#include +<([\w\d./]+)>/gm;function LF(i){return i.replace(cxe,hxe)}var uxe=new Map;function hxe(i,e){let t=kn[e];if(t===void 0){let n=uxe.get(e);if(n!==void 0)t=kn[n],Xe('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("THREE.WebGLProgram: Can not resolve #include <"+e+">")}return LF(t)}var fxe=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function ZZ(i){return i.replace(fxe,dxe)}function dxe(i,e,t,n){let r="";for(let s=parseInt(e);s<parseInt(t);s++)r+=n.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return r}function KZ(i){let e=`precision ${i.precision} float;40264026 precision ${i.precision} int;40274027 precision ${i.precision} sampler2D;40284028 precision ${i.precision} samplerCube;@@ -4042,30 +4042,30 @@ void main() {
40424042 `;return i.precision==="highp"?e+=`40434043 #define HIGH_PRECISION`:i.precision==="mediump"?e+=`40444044 #define MEDIUM_PRECISION`:i.precision==="lowp"&&(e+=`4045-#define LOW_PRECISION`),e}var $_e={[p0]:"SHADOWMAP_TYPE_PCF",[qc]:"SHADOWMAP_TYPE_VSM"};function Y_e(i){return $_e[i.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}var Z_e={[Jl]:"ENVMAP_TYPE_CUBE",[Hc]:"ENVMAP_TYPE_CUBE",[Uh]:"ENVMAP_TYPE_CUBE_UV"};function K_e(i){return i.envMap===!1?"ENVMAP_TYPE_CUBE":Z_e[i.envMapMode]||"ENVMAP_TYPE_CUBE"}var Q_e={[Hc]:"ENVMAP_MODE_REFRACTION"};function J_e(i){return i.envMap===!1?"ENVMAP_MODE_REFLECTION":Q_e[i.envMapMode]||"ENVMAP_MODE_REFLECTION"}var exe={[ig]:"ENVMAP_BLENDING_MULTIPLY",[DM]:"ENVMAP_BLENDING_MIX",[NM]:"ENVMAP_BLENDING_ADD"};function txe(i){return i.envMap===!1?"ENVMAP_BLENDING_NONE":exe[i.combine]||"ENVMAP_BLENDING_NONE"}function nxe(i){let e=i.envMapCubeUVHeight;if(e===null)return null;let t=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),112)),texelHeight:n,maxMip:t}}function ixe(i,e,t,n){let r=i.getContext(),s=t.defines,o=t.vertexShader,a=t.fragmentShader,l=Y_e(t),c=K_e(t),u=J_e(t),f=txe(t),d=nxe(t),A=z_e(t),y=V_e(s),w=r.createProgram(),S,T,R=t.glslVersion?"#version "+t.glslVersion+`4046-`:"";t.isRawShaderMaterial?(S=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,y].filter(zb).join(`4045+#define LOW_PRECISION`),e}var pxe={[p0]:"SHADOWMAP_TYPE_PCF",[Hc]:"SHADOWMAP_TYPE_VSM"};function mxe(i){return pxe[i.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}var Axe={[ec]:"ENVMAP_TYPE_CUBE",[Wc]:"ENVMAP_TYPE_CUBE",[kh]:"ENVMAP_TYPE_CUBE_UV"};function gxe(i){return i.envMap===!1?"ENVMAP_TYPE_CUBE":Axe[i.envMapMode]||"ENVMAP_TYPE_CUBE"}var vxe={[Wc]:"ENVMAP_MODE_REFRACTION"};function _xe(i){return i.envMap===!1?"ENVMAP_MODE_REFLECTION":vxe[i.envMapMode]||"ENVMAP_MODE_REFLECTION"}var xxe={[ig]:"ENVMAP_BLENDING_MULTIPLY",[OM]:"ENVMAP_BLENDING_MIX",[UM]:"ENVMAP_BLENDING_ADD"};function yxe(i){return i.envMap===!1?"ENVMAP_BLENDING_NONE":xxe[i.combine]||"ENVMAP_BLENDING_NONE"}function bxe(i){let e=i.envMapCubeUVHeight;if(e===null)return null;let t=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),112)),texelHeight:n,maxMip:t}}function wxe(i,e,t,n){let r=i.getContext(),s=t.defines,o=t.vertexShader,a=t.fragmentShader,l=mxe(t),c=gxe(t),u=_xe(t),f=yxe(t),d=bxe(t),A=oxe(t),y=axe(s),w=r.createProgram(),S,T,R=t.glslVersion?"#version "+t.glslVersion+`4046+`:"";t.isRawShaderMaterial?(S=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,y].filter(Hb).join(`40474047 `),S.length>0&&(S+=`4048-`),T=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,y].filter(zb).join(`4048+`),T=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,y].filter(Hb).join(`40494049 `),T.length>0&&(T+=`4050-`)):(S=[GZ(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,y,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+u:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexNormals?"#define HAS_NORMAL":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`4051-`].filter(zb).join(`4052-`),T=[GZ(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,y,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+u:"",t.envMap?"#define "+f:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.packedNormalMap?"#define USE_PACKED_NORMALMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas||t.batchingColor?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.numLightProbeGrids>0?"#define USE_LIGHT_PROBES_GRID":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==ao?"#define TONE_MAPPING":"",t.toneMapping!==ao?kn.tonemapping_pars_fragment:"",t.toneMapping!==ao?U_e("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",kn.colorspace_pars_fragment,B_e("linearToOutputTexel",t.outputColorSpace),k_e(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`4053-`].filter(zb).join(`4054-`)),o=SF(o),o=kZ(o,t),o=zZ(o,t),a=SF(a),a=kZ(a,t),a=zZ(a,t),o=VZ(o),a=VZ(a),t.isRawShaderMaterial!==!0&&(R=`#version 300 es4050+`)):(S=[KZ(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,y,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+u:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexNormals?"#define HAS_NORMAL":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`4051+`].filter(Hb).join(`4052+`),T=[KZ(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,y,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+u:"",t.envMap?"#define "+f:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.packedNormalMap?"#define USE_PACKED_NORMALMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas||t.batchingColor?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.numLightProbeGrids>0?"#define USE_LIGHT_PROBES_GRID":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==ao?"#define TONE_MAPPING":"",t.toneMapping!==ao?kn.tonemapping_pars_fragment:"",t.toneMapping!==ao?rxe("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",kn.colorspace_pars_fragment,nxe("linearToOutputTexel",t.outputColorSpace),sxe(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`4053+`].filter(Hb).join(`4054+`)),o=LF(o),o=$Z(o,t),o=YZ(o,t),a=LF(a),a=$Z(a,t),a=YZ(a,t),o=ZZ(o),a=ZZ(a),t.isRawShaderMaterial!==!0&&(R=`#version 300 es40554055 `,S=[A,"#define attribute in","#define varying out","#define texture2D texture"].join(`40564056 `)+`4057-`+S,T=["#define varying in",t.glslVersion===nF?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===nF?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`4057+`+S,T=["#define varying in",t.glslVersion===uF?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===uF?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`40584058 `)+`4059-`+T);let P=R+S+o,I=R+T+a,F=BZ(r,r.VERTEX_SHADER,P),D=BZ(r,r.FRAGMENT_SHADER,I);r.attachShader(w,F),r.attachShader(w,D),t.index0AttributeName!==void 0?r.bindAttribLocation(w,0,t.index0AttributeName):t.hasPositionAttribute===!0&&r.bindAttribLocation(w,0,"position"),r.linkProgram(w);function L(z){if(i.debug.checkShaderErrors){let G=r.getProgramInfoLog(w)||"",W=r.getShaderInfoLog(F)||"",Y=r.getShaderInfoLog(D)||"",H=G.trim(),$=W.trim(),J=Y.trim(),te=!0,ce=!0;if(r.getProgramParameter(w,r.LINK_STATUS)===!1)if(te=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(r,w,F,D);else{let he=UZ(r,F,"vertex"),ve=UZ(r,D,"fragment");ze("WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(w,r.VALIDATE_STATUS)+`4059+`+T);let P=R+S+o,I=R+T+a,F=WZ(r,r.VERTEX_SHADER,P),D=WZ(r,r.FRAGMENT_SHADER,I);r.attachShader(w,F),r.attachShader(w,D),t.index0AttributeName!==void 0?r.bindAttribLocation(w,0,t.index0AttributeName):t.hasPositionAttribute===!0&&r.bindAttribLocation(w,0,"position"),r.linkProgram(w);function L(z){if(i.debug.checkShaderErrors){let G=r.getProgramInfoLog(w)||"",W=r.getShaderInfoLog(F)||"",Y=r.getShaderInfoLog(D)||"",H=G.trim(),$=W.trim(),J=Y.trim(),te=!0,ce=!0;if(r.getProgramParameter(w,r.LINK_STATUS)===!1)if(te=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(r,w,F,D);else{let he=XZ(r,F,"vertex"),ve=XZ(r,D,"fragment");ze("WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(w,r.VALIDATE_STATUS)+`40604060 40614061 Material Name: `+z.name+`40624062 Material Type: `+z.type+`40634063 40644064 Program Info Log: `+H+`40654065 `+he+`4066-`+ve)}else H!==""?Xe("WebGLProgram: Program Info Log:",H):($===""||J==="")&&(ce=!1);ce&&(z.diagnostics={runnable:te,programLog:H,vertexShader:{log:$,prefix:S},fragmentShader:{log:J,prefix:T}})}r.deleteShader(F),r.deleteShader(D),C=new p_(r,w),B=G_e(r,w)}let C;this.getUniforms=function(){return C===void 0&&L(this),C};let B;this.getAttributes=function(){return B===void 0&&L(this),B};let k=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return k===!1&&(k=r.getProgramParameter(w,L_e)),k},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(w),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=D_e++,this.cacheKey=e,this.usedTimes=1,this.program=w,this.vertexShader=F,this.fragmentShader=D,this}var rxe=0,TF=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e,t,n){let r=this._getShaderCacheForMaterial(e);return r.has(t)===!1&&(r.add(t),t.usedTimes++),r.has(n)===!1&&(r.add(n),n.usedTimes++),this}remove(e){let t=this.materialCache.get(e);for(let n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderStage(e){return this._getShaderStage(e.vertexShader)}getFragmentShaderStage(e){return this._getShaderStage(e.fragmentShader)}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache,n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){let t=this.shaderCache,n=t.get(e);return n===void 0&&(n=new EF(e),t.set(e,n)),n}},EF=class{constructor(e){this.id=rxe++,this.code=e,this.usedTimes=0}};function sxe(i){return i===js||i===Xh||i===$h}function oxe(i,e,t,n,r,s){let o=new Kv,a=new TF,l=new Set,c=[],u=new Map,f=n.logarithmicDepthBuffer,d=n.precision,A={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function y(C){return l.add(C),C===0?"uv":`uv${C}`}function w(C,B,k,z,G,W){let Y=z.fog,H=G.geometry,$=C.isMeshStandardMaterial||C.isMeshLambertMaterial||C.isMeshPhongMaterial?z.environment:null,J=C.isMeshStandardMaterial||C.isMeshLambertMaterial&&!C.envMap||C.isMeshPhongMaterial&&!C.envMap,te=e.get(C.envMap||$,J),ce=te&&te.mapping===Uh?te.image.height:null,he=A[C.type];C.precision!==null&&(d=n.getMaxPrecision(C.precision),d!==C.precision&&Xe("WebGLProgram.getParameters:",C.precision,"not supported, using",d,"instead."));let ve=H.morphAttributes.position||H.morphAttributes.normal||H.morphAttributes.color,Re=ve!==void 0?ve.length:0,Qe=0;H.morphAttributes.position!==void 0&&(Qe=1),H.morphAttributes.normal!==void 0&&(Qe=2),H.morphAttributes.color!==void 0&&(Qe=3);let Fe,mt,Ee,Ve;if(he){let Yt=qa[he];Fe=Yt.vertexShader,mt=Yt.fragmentShader}else{Fe=C.vertexShader,mt=C.fragmentShader;let Yt=a.getVertexShaderStage(C),nr=a.getFragmentShaderStage(C);a.update(C,Yt,nr),Ee=Yt.id,Ve=nr.id}let Ye=i.getRenderTarget(),Mt=i.state.buffers.depth.getReversed(),Et=G.isInstancedMesh===!0,It=G.isBatchedMesh===!0,dn=!!C.map,Gt=!!C.matcap,$e=!!te,ot=!!C.aoMap,nt=!!C.lightMap,bt=!!C.bumpMap&&C.wireframe===!1,yt=!!C.normalMap,hn=!!C.displacementMap,en=!!C.emissiveMap,tn=!!C.metalnessMap,bn=!!C.roughnessMap,_e=C.anisotropy>0,vi=C.clearcoat>0,zn=C.dispersion>0,le=C.iridescence>0,Z=C.sheen>0,Te=C.transmission>0,Pe=_e&&!!C.anisotropyMap,Ge=vi&&!!C.clearcoatMap,vt=vi&&!!C.clearcoatNormalMap,Tt=vi&&!!C.clearcoatRoughnessMap,qe=le&&!!C.iridescenceMap,Je=le&&!!C.iridescenceThicknessMap,Pt=Z&&!!C.sheenColorMap,rn=Z&&!!C.sheenRoughnessMap,Lt=!!C.specularMap,Rt=!!C.specularColorMap,fn=!!C.specularIntensityMap,wn=Te&&!!C.transmissionMap,Dn=Te&&!!C.thicknessMap,ye=!!C.gradientMap,wt=!!C.alphaMap,Ze=C.alphaTest>0,St=!!C.alphaHash,Bt=!!C.extensions,ut=ao;C.toneMapped&&(Ye===null||Ye.isXRRenderTarget===!0)&&(ut=i.toneMapping);let Ce={shaderID:he,shaderType:C.type,shaderName:C.name,vertexShader:Fe,fragmentShader:mt,defines:C.defines,customVertexShaderID:Ee,customFragmentShaderID:Ve,isRawShaderMaterial:C.isRawShaderMaterial===!0,glslVersion:C.glslVersion,precision:d,batching:It,batchingColor:It&&G._colorsTexture!==null,instancing:Et,instancingColor:Et&&G.instanceColor!==null,instancingMorph:Et&&G.morphTexture!==null,outputColorSpace:Ye===null?i.outputColorSpace:Ye.isXRRenderTarget===!0?Ye.texture.colorSpace:ln.workingColorSpace,alphaToCoverage:!!C.alphaToCoverage,map:dn,matcap:Gt,envMap:$e,envMapMode:$e&&te.mapping,envMapCubeUVHeight:ce,aoMap:ot,lightMap:nt,bumpMap:bt,normalMap:yt,displacementMap:hn,emissiveMap:en,normalMapObjectSpace:yt&&C.normalMapType===BM,normalMapTangentSpace:yt&&C.normalMapType===ec,packedNormalMap:yt&&C.normalMapType===ec&&sxe(C.normalMap.format),metalnessMap:tn,roughnessMap:bn,anisotropy:_e,anisotropyMap:Pe,clearcoat:vi,clearcoatMap:Ge,clearcoatNormalMap:vt,clearcoatRoughnessMap:Tt,dispersion:zn,iridescence:le,iridescenceMap:qe,iridescenceThicknessMap:Je,sheen:Z,sheenColorMap:Pt,sheenRoughnessMap:rn,specularMap:Lt,specularColorMap:Rt,specularIntensityMap:fn,transmission:Te,transmissionMap:wn,thicknessMap:Dn,gradientMap:ye,opaque:C.transparent===!1&&C.blending===Ms&&C.alphaToCoverage===!1,alphaMap:wt,alphaTest:Ze,alphaHash:St,combine:C.combine,mapUv:dn&&y(C.map.channel),aoMapUv:ot&&y(C.aoMap.channel),lightMapUv:nt&&y(C.lightMap.channel),bumpMapUv:bt&&y(C.bumpMap.channel),normalMapUv:yt&&y(C.normalMap.channel),displacementMapUv:hn&&y(C.displacementMap.channel),emissiveMapUv:en&&y(C.emissiveMap.channel),metalnessMapUv:tn&&y(C.metalnessMap.channel),roughnessMapUv:bn&&y(C.roughnessMap.channel),anisotropyMapUv:Pe&&y(C.anisotropyMap.channel),clearcoatMapUv:Ge&&y(C.clearcoatMap.channel),clearcoatNormalMapUv:vt&&y(C.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Tt&&y(C.clearcoatRoughnessMap.channel),iridescenceMapUv:qe&&y(C.iridescenceMap.channel),iridescenceThicknessMapUv:Je&&y(C.iridescenceThicknessMap.channel),sheenColorMapUv:Pt&&y(C.sheenColorMap.channel),sheenRoughnessMapUv:rn&&y(C.sheenRoughnessMap.channel),specularMapUv:Lt&&y(C.specularMap.channel),specularColorMapUv:Rt&&y(C.specularColorMap.channel),specularIntensityMapUv:fn&&y(C.specularIntensityMap.channel),transmissionMapUv:wn&&y(C.transmissionMap.channel),thicknessMapUv:Dn&&y(C.thicknessMap.channel),alphaMapUv:wt&&y(C.alphaMap.channel),vertexTangents:!!H.attributes.tangent&&(yt||_e),vertexNormals:!!H.attributes.normal,vertexColors:C.vertexColors,vertexAlphas:C.vertexColors===!0&&!!H.attributes.color&&H.attributes.color.itemSize===4,pointsUvs:G.isPoints===!0&&!!H.attributes.uv&&(dn||wt),fog:!!Y,useFog:C.fog===!0,fogExp2:!!Y&&Y.isFogExp2,flatShading:C.wireframe===!1&&(C.flatShading===!0||H.attributes.normal===void 0&&yt===!1&&(C.isMeshLambertMaterial||C.isMeshPhongMaterial||C.isMeshStandardMaterial||C.isMeshPhysicalMaterial)),sizeAttenuation:C.sizeAttenuation===!0,logarithmicDepthBuffer:f,reversedDepthBuffer:Mt,skinning:G.isSkinnedMesh===!0,hasPositionAttribute:H.attributes.position!==void 0,morphTargets:H.morphAttributes.position!==void 0,morphNormals:H.morphAttributes.normal!==void 0,morphColors:H.morphAttributes.color!==void 0,morphTargetsCount:Re,morphTextureStride:Qe,numDirLights:B.directional.length,numPointLights:B.point.length,numSpotLights:B.spot.length,numSpotLightMaps:B.spotLightMap.length,numRectAreaLights:B.rectArea.length,numHemiLights:B.hemi.length,numDirLightShadows:B.directionalShadowMap.length,numPointLightShadows:B.pointShadowMap.length,numSpotLightShadows:B.spotShadowMap.length,numSpotLightShadowsWithMaps:B.numSpotLightShadowsWithMaps,numLightProbes:B.numLightProbes,numLightProbeGrids:W.length,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:C.dithering,shadowMapEnabled:i.shadowMap.enabled&&k.length>0,shadowMapType:i.shadowMap.type,toneMapping:ut,decodeVideoTexture:dn&&C.map.isVideoTexture===!0&&ln.getTransfer(C.map.colorSpace)===kt,decodeVideoTextureEmissive:en&&C.emissiveMap.isVideoTexture===!0&&ln.getTransfer(C.emissiveMap.colorSpace)===kt,premultipliedAlpha:C.premultipliedAlpha,doubleSided:C.side===vr,flipSided:C.side===mi,useDepthPacking:C.depthPacking>=0,depthPacking:C.depthPacking||0,index0AttributeName:C.index0AttributeName,extensionClipCullDistance:Bt&&C.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Bt&&C.extensions.multiDraw===!0||It)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:C.customProgramCacheKey()};return Ce.vertexUv1s=l.has(1),Ce.vertexUv2s=l.has(2),Ce.vertexUv3s=l.has(3),l.clear(),Ce}function S(C){let B=[];if(C.shaderID?B.push(C.shaderID):(B.push(C.customVertexShaderID),B.push(C.customFragmentShaderID)),C.defines!==void 0)for(let k in C.defines)B.push(k),B.push(C.defines[k]);return C.isRawShaderMaterial===!1&&(T(B,C),R(B,C),B.push(i.outputColorSpace)),B.push(C.customProgramCacheKey),B.join()}function T(C,B){C.push(B.precision),C.push(B.outputColorSpace),C.push(B.envMapMode),C.push(B.envMapCubeUVHeight),C.push(B.mapUv),C.push(B.alphaMapUv),C.push(B.lightMapUv),C.push(B.aoMapUv),C.push(B.bumpMapUv),C.push(B.normalMapUv),C.push(B.displacementMapUv),C.push(B.emissiveMapUv),C.push(B.metalnessMapUv),C.push(B.roughnessMapUv),C.push(B.anisotropyMapUv),C.push(B.clearcoatMapUv),C.push(B.clearcoatNormalMapUv),C.push(B.clearcoatRoughnessMapUv),C.push(B.iridescenceMapUv),C.push(B.iridescenceThicknessMapUv),C.push(B.sheenColorMapUv),C.push(B.sheenRoughnessMapUv),C.push(B.specularMapUv),C.push(B.specularColorMapUv),C.push(B.specularIntensityMapUv),C.push(B.transmissionMapUv),C.push(B.thicknessMapUv),C.push(B.combine),C.push(B.fogExp2),C.push(B.sizeAttenuation),C.push(B.morphTargetsCount),C.push(B.morphAttributeCount),C.push(B.numDirLights),C.push(B.numPointLights),C.push(B.numSpotLights),C.push(B.numSpotLightMaps),C.push(B.numHemiLights),C.push(B.numRectAreaLights),C.push(B.numDirLightShadows),C.push(B.numPointLightShadows),C.push(B.numSpotLightShadows),C.push(B.numSpotLightShadowsWithMaps),C.push(B.numLightProbes),C.push(B.shadowMapType),C.push(B.toneMapping),C.push(B.numClippingPlanes),C.push(B.numClipIntersection),C.push(B.depthPacking)}function R(C,B){o.disableAll(),B.instancing&&o.enable(0),B.instancingColor&&o.enable(1),B.instancingMorph&&o.enable(2),B.matcap&&o.enable(3),B.envMap&&o.enable(4),B.normalMapObjectSpace&&o.enable(5),B.normalMapTangentSpace&&o.enable(6),B.clearcoat&&o.enable(7),B.iridescence&&o.enable(8),B.alphaTest&&o.enable(9),B.vertexColors&&o.enable(10),B.vertexAlphas&&o.enable(11),B.vertexUv1s&&o.enable(12),B.vertexUv2s&&o.enable(13),B.vertexUv3s&&o.enable(14),B.vertexTangents&&o.enable(15),B.anisotropy&&o.enable(16),B.alphaHash&&o.enable(17),B.batching&&o.enable(18),B.dispersion&&o.enable(19),B.batchingColor&&o.enable(20),B.gradientMap&&o.enable(21),B.packedNormalMap&&o.enable(22),B.vertexNormals&&o.enable(23),C.push(o.mask),o.disableAll(),B.fog&&o.enable(0),B.useFog&&o.enable(1),B.flatShading&&o.enable(2),B.logarithmicDepthBuffer&&o.enable(3),B.reversedDepthBuffer&&o.enable(4),B.skinning&&o.enable(5),B.morphTargets&&o.enable(6),B.morphNormals&&o.enable(7),B.morphColors&&o.enable(8),B.premultipliedAlpha&&o.enable(9),B.shadowMapEnabled&&o.enable(10),B.doubleSided&&o.enable(11),B.flipSided&&o.enable(12),B.useDepthPacking&&o.enable(13),B.dithering&&o.enable(14),B.transmission&&o.enable(15),B.sheen&&o.enable(16),B.opaque&&o.enable(17),B.pointsUvs&&o.enable(18),B.decodeVideoTexture&&o.enable(19),B.decodeVideoTextureEmissive&&o.enable(20),B.alphaToCoverage&&o.enable(21),B.numLightProbeGrids>0&&o.enable(22),B.hasPositionAttribute&&o.enable(23),C.push(o.mask)}function P(C){let B=A[C.type],k;if(B){let z=qa[B];k=mg.clone(z.uniforms)}else k=C.uniforms;return k}function I(C,B){let k=u.get(B);return k!==void 0?++k.usedTimes:(k=new ixe(i,B,C,r),c.push(k),u.set(B,k)),k}function F(C){if(--C.usedTimes===0){let B=c.indexOf(C);c[B]=c[c.length-1],c.pop(),u.delete(C.cacheKey),C.destroy()}}function D(C){a.remove(C)}function L(){a.dispose()}return{getParameters:w,getProgramCacheKey:S,getUniforms:P,acquireProgram:I,releaseProgram:F,releaseShaderCache:D,programs:c,dispose:L}}function axe(){let i=new WeakMap;function e(o){return i.has(o)}function t(o){let a=i.get(o);return a===void 0&&(a={},i.set(o,a)),a}function n(o){i.delete(o)}function r(o,a,l){i.get(o)[a]=l}function s(){i=new WeakMap}return{has:e,get:t,remove:n,update:r,dispose:s}}function lxe(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.material.id!==e.material.id?i.material.id-e.material.id:i.materialVariant!==e.materialVariant?i.materialVariant-e.materialVariant:i.z!==e.z?i.z-e.z:i.id-e.id}function qZ(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?e.z-i.z:i.id-e.id}function HZ(){let i=[],e=0,t=[],n=[],r=[];function s(){e=0,t.length=0,n.length=0,r.length=0}function o(d){let A=0;return d.isInstancedMesh&&(A+=2),d.isSkinnedMesh&&(A+=1),A}function a(d,A,y,w,S,T){let R=i[e];return R===void 0?(R={id:d.id,object:d,geometry:A,material:y,materialVariant:o(d),groupOrder:w,renderOrder:d.renderOrder,z:S,group:T},i[e]=R):(R.id=d.id,R.object=d,R.geometry=A,R.material=y,R.materialVariant=o(d),R.groupOrder=w,R.renderOrder=d.renderOrder,R.z=S,R.group=T),e++,R}function l(d,A,y,w,S,T){let R=a(d,A,y,w,S,T);y.transmission>0?n.push(R):y.transparent===!0?r.push(R):t.push(R)}function c(d,A,y,w,S,T){let R=a(d,A,y,w,S,T);y.transmission>0?n.unshift(R):y.transparent===!0?r.unshift(R):t.unshift(R)}function u(d,A,y){t.length>1&&t.sort(d||lxe),n.length>1&&n.sort(A||qZ),r.length>1&&r.sort(A||qZ),y&&(t.reverse(),n.reverse(),r.reverse())}function f(){for(let d=e,A=i.length;d<A;d++){let y=i[d];if(y.id===null)break;y.id=null,y.object=null,y.geometry=null,y.material=null,y.group=null}}return{opaque:t,transmissive:n,transparent:r,init:s,push:l,unshift:c,finish:f,sort:u}}function cxe(){let i=new WeakMap;function e(n,r){let s=i.get(n),o;return s===void 0?(o=new HZ,i.set(n,[o])):r>=s.length?(o=new HZ,s.push(o)):o=s[r],o}function t(){i=new WeakMap}return{get:e,dispose:t}}function uxe(){let i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new re,color:new zt};break;case"SpotLight":t={position:new re,direction:new re,color:new zt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new re,color:new zt,distance:0,decay:0};break;case"HemisphereLight":t={direction:new re,skyColor:new zt,groundColor:new zt};break;case"RectAreaLight":t={color:new zt,position:new re,halfWidth:new re,halfHeight:new re};break}return i[e.id]=t,t}}}function hxe(){let i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Oe};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Oe};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Oe,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[e.id]=t,t}}}var fxe=0;function dxe(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function pxe(i){let e=new uxe,t=hxe(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)n.probe.push(new re);let r=new re,s=new cn,o=new cn;function a(c){let u=0,f=0,d=0;for(let B=0;B<9;B++)n.probe[B].set(0,0,0);let A=0,y=0,w=0,S=0,T=0,R=0,P=0,I=0,F=0,D=0,L=0;c.sort(dxe);for(let B=0,k=c.length;B<k;B++){let z=c[B],G=z.color,W=z.intensity,Y=z.distance,H=null;if(z.shadow&&z.shadow.map&&(z.shadow.map.texture.format===js?H=z.shadow.map.texture:H=z.shadow.map.depthTexture||z.shadow.map.texture),z.isAmbientLight)u+=G.r*W,f+=G.g*W,d+=G.b*W;else if(z.isLightProbe){for(let $=0;$<9;$++)n.probe[$].addScaledVector(z.sh.coefficients[$],W);L++}else if(z.isDirectionalLight){let $=e.get(z);if($.color.copy(z.color).multiplyScalar(z.intensity),z.castShadow){let J=z.shadow,te=t.get(z);te.shadowIntensity=J.intensity,te.shadowBias=J.bias,te.shadowNormalBias=J.normalBias,te.shadowRadius=J.radius,te.shadowMapSize=J.mapSize,n.directionalShadow[A]=te,n.directionalShadowMap[A]=H,n.directionalShadowMatrix[A]=z.shadow.matrix,R++}n.directional[A]=$,A++}else if(z.isSpotLight){let $=e.get(z);$.position.setFromMatrixPosition(z.matrixWorld),$.color.copy(G).multiplyScalar(W),$.distance=Y,$.coneCos=Math.cos(z.angle),$.penumbraCos=Math.cos(z.angle*(1-z.penumbra)),$.decay=z.decay,n.spot[w]=$;let J=z.shadow;if(z.map&&(n.spotLightMap[F]=z.map,F++,J.updateMatrices(z),z.castShadow&&D++),n.spotLightMatrix[w]=J.matrix,z.castShadow){let te=t.get(z);te.shadowIntensity=J.intensity,te.shadowBias=J.bias,te.shadowNormalBias=J.normalBias,te.shadowRadius=J.radius,te.shadowMapSize=J.mapSize,n.spotShadow[w]=te,n.spotShadowMap[w]=H,I++}w++}else if(z.isRectAreaLight){let $=e.get(z);$.color.copy(G).multiplyScalar(W),$.halfWidth.set(z.width*.5,0,0),$.halfHeight.set(0,z.height*.5,0),n.rectArea[S]=$,S++}else if(z.isPointLight){let $=e.get(z);if($.color.copy(z.color).multiplyScalar(z.intensity),$.distance=z.distance,$.decay=z.decay,z.castShadow){let J=z.shadow,te=t.get(z);te.shadowIntensity=J.intensity,te.shadowBias=J.bias,te.shadowNormalBias=J.normalBias,te.shadowRadius=J.radius,te.shadowMapSize=J.mapSize,te.shadowCameraNear=J.camera.near,te.shadowCameraFar=J.camera.far,n.pointShadow[y]=te,n.pointShadowMap[y]=H,n.pointShadowMatrix[y]=z.shadow.matrix,P++}n.point[y]=$,y++}else if(z.isHemisphereLight){let $=e.get(z);$.skyColor.copy(z.color).multiplyScalar(W),$.groundColor.copy(z.groundColor).multiplyScalar(W),n.hemi[T]=$,T++}}S>0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=Nt.LTC_FLOAT_1,n.rectAreaLTC2=Nt.LTC_FLOAT_2):(n.rectAreaLTC1=Nt.LTC_HALF_1,n.rectAreaLTC2=Nt.LTC_HALF_2)),n.ambient[0]=u,n.ambient[1]=f,n.ambient[2]=d;let C=n.hash;(C.directionalLength!==A||C.pointLength!==y||C.spotLength!==w||C.rectAreaLength!==S||C.hemiLength!==T||C.numDirectionalShadows!==R||C.numPointShadows!==P||C.numSpotShadows!==I||C.numSpotMaps!==F||C.numLightProbes!==L)&&(n.directional.length=A,n.spot.length=w,n.rectArea.length=S,n.point.length=y,n.hemi.length=T,n.directionalShadow.length=R,n.directionalShadowMap.length=R,n.pointShadow.length=P,n.pointShadowMap.length=P,n.spotShadow.length=I,n.spotShadowMap.length=I,n.directionalShadowMatrix.length=R,n.pointShadowMatrix.length=P,n.spotLightMatrix.length=I+F-D,n.spotLightMap.length=F,n.numSpotLightShadowsWithMaps=D,n.numLightProbes=L,C.directionalLength=A,C.pointLength=y,C.spotLength=w,C.rectAreaLength=S,C.hemiLength=T,C.numDirectionalShadows=R,C.numPointShadows=P,C.numSpotShadows=I,C.numSpotMaps=F,C.numLightProbes=L,n.version=fxe++)}function l(c,u){let f=0,d=0,A=0,y=0,w=0,S=u.matrixWorldInverse;for(let T=0,R=c.length;T<R;T++){let P=c[T];if(P.isDirectionalLight){let I=n.directional[f];I.direction.setFromMatrixPosition(P.matrixWorld),r.setFromMatrixPosition(P.target.matrixWorld),I.direction.sub(r),I.direction.transformDirection(S),f++}else if(P.isSpotLight){let I=n.spot[A];I.position.setFromMatrixPosition(P.matrixWorld),I.position.applyMatrix4(S),I.direction.setFromMatrixPosition(P.matrixWorld),r.setFromMatrixPosition(P.target.matrixWorld),I.direction.sub(r),I.direction.transformDirection(S),A++}else if(P.isRectAreaLight){let I=n.rectArea[y];I.position.setFromMatrixPosition(P.matrixWorld),I.position.applyMatrix4(S),o.identity(),s.copy(P.matrixWorld),s.premultiply(S),o.extractRotation(s),I.halfWidth.set(P.width*.5,0,0),I.halfHeight.set(0,P.height*.5,0),I.halfWidth.applyMatrix4(o),I.halfHeight.applyMatrix4(o),y++}else if(P.isPointLight){let I=n.point[d];I.position.setFromMatrixPosition(P.matrixWorld),I.position.applyMatrix4(S),d++}else if(P.isHemisphereLight){let I=n.hemi[w];I.direction.setFromMatrixPosition(P.matrixWorld),I.direction.transformDirection(S),w++}}}return{setup:a,setupView:l,state:n}}function WZ(i){let e=new pxe(i),t=[],n=[],r=[];function s(d){f.camera=d,t.length=0,n.length=0,r.length=0}function o(d){t.push(d)}function a(d){n.push(d)}function l(d){r.push(d)}function c(){e.setup(t)}function u(d){e.setupView(t,d)}let f={lightsArray:t,shadowsArray:n,lightProbeGridArray:r,camera:null,lights:e,transmissionRenderTarget:{},textureUnits:0};return{init:s,state:f,setupLights:c,setupLightsView:u,pushLight:o,pushShadow:a,pushLightProbeGrid:l}}function mxe(i){let e=new WeakMap;function t(r,s=0){let o=e.get(r),a;return o===void 0?(a=new WZ(i),e.set(r,[a])):s>=o.length?(a=new WZ(i),o.push(a)):a=o[s],a}function n(){e=new WeakMap}return{get:t,dispose:n}}var Axe=`void main() {4066+`+ve)}else H!==""?Xe("WebGLProgram: Program Info Log:",H):($===""||J==="")&&(ce=!1);ce&&(z.diagnostics={runnable:te,programLog:H,vertexShader:{log:$,prefix:S},fragmentShader:{log:J,prefix:T}})}r.deleteShader(F),r.deleteShader(D),C=new A_(r,w),B=lxe(r,w)}let C;this.getUniforms=function(){return C===void 0&&L(this),C};let B;this.getAttributes=function(){return B===void 0&&L(this),B};let k=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return k===!1&&(k=r.getProgramParameter(w,Q_e)),k},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(w),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=J_e++,this.cacheKey=e,this.usedTimes=1,this.program=w,this.vertexShader=F,this.fragmentShader=D,this}var Sxe=0,DF=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e,t,n){let r=this._getShaderCacheForMaterial(e);return r.has(t)===!1&&(r.add(t),t.usedTimes++),r.has(n)===!1&&(r.add(n),n.usedTimes++),this}remove(e){let t=this.materialCache.get(e);for(let n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderStage(e){return this._getShaderStage(e.vertexShader)}getFragmentShaderStage(e){return this._getShaderStage(e.fragmentShader)}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache,n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){let t=this.shaderCache,n=t.get(e);return n===void 0&&(n=new NF(e),t.set(e,n)),n}},NF=class{constructor(e){this.id=Sxe++,this.code=e,this.usedTimes=0}};function Txe(i){return i===js||i===$h||i===Yh}function Exe(i,e,t,n,r,s){let o=new Jv,a=new DF,l=new Set,c=[],u=new Map,f=n.logarithmicDepthBuffer,d=n.precision,A={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function y(C){return l.add(C),C===0?"uv":`uv${C}`}function w(C,B,k,z,G,W){let Y=z.fog,H=G.geometry,$=C.isMeshStandardMaterial||C.isMeshLambertMaterial||C.isMeshPhongMaterial?z.environment:null,J=C.isMeshStandardMaterial||C.isMeshLambertMaterial&&!C.envMap||C.isMeshPhongMaterial&&!C.envMap,te=e.get(C.envMap||$,J),ce=te&&te.mapping===kh?te.image.height:null,he=A[C.type];C.precision!==null&&(d=n.getMaxPrecision(C.precision),d!==C.precision&&Xe("WebGLProgram.getParameters:",C.precision,"not supported, using",d,"instead."));let ve=H.morphAttributes.position||H.morphAttributes.normal||H.morphAttributes.color,Re=ve!==void 0?ve.length:0,Qe=0;H.morphAttributes.position!==void 0&&(Qe=1),H.morphAttributes.normal!==void 0&&(Qe=2),H.morphAttributes.color!==void 0&&(Qe=3);let Fe,mt,Ee,Ve;if(he){let Yt=Ha[he];Fe=Yt.vertexShader,mt=Yt.fragmentShader}else{Fe=C.vertexShader,mt=C.fragmentShader;let Yt=a.getVertexShaderStage(C),nr=a.getFragmentShaderStage(C);a.update(C,Yt,nr),Ee=Yt.id,Ve=nr.id}let Ye=i.getRenderTarget(),Mt=i.state.buffers.depth.getReversed(),Et=G.isInstancedMesh===!0,It=G.isBatchedMesh===!0,dn=!!C.map,Gt=!!C.matcap,$e=!!te,ot=!!C.aoMap,nt=!!C.lightMap,bt=!!C.bumpMap&&C.wireframe===!1,yt=!!C.normalMap,hn=!!C.displacementMap,en=!!C.emissiveMap,tn=!!C.metalnessMap,bn=!!C.roughnessMap,_e=C.anisotropy>0,vi=C.clearcoat>0,zn=C.dispersion>0,le=C.iridescence>0,Z=C.sheen>0,Te=C.transmission>0,Pe=_e&&!!C.anisotropyMap,Ge=vi&&!!C.clearcoatMap,vt=vi&&!!C.clearcoatNormalMap,Tt=vi&&!!C.clearcoatRoughnessMap,qe=le&&!!C.iridescenceMap,Je=le&&!!C.iridescenceThicknessMap,Pt=Z&&!!C.sheenColorMap,rn=Z&&!!C.sheenRoughnessMap,Lt=!!C.specularMap,Rt=!!C.specularColorMap,fn=!!C.specularIntensityMap,wn=Te&&!!C.transmissionMap,Dn=Te&&!!C.thicknessMap,ye=!!C.gradientMap,wt=!!C.alphaMap,Ze=C.alphaTest>0,St=!!C.alphaHash,Bt=!!C.extensions,ut=ao;C.toneMapped&&(Ye===null||Ye.isXRRenderTarget===!0)&&(ut=i.toneMapping);let Ce={shaderID:he,shaderType:C.type,shaderName:C.name,vertexShader:Fe,fragmentShader:mt,defines:C.defines,customVertexShaderID:Ee,customFragmentShaderID:Ve,isRawShaderMaterial:C.isRawShaderMaterial===!0,glslVersion:C.glslVersion,precision:d,batching:It,batchingColor:It&&G._colorsTexture!==null,instancing:Et,instancingColor:Et&&G.instanceColor!==null,instancingMorph:Et&&G.morphTexture!==null,outputColorSpace:Ye===null?i.outputColorSpace:Ye.isXRRenderTarget===!0?Ye.texture.colorSpace:ln.workingColorSpace,alphaToCoverage:!!C.alphaToCoverage,map:dn,matcap:Gt,envMap:$e,envMapMode:$e&&te.mapping,envMapCubeUVHeight:ce,aoMap:ot,lightMap:nt,bumpMap:bt,normalMap:yt,displacementMap:hn,emissiveMap:en,normalMapObjectSpace:yt&&C.normalMapType===zM,normalMapTangentSpace:yt&&C.normalMapType===tc,packedNormalMap:yt&&C.normalMapType===tc&&Txe(C.normalMap.format),metalnessMap:tn,roughnessMap:bn,anisotropy:_e,anisotropyMap:Pe,clearcoat:vi,clearcoatMap:Ge,clearcoatNormalMap:vt,clearcoatRoughnessMap:Tt,dispersion:zn,iridescence:le,iridescenceMap:qe,iridescenceThicknessMap:Je,sheen:Z,sheenColorMap:Pt,sheenRoughnessMap:rn,specularMap:Lt,specularColorMap:Rt,specularIntensityMap:fn,transmission:Te,transmissionMap:wn,thicknessMap:Dn,gradientMap:ye,opaque:C.transparent===!1&&C.blending===Ms&&C.alphaToCoverage===!1,alphaMap:wt,alphaTest:Ze,alphaHash:St,combine:C.combine,mapUv:dn&&y(C.map.channel),aoMapUv:ot&&y(C.aoMap.channel),lightMapUv:nt&&y(C.lightMap.channel),bumpMapUv:bt&&y(C.bumpMap.channel),normalMapUv:yt&&y(C.normalMap.channel),displacementMapUv:hn&&y(C.displacementMap.channel),emissiveMapUv:en&&y(C.emissiveMap.channel),metalnessMapUv:tn&&y(C.metalnessMap.channel),roughnessMapUv:bn&&y(C.roughnessMap.channel),anisotropyMapUv:Pe&&y(C.anisotropyMap.channel),clearcoatMapUv:Ge&&y(C.clearcoatMap.channel),clearcoatNormalMapUv:vt&&y(C.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Tt&&y(C.clearcoatRoughnessMap.channel),iridescenceMapUv:qe&&y(C.iridescenceMap.channel),iridescenceThicknessMapUv:Je&&y(C.iridescenceThicknessMap.channel),sheenColorMapUv:Pt&&y(C.sheenColorMap.channel),sheenRoughnessMapUv:rn&&y(C.sheenRoughnessMap.channel),specularMapUv:Lt&&y(C.specularMap.channel),specularColorMapUv:Rt&&y(C.specularColorMap.channel),specularIntensityMapUv:fn&&y(C.specularIntensityMap.channel),transmissionMapUv:wn&&y(C.transmissionMap.channel),thicknessMapUv:Dn&&y(C.thicknessMap.channel),alphaMapUv:wt&&y(C.alphaMap.channel),vertexTangents:!!H.attributes.tangent&&(yt||_e),vertexNormals:!!H.attributes.normal,vertexColors:C.vertexColors,vertexAlphas:C.vertexColors===!0&&!!H.attributes.color&&H.attributes.color.itemSize===4,pointsUvs:G.isPoints===!0&&!!H.attributes.uv&&(dn||wt),fog:!!Y,useFog:C.fog===!0,fogExp2:!!Y&&Y.isFogExp2,flatShading:C.wireframe===!1&&(C.flatShading===!0||H.attributes.normal===void 0&&yt===!1&&(C.isMeshLambertMaterial||C.isMeshPhongMaterial||C.isMeshStandardMaterial||C.isMeshPhysicalMaterial)),sizeAttenuation:C.sizeAttenuation===!0,logarithmicDepthBuffer:f,reversedDepthBuffer:Mt,skinning:G.isSkinnedMesh===!0,hasPositionAttribute:H.attributes.position!==void 0,morphTargets:H.morphAttributes.position!==void 0,morphNormals:H.morphAttributes.normal!==void 0,morphColors:H.morphAttributes.color!==void 0,morphTargetsCount:Re,morphTextureStride:Qe,numDirLights:B.directional.length,numPointLights:B.point.length,numSpotLights:B.spot.length,numSpotLightMaps:B.spotLightMap.length,numRectAreaLights:B.rectArea.length,numHemiLights:B.hemi.length,numDirLightShadows:B.directionalShadowMap.length,numPointLightShadows:B.pointShadowMap.length,numSpotLightShadows:B.spotShadowMap.length,numSpotLightShadowsWithMaps:B.numSpotLightShadowsWithMaps,numLightProbes:B.numLightProbes,numLightProbeGrids:W.length,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:C.dithering,shadowMapEnabled:i.shadowMap.enabled&&k.length>0,shadowMapType:i.shadowMap.type,toneMapping:ut,decodeVideoTexture:dn&&C.map.isVideoTexture===!0&&ln.getTransfer(C.map.colorSpace)===kt,decodeVideoTextureEmissive:en&&C.emissiveMap.isVideoTexture===!0&&ln.getTransfer(C.emissiveMap.colorSpace)===kt,premultipliedAlpha:C.premultipliedAlpha,doubleSided:C.side===vr,flipSided:C.side===mi,useDepthPacking:C.depthPacking>=0,depthPacking:C.depthPacking||0,index0AttributeName:C.index0AttributeName,extensionClipCullDistance:Bt&&C.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Bt&&C.extensions.multiDraw===!0||It)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:C.customProgramCacheKey()};return Ce.vertexUv1s=l.has(1),Ce.vertexUv2s=l.has(2),Ce.vertexUv3s=l.has(3),l.clear(),Ce}function S(C){let B=[];if(C.shaderID?B.push(C.shaderID):(B.push(C.customVertexShaderID),B.push(C.customFragmentShaderID)),C.defines!==void 0)for(let k in C.defines)B.push(k),B.push(C.defines[k]);return C.isRawShaderMaterial===!1&&(T(B,C),R(B,C),B.push(i.outputColorSpace)),B.push(C.customProgramCacheKey),B.join()}function T(C,B){C.push(B.precision),C.push(B.outputColorSpace),C.push(B.envMapMode),C.push(B.envMapCubeUVHeight),C.push(B.mapUv),C.push(B.alphaMapUv),C.push(B.lightMapUv),C.push(B.aoMapUv),C.push(B.bumpMapUv),C.push(B.normalMapUv),C.push(B.displacementMapUv),C.push(B.emissiveMapUv),C.push(B.metalnessMapUv),C.push(B.roughnessMapUv),C.push(B.anisotropyMapUv),C.push(B.clearcoatMapUv),C.push(B.clearcoatNormalMapUv),C.push(B.clearcoatRoughnessMapUv),C.push(B.iridescenceMapUv),C.push(B.iridescenceThicknessMapUv),C.push(B.sheenColorMapUv),C.push(B.sheenRoughnessMapUv),C.push(B.specularMapUv),C.push(B.specularColorMapUv),C.push(B.specularIntensityMapUv),C.push(B.transmissionMapUv),C.push(B.thicknessMapUv),C.push(B.combine),C.push(B.fogExp2),C.push(B.sizeAttenuation),C.push(B.morphTargetsCount),C.push(B.morphAttributeCount),C.push(B.numDirLights),C.push(B.numPointLights),C.push(B.numSpotLights),C.push(B.numSpotLightMaps),C.push(B.numHemiLights),C.push(B.numRectAreaLights),C.push(B.numDirLightShadows),C.push(B.numPointLightShadows),C.push(B.numSpotLightShadows),C.push(B.numSpotLightShadowsWithMaps),C.push(B.numLightProbes),C.push(B.shadowMapType),C.push(B.toneMapping),C.push(B.numClippingPlanes),C.push(B.numClipIntersection),C.push(B.depthPacking)}function R(C,B){o.disableAll(),B.instancing&&o.enable(0),B.instancingColor&&o.enable(1),B.instancingMorph&&o.enable(2),B.matcap&&o.enable(3),B.envMap&&o.enable(4),B.normalMapObjectSpace&&o.enable(5),B.normalMapTangentSpace&&o.enable(6),B.clearcoat&&o.enable(7),B.iridescence&&o.enable(8),B.alphaTest&&o.enable(9),B.vertexColors&&o.enable(10),B.vertexAlphas&&o.enable(11),B.vertexUv1s&&o.enable(12),B.vertexUv2s&&o.enable(13),B.vertexUv3s&&o.enable(14),B.vertexTangents&&o.enable(15),B.anisotropy&&o.enable(16),B.alphaHash&&o.enable(17),B.batching&&o.enable(18),B.dispersion&&o.enable(19),B.batchingColor&&o.enable(20),B.gradientMap&&o.enable(21),B.packedNormalMap&&o.enable(22),B.vertexNormals&&o.enable(23),C.push(o.mask),o.disableAll(),B.fog&&o.enable(0),B.useFog&&o.enable(1),B.flatShading&&o.enable(2),B.logarithmicDepthBuffer&&o.enable(3),B.reversedDepthBuffer&&o.enable(4),B.skinning&&o.enable(5),B.morphTargets&&o.enable(6),B.morphNormals&&o.enable(7),B.morphColors&&o.enable(8),B.premultipliedAlpha&&o.enable(9),B.shadowMapEnabled&&o.enable(10),B.doubleSided&&o.enable(11),B.flipSided&&o.enable(12),B.useDepthPacking&&o.enable(13),B.dithering&&o.enable(14),B.transmission&&o.enable(15),B.sheen&&o.enable(16),B.opaque&&o.enable(17),B.pointsUvs&&o.enable(18),B.decodeVideoTexture&&o.enable(19),B.decodeVideoTextureEmissive&&o.enable(20),B.alphaToCoverage&&o.enable(21),B.numLightProbeGrids>0&&o.enable(22),B.hasPositionAttribute&&o.enable(23),C.push(o.mask)}function P(C){let B=A[C.type],k;if(B){let z=Ha[B];k=mg.clone(z.uniforms)}else k=C.uniforms;return k}function I(C,B){let k=u.get(B);return k!==void 0?++k.usedTimes:(k=new wxe(i,B,C,r),c.push(k),u.set(B,k)),k}function F(C){if(--C.usedTimes===0){let B=c.indexOf(C);c[B]=c[c.length-1],c.pop(),u.delete(C.cacheKey),C.destroy()}}function D(C){a.remove(C)}function L(){a.dispose()}return{getParameters:w,getProgramCacheKey:S,getUniforms:P,acquireProgram:I,releaseProgram:F,releaseShaderCache:D,programs:c,dispose:L}}function Mxe(){let i=new WeakMap;function e(o){return i.has(o)}function t(o){let a=i.get(o);return a===void 0&&(a={},i.set(o,a)),a}function n(o){i.delete(o)}function r(o,a,l){i.get(o)[a]=l}function s(){i=new WeakMap}return{has:e,get:t,remove:n,update:r,dispose:s}}function Cxe(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.material.id!==e.material.id?i.material.id-e.material.id:i.materialVariant!==e.materialVariant?i.materialVariant-e.materialVariant:i.z!==e.z?i.z-e.z:i.id-e.id}function QZ(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?e.z-i.z:i.id-e.id}function JZ(){let i=[],e=0,t=[],n=[],r=[];function s(){e=0,t.length=0,n.length=0,r.length=0}function o(d){let A=0;return d.isInstancedMesh&&(A+=2),d.isSkinnedMesh&&(A+=1),A}function a(d,A,y,w,S,T){let R=i[e];return R===void 0?(R={id:d.id,object:d,geometry:A,material:y,materialVariant:o(d),groupOrder:w,renderOrder:d.renderOrder,z:S,group:T},i[e]=R):(R.id=d.id,R.object=d,R.geometry=A,R.material=y,R.materialVariant=o(d),R.groupOrder=w,R.renderOrder=d.renderOrder,R.z=S,R.group=T),e++,R}function l(d,A,y,w,S,T){let R=a(d,A,y,w,S,T);y.transmission>0?n.push(R):y.transparent===!0?r.push(R):t.push(R)}function c(d,A,y,w,S,T){let R=a(d,A,y,w,S,T);y.transmission>0?n.unshift(R):y.transparent===!0?r.unshift(R):t.unshift(R)}function u(d,A,y){t.length>1&&t.sort(d||Cxe),n.length>1&&n.sort(A||QZ),r.length>1&&r.sort(A||QZ),y&&(t.reverse(),n.reverse(),r.reverse())}function f(){for(let d=e,A=i.length;d<A;d++){let y=i[d];if(y.id===null)break;y.id=null,y.object=null,y.geometry=null,y.material=null,y.group=null}}return{opaque:t,transmissive:n,transparent:r,init:s,push:l,unshift:c,finish:f,sort:u}}function Rxe(){let i=new WeakMap;function e(n,r){let s=i.get(n),o;return s===void 0?(o=new JZ,i.set(n,[o])):r>=s.length?(o=new JZ,s.push(o)):o=s[r],o}function t(){i=new WeakMap}return{get:e,dispose:t}}function Ixe(){let i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new re,color:new zt};break;case"SpotLight":t={position:new re,direction:new re,color:new zt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new re,color:new zt,distance:0,decay:0};break;case"HemisphereLight":t={direction:new re,skyColor:new zt,groundColor:new zt};break;case"RectAreaLight":t={color:new zt,position:new re,halfWidth:new re,halfHeight:new re};break}return i[e.id]=t,t}}}function Pxe(){let i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Oe};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Oe};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Oe,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[e.id]=t,t}}}var Lxe=0;function Dxe(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function Nxe(i){let e=new Ixe,t=Pxe(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)n.probe.push(new re);let r=new re,s=new cn,o=new cn;function a(c){let u=0,f=0,d=0;for(let B=0;B<9;B++)n.probe[B].set(0,0,0);let A=0,y=0,w=0,S=0,T=0,R=0,P=0,I=0,F=0,D=0,L=0;c.sort(Dxe);for(let B=0,k=c.length;B<k;B++){let z=c[B],G=z.color,W=z.intensity,Y=z.distance,H=null;if(z.shadow&&z.shadow.map&&(z.shadow.map.texture.format===js?H=z.shadow.map.texture:H=z.shadow.map.depthTexture||z.shadow.map.texture),z.isAmbientLight)u+=G.r*W,f+=G.g*W,d+=G.b*W;else if(z.isLightProbe){for(let $=0;$<9;$++)n.probe[$].addScaledVector(z.sh.coefficients[$],W);L++}else if(z.isDirectionalLight){let $=e.get(z);if($.color.copy(z.color).multiplyScalar(z.intensity),z.castShadow){let J=z.shadow,te=t.get(z);te.shadowIntensity=J.intensity,te.shadowBias=J.bias,te.shadowNormalBias=J.normalBias,te.shadowRadius=J.radius,te.shadowMapSize=J.mapSize,n.directionalShadow[A]=te,n.directionalShadowMap[A]=H,n.directionalShadowMatrix[A]=z.shadow.matrix,R++}n.directional[A]=$,A++}else if(z.isSpotLight){let $=e.get(z);$.position.setFromMatrixPosition(z.matrixWorld),$.color.copy(G).multiplyScalar(W),$.distance=Y,$.coneCos=Math.cos(z.angle),$.penumbraCos=Math.cos(z.angle*(1-z.penumbra)),$.decay=z.decay,n.spot[w]=$;let J=z.shadow;if(z.map&&(n.spotLightMap[F]=z.map,F++,J.updateMatrices(z),z.castShadow&&D++),n.spotLightMatrix[w]=J.matrix,z.castShadow){let te=t.get(z);te.shadowIntensity=J.intensity,te.shadowBias=J.bias,te.shadowNormalBias=J.normalBias,te.shadowRadius=J.radius,te.shadowMapSize=J.mapSize,n.spotShadow[w]=te,n.spotShadowMap[w]=H,I++}w++}else if(z.isRectAreaLight){let $=e.get(z);$.color.copy(G).multiplyScalar(W),$.halfWidth.set(z.width*.5,0,0),$.halfHeight.set(0,z.height*.5,0),n.rectArea[S]=$,S++}else if(z.isPointLight){let $=e.get(z);if($.color.copy(z.color).multiplyScalar(z.intensity),$.distance=z.distance,$.decay=z.decay,z.castShadow){let J=z.shadow,te=t.get(z);te.shadowIntensity=J.intensity,te.shadowBias=J.bias,te.shadowNormalBias=J.normalBias,te.shadowRadius=J.radius,te.shadowMapSize=J.mapSize,te.shadowCameraNear=J.camera.near,te.shadowCameraFar=J.camera.far,n.pointShadow[y]=te,n.pointShadowMap[y]=H,n.pointShadowMatrix[y]=z.shadow.matrix,P++}n.point[y]=$,y++}else if(z.isHemisphereLight){let $=e.get(z);$.skyColor.copy(z.color).multiplyScalar(W),$.groundColor.copy(z.groundColor).multiplyScalar(W),n.hemi[T]=$,T++}}S>0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=Nt.LTC_FLOAT_1,n.rectAreaLTC2=Nt.LTC_FLOAT_2):(n.rectAreaLTC1=Nt.LTC_HALF_1,n.rectAreaLTC2=Nt.LTC_HALF_2)),n.ambient[0]=u,n.ambient[1]=f,n.ambient[2]=d;let C=n.hash;(C.directionalLength!==A||C.pointLength!==y||C.spotLength!==w||C.rectAreaLength!==S||C.hemiLength!==T||C.numDirectionalShadows!==R||C.numPointShadows!==P||C.numSpotShadows!==I||C.numSpotMaps!==F||C.numLightProbes!==L)&&(n.directional.length=A,n.spot.length=w,n.rectArea.length=S,n.point.length=y,n.hemi.length=T,n.directionalShadow.length=R,n.directionalShadowMap.length=R,n.pointShadow.length=P,n.pointShadowMap.length=P,n.spotShadow.length=I,n.spotShadowMap.length=I,n.directionalShadowMatrix.length=R,n.pointShadowMatrix.length=P,n.spotLightMatrix.length=I+F-D,n.spotLightMap.length=F,n.numSpotLightShadowsWithMaps=D,n.numLightProbes=L,C.directionalLength=A,C.pointLength=y,C.spotLength=w,C.rectAreaLength=S,C.hemiLength=T,C.numDirectionalShadows=R,C.numPointShadows=P,C.numSpotShadows=I,C.numSpotMaps=F,C.numLightProbes=L,n.version=Lxe++)}function l(c,u){let f=0,d=0,A=0,y=0,w=0,S=u.matrixWorldInverse;for(let T=0,R=c.length;T<R;T++){let P=c[T];if(P.isDirectionalLight){let I=n.directional[f];I.direction.setFromMatrixPosition(P.matrixWorld),r.setFromMatrixPosition(P.target.matrixWorld),I.direction.sub(r),I.direction.transformDirection(S),f++}else if(P.isSpotLight){let I=n.spot[A];I.position.setFromMatrixPosition(P.matrixWorld),I.position.applyMatrix4(S),I.direction.setFromMatrixPosition(P.matrixWorld),r.setFromMatrixPosition(P.target.matrixWorld),I.direction.sub(r),I.direction.transformDirection(S),A++}else if(P.isRectAreaLight){let I=n.rectArea[y];I.position.setFromMatrixPosition(P.matrixWorld),I.position.applyMatrix4(S),o.identity(),s.copy(P.matrixWorld),s.premultiply(S),o.extractRotation(s),I.halfWidth.set(P.width*.5,0,0),I.halfHeight.set(0,P.height*.5,0),I.halfWidth.applyMatrix4(o),I.halfHeight.applyMatrix4(o),y++}else if(P.isPointLight){let I=n.point[d];I.position.setFromMatrixPosition(P.matrixWorld),I.position.applyMatrix4(S),d++}else if(P.isHemisphereLight){let I=n.hemi[w];I.direction.setFromMatrixPosition(P.matrixWorld),I.direction.transformDirection(S),w++}}}return{setup:a,setupView:l,state:n}}function eK(i){let e=new Nxe(i),t=[],n=[],r=[];function s(d){f.camera=d,t.length=0,n.length=0,r.length=0}function o(d){t.push(d)}function a(d){n.push(d)}function l(d){r.push(d)}function c(){e.setup(t)}function u(d){e.setupView(t,d)}let f={lightsArray:t,shadowsArray:n,lightProbeGridArray:r,camera:null,lights:e,transmissionRenderTarget:{},textureUnits:0};return{init:s,state:f,setupLights:c,setupLightsView:u,pushLight:o,pushShadow:a,pushLightProbeGrid:l}}function Fxe(i){let e=new WeakMap;function t(r,s=0){let o=e.get(r),a;return o===void 0?(a=new eK(i),e.set(r,[a])):s>=o.length?(a=new eK(i),o.push(a)):a=o[s],a}function n(){e=new WeakMap}return{get:t,dispose:n}}var Bxe=`void main() {40674067 gl_Position = vec4( position, 1.0 );4068-}`,gxe=`uniform sampler2D shadow_pass;4068+}`,Oxe=`uniform sampler2D shadow_pass;40694069 uniform vec2 resolution;40704070 uniform float radius;40714071 void main() {@@ -4090,12 +4090,12 @@ void main() {
40904090 squared_mean = squared_mean / samples;40914091 float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );40924092 gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );4093-}`,vxe=[new re(1,0,0),new re(-1,0,0),new re(0,1,0),new re(0,-1,0),new re(0,0,1),new re(0,0,-1)],_xe=[new re(0,-1,0),new re(0,-1,0),new re(0,0,1),new re(0,0,-1),new re(0,-1,0),new re(0,-1,0)],jZ=new cn,kb=new re,_F=new re;function xxe(i,e,t){let n=new Gc,r=new Oe,s=new Oe,o=new xn,a=new dM,l=new pM,c={},u=t.maxTextureSize,f={[ko]:mi,[mi]:ko,[vr]:vr},d=new ds({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Oe},radius:{value:4}},vertexShader:Axe,fragmentShader:gxe}),A=d.clone();A.defines.HORIZONTAL_PASS=1;let y=new Xn;y.setAttribute("position",new Hi(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let w=new Hn(y,d),S=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=p0;let T=this.type;this.render=function(D,L,C){if(S.enabled===!1||S.autoUpdate===!1&&S.needsUpdate===!1||D.length===0)return;this.type===IM&&(Xe("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=p0);let B=i.getRenderTarget(),k=i.getActiveCubeFace(),z=i.getActiveMipmapLevel(),G=i.state;G.setBlending(ps),G.buffers.depth.getReversed()===!0?G.buffers.color.setClear(0,0,0,0):G.buffers.color.setClear(1,1,1,1),G.buffers.depth.setTest(!0),G.setScissorTest(!1);let W=T!==this.type;W&&L.traverse(function(Y){Y.material&&(Array.isArray(Y.material)?Y.material.forEach(H=>H.needsUpdate=!0):Y.material.needsUpdate=!0)});for(let Y=0,H=D.length;Y<H;Y++){let $=D[Y],J=$.shadow;if(J===void 0){Xe("WebGLShadowMap:",$,"has no shadow.");continue}if(J.autoUpdate===!1&&J.needsUpdate===!1)continue;r.copy(J.mapSize);let te=J.getFrameExtents();r.multiply(te),s.copy(J.mapSize),(r.x>u||r.y>u)&&(r.x>u&&(s.x=Math.floor(u/te.x),r.x=s.x*te.x,J.mapSize.x=s.x),r.y>u&&(s.y=Math.floor(u/te.y),r.y=s.y*te.y,J.mapSize.y=s.y));let ce=i.state.buffers.depth.getReversed();if(J.camera._reversedDepth=ce,J.map===null||W===!0){if(J.map!==null&&(J.map.depthTexture!==null&&(J.map.depthTexture.dispose(),J.map.depthTexture=null),J.map.dispose()),this.type===qc){if($.isPointLight){Xe("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}J.map=new Ba(r.x,r.y,{format:js,type:Wi,minFilter:Mi,magFilter:Mi,generateMipmaps:!1}),J.map.texture.name=$.name+".shadowMap",J.map.depthTexture=new Cs(r.x,r.y,cr),J.map.depthTexture.name=$.name+".shadowMapDepth",J.map.depthTexture.format=Gs,J.map.depthTexture.compareFunction=null,J.map.depthTexture.minFilter=Ti,J.map.depthTexture.magFilter=Ti}else $.isPointLight?(J.map=new GM(r.x),J.map.depthTexture=new e_(r.x,xi)):(J.map=new Ba(r.x,r.y),J.map.depthTexture=new Cs(r.x,r.y,xi)),J.map.depthTexture.name=$.name+".shadowMap",J.map.depthTexture.format=Gs,this.type===p0?(J.map.depthTexture.compareFunction=ce?Fu:Yh,J.map.depthTexture.minFilter=Mi,J.map.depthTexture.magFilter=Mi):(J.map.depthTexture.compareFunction=null,J.map.depthTexture.minFilter=Ti,J.map.depthTexture.magFilter=Ti);J.camera.updateProjectionMatrix()}let he=J.map.isWebGLCubeRenderTarget?6:1;for(let ve=0;ve<he;ve++){if(J.map.isWebGLCubeRenderTarget)i.setRenderTarget(J.map,ve),i.clear();else{ve===0&&(i.setRenderTarget(J.map),i.clear());let Re=J.getViewport(ve);o.set(s.x*Re.x,s.y*Re.y,s.x*Re.z,s.y*Re.w),G.viewport(o)}if($.isPointLight){let Re=J.camera,Qe=J.matrix,Fe=$.distance||Re.far;Fe!==Re.far&&(Re.far=Fe,Re.updateProjectionMatrix()),kb.setFromMatrixPosition($.matrixWorld),Re.position.copy(kb),_F.copy(Re.position),_F.add(vxe[ve]),Re.up.copy(_xe[ve]),Re.lookAt(_F),Re.updateMatrixWorld(),Qe.makeTranslation(-kb.x,-kb.y,-kb.z),jZ.multiplyMatrices(Re.projectionMatrix,Re.matrixWorldInverse),J._frustum.setFromProjectionMatrix(jZ,Re.coordinateSystem,Re.reversedDepth)}else J.updateMatrices($);n=J.getFrustum(),I(L,C,J.camera,$,this.type)}J.isPointLightShadow!==!0&&this.type===qc&&R(J,C),J.needsUpdate=!1}T=this.type,S.needsUpdate=!1,i.setRenderTarget(B,k,z)};function R(D,L){let C=e.update(w);d.defines.VSM_SAMPLES!==D.blurSamples&&(d.defines.VSM_SAMPLES=D.blurSamples,A.defines.VSM_SAMPLES=D.blurSamples,d.needsUpdate=!0,A.needsUpdate=!0),D.mapPass===null&&(D.mapPass=new Ba(r.x,r.y,{format:js,type:Wi})),d.uniforms.shadow_pass.value=D.map.depthTexture,d.uniforms.resolution.value=D.mapSize,d.uniforms.radius.value=D.radius,i.setRenderTarget(D.mapPass),i.clear(),i.renderBufferDirect(L,null,C,d,w,null),A.uniforms.shadow_pass.value=D.mapPass.texture,A.uniforms.resolution.value=D.mapSize,A.uniforms.radius.value=D.radius,i.setRenderTarget(D.map),i.clear(),i.renderBufferDirect(L,null,C,A,w,null)}function P(D,L,C,B){let k=null,z=C.isPointLight===!0?D.customDistanceMaterial:D.customDepthMaterial;if(z!==void 0)k=z;else if(k=C.isPointLight===!0?l:a,i.localClippingEnabled&&L.clipShadows===!0&&Array.isArray(L.clippingPlanes)&&L.clippingPlanes.length!==0||L.displacementMap&&L.displacementScale!==0||L.alphaMap&&L.alphaTest>0||L.map&&L.alphaTest>0||L.alphaToCoverage===!0){let G=k.uuid,W=L.uuid,Y=c[G];Y===void 0&&(Y={},c[G]=Y);let H=Y[W];H===void 0&&(H=k.clone(),Y[W]=H,L.addEventListener("dispose",F)),k=H}if(k.visible=L.visible,k.wireframe=L.wireframe,B===qc?k.side=L.shadowSide!==null?L.shadowSide:L.side:k.side=L.shadowSide!==null?L.shadowSide:f[L.side],k.alphaMap=L.alphaMap,k.alphaTest=L.alphaToCoverage===!0?.5:L.alphaTest,k.map=L.map,k.clipShadows=L.clipShadows,k.clippingPlanes=L.clippingPlanes,k.clipIntersection=L.clipIntersection,k.displacementMap=L.displacementMap,k.displacementScale=L.displacementScale,k.displacementBias=L.displacementBias,k.wireframeLinewidth=L.wireframeLinewidth,k.linewidth=L.linewidth,C.isPointLight===!0&&k.isMeshDistanceMaterial===!0){let G=i.properties.get(k);G.light=C}return k}function I(D,L,C,B,k){if(D.visible===!1)return;if(D.layers.test(L.layers)&&(D.isMesh||D.isLine||D.isPoints)&&(D.castShadow||D.receiveShadow&&k===qc)&&(!D.frustumCulled||n.intersectsObject(D))){D.modelViewMatrix.multiplyMatrices(C.matrixWorldInverse,D.matrixWorld);let W=e.update(D),Y=D.material;if(Array.isArray(Y)){let H=W.groups;for(let $=0,J=H.length;$<J;$++){let te=H[$],ce=Y[te.materialIndex];if(ce&&ce.visible){let he=P(D,ce,B,k);D.onBeforeShadow(i,D,L,C,W,he,te),i.renderBufferDirect(C,null,W,he,D,te),D.onAfterShadow(i,D,L,C,W,he,te)}}}else if(Y.visible){let H=P(D,Y,B,k);D.onBeforeShadow(i,D,L,C,W,H,null),i.renderBufferDirect(C,null,W,H,D,null),D.onAfterShadow(i,D,L,C,W,H,null)}}let G=D.children;for(let W=0,Y=G.length;W<Y;W++)I(G[W],L,C,B,k)}function F(D){D.target.removeEventListener("dispose",F);for(let C in c){let B=c[C],k=D.target.uuid;k in B&&(B[k].dispose(),delete B[k])}}}function yxe(i,e){function t(){let ye=!1,wt=new xn,Ze=null,St=new xn(0,0,0,0);return{setMask:function(Bt){Ze!==Bt&&!ye&&(i.colorMask(Bt,Bt,Bt,Bt),Ze=Bt)},setLocked:function(Bt){ye=Bt},setClear:function(Bt,ut,Ce,Yt,nr){nr===!0&&(Bt*=Yt,ut*=Yt,Ce*=Yt),wt.set(Bt,ut,Ce,Yt),St.equals(wt)===!1&&(i.clearColor(Bt,ut,Ce,Yt),St.copy(wt))},reset:function(){ye=!1,Ze=null,St.set(-1,0,0,0)}}}function n(){let ye=!1,wt=!1,Ze=null,St=null,Bt=null;return{setReversed:function(ut){if(wt!==ut){let Ce=e.get("EXT_clip_control");ut?Ce.clipControlEXT(Ce.LOWER_LEFT_EXT,Ce.ZERO_TO_ONE_EXT):Ce.clipControlEXT(Ce.LOWER_LEFT_EXT,Ce.NEGATIVE_ONE_TO_ONE_EXT),wt=ut;let Yt=Bt;Bt=null,this.setClear(Yt)}},getReversed:function(){return wt},setTest:function(ut){ut?Ye(i.DEPTH_TEST):Mt(i.DEPTH_TEST)},setMask:function(ut){Ze!==ut&&!ye&&(i.depthMask(ut),Ze=ut)},setFunc:function(ut){if(wt&&(ut=Bb[ut]),St!==ut){switch(ut){case NA:i.depthFunc(i.NEVER);break;case FA:i.depthFunc(i.ALWAYS);break;case BA:i.depthFunc(i.LESS);break;case Ih:i.depthFunc(i.LEQUAL);break;case OA:i.depthFunc(i.EQUAL);break;case UA:i.depthFunc(i.GEQUAL);break;case kA:i.depthFunc(i.GREATER);break;case zA:i.depthFunc(i.NOTEQUAL);break;default:i.depthFunc(i.LEQUAL)}St=ut}},setLocked:function(ut){ye=ut},setClear:function(ut){Bt!==ut&&(Bt=ut,wt&&(ut=1-ut),i.clearDepth(ut))},reset:function(){ye=!1,Ze=null,St=null,Bt=null,wt=!1}}}function r(){let ye=!1,wt=null,Ze=null,St=null,Bt=null,ut=null,Ce=null,Yt=null,nr=null;return{setTest:function(Fn){ye||(Fn?Ye(i.STENCIL_TEST):Mt(i.STENCIL_TEST))},setMask:function(Fn){wt!==Fn&&!ye&&(i.stencilMask(Fn),wt=Fn)},setFunc:function(Fn,is,Lr){(Ze!==Fn||St!==is||Bt!==Lr)&&(i.stencilFunc(Fn,is,Lr),Ze=Fn,St=is,Bt=Lr)},setOp:function(Fn,is,Lr){(ut!==Fn||Ce!==is||Yt!==Lr)&&(i.stencilOp(Fn,is,Lr),ut=Fn,Ce=is,Yt=Lr)},setLocked:function(Fn){ye=Fn},setClear:function(Fn){nr!==Fn&&(i.clearStencil(Fn),nr=Fn)},reset:function(){ye=!1,wt=null,Ze=null,St=null,Bt=null,ut=null,Ce=null,Yt=null,nr=null}}}let s=new t,o=new n,a=new r,l=new WeakMap,c=new WeakMap,u={},f={},d={},A=new WeakMap,y=[],w=null,S=!1,T=null,R=null,P=null,I=null,F=null,D=null,L=null,C=new zt(0,0,0),B=0,k=!1,z=null,G=null,W=null,Y=null,H=null,$=i.getParameter(i.MAX_COMBINED_TEXTURE_IMAGE_UNITS),J=!1,te=0,ce=i.getParameter(i.VERSION);ce.indexOf("WebGL")!==-1?(te=parseFloat(/^WebGL (\d)/.exec(ce)[1]),J=te>=1):ce.indexOf("OpenGL ES")!==-1&&(te=parseFloat(/^OpenGL ES (\d)/.exec(ce)[1]),J=te>=2);let he=null,ve={},Re=i.getParameter(i.SCISSOR_BOX),Qe=i.getParameter(i.VIEWPORT),Fe=new xn().fromArray(Re),mt=new xn().fromArray(Qe);function Ee(ye,wt,Ze,St){let Bt=new Uint8Array(4),ut=i.createTexture();i.bindTexture(ye,ut),i.texParameteri(ye,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(ye,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let Ce=0;Ce<Ze;Ce++)ye===i.TEXTURE_3D||ye===i.TEXTURE_2D_ARRAY?i.texImage3D(wt,0,i.RGBA,1,1,St,0,i.RGBA,i.UNSIGNED_BYTE,Bt):i.texImage2D(wt+Ce,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,Bt);return ut}let Ve={};Ve[i.TEXTURE_2D]=Ee(i.TEXTURE_2D,i.TEXTURE_2D,1),Ve[i.TEXTURE_CUBE_MAP]=Ee(i.TEXTURE_CUBE_MAP,i.TEXTURE_CUBE_MAP_POSITIVE_X,6),Ve[i.TEXTURE_2D_ARRAY]=Ee(i.TEXTURE_2D_ARRAY,i.TEXTURE_2D_ARRAY,1,1),Ve[i.TEXTURE_3D]=Ee(i.TEXTURE_3D,i.TEXTURE_3D,1,1),s.setClear(0,0,0,1),o.setClear(1),a.setClear(0),Ye(i.DEPTH_TEST),o.setFunc(Ih),bt(!1),yt(ub),Ye(i.CULL_FACE),ot(ps);function Ye(ye){u[ye]!==!0&&(i.enable(ye),u[ye]=!0)}function Mt(ye){u[ye]!==!1&&(i.disable(ye),u[ye]=!1)}function Et(ye,wt){return d[ye]!==wt?(i.bindFramebuffer(ye,wt),d[ye]=wt,ye===i.DRAW_FRAMEBUFFER&&(d[i.FRAMEBUFFER]=wt),ye===i.FRAMEBUFFER&&(d[i.DRAW_FRAMEBUFFER]=wt),!0):!1}function It(ye,wt){let Ze=y,St=!1;if(ye){Ze=A.get(wt),Ze===void 0&&(Ze=[],A.set(wt,Ze));let Bt=ye.textures;if(Ze.length!==Bt.length||Ze[0]!==i.COLOR_ATTACHMENT0){for(let ut=0,Ce=Bt.length;ut<Ce;ut++)Ze[ut]=i.COLOR_ATTACHMENT0+ut;Ze.length=Bt.length,St=!0}}else Ze[0]!==i.BACK&&(Ze[0]=i.BACK,St=!0);St&&i.drawBuffers(Ze)}function dn(ye){return w!==ye?(i.useProgram(ye),w=ye,!0):!1}let Gt={[oo]:i.FUNC_ADD,[fb]:i.FUNC_SUBTRACT,[db]:i.FUNC_REVERSE_SUBTRACT};Gt[PM]=i.MIN,Gt[LM]=i.MAX;let $e={[Nu]:i.ZERO,[pb]:i.ONE,[mb]:i.SRC_COLOR,[e0]:i.SRC_ALPHA,[yb]:i.SRC_ALPHA_SATURATE,[_b]:i.DST_COLOR,[gb]:i.DST_ALPHA,[Ab]:i.ONE_MINUS_SRC_COLOR,[t0]:i.ONE_MINUS_SRC_ALPHA,[xb]:i.ONE_MINUS_DST_COLOR,[vb]:i.ONE_MINUS_DST_ALPHA,[hZ]:i.CONSTANT_COLOR,[fZ]:i.ONE_MINUS_CONSTANT_COLOR,[dZ]:i.CONSTANT_ALPHA,[pZ]:i.ONE_MINUS_CONSTANT_ALPHA};function ot(ye,wt,Ze,St,Bt,ut,Ce,Yt,nr,Fn){if(ye===ps){S===!0&&(Mt(i.BLEND),S=!1);return}if(S===!1&&(Ye(i.BLEND),S=!0),ye!==Fd){if(ye!==T||Fn!==k){if((R!==oo||F!==oo)&&(i.blendEquation(i.FUNC_ADD),R=oo,F=oo),Fn)switch(ye){case Ms:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case Fh:i.blendFunc(i.ONE,i.ONE);break;case Bh:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case Oh:i.blendFuncSeparate(i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ZERO,i.ONE);break;default:ze("WebGLState: Invalid blending: ",ye);break}else switch(ye){case Ms:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case Fh:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE,i.ONE,i.ONE);break;case Bh:ze("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case Oh:ze("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:ze("WebGLState: Invalid blending: ",ye);break}P=null,I=null,D=null,L=null,C.set(0,0,0),B=0,T=ye,k=Fn}return}Bt=Bt||wt,ut=ut||Ze,Ce=Ce||St,(wt!==R||Bt!==F)&&(i.blendEquationSeparate(Gt[wt],Gt[Bt]),R=wt,F=Bt),(Ze!==P||St!==I||ut!==D||Ce!==L)&&(i.blendFuncSeparate($e[Ze],$e[St],$e[ut],$e[Ce]),P=Ze,I=St,D=ut,L=Ce),(Yt.equals(C)===!1||nr!==B)&&(i.blendColor(Yt.r,Yt.g,Yt.b,nr),C.copy(Yt),B=nr),T=ye,k=!1}function nt(ye,wt){ye.side===vr?Mt(i.CULL_FACE):Ye(i.CULL_FACE);let Ze=ye.side===mi;wt&&(Ze=!Ze),bt(Ze),ye.blending===Ms&&ye.transparent===!1?ot(ps):ot(ye.blending,ye.blendEquation,ye.blendSrc,ye.blendDst,ye.blendEquationAlpha,ye.blendSrcAlpha,ye.blendDstAlpha,ye.blendColor,ye.blendAlpha,ye.premultipliedAlpha),o.setFunc(ye.depthFunc),o.setTest(ye.depthTest),o.setMask(ye.depthWrite),s.setMask(ye.colorWrite);let St=ye.stencilWrite;a.setTest(St),St&&(a.setMask(ye.stencilWriteMask),a.setFunc(ye.stencilFunc,ye.stencilRef,ye.stencilFuncMask),a.setOp(ye.stencilFail,ye.stencilZFail,ye.stencilZPass)),en(ye.polygonOffset,ye.polygonOffsetFactor,ye.polygonOffsetUnits),ye.alphaToCoverage===!0?Ye(i.SAMPLE_ALPHA_TO_COVERAGE):Mt(i.SAMPLE_ALPHA_TO_COVERAGE)}function bt(ye){z!==ye&&(ye?i.frontFace(i.CW):i.frontFace(i.CCW),z=ye)}function yt(ye){ye!==CM?(Ye(i.CULL_FACE),ye!==G&&(ye===ub?i.cullFace(i.BACK):ye===RM?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK))):Mt(i.CULL_FACE),G=ye}function hn(ye){ye!==W&&(J&&i.lineWidth(ye),W=ye)}function en(ye,wt,Ze){ye?(Ye(i.POLYGON_OFFSET_FILL),(Y!==wt||H!==Ze)&&(Y=wt,H=Ze,o.getReversed()&&(wt=-wt),i.polygonOffset(wt,Ze))):Mt(i.POLYGON_OFFSET_FILL)}function tn(ye){ye?Ye(i.SCISSOR_TEST):Mt(i.SCISSOR_TEST)}function bn(ye){ye===void 0&&(ye=i.TEXTURE0+$-1),he!==ye&&(i.activeTexture(ye),he=ye)}function _e(ye,wt,Ze){Ze===void 0&&(he===null?Ze=i.TEXTURE0+$-1:Ze=he);let St=ve[Ze];St===void 0&&(St={type:void 0,texture:void 0},ve[Ze]=St),(St.type!==ye||St.texture!==wt)&&(he!==Ze&&(i.activeTexture(Ze),he=Ze),i.bindTexture(ye,wt||Ve[ye]),St.type=ye,St.texture=wt)}function vi(){let ye=ve[he];ye!==void 0&&ye.type!==void 0&&(i.bindTexture(ye.type,null),ye.type=void 0,ye.texture=void 0)}function zn(){try{i.compressedTexImage2D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function le(){try{i.compressedTexImage3D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function Z(){try{i.texSubImage2D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function Te(){try{i.texSubImage3D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function Pe(){try{i.compressedTexSubImage2D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function Ge(){try{i.compressedTexSubImage3D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function vt(){try{i.texStorage2D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function Tt(){try{i.texStorage3D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function qe(){try{i.texImage2D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function Je(){try{i.texImage3D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function Pt(ye){return f[ye]!==void 0?f[ye]:i.getParameter(ye)}function rn(ye,wt){f[ye]!==wt&&(i.pixelStorei(ye,wt),f[ye]=wt)}function Lt(ye){Fe.equals(ye)===!1&&(i.scissor(ye.x,ye.y,ye.z,ye.w),Fe.copy(ye))}function Rt(ye){mt.equals(ye)===!1&&(i.viewport(ye.x,ye.y,ye.z,ye.w),mt.copy(ye))}function fn(ye,wt){let Ze=c.get(wt);Ze===void 0&&(Ze=new WeakMap,c.set(wt,Ze));let St=Ze.get(ye);St===void 0&&(St=i.getUniformBlockIndex(wt,ye.name),Ze.set(ye,St))}function wn(ye,wt){let St=c.get(wt).get(ye);l.get(wt)!==St&&(i.uniformBlockBinding(wt,St,ye.__bindingPointIndex),l.set(wt,St))}function Dn(){i.disable(i.BLEND),i.disable(i.CULL_FACE),i.disable(i.DEPTH_TEST),i.disable(i.POLYGON_OFFSET_FILL),i.disable(i.SCISSOR_TEST),i.disable(i.STENCIL_TEST),i.disable(i.SAMPLE_ALPHA_TO_COVERAGE),i.blendEquation(i.FUNC_ADD),i.blendFunc(i.ONE,i.ZERO),i.blendFuncSeparate(i.ONE,i.ZERO,i.ONE,i.ZERO),i.blendColor(0,0,0,0),i.colorMask(!0,!0,!0,!0),i.clearColor(0,0,0,0),i.depthMask(!0),i.depthFunc(i.LESS),o.setReversed(!1),i.clearDepth(1),i.stencilMask(4294967295),i.stencilFunc(i.ALWAYS,0,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.KEEP),i.clearStencil(0),i.cullFace(i.BACK),i.frontFace(i.CCW),i.polygonOffset(0,0),i.activeTexture(i.TEXTURE0),i.bindFramebuffer(i.FRAMEBUFFER,null),i.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),i.bindFramebuffer(i.READ_FRAMEBUFFER,null),i.useProgram(null),i.lineWidth(1),i.scissor(0,0,i.canvas.width,i.canvas.height),i.viewport(0,0,i.canvas.width,i.canvas.height),i.pixelStorei(i.PACK_ALIGNMENT,4),i.pixelStorei(i.UNPACK_ALIGNMENT,4),i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,!1),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,i.BROWSER_DEFAULT_WEBGL),i.pixelStorei(i.PACK_ROW_LENGTH,0),i.pixelStorei(i.PACK_SKIP_PIXELS,0),i.pixelStorei(i.PACK_SKIP_ROWS,0),i.pixelStorei(i.UNPACK_ROW_LENGTH,0),i.pixelStorei(i.UNPACK_IMAGE_HEIGHT,0),i.pixelStorei(i.UNPACK_SKIP_PIXELS,0),i.pixelStorei(i.UNPACK_SKIP_ROWS,0),i.pixelStorei(i.UNPACK_SKIP_IMAGES,0),u={},f={},he=null,ve={},d={},A=new WeakMap,y=[],w=null,S=!1,T=null,R=null,P=null,I=null,F=null,D=null,L=null,C=new zt(0,0,0),B=0,k=!1,z=null,G=null,W=null,Y=null,H=null,Fe.set(0,0,i.canvas.width,i.canvas.height),mt.set(0,0,i.canvas.width,i.canvas.height),s.reset(),o.reset(),a.reset()}return{buffers:{color:s,depth:o,stencil:a},enable:Ye,disable:Mt,bindFramebuffer:Et,drawBuffers:It,useProgram:dn,setBlending:ot,setMaterial:nt,setFlipSided:bt,setCullFace:yt,setLineWidth:hn,setPolygonOffset:en,setScissorTest:tn,activeTexture:bn,bindTexture:_e,unbindTexture:vi,compressedTexImage2D:zn,compressedTexImage3D:le,texImage2D:qe,texImage3D:Je,pixelStorei:rn,getParameter:Pt,updateUBOMapping:fn,uniformBlockBinding:wn,texStorage2D:vt,texStorage3D:Tt,texSubImage2D:Z,texSubImage3D:Te,compressedTexSubImage2D:Pe,compressedTexSubImage3D:Ge,scissor:Lt,viewport:Rt,reset:Dn}}function bxe(i,e,t,n,r,s,o){let a=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new Oe,u=new WeakMap,f=new Set,d,A=new WeakMap,y=!1;try{y=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function w(le,Z){return y?new OffscreenCanvas(le,Z):$v("canvas")}function S(le,Z,Te){let Pe=1,Ge=zn(le);if((Ge.width>Te||Ge.height>Te)&&(Pe=Te/Math.max(Ge.width,Ge.height)),Pe<1)if(typeof HTMLImageElement<"u"&&le instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&le instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&le instanceof ImageBitmap||typeof VideoFrame<"u"&&le instanceof VideoFrame){let vt=Math.floor(Pe*Ge.width),Tt=Math.floor(Pe*Ge.height);d===void 0&&(d=w(vt,Tt));let qe=Z?w(vt,Tt):d;return qe.width=vt,qe.height=Tt,qe.getContext("2d").drawImage(le,0,0,vt,Tt),Xe("WebGLRenderer: Texture has been resized from ("+Ge.width+"x"+Ge.height+") to ("+vt+"x"+Tt+")."),qe}else return"data"in le&&Xe("WebGLRenderer: Image in DataTexture is too big ("+Ge.width+"x"+Ge.height+")."),le;return le}function T(le){return le.generateMipmaps}function R(le){i.generateMipmap(le)}function P(le){return le.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:le.isWebGL3DRenderTarget?i.TEXTURE_3D:le.isWebGLArrayRenderTarget||le.isCompressedArrayTexture?i.TEXTURE_2D_ARRAY:i.TEXTURE_2D}function I(le,Z,Te,Pe,Ge,vt=!1){if(le!==null){if(i[le]!==void 0)return i[le];Xe("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+le+"'")}let Tt;Pe&&(Tt=e.get("EXT_texture_norm16"),Tt||Xe("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let qe=Z;if(Z===i.RED&&(Te===i.FLOAT&&(qe=i.R32F),Te===i.HALF_FLOAT&&(qe=i.R16F),Te===i.UNSIGNED_BYTE&&(qe=i.R8),Te===i.UNSIGNED_SHORT&&Tt&&(qe=Tt.R16_EXT),Te===i.SHORT&&Tt&&(qe=Tt.R16_SNORM_EXT)),Z===i.RED_INTEGER&&(Te===i.UNSIGNED_BYTE&&(qe=i.R8UI),Te===i.UNSIGNED_SHORT&&(qe=i.R16UI),Te===i.UNSIGNED_INT&&(qe=i.R32UI),Te===i.BYTE&&(qe=i.R8I),Te===i.SHORT&&(qe=i.R16I),Te===i.INT&&(qe=i.R32I)),Z===i.RG&&(Te===i.FLOAT&&(qe=i.RG32F),Te===i.HALF_FLOAT&&(qe=i.RG16F),Te===i.UNSIGNED_BYTE&&(qe=i.RG8),Te===i.UNSIGNED_SHORT&&Tt&&(qe=Tt.RG16_EXT),Te===i.SHORT&&Tt&&(qe=Tt.RG16_SNORM_EXT)),Z===i.RG_INTEGER&&(Te===i.UNSIGNED_BYTE&&(qe=i.RG8UI),Te===i.UNSIGNED_SHORT&&(qe=i.RG16UI),Te===i.UNSIGNED_INT&&(qe=i.RG32UI),Te===i.BYTE&&(qe=i.RG8I),Te===i.SHORT&&(qe=i.RG16I),Te===i.INT&&(qe=i.RG32I)),Z===i.RGB_INTEGER&&(Te===i.UNSIGNED_BYTE&&(qe=i.RGB8UI),Te===i.UNSIGNED_SHORT&&(qe=i.RGB16UI),Te===i.UNSIGNED_INT&&(qe=i.RGB32UI),Te===i.BYTE&&(qe=i.RGB8I),Te===i.SHORT&&(qe=i.RGB16I),Te===i.INT&&(qe=i.RGB32I)),Z===i.RGBA_INTEGER&&(Te===i.UNSIGNED_BYTE&&(qe=i.RGBA8UI),Te===i.UNSIGNED_SHORT&&(qe=i.RGBA16UI),Te===i.UNSIGNED_INT&&(qe=i.RGBA32UI),Te===i.BYTE&&(qe=i.RGBA8I),Te===i.SHORT&&(qe=i.RGBA16I),Te===i.INT&&(qe=i.RGBA32I)),Z===i.RGB&&(Te===i.UNSIGNED_SHORT&&Tt&&(qe=Tt.RGB16_EXT),Te===i.SHORT&&Tt&&(qe=Tt.RGB16_SNORM_EXT),Te===i.UNSIGNED_INT_5_9_9_9_REV&&(qe=i.RGB9_E5),Te===i.UNSIGNED_INT_10F_11F_11F_REV&&(qe=i.R11F_G11F_B10F)),Z===i.RGBA){let Je=vt?i0:ln.getTransfer(Ge);Te===i.FLOAT&&(qe=i.RGBA32F),Te===i.HALF_FLOAT&&(qe=i.RGBA16F),Te===i.UNSIGNED_BYTE&&(qe=Je===kt?i.SRGB8_ALPHA8:i.RGBA8),Te===i.UNSIGNED_SHORT&&Tt&&(qe=Tt.RGBA16_EXT),Te===i.SHORT&&Tt&&(qe=Tt.RGBA16_SNORM_EXT),Te===i.UNSIGNED_SHORT_4_4_4_4&&(qe=i.RGBA4),Te===i.UNSIGNED_SHORT_5_5_5_1&&(qe=i.RGB5_A1)}return(qe===i.R16F||qe===i.R32F||qe===i.RG16F||qe===i.RG32F||qe===i.RGBA16F||qe===i.RGBA32F)&&e.get("EXT_color_buffer_float"),qe}function F(le,Z){let Te;return le?Z===null||Z===xi||Z===ca?Te=i.DEPTH24_STENCIL8:Z===cr?Te=i.DEPTH32F_STENCIL8:Z===wl&&(Te=i.DEPTH24_STENCIL8,Xe("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):Z===null||Z===xi||Z===ca?Te=i.DEPTH_COMPONENT24:Z===cr?Te=i.DEPTH_COMPONENT32F:Z===wl&&(Te=i.DEPTH_COMPONENT16),Te}function D(le,Z){return T(le)===!0||le.isFramebufferTexture&&le.minFilter!==Ti&&le.minFilter!==Mi?Math.log2(Math.max(Z.width,Z.height))+1:le.mipmaps!==void 0&&le.mipmaps.length>0?le.mipmaps.length:le.isCompressedTexture&&Array.isArray(le.image)?Z.mipmaps.length:1}function L(le){let Z=le.target;Z.removeEventListener("dispose",L),B(Z),Z.isVideoTexture&&u.delete(Z),Z.isHTMLTexture&&f.delete(Z)}function C(le){let Z=le.target;Z.removeEventListener("dispose",C),z(Z)}function B(le){let Z=n.get(le);if(Z.__webglInit===void 0)return;let Te=le.source,Pe=A.get(Te);if(Pe){let Ge=Pe[Z.__cacheKey];Ge.usedTimes--,Ge.usedTimes===0&&k(le),Object.keys(Pe).length===0&&A.delete(Te)}n.remove(le)}function k(le){let Z=n.get(le);i.deleteTexture(Z.__webglTexture);let Te=le.source,Pe=A.get(Te);delete Pe[Z.__cacheKey],o.memory.textures--}function z(le){let Z=n.get(le);if(le.depthTexture&&(le.depthTexture.dispose(),n.remove(le.depthTexture)),le.isWebGLCubeRenderTarget)for(let Pe=0;Pe<6;Pe++){if(Array.isArray(Z.__webglFramebuffer[Pe]))for(let Ge=0;Ge<Z.__webglFramebuffer[Pe].length;Ge++)i.deleteFramebuffer(Z.__webglFramebuffer[Pe][Ge]);else i.deleteFramebuffer(Z.__webglFramebuffer[Pe]);Z.__webglDepthbuffer&&i.deleteRenderbuffer(Z.__webglDepthbuffer[Pe])}else{if(Array.isArray(Z.__webglFramebuffer))for(let Pe=0;Pe<Z.__webglFramebuffer.length;Pe++)i.deleteFramebuffer(Z.__webglFramebuffer[Pe]);else i.deleteFramebuffer(Z.__webglFramebuffer);if(Z.__webglDepthbuffer&&i.deleteRenderbuffer(Z.__webglDepthbuffer),Z.__webglMultisampledFramebuffer&&i.deleteFramebuffer(Z.__webglMultisampledFramebuffer),Z.__webglColorRenderbuffer)for(let Pe=0;Pe<Z.__webglColorRenderbuffer.length;Pe++)Z.__webglColorRenderbuffer[Pe]&&i.deleteRenderbuffer(Z.__webglColorRenderbuffer[Pe]);Z.__webglDepthRenderbuffer&&i.deleteRenderbuffer(Z.__webglDepthRenderbuffer)}let Te=le.textures;for(let Pe=0,Ge=Te.length;Pe<Ge;Pe++){let vt=n.get(Te[Pe]);vt.__webglTexture&&(i.deleteTexture(vt.__webglTexture),o.memory.textures--),n.remove(Te[Pe])}n.remove(le)}let G=0;function W(){G=0}function Y(){return G}function H(le){G=le}function $(){let le=G;return le>=r.maxTextures&&Xe("WebGLTextures: Trying to use "+le+" texture units while this GPU supports only "+r.maxTextures),G+=1,le}function J(le){let Z=[];return Z.push(le.wrapS),Z.push(le.wrapT),Z.push(le.wrapR||0),Z.push(le.magFilter),Z.push(le.minFilter),Z.push(le.anisotropy),Z.push(le.internalFormat),Z.push(le.format),Z.push(le.type),Z.push(le.generateMipmaps),Z.push(le.premultiplyAlpha),Z.push(le.flipY),Z.push(le.unpackAlignment),Z.push(le.colorSpace),Z.join()}function te(le,Z){let Te=n.get(le);if(le.isVideoTexture&&_e(le),le.isRenderTargetTexture===!1&&le.isExternalTexture!==!0&&le.version>0&&Te.__version!==le.version){let Pe=le.image;if(Pe===null)Xe("WebGLRenderer: Texture marked for update but no image data found.");else if(Pe.complete===!1)Xe("WebGLRenderer: Texture marked for update but image is incomplete");else{Mt(Te,le,Z);return}}else le.isExternalTexture&&(Te.__webglTexture=le.sourceTexture?le.sourceTexture:null);t.bindTexture(i.TEXTURE_2D,Te.__webglTexture,i.TEXTURE0+Z)}function ce(le,Z){let Te=n.get(le);if(le.isRenderTargetTexture===!1&&le.version>0&&Te.__version!==le.version){Mt(Te,le,Z);return}else le.isExternalTexture&&(Te.__webglTexture=le.sourceTexture?le.sourceTexture:null);t.bindTexture(i.TEXTURE_2D_ARRAY,Te.__webglTexture,i.TEXTURE0+Z)}function he(le,Z){let Te=n.get(le);if(le.isRenderTargetTexture===!1&&le.version>0&&Te.__version!==le.version){Mt(Te,le,Z);return}t.bindTexture(i.TEXTURE_3D,Te.__webglTexture,i.TEXTURE0+Z)}function ve(le,Z){let Te=n.get(le);if(le.isCubeDepthTexture!==!0&&le.version>0&&Te.__version!==le.version){Et(Te,le,Z);return}t.bindTexture(i.TEXTURE_CUBE_MAP,Te.__webglTexture,i.TEXTURE0+Z)}let Re={[Cd]:i.REPEAT,[aa]:i.CLAMP_TO_EDGE,[Rd]:i.MIRRORED_REPEAT},Qe={[Ti]:i.NEAREST,[Rb]:i.NEAREST_MIPMAP_NEAREST,[Wc]:i.NEAREST_MIPMAP_LINEAR,[Mi]:i.LINEAR,[g0]:i.LINEAR_MIPMAP_NEAREST,[Vo]:i.LINEAR_MIPMAP_LINEAR},Fe={[Lb]:i.NEVER,[Fb]:i.ALWAYS,[h_]:i.LESS,[Yh]:i.LEQUAL,[Db]:i.EQUAL,[Fu]:i.GEQUAL,[fg]:i.GREATER,[Nb]:i.NOTEQUAL};function mt(le,Z){if(Z.type===cr&&e.has("OES_texture_float_linear")===!1&&(Z.magFilter===Mi||Z.magFilter===g0||Z.magFilter===Wc||Z.magFilter===Vo||Z.minFilter===Mi||Z.minFilter===g0||Z.minFilter===Wc||Z.minFilter===Vo)&&Xe("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(le,i.TEXTURE_WRAP_S,Re[Z.wrapS]),i.texParameteri(le,i.TEXTURE_WRAP_T,Re[Z.wrapT]),(le===i.TEXTURE_3D||le===i.TEXTURE_2D_ARRAY)&&i.texParameteri(le,i.TEXTURE_WRAP_R,Re[Z.wrapR]),i.texParameteri(le,i.TEXTURE_MAG_FILTER,Qe[Z.magFilter]),i.texParameteri(le,i.TEXTURE_MIN_FILTER,Qe[Z.minFilter]),Z.compareFunction&&(i.texParameteri(le,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(le,i.TEXTURE_COMPARE_FUNC,Fe[Z.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(Z.magFilter===Ti||Z.minFilter!==Wc&&Z.minFilter!==Vo||Z.type===cr&&e.has("OES_texture_float_linear")===!1)return;if(Z.anisotropy>1||n.get(Z).__currentAnisotropy){let Te=e.get("EXT_texture_filter_anisotropic");i.texParameterf(le,Te.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(Z.anisotropy,r.getMaxAnisotropy())),n.get(Z).__currentAnisotropy=Z.anisotropy}}}function Ee(le,Z){let Te=!1;le.__webglInit===void 0&&(le.__webglInit=!0,Z.addEventListener("dispose",L));let Pe=Z.source,Ge=A.get(Pe);Ge===void 0&&(Ge={},A.set(Pe,Ge));let vt=J(Z);if(vt!==le.__cacheKey){Ge[vt]===void 0&&(Ge[vt]={texture:i.createTexture(),usedTimes:0},o.memory.textures++,Te=!0),Ge[vt].usedTimes++;let Tt=Ge[le.__cacheKey];Tt!==void 0&&(Ge[le.__cacheKey].usedTimes--,Tt.usedTimes===0&&k(Z)),le.__cacheKey=vt,le.__webglTexture=Ge[vt].texture}return Te}function Ve(le,Z,Te){return Math.floor(Math.floor(le/Te)/Z)}function Ye(le,Z,Te,Pe){let vt=le.updateRanges;if(vt.length===0)t.texSubImage2D(i.TEXTURE_2D,0,0,0,Z.width,Z.height,Te,Pe,Z.data);else{vt.sort((rn,Lt)=>rn.start-Lt.start);let Tt=0;for(let rn=1;rn<vt.length;rn++){let Lt=vt[Tt],Rt=vt[rn],fn=Lt.start+Lt.count,wn=Ve(Rt.start,Z.width,4),Dn=Ve(Lt.start,Z.width,4);Rt.start<=fn+1&&wn===Dn&&Ve(Rt.start+Rt.count-1,Z.width,4)===wn?Lt.count=Math.max(Lt.count,Rt.start+Rt.count-Lt.start):(++Tt,vt[Tt]=Rt)}vt.length=Tt+1;let qe=t.getParameter(i.UNPACK_ROW_LENGTH),Je=t.getParameter(i.UNPACK_SKIP_PIXELS),Pt=t.getParameter(i.UNPACK_SKIP_ROWS);t.pixelStorei(i.UNPACK_ROW_LENGTH,Z.width);for(let rn=0,Lt=vt.length;rn<Lt;rn++){let Rt=vt[rn],fn=Math.floor(Rt.start/4),wn=Math.ceil(Rt.count/4),Dn=fn%Z.width,ye=Math.floor(fn/Z.width),wt=wn,Ze=1;t.pixelStorei(i.UNPACK_SKIP_PIXELS,Dn),t.pixelStorei(i.UNPACK_SKIP_ROWS,ye),t.texSubImage2D(i.TEXTURE_2D,0,Dn,ye,wt,Ze,Te,Pe,Z.data)}le.clearUpdateRanges(),t.pixelStorei(i.UNPACK_ROW_LENGTH,qe),t.pixelStorei(i.UNPACK_SKIP_PIXELS,Je),t.pixelStorei(i.UNPACK_SKIP_ROWS,Pt)}}function Mt(le,Z,Te){let Pe=i.TEXTURE_2D;(Z.isDataArrayTexture||Z.isCompressedArrayTexture)&&(Pe=i.TEXTURE_2D_ARRAY),Z.isData3DTexture&&(Pe=i.TEXTURE_3D);let Ge=Ee(le,Z),vt=Z.source;t.bindTexture(Pe,le.__webglTexture,i.TEXTURE0+Te);let Tt=n.get(vt);if(vt.version!==Tt.__version||Ge===!0){if(t.activeTexture(i.TEXTURE0+Te),(typeof ImageBitmap<"u"&&Z.image instanceof ImageBitmap)===!1){let Ze=ln.getPrimaries(ln.workingColorSpace),St=Z.colorSpace===ua?null:ln.getPrimaries(Z.colorSpace),Bt=Z.colorSpace===ua||Ze===St?i.NONE:i.BROWSER_DEFAULT_WEBGL;t.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,Z.flipY),t.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Z.premultiplyAlpha),t.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Bt)}t.pixelStorei(i.UNPACK_ALIGNMENT,Z.unpackAlignment);let Je=S(Z.image,!1,r.maxTextureSize);Je=vi(Z,Je);let Pt=s.convert(Z.format,Z.colorSpace),rn=s.convert(Z.type),Lt=I(Z.internalFormat,Pt,rn,Z.normalized,Z.colorSpace,Z.isVideoTexture);mt(Pe,Z);let Rt,fn=Z.mipmaps,wn=Z.isVideoTexture!==!0,Dn=Tt.__version===void 0||Ge===!0,ye=vt.dataReady,wt=D(Z,Je);if(Z.isDepthTexture)Lt=F(Z.format===xo,Z.type),Dn&&(wn?t.texStorage2D(i.TEXTURE_2D,1,Lt,Je.width,Je.height):t.texImage2D(i.TEXTURE_2D,0,Lt,Je.width,Je.height,0,Pt,rn,null));else if(Z.isDataTexture)if(fn.length>0){wn&&Dn&&t.texStorage2D(i.TEXTURE_2D,wt,Lt,fn[0].width,fn[0].height);for(let Ze=0,St=fn.length;Ze<St;Ze++)Rt=fn[Ze],wn?ye&&t.texSubImage2D(i.TEXTURE_2D,Ze,0,0,Rt.width,Rt.height,Pt,rn,Rt.data):t.texImage2D(i.TEXTURE_2D,Ze,Lt,Rt.width,Rt.height,0,Pt,rn,Rt.data);Z.generateMipmaps=!1}else wn?(Dn&&t.texStorage2D(i.TEXTURE_2D,wt,Lt,Je.width,Je.height),ye&&Ye(Z,Je,Pt,rn)):t.texImage2D(i.TEXTURE_2D,0,Lt,Je.width,Je.height,0,Pt,rn,Je.data);else if(Z.isCompressedTexture)if(Z.isCompressedArrayTexture){wn&&Dn&&t.texStorage3D(i.TEXTURE_2D_ARRAY,wt,Lt,fn[0].width,fn[0].height,Je.depth);for(let Ze=0,St=fn.length;Ze<St;Ze++)if(Rt=fn[Ze],Z.format!==Or)if(Pt!==null)if(wn){if(ye)if(Z.layerUpdates.size>0){let Bt=Ob(Rt.width,Rt.height,Z.format,Z.type);for(let ut of Z.layerUpdates){let Ce=Rt.data.subarray(ut*Bt/Rt.data.BYTES_PER_ELEMENT,(ut+1)*Bt/Rt.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,Ze,0,0,ut,Rt.width,Rt.height,1,Pt,Ce)}Z.clearLayerUpdates()}else t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,Ze,0,0,0,Rt.width,Rt.height,Je.depth,Pt,Rt.data)}else t.compressedTexImage3D(i.TEXTURE_2D_ARRAY,Ze,Lt,Rt.width,Rt.height,Je.depth,0,Rt.data,0,0);else Xe("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else wn?ye&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,Ze,0,0,0,Rt.width,Rt.height,Je.depth,Pt,rn,Rt.data):t.texImage3D(i.TEXTURE_2D_ARRAY,Ze,Lt,Rt.width,Rt.height,Je.depth,0,Pt,rn,Rt.data)}else{wn&&Dn&&t.texStorage2D(i.TEXTURE_2D,wt,Lt,fn[0].width,fn[0].height);for(let Ze=0,St=fn.length;Ze<St;Ze++)Rt=fn[Ze],Z.format!==Or?Pt!==null?wn?ye&&t.compressedTexSubImage2D(i.TEXTURE_2D,Ze,0,0,Rt.width,Rt.height,Pt,Rt.data):t.compressedTexImage2D(i.TEXTURE_2D,Ze,Lt,Rt.width,Rt.height,0,Rt.data):Xe("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):wn?ye&&t.texSubImage2D(i.TEXTURE_2D,Ze,0,0,Rt.width,Rt.height,Pt,rn,Rt.data):t.texImage2D(i.TEXTURE_2D,Ze,Lt,Rt.width,Rt.height,0,Pt,rn,Rt.data)}else if(Z.isDataArrayTexture)if(wn){if(Dn&&t.texStorage3D(i.TEXTURE_2D_ARRAY,wt,Lt,Je.width,Je.height,Je.depth),ye)if(Z.layerUpdates.size>0){let Ze=Ob(Je.width,Je.height,Z.format,Z.type);for(let St of Z.layerUpdates){let Bt=Je.data.subarray(St*Ze/Je.data.BYTES_PER_ELEMENT,(St+1)*Ze/Je.data.BYTES_PER_ELEMENT);t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,St,Je.width,Je.height,1,Pt,rn,Bt)}Z.clearLayerUpdates()}else t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,Je.width,Je.height,Je.depth,Pt,rn,Je.data)}else t.texImage3D(i.TEXTURE_2D_ARRAY,0,Lt,Je.width,Je.height,Je.depth,0,Pt,rn,Je.data);else if(Z.isData3DTexture)wn?(Dn&&t.texStorage3D(i.TEXTURE_3D,wt,Lt,Je.width,Je.height,Je.depth),ye&&t.texSubImage3D(i.TEXTURE_3D,0,0,0,0,Je.width,Je.height,Je.depth,Pt,rn,Je.data)):t.texImage3D(i.TEXTURE_3D,0,Lt,Je.width,Je.height,Je.depth,0,Pt,rn,Je.data);else if(Z.isFramebufferTexture){if(Dn)if(wn)t.texStorage2D(i.TEXTURE_2D,wt,Lt,Je.width,Je.height);else{let Ze=Je.width,St=Je.height;for(let Bt=0;Bt<wt;Bt++)t.texImage2D(i.TEXTURE_2D,Bt,Lt,Ze,St,0,Pt,rn,null),Ze>>=1,St>>=1}}else if(Z.isHTMLTexture){if("texElementImage2D"in i){let Ze=i.canvas;if(Ze.hasAttribute("layoutsubtree")||Ze.setAttribute("layoutsubtree","true"),Je.parentNode!==Ze){Ze.appendChild(Je),f.add(Z),Ze.onpaint=St=>{let Bt=St.changedElements;for(let ut of f)Bt.includes(ut.image)&&(ut.needsUpdate=!0)},Ze.requestPaint();return}if(i.texElementImage2D.length===3)i.texElementImage2D(i.TEXTURE_2D,i.RGBA8,Je);else{let Bt=i.RGBA,ut=i.RGBA,Ce=i.UNSIGNED_BYTE;i.texElementImage2D(i.TEXTURE_2D,0,Bt,ut,Ce,Je)}i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE)}}else if(fn.length>0){if(wn&&Dn){let Ze=zn(fn[0]);t.texStorage2D(i.TEXTURE_2D,wt,Lt,Ze.width,Ze.height)}for(let Ze=0,St=fn.length;Ze<St;Ze++)Rt=fn[Ze],wn?ye&&t.texSubImage2D(i.TEXTURE_2D,Ze,0,0,Pt,rn,Rt):t.texImage2D(i.TEXTURE_2D,Ze,Lt,Pt,rn,Rt);Z.generateMipmaps=!1}else if(wn){if(Dn){let Ze=zn(Je);t.texStorage2D(i.TEXTURE_2D,wt,Lt,Ze.width,Ze.height)}ye&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,Pt,rn,Je)}else t.texImage2D(i.TEXTURE_2D,0,Lt,Pt,rn,Je);T(Z)&&R(Pe),Tt.__version=vt.version,Z.onUpdate&&Z.onUpdate(Z)}le.__version=Z.version}function Et(le,Z,Te){if(Z.image.length!==6)return;let Pe=Ee(le,Z),Ge=Z.source;t.bindTexture(i.TEXTURE_CUBE_MAP,le.__webglTexture,i.TEXTURE0+Te);let vt=n.get(Ge);if(Ge.version!==vt.__version||Pe===!0){t.activeTexture(i.TEXTURE0+Te);let Tt=ln.getPrimaries(ln.workingColorSpace),qe=Z.colorSpace===ua?null:ln.getPrimaries(Z.colorSpace),Je=Z.colorSpace===ua||Tt===qe?i.NONE:i.BROWSER_DEFAULT_WEBGL;t.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,Z.flipY),t.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Z.premultiplyAlpha),t.pixelStorei(i.UNPACK_ALIGNMENT,Z.unpackAlignment),t.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Je);let Pt=Z.isCompressedTexture||Z.image[0].isCompressedTexture,rn=Z.image[0]&&Z.image[0].isDataTexture,Lt=[];for(let ut=0;ut<6;ut++)!Pt&&!rn?Lt[ut]=S(Z.image[ut],!0,r.maxCubemapSize):Lt[ut]=rn?Z.image[ut].image:Z.image[ut],Lt[ut]=vi(Z,Lt[ut]);let Rt=Lt[0],fn=s.convert(Z.format,Z.colorSpace),wn=s.convert(Z.type),Dn=I(Z.internalFormat,fn,wn,Z.normalized,Z.colorSpace),ye=Z.isVideoTexture!==!0,wt=vt.__version===void 0||Pe===!0,Ze=Ge.dataReady,St=D(Z,Rt);mt(i.TEXTURE_CUBE_MAP,Z);let Bt;if(Pt){ye&&wt&&t.texStorage2D(i.TEXTURE_CUBE_MAP,St,Dn,Rt.width,Rt.height);for(let ut=0;ut<6;ut++){Bt=Lt[ut].mipmaps;for(let Ce=0;Ce<Bt.length;Ce++){let Yt=Bt[Ce];Z.format!==Or?fn!==null?ye?Ze&&t.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,Ce,0,0,Yt.width,Yt.height,fn,Yt.data):t.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,Ce,Dn,Yt.width,Yt.height,0,Yt.data):Xe("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):ye?Ze&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,Ce,0,0,Yt.width,Yt.height,fn,wn,Yt.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,Ce,Dn,Yt.width,Yt.height,0,fn,wn,Yt.data)}}}else{if(Bt=Z.mipmaps,ye&&wt){Bt.length>0&&St++;let ut=zn(Lt[0]);t.texStorage2D(i.TEXTURE_CUBE_MAP,St,Dn,ut.width,ut.height)}for(let ut=0;ut<6;ut++)if(rn){ye?Ze&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,0,0,0,Lt[ut].width,Lt[ut].height,fn,wn,Lt[ut].data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,0,Dn,Lt[ut].width,Lt[ut].height,0,fn,wn,Lt[ut].data);for(let Ce=0;Ce<Bt.length;Ce++){let nr=Bt[Ce].image[ut].image;ye?Ze&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,Ce+1,0,0,nr.width,nr.height,fn,wn,nr.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,Ce+1,Dn,nr.width,nr.height,0,fn,wn,nr.data)}}else{ye?Ze&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,0,0,0,fn,wn,Lt[ut]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,0,Dn,fn,wn,Lt[ut]);for(let Ce=0;Ce<Bt.length;Ce++){let Yt=Bt[Ce];ye?Ze&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,Ce+1,0,0,fn,wn,Yt.image[ut]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,Ce+1,Dn,fn,wn,Yt.image[ut])}}}T(Z)&&R(i.TEXTURE_CUBE_MAP),vt.__version=Ge.version,Z.onUpdate&&Z.onUpdate(Z)}le.__version=Z.version}function It(le,Z,Te,Pe,Ge,vt){let Tt=s.convert(Te.format,Te.colorSpace),qe=s.convert(Te.type),Je=I(Te.internalFormat,Tt,qe,Te.normalized,Te.colorSpace),Pt=n.get(Z),rn=n.get(Te);if(rn.__renderTarget=Z,!Pt.__hasExternalTextures){let Lt=Math.max(1,Z.width>>vt),Rt=Math.max(1,Z.height>>vt);Ge===i.TEXTURE_3D||Ge===i.TEXTURE_2D_ARRAY?t.texImage3D(Ge,vt,Je,Lt,Rt,Z.depth,0,Tt,qe,null):t.texImage2D(Ge,vt,Je,Lt,Rt,0,Tt,qe,null)}t.bindFramebuffer(i.FRAMEBUFFER,le),bn(Z)?a.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Pe,Ge,rn.__webglTexture,0,tn(Z)):(Ge===i.TEXTURE_2D||Ge>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&Ge<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,Pe,Ge,rn.__webglTexture,vt),t.bindFramebuffer(i.FRAMEBUFFER,null)}function dn(le,Z,Te){if(i.bindRenderbuffer(i.RENDERBUFFER,le),Z.depthBuffer){let Pe=Z.depthTexture,Ge=Pe&&Pe.isDepthTexture?Pe.type:null,vt=F(Z.stencilBuffer,Ge),Tt=Z.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;bn(Z)?a.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,tn(Z),vt,Z.width,Z.height):Te?i.renderbufferStorageMultisample(i.RENDERBUFFER,tn(Z),vt,Z.width,Z.height):i.renderbufferStorage(i.RENDERBUFFER,vt,Z.width,Z.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,Tt,i.RENDERBUFFER,le)}else{let Pe=Z.textures;for(let Ge=0;Ge<Pe.length;Ge++){let vt=Pe[Ge],Tt=s.convert(vt.format,vt.colorSpace),qe=s.convert(vt.type),Je=I(vt.internalFormat,Tt,qe,vt.normalized,vt.colorSpace);bn(Z)?a.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,tn(Z),Je,Z.width,Z.height):Te?i.renderbufferStorageMultisample(i.RENDERBUFFER,tn(Z),Je,Z.width,Z.height):i.renderbufferStorage(i.RENDERBUFFER,Je,Z.width,Z.height)}}i.bindRenderbuffer(i.RENDERBUFFER,null)}function Gt(le,Z,Te){let Pe=Z.isWebGLCubeRenderTarget===!0;if(t.bindFramebuffer(i.FRAMEBUFFER,le),!(Z.depthTexture&&Z.depthTexture.isDepthTexture))throw new Error("THREE.WebGLTextures: renderTarget.depthTexture must be an instance of THREE.DepthTexture.");let Ge=n.get(Z.depthTexture);if(Ge.__renderTarget=Z,(!Ge.__webglTexture||Z.depthTexture.image.width!==Z.width||Z.depthTexture.image.height!==Z.height)&&(Z.depthTexture.image.width=Z.width,Z.depthTexture.image.height=Z.height,Z.depthTexture.needsUpdate=!0),Pe){if(Ge.__webglInit===void 0&&(Ge.__webglInit=!0,Z.depthTexture.addEventListener("dispose",L)),Ge.__webglTexture===void 0){Ge.__webglTexture=i.createTexture(),t.bindTexture(i.TEXTURE_CUBE_MAP,Ge.__webglTexture),mt(i.TEXTURE_CUBE_MAP,Z.depthTexture);let Pt=s.convert(Z.depthTexture.format),rn=s.convert(Z.depthTexture.type),Lt;Z.depthTexture.format===Gs?Lt=i.DEPTH_COMPONENT24:Z.depthTexture.format===xo&&(Lt=i.DEPTH24_STENCIL8);for(let Rt=0;Rt<6;Rt++)i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Rt,0,Lt,Z.width,Z.height,0,Pt,rn,null)}}else te(Z.depthTexture,0);let vt=Ge.__webglTexture,Tt=tn(Z),qe=Pe?i.TEXTURE_CUBE_MAP_POSITIVE_X+Te:i.TEXTURE_2D,Je=Z.depthTexture.format===xo?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;if(Z.depthTexture.format===Gs)bn(Z)?a.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Je,qe,vt,0,Tt):i.framebufferTexture2D(i.FRAMEBUFFER,Je,qe,vt,0);else if(Z.depthTexture.format===xo)bn(Z)?a.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Je,qe,vt,0,Tt):i.framebufferTexture2D(i.FRAMEBUFFER,Je,qe,vt,0);else throw new Error("THREE.WebGLTextures: Unknown depthTexture format.")}function $e(le){let Z=n.get(le),Te=le.isWebGLCubeRenderTarget===!0;if(Z.__boundDepthTexture!==le.depthTexture){let Pe=le.depthTexture;if(Z.__depthDisposeCallback&&Z.__depthDisposeCallback(),Pe){let Ge=()=>{delete Z.__boundDepthTexture,delete Z.__depthDisposeCallback,Pe.removeEventListener("dispose",Ge)};Pe.addEventListener("dispose",Ge),Z.__depthDisposeCallback=Ge}Z.__boundDepthTexture=Pe}if(le.depthTexture&&!Z.__autoAllocateDepthBuffer)if(Te)for(let Pe=0;Pe<6;Pe++)Gt(Z.__webglFramebuffer[Pe],le,Pe);else{let Pe=le.texture.mipmaps;Pe&&Pe.length>0?Gt(Z.__webglFramebuffer[0],le,0):Gt(Z.__webglFramebuffer,le,0)}else if(Te){Z.__webglDepthbuffer=[];for(let Pe=0;Pe<6;Pe++)if(t.bindFramebuffer(i.FRAMEBUFFER,Z.__webglFramebuffer[Pe]),Z.__webglDepthbuffer[Pe]===void 0)Z.__webglDepthbuffer[Pe]=i.createRenderbuffer(),dn(Z.__webglDepthbuffer[Pe],le,!1);else{let Ge=le.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,vt=Z.__webglDepthbuffer[Pe];i.bindRenderbuffer(i.RENDERBUFFER,vt),i.framebufferRenderbuffer(i.FRAMEBUFFER,Ge,i.RENDERBUFFER,vt)}}else{let Pe=le.texture.mipmaps;if(Pe&&Pe.length>0?t.bindFramebuffer(i.FRAMEBUFFER,Z.__webglFramebuffer[0]):t.bindFramebuffer(i.FRAMEBUFFER,Z.__webglFramebuffer),Z.__webglDepthbuffer===void 0)Z.__webglDepthbuffer=i.createRenderbuffer(),dn(Z.__webglDepthbuffer,le,!1);else{let Ge=le.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,vt=Z.__webglDepthbuffer;i.bindRenderbuffer(i.RENDERBUFFER,vt),i.framebufferRenderbuffer(i.FRAMEBUFFER,Ge,i.RENDERBUFFER,vt)}}t.bindFramebuffer(i.FRAMEBUFFER,null)}function ot(le,Z,Te){let Pe=n.get(le);Z!==void 0&&It(Pe.__webglFramebuffer,le,le.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),Te!==void 0&&$e(le)}function nt(le){let Z=le.texture,Te=n.get(le),Pe=n.get(Z);le.addEventListener("dispose",C);let Ge=le.textures,vt=le.isWebGLCubeRenderTarget===!0,Tt=Ge.length>1;if(Tt||(Pe.__webglTexture===void 0&&(Pe.__webglTexture=i.createTexture()),Pe.__version=Z.version,o.memory.textures++),vt){Te.__webglFramebuffer=[];for(let qe=0;qe<6;qe++)if(Z.mipmaps&&Z.mipmaps.length>0){Te.__webglFramebuffer[qe]=[];for(let Je=0;Je<Z.mipmaps.length;Je++)Te.__webglFramebuffer[qe][Je]=i.createFramebuffer()}else Te.__webglFramebuffer[qe]=i.createFramebuffer()}else{if(Z.mipmaps&&Z.mipmaps.length>0){Te.__webglFramebuffer=[];for(let qe=0;qe<Z.mipmaps.length;qe++)Te.__webglFramebuffer[qe]=i.createFramebuffer()}else Te.__webglFramebuffer=i.createFramebuffer();if(Tt)for(let qe=0,Je=Ge.length;qe<Je;qe++){let Pt=n.get(Ge[qe]);Pt.__webglTexture===void 0&&(Pt.__webglTexture=i.createTexture(),o.memory.textures++)}if(le.samples>0&&bn(le)===!1){Te.__webglMultisampledFramebuffer=i.createFramebuffer(),Te.__webglColorRenderbuffer=[],t.bindFramebuffer(i.FRAMEBUFFER,Te.__webglMultisampledFramebuffer);for(let qe=0;qe<Ge.length;qe++){let Je=Ge[qe];Te.__webglColorRenderbuffer[qe]=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,Te.__webglColorRenderbuffer[qe]);let Pt=s.convert(Je.format,Je.colorSpace),rn=s.convert(Je.type),Lt=I(Je.internalFormat,Pt,rn,Je.normalized,Je.colorSpace,le.isXRRenderTarget===!0),Rt=tn(le);i.renderbufferStorageMultisample(i.RENDERBUFFER,Rt,Lt,le.width,le.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+qe,i.RENDERBUFFER,Te.__webglColorRenderbuffer[qe])}i.bindRenderbuffer(i.RENDERBUFFER,null),le.depthBuffer&&(Te.__webglDepthRenderbuffer=i.createRenderbuffer(),dn(Te.__webglDepthRenderbuffer,le,!0)),t.bindFramebuffer(i.FRAMEBUFFER,null)}}if(vt){t.bindTexture(i.TEXTURE_CUBE_MAP,Pe.__webglTexture),mt(i.TEXTURE_CUBE_MAP,Z);for(let qe=0;qe<6;qe++)if(Z.mipmaps&&Z.mipmaps.length>0)for(let Je=0;Je<Z.mipmaps.length;Je++)It(Te.__webglFramebuffer[qe][Je],le,Z,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+qe,Je);else It(Te.__webglFramebuffer[qe],le,Z,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+qe,0);T(Z)&&R(i.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(Tt){for(let qe=0,Je=Ge.length;qe<Je;qe++){let Pt=Ge[qe],rn=n.get(Pt),Lt=i.TEXTURE_2D;(le.isWebGL3DRenderTarget||le.isWebGLArrayRenderTarget)&&(Lt=le.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(Lt,rn.__webglTexture),mt(Lt,Pt),It(Te.__webglFramebuffer,le,Pt,i.COLOR_ATTACHMENT0+qe,Lt,0),T(Pt)&&R(Lt)}t.unbindTexture()}else{let qe=i.TEXTURE_2D;if((le.isWebGL3DRenderTarget||le.isWebGLArrayRenderTarget)&&(qe=le.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(qe,Pe.__webglTexture),mt(qe,Z),Z.mipmaps&&Z.mipmaps.length>0)for(let Je=0;Je<Z.mipmaps.length;Je++)It(Te.__webglFramebuffer[Je],le,Z,i.COLOR_ATTACHMENT0,qe,Je);else It(Te.__webglFramebuffer,le,Z,i.COLOR_ATTACHMENT0,qe,0);T(Z)&&R(qe),t.unbindTexture()}le.depthBuffer&&$e(le)}function bt(le){let Z=le.textures;for(let Te=0,Pe=Z.length;Te<Pe;Te++){let Ge=Z[Te];if(T(Ge)){let vt=P(le),Tt=n.get(Ge).__webglTexture;t.bindTexture(vt,Tt),R(vt),t.unbindTexture()}}}let yt=[],hn=[];function en(le){if(le.samples>0){if(bn(le)===!1){let Z=le.textures,Te=le.width,Pe=le.height,Ge=i.COLOR_BUFFER_BIT,vt=le.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,Tt=n.get(le),qe=Z.length>1;if(qe)for(let Pt=0;Pt<Z.length;Pt++)t.bindFramebuffer(i.FRAMEBUFFER,Tt.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Pt,i.RENDERBUFFER,null),t.bindFramebuffer(i.FRAMEBUFFER,Tt.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+Pt,i.TEXTURE_2D,null,0);t.bindFramebuffer(i.READ_FRAMEBUFFER,Tt.__webglMultisampledFramebuffer);let Je=le.texture.mipmaps;Je&&Je.length>0?t.bindFramebuffer(i.DRAW_FRAMEBUFFER,Tt.__webglFramebuffer[0]):t.bindFramebuffer(i.DRAW_FRAMEBUFFER,Tt.__webglFramebuffer);for(let Pt=0;Pt<Z.length;Pt++){if(le.resolveDepthBuffer&&(le.depthBuffer&&(Ge|=i.DEPTH_BUFFER_BIT),le.stencilBuffer&&le.resolveStencilBuffer&&(Ge|=i.STENCIL_BUFFER_BIT)),qe){i.framebufferRenderbuffer(i.READ_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,Tt.__webglColorRenderbuffer[Pt]);let rn=n.get(Z[Pt]).__webglTexture;i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,rn,0)}i.blitFramebuffer(0,0,Te,Pe,0,0,Te,Pe,Ge,i.NEAREST),l===!0&&(yt.length=0,hn.length=0,yt.push(i.COLOR_ATTACHMENT0+Pt),le.depthBuffer&&le.resolveDepthBuffer===!1&&(yt.push(vt),hn.push(vt),i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,hn)),i.invalidateFramebuffer(i.READ_FRAMEBUFFER,yt))}if(t.bindFramebuffer(i.READ_FRAMEBUFFER,null),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),qe)for(let Pt=0;Pt<Z.length;Pt++){t.bindFramebuffer(i.FRAMEBUFFER,Tt.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Pt,i.RENDERBUFFER,Tt.__webglColorRenderbuffer[Pt]);let rn=n.get(Z[Pt]).__webglTexture;t.bindFramebuffer(i.FRAMEBUFFER,Tt.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+Pt,i.TEXTURE_2D,rn,0)}t.bindFramebuffer(i.DRAW_FRAMEBUFFER,Tt.__webglMultisampledFramebuffer)}else if(le.depthBuffer&&le.resolveDepthBuffer===!1&&l){let Z=le.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,[Z])}}}function tn(le){return Math.min(r.maxSamples,le.samples)}function bn(le){let Z=n.get(le);return le.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&Z.__useRenderToTexture!==!1}function _e(le){let Z=o.render.frame;u.get(le)!==Z&&(u.set(le,Z),le.update())}function vi(le,Z){let Te=le.colorSpace,Pe=le.format,Ge=le.type;return le.isCompressedTexture===!0||le.isVideoTexture===!0||Te!==n0&&Te!==ua&&(ln.getTransfer(Te)===kt?(Pe!==Or||Ge!==Ji)&&Xe("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):ze("WebGLTextures: Unsupported texture color space:",Te)),Z}function zn(le){return typeof HTMLImageElement<"u"&&le instanceof HTMLImageElement?(c.width=le.naturalWidth||le.width,c.height=le.naturalHeight||le.height):typeof VideoFrame<"u"&&le instanceof VideoFrame?(c.width=le.displayWidth,c.height=le.displayHeight):(c.width=le.width,c.height=le.height),c}this.allocateTextureUnit=$,this.resetTextureUnits=W,this.getTextureUnits=Y,this.setTextureUnits=H,this.setTexture2D=te,this.setTexture2DArray=ce,this.setTexture3D=he,this.setTextureCube=ve,this.rebindTextures=ot,this.setupRenderTarget=nt,this.updateRenderTargetMipmap=bt,this.updateMultisampleRenderTarget=en,this.setupDepthRenderbuffer=$e,this.setupFrameBufferTexture=It,this.useMultisampledRTT=bn,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function wxe(i,e){function t(n,r=ua){let s,o=ln.getTransfer(r);if(n===Ji)return i.UNSIGNED_BYTE;if(n===rg)return i.UNSIGNED_SHORT_4_4_4_4;if(n===sg)return i.UNSIGNED_SHORT_5_5_5_1;if(n===og)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===ag)return i.UNSIGNED_INT_10F_11F_11F_REV;if(n===kh)return i.BYTE;if(n===zh)return i.SHORT;if(n===wl)return i.UNSIGNED_SHORT;if(n===Zr)return i.INT;if(n===xi)return i.UNSIGNED_INT;if(n===cr)return i.FLOAT;if(n===Wi)return i.HALF_FLOAT;if(n===u_)return i.ALPHA;if(n===Bd)return i.RGB;if(n===Or)return i.RGBA;if(n===Gs)return i.DEPTH_COMPONENT;if(n===xo)return i.DEPTH_STENCIL;if(n===Od)return i.RED;if(n===Vh)return i.RED_INTEGER;if(n===js)return i.RG;if(n===Gh)return i.RG_INTEGER;if(n===v0)return i.RGBA_INTEGER;if(n===qh||n===Hh||n===Wh||n===jh)if(o===kt)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===qh)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Hh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Wh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===jh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===qh)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Hh)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Wh)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===jh)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===lg||n===cg||n===ug||n===hg)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===lg)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===cg)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===ug)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===hg)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===_0||n===x0||n===y0||n===b0||n===w0||n===Xh||n===S0)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===_0||n===x0)return o===kt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===y0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(n===b0)return s.COMPRESSED_R11_EAC;if(n===w0)return s.COMPRESSED_SIGNED_R11_EAC;if(n===Xh)return s.COMPRESSED_RG11_EAC;if(n===S0)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===T0||n===E0||n===M0||n===C0||n===R0||n===I0||n===P0||n===L0||n===D0||n===N0||n===F0||n===B0||n===O0||n===U0)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===T0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===E0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===M0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===C0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===R0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===I0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===P0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===L0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===D0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===N0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===F0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===B0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===O0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===U0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===k0||n===z0||n===V0)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===k0)return o===kt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===z0)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===V0)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===G0||n===q0||n===$h||n===H0)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===G0)return s.COMPRESSED_RED_RGTC1_EXT;if(n===q0)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===$h)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===H0)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===ca?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:t}}var Sxe=`4093+}`,Uxe=[new re(1,0,0),new re(-1,0,0),new re(0,1,0),new re(0,-1,0),new re(0,0,1),new re(0,0,-1)],kxe=[new re(0,-1,0),new re(0,-1,0),new re(0,0,1),new re(0,0,-1),new re(0,-1,0),new re(0,-1,0)],tK=new cn,qb=new re,MF=new re;function zxe(i,e,t){let n=new qc,r=new Oe,s=new Oe,o=new xn,a=new gM,l=new vM,c={},u=t.maxTextureSize,f={[ko]:mi,[mi]:ko,[vr]:vr},d=new ds({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Oe},radius:{value:4}},vertexShader:Bxe,fragmentShader:Oxe}),A=d.clone();A.defines.HORIZONTAL_PASS=1;let y=new Xn;y.setAttribute("position",new Hi(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let w=new Hn(y,d),S=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=p0;let T=this.type;this.render=function(D,L,C){if(S.enabled===!1||S.autoUpdate===!1&&S.needsUpdate===!1||D.length===0)return;this.type===NM&&(Xe("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=p0);let B=i.getRenderTarget(),k=i.getActiveCubeFace(),z=i.getActiveMipmapLevel(),G=i.state;G.setBlending(ps),G.buffers.depth.getReversed()===!0?G.buffers.color.setClear(0,0,0,0):G.buffers.color.setClear(1,1,1,1),G.buffers.depth.setTest(!0),G.setScissorTest(!1);let W=T!==this.type;W&&L.traverse(function(Y){Y.material&&(Array.isArray(Y.material)?Y.material.forEach(H=>H.needsUpdate=!0):Y.material.needsUpdate=!0)});for(let Y=0,H=D.length;Y<H;Y++){let $=D[Y],J=$.shadow;if(J===void 0){Xe("WebGLShadowMap:",$,"has no shadow.");continue}if(J.autoUpdate===!1&&J.needsUpdate===!1)continue;r.copy(J.mapSize);let te=J.getFrameExtents();r.multiply(te),s.copy(J.mapSize),(r.x>u||r.y>u)&&(r.x>u&&(s.x=Math.floor(u/te.x),r.x=s.x*te.x,J.mapSize.x=s.x),r.y>u&&(s.y=Math.floor(u/te.y),r.y=s.y*te.y,J.mapSize.y=s.y));let ce=i.state.buffers.depth.getReversed();if(J.camera._reversedDepth=ce,J.map===null||W===!0){if(J.map!==null&&(J.map.depthTexture!==null&&(J.map.depthTexture.dispose(),J.map.depthTexture=null),J.map.dispose()),this.type===Hc){if($.isPointLight){Xe("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}J.map=new Oa(r.x,r.y,{format:js,type:Wi,minFilter:Mi,magFilter:Mi,generateMipmaps:!1}),J.map.texture.name=$.name+".shadowMap",J.map.depthTexture=new Cs(r.x,r.y,cr),J.map.depthTexture.name=$.name+".shadowMapDepth",J.map.depthTexture.format=Gs,J.map.depthTexture.compareFunction=null,J.map.depthTexture.minFilter=Ti,J.map.depthTexture.magFilter=Ti}else $.isPointLight?(J.map=new jM(r.x),J.map.depthTexture=new n_(r.x,xi)):(J.map=new Oa(r.x,r.y),J.map.depthTexture=new Cs(r.x,r.y,xi)),J.map.depthTexture.name=$.name+".shadowMap",J.map.depthTexture.format=Gs,this.type===p0?(J.map.depthTexture.compareFunction=ce?Ou:Zh,J.map.depthTexture.minFilter=Mi,J.map.depthTexture.magFilter=Mi):(J.map.depthTexture.compareFunction=null,J.map.depthTexture.minFilter=Ti,J.map.depthTexture.magFilter=Ti);J.camera.updateProjectionMatrix()}let he=J.map.isWebGLCubeRenderTarget?6:1;for(let ve=0;ve<he;ve++){if(J.map.isWebGLCubeRenderTarget)i.setRenderTarget(J.map,ve),i.clear();else{ve===0&&(i.setRenderTarget(J.map),i.clear());let Re=J.getViewport(ve);o.set(s.x*Re.x,s.y*Re.y,s.x*Re.z,s.y*Re.w),G.viewport(o)}if($.isPointLight){let Re=J.camera,Qe=J.matrix,Fe=$.distance||Re.far;Fe!==Re.far&&(Re.far=Fe,Re.updateProjectionMatrix()),qb.setFromMatrixPosition($.matrixWorld),Re.position.copy(qb),MF.copy(Re.position),MF.add(Uxe[ve]),Re.up.copy(kxe[ve]),Re.lookAt(MF),Re.updateMatrixWorld(),Qe.makeTranslation(-qb.x,-qb.y,-qb.z),tK.multiplyMatrices(Re.projectionMatrix,Re.matrixWorldInverse),J._frustum.setFromProjectionMatrix(tK,Re.coordinateSystem,Re.reversedDepth)}else J.updateMatrices($);n=J.getFrustum(),I(L,C,J.camera,$,this.type)}J.isPointLightShadow!==!0&&this.type===Hc&&R(J,C),J.needsUpdate=!1}T=this.type,S.needsUpdate=!1,i.setRenderTarget(B,k,z)};function R(D,L){let C=e.update(w);d.defines.VSM_SAMPLES!==D.blurSamples&&(d.defines.VSM_SAMPLES=D.blurSamples,A.defines.VSM_SAMPLES=D.blurSamples,d.needsUpdate=!0,A.needsUpdate=!0),D.mapPass===null&&(D.mapPass=new Oa(r.x,r.y,{format:js,type:Wi})),d.uniforms.shadow_pass.value=D.map.depthTexture,d.uniforms.resolution.value=D.mapSize,d.uniforms.radius.value=D.radius,i.setRenderTarget(D.mapPass),i.clear(),i.renderBufferDirect(L,null,C,d,w,null),A.uniforms.shadow_pass.value=D.mapPass.texture,A.uniforms.resolution.value=D.mapSize,A.uniforms.radius.value=D.radius,i.setRenderTarget(D.map),i.clear(),i.renderBufferDirect(L,null,C,A,w,null)}function P(D,L,C,B){let k=null,z=C.isPointLight===!0?D.customDistanceMaterial:D.customDepthMaterial;if(z!==void 0)k=z;else if(k=C.isPointLight===!0?l:a,i.localClippingEnabled&&L.clipShadows===!0&&Array.isArray(L.clippingPlanes)&&L.clippingPlanes.length!==0||L.displacementMap&&L.displacementScale!==0||L.alphaMap&&L.alphaTest>0||L.map&&L.alphaTest>0||L.alphaToCoverage===!0){let G=k.uuid,W=L.uuid,Y=c[G];Y===void 0&&(Y={},c[G]=Y);let H=Y[W];H===void 0&&(H=k.clone(),Y[W]=H,L.addEventListener("dispose",F)),k=H}if(k.visible=L.visible,k.wireframe=L.wireframe,B===Hc?k.side=L.shadowSide!==null?L.shadowSide:L.side:k.side=L.shadowSide!==null?L.shadowSide:f[L.side],k.alphaMap=L.alphaMap,k.alphaTest=L.alphaToCoverage===!0?.5:L.alphaTest,k.map=L.map,k.clipShadows=L.clipShadows,k.clippingPlanes=L.clippingPlanes,k.clipIntersection=L.clipIntersection,k.displacementMap=L.displacementMap,k.displacementScale=L.displacementScale,k.displacementBias=L.displacementBias,k.wireframeLinewidth=L.wireframeLinewidth,k.linewidth=L.linewidth,C.isPointLight===!0&&k.isMeshDistanceMaterial===!0){let G=i.properties.get(k);G.light=C}return k}function I(D,L,C,B,k){if(D.visible===!1)return;if(D.layers.test(L.layers)&&(D.isMesh||D.isLine||D.isPoints)&&(D.castShadow||D.receiveShadow&&k===Hc)&&(!D.frustumCulled||n.intersectsObject(D))){D.modelViewMatrix.multiplyMatrices(C.matrixWorldInverse,D.matrixWorld);let W=e.update(D),Y=D.material;if(Array.isArray(Y)){let H=W.groups;for(let $=0,J=H.length;$<J;$++){let te=H[$],ce=Y[te.materialIndex];if(ce&&ce.visible){let he=P(D,ce,B,k);D.onBeforeShadow(i,D,L,C,W,he,te),i.renderBufferDirect(C,null,W,he,D,te),D.onAfterShadow(i,D,L,C,W,he,te)}}}else if(Y.visible){let H=P(D,Y,B,k);D.onBeforeShadow(i,D,L,C,W,H,null),i.renderBufferDirect(C,null,W,H,D,null),D.onAfterShadow(i,D,L,C,W,H,null)}}let G=D.children;for(let W=0,Y=G.length;W<Y;W++)I(G[W],L,C,B,k)}function F(D){D.target.removeEventListener("dispose",F);for(let C in c){let B=c[C],k=D.target.uuid;k in B&&(B[k].dispose(),delete B[k])}}}function Vxe(i,e){function t(){let ye=!1,wt=new xn,Ze=null,St=new xn(0,0,0,0);return{setMask:function(Bt){Ze!==Bt&&!ye&&(i.colorMask(Bt,Bt,Bt,Bt),Ze=Bt)},setLocked:function(Bt){ye=Bt},setClear:function(Bt,ut,Ce,Yt,nr){nr===!0&&(Bt*=Yt,ut*=Yt,Ce*=Yt),wt.set(Bt,ut,Ce,Yt),St.equals(wt)===!1&&(i.clearColor(Bt,ut,Ce,Yt),St.copy(wt))},reset:function(){ye=!1,Ze=null,St.set(-1,0,0,0)}}}function n(){let ye=!1,wt=!1,Ze=null,St=null,Bt=null;return{setReversed:function(ut){if(wt!==ut){let Ce=e.get("EXT_clip_control");ut?Ce.clipControlEXT(Ce.LOWER_LEFT_EXT,Ce.ZERO_TO_ONE_EXT):Ce.clipControlEXT(Ce.LOWER_LEFT_EXT,Ce.NEGATIVE_ONE_TO_ONE_EXT),wt=ut;let Yt=Bt;Bt=null,this.setClear(Yt)}},getReversed:function(){return wt},setTest:function(ut){ut?Ye(i.DEPTH_TEST):Mt(i.DEPTH_TEST)},setMask:function(ut){Ze!==ut&&!ye&&(i.depthMask(ut),Ze=ut)},setFunc:function(ut){if(wt&&(ut=zb[ut]),St!==ut){switch(ut){case NA:i.depthFunc(i.NEVER);break;case FA:i.depthFunc(i.ALWAYS);break;case BA:i.depthFunc(i.LESS);break;case Ph:i.depthFunc(i.LEQUAL);break;case OA:i.depthFunc(i.EQUAL);break;case UA:i.depthFunc(i.GEQUAL);break;case kA:i.depthFunc(i.GREATER);break;case zA:i.depthFunc(i.NOTEQUAL);break;default:i.depthFunc(i.LEQUAL)}St=ut}},setLocked:function(ut){ye=ut},setClear:function(ut){Bt!==ut&&(Bt=ut,wt&&(ut=1-ut),i.clearDepth(ut))},reset:function(){ye=!1,Ze=null,St=null,Bt=null,wt=!1}}}function r(){let ye=!1,wt=null,Ze=null,St=null,Bt=null,ut=null,Ce=null,Yt=null,nr=null;return{setTest:function(Fn){ye||(Fn?Ye(i.STENCIL_TEST):Mt(i.STENCIL_TEST))},setMask:function(Fn){wt!==Fn&&!ye&&(i.stencilMask(Fn),wt=Fn)},setFunc:function(Fn,is,Lr){(Ze!==Fn||St!==is||Bt!==Lr)&&(i.stencilFunc(Fn,is,Lr),Ze=Fn,St=is,Bt=Lr)},setOp:function(Fn,is,Lr){(ut!==Fn||Ce!==is||Yt!==Lr)&&(i.stencilOp(Fn,is,Lr),ut=Fn,Ce=is,Yt=Lr)},setLocked:function(Fn){ye=Fn},setClear:function(Fn){nr!==Fn&&(i.clearStencil(Fn),nr=Fn)},reset:function(){ye=!1,wt=null,Ze=null,St=null,Bt=null,ut=null,Ce=null,Yt=null,nr=null}}}let s=new t,o=new n,a=new r,l=new WeakMap,c=new WeakMap,u={},f={},d={},A=new WeakMap,y=[],w=null,S=!1,T=null,R=null,P=null,I=null,F=null,D=null,L=null,C=new zt(0,0,0),B=0,k=!1,z=null,G=null,W=null,Y=null,H=null,$=i.getParameter(i.MAX_COMBINED_TEXTURE_IMAGE_UNITS),J=!1,te=0,ce=i.getParameter(i.VERSION);ce.indexOf("WebGL")!==-1?(te=parseFloat(/^WebGL (\d)/.exec(ce)[1]),J=te>=1):ce.indexOf("OpenGL ES")!==-1&&(te=parseFloat(/^OpenGL ES (\d)/.exec(ce)[1]),J=te>=2);let he=null,ve={},Re=i.getParameter(i.SCISSOR_BOX),Qe=i.getParameter(i.VIEWPORT),Fe=new xn().fromArray(Re),mt=new xn().fromArray(Qe);function Ee(ye,wt,Ze,St){let Bt=new Uint8Array(4),ut=i.createTexture();i.bindTexture(ye,ut),i.texParameteri(ye,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(ye,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let Ce=0;Ce<Ze;Ce++)ye===i.TEXTURE_3D||ye===i.TEXTURE_2D_ARRAY?i.texImage3D(wt,0,i.RGBA,1,1,St,0,i.RGBA,i.UNSIGNED_BYTE,Bt):i.texImage2D(wt+Ce,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,Bt);return ut}let Ve={};Ve[i.TEXTURE_2D]=Ee(i.TEXTURE_2D,i.TEXTURE_2D,1),Ve[i.TEXTURE_CUBE_MAP]=Ee(i.TEXTURE_CUBE_MAP,i.TEXTURE_CUBE_MAP_POSITIVE_X,6),Ve[i.TEXTURE_2D_ARRAY]=Ee(i.TEXTURE_2D_ARRAY,i.TEXTURE_2D_ARRAY,1,1),Ve[i.TEXTURE_3D]=Ee(i.TEXTURE_3D,i.TEXTURE_3D,1,1),s.setClear(0,0,0,1),o.setClear(1),a.setClear(0),Ye(i.DEPTH_TEST),o.setFunc(Ph),bt(!1),yt(pb),Ye(i.CULL_FACE),ot(ps);function Ye(ye){u[ye]!==!0&&(i.enable(ye),u[ye]=!0)}function Mt(ye){u[ye]!==!1&&(i.disable(ye),u[ye]=!1)}function Et(ye,wt){return d[ye]!==wt?(i.bindFramebuffer(ye,wt),d[ye]=wt,ye===i.DRAW_FRAMEBUFFER&&(d[i.FRAMEBUFFER]=wt),ye===i.FRAMEBUFFER&&(d[i.DRAW_FRAMEBUFFER]=wt),!0):!1}function It(ye,wt){let Ze=y,St=!1;if(ye){Ze=A.get(wt),Ze===void 0&&(Ze=[],A.set(wt,Ze));let Bt=ye.textures;if(Ze.length!==Bt.length||Ze[0]!==i.COLOR_ATTACHMENT0){for(let ut=0,Ce=Bt.length;ut<Ce;ut++)Ze[ut]=i.COLOR_ATTACHMENT0+ut;Ze.length=Bt.length,St=!0}}else Ze[0]!==i.BACK&&(Ze[0]=i.BACK,St=!0);St&&i.drawBuffers(Ze)}function dn(ye){return w!==ye?(i.useProgram(ye),w=ye,!0):!1}let Gt={[oo]:i.FUNC_ADD,[Ab]:i.FUNC_SUBTRACT,[gb]:i.FUNC_REVERSE_SUBTRACT};Gt[FM]=i.MIN,Gt[BM]=i.MAX;let $e={[Bu]:i.ZERO,[vb]:i.ONE,[_b]:i.SRC_COLOR,[e0]:i.SRC_ALPHA,[Tb]:i.SRC_ALPHA_SATURATE,[wb]:i.DST_COLOR,[yb]:i.DST_ALPHA,[xb]:i.ONE_MINUS_SRC_COLOR,[t0]:i.ONE_MINUS_SRC_ALPHA,[Sb]:i.ONE_MINUS_DST_COLOR,[bb]:i.ONE_MINUS_DST_ALPHA,[xZ]:i.CONSTANT_COLOR,[yZ]:i.ONE_MINUS_CONSTANT_COLOR,[bZ]:i.CONSTANT_ALPHA,[wZ]:i.ONE_MINUS_CONSTANT_ALPHA};function ot(ye,wt,Ze,St,Bt,ut,Ce,Yt,nr,Fn){if(ye===ps){S===!0&&(Mt(i.BLEND),S=!1);return}if(S===!1&&(Ye(i.BLEND),S=!0),ye!==Nd){if(ye!==T||Fn!==k){if((R!==oo||F!==oo)&&(i.blendEquation(i.FUNC_ADD),R=oo,F=oo),Fn)switch(ye){case Ms:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case Bh:i.blendFunc(i.ONE,i.ONE);break;case Oh:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case Uh:i.blendFuncSeparate(i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ZERO,i.ONE);break;default:ze("WebGLState: Invalid blending: ",ye);break}else switch(ye){case Ms:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case Bh:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE,i.ONE,i.ONE);break;case Oh:ze("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case Uh:ze("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:ze("WebGLState: Invalid blending: ",ye);break}P=null,I=null,D=null,L=null,C.set(0,0,0),B=0,T=ye,k=Fn}return}Bt=Bt||wt,ut=ut||Ze,Ce=Ce||St,(wt!==R||Bt!==F)&&(i.blendEquationSeparate(Gt[wt],Gt[Bt]),R=wt,F=Bt),(Ze!==P||St!==I||ut!==D||Ce!==L)&&(i.blendFuncSeparate($e[Ze],$e[St],$e[ut],$e[Ce]),P=Ze,I=St,D=ut,L=Ce),(Yt.equals(C)===!1||nr!==B)&&(i.blendColor(Yt.r,Yt.g,Yt.b,nr),C.copy(Yt),B=nr),T=ye,k=!1}function nt(ye,wt){ye.side===vr?Mt(i.CULL_FACE):Ye(i.CULL_FACE);let Ze=ye.side===mi;wt&&(Ze=!Ze),bt(Ze),ye.blending===Ms&&ye.transparent===!1?ot(ps):ot(ye.blending,ye.blendEquation,ye.blendSrc,ye.blendDst,ye.blendEquationAlpha,ye.blendSrcAlpha,ye.blendDstAlpha,ye.blendColor,ye.blendAlpha,ye.premultipliedAlpha),o.setFunc(ye.depthFunc),o.setTest(ye.depthTest),o.setMask(ye.depthWrite),s.setMask(ye.colorWrite);let St=ye.stencilWrite;a.setTest(St),St&&(a.setMask(ye.stencilWriteMask),a.setFunc(ye.stencilFunc,ye.stencilRef,ye.stencilFuncMask),a.setOp(ye.stencilFail,ye.stencilZFail,ye.stencilZPass)),en(ye.polygonOffset,ye.polygonOffsetFactor,ye.polygonOffsetUnits),ye.alphaToCoverage===!0?Ye(i.SAMPLE_ALPHA_TO_COVERAGE):Mt(i.SAMPLE_ALPHA_TO_COVERAGE)}function bt(ye){z!==ye&&(ye?i.frontFace(i.CW):i.frontFace(i.CCW),z=ye)}function yt(ye){ye!==LM?(Ye(i.CULL_FACE),ye!==G&&(ye===pb?i.cullFace(i.BACK):ye===DM?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK))):Mt(i.CULL_FACE),G=ye}function hn(ye){ye!==W&&(J&&i.lineWidth(ye),W=ye)}function en(ye,wt,Ze){ye?(Ye(i.POLYGON_OFFSET_FILL),(Y!==wt||H!==Ze)&&(Y=wt,H=Ze,o.getReversed()&&(wt=-wt),i.polygonOffset(wt,Ze))):Mt(i.POLYGON_OFFSET_FILL)}function tn(ye){ye?Ye(i.SCISSOR_TEST):Mt(i.SCISSOR_TEST)}function bn(ye){ye===void 0&&(ye=i.TEXTURE0+$-1),he!==ye&&(i.activeTexture(ye),he=ye)}function _e(ye,wt,Ze){Ze===void 0&&(he===null?Ze=i.TEXTURE0+$-1:Ze=he);let St=ve[Ze];St===void 0&&(St={type:void 0,texture:void 0},ve[Ze]=St),(St.type!==ye||St.texture!==wt)&&(he!==Ze&&(i.activeTexture(Ze),he=Ze),i.bindTexture(ye,wt||Ve[ye]),St.type=ye,St.texture=wt)}function vi(){let ye=ve[he];ye!==void 0&&ye.type!==void 0&&(i.bindTexture(ye.type,null),ye.type=void 0,ye.texture=void 0)}function zn(){try{i.compressedTexImage2D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function le(){try{i.compressedTexImage3D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function Z(){try{i.texSubImage2D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function Te(){try{i.texSubImage3D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function Pe(){try{i.compressedTexSubImage2D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function Ge(){try{i.compressedTexSubImage3D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function vt(){try{i.texStorage2D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function Tt(){try{i.texStorage3D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function qe(){try{i.texImage2D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function Je(){try{i.texImage3D(...arguments)}catch(ye){ze("WebGLState:",ye)}}function Pt(ye){return f[ye]!==void 0?f[ye]:i.getParameter(ye)}function rn(ye,wt){f[ye]!==wt&&(i.pixelStorei(ye,wt),f[ye]=wt)}function Lt(ye){Fe.equals(ye)===!1&&(i.scissor(ye.x,ye.y,ye.z,ye.w),Fe.copy(ye))}function Rt(ye){mt.equals(ye)===!1&&(i.viewport(ye.x,ye.y,ye.z,ye.w),mt.copy(ye))}function fn(ye,wt){let Ze=c.get(wt);Ze===void 0&&(Ze=new WeakMap,c.set(wt,Ze));let St=Ze.get(ye);St===void 0&&(St=i.getUniformBlockIndex(wt,ye.name),Ze.set(ye,St))}function wn(ye,wt){let St=c.get(wt).get(ye);l.get(wt)!==St&&(i.uniformBlockBinding(wt,St,ye.__bindingPointIndex),l.set(wt,St))}function Dn(){i.disable(i.BLEND),i.disable(i.CULL_FACE),i.disable(i.DEPTH_TEST),i.disable(i.POLYGON_OFFSET_FILL),i.disable(i.SCISSOR_TEST),i.disable(i.STENCIL_TEST),i.disable(i.SAMPLE_ALPHA_TO_COVERAGE),i.blendEquation(i.FUNC_ADD),i.blendFunc(i.ONE,i.ZERO),i.blendFuncSeparate(i.ONE,i.ZERO,i.ONE,i.ZERO),i.blendColor(0,0,0,0),i.colorMask(!0,!0,!0,!0),i.clearColor(0,0,0,0),i.depthMask(!0),i.depthFunc(i.LESS),o.setReversed(!1),i.clearDepth(1),i.stencilMask(4294967295),i.stencilFunc(i.ALWAYS,0,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.KEEP),i.clearStencil(0),i.cullFace(i.BACK),i.frontFace(i.CCW),i.polygonOffset(0,0),i.activeTexture(i.TEXTURE0),i.bindFramebuffer(i.FRAMEBUFFER,null),i.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),i.bindFramebuffer(i.READ_FRAMEBUFFER,null),i.useProgram(null),i.lineWidth(1),i.scissor(0,0,i.canvas.width,i.canvas.height),i.viewport(0,0,i.canvas.width,i.canvas.height),i.pixelStorei(i.PACK_ALIGNMENT,4),i.pixelStorei(i.UNPACK_ALIGNMENT,4),i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,!1),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,i.BROWSER_DEFAULT_WEBGL),i.pixelStorei(i.PACK_ROW_LENGTH,0),i.pixelStorei(i.PACK_SKIP_PIXELS,0),i.pixelStorei(i.PACK_SKIP_ROWS,0),i.pixelStorei(i.UNPACK_ROW_LENGTH,0),i.pixelStorei(i.UNPACK_IMAGE_HEIGHT,0),i.pixelStorei(i.UNPACK_SKIP_PIXELS,0),i.pixelStorei(i.UNPACK_SKIP_ROWS,0),i.pixelStorei(i.UNPACK_SKIP_IMAGES,0),u={},f={},he=null,ve={},d={},A=new WeakMap,y=[],w=null,S=!1,T=null,R=null,P=null,I=null,F=null,D=null,L=null,C=new zt(0,0,0),B=0,k=!1,z=null,G=null,W=null,Y=null,H=null,Fe.set(0,0,i.canvas.width,i.canvas.height),mt.set(0,0,i.canvas.width,i.canvas.height),s.reset(),o.reset(),a.reset()}return{buffers:{color:s,depth:o,stencil:a},enable:Ye,disable:Mt,bindFramebuffer:Et,drawBuffers:It,useProgram:dn,setBlending:ot,setMaterial:nt,setFlipSided:bt,setCullFace:yt,setLineWidth:hn,setPolygonOffset:en,setScissorTest:tn,activeTexture:bn,bindTexture:_e,unbindTexture:vi,compressedTexImage2D:zn,compressedTexImage3D:le,texImage2D:qe,texImage3D:Je,pixelStorei:rn,getParameter:Pt,updateUBOMapping:fn,uniformBlockBinding:wn,texStorage2D:vt,texStorage3D:Tt,texSubImage2D:Z,texSubImage3D:Te,compressedTexSubImage2D:Pe,compressedTexSubImage3D:Ge,scissor:Lt,viewport:Rt,reset:Dn}}function Gxe(i,e,t,n,r,s,o){let a=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new Oe,u=new WeakMap,f=new Set,d,A=new WeakMap,y=!1;try{y=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function w(le,Z){return y?new OffscreenCanvas(le,Z):Zv("canvas")}function S(le,Z,Te){let Pe=1,Ge=zn(le);if((Ge.width>Te||Ge.height>Te)&&(Pe=Te/Math.max(Ge.width,Ge.height)),Pe<1)if(typeof HTMLImageElement<"u"&&le instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&le instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&le instanceof ImageBitmap||typeof VideoFrame<"u"&&le instanceof VideoFrame){let vt=Math.floor(Pe*Ge.width),Tt=Math.floor(Pe*Ge.height);d===void 0&&(d=w(vt,Tt));let qe=Z?w(vt,Tt):d;return qe.width=vt,qe.height=Tt,qe.getContext("2d").drawImage(le,0,0,vt,Tt),Xe("WebGLRenderer: Texture has been resized from ("+Ge.width+"x"+Ge.height+") to ("+vt+"x"+Tt+")."),qe}else return"data"in le&&Xe("WebGLRenderer: Image in DataTexture is too big ("+Ge.width+"x"+Ge.height+")."),le;return le}function T(le){return le.generateMipmaps}function R(le){i.generateMipmap(le)}function P(le){return le.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:le.isWebGL3DRenderTarget?i.TEXTURE_3D:le.isWebGLArrayRenderTarget||le.isCompressedArrayTexture?i.TEXTURE_2D_ARRAY:i.TEXTURE_2D}function I(le,Z,Te,Pe,Ge,vt=!1){if(le!==null){if(i[le]!==void 0)return i[le];Xe("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+le+"'")}let Tt;Pe&&(Tt=e.get("EXT_texture_norm16"),Tt||Xe("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let qe=Z;if(Z===i.RED&&(Te===i.FLOAT&&(qe=i.R32F),Te===i.HALF_FLOAT&&(qe=i.R16F),Te===i.UNSIGNED_BYTE&&(qe=i.R8),Te===i.UNSIGNED_SHORT&&Tt&&(qe=Tt.R16_EXT),Te===i.SHORT&&Tt&&(qe=Tt.R16_SNORM_EXT)),Z===i.RED_INTEGER&&(Te===i.UNSIGNED_BYTE&&(qe=i.R8UI),Te===i.UNSIGNED_SHORT&&(qe=i.R16UI),Te===i.UNSIGNED_INT&&(qe=i.R32UI),Te===i.BYTE&&(qe=i.R8I),Te===i.SHORT&&(qe=i.R16I),Te===i.INT&&(qe=i.R32I)),Z===i.RG&&(Te===i.FLOAT&&(qe=i.RG32F),Te===i.HALF_FLOAT&&(qe=i.RG16F),Te===i.UNSIGNED_BYTE&&(qe=i.RG8),Te===i.UNSIGNED_SHORT&&Tt&&(qe=Tt.RG16_EXT),Te===i.SHORT&&Tt&&(qe=Tt.RG16_SNORM_EXT)),Z===i.RG_INTEGER&&(Te===i.UNSIGNED_BYTE&&(qe=i.RG8UI),Te===i.UNSIGNED_SHORT&&(qe=i.RG16UI),Te===i.UNSIGNED_INT&&(qe=i.RG32UI),Te===i.BYTE&&(qe=i.RG8I),Te===i.SHORT&&(qe=i.RG16I),Te===i.INT&&(qe=i.RG32I)),Z===i.RGB_INTEGER&&(Te===i.UNSIGNED_BYTE&&(qe=i.RGB8UI),Te===i.UNSIGNED_SHORT&&(qe=i.RGB16UI),Te===i.UNSIGNED_INT&&(qe=i.RGB32UI),Te===i.BYTE&&(qe=i.RGB8I),Te===i.SHORT&&(qe=i.RGB16I),Te===i.INT&&(qe=i.RGB32I)),Z===i.RGBA_INTEGER&&(Te===i.UNSIGNED_BYTE&&(qe=i.RGBA8UI),Te===i.UNSIGNED_SHORT&&(qe=i.RGBA16UI),Te===i.UNSIGNED_INT&&(qe=i.RGBA32UI),Te===i.BYTE&&(qe=i.RGBA8I),Te===i.SHORT&&(qe=i.RGBA16I),Te===i.INT&&(qe=i.RGBA32I)),Z===i.RGB&&(Te===i.UNSIGNED_SHORT&&Tt&&(qe=Tt.RGB16_EXT),Te===i.SHORT&&Tt&&(qe=Tt.RGB16_SNORM_EXT),Te===i.UNSIGNED_INT_5_9_9_9_REV&&(qe=i.RGB9_E5),Te===i.UNSIGNED_INT_10F_11F_11F_REV&&(qe=i.R11F_G11F_B10F)),Z===i.RGBA){let Je=vt?i0:ln.getTransfer(Ge);Te===i.FLOAT&&(qe=i.RGBA32F),Te===i.HALF_FLOAT&&(qe=i.RGBA16F),Te===i.UNSIGNED_BYTE&&(qe=Je===kt?i.SRGB8_ALPHA8:i.RGBA8),Te===i.UNSIGNED_SHORT&&Tt&&(qe=Tt.RGBA16_EXT),Te===i.SHORT&&Tt&&(qe=Tt.RGBA16_SNORM_EXT),Te===i.UNSIGNED_SHORT_4_4_4_4&&(qe=i.RGBA4),Te===i.UNSIGNED_SHORT_5_5_5_1&&(qe=i.RGB5_A1)}return(qe===i.R16F||qe===i.R32F||qe===i.RG16F||qe===i.RG32F||qe===i.RGBA16F||qe===i.RGBA32F)&&e.get("EXT_color_buffer_float"),qe}function F(le,Z){let Te;return le?Z===null||Z===xi||Z===ca?Te=i.DEPTH24_STENCIL8:Z===cr?Te=i.DEPTH32F_STENCIL8:Z===wl&&(Te=i.DEPTH24_STENCIL8,Xe("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):Z===null||Z===xi||Z===ca?Te=i.DEPTH_COMPONENT24:Z===cr?Te=i.DEPTH_COMPONENT32F:Z===wl&&(Te=i.DEPTH_COMPONENT16),Te}function D(le,Z){return T(le)===!0||le.isFramebufferTexture&&le.minFilter!==Ti&&le.minFilter!==Mi?Math.log2(Math.max(Z.width,Z.height))+1:le.mipmaps!==void 0&&le.mipmaps.length>0?le.mipmaps.length:le.isCompressedTexture&&Array.isArray(le.image)?Z.mipmaps.length:1}function L(le){let Z=le.target;Z.removeEventListener("dispose",L),B(Z),Z.isVideoTexture&&u.delete(Z),Z.isHTMLTexture&&f.delete(Z)}function C(le){let Z=le.target;Z.removeEventListener("dispose",C),z(Z)}function B(le){let Z=n.get(le);if(Z.__webglInit===void 0)return;let Te=le.source,Pe=A.get(Te);if(Pe){let Ge=Pe[Z.__cacheKey];Ge.usedTimes--,Ge.usedTimes===0&&k(le),Object.keys(Pe).length===0&&A.delete(Te)}n.remove(le)}function k(le){let Z=n.get(le);i.deleteTexture(Z.__webglTexture);let Te=le.source,Pe=A.get(Te);delete Pe[Z.__cacheKey],o.memory.textures--}function z(le){let Z=n.get(le);if(le.depthTexture&&(le.depthTexture.dispose(),n.remove(le.depthTexture)),le.isWebGLCubeRenderTarget)for(let Pe=0;Pe<6;Pe++){if(Array.isArray(Z.__webglFramebuffer[Pe]))for(let Ge=0;Ge<Z.__webglFramebuffer[Pe].length;Ge++)i.deleteFramebuffer(Z.__webglFramebuffer[Pe][Ge]);else i.deleteFramebuffer(Z.__webglFramebuffer[Pe]);Z.__webglDepthbuffer&&i.deleteRenderbuffer(Z.__webglDepthbuffer[Pe])}else{if(Array.isArray(Z.__webglFramebuffer))for(let Pe=0;Pe<Z.__webglFramebuffer.length;Pe++)i.deleteFramebuffer(Z.__webglFramebuffer[Pe]);else i.deleteFramebuffer(Z.__webglFramebuffer);if(Z.__webglDepthbuffer&&i.deleteRenderbuffer(Z.__webglDepthbuffer),Z.__webglMultisampledFramebuffer&&i.deleteFramebuffer(Z.__webglMultisampledFramebuffer),Z.__webglColorRenderbuffer)for(let Pe=0;Pe<Z.__webglColorRenderbuffer.length;Pe++)Z.__webglColorRenderbuffer[Pe]&&i.deleteRenderbuffer(Z.__webglColorRenderbuffer[Pe]);Z.__webglDepthRenderbuffer&&i.deleteRenderbuffer(Z.__webglDepthRenderbuffer)}let Te=le.textures;for(let Pe=0,Ge=Te.length;Pe<Ge;Pe++){let vt=n.get(Te[Pe]);vt.__webglTexture&&(i.deleteTexture(vt.__webglTexture),o.memory.textures--),n.remove(Te[Pe])}n.remove(le)}let G=0;function W(){G=0}function Y(){return G}function H(le){G=le}function $(){let le=G;return le>=r.maxTextures&&Xe("WebGLTextures: Trying to use "+le+" texture units while this GPU supports only "+r.maxTextures),G+=1,le}function J(le){let Z=[];return Z.push(le.wrapS),Z.push(le.wrapT),Z.push(le.wrapR||0),Z.push(le.magFilter),Z.push(le.minFilter),Z.push(le.anisotropy),Z.push(le.internalFormat),Z.push(le.format),Z.push(le.type),Z.push(le.generateMipmaps),Z.push(le.premultiplyAlpha),Z.push(le.flipY),Z.push(le.unpackAlignment),Z.push(le.colorSpace),Z.join()}function te(le,Z){let Te=n.get(le);if(le.isVideoTexture&&_e(le),le.isRenderTargetTexture===!1&&le.isExternalTexture!==!0&&le.version>0&&Te.__version!==le.version){let Pe=le.image;if(Pe===null)Xe("WebGLRenderer: Texture marked for update but no image data found.");else if(Pe.complete===!1)Xe("WebGLRenderer: Texture marked for update but image is incomplete");else{Mt(Te,le,Z);return}}else le.isExternalTexture&&(Te.__webglTexture=le.sourceTexture?le.sourceTexture:null);t.bindTexture(i.TEXTURE_2D,Te.__webglTexture,i.TEXTURE0+Z)}function ce(le,Z){let Te=n.get(le);if(le.isRenderTargetTexture===!1&&le.version>0&&Te.__version!==le.version){Mt(Te,le,Z);return}else le.isExternalTexture&&(Te.__webglTexture=le.sourceTexture?le.sourceTexture:null);t.bindTexture(i.TEXTURE_2D_ARRAY,Te.__webglTexture,i.TEXTURE0+Z)}function he(le,Z){let Te=n.get(le);if(le.isRenderTargetTexture===!1&&le.version>0&&Te.__version!==le.version){Mt(Te,le,Z);return}t.bindTexture(i.TEXTURE_3D,Te.__webglTexture,i.TEXTURE0+Z)}function ve(le,Z){let Te=n.get(le);if(le.isCubeDepthTexture!==!0&&le.version>0&&Te.__version!==le.version){Et(Te,le,Z);return}t.bindTexture(i.TEXTURE_CUBE_MAP,Te.__webglTexture,i.TEXTURE0+Z)}let Re={[Md]:i.REPEAT,[aa]:i.CLAMP_TO_EDGE,[Cd]:i.MIRRORED_REPEAT},Qe={[Ti]:i.NEAREST,[Db]:i.NEAREST_MIPMAP_NEAREST,[jc]:i.NEAREST_MIPMAP_LINEAR,[Mi]:i.LINEAR,[g0]:i.LINEAR_MIPMAP_NEAREST,[Vo]:i.LINEAR_MIPMAP_LINEAR},Fe={[Bb]:i.NEVER,[kb]:i.ALWAYS,[d_]:i.LESS,[Zh]:i.LEQUAL,[Ob]:i.EQUAL,[Ou]:i.GEQUAL,[fg]:i.GREATER,[Ub]:i.NOTEQUAL};function mt(le,Z){if(Z.type===cr&&e.has("OES_texture_float_linear")===!1&&(Z.magFilter===Mi||Z.magFilter===g0||Z.magFilter===jc||Z.magFilter===Vo||Z.minFilter===Mi||Z.minFilter===g0||Z.minFilter===jc||Z.minFilter===Vo)&&Xe("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(le,i.TEXTURE_WRAP_S,Re[Z.wrapS]),i.texParameteri(le,i.TEXTURE_WRAP_T,Re[Z.wrapT]),(le===i.TEXTURE_3D||le===i.TEXTURE_2D_ARRAY)&&i.texParameteri(le,i.TEXTURE_WRAP_R,Re[Z.wrapR]),i.texParameteri(le,i.TEXTURE_MAG_FILTER,Qe[Z.magFilter]),i.texParameteri(le,i.TEXTURE_MIN_FILTER,Qe[Z.minFilter]),Z.compareFunction&&(i.texParameteri(le,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(le,i.TEXTURE_COMPARE_FUNC,Fe[Z.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(Z.magFilter===Ti||Z.minFilter!==jc&&Z.minFilter!==Vo||Z.type===cr&&e.has("OES_texture_float_linear")===!1)return;if(Z.anisotropy>1||n.get(Z).__currentAnisotropy){let Te=e.get("EXT_texture_filter_anisotropic");i.texParameterf(le,Te.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(Z.anisotropy,r.getMaxAnisotropy())),n.get(Z).__currentAnisotropy=Z.anisotropy}}}function Ee(le,Z){let Te=!1;le.__webglInit===void 0&&(le.__webglInit=!0,Z.addEventListener("dispose",L));let Pe=Z.source,Ge=A.get(Pe);Ge===void 0&&(Ge={},A.set(Pe,Ge));let vt=J(Z);if(vt!==le.__cacheKey){Ge[vt]===void 0&&(Ge[vt]={texture:i.createTexture(),usedTimes:0},o.memory.textures++,Te=!0),Ge[vt].usedTimes++;let Tt=Ge[le.__cacheKey];Tt!==void 0&&(Ge[le.__cacheKey].usedTimes--,Tt.usedTimes===0&&k(Z)),le.__cacheKey=vt,le.__webglTexture=Ge[vt].texture}return Te}function Ve(le,Z,Te){return Math.floor(Math.floor(le/Te)/Z)}function Ye(le,Z,Te,Pe){let vt=le.updateRanges;if(vt.length===0)t.texSubImage2D(i.TEXTURE_2D,0,0,0,Z.width,Z.height,Te,Pe,Z.data);else{vt.sort((rn,Lt)=>rn.start-Lt.start);let Tt=0;for(let rn=1;rn<vt.length;rn++){let Lt=vt[Tt],Rt=vt[rn],fn=Lt.start+Lt.count,wn=Ve(Rt.start,Z.width,4),Dn=Ve(Lt.start,Z.width,4);Rt.start<=fn+1&&wn===Dn&&Ve(Rt.start+Rt.count-1,Z.width,4)===wn?Lt.count=Math.max(Lt.count,Rt.start+Rt.count-Lt.start):(++Tt,vt[Tt]=Rt)}vt.length=Tt+1;let qe=t.getParameter(i.UNPACK_ROW_LENGTH),Je=t.getParameter(i.UNPACK_SKIP_PIXELS),Pt=t.getParameter(i.UNPACK_SKIP_ROWS);t.pixelStorei(i.UNPACK_ROW_LENGTH,Z.width);for(let rn=0,Lt=vt.length;rn<Lt;rn++){let Rt=vt[rn],fn=Math.floor(Rt.start/4),wn=Math.ceil(Rt.count/4),Dn=fn%Z.width,ye=Math.floor(fn/Z.width),wt=wn,Ze=1;t.pixelStorei(i.UNPACK_SKIP_PIXELS,Dn),t.pixelStorei(i.UNPACK_SKIP_ROWS,ye),t.texSubImage2D(i.TEXTURE_2D,0,Dn,ye,wt,Ze,Te,Pe,Z.data)}le.clearUpdateRanges(),t.pixelStorei(i.UNPACK_ROW_LENGTH,qe),t.pixelStorei(i.UNPACK_SKIP_PIXELS,Je),t.pixelStorei(i.UNPACK_SKIP_ROWS,Pt)}}function Mt(le,Z,Te){let Pe=i.TEXTURE_2D;(Z.isDataArrayTexture||Z.isCompressedArrayTexture)&&(Pe=i.TEXTURE_2D_ARRAY),Z.isData3DTexture&&(Pe=i.TEXTURE_3D);let Ge=Ee(le,Z),vt=Z.source;t.bindTexture(Pe,le.__webglTexture,i.TEXTURE0+Te);let Tt=n.get(vt);if(vt.version!==Tt.__version||Ge===!0){if(t.activeTexture(i.TEXTURE0+Te),(typeof ImageBitmap<"u"&&Z.image instanceof ImageBitmap)===!1){let Ze=ln.getPrimaries(ln.workingColorSpace),St=Z.colorSpace===ua?null:ln.getPrimaries(Z.colorSpace),Bt=Z.colorSpace===ua||Ze===St?i.NONE:i.BROWSER_DEFAULT_WEBGL;t.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,Z.flipY),t.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Z.premultiplyAlpha),t.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Bt)}t.pixelStorei(i.UNPACK_ALIGNMENT,Z.unpackAlignment);let Je=S(Z.image,!1,r.maxTextureSize);Je=vi(Z,Je);let Pt=s.convert(Z.format,Z.colorSpace),rn=s.convert(Z.type),Lt=I(Z.internalFormat,Pt,rn,Z.normalized,Z.colorSpace,Z.isVideoTexture);mt(Pe,Z);let Rt,fn=Z.mipmaps,wn=Z.isVideoTexture!==!0,Dn=Tt.__version===void 0||Ge===!0,ye=vt.dataReady,wt=D(Z,Je);if(Z.isDepthTexture)Lt=F(Z.format===xo,Z.type),Dn&&(wn?t.texStorage2D(i.TEXTURE_2D,1,Lt,Je.width,Je.height):t.texImage2D(i.TEXTURE_2D,0,Lt,Je.width,Je.height,0,Pt,rn,null));else if(Z.isDataTexture)if(fn.length>0){wn&&Dn&&t.texStorage2D(i.TEXTURE_2D,wt,Lt,fn[0].width,fn[0].height);for(let Ze=0,St=fn.length;Ze<St;Ze++)Rt=fn[Ze],wn?ye&&t.texSubImage2D(i.TEXTURE_2D,Ze,0,0,Rt.width,Rt.height,Pt,rn,Rt.data):t.texImage2D(i.TEXTURE_2D,Ze,Lt,Rt.width,Rt.height,0,Pt,rn,Rt.data);Z.generateMipmaps=!1}else wn?(Dn&&t.texStorage2D(i.TEXTURE_2D,wt,Lt,Je.width,Je.height),ye&&Ye(Z,Je,Pt,rn)):t.texImage2D(i.TEXTURE_2D,0,Lt,Je.width,Je.height,0,Pt,rn,Je.data);else if(Z.isCompressedTexture)if(Z.isCompressedArrayTexture){wn&&Dn&&t.texStorage3D(i.TEXTURE_2D_ARRAY,wt,Lt,fn[0].width,fn[0].height,Je.depth);for(let Ze=0,St=fn.length;Ze<St;Ze++)if(Rt=fn[Ze],Z.format!==Or)if(Pt!==null)if(wn){if(ye)if(Z.layerUpdates.size>0){let Bt=Vb(Rt.width,Rt.height,Z.format,Z.type);for(let ut of Z.layerUpdates){let Ce=Rt.data.subarray(ut*Bt/Rt.data.BYTES_PER_ELEMENT,(ut+1)*Bt/Rt.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,Ze,0,0,ut,Rt.width,Rt.height,1,Pt,Ce)}Z.clearLayerUpdates()}else t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,Ze,0,0,0,Rt.width,Rt.height,Je.depth,Pt,Rt.data)}else t.compressedTexImage3D(i.TEXTURE_2D_ARRAY,Ze,Lt,Rt.width,Rt.height,Je.depth,0,Rt.data,0,0);else Xe("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else wn?ye&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,Ze,0,0,0,Rt.width,Rt.height,Je.depth,Pt,rn,Rt.data):t.texImage3D(i.TEXTURE_2D_ARRAY,Ze,Lt,Rt.width,Rt.height,Je.depth,0,Pt,rn,Rt.data)}else{wn&&Dn&&t.texStorage2D(i.TEXTURE_2D,wt,Lt,fn[0].width,fn[0].height);for(let Ze=0,St=fn.length;Ze<St;Ze++)Rt=fn[Ze],Z.format!==Or?Pt!==null?wn?ye&&t.compressedTexSubImage2D(i.TEXTURE_2D,Ze,0,0,Rt.width,Rt.height,Pt,Rt.data):t.compressedTexImage2D(i.TEXTURE_2D,Ze,Lt,Rt.width,Rt.height,0,Rt.data):Xe("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):wn?ye&&t.texSubImage2D(i.TEXTURE_2D,Ze,0,0,Rt.width,Rt.height,Pt,rn,Rt.data):t.texImage2D(i.TEXTURE_2D,Ze,Lt,Rt.width,Rt.height,0,Pt,rn,Rt.data)}else if(Z.isDataArrayTexture)if(wn){if(Dn&&t.texStorage3D(i.TEXTURE_2D_ARRAY,wt,Lt,Je.width,Je.height,Je.depth),ye)if(Z.layerUpdates.size>0){let Ze=Vb(Je.width,Je.height,Z.format,Z.type);for(let St of Z.layerUpdates){let Bt=Je.data.subarray(St*Ze/Je.data.BYTES_PER_ELEMENT,(St+1)*Ze/Je.data.BYTES_PER_ELEMENT);t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,St,Je.width,Je.height,1,Pt,rn,Bt)}Z.clearLayerUpdates()}else t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,Je.width,Je.height,Je.depth,Pt,rn,Je.data)}else t.texImage3D(i.TEXTURE_2D_ARRAY,0,Lt,Je.width,Je.height,Je.depth,0,Pt,rn,Je.data);else if(Z.isData3DTexture)wn?(Dn&&t.texStorage3D(i.TEXTURE_3D,wt,Lt,Je.width,Je.height,Je.depth),ye&&t.texSubImage3D(i.TEXTURE_3D,0,0,0,0,Je.width,Je.height,Je.depth,Pt,rn,Je.data)):t.texImage3D(i.TEXTURE_3D,0,Lt,Je.width,Je.height,Je.depth,0,Pt,rn,Je.data);else if(Z.isFramebufferTexture){if(Dn)if(wn)t.texStorage2D(i.TEXTURE_2D,wt,Lt,Je.width,Je.height);else{let Ze=Je.width,St=Je.height;for(let Bt=0;Bt<wt;Bt++)t.texImage2D(i.TEXTURE_2D,Bt,Lt,Ze,St,0,Pt,rn,null),Ze>>=1,St>>=1}}else if(Z.isHTMLTexture){if("texElementImage2D"in i){let Ze=i.canvas;if(Ze.hasAttribute("layoutsubtree")||Ze.setAttribute("layoutsubtree","true"),Je.parentNode!==Ze){Ze.appendChild(Je),f.add(Z),Ze.onpaint=St=>{let Bt=St.changedElements;for(let ut of f)Bt.includes(ut.image)&&(ut.needsUpdate=!0)},Ze.requestPaint();return}if(i.texElementImage2D.length===3)i.texElementImage2D(i.TEXTURE_2D,i.RGBA8,Je);else{let Bt=i.RGBA,ut=i.RGBA,Ce=i.UNSIGNED_BYTE;i.texElementImage2D(i.TEXTURE_2D,0,Bt,ut,Ce,Je)}i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE)}}else if(fn.length>0){if(wn&&Dn){let Ze=zn(fn[0]);t.texStorage2D(i.TEXTURE_2D,wt,Lt,Ze.width,Ze.height)}for(let Ze=0,St=fn.length;Ze<St;Ze++)Rt=fn[Ze],wn?ye&&t.texSubImage2D(i.TEXTURE_2D,Ze,0,0,Pt,rn,Rt):t.texImage2D(i.TEXTURE_2D,Ze,Lt,Pt,rn,Rt);Z.generateMipmaps=!1}else if(wn){if(Dn){let Ze=zn(Je);t.texStorage2D(i.TEXTURE_2D,wt,Lt,Ze.width,Ze.height)}ye&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,Pt,rn,Je)}else t.texImage2D(i.TEXTURE_2D,0,Lt,Pt,rn,Je);T(Z)&&R(Pe),Tt.__version=vt.version,Z.onUpdate&&Z.onUpdate(Z)}le.__version=Z.version}function Et(le,Z,Te){if(Z.image.length!==6)return;let Pe=Ee(le,Z),Ge=Z.source;t.bindTexture(i.TEXTURE_CUBE_MAP,le.__webglTexture,i.TEXTURE0+Te);let vt=n.get(Ge);if(Ge.version!==vt.__version||Pe===!0){t.activeTexture(i.TEXTURE0+Te);let Tt=ln.getPrimaries(ln.workingColorSpace),qe=Z.colorSpace===ua?null:ln.getPrimaries(Z.colorSpace),Je=Z.colorSpace===ua||Tt===qe?i.NONE:i.BROWSER_DEFAULT_WEBGL;t.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,Z.flipY),t.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Z.premultiplyAlpha),t.pixelStorei(i.UNPACK_ALIGNMENT,Z.unpackAlignment),t.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Je);let Pt=Z.isCompressedTexture||Z.image[0].isCompressedTexture,rn=Z.image[0]&&Z.image[0].isDataTexture,Lt=[];for(let ut=0;ut<6;ut++)!Pt&&!rn?Lt[ut]=S(Z.image[ut],!0,r.maxCubemapSize):Lt[ut]=rn?Z.image[ut].image:Z.image[ut],Lt[ut]=vi(Z,Lt[ut]);let Rt=Lt[0],fn=s.convert(Z.format,Z.colorSpace),wn=s.convert(Z.type),Dn=I(Z.internalFormat,fn,wn,Z.normalized,Z.colorSpace),ye=Z.isVideoTexture!==!0,wt=vt.__version===void 0||Pe===!0,Ze=Ge.dataReady,St=D(Z,Rt);mt(i.TEXTURE_CUBE_MAP,Z);let Bt;if(Pt){ye&&wt&&t.texStorage2D(i.TEXTURE_CUBE_MAP,St,Dn,Rt.width,Rt.height);for(let ut=0;ut<6;ut++){Bt=Lt[ut].mipmaps;for(let Ce=0;Ce<Bt.length;Ce++){let Yt=Bt[Ce];Z.format!==Or?fn!==null?ye?Ze&&t.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,Ce,0,0,Yt.width,Yt.height,fn,Yt.data):t.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,Ce,Dn,Yt.width,Yt.height,0,Yt.data):Xe("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):ye?Ze&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,Ce,0,0,Yt.width,Yt.height,fn,wn,Yt.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,Ce,Dn,Yt.width,Yt.height,0,fn,wn,Yt.data)}}}else{if(Bt=Z.mipmaps,ye&&wt){Bt.length>0&&St++;let ut=zn(Lt[0]);t.texStorage2D(i.TEXTURE_CUBE_MAP,St,Dn,ut.width,ut.height)}for(let ut=0;ut<6;ut++)if(rn){ye?Ze&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,0,0,0,Lt[ut].width,Lt[ut].height,fn,wn,Lt[ut].data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,0,Dn,Lt[ut].width,Lt[ut].height,0,fn,wn,Lt[ut].data);for(let Ce=0;Ce<Bt.length;Ce++){let nr=Bt[Ce].image[ut].image;ye?Ze&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,Ce+1,0,0,nr.width,nr.height,fn,wn,nr.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,Ce+1,Dn,nr.width,nr.height,0,fn,wn,nr.data)}}else{ye?Ze&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,0,0,0,fn,wn,Lt[ut]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,0,Dn,fn,wn,Lt[ut]);for(let Ce=0;Ce<Bt.length;Ce++){let Yt=Bt[Ce];ye?Ze&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,Ce+1,0,0,fn,wn,Yt.image[ut]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ut,Ce+1,Dn,fn,wn,Yt.image[ut])}}}T(Z)&&R(i.TEXTURE_CUBE_MAP),vt.__version=Ge.version,Z.onUpdate&&Z.onUpdate(Z)}le.__version=Z.version}function It(le,Z,Te,Pe,Ge,vt){let Tt=s.convert(Te.format,Te.colorSpace),qe=s.convert(Te.type),Je=I(Te.internalFormat,Tt,qe,Te.normalized,Te.colorSpace),Pt=n.get(Z),rn=n.get(Te);if(rn.__renderTarget=Z,!Pt.__hasExternalTextures){let Lt=Math.max(1,Z.width>>vt),Rt=Math.max(1,Z.height>>vt);Ge===i.TEXTURE_3D||Ge===i.TEXTURE_2D_ARRAY?t.texImage3D(Ge,vt,Je,Lt,Rt,Z.depth,0,Tt,qe,null):t.texImage2D(Ge,vt,Je,Lt,Rt,0,Tt,qe,null)}t.bindFramebuffer(i.FRAMEBUFFER,le),bn(Z)?a.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Pe,Ge,rn.__webglTexture,0,tn(Z)):(Ge===i.TEXTURE_2D||Ge>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&Ge<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,Pe,Ge,rn.__webglTexture,vt),t.bindFramebuffer(i.FRAMEBUFFER,null)}function dn(le,Z,Te){if(i.bindRenderbuffer(i.RENDERBUFFER,le),Z.depthBuffer){let Pe=Z.depthTexture,Ge=Pe&&Pe.isDepthTexture?Pe.type:null,vt=F(Z.stencilBuffer,Ge),Tt=Z.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;bn(Z)?a.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,tn(Z),vt,Z.width,Z.height):Te?i.renderbufferStorageMultisample(i.RENDERBUFFER,tn(Z),vt,Z.width,Z.height):i.renderbufferStorage(i.RENDERBUFFER,vt,Z.width,Z.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,Tt,i.RENDERBUFFER,le)}else{let Pe=Z.textures;for(let Ge=0;Ge<Pe.length;Ge++){let vt=Pe[Ge],Tt=s.convert(vt.format,vt.colorSpace),qe=s.convert(vt.type),Je=I(vt.internalFormat,Tt,qe,vt.normalized,vt.colorSpace);bn(Z)?a.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,tn(Z),Je,Z.width,Z.height):Te?i.renderbufferStorageMultisample(i.RENDERBUFFER,tn(Z),Je,Z.width,Z.height):i.renderbufferStorage(i.RENDERBUFFER,Je,Z.width,Z.height)}}i.bindRenderbuffer(i.RENDERBUFFER,null)}function Gt(le,Z,Te){let Pe=Z.isWebGLCubeRenderTarget===!0;if(t.bindFramebuffer(i.FRAMEBUFFER,le),!(Z.depthTexture&&Z.depthTexture.isDepthTexture))throw new Error("THREE.WebGLTextures: renderTarget.depthTexture must be an instance of THREE.DepthTexture.");let Ge=n.get(Z.depthTexture);if(Ge.__renderTarget=Z,(!Ge.__webglTexture||Z.depthTexture.image.width!==Z.width||Z.depthTexture.image.height!==Z.height)&&(Z.depthTexture.image.width=Z.width,Z.depthTexture.image.height=Z.height,Z.depthTexture.needsUpdate=!0),Pe){if(Ge.__webglInit===void 0&&(Ge.__webglInit=!0,Z.depthTexture.addEventListener("dispose",L)),Ge.__webglTexture===void 0){Ge.__webglTexture=i.createTexture(),t.bindTexture(i.TEXTURE_CUBE_MAP,Ge.__webglTexture),mt(i.TEXTURE_CUBE_MAP,Z.depthTexture);let Pt=s.convert(Z.depthTexture.format),rn=s.convert(Z.depthTexture.type),Lt;Z.depthTexture.format===Gs?Lt=i.DEPTH_COMPONENT24:Z.depthTexture.format===xo&&(Lt=i.DEPTH24_STENCIL8);for(let Rt=0;Rt<6;Rt++)i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Rt,0,Lt,Z.width,Z.height,0,Pt,rn,null)}}else te(Z.depthTexture,0);let vt=Ge.__webglTexture,Tt=tn(Z),qe=Pe?i.TEXTURE_CUBE_MAP_POSITIVE_X+Te:i.TEXTURE_2D,Je=Z.depthTexture.format===xo?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;if(Z.depthTexture.format===Gs)bn(Z)?a.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Je,qe,vt,0,Tt):i.framebufferTexture2D(i.FRAMEBUFFER,Je,qe,vt,0);else if(Z.depthTexture.format===xo)bn(Z)?a.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Je,qe,vt,0,Tt):i.framebufferTexture2D(i.FRAMEBUFFER,Je,qe,vt,0);else throw new Error("THREE.WebGLTextures: Unknown depthTexture format.")}function $e(le){let Z=n.get(le),Te=le.isWebGLCubeRenderTarget===!0;if(Z.__boundDepthTexture!==le.depthTexture){let Pe=le.depthTexture;if(Z.__depthDisposeCallback&&Z.__depthDisposeCallback(),Pe){let Ge=()=>{delete Z.__boundDepthTexture,delete Z.__depthDisposeCallback,Pe.removeEventListener("dispose",Ge)};Pe.addEventListener("dispose",Ge),Z.__depthDisposeCallback=Ge}Z.__boundDepthTexture=Pe}if(le.depthTexture&&!Z.__autoAllocateDepthBuffer)if(Te)for(let Pe=0;Pe<6;Pe++)Gt(Z.__webglFramebuffer[Pe],le,Pe);else{let Pe=le.texture.mipmaps;Pe&&Pe.length>0?Gt(Z.__webglFramebuffer[0],le,0):Gt(Z.__webglFramebuffer,le,0)}else if(Te){Z.__webglDepthbuffer=[];for(let Pe=0;Pe<6;Pe++)if(t.bindFramebuffer(i.FRAMEBUFFER,Z.__webglFramebuffer[Pe]),Z.__webglDepthbuffer[Pe]===void 0)Z.__webglDepthbuffer[Pe]=i.createRenderbuffer(),dn(Z.__webglDepthbuffer[Pe],le,!1);else{let Ge=le.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,vt=Z.__webglDepthbuffer[Pe];i.bindRenderbuffer(i.RENDERBUFFER,vt),i.framebufferRenderbuffer(i.FRAMEBUFFER,Ge,i.RENDERBUFFER,vt)}}else{let Pe=le.texture.mipmaps;if(Pe&&Pe.length>0?t.bindFramebuffer(i.FRAMEBUFFER,Z.__webglFramebuffer[0]):t.bindFramebuffer(i.FRAMEBUFFER,Z.__webglFramebuffer),Z.__webglDepthbuffer===void 0)Z.__webglDepthbuffer=i.createRenderbuffer(),dn(Z.__webglDepthbuffer,le,!1);else{let Ge=le.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,vt=Z.__webglDepthbuffer;i.bindRenderbuffer(i.RENDERBUFFER,vt),i.framebufferRenderbuffer(i.FRAMEBUFFER,Ge,i.RENDERBUFFER,vt)}}t.bindFramebuffer(i.FRAMEBUFFER,null)}function ot(le,Z,Te){let Pe=n.get(le);Z!==void 0&&It(Pe.__webglFramebuffer,le,le.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),Te!==void 0&&$e(le)}function nt(le){let Z=le.texture,Te=n.get(le),Pe=n.get(Z);le.addEventListener("dispose",C);let Ge=le.textures,vt=le.isWebGLCubeRenderTarget===!0,Tt=Ge.length>1;if(Tt||(Pe.__webglTexture===void 0&&(Pe.__webglTexture=i.createTexture()),Pe.__version=Z.version,o.memory.textures++),vt){Te.__webglFramebuffer=[];for(let qe=0;qe<6;qe++)if(Z.mipmaps&&Z.mipmaps.length>0){Te.__webglFramebuffer[qe]=[];for(let Je=0;Je<Z.mipmaps.length;Je++)Te.__webglFramebuffer[qe][Je]=i.createFramebuffer()}else Te.__webglFramebuffer[qe]=i.createFramebuffer()}else{if(Z.mipmaps&&Z.mipmaps.length>0){Te.__webglFramebuffer=[];for(let qe=0;qe<Z.mipmaps.length;qe++)Te.__webglFramebuffer[qe]=i.createFramebuffer()}else Te.__webglFramebuffer=i.createFramebuffer();if(Tt)for(let qe=0,Je=Ge.length;qe<Je;qe++){let Pt=n.get(Ge[qe]);Pt.__webglTexture===void 0&&(Pt.__webglTexture=i.createTexture(),o.memory.textures++)}if(le.samples>0&&bn(le)===!1){Te.__webglMultisampledFramebuffer=i.createFramebuffer(),Te.__webglColorRenderbuffer=[],t.bindFramebuffer(i.FRAMEBUFFER,Te.__webglMultisampledFramebuffer);for(let qe=0;qe<Ge.length;qe++){let Je=Ge[qe];Te.__webglColorRenderbuffer[qe]=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,Te.__webglColorRenderbuffer[qe]);let Pt=s.convert(Je.format,Je.colorSpace),rn=s.convert(Je.type),Lt=I(Je.internalFormat,Pt,rn,Je.normalized,Je.colorSpace,le.isXRRenderTarget===!0),Rt=tn(le);i.renderbufferStorageMultisample(i.RENDERBUFFER,Rt,Lt,le.width,le.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+qe,i.RENDERBUFFER,Te.__webglColorRenderbuffer[qe])}i.bindRenderbuffer(i.RENDERBUFFER,null),le.depthBuffer&&(Te.__webglDepthRenderbuffer=i.createRenderbuffer(),dn(Te.__webglDepthRenderbuffer,le,!0)),t.bindFramebuffer(i.FRAMEBUFFER,null)}}if(vt){t.bindTexture(i.TEXTURE_CUBE_MAP,Pe.__webglTexture),mt(i.TEXTURE_CUBE_MAP,Z);for(let qe=0;qe<6;qe++)if(Z.mipmaps&&Z.mipmaps.length>0)for(let Je=0;Je<Z.mipmaps.length;Je++)It(Te.__webglFramebuffer[qe][Je],le,Z,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+qe,Je);else It(Te.__webglFramebuffer[qe],le,Z,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+qe,0);T(Z)&&R(i.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(Tt){for(let qe=0,Je=Ge.length;qe<Je;qe++){let Pt=Ge[qe],rn=n.get(Pt),Lt=i.TEXTURE_2D;(le.isWebGL3DRenderTarget||le.isWebGLArrayRenderTarget)&&(Lt=le.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(Lt,rn.__webglTexture),mt(Lt,Pt),It(Te.__webglFramebuffer,le,Pt,i.COLOR_ATTACHMENT0+qe,Lt,0),T(Pt)&&R(Lt)}t.unbindTexture()}else{let qe=i.TEXTURE_2D;if((le.isWebGL3DRenderTarget||le.isWebGLArrayRenderTarget)&&(qe=le.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(qe,Pe.__webglTexture),mt(qe,Z),Z.mipmaps&&Z.mipmaps.length>0)for(let Je=0;Je<Z.mipmaps.length;Je++)It(Te.__webglFramebuffer[Je],le,Z,i.COLOR_ATTACHMENT0,qe,Je);else It(Te.__webglFramebuffer,le,Z,i.COLOR_ATTACHMENT0,qe,0);T(Z)&&R(qe),t.unbindTexture()}le.depthBuffer&&$e(le)}function bt(le){let Z=le.textures;for(let Te=0,Pe=Z.length;Te<Pe;Te++){let Ge=Z[Te];if(T(Ge)){let vt=P(le),Tt=n.get(Ge).__webglTexture;t.bindTexture(vt,Tt),R(vt),t.unbindTexture()}}}let yt=[],hn=[];function en(le){if(le.samples>0){if(bn(le)===!1){let Z=le.textures,Te=le.width,Pe=le.height,Ge=i.COLOR_BUFFER_BIT,vt=le.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,Tt=n.get(le),qe=Z.length>1;if(qe)for(let Pt=0;Pt<Z.length;Pt++)t.bindFramebuffer(i.FRAMEBUFFER,Tt.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Pt,i.RENDERBUFFER,null),t.bindFramebuffer(i.FRAMEBUFFER,Tt.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+Pt,i.TEXTURE_2D,null,0);t.bindFramebuffer(i.READ_FRAMEBUFFER,Tt.__webglMultisampledFramebuffer);let Je=le.texture.mipmaps;Je&&Je.length>0?t.bindFramebuffer(i.DRAW_FRAMEBUFFER,Tt.__webglFramebuffer[0]):t.bindFramebuffer(i.DRAW_FRAMEBUFFER,Tt.__webglFramebuffer);for(let Pt=0;Pt<Z.length;Pt++){if(le.resolveDepthBuffer&&(le.depthBuffer&&(Ge|=i.DEPTH_BUFFER_BIT),le.stencilBuffer&&le.resolveStencilBuffer&&(Ge|=i.STENCIL_BUFFER_BIT)),qe){i.framebufferRenderbuffer(i.READ_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,Tt.__webglColorRenderbuffer[Pt]);let rn=n.get(Z[Pt]).__webglTexture;i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,rn,0)}i.blitFramebuffer(0,0,Te,Pe,0,0,Te,Pe,Ge,i.NEAREST),l===!0&&(yt.length=0,hn.length=0,yt.push(i.COLOR_ATTACHMENT0+Pt),le.depthBuffer&&le.resolveDepthBuffer===!1&&(yt.push(vt),hn.push(vt),i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,hn)),i.invalidateFramebuffer(i.READ_FRAMEBUFFER,yt))}if(t.bindFramebuffer(i.READ_FRAMEBUFFER,null),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),qe)for(let Pt=0;Pt<Z.length;Pt++){t.bindFramebuffer(i.FRAMEBUFFER,Tt.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Pt,i.RENDERBUFFER,Tt.__webglColorRenderbuffer[Pt]);let rn=n.get(Z[Pt]).__webglTexture;t.bindFramebuffer(i.FRAMEBUFFER,Tt.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+Pt,i.TEXTURE_2D,rn,0)}t.bindFramebuffer(i.DRAW_FRAMEBUFFER,Tt.__webglMultisampledFramebuffer)}else if(le.depthBuffer&&le.resolveDepthBuffer===!1&&l){let Z=le.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,[Z])}}}function tn(le){return Math.min(r.maxSamples,le.samples)}function bn(le){let Z=n.get(le);return le.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&Z.__useRenderToTexture!==!1}function _e(le){let Z=o.render.frame;u.get(le)!==Z&&(u.set(le,Z),le.update())}function vi(le,Z){let Te=le.colorSpace,Pe=le.format,Ge=le.type;return le.isCompressedTexture===!0||le.isVideoTexture===!0||Te!==n0&&Te!==ua&&(ln.getTransfer(Te)===kt?(Pe!==Or||Ge!==Ji)&&Xe("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):ze("WebGLTextures: Unsupported texture color space:",Te)),Z}function zn(le){return typeof HTMLImageElement<"u"&&le instanceof HTMLImageElement?(c.width=le.naturalWidth||le.width,c.height=le.naturalHeight||le.height):typeof VideoFrame<"u"&&le instanceof VideoFrame?(c.width=le.displayWidth,c.height=le.displayHeight):(c.width=le.width,c.height=le.height),c}this.allocateTextureUnit=$,this.resetTextureUnits=W,this.getTextureUnits=Y,this.setTextureUnits=H,this.setTexture2D=te,this.setTexture2DArray=ce,this.setTexture3D=he,this.setTextureCube=ve,this.rebindTextures=ot,this.setupRenderTarget=nt,this.updateRenderTargetMipmap=bt,this.updateMultisampleRenderTarget=en,this.setupDepthRenderbuffer=$e,this.setupFrameBufferTexture=It,this.useMultisampledRTT=bn,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function qxe(i,e){function t(n,r=ua){let s,o=ln.getTransfer(r);if(n===Ji)return i.UNSIGNED_BYTE;if(n===rg)return i.UNSIGNED_SHORT_4_4_4_4;if(n===sg)return i.UNSIGNED_SHORT_5_5_5_1;if(n===og)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===ag)return i.UNSIGNED_INT_10F_11F_11F_REV;if(n===zh)return i.BYTE;if(n===Vh)return i.SHORT;if(n===wl)return i.UNSIGNED_SHORT;if(n===Zr)return i.INT;if(n===xi)return i.UNSIGNED_INT;if(n===cr)return i.FLOAT;if(n===Wi)return i.HALF_FLOAT;if(n===f_)return i.ALPHA;if(n===Fd)return i.RGB;if(n===Or)return i.RGBA;if(n===Gs)return i.DEPTH_COMPONENT;if(n===xo)return i.DEPTH_STENCIL;if(n===Bd)return i.RED;if(n===Gh)return i.RED_INTEGER;if(n===js)return i.RG;if(n===qh)return i.RG_INTEGER;if(n===v0)return i.RGBA_INTEGER;if(n===Hh||n===Wh||n===jh||n===Xh)if(o===kt)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===Hh)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Wh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===jh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Xh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===Hh)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Wh)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===jh)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Xh)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===lg||n===cg||n===ug||n===hg)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===lg)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===cg)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===ug)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===hg)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===_0||n===x0||n===y0||n===b0||n===w0||n===$h||n===S0)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===_0||n===x0)return o===kt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===y0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(n===b0)return s.COMPRESSED_R11_EAC;if(n===w0)return s.COMPRESSED_SIGNED_R11_EAC;if(n===$h)return s.COMPRESSED_RG11_EAC;if(n===S0)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===T0||n===E0||n===M0||n===C0||n===R0||n===I0||n===P0||n===L0||n===D0||n===N0||n===F0||n===B0||n===O0||n===U0)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===T0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===E0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===M0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===C0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===R0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===I0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===P0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===L0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===D0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===N0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===F0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===B0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===O0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===U0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===k0||n===z0||n===V0)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===k0)return o===kt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===z0)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===V0)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===G0||n===q0||n===Yh||n===H0)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===G0)return s.COMPRESSED_RED_RGTC1_EXT;if(n===q0)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Yh)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===H0)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===ca?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:t}}var Hxe=`40944094 void main() {40954095 40964096 gl_Position = vec4( position, 1.0 );40974097 4098-}`,Txe=`4098+}`,Wxe=`40994099 uniform sampler2DArray depthColor;41004100 uniform float depthWidth;41014101 uniform float depthHeight;@@ -4114,23 +4114,23 @@ void main() {
41144114 41154115 }41164116 4117-}`,MF=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){let n=new F2(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){let t=e.cameras[0].viewport,n=new ds({vertexShader:Sxe,fragmentShader:Txe,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Hn(new KA(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}},CF=class extends la{constructor(e,t){super();let n=this,r=null,s=1,o=null,a="local-floor",l=1,c=null,u=null,f=null,d=null,A=null,y=null,w=typeof XRWebGLBinding<"u",S=new MF,T={},R=t.getContextAttributes(),P=null,I=null,F=[],D=[],L=new Oe,C=null,B=new $r;B.viewport=new xn;let k=new $r;k.viewport=new xn;let z=[B,k],G=new a_,W=null,Y=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Ee){let Ve=F[Ee];return Ve===void 0&&(Ve=new s0,F[Ee]=Ve),Ve.getTargetRaySpace()},this.getControllerGrip=function(Ee){let Ve=F[Ee];return Ve===void 0&&(Ve=new s0,F[Ee]=Ve),Ve.getGripSpace()},this.getHand=function(Ee){let Ve=F[Ee];return Ve===void 0&&(Ve=new s0,F[Ee]=Ve),Ve.getHandSpace()};function H(Ee){let Ve=D.indexOf(Ee.inputSource);if(Ve===-1)return;let Ye=F[Ve];Ye!==void 0&&(Ye.update(Ee.inputSource,Ee.frame,c||o),Ye.dispatchEvent({type:Ee.type,data:Ee.inputSource}))}function $(){r.removeEventListener("select",H),r.removeEventListener("selectstart",H),r.removeEventListener("selectend",H),r.removeEventListener("squeeze",H),r.removeEventListener("squeezestart",H),r.removeEventListener("squeezeend",H),r.removeEventListener("end",$),r.removeEventListener("inputsourceschange",J);for(let Ee=0;Ee<F.length;Ee++){let Ve=D[Ee];Ve!==null&&(D[Ee]=null,F[Ee].disconnect(Ve))}W=null,Y=null,S.reset();for(let Ee in T)delete T[Ee];e.setRenderTarget(P),A=null,d=null,f=null,r=null,I=null,mt.stop(),n.isPresenting=!1,e.setPixelRatio(C),e.setSize(L.width,L.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(Ee){s=Ee,n.isPresenting===!0&&Xe("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Ee){a=Ee,n.isPresenting===!0&&Xe("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||o},this.setReferenceSpace=function(Ee){c=Ee},this.getBaseLayer=function(){return d!==null?d:A},this.getBinding=function(){return f===null&&w&&(f=new XRWebGLBinding(r,t)),f},this.getFrame=function(){return y},this.getSession=function(){return r},this.setSession=async function(Ee){if(r=Ee,r!==null){if(P=e.getRenderTarget(),r.addEventListener("select",H),r.addEventListener("selectstart",H),r.addEventListener("selectend",H),r.addEventListener("squeeze",H),r.addEventListener("squeezestart",H),r.addEventListener("squeezeend",H),r.addEventListener("end",$),r.addEventListener("inputsourceschange",J),R.xrCompatible!==!0&&await t.makeXRCompatible(),C=e.getPixelRatio(),e.getSize(L),w&&"createProjectionLayer"in XRWebGLBinding.prototype){let Ye=null,Mt=null,Et=null;R.depth&&(Et=R.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,Ye=R.stencil?xo:Gs,Mt=R.stencil?ca:xi);let It={colorFormat:t.RGBA8,depthFormat:Et,scaleFactor:s};f=this.getBinding(),d=f.createProjectionLayer(It),r.updateRenderState({layers:[d]}),e.setPixelRatio(1),e.setSize(d.textureWidth,d.textureHeight,!1),I=new Ba(d.textureWidth,d.textureHeight,{format:Or,type:Ji,depthTexture:new Cs(d.textureWidth,d.textureHeight,Mt,void 0,void 0,void 0,void 0,void 0,void 0,Ye),stencilBuffer:R.stencil,colorSpace:e.outputColorSpace,samples:R.antialias?4:0,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1})}else{let Ye={antialias:R.antialias,alpha:!0,depth:R.depth,stencil:R.stencil,framebufferScaleFactor:s};A=new XRWebGLLayer(r,t,Ye),r.updateRenderState({baseLayer:A}),e.setPixelRatio(1),e.setSize(A.framebufferWidth,A.framebufferHeight,!1),I=new Ba(A.framebufferWidth,A.framebufferHeight,{format:Or,type:Ji,colorSpace:e.outputColorSpace,stencilBuffer:R.stencil,resolveDepthBuffer:A.ignoreDepthValues===!1,resolveStencilBuffer:A.ignoreDepthValues===!1})}I.isXRRenderTarget=!0,this.setFoveation(l),c=null,o=await r.requestReferenceSpace(a),mt.setContext(r),mt.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return S.getDepthTexture()};function J(Ee){for(let Ve=0;Ve<Ee.removed.length;Ve++){let Ye=Ee.removed[Ve],Mt=D.indexOf(Ye);Mt>=0&&(D[Mt]=null,F[Mt].disconnect(Ye))}for(let Ve=0;Ve<Ee.added.length;Ve++){let Ye=Ee.added[Ve],Mt=D.indexOf(Ye);if(Mt===-1){for(let It=0;It<F.length;It++)if(It>=D.length){D.push(Ye),Mt=It;break}else if(D[It]===null){D[It]=Ye,Mt=It;break}if(Mt===-1)break}let Et=F[Mt];Et&&Et.connect(Ye)}}let te=new re,ce=new re;function he(Ee,Ve,Ye){te.setFromMatrixPosition(Ve.matrixWorld),ce.setFromMatrixPosition(Ye.matrixWorld);let Mt=te.distanceTo(ce),Et=Ve.projectionMatrix.elements,It=Ye.projectionMatrix.elements,dn=Et[14]/(Et[10]-1),Gt=Et[14]/(Et[10]+1),$e=(Et[9]+1)/Et[5],ot=(Et[9]-1)/Et[5],nt=(Et[8]-1)/Et[0],bt=(It[8]+1)/It[0],yt=dn*nt,hn=dn*bt,en=Mt/(-nt+bt),tn=en*-nt;if(Ve.matrixWorld.decompose(Ee.position,Ee.quaternion,Ee.scale),Ee.translateX(tn),Ee.translateZ(en),Ee.matrixWorld.compose(Ee.position,Ee.quaternion,Ee.scale),Ee.matrixWorldInverse.copy(Ee.matrixWorld).invert(),Et[10]===-1)Ee.projectionMatrix.copy(Ve.projectionMatrix),Ee.projectionMatrixInverse.copy(Ve.projectionMatrixInverse);else{let bn=dn+en,_e=Gt+en,vi=yt-tn,zn=hn+(Mt-tn),le=$e*Gt/_e*bn,Z=ot*Gt/_e*bn;Ee.projectionMatrix.makePerspective(vi,zn,le,Z,bn,_e),Ee.projectionMatrixInverse.copy(Ee.projectionMatrix).invert()}}function ve(Ee,Ve){Ve===null?Ee.matrixWorld.copy(Ee.matrix):Ee.matrixWorld.multiplyMatrices(Ve.matrixWorld,Ee.matrix),Ee.matrixWorldInverse.copy(Ee.matrixWorld).invert()}this.updateCamera=function(Ee){if(r===null)return;let Ve=Ee.near,Ye=Ee.far;S.texture!==null&&(S.depthNear>0&&(Ve=S.depthNear),S.depthFar>0&&(Ye=S.depthFar)),G.near=k.near=B.near=Ve,G.far=k.far=B.far=Ye,(W!==G.near||Y!==G.far)&&(r.updateRenderState({depthNear:G.near,depthFar:G.far}),W=G.near,Y=G.far),G.layers.mask=Ee.layers.mask|6,B.layers.mask=G.layers.mask&-5,k.layers.mask=G.layers.mask&-3;let Mt=Ee.parent,Et=G.cameras;ve(G,Mt);for(let It=0;It<Et.length;It++)ve(Et[It],Mt);Et.length===2?he(G,B,k):G.projectionMatrix.copy(B.projectionMatrix),Re(Ee,G,Mt)};function Re(Ee,Ve,Ye){Ye===null?Ee.matrix.copy(Ve.matrixWorld):(Ee.matrix.copy(Ye.matrixWorld),Ee.matrix.invert(),Ee.matrix.multiply(Ve.matrixWorld)),Ee.matrix.decompose(Ee.position,Ee.quaternion,Ee.scale),Ee.updateMatrixWorld(!0),Ee.projectionMatrix.copy(Ve.projectionMatrix),Ee.projectionMatrixInverse.copy(Ve.projectionMatrixInverse),Ee.isPerspectiveCamera&&(Ee.fov=Id*2*Math.atan(1/Ee.projectionMatrix.elements[5]),Ee.zoom=1)}this.getCamera=function(){return G},this.getFoveation=function(){if(!(d===null&&A===null))return l},this.setFoveation=function(Ee){l=Ee,d!==null&&(d.fixedFoveation=Ee),A!==null&&A.fixedFoveation!==void 0&&(A.fixedFoveation=Ee)},this.hasDepthSensing=function(){return S.texture!==null},this.getDepthSensingMesh=function(){return S.getMesh(G)},this.getCameraTexture=function(Ee){return T[Ee]};let Qe=null;function Fe(Ee,Ve){if(u=Ve.getViewerPose(c||o),y=Ve,u!==null){let Ye=u.views;A!==null&&(e.setRenderTargetFramebuffer(I,A.framebuffer),e.setRenderTarget(I));let Mt=!1;Ye.length!==G.cameras.length&&(G.cameras.length=0,Mt=!0);for(let Gt=0;Gt<Ye.length;Gt++){let $e=Ye[Gt],ot=null;if(A!==null)ot=A.getViewport($e);else{let bt=f.getViewSubImage(d,$e);ot=bt.viewport,Gt===0&&(e.setRenderTargetTextures(I,bt.colorTexture,bt.depthStencilTexture),e.setRenderTarget(I))}let nt=z[Gt];nt===void 0&&(nt=new $r,nt.layers.enable(Gt),nt.viewport=new xn,z[Gt]=nt),nt.matrix.fromArray($e.transform.matrix),nt.matrix.decompose(nt.position,nt.quaternion,nt.scale),nt.projectionMatrix.fromArray($e.projectionMatrix),nt.projectionMatrixInverse.copy(nt.projectionMatrix).invert(),nt.viewport.set(ot.x,ot.y,ot.width,ot.height),Gt===0&&(G.matrix.copy(nt.matrix),G.matrix.decompose(G.position,G.quaternion,G.scale)),Mt===!0&&G.cameras.push(nt)}let Et=r.enabledFeatures;if(Et&&Et.includes("depth-sensing")&&r.depthUsage=="gpu-optimized"&&w){f=n.getBinding();let Gt=f.getDepthInformation(Ye[0]);Gt&&Gt.isValid&&Gt.texture&&S.init(Gt,r.renderState)}if(Et&&Et.includes("camera-access")&&w){e.state.unbindTexture(),f=n.getBinding();for(let Gt=0;Gt<Ye.length;Gt++){let $e=Ye[Gt].camera;if($e){let ot=T[$e];ot||(ot=new F2,T[$e]=ot);let nt=f.getCameraImage($e);ot.sourceTexture=nt}}}}for(let Ye=0;Ye<F.length;Ye++){let Mt=D[Ye],Et=F[Ye];Mt!==null&&Et!==void 0&&Et.update(Mt,Ve,c||o)}Qe&&Qe(Ee,Ve),Ve.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:Ve}),y=null}let mt=new $Z;mt.setAnimationLoop(Fe),this.setAnimationLoop=function(Ee){Qe=Ee},this.dispose=function(){}}},Exe=new cn,eK=new Mn;eK.set(-1,0,0,0,1,0,0,0,1);function Mxe(i,e){function t(S,T){S.matrixAutoUpdate===!0&&S.updateMatrix(),T.value.copy(S.matrix)}function n(S,T){T.color.getRGB(S.fogColor.value,oF(i)),T.isFog?(S.fogNear.value=T.near,S.fogFar.value=T.far):T.isFogExp2&&(S.fogDensity.value=T.density)}function r(S,T,R,P,I){T.isNodeMaterial?T.uniformsNeedUpdate=!1:T.isMeshBasicMaterial?s(S,T):T.isMeshLambertMaterial?(s(S,T),T.envMap&&(S.envMapIntensity.value=T.envMapIntensity)):T.isMeshToonMaterial?(s(S,T),f(S,T)):T.isMeshPhongMaterial?(s(S,T),u(S,T),T.envMap&&(S.envMapIntensity.value=T.envMapIntensity)):T.isMeshStandardMaterial?(s(S,T),d(S,T),T.isMeshPhysicalMaterial&&A(S,T,I)):T.isMeshMatcapMaterial?(s(S,T),y(S,T)):T.isMeshDepthMaterial?s(S,T):T.isMeshDistanceMaterial?(s(S,T),w(S,T)):T.isMeshNormalMaterial?s(S,T):T.isLineBasicMaterial?(o(S,T),T.isLineDashedMaterial&&a(S,T)):T.isPointsMaterial?l(S,T,R,P):T.isSpriteMaterial?c(S,T):T.isShadowMaterial?(S.color.value.copy(T.color),S.opacity.value=T.opacity):T.isShaderMaterial&&(T.uniformsNeedUpdate=!1)}function s(S,T){S.opacity.value=T.opacity,T.color&&S.diffuse.value.copy(T.color),T.emissive&&S.emissive.value.copy(T.emissive).multiplyScalar(T.emissiveIntensity),T.map&&(S.map.value=T.map,t(T.map,S.mapTransform)),T.alphaMap&&(S.alphaMap.value=T.alphaMap,t(T.alphaMap,S.alphaMapTransform)),T.bumpMap&&(S.bumpMap.value=T.bumpMap,t(T.bumpMap,S.bumpMapTransform),S.bumpScale.value=T.bumpScale,T.side===mi&&(S.bumpScale.value*=-1)),T.normalMap&&(S.normalMap.value=T.normalMap,t(T.normalMap,S.normalMapTransform),S.normalScale.value.copy(T.normalScale),T.side===mi&&S.normalScale.value.negate()),T.displacementMap&&(S.displacementMap.value=T.displacementMap,t(T.displacementMap,S.displacementMapTransform),S.displacementScale.value=T.displacementScale,S.displacementBias.value=T.displacementBias),T.emissiveMap&&(S.emissiveMap.value=T.emissiveMap,t(T.emissiveMap,S.emissiveMapTransform)),T.specularMap&&(S.specularMap.value=T.specularMap,t(T.specularMap,S.specularMapTransform)),T.alphaTest>0&&(S.alphaTest.value=T.alphaTest);let R=e.get(T),P=R.envMap,I=R.envMapRotation;P&&(S.envMap.value=P,S.envMapRotation.value.setFromMatrix4(Exe.makeRotationFromEuler(I)).transpose(),P.isCubeTexture&&P.isRenderTargetTexture===!1&&S.envMapRotation.value.premultiply(eK),S.reflectivity.value=T.reflectivity,S.ior.value=T.ior,S.refractionRatio.value=T.refractionRatio),T.lightMap&&(S.lightMap.value=T.lightMap,S.lightMapIntensity.value=T.lightMapIntensity,t(T.lightMap,S.lightMapTransform)),T.aoMap&&(S.aoMap.value=T.aoMap,S.aoMapIntensity.value=T.aoMapIntensity,t(T.aoMap,S.aoMapTransform))}function o(S,T){S.diffuse.value.copy(T.color),S.opacity.value=T.opacity,T.map&&(S.map.value=T.map,t(T.map,S.mapTransform))}function a(S,T){S.dashSize.value=T.dashSize,S.totalSize.value=T.dashSize+T.gapSize,S.scale.value=T.scale}function l(S,T,R,P){S.diffuse.value.copy(T.color),S.opacity.value=T.opacity,S.size.value=T.size*R,S.scale.value=P*.5,T.map&&(S.map.value=T.map,t(T.map,S.uvTransform)),T.alphaMap&&(S.alphaMap.value=T.alphaMap,t(T.alphaMap,S.alphaMapTransform)),T.alphaTest>0&&(S.alphaTest.value=T.alphaTest)}function c(S,T){S.diffuse.value.copy(T.color),S.opacity.value=T.opacity,S.rotation.value=T.rotation,T.map&&(S.map.value=T.map,t(T.map,S.mapTransform)),T.alphaMap&&(S.alphaMap.value=T.alphaMap,t(T.alphaMap,S.alphaMapTransform)),T.alphaTest>0&&(S.alphaTest.value=T.alphaTest)}function u(S,T){S.specular.value.copy(T.specular),S.shininess.value=Math.max(T.shininess,1e-4)}function f(S,T){T.gradientMap&&(S.gradientMap.value=T.gradientMap)}function d(S,T){S.metalness.value=T.metalness,T.metalnessMap&&(S.metalnessMap.value=T.metalnessMap,t(T.metalnessMap,S.metalnessMapTransform)),S.roughness.value=T.roughness,T.roughnessMap&&(S.roughnessMap.value=T.roughnessMap,t(T.roughnessMap,S.roughnessMapTransform)),T.envMap&&(S.envMapIntensity.value=T.envMapIntensity)}function A(S,T,R){S.ior.value=T.ior,T.sheen>0&&(S.sheenColor.value.copy(T.sheenColor).multiplyScalar(T.sheen),S.sheenRoughness.value=T.sheenRoughness,T.sheenColorMap&&(S.sheenColorMap.value=T.sheenColorMap,t(T.sheenColorMap,S.sheenColorMapTransform)),T.sheenRoughnessMap&&(S.sheenRoughnessMap.value=T.sheenRoughnessMap,t(T.sheenRoughnessMap,S.sheenRoughnessMapTransform))),T.clearcoat>0&&(S.clearcoat.value=T.clearcoat,S.clearcoatRoughness.value=T.clearcoatRoughness,T.clearcoatMap&&(S.clearcoatMap.value=T.clearcoatMap,t(T.clearcoatMap,S.clearcoatMapTransform)),T.clearcoatRoughnessMap&&(S.clearcoatRoughnessMap.value=T.clearcoatRoughnessMap,t(T.clearcoatRoughnessMap,S.clearcoatRoughnessMapTransform)),T.clearcoatNormalMap&&(S.clearcoatNormalMap.value=T.clearcoatNormalMap,t(T.clearcoatNormalMap,S.clearcoatNormalMapTransform),S.clearcoatNormalScale.value.copy(T.clearcoatNormalScale),T.side===mi&&S.clearcoatNormalScale.value.negate())),T.dispersion>0&&(S.dispersion.value=T.dispersion),T.iridescence>0&&(S.iridescence.value=T.iridescence,S.iridescenceIOR.value=T.iridescenceIOR,S.iridescenceThicknessMinimum.value=T.iridescenceThicknessRange[0],S.iridescenceThicknessMaximum.value=T.iridescenceThicknessRange[1],T.iridescenceMap&&(S.iridescenceMap.value=T.iridescenceMap,t(T.iridescenceMap,S.iridescenceMapTransform)),T.iridescenceThicknessMap&&(S.iridescenceThicknessMap.value=T.iridescenceThicknessMap,t(T.iridescenceThicknessMap,S.iridescenceThicknessMapTransform))),T.transmission>0&&(S.transmission.value=T.transmission,S.transmissionSamplerMap.value=R.texture,S.transmissionSamplerSize.value.set(R.width,R.height),T.transmissionMap&&(S.transmissionMap.value=T.transmissionMap,t(T.transmissionMap,S.transmissionMapTransform)),S.thickness.value=T.thickness,T.thicknessMap&&(S.thicknessMap.value=T.thicknessMap,t(T.thicknessMap,S.thicknessMapTransform)),S.attenuationDistance.value=T.attenuationDistance,S.attenuationColor.value.copy(T.attenuationColor)),T.anisotropy>0&&(S.anisotropyVector.value.set(T.anisotropy*Math.cos(T.anisotropyRotation),T.anisotropy*Math.sin(T.anisotropyRotation)),T.anisotropyMap&&(S.anisotropyMap.value=T.anisotropyMap,t(T.anisotropyMap,S.anisotropyMapTransform))),S.specularIntensity.value=T.specularIntensity,S.specularColor.value.copy(T.specularColor),T.specularColorMap&&(S.specularColorMap.value=T.specularColorMap,t(T.specularColorMap,S.specularColorMapTransform)),T.specularIntensityMap&&(S.specularIntensityMap.value=T.specularIntensityMap,t(T.specularIntensityMap,S.specularIntensityMapTransform))}function y(S,T){T.matcap&&(S.matcap.value=T.matcap)}function w(S,T){let R=e.get(T).light;S.referencePosition.value.setFromMatrixPosition(R.matrixWorld),S.nearDistance.value=R.shadow.camera.near,S.farDistance.value=R.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:r}}function Cxe(i,e,t,n){let r={},s={},o=[],a=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function l(I,F){let D=F.program;n.uniformBlockBinding(I,D)}function c(I,F){let D=r[I.id];D===void 0&&(S(I),D=u(I),r[I.id]=D,I.addEventListener("dispose",R));let L=F.program;n.updateUBOMapping(I,L);let C=e.render.frame;s[I.id]!==C&&(d(I),s[I.id]=C)}function u(I){let F=f();I.__bindingPointIndex=F;let D=i.createBuffer(),L=I.__size,C=I.usage;return i.bindBuffer(i.UNIFORM_BUFFER,D),i.bufferData(i.UNIFORM_BUFFER,L,C),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,F,D),D}function f(){for(let I=0;I<a;I++)if(o.indexOf(I)===-1)return o.push(I),I;return ze("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function d(I){let F=r[I.id],D=I.uniforms,L=I.__cache;i.bindBuffer(i.UNIFORM_BUFFER,F);for(let C=0,B=D.length;C<B;C++){let k=D[C];if(Array.isArray(k))for(let z=0,G=k.length;z<G;z++)A(k[z],C,z,L);else A(k,C,0,L)}i.bindBuffer(i.UNIFORM_BUFFER,null)}function A(I,F,D,L){if(w(I,F,D,L)===!0){let C=I.__offset,B=I.value;if(Array.isArray(B)){let k=0;for(let z=0;z<B.length;z++){let G=B[z],W=T(G);y(G,I.__data,k),typeof G!="number"&&typeof G!="boolean"&&!G.isMatrix3&&!ArrayBuffer.isView(G)&&(k+=W.storage/Float32Array.BYTES_PER_ELEMENT)}}else y(B,I.__data,0);i.bufferSubData(i.UNIFORM_BUFFER,C,I.__data)}}function y(I,F,D){typeof I=="number"||typeof I=="boolean"?F[0]=I:I.isMatrix3?(F[0]=I.elements[0],F[1]=I.elements[1],F[2]=I.elements[2],F[3]=0,F[4]=I.elements[3],F[5]=I.elements[4],F[6]=I.elements[5],F[7]=0,F[8]=I.elements[6],F[9]=I.elements[7],F[10]=I.elements[8],F[11]=0):ArrayBuffer.isView(I)?F.set(new I.constructor(I.buffer,I.byteOffset,F.length)):I.toArray(F,D)}function w(I,F,D,L){let C=I.value,B=F+"_"+D;if(L[B]===void 0)return typeof C=="number"||typeof C=="boolean"?L[B]=C:ArrayBuffer.isView(C)?L[B]=C.slice():L[B]=C.clone(),!0;{let k=L[B];if(typeof C=="number"||typeof C=="boolean"){if(k!==C)return L[B]=C,!0}else{if(ArrayBuffer.isView(C))return!0;if(k.equals(C)===!1)return k.copy(C),!0}}return!1}function S(I){let F=I.uniforms,D=0,L=16;for(let B=0,k=F.length;B<k;B++){let z=Array.isArray(F[B])?F[B]:[F[B]];for(let G=0,W=z.length;G<W;G++){let Y=z[G],H=Array.isArray(Y.value)?Y.value:[Y.value];for(let $=0,J=H.length;$<J;$++){let te=H[$],ce=T(te),he=D%L,ve=he%ce.boundary,Re=he+ve;D+=ve,Re!==0&&L-Re<ce.storage&&(D+=L-Re),Y.__data=new Float32Array(ce.storage/Float32Array.BYTES_PER_ELEMENT),Y.__offset=D,D+=ce.storage}}}let C=D%L;return C>0&&(D+=L-C),I.__size=D,I.__cache={},this}function T(I){let F={boundary:0,storage:0};return typeof I=="number"||typeof I=="boolean"?(F.boundary=4,F.storage=4):I.isVector2?(F.boundary=8,F.storage=8):I.isVector3||I.isColor?(F.boundary=16,F.storage=12):I.isVector4?(F.boundary=16,F.storage=16):I.isMatrix3?(F.boundary=48,F.storage=48):I.isMatrix4?(F.boundary=64,F.storage=64):I.isTexture?Xe("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ArrayBuffer.isView(I)?(F.boundary=16,F.storage=I.byteLength):Xe("WebGLRenderer: Unsupported uniform value type.",I),F}function R(I){let F=I.target;F.removeEventListener("dispose",R);let D=o.indexOf(F.__bindingPointIndex);o.splice(D,1),i.deleteBuffer(r[F.id]),delete r[F.id],delete s[F.id]}function P(){for(let I in r)i.deleteBuffer(r[I]);o=[],r={},s={}}return{bind:l,update:c,dispose:P}}var Rxe=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]),Zh=null;function Ixe(){return Zh===null&&(Zh=new jA(Rxe,16,16,js,Wi),Zh.name="DFG_LUT",Zh.minFilter=Mi,Zh.magFilter=Mi,Zh.wrapS=aa,Zh.wrapT=aa,Zh.generateMipmaps=!1,Zh.needsUpdate=!0),Zh}var qM=class{constructor(e={}){let{canvas:t=UM(),context:n=null,depth:r=!0,stencil:s=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:f=!1,reversedDepthBuffer:d=!1,outputBufferType:A=Ji}=e;this.isWebGLRenderer=!0;let y;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");y=n.getContextAttributes().alpha}else y=o;let w=A,S=new Set([v0,Gh,Vh]),T=new Set([Ji,xi,wl,ca,rg,sg]),R=new Uint32Array(4),P=new Int32Array(4),I=new re,F=null,D=null,L=[],C=[],B=null;this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=ao,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let k=this,z=!1,G=null,W=null,Y=null,H=null;this._outputColorSpace=Fr;let $=0,J=0,te=null,ce=-1,he=null,ve=new xn,Re=new xn,Qe=null,Fe=new zt(0),mt=0,Ee=t.width,Ve=t.height,Ye=1,Mt=null,Et=null,It=new xn(0,0,Ee,Ve),dn=new xn(0,0,Ee,Ve),Gt=!1,$e=new Gc,ot=!1,nt=!1,bt=new cn,yt=new re,hn=new xn,en={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},tn=!1;function bn(){return te===null?Ye:1}let _e=n;function vi(ne,Se){return t.getContext(ne,Se)}try{let ne={alpha:!0,depth:r,stencil:s,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:f};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${"185"}`),t.addEventListener("webglcontextlost",nr,!1),t.addEventListener("webglcontextrestored",Fn,!1),t.addEventListener("webglcontextcreationerror",is,!1),_e===null){let Se="webgl2";if(_e=vi(Se,ne),_e===null)throw vi(Se)?new Error("THREE.WebGLRenderer: Error creating WebGL context with your selected attributes."):new Error("THREE.WebGLRenderer: Error creating WebGL context.")}}catch(ne){throw ze("WebGLRenderer: "+ne.message),ne}let zn,le,Z,Te,Pe,Ge,vt,Tt,qe,Je,Pt,rn,Lt,Rt,fn,wn,Dn,ye,wt,Ze,St,Bt,ut;function Ce(){zn=new Ove(_e),zn.init(),St=new wxe(_e,zn),le=new Rve(_e,zn,e,St),Z=new yxe(_e,zn),le.reversedDepthBuffer&&d&&Z.buffers.depth.setReversed(!0),W=_e.createFramebuffer(),Y=_e.createFramebuffer(),H=_e.createFramebuffer(),Te=new zve(_e),Pe=new axe,Ge=new bxe(_e,zn,Z,Pe,le,St,Te),vt=new Bve(k),Tt=new HAe(_e),Bt=new Mve(_e,Tt),qe=new Uve(_e,Tt,Te,Bt),Je=new Gve(_e,qe,Tt,Bt,Te),ye=new Vve(_e,le,Ge),fn=new Ive(Pe),Pt=new oxe(k,vt,zn,le,Bt,fn),rn=new Mxe(k,Pe),Lt=new cxe,Rt=new mxe(zn),Dn=new Eve(k,vt,Z,Je,y,l),wn=new xxe(k,Je,le),ut=new Cxe(_e,Te,le,Z),wt=new Cve(_e,zn,Te),Ze=new kve(_e,zn,Te),Te.programs=Pt.programs,k.capabilities=le,k.extensions=zn,k.properties=Pe,k.renderLists=Lt,k.shadowMap=wn,k.state=Z,k.info=Te}Ce(),w!==Ji&&(B=new Hve(w,t.width,t.height,a,r,s));let Yt=new CF(k,_e);this.xr=Yt,this.getContext=function(){return _e},this.getContextAttributes=function(){return _e.getContextAttributes()},this.forceContextLoss=function(){let ne=zn.get("WEBGL_lose_context");ne&&ne.loseContext()},this.forceContextRestore=function(){let ne=zn.get("WEBGL_lose_context");ne&&ne.restoreContext()},this.getPixelRatio=function(){return Ye},this.setPixelRatio=function(ne){ne!==void 0&&(Ye=ne,this.setSize(Ee,Ve,!1))},this.getSize=function(ne){return ne.set(Ee,Ve)},this.setSize=function(ne,Se,ke=!0){if(Yt.isPresenting){Xe("WebGLRenderer: Can't change size while VR device is presenting.");return}Ee=ne,Ve=Se,t.width=Math.floor(ne*Ye),t.height=Math.floor(Se*Ye),ke===!0&&(t.style.width=ne+"px",t.style.height=Se+"px"),B!==null&&B.setSize(t.width,t.height),this.setViewport(0,0,ne,Se)},this.getDrawingBufferSize=function(ne){return ne.set(Ee*Ye,Ve*Ye).floor()},this.setDrawingBufferSize=function(ne,Se,ke){Ee=ne,Ve=Se,Ye=ke,t.width=Math.floor(ne*ke),t.height=Math.floor(Se*ke),this.setViewport(0,0,ne,Se)},this.setEffects=function(ne){if(w===Ji){ze("WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(ne){for(let Se=0;Se<ne.length;Se++)if(ne[Se].isOutputPass===!0){Xe("WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}B.setEffects(ne||[])},this.getCurrentViewport=function(ne){return ne.copy(ve)},this.getViewport=function(ne){return ne.copy(It)},this.setViewport=function(ne,Se,ke,De){ne.isVector4?It.set(ne.x,ne.y,ne.z,ne.w):It.set(ne,Se,ke,De),Z.viewport(ve.copy(It).multiplyScalar(Ye).round())},this.getScissor=function(ne){return ne.copy(dn)},this.setScissor=function(ne,Se,ke,De){ne.isVector4?dn.set(ne.x,ne.y,ne.z,ne.w):dn.set(ne,Se,ke,De),Z.scissor(Re.copy(dn).multiplyScalar(Ye).round())},this.getScissorTest=function(){return Gt},this.setScissorTest=function(ne){Z.setScissorTest(Gt=ne)},this.setOpaqueSort=function(ne){Mt=ne},this.setTransparentSort=function(ne){Et=ne},this.getClearColor=function(ne){return ne.copy(Dn.getClearColor())},this.setClearColor=function(){Dn.setClearColor(...arguments)},this.getClearAlpha=function(){return Dn.getClearAlpha()},this.setClearAlpha=function(){Dn.setClearAlpha(...arguments)},this.clear=function(ne=!0,Se=!0,ke=!0){let De=0;if(ne){let Ne=!1;if(te!==null){let qt=te.texture.format;Ne=S.has(qt)}if(Ne){let qt=te.texture.type,Qt=T.has(qt),Vt=Dn.getClearColor(),sn=Dn.getClearAlpha(),pn=Vt.r,Wn=Vt.g,Jn=Vt.b;Qt?(R[0]=pn,R[1]=Wn,R[2]=Jn,R[3]=sn,_e.clearBufferuiv(_e.COLOR,0,R)):(P[0]=pn,P[1]=Wn,P[2]=Jn,P[3]=sn,_e.clearBufferiv(_e.COLOR,0,P))}else De|=_e.COLOR_BUFFER_BIT}Se&&(De|=_e.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0)),ke&&(De|=_e.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),De!==0&&_e.clear(De)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.setNodesHandler=function(ne){ne.setRenderer(this),G=ne},this.dispose=function(){t.removeEventListener("webglcontextlost",nr,!1),t.removeEventListener("webglcontextrestored",Fn,!1),t.removeEventListener("webglcontextcreationerror",is,!1),Dn.dispose(),Lt.dispose(),Rt.dispose(),Pe.dispose(),vt.dispose(),Je.dispose(),Bt.dispose(),ut.dispose(),Pt.dispose(),Yt.dispose(),Yt.removeEventListener("sessionstart",Ks),Yt.removeEventListener("sessionend",Ol),nh.stop()};function nr(ne){ne.preventDefault(),VA("WebGLRenderer: Context Lost."),z=!0}function Fn(){VA("WebGLRenderer: Context Restored."),z=!1;let ne=Te.autoReset,Se=wn.enabled,ke=wn.autoUpdate,De=wn.needsUpdate,Ne=wn.type;Ce(),Te.autoReset=ne,wn.enabled=Se,wn.autoUpdate=ke,wn.needsUpdate=De,wn.type=Ne}function is(ne){ze("WebGLRenderer: A WebGL context could not be created. Reason: ",ne.statusMessage)}function Lr(ne){let Se=ne.target;Se.removeEventListener("dispose",Lr),Fl(Se)}function Fl(ne){wa(ne),Pe.remove(ne)}function wa(ne){let Se=Pe.get(ne).programs;Se!==void 0&&(Se.forEach(function(ke){Pt.releaseProgram(ke)}),ne.isShaderMaterial&&Pt.releaseShaderCache(ne))}this.renderBufferDirect=function(ne,Se,ke,De,Ne,qt){Se===null&&(Se=en);let Qt=Ne.isMesh&&Ne.matrixWorld.determinantAffine()<0,Vt=PG(ne,Se,ke,De,Ne);Z.setMaterial(De,Qt);let sn=ke.index,pn=1;if(De.wireframe===!0){if(sn=qe.getWireframeAttribute(ke),sn===void 0)return;pn=2}let Wn=ke.drawRange,Jn=ke.attributes.position,gn=Wn.start*pn,Yi=(Wn.start+Wn.count)*pn;qt!==null&&(gn=Math.max(gn,qt.start*pn),Yi=Math.min(Yi,(qt.start+qt.count)*pn)),sn!==null?(gn=Math.max(gn,0),Yi=Math.min(Yi,sn.count)):Jn!=null&&(gn=Math.max(gn,0),Yi=Math.min(Yi,Jn.count));let rs=Yi-gn;if(rs<0||rs===1/0)return;Bt.setup(Ne,De,Vt,ke,sn);let qr,ir=wt;if(sn!==null&&(qr=Tt.get(sn),ir=Ze,ir.setIndex(qr)),Ne.isMesh)De.wireframe===!0?(Z.setLineWidth(De.wireframeLinewidth*bn()),ir.setMode(_e.LINES)):ir.setMode(_e.TRIANGLES);else if(Ne.isLine){let Co=De.linewidth;Co===void 0&&(Co=1),Z.setLineWidth(Co*bn()),Ne.isLineSegments?ir.setMode(_e.LINES):Ne.isLineLoop?ir.setMode(_e.LINE_LOOP):ir.setMode(_e.LINE_STRIP)}else Ne.isPoints?ir.setMode(_e.POINTS):Ne.isSprite&&ir.setMode(_e.TRIANGLES);if(Ne.isBatchedMesh)if(zn.get("WEBGL_multi_draw"))ir.renderMultiDraw(Ne._multiDrawStarts,Ne._multiDrawCounts,Ne._multiDrawCount);else{let Co=Ne._multiDrawStarts,Zt=Ne._multiDrawCounts,rl=Ne._multiDrawCount,yi=sn?Tt.get(sn).bytesPerElement:1,Ul=Pe.get(De).currentProgram.getUniforms();for(let uu=0;uu<rl;uu++)Ul.setValue(_e,"_gl_DrawID",uu),ir.render(Co[uu]/yi,Zt[uu])}else if(Ne.isInstancedMesh)ir.renderInstances(gn,rs,Ne.count);else if(ke.isInstancedBufferGeometry){let Co=ke._maxInstanceCount!==void 0?ke._maxInstanceCount:1/0,Zt=Math.min(ke.instanceCount,Co);ir.renderInstances(gn,rs,Zt)}else ir.render(gn,rs)};function Bl(ne,Se,ke){ne.transparent===!0&&ne.side===vr&&ne.forceSinglePass===!1?(ne.side=mi,ne.needsUpdate=!0,Gx(ne,Se,ke),ne.side=ko,ne.needsUpdate=!0,Gx(ne,Se,ke),ne.side=vr):Gx(ne,Se,ke)}this.compile=function(ne,Se,ke=null){ke===null&&(ke=ne),D=Rt.get(ke),D.init(Se),C.push(D),ke.traverseVisible(function(Ne){Ne.isLight&&Ne.layers.test(Se.layers)&&(D.pushLight(Ne),Ne.castShadow&&D.pushShadow(Ne))}),ne!==ke&&ne.traverseVisible(function(Ne){Ne.isLight&&Ne.layers.test(Se.layers)&&(D.pushLight(Ne),Ne.castShadow&&D.pushShadow(Ne))}),D.setupLights();let De=new Set;return ne.traverse(function(Ne){if(!(Ne.isMesh||Ne.isPoints||Ne.isLine||Ne.isSprite))return;let qt=Ne.material;if(qt)if(Array.isArray(qt))for(let Qt=0;Qt<qt.length;Qt++){let Vt=qt[Qt];Bl(Vt,ke,Ne),De.add(Vt)}else Bl(qt,ke,Ne),De.add(qt)}),D=C.pop(),De},this.compileAsync=function(ne,Se,ke=null){let De=this.compile(ne,Se,ke);return new Promise(Ne=>{function qt(){if(De.forEach(function(Qt){Pe.get(Qt).currentProgram.isReady()&&De.delete(Qt)}),De.size===0){Ne(ne);return}setTimeout(qt,10)}zn.get("KHR_parallel_shader_compile")!==null?qt():setTimeout(qt,10)})};let il=null;function xr(ne){il&&il(ne)}function Ks(){nh.stop()}function Ol(){nh.start()}let nh=new $Z;nh.setAnimationLoop(xr),typeof self<"u"&&nh.setContext(self),this.setAnimationLoop=function(ne){il=ne,Yt.setAnimationLoop(ne),ne===null?nh.stop():nh.start()},Yt.addEventListener("sessionstart",Ks),Yt.addEventListener("sessionend",Ol),this.render=function(ne,Se){if(Se!==void 0&&Se.isCamera!==!0){ze("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(z===!0)return;G!==null&&G.renderStart(ne,Se);let ke=Yt.enabled===!0&&Yt.isPresenting===!0,De=B!==null&&(te===null||ke)&&B.begin(k,te);if(ne.matrixWorldAutoUpdate===!0&&ne.updateMatrixWorld(),Se.parent===null&&Se.matrixWorldAutoUpdate===!0&&Se.updateMatrixWorld(),Yt.enabled===!0&&Yt.isPresenting===!0&&(B===null||B.isCompositing()===!1)&&(Yt.cameraAutoUpdate===!0&&Yt.updateCamera(Se),Se=Yt.getCamera()),ne.isScene===!0&&ne.onBeforeRender(k,ne,Se,te),D=Rt.get(ne,C.length),D.init(Se),D.state.textureUnits=Ge.getTextureUnits(),C.push(D),bt.multiplyMatrices(Se.projectionMatrix,Se.matrixWorldInverse),$e.setFromProjectionMatrix(bt,Uo,Se.reversedDepth),nt=this.localClippingEnabled,ot=fn.init(this.clippingPlanes,nt),F=Lt.get(ne,L.length),F.init(),L.push(F),Yt.enabled===!0&&Yt.isPresenting===!0){let Qt=k.xr.getDepthSensingMesh();Qt!==null&&eT(Qt,Se,-1/0,k.sortObjects)}eT(ne,Se,0,k.sortObjects),F.finish(),k.sortObjects===!0&&F.sort(Mt,Et,Se.reversedDepth),tn=Yt.enabled===!1||Yt.isPresenting===!1||Yt.hasDepthSensing()===!1,tn&&Dn.addToRenderList(F,ne),this.info.render.frame++,this.info.autoReset===!0&&this.info.reset(),ot===!0&&fn.beginShadows();let Ne=D.state.shadowsArray;if(wn.render(Ne,ne,Se),ot===!0&&fn.endShadows(),(De&&B.hasRenderPass())===!1){let Qt=F.opaque,Vt=F.transmissive;if(D.setupLights(),Se.isArrayCamera){let sn=Se.cameras;if(Vt.length>0)for(let pn=0,Wn=sn.length;pn<Wn;pn++){let Jn=sn[pn];jP(Qt,Vt,ne,Jn)}tn&&Dn.render(ne);for(let pn=0,Wn=sn.length;pn<Wn;pn++){let Jn=sn[pn];WP(F,ne,Jn,Jn.viewport)}}else Vt.length>0&&jP(Qt,Vt,ne,Se),tn&&Dn.render(ne),WP(F,ne,Se)}te!==null&&J===0&&(Ge.updateMultisampleRenderTarget(te),Ge.updateRenderTargetMipmap(te)),De&&B.end(k),ne.isScene===!0&&ne.onAfterRender(k,ne,Se),Bt.resetDefaultState(),ce=-1,he=null,C.pop(),C.length>0?(D=C[C.length-1],Ge.setTextureUnits(D.state.textureUnits),ot===!0&&fn.setGlobalState(k.clippingPlanes,D.state.camera)):D=null,L.pop(),L.length>0?F=L[L.length-1]:F=null,G!==null&&G.renderEnd()};function eT(ne,Se,ke,De){if(ne.visible===!1)return;if(ne.layers.test(Se.layers)){if(ne.isGroup)ke=ne.renderOrder;else if(ne.isLOD)ne.autoUpdate===!0&&ne.update(Se);else if(ne.isLightProbeGrid)D.pushLightProbeGrid(ne);else if(ne.isLight)D.pushLight(ne),ne.castShadow&&D.pushShadow(ne);else if(ne.isSprite){if(!ne.frustumCulled||$e.intersectsSprite(ne)){De&&hn.setFromMatrixPosition(ne.matrixWorld).applyMatrix4(bt);let Qt=Je.update(ne),Vt=ne.material;Vt.visible&&F.push(ne,Qt,Vt,ke,hn.z,null)}}else if((ne.isMesh||ne.isLine||ne.isPoints)&&(!ne.frustumCulled||$e.intersectsObject(ne))){let Qt=Je.update(ne),Vt=ne.material;if(De&&(ne.boundingSphere!==void 0?(ne.boundingSphere===null&&ne.computeBoundingSphere(),hn.copy(ne.boundingSphere.center)):(Qt.boundingSphere===null&&Qt.computeBoundingSphere(),hn.copy(Qt.boundingSphere.center)),hn.applyMatrix4(ne.matrixWorld).applyMatrix4(bt)),Array.isArray(Vt)){let sn=Qt.groups;for(let pn=0,Wn=sn.length;pn<Wn;pn++){let Jn=sn[pn],gn=Vt[Jn.materialIndex];gn&&gn.visible&&F.push(ne,Qt,gn,ke,hn.z,Jn)}}else Vt.visible&&F.push(ne,Qt,Vt,ke,hn.z,null)}}let qt=ne.children;for(let Qt=0,Vt=qt.length;Qt<Vt;Qt++)eT(qt[Qt],Se,ke,De)}function WP(ne,Se,ke,De){let{opaque:Ne,transmissive:qt,transparent:Qt}=ne;D.setupLightsView(ke),ot===!0&&fn.setGlobalState(k.clippingPlanes,ke),De&&Z.viewport(ve.copy(De)),Ne.length>0&&Vx(Ne,Se,ke),qt.length>0&&Vx(qt,Se,ke),Qt.length>0&&Vx(Qt,Se,ke),Z.buffers.depth.setTest(!0),Z.buffers.depth.setMask(!0),Z.buffers.color.setMask(!0),Z.setPolygonOffset(!1)}function jP(ne,Se,ke,De){if((ke.isScene===!0?ke.overrideMaterial:null)!==null)return;if(D.state.transmissionRenderTarget[De.id]===void 0){let gn=zn.has("EXT_color_buffer_half_float")||zn.has("EXT_color_buffer_float");D.state.transmissionRenderTarget[De.id]=new Ba(1,1,{generateMipmaps:!0,type:gn?Wi:Ji,minFilter:Vo,samples:Math.max(4,le.samples),stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:ln.workingColorSpace})}let qt=D.state.transmissionRenderTarget[De.id],Qt=De.viewport||ve;qt.setSize(Qt.z*k.transmissionResolutionScale,Qt.w*k.transmissionResolutionScale);let Vt=k.getRenderTarget(),sn=k.getActiveCubeFace(),pn=k.getActiveMipmapLevel();k.setRenderTarget(qt),k.getClearColor(Fe),mt=k.getClearAlpha(),mt<1&&k.setClearColor(16777215,.5),k.clear(),tn&&Dn.render(ke);let Wn=k.toneMapping;k.toneMapping=ao;let Jn=De.viewport;if(De.viewport!==void 0&&(De.viewport=void 0),D.setupLightsView(De),ot===!0&&fn.setGlobalState(k.clippingPlanes,De),Vx(ne,ke,De),Ge.updateMultisampleRenderTarget(qt),Ge.updateRenderTargetMipmap(qt),zn.has("WEBGL_multisampled_render_to_texture")===!1){let gn=!1;for(let Yi=0,rs=Se.length;Yi<rs;Yi++){let qr=Se[Yi],{object:ir,geometry:Co,material:Zt,group:rl}=qr;if(Zt.side===vr&&ir.layers.test(De.layers)){let yi=Zt.side;Zt.side=mi,Zt.needsUpdate=!0,XP(ir,ke,De,Co,Zt,rl),Zt.side=yi,Zt.needsUpdate=!0,gn=!0}}gn===!0&&(Ge.updateMultisampleRenderTarget(qt),Ge.updateRenderTargetMipmap(qt))}k.setRenderTarget(Vt,sn,pn),k.setClearColor(Fe,mt),Jn!==void 0&&(De.viewport=Jn),k.toneMapping=Wn}function Vx(ne,Se,ke){let De=Se.isScene===!0?Se.overrideMaterial:null;for(let Ne=0,qt=ne.length;Ne<qt;Ne++){let Qt=ne[Ne],{object:Vt,geometry:sn,group:pn}=Qt,Wn=Qt.material;Wn.allowOverride===!0&&De!==null&&(Wn=De),Vt.layers.test(ke.layers)&&XP(Vt,Se,ke,sn,Wn,pn)}}function XP(ne,Se,ke,De,Ne,qt){ne.onBeforeRender(k,Se,ke,De,Ne,qt),ne.modelViewMatrix.multiplyMatrices(ke.matrixWorldInverse,ne.matrixWorld),ne.normalMatrix.getNormalMatrix(ne.modelViewMatrix),Ne.onBeforeRender(k,Se,ke,De,ne,qt),Ne.transparent===!0&&Ne.side===vr&&Ne.forceSinglePass===!1?(Ne.side=mi,Ne.needsUpdate=!0,k.renderBufferDirect(ke,Se,De,Ne,ne,qt),Ne.side=ko,Ne.needsUpdate=!0,k.renderBufferDirect(ke,Se,De,Ne,ne,qt),Ne.side=vr):k.renderBufferDirect(ke,Se,De,Ne,ne,qt),ne.onAfterRender(k,Se,ke,De,Ne,qt)}function Gx(ne,Se,ke){Se.isScene!==!0&&(Se=en);let De=Pe.get(ne),Ne=D.state.lights,qt=D.state.shadowsArray,Qt=Ne.state.version,Vt=Pt.getParameters(ne,Ne.state,qt,Se,ke,D.state.lightProbeGridArray),sn=Pt.getProgramCacheKey(Vt),pn=De.programs;De.environment=ne.isMeshStandardMaterial||ne.isMeshLambertMaterial||ne.isMeshPhongMaterial?Se.environment:null,De.fog=Se.fog;let Wn=ne.isMeshStandardMaterial||ne.isMeshLambertMaterial&&!ne.envMap||ne.isMeshPhongMaterial&&!ne.envMap;De.envMap=vt.get(ne.envMap||De.environment,Wn),De.envMapRotation=De.environment!==null&&ne.envMap===null?Se.environmentRotation:ne.envMapRotation,pn===void 0&&(ne.addEventListener("dispose",Lr),pn=new Map,De.programs=pn);let Jn=pn.get(sn);if(Jn!==void 0){if(De.currentProgram===Jn&&De.lightsStateVersion===Qt)return YP(ne,Vt),Jn}else Vt.uniforms=Pt.getUniforms(ne),G!==null&&ne.isNodeMaterial&&G.build(ne,ke,Vt),ne.onBeforeCompile(Vt,k),Jn=Pt.acquireProgram(Vt,sn),pn.set(sn,Jn),De.uniforms=Vt.uniforms;let gn=De.uniforms;return(!ne.isShaderMaterial&&!ne.isRawShaderMaterial||ne.clipping===!0)&&(gn.clippingPlanes=fn.uniform),YP(ne,Vt),De.needsLights=DG(ne),De.lightsStateVersion=Qt,De.needsLights&&(gn.ambientLightColor.value=Ne.state.ambient,gn.lightProbe.value=Ne.state.probe,gn.directionalLights.value=Ne.state.directional,gn.directionalLightShadows.value=Ne.state.directionalShadow,gn.spotLights.value=Ne.state.spot,gn.spotLightShadows.value=Ne.state.spotShadow,gn.rectAreaLights.value=Ne.state.rectArea,gn.ltc_1.value=Ne.state.rectAreaLTC1,gn.ltc_2.value=Ne.state.rectAreaLTC2,gn.pointLights.value=Ne.state.point,gn.pointLightShadows.value=Ne.state.pointShadow,gn.hemisphereLights.value=Ne.state.hemi,gn.directionalShadowMatrix.value=Ne.state.directionalShadowMatrix,gn.spotLightMatrix.value=Ne.state.spotLightMatrix,gn.spotLightMap.value=Ne.state.spotLightMap,gn.pointShadowMatrix.value=Ne.state.pointShadowMatrix),De.lightProbeGrid=D.state.lightProbeGridArray.length>0,De.currentProgram=Jn,De.uniformsList=null,Jn}function $P(ne){if(ne.uniformsList===null){let Se=ne.currentProgram.getUniforms();ne.uniformsList=p_.seqWithValue(Se.seq,ne.uniforms)}return ne.uniformsList}function YP(ne,Se){let ke=Pe.get(ne);ke.outputColorSpace=Se.outputColorSpace,ke.batching=Se.batching,ke.batchingColor=Se.batchingColor,ke.instancing=Se.instancing,ke.instancingColor=Se.instancingColor,ke.instancingMorph=Se.instancingMorph,ke.skinning=Se.skinning,ke.morphTargets=Se.morphTargets,ke.morphNormals=Se.morphNormals,ke.morphColors=Se.morphColors,ke.morphTargetsCount=Se.morphTargetsCount,ke.numClippingPlanes=Se.numClippingPlanes,ke.numIntersection=Se.numClipIntersection,ke.vertexAlphas=Se.vertexAlphas,ke.vertexTangents=Se.vertexTangents,ke.toneMapping=Se.toneMapping}function IG(ne,Se){if(ne.length===0)return null;if(ne.length===1)return ne[0].texture!==null?ne[0]:null;I.setFromMatrixPosition(Se.matrixWorld);for(let ke=0,De=ne.length;ke<De;ke++){let Ne=ne[ke];if(Ne.texture!==null&&Ne.boundingBox.containsPoint(I))return Ne}return null}function PG(ne,Se,ke,De,Ne){Se.isScene!==!0&&(Se=en),Ge.resetTextureUnits();let qt=Se.fog,Qt=De.isMeshStandardMaterial||De.isMeshLambertMaterial||De.isMeshPhongMaterial?Se.environment:null,Vt=te===null?k.outputColorSpace:te.isXRRenderTarget===!0?te.texture.colorSpace:ln.workingColorSpace,sn=De.isMeshStandardMaterial||De.isMeshLambertMaterial&&!De.envMap||De.isMeshPhongMaterial&&!De.envMap,pn=vt.get(De.envMap||Qt,sn),Wn=De.vertexColors===!0&&!!ke.attributes.color&&ke.attributes.color.itemSize===4,Jn=!!ke.attributes.tangent&&(!!De.normalMap||De.anisotropy>0),gn=!!ke.morphAttributes.position,Yi=!!ke.morphAttributes.normal,rs=!!ke.morphAttributes.color,qr=ao;De.toneMapped&&(te===null||te.isXRRenderTarget===!0)&&(qr=k.toneMapping);let ir=ke.morphAttributes.position||ke.morphAttributes.normal||ke.morphAttributes.color,Co=ir!==void 0?ir.length:0,Zt=Pe.get(De),rl=D.state.lights;if(ot===!0&&(nt===!0||ne!==he)){let pr=ne===he&&De.id===ce;fn.setState(De,ne,pr)}let yi=!1;De.version===Zt.__version?(Zt.needsLights&&Zt.lightsStateVersion!==rl.state.version||Zt.outputColorSpace!==Vt||Ne.isBatchedMesh&&Zt.batching===!1||!Ne.isBatchedMesh&&Zt.batching===!0||Ne.isBatchedMesh&&Zt.batchingColor===!0&&Ne.colorTexture===null||Ne.isBatchedMesh&&Zt.batchingColor===!1&&Ne.colorTexture!==null||Ne.isInstancedMesh&&Zt.instancing===!1||!Ne.isInstancedMesh&&Zt.instancing===!0||Ne.isSkinnedMesh&&Zt.skinning===!1||!Ne.isSkinnedMesh&&Zt.skinning===!0||Ne.isInstancedMesh&&Zt.instancingColor===!0&&Ne.instanceColor===null||Ne.isInstancedMesh&&Zt.instancingColor===!1&&Ne.instanceColor!==null||Ne.isInstancedMesh&&Zt.instancingMorph===!0&&Ne.morphTexture===null||Ne.isInstancedMesh&&Zt.instancingMorph===!1&&Ne.morphTexture!==null||Zt.envMap!==pn||De.fog===!0&&Zt.fog!==qt||Zt.numClippingPlanes!==void 0&&(Zt.numClippingPlanes!==fn.numPlanes||Zt.numIntersection!==fn.numIntersection)||Zt.vertexAlphas!==Wn||Zt.vertexTangents!==Jn||Zt.morphTargets!==gn||Zt.morphNormals!==Yi||Zt.morphColors!==rs||Zt.toneMapping!==qr||Zt.morphTargetsCount!==Co||!!Zt.lightProbeGrid!=D.state.lightProbeGridArray.length>0)&&(yi=!0):(yi=!0,Zt.__version=De.version);let Ul=Zt.currentProgram;yi===!0&&(Ul=Gx(De,Se,Ne),G&&De.isNodeMaterial&&G.onUpdateProgram(De,Ul,Zt));let uu=!1,zf=!1,Om=!1,rr=Ul.getUniforms(),ss=Zt.uniforms;if(Z.useProgram(Ul.program)&&(uu=!0,zf=!0,Om=!0),De.id!==ce&&(ce=De.id,zf=!0),Zt.needsLights){let pr=IG(D.state.lightProbeGridArray,Ne);Zt.lightProbeGrid!==pr&&(Zt.lightProbeGrid=pr,zf=!0)}if(uu||he!==ne){Z.buffers.depth.getReversed()&&ne.reversedDepth!==!0&&(ne._reversedDepth=!0,ne.updateProjectionMatrix()),rr.setValue(_e,"projectionMatrix",ne.projectionMatrix),rr.setValue(_e,"viewMatrix",ne.matrixWorldInverse);let Gf=rr.map.cameraPosition;Gf!==void 0&&Gf.setValue(_e,yt.setFromMatrixPosition(ne.matrixWorld)),le.logarithmicDepthBuffer&&rr.setValue(_e,"logDepthBufFC",2/(Math.log(ne.far+1)/Math.LN2)),(De.isMeshPhongMaterial||De.isMeshToonMaterial||De.isMeshLambertMaterial||De.isMeshBasicMaterial||De.isMeshStandardMaterial||De.isShaderMaterial)&&rr.setValue(_e,"isOrthographic",ne.isOrthographicCamera===!0),he!==ne&&(he=ne,zf=!0,Om=!0)}if(Zt.needsLights&&(rl.state.directionalShadowMap.length>0&&rr.setValue(_e,"directionalShadowMap",rl.state.directionalShadowMap,Ge),rl.state.spotShadowMap.length>0&&rr.setValue(_e,"spotShadowMap",rl.state.spotShadowMap,Ge),rl.state.pointShadowMap.length>0&&rr.setValue(_e,"pointShadowMap",rl.state.pointShadowMap,Ge)),Ne.isSkinnedMesh){rr.setOptional(_e,Ne,"bindMatrix"),rr.setOptional(_e,Ne,"bindMatrixInverse");let pr=Ne.skeleton;pr&&(pr.boneTexture===null&&pr.computeBoneTexture(),rr.setValue(_e,"boneTexture",pr.boneTexture,Ge))}Ne.isBatchedMesh&&(rr.setOptional(_e,Ne,"batchingTexture"),rr.setValue(_e,"batchingTexture",Ne._matricesTexture,Ge),rr.setOptional(_e,Ne,"batchingIdTexture"),rr.setValue(_e,"batchingIdTexture",Ne._indirectTexture,Ge),rr.setOptional(_e,Ne,"batchingColorTexture"),Ne._colorsTexture!==null&&rr.setValue(_e,"batchingColorTexture",Ne._colorsTexture,Ge));let Vf=ke.morphAttributes;if((Vf.position!==void 0||Vf.normal!==void 0||Vf.color!==void 0)&&ye.update(Ne,ke,Ul),(zf||Zt.receiveShadow!==Ne.receiveShadow)&&(Zt.receiveShadow=Ne.receiveShadow,rr.setValue(_e,"receiveShadow",Ne.receiveShadow)),(De.isMeshStandardMaterial||De.isMeshLambertMaterial||De.isMeshPhongMaterial)&&De.envMap===null&&Se.environment!==null&&(ss.envMapIntensity.value=Se.environmentIntensity),ss.dfgLUT!==void 0&&(ss.dfgLUT.value=Ixe()),zf){if(rr.setValue(_e,"toneMappingExposure",k.toneMappingExposure),Zt.needsLights&&LG(ss,Om),qt&&De.fog===!0&&rn.refreshFogUniforms(ss,qt),rn.refreshMaterialUniforms(ss,De,Ye,Ve,D.state.transmissionRenderTarget[ne.id]),Zt.needsLights&&Zt.lightProbeGrid){let pr=Zt.lightProbeGrid;ss.probesSH.value=pr.texture,ss.probesMin.value.copy(pr.boundingBox.min),ss.probesMax.value.copy(pr.boundingBox.max),ss.probesResolution.value.copy(pr.resolution)}p_.upload(_e,$P(Zt),ss,Ge)}if(De.isShaderMaterial&&De.uniformsNeedUpdate===!0&&(p_.upload(_e,$P(Zt),ss,Ge),De.uniformsNeedUpdate=!1),De.isSpriteMaterial&&rr.setValue(_e,"center",Ne.center),rr.setValue(_e,"modelViewMatrix",Ne.modelViewMatrix),rr.setValue(_e,"normalMatrix",Ne.normalMatrix),rr.setValue(_e,"modelMatrix",Ne.matrixWorld),De.uniformsGroups!==void 0){let pr=De.uniformsGroups;for(let Gf=0,Um=pr.length;Gf<Um;Gf++){let ZP=pr[Gf];ut.update(ZP,Ul),ut.bind(ZP,Ul)}}return Ul}function LG(ne,Se){ne.ambientLightColor.needsUpdate=Se,ne.lightProbe.needsUpdate=Se,ne.directionalLights.needsUpdate=Se,ne.directionalLightShadows.needsUpdate=Se,ne.pointLights.needsUpdate=Se,ne.pointLightShadows.needsUpdate=Se,ne.spotLights.needsUpdate=Se,ne.spotLightShadows.needsUpdate=Se,ne.rectAreaLights.needsUpdate=Se,ne.hemisphereLights.needsUpdate=Se}function DG(ne){return ne.isMeshLambertMaterial||ne.isMeshToonMaterial||ne.isMeshPhongMaterial||ne.isMeshStandardMaterial||ne.isShadowMaterial||ne.isShaderMaterial&&ne.lights===!0}this.getActiveCubeFace=function(){return $},this.getActiveMipmapLevel=function(){return J},this.getRenderTarget=function(){return te},this.setRenderTargetTextures=function(ne,Se,ke){let De=Pe.get(ne);De.__autoAllocateDepthBuffer=ne.resolveDepthBuffer===!1,De.__autoAllocateDepthBuffer===!1&&(De.__useRenderToTexture=!1),Pe.get(ne.texture).__webglTexture=Se,Pe.get(ne.depthTexture).__webglTexture=De.__autoAllocateDepthBuffer?void 0:ke,De.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(ne,Se){let ke=Pe.get(ne);ke.__webglFramebuffer=Se,ke.__useDefaultFramebuffer=Se===void 0},this.setRenderTarget=function(ne,Se=0,ke=0){te=ne,$=Se,J=ke;let De=null,Ne=!1,qt=!1;if(ne){let Vt=Pe.get(ne);if(Vt.__useDefaultFramebuffer!==void 0){Z.bindFramebuffer(_e.FRAMEBUFFER,Vt.__webglFramebuffer),ve.copy(ne.viewport),Re.copy(ne.scissor),Qe=ne.scissorTest,Z.viewport(ve),Z.scissor(Re),Z.setScissorTest(Qe),ce=-1;return}else if(Vt.__webglFramebuffer===void 0)Ge.setupRenderTarget(ne);else if(Vt.__hasExternalTextures)Ge.rebindTextures(ne,Pe.get(ne.texture).__webglTexture,Pe.get(ne.depthTexture).__webglTexture);else if(ne.depthBuffer){let Wn=ne.depthTexture;if(Vt.__boundDepthTexture!==Wn){if(Wn!==null&&Pe.has(Wn)&&(ne.width!==Wn.image.width||ne.height!==Wn.image.height))throw new Error("THREE.WebGLRenderer: Attached DepthTexture is initialized to the incorrect size.");Ge.setupDepthRenderbuffer(ne)}}let sn=ne.texture;(sn.isData3DTexture||sn.isDataArrayTexture||sn.isCompressedArrayTexture)&&(qt=!0);let pn=Pe.get(ne).__webglFramebuffer;ne.isWebGLCubeRenderTarget?(Array.isArray(pn[Se])?De=pn[Se][ke]:De=pn[Se],Ne=!0):ne.samples>0&&Ge.useMultisampledRTT(ne)===!1?De=Pe.get(ne).__webglMultisampledFramebuffer:Array.isArray(pn)?De=pn[ke]:De=pn,ve.copy(ne.viewport),Re.copy(ne.scissor),Qe=ne.scissorTest}else ve.copy(It).multiplyScalar(Ye).floor(),Re.copy(dn).multiplyScalar(Ye).floor(),Qe=Gt;if(ke!==0&&(De=W),Z.bindFramebuffer(_e.FRAMEBUFFER,De)&&Z.drawBuffers(ne,De),Z.viewport(ve),Z.scissor(Re),Z.setScissorTest(Qe),Ne){let Vt=Pe.get(ne.texture);_e.framebufferTexture2D(_e.FRAMEBUFFER,_e.COLOR_ATTACHMENT0,_e.TEXTURE_CUBE_MAP_POSITIVE_X+Se,Vt.__webglTexture,ke)}else if(qt){let Vt=Se;for(let sn=0;sn<ne.textures.length;sn++){let pn=Pe.get(ne.textures[sn]);_e.framebufferTextureLayer(_e.FRAMEBUFFER,_e.COLOR_ATTACHMENT0+sn,pn.__webglTexture,ke,Vt)}}else if(ne!==null&&ke!==0){let Vt=Pe.get(ne.texture);_e.framebufferTexture2D(_e.FRAMEBUFFER,_e.COLOR_ATTACHMENT0,_e.TEXTURE_2D,Vt.__webglTexture,ke)}ce=-1},this.readRenderTargetPixels=function(ne,Se,ke,De,Ne,qt,Qt,Vt=0){if(!(ne&&ne.isWebGLRenderTarget)){ze("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let sn=Pe.get(ne).__webglFramebuffer;if(ne.isWebGLCubeRenderTarget&&Qt!==void 0&&(sn=sn[Qt]),sn){Z.bindFramebuffer(_e.FRAMEBUFFER,sn);try{let pn=ne.textures[Vt],Wn=pn.format,Jn=pn.type;if(ne.textures.length>1&&_e.readBuffer(_e.COLOR_ATTACHMENT0+Vt),!le.textureFormatReadable(Wn)){ze("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!le.textureTypeReadable(Jn)){ze("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}Se>=0&&Se<=ne.width-De&&ke>=0&&ke<=ne.height-Ne&&_e.readPixels(Se,ke,De,Ne,St.convert(Wn),St.convert(Jn),qt)}finally{let pn=te!==null?Pe.get(te).__webglFramebuffer:null;Z.bindFramebuffer(_e.FRAMEBUFFER,pn)}}},this.readRenderTargetPixelsAsync=async function(ne,Se,ke,De,Ne,qt,Qt,Vt=0){if(!(ne&&ne.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let sn=Pe.get(ne).__webglFramebuffer;if(ne.isWebGLCubeRenderTarget&&Qt!==void 0&&(sn=sn[Qt]),sn)if(Se>=0&&Se<=ne.width-De&&ke>=0&&ke<=ne.height-Ne){Z.bindFramebuffer(_e.FRAMEBUFFER,sn);let pn=ne.textures[Vt],Wn=pn.format,Jn=pn.type;if(ne.textures.length>1&&_e.readBuffer(_e.COLOR_ATTACHMENT0+Vt),!le.textureFormatReadable(Wn))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!le.textureTypeReadable(Jn))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let gn=_e.createBuffer();_e.bindBuffer(_e.PIXEL_PACK_BUFFER,gn),_e.bufferData(_e.PIXEL_PACK_BUFFER,qt.byteLength,_e.STREAM_READ),_e.readPixels(Se,ke,De,Ne,St.convert(Wn),St.convert(Jn),0);let Yi=te!==null?Pe.get(te).__webglFramebuffer:null;Z.bindFramebuffer(_e.FRAMEBUFFER,Yi);let rs=_e.fenceSync(_e.SYNC_GPU_COMMANDS_COMPLETE,0);return _e.flush(),await gZ(_e,rs,4),_e.bindBuffer(_e.PIXEL_PACK_BUFFER,gn),_e.getBufferSubData(_e.PIXEL_PACK_BUFFER,0,qt),_e.deleteBuffer(gn),_e.deleteSync(rs),qt}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(ne,Se=null,ke=0){let De=Math.pow(2,-ke),Ne=Math.floor(ne.image.width*De),qt=Math.floor(ne.image.height*De),Qt=Se!==null?Se.x:0,Vt=Se!==null?Se.y:0;Ge.setTexture2D(ne,0),_e.copyTexSubImage2D(_e.TEXTURE_2D,ke,0,0,Qt,Vt,Ne,qt),Z.unbindTexture()},this.copyTextureToTexture=function(ne,Se,ke=null,De=null,Ne=0,qt=0){let Qt,Vt,sn,pn,Wn,Jn,gn,Yi,rs,qr=ne.isCompressedTexture?ne.mipmaps[qt]:ne.image;if(ke!==null)Qt=ke.max.x-ke.min.x,Vt=ke.max.y-ke.min.y,sn=ke.isBox3?ke.max.z-ke.min.z:1,pn=ke.min.x,Wn=ke.min.y,Jn=ke.isBox3?ke.min.z:0;else{let ss=Math.pow(2,-Ne);Qt=Math.floor(qr.width*ss),Vt=Math.floor(qr.height*ss),ne.isDataArrayTexture?sn=qr.depth:ne.isData3DTexture?sn=Math.floor(qr.depth*ss):sn=1,pn=0,Wn=0,Jn=0}De!==null?(gn=De.x,Yi=De.y,rs=De.z):(gn=0,Yi=0,rs=0);let ir=St.convert(Se.format),Co=St.convert(Se.type),Zt;Se.isData3DTexture?(Ge.setTexture3D(Se,0),Zt=_e.TEXTURE_3D):Se.isDataArrayTexture||Se.isCompressedArrayTexture?(Ge.setTexture2DArray(Se,0),Zt=_e.TEXTURE_2D_ARRAY):(Ge.setTexture2D(Se,0),Zt=_e.TEXTURE_2D),Z.activeTexture(_e.TEXTURE0),Z.pixelStorei(_e.UNPACK_FLIP_Y_WEBGL,Se.flipY),Z.pixelStorei(_e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Se.premultiplyAlpha),Z.pixelStorei(_e.UNPACK_ALIGNMENT,Se.unpackAlignment);let rl=Z.getParameter(_e.UNPACK_ROW_LENGTH),yi=Z.getParameter(_e.UNPACK_IMAGE_HEIGHT),Ul=Z.getParameter(_e.UNPACK_SKIP_PIXELS),uu=Z.getParameter(_e.UNPACK_SKIP_ROWS),zf=Z.getParameter(_e.UNPACK_SKIP_IMAGES);Z.pixelStorei(_e.UNPACK_ROW_LENGTH,qr.width),Z.pixelStorei(_e.UNPACK_IMAGE_HEIGHT,qr.height),Z.pixelStorei(_e.UNPACK_SKIP_PIXELS,pn),Z.pixelStorei(_e.UNPACK_SKIP_ROWS,Wn),Z.pixelStorei(_e.UNPACK_SKIP_IMAGES,Jn);let Om=ne.isDataArrayTexture||ne.isData3DTexture,rr=Se.isDataArrayTexture||Se.isData3DTexture;if(ne.isDepthTexture){let ss=Pe.get(ne),Vf=Pe.get(Se),pr=Pe.get(ss.__renderTarget),Gf=Pe.get(Vf.__renderTarget);Z.bindFramebuffer(_e.READ_FRAMEBUFFER,pr.__webglFramebuffer),Z.bindFramebuffer(_e.DRAW_FRAMEBUFFER,Gf.__webglFramebuffer);for(let Um=0;Um<sn;Um++)Om&&(_e.framebufferTextureLayer(_e.READ_FRAMEBUFFER,_e.COLOR_ATTACHMENT0,Pe.get(ne).__webglTexture,Ne,Jn+Um),_e.framebufferTextureLayer(_e.DRAW_FRAMEBUFFER,_e.COLOR_ATTACHMENT0,Pe.get(Se).__webglTexture,qt,rs+Um)),_e.blitFramebuffer(pn,Wn,Qt,Vt,gn,Yi,Qt,Vt,_e.DEPTH_BUFFER_BIT,_e.NEAREST);Z.bindFramebuffer(_e.READ_FRAMEBUFFER,null),Z.bindFramebuffer(_e.DRAW_FRAMEBUFFER,null)}else if(Ne!==0||ne.isRenderTargetTexture||Pe.has(ne)){let ss=Pe.get(ne),Vf=Pe.get(Se);Z.bindFramebuffer(_e.READ_FRAMEBUFFER,Y),Z.bindFramebuffer(_e.DRAW_FRAMEBUFFER,H);for(let pr=0;pr<sn;pr++)Om?_e.framebufferTextureLayer(_e.READ_FRAMEBUFFER,_e.COLOR_ATTACHMENT0,ss.__webglTexture,Ne,Jn+pr):_e.framebufferTexture2D(_e.READ_FRAMEBUFFER,_e.COLOR_ATTACHMENT0,_e.TEXTURE_2D,ss.__webglTexture,Ne),rr?_e.framebufferTextureLayer(_e.DRAW_FRAMEBUFFER,_e.COLOR_ATTACHMENT0,Vf.__webglTexture,qt,rs+pr):_e.framebufferTexture2D(_e.DRAW_FRAMEBUFFER,_e.COLOR_ATTACHMENT0,_e.TEXTURE_2D,Vf.__webglTexture,qt),Ne!==0?_e.blitFramebuffer(pn,Wn,Qt,Vt,gn,Yi,Qt,Vt,_e.COLOR_BUFFER_BIT,_e.NEAREST):rr?_e.copyTexSubImage3D(Zt,qt,gn,Yi,rs+pr,pn,Wn,Qt,Vt):_e.copyTexSubImage2D(Zt,qt,gn,Yi,pn,Wn,Qt,Vt);Z.bindFramebuffer(_e.READ_FRAMEBUFFER,null),Z.bindFramebuffer(_e.DRAW_FRAMEBUFFER,null)}else rr?ne.isDataTexture||ne.isData3DTexture?_e.texSubImage3D(Zt,qt,gn,Yi,rs,Qt,Vt,sn,ir,Co,qr.data):Se.isCompressedArrayTexture?_e.compressedTexSubImage3D(Zt,qt,gn,Yi,rs,Qt,Vt,sn,ir,qr.data):_e.texSubImage3D(Zt,qt,gn,Yi,rs,Qt,Vt,sn,ir,Co,qr):ne.isDataTexture?_e.texSubImage2D(_e.TEXTURE_2D,qt,gn,Yi,Qt,Vt,ir,Co,qr.data):ne.isCompressedTexture?_e.compressedTexSubImage2D(_e.TEXTURE_2D,qt,gn,Yi,qr.width,qr.height,ir,qr.data):_e.texSubImage2D(_e.TEXTURE_2D,qt,gn,Yi,Qt,Vt,ir,Co,qr);Z.pixelStorei(_e.UNPACK_ROW_LENGTH,rl),Z.pixelStorei(_e.UNPACK_IMAGE_HEIGHT,yi),Z.pixelStorei(_e.UNPACK_SKIP_PIXELS,Ul),Z.pixelStorei(_e.UNPACK_SKIP_ROWS,uu),Z.pixelStorei(_e.UNPACK_SKIP_IMAGES,zf),qt===0&&Se.generateMipmaps&&_e.generateMipmap(Zt),Z.unbindTexture()},this.initRenderTarget=function(ne){Pe.get(ne).__webglFramebuffer===void 0&&Ge.setupRenderTarget(ne)},this.initTexture=function(ne){ne.isCubeTexture?Ge.setTextureCube(ne,0):ne.isData3DTexture?Ge.setTexture3D(ne,0):ne.isDataArrayTexture||ne.isCompressedArrayTexture?Ge.setTexture2DArray(ne,0):Ge.setTexture2D(ne,0),Z.unbindTexture()},this.resetState=function(){$=0,J=0,te=null,Z.reset(),Bt.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Uo}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;let t=this.getContext();t.drawingBufferColorSpace=ln._getDrawingBufferColorSpace(e),t.unpackColorSpace=ln._getUnpackColorSpace()}};var jM=class extends lr{constructor(e=document.createElement("div")){super(),this.isCSS2DObject=!0,this.element=e,this.element.style.position="absolute",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.center=new Oe(.5,.5),this.addEventListener("removed",function(){this.traverse(function(t){t.element&&t.element instanceof t.element.ownerDocument.defaultView.Element&&t.element.parentNode!==null&&t.element.remove()})})}copy(e,t){return super.copy(e,t),this.element=e.element.cloneNode(!0),this.center=e.center,this}},A_=new re,tK=new cn,nK=new cn,iK=new re,rK=new re,XM=class{constructor(e={}){let t=this,n,r,s,o,a={objects:new WeakMap},l=e.element!==void 0?e.element:document.createElement("div");l.style.overflow="hidden",this.domElement=l,this.sortObjects=!0,this.getSize=function(){return{width:n,height:r}},this.render=function(y,w){y.matrixWorldAutoUpdate===!0&&y.updateMatrixWorld(),w.parent===null&&w.matrixWorldAutoUpdate===!0&&w.updateMatrixWorld(),tK.copy(w.matrixWorldInverse),nK.multiplyMatrices(w.projectionMatrix,tK),u(y,y,w),this.sortObjects&&A(y)},this.setSize=function(y,w){n=y,r=w,s=n/2,o=r/2,l.style.width=y+"px",l.style.height=w+"px"};function c(y){y.isCSS2DObject&&(y.element.style.display="none");for(let w=0,S=y.children.length;w<S;w++)c(y.children[w])}function u(y,w,S){if(y.visible===!1){c(y);return}if(y.isCSS2DObject){A_.setFromMatrixPosition(y.matrixWorld),A_.applyMatrix4(nK);let T=A_.z>=-1&&A_.z<=1&&y.layers.test(S.layers)===!0,R=y.element;R.style.display=T===!0?"":"none",T===!0&&(y.onBeforeRender(t,w,S),R.style.transform="translate("+-100*y.center.x+"%,"+-100*y.center.y+"%)translate("+(A_.x*s+s)+"px,"+(-A_.y*o+o)+"px)",R.parentNode!==l&&l.appendChild(R),y.onAfterRender(t,w,S));let P={distanceToCameraSquared:f(S,y)};a.objects.set(y,P)}for(let T=0,R=y.children.length;T<R;T++)u(y.children[T],w,S)}function f(y,w){return iK.setFromMatrixPosition(y.matrixWorld),rK.setFromMatrixPosition(w.matrixWorld),iK.distanceToSquared(rK)}function d(y){let w=[];return y.traverseVisible(function(S){S.isCSS2DObject&&w.push(S)}),w}function A(y){let w=d(y).sort(function(T,R){if(T.renderOrder!==R.renderOrder)return R.renderOrder-T.renderOrder;let P=a.objects.get(T).distanceToCameraSquared,I=a.objects.get(R).distanceToCameraSquared;return P-I}),S=w.length;for(let T=0,R=w.length;T<R;T++)w[T].element.style.zIndex=S-T}}};function Pxe(i){var e=typeof i;return i!=null&&(e=="object"||e=="function")}var Vb=Pxe;var Lxe=typeof global=="object"&&global&&global.Object===Object&&global,sK=Lxe;var Dxe=typeof self=="object"&&self&&self.Object===Object&&self,Nxe=sK||Dxe||Function("return this")(),$M=Nxe;var Fxe=function(){return $M.Date.now()},YM=Fxe;var Bxe=/\s/;function Oxe(i){for(var e=i.length;e--&&Bxe.test(i.charAt(e)););return e}var oK=Oxe;var Uxe=/^\s+/;function kxe(i){return i&&i.slice(0,oK(i)+1).replace(Uxe,"")}var aK=kxe;var zxe=$M.Symbol,g_=zxe;var lK=Object.prototype,Vxe=lK.hasOwnProperty,Gxe=lK.toString,Gb=g_?g_.toStringTag:void 0;function qxe(i){var e=Vxe.call(i,Gb),t=i[Gb];try{i[Gb]=void 0;var n=!0}catch{}var r=Gxe.call(i);return n&&(e?i[Gb]=t:delete i[Gb]),r}var cK=qxe;var Hxe=Object.prototype,Wxe=Hxe.toString;function jxe(i){return Wxe.call(i)}var uK=jxe;var Xxe="[object Null]",$xe="[object Undefined]",hK=g_?g_.toStringTag:void 0;function Yxe(i){return i==null?i===void 0?$xe:Xxe:hK&&hK in Object(i)?cK(i):uK(i)}var fK=Yxe;function Zxe(i){return i!=null&&typeof i=="object"}var dK=Zxe;var Kxe="[object Symbol]";function Qxe(i){return typeof i=="symbol"||dK(i)&&fK(i)==Kxe}var pK=Qxe;var mK=NaN,Jxe=/^[-+]0x[0-9a-f]+$/i,eye=/^0b[01]+$/i,tye=/^0o[0-7]+$/i,nye=parseInt;function iye(i){if(typeof i=="number")return i;if(pK(i))return mK;if(Vb(i)){var e=typeof i.valueOf=="function"?i.valueOf():i;i=Vb(e)?e+"":e}if(typeof i!="string")return i===0?i:+i;i=aK(i);var t=eye.test(i);return t||tye.test(i)?nye(i.slice(2),t?2:8):Jxe.test(i)?mK:+i}var RF=iye;var rye="Expected a function",sye=Math.max,oye=Math.min;function aye(i,e,t){var n,r,s,o,a,l,c=0,u=!1,f=!1,d=!0;if(typeof i!="function")throw new TypeError(rye);e=RF(e)||0,Vb(t)&&(u=!!t.leading,f="maxWait"in t,s=f?sye(RF(t.maxWait)||0,e):s,d="trailing"in t?!!t.trailing:d);function A(D){var L=n,C=r;return n=r=void 0,c=D,o=i.apply(C,L),o}function y(D){return c=D,a=setTimeout(T,e),u?A(D):o}function w(D){var L=D-l,C=D-c,B=e-L;return f?oye(B,s-C):B}function S(D){var L=D-l,C=D-c;return l===void 0||L>=e||L<0||f&&C>=s}function T(){var D=YM();if(S(D))return R(D);a=setTimeout(T,w(D))}function R(D){return a=void 0,d&&n?A(D):(n=r=void 0,o)}function P(){a!==void 0&&clearTimeout(a),c=0,n=l=r=a=void 0}function I(){return a===void 0?o:R(YM())}function F(){var D=YM(),L=S(D);if(n=arguments,r=this,l=D,L){if(a===void 0)return y(l);if(f)return clearTimeout(a),a=setTimeout(T,e),A(l)}return a===void 0&&(a=setTimeout(T,e)),o}return F.cancel=P,F.flush=I,F}var AK=aye;function gK(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function lye(i){if(Array.isArray(i))return i}function cye(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function uye(i,e,t){return Object.defineProperty(i,"prototype",{writable:!1}),i}function hye(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function fye(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.4118-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function dye(i,e){return lye(i)||hye(i,e)||pye(i,e)||fye()}function pye(i,e){if(i){if(typeof i=="string")return gK(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?gK(i,e):void 0}}var mye=uye(function i(e,t){var n=t.default,r=n===void 0?null:n,s=t.triggerUpdate,o=s===void 0?!0:s,a=t.onChange,l=a===void 0?function(c,u){}:a;cye(this,i),this.name=e,this.defaultVal=r,this.triggerUpdate=o,this.onChange=l});function Kr(i){var e=i.stateInit,t=e===void 0?function(){return{}}:e,n=i.props,r=n===void 0?{}:n,s=i.methods,o=s===void 0?{}:s,a=i.aliases,l=a===void 0?{}:a,c=i.init,u=c===void 0?function(){}:c,f=i.update,d=f===void 0?function(){}:f,A=Object.keys(r).map(function(y){return new mye(y,r[y])});return function y(){for(var w=arguments.length,S=new Array(w),T=0;T<w;T++)S[T]=arguments[T];var R=!!(this instanceof y&&this.constructor),P=R?S.shift():void 0,I=S[0],F=I===void 0?{}:I,D=Object.assign({},t instanceof Function?t(F):t,{initialised:!1}),L={};function C(z){return B(z,F),k(),C}var B=function(G,W){u.call(C,G,D,W),D.initialised=!0},k=AK(function(){D.initialised&&(d.call(C,D,L),L={})},1);return A.forEach(function(z){C[z.name]=G(z);function G(W){var Y=W.name,H=W.triggerUpdate,$=H===void 0?!1:H,J=W.onChange,te=J===void 0?function(ve,Re){}:J,ce=W.defaultVal,he=ce===void 0?null:ce;return function(ve){var Re=D[Y];if(!arguments.length)return Re;var Qe=ve===void 0?he:ve;return D[Y]=Qe,te.call(C,Qe,D,Re),!L.hasOwnProperty(Y)&&(L[Y]=Re),$&&k(),C}}}),Object.keys(o).forEach(function(z){C[z]=function(){for(var G,W=arguments.length,Y=new Array(W),H=0;H<W;H++)Y[H]=arguments[H];return(G=o[z]).call.apply(G,[C,D].concat(Y))}}),Object.entries(l).forEach(function(z){var G=dye(z,2),W=G[0],Y=G[1];return C[W]=C[Y]}),C.resetProps=function(){return A.forEach(function(z){C[z.name](z.defaultVal)}),C},C.resetProps(),D._rerender=k,R&&P&&C(P),C}}var Qr=Object.freeze({Linear:Object.freeze({None:function(i){return i},In:function(i){return i},Out:function(i){return i},InOut:function(i){return i}}),Quadratic:Object.freeze({In:function(i){return i*i},Out:function(i){return i*(2-i)},InOut:function(i){return(i*=2)<1?.5*i*i:-.5*(--i*(i-2)-1)}}),Cubic:Object.freeze({In:function(i){return i*i*i},Out:function(i){return--i*i*i+1},InOut:function(i){return(i*=2)<1?.5*i*i*i:.5*((i-=2)*i*i+2)}}),Quartic:Object.freeze({In:function(i){return i*i*i*i},Out:function(i){return 1- --i*i*i*i},InOut:function(i){return(i*=2)<1?.5*i*i*i*i:-.5*((i-=2)*i*i*i-2)}}),Quintic:Object.freeze({In:function(i){return i*i*i*i*i},Out:function(i){return--i*i*i*i*i+1},InOut:function(i){return(i*=2)<1?.5*i*i*i*i*i:.5*((i-=2)*i*i*i*i+2)}}),Sinusoidal:Object.freeze({In:function(i){return 1-Math.sin((1-i)*Math.PI/2)},Out:function(i){return Math.sin(i*Math.PI/2)},InOut:function(i){return .5*(1-Math.sin(Math.PI*(.5-i)))}}),Exponential:Object.freeze({In:function(i){return i===0?0:Math.pow(1024,i-1)},Out:function(i){return i===1?1:1-Math.pow(2,-10*i)},InOut:function(i){return i===0?0:i===1?1:(i*=2)<1?.5*Math.pow(1024,i-1):.5*(-Math.pow(2,-10*(i-1))+2)}}),Circular:Object.freeze({In:function(i){return 1-Math.sqrt(1-i*i)},Out:function(i){return Math.sqrt(1- --i*i)},InOut:function(i){return(i*=2)<1?-.5*(Math.sqrt(1-i*i)-1):.5*(Math.sqrt(1-(i-=2)*i)+1)}}),Elastic:Object.freeze({In:function(i){return i===0?0:i===1?1:-Math.pow(2,10*(i-1))*Math.sin((i-1.1)*5*Math.PI)},Out:function(i){return i===0?0:i===1?1:Math.pow(2,-10*i)*Math.sin((i-.1)*5*Math.PI)+1},InOut:function(i){return i===0?0:i===1?1:(i*=2,i<1?-.5*Math.pow(2,10*(i-1))*Math.sin((i-1.1)*5*Math.PI):.5*Math.pow(2,-10*(i-1))*Math.sin((i-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(i){var e=1.70158;return i===1?1:i*i*((e+1)*i-e)},Out:function(i){var e=1.70158;return i===0?0:--i*i*((e+1)*i+e)+1},InOut:function(i){var e=2.5949095;return(i*=2)<1?.5*(i*i*((e+1)*i-e)):.5*((i-=2)*i*((e+1)*i+e)+2)}}),Bounce:Object.freeze({In:function(i){return 1-Qr.Bounce.Out(1-i)},Out:function(i){return i<.36363636363636365?7.5625*i*i:i<.7272727272727273?7.5625*(i-=.5454545454545454)*i+.75:i<.9090909090909091?7.5625*(i-=.8181818181818182)*i+.9375:7.5625*(i-=.9545454545454546)*i+.984375},InOut:function(i){return i<.5?Qr.Bounce.In(i*2)*.5:Qr.Bounce.Out(i*2-1)*.5+.5}}),generatePow:function(i){return i===void 0&&(i=4),i=i<Number.EPSILON?Number.EPSILON:i,i=i>1e4?1e4:i,{In:function(e){return Math.pow(e,i)},Out:function(e){return 1-Math.pow(1-e,i)},InOut:function(e){return e<.5?Math.pow(e*2,i)/2:(1-Math.pow(2-e*2,i))/2+.5}}}}),qb=function(){return performance.now()},vg=(function(){function i(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._tweens={},this._tweensAddedDuringUpdate={},this.add.apply(this,e)}return i.prototype.getAll=function(){var e=this;return Object.keys(this._tweens).map(function(t){return e._tweens[t]})},i.prototype.removeAll=function(){this._tweens={}},i.prototype.add=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];for(var r=0,s=t;r<s.length;r++){var o=s[r];(e=o._group)===null||e===void 0||e.remove(o),o._group=this,this._tweens[o.getId()]=o,this._tweensAddedDuringUpdate[o.getId()]=o}},i.prototype.remove=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n=0,r=e;n<r.length;n++){var s=r[n];s._group=void 0,delete this._tweens[s.getId()],delete this._tweensAddedDuringUpdate[s.getId()]}},i.prototype.allStopped=function(){return this.getAll().every(function(e){return!e.isPlaying()})},i.prototype.update=function(e,t){e===void 0&&(e=qb()),t===void 0&&(t=!0);var n=Object.keys(this._tweens);if(n.length!==0)for(;n.length>0;){this._tweensAddedDuringUpdate={};for(var r=0;r<n.length;r++){var s=this._tweens[n[r]],o=!t;s&&s.update(e,o)===!1&&!t&&this.remove(s)}n=Object.keys(this._tweensAddedDuringUpdate)}},i})(),v_={Linear:function(i,e){var t=i.length-1,n=t*e,r=Math.floor(n),s=v_.Utils.Linear;return e<0?s(i[0],i[1],n):e>1?s(i[t],i[t-1],t-n):s(i[r],i[r+1>t?t:r+1],n-r)},Bezier:function(i,e){for(var t=0,n=i.length-1,r=Math.pow,s=v_.Utils.Bernstein,o=0;o<=n;o++)t+=r(1-e,n-o)*r(e,o)*i[o]*s(n,o);return t},CatmullRom:function(i,e){var t=i.length-1,n=t*e,r=Math.floor(n),s=v_.Utils.CatmullRom;return i[0]===i[t]?(e<0&&(r=Math.floor(n=t*(1+e))),s(i[(r-1+t)%t],i[r],i[(r+1)%t],i[(r+2)%t],n-r)):e<0?i[0]-(s(i[0],i[0],i[1],i[1],-n)-i[0]):e>1?i[t]-(s(i[t],i[t],i[t-1],i[t-1],n-t)-i[t]):s(i[r?r-1:0],i[r],i[t<r+1?t:r+1],i[t<r+2?t:r+2],n-r)},Utils:{Linear:function(i,e,t){return(e-i)*t+i},Bernstein:function(i,e){var t=v_.Utils.Factorial;return t(i)/t(e)/t(i-e)},Factorial:(function(){var i=[1];return function(e){var t=1;if(i[e])return i[e];for(var n=e;n>1;n--)t*=n;return i[e]=t,t}})(),CatmullRom:function(i,e,t,n,r){var s=(t-i)*.5,o=(n-e)*.5,a=r*r,l=r*a;return(2*e-2*t+s+o)*l+(-3*e+3*t-2*s-o)*a+s*r+e}}},vK=(function(){function i(){}return i.nextId=function(){return i._nextId++},i._nextId=0,i})(),IF=new vg,uo=(function(){function i(e,t){this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=Qr.Linear.None,this._interpolationFunction=v_.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=vK.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1,this._object=e,typeof t=="object"?(this._group=t,t.add(this)):t===!0&&(this._group=IF,IF.add(this))}return i.prototype.getId=function(){return this._id},i.prototype.isPlaying=function(){return this._isPlaying},i.prototype.isPaused=function(){return this._isPaused},i.prototype.getDuration=function(){return this._duration},i.prototype.to=function(e,t){if(t===void 0&&(t=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=e,this._propertiesAreSetUp=!1,this._duration=t<0?0:t,this},i.prototype.duration=function(e){return e===void 0&&(e=1e3),this._duration=e<0?0:e,this},i.prototype.dynamic=function(e){return e===void 0&&(e=!1),this._isDynamic=e,this},i.prototype.start=function(e,t){if(e===void 0&&(e=qb()),t===void 0&&(t=!1),this._isPlaying)return this;if(this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var n in this._valuesStartRepeat)this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=e,this._startTime+=this._delayTime,!this._propertiesAreSetUp||t){if(this._propertiesAreSetUp=!0,!this._isDynamic){var r={};for(var s in this._valuesEnd)r[s]=this._valuesEnd[s];this._valuesEnd=r}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,t)}return this},i.prototype.startFromCurrentValues=function(e){return this.start(e,!0)},i.prototype._setupProperties=function(e,t,n,r,s){for(var o in n){var a=e[o],l=Array.isArray(a),c=l?"array":typeof a,u=!l&&Array.isArray(n[o]);if(!(c==="undefined"||c==="function")){if(u){var f=n[o];if(f.length===0)continue;for(var d=[a],A=0,y=f.length;A<y;A+=1){var w=this._handleRelativeValue(a,f[A]);if(isNaN(w)){u=!1,console.warn("Found invalid interpolation list. Skipping.");break}d.push(w)}u&&(n[o]=d)}if((c==="object"||l)&&a&&!u){t[o]=l?[]:{};var S=a;for(var T in S)t[o][T]=S[T];r[o]=l?[]:{};var f=n[o];if(!this._isDynamic){var R={};for(var T in f)R[T]=f[T];n[o]=f=R}this._setupProperties(S,t[o],f,r[o],s)}else(typeof t[o]>"u"||s)&&(t[o]=a),l||(t[o]*=1),u?r[o]=n[o].slice().reverse():r[o]=t[o]||0}}},i.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},i.prototype.end=function(){return this._goToEnd=!0,this.update(this._startTime+this._duration),this},i.prototype.pause=function(e){return e===void 0&&(e=qb()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=e,this)},i.prototype.resume=function(e){return e===void 0&&(e=qb()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this)},i.prototype.stopChainedTweens=function(){for(var e=0,t=this._chainedTweens.length;e<t;e++)this._chainedTweens[e].stop();return this},i.prototype.group=function(e){return e?(e.add(this),this):(console.warn("tween.group() without args has been removed, use group.add(tween) instead."),this)},i.prototype.remove=function(){var e;return(e=this._group)===null||e===void 0||e.remove(this),this},i.prototype.delay=function(e){return e===void 0&&(e=0),this._delayTime=e,this},i.prototype.repeat=function(e){return e===void 0&&(e=0),this._initialRepeat=e,this._repeat=e,this},i.prototype.repeatDelay=function(e){return this._repeatDelayTime=e,this},i.prototype.yoyo=function(e){return e===void 0&&(e=!1),this._yoyo=e,this},i.prototype.easing=function(e){return e===void 0&&(e=Qr.Linear.None),this._easingFunction=e,this},i.prototype.interpolation=function(e){return e===void 0&&(e=v_.Linear),this._interpolationFunction=e,this},i.prototype.chain=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this._chainedTweens=e,this},i.prototype.onStart=function(e){return this._onStartCallback=e,this},i.prototype.onEveryStart=function(e){return this._onEveryStartCallback=e,this},i.prototype.onUpdate=function(e){return this._onUpdateCallback=e,this},i.prototype.onRepeat=function(e){return this._onRepeatCallback=e,this},i.prototype.onComplete=function(e){return this._onCompleteCallback=e,this},i.prototype.onStop=function(e){return this._onStopCallback=e,this},i.prototype.update=function(e,t){var n=this,r;if(e===void 0&&(e=qb()),t===void 0&&(t=i.autoStartOnUpdate),this._isPaused)return!0;var s;if(!this._goToEnd&&!this._isPlaying)if(t)this.start(e,!0);else return!1;if(this._goToEnd=!1,e<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var o=e-this._startTime,a=this._duration+((r=this._repeatDelayTime)!==null&&r!==void 0?r:this._delayTime),l=this._duration+this._repeat*a,c=function(){if(n._duration===0||o>l)return 1;var w=Math.trunc(o/a),S=o-w*a,T=Math.min(S/n._duration,1);return T===0&&o===n._duration?1:T},u=c(),f=this._easingFunction(u);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,f),this._onUpdateCallback&&this._onUpdateCallback(this._object,u),this._duration===0||o>=this._duration)if(this._repeat>0){var d=Math.min(Math.trunc((o-this._duration)/a)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=d);for(s in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[s]=="string"&&(this._valuesStartRepeat[s]=this._valuesStartRepeat[s]+parseFloat(this._valuesEnd[s])),this._yoyo&&this._swapEndStartRepeatValues(s),this._valuesStart[s]=this._valuesStartRepeat[s];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=a*d,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var A=0,y=this._chainedTweens.length;A<y;A++)this._chainedTweens[A].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},i.prototype._updateProperties=function(e,t,n,r){for(var s in n)if(t[s]!==void 0){var o=t[s]||0,a=n[s],l=Array.isArray(e[s]),c=Array.isArray(a),u=!l&&c;u?e[s]=this._interpolationFunction(a,r):typeof a=="object"&&a?this._updateProperties(e[s],o,a,r):(a=this._handleRelativeValue(o,a),typeof a=="number"&&(e[s]=o+(a-o)*r))}},i.prototype._handleRelativeValue=function(e,t){return typeof t!="string"?t:t.charAt(0)==="+"||t.charAt(0)==="-"?e+parseFloat(t):parseFloat(t)},i.prototype._swapEndStartRepeatValues=function(e){var t=this._valuesStartRepeat[e],n=this._valuesEnd[e];typeof n=="string"?this._valuesStartRepeat[e]=this._valuesStartRepeat[e]+parseFloat(n):this._valuesStartRepeat[e]=this._valuesEnd[e],this._valuesEnd[e]=t},i.autoStartOnUpdate=!1,i})();var WQe=vK.nextId,Kh=IF,jQe=Kh.getAll.bind(Kh),XQe=Kh.removeAll.bind(Kh),$Qe=Kh.add.bind(Kh),YQe=Kh.remove.bind(Kh),ZQe=Kh.update.bind(Kh);function _K(i){let e=+this._x.call(null,i),t=+this._y.call(null,i),n=+this._z.call(null,i);return xK(this.cover(e,t,n),e,t,n,i)}function xK(i,e,t,n,r){if(isNaN(e)||isNaN(t)||isNaN(n))return i;var s,o=i._root,a={data:r},l=i._x0,c=i._y0,u=i._z0,f=i._x1,d=i._y1,A=i._z1,y,w,S,T,R,P,I,F,D,L,C;if(!o)return i._root=a,i;for(;o.length;)if((I=e>=(y=(l+f)/2))?l=y:f=y,(F=t>=(w=(c+d)/2))?c=w:d=w,(D=n>=(S=(u+A)/2))?u=S:A=S,s=o,!(o=o[L=D<<2|F<<1|I]))return s[L]=a,i;if(T=+i._x.call(null,o.data),R=+i._y.call(null,o.data),P=+i._z.call(null,o.data),e===T&&t===R&&n===P)return a.next=o,s?s[L]=a:i._root=a,i;do s=s?s[L]=new Array(8):i._root=new Array(8),(I=e>=(y=(l+f)/2))?l=y:f=y,(F=t>=(w=(c+d)/2))?c=w:d=w,(D=n>=(S=(u+A)/2))?u=S:A=S;while((L=D<<2|F<<1|I)===(C=(P>=S)<<2|(R>=w)<<1|T>=y));return s[C]=o,s[L]=a,i}function yK(i){Array.isArray(i)||(i=Array.from(i));let e=i.length,t=new Float64Array(e),n=new Float64Array(e),r=new Float64Array(e),s=1/0,o=1/0,a=1/0,l=-1/0,c=-1/0,u=-1/0;for(let f=0,d,A,y,w;f<e;++f)isNaN(A=+this._x.call(null,d=i[f]))||isNaN(y=+this._y.call(null,d))||isNaN(w=+this._z.call(null,d))||(t[f]=A,n[f]=y,r[f]=w,A<s&&(s=A),A>l&&(l=A),y<o&&(o=y),y>c&&(c=y),w<a&&(a=w),w>u&&(u=w));if(s>l||o>c||a>u)return this;this.cover(s,o,a).cover(l,c,u);for(let f=0;f<e;++f)xK(this,t[f],n[f],r[f],i[f]);return this}function bK(i,e,t){if(isNaN(i=+i)||isNaN(e=+e)||isNaN(t=+t))return this;var n=this._x0,r=this._y0,s=this._z0,o=this._x1,a=this._y1,l=this._z1;if(isNaN(n))o=(n=Math.floor(i))+1,a=(r=Math.floor(e))+1,l=(s=Math.floor(t))+1;else{for(var c=o-n||1,u=this._root,f,d;n>i||i>=o||r>e||e>=a||s>t||t>=l;)switch(d=(t<s)<<2|(e<r)<<1|i<n,f=new Array(8),f[d]=u,u=f,c*=2,d){case 0:o=n+c,a=r+c,l=s+c;break;case 1:n=o-c,a=r+c,l=s+c;break;case 2:o=n+c,r=a-c,l=s+c;break;case 3:n=o-c,r=a-c,l=s+c;break;case 4:o=n+c,a=r+c,s=l-c;break;case 5:n=o-c,a=r+c,s=l-c;break;case 6:o=n+c,r=a-c,s=l-c;break;case 7:n=o-c,r=a-c,s=l-c;break}this._root&&this._root.length&&(this._root=u)}return this._x0=n,this._y0=r,this._z0=s,this._x1=o,this._y1=a,this._z1=l,this}function wK(){var i=[];return this.visit(function(e){if(!e.length)do i.push(e.data);while(e=e.next)}),i}function SK(i){return arguments.length?this.cover(+i[0][0],+i[0][1],+i[0][2]).cover(+i[1][0],+i[1][1],+i[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]}function ji(i,e,t,n,r,s,o){this.node=i,this.x0=e,this.y0=t,this.z0=n,this.x1=r,this.y1=s,this.z1=o}function TK(i,e,t,n){var r,s=this._x0,o=this._y0,a=this._z0,l,c,u,f,d,A,y=this._x1,w=this._y1,S=this._z1,T=[],R=this._root,P,I;for(R&&T.push(new ji(R,s,o,a,y,w,S)),n==null?n=1/0:(s=i-n,o=e-n,a=t-n,y=i+n,w=e+n,S=t+n,n*=n);P=T.pop();)if(!(!(R=P.node)||(l=P.x0)>y||(c=P.y0)>w||(u=P.z0)>S||(f=P.x1)<s||(d=P.y1)<o||(A=P.z1)<a))if(R.length){var F=(l+f)/2,D=(c+d)/2,L=(u+A)/2;T.push(new ji(R[7],F,D,L,f,d,A),new ji(R[6],l,D,L,F,d,A),new ji(R[5],F,c,L,f,D,A),new ji(R[4],l,c,L,F,D,A),new ji(R[3],F,D,u,f,d,L),new ji(R[2],l,D,u,F,d,L),new ji(R[1],F,c,u,f,D,L),new ji(R[0],l,c,u,F,D,L)),(I=(t>=L)<<2|(e>=D)<<1|i>=F)&&(P=T[T.length-1],T[T.length-1]=T[T.length-1-I],T[T.length-1-I]=P)}else{var C=i-+this._x.call(null,R.data),B=e-+this._y.call(null,R.data),k=t-+this._z.call(null,R.data),z=C*C+B*B+k*k;if(z<n){var G=Math.sqrt(n=z);s=i-G,o=e-G,a=t-G,y=i+G,w=e+G,S=t+G,r=R.data}}return r}var Aye=(i,e,t,n,r,s)=>Math.sqrt((i-n)**2+(e-r)**2+(t-s)**2);function EK(i,e,t,n){let r=[],s=i-n,o=e-n,a=t-n,l=i+n,c=e+n,u=t+n;return this.visit((f,d,A,y,w,S,T)=>{if(!f.length)do{let R=f.data;Aye(i,e,t,this._x(R),this._y(R),this._z(R))<=n&&r.push(R)}while(f=f.next);return d>l||A>c||y>u||w<s||S<o||T<a}),r}function MK(i){if(isNaN(d=+this._x.call(null,i))||isNaN(A=+this._y.call(null,i))||isNaN(y=+this._z.call(null,i)))return this;var e,t=this._root,n,r,s,o=this._x0,a=this._y0,l=this._z0,c=this._x1,u=this._y1,f=this._z1,d,A,y,w,S,T,R,P,I,F,D;if(!t)return this;if(t.length)for(;;){if((R=d>=(w=(o+c)/2))?o=w:c=w,(P=A>=(S=(a+u)/2))?a=S:u=S,(I=y>=(T=(l+f)/2))?l=T:f=T,e=t,!(t=t[F=I<<2|P<<1|R]))return this;if(!t.length)break;(e[F+1&7]||e[F+2&7]||e[F+3&7]||e[F+4&7]||e[F+5&7]||e[F+6&7]||e[F+7&7])&&(n=e,D=F)}for(;t.data!==i;)if(r=t,!(t=t.next))return this;return(s=t.next)&&delete t.next,r?(s?r.next=s:delete r.next,this):e?(s?e[F]=s:delete e[F],(t=e[0]||e[1]||e[2]||e[3]||e[4]||e[5]||e[6]||e[7])&&t===(e[7]||e[6]||e[5]||e[4]||e[3]||e[2]||e[1]||e[0])&&!t.length&&(n?n[D]=t:this._root=t),this):(this._root=s,this)}function CK(i){for(var e=0,t=i.length;e<t;++e)this.remove(i[e]);return this}function RK(){return this._root}function IK(){var i=0;return this.visit(function(e){if(!e.length)do++i;while(e=e.next)}),i}function PK(i){var e=[],t,n=this._root,r,s,o,a,l,c,u;for(n&&e.push(new ji(n,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));t=e.pop();)if(!i(n=t.node,s=t.x0,o=t.y0,a=t.z0,l=t.x1,c=t.y1,u=t.z1)&&n.length){var f=(s+l)/2,d=(o+c)/2,A=(a+u)/2;(r=n[7])&&e.push(new ji(r,f,d,A,l,c,u)),(r=n[6])&&e.push(new ji(r,s,d,A,f,c,u)),(r=n[5])&&e.push(new ji(r,f,o,A,l,d,u)),(r=n[4])&&e.push(new ji(r,s,o,A,f,d,u)),(r=n[3])&&e.push(new ji(r,f,d,a,l,c,A)),(r=n[2])&&e.push(new ji(r,s,d,a,f,c,A)),(r=n[1])&&e.push(new ji(r,f,o,a,l,d,A)),(r=n[0])&&e.push(new ji(r,s,o,a,f,d,A))}return this}function LK(i){var e=[],t=[],n;for(this._root&&e.push(new ji(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));n=e.pop();){var r=n.node;if(r.length){var s,o=n.x0,a=n.y0,l=n.z0,c=n.x1,u=n.y1,f=n.z1,d=(o+c)/2,A=(a+u)/2,y=(l+f)/2;(s=r[0])&&e.push(new ji(s,o,a,l,d,A,y)),(s=r[1])&&e.push(new ji(s,d,a,l,c,A,y)),(s=r[2])&&e.push(new ji(s,o,A,l,d,u,y)),(s=r[3])&&e.push(new ji(s,d,A,l,c,u,y)),(s=r[4])&&e.push(new ji(s,o,a,y,d,A,f)),(s=r[5])&&e.push(new ji(s,d,a,y,c,A,f)),(s=r[6])&&e.push(new ji(s,o,A,y,d,u,f)),(s=r[7])&&e.push(new ji(s,d,A,y,c,u,f))}t.push(n)}for(;n=t.pop();)i(n.node,n.x0,n.y0,n.z0,n.x1,n.y1,n.z1);return this}function DK(i){return i[0]}function NK(i){return arguments.length?(this._x=i,this):this._x}function FK(i){return i[1]}function BK(i){return arguments.length?(this._y=i,this):this._y}function OK(i){return i[2]}function UK(i){return arguments.length?(this._z=i,this):this._z}function Hb(i,e,t,n){var r=new PF(e??DK,t??FK,n??OK,NaN,NaN,NaN,NaN,NaN,NaN);return i==null?r:r.addAll(i)}function PF(i,e,t,n,r,s,o,a,l){this._x=i,this._y=e,this._z=t,this._x0=n,this._y0=r,this._z0=s,this._x1=o,this._y1=a,this._z1=l,this._root=void 0}function kK(i){for(var e={data:i.data},t=e;i=i.next;)t=t.next={data:i.data};return e}var Go=Hb.prototype=PF.prototype;Go.copy=function(){var i=new PF(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),e=this._root,t,n;if(!e)return i;if(!e.length)return i._root=kK(e),i;for(t=[{source:e,target:i._root=new Array(8)}];e=t.pop();)for(var r=0;r<8;++r)(n=e.source[r])&&(n.length?t.push({source:n,target:e.target[r]=new Array(8)}):e.target[r]=kK(n));return i};Go.add=_K;Go.addAll=yK;Go.cover=bK;Go.data=wK;Go.extent=SK;Go.find=TK;Go.findAllWithinRadius=EK;Go.remove=MK;Go.removeAll=CK;Go.root=RK;Go.size=IK;Go.visit=PK;Go.visitAfter=LK;Go.x=NK;Go.y=BK;Go.z=UK;function _g(i,e){return i==null||e==null?NaN:i<e?-1:i>e?1:i>=e?0:NaN}function LF(i,e){return i==null||e==null?NaN:e<i?-1:e>i?1:e>=i?0:NaN}function ZM(i){let e,t,n;i.length!==2?(e=_g,t=(a,l)=>_g(i(a),l),n=(a,l)=>i(a)-l):(e=i===_g||i===LF?i:gye,t=i,n=i);function r(a,l,c=0,u=a.length){if(c<u){if(e(l,l)!==0)return u;do{let f=c+u>>>1;t(a[f],l)<0?c=f+1:u=f}while(c<u)}return c}function s(a,l,c=0,u=a.length){if(c<u){if(e(l,l)!==0)return u;do{let f=c+u>>>1;t(a[f],l)<=0?c=f+1:u=f}while(c<u)}return c}function o(a,l,c=0,u=a.length){let f=r(a,l,c,u-1);return f>c&&n(a[f-1],l)>-n(a[f],l)?f-1:f}return{left:r,center:o,right:s}}function gye(){return 0}function DF(i){return i===null?NaN:+i}var zK=ZM(_g),VK=zK.right,vye=zK.left,_ye=ZM(DF).center,Wb=VK;function j0(i,e){let t,n;if(e===void 0)for(let r of i)r!=null&&(t===void 0?r>=r&&(t=n=r):(t>r&&(t=r),n<r&&(n=r)));else{let r=-1;for(let s of i)(s=e(s,++r,i))!=null&&(t===void 0?s>=s&&(t=n=s):(t>s&&(t=s),n<s&&(n=s)))}return[t,n]}var qo=class{constructor(){this._partials=new Float64Array(32),this._n=0}add(e){let t=this._partials,n=0;for(let r=0;r<this._n&&r<32;r++){let s=t[r],o=e+s,a=Math.abs(e)<Math.abs(s)?e-(o-s):s-(o-e);a&&(t[n++]=a),e=o}return t[n]=e,this._n=n+1,this}valueOf(){let e=this._partials,t=this._n,n,r,s,o=0;if(t>0){for(o=e[--t];t>0&&(n=o,r=e[--t],o=n+r,s=r-(o-n),!s););t>0&&(s<0&&e[t-1]<0||s>0&&e[t-1]>0)&&(r=s*2,n=o+r,r==n-o&&(o=n))}return o}};var xye=Math.sqrt(50),yye=Math.sqrt(10),bye=Math.sqrt(2);function KM(i,e,t){let n=(e-i)/Math.max(0,t),r=Math.floor(Math.log10(n)),s=n/Math.pow(10,r),o=s>=xye?10:s>=yye?5:s>=bye?2:1,a,l,c;return r<0?(c=Math.pow(10,-r)/o,a=Math.round(i*c),l=Math.round(e*c),a/c<i&&++a,l/c>e&&--l,c=-c):(c=Math.pow(10,r)*o,a=Math.round(i/c),l=Math.round(e/c),a*c<i&&++a,l*c>e&&--l),l<a&&.5<=t&&t<2?KM(i,e,t*2):[a,l,c]}function QM(i,e,t){if(e=+e,i=+i,t=+t,!(t>0))return[];if(i===e)return[i];let n=e<i,[r,s,o]=n?KM(e,i,t):KM(i,e,t);if(!(s>=r))return[];let a=s-r+1,l=new Array(a);if(n)if(o<0)for(let c=0;c<a;++c)l[c]=(s-c)/-o;else for(let c=0;c<a;++c)l[c]=(s-c)*o;else if(o<0)for(let c=0;c<a;++c)l[c]=(r+c)/-o;else for(let c=0;c<a;++c)l[c]=(r+c)*o;return l}function jb(i,e,t){return e=+e,i=+i,t=+t,KM(i,e,t)[2]}function NF(i,e,t){e=+e,i=+i,t=+t;let n=e<i,r=n?jb(e,i,t):jb(i,e,t);return(n?-1:1)*(r<0?1/-r:r)}function JM(i,e){let t;if(e===void 0)for(let n of i)n!=null&&(t<n||t===void 0&&n>=n)&&(t=n);else{let n=-1;for(let r of i)(r=e(r,++n,i))!=null&&(t<r||t===void 0&&r>=r)&&(t=r)}return t}function eC(i,e){let t=0,n=0;if(e===void 0)for(let r of i)r!=null&&(r=+r)>=r&&(++t,n+=r);else{let r=-1;for(let s of i)(s=e(s,++r,i))!=null&&(s=+s)>=s&&(++t,n+=s)}if(t)return n/t}function*wye(i){for(let e of i)yield*e}function Qh(i){return Array.from(wye(i))}function kd(i,e,t){i=+i,e=+e,t=(r=arguments.length)<2?(e=i,i=0,1):r<3?1:+t;for(var n=-1,r=Math.max(0,Math.ceil((e-i)/t))|0,s=new Array(r);++n<r;)s[n]=i+n*t;return s}function tC(i,e){let t=0;if(e===void 0)for(let n of i)(n=+n)&&(t+=n);else{let n=-1;for(let r of i)(r=+e(r,++n,i))&&(t+=r)}return t}function nC(i,e){switch(arguments.length){case 0:break;case 1:this.range(i);break;default:this.range(e).domain(i);break}return this}function iC(i,e,t){i.prototype=e.prototype=t,t.constructor=i}function FF(i,e){var t=Object.create(i.prototype);for(var n in e)t[n]=e[n];return t}function Yb(){}var Xb=.7,oC=1/Xb,__="\\s*([+-]?\\d+)\\s*",$b="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Jh="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Sye=/^#([0-9a-f]{3,8})$/,Tye=new RegExp(`^rgb\\(${__},${__},${__}\\)$`),Eye=new RegExp(`^rgb\\(${Jh},${Jh},${Jh}\\)$`),Mye=new RegExp(`^rgba\\(${__},${__},${__},${$b}\\)$`),Cye=new RegExp(`^rgba\\(${Jh},${Jh},${Jh},${$b}\\)$`),Rye=new RegExp(`^hsl\\(${$b},${Jh},${Jh}\\)$`),Iye=new RegExp(`^hsla\\(${$b},${Jh},${Jh},${$b}\\)$`),GK={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};iC(Yb,Uu,{copy(i){return Object.assign(new this.constructor,this,i)},displayable(){return this.rgb().displayable()},hex:qK,formatHex:qK,formatHex8:Pye,formatHsl:Lye,formatRgb:HK,toString:HK});function qK(){return this.rgb().formatHex()}function Pye(){return this.rgb().formatHex8()}function Lye(){return ZK(this).formatHsl()}function HK(){return this.rgb().formatRgb()}function Uu(i){var e,t;return i=(i+"").trim().toLowerCase(),(e=Sye.exec(i))?(t=e[1].length,e=parseInt(e[1],16),t===6?WK(e):t===3?new Sl(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):t===8?rC(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):t===4?rC(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=Tye.exec(i))?new Sl(e[1],e[2],e[3],1):(e=Eye.exec(i))?new Sl(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=Mye.exec(i))?rC(e[1],e[2],e[3],e[4]):(e=Cye.exec(i))?rC(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=Rye.exec(i))?$K(e[1],e[2]/100,e[3]/100,1):(e=Iye.exec(i))?$K(e[1],e[2]/100,e[3]/100,e[4]):GK.hasOwnProperty(i)?WK(GK[i]):i==="transparent"?new Sl(NaN,NaN,NaN,0):null}function WK(i){return new Sl(i>>16&255,i>>8&255,i&255,1)}function rC(i,e,t,n){return n<=0&&(i=e=t=NaN),new Sl(i,e,t,n)}function Dye(i){return i instanceof Yb||(i=Uu(i)),i?(i=i.rgb(),new Sl(i.r,i.g,i.b,i.opacity)):new Sl}function x_(i,e,t,n){return arguments.length===1?Dye(i):new Sl(i,e,t,n??1)}function Sl(i,e,t,n){this.r=+i,this.g=+e,this.b=+t,this.opacity=+n}iC(Sl,x_,FF(Yb,{brighter(i){return i=i==null?oC:Math.pow(oC,i),new Sl(this.r*i,this.g*i,this.b*i,this.opacity)},darker(i){return i=i==null?Xb:Math.pow(Xb,i),new Sl(this.r*i,this.g*i,this.b*i,this.opacity)},rgb(){return this},clamp(){return new Sl(yg(this.r),yg(this.g),yg(this.b),aC(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:jK,formatHex:jK,formatHex8:Nye,formatRgb:XK,toString:XK}));function jK(){return`#${xg(this.r)}${xg(this.g)}${xg(this.b)}`}function Nye(){return`#${xg(this.r)}${xg(this.g)}${xg(this.b)}${xg((isNaN(this.opacity)?1:this.opacity)*255)}`}function XK(){let i=aC(this.opacity);return`${i===1?"rgb(":"rgba("}${yg(this.r)}, ${yg(this.g)}, ${yg(this.b)}${i===1?")":`, ${i})`}`}function aC(i){return isNaN(i)?1:Math.max(0,Math.min(1,i))}function yg(i){return Math.max(0,Math.min(255,Math.round(i)||0))}function xg(i){return i=yg(i),(i<16?"0":"")+i.toString(16)}function $K(i,e,t,n){return n<=0?i=e=t=NaN:t<=0||t>=1?i=e=NaN:e<=0&&(i=NaN),new Ou(i,e,t,n)}function ZK(i){if(i instanceof Ou)return new Ou(i.h,i.s,i.l,i.opacity);if(i instanceof Yb||(i=Uu(i)),!i)return new Ou;if(i instanceof Ou)return i;i=i.rgb();var e=i.r/255,t=i.g/255,n=i.b/255,r=Math.min(e,t,n),s=Math.max(e,t,n),o=NaN,a=s-r,l=(s+r)/2;return a?(e===s?o=(t-n)/a+(t<n)*6:t===s?o=(n-e)/a+2:o=(e-t)/a+4,a/=l<.5?s+r:2-s-r,o*=60):a=l>0&&l<1?0:o,new Ou(o,a,l,i.opacity)}function KK(i,e,t,n){return arguments.length===1?ZK(i):new Ou(i,e,t,n??1)}function Ou(i,e,t,n){this.h=+i,this.s=+e,this.l=+t,this.opacity=+n}iC(Ou,KK,FF(Yb,{brighter(i){return i=i==null?oC:Math.pow(oC,i),new Ou(this.h,this.s,this.l*i,this.opacity)},darker(i){return i=i==null?Xb:Math.pow(Xb,i),new Ou(this.h,this.s,this.l*i,this.opacity)},rgb(){var i=this.h%360+(this.h<0)*360,e=isNaN(i)||isNaN(this.s)?0:this.s,t=this.l,n=t+(t<.5?t:1-t)*e,r=2*t-n;return new Sl(BF(i>=240?i-240:i+120,r,n),BF(i,r,n),BF(i<120?i+240:i-120,r,n),this.opacity)},clamp(){return new Ou(YK(this.h),sC(this.s),sC(this.l),aC(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let i=aC(this.opacity);return`${i===1?"hsl(":"hsla("}${YK(this.h)}, ${sC(this.s)*100}%, ${sC(this.l)*100}%${i===1?")":`, ${i})`}`}}));function YK(i){return i=(i||0)%360,i<0?i+360:i}function sC(i){return Math.max(0,Math.min(1,i||0))}function BF(i,e,t){return(i<60?e+(t-e)*i/60:i<180?t:i<240?e+(t-e)*(240-i)/60:e)*255}function OF(i,e,t,n,r){var s=i*i,o=s*i;return((1-3*i+3*s-o)*e+(4-6*s+3*o)*t+(1+3*i+3*s-3*o)*n+o*r)/6}function QK(i){var e=i.length-1;return function(t){var n=t<=0?t=0:t>=1?(t=1,e-1):Math.floor(t*e),r=i[n],s=i[n+1],o=n>0?i[n-1]:2*r-s,a=n<e-1?i[n+2]:2*s-r;return OF((t-n/e)*e,o,r,s,a)}}function JK(i){var e=i.length;return function(t){var n=Math.floor(((t%=1)<0?++t:t)*e),r=i[(n+e-1)%e],s=i[n%e],o=i[(n+1)%e],a=i[(n+2)%e];return OF((t-n/e)*e,r,s,o,a)}}var Zb=i=>()=>i;function Fye(i,e){return function(t){return i+t*e}}function Bye(i,e,t){return i=Math.pow(i,t),e=Math.pow(e,t)-i,t=1/t,function(n){return Math.pow(i+n*e,t)}}function eQ(i){return(i=+i)==1?lC:function(e,t){return t-e?Bye(e,t,i):Zb(isNaN(e)?t:e)}}function lC(i,e){var t=e-i;return t?Fye(i,t):Zb(isNaN(i)?e:i)}var UF=(function i(e){var t=eQ(e);function n(r,s){var o=t((r=x_(r)).r,(s=x_(s)).r),a=t(r.g,s.g),l=t(r.b,s.b),c=lC(r.opacity,s.opacity);return function(u){return r.r=o(u),r.g=a(u),r.b=l(u),r.opacity=c(u),r+""}}return n.gamma=i,n})(1);function tQ(i){return function(e){var t=e.length,n=new Array(t),r=new Array(t),s=new Array(t),o,a;for(o=0;o<t;++o)a=x_(e[o]),n[o]=a.r||0,r[o]=a.g||0,s[o]=a.b||0;return n=i(n),r=i(r),s=i(s),a.opacity=1,function(l){return a.r=n(l),a.g=r(l),a.b=s(l),a+""}}}var Met=tQ(QK),Cet=tQ(JK);function cC(i,e){e||(e=[]);var t=i?Math.min(e.length,i.length):0,n=e.slice(),r;return function(s){for(r=0;r<t;++r)n[r]=i[r]*(1-s)+e[r]*s;return n}}function uC(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function kF(i,e){return(uC(e)?cC:zF)(i,e)}function zF(i,e){var t=e?e.length:0,n=i?Math.min(t,i.length):0,r=new Array(n),s=new Array(t),o;for(o=0;o<n;++o)r[o]=bg(i[o],e[o]);for(;o<t;++o)s[o]=e[o];return function(a){for(o=0;o<n;++o)s[o]=r[o](a);return s}}function nQ(i,e){var t=new Date;return i=+i,e=+e,function(n){return t.setTime(i*(1-n)+e*n),t}}function ef(i,e){return i=+i,e=+e,function(t){return i*(1-t)+e*t}}function iQ(i,e){var t={},n={},r;(i===null||typeof i!="object")&&(i={}),(e===null||typeof e!="object")&&(e={});for(r in e)r in i?t[r]=bg(i[r],e[r]):n[r]=e[r];return function(s){for(r in t)n[r]=t[r](s);return n}}var GF=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,VF=new RegExp(GF.source,"g");function Oye(i){return function(){return i}}function Uye(i){return function(e){return i(e)+""}}function rQ(i,e){var t=GF.lastIndex=VF.lastIndex=0,n,r,s,o=-1,a=[],l=[];for(i=i+"",e=e+"";(n=GF.exec(i))&&(r=VF.exec(e));)(s=r.index)>t&&(s=e.slice(t,s),a[o]?a[o]+=s:a[++o]=s),(n=n[0])===(r=r[0])?a[o]?a[o]+=r:a[++o]=r:(a[++o]=null,l.push({i:o,x:ef(n,r)})),t=VF.lastIndex;return t<e.length&&(s=e.slice(t),a[o]?a[o]+=s:a[++o]=s),a.length<2?l[0]?Uye(l[0].x):Oye(e):(e=l.length,function(c){for(var u=0,f;u<e;++u)a[(f=l[u]).i]=f.x(c);return a.join("")})}function bg(i,e){var t=typeof e,n;return e==null||t==="boolean"?Zb(e):(t==="number"?ef:t==="string"?(n=Uu(e))?(e=n,UF):rQ:e instanceof Uu?UF:e instanceof Date?nQ:uC(e)?cC:Array.isArray(e)?zF:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?iQ:ef)(i,e)}function qF(i,e){return i=+i,e=+e,function(t){return Math.round(i*(1-t)+e*t)}}function HF(i){return function(){return i}}function WF(i){return+i}var sQ=[0,1];function y_(i){return i}function jF(i,e){return(e-=i=+i)?function(t){return(t-i)/e}:HF(isNaN(e)?NaN:.5)}function kye(i,e){var t;return i>e&&(t=i,i=e,e=t),function(n){return Math.max(i,Math.min(e,n))}}function zye(i,e,t){var n=i[0],r=i[1],s=e[0],o=e[1];return r<n?(n=jF(r,n),s=t(o,s)):(n=jF(n,r),s=t(s,o)),function(a){return s(n(a))}}function Vye(i,e,t){var n=Math.min(i.length,e.length)-1,r=new Array(n),s=new Array(n),o=-1;for(i[n]<i[0]&&(i=i.slice().reverse(),e=e.slice().reverse());++o<n;)r[o]=jF(i[o],i[o+1]),s[o]=t(e[o],e[o+1]);return function(a){var l=Wb(i,a,1,n)-1;return s[l](r[l](a))}}function oQ(i,e){return e.domain(i.domain()).range(i.range()).interpolate(i.interpolate()).clamp(i.clamp()).unknown(i.unknown())}function Gye(){var i=sQ,e=sQ,t=bg,n,r,s,o=y_,a,l,c;function u(){var d=Math.min(i.length,e.length);return o!==y_&&(o=kye(i[0],i[d-1])),a=d>2?Vye:zye,l=c=null,f}function f(d){return d==null||isNaN(d=+d)?s:(l||(l=a(i.map(n),e,t)))(n(o(d)))}return f.invert=function(d){return o(r((c||(c=a(e,i.map(n),ef)))(d)))},f.domain=function(d){return arguments.length?(i=Array.from(d,WF),u()):i.slice()},f.range=function(d){return arguments.length?(e=Array.from(d),u()):e.slice()},f.rangeRound=function(d){return e=Array.from(d),t=qF,u()},f.clamp=function(d){return arguments.length?(o=d?!0:y_,u()):o!==y_},f.interpolate=function(d){return arguments.length?(t=d,u()):t},f.unknown=function(d){return arguments.length?(s=d,f):s},function(d,A){return n=d,r=A,u()}}function XF(){return Gye()(y_,y_)}function aQ(i){return Math.abs(i=Math.round(i))>=1e21?i.toLocaleString("en").replace(/,/g,""):i.toString(10)}function wg(i,e){if(!isFinite(i)||i===0)return null;var t=(i=e?i.toExponential(e-1):i.toExponential()).indexOf("e"),n=i.slice(0,t);return[n.length>1?n[0]+n.slice(2):n,+i.slice(t+1)]}function tf(i){return i=wg(Math.abs(i)),i?i[1]:NaN}function lQ(i,e){return function(t,n){for(var r=t.length,s=[],o=0,a=i[0],l=0;r>0&&a>0&&(l+a+1>n&&(a=Math.max(1,n-l)),s.push(t.substring(r-=a,r+a)),!((l+=a+1)>n));)a=i[o=(o+1)%i.length];return s.reverse().join(e)}}function cQ(i){return function(e){return e.replace(/[0-9]/g,function(t){return i[+t]})}}var qye=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function X0(i){if(!(e=qye.exec(i)))throw new Error("invalid format: "+i);var e;return new hC({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}X0.prototype=hC.prototype;function hC(i){this.fill=i.fill===void 0?" ":i.fill+"",this.align=i.align===void 0?">":i.align+"",this.sign=i.sign===void 0?"-":i.sign+"",this.symbol=i.symbol===void 0?"":i.symbol+"",this.zero=!!i.zero,this.width=i.width===void 0?void 0:+i.width,this.comma=!!i.comma,this.precision=i.precision===void 0?void 0:+i.precision,this.trim=!!i.trim,this.type=i.type===void 0?"":i.type+""}hC.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function uQ(i){e:for(var e=i.length,t=1,n=-1,r;t<e;++t)switch(i[t]){case".":n=r=t;break;case"0":n===0&&(n=t),r=t;break;default:if(!+i[t])break e;n>0&&(n=0);break}return n>0?i.slice(0,n)+i.slice(r+1):i}var Kb;function hQ(i,e){var t=wg(i,e);if(!t)return Kb=void 0,i.toPrecision(e);var n=t[0],r=t[1],s=r-(Kb=Math.max(-8,Math.min(8,Math.floor(r/3)))*3)+1,o=n.length;return s===o?n:s>o?n+new Array(s-o+1).join("0"):s>0?n.slice(0,s)+"."+n.slice(s):"0."+new Array(1-s).join("0")+wg(i,Math.max(0,e+s-1))[0]}function $F(i,e){var t=wg(i,e);if(!t)return i+"";var n=t[0],r=t[1];return r<0?"0."+new Array(-r).join("0")+n:n.length>r+1?n.slice(0,r+1)+"."+n.slice(r+1):n+new Array(r-n.length+2).join("0")}var YF={"%":(i,e)=>(i*100).toFixed(e),b:i=>Math.round(i).toString(2),c:i=>i+"",d:aQ,e:(i,e)=>i.toExponential(e),f:(i,e)=>i.toFixed(e),g:(i,e)=>i.toPrecision(e),o:i=>Math.round(i).toString(8),p:(i,e)=>$F(i*100,e),r:$F,s:hQ,X:i=>Math.round(i).toString(16).toUpperCase(),x:i=>Math.round(i).toString(16)};function ZF(i){return i}var fQ=Array.prototype.map,dQ=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function pQ(i){var e=i.grouping===void 0||i.thousands===void 0?ZF:lQ(fQ.call(i.grouping,Number),i.thousands+""),t=i.currency===void 0?"":i.currency[0]+"",n=i.currency===void 0?"":i.currency[1]+"",r=i.decimal===void 0?".":i.decimal+"",s=i.numerals===void 0?ZF:cQ(fQ.call(i.numerals,String)),o=i.percent===void 0?"%":i.percent+"",a=i.minus===void 0?"\u2212":i.minus+"",l=i.nan===void 0?"NaN":i.nan+"";function c(f,d){f=X0(f);var A=f.fill,y=f.align,w=f.sign,S=f.symbol,T=f.zero,R=f.width,P=f.comma,I=f.precision,F=f.trim,D=f.type;D==="n"?(P=!0,D="g"):YF[D]||(I===void 0&&(I=12),F=!0,D="g"),(T||A==="0"&&y==="=")&&(T=!0,A="0",y="=");var L=(d&&d.prefix!==void 0?d.prefix:"")+(S==="$"?t:S==="#"&&/[boxX]/.test(D)?"0"+D.toLowerCase():""),C=(S==="$"?n:/[%p]/.test(D)?o:"")+(d&&d.suffix!==void 0?d.suffix:""),B=YF[D],k=/[defgprs%]/.test(D);I=I===void 0?6:/[gprs]/.test(D)?Math.max(1,Math.min(21,I)):Math.max(0,Math.min(20,I));function z(G){var W=L,Y=C,H,$,J;if(D==="c")Y=B(G)+Y,G="";else{G=+G;var te=G<0||1/G<0;if(G=isNaN(G)?l:B(Math.abs(G),I),F&&(G=uQ(G)),te&&+G==0&&w!=="+"&&(te=!1),W=(te?w==="("?w:a:w==="-"||w==="("?"":w)+W,Y=(D==="s"&&!isNaN(G)&&Kb!==void 0?dQ[8+Kb/3]:"")+Y+(te&&w==="("?")":""),k){for(H=-1,$=G.length;++H<$;)if(J=G.charCodeAt(H),48>J||J>57){Y=(J===46?r+G.slice(H+1):G.slice(H))+Y,G=G.slice(0,H);break}}}P&&!T&&(G=e(G,1/0));var ce=W.length+G.length+Y.length,he=ce<R?new Array(R-ce+1).join(A):"";switch(P&&T&&(G=e(he+G,he.length?R-Y.length:1/0),he=""),y){case"<":G=W+G+Y+he;break;case"=":G=W+he+G+Y;break;case"^":G=he.slice(0,ce=he.length>>1)+W+G+Y+he.slice(ce);break;default:G=he+W+G+Y;break}return s(G)}return z.toString=function(){return f+""},z}function u(f,d){var A=Math.max(-8,Math.min(8,Math.floor(tf(d)/3)))*3,y=Math.pow(10,-A),w=c((f=X0(f),f.type="f",f),{suffix:dQ[8+A/3]});return function(S){return w(y*S)}}return{format:c,formatPrefix:u}}var fC,dC,pC;KF({thousands:",",grouping:[3],currency:["$",""]});function KF(i){return fC=pQ(i),dC=fC.format,pC=fC.formatPrefix,fC}function QF(i){return Math.max(0,-tf(Math.abs(i)))}function JF(i,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(tf(e)/3)))*3-tf(Math.abs(i)))}function eB(i,e){return i=Math.abs(i),e=Math.abs(e)-i,Math.max(0,tf(e)-tf(i))+1}function tB(i,e,t,n){var r=NF(i,e,t),s;switch(n=X0(n??",f"),n.type){case"s":{var o=Math.max(Math.abs(i),Math.abs(e));return n.precision==null&&!isNaN(s=JF(r,o))&&(n.precision=s),pC(n,o)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(s=eB(r,Math.max(Math.abs(i),Math.abs(e))))&&(n.precision=s-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(s=QF(r))&&(n.precision=s-(n.type==="%")*2);break}}return dC(n)}function nB(i){var e=i.domain;return i.ticks=function(t){var n=e();return QM(n[0],n[n.length-1],t??10)},i.tickFormat=function(t,n){var r=e();return tB(r[0],r[r.length-1],t??10,n)},i.nice=function(t){t==null&&(t=10);var n=e(),r=0,s=n.length-1,o=n[r],a=n[s],l,c,u=10;for(a<o&&(c=o,o=a,a=c,c=r,r=s,s=c);u-- >0;){if(c=jb(o,a,t),c===l)return n[r]=o,n[s]=a,e(n);if(c>0)o=Math.floor(o/c)*c,a=Math.ceil(a/c)*c;else if(c<0)o=Math.ceil(o*c)/c,a=Math.floor(a*c)/c;else break;l=c}return i},i}function Tl(){var i=XF();return i.copy=function(){return oQ(i,Tl())},nC.apply(i,arguments),nB(i)}function Qb(){var i=0,e=1,t=1,n=[.5],r=[0,1],s;function o(l){return l!=null&&l<=l?r[Wb(n,l,0,t)]:s}function a(){var l=-1;for(n=new Array(t);++l<t;)n[l]=((l+1)*e-(l-t)*i)/(t+1);return o}return o.domain=function(l){return arguments.length?([i,e]=l,i=+i,e=+e,a()):[i,e]},o.range=function(l){return arguments.length?(t=(r=Array.from(l)).length-1,a()):r.slice()},o.invertExtent=function(l){var c=r.indexOf(l);return c<0?[NaN,NaN]:c<1?[i,n[0]]:c>=t?[n[t-1],e]:[n[c-1],n[c]]},o.unknown=function(l){return arguments.length&&(s=l),o},o.thresholds=function(){return n.slice()},o.copy=function(){return Qb().domain([i,e]).range(r).unknown(s)},nC.apply(nB(o),arguments)}var Pn=1e-6,Sg=1e-12,ri=Math.PI,yo=ri/2,b_=ri/4,bo=ri*2,ur=180/ri,_n=ri/180,si=Math.abs,w_=Math.atan,Rs=Math.atan2,mn=Math.cos,Jb=Math.ceil,mQ=Math.exp;var mC=Math.hypot,AQ=Math.log;var un=Math.sin,gQ=Math.sign||function(i){return i>0?1:i<0?-1:0},Ho=Math.sqrt,vQ=Math.tan;function _Q(i){return i>1?0:i<-1?ri:Math.acos(i)}function fa(i){return i>1?yo:i<-1?-yo:Math.asin(i)}function iB(i){return(i=un(i/2))*i}function ms(){}function AC(i,e){i&&yQ.hasOwnProperty(i.type)&&yQ[i.type](i,e)}var xQ={Feature:function(i,e){AC(i.geometry,e)},FeatureCollection:function(i,e){for(var t=i.features,n=-1,r=t.length;++n<r;)AC(t[n].geometry,e)}},yQ={Sphere:function(i,e){e.sphere()},Point:function(i,e){i=i.coordinates,e.point(i[0],i[1],i[2])},MultiPoint:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)i=t[n],e.point(i[0],i[1],i[2])},LineString:function(i,e){rB(i.coordinates,e,0)},MultiLineString:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)rB(t[n],e,0)},Polygon:function(i,e){bQ(i.coordinates,e)},MultiPolygon:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)bQ(t[n],e)},GeometryCollection:function(i,e){for(var t=i.geometries,n=-1,r=t.length;++n<r;)AC(t[n],e)}};function rB(i,e,t){var n=-1,r=i.length-t,s;for(e.lineStart();++n<r;)s=i[n],e.point(s[0],s[1],s[2]);e.lineEnd()}function bQ(i,e){var t=-1,n=i.length;for(e.polygonStart();++t<n;)rB(i[t],e,1);e.polygonEnd()}function $0(i,e){i&&xQ.hasOwnProperty(i.type)?xQ[i.type](i,e):AC(i,e)}var ew=new qo,wQ=new qo,SQ,TQ,sB,oB,aB,nf={point:ms,lineStart:ms,lineEnd:ms,polygonStart:function(){ew=new qo,nf.lineStart=Hye,nf.lineEnd=Wye},polygonEnd:function(){var i=+ew;wQ.add(i<0?bo+i:i),this.lineStart=this.lineEnd=this.point=ms},sphere:function(){wQ.add(bo)}};function Hye(){nf.point=jye}function Wye(){EQ(SQ,TQ)}function jye(i,e){nf.point=EQ,SQ=i,TQ=e,i*=_n,e*=_n,sB=i,oB=mn(e=e/2+b_),aB=un(e)}function EQ(i,e){i*=_n,e*=_n,e=e/2+b_;var t=i-sB,n=t>=0?1:-1,r=n*t,s=mn(e),o=un(e),a=aB*o,l=oB*s+a*mn(r),c=a*n*un(r);ew.add(Rs(c,l)),sB=i,oB=s,aB=o}function Tg(i){return[Rs(i[1],i[0]),fa(i[2])]}function Xc(i){var e=i[0],t=i[1],n=mn(t);return[n*mn(e),n*un(e),un(t)]}function tw(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]}function zd(i,e){return[i[1]*e[2]-i[2]*e[1],i[2]*e[0]-i[0]*e[2],i[0]*e[1]-i[1]*e[0]]}function gC(i,e){i[0]+=e[0],i[1]+=e[1],i[2]+=e[2]}function nw(i,e){return[i[0]*e,i[1]*e,i[2]*e]}function Eg(i){var e=Ho(i[0]*i[0]+i[1]*i[1]+i[2]*i[2]);i[0]/=e,i[1]/=e,i[2]/=e}var Jr,El,As,nc,Mg,IQ,PQ,S_,iw,Y0,Gd,Vd={point:lB,lineStart:MQ,lineEnd:CQ,polygonStart:function(){Vd.point=DQ,Vd.lineStart=Xye,Vd.lineEnd=$ye,iw=new qo,nf.polygonStart()},polygonEnd:function(){nf.polygonEnd(),Vd.point=lB,Vd.lineStart=MQ,Vd.lineEnd=CQ,ew<0?(Jr=-(As=180),El=-(nc=90)):iw>Pn?nc=90:iw<-Pn&&(El=-90),Gd[0]=Jr,Gd[1]=As},sphere:function(){Jr=-(As=180),El=-(nc=90)}};function lB(i,e){Y0.push(Gd=[Jr=i,As=i]),e<El&&(El=e),e>nc&&(nc=e)}function LQ(i,e){var t=Xc([i*_n,e*_n]);if(S_){var n=zd(S_,t),r=[n[1],-n[0],0],s=zd(r,n);Eg(s),s=Tg(s);var o=i-Mg,a=o>0?1:-1,l=s[0]*ur*a,c,u=si(o)>180;u^(a*Mg<l&&l<a*i)?(c=s[1]*ur,c>nc&&(nc=c)):(l=(l+360)%360-180,u^(a*Mg<l&&l<a*i)?(c=-s[1]*ur,c<El&&(El=c)):(e<El&&(El=e),e>nc&&(nc=e))),u?i<Mg?tc(Jr,i)>tc(Jr,As)&&(As=i):tc(i,As)>tc(Jr,As)&&(Jr=i):As>=Jr?(i<Jr&&(Jr=i),i>As&&(As=i)):i>Mg?tc(Jr,i)>tc(Jr,As)&&(As=i):tc(i,As)>tc(Jr,As)&&(Jr=i)}else Y0.push(Gd=[Jr=i,As=i]);e<El&&(El=e),e>nc&&(nc=e),S_=t,Mg=i}function MQ(){Vd.point=LQ}function CQ(){Gd[0]=Jr,Gd[1]=As,Vd.point=lB,S_=null}function DQ(i,e){if(S_){var t=i-Mg;iw.add(si(t)>180?t+(t>0?360:-360):t)}else IQ=i,PQ=e;nf.point(i,e),LQ(i,e)}function Xye(){nf.lineStart()}function $ye(){DQ(IQ,PQ),nf.lineEnd(),si(iw)>Pn&&(Jr=-(As=180)),Gd[0]=Jr,Gd[1]=As,S_=null}function tc(i,e){return(e-=i)<0?e+360:e}function Yye(i,e){return i[0]-e[0]}function RQ(i,e){return i[0]<=i[1]?i[0]<=e&&e<=i[1]:e<i[0]||i[1]<e}function vC(i){var e,t,n,r,s,o,a;if(nc=As=-(Jr=El=1/0),Y0=[],$0(i,Vd),t=Y0.length){for(Y0.sort(Yye),e=1,n=Y0[0],s=[n];e<t;++e)r=Y0[e],RQ(n,r[0])||RQ(n,r[1])?(tc(n[0],r[1])>tc(n[0],n[1])&&(n[1]=r[1]),tc(r[0],n[1])>tc(n[0],n[1])&&(n[0]=r[0])):s.push(n=r);for(o=-1/0,t=s.length-1,e=0,n=s[t];e<=t;n=r,++e)r=s[e],(a=tc(n[1],r[0]))>o&&(o=a,Jr=r[0],As=n[1])}return Y0=Gd=null,Jr===1/0||El===1/0?[[NaN,NaN],[NaN,NaN]]:[[Jr,El],[As,nc]]}var rw,_C,xC,yC,bC,wC,SC,TC,cB,uB,hB,BQ,OQ,Ha,Wa,ja,ku={sphere:ms,point:fB,lineStart:NQ,lineEnd:FQ,polygonStart:function(){ku.lineStart=Qye,ku.lineEnd=Jye},polygonEnd:function(){ku.lineStart=NQ,ku.lineEnd=FQ}};function fB(i,e){i*=_n,e*=_n;var t=mn(e);sw(t*mn(i),t*un(i),un(e))}function sw(i,e,t){++rw,xC+=(i-xC)/rw,yC+=(e-yC)/rw,bC+=(t-bC)/rw}function NQ(){ku.point=Zye}function Zye(i,e){i*=_n,e*=_n;var t=mn(e);Ha=t*mn(i),Wa=t*un(i),ja=un(e),ku.point=Kye,sw(Ha,Wa,ja)}function Kye(i,e){i*=_n,e*=_n;var t=mn(e),n=t*mn(i),r=t*un(i),s=un(e),o=Rs(Ho((o=Wa*s-ja*r)*o+(o=ja*n-Ha*s)*o+(o=Ha*r-Wa*n)*o),Ha*n+Wa*r+ja*s);_C+=o,wC+=o*(Ha+(Ha=n)),SC+=o*(Wa+(Wa=r)),TC+=o*(ja+(ja=s)),sw(Ha,Wa,ja)}function FQ(){ku.point=fB}function Qye(){ku.point=e2e}function Jye(){UQ(BQ,OQ),ku.point=fB}function e2e(i,e){BQ=i,OQ=e,i*=_n,e*=_n,ku.point=UQ;var t=mn(e);Ha=t*mn(i),Wa=t*un(i),ja=un(e),sw(Ha,Wa,ja)}function UQ(i,e){i*=_n,e*=_n;var t=mn(e),n=t*mn(i),r=t*un(i),s=un(e),o=Wa*s-ja*r,a=ja*n-Ha*s,l=Ha*r-Wa*n,c=mC(o,a,l),u=fa(c),f=c&&-u/c;cB.add(f*o),uB.add(f*a),hB.add(f*l),_C+=u,wC+=u*(Ha+(Ha=n)),SC+=u*(Wa+(Wa=r)),TC+=u*(ja+(ja=s)),sw(Ha,Wa,ja)}function EC(i){rw=_C=xC=yC=bC=wC=SC=TC=0,cB=new qo,uB=new qo,hB=new qo,$0(i,ku);var e=+cB,t=+uB,n=+hB,r=mC(e,t,n);return r<Sg&&(e=wC,t=SC,n=TC,_C<Pn&&(e=xC,t=yC,n=bC),r=mC(e,t,n),r<Sg)?[NaN,NaN]:[Rs(t,e)*ur,fa(n/r)*ur]}function ow(i,e){function t(n,r){return n=i(n,r),e(n[0],n[1])}return i.invert&&e.invert&&(t.invert=function(n,r){return n=e.invert(n,r),n&&i.invert(n[0],n[1])}),t}function dB(i,e){return si(i)>ri&&(i-=Math.round(i/bo)*bo),[i,e]}dB.invert=dB;function pB(i,e,t){return(i%=bo)?e||t?ow(zQ(i),VQ(e,t)):zQ(i):e||t?VQ(e,t):dB}function kQ(i){return function(e,t){return e+=i,si(e)>ri&&(e-=Math.round(e/bo)*bo),[e,t]}}function zQ(i){var e=kQ(i);return e.invert=kQ(-i),e}function VQ(i,e){var t=mn(i),n=un(i),r=mn(e),s=un(e);function o(a,l){var c=mn(l),u=mn(a)*c,f=un(a)*c,d=un(l),A=d*t+u*n;return[Rs(f*r-A*s,u*t-d*n),fa(A*r+f*s)]}return o.invert=function(a,l){var c=mn(l),u=mn(a)*c,f=un(a)*c,d=un(l),A=d*r-f*s;return[Rs(f*r+d*s,u*t+A*n),fa(A*t-u*n)]},o}function mB(i){i=pB(i[0]*_n,i[1]*_n,i.length>2?i[2]*_n:0);function e(t){return t=i(t[0]*_n,t[1]*_n),t[0]*=ur,t[1]*=ur,t}return e.invert=function(t){return t=i.invert(t[0]*_n,t[1]*_n),t[0]*=ur,t[1]*=ur,t},e}function qQ(i,e,t,n,r,s){if(t){var o=mn(e),a=un(e),l=n*t;r==null?(r=e+n*bo,s=e-l/2):(r=GQ(o,r),s=GQ(o,s),(n>0?r<s:r>s)&&(r+=n*bo));for(var c,u=r;n>0?u>s:u<s;u-=l)c=Tg([o,-a*mn(u),-a*un(u)]),i.point(c[0],c[1])}}function GQ(i,e){e=Xc(e),e[0]-=i,Eg(e);var t=_Q(-e[1]);return((-e[2]<0?-t:t)+bo-Pn)%bo}function MC(){var i=[],e;return{point:function(t,n,r){e.push([t,n,r])},lineStart:function(){i.push(e=[])},lineEnd:ms,rejoin:function(){i.length>1&&i.push(i.pop().concat(i.shift()))},result:function(){var t=i;return i=[],e=null,t}}}function T_(i,e){return si(i[0]-e[0])<Pn&&si(i[1]-e[1])<Pn}function CC(i,e,t,n){this.x=i,this.z=e,this.o=t,this.e=n,this.v=!1,this.n=this.p=null}function RC(i,e,t,n,r){var s=[],o=[],a,l;if(i.forEach(function(y){if(!((w=y.length-1)<=0)){var w,S=y[0],T=y[w],R;if(T_(S,T)){if(!S[2]&&!T[2]){for(r.lineStart(),a=0;a<w;++a)r.point((S=y[a])[0],S[1]);r.lineEnd();return}T[0]+=2*Pn}s.push(R=new CC(S,y,null,!0)),o.push(R.o=new CC(S,null,R,!1)),s.push(R=new CC(T,y,null,!1)),o.push(R.o=new CC(T,null,R,!0))}}),!!s.length){for(o.sort(e),HQ(s),HQ(o),a=0,l=o.length;a<l;++a)o[a].e=t=!t;for(var c=s[0],u,f;;){for(var d=c,A=!0;d.v;)if((d=d.n)===c)return;u=d.z,r.lineStart();do{if(d.v=d.o.v=!0,d.e){if(A)for(a=0,l=u.length;a<l;++a)r.point((f=u[a])[0],f[1]);else n(d.x,d.n.x,1,r);d=d.n}else{if(A)for(u=d.p.z,a=u.length-1;a>=0;--a)r.point((f=u[a])[0],f[1]);else n(d.x,d.p.x,-1,r);d=d.p}d=d.o,u=d.z,A=!A}while(!d.v);r.lineEnd()}}}function HQ(i){if(e=i.length){for(var e,t=0,n=i[0],r;++t<e;)n.n=r=i[t],r.p=n,n=r;n.n=r=i[0],r.p=n}}function AB(i){return si(i[0])<=ri?i[0]:gQ(i[0])*((si(i[0])+ri)%bo-ri)}function IC(i,e){var t=AB(e),n=e[1],r=un(n),s=[un(t),-mn(t),0],o=0,a=0,l=new qo;r===1?n=yo+Pn:r===-1&&(n=-yo-Pn);for(var c=0,u=i.length;c<u;++c)if(d=(f=i[c]).length)for(var f,d,A=f[d-1],y=AB(A),w=A[1]/2+b_,S=un(w),T=mn(w),R=0;R<d;++R,y=I,S=D,T=L,A=P){var P=f[R],I=AB(P),F=P[1]/2+b_,D=un(F),L=mn(F),C=I-y,B=C>=0?1:-1,k=B*C,z=k>ri,G=S*D;if(l.add(Rs(G*B*un(k),T*L+G*mn(k))),o+=z?C+B*bo:C,z^y>=t^I>=t){var W=zd(Xc(A),Xc(P));Eg(W);var Y=zd(s,W);Eg(Y);var H=(z^C>=0?-1:1)*fa(Y[2]);(n>H||n===H&&(W[0]||W[1]))&&(a+=z^C>=0?1:-1)}}return(o<-Pn||o<Pn&&l<-Sg)^a&1}function PC(i,e,t,n){return function(r){var s=e(r),o=MC(),a=e(o),l=!1,c,u,f,d={point:A,lineStart:w,lineEnd:S,polygonStart:function(){d.point=T,d.lineStart=R,d.lineEnd=P,u=[],c=[]},polygonEnd:function(){d.point=A,d.lineStart=w,d.lineEnd=S,u=Qh(u);var I=IC(c,n);u.length?(l||(r.polygonStart(),l=!0),RC(u,n2e,I,t,r)):I&&(l||(r.polygonStart(),l=!0),r.lineStart(),t(null,null,1,r),r.lineEnd()),l&&(r.polygonEnd(),l=!1),u=c=null},sphere:function(){r.polygonStart(),r.lineStart(),t(null,null,1,r),r.lineEnd(),r.polygonEnd()}};function A(I,F){i(I,F)&&r.point(I,F)}function y(I,F){s.point(I,F)}function w(){d.point=y,s.lineStart()}function S(){d.point=A,s.lineEnd()}function T(I,F){f.push([I,F]),a.point(I,F)}function R(){a.lineStart(),f=[]}function P(){T(f[0][0],f[0][1]),a.lineEnd();var I=a.clean(),F=o.result(),D,L=F.length,C,B,k;if(f.pop(),c.push(f),f=null,!!L){if(I&1){if(B=F[0],(C=B.length-1)>0){for(l||(r.polygonStart(),l=!0),r.lineStart(),D=0;D<C;++D)r.point((k=B[D])[0],k[1]);r.lineEnd()}return}L>1&&I&2&&F.push(F.pop().concat(F.shift())),u.push(F.filter(t2e))}}return d}}function t2e(i){return i.length>1}function n2e(i,e){return((i=i.x)[0]<0?i[1]-yo-Pn:yo-i[1])-((e=e.x)[0]<0?e[1]-yo-Pn:yo-e[1])}var gB=PC(function(){return!0},i2e,s2e,[-ri,-yo]);function i2e(i){var e=NaN,t=NaN,n=NaN,r;return{lineStart:function(){i.lineStart(),r=1},point:function(s,o){var a=s>0?ri:-ri,l=si(s-e);si(l-ri)<Pn?(i.point(e,t=(t+o)/2>0?yo:-yo),i.point(n,t),i.lineEnd(),i.lineStart(),i.point(a,t),i.point(s,t),r=0):n!==a&&l>=ri&&(si(e-n)<Pn&&(e-=n*Pn),si(s-a)<Pn&&(s-=a*Pn),t=r2e(e,t,s,o),i.point(n,t),i.lineEnd(),i.lineStart(),i.point(a,t),r=0),i.point(e=s,t=o),n=a},lineEnd:function(){i.lineEnd(),e=t=NaN},clean:function(){return 2-r}}}function r2e(i,e,t,n){var r,s,o=un(i-t);return si(o)>Pn?w_((un(e)*(s=mn(n))*un(t)-un(n)*(r=mn(e))*un(i))/(r*s*o)):(e+n)/2}function s2e(i,e,t,n){var r;if(i==null)r=t*yo,n.point(-ri,r),n.point(0,r),n.point(ri,r),n.point(ri,0),n.point(ri,-r),n.point(0,-r),n.point(-ri,-r),n.point(-ri,0),n.point(-ri,r);else if(si(i[0]-e[0])>Pn){var s=i[0]<e[0]?ri:-ri;r=t*s/2,n.point(-s,r),n.point(0,r),n.point(s,r)}else n.point(e[0],e[1])}function WQ(i){var e=mn(i),t=2*_n,n=e>0,r=si(e)>Pn;function s(u,f,d,A){qQ(A,i,t,d,u,f)}function o(u,f){return mn(u)*mn(f)>e}function a(u){var f,d,A,y,w;return{lineStart:function(){y=A=!1,w=1},point:function(S,T){var R=[S,T],P,I=o(S,T),F=n?I?0:c(S,T):I?c(S+(S<0?ri:-ri),T):0;if(!f&&(y=A=I)&&u.lineStart(),I!==A&&(P=l(f,R),(!P||T_(f,P)||T_(R,P))&&(R[2]=1)),I!==A)w=0,I?(u.lineStart(),P=l(R,f),u.point(P[0],P[1])):(P=l(f,R),u.point(P[0],P[1],2),u.lineEnd()),f=P;else if(r&&f&&n^I){var D;!(F&d)&&(D=l(R,f,!0))&&(w=0,n?(u.lineStart(),u.point(D[0][0],D[0][1]),u.point(D[1][0],D[1][1]),u.lineEnd()):(u.point(D[1][0],D[1][1]),u.lineEnd(),u.lineStart(),u.point(D[0][0],D[0][1],3)))}I&&(!f||!T_(f,R))&&u.point(R[0],R[1]),f=R,A=I,d=F},lineEnd:function(){A&&u.lineEnd(),f=null},clean:function(){return w|(y&&A)<<1}}}function l(u,f,d){var A=Xc(u),y=Xc(f),w=[1,0,0],S=zd(A,y),T=tw(S,S),R=S[0],P=T-R*R;if(!P)return!d&&u;var I=e*T/P,F=-e*R/P,D=zd(w,S),L=nw(w,I),C=nw(S,F);gC(L,C);var B=D,k=tw(L,B),z=tw(B,B),G=k*k-z*(tw(L,L)-1);if(!(G<0)){var W=Ho(G),Y=nw(B,(-k-W)/z);if(gC(Y,L),Y=Tg(Y),!d)return Y;var H=u[0],$=f[0],J=u[1],te=f[1],ce;$<H&&(ce=H,H=$,$=ce);var he=$-H,ve=si(he-ri)<Pn,Re=ve||he<Pn;if(!ve&&te<J&&(ce=J,J=te,te=ce),Re?ve?J+te>0^Y[1]<(si(Y[0]-H)<Pn?J:te):J<=Y[1]&&Y[1]<=te:he>ri^(H<=Y[0]&&Y[0]<=$)){var Qe=nw(B,(-k+W)/z);return gC(Qe,L),[Y,Tg(Qe)]}}}function c(u,f){var d=n?i:ri-i,A=0;return u<-d?A|=1:u>d&&(A|=2),f<-d?A|=4:f>d&&(A|=8),A}return PC(o,a,s,n?[0,-i]:[-ri,i-ri])}function jQ(i,e,t,n,r,s){var o=i[0],a=i[1],l=e[0],c=e[1],u=0,f=1,d=l-o,A=c-a,y;if(y=t-o,!(!d&&y>0)){if(y/=d,d<0){if(y<u)return;y<f&&(f=y)}else if(d>0){if(y>f)return;y>u&&(u=y)}if(y=r-o,!(!d&&y<0)){if(y/=d,d<0){if(y>f)return;y>u&&(u=y)}else if(d>0){if(y<u)return;y<f&&(f=y)}if(y=n-a,!(!A&&y>0)){if(y/=A,A<0){if(y<u)return;y<f&&(f=y)}else if(A>0){if(y>f)return;y>u&&(u=y)}if(y=s-a,!(!A&&y<0)){if(y/=A,A<0){if(y>f)return;y>u&&(u=y)}else if(A>0){if(y<u)return;y<f&&(f=y)}return u>0&&(i[0]=o+u*d,i[1]=a+u*A),f<1&&(e[0]=o+f*d,e[1]=a+f*A),!0}}}}}var aw=1e9,LC=-aw;function vB(i,e,t,n){function r(c,u){return i<=c&&c<=t&&e<=u&&u<=n}function s(c,u,f,d){var A=0,y=0;if(c==null||(A=o(c,f))!==(y=o(u,f))||l(c,u)<0^f>0)do d.point(A===0||A===3?i:t,A>1?n:e);while((A=(A+f+4)%4)!==y);else d.point(u[0],u[1])}function o(c,u){return si(c[0]-i)<Pn?u>0?0:3:si(c[0]-t)<Pn?u>0?2:1:si(c[1]-e)<Pn?u>0?1:0:u>0?3:2}function a(c,u){return l(c.x,u.x)}function l(c,u){var f=o(c,1),d=o(u,1);return f!==d?f-d:f===0?u[1]-c[1]:f===1?c[0]-u[0]:f===2?c[1]-u[1]:u[0]-c[0]}return function(c){var u=c,f=MC(),d,A,y,w,S,T,R,P,I,F,D,L={point:C,lineStart:G,lineEnd:W,polygonStart:k,polygonEnd:z};function C(H,$){r(H,$)&&u.point(H,$)}function B(){for(var H=0,$=0,J=A.length;$<J;++$)for(var te=A[$],ce=1,he=te.length,ve=te[0],Re,Qe,Fe=ve[0],mt=ve[1];ce<he;++ce)Re=Fe,Qe=mt,ve=te[ce],Fe=ve[0],mt=ve[1],Qe<=n?mt>n&&(Fe-Re)*(n-Qe)>(mt-Qe)*(i-Re)&&++H:mt<=n&&(Fe-Re)*(n-Qe)<(mt-Qe)*(i-Re)&&--H;return H}function k(){u=f,d=[],A=[],D=!0}function z(){var H=B(),$=D&&H,J=(d=Qh(d)).length;($||J)&&(c.polygonStart(),$&&(c.lineStart(),s(null,null,1,c),c.lineEnd()),J&&RC(d,a,H,s,c),c.polygonEnd()),u=c,d=A=y=null}function G(){L.point=Y,A&&A.push(y=[]),F=!0,I=!1,R=P=NaN}function W(){d&&(Y(w,S),T&&I&&f.rejoin(),d.push(f.result())),L.point=C,I&&u.lineEnd()}function Y(H,$){var J=r(H,$);if(A&&y.push([H,$]),F)w=H,S=$,T=J,F=!1,J&&(u.lineStart(),u.point(H,$));else if(J&&I)u.point(H,$);else{var te=[R=Math.max(LC,Math.min(aw,R)),P=Math.max(LC,Math.min(aw,P))],ce=[H=Math.max(LC,Math.min(aw,H)),$=Math.max(LC,Math.min(aw,$))];jQ(te,ce,i,e,t,n)?(I||(u.lineStart(),u.point(te[0],te[1])),u.point(ce[0],ce[1]),J||u.lineEnd(),D=!1):J&&(u.lineStart(),u.point(H,$),D=!1)}R=H,P=$,I=J}return L}}var _B,xB,DC,NC,E_={sphere:ms,point:ms,lineStart:o2e,lineEnd:ms,polygonStart:ms,polygonEnd:ms};function o2e(){E_.point=l2e,E_.lineEnd=a2e}function a2e(){E_.point=E_.lineEnd=ms}function l2e(i,e){i*=_n,e*=_n,xB=i,DC=un(e),NC=mn(e),E_.point=c2e}function c2e(i,e){i*=_n,e*=_n;var t=un(e),n=mn(e),r=si(i-xB),s=mn(r),o=un(r),a=n*o,l=NC*t-DC*n*s,c=DC*t+NC*n*s;_B.add(Rs(Ho(a*a+l*l),c)),xB=i,DC=t,NC=n}function XQ(i){return _B=new qo,$0(i,E_),+_B}var yB=[null,null],u2e={type:"LineString",coordinates:yB};function Ml(i,e){return yB[0]=i,yB[1]=e,XQ(u2e)}var $Q={Feature:function(i,e){return FC(i.geometry,e)},FeatureCollection:function(i,e){for(var t=i.features,n=-1,r=t.length;++n<r;)if(FC(t[n].geometry,e))return!0;return!1}},YQ={Sphere:function(){return!0},Point:function(i,e){return ZQ(i.coordinates,e)},MultiPoint:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)if(ZQ(t[n],e))return!0;return!1},LineString:function(i,e){return KQ(i.coordinates,e)},MultiLineString:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)if(KQ(t[n],e))return!0;return!1},Polygon:function(i,e){return QQ(i.coordinates,e)},MultiPolygon:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)if(QQ(t[n],e))return!0;return!1},GeometryCollection:function(i,e){for(var t=i.geometries,n=-1,r=t.length;++n<r;)if(FC(t[n],e))return!0;return!1}};function FC(i,e){return i&&YQ.hasOwnProperty(i.type)?YQ[i.type](i,e):!1}function ZQ(i,e){return Ml(i,e)===0}function KQ(i,e){for(var t,n,r,s=0,o=i.length;s<o;s++){if(n=Ml(i[s],e),n===0||s>0&&(r=Ml(i[s],i[s-1]),r>0&&t<=r&&n<=r&&(t+n-r)*(1-Math.pow((t-n)/r,2))<Sg*r))return!0;t=n}return!1}function QQ(i,e){return!!IC(i.map(h2e),JQ(e))}function h2e(i){return i=i.map(JQ),i.pop(),i}function JQ(i){return[i[0]*_n,i[1]*_n]}function bB(i,e){return(i&&$Q.hasOwnProperty(i.type)?$Q[i.type]:FC)(i,e)}function eJ(i,e,t){var n=kd(i,e-Pn,t).concat(e);return function(r){return n.map(function(s){return[r,s]})}}function tJ(i,e,t){var n=kd(i,e-Pn,t).concat(e);return function(r){return n.map(function(s){return[s,r]})}}function wB(){var i,e,t,n,r,s,o,a,l=10,c=l,u=90,f=360,d,A,y,w,S=2.5;function T(){return{type:"MultiLineString",coordinates:R()}}function R(){return kd(Jb(n/u)*u,t,u).map(y).concat(kd(Jb(a/f)*f,o,f).map(w)).concat(kd(Jb(e/l)*l,i,l).filter(function(P){return si(P%u)>Pn}).map(d)).concat(kd(Jb(s/c)*c,r,c).filter(function(P){return si(P%f)>Pn}).map(A))}return T.lines=function(){return R().map(function(P){return{type:"LineString",coordinates:P}})},T.outline=function(){return{type:"Polygon",coordinates:[y(n).concat(w(o).slice(1),y(t).reverse().slice(1),w(a).reverse().slice(1))]}},T.extent=function(P){return arguments.length?T.extentMajor(P).extentMinor(P):T.extentMinor()},T.extentMajor=function(P){return arguments.length?(n=+P[0][0],t=+P[1][0],a=+P[0][1],o=+P[1][1],n>t&&(P=n,n=t,t=P),a>o&&(P=a,a=o,o=P),T.precision(S)):[[n,a],[t,o]]},T.extentMinor=function(P){return arguments.length?(e=+P[0][0],i=+P[1][0],s=+P[0][1],r=+P[1][1],e>i&&(P=e,e=i,i=P),s>r&&(P=s,s=r,r=P),T.precision(S)):[[e,s],[i,r]]},T.step=function(P){return arguments.length?T.stepMajor(P).stepMinor(P):T.stepMinor()},T.stepMajor=function(P){return arguments.length?(u=+P[0],f=+P[1],T):[u,f]},T.stepMinor=function(P){return arguments.length?(l=+P[0],c=+P[1],T):[l,c]},T.precision=function(P){return arguments.length?(S=+P,d=eJ(s,r,90),A=tJ(e,i,S),y=eJ(a,o,90),w=tJ(n,t,S),T):S},T.extentMajor([[-180,-90+Pn],[180,90-Pn]]).extentMinor([[-180,-80-Pn],[180,80+Pn]])}function SB(){return wB()()}function Cg(i,e){var t=i[0]*_n,n=i[1]*_n,r=e[0]*_n,s=e[1]*_n,o=mn(n),a=un(n),l=mn(s),c=un(s),u=o*mn(t),f=o*un(t),d=l*mn(r),A=l*un(r),y=2*fa(Ho(iB(s-n)+o*l*iB(r-t))),w=un(y),S=y?function(T){var R=un(T*=y)/w,P=un(y-T)/w,I=P*u+R*d,F=P*f+R*A,D=P*a+R*c;return[Rs(F,I)*ur,Rs(D,Ho(I*I+F*F))*ur]}:function(){return[t*ur,n*ur]};return S.distance=y,S}var TB=i=>i;var M_=1/0,BC=M_,lw=-M_,OC=lw,f2e={point:d2e,lineStart:ms,lineEnd:ms,polygonStart:ms,polygonEnd:ms,result:function(){var i=[[M_,BC],[lw,OC]];return lw=OC=-(BC=M_=1/0),i}};function d2e(i,e){i<M_&&(M_=i),i>lw&&(lw=i),e<BC&&(BC=e),e>OC&&(OC=e)}var EB=f2e;function cw(i){return function(e){var t=new MB;for(var n in i)t[n]=i[n];return t.stream=e,t}}function MB(){}MB.prototype={constructor:MB,point:function(i,e){this.stream.point(i,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function CB(i,e,t){var n=i.clipExtent&&i.clipExtent();return i.scale(150).translate([0,0]),n!=null&&i.clipExtent(null),$0(t,i.stream(EB)),e(EB.result()),n!=null&&i.clipExtent(n),i}function RB(i,e,t){return CB(i,function(n){var r=e[1][0]-e[0][0],s=e[1][1]-e[0][1],o=Math.min(r/(n[1][0]-n[0][0]),s/(n[1][1]-n[0][1])),a=+e[0][0]+(r-o*(n[1][0]+n[0][0]))/2,l=+e[0][1]+(s-o*(n[1][1]+n[0][1]))/2;i.scale(150*o).translate([a,l])},t)}function nJ(i,e,t){return RB(i,[[0,0],e],t)}function iJ(i,e,t){return CB(i,function(n){var r=+e,s=r/(n[1][0]-n[0][0]),o=(r-s*(n[1][0]+n[0][0]))/2,a=-s*n[0][1];i.scale(150*s).translate([o,a])},t)}function rJ(i,e,t){return CB(i,function(n){var r=+e,s=r/(n[1][1]-n[0][1]),o=-s*n[0][0],a=(r-s*(n[1][1]+n[0][1]))/2;i.scale(150*s).translate([o,a])},t)}var sJ=16,p2e=mn(30*_n);function IB(i,e){return+e?A2e(i,e):m2e(i)}function m2e(i){return cw({point:function(e,t){e=i(e,t),this.stream.point(e[0],e[1])}})}function A2e(i,e){function t(n,r,s,o,a,l,c,u,f,d,A,y,w,S){var T=c-n,R=u-r,P=T*T+R*R;if(P>4*e&&w--){var I=o+d,F=a+A,D=l+y,L=Ho(I*I+F*F+D*D),C=fa(D/=L),B=si(si(D)-1)<Pn||si(s-f)<Pn?(s+f)/2:Rs(F,I),k=i(B,C),z=k[0],G=k[1],W=z-n,Y=G-r,H=R*W-T*Y;(H*H/P>e||si((T*W+R*Y)/P-.5)>.3||o*d+a*A+l*y<p2e)&&(t(n,r,s,o,a,l,z,G,B,I/=L,F/=L,D,w,S),S.point(z,G),t(z,G,B,I,F,D,c,u,f,d,A,y,w,S))}}return function(n){var r,s,o,a,l,c,u,f,d,A,y,w,S={point:T,lineStart:R,lineEnd:I,polygonStart:function(){n.polygonStart(),S.lineStart=F},polygonEnd:function(){n.polygonEnd(),S.lineStart=R}};function T(C,B){C=i(C,B),n.point(C[0],C[1])}function R(){f=NaN,S.point=P,n.lineStart()}function P(C,B){var k=Xc([C,B]),z=i(C,B);t(f,d,u,A,y,w,f=z[0],d=z[1],u=C,A=k[0],y=k[1],w=k[2],sJ,n),n.point(f,d)}function I(){S.point=T,n.lineEnd()}function F(){R(),S.point=D,S.lineEnd=L}function D(C,B){P(r=C,B),s=f,o=d,a=A,l=y,c=w,S.point=P}function L(){t(f,d,u,A,y,w,s,o,r,a,l,c,sJ,n),S.lineEnd=I,I()}return S}}var g2e=cw({point:function(i,e){this.stream.point(i*_n,e*_n)}});function v2e(i){return cw({point:function(e,t){var n=i(e,t);return this.stream.point(n[0],n[1])}})}function _2e(i,e,t,n,r){function s(o,a){return o*=n,a*=r,[e+i*o,t-i*a]}return s.invert=function(o,a){return[(o-e)/i*n,(t-a)/i*r]},s}function oJ(i,e,t,n,r,s){if(!s)return _2e(i,e,t,n,r);var o=mn(s),a=un(s),l=o*i,c=a*i,u=o/i,f=a/i,d=(a*t-o*e)/i,A=(a*e+o*t)/i;function y(w,S){return w*=n,S*=r,[l*w-c*S+e,t-c*w-l*S]}return y.invert=function(w,S){return[n*(u*w-f*S+d),r*(A-f*w-u*S)]},y}function PB(i){return x2e(function(){return i})()}function x2e(i){var e,t=150,n=480,r=250,s=0,o=0,a=0,l=0,c=0,u,f=0,d=1,A=1,y=null,w=gB,S=null,T,R,P,I=TB,F=.5,D,L,C,B,k;function z(H){return C(H[0]*_n,H[1]*_n)}function G(H){return H=C.invert(H[0],H[1]),H&&[H[0]*ur,H[1]*ur]}z.stream=function(H){return B&&k===H?B:B=g2e(v2e(u)(w(D(I(k=H)))))},z.preclip=function(H){return arguments.length?(w=H,y=void 0,Y()):w},z.postclip=function(H){return arguments.length?(I=H,S=T=R=P=null,Y()):I},z.clipAngle=function(H){return arguments.length?(w=+H?WQ(y=H*_n):(y=null,gB),Y()):y*ur},z.clipExtent=function(H){return arguments.length?(I=H==null?(S=T=R=P=null,TB):vB(S=+H[0][0],T=+H[0][1],R=+H[1][0],P=+H[1][1]),Y()):S==null?null:[[S,T],[R,P]]},z.scale=function(H){return arguments.length?(t=+H,W()):t},z.translate=function(H){return arguments.length?(n=+H[0],r=+H[1],W()):[n,r]},z.center=function(H){return arguments.length?(s=H[0]%360*_n,o=H[1]%360*_n,W()):[s*ur,o*ur]},z.rotate=function(H){return arguments.length?(a=H[0]%360*_n,l=H[1]%360*_n,c=H.length>2?H[2]%360*_n:0,W()):[a*ur,l*ur,c*ur]},z.angle=function(H){return arguments.length?(f=H%360*_n,W()):f*ur},z.reflectX=function(H){return arguments.length?(d=H?-1:1,W()):d<0},z.reflectY=function(H){return arguments.length?(A=H?-1:1,W()):A<0},z.precision=function(H){return arguments.length?(D=IB(L,F=H*H),Y()):Ho(F)},z.fitExtent=function(H,$){return RB(z,H,$)},z.fitSize=function(H,$){return nJ(z,H,$)},z.fitWidth=function(H,$){return iJ(z,H,$)},z.fitHeight=function(H,$){return rJ(z,H,$)};function W(){var H=oJ(t,0,0,d,A,f).apply(null,e(s,o)),$=oJ(t,n-H[0],r-H[1],d,A,f);return u=pB(a,l,c),L=ow(e,$),C=ow(u,L),D=IB(L,F),Y()}function Y(){return B=k=null,z}return function(){return e=i.apply(this,arguments),z.invert=e.invert&&G,W()}}function aJ(i){return function(e,t){var n=Ho(e*e+t*t),r=i(n),s=un(r),o=mn(r);return[Rs(e*s,n*o),fa(n&&t*s/n)]}}function uw(i,e){return[i,AQ(vQ((yo+e)/2))]}uw.invert=function(i,e){return[i,2*w_(mQ(e))-yo]};function LB(i,e){var t=mn(e),n=1+mn(i)*t;return[t*un(i)/n,un(e)/n]}LB.invert=aJ(function(i){return 2*w_(i)});function DB(){return PB(LB).scale(250).clipAngle(142)}function BB(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function y2e(i){if(Array.isArray(i))return i}function b2e(i){if(Array.isArray(i))return BB(i)}function hw(i,e,t){if(typeof i=="function"?i===e:i.has(e))return arguments.length<3?e:t;throw new TypeError("Private element is not present on this object")}function w2e(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function S2e(i,e,t){return e=VC(e),N2e(i,fJ()?Reflect.construct(e,[],VC(i).constructor):e.apply(i,t))}function hJ(i,e){if(e.has(i))throw new TypeError("Cannot initialize the same private elements twice on an object")}function T2e(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function oi(i,e){return i.get(hw(i,e))}function Z0(i,e,t){hJ(i,e),e.set(i,t)}function K0(i,e,t){return i.set(hw(i,e),t),t}function E2e(i,e){hJ(i,e),e.add(i)}function M2e(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,pJ(n.key),n)}}function C2e(i,e,t){return e&&M2e(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function C_(i,e,t){return(e=pJ(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function VC(i){return VC=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},VC(i)}function R2e(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),e&&OB(i,e)}function fJ(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(fJ=function(){return!!i})()}function I2e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function P2e(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function L2e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.4119-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function D2e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.4120-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function N2e(i,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return w2e(i)}function OB(i,e){return OB=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},OB(i,e)}function zC(i,e){return y2e(i)||P2e(i,e)||mJ(i,e)||L2e()}function dJ(i){return b2e(i)||I2e(i)||mJ(i)||D2e()}function F2e(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(i)}function pJ(i){var e=F2e(i,"string");return typeof e=="symbol"?e:e+""}function mJ(i,e){if(i){if(typeof i=="string")return BB(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?BB(i,e):void 0}}var AJ=function(e){e instanceof Array?e.forEach(AJ):(e.map&&e.map.dispose(),e.dispose())},UB=function(e){e.geometry&&e.geometry.dispose(),e.material&&AJ(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(UB)};function gJ(i,e,t){var n=(90-i)*Math.PI/180,r=(90-e)*Math.PI/180;return{x:t*Math.sin(n)*Math.cos(r),y:t*Math.cos(n),z:t*Math.sin(n)*Math.sin(r)}}function B2e(i){var e=i.x,t=i.y,n=i.z,r=Math.sqrt(e*e+t*t+n*n),s=Math.acos(t/r),o=Math.atan2(n,e);return{lat:90-s*180/Math.PI,lng:90-o*180/Math.PI-(o<-Math.PI/2?360:0),r}}function Rg(i){return i*Math.PI/180}var vJ=function(e){return 1-(uw(0,(.5-e)*Math.PI)[1]/Math.PI+1)/2},NB=function(e){return Math.max(0,Math.min(1,vJ(e)))},lJ=function(e){return .5-uw.invert(0,(2*(1-e)-1)*Math.PI)[1]/Math.PI},O2e=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,r=Tl().domain([1,0]).range([t,n]).clamp(!0),s=Tl().domain([NB(t),NB(n)]).range([1,0]).clamp(!0),o=function(f){return s(NB(r(f)))},a=e.array,l=0,c=a.length;l<c;l+=2)a[l+1]=o(a[l+1]);e.needsUpdate=!0},cJ=function(e,t,n,r){var s=Math.pow(2,e),o=Math.max(0,Math.min(s-1,Math.floor((n+180)*s/360))),a=(90-r)/180;t&&(a=Math.max(0,Math.min(1,vJ(a))));var l=Math.floor(a*s);return[o,l]},kB=function(e,t){for(var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,s=arguments.length>4?arguments[4]:void 0,o=arguments.length>5?arguments[5]:void 0,a=[],l=Math.pow(2,e),c=360/l,u=180/l,f=s===void 0?l-1:s,d=o===void 0?l-1:o,A=n,y=Math.min(l-1,f);A<=y;A++)for(var w=r,S=Math.min(l-1,d);w<=S;w++){var T=w,R=u;if(t){T=w===0?w:lJ(w/l)*l;var P=w+1===l?w+1:lJ((w+1)/l)*l;R=(P-T)*180/l}var I=-180+(A+.5)*c,F=90-(T*180/l+R/2),D=R;a.push({x:A,y:w,lng:I,lat:F,latLen:D})}return a},U2e=6,k2e=7,z2e=3,V2e=90,rf=new WeakMap,Q0=new WeakMap,FB=new WeakMap,UC=new WeakMap,$c=new WeakMap,GC=new WeakMap,R_=new WeakMap,Ig=new WeakMap,kC=new WeakSet,_J=(function(i){function e(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=r.tileUrl,o=r.minLevel,a=o===void 0?0:o,l=r.maxLevel,c=l===void 0?17:l,u=r.mercatorProjection,f=u===void 0?!0:u;return T2e(this,e),n=S2e(this,e),E2e(n,kC),Z0(n,rf,void 0),Z0(n,Q0,void 0),Z0(n,FB,void 0),Z0(n,UC,void 0),Z0(n,$c,{}),Z0(n,GC,void 0),Z0(n,R_,void 0),Z0(n,Ig,void 0),C_(n,"minLevel",void 0),C_(n,"maxLevel",void 0),C_(n,"thresholds",dJ(new Array(30)).map(function(d,A){return 8/Math.pow(2,A)})),C_(n,"curvatureResolution",5),C_(n,"tileMargin",0),C_(n,"clearTiles",function(){Object.values(oi($c,n)).forEach(function(d){d.forEach(function(A){A.obj&&(n.remove(A.obj),UB(A.obj),delete A.obj)})}),K0($c,n,{})}),K0(rf,n,t),n.tileUrl=s,K0(Q0,n,f),n.minLevel=a,n.maxLevel=c,n.level=0,n.add(K0(Ig,n,new Hn(new za(oi(rf,n)*.99,180,90),new fs({color:0})))),oi(Ig,n).visible=!1,oi(Ig,n).material.polygonOffset=!0,oi(Ig,n).material.polygonOffsetUnits=3,oi(Ig,n).material.polygonOffsetFactor=1,n}return R2e(e,i),C2e(e,[{key:"tileUrl",get:function(){return oi(FB,this)},set:function(n){K0(FB,this,n),this.updatePov(oi(R_,this))}},{key:"level",get:function(){return oi(UC,this)},set:function(n){var r,s=this;oi($c,this)[n]||hw(kC,this,G2e).call(this,n);var o=oi(UC,this);if(K0(UC,this,n),!(n===o||o===void 0)){if(oi(Ig,this).visible=n>0,oi($c,this)[n].forEach(function(l){return l.obj&&(l.obj.material.depthWrite=!0)}),o<n&&((r=oi($c,this)[o])===null||r===void 0||r.forEach(function(l){return l.obj&&(l.obj.material.depthWrite=!1)})),o>n)for(var a=n+1;a<=o;a++)oi($c,this)[a]&&oi($c,this)[a].forEach(function(l){l.obj&&(s.remove(l.obj),UB(l.obj),delete l.obj)});hw(kC,this,uJ).call(this)}}},{key:"updatePov",value:function(n){var r=this;if(!(!n||!(n instanceof Dd))){K0(R_,this,n);var s;if(K0(GC,this,function(u){if(!u.hullPnts){var f=360/Math.pow(2,r.level),d=u.lng,A=u.lat,y=u.latLen,w=d-f/2,S=d+f/2,T=A-y/2,R=A+y/2;u.hullPnts=[[A,d],[T,w],[R,w],[T,S],[R,S]].map(function(P){var I=zC(P,2),F=I[0],D=I[1];return gJ(F,D,oi(rf,r))}).map(function(P){var I=P.x,F=P.y,D=P.z;return new re(I,F,D)})}return s||(s=new Gc,n.updateMatrix(),n.updateMatrixWorld(),s.setFromProjectionMatrix(new cn().multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse))),u.hullPnts.some(function(P){return s.containsPoint(P.clone().applyMatrix4(r.matrixWorld))})}),this.tileUrl){var o=n.position.clone(),a=o.distanceTo(this.getWorldPosition(new re)),l=(a-oi(rf,this))/oi(rf,this),c=this.thresholds.findIndex(function(u){return u&&u<=l});this.level=Math.min(this.maxLevel,Math.max(this.minLevel,c<0?this.thresholds.length:c)),hw(kC,this,uJ).call(this)}}}}])})(Br);function G2e(i){var e=this;if(i>k2e){oi($c,this)[i]=[];return}var t=oi($c,this)[i]=kB(i,oi(Q0,this));t.forEach(function(n){return n.centroid=gJ(n.lat,n.lng,oi(rf,e))}),t.octree=Hb().x(function(n){return n.centroid.x}).y(function(n){return n.centroid.y}).z(function(n){return n.centroid.z}).addAll(t)}function uJ(){var i=this;if(!(!this.tileUrl||this.level===void 0||!oi($c,this).hasOwnProperty(this.level))&&!(!oi(GC,this)&&this.level>U2e)){var e=oi($c,this)[this.level];if(oi(R_,this)){var t=this.worldToLocal(oi(R_,this).position.clone());if(e.octree){var n,r=this.worldToLocal(oi(R_,this).position.clone()),s=(r.length()-oi(rf,this))*z2e;e=(n=e.octree).findAllWithinRadius.apply(n,dJ(r).concat([s]))}else{var o=B2e(t),a=(o.r/oi(rf,this)-1)*V2e,l=a/Math.cos(Rg(o.lat)),c=[o.lng-l,o.lng+l],u=[o.lat+a,o.lat-a],f=cJ(this.level,oi(Q0,this),c[0],u[0]),d=zC(f,2),A=d[0],y=d[1],w=cJ(this.level,oi(Q0,this),c[1],u[1]),S=zC(w,2),T=S[0],R=S[1];!e.record&&(e.record={});var P=e.record;if(!P.hasOwnProperty("".concat(Math.round((A+T)/2),"_").concat(Math.round((y+R)/2))))e=kB(this.level,oi(Q0,this),A,y,T,R).map(function(C){var B="".concat(C.x,"_").concat(C.y);return P.hasOwnProperty(B)?P[B]:(P[B]=C,e.push(C),C)});else{for(var I=[],F=A;F<=T;F++)for(var D=y;D<=R;D++){var L="".concat(F,"_").concat(D);P.hasOwnProperty(L)||(P[L]=kB(this.level,oi(Q0,this),F,D,F,D)[0],e.push(P[L])),I.push(P[L])}e=I}}}e.filter(function(C){return!C.obj}).filter(oi(GC,this)||function(){return!0}).forEach(function(C){var B=C.x,k=C.y,z=C.lng,G=C.lat,W=C.latLen,Y=360/Math.pow(2,i.level);if(!C.obj){var H=Y*(1-i.tileMargin),$=W*(1-i.tileMargin),J=Rg(z),te=Rg(-G),ce=new Hn(new za(oi(rf,i),Math.ceil(H/i.curvatureResolution),Math.ceil($/i.curvatureResolution),Rg(90-H/2)+J,Rg(H),Rg(90-$/2)+te,Rg($)),new Va);if(oi(Q0,i)){var he=[G+W/2,G-W/2].map(function(Fe){return .5-Fe/180}),ve=zC(he,2),Re=ve[0],Qe=ve[1];O2e(ce.geometry.attributes.uv,Re,Qe)}C.obj=ce}C.loading||(C.loading=!0,new bl().load(i.tileUrl(B,k,i.level),function(Fe){var mt=C.obj;mt&&(Fe.colorSpace=Fr,mt.material.map=Fe,mt.material.color=null,mt.material.needsUpdate=!0,i.add(mt)),C.loading=!1}))})}}var mw=new Set,zB=!1;function XB(i,e,t=2){let n=e&&e.length,r=n?e[0]*t:i.length;mw.size&&mw.clear();let s=wJ(i,0,r,t,!0),o=[];if(!s||s.next===s.prev)return o;let a=0,l=0,c=0;if(n&&(s=X2e(i,e,s,t)),i.length>80*t){a=i[0],l=i[1];let u=a,f=l;for(let d=t;d<r;d+=t){let A=i[d],y=i[d+1];A<a&&(a=A),y<l&&(l=y),A>u&&(u=A),y>f&&(f=y)}c=Math.max(u-a,f-l),c=c!==0?32767/c:0}return VB(s,o,a,l,c),o}function wJ(i,e,t,n,r){let s=null;if(r===obe(i,e,t,n)>0)for(let o=e;o<t;o+=n)s=bJ(o/n|0,i[o],i[o+1],s);else for(let o=t-n;o>=e;o-=n)s=bJ(o/n|0,i[o],i[o+1],s);return s&&Aw(s,s.next)&&(vw(s),s=s.next),s}function Lg(i,e=i){let t=e===i,n=i,r;do r=!1,n!==n.next&&(mw.size===0||!mw.has(n))&&(Aw(n,n.next)||Xs(n.prev,n,n.next)===0)?((t||n===e)&&(e=n.prev),zB=!0,vw(n),n=n.prev,r=!0):(t||n!==e)&&(n=n.next,r=!t);while(r||n!==e);return e}function VB(i,e,t,n,r){r&&ebe(i,t,n,r);let s=i,o=!1;for(;i.prev!==i.next;){let a=i.prev,l=i.next;if(Xs(a,i,l)<0&&(r?H2e(i,t,n,r):q2e(i))){e.push(a.i,i.i,l.i),vw(i),i=l,s=l;continue}if(i=l,i===s){if(zB=!1,i=Lg(i),zB){s=i;continue}if(!o){i=W2e(i,e),s=i,o=!0;continue}j2e(i,e,t,n,r);break}}}function q2e(i){let e=i.prev,t=i,n=i.next,r=e.x,s=t.x,o=n.x,a=e.y,l=t.y,c=n.y,u=Math.min(r,s,o),f=Math.min(a,l,c),d=Math.max(r,s,o),A=Math.max(a,l,c),y=n.next;for(;y!==e;){if(y.x>=u&&y.x<=d&&y.y>=f&&y.y<=A&&!(r===y.x&&a===y.y)&&jC(r,a,s,l,o,c,y.x,y.y)&&Xs(y.prev,y,y.next)>=0)return!1;y=y.next}return!0}function H2e(i,e,t,n){let r=i.prev,s=i,o=i.next,a=r.x,l=s.x,c=o.x,u=r.y,f=s.y,d=o.y,A=Math.min(a,l,c),y=Math.min(u,f,d),w=Math.max(a,l,c),S=Math.max(u,f,d),T=WB(A,y,e,t,n),R=WB(w,S,e,t,n),P=i.prevZ;for(;P&&P.z>=T;){if(P.x>=A&&P.x<=w&&P.y>=y&&P.y<=S&&P!==o&&!(a===P.x&&u===P.y)&&jC(a,u,l,f,c,d,P.x,P.y)&&Xs(P.prev,P,P.next)>=0)return!1;P=P.prevZ}let I=i.nextZ;for(;I&&I.z<=R;){if(I.x>=A&&I.x<=w&&I.y>=y&&I.y<=S&&I!==o&&!(a===I.x&&u===I.y)&&jC(a,u,l,f,c,d,I.x,I.y)&&Xs(I.prev,I,I.next)>=0)return!1;I=I.nextZ}return!0}function W2e(i,e){let t=i,n=!1;do{let r=t.prev,s=t.next.next;EJ(r,t,t.next,s,!1)&&gw(r,s)&&gw(s,r)&&(e.push(r.i,t.i,s.i),vw(t),vw(t.next),t=i=s,n=!0),t=t.next}while(t!==i);return n?Lg(t):t}function j2e(i,e,t,n,r){let s=i;do{let o=s.next.next;for(;o!==s.prev;){if(s.i!==o.i&&ibe(s,o)){let a=MJ(s,o);s=Lg(s,s.next),a=Lg(a,a.next),VB(s,e,t,n,r),VB(a,e,t,n,r);return}o=o.next}s=s.next}while(s!==i)}var GB=!1;function X2e(i,e,t,n){let r=[];for(let s=0,o=e.length;s<o;s++){let a=e[s]*n,l=s<o-1?e[s+1]*n:i.length,c=wJ(i,a,l,n,!1);c===c.next&&mw.add(c),r.push(nbe(c))}r.sort($2e),Z2e(i.length/n,e.length),TJ(t,t),GB=!0;for(let s=0;s<r.length;s++)t=Y2e(r[s],t);return GB=!1,Lg(t)}function $2e(i,e){return i.x-e.x||i.y-e.y||(i.next.y-i.y)/(i.next.x-i.x)-(e.next.y-e.y)/(e.next.x-e.x)}function Y2e(i,e){let t=Q2e(i,e);if(!t)return e;let n=MJ(t,i),r=n.next;return TJ(t,r.next),Lg(n,n.next),Lg(t,t.next)}var SJ=16,gs=new Float64Array(0),WC=0,qB=[],HB=[];function Z2e(i,e){let t=Math.ceil((i+2*e)/SJ)+e+2;gs.length<t*4&&(gs=new Float64Array(t*4)),WC=0}function TJ(i,e){let t=i;do{let n=WC++;qB[n]=t;let r=1/0,s=1/0,o=-1/0,a=-1/0,l=0;do{let u=t.next;t.z=n,t.x<r&&(r=t.x),t.x>o&&(o=t.x),t.y<s&&(s=t.y),t.y>a&&(a=t.y),u.x<r&&(r=u.x),u.x>o&&(o=u.x),u.y<s&&(s=u.y),u.y>a&&(a=u.y),t=u}while(++l<SJ&&t!==e);HB[n]=t;let c=n*4;gs[c]=r,gs[c+1]=s,gs[c+2]=o,gs[c+3]=a}while(t!==e)}function K2e(i,e){let t=i.z*4;e.x<gs[t]&&(gs[t]=e.x),e.y<gs[t+1]&&(gs[t+1]=e.y),e.x>gs[t+2]&&(gs[t+2]=e.x),e.y>gs[t+3]&&(gs[t+3]=e.y)}function xJ(i){let e=HB[i];for(;e.prev.next!==e;)e=e.next;return HB[i]=e,e}function yJ(i){let e=qB[i];for(;e.prev.next!==e;)e=e.next;return qB[i]=e,e}function Q2e(i,e){let t=e,n=i.x,r=i.y,s=-1/0,o;if(Aw(i,t))return t;for(let d=0,A=0;d<WC;d++,A+=4){if(r<gs[A+1]||r>gs[A+3]||gs[A]>n||gs[A+2]<=s)continue;let y=xJ(d);t=yJ(d);do{if(t.prev.next===t){if(Aw(i,t.next))return t.next;if(r<=t.y&&r>=t.next.y&&t.next.y!==t.y){let w=t.x+(r-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(w<=n&&w>s&&(s=w,o=t.x<t.next.x?t:t.next,w===n))return o}}t=t.next}while(t!==y)}if(!o)return null;let a=o.x,l=o.y,c=Math.min(r,l),u=Math.max(r,l),f=1/0;for(let d=0,A=0;d<WC;d++,A+=4){if(gs[A+2]<a||gs[A]>n||gs[A+3]<c||gs[A+1]>u)continue;let y=xJ(d);t=yJ(d);do{if(t.prev.next===t&&n>=t.x&&t.x>=a&&n!==t.x&&jC(r<l?n:s,r,a,l,r<l?s:n,r,t.x,t.y)){let w=Math.abs(r-t.y)/(n-t.x);(gw(t,i)||t.y===r&&t.next.y===r&&t.next.x>n)&&(w<f||w===f&&(t.x>o.x||t.x===o.x&&J2e(o,t)))&&(o=t,f=w)}t=t.next}while(t!==y)}return o}function J2e(i,e){return Xs(i.prev,i,e.prev)<0&&Xs(e.next,i,i.next)<0}var Yc=[],fw=[],Pg=new Uint32Array(0),dw=new Uint32Array(0),pw=new Uint32Array(256);function ebe(i,e,t,n){let r=i,s=0;do r.z=WB(r.x,r.y,e,t,n),Yc[s++]=r,r=r.next;while(r!==i);tbe(s);let o=null;for(let a=0;a<s;a++){let l=Yc[a];l.prevZ=o,o&&(o.nextZ=l),o=l}o.nextZ=null}function tbe(i){if(i<=32){for(let e=1;e<i;e++){let t=Yc[e],n=t.z,r=e-1;for(;r>=0&&Yc[r].z>n;)Yc[r+1]=Yc[r],r--;Yc[r+1]=t}return}Pg.length<i&&(Pg=new Uint32Array(i),dw=new Uint32Array(i),fw=new Array(i));for(let e=0;e<i;e++)Pg[e]=Yc[e].z;qC(i,Yc,Pg,fw,dw,0),qC(i,fw,dw,Yc,Pg,8),qC(i,Yc,Pg,fw,dw,16),qC(i,fw,dw,Yc,Pg,24)}function qC(i,e,t,n,r,s){pw.fill(0);for(let a=0;a<i;a++)pw[t[a]>>>s&255]++;let o=0;for(let a=0;a<256;a++){let l=pw[a];pw[a]=o,o+=l}for(let a=0;a<i;a++){let l=t[a],c=pw[l>>>s&255]++;n[c]=e[a],r[c]=l}}function WB(i,e,t,n,r){return i=(i-t)*r|0,e=(e-n)*r|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,i|e<<1}function nbe(i){let e=i,t=i;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==i);return t}function jC(i,e,t,n,r,s,o,a){return(r-o)*(e-a)>=(i-o)*(s-a)&&(i-o)*(n-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(r-o)*(n-a)}function ibe(i,e){let t=Aw(i,e)&&Xs(i.prev,i,i.next)>0&&Xs(e.prev,e,e.next)>0;return i.next.i!==e.i&&(t||gw(i,e)&&gw(e,i)&&(Xs(i.prev,i,e.prev)!==0||Xs(i,e.prev,e)!==0))&&!rbe(i,e)&&(t||sbe(i,e))}function Xs(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function Aw(i,e){return i.x===e.x&&i.y===e.y}function EJ(i,e,t,n,r=!0){let s=Xs(i,e,t),o=Xs(i,e,n),a=Xs(t,n,i),l=Xs(t,n,e);return(s>0&&o<0||s<0&&o>0)&&(a>0&&l<0||a<0&&l>0)?!0:r?!!(s===0&&HC(i,t,e)||o===0&&HC(i,n,e)||a===0&&HC(t,i,n)||l===0&&HC(t,e,n)):!1}function HC(i,e,t){return e.x<=Math.max(i.x,t.x)&&e.x>=Math.min(i.x,t.x)&&e.y<=Math.max(i.y,t.y)&&e.y>=Math.min(i.y,t.y)}function rbe(i,e){let t=Math.min(i.x,e.x),n=Math.max(i.x,e.x),r=Math.min(i.y,e.y),s=Math.max(i.y,e.y),o=i;do{let a=o.next;if(o.x>n&&a.x>n||o.x<t&&a.x<t||o.y>s&&a.y>s||o.y<r&&a.y<r){o=a;continue}if(o.i!==i.i&&a.i!==i.i&&o.i!==e.i&&a.i!==e.i&&EJ(o,a,i,e))return!0;o=a}while(o!==i);return!1}function gw(i,e){return Xs(i.prev,i,i.next)<0?Xs(i,e,i.next)>=0&&Xs(i,i.prev,e)>=0:Xs(i,e,i.prev)<0||Xs(i,i.next,e)<0}function sbe(i,e){let t=i,n=!1,r=(i.x+e.x)/2,s=(i.y+e.y)/2;do{let o=t.next;t.y>s!=o.y>s&&r<(o.x-t.x)*(s-t.y)/(o.y-t.y)+t.x&&(n=!n),t=o}while(t!==i);return n}function MJ(i,e){let t=jB(i.i,i.x,i.y),n=jB(e.i,e.x,e.y),r=i.next,s=e.prev;return i.next=e,e.prev=i,t.next=r,r.prev=t,n.next=t,t.prev=n,s.next=n,n.prev=s,n}function bJ(i,e,t,n){let r=jB(i,e,t);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function vw(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ),GB&&K2e(i.prev,i.next)}function jB(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null}}function obe(i,e,t,n){let r=0;for(let s=e,o=t-n;s<t;s+=n)r+=(i[o]-i[s])*(i[s+1]+i[o+1]),o=s;return r}function I_(i){let e=[],t=[],n=i[0][0].length,r=0,s=0;for(let o of i){for(let a of o)for(let l=0;l<n;l++)e.push(a[l]);s&&(r+=s,t.push(r)),s=o.length}return{vertices:e,holes:t,dimensions:n}}function YB(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function abe(i){if(Array.isArray(i))return i}function lbe(i){if(Array.isArray(i))return YB(i)}function cbe(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function ube(i,e,t){return e=XC(e),_be(i,IJ()?Reflect.construct(e,[],XC(i).constructor):e.apply(i,t))}function hbe(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function fbe(i,e,t){return Object.defineProperty(i,"prototype",{writable:!1}),i}function dbe(i,e){var t=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(!t){if(Array.isArray(i)||(t=QB(i))||e){t&&(i=t);var n=0,r=function(){};return{s:r,n:function(){return n>=i.length?{done:!0}:{done:!1,value:i[n++]}},e:function(l){throw l},f:r}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.4121-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s,o=!0,a=!1;return{s:function(){t=t.call(i)},n:function(){var l=t.next();return o=l.done,l},e:function(l){a=!0,s=l},f:function(){try{o||t.return==null||t.return()}finally{if(a)throw s}}}}function XC(i){return XC=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},XC(i)}function pbe(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),e&&ZB(i,e)}function IJ(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(IJ=function(){return!!i})()}function mbe(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function Abe(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e===0){if(Object(t)!==t)return;l=!1}else for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function gbe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.4122-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function vbe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.4123-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _be(i,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return cbe(i)}function ZB(i,e){return ZB=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},ZB(i,e)}function _w(i,e){return abe(i)||Abe(i,e)||QB(i,e)||gbe()}function xbe(i){return lbe(i)||mbe(i)||QB(i)||vbe()}function QB(i,e){if(i){if(typeof i=="string")return YB(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?YB(i,e):void 0}}var CJ=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,n=[],r=null;return e.forEach(function(s){if(r){var o=Ml(s,r)*180/Math.PI;if(o>t)for(var a=Cg(r,s),l=r.length>2||s.length>2?ef(r[2]||0,s[2]||0):null,c=l?function(d){return[].concat(xbe(a(d)),[l(d)])}:a,u=1/Math.ceil(o/t),f=u;f<1;)n.push(c(f)),f+=u}n.push(r=s)}),n},KB=typeof window<"u"&&window.THREE?window.THREE:{BufferGeometry:Xn,Float32BufferAttribute:Ln},ybe=new KB.BufferGeometry().setAttribute?"setAttribute":"addAttribute",JB=(function(i){function e(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:5;hbe(this,e),n=ube(this,e),n.type="GeoJsonGeometry",n.parameters={geoJson:t,radius:r,resolution:s};var o=({Point:u,MultiPoint:f,LineString:d,MultiLineString:A,Polygon:y,MultiPolygon:w}[t.type]||function(){return[]})(t.coordinates,r),a=[],l=[],c=0;o.forEach(function(S){var T=a.length;xw({indices:a,vertices:l},S),n.addGroup(T,a.length-T,c++)}),a.length&&n.setIndex(a),l.length&&n[ybe]("position",new KB.Float32BufferAttribute(l,3));function u(S,T){var R=$B(S[1],S[0],T+(S[2]||0)),P=[];return[{vertices:R,indices:P}]}function f(S,T){var R={vertices:[],indices:[]};return S.map(function(P){return u(P,T)}).forEach(function(P){var I=_w(P,1),F=I[0];xw(R,F)}),[R]}function d(S,T){for(var R=CJ(S,s).map(function(C){var B=_w(C,3),k=B[0],z=B[1],G=B[2],W=G===void 0?0:G;return $B(z,k,T+W)}),P=I_([R]),I=P.vertices,F=Math.round(I.length/3),D=[],L=1;L<F;L++)D.push(L-1,L);return[{vertices:I,indices:D}]}function A(S,T){var R={vertices:[],indices:[]};return S.map(function(P){return d(P,T)}).forEach(function(P){var I=_w(P,1),F=I[0];xw(R,F)}),[R]}function y(S,T){for(var R=S.map(function(H){return CJ(H,s).map(function($){var J=_w($,3),te=J[0],ce=J[1],he=J[2],ve=he===void 0?0:he;return $B(ce,te,T+ve)})}),P=I_(R),I=P.vertices,F=P.holes,D=F[0]||1/0,L=I.slice(0,D*3),C=I.slice(D*3),B=new Set(F),k=Math.round(I.length/3),z=[],G=[],W=1;W<k;W++)B.has(W)||(W<D?z.push(W-1,W):G.push(W-1-D,W-D));var Y=[{indices:z,vertices:L}];return F.length&&Y.push({indices:G,vertices:C}),Y}function w(S,T){var R={vertices:[],indices:[]},P={vertices:[],indices:[]};S.map(function(F){return y(F,T)}).forEach(function(F){var D=_w(F,2),L=D[0],C=D[1];xw(R,L),C&&xw(P,C)});var I=[R];return P.vertices.length&&I.push(P),I}return n}return pbe(e,i),fbe(e)})(KB.BufferGeometry);function xw(i,e){var t=Math.round(i.vertices.length/3);RJ(i.vertices,e.vertices),RJ(i.indices,e.indices.map(function(n){return n+t}))}function RJ(i,e){var t=dbe(e),n;try{for(t.s();!(n=t.n()).done;){var r=n.value;i.push(r)}}catch(s){t.e(s)}finally{t.f()}}function $B(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=(90-i)*Math.PI/180,r=(90-e)*Math.PI/180;return[t*Math.sin(n)*Math.cos(r),t*Math.cos(n),t*Math.sin(n)*Math.sin(r)]}var yw={};ehe(yw,{computeMikkTSpaceTangents:()=>bbe,computeMorphedAttributes:()=>Ibe,deepCloneAttribute:()=>Sbe,deinterleaveAttribute:()=>$C,deinterleaveGeometry:()=>Ebe,estimateBytesUsed:()=>Mbe,interleaveAttributes:()=>Tbe,mergeAttributes:()=>eO,mergeGeometries:()=>wbe,mergeGroups:()=>Pbe,mergeVertices:()=>Cbe,toCreasedNormals:()=>Lbe,toTrianglesDrawMode:()=>Rbe});function bbe(i,e,t=!0){if(!e||!e.isReady)throw new Error("THREE.BufferGeometryUtils: Initialized MikkTSpace library required.");if(!i.hasAttribute("position")||!i.hasAttribute("normal")||!i.hasAttribute("uv"))throw new Error('THREE.BufferGeometryUtils: Tangents require "position", "normal", and "uv" attributes.');function n(o){if(o.normalized||o.isInterleavedBufferAttribute){let a=new Float32Array(o.count*o.itemSize);for(let l=0,c=0;l<o.count;l++)a[c++]=o.getX(l),a[c++]=o.getY(l),o.itemSize>2&&(a[c++]=o.getZ(l));return a}return o.array instanceof Float32Array?o.array:new Float32Array(o.array)}let r=i.index?i.toNonIndexed():i,s=e.generateTangents(n(r.attributes.position),n(r.attributes.normal),n(r.attributes.uv));if(t)for(let o=3;o<s.length;o+=4)s[o]*=-1;return r.setAttribute("tangent",new Hi(s,4)),i!==r&&i.copy(r),i}function wbe(i,e=!1){let t=i[0].index!==null,n=new Set(Object.keys(i[0].attributes)),r=new Set(Object.keys(i[0].morphAttributes)),s={},o={},a=i[0].morphTargetsRelative,l=new Xn,c=0;for(let u=0;u<i.length;++u){let f=i[u],d=0;if(t!==(f.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let A in f.attributes){if(!n.has(A))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+'. All geometries must have compatible attributes; make sure "'+A+'" attribute exists among all geometries, or in none of them.'),null;s[A]===void 0&&(s[A]=[]),s[A].push(f.attributes[A]),d++}if(d!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". Make sure all geometries have the same number of attributes."),null;if(a!==f.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let A in f.morphAttributes){if(!r.has(A))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". .morphAttributes must be consistent throughout all geometries."),null;o[A]===void 0&&(o[A]=[]),o[A].push(f.morphAttributes[A])}if(e){let A;if(t)A=f.index.count;else if(f.attributes.position!==void 0)A=f.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". The geometry must have either an index or a position attribute"),null;l.addGroup(c,A,u),c+=A}}if(t){let u=0,f=[];for(let d=0;d<i.length;++d){let A=i[d].index;for(let y=0;y<A.count;++y)f.push(A.getX(y)+u);u+=i[d].attributes.position.count}l.setIndex(f)}for(let u in s){let f=eO(s[u]);if(!f)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" attribute."),null;l.setAttribute(u,f)}for(let u in o){let f=o[u][0].length;if(f!==0){l.morphAttributes=l.morphAttributes||{},l.morphAttributes[u]=[];for(let d=0;d<f;++d){let A=[];for(let w=0;w<o[u].length;++w)A.push(o[u][w][d]);let y=eO(A);if(!y)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" morphAttribute."),null;l.morphAttributes[u].push(y)}}}return l}function eO(i){let e,t,n,r=-1,s=0;for(let c=0;c<i.length;++c){let u=i[c];if(e===void 0&&(e=u.array.constructor),e!==u.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(t===void 0&&(t=u.itemSize),t!==u.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(n===void 0&&(n=u.normalized),n!==u.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(r===-1&&(r=u.gpuType),r!==u.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;s+=u.count*t}let o=new e(s),a=new Hi(o,t,n),l=0;for(let c=0;c<i.length;++c){let u=i[c];if(u.isInterleavedBufferAttribute){let f=l/t;for(let d=0,A=u.count;d<A;d++)for(let y=0;y<t;y++){let w=u.getComponent(d,y);a.setComponent(d+f,y,w)}}else o.set(u.array,l);l+=u.count*t}return r!==void 0&&(a.gpuType=r),a}function Sbe(i){return i.isInstancedInterleavedBufferAttribute||i.isInterleavedBufferAttribute?$C(i):i.isInstancedBufferAttribute?new Kl().copy(i):new Hi().copy(i)}function Tbe(i){let e,t=0,n=0;for(let c=0,u=i.length;c<u;++c){let f=i[c];if(e===void 0&&(e=f.array.constructor),e!==f.array.constructor)return console.error("AttributeBuffers of different types cannot be interleaved"),null;t+=f.array.length,n+=f.itemSize}let r=new Pd(new e(t),n),s=0,o=[],a=["getX","getY","getZ","getW"],l=["setX","setY","setZ","setW"];for(let c=0,u=i.length;c<u;c++){let f=i[c],d=f.itemSize,A=f.count,y=new zo(r,d,s,f.normalized);o.push(y),s+=d;for(let w=0;w<A;w++)for(let S=0;S<d;S++)y[l[S]](w,f[a[S]](w))}return o}function $C(i){let e=i.data.array.constructor,t=i.count,n=i.itemSize,r=i.normalized,s=new e(t*n),o;i.isInstancedInterleavedBufferAttribute?o=new Kl(s,n,r,i.meshPerAttribute):o=new Hi(s,n,r);for(let a=0;a<t;a++)o.setX(a,i.getX(a)),n>=2&&o.setY(a,i.getY(a)),n>=3&&o.setZ(a,i.getZ(a)),n>=4&&o.setW(a,i.getW(a));return o}function Ebe(i){let e=i.attributes,t=i.morphTargets,n=new Map;for(let r in e){let s=e[r];s.isInterleavedBufferAttribute&&(n.has(s)||n.set(s,$C(s)),e[r]=n.get(s))}for(let r in t){let s=t[r];s.isInterleavedBufferAttribute&&(n.has(s)||n.set(s,$C(s)),t[r]=n.get(s))}}function Mbe(i){let e=0;for(let n in i.attributes){let r=i.getAttribute(n);e+=r.count*r.itemSize*r.array.BYTES_PER_ELEMENT}let t=i.getIndex();return e+=t?t.count*t.itemSize*t.array.BYTES_PER_ELEMENT:0,e}function Cbe(i,e=1e-4){e=Math.max(e,Number.EPSILON);let t={},n=i.getIndex(),r=i.getAttribute("position"),s=n?n.count:r.count,o=0,a=Object.keys(i.attributes),l={},c={},u=[],f=["getX","getY","getZ","getW"],d=["setX","setY","setZ","setW"];for(let R=0,P=a.length;R<P;R++){let I=a[R],F=i.attributes[I];l[I]=new F.constructor(new F.array.constructor(F.count*F.itemSize),F.itemSize,F.normalized);let D=i.morphAttributes[I];D&&(c[I]||(c[I]=[]),D.forEach((L,C)=>{let B=new L.array.constructor(L.count*L.itemSize);c[I][C]=new L.constructor(B,L.itemSize,L.normalized)}))}let A=e*.5,y=Math.log10(1/e),w=Math.pow(10,y),S=A*w;for(let R=0;R<s;R++){let P=n?n.getX(R):R,I="";for(let F=0,D=a.length;F<D;F++){let L=a[F],C=i.getAttribute(L),B=C.itemSize;for(let k=0;k<B;k++)I+=`${~~(C[f[k]](P)*w+S)},`}if(I in t)u.push(t[I]);else{for(let F=0,D=a.length;F<D;F++){let L=a[F],C=i.getAttribute(L),B=i.morphAttributes[L],k=C.itemSize,z=l[L],G=c[L];for(let W=0;W<k;W++){let Y=f[W],H=d[W];if(z[H](o,C[Y](P)),B)for(let $=0,J=B.length;$<J;$++)G[$][H](o,B[$][Y](P))}}t[I]=o,u.push(o),o++}}let T=i.clone();for(let R in i.attributes){let P=l[R];if(T.setAttribute(R,new P.constructor(P.array.slice(0,o*P.itemSize),P.itemSize,P.normalized)),R in c)for(let I=0;I<c[R].length;I++){let F=c[R][I];T.morphAttributes[R][I]=new F.constructor(F.array.slice(0,o*F.itemSize),F.itemSize,F.normalized)}}return T.setIndex(u),T}function Rbe(i,e){if(e===k8)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),i;if(e===FM||e===z8){let t=i.getIndex();if(t===null){let o=[],a=i.getAttribute("position");if(a!==void 0){for(let l=0;l<a.count;l++)o.push(l);i.setIndex(o),t=i.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),i}let n=t.count-2,r=[];if(e===FM)for(let o=1;o<=n;o++)r.push(t.getX(0)),r.push(t.getX(o)),r.push(t.getX(o+1));else for(let o=0;o<n;o++)o%2===0?(r.push(t.getX(o)),r.push(t.getX(o+1)),r.push(t.getX(o+2))):(r.push(t.getX(o+2)),r.push(t.getX(o+1)),r.push(t.getX(o)));r.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");let s=i.clone();return s.setIndex(r),s.clearGroups(),s}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),i}function Ibe(i){let e=new re,t=new re,n=new re,r=new re,s=new re,o=new re,a=new re,l=new re,c=new re;function u(ce,he,ve,Re,Qe,Fe,mt,Ee){e.fromBufferAttribute(he,Qe),t.fromBufferAttribute(he,Fe),n.fromBufferAttribute(he,mt);let Ve=ce.morphTargetInfluences;if(ve&&Ve){a.set(0,0,0),l.set(0,0,0),c.set(0,0,0);for(let Ye=0,Mt=ve.length;Ye<Mt;Ye++){let Et=Ve[Ye],It=ve[Ye];Et!==0&&(r.fromBufferAttribute(It,Qe),s.fromBufferAttribute(It,Fe),o.fromBufferAttribute(It,mt),Re?(a.addScaledVector(r,Et),l.addScaledVector(s,Et),c.addScaledVector(o,Et)):(a.addScaledVector(r.sub(e),Et),l.addScaledVector(s.sub(t),Et),c.addScaledVector(o.sub(n),Et)))}e.add(a),t.add(l),n.add(c)}ce.isSkinnedMesh&&(ce.applyBoneTransform(Qe,e),ce.applyBoneTransform(Fe,t),ce.applyBoneTransform(mt,n)),Ee[Qe*3+0]=e.x,Ee[Qe*3+1]=e.y,Ee[Qe*3+2]=e.z,Ee[Fe*3+0]=t.x,Ee[Fe*3+1]=t.y,Ee[Fe*3+2]=t.z,Ee[mt*3+0]=n.x,Ee[mt*3+1]=n.y,Ee[mt*3+2]=n.z}let f=i.geometry,d=i.material,A,y,w,S=f.index,T=f.attributes.position,R=f.morphAttributes.position,P=f.morphTargetsRelative,I=f.attributes.normal,F=f.morphAttributes.normal,D=f.groups,L=f.drawRange,C,B,k,z,G,W,Y,H=new Float32Array(T.count*T.itemSize),$=new Float32Array(I.count*I.itemSize);if(S!==null)if(Array.isArray(d))for(C=0,k=D.length;C<k;C++)for(G=D[C],W=Math.max(G.start,L.start),Y=Math.min(G.start+G.count,L.start+L.count),B=W,z=Y;B<z;B+=3)A=S.getX(B),y=S.getX(B+1),w=S.getX(B+2),u(i,T,R,P,A,y,w,H),u(i,I,F,P,A,y,w,$);else for(W=Math.max(0,L.start),Y=Math.min(S.count,L.start+L.count),C=W,k=Y;C<k;C+=3)A=S.getX(C),y=S.getX(C+1),w=S.getX(C+2),u(i,T,R,P,A,y,w,H),u(i,I,F,P,A,y,w,$);else if(Array.isArray(d))for(C=0,k=D.length;C<k;C++)for(G=D[C],W=Math.max(G.start,L.start),Y=Math.min(G.start+G.count,L.start+L.count),B=W,z=Y;B<z;B+=3)A=B,y=B+1,w=B+2,u(i,T,R,P,A,y,w,H),u(i,I,F,P,A,y,w,$);else for(W=Math.max(0,L.start),Y=Math.min(T.count,L.start+L.count),C=W,k=Y;C<k;C+=3)A=C,y=C+1,w=C+2,u(i,T,R,P,A,y,w,H),u(i,I,F,P,A,y,w,$);let J=new Ln(H,3),te=new Ln($,3);return{positionAttribute:T,normalAttribute:I,morphedPositionAttribute:J,morphedNormalAttribute:te}}function Pbe(i){if(i.groups.length===0)return console.warn("THREE.BufferGeometryUtils.mergeGroups(): No groups are defined. Nothing to merge."),i;let e=i.groups;if(e=e.sort((o,a)=>o.materialIndex!==a.materialIndex?o.materialIndex-a.materialIndex:o.start-a.start),i.getIndex()===null){let o=i.getAttribute("position"),a=[];for(let l=0;l<o.count;l+=3)a.push(l,l+1,l+2);i.setIndex(a)}let t=i.getIndex(),n=[];for(let o=0;o<e.length;o++){let a=e[o],l=a.start,c=l+a.count;for(let u=l;u<c;u++)n.push(t.getX(u))}i.dispose(),i.setIndex(n);let r=0;for(let o=0;o<e.length;o++){let a=e[o];a.start=r,r+=a.count}let s=e[0];i.groups=[s];for(let o=1;o<e.length;o++){let a=e[o];s.materialIndex===a.materialIndex?s.count+=a.count:(s=a,i.groups.push(s))}return i}function Lbe(i,e=Math.PI/3){let t=i.index?i.toNonIndexed():i,n=t.attributes.position,r=n.count,s;if(n.isBufferAttribute===!0&&n.itemSize===3&&n.normalized===!1)s=n.array;else{s=new Float64Array(r*3);for(let I=0;I<r;I++)s[3*I+0]=n.getX(I),s[3*I+1]=n.getY(I),s[3*I+2]=n.getZ(I)}let o=Math.cos(e),a=(1+1e-10)*100,l=r/3,c=new Float64Array(l*3);for(let I=0;I<l;I++){let F=9*I,D=s[F+0],L=s[F+1],C=s[F+2],B=s[F+3],k=s[F+4],z=s[F+5],G=s[F+6],W=s[F+7],Y=s[F+8],H=G-B,$=W-k,J=Y-z,te=D-B,ce=L-k,he=C-z,ve=$*he-J*ce,Re=J*te-H*he,Qe=H*ce-$*te,Fe=1/(Math.sqrt(ve*ve+Re*Re+Qe*Qe)||1);c[3*I+0]=ve*Fe,c[3*I+1]=Re*Fe,c[3*I+2]=Qe*Fe}let u=new Int32Array(r),f=new Int32Array(r*3),d=1;for(;d<r*2;)d<<=1;let A=d-1,y=new Int32Array(d),w=0;for(let I=0;I<r;I++){let F=3*I,D=~~(s[F+0]*a),L=~~(s[F+1]*a),C=~~(s[F+2]*a),B=(Math.imul(D,73856093)^Math.imul(L,19349663)^Math.imul(C,83492791))&A;for(;;){let k=y[B];if(k===0){let G=3*w;f[G+0]=D,f[G+1]=L,f[G+2]=C,y[B]=w+1,u[I]=w++;break}let z=3*(k-1);if(f[z+0]===D&&f[z+1]===L&&f[z+2]===C){u[I]=k-1;break}B=B+1&A}}let S=new Int32Array(w+1);for(let I=0;I<r;I++)S[u[I]+1]++;for(let I=0;I<w;I++)S[I+1]+=S[I];let T=new Int32Array(r),R=S.slice(0,w);for(let I=0;I<l;I++){let F=3*I;T[R[u[F+0]]++]=I,T[R[u[F+1]]++]=I,T[R[u[F+2]]++]=I}let P=new Float32Array(r*3);for(let I=0;I<l;I++){let F=3*I,D=c[F+0],L=c[F+1],C=c[F+2];for(let B=0;B<3;B++){let k=F+B,z=u[k],G=0,W=0,Y=0;for(let $=S[z],J=S[z+1];$<J;$++){let te=3*T[$],ce=c[te+0],he=c[te+1],ve=c[te+2];D*ce+L*he+C*ve>o&&(G+=ce,W+=he,Y+=ve)}let H=1/(Math.sqrt(G*G+W*W+Y*Y)||1);P[3*k+0]=G*H,P[3*k+1]=W*H,P[3*k+2]=Y*H}}return t.setAttribute("normal",new Hi(P,3,!1)),t}var st=(function(i){return typeof i=="function"?i:typeof i=="string"?function(e){return e[i]}:function(e){return i}});function YC(i){"@babel/helpers - typeof";return YC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},YC(i)}var Dbe=/^\s+/,Nbe=/\s+$/;function An(i,e){if(i=i||"",e=e||{},i instanceof An)return i;if(!(this instanceof An))return new An(i,e);var t=Fbe(i);this._originalInput=i,this._r=t.r,this._g=t.g,this._b=t.b,this._a=t.a,this._roundA=Math.round(100*this._a)/100,this._format=e.format||t.format,this._gradientType=e.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=t.ok}An.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var e=this.toRgb();return(e.r*299+e.g*587+e.b*114)/1e3},getLuminance:function(){var e=this.toRgb(),t,n,r,s,o,a;return t=e.r/255,n=e.g/255,r=e.b/255,t<=.03928?s=t/12.92:s=Math.pow((t+.055)/1.055,2.4),n<=.03928?o=n/12.92:o=Math.pow((n+.055)/1.055,2.4),r<=.03928?a=r/12.92:a=Math.pow((r+.055)/1.055,2.4),.2126*s+.7152*o+.0722*a},setAlpha:function(e){return this._a=OJ(e),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var e=LJ(this._r,this._g,this._b);return{h:e.h*360,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=LJ(this._r,this._g,this._b),t=Math.round(e.h*360),n=Math.round(e.s*100),r=Math.round(e.v*100);return this._a==1?"hsv("+t+", "+n+"%, "+r+"%)":"hsva("+t+", "+n+"%, "+r+"%, "+this._roundA+")"},toHsl:function(){var e=PJ(this._r,this._g,this._b);return{h:e.h*360,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=PJ(this._r,this._g,this._b),t=Math.round(e.h*360),n=Math.round(e.s*100),r=Math.round(e.l*100);return this._a==1?"hsl("+t+", "+n+"%, "+r+"%)":"hsla("+t+", "+n+"%, "+r+"%, "+this._roundA+")"},toHex:function(e){return DJ(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){return kbe(this._r,this._g,this._b,this._a,e)},toHex8String:function(e){return"#"+this.toHex8(e)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(Ur(this._r,255)*100)+"%",g:Math.round(Ur(this._g,255)*100)+"%",b:Math.round(Ur(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(Ur(this._r,255)*100)+"%, "+Math.round(Ur(this._g,255)*100)+"%, "+Math.round(Ur(this._b,255)*100)+"%)":"rgba("+Math.round(Ur(this._r,255)*100)+"%, "+Math.round(Ur(this._g,255)*100)+"%, "+Math.round(Ur(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:Kbe[DJ(this._r,this._g,this._b,!0)]||!1},toFilter:function(e){var t="#"+NJ(this._r,this._g,this._b,this._a),n=t,r=this._gradientType?"GradientType = 1, ":"";if(e){var s=An(e);n="#"+NJ(s._r,s._g,s._b,s._a)}return"progid:DXImageTransform.Microsoft.gradient("+r+"startColorstr="+t+",endColorstr="+n+")"},toString:function(e){var t=!!e;e=e||this._format;var n=!1,r=this._a<1&&this._a>=0,s=!t&&r&&(e==="hex"||e==="hex6"||e==="hex3"||e==="hex4"||e==="hex8"||e==="name");return s?e==="name"&&this._a===0?this.toName():this.toRgbString():(e==="rgb"&&(n=this.toRgbString()),e==="prgb"&&(n=this.toPercentageRgbString()),(e==="hex"||e==="hex6")&&(n=this.toHexString()),e==="hex3"&&(n=this.toHexString(!0)),e==="hex4"&&(n=this.toHex8String(!0)),e==="hex8"&&(n=this.toHex8String()),e==="name"&&(n=this.toName()),e==="hsl"&&(n=this.toHslString()),e==="hsv"&&(n=this.toHsvString()),n||this.toHexString())},clone:function(){return An(this.toString())},_applyModification:function(e,t){var n=e.apply(null,[this].concat([].slice.call(t)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(qbe,arguments)},brighten:function(){return this._applyModification(Hbe,arguments)},darken:function(){return this._applyModification(Wbe,arguments)},desaturate:function(){return this._applyModification(zbe,arguments)},saturate:function(){return this._applyModification(Vbe,arguments)},greyscale:function(){return this._applyModification(Gbe,arguments)},spin:function(){return this._applyModification(jbe,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(Ybe,arguments)},complement:function(){return this._applyCombination(Xbe,arguments)},monochromatic:function(){return this._applyCombination(Zbe,arguments)},splitcomplement:function(){return this._applyCombination($be,arguments)},triad:function(){return this._applyCombination(FJ,[3])},tetrad:function(){return this._applyCombination(FJ,[4])}};An.fromRatio=function(i,e){if(YC(i)=="object"){var t={};for(var n in i)i.hasOwnProperty(n)&&(n==="a"?t[n]=i[n]:t[n]=bw(i[n]));i=t}return An(i,e)};function Fbe(i){var e={r:0,g:0,b:0},t=1,n=null,r=null,s=null,o=!1,a=!1;return typeof i=="string"&&(i=twe(i)),YC(i)=="object"&&(qd(i.r)&&qd(i.g)&&qd(i.b)?(e=Bbe(i.r,i.g,i.b),o=!0,a=String(i.r).substr(-1)==="%"?"prgb":"rgb"):qd(i.h)&&qd(i.s)&&qd(i.v)?(n=bw(i.s),r=bw(i.v),e=Ube(i.h,n,r),o=!0,a="hsv"):qd(i.h)&&qd(i.s)&&qd(i.l)&&(n=bw(i.s),s=bw(i.l),e=Obe(i.h,n,s),o=!0,a="hsl"),i.hasOwnProperty("a")&&(t=i.a)),t=OJ(t),{ok:o,format:i.format||a,r:Math.min(255,Math.max(e.r,0)),g:Math.min(255,Math.max(e.g,0)),b:Math.min(255,Math.max(e.b,0)),a:t}}function Bbe(i,e,t){return{r:Ur(i,255)*255,g:Ur(e,255)*255,b:Ur(t,255)*255}}function PJ(i,e,t){i=Ur(i,255),e=Ur(e,255),t=Ur(t,255);var n=Math.max(i,e,t),r=Math.min(i,e,t),s,o,a=(n+r)/2;if(n==r)s=o=0;else{var l=n-r;switch(o=a>.5?l/(2-n-r):l/(n+r),n){case i:s=(e-t)/l+(e<t?6:0);break;case e:s=(t-i)/l+2;break;case t:s=(i-e)/l+4;break}s/=6}return{h:s,s:o,l:a}}function Obe(i,e,t){var n,r,s;i=Ur(i,360),e=Ur(e,100),t=Ur(t,100);function o(c,u,f){return f<0&&(f+=1),f>1&&(f-=1),f<1/6?c+(u-c)*6*f:f<1/2?u:f<2/3?c+(u-c)*(2/3-f)*6:c}if(e===0)n=r=s=t;else{var a=t<.5?t*(1+e):t+e-t*e,l=2*t-a;n=o(l,a,i+1/3),r=o(l,a,i),s=o(l,a,i-1/3)}return{r:n*255,g:r*255,b:s*255}}function LJ(i,e,t){i=Ur(i,255),e=Ur(e,255),t=Ur(t,255);var n=Math.max(i,e,t),r=Math.min(i,e,t),s,o,a=n,l=n-r;if(o=n===0?0:l/n,n==r)s=0;else{switch(n){case i:s=(e-t)/l+(e<t?6:0);break;case e:s=(t-i)/l+2;break;case t:s=(i-e)/l+4;break}s/=6}return{h:s,s:o,v:a}}function Ube(i,e,t){i=Ur(i,360)*6,e=Ur(e,100),t=Ur(t,100);var n=Math.floor(i),r=i-n,s=t*(1-e),o=t*(1-r*e),a=t*(1-(1-r)*e),l=n%6,c=[t,o,s,s,a,t][l],u=[a,t,t,o,s,s][l],f=[s,s,a,t,t,o][l];return{r:c*255,g:u*255,b:f*255}}function DJ(i,e,t,n){var r=[Vu(Math.round(i).toString(16)),Vu(Math.round(e).toString(16)),Vu(Math.round(t).toString(16))];return n&&r[0].charAt(0)==r[0].charAt(1)&&r[1].charAt(0)==r[1].charAt(1)&&r[2].charAt(0)==r[2].charAt(1)?r[0].charAt(0)+r[1].charAt(0)+r[2].charAt(0):r.join("")}function kbe(i,e,t,n,r){var s=[Vu(Math.round(i).toString(16)),Vu(Math.round(e).toString(16)),Vu(Math.round(t).toString(16)),Vu(UJ(n))];return r&&s[0].charAt(0)==s[0].charAt(1)&&s[1].charAt(0)==s[1].charAt(1)&&s[2].charAt(0)==s[2].charAt(1)&&s[3].charAt(0)==s[3].charAt(1)?s[0].charAt(0)+s[1].charAt(0)+s[2].charAt(0)+s[3].charAt(0):s.join("")}function NJ(i,e,t,n){var r=[Vu(UJ(n)),Vu(Math.round(i).toString(16)),Vu(Math.round(e).toString(16)),Vu(Math.round(t).toString(16))];return r.join("")}An.equals=function(i,e){return!i||!e?!1:An(i).toRgbString()==An(e).toRgbString()};An.random=function(){return An.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function zbe(i,e){e=e===0?0:e||10;var t=An(i).toHsl();return t.s-=e/100,t.s=ZC(t.s),An(t)}function Vbe(i,e){e=e===0?0:e||10;var t=An(i).toHsl();return t.s+=e/100,t.s=ZC(t.s),An(t)}function Gbe(i){return An(i).desaturate(100)}function qbe(i,e){e=e===0?0:e||10;var t=An(i).toHsl();return t.l+=e/100,t.l=ZC(t.l),An(t)}function Hbe(i,e){e=e===0?0:e||10;var t=An(i).toRgb();return t.r=Math.max(0,Math.min(255,t.r-Math.round(255*-(e/100)))),t.g=Math.max(0,Math.min(255,t.g-Math.round(255*-(e/100)))),t.b=Math.max(0,Math.min(255,t.b-Math.round(255*-(e/100)))),An(t)}function Wbe(i,e){e=e===0?0:e||10;var t=An(i).toHsl();return t.l-=e/100,t.l=ZC(t.l),An(t)}function jbe(i,e){var t=An(i).toHsl(),n=(t.h+e)%360;return t.h=n<0?360+n:n,An(t)}function Xbe(i){var e=An(i).toHsl();return e.h=(e.h+180)%360,An(e)}function FJ(i,e){if(isNaN(e)||e<=0)throw new Error("Argument to polyad must be a positive number");for(var t=An(i).toHsl(),n=[An(i)],r=360/e,s=1;s<e;s++)n.push(An({h:(t.h+s*r)%360,s:t.s,l:t.l}));return n}function $be(i){var e=An(i).toHsl(),t=e.h;return[An(i),An({h:(t+72)%360,s:e.s,l:e.l}),An({h:(t+216)%360,s:e.s,l:e.l})]}function Ybe(i,e,t){e=e||6,t=t||30;var n=An(i).toHsl(),r=360/t,s=[An(i)];for(n.h=(n.h-(r*e>>1)+720)%360;--e;)n.h=(n.h+r)%360,s.push(An(n));return s}function Zbe(i,e){e=e||6;for(var t=An(i).toHsv(),n=t.h,r=t.s,s=t.v,o=[],a=1/e;e--;)o.push(An({h:n,s:r,v:s})),s=(s+a)%1;return o}An.mix=function(i,e,t){t=t===0?0:t||50;var n=An(i).toRgb(),r=An(e).toRgb(),s=t/100,o={r:(r.r-n.r)*s+n.r,g:(r.g-n.g)*s+n.g,b:(r.b-n.b)*s+n.b,a:(r.a-n.a)*s+n.a};return An(o)};An.readability=function(i,e){var t=An(i),n=An(e);return(Math.max(t.getLuminance(),n.getLuminance())+.05)/(Math.min(t.getLuminance(),n.getLuminance())+.05)};An.isReadable=function(i,e,t){var n=An.readability(i,e),r,s;switch(s=!1,r=nwe(t),r.level+r.size){case"AAsmall":case"AAAlarge":s=n>=4.5;break;case"AAlarge":s=n>=3;break;case"AAAsmall":s=n>=7;break}return s};An.mostReadable=function(i,e,t){var n=null,r=0,s,o,a,l;t=t||{},o=t.includeFallbackColors,a=t.level,l=t.size;for(var c=0;c<e.length;c++)s=An.readability(i,e[c]),s>r&&(r=s,n=An(e[c]));return An.isReadable(i,n,{level:a,size:l})||!o?n:(t.includeFallbackColors=!1,An.mostReadable(i,["#fff","#000"],t))};var tO=An.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},Kbe=An.hexNames=Qbe(tO);function Qbe(i){var e={};for(var t in i)i.hasOwnProperty(t)&&(e[i[t]]=t);return e}function OJ(i){return i=parseFloat(i),(isNaN(i)||i<0||i>1)&&(i=1),i}function Ur(i,e){Jbe(i)&&(i="100%");var t=ewe(i);return i=Math.min(e,Math.max(0,parseFloat(i))),t&&(i=parseInt(i*e,10)/100),Math.abs(i-e)<1e-6?1:i%e/parseFloat(e)}function ZC(i){return Math.min(1,Math.max(0,i))}function ic(i){return parseInt(i,16)}function Jbe(i){return typeof i=="string"&&i.indexOf(".")!=-1&&parseFloat(i)===1}function ewe(i){return typeof i=="string"&&i.indexOf("%")!=-1}function Vu(i){return i.length==1?"0"+i:""+i}function bw(i){return i<=1&&(i=i*100+"%"),i}function UJ(i){return Math.round(parseFloat(i)*255).toString(16)}function BJ(i){return ic(i)/255}var zu=(function(){var i="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",t="(?:"+e+")|(?:"+i+")",n="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?",r="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?";return{CSS_UNIT:new RegExp(t),rgb:new RegExp("rgb"+n),rgba:new RegExp("rgba"+r),hsl:new RegExp("hsl"+n),hsla:new RegExp("hsla"+r),hsv:new RegExp("hsv"+n),hsva:new RegExp("hsva"+r),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}})();function qd(i){return!!zu.CSS_UNIT.exec(i)}function twe(i){i=i.replace(Dbe,"").replace(Nbe,"").toLowerCase();var e=!1;if(tO[i])i=tO[i],e=!0;else if(i=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var t;return(t=zu.rgb.exec(i))?{r:t[1],g:t[2],b:t[3]}:(t=zu.rgba.exec(i))?{r:t[1],g:t[2],b:t[3],a:t[4]}:(t=zu.hsl.exec(i))?{h:t[1],s:t[2],l:t[3]}:(t=zu.hsla.exec(i))?{h:t[1],s:t[2],l:t[3],a:t[4]}:(t=zu.hsv.exec(i))?{h:t[1],s:t[2],v:t[3]}:(t=zu.hsva.exec(i))?{h:t[1],s:t[2],v:t[3],a:t[4]}:(t=zu.hex8.exec(i))?{r:ic(t[1]),g:ic(t[2]),b:ic(t[3]),a:BJ(t[4]),format:e?"name":"hex8"}:(t=zu.hex6.exec(i))?{r:ic(t[1]),g:ic(t[2]),b:ic(t[3]),format:e?"name":"hex"}:(t=zu.hex4.exec(i))?{r:ic(t[1]+""+t[1]),g:ic(t[2]+""+t[2]),b:ic(t[3]+""+t[3]),a:BJ(t[4]+""+t[4]),format:e?"name":"hex8"}:(t=zu.hex3.exec(i))?{r:ic(t[1]+""+t[1]),g:ic(t[2]+""+t[2]),b:ic(t[3]+""+t[3]),format:e?"name":"hex"}:!1}function nwe(i){var e,t;return i=i||{level:"AA",size:"small"},e=(i.level||"AA").toUpperCase(),t=(i.size||"small").toLowerCase(),e!=="AA"&&e!=="AAA"&&(e="AA"),t!=="small"&&t!=="large"&&(t="small"),{level:e,size:t}}function sO(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function iwe(i){if(Array.isArray(i))return i}function rwe(i){if(Array.isArray(i))return sO(i)}function kJ(i,e,t){if(typeof i=="function"?i===e:i.has(e))return arguments.length<3?e:t;throw new TypeError("Private element is not present on this object")}function swe(i,e){if(e.has(i))throw new TypeError("Cannot initialize the same private elements twice on an object")}function owe(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function da(i,e){return i.get(kJ(i,e))}function P_(i,e,t){swe(i,e),e.set(i,t)}function KC(i,e,t){return i.set(kJ(i,e),t),t}function awe(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,Awe(n.key),n)}}function lwe(i,e,t){return e&&awe(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function cwe(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function uwe(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function hwe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.4124-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function fwe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.4125-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function dwe(i,e){return iwe(i)||uwe(i,e)||zJ(i,e)||hwe()}function pwe(i){return rwe(i)||cwe(i)||zJ(i)||fwe()}function mwe(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(i)}function Awe(i){var e=mwe(i,"string");return typeof e=="symbol"?e:e+""}function zJ(i,e){if(i){if(typeof i=="string")return sO(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?sO(i,e):void 0}}var L_=new WeakMap,ww=new WeakMap,D_=new WeakMap,nO=new WeakMap,iO=new WeakMap,rO=new WeakMap,VJ=(function(){function i(){owe(this,i),P_(this,L_,new Map),P_(this,ww,new Map),P_(this,D_,function(e){return e}),P_(this,nO,function(){return{}}),P_(this,iO,function(){}),P_(this,rO,function(){})}return lwe(i,[{key:"getObj",value:function(t){return da(L_,this).get(da(D_,this).call(this,t))}},{key:"getData",value:function(t){return da(ww,this).get(t)}},{key:"entries",value:function(){return pwe(da(ww,this).entries()).map(function(t){var n=dwe(t,2),r=n[0],s=n[1];return[s,r]})}},{key:"id",value:function(t){return KC(D_,this,st(t)),this}},{key:"onCreateObj",value:function(t){return KC(nO,this,t),this}},{key:"onUpdateObj",value:function(t){return KC(iO,this,t),this}},{key:"onRemoveObj",value:function(t){return KC(rO,this,t),this}},{key:"digest",value:function(t){var n=this;t.filter(function(s){return!da(L_,n).has(da(D_,n).call(n,s))}).forEach(function(s){var o=da(nO,n).call(n,s);da(L_,n).set(da(D_,n).call(n,s),o),da(ww,n).set(o,s)});var r=new Map(t.map(function(s){return[da(D_,n).call(n,s),s]}));return da(L_,this).forEach(function(s,o){r.has(o)?da(iO,n).call(n,s,r.get(o)):(da(rO,n).call(n,s,o),da(L_,n).delete(o),da(ww,n).delete(s))}),this}},{key:"clear",value:function(){return this.digest([]),this}}])})();var g1=Eq(GJ(),1);var Ei=11102230246251565e-32,$s=134217729,Tw=(3+8*Ei)*Ei;function Dg(i,e,t,n,r){let s,o,a,l,c=e[0],u=n[0],f=0,d=0;u>c==u>-c?(s=c,c=e[++f]):(s=u,u=n[++d]);let A=0;if(f<i&&d<t)for(u>c==u>-c?(o=c+s,a=s-(o-c),c=e[++f]):(o=u+s,a=s-(o-u),u=n[++d]),s=o,a!==0&&(r[A++]=a);f<i&&d<t;)u>c==u>-c?(o=s+c,l=o-s,a=s-(o-l)+(c-l),c=e[++f]):(o=s+u,l=o-s,a=s-(o-l)+(u-l),u=n[++d]),s=o,a!==0&&(r[A++]=a);for(;f<i;)o=s+c,l=o-s,a=s-(o-l)+(c-l),c=e[++f],s=o,a!==0&&(r[A++]=a);for(;d<t;)o=s+u,l=o-s,a=s-(o-l)+(u-l),u=n[++d],s=o,a!==0&&(r[A++]=a);return(s!==0||A===0)&&(r[A++]=s),A}function Ew(i,e){let t=e[0];for(let n=1;n<i;n++)t+=e[n];return t}function ht(i){return new Float64Array(i)}var gwe=(3+16*Ei)*Ei,vwe=(2+12*Ei)*Ei,_we=(9+64*Ei)*Ei*Ei,N_=ht(4),qJ=ht(8),HJ=ht(12),WJ=ht(16),Xa=ht(4);function xwe(i,e,t,n,r,s,o){let a,l,c,u,f,d,A,y,w,S,T,R,P,I,F,D,L,C,B=i-r,k=t-r,z=e-s,G=n-s;I=B*G,d=$s*B,A=d-(d-B),y=B-A,d=$s*G,w=d-(d-G),S=G-w,F=y*S-(I-A*w-y*w-A*S),D=z*k,d=$s*z,A=d-(d-z),y=z-A,d=$s*k,w=d-(d-k),S=k-w,L=y*S-(D-A*w-y*w-A*S),T=F-L,f=F-T,N_[0]=F-(T+f)+(f-L),R=I+T,f=R-I,P=I-(R-f)+(T-f),T=P-D,f=P-T,N_[1]=P-(T+f)+(f-D),C=R+T,f=C-R,N_[2]=R-(C-f)+(T-f),N_[3]=C;let W=Ew(4,N_),Y=vwe*o;if(W>=Y||-W>=Y||(f=i-B,a=i-(B+f)+(f-r),f=t-k,c=t-(k+f)+(f-r),f=e-z,l=e-(z+f)+(f-s),f=n-G,u=n-(G+f)+(f-s),a===0&&l===0&&c===0&&u===0)||(Y=_we*o+Tw*Math.abs(W),W+=B*u+G*a-(z*c+k*l),W>=Y||-W>=Y))return W;I=a*G,d=$s*a,A=d-(d-a),y=a-A,d=$s*G,w=d-(d-G),S=G-w,F=y*S-(I-A*w-y*w-A*S),D=l*k,d=$s*l,A=d-(d-l),y=l-A,d=$s*k,w=d-(d-k),S=k-w,L=y*S-(D-A*w-y*w-A*S),T=F-L,f=F-T,Xa[0]=F-(T+f)+(f-L),R=I+T,f=R-I,P=I-(R-f)+(T-f),T=P-D,f=P-T,Xa[1]=P-(T+f)+(f-D),C=R+T,f=C-R,Xa[2]=R-(C-f)+(T-f),Xa[3]=C;let H=Dg(4,N_,4,Xa,qJ);I=B*u,d=$s*B,A=d-(d-B),y=B-A,d=$s*u,w=d-(d-u),S=u-w,F=y*S-(I-A*w-y*w-A*S),D=z*c,d=$s*z,A=d-(d-z),y=z-A,d=$s*c,w=d-(d-c),S=c-w,L=y*S-(D-A*w-y*w-A*S),T=F-L,f=F-T,Xa[0]=F-(T+f)+(f-L),R=I+T,f=R-I,P=I-(R-f)+(T-f),T=P-D,f=P-T,Xa[1]=P-(T+f)+(f-D),C=R+T,f=C-R,Xa[2]=R-(C-f)+(T-f),Xa[3]=C;let $=Dg(H,qJ,4,Xa,HJ);I=a*u,d=$s*a,A=d-(d-a),y=a-A,d=$s*u,w=d-(d-u),S=u-w,F=y*S-(I-A*w-y*w-A*S),D=l*c,d=$s*l,A=d-(d-l),y=l-A,d=$s*c,w=d-(d-c),S=c-w,L=y*S-(D-A*w-y*w-A*S),T=F-L,f=F-T,Xa[0]=F-(T+f)+(f-L),R=I+T,f=R-I,P=I-(R-f)+(T-f),T=P-D,f=P-T,Xa[1]=P-(T+f)+(f-D),C=R+T,f=C-R,Xa[2]=R-(C-f)+(T-f),Xa[3]=C;let J=Dg($,HJ,4,Xa,WJ);return WJ[J-1]}function J0(i,e,t,n,r,s){let o=(e-s)*(t-r),a=(i-r)*(n-s),l=o-a,c=Math.abs(o+a);return Math.abs(l)>=gwe*c?l:-xwe(i,e,t,n,r,s,c)}var Urt=(7+56*Ei)*Ei,krt=(3+28*Ei)*Ei,zrt=(26+288*Ei)*Ei*Ei,Vrt=ht(4),Grt=ht(4),qrt=ht(4),Hrt=ht(4),Wrt=ht(4),jrt=ht(4),Xrt=ht(4),$rt=ht(4),Yrt=ht(4),Zrt=ht(8),Krt=ht(8),Qrt=ht(8),Jrt=ht(4),est=ht(8),tst=ht(8),nst=ht(16),ist=ht(12),rst=ht(192),sst=ht(192);var lst=(10+96*Ei)*Ei,cst=(4+48*Ei)*Ei,ust=(44+576*Ei)*Ei*Ei,hst=ht(4),fst=ht(4),dst=ht(4),pst=ht(4),mst=ht(4),Ast=ht(4),gst=ht(4),vst=ht(4),_st=ht(8),xst=ht(8),yst=ht(8),bst=ht(8),wst=ht(8),Sst=ht(8),Tst=ht(8),Est=ht(8),Mst=ht(8),Cst=ht(4),Rst=ht(4),Ist=ht(4),Pst=ht(8),Lst=ht(16),Dst=ht(16),Nst=ht(16),Fst=ht(32),Bst=ht(32),Ost=ht(48),Ust=ht(64),kst=ht(1152),zst=ht(1152);var Hst=(16+224*Ei)*Ei,Wst=(5+72*Ei)*Ei,jst=(71+1408*Ei)*Ei*Ei,Xst=ht(4),$st=ht(4),Yst=ht(4),Zst=ht(4),Kst=ht(4),Qst=ht(4),Jst=ht(4),eot=ht(4),tot=ht(4),not=ht(4),iot=ht(24),rot=ht(24),sot=ht(24),oot=ht(24),aot=ht(24),lot=ht(24),cot=ht(24),uot=ht(24),hot=ht(24),fot=ht(24),dot=ht(1152),pot=ht(1152),mot=ht(1152),Aot=ht(1152),got=ht(1152),vot=ht(2304),_ot=ht(2304),xot=ht(3456),yot=ht(5760),bot=ht(8),wot=ht(8),Sot=ht(8),Tot=ht(16),Eot=ht(24),Mot=ht(48),Cot=ht(48),Rot=ht(96),Iot=ht(192),Pot=ht(384),Lot=ht(384),Dot=ht(384),Not=ht(768);var Fot=ht(96),Bot=ht(96),Oot=ht(96),Uot=ht(1152);var XJ=Math.pow(2,-52),QC=new Uint32Array(512),em=class i{static from(e,t=Ewe,n=Mwe){let r=e.length,s=new Float64Array(r*2);for(let o=0;o<r;o++){let a=e[o];s[2*o]=t(a),s[2*o+1]=n(a)}return new i(s)}constructor(e){let t=e.length>>1;if(t>0&&typeof e[0]!="number")throw new Error("Expected coords to contain numbers.");this.coords=e;let n=Math.max(2*t-5,0);this._triangles=new Uint32Array(n*3),this._halfedges=new Int32Array(n*3),this._hashSize=Math.ceil(Math.sqrt(t)),this._hullPrev=new Uint32Array(t),this._hullNext=new Uint32Array(t),this._hullTri=new Uint32Array(t),this._hullHash=new Int32Array(this._hashSize),this._ids=new Uint32Array(t),this._dists=new Float64Array(t),this.trianglesLen=0,this._cx=0,this._cy=0,this._hullStart=0,this.hull=this._triangles,this.triangles=this._triangles,this.halfedges=this._halfedges,this.update()}update(){let{coords:e,_hullPrev:t,_hullNext:n,_hullTri:r,_hullHash:s}=this,o=e.length>>1,a=1/0,l=1/0,c=-1/0,u=-1/0;for(let B=0;B<o;B++){let k=e[2*B],z=e[2*B+1];k<a&&(a=k),z<l&&(l=z),k>c&&(c=k),z>u&&(u=z),this._ids[B]=B}let f=(a+c)/2,d=(l+u)/2,A=0,y=0,w=0;for(let B=0,k=1/0;B<o;B++){let z=aO(f,d,e[2*B],e[2*B+1]);z<k&&(A=B,k=z)}let S=e[2*A],T=e[2*A+1];for(let B=0,k=1/0;B<o;B++){if(B===A)continue;let z=aO(S,T,e[2*B],e[2*B+1]);z<k&&z>0&&(y=B,k=z)}let R=e[2*y],P=e[2*y+1],I=1/0;for(let B=0;B<o;B++){if(B===A||B===y)continue;let k=Swe(S,T,R,P,e[2*B],e[2*B+1]);k<I&&(w=B,I=k)}let F=e[2*w],D=e[2*w+1];if(I===1/0){for(let z=0;z<o;z++)this._dists[z]=e[2*z]-e[0]||e[2*z+1]-e[1];F_(this._ids,this._dists,0,o-1);let B=new Uint32Array(o),k=0;for(let z=0,G=-1/0;z<o;z++){let W=this._ids[z],Y=this._dists[W];Y>G&&(B[k++]=W,G=Y)}this.hull=B.subarray(0,k),this.triangles=new Uint32Array(0),this.halfedges=new Int32Array(0);return}if(J0(S,T,R,P,F,D)<0){let B=y,k=R,z=P;y=w,R=F,P=D,w=B,F=k,D=z}let L=Twe(S,T,R,P,F,D);this._cx=L.x,this._cy=L.y;for(let B=0;B<o;B++)this._dists[B]=aO(e[2*B],e[2*B+1],L.x,L.y);F_(this._ids,this._dists,0,o-1),this._hullStart=A;let C=3;n[A]=t[w]=y,n[y]=t[A]=w,n[w]=t[y]=A,r[A]=0,r[y]=1,r[w]=2,s.fill(-1),s[this._hashKey(S,T)]=A,s[this._hashKey(R,P)]=y,s[this._hashKey(F,D)]=w,this.trianglesLen=0,this._addTriangle(A,y,w,-1,-1,-1);for(let B=0,k=0,z=0;B<this._ids.length;B++){let G=this._ids[B],W=e[2*G],Y=e[2*G+1];if(B>0&&Math.abs(W-k)<=XJ&&Math.abs(Y-z)<=XJ||(k=W,z=Y,G===A||G===y||G===w))continue;let H=0;for(let he=0,ve=this._hashKey(W,Y);he<this._hashSize&&(H=s[(ve+he)%this._hashSize],!(H!==-1&&H!==n[H]));he++);H=t[H];let $=H,J;for(;J=n[$],J0(W,Y,e[2*$],e[2*$+1],e[2*J],e[2*J+1])>=0;)if($=J,$===H){$=-1;break}if($===-1)continue;let te=this._addTriangle($,G,n[$],-1,-1,r[$]);r[G]=this._legalize(te+2),r[$]=te,C++;let ce=n[$];for(;J=n[ce],J0(W,Y,e[2*ce],e[2*ce+1],e[2*J],e[2*J+1])<0;)te=this._addTriangle(ce,G,J,r[G],-1,r[ce]),r[G]=this._legalize(te+2),n[ce]=ce,C--,ce=J;if($===H)for(;J=t[$],J0(W,Y,e[2*J],e[2*J+1],e[2*$],e[2*$+1])<0;)te=this._addTriangle(J,G,$,-1,r[$],r[J]),this._legalize(te+2),r[J]=te,n[$]=$,C--,$=J;this._hullStart=t[G]=$,n[$]=t[ce]=G,n[G]=ce,s[this._hashKey(W,Y)]=G,s[this._hashKey(e[2*$],e[2*$+1])]=$}this.hull=new Uint32Array(C);for(let B=0,k=this._hullStart;B<C;B++)this.hull[B]=k,k=n[k];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(e,t){return Math.floor(bwe(e-this._cx,t-this._cy)*this._hashSize)%this._hashSize}_legalize(e){let{_triangles:t,_halfedges:n,coords:r}=this,s=0,o=0;for(;;){let a=n[e],l=e-e%3;if(o=l+(e+2)%3,a===-1){if(s===0)break;e=QC[--s];continue}let c=a-a%3,u=l+(e+1)%3,f=c+(a+2)%3,d=t[o],A=t[e],y=t[u],w=t[f];if(wwe(r[2*d],r[2*d+1],r[2*A],r[2*A+1],r[2*y],r[2*y+1],r[2*w],r[2*w+1])){t[e]=w,t[a]=d;let T=n[f];if(T===-1){let P=this._hullStart;do{if(this._hullTri[P]===f){this._hullTri[P]=e;break}P=this._hullPrev[P]}while(P!==this._hullStart)}this._link(e,T),this._link(a,n[o]),this._link(o,f);let R=c+(a+1)%3;s<QC.length&&(QC[s++]=R)}else{if(s===0)break;e=QC[--s]}}return o}_link(e,t){this._halfedges[e]=t,t!==-1&&(this._halfedges[t]=e)}_addTriangle(e,t,n,r,s,o){let a=this.trianglesLen;return this._triangles[a]=e,this._triangles[a+1]=t,this._triangles[a+2]=n,this._link(a,r),this._link(a+1,s),this._link(a+2,o),this.trianglesLen+=3,a}};function bwe(i,e){let t=i/(Math.abs(i)+Math.abs(e));return(e>0?3-t:1+t)/4}function aO(i,e,t,n){let r=i-t,s=e-n;return r*r+s*s}function wwe(i,e,t,n,r,s,o,a){let l=i-o,c=e-a,u=t-o,f=n-a,d=r-o,A=s-a,y=l*l+c*c,w=u*u+f*f,S=d*d+A*A;return l*(f*S-w*A)-c*(u*S-w*d)+y*(u*A-f*d)<0}function Swe(i,e,t,n,r,s){let o=t-i,a=n-e,l=r-i,c=s-e,u=o*o+a*a,f=l*l+c*c,d=.5/(o*c-a*l),A=(c*u-a*f)*d,y=(o*f-l*u)*d;return A*A+y*y}function Twe(i,e,t,n,r,s){let o=t-i,a=n-e,l=r-i,c=s-e,u=o*o+a*a,f=l*l+c*c,d=.5/(o*c-a*l),A=i+(c*u-a*f)*d,y=e+(o*f-l*u)*d;return{x:A,y}}function F_(i,e,t,n){if(n-t<=20)for(let r=t+1;r<=n;r++){let s=i[r],o=e[s],a=r-1;for(;a>=t&&e[i[a]]>o;)i[a+1]=i[a--];i[a+1]=s}else{let r=t+n>>1,s=t+1,o=n;Mw(i,r,s),e[i[t]]>e[i[n]]&&Mw(i,t,n),e[i[s]]>e[i[n]]&&Mw(i,s,n),e[i[t]]>e[i[s]]&&Mw(i,t,s);let a=i[s],l=e[a];for(;;){do s++;while(e[i[s]]<l);do o--;while(e[i[o]]>l);if(o<s)break;Mw(i,s,o)}i[t+1]=i[o],i[o]=a,n-s+1>=o-t?(F_(i,e,s,n),F_(i,e,t,o-1)):(F_(i,e,t,o-1),F_(i,e,s,n))}}function Mw(i,e,t){let n=i[e];i[e]=i[t],i[t]=n}function Ewe(i){return i[0]}function Mwe(i){return i[1]}function $J(i,e){var t,n,r=0,s,o,a,l,c,u,f,d=i[0],A=i[1],y=e.length;for(t=0;t<y;t++){n=0;var w=e[t],S=w.length-1;if(u=w[0],u[0]!==w[S][0]&&u[1]!==w[S][1])throw new Error("First and last coordinates in a ring must be the same");for(o=u[0]-d,a=u[1]-A,n;n<S;n++){if(f=w[n+1],l=f[0]-d,c=f[1]-A,a===0&&c===0){if(l<=0&&o>=0||o<=0&&l>=0)return 0}else if(c>=0&&a<=0||c<=0&&a>=0){if(s=J0(o,l,a,c,0,0),s===0)return 0;(s>0&&c>0&&a<=0||s<0&&c<=0&&a>0)&&r++}u=f,a=c,o=l}}return r%2!==0}function YJ(i){if(!i)throw new Error("coord is required");if(!Array.isArray(i)){if(i.type==="Feature"&&i.geometry!==null&&i.geometry.type==="Point")return[...i.geometry.coordinates];if(i.type==="Point")return[...i.coordinates]}if(Array.isArray(i)&&i.length>=2&&!Array.isArray(i[0])&&!Array.isArray(i[1]))return[...i];throw new Error("coord must be GeoJSON Point or an Array of numbers")}function ZJ(i){return i.type==="Feature"?i.geometry:i}function Cwe(i,e,t={}){if(!i)throw new Error("point is required");if(!e)throw new Error("polygon is required");let n=YJ(i),r=ZJ(e),s=r.type,o=e.bbox,a=r.coordinates;if(o&&Rwe(n,o)===!1)return!1;s==="Polygon"&&(a=[a]);let l=!1;for(var c=0;c<a.length;++c){let u=$J(n,a[c]);if(u===0)return!t.ignoreBoundary;u&&(l=!0)}return l}function Rwe(i,e){return e[0]<=i[0]&&e[1]<=i[1]&&e[2]>=i[0]&&e[3]>=i[1]}var KJ=Cwe;var Zc=class{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(e,t){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(e,t){this._+=`L${this._x1=+e},${this._y1=+t}`}arc(e,t,n){e=+e,t=+t,n=+n;let r=e+n,s=t;if(n<0)throw new Error("negative radius");this._x1===null?this._+=`M${r},${s}`:(Math.abs(this._x1-r)>1e-6||Math.abs(this._y1-s)>1e-6)&&(this._+="L"+r+","+s),n&&(this._+=`A${n},${n},0,1,1,${e-n},${t}A${n},${n},0,1,1,${this._x1=r},${this._y1=s}`)}rect(e,t,n,r){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${+n}v${+r}h${-n}Z`}value(){return this._||null}};var tm=class{constructor(){this._=[]}moveTo(e,t){this._.push([e,t])}closePath(){this._.push(this._[0].slice())}lineTo(e,t){this._.push([e,t])}value(){return this._.length?this._:null}};var Cw=class{constructor(e,[t,n,r,s]=[0,0,960,500]){if(!((r=+r)>=(t=+t))||!((s=+s)>=(n=+n)))throw new Error("invalid bounds");this.delaunay=e,this._circumcenters=new Float64Array(e.points.length*2),this.vectors=new Float64Array(e.points.length*2),this.xmax=r,this.xmin=t,this.ymax=s,this.ymin=n,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){let{delaunay:{points:e,hull:t,triangles:n},vectors:r}=this,s,o,a=this.circumcenters=this._circumcenters.subarray(0,n.length/3*2);for(let w=0,S=0,T=n.length,R,P;w<T;w+=3,S+=2){let I=n[w]*2,F=n[w+1]*2,D=n[w+2]*2,L=e[I],C=e[I+1],B=e[F],k=e[F+1],z=e[D],G=e[D+1],W=B-L,Y=k-C,H=z-L,$=G-C,J=(W*$-Y*H)*2;if(Math.abs(J)<1e-9){if(s===void 0){s=o=0;for(let ce of t)s+=e[ce*2],o+=e[ce*2+1];s/=t.length,o/=t.length}let te=1e9*Math.sign((s-L)*$-(o-C)*H);R=(L+z)/2-te*$,P=(C+G)/2+te*H}else{let te=1/J,ce=W*W+Y*Y,he=H*H+$*$;R=L+($*ce-Y*he)*te,P=C+(W*he-H*ce)*te}a[S]=R,a[S+1]=P}let l=t[t.length-1],c,u=l*4,f,d=e[2*l],A,y=e[2*l+1];r.fill(0);for(let w=0;w<t.length;++w)l=t[w],c=u,f=d,A=y,u=l*4,d=e[2*l],y=e[2*l+1],r[c+2]=r[u]=A-y,r[c+3]=r[u+1]=d-f}render(e){let t=e==null?e=new Zc:void 0,{delaunay:{halfedges:n,inedges:r,hull:s},circumcenters:o,vectors:a}=this;if(s.length<=1)return null;for(let u=0,f=n.length;u<f;++u){let d=n[u];if(d<u)continue;let A=Math.floor(u/3)*2,y=Math.floor(d/3)*2,w=o[A],S=o[A+1],T=o[y],R=o[y+1];this._renderSegment(w,S,T,R,e)}let l,c=s[s.length-1];for(let u=0;u<s.length;++u){l=c,c=s[u];let f=Math.floor(r[c]/3)*2,d=o[f],A=o[f+1],y=l*4,w=this._project(d,A,a[y+2],a[y+3]);w&&this._renderSegment(d,A,w[0],w[1],e)}return t&&t.value()}renderBounds(e){let t=e==null?e=new Zc:void 0;return e.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),t&&t.value()}renderCell(e,t){let n=t==null?t=new Zc:void 0,r=this._clip(e);if(r===null||!r.length)return;t.moveTo(r[0],r[1]);let s=r.length;for(;r[0]===r[s-2]&&r[1]===r[s-1]&&s>1;)s-=2;for(let o=2;o<s;o+=2)(r[o]!==r[o-2]||r[o+1]!==r[o-1])&&t.lineTo(r[o],r[o+1]);return t.closePath(),n&&n.value()}*cellPolygons(){let{delaunay:{points:e}}=this;for(let t=0,n=e.length/2;t<n;++t){let r=this.cellPolygon(t);r&&(r.index=t,yield r)}}cellPolygon(e){let t=new tm;return this.renderCell(e,t),t.value()}_renderSegment(e,t,n,r,s){let o,a=this._regioncode(e,t),l=this._regioncode(n,r);a===0&&l===0?(s.moveTo(e,t),s.lineTo(n,r)):(o=this._clipSegment(e,t,n,r,a,l))&&(s.moveTo(o[0],o[1]),s.lineTo(o[2],o[3]))}contains(e,t,n){return t=+t,t!==t||(n=+n,n!==n)?!1:this.delaunay._step(e,t,n)===e}*neighbors(e){let t=this._clip(e);if(t)for(let n of this.delaunay.neighbors(e)){let r=this._clip(n);if(r){e:for(let s=0,o=t.length;s<o;s+=2)for(let a=0,l=r.length;a<l;a+=2)if(t[s]===r[a]&&t[s+1]===r[a+1]&&t[(s+2)%o]===r[(a+l-2)%l]&&t[(s+3)%o]===r[(a+l-1)%l]){yield n;break e}}}}_cell(e){let{circumcenters:t,delaunay:{inedges:n,halfedges:r,triangles:s}}=this,o=n[e];if(o===-1)return null;let a=[],l=o;do{let c=Math.floor(l/3);if(a.push(t[c*2],t[c*2+1]),l=l%3===2?l-2:l+1,s[l]!==e)break;l=r[l]}while(l!==o&&l!==-1);return a}_clip(e){if(e===0&&this.delaunay.hull.length===1)return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];let t=this._cell(e);if(t===null)return null;let{vectors:n}=this,r=e*4;return this._simplify(n[r]||n[r+1]?this._clipInfinite(e,t,n[r],n[r+1],n[r+2],n[r+3]):this._clipFinite(e,t))}_clipFinite(e,t){let n=t.length,r=null,s,o,a=t[n-2],l=t[n-1],c,u=this._regioncode(a,l),f,d=0;for(let A=0;A<n;A+=2)if(s=a,o=l,a=t[A],l=t[A+1],c=u,u=this._regioncode(a,l),c===0&&u===0)f=d,d=0,r?r.push(a,l):r=[a,l];else{let y,w,S,T,R;if(c===0){if((y=this._clipSegment(s,o,a,l,c,u))===null)continue;[w,S,T,R]=y}else{if((y=this._clipSegment(a,l,s,o,u,c))===null)continue;[T,R,w,S]=y,f=d,d=this._edgecode(w,S),f&&d&&this._edge(e,f,d,r,r.length),r?r.push(w,S):r=[w,S]}f=d,d=this._edgecode(T,R),f&&d&&this._edge(e,f,d,r,r.length),r?r.push(T,R):r=[T,R]}if(r)f=d,d=this._edgecode(r[0],r[1]),f&&d&&this._edge(e,f,d,r,r.length);else if(this.contains(e,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2))return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];return r}_clipSegment(e,t,n,r,s,o){let a=s<o;for(a&&([e,t,n,r,s,o]=[n,r,e,t,o,s]);;){if(s===0&&o===0)return a?[n,r,e,t]:[e,t,n,r];if(s&o)return null;let l,c,u=s||o;u&8?(l=e+(n-e)*(this.ymax-t)/(r-t),c=this.ymax):u&4?(l=e+(n-e)*(this.ymin-t)/(r-t),c=this.ymin):u&2?(c=t+(r-t)*(this.xmax-e)/(n-e),l=this.xmax):(c=t+(r-t)*(this.xmin-e)/(n-e),l=this.xmin),s?(e=l,t=c,s=this._regioncode(e,t)):(n=l,r=c,o=this._regioncode(n,r))}}_clipInfinite(e,t,n,r,s,o){let a=Array.from(t),l;if((l=this._project(a[0],a[1],n,r))&&a.unshift(l[0],l[1]),(l=this._project(a[a.length-2],a[a.length-1],s,o))&&a.push(l[0],l[1]),a=this._clipFinite(e,a))for(let c=0,u=a.length,f,d=this._edgecode(a[u-2],a[u-1]);c<u;c+=2)f=d,d=this._edgecode(a[c],a[c+1]),f&&d&&(c=this._edge(e,f,d,a,c),u=a.length);else this.contains(e,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)&&(a=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax]);return a}_edge(e,t,n,r,s){for(;t!==n;){let o,a;switch(t){case 5:t=4;continue;case 4:t=6,o=this.xmax,a=this.ymin;break;case 6:t=2;continue;case 2:t=10,o=this.xmax,a=this.ymax;break;case 10:t=8;continue;case 8:t=9,o=this.xmin,a=this.ymax;break;case 9:t=1;continue;case 1:t=5,o=this.xmin,a=this.ymin;break}(r[s]!==o||r[s+1]!==a)&&this.contains(e,o,a)&&(r.splice(s,0,o,a),s+=2)}return s}_project(e,t,n,r){let s=1/0,o,a,l;if(r<0){if(t<=this.ymin)return null;(o=(this.ymin-t)/r)<s&&(l=this.ymin,a=e+(s=o)*n)}else if(r>0){if(t>=this.ymax)return null;(o=(this.ymax-t)/r)<s&&(l=this.ymax,a=e+(s=o)*n)}if(n>0){if(e>=this.xmax)return null;(o=(this.xmax-e)/n)<s&&(a=this.xmax,l=t+(s=o)*r)}else if(n<0){if(e<=this.xmin)return null;(o=(this.xmin-e)/n)<s&&(a=this.xmin,l=t+(s=o)*r)}return[a,l]}_edgecode(e,t){return(e===this.xmin?1:e===this.xmax?2:0)|(t===this.ymin?4:t===this.ymax?8:0)}_regioncode(e,t){return(e<this.xmin?1:e>this.xmax?2:0)|(t<this.ymin?4:t>this.ymax?8:0)}_simplify(e){if(e&&e.length>4){for(let t=0;t<e.length;t+=2){let n=(t+2)%e.length,r=(t+4)%e.length;(e[t]===e[n]&&e[n]===e[r]||e[t+1]===e[n+1]&&e[n+1]===e[r+1])&&(e.splice(n,2),t-=2)}e.length||(e=null)}return e}};var Iwe=2*Math.PI,B_=Math.pow;function Pwe(i){return i[0]}function Lwe(i){return i[1]}function Dwe(i){let{triangles:e,coords:t}=i;for(let n=0;n<e.length;n+=3){let r=2*e[n],s=2*e[n+1],o=2*e[n+2];if((t[o]-t[r])*(t[s+1]-t[r+1])-(t[s]-t[r])*(t[o+1]-t[r+1])>1e-10)return!1}return!0}function Nwe(i,e,t){return[i+Math.sin(i+e)*t,e+Math.cos(i-e)*t]}var O_=class i{static from(e,t=Pwe,n=Lwe,r){return new i("length"in e?Fwe(e,t,n,r):Float64Array.from(Bwe(e,t,n,r)))}constructor(e){this._delaunator=new em(e),this.inedges=new Int32Array(e.length/2),this._hullIndex=new Int32Array(e.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){let e=this._delaunator,t=this.points;if(e.hull&&e.hull.length>2&&Dwe(e)){this.collinear=Int32Array.from({length:t.length/2},(d,A)=>A).sort((d,A)=>t[2*d]-t[2*A]||t[2*d+1]-t[2*A+1]);let l=this.collinear[0],c=this.collinear[this.collinear.length-1],u=[t[2*l],t[2*l+1],t[2*c],t[2*c+1]],f=1e-8*Math.hypot(u[3]-u[1],u[2]-u[0]);for(let d=0,A=t.length/2;d<A;++d){let y=Nwe(t[2*d],t[2*d+1],f);t[2*d]=y[0],t[2*d+1]=y[1]}this._delaunator=new em(t)}else delete this.collinear;let n=this.halfedges=this._delaunator.halfedges,r=this.hull=this._delaunator.hull,s=this.triangles=this._delaunator.triangles,o=this.inedges.fill(-1),a=this._hullIndex.fill(-1);for(let l=0,c=n.length;l<c;++l){let u=s[l%3===2?l-2:l+1];(n[l]===-1||o[u]===-1)&&(o[u]=l)}for(let l=0,c=r.length;l<c;++l)a[r[l]]=l;r.length<=2&&r.length>0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=r[0],o[r[0]]=1,r.length===2&&(o[r[1]]=0,this.triangles[1]=r[1],this.triangles[2]=r[1]))}voronoi(e){return new Cw(this,e)}*neighbors(e){let{inedges:t,hull:n,_hullIndex:r,halfedges:s,triangles:o,collinear:a}=this;if(a){let f=a.indexOf(e);f>0&&(yield a[f-1]),f<a.length-1&&(yield a[f+1]);return}let l=t[e];if(l===-1)return;let c=l,u=-1;do{if(yield u=o[c],c=c%3===2?c-2:c+1,o[c]!==e)return;if(c=s[c],c===-1){let f=n[(r[e]+1)%n.length];f!==u&&(yield f);return}}while(c!==l)}find(e,t,n=0){if(e=+e,e!==e||(t=+t,t!==t))return-1;let r=n,s;for(;(s=this._step(n,e,t))>=0&&s!==n&&s!==r;)n=s;return s}_step(e,t,n){let{inedges:r,hull:s,_hullIndex:o,halfedges:a,triangles:l,points:c}=this;if(r[e]===-1||!c.length)return(e+1)%(c.length>>1);let u=e,f=B_(t-c[e*2],2)+B_(n-c[e*2+1],2),d=r[e],A=d;do{let y=l[A],w=B_(t-c[y*2],2)+B_(n-c[y*2+1],2);if(w<f&&(f=w,u=y),A=A%3===2?A-2:A+1,l[A]!==e)break;if(A=a[A],A===-1){if(A=s[(o[e]+1)%s.length],A!==y&&B_(t-c[A*2],2)+B_(n-c[A*2+1],2)<f)return A;break}}while(A!==d);return u}render(e){let t=e==null?e=new Zc:void 0,{points:n,halfedges:r,triangles:s}=this;for(let o=0,a=r.length;o<a;++o){let l=r[o];if(l<o)continue;let c=s[o]*2,u=s[l]*2;e.moveTo(n[c],n[c+1]),e.lineTo(n[u],n[u+1])}return this.renderHull(e),t&&t.value()}renderPoints(e,t){t===void 0&&(!e||typeof e.moveTo!="function")&&(t=e,e=null),t=t==null?2:+t;let n=e==null?e=new Zc:void 0,{points:r}=this;for(let s=0,o=r.length;s<o;s+=2){let a=r[s],l=r[s+1];e.moveTo(a+t,l),e.arc(a,l,t,0,Iwe)}return n&&n.value()}renderHull(e){let t=e==null?e=new Zc:void 0,{hull:n,points:r}=this,s=n[0]*2,o=n.length;e.moveTo(r[s],r[s+1]);for(let a=1;a<o;++a){let l=2*n[a];e.lineTo(r[l],r[l+1])}return e.closePath(),t&&t.value()}hullPolygon(){let e=new tm;return this.renderHull(e),e.value()}renderTriangle(e,t){let n=t==null?t=new Zc:void 0,{points:r,triangles:s}=this,o=s[e*=3]*2,a=s[e+1]*2,l=s[e+2]*2;return t.moveTo(r[o],r[o+1]),t.lineTo(r[a],r[a+1]),t.lineTo(r[l],r[l+1]),t.closePath(),n&&n.value()}*trianglePolygons(){let{triangles:e}=this;for(let t=0,n=e.length/3;t<n;++t)yield this.trianglePolygon(t)}trianglePolygon(e){let t=new tm;return this.renderTriangle(e,t),t.value()}};function Fwe(i,e,t,n){let r=i.length,s=new Float64Array(r*2);for(let o=0;o<r;++o){let a=i[o];s[o*2]=e.call(n,a,o,i),s[o*2+1]=t.call(n,a,o,i)}return s}function*Bwe(i,e,t,n){let r=0;for(let s of i)yield e.call(n,s,r,i),yield t.call(n,s,r,i),++r}var Rw=Math.PI,QJ=Rw/2,vat=Rw/4,_at=Rw*2,lO=180/Rw,cO=Rw/180;var uO=Math.atan2,JC=Math.cos;var JJ=Math.max,eee=Math.min;var eR=Math.sin,tee=Math.sign||function(i){return i>0?1:i<0?-1:0},tR=Math.sqrt;function hO(i){return i>1?QJ:i<-1?-QJ:Math.asin(i)}function fO(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]}function Cl(i,e){return[i[1]*e[2]-i[2]*e[1],i[2]*e[0]-i[0]*e[2],i[0]*e[1]-i[1]*e[0]]}function Iw(i,e){return[i[0]+e[0],i[1]+e[1],i[2]+e[2]]}function Pw(i){var e=tR(i[0]*i[0]+i[1]*i[1]+i[2]*i[2]);return[i[0]/e,i[1]/e,i[2]/e]}function dO(i){return[uO(i[1],i[0])*lO,hO(JJ(-1,eee(1,i[2])))*lO]}function sf(i){let e=i[0]*cO,t=i[1]*cO,n=JC(t);return[n*JC(e),n*eR(e),eR(t)]}function nR(i){return i=i.map(e=>sf(e)),fO(i[0],Cl(i[2],i[1]))}function iee(i){let e=Uwe(i),t=zwe(e),n=kwe(t,i),r=Gwe(t,i.length),s=Owe(r,i),o=Vwe(t,i),{polygons:a,centers:l}=qwe(o,t,i),c=Hwe(a),u=jwe(t,i),f=Wwe(n,t);return{delaunay:e,edges:n,triangles:t,centers:l,neighbors:r,polygons:a,mesh:c,hull:u,urquhart:f,find:s}}function Owe(i,e){function t(n,r){let s=n[0]-r[0],o=n[1]-r[1],a=n[2]-r[2];return s*s+o*o+a*a}return function(r,s,o){o===void 0&&(o=0);let a,l,c=o,u=sf([r,s]);do a=o,o=null,l=t(u,sf(e[a])),i[a].forEach(f=>{let d=t(u,sf(e[f]));if(d<l){l=d,o=f,c=f;return}});while(o!==null);return c}}function Uwe(i){if(i.length<2)return{};let e=0;for(;isNaN(i[e][0]+i[e][1])&&e++<i.length;);let t=mB(i[e]),n=DB().translate([0,0]).scale(1).rotate(t.invert([180,0]));i=i.map(n);let r=[],s=1;for(let d=0,A=i.length;d<A;d++){let y=i[d][0]**2+i[d][1]**2;!isFinite(y)||y>1e32?r.push(d):y>s&&(s=y)}let o=1e6*tR(s);r.forEach(d=>i[d]=[o,0]),i.push([0,o]),i.push([-o,0]),i.push([0,-o]);let a=O_.from(i);a.projection=n;let{triangles:l,halfedges:c,inedges:u}=a,f=[];for(let d=0,A=c.length;d<A;d++)if(c[d]<0){let y=d%3==2?d-2:d+1,w=d%3==0?d+2:d-1,S=c[y],T=c[w];c[S]=T,c[T]=S,c[y]=c[w]=-1,l[d]=l[y]=l[w]=e,u[l[S]]=S%3==0?S+2:S-1,u[l[T]]=T%3==0?T+2:T-1,f.push(Math.min(d,y,w)),d+=2-d%3}else l[d]>i.length-3-1&&(l[d]=e);return a}function kwe(i,e){let t=new Set;return e.length===2?[[0,1]]:(i.forEach(n=>{if(n[0]!==n[1]&&!(nR(n.map(r=>e[r]))<0))for(let r=0,s;r<3;r++)s=(r+1)%3,t.add(j0([n[r],n[s]]).join("-"))}),Array.from(t,n=>n.split("-").map(Number)))}function zwe(i){let{triangles:e}=i;if(!e)return[];let t=[];for(let n=0,r=e.length/3;n<r;n++){let s=e[3*n],o=e[3*n+1],a=e[3*n+2];s!==o&&o!==a&&t.push([s,a,o])}return t}function Vwe(i,e){return i.map(t=>{let n=t.map(s=>e[s]).map(sf),r=Iw(Iw(Cl(n[1],n[0]),Cl(n[2],n[1])),Cl(n[0],n[2]));return dO(Pw(r))})}function Gwe(i,e){let t=[];return i.forEach(n=>{for(let r=0;r<3;r++){let s=n[r],o=n[(r+1)%3];t[s]=t[s]||[],t[s].push(o)}}),i.length===0&&(e===2?(t[0]=[1],t[1]=[0]):e===1&&(t[0]=[])),t}function qwe(i,e,t){let n=[],r=i.slice();if(e.length===0){if(t.length<2)return{polygons:n,centers:r};if(t.length===2){let a=sf(t[0]),l=sf(t[1]),c=Pw(Iw(a,l)),u=Pw(Cl(a,l)),f=Cl(c,u),d=[c,Cl(c,f),Cl(Cl(c,f),f),Cl(Cl(Cl(c,f),f),f)].map(dO).map(o);return n.push(d),n.push(d.slice().reverse()),{polygons:n,centers:r}}}e.forEach((a,l)=>{for(let c=0;c<3;c++){let u=a[c],f=a[(c+1)%3],d=a[(c+2)%3];n[u]=n[u]||[],n[u].push([f,d,l,[u,f,d]])}});let s=n.map(a=>{let l=[a[0][2]],c=a[0][1];for(let u=1;u<a.length;u++)for(let f=0;f<a.length;f++)if(a[f][0]==c){c=a[f][1],l.push(a[f][2]);break}if(l.length>2)return l;if(l.length==2){let u=nee(t[a[0][3][0]],t[a[0][3][1]],r[l[0]]),f=nee(t[a[0][3][2]],t[a[0][3][0]],r[l[0]]),d=o(u),A=o(f);return[l[0],A,l[1],d]}});function o(a){let l=-1;return r.slice(e.length,1/0).forEach((c,u)=>{c[0]===a[0]&&c[1]===a[1]&&(l=u+e.length)}),l<0&&(l=r.length,r.push(a)),l}return{polygons:s,centers:r}}function nee(i,e,t){i=sf(i),e=sf(e),t=sf(t);let n=tee(fO(Cl(e,i),t));return dO(Pw(Iw(i,e)).map(r=>n*r))}function Hwe(i){let e=[];return i.forEach(t=>{if(!t)return;let n=t[t.length-1];for(let r of t)r>n&&e.push([n,r]),n=r}),e}function Wwe(i,e){return function(t){let n=new Map,r=new Map;return i.forEach((s,o)=>{let a=s.join("-");n.set(a,t[o]),r.set(a,!0)}),e.forEach(s=>{let o=0,a=-1;for(let l=0;l<3;l++){let c=j0([s[l],s[(l+1)%3]]).join("-");n.get(c)>o&&(o=n.get(c),a=c)}r.set(a,!1)}),i.map(s=>r.get(s.join("-")))}}function jwe(i,e){let t=new Set,n=[];i.map(a=>{if(!(nR(a.map(l=>e[l>e.length?0:l]))>1e-12))for(let l=0;l<3;l++){let c=[a[l],a[(l+1)%3]],u=`${c[0]}-${c[1]}`;t.has(u)?t.delete(u):t.add(`${c[1]}-${c[0]}`)}});let r=new Map,s;if(t.forEach(a=>{a=a.split("-").map(Number),r.set(a[0],a[1]),s=a[0]}),s===void 0)return n;let o=s;do{n.push(o);let a=r.get(o);r.set(o,-1),o=a}while(o>-1&&o!==s);return n}function pO(i){let e=function(t){if(e.delaunay=null,e._data=t,typeof e._data=="object"&&e._data.type==="FeatureCollection"&&(e._data=e._data.features),typeof e._data=="object"){let n=e._data.map(r=>[e._vx(r),e._vy(r),r]).filter(r=>isFinite(r[0]+r[1]));e.points=n.map(r=>[r[0],r[1]]),e.valid=n.map(r=>r[2]),e.delaunay=iee(e.points)}return e};return e._vx=function(t){if(typeof t=="object"&&"type"in t)return EC(t)[0];if(0 in t)return t[0]},e._vy=function(t){if(typeof t=="object"&&"type"in t)return EC(t)[1];if(1 in t)return t[1]},e.x=function(t){return t?(e._vx=t,e):e._vx},e.y=function(t){return t?(e._vy=t,e):e._vy},e.polygons=function(t){if(t!==void 0&&e(t),!e.delaunay)return!1;let n={type:"FeatureCollection",features:[]};return e.valid.length===0||(e.delaunay.polygons.forEach((r,s)=>n.features.push({type:"Feature",geometry:r?{type:"Polygon",coordinates:[[...r,r[0]].map(o=>e.delaunay.centers[o])]}:null,properties:{site:e.valid[s],sitecoordinates:e.points[s],neighbours:e.delaunay.neighbors[s]}})),e.valid.length===1&&n.features.push({type:"Feature",geometry:{type:"Sphere"},properties:{site:e.valid[0],sitecoordinates:e.points[0],neighbours:[]}})),n},e.triangles=function(t){return t!==void 0&&e(t),e.delaunay?{type:"FeatureCollection",features:e.delaunay.triangles.map((n,r)=>(n=n.map(s=>e.points[s]),n.center=e.delaunay.centers[r],n)).filter(n=>nR(n)>0).map(n=>({type:"Feature",properties:{circumcenter:n.center},geometry:{type:"Polygon",coordinates:[[...n,n[0]]]}}))}:!1},e.links=function(t){if(t!==void 0&&e(t),!e.delaunay)return!1;let n=e.delaunay.edges.map(s=>Ml(e.points[s[0]],e.points[s[1]])),r=e.delaunay.urquhart(n);return{type:"FeatureCollection",features:e.delaunay.edges.map((s,o)=>({type:"Feature",properties:{source:e.valid[s[0]],target:e.valid[s[1]],length:n[o],urquhart:!!r[o]},geometry:{type:"LineString",coordinates:[e.points[s[0]],e.points[s[1]]]}}))}},e.mesh=function(t){return t!==void 0&&e(t),e.delaunay?{type:"MultiLineString",coordinates:e.delaunay.edges.map(n=>[e.points[n[0]],e.points[n[1]]])}:!1},e.cellMesh=function(t){if(t!==void 0&&e(t),!e.delaunay)return!1;let{centers:n,polygons:r}=e.delaunay,s=[];for(let o of r)if(o)for(let a=o.length,l=o[a-1],c=o[0],u=0;u<a;l=c,c=o[++u])c>l&&s.push([n[l],n[c]]);return{type:"MultiLineString",coordinates:s}},e._found=void 0,e.find=function(t,n,r){if(e._found=e.delaunay.find(t,n,e._found),!r||Ml([t,n],e.points[e._found])<r)return e._found},e.hull=function(t){t!==void 0&&e(t);let n=e.delaunay.hull,r=e.points;return n.length===0?null:{type:"Polygon",coordinates:[[...n.map(s=>r[s]),r[n[0]]]]}},i?e(i):e}function AO(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function Xwe(i){if(Array.isArray(i))return i}function $we(i){if(Array.isArray(i))return AO(i)}function Ywe(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function Zwe(i,e,t){return e=rR(e),rSe(i,see()?Reflect.construct(e,[],rR(i).constructor):e.apply(i,t))}function Kwe(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function Qwe(i,e,t){return Object.defineProperty(i,"prototype",{writable:!1}),i}function rR(i){return rR=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},rR(i)}function Jwe(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),e&&gO(i,e)}function see(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(see=function(){return!!i})()}function eSe(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function tSe(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function nSe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.4126-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function iSe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.4127-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function rSe(i,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ywe(i)}function gO(i,e){return gO=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},gO(i,e)}function of(i,e){return Xwe(i)||tSe(i,e)||oee(i,e)||nSe()}function mO(i){return $we(i)||eSe(i)||oee(i)||iSe()}function oee(i,e){if(i){if(typeof i=="string")return AO(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?AO(i,e):void 0}}function sSe(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=e.resolution,n=t===void 0?1/0:t,r=oSe(i,n),s=Qh(r),o=aSe(i,n),a=[].concat(mO(s),mO(o)),l={type:"Polygon",coordinates:i},c=vC(l),u=of(c,2),f=of(u[0],2),d=f[0],A=f[1],y=of(u[1],2),w=y[0],S=y[1],T=d>w||S>=89||A<=-89,R=[];if(T){var P=pO(a).triangles(),I=new Map(a.map(function(J,te){var ce=of(J,2),he=ce[0],ve=ce[1];return["".concat(he,"-").concat(ve),te]}));P.features.forEach(function(J){var te,ce=J.geometry.coordinates[0].slice(0,3).reverse(),he=[];if(ce.forEach(function(Re){var Qe=of(Re,2),Fe=Qe[0],mt=Qe[1],Ee="".concat(Fe,"-").concat(mt);I.has(Ee)&&he.push(I.get(Ee))}),he.length===3){if(he.some(function(Re){return Re<s.length})){var ve=J.properties.circumcenter;if(!vO(ve,l,T))return}(te=R).push.apply(te,he)}})}else if(o.length)for(var B=em.from(a),k=function(te){var ce,he=[2,1,0].map(function(Qe){return B.triangles[te+Qe]}),ve=he.map(function(Qe){return a[Qe]});if(he.some(function(Qe){return Qe<s.length})){var Re=[0,1].map(function(Qe){return eC(ve,function(Fe){return Fe[Qe]})});if(!vO(Re,l,T))return 1}(ce=R).push.apply(ce,mO(he))},z=0,G=B.triangles.length;z<G;z+=3)k(z);else{var F=I_(r),D=F.vertices,L=F.holes,C=L===void 0?[]:L;R=XB(D,C,2)}var W=Tl(j0(a,function(J){return J[0]}),[0,1]),Y=Tl(j0(a,function(J){return J[1]}),[0,1]),H=a.map(function(J){var te=of(J,2),ce=te[0],he=te[1];return[W(ce),Y(he)]}),$={points:a,indices:R,uvs:H};return{contour:r,triangles:$}}function oSe(i,e){return i.map(function(t){var n=[],r;return t.forEach(function(s){if(r){var o=Ml(s,r)*180/Math.PI;if(o>e)for(var a=Cg(r,s),l=1/Math.ceil(o/e),c=l;c<1;)n.push(a(c)),c+=l}n.push(r=s)}),n})}function aSe(i,e){var t={type:"Polygon",coordinates:i},n=vC(t),r=of(n,2),s=of(r[0],2),o=s[0],a=s[1],l=of(r[1],2),c=l[0],u=l[1];if(Math.min(Math.abs(c-o),Math.abs(u-a))<e)return[];var f=o>c||u>=89||a<=-89;return lSe(e,{minLng:o,maxLng:c,minLat:a,maxLat:u}).filter(function(d){return vO(d,t,f)})}function lSe(i){for(var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=e.minLng,n=e.maxLng,r=e.minLat,s=e.maxLat,o=Math.round(Math.pow(360/i,2)/Math.PI),a=(1+Math.sqrt(5))/2,l=function(T){return T/a*360%360-180},c=function(T){return Math.acos(2*T/o-1)/Math.PI*180-90},u=function(T){return o*(Math.cos((T+90)*Math.PI/180)+1)/2},f=[s!==void 0?Math.ceil(u(s)):0,r!==void 0?Math.floor(u(r)):o-1],d=t===void 0&&n===void 0?function(){return!0}:t===void 0?function(S){return S<=n}:n===void 0?function(S){return S>=t}:n>=t?function(S){return S>=t&&S<=n}:function(S){return S>=t||S<=n},A=[],y=f[0];y<=f[1];y++){var w=l(y);d(w)&&A.push([w,c(y)])}return A}function vO(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return t?bB(e,i):KJ(i,e)}var iR=window.THREE?window.THREE:{BufferGeometry:Xn,Float32BufferAttribute:Ln},ree=new iR.BufferGeometry().setAttribute?"setAttribute":"addAttribute",sR=(function(i){function e(t,n,r,s,o,a,l){var c;Kwe(this,e),c=Zwe(this,e),c.type="ConicPolygonGeometry",c.parameters={polygonGeoJson:t,bottomHeight:n,topHeight:r,closedBottom:s,closedTop:o,includeSides:a,curvatureResolution:l},n=n||0,r=r||1,s=s!==void 0?s:!0,o=o!==void 0?o:!0,a=a!==void 0?a:!0,l=l||5;var u=sSe(t,{resolution:l}),f=u.contour,d=u.triangles,A=Qh(d.uvs),y=[],w=[],S=[],T=0,R=function(L){var C=Math.round(y.length/3),B=S.length;y=y.concat(L.vertices),w=w.concat(L.uvs),S=S.concat(C?L.indices.map(function(k){return k+C}):L.indices),c.addGroup(B,S.length-B,T++)};a&&R(I()),s&&R(F(n,!1)),o&&R(F(r,!0)),c.setIndex(S),c[ree]("position",new iR.Float32BufferAttribute(y,3)),c[ree]("uv",new iR.Float32BufferAttribute(w,2)),c.computeVertexNormals();function P(D,L){var C=typeof L=="function"?L:function(){return L},B=D.map(function(k){return k.map(function(z){var G=of(z,2),W=G[0],Y=G[1];return cSe(Y,W,C(W,Y))})});return I_(B)}function I(){for(var D=P(f,n),L=D.vertices,C=D.holes,B=P(f,r),k=B.vertices,z=Qh([k,L]),G=Math.round(k.length/3),W=new Set(C),Y=0,H=[],$=0;$<G;$++){var J=$+1;if(J===G)J=Y;else if(W.has(J)){var te=J;J=Y,Y=te}H.push($,$+G,J+G),H.push(J+G,J,$)}for(var ce=[],he=1;he>=0;he--)for(var ve=0;ve<G;ve+=1)ce.push(ve/(G-1),he);return{indices:H,vertices:z,uvs:ce}}function F(D){var L=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return{indices:L?d.indices:d.indices.slice().reverse(),vertices:P([d.points],D).vertices,uvs:A}}return c}return Jwe(e,i),Qwe(e)})(iR.BufferGeometry);function cSe(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=(90-i)*Math.PI/180,r=(90-e)*Math.PI/180;return[t*Math.sin(n)*Math.cos(r),t*Math.cos(n),t*Math.sin(n)*Math.sin(r)]}function _O(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function uSe(i){if(Array.isArray(i))return i}function hSe(i){if(Array.isArray(i))return _O(i)}function fSe(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function dSe(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function pSe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.4128-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function mSe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.4129-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ASe(i,e){if(i==null)return{};var t,n,r=gSe(i,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);for(n=0;n<s.length;n++)t=s[n],e.includes(t)||{}.propertyIsEnumerable.call(i,t)&&(r[t]=i[t])}return r}function gSe(i,e){if(i==null)return{};var t={};for(var n in i)if({}.hasOwnProperty.call(i,n)){if(e.includes(n))continue;t[n]=i[n]}return t}function vSe(i,e){return uSe(i)||dSe(i,e)||aee(i,e)||pSe()}function _Se(i){return hSe(i)||fSe(i)||aee(i)||mSe()}function xSe(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(i)}function ySe(i){var e=xSe(i,"string");return typeof e=="symbol"?e:e+""}function aee(i,e){if(i){if(typeof i=="string")return _O(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_O(i,e):void 0}}var lee=(function(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,r=(e instanceof Array?e.length?e:[void 0]:[e]).map(function(a){return{keyAccessor:a,isProp:!(a instanceof Function)}}),s=i.reduce(function(a,l){var c=a,u=l;return r.forEach(function(f,d){var A=f.keyAccessor,y=f.isProp,w;if(y){var S=u,T=S[A],R=ASe(S,[A].map(ySe));w=T,u=R}else w=A(u,d);d+1<r.length?(c.hasOwnProperty(w)||(c[w]={}),c=c[w]):t?(c.hasOwnProperty(w)||(c[w]=[]),c[w].push(u)):c[w]=u}),a},{});t instanceof Function&&(function a(l){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;c===r.length?Object.keys(l).forEach(function(u){return l[u]=t(l[u])}):Object.values(l).forEach(function(u){return a(u,c+1)})})(s);var o=s;return n&&(o=[],(function a(l){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];c.length===r.length?o.push({keys:c,vals:l}):Object.entries(l).forEach(function(u){var f=vSe(u,2),d=f[0],A=f[1];return a(A,[].concat(_Se(c),[d]))})})(s),e instanceof Array&&e.length===0&&o.length===1&&(o[0].keys=[])),o});var Ai=(function(i){i=i||{};var e=typeof i<"u"?i:{},t={},n;for(n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);var r=[],s="";function o(Le){return e.locateFile?e.locateFile(Le,s):s+Le}var a;typeof document<"u"&&document.currentScript&&(s=document.currentScript.src),s.indexOf("blob:")!==0?s=s.substr(0,s.lastIndexOf("/")+1):s="",a=function(it,Dt,He){var h=new XMLHttpRequest;h.open("GET",it,!0),h.responseType="arraybuffer",h.onload=function(){if(h.status==200||h.status==0&&h.response){Dt(h.response);return}var Ii=St(it);if(Ii){Dt(Ii.buffer);return}He()},h.onerror=He,h.send(null)};var l=e.print||console.log.bind(console),c=e.printErr||console.warn.bind(console);for(n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);t=null,e.arguments&&(r=e.arguments);var u=0,f=function(Le){u=Le},d=function(){return u},A=8;function y(Le,it,Dt,He){switch(Dt=Dt||"i8",Dt.charAt(Dt.length-1)==="*"&&(Dt="i32"),Dt){case"i1":Y[Le>>0]=it;break;case"i8":Y[Le>>0]=it;break;case"i16":$[Le>>1]=it;break;case"i32":te[Le>>2]=it;break;case"i64":Ge=[it>>>0,(Pe=it,+bt(Pe)>=1?Pe>0?(en(+hn(Pe/4294967296),4294967295)|0)>>>0:~~+yt((Pe-+(~~Pe>>>0))/4294967296)>>>0:0)],te[Le>>2]=Ge[0],te[Le+4>>2]=Ge[1];break;case"float":he[Le>>2]=it;break;case"double":ve[Le>>3]=it;break;default:km("invalid type for setValue: "+Dt)}}function w(Le,it,Dt){switch(it=it||"i8",it.charAt(it.length-1)==="*"&&(it="i32"),it){case"i1":return Y[Le>>0];case"i8":return Y[Le>>0];case"i16":return $[Le>>1];case"i32":return te[Le>>2];case"i64":return te[Le>>2];case"float":return he[Le>>2];case"double":return ve[Le>>3];default:km("invalid type for getValue: "+it)}return null}var S=!1;function T(Le,it){Le||km("Assertion failed: "+it)}function R(Le){var it=e["_"+Le];return T(it,"Cannot call unknown function "+Le+", make sure it is exported"),it}function P(Le,it,Dt,He,h){var sr={string:function(ii){var zi=0;if(ii!=null&&ii!==0){var nT=(ii.length<<2)+1;zi=NG(nT),B(ii,zi,nT)}return zi},array:function(ii){var zi=NG(ii.length);return z(ii,zi),zi}};function Ii(ii){return it==="string"?L(ii):it==="boolean"?!!ii:ii}var ie=R(Le),or=[],sl=0;if(He)for(var fo=0;fo<He.length;fo++){var Qs=sr[Dt[fo]];Qs?(sl===0&&(sl=uce()),or[fo]=Qs(He[fo])):or[fo]=He[fo]}var bs=ie.apply(null,or);return bs=Ii(bs),sl!==0&&cce(sl),bs}function I(Le,it,Dt,He){Dt=Dt||[];var h=Dt.every(function(Ii){return Ii==="number"}),sr=it!=="string";return sr&&h&&!He?R(Le):function(){return P(Le,it,Dt,arguments,He)}}var F=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function D(Le,it,Dt){for(var He=it+Dt,h=it;Le[h]&&!(h>=He);)++h;if(h-it>16&&Le.subarray&&F)return F.decode(Le.subarray(it,h));for(var sr="";it<h;){var Ii=Le[it++];if(!(Ii&128)){sr+=String.fromCharCode(Ii);continue}var ie=Le[it++]&63;if((Ii&224)==192){sr+=String.fromCharCode((Ii&31)<<6|ie);continue}var or=Le[it++]&63;if((Ii&240)==224?Ii=(Ii&15)<<12|ie<<6|or:Ii=(Ii&7)<<18|ie<<12|or<<6|Le[it++]&63,Ii<65536)sr+=String.fromCharCode(Ii);else{var sl=Ii-65536;sr+=String.fromCharCode(55296|sl>>10,56320|sl&1023)}}return sr}function L(Le,it){return Le?D(H,Le,it):""}function C(Le,it,Dt,He){if(!(He>0))return 0;for(var h=Dt,sr=Dt+He-1,Ii=0;Ii<Le.length;++Ii){var ie=Le.charCodeAt(Ii);if(ie>=55296&&ie<=57343){var or=Le.charCodeAt(++Ii);ie=65536+((ie&1023)<<10)|or&1023}if(ie<=127){if(Dt>=sr)break;it[Dt++]=ie}else if(ie<=2047){if(Dt+1>=sr)break;it[Dt++]=192|ie>>6,it[Dt++]=128|ie&63}else if(ie<=65535){if(Dt+2>=sr)break;it[Dt++]=224|ie>>12,it[Dt++]=128|ie>>6&63,it[Dt++]=128|ie&63}else{if(Dt+3>=sr)break;it[Dt++]=240|ie>>18,it[Dt++]=128|ie>>12&63,it[Dt++]=128|ie>>6&63,it[Dt++]=128|ie&63}}return it[Dt]=0,Dt-h}function B(Le,it,Dt){return C(Le,H,it,Dt)}var k=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0;function z(Le,it){Y.set(Le,it)}function G(Le,it){return Le%it>0&&(Le+=it-Le%it),Le}var W,Y,H,$,J,te,ce,he,ve;function Re(Le){W=Le,e.HEAP8=Y=new Int8Array(Le),e.HEAP16=$=new Int16Array(Le),e.HEAP32=te=new Int32Array(Le),e.HEAPU8=H=new Uint8Array(Le),e.HEAPU16=J=new Uint16Array(Le),e.HEAPU32=ce=new Uint32Array(Le),e.HEAPF32=he=new Float32Array(Le),e.HEAPF64=ve=new Float64Array(Le)}var Qe=5271296,Fe=28384,mt=e.TOTAL_MEMORY||33554432;e.buffer?W=e.buffer:W=new ArrayBuffer(mt),mt=W.byteLength,Re(W),te[Fe>>2]=Qe;function Ee(Le){for(;Le.length>0;){var it=Le.shift();if(typeof it=="function"){it();continue}var Dt=it.func;typeof Dt=="number"?it.arg===void 0?e.dynCall_v(Dt):e.dynCall_vi(Dt,it.arg):Dt(it.arg===void 0?null:it.arg)}}var Ve=[],Ye=[],Mt=[],Et=[];function It(){if(e.preRun)for(typeof e.preRun=="function"&&(e.preRun=[e.preRun]);e.preRun.length;)ot(e.preRun.shift());Ee(Ve)}function dn(){Ee(Ye)}function Gt(){Ee(Mt)}function $e(){if(e.postRun)for(typeof e.postRun=="function"&&(e.postRun=[e.postRun]);e.postRun.length;)nt(e.postRun.shift());Ee(Et)}function ot(Le){Ve.unshift(Le)}function nt(Le){Et.unshift(Le)}var bt=Math.abs,yt=Math.ceil,hn=Math.floor,en=Math.min,tn=0,bn=null,_e=null;function vi(Le){tn++,e.monitorRunDependencies&&e.monitorRunDependencies(tn)}function zn(Le){if(tn--,e.monitorRunDependencies&&e.monitorRunDependencies(tn),tn==0&&(bn!==null&&(clearInterval(bn),bn=null),_e)){var it=_e;_e=null,it()}}e.preloadedImages={},e.preloadedAudios={};var le=null,Z="data:application/octet-stream;base64,";function Te(Le){return String.prototype.startsWith?Le.startsWith(Z):Le.indexOf(Z)===0}var Pe,Ge;le="data:application/octet-stream;base64,AAAAAAAAAAAAAAAAAQAAAAIAAAADAAAABAAAAAUAAAAGAAAAAQAAAAQAAAADAAAABgAAAAUAAAACAAAAAAAAAAIAAAADAAAAAQAAAAQAAAAGAAAAAAAAAAUAAAADAAAABgAAAAQAAAAFAAAAAAAAAAEAAAACAAAABAAAAAUAAAAGAAAAAAAAAAIAAAADAAAAAQAAAAUAAAACAAAAAAAAAAEAAAADAAAABgAAAAQAAAAGAAAAAAAAAAUAAAACAAAAAQAAAAQAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAIAAAADAAAAAAAAAAAAAAACAAAAAAAAAAEAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAYAAAAAAAAABQAAAAAAAAAAAAAABAAAAAUAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAYAAAAAAAAABgAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAgAAAAMAAAAEAAAABQAAAAYAAAABAAAAAgAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAgAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAIAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAIAAAADAAAABQAAAAYAAAAAAAAAAQAAAAIAAAADAAAABAAAAAYAAAAAAAAAAQAAAAIAAAADAAAABAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAgAAAAIAAAAAAAAAAAAAAAYAAAAAAAAAAwAAAAIAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAFAAAABAAAAAAAAAABAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAYAAAAAAAAABAAAAAAAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAgAAAAQAAAADAAAACAAAAAEAAAAHAAAABgAAAAkAAAAAAAAAAwAAAAIAAAACAAAABgAAAAoAAAALAAAAAAAAAAEAAAAFAAAAAwAAAA0AAAABAAAABwAAAAQAAAAMAAAAAAAAAAQAAAB/AAAADwAAAAgAAAADAAAAAAAAAAwAAAAFAAAAAgAAABIAAAAKAAAACAAAAAAAAAAQAAAABgAAAA4AAAALAAAAEQAAAAEAAAAJAAAAAgAAAAcAAAAVAAAACQAAABMAAAADAAAADQAAAAEAAAAIAAAABQAAABYAAAAQAAAABAAAAAAAAAAPAAAACQAAABMAAAAOAAAAFAAAAAEAAAAHAAAABgAAAAoAAAALAAAAGAAAABcAAAAFAAAAAgAAABIAAAALAAAAEQAAABcAAAAZAAAAAgAAAAYAAAAKAAAADAAAABwAAAANAAAAGgAAAAQAAAAPAAAAAwAAAA0AAAAaAAAAFQAAAB0AAAADAAAADAAAAAcAAAAOAAAAfwAAABEAAAAbAAAACQAAABQAAAAGAAAADwAAABYAAAAcAAAAHwAAAAQAAAAIAAAADAAAABAAAAASAAAAIQAAAB4AAAAIAAAABQAAABYAAAARAAAACwAAAA4AAAAGAAAAIwAAABkAAAAbAAAAEgAAABgAAAAeAAAAIAAAAAUAAAAKAAAAEAAAABMAAAAiAAAAFAAAACQAAAAHAAAAFQAAAAkAAAAUAAAADgAAABMAAAAJAAAAKAAAABsAAAAkAAAAFQAAACYAAAATAAAAIgAAAA0AAAAdAAAABwAAABYAAAAQAAAAKQAAACEAAAAPAAAACAAAAB8AAAAXAAAAGAAAAAsAAAAKAAAAJwAAACUAAAAZAAAAGAAAAH8AAAAgAAAAJQAAAAoAAAAXAAAAEgAAABkAAAAXAAAAEQAAAAsAAAAtAAAAJwAAACMAAAAaAAAAKgAAAB0AAAArAAAADAAAABwAAAANAAAAGwAAACgAAAAjAAAALgAAAA4AAAAUAAAAEQAAABwAAAAfAAAAKgAAACwAAAAMAAAADwAAABoAAAAdAAAAKwAAACYAAAAvAAAADQAAABoAAAAVAAAAHgAAACAAAAAwAAAAMgAAABAAAAASAAAAIQAAAB8AAAApAAAALAAAADUAAAAPAAAAFgAAABwAAAAgAAAAHgAAABgAAAASAAAANAAAADIAAAAlAAAAIQAAAB4AAAAxAAAAMAAAABYAAAAQAAAAKQAAACIAAAATAAAAJgAAABUAAAA2AAAAJAAAADMAAAAjAAAALgAAAC0AAAA4AAAAEQAAABsAAAAZAAAAJAAAABQAAAAiAAAAEwAAADcAAAAoAAAANgAAACUAAAAnAAAANAAAADkAAAAYAAAAFwAAACAAAAAmAAAAfwAAACIAAAAzAAAAHQAAAC8AAAAVAAAAJwAAACUAAAAZAAAAFwAAADsAAAA5AAAALQAAACgAAAAbAAAAJAAAABQAAAA8AAAALgAAADcAAAApAAAAMQAAADUAAAA9AAAAFgAAACEAAAAfAAAAKgAAADoAAAArAAAAPgAAABwAAAAsAAAAGgAAACsAAAA+AAAALwAAAEAAAAAaAAAAKgAAAB0AAAAsAAAANQAAADoAAABBAAAAHAAAAB8AAAAqAAAALQAAACcAAAAjAAAAGQAAAD8AAAA7AAAAOAAAAC4AAAA8AAAAOAAAAEQAAAAbAAAAKAAAACMAAAAvAAAAJgAAACsAAAAdAAAARQAAADMAAABAAAAAMAAAADEAAAAeAAAAIQAAAEMAAABCAAAAMgAAADEAAAB/AAAAPQAAAEIAAAAhAAAAMAAAACkAAAAyAAAAMAAAACAAAAAeAAAARgAAAEMAAAA0AAAAMwAAAEUAAAA2AAAARwAAACYAAAAvAAAAIgAAADQAAAA5AAAARgAAAEoAAAAgAAAAJQAAADIAAAA1AAAAPQAAAEEAAABLAAAAHwAAACkAAAAsAAAANgAAAEcAAAA3AAAASQAAACIAAAAzAAAAJAAAADcAAAAoAAAANgAAACQAAABIAAAAPAAAAEkAAAA4AAAARAAAAD8AAABNAAAAIwAAAC4AAAAtAAAAOQAAADsAAABKAAAATgAAACUAAAAnAAAANAAAADoAAAB/AAAAPgAAAEwAAAAsAAAAQQAAACoAAAA7AAAAPwAAAE4AAABPAAAAJwAAAC0AAAA5AAAAPAAAAEgAAABEAAAAUAAAACgAAAA3AAAALgAAAD0AAAA1AAAAMQAAACkAAABRAAAASwAAAEIAAAA+AAAAKwAAADoAAAAqAAAAUgAAAEAAAABMAAAAPwAAAH8AAAA4AAAALQAAAE8AAAA7AAAATQAAAEAAAAAvAAAAPgAAACsAAABUAAAARQAAAFIAAABBAAAAOgAAADUAAAAsAAAAVgAAAEwAAABLAAAAQgAAAEMAAABRAAAAVQAAADEAAAAwAAAAPQAAAEMAAABCAAAAMgAAADAAAABXAAAAVQAAAEYAAABEAAAAOAAAADwAAAAuAAAAWgAAAE0AAABQAAAARQAAADMAAABAAAAALwAAAFkAAABHAAAAVAAAAEYAAABDAAAANAAAADIAAABTAAAAVwAAAEoAAABHAAAAWQAAAEkAAABbAAAAMwAAAEUAAAA2AAAASAAAAH8AAABJAAAANwAAAFAAAAA8AAAAWAAAAEkAAABbAAAASAAAAFgAAAA2AAAARwAAADcAAABKAAAATgAAAFMAAABcAAAANAAAADkAAABGAAAASwAAAEEAAAA9AAAANQAAAF4AAABWAAAAUQAAAEwAAABWAAAAUgAAAGAAAAA6AAAAQQAAAD4AAABNAAAAPwAAAEQAAAA4AAAAXQAAAE8AAABaAAAATgAAAEoAAAA7AAAAOQAAAF8AAABcAAAATwAAAE8AAABOAAAAPwAAADsAAABdAAAAXwAAAE0AAABQAAAARAAAAEgAAAA8AAAAYwAAAFoAAABYAAAAUQAAAFUAAABeAAAAZQAAAD0AAABCAAAASwAAAFIAAABgAAAAVAAAAGIAAAA+AAAATAAAAEAAAABTAAAAfwAAAEoAAABGAAAAZAAAAFcAAABcAAAAVAAAAEUAAABSAAAAQAAAAGEAAABZAAAAYgAAAFUAAABXAAAAZQAAAGYAAABCAAAAQwAAAFEAAABWAAAATAAAAEsAAABBAAAAaAAAAGAAAABeAAAAVwAAAFMAAABmAAAAZAAAAEMAAABGAAAAVQAAAFgAAABIAAAAWwAAAEkAAABjAAAAUAAAAGkAAABZAAAAYQAAAFsAAABnAAAARQAAAFQAAABHAAAAWgAAAE0AAABQAAAARAAAAGoAAABdAAAAYwAAAFsAAABJAAAAWQAAAEcAAABpAAAAWAAAAGcAAABcAAAAUwAAAE4AAABKAAAAbAAAAGQAAABfAAAAXQAAAE8AAABaAAAATQAAAG0AAABfAAAAagAAAF4AAABWAAAAUQAAAEsAAABrAAAAaAAAAGUAAABfAAAAXAAAAE8AAABOAAAAbQAAAGwAAABdAAAAYAAAAGgAAABiAAAAbgAAAEwAAABWAAAAUgAAAGEAAAB/AAAAYgAAAFQAAABnAAAAWQAAAG8AAABiAAAAbgAAAGEAAABvAAAAUgAAAGAAAABUAAAAYwAAAFAAAABpAAAAWAAAAGoAAABaAAAAcQAAAGQAAABmAAAAUwAAAFcAAABsAAAAcgAAAFwAAABlAAAAZgAAAGsAAABwAAAAUQAAAFUAAABeAAAAZgAAAGUAAABXAAAAVQAAAHIAAABwAAAAZAAAAGcAAABbAAAAYQAAAFkAAAB0AAAAaQAAAG8AAABoAAAAawAAAG4AAABzAAAAVgAAAF4AAABgAAAAaQAAAFgAAABnAAAAWwAAAHEAAABjAAAAdAAAAGoAAABdAAAAYwAAAFoAAAB1AAAAbQAAAHEAAABrAAAAfwAAAGUAAABeAAAAcwAAAGgAAABwAAAAbAAAAGQAAABfAAAAXAAAAHYAAAByAAAAbQAAAG0AAABsAAAAXQAAAF8AAAB1AAAAdgAAAGoAAABuAAAAYgAAAGgAAABgAAAAdwAAAG8AAABzAAAAbwAAAGEAAABuAAAAYgAAAHQAAABnAAAAdwAAAHAAAABrAAAAZgAAAGUAAAB4AAAAcwAAAHIAAABxAAAAYwAAAHQAAABpAAAAdQAAAGoAAAB5AAAAcgAAAHAAAABkAAAAZgAAAHYAAAB4AAAAbAAAAHMAAABuAAAAawAAAGgAAAB4AAAAdwAAAHAAAAB0AAAAZwAAAHcAAABvAAAAcQAAAGkAAAB5AAAAdQAAAH8AAABtAAAAdgAAAHEAAAB5AAAAagAAAHYAAAB4AAAAbAAAAHIAAAB1AAAAeQAAAG0AAAB3AAAAbwAAAHMAAABuAAAAeQAAAHQAAAB4AAAAeAAAAHMAAAByAAAAcAAAAHkAAAB3AAAAdgAAAHkAAAB0AAAAeAAAAHcAAAB1AAAAcQAAAHYAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAABAAAABQAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAACAAAABQAAAAEAAAAAAAAA/////wEAAAAAAAAAAwAAAAQAAAACAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAFAAAAAQAAAAAAAAAAAAAAAQAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAADAAAAAAAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAADAAAABQAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAEAAAABQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAABAAAAAwAAAAAAAAAAAAAAAQAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAQAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAADAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAwAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAAAAAABAAAAAwAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAADAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAUAAAABAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAABAAAAAUAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAIAAAAFAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAFAAAAAAAAAAAAAAD/////AQAAAAAAAAADAAAABAAAAAIAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAUAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAUAAAABAAAAAAAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAEAAAD//////////wEAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAADAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAACAAAAAAAAAAAAAAABAAAAAgAAAAYAAAAEAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAcAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAKAAAAAgAAAAAAAAAAAAAAAQAAAAEAAAAFAAAABgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAABwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAACAAAAAAAAAAAAAAABAAAAAwAAAAcAAAAGAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAABwAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAADgAAAAIAAAAAAAAAAAAAAAEAAAAAAAAACQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAMAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAABwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAIAAAAAAAAAAAAAAAEAAAAEAAAACAAAAAoAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAALAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAACQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAAgAAAAAAAAAAAAAAAQAAAAsAAAAPAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAOAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAIAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAABQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAgAAAAAAAAAAAAAAAQAAAAwAAAAQAAAADAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAoAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAPAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAADwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAACAAAAAAAAAAAAAAABAAAACgAAABMAAAAIAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAA8AAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAQAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAACQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAIAAAAAAAAAAAAAAAEAAAANAAAAEQAAAA0AAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAARAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAA0AAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAACAAAAAAAAAAAAAAABAAAADgAAABIAAAAPAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAADwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAASAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEwAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAABEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEgAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAABIAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAATAAAAAgAAAAAAAAAAAAAAAQAAAP//////////EwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEgAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAASAAAAAAAAABgAAAAAAAAAIQAAAAAAAAAeAAAAAAAAACAAAAADAAAAMQAAAAEAAAAwAAAAAwAAADIAAAADAAAACAAAAAAAAAAFAAAABQAAAAoAAAAFAAAAFgAAAAAAAAAQAAAAAAAAABIAAAAAAAAAKQAAAAEAAAAhAAAAAAAAAB4AAAAAAAAABAAAAAAAAAAAAAAABQAAAAIAAAAFAAAADwAAAAEAAAAIAAAAAAAAAAUAAAAFAAAAHwAAAAEAAAAWAAAAAAAAABAAAAAAAAAAAgAAAAAAAAAGAAAAAAAAAA4AAAAAAAAACgAAAAAAAAALAAAAAAAAABEAAAADAAAAGAAAAAEAAAAXAAAAAwAAABkAAAADAAAAAAAAAAAAAAABAAAABQAAAAkAAAAFAAAABQAAAAAAAAACAAAAAAAAAAYAAAAAAAAAEgAAAAEAAAAKAAAAAAAAAAsAAAAAAAAABAAAAAEAAAADAAAABQAAAAcAAAAFAAAACAAAAAEAAAAAAAAAAAAAAAEAAAAFAAAAEAAAAAEAAAAFAAAAAAAAAAIAAAAAAAAABwAAAAAAAAAVAAAAAAAAACYAAAAAAAAACQAAAAAAAAATAAAAAAAAACIAAAADAAAADgAAAAEAAAAUAAAAAwAAACQAAAADAAAAAwAAAAAAAAANAAAABQAAAB0AAAAFAAAAAQAAAAAAAAAHAAAAAAAAABUAAAAAAAAABgAAAAEAAAAJAAAAAAAAABMAAAAAAAAABAAAAAIAAAAMAAAABQAAABoAAAAFAAAAAAAAAAEAAAADAAAAAAAAAA0AAAAFAAAAAgAAAAEAAAABAAAAAAAAAAcAAAAAAAAAGgAAAAAAAAAqAAAAAAAAADoAAAAAAAAAHQAAAAAAAAArAAAAAAAAAD4AAAADAAAAJgAAAAEAAAAvAAAAAwAAAEAAAAADAAAADAAAAAAAAAAcAAAABQAAACwAAAAFAAAADQAAAAAAAAAaAAAAAAAAACoAAAAAAAAAFQAAAAEAAAAdAAAAAAAAACsAAAAAAAAABAAAAAMAAAAPAAAABQAAAB8AAAAFAAAAAwAAAAEAAAAMAAAAAAAAABwAAAAFAAAABwAAAAEAAAANAAAAAAAAABoAAAAAAAAAHwAAAAAAAAApAAAAAAAAADEAAAAAAAAALAAAAAAAAAA1AAAAAAAAAD0AAAADAAAAOgAAAAEAAABBAAAAAwAAAEsAAAADAAAADwAAAAAAAAAWAAAABQAAACEAAAAFAAAAHAAAAAAAAAAfAAAAAAAAACkAAAAAAAAAKgAAAAEAAAAsAAAAAAAAADUAAAAAAAAABAAAAAQAAAAIAAAABQAAABAAAAAFAAAADAAAAAEAAAAPAAAAAAAAABYAAAAFAAAAGgAAAAEAAAAcAAAAAAAAAB8AAAAAAAAAMgAAAAAAAAAwAAAAAAAAADEAAAADAAAAIAAAAAAAAAAeAAAAAwAAACEAAAADAAAAGAAAAAMAAAASAAAAAwAAABAAAAADAAAARgAAAAAAAABDAAAAAAAAAEIAAAADAAAANAAAAAMAAAAyAAAAAAAAADAAAAAAAAAAJQAAAAMAAAAgAAAAAAAAAB4AAAADAAAAUwAAAAAAAABXAAAAAwAAAFUAAAADAAAASgAAAAMAAABGAAAAAAAAAEMAAAAAAAAAOQAAAAEAAAA0AAAAAwAAADIAAAAAAAAAGQAAAAAAAAAXAAAAAAAAABgAAAADAAAAEQAAAAAAAAALAAAAAwAAAAoAAAADAAAADgAAAAMAAAAGAAAAAwAAAAIAAAADAAAALQAAAAAAAAAnAAAAAAAAACUAAAADAAAAIwAAAAMAAAAZAAAAAAAAABcAAAAAAAAAGwAAAAMAAAARAAAAAAAAAAsAAAADAAAAPwAAAAAAAAA7AAAAAwAAADkAAAADAAAAOAAAAAMAAAAtAAAAAAAAACcAAAAAAAAALgAAAAMAAAAjAAAAAwAAABkAAAAAAAAAJAAAAAAAAAAUAAAAAAAAAA4AAAADAAAAIgAAAAAAAAATAAAAAwAAAAkAAAADAAAAJgAAAAMAAAAVAAAAAwAAAAcAAAADAAAANwAAAAAAAAAoAAAAAAAAABsAAAADAAAANgAAAAMAAAAkAAAAAAAAABQAAAAAAAAAMwAAAAMAAAAiAAAAAAAAABMAAAADAAAASAAAAAAAAAA8AAAAAwAAAC4AAAADAAAASQAAAAMAAAA3AAAAAAAAACgAAAAAAAAARwAAAAMAAAA2AAAAAwAAACQAAAAAAAAAQAAAAAAAAAAvAAAAAAAAACYAAAADAAAAPgAAAAAAAAArAAAAAwAAAB0AAAADAAAAOgAAAAMAAAAqAAAAAwAAABoAAAADAAAAVAAAAAAAAABFAAAAAAAAADMAAAADAAAAUgAAAAMAAABAAAAAAAAAAC8AAAAAAAAATAAAAAMAAAA+AAAAAAAAACsAAAADAAAAYQAAAAAAAABZAAAAAwAAAEcAAAADAAAAYgAAAAMAAABUAAAAAAAAAEUAAAAAAAAAYAAAAAMAAABSAAAAAwAAAEAAAAAAAAAASwAAAAAAAABBAAAAAAAAADoAAAADAAAAPQAAAAAAAAA1AAAAAwAAACwAAAADAAAAMQAAAAMAAAApAAAAAwAAAB8AAAADAAAAXgAAAAAAAABWAAAAAAAAAEwAAAADAAAAUQAAAAMAAABLAAAAAAAAAEEAAAAAAAAAQgAAAAMAAAA9AAAAAAAAADUAAAADAAAAawAAAAAAAABoAAAAAwAAAGAAAAADAAAAZQAAAAMAAABeAAAAAAAAAFYAAAAAAAAAVQAAAAMAAABRAAAAAwAAAEsAAAAAAAAAOQAAAAAAAAA7AAAAAAAAAD8AAAADAAAASgAAAAAAAABOAAAAAwAAAE8AAAADAAAAUwAAAAMAAABcAAAAAwAAAF8AAAADAAAAJQAAAAAAAAAnAAAAAwAAAC0AAAADAAAANAAAAAAAAAA5AAAAAAAAADsAAAAAAAAARgAAAAMAAABKAAAAAAAAAE4AAAADAAAAGAAAAAAAAAAXAAAAAwAAABkAAAADAAAAIAAAAAMAAAAlAAAAAAAAACcAAAADAAAAMgAAAAMAAAA0AAAAAAAAADkAAAAAAAAALgAAAAAAAAA8AAAAAAAAAEgAAAADAAAAOAAAAAAAAABEAAAAAwAAAFAAAAADAAAAPwAAAAMAAABNAAAAAwAAAFoAAAADAAAAGwAAAAAAAAAoAAAAAwAAADcAAAADAAAAIwAAAAAAAAAuAAAAAAAAADwAAAAAAAAALQAAAAMAAAA4AAAAAAAAAEQAAAADAAAADgAAAAAAAAAUAAAAAwAAACQAAAADAAAAEQAAAAMAAAAbAAAAAAAAACgAAAADAAAAGQAAAAMAAAAjAAAAAAAAAC4AAAAAAAAARwAAAAAAAABZAAAAAAAAAGEAAAADAAAASQAAAAAAAABbAAAAAwAAAGcAAAADAAAASAAAAAMAAABYAAAAAwAAAGkAAAADAAAAMwAAAAAAAABFAAAAAwAAAFQAAAADAAAANgAAAAAAAABHAAAAAAAAAFkAAAAAAAAANwAAAAMAAABJAAAAAAAAAFsAAAADAAAAJgAAAAAAAAAvAAAAAwAAAEAAAAADAAAAIgAAAAMAAAAzAAAAAAAAAEUAAAADAAAAJAAAAAMAAAA2AAAAAAAAAEcAAAAAAAAAYAAAAAAAAABoAAAAAAAAAGsAAAADAAAAYgAAAAAAAABuAAAAAwAAAHMAAAADAAAAYQAAAAMAAABvAAAAAwAAAHcAAAADAAAATAAAAAAAAABWAAAAAwAAAF4AAAADAAAAUgAAAAAAAABgAAAAAAAAAGgAAAAAAAAAVAAAAAMAAABiAAAAAAAAAG4AAAADAAAAOgAAAAAAAABBAAAAAwAAAEsAAAADAAAAPgAAAAMAAABMAAAAAAAAAFYAAAADAAAAQAAAAAMAAABSAAAAAAAAAGAAAAAAAAAAVQAAAAAAAABXAAAAAAAAAFMAAAADAAAAZQAAAAAAAABmAAAAAwAAAGQAAAADAAAAawAAAAMAAABwAAAAAwAAAHIAAAADAAAAQgAAAAAAAABDAAAAAwAAAEYAAAADAAAAUQAAAAAAAABVAAAAAAAAAFcAAAAAAAAAXgAAAAMAAABlAAAAAAAAAGYAAAADAAAAMQAAAAAAAAAwAAAAAwAAADIAAAADAAAAPQAAAAMAAABCAAAAAAAAAEMAAAADAAAASwAAAAMAAABRAAAAAAAAAFUAAAAAAAAAXwAAAAAAAABcAAAAAAAAAFMAAAAAAAAATwAAAAAAAABOAAAAAAAAAEoAAAADAAAAPwAAAAEAAAA7AAAAAwAAADkAAAADAAAAbQAAAAAAAABsAAAAAAAAAGQAAAAFAAAAXQAAAAEAAABfAAAAAAAAAFwAAAAAAAAATQAAAAEAAABPAAAAAAAAAE4AAAAAAAAAdQAAAAQAAAB2AAAABQAAAHIAAAAFAAAAagAAAAEAAABtAAAAAAAAAGwAAAAAAAAAWgAAAAEAAABdAAAAAQAAAF8AAAAAAAAAWgAAAAAAAABNAAAAAAAAAD8AAAAAAAAAUAAAAAAAAABEAAAAAAAAADgAAAADAAAASAAAAAEAAAA8AAAAAwAAAC4AAAADAAAAagAAAAAAAABdAAAAAAAAAE8AAAAFAAAAYwAAAAEAAABaAAAAAAAAAE0AAAAAAAAAWAAAAAEAAABQAAAAAAAAAEQAAAAAAAAAdQAAAAMAAABtAAAABQAAAF8AAAAFAAAAcQAAAAEAAABqAAAAAAAAAF0AAAAAAAAAaQAAAAEAAABjAAAAAQAAAFoAAAAAAAAAaQAAAAAAAABYAAAAAAAAAEgAAAAAAAAAZwAAAAAAAABbAAAAAAAAAEkAAAADAAAAYQAAAAEAAABZAAAAAwAAAEcAAAADAAAAcQAAAAAAAABjAAAAAAAAAFAAAAAFAAAAdAAAAAEAAABpAAAAAAAAAFgAAAAAAAAAbwAAAAEAAABnAAAAAAAAAFsAAAAAAAAAdQAAAAIAAABqAAAABQAAAFoAAAAFAAAAeQAAAAEAAABxAAAAAAAAAGMAAAAAAAAAdwAAAAEAAAB0AAAAAQAAAGkAAAAAAAAAdwAAAAAAAABvAAAAAAAAAGEAAAAAAAAAcwAAAAAAAABuAAAAAAAAAGIAAAADAAAAawAAAAEAAABoAAAAAwAAAGAAAAADAAAAeQAAAAAAAAB0AAAAAAAAAGcAAAAFAAAAeAAAAAEAAAB3AAAAAAAAAG8AAAAAAAAAcAAAAAEAAABzAAAAAAAAAG4AAAAAAAAAdQAAAAEAAABxAAAABQAAAGkAAAAFAAAAdgAAAAEAAAB5AAAAAAAAAHQAAAAAAAAAcgAAAAEAAAB4AAAAAQAAAHcAAAAAAAAAcgAAAAAAAABwAAAAAAAAAGsAAAAAAAAAZAAAAAAAAABmAAAAAAAAAGUAAAADAAAAUwAAAAEAAABXAAAAAwAAAFUAAAADAAAAdgAAAAAAAAB4AAAAAAAAAHMAAAAFAAAAbAAAAAEAAAByAAAAAAAAAHAAAAAAAAAAXAAAAAEAAABkAAAAAAAAAGYAAAAAAAAAdQAAAAAAAAB5AAAABQAAAHcAAAAFAAAAbQAAAAEAAAB2AAAAAAAAAHgAAAAAAAAAXwAAAAEAAABsAAAAAQAAAHIAAAAAAAAAGC1EVPsh+T8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABgtRFT7Ifk/GC1EVPsh+T8AAAAAAAAAAAAAAAAAAAAAGC1EVPsh+T8AAAAAAAAAABgtRFT7IQlAGC1EVPsh+T8AAAAAAAAAAAAAAAAAAAAAGC1EVPshCUAAAAAAAAAAABgtRFT7Ifm/GC1EVPsh+T8AAAAAAAAAAAAAAAAAAAAAGC1EVPsh+b8AAAAAAAAAAAAAAAAAAAAAGC1EVPsh+b8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABgtRFT7Ifm/GC1EVPsh+b8AAAAAAAAAAAAAAAAAAAAAGC1EVPsh+b8AAAAAAAAAABgtRFT7IQnAGC1EVPsh+b8AAAAAAAAAAAAAAAAAAAAAGC1EVPshCcAAAAAAAAAAABgtRFT7Ifk/GC1EVPsh+b8AAAAAAAAAAAAAAAAAAAAAGC1EVPsh+T8AAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAGAAAAAgAAAAUAAAABAAAABAAAAAAAAAAAAAAABQAAAAMAAAABAAAABgAAAAQAAAACAAAAAAAAAMpi5RexJsw/BlIKPVwR5T95Wyu0/QjnP5PjoT7YYcu/mBhKZ6zrwj8wRYS7NebuP3qW6geh+Ls/SLrixebL3r+pcyymN9XrPwmkNHp7xec/GWNMZVAA17+82s+x2BLiPwn2ytbJ9ek/LgEH1sMS1j8yp/2LhTfeP+SnWwtQBbu/d38gkp5X7z8ytsuHaADGPzUYObdf1+m/7IauECWhwz+cjSACjzniP76Z+wUhN9K/1+GEKzup67+/GYr/04baPw6idWOvsuc/ZedTWsRa5b/EJQOuRzi0v/OncYhHPes/h49PixY53j+i8wWfC03Nvw2idWOvsue/ZedTWsRa5T/EJQOuRzi0P/KncYhHPeu/iY9PixY53r+i8wWfC03NP9anWwtQBbs/d38gkp5X778ytsuHaADGvzUYObdf1+k/74auECWhw7+cjSACjzniv8CZ+wUhN9I/1uGEKzup6z+/GYr/04bavwmkNHp7xee/F2NMZVAA1z+82s+x2BLivwr2ytbJ9em/KwEH1sMS1r8yp/2LhTfev81i5RexJsy/BlIKPVwR5b95Wyu0/Qjnv5DjoT7YYcs/nBhKZ6zrwr8wRYS7Nebuv3OW6geh+Lu/SLrixebL3j+pcyymN9Xrv8rHIFfWehZAMBwUdlo0DECTUc17EOb2PxpVB1SWChdAzjbhb9pTDUDQhmdvECX5P9FlMKCC9+g/IIAzjELgE0DajDngMv8GQFhWDmDPjNs/y1guLh96EkAxPi8k7DIEQJCc4URlhRhA3eLKKLwkEECqpNAyTBD/P6xpjXcDiwVAFtl//cQm4z+Ibt3XKiYTQM7mCLUb3QdAoM1t8yVv7D8aLZv2Nk8UQEAJPV5nQwxAtSsfTCoE9z9TPjXLXIIWQBVanC5W9AtAYM3d7Adm9j++5mQz1FoWQBUThyaVBghAwH5muQsV7T89Q1qv82MUQJoWGOfNuBdAzrkClkmwDkDQjKq77t37Py+g0dtitsE/ZwAMTwVPEUBojepluNwBQGYbtuW+t9w/HNWIJs6MEkDTNuQUSlgEQKxktPP5TcQ/ixbLB8JjEUCwuWjXMQYCQAS/R09FkRdAowpiZjhhDkB7LmlczD/7P01iQmhhsAVAnrtTwDy84z/Z6jfQ2TgTQChOCXMnWwpAhrW3daoz8z/HYJvVPI4VQLT3ik5FcA5Angi7LOZd+z+NNVzDy5gXQBXdvVTFUA1AYNMgOeYe+T8+qHXGCwkXQKQTOKwa5AJA8gFVoEMW0T+FwzJyttIRQAEAAAD/////BwAAAP////8xAAAA/////1cBAAD/////YQkAAP////+nQQAA/////5HLAQD/////95AMAP/////B9lcAAAAAAAAAAAAAAAAAAgAAAP////8OAAAA/////2IAAAD/////rgIAAP/////CEgAA/////06DAAD/////IpcDAP/////uIRkA/////4LtrwAAAAAAAAAAAAAAAAAAAAAAAgAAAP//////////AQAAAAMAAAD//////////////////////////////////////////////////////////////////////////wEAAAAAAAAAAgAAAP///////////////wMAAAD//////////////////////////////////////////////////////////////////////////wEAAAAAAAAAAgAAAP///////////////wMAAAD//////////////////////////////////////////////////////////////////////////wEAAAAAAAAAAgAAAP///////////////wMAAAD//////////////////////////////////////////////////////////wIAAAD//////////wEAAAAAAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAA/////////////////////wEAAAD///////////////8CAAAA////////////////////////////////AwAAAP////////////////////8AAAAA////////////////AgAAAAEAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAA////////////////AgAAAAEAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAA////////////////AgAAAAEAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAA////////////////AgAAAAEAAAD/////////////////////////////////////////////////////AQAAAAIAAAD///////////////8AAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AQAAAAIAAAD///////////////8AAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AQAAAAIAAAD///////////////8AAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AQAAAAIAAAD///////////////8AAAAA/////////////////////wMAAAD///////////////////////////////8CAAAA////////////////AQAAAP////////////////////8AAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAAAQAAAP//////////AgAAAP//////////////////////////////////////////////////////////AwAAAP///////////////wIAAAAAAAAAAQAAAP//////////////////////////////////////////////////////////////////////////AwAAAP///////////////wIAAAAAAAAAAQAAAP//////////////////////////////////////////////////////////////////////////AwAAAP///////////////wIAAAAAAAAAAQAAAP//////////////////////////////////////////////////////////////////////////AwAAAAEAAAD//////////wIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAgAAAAAAAAACAAAAAQAAAAEAAAACAAAAAgAAAAAAAAAFAAAABQAAAAAAAAACAAAAAgAAAAMAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAIAAAABAAAAAgAAAAIAAAACAAAAAAAAAAUAAAAGAAAAAAAAAAIAAAACAAAAAwAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAIAAAAAAAAAAgAAAAEAAAADAAAAAgAAAAIAAAAAAAAABQAAAAcAAAAAAAAAAgAAAAIAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAgAAAAAAAAACAAAAAQAAAAQAAAACAAAAAgAAAAAAAAAFAAAACAAAAAAAAAACAAAAAgAAAAMAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAACAAAAAAAAAAIAAAABAAAAAAAAAAIAAAACAAAAAAAAAAUAAAAJAAAAAAAAAAIAAAACAAAAAwAAAAUAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAIAAAACAAAAAAAAAAMAAAAOAAAAAgAAAAAAAAACAAAAAwAAAAAAAAAAAAAAAgAAAAIAAAADAAAABgAAAAAAAAAAAAAAAAAAAAAAAAALAAAAAgAAAAIAAAAAAAAAAwAAAAoAAAACAAAAAAAAAAIAAAADAAAAAQAAAAAAAAACAAAAAgAAAAMAAAAHAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAACAAAAAgAAAAAAAAADAAAACwAAAAIAAAAAAAAAAgAAAAMAAAACAAAAAAAAAAIAAAACAAAAAwAAAAgAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAIAAAACAAAAAAAAAAMAAAAMAAAAAgAAAAAAAAACAAAAAwAAAAMAAAAAAAAAAgAAAAIAAAADAAAACQAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAgAAAAIAAAAAAAAAAwAAAA0AAAACAAAAAAAAAAIAAAADAAAABAAAAAAAAAACAAAAAgAAAAMAAAAKAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAACAAAAAgAAAAAAAAADAAAABgAAAAIAAAAAAAAAAgAAAAMAAAAPAAAAAAAAAAIAAAACAAAAAwAAAAsAAAAAAAAAAAAAAAAAAAAAAAAABgAAAAIAAAACAAAAAAAAAAMAAAAHAAAAAgAAAAAAAAACAAAAAwAAABAAAAAAAAAAAgAAAAIAAAADAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAgAAAAIAAAAAAAAAAwAAAAgAAAACAAAAAAAAAAIAAAADAAAAEQAAAAAAAAACAAAAAgAAAAMAAAANAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAACAAAAAgAAAAAAAAADAAAACQAAAAIAAAAAAAAAAgAAAAMAAAASAAAAAAAAAAIAAAACAAAAAwAAAA4AAAAAAAAAAAAAAAAAAAAAAAAACQAAAAIAAAACAAAAAAAAAAMAAAAFAAAAAgAAAAAAAAACAAAAAwAAABMAAAAAAAAAAgAAAAIAAAADAAAADwAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAgAAAAAAAAACAAAAAQAAABMAAAACAAAAAgAAAAAAAAAFAAAACgAAAAAAAAACAAAAAgAAAAMAAAAQAAAAAAAAAAAAAAAAAAAAAAAAABEAAAACAAAAAAAAAAIAAAABAAAADwAAAAIAAAACAAAAAAAAAAUAAAALAAAAAAAAAAIAAAACAAAAAwAAABEAAAAAAAAAAAAAAAAAAAAAAAAAEgAAAAIAAAAAAAAAAgAAAAEAAAAQAAAAAgAAAAIAAAAAAAAABQAAAAwAAAAAAAAAAgAAAAIAAAADAAAAEgAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAgAAAAAAAAACAAAAAQAAABEAAAACAAAAAgAAAAAAAAAFAAAADQAAAAAAAAACAAAAAgAAAAMAAAATAAAAAAAAAAAAAAAAAAAAAAAAAA8AAAACAAAAAAAAAAIAAAABAAAAEgAAAAIAAAACAAAAAAAAAAUAAAAOAAAAAAAAAAIAAAACAAAAAwAAAAIAAAABAAAAAAAAAAEAAAACAAAAAAAAAAAAAAACAAAAAQAAAAAAAAABAAAAAgAAAAEAAAAAAAAAAgAAAAAAAAAFAAAABAAAAAAAAAABAAAABQAAAAAAAAAAAAAABQAAAAQAAAAAAAAAAQAAAAUAAAAEAAAAAAAAAAUAAAAAAAAAAgAAAAEAAAAAAAAAAQAAAAIAAAAAAAAAAAAAAAIAAAABAAAAAAAAAAEAAAACAAAAAQAAAAAAAAACAAAAAgAAAAAAAAABAAAAAAAAAAAAAAAFAAAABAAAAAAAAAABAAAABQAAAAAAAAAAAAAABQAAAAQAAAAAAAAAAQAAAAUAAAAEAAAAAAAAAAUAAAAFAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAQAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAABAAAAAAAAAAABAAAAAAEAAAAAAAAAAAEAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAQAAAAAAAAAAAAEAAAAAAAAAAAAAOgehWlKfUEEz1zLi+JsiQa2og3wcMfVAWCbHorc0yEDi+Yn/Y6mbQJ11/mfsnG9At6bnG4UQQkBvMCQWKqUUQJVmwwswmOc/3hVgVBL3uj//qqOEOdGOPw/WDN4gnGE/H3ANkCUgND+AA8btKgAHPwTXBqJVSdo+XfRQAqsKrj4fc+zLYbSPQklEmCZHv2FCUP+uDso1NEKYtPhwphUHQptxnyFXYdpB7CddZAMmrkGAt1AxSTqBQUibBVdTsFNBSuX3MV+AJkFocv82SLf5QAqmgj7AY81A23VDSEnLoEDGEJVSeDFzQDYrqvBk70VA8U157pcRGUBWfEF+ZKbsP6phvycGBZRAJbod0OgwfkCp+L8jatBmQCjl3pGrPlFAfMWm114SOkButwtqS7UjQHQwbcjXyw1A8jnLuuyA9j9KwjL0VwHhPyotk0lcs8k/Q5PvEs9rsz+SfsOQEVqdPzUAKDojLoY/WJz/kcjCcD8YFu070FRZPyoLC2BdJEM/YOXQAuiMM0HIBz1bw3sdQdV46aaHRwZByatzjDPX8EDb3Jie8HXZQCJxj6ULP8NAUaG6uRAZrUCWdmou5/mVQLb9huRPm4BAhvoCHygZaUCuX/I3SPdSQC9/bC/1qTxAfKxsYQ6pJUCuslH+N14QQMS/cv7SvPg/Ol8maYKx4j8AAAAA/////wAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////////////////////////////wAAAAD/////AAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAA/////wAAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAP////8AAAAABQAAAAAAAAAAAAAAAAAAAAAAAAD/////BQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAA/////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////////////////////////////8AAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////////////////////////////AAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAABQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////////////////////////////wAAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAABAAAAAQAAAAAAAAABAAAAAAAAAAUAAAABAAAAAQAAAAAAAAAAAAAAAQAAAAEAAAAAAAAAAQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAEAAQAAAQEAAAAAAAEAAAABAAAAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAABAAAAAQAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAKriWFiWZfg/Y2nmTbY/8z8MHSPSqmnjv6hnn18HR3c/quJYWJZl+D/jq5TzDdzyPwwdI9KqaeO/u0kC1eFSBECq4lhYlmX4P69pJmt7c/E/NnkJi6jSBsDESFlzKkr6P33ArMz7sfY/o2q2uqM08D+oZ59fB0d3PzEqCi3qrvK/kmm4ANp49D+4wS2wzhzvP9WJvyAnx+E/upcY75RVx7+95t+9y0T1P9L18g1caO0/k6CkRyVzAEBf99+e/GjxP6QMsuuLQ/U/PlP4Qr8q7j8Mb/GO2GMCwLl2K/DQIghAePiwytEp9D9UHrsuI/nqPzjMedJ+yuy/k6xgf58n/L+XoQtn22DzP2lzCnsYk+s/JhUSDI4P8z+8lFcBhgTcPxOqKRxEX/M/89MEdoPQ6j8OKQaXDob7vzWwNvblgAPAzGkxMcl88j9Nm4okPkbpP0vI89vxSgRAdac2Z6W2/T+6UFOMC3zyP/+2XEF3hug/QqhELwGKCMAwdlQerEoEQFcr/B+VnvE/hB1hfFzT5j8wdsE/Da64P0hIvnF/sOC/KH/hrXUg8T9bI5OQHaLlP+mYzla7td6/CtKG6iOm8b8FW3TV8oXwP8ORhtNuJ+c/q8JrTMz/AcC8PaUl+PUFwAXv9rkMT/A/m+sAswr15D+7hk/O3yvkP6c/yVsOHKI/qqAX9idJ8D/8hNz1KNPiP7xSXh3Ggvg/epbkiKr57T/23/LB1GLvP4GTTeNZi+M/W4TqlTheBcDupZgIdYUIQGwlcW3YZO8/tQvDXQ3H4j8Bt+sf9DkAQMdFie+nNvg/Z5Uh1wDX7j9h5X2d4KjhPxMJ1ZVT4Pa/evqB8xB//7+W183U9QLsPwzNxsC7AOA/af/LqCnK/r/lPceQ0FQDwHoY0nYIW+w/bHNSHrTg4D/DFcMAdabuv2sz5Ojhnve/FvLf01HN6z/tEDL2Hz/gP0bBv0KUhPA/pd7sEnMc4D8EGon4Lo7sP5NVbYtSON8/DAMC50odBkB+Z2J8MGYCQIhlM1gubOo/FssiPwWy4D8OIlGqRnkCQAd1vopp6f4/QS1keLLK6T9rfoBuT7LZP3KQbH5ugwjAjqVPXTmbBUBL/JxcqR3qP3oSeovuktg/Y6pRhJmqy7+0kwuU0Yjmv2wvsfFmQ+g/R98lJFqQ2T/IGb5gjLkCwK3mNff3kQbAqDznPFM86T+iiP0FfsvYP7fzKG6Mls0/h7+at2btzL8tsUTgk+LmP/YEIrTDINU/WmwKoVjA5L9aC02r6FHxvzzFCT/Qg+Y/nx0V97en0j8+1toJOm77P1kZ7h8KjfQ/GBbbqxgk5j9RGXM79G/SP+beHsWmweQ/9REi4eX0xD/V9s+kmMHkP+pb9yNs09A/c5ERjVDTAECqEr3OBCH7P14ILfMECOU/piRx4P8P0j+JYU//bfL0Pw62fw28B+w/l5YW2Ga45D9+CyKRbenOP5cH6fHy1/S/o/egk03++r91nTYRL/bjP3fHN6OJVdA/7xXQh1XLBcAB3g6tBdUIQKW2KnGYjeQ/SqIpagclyz8F9P3YgNL6v9H6NBsZ8QDAW2k5L5Qs4z/0axa1l6zLP1GE65Mu4wNAwfX+BYmWAEBBgJP90M3hP6/03qhPLdA/zqo5bJz2778/ESlPCTn1v7JkhGyvzuE/DM7sj5twwz/6xbXLavYGQH29RFRGkgNA7bOXVSJ54T9fEhTHO/TDP+8t+HMOiwDAxa0SbGTtA8Atii7y0mLgP4cecHFB3sM/uPUpyv+K7j8nktD1/WvhP2cWmi772d8/Fj7uU9kEvD8oKOESLzKmvwSdCqrHdNu/XCluGsvI3T929OW5md+uP9dP6rXcZNq/gXM+ggzL6b+eKjsPgJncP6i1e9aVu7E/2CnPNJyD1D/DnyGgSe+xvy8k7g9bp9s/nYmLvHn1sz9cFOwApH8IwGa6Mjy9cgZAJr95SiSW2z8rCkhOFvqdP3SIKmO/UwPAEy0zkN7bBsCds8Hg/13YP1zv413hVGi/FVtqixSn6L9XAPQGul3yv7SGu2BoCNk/n94bv7Maj79p13T6X9z3P45MPCW3WvI/rU/8/LRj1T9cgR6SXd+ZPymL2DstbPI/8s/pAkIz6z/fmoB+8efYPz2XyfWgYaa/6wys72AW/j8LZImhgrf3P729Zla/n9U/ySB8B3PBqL8O2nhevvbxv17+5A+n6fe/YrGIqEGB1T+wCEGbkhaxv989QHVE5wFAzd12PTu3/T9AHUPZY2DUP3SQDST0zq2/JCxAlIoj5T+Mhe1IJkrQP/cRpl8QhtU/amc4seFts79khiUSVaz3vxYfWtjPwf2/CHscxQqD0j/ctUBQ9my3v0POnFiyXv2/pjjn2Ju/AcDk45DwBhPRP/GjwlCrv7m/aT2ciwolBsAQOzHr/wUJQCzpq5UYvtI/gDCf3SlCwb+4i7S+mukEQBDA1f8mowFA2utnRN3KyT9T+9EYAVG6v9/IVZ0enrE/7NbRtdGfzr/8y8GpRz7LP3U0vTSk18e/JzHEcwiBB0AGm8Q7AJkEQNLciyt4Esk/gLou5zoQxr+RrOfM91oBwEzd36KybgTAgLou5zoQxj/S3IsreBLJv1gCch0OHO8/FD+RxSLN4j91NL00pNfHP/zLwalHPsu/nL7/By4Pyr8tSP5h7CPiv1P70RgBUbo/2utnRN3Kyb/KfllfCpUIwLkP5zj+NwdAgDCf3SlCwT8s6auVGL7Sv2aFPlaC4eC/XrS5UVH77b/xo8JQq7+5P+TjkPAGE9G/Q30/RYbn1z8FF/ISafuLv9y1QFD2bLc/CHscxQqD0r/fi+tPROX0P6vRc+19ie0/amc4seFtsz/3EaZfEIbVv77TYpahl/o/DDsu0CaC9D90kA0k9M6tP0AdQ9ljYNS/CCI0rxjZA8BgfCaLthgHwLAIQZuSFrE/YrGIqEGB1b8kvQ982+rsv4J8EWu7jPS/ySB8B3PBqD+9vWZWv5/VvwrAByWcJgBAxFujmE9a+j89l8n1oGGmP9+agH7x59i/N03cuJUt9L8X9v4GdIz6v1yBHpJd35m/rU/8/LRj1b8mz69sydf/vyu5idMqVQLAn94bv7Majz8AhrtgaAjZv+aCE66WZ/q/lA1Mgz/p/79c7+Nd4VRoP52zweD/Xdi/TJZpMTb4AkDLWZShPOb/PysKSE4W+p2/Jr95SiSW27/PkmbE7zjnP6UAiCDmMNI/nYmLvHn1s78vJO4PW6fbv5MWA2vqSrQ/V5WLwPB51b+otXvWlbuxv54qOw+Amdy/1keqzYeRBsApIEMHgZIIQHb05bmZ366/XCluGsvI3b8W44a9X9UFQEeQtDM4rwJAFj7uU9kEvL9nFpou+9nfv3Co+JcyyQhAcdkCX2KzBUCHHnBxQd7Dvy2KLvLSYuC/o6+5YTt/AcCHCNDW+8YEwF8SFMc79MO/7bOXVSJ54b9E/pfA2S3xPzD9xaBb0uQ/DM7sj5tww7+yZIRsr87hv7c4c0SEXNG/Tr79/9M+5r+v9N6oTy3Qv5uAk/3QzeG/XcI1OVQkAUAQSV9Z7Qr9P/RrFrWXrMu/W2k5L5Qs479Zo2IBM/vkv6FuipzkFvG/SqIpagcly7+ltipxmI3kv0pmis91cfc/gWQecsRh8D93xzejiVXQv3WdNhEv9uO/D7mgYy612j+PyVPNaT2jv34LIpFt6c6/l5YW2Ga45L+LUp+2A2z9P39i5xSpRfc/piRx4P8P0r9eCC3zBAjlv5n4OKmIUf2/jj/kUAwgAsDqW/cjbNPQv9X2z6SYweS/aTdljlWd8L94R8vZ8SL3v1EZczv0b9K/GBbbqxgk5r9XdfyikfEDwPILMvas0gfAnx0V97en0r88xQk/0IPmvxGErZ681fa/9kCaiOy2/b/2BCK0wyDVvy2xROCT4ua/+5EBLOXxA0B7p53+BnkAQKKI/QV+y9i/qDznPFM86b/snWGNkkgHwC+ByugkUwdAR98lJFqQ2b9sL7HxZkPovyJNGM67oek/HzNy6BqA1D96EnqL7pLYv0v8nFypHeq/axL/u1FnB0AkSEHvxn8DQGt+gG5Pstm/QS1keLLK6b/Sk/O6mtGzPxU8pLcPNty/FssiPwWy4L+IZTNYLmzqvw4szKfSouq/G+XJHY1a87+TVW2LUjjfvwQaifgujuy/3VARaoMl2L9NFodfK+/qv+0QMvYfP+C/FvLf01HN67+ETOQysd8AwH71iI/eGgXAbHNSHrTg4L96GNJ2CFvsv6BnExReeAFA5CakvxSl+j8MzcbAuwDgv5bXzdT1Auy/uVq8/8x58z+uvPMNqzTnP2HlfZ3gqOG/Z5Uh1wDX7r8PUbMSo2P7P9VfBrXlxPI/tQvDXQ3H4r9sJXFt2GTvvyDssGgO0PG/WxT/uE4N+r+Bk03jWYvjv/bf8sHUYu+/rUXN8hUe3j9m5HB1yZCzv/yE3PUo0+K/qqAX9idJ8L9mByqLMMH5v4kHC7KQowHAm+sAswr15L8F7/a5DE/wv2JLsGADFwTAKQjVGovZCMDDkYbTbifnvwVbdNXyhfC/malhH7yI7D+oevd0GWDZP1sjk5AdouW/KH/hrXUg8b8KWmrpQ0sFQAzEAF/pTgBAhB1hfFzT5r9XK/wflZ7xv18hRuqKXAjA/5rUd9v1BED/tlxBd4bov7pQU4wLfPK/4pnwn0T/sj/c277XPF3jv02biiQ+Rum/zGkxMcl88r8Yk0HhJVzjv62yUUFRjfS/89MEdoPQ6r8TqikcRF/zvxQxghHovfY/cfM1eFWE5j9pcwp7GJPrv5ehC2fbYPO/KUV2nGg0/795OhmUaqEFwFQeuy4j+eq/ePiwytEp9L8DuqWfW+8BQLytJylXHPY/PlP4Qr8q7r+kDLLri0P1vxT4ShWL+Oo/DMsWg0zlv7/S9fINXGjtv73m373LRPW/+xg/Gaxd8b94MdQEfW0AwLjBLbDOHO+/kmm4ANp49L+cShSMMbAEwKyjUgWirAdAo2q2uqM08L99wKzM+7H2v3RdlNBXFgnA8S9+ewyV/z+vaSZre3Pxv6riWFiWZfi/2J7VSZZ60j+LES81zPn3v+OrlPMN3PK/quJYWJZl+L/OZbufkEcEQLCNB/1lPOO/Y2nmTbY/87+q4lhYlmX4v7CNB/1lPOO/zmW7n5BHBEBwKD1Aa57LP/XsSsw7RbU/PMDPJGsfoD/TqningGKIPzFtCLYmb3I/qYfrJr7eWz9pQmleXRFFP0rWlJkA2i8/pCvcttgTGD9Dt8IWbjMCPyCG4GRlhOs+1JI2GhDN1D7ns8cGvXK/Pi8m8UTJxac+hNTfA2z4kT7GI8kjLyt7Pv//////HwAI//////8zEAj/////fzIgCP////9vMjAI/////2MyQAj///8/YjJQCP///zdiMmAI////M2IycAj//78zYjKACP//qzNiMpAI/3+rM2IyoAj/D6szYjKwCP8DqzNiMsAIvwOrM2Iy0AifA6szYjLgCJkDqzNiMvAI//////8/Dwj//////ysfCP////9/KS8I/////z8pPwj/////OSlPCP///z84KV8I////Dzgpbwj///8OOCl/CP//Hw44KY8I//8PDjgpnwj/fw0OOCmvCP8PDQ44Kb8I/w0NDjgpzwj/DA0OOCnfCMcMDQ44Ke8IxAwNDjgp/wgHAAAABwAAAAEAAAACAAAABAAAAAMAAAAAAAAAAAAAAAcAAAADAAAAAQAAAAIAAAAFAAAABAAAAAAAAAAAAAAABAAAAAQAAAAAAAAAAgAAAAEAAAADAAAADgAAAAYAAAALAAAAAgAAAAcAAAABAAAAGAAAAAUAAAAKAAAAAQAAAAYAAAAAAAAAJgAAAAcAAAAMAAAAAwAAAAgAAAACAAAAMQAAAAkAAAAOAAAAAAAAAAUAAAAEAAAAOgAAAAgAAAANAAAABAAAAAkAAAADAAAAPwAAAAsAAAAGAAAADwAAAAoAAAAQAAAASAAAAAwAAAAHAAAAEAAAAAsAAAARAAAAUwAAAAoAAAAFAAAAEwAAAA4AAAAPAAAAYQAAAA0AAAAIAAAAEQAAAAwAAAASAAAAawAAAA4AAAAJAAAAEgAAAA0AAAATAAAAdQAAAA8AAAATAAAAEQAAABIAAAAQAAAABgAAAAIAAAADAAAABQAAAAQAAAAAAAAAAAAAAAAAAAAGAAAAAgAAAAMAAAABAAAABQAAAAQAAAAAAAAAAAAAAAcAAAAFAAAAAwAAAAQAAAABAAAAAAAAAAIAAAAAAAAAAgAAAAMAAAABAAAABQAAAAQAAAAGAAAAAAAAAAAAAAAYLURU+yH5PxgtRFT7Ifm/GC1EVPshCUAYLURU+yEJwGFsZ29zLmMAaDNOZWlnaGJvclJvdGF0aW9ucwBjZWxsc1RvTXVsdGlQb2x5LmMAY2VsbFRvRWRnZUFyY3MAAAEDAgQABAMFAQJjYW5jZWxBcmNQYWlycwBjcmVhdGVTb3J0YWJsZUxvb3AAZGlyZWN0ZWRFZGdlLmMAZGlyZWN0ZWRFZGdlVG9Cb3VuZGFyeQBhZGphY2VudEZhY2VEaXJbdG1wRmlqay5mYWNlXVtmaWprLmZhY2VdID09IEtJAGZhY2VpamsuYwBfZmFjZUlqa1BlbnRUb0NlbGxCb3VuZGFyeQBhZGphY2VudEZhY2VEaXJbY2VudGVySUpLLmZhY2VdW2ZhY2UyXSA9PSBLSQBfZmFjZUlqa1RvQ2VsbEJvdW5kYXJ5AGgzSW5kZXguYwBjb21wYWN0Q2VsbHMAdmVjM1RvQ2VsbABjZWxsVG9DaGlsZFBvcwB2YWxpZGF0ZUNoaWxkUG9zAHJldkRpciAhPSBJTlZBTElEX0RJR0lUAGxvY2FsaWouYwBjZWxsVG9Mb2NhbElqawBiYXNlQ2VsbCAhPSBvcmlnaW5CYXNlQ2VsbAAhKG9yaWdpbk9uUGVudCAmJiBpbmRleE9uUGVudCkAYmFzZUNlbGwgPT0gb3JpZ2luQmFzZUNlbGwALi4vaW5jbHVkZS9jb29yZGlqay5oAF91cEFwN0NoZWNrZWQAX3VwQXA3ckNoZWNrZWQAYmFzZUNlbGwgIT0gSU5WQUxJRF9CQVNFX0NFTEwAbG9jYWxJamtUb0NlbGwAIV9pc0Jhc2VDZWxsUGVudGFnb24oYmFzZUNlbGwpAGJhc2VDZWxsUm90YXRpb25zID49IDAAZ3JpZFBhdGhDZWxsc0ludGVycG9sYXRlAHBvbHlmaWxsLmMAaXRlclN0ZXBQb2x5Z29uQ29tcGFjdAAwAHZlcnRleC5jAHZlcnRleFJvdGF0aW9ucwBjZWxsVG9WZXJ0ZXg=";var vt=28400;function Tt(Le){return Le}function qe(Le){var it=/\b__Z[\w\d_]+/g;return Le.replace(it,function(Dt){var He=Dt;return Dt===He?Dt:He+" ["+Dt+"]"})}function Je(){var Le=new Error;if(!Le.stack){try{throw new Error(0)}catch(it){Le=it}if(!Le.stack)return"(no stack trace available)"}return Le.stack.toString()}function Pt(){var Le=Je();return e.extraStackTrace&&(Le+=`4130-`+e.extraStackTrace()),qe(Le)}function rn(Le,it,Dt,He){km("Assertion failed: "+L(Le)+", at: "+[it?L(it):"unknown filename",Dt,He?L(He):"unknown function"])}function Lt(){return Y.length}function Rt(Le,it,Dt){H.set(H.subarray(it,it+Dt),Le)}function fn(Le){return e.___errno_location&&(te[e.___errno_location()>>2]=Le),Le}function wn(Le){km("OOM")}function Dn(Le){try{var it=new ArrayBuffer(Le);return it.byteLength!=Le?void 0:(new Int8Array(it).set(Y),sn(it),Re(it),1)}catch{}}function ye(Le){var it=Lt(),Dt=16777216,He=2147483648-Dt;if(Le>He)return!1;for(var h=16777216,sr=Math.max(it,h);sr<Le;)sr<=536870912?sr=G(2*sr,Dt):sr=Math.min(G((3*sr+2147483648)/4,Dt),He);var Ii=Dn(sr);return!!Ii}var wt=typeof atob=="function"?atob:function(Le){var it="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Dt="",He,h,sr,Ii,ie,or,sl,fo=0;Le=Le.replace(/[^A-Za-z0-9\+\/\=]/g,"");do Ii=it.indexOf(Le.charAt(fo++)),ie=it.indexOf(Le.charAt(fo++)),or=it.indexOf(Le.charAt(fo++)),sl=it.indexOf(Le.charAt(fo++)),He=Ii<<2|ie>>4,h=(ie&15)<<4|or>>2,sr=(or&3)<<6|sl,Dt=Dt+String.fromCharCode(He),or!==64&&(Dt=Dt+String.fromCharCode(h)),sl!==64&&(Dt=Dt+String.fromCharCode(sr));while(fo<Le.length);return Dt};function Ze(Le){try{for(var it=wt(Le),Dt=new Uint8Array(it.length),He=0;He<it.length;++He)Dt[He]=it.charCodeAt(He);return Dt}catch{throw new Error("Converting base64 string to bytes failed.")}}function St(Le){if(Te(Le))return Ze(Le.slice(Z.length))}var Bt={Math,Int8Array,Int32Array,Uint8Array,Float32Array,Float64Array},ut={a:km,b:f,c:d,d:rn,e:fn,f:Lt,g:Rt,h:ye,i:wn,j:Tt,k:qe,l:Dn,m:Je,n:Pt,o:vt,p:Fe},Ce=(function(Le,it,Dt){"almost asm";var He=new Le.Int8Array(Dt),h=new Le.Int32Array(Dt),sr=new Le.Uint8Array(Dt),Ii=new Le.Float32Array(Dt),ie=new Le.Float64Array(Dt),or=it.o|0,sl=it.p|0,fo=Le.Math.floor,Qs=Le.Math.abs,bs=Le.Math.sqrt,ii=Le.Math.cos,zi=Le.Math.sin,nT=Le.Math.tan,hce=Le.Math.acos,qx=Le.Math.asin,UG=Le.Math.atan,Sa=Le.Math.atan2,b1=Le.Math.ceil,ol=Le.Math.imul,JP=Le.Math.min,fce=Le.Math.max,qf=Le.Math.clz32,dce=it.a,On=it.b,ee=it.c,di=it.d,kG=it.e,pce=it.f,mce=it.g,Ace=it.h,gce=it.i,Q=28416;function vce(p){return He=new Int8Array(p),sr=new Uint8Array(p),h=new Int32Array(p),Ii=new Float32Array(p),ie=new Float64Array(p),Dt=p,!0}function _ce(p){p=p|0;var m=0;return m=Q,Q=Q+p|0,Q=Q+15&-16,m|0}function xce(){return Q|0}function yce(p){p=p|0,Q=p}function bce(p,m){p=p|0,m=m|0,Q=p}function wce(p,m){p=p|0,m=m|0;var g=0,_=0,v=0;return(p|0)<0?(m=2,m|0):(p|0)>13780509?(m=oT(15,m)|0,m|0):(g=((p|0)<0)<<31>>31,v=wr(p|0,g|0,3,0)|0,_=ee()|0,g=At(p|0,g|0,1,0)|0,g=wr(v|0,_|0,g|0,ee()|0)|0,g=At(g|0,ee()|0,1,0)|0,p=ee()|0,h[m>>2]=g,h[m+4>>2]=p,m=0,m|0)}function zG(p,m,g,_){return p=p|0,m=m|0,g=g|0,_=_|0,VG(p,m,g,_,0)|0}function VG(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0;if(M=Q,Q=Q+16|0,b=M,!(GG(p,m,g,_,v)|0))return _=0,Q=M,_|0;do if((g|0)>=0){if((g|0)>13780509){if(x=oT(15,b)|0,x|0)break;E=b,b=h[E>>2]|0,E=h[E+4>>2]|0}else x=((g|0)<0)<<31>>31,N=wr(g|0,x|0,3,0)|0,E=ee()|0,x=At(g|0,x|0,1,0)|0,x=wr(N|0,E|0,x|0,ee()|0)|0,x=At(x|0,ee()|0,1,0)|0,E=ee()|0,h[b>>2]=x,h[b+4>>2]=E,b=x;if(up(_|0,0,b<<3|0)|0,v|0){up(v|0,0,b<<2|0)|0,x=ih(p,m,g,_,v,b,E,0)|0;break}x=Ta(b,4)|0,x?(N=ih(p,m,g,_,x,b,E,0)|0,_t(x),x=N):x=13}else x=2;while(!1);return N=x,Q=M,N|0}function GG(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0;if(ae=Q,Q=Q+16|0,X=ae,K=ae+8|0,j=X,h[j>>2]=p,h[j+4>>2]=m,(g|0)<0)return K=2,Q=ae,K|0;if(x=_,h[x>>2]=p,h[x+4>>2]=m,x=(v|0)!=0,x&&(h[v>>2]=0),Zi(p,m)|0)return K=9,Q=ae,K|0;h[K>>2]=0;e:do if((g|0)>=1)if(x)for(U=1,N=0,q=0,j=1,x=p;;){if(!(N|q)){if(x=Js(x,m,4,K,X)|0,x|0)break e;if(m=X,x=h[m>>2]|0,m=h[m+4>>2]|0,Zi(x,m)|0){x=9;break e}}if(x=Js(x,m,h[26864+(q<<2)>>2]|0,K,X)|0,x|0)break e;if(m=X,x=h[m>>2]|0,m=h[m+4>>2]|0,p=_+(U<<3)|0,h[p>>2]=x,h[p+4>>2]=m,h[v+(U<<2)>>2]=j,p=N+1|0,b=(p|0)==(j|0),E=q+1|0,M=(E|0)==6,Zi(x,m)|0){x=9;break e}if(j=j+(M&b&1)|0,(j|0)>(g|0)){x=0;break}else U=U+1|0,N=b?0:p,q=b?M?0:E:q}else for(U=1,N=0,q=0,j=1,x=p;;){if(!(N|q)){if(x=Js(x,m,4,K,X)|0,x|0)break e;if(m=X,x=h[m>>2]|0,m=h[m+4>>2]|0,Zi(x,m)|0){x=9;break e}}if(x=Js(x,m,h[26864+(q<<2)>>2]|0,K,X)|0,x|0)break e;if(m=X,x=h[m>>2]|0,m=h[m+4>>2]|0,p=_+(U<<3)|0,h[p>>2]=x,h[p+4>>2]=m,p=N+1|0,b=(p|0)==(j|0),E=q+1|0,M=(E|0)==6,Zi(x,m)|0){x=9;break e}if(j=j+(M&b&1)|0,(j|0)>(g|0)){x=0;break}else U=U+1|0,N=b?0:p,q=b?M?0:E:q}else x=0;while(!1);return K=x,Q=ae,K|0}function ih(p,m,g,_,v,x,b,E){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0,x=x|0,b=b|0,E=E|0;var M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0;if(ae=Q,Q=Q+16|0,X=ae+8|0,K=ae,M=Hf(p|0,m|0,x|0,b|0)|0,U=ee()|0,q=_+(M<<3)|0,ue=q,xe=h[ue>>2]|0,ue=h[ue+4>>2]|0,N=(xe|0)==(p|0)&(ue|0)==(m|0),!((xe|0)==0&(ue|0)==0|N))do M=At(M|0,U|0,1,0)|0,M=cp(M|0,ee()|0,x|0,b|0)|0,U=ee()|0,q=_+(M<<3)|0,xe=q,ue=h[xe>>2]|0,xe=h[xe+4>>2]|0,N=(ue|0)==(p|0)&(xe|0)==(m|0);while(!((ue|0)==0&(xe|0)==0|N));if(M=v+(M<<2)|0,N&&(h[M>>2]|0)<=(E|0)||(xe=q,h[xe>>2]=p,h[xe+4>>2]=m,h[M>>2]=E,(E|0)>=(g|0)))return xe=0,Q=ae,xe|0;switch(N=E+1|0,h[X>>2]=0,M=Js(p,m,2,X,K)|0,M|0){case 9:{j=9;break}case 0:{M=K,M=ih(h[M>>2]|0,h[M+4>>2]|0,g,_,v,x,b,N)|0,M||(j=9);break}default:}e:do if((j|0)==9){switch(h[X>>2]=0,M=Js(p,m,3,X,K)|0,M|0){case 9:break;case 0:{if(M=K,M=ih(h[M>>2]|0,h[M+4>>2]|0,g,_,v,x,b,N)|0,M|0)break e;break}default:break e}switch(h[X>>2]=0,M=Js(p,m,1,X,K)|0,M|0){case 9:break;case 0:{if(M=K,M=ih(h[M>>2]|0,h[M+4>>2]|0,g,_,v,x,b,N)|0,M|0)break e;break}default:break e}switch(h[X>>2]=0,M=Js(p,m,5,X,K)|0,M|0){case 9:break;case 0:{if(M=K,M=ih(h[M>>2]|0,h[M+4>>2]|0,g,_,v,x,b,N)|0,M|0)break e;break}default:break e}switch(h[X>>2]=0,M=Js(p,m,4,X,K)|0,M|0){case 9:break;case 0:{if(M=K,M=ih(h[M>>2]|0,h[M+4>>2]|0,g,_,v,x,b,N)|0,M|0)break e;break}default:break e}switch(h[X>>2]=0,M=Js(p,m,6,X,K)|0,M|0){case 9:break;case 0:{if(M=K,M=ih(h[M>>2]|0,h[M+4>>2]|0,g,_,v,x,b,N)|0,M|0)break e;break}default:break e}return xe=0,Q=ae,xe|0}while(!1);return xe=M,Q=ae,xe|0}function Js(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0;if(g>>>0>6)return v=1,v|0;b=(h[_>>2]|0)%6|0,h[_>>2]=b;e:do if((b|0)>0)for(x=0;;){switch(g|0){case 1:{g=5;break}case 5:{g=4;break}case 4:{g=6;break}case 6:{g=2;break}case 2:{g=3;break}case 3:{g=1;break}default:}if(x=x+1|0,(x|0)==(b|0))break e}while(!1);if(q=tt(p|0,m|0,45)|0,ee()|0,U=q&127,U>>>0>121)return v=5,v|0;M=al(p,m)|0,x=tt(p|0,m|0,52)|0,ee()|0,x=x&15;e:do if(!x)N=15;else{for(;;){if(b=(15-x|0)*3|0,E=tt(p|0,m|0,b|0)|0,ee()|0,E=E&7,(E|0)==7){m=5;break}if(K=(_c(x)|0)==0,x=x+-1|0,j=ft(7,0,b|0)|0,m=m&~(ee()|0),X=ft(h[(K?432:16)+(E*28|0)+(g<<2)>>2]|0,0,b|0)|0,b=ee()|0,g=h[(K?640:224)+(E*28|0)+(g<<2)>>2]|0,p=X|p&~j,m=b|m,!g){g=0;break e}if(!x){N=15;break e}}return m|0}while(!1);(N|0)==15&&(K=h[848+(U*28|0)+(g<<2)>>2]|0,X=ft(K|0,0,45)|0,p=X|p,m=ee()|0|m&-1040385,g=h[4272+(U*28|0)+(g<<2)>>2]|0,(K&127|0)==127&&(K=ft(h[848+(U*28|0)+20>>2]|0,0,45)|0,m=ee()|0|m&-1040385,g=h[4272+(U*28|0)+20>>2]|0,p=zm(K|p,m)|0,m=ee()|0,h[_>>2]=(h[_>>2]|0)+1)),E=tt(p|0,m|0,45)|0,ee()|0,E=E&127;e:do if(yr(E)|0){t:do if((al(p,m)|0)==1){if((U|0)!=(E|0))if(jG(E,h[7696+(U*28|0)>>2]|0)|0){p=hL(p,m)|0,b=1,m=ee()|0;break}else di(27634,26928,533,26936);switch(M|0){case 3:{p=zm(p,m)|0,m=ee()|0,h[_>>2]=(h[_>>2]|0)+1,b=0;break t}case 5:{p=hL(p,m)|0,m=ee()|0,h[_>>2]=(h[_>>2]|0)+5,b=0;break t}case 0:return K=9,K|0;default:return K=1,K|0}}else b=0;while(!1);if((g|0)>0){x=0;do p=uL(p,m)|0,m=ee()|0,x=x+1|0;while((x|0)!=(g|0))}if((U|0)!=(E|0)){if(!(eL(E)|0)){if((b|0)!=0|(al(p,m)|0)!=5)break;h[_>>2]=(h[_>>2]|0)+1;break}switch(q&127){case 8:case 118:break e;default:}(al(p,m)|0)!=3&&(h[_>>2]=(h[_>>2]|0)+1)}}else if((g|0)>0){x=0;do p=zm(p,m)|0,m=ee()|0,x=x+1|0;while((x|0)!=(g|0))}while(!1);return h[_>>2]=((h[_>>2]|0)+g|0)%6|0,K=v,h[K>>2]=p,h[K+4>>2]=m,K=0,K|0}function Sce(p,m,g,_){return p=p|0,m=m|0,g=g|0,_=_|0,qG(p,m,g,_)|0?(up(_|0,0,g*48|0)|0,_=Tce(p,m,g,_)|0,_|0):(_=0,_|0)}function qG(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0;if(K=Q,Q=Q+16|0,j=K,X=K+8|0,q=j,h[q>>2]=p,h[q+4>>2]=m,(g|0)<0)return X=2,Q=K,X|0;if(!g)return X=_,h[X>>2]=p,h[X+4>>2]=m,X=0,Q=K,X|0;h[X>>2]=0;e:do if(Zi(p,m)|0)p=9;else{v=0,q=p;do{if(p=Js(q,m,4,X,j)|0,p|0)break e;if(m=j,q=h[m>>2]|0,m=h[m+4>>2]|0,v=v+1|0,Zi(q,m)|0){p=9;break e}}while((v|0)<(g|0));U=_,h[U>>2]=q,h[U+4>>2]=m,U=g+-1|0,N=0,p=1;do{if(v=26864+(N<<2)|0,(N|0)==5)for(b=h[v>>2]|0,x=0,v=p;;){if(p=j,p=Js(h[p>>2]|0,h[p+4>>2]|0,b,X,j)|0,p|0)break e;if((x|0)!=(U|0))if(M=j,E=h[M>>2]|0,M=h[M+4>>2]|0,p=_+(v<<3)|0,h[p>>2]=E,h[p+4>>2]=M,!(Zi(E,M)|0))p=v+1|0;else{p=9;break e}else p=v;if(x=x+1|0,(x|0)>=(g|0))break;v=p}else for(b=j,M=h[v>>2]|0,E=0,v=p,x=h[b>>2]|0,b=h[b+4>>2]|0;;){if(p=Js(x,b,M,X,j)|0,p|0)break e;if(b=j,x=h[b>>2]|0,b=h[b+4>>2]|0,p=_+(v<<3)|0,h[p>>2]=x,h[p+4>>2]=b,p=v+1|0,Zi(x,b)|0){p=9;break e}if(E=E+1|0,(E|0)>=(g|0))break;v=p}N=N+1|0}while(N>>>0<6);p=j,p=(q|0)==(h[p>>2]|0)&&(m|0)==(h[p+4>>2]|0)?0:9}while(!1);return X=p,Q=K,X|0}function Tce(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0;if(q=Q,Q=Q+16|0,b=q,!g)return h[_>>2]=p,h[_+4>>2]=m,_=0,Q=q,_|0;do if((g|0)>=0){if((g|0)>13780509){if(v=oT(15,b)|0,v|0)break;x=b,v=h[x>>2]|0,x=h[x+4>>2]|0}else v=((g|0)<0)<<31>>31,U=wr(g|0,v|0,3,0)|0,x=ee()|0,v=At(g|0,v|0,1,0)|0,v=wr(U|0,x|0,v|0,ee()|0)|0,v=At(v|0,ee()|0,1,0)|0,x=ee()|0,U=b,h[U>>2]=v,h[U+4>>2]=x;if(N=Ta(v,8)|0,!N)v=13;else{if(U=Ta(v,4)|0,!U){_t(N),v=13;break}if(v=ih(p,m,g,N,U,v,x,0)|0,v|0){_t(N),_t(U);break}if(m=h[b>>2]|0,b=h[b+4>>2]|0,(b|0)>0|(b|0)==0&m>>>0>0){v=0,E=0,M=0;do p=N+(E<<3)|0,x=h[p>>2]|0,p=h[p+4>>2]|0,!((x|0)==0&(p|0)==0)&&(h[U+(E<<2)>>2]|0)==(g|0)&&(j=_+(v<<3)|0,h[j>>2]=x,h[j+4>>2]=p,v=v+1|0),E=At(E|0,M|0,1,0)|0,M=ee()|0;while((M|0)<(b|0)|(M|0)==(b|0)&E>>>0<m>>>0)}_t(N),_t(U),v=0}}else v=2;while(!1);return j=v,Q=q,j|0}function iT(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0;for(E=Q,Q=Q+16|0,x=E,b=E+8|0,v=(Zi(p,m)|0)==0,v=v?1:2;;){if(h[b>>2]=0,N=(Js(p,m,v,b,x)|0)==0,M=x,N&((h[M>>2]|0)==(g|0)?(h[M+4>>2]|0)==(_|0):0)){p=4;break}if(v=v+1|0,v>>>0>=7){v=7,p=4;break}}return(p|0)==4?(Q=E,v|0):0}function Ece(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0;if(E=Q,Q=Q+48|0,v=E+16|0,x=E+8|0,b=E,g=Kx(g)|0,g|0)return b=g,Q=E,b|0;if(N=p,M=h[N+4>>2]|0,g=x,h[g>>2]=h[N>>2],h[g+4>>2]=M,uq(x,v),g=ZG(v,m,b)|0,!g){if(m=h[x>>2]|0,x=h[p+8>>2]|0,(x|0)>0){v=h[p+12>>2]|0,g=0;do m=(h[v+(g<<3)>>2]|0)+m|0,g=g+1|0;while((g|0)<(x|0))}g=b,v=h[g>>2]|0,g=h[g+4>>2]|0,x=((m|0)<0)<<31>>31,(g|0)<(x|0)|(g|0)==(x|0)&v>>>0<m>>>0?(g=b,h[g>>2]=m,h[g+4>>2]=x,g=x):m=v,M=At(m|0,g|0,12,0)|0,N=ee()|0,g=b,h[g>>2]=M,h[g+4>>2]=N,g=_,h[g>>2]=M,h[g+4>>2]=N,g=0}return N=g,Q=E,N|0}function HG(p,m,g,_,v,x,b){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0,x=x|0,b=b|0;var E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0,be=0,gt=0,je=0,Ut=0,lt=0,pt=0,pi=0,bi=0,Ro=0,Vn=0,wi=0,Ea=0;if(bi=Q,Q=Q+64|0,Ut=bi+48|0,lt=bi+32|0,pt=bi+24|0,Be=bi+8|0,Ke=bi,M=h[p>>2]|0,(M|0)<=0)return pi=0,Q=bi,pi|0;for(Me=p+4|0,be=Ut+8|0,gt=lt+8|0,je=Be+8|0,E=0,we=0;;){N=h[Me>>2]|0,se=N+(we<<4)|0,h[Ut>>2]=h[se>>2],h[Ut+4>>2]=h[se+4>>2],h[Ut+8>>2]=h[se+8>>2],h[Ut+12>>2]=h[se+12>>2],(we|0)==(M+-1|0)?(h[lt>>2]=h[N>>2],h[lt+4>>2]=h[N+4>>2],h[lt+8>>2]=h[N+8>>2],h[lt+12>>2]=h[N+12>>2]):(se=N+(we+1<<4)|0,h[lt>>2]=h[se>>2],h[lt+4>>2]=h[se+4>>2],h[lt+8>>2]=h[se+8>>2],h[lt+12>>2]=h[se+12>>2]),M=Vce(Ut,lt,_,pt)|0;e:do if(M)N=0,E=M;else if(M=pt,N=h[M>>2]|0,M=h[M+4>>2]|0,(M|0)>0|(M|0)==0&N>>>0>0){xe=0,se=0;t:for(;;){if(Vn=1/(+(N>>>0)+4294967296*+(M|0)),Ea=+ie[Ut>>3],M=eo(N|0,M|0,xe|0,se|0)|0,wi=+(M>>>0)+4294967296*+(ee()|0),Ro=+(xe>>>0)+4294967296*+(se|0),ie[Be>>3]=Vn*(Ea*wi)+Vn*(+ie[lt>>3]*Ro),ie[je>>3]=Vn*(+ie[be>>3]*wi)+Vn*(+ie[gt>>3]*Ro),M=fL(Be,_,Ke)|0,M|0){E=M;break}ue=Ke,ae=h[ue>>2]|0,ue=h[ue+4>>2]|0,j=Hf(ae|0,ue|0,m|0,g|0)|0,U=ee()|0,M=b+(j<<3)|0,q=M,N=h[q>>2]|0,q=h[q+4>>2]|0;n:do if((N|0)==0&(q|0)==0)Ae=M,pi=16;else for(X=0,K=0;;){if((X|0)>(g|0)|(X|0)==(g|0)&K>>>0>m>>>0){E=1;break t}if((N|0)==(ae|0)&(q|0)==(ue|0))break n;if(M=At(j|0,U|0,1,0)|0,j=cp(M|0,ee()|0,m|0,g|0)|0,U=ee()|0,K=At(K|0,X|0,1,0)|0,X=ee()|0,M=b+(j<<3)|0,q=M,N=h[q>>2]|0,q=h[q+4>>2]|0,(N|0)==0&(q|0)==0){Ae=M,pi=16;break}}while(!1);if((pi|0)==16&&(pi=0,!((ae|0)==0&(ue|0)==0))&&(K=Ae,h[K>>2]=ae,h[K+4>>2]=ue,K=x+(h[v>>2]<<3)|0,h[K>>2]=ae,h[K+4>>2]=ue,K=v,K=At(h[K>>2]|0,h[K+4>>2]|0,1,0)|0,ae=ee()|0,ue=v,h[ue>>2]=K,h[ue+4>>2]=ae),xe=At(xe|0,se|0,1,0)|0,se=ee()|0,M=pt,N=h[M>>2]|0,M=h[M+4>>2]|0,!((M|0)>(se|0)|(M|0)==(se|0)&N>>>0>xe>>>0)){N=1;break e}}N=0}else N=1;while(!1);if(we=we+1|0,!N){pi=21;break}if(M=h[p>>2]|0,(we|0)>=(M|0)){E=0,pi=21;break}}return(pi|0)==21?(Q=bi,E|0):0}function Mce(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0,be=0,gt=0,je=0,Ut=0,lt=0,pt=0,pi=0,bi=0,Ro=0,Vn=0,wi=0;if(wi=Q,Q=Q+112|0,pi=wi+80|0,M=wi+72|0,bi=wi,Ro=wi+56|0,v=Kx(g)|0,v|0)return Vn=v,Q=wi,Vn|0;if(N=p+8|0,Vn=br((h[N>>2]<<5)+32|0)|0,!Vn)return Vn=13,Q=wi,Vn|0;if(_L(p,Vn),v=Kx(g)|0,!v){if(lt=p,pt=h[lt+4>>2]|0,v=M,h[v>>2]=h[lt>>2],h[v+4>>2]=pt,uq(M,pi),v=ZG(pi,m,bi)|0,v)lt=0,pt=0;else{if(v=h[M>>2]|0,x=h[N>>2]|0,(x|0)>0){b=h[p+12>>2]|0,g=0;do v=(h[b+(g<<3)>>2]|0)+v|0,g=g+1|0;while((g|0)!=(x|0));g=v}else g=v;v=bi,x=h[v>>2]|0,v=h[v+4>>2]|0,b=((g|0)<0)<<31>>31,(v|0)<(b|0)|(v|0)==(b|0)&x>>>0<g>>>0?(v=bi,h[v>>2]=g,h[v+4>>2]=b,v=b):g=x,lt=At(g|0,v|0,12,0)|0,pt=ee()|0,v=bi,h[v>>2]=lt,h[v+4>>2]=pt,v=0}if(!v){if(g=Ta(lt,8)|0,!g)return _t(Vn),Vn=13,Q=wi,Vn|0;if(E=Ta(lt,8)|0,!E)return _t(Vn),_t(g),Vn=13,Q=wi,Vn|0;je=pi,h[je>>2]=0,h[je+4>>2]=0,je=p,Ut=h[je+4>>2]|0,v=M,h[v>>2]=h[je>>2],h[v+4>>2]=Ut,v=HG(M,lt,pt,m,pi,g,E)|0;e:do if(v)_t(g),_t(E),_t(Vn);else{t:do if((h[N>>2]|0)>0){for(b=p+12|0,x=0;v=HG((h[b>>2]|0)+(x<<3)|0,lt,pt,m,pi,g,E)|0,x=x+1|0,!(v|0);)if((x|0)>=(h[N>>2]|0))break t;_t(g),_t(E),_t(Vn);break e}while(!1);(pt|0)>0|(pt|0)==0<>>>0>0&&up(E|0,0,lt<<3|0)|0,Ut=pi,je=h[Ut+4>>2]|0;t:do if((je|0)>0|(je|0)==0&(h[Ut>>2]|0)>>>0>0){Me=g,be=E,gt=g,je=E,Ut=g,v=g,Ae=g,Be=E,Ke=E,g=E;n:for(;;){for(ue=0,xe=0,se=0,we=0,x=0,b=0;;){E=bi,M=E+56|0;do h[E>>2]=0,E=E+4|0;while((E|0)<(M|0));if(m=Me+(ue<<3)|0,N=h[m>>2]|0,m=h[m+4>>2]|0,GG(N,m,1,bi,0)|0){E=bi,M=E+56|0;do h[E>>2]=0,E=E+4|0;while((E|0)<(M|0));E=Ta(7,4)|0,E|0&&(ih(N,m,1,bi,E,7,0,0)|0,_t(E))}for(ae=0;;){K=bi+(ae<<3)|0,X=h[K>>2]|0,K=h[K+4>>2]|0;i:do if((X|0)==0&(K|0)==0)E=x,M=b;else{if(U=Hf(X|0,K|0,lt|0,pt|0)|0,N=ee()|0,E=_+(U<<3)|0,m=E,M=h[m>>2]|0,m=h[m+4>>2]|0,!((M|0)==0&(m|0)==0)){q=0,j=0;do{if((q|0)>(pt|0)|(q|0)==(pt|0)&j>>>0>lt>>>0)break n;if((M|0)==(X|0)&(m|0)==(K|0)){E=x,M=b;break i}E=At(U|0,N|0,1,0)|0,U=cp(E|0,ee()|0,lt|0,pt|0)|0,N=ee()|0,j=At(j|0,q|0,1,0)|0,q=ee()|0,E=_+(U<<3)|0,m=E,M=h[m>>2]|0,m=h[m+4>>2]|0}while(!((M|0)==0&(m|0)==0))}if((X|0)==0&(K|0)==0){E=x,M=b;break}T1(X,K,Ro)|0,xL(p,Vn,Ro)|0&&(j=At(x|0,b|0,1,0)|0,b=ee()|0,q=E,h[q>>2]=X,h[q+4>>2]=K,x=be+(x<<3)|0,h[x>>2]=X,h[x+4>>2]=K,x=j),E=x,M=b}while(!1);if(ae=ae+1|0,ae>>>0>=7)break;x=E,b=M}if(ue=At(ue|0,xe|0,1,0)|0,xe=ee()|0,se=At(se|0,we|0,1,0)|0,we=ee()|0,b=pi,x=h[b>>2]|0,b=h[b+4>>2]|0,(we|0)<(b|0)|(we|0)==(b|0)&se>>>0<x>>>0)x=E,b=M;else break}if((b|0)>0|(b|0)==0&x>>>0>0){x=0,b=0;do we=Me+(x<<3)|0,h[we>>2]=0,h[we+4>>2]=0,x=At(x|0,b|0,1,0)|0,b=ee()|0,we=pi,se=h[we+4>>2]|0;while((b|0)<(se|0)|((b|0)==(se|0)?x>>>0<(h[we>>2]|0)>>>0:0))}if(we=pi,h[we>>2]=E,h[we+4>>2]=M,(M|0)>0|(M|0)==0&E>>>0>0)ae=g,ue=Ke,xe=Ut,se=Be,we=be,g=Ae,Ke=v,Be=gt,Ae=ae,v=ue,Ut=je,je=xe,gt=se,be=Me,Me=we;else break t}_t(gt),_t(je),_t(Vn),v=1;break e}else v=E;while(!1);_t(Vn),_t(g),_t(v),v=0}while(!1);return Vn=v,Q=wi,Vn|0}}return _t(Vn),Vn=v,Q=wi,Vn|0}function Cce(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0;if(E=Q,Q=Q+16|0,b=E,p=qce(p,m,((m|0)<0)<<31>>31,b)|0,p|0)return b=p,Q=E,b|0;if(x=Sue(b,g)|0,g=b+4|0,(h[b>>2]|0)>0){m=0;do{if(v=h[g>>2]|0,_=v+(m<<4)+4|0,_t(h[_>>2]|0),h[_>>2]=0,h[v+(m<<4)>>2]=0,_=v+(m<<4)+8|0,v=v+(m<<4)+12|0,(h[_>>2]|0)>0){p=0;do M=h[v>>2]|0,N=M+(p<<3)+4|0,_t(h[N>>2]|0),h[N>>2]=0,h[M+(p<<3)>>2]=0,p=p+1|0;while((p|0)<(h[_>>2]|0))}_t(h[v>>2]|0),h[v>>2]=0,h[_>>2]=0,m=m+1|0}while((m|0)<(h[b>>2]|0))}return _t(h[g>>2]|0),h[g>>2]=0,h[b>>2]=0,N=x,Q=E,N|0}function vc(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0;if(b=h[p>>2]|0,(b|0)<=0)return v=0,_=0,b=v<0,_=12.566370614359172-_,_=v+_,v=b?_:v,ie[m>>3]=v,0;if(x=h[p+4>>2]|0,p=(b|0)!=1&1,E=+ie[x>>3]*.5+.7853981633974483,v=+ie[x+(p<<4)>>3]*.5+.7853981633974483,g=+zi(+E)*+zi(+v),_=+ie[x+(p<<4)+8>>3]-+ie[x+8>>3],g=+Sa(+(+zi(+_)*g),+(+ii(+E)*+ii(+v)+ +ii(+_)*g))*-2,_=g+0,g=_-g,(b|0)==1)return E=_,v=g,b=E<0,v=12.566370614359172-v,v=E+v,E=b?v:E,ie[m>>3]=E,0;for(p=1,v=_;U=p,p=p+1|0,q=(p|0)%(b|0)|0,N=+ie[x+(U<<4)>>3]*.5+.7853981633974483,M=+ie[x+(q<<4)>>3]*.5+.7853981633974483,_=+zi(+N)*+zi(+M),E=+ie[x+(q<<4)+8>>3]-+ie[x+(U<<4)+8>>3],g=+Sa(+(+zi(+E)*_),+(+ii(+N)*+ii(+M)+ +ii(+E)*_))*-2-g,_=v+g,g=_-v-g,!((p|0)>=(b|0));)v=_;return q=_<0,N=12.566370614359172-g,N=_+N,N=q?N:_,ie[m>>3]=N,0}function Rce(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0;return b=Q,Q=Q+192|0,_=b+176|0,v=b,x=b+168|0,p=Vm(p,m,v)|0,p|0?(x=p,Q=b,x|0):(h[x>>2]=h[v>>2],h[x+4>>2]=v+8,h[_>>2]=h[x>>2],h[_+4>>2]=h[x+4>>2],vc(_,g)|0,x=0,Q=b,x|0)}function Ice(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0;return b=Q,Q=Q+192|0,_=b+176|0,v=b,x=b+168|0,p=Vm(p,m,v)|0,p?(x=p,Q=b,x|0):(h[x>>2]=h[v>>2],h[x+4>>2]=v+8,h[_>>2]=h[x>>2],h[_+4>>2]=h[x+4>>2],vc(_,g)|0,ie[g>>3]=+ie[g>>3]*4058973249931477e-8,x=0,Q=b,x|0)}function Pce(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0;return b=Q,Q=Q+192|0,_=b+176|0,v=b,x=b+168|0,p=Vm(p,m,v)|0,p?(x=p,Q=b,x|0):(h[x>>2]=h[v>>2],h[x+4>>2]=v+8,h[_>>2]=h[x>>2],h[_+4>>2]=h[x+4>>2],vc(_,g)|0,ie[g>>3]=+ie[g>>3]*4058973249931477e-8*1e6,x=0,Q=b,x|0)}function yr(p){return p=p|0,p>>>0>121?(p=0,p|0):(p=h[7696+(p*28|0)+16>>2]|0,p|0)}function eL(p){return p=p|0,(p|0)==4|(p|0)==117|0}function WG(p){return p=p|0,h[11120+((h[p>>2]|0)*216|0)+((h[p+4>>2]|0)*72|0)+((h[p+8>>2]|0)*24|0)+(h[p+12>>2]<<3)>>2]|0}function Lce(p){return p=p|0,h[11120+((h[p>>2]|0)*216|0)+((h[p+4>>2]|0)*72|0)+((h[p+8>>2]|0)*24|0)+(h[p+12>>2]<<3)+4>>2]|0}function Dce(p,m){p=p|0,m=m|0,p=7696+(p*28|0)|0,h[m>>2]=h[p>>2],h[m+4>>2]=h[p+4>>2],h[m+8>>2]=h[p+8>>2],h[m+12>>2]=h[p+12>>2]}function Nce(p,m){p=p|0,m=m|0;var g=0,_=0;if(m>>>0>20)return m=-1,m|0;do if((h[11120+(m*216|0)>>2]|0)!=(p|0))if((h[11120+(m*216|0)+8>>2]|0)!=(p|0))if((h[11120+(m*216|0)+16>>2]|0)!=(p|0))if((h[11120+(m*216|0)+24>>2]|0)!=(p|0))if((h[11120+(m*216|0)+32>>2]|0)!=(p|0))if((h[11120+(m*216|0)+40>>2]|0)!=(p|0))if((h[11120+(m*216|0)+48>>2]|0)!=(p|0))if((h[11120+(m*216|0)+56>>2]|0)!=(p|0))if((h[11120+(m*216|0)+64>>2]|0)!=(p|0))if((h[11120+(m*216|0)+72>>2]|0)!=(p|0))if((h[11120+(m*216|0)+80>>2]|0)!=(p|0))if((h[11120+(m*216|0)+88>>2]|0)!=(p|0))if((h[11120+(m*216|0)+96>>2]|0)!=(p|0))if((h[11120+(m*216|0)+104>>2]|0)!=(p|0))if((h[11120+(m*216|0)+112>>2]|0)!=(p|0))if((h[11120+(m*216|0)+120>>2]|0)!=(p|0))if((h[11120+(m*216|0)+128>>2]|0)!=(p|0))if((h[11120+(m*216|0)+136>>2]|0)==(p|0))p=2,g=1,_=2;else{if((h[11120+(m*216|0)+144>>2]|0)==(p|0)){p=0,g=2,_=0;break}if((h[11120+(m*216|0)+152>>2]|0)==(p|0)){p=0,g=2,_=1;break}if((h[11120+(m*216|0)+160>>2]|0)==(p|0)){p=0,g=2,_=2;break}if((h[11120+(m*216|0)+168>>2]|0)==(p|0)){p=1,g=2,_=0;break}if((h[11120+(m*216|0)+176>>2]|0)==(p|0)){p=1,g=2,_=1;break}if((h[11120+(m*216|0)+184>>2]|0)==(p|0)){p=1,g=2,_=2;break}if((h[11120+(m*216|0)+192>>2]|0)==(p|0)){p=2,g=2,_=0;break}if((h[11120+(m*216|0)+200>>2]|0)==(p|0)){p=2,g=2,_=1;break}if((h[11120+(m*216|0)+208>>2]|0)==(p|0)){p=2,g=2,_=2;break}else p=-1;return p|0}else p=2,g=1,_=1;else p=2,g=1,_=0;else p=1,g=1,_=2;else p=1,g=1,_=1;else p=1,g=1,_=0;else p=0,g=1,_=2;else p=0,g=1,_=1;else p=0,g=1,_=0;else p=2,g=0,_=2;else p=2,g=0,_=1;else p=2,g=0,_=0;else p=1,g=0,_=2;else p=1,g=0,_=1;else p=1,g=0,_=0;else p=0,g=0,_=2;else p=0,g=0,_=1;else p=0,g=0,_=0;while(!1);return m=h[11120+(m*216|0)+(g*72|0)+(p*24|0)+(_<<3)+4>>2]|0,m|0}function jG(p,m){return p=p|0,m=m|0,(h[7696+(p*28|0)+20>>2]|0)==(m|0)?(m=1,m|0):(m=(h[7696+(p*28|0)+24>>2]|0)==(m|0),m|0)}function tL(p,m){return p=p|0,m=m|0,h[848+(p*28|0)+(m<<2)>>2]|0}function nL(p,m){return p=p|0,m=m|0,(h[848+(p*28|0)>>2]|0)==(m|0)?(m=0,m|0):(h[848+(p*28|0)+4>>2]|0)==(m|0)?(m=1,m|0):(h[848+(p*28|0)+8>>2]|0)==(m|0)?(m=2,m|0):(h[848+(p*28|0)+12>>2]|0)==(m|0)?(m=3,m|0):(h[848+(p*28|0)+16>>2]|0)==(m|0)?(m=4,m|0):(h[848+(p*28|0)+20>>2]|0)==(m|0)?(m=5,m|0):((h[848+(p*28|0)+24>>2]|0)==(m|0)?6:7)|0}function Fce(){return 122}function Bce(p){p=p|0;var m=0,g=0,_=0;m=0;do ft(m|0,0,45)|0,_=ee()|0|134225919,g=p+(m<<3)|0,h[g>>2]=-1,h[g+4>>2]=_,m=m+1|0;while((m|0)!=122);return 0}function Oce(p){p=p|0;var m=0,g=0,_=0;return _=+ie[p+16>>3],g=+ie[p+24>>3],m=_-g,+(_<g?m+6.283185307179586:m)}function Uce(p){return p=p|0,+ie[p+16>>3]<+ie[p+24>>3]|0}function kce(p){return p=p|0,+(+ie[p>>3]-+ie[p+8>>3])}function XG(p,m){p=p|0,m=m|0;var g=0,_=0,v=0;return g=+ie[m>>3],!(g>=+ie[p+8>>3])||!(g<=+ie[p>>3])?(m=0,m|0):(_=+ie[p+16>>3],g=+ie[p+24>>3],v=+ie[m+8>>3],m=v>=g,p=v<=_&1,_<g?m&&(p=1):m||(p=0),m=(p|0)!=0,m|0)}function iL(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0;return+ie[p>>3]<+ie[m+8>>3]||+ie[p+8>>3]>+ie[m>>3]?(_=0,_|0):(x=+ie[p+16>>3],g=p+24|0,U=+ie[g>>3],b=x<U,_=m+16|0,N=+ie[_>>3],v=m+24|0,M=+ie[v>>3],E=N<M,m=U-N<M-x,p=b?E|m?1:2:0,m=E?b?1:m?2:1:0,x=+kl(x,p),x<+kl(+ie[v>>3],m)||(U=+kl(+ie[g>>3],p),U>+kl(+ie[_>>3],m))?(E=0,E|0):(E=1,E|0))}function zce(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0;x=+ie[p+16>>3],M=+ie[p+24>>3],p=x<M,E=+ie[m+16>>3],b=+ie[m+24>>3],v=E<b,m=M-E<b-x,h[g>>2]=p?v|m?1:2:0,h[_>>2]=v?p?1:m?2:1:0}function $G(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0;return+ie[p>>3]<+ie[m>>3]||+ie[p+8>>3]>+ie[m+8>>3]?(_=0,_|0):(_=p+16|0,M=+ie[_>>3],x=+ie[p+24>>3],b=M<x,g=m+16|0,U=+ie[g>>3],v=m+24|0,N=+ie[v>>3],E=U<N,m=x-U<N-M,p=b?E|m?1:2:0,m=E?b?1:m?2:1:0,x=+kl(x,p),x<=+kl(+ie[v>>3],m)?(U=+kl(+ie[_>>3],p),E=U>=+kl(+ie[g>>3],m),E|0):(E=0,E|0))}function YG(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0;v=Q,Q=Q+176|0,_=v,h[_>>2]=4,E=+ie[m>>3],ie[_+8>>3]=E,x=+ie[m+16>>3],ie[_+16>>3]=x,ie[_+24>>3]=E,E=+ie[m+24>>3],ie[_+32>>3]=E,b=+ie[m+8>>3],ie[_+40>>3]=b,ie[_+48>>3]=E,ie[_+56>>3]=b,ie[_+64>>3]=x,m=_+72|0,g=m+96|0;do h[m>>2]=0,m=m+4|0;while((m|0)<(g|0));hu(p|0,_|0,168)|0,Q=v}function ZG(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0;K=Q,Q=Q+288|0,U=K+264|0,q=K+96|0,N=K,E=N,M=E+96|0;do h[E>>2]=0,E=E+4|0;while((E|0)<(M|0));return m=pL(m,N)|0,m|0?(X=m,Q=K,X|0):(M=N,N=h[M>>2]|0,M=h[M+4>>2]|0,T1(N,M,U)|0,Vm(N,M,q)|0,b=+$x(U,q+8|0),ie[U>>3]=+ie[p>>3],M=U+8|0,ie[M>>3]=+ie[p+16>>3],ie[q>>3]=+ie[p+8>>3],N=q+8|0,ie[N>>3]=+ie[p+24>>3],v=+$x(U,q),ue=+ie[M>>3]-+ie[N>>3],x=+Qs(+ue),ae=+ie[U>>3]-+ie[q>>3],_=+Qs(+ae),!(ue==0|ae==0)&&(ue=+wq(+x,+_),ue=+b1(+(v*v/+dT(+(ue/+dT(+x,+_)),3)/(b*(b*2.59807621135)*.8))),ie[or>>3]=ue,j=~~ue>>>0,X=+Qs(ue)>=1?ue>0?~~+JP(+fo(ue/4294967296),4294967295)>>>0:~~+b1((ue-+(~~ue>>>0))/4294967296)>>>0:0,(h[or+4>>2]&2146435072|0)!=2146435072)?(q=(j|0)==0&(X|0)==0,m=g,h[m>>2]=q?1:j,h[m+4>>2]=q?0:X,m=0):m=1,X=m,Q=K,X|0)}function Vce(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0;N=Q,Q=Q+288|0,b=N+264|0,E=N+96|0,M=N,v=M,x=v+96|0;do h[v>>2]=0,v=v+4|0;while((v|0)<(x|0));return g=pL(g,M)|0,g|0?(_=g,Q=N,_|0):(g=M,v=h[g>>2]|0,g=h[g+4>>2]|0,T1(v,g,b)|0,Vm(v,g,E)|0,U=+$x(b,E+8|0),U=+b1(+(+$x(p,m)/(U*2))),ie[or>>3]=U,g=~~U>>>0,v=+Qs(U)>=1?U>0?~~+JP(+fo(U/4294967296),4294967295)>>>0:~~+b1((U-+(~~U>>>0))/4294967296)>>>0:0,(h[or+4>>2]&2146435072|0)==2146435072?(_=1,Q=N,_|0):(M=(g|0)==0&(v|0)==0,h[_>>2]=M?1:g,h[_+4>>2]=M?0:v,_=0,Q=N,_|0))}function Gce(p,m){p=p|0,m=+m;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0;x=p+16|0,b=+ie[x>>3],g=p+24|0,v=+ie[g>>3],_=b-v,_=b<v?_+6.283185307179586:_,N=+ie[p>>3],E=p+8|0,M=+ie[E>>3],U=N-M,_=(_*m-_)*.5,m=(U*m-U)*.5,N=N+m,ie[p>>3]=N>1.5707963267948966?1.5707963267948966:N,m=M-m,ie[E>>3]=m<-1.5707963267948966?-1.5707963267948966:m,m=b+_,m=m>3.141592653589793?m+-6.283185307179586:m,ie[x>>3]=m<-3.141592653589793?m+6.283185307179586:m,m=v-_,m=m>3.141592653589793?m+-6.283185307179586:m,ie[g>>3]=m<-3.141592653589793?m+6.283185307179586:m}function qce(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0,be=0,gt=0,je=0,Ut=0,lt=0,pt=0;if(pt=Q,Q=Q+224|0,gt=pt,Be=pt+48|0,M=(g|0)>0|(g|0)==0&m>>>0>0,M&(g>>>0>0|(g|0)==0&m>>>0>17895697))return lt=14,Q=pt,lt|0;if((g|0)<0)return lt=2,Q=pt,lt|0;if((m|0)==0&(g|0)==0)return h[_>>2]=0,h[_+4>>2]=0,lt=0,Q=pt,lt|0;for(v=p,v=aL(h[v>>2]|0,h[v+4>>2]|0)|0,b=0,E=0;;){if(x=p+(b<<3)|0,lt=x,!(sT(h[lt>>2]|0,h[lt+4>>2]|0)|0)){v=5,je=159;break}if(lt=x,lt=(aL(h[lt>>2]|0,h[lt+4>>2]|0)|0)==(v|0),b=At(b|0,E|0,1,0)|0,E=ee()|0,!lt){v=12,je=159;break}if(!((E|0)<(g|0)|(E|0)==(g|0)&b>>>0<m>>>0)){je=8;break}}if((je|0)==8){do if((g|0)>0|(g|0)==0&m>>>0>1){if(v=m<<3,b=br(v)|0,!b)return lt=13,Q=pt,lt|0;for(hu(b|0,p|0,v|0)|0,cT(b,m,8,1),v=1,x=0;Ut=b+(v<<3)|0,lt=b+(v+-1<<3)|0,lt=(h[Ut>>2]|0)==(h[lt>>2]|0)?(h[Ut+4>>2]|0)==(h[lt+4>>2]|0):0,v=At(v|0,x|0,1,0)|0,x=ee()|0,!lt;)if(!((x|0)<(g|0)|(x|0)==(g|0)&v>>>0<m>>>0)){je=14;break}if((je|0)==14){_t(b);break}return _t(b),lt=10,Q=pt,lt|0}while(!1);if(v=wr(m|0,g|0,6,0)|0,x=ee()|0,M){b=0,E=0;do lt=p+(E<<3)|0,lt=((Zi(h[lt>>2]|0,h[lt+4>>2]|0)|0)!=0)<<31>>31,v=At(v|0,x|0,lt|0,((lt|0)<0)<<31>>31|0)|0,x=ee()|0,E=At(E|0,b|0,1,0)|0,b=ee()|0;while((b|0)<(g|0)|(b|0)==(g|0)&E>>>0<m>>>0);Ae=v,we=x}else Ae=v,we=x;if(xe=wr(Ae|0,we|0,10,0)|0,se=ee()|0,Ut=br(Ae<<5)|0,!Ut)return lt=13,Q=pt,lt|0;if(lt=Ta(xe,4)|0,!lt)return _t(Ut),lt=13,Q=pt,lt|0;e:do if(M){for(be=p,rL(h[be>>2]|0,h[be+4>>2]|0,gt)|0,X=Ut,K=0,ae=0,v=0,ue=0;;){M=gt,M=(h[M>>2]|0)==0&(h[M+4>>2]|0)==0,x=M?26990:26995,b=M?5:6,E=0,M=gt+((M&1)<<3)|0,N=At(b|0,E|0,-1,-1)|0,U=ee()|0,q=0,j=0;do Me=M+(q<<3)|0,Ke=h[Me+4>>2]|0,be=X+(q<<5)|0,h[be>>2]=h[Me>>2],h[be+4>>2]=Ke,He[X+(q<<5)+9>>0]=0,He[X+(q<<5)+8>>0]=0,h[X+(q<<5)+20>>2]=X,be=X+(q<<5)+24|0,h[be>>2]=1,h[be+4>>2]=0,be=He[x+q>>0]|0,Ke=At(N|0,U|0,q|0,j|0)|0,Ke=Hf(Ke|0,ee()|0,b|0,E|0)|0,ee()|0,Ke=He[x+Ke>>0]|0,q=At(q|0,j|0,1,0)|0,j=ee()|0,Me=He[x+((q|0)==(b|0)&(j|0)==(E|0)?0:q)>>0]|0,be=be&255,h[X+(be<<5)+16>>2]=X+((Ke&255)<<5),h[X+(be<<5)+12>>2]=X+((Me&255)<<5);while(j>>>0<E>>>0|(j|0)==(E|0)&q>>>0<b>>>0);if(K=At(K|0,ae|0,1,0)|0,ae=ee()|0,v=At(b|0,E|0,v|0,ue|0)|0,ue=ee()|0,!((ae|0)<(g|0)|(ae|0)==(g|0)&K>>>0<m>>>0))break e;be=p+(K<<3)|0,rL(h[be>>2]|0,h[be+4>>2]|0,gt)|0||(X=Ut+(v<<5)|0)}di(27634,26956,108,26975)}while(!1);if((we|0)>0|(we|0)==0&Ae>>>0>0){E=0,M=0;do{if(x=Ut+(E<<5)|0,b=h[x>>2]|0,x=h[x+4>>2]|0,v=tt(b|0,x|0,30)|0,x=wr(v^b|0,(ee()|0)^x|0,484763065,-1084733587)|0,b=ee()|0,v=tt(x|0,b|0,27)|0,b=wr(v^x|0,(ee()|0)^b|0,321982955,-1798288965)|0,x=ee()|0,v=tt(b|0,x|0,31)|0,x=Hf(v^b|0,(ee()|0)^x|0,xe|0,se|0)|0,b=ee()|0,v=lt+(x<<2)|0,h[v>>2]|0)do v=At(x|0,b|0,1,0)|0,x=cp(v|0,ee()|0,xe|0,se|0)|0,b=ee()|0,v=lt+(x<<2)|0;while((h[v>>2]|0)!=0);h[v>>2]=Ut+(E<<5),E=At(E|0,M|0,1,0)|0,M=ee()|0}while((M|0)<(we|0)|(M|0)==(we|0)&E>>>0<Ae>>>0);q=0,j=0;do{if(E=Ut+(q<<5)|0,M=Ut+(q<<5)+9|0,!(He[M>>0]|0)){if(be=E,QG(h[be>>2]|0,h[be+4>>2]|0,gt)|0){je=39;break}U=gt,N=h[U>>2]|0,U=h[U+4>>2]|0,x=tt(N|0,U|0,30)|0,x=wr(x^N|0,(ee()|0)^U|0,484763065,-1084733587)|0,b=ee()|0,v=tt(x|0,b|0,27)|0,b=wr(v^x|0,(ee()|0)^b|0,321982955,-1798288965)|0,x=ee()|0,v=tt(b|0,x|0,31)|0,x=Hf(v^b|0,(ee()|0)^x|0,xe|0,se|0)|0,b=ee()|0,v=h[lt+(x<<2)>>2]|0;e:do if(v|0){for(;be=v,!((h[be>>2]|0)==(N|0)&&(h[be+4>>2]|0)==(U|0));)if(v=At(x|0,b|0,1,0)|0,x=cp(v|0,ee()|0,xe|0,se|0)|0,b=ee()|0,v=h[lt+(x<<2)>>2]|0,!v)break e;He[M>>0]=1,He[v+9>>0]=1,x=v+16|0,be=Ut+(q<<5)+12|0,h[(h[be>>2]|0)+16>>2]=h[x>>2],g=v+12|0,Me=h[Ut+(q<<5)+16>>2]|0,h[Me+12>>2]=h[g>>2],h[(h[g>>2]|0)+16>>2]=Me,h[(h[x>>2]|0)+12>>2]=h[be>>2],x=rT(E)|0,be=rT(v)|0,v=x+24|0,g=h[v+4>>2]|0,Me=be+24|0,Ke=h[Me+4>>2]|0,Me=(g|0)<(Ke|0)|((g|0)==(Ke|0)?(h[v>>2]|0)>>>0<(h[Me>>2]|0)>>>0:0),v=Me?x:be,x=Me?be:x,(x|0)!=(v|0)&&(Ke=v+24|0,be=x+24|0,Me=be,Ke=At(h[Me>>2]|0,h[Me+4>>2]|0,h[Ke>>2]|0,h[Ke+4>>2]|0)|0,Me=ee()|0,h[be>>2]=Ke,h[be+4>>2]=Me,h[v+20>>2]=x)}while(!1)}q=At(q|0,j|0,1,0)|0,j=ee()|0}while((j|0)<(we|0)|(j|0)==(we|0)&q>>>0<Ae>>>0);(je|0)==39&&di(27634,26956,258,27001),v=0,x=0;do He[Ut+(v<<5)+8>>0]=0,v=At(v|0,x|0,1,0)|0,x=ee()|0;while((x|0)<(we|0)|(x|0)==(we|0)&v>>>0<Ae>>>0);for(N=0,b=0,M=0,U=0;;){if(v=Ut+(N<<5)|0,(He[Ut+(N<<5)+8>>0]|0)==0&&(He[Ut+(N<<5)+9>>0]|0)==0){E=v,x=h[E>>2]|0,E=h[E+4>>2]|0;do He[v+8>>0]=1,v=h[v+12>>2]|0,be=v;while(!((h[be>>2]|0)==(x|0)&&(h[be+4>>2]|0)==(E|0)));b=At(b|0,M|0,1,0)|0,E=ee()|0}else E=M;if(N=At(N|0,U|0,1,0)|0,U=ee()|0,(U|0)<(we|0)|(U|0)==(we|0)&N>>>0<Ae>>>0)M=E;else break}v=0,x=0;do He[Ut+(v<<5)+8>>0]=0,v=At(v|0,x|0,1,0)|0,x=ee()|0;while((x|0)<(we|0)|(x|0)==(we|0)&v>>>0<Ae>>>0);Me=b,Ke=E,v=1}else Me=0,Ke=0,v=0;be=br(Me*24|0)|0;e:do if(be|0){t:do if(v){p=0,xe=0,g=0,m=0;n:for(;;){if(v=Ut+(p<<5)|0,(He[Ut+(p<<5)+8>>0]|0)==0&&(He[Ut+(p<<5)+9>>0]|0)==0){ue=v,ae=h[ue>>2]|0,ue=h[ue+4>>2]|0,x=0,b=0;do x=At(x|0,b|0,2,0)|0,b=ee()|0,v=h[v+12>>2]|0,se=v;while(!((h[se>>2]|0)==(ae|0)&&(h[se+4>>2]|0)==(ue|0)));if(K=br(x<<4)|0,!K)break;x=ae,b=ue,X=0,j=0,E=0,M=0;do{if(Hx(x,b,Be)|0){je=69;break n}if(se=h[Be>>2]|0,U=se+-1|0,q=((U|0)<0)<<31>>31,(se|0)>1){b=E,N=0,x=M,E=0;do se=K+(b<<4)|0,M=Be+8+(N<<4)|0,h[se>>2]=h[M>>2],h[se+4>>2]=h[M+4>>2],h[se+8>>2]=h[M+8>>2],h[se+12>>2]=h[M+12>>2],b=At(b|0,x|0,1,0)|0,x=ee()|0,N=At(N|0,E|0,1,0)|0,E=ee()|0;while((E|0)<(q|0)|(E|0)==(q|0)&N>>>0<U>>>0);E=b,M=x}X=At(X|0,j|0,U|0,q|0)|0,j=ee()|0,He[v+8>>0]=1,v=h[v+12>>2]|0,b=v,x=h[b>>2]|0,b=h[b+4>>2]|0}while(!((x|0)==(ae|0)&(b|0)==(ue|0)));if(x=Hue(K,X<<4)|0,!x){je=75;break}ue=rT(v)|0,se=h[ue+4>>2]|0,v=be+(g*24|0)|0,h[v>>2]=h[ue>>2],h[v+4>>2]=se,v=be+(g*24|0)+16|0,h[v>>2]=X,h[be+(g*24|0)+20>>2]=x,h[gt>>2]=h[v>>2],h[gt+4>>2]=h[v+4>>2],vc(gt,be+(g*24|0)+8|0)|0,x=At(g|0,xe|0,1,0)|0,v=ee()|0}else x=g,v=xe;if(p=At(p|0,m|0,1,0)|0,m=ee()|0,(m|0)<(we|0)|(m|0)==(we|0)&p>>>0<Ae>>>0)xe=v,g=x;else break t}if((je|0)==69?di(27634,26956,351,27016):(je|0)==75&&_t(K),(xe|0)>0|(xe|0)==0&g>>>0>0)for(E=0,M=0,v=g,b=xe;x=h[be+(E*24|0)+20>>2]|0,x?(_t(x),x=xe,v=g):x=b,E=At(E|0,M|0,1,0)|0,M=ee()|0,(M|0)<(x|0)|(M|0)==(x|0)&E>>>0<v>>>0;)b=x;_t(be);break e}while(!1);cT(be,Me,24,2);t:do if((Me|0)==0&(Ke|0)==0){if(se=br(192)|0,se|0){if(h[se+16>>2]=0,h[se+20>>2]=0,j=se+8|0,h[j>>2]=3,v=br(48)|0,X=se+12|0,h[X>>2]=v,v|0){h[v>>2]=h[3860],h[v+4>>2]=h[3861],h[v+8>>2]=h[3862],h[v+12>>2]=h[3863],q=v+16|0,h[q>>2]=h[3864],h[q+4>>2]=h[3865],h[q+8>>2]=h[3866],h[q+12>>2]=h[3867],q=v+32|0,h[q>>2]=h[3868],h[q+4>>2]=h[3869],h[q+8>>2]=h[3870],h[q+12>>2]=h[3871],h[gt>>2]=h[j>>2],h[gt+4>>2]=h[j+4>>2],vc(gt,se)|0,h[se+40>>2]=0,h[se+44>>2]=0,q=se+32|0,h[q>>2]=3,v=br(48)|0,K=se+36|0,h[K>>2]=v;do if(!v)E=0,M=1;else{if(h[v>>2]=h[3872],h[v+4>>2]=h[3873],h[v+8>>2]=h[3874],h[v+12>>2]=h[3875],U=v+16|0,h[U>>2]=h[3876],h[U+4>>2]=h[3877],h[U+8>>2]=h[3878],h[U+12>>2]=h[3879],U=v+32|0,h[U>>2]=h[3880],h[U+4>>2]=h[3881],h[U+8>>2]=h[3882],h[U+12>>2]=h[3883],h[gt>>2]=h[q>>2],h[gt+4>>2]=h[q+4>>2],vc(gt,se+24|0)|0,h[se+64>>2]=0,h[se+68>>2]=0,U=se+56|0,h[U>>2]=3,v=br(48)|0,ae=se+60|0,h[ae>>2]=v,!v){E=0,M=2;break}if(h[v>>2]=h[3884],h[v+4>>2]=h[3885],h[v+8>>2]=h[3886],h[v+12>>2]=h[3887],N=v+16|0,h[N>>2]=h[3888],h[N+4>>2]=h[3889],h[N+8>>2]=h[3890],h[N+12>>2]=h[3891],N=v+32|0,h[N>>2]=h[3892],h[N+4>>2]=h[3893],h[N+8>>2]=h[3894],h[N+12>>2]=h[3895],h[gt>>2]=h[U>>2],h[gt+4>>2]=h[U+4>>2],vc(gt,se+48|0)|0,h[se+88>>2]=0,h[se+92>>2]=0,N=se+80|0,h[N>>2]=3,v=br(48)|0,ue=se+84|0,h[ue>>2]=v,!v){E=0,M=3;break}if(h[v>>2]=h[3896],h[v+4>>2]=h[3897],h[v+8>>2]=h[3898],h[v+12>>2]=h[3899],M=v+16|0,h[M>>2]=h[3900],h[M+4>>2]=h[3901],h[M+8>>2]=h[3902],h[M+12>>2]=h[3903],M=v+32|0,h[M>>2]=h[3904],h[M+4>>2]=h[3905],h[M+8>>2]=h[3906],h[M+12>>2]=h[3907],h[gt>>2]=h[N>>2],h[gt+4>>2]=h[N+4>>2],vc(gt,se+72|0)|0,h[se+112>>2]=0,h[se+116>>2]=0,M=se+104|0,h[M>>2]=3,v=br(48)|0,p=se+108|0,h[p>>2]=v,!v){E=0,M=4;break}if(h[v>>2]=h[3908],h[v+4>>2]=h[3909],h[v+8>>2]=h[3910],h[v+12>>2]=h[3911],E=v+16|0,h[E>>2]=h[3912],h[E+4>>2]=h[3913],h[E+8>>2]=h[3914],h[E+12>>2]=h[3915],E=v+32|0,h[E>>2]=h[3916],h[E+4>>2]=h[3917],h[E+8>>2]=h[3918],h[E+12>>2]=h[3919],h[gt>>2]=h[M>>2],h[gt+4>>2]=h[M+4>>2],vc(gt,se+96|0)|0,h[se+136>>2]=0,h[se+140>>2]=0,E=se+128|0,h[E>>2]=3,v=br(48)|0,m=se+132|0,h[m>>2]=v,!v){E=0,M=5;break}if(h[v>>2]=h[3920],h[v+4>>2]=h[3921],h[v+8>>2]=h[3922],h[v+12>>2]=h[3923],b=v+16|0,h[b>>2]=h[3924],h[b+4>>2]=h[3925],h[b+8>>2]=h[3926],h[b+12>>2]=h[3927],b=v+32|0,h[b>>2]=h[3928],h[b+4>>2]=h[3929],h[b+8>>2]=h[3930],h[b+12>>2]=h[3931],h[gt>>2]=h[E>>2],h[gt+4>>2]=h[E+4>>2],vc(gt,se+120|0)|0,h[se+160>>2]=0,h[se+164>>2]=0,b=se+152|0,h[b>>2]=3,v=br(48)|0,g=se+156|0,h[g>>2]=v,!v){E=0,M=6;break}if(h[v>>2]=h[3932],h[v+4>>2]=h[3933],h[v+8>>2]=h[3934],h[v+12>>2]=h[3935],x=v+16|0,h[x>>2]=h[3936],h[x+4>>2]=h[3937],h[x+8>>2]=h[3938],h[x+12>>2]=h[3939],x=v+32|0,h[x>>2]=h[3940],h[x+4>>2]=h[3941],h[x+8>>2]=h[3942],h[x+12>>2]=h[3943],h[gt>>2]=h[b>>2],h[gt+4>>2]=h[b+4>>2],vc(gt,se+144|0)|0,h[se+184>>2]=0,h[se+188>>2]=0,x=se+176|0,h[x>>2]=3,v=br(48)|0,xe=se+180|0,h[xe>>2]=v,!v){E=0,M=7;break}if(h[v>>2]=h[3944],h[v+4>>2]=h[3945],h[v+8>>2]=h[3946],h[v+12>>2]=h[3947],Be=v+16|0,h[Be>>2]=h[3948],h[Be+4>>2]=h[3949],h[Be+8>>2]=h[3950],h[Be+12>>2]=h[3951],v=v+32|0,h[v>>2]=h[3952],h[v+4>>2]=h[3953],h[v+8>>2]=h[3954],h[v+12>>2]=h[3955],h[gt>>2]=h[x>>2],h[gt+4>>2]=h[x+4>>2],vc(gt,se+168|0)|0,cT(se,8,24,3),v=br(128)|0,h[_+4>>2]=v,v|0){h[_>>2]=8,h[v>>2]=h[j>>2],h[v+4>>2]=h[j+4>>2],h[v+8>>2]=h[j+8>>2],h[v+12>>2]=h[j+12>>2],je=v+16|0,h[je>>2]=h[q>>2],h[je+4>>2]=h[q+4>>2],h[je+8>>2]=h[q+8>>2],h[je+12>>2]=h[q+12>>2],je=v+32|0,h[je>>2]=h[U>>2],h[je+4>>2]=h[U+4>>2],h[je+8>>2]=h[U+8>>2],h[je+12>>2]=h[U+12>>2],je=v+48|0,h[je>>2]=h[N>>2],h[je+4>>2]=h[N+4>>2],h[je+8>>2]=h[N+8>>2],h[je+12>>2]=h[N+12>>2],je=v+64|0,h[je>>2]=h[M>>2],h[je+4>>2]=h[M+4>>2],h[je+8>>2]=h[M+8>>2],h[je+12>>2]=h[M+12>>2],je=v+80|0,h[je>>2]=h[E>>2],h[je+4>>2]=h[E+4>>2],h[je+8>>2]=h[E+8>>2],h[je+12>>2]=h[E+12>>2],je=v+96|0,h[je>>2]=h[b>>2],h[je+4>>2]=h[b+4>>2],h[je+8>>2]=h[b+8>>2],h[je+12>>2]=h[b+12>>2],je=v+112|0,h[je>>2]=h[x>>2],h[je+4>>2]=h[x+4>>2],h[je+8>>2]=h[x+8>>2],h[je+12>>2]=h[x+12>>2],_t(se),je=158;break t}v=h[X>>2]|0,v|0&&_t(v),v=h[K>>2]|0,v|0&&_t(v),v=h[ae>>2]|0,v|0&&_t(v),v=h[ue>>2]|0,v|0&&_t(v),v=h[p>>2]|0,v|0&&_t(v),v=h[m>>2]|0,v|0&&_t(v),v=h[g>>2]|0,v|0&&_t(v),v=h[xe>>2]|0,v|0&&_t(v),_t(se);break t}while(!1);v=0,b=0;do x=h[se+(v*24|0)+12>>2]|0,x|0&&_t(x),v=At(v|0,b|0,1,0)|0,b=ee()|0;while(b>>>0<E>>>0|(b|0)==(E|0)&v>>>0<M>>>0)}_t(se),je=152}}else{if((Ke|0)>0|(Ke|0)==0&Me>>>0>0){b=0,E=0,M=0,x=0,v=0,N=0;do Be=be+(b*24|0)|0,gt=E,E=h[Be>>2]|0,je=M,M=h[Be+4>>2]|0,x=At(x|0,v|0,((E|0)!=(gt|0)|(M|0)!=(je|0))&1|0,0)|0,v=ee()|0,b=At(b|0,N|0,1,0)|0,N=ee()|0;while((N|0)<(Ke|0)|(N|0)==(Ke|0)&b>>>0<Me>>>0);ue=x,ae=v}else ue=0,ae=0;if(p=br(ue*24|0)|0,p){n:do if((Ke|0)>=0){for(j=0,X=0,x=0,b=0,K=0,E=0;;){if(!((j|0)==(Me|0)&(X|0)==(Ke|0))&&(gt=be+(x*24|0)|0,je=be+(j*24|0)|0,(h[gt>>2]|0)==(h[je>>2]|0)?(h[gt+4>>2]|0)==(h[je+4>>2]|0):0))v=K;else{if(U=be+(x*24|0)|0,je=eo(j|0,X|0,x|0,b|0)|0,gt=ee()|0,q=At(je|0,gt|0,-1,-1)|0,b=ee()|0,(gt|0)>0|(gt|0)==0&je>>>0>1){if(v=br(q<<3)|0,!v)break;M=0,N=0;do je=M,M=At(M|0,N|0,1,0)|0,N=ee()|0,Be=U+(M*24|0)+16|0,gt=h[Be+4>>2]|0,je=v+(je<<3)|0,h[je>>2]=h[Be>>2],h[je+4>>2]=gt;while((N|0)<(b|0)|(N|0)==(b|0)&M>>>0<q>>>0)}else v=0;gt=be+(x*24|0)+16|0,je=h[gt+4>>2]|0,b=p+(E*24|0)+8|0,h[b>>2]=h[gt>>2],h[b+4>>2]=je,h[p+(E*24|0)+16>>2]=q,h[p+(E*24|0)+20>>2]=v,ie[p+(E*24|0)>>3]=+ie[be+(x*24|0)+8>>3],E=At(E|0,K|0,1,0)|0,x=j,b=X,v=ee()|0}if(je=j,j=At(j|0,X|0,1,0)|0,gt=X,X=ee()|0,(gt|0)<(Ke|0)|(gt|0)==(Ke|0)&je>>>0<Me>>>0)K=v;else break n}if((K|0)>0|(K|0)==0&E>>>0>0){v=0,b=0;do x=h[p+(v*24|0)+20>>2]|0,x|0&&_t(x),v=At(v|0,b|0,1,0)|0,b=ee()|0;while((b|0)<(K|0)|(b|0)==(K|0)&v>>>0<E>>>0)}_t(p),je=152;break t}while(!1);if(cT(p,ue,24,3),v=br(ue<<4)|0,b=_+4|0,h[b>>2]=v,v){h[_>>2]=ue;do if((ae|0)>0|(ae|0)==0&ue>>>0>0){if(_=p+8|0,h[v>>2]=h[_>>2],h[v+4>>2]=h[_+4>>2],h[v+8>>2]=h[_+8>>2],h[v+12>>2]=h[_+12>>2],(ue|0)==1&(ae|0)==0||(_=v+16|0,je=p+32|0,h[_>>2]=h[je>>2],h[_+4>>2]=h[je+4>>2],h[_+8>>2]=h[je+8>>2],h[_+12>>2]=h[je+12>>2],!((ae|0)>0|(ae|0)==0&ue>>>0>2)))break;v=2,x=0;do _=(h[b>>2]|0)+(v<<4)|0,je=p+(v*24|0)+8|0,h[_>>2]=h[je>>2],h[_+4>>2]=h[je+4>>2],h[_+8>>2]=h[je+8>>2],h[_+12>>2]=h[je+12>>2],v=At(v|0,x|0,1,0)|0,x=ee()|0;while((x|0)<(ae|0)|(x|0)==(ae|0)&v>>>0<ue>>>0)}while(!1);_t(p),je=158;break}else{if((ae|0)>0|(ae|0)==0&ue>>>0>0){v=0,b=0;do x=h[p+(v*24|0)+20>>2]|0,x|0&&_t(x),v=At(v|0,b|0,1,0)|0,b=ee()|0;while((b|0)<(ae|0)|(b|0)==(ae|0)&v>>>0<ue>>>0)}_t(p),je=152;break}}else je=152}while(!1);if((je|0)==158)return _t(Ut),_t(lt),_t(be),lt=0,Q=pt,lt|0;if((je|0)==152&&(Ke|0)>0|(Ke|0)==0&Me>>>0>0)for(E=0,M=0,v=Me,b=Ke;x=h[be+(E*24|0)+20>>2]|0,x?(_t(x),x=Ke,v=Me):x=b,E=At(E|0,M|0,1,0)|0,M=ee()|0,(M|0)<(x|0)|(M|0)==(x|0)&E>>>0<v>>>0;)b=x;return _t(be),_t(Ut),_t(lt),lt=13,Q=pt,lt|0}while(!1);return _t(Ut),_t(lt),lt=13,Q=pt,lt|0}else if((je|0)==159)return Q=pt,v|0;return 0}function Hce(p,m){p=p|0,m=m|0;var g=0,_=0;return _=p,p=h[_>>2]|0,_=h[_+4>>2]|0,g=m,m=h[g>>2]|0,g=h[g+4>>2]|0,(_>>>0<g>>>0|(_|0)==(g|0)&p>>>0<m>>>0?-1:(_>>>0>g>>>0|(_|0)==(g|0)&p>>>0>m>>>0)&1)|0}function rT(p){p=p|0;var m=0,g=0;return m=p+20|0,g=h[m>>2]|0,(g|0)==(p|0)?p|0:(g=rT(g)|0,h[m>>2]=g,g|0)}function Wce(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0;return E=p,b=h[E>>2]|0,E=h[E+4>>2]|0,x=m,v=h[x>>2]|0,x=h[x+4>>2]|0,E>>>0<x>>>0|(E|0)==(x|0)&b>>>0<v>>>0?(m=-1,m|0):E>>>0>x>>>0|(E|0)==(x|0)&b>>>0>v>>>0?(m=1,m|0):(_=+ie[p+8>>3],g=+ie[m+8>>3],_<g?(m=-1,m|0):(m=_>g&1,m|0))}function jce(p,m){p=p|0,m=m|0;var g=0,_=0;return _=+ie[p>>3],g=+ie[m>>3],(_>g?-1:_<g&1)|0}function Xce(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0;if(q=Q,Q=Q+64|0,U=q,E=q+56|0,!(!0&(m&2013265920|0)==134217728&(!0&(_&2013265920|0)==134217728)))return v=5,Q=q,v|0;if((p|0)==(g|0)&(m|0)==(_|0))return h[v>>2]=0,v=0,Q=q,v|0;if(b=tt(p|0,m|0,52)|0,ee()|0,b=b&15,N=tt(g|0,_|0,52)|0,ee()|0,(b|0)!=(N&15|0))return v=12,Q=q,v|0;if(x=b+-1|0,b>>>0>1){cL(p,m,x,U)|0,cL(g,_,x,E)|0,N=U,M=h[N>>2]|0,N=h[N+4>>2]|0;e:do if((M|0)==(h[E>>2]|0)&&(N|0)==(h[E+4>>2]|0)){b=(b^15)*3|0,x=tt(p|0,m|0,b|0)|0,ee()|0,x=x&7,b=tt(g|0,_|0,b|0)|0,ee()|0,b=b&7;do if((x|0)==0|(b|0)==0)h[v>>2]=1,x=0;else if((x|0)==7)x=5;else{if((x|0)==1|(b|0)==1&&Zi(M,N)|0){x=5;break}if((h[15824+(x<<2)>>2]|0)!=(b|0)&&(h[15856+(x<<2)>>2]|0)!=(b|0))break e;h[v>>2]=1,x=0}while(!1);return v=x,Q=q,v|0}while(!1)}x=U,b=x+56|0;do h[x>>2]=0,x=x+4|0;while((x|0)<(b|0));return zG(p,m,1,U)|0,m=U,!((h[m>>2]|0)==(g|0)&&(h[m+4>>2]|0)==(_|0))&&(m=U+8|0,!((h[m>>2]|0)==(g|0)&&(h[m+4>>2]|0)==(_|0)))&&(m=U+16|0,!((h[m>>2]|0)==(g|0)&&(h[m+4>>2]|0)==(_|0)))&&(m=U+24|0,!((h[m>>2]|0)==(g|0)&&(h[m+4>>2]|0)==(_|0)))&&(m=U+32|0,!((h[m>>2]|0)==(g|0)&&(h[m+4>>2]|0)==(_|0)))&&(m=U+40|0,!((h[m>>2]|0)==(g|0)&&(h[m+4>>2]|0)==(_|0)))?(x=U+48|0,x=((h[x>>2]|0)==(g|0)?(h[x+4>>2]|0)==(_|0):0)&1):x=1,h[v>>2]=x,v=0,Q=q,v|0}function $ce(p,m,g,_,v){return p=p|0,m=m|0,g=g|0,_=_|0,v=v|0,g=iT(p,m,g,_)|0,(g|0)==7?(v=11,v|0):(_=ft(g|0,0,56)|0,m=m&-2130706433|(ee()|0)|268435456,h[v>>2]=p|_,h[v+4>>2]=m,v=0,v|0)}function Yce(p,m,g){return p=p|0,m=m|0,g=g|0,!0&(m&2013265920|0)==268435456?(h[g>>2]=p,h[g+4>>2]=m&-2130706433|134217728,g=0,g|0):(g=6,g|0)}function Zce(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0;return v=Q,Q=Q+16|0,_=v,h[_>>2]=0,!0&(m&2013265920|0)==268435456?(x=tt(p|0,m|0,56)|0,ee()|0,_=Js(p,m&-2130706433|134217728,x&7,_,g)|0,Q=v,_|0):(_=6,Q=v,_|0)}function KG(p,m){p=p|0,m=m|0;var g=0;switch(g=tt(p|0,m|0,56)|0,ee()|0,g&7){case 0:case 7:return g=0,g|0;default:}return g=m&-2130706433|134217728,!(!0&(m&2013265920|0)==268435456)||!0&(m&117440512|0)==16777216&(Zi(p,g)|0)!=0?(g=0,g|0):(g=sT(p,g)|0,g|0)}function Kce(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0;return v=Q,Q=Q+16|0,_=v,!0&(m&2013265920|0)==268435456?(x=m&-2130706433|134217728,b=g,h[b>>2]=p,h[b+4>>2]=x,h[_>>2]=0,m=tt(p|0,m|0,56)|0,ee()|0,_=Js(p,x,m&7,_,g+8|0)|0,Q=v,_|0):(_=6,Q=v,_|0)}function rL(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0;return v=(Zi(p,m)|0)==0,m=m&-2130706433,_=g,h[_>>2]=v?p:0,h[_+4>>2]=v?m|285212672:0,_=g+8|0,h[_>>2]=p,h[_+4>>2]=m|301989888,_=g+16|0,h[_>>2]=p,h[_+4>>2]=m|318767104,_=g+24|0,h[_>>2]=p,h[_+4>>2]=m|335544320,_=g+32|0,h[_>>2]=p,h[_+4>>2]=m|352321536,g=g+40|0,h[g>>2]=p,h[g+4>>2]=m|369098752,0}function Hx(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0;return b=Q,Q=Q+16|0,v=b,x=m&-2130706433|134217728,!0&(m&2013265920|0)==268435456?(_=tt(p|0,m|0,56)|0,ee()|0,_=Vue(p,x,_&7)|0,(_|0)==-1?(h[g>>2]=0,x=6,Q=b,x|0):(S1(p,x,v)|0&&di(27634,27035,282,27050),m=tt(p|0,m|0,52)|0,ee()|0,m=m&15,Zi(p,x)|0?sL(v,m,_,2,g):oL(v,m,_,2,g),x=0,Q=b,x|0)):(x=6,Q=b,x|0)}function QG(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0;return b=Q,Q=Q+16|0,_=b+8|0,v=b,x=m&-2130706433|134217728,!0&(m&2013265920|0)==268435456?(h[_>>2]=0,m=tt(p|0,m|0,56)|0,ee()|0,m=Js(p,x,m&7,_,v)|0,m|0?(g=m,Q=b,g|0):(_=h[v>>2]|0,v=h[v+4>>2]|0,m=iT(_,v,p,x)|0,(m|0)==7?(g=11,Q=b,g|0):(p=ft(m|0,0,56)|0,x=v&-2130706433|(ee()|0)|268435456,h[g>>2]=_|p,h[g+4>>2]=x,g=0,Q=b,g|0))):(g=6,Q=b,g|0)}function Qce(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0;h[g>>2]=0,N=+ie[p>>3],U=+ie[p+8>>3],M=+ie[p+16>>3],v=0,x=5,_=5,p=0;do ae=+ie[15888+(v*24|0)>>3]-N,K=+ie[15888+(v*24|0)+8>>3]-U,b=+ie[15888+(v*24|0)+16>>3]-M,b=ae*ae+K*K+b*b,b<_&&(h[g>>2]=v,x=b,p=v,_=b),v=v+1|0;while((v|0)!=20);if(x=+hce(+(1-x*.5)),x<1e-16)M=0,b=0;else{if(Ae=+ie[16368+(p*24|0)>>3],se=+ie[15888+(p*24|0)>>3],we=+ie[15888+(p*24|0)+8>>3],xe=+ie[15888+(p*24|0)+16>>3],Be=-(xe+(se*0+we*0)),b=se*Be+0,ae=we*Be+0,Be=xe*Be+1,ue=+bs(+(Be*Be+(b*b+ae*ae))),ue=ue>0?1/ue:0,b=b*ue,ae=ae*ue,ue=Be*ue,Be=-(N*se+U*we+M*xe),K=N+se*Be,_=U+we*Be,N=M+xe*Be,U=+bs(+(N*N+(K*K+_*_))),U=U>0?1/U:0,K=K*U,_=_*U,U=N*U,_=+Xx(Ae-+Xx(+Sa(+(U*(we*b-se*ae)+(K*(xe*ae-we*ue)+_*(se*ue-xe*b))),+(ue*U+(b*K+ae*_))))),_c(m)|0?b=+Xx(_+-.3334731722518321):b=_,_=+nT(+x)*2.618033988749896,(m|0)>0){p=0;do _=_*2.6457513110645907,p=p+1|0;while((p|0)!=(m|0))}M=+ii(+b)*_,b=+zi(+b)*_}m=g+4|0,X=g+12|0,h[X>>2]=0,x=+Qs(+b)*1.1547005383792515,_=+Qs(+M)+x*.5,p=~~_,v=~~x,_=_-+(p|0),x=x-+(v|0);do if(_<.5)if(_<.3333333333333333)if(h[m>>2]=p,x<(_+1)*.5){h[g+8>>2]=v;break}else{v=v+1|0,h[g+8>>2]=v;break}else if(Be=1-_,v=(!(x<Be)&1)+v|0,h[g+8>>2]=v,Be<=x&x<_*2){p=p+1|0,h[m>>2]=p;break}else{h[m>>2]=p;break}else{if(!(_<.6666666666666666))if(p=p+1|0,h[m>>2]=p,x<_*.5){h[g+8>>2]=v;break}else{v=v+1|0,h[g+8>>2]=v;break}if(x<1-_){if(h[g+8>>2]=v,_*2+-1<x){h[m>>2]=p;break}}else v=v+1|0,h[g+8>>2]=v;p=p+1|0,h[m>>2]=p}while(!1);do if(M<0)if(v&1){j=(v+1|0)/2|0,j=eo(p|0,((p|0)<0)<<31>>31|0,j|0,((j|0)<0)<<31>>31|0)|0,p=~~(+(p|0)-((+(j>>>0)+4294967296*+(ee()|0))*2+1)),h[m>>2]=p,j=m;break}else{j=(v|0)/2|0,j=eo(p|0,((p|0)<0)<<31>>31|0,j|0,((j|0)<0)<<31>>31|0)|0,p=~~(+(p|0)-(+(j>>>0)+4294967296*+(ee()|0))*2),h[m>>2]=p,j=m;break}else j=m;while(!1);q=g+8|0,m=0-v|0,b<0?(g=p-((v<<1|1|0)/2|0)|0,h[j>>2]=g,h[q>>2]=m,v=m):g=p,p=v-g|0,m=0-g|0,(g|0)<0?(h[q>>2]=p,h[X>>2]=m,h[j>>2]=0,E=0):(p=v,E=g,m=0),g=E-p|0,v=m-p|0,(p|0)<0?(h[j>>2]=g,h[X>>2]=v,h[q>>2]=0,E=g,p=0):v=m,g=E-v|0,m=p-v|0,(v|0)<0?(h[j>>2]=g,h[q>>2]=m,h[X>>2]=0,v=0):(m=p,g=E),p=(m|0)<(g|0)?m:g,p=(v|0)<(p|0)?v:p,!((p|0)<=0)&&(h[j>>2]=g-p,h[q>>2]=m-p,h[X>>2]=v-p)}function Jce(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0;_=Q,Q=Q+16|0,v=_,b=h[p+12>>2]|0,x=+((h[p+8>>2]|0)-b|0),ie[v>>3]=+((h[p+4>>2]|0)-b|0)-x*.5,ie[v+8>>3]=x*.8660254037844386,Wx(v,h[p>>2]|0,m,0,g),Q=_}function Wx(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0;if(x=+zue(p),x<1e-16){m=15888+(m*24|0)|0,h[v>>2]=h[m>>2],h[v+4>>2]=h[m+4>>2],h[v+8>>2]=h[m+8>>2],h[v+12>>2]=h[m+12>>2],h[v+16>>2]=h[m+16>>2],h[v+20>>2]=h[m+20>>2];return}if(b=+Sa(+ +ie[p+8>>3],+ +ie[p>>3]),(g|0)>0){p=0;do x=x*.37796447300922725,p=p+1|0;while((p|0)!=(g|0))}E=x*.3333333333333333,_?(g=(_c(g)|0)==0,x=+UG(+((g?E:E*.37796447300922725)*.381966011250105))):(x=+UG(+(x*.381966011250105)),_c(g)|0&&(b=+Xx(b+.3334731722518321))),q=+Xx(+ie[16368+(m*24|0)>>3]-b),E=+ie[15888+(m*24|0)>>3],U=+ie[15888+(m*24|0)+8>>3],ae=+ie[15888+(m*24|0)+16>>3],X=-(ae+(E*0+U*0)),N=E*X+0,b=U*X+0,X=ae*X+1,j=+bs(+(X*X+(N*N+b*b))),j=j>0?1/j:0,N=N*j,b=b*j,j=X*j,X=+ii(+q),q=+zi(+q),ue=+ii(+x),K=+zi(+x),M=ue*E+K*(X*N+q*(ae*b-U*j)),x=ue*U+K*(X*b+q*(E*j-ae*N)),b=ue*ae+K*(X*j+q*(U*N-E*b)),E=+bs(+(b*b+(M*M+x*x))),E=E>0?1/E:0,ie[v>>3]=M*E,ie[v+8>>3]=x*E,ie[v+16>>3]=b*E}function sL(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0,be=0,gt=0,je=0,Ut=0,lt=0,pt=0,pi=0,bi=0,Ro=0,Vn=0,wi=0,Ea=0,Bs=0,os=0,Os=0,ws=0,ll=0,po=0,mo=0,yc=0,Io=0,Pi=0,Gm=0;if(ll=Q,Q=Q+256|0,x=ll+240|0,pi=ll+224|0,os=ll,Os=ll+208|0,ws=ll+192|0,bi=ll+168|0,Ro=ll+152|0,Vn=ll+136|0,wi=ll+120|0,Ea=ll+104|0,Bs=ll+80|0,h[x>>2]=m,h[pi>>2]=h[p>>2],h[pi+4>>2]=h[p+4>>2],h[pi+8>>2]=h[p+8>>2],h[pi+12>>2]=h[p+12>>2],JG(pi,x,os),h[v>>2]=0,pi=_+g+((_|0)==5&1)|0,(pi|0)<=(g|0)){Q=ll;return}Ae=h[x>>2]|0,we=Os+4|0,xe=Os+8|0,se=Os+12|0,Be=ws+8|0,Ke=g+5|0,Me=16848+(Ae<<2)|0,be=bi+8|0,gt=16928+(Ae<<2)|0,je=Ro+8|0,Ut=Vn+8|0,lt=wi+8|0,pt=ws+8|0,X=bi+8|0,ae=bi+16|0,K=Bs+8|0,ue=Bs+16|0,j=g,_=0,b=0,E=0,M=0;e:for(;;){q=os+(((j|0)%5|0)<<4)|0,h[Os>>2]=h[q>>2],h[Os+4>>2]=h[q+4>>2],h[Os+8>>2]=h[q+8>>2],h[Os+12>>2]=h[q+12>>2];do;while((w1(Os,Ae,0,1)|0)==2);if((j|0)>(g|0)&(_c(m)|0)!=0){if(q=h[Os>>2]|0,p=h[we>>2]|0,N=h[xe>>2]|0,x=h[se>>2]|0,po=+(E-M|0),ie[ws>>3]=+(b-M|0)-po*.5,ie[Be>>3]=po*.8660254037844386,M=h[17008+(q*80|0)+(_<<2)>>2]|0,U=h[18608+(q*80|0)+(M*20|0)>>2]|0,E=h[18608+(q*80|0)+(M*20|0)+16>>2]|0,(E|0)>0){b=0,_=N;do Io=x+p|0,Pi=(Io|0)<0,N=_+p-(Pi?Io:0)|0,yc=(N|0)<0,mo=x+_-(Pi?Io:0)-(yc?N:0)|0,x=(mo|0)<0,p=(Pi?0:Io)-(yc?N:0)-(x?mo:0)|0,_=(yc?0:N)-(x?mo:0)|0,mo=x?0:mo,x=(_|0)<(p|0)?_:p,x=(mo|0)<(x|0)?mo:x,N=(x|0)>0,p=p-(N?x:0)|0,_=_-(N?x:0)|0,x=mo-(N?x:0)|0,b=b+1|0;while((b|0)<(E|0))}else _=N;switch(Pi=(h[Me>>2]|0)*3|0,mo=(ol(Pi,h[18608+(q*80|0)+(M*20|0)+4>>2]|0)|0)+p|0,N=(ol(Pi,h[18608+(q*80|0)+(M*20|0)+8>>2]|0)|0)+_|0,Pi=(ol(Pi,h[18608+(q*80|0)+(M*20|0)+12>>2]|0)|0)+x|0,M=(mo|0)<0,N=N-(M?mo:0)|0,yc=(N|0)<0,Pi=Pi+(M?0-mo|0:0)+(yc?0-N|0:0)|0,Io=(Pi|0)<0,mo=(M?0:mo)-(yc?N:0)-(Io?Pi:0)|0,N=(yc?0:N)-(Io?Pi:0)|0,Pi=Io?0:Pi,Io=(N|0)<(mo|0)?N:mo,Io=(Pi|0)<(Io|0)?Pi:Io,yc=(Io|0)>0,Pi=Pi-(yc?Io:0)|0,po=+(N-(yc?Io:0)-Pi|0),ie[bi>>3]=+(mo-(yc?Io:0)-Pi|0)-po*.5,ie[be>>3]=po*.8660254037844386,po=+(h[gt>>2]|0),ie[Ro>>3]=po*3,ie[je>>3]=0,Gm=po*-1.5,ie[Vn>>3]=Gm,ie[Ut>>3]=po*2.598076211353316,ie[wi>>3]=Gm,ie[lt>>3]=po*-2.598076211353316,h[17008+(U*80|0)+(q<<2)>>2]|0){case 1:{p=Vn,_=Ro;break}case 3:{p=wi,_=Vn;break}case 2:{p=Ro,_=wi;break}default:{p=12;break e}}dq(ws,bi,_,p,Ea),Wx(Ea,U,Ae,1,Bs),Pi=h[v>>2]|0,po=+qx(+ +ie[ue>>3]),Gm=+Sa(+ +ie[K>>3],+ +ie[Bs>>3]),ie[v+8+(Pi<<4)>>3]=po,ie[v+8+(Pi<<4)+8>>3]=Gm,h[v>>2]=(h[v>>2]|0)+1}if((j|0)<(Ke|0)&&(Pi=h[se>>2]|0,po=+((h[xe>>2]|0)-Pi|0),ie[ws>>3]=+((h[we>>2]|0)-Pi|0)-po*.5,ie[pt>>3]=po*.8660254037844386,Wx(ws,h[Os>>2]|0,Ae,1,bi),Pi=h[v>>2]|0,po=+qx(+ +ie[ae>>3]),Gm=+Sa(+ +ie[X>>3],+ +ie[bi>>3]),ie[v+8+(Pi<<4)>>3]=po,ie[v+8+(Pi<<4)+8>>3]=Gm,h[v>>2]=(h[v>>2]|0)+1),j=j+1|0,(j|0)>=(pi|0)){p=3;break}else _=h[Os>>2]|0,b=h[we>>2]|0,E=h[xe>>2]|0,M=h[se>>2]|0}if((p|0)==3){Q=ll;return}else(p|0)==12&&di(27073,27120,599,27130)}function JG(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0;K=Q,Q=Q+128|0,_=K+64|0,v=K,x=_,b=20208,E=x+60|0;do h[x>>2]=h[b>>2],x=x+4|0,b=b+4|0;while((x|0)<(E|0));x=v,b=20272,E=x+60|0;do h[x>>2]=h[b>>2],x=x+4|0,b=b+4|0;while((x|0)<(E|0));if(U=(_c(h[m>>2]|0)|0)==0,U=U?_:v,X=p+4|0,x=h[X>>2]|0,q=p+8|0,_=h[q>>2]|0,j=p+12|0,v=h[j>>2]|0,b=_+(x<<1)|0,h[X>>2]=b,_=v+(_<<1)|0,h[q>>2]=_,x=(v<<1)+x|0,h[j>>2]=x,v=_-b|0,E=x-b|0,(b|0)<0&&(h[q>>2]=v,h[j>>2]=E,h[X>>2]=0,_=v,b=0,x=E),E=b-_|0,v=x-_|0,(_|0)<0?(h[X>>2]=E,h[j>>2]=v,h[q>>2]=0,_=0):(v=x,E=b),b=E-v|0,x=_-v|0,(v|0)<0?(h[X>>2]=b,h[q>>2]=x,h[j>>2]=0,v=0):(x=_,b=E),_=(x|0)<(b|0)?x:b,_=(v|0)<(_|0)?v:_,(_|0)>0&&(v=v-_|0,x=x-_|0,b=b-_|0,h[X>>2]=b,h[q>>2]=x,h[j>>2]=v),M=(x<<1)+b|0,E=v+(b<<1)|0,h[X>>2]=E,h[q>>2]=M,x=(v<<1)+x|0,h[j>>2]=x,_=M-E|0,v=x-E|0,(E|0)<0?(h[q>>2]=_,h[j>>2]=v,h[X>>2]=0,E=0,x=v):_=M,b=E-_|0,v=x-_|0,(_|0)<0?(h[X>>2]=b,h[j>>2]=v,h[q>>2]=0,E=b,_=0):v=x,b=E-v|0,x=_-v|0,(v|0)<0?(h[X>>2]=b,h[q>>2]=x,h[j>>2]=0,v=0):(x=_,b=E),_=(x|0)<(b|0)?x:b,_=(v|0)<(_|0)?v:_,(_|0)>0&&(h[X>>2]=b-_,h[q>>2]=x-_,h[j>>2]=v-_),_c(h[m>>2]|0)|0&&(x=h[X>>2]|0,b=h[q>>2]|0,v=h[j>>2]|0,_=(b*3|0)+x|0,x=v+(x*3|0)|0,h[X>>2]=x,h[q>>2]=_,b=(v*3|0)+b|0,h[j>>2]=b,v=_-x|0,E=b-x|0,(x|0)<0?(h[q>>2]=v,h[j>>2]=E,h[X>>2]=0,_=v,M=0):(M=x,E=b),x=M-_|0,v=E-_|0,(_|0)<0?(h[X>>2]=x,h[j>>2]=v,h[q>>2]=0,M=x,b=0):(b=_,v=E),x=M-v|0,_=b-v|0,(v|0)<0?(h[X>>2]=x,h[q>>2]=_,h[j>>2]=0,b=_,v=0):x=M,_=(b|0)<(x|0)?b:x,_=(v|0)<(_|0)?v:_,(_|0)>0&&(h[X>>2]=x-_,h[q>>2]=b-_,h[j>>2]=v-_),h[m>>2]=(h[m>>2]|0)+1),h[g>>2]=h[p>>2],v=h[q>>2]|0,_=h[j>>2]|0,m=h[U+4>>2]|0,N=h[U+8>>2]|0,b=(h[U>>2]|0)+(h[X>>2]|0)|0,M=g+4|0,h[M>>2]=b,v=m+v|0,m=g+8|0,h[m>>2]=v,_=N+_|0,N=g+12|0,h[N>>2]=_,x=v-b|0,(b|0)<0&&(_=_-b|0,h[m>>2]=x,h[N>>2]=_,h[M>>2]=0,v=x,b=0),(v|0)<0&&(b=b-v|0,h[M>>2]=b,_=_-v|0,h[N>>2]=_,h[m>>2]=0,v=0),E=b-_|0,x=v-_|0,(_|0)<0?(h[M>>2]=E,h[m>>2]=x,h[N>>2]=0,b=E,_=0):x=v,v=(x|0)<(b|0)?x:b,v=(_|0)<(v|0)?_:v,(v|0)>0&&(h[M>>2]=b-v,h[m>>2]=x-v,h[N>>2]=_-v),h[g+16>>2]=h[p>>2],v=h[q>>2]|0,_=h[j>>2]|0,m=h[U+16>>2]|0,N=h[U+20>>2]|0,b=(h[U+12>>2]|0)+(h[X>>2]|0)|0,M=g+20|0,h[M>>2]=b,v=m+v|0,m=g+24|0,h[m>>2]=v,_=N+_|0,N=g+28|0,h[N>>2]=_,x=v-b|0,(b|0)<0&&(_=_-b|0,h[m>>2]=x,h[N>>2]=_,h[M>>2]=0,v=x,b=0),(v|0)<0&&(b=b-v|0,h[M>>2]=b,_=_-v|0,h[N>>2]=_,h[m>>2]=0,v=0),E=b-_|0,x=v-_|0,(_|0)<0?(h[M>>2]=E,h[m>>2]=x,h[N>>2]=0,b=E,_=0):x=v,v=(x|0)<(b|0)?x:b,v=(_|0)<(v|0)?_:v,(v|0)>0&&(h[M>>2]=b-v,h[m>>2]=x-v,h[N>>2]=_-v),h[g+32>>2]=h[p>>2],v=h[q>>2]|0,_=h[j>>2]|0,m=h[U+28>>2]|0,N=h[U+32>>2]|0,b=(h[U+24>>2]|0)+(h[X>>2]|0)|0,M=g+36|0,h[M>>2]=b,v=m+v|0,m=g+40|0,h[m>>2]=v,_=N+_|0,N=g+44|0,h[N>>2]=_,x=v-b|0,(b|0)<0&&(_=_-b|0,h[m>>2]=x,h[N>>2]=_,h[M>>2]=0,v=x,b=0),(v|0)<0&&(b=b-v|0,h[M>>2]=b,_=_-v|0,h[N>>2]=_,h[m>>2]=0,v=0),E=b-_|0,x=v-_|0,(_|0)<0?(h[M>>2]=E,h[m>>2]=x,h[N>>2]=0,b=E,_=0):x=v,v=(x|0)<(b|0)?x:b,v=(_|0)<(v|0)?_:v,(v|0)>0&&(h[M>>2]=b-v,h[m>>2]=x-v,h[N>>2]=_-v),h[g+48>>2]=h[p>>2],v=h[q>>2]|0,_=h[j>>2]|0,m=h[U+40>>2]|0,N=h[U+44>>2]|0,b=(h[U+36>>2]|0)+(h[X>>2]|0)|0,M=g+52|0,h[M>>2]=b,v=m+v|0,m=g+56|0,h[m>>2]=v,_=N+_|0,N=g+60|0,h[N>>2]=_,x=v-b|0,(b|0)<0&&(_=_-b|0,h[m>>2]=x,h[N>>2]=_,h[M>>2]=0,v=x,b=0),(v|0)<0&&(b=b-v|0,h[M>>2]=b,_=_-v|0,h[N>>2]=_,h[m>>2]=0,v=0),E=b-_|0,x=v-_|0,(_|0)<0?(h[M>>2]=E,h[m>>2]=x,h[N>>2]=0,b=E,_=0):x=v,v=(x|0)<(b|0)?x:b,v=(_|0)<(v|0)?_:v,(v|0)>0&&(h[M>>2]=b-v,h[m>>2]=x-v,h[N>>2]=_-v),h[g+64>>2]=h[p>>2],x=h[q>>2]|0,_=h[j>>2]|0,N=h[U+52>>2]|0,M=h[U+56>>2]|0,b=(h[U+48>>2]|0)+(h[X>>2]|0)|0,m=g+68|0,h[m>>2]=b,x=N+x|0,N=g+72|0,h[N>>2]=x,_=M+_|0,M=g+76|0,h[M>>2]=_,v=x-b|0,(b|0)<0?(_=_-b|0,h[N>>2]=v,h[M>>2]=_,h[m>>2]=0,x=0):(v=x,x=b),(v|0)<0&&(x=x-v|0,h[m>>2]=x,_=_-v|0,h[M>>2]=_,h[N>>2]=0,v=0),E=x-_|0,b=v-_|0,(_|0)<0?(h[m>>2]=E,h[N>>2]=b,h[M>>2]=0,x=E,_=0):b=v,v=(b|0)<(x|0)?b:x,v=(_|0)<(v|0)?_:v,(v|0)<=0){Q=K;return}h[m>>2]=x-v,h[N>>2]=b-v,h[M>>2]=_-v,Q=K}function w1(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0;if(j=h[16928+(m<<2)>>2]|0,q=(_|0)!=0,j=q?j*3|0:j,U=p+4|0,E=h[U>>2]|0,N=p+8|0,x=h[N>>2]|0,q){if(b=p+12|0,_=h[b>>2]|0,v=x+E+_|0,(v|0)==(j|0))return j=1,j|0;M=b}else M=p+12|0,v=h[M>>2]|0,_=v,v=x+E+v|0;if((v|0)<=(j|0))return j=0,j|0;do if((_|0)>0){if(v=h[p>>2]|0,(x|0)>0){v=18608+(v*80|0)+60|0,b=E;break}v=18608+(v*80|0)+40|0,g?(b=E-j|0,g=x+b|0,X=(g|0)<0,x=_+x-(X?g:0)|0,E=(x|0)<0,_=_+b-(X?g:0)-(E?x:0)|0,b=(_|0)<0,g=(X?0:g)-(E?x:0)-(b?_:0)|0,x=(E?0:x)-(b?_:0)|0,_=b?0:_,b=(x|0)<(g|0)?x:g,b=(_|0)<(b|0)?_:b,E=(b|0)>0,x=x-(E?b:0)|0,_=_-(E?b:0)|0,b=g-(E?b:0)+j|0,h[U>>2]=b,h[N>>2]=x,h[M>>2]=_):b=E}else v=18608+((h[p>>2]|0)*80|0)+20|0,b=E;while(!1);if(h[p>>2]=h[v>>2],E=h[v+16>>2]|0,(E|0)>0){g=0;do X=_+b|0,K=(X|0)<0,xe=K?X:0,ae=x+b-xe|0,ue=(ae|0)<0,p=ue?ae:0,b=_+x-xe-p|0,x=(b|0)<0,_=x?0:b,b=x?b:0,x=(ue?0:ae)-b|0,b=(K?0:X)-p-b|0,p=(x|0)<(b|0)?x:b,p=(_|0)<(p|0)?_:p,(p|0)>0&&(b=b-p|0,x=x-p|0,_=_-p|0),g=g+1|0;while((g|0)<(E|0));h[U>>2]=b,h[N>>2]=x,h[M>>2]=_}return ae=h[16848+(m<<2)>>2]|0,ae=q?ae*3|0:ae,ue=ol(ae,h[v+8>>2]|0)|0,xe=ol(ae,h[v+12>>2]|0)|0,b=(ol(ae,h[v+4>>2]|0)|0)+b|0,h[U>>2]=b,x=ue+x|0,h[N>>2]=x,_=xe+_|0,h[M>>2]=_,v=x-b|0,(b|0)<0?(_=_-b|0,h[N>>2]=v,h[M>>2]=_,h[U>>2]=0,x=0):(v=x,x=b),(v|0)<0?(p=x-v|0,h[U>>2]=p,_=_-v|0,h[M>>2]=_,h[N>>2]=0,b=0):(p=x,b=v),x=p-_|0,v=b-_|0,(_|0)<0?(h[U>>2]=x,h[N>>2]=v,h[M>>2]=0,_=0):(v=b,x=p),b=(v|0)<(x|0)?v:x,b=(_|0)<(b|0)?_:b,(b|0)>0&&(x=x-b|0,v=v-b|0,_=_-b|0,h[U>>2]=x,h[N>>2]=v,h[M>>2]=_),q?(xe=(v+x+_|0)==(j|0)?1:2,xe|0):(xe=2,xe|0)}function eue(p,m){p=p|0,m=m|0;var g=0;do g=w1(p,m,0,1)|0;while((g|0)==2);return g|0}function oL(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0,be=0,gt=0,je=0,Ut=0,lt=0,pt=0,pi=0,bi=0,Ro=0,Vn=0,wi=0,Ea=0,Bs=0,os=0,Os=0,ws=0;if(Bs=Q,Q=Q+272|0,x=Bs+256|0,b=Bs+240|0,Vn=Bs,wi=Bs+224|0,Ea=Bs+208|0,je=Bs+184|0,Ut=Bs+168|0,lt=Bs+152|0,pt=Bs+136|0,pi=Bs+120|0,bi=Bs+96|0,h[x>>2]=m,h[b>>2]=h[p>>2],h[b+4>>2]=h[p+4>>2],h[b+8>>2]=h[p+8>>2],h[b+12>>2]=h[p+12>>2],eq(b,x,Vn),h[v>>2]=0,gt=_+g+((_|0)==6&1)|0,(gt|0)<=(g|0)){Q=Bs;return}xe=h[x>>2]|0,se=g+6|0,we=Ea+8|0,Ae=je+8|0,Be=16928+(xe<<2)|0,Ke=Ut+8|0,Me=lt+8|0,be=pt+8|0,ae=h[b>>2]|0,j=wi+4|0,X=wi+8|0,K=wi+12|0,ue=Ea+8|0,M=je+8|0,U=je+16|0,N=bi+8|0,q=bi+16|0,b=0,E=g,_=-1;e:for(;;){if(x=(E|0)%6|0,p=Vn+(x<<4)|0,h[wi>>2]=h[p>>2],h[wi+4>>2]=h[p+4>>2],h[wi+8>>2]=h[p+8>>2],h[wi+12>>2]=h[p+12>>2],p=b,b=w1(wi,xe,0,1)|0,(E|0)>(g|0)&(_c(m)|0)!=0&&(Ro=h[wi>>2]|0,(p|0)!=1&(Ro|0)!=(_|0))){switch(ws=(x+5|0)%6|0,p=h[Vn+(ws<<4)+12>>2]|0,os=+((h[Vn+(ws<<4)+8>>2]|0)-p|0),ie[Ea>>3]=+((h[Vn+(ws<<4)+4>>2]|0)-p|0)-os*.5,ie[we>>3]=os*.8660254037844386,p=h[Vn+(x<<4)+12>>2]|0,os=+((h[Vn+(x<<4)+8>>2]|0)-p|0),ie[je>>3]=+((h[Vn+(x<<4)+4>>2]|0)-p|0)-os*.5,ie[Ae>>3]=os*.8660254037844386,os=+(h[Be>>2]|0),ie[Ut>>3]=os*3,ie[Ke>>3]=0,Os=os*-1.5,ie[lt>>3]=Os,ie[Me>>3]=os*2.598076211353316,ie[pt>>3]=Os,ie[be>>3]=os*-2.598076211353316,h[17008+(ae*80|0)+(((_|0)==(ae|0)?Ro:_)<<2)>>2]|0){case 1:{p=lt,_=Ut;break}case 3:{p=pt,_=lt;break}case 2:{p=Ut,_=pt;break}default:{p=8;break e}}dq(Ea,je,_,p,pi),!(pq(Ea,pi)|0)&&!(pq(je,pi)|0)&&(Wx(pi,ae,xe,1,bi),ws=h[v>>2]|0,os=+qx(+ +ie[q>>3]),Os=+Sa(+ +ie[N>>3],+ +ie[bi>>3]),ie[v+8+(ws<<4)>>3]=os,ie[v+8+(ws<<4)+8>>3]=Os,h[v>>2]=(h[v>>2]|0)+1)}if((E|0)<(se|0)&&(ws=h[K>>2]|0,os=+((h[X>>2]|0)-ws|0),ie[Ea>>3]=+((h[j>>2]|0)-ws|0)-os*.5,ie[ue>>3]=os*.8660254037844386,Wx(Ea,h[wi>>2]|0,xe,1,je),ws=h[v>>2]|0,os=+qx(+ +ie[U>>3]),Os=+Sa(+ +ie[M>>3],+ +ie[je>>3]),ie[v+8+(ws<<4)>>3]=os,ie[v+8+(ws<<4)+8>>3]=Os,h[v>>2]=(h[v>>2]|0)+1),E=E+1|0,(E|0)>=(gt|0)){p=3;break}else _=h[wi>>2]|0}if((p|0)==3){Q=Bs;return}else(p|0)==8&&di(27157,27120,766,27202)}function eq(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0;ae=Q,Q=Q+160|0,_=ae+80|0,v=ae,x=_,b=20336,E=x+72|0;do h[x>>2]=h[b>>2],x=x+4|0,b=b+4|0;while((x|0)<(E|0));x=v,b=20416,E=x+72|0;do h[x>>2]=h[b>>2],x=x+4|0,b=b+4|0;while((x|0)<(E|0));q=(_c(h[m>>2]|0)|0)==0,q=q?_:v,K=p+4|0,x=h[K>>2]|0,j=p+8|0,_=h[j>>2]|0,X=p+12|0,v=h[X>>2]|0,b=_+(x<<1)|0,h[K>>2]=b,_=v+(_<<1)|0,h[j>>2]=_,x=(v<<1)+x|0,h[X>>2]=x,v=_-b|0,E=x-b|0,(b|0)<0&&(h[j>>2]=v,h[X>>2]=E,h[K>>2]=0,_=v,b=0,x=E),E=b-_|0,v=x-_|0,(_|0)<0?(h[K>>2]=E,h[X>>2]=v,h[j>>2]=0,_=0):(v=x,E=b),b=E-v|0,x=_-v|0,(v|0)<0?(h[K>>2]=b,h[j>>2]=x,h[X>>2]=0,v=0):(x=_,b=E),_=(x|0)<(b|0)?x:b,_=(v|0)<(_|0)?v:_,(_|0)>0&&(v=v-_|0,x=x-_|0,b=b-_|0,h[K>>2]=b,h[j>>2]=x,h[X>>2]=v),M=(x<<1)+b|0,E=v+(b<<1)|0,h[K>>2]=E,h[j>>2]=M,x=(v<<1)+x|0,h[X>>2]=x,_=M-E|0,v=x-E|0,(E|0)<0?(h[j>>2]=_,h[X>>2]=v,h[K>>2]=0,E=0,x=v):_=M,b=E-_|0,v=x-_|0,(_|0)<0?(h[K>>2]=b,h[X>>2]=v,h[j>>2]=0,E=b,_=0):v=x,b=E-v|0,x=_-v|0,(v|0)<0?(h[K>>2]=b,h[j>>2]=x,h[X>>2]=0,v=0):(x=_,b=E),_=(x|0)<(b|0)?x:b,_=(v|0)<(_|0)?v:_,(_|0)>0&&(h[K>>2]=b-_,h[j>>2]=x-_,h[X>>2]=v-_),_c(h[m>>2]|0)|0&&(x=h[K>>2]|0,b=h[j>>2]|0,v=h[X>>2]|0,_=(b*3|0)+x|0,x=v+(x*3|0)|0,h[K>>2]=x,h[j>>2]=_,b=(v*3|0)+b|0,h[X>>2]=b,v=_-x|0,E=b-x|0,(x|0)<0?(h[j>>2]=v,h[X>>2]=E,h[K>>2]=0,_=v,M=0):(M=x,E=b),x=M-_|0,v=E-_|0,(_|0)<0?(h[K>>2]=x,h[X>>2]=v,h[j>>2]=0,M=x,b=0):(b=_,v=E),x=M-v|0,_=b-v|0,(v|0)<0?(h[K>>2]=x,h[j>>2]=_,h[X>>2]=0,b=_,v=0):x=M,_=(b|0)<(x|0)?b:x,_=(v|0)<(_|0)?v:_,(_|0)>0&&(h[K>>2]=x-_,h[j>>2]=b-_,h[X>>2]=v-_),h[m>>2]=(h[m>>2]|0)+1),M=0;do h[g+(M<<4)>>2]=h[p>>2],v=h[j>>2]|0,_=h[X>>2]|0,N=h[q+(M*12|0)+4>>2]|0,U=h[q+(M*12|0)+8>>2]|0,b=(h[q+(M*12|0)>>2]|0)+(h[K>>2]|0)|0,m=g+(M<<4)+4|0,h[m>>2]=b,v=N+v|0,N=g+(M<<4)+8|0,h[N>>2]=v,_=U+_|0,U=g+(M<<4)+12|0,h[U>>2]=_,x=v-b|0,(b|0)<0&&(_=_-b|0,h[N>>2]=x,h[U>>2]=_,h[m>>2]=0,v=x,b=0),(v|0)<0&&(b=b-v|0,h[m>>2]=b,_=_-v|0,h[U>>2]=_,h[N>>2]=0,v=0),E=b-_|0,x=v-_|0,(_|0)<0?(h[m>>2]=E,h[N>>2]=x,h[U>>2]=0,b=E,_=0):x=v,v=(x|0)<(b|0)?x:b,v=(_|0)<(v|0)?_:v,(v|0)>0&&(h[m>>2]=b-v,h[N>>2]=x-v,h[U>>2]=_-v),M=M+1|0;while((M|0)!=6);Q=ae}function aL(p,m){return p=p|0,m=m|0,m=tt(p|0,m|0,52)|0,ee()|0,m&15|0}function tq(p,m){return p=p|0,m=m|0,m=tt(p|0,m|0,45)|0,ee()|0,m&127|0}function tue(p,m,g,_){return p=p|0,m=m|0,g=g|0,_=_|0,(g+-1|0)>>>0>14?(_=4,_|0):(g=tt(p|0,m|0,(15-g|0)*3|0)|0,ee()|0,h[_>>2]=g&7,_=0,_|0)}function nue(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0;if(p>>>0>15)return _=4,_|0;if(m>>>0>121)return _=17,_|0;b=ft(p|0,0,52)|0,v=ee()|0,E=ft(m|0,0,45)|0,v=v|(ee()|0)|134225919;e:do if((p|0)>=1){for(E=1,b=(He[20496+m>>0]|0)!=0,x=-1;;){if(m=h[g+(E+-1<<2)>>2]|0,m>>>0>6){v=18,m=10;break}if(!((m|0)==0|b^1))if((m|0)==1){v=19,m=10;break}else b=0;if(N=(15-E|0)*3|0,M=ft(7,0,N|0)|0,v=v&~(ee()|0),m=ft(m|0,((m|0)<0)<<31>>31|0,N|0)|0,x=m|x&~M,v=ee()|0|v,(E|0)<(p|0))E=E+1|0;else break e}if((m|0)==10)return v|0}else x=-1;while(!1);return N=_,h[N>>2]=x,h[N+4>>2]=v,N=0,N|0}function sT(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0;return!(!0&(m&-16777216|0)==134217728)||(_=tt(p|0,m|0,52)|0,ee()|0,_=_&15,g=tt(p|0,m|0,45)|0,ee()|0,g=g&127,g>>>0>121)?(p=0,p|0):(b=(_^15)*3|0,v=tt(p|0,m|0,b|0)|0,b=ft(v|0,ee()|0,b|0)|0,v=ee()|0,x=eo(-1227133514,-1171,b|0,v|0)|0,!((b&613566756&x|0)==0&(v&4681&(ee()|0)|0)==0)||(b=(_*3|0)+19|0,x=ft(~p|0,~m|0,b|0)|0,b=tt(x|0,ee()|0,b|0)|0,!((_|0)==15|(b|0)==0&(ee()|0)==0))?(b=0,b|0):!(He[20496+g>>0]|0)||(m=m&8191,(p|0)==0&(m|0)==0)?(b=1,b|0):(b=wL(p|0,m|0,0)|0,ee()|0,((63-b|0)%3|0|0)!=0|0))}function iue(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0;return!0&(m&-16777216|0)==134217728&&(_=tt(p|0,m|0,52)|0,ee()|0,_=_&15,g=tt(p|0,m|0,45)|0,ee()|0,g=g&127,g>>>0<=121)&&(b=(_^15)*3|0,v=tt(p|0,m|0,b|0)|0,b=ft(v|0,ee()|0,b|0)|0,v=ee()|0,x=eo(-1227133514,-1171,b|0,v|0)|0,(b&613566756&x|0)==0&(v&4681&(ee()|0)|0)==0)&&(b=(_*3|0)+19|0,x=ft(~p|0,~m|0,b|0)|0,b=tt(x|0,ee()|0,b|0)|0,(_|0)==15|(b|0)==0&(ee()|0)==0)&&(!(He[20496+g>>0]|0)||(g=m&8191,(p|0)==0&(g|0)==0)||(b=wL(p|0,g|0,0)|0,ee()|0,(63-b|0)%3|0|0))||KG(p,m)|0?(b=1,b|0):(b=(mq(p,m)|0)!=0&1,b|0)}function lL(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0;if(v=ft(m|0,0,52)|0,x=ee()|0,g=ft(g|0,0,45)|0,g=x|(ee()|0)|134225919,(m|0)<1){x=-1,_=g,m=p,h[m>>2]=x,p=p+4|0,h[p>>2]=_;return}for(x=1,v=-1;b=(15-x|0)*3|0,E=ft(7,0,b|0)|0,g=g&~(ee()|0),b=ft(_|0,0,b|0)|0,v=v&~E|b,g=g|(ee()|0),(x|0)!=(m|0);)x=x+1|0;E=p,b=E,h[b>>2]=v,E=E+4|0,h[E>>2]=g}function cL(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0;if(x=tt(p|0,m|0,52)|0,ee()|0,x=x&15,g>>>0>15)return _=4,_|0;if((x|0)<(g|0))return _=12,_|0;if((x|0)==(g|0))return h[_>>2]=p,h[_+4>>2]=m,_=0,_|0;if(v=ft(g|0,0,52)|0,v=v|p,p=ee()|0|m&-15728641,(x|0)>(g|0))do m=ft(7,0,(14-g|0)*3|0)|0,g=g+1|0,v=m|v,p=ee()|0|p;while((g|0)<(x|0));return h[_>>2]=v,h[_+4>>2]=p,_=0,_|0}function jx(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0;if(x=tt(p|0,m|0,52)|0,ee()|0,x=x&15,!((g|0)<16&(x|0)<=(g|0)))return _=4,_|0;v=g-x|0,g=tt(p|0,m|0,45)|0,ee()|0;e:do if(!(yr(g&127)|0))g=ap(7,0,v,((v|0)<0)<<31>>31)|0,v=ee()|0;else{t:do if(x|0){for(g=1;b=ft(7,0,(15-g|0)*3|0)|0,!!((b&p|0)==0&((ee()|0)&m|0)==0);)if(g>>>0<x>>>0)g=g+1|0;else break t;g=ap(7,0,v,((v|0)<0)<<31>>31)|0,v=ee()|0;break e}while(!1);g=ap(7,0,v,((v|0)<0)<<31>>31)|0,g=wr(g|0,ee()|0,5,0)|0,g=At(g|0,ee()|0,-5,-1)|0,g=lp(g|0,ee()|0,6,0)|0,g=At(g|0,ee()|0,1,0)|0,v=ee()|0}while(!1);return b=_,h[b>>2]=g,h[b+4>>2]=v,b=0,b|0}function Zi(p,m){p=p|0,m=m|0;var g=0,_=0,v=0;if(v=tt(p|0,m|0,45)|0,ee()|0,!(yr(v&127)|0))return v=0,v|0;v=tt(p|0,m|0,52)|0,ee()|0,v=v&15;e:do if(!v)g=0;else for(_=1;;){if(g=tt(p|0,m|0,(15-_|0)*3|0)|0,ee()|0,g=g&7,g|0)break e;if(_>>>0<v>>>0)_=_+1|0;else{g=0;break}}while(!1);return v=(g|0)==0&1,v|0}function rue(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0;if(b=Q,Q=Q+16|0,x=b,mL(x,p,m,g),m=x,p=h[m>>2]|0,m=h[m+4>>2]|0,(p|0)==0&(m|0)==0)return Q=b,0;v=0,g=0;do E=_+(v<<3)|0,h[E>>2]=p,h[E+4>>2]=m,v=At(v|0,g|0,1,0)|0,g=ee()|0,AL(x),E=x,p=h[E>>2]|0,m=h[E+4>>2]|0;while(!((p|0)==0&(m|0)==0));return Q=b,0}function nq(p,m,g,_){return p=p|0,m=m|0,g=g|0,_=_|0,(_|0)<(g|0)?(g=m,_=p,On(g|0),_|0):(g=ft(-1,-1,((_-g|0)*3|0)+3|0)|0,_=ft(~g|0,~(ee()|0)|0,(15-_|0)*3|0)|0,g=~(ee()|0)&m,_=~_&p,On(g|0),_|0)}function iq(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0;return v=tt(p|0,m|0,52)|0,ee()|0,v=v&15,(g|0)<16&(v|0)<=(g|0)?((v|0)<(g|0)&&(v=ft(-1,-1,((g+-1-v|0)*3|0)+3|0)|0,v=ft(~v|0,~(ee()|0)|0,(15-g|0)*3|0)|0,m=~(ee()|0)&m,p=~v&p),v=ft(g|0,0,52)|0,g=m&-15728641|(ee()|0),h[_>>2]=p|v,h[_+4>>2]=g,_=0,_|0):(_=4,_|0)}function sue(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0,be=0,gt=0,je=0,Ut=0,lt=0,pt=0;if((g|0)==0&(_|0)==0)return pt=0,pt|0;if(v=p,x=h[v>>2]|0,v=h[v+4>>2]|0,!0&(v&15728640|0)==0){if(!((_|0)>0|(_|0)==0&g>>>0>0)||(pt=m,h[pt>>2]=x,h[pt+4>>2]=v,(g|0)==1&(_|0)==0))return pt=0,pt|0;v=1,x=0;do Ut=p+(v<<3)|0,lt=h[Ut+4>>2]|0,pt=m+(v<<3)|0,h[pt>>2]=h[Ut>>2],h[pt+4>>2]=lt,v=At(v|0,x|0,1,0)|0,x=ee()|0;while((x|0)<(_|0)|(x|0)==(_|0)&v>>>0<g>>>0);return v=0,v|0}if(je=g<<3,lt=br(je)|0,!lt)return pt=13,pt|0;if(hu(lt|0,p|0,je|0)|0,Ut=Ta(g,8)|0,!Ut)return _t(lt),pt=13,pt|0;e:for(;;){v=lt,N=h[v>>2]|0,v=h[v+4>>2]|0,be=tt(N|0,v|0,52)|0,ee()|0,be=be&15,gt=be+-1|0,Me=(be|0)!=0,Ke=(_|0)>0|(_|0)==0&g>>>0>0;t:do if(Me&Ke){if(se=ft(gt|0,0,52)|0,we=ee()|0,gt>>>0>15){if(!((N|0)==0&(v|0)==0)){pt=16;break e}for(x=0,p=0;;){if(x=At(x|0,p|0,1,0)|0,p=ee()|0,!((p|0)<(_|0)|(p|0)==(_|0)&x>>>0<g>>>0))break t;if(b=lt+(x<<3)|0,Be=h[b>>2]|0,b=h[b+4>>2]|0,!((Be|0)==0&(b|0)==0)){v=b,pt=16;break e}}}for(E=N,p=v,x=0,b=0;;){if(!((E|0)==0&(p|0)==0)){if(!(!0&(p&117440512|0)==0)){pt=21;break e}if(U=tt(E|0,p|0,52)|0,ee()|0,U=U&15,(U|0)<(gt|0)){v=12,pt=27;break e}if((U|0)!=(gt|0)&&(E=E|se,p=p&-15728641|we,U>>>0>=be>>>0)){M=gt;do Be=ft(7,0,(14-M|0)*3|0)|0,M=M+1|0,E=Be|E,p=ee()|0|p;while(M>>>0<U>>>0)}if(j=Hf(E|0,p|0,g|0,_|0)|0,X=ee()|0,M=Ut+(j<<3)|0,U=M,q=h[U>>2]|0,U=h[U+4>>2]|0,!((q|0)==0&(U|0)==0)){ue=0,xe=0;do{if((ue|0)>(_|0)|(ue|0)==(_|0)&xe>>>0>g>>>0){pt=31;break e}if((q|0)==(E|0)&(U&-117440513|0)==(p|0)){K=tt(q|0,U|0,56)|0,ee()|0,K=K&7,ae=K+1|0,Be=tt(q|0,U|0,45)|0,ee()|0;n:do if(!(yr(Be&127)|0))U=7;else{if(q=tt(q|0,U|0,52)|0,ee()|0,q=q&15,!q){U=6;break}for(U=1;;){if(Be=ft(7,0,(15-U|0)*3|0)|0,!((Be&E|0)==0&((ee()|0)&p|0)==0)){U=7;break n}if(U>>>0<q>>>0)U=U+1|0;else{U=6;break}}}while(!1);if((K+2|0)>>>0>U>>>0){pt=41;break e}Be=ft(ae|0,0,56)|0,p=ee()|0|p&-117440513,Ae=M,h[Ae>>2]=0,h[Ae+4>>2]=0,E=Be|E}else j=At(j|0,X|0,1,0)|0,j=cp(j|0,ee()|0,g|0,_|0)|0,X=ee()|0;xe=At(xe|0,ue|0,1,0)|0,ue=ee()|0,M=Ut+(j<<3)|0,U=M,q=h[U>>2]|0,U=h[U+4>>2]|0}while(!((q|0)==0&(U|0)==0))}Be=M,h[Be>>2]=E,h[Be+4>>2]=p}if(x=At(x|0,b|0,1,0)|0,b=ee()|0,!((b|0)<(_|0)|(b|0)==(_|0)&x>>>0<g>>>0))break t;p=lt+(x<<3)|0,E=h[p>>2]|0,p=h[p+4>>2]|0}}while(!1);if(Be=At(g|0,_|0,5,0)|0,Ae=ee()|0,Ae>>>0<0|(Ae|0)==0&Be>>>0<11){pt=85;break}if(Be=lp(g|0,_|0,6,0)|0,ee()|0,Be=Ta(Be,8)|0,!Be){pt=48;break}do if(Ke){for(ae=0,p=0,K=0,ue=0;;){if(U=Ut+(ae<<3)|0,b=U,x=h[b>>2]|0,b=h[b+4>>2]|0,(x|0)==0&(b|0)==0)Ae=K;else{q=tt(x|0,b|0,56)|0,ee()|0,q=q&7,E=q+1|0,j=b&-117440513,Ae=tt(x|0,b|0,45)|0,ee()|0;t:do if(yr(Ae&127)|0){if(X=tt(x|0,b|0,52)|0,ee()|0,X=X&15,X|0)for(M=1;;){if(Ae=ft(7,0,(15-M|0)*3|0)|0,!((x&Ae|0)==0&(j&(ee()|0)|0)==0))break t;if(M>>>0<X>>>0)M=M+1|0;else break}b=ft(E|0,0,56)|0,x=b|x,b=ee()|0|j,E=U,h[E>>2]=x,h[E+4>>2]=b,E=q+2|0}while(!1);(E|0)==7?(Ae=Be+(p<<3)|0,h[Ae>>2]=x,h[Ae+4>>2]=b&-117440513,p=At(p|0,K|0,1,0)|0,Ae=ee()|0):Ae=K}if(ae=At(ae|0,ue|0,1,0)|0,ue=ee()|0,(ue|0)<(_|0)|(ue|0)==(_|0)&ae>>>0<g>>>0)K=Ae;else break}if(Ke){if(xe=gt>>>0>15,se=ft(gt|0,0,52)|0,we=ee()|0,!Me){for(x=0,M=0,E=0,b=0;(N|0)==0&(v|0)==0||(gt=m+(x<<3)|0,h[gt>>2]=N,h[gt+4>>2]=v,x=At(x|0,M|0,1,0)|0,M=ee()|0),E=At(E|0,b|0,1,0)|0,b=ee()|0,!!((b|0)<(_|0)|(b|0)==(_|0)&E>>>0<g>>>0);)v=lt+(E<<3)|0,N=h[v>>2]|0,v=h[v+4>>2]|0;v=Ae;break}for(x=0,M=0,b=0,E=0;;){do if(!((N|0)==0&(v|0)==0)){if(X=tt(N|0,v|0,52)|0,ee()|0,X=X&15,xe|(X|0)<(gt|0)){pt=80;break e}if((X|0)!=(gt|0)){if(U=N|se,q=v&-15728641|we,X>>>0>=be>>>0){j=gt;do Me=ft(7,0,(14-j|0)*3|0)|0,j=j+1|0,U=Me|U,q=ee()|0|q;while(j>>>0<X>>>0)}}else U=N,q=v;K=Hf(U|0,q|0,g|0,_|0)|0,j=0,X=0,ue=ee()|0;do{if((j|0)>(_|0)|(j|0)==(_|0)&X>>>0>g>>>0){pt=81;break e}if(Me=Ut+(K<<3)|0,ae=h[Me+4>>2]|0,(ae&-117440513|0)==(q|0)&&(h[Me>>2]|0)==(U|0)){pt=65;break}Me=At(K|0,ue|0,1,0)|0,K=cp(Me|0,ee()|0,g|0,_|0)|0,ue=ee()|0,X=At(X|0,j|0,1,0)|0,j=ee()|0,Me=Ut+(K<<3)|0}while(!((h[Me>>2]|0)==(U|0)&&(h[Me+4>>2]|0)==(q|0)));if((pt|0)==65&&(pt=0,!0&(ae&117440512|0)==100663296))break;Me=m+(x<<3)|0,h[Me>>2]=N,h[Me+4>>2]=v,x=At(x|0,M|0,1,0)|0,M=ee()|0}while(!1);if(b=At(b|0,E|0,1,0)|0,E=ee()|0,!((E|0)<(_|0)|(E|0)==(_|0)&b>>>0<g>>>0))break;v=lt+(b<<3)|0,N=h[v>>2]|0,v=h[v+4>>2]|0}v=Ae}else x=0,v=Ae}else x=0,p=0,v=0;while(!1);if(up(Ut|0,0,je|0)|0,hu(lt|0,Be|0,p<<3|0)|0,_t(Be),(p|0)==0&(v|0)==0){pt=89;break}else m=m+(x<<3)|0,_=v,g=p}if((pt|0)==16)!0&(v&117440512|0)==0?(v=4,pt=27):pt=21;else if((pt|0)==31)di(27634,27225,620,27235);else{if((pt|0)==41)return _t(lt),_t(Ut),pt=10,pt|0;if((pt|0)==48)return _t(lt),_t(Ut),pt=13,pt|0;(pt|0)==80?di(27634,27225,711,27235):(pt|0)==81?di(27634,27225,723,27235):(pt|0)==85&&(hu(m|0,lt|0,g<<3|0)|0,pt=89)}return(pt|0)==21?(_t(lt),_t(Ut),pt=5,pt|0):(pt|0)==27?(_t(lt),_t(Ut),pt=v,pt|0):(pt|0)==89?(_t(lt),_t(Ut),pt=0,pt|0):0}function oue(p,m,g,_,v,x,b){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0,x=x|0,b=b|0;var E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0;if(ae=Q,Q=Q+16|0,K=ae,!((g|0)>0|(g|0)==0&m>>>0>0))return K=0,Q=ae,K|0;if((b|0)>=16)return K=12,Q=ae,K|0;j=0,X=0,q=0,E=0;e:for(;;){if(N=p+(j<<3)|0,M=h[N>>2]|0,N=h[N+4>>2]|0,U=tt(M|0,N|0,52)|0,ee()|0,(U&15|0)>(b|0)){E=12,M=11;break}if(mL(K,M,N,b),U=K,N=h[U>>2]|0,U=h[U+4>>2]|0,(N|0)==0&(U|0)==0)M=q;else{M=q;do{if(!((E|0)<(x|0)|(E|0)==(x|0)&M>>>0<v>>>0)){M=10;break e}q=_+(M<<3)|0,h[q>>2]=N,h[q+4>>2]=U,M=At(M|0,E|0,1,0)|0,E=ee()|0,AL(K),q=K,N=h[q>>2]|0,U=h[q+4>>2]|0}while(!((N|0)==0&(U|0)==0))}if(j=At(j|0,X|0,1,0)|0,X=ee()|0,(X|0)<(g|0)|(X|0)==(g|0)&j>>>0<m>>>0)q=M;else{E=0,M=11;break}}return(M|0)==10?(K=14,Q=ae,K|0):(M|0)==11?(Q=ae,E|0):0}function aue(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0;j=Q,Q=Q+16|0,q=j;e:do if((g|0)>0|(g|0)==0&m>>>0>0){for(N=0,b=0,x=0,U=0;;){if(M=p+(N<<3)|0,E=h[M>>2]|0,M=h[M+4>>2]|0,!((E|0)==0&(M|0)==0)&&(M=(jx(E,M,_,q)|0)==0,E=q,b=At(h[E>>2]|0,h[E+4>>2]|0,b|0,x|0)|0,x=ee()|0,!M)){x=12;break}if(N=At(N|0,U|0,1,0)|0,U=ee()|0,!((U|0)<(g|0)|(U|0)==(g|0)&N>>>0<m>>>0))break e}return Q=j,x|0}else b=0,x=0;while(!1);return h[v>>2]=b,h[v+4>>2]=x,v=0,Q=j,v|0}function lue(p,m){return p=p|0,m=m|0,m=tt(p|0,m|0,52)|0,ee()|0,m&1|0}function al(p,m){p=p|0,m=m|0;var g=0,_=0,v=0;if(v=tt(p|0,m|0,52)|0,ee()|0,v=v&15,!v)return v=0,v|0;for(_=1;;){if(g=tt(p|0,m|0,(15-_|0)*3|0)|0,ee()|0,g=g&7,g|0){_=5;break}if(_>>>0<v>>>0)_=_+1|0;else{g=0,_=5;break}}return(_|0)==5?g|0:0}function uL(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0;if(U=tt(p|0,m|0,52)|0,ee()|0,U=U&15,!U)return N=m,U=p,On(N|0),U|0;for(N=1,g=0;;){switch(_=(15-N|0)*3|0,E=ft(7,0,_|0)|0,M=ee()|0,x=p&~E,b=m&~M,p=tt(p|0,m|0,_|0)|0,ee()|0,p&7){case 1:{p=5;break}case 5:{p=4;break}case 4:{p=6;break}case 6:{p=2;break}case 2:{p=3;break}case 3:{p=1;break}default:p=p&7}_=ft(p|0,0,_|0)|0,v=ee()|0,p=_|x,m=v|b;e:do if(!g)if((_&E|0)==0&(v&M|0)==0)g=0;else if(b=tt(p|0,m|0,52)|0,ee()|0,b=b&15,!b)g=1;else{g=1;t:for(;;){switch(M=tt(p|0,m|0,(15-g|0)*3|0)|0,ee()|0,M&7){case 1:break t;case 0:break;default:{g=1;break e}}if(g>>>0<b>>>0)g=g+1|0;else{g=1;break e}}for(x=1;;){switch(v=(15-x|0)*3|0,g=tt(p|0,m|0,v|0)|0,ee()|0,_=ft(7,0,v|0)|0,_=p&~_,m=m&~(ee()|0),g&7){case 1:{p=5;break}case 5:{p=4;break}case 4:{p=6;break}case 6:{p=2;break}case 2:{p=3;break}case 3:{p=1;break}default:p=g&7}if(p=ft(p|0,0,v|0)|0,p=p|_,m=ee()|0|m,x>>>0<b>>>0)x=x+1|0;else{g=1;break e}}}while(!1);if(N>>>0<U>>>0)N=N+1|0;else break}return On(m|0),p|0}function zm(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0;if(b=tt(p|0,m|0,52)|0,ee()|0,b=b&15,!b)return x=m,b=p,On(x|0),b|0;for(x=1;;){switch(v=(15-x|0)*3|0,g=tt(p|0,m|0,v|0)|0,ee()|0,_=ft(7,0,v|0)|0,_=p&~_,m=m&~(ee()|0),g&7){case 1:{p=5;break}case 5:{p=4;break}case 4:{p=6;break}case 6:{p=2;break}case 2:{p=3;break}case 3:{p=1;break}default:p=g&7}if(p=ft(p|0,0,v|0)|0,p=p|_,m=ee()|0|m,x>>>0<b>>>0)x=x+1|0;else break}return On(m|0),p|0}function cue(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0;if(U=tt(p|0,m|0,52)|0,ee()|0,U=U&15,!U)return N=m,U=p,On(N|0),U|0;for(N=1,g=0;;){switch(_=(15-N|0)*3|0,E=ft(7,0,_|0)|0,M=ee()|0,x=p&~E,b=m&~M,p=tt(p|0,m|0,_|0)|0,ee()|0,p&7){case 1:{p=3;break}case 3:{p=2;break}case 2:{p=6;break}case 6:{p=4;break}case 4:{p=5;break}case 5:{p=1;break}default:p=p&7}_=ft(p|0,0,_|0)|0,v=ee()|0,p=_|x,m=v|b;e:do if(!g)if((_&E|0)==0&(v&M|0)==0)g=0;else if(b=tt(p|0,m|0,52)|0,ee()|0,b=b&15,!b)g=1;else{g=1;t:for(;;){switch(M=tt(p|0,m|0,(15-g|0)*3|0)|0,ee()|0,M&7){case 1:break t;case 0:break;default:{g=1;break e}}if(g>>>0<b>>>0)g=g+1|0;else{g=1;break e}}for(x=1;;){switch(g=(15-x|0)*3|0,_=ft(7,0,g|0)|0,_=p&~_,v=m&~(ee()|0),p=tt(p|0,m|0,g|0)|0,ee()|0,p&7){case 1:{p=3;break}case 3:{p=2;break}case 2:{p=6;break}case 6:{p=4;break}case 4:{p=5;break}case 5:{p=1;break}default:p=p&7}if(p=ft(p|0,0,g|0)|0,p=p|_,m=ee()|0|v,x>>>0<b>>>0)x=x+1|0;else{g=1;break e}}}while(!1);if(N>>>0<U>>>0)N=N+1|0;else break}return On(m|0),p|0}function hL(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0;if(b=tt(p|0,m|0,52)|0,ee()|0,b=b&15,!b)return x=m,b=p,On(x|0),b|0;for(x=1;;){switch(_=(15-x|0)*3|0,g=ft(7,0,_|0)|0,g=p&~g,v=m&~(ee()|0),p=tt(p|0,m|0,_|0)|0,ee()|0,p&7){case 1:{p=3;break}case 3:{p=2;break}case 2:{p=6;break}case 6:{p=4;break}case 4:{p=5;break}case 5:{p=1;break}default:p=p&7}if(p=ft(p|0,0,_|0)|0,p=p|g,m=ee()|0|v,x>>>0<b>>>0)x=x+1|0;else break}return On(m|0),p|0}function uue(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0;if(Ae=Q,Q=Q+16|0,we=Ae,ft(m|0,0,52)|0,g=ee()|0|134225919,!m)return(h[p+4>>2]|0)>2||(h[p+8>>2]|0)>2||(h[p+12>>2]|0)>2?(se=0,we=0,On(se|0),Q=Ae,we|0):(ft(WG(p)|0,0,45)|0,se=ee()|0|g,we=-1,On(se|0),Q=Ae,we|0);h[we>>2]=h[p>>2],h[we+4>>2]=h[p+4>>2],h[we+8>>2]=h[p+8>>2],h[we+12>>2]=h[p+12>>2],se=we+4|0;e:do if((m|0)>0)for(ae=we+8|0,ue=we+12|0,K=m,q=h[ae>>2]|0,j=h[ue>>2]|0,m=-1,U=h[we+4>>2]|0;;){X=K,K=K+-1|0,p=U-j|0,_=q-j|0,X&1?(x=rh(+((p*3|0)-_|0)*.14285714285714285)|0,h[se>>2]=x,p=rh(+((_<<1)+p|0)*.14285714285714285)|0,h[ae>>2]=p,h[ue>>2]=0,_=p-x|0,v=0-x|0,(x|0)<0?(h[ae>>2]=_,h[ue>>2]=v,h[se>>2]=0,p=_,b=0):(b=x,v=0),x=b-p|0,_=v-p|0,(p|0)<0?(h[se>>2]=x,h[ue>>2]=_,h[ae>>2]=0,b=x,x=0):(_=v,x=p),p=b-_|0,v=x-_|0,(_|0)<0?(h[se>>2]=p,h[ae>>2]=v,h[ue>>2]=0,x=0):(v=x,p=b,x=_),_=(v|0)<(p|0)?v:p,_=(x|0)<(_|0)?x:_,(_|0)>0&&(x=x-_|0,v=v-_|0,p=p-_|0,h[se>>2]=p,h[ae>>2]=v,h[ue>>2]=x),Ke=v+(p*3|0)|0,Be=(Ke|0)<0,N=x+(v*3|0)-(Be?Ke:0)|0,M=(N|0)<0,_=(x*3|0)+p-(Be?Ke:0)-(M?N:0)|0,E=(_|0)<0,Me=E?0:_,b=(M?0:N)-(E?_:0)|0,_=(Be?0:Ke)-(M?N:0)-(E?_:0)|0,E=(b|0)<(_|0)?b:_,E=(Me|0)<(E|0)?Me:E,N=(E|0)>0,M=N?E:0,b=b-(N?E:0)|0,E=Me-(N?E:0)|0,N=x):(E=rh(+((p<<1)+_|0)*.14285714285714285)|0,h[se>>2]=E,v=rh(+((_*3|0)-p|0)*.14285714285714285)|0,h[ae>>2]=v,h[ue>>2]=0,_=v-E|0,p=0-E|0,(E|0)<0?(h[ae>>2]=_,h[ue>>2]=p,h[se>>2]=0,v=_,E=0):p=0,b=E-v|0,_=p-v|0,(v|0)<0?(h[se>>2]=b,h[ue>>2]=_,h[ae>>2]=0,x=_,v=0):(x=p,b=E),p=b-x|0,_=v-x|0,(x|0)<0?(h[se>>2]=p,h[ae>>2]=_,h[ue>>2]=0,v=_,x=0):p=b,_=(v|0)<(p|0)?v:p,_=(x|0)<(_|0)?x:_,(_|0)>0&&(x=x-_|0,v=v-_|0,p=p-_|0,h[se>>2]=p,h[ae>>2]=v,h[ue>>2]=x),Ke=x+(p*3|0)|0,Me=(Ke|0)<0,N=(v*3|0)+p-(Me?Ke:0)|0,M=(N|0)<0,_=(x*3|0)+v-(Me?Ke:0)-(M?N:0)|0,E=(_|0)<0,Be=E?0:_,b=(M?0:N)-(E?_:0)|0,_=(Me?0:Ke)-(M?N:0)-(E?_:0)|0,E=(b|0)<(_|0)?b:_,E=(Be|0)<(E|0)?Be:E,N=(E|0)>0,M=N?E:0,b=b-(N?E:0)|0,E=Be-(N?E:0)|0,N=x),_=U+(M-_)|0,x=(_|0)<0,M=q-b-(x?_:0)|0,b=(M|0)<0,j=j-E+(x?0-_|0:0)+(b?0-M|0:0)|0,U=(j|0)<0,E=U?0:j,Me=(b?0:M)-(U?j:0)|0,j=(x?0:_)-(b?M:0)-(U?j:0)|0,U=(Me|0)<(j|0)?Me:j,U=(E|0)<(U|0)?E:U,M=(U|0)>0,j=j-(M?U:0)|0,b=(15-X|0)*3|0,_=ft(7,0,b|0)|0,_=m&~_,x=g&~(ee()|0),q=(j|0)<0,Ke=q?j:0,Me=Me-(M?U:0)-Ke|0,Be=(Me|0)<0,Ke=(Be?0-Me|0:0)+(E-(M?U:0)-Ke)|0,g=(Ke|0)<0,m=g?0:Ke,Ke=g?Ke:0,g=(Be?0:Me)-Ke|0,Ke=(q?0:j)-(Be?Me:0)-Ke|0,Me=(g|0)<(Ke|0)?g:Ke,Me=(m|0)<(Me|0)?m:Me,Me=(Me|0)>0?Me:0,m=m-Me|0,g=g-Me|0;t:do switch(Ke-Me|0){case 0:switch(g|0){case 0:{m=(m|0)==0?0:(m|0)==1?1:7;break t}case 1:{m=(m|0)==0?2:(m|0)==1?3:7;break t}default:{xe=36;break t}}case 1:switch(g|0){case 0:{m=(m|0)==0?4:(m|0)==1?5:7;break t}case 1:if(m){xe=36;break t}else{m=6;break t}default:{xe=36;break t}}default:xe=36}while(!1);if((xe|0)==36&&(xe=0,m=7),m=ft(m|0,0,b|0)|0,m=m|_,g=ee()|0|x,(X|0)<=1)break e;q=v,j=N,U=p}else m=-1,p=h[se>>2]|0;while(!1);e:do if((p|0)<=2&&(h[we+8>>2]|0)<=2&&(h[we+12>>2]|0)<=2){if(_=WG(we)|0,p=ft(_|0,0,45)|0,m=p|m,p=ee()|0|g&-1040385,M=Lce(we)|0,!(yr(_)|0)){if((M|0)<=0)break;for(E=0;;){b=tt(m|0,p|0,52)|0,ee()|0,b=b&15;t:do if(b)for(x=1;;){switch(v=(15-x|0)*3|0,g=tt(m|0,p|0,v|0)|0,ee()|0,_=ft(7,0,v|0)|0,m=m&~_,_=p&~(ee()|0),g&7){case 1:{p=5;break}case 5:{p=4;break}case 4:{p=6;break}case 6:{p=2;break}case 2:{p=3;break}case 3:{p=1;break}default:p=g&7}if(p=ft(p|0,0,v|0)|0,m=p|m,p=ee()|0|_,x>>>0<b>>>0)x=x+1|0;else break t}while(!1);if(E=E+1|0,(E|0)==(M|0))break e}}b=tt(m|0,p|0,52)|0,ee()|0,b=b&15;t:do if(b){g=1;n:for(;;){switch(Me=tt(m|0,p|0,(15-g|0)*3|0)|0,ee()|0,Me&7){case 1:break n;case 0:break;default:break t}if(g>>>0<b>>>0)g=g+1|0;else break t}if(jG(_,h[we>>2]|0)|0)for(x=1;;){switch(g=(15-x|0)*3|0,_=ft(7,0,g|0)|0,_=m&~_,v=p&~(ee()|0),p=tt(m|0,p|0,g|0)|0,ee()|0,p&7){case 1:{p=3;break}case 3:{p=2;break}case 2:{p=6;break}case 6:{p=4;break}case 4:{p=5;break}case 5:{p=1;break}default:p=p&7}if(m=ft(p|0,0,g|0)|0,m=m|_,p=ee()|0|v,x>>>0<b>>>0)x=x+1|0;else break t}else for(x=1;;){switch(v=(15-x|0)*3|0,g=tt(m|0,p|0,v|0)|0,ee()|0,_=ft(7,0,v|0)|0,m=m&~_,_=p&~(ee()|0),g&7){case 1:{p=5;break}case 5:{p=4;break}case 4:{p=6;break}case 6:{p=2;break}case 2:{p=3;break}case 3:{p=1;break}default:p=g&7}if(p=ft(p|0,0,v|0)|0,m=p|m,p=ee()|0|_,x>>>0<b>>>0)x=x+1|0;else break t}}while(!1);if((M|0)>0){g=0;do m=uL(m,p)|0,p=ee()|0,g=g+1|0;while((g|0)!=(M|0))}}else m=0,p=0;while(!1);return Ke=p,Me=m,On(Ke|0),Q=Ae,Me|0}function _c(p){return p=p|0,(p|0)%2|0|0}function fL(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0;if(U=Q,Q=Q+64|0,E=U+24|0,M=U+48|0,N=U,m>>>0>15)return N=4,Q=U,N|0;if(x=+ie[p>>3],ie[or>>3]=x,(h[or+4>>2]&2146435072|0)==2146435072||(_=+ie[p+8>>3],ie[or>>3]=_,(h[or+4>>2]&2146435072|0)==2146435072))return N=3,Q=U,N|0;v=+ii(+x),q=v*+ii(+_),v=v*+zi(+_),_=+zi(+x),ie[N>>3]=q,ie[N+8>>3]=v,ie[N+16>>3]=_,ie[or>>3]=q;do if((h[or+4>>2]&2146435072|0)!=2146435072&&(ie[or>>3]=_,p=h[or+4>>2]|0,ie[or>>3]=v,!((h[or+4>>2]&2146435072|0)==2146435072|!0&(p&2146435072|0)==2146435072)))if(h[E>>2]=h[N>>2],h[E+4>>2]=h[N+4>>2],h[E+8>>2]=h[N+8>>2],h[E+12>>2]=h[N+12>>2],h[E+16>>2]=h[N+16>>2],h[E+20>>2]=h[N+20>>2],Qce(E,m,M),M=uue(M,m)|0,N=ee()|0,h[g>>2]=M,h[g+4>>2]=N,(M|0)==0&(N|0)==0)di(27634,27225,1073,27248);else{b=0;break}else b=2;while(!1);return N=b,Q=U,N|0}function dL(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0;if(X=g+4|0,K=tt(p|0,m|0,52)|0,ee()|0,K=K&15,j=tt(p|0,m|0,45)|0,ee()|0,_=(K|0)==0,yr(j&127)|0){if(_)return K=1,K|0;_=1}else{if(_)return K=0,K|0;(h[X>>2]|0)==0&&(h[g+8>>2]|0)==0?_=(h[g+12>>2]|0)!=0&1:_=1}for(j=g+8|0,q=g+12|0,U=1,g=h[X>>2]|0,b=h[j>>2]|0,x=h[q>>2]|0;v=g*3|0,E=b*3|0,N=x*3|0,U&1?(M=b+v|0,h[X>>2]=M,x=x+E|0,h[j>>2]=x,v=N+g|0,h[q>>2]=v,g=x-M|0,b=v-M|0,(M|0)<0?(h[j>>2]=g,h[q>>2]=b,h[X>>2]=0,E=0,v=b):(g=x,E=M),b=E-g|0,x=v-g|0,(g|0)<0?(h[X>>2]=b,h[q>>2]=x,h[j>>2]=0,E=b,v=0):(x=v,v=g),g=E-x|0,b=v-x|0,(x|0)<0?(h[X>>2]=g,h[j>>2]=b,h[q>>2]=0,x=0):(b=v,g=E),v=(b|0)<(g|0)?b:g,v=(x|0)<(v|0)?x:v,(v|0)>0&&(x=x-v|0,b=b-v|0,g=g-v|0,h[X>>2]=g,h[j>>2]=b,h[q>>2]=x)):(M=E+g|0,E=x+v|0,h[X>>2]=E,h[j>>2]=M,v=N+b|0,h[q>>2]=v,g=M-E|0,x=v-E|0,(E|0)<0?(h[j>>2]=g,h[q>>2]=x,h[X>>2]=0,E=0,v=x):g=M,b=E-g|0,x=v-g|0,(g|0)<0?(h[X>>2]=b,h[q>>2]=x,h[j>>2]=0,E=b,v=0):(x=v,v=g),g=E-x|0,b=v-x|0,(x|0)<0?(h[X>>2]=g,h[j>>2]=b,h[q>>2]=0,x=0):(b=v,g=E),v=(b|0)<(g|0)?b:g,v=(x|0)<(v|0)?x:v,(v|0)>0&&(x=x-v|0,b=b-v|0,g=g-v|0,h[X>>2]=g,h[j>>2]=b,h[q>>2]=x)),v=tt(p|0,m|0,(15-U|0)*3|0)|0,ee()|0,v=v&7,(v+-1|0)>>>0<6&&(M=h[22032+(v*12|0)+4>>2]|0,N=h[22032+(v*12|0)+8>>2]|0,E=(h[22032+(v*12|0)>>2]|0)+g|0,h[X>>2]=E,b=M+b|0,h[j>>2]=b,g=N+x|0,h[q>>2]=g,x=b-E|0,v=g-E|0,(E|0)<0&&(h[j>>2]=x,h[q>>2]=v,h[X>>2]=0,E=0,g=v,b=x),v=E-b|0,x=g-b|0,(b|0)<0?(h[X>>2]=v,h[q>>2]=x,h[j>>2]=0,E=v,b=0):x=g,g=E-x|0,v=b-x|0,(x|0)<0?(h[X>>2]=g,h[j>>2]=v,h[q>>2]=0,b=v,x=0):g=E,v=(b|0)<(g|0)?b:g,v=(x|0)<(v|0)?x:v,(v|0)>0&&(x=x-v|0,b=b-v|0,g=g-v|0,h[X>>2]=g,h[j>>2]=b,h[q>>2]=x)),U>>>0<K>>>0;)U=U+1|0;return _|0}function S1(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0;if(K=Q,Q=Q+16|0,q=K,j=tt(p|0,m|0,45)|0,ee()|0,j=j&127,j>>>0>121)return h[g>>2]=0,h[g+4>>2]=0,h[g+8>>2]=0,h[g+12>>2]=0,X=5,Q=K,X|0;e:do if((yr(j)|0)!=0&&(E=tt(p|0,m|0,52)|0,ee()|0,E=E&15,(E|0)!=0)){_=1;t:for(;;){switch(X=tt(p|0,m|0,(15-_|0)*3|0)|0,ee()|0,X&7){case 5:break t;case 0:break;default:{N=m;break e}}if(_>>>0<E>>>0)_=_+1|0;else{N=m;break e}}for(b=1,_=m;;){switch(m=(15-b|0)*3|0,v=ft(7,0,m|0)|0,v=p&~v,x=_&~(ee()|0),_=tt(p|0,_|0,m|0)|0,ee()|0,_&7){case 1:{_=3;break}case 3:{_=2;break}case 2:{_=6;break}case 6:{_=4;break}case 4:{_=5;break}case 5:{_=1;break}default:_=_&7}if(p=ft(_|0,0,m|0)|0,p=p|v,_=ee()|0|x,b>>>0<E>>>0)b=b+1|0;else{N=_;break e}}}else N=m;while(!1);if(X=7696+(j*28|0)|0,h[g>>2]=h[X>>2],h[g+4>>2]=h[X+4>>2],h[g+8>>2]=h[X+8>>2],h[g+12>>2]=h[X+12>>2],!(dL(p,N,g)|0))return X=0,Q=K,X|0;if(X=g+4|0,h[q>>2]=h[X>>2],h[q+4>>2]=h[X+4>>2],h[q+8>>2]=h[X+8>>2],M=tt(p|0,N|0,52)|0,ee()|0,U=M&15,M&1?(x=h[X>>2]|0,E=g+8|0,v=h[E>>2]|0,M=g+12|0,m=h[M>>2]|0,_=(v*3|0)+x|0,x=m+(x*3|0)|0,h[X>>2]=x,h[E>>2]=_,v=(m*3|0)+v|0,h[M>>2]=v,m=_-x|0,b=v-x|0,(x|0)<0&&(h[E>>2]=m,h[M>>2]=b,h[X>>2]=0,_=m,x=0,v=b),b=x-_|0,m=v-_|0,(_|0)<0?(h[X>>2]=b,h[M>>2]=m,h[E>>2]=0,_=0):(m=v,b=x),x=b-m|0,v=_-m|0,(m|0)<0?(h[X>>2]=x,h[E>>2]=v,h[M>>2]=0,m=0):(v=_,x=b),_=(v|0)<(x|0)?v:x,_=(m|0)<(_|0)?m:_,(_|0)>0&&(h[X>>2]=x-_,h[E>>2]=v-_,h[M>>2]=m-_),v=U+1|0):v=U,!(yr(j)|0))_=0;else{e:do if(!U)_=0;else for(m=1;;){if(_=tt(p|0,N|0,(15-m|0)*3|0)|0,ee()|0,_=_&7,_|0)break e;if(m>>>0<U>>>0)m=m+1|0;else{_=0;break}}while(!1);_=(_|0)==4&1}if(!(w1(g,v,_,0)|0))(v|0)!=(U|0)&&(h[X>>2]=h[q>>2],h[X+4>>2]=h[q+4>>2],h[X+8>>2]=h[q+8>>2]);else{if(yr(j)|0)do;while((w1(g,v,0,0)|0)!=0);(v|0)!=(U|0)&&(E=g+12|0,p=h[E>>2]|0,_=(h[X>>2]|0)-p|0,b=g+8|0,p=(h[b>>2]|0)-p|0,m=rh(+((_<<1)+p|0)*.14285714285714285)|0,h[X>>2]=m,_=rh(+((p*3|0)-_|0)*.14285714285714285)|0,h[b>>2]=_,h[E>>2]=0,p=_-m|0,v=0-m|0,(m|0)<0?(h[b>>2]=p,h[E>>2]=v,h[X>>2]=0,_=p,m=0):v=0,x=m-_|0,p=v-_|0,(_|0)<0?(h[X>>2]=x,h[E>>2]=p,h[b>>2]=0,m=x,_=0):p=v,x=m-p|0,v=_-p|0,(p|0)<0?(h[X>>2]=x,h[b>>2]=v,h[E>>2]=0,m=x,p=0):v=_,_=(v|0)<(m|0)?v:m,_=(p|0)<(_|0)?p:_,(_|0)>0&&(h[X>>2]=m-_,h[b>>2]=v-_,h[E>>2]=p-_))}return X=0,Q=K,X|0}function T1(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0;return b=Q,Q=Q+48|0,_=b+24|0,v=b,x=S1(p,m,_)|0,x?(Q=b,x|0):(x=tt(p|0,m|0,52)|0,ee()|0,Jce(_,x&15,v),M=+qx(+ +ie[v+16>>3]),E=+Sa(+ +ie[v+8>>3],+ +ie[v>>3]),ie[g>>3]=M,ie[g+8>>3]=E,x=0,Q=b,x|0)}function Vm(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0;if(b=Q,Q=Q+16|0,x=b,_=S1(p,m,x)|0,_|0)return x=_,Q=b,x|0;_=tt(p|0,m|0,45)|0,ee()|0,_=(yr(_&127)|0)==0,v=tt(p|0,m|0,52)|0,ee()|0,v=v&15;e:do if(!_){if(v|0)for(_=1;;){if(E=ft(7,0,(15-_|0)*3|0)|0,!((E&p|0)==0&((ee()|0)&m|0)==0))break e;if(_>>>0<v>>>0)_=_+1|0;else break}return sL(x,v,0,5,g),E=0,Q=b,E|0}while(!1);return oL(x,v,0,6,g),E=0,Q=b,E|0}function hue(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0;if(v=tt(p|0,m|0,45)|0,ee()|0,!(yr(v&127)|0))return v=2,h[g>>2]=v,0;if(v=tt(p|0,m|0,52)|0,ee()|0,v=v&15,!v)return v=5,h[g>>2]=v,0;for(_=1;;){if(x=ft(7,0,(15-_|0)*3|0)|0,!((x&p|0)==0&((ee()|0)&m|0)==0)){_=2,p=6;break}if(_>>>0<v>>>0)_=_+1|0;else{_=5,p=6;break}}return(p|0)==6&&(h[g>>2]=_),0}function rq(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0;q=Q,Q=Q+128|0,N=q+112|0,x=q+96|0,U=q,v=tt(p|0,m|0,52)|0,ee()|0,E=v&15,h[N>>2]=E,b=tt(p|0,m|0,45)|0,ee()|0,b=b&127;e:do if(yr(b)|0){if(E|0)for(_=1;;){if(M=ft(7,0,(15-_|0)*3|0)|0,!((M&p|0)==0&((ee()|0)&m|0)==0)){v=0;break e}if(_>>>0<E>>>0)_=_+1|0;else break}if(v&1)v=1;else return M=ft(E+1|0,0,52)|0,U=ee()|0|m&-15728641,N=ft(7,0,(14-E|0)*3|0)|0,U=rq((M|p)&~N,U&~(ee()|0),g)|0,Q=q,U|0}else v=0;while(!1);if(_=S1(p,m,x)|0,!_){v?(JG(x,N,U),M=5):(eq(x,N,U),M=6);e:do if(yr(b)|0)if(!E)p=5;else for(_=1;;){if(b=ft(7,0,(15-_|0)*3|0)|0,!((b&p|0)==0&((ee()|0)&m|0)==0)){p=2;break e}if(_>>>0<E>>>0)_=_+1|0;else{p=5;break}}else p=2;while(!1);up(g|0,-1,p<<2|0)|0;e:do if(v)for(x=0;;){if(b=U+(x<<4)|0,eue(b,h[N>>2]|0)|0,b=h[b>>2]|0,E=h[g>>2]|0,(E|0)==-1|(E|0)==(b|0))_=g;else{v=0;do{if(v=v+1|0,v>>>0>=p>>>0){_=1;break e}_=g+(v<<2)|0,E=h[_>>2]|0}while(!((E|0)==-1|(E|0)==(b|0)))}if(h[_>>2]=b,x=x+1|0,x>>>0>=M>>>0){_=0;break}}else for(x=0;;){if(b=U+(x<<4)|0,w1(b,h[N>>2]|0,0,1)|0,b=h[b>>2]|0,E=h[g>>2]|0,(E|0)==-1|(E|0)==(b|0))_=g;else{v=0;do{if(v=v+1|0,v>>>0>=p>>>0){_=1;break e}_=g+(v<<2)|0,E=h[_>>2]|0}while(!((E|0)==-1|(E|0)==(b|0)))}if(h[_>>2]=b,x=x+1|0,x>>>0>=M>>>0){_=0;break}}while(!1)}return U=_,Q=q,U|0}function fue(){return 12}function pL(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0;if(p>>>0>15)return E=4,E|0;if(ft(p|0,0,52)|0,E=ee()|0|134225919,!p){g=0,_=0;do yr(_)|0&&(ft(_|0,0,45)|0,b=E|(ee()|0),p=m+(g<<3)|0,h[p>>2]=-1,h[p+4>>2]=b,g=g+1|0),_=_+1|0;while((_|0)!=122);return g=0,g|0}g=0,b=0;do{if(yr(b)|0){for(ft(b|0,0,45)|0,_=1,v=-1,x=E|(ee()|0);M=ft(7,0,(15-_|0)*3|0)|0,v=v&~M,x=x&~(ee()|0),(_|0)!=(p|0);)_=_+1|0;M=m+(g<<3)|0,h[M>>2]=v,h[M+4>>2]=x,g=g+1|0}b=b+1|0}while((b|0)!=122);return g=0,g|0}function due(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0;if(se=Q,Q=Q+16|0,ue=se,xe=tt(p|0,m|0,52)|0,ee()|0,xe=xe&15,g>>>0>15)return xe=4,Q=se,xe|0;if((xe|0)<(g|0))return xe=12,Q=se,xe|0;if((xe|0)!=(g|0))if(x=ft(g|0,0,52)|0,x=x|p,E=ee()|0|m&-15728641,(xe|0)>(g|0)){M=g;do ae=ft(7,0,(14-M|0)*3|0)|0,M=M+1|0,x=ae|x,E=ee()|0|E;while((M|0)<(xe|0));ae=x}else ae=x;else ae=p,E=m;K=tt(ae|0,E|0,45)|0,ee()|0;e:do if(yr(K&127)|0){if(M=tt(ae|0,E|0,52)|0,ee()|0,M=M&15,M|0)for(x=1;;){if(K=ft(7,0,(15-x|0)*3|0)|0,!((K&ae|0)==0&((ee()|0)&E|0)==0)){N=33;break e}if(x>>>0<M>>>0)x=x+1|0;else break}if(K=_,h[K>>2]=0,h[K+4>>2]=0,(xe|0)>(g|0)){for(K=m&-15728641,X=xe;;){if(j=X,X=X+-1|0,X>>>0>15|(xe|0)<(X|0)){N=19;break}if((xe|0)!=(X|0))if(x=ft(X|0,0,52)|0,x=x|p,M=ee()|0|K,(xe|0)<(j|0))q=x;else{N=X;do q=ft(7,0,(14-N|0)*3|0)|0,N=N+1|0,x=q|x,M=ee()|0|M;while((N|0)<(xe|0));q=x}else q=p,M=m;if(U=tt(q|0,M|0,45)|0,ee()|0,!(yr(U&127)|0))x=0;else{U=tt(q|0,M|0,52)|0,ee()|0,U=U&15;t:do if(!U)x=0;else for(N=1;;){if(x=tt(q|0,M|0,(15-N|0)*3|0)|0,ee()|0,x=x&7,x|0)break t;if(N>>>0<U>>>0)N=N+1|0;else{x=0;break}}while(!1);x=(x|0)==0&1}if(M=tt(p|0,m|0,(15-j|0)*3|0)|0,ee()|0,M=M&7,(M|0)==7){v=5,N=42;break}if(x=(x|0)!=0,(M|0)==1&x){v=5,N=42;break}if(q=M+(((M|0)!=0&x)<<31>>31)|0,q|0&&(N=xe-j|0,N=ap(7,0,N,((N|0)<0)<<31>>31)|0,U=ee()|0,x?(x=wr(N|0,U|0,5,0)|0,x=At(x|0,ee()|0,-5,-1)|0,x=lp(x|0,ee()|0,6,0)|0,x=At(x|0,ee()|0,1,0)|0,M=ee()|0):(x=N,M=U),j=q+-1|0,j=wr(N|0,U|0,j|0,((j|0)<0)<<31>>31|0)|0,j=At(x|0,M|0,j|0,ee()|0)|0,q=ee()|0,U=_,U=At(j|0,q|0,h[U>>2]|0,h[U+4>>2]|0)|0,q=ee()|0,j=_,h[j>>2]=U,h[j+4>>2]=q),(X|0)<=(g|0)){N=37;break}}if((N|0)==19)di(27634,27225,1407,27259);else if((N|0)==37){b=_,v=h[b+4>>2]|0,b=h[b>>2]|0;break}else if((N|0)==42)return Q=se,v|0}else v=0,b=0}else N=33;while(!1);e:do if((N|0)==33)if(K=_,h[K>>2]=0,h[K+4>>2]=0,(xe|0)>(g|0)){for(x=xe;;){if(v=tt(p|0,m|0,(15-x|0)*3|0)|0,ee()|0,v=v&7,(v|0)==7){v=5;break}if(b=xe-x|0,b=ap(7,0,b,((b|0)<0)<<31>>31)|0,v=wr(b|0,ee()|0,v|0,0)|0,b=ee()|0,K=_,b=At(h[K>>2]|0,h[K+4>>2]|0,v|0,b|0)|0,v=ee()|0,K=_,h[K>>2]=b,h[K+4>>2]=v,x=x+-1|0,(x|0)<=(g|0))break e}return Q=se,v|0}else v=0,b=0;while(!1);return jx(ae,E,xe,ue)|0&&di(27634,27225,1367,27274),xe=ue,ue=h[xe+4>>2]|0,((v|0)>-1|(v|0)==-1&b>>>0>4294967295)&((ue|0)>(v|0)|((ue|0)==(v|0)?(h[xe>>2]|0)>>>0>b>>>0:0))?(xe=0,Q=se,xe|0):(di(27634,27225,1447,27259),0)}function pue(p,m,g,_,v,x){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0,x=x|0;var b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0;if(q=Q,Q=Q+16|0,b=q,v>>>0>15)return x=4,Q=q,x|0;if(E=tt(g|0,_|0,52)|0,ee()|0,E=E&15,(E|0)>(v|0))return x=12,Q=q,x|0;if(jx(g,_,v,b)|0&&di(27634,27225,1367,27274),U=b,N=h[U+4>>2]|0,!(((m|0)>-1|(m|0)==-1&p>>>0>4294967295)&((N|0)>(m|0)|((N|0)==(m|0)?(h[U>>2]|0)>>>0>p>>>0:0))))return x=2,Q=q,x|0;U=v-E|0,v=ft(v|0,0,52)|0,M=ee()|0|_&-15728641,N=x,h[N>>2]=v|g,h[N+4>>2]=M,N=tt(g|0,_|0,45)|0,ee()|0;e:do if(yr(N&127)|0){if(E|0)for(b=1;;){if(N=ft(7,0,(15-b|0)*3|0)|0,!((N&g|0)==0&((ee()|0)&_|0)==0))break e;if(b>>>0<E>>>0)b=b+1|0;else break}if((U|0)<1)return x=0,Q=q,x|0;for(N=E^15,_=-1,M=1,b=1;;){E=U-M|0,E=ap(7,0,E,((E|0)<0)<<31>>31)|0,g=ee()|0;do if(b)if(b=wr(E|0,g|0,5,0)|0,b=At(b|0,ee()|0,-5,-1)|0,b=lp(b|0,ee()|0,6,0)|0,v=ee()|0,(m|0)>(v|0)|(m|0)==(v|0)&p>>>0>b>>>0){m=At(p|0,m|0,-1,-1)|0,m=eo(m|0,ee()|0,b|0,v|0)|0,b=ee()|0,j=x,K=h[j>>2]|0,j=h[j+4>>2]|0,ae=(N+_|0)*3|0,X=ft(7,0,ae|0)|0,j=j&~(ee()|0),_=lp(m|0,b|0,E|0,g|0)|0,p=ee()|0,v=At(_|0,p|0,2,0)|0,ae=ft(v|0,ee()|0,ae|0)|0,j=ee()|0|j,v=x,h[v>>2]=ae|K&~X,h[v+4>>2]=j,p=wr(_|0,p|0,E|0,g|0)|0,p=eo(m|0,b|0,p|0,ee()|0)|0,b=0,m=ee()|0;break}else{ae=x,X=h[ae>>2]|0,ae=h[ae+4>>2]|0,K=ft(7,0,(N+_|0)*3|0)|0,ae=ae&~(ee()|0),b=x,h[b>>2]=X&~K,h[b+4>>2]=ae,b=1;break}else X=x,v=h[X>>2]|0,X=h[X+4>>2]|0,_=(N+_|0)*3|0,j=ft(7,0,_|0)|0,X=X&~(ee()|0),ae=lp(p|0,m|0,E|0,g|0)|0,b=ee()|0,_=ft(ae|0,b|0,_|0)|0,X=ee()|0|X,K=x,h[K>>2]=_|v&~j,h[K+4>>2]=X,b=wr(ae|0,b|0,E|0,g|0)|0,p=eo(p|0,m|0,b|0,ee()|0)|0,b=0,m=ee()|0;while(!1);if((U|0)>(M|0))_=~M,M=M+1|0;else{m=0;break}}return Q=q,m|0}while(!1);if((U|0)<1)return ae=0,Q=q,ae|0;for(v=E^15,b=1;;)if(K=U-b|0,K=ap(7,0,K,((K|0)<0)<<31>>31)|0,ae=ee()|0,M=x,g=h[M>>2]|0,M=h[M+4>>2]|0,E=(v-b|0)*3|0,_=ft(7,0,E|0)|0,M=M&~(ee()|0),j=lp(p|0,m|0,K|0,ae|0)|0,X=ee()|0,E=ft(j|0,X|0,E|0)|0,M=ee()|0|M,N=x,h[N>>2]=E|g&~_,h[N+4>>2]=M,ae=wr(j|0,X|0,K|0,ae|0)|0,p=eo(p|0,m|0,ae|0,ee()|0)|0,m=ee()|0,(U|0)<=(b|0)){m=0;break}else b=b+1|0;return Q=q,m|0}function mL(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0;v=tt(m|0,g|0,52)|0,ee()|0,v=v&15,(m|0)==0&(g|0)==0|((_|0)>15|(v|0)>(_|0))?(x=-1,m=-1,g=0,v=0):(m=nq(m,g,v+1|0,_)|0,b=(ee()|0)&-15728641,g=ft(_|0,0,52)|0,g=m|g,b=b|(ee()|0),m=(Zi(g,b)|0)==0,x=v,m=m?-1:_,v=b),b=p,h[b>>2]=g,h[b+4>>2]=v,h[p+8>>2]=x,h[p+12>>2]=m}function sq(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0;if(v=tt(p|0,m|0,52)|0,ee()|0,v=v&15,x=_+8|0,h[x>>2]=v,(p|0)==0&(m|0)==0|((g|0)>15|(v|0)>(g|0))){g=_,h[g>>2]=0,h[g+4>>2]=0,h[x>>2]=-1,h[_+12>>2]=-1;return}if(p=nq(p,m,v+1|0,g)|0,x=(ee()|0)&-15728641,v=ft(g|0,0,52)|0,v=p|v,x=x|(ee()|0),p=_,h[p>>2]=v,h[p+4>>2]=x,p=_+12|0,Zi(v,x)|0){h[p>>2]=g;return}else{h[p>>2]=-1;return}}function AL(p){p=p|0;var m=0,g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0;if(g=p,m=h[g>>2]|0,g=h[g+4>>2]|0,!((m|0)==0&(g|0)==0)&&(_=tt(m|0,g|0,52)|0,ee()|0,_=_&15,E=ft(1,0,(_^15)*3|0)|0,m=At(E|0,ee()|0,m|0,g|0)|0,g=ee()|0,E=p,h[E>>2]=m,h[E+4>>2]=g,E=p+8|0,b=h[E>>2]|0,!((_|0)<(b|0)))){for(M=p+12|0,x=_;;){if((x|0)==(b|0)){_=5;break}if(N=(x|0)==(h[M>>2]|0),v=(15-x|0)*3|0,_=tt(m|0,g|0,v|0)|0,ee()|0,_=_&7,N&((_|0)==1&!0)){_=7;break}if(!((_|0)==7&!0)){_=10;break}if(N=ft(1,0,v|0)|0,m=At(m|0,g|0,N|0,ee()|0)|0,g=ee()|0,N=p,h[N>>2]=m,h[N+4>>2]=g,(x|0)>(b|0))x=x+-1|0;else{_=10;break}}if((_|0)==5){N=p,h[N>>2]=0,h[N+4>>2]=0,h[E>>2]=-1,h[M>>2]=-1;return}else if((_|0)==7){b=ft(1,0,v|0)|0,b=At(m|0,g|0,b|0,ee()|0)|0,E=ee()|0,N=p,h[N>>2]=b,h[N+4>>2]=E,h[M>>2]=x+-1;return}else if((_|0)==10)return}}function Xx(p){p=+p;var m=0;return m=p<0?p+6.283185307179586:p,+(p>=6.283185307179586?m+-6.283185307179586:m)}function kl(p,m){switch(p=+p,m=m|0,m|0){case 1:{p=p<0?p+6.283185307179586:p;break}case 2:{p=p>0?p+-6.283185307179586:p;break}default:}return+p}function mue(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0;return v=+ie[m>>3],_=+ie[p>>3],x=+zi(+((v-_)*.5)),g=+zi(+((+ie[m+8>>3]-+ie[p+8>>3])*.5)),g=x*x+g*(+ii(+v)*+ii(+_)*g),+(+Sa(+ +bs(+g),+ +bs(+(1-g)))*2)}function $x(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0;return v=+ie[m>>3],_=+ie[p>>3],x=+zi(+((v-_)*.5)),g=+zi(+((+ie[m+8>>3]-+ie[p+8>>3])*.5)),g=x*x+g*(+ii(+v)*+ii(+_)*g),+(+Sa(+ +bs(+g),+ +bs(+(1-g)))*2*6371.007180918475)}function Aue(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0;return v=+ie[m>>3],_=+ie[p>>3],x=+zi(+((v-_)*.5)),g=+zi(+((+ie[m+8>>3]-+ie[p+8>>3])*.5)),g=x*x+g*(+ii(+v)*+ii(+_)*g),+(+Sa(+ +bs(+g),+ +bs(+(1-g)))*2*6371.007180918475*1e3)}function oq(p,m){return p=p|0,m=m|0,p>>>0>15?(m=4,m|0):(ie[m>>3]=+ie[20624+(p<<3)>>3],m=0,m|0)}function gue(p,m){return p=p|0,m=m|0,p>>>0>15?(m=4,m|0):(ie[m>>3]=+ie[20752+(p<<3)>>3],m=0,m|0)}function vue(p,m){return p=p|0,m=m|0,p>>>0>15?(m=4,m|0):(ie[m>>3]=+ie[20880+(p<<3)>>3],m=0,m|0)}function _ue(p,m){return p=p|0,m=m|0,p>>>0>15?(m=4,m|0):(ie[m>>3]=+ie[21008+(p<<3)>>3],m=0,m|0)}function oT(p,m){p=p|0,m=m|0;var g=0;return p>>>0>15?(m=4,m|0):(g=ap(7,0,p,((p|0)<0)<<31>>31)|0,g=wr(g|0,ee()|0,120,0)|0,p=ee()|0,h[m>>2]=g|2,h[m+4>>2]=p,m=0,m|0)}function xue(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0;if(E=Q,Q=Q+176|0,b=E,p=Hx(p,m,b)|0,p|0)return b=p,Q=E,b|0;if(ie[g>>3]=0,p=h[b>>2]|0,(p|0)<=1)return b=0,Q=E,b|0;m=p+-1|0,p=0,_=+ie[b+8>>3],v=+ie[b+16>>3],x=0;do p=p+1|0,N=_,_=+ie[b+8+(p<<4)>>3],U=+zi(+((_-N)*.5)),M=v,v=+ie[b+8+(p<<4)+8>>3],M=+zi(+((v-M)*.5)),M=U*U+M*(+ii(+_)*+ii(+N)*M),x=x+ +Sa(+ +bs(+M),+ +bs(+(1-M)))*2;while((p|0)<(m|0));return ie[g>>3]=x,b=0,Q=E,b|0}function yue(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0;if(E=Q,Q=Q+176|0,b=E,p=Hx(p,m,b)|0,p|0)return b=p,x=+ie[g>>3],x=x*6371.007180918475,ie[g>>3]=x,Q=E,b|0;if(ie[g>>3]=0,p=h[b>>2]|0,(p|0)<=1)return b=0,x=0,x=x*6371.007180918475,ie[g>>3]=x,Q=E,b|0;m=p+-1|0,p=0,_=+ie[b+8>>3],v=+ie[b+16>>3],x=0;do p=p+1|0,N=_,_=+ie[b+8+(p<<4)>>3],U=+zi(+((_-N)*.5)),M=v,v=+ie[b+8+(p<<4)+8>>3],M=+zi(+((v-M)*.5)),M=U*U+M*(+ii(+N)*+ii(+_)*M),x=x+ +Sa(+ +bs(+M),+ +bs(+(1-M)))*2;while((p|0)!=(m|0));return ie[g>>3]=x,b=0,U=x,U=U*6371.007180918475,ie[g>>3]=U,Q=E,b|0}function bue(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0;if(E=Q,Q=Q+176|0,b=E,p=Hx(p,m,b)|0,p|0)return b=p,x=+ie[g>>3],x=x*6371.007180918475,x=x*1e3,ie[g>>3]=x,Q=E,b|0;if(ie[g>>3]=0,p=h[b>>2]|0,(p|0)<=1)return b=0,x=0,x=x*6371.007180918475,x=x*1e3,ie[g>>3]=x,Q=E,b|0;m=p+-1|0,p=0,_=+ie[b+8>>3],v=+ie[b+16>>3],x=0;do p=p+1|0,N=_,_=+ie[b+8+(p<<4)>>3],U=+zi(+((_-N)*.5)),M=v,v=+ie[b+8+(p<<4)+8>>3],M=+zi(+((v-M)*.5)),M=U*U+M*(+ii(+N)*+ii(+_)*M),x=x+ +Sa(+ +bs(+M),+ +bs(+(1-M)))*2;while((p|0)!=(m|0));return ie[g>>3]=x,b=0,U=x,U=U*6371.007180918475,U=U*1e3,ie[g>>3]=U,Q=E,b|0}function wue(p){p=p|0;var m=0,g=0,_=0,v=0,x=0,b=0,E=0;if(p)for(x=p+4|0,b=p+8|0,_=1,v=p;;){if(m=h[v>>2]|0,m|0)do{if(g=h[m>>2]|0,g|0)do E=g,g=h[g+16>>2]|0,_t(E);while((g|0)!=0);E=m,m=h[m+8>>2]|0,_t(E)}while((m|0)!=0);if(m=v,v=h[v+8>>2]|0,_?(h[p>>2]=0,h[x>>2]=0,h[b>>2]=0):_t(m),v)_=0;else break}}function Sue(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0;if(h[m>>2]=0,ue=m+4|0,h[ue>>2]=0,xe=m+8|0,h[xe>>2]=0,ae=h[p>>2]|0,(ae|0)<=0)return m=0,m|0;K=p+4|0,p=m,X=0;e:for(;;){if(X){if(g=Ta(1,12)|0,!g){g=5;break}h[p+8>>2]=g,p=g}if(M=h[K>>2]|0,N=Ta(1,12)|0,!N){p=13,g=37;break}if(j=p+4|0,_=h[j>>2]|0,h[((_|0)==0?p:_+8|0)>>2]=N,h[j>>2]=N,_=h[M+(X<<4)>>2]|0,(_|0)<3){p=1,g=37;break}v=M+(X<<4)+4|0,x=N+4|0,g=0,b=0;do{if(E=b,b=br(24)|0,!b){p=13,g=37;break e}SL(b|0,(h[v>>2]|0)+(g<<4)|0,16)|0,h[b+16>>2]=0,E?h[E+16>>2]=b:h[N>>2]=b,h[x>>2]=b,g=g+1|0}while((g|0)<(_|0));if(q=h[M+(X<<4)+8>>2]|0,(q|0)>0){U=M+(X<<4)+12|0,M=0;do{if(_=h[U>>2]|0,g=N,N=Ta(1,12)|0,!N){p=13,g=37;break e}if(h[g+8>>2]=N,h[j>>2]=N,E=h[_+(M<<3)>>2]|0,(E|0)<3){p=1,g=37;break e}_=_+(M<<3)+4|0,v=N+4|0,g=0,x=0;do{if(b=x,x=br(24)|0,!x){p=13,g=37;break e}SL(x|0,(h[_>>2]|0)+(g<<4)|0,16)|0,h[x+16>>2]=0,b?h[b+16>>2]=x:h[N>>2]=x,h[v>>2]=x,g=g+1|0}while((g|0)<(E|0));M=M+1|0}while((M|0)<(q|0))}if(X=X+1|0,(X|0)>=(ae|0)){p=0,g=50;break}}if((g|0)==5){if(!m)return m=13,m|0;for(_=1,v=m;;){if(p=h[v>>2]|0,p|0)do{if(g=h[p>>2]|0,g|0)do ae=g,g=h[g+16>>2]|0,_t(ae);while((g|0)!=0);ae=p,p=h[p+8>>2]|0,_t(ae)}while((p|0)!=0);if(p=v,v=h[v+8>>2]|0,_?(h[m>>2]=0,h[ue>>2]=0,h[xe>>2]=0):_t(p),v)_=0;else{p=13;break}}return p|0}else if((g|0)==37){if(!m)return m=p,m|0;for(v=1,x=m;;){if(g=h[x>>2]|0,g|0)do{if(_=h[g>>2]|0,_|0)do ae=_,_=h[_+16>>2]|0,_t(ae);while((_|0)!=0);ae=g,g=h[g+8>>2]|0,_t(ae)}while((g|0)!=0);if(g=x,x=h[x+8>>2]|0,v?(h[m>>2]=0,h[ue>>2]=0,h[xe>>2]=0):_t(g),x)v=0;else break}return p|0}else if((g|0)==50)return p|0;return 0}function Yx(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0;if(xe=Q,Q=Q+16|0,ue=xe,U=tt(p|0,m|0,52)|0,ee()|0,U=U&15,X=tt(g|0,_|0,52)|0,ee()|0,(U|0)!=(X&15|0))return ue=12,Q=xe,ue|0;if(M=tt(p|0,m|0,45)|0,ee()|0,M=M&127,N=tt(g|0,_|0,45)|0,ee()|0,N=N&127,M>>>0>121|N>>>0>121)return ue=5,Q=xe,ue|0;if(X=(M|0)!=(N|0),X){if(b=nL(M,N)|0,(b|0)==7)return ue=1,Q=xe,ue|0;E=nL(N,M)|0,(E|0)==7?di(27291,27315,164,27325):(ae=b,x=E)}else ae=0,x=0;q=yr(M)|0,j=yr(N)|0,h[ue>>2]=0,h[ue+4>>2]=0,h[ue+8>>2]=0,h[ue+12>>2]=0;do if(ae){N=h[4272+(M*28|0)+(ae<<2)>>2]|0,b=(N|0)>0;e:do if(j)if(b)for(M=0,E=g,b=_;;){switch(E=cue(E,b)|0,b=ee()|0,x|0){case 5:case 1:{x=3;break}case 3:{x=2;break}case 2:{x=6;break}case 6:{x=4;break}case 4:{x=5;break}default:}if(M=M+1|0,(M|0)==(N|0)){N=x,M=E,E=b;break e}}else N=x,M=g,E=_;else if(b)for(M=0,E=g,b=_;;){switch(E=hL(E,b)|0,b=ee()|0,x|0){case 1:{x=3;break}case 3:{x=2;break}case 2:{x=6;break}case 6:{x=4;break}case 4:{x=5;break}case 5:{x=1;break}default:}if(M=M+1|0,(M|0)==(N|0)){N=x,M=E,E=b;break e}}else N=x,M=g,E=_;while(!1);if(dL(M,E,ue)|0,X||di(27340,27315,194,27325),b=(q|0)!=0,x=(j|0)!=0,b&x&&di(27367,27315,195,27325),b){if(x=al(p,m)|0,(x|0)==7){x=5;break}if(He[21968+(x*7|0)+ae>>0]|0){x=1;break}j=h[21136+(x*28|0)+(ae<<2)>>2]|0,X=j}else if(x){if(x=al(M,E)|0,(x|0)==7){x=5;break}if(He[21968+(x*7|0)+N>>0]|0){x=1;break}X=0,j=h[21136+(N*28|0)+(x<<2)>>2]|0}else X=0,j=0;if((X|j|0)>=0){if((j|0)>0){g=ue+4|0,_=ue+8|0,q=ue+12|0,N=0,E=h[g>>2]|0,b=h[_>>2]|0,x=h[q>>2]|0;do K=b+E|0,m=(K|0)<0,se=m?K:0,b=x+b-se|0,p=(b|0)<0,M=p?b:0,E=x+E-se-M|0,se=(E|0)<0,x=se?0:E,E=se?E:0,b=(p?0:b)-E|0,E=(m?0:K)-M-E|0,M=(b|0)<(E|0)?b:E,M=(x|0)<(M|0)?x:M,(M|0)>0&&(E=E-M|0,b=b-M|0,x=x-M|0),N=N+1|0;while((N|0)!=(j|0));h[g>>2]=E,h[_>>2]=b,h[q>>2]=x}if((ae+-1|0)>>>0<6?(x=h[22032+(ae*12|0)>>2]|0,E=h[22032+(ae*12|0)+4>>2]|0,se=h[22032+(ae*12|0)+8>>2]|0,b=(E|0)<(x|0)?E:x,b=(se|0)<(b|0)?se:b,b=(b|0)>0?b:0,x=x-b|0,E=E-b|0,b=se-b|0):(x=0,E=0,b=0),U)for(;;)if(M=x*3|0,N=E*3|0,g=b*3|0,_c(U)|0?(m=M+E|0,p=(m|0)<0,se=N+b-(p?m:0)|0,K=(se|0)<0,E=x+g-(p?m:0)-(K?se:0)|0,b=(E|0)<0,ae=b?0:E,M=(K?0:se)-(b?E:0)|0,E=(p?0:m)-(K?se:0)-(b?E:0)|0,b=(M|0)<(E|0)?M:E,b=(ae|0)<(b|0)?ae:b,se=(b|0)>0,x=se?b:0,M=M-(se?b:0)|0,b=ae-(se?b:0)|0):(K=M+b|0,m=(K|0)<0,se=N+x-(m?K:0)|0,x=(se|0)<0,E=g+E-(m?K:0)-(x?se:0)|0,b=(E|0)<0,ae=b?0:E,M=(x?0:se)-(b?E:0)|0,E=(m?0:K)-(x?se:0)-(b?E:0)|0,b=(M|0)<(E|0)?M:E,b=(ae|0)<(b|0)?ae:b,se=(b|0)>0,x=se?b:0,M=M-(se?b:0)|0,b=ae-(se?b:0)|0),x=E-x|0,(U|0)>1)U=U+-1|0,E=M;else{E=M;break}if((X|0)>0){M=0;do m=x+E|0,p=(m|0)<0,se=E+b-(p?m:0)|0,K=(se|0)<0,ae=x+b-(p?m:0)-(K?se:0)|0,x=(ae|0)<0,b=x?0:ae,E=(K?0:se)-(x?ae:0)|0,ae=(p?0:m)-(K?se:0)-(x?ae:0)|0,x=(E|0)<(ae|0)?E:ae,x=(b|0)<(x|0)?b:x,se=(x|0)>0,b=b-(se?x:0)|0,E=E-(se?x:0)|0,x=ae-(se?x:0)|0,M=M+1|0;while((M|0)!=(X|0))}g=ue+4|0,U=ue+8|0,ae=h[U>>2]|0,_=ue+12|0,se=h[_>>2]|0,M=(h[g>>2]|0)+x|0,h[g>>2]=M,E=ae+E|0,h[U>>2]=E,x=se+b|0,h[_>>2]=x,b=E-M|0,(M|0)<0?(x=x-M|0,h[U>>2]=b,h[_>>2]=x,h[g>>2]=0,E=0):(b=E,E=M),(b|0)<0&&(E=E-b|0,h[g>>2]=E,x=x-b|0,h[_>>2]=x,h[U>>2]=0,b=0),N=E-x|0,M=b-x|0,(x|0)<0?(h[g>>2]=N,h[U>>2]=M,h[_>>2]=0,E=N,x=0):M=b,b=(M|0)<(E|0)?M:E,b=(x|0)<(b|0)?x:b,(b|0)>0&&(h[g>>2]=E-b,h[U>>2]=M-b,h[_>>2]=x-b),K=77}else x=5}else if(dL(g,_,ue)|0,(q|0)!=0&(j|0)!=0)if((N|0)!=(M|0)&&di(27398,27315,264,27325),b=al(p,m)|0,x=al(g,_)|0,(b|0)==7|(x|0)==7)x=5;else if(He[21968+(b*7|0)+x>>0]|0)x=1;else if(g=h[21136+(b*28|0)+(x<<2)>>2]|0,(g|0)>0){U=ue+4|0,_=ue+8|0,q=ue+12|0,N=0,E=h[U>>2]|0,b=h[_>>2]|0,x=h[q>>2]|0;do ae=b+E|0,K=(ae|0)<0,p=K?ae:0,b=x+b-p|0,m=(b|0)<0,M=m?b:0,E=x+E-p-M|0,p=(E|0)<0,x=p?0:E,E=p?E:0,b=(m?0:b)-E|0,E=(K?0:ae)-M-E|0,M=(b|0)<(E|0)?b:E,M=(x|0)<(M|0)?x:M,(M|0)>0&&(E=E-M|0,b=b-M|0,x=x-M|0),N=N+1|0;while((N|0)!=(g|0));h[U>>2]=E,h[_>>2]=b,h[q>>2]=x,K=77}else K=77;else K=77;while(!1);return(K|0)==77&&(x=ue+4|0,h[v>>2]=h[x>>2],h[v+4>>2]=h[x+4>>2],h[v+8>>2]=h[x+8>>2],x=0),se=x,Q=xe,se|0}function aq(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0,be=0;if(x=tt(p|0,m|0,52)|0,ee()|0,x=x&15,Ae=tt(p|0,m|0,45)|0,ee()|0,Ae=Ae&127,Ae>>>0>121)return _=5,_|0;if(ue=yr(Ae)|0,ft(x|0,0,52)|0,E=ee()|0|134225919,b=_,h[b>>2]=-1,h[b+4>>2]=E,b=h[g>>2]|0,E=h[g+4>>2]|0,g=h[g+8>>2]|0,!x){m=(b|0)<0,xe=m?b:0,we=E-xe|0,ue=(we|0)<0,xe=(ue?0-we|0:0)+(g-xe)|0,g=(xe|0)<0,v=g?0:xe,xe=g?xe:0,g=(ue?0:we)-xe|0,xe=(m?0:b)-(ue?we:0)-xe|0,we=(g|0)<(xe|0)?g:xe,we=(v|0)<(we|0)?v:we,we=(we|0)>0?we:0,v=v-we|0,g=g-we|0;e:do switch(xe-we|0){case 0:switch(g|0){case 0:if(v){v=(v|0)==1?1:7,se=11;break e}else{v=0;break e}case 1:if(v){v=(v|0)==1?3:7,se=11;break e}else{v=2;break e}default:return _=1,_|0}case 1:switch(g|0){case 0:if(v){v=(v|0)==1?5:7,se=11;break e}else{v=4;break e}case 1:{if(v)v=1;else{v=6;break e}return v|0}default:return _=1,_|0}default:return _=1,_|0}while(!1);return(se|0)==11&&(v|0)==7||(v=tL(Ae,v)|0,(v|0)==127)?(_=1,_|0):(we=ft(v|0,0,45)|0,Ae=ee()|0,se=_,Ae=h[se+4>>2]&-1040385|Ae,h[_>>2]=h[se>>2]|we,h[_+4>>2]=Ae,_=0,_|0)}for(;;){if(ae=x,x=x+-1|0,K=b-g|0,X=E-g|0,M=K>>>0>715827881|X>>>0>715827881,_c(ae)|0){if(M){if(U=(K|0)>0,q=2147483647-K|0,j=-2147483648-K|0,U?(q|0)<(K|0):(j|0)>(K|0)){v=1,se=107;break}if(be=K<<1,U?(2147483647-be|0)<(K|0):(-2147483648-be|0)>(K|0)){v=1,se=107;break}if((X|0)>0?(2147483647-X|0)<(X|0):(-2147483648-X|0)>(X|0)){v=1,se=107;break}if(M=K*3|0,N=X<<1,(U?(q|0)<(N|0):(j|0)>(N|0))||((K|0)>-1?(M|-2147483648|0)>=(X|0):(M^-2147483648|0)<(X|0))){v=1,se=107;break}}else M=K*3|0,N=X<<1;if(q=rh(+(M-X|0)*.14285714285714285)|0,U=rh(+(N+K|0)*.14285714285714285)|0,N=(U|0)<(q|0),M=N?q:U,N=N?U:q,(N|0)<0){if((N|0)==-2147483648||((M|0)>0?(2147483647-M|0)<(N|0):(-2147483648-M|0)>(N|0))){se=24;break}if((M|0)>-1?(M|-2147483648|0)>=(N|0):(M^-2147483648|0)<(N|0)){se=24;break}}j=(q|0)<0,X=U-(j?q:0)|0,Ke=(X|0)<0,Be=(j?0-q|0:0)-(Ke?X:0)|0,K=(Be|0)<0,j=(j?0:q)-(Ke?X:0)-(K?Be:0)|0,X=(Ke?0:X)-(K?Be:0)|0,Be=K?0:Be,K=(X|0)<(j|0)?X:j,K=(Be|0)<(K|0)?Be:K,Ke=(K|0)>0,j=j-(Ke?K:0)|0,X=X-(Ke?K:0)|0,K=Be-(Ke?K:0)|0,Ke=(j*3|0)+X|0,Be=(Ke|0)<0,be=(X*3|0)+K-(Be?Ke:0)|0,M=(be|0)<0,q=(K*3|0)+j-(Be?Ke:0)-(M?be:0)|0,U=(q|0)<0,Me=U?0:q,N=(M?0:be)-(U?q:0)|0,q=(Be?0:Ke)-(M?be:0)-(U?q:0)|0,U=(N|0)<(q|0)?N:q,U=(Me|0)<(U|0)?Me:U,be=(U|0)>0,M=be?U:0,N=N-(be?U:0)|0,U=Me-(be?U:0)|0}else{if(M){if(N=(K|0)>0,N?(2147483647-K|0)<(K|0):(-2147483648-K|0)>(K|0)){v=1,se=107;break}if(M=K<<1,U=(X|0)>0,U?(2147483647-X|0)<(X|0):(-2147483648-X|0)>(X|0)){v=1,se=107;break}if(j=X<<1,U?(2147483647-j|0)<(X|0):(-2147483648-j|0)>(X|0)){v=1,se=107;break}if(N?(2147483647-M|0)<(X|0):(-2147483648-M|0)>(X|0)){v=1,se=107;break}if(N=X*3|0,(X|0)>-1?(N|-2147483648|0)>=(K|0):(N^-2147483648|0)<(K|0)){v=1,se=107;break}}else M=K<<1,N=X*3|0;if(q=rh(+(M+X|0)*.14285714285714285)|0,U=rh(+(N-K|0)*.14285714285714285)|0,N=(U|0)<(q|0),M=N?q:U,N=N?U:q,(N|0)<0){if((N|0)==-2147483648||((M|0)>0?(2147483647-M|0)<(N|0):(-2147483648-M|0)>(N|0))){se=36;break}if((M|0)>-1?(M|-2147483648|0)>=(N|0):(M^-2147483648|0)<(N|0)){se=36;break}}j=(q|0)<0,X=U-(j?q:0)|0,Me=(X|0)<0,be=(j?0-q|0:0)-(Me?X:0)|0,K=(be|0)<0,j=(j?0:q)-(Me?X:0)-(K?be:0)|0,X=(Me?0:X)-(K?be:0)|0,be=K?0:be,K=(X|0)<(j|0)?X:j,K=(be|0)<(K|0)?be:K,Me=(K|0)>0,j=j-(Me?K:0)|0,X=X-(Me?K:0)|0,K=be-(Me?K:0)|0,Me=(j*3|0)+K|0,be=(Me|0)<0,Be=(X*3|0)+j-(be?Me:0)|0,M=(Be|0)<0,q=(K*3|0)+X-(be?Me:0)-(M?Be:0)|0,U=(q|0)<0,Ke=U?0:q,N=(M?0:Be)-(U?q:0)|0,q=(be?0:Me)-(M?Be:0)-(U?q:0)|0,U=(N|0)<(q|0)?N:q,U=(Ke|0)<(U|0)?Ke:U,Be=(U|0)>0,M=Be?U:0,N=N-(Be?U:0)|0,U=Ke-(Be?U:0)|0}M=b+(M-q)|0,Me=(M|0)<0,N=E-N-(Me?M:0)|0,q=(N|0)<0,Be=g-U+(Me?0-M|0:0)+(q?0-N|0:0)|0,b=(Be|0)<0,U=b?0:Be,be=(q?0:N)-(b?Be:0)|0,Be=(Me?0:M)-(q?N:0)-(b?Be:0)|0,b=(be|0)<(Be|0)?be:Be,b=(U|0)<(b|0)?U:b,g=(b|0)>0,Be=Be-(g?b:0)|0,N=_,q=h[N>>2]|0,N=h[N+4>>2]|0,E=(15-ae|0)*3|0,M=ft(7,0,E|0)|0,M=q&~M,N=N&~(ee()|0),q=(Be|0)<0,Me=q?Be:0,be=be-(g?b:0)-Me|0,Ke=(be|0)<0,Me=(Ke?0-be|0:0)+(U-(g?b:0)-Me)|0,b=(Me|0)<0,g=b?0:Me,Me=b?Me:0,b=(Ke?0:be)-Me|0,Me=(q?0:Be)-(Ke?be:0)-Me|0,be=(b|0)<(Me|0)?b:Me,be=(g|0)<(be|0)?g:be,be=(be|0)>0?be:0,g=g-be|0,b=b-be|0;e:do switch(Me-be|0){case 0:switch(b|0){case 0:{g=(g|0)==0?0:(g|0)==1?1:7;break e}case 1:{g=(g|0)==0?2:(g|0)==1?3:7;break e}default:{se=45;break e}}case 1:switch(b|0){case 0:{g=(g|0)==0?4:(g|0)==1?5:7;break e}case 1:if(g){se=45;break e}else{g=6;break e}default:{se=45;break e}}default:se=45}while(!1);if((se|0)==45&&(se=0,g=7),Ke=ft(g|0,0,E|0)|0,Me=ee()|0|N,be=_,h[be>>2]=Ke|M,h[be+4>>2]=Me,(ae|0)<=1){se=47;break}else b=j,E=X,g=K}if((se|0)==24)di(27634,27425,416,27447);else if((se|0)==36)di(27634,27425,464,27461);else if((se|0)==47){if((j|0)>1|(X|0)>1|(K|0)>1)return be=1,be|0;Be=(j|0)<0,Me=Be?j:0,be=X-Me|0,Ke=(be|0)<0,Me=(Ke?0-be|0:0)+(K-Me)|0,x=(Me|0)<0,g=x?0:Me,Me=x?Me:0,x=(Ke?0:be)-Me|0,Me=(Be?0:j)-(Ke?be:0)-Me|0,be=(x|0)<(Me|0)?x:Me,be=(g|0)<(be|0)?g:be,be=(be|0)>0?be:0,g=g-be|0,x=x-be|0;e:do switch(Me-be|0){case 0:switch(x|0){case 0:{x=(g|0)==0?0:(g|0)==1?1:7;break e}case 1:{x=(g|0)==0?2:(g|0)==1?3:7;break e}default:{se=55;break e}}case 1:switch(x|0){case 0:{x=(g|0)==0?4:(g|0)==1?5:7;break e}case 1:if(g){se=55;break e}else{x=6;break e}default:{se=55;break e}}default:se=55}while(!1);(se|0)==55&&(x=7),E=tL(Ae,x)|0,(E|0)==127?N=0:N=yr(E)|0;e:do if(x){if(ue){if(g=al(p,m)|0,(g|0)==7)return be=5,be|0;b=h[21344+(g*28|0)+(x<<2)>>2]|0;t:do if((b|0)>0)for(g=x,x=0;;){switch(g|0){case 1:{g=5;break}case 5:{g=4;break}case 4:{g=6;break}case 6:{g=2;break}case 2:{g=3;break}case 3:{g=1;break}default:}if(x=x+1|0,(x|0)==(b|0))break t}else g=x;while(!1);if((g|0)==1)return be=9,be|0;x=tL(Ae,g)|0,(x|0)==127&&di(27476,27315,415,27506),yr(x)|0?di(27521,27315,416,27506):(v=x,we=b,xe=g)}else v=E,we=0,xe=x;if(M=h[4272+(Ae*28|0)+(xe<<2)>>2]|0,(M|0)<=-1&&di(27552,27315,423,27506),!N){if((we|0)<0)return be=5,be|0;if(we|0){b=_,g=0,x=h[b>>2]|0,b=h[b+4>>2]|0;do x=zm(x,b)|0,b=ee()|0,be=_,h[be>>2]=x,h[be+4>>2]=b,g=g+1|0;while((g|0)<(we|0))}if((M|0)<=0){se=104;break}for(b=_,g=0,x=h[b>>2]|0,b=h[b+4>>2]|0;;)if(x=zm(x,b)|0,b=ee()|0,be=_,h[be>>2]=x,h[be+4>>2]=b,g=g+1|0,(g|0)==(M|0)){se=104;break e}}if(E=nL(v,Ae)|0,(E|0)==7&&di(27291,27315,432,27506),g=_,x=h[g>>2]|0,g=h[g+4>>2]|0,(M|0)>0){b=0;do x=zm(x,g)|0,g=ee()|0,be=_,h[be>>2]=x,h[be+4>>2]=g,b=b+1|0;while((b|0)!=(M|0))}if(g=al(x,g)|0,(g|0)==7&&di(27634,27315,444,27506),x=eL(v)|0,x=h[(x?21760:21552)+(E*28|0)+(g<<2)>>2]|0,(x|0)<0&&di(27634,27315,458,27506),!x)se=104;else{E=_,g=0,b=h[E>>2]|0,E=h[E+4>>2]|0;do b=uL(b,E)|0,E=ee()|0,be=_,h[be>>2]=b,h[be+4>>2]=E,g=g+1|0;while((g|0)<(x|0));se=104}}else if((ue|0)!=0&(N|0)!=0){if(v=al(p,m)|0,g=_,g=al(h[g>>2]|0,h[g+4>>2]|0)|0,(v|0)==7|(g|0)==7||(g=h[21344+(v*28|0)+(g<<2)>>2]|0,(g|0)<0))return be=5,be|0;if(!g)v=E,se=105;else{b=_,v=0,x=h[b>>2]|0,b=h[b+4>>2]|0;do x=zm(x,b)|0,b=ee()|0,be=_,h[be>>2]=x,h[be+4>>2]=b,v=v+1|0;while((v|0)<(g|0));v=E,se=104}}else v=E,se=104;while(!1);return(se|0)==104&&N&&(se=105),(se|0)==105&&(be=_,(al(h[be>>2]|0,h[be+4>>2]|0)|0)==1)?(be=9,be|0):(Me=_,Be=h[Me>>2]|0,Me=h[Me+4>>2]&-1040385,Ke=ft(v|0,0,45)|0,Me=Me|(ee()|0),be=_,h[be>>2]=Be|Ke,h[be+4>>2]=Me,be=0,be|0)}else if((se|0)==107)return v|0;return 0}function Tue(p,m,g,_,v,x){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0,x=x|0;var b=0,E=0;return E=Q,Q=Q+16|0,b=E,v|0?(b=15,Q=E,b|0):(p=Yx(p,m,g,_,b)|0,p||(v=h[b+4>>2]|0,p=h[b+8>>2]|0,h[x>>2]=(h[b>>2]|0)-p,h[x+4>>2]=v-p,p=0),b=p,Q=E,b|0)}function Eue(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0;return q=Q,Q=Q+16|0,U=q,_|0?(U=15,Q=q,U|0):(E=h[g>>2]|0,b=h[g+4>>2]|0,h[U>>2]=E,M=U+4|0,h[M>>2]=b,N=U+8|0,h[N>>2]=0,g=(b|0)<(E|0),_=g?E:b,g=g?b:E,(g|0)<0?!((g|0)==-2147483648||((_|0)>0?(2147483647-_|0)<(g|0):(-2147483648-_|0)>(g|0)))&&!((_|0)>-1?(_|-2147483648|0)>=(g|0):(_^-2147483648|0)<(g|0))?x=5:_=1:x=5,(x|0)==5&&(_=b-E|0,x=0-E|0,(E|0)<0?(h[M>>2]=_,h[N>>2]=x,h[U>>2]=0,E=0):(_=b,x=0),b=E-_|0,g=x-_|0,(_|0)<0?(h[U>>2]=b,h[N>>2]=g,h[M>>2]=0,E=b,_=0):g=x,b=E-g|0,x=_-g|0,(g|0)<0?(h[U>>2]=b,h[M>>2]=x,h[N>>2]=0,g=0):(x=_,b=E),_=(x|0)<(b|0)?x:b,_=(g|0)<(_|0)?g:_,(_|0)>0&&(h[U>>2]=b-_,h[M>>2]=x-_,h[N>>2]=g-_),_=aq(p,m,U,v)|0),U=_,Q=q,U|0)}function gL(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0;return M=Q,Q=Q+32|0,b=M+12|0,E=M,x=Yx(p,m,p,m,b)|0,x|0?(E=x,Q=M,E|0):(p=Yx(p,m,g,_,E)|0,p|0?(E=p,Q=M,E|0):(p=(h[b>>2]|0)-(h[E>>2]|0)|0,N=(p|0)<0,_=N?0-p|0:0,g=_+((h[b+4>>2]|0)-(h[E+4>>2]|0))|0,m=(g|0)<0,_=(h[b+8>>2]|0)-(h[E+8>>2]|0)+_+(m?0-g|0:0)|0,x=(_|0)<0,b=x?0:_,_=x?_:0,x=(m?0:g)-_|0,_=(N?0:p)-(m?g:0)-_|0,E=(x|0)<(_|0)?x:_,E=(b|0)<(E|0)?b:E,E=(E|0)>0?E:0,b=b-E|0,x=x-E|0,E=_-E|0,E=(E|0)>-1?E:0-E|0,x=(x|0)>-1?x:0-x|0,b=(b|0)>-1?b:0-b|0,b=(x|0)>(b|0)?x:b,b=(E|0)>(b|0)?E:b,E=v,h[E>>2]=b,h[E+4>>2]=((b|0)<0)<<31>>31,E=0,Q=M,E|0))}function Mue(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0;return b=Q,Q=Q+16|0,x=b,p=gL(p,m,g,_,x)|0,p|0?(x=p,Q=b,x|0):(g=x,g=At(h[g>>2]|0,h[g+4>>2]|0,1,0)|0,_=ee()|0,x=v,h[x>>2]=g,h[x+4>>2]=_,x=0,Q=b,x|0)}function Cue(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0;return M=Q,Q=Q+16|0,x=M,b=gL(p,m,g,_,x)|0,b|0?(v=b,Q=M,v|0):(b=x,x=h[b>>2]|0,b=h[b+4>>2]|0,(x|0)==0&(b|0)==0?(h[v>>2]=p,h[v+4>>2]=m,v=0,Q=M,v|0):(E=lq(p,m,g,_,x,b,v,0,0,1,0)|0,E?(v=(lq(g,_,p,m,x,b,v,x,b,-1,-1)|0)==0,v=v?0:E,Q=M,v|0):(v=0,Q=M,v|0)))}function lq(p,m,g,_,v,x,b,E,M,N,U){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0,x=x|0,b=b|0,E=E|0,M=M|0,N=N|0,U=U|0;var q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0,be=0,gt=0,je=0,Ut=0,lt=0;if(Ut=Q,Q=Q+48|0,q=Ut+24|0,j=Ut+12|0,je=Ut,h[q>>2]=0,h[q+4>>2]=0,h[q+8>>2]=0,h[j>>2]=0,h[j+4>>2]=0,h[j+8>>2]=0,Yx(p,m,p,m,q)|0&&di(27634,27315,696,27575),Yx(p,m,g,_,j)|0&&di(27634,27315,701,27575),ae=q+8|0,_=h[ae>>2]|0,g=_-(h[q>>2]|0)|0,h[q>>2]=g,gt=q+4|0,_=(h[gt>>2]|0)-_|0,h[gt>>2]=_,gt=_+g|0,q=0-gt|0,h[ae>>2]=q,ae=j+8|0,se=h[ae>>2]|0,xe=se-(h[j>>2]|0)|0,h[j>>2]=xe,be=j+4|0,se=(h[be>>2]|0)-se|0,h[be>>2]=se,be=se+xe|0,h[ae>>2]=0-be,Me=1/(+(v>>>0)+4294967296*+(x|0)),Be=Me*+(xe-g|0),Ke=Me*+(se-_|0),Me=Me*+(gt-be|0),h[je>>2]=g,be=je+4|0,h[be>>2]=_,gt=je+8|0,h[gt>>2]=q,(x|0)<0)return N=0,Q=Ut,N|0;for(Ae=+(g|0),we=+(_|0),ue=+(q|0),xe=0,se=0;;){if(K=+(xe>>>0)+4294967296*+(se|0),lt=Be*K+Ae,X=Ke*K+we,K=Me*K+ue,_=~~+pT(+lt),q=~~+pT(+X),g=~~+pT(+K),lt=+Qs(+(+(_|0)-lt)),X=+Qs(+(+(q|0)-X)),K=+Qs(+(+(g|0)-K)),lt>X<>K?(j=g+q|0,_=0-j|0):(j=0-_|0,X>K&&(q=j-g|0)),h[be>>2]=q,h[je>>2]=j,h[gt>>2]=0,g=_+q|0,(_|0)>0?(h[be>>2]=g,h[gt>>2]=_,h[je>>2]=0,j=0):(g=q,_=0),(g|0)<0?(q=j-g|0,h[je>>2]=q,_=_-g|0,h[gt>>2]=_,h[be>>2]=0,j=q-_|0,g=0-_|0,(_|0)<0?(h[je>>2]=j,h[be>>2]=g,h[gt>>2]=0,ae=g,_=0):(ae=0,j=q)):ae=g,g=(ae|0)<(j|0)?ae:j,g=(_|0)<(g|0)?_:g,(g|0)>0&&(h[je>>2]=j-g,h[be>>2]=ae-g,h[gt>>2]=_-g),g=wr(xe|0,se|0,N|0,U|0)|0,g=At(g|0,ee()|0,E|0,M|0)|0,ee()|0,g=aq(p,m,je,b+(g<<3)|0)|0,g|0){_=20;break}if(ae=xe,xe=At(xe|0,se|0,1,0)|0,j=se,se=ee()|0,!((j|0)<(x|0)|(j|0)==(x|0)&ae>>>0<v>>>0)){g=0,_=20;break}}return(_|0)==20?(Q=Ut,g|0):0}function ap(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0;if((g|0)==0&(_|0)==0)return v=0,x=1,On(v|0),x|0;x=p,v=m,p=1,m=0;do b=(g&1|0)==0&!0,p=wr((b?1:x)|0,(b?0:v)|0,p|0,m|0)|0,m=ee()|0,g=bq(g|0,_|0,1)|0,_=ee()|0,x=wr(x|0,v|0,x|0,v|0)|0,v=ee()|0;while(!((g|0)==0&(_|0)==0));return On(m|0),p|0}function vL(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0;E=Q,Q=Q+16|0,x=E,b=tt(p|0,m|0,52)|0,ee()|0,b=b&15;do if(b){if(v=T1(p,m,x)|0,!v){N=+ie[x>>3],M=1/+ii(+N),U=+ie[26032+(b<<3)>>3],ie[g>>3]=N+U,ie[g+8>>3]=N-U,N=+ie[x+8>>3],M=U*M,ie[g+16>>3]=M+N,ie[g+24>>3]=N-M;break}return b=v,Q=E,b|0}else{if(v=tt(p|0,m|0,45)|0,ee()|0,v=v&127,v>>>0>121)return b=5,Q=E,b|0;x=22128+(v<<5)|0,h[g>>2]=h[x>>2],h[g+4>>2]=h[x+4>>2],h[g+8>>2]=h[x+8>>2],h[g+12>>2]=h[x+12>>2],h[g+16>>2]=h[x+16>>2],h[g+20>>2]=h[x+20>>2],h[g+24>>2]=h[x+24>>2],h[g+28>>2]=h[x+28>>2];break}while(!1);return Gce(g,_?1.4:1.1),_=26160+(b<<3)|0,(h[_>>2]|0)==(p|0)&&(h[_+4>>2]|0)==(m|0)&&(ie[g>>3]=1.5707963267948966),b=26288+(b<<3)|0,(h[b>>2]|0)==(p|0)&&(h[b+4>>2]|0)==(m|0)&&(ie[g+8>>3]=-1.5707963267948966),+ie[g>>3]!=1.5707963267948966&&+ie[g+8>>3]!=-1.5707963267948966?(b=0,Q=E,b|0):(ie[g+16>>3]=3.141592653589793,ie[g+24>>3]=-3.141592653589793,b=0,Q=E,b|0)}function Rue(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0;N=Q,Q=Q+48|0,b=N+32|0,x=N+40|0,E=N,lL(b,0,0,0),M=h[b>>2]|0,b=h[b+4>>2]|0;do if(g>>>0<=15){if(v=Kx(_)|0,v|0){_=E,h[_>>2]=0,h[_+4>>2]=0,h[E+8>>2]=v,h[E+12>>2]=-1,_=E+16|0,M=E+29|0,h[_>>2]=0,h[_+4>>2]=0,h[_+8>>2]=0,He[_+12>>0]=0,He[M>>0]=He[x>>0]|0,He[M+1>>0]=He[x+1>>0]|0,He[M+2>>0]=He[x+2>>0]|0;break}if(v=Ta((h[m+8>>2]|0)+1|0,32)|0,v){_L(m,v),U=E,h[U>>2]=M,h[U+4>>2]=b,h[E+8>>2]=0,h[E+12>>2]=g,h[E+16>>2]=_,h[E+20>>2]=m,h[E+24>>2]=v,He[E+28>>0]=0,M=E+29|0,He[M>>0]=He[x>>0]|0,He[M+1>>0]=He[x+1>>0]|0,He[M+2>>0]=He[x+2>>0]|0;break}else{_=E,h[_>>2]=0,h[_+4>>2]=0,h[E+8>>2]=13,h[E+12>>2]=-1,_=E+16|0,M=E+29|0,h[_>>2]=0,h[_+4>>2]=0,h[_+8>>2]=0,He[_+12>>0]=0,He[M>>0]=He[x>>0]|0,He[M+1>>0]=He[x+1>>0]|0,He[M+2>>0]=He[x+2>>0]|0;break}}else M=E,h[M>>2]=0,h[M+4>>2]=0,h[E+8>>2]=4,h[E+12>>2]=-1,M=E+16|0,U=E+29|0,h[M>>2]=0,h[M+4>>2]=0,h[M+8>>2]=0,He[M+12>>0]=0,He[U>>0]=He[x>>0]|0,He[U+1>>0]=He[x+1>>0]|0,He[U+2>>0]=He[x+2>>0]|0;while(!1);aT(E),h[p>>2]=h[E>>2],h[p+4>>2]=h[E+4>>2],h[p+8>>2]=h[E+8>>2],h[p+12>>2]=h[E+12>>2],h[p+16>>2]=h[E+16>>2],h[p+20>>2]=h[E+20>>2],h[p+24>>2]=h[E+24>>2],h[p+28>>2]=h[E+28>>2],Q=N}function aT(p){p=p|0;var m=0,g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0;if(Ae=Q,Q=Q+336|0,X=Ae+168|0,K=Ae,_=p,g=h[_>>2]|0,_=h[_+4>>2]|0,(g|0)==0&(_|0)==0){Q=Ae;return}if(m=p+28|0,He[m>>0]|0?(g=cq(g,_)|0,_=ee()|0):He[m>>0]=1,we=p+20|0,!(h[h[we>>2]>>2]|0)){m=p+24|0,g=h[m>>2]|0,g|0&&_t(g),se=p,h[se>>2]=0,h[se+4>>2]=0,h[p+8>>2]=0,h[we>>2]=0,h[p+12>>2]=-1,h[p+16>>2]=0,h[m>>2]=0,Q=Ae;return}se=p+16|0,m=h[se>>2]|0,v=m&15;e:do if((g|0)==0&(_|0)==0)xe=p+24|0;else{ae=p+12|0,q=(v|0)==3,U=m&255,M=(v|1|0)==3,j=p+24|0,N=(v+-1|0)>>>0<3,b=(v|2|0)==3,E=K+8|0;t:for(;;){if(x=tt(g|0,_|0,52)|0,ee()|0,x=x&15,(x|0)==(h[ae>>2]|0)){switch(U&15){case 0:case 2:case 3:{if(v=T1(g,_,X)|0,v|0){ue=15;break t}if(xL(h[we>>2]|0,h[j>>2]|0,X)|0){ue=19;break t}break}default:}if(M&&(v=h[(h[we>>2]|0)+4>>2]|0,h[X>>2]=h[v>>2],h[X+4>>2]=h[v+4>>2],h[X+8>>2]=h[v+8>>2],h[X+12>>2]=h[v+12>>2],XG(26896,X)|0)){if(fL(h[(h[we>>2]|0)+4>>2]|0,x,K)|0){ue=25;break}if(v=K,(h[v>>2]|0)==(g|0)&&(h[v+4>>2]|0)==(_|0)){ue=29;break}}if(N){if(v=Vm(g,_,X)|0,v|0){ue=32;break}if(vL(g,_,K,0)|0){ue=36;break}if(b&&hq(h[we>>2]|0,h[j>>2]|0,X,K)|0){ue=42;break}if(M&&fq(h[we>>2]|0,h[j>>2]|0,X,K)|0){ue=42;break}}if(q){if(m=vL(g,_,X,1)|0,v=h[j>>2]|0,m|0){ue=45;break}if(iL(v,X)|0){if(YG(K,X),$G(X,h[j>>2]|0)|0){ue=53;break}if(xL(h[we>>2]|0,h[j>>2]|0,E)|0){ue=53;break}if(fq(h[we>>2]|0,h[j>>2]|0,K,X)|0){ue=53;break}}}}do if((x|0)<(h[ae>>2]|0)){if(m=vL(g,_,X,1)|0,v=h[j>>2]|0,m|0){ue=58;break t}if(!(iL(v,X)|0)){ue=73;break}if($G(h[j>>2]|0,X)|0&&(YG(K,X),hq(h[we>>2]|0,h[j>>2]|0,K,X)|0)){ue=65;break t}if(g=iq(g,_,x+1|0,K)|0,g|0){ue=67;break t}_=K,g=h[_>>2]|0,_=h[_+4>>2]|0}else ue=73;while(!1);if((ue|0)==73&&(ue=0,g=cq(g,_)|0,_=ee()|0),(g|0)==0&(_|0)==0){xe=j;break e}}switch(ue|0){case 15:{m=h[j>>2]|0,m|0&&_t(m),ue=p,h[ue>>2]=0,h[ue+4>>2]=0,h[we>>2]=0,h[ae>>2]=-1,h[se>>2]=0,h[j>>2]=0,h[p+8>>2]=v,ue=20;break}case 19:{h[p>>2]=g,h[p+4>>2]=_,ue=20;break}case 25:{di(27634,27600,470,27611);break}case 29:{h[p>>2]=g,h[p+4>>2]=_,Q=Ae;return}case 32:{m=h[j>>2]|0,m|0&&_t(m),xe=p,h[xe>>2]=0,h[xe+4>>2]=0,h[we>>2]=0,h[ae>>2]=-1,h[se>>2]=0,h[j>>2]=0,h[p+8>>2]=v,Q=Ae;return}case 36:{di(27634,27600,493,27611);break}case 42:{h[p>>2]=g,h[p+4>>2]=_,Q=Ae;return}case 45:{v|0&&_t(v),ue=p,h[ue>>2]=0,h[ue+4>>2]=0,h[we>>2]=0,h[ae>>2]=-1,h[se>>2]=0,h[j>>2]=0,h[p+8>>2]=m,ue=55;break}case 53:{h[p>>2]=g,h[p+4>>2]=_,ue=55;break}case 58:{v|0&&_t(v),ue=p,h[ue>>2]=0,h[ue+4>>2]=0,h[we>>2]=0,h[ae>>2]=-1,h[se>>2]=0,h[j>>2]=0,h[p+8>>2]=m,ue=71;break}case 65:{h[p>>2]=g,h[p+4>>2]=_,ue=71;break}case 67:{m=h[j>>2]|0,m|0&&_t(m),xe=p,h[xe>>2]=0,h[xe+4>>2]=0,h[we>>2]=0,h[ae>>2]=-1,h[se>>2]=0,h[j>>2]=0,h[p+8>>2]=g,Q=Ae;return}}if((ue|0)==20){Q=Ae;return}else if((ue|0)==55){Q=Ae;return}else if((ue|0)==71){Q=Ae;return}}while(!1);m=h[xe>>2]|0,m|0&&_t(m),ue=p,h[ue>>2]=0,h[ue+4>>2]=0,h[p+8>>2]=0,h[we>>2]=0,h[p+12>>2]=-1,h[se>>2]=0,h[xe>>2]=0,Q=Ae}function cq(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0;q=Q,Q=Q+16|0,U=q,_=tt(p|0,m|0,52)|0,ee()|0,_=_&15,g=tt(p|0,m|0,45)|0,ee()|0;do if(_){for(;g=ft(_+4095|0,0,52)|0,v=ee()|0|m&-15728641,x=(15-_|0)*3|0,b=ft(7,0,x|0)|0,E=ee()|0,g=g|p|b,v=v|E,M=tt(p|0,m|0,x|0)|0,ee()|0,M=M&7,_=_+-1|0,!(M>>>0<6);)if(_)m=v,p=g;else{N=4;break}if((N|0)==4){g=tt(g|0,v|0,45)|0,ee()|0;break}return U=(M|0)==0&(Zi(g,v)|0)!=0,U=ft((U?2:1)+M|0,0,x|0)|0,N=ee()|0|m&~E,U=U|p&~b,On(N|0),Q=q,U|0}while(!1);return g=g&127,g>>>0>120?(N=0,U=0,On(N|0),Q=q,U|0):(lL(U,0,g+1|0,0),N=h[U+4>>2]|0,U=h[U>>2]|0,On(N|0),Q=q,U|0)}function Iue(p,m,g,_,v,x){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0,x=x|0;var b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0;ue=Q,Q=Q+160|0,q=ue+80|0,E=ue+64|0,j=ue+112|0,ae=ue,Rue(q,p,m,g),N=q,mL(E,h[N>>2]|0,h[N+4>>2]|0,m),N=E,M=h[N>>2]|0,N=h[N+4>>2]|0,b=h[q+8>>2]|0,X=j+4|0,h[X>>2]=h[q>>2],h[X+4>>2]=h[q+4>>2],h[X+8>>2]=h[q+8>>2],h[X+12>>2]=h[q+12>>2],h[X+16>>2]=h[q+16>>2],h[X+20>>2]=h[q+20>>2],h[X+24>>2]=h[q+24>>2],h[X+28>>2]=h[q+28>>2],X=ae,h[X>>2]=M,h[X+4>>2]=N,X=ae+8|0,h[X>>2]=b,p=ae+12|0,m=j,g=p+36|0;do h[p>>2]=h[m>>2],p=p+4|0,m=m+4|0;while((p|0)<(g|0));if(j=ae+48|0,h[j>>2]=h[E>>2],h[j+4>>2]=h[E+4>>2],h[j+8>>2]=h[E+8>>2],h[j+12>>2]=h[E+12>>2],(M|0)==0&(N|0)==0)return ae=b,Q=ue,ae|0;g=ae+16|0,U=ae+24|0,q=ae+28|0,b=0,E=0,m=M,p=N;do{if(!((b|0)<(v|0)|(b|0)==(v|0)&E>>>0<_>>>0)){K=4;break}if(N=E,E=At(E|0,b|0,1,0)|0,b=ee()|0,N=x+(N<<3)|0,h[N>>2]=m,h[N+4>>2]=p,AL(j),p=j,m=h[p>>2]|0,p=h[p+4>>2]|0,(m|0)==0&(p|0)==0){if(aT(g),m=g,p=h[m>>2]|0,m=h[m+4>>2]|0,(p|0)==0&(m|0)==0){K=10;break}sq(p,m,h[q>>2]|0,j),p=j,m=h[p>>2]|0,p=h[p+4>>2]|0}N=ae,h[N>>2]=m,h[N+4>>2]=p}while(!((m|0)==0&(p|0)==0));return(K|0)==4?(p=ae+40|0,m=h[p>>2]|0,m|0&&_t(m),K=ae+16|0,h[K>>2]=0,h[K+4>>2]=0,h[U>>2]=0,h[ae+36>>2]=0,h[q>>2]=-1,h[ae+32>>2]=0,h[p>>2]=0,sq(0,0,0,j),h[ae>>2]=0,h[ae+4>>2]=0,h[X>>2]=0,ae=14,Q=ue,ae|0):((K|0)==10&&(h[ae>>2]=0,h[ae+4>>2]=0,h[X>>2]=h[U>>2]),ae=h[X>>2]|0,Q=ue,ae|0)}function Pue(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0;if(q=Q,Q=Q+48|0,M=q+32|0,E=q+40|0,N=q,!(h[p>>2]|0))return U=_,h[U>>2]=0,h[U+4>>2]=0,U=0,Q=q,U|0;lL(M,0,0,0),b=M,v=h[b>>2]|0,b=h[b+4>>2]|0;do if(m>>>0>15)U=N,h[U>>2]=0,h[U+4>>2]=0,h[N+8>>2]=4,h[N+12>>2]=-1,U=N+16|0,g=N+29|0,h[U>>2]=0,h[U+4>>2]=0,h[U+8>>2]=0,He[U+12>>0]=0,He[g>>0]=He[E>>0]|0,He[g+1>>0]=He[E+1>>0]|0,He[g+2>>0]=He[E+2>>0]|0,g=4,U=9;else{if(g=Kx(g)|0,g|0){M=N,h[M>>2]=0,h[M+4>>2]=0,h[N+8>>2]=g,h[N+12>>2]=-1,M=N+16|0,U=N+29|0,h[M>>2]=0,h[M+4>>2]=0,h[M+8>>2]=0,He[M+12>>0]=0,He[U>>0]=He[E>>0]|0,He[U+1>>0]=He[E+1>>0]|0,He[U+2>>0]=He[E+2>>0]|0,U=9;break}if(g=Ta((h[p+8>>2]|0)+1|0,32)|0,!g){U=N,h[U>>2]=0,h[U+4>>2]=0,h[N+8>>2]=13,h[N+12>>2]=-1,U=N+16|0,g=N+29|0,h[U>>2]=0,h[U+4>>2]=0,h[U+8>>2]=0,He[U+12>>0]=0,He[g>>0]=He[E>>0]|0,He[g+1>>0]=He[E+1>>0]|0,He[g+2>>0]=He[E+2>>0]|0,g=13,U=9;break}_L(p,g),X=N,h[X>>2]=v,h[X+4>>2]=b,b=N+8|0,h[b>>2]=0,h[N+12>>2]=m,h[N+20>>2]=p,h[N+24>>2]=g,He[N+28>>0]=0,v=N+29|0,He[v>>0]=He[E>>0]|0,He[v+1>>0]=He[E+1>>0]|0,He[v+2>>0]=He[E+2>>0]|0,h[N+16>>2]=3,j=+kce(g),j=j*+Oce(g),x=+Qs(+ +ie[g>>3]),x=j/+ii(+ +dT(+x,+ +Qs(+ +ie[g+8>>3])))*6371.007180918475*6371.007180918475,v=N+12|0,g=h[v>>2]|0;e:do if((g|0)>0)do{if(oq(g+-1|0,M)|0,!(x/+ie[M>>3]>10))break e;X=h[v>>2]|0,g=X+-1|0,h[v>>2]=g}while((X|0)>1);while(!1);if(aT(N),v=_,h[v>>2]=0,h[v+4>>2]=0,v=N,g=h[v>>2]|0,v=h[v+4>>2]|0,!((g|0)==0&(v|0)==0))do jx(g,v,m,M)|0,E=M,p=_,E=At(h[p>>2]|0,h[p+4>>2]|0,h[E>>2]|0,h[E+4>>2]|0)|0,p=ee()|0,X=_,h[X>>2]=E,h[X+4>>2]=p,aT(N),X=N,g=h[X>>2]|0,v=h[X+4>>2]|0;while(!((g|0)==0&(v|0)==0));g=h[b>>2]|0}while(!1);return X=g,Q=q,X|0}function Zx(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0;if(!(XG(m,g)|0)||(m=Uce(m)|0,_=+ie[g>>3],v=+ie[g+8>>3],v=m&v<0?v+6.283185307179586:v,j=h[p>>2]|0,(j|0)<=0))return j=0,j|0;if(q=h[p+4>>2]|0,m){m=0,U=v,g=-1,p=0;e:for(;;){for(N=p;b=+ie[q+(N<<4)>>3],v=+ie[q+(N<<4)+8>>3],p=(g+2|0)%(j|0)|0,x=+ie[q+(p<<4)>>3],E=+ie[q+(p<<4)+8>>3],b>x?(M=b,b=E):(M=x,x=b,b=v,v=E),_=_==x|_==M?_+2220446049250313e-31:_,!!(_<x|_>M);)if(g=N+1|0,(g|0)>=(j|0)){g=22;break e}else p=N,N=g,g=p;if(E=b<0?b+6.283185307179586:b,b=v<0?v+6.283185307179586:v,U=E==U|b==U?U+-2220446049250313e-31:U,M=E+(b-E)*((_-x)/(M-x)),(M<0?M+6.283185307179586:M)>U&&(m=m^1),p=N+1|0,(p|0)>=(j|0)){g=22;break}else g=N}if((g|0)==22)return m|0}else{m=0,U=v,g=-1,p=0;e:for(;;){for(N=p;b=+ie[q+(N<<4)>>3],v=+ie[q+(N<<4)+8>>3],p=(g+2|0)%(j|0)|0,x=+ie[q+(p<<4)>>3],E=+ie[q+(p<<4)+8>>3],b>x?(M=b,b=E):(M=x,x=b,b=v,v=E),_=_==x|_==M?_+2220446049250313e-31:_,!!(_<x|_>M);)if(g=N+1|0,(g|0)>=(j|0)){g=22;break e}else p=N,N=g,g=p;if(U=b==U|v==U?U+-2220446049250313e-31:U,b+(v-b)*((_-x)/(M-x))>U&&(m=m^1),p=N+1|0,(p|0)>=(j|0)){g=22;break}else g=N}if((g|0)==22)return m|0}return 0}function uq(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0;if(K=h[p>>2]|0,!K){h[m>>2]=0,h[m+4>>2]=0,h[m+8>>2]=0,h[m+12>>2]=0,h[m+16>>2]=0,h[m+20>>2]=0,h[m+24>>2]=0,h[m+28>>2]=0;return}if(ae=m+8|0,ie[ae>>3]=17976931348623157e292,ue=m+24|0,ie[ue>>3]=17976931348623157e292,ie[m>>3]=-17976931348623157e292,xe=m+16|0,ie[xe>>3]=-17976931348623157e292,!((K|0)<=0)){for(j=h[p+4>>2]|0,N=17976931348623157e292,U=-17976931348623157e292,q=0,p=-1,x=17976931348623157e292,b=17976931348623157e292,M=-17976931348623157e292,_=-17976931348623157e292,X=0;g=+ie[j+(X<<4)>>3],E=+ie[j+(X<<4)+8>>3],p=p+2|0,v=+ie[j+(((p|0)==(K|0)?0:p)<<4)+8>>3],g<x&&(ie[ae>>3]=g,x=g),E<b&&(ie[ue>>3]=E,b=E),g>M?ie[m>>3]=g:g=M,E>_&&(ie[xe>>3]=E,_=E),N=E>0&E<N?E:N,U=E<0&E>U?E:U,q=q|+Qs(+(E-v))>3.141592653589793,p=X+1|0,(p|0)!=(K|0);)se=X,M=g,X=p,p=se;q&&(ie[xe>>3]=U,ie[ue>>3]=N)}}function Kx(p){return p=p|0,(p>>>0<4?0:15)|0}function _L(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0;if(K=h[p>>2]|0,K){if(ae=m+8|0,ie[ae>>3]=17976931348623157e292,ue=m+24|0,ie[ue>>3]=17976931348623157e292,ie[m>>3]=-17976931348623157e292,xe=m+16|0,ie[xe>>3]=-17976931348623157e292,(K|0)>0){for(v=h[p+4>>2]|0,j=17976931348623157e292,X=-17976931348623157e292,_=0,g=-1,M=17976931348623157e292,N=17976931348623157e292,q=-17976931348623157e292,b=-17976931348623157e292,se=0;x=+ie[v+(se<<4)>>3],U=+ie[v+(se<<4)+8>>3],Ke=g+2|0,E=+ie[v+(((Ke|0)==(K|0)?0:Ke)<<4)+8>>3],x<M&&(ie[ae>>3]=x,M=x),U<N&&(ie[ue>>3]=U,N=U),x>q?ie[m>>3]=x:x=q,U>b&&(ie[xe>>3]=U,b=U),j=U>0&U<j?U:j,X=U<0&U>X?U:X,_=_|+Qs(+(U-E))>3.141592653589793,g=se+1|0,(g|0)!=(K|0);)Ke=se,q=x,se=g,g=Ke;_&&(ie[xe>>3]=X,ie[ue>>3]=j)}}else h[m>>2]=0,h[m+4>>2]=0,h[m+8>>2]=0,h[m+12>>2]=0,h[m+16>>2]=0,h[m+20>>2]=0,h[m+24>>2]=0,h[m+28>>2]=0;if(Ke=p+8|0,g=h[Ke>>2]|0,!((g|0)<=0)){Be=p+12|0,Ae=0;do if(v=h[Be>>2]|0,_=Ae,Ae=Ae+1|0,ue=m+(Ae<<5)|0,xe=h[v+(_<<3)>>2]|0,xe){if(se=m+(Ae<<5)+8|0,ie[se>>3]=17976931348623157e292,p=m+(Ae<<5)+24|0,ie[p>>3]=17976931348623157e292,ie[ue>>3]=-17976931348623157e292,we=m+(Ae<<5)+16|0,ie[we>>3]=-17976931348623157e292,(xe|0)>0){for(K=h[v+(_<<3)+4>>2]|0,j=17976931348623157e292,X=-17976931348623157e292,v=0,_=-1,ae=0,M=17976931348623157e292,N=17976931348623157e292,U=-17976931348623157e292,b=-17976931348623157e292;x=+ie[K+(ae<<4)>>3],q=+ie[K+(ae<<4)+8>>3],_=_+2|0,E=+ie[K+(((_|0)==(xe|0)?0:_)<<4)+8>>3],x<M&&(ie[se>>3]=x,M=x),q<N&&(ie[p>>3]=q,N=q),x>U?ie[ue>>3]=x:x=U,q>b&&(ie[we>>3]=q,b=q),j=q>0&q<j?q:j,X=q<0&q>X?q:X,v=v|+Qs(+(q-E))>3.141592653589793,_=ae+1|0,(_|0)!=(xe|0);)Me=ae,ae=_,U=x,_=Me;v&&(ie[we>>3]=X,ie[p>>3]=j)}}else h[ue>>2]=0,h[ue+4>>2]=0,h[ue+8>>2]=0,h[ue+12>>2]=0,h[ue+16>>2]=0,h[ue+20>>2]=0,h[ue+24>>2]=0,h[ue+28>>2]=0,g=h[Ke>>2]|0;while((Ae|0)<(g|0))}}function xL(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0;if(!(Zx(p,m,g)|0))return v=0,v|0;if(v=p+8|0,(h[v>>2]|0)<=0)return v=1,v|0;for(_=p+12|0,p=0;;){if(x=p,p=p+1|0,Zx((h[_>>2]|0)+(x<<3)|0,m+(p<<5)|0,g)|0){p=0,_=6;break}if((p|0)>=(h[v>>2]|0)){p=1,_=6;break}}return(_|0)==6?p|0:0}function hq(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0;if(N=Q,Q=Q+16|0,E=N,b=g+8|0,!(Zx(p,m,b)|0))return M=0,Q=N,M|0;M=p+8|0;e:do if((h[M>>2]|0)>0){for(x=p+12|0,v=0;;){if(U=v,v=v+1|0,Zx((h[x>>2]|0)+(U<<3)|0,m+(v<<5)|0,b)|0){v=0;break}if((v|0)>=(h[M>>2]|0))break e}return Q=N,v|0}while(!1);if(lT(p,m,g,_)|0)return U=0,Q=N,U|0;h[E>>2]=h[g>>2],h[E+4>>2]=b,v=h[M>>2]|0;e:do if((v|0)>0)for(p=p+12|0,b=0,x=v;;){if(v=h[p>>2]|0,(h[v+(b<<3)>>2]|0)>0){if(Zx(E,_,h[v+(b<<3)+4>>2]|0)|0){v=0;break e}if(v=b+1|0,lT((h[p>>2]|0)+(b<<3)|0,m+(v<<5)|0,g,_)|0){v=0;break e}x=h[M>>2]|0}else v=b+1|0;if((v|0)<(x|0))b=v;else{v=1;break}}else v=1;while(!1);return U=v,Q=N,U|0}function lT(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0,be=0;if(Ke=Q,Q=Q+176|0,se=Ke+172|0,v=Ke+168|0,we=Ke,!(iL(m,_)|0))return p=0,Q=Ke,p|0;if(zce(m,_,se,v),hu(we|0,g|0,168)|0,(h[g>>2]|0)>0){m=0;do Me=we+8+(m<<4)+8|0,xe=+kl(+ie[Me>>3],h[v>>2]|0),ie[Me>>3]=xe,m=m+1|0;while((m|0)<(h[g>>2]|0))}ae=+ie[_>>3],ue=+ie[_+8>>3],xe=+kl(+ie[_+16>>3],h[v>>2]|0),X=+kl(+ie[_+24>>3],h[v>>2]|0);e:do if((h[p>>2]|0)>0){if(_=p+4|0,v=h[we>>2]|0,(v|0)<=0){for(m=0;;)if(m=m+1|0,(m|0)>=(h[p>>2]|0)){m=0;break e}}for(g=0;;){if(m=h[_>>2]|0,j=+ie[m+(g<<4)>>3],K=+kl(+ie[m+(g<<4)+8>>3],h[se>>2]|0),m=h[_>>2]|0,g=g+1|0,Me=(g|0)%(h[p>>2]|0)|0,x=+ie[m+(Me<<4)>>3],b=+kl(+ie[m+(Me<<4)+8>>3],h[se>>2]|0),!(j>=ae)|!(x>=ae)&&!(j<=ue)|!(x<=ue)&&!(K<=X)|!(b<=X)&&!(K>=xe)|!(b>=xe)){q=x-j,N=b-K,m=0;do if(be=m,m=m+1|0,Me=(m|0)==(v|0)?0:m,x=+ie[we+8+(be<<4)+8>>3],b=+ie[we+8+(Me<<4)+8>>3]-x,E=+ie[we+8+(be<<4)>>3],M=+ie[we+8+(Me<<4)>>3]-E,U=q*b-N*M,U!=0&&(Ae=K-x,Be=j-E,M=(Ae*M-b*Be)/U,!(M<0|M>1))&&(U=(q*Ae-N*Be)/U,U>=0&U<=1)){m=1;break e}while((m|0)<(v|0))}if((g|0)>=(h[p>>2]|0)){m=0;break}}}else m=0;while(!1);return be=m,Q=Ke,be|0}function fq(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0;if(lT(p,m,g,_)|0)return x=1,x|0;if(x=p+8|0,(h[x>>2]|0)<=0)return x=0,x|0;for(v=p+12|0,p=0;;){if(b=p,p=p+1|0,lT((h[v>>2]|0)+(b<<3)|0,m+(p<<5)|0,g,_)|0){p=1,v=6;break}if((p|0)>=(h[x>>2]|0)){p=0,v=6;break}}return(v|0)==6?p|0:0}function Lue(){return 8}function Due(){return 16}function Nue(){return 168}function Fue(){return 8}function Bue(){return 16}function Oue(){return 12}function Uue(){return 8}function kue(p){return p=p|0,+(+((h[p>>2]|0)>>>0)+4294967296*+(h[p+4>>2]|0))}function zue(p){p=p|0;var m=0,g=0;return g=+ie[p>>3],m=+ie[p+8>>3],+ +bs(+(g*g+m*m))}function dq(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0;N=+ie[p>>3],M=+ie[m>>3]-N,E=+ie[p+8>>3],b=+ie[m+8>>3]-E,q=+ie[g>>3],x=+ie[_>>3]-q,j=+ie[g+8>>3],U=+ie[_+8>>3]-j,x=(x*(E-j)-(N-q)*U)/(M*U-b*x),ie[v>>3]=N+M*x,ie[v+8>>3]=E+b*x}function pq(p,m){return p=p|0,m=m|0,+Qs(+(+ie[p>>3]-+ie[m>>3]))<11920928955078125e-23?(m=+Qs(+(+ie[p+8>>3]-+ie[m+8>>3]))<11920928955078125e-23,m|0):(m=0,m|0)}function Vue(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0;if(x=Q,Q=Q+16|0,v=x,_=Zi(p,m)|0,(g+-1|0)>>>0>5||(_=(_|0)!=0,(g|0)==1&_))return v=-1,Q=x,v|0;do if(Qx(p,m,v)|0)_=-1;else if(_){_=((h[26416+(g<<2)>>2]|0)+5-(h[v>>2]|0)|0)%5|0;break}else{_=((h[26448+(g<<2)>>2]|0)+6-(h[v>>2]|0)|0)%6|0;break}while(!1);return v=_,Q=x,v|0}function Qx(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0;if(U=Q,Q=Q+32|0,E=U+16|0,M=U,_=S1(p,m,E)|0,_|0)return g=_,Q=U,g|0;x=tq(p,m)|0,N=al(p,m)|0,Dce(x,M),_=Nce(x,h[E>>2]|0)|0;do if(yr(x)|0){do switch(x|0){case 4:{v=0;break}case 14:{v=1;break}case 24:{v=2;break}case 38:{v=3;break}case 49:{v=4;break}case 58:{v=5;break}case 63:{v=6;break}case 72:{v=7;break}case 83:{v=8;break}case 97:{v=9;break}case 107:{v=10;break}case 117:{v=11;break}default:di(27634,27636,75,27645)}while(!1);if(b=h[26480+(v*24|0)+8>>2]|0,m=h[26480+(v*24|0)+16>>2]|0,p=h[E>>2]|0,(p|0)!=(h[M>>2]|0)&&(M=eL(x)|0,p=h[E>>2]|0,M|(p|0)==(m|0)&&(_=(_+1|0)%6|0)),(N|0)==3&(p|0)==(m|0)){_=(_+5|0)%6|0;break}(N|0)==5&(p|0)==(b|0)&&(_=(_+1|0)%6|0)}while(!1);return h[g>>2]=_,g=0,Q=U,g|0}function xc(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0;if(we=Q,Q=Q+32|0,se=we+24|0,ue=we+20|0,K=we+8|0,X=we+16|0,j=we,M=(Zi(p,m)|0)==0,M=M?6:5,U=tt(p|0,m|0,52)|0,ee()|0,U=U&15,M>>>0<=g>>>0)return _=2,Q=we,_|0;q=(U|0)==0,!q&&(ae=ft(7,0,(U^15)*3|0)|0,(ae&p|0)==0&((ee()|0)&m|0)==0)?v=g:x=4;e:do if((x|0)==4){if(v=(Zi(p,m)|0)!=0,((v?4:5)|0)<(g|0)||Qx(p,m,se)|0||(x=(h[se>>2]|0)+g|0,v?v=26768+(((x|0)%5|0)<<2)|0:v=26800+(((x|0)%6|0)<<2)|0,ae=h[v>>2]|0,(ae|0)==7))return _=1,Q=we,_|0;h[ue>>2]=0,v=Js(p,m,ae,ue,K)|0;do if(!v){if(E=K,N=h[E>>2]|0,E=h[E+4>>2]|0,b=E>>>0<m>>>0|(E|0)==(m|0)&N>>>0<p>>>0,x=b?N:p,b=b?E:m,!q&&(q=ft(7,0,(U^15)*3|0)|0,(N&q|0)==0&(E&(ee()|0)|0)==0))v=g;else{if(E=(g+-1+M|0)%(M|0)|0,v=Zi(p,m)|0,(E|0)<0&&di(27634,27636,248,27661),M=(v|0)!=0,((M?4:5)|0)<(E|0)&&di(27634,27636,248,27661),Qx(p,m,se)|0&&di(27634,27636,248,27661),v=(h[se>>2]|0)+E|0,M?v=26768+(((v|0)%5|0)<<2)|0:v=26800+(((v|0)%6|0)<<2)|0,E=h[v>>2]|0,(E|0)==7&&di(27634,27636,248,27661),h[X>>2]=0,v=Js(p,m,E,X,j)|0,v|0)break;N=j,M=h[N>>2]|0,N=h[N+4>>2]|0;do if(N>>>0<b>>>0|(N|0)==(b|0)&M>>>0<x>>>0){if(Zi(M,N)|0?x=iT(M,N,p,m)|0:x=h[26864+((((h[X>>2]|0)+(h[26832+(E<<2)>>2]|0)|0)%6|0)<<2)>>2]|0,v=Zi(M,N)|0,(x+-1|0)>>>0>5){v=-1,x=M,b=N;break}if(v=(v|0)!=0,(x|0)==1&v){v=-1,x=M,b=N;break}do if(Qx(M,N,se)|0)v=-1;else if(v){v=((h[26416+(x<<2)>>2]|0)+5-(h[se>>2]|0)|0)%5|0;break}else{v=((h[26448+(x<<2)>>2]|0)+6-(h[se>>2]|0)|0)%6|0;break}while(!1);x=M,b=N}else v=g;while(!1);E=K,N=h[E>>2]|0,E=h[E+4>>2]|0}if((x|0)==(N|0)&(b|0)==(E|0)){if(M=(Zi(N,E)|0)!=0,M?p=iT(N,E,p,m)|0:p=h[26864+((((h[ue>>2]|0)+(h[26832+(ae<<2)>>2]|0)|0)%6|0)<<2)>>2]|0,v=Zi(N,E)|0,(p+-1|0)>>>0<=5&&(xe=(v|0)!=0,!((p|0)==1&xe)))do if(Qx(N,E,se)|0)v=-1;else if(xe){v=((h[26416+(p<<2)>>2]|0)+5-(h[se>>2]|0)|0)%5|0;break}else{v=((h[26448+(p<<2)>>2]|0)+6-(h[se>>2]|0)|0)%6|0;break}while(!1);else v=-1;v=v+1|0,v=(v|0)==6|M&(v|0)==5?0:v}m=b,p=x;break e}while(!1);return _=v,Q=we,_|0}while(!1);return xe=ft(v|0,0,56)|0,se=ee()|0|m&-2130706433|536870912,h[_>>2]=xe|p,h[_+4>>2]=se,_=0,Q=we,_|0}function Gue(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0;return x=(Zi(p,m)|0)==0,_=xc(p,m,0,g)|0,v=(_|0)==0,x?!v||(_=xc(p,m,1,g+8|0)|0,_|0)||(_=xc(p,m,2,g+16|0)|0,_|0)||(_=xc(p,m,3,g+24|0)|0,_|0)||(_=xc(p,m,4,g+32|0)|0,_)?(x=_,x|0):xc(p,m,5,g+40|0)|0:!v||(_=xc(p,m,1,g+8|0)|0,_|0)||(_=xc(p,m,2,g+16|0)|0,_|0)||(_=xc(p,m,3,g+24|0)|0,_|0)||(_=xc(p,m,4,g+32|0)|0,_|0)?(x=_,x|0):(x=g+40|0,h[x>>2]=0,h[x+4>>2]=0,x=0,x|0)}function que(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0;return M=Q,Q=Q+192|0,v=M,x=M+168|0,b=tt(p|0,m|0,56)|0,ee()|0,b=b&7,E=m&-2130706433|134217728,_=S1(p,E,x)|0,_|0?(E=_,Q=M,E|0):(m=tt(p|0,m|0,52)|0,ee()|0,m=m&15,Zi(p,E)|0?sL(x,m,b,1,v):oL(x,m,b,1,v),E=v+8|0,h[g>>2]=h[E>>2],h[g+4>>2]=h[E+4>>2],h[g+8>>2]=h[E+8>>2],h[g+12>>2]=h[E+12>>2],E=0,Q=M,E|0)}function mq(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0;return v=Q,Q=Q+16|0,g=v,!(!0&(m&2013265920|0)==536870912)||(_=m&-2130706433|134217728,!(sT(p,_)|0))?(_=0,Q=v,_|0):(x=tt(p|0,m|0,56)|0,ee()|0,x=(xc(p,_,x&7,g)|0)==0,_=g,_=x&((h[_>>2]|0)==(p|0)?(h[_+4>>2]|0)==(m|0):0)&1,Q=v,_|0)}function Aq(){return 27680}function cT(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0;q=Q,Q=Q+208|0,M=q,N=q+192|0,b=ol(g,m)|0,E=N,h[E>>2]=1,h[E+4>>2]=0;e:do if(b|0){for(E=0-g|0,h[M+4>>2]=g,h[M>>2]=g,v=2,m=g,x=g;m=m+g+x|0,h[M+(v<<2)>>2]=m,m>>>0<b>>>0;)j=x,v=v+1|0,x=m,m=j;if(x=p+b+E|0,x>>>0>p>>>0){b=x,v=1,m=1;do{do if((m&3|0)!=3)if(m=v+-1|0,(h[M+(m<<2)>>2]|0)>>>0<(b-p|0)>>>0?yL(p,g,_,v,M):hT(p,g,_,N,v,0,M),(v|0)==1){fT(N,1),v=0;break}else{fT(N,m),v=1;break}else yL(p,g,_,v,M),uT(N,2),v=v+2|0;while(!1);m=h[N>>2]|1,h[N>>2]=m,p=p+g|0}while(p>>>0<x>>>0)}else v=1,m=1;for(hT(p,g,_,N,v,0,M),x=N+4|0;;){if((v|0)==1&(m|0)==1)if(h[x>>2]|0)U=19;else break e;else(v|0)<2?U=19:(fT(N,2),j=v+-2|0,h[N>>2]=h[N>>2]^7,uT(N,1),hT(p+(0-(h[M+(j<<2)>>2]|0))+E|0,g,_,N,v+-1|0,1,M),fT(N,1),m=h[N>>2]|1,h[N>>2]=m,p=p+E|0,hT(p,g,_,N,j,1,M),v=j);(U|0)==19&&(U=0,m=gq(N)|0,uT(N,m),p=p+E|0,v=m+v|0,m=h[N>>2]|0)}}while(!1);Q=q}function yL(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0;q=Q,Q=Q+240|0,U=q,h[U>>2]=p;e:do if((_|0)>1)for(N=0-m|0,E=p,x=_,_=1,b=p;;){if(E=E+N|0,M=x+-2|0,p=E+(0-(h[v+(M<<2)>>2]|0))|0,(fp[g&3](b,p)|0)>-1&&(fp[g&3](b,E)|0)>-1||(b=U+(_<<2)|0,(fp[g&3](p,E)|0)>-1?(h[b>>2]=p,x=x+-1|0):(h[b>>2]=E,p=E,x=M),_=_+1|0,(x|0)<=1))break e;E=p,b=h[U>>2]|0}else _=1;while(!1);_q(m,U,_),Q=q}function uT(p,m){p=p|0,m=m|0;var g=0,_=0,v=0;v=p+4|0,m>>>0>31?(_=h[v>>2]|0,h[p>>2]=_,h[v>>2]=0,m=m+-32|0,g=0):(g=h[v>>2]|0,_=h[p>>2]|0),h[p>>2]=g<<32-m|_>>>m,h[v>>2]=g>>>m}function hT(p,m,g,_,v,x,b){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0,x=x|0,b=b|0;var E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0;X=Q,Q=Q+240|0,q=X+232|0,j=X,K=h[_>>2]|0,h[q>>2]=K,M=h[_+4>>2]|0,N=q+4|0,h[N>>2]=M,h[j>>2]=p;e:do if((K|0)!=1|(M|0)!=0&&(U=0-m|0,E=p+(0-(h[b+(v<<2)>>2]|0))|0,(fp[g&3](E,p)|0)>=1))for(_=1,x=(x|0)==0,M=E;;){if(x&(v|0)>1){if(x=p+U|0,E=h[b+(v+-2<<2)>>2]|0,(fp[g&3](x,M)|0)>-1){E=10;break e}if((fp[g&3](x+(0-E)|0,M)|0)>-1){E=10;break e}}if(x=_+1|0,h[j+(_<<2)>>2]=M,K=gq(q)|0,uT(q,K),v=K+v|0,!((h[q>>2]|0)!=1|(h[N>>2]|0)!=0)){_=x,p=M,E=10;break e}if(p=M+(0-(h[b+(v<<2)>>2]|0))|0,(fp[g&3](p,h[j>>2]|0)|0)<1){p=M,_=x,x=0,E=9;break}else K=M,_=x,x=1,M=p,p=K}else _=1,E=9;while(!1);(E|0)==9&&(x|0)==0&&(E=10),(E|0)==10&&(_q(m,j,_),yL(p,m,g,v,b)),Q=X}function fT(p,m){p=p|0,m=m|0;var g=0,_=0,v=0;v=p+4|0,m>>>0>31?(_=h[p>>2]|0,h[v>>2]=_,h[p>>2]=0,m=m+-32|0,g=0):(g=h[p>>2]|0,_=h[v>>2]|0),h[v>>2]=g>>>(32-m|0)|_<<m,h[p>>2]=g<<m}function gq(p){p=p|0;var m=0;return m=vq((h[p>>2]|0)+-1|0)|0,m?m|0:(m=vq(h[p+4>>2]|0)|0,((m|0)==0?0:m+32|0)|0)}function vq(p){p=p|0;var m=0;if(p)if(p&1)p=0;else for(m=p,p=0;p=p+1|0,!(m&2);)m=m>>>1;else p=32;return p|0}function _q(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0;b=Q,Q=Q+256|0,_=b;e:do if((g|0)>=2&&(x=m+(g<<2)|0,h[x>>2]=_,p|0))for(;;){v=p>>>0<256?p:256,hu(_|0,h[m>>2]|0,v|0)|0,_=0;do E=m+(_<<2)|0,_=_+1|0,hu(h[E>>2]|0,h[m+(_<<2)>>2]|0,v|0)|0,h[E>>2]=(h[E>>2]|0)+v;while((_|0)!=(g|0));if(p=p-v|0,!p)break e;_=h[x>>2]|0}while(!1);Q=b}function rh(p){return p=+p,~~+Sq(+p)|0}function br(p){p=p|0;var m=0,g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0;Be=Q,Q=Q+16|0,j=Be;do if(p>>>0<245){if(N=p>>>0<11?16:p+11&-8,p=N>>>3,q=h[6921]|0,g=q>>>p,g&3|0)return m=(g&1^1)+p|0,p=27724+(m<<1<<2)|0,g=p+8|0,_=h[g>>2]|0,v=_+8|0,x=h[v>>2]|0,(x|0)==(p|0)?h[6921]=q&~(1<<m):(h[x+12>>2]=p,h[g>>2]=x),Ae=m<<3,h[_+4>>2]=Ae|3,Ae=_+Ae+4|0,h[Ae>>2]=h[Ae>>2]|1,Ae=v,Q=Be,Ae|0;if(U=h[6923]|0,N>>>0>U>>>0){if(g|0)return m=2<<p,m=g<<p&(m|0-m),m=(m&0-m)+-1|0,E=m>>>12&16,m=m>>>E,g=m>>>5&8,m=m>>>g,x=m>>>2&4,m=m>>>x,p=m>>>1&2,m=m>>>p,_=m>>>1&1,_=(g|E|x|p|_)+(m>>>_)|0,m=27724+(_<<1<<2)|0,p=m+8|0,x=h[p>>2]|0,E=x+8|0,g=h[E>>2]|0,(g|0)==(m|0)?(p=q&~(1<<_),h[6921]=p):(h[g+12>>2]=m,h[p>>2]=g,p=q),Ae=_<<3,b=Ae-N|0,h[x+4>>2]=N|3,v=x+N|0,h[v+4>>2]=b|1,h[x+Ae>>2]=b,U|0&&(_=h[6926]|0,m=U>>>3,g=27724+(m<<1<<2)|0,m=1<<m,p&m?(p=g+8|0,m=h[p>>2]|0):(h[6921]=p|m,m=g,p=g+8|0),h[p>>2]=_,h[m+12>>2]=_,h[_+8>>2]=m,h[_+12>>2]=g),h[6923]=b,h[6926]=v,Ae=E,Q=Be,Ae|0;if(x=h[6922]|0,x){for(g=(x&0-x)+-1|0,v=g>>>12&16,g=g>>>v,_=g>>>5&8,g=g>>>_,b=g>>>2&4,g=g>>>b,E=g>>>1&2,g=g>>>E,M=g>>>1&1,M=h[27988+((_|v|b|E|M)+(g>>>M)<<2)>>2]|0,g=M,E=M,M=(h[M+4>>2]&-8)-N|0;p=h[g+16>>2]|0,!(!p&&(p=h[g+20>>2]|0,!p));)b=(h[p+4>>2]&-8)-N|0,v=b>>>0<M>>>0,g=p,E=v?p:E,M=v?b:M;if(b=E+N|0,b>>>0>E>>>0){v=h[E+24>>2]|0,m=h[E+12>>2]|0;do if((m|0)==(E|0)){if(p=E+20|0,m=h[p>>2]|0,!m&&(p=E+16|0,m=h[p>>2]|0,!m)){g=0;break}for(;;)if(_=m+20|0,g=h[_>>2]|0,g)m=g,p=_;else if(_=m+16|0,g=h[_>>2]|0,g)m=g,p=_;else break;h[p>>2]=0,g=m}else g=h[E+8>>2]|0,h[g+12>>2]=m,h[m+8>>2]=g,g=m;while(!1);do if(v|0){if(m=h[E+28>>2]|0,p=27988+(m<<2)|0,(E|0)==(h[p>>2]|0)){if(h[p>>2]=g,!g){h[6922]=x&~(1<<m);break}}else if(Ae=v+16|0,h[((h[Ae>>2]|0)==(E|0)?Ae:v+20|0)>>2]=g,!g)break;h[g+24>>2]=v,m=h[E+16>>2]|0,m|0&&(h[g+16>>2]=m,h[m+24>>2]=g),m=h[E+20>>2]|0,m|0&&(h[g+20>>2]=m,h[m+24>>2]=g)}while(!1);return M>>>0<16?(Ae=M+N|0,h[E+4>>2]=Ae|3,Ae=E+Ae+4|0,h[Ae>>2]=h[Ae>>2]|1):(h[E+4>>2]=N|3,h[b+4>>2]=M|1,h[b+M>>2]=M,U|0&&(_=h[6926]|0,m=U>>>3,g=27724+(m<<1<<2)|0,m=1<<m,m&q?(p=g+8|0,m=h[p>>2]|0):(h[6921]=m|q,m=g,p=g+8|0),h[p>>2]=_,h[m+12>>2]=_,h[_+8>>2]=m,h[_+12>>2]=g),h[6923]=M,h[6926]=b),Ae=E+8|0,Q=Be,Ae|0}else q=N}else q=N}else q=N}else if(p>>>0<=4294967231)if(p=p+11|0,N=p&-8,_=h[6922]|0,_){v=0-N|0,p=p>>>8,p?N>>>0>16777215?M=31:(q=(p+1048320|0)>>>16&8,ae=p<<q,E=(ae+520192|0)>>>16&4,ae=ae<<E,M=(ae+245760|0)>>>16&2,M=14-(E|q|M)+(ae<<M>>>15)|0,M=N>>>(M+7|0)&1|M<<1):M=0,g=h[27988+(M<<2)>>2]|0;e:do if(!g)g=0,p=0,ae=61;else for(p=0,E=N<<((M|0)==31?0:25-(M>>>1)|0),x=0;;){if(b=(h[g+4>>2]&-8)-N|0,b>>>0<v>>>0)if(b)p=g,v=b;else{p=g,v=0,ae=65;break e}if(ae=h[g+20>>2]|0,g=h[g+16+(E>>>31<<2)>>2]|0,x=(ae|0)==0|(ae|0)==(g|0)?x:ae,g)E=E<<1;else{g=x,ae=61;break}}while(!1);if((ae|0)==61){if((g|0)==0&(p|0)==0){if(p=2<<M,p=(p|0-p)&_,!p){q=N;break}q=(p&0-p)+-1|0,b=q>>>12&16,q=q>>>b,x=q>>>5&8,q=q>>>x,E=q>>>2&4,q=q>>>E,M=q>>>1&2,q=q>>>M,g=q>>>1&1,p=0,g=h[27988+((x|b|E|M|g)+(q>>>g)<<2)>>2]|0}g?ae=65:(E=p,b=v)}if((ae|0)==65)for(x=g;;)if(q=(h[x+4>>2]&-8)-N|0,g=q>>>0<v>>>0,v=g?q:v,p=g?x:p,g=h[x+16>>2]|0,g||(g=h[x+20>>2]|0),g)x=g;else{E=p,b=v;break}if((E|0)!=0&&b>>>0<((h[6923]|0)-N|0)>>>0&&(U=E+N|0,U>>>0>E>>>0)){x=h[E+24>>2]|0,m=h[E+12>>2]|0;do if((m|0)==(E|0)){if(p=E+20|0,m=h[p>>2]|0,!m&&(p=E+16|0,m=h[p>>2]|0,!m)){m=0;break}for(;;)if(v=m+20|0,g=h[v>>2]|0,g)m=g,p=v;else if(v=m+16|0,g=h[v>>2]|0,g)m=g,p=v;else break;h[p>>2]=0}else Ae=h[E+8>>2]|0,h[Ae+12>>2]=m,h[m+8>>2]=Ae;while(!1);do if(x){if(p=h[E+28>>2]|0,g=27988+(p<<2)|0,(E|0)==(h[g>>2]|0)){if(h[g>>2]=m,!m){_=_&~(1<<p),h[6922]=_;break}}else if(Ae=x+16|0,h[((h[Ae>>2]|0)==(E|0)?Ae:x+20|0)>>2]=m,!m)break;h[m+24>>2]=x,p=h[E+16>>2]|0,p|0&&(h[m+16>>2]=p,h[p+24>>2]=m),p=h[E+20>>2]|0,p&&(h[m+20>>2]=p,h[p+24>>2]=m)}while(!1);e:do if(b>>>0<16)Ae=b+N|0,h[E+4>>2]=Ae|3,Ae=E+Ae+4|0,h[Ae>>2]=h[Ae>>2]|1;else{if(h[E+4>>2]=N|3,h[U+4>>2]=b|1,h[U+b>>2]=b,m=b>>>3,b>>>0<256){g=27724+(m<<1<<2)|0,p=h[6921]|0,m=1<<m,p&m?(p=g+8|0,m=h[p>>2]|0):(h[6921]=p|m,m=g,p=g+8|0),h[p>>2]=U,h[m+12>>2]=U,h[U+8>>2]=m,h[U+12>>2]=g;break}if(m=b>>>8,m?b>>>0>16777215?g=31:(we=(m+1048320|0)>>>16&8,Ae=m<<we,se=(Ae+520192|0)>>>16&4,Ae=Ae<<se,g=(Ae+245760|0)>>>16&2,g=14-(se|we|g)+(Ae<<g>>>15)|0,g=b>>>(g+7|0)&1|g<<1):g=0,m=27988+(g<<2)|0,h[U+28>>2]=g,p=U+16|0,h[p+4>>2]=0,h[p>>2]=0,p=1<<g,!(_&p)){h[6922]=_|p,h[m>>2]=U,h[U+24>>2]=m,h[U+12>>2]=U,h[U+8>>2]=U;break}m=h[m>>2]|0;t:do if((h[m+4>>2]&-8|0)!=(b|0)){for(_=b<<((g|0)==31?0:25-(g>>>1)|0);g=m+16+(_>>>31<<2)|0,p=h[g>>2]|0,!!p;)if((h[p+4>>2]&-8|0)==(b|0)){m=p;break t}else _=_<<1,m=p;h[g>>2]=U,h[U+24>>2]=m,h[U+12>>2]=U,h[U+8>>2]=U;break e}while(!1);we=m+8|0,Ae=h[we>>2]|0,h[Ae+12>>2]=U,h[we>>2]=U,h[U+8>>2]=Ae,h[U+12>>2]=m,h[U+24>>2]=0}while(!1);return Ae=E+8|0,Q=Be,Ae|0}else q=N}else q=N;else q=-1;while(!1);if(g=h[6923]|0,g>>>0>=q>>>0)return m=g-q|0,p=h[6926]|0,m>>>0>15?(Ae=p+q|0,h[6926]=Ae,h[6923]=m,h[Ae+4>>2]=m|1,h[p+g>>2]=m,h[p+4>>2]=q|3):(h[6923]=0,h[6926]=0,h[p+4>>2]=g|3,Ae=p+g+4|0,h[Ae>>2]=h[Ae>>2]|1),Ae=p+8|0,Q=Be,Ae|0;if(b=h[6924]|0,b>>>0>q>>>0)return se=b-q|0,h[6924]=se,Ae=h[6927]|0,we=Ae+q|0,h[6927]=we,h[we+4>>2]=se|1,h[Ae+4>>2]=q|3,Ae=Ae+8|0,Q=Be,Ae|0;if(h[7039]|0?p=h[7041]|0:(h[7041]=4096,h[7040]=4096,h[7042]=-1,h[7043]=-1,h[7044]=0,h[7032]=0,h[7039]=j&-16^1431655768,p=4096),E=q+48|0,M=q+47|0,x=p+M|0,v=0-p|0,N=x&v,N>>>0<=q>>>0||(p=h[7031]|0,p|0&&(U=h[7029]|0,j=U+N|0,j>>>0<=U>>>0|j>>>0>p>>>0)))return Ae=0,Q=Be,Ae|0;e:do if(h[7032]&4)m=0,ae=143;else{g=h[6927]|0;t:do if(g){for(_=28132;j=h[_>>2]|0,!(j>>>0<=g>>>0&&(j+(h[_+4>>2]|0)|0)>>>0>g>>>0);)if(p=h[_+8>>2]|0,p)_=p;else{ae=128;break t}if(m=x-b&v,m>>>0<2147483647)if(p=hp(m|0)|0,(p|0)==((h[_>>2]|0)+(h[_+4>>2]|0)|0)){if((p|0)!=-1){b=m,x=p,ae=145;break e}}else _=p,ae=136;else m=0}else ae=128;while(!1);do if((ae|0)==128)if(g=hp(0)|0,(g|0)!=-1&&(m=g,X=h[7040]|0,K=X+-1|0,m=((K&m|0)==0?0:(K+m&0-X)-m|0)+N|0,X=h[7029]|0,K=m+X|0,m>>>0>q>>>0&m>>>0<2147483647)){if(j=h[7031]|0,j|0&&K>>>0<=X>>>0|K>>>0>j>>>0){m=0;break}if(p=hp(m|0)|0,(p|0)==(g|0)){b=m,x=g,ae=145;break e}else _=p,ae=136}else m=0;while(!1);do if((ae|0)==136){if(g=0-m|0,!(E>>>0>m>>>0&(m>>>0<2147483647&(_|0)!=-1)))if((_|0)==-1){m=0;break}else{b=m,x=_,ae=145;break e}if(p=h[7041]|0,p=M-m+p&0-p,p>>>0>=2147483647){b=m,x=_,ae=145;break e}if((hp(p|0)|0)==-1){hp(g|0)|0,m=0;break}else{b=p+m|0,x=_,ae=145;break e}}while(!1);h[7032]=h[7032]|4,ae=143}while(!1);if((ae|0)==143&&N>>>0<2147483647&&(se=hp(N|0)|0,K=hp(0)|0,ue=K-se|0,xe=ue>>>0>(q+40|0)>>>0,!((se|0)==-1|xe^1|se>>>0<K>>>0&((se|0)!=-1&(K|0)!=-1)^1))&&(b=xe?ue:m,x=se,ae=145),(ae|0)==145){m=(h[7029]|0)+b|0,h[7029]=m,m>>>0>(h[7030]|0)>>>0&&(h[7030]=m),M=h[6927]|0;e:do if(M){for(m=28132;;){if(p=h[m>>2]|0,g=h[m+4>>2]|0,(x|0)==(p+g|0)){ae=154;break}if(_=h[m+8>>2]|0,_)m=_;else break}if((ae|0)==154&&(we=m+4|0,(h[m+12>>2]&8|0)==0)&&x>>>0>M>>>0&p>>>0<=M>>>0){h[we>>2]=g+b,Ae=(h[6924]|0)+b|0,se=M+8|0,se=(se&7|0)==0?0:0-se&7,we=M+se|0,se=Ae-se|0,h[6927]=we,h[6924]=se,h[we+4>>2]=se|1,h[M+Ae+4>>2]=40,h[6928]=h[7043];break}for(x>>>0<(h[6925]|0)>>>0&&(h[6925]=x),g=x+b|0,m=28132;;){if((h[m>>2]|0)==(g|0)){ae=162;break}if(p=h[m+8>>2]|0,p)m=p;else break}if((ae|0)==162&&(h[m+12>>2]&8|0)==0){h[m>>2]=x,U=m+4|0,h[U>>2]=(h[U>>2]|0)+b,U=x+8|0,U=x+((U&7|0)==0?0:0-U&7)|0,m=g+8|0,m=g+((m&7|0)==0?0:0-m&7)|0,N=U+q|0,E=m-U-q|0,h[U+4>>2]=q|3;t:do if((M|0)==(m|0))Ae=(h[6924]|0)+E|0,h[6924]=Ae,h[6927]=N,h[N+4>>2]=Ae|1;else{if((h[6926]|0)==(m|0)){Ae=(h[6923]|0)+E|0,h[6923]=Ae,h[6926]=N,h[N+4>>2]=Ae|1,h[N+Ae>>2]=Ae;break}if(p=h[m+4>>2]|0,(p&3|0)==1){b=p&-8,_=p>>>3;n:do if(p>>>0<256)if(p=h[m+8>>2]|0,g=h[m+12>>2]|0,(g|0)==(p|0)){h[6921]=h[6921]&~(1<<_);break}else{h[p+12>>2]=g,h[g+8>>2]=p;break}else{x=h[m+24>>2]|0,p=h[m+12>>2]|0;do if((p|0)==(m|0)){if(g=m+16|0,_=g+4|0,p=h[_>>2]|0,p)g=_;else if(p=h[g>>2]|0,!p){p=0;break}for(;;)if(v=p+20|0,_=h[v>>2]|0,_)p=_,g=v;else if(v=p+16|0,_=h[v>>2]|0,_)p=_,g=v;else break;h[g>>2]=0}else Ae=h[m+8>>2]|0,h[Ae+12>>2]=p,h[p+8>>2]=Ae;while(!1);if(!x)break;g=h[m+28>>2]|0,_=27988+(g<<2)|0;do if((h[_>>2]|0)!=(m|0)){if(Ae=x+16|0,h[((h[Ae>>2]|0)==(m|0)?Ae:x+20|0)>>2]=p,!p)break n}else{if(h[_>>2]=p,p|0)break;h[6922]=h[6922]&~(1<<g);break n}while(!1);if(h[p+24>>2]=x,g=m+16|0,_=h[g>>2]|0,_|0&&(h[p+16>>2]=_,h[_+24>>2]=p),g=h[g+4>>2]|0,!g)break;h[p+20>>2]=g,h[g+24>>2]=p}while(!1);m=m+b|0,v=b+E|0}else v=E;if(m=m+4|0,h[m>>2]=h[m>>2]&-2,h[N+4>>2]=v|1,h[N+v>>2]=v,m=v>>>3,v>>>0<256){g=27724+(m<<1<<2)|0,p=h[6921]|0,m=1<<m,p&m?(p=g+8|0,m=h[p>>2]|0):(h[6921]=p|m,m=g,p=g+8|0),h[p>>2]=N,h[m+12>>2]=N,h[N+8>>2]=m,h[N+12>>2]=g;break}m=v>>>8;do if(!m)_=0;else{if(v>>>0>16777215){_=31;break}we=(m+1048320|0)>>>16&8,Ae=m<<we,se=(Ae+520192|0)>>>16&4,Ae=Ae<<se,_=(Ae+245760|0)>>>16&2,_=14-(se|we|_)+(Ae<<_>>>15)|0,_=v>>>(_+7|0)&1|_<<1}while(!1);if(m=27988+(_<<2)|0,h[N+28>>2]=_,p=N+16|0,h[p+4>>2]=0,h[p>>2]=0,p=h[6922]|0,g=1<<_,!(p&g)){h[6922]=p|g,h[m>>2]=N,h[N+24>>2]=m,h[N+12>>2]=N,h[N+8>>2]=N;break}m=h[m>>2]|0;n:do if((h[m+4>>2]&-8|0)!=(v|0)){for(_=v<<((_|0)==31?0:25-(_>>>1)|0);g=m+16+(_>>>31<<2)|0,p=h[g>>2]|0,!!p;)if((h[p+4>>2]&-8|0)==(v|0)){m=p;break n}else _=_<<1,m=p;h[g>>2]=N,h[N+24>>2]=m,h[N+12>>2]=N,h[N+8>>2]=N;break t}while(!1);we=m+8|0,Ae=h[we>>2]|0,h[Ae+12>>2]=N,h[we>>2]=N,h[N+8>>2]=Ae,h[N+12>>2]=m,h[N+24>>2]=0}while(!1);return Ae=U+8|0,Q=Be,Ae|0}for(m=28132;p=h[m>>2]|0,!(p>>>0<=M>>>0&&(Ae=p+(h[m+4>>2]|0)|0,Ae>>>0>M>>>0));)m=h[m+8>>2]|0;v=Ae+-47|0,p=v+8|0,p=v+((p&7|0)==0?0:0-p&7)|0,v=M+16|0,p=p>>>0<v>>>0?M:p,m=p+8|0,g=b+-40|0,se=x+8|0,se=(se&7|0)==0?0:0-se&7,we=x+se|0,se=g-se|0,h[6927]=we,h[6924]=se,h[we+4>>2]=se|1,h[x+g+4>>2]=40,h[6928]=h[7043],g=p+4|0,h[g>>2]=27,h[m>>2]=h[7033],h[m+4>>2]=h[7034],h[m+8>>2]=h[7035],h[m+12>>2]=h[7036],h[7033]=x,h[7034]=b,h[7036]=0,h[7035]=m,m=p+24|0;do we=m,m=m+4|0,h[m>>2]=7;while((we+8|0)>>>0<Ae>>>0);if((p|0)!=(M|0)){if(x=p-M|0,h[g>>2]=h[g>>2]&-2,h[M+4>>2]=x|1,h[p>>2]=x,m=x>>>3,x>>>0<256){g=27724+(m<<1<<2)|0,p=h[6921]|0,m=1<<m,p&m?(p=g+8|0,m=h[p>>2]|0):(h[6921]=p|m,m=g,p=g+8|0),h[p>>2]=M,h[m+12>>2]=M,h[M+8>>2]=m,h[M+12>>2]=g;break}if(m=x>>>8,m?x>>>0>16777215?_=31:(we=(m+1048320|0)>>>16&8,Ae=m<<we,se=(Ae+520192|0)>>>16&4,Ae=Ae<<se,_=(Ae+245760|0)>>>16&2,_=14-(se|we|_)+(Ae<<_>>>15)|0,_=x>>>(_+7|0)&1|_<<1):_=0,g=27988+(_<<2)|0,h[M+28>>2]=_,h[M+20>>2]=0,h[v>>2]=0,m=h[6922]|0,p=1<<_,!(m&p)){h[6922]=m|p,h[g>>2]=M,h[M+24>>2]=g,h[M+12>>2]=M,h[M+8>>2]=M;break}m=h[g>>2]|0;t:do if((h[m+4>>2]&-8|0)!=(x|0)){for(_=x<<((_|0)==31?0:25-(_>>>1)|0);g=m+16+(_>>>31<<2)|0,p=h[g>>2]|0,!!p;)if((h[p+4>>2]&-8|0)==(x|0)){m=p;break t}else _=_<<1,m=p;h[g>>2]=M,h[M+24>>2]=m,h[M+12>>2]=M,h[M+8>>2]=M;break e}while(!1);we=m+8|0,Ae=h[we>>2]|0,h[Ae+12>>2]=M,h[we>>2]=M,h[M+8>>2]=Ae,h[M+12>>2]=m,h[M+24>>2]=0}}else Ae=h[6925]|0,(Ae|0)==0|x>>>0<Ae>>>0&&(h[6925]=x),h[7033]=x,h[7034]=b,h[7036]=0,h[6930]=h[7039],h[6929]=-1,h[6934]=27724,h[6933]=27724,h[6936]=27732,h[6935]=27732,h[6938]=27740,h[6937]=27740,h[6940]=27748,h[6939]=27748,h[6942]=27756,h[6941]=27756,h[6944]=27764,h[6943]=27764,h[6946]=27772,h[6945]=27772,h[6948]=27780,h[6947]=27780,h[6950]=27788,h[6949]=27788,h[6952]=27796,h[6951]=27796,h[6954]=27804,h[6953]=27804,h[6956]=27812,h[6955]=27812,h[6958]=27820,h[6957]=27820,h[6960]=27828,h[6959]=27828,h[6962]=27836,h[6961]=27836,h[6964]=27844,h[6963]=27844,h[6966]=27852,h[6965]=27852,h[6968]=27860,h[6967]=27860,h[6970]=27868,h[6969]=27868,h[6972]=27876,h[6971]=27876,h[6974]=27884,h[6973]=27884,h[6976]=27892,h[6975]=27892,h[6978]=27900,h[6977]=27900,h[6980]=27908,h[6979]=27908,h[6982]=27916,h[6981]=27916,h[6984]=27924,h[6983]=27924,h[6986]=27932,h[6985]=27932,h[6988]=27940,h[6987]=27940,h[6990]=27948,h[6989]=27948,h[6992]=27956,h[6991]=27956,h[6994]=27964,h[6993]=27964,h[6996]=27972,h[6995]=27972,Ae=b+-40|0,se=x+8|0,se=(se&7|0)==0?0:0-se&7,we=x+se|0,se=Ae-se|0,h[6927]=we,h[6924]=se,h[we+4>>2]=se|1,h[x+Ae+4>>2]=40,h[6928]=h[7043];while(!1);if(m=h[6924]|0,m>>>0>q>>>0)return se=m-q|0,h[6924]=se,Ae=h[6927]|0,we=Ae+q|0,h[6927]=we,h[we+4>>2]=se|1,h[Ae+4>>2]=q|3,Ae=Ae+8|0,Q=Be,Ae|0}return Ae=Aq()|0,h[Ae>>2]=12,Ae=0,Q=Be,Ae|0}function _t(p){p=p|0;var m=0,g=0,_=0,v=0,x=0,b=0,E=0,M=0;if(p){g=p+-8|0,v=h[6925]|0,p=h[p+-4>>2]|0,m=p&-8,M=g+m|0;do if(p&1)E=g,b=g;else{if(_=h[g>>2]|0,!(p&3)||(b=g+(0-_)|0,x=_+m|0,b>>>0<v>>>0))return;if((h[6926]|0)==(b|0)){if(p=M+4|0,m=h[p>>2]|0,(m&3|0)!=3){E=b,m=x;break}h[6923]=x,h[p>>2]=m&-2,h[b+4>>2]=x|1,h[b+x>>2]=x;return}if(g=_>>>3,_>>>0<256)if(p=h[b+8>>2]|0,m=h[b+12>>2]|0,(m|0)==(p|0)){h[6921]=h[6921]&~(1<<g),E=b,m=x;break}else{h[p+12>>2]=m,h[m+8>>2]=p,E=b,m=x;break}v=h[b+24>>2]|0,p=h[b+12>>2]|0;do if((p|0)==(b|0)){if(m=b+16|0,g=m+4|0,p=h[g>>2]|0,p)m=g;else if(p=h[m>>2]|0,!p){p=0;break}for(;;)if(_=p+20|0,g=h[_>>2]|0,g)p=g,m=_;else if(_=p+16|0,g=h[_>>2]|0,g)p=g,m=_;else break;h[m>>2]=0}else E=h[b+8>>2]|0,h[E+12>>2]=p,h[p+8>>2]=E;while(!1);if(v){if(m=h[b+28>>2]|0,g=27988+(m<<2)|0,(h[g>>2]|0)==(b|0)){if(h[g>>2]=p,!p){h[6922]=h[6922]&~(1<<m),E=b,m=x;break}}else if(E=v+16|0,h[((h[E>>2]|0)==(b|0)?E:v+20|0)>>2]=p,!p){E=b,m=x;break}h[p+24>>2]=v,m=b+16|0,g=h[m>>2]|0,g|0&&(h[p+16>>2]=g,h[g+24>>2]=p),m=h[m+4>>2]|0,m?(h[p+20>>2]=m,h[m+24>>2]=p,E=b,m=x):(E=b,m=x)}else E=b,m=x}while(!1);if(!(b>>>0>=M>>>0)&&(p=M+4|0,_=h[p>>2]|0,!!(_&1))){if(_&2)h[p>>2]=_&-2,h[E+4>>2]=m|1,h[b+m>>2]=m,v=m;else{if((h[6927]|0)==(M|0)){if(M=(h[6924]|0)+m|0,h[6924]=M,h[6927]=E,h[E+4>>2]=M|1,(E|0)!=(h[6926]|0))return;h[6926]=0,h[6923]=0;return}if((h[6926]|0)==(M|0)){M=(h[6923]|0)+m|0,h[6923]=M,h[6926]=b,h[E+4>>2]=M|1,h[b+M>>2]=M;return}v=(_&-8)+m|0,g=_>>>3;do if(_>>>0<256)if(m=h[M+8>>2]|0,p=h[M+12>>2]|0,(p|0)==(m|0)){h[6921]=h[6921]&~(1<<g);break}else{h[m+12>>2]=p,h[p+8>>2]=m;break}else{x=h[M+24>>2]|0,p=h[M+12>>2]|0;do if((p|0)==(M|0)){if(m=M+16|0,g=m+4|0,p=h[g>>2]|0,p)m=g;else if(p=h[m>>2]|0,!p){g=0;break}for(;;)if(_=p+20|0,g=h[_>>2]|0,g)p=g,m=_;else if(_=p+16|0,g=h[_>>2]|0,g)p=g,m=_;else break;h[m>>2]=0,g=p}else g=h[M+8>>2]|0,h[g+12>>2]=p,h[p+8>>2]=g,g=p;while(!1);if(x|0){if(p=h[M+28>>2]|0,m=27988+(p<<2)|0,(h[m>>2]|0)==(M|0)){if(h[m>>2]=g,!g){h[6922]=h[6922]&~(1<<p);break}}else if(_=x+16|0,h[((h[_>>2]|0)==(M|0)?_:x+20|0)>>2]=g,!g)break;h[g+24>>2]=x,p=M+16|0,m=h[p>>2]|0,m|0&&(h[g+16>>2]=m,h[m+24>>2]=g),p=h[p+4>>2]|0,p|0&&(h[g+20>>2]=p,h[p+24>>2]=g)}}while(!1);if(h[E+4>>2]=v|1,h[b+v>>2]=v,(E|0)==(h[6926]|0)){h[6923]=v;return}}if(p=v>>>3,v>>>0<256){g=27724+(p<<1<<2)|0,m=h[6921]|0,p=1<<p,m&p?(m=g+8|0,p=h[m>>2]|0):(h[6921]=m|p,p=g,m=g+8|0),h[m>>2]=E,h[p+12>>2]=E,h[E+8>>2]=p,h[E+12>>2]=g;return}p=v>>>8,p?v>>>0>16777215?_=31:(b=(p+1048320|0)>>>16&8,M=p<<b,x=(M+520192|0)>>>16&4,M=M<<x,_=(M+245760|0)>>>16&2,_=14-(x|b|_)+(M<<_>>>15)|0,_=v>>>(_+7|0)&1|_<<1):_=0,p=27988+(_<<2)|0,h[E+28>>2]=_,h[E+20>>2]=0,h[E+16>>2]=0,m=h[6922]|0,g=1<<_;e:do if(!(m&g))h[6922]=m|g,h[p>>2]=E,h[E+24>>2]=p,h[E+12>>2]=E,h[E+8>>2]=E;else{p=h[p>>2]|0;t:do if((h[p+4>>2]&-8|0)!=(v|0)){for(_=v<<((_|0)==31?0:25-(_>>>1)|0);g=p+16+(_>>>31<<2)|0,m=h[g>>2]|0,!!m;)if((h[m+4>>2]&-8|0)==(v|0)){p=m;break t}else _=_<<1,p=m;h[g>>2]=E,h[E+24>>2]=p,h[E+12>>2]=E,h[E+8>>2]=E;break e}while(!1);b=p+8|0,M=h[b>>2]|0,h[M+12>>2]=E,h[b>>2]=E,h[E+8>>2]=M,h[E+12>>2]=p,h[E+24>>2]=0}while(!1);if(M=(h[6929]|0)+-1|0,h[6929]=M,!(M|0)){for(p=28140;p=h[p>>2]|0,p;)p=p+8|0;h[6929]=-1}}}}function Ta(p,m){p=p|0,m=m|0;var g=0;return p?(g=ol(m,p)|0,(m|p)>>>0>65535&&(g=((g>>>0)/(p>>>0)|0|0)==(m|0)?g:-1)):g=0,p=br(g)|0,!p||!(h[p+-4>>2]&3)||up(p|0,0,g|0)|0,p|0}function Hue(p,m){p=p|0,m=m|0;var g=0,_=0;return p?m>>>0>4294967231?(m=Aq()|0,h[m>>2]=12,m=0,m|0):(g=Wue(p+-8|0,m>>>0<11?16:m+11&-8)|0,g|0?(m=g+8|0,m|0):(g=br(m)|0,g?(_=h[p+-4>>2]|0,_=(_&-8)-((_&3|0)==0?8:4)|0,hu(g|0,p|0,(_>>>0<m>>>0?_:m)|0)|0,_t(p),m=g,m|0):(m=0,m|0))):(m=br(m)|0,m|0)}function Wue(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0;if(U=p+4|0,q=h[U>>2]|0,g=q&-8,E=p+g|0,!(q&3))return m>>>0<256?(p=0,p|0):(g>>>0>=(m+4|0)>>>0&&(g-m|0)>>>0<=h[7041]<<1>>>0||(p=0),p|0);if(g>>>0>=m>>>0)return g=g-m|0,g>>>0<=15||(N=p+m|0,h[U>>2]=q&1|m|2,h[N+4>>2]=g|3,q=E+4|0,h[q>>2]=h[q>>2]|1,xq(N,g)),p|0;if((h[6927]|0)==(E|0))return N=(h[6924]|0)+g|0,g=N-m|0,_=p+m|0,N>>>0<=m>>>0?(p=0,p|0):(h[U>>2]=q&1|m|2,h[_+4>>2]=g|1,h[6927]=_,h[6924]=g,p|0);if((h[6926]|0)==(E|0))return _=(h[6923]|0)+g|0,_>>>0<m>>>0?(p=0,p|0):(g=_-m|0,g>>>0>15?(N=p+m|0,_=p+_|0,h[U>>2]=q&1|m|2,h[N+4>>2]=g|1,h[_>>2]=g,_=_+4|0,h[_>>2]=h[_>>2]&-2,_=N):(h[U>>2]=q&1|_|2,_=p+_+4|0,h[_>>2]=h[_>>2]|1,_=0,g=0),h[6923]=g,h[6926]=_,p|0);if(_=h[E+4>>2]|0,_&2|0||(M=(_&-8)+g|0,M>>>0<m>>>0))return p=0,p|0;N=M-m|0,v=_>>>3;do if(_>>>0<256)if(_=h[E+8>>2]|0,g=h[E+12>>2]|0,(g|0)==(_|0)){h[6921]=h[6921]&~(1<<v);break}else{h[_+12>>2]=g,h[g+8>>2]=_;break}else{b=h[E+24>>2]|0,g=h[E+12>>2]|0;do if((g|0)==(E|0)){if(_=E+16|0,v=_+4|0,g=h[v>>2]|0,g)_=v;else if(g=h[_>>2]|0,!g){v=0;break}for(;;)if(x=g+20|0,v=h[x>>2]|0,v)g=v,_=x;else if(x=g+16|0,v=h[x>>2]|0,v)g=v,_=x;else break;h[_>>2]=0,v=g}else v=h[E+8>>2]|0,h[v+12>>2]=g,h[g+8>>2]=v,v=g;while(!1);if(b|0){if(g=h[E+28>>2]|0,_=27988+(g<<2)|0,(h[_>>2]|0)==(E|0)){if(h[_>>2]=v,!v){h[6922]=h[6922]&~(1<<g);break}}else if(x=b+16|0,h[((h[x>>2]|0)==(E|0)?x:b+20|0)>>2]=v,!v)break;h[v+24>>2]=b,g=E+16|0,_=h[g>>2]|0,_|0&&(h[v+16>>2]=_,h[_+24>>2]=v),g=h[g+4>>2]|0,g|0&&(h[v+20>>2]=g,h[g+24>>2]=v)}}while(!1);return N>>>0<16?(h[U>>2]=q&1|M|2,q=p+M+4|0,h[q>>2]=h[q>>2]|1,p|0):(E=p+m|0,h[U>>2]=q&1|m|2,h[E+4>>2]=N|3,q=p+M+4|0,h[q>>2]=h[q>>2]|1,xq(E,N),p|0)}function xq(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0;E=p+m|0,g=h[p+4>>2]|0;do if(g&1)b=p;else{if(v=h[p>>2]|0,!(g&3))return;if(b=p+(0-v)|0,m=v+m|0,(h[6926]|0)==(b|0)){if(p=E+4|0,g=h[p>>2]|0,(g&3|0)!=3)break;h[6923]=m,h[p>>2]=g&-2,h[b+4>>2]=m|1,h[E>>2]=m;return}if(_=v>>>3,v>>>0<256)if(p=h[b+8>>2]|0,g=h[b+12>>2]|0,(g|0)==(p|0)){h[6921]=h[6921]&~(1<<_);break}else{h[p+12>>2]=g,h[g+8>>2]=p;break}x=h[b+24>>2]|0,p=h[b+12>>2]|0;do if((p|0)==(b|0)){if(g=b+16|0,_=g+4|0,p=h[_>>2]|0,p)g=_;else if(p=h[g>>2]|0,!p){p=0;break}for(;;)if(v=p+20|0,_=h[v>>2]|0,_)p=_,g=v;else if(v=p+16|0,_=h[v>>2]|0,_)p=_,g=v;else break;h[g>>2]=0}else v=h[b+8>>2]|0,h[v+12>>2]=p,h[p+8>>2]=v;while(!1);if(x){if(g=h[b+28>>2]|0,_=27988+(g<<2)|0,(h[_>>2]|0)==(b|0)){if(h[_>>2]=p,!p){h[6922]=h[6922]&~(1<<g);break}}else if(v=x+16|0,h[((h[v>>2]|0)==(b|0)?v:x+20|0)>>2]=p,!p)break;h[p+24>>2]=x,g=b+16|0,_=h[g>>2]|0,_|0&&(h[p+16>>2]=_,h[_+24>>2]=p),g=h[g+4>>2]|0,g&&(h[p+20>>2]=g,h[g+24>>2]=p)}}while(!1);if(p=E+4|0,_=h[p>>2]|0,_&2)h[p>>2]=_&-2,h[b+4>>2]=m|1,h[b+m>>2]=m,v=m;else{if((h[6927]|0)==(E|0)){if(E=(h[6924]|0)+m|0,h[6924]=E,h[6927]=b,h[b+4>>2]=E|1,(b|0)!=(h[6926]|0))return;h[6926]=0,h[6923]=0;return}if((h[6926]|0)==(E|0)){E=(h[6923]|0)+m|0,h[6923]=E,h[6926]=b,h[b+4>>2]=E|1,h[b+E>>2]=E;return}v=(_&-8)+m|0,g=_>>>3;do if(_>>>0<256)if(p=h[E+8>>2]|0,m=h[E+12>>2]|0,(m|0)==(p|0)){h[6921]=h[6921]&~(1<<g);break}else{h[p+12>>2]=m,h[m+8>>2]=p;break}else{x=h[E+24>>2]|0,m=h[E+12>>2]|0;do if((m|0)==(E|0)){if(p=E+16|0,g=p+4|0,m=h[g>>2]|0,m)p=g;else if(m=h[p>>2]|0,!m){g=0;break}for(;;)if(_=m+20|0,g=h[_>>2]|0,g)m=g,p=_;else if(_=m+16|0,g=h[_>>2]|0,g)m=g,p=_;else break;h[p>>2]=0,g=m}else g=h[E+8>>2]|0,h[g+12>>2]=m,h[m+8>>2]=g,g=m;while(!1);if(x|0){if(m=h[E+28>>2]|0,p=27988+(m<<2)|0,(h[p>>2]|0)==(E|0)){if(h[p>>2]=g,!g){h[6922]=h[6922]&~(1<<m);break}}else if(_=x+16|0,h[((h[_>>2]|0)==(E|0)?_:x+20|0)>>2]=g,!g)break;h[g+24>>2]=x,m=E+16|0,p=h[m>>2]|0,p|0&&(h[g+16>>2]=p,h[p+24>>2]=g),m=h[m+4>>2]|0,m|0&&(h[g+20>>2]=m,h[m+24>>2]=g)}}while(!1);if(h[b+4>>2]=v|1,h[b+v>>2]=v,(b|0)==(h[6926]|0)){h[6923]=v;return}}if(m=v>>>3,v>>>0<256){g=27724+(m<<1<<2)|0,p=h[6921]|0,m=1<<m,p&m?(p=g+8|0,m=h[p>>2]|0):(h[6921]=p|m,m=g,p=g+8|0),h[p>>2]=b,h[m+12>>2]=b,h[b+8>>2]=m,h[b+12>>2]=g;return}if(m=v>>>8,m?v>>>0>16777215?_=31:(x=(m+1048320|0)>>>16&8,E=m<<x,g=(E+520192|0)>>>16&4,E=E<<g,_=(E+245760|0)>>>16&2,_=14-(g|x|_)+(E<<_>>>15)|0,_=v>>>(_+7|0)&1|_<<1):_=0,m=27988+(_<<2)|0,h[b+28>>2]=_,h[b+20>>2]=0,h[b+16>>2]=0,p=h[6922]|0,g=1<<_,!(p&g)){h[6922]=p|g,h[m>>2]=b,h[b+24>>2]=m,h[b+12>>2]=b,h[b+8>>2]=b;return}m=h[m>>2]|0;e:do if((h[m+4>>2]&-8|0)!=(v|0)){for(_=v<<((_|0)==31?0:25-(_>>>1)|0);g=m+16+(_>>>31<<2)|0,p=h[g>>2]|0,!!p;)if((h[p+4>>2]&-8|0)==(v|0)){m=p;break e}else _=_<<1,m=p;h[g>>2]=b,h[b+24>>2]=m,h[b+12>>2]=b,h[b+8>>2]=b;return}while(!1);x=m+8|0,E=h[x>>2]|0,h[E+12>>2]=b,h[x>>2]=b,h[b+8>>2]=E,h[b+12>>2]=m,h[b+24>>2]=0}function At(p,m,g,_){return p=p|0,m=m|0,g=g|0,_=_|0,g=p+g>>>0,On(m+_+(g>>>0<p>>>0|0)>>>0|0),g|0|0}function eo(p,m,g,_){return p=p|0,m=m|0,g=g|0,_=_|0,_=m-_-(g>>>0>p>>>0|0)>>>0,On(_|0),p-g>>>0|0|0}function yq(p){return p=p|0,(p?31-(qf(p^p-1)|0)|0:32)|0}function bL(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0;if(U=p,M=m,N=M,b=g,j=_,E=j,!N)return x=(v|0)!=0,E?x?(h[v>>2]=p|0,h[v+4>>2]=m&0,j=0,v=0,On(j|0),v|0):(j=0,v=0,On(j|0),v|0):(x&&(h[v>>2]=(U>>>0)%(b>>>0),h[v+4>>2]=0),j=0,v=(U>>>0)/(b>>>0)>>>0,On(j|0),v|0);x=(E|0)==0;do if(b){if(!x){if(x=(qf(E|0)|0)-(qf(N|0)|0)|0,x>>>0<=31){q=x+1|0,E=31-x|0,m=x-31>>31,b=q,p=U>>>(q>>>0)&m|N<<E,m=N>>>(q>>>0)&m,x=0,E=U<<E;break}return v?(h[v>>2]=p|0,h[v+4>>2]=M|m&0,j=0,v=0,On(j|0),v|0):(j=0,v=0,On(j|0),v|0)}if(x=b-1|0,x&b|0){E=(qf(b|0)|0)+33-(qf(N|0)|0)|0,K=64-E|0,q=32-E|0,M=q>>31,X=E-32|0,m=X>>31,b=E,p=q-1>>31&N>>>(X>>>0)|(N<<q|U>>>(E>>>0))&m,m=m&N>>>(E>>>0),x=U<<K&M,E=(N<<K|U>>>(X>>>0))&M|U<<q&E-33>>31;break}return v|0&&(h[v>>2]=x&U,h[v+4>>2]=0),(b|0)==1?(X=M|m&0,K=p|0|0,On(X|0),K|0):(K=yq(b|0)|0,X=N>>>(K>>>0)|0,K=N<<32-K|U>>>(K>>>0)|0,On(X|0),K|0)}else{if(x)return v|0&&(h[v>>2]=(N>>>0)%(b>>>0),h[v+4>>2]=0),X=0,K=(N>>>0)/(b>>>0)>>>0,On(X|0),K|0;if(!U)return v|0&&(h[v>>2]=0,h[v+4>>2]=(N>>>0)%(E>>>0)),X=0,K=(N>>>0)/(E>>>0)>>>0,On(X|0),K|0;if(x=E-1|0,!(x&E))return v|0&&(h[v>>2]=p|0,h[v+4>>2]=x&N|m&0),X=0,K=N>>>((yq(E|0)|0)>>>0),On(X|0),K|0;if(x=(qf(E|0)|0)-(qf(N|0)|0)|0,x>>>0<=30){m=x+1|0,E=31-x|0,b=m,p=N<<E|U>>>(m>>>0),m=N>>>(m>>>0),x=0,E=U<<E;break}return v?(h[v>>2]=p|0,h[v+4>>2]=M|m&0,X=0,K=0,On(X|0),K|0):(X=0,K=0,On(X|0),K|0)}while(!1);if(!b)N=E,M=0,E=0;else{q=g|0|0,U=j|_&0,N=At(q|0,U|0,-1,-1)|0,g=ee()|0,M=E,E=0;do _=M,M=x>>>31|M<<1,x=E|x<<1,_=p<<1|_>>>31|0,j=p>>>31|m<<1|0,eo(N|0,g|0,_|0,j|0)|0,K=ee()|0,X=K>>31|((K|0)<0?-1:0)<<1,E=X&1,p=eo(_|0,j|0,X&q|0,(((K|0)<0?-1:0)>>31|((K|0)<0?-1:0)<<1)&U|0)|0,m=ee()|0,b=b-1|0;while((b|0)!=0);N=M,M=0}return b=0,v|0&&(h[v>>2]=p,h[v+4>>2]=m),X=(x|0)>>>31|(N|b)<<1|(b<<1|x>>>31)&0|M,K=(x<<1|0)&-2|E,On(X|0),K|0}function lp(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0;return N=m>>31|((m|0)<0?-1:0)<<1,M=((m|0)<0?-1:0)>>31|((m|0)<0?-1:0)<<1,x=_>>31|((_|0)<0?-1:0)<<1,v=((_|0)<0?-1:0)>>31|((_|0)<0?-1:0)<<1,E=eo(N^p|0,M^m|0,N|0,M|0)|0,b=ee()|0,p=x^N,m=v^M,eo((bL(E,b,eo(x^g|0,v^_|0,x|0,v|0)|0,ee()|0,0)|0)^p|0,(ee()|0)^m|0,p|0,m|0)|0}function jue(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0;return x=p&65535,v=m&65535,g=ol(v,x)|0,_=p>>>16,p=(g>>>16)+(ol(v,_)|0)|0,v=m>>>16,m=ol(v,x)|0,On((p>>>16)+(ol(v,_)|0)+(((p&65535)+m|0)>>>16)|0),p+m<<16|g&65535|0|0}function wr(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0;return v=p,x=g,g=jue(v,x)|0,p=ee()|0,On((ol(m,x)|0)+(ol(_,v)|0)+p|p&0|0),g|0|0|0}function cp(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0;return v=Q,Q=Q+16|0,E=v|0,b=m>>31|((m|0)<0?-1:0)<<1,x=((m|0)<0?-1:0)>>31|((m|0)<0?-1:0)<<1,N=_>>31|((_|0)<0?-1:0)<<1,M=((_|0)<0?-1:0)>>31|((_|0)<0?-1:0)<<1,p=eo(b^p|0,x^m|0,b|0,x|0)|0,m=ee()|0,bL(p,m,eo(N^g|0,M^_|0,N|0,M|0)|0,ee()|0,E)|0,_=eo(h[E>>2]^b|0,h[E+4>>2]^x|0,b|0,x|0)|0,g=ee()|0,Q=v,On(g|0),_|0}function Hf(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0;return x=Q,Q=Q+16|0,v=x|0,bL(p,m,g,_,v)|0,Q=x,On(h[v+4>>2]|0),h[v>>2]|0|0}function bq(p,m,g){return p=p|0,m=m|0,g=g|0,(g|0)<32?(On(m>>g|0),p>>>g|(m&(1<<g)-1)<<32-g):(On(((m|0)<0?-1:0)|0),m>>g-32|0)}function tt(p,m,g){return p=p|0,m=m|0,g=g|0,(g|0)<32?(On(m>>>g|0),p>>>g|(m&(1<<g)-1)<<32-g):(On(0),m>>>g-32|0)}function ft(p,m,g){return p=p|0,m=m|0,g=g|0,(g|0)<32?(On(m<<g|(p&(1<<g)-1<<32-g)>>>32-g|0),p<<g):(On(p<<g-32|0),0)}function wL(p,m,g){return p=p|0,m=m|0,g=g|0,m=qf(m)|0,(m|0)==32&&(m=m+(qf(p)|0)|0),On(0),m|0}function wq(p,m){return p=+p,m=+m,p!=p?+m:m!=m?+p:+fce(+p,+m)}function dT(p,m){return p=+p,m=+m,p!=p?+m:m!=m?+p:+JP(+p,+m)}function pT(p){return p=+p,p>=0?+fo(p+.5):+b1(p-.5)}function hu(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0;if((g|0)>=8192)return mce(p|0,m|0,g|0)|0,p|0;if(x=p|0,v=p+g|0,(p&3)==(m&3)){for(;p&3;){if(!g)return x|0;He[p>>0]=He[m>>0]|0,p=p+1|0,m=m+1|0,g=g-1|0}for(g=v&-4|0,_=g-64|0;(p|0)<=(_|0);)h[p>>2]=h[m>>2],h[p+4>>2]=h[m+4>>2],h[p+8>>2]=h[m+8>>2],h[p+12>>2]=h[m+12>>2],h[p+16>>2]=h[m+16>>2],h[p+20>>2]=h[m+20>>2],h[p+24>>2]=h[m+24>>2],h[p+28>>2]=h[m+28>>2],h[p+32>>2]=h[m+32>>2],h[p+36>>2]=h[m+36>>2],h[p+40>>2]=h[m+40>>2],h[p+44>>2]=h[m+44>>2],h[p+48>>2]=h[m+48>>2],h[p+52>>2]=h[m+52>>2],h[p+56>>2]=h[m+56>>2],h[p+60>>2]=h[m+60>>2],p=p+64|0,m=m+64|0;for(;(p|0)<(g|0);)h[p>>2]=h[m>>2],p=p+4|0,m=m+4|0}else for(g=v-4|0;(p|0)<(g|0);)He[p>>0]=He[m>>0]|0,He[p+1>>0]=He[m+1>>0]|0,He[p+2>>0]=He[m+2>>0]|0,He[p+3>>0]=He[m+3>>0]|0,p=p+4|0,m=m+4|0;for(;(p|0)<(v|0);)He[p>>0]=He[m>>0]|0,p=p+1|0,m=m+1|0;return x|0}function SL(p,m,g){p=p|0,m=m|0,g=g|0;var _=0;if((m|0)<(p|0)&(p|0)<(m+g|0)){for(_=p,m=m+g|0,p=p+g|0;(g|0)>0;)p=p-1|0,m=m-1|0,g=g-1|0,He[p>>0]=He[m>>0]|0;p=_}else hu(p,m,g)|0;return p|0}function up(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0;if(x=p+g|0,m=m&255,(g|0)>=67){for(;p&3;)He[p>>0]=m,p=p+1|0;for(_=x&-4|0,b=m|m<<8|m<<16|m<<24,v=_-64|0;(p|0)<=(v|0);)h[p>>2]=b,h[p+4>>2]=b,h[p+8>>2]=b,h[p+12>>2]=b,h[p+16>>2]=b,h[p+20>>2]=b,h[p+24>>2]=b,h[p+28>>2]=b,h[p+32>>2]=b,h[p+36>>2]=b,h[p+40>>2]=b,h[p+44>>2]=b,h[p+48>>2]=b,h[p+52>>2]=b,h[p+56>>2]=b,h[p+60>>2]=b,p=p+64|0;for(;(p|0)<(_|0);)h[p>>2]=b,p=p+4|0}for(;(p|0)<(x|0);)He[p>>0]=m,p=p+1|0;return x-g|0}function Sq(p){return p=+p,p>=0?+fo(p+.5):+b1(p-.5)}function hp(p){p=p|0;var m=0,g=0,_=0;return _=pce()|0,g=h[sl>>2]|0,m=g+p|0,(p|0)>0&(m|0)<(g|0)|(m|0)<0?(gce(m|0)|0,kG(12),-1):(m|0)>(_|0)&&!(Ace(m|0)|0)?(kG(12),-1):(h[sl>>2]=m,g|0)}function Xue(p,m,g){return p=p|0,m=m|0,g=g|0,fp[p&3](m|0,g|0)|0}function $ue(p,m){return p=p|0,m=m|0,dce(0),0}var fp=[$ue,Hce,Wce,jce];return{___divdi3:lp,___muldi3:wr,___remdi3:cp,___uremdi3:Hf,_areNeighborCells:Xce,_bitshift64Ashr:bq,_bitshift64Lshr:tt,_bitshift64Shl:ft,_calloc:Ta,_cellAreaKm2:Ice,_cellAreaM2:Pce,_cellAreaRads2:Rce,_cellToBoundary:Vm,_cellToCenterChild:iq,_cellToChildPos:due,_cellToChildren:rue,_cellToChildrenSize:jx,_cellToLatLng:T1,_cellToLocalIj:Tue,_cellToParent:cL,_cellToVertex:xc,_cellToVertexes:Gue,_cellsToDirectedEdge:$ce,_cellsToLinkedMultiPolygon:Cce,_childPosToCell:pue,_compactCells:sue,_constructCell:nue,_destroyLinkedMultiPolygon:wue,_directedEdgeToBoundary:Hx,_directedEdgeToCells:Kce,_edgeLengthKm:yue,_edgeLengthM:bue,_edgeLengthRads:xue,_emscripten_replace_memory:vce,_free:_t,_getBaseCellNumber:tq,_getDirectedEdgeDestination:Zce,_getDirectedEdgeOrigin:Yce,_getHexagonAreaAvgKm2:oq,_getHexagonAreaAvgM2:gue,_getHexagonEdgeLengthAvgKm:vue,_getHexagonEdgeLengthAvgM:_ue,_getIcosahedronFaces:rq,_getIndexDigit:tue,_getNumCells:oT,_getPentagons:pL,_getRes0Cells:Bce,_getResolution:aL,_greatCircleDistanceKm:$x,_greatCircleDistanceM:Aue,_greatCircleDistanceRads:mue,_gridDisk:zG,_gridDiskDistances:VG,_gridDistance:gL,_gridPathCells:Cue,_gridPathCellsSize:Mue,_gridRing:Sce,_gridRingUnsafe:qG,_i64Add:At,_i64Subtract:eo,_isPentagon:Zi,_isResClassIII:lue,_isValidCell:sT,_isValidDirectedEdge:KG,_isValidIndex:iue,_isValidVertex:mq,_latLngToCell:fL,_llvm_ctlz_i64:wL,_llvm_maxnum_f64:wq,_llvm_minnum_f64:dT,_llvm_round_f64:pT,_localIjToCell:Eue,_malloc:br,_maxFaceCount:hue,_maxGridDiskSize:wce,_maxPolygonToCellsSize:Ece,_maxPolygonToCellsSizeExperimental:Pue,_memcpy:hu,_memmove:SL,_memset:up,_originToDirectedEdges:rL,_pentagonCount:fue,_polygonToCells:Mce,_polygonToCellsExperimental:Iue,_readInt64AsDoubleFromPointer:kue,_res0CellCount:Fce,_reverseDirectedEdge:QG,_round:Sq,_sbrk:hp,_sizeOfCellBoundary:Nue,_sizeOfCoordIJ:Uue,_sizeOfGeoLoop:Fue,_sizeOfGeoPolygon:Bue,_sizeOfH3Index:Lue,_sizeOfLatLng:Due,_sizeOfLinkedGeoPolygon:Oue,_uncompactCells:oue,_uncompactCellsSize:aue,_vertexToLatLng:que,dynCall_iii:Xue,establishStackSpace:bce,stackAlloc:_ce,stackRestore:yce,stackSave:xce}})(Bt,ut,W),Yt=e.___divdi3=Ce.___divdi3,nr=e.___muldi3=Ce.___muldi3,Fn=e.___remdi3=Ce.___remdi3,is=e.___uremdi3=Ce.___uremdi3,Lr=e._areNeighborCells=Ce._areNeighborCells,Fl=e._bitshift64Ashr=Ce._bitshift64Ashr,wa=e._bitshift64Lshr=Ce._bitshift64Lshr,Bl=e._bitshift64Shl=Ce._bitshift64Shl,il=e._calloc=Ce._calloc,xr=e._cellAreaKm2=Ce._cellAreaKm2,Ks=e._cellAreaM2=Ce._cellAreaM2,Ol=e._cellAreaRads2=Ce._cellAreaRads2,nh=e._cellToBoundary=Ce._cellToBoundary,eT=e._cellToCenterChild=Ce._cellToCenterChild,WP=e._cellToChildPos=Ce._cellToChildPos,jP=e._cellToChildren=Ce._cellToChildren,Vx=e._cellToChildrenSize=Ce._cellToChildrenSize,XP=e._cellToLatLng=Ce._cellToLatLng,Gx=e._cellToLocalIj=Ce._cellToLocalIj,$P=e._cellToParent=Ce._cellToParent,YP=e._cellToVertex=Ce._cellToVertex,IG=e._cellToVertexes=Ce._cellToVertexes,PG=e._cellsToDirectedEdge=Ce._cellsToDirectedEdge,LG=e._cellsToLinkedMultiPolygon=Ce._cellsToLinkedMultiPolygon,DG=e._childPosToCell=Ce._childPosToCell,ne=e._compactCells=Ce._compactCells,Se=e._constructCell=Ce._constructCell,ke=e._destroyLinkedMultiPolygon=Ce._destroyLinkedMultiPolygon,De=e._directedEdgeToBoundary=Ce._directedEdgeToBoundary,Ne=e._directedEdgeToCells=Ce._directedEdgeToCells,qt=e._edgeLengthKm=Ce._edgeLengthKm,Qt=e._edgeLengthM=Ce._edgeLengthM,Vt=e._edgeLengthRads=Ce._edgeLengthRads,sn=e._emscripten_replace_memory=Ce._emscripten_replace_memory,pn=e._free=Ce._free,Wn=e._getBaseCellNumber=Ce._getBaseCellNumber,Jn=e._getDirectedEdgeDestination=Ce._getDirectedEdgeDestination,gn=e._getDirectedEdgeOrigin=Ce._getDirectedEdgeOrigin,Yi=e._getHexagonAreaAvgKm2=Ce._getHexagonAreaAvgKm2,rs=e._getHexagonAreaAvgM2=Ce._getHexagonAreaAvgM2,qr=e._getHexagonEdgeLengthAvgKm=Ce._getHexagonEdgeLengthAvgKm,ir=e._getHexagonEdgeLengthAvgM=Ce._getHexagonEdgeLengthAvgM,Co=e._getIcosahedronFaces=Ce._getIcosahedronFaces,Zt=e._getIndexDigit=Ce._getIndexDigit,rl=e._getNumCells=Ce._getNumCells,yi=e._getPentagons=Ce._getPentagons,Ul=e._getRes0Cells=Ce._getRes0Cells,uu=e._getResolution=Ce._getResolution,zf=e._greatCircleDistanceKm=Ce._greatCircleDistanceKm,Om=e._greatCircleDistanceM=Ce._greatCircleDistanceM,rr=e._greatCircleDistanceRads=Ce._greatCircleDistanceRads,ss=e._gridDisk=Ce._gridDisk,Vf=e._gridDiskDistances=Ce._gridDiskDistances,pr=e._gridDistance=Ce._gridDistance,Gf=e._gridPathCells=Ce._gridPathCells,Um=e._gridPathCellsSize=Ce._gridPathCellsSize,ZP=e._gridRing=Ce._gridRing,X6e=e._gridRingUnsafe=Ce._gridRingUnsafe,$6e=e._i64Add=Ce._i64Add,Y6e=e._i64Subtract=Ce._i64Subtract,Z6e=e._isPentagon=Ce._isPentagon,K6e=e._isResClassIII=Ce._isResClassIII,Q6e=e._isValidCell=Ce._isValidCell,J6e=e._isValidDirectedEdge=Ce._isValidDirectedEdge,e8e=e._isValidIndex=Ce._isValidIndex,t8e=e._isValidVertex=Ce._isValidVertex,n8e=e._latLngToCell=Ce._latLngToCell,i8e=e._llvm_ctlz_i64=Ce._llvm_ctlz_i64,r8e=e._llvm_maxnum_f64=Ce._llvm_maxnum_f64,s8e=e._llvm_minnum_f64=Ce._llvm_minnum_f64,o8e=e._llvm_round_f64=Ce._llvm_round_f64,a8e=e._localIjToCell=Ce._localIjToCell,l8e=e._malloc=Ce._malloc,c8e=e._maxFaceCount=Ce._maxFaceCount,u8e=e._maxGridDiskSize=Ce._maxGridDiskSize,h8e=e._maxPolygonToCellsSize=Ce._maxPolygonToCellsSize,f8e=e._maxPolygonToCellsSizeExperimental=Ce._maxPolygonToCellsSizeExperimental,d8e=e._memcpy=Ce._memcpy,p8e=e._memmove=Ce._memmove,m8e=e._memset=Ce._memset,A8e=e._originToDirectedEdges=Ce._originToDirectedEdges,g8e=e._pentagonCount=Ce._pentagonCount,v8e=e._polygonToCells=Ce._polygonToCells,_8e=e._polygonToCellsExperimental=Ce._polygonToCellsExperimental,x8e=e._readInt64AsDoubleFromPointer=Ce._readInt64AsDoubleFromPointer,y8e=e._res0CellCount=Ce._res0CellCount,b8e=e._reverseDirectedEdge=Ce._reverseDirectedEdge,w8e=e._round=Ce._round,S8e=e._sbrk=Ce._sbrk,T8e=e._sizeOfCellBoundary=Ce._sizeOfCellBoundary,E8e=e._sizeOfCoordIJ=Ce._sizeOfCoordIJ,M8e=e._sizeOfGeoLoop=Ce._sizeOfGeoLoop,C8e=e._sizeOfGeoPolygon=Ce._sizeOfGeoPolygon,R8e=e._sizeOfH3Index=Ce._sizeOfH3Index,I8e=e._sizeOfLatLng=Ce._sizeOfLatLng,P8e=e._sizeOfLinkedGeoPolygon=Ce._sizeOfLinkedGeoPolygon,L8e=e._uncompactCells=Ce._uncompactCells,D8e=e._uncompactCellsSize=Ce._uncompactCellsSize,N8e=e._vertexToLatLng=Ce._vertexToLatLng,F8e=e.establishStackSpace=Ce.establishStackSpace,NG=e.stackAlloc=Ce.stackAlloc,cce=e.stackRestore=Ce.stackRestore,uce=e.stackSave=Ce.stackSave,B8e=e.dynCall_iii=Ce.dynCall_iii;if(e.asm=Ce,e.cwrap=I,e.setValue=y,e.getValue=w,le){Te(le)||(le=o(le));{vi("memory initializer");var KP=function(Le){Le.byteLength&&(Le=new Uint8Array(Le)),H.set(Le,A),e.memoryInitializerRequest&&delete e.memoryInitializerRequest.response,zn("memory initializer")},FG=function(){a(le,KP,function(){throw"could not load memory initializer "+le})},BG=St(le);if(BG)KP(BG.buffer);else if(e.memoryInitializerRequest){var OG=function(){var Le=e.memoryInitializerRequest,it=Le.response;if(Le.status!==200&&Le.status!==0){var Dt=St(e.memoryInitializerRequestURL);if(Dt)it=Dt.buffer;else{console.warn("a problem seems to have happened with Module.memoryInitializerRequest, status: "+Le.status+", retrying "+le),FG();return}}KP(it)};e.memoryInitializerRequest.response?setTimeout(OG,0):e.memoryInitializerRequest.addEventListener("load",OG)}else FG()}}var tT;_e=function Le(){tT||QP(),tT||(_e=Le)};function QP(Le){if(Le=Le||r,tn>0||(It(),tn>0))return;function it(){tT||(tT=!0,!S&&(dn(),Gt(),e.onRuntimeInitialized&&e.onRuntimeInitialized(),$e()))}e.setStatus?(e.setStatus("Running..."),setTimeout(function(){setTimeout(function(){e.setStatus("")},1),it()},1)):it()}e.run=QP;function km(Le){throw e.onAbort&&e.onAbort(Le),Le+="",l(Le),c(Le),S=!0,"abort("+Le+"). Build with -s ASSERTIONS=1 for more info."}if(e.abort=km,e.preInit)for(typeof e.preInit=="function"&&(e.preInit=[e.preInit]);e.preInit.length>0;)e.preInit.pop()();return QP(),i})(typeof Ai=="object"?Ai:{}),En="number",Sn=En,U_=En,Cn=En,Rn=En,wo=En,jt=En,bSe=[["sizeOfH3Index",En],["sizeOfLatLng",En],["sizeOfCellBoundary",En],["sizeOfGeoLoop",En],["sizeOfGeoPolygon",En],["sizeOfLinkedGeoPolygon",En],["sizeOfCoordIJ",En],["readInt64AsDoubleFromPointer",En],["isValidCell",U_,[Cn,Rn]],["isValidIndex",U_,[Cn,Rn]],["latLngToCell",Sn,[En,En,wo,jt]],["cellToLatLng",Sn,[Cn,Rn,jt]],["cellToBoundary",Sn,[Cn,Rn,jt]],["maxGridDiskSize",Sn,[En,jt]],["gridDisk",Sn,[Cn,Rn,En,jt]],["gridDiskDistances",Sn,[Cn,Rn,En,jt,jt]],["gridRing",Sn,[Cn,Rn,En,jt]],["gridRingUnsafe",Sn,[Cn,Rn,En,jt]],["maxPolygonToCellsSize",Sn,[jt,wo,En,jt]],["polygonToCells",Sn,[jt,wo,En,jt]],["maxPolygonToCellsSizeExperimental",Sn,[jt,wo,En,jt]],["polygonToCellsExperimental",Sn,[jt,wo,En,En,En,jt]],["cellsToLinkedMultiPolygon",Sn,[jt,En,jt]],["destroyLinkedMultiPolygon",null,[jt]],["compactCells",Sn,[jt,jt,En,En]],["uncompactCells",Sn,[jt,En,En,jt,En,wo]],["uncompactCellsSize",Sn,[jt,En,En,wo,jt]],["isPentagon",U_,[Cn,Rn]],["isResClassIII",U_,[Cn,Rn]],["getBaseCellNumber",En,[Cn,Rn]],["getResolution",En,[Cn,Rn]],["getIndexDigit",En,[Cn,Rn,En]],["constructCell",Sn,[En,En,jt,jt]],["maxFaceCount",Sn,[Cn,Rn,jt]],["getIcosahedronFaces",Sn,[Cn,Rn,jt]],["cellToParent",Sn,[Cn,Rn,wo,jt]],["cellToChildren",Sn,[Cn,Rn,wo,jt]],["cellToCenterChild",Sn,[Cn,Rn,wo,jt]],["cellToChildrenSize",Sn,[Cn,Rn,wo,jt]],["cellToChildPos",Sn,[Cn,Rn,wo,jt]],["childPosToCell",Sn,[En,En,Cn,Rn,wo,jt]],["areNeighborCells",Sn,[Cn,Rn,Cn,Rn,jt]],["cellsToDirectedEdge",Sn,[Cn,Rn,Cn,Rn,jt]],["getDirectedEdgeOrigin",Sn,[Cn,Rn,jt]],["getDirectedEdgeDestination",Sn,[Cn,Rn,jt]],["isValidDirectedEdge",U_,[Cn,Rn]],["directedEdgeToCells",Sn,[Cn,Rn,jt]],["originToDirectedEdges",Sn,[Cn,Rn,jt]],["directedEdgeToBoundary",Sn,[Cn,Rn,jt]],["reverseDirectedEdge",Sn,[Cn,Rn,jt]],["gridDistance",Sn,[Cn,Rn,Cn,Rn,jt]],["gridPathCells",Sn,[Cn,Rn,Cn,Rn,jt]],["gridPathCellsSize",Sn,[Cn,Rn,Cn,Rn,jt]],["cellToLocalIj",Sn,[Cn,Rn,Cn,Rn,En,jt]],["localIjToCell",Sn,[Cn,Rn,jt,En,jt]],["getHexagonAreaAvgM2",Sn,[wo,jt]],["getHexagonAreaAvgKm2",Sn,[wo,jt]],["getHexagonEdgeLengthAvgM",Sn,[wo,jt]],["getHexagonEdgeLengthAvgKm",Sn,[wo,jt]],["greatCircleDistanceM",En,[jt,jt]],["greatCircleDistanceKm",En,[jt,jt]],["greatCircleDistanceRads",En,[jt,jt]],["cellAreaM2",Sn,[Cn,Rn,jt]],["cellAreaKm2",Sn,[Cn,Rn,jt]],["cellAreaRads2",Sn,[Cn,Rn,jt]],["edgeLengthM",Sn,[Cn,Rn,jt]],["edgeLengthKm",Sn,[Cn,Rn,jt]],["edgeLengthRads",Sn,[Cn,Rn,jt]],["getNumCells",Sn,[wo,jt]],["getRes0Cells",Sn,[jt]],["res0CellCount",En],["getPentagons",Sn,[En,jt]],["pentagonCount",En],["cellToVertex",Sn,[Cn,Rn,En,jt]],["cellToVertexes",Sn,[Cn,Rn,jt]],["vertexToLatLng",Sn,[Cn,Rn,jt]],["isValidVertex",U_,[Cn,Rn]]],wSe=0,SSe=1,TSe=2,ESe=3,hee=4,MSe=5,CSe=6,RSe=7,ISe=8,PSe=9,LSe=10,DSe=11,NSe=12,FSe=13,BSe=14,OSe=15,USe=16,kSe=17,zSe=18,VSe=19,Is={};Is[wSe]="Success";Is[SSe]="The operation failed but a more specific error is not available";Is[TSe]="Argument was outside of acceptable range";Is[ESe]="Latitude or longitude arguments were outside of acceptable range";Is[hee]="Resolution argument was outside of acceptable range";Is[MSe]="Cell argument was not valid";Is[CSe]="Directed edge argument was not valid";Is[RSe]="Undirected edge argument was not valid";Is[ISe]="Vertex argument was not valid";Is[PSe]="Pentagon distortion was encountered";Is[LSe]="Duplicate input";Is[DSe]="Cell arguments were not neighbors";Is[NSe]="Cell arguments had incompatible resolutions";Is[FSe]="Memory allocation failed";Is[BSe]="Bounds of provided memory were insufficient";Is[OSe]="Mode or flags argument was not valid";Is[USe]="Index argument was not valid";Is[kSe]="Base cell number was outside of acceptable range";Is[zSe]="Child indexing digits invalid";Is[VSe]="Child indexing digits refer to a deleted subsequence";var GSe=1e3,fee=1001,dee=1002,lR={};lR[GSe]="Unknown unit";lR[fee]="Array length out of bounds";lR[dee]="Got unexpected null value for H3 index";var qSe="Unknown error";function pee(i,e,t){var n=t&&"value"in t,r=new Error((i[e]||qSe)+" (code: "+e+(n?", value: "+t.value:"")+")");return r.code=e,r}function mee(i,e){var t=arguments.length===2?{value:e}:{};return pee(Is,i,t)}function Aee(i,e){var t=arguments.length===2?{value:e}:{};return pee(lR,i,t)}function Dw(i){if(i!==0)throw mee(i)}var Rl={};bSe.forEach(function(e){Rl[e[0]]=Ai.cwrap.apply(Ai,e)});var k_=16;var Nw=4;var z_=8,HSe=8,oR=Rl.sizeOfH3Index(),xO=Rl.sizeOfLatLng(),WSe=Rl.sizeOfCellBoundary(),jSe=Rl.sizeOfGeoPolygon(),Lw=Rl.sizeOfGeoLoop(),Hat=Rl.sizeOfLinkedGeoPolygon(),Wat=Rl.sizeOfCoordIJ();function XSe(i){if(typeof i!="number"||i<0||i>15||Math.floor(i)!==i)throw mee(hee,i);return i}function $Se(i){if(!i)throw Aee(dee);return i}var YSe=Math.pow(2,32)-1,jat=Math.pow(2,31)-1;function ZSe(i){if(i>YSe)throw Aee(fee,i);return i}var KSe=/[^0-9a-fA-F]/;function gee(i){if(Array.isArray(i)&&i.length===2&&Number.isInteger(i[0])&&Number.isInteger(i[1]))return i;if(typeof i!="string"||KSe.test(i))return[0,0];var e=parseInt(i.substring(0,i.length-8),k_),t=parseInt(i.substring(i.length-8),k_);return[t,e]}function cee(i){if(i>=0)return i.toString(k_);i=i&2147483647;var e=vee(8,i.toString(k_)),t=(parseInt(e[0],k_)+8).toString(k_);return e=t+e.substring(1),e}function QSe(i,e){return cee(e)+vee(8,cee(i))}function vee(i,e){for(var t=i-e.length,n="",r=0;r<t;r++)n+="0";return n=n+e,n}var Xat=Math.pow(2,32);function uee(i,e,t){for(var n=i.length,r=Ai._calloc(n,xO),s=t?1:0,o=t?0:1,a=0;a<n*2;a+=2)Ai.HEAPF64.set([i[a/2][s],i[a/2][o]].map(bee),r/z_+a);return Ai.HEAPU32.set([n,r],e/Nw),e}function JSe(i,e){var t=i.length-1,n=Ai._calloc(jSe),r=0,s=r+Lw,o=s+Nw;uee(i[0],n+r,e);var a;if(t>0){a=Ai._calloc(t,Lw);for(var l=0;l<t;l++)uee(i[l+1],a+Lw*l,e)}return Ai.setValue(n+s,t,"i32"),Ai.setValue(n+o,a,"i32"),n}function eTe(i){var e=0,t=e+Lw,n=t+Nw,r=Nw;Ai._free(Ai.getValue(i+e+r,"i8*"));var s=Ai.getValue(i+t,"i32");if(s>0){for(var o=Ai.getValue(i+n,"i32"),a=0;a<s;a++)Ai._free(Ai.getValue(o+Lw*a+r,"i8*"));Ai._free(o)}Ai._free(i)}function _ee(i,e){e===void 0&&(e=0);var t=Ai.getValue(i+oR*e,"i32"),n=Ai.getValue(i+oR*e+Nw,"i32");return n?QSe(t,n):null}function tTe(i){return Rl.readInt64AsDoubleFromPointer(i)}function nTe(i,e){for(var t=[],n=0;n<e;n++){var r=_ee(i,n);r!==null&&t.push(r)}return t}function aR(i){return sTe(Ai.getValue(i,"double"))}function xee(i){return[aR(i),aR(i+z_)]}function iTe(i){return[aR(i+z_),aR(i)]}function rTe(i,e,t){for(var n=Ai.getValue(i,"i32"),r=i+z_,s=[],o=e?iTe:xee,a=0;a<n*2;a+=2)s.push(o(r+z_*a));return t&&s.push(s[0]),s}function yee(i,e,t){var n=Ai._malloc(xO);Ai.HEAPF64.set([i,e].map(bee),n/z_);var r=Ai._malloc(oR);try{return Dw(Rl.latLngToCell(n,t,r)),$Se(_ee(r))}finally{Ai._free(r),Ai._free(n)}}function yO(i){var e=Ai._malloc(xO),t=gee(i),n=t[0],r=t[1];try{return Dw(Rl.cellToLatLng(n,r,e)),xee(e)}finally{Ai._free(e)}}function bO(i,e){var t=Ai._malloc(WSe),n=gee(i),r=n[0],s=n[1];try{return Dw(Rl.cellToBoundary(r,s,t)),rTe(t,e,e)}finally{Ai._free(t)}}function wO(i,e,t){if(XSe(e),t=!!t,i.length===0||i[0].length===0)return[];var n=typeof i[0][0]=="number"?[i]:i,r=JSe(n,t),s=Ai._malloc(HSe);try{Dw(Rl.maxPolygonToCellsSize(r,e,0,s));var o=ZSe(tTe(s)),a=Ai._calloc(o,oR);try{return Dw(Rl.polygonToCells(r,e,0,a)),nTe(a,o)}finally{Ai._free(a)}}finally{Ai._free(s),eTe(r)}}function bee(i){return i*Math.PI/180}function sTe(i){return i*180/Math.PI}function SO(i){return i=Math.max(0,Math.min(1,i)),"rgb("+Math.max(0,Math.min(255,Math.round(34.61+i*(1172.33-i*(10793.56-i*(33300.12-i*(38394.49-i*14825.05)))))))+", "+Math.max(0,Math.min(255,Math.round(23.31+i*(557.33+i*(1225.33-i*(3574.96-i*(1073.77+i*707.56)))))))+", "+Math.max(0,Math.min(255,Math.round(27.2+i*(3211.1-i*(15327.97-i*(27814-i*(22569.18-i*6838.66)))))))+")"}var oTe=["alphaMap","alphaTest","anisotropy","anisotropyMap","anisotropyRotation","aoMap","aoMapIntensity","attenuationColor","attenuationDistance","bumpMap","clearcoat","clearcoatMap","clearcoatNormalMap","clearcoatNormalScale","clearcoatRoughness","color","dispersion","displacementMap","emissive","emissiveIntensity","emissiveMap","envMap","envMapIntensity","envMapRotation","gradientMap","ior","iridescence","iridescenceIOR","iridescenceMap","iridescenceThicknessMap","lightMap","lightMapIntensity","map","matcap","metalness","metalnessMap","normalMap","normalScale","opacity","roughness","roughnessMap","sheen","sheenColor","sheenColorMap","sheenRoughnessMap","shininess","specular","specularColor","specularColorMap","specularIntensity","specularIntensityMap","specularMap","thickness","transmission","transmissionMap"],wee=new WeakMap,See=new WeakMap,Tee=new WeakMap,cU=class{constructor(e){this.renderObjects=new WeakMap,this.hasNode=this.containsNode(e),this.hasAnimation=e.object.isSkinnedMesh===!0,this.refreshUniforms=oTe,this.renderId=0}firstInitialization(e){return this.renderObjects.has(e)===!1?(this.getRenderObjectData(e),!0):!1}needsVelocity(e){let t=e.getMRT();return t!==null&&t.has("velocity")}getRenderObjectData(e){let t=this.renderObjects.get(e);if(t===void 0){let{geometry:n,object:r}=e;if(t={geometryId:n.id,worldMatrix:r.matrixWorld.clone()},r.center&&(t.center=r.center.clone()),r.morphTargetInfluences&&(t.morphTargetInfluences=r.morphTargetInfluences.slice()),e.bundle!==null&&(t.version=e.bundle.version),e.material.transmission>0){let{width:a,height:l}=e.context;t.bufferWidth=a,t.bufferHeight=l}let{environmentIntensity:s,environmentRotation:o}=e.scene;t.environmentIntensity=s,t.environmentRotation=o.clone(),t.lights=this.getLightsData(e.lightsNode.getLights(),[]),this.renderObjects.set(e,t)}return t}getAttributesData(e){let t={};for(let n in e){let r=e[n];t[n]={id:r.isInterleavedBufferAttribute?r.data.uuid:r.id,version:r.isInterleavedBufferAttribute?r.data.version:r.version}}return t}containsNode(e){let t=e.material;for(let n in t)if(t[n]&&t[n].isNode)return!0;return!!(e.context.modelViewMatrix||e.context.modelNormalViewMatrix||e.context.getAO||e.context.getShadow)}getGeometryData(e){let t=Tee.get(e);return t===void 0&&(t={_renderId:-1,_equal:!1,attributes:this.getAttributesData(e.attributes),indexId:e.index?e.index.id:null,indexVersion:e.index?e.index.version:null,drawRange:{start:e.drawRange.start,count:e.drawRange.count}},Tee.set(e,t)),t}getMaterialData(e){let t=See.get(e);if(t===void 0){t={_renderId:-1,_equal:!1};for(let n of this.refreshUniforms){let r=e[n];r!=null&&(typeof r=="object"&&r.clone!==void 0?r.isTexture===!0?t[n]={id:r.id,version:0}:t[n]=r.clone():t[n]=r)}See.set(e,t)}return t}equals(e,t,n){let{object:r,material:s,geometry:o}=e,a=this.getRenderObjectData(e);if(a.worldMatrix.equals(r.matrixWorld)!==!0)return a.worldMatrix.copy(r.matrixWorld),!1;let l=this.getMaterialData(e.material);if(l._renderId!==n){l._renderId=n;for(let f in l){let d=l[f],A=s[f];if(f!=="_renderId"&&f!=="_equal"){if(d.equals!==void 0){if(d.equals(A)===!1)return d.copy(A),l._equal=!1,!1}else if(A.isTexture===!0){if(d.id!==A.id||d.version!==A.version)return d.id=A.id,d.version=A.version,l._equal=!1,!1}else if(d!==A)return l[f]=A,l._equal=!1,!1}}if(l.transmission>0){let{width:f,height:d}=e.context;if(a.bufferWidth!==f||a.bufferHeight!==d)return a.bufferWidth=f,a.bufferHeight=d,l._equal=!1,!1}l._equal=!0}else if(l._equal===!1)return!1;if(a.geometryId!==o.id)return a.geometryId=o.id,!1;let c=this.getGeometryData(e.geometry);if(c._renderId!==n){c._renderId=n;let f=o.attributes,d=c.attributes,A=0,y=0;for(let I in f)A++;for(let I in d){y++;let F=d[I],D=f[I];if(D===void 0)return delete d[I],c._equal=!1,!1;let L=D.isInterleavedBufferAttribute?D.data.uuid:D.id,C=D.isInterleavedBufferAttribute?D.data.version:D.version;if(F.id!==L||F.version!==C)return F.id=L,F.version=C,c._equal=!1,!1}if(y!==A)return c.attributes=this.getAttributesData(f),c._equal=!1,!1;let w=o.index,S=c.indexId,T=c.indexVersion,R=w?w.id:null,P=w?w.version:null;if(S!==R||T!==P)return c.indexId=R,c.indexVersion=P,c._equal=!1,!1;if(c.drawRange.start!==o.drawRange.start||c.drawRange.count!==o.drawRange.count)return c.drawRange.start=o.drawRange.start,c.drawRange.count=o.drawRange.count,c._equal=!1,!1;c._equal=!0}else if(c._equal===!1)return!1;if(a.morphTargetInfluences){let f=!1;for(let d=0;d<a.morphTargetInfluences.length;d++)a.morphTargetInfluences[d]!==r.morphTargetInfluences[d]&&(a.morphTargetInfluences[d]=r.morphTargetInfluences[d],f=!0);if(f)return!1}if(a.lights){for(let f=0;f<t.length;f++)if(a.lights[f].map!==t[f].map)return!1}let u=e.scene;return u.environment!==null&&s.envMap===null&&(a.environmentIntensity!==u.environmentIntensity||a.environmentRotation.equals(u.environmentRotation)===!1)?(a.environmentIntensity=u.environmentIntensity,a.environmentRotation.copy(u.environmentRotation),!1):a.center&&a.center.equals(r.center)===!1?(a.center.copy(r.center),!1):(e.bundle!==null&&(a.version=e.bundle.version),!0)}getLightsData(e,t){t.length=0;for(let n of e)n.isSpotLight===!0&&n.map!==null&&t.push({map:n.map.version});return t}getLights(e,t){let n=wee.get(e);return n===void 0&&(n={renderId:-1,lightsData:[]},wee.set(e,n)),n.renderId===t||(n.renderId=t,this.getLightsData(e.getLights(),n.lightsData)),n.lightsData}needsRefresh(e,t){if(this.hasNode||this.hasAnimation||this.firstInitialization(e)||this.needsVelocity(t.renderer))return!0;let{renderId:n}=t;if(this.renderId!==n)return this.renderId=n,!0;let r=e.object.static===!0,s=e.bundle!==null&&e.bundle.static===!0&&this.getRenderObjectData(e).version===e.bundle.version;if(r||s)return!1;let o=this.getLights(e.lightsNode,n);return this.equals(e,o,n)!==!0}},aTe=[/^StackTrace\.js$/,/^TSLCore\.js$/,/^.*Node\.js$/,/^three\.webgpu.*\.js$/];function lTe(i){let e=/(?:at\s+(.+?)\s+\()?(?:(.+?)@)?([^@\s()]+):(\d+):(\d+)/;return i.split(`4131-`).map(t=>{let n=t.match(e);if(!n)return null;let r=n[1]||n[2]||"",s=n[3].split("?")[0],o=parseInt(n[4],10),a=parseInt(n[5],10),l=s.split("/").pop();return{fn:r,file:l,line:o,column:a}}).filter(t=>t&&!aTe.some(n=>n.test(t.file)))}var es=class{constructor(e=null){this.isStackTrace=!0,this.stack=lTe(e||new Error().stack)}getLocation(){if(this.stack.length===0)return"[Unknown location]";let e=this.stack[0],t=e.fn;return`${t?`"${t}()" at `:""}"${e.file}:${e.line}"`}getError(e){if(this.stack.length===0)return e;let t=this.stack.map(n=>{let r=`${n.file}:${n.line}:${n.column}`;return n.fn?` at ${n.fn} (${r})`:` at ${r}`}).join(`4117+}`,FF=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){let n=new k2(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){let t=e.cameras[0].viewport,n=new ds({vertexShader:Hxe,fragmentShader:Wxe,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Hn(new KA(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}},BF=class extends la{constructor(e,t){super();let n=this,r=null,s=1,o=null,a="local-floor",l=1,c=null,u=null,f=null,d=null,A=null,y=null,w=typeof XRWebGLBinding<"u",S=new FF,T={},R=t.getContextAttributes(),P=null,I=null,F=[],D=[],L=new Oe,C=null,B=new $r;B.viewport=new xn;let k=new $r;k.viewport=new xn;let z=[B,k],G=new c_,W=null,Y=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Ee){let Ve=F[Ee];return Ve===void 0&&(Ve=new s0,F[Ee]=Ve),Ve.getTargetRaySpace()},this.getControllerGrip=function(Ee){let Ve=F[Ee];return Ve===void 0&&(Ve=new s0,F[Ee]=Ve),Ve.getGripSpace()},this.getHand=function(Ee){let Ve=F[Ee];return Ve===void 0&&(Ve=new s0,F[Ee]=Ve),Ve.getHandSpace()};function H(Ee){let Ve=D.indexOf(Ee.inputSource);if(Ve===-1)return;let Ye=F[Ve];Ye!==void 0&&(Ye.update(Ee.inputSource,Ee.frame,c||o),Ye.dispatchEvent({type:Ee.type,data:Ee.inputSource}))}function $(){r.removeEventListener("select",H),r.removeEventListener("selectstart",H),r.removeEventListener("selectend",H),r.removeEventListener("squeeze",H),r.removeEventListener("squeezestart",H),r.removeEventListener("squeezeend",H),r.removeEventListener("end",$),r.removeEventListener("inputsourceschange",J);for(let Ee=0;Ee<F.length;Ee++){let Ve=D[Ee];Ve!==null&&(D[Ee]=null,F[Ee].disconnect(Ve))}W=null,Y=null,S.reset();for(let Ee in T)delete T[Ee];e.setRenderTarget(P),A=null,d=null,f=null,r=null,I=null,mt.stop(),n.isPresenting=!1,e.setPixelRatio(C),e.setSize(L.width,L.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(Ee){s=Ee,n.isPresenting===!0&&Xe("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Ee){a=Ee,n.isPresenting===!0&&Xe("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||o},this.setReferenceSpace=function(Ee){c=Ee},this.getBaseLayer=function(){return d!==null?d:A},this.getBinding=function(){return f===null&&w&&(f=new XRWebGLBinding(r,t)),f},this.getFrame=function(){return y},this.getSession=function(){return r},this.setSession=async function(Ee){if(r=Ee,r!==null){if(P=e.getRenderTarget(),r.addEventListener("select",H),r.addEventListener("selectstart",H),r.addEventListener("selectend",H),r.addEventListener("squeeze",H),r.addEventListener("squeezestart",H),r.addEventListener("squeezeend",H),r.addEventListener("end",$),r.addEventListener("inputsourceschange",J),R.xrCompatible!==!0&&await t.makeXRCompatible(),C=e.getPixelRatio(),e.getSize(L),w&&"createProjectionLayer"in XRWebGLBinding.prototype){let Ye=null,Mt=null,Et=null;R.depth&&(Et=R.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,Ye=R.stencil?xo:Gs,Mt=R.stencil?ca:xi);let It={colorFormat:t.RGBA8,depthFormat:Et,scaleFactor:s};f=this.getBinding(),d=f.createProjectionLayer(It),r.updateRenderState({layers:[d]}),e.setPixelRatio(1),e.setSize(d.textureWidth,d.textureHeight,!1),I=new Oa(d.textureWidth,d.textureHeight,{format:Or,type:Ji,depthTexture:new Cs(d.textureWidth,d.textureHeight,Mt,void 0,void 0,void 0,void 0,void 0,void 0,Ye),stencilBuffer:R.stencil,colorSpace:e.outputColorSpace,samples:R.antialias?4:0,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1})}else{let Ye={antialias:R.antialias,alpha:!0,depth:R.depth,stencil:R.stencil,framebufferScaleFactor:s};A=new XRWebGLLayer(r,t,Ye),r.updateRenderState({baseLayer:A}),e.setPixelRatio(1),e.setSize(A.framebufferWidth,A.framebufferHeight,!1),I=new Oa(A.framebufferWidth,A.framebufferHeight,{format:Or,type:Ji,colorSpace:e.outputColorSpace,stencilBuffer:R.stencil,resolveDepthBuffer:A.ignoreDepthValues===!1,resolveStencilBuffer:A.ignoreDepthValues===!1})}I.isXRRenderTarget=!0,this.setFoveation(l),c=null,o=await r.requestReferenceSpace(a),mt.setContext(r),mt.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return S.getDepthTexture()};function J(Ee){for(let Ve=0;Ve<Ee.removed.length;Ve++){let Ye=Ee.removed[Ve],Mt=D.indexOf(Ye);Mt>=0&&(D[Mt]=null,F[Mt].disconnect(Ye))}for(let Ve=0;Ve<Ee.added.length;Ve++){let Ye=Ee.added[Ve],Mt=D.indexOf(Ye);if(Mt===-1){for(let It=0;It<F.length;It++)if(It>=D.length){D.push(Ye),Mt=It;break}else if(D[It]===null){D[It]=Ye,Mt=It;break}if(Mt===-1)break}let Et=F[Mt];Et&&Et.connect(Ye)}}let te=new re,ce=new re;function he(Ee,Ve,Ye){te.setFromMatrixPosition(Ve.matrixWorld),ce.setFromMatrixPosition(Ye.matrixWorld);let Mt=te.distanceTo(ce),Et=Ve.projectionMatrix.elements,It=Ye.projectionMatrix.elements,dn=Et[14]/(Et[10]-1),Gt=Et[14]/(Et[10]+1),$e=(Et[9]+1)/Et[5],ot=(Et[9]-1)/Et[5],nt=(Et[8]-1)/Et[0],bt=(It[8]+1)/It[0],yt=dn*nt,hn=dn*bt,en=Mt/(-nt+bt),tn=en*-nt;if(Ve.matrixWorld.decompose(Ee.position,Ee.quaternion,Ee.scale),Ee.translateX(tn),Ee.translateZ(en),Ee.matrixWorld.compose(Ee.position,Ee.quaternion,Ee.scale),Ee.matrixWorldInverse.copy(Ee.matrixWorld).invert(),Et[10]===-1)Ee.projectionMatrix.copy(Ve.projectionMatrix),Ee.projectionMatrixInverse.copy(Ve.projectionMatrixInverse);else{let bn=dn+en,_e=Gt+en,vi=yt-tn,zn=hn+(Mt-tn),le=$e*Gt/_e*bn,Z=ot*Gt/_e*bn;Ee.projectionMatrix.makePerspective(vi,zn,le,Z,bn,_e),Ee.projectionMatrixInverse.copy(Ee.projectionMatrix).invert()}}function ve(Ee,Ve){Ve===null?Ee.matrixWorld.copy(Ee.matrix):Ee.matrixWorld.multiplyMatrices(Ve.matrixWorld,Ee.matrix),Ee.matrixWorldInverse.copy(Ee.matrixWorld).invert()}this.updateCamera=function(Ee){if(r===null)return;let Ve=Ee.near,Ye=Ee.far;S.texture!==null&&(S.depthNear>0&&(Ve=S.depthNear),S.depthFar>0&&(Ye=S.depthFar)),G.near=k.near=B.near=Ve,G.far=k.far=B.far=Ye,(W!==G.near||Y!==G.far)&&(r.updateRenderState({depthNear:G.near,depthFar:G.far}),W=G.near,Y=G.far),G.layers.mask=Ee.layers.mask|6,B.layers.mask=G.layers.mask&-5,k.layers.mask=G.layers.mask&-3;let Mt=Ee.parent,Et=G.cameras;ve(G,Mt);for(let It=0;It<Et.length;It++)ve(Et[It],Mt);Et.length===2?he(G,B,k):G.projectionMatrix.copy(B.projectionMatrix),Re(Ee,G,Mt)};function Re(Ee,Ve,Ye){Ye===null?Ee.matrix.copy(Ve.matrixWorld):(Ee.matrix.copy(Ye.matrixWorld),Ee.matrix.invert(),Ee.matrix.multiply(Ve.matrixWorld)),Ee.matrix.decompose(Ee.position,Ee.quaternion,Ee.scale),Ee.updateMatrixWorld(!0),Ee.projectionMatrix.copy(Ve.projectionMatrix),Ee.projectionMatrixInverse.copy(Ve.projectionMatrixInverse),Ee.isPerspectiveCamera&&(Ee.fov=Rd*2*Math.atan(1/Ee.projectionMatrix.elements[5]),Ee.zoom=1)}this.getCamera=function(){return G},this.getFoveation=function(){if(!(d===null&&A===null))return l},this.setFoveation=function(Ee){l=Ee,d!==null&&(d.fixedFoveation=Ee),A!==null&&A.fixedFoveation!==void 0&&(A.fixedFoveation=Ee)},this.hasDepthSensing=function(){return S.texture!==null},this.getDepthSensingMesh=function(){return S.getMesh(G)},this.getCameraTexture=function(Ee){return T[Ee]};let Qe=null;function Fe(Ee,Ve){if(u=Ve.getViewerPose(c||o),y=Ve,u!==null){let Ye=u.views;A!==null&&(e.setRenderTargetFramebuffer(I,A.framebuffer),e.setRenderTarget(I));let Mt=!1;Ye.length!==G.cameras.length&&(G.cameras.length=0,Mt=!0);for(let Gt=0;Gt<Ye.length;Gt++){let $e=Ye[Gt],ot=null;if(A!==null)ot=A.getViewport($e);else{let bt=f.getViewSubImage(d,$e);ot=bt.viewport,Gt===0&&(e.setRenderTargetTextures(I,bt.colorTexture,bt.depthStencilTexture),e.setRenderTarget(I))}let nt=z[Gt];nt===void 0&&(nt=new $r,nt.layers.enable(Gt),nt.viewport=new xn,z[Gt]=nt),nt.matrix.fromArray($e.transform.matrix),nt.matrix.decompose(nt.position,nt.quaternion,nt.scale),nt.projectionMatrix.fromArray($e.projectionMatrix),nt.projectionMatrixInverse.copy(nt.projectionMatrix).invert(),nt.viewport.set(ot.x,ot.y,ot.width,ot.height),Gt===0&&(G.matrix.copy(nt.matrix),G.matrix.decompose(G.position,G.quaternion,G.scale)),Mt===!0&&G.cameras.push(nt)}let Et=r.enabledFeatures;if(Et&&Et.includes("depth-sensing")&&r.depthUsage=="gpu-optimized"&&w){f=n.getBinding();let Gt=f.getDepthInformation(Ye[0]);Gt&&Gt.isValid&&Gt.texture&&S.init(Gt,r.renderState)}if(Et&&Et.includes("camera-access")&&w){e.state.unbindTexture(),f=n.getBinding();for(let Gt=0;Gt<Ye.length;Gt++){let $e=Ye[Gt].camera;if($e){let ot=T[$e];ot||(ot=new k2,T[$e]=ot);let nt=f.getCameraImage($e);ot.sourceTexture=nt}}}}for(let Ye=0;Ye<F.length;Ye++){let Mt=D[Ye],Et=F[Ye];Mt!==null&&Et!==void 0&&Et.update(Mt,Ve,c||o)}Qe&&Qe(Ee,Ve),Ve.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:Ve}),y=null}let mt=new iK;mt.setAnimationLoop(Fe),this.setAnimationLoop=function(Ee){Qe=Ee},this.dispose=function(){}}},jxe=new cn,cK=new Mn;cK.set(-1,0,0,0,1,0,0,0,1);function Xxe(i,e){function t(S,T){S.matrixAutoUpdate===!0&&S.updateMatrix(),T.value.copy(S.matrix)}function n(S,T){T.color.getRGB(S.fogColor.value,pF(i)),T.isFog?(S.fogNear.value=T.near,S.fogFar.value=T.far):T.isFogExp2&&(S.fogDensity.value=T.density)}function r(S,T,R,P,I){T.isNodeMaterial?T.uniformsNeedUpdate=!1:T.isMeshBasicMaterial?s(S,T):T.isMeshLambertMaterial?(s(S,T),T.envMap&&(S.envMapIntensity.value=T.envMapIntensity)):T.isMeshToonMaterial?(s(S,T),f(S,T)):T.isMeshPhongMaterial?(s(S,T),u(S,T),T.envMap&&(S.envMapIntensity.value=T.envMapIntensity)):T.isMeshStandardMaterial?(s(S,T),d(S,T),T.isMeshPhysicalMaterial&&A(S,T,I)):T.isMeshMatcapMaterial?(s(S,T),y(S,T)):T.isMeshDepthMaterial?s(S,T):T.isMeshDistanceMaterial?(s(S,T),w(S,T)):T.isMeshNormalMaterial?s(S,T):T.isLineBasicMaterial?(o(S,T),T.isLineDashedMaterial&&a(S,T)):T.isPointsMaterial?l(S,T,R,P):T.isSpriteMaterial?c(S,T):T.isShadowMaterial?(S.color.value.copy(T.color),S.opacity.value=T.opacity):T.isShaderMaterial&&(T.uniformsNeedUpdate=!1)}function s(S,T){S.opacity.value=T.opacity,T.color&&S.diffuse.value.copy(T.color),T.emissive&&S.emissive.value.copy(T.emissive).multiplyScalar(T.emissiveIntensity),T.map&&(S.map.value=T.map,t(T.map,S.mapTransform)),T.alphaMap&&(S.alphaMap.value=T.alphaMap,t(T.alphaMap,S.alphaMapTransform)),T.bumpMap&&(S.bumpMap.value=T.bumpMap,t(T.bumpMap,S.bumpMapTransform),S.bumpScale.value=T.bumpScale,T.side===mi&&(S.bumpScale.value*=-1)),T.normalMap&&(S.normalMap.value=T.normalMap,t(T.normalMap,S.normalMapTransform),S.normalScale.value.copy(T.normalScale),T.side===mi&&S.normalScale.value.negate()),T.displacementMap&&(S.displacementMap.value=T.displacementMap,t(T.displacementMap,S.displacementMapTransform),S.displacementScale.value=T.displacementScale,S.displacementBias.value=T.displacementBias),T.emissiveMap&&(S.emissiveMap.value=T.emissiveMap,t(T.emissiveMap,S.emissiveMapTransform)),T.specularMap&&(S.specularMap.value=T.specularMap,t(T.specularMap,S.specularMapTransform)),T.alphaTest>0&&(S.alphaTest.value=T.alphaTest);let R=e.get(T),P=R.envMap,I=R.envMapRotation;P&&(S.envMap.value=P,S.envMapRotation.value.setFromMatrix4(jxe.makeRotationFromEuler(I)).transpose(),P.isCubeTexture&&P.isRenderTargetTexture===!1&&S.envMapRotation.value.premultiply(cK),S.reflectivity.value=T.reflectivity,S.ior.value=T.ior,S.refractionRatio.value=T.refractionRatio),T.lightMap&&(S.lightMap.value=T.lightMap,S.lightMapIntensity.value=T.lightMapIntensity,t(T.lightMap,S.lightMapTransform)),T.aoMap&&(S.aoMap.value=T.aoMap,S.aoMapIntensity.value=T.aoMapIntensity,t(T.aoMap,S.aoMapTransform))}function o(S,T){S.diffuse.value.copy(T.color),S.opacity.value=T.opacity,T.map&&(S.map.value=T.map,t(T.map,S.mapTransform))}function a(S,T){S.dashSize.value=T.dashSize,S.totalSize.value=T.dashSize+T.gapSize,S.scale.value=T.scale}function l(S,T,R,P){S.diffuse.value.copy(T.color),S.opacity.value=T.opacity,S.size.value=T.size*R,S.scale.value=P*.5,T.map&&(S.map.value=T.map,t(T.map,S.uvTransform)),T.alphaMap&&(S.alphaMap.value=T.alphaMap,t(T.alphaMap,S.alphaMapTransform)),T.alphaTest>0&&(S.alphaTest.value=T.alphaTest)}function c(S,T){S.diffuse.value.copy(T.color),S.opacity.value=T.opacity,S.rotation.value=T.rotation,T.map&&(S.map.value=T.map,t(T.map,S.mapTransform)),T.alphaMap&&(S.alphaMap.value=T.alphaMap,t(T.alphaMap,S.alphaMapTransform)),T.alphaTest>0&&(S.alphaTest.value=T.alphaTest)}function u(S,T){S.specular.value.copy(T.specular),S.shininess.value=Math.max(T.shininess,1e-4)}function f(S,T){T.gradientMap&&(S.gradientMap.value=T.gradientMap)}function d(S,T){S.metalness.value=T.metalness,T.metalnessMap&&(S.metalnessMap.value=T.metalnessMap,t(T.metalnessMap,S.metalnessMapTransform)),S.roughness.value=T.roughness,T.roughnessMap&&(S.roughnessMap.value=T.roughnessMap,t(T.roughnessMap,S.roughnessMapTransform)),T.envMap&&(S.envMapIntensity.value=T.envMapIntensity)}function A(S,T,R){S.ior.value=T.ior,T.sheen>0&&(S.sheenColor.value.copy(T.sheenColor).multiplyScalar(T.sheen),S.sheenRoughness.value=T.sheenRoughness,T.sheenColorMap&&(S.sheenColorMap.value=T.sheenColorMap,t(T.sheenColorMap,S.sheenColorMapTransform)),T.sheenRoughnessMap&&(S.sheenRoughnessMap.value=T.sheenRoughnessMap,t(T.sheenRoughnessMap,S.sheenRoughnessMapTransform))),T.clearcoat>0&&(S.clearcoat.value=T.clearcoat,S.clearcoatRoughness.value=T.clearcoatRoughness,T.clearcoatMap&&(S.clearcoatMap.value=T.clearcoatMap,t(T.clearcoatMap,S.clearcoatMapTransform)),T.clearcoatRoughnessMap&&(S.clearcoatRoughnessMap.value=T.clearcoatRoughnessMap,t(T.clearcoatRoughnessMap,S.clearcoatRoughnessMapTransform)),T.clearcoatNormalMap&&(S.clearcoatNormalMap.value=T.clearcoatNormalMap,t(T.clearcoatNormalMap,S.clearcoatNormalMapTransform),S.clearcoatNormalScale.value.copy(T.clearcoatNormalScale),T.side===mi&&S.clearcoatNormalScale.value.negate())),T.dispersion>0&&(S.dispersion.value=T.dispersion),T.iridescence>0&&(S.iridescence.value=T.iridescence,S.iridescenceIOR.value=T.iridescenceIOR,S.iridescenceThicknessMinimum.value=T.iridescenceThicknessRange[0],S.iridescenceThicknessMaximum.value=T.iridescenceThicknessRange[1],T.iridescenceMap&&(S.iridescenceMap.value=T.iridescenceMap,t(T.iridescenceMap,S.iridescenceMapTransform)),T.iridescenceThicknessMap&&(S.iridescenceThicknessMap.value=T.iridescenceThicknessMap,t(T.iridescenceThicknessMap,S.iridescenceThicknessMapTransform))),T.transmission>0&&(S.transmission.value=T.transmission,S.transmissionSamplerMap.value=R.texture,S.transmissionSamplerSize.value.set(R.width,R.height),T.transmissionMap&&(S.transmissionMap.value=T.transmissionMap,t(T.transmissionMap,S.transmissionMapTransform)),S.thickness.value=T.thickness,T.thicknessMap&&(S.thicknessMap.value=T.thicknessMap,t(T.thicknessMap,S.thicknessMapTransform)),S.attenuationDistance.value=T.attenuationDistance,S.attenuationColor.value.copy(T.attenuationColor)),T.anisotropy>0&&(S.anisotropyVector.value.set(T.anisotropy*Math.cos(T.anisotropyRotation),T.anisotropy*Math.sin(T.anisotropyRotation)),T.anisotropyMap&&(S.anisotropyMap.value=T.anisotropyMap,t(T.anisotropyMap,S.anisotropyMapTransform))),S.specularIntensity.value=T.specularIntensity,S.specularColor.value.copy(T.specularColor),T.specularColorMap&&(S.specularColorMap.value=T.specularColorMap,t(T.specularColorMap,S.specularColorMapTransform)),T.specularIntensityMap&&(S.specularIntensityMap.value=T.specularIntensityMap,t(T.specularIntensityMap,S.specularIntensityMapTransform))}function y(S,T){T.matcap&&(S.matcap.value=T.matcap)}function w(S,T){let R=e.get(T).light;S.referencePosition.value.setFromMatrixPosition(R.matrixWorld),S.nearDistance.value=R.shadow.camera.near,S.farDistance.value=R.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:r}}function $xe(i,e,t,n){let r={},s={},o=[],a=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function l(I,F){let D=F.program;n.uniformBlockBinding(I,D)}function c(I,F){let D=r[I.id];D===void 0&&(S(I),D=u(I),r[I.id]=D,I.addEventListener("dispose",R));let L=F.program;n.updateUBOMapping(I,L);let C=e.render.frame;s[I.id]!==C&&(d(I),s[I.id]=C)}function u(I){let F=f();I.__bindingPointIndex=F;let D=i.createBuffer(),L=I.__size,C=I.usage;return i.bindBuffer(i.UNIFORM_BUFFER,D),i.bufferData(i.UNIFORM_BUFFER,L,C),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,F,D),D}function f(){for(let I=0;I<a;I++)if(o.indexOf(I)===-1)return o.push(I),I;return ze("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function d(I){let F=r[I.id],D=I.uniforms,L=I.__cache;i.bindBuffer(i.UNIFORM_BUFFER,F);for(let C=0,B=D.length;C<B;C++){let k=D[C];if(Array.isArray(k))for(let z=0,G=k.length;z<G;z++)A(k[z],C,z,L);else A(k,C,0,L)}i.bindBuffer(i.UNIFORM_BUFFER,null)}function A(I,F,D,L){if(w(I,F,D,L)===!0){let C=I.__offset,B=I.value;if(Array.isArray(B)){let k=0;for(let z=0;z<B.length;z++){let G=B[z],W=T(G);y(G,I.__data,k),typeof G!="number"&&typeof G!="boolean"&&!G.isMatrix3&&!ArrayBuffer.isView(G)&&(k+=W.storage/Float32Array.BYTES_PER_ELEMENT)}}else y(B,I.__data,0);i.bufferSubData(i.UNIFORM_BUFFER,C,I.__data)}}function y(I,F,D){typeof I=="number"||typeof I=="boolean"?F[0]=I:I.isMatrix3?(F[0]=I.elements[0],F[1]=I.elements[1],F[2]=I.elements[2],F[3]=0,F[4]=I.elements[3],F[5]=I.elements[4],F[6]=I.elements[5],F[7]=0,F[8]=I.elements[6],F[9]=I.elements[7],F[10]=I.elements[8],F[11]=0):ArrayBuffer.isView(I)?F.set(new I.constructor(I.buffer,I.byteOffset,F.length)):I.toArray(F,D)}function w(I,F,D,L){let C=I.value,B=F+"_"+D;if(L[B]===void 0)return typeof C=="number"||typeof C=="boolean"?L[B]=C:ArrayBuffer.isView(C)?L[B]=C.slice():L[B]=C.clone(),!0;{let k=L[B];if(typeof C=="number"||typeof C=="boolean"){if(k!==C)return L[B]=C,!0}else{if(ArrayBuffer.isView(C))return!0;if(k.equals(C)===!1)return k.copy(C),!0}}return!1}function S(I){let F=I.uniforms,D=0,L=16;for(let B=0,k=F.length;B<k;B++){let z=Array.isArray(F[B])?F[B]:[F[B]];for(let G=0,W=z.length;G<W;G++){let Y=z[G],H=Array.isArray(Y.value)?Y.value:[Y.value];for(let $=0,J=H.length;$<J;$++){let te=H[$],ce=T(te),he=D%L,ve=he%ce.boundary,Re=he+ve;D+=ve,Re!==0&&L-Re<ce.storage&&(D+=L-Re),Y.__data=new Float32Array(ce.storage/Float32Array.BYTES_PER_ELEMENT),Y.__offset=D,D+=ce.storage}}}let C=D%L;return C>0&&(D+=L-C),I.__size=D,I.__cache={},this}function T(I){let F={boundary:0,storage:0};return typeof I=="number"||typeof I=="boolean"?(F.boundary=4,F.storage=4):I.isVector2?(F.boundary=8,F.storage=8):I.isVector3||I.isColor?(F.boundary=16,F.storage=12):I.isVector4?(F.boundary=16,F.storage=16):I.isMatrix3?(F.boundary=48,F.storage=48):I.isMatrix4?(F.boundary=64,F.storage=64):I.isTexture?Xe("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ArrayBuffer.isView(I)?(F.boundary=16,F.storage=I.byteLength):Xe("WebGLRenderer: Unsupported uniform value type.",I),F}function R(I){let F=I.target;F.removeEventListener("dispose",R);let D=o.indexOf(F.__bindingPointIndex);o.splice(D,1),i.deleteBuffer(r[F.id]),delete r[F.id],delete s[F.id]}function P(){for(let I in r)i.deleteBuffer(r[I]);o=[],r={},s={}}return{bind:l,update:c,dispose:P}}var Yxe=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]),Kh=null;function Zxe(){return Kh===null&&(Kh=new jA(Yxe,16,16,js,Wi),Kh.name="DFG_LUT",Kh.minFilter=Mi,Kh.magFilter=Mi,Kh.wrapS=aa,Kh.wrapT=aa,Kh.generateMipmaps=!1,Kh.needsUpdate=!0),Kh}var XM=class{constructor(e={}){let{canvas:t=GM(),context:n=null,depth:r=!0,stencil:s=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:f=!1,reversedDepthBuffer:d=!1,outputBufferType:A=Ji}=e;this.isWebGLRenderer=!0;let y;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");y=n.getContextAttributes().alpha}else y=o;let w=A,S=new Set([v0,qh,Gh]),T=new Set([Ji,xi,wl,ca,rg,sg]),R=new Uint32Array(4),P=new Int32Array(4),I=new re,F=null,D=null,L=[],C=[],B=null;this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=ao,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let k=this,z=!1,G=null,W=null,Y=null,H=null;this._outputColorSpace=Fr;let $=0,J=0,te=null,ce=-1,he=null,ve=new xn,Re=new xn,Qe=null,Fe=new zt(0),mt=0,Ee=t.width,Ve=t.height,Ye=1,Mt=null,Et=null,It=new xn(0,0,Ee,Ve),dn=new xn(0,0,Ee,Ve),Gt=!1,$e=new qc,ot=!1,nt=!1,bt=new cn,yt=new re,hn=new xn,en={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},tn=!1;function bn(){return te===null?Ye:1}let _e=n;function vi(ne,Se){return t.getContext(ne,Se)}try{let ne={alpha:!0,depth:r,stencil:s,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:f};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${"185"}`),t.addEventListener("webglcontextlost",nr,!1),t.addEventListener("webglcontextrestored",Fn,!1),t.addEventListener("webglcontextcreationerror",is,!1),_e===null){let Se="webgl2";if(_e=vi(Se,ne),_e===null)throw vi(Se)?new Error("THREE.WebGLRenderer: Error creating WebGL context with your selected attributes."):new Error("THREE.WebGLRenderer: Error creating WebGL context.")}}catch(ne){throw ze("WebGLRenderer: "+ne.message),ne}let zn,le,Z,Te,Pe,Ge,vt,Tt,qe,Je,Pt,rn,Lt,Rt,fn,wn,Dn,ye,wt,Ze,St,Bt,ut;function Ce(){zn=new i_e(_e),zn.init(),St=new qxe(_e,zn),le=new Yve(_e,zn,e,St),Z=new Vxe(_e,zn),le.reversedDepthBuffer&&d&&Z.buffers.depth.setReversed(!0),W=_e.createFramebuffer(),Y=_e.createFramebuffer(),H=_e.createFramebuffer(),Te=new o_e(_e),Pe=new Mxe,Ge=new Gxe(_e,zn,Z,Pe,le,St,Te),vt=new n_e(k),Tt=new uge(_e),Bt=new Xve(_e,Tt),qe=new r_e(_e,Tt,Te,Bt),Je=new l_e(_e,qe,Tt,Bt,Te),ye=new a_e(_e,le,Ge),fn=new Zve(Pe),Pt=new Exe(k,vt,zn,le,Bt,fn),rn=new Xxe(k,Pe),Lt=new Rxe,Rt=new Fxe(zn),Dn=new jve(k,vt,Z,Je,y,l),wn=new zxe(k,Je,le),ut=new $xe(_e,Te,le,Z),wt=new $ve(_e,zn,Te),Ze=new s_e(_e,zn,Te),Te.programs=Pt.programs,k.capabilities=le,k.extensions=zn,k.properties=Pe,k.renderLists=Lt,k.shadowMap=wn,k.state=Z,k.info=Te}Ce(),w!==Ji&&(B=new u_e(w,t.width,t.height,a,r,s));let Yt=new BF(k,_e);this.xr=Yt,this.getContext=function(){return _e},this.getContextAttributes=function(){return _e.getContextAttributes()},this.forceContextLoss=function(){let ne=zn.get("WEBGL_lose_context");ne&&ne.loseContext()},this.forceContextRestore=function(){let ne=zn.get("WEBGL_lose_context");ne&&ne.restoreContext()},this.getPixelRatio=function(){return Ye},this.setPixelRatio=function(ne){ne!==void 0&&(Ye=ne,this.setSize(Ee,Ve,!1))},this.getSize=function(ne){return ne.set(Ee,Ve)},this.setSize=function(ne,Se,ke=!0){if(Yt.isPresenting){Xe("WebGLRenderer: Can't change size while VR device is presenting.");return}Ee=ne,Ve=Se,t.width=Math.floor(ne*Ye),t.height=Math.floor(Se*Ye),ke===!0&&(t.style.width=ne+"px",t.style.height=Se+"px"),B!==null&&B.setSize(t.width,t.height),this.setViewport(0,0,ne,Se)},this.getDrawingBufferSize=function(ne){return ne.set(Ee*Ye,Ve*Ye).floor()},this.setDrawingBufferSize=function(ne,Se,ke){Ee=ne,Ve=Se,Ye=ke,t.width=Math.floor(ne*ke),t.height=Math.floor(Se*ke),this.setViewport(0,0,ne,Se)},this.setEffects=function(ne){if(w===Ji){ze("WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(ne){for(let Se=0;Se<ne.length;Se++)if(ne[Se].isOutputPass===!0){Xe("WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}B.setEffects(ne||[])},this.getCurrentViewport=function(ne){return ne.copy(ve)},this.getViewport=function(ne){return ne.copy(It)},this.setViewport=function(ne,Se,ke,De){ne.isVector4?It.set(ne.x,ne.y,ne.z,ne.w):It.set(ne,Se,ke,De),Z.viewport(ve.copy(It).multiplyScalar(Ye).round())},this.getScissor=function(ne){return ne.copy(dn)},this.setScissor=function(ne,Se,ke,De){ne.isVector4?dn.set(ne.x,ne.y,ne.z,ne.w):dn.set(ne,Se,ke,De),Z.scissor(Re.copy(dn).multiplyScalar(Ye).round())},this.getScissorTest=function(){return Gt},this.setScissorTest=function(ne){Z.setScissorTest(Gt=ne)},this.setOpaqueSort=function(ne){Mt=ne},this.setTransparentSort=function(ne){Et=ne},this.getClearColor=function(ne){return ne.copy(Dn.getClearColor())},this.setClearColor=function(){Dn.setClearColor(...arguments)},this.getClearAlpha=function(){return Dn.getClearAlpha()},this.setClearAlpha=function(){Dn.setClearAlpha(...arguments)},this.clear=function(ne=!0,Se=!0,ke=!0){let De=0;if(ne){let Ne=!1;if(te!==null){let qt=te.texture.format;Ne=S.has(qt)}if(Ne){let qt=te.texture.type,Qt=T.has(qt),Vt=Dn.getClearColor(),sn=Dn.getClearAlpha(),pn=Vt.r,Wn=Vt.g,Jn=Vt.b;Qt?(R[0]=pn,R[1]=Wn,R[2]=Jn,R[3]=sn,_e.clearBufferuiv(_e.COLOR,0,R)):(P[0]=pn,P[1]=Wn,P[2]=Jn,P[3]=sn,_e.clearBufferiv(_e.COLOR,0,P))}else De|=_e.COLOR_BUFFER_BIT}Se&&(De|=_e.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0)),ke&&(De|=_e.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),De!==0&&_e.clear(De)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.setNodesHandler=function(ne){ne.setRenderer(this),G=ne},this.dispose=function(){t.removeEventListener("webglcontextlost",nr,!1),t.removeEventListener("webglcontextrestored",Fn,!1),t.removeEventListener("webglcontextcreationerror",is,!1),Dn.dispose(),Lt.dispose(),Rt.dispose(),Pe.dispose(),vt.dispose(),Je.dispose(),Bt.dispose(),ut.dispose(),Pt.dispose(),Yt.dispose(),Yt.removeEventListener("sessionstart",Ks),Yt.removeEventListener("sessionend",Ol),rh.stop()};function nr(ne){ne.preventDefault(),VA("WebGLRenderer: Context Lost."),z=!0}function Fn(){VA("WebGLRenderer: Context Restored."),z=!1;let ne=Te.autoReset,Se=wn.enabled,ke=wn.autoUpdate,De=wn.needsUpdate,Ne=wn.type;Ce(),Te.autoReset=ne,wn.enabled=Se,wn.autoUpdate=ke,wn.needsUpdate=De,wn.type=Ne}function is(ne){ze("WebGLRenderer: A WebGL context could not be created. Reason: ",ne.statusMessage)}function Lr(ne){let Se=ne.target;Se.removeEventListener("dispose",Lr),Fl(Se)}function Fl(ne){wa(ne),Pe.remove(ne)}function wa(ne){let Se=Pe.get(ne).programs;Se!==void 0&&(Se.forEach(function(ke){Pt.releaseProgram(ke)}),ne.isShaderMaterial&&Pt.releaseShaderCache(ne))}this.renderBufferDirect=function(ne,Se,ke,De,Ne,qt){Se===null&&(Se=en);let Qt=Ne.isMesh&&Ne.matrixWorld.determinantAffine()<0,Vt=kG(ne,Se,ke,De,Ne);Z.setMaterial(De,Qt);let sn=ke.index,pn=1;if(De.wireframe===!0){if(sn=qe.getWireframeAttribute(ke),sn===void 0)return;pn=2}let Wn=ke.drawRange,Jn=ke.attributes.position,gn=Wn.start*pn,Yi=(Wn.start+Wn.count)*pn;qt!==null&&(gn=Math.max(gn,qt.start*pn),Yi=Math.min(Yi,(qt.start+qt.count)*pn)),sn!==null?(gn=Math.max(gn,0),Yi=Math.min(Yi,sn.count)):Jn!=null&&(gn=Math.max(gn,0),Yi=Math.min(Yi,Jn.count));let rs=Yi-gn;if(rs<0||rs===1/0)return;Bt.setup(Ne,De,Vt,ke,sn);let qr,ir=wt;if(sn!==null&&(qr=Tt.get(sn),ir=Ze,ir.setIndex(qr)),Ne.isMesh)De.wireframe===!0?(Z.setLineWidth(De.wireframeLinewidth*bn()),ir.setMode(_e.LINES)):ir.setMode(_e.TRIANGLES);else if(Ne.isLine){let Co=De.linewidth;Co===void 0&&(Co=1),Z.setLineWidth(Co*bn()),Ne.isLineSegments?ir.setMode(_e.LINES):Ne.isLineLoop?ir.setMode(_e.LINE_LOOP):ir.setMode(_e.LINE_STRIP)}else Ne.isPoints?ir.setMode(_e.POINTS):Ne.isSprite&&ir.setMode(_e.TRIANGLES);if(Ne.isBatchedMesh)if(zn.get("WEBGL_multi_draw"))ir.renderMultiDraw(Ne._multiDrawStarts,Ne._multiDrawCounts,Ne._multiDrawCount);else{let Co=Ne._multiDrawStarts,Zt=Ne._multiDrawCounts,sl=Ne._multiDrawCount,yi=sn?Tt.get(sn).bytesPerElement:1,Ul=Pe.get(De).currentProgram.getUniforms();for(let hu=0;hu<sl;hu++)Ul.setValue(_e,"_gl_DrawID",hu),ir.render(Co[hu]/yi,Zt[hu])}else if(Ne.isInstancedMesh)ir.renderInstances(gn,rs,Ne.count);else if(ke.isInstancedBufferGeometry){let Co=ke._maxInstanceCount!==void 0?ke._maxInstanceCount:1/0,Zt=Math.min(ke.instanceCount,Co);ir.renderInstances(gn,rs,Zt)}else ir.render(gn,rs)};function Bl(ne,Se,ke){ne.transparent===!0&&ne.side===vr&&ne.forceSinglePass===!1?(ne.side=mi,ne.needsUpdate=!0,Hx(ne,Se,ke),ne.side=ko,ne.needsUpdate=!0,Hx(ne,Se,ke),ne.side=vr):Hx(ne,Se,ke)}this.compile=function(ne,Se,ke=null){ke===null&&(ke=ne),D=Rt.get(ke),D.init(Se),C.push(D),ke.traverseVisible(function(Ne){Ne.isLight&&Ne.layers.test(Se.layers)&&(D.pushLight(Ne),Ne.castShadow&&D.pushShadow(Ne))}),ne!==ke&&ne.traverseVisible(function(Ne){Ne.isLight&&Ne.layers.test(Se.layers)&&(D.pushLight(Ne),Ne.castShadow&&D.pushShadow(Ne))}),D.setupLights();let De=new Set;return ne.traverse(function(Ne){if(!(Ne.isMesh||Ne.isPoints||Ne.isLine||Ne.isSprite))return;let qt=Ne.material;if(qt)if(Array.isArray(qt))for(let Qt=0;Qt<qt.length;Qt++){let Vt=qt[Qt];Bl(Vt,ke,Ne),De.add(Vt)}else Bl(qt,ke,Ne),De.add(qt)}),D=C.pop(),De},this.compileAsync=function(ne,Se,ke=null){let De=this.compile(ne,Se,ke);return new Promise(Ne=>{function qt(){if(De.forEach(function(Qt){Pe.get(Qt).currentProgram.isReady()&&De.delete(Qt)}),De.size===0){Ne(ne);return}setTimeout(qt,10)}zn.get("KHR_parallel_shader_compile")!==null?qt():setTimeout(qt,10)})};let rl=null;function xr(ne){rl&&rl(ne)}function Ks(){rh.stop()}function Ol(){rh.start()}let rh=new iK;rh.setAnimationLoop(xr),typeof self<"u"&&rh.setContext(self),this.setAnimationLoop=function(ne){rl=ne,Yt.setAnimationLoop(ne),ne===null?rh.stop():rh.start()},Yt.addEventListener("sessionstart",Ks),Yt.addEventListener("sessionend",Ol),this.render=function(ne,Se){if(Se!==void 0&&Se.isCamera!==!0){ze("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(z===!0)return;G!==null&&G.renderStart(ne,Se);let ke=Yt.enabled===!0&&Yt.isPresenting===!0,De=B!==null&&(te===null||ke)&&B.begin(k,te);if(ne.matrixWorldAutoUpdate===!0&&ne.updateMatrixWorld(),Se.parent===null&&Se.matrixWorldAutoUpdate===!0&&Se.updateMatrixWorld(),Yt.enabled===!0&&Yt.isPresenting===!0&&(B===null||B.isCompositing()===!1)&&(Yt.cameraAutoUpdate===!0&&Yt.updateCamera(Se),Se=Yt.getCamera()),ne.isScene===!0&&ne.onBeforeRender(k,ne,Se,te),D=Rt.get(ne,C.length),D.init(Se),D.state.textureUnits=Ge.getTextureUnits(),C.push(D),bt.multiplyMatrices(Se.projectionMatrix,Se.matrixWorldInverse),$e.setFromProjectionMatrix(bt,Uo,Se.reversedDepth),nt=this.localClippingEnabled,ot=fn.init(this.clippingPlanes,nt),F=Lt.get(ne,L.length),F.init(),L.push(F),Yt.enabled===!0&&Yt.isPresenting===!0){let Qt=k.xr.getDepthSensingMesh();Qt!==null&&rT(Qt,Se,-1/0,k.sortObjects)}rT(ne,Se,0,k.sortObjects),F.finish(),k.sortObjects===!0&&F.sort(Mt,Et,Se.reversedDepth),tn=Yt.enabled===!1||Yt.isPresenting===!1||Yt.hasDepthSensing()===!1,tn&&Dn.addToRenderList(F,ne),this.info.render.frame++,this.info.autoReset===!0&&this.info.reset(),ot===!0&&fn.beginShadows();let Ne=D.state.shadowsArray;if(wn.render(Ne,ne,Se),ot===!0&&fn.endShadows(),(De&&B.hasRenderPass())===!1){let Qt=F.opaque,Vt=F.transmissive;if(D.setupLights(),Se.isArrayCamera){let sn=Se.cameras;if(Vt.length>0)for(let pn=0,Wn=sn.length;pn<Wn;pn++){let Jn=sn[pn];ZP(Qt,Vt,ne,Jn)}tn&&Dn.render(ne);for(let pn=0,Wn=sn.length;pn<Wn;pn++){let Jn=sn[pn];YP(F,ne,Jn,Jn.viewport)}}else Vt.length>0&&ZP(Qt,Vt,ne,Se),tn&&Dn.render(ne),YP(F,ne,Se)}te!==null&&J===0&&(Ge.updateMultisampleRenderTarget(te),Ge.updateRenderTargetMipmap(te)),De&&B.end(k),ne.isScene===!0&&ne.onAfterRender(k,ne,Se),Bt.resetDefaultState(),ce=-1,he=null,C.pop(),C.length>0?(D=C[C.length-1],Ge.setTextureUnits(D.state.textureUnits),ot===!0&&fn.setGlobalState(k.clippingPlanes,D.state.camera)):D=null,L.pop(),L.length>0?F=L[L.length-1]:F=null,G!==null&&G.renderEnd()};function rT(ne,Se,ke,De){if(ne.visible===!1)return;if(ne.layers.test(Se.layers)){if(ne.isGroup)ke=ne.renderOrder;else if(ne.isLOD)ne.autoUpdate===!0&&ne.update(Se);else if(ne.isLightProbeGrid)D.pushLightProbeGrid(ne);else if(ne.isLight)D.pushLight(ne),ne.castShadow&&D.pushShadow(ne);else if(ne.isSprite){if(!ne.frustumCulled||$e.intersectsSprite(ne)){De&&hn.setFromMatrixPosition(ne.matrixWorld).applyMatrix4(bt);let Qt=Je.update(ne),Vt=ne.material;Vt.visible&&F.push(ne,Qt,Vt,ke,hn.z,null)}}else if((ne.isMesh||ne.isLine||ne.isPoints)&&(!ne.frustumCulled||$e.intersectsObject(ne))){let Qt=Je.update(ne),Vt=ne.material;if(De&&(ne.boundingSphere!==void 0?(ne.boundingSphere===null&&ne.computeBoundingSphere(),hn.copy(ne.boundingSphere.center)):(Qt.boundingSphere===null&&Qt.computeBoundingSphere(),hn.copy(Qt.boundingSphere.center)),hn.applyMatrix4(ne.matrixWorld).applyMatrix4(bt)),Array.isArray(Vt)){let sn=Qt.groups;for(let pn=0,Wn=sn.length;pn<Wn;pn++){let Jn=sn[pn],gn=Vt[Jn.materialIndex];gn&&gn.visible&&F.push(ne,Qt,gn,ke,hn.z,Jn)}}else Vt.visible&&F.push(ne,Qt,Vt,ke,hn.z,null)}}let qt=ne.children;for(let Qt=0,Vt=qt.length;Qt<Vt;Qt++)rT(qt[Qt],Se,ke,De)}function YP(ne,Se,ke,De){let{opaque:Ne,transmissive:qt,transparent:Qt}=ne;D.setupLightsView(ke),ot===!0&&fn.setGlobalState(k.clippingPlanes,ke),De&&Z.viewport(ve.copy(De)),Ne.length>0&&qx(Ne,Se,ke),qt.length>0&&qx(qt,Se,ke),Qt.length>0&&qx(Qt,Se,ke),Z.buffers.depth.setTest(!0),Z.buffers.depth.setMask(!0),Z.buffers.color.setMask(!0),Z.setPolygonOffset(!1)}function ZP(ne,Se,ke,De){if((ke.isScene===!0?ke.overrideMaterial:null)!==null)return;if(D.state.transmissionRenderTarget[De.id]===void 0){let gn=zn.has("EXT_color_buffer_half_float")||zn.has("EXT_color_buffer_float");D.state.transmissionRenderTarget[De.id]=new Oa(1,1,{generateMipmaps:!0,type:gn?Wi:Ji,minFilter:Vo,samples:Math.max(4,le.samples),stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:ln.workingColorSpace})}let qt=D.state.transmissionRenderTarget[De.id],Qt=De.viewport||ve;qt.setSize(Qt.z*k.transmissionResolutionScale,Qt.w*k.transmissionResolutionScale);let Vt=k.getRenderTarget(),sn=k.getActiveCubeFace(),pn=k.getActiveMipmapLevel();k.setRenderTarget(qt),k.getClearColor(Fe),mt=k.getClearAlpha(),mt<1&&k.setClearColor(16777215,.5),k.clear(),tn&&Dn.render(ke);let Wn=k.toneMapping;k.toneMapping=ao;let Jn=De.viewport;if(De.viewport!==void 0&&(De.viewport=void 0),D.setupLightsView(De),ot===!0&&fn.setGlobalState(k.clippingPlanes,De),qx(ne,ke,De),Ge.updateMultisampleRenderTarget(qt),Ge.updateRenderTargetMipmap(qt),zn.has("WEBGL_multisampled_render_to_texture")===!1){let gn=!1;for(let Yi=0,rs=Se.length;Yi<rs;Yi++){let qr=Se[Yi],{object:ir,geometry:Co,material:Zt,group:sl}=qr;if(Zt.side===vr&&ir.layers.test(De.layers)){let yi=Zt.side;Zt.side=mi,Zt.needsUpdate=!0,KP(ir,ke,De,Co,Zt,sl),Zt.side=yi,Zt.needsUpdate=!0,gn=!0}}gn===!0&&(Ge.updateMultisampleRenderTarget(qt),Ge.updateRenderTargetMipmap(qt))}k.setRenderTarget(Vt,sn,pn),k.setClearColor(Fe,mt),Jn!==void 0&&(De.viewport=Jn),k.toneMapping=Wn}function qx(ne,Se,ke){let De=Se.isScene===!0?Se.overrideMaterial:null;for(let Ne=0,qt=ne.length;Ne<qt;Ne++){let Qt=ne[Ne],{object:Vt,geometry:sn,group:pn}=Qt,Wn=Qt.material;Wn.allowOverride===!0&&De!==null&&(Wn=De),Vt.layers.test(ke.layers)&&KP(Vt,Se,ke,sn,Wn,pn)}}function KP(ne,Se,ke,De,Ne,qt){ne.onBeforeRender(k,Se,ke,De,Ne,qt),ne.modelViewMatrix.multiplyMatrices(ke.matrixWorldInverse,ne.matrixWorld),ne.normalMatrix.getNormalMatrix(ne.modelViewMatrix),Ne.onBeforeRender(k,Se,ke,De,ne,qt),Ne.transparent===!0&&Ne.side===vr&&Ne.forceSinglePass===!1?(Ne.side=mi,Ne.needsUpdate=!0,k.renderBufferDirect(ke,Se,De,Ne,ne,qt),Ne.side=ko,Ne.needsUpdate=!0,k.renderBufferDirect(ke,Se,De,Ne,ne,qt),Ne.side=vr):k.renderBufferDirect(ke,Se,De,Ne,ne,qt),ne.onAfterRender(k,Se,ke,De,Ne,qt)}function Hx(ne,Se,ke){Se.isScene!==!0&&(Se=en);let De=Pe.get(ne),Ne=D.state.lights,qt=D.state.shadowsArray,Qt=Ne.state.version,Vt=Pt.getParameters(ne,Ne.state,qt,Se,ke,D.state.lightProbeGridArray),sn=Pt.getProgramCacheKey(Vt),pn=De.programs;De.environment=ne.isMeshStandardMaterial||ne.isMeshLambertMaterial||ne.isMeshPhongMaterial?Se.environment:null,De.fog=Se.fog;let Wn=ne.isMeshStandardMaterial||ne.isMeshLambertMaterial&&!ne.envMap||ne.isMeshPhongMaterial&&!ne.envMap;De.envMap=vt.get(ne.envMap||De.environment,Wn),De.envMapRotation=De.environment!==null&&ne.envMap===null?Se.environmentRotation:ne.envMapRotation,pn===void 0&&(ne.addEventListener("dispose",Lr),pn=new Map,De.programs=pn);let Jn=pn.get(sn);if(Jn!==void 0){if(De.currentProgram===Jn&&De.lightsStateVersion===Qt)return JP(ne,Vt),Jn}else Vt.uniforms=Pt.getUniforms(ne),G!==null&&ne.isNodeMaterial&&G.build(ne,ke,Vt),ne.onBeforeCompile(Vt,k),Jn=Pt.acquireProgram(Vt,sn),pn.set(sn,Jn),De.uniforms=Vt.uniforms;let gn=De.uniforms;return(!ne.isShaderMaterial&&!ne.isRawShaderMaterial||ne.clipping===!0)&&(gn.clippingPlanes=fn.uniform),JP(ne,Vt),De.needsLights=VG(ne),De.lightsStateVersion=Qt,De.needsLights&&(gn.ambientLightColor.value=Ne.state.ambient,gn.lightProbe.value=Ne.state.probe,gn.directionalLights.value=Ne.state.directional,gn.directionalLightShadows.value=Ne.state.directionalShadow,gn.spotLights.value=Ne.state.spot,gn.spotLightShadows.value=Ne.state.spotShadow,gn.rectAreaLights.value=Ne.state.rectArea,gn.ltc_1.value=Ne.state.rectAreaLTC1,gn.ltc_2.value=Ne.state.rectAreaLTC2,gn.pointLights.value=Ne.state.point,gn.pointLightShadows.value=Ne.state.pointShadow,gn.hemisphereLights.value=Ne.state.hemi,gn.directionalShadowMatrix.value=Ne.state.directionalShadowMatrix,gn.spotLightMatrix.value=Ne.state.spotLightMatrix,gn.spotLightMap.value=Ne.state.spotLightMap,gn.pointShadowMatrix.value=Ne.state.pointShadowMatrix),De.lightProbeGrid=D.state.lightProbeGridArray.length>0,De.currentProgram=Jn,De.uniformsList=null,Jn}function QP(ne){if(ne.uniformsList===null){let Se=ne.currentProgram.getUniforms();ne.uniformsList=A_.seqWithValue(Se.seq,ne.uniforms)}return ne.uniformsList}function JP(ne,Se){let ke=Pe.get(ne);ke.outputColorSpace=Se.outputColorSpace,ke.batching=Se.batching,ke.batchingColor=Se.batchingColor,ke.instancing=Se.instancing,ke.instancingColor=Se.instancingColor,ke.instancingMorph=Se.instancingMorph,ke.skinning=Se.skinning,ke.morphTargets=Se.morphTargets,ke.morphNormals=Se.morphNormals,ke.morphColors=Se.morphColors,ke.morphTargetsCount=Se.morphTargetsCount,ke.numClippingPlanes=Se.numClippingPlanes,ke.numIntersection=Se.numClipIntersection,ke.vertexAlphas=Se.vertexAlphas,ke.vertexTangents=Se.vertexTangents,ke.toneMapping=Se.toneMapping}function UG(ne,Se){if(ne.length===0)return null;if(ne.length===1)return ne[0].texture!==null?ne[0]:null;I.setFromMatrixPosition(Se.matrixWorld);for(let ke=0,De=ne.length;ke<De;ke++){let Ne=ne[ke];if(Ne.texture!==null&&Ne.boundingBox.containsPoint(I))return Ne}return null}function kG(ne,Se,ke,De,Ne){Se.isScene!==!0&&(Se=en),Ge.resetTextureUnits();let qt=Se.fog,Qt=De.isMeshStandardMaterial||De.isMeshLambertMaterial||De.isMeshPhongMaterial?Se.environment:null,Vt=te===null?k.outputColorSpace:te.isXRRenderTarget===!0?te.texture.colorSpace:ln.workingColorSpace,sn=De.isMeshStandardMaterial||De.isMeshLambertMaterial&&!De.envMap||De.isMeshPhongMaterial&&!De.envMap,pn=vt.get(De.envMap||Qt,sn),Wn=De.vertexColors===!0&&!!ke.attributes.color&&ke.attributes.color.itemSize===4,Jn=!!ke.attributes.tangent&&(!!De.normalMap||De.anisotropy>0),gn=!!ke.morphAttributes.position,Yi=!!ke.morphAttributes.normal,rs=!!ke.morphAttributes.color,qr=ao;De.toneMapped&&(te===null||te.isXRRenderTarget===!0)&&(qr=k.toneMapping);let ir=ke.morphAttributes.position||ke.morphAttributes.normal||ke.morphAttributes.color,Co=ir!==void 0?ir.length:0,Zt=Pe.get(De),sl=D.state.lights;if(ot===!0&&(nt===!0||ne!==he)){let pr=ne===he&&De.id===ce;fn.setState(De,ne,pr)}let yi=!1;De.version===Zt.__version?(Zt.needsLights&&Zt.lightsStateVersion!==sl.state.version||Zt.outputColorSpace!==Vt||Ne.isBatchedMesh&&Zt.batching===!1||!Ne.isBatchedMesh&&Zt.batching===!0||Ne.isBatchedMesh&&Zt.batchingColor===!0&&Ne.colorTexture===null||Ne.isBatchedMesh&&Zt.batchingColor===!1&&Ne.colorTexture!==null||Ne.isInstancedMesh&&Zt.instancing===!1||!Ne.isInstancedMesh&&Zt.instancing===!0||Ne.isSkinnedMesh&&Zt.skinning===!1||!Ne.isSkinnedMesh&&Zt.skinning===!0||Ne.isInstancedMesh&&Zt.instancingColor===!0&&Ne.instanceColor===null||Ne.isInstancedMesh&&Zt.instancingColor===!1&&Ne.instanceColor!==null||Ne.isInstancedMesh&&Zt.instancingMorph===!0&&Ne.morphTexture===null||Ne.isInstancedMesh&&Zt.instancingMorph===!1&&Ne.morphTexture!==null||Zt.envMap!==pn||De.fog===!0&&Zt.fog!==qt||Zt.numClippingPlanes!==void 0&&(Zt.numClippingPlanes!==fn.numPlanes||Zt.numIntersection!==fn.numIntersection)||Zt.vertexAlphas!==Wn||Zt.vertexTangents!==Jn||Zt.morphTargets!==gn||Zt.morphNormals!==Yi||Zt.morphColors!==rs||Zt.toneMapping!==qr||Zt.morphTargetsCount!==Co||!!Zt.lightProbeGrid!=D.state.lightProbeGridArray.length>0)&&(yi=!0):(yi=!0,Zt.__version=De.version);let Ul=Zt.currentProgram;yi===!0&&(Ul=Hx(De,Se,Ne),G&&De.isNodeMaterial&&G.onUpdateProgram(De,Ul,Zt));let hu=!1,Vf=!1,Om=!1,rr=Ul.getUniforms(),ss=Zt.uniforms;if(Z.useProgram(Ul.program)&&(hu=!0,Vf=!0,Om=!0),De.id!==ce&&(ce=De.id,Vf=!0),Zt.needsLights){let pr=UG(D.state.lightProbeGridArray,Ne);Zt.lightProbeGrid!==pr&&(Zt.lightProbeGrid=pr,Vf=!0)}if(hu||he!==ne){Z.buffers.depth.getReversed()&&ne.reversedDepth!==!0&&(ne._reversedDepth=!0,ne.updateProjectionMatrix()),rr.setValue(_e,"projectionMatrix",ne.projectionMatrix),rr.setValue(_e,"viewMatrix",ne.matrixWorldInverse);let qf=rr.map.cameraPosition;qf!==void 0&&qf.setValue(_e,yt.setFromMatrixPosition(ne.matrixWorld)),le.logarithmicDepthBuffer&&rr.setValue(_e,"logDepthBufFC",2/(Math.log(ne.far+1)/Math.LN2)),(De.isMeshPhongMaterial||De.isMeshToonMaterial||De.isMeshLambertMaterial||De.isMeshBasicMaterial||De.isMeshStandardMaterial||De.isShaderMaterial)&&rr.setValue(_e,"isOrthographic",ne.isOrthographicCamera===!0),he!==ne&&(he=ne,Vf=!0,Om=!0)}if(Zt.needsLights&&(sl.state.directionalShadowMap.length>0&&rr.setValue(_e,"directionalShadowMap",sl.state.directionalShadowMap,Ge),sl.state.spotShadowMap.length>0&&rr.setValue(_e,"spotShadowMap",sl.state.spotShadowMap,Ge),sl.state.pointShadowMap.length>0&&rr.setValue(_e,"pointShadowMap",sl.state.pointShadowMap,Ge)),Ne.isSkinnedMesh){rr.setOptional(_e,Ne,"bindMatrix"),rr.setOptional(_e,Ne,"bindMatrixInverse");let pr=Ne.skeleton;pr&&(pr.boneTexture===null&&pr.computeBoneTexture(),rr.setValue(_e,"boneTexture",pr.boneTexture,Ge))}Ne.isBatchedMesh&&(rr.setOptional(_e,Ne,"batchingTexture"),rr.setValue(_e,"batchingTexture",Ne._matricesTexture,Ge),rr.setOptional(_e,Ne,"batchingIdTexture"),rr.setValue(_e,"batchingIdTexture",Ne._indirectTexture,Ge),rr.setOptional(_e,Ne,"batchingColorTexture"),Ne._colorsTexture!==null&&rr.setValue(_e,"batchingColorTexture",Ne._colorsTexture,Ge));let Gf=ke.morphAttributes;if((Gf.position!==void 0||Gf.normal!==void 0||Gf.color!==void 0)&&ye.update(Ne,ke,Ul),(Vf||Zt.receiveShadow!==Ne.receiveShadow)&&(Zt.receiveShadow=Ne.receiveShadow,rr.setValue(_e,"receiveShadow",Ne.receiveShadow)),(De.isMeshStandardMaterial||De.isMeshLambertMaterial||De.isMeshPhongMaterial)&&De.envMap===null&&Se.environment!==null&&(ss.envMapIntensity.value=Se.environmentIntensity),ss.dfgLUT!==void 0&&(ss.dfgLUT.value=Zxe()),Vf){if(rr.setValue(_e,"toneMappingExposure",k.toneMappingExposure),Zt.needsLights&&zG(ss,Om),qt&&De.fog===!0&&rn.refreshFogUniforms(ss,qt),rn.refreshMaterialUniforms(ss,De,Ye,Ve,D.state.transmissionRenderTarget[ne.id]),Zt.needsLights&&Zt.lightProbeGrid){let pr=Zt.lightProbeGrid;ss.probesSH.value=pr.texture,ss.probesMin.value.copy(pr.boundingBox.min),ss.probesMax.value.copy(pr.boundingBox.max),ss.probesResolution.value.copy(pr.resolution)}A_.upload(_e,QP(Zt),ss,Ge)}if(De.isShaderMaterial&&De.uniformsNeedUpdate===!0&&(A_.upload(_e,QP(Zt),ss,Ge),De.uniformsNeedUpdate=!1),De.isSpriteMaterial&&rr.setValue(_e,"center",Ne.center),rr.setValue(_e,"modelViewMatrix",Ne.modelViewMatrix),rr.setValue(_e,"normalMatrix",Ne.normalMatrix),rr.setValue(_e,"modelMatrix",Ne.matrixWorld),De.uniformsGroups!==void 0){let pr=De.uniformsGroups;for(let qf=0,Um=pr.length;qf<Um;qf++){let eL=pr[qf];ut.update(eL,Ul),ut.bind(eL,Ul)}}return Ul}function zG(ne,Se){ne.ambientLightColor.needsUpdate=Se,ne.lightProbe.needsUpdate=Se,ne.directionalLights.needsUpdate=Se,ne.directionalLightShadows.needsUpdate=Se,ne.pointLights.needsUpdate=Se,ne.pointLightShadows.needsUpdate=Se,ne.spotLights.needsUpdate=Se,ne.spotLightShadows.needsUpdate=Se,ne.rectAreaLights.needsUpdate=Se,ne.hemisphereLights.needsUpdate=Se}function VG(ne){return ne.isMeshLambertMaterial||ne.isMeshToonMaterial||ne.isMeshPhongMaterial||ne.isMeshStandardMaterial||ne.isShadowMaterial||ne.isShaderMaterial&&ne.lights===!0}this.getActiveCubeFace=function(){return $},this.getActiveMipmapLevel=function(){return J},this.getRenderTarget=function(){return te},this.setRenderTargetTextures=function(ne,Se,ke){let De=Pe.get(ne);De.__autoAllocateDepthBuffer=ne.resolveDepthBuffer===!1,De.__autoAllocateDepthBuffer===!1&&(De.__useRenderToTexture=!1),Pe.get(ne.texture).__webglTexture=Se,Pe.get(ne.depthTexture).__webglTexture=De.__autoAllocateDepthBuffer?void 0:ke,De.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(ne,Se){let ke=Pe.get(ne);ke.__webglFramebuffer=Se,ke.__useDefaultFramebuffer=Se===void 0},this.setRenderTarget=function(ne,Se=0,ke=0){te=ne,$=Se,J=ke;let De=null,Ne=!1,qt=!1;if(ne){let Vt=Pe.get(ne);if(Vt.__useDefaultFramebuffer!==void 0){Z.bindFramebuffer(_e.FRAMEBUFFER,Vt.__webglFramebuffer),ve.copy(ne.viewport),Re.copy(ne.scissor),Qe=ne.scissorTest,Z.viewport(ve),Z.scissor(Re),Z.setScissorTest(Qe),ce=-1;return}else if(Vt.__webglFramebuffer===void 0)Ge.setupRenderTarget(ne);else if(Vt.__hasExternalTextures)Ge.rebindTextures(ne,Pe.get(ne.texture).__webglTexture,Pe.get(ne.depthTexture).__webglTexture);else if(ne.depthBuffer){let Wn=ne.depthTexture;if(Vt.__boundDepthTexture!==Wn){if(Wn!==null&&Pe.has(Wn)&&(ne.width!==Wn.image.width||ne.height!==Wn.image.height))throw new Error("THREE.WebGLRenderer: Attached DepthTexture is initialized to the incorrect size.");Ge.setupDepthRenderbuffer(ne)}}let sn=ne.texture;(sn.isData3DTexture||sn.isDataArrayTexture||sn.isCompressedArrayTexture)&&(qt=!0);let pn=Pe.get(ne).__webglFramebuffer;ne.isWebGLCubeRenderTarget?(Array.isArray(pn[Se])?De=pn[Se][ke]:De=pn[Se],Ne=!0):ne.samples>0&&Ge.useMultisampledRTT(ne)===!1?De=Pe.get(ne).__webglMultisampledFramebuffer:Array.isArray(pn)?De=pn[ke]:De=pn,ve.copy(ne.viewport),Re.copy(ne.scissor),Qe=ne.scissorTest}else ve.copy(It).multiplyScalar(Ye).floor(),Re.copy(dn).multiplyScalar(Ye).floor(),Qe=Gt;if(ke!==0&&(De=W),Z.bindFramebuffer(_e.FRAMEBUFFER,De)&&Z.drawBuffers(ne,De),Z.viewport(ve),Z.scissor(Re),Z.setScissorTest(Qe),Ne){let Vt=Pe.get(ne.texture);_e.framebufferTexture2D(_e.FRAMEBUFFER,_e.COLOR_ATTACHMENT0,_e.TEXTURE_CUBE_MAP_POSITIVE_X+Se,Vt.__webglTexture,ke)}else if(qt){let Vt=Se;for(let sn=0;sn<ne.textures.length;sn++){let pn=Pe.get(ne.textures[sn]);_e.framebufferTextureLayer(_e.FRAMEBUFFER,_e.COLOR_ATTACHMENT0+sn,pn.__webglTexture,ke,Vt)}}else if(ne!==null&&ke!==0){let Vt=Pe.get(ne.texture);_e.framebufferTexture2D(_e.FRAMEBUFFER,_e.COLOR_ATTACHMENT0,_e.TEXTURE_2D,Vt.__webglTexture,ke)}ce=-1},this.readRenderTargetPixels=function(ne,Se,ke,De,Ne,qt,Qt,Vt=0){if(!(ne&&ne.isWebGLRenderTarget)){ze("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let sn=Pe.get(ne).__webglFramebuffer;if(ne.isWebGLCubeRenderTarget&&Qt!==void 0&&(sn=sn[Qt]),sn){Z.bindFramebuffer(_e.FRAMEBUFFER,sn);try{let pn=ne.textures[Vt],Wn=pn.format,Jn=pn.type;if(ne.textures.length>1&&_e.readBuffer(_e.COLOR_ATTACHMENT0+Vt),!le.textureFormatReadable(Wn)){ze("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!le.textureTypeReadable(Jn)){ze("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}Se>=0&&Se<=ne.width-De&&ke>=0&&ke<=ne.height-Ne&&_e.readPixels(Se,ke,De,Ne,St.convert(Wn),St.convert(Jn),qt)}finally{let pn=te!==null?Pe.get(te).__webglFramebuffer:null;Z.bindFramebuffer(_e.FRAMEBUFFER,pn)}}},this.readRenderTargetPixelsAsync=async function(ne,Se,ke,De,Ne,qt,Qt,Vt=0){if(!(ne&&ne.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let sn=Pe.get(ne).__webglFramebuffer;if(ne.isWebGLCubeRenderTarget&&Qt!==void 0&&(sn=sn[Qt]),sn)if(Se>=0&&Se<=ne.width-De&&ke>=0&&ke<=ne.height-Ne){Z.bindFramebuffer(_e.FRAMEBUFFER,sn);let pn=ne.textures[Vt],Wn=pn.format,Jn=pn.type;if(ne.textures.length>1&&_e.readBuffer(_e.COLOR_ATTACHMENT0+Vt),!le.textureFormatReadable(Wn))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!le.textureTypeReadable(Jn))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let gn=_e.createBuffer();_e.bindBuffer(_e.PIXEL_PACK_BUFFER,gn),_e.bufferData(_e.PIXEL_PACK_BUFFER,qt.byteLength,_e.STREAM_READ),_e.readPixels(Se,ke,De,Ne,St.convert(Wn),St.convert(Jn),0);let Yi=te!==null?Pe.get(te).__webglFramebuffer:null;Z.bindFramebuffer(_e.FRAMEBUFFER,Yi);let rs=_e.fenceSync(_e.SYNC_GPU_COMMANDS_COMPLETE,0);return _e.flush(),await EZ(_e,rs,4),_e.bindBuffer(_e.PIXEL_PACK_BUFFER,gn),_e.getBufferSubData(_e.PIXEL_PACK_BUFFER,0,qt),_e.deleteBuffer(gn),_e.deleteSync(rs),qt}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(ne,Se=null,ke=0){let De=Math.pow(2,-ke),Ne=Math.floor(ne.image.width*De),qt=Math.floor(ne.image.height*De),Qt=Se!==null?Se.x:0,Vt=Se!==null?Se.y:0;Ge.setTexture2D(ne,0),_e.copyTexSubImage2D(_e.TEXTURE_2D,ke,0,0,Qt,Vt,Ne,qt),Z.unbindTexture()},this.copyTextureToTexture=function(ne,Se,ke=null,De=null,Ne=0,qt=0){let Qt,Vt,sn,pn,Wn,Jn,gn,Yi,rs,qr=ne.isCompressedTexture?ne.mipmaps[qt]:ne.image;if(ke!==null)Qt=ke.max.x-ke.min.x,Vt=ke.max.y-ke.min.y,sn=ke.isBox3?ke.max.z-ke.min.z:1,pn=ke.min.x,Wn=ke.min.y,Jn=ke.isBox3?ke.min.z:0;else{let ss=Math.pow(2,-Ne);Qt=Math.floor(qr.width*ss),Vt=Math.floor(qr.height*ss),ne.isDataArrayTexture?sn=qr.depth:ne.isData3DTexture?sn=Math.floor(qr.depth*ss):sn=1,pn=0,Wn=0,Jn=0}De!==null?(gn=De.x,Yi=De.y,rs=De.z):(gn=0,Yi=0,rs=0);let ir=St.convert(Se.format),Co=St.convert(Se.type),Zt;Se.isData3DTexture?(Ge.setTexture3D(Se,0),Zt=_e.TEXTURE_3D):Se.isDataArrayTexture||Se.isCompressedArrayTexture?(Ge.setTexture2DArray(Se,0),Zt=_e.TEXTURE_2D_ARRAY):(Ge.setTexture2D(Se,0),Zt=_e.TEXTURE_2D),Z.activeTexture(_e.TEXTURE0),Z.pixelStorei(_e.UNPACK_FLIP_Y_WEBGL,Se.flipY),Z.pixelStorei(_e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Se.premultiplyAlpha),Z.pixelStorei(_e.UNPACK_ALIGNMENT,Se.unpackAlignment);let sl=Z.getParameter(_e.UNPACK_ROW_LENGTH),yi=Z.getParameter(_e.UNPACK_IMAGE_HEIGHT),Ul=Z.getParameter(_e.UNPACK_SKIP_PIXELS),hu=Z.getParameter(_e.UNPACK_SKIP_ROWS),Vf=Z.getParameter(_e.UNPACK_SKIP_IMAGES);Z.pixelStorei(_e.UNPACK_ROW_LENGTH,qr.width),Z.pixelStorei(_e.UNPACK_IMAGE_HEIGHT,qr.height),Z.pixelStorei(_e.UNPACK_SKIP_PIXELS,pn),Z.pixelStorei(_e.UNPACK_SKIP_ROWS,Wn),Z.pixelStorei(_e.UNPACK_SKIP_IMAGES,Jn);let Om=ne.isDataArrayTexture||ne.isData3DTexture,rr=Se.isDataArrayTexture||Se.isData3DTexture;if(ne.isDepthTexture){let ss=Pe.get(ne),Gf=Pe.get(Se),pr=Pe.get(ss.__renderTarget),qf=Pe.get(Gf.__renderTarget);Z.bindFramebuffer(_e.READ_FRAMEBUFFER,pr.__webglFramebuffer),Z.bindFramebuffer(_e.DRAW_FRAMEBUFFER,qf.__webglFramebuffer);for(let Um=0;Um<sn;Um++)Om&&(_e.framebufferTextureLayer(_e.READ_FRAMEBUFFER,_e.COLOR_ATTACHMENT0,Pe.get(ne).__webglTexture,Ne,Jn+Um),_e.framebufferTextureLayer(_e.DRAW_FRAMEBUFFER,_e.COLOR_ATTACHMENT0,Pe.get(Se).__webglTexture,qt,rs+Um)),_e.blitFramebuffer(pn,Wn,Qt,Vt,gn,Yi,Qt,Vt,_e.DEPTH_BUFFER_BIT,_e.NEAREST);Z.bindFramebuffer(_e.READ_FRAMEBUFFER,null),Z.bindFramebuffer(_e.DRAW_FRAMEBUFFER,null)}else if(Ne!==0||ne.isRenderTargetTexture||Pe.has(ne)){let ss=Pe.get(ne),Gf=Pe.get(Se);Z.bindFramebuffer(_e.READ_FRAMEBUFFER,Y),Z.bindFramebuffer(_e.DRAW_FRAMEBUFFER,H);for(let pr=0;pr<sn;pr++)Om?_e.framebufferTextureLayer(_e.READ_FRAMEBUFFER,_e.COLOR_ATTACHMENT0,ss.__webglTexture,Ne,Jn+pr):_e.framebufferTexture2D(_e.READ_FRAMEBUFFER,_e.COLOR_ATTACHMENT0,_e.TEXTURE_2D,ss.__webglTexture,Ne),rr?_e.framebufferTextureLayer(_e.DRAW_FRAMEBUFFER,_e.COLOR_ATTACHMENT0,Gf.__webglTexture,qt,rs+pr):_e.framebufferTexture2D(_e.DRAW_FRAMEBUFFER,_e.COLOR_ATTACHMENT0,_e.TEXTURE_2D,Gf.__webglTexture,qt),Ne!==0?_e.blitFramebuffer(pn,Wn,Qt,Vt,gn,Yi,Qt,Vt,_e.COLOR_BUFFER_BIT,_e.NEAREST):rr?_e.copyTexSubImage3D(Zt,qt,gn,Yi,rs+pr,pn,Wn,Qt,Vt):_e.copyTexSubImage2D(Zt,qt,gn,Yi,pn,Wn,Qt,Vt);Z.bindFramebuffer(_e.READ_FRAMEBUFFER,null),Z.bindFramebuffer(_e.DRAW_FRAMEBUFFER,null)}else rr?ne.isDataTexture||ne.isData3DTexture?_e.texSubImage3D(Zt,qt,gn,Yi,rs,Qt,Vt,sn,ir,Co,qr.data):Se.isCompressedArrayTexture?_e.compressedTexSubImage3D(Zt,qt,gn,Yi,rs,Qt,Vt,sn,ir,qr.data):_e.texSubImage3D(Zt,qt,gn,Yi,rs,Qt,Vt,sn,ir,Co,qr):ne.isDataTexture?_e.texSubImage2D(_e.TEXTURE_2D,qt,gn,Yi,Qt,Vt,ir,Co,qr.data):ne.isCompressedTexture?_e.compressedTexSubImage2D(_e.TEXTURE_2D,qt,gn,Yi,qr.width,qr.height,ir,qr.data):_e.texSubImage2D(_e.TEXTURE_2D,qt,gn,Yi,Qt,Vt,ir,Co,qr);Z.pixelStorei(_e.UNPACK_ROW_LENGTH,sl),Z.pixelStorei(_e.UNPACK_IMAGE_HEIGHT,yi),Z.pixelStorei(_e.UNPACK_SKIP_PIXELS,Ul),Z.pixelStorei(_e.UNPACK_SKIP_ROWS,hu),Z.pixelStorei(_e.UNPACK_SKIP_IMAGES,Vf),qt===0&&Se.generateMipmaps&&_e.generateMipmap(Zt),Z.unbindTexture()},this.initRenderTarget=function(ne){Pe.get(ne).__webglFramebuffer===void 0&&Ge.setupRenderTarget(ne)},this.initTexture=function(ne){ne.isCubeTexture?Ge.setTextureCube(ne,0):ne.isData3DTexture?Ge.setTexture3D(ne,0):ne.isDataArrayTexture||ne.isCompressedArrayTexture?Ge.setTexture2DArray(ne,0):Ge.setTexture2D(ne,0),Z.unbindTexture()},this.resetState=function(){$=0,J=0,te=null,Z.reset(),Bt.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Uo}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;let t=this.getContext();t.drawingBufferColorSpace=ln._getDrawingBufferColorSpace(e),t.unpackColorSpace=ln._getUnpackColorSpace()}};var ZM=class extends lr{constructor(e=document.createElement("div")){super(),this.isCSS2DObject=!0,this.element=e,this.element.style.position="absolute",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.center=new Oe(.5,.5),this.addEventListener("removed",function(){this.traverse(function(t){t.element&&t.element instanceof t.element.ownerDocument.defaultView.Element&&t.element.parentNode!==null&&t.element.remove()})})}copy(e,t){return super.copy(e,t),this.element=e.element.cloneNode(!0),this.center=e.center,this}},v_=new re,uK=new cn,hK=new cn,fK=new re,dK=new re,KM=class{constructor(e={}){let t=this,n,r,s,o,a={objects:new WeakMap},l=e.element!==void 0?e.element:document.createElement("div");l.style.overflow="hidden",this.domElement=l,this.sortObjects=!0,this.getSize=function(){return{width:n,height:r}},this.render=function(y,w){y.matrixWorldAutoUpdate===!0&&y.updateMatrixWorld(),w.parent===null&&w.matrixWorldAutoUpdate===!0&&w.updateMatrixWorld(),uK.copy(w.matrixWorldInverse),hK.multiplyMatrices(w.projectionMatrix,uK),u(y,y,w),this.sortObjects&&A(y)},this.setSize=function(y,w){n=y,r=w,s=n/2,o=r/2,l.style.width=y+"px",l.style.height=w+"px"};function c(y){y.isCSS2DObject&&(y.element.style.display="none");for(let w=0,S=y.children.length;w<S;w++)c(y.children[w])}function u(y,w,S){if(y.visible===!1){c(y);return}if(y.isCSS2DObject){v_.setFromMatrixPosition(y.matrixWorld),v_.applyMatrix4(hK);let T=v_.z>=-1&&v_.z<=1&&y.layers.test(S.layers)===!0,R=y.element;R.style.display=T===!0?"":"none",T===!0&&(y.onBeforeRender(t,w,S),R.style.transform="translate("+-100*y.center.x+"%,"+-100*y.center.y+"%)translate("+(v_.x*s+s)+"px,"+(-v_.y*o+o)+"px)",R.parentNode!==l&&l.appendChild(R),y.onAfterRender(t,w,S));let P={distanceToCameraSquared:f(S,y)};a.objects.set(y,P)}for(let T=0,R=y.children.length;T<R;T++)u(y.children[T],w,S)}function f(y,w){return fK.setFromMatrixPosition(y.matrixWorld),dK.setFromMatrixPosition(w.matrixWorld),fK.distanceToSquared(dK)}function d(y){let w=[];return y.traverseVisible(function(S){S.isCSS2DObject&&w.push(S)}),w}function A(y){let w=d(y).sort(function(T,R){if(T.renderOrder!==R.renderOrder)return R.renderOrder-T.renderOrder;let P=a.objects.get(T).distanceToCameraSquared,I=a.objects.get(R).distanceToCameraSquared;return P-I}),S=w.length;for(let T=0,R=w.length;T<R;T++)w[T].element.style.zIndex=S-T}}};function Kxe(i){var e=typeof i;return i!=null&&(e=="object"||e=="function")}var Wb=Kxe;var Qxe=typeof global=="object"&&global&&global.Object===Object&&global,pK=Qxe;var Jxe=typeof self=="object"&&self&&self.Object===Object&&self,eye=pK||Jxe||Function("return this")(),QM=eye;var tye=function(){return QM.Date.now()},JM=tye;var nye=/\s/;function iye(i){for(var e=i.length;e--&&nye.test(i.charAt(e)););return e}var mK=iye;var rye=/^\s+/;function sye(i){return i&&i.slice(0,mK(i)+1).replace(rye,"")}var AK=sye;var oye=QM.Symbol,__=oye;var gK=Object.prototype,aye=gK.hasOwnProperty,lye=gK.toString,jb=__?__.toStringTag:void 0;function cye(i){var e=aye.call(i,jb),t=i[jb];try{i[jb]=void 0;var n=!0}catch{}var r=lye.call(i);return n&&(e?i[jb]=t:delete i[jb]),r}var vK=cye;var uye=Object.prototype,hye=uye.toString;function fye(i){return hye.call(i)}var _K=fye;var dye="[object Null]",pye="[object Undefined]",xK=__?__.toStringTag:void 0;function mye(i){return i==null?i===void 0?pye:dye:xK&&xK in Object(i)?vK(i):_K(i)}var yK=mye;function Aye(i){return i!=null&&typeof i=="object"}var bK=Aye;var gye="[object Symbol]";function vye(i){return typeof i=="symbol"||bK(i)&&yK(i)==gye}var wK=vye;var SK=NaN,_ye=/^[-+]0x[0-9a-f]+$/i,xye=/^0b[01]+$/i,yye=/^0o[0-7]+$/i,bye=parseInt;function wye(i){if(typeof i=="number")return i;if(wK(i))return SK;if(Wb(i)){var e=typeof i.valueOf=="function"?i.valueOf():i;i=Wb(e)?e+"":e}if(typeof i!="string")return i===0?i:+i;i=AK(i);var t=xye.test(i);return t||yye.test(i)?bye(i.slice(2),t?2:8):_ye.test(i)?SK:+i}var OF=wye;var Sye="Expected a function",Tye=Math.max,Eye=Math.min;function Mye(i,e,t){var n,r,s,o,a,l,c=0,u=!1,f=!1,d=!0;if(typeof i!="function")throw new TypeError(Sye);e=OF(e)||0,Wb(t)&&(u=!!t.leading,f="maxWait"in t,s=f?Tye(OF(t.maxWait)||0,e):s,d="trailing"in t?!!t.trailing:d);function A(D){var L=n,C=r;return n=r=void 0,c=D,o=i.apply(C,L),o}function y(D){return c=D,a=setTimeout(T,e),u?A(D):o}function w(D){var L=D-l,C=D-c,B=e-L;return f?Eye(B,s-C):B}function S(D){var L=D-l,C=D-c;return l===void 0||L>=e||L<0||f&&C>=s}function T(){var D=JM();if(S(D))return R(D);a=setTimeout(T,w(D))}function R(D){return a=void 0,d&&n?A(D):(n=r=void 0,o)}function P(){a!==void 0&&clearTimeout(a),c=0,n=l=r=a=void 0}function I(){return a===void 0?o:R(JM())}function F(){var D=JM(),L=S(D);if(n=arguments,r=this,l=D,L){if(a===void 0)return y(l);if(f)return clearTimeout(a),a=setTimeout(T,e),A(l)}return a===void 0&&(a=setTimeout(T,e)),o}return F.cancel=P,F.flush=I,F}var TK=Mye;function EK(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function Cye(i){if(Array.isArray(i))return i}function Rye(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function Iye(i,e,t){return Object.defineProperty(i,"prototype",{writable:!1}),i}function Pye(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function Lye(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.4118+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Dye(i,e){return Cye(i)||Pye(i,e)||Nye(i,e)||Lye()}function Nye(i,e){if(i){if(typeof i=="string")return EK(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?EK(i,e):void 0}}var Fye=Iye(function i(e,t){var n=t.default,r=n===void 0?null:n,s=t.triggerUpdate,o=s===void 0?!0:s,a=t.onChange,l=a===void 0?function(c,u){}:a;Rye(this,i),this.name=e,this.defaultVal=r,this.triggerUpdate=o,this.onChange=l});function Kr(i){var e=i.stateInit,t=e===void 0?function(){return{}}:e,n=i.props,r=n===void 0?{}:n,s=i.methods,o=s===void 0?{}:s,a=i.aliases,l=a===void 0?{}:a,c=i.init,u=c===void 0?function(){}:c,f=i.update,d=f===void 0?function(){}:f,A=Object.keys(r).map(function(y){return new Fye(y,r[y])});return function y(){for(var w=arguments.length,S=new Array(w),T=0;T<w;T++)S[T]=arguments[T];var R=!!(this instanceof y&&this.constructor),P=R?S.shift():void 0,I=S[0],F=I===void 0?{}:I,D=Object.assign({},t instanceof Function?t(F):t,{initialised:!1}),L={};function C(z){return B(z,F),k(),C}var B=function(G,W){u.call(C,G,D,W),D.initialised=!0},k=TK(function(){D.initialised&&(d.call(C,D,L),L={})},1);return A.forEach(function(z){C[z.name]=G(z);function G(W){var Y=W.name,H=W.triggerUpdate,$=H===void 0?!1:H,J=W.onChange,te=J===void 0?function(ve,Re){}:J,ce=W.defaultVal,he=ce===void 0?null:ce;return function(ve){var Re=D[Y];if(!arguments.length)return Re;var Qe=ve===void 0?he:ve;return D[Y]=Qe,te.call(C,Qe,D,Re),!L.hasOwnProperty(Y)&&(L[Y]=Re),$&&k(),C}}}),Object.keys(o).forEach(function(z){C[z]=function(){for(var G,W=arguments.length,Y=new Array(W),H=0;H<W;H++)Y[H]=arguments[H];return(G=o[z]).call.apply(G,[C,D].concat(Y))}}),Object.entries(l).forEach(function(z){var G=Dye(z,2),W=G[0],Y=G[1];return C[W]=C[Y]}),C.resetProps=function(){return A.forEach(function(z){C[z.name](z.defaultVal)}),C},C.resetProps(),D._rerender=k,R&&P&&C(P),C}}var Qr=Object.freeze({Linear:Object.freeze({None:function(i){return i},In:function(i){return i},Out:function(i){return i},InOut:function(i){return i}}),Quadratic:Object.freeze({In:function(i){return i*i},Out:function(i){return i*(2-i)},InOut:function(i){return(i*=2)<1?.5*i*i:-.5*(--i*(i-2)-1)}}),Cubic:Object.freeze({In:function(i){return i*i*i},Out:function(i){return--i*i*i+1},InOut:function(i){return(i*=2)<1?.5*i*i*i:.5*((i-=2)*i*i+2)}}),Quartic:Object.freeze({In:function(i){return i*i*i*i},Out:function(i){return 1- --i*i*i*i},InOut:function(i){return(i*=2)<1?.5*i*i*i*i:-.5*((i-=2)*i*i*i-2)}}),Quintic:Object.freeze({In:function(i){return i*i*i*i*i},Out:function(i){return--i*i*i*i*i+1},InOut:function(i){return(i*=2)<1?.5*i*i*i*i*i:.5*((i-=2)*i*i*i*i+2)}}),Sinusoidal:Object.freeze({In:function(i){return 1-Math.sin((1-i)*Math.PI/2)},Out:function(i){return Math.sin(i*Math.PI/2)},InOut:function(i){return .5*(1-Math.sin(Math.PI*(.5-i)))}}),Exponential:Object.freeze({In:function(i){return i===0?0:Math.pow(1024,i-1)},Out:function(i){return i===1?1:1-Math.pow(2,-10*i)},InOut:function(i){return i===0?0:i===1?1:(i*=2)<1?.5*Math.pow(1024,i-1):.5*(-Math.pow(2,-10*(i-1))+2)}}),Circular:Object.freeze({In:function(i){return 1-Math.sqrt(1-i*i)},Out:function(i){return Math.sqrt(1- --i*i)},InOut:function(i){return(i*=2)<1?-.5*(Math.sqrt(1-i*i)-1):.5*(Math.sqrt(1-(i-=2)*i)+1)}}),Elastic:Object.freeze({In:function(i){return i===0?0:i===1?1:-Math.pow(2,10*(i-1))*Math.sin((i-1.1)*5*Math.PI)},Out:function(i){return i===0?0:i===1?1:Math.pow(2,-10*i)*Math.sin((i-.1)*5*Math.PI)+1},InOut:function(i){return i===0?0:i===1?1:(i*=2,i<1?-.5*Math.pow(2,10*(i-1))*Math.sin((i-1.1)*5*Math.PI):.5*Math.pow(2,-10*(i-1))*Math.sin((i-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(i){var e=1.70158;return i===1?1:i*i*((e+1)*i-e)},Out:function(i){var e=1.70158;return i===0?0:--i*i*((e+1)*i+e)+1},InOut:function(i){var e=2.5949095;return(i*=2)<1?.5*(i*i*((e+1)*i-e)):.5*((i-=2)*i*((e+1)*i+e)+2)}}),Bounce:Object.freeze({In:function(i){return 1-Qr.Bounce.Out(1-i)},Out:function(i){return i<.36363636363636365?7.5625*i*i:i<.7272727272727273?7.5625*(i-=.5454545454545454)*i+.75:i<.9090909090909091?7.5625*(i-=.8181818181818182)*i+.9375:7.5625*(i-=.9545454545454546)*i+.984375},InOut:function(i){return i<.5?Qr.Bounce.In(i*2)*.5:Qr.Bounce.Out(i*2-1)*.5+.5}}),generatePow:function(i){return i===void 0&&(i=4),i=i<Number.EPSILON?Number.EPSILON:i,i=i>1e4?1e4:i,{In:function(e){return Math.pow(e,i)},Out:function(e){return 1-Math.pow(1-e,i)},InOut:function(e){return e<.5?Math.pow(e*2,i)/2:(1-Math.pow(2-e*2,i))/2+.5}}}}),Xb=function(){return performance.now()},vg=(function(){function i(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._tweens={},this._tweensAddedDuringUpdate={},this.add.apply(this,e)}return i.prototype.getAll=function(){var e=this;return Object.keys(this._tweens).map(function(t){return e._tweens[t]})},i.prototype.removeAll=function(){this._tweens={}},i.prototype.add=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];for(var r=0,s=t;r<s.length;r++){var o=s[r];(e=o._group)===null||e===void 0||e.remove(o),o._group=this,this._tweens[o.getId()]=o,this._tweensAddedDuringUpdate[o.getId()]=o}},i.prototype.remove=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n=0,r=e;n<r.length;n++){var s=r[n];s._group=void 0,delete this._tweens[s.getId()],delete this._tweensAddedDuringUpdate[s.getId()]}},i.prototype.allStopped=function(){return this.getAll().every(function(e){return!e.isPlaying()})},i.prototype.update=function(e,t){e===void 0&&(e=Xb()),t===void 0&&(t=!0);var n=Object.keys(this._tweens);if(n.length!==0)for(;n.length>0;){this._tweensAddedDuringUpdate={};for(var r=0;r<n.length;r++){var s=this._tweens[n[r]],o=!t;s&&s.update(e,o)===!1&&!t&&this.remove(s)}n=Object.keys(this._tweensAddedDuringUpdate)}},i})(),x_={Linear:function(i,e){var t=i.length-1,n=t*e,r=Math.floor(n),s=x_.Utils.Linear;return e<0?s(i[0],i[1],n):e>1?s(i[t],i[t-1],t-n):s(i[r],i[r+1>t?t:r+1],n-r)},Bezier:function(i,e){for(var t=0,n=i.length-1,r=Math.pow,s=x_.Utils.Bernstein,o=0;o<=n;o++)t+=r(1-e,n-o)*r(e,o)*i[o]*s(n,o);return t},CatmullRom:function(i,e){var t=i.length-1,n=t*e,r=Math.floor(n),s=x_.Utils.CatmullRom;return i[0]===i[t]?(e<0&&(r=Math.floor(n=t*(1+e))),s(i[(r-1+t)%t],i[r],i[(r+1)%t],i[(r+2)%t],n-r)):e<0?i[0]-(s(i[0],i[0],i[1],i[1],-n)-i[0]):e>1?i[t]-(s(i[t],i[t],i[t-1],i[t-1],n-t)-i[t]):s(i[r?r-1:0],i[r],i[t<r+1?t:r+1],i[t<r+2?t:r+2],n-r)},Utils:{Linear:function(i,e,t){return(e-i)*t+i},Bernstein:function(i,e){var t=x_.Utils.Factorial;return t(i)/t(e)/t(i-e)},Factorial:(function(){var i=[1];return function(e){var t=1;if(i[e])return i[e];for(var n=e;n>1;n--)t*=n;return i[e]=t,t}})(),CatmullRom:function(i,e,t,n,r){var s=(t-i)*.5,o=(n-e)*.5,a=r*r,l=r*a;return(2*e-2*t+s+o)*l+(-3*e+3*t-2*s-o)*a+s*r+e}}},MK=(function(){function i(){}return i.nextId=function(){return i._nextId++},i._nextId=0,i})(),UF=new vg,uo=(function(){function i(e,t){this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=Qr.Linear.None,this._interpolationFunction=x_.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=MK.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1,this._object=e,typeof t=="object"?(this._group=t,t.add(this)):t===!0&&(this._group=UF,UF.add(this))}return i.prototype.getId=function(){return this._id},i.prototype.isPlaying=function(){return this._isPlaying},i.prototype.isPaused=function(){return this._isPaused},i.prototype.getDuration=function(){return this._duration},i.prototype.to=function(e,t){if(t===void 0&&(t=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=e,this._propertiesAreSetUp=!1,this._duration=t<0?0:t,this},i.prototype.duration=function(e){return e===void 0&&(e=1e3),this._duration=e<0?0:e,this},i.prototype.dynamic=function(e){return e===void 0&&(e=!1),this._isDynamic=e,this},i.prototype.start=function(e,t){if(e===void 0&&(e=Xb()),t===void 0&&(t=!1),this._isPlaying)return this;if(this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var n in this._valuesStartRepeat)this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=e,this._startTime+=this._delayTime,!this._propertiesAreSetUp||t){if(this._propertiesAreSetUp=!0,!this._isDynamic){var r={};for(var s in this._valuesEnd)r[s]=this._valuesEnd[s];this._valuesEnd=r}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,t)}return this},i.prototype.startFromCurrentValues=function(e){return this.start(e,!0)},i.prototype._setupProperties=function(e,t,n,r,s){for(var o in n){var a=e[o],l=Array.isArray(a),c=l?"array":typeof a,u=!l&&Array.isArray(n[o]);if(!(c==="undefined"||c==="function")){if(u){var f=n[o];if(f.length===0)continue;for(var d=[a],A=0,y=f.length;A<y;A+=1){var w=this._handleRelativeValue(a,f[A]);if(isNaN(w)){u=!1,console.warn("Found invalid interpolation list. Skipping.");break}d.push(w)}u&&(n[o]=d)}if((c==="object"||l)&&a&&!u){t[o]=l?[]:{};var S=a;for(var T in S)t[o][T]=S[T];r[o]=l?[]:{};var f=n[o];if(!this._isDynamic){var R={};for(var T in f)R[T]=f[T];n[o]=f=R}this._setupProperties(S,t[o],f,r[o],s)}else(typeof t[o]>"u"||s)&&(t[o]=a),l||(t[o]*=1),u?r[o]=n[o].slice().reverse():r[o]=t[o]||0}}},i.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},i.prototype.end=function(){return this._goToEnd=!0,this.update(this._startTime+this._duration),this},i.prototype.pause=function(e){return e===void 0&&(e=Xb()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=e,this)},i.prototype.resume=function(e){return e===void 0&&(e=Xb()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this)},i.prototype.stopChainedTweens=function(){for(var e=0,t=this._chainedTweens.length;e<t;e++)this._chainedTweens[e].stop();return this},i.prototype.group=function(e){return e?(e.add(this),this):(console.warn("tween.group() without args has been removed, use group.add(tween) instead."),this)},i.prototype.remove=function(){var e;return(e=this._group)===null||e===void 0||e.remove(this),this},i.prototype.delay=function(e){return e===void 0&&(e=0),this._delayTime=e,this},i.prototype.repeat=function(e){return e===void 0&&(e=0),this._initialRepeat=e,this._repeat=e,this},i.prototype.repeatDelay=function(e){return this._repeatDelayTime=e,this},i.prototype.yoyo=function(e){return e===void 0&&(e=!1),this._yoyo=e,this},i.prototype.easing=function(e){return e===void 0&&(e=Qr.Linear.None),this._easingFunction=e,this},i.prototype.interpolation=function(e){return e===void 0&&(e=x_.Linear),this._interpolationFunction=e,this},i.prototype.chain=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this._chainedTweens=e,this},i.prototype.onStart=function(e){return this._onStartCallback=e,this},i.prototype.onEveryStart=function(e){return this._onEveryStartCallback=e,this},i.prototype.onUpdate=function(e){return this._onUpdateCallback=e,this},i.prototype.onRepeat=function(e){return this._onRepeatCallback=e,this},i.prototype.onComplete=function(e){return this._onCompleteCallback=e,this},i.prototype.onStop=function(e){return this._onStopCallback=e,this},i.prototype.update=function(e,t){var n=this,r;if(e===void 0&&(e=Xb()),t===void 0&&(t=i.autoStartOnUpdate),this._isPaused)return!0;var s;if(!this._goToEnd&&!this._isPlaying)if(t)this.start(e,!0);else return!1;if(this._goToEnd=!1,e<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var o=e-this._startTime,a=this._duration+((r=this._repeatDelayTime)!==null&&r!==void 0?r:this._delayTime),l=this._duration+this._repeat*a,c=function(){if(n._duration===0||o>l)return 1;var w=Math.trunc(o/a),S=o-w*a,T=Math.min(S/n._duration,1);return T===0&&o===n._duration?1:T},u=c(),f=this._easingFunction(u);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,f),this._onUpdateCallback&&this._onUpdateCallback(this._object,u),this._duration===0||o>=this._duration)if(this._repeat>0){var d=Math.min(Math.trunc((o-this._duration)/a)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=d);for(s in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[s]=="string"&&(this._valuesStartRepeat[s]=this._valuesStartRepeat[s]+parseFloat(this._valuesEnd[s])),this._yoyo&&this._swapEndStartRepeatValues(s),this._valuesStart[s]=this._valuesStartRepeat[s];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=a*d,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var A=0,y=this._chainedTweens.length;A<y;A++)this._chainedTweens[A].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},i.prototype._updateProperties=function(e,t,n,r){for(var s in n)if(t[s]!==void 0){var o=t[s]||0,a=n[s],l=Array.isArray(e[s]),c=Array.isArray(a),u=!l&&c;u?e[s]=this._interpolationFunction(a,r):typeof a=="object"&&a?this._updateProperties(e[s],o,a,r):(a=this._handleRelativeValue(o,a),typeof a=="number"&&(e[s]=o+(a-o)*r))}},i.prototype._handleRelativeValue=function(e,t){return typeof t!="string"?t:t.charAt(0)==="+"||t.charAt(0)==="-"?e+parseFloat(t):parseFloat(t)},i.prototype._swapEndStartRepeatValues=function(e){var t=this._valuesStartRepeat[e],n=this._valuesEnd[e];typeof n=="string"?this._valuesStartRepeat[e]=this._valuesStartRepeat[e]+parseFloat(n):this._valuesStartRepeat[e]=this._valuesEnd[e],this._valuesEnd[e]=t},i.autoStartOnUpdate=!1,i})();var pJe=MK.nextId,Qh=UF,mJe=Qh.getAll.bind(Qh),AJe=Qh.removeAll.bind(Qh),gJe=Qh.add.bind(Qh),vJe=Qh.remove.bind(Qh),_Je=Qh.update.bind(Qh);function CK(i){let e=+this._x.call(null,i),t=+this._y.call(null,i),n=+this._z.call(null,i);return RK(this.cover(e,t,n),e,t,n,i)}function RK(i,e,t,n,r){if(isNaN(e)||isNaN(t)||isNaN(n))return i;var s,o=i._root,a={data:r},l=i._x0,c=i._y0,u=i._z0,f=i._x1,d=i._y1,A=i._z1,y,w,S,T,R,P,I,F,D,L,C;if(!o)return i._root=a,i;for(;o.length;)if((I=e>=(y=(l+f)/2))?l=y:f=y,(F=t>=(w=(c+d)/2))?c=w:d=w,(D=n>=(S=(u+A)/2))?u=S:A=S,s=o,!(o=o[L=D<<2|F<<1|I]))return s[L]=a,i;if(T=+i._x.call(null,o.data),R=+i._y.call(null,o.data),P=+i._z.call(null,o.data),e===T&&t===R&&n===P)return a.next=o,s?s[L]=a:i._root=a,i;do s=s?s[L]=new Array(8):i._root=new Array(8),(I=e>=(y=(l+f)/2))?l=y:f=y,(F=t>=(w=(c+d)/2))?c=w:d=w,(D=n>=(S=(u+A)/2))?u=S:A=S;while((L=D<<2|F<<1|I)===(C=(P>=S)<<2|(R>=w)<<1|T>=y));return s[C]=o,s[L]=a,i}function IK(i){Array.isArray(i)||(i=Array.from(i));let e=i.length,t=new Float64Array(e),n=new Float64Array(e),r=new Float64Array(e),s=1/0,o=1/0,a=1/0,l=-1/0,c=-1/0,u=-1/0;for(let f=0,d,A,y,w;f<e;++f)isNaN(A=+this._x.call(null,d=i[f]))||isNaN(y=+this._y.call(null,d))||isNaN(w=+this._z.call(null,d))||(t[f]=A,n[f]=y,r[f]=w,A<s&&(s=A),A>l&&(l=A),y<o&&(o=y),y>c&&(c=y),w<a&&(a=w),w>u&&(u=w));if(s>l||o>c||a>u)return this;this.cover(s,o,a).cover(l,c,u);for(let f=0;f<e;++f)RK(this,t[f],n[f],r[f],i[f]);return this}function PK(i,e,t){if(isNaN(i=+i)||isNaN(e=+e)||isNaN(t=+t))return this;var n=this._x0,r=this._y0,s=this._z0,o=this._x1,a=this._y1,l=this._z1;if(isNaN(n))o=(n=Math.floor(i))+1,a=(r=Math.floor(e))+1,l=(s=Math.floor(t))+1;else{for(var c=o-n||1,u=this._root,f,d;n>i||i>=o||r>e||e>=a||s>t||t>=l;)switch(d=(t<s)<<2|(e<r)<<1|i<n,f=new Array(8),f[d]=u,u=f,c*=2,d){case 0:o=n+c,a=r+c,l=s+c;break;case 1:n=o-c,a=r+c,l=s+c;break;case 2:o=n+c,r=a-c,l=s+c;break;case 3:n=o-c,r=a-c,l=s+c;break;case 4:o=n+c,a=r+c,s=l-c;break;case 5:n=o-c,a=r+c,s=l-c;break;case 6:o=n+c,r=a-c,s=l-c;break;case 7:n=o-c,r=a-c,s=l-c;break}this._root&&this._root.length&&(this._root=u)}return this._x0=n,this._y0=r,this._z0=s,this._x1=o,this._y1=a,this._z1=l,this}function LK(){var i=[];return this.visit(function(e){if(!e.length)do i.push(e.data);while(e=e.next)}),i}function DK(i){return arguments.length?this.cover(+i[0][0],+i[0][1],+i[0][2]).cover(+i[1][0],+i[1][1],+i[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]}function ji(i,e,t,n,r,s,o){this.node=i,this.x0=e,this.y0=t,this.z0=n,this.x1=r,this.y1=s,this.z1=o}function NK(i,e,t,n){var r,s=this._x0,o=this._y0,a=this._z0,l,c,u,f,d,A,y=this._x1,w=this._y1,S=this._z1,T=[],R=this._root,P,I;for(R&&T.push(new ji(R,s,o,a,y,w,S)),n==null?n=1/0:(s=i-n,o=e-n,a=t-n,y=i+n,w=e+n,S=t+n,n*=n);P=T.pop();)if(!(!(R=P.node)||(l=P.x0)>y||(c=P.y0)>w||(u=P.z0)>S||(f=P.x1)<s||(d=P.y1)<o||(A=P.z1)<a))if(R.length){var F=(l+f)/2,D=(c+d)/2,L=(u+A)/2;T.push(new ji(R[7],F,D,L,f,d,A),new ji(R[6],l,D,L,F,d,A),new ji(R[5],F,c,L,f,D,A),new ji(R[4],l,c,L,F,D,A),new ji(R[3],F,D,u,f,d,L),new ji(R[2],l,D,u,F,d,L),new ji(R[1],F,c,u,f,D,L),new ji(R[0],l,c,u,F,D,L)),(I=(t>=L)<<2|(e>=D)<<1|i>=F)&&(P=T[T.length-1],T[T.length-1]=T[T.length-1-I],T[T.length-1-I]=P)}else{var C=i-+this._x.call(null,R.data),B=e-+this._y.call(null,R.data),k=t-+this._z.call(null,R.data),z=C*C+B*B+k*k;if(z<n){var G=Math.sqrt(n=z);s=i-G,o=e-G,a=t-G,y=i+G,w=e+G,S=t+G,r=R.data}}return r}var Bye=(i,e,t,n,r,s)=>Math.sqrt((i-n)**2+(e-r)**2+(t-s)**2);function FK(i,e,t,n){let r=[],s=i-n,o=e-n,a=t-n,l=i+n,c=e+n,u=t+n;return this.visit((f,d,A,y,w,S,T)=>{if(!f.length)do{let R=f.data;Bye(i,e,t,this._x(R),this._y(R),this._z(R))<=n&&r.push(R)}while(f=f.next);return d>l||A>c||y>u||w<s||S<o||T<a}),r}function BK(i){if(isNaN(d=+this._x.call(null,i))||isNaN(A=+this._y.call(null,i))||isNaN(y=+this._z.call(null,i)))return this;var e,t=this._root,n,r,s,o=this._x0,a=this._y0,l=this._z0,c=this._x1,u=this._y1,f=this._z1,d,A,y,w,S,T,R,P,I,F,D;if(!t)return this;if(t.length)for(;;){if((R=d>=(w=(o+c)/2))?o=w:c=w,(P=A>=(S=(a+u)/2))?a=S:u=S,(I=y>=(T=(l+f)/2))?l=T:f=T,e=t,!(t=t[F=I<<2|P<<1|R]))return this;if(!t.length)break;(e[F+1&7]||e[F+2&7]||e[F+3&7]||e[F+4&7]||e[F+5&7]||e[F+6&7]||e[F+7&7])&&(n=e,D=F)}for(;t.data!==i;)if(r=t,!(t=t.next))return this;return(s=t.next)&&delete t.next,r?(s?r.next=s:delete r.next,this):e?(s?e[F]=s:delete e[F],(t=e[0]||e[1]||e[2]||e[3]||e[4]||e[5]||e[6]||e[7])&&t===(e[7]||e[6]||e[5]||e[4]||e[3]||e[2]||e[1]||e[0])&&!t.length&&(n?n[D]=t:this._root=t),this):(this._root=s,this)}function OK(i){for(var e=0,t=i.length;e<t;++e)this.remove(i[e]);return this}function UK(){return this._root}function kK(){var i=0;return this.visit(function(e){if(!e.length)do++i;while(e=e.next)}),i}function zK(i){var e=[],t,n=this._root,r,s,o,a,l,c,u;for(n&&e.push(new ji(n,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));t=e.pop();)if(!i(n=t.node,s=t.x0,o=t.y0,a=t.z0,l=t.x1,c=t.y1,u=t.z1)&&n.length){var f=(s+l)/2,d=(o+c)/2,A=(a+u)/2;(r=n[7])&&e.push(new ji(r,f,d,A,l,c,u)),(r=n[6])&&e.push(new ji(r,s,d,A,f,c,u)),(r=n[5])&&e.push(new ji(r,f,o,A,l,d,u)),(r=n[4])&&e.push(new ji(r,s,o,A,f,d,u)),(r=n[3])&&e.push(new ji(r,f,d,a,l,c,A)),(r=n[2])&&e.push(new ji(r,s,d,a,f,c,A)),(r=n[1])&&e.push(new ji(r,f,o,a,l,d,A)),(r=n[0])&&e.push(new ji(r,s,o,a,f,d,A))}return this}function VK(i){var e=[],t=[],n;for(this._root&&e.push(new ji(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));n=e.pop();){var r=n.node;if(r.length){var s,o=n.x0,a=n.y0,l=n.z0,c=n.x1,u=n.y1,f=n.z1,d=(o+c)/2,A=(a+u)/2,y=(l+f)/2;(s=r[0])&&e.push(new ji(s,o,a,l,d,A,y)),(s=r[1])&&e.push(new ji(s,d,a,l,c,A,y)),(s=r[2])&&e.push(new ji(s,o,A,l,d,u,y)),(s=r[3])&&e.push(new ji(s,d,A,l,c,u,y)),(s=r[4])&&e.push(new ji(s,o,a,y,d,A,f)),(s=r[5])&&e.push(new ji(s,d,a,y,c,A,f)),(s=r[6])&&e.push(new ji(s,o,A,y,d,u,f)),(s=r[7])&&e.push(new ji(s,d,A,y,c,u,f))}t.push(n)}for(;n=t.pop();)i(n.node,n.x0,n.y0,n.z0,n.x1,n.y1,n.z1);return this}function GK(i){return i[0]}function qK(i){return arguments.length?(this._x=i,this):this._x}function HK(i){return i[1]}function WK(i){return arguments.length?(this._y=i,this):this._y}function jK(i){return i[2]}function XK(i){return arguments.length?(this._z=i,this):this._z}function $b(i,e,t,n){var r=new kF(e??GK,t??HK,n??jK,NaN,NaN,NaN,NaN,NaN,NaN);return i==null?r:r.addAll(i)}function kF(i,e,t,n,r,s,o,a,l){this._x=i,this._y=e,this._z=t,this._x0=n,this._y0=r,this._z0=s,this._x1=o,this._y1=a,this._z1=l,this._root=void 0}function $K(i){for(var e={data:i.data},t=e;i=i.next;)t=t.next={data:i.data};return e}var Go=$b.prototype=kF.prototype;Go.copy=function(){var i=new kF(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),e=this._root,t,n;if(!e)return i;if(!e.length)return i._root=$K(e),i;for(t=[{source:e,target:i._root=new Array(8)}];e=t.pop();)for(var r=0;r<8;++r)(n=e.source[r])&&(n.length?t.push({source:n,target:e.target[r]=new Array(8)}):e.target[r]=$K(n));return i};Go.add=CK;Go.addAll=IK;Go.cover=PK;Go.data=LK;Go.extent=DK;Go.find=NK;Go.findAllWithinRadius=FK;Go.remove=BK;Go.removeAll=OK;Go.root=UK;Go.size=kK;Go.visit=zK;Go.visitAfter=VK;Go.x=qK;Go.y=WK;Go.z=XK;function _g(i,e){return i==null||e==null?NaN:i<e?-1:i>e?1:i>=e?0:NaN}function zF(i,e){return i==null||e==null?NaN:e<i?-1:e>i?1:e>=i?0:NaN}function eC(i){let e,t,n;i.length!==2?(e=_g,t=(a,l)=>_g(i(a),l),n=(a,l)=>i(a)-l):(e=i===_g||i===zF?i:Oye,t=i,n=i);function r(a,l,c=0,u=a.length){if(c<u){if(e(l,l)!==0)return u;do{let f=c+u>>>1;t(a[f],l)<0?c=f+1:u=f}while(c<u)}return c}function s(a,l,c=0,u=a.length){if(c<u){if(e(l,l)!==0)return u;do{let f=c+u>>>1;t(a[f],l)<=0?c=f+1:u=f}while(c<u)}return c}function o(a,l,c=0,u=a.length){let f=r(a,l,c,u-1);return f>c&&n(a[f-1],l)>-n(a[f],l)?f-1:f}return{left:r,center:o,right:s}}function Oye(){return 0}function VF(i){return i===null?NaN:+i}var YK=eC(_g),ZK=YK.right,Uye=YK.left,kye=eC(VF).center,Yb=ZK;function j0(i,e){let t,n;if(e===void 0)for(let r of i)r!=null&&(t===void 0?r>=r&&(t=n=r):(t>r&&(t=r),n<r&&(n=r)));else{let r=-1;for(let s of i)(s=e(s,++r,i))!=null&&(t===void 0?s>=s&&(t=n=s):(t>s&&(t=s),n<s&&(n=s)))}return[t,n]}var qo=class{constructor(){this._partials=new Float64Array(32),this._n=0}add(e){let t=this._partials,n=0;for(let r=0;r<this._n&&r<32;r++){let s=t[r],o=e+s,a=Math.abs(e)<Math.abs(s)?e-(o-s):s-(o-e);a&&(t[n++]=a),e=o}return t[n]=e,this._n=n+1,this}valueOf(){let e=this._partials,t=this._n,n,r,s,o=0;if(t>0){for(o=e[--t];t>0&&(n=o,r=e[--t],o=n+r,s=r-(o-n),!s););t>0&&(s<0&&e[t-1]<0||s>0&&e[t-1]>0)&&(r=s*2,n=o+r,r==n-o&&(o=n))}return o}};var zye=Math.sqrt(50),Vye=Math.sqrt(10),Gye=Math.sqrt(2);function tC(i,e,t){let n=(e-i)/Math.max(0,t),r=Math.floor(Math.log10(n)),s=n/Math.pow(10,r),o=s>=zye?10:s>=Vye?5:s>=Gye?2:1,a,l,c;return r<0?(c=Math.pow(10,-r)/o,a=Math.round(i*c),l=Math.round(e*c),a/c<i&&++a,l/c>e&&--l,c=-c):(c=Math.pow(10,r)*o,a=Math.round(i/c),l=Math.round(e/c),a*c<i&&++a,l*c>e&&--l),l<a&&.5<=t&&t<2?tC(i,e,t*2):[a,l,c]}function nC(i,e,t){if(e=+e,i=+i,t=+t,!(t>0))return[];if(i===e)return[i];let n=e<i,[r,s,o]=n?tC(e,i,t):tC(i,e,t);if(!(s>=r))return[];let a=s-r+1,l=new Array(a);if(n)if(o<0)for(let c=0;c<a;++c)l[c]=(s-c)/-o;else for(let c=0;c<a;++c)l[c]=(s-c)*o;else if(o<0)for(let c=0;c<a;++c)l[c]=(r+c)/-o;else for(let c=0;c<a;++c)l[c]=(r+c)*o;return l}function Zb(i,e,t){return e=+e,i=+i,t=+t,tC(i,e,t)[2]}function GF(i,e,t){e=+e,i=+i,t=+t;let n=e<i,r=n?Zb(e,i,t):Zb(i,e,t);return(n?-1:1)*(r<0?1/-r:r)}function iC(i,e){let t;if(e===void 0)for(let n of i)n!=null&&(t<n||t===void 0&&n>=n)&&(t=n);else{let n=-1;for(let r of i)(r=e(r,++n,i))!=null&&(t<r||t===void 0&&r>=r)&&(t=r)}return t}function rC(i,e){let t=0,n=0;if(e===void 0)for(let r of i)r!=null&&(r=+r)>=r&&(++t,n+=r);else{let r=-1;for(let s of i)(s=e(s,++r,i))!=null&&(s=+s)>=s&&(++t,n+=s)}if(t)return n/t}function*qye(i){for(let e of i)yield*e}function Jh(i){return Array.from(qye(i))}function Ud(i,e,t){i=+i,e=+e,t=(r=arguments.length)<2?(e=i,i=0,1):r<3?1:+t;for(var n=-1,r=Math.max(0,Math.ceil((e-i)/t))|0,s=new Array(r);++n<r;)s[n]=i+n*t;return s}function sC(i,e){let t=0;if(e===void 0)for(let n of i)(n=+n)&&(t+=n);else{let n=-1;for(let r of i)(r=+e(r,++n,i))&&(t+=r)}return t}function oC(i,e){switch(arguments.length){case 0:break;case 1:this.range(i);break;default:this.range(e).domain(i);break}return this}function aC(i,e,t){i.prototype=e.prototype=t,t.constructor=i}function qF(i,e){var t=Object.create(i.prototype);for(var n in e)t[n]=e[n];return t}function Jb(){}var Kb=.7,uC=1/Kb,y_="\\s*([+-]?\\d+)\\s*",Qb="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ef="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Hye=/^#([0-9a-f]{3,8})$/,Wye=new RegExp(`^rgb\\(${y_},${y_},${y_}\\)$`),jye=new RegExp(`^rgb\\(${ef},${ef},${ef}\\)$`),Xye=new RegExp(`^rgba\\(${y_},${y_},${y_},${Qb}\\)$`),$ye=new RegExp(`^rgba\\(${ef},${ef},${ef},${Qb}\\)$`),Yye=new RegExp(`^hsl\\(${Qb},${ef},${ef}\\)$`),Zye=new RegExp(`^hsla\\(${Qb},${ef},${ef},${Qb}\\)$`),KK={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};aC(Jb,zu,{copy(i){return Object.assign(new this.constructor,this,i)},displayable(){return this.rgb().displayable()},hex:QK,formatHex:QK,formatHex8:Kye,formatHsl:Qye,formatRgb:JK,toString:JK});function QK(){return this.rgb().formatHex()}function Kye(){return this.rgb().formatHex8()}function Qye(){return sQ(this).formatHsl()}function JK(){return this.rgb().formatRgb()}function zu(i){var e,t;return i=(i+"").trim().toLowerCase(),(e=Hye.exec(i))?(t=e[1].length,e=parseInt(e[1],16),t===6?eQ(e):t===3?new Sl(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):t===8?lC(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):t===4?lC(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=Wye.exec(i))?new Sl(e[1],e[2],e[3],1):(e=jye.exec(i))?new Sl(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=Xye.exec(i))?lC(e[1],e[2],e[3],e[4]):(e=$ye.exec(i))?lC(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=Yye.exec(i))?iQ(e[1],e[2]/100,e[3]/100,1):(e=Zye.exec(i))?iQ(e[1],e[2]/100,e[3]/100,e[4]):KK.hasOwnProperty(i)?eQ(KK[i]):i==="transparent"?new Sl(NaN,NaN,NaN,0):null}function eQ(i){return new Sl(i>>16&255,i>>8&255,i&255,1)}function lC(i,e,t,n){return n<=0&&(i=e=t=NaN),new Sl(i,e,t,n)}function Jye(i){return i instanceof Jb||(i=zu(i)),i?(i=i.rgb(),new Sl(i.r,i.g,i.b,i.opacity)):new Sl}function b_(i,e,t,n){return arguments.length===1?Jye(i):new Sl(i,e,t,n??1)}function Sl(i,e,t,n){this.r=+i,this.g=+e,this.b=+t,this.opacity=+n}aC(Sl,b_,qF(Jb,{brighter(i){return i=i==null?uC:Math.pow(uC,i),new Sl(this.r*i,this.g*i,this.b*i,this.opacity)},darker(i){return i=i==null?Kb:Math.pow(Kb,i),new Sl(this.r*i,this.g*i,this.b*i,this.opacity)},rgb(){return this},clamp(){return new Sl(yg(this.r),yg(this.g),yg(this.b),hC(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:tQ,formatHex:tQ,formatHex8:e2e,formatRgb:nQ,toString:nQ}));function tQ(){return`#${xg(this.r)}${xg(this.g)}${xg(this.b)}`}function e2e(){return`#${xg(this.r)}${xg(this.g)}${xg(this.b)}${xg((isNaN(this.opacity)?1:this.opacity)*255)}`}function nQ(){let i=hC(this.opacity);return`${i===1?"rgb(":"rgba("}${yg(this.r)}, ${yg(this.g)}, ${yg(this.b)}${i===1?")":`, ${i})`}`}function hC(i){return isNaN(i)?1:Math.max(0,Math.min(1,i))}function yg(i){return Math.max(0,Math.min(255,Math.round(i)||0))}function xg(i){return i=yg(i),(i<16?"0":"")+i.toString(16)}function iQ(i,e,t,n){return n<=0?i=e=t=NaN:t<=0||t>=1?i=e=NaN:e<=0&&(i=NaN),new ku(i,e,t,n)}function sQ(i){if(i instanceof ku)return new ku(i.h,i.s,i.l,i.opacity);if(i instanceof Jb||(i=zu(i)),!i)return new ku;if(i instanceof ku)return i;i=i.rgb();var e=i.r/255,t=i.g/255,n=i.b/255,r=Math.min(e,t,n),s=Math.max(e,t,n),o=NaN,a=s-r,l=(s+r)/2;return a?(e===s?o=(t-n)/a+(t<n)*6:t===s?o=(n-e)/a+2:o=(e-t)/a+4,a/=l<.5?s+r:2-s-r,o*=60):a=l>0&&l<1?0:o,new ku(o,a,l,i.opacity)}function oQ(i,e,t,n){return arguments.length===1?sQ(i):new ku(i,e,t,n??1)}function ku(i,e,t,n){this.h=+i,this.s=+e,this.l=+t,this.opacity=+n}aC(ku,oQ,qF(Jb,{brighter(i){return i=i==null?uC:Math.pow(uC,i),new ku(this.h,this.s,this.l*i,this.opacity)},darker(i){return i=i==null?Kb:Math.pow(Kb,i),new ku(this.h,this.s,this.l*i,this.opacity)},rgb(){var i=this.h%360+(this.h<0)*360,e=isNaN(i)||isNaN(this.s)?0:this.s,t=this.l,n=t+(t<.5?t:1-t)*e,r=2*t-n;return new Sl(HF(i>=240?i-240:i+120,r,n),HF(i,r,n),HF(i<120?i+240:i-120,r,n),this.opacity)},clamp(){return new ku(rQ(this.h),cC(this.s),cC(this.l),hC(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let i=hC(this.opacity);return`${i===1?"hsl(":"hsla("}${rQ(this.h)}, ${cC(this.s)*100}%, ${cC(this.l)*100}%${i===1?")":`, ${i})`}`}}));function rQ(i){return i=(i||0)%360,i<0?i+360:i}function cC(i){return Math.max(0,Math.min(1,i||0))}function HF(i,e,t){return(i<60?e+(t-e)*i/60:i<180?t:i<240?e+(t-e)*(240-i)/60:e)*255}function WF(i,e,t,n,r){var s=i*i,o=s*i;return((1-3*i+3*s-o)*e+(4-6*s+3*o)*t+(1+3*i+3*s-3*o)*n+o*r)/6}function aQ(i){var e=i.length-1;return function(t){var n=t<=0?t=0:t>=1?(t=1,e-1):Math.floor(t*e),r=i[n],s=i[n+1],o=n>0?i[n-1]:2*r-s,a=n<e-1?i[n+2]:2*s-r;return WF((t-n/e)*e,o,r,s,a)}}function lQ(i){var e=i.length;return function(t){var n=Math.floor(((t%=1)<0?++t:t)*e),r=i[(n+e-1)%e],s=i[n%e],o=i[(n+1)%e],a=i[(n+2)%e];return WF((t-n/e)*e,r,s,o,a)}}var ew=i=>()=>i;function t2e(i,e){return function(t){return i+t*e}}function n2e(i,e,t){return i=Math.pow(i,t),e=Math.pow(e,t)-i,t=1/t,function(n){return Math.pow(i+n*e,t)}}function cQ(i){return(i=+i)==1?fC:function(e,t){return t-e?n2e(e,t,i):ew(isNaN(e)?t:e)}}function fC(i,e){var t=e-i;return t?t2e(i,t):ew(isNaN(i)?e:i)}var jF=(function i(e){var t=cQ(e);function n(r,s){var o=t((r=b_(r)).r,(s=b_(s)).r),a=t(r.g,s.g),l=t(r.b,s.b),c=fC(r.opacity,s.opacity);return function(u){return r.r=o(u),r.g=a(u),r.b=l(u),r.opacity=c(u),r+""}}return n.gamma=i,n})(1);function uQ(i){return function(e){var t=e.length,n=new Array(t),r=new Array(t),s=new Array(t),o,a;for(o=0;o<t;++o)a=b_(e[o]),n[o]=a.r||0,r[o]=a.g||0,s[o]=a.b||0;return n=i(n),r=i(r),s=i(s),a.opacity=1,function(l){return a.r=n(l),a.g=r(l),a.b=s(l),a+""}}}var Zet=uQ(aQ),Ket=uQ(lQ);function dC(i,e){e||(e=[]);var t=i?Math.min(e.length,i.length):0,n=e.slice(),r;return function(s){for(r=0;r<t;++r)n[r]=i[r]*(1-s)+e[r]*s;return n}}function pC(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function XF(i,e){return(pC(e)?dC:$F)(i,e)}function $F(i,e){var t=e?e.length:0,n=i?Math.min(t,i.length):0,r=new Array(n),s=new Array(t),o;for(o=0;o<n;++o)r[o]=bg(i[o],e[o]);for(;o<t;++o)s[o]=e[o];return function(a){for(o=0;o<n;++o)s[o]=r[o](a);return s}}function hQ(i,e){var t=new Date;return i=+i,e=+e,function(n){return t.setTime(i*(1-n)+e*n),t}}function tf(i,e){return i=+i,e=+e,function(t){return i*(1-t)+e*t}}function fQ(i,e){var t={},n={},r;(i===null||typeof i!="object")&&(i={}),(e===null||typeof e!="object")&&(e={});for(r in e)r in i?t[r]=bg(i[r],e[r]):n[r]=e[r];return function(s){for(r in t)n[r]=t[r](s);return n}}var ZF=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,YF=new RegExp(ZF.source,"g");function i2e(i){return function(){return i}}function r2e(i){return function(e){return i(e)+""}}function dQ(i,e){var t=ZF.lastIndex=YF.lastIndex=0,n,r,s,o=-1,a=[],l=[];for(i=i+"",e=e+"";(n=ZF.exec(i))&&(r=YF.exec(e));)(s=r.index)>t&&(s=e.slice(t,s),a[o]?a[o]+=s:a[++o]=s),(n=n[0])===(r=r[0])?a[o]?a[o]+=r:a[++o]=r:(a[++o]=null,l.push({i:o,x:tf(n,r)})),t=YF.lastIndex;return t<e.length&&(s=e.slice(t),a[o]?a[o]+=s:a[++o]=s),a.length<2?l[0]?r2e(l[0].x):i2e(e):(e=l.length,function(c){for(var u=0,f;u<e;++u)a[(f=l[u]).i]=f.x(c);return a.join("")})}function bg(i,e){var t=typeof e,n;return e==null||t==="boolean"?ew(e):(t==="number"?tf:t==="string"?(n=zu(e))?(e=n,jF):dQ:e instanceof zu?jF:e instanceof Date?hQ:pC(e)?dC:Array.isArray(e)?$F:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?fQ:tf)(i,e)}function KF(i,e){return i=+i,e=+e,function(t){return Math.round(i*(1-t)+e*t)}}function QF(i){return function(){return i}}function JF(i){return+i}var pQ=[0,1];function w_(i){return i}function eB(i,e){return(e-=i=+i)?function(t){return(t-i)/e}:QF(isNaN(e)?NaN:.5)}function s2e(i,e){var t;return i>e&&(t=i,i=e,e=t),function(n){return Math.max(i,Math.min(e,n))}}function o2e(i,e,t){var n=i[0],r=i[1],s=e[0],o=e[1];return r<n?(n=eB(r,n),s=t(o,s)):(n=eB(n,r),s=t(s,o)),function(a){return s(n(a))}}function a2e(i,e,t){var n=Math.min(i.length,e.length)-1,r=new Array(n),s=new Array(n),o=-1;for(i[n]<i[0]&&(i=i.slice().reverse(),e=e.slice().reverse());++o<n;)r[o]=eB(i[o],i[o+1]),s[o]=t(e[o],e[o+1]);return function(a){var l=Yb(i,a,1,n)-1;return s[l](r[l](a))}}function mQ(i,e){return e.domain(i.domain()).range(i.range()).interpolate(i.interpolate()).clamp(i.clamp()).unknown(i.unknown())}function l2e(){var i=pQ,e=pQ,t=bg,n,r,s,o=w_,a,l,c;function u(){var d=Math.min(i.length,e.length);return o!==w_&&(o=s2e(i[0],i[d-1])),a=d>2?a2e:o2e,l=c=null,f}function f(d){return d==null||isNaN(d=+d)?s:(l||(l=a(i.map(n),e,t)))(n(o(d)))}return f.invert=function(d){return o(r((c||(c=a(e,i.map(n),tf)))(d)))},f.domain=function(d){return arguments.length?(i=Array.from(d,JF),u()):i.slice()},f.range=function(d){return arguments.length?(e=Array.from(d),u()):e.slice()},f.rangeRound=function(d){return e=Array.from(d),t=KF,u()},f.clamp=function(d){return arguments.length?(o=d?!0:w_,u()):o!==w_},f.interpolate=function(d){return arguments.length?(t=d,u()):t},f.unknown=function(d){return arguments.length?(s=d,f):s},function(d,A){return n=d,r=A,u()}}function tB(){return l2e()(w_,w_)}function AQ(i){return Math.abs(i=Math.round(i))>=1e21?i.toLocaleString("en").replace(/,/g,""):i.toString(10)}function wg(i,e){if(!isFinite(i)||i===0)return null;var t=(i=e?i.toExponential(e-1):i.toExponential()).indexOf("e"),n=i.slice(0,t);return[n.length>1?n[0]+n.slice(2):n,+i.slice(t+1)]}function nf(i){return i=wg(Math.abs(i)),i?i[1]:NaN}function gQ(i,e){return function(t,n){for(var r=t.length,s=[],o=0,a=i[0],l=0;r>0&&a>0&&(l+a+1>n&&(a=Math.max(1,n-l)),s.push(t.substring(r-=a,r+a)),!((l+=a+1)>n));)a=i[o=(o+1)%i.length];return s.reverse().join(e)}}function vQ(i){return function(e){return e.replace(/[0-9]/g,function(t){return i[+t]})}}var c2e=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function X0(i){if(!(e=c2e.exec(i)))throw new Error("invalid format: "+i);var e;return new mC({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}X0.prototype=mC.prototype;function mC(i){this.fill=i.fill===void 0?" ":i.fill+"",this.align=i.align===void 0?">":i.align+"",this.sign=i.sign===void 0?"-":i.sign+"",this.symbol=i.symbol===void 0?"":i.symbol+"",this.zero=!!i.zero,this.width=i.width===void 0?void 0:+i.width,this.comma=!!i.comma,this.precision=i.precision===void 0?void 0:+i.precision,this.trim=!!i.trim,this.type=i.type===void 0?"":i.type+""}mC.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function _Q(i){e:for(var e=i.length,t=1,n=-1,r;t<e;++t)switch(i[t]){case".":n=r=t;break;case"0":n===0&&(n=t),r=t;break;default:if(!+i[t])break e;n>0&&(n=0);break}return n>0?i.slice(0,n)+i.slice(r+1):i}var tw;function xQ(i,e){var t=wg(i,e);if(!t)return tw=void 0,i.toPrecision(e);var n=t[0],r=t[1],s=r-(tw=Math.max(-8,Math.min(8,Math.floor(r/3)))*3)+1,o=n.length;return s===o?n:s>o?n+new Array(s-o+1).join("0"):s>0?n.slice(0,s)+"."+n.slice(s):"0."+new Array(1-s).join("0")+wg(i,Math.max(0,e+s-1))[0]}function nB(i,e){var t=wg(i,e);if(!t)return i+"";var n=t[0],r=t[1];return r<0?"0."+new Array(-r).join("0")+n:n.length>r+1?n.slice(0,r+1)+"."+n.slice(r+1):n+new Array(r-n.length+2).join("0")}var iB={"%":(i,e)=>(i*100).toFixed(e),b:i=>Math.round(i).toString(2),c:i=>i+"",d:AQ,e:(i,e)=>i.toExponential(e),f:(i,e)=>i.toFixed(e),g:(i,e)=>i.toPrecision(e),o:i=>Math.round(i).toString(8),p:(i,e)=>nB(i*100,e),r:nB,s:xQ,X:i=>Math.round(i).toString(16).toUpperCase(),x:i=>Math.round(i).toString(16)};function rB(i){return i}var yQ=Array.prototype.map,bQ=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function wQ(i){var e=i.grouping===void 0||i.thousands===void 0?rB:gQ(yQ.call(i.grouping,Number),i.thousands+""),t=i.currency===void 0?"":i.currency[0]+"",n=i.currency===void 0?"":i.currency[1]+"",r=i.decimal===void 0?".":i.decimal+"",s=i.numerals===void 0?rB:vQ(yQ.call(i.numerals,String)),o=i.percent===void 0?"%":i.percent+"",a=i.minus===void 0?"\u2212":i.minus+"",l=i.nan===void 0?"NaN":i.nan+"";function c(f,d){f=X0(f);var A=f.fill,y=f.align,w=f.sign,S=f.symbol,T=f.zero,R=f.width,P=f.comma,I=f.precision,F=f.trim,D=f.type;D==="n"?(P=!0,D="g"):iB[D]||(I===void 0&&(I=12),F=!0,D="g"),(T||A==="0"&&y==="=")&&(T=!0,A="0",y="=");var L=(d&&d.prefix!==void 0?d.prefix:"")+(S==="$"?t:S==="#"&&/[boxX]/.test(D)?"0"+D.toLowerCase():""),C=(S==="$"?n:/[%p]/.test(D)?o:"")+(d&&d.suffix!==void 0?d.suffix:""),B=iB[D],k=/[defgprs%]/.test(D);I=I===void 0?6:/[gprs]/.test(D)?Math.max(1,Math.min(21,I)):Math.max(0,Math.min(20,I));function z(G){var W=L,Y=C,H,$,J;if(D==="c")Y=B(G)+Y,G="";else{G=+G;var te=G<0||1/G<0;if(G=isNaN(G)?l:B(Math.abs(G),I),F&&(G=_Q(G)),te&&+G==0&&w!=="+"&&(te=!1),W=(te?w==="("?w:a:w==="-"||w==="("?"":w)+W,Y=(D==="s"&&!isNaN(G)&&tw!==void 0?bQ[8+tw/3]:"")+Y+(te&&w==="("?")":""),k){for(H=-1,$=G.length;++H<$;)if(J=G.charCodeAt(H),48>J||J>57){Y=(J===46?r+G.slice(H+1):G.slice(H))+Y,G=G.slice(0,H);break}}}P&&!T&&(G=e(G,1/0));var ce=W.length+G.length+Y.length,he=ce<R?new Array(R-ce+1).join(A):"";switch(P&&T&&(G=e(he+G,he.length?R-Y.length:1/0),he=""),y){case"<":G=W+G+Y+he;break;case"=":G=W+he+G+Y;break;case"^":G=he.slice(0,ce=he.length>>1)+W+G+Y+he.slice(ce);break;default:G=he+W+G+Y;break}return s(G)}return z.toString=function(){return f+""},z}function u(f,d){var A=Math.max(-8,Math.min(8,Math.floor(nf(d)/3)))*3,y=Math.pow(10,-A),w=c((f=X0(f),f.type="f",f),{suffix:bQ[8+A/3]});return function(S){return w(y*S)}}return{format:c,formatPrefix:u}}var AC,gC,vC;sB({thousands:",",grouping:[3],currency:["$",""]});function sB(i){return AC=wQ(i),gC=AC.format,vC=AC.formatPrefix,AC}function oB(i){return Math.max(0,-nf(Math.abs(i)))}function aB(i,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(nf(e)/3)))*3-nf(Math.abs(i)))}function lB(i,e){return i=Math.abs(i),e=Math.abs(e)-i,Math.max(0,nf(e)-nf(i))+1}function cB(i,e,t,n){var r=GF(i,e,t),s;switch(n=X0(n??",f"),n.type){case"s":{var o=Math.max(Math.abs(i),Math.abs(e));return n.precision==null&&!isNaN(s=aB(r,o))&&(n.precision=s),vC(n,o)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(s=lB(r,Math.max(Math.abs(i),Math.abs(e))))&&(n.precision=s-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(s=oB(r))&&(n.precision=s-(n.type==="%")*2);break}}return gC(n)}function uB(i){var e=i.domain;return i.ticks=function(t){var n=e();return nC(n[0],n[n.length-1],t??10)},i.tickFormat=function(t,n){var r=e();return cB(r[0],r[r.length-1],t??10,n)},i.nice=function(t){t==null&&(t=10);var n=e(),r=0,s=n.length-1,o=n[r],a=n[s],l,c,u=10;for(a<o&&(c=o,o=a,a=c,c=r,r=s,s=c);u-- >0;){if(c=Zb(o,a,t),c===l)return n[r]=o,n[s]=a,e(n);if(c>0)o=Math.floor(o/c)*c,a=Math.ceil(a/c)*c;else if(c<0)o=Math.ceil(o*c)/c,a=Math.floor(a*c)/c;else break;l=c}return i},i}function Tl(){var i=tB();return i.copy=function(){return mQ(i,Tl())},oC.apply(i,arguments),uB(i)}function nw(){var i=0,e=1,t=1,n=[.5],r=[0,1],s;function o(l){return l!=null&&l<=l?r[Yb(n,l,0,t)]:s}function a(){var l=-1;for(n=new Array(t);++l<t;)n[l]=((l+1)*e-(l-t)*i)/(t+1);return o}return o.domain=function(l){return arguments.length?([i,e]=l,i=+i,e=+e,a()):[i,e]},o.range=function(l){return arguments.length?(t=(r=Array.from(l)).length-1,a()):r.slice()},o.invertExtent=function(l){var c=r.indexOf(l);return c<0?[NaN,NaN]:c<1?[i,n[0]]:c>=t?[n[t-1],e]:[n[c-1],n[c]]},o.unknown=function(l){return arguments.length&&(s=l),o},o.thresholds=function(){return n.slice()},o.copy=function(){return nw().domain([i,e]).range(r).unknown(s)},oC.apply(uB(o),arguments)}var Pn=1e-6,Sg=1e-12,ri=Math.PI,yo=ri/2,S_=ri/4,bo=ri*2,ur=180/ri,_n=ri/180,si=Math.abs,T_=Math.atan,Rs=Math.atan2,mn=Math.cos,iw=Math.ceil,SQ=Math.exp;var _C=Math.hypot,TQ=Math.log;var un=Math.sin,EQ=Math.sign||function(i){return i>0?1:i<0?-1:0},Ho=Math.sqrt,MQ=Math.tan;function CQ(i){return i>1?0:i<-1?ri:Math.acos(i)}function fa(i){return i>1?yo:i<-1?-yo:Math.asin(i)}function hB(i){return(i=un(i/2))*i}function ms(){}function xC(i,e){i&&IQ.hasOwnProperty(i.type)&&IQ[i.type](i,e)}var RQ={Feature:function(i,e){xC(i.geometry,e)},FeatureCollection:function(i,e){for(var t=i.features,n=-1,r=t.length;++n<r;)xC(t[n].geometry,e)}},IQ={Sphere:function(i,e){e.sphere()},Point:function(i,e){i=i.coordinates,e.point(i[0],i[1],i[2])},MultiPoint:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)i=t[n],e.point(i[0],i[1],i[2])},LineString:function(i,e){fB(i.coordinates,e,0)},MultiLineString:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)fB(t[n],e,0)},Polygon:function(i,e){PQ(i.coordinates,e)},MultiPolygon:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)PQ(t[n],e)},GeometryCollection:function(i,e){for(var t=i.geometries,n=-1,r=t.length;++n<r;)xC(t[n],e)}};function fB(i,e,t){var n=-1,r=i.length-t,s;for(e.lineStart();++n<r;)s=i[n],e.point(s[0],s[1],s[2]);e.lineEnd()}function PQ(i,e){var t=-1,n=i.length;for(e.polygonStart();++t<n;)fB(i[t],e,1);e.polygonEnd()}function $0(i,e){i&&RQ.hasOwnProperty(i.type)?RQ[i.type](i,e):xC(i,e)}var rw=new qo,LQ=new qo,DQ,NQ,dB,pB,mB,rf={point:ms,lineStart:ms,lineEnd:ms,polygonStart:function(){rw=new qo,rf.lineStart=u2e,rf.lineEnd=h2e},polygonEnd:function(){var i=+rw;LQ.add(i<0?bo+i:i),this.lineStart=this.lineEnd=this.point=ms},sphere:function(){LQ.add(bo)}};function u2e(){rf.point=f2e}function h2e(){FQ(DQ,NQ)}function f2e(i,e){rf.point=FQ,DQ=i,NQ=e,i*=_n,e*=_n,dB=i,pB=mn(e=e/2+S_),mB=un(e)}function FQ(i,e){i*=_n,e*=_n,e=e/2+S_;var t=i-dB,n=t>=0?1:-1,r=n*t,s=mn(e),o=un(e),a=mB*o,l=pB*s+a*mn(r),c=a*n*un(r);rw.add(Rs(c,l)),dB=i,pB=s,mB=o}function Tg(i){return[Rs(i[1],i[0]),fa(i[2])]}function $c(i){var e=i[0],t=i[1],n=mn(t);return[n*mn(e),n*un(e),un(t)]}function sw(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]}function kd(i,e){return[i[1]*e[2]-i[2]*e[1],i[2]*e[0]-i[0]*e[2],i[0]*e[1]-i[1]*e[0]]}function yC(i,e){i[0]+=e[0],i[1]+=e[1],i[2]+=e[2]}function ow(i,e){return[i[0]*e,i[1]*e,i[2]*e]}function Eg(i){var e=Ho(i[0]*i[0]+i[1]*i[1]+i[2]*i[2]);i[0]/=e,i[1]/=e,i[2]/=e}var Jr,El,As,ic,Mg,kQ,zQ,E_,aw,Y0,Vd,zd={point:AB,lineStart:BQ,lineEnd:OQ,polygonStart:function(){zd.point=GQ,zd.lineStart=d2e,zd.lineEnd=p2e,aw=new qo,rf.polygonStart()},polygonEnd:function(){rf.polygonEnd(),zd.point=AB,zd.lineStart=BQ,zd.lineEnd=OQ,rw<0?(Jr=-(As=180),El=-(ic=90)):aw>Pn?ic=90:aw<-Pn&&(El=-90),Vd[0]=Jr,Vd[1]=As},sphere:function(){Jr=-(As=180),El=-(ic=90)}};function AB(i,e){Y0.push(Vd=[Jr=i,As=i]),e<El&&(El=e),e>ic&&(ic=e)}function VQ(i,e){var t=$c([i*_n,e*_n]);if(E_){var n=kd(E_,t),r=[n[1],-n[0],0],s=kd(r,n);Eg(s),s=Tg(s);var o=i-Mg,a=o>0?1:-1,l=s[0]*ur*a,c,u=si(o)>180;u^(a*Mg<l&&l<a*i)?(c=s[1]*ur,c>ic&&(ic=c)):(l=(l+360)%360-180,u^(a*Mg<l&&l<a*i)?(c=-s[1]*ur,c<El&&(El=c)):(e<El&&(El=e),e>ic&&(ic=e))),u?i<Mg?nc(Jr,i)>nc(Jr,As)&&(As=i):nc(i,As)>nc(Jr,As)&&(Jr=i):As>=Jr?(i<Jr&&(Jr=i),i>As&&(As=i)):i>Mg?nc(Jr,i)>nc(Jr,As)&&(As=i):nc(i,As)>nc(Jr,As)&&(Jr=i)}else Y0.push(Vd=[Jr=i,As=i]);e<El&&(El=e),e>ic&&(ic=e),E_=t,Mg=i}function BQ(){zd.point=VQ}function OQ(){Vd[0]=Jr,Vd[1]=As,zd.point=AB,E_=null}function GQ(i,e){if(E_){var t=i-Mg;aw.add(si(t)>180?t+(t>0?360:-360):t)}else kQ=i,zQ=e;rf.point(i,e),VQ(i,e)}function d2e(){rf.lineStart()}function p2e(){GQ(kQ,zQ),rf.lineEnd(),si(aw)>Pn&&(Jr=-(As=180)),Vd[0]=Jr,Vd[1]=As,E_=null}function nc(i,e){return(e-=i)<0?e+360:e}function m2e(i,e){return i[0]-e[0]}function UQ(i,e){return i[0]<=i[1]?i[0]<=e&&e<=i[1]:e<i[0]||i[1]<e}function bC(i){var e,t,n,r,s,o,a;if(ic=As=-(Jr=El=1/0),Y0=[],$0(i,zd),t=Y0.length){for(Y0.sort(m2e),e=1,n=Y0[0],s=[n];e<t;++e)r=Y0[e],UQ(n,r[0])||UQ(n,r[1])?(nc(n[0],r[1])>nc(n[0],n[1])&&(n[1]=r[1]),nc(r[0],n[1])>nc(n[0],n[1])&&(n[0]=r[0])):s.push(n=r);for(o=-1/0,t=s.length-1,e=0,n=s[t];e<=t;n=r,++e)r=s[e],(a=nc(n[1],r[0]))>o&&(o=a,Jr=r[0],As=n[1])}return Y0=Vd=null,Jr===1/0||El===1/0?[[NaN,NaN],[NaN,NaN]]:[[Jr,El],[As,ic]]}var lw,wC,SC,TC,EC,MC,CC,RC,gB,vB,_B,WQ,jQ,Wa,ja,Xa,Vu={sphere:ms,point:xB,lineStart:qQ,lineEnd:HQ,polygonStart:function(){Vu.lineStart=v2e,Vu.lineEnd=_2e},polygonEnd:function(){Vu.lineStart=qQ,Vu.lineEnd=HQ}};function xB(i,e){i*=_n,e*=_n;var t=mn(e);cw(t*mn(i),t*un(i),un(e))}function cw(i,e,t){++lw,SC+=(i-SC)/lw,TC+=(e-TC)/lw,EC+=(t-EC)/lw}function qQ(){Vu.point=A2e}function A2e(i,e){i*=_n,e*=_n;var t=mn(e);Wa=t*mn(i),ja=t*un(i),Xa=un(e),Vu.point=g2e,cw(Wa,ja,Xa)}function g2e(i,e){i*=_n,e*=_n;var t=mn(e),n=t*mn(i),r=t*un(i),s=un(e),o=Rs(Ho((o=ja*s-Xa*r)*o+(o=Xa*n-Wa*s)*o+(o=Wa*r-ja*n)*o),Wa*n+ja*r+Xa*s);wC+=o,MC+=o*(Wa+(Wa=n)),CC+=o*(ja+(ja=r)),RC+=o*(Xa+(Xa=s)),cw(Wa,ja,Xa)}function HQ(){Vu.point=xB}function v2e(){Vu.point=x2e}function _2e(){XQ(WQ,jQ),Vu.point=xB}function x2e(i,e){WQ=i,jQ=e,i*=_n,e*=_n,Vu.point=XQ;var t=mn(e);Wa=t*mn(i),ja=t*un(i),Xa=un(e),cw(Wa,ja,Xa)}function XQ(i,e){i*=_n,e*=_n;var t=mn(e),n=t*mn(i),r=t*un(i),s=un(e),o=ja*s-Xa*r,a=Xa*n-Wa*s,l=Wa*r-ja*n,c=_C(o,a,l),u=fa(c),f=c&&-u/c;gB.add(f*o),vB.add(f*a),_B.add(f*l),wC+=u,MC+=u*(Wa+(Wa=n)),CC+=u*(ja+(ja=r)),RC+=u*(Xa+(Xa=s)),cw(Wa,ja,Xa)}function IC(i){lw=wC=SC=TC=EC=MC=CC=RC=0,gB=new qo,vB=new qo,_B=new qo,$0(i,Vu);var e=+gB,t=+vB,n=+_B,r=_C(e,t,n);return r<Sg&&(e=MC,t=CC,n=RC,wC<Pn&&(e=SC,t=TC,n=EC),r=_C(e,t,n),r<Sg)?[NaN,NaN]:[Rs(t,e)*ur,fa(n/r)*ur]}function uw(i,e){function t(n,r){return n=i(n,r),e(n[0],n[1])}return i.invert&&e.invert&&(t.invert=function(n,r){return n=e.invert(n,r),n&&i.invert(n[0],n[1])}),t}function yB(i,e){return si(i)>ri&&(i-=Math.round(i/bo)*bo),[i,e]}yB.invert=yB;function bB(i,e,t){return(i%=bo)?e||t?uw(YQ(i),ZQ(e,t)):YQ(i):e||t?ZQ(e,t):yB}function $Q(i){return function(e,t){return e+=i,si(e)>ri&&(e-=Math.round(e/bo)*bo),[e,t]}}function YQ(i){var e=$Q(i);return e.invert=$Q(-i),e}function ZQ(i,e){var t=mn(i),n=un(i),r=mn(e),s=un(e);function o(a,l){var c=mn(l),u=mn(a)*c,f=un(a)*c,d=un(l),A=d*t+u*n;return[Rs(f*r-A*s,u*t-d*n),fa(A*r+f*s)]}return o.invert=function(a,l){var c=mn(l),u=mn(a)*c,f=un(a)*c,d=un(l),A=d*r-f*s;return[Rs(f*r+d*s,u*t+A*n),fa(A*t-u*n)]},o}function wB(i){i=bB(i[0]*_n,i[1]*_n,i.length>2?i[2]*_n:0);function e(t){return t=i(t[0]*_n,t[1]*_n),t[0]*=ur,t[1]*=ur,t}return e.invert=function(t){return t=i.invert(t[0]*_n,t[1]*_n),t[0]*=ur,t[1]*=ur,t},e}function QQ(i,e,t,n,r,s){if(t){var o=mn(e),a=un(e),l=n*t;r==null?(r=e+n*bo,s=e-l/2):(r=KQ(o,r),s=KQ(o,s),(n>0?r<s:r>s)&&(r+=n*bo));for(var c,u=r;n>0?u>s:u<s;u-=l)c=Tg([o,-a*mn(u),-a*un(u)]),i.point(c[0],c[1])}}function KQ(i,e){e=$c(e),e[0]-=i,Eg(e);var t=CQ(-e[1]);return((-e[2]<0?-t:t)+bo-Pn)%bo}function PC(){var i=[],e;return{point:function(t,n,r){e.push([t,n,r])},lineStart:function(){i.push(e=[])},lineEnd:ms,rejoin:function(){i.length>1&&i.push(i.pop().concat(i.shift()))},result:function(){var t=i;return i=[],e=null,t}}}function M_(i,e){return si(i[0]-e[0])<Pn&&si(i[1]-e[1])<Pn}function LC(i,e,t,n){this.x=i,this.z=e,this.o=t,this.e=n,this.v=!1,this.n=this.p=null}function DC(i,e,t,n,r){var s=[],o=[],a,l;if(i.forEach(function(y){if(!((w=y.length-1)<=0)){var w,S=y[0],T=y[w],R;if(M_(S,T)){if(!S[2]&&!T[2]){for(r.lineStart(),a=0;a<w;++a)r.point((S=y[a])[0],S[1]);r.lineEnd();return}T[0]+=2*Pn}s.push(R=new LC(S,y,null,!0)),o.push(R.o=new LC(S,null,R,!1)),s.push(R=new LC(T,y,null,!1)),o.push(R.o=new LC(T,null,R,!0))}}),!!s.length){for(o.sort(e),JQ(s),JQ(o),a=0,l=o.length;a<l;++a)o[a].e=t=!t;for(var c=s[0],u,f;;){for(var d=c,A=!0;d.v;)if((d=d.n)===c)return;u=d.z,r.lineStart();do{if(d.v=d.o.v=!0,d.e){if(A)for(a=0,l=u.length;a<l;++a)r.point((f=u[a])[0],f[1]);else n(d.x,d.n.x,1,r);d=d.n}else{if(A)for(u=d.p.z,a=u.length-1;a>=0;--a)r.point((f=u[a])[0],f[1]);else n(d.x,d.p.x,-1,r);d=d.p}d=d.o,u=d.z,A=!A}while(!d.v);r.lineEnd()}}}function JQ(i){if(e=i.length){for(var e,t=0,n=i[0],r;++t<e;)n.n=r=i[t],r.p=n,n=r;n.n=r=i[0],r.p=n}}function SB(i){return si(i[0])<=ri?i[0]:EQ(i[0])*((si(i[0])+ri)%bo-ri)}function NC(i,e){var t=SB(e),n=e[1],r=un(n),s=[un(t),-mn(t),0],o=0,a=0,l=new qo;r===1?n=yo+Pn:r===-1&&(n=-yo-Pn);for(var c=0,u=i.length;c<u;++c)if(d=(f=i[c]).length)for(var f,d,A=f[d-1],y=SB(A),w=A[1]/2+S_,S=un(w),T=mn(w),R=0;R<d;++R,y=I,S=D,T=L,A=P){var P=f[R],I=SB(P),F=P[1]/2+S_,D=un(F),L=mn(F),C=I-y,B=C>=0?1:-1,k=B*C,z=k>ri,G=S*D;if(l.add(Rs(G*B*un(k),T*L+G*mn(k))),o+=z?C+B*bo:C,z^y>=t^I>=t){var W=kd($c(A),$c(P));Eg(W);var Y=kd(s,W);Eg(Y);var H=(z^C>=0?-1:1)*fa(Y[2]);(n>H||n===H&&(W[0]||W[1]))&&(a+=z^C>=0?1:-1)}}return(o<-Pn||o<Pn&&l<-Sg)^a&1}function FC(i,e,t,n){return function(r){var s=e(r),o=PC(),a=e(o),l=!1,c,u,f,d={point:A,lineStart:w,lineEnd:S,polygonStart:function(){d.point=T,d.lineStart=R,d.lineEnd=P,u=[],c=[]},polygonEnd:function(){d.point=A,d.lineStart=w,d.lineEnd=S,u=Jh(u);var I=NC(c,n);u.length?(l||(r.polygonStart(),l=!0),DC(u,b2e,I,t,r)):I&&(l||(r.polygonStart(),l=!0),r.lineStart(),t(null,null,1,r),r.lineEnd()),l&&(r.polygonEnd(),l=!1),u=c=null},sphere:function(){r.polygonStart(),r.lineStart(),t(null,null,1,r),r.lineEnd(),r.polygonEnd()}};function A(I,F){i(I,F)&&r.point(I,F)}function y(I,F){s.point(I,F)}function w(){d.point=y,s.lineStart()}function S(){d.point=A,s.lineEnd()}function T(I,F){f.push([I,F]),a.point(I,F)}function R(){a.lineStart(),f=[]}function P(){T(f[0][0],f[0][1]),a.lineEnd();var I=a.clean(),F=o.result(),D,L=F.length,C,B,k;if(f.pop(),c.push(f),f=null,!!L){if(I&1){if(B=F[0],(C=B.length-1)>0){for(l||(r.polygonStart(),l=!0),r.lineStart(),D=0;D<C;++D)r.point((k=B[D])[0],k[1]);r.lineEnd()}return}L>1&&I&2&&F.push(F.pop().concat(F.shift())),u.push(F.filter(y2e))}}return d}}function y2e(i){return i.length>1}function b2e(i,e){return((i=i.x)[0]<0?i[1]-yo-Pn:yo-i[1])-((e=e.x)[0]<0?e[1]-yo-Pn:yo-e[1])}var TB=FC(function(){return!0},w2e,T2e,[-ri,-yo]);function w2e(i){var e=NaN,t=NaN,n=NaN,r;return{lineStart:function(){i.lineStart(),r=1},point:function(s,o){var a=s>0?ri:-ri,l=si(s-e);si(l-ri)<Pn?(i.point(e,t=(t+o)/2>0?yo:-yo),i.point(n,t),i.lineEnd(),i.lineStart(),i.point(a,t),i.point(s,t),r=0):n!==a&&l>=ri&&(si(e-n)<Pn&&(e-=n*Pn),si(s-a)<Pn&&(s-=a*Pn),t=S2e(e,t,s,o),i.point(n,t),i.lineEnd(),i.lineStart(),i.point(a,t),r=0),i.point(e=s,t=o),n=a},lineEnd:function(){i.lineEnd(),e=t=NaN},clean:function(){return 2-r}}}function S2e(i,e,t,n){var r,s,o=un(i-t);return si(o)>Pn?T_((un(e)*(s=mn(n))*un(t)-un(n)*(r=mn(e))*un(i))/(r*s*o)):(e+n)/2}function T2e(i,e,t,n){var r;if(i==null)r=t*yo,n.point(-ri,r),n.point(0,r),n.point(ri,r),n.point(ri,0),n.point(ri,-r),n.point(0,-r),n.point(-ri,-r),n.point(-ri,0),n.point(-ri,r);else if(si(i[0]-e[0])>Pn){var s=i[0]<e[0]?ri:-ri;r=t*s/2,n.point(-s,r),n.point(0,r),n.point(s,r)}else n.point(e[0],e[1])}function eJ(i){var e=mn(i),t=2*_n,n=e>0,r=si(e)>Pn;function s(u,f,d,A){QQ(A,i,t,d,u,f)}function o(u,f){return mn(u)*mn(f)>e}function a(u){var f,d,A,y,w;return{lineStart:function(){y=A=!1,w=1},point:function(S,T){var R=[S,T],P,I=o(S,T),F=n?I?0:c(S,T):I?c(S+(S<0?ri:-ri),T):0;if(!f&&(y=A=I)&&u.lineStart(),I!==A&&(P=l(f,R),(!P||M_(f,P)||M_(R,P))&&(R[2]=1)),I!==A)w=0,I?(u.lineStart(),P=l(R,f),u.point(P[0],P[1])):(P=l(f,R),u.point(P[0],P[1],2),u.lineEnd()),f=P;else if(r&&f&&n^I){var D;!(F&d)&&(D=l(R,f,!0))&&(w=0,n?(u.lineStart(),u.point(D[0][0],D[0][1]),u.point(D[1][0],D[1][1]),u.lineEnd()):(u.point(D[1][0],D[1][1]),u.lineEnd(),u.lineStart(),u.point(D[0][0],D[0][1],3)))}I&&(!f||!M_(f,R))&&u.point(R[0],R[1]),f=R,A=I,d=F},lineEnd:function(){A&&u.lineEnd(),f=null},clean:function(){return w|(y&&A)<<1}}}function l(u,f,d){var A=$c(u),y=$c(f),w=[1,0,0],S=kd(A,y),T=sw(S,S),R=S[0],P=T-R*R;if(!P)return!d&&u;var I=e*T/P,F=-e*R/P,D=kd(w,S),L=ow(w,I),C=ow(S,F);yC(L,C);var B=D,k=sw(L,B),z=sw(B,B),G=k*k-z*(sw(L,L)-1);if(!(G<0)){var W=Ho(G),Y=ow(B,(-k-W)/z);if(yC(Y,L),Y=Tg(Y),!d)return Y;var H=u[0],$=f[0],J=u[1],te=f[1],ce;$<H&&(ce=H,H=$,$=ce);var he=$-H,ve=si(he-ri)<Pn,Re=ve||he<Pn;if(!ve&&te<J&&(ce=J,J=te,te=ce),Re?ve?J+te>0^Y[1]<(si(Y[0]-H)<Pn?J:te):J<=Y[1]&&Y[1]<=te:he>ri^(H<=Y[0]&&Y[0]<=$)){var Qe=ow(B,(-k+W)/z);return yC(Qe,L),[Y,Tg(Qe)]}}}function c(u,f){var d=n?i:ri-i,A=0;return u<-d?A|=1:u>d&&(A|=2),f<-d?A|=4:f>d&&(A|=8),A}return FC(o,a,s,n?[0,-i]:[-ri,i-ri])}function tJ(i,e,t,n,r,s){var o=i[0],a=i[1],l=e[0],c=e[1],u=0,f=1,d=l-o,A=c-a,y;if(y=t-o,!(!d&&y>0)){if(y/=d,d<0){if(y<u)return;y<f&&(f=y)}else if(d>0){if(y>f)return;y>u&&(u=y)}if(y=r-o,!(!d&&y<0)){if(y/=d,d<0){if(y>f)return;y>u&&(u=y)}else if(d>0){if(y<u)return;y<f&&(f=y)}if(y=n-a,!(!A&&y>0)){if(y/=A,A<0){if(y<u)return;y<f&&(f=y)}else if(A>0){if(y>f)return;y>u&&(u=y)}if(y=s-a,!(!A&&y<0)){if(y/=A,A<0){if(y>f)return;y>u&&(u=y)}else if(A>0){if(y<u)return;y<f&&(f=y)}return u>0&&(i[0]=o+u*d,i[1]=a+u*A),f<1&&(e[0]=o+f*d,e[1]=a+f*A),!0}}}}}var hw=1e9,BC=-hw;function EB(i,e,t,n){function r(c,u){return i<=c&&c<=t&&e<=u&&u<=n}function s(c,u,f,d){var A=0,y=0;if(c==null||(A=o(c,f))!==(y=o(u,f))||l(c,u)<0^f>0)do d.point(A===0||A===3?i:t,A>1?n:e);while((A=(A+f+4)%4)!==y);else d.point(u[0],u[1])}function o(c,u){return si(c[0]-i)<Pn?u>0?0:3:si(c[0]-t)<Pn?u>0?2:1:si(c[1]-e)<Pn?u>0?1:0:u>0?3:2}function a(c,u){return l(c.x,u.x)}function l(c,u){var f=o(c,1),d=o(u,1);return f!==d?f-d:f===0?u[1]-c[1]:f===1?c[0]-u[0]:f===2?c[1]-u[1]:u[0]-c[0]}return function(c){var u=c,f=PC(),d,A,y,w,S,T,R,P,I,F,D,L={point:C,lineStart:G,lineEnd:W,polygonStart:k,polygonEnd:z};function C(H,$){r(H,$)&&u.point(H,$)}function B(){for(var H=0,$=0,J=A.length;$<J;++$)for(var te=A[$],ce=1,he=te.length,ve=te[0],Re,Qe,Fe=ve[0],mt=ve[1];ce<he;++ce)Re=Fe,Qe=mt,ve=te[ce],Fe=ve[0],mt=ve[1],Qe<=n?mt>n&&(Fe-Re)*(n-Qe)>(mt-Qe)*(i-Re)&&++H:mt<=n&&(Fe-Re)*(n-Qe)<(mt-Qe)*(i-Re)&&--H;return H}function k(){u=f,d=[],A=[],D=!0}function z(){var H=B(),$=D&&H,J=(d=Jh(d)).length;($||J)&&(c.polygonStart(),$&&(c.lineStart(),s(null,null,1,c),c.lineEnd()),J&&DC(d,a,H,s,c),c.polygonEnd()),u=c,d=A=y=null}function G(){L.point=Y,A&&A.push(y=[]),F=!0,I=!1,R=P=NaN}function W(){d&&(Y(w,S),T&&I&&f.rejoin(),d.push(f.result())),L.point=C,I&&u.lineEnd()}function Y(H,$){var J=r(H,$);if(A&&y.push([H,$]),F)w=H,S=$,T=J,F=!1,J&&(u.lineStart(),u.point(H,$));else if(J&&I)u.point(H,$);else{var te=[R=Math.max(BC,Math.min(hw,R)),P=Math.max(BC,Math.min(hw,P))],ce=[H=Math.max(BC,Math.min(hw,H)),$=Math.max(BC,Math.min(hw,$))];tJ(te,ce,i,e,t,n)?(I||(u.lineStart(),u.point(te[0],te[1])),u.point(ce[0],ce[1]),J||u.lineEnd(),D=!1):J&&(u.lineStart(),u.point(H,$),D=!1)}R=H,P=$,I=J}return L}}var MB,CB,OC,UC,C_={sphere:ms,point:ms,lineStart:E2e,lineEnd:ms,polygonStart:ms,polygonEnd:ms};function E2e(){C_.point=C2e,C_.lineEnd=M2e}function M2e(){C_.point=C_.lineEnd=ms}function C2e(i,e){i*=_n,e*=_n,CB=i,OC=un(e),UC=mn(e),C_.point=R2e}function R2e(i,e){i*=_n,e*=_n;var t=un(e),n=mn(e),r=si(i-CB),s=mn(r),o=un(r),a=n*o,l=UC*t-OC*n*s,c=OC*t+UC*n*s;MB.add(Rs(Ho(a*a+l*l),c)),CB=i,OC=t,UC=n}function nJ(i){return MB=new qo,$0(i,C_),+MB}var RB=[null,null],I2e={type:"LineString",coordinates:RB};function Ml(i,e){return RB[0]=i,RB[1]=e,nJ(I2e)}var iJ={Feature:function(i,e){return kC(i.geometry,e)},FeatureCollection:function(i,e){for(var t=i.features,n=-1,r=t.length;++n<r;)if(kC(t[n].geometry,e))return!0;return!1}},rJ={Sphere:function(){return!0},Point:function(i,e){return sJ(i.coordinates,e)},MultiPoint:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)if(sJ(t[n],e))return!0;return!1},LineString:function(i,e){return oJ(i.coordinates,e)},MultiLineString:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)if(oJ(t[n],e))return!0;return!1},Polygon:function(i,e){return aJ(i.coordinates,e)},MultiPolygon:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)if(aJ(t[n],e))return!0;return!1},GeometryCollection:function(i,e){for(var t=i.geometries,n=-1,r=t.length;++n<r;)if(kC(t[n],e))return!0;return!1}};function kC(i,e){return i&&rJ.hasOwnProperty(i.type)?rJ[i.type](i,e):!1}function sJ(i,e){return Ml(i,e)===0}function oJ(i,e){for(var t,n,r,s=0,o=i.length;s<o;s++){if(n=Ml(i[s],e),n===0||s>0&&(r=Ml(i[s],i[s-1]),r>0&&t<=r&&n<=r&&(t+n-r)*(1-Math.pow((t-n)/r,2))<Sg*r))return!0;t=n}return!1}function aJ(i,e){return!!NC(i.map(P2e),lJ(e))}function P2e(i){return i=i.map(lJ),i.pop(),i}function lJ(i){return[i[0]*_n,i[1]*_n]}function IB(i,e){return(i&&iJ.hasOwnProperty(i.type)?iJ[i.type]:kC)(i,e)}function cJ(i,e,t){var n=Ud(i,e-Pn,t).concat(e);return function(r){return n.map(function(s){return[r,s]})}}function uJ(i,e,t){var n=Ud(i,e-Pn,t).concat(e);return function(r){return n.map(function(s){return[s,r]})}}function PB(){var i,e,t,n,r,s,o,a,l=10,c=l,u=90,f=360,d,A,y,w,S=2.5;function T(){return{type:"MultiLineString",coordinates:R()}}function R(){return Ud(iw(n/u)*u,t,u).map(y).concat(Ud(iw(a/f)*f,o,f).map(w)).concat(Ud(iw(e/l)*l,i,l).filter(function(P){return si(P%u)>Pn}).map(d)).concat(Ud(iw(s/c)*c,r,c).filter(function(P){return si(P%f)>Pn}).map(A))}return T.lines=function(){return R().map(function(P){return{type:"LineString",coordinates:P}})},T.outline=function(){return{type:"Polygon",coordinates:[y(n).concat(w(o).slice(1),y(t).reverse().slice(1),w(a).reverse().slice(1))]}},T.extent=function(P){return arguments.length?T.extentMajor(P).extentMinor(P):T.extentMinor()},T.extentMajor=function(P){return arguments.length?(n=+P[0][0],t=+P[1][0],a=+P[0][1],o=+P[1][1],n>t&&(P=n,n=t,t=P),a>o&&(P=a,a=o,o=P),T.precision(S)):[[n,a],[t,o]]},T.extentMinor=function(P){return arguments.length?(e=+P[0][0],i=+P[1][0],s=+P[0][1],r=+P[1][1],e>i&&(P=e,e=i,i=P),s>r&&(P=s,s=r,r=P),T.precision(S)):[[e,s],[i,r]]},T.step=function(P){return arguments.length?T.stepMajor(P).stepMinor(P):T.stepMinor()},T.stepMajor=function(P){return arguments.length?(u=+P[0],f=+P[1],T):[u,f]},T.stepMinor=function(P){return arguments.length?(l=+P[0],c=+P[1],T):[l,c]},T.precision=function(P){return arguments.length?(S=+P,d=cJ(s,r,90),A=uJ(e,i,S),y=cJ(a,o,90),w=uJ(n,t,S),T):S},T.extentMajor([[-180,-90+Pn],[180,90-Pn]]).extentMinor([[-180,-80-Pn],[180,80+Pn]])}function LB(){return PB()()}function Cg(i,e){var t=i[0]*_n,n=i[1]*_n,r=e[0]*_n,s=e[1]*_n,o=mn(n),a=un(n),l=mn(s),c=un(s),u=o*mn(t),f=o*un(t),d=l*mn(r),A=l*un(r),y=2*fa(Ho(hB(s-n)+o*l*hB(r-t))),w=un(y),S=y?function(T){var R=un(T*=y)/w,P=un(y-T)/w,I=P*u+R*d,F=P*f+R*A,D=P*a+R*c;return[Rs(F,I)*ur,Rs(D,Ho(I*I+F*F))*ur]}:function(){return[t*ur,n*ur]};return S.distance=y,S}var DB=i=>i;var R_=1/0,zC=R_,fw=-R_,VC=fw,L2e={point:D2e,lineStart:ms,lineEnd:ms,polygonStart:ms,polygonEnd:ms,result:function(){var i=[[R_,zC],[fw,VC]];return fw=VC=-(zC=R_=1/0),i}};function D2e(i,e){i<R_&&(R_=i),i>fw&&(fw=i),e<zC&&(zC=e),e>VC&&(VC=e)}var NB=L2e;function dw(i){return function(e){var t=new FB;for(var n in i)t[n]=i[n];return t.stream=e,t}}function FB(){}FB.prototype={constructor:FB,point:function(i,e){this.stream.point(i,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function BB(i,e,t){var n=i.clipExtent&&i.clipExtent();return i.scale(150).translate([0,0]),n!=null&&i.clipExtent(null),$0(t,i.stream(NB)),e(NB.result()),n!=null&&i.clipExtent(n),i}function OB(i,e,t){return BB(i,function(n){var r=e[1][0]-e[0][0],s=e[1][1]-e[0][1],o=Math.min(r/(n[1][0]-n[0][0]),s/(n[1][1]-n[0][1])),a=+e[0][0]+(r-o*(n[1][0]+n[0][0]))/2,l=+e[0][1]+(s-o*(n[1][1]+n[0][1]))/2;i.scale(150*o).translate([a,l])},t)}function hJ(i,e,t){return OB(i,[[0,0],e],t)}function fJ(i,e,t){return BB(i,function(n){var r=+e,s=r/(n[1][0]-n[0][0]),o=(r-s*(n[1][0]+n[0][0]))/2,a=-s*n[0][1];i.scale(150*s).translate([o,a])},t)}function dJ(i,e,t){return BB(i,function(n){var r=+e,s=r/(n[1][1]-n[0][1]),o=-s*n[0][0],a=(r-s*(n[1][1]+n[0][1]))/2;i.scale(150*s).translate([o,a])},t)}var pJ=16,N2e=mn(30*_n);function UB(i,e){return+e?B2e(i,e):F2e(i)}function F2e(i){return dw({point:function(e,t){e=i(e,t),this.stream.point(e[0],e[1])}})}function B2e(i,e){function t(n,r,s,o,a,l,c,u,f,d,A,y,w,S){var T=c-n,R=u-r,P=T*T+R*R;if(P>4*e&&w--){var I=o+d,F=a+A,D=l+y,L=Ho(I*I+F*F+D*D),C=fa(D/=L),B=si(si(D)-1)<Pn||si(s-f)<Pn?(s+f)/2:Rs(F,I),k=i(B,C),z=k[0],G=k[1],W=z-n,Y=G-r,H=R*W-T*Y;(H*H/P>e||si((T*W+R*Y)/P-.5)>.3||o*d+a*A+l*y<N2e)&&(t(n,r,s,o,a,l,z,G,B,I/=L,F/=L,D,w,S),S.point(z,G),t(z,G,B,I,F,D,c,u,f,d,A,y,w,S))}}return function(n){var r,s,o,a,l,c,u,f,d,A,y,w,S={point:T,lineStart:R,lineEnd:I,polygonStart:function(){n.polygonStart(),S.lineStart=F},polygonEnd:function(){n.polygonEnd(),S.lineStart=R}};function T(C,B){C=i(C,B),n.point(C[0],C[1])}function R(){f=NaN,S.point=P,n.lineStart()}function P(C,B){var k=$c([C,B]),z=i(C,B);t(f,d,u,A,y,w,f=z[0],d=z[1],u=C,A=k[0],y=k[1],w=k[2],pJ,n),n.point(f,d)}function I(){S.point=T,n.lineEnd()}function F(){R(),S.point=D,S.lineEnd=L}function D(C,B){P(r=C,B),s=f,o=d,a=A,l=y,c=w,S.point=P}function L(){t(f,d,u,A,y,w,s,o,r,a,l,c,pJ,n),S.lineEnd=I,I()}return S}}var O2e=dw({point:function(i,e){this.stream.point(i*_n,e*_n)}});function U2e(i){return dw({point:function(e,t){var n=i(e,t);return this.stream.point(n[0],n[1])}})}function k2e(i,e,t,n,r){function s(o,a){return o*=n,a*=r,[e+i*o,t-i*a]}return s.invert=function(o,a){return[(o-e)/i*n,(t-a)/i*r]},s}function mJ(i,e,t,n,r,s){if(!s)return k2e(i,e,t,n,r);var o=mn(s),a=un(s),l=o*i,c=a*i,u=o/i,f=a/i,d=(a*t-o*e)/i,A=(a*e+o*t)/i;function y(w,S){return w*=n,S*=r,[l*w-c*S+e,t-c*w-l*S]}return y.invert=function(w,S){return[n*(u*w-f*S+d),r*(A-f*w-u*S)]},y}function kB(i){return z2e(function(){return i})()}function z2e(i){var e,t=150,n=480,r=250,s=0,o=0,a=0,l=0,c=0,u,f=0,d=1,A=1,y=null,w=TB,S=null,T,R,P,I=DB,F=.5,D,L,C,B,k;function z(H){return C(H[0]*_n,H[1]*_n)}function G(H){return H=C.invert(H[0],H[1]),H&&[H[0]*ur,H[1]*ur]}z.stream=function(H){return B&&k===H?B:B=O2e(U2e(u)(w(D(I(k=H)))))},z.preclip=function(H){return arguments.length?(w=H,y=void 0,Y()):w},z.postclip=function(H){return arguments.length?(I=H,S=T=R=P=null,Y()):I},z.clipAngle=function(H){return arguments.length?(w=+H?eJ(y=H*_n):(y=null,TB),Y()):y*ur},z.clipExtent=function(H){return arguments.length?(I=H==null?(S=T=R=P=null,DB):EB(S=+H[0][0],T=+H[0][1],R=+H[1][0],P=+H[1][1]),Y()):S==null?null:[[S,T],[R,P]]},z.scale=function(H){return arguments.length?(t=+H,W()):t},z.translate=function(H){return arguments.length?(n=+H[0],r=+H[1],W()):[n,r]},z.center=function(H){return arguments.length?(s=H[0]%360*_n,o=H[1]%360*_n,W()):[s*ur,o*ur]},z.rotate=function(H){return arguments.length?(a=H[0]%360*_n,l=H[1]%360*_n,c=H.length>2?H[2]%360*_n:0,W()):[a*ur,l*ur,c*ur]},z.angle=function(H){return arguments.length?(f=H%360*_n,W()):f*ur},z.reflectX=function(H){return arguments.length?(d=H?-1:1,W()):d<0},z.reflectY=function(H){return arguments.length?(A=H?-1:1,W()):A<0},z.precision=function(H){return arguments.length?(D=UB(L,F=H*H),Y()):Ho(F)},z.fitExtent=function(H,$){return OB(z,H,$)},z.fitSize=function(H,$){return hJ(z,H,$)},z.fitWidth=function(H,$){return fJ(z,H,$)},z.fitHeight=function(H,$){return dJ(z,H,$)};function W(){var H=mJ(t,0,0,d,A,f).apply(null,e(s,o)),$=mJ(t,n-H[0],r-H[1],d,A,f);return u=bB(a,l,c),L=uw(e,$),C=uw(u,L),D=UB(L,F),Y()}function Y(){return B=k=null,z}return function(){return e=i.apply(this,arguments),z.invert=e.invert&&G,W()}}function AJ(i){return function(e,t){var n=Ho(e*e+t*t),r=i(n),s=un(r),o=mn(r);return[Rs(e*s,n*o),fa(n&&t*s/n)]}}function pw(i,e){return[i,TQ(MQ((yo+e)/2))]}pw.invert=function(i,e){return[i,2*T_(SQ(e))-yo]};function zB(i,e){var t=mn(e),n=1+mn(i)*t;return[t*un(i)/n,un(e)/n]}zB.invert=AJ(function(i){return 2*T_(i)});function VB(){return kB(zB).scale(250).clipAngle(142)}function HB(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function V2e(i){if(Array.isArray(i))return i}function G2e(i){if(Array.isArray(i))return HB(i)}function mw(i,e,t){if(typeof i=="function"?i===e:i.has(e))return arguments.length<3?e:t;throw new TypeError("Private element is not present on this object")}function q2e(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function H2e(i,e,t){return e=WC(e),ebe(i,yJ()?Reflect.construct(e,[],WC(i).constructor):e.apply(i,t))}function xJ(i,e){if(e.has(i))throw new TypeError("Cannot initialize the same private elements twice on an object")}function W2e(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function oi(i,e){return i.get(mw(i,e))}function Z0(i,e,t){xJ(i,e),e.set(i,t)}function K0(i,e,t){return i.set(mw(i,e),t),t}function j2e(i,e){xJ(i,e),e.add(i)}function X2e(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,wJ(n.key),n)}}function $2e(i,e,t){return e&&X2e(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function I_(i,e,t){return(e=wJ(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function WC(i){return WC=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},WC(i)}function Y2e(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),e&&WB(i,e)}function yJ(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(yJ=function(){return!!i})()}function Z2e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function K2e(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function Q2e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.4119+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function J2e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.4120+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ebe(i,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return q2e(i)}function WB(i,e){return WB=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},WB(i,e)}function HC(i,e){return V2e(i)||K2e(i,e)||SJ(i,e)||Q2e()}function bJ(i){return G2e(i)||Z2e(i)||SJ(i)||J2e()}function tbe(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(i)}function wJ(i){var e=tbe(i,"string");return typeof e=="symbol"?e:e+""}function SJ(i,e){if(i){if(typeof i=="string")return HB(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?HB(i,e):void 0}}var TJ=function(e){e instanceof Array?e.forEach(TJ):(e.map&&e.map.dispose(),e.dispose())},jB=function(e){e.geometry&&e.geometry.dispose(),e.material&&TJ(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(jB)};function EJ(i,e,t){var n=(90-i)*Math.PI/180,r=(90-e)*Math.PI/180;return{x:t*Math.sin(n)*Math.cos(r),y:t*Math.cos(n),z:t*Math.sin(n)*Math.sin(r)}}function nbe(i){var e=i.x,t=i.y,n=i.z,r=Math.sqrt(e*e+t*t+n*n),s=Math.acos(t/r),o=Math.atan2(n,e);return{lat:90-s*180/Math.PI,lng:90-o*180/Math.PI-(o<-Math.PI/2?360:0),r}}function Rg(i){return i*Math.PI/180}var MJ=function(e){return 1-(pw(0,(.5-e)*Math.PI)[1]/Math.PI+1)/2},GB=function(e){return Math.max(0,Math.min(1,MJ(e)))},gJ=function(e){return .5-pw.invert(0,(2*(1-e)-1)*Math.PI)[1]/Math.PI},ibe=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,r=Tl().domain([1,0]).range([t,n]).clamp(!0),s=Tl().domain([GB(t),GB(n)]).range([1,0]).clamp(!0),o=function(f){return s(GB(r(f)))},a=e.array,l=0,c=a.length;l<c;l+=2)a[l+1]=o(a[l+1]);e.needsUpdate=!0},vJ=function(e,t,n,r){var s=Math.pow(2,e),o=Math.max(0,Math.min(s-1,Math.floor((n+180)*s/360))),a=(90-r)/180;t&&(a=Math.max(0,Math.min(1,MJ(a))));var l=Math.floor(a*s);return[o,l]},XB=function(e,t){for(var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,s=arguments.length>4?arguments[4]:void 0,o=arguments.length>5?arguments[5]:void 0,a=[],l=Math.pow(2,e),c=360/l,u=180/l,f=s===void 0?l-1:s,d=o===void 0?l-1:o,A=n,y=Math.min(l-1,f);A<=y;A++)for(var w=r,S=Math.min(l-1,d);w<=S;w++){var T=w,R=u;if(t){T=w===0?w:gJ(w/l)*l;var P=w+1===l?w+1:gJ((w+1)/l)*l;R=(P-T)*180/l}var I=-180+(A+.5)*c,F=90-(T*180/l+R/2),D=R;a.push({x:A,y:w,lng:I,lat:F,latLen:D})}return a},rbe=6,sbe=7,obe=3,abe=90,sf=new WeakMap,Q0=new WeakMap,qB=new WeakMap,GC=new WeakMap,Yc=new WeakMap,jC=new WeakMap,P_=new WeakMap,Ig=new WeakMap,qC=new WeakSet,CJ=(function(i){function e(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=r.tileUrl,o=r.minLevel,a=o===void 0?0:o,l=r.maxLevel,c=l===void 0?17:l,u=r.mercatorProjection,f=u===void 0?!0:u;return W2e(this,e),n=H2e(this,e),j2e(n,qC),Z0(n,sf,void 0),Z0(n,Q0,void 0),Z0(n,qB,void 0),Z0(n,GC,void 0),Z0(n,Yc,{}),Z0(n,jC,void 0),Z0(n,P_,void 0),Z0(n,Ig,void 0),I_(n,"minLevel",void 0),I_(n,"maxLevel",void 0),I_(n,"thresholds",bJ(new Array(30)).map(function(d,A){return 8/Math.pow(2,A)})),I_(n,"curvatureResolution",5),I_(n,"tileMargin",0),I_(n,"clearTiles",function(){Object.values(oi(Yc,n)).forEach(function(d){d.forEach(function(A){A.obj&&(n.remove(A.obj),jB(A.obj),delete A.obj)})}),K0(Yc,n,{})}),K0(sf,n,t),n.tileUrl=s,K0(Q0,n,f),n.minLevel=a,n.maxLevel=c,n.level=0,n.add(K0(Ig,n,new Hn(new Va(oi(sf,n)*.99,180,90),new fs({color:0})))),oi(Ig,n).visible=!1,oi(Ig,n).material.polygonOffset=!0,oi(Ig,n).material.polygonOffsetUnits=3,oi(Ig,n).material.polygonOffsetFactor=1,n}return Y2e(e,i),$2e(e,[{key:"tileUrl",get:function(){return oi(qB,this)},set:function(n){K0(qB,this,n),this.updatePov(oi(P_,this))}},{key:"level",get:function(){return oi(GC,this)},set:function(n){var r,s=this;oi(Yc,this)[n]||mw(qC,this,lbe).call(this,n);var o=oi(GC,this);if(K0(GC,this,n),!(n===o||o===void 0)){if(oi(Ig,this).visible=n>0,oi(Yc,this)[n].forEach(function(l){return l.obj&&(l.obj.material.depthWrite=!0)}),o<n&&((r=oi(Yc,this)[o])===null||r===void 0||r.forEach(function(l){return l.obj&&(l.obj.material.depthWrite=!1)})),o>n)for(var a=n+1;a<=o;a++)oi(Yc,this)[a]&&oi(Yc,this)[a].forEach(function(l){l.obj&&(s.remove(l.obj),jB(l.obj),delete l.obj)});mw(qC,this,_J).call(this)}}},{key:"updatePov",value:function(n){var r=this;if(!(!n||!(n instanceof Ld))){K0(P_,this,n);var s;if(K0(jC,this,function(u){if(!u.hullPnts){var f=360/Math.pow(2,r.level),d=u.lng,A=u.lat,y=u.latLen,w=d-f/2,S=d+f/2,T=A-y/2,R=A+y/2;u.hullPnts=[[A,d],[T,w],[R,w],[T,S],[R,S]].map(function(P){var I=HC(P,2),F=I[0],D=I[1];return EJ(F,D,oi(sf,r))}).map(function(P){var I=P.x,F=P.y,D=P.z;return new re(I,F,D)})}return s||(s=new qc,n.updateMatrix(),n.updateMatrixWorld(),s.setFromProjectionMatrix(new cn().multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse))),u.hullPnts.some(function(P){return s.containsPoint(P.clone().applyMatrix4(r.matrixWorld))})}),this.tileUrl){var o=n.position.clone(),a=o.distanceTo(this.getWorldPosition(new re)),l=(a-oi(sf,this))/oi(sf,this),c=this.thresholds.findIndex(function(u){return u&&u<=l});this.level=Math.min(this.maxLevel,Math.max(this.minLevel,c<0?this.thresholds.length:c)),mw(qC,this,_J).call(this)}}}}])})(Br);function lbe(i){var e=this;if(i>sbe){oi(Yc,this)[i]=[];return}var t=oi(Yc,this)[i]=XB(i,oi(Q0,this));t.forEach(function(n){return n.centroid=EJ(n.lat,n.lng,oi(sf,e))}),t.octree=$b().x(function(n){return n.centroid.x}).y(function(n){return n.centroid.y}).z(function(n){return n.centroid.z}).addAll(t)}function _J(){var i=this;if(!(!this.tileUrl||this.level===void 0||!oi(Yc,this).hasOwnProperty(this.level))&&!(!oi(jC,this)&&this.level>rbe)){var e=oi(Yc,this)[this.level];if(oi(P_,this)){var t=this.worldToLocal(oi(P_,this).position.clone());if(e.octree){var n,r=this.worldToLocal(oi(P_,this).position.clone()),s=(r.length()-oi(sf,this))*obe;e=(n=e.octree).findAllWithinRadius.apply(n,bJ(r).concat([s]))}else{var o=nbe(t),a=(o.r/oi(sf,this)-1)*abe,l=a/Math.cos(Rg(o.lat)),c=[o.lng-l,o.lng+l],u=[o.lat+a,o.lat-a],f=vJ(this.level,oi(Q0,this),c[0],u[0]),d=HC(f,2),A=d[0],y=d[1],w=vJ(this.level,oi(Q0,this),c[1],u[1]),S=HC(w,2),T=S[0],R=S[1];!e.record&&(e.record={});var P=e.record;if(!P.hasOwnProperty("".concat(Math.round((A+T)/2),"_").concat(Math.round((y+R)/2))))e=XB(this.level,oi(Q0,this),A,y,T,R).map(function(C){var B="".concat(C.x,"_").concat(C.y);return P.hasOwnProperty(B)?P[B]:(P[B]=C,e.push(C),C)});else{for(var I=[],F=A;F<=T;F++)for(var D=y;D<=R;D++){var L="".concat(F,"_").concat(D);P.hasOwnProperty(L)||(P[L]=XB(this.level,oi(Q0,this),F,D,F,D)[0],e.push(P[L])),I.push(P[L])}e=I}}}e.filter(function(C){return!C.obj}).filter(oi(jC,this)||function(){return!0}).forEach(function(C){var B=C.x,k=C.y,z=C.lng,G=C.lat,W=C.latLen,Y=360/Math.pow(2,i.level);if(!C.obj){var H=Y*(1-i.tileMargin),$=W*(1-i.tileMargin),J=Rg(z),te=Rg(-G),ce=new Hn(new Va(oi(sf,i),Math.ceil(H/i.curvatureResolution),Math.ceil($/i.curvatureResolution),Rg(90-H/2)+J,Rg(H),Rg(90-$/2)+te,Rg($)),new Ga);if(oi(Q0,i)){var he=[G+W/2,G-W/2].map(function(Fe){return .5-Fe/180}),ve=HC(he,2),Re=ve[0],Qe=ve[1];ibe(ce.geometry.attributes.uv,Re,Qe)}C.obj=ce}C.loading||(C.loading=!0,new bl().load(i.tileUrl(B,k,i.level),function(Fe){var mt=C.obj;mt&&(Fe.colorSpace=Fr,mt.material.map=Fe,mt.material.color=null,mt.material.needsUpdate=!0,i.add(mt)),C.loading=!1}))})}}var _w=new Set,$B=!1;function tO(i,e,t=2){let n=e&&e.length,r=n?e[0]*t:i.length;_w.size&&_w.clear();let s=LJ(i,0,r,t,!0),o=[];if(!s||s.next===s.prev)return o;let a=0,l=0,c=0;if(n&&(s=dbe(i,e,s,t)),i.length>80*t){a=i[0],l=i[1];let u=a,f=l;for(let d=t;d<r;d+=t){let A=i[d],y=i[d+1];A<a&&(a=A),y<l&&(l=y),A>u&&(u=A),y>f&&(f=y)}c=Math.max(u-a,f-l),c=c!==0?32767/c:0}return YB(s,o,a,l,c),o}function LJ(i,e,t,n,r){let s=null;if(r===Ebe(i,e,t,n)>0)for(let o=e;o<t;o+=n)s=PJ(o/n|0,i[o],i[o+1],s);else for(let o=t-n;o>=e;o-=n)s=PJ(o/n|0,i[o],i[o+1],s);return s&&xw(s,s.next)&&(bw(s),s=s.next),s}function Lg(i,e=i){let t=e===i,n=i,r;do r=!1,n!==n.next&&(_w.size===0||!_w.has(n))&&(xw(n,n.next)||Xs(n.prev,n,n.next)===0)?((t||n===e)&&(e=n.prev),$B=!0,bw(n),n=n.prev,r=!0):(t||n!==e)&&(n=n.next,r=!t);while(r||n!==e);return e}function YB(i,e,t,n,r){r&&xbe(i,t,n,r);let s=i,o=!1;for(;i.prev!==i.next;){let a=i.prev,l=i.next;if(Xs(a,i,l)<0&&(r?ube(i,t,n,r):cbe(i))){e.push(a.i,i.i,l.i),bw(i),i=l,s=l;continue}if(i=l,i===s){if($B=!1,i=Lg(i),$B){s=i;continue}if(!o){i=hbe(i,e),s=i,o=!0;continue}fbe(i,e,t,n,r);break}}}function cbe(i){let e=i.prev,t=i,n=i.next,r=e.x,s=t.x,o=n.x,a=e.y,l=t.y,c=n.y,u=Math.min(r,s,o),f=Math.min(a,l,c),d=Math.max(r,s,o),A=Math.max(a,l,c),y=n.next;for(;y!==e;){if(y.x>=u&&y.x<=d&&y.y>=f&&y.y<=A&&!(r===y.x&&a===y.y)&&ZC(r,a,s,l,o,c,y.x,y.y)&&Xs(y.prev,y,y.next)>=0)return!1;y=y.next}return!0}function ube(i,e,t,n){let r=i.prev,s=i,o=i.next,a=r.x,l=s.x,c=o.x,u=r.y,f=s.y,d=o.y,A=Math.min(a,l,c),y=Math.min(u,f,d),w=Math.max(a,l,c),S=Math.max(u,f,d),T=JB(A,y,e,t,n),R=JB(w,S,e,t,n),P=i.prevZ;for(;P&&P.z>=T;){if(P.x>=A&&P.x<=w&&P.y>=y&&P.y<=S&&P!==o&&!(a===P.x&&u===P.y)&&ZC(a,u,l,f,c,d,P.x,P.y)&&Xs(P.prev,P,P.next)>=0)return!1;P=P.prevZ}let I=i.nextZ;for(;I&&I.z<=R;){if(I.x>=A&&I.x<=w&&I.y>=y&&I.y<=S&&I!==o&&!(a===I.x&&u===I.y)&&ZC(a,u,l,f,c,d,I.x,I.y)&&Xs(I.prev,I,I.next)>=0)return!1;I=I.nextZ}return!0}function hbe(i,e){let t=i,n=!1;do{let r=t.prev,s=t.next.next;FJ(r,t,t.next,s,!1)&&yw(r,s)&&yw(s,r)&&(e.push(r.i,t.i,s.i),bw(t),bw(t.next),t=i=s,n=!0),t=t.next}while(t!==i);return n?Lg(t):t}function fbe(i,e,t,n,r){let s=i;do{let o=s.next.next;for(;o!==s.prev;){if(s.i!==o.i&&wbe(s,o)){let a=BJ(s,o);s=Lg(s,s.next),a=Lg(a,a.next),YB(s,e,t,n,r),YB(a,e,t,n,r);return}o=o.next}s=s.next}while(s!==i)}var ZB=!1;function dbe(i,e,t,n){let r=[];for(let s=0,o=e.length;s<o;s++){let a=e[s]*n,l=s<o-1?e[s+1]*n:i.length,c=LJ(i,a,l,n,!1);c===c.next&&_w.add(c),r.push(bbe(c))}r.sort(pbe),Abe(i.length/n,e.length),NJ(t,t),ZB=!0;for(let s=0;s<r.length;s++)t=mbe(r[s],t);return ZB=!1,Lg(t)}function pbe(i,e){return i.x-e.x||i.y-e.y||(i.next.y-i.y)/(i.next.x-i.x)-(e.next.y-e.y)/(e.next.x-e.x)}function mbe(i,e){let t=vbe(i,e);if(!t)return e;let n=BJ(t,i),r=n.next;return NJ(t,r.next),Lg(n,n.next),Lg(t,t.next)}var DJ=16,gs=new Float64Array(0),YC=0,KB=[],QB=[];function Abe(i,e){let t=Math.ceil((i+2*e)/DJ)+e+2;gs.length<t*4&&(gs=new Float64Array(t*4)),YC=0}function NJ(i,e){let t=i;do{let n=YC++;KB[n]=t;let r=1/0,s=1/0,o=-1/0,a=-1/0,l=0;do{let u=t.next;t.z=n,t.x<r&&(r=t.x),t.x>o&&(o=t.x),t.y<s&&(s=t.y),t.y>a&&(a=t.y),u.x<r&&(r=u.x),u.x>o&&(o=u.x),u.y<s&&(s=u.y),u.y>a&&(a=u.y),t=u}while(++l<DJ&&t!==e);QB[n]=t;let c=n*4;gs[c]=r,gs[c+1]=s,gs[c+2]=o,gs[c+3]=a}while(t!==e)}function gbe(i,e){let t=i.z*4;e.x<gs[t]&&(gs[t]=e.x),e.y<gs[t+1]&&(gs[t+1]=e.y),e.x>gs[t+2]&&(gs[t+2]=e.x),e.y>gs[t+3]&&(gs[t+3]=e.y)}function RJ(i){let e=QB[i];for(;e.prev.next!==e;)e=e.next;return QB[i]=e,e}function IJ(i){let e=KB[i];for(;e.prev.next!==e;)e=e.next;return KB[i]=e,e}function vbe(i,e){let t=e,n=i.x,r=i.y,s=-1/0,o;if(xw(i,t))return t;for(let d=0,A=0;d<YC;d++,A+=4){if(r<gs[A+1]||r>gs[A+3]||gs[A]>n||gs[A+2]<=s)continue;let y=RJ(d);t=IJ(d);do{if(t.prev.next===t){if(xw(i,t.next))return t.next;if(r<=t.y&&r>=t.next.y&&t.next.y!==t.y){let w=t.x+(r-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(w<=n&&w>s&&(s=w,o=t.x<t.next.x?t:t.next,w===n))return o}}t=t.next}while(t!==y)}if(!o)return null;let a=o.x,l=o.y,c=Math.min(r,l),u=Math.max(r,l),f=1/0;for(let d=0,A=0;d<YC;d++,A+=4){if(gs[A+2]<a||gs[A]>n||gs[A+3]<c||gs[A+1]>u)continue;let y=RJ(d);t=IJ(d);do{if(t.prev.next===t&&n>=t.x&&t.x>=a&&n!==t.x&&ZC(r<l?n:s,r,a,l,r<l?s:n,r,t.x,t.y)){let w=Math.abs(r-t.y)/(n-t.x);(yw(t,i)||t.y===r&&t.next.y===r&&t.next.x>n)&&(w<f||w===f&&(t.x>o.x||t.x===o.x&&_be(o,t)))&&(o=t,f=w)}t=t.next}while(t!==y)}return o}function _be(i,e){return Xs(i.prev,i,e.prev)<0&&Xs(e.next,i,i.next)<0}var Zc=[],Aw=[],Pg=new Uint32Array(0),gw=new Uint32Array(0),vw=new Uint32Array(256);function xbe(i,e,t,n){let r=i,s=0;do r.z=JB(r.x,r.y,e,t,n),Zc[s++]=r,r=r.next;while(r!==i);ybe(s);let o=null;for(let a=0;a<s;a++){let l=Zc[a];l.prevZ=o,o&&(o.nextZ=l),o=l}o.nextZ=null}function ybe(i){if(i<=32){for(let e=1;e<i;e++){let t=Zc[e],n=t.z,r=e-1;for(;r>=0&&Zc[r].z>n;)Zc[r+1]=Zc[r],r--;Zc[r+1]=t}return}Pg.length<i&&(Pg=new Uint32Array(i),gw=new Uint32Array(i),Aw=new Array(i));for(let e=0;e<i;e++)Pg[e]=Zc[e].z;XC(i,Zc,Pg,Aw,gw,0),XC(i,Aw,gw,Zc,Pg,8),XC(i,Zc,Pg,Aw,gw,16),XC(i,Aw,gw,Zc,Pg,24)}function XC(i,e,t,n,r,s){vw.fill(0);for(let a=0;a<i;a++)vw[t[a]>>>s&255]++;let o=0;for(let a=0;a<256;a++){let l=vw[a];vw[a]=o,o+=l}for(let a=0;a<i;a++){let l=t[a],c=vw[l>>>s&255]++;n[c]=e[a],r[c]=l}}function JB(i,e,t,n,r){return i=(i-t)*r|0,e=(e-n)*r|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,i|e<<1}function bbe(i){let e=i,t=i;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==i);return t}function ZC(i,e,t,n,r,s,o,a){return(r-o)*(e-a)>=(i-o)*(s-a)&&(i-o)*(n-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(r-o)*(n-a)}function wbe(i,e){let t=xw(i,e)&&Xs(i.prev,i,i.next)>0&&Xs(e.prev,e,e.next)>0;return i.next.i!==e.i&&(t||yw(i,e)&&yw(e,i)&&(Xs(i.prev,i,e.prev)!==0||Xs(i,e.prev,e)!==0))&&!Sbe(i,e)&&(t||Tbe(i,e))}function Xs(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function xw(i,e){return i.x===e.x&&i.y===e.y}function FJ(i,e,t,n,r=!0){let s=Xs(i,e,t),o=Xs(i,e,n),a=Xs(t,n,i),l=Xs(t,n,e);return(s>0&&o<0||s<0&&o>0)&&(a>0&&l<0||a<0&&l>0)?!0:r?!!(s===0&&$C(i,t,e)||o===0&&$C(i,n,e)||a===0&&$C(t,i,n)||l===0&&$C(t,e,n)):!1}function $C(i,e,t){return e.x<=Math.max(i.x,t.x)&&e.x>=Math.min(i.x,t.x)&&e.y<=Math.max(i.y,t.y)&&e.y>=Math.min(i.y,t.y)}function Sbe(i,e){let t=Math.min(i.x,e.x),n=Math.max(i.x,e.x),r=Math.min(i.y,e.y),s=Math.max(i.y,e.y),o=i;do{let a=o.next;if(o.x>n&&a.x>n||o.x<t&&a.x<t||o.y>s&&a.y>s||o.y<r&&a.y<r){o=a;continue}if(o.i!==i.i&&a.i!==i.i&&o.i!==e.i&&a.i!==e.i&&FJ(o,a,i,e))return!0;o=a}while(o!==i);return!1}function yw(i,e){return Xs(i.prev,i,i.next)<0?Xs(i,e,i.next)>=0&&Xs(i,i.prev,e)>=0:Xs(i,e,i.prev)<0||Xs(i,i.next,e)<0}function Tbe(i,e){let t=i,n=!1,r=(i.x+e.x)/2,s=(i.y+e.y)/2;do{let o=t.next;t.y>s!=o.y>s&&r<(o.x-t.x)*(s-t.y)/(o.y-t.y)+t.x&&(n=!n),t=o}while(t!==i);return n}function BJ(i,e){let t=eO(i.i,i.x,i.y),n=eO(e.i,e.x,e.y),r=i.next,s=e.prev;return i.next=e,e.prev=i,t.next=r,r.prev=t,n.next=t,t.prev=n,s.next=n,n.prev=s,n}function PJ(i,e,t,n){let r=eO(i,e,t);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function bw(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ),ZB&&gbe(i.prev,i.next)}function eO(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null}}function Ebe(i,e,t,n){let r=0;for(let s=e,o=t-n;s<t;s+=n)r+=(i[o]-i[s])*(i[s+1]+i[o+1]),o=s;return r}function L_(i){let e=[],t=[],n=i[0][0].length,r=0,s=0;for(let o of i){for(let a of o)for(let l=0;l<n;l++)e.push(a[l]);s&&(r+=s,t.push(r)),s=o.length}return{vertices:e,holes:t,dimensions:n}}function iO(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function Mbe(i){if(Array.isArray(i))return i}function Cbe(i){if(Array.isArray(i))return iO(i)}function Rbe(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function Ibe(i,e,t){return e=KC(e),kbe(i,kJ()?Reflect.construct(e,[],KC(i).constructor):e.apply(i,t))}function Pbe(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function Lbe(i,e,t){return Object.defineProperty(i,"prototype",{writable:!1}),i}function Dbe(i,e){var t=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(!t){if(Array.isArray(i)||(t=oO(i))||e){t&&(i=t);var n=0,r=function(){};return{s:r,n:function(){return n>=i.length?{done:!0}:{done:!1,value:i[n++]}},e:function(l){throw l},f:r}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.4121+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s,o=!0,a=!1;return{s:function(){t=t.call(i)},n:function(){var l=t.next();return o=l.done,l},e:function(l){a=!0,s=l},f:function(){try{o||t.return==null||t.return()}finally{if(a)throw s}}}}function KC(i){return KC=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},KC(i)}function Nbe(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),e&&rO(i,e)}function kJ(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(kJ=function(){return!!i})()}function Fbe(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function Bbe(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e===0){if(Object(t)!==t)return;l=!1}else for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function Obe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.4122+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ube(){throw new TypeError(`Invalid attempt to spread non-iterable instance.4123+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function kbe(i,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Rbe(i)}function rO(i,e){return rO=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},rO(i,e)}function ww(i,e){return Mbe(i)||Bbe(i,e)||oO(i,e)||Obe()}function zbe(i){return Cbe(i)||Fbe(i)||oO(i)||Ube()}function oO(i,e){if(i){if(typeof i=="string")return iO(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?iO(i,e):void 0}}var OJ=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,n=[],r=null;return e.forEach(function(s){if(r){var o=Ml(s,r)*180/Math.PI;if(o>t)for(var a=Cg(r,s),l=r.length>2||s.length>2?tf(r[2]||0,s[2]||0):null,c=l?function(d){return[].concat(zbe(a(d)),[l(d)])}:a,u=1/Math.ceil(o/t),f=u;f<1;)n.push(c(f)),f+=u}n.push(r=s)}),n},sO=typeof window<"u"&&window.THREE?window.THREE:{BufferGeometry:Xn,Float32BufferAttribute:Ln},Vbe=new sO.BufferGeometry().setAttribute?"setAttribute":"addAttribute",aO=(function(i){function e(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:5;Pbe(this,e),n=Ibe(this,e),n.type="GeoJsonGeometry",n.parameters={geoJson:t,radius:r,resolution:s};var o=({Point:u,MultiPoint:f,LineString:d,MultiLineString:A,Polygon:y,MultiPolygon:w}[t.type]||function(){return[]})(t.coordinates,r),a=[],l=[],c=0;o.forEach(function(S){var T=a.length;Sw({indices:a,vertices:l},S),n.addGroup(T,a.length-T,c++)}),a.length&&n.setIndex(a),l.length&&n[Vbe]("position",new sO.Float32BufferAttribute(l,3));function u(S,T){var R=nO(S[1],S[0],T+(S[2]||0)),P=[];return[{vertices:R,indices:P}]}function f(S,T){var R={vertices:[],indices:[]};return S.map(function(P){return u(P,T)}).forEach(function(P){var I=ww(P,1),F=I[0];Sw(R,F)}),[R]}function d(S,T){for(var R=OJ(S,s).map(function(C){var B=ww(C,3),k=B[0],z=B[1],G=B[2],W=G===void 0?0:G;return nO(z,k,T+W)}),P=L_([R]),I=P.vertices,F=Math.round(I.length/3),D=[],L=1;L<F;L++)D.push(L-1,L);return[{vertices:I,indices:D}]}function A(S,T){var R={vertices:[],indices:[]};return S.map(function(P){return d(P,T)}).forEach(function(P){var I=ww(P,1),F=I[0];Sw(R,F)}),[R]}function y(S,T){for(var R=S.map(function(H){return OJ(H,s).map(function($){var J=ww($,3),te=J[0],ce=J[1],he=J[2],ve=he===void 0?0:he;return nO(ce,te,T+ve)})}),P=L_(R),I=P.vertices,F=P.holes,D=F[0]||1/0,L=I.slice(0,D*3),C=I.slice(D*3),B=new Set(F),k=Math.round(I.length/3),z=[],G=[],W=1;W<k;W++)B.has(W)||(W<D?z.push(W-1,W):G.push(W-1-D,W-D));var Y=[{indices:z,vertices:L}];return F.length&&Y.push({indices:G,vertices:C}),Y}function w(S,T){var R={vertices:[],indices:[]},P={vertices:[],indices:[]};S.map(function(F){return y(F,T)}).forEach(function(F){var D=ww(F,2),L=D[0],C=D[1];Sw(R,L),C&&Sw(P,C)});var I=[R];return P.vertices.length&&I.push(P),I}return n}return Nbe(e,i),Lbe(e)})(sO.BufferGeometry);function Sw(i,e){var t=Math.round(i.vertices.length/3);UJ(i.vertices,e.vertices),UJ(i.indices,e.indices.map(function(n){return n+t}))}function UJ(i,e){var t=Dbe(e),n;try{for(t.s();!(n=t.n()).done;){var r=n.value;i.push(r)}}catch(s){t.e(s)}finally{t.f()}}function nO(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=(90-i)*Math.PI/180,r=(90-e)*Math.PI/180;return[t*Math.sin(n)*Math.cos(r),t*Math.cos(n),t*Math.sin(n)*Math.sin(r)]}var Tw={};che(Tw,{computeMikkTSpaceTangents:()=>Gbe,computeMorphedAttributes:()=>Zbe,deepCloneAttribute:()=>Hbe,deinterleaveAttribute:()=>QC,deinterleaveGeometry:()=>jbe,estimateBytesUsed:()=>Xbe,interleaveAttributes:()=>Wbe,mergeAttributes:()=>lO,mergeGeometries:()=>qbe,mergeGroups:()=>Kbe,mergeVertices:()=>$be,toCreasedNormals:()=>Qbe,toTrianglesDrawMode:()=>Ybe});function Gbe(i,e,t=!0){if(!e||!e.isReady)throw new Error("THREE.BufferGeometryUtils: Initialized MikkTSpace library required.");if(!i.hasAttribute("position")||!i.hasAttribute("normal")||!i.hasAttribute("uv"))throw new Error('THREE.BufferGeometryUtils: Tangents require "position", "normal", and "uv" attributes.');function n(o){if(o.normalized||o.isInterleavedBufferAttribute){let a=new Float32Array(o.count*o.itemSize);for(let l=0,c=0;l<o.count;l++)a[c++]=o.getX(l),a[c++]=o.getY(l),o.itemSize>2&&(a[c++]=o.getZ(l));return a}return o.array instanceof Float32Array?o.array:new Float32Array(o.array)}let r=i.index?i.toNonIndexed():i,s=e.generateTangents(n(r.attributes.position),n(r.attributes.normal),n(r.attributes.uv));if(t)for(let o=3;o<s.length;o+=4)s[o]*=-1;return r.setAttribute("tangent",new Hi(s,4)),i!==r&&i.copy(r),i}function qbe(i,e=!1){let t=i[0].index!==null,n=new Set(Object.keys(i[0].attributes)),r=new Set(Object.keys(i[0].morphAttributes)),s={},o={},a=i[0].morphTargetsRelative,l=new Xn,c=0;for(let u=0;u<i.length;++u){let f=i[u],d=0;if(t!==(f.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let A in f.attributes){if(!n.has(A))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+'. All geometries must have compatible attributes; make sure "'+A+'" attribute exists among all geometries, or in none of them.'),null;s[A]===void 0&&(s[A]=[]),s[A].push(f.attributes[A]),d++}if(d!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". Make sure all geometries have the same number of attributes."),null;if(a!==f.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let A in f.morphAttributes){if(!r.has(A))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". .morphAttributes must be consistent throughout all geometries."),null;o[A]===void 0&&(o[A]=[]),o[A].push(f.morphAttributes[A])}if(e){let A;if(t)A=f.index.count;else if(f.attributes.position!==void 0)A=f.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". The geometry must have either an index or a position attribute"),null;l.addGroup(c,A,u),c+=A}}if(t){let u=0,f=[];for(let d=0;d<i.length;++d){let A=i[d].index;for(let y=0;y<A.count;++y)f.push(A.getX(y)+u);u+=i[d].attributes.position.count}l.setIndex(f)}for(let u in s){let f=lO(s[u]);if(!f)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" attribute."),null;l.setAttribute(u,f)}for(let u in o){let f=o[u][0].length;if(f!==0){l.morphAttributes=l.morphAttributes||{},l.morphAttributes[u]=[];for(let d=0;d<f;++d){let A=[];for(let w=0;w<o[u].length;++w)A.push(o[u][w][d]);let y=lO(A);if(!y)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" morphAttribute."),null;l.morphAttributes[u].push(y)}}}return l}function lO(i){let e,t,n,r=-1,s=0;for(let c=0;c<i.length;++c){let u=i[c];if(e===void 0&&(e=u.array.constructor),e!==u.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(t===void 0&&(t=u.itemSize),t!==u.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(n===void 0&&(n=u.normalized),n!==u.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(r===-1&&(r=u.gpuType),r!==u.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;s+=u.count*t}let o=new e(s),a=new Hi(o,t,n),l=0;for(let c=0;c<i.length;++c){let u=i[c];if(u.isInterleavedBufferAttribute){let f=l/t;for(let d=0,A=u.count;d<A;d++)for(let y=0;y<t;y++){let w=u.getComponent(d,y);a.setComponent(d+f,y,w)}}else o.set(u.array,l);l+=u.count*t}return r!==void 0&&(a.gpuType=r),a}function Hbe(i){return i.isInstancedInterleavedBufferAttribute||i.isInterleavedBufferAttribute?QC(i):i.isInstancedBufferAttribute?new Ql().copy(i):new Hi().copy(i)}function Wbe(i){let e,t=0,n=0;for(let c=0,u=i.length;c<u;++c){let f=i[c];if(e===void 0&&(e=f.array.constructor),e!==f.array.constructor)return console.error("AttributeBuffers of different types cannot be interleaved"),null;t+=f.array.length,n+=f.itemSize}let r=new Id(new e(t),n),s=0,o=[],a=["getX","getY","getZ","getW"],l=["setX","setY","setZ","setW"];for(let c=0,u=i.length;c<u;c++){let f=i[c],d=f.itemSize,A=f.count,y=new zo(r,d,s,f.normalized);o.push(y),s+=d;for(let w=0;w<A;w++)for(let S=0;S<d;S++)y[l[S]](w,f[a[S]](w))}return o}function QC(i){let e=i.data.array.constructor,t=i.count,n=i.itemSize,r=i.normalized,s=new e(t*n),o;i.isInstancedInterleavedBufferAttribute?o=new Ql(s,n,r,i.meshPerAttribute):o=new Hi(s,n,r);for(let a=0;a<t;a++)o.setX(a,i.getX(a)),n>=2&&o.setY(a,i.getY(a)),n>=3&&o.setZ(a,i.getZ(a)),n>=4&&o.setW(a,i.getW(a));return o}function jbe(i){let e=i.attributes,t=i.morphTargets,n=new Map;for(let r in e){let s=e[r];s.isInterleavedBufferAttribute&&(n.has(s)||n.set(s,QC(s)),e[r]=n.get(s))}for(let r in t){let s=t[r];s.isInterleavedBufferAttribute&&(n.has(s)||n.set(s,QC(s)),t[r]=n.get(s))}}function Xbe(i){let e=0;for(let n in i.attributes){let r=i.getAttribute(n);e+=r.count*r.itemSize*r.array.BYTES_PER_ELEMENT}let t=i.getIndex();return e+=t?t.count*t.itemSize*t.array.BYTES_PER_ELEMENT:0,e}function $be(i,e=1e-4){e=Math.max(e,Number.EPSILON);let t={},n=i.getIndex(),r=i.getAttribute("position"),s=n?n.count:r.count,o=0,a=Object.keys(i.attributes),l={},c={},u=[],f=["getX","getY","getZ","getW"],d=["setX","setY","setZ","setW"];for(let R=0,P=a.length;R<P;R++){let I=a[R],F=i.attributes[I];l[I]=new F.constructor(new F.array.constructor(F.count*F.itemSize),F.itemSize,F.normalized);let D=i.morphAttributes[I];D&&(c[I]||(c[I]=[]),D.forEach((L,C)=>{let B=new L.array.constructor(L.count*L.itemSize);c[I][C]=new L.constructor(B,L.itemSize,L.normalized)}))}let A=e*.5,y=Math.log10(1/e),w=Math.pow(10,y),S=A*w;for(let R=0;R<s;R++){let P=n?n.getX(R):R,I="";for(let F=0,D=a.length;F<D;F++){let L=a[F],C=i.getAttribute(L),B=C.itemSize;for(let k=0;k<B;k++)I+=`${~~(C[f[k]](P)*w+S)},`}if(I in t)u.push(t[I]);else{for(let F=0,D=a.length;F<D;F++){let L=a[F],C=i.getAttribute(L),B=i.morphAttributes[L],k=C.itemSize,z=l[L],G=c[L];for(let W=0;W<k;W++){let Y=f[W],H=d[W];if(z[H](o,C[Y](P)),B)for(let $=0,J=B.length;$<J;$++)G[$][H](o,B[$][Y](P))}}t[I]=o,u.push(o),o++}}let T=i.clone();for(let R in i.attributes){let P=l[R];if(T.setAttribute(R,new P.constructor(P.array.slice(0,o*P.itemSize),P.itemSize,P.normalized)),R in c)for(let I=0;I<c[R].length;I++){let F=c[R][I];T.morphAttributes[R][I]=new F.constructor(F.array.slice(0,o*F.itemSize),F.itemSize,F.normalized)}}return T.setIndex(u),T}function Ybe(i,e){if(e===X8)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),i;if(e===kM||e===$8){let t=i.getIndex();if(t===null){let o=[],a=i.getAttribute("position");if(a!==void 0){for(let l=0;l<a.count;l++)o.push(l);i.setIndex(o),t=i.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),i}let n=t.count-2,r=[];if(e===kM)for(let o=1;o<=n;o++)r.push(t.getX(0)),r.push(t.getX(o)),r.push(t.getX(o+1));else for(let o=0;o<n;o++)o%2===0?(r.push(t.getX(o)),r.push(t.getX(o+1)),r.push(t.getX(o+2))):(r.push(t.getX(o+2)),r.push(t.getX(o+1)),r.push(t.getX(o)));r.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");let s=i.clone();return s.setIndex(r),s.clearGroups(),s}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),i}function Zbe(i){let e=new re,t=new re,n=new re,r=new re,s=new re,o=new re,a=new re,l=new re,c=new re;function u(ce,he,ve,Re,Qe,Fe,mt,Ee){e.fromBufferAttribute(he,Qe),t.fromBufferAttribute(he,Fe),n.fromBufferAttribute(he,mt);let Ve=ce.morphTargetInfluences;if(ve&&Ve){a.set(0,0,0),l.set(0,0,0),c.set(0,0,0);for(let Ye=0,Mt=ve.length;Ye<Mt;Ye++){let Et=Ve[Ye],It=ve[Ye];Et!==0&&(r.fromBufferAttribute(It,Qe),s.fromBufferAttribute(It,Fe),o.fromBufferAttribute(It,mt),Re?(a.addScaledVector(r,Et),l.addScaledVector(s,Et),c.addScaledVector(o,Et)):(a.addScaledVector(r.sub(e),Et),l.addScaledVector(s.sub(t),Et),c.addScaledVector(o.sub(n),Et)))}e.add(a),t.add(l),n.add(c)}ce.isSkinnedMesh&&(ce.applyBoneTransform(Qe,e),ce.applyBoneTransform(Fe,t),ce.applyBoneTransform(mt,n)),Ee[Qe*3+0]=e.x,Ee[Qe*3+1]=e.y,Ee[Qe*3+2]=e.z,Ee[Fe*3+0]=t.x,Ee[Fe*3+1]=t.y,Ee[Fe*3+2]=t.z,Ee[mt*3+0]=n.x,Ee[mt*3+1]=n.y,Ee[mt*3+2]=n.z}let f=i.geometry,d=i.material,A,y,w,S=f.index,T=f.attributes.position,R=f.morphAttributes.position,P=f.morphTargetsRelative,I=f.attributes.normal,F=f.morphAttributes.normal,D=f.groups,L=f.drawRange,C,B,k,z,G,W,Y,H=new Float32Array(T.count*T.itemSize),$=new Float32Array(I.count*I.itemSize);if(S!==null)if(Array.isArray(d))for(C=0,k=D.length;C<k;C++)for(G=D[C],W=Math.max(G.start,L.start),Y=Math.min(G.start+G.count,L.start+L.count),B=W,z=Y;B<z;B+=3)A=S.getX(B),y=S.getX(B+1),w=S.getX(B+2),u(i,T,R,P,A,y,w,H),u(i,I,F,P,A,y,w,$);else for(W=Math.max(0,L.start),Y=Math.min(S.count,L.start+L.count),C=W,k=Y;C<k;C+=3)A=S.getX(C),y=S.getX(C+1),w=S.getX(C+2),u(i,T,R,P,A,y,w,H),u(i,I,F,P,A,y,w,$);else if(Array.isArray(d))for(C=0,k=D.length;C<k;C++)for(G=D[C],W=Math.max(G.start,L.start),Y=Math.min(G.start+G.count,L.start+L.count),B=W,z=Y;B<z;B+=3)A=B,y=B+1,w=B+2,u(i,T,R,P,A,y,w,H),u(i,I,F,P,A,y,w,$);else for(W=Math.max(0,L.start),Y=Math.min(T.count,L.start+L.count),C=W,k=Y;C<k;C+=3)A=C,y=C+1,w=C+2,u(i,T,R,P,A,y,w,H),u(i,I,F,P,A,y,w,$);let J=new Ln(H,3),te=new Ln($,3);return{positionAttribute:T,normalAttribute:I,morphedPositionAttribute:J,morphedNormalAttribute:te}}function Kbe(i){if(i.groups.length===0)return console.warn("THREE.BufferGeometryUtils.mergeGroups(): No groups are defined. Nothing to merge."),i;let e=i.groups;if(e=e.sort((o,a)=>o.materialIndex!==a.materialIndex?o.materialIndex-a.materialIndex:o.start-a.start),i.getIndex()===null){let o=i.getAttribute("position"),a=[];for(let l=0;l<o.count;l+=3)a.push(l,l+1,l+2);i.setIndex(a)}let t=i.getIndex(),n=[];for(let o=0;o<e.length;o++){let a=e[o],l=a.start,c=l+a.count;for(let u=l;u<c;u++)n.push(t.getX(u))}i.dispose(),i.setIndex(n);let r=0;for(let o=0;o<e.length;o++){let a=e[o];a.start=r,r+=a.count}let s=e[0];i.groups=[s];for(let o=1;o<e.length;o++){let a=e[o];s.materialIndex===a.materialIndex?s.count+=a.count:(s=a,i.groups.push(s))}return i}function Qbe(i,e=Math.PI/3){let t=i.index?i.toNonIndexed():i,n=t.attributes.position,r=n.count,s;if(n.isBufferAttribute===!0&&n.itemSize===3&&n.normalized===!1)s=n.array;else{s=new Float64Array(r*3);for(let I=0;I<r;I++)s[3*I+0]=n.getX(I),s[3*I+1]=n.getY(I),s[3*I+2]=n.getZ(I)}let o=Math.cos(e),a=(1+1e-10)*100,l=r/3,c=new Float64Array(l*3);for(let I=0;I<l;I++){let F=9*I,D=s[F+0],L=s[F+1],C=s[F+2],B=s[F+3],k=s[F+4],z=s[F+5],G=s[F+6],W=s[F+7],Y=s[F+8],H=G-B,$=W-k,J=Y-z,te=D-B,ce=L-k,he=C-z,ve=$*he-J*ce,Re=J*te-H*he,Qe=H*ce-$*te,Fe=1/(Math.sqrt(ve*ve+Re*Re+Qe*Qe)||1);c[3*I+0]=ve*Fe,c[3*I+1]=Re*Fe,c[3*I+2]=Qe*Fe}let u=new Int32Array(r),f=new Int32Array(r*3),d=1;for(;d<r*2;)d<<=1;let A=d-1,y=new Int32Array(d),w=0;for(let I=0;I<r;I++){let F=3*I,D=~~(s[F+0]*a),L=~~(s[F+1]*a),C=~~(s[F+2]*a),B=(Math.imul(D,73856093)^Math.imul(L,19349663)^Math.imul(C,83492791))&A;for(;;){let k=y[B];if(k===0){let G=3*w;f[G+0]=D,f[G+1]=L,f[G+2]=C,y[B]=w+1,u[I]=w++;break}let z=3*(k-1);if(f[z+0]===D&&f[z+1]===L&&f[z+2]===C){u[I]=k-1;break}B=B+1&A}}let S=new Int32Array(w+1);for(let I=0;I<r;I++)S[u[I]+1]++;for(let I=0;I<w;I++)S[I+1]+=S[I];let T=new Int32Array(r),R=S.slice(0,w);for(let I=0;I<l;I++){let F=3*I;T[R[u[F+0]]++]=I,T[R[u[F+1]]++]=I,T[R[u[F+2]]++]=I}let P=new Float32Array(r*3);for(let I=0;I<l;I++){let F=3*I,D=c[F+0],L=c[F+1],C=c[F+2];for(let B=0;B<3;B++){let k=F+B,z=u[k],G=0,W=0,Y=0;for(let $=S[z],J=S[z+1];$<J;$++){let te=3*T[$],ce=c[te+0],he=c[te+1],ve=c[te+2];D*ce+L*he+C*ve>o&&(G+=ce,W+=he,Y+=ve)}let H=1/(Math.sqrt(G*G+W*W+Y*Y)||1);P[3*k+0]=G*H,P[3*k+1]=W*H,P[3*k+2]=Y*H}}return t.setAttribute("normal",new Hi(P,3,!1)),t}var st=(function(i){return typeof i=="function"?i:typeof i=="string"?function(e){return e[i]}:function(e){return i}});function JC(i){"@babel/helpers - typeof";return JC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},JC(i)}var Jbe=/^\s+/,ewe=/\s+$/;function An(i,e){if(i=i||"",e=e||{},i instanceof An)return i;if(!(this instanceof An))return new An(i,e);var t=twe(i);this._originalInput=i,this._r=t.r,this._g=t.g,this._b=t.b,this._a=t.a,this._roundA=Math.round(100*this._a)/100,this._format=e.format||t.format,this._gradientType=e.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=t.ok}An.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var e=this.toRgb();return(e.r*299+e.g*587+e.b*114)/1e3},getLuminance:function(){var e=this.toRgb(),t,n,r,s,o,a;return t=e.r/255,n=e.g/255,r=e.b/255,t<=.03928?s=t/12.92:s=Math.pow((t+.055)/1.055,2.4),n<=.03928?o=n/12.92:o=Math.pow((n+.055)/1.055,2.4),r<=.03928?a=r/12.92:a=Math.pow((r+.055)/1.055,2.4),.2126*s+.7152*o+.0722*a},setAlpha:function(e){return this._a=jJ(e),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var e=VJ(this._r,this._g,this._b);return{h:e.h*360,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=VJ(this._r,this._g,this._b),t=Math.round(e.h*360),n=Math.round(e.s*100),r=Math.round(e.v*100);return this._a==1?"hsv("+t+", "+n+"%, "+r+"%)":"hsva("+t+", "+n+"%, "+r+"%, "+this._roundA+")"},toHsl:function(){var e=zJ(this._r,this._g,this._b);return{h:e.h*360,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=zJ(this._r,this._g,this._b),t=Math.round(e.h*360),n=Math.round(e.s*100),r=Math.round(e.l*100);return this._a==1?"hsl("+t+", "+n+"%, "+r+"%)":"hsla("+t+", "+n+"%, "+r+"%, "+this._roundA+")"},toHex:function(e){return GJ(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){return swe(this._r,this._g,this._b,this._a,e)},toHex8String:function(e){return"#"+this.toHex8(e)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(Ur(this._r,255)*100)+"%",g:Math.round(Ur(this._g,255)*100)+"%",b:Math.round(Ur(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(Ur(this._r,255)*100)+"%, "+Math.round(Ur(this._g,255)*100)+"%, "+Math.round(Ur(this._b,255)*100)+"%)":"rgba("+Math.round(Ur(this._r,255)*100)+"%, "+Math.round(Ur(this._g,255)*100)+"%, "+Math.round(Ur(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:gwe[GJ(this._r,this._g,this._b,!0)]||!1},toFilter:function(e){var t="#"+qJ(this._r,this._g,this._b,this._a),n=t,r=this._gradientType?"GradientType = 1, ":"";if(e){var s=An(e);n="#"+qJ(s._r,s._g,s._b,s._a)}return"progid:DXImageTransform.Microsoft.gradient("+r+"startColorstr="+t+",endColorstr="+n+")"},toString:function(e){var t=!!e;e=e||this._format;var n=!1,r=this._a<1&&this._a>=0,s=!t&&r&&(e==="hex"||e==="hex6"||e==="hex3"||e==="hex4"||e==="hex8"||e==="name");return s?e==="name"&&this._a===0?this.toName():this.toRgbString():(e==="rgb"&&(n=this.toRgbString()),e==="prgb"&&(n=this.toPercentageRgbString()),(e==="hex"||e==="hex6")&&(n=this.toHexString()),e==="hex3"&&(n=this.toHexString(!0)),e==="hex4"&&(n=this.toHex8String(!0)),e==="hex8"&&(n=this.toHex8String()),e==="name"&&(n=this.toName()),e==="hsl"&&(n=this.toHslString()),e==="hsv"&&(n=this.toHsvString()),n||this.toHexString())},clone:function(){return An(this.toString())},_applyModification:function(e,t){var n=e.apply(null,[this].concat([].slice.call(t)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(cwe,arguments)},brighten:function(){return this._applyModification(uwe,arguments)},darken:function(){return this._applyModification(hwe,arguments)},desaturate:function(){return this._applyModification(owe,arguments)},saturate:function(){return this._applyModification(awe,arguments)},greyscale:function(){return this._applyModification(lwe,arguments)},spin:function(){return this._applyModification(fwe,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(mwe,arguments)},complement:function(){return this._applyCombination(dwe,arguments)},monochromatic:function(){return this._applyCombination(Awe,arguments)},splitcomplement:function(){return this._applyCombination(pwe,arguments)},triad:function(){return this._applyCombination(HJ,[3])},tetrad:function(){return this._applyCombination(HJ,[4])}};An.fromRatio=function(i,e){if(JC(i)=="object"){var t={};for(var n in i)i.hasOwnProperty(n)&&(n==="a"?t[n]=i[n]:t[n]=Ew(i[n]));i=t}return An(i,e)};function twe(i){var e={r:0,g:0,b:0},t=1,n=null,r=null,s=null,o=!1,a=!1;return typeof i=="string"&&(i=ywe(i)),JC(i)=="object"&&(Gd(i.r)&&Gd(i.g)&&Gd(i.b)?(e=nwe(i.r,i.g,i.b),o=!0,a=String(i.r).substr(-1)==="%"?"prgb":"rgb"):Gd(i.h)&&Gd(i.s)&&Gd(i.v)?(n=Ew(i.s),r=Ew(i.v),e=rwe(i.h,n,r),o=!0,a="hsv"):Gd(i.h)&&Gd(i.s)&&Gd(i.l)&&(n=Ew(i.s),s=Ew(i.l),e=iwe(i.h,n,s),o=!0,a="hsl"),i.hasOwnProperty("a")&&(t=i.a)),t=jJ(t),{ok:o,format:i.format||a,r:Math.min(255,Math.max(e.r,0)),g:Math.min(255,Math.max(e.g,0)),b:Math.min(255,Math.max(e.b,0)),a:t}}function nwe(i,e,t){return{r:Ur(i,255)*255,g:Ur(e,255)*255,b:Ur(t,255)*255}}function zJ(i,e,t){i=Ur(i,255),e=Ur(e,255),t=Ur(t,255);var n=Math.max(i,e,t),r=Math.min(i,e,t),s,o,a=(n+r)/2;if(n==r)s=o=0;else{var l=n-r;switch(o=a>.5?l/(2-n-r):l/(n+r),n){case i:s=(e-t)/l+(e<t?6:0);break;case e:s=(t-i)/l+2;break;case t:s=(i-e)/l+4;break}s/=6}return{h:s,s:o,l:a}}function iwe(i,e,t){var n,r,s;i=Ur(i,360),e=Ur(e,100),t=Ur(t,100);function o(c,u,f){return f<0&&(f+=1),f>1&&(f-=1),f<1/6?c+(u-c)*6*f:f<1/2?u:f<2/3?c+(u-c)*(2/3-f)*6:c}if(e===0)n=r=s=t;else{var a=t<.5?t*(1+e):t+e-t*e,l=2*t-a;n=o(l,a,i+1/3),r=o(l,a,i),s=o(l,a,i-1/3)}return{r:n*255,g:r*255,b:s*255}}function VJ(i,e,t){i=Ur(i,255),e=Ur(e,255),t=Ur(t,255);var n=Math.max(i,e,t),r=Math.min(i,e,t),s,o,a=n,l=n-r;if(o=n===0?0:l/n,n==r)s=0;else{switch(n){case i:s=(e-t)/l+(e<t?6:0);break;case e:s=(t-i)/l+2;break;case t:s=(i-e)/l+4;break}s/=6}return{h:s,s:o,v:a}}function rwe(i,e,t){i=Ur(i,360)*6,e=Ur(e,100),t=Ur(t,100);var n=Math.floor(i),r=i-n,s=t*(1-e),o=t*(1-r*e),a=t*(1-(1-r)*e),l=n%6,c=[t,o,s,s,a,t][l],u=[a,t,t,o,s,s][l],f=[s,s,a,t,t,o][l];return{r:c*255,g:u*255,b:f*255}}function GJ(i,e,t,n){var r=[qu(Math.round(i).toString(16)),qu(Math.round(e).toString(16)),qu(Math.round(t).toString(16))];return n&&r[0].charAt(0)==r[0].charAt(1)&&r[1].charAt(0)==r[1].charAt(1)&&r[2].charAt(0)==r[2].charAt(1)?r[0].charAt(0)+r[1].charAt(0)+r[2].charAt(0):r.join("")}function swe(i,e,t,n,r){var s=[qu(Math.round(i).toString(16)),qu(Math.round(e).toString(16)),qu(Math.round(t).toString(16)),qu(XJ(n))];return r&&s[0].charAt(0)==s[0].charAt(1)&&s[1].charAt(0)==s[1].charAt(1)&&s[2].charAt(0)==s[2].charAt(1)&&s[3].charAt(0)==s[3].charAt(1)?s[0].charAt(0)+s[1].charAt(0)+s[2].charAt(0)+s[3].charAt(0):s.join("")}function qJ(i,e,t,n){var r=[qu(XJ(n)),qu(Math.round(i).toString(16)),qu(Math.round(e).toString(16)),qu(Math.round(t).toString(16))];return r.join("")}An.equals=function(i,e){return!i||!e?!1:An(i).toRgbString()==An(e).toRgbString()};An.random=function(){return An.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function owe(i,e){e=e===0?0:e||10;var t=An(i).toHsl();return t.s-=e/100,t.s=eR(t.s),An(t)}function awe(i,e){e=e===0?0:e||10;var t=An(i).toHsl();return t.s+=e/100,t.s=eR(t.s),An(t)}function lwe(i){return An(i).desaturate(100)}function cwe(i,e){e=e===0?0:e||10;var t=An(i).toHsl();return t.l+=e/100,t.l=eR(t.l),An(t)}function uwe(i,e){e=e===0?0:e||10;var t=An(i).toRgb();return t.r=Math.max(0,Math.min(255,t.r-Math.round(255*-(e/100)))),t.g=Math.max(0,Math.min(255,t.g-Math.round(255*-(e/100)))),t.b=Math.max(0,Math.min(255,t.b-Math.round(255*-(e/100)))),An(t)}function hwe(i,e){e=e===0?0:e||10;var t=An(i).toHsl();return t.l-=e/100,t.l=eR(t.l),An(t)}function fwe(i,e){var t=An(i).toHsl(),n=(t.h+e)%360;return t.h=n<0?360+n:n,An(t)}function dwe(i){var e=An(i).toHsl();return e.h=(e.h+180)%360,An(e)}function HJ(i,e){if(isNaN(e)||e<=0)throw new Error("Argument to polyad must be a positive number");for(var t=An(i).toHsl(),n=[An(i)],r=360/e,s=1;s<e;s++)n.push(An({h:(t.h+s*r)%360,s:t.s,l:t.l}));return n}function pwe(i){var e=An(i).toHsl(),t=e.h;return[An(i),An({h:(t+72)%360,s:e.s,l:e.l}),An({h:(t+216)%360,s:e.s,l:e.l})]}function mwe(i,e,t){e=e||6,t=t||30;var n=An(i).toHsl(),r=360/t,s=[An(i)];for(n.h=(n.h-(r*e>>1)+720)%360;--e;)n.h=(n.h+r)%360,s.push(An(n));return s}function Awe(i,e){e=e||6;for(var t=An(i).toHsv(),n=t.h,r=t.s,s=t.v,o=[],a=1/e;e--;)o.push(An({h:n,s:r,v:s})),s=(s+a)%1;return o}An.mix=function(i,e,t){t=t===0?0:t||50;var n=An(i).toRgb(),r=An(e).toRgb(),s=t/100,o={r:(r.r-n.r)*s+n.r,g:(r.g-n.g)*s+n.g,b:(r.b-n.b)*s+n.b,a:(r.a-n.a)*s+n.a};return An(o)};An.readability=function(i,e){var t=An(i),n=An(e);return(Math.max(t.getLuminance(),n.getLuminance())+.05)/(Math.min(t.getLuminance(),n.getLuminance())+.05)};An.isReadable=function(i,e,t){var n=An.readability(i,e),r,s;switch(s=!1,r=bwe(t),r.level+r.size){case"AAsmall":case"AAAlarge":s=n>=4.5;break;case"AAlarge":s=n>=3;break;case"AAAsmall":s=n>=7;break}return s};An.mostReadable=function(i,e,t){var n=null,r=0,s,o,a,l;t=t||{},o=t.includeFallbackColors,a=t.level,l=t.size;for(var c=0;c<e.length;c++)s=An.readability(i,e[c]),s>r&&(r=s,n=An(e[c]));return An.isReadable(i,n,{level:a,size:l})||!o?n:(t.includeFallbackColors=!1,An.mostReadable(i,["#fff","#000"],t))};var cO=An.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},gwe=An.hexNames=vwe(cO);function vwe(i){var e={};for(var t in i)i.hasOwnProperty(t)&&(e[i[t]]=t);return e}function jJ(i){return i=parseFloat(i),(isNaN(i)||i<0||i>1)&&(i=1),i}function Ur(i,e){_we(i)&&(i="100%");var t=xwe(i);return i=Math.min(e,Math.max(0,parseFloat(i))),t&&(i=parseInt(i*e,10)/100),Math.abs(i-e)<1e-6?1:i%e/parseFloat(e)}function eR(i){return Math.min(1,Math.max(0,i))}function rc(i){return parseInt(i,16)}function _we(i){return typeof i=="string"&&i.indexOf(".")!=-1&&parseFloat(i)===1}function xwe(i){return typeof i=="string"&&i.indexOf("%")!=-1}function qu(i){return i.length==1?"0"+i:""+i}function Ew(i){return i<=1&&(i=i*100+"%"),i}function XJ(i){return Math.round(parseFloat(i)*255).toString(16)}function WJ(i){return rc(i)/255}var Gu=(function(){var i="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",t="(?:"+e+")|(?:"+i+")",n="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?",r="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?";return{CSS_UNIT:new RegExp(t),rgb:new RegExp("rgb"+n),rgba:new RegExp("rgba"+r),hsl:new RegExp("hsl"+n),hsla:new RegExp("hsla"+r),hsv:new RegExp("hsv"+n),hsva:new RegExp("hsva"+r),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}})();function Gd(i){return!!Gu.CSS_UNIT.exec(i)}function ywe(i){i=i.replace(Jbe,"").replace(ewe,"").toLowerCase();var e=!1;if(cO[i])i=cO[i],e=!0;else if(i=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var t;return(t=Gu.rgb.exec(i))?{r:t[1],g:t[2],b:t[3]}:(t=Gu.rgba.exec(i))?{r:t[1],g:t[2],b:t[3],a:t[4]}:(t=Gu.hsl.exec(i))?{h:t[1],s:t[2],l:t[3]}:(t=Gu.hsla.exec(i))?{h:t[1],s:t[2],l:t[3],a:t[4]}:(t=Gu.hsv.exec(i))?{h:t[1],s:t[2],v:t[3]}:(t=Gu.hsva.exec(i))?{h:t[1],s:t[2],v:t[3],a:t[4]}:(t=Gu.hex8.exec(i))?{r:rc(t[1]),g:rc(t[2]),b:rc(t[3]),a:WJ(t[4]),format:e?"name":"hex8"}:(t=Gu.hex6.exec(i))?{r:rc(t[1]),g:rc(t[2]),b:rc(t[3]),format:e?"name":"hex"}:(t=Gu.hex4.exec(i))?{r:rc(t[1]+""+t[1]),g:rc(t[2]+""+t[2]),b:rc(t[3]+""+t[3]),a:WJ(t[4]+""+t[4]),format:e?"name":"hex8"}:(t=Gu.hex3.exec(i))?{r:rc(t[1]+""+t[1]),g:rc(t[2]+""+t[2]),b:rc(t[3]+""+t[3]),format:e?"name":"hex"}:!1}function bwe(i){var e,t;return i=i||{level:"AA",size:"small"},e=(i.level||"AA").toUpperCase(),t=(i.size||"small").toLowerCase(),e!=="AA"&&e!=="AAA"&&(e="AA"),t!=="small"&&t!=="large"&&(t="small"),{level:e,size:t}}function dO(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function wwe(i){if(Array.isArray(i))return i}function Swe(i){if(Array.isArray(i))return dO(i)}function $J(i,e,t){if(typeof i=="function"?i===e:i.has(e))return arguments.length<3?e:t;throw new TypeError("Private element is not present on this object")}function Twe(i,e){if(e.has(i))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Ewe(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function da(i,e){return i.get($J(i,e))}function D_(i,e,t){Twe(i,e),e.set(i,t)}function tR(i,e,t){return i.set($J(i,e),t),t}function Mwe(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,Bwe(n.key),n)}}function Cwe(i,e,t){return e&&Mwe(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function Rwe(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function Iwe(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function Pwe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.4124+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Lwe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.4125+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Dwe(i,e){return wwe(i)||Iwe(i,e)||YJ(i,e)||Pwe()}function Nwe(i){return Swe(i)||Rwe(i)||YJ(i)||Lwe()}function Fwe(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(i)}function Bwe(i){var e=Fwe(i,"string");return typeof e=="symbol"?e:e+""}function YJ(i,e){if(i){if(typeof i=="string")return dO(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?dO(i,e):void 0}}var N_=new WeakMap,Mw=new WeakMap,F_=new WeakMap,uO=new WeakMap,hO=new WeakMap,fO=new WeakMap,ZJ=(function(){function i(){Ewe(this,i),D_(this,N_,new Map),D_(this,Mw,new Map),D_(this,F_,function(e){return e}),D_(this,uO,function(){return{}}),D_(this,hO,function(){}),D_(this,fO,function(){})}return Cwe(i,[{key:"getObj",value:function(t){return da(N_,this).get(da(F_,this).call(this,t))}},{key:"getData",value:function(t){return da(Mw,this).get(t)}},{key:"entries",value:function(){return Nwe(da(Mw,this).entries()).map(function(t){var n=Dwe(t,2),r=n[0],s=n[1];return[s,r]})}},{key:"id",value:function(t){return tR(F_,this,st(t)),this}},{key:"onCreateObj",value:function(t){return tR(uO,this,t),this}},{key:"onUpdateObj",value:function(t){return tR(hO,this,t),this}},{key:"onRemoveObj",value:function(t){return tR(fO,this,t),this}},{key:"digest",value:function(t){var n=this;t.filter(function(s){return!da(N_,n).has(da(F_,n).call(n,s))}).forEach(function(s){var o=da(uO,n).call(n,s);da(N_,n).set(da(F_,n).call(n,s),o),da(Mw,n).set(o,s)});var r=new Map(t.map(function(s){return[da(F_,n).call(n,s),s]}));return da(N_,this).forEach(function(s,o){r.has(o)?da(hO,n).call(n,s,r.get(o)):(da(fO,n).call(n,s,o),da(N_,n).delete(o),da(Mw,n).delete(s))}),this}},{key:"clear",value:function(){return this.digest([]),this}}])})();var g1=Nq(KJ(),1);var Ei=11102230246251565e-32,$s=134217729,Rw=(3+8*Ei)*Ei;function Dg(i,e,t,n,r){let s,o,a,l,c=e[0],u=n[0],f=0,d=0;u>c==u>-c?(s=c,c=e[++f]):(s=u,u=n[++d]);let A=0;if(f<i&&d<t)for(u>c==u>-c?(o=c+s,a=s-(o-c),c=e[++f]):(o=u+s,a=s-(o-u),u=n[++d]),s=o,a!==0&&(r[A++]=a);f<i&&d<t;)u>c==u>-c?(o=s+c,l=o-s,a=s-(o-l)+(c-l),c=e[++f]):(o=s+u,l=o-s,a=s-(o-l)+(u-l),u=n[++d]),s=o,a!==0&&(r[A++]=a);for(;f<i;)o=s+c,l=o-s,a=s-(o-l)+(c-l),c=e[++f],s=o,a!==0&&(r[A++]=a);for(;d<t;)o=s+u,l=o-s,a=s-(o-l)+(u-l),u=n[++d],s=o,a!==0&&(r[A++]=a);return(s!==0||A===0)&&(r[A++]=s),A}function Iw(i,e){let t=e[0];for(let n=1;n<i;n++)t+=e[n];return t}function ht(i){return new Float64Array(i)}var Owe=(3+16*Ei)*Ei,Uwe=(2+12*Ei)*Ei,kwe=(9+64*Ei)*Ei*Ei,B_=ht(4),QJ=ht(8),JJ=ht(12),eee=ht(16),$a=ht(4);function zwe(i,e,t,n,r,s,o){let a,l,c,u,f,d,A,y,w,S,T,R,P,I,F,D,L,C,B=i-r,k=t-r,z=e-s,G=n-s;I=B*G,d=$s*B,A=d-(d-B),y=B-A,d=$s*G,w=d-(d-G),S=G-w,F=y*S-(I-A*w-y*w-A*S),D=z*k,d=$s*z,A=d-(d-z),y=z-A,d=$s*k,w=d-(d-k),S=k-w,L=y*S-(D-A*w-y*w-A*S),T=F-L,f=F-T,B_[0]=F-(T+f)+(f-L),R=I+T,f=R-I,P=I-(R-f)+(T-f),T=P-D,f=P-T,B_[1]=P-(T+f)+(f-D),C=R+T,f=C-R,B_[2]=R-(C-f)+(T-f),B_[3]=C;let W=Iw(4,B_),Y=Uwe*o;if(W>=Y||-W>=Y||(f=i-B,a=i-(B+f)+(f-r),f=t-k,c=t-(k+f)+(f-r),f=e-z,l=e-(z+f)+(f-s),f=n-G,u=n-(G+f)+(f-s),a===0&&l===0&&c===0&&u===0)||(Y=kwe*o+Rw*Math.abs(W),W+=B*u+G*a-(z*c+k*l),W>=Y||-W>=Y))return W;I=a*G,d=$s*a,A=d-(d-a),y=a-A,d=$s*G,w=d-(d-G),S=G-w,F=y*S-(I-A*w-y*w-A*S),D=l*k,d=$s*l,A=d-(d-l),y=l-A,d=$s*k,w=d-(d-k),S=k-w,L=y*S-(D-A*w-y*w-A*S),T=F-L,f=F-T,$a[0]=F-(T+f)+(f-L),R=I+T,f=R-I,P=I-(R-f)+(T-f),T=P-D,f=P-T,$a[1]=P-(T+f)+(f-D),C=R+T,f=C-R,$a[2]=R-(C-f)+(T-f),$a[3]=C;let H=Dg(4,B_,4,$a,QJ);I=B*u,d=$s*B,A=d-(d-B),y=B-A,d=$s*u,w=d-(d-u),S=u-w,F=y*S-(I-A*w-y*w-A*S),D=z*c,d=$s*z,A=d-(d-z),y=z-A,d=$s*c,w=d-(d-c),S=c-w,L=y*S-(D-A*w-y*w-A*S),T=F-L,f=F-T,$a[0]=F-(T+f)+(f-L),R=I+T,f=R-I,P=I-(R-f)+(T-f),T=P-D,f=P-T,$a[1]=P-(T+f)+(f-D),C=R+T,f=C-R,$a[2]=R-(C-f)+(T-f),$a[3]=C;let $=Dg(H,QJ,4,$a,JJ);I=a*u,d=$s*a,A=d-(d-a),y=a-A,d=$s*u,w=d-(d-u),S=u-w,F=y*S-(I-A*w-y*w-A*S),D=l*c,d=$s*l,A=d-(d-l),y=l-A,d=$s*c,w=d-(d-c),S=c-w,L=y*S-(D-A*w-y*w-A*S),T=F-L,f=F-T,$a[0]=F-(T+f)+(f-L),R=I+T,f=R-I,P=I-(R-f)+(T-f),T=P-D,f=P-T,$a[1]=P-(T+f)+(f-D),C=R+T,f=C-R,$a[2]=R-(C-f)+(T-f),$a[3]=C;let J=Dg($,JJ,4,$a,eee);return eee[J-1]}function J0(i,e,t,n,r,s){let o=(e-s)*(t-r),a=(i-r)*(n-s),l=o-a,c=Math.abs(o+a);return Math.abs(l)>=Owe*c?l:-zwe(i,e,t,n,r,s,c)}var ast=(7+56*Ei)*Ei,lst=(3+28*Ei)*Ei,cst=(26+288*Ei)*Ei*Ei,ust=ht(4),hst=ht(4),fst=ht(4),dst=ht(4),pst=ht(4),mst=ht(4),Ast=ht(4),gst=ht(4),vst=ht(4),_st=ht(8),xst=ht(8),yst=ht(8),bst=ht(4),wst=ht(8),Sst=ht(8),Tst=ht(16),Est=ht(12),Mst=ht(192),Cst=ht(192);var Pst=(10+96*Ei)*Ei,Lst=(4+48*Ei)*Ei,Dst=(44+576*Ei)*Ei*Ei,Nst=ht(4),Fst=ht(4),Bst=ht(4),Ost=ht(4),Ust=ht(4),kst=ht(4),zst=ht(4),Vst=ht(4),Gst=ht(8),qst=ht(8),Hst=ht(8),Wst=ht(8),jst=ht(8),Xst=ht(8),$st=ht(8),Yst=ht(8),Zst=ht(8),Kst=ht(4),Qst=ht(4),Jst=ht(4),eot=ht(8),tot=ht(16),not=ht(16),iot=ht(16),rot=ht(32),sot=ht(32),oot=ht(48),aot=ht(64),lot=ht(1152),cot=ht(1152);var dot=(16+224*Ei)*Ei,pot=(5+72*Ei)*Ei,mot=(71+1408*Ei)*Ei*Ei,Aot=ht(4),got=ht(4),vot=ht(4),_ot=ht(4),xot=ht(4),yot=ht(4),bot=ht(4),wot=ht(4),Sot=ht(4),Tot=ht(4),Eot=ht(24),Mot=ht(24),Cot=ht(24),Rot=ht(24),Iot=ht(24),Pot=ht(24),Lot=ht(24),Dot=ht(24),Not=ht(24),Fot=ht(24),Bot=ht(1152),Oot=ht(1152),Uot=ht(1152),kot=ht(1152),zot=ht(1152),Vot=ht(2304),Got=ht(2304),qot=ht(3456),Hot=ht(5760),Wot=ht(8),jot=ht(8),Xot=ht(8),$ot=ht(16),Yot=ht(24),Zot=ht(48),Kot=ht(48),Qot=ht(96),Jot=ht(192),eat=ht(384),tat=ht(384),nat=ht(384),iat=ht(768);var rat=ht(96),sat=ht(96),oat=ht(96),aat=ht(1152);var nee=Math.pow(2,-52),nR=new Uint32Array(512),em=class i{static from(e,t=jwe,n=Xwe){let r=e.length,s=new Float64Array(r*2);for(let o=0;o<r;o++){let a=e[o];s[2*o]=t(a),s[2*o+1]=n(a)}return new i(s)}constructor(e){let t=e.length>>1;if(t>0&&typeof e[0]!="number")throw new Error("Expected coords to contain numbers.");this.coords=e;let n=Math.max(2*t-5,0);this._triangles=new Uint32Array(n*3),this._halfedges=new Int32Array(n*3),this._hashSize=Math.ceil(Math.sqrt(t)),this._hullPrev=new Uint32Array(t),this._hullNext=new Uint32Array(t),this._hullTri=new Uint32Array(t),this._hullHash=new Int32Array(this._hashSize),this._ids=new Uint32Array(t),this._dists=new Float64Array(t),this.trianglesLen=0,this._cx=0,this._cy=0,this._hullStart=0,this.hull=this._triangles,this.triangles=this._triangles,this.halfedges=this._halfedges,this.update()}update(){let{coords:e,_hullPrev:t,_hullNext:n,_hullTri:r,_hullHash:s}=this,o=e.length>>1,a=1/0,l=1/0,c=-1/0,u=-1/0;for(let B=0;B<o;B++){let k=e[2*B],z=e[2*B+1];k<a&&(a=k),z<l&&(l=z),k>c&&(c=k),z>u&&(u=z),this._ids[B]=B}let f=(a+c)/2,d=(l+u)/2,A=0,y=0,w=0;for(let B=0,k=1/0;B<o;B++){let z=mO(f,d,e[2*B],e[2*B+1]);z<k&&(A=B,k=z)}let S=e[2*A],T=e[2*A+1];for(let B=0,k=1/0;B<o;B++){if(B===A)continue;let z=mO(S,T,e[2*B],e[2*B+1]);z<k&&z>0&&(y=B,k=z)}let R=e[2*y],P=e[2*y+1],I=1/0;for(let B=0;B<o;B++){if(B===A||B===y)continue;let k=Hwe(S,T,R,P,e[2*B],e[2*B+1]);k<I&&(w=B,I=k)}let F=e[2*w],D=e[2*w+1];if(I===1/0){for(let z=0;z<o;z++)this._dists[z]=e[2*z]-e[0]||e[2*z+1]-e[1];O_(this._ids,this._dists,0,o-1);let B=new Uint32Array(o),k=0;for(let z=0,G=-1/0;z<o;z++){let W=this._ids[z],Y=this._dists[W];Y>G&&(B[k++]=W,G=Y)}this.hull=B.subarray(0,k),this.triangles=new Uint32Array(0),this.halfedges=new Int32Array(0);return}if(J0(S,T,R,P,F,D)<0){let B=y,k=R,z=P;y=w,R=F,P=D,w=B,F=k,D=z}let L=Wwe(S,T,R,P,F,D);this._cx=L.x,this._cy=L.y;for(let B=0;B<o;B++)this._dists[B]=mO(e[2*B],e[2*B+1],L.x,L.y);O_(this._ids,this._dists,0,o-1),this._hullStart=A;let C=3;n[A]=t[w]=y,n[y]=t[A]=w,n[w]=t[y]=A,r[A]=0,r[y]=1,r[w]=2,s.fill(-1),s[this._hashKey(S,T)]=A,s[this._hashKey(R,P)]=y,s[this._hashKey(F,D)]=w,this.trianglesLen=0,this._addTriangle(A,y,w,-1,-1,-1);for(let B=0,k=0,z=0;B<this._ids.length;B++){let G=this._ids[B],W=e[2*G],Y=e[2*G+1];if(B>0&&Math.abs(W-k)<=nee&&Math.abs(Y-z)<=nee||(k=W,z=Y,G===A||G===y||G===w))continue;let H=0;for(let he=0,ve=this._hashKey(W,Y);he<this._hashSize&&(H=s[(ve+he)%this._hashSize],!(H!==-1&&H!==n[H]));he++);H=t[H];let $=H,J;for(;J=n[$],J0(W,Y,e[2*$],e[2*$+1],e[2*J],e[2*J+1])>=0;)if($=J,$===H){$=-1;break}if($===-1)continue;let te=this._addTriangle($,G,n[$],-1,-1,r[$]);r[G]=this._legalize(te+2),r[$]=te,C++;let ce=n[$];for(;J=n[ce],J0(W,Y,e[2*ce],e[2*ce+1],e[2*J],e[2*J+1])<0;)te=this._addTriangle(ce,G,J,r[G],-1,r[ce]),r[G]=this._legalize(te+2),n[ce]=ce,C--,ce=J;if($===H)for(;J=t[$],J0(W,Y,e[2*J],e[2*J+1],e[2*$],e[2*$+1])<0;)te=this._addTriangle(J,G,$,-1,r[$],r[J]),this._legalize(te+2),r[J]=te,n[$]=$,C--,$=J;this._hullStart=t[G]=$,n[$]=t[ce]=G,n[G]=ce,s[this._hashKey(W,Y)]=G,s[this._hashKey(e[2*$],e[2*$+1])]=$}this.hull=new Uint32Array(C);for(let B=0,k=this._hullStart;B<C;B++)this.hull[B]=k,k=n[k];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(e,t){return Math.floor(Gwe(e-this._cx,t-this._cy)*this._hashSize)%this._hashSize}_legalize(e){let{_triangles:t,_halfedges:n,coords:r}=this,s=0,o=0;for(;;){let a=n[e],l=e-e%3;if(o=l+(e+2)%3,a===-1){if(s===0)break;e=nR[--s];continue}let c=a-a%3,u=l+(e+1)%3,f=c+(a+2)%3,d=t[o],A=t[e],y=t[u],w=t[f];if(qwe(r[2*d],r[2*d+1],r[2*A],r[2*A+1],r[2*y],r[2*y+1],r[2*w],r[2*w+1])){t[e]=w,t[a]=d;let T=n[f];if(T===-1){let P=this._hullStart;do{if(this._hullTri[P]===f){this._hullTri[P]=e;break}P=this._hullPrev[P]}while(P!==this._hullStart)}this._link(e,T),this._link(a,n[o]),this._link(o,f);let R=c+(a+1)%3;s<nR.length&&(nR[s++]=R)}else{if(s===0)break;e=nR[--s]}}return o}_link(e,t){this._halfedges[e]=t,t!==-1&&(this._halfedges[t]=e)}_addTriangle(e,t,n,r,s,o){let a=this.trianglesLen;return this._triangles[a]=e,this._triangles[a+1]=t,this._triangles[a+2]=n,this._link(a,r),this._link(a+1,s),this._link(a+2,o),this.trianglesLen+=3,a}};function Gwe(i,e){let t=i/(Math.abs(i)+Math.abs(e));return(e>0?3-t:1+t)/4}function mO(i,e,t,n){let r=i-t,s=e-n;return r*r+s*s}function qwe(i,e,t,n,r,s,o,a){let l=i-o,c=e-a,u=t-o,f=n-a,d=r-o,A=s-a,y=l*l+c*c,w=u*u+f*f,S=d*d+A*A;return l*(f*S-w*A)-c*(u*S-w*d)+y*(u*A-f*d)<0}function Hwe(i,e,t,n,r,s){let o=t-i,a=n-e,l=r-i,c=s-e,u=o*o+a*a,f=l*l+c*c,d=.5/(o*c-a*l),A=(c*u-a*f)*d,y=(o*f-l*u)*d;return A*A+y*y}function Wwe(i,e,t,n,r,s){let o=t-i,a=n-e,l=r-i,c=s-e,u=o*o+a*a,f=l*l+c*c,d=.5/(o*c-a*l),A=i+(c*u-a*f)*d,y=e+(o*f-l*u)*d;return{x:A,y}}function O_(i,e,t,n){if(n-t<=20)for(let r=t+1;r<=n;r++){let s=i[r],o=e[s],a=r-1;for(;a>=t&&e[i[a]]>o;)i[a+1]=i[a--];i[a+1]=s}else{let r=t+n>>1,s=t+1,o=n;Pw(i,r,s),e[i[t]]>e[i[n]]&&Pw(i,t,n),e[i[s]]>e[i[n]]&&Pw(i,s,n),e[i[t]]>e[i[s]]&&Pw(i,t,s);let a=i[s],l=e[a];for(;;){do s++;while(e[i[s]]<l);do o--;while(e[i[o]]>l);if(o<s)break;Pw(i,s,o)}i[t+1]=i[o],i[o]=a,n-s+1>=o-t?(O_(i,e,s,n),O_(i,e,t,o-1)):(O_(i,e,t,o-1),O_(i,e,s,n))}}function Pw(i,e,t){let n=i[e];i[e]=i[t],i[t]=n}function jwe(i){return i[0]}function Xwe(i){return i[1]}function iee(i,e){var t,n,r=0,s,o,a,l,c,u,f,d=i[0],A=i[1],y=e.length;for(t=0;t<y;t++){n=0;var w=e[t],S=w.length-1;if(u=w[0],u[0]!==w[S][0]&&u[1]!==w[S][1])throw new Error("First and last coordinates in a ring must be the same");for(o=u[0]-d,a=u[1]-A,n;n<S;n++){if(f=w[n+1],l=f[0]-d,c=f[1]-A,a===0&&c===0){if(l<=0&&o>=0||o<=0&&l>=0)return 0}else if(c>=0&&a<=0||c<=0&&a>=0){if(s=J0(o,l,a,c,0,0),s===0)return 0;(s>0&&c>0&&a<=0||s<0&&c<=0&&a>0)&&r++}u=f,a=c,o=l}}return r%2!==0}function ree(i){if(!i)throw new Error("coord is required");if(!Array.isArray(i)){if(i.type==="Feature"&&i.geometry!==null&&i.geometry.type==="Point")return[...i.geometry.coordinates];if(i.type==="Point")return[...i.coordinates]}if(Array.isArray(i)&&i.length>=2&&!Array.isArray(i[0])&&!Array.isArray(i[1]))return[...i];throw new Error("coord must be GeoJSON Point or an Array of numbers")}function see(i){return i.type==="Feature"?i.geometry:i}function $we(i,e,t={}){if(!i)throw new Error("point is required");if(!e)throw new Error("polygon is required");let n=ree(i),r=see(e),s=r.type,o=e.bbox,a=r.coordinates;if(o&&Ywe(n,o)===!1)return!1;s==="Polygon"&&(a=[a]);let l=!1;for(var c=0;c<a.length;++c){let u=iee(n,a[c]);if(u===0)return!t.ignoreBoundary;u&&(l=!0)}return l}function Ywe(i,e){return e[0]<=i[0]&&e[1]<=i[1]&&e[2]>=i[0]&&e[3]>=i[1]}var oee=$we;var Kc=class{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(e,t){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(e,t){this._+=`L${this._x1=+e},${this._y1=+t}`}arc(e,t,n){e=+e,t=+t,n=+n;let r=e+n,s=t;if(n<0)throw new Error("negative radius");this._x1===null?this._+=`M${r},${s}`:(Math.abs(this._x1-r)>1e-6||Math.abs(this._y1-s)>1e-6)&&(this._+="L"+r+","+s),n&&(this._+=`A${n},${n},0,1,1,${e-n},${t}A${n},${n},0,1,1,${this._x1=r},${this._y1=s}`)}rect(e,t,n,r){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${+n}v${+r}h${-n}Z`}value(){return this._||null}};var tm=class{constructor(){this._=[]}moveTo(e,t){this._.push([e,t])}closePath(){this._.push(this._[0].slice())}lineTo(e,t){this._.push([e,t])}value(){return this._.length?this._:null}};var Lw=class{constructor(e,[t,n,r,s]=[0,0,960,500]){if(!((r=+r)>=(t=+t))||!((s=+s)>=(n=+n)))throw new Error("invalid bounds");this.delaunay=e,this._circumcenters=new Float64Array(e.points.length*2),this.vectors=new Float64Array(e.points.length*2),this.xmax=r,this.xmin=t,this.ymax=s,this.ymin=n,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){let{delaunay:{points:e,hull:t,triangles:n},vectors:r}=this,s,o,a=this.circumcenters=this._circumcenters.subarray(0,n.length/3*2);for(let w=0,S=0,T=n.length,R,P;w<T;w+=3,S+=2){let I=n[w]*2,F=n[w+1]*2,D=n[w+2]*2,L=e[I],C=e[I+1],B=e[F],k=e[F+1],z=e[D],G=e[D+1],W=B-L,Y=k-C,H=z-L,$=G-C,J=(W*$-Y*H)*2;if(Math.abs(J)<1e-9){if(s===void 0){s=o=0;for(let ce of t)s+=e[ce*2],o+=e[ce*2+1];s/=t.length,o/=t.length}let te=1e9*Math.sign((s-L)*$-(o-C)*H);R=(L+z)/2-te*$,P=(C+G)/2+te*H}else{let te=1/J,ce=W*W+Y*Y,he=H*H+$*$;R=L+($*ce-Y*he)*te,P=C+(W*he-H*ce)*te}a[S]=R,a[S+1]=P}let l=t[t.length-1],c,u=l*4,f,d=e[2*l],A,y=e[2*l+1];r.fill(0);for(let w=0;w<t.length;++w)l=t[w],c=u,f=d,A=y,u=l*4,d=e[2*l],y=e[2*l+1],r[c+2]=r[u]=A-y,r[c+3]=r[u+1]=d-f}render(e){let t=e==null?e=new Kc:void 0,{delaunay:{halfedges:n,inedges:r,hull:s},circumcenters:o,vectors:a}=this;if(s.length<=1)return null;for(let u=0,f=n.length;u<f;++u){let d=n[u];if(d<u)continue;let A=Math.floor(u/3)*2,y=Math.floor(d/3)*2,w=o[A],S=o[A+1],T=o[y],R=o[y+1];this._renderSegment(w,S,T,R,e)}let l,c=s[s.length-1];for(let u=0;u<s.length;++u){l=c,c=s[u];let f=Math.floor(r[c]/3)*2,d=o[f],A=o[f+1],y=l*4,w=this._project(d,A,a[y+2],a[y+3]);w&&this._renderSegment(d,A,w[0],w[1],e)}return t&&t.value()}renderBounds(e){let t=e==null?e=new Kc:void 0;return e.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),t&&t.value()}renderCell(e,t){let n=t==null?t=new Kc:void 0,r=this._clip(e);if(r===null||!r.length)return;t.moveTo(r[0],r[1]);let s=r.length;for(;r[0]===r[s-2]&&r[1]===r[s-1]&&s>1;)s-=2;for(let o=2;o<s;o+=2)(r[o]!==r[o-2]||r[o+1]!==r[o-1])&&t.lineTo(r[o],r[o+1]);return t.closePath(),n&&n.value()}*cellPolygons(){let{delaunay:{points:e}}=this;for(let t=0,n=e.length/2;t<n;++t){let r=this.cellPolygon(t);r&&(r.index=t,yield r)}}cellPolygon(e){let t=new tm;return this.renderCell(e,t),t.value()}_renderSegment(e,t,n,r,s){let o,a=this._regioncode(e,t),l=this._regioncode(n,r);a===0&&l===0?(s.moveTo(e,t),s.lineTo(n,r)):(o=this._clipSegment(e,t,n,r,a,l))&&(s.moveTo(o[0],o[1]),s.lineTo(o[2],o[3]))}contains(e,t,n){return t=+t,t!==t||(n=+n,n!==n)?!1:this.delaunay._step(e,t,n)===e}*neighbors(e){let t=this._clip(e);if(t)for(let n of this.delaunay.neighbors(e)){let r=this._clip(n);if(r){e:for(let s=0,o=t.length;s<o;s+=2)for(let a=0,l=r.length;a<l;a+=2)if(t[s]===r[a]&&t[s+1]===r[a+1]&&t[(s+2)%o]===r[(a+l-2)%l]&&t[(s+3)%o]===r[(a+l-1)%l]){yield n;break e}}}}_cell(e){let{circumcenters:t,delaunay:{inedges:n,halfedges:r,triangles:s}}=this,o=n[e];if(o===-1)return null;let a=[],l=o;do{let c=Math.floor(l/3);if(a.push(t[c*2],t[c*2+1]),l=l%3===2?l-2:l+1,s[l]!==e)break;l=r[l]}while(l!==o&&l!==-1);return a}_clip(e){if(e===0&&this.delaunay.hull.length===1)return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];let t=this._cell(e);if(t===null)return null;let{vectors:n}=this,r=e*4;return this._simplify(n[r]||n[r+1]?this._clipInfinite(e,t,n[r],n[r+1],n[r+2],n[r+3]):this._clipFinite(e,t))}_clipFinite(e,t){let n=t.length,r=null,s,o,a=t[n-2],l=t[n-1],c,u=this._regioncode(a,l),f,d=0;for(let A=0;A<n;A+=2)if(s=a,o=l,a=t[A],l=t[A+1],c=u,u=this._regioncode(a,l),c===0&&u===0)f=d,d=0,r?r.push(a,l):r=[a,l];else{let y,w,S,T,R;if(c===0){if((y=this._clipSegment(s,o,a,l,c,u))===null)continue;[w,S,T,R]=y}else{if((y=this._clipSegment(a,l,s,o,u,c))===null)continue;[T,R,w,S]=y,f=d,d=this._edgecode(w,S),f&&d&&this._edge(e,f,d,r,r.length),r?r.push(w,S):r=[w,S]}f=d,d=this._edgecode(T,R),f&&d&&this._edge(e,f,d,r,r.length),r?r.push(T,R):r=[T,R]}if(r)f=d,d=this._edgecode(r[0],r[1]),f&&d&&this._edge(e,f,d,r,r.length);else if(this.contains(e,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2))return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];return r}_clipSegment(e,t,n,r,s,o){let a=s<o;for(a&&([e,t,n,r,s,o]=[n,r,e,t,o,s]);;){if(s===0&&o===0)return a?[n,r,e,t]:[e,t,n,r];if(s&o)return null;let l,c,u=s||o;u&8?(l=e+(n-e)*(this.ymax-t)/(r-t),c=this.ymax):u&4?(l=e+(n-e)*(this.ymin-t)/(r-t),c=this.ymin):u&2?(c=t+(r-t)*(this.xmax-e)/(n-e),l=this.xmax):(c=t+(r-t)*(this.xmin-e)/(n-e),l=this.xmin),s?(e=l,t=c,s=this._regioncode(e,t)):(n=l,r=c,o=this._regioncode(n,r))}}_clipInfinite(e,t,n,r,s,o){let a=Array.from(t),l;if((l=this._project(a[0],a[1],n,r))&&a.unshift(l[0],l[1]),(l=this._project(a[a.length-2],a[a.length-1],s,o))&&a.push(l[0],l[1]),a=this._clipFinite(e,a))for(let c=0,u=a.length,f,d=this._edgecode(a[u-2],a[u-1]);c<u;c+=2)f=d,d=this._edgecode(a[c],a[c+1]),f&&d&&(c=this._edge(e,f,d,a,c),u=a.length);else this.contains(e,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)&&(a=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax]);return a}_edge(e,t,n,r,s){for(;t!==n;){let o,a;switch(t){case 5:t=4;continue;case 4:t=6,o=this.xmax,a=this.ymin;break;case 6:t=2;continue;case 2:t=10,o=this.xmax,a=this.ymax;break;case 10:t=8;continue;case 8:t=9,o=this.xmin,a=this.ymax;break;case 9:t=1;continue;case 1:t=5,o=this.xmin,a=this.ymin;break}(r[s]!==o||r[s+1]!==a)&&this.contains(e,o,a)&&(r.splice(s,0,o,a),s+=2)}return s}_project(e,t,n,r){let s=1/0,o,a,l;if(r<0){if(t<=this.ymin)return null;(o=(this.ymin-t)/r)<s&&(l=this.ymin,a=e+(s=o)*n)}else if(r>0){if(t>=this.ymax)return null;(o=(this.ymax-t)/r)<s&&(l=this.ymax,a=e+(s=o)*n)}if(n>0){if(e>=this.xmax)return null;(o=(this.xmax-e)/n)<s&&(a=this.xmax,l=t+(s=o)*r)}else if(n<0){if(e<=this.xmin)return null;(o=(this.xmin-e)/n)<s&&(a=this.xmin,l=t+(s=o)*r)}return[a,l]}_edgecode(e,t){return(e===this.xmin?1:e===this.xmax?2:0)|(t===this.ymin?4:t===this.ymax?8:0)}_regioncode(e,t){return(e<this.xmin?1:e>this.xmax?2:0)|(t<this.ymin?4:t>this.ymax?8:0)}_simplify(e){if(e&&e.length>4){for(let t=0;t<e.length;t+=2){let n=(t+2)%e.length,r=(t+4)%e.length;(e[t]===e[n]&&e[n]===e[r]||e[t+1]===e[n+1]&&e[n+1]===e[r+1])&&(e.splice(n,2),t-=2)}e.length||(e=null)}return e}};var Zwe=2*Math.PI,U_=Math.pow;function Kwe(i){return i[0]}function Qwe(i){return i[1]}function Jwe(i){let{triangles:e,coords:t}=i;for(let n=0;n<e.length;n+=3){let r=2*e[n],s=2*e[n+1],o=2*e[n+2];if((t[o]-t[r])*(t[s+1]-t[r+1])-(t[s]-t[r])*(t[o+1]-t[r+1])>1e-10)return!1}return!0}function eSe(i,e,t){return[i+Math.sin(i+e)*t,e+Math.cos(i-e)*t]}var k_=class i{static from(e,t=Kwe,n=Qwe,r){return new i("length"in e?tSe(e,t,n,r):Float64Array.from(nSe(e,t,n,r)))}constructor(e){this._delaunator=new em(e),this.inedges=new Int32Array(e.length/2),this._hullIndex=new Int32Array(e.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){let e=this._delaunator,t=this.points;if(e.hull&&e.hull.length>2&&Jwe(e)){this.collinear=Int32Array.from({length:t.length/2},(d,A)=>A).sort((d,A)=>t[2*d]-t[2*A]||t[2*d+1]-t[2*A+1]);let l=this.collinear[0],c=this.collinear[this.collinear.length-1],u=[t[2*l],t[2*l+1],t[2*c],t[2*c+1]],f=1e-8*Math.hypot(u[3]-u[1],u[2]-u[0]);for(let d=0,A=t.length/2;d<A;++d){let y=eSe(t[2*d],t[2*d+1],f);t[2*d]=y[0],t[2*d+1]=y[1]}this._delaunator=new em(t)}else delete this.collinear;let n=this.halfedges=this._delaunator.halfedges,r=this.hull=this._delaunator.hull,s=this.triangles=this._delaunator.triangles,o=this.inedges.fill(-1),a=this._hullIndex.fill(-1);for(let l=0,c=n.length;l<c;++l){let u=s[l%3===2?l-2:l+1];(n[l]===-1||o[u]===-1)&&(o[u]=l)}for(let l=0,c=r.length;l<c;++l)a[r[l]]=l;r.length<=2&&r.length>0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=r[0],o[r[0]]=1,r.length===2&&(o[r[1]]=0,this.triangles[1]=r[1],this.triangles[2]=r[1]))}voronoi(e){return new Lw(this,e)}*neighbors(e){let{inedges:t,hull:n,_hullIndex:r,halfedges:s,triangles:o,collinear:a}=this;if(a){let f=a.indexOf(e);f>0&&(yield a[f-1]),f<a.length-1&&(yield a[f+1]);return}let l=t[e];if(l===-1)return;let c=l,u=-1;do{if(yield u=o[c],c=c%3===2?c-2:c+1,o[c]!==e)return;if(c=s[c],c===-1){let f=n[(r[e]+1)%n.length];f!==u&&(yield f);return}}while(c!==l)}find(e,t,n=0){if(e=+e,e!==e||(t=+t,t!==t))return-1;let r=n,s;for(;(s=this._step(n,e,t))>=0&&s!==n&&s!==r;)n=s;return s}_step(e,t,n){let{inedges:r,hull:s,_hullIndex:o,halfedges:a,triangles:l,points:c}=this;if(r[e]===-1||!c.length)return(e+1)%(c.length>>1);let u=e,f=U_(t-c[e*2],2)+U_(n-c[e*2+1],2),d=r[e],A=d;do{let y=l[A],w=U_(t-c[y*2],2)+U_(n-c[y*2+1],2);if(w<f&&(f=w,u=y),A=A%3===2?A-2:A+1,l[A]!==e)break;if(A=a[A],A===-1){if(A=s[(o[e]+1)%s.length],A!==y&&U_(t-c[A*2],2)+U_(n-c[A*2+1],2)<f)return A;break}}while(A!==d);return u}render(e){let t=e==null?e=new Kc:void 0,{points:n,halfedges:r,triangles:s}=this;for(let o=0,a=r.length;o<a;++o){let l=r[o];if(l<o)continue;let c=s[o]*2,u=s[l]*2;e.moveTo(n[c],n[c+1]),e.lineTo(n[u],n[u+1])}return this.renderHull(e),t&&t.value()}renderPoints(e,t){t===void 0&&(!e||typeof e.moveTo!="function")&&(t=e,e=null),t=t==null?2:+t;let n=e==null?e=new Kc:void 0,{points:r}=this;for(let s=0,o=r.length;s<o;s+=2){let a=r[s],l=r[s+1];e.moveTo(a+t,l),e.arc(a,l,t,0,Zwe)}return n&&n.value()}renderHull(e){let t=e==null?e=new Kc:void 0,{hull:n,points:r}=this,s=n[0]*2,o=n.length;e.moveTo(r[s],r[s+1]);for(let a=1;a<o;++a){let l=2*n[a];e.lineTo(r[l],r[l+1])}return e.closePath(),t&&t.value()}hullPolygon(){let e=new tm;return this.renderHull(e),e.value()}renderTriangle(e,t){let n=t==null?t=new Kc:void 0,{points:r,triangles:s}=this,o=s[e*=3]*2,a=s[e+1]*2,l=s[e+2]*2;return t.moveTo(r[o],r[o+1]),t.lineTo(r[a],r[a+1]),t.lineTo(r[l],r[l+1]),t.closePath(),n&&n.value()}*trianglePolygons(){let{triangles:e}=this;for(let t=0,n=e.length/3;t<n;++t)yield this.trianglePolygon(t)}trianglePolygon(e){let t=new tm;return this.renderTriangle(e,t),t.value()}};function tSe(i,e,t,n){let r=i.length,s=new Float64Array(r*2);for(let o=0;o<r;++o){let a=i[o];s[o*2]=e.call(n,a,o,i),s[o*2+1]=t.call(n,a,o,i)}return s}function*nSe(i,e,t,n){let r=0;for(let s of i)yield e.call(n,s,r,i),yield t.call(n,s,r,i),++r}var Dw=Math.PI,aee=Dw/2,Vat=Dw/4,Gat=Dw*2,AO=180/Dw,gO=Dw/180;var vO=Math.atan2,iR=Math.cos;var lee=Math.max,cee=Math.min;var rR=Math.sin,uee=Math.sign||function(i){return i>0?1:i<0?-1:0},sR=Math.sqrt;function _O(i){return i>1?aee:i<-1?-aee:Math.asin(i)}function xO(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]}function Cl(i,e){return[i[1]*e[2]-i[2]*e[1],i[2]*e[0]-i[0]*e[2],i[0]*e[1]-i[1]*e[0]]}function Nw(i,e){return[i[0]+e[0],i[1]+e[1],i[2]+e[2]]}function Fw(i){var e=sR(i[0]*i[0]+i[1]*i[1]+i[2]*i[2]);return[i[0]/e,i[1]/e,i[2]/e]}function yO(i){return[vO(i[1],i[0])*AO,_O(lee(-1,cee(1,i[2])))*AO]}function of(i){let e=i[0]*gO,t=i[1]*gO,n=iR(t);return[n*iR(e),n*rR(e),rR(t)]}function oR(i){return i=i.map(e=>of(e)),xO(i[0],Cl(i[2],i[1]))}function fee(i){let e=rSe(i),t=oSe(e),n=sSe(t,i),r=lSe(t,i.length),s=iSe(r,i),o=aSe(t,i),{polygons:a,centers:l}=cSe(o,t,i),c=uSe(a),u=fSe(t,i),f=hSe(n,t);return{delaunay:e,edges:n,triangles:t,centers:l,neighbors:r,polygons:a,mesh:c,hull:u,urquhart:f,find:s}}function iSe(i,e){function t(n,r){let s=n[0]-r[0],o=n[1]-r[1],a=n[2]-r[2];return s*s+o*o+a*a}return function(r,s,o){o===void 0&&(o=0);let a,l,c=o,u=of([r,s]);do a=o,o=null,l=t(u,of(e[a])),i[a].forEach(f=>{let d=t(u,of(e[f]));if(d<l){l=d,o=f,c=f;return}});while(o!==null);return c}}function rSe(i){if(i.length<2)return{};let e=0;for(;isNaN(i[e][0]+i[e][1])&&e++<i.length;);let t=wB(i[e]),n=VB().translate([0,0]).scale(1).rotate(t.invert([180,0]));i=i.map(n);let r=[],s=1;for(let d=0,A=i.length;d<A;d++){let y=i[d][0]**2+i[d][1]**2;!isFinite(y)||y>1e32?r.push(d):y>s&&(s=y)}let o=1e6*sR(s);r.forEach(d=>i[d]=[o,0]),i.push([0,o]),i.push([-o,0]),i.push([0,-o]);let a=k_.from(i);a.projection=n;let{triangles:l,halfedges:c,inedges:u}=a,f=[];for(let d=0,A=c.length;d<A;d++)if(c[d]<0){let y=d%3==2?d-2:d+1,w=d%3==0?d+2:d-1,S=c[y],T=c[w];c[S]=T,c[T]=S,c[y]=c[w]=-1,l[d]=l[y]=l[w]=e,u[l[S]]=S%3==0?S+2:S-1,u[l[T]]=T%3==0?T+2:T-1,f.push(Math.min(d,y,w)),d+=2-d%3}else l[d]>i.length-3-1&&(l[d]=e);return a}function sSe(i,e){let t=new Set;return e.length===2?[[0,1]]:(i.forEach(n=>{if(n[0]!==n[1]&&!(oR(n.map(r=>e[r]))<0))for(let r=0,s;r<3;r++)s=(r+1)%3,t.add(j0([n[r],n[s]]).join("-"))}),Array.from(t,n=>n.split("-").map(Number)))}function oSe(i){let{triangles:e}=i;if(!e)return[];let t=[];for(let n=0,r=e.length/3;n<r;n++){let s=e[3*n],o=e[3*n+1],a=e[3*n+2];s!==o&&o!==a&&t.push([s,a,o])}return t}function aSe(i,e){return i.map(t=>{let n=t.map(s=>e[s]).map(of),r=Nw(Nw(Cl(n[1],n[0]),Cl(n[2],n[1])),Cl(n[0],n[2]));return yO(Fw(r))})}function lSe(i,e){let t=[];return i.forEach(n=>{for(let r=0;r<3;r++){let s=n[r],o=n[(r+1)%3];t[s]=t[s]||[],t[s].push(o)}}),i.length===0&&(e===2?(t[0]=[1],t[1]=[0]):e===1&&(t[0]=[])),t}function cSe(i,e,t){let n=[],r=i.slice();if(e.length===0){if(t.length<2)return{polygons:n,centers:r};if(t.length===2){let a=of(t[0]),l=of(t[1]),c=Fw(Nw(a,l)),u=Fw(Cl(a,l)),f=Cl(c,u),d=[c,Cl(c,f),Cl(Cl(c,f),f),Cl(Cl(Cl(c,f),f),f)].map(yO).map(o);return n.push(d),n.push(d.slice().reverse()),{polygons:n,centers:r}}}e.forEach((a,l)=>{for(let c=0;c<3;c++){let u=a[c],f=a[(c+1)%3],d=a[(c+2)%3];n[u]=n[u]||[],n[u].push([f,d,l,[u,f,d]])}});let s=n.map(a=>{let l=[a[0][2]],c=a[0][1];for(let u=1;u<a.length;u++)for(let f=0;f<a.length;f++)if(a[f][0]==c){c=a[f][1],l.push(a[f][2]);break}if(l.length>2)return l;if(l.length==2){let u=hee(t[a[0][3][0]],t[a[0][3][1]],r[l[0]]),f=hee(t[a[0][3][2]],t[a[0][3][0]],r[l[0]]),d=o(u),A=o(f);return[l[0],A,l[1],d]}});function o(a){let l=-1;return r.slice(e.length,1/0).forEach((c,u)=>{c[0]===a[0]&&c[1]===a[1]&&(l=u+e.length)}),l<0&&(l=r.length,r.push(a)),l}return{polygons:s,centers:r}}function hee(i,e,t){i=of(i),e=of(e),t=of(t);let n=uee(xO(Cl(e,i),t));return yO(Fw(Nw(i,e)).map(r=>n*r))}function uSe(i){let e=[];return i.forEach(t=>{if(!t)return;let n=t[t.length-1];for(let r of t)r>n&&e.push([n,r]),n=r}),e}function hSe(i,e){return function(t){let n=new Map,r=new Map;return i.forEach((s,o)=>{let a=s.join("-");n.set(a,t[o]),r.set(a,!0)}),e.forEach(s=>{let o=0,a=-1;for(let l=0;l<3;l++){let c=j0([s[l],s[(l+1)%3]]).join("-");n.get(c)>o&&(o=n.get(c),a=c)}r.set(a,!1)}),i.map(s=>r.get(s.join("-")))}}function fSe(i,e){let t=new Set,n=[];i.map(a=>{if(!(oR(a.map(l=>e[l>e.length?0:l]))>1e-12))for(let l=0;l<3;l++){let c=[a[l],a[(l+1)%3]],u=`${c[0]}-${c[1]}`;t.has(u)?t.delete(u):t.add(`${c[1]}-${c[0]}`)}});let r=new Map,s;if(t.forEach(a=>{a=a.split("-").map(Number),r.set(a[0],a[1]),s=a[0]}),s===void 0)return n;let o=s;do{n.push(o);let a=r.get(o);r.set(o,-1),o=a}while(o>-1&&o!==s);return n}function bO(i){let e=function(t){if(e.delaunay=null,e._data=t,typeof e._data=="object"&&e._data.type==="FeatureCollection"&&(e._data=e._data.features),typeof e._data=="object"){let n=e._data.map(r=>[e._vx(r),e._vy(r),r]).filter(r=>isFinite(r[0]+r[1]));e.points=n.map(r=>[r[0],r[1]]),e.valid=n.map(r=>r[2]),e.delaunay=fee(e.points)}return e};return e._vx=function(t){if(typeof t=="object"&&"type"in t)return IC(t)[0];if(0 in t)return t[0]},e._vy=function(t){if(typeof t=="object"&&"type"in t)return IC(t)[1];if(1 in t)return t[1]},e.x=function(t){return t?(e._vx=t,e):e._vx},e.y=function(t){return t?(e._vy=t,e):e._vy},e.polygons=function(t){if(t!==void 0&&e(t),!e.delaunay)return!1;let n={type:"FeatureCollection",features:[]};return e.valid.length===0||(e.delaunay.polygons.forEach((r,s)=>n.features.push({type:"Feature",geometry:r?{type:"Polygon",coordinates:[[...r,r[0]].map(o=>e.delaunay.centers[o])]}:null,properties:{site:e.valid[s],sitecoordinates:e.points[s],neighbours:e.delaunay.neighbors[s]}})),e.valid.length===1&&n.features.push({type:"Feature",geometry:{type:"Sphere"},properties:{site:e.valid[0],sitecoordinates:e.points[0],neighbours:[]}})),n},e.triangles=function(t){return t!==void 0&&e(t),e.delaunay?{type:"FeatureCollection",features:e.delaunay.triangles.map((n,r)=>(n=n.map(s=>e.points[s]),n.center=e.delaunay.centers[r],n)).filter(n=>oR(n)>0).map(n=>({type:"Feature",properties:{circumcenter:n.center},geometry:{type:"Polygon",coordinates:[[...n,n[0]]]}}))}:!1},e.links=function(t){if(t!==void 0&&e(t),!e.delaunay)return!1;let n=e.delaunay.edges.map(s=>Ml(e.points[s[0]],e.points[s[1]])),r=e.delaunay.urquhart(n);return{type:"FeatureCollection",features:e.delaunay.edges.map((s,o)=>({type:"Feature",properties:{source:e.valid[s[0]],target:e.valid[s[1]],length:n[o],urquhart:!!r[o]},geometry:{type:"LineString",coordinates:[e.points[s[0]],e.points[s[1]]]}}))}},e.mesh=function(t){return t!==void 0&&e(t),e.delaunay?{type:"MultiLineString",coordinates:e.delaunay.edges.map(n=>[e.points[n[0]],e.points[n[1]]])}:!1},e.cellMesh=function(t){if(t!==void 0&&e(t),!e.delaunay)return!1;let{centers:n,polygons:r}=e.delaunay,s=[];for(let o of r)if(o)for(let a=o.length,l=o[a-1],c=o[0],u=0;u<a;l=c,c=o[++u])c>l&&s.push([n[l],n[c]]);return{type:"MultiLineString",coordinates:s}},e._found=void 0,e.find=function(t,n,r){if(e._found=e.delaunay.find(t,n,e._found),!r||Ml([t,n],e.points[e._found])<r)return e._found},e.hull=function(t){t!==void 0&&e(t);let n=e.delaunay.hull,r=e.points;return n.length===0?null:{type:"Polygon",coordinates:[[...n.map(s=>r[s]),r[n[0]]]]}},i?e(i):e}function SO(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function dSe(i){if(Array.isArray(i))return i}function pSe(i){if(Array.isArray(i))return SO(i)}function mSe(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function ASe(i,e,t){return e=lR(e),SSe(i,pee()?Reflect.construct(e,[],lR(i).constructor):e.apply(i,t))}function gSe(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function vSe(i,e,t){return Object.defineProperty(i,"prototype",{writable:!1}),i}function lR(i){return lR=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},lR(i)}function _Se(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),e&&TO(i,e)}function pee(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(pee=function(){return!!i})()}function xSe(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function ySe(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function bSe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.4126+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function wSe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.4127+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function SSe(i,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return mSe(i)}function TO(i,e){return TO=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},TO(i,e)}function af(i,e){return dSe(i)||ySe(i,e)||mee(i,e)||bSe()}function wO(i){return pSe(i)||xSe(i)||mee(i)||wSe()}function mee(i,e){if(i){if(typeof i=="string")return SO(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?SO(i,e):void 0}}function TSe(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=e.resolution,n=t===void 0?1/0:t,r=ESe(i,n),s=Jh(r),o=MSe(i,n),a=[].concat(wO(s),wO(o)),l={type:"Polygon",coordinates:i},c=bC(l),u=af(c,2),f=af(u[0],2),d=f[0],A=f[1],y=af(u[1],2),w=y[0],S=y[1],T=d>w||S>=89||A<=-89,R=[];if(T){var P=bO(a).triangles(),I=new Map(a.map(function(J,te){var ce=af(J,2),he=ce[0],ve=ce[1];return["".concat(he,"-").concat(ve),te]}));P.features.forEach(function(J){var te,ce=J.geometry.coordinates[0].slice(0,3).reverse(),he=[];if(ce.forEach(function(Re){var Qe=af(Re,2),Fe=Qe[0],mt=Qe[1],Ee="".concat(Fe,"-").concat(mt);I.has(Ee)&&he.push(I.get(Ee))}),he.length===3){if(he.some(function(Re){return Re<s.length})){var ve=J.properties.circumcenter;if(!EO(ve,l,T))return}(te=R).push.apply(te,he)}})}else if(o.length)for(var B=em.from(a),k=function(te){var ce,he=[2,1,0].map(function(Qe){return B.triangles[te+Qe]}),ve=he.map(function(Qe){return a[Qe]});if(he.some(function(Qe){return Qe<s.length})){var Re=[0,1].map(function(Qe){return rC(ve,function(Fe){return Fe[Qe]})});if(!EO(Re,l,T))return 1}(ce=R).push.apply(ce,wO(he))},z=0,G=B.triangles.length;z<G;z+=3)k(z);else{var F=L_(r),D=F.vertices,L=F.holes,C=L===void 0?[]:L;R=tO(D,C,2)}var W=Tl(j0(a,function(J){return J[0]}),[0,1]),Y=Tl(j0(a,function(J){return J[1]}),[0,1]),H=a.map(function(J){var te=af(J,2),ce=te[0],he=te[1];return[W(ce),Y(he)]}),$={points:a,indices:R,uvs:H};return{contour:r,triangles:$}}function ESe(i,e){return i.map(function(t){var n=[],r;return t.forEach(function(s){if(r){var o=Ml(s,r)*180/Math.PI;if(o>e)for(var a=Cg(r,s),l=1/Math.ceil(o/e),c=l;c<1;)n.push(a(c)),c+=l}n.push(r=s)}),n})}function MSe(i,e){var t={type:"Polygon",coordinates:i},n=bC(t),r=af(n,2),s=af(r[0],2),o=s[0],a=s[1],l=af(r[1],2),c=l[0],u=l[1];if(Math.min(Math.abs(c-o),Math.abs(u-a))<e)return[];var f=o>c||u>=89||a<=-89;return CSe(e,{minLng:o,maxLng:c,minLat:a,maxLat:u}).filter(function(d){return EO(d,t,f)})}function CSe(i){for(var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=e.minLng,n=e.maxLng,r=e.minLat,s=e.maxLat,o=Math.round(Math.pow(360/i,2)/Math.PI),a=(1+Math.sqrt(5))/2,l=function(T){return T/a*360%360-180},c=function(T){return Math.acos(2*T/o-1)/Math.PI*180-90},u=function(T){return o*(Math.cos((T+90)*Math.PI/180)+1)/2},f=[s!==void 0?Math.ceil(u(s)):0,r!==void 0?Math.floor(u(r)):o-1],d=t===void 0&&n===void 0?function(){return!0}:t===void 0?function(S){return S<=n}:n===void 0?function(S){return S>=t}:n>=t?function(S){return S>=t&&S<=n}:function(S){return S>=t||S<=n},A=[],y=f[0];y<=f[1];y++){var w=l(y);d(w)&&A.push([w,c(y)])}return A}function EO(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return t?IB(e,i):oee(i,e)}var aR=window.THREE?window.THREE:{BufferGeometry:Xn,Float32BufferAttribute:Ln},dee=new aR.BufferGeometry().setAttribute?"setAttribute":"addAttribute",cR=(function(i){function e(t,n,r,s,o,a,l){var c;gSe(this,e),c=ASe(this,e),c.type="ConicPolygonGeometry",c.parameters={polygonGeoJson:t,bottomHeight:n,topHeight:r,closedBottom:s,closedTop:o,includeSides:a,curvatureResolution:l},n=n||0,r=r||1,s=s!==void 0?s:!0,o=o!==void 0?o:!0,a=a!==void 0?a:!0,l=l||5;var u=TSe(t,{resolution:l}),f=u.contour,d=u.triangles,A=Jh(d.uvs),y=[],w=[],S=[],T=0,R=function(L){var C=Math.round(y.length/3),B=S.length;y=y.concat(L.vertices),w=w.concat(L.uvs),S=S.concat(C?L.indices.map(function(k){return k+C}):L.indices),c.addGroup(B,S.length-B,T++)};a&&R(I()),s&&R(F(n,!1)),o&&R(F(r,!0)),c.setIndex(S),c[dee]("position",new aR.Float32BufferAttribute(y,3)),c[dee]("uv",new aR.Float32BufferAttribute(w,2)),c.computeVertexNormals();function P(D,L){var C=typeof L=="function"?L:function(){return L},B=D.map(function(k){return k.map(function(z){var G=af(z,2),W=G[0],Y=G[1];return RSe(Y,W,C(W,Y))})});return L_(B)}function I(){for(var D=P(f,n),L=D.vertices,C=D.holes,B=P(f,r),k=B.vertices,z=Jh([k,L]),G=Math.round(k.length/3),W=new Set(C),Y=0,H=[],$=0;$<G;$++){var J=$+1;if(J===G)J=Y;else if(W.has(J)){var te=J;J=Y,Y=te}H.push($,$+G,J+G),H.push(J+G,J,$)}for(var ce=[],he=1;he>=0;he--)for(var ve=0;ve<G;ve+=1)ce.push(ve/(G-1),he);return{indices:H,vertices:z,uvs:ce}}function F(D){var L=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return{indices:L?d.indices:d.indices.slice().reverse(),vertices:P([d.points],D).vertices,uvs:A}}return c}return _Se(e,i),vSe(e)})(aR.BufferGeometry);function RSe(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=(90-i)*Math.PI/180,r=(90-e)*Math.PI/180;return[t*Math.sin(n)*Math.cos(r),t*Math.cos(n),t*Math.sin(n)*Math.sin(r)]}function MO(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function ISe(i){if(Array.isArray(i))return i}function PSe(i){if(Array.isArray(i))return MO(i)}function LSe(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function DSe(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function NSe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.4128+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function FSe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.4129+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function BSe(i,e){if(i==null)return{};var t,n,r=OSe(i,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);for(n=0;n<s.length;n++)t=s[n],e.includes(t)||{}.propertyIsEnumerable.call(i,t)&&(r[t]=i[t])}return r}function OSe(i,e){if(i==null)return{};var t={};for(var n in i)if({}.hasOwnProperty.call(i,n)){if(e.includes(n))continue;t[n]=i[n]}return t}function USe(i,e){return ISe(i)||DSe(i,e)||Aee(i,e)||NSe()}function kSe(i){return PSe(i)||LSe(i)||Aee(i)||FSe()}function zSe(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(i)}function VSe(i){var e=zSe(i,"string");return typeof e=="symbol"?e:e+""}function Aee(i,e){if(i){if(typeof i=="string")return MO(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?MO(i,e):void 0}}var gee=(function(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,r=(e instanceof Array?e.length?e:[void 0]:[e]).map(function(a){return{keyAccessor:a,isProp:!(a instanceof Function)}}),s=i.reduce(function(a,l){var c=a,u=l;return r.forEach(function(f,d){var A=f.keyAccessor,y=f.isProp,w;if(y){var S=u,T=S[A],R=BSe(S,[A].map(VSe));w=T,u=R}else w=A(u,d);d+1<r.length?(c.hasOwnProperty(w)||(c[w]={}),c=c[w]):t?(c.hasOwnProperty(w)||(c[w]=[]),c[w].push(u)):c[w]=u}),a},{});t instanceof Function&&(function a(l){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;c===r.length?Object.keys(l).forEach(function(u){return l[u]=t(l[u])}):Object.values(l).forEach(function(u){return a(u,c+1)})})(s);var o=s;return n&&(o=[],(function a(l){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];c.length===r.length?o.push({keys:c,vals:l}):Object.entries(l).forEach(function(u){var f=USe(u,2),d=f[0],A=f[1];return a(A,[].concat(kSe(c),[d]))})})(s),e instanceof Array&&e.length===0&&o.length===1&&(o[0].keys=[])),o});var Ai=(function(i){i=i||{};var e=typeof i<"u"?i:{},t={},n;for(n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);var r=[],s="";function o(Le){return e.locateFile?e.locateFile(Le,s):s+Le}var a;typeof document<"u"&&document.currentScript&&(s=document.currentScript.src),s.indexOf("blob:")!==0?s=s.substr(0,s.lastIndexOf("/")+1):s="",a=function(it,Dt,He){var h=new XMLHttpRequest;h.open("GET",it,!0),h.responseType="arraybuffer",h.onload=function(){if(h.status==200||h.status==0&&h.response){Dt(h.response);return}var Ii=St(it);if(Ii){Dt(Ii.buffer);return}He()},h.onerror=He,h.send(null)};var l=e.print||console.log.bind(console),c=e.printErr||console.warn.bind(console);for(n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);t=null,e.arguments&&(r=e.arguments);var u=0,f=function(Le){u=Le},d=function(){return u},A=8;function y(Le,it,Dt,He){switch(Dt=Dt||"i8",Dt.charAt(Dt.length-1)==="*"&&(Dt="i32"),Dt){case"i1":Y[Le>>0]=it;break;case"i8":Y[Le>>0]=it;break;case"i16":$[Le>>1]=it;break;case"i32":te[Le>>2]=it;break;case"i64":Ge=[it>>>0,(Pe=it,+bt(Pe)>=1?Pe>0?(en(+hn(Pe/4294967296),4294967295)|0)>>>0:~~+yt((Pe-+(~~Pe>>>0))/4294967296)>>>0:0)],te[Le>>2]=Ge[0],te[Le+4>>2]=Ge[1];break;case"float":he[Le>>2]=it;break;case"double":ve[Le>>3]=it;break;default:km("invalid type for setValue: "+Dt)}}function w(Le,it,Dt){switch(it=it||"i8",it.charAt(it.length-1)==="*"&&(it="i32"),it){case"i1":return Y[Le>>0];case"i8":return Y[Le>>0];case"i16":return $[Le>>1];case"i32":return te[Le>>2];case"i64":return te[Le>>2];case"float":return he[Le>>2];case"double":return ve[Le>>3];default:km("invalid type for getValue: "+it)}return null}var S=!1;function T(Le,it){Le||km("Assertion failed: "+it)}function R(Le){var it=e["_"+Le];return T(it,"Cannot call unknown function "+Le+", make sure it is exported"),it}function P(Le,it,Dt,He,h){var sr={string:function(ii){var zi=0;if(ii!=null&&ii!==0){var oT=(ii.length<<2)+1;zi=GG(oT),B(ii,zi,oT)}return zi},array:function(ii){var zi=GG(ii.length);return z(ii,zi),zi}};function Ii(ii){return it==="string"?L(ii):it==="boolean"?!!ii:ii}var ie=R(Le),or=[],ol=0;if(He)for(var fo=0;fo<He.length;fo++){var Qs=sr[Dt[fo]];Qs?(ol===0&&(ol=_ce()),or[fo]=Qs(He[fo])):or[fo]=He[fo]}var bs=ie.apply(null,or);return bs=Ii(bs),ol!==0&&vce(ol),bs}function I(Le,it,Dt,He){Dt=Dt||[];var h=Dt.every(function(Ii){return Ii==="number"}),sr=it!=="string";return sr&&h&&!He?R(Le):function(){return P(Le,it,Dt,arguments,He)}}var F=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function D(Le,it,Dt){for(var He=it+Dt,h=it;Le[h]&&!(h>=He);)++h;if(h-it>16&&Le.subarray&&F)return F.decode(Le.subarray(it,h));for(var sr="";it<h;){var Ii=Le[it++];if(!(Ii&128)){sr+=String.fromCharCode(Ii);continue}var ie=Le[it++]&63;if((Ii&224)==192){sr+=String.fromCharCode((Ii&31)<<6|ie);continue}var or=Le[it++]&63;if((Ii&240)==224?Ii=(Ii&15)<<12|ie<<6|or:Ii=(Ii&7)<<18|ie<<12|or<<6|Le[it++]&63,Ii<65536)sr+=String.fromCharCode(Ii);else{var ol=Ii-65536;sr+=String.fromCharCode(55296|ol>>10,56320|ol&1023)}}return sr}function L(Le,it){return Le?D(H,Le,it):""}function C(Le,it,Dt,He){if(!(He>0))return 0;for(var h=Dt,sr=Dt+He-1,Ii=0;Ii<Le.length;++Ii){var ie=Le.charCodeAt(Ii);if(ie>=55296&&ie<=57343){var or=Le.charCodeAt(++Ii);ie=65536+((ie&1023)<<10)|or&1023}if(ie<=127){if(Dt>=sr)break;it[Dt++]=ie}else if(ie<=2047){if(Dt+1>=sr)break;it[Dt++]=192|ie>>6,it[Dt++]=128|ie&63}else if(ie<=65535){if(Dt+2>=sr)break;it[Dt++]=224|ie>>12,it[Dt++]=128|ie>>6&63,it[Dt++]=128|ie&63}else{if(Dt+3>=sr)break;it[Dt++]=240|ie>>18,it[Dt++]=128|ie>>12&63,it[Dt++]=128|ie>>6&63,it[Dt++]=128|ie&63}}return it[Dt]=0,Dt-h}function B(Le,it,Dt){return C(Le,H,it,Dt)}var k=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0;function z(Le,it){Y.set(Le,it)}function G(Le,it){return Le%it>0&&(Le+=it-Le%it),Le}var W,Y,H,$,J,te,ce,he,ve;function Re(Le){W=Le,e.HEAP8=Y=new Int8Array(Le),e.HEAP16=$=new Int16Array(Le),e.HEAP32=te=new Int32Array(Le),e.HEAPU8=H=new Uint8Array(Le),e.HEAPU16=J=new Uint16Array(Le),e.HEAPU32=ce=new Uint32Array(Le),e.HEAPF32=he=new Float32Array(Le),e.HEAPF64=ve=new Float64Array(Le)}var Qe=5271296,Fe=28384,mt=e.TOTAL_MEMORY||33554432;e.buffer?W=e.buffer:W=new ArrayBuffer(mt),mt=W.byteLength,Re(W),te[Fe>>2]=Qe;function Ee(Le){for(;Le.length>0;){var it=Le.shift();if(typeof it=="function"){it();continue}var Dt=it.func;typeof Dt=="number"?it.arg===void 0?e.dynCall_v(Dt):e.dynCall_vi(Dt,it.arg):Dt(it.arg===void 0?null:it.arg)}}var Ve=[],Ye=[],Mt=[],Et=[];function It(){if(e.preRun)for(typeof e.preRun=="function"&&(e.preRun=[e.preRun]);e.preRun.length;)ot(e.preRun.shift());Ee(Ve)}function dn(){Ee(Ye)}function Gt(){Ee(Mt)}function $e(){if(e.postRun)for(typeof e.postRun=="function"&&(e.postRun=[e.postRun]);e.postRun.length;)nt(e.postRun.shift());Ee(Et)}function ot(Le){Ve.unshift(Le)}function nt(Le){Et.unshift(Le)}var bt=Math.abs,yt=Math.ceil,hn=Math.floor,en=Math.min,tn=0,bn=null,_e=null;function vi(Le){tn++,e.monitorRunDependencies&&e.monitorRunDependencies(tn)}function zn(Le){if(tn--,e.monitorRunDependencies&&e.monitorRunDependencies(tn),tn==0&&(bn!==null&&(clearInterval(bn),bn=null),_e)){var it=_e;_e=null,it()}}e.preloadedImages={},e.preloadedAudios={};var le=null,Z="data:application/octet-stream;base64,";function Te(Le){return String.prototype.startsWith?Le.startsWith(Z):Le.indexOf(Z)===0}var Pe,Ge;le="data:application/octet-stream;base64,AAAAAAAAAAAAAAAAAQAAAAIAAAADAAAABAAAAAUAAAAGAAAAAQAAAAQAAAADAAAABgAAAAUAAAACAAAAAAAAAAIAAAADAAAAAQAAAAQAAAAGAAAAAAAAAAUAAAADAAAABgAAAAQAAAAFAAAAAAAAAAEAAAACAAAABAAAAAUAAAAGAAAAAAAAAAIAAAADAAAAAQAAAAUAAAACAAAAAAAAAAEAAAADAAAABgAAAAQAAAAGAAAAAAAAAAUAAAACAAAAAQAAAAQAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAIAAAADAAAAAAAAAAAAAAACAAAAAAAAAAEAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAYAAAAAAAAABQAAAAAAAAAAAAAABAAAAAUAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAYAAAAAAAAABgAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAgAAAAMAAAAEAAAABQAAAAYAAAABAAAAAgAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAgAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAMAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAIAAAAEAAAABQAAAAYAAAAAAAAAAQAAAAIAAAADAAAABQAAAAYAAAAAAAAAAQAAAAIAAAADAAAABAAAAAYAAAAAAAAAAQAAAAIAAAADAAAABAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAgAAAAIAAAAAAAAAAAAAAAYAAAAAAAAAAwAAAAIAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAFAAAABAAAAAAAAAABAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAYAAAAAAAAABAAAAAAAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAgAAAAQAAAADAAAACAAAAAEAAAAHAAAABgAAAAkAAAAAAAAAAwAAAAIAAAACAAAABgAAAAoAAAALAAAAAAAAAAEAAAAFAAAAAwAAAA0AAAABAAAABwAAAAQAAAAMAAAAAAAAAAQAAAB/AAAADwAAAAgAAAADAAAAAAAAAAwAAAAFAAAAAgAAABIAAAAKAAAACAAAAAAAAAAQAAAABgAAAA4AAAALAAAAEQAAAAEAAAAJAAAAAgAAAAcAAAAVAAAACQAAABMAAAADAAAADQAAAAEAAAAIAAAABQAAABYAAAAQAAAABAAAAAAAAAAPAAAACQAAABMAAAAOAAAAFAAAAAEAAAAHAAAABgAAAAoAAAALAAAAGAAAABcAAAAFAAAAAgAAABIAAAALAAAAEQAAABcAAAAZAAAAAgAAAAYAAAAKAAAADAAAABwAAAANAAAAGgAAAAQAAAAPAAAAAwAAAA0AAAAaAAAAFQAAAB0AAAADAAAADAAAAAcAAAAOAAAAfwAAABEAAAAbAAAACQAAABQAAAAGAAAADwAAABYAAAAcAAAAHwAAAAQAAAAIAAAADAAAABAAAAASAAAAIQAAAB4AAAAIAAAABQAAABYAAAARAAAACwAAAA4AAAAGAAAAIwAAABkAAAAbAAAAEgAAABgAAAAeAAAAIAAAAAUAAAAKAAAAEAAAABMAAAAiAAAAFAAAACQAAAAHAAAAFQAAAAkAAAAUAAAADgAAABMAAAAJAAAAKAAAABsAAAAkAAAAFQAAACYAAAATAAAAIgAAAA0AAAAdAAAABwAAABYAAAAQAAAAKQAAACEAAAAPAAAACAAAAB8AAAAXAAAAGAAAAAsAAAAKAAAAJwAAACUAAAAZAAAAGAAAAH8AAAAgAAAAJQAAAAoAAAAXAAAAEgAAABkAAAAXAAAAEQAAAAsAAAAtAAAAJwAAACMAAAAaAAAAKgAAAB0AAAArAAAADAAAABwAAAANAAAAGwAAACgAAAAjAAAALgAAAA4AAAAUAAAAEQAAABwAAAAfAAAAKgAAACwAAAAMAAAADwAAABoAAAAdAAAAKwAAACYAAAAvAAAADQAAABoAAAAVAAAAHgAAACAAAAAwAAAAMgAAABAAAAASAAAAIQAAAB8AAAApAAAALAAAADUAAAAPAAAAFgAAABwAAAAgAAAAHgAAABgAAAASAAAANAAAADIAAAAlAAAAIQAAAB4AAAAxAAAAMAAAABYAAAAQAAAAKQAAACIAAAATAAAAJgAAABUAAAA2AAAAJAAAADMAAAAjAAAALgAAAC0AAAA4AAAAEQAAABsAAAAZAAAAJAAAABQAAAAiAAAAEwAAADcAAAAoAAAANgAAACUAAAAnAAAANAAAADkAAAAYAAAAFwAAACAAAAAmAAAAfwAAACIAAAAzAAAAHQAAAC8AAAAVAAAAJwAAACUAAAAZAAAAFwAAADsAAAA5AAAALQAAACgAAAAbAAAAJAAAABQAAAA8AAAALgAAADcAAAApAAAAMQAAADUAAAA9AAAAFgAAACEAAAAfAAAAKgAAADoAAAArAAAAPgAAABwAAAAsAAAAGgAAACsAAAA+AAAALwAAAEAAAAAaAAAAKgAAAB0AAAAsAAAANQAAADoAAABBAAAAHAAAAB8AAAAqAAAALQAAACcAAAAjAAAAGQAAAD8AAAA7AAAAOAAAAC4AAAA8AAAAOAAAAEQAAAAbAAAAKAAAACMAAAAvAAAAJgAAACsAAAAdAAAARQAAADMAAABAAAAAMAAAADEAAAAeAAAAIQAAAEMAAABCAAAAMgAAADEAAAB/AAAAPQAAAEIAAAAhAAAAMAAAACkAAAAyAAAAMAAAACAAAAAeAAAARgAAAEMAAAA0AAAAMwAAAEUAAAA2AAAARwAAACYAAAAvAAAAIgAAADQAAAA5AAAARgAAAEoAAAAgAAAAJQAAADIAAAA1AAAAPQAAAEEAAABLAAAAHwAAACkAAAAsAAAANgAAAEcAAAA3AAAASQAAACIAAAAzAAAAJAAAADcAAAAoAAAANgAAACQAAABIAAAAPAAAAEkAAAA4AAAARAAAAD8AAABNAAAAIwAAAC4AAAAtAAAAOQAAADsAAABKAAAATgAAACUAAAAnAAAANAAAADoAAAB/AAAAPgAAAEwAAAAsAAAAQQAAACoAAAA7AAAAPwAAAE4AAABPAAAAJwAAAC0AAAA5AAAAPAAAAEgAAABEAAAAUAAAACgAAAA3AAAALgAAAD0AAAA1AAAAMQAAACkAAABRAAAASwAAAEIAAAA+AAAAKwAAADoAAAAqAAAAUgAAAEAAAABMAAAAPwAAAH8AAAA4AAAALQAAAE8AAAA7AAAATQAAAEAAAAAvAAAAPgAAACsAAABUAAAARQAAAFIAAABBAAAAOgAAADUAAAAsAAAAVgAAAEwAAABLAAAAQgAAAEMAAABRAAAAVQAAADEAAAAwAAAAPQAAAEMAAABCAAAAMgAAADAAAABXAAAAVQAAAEYAAABEAAAAOAAAADwAAAAuAAAAWgAAAE0AAABQAAAARQAAADMAAABAAAAALwAAAFkAAABHAAAAVAAAAEYAAABDAAAANAAAADIAAABTAAAAVwAAAEoAAABHAAAAWQAAAEkAAABbAAAAMwAAAEUAAAA2AAAASAAAAH8AAABJAAAANwAAAFAAAAA8AAAAWAAAAEkAAABbAAAASAAAAFgAAAA2AAAARwAAADcAAABKAAAATgAAAFMAAABcAAAANAAAADkAAABGAAAASwAAAEEAAAA9AAAANQAAAF4AAABWAAAAUQAAAEwAAABWAAAAUgAAAGAAAAA6AAAAQQAAAD4AAABNAAAAPwAAAEQAAAA4AAAAXQAAAE8AAABaAAAATgAAAEoAAAA7AAAAOQAAAF8AAABcAAAATwAAAE8AAABOAAAAPwAAADsAAABdAAAAXwAAAE0AAABQAAAARAAAAEgAAAA8AAAAYwAAAFoAAABYAAAAUQAAAFUAAABeAAAAZQAAAD0AAABCAAAASwAAAFIAAABgAAAAVAAAAGIAAAA+AAAATAAAAEAAAABTAAAAfwAAAEoAAABGAAAAZAAAAFcAAABcAAAAVAAAAEUAAABSAAAAQAAAAGEAAABZAAAAYgAAAFUAAABXAAAAZQAAAGYAAABCAAAAQwAAAFEAAABWAAAATAAAAEsAAABBAAAAaAAAAGAAAABeAAAAVwAAAFMAAABmAAAAZAAAAEMAAABGAAAAVQAAAFgAAABIAAAAWwAAAEkAAABjAAAAUAAAAGkAAABZAAAAYQAAAFsAAABnAAAARQAAAFQAAABHAAAAWgAAAE0AAABQAAAARAAAAGoAAABdAAAAYwAAAFsAAABJAAAAWQAAAEcAAABpAAAAWAAAAGcAAABcAAAAUwAAAE4AAABKAAAAbAAAAGQAAABfAAAAXQAAAE8AAABaAAAATQAAAG0AAABfAAAAagAAAF4AAABWAAAAUQAAAEsAAABrAAAAaAAAAGUAAABfAAAAXAAAAE8AAABOAAAAbQAAAGwAAABdAAAAYAAAAGgAAABiAAAAbgAAAEwAAABWAAAAUgAAAGEAAAB/AAAAYgAAAFQAAABnAAAAWQAAAG8AAABiAAAAbgAAAGEAAABvAAAAUgAAAGAAAABUAAAAYwAAAFAAAABpAAAAWAAAAGoAAABaAAAAcQAAAGQAAABmAAAAUwAAAFcAAABsAAAAcgAAAFwAAABlAAAAZgAAAGsAAABwAAAAUQAAAFUAAABeAAAAZgAAAGUAAABXAAAAVQAAAHIAAABwAAAAZAAAAGcAAABbAAAAYQAAAFkAAAB0AAAAaQAAAG8AAABoAAAAawAAAG4AAABzAAAAVgAAAF4AAABgAAAAaQAAAFgAAABnAAAAWwAAAHEAAABjAAAAdAAAAGoAAABdAAAAYwAAAFoAAAB1AAAAbQAAAHEAAABrAAAAfwAAAGUAAABeAAAAcwAAAGgAAABwAAAAbAAAAGQAAABfAAAAXAAAAHYAAAByAAAAbQAAAG0AAABsAAAAXQAAAF8AAAB1AAAAdgAAAGoAAABuAAAAYgAAAGgAAABgAAAAdwAAAG8AAABzAAAAbwAAAGEAAABuAAAAYgAAAHQAAABnAAAAdwAAAHAAAABrAAAAZgAAAGUAAAB4AAAAcwAAAHIAAABxAAAAYwAAAHQAAABpAAAAdQAAAGoAAAB5AAAAcgAAAHAAAABkAAAAZgAAAHYAAAB4AAAAbAAAAHMAAABuAAAAawAAAGgAAAB4AAAAdwAAAHAAAAB0AAAAZwAAAHcAAABvAAAAcQAAAGkAAAB5AAAAdQAAAH8AAABtAAAAdgAAAHEAAAB5AAAAagAAAHYAAAB4AAAAbAAAAHIAAAB1AAAAeQAAAG0AAAB3AAAAbwAAAHMAAABuAAAAeQAAAHQAAAB4AAAAeAAAAHMAAAByAAAAcAAAAHkAAAB3AAAAdgAAAHkAAAB0AAAAeAAAAHcAAAB1AAAAcQAAAHYAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAABAAAABQAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAACAAAABQAAAAEAAAAAAAAA/////wEAAAAAAAAAAwAAAAQAAAACAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAFAAAAAQAAAAAAAAAAAAAAAQAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAADAAAAAAAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAADAAAABQAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAEAAAABQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAABAAAAAwAAAAAAAAAAAAAAAQAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAQAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAADAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAFAAAABQAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAwAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAADAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAAAAAD/////AwAAAAAAAAAFAAAAAgAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAADAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAAAAAABAAAAAwAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAADAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAADAAAAAwAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAUAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAwAAAAAAAAAAAAAA/////wMAAAAAAAAABQAAAAIAAAAAAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAwAAAAAAAAADAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAMAAAADAAAAAwAAAAMAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAwAAAAUAAAABAAAAAAAAAP////8DAAAAAAAAAAUAAAACAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAABAAAAAUAAAABAAAAAAAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAIAAAAFAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAADAAAAAQAAAAAAAAABAAAAAAAAAAUAAAAAAAAAAAAAAAUAAAAFAAAAAAAAAAAAAAD/////AQAAAAAAAAADAAAABAAAAAIAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAUAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAFAAAAAAAAAAAAAAAFAAAABQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAUAAAABAAAAAAAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAEAAAD//////////wEAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAADAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAACAAAAAAAAAAAAAAABAAAAAgAAAAYAAAAEAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAcAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAKAAAAAgAAAAAAAAAAAAAAAQAAAAEAAAAFAAAABgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAABwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAACAAAAAAAAAAAAAAABAAAAAwAAAAcAAAAGAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAABwAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAADgAAAAIAAAAAAAAAAAAAAAEAAAAAAAAACQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAMAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAABwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAIAAAAAAAAAAAAAAAEAAAAEAAAACAAAAAoAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAALAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAACQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAAgAAAAAAAAAAAAAAAQAAAAsAAAAPAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAOAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAIAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAABQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAgAAAAAAAAAAAAAAAQAAAAwAAAAQAAAADAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAoAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAPAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAADwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAACAAAAAAAAAAAAAAABAAAACgAAABMAAAAIAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAA8AAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAQAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAACQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAIAAAAAAAAAAAAAAAEAAAANAAAAEQAAAA0AAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAARAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAA0AAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAAAACAAAAAAAAAAAAAAABAAAADgAAABIAAAAPAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAADwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAASAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEwAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAABEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEgAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAABIAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAATAAAAAgAAAAAAAAAAAAAAAQAAAP//////////EwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAEgAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAASAAAAAAAAABgAAAAAAAAAIQAAAAAAAAAeAAAAAAAAACAAAAADAAAAMQAAAAEAAAAwAAAAAwAAADIAAAADAAAACAAAAAAAAAAFAAAABQAAAAoAAAAFAAAAFgAAAAAAAAAQAAAAAAAAABIAAAAAAAAAKQAAAAEAAAAhAAAAAAAAAB4AAAAAAAAABAAAAAAAAAAAAAAABQAAAAIAAAAFAAAADwAAAAEAAAAIAAAAAAAAAAUAAAAFAAAAHwAAAAEAAAAWAAAAAAAAABAAAAAAAAAAAgAAAAAAAAAGAAAAAAAAAA4AAAAAAAAACgAAAAAAAAALAAAAAAAAABEAAAADAAAAGAAAAAEAAAAXAAAAAwAAABkAAAADAAAAAAAAAAAAAAABAAAABQAAAAkAAAAFAAAABQAAAAAAAAACAAAAAAAAAAYAAAAAAAAAEgAAAAEAAAAKAAAAAAAAAAsAAAAAAAAABAAAAAEAAAADAAAABQAAAAcAAAAFAAAACAAAAAEAAAAAAAAAAAAAAAEAAAAFAAAAEAAAAAEAAAAFAAAAAAAAAAIAAAAAAAAABwAAAAAAAAAVAAAAAAAAACYAAAAAAAAACQAAAAAAAAATAAAAAAAAACIAAAADAAAADgAAAAEAAAAUAAAAAwAAACQAAAADAAAAAwAAAAAAAAANAAAABQAAAB0AAAAFAAAAAQAAAAAAAAAHAAAAAAAAABUAAAAAAAAABgAAAAEAAAAJAAAAAAAAABMAAAAAAAAABAAAAAIAAAAMAAAABQAAABoAAAAFAAAAAAAAAAEAAAADAAAAAAAAAA0AAAAFAAAAAgAAAAEAAAABAAAAAAAAAAcAAAAAAAAAGgAAAAAAAAAqAAAAAAAAADoAAAAAAAAAHQAAAAAAAAArAAAAAAAAAD4AAAADAAAAJgAAAAEAAAAvAAAAAwAAAEAAAAADAAAADAAAAAAAAAAcAAAABQAAACwAAAAFAAAADQAAAAAAAAAaAAAAAAAAACoAAAAAAAAAFQAAAAEAAAAdAAAAAAAAACsAAAAAAAAABAAAAAMAAAAPAAAABQAAAB8AAAAFAAAAAwAAAAEAAAAMAAAAAAAAABwAAAAFAAAABwAAAAEAAAANAAAAAAAAABoAAAAAAAAAHwAAAAAAAAApAAAAAAAAADEAAAAAAAAALAAAAAAAAAA1AAAAAAAAAD0AAAADAAAAOgAAAAEAAABBAAAAAwAAAEsAAAADAAAADwAAAAAAAAAWAAAABQAAACEAAAAFAAAAHAAAAAAAAAAfAAAAAAAAACkAAAAAAAAAKgAAAAEAAAAsAAAAAAAAADUAAAAAAAAABAAAAAQAAAAIAAAABQAAABAAAAAFAAAADAAAAAEAAAAPAAAAAAAAABYAAAAFAAAAGgAAAAEAAAAcAAAAAAAAAB8AAAAAAAAAMgAAAAAAAAAwAAAAAAAAADEAAAADAAAAIAAAAAAAAAAeAAAAAwAAACEAAAADAAAAGAAAAAMAAAASAAAAAwAAABAAAAADAAAARgAAAAAAAABDAAAAAAAAAEIAAAADAAAANAAAAAMAAAAyAAAAAAAAADAAAAAAAAAAJQAAAAMAAAAgAAAAAAAAAB4AAAADAAAAUwAAAAAAAABXAAAAAwAAAFUAAAADAAAASgAAAAMAAABGAAAAAAAAAEMAAAAAAAAAOQAAAAEAAAA0AAAAAwAAADIAAAAAAAAAGQAAAAAAAAAXAAAAAAAAABgAAAADAAAAEQAAAAAAAAALAAAAAwAAAAoAAAADAAAADgAAAAMAAAAGAAAAAwAAAAIAAAADAAAALQAAAAAAAAAnAAAAAAAAACUAAAADAAAAIwAAAAMAAAAZAAAAAAAAABcAAAAAAAAAGwAAAAMAAAARAAAAAAAAAAsAAAADAAAAPwAAAAAAAAA7AAAAAwAAADkAAAADAAAAOAAAAAMAAAAtAAAAAAAAACcAAAAAAAAALgAAAAMAAAAjAAAAAwAAABkAAAAAAAAAJAAAAAAAAAAUAAAAAAAAAA4AAAADAAAAIgAAAAAAAAATAAAAAwAAAAkAAAADAAAAJgAAAAMAAAAVAAAAAwAAAAcAAAADAAAANwAAAAAAAAAoAAAAAAAAABsAAAADAAAANgAAAAMAAAAkAAAAAAAAABQAAAAAAAAAMwAAAAMAAAAiAAAAAAAAABMAAAADAAAASAAAAAAAAAA8AAAAAwAAAC4AAAADAAAASQAAAAMAAAA3AAAAAAAAACgAAAAAAAAARwAAAAMAAAA2AAAAAwAAACQAAAAAAAAAQAAAAAAAAAAvAAAAAAAAACYAAAADAAAAPgAAAAAAAAArAAAAAwAAAB0AAAADAAAAOgAAAAMAAAAqAAAAAwAAABoAAAADAAAAVAAAAAAAAABFAAAAAAAAADMAAAADAAAAUgAAAAMAAABAAAAAAAAAAC8AAAAAAAAATAAAAAMAAAA+AAAAAAAAACsAAAADAAAAYQAAAAAAAABZAAAAAwAAAEcAAAADAAAAYgAAAAMAAABUAAAAAAAAAEUAAAAAAAAAYAAAAAMAAABSAAAAAwAAAEAAAAAAAAAASwAAAAAAAABBAAAAAAAAADoAAAADAAAAPQAAAAAAAAA1AAAAAwAAACwAAAADAAAAMQAAAAMAAAApAAAAAwAAAB8AAAADAAAAXgAAAAAAAABWAAAAAAAAAEwAAAADAAAAUQAAAAMAAABLAAAAAAAAAEEAAAAAAAAAQgAAAAMAAAA9AAAAAAAAADUAAAADAAAAawAAAAAAAABoAAAAAwAAAGAAAAADAAAAZQAAAAMAAABeAAAAAAAAAFYAAAAAAAAAVQAAAAMAAABRAAAAAwAAAEsAAAAAAAAAOQAAAAAAAAA7AAAAAAAAAD8AAAADAAAASgAAAAAAAABOAAAAAwAAAE8AAAADAAAAUwAAAAMAAABcAAAAAwAAAF8AAAADAAAAJQAAAAAAAAAnAAAAAwAAAC0AAAADAAAANAAAAAAAAAA5AAAAAAAAADsAAAAAAAAARgAAAAMAAABKAAAAAAAAAE4AAAADAAAAGAAAAAAAAAAXAAAAAwAAABkAAAADAAAAIAAAAAMAAAAlAAAAAAAAACcAAAADAAAAMgAAAAMAAAA0AAAAAAAAADkAAAAAAAAALgAAAAAAAAA8AAAAAAAAAEgAAAADAAAAOAAAAAAAAABEAAAAAwAAAFAAAAADAAAAPwAAAAMAAABNAAAAAwAAAFoAAAADAAAAGwAAAAAAAAAoAAAAAwAAADcAAAADAAAAIwAAAAAAAAAuAAAAAAAAADwAAAAAAAAALQAAAAMAAAA4AAAAAAAAAEQAAAADAAAADgAAAAAAAAAUAAAAAwAAACQAAAADAAAAEQAAAAMAAAAbAAAAAAAAACgAAAADAAAAGQAAAAMAAAAjAAAAAAAAAC4AAAAAAAAARwAAAAAAAABZAAAAAAAAAGEAAAADAAAASQAAAAAAAABbAAAAAwAAAGcAAAADAAAASAAAAAMAAABYAAAAAwAAAGkAAAADAAAAMwAAAAAAAABFAAAAAwAAAFQAAAADAAAANgAAAAAAAABHAAAAAAAAAFkAAAAAAAAANwAAAAMAAABJAAAAAAAAAFsAAAADAAAAJgAAAAAAAAAvAAAAAwAAAEAAAAADAAAAIgAAAAMAAAAzAAAAAAAAAEUAAAADAAAAJAAAAAMAAAA2AAAAAAAAAEcAAAAAAAAAYAAAAAAAAABoAAAAAAAAAGsAAAADAAAAYgAAAAAAAABuAAAAAwAAAHMAAAADAAAAYQAAAAMAAABvAAAAAwAAAHcAAAADAAAATAAAAAAAAABWAAAAAwAAAF4AAAADAAAAUgAAAAAAAABgAAAAAAAAAGgAAAAAAAAAVAAAAAMAAABiAAAAAAAAAG4AAAADAAAAOgAAAAAAAABBAAAAAwAAAEsAAAADAAAAPgAAAAMAAABMAAAAAAAAAFYAAAADAAAAQAAAAAMAAABSAAAAAAAAAGAAAAAAAAAAVQAAAAAAAABXAAAAAAAAAFMAAAADAAAAZQAAAAAAAABmAAAAAwAAAGQAAAADAAAAawAAAAMAAABwAAAAAwAAAHIAAAADAAAAQgAAAAAAAABDAAAAAwAAAEYAAAADAAAAUQAAAAAAAABVAAAAAAAAAFcAAAAAAAAAXgAAAAMAAABlAAAAAAAAAGYAAAADAAAAMQAAAAAAAAAwAAAAAwAAADIAAAADAAAAPQAAAAMAAABCAAAAAAAAAEMAAAADAAAASwAAAAMAAABRAAAAAAAAAFUAAAAAAAAAXwAAAAAAAABcAAAAAAAAAFMAAAAAAAAATwAAAAAAAABOAAAAAAAAAEoAAAADAAAAPwAAAAEAAAA7AAAAAwAAADkAAAADAAAAbQAAAAAAAABsAAAAAAAAAGQAAAAFAAAAXQAAAAEAAABfAAAAAAAAAFwAAAAAAAAATQAAAAEAAABPAAAAAAAAAE4AAAAAAAAAdQAAAAQAAAB2AAAABQAAAHIAAAAFAAAAagAAAAEAAABtAAAAAAAAAGwAAAAAAAAAWgAAAAEAAABdAAAAAQAAAF8AAAAAAAAAWgAAAAAAAABNAAAAAAAAAD8AAAAAAAAAUAAAAAAAAABEAAAAAAAAADgAAAADAAAASAAAAAEAAAA8AAAAAwAAAC4AAAADAAAAagAAAAAAAABdAAAAAAAAAE8AAAAFAAAAYwAAAAEAAABaAAAAAAAAAE0AAAAAAAAAWAAAAAEAAABQAAAAAAAAAEQAAAAAAAAAdQAAAAMAAABtAAAABQAAAF8AAAAFAAAAcQAAAAEAAABqAAAAAAAAAF0AAAAAAAAAaQAAAAEAAABjAAAAAQAAAFoAAAAAAAAAaQAAAAAAAABYAAAAAAAAAEgAAAAAAAAAZwAAAAAAAABbAAAAAAAAAEkAAAADAAAAYQAAAAEAAABZAAAAAwAAAEcAAAADAAAAcQAAAAAAAABjAAAAAAAAAFAAAAAFAAAAdAAAAAEAAABpAAAAAAAAAFgAAAAAAAAAbwAAAAEAAABnAAAAAAAAAFsAAAAAAAAAdQAAAAIAAABqAAAABQAAAFoAAAAFAAAAeQAAAAEAAABxAAAAAAAAAGMAAAAAAAAAdwAAAAEAAAB0AAAAAQAAAGkAAAAAAAAAdwAAAAAAAABvAAAAAAAAAGEAAAAAAAAAcwAAAAAAAABuAAAAAAAAAGIAAAADAAAAawAAAAEAAABoAAAAAwAAAGAAAAADAAAAeQAAAAAAAAB0AAAAAAAAAGcAAAAFAAAAeAAAAAEAAAB3AAAAAAAAAG8AAAAAAAAAcAAAAAEAAABzAAAAAAAAAG4AAAAAAAAAdQAAAAEAAABxAAAABQAAAGkAAAAFAAAAdgAAAAEAAAB5AAAAAAAAAHQAAAAAAAAAcgAAAAEAAAB4AAAAAQAAAHcAAAAAAAAAcgAAAAAAAABwAAAAAAAAAGsAAAAAAAAAZAAAAAAAAABmAAAAAAAAAGUAAAADAAAAUwAAAAEAAABXAAAAAwAAAFUAAAADAAAAdgAAAAAAAAB4AAAAAAAAAHMAAAAFAAAAbAAAAAEAAAByAAAAAAAAAHAAAAAAAAAAXAAAAAEAAABkAAAAAAAAAGYAAAAAAAAAdQAAAAAAAAB5AAAABQAAAHcAAAAFAAAAbQAAAAEAAAB2AAAAAAAAAHgAAAAAAAAAXwAAAAEAAABsAAAAAQAAAHIAAAAAAAAAGC1EVPsh+T8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABgtRFT7Ifk/GC1EVPsh+T8AAAAAAAAAAAAAAAAAAAAAGC1EVPsh+T8AAAAAAAAAABgtRFT7IQlAGC1EVPsh+T8AAAAAAAAAAAAAAAAAAAAAGC1EVPshCUAAAAAAAAAAABgtRFT7Ifm/GC1EVPsh+T8AAAAAAAAAAAAAAAAAAAAAGC1EVPsh+b8AAAAAAAAAAAAAAAAAAAAAGC1EVPsh+b8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABgtRFT7Ifm/GC1EVPsh+b8AAAAAAAAAAAAAAAAAAAAAGC1EVPsh+b8AAAAAAAAAABgtRFT7IQnAGC1EVPsh+b8AAAAAAAAAAAAAAAAAAAAAGC1EVPshCcAAAAAAAAAAABgtRFT7Ifk/GC1EVPsh+b8AAAAAAAAAAAAAAAAAAAAAGC1EVPsh+T8AAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAGAAAAAgAAAAUAAAABAAAABAAAAAAAAAAAAAAABQAAAAMAAAABAAAABgAAAAQAAAACAAAAAAAAAMpi5RexJsw/BlIKPVwR5T95Wyu0/QjnP5PjoT7YYcu/mBhKZ6zrwj8wRYS7NebuP3qW6geh+Ls/SLrixebL3r+pcyymN9XrPwmkNHp7xec/GWNMZVAA17+82s+x2BLiPwn2ytbJ9ek/LgEH1sMS1j8yp/2LhTfeP+SnWwtQBbu/d38gkp5X7z8ytsuHaADGPzUYObdf1+m/7IauECWhwz+cjSACjzniP76Z+wUhN9K/1+GEKzup67+/GYr/04baPw6idWOvsuc/ZedTWsRa5b/EJQOuRzi0v/OncYhHPes/h49PixY53j+i8wWfC03Nvw2idWOvsue/ZedTWsRa5T/EJQOuRzi0P/KncYhHPeu/iY9PixY53r+i8wWfC03NP9anWwtQBbs/d38gkp5X778ytsuHaADGvzUYObdf1+k/74auECWhw7+cjSACjzniv8CZ+wUhN9I/1uGEKzup6z+/GYr/04bavwmkNHp7xee/F2NMZVAA1z+82s+x2BLivwr2ytbJ9em/KwEH1sMS1r8yp/2LhTfev81i5RexJsy/BlIKPVwR5b95Wyu0/Qjnv5DjoT7YYcs/nBhKZ6zrwr8wRYS7Nebuv3OW6geh+Lu/SLrixebL3j+pcyymN9Xrv8rHIFfWehZAMBwUdlo0DECTUc17EOb2PxpVB1SWChdAzjbhb9pTDUDQhmdvECX5P9FlMKCC9+g/IIAzjELgE0DajDngMv8GQFhWDmDPjNs/y1guLh96EkAxPi8k7DIEQJCc4URlhRhA3eLKKLwkEECqpNAyTBD/P6xpjXcDiwVAFtl//cQm4z+Ibt3XKiYTQM7mCLUb3QdAoM1t8yVv7D8aLZv2Nk8UQEAJPV5nQwxAtSsfTCoE9z9TPjXLXIIWQBVanC5W9AtAYM3d7Adm9j++5mQz1FoWQBUThyaVBghAwH5muQsV7T89Q1qv82MUQJoWGOfNuBdAzrkClkmwDkDQjKq77t37Py+g0dtitsE/ZwAMTwVPEUBojepluNwBQGYbtuW+t9w/HNWIJs6MEkDTNuQUSlgEQKxktPP5TcQ/ixbLB8JjEUCwuWjXMQYCQAS/R09FkRdAowpiZjhhDkB7LmlczD/7P01iQmhhsAVAnrtTwDy84z/Z6jfQ2TgTQChOCXMnWwpAhrW3daoz8z/HYJvVPI4VQLT3ik5FcA5Angi7LOZd+z+NNVzDy5gXQBXdvVTFUA1AYNMgOeYe+T8+qHXGCwkXQKQTOKwa5AJA8gFVoEMW0T+FwzJyttIRQAEAAAD/////BwAAAP////8xAAAA/////1cBAAD/////YQkAAP////+nQQAA/////5HLAQD/////95AMAP/////B9lcAAAAAAAAAAAAAAAAAAgAAAP////8OAAAA/////2IAAAD/////rgIAAP/////CEgAA/////06DAAD/////IpcDAP/////uIRkA/////4LtrwAAAAAAAAAAAAAAAAAAAAAAAgAAAP//////////AQAAAAMAAAD//////////////////////////////////////////////////////////////////////////wEAAAAAAAAAAgAAAP///////////////wMAAAD//////////////////////////////////////////////////////////////////////////wEAAAAAAAAAAgAAAP///////////////wMAAAD//////////////////////////////////////////////////////////////////////////wEAAAAAAAAAAgAAAP///////////////wMAAAD//////////////////////////////////////////////////////////wIAAAD//////////wEAAAAAAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAA/////////////////////wEAAAD///////////////8CAAAA////////////////////////////////AwAAAP////////////////////8AAAAA////////////////AgAAAAEAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAA////////////////AgAAAAEAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAA////////////////AgAAAAEAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAA////////////////AgAAAAEAAAD/////////////////////////////////////////////////////AQAAAAIAAAD///////////////8AAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AQAAAAIAAAD///////////////8AAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AQAAAAIAAAD///////////////8AAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AQAAAAIAAAD///////////////8AAAAA/////////////////////wMAAAD///////////////////////////////8CAAAA////////////////AQAAAP////////////////////8AAAAA/////////////////////wMAAAD/////////////////////////////////////////////////////AwAAAP////////////////////8AAAAAAQAAAP//////////AgAAAP//////////////////////////////////////////////////////////AwAAAP///////////////wIAAAAAAAAAAQAAAP//////////////////////////////////////////////////////////////////////////AwAAAP///////////////wIAAAAAAAAAAQAAAP//////////////////////////////////////////////////////////////////////////AwAAAP///////////////wIAAAAAAAAAAQAAAP//////////////////////////////////////////////////////////////////////////AwAAAAEAAAD//////////wIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAgAAAAAAAAACAAAAAQAAAAEAAAACAAAAAgAAAAAAAAAFAAAABQAAAAAAAAACAAAAAgAAAAMAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAIAAAABAAAAAgAAAAIAAAACAAAAAAAAAAUAAAAGAAAAAAAAAAIAAAACAAAAAwAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAIAAAAAAAAAAgAAAAEAAAADAAAAAgAAAAIAAAAAAAAABQAAAAcAAAAAAAAAAgAAAAIAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAgAAAAAAAAACAAAAAQAAAAQAAAACAAAAAgAAAAAAAAAFAAAACAAAAAAAAAACAAAAAgAAAAMAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAACAAAAAAAAAAIAAAABAAAAAAAAAAIAAAACAAAAAAAAAAUAAAAJAAAAAAAAAAIAAAACAAAAAwAAAAUAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAIAAAACAAAAAAAAAAMAAAAOAAAAAgAAAAAAAAACAAAAAwAAAAAAAAAAAAAAAgAAAAIAAAADAAAABgAAAAAAAAAAAAAAAAAAAAAAAAALAAAAAgAAAAIAAAAAAAAAAwAAAAoAAAACAAAAAAAAAAIAAAADAAAAAQAAAAAAAAACAAAAAgAAAAMAAAAHAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAACAAAAAgAAAAAAAAADAAAACwAAAAIAAAAAAAAAAgAAAAMAAAACAAAAAAAAAAIAAAACAAAAAwAAAAgAAAAAAAAAAAAAAAAAAAAAAAAADQAAAAIAAAACAAAAAAAAAAMAAAAMAAAAAgAAAAAAAAACAAAAAwAAAAMAAAAAAAAAAgAAAAIAAAADAAAACQAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAgAAAAIAAAAAAAAAAwAAAA0AAAACAAAAAAAAAAIAAAADAAAABAAAAAAAAAACAAAAAgAAAAMAAAAKAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAACAAAAAgAAAAAAAAADAAAABgAAAAIAAAAAAAAAAgAAAAMAAAAPAAAAAAAAAAIAAAACAAAAAwAAAAsAAAAAAAAAAAAAAAAAAAAAAAAABgAAAAIAAAACAAAAAAAAAAMAAAAHAAAAAgAAAAAAAAACAAAAAwAAABAAAAAAAAAAAgAAAAIAAAADAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAgAAAAIAAAAAAAAAAwAAAAgAAAACAAAAAAAAAAIAAAADAAAAEQAAAAAAAAACAAAAAgAAAAMAAAANAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAACAAAAAgAAAAAAAAADAAAACQAAAAIAAAAAAAAAAgAAAAMAAAASAAAAAAAAAAIAAAACAAAAAwAAAA4AAAAAAAAAAAAAAAAAAAAAAAAACQAAAAIAAAACAAAAAAAAAAMAAAAFAAAAAgAAAAAAAAACAAAAAwAAABMAAAAAAAAAAgAAAAIAAAADAAAADwAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAgAAAAAAAAACAAAAAQAAABMAAAACAAAAAgAAAAAAAAAFAAAACgAAAAAAAAACAAAAAgAAAAMAAAAQAAAAAAAAAAAAAAAAAAAAAAAAABEAAAACAAAAAAAAAAIAAAABAAAADwAAAAIAAAACAAAAAAAAAAUAAAALAAAAAAAAAAIAAAACAAAAAwAAABEAAAAAAAAAAAAAAAAAAAAAAAAAEgAAAAIAAAAAAAAAAgAAAAEAAAAQAAAAAgAAAAIAAAAAAAAABQAAAAwAAAAAAAAAAgAAAAIAAAADAAAAEgAAAAAAAAAAAAAAAAAAAAAAAAATAAAAAgAAAAAAAAACAAAAAQAAABEAAAACAAAAAgAAAAAAAAAFAAAADQAAAAAAAAACAAAAAgAAAAMAAAATAAAAAAAAAAAAAAAAAAAAAAAAAA8AAAACAAAAAAAAAAIAAAABAAAAEgAAAAIAAAACAAAAAAAAAAUAAAAOAAAAAAAAAAIAAAACAAAAAwAAAAIAAAABAAAAAAAAAAEAAAACAAAAAAAAAAAAAAACAAAAAQAAAAAAAAABAAAAAgAAAAEAAAAAAAAAAgAAAAAAAAAFAAAABAAAAAAAAAABAAAABQAAAAAAAAAAAAAABQAAAAQAAAAAAAAAAQAAAAUAAAAEAAAAAAAAAAUAAAAAAAAAAgAAAAEAAAAAAAAAAQAAAAIAAAAAAAAAAAAAAAIAAAABAAAAAAAAAAEAAAACAAAAAQAAAAAAAAACAAAAAgAAAAAAAAABAAAAAAAAAAAAAAAFAAAABAAAAAAAAAABAAAABQAAAAAAAAAAAAAABQAAAAQAAAAAAAAAAQAAAAUAAAAEAAAAAAAAAAUAAAAFAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAQAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAABAAAAAAAAAAABAAAAAAEAAAAAAAAAAAEAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAQAAAAAAAAAAAAEAAAAAAAAAAAAAOgehWlKfUEEz1zLi+JsiQa2og3wcMfVAWCbHorc0yEDi+Yn/Y6mbQJ11/mfsnG9At6bnG4UQQkBvMCQWKqUUQJVmwwswmOc/3hVgVBL3uj//qqOEOdGOPw/WDN4gnGE/H3ANkCUgND+AA8btKgAHPwTXBqJVSdo+XfRQAqsKrj4fc+zLYbSPQklEmCZHv2FCUP+uDso1NEKYtPhwphUHQptxnyFXYdpB7CddZAMmrkGAt1AxSTqBQUibBVdTsFNBSuX3MV+AJkFocv82SLf5QAqmgj7AY81A23VDSEnLoEDGEJVSeDFzQDYrqvBk70VA8U157pcRGUBWfEF+ZKbsP6phvycGBZRAJbod0OgwfkCp+L8jatBmQCjl3pGrPlFAfMWm114SOkButwtqS7UjQHQwbcjXyw1A8jnLuuyA9j9KwjL0VwHhPyotk0lcs8k/Q5PvEs9rsz+SfsOQEVqdPzUAKDojLoY/WJz/kcjCcD8YFu070FRZPyoLC2BdJEM/YOXQAuiMM0HIBz1bw3sdQdV46aaHRwZByatzjDPX8EDb3Jie8HXZQCJxj6ULP8NAUaG6uRAZrUCWdmou5/mVQLb9huRPm4BAhvoCHygZaUCuX/I3SPdSQC9/bC/1qTxAfKxsYQ6pJUCuslH+N14QQMS/cv7SvPg/Ol8maYKx4j8AAAAA/////wAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////////////////////////////wAAAAD/////AAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAA/////wAAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAP////8AAAAABQAAAAAAAAAAAAAAAAAAAAAAAAD/////BQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAA/////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////////////////////////////8AAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////////////////////////////AAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAABQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////////////////////////////wAAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAABAAAAAQAAAAAAAAABAAAAAAAAAAUAAAABAAAAAQAAAAAAAAAAAAAAAQAAAAEAAAAAAAAAAQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAEAAQAAAQEAAAAAAAEAAAABAAAAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAAAAAABAAAAAQAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAKriWFiWZfg/Y2nmTbY/8z8MHSPSqmnjv6hnn18HR3c/quJYWJZl+D/jq5TzDdzyPwwdI9KqaeO/u0kC1eFSBECq4lhYlmX4P69pJmt7c/E/NnkJi6jSBsDESFlzKkr6P33ArMz7sfY/o2q2uqM08D+oZ59fB0d3PzEqCi3qrvK/kmm4ANp49D+4wS2wzhzvP9WJvyAnx+E/upcY75RVx7+95t+9y0T1P9L18g1caO0/k6CkRyVzAEBf99+e/GjxP6QMsuuLQ/U/PlP4Qr8q7j8Mb/GO2GMCwLl2K/DQIghAePiwytEp9D9UHrsuI/nqPzjMedJ+yuy/k6xgf58n/L+XoQtn22DzP2lzCnsYk+s/JhUSDI4P8z+8lFcBhgTcPxOqKRxEX/M/89MEdoPQ6j8OKQaXDob7vzWwNvblgAPAzGkxMcl88j9Nm4okPkbpP0vI89vxSgRAdac2Z6W2/T+6UFOMC3zyP/+2XEF3hug/QqhELwGKCMAwdlQerEoEQFcr/B+VnvE/hB1hfFzT5j8wdsE/Da64P0hIvnF/sOC/KH/hrXUg8T9bI5OQHaLlP+mYzla7td6/CtKG6iOm8b8FW3TV8oXwP8ORhtNuJ+c/q8JrTMz/AcC8PaUl+PUFwAXv9rkMT/A/m+sAswr15D+7hk/O3yvkP6c/yVsOHKI/qqAX9idJ8D/8hNz1KNPiP7xSXh3Ggvg/epbkiKr57T/23/LB1GLvP4GTTeNZi+M/W4TqlTheBcDupZgIdYUIQGwlcW3YZO8/tQvDXQ3H4j8Bt+sf9DkAQMdFie+nNvg/Z5Uh1wDX7j9h5X2d4KjhPxMJ1ZVT4Pa/evqB8xB//7+W183U9QLsPwzNxsC7AOA/af/LqCnK/r/lPceQ0FQDwHoY0nYIW+w/bHNSHrTg4D/DFcMAdabuv2sz5Ojhnve/FvLf01HN6z/tEDL2Hz/gP0bBv0KUhPA/pd7sEnMc4D8EGon4Lo7sP5NVbYtSON8/DAMC50odBkB+Z2J8MGYCQIhlM1gubOo/FssiPwWy4D8OIlGqRnkCQAd1vopp6f4/QS1keLLK6T9rfoBuT7LZP3KQbH5ugwjAjqVPXTmbBUBL/JxcqR3qP3oSeovuktg/Y6pRhJmqy7+0kwuU0Yjmv2wvsfFmQ+g/R98lJFqQ2T/IGb5gjLkCwK3mNff3kQbAqDznPFM86T+iiP0FfsvYP7fzKG6Mls0/h7+at2btzL8tsUTgk+LmP/YEIrTDINU/WmwKoVjA5L9aC02r6FHxvzzFCT/Qg+Y/nx0V97en0j8+1toJOm77P1kZ7h8KjfQ/GBbbqxgk5j9RGXM79G/SP+beHsWmweQ/9REi4eX0xD/V9s+kmMHkP+pb9yNs09A/c5ERjVDTAECqEr3OBCH7P14ILfMECOU/piRx4P8P0j+JYU//bfL0Pw62fw28B+w/l5YW2Ga45D9+CyKRbenOP5cH6fHy1/S/o/egk03++r91nTYRL/bjP3fHN6OJVdA/7xXQh1XLBcAB3g6tBdUIQKW2KnGYjeQ/SqIpagclyz8F9P3YgNL6v9H6NBsZ8QDAW2k5L5Qs4z/0axa1l6zLP1GE65Mu4wNAwfX+BYmWAEBBgJP90M3hP6/03qhPLdA/zqo5bJz2778/ESlPCTn1v7JkhGyvzuE/DM7sj5twwz/6xbXLavYGQH29RFRGkgNA7bOXVSJ54T9fEhTHO/TDP+8t+HMOiwDAxa0SbGTtA8Atii7y0mLgP4cecHFB3sM/uPUpyv+K7j8nktD1/WvhP2cWmi772d8/Fj7uU9kEvD8oKOESLzKmvwSdCqrHdNu/XCluGsvI3T929OW5md+uP9dP6rXcZNq/gXM+ggzL6b+eKjsPgJncP6i1e9aVu7E/2CnPNJyD1D/DnyGgSe+xvy8k7g9bp9s/nYmLvHn1sz9cFOwApH8IwGa6Mjy9cgZAJr95SiSW2z8rCkhOFvqdP3SIKmO/UwPAEy0zkN7bBsCds8Hg/13YP1zv413hVGi/FVtqixSn6L9XAPQGul3yv7SGu2BoCNk/n94bv7Maj79p13T6X9z3P45MPCW3WvI/rU/8/LRj1T9cgR6SXd+ZPymL2DstbPI/8s/pAkIz6z/fmoB+8efYPz2XyfWgYaa/6wys72AW/j8LZImhgrf3P729Zla/n9U/ySB8B3PBqL8O2nhevvbxv17+5A+n6fe/YrGIqEGB1T+wCEGbkhaxv989QHVE5wFAzd12PTu3/T9AHUPZY2DUP3SQDST0zq2/JCxAlIoj5T+Mhe1IJkrQP/cRpl8QhtU/amc4seFts79khiUSVaz3vxYfWtjPwf2/CHscxQqD0j/ctUBQ9my3v0POnFiyXv2/pjjn2Ju/AcDk45DwBhPRP/GjwlCrv7m/aT2ciwolBsAQOzHr/wUJQCzpq5UYvtI/gDCf3SlCwb+4i7S+mukEQBDA1f8mowFA2utnRN3KyT9T+9EYAVG6v9/IVZ0enrE/7NbRtdGfzr/8y8GpRz7LP3U0vTSk18e/JzHEcwiBB0AGm8Q7AJkEQNLciyt4Esk/gLou5zoQxr+RrOfM91oBwEzd36KybgTAgLou5zoQxj/S3IsreBLJv1gCch0OHO8/FD+RxSLN4j91NL00pNfHP/zLwalHPsu/nL7/By4Pyr8tSP5h7CPiv1P70RgBUbo/2utnRN3Kyb/KfllfCpUIwLkP5zj+NwdAgDCf3SlCwT8s6auVGL7Sv2aFPlaC4eC/XrS5UVH77b/xo8JQq7+5P+TjkPAGE9G/Q30/RYbn1z8FF/ISafuLv9y1QFD2bLc/CHscxQqD0r/fi+tPROX0P6vRc+19ie0/amc4seFtsz/3EaZfEIbVv77TYpahl/o/DDsu0CaC9D90kA0k9M6tP0AdQ9ljYNS/CCI0rxjZA8BgfCaLthgHwLAIQZuSFrE/YrGIqEGB1b8kvQ982+rsv4J8EWu7jPS/ySB8B3PBqD+9vWZWv5/VvwrAByWcJgBAxFujmE9a+j89l8n1oGGmP9+agH7x59i/N03cuJUt9L8X9v4GdIz6v1yBHpJd35m/rU/8/LRj1b8mz69sydf/vyu5idMqVQLAn94bv7Majz8AhrtgaAjZv+aCE66WZ/q/lA1Mgz/p/79c7+Nd4VRoP52zweD/Xdi/TJZpMTb4AkDLWZShPOb/PysKSE4W+p2/Jr95SiSW27/PkmbE7zjnP6UAiCDmMNI/nYmLvHn1s78vJO4PW6fbv5MWA2vqSrQ/V5WLwPB51b+otXvWlbuxv54qOw+Amdy/1keqzYeRBsApIEMHgZIIQHb05bmZ366/XCluGsvI3b8W44a9X9UFQEeQtDM4rwJAFj7uU9kEvL9nFpou+9nfv3Co+JcyyQhAcdkCX2KzBUCHHnBxQd7Dvy2KLvLSYuC/o6+5YTt/AcCHCNDW+8YEwF8SFMc79MO/7bOXVSJ54b9E/pfA2S3xPzD9xaBb0uQ/DM7sj5tww7+yZIRsr87hv7c4c0SEXNG/Tr79/9M+5r+v9N6oTy3Qv5uAk/3QzeG/XcI1OVQkAUAQSV9Z7Qr9P/RrFrWXrMu/W2k5L5Qs479Zo2IBM/vkv6FuipzkFvG/SqIpagcly7+ltipxmI3kv0pmis91cfc/gWQecsRh8D93xzejiVXQv3WdNhEv9uO/D7mgYy612j+PyVPNaT2jv34LIpFt6c6/l5YW2Ga45L+LUp+2A2z9P39i5xSpRfc/piRx4P8P0r9eCC3zBAjlv5n4OKmIUf2/jj/kUAwgAsDqW/cjbNPQv9X2z6SYweS/aTdljlWd8L94R8vZ8SL3v1EZczv0b9K/GBbbqxgk5r9XdfyikfEDwPILMvas0gfAnx0V97en0r88xQk/0IPmvxGErZ681fa/9kCaiOy2/b/2BCK0wyDVvy2xROCT4ua/+5EBLOXxA0B7p53+BnkAQKKI/QV+y9i/qDznPFM86b/snWGNkkgHwC+ByugkUwdAR98lJFqQ2b9sL7HxZkPovyJNGM67oek/HzNy6BqA1D96EnqL7pLYv0v8nFypHeq/axL/u1FnB0AkSEHvxn8DQGt+gG5Pstm/QS1keLLK6b/Sk/O6mtGzPxU8pLcPNty/FssiPwWy4L+IZTNYLmzqvw4szKfSouq/G+XJHY1a87+TVW2LUjjfvwQaifgujuy/3VARaoMl2L9NFodfK+/qv+0QMvYfP+C/FvLf01HN67+ETOQysd8AwH71iI/eGgXAbHNSHrTg4L96GNJ2CFvsv6BnExReeAFA5CakvxSl+j8MzcbAuwDgv5bXzdT1Auy/uVq8/8x58z+uvPMNqzTnP2HlfZ3gqOG/Z5Uh1wDX7r8PUbMSo2P7P9VfBrXlxPI/tQvDXQ3H4r9sJXFt2GTvvyDssGgO0PG/WxT/uE4N+r+Bk03jWYvjv/bf8sHUYu+/rUXN8hUe3j9m5HB1yZCzv/yE3PUo0+K/qqAX9idJ8L9mByqLMMH5v4kHC7KQowHAm+sAswr15L8F7/a5DE/wv2JLsGADFwTAKQjVGovZCMDDkYbTbifnvwVbdNXyhfC/malhH7yI7D+oevd0GWDZP1sjk5AdouW/KH/hrXUg8b8KWmrpQ0sFQAzEAF/pTgBAhB1hfFzT5r9XK/wflZ7xv18hRuqKXAjA/5rUd9v1BED/tlxBd4bov7pQU4wLfPK/4pnwn0T/sj/c277XPF3jv02biiQ+Rum/zGkxMcl88r8Yk0HhJVzjv62yUUFRjfS/89MEdoPQ6r8TqikcRF/zvxQxghHovfY/cfM1eFWE5j9pcwp7GJPrv5ehC2fbYPO/KUV2nGg0/795OhmUaqEFwFQeuy4j+eq/ePiwytEp9L8DuqWfW+8BQLytJylXHPY/PlP4Qr8q7r+kDLLri0P1vxT4ShWL+Oo/DMsWg0zlv7/S9fINXGjtv73m373LRPW/+xg/Gaxd8b94MdQEfW0AwLjBLbDOHO+/kmm4ANp49L+cShSMMbAEwKyjUgWirAdAo2q2uqM08L99wKzM+7H2v3RdlNBXFgnA8S9+ewyV/z+vaSZre3Pxv6riWFiWZfi/2J7VSZZ60j+LES81zPn3v+OrlPMN3PK/quJYWJZl+L/OZbufkEcEQLCNB/1lPOO/Y2nmTbY/87+q4lhYlmX4v7CNB/1lPOO/zmW7n5BHBEBwKD1Aa57LP/XsSsw7RbU/PMDPJGsfoD/TqningGKIPzFtCLYmb3I/qYfrJr7eWz9pQmleXRFFP0rWlJkA2i8/pCvcttgTGD9Dt8IWbjMCPyCG4GRlhOs+1JI2GhDN1D7ns8cGvXK/Pi8m8UTJxac+hNTfA2z4kT7GI8kjLyt7Pv//////HwAI//////8zEAj/////fzIgCP////9vMjAI/////2MyQAj///8/YjJQCP///zdiMmAI////M2IycAj//78zYjKACP//qzNiMpAI/3+rM2IyoAj/D6szYjKwCP8DqzNiMsAIvwOrM2Iy0AifA6szYjLgCJkDqzNiMvAI//////8/Dwj//////ysfCP////9/KS8I/////z8pPwj/////OSlPCP///z84KV8I////Dzgpbwj///8OOCl/CP//Hw44KY8I//8PDjgpnwj/fw0OOCmvCP8PDQ44Kb8I/w0NDjgpzwj/DA0OOCnfCMcMDQ44Ke8IxAwNDjgp/wgHAAAABwAAAAEAAAACAAAABAAAAAMAAAAAAAAAAAAAAAcAAAADAAAAAQAAAAIAAAAFAAAABAAAAAAAAAAAAAAABAAAAAQAAAAAAAAAAgAAAAEAAAADAAAADgAAAAYAAAALAAAAAgAAAAcAAAABAAAAGAAAAAUAAAAKAAAAAQAAAAYAAAAAAAAAJgAAAAcAAAAMAAAAAwAAAAgAAAACAAAAMQAAAAkAAAAOAAAAAAAAAAUAAAAEAAAAOgAAAAgAAAANAAAABAAAAAkAAAADAAAAPwAAAAsAAAAGAAAADwAAAAoAAAAQAAAASAAAAAwAAAAHAAAAEAAAAAsAAAARAAAAUwAAAAoAAAAFAAAAEwAAAA4AAAAPAAAAYQAAAA0AAAAIAAAAEQAAAAwAAAASAAAAawAAAA4AAAAJAAAAEgAAAA0AAAATAAAAdQAAAA8AAAATAAAAEQAAABIAAAAQAAAABgAAAAIAAAADAAAABQAAAAQAAAAAAAAAAAAAAAAAAAAGAAAAAgAAAAMAAAABAAAABQAAAAQAAAAAAAAAAAAAAAcAAAAFAAAAAwAAAAQAAAABAAAAAAAAAAIAAAAAAAAAAgAAAAMAAAABAAAABQAAAAQAAAAGAAAAAAAAAAAAAAAYLURU+yH5PxgtRFT7Ifm/GC1EVPshCUAYLURU+yEJwGFsZ29zLmMAaDNOZWlnaGJvclJvdGF0aW9ucwBjZWxsc1RvTXVsdGlQb2x5LmMAY2VsbFRvRWRnZUFyY3MAAAEDAgQABAMFAQJjYW5jZWxBcmNQYWlycwBjcmVhdGVTb3J0YWJsZUxvb3AAZGlyZWN0ZWRFZGdlLmMAZGlyZWN0ZWRFZGdlVG9Cb3VuZGFyeQBhZGphY2VudEZhY2VEaXJbdG1wRmlqay5mYWNlXVtmaWprLmZhY2VdID09IEtJAGZhY2VpamsuYwBfZmFjZUlqa1BlbnRUb0NlbGxCb3VuZGFyeQBhZGphY2VudEZhY2VEaXJbY2VudGVySUpLLmZhY2VdW2ZhY2UyXSA9PSBLSQBfZmFjZUlqa1RvQ2VsbEJvdW5kYXJ5AGgzSW5kZXguYwBjb21wYWN0Q2VsbHMAdmVjM1RvQ2VsbABjZWxsVG9DaGlsZFBvcwB2YWxpZGF0ZUNoaWxkUG9zAHJldkRpciAhPSBJTlZBTElEX0RJR0lUAGxvY2FsaWouYwBjZWxsVG9Mb2NhbElqawBiYXNlQ2VsbCAhPSBvcmlnaW5CYXNlQ2VsbAAhKG9yaWdpbk9uUGVudCAmJiBpbmRleE9uUGVudCkAYmFzZUNlbGwgPT0gb3JpZ2luQmFzZUNlbGwALi4vaW5jbHVkZS9jb29yZGlqay5oAF91cEFwN0NoZWNrZWQAX3VwQXA3ckNoZWNrZWQAYmFzZUNlbGwgIT0gSU5WQUxJRF9CQVNFX0NFTEwAbG9jYWxJamtUb0NlbGwAIV9pc0Jhc2VDZWxsUGVudGFnb24oYmFzZUNlbGwpAGJhc2VDZWxsUm90YXRpb25zID49IDAAZ3JpZFBhdGhDZWxsc0ludGVycG9sYXRlAHBvbHlmaWxsLmMAaXRlclN0ZXBQb2x5Z29uQ29tcGFjdAAwAHZlcnRleC5jAHZlcnRleFJvdGF0aW9ucwBjZWxsVG9WZXJ0ZXg=";var vt=28400;function Tt(Le){return Le}function qe(Le){var it=/\b__Z[\w\d_]+/g;return Le.replace(it,function(Dt){var He=Dt;return Dt===He?Dt:He+" ["+Dt+"]"})}function Je(){var Le=new Error;if(!Le.stack){try{throw new Error(0)}catch(it){Le=it}if(!Le.stack)return"(no stack trace available)"}return Le.stack.toString()}function Pt(){var Le=Je();return e.extraStackTrace&&(Le+=`4130+`+e.extraStackTrace()),qe(Le)}function rn(Le,it,Dt,He){km("Assertion failed: "+L(Le)+", at: "+[it?L(it):"unknown filename",Dt,He?L(He):"unknown function"])}function Lt(){return Y.length}function Rt(Le,it,Dt){H.set(H.subarray(it,it+Dt),Le)}function fn(Le){return e.___errno_location&&(te[e.___errno_location()>>2]=Le),Le}function wn(Le){km("OOM")}function Dn(Le){try{var it=new ArrayBuffer(Le);return it.byteLength!=Le?void 0:(new Int8Array(it).set(Y),sn(it),Re(it),1)}catch{}}function ye(Le){var it=Lt(),Dt=16777216,He=2147483648-Dt;if(Le>He)return!1;for(var h=16777216,sr=Math.max(it,h);sr<Le;)sr<=536870912?sr=G(2*sr,Dt):sr=Math.min(G((3*sr+2147483648)/4,Dt),He);var Ii=Dn(sr);return!!Ii}var wt=typeof atob=="function"?atob:function(Le){var it="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Dt="",He,h,sr,Ii,ie,or,ol,fo=0;Le=Le.replace(/[^A-Za-z0-9\+\/\=]/g,"");do Ii=it.indexOf(Le.charAt(fo++)),ie=it.indexOf(Le.charAt(fo++)),or=it.indexOf(Le.charAt(fo++)),ol=it.indexOf(Le.charAt(fo++)),He=Ii<<2|ie>>4,h=(ie&15)<<4|or>>2,sr=(or&3)<<6|ol,Dt=Dt+String.fromCharCode(He),or!==64&&(Dt=Dt+String.fromCharCode(h)),ol!==64&&(Dt=Dt+String.fromCharCode(sr));while(fo<Le.length);return Dt};function Ze(Le){try{for(var it=wt(Le),Dt=new Uint8Array(it.length),He=0;He<it.length;++He)Dt[He]=it.charCodeAt(He);return Dt}catch{throw new Error("Converting base64 string to bytes failed.")}}function St(Le){if(Te(Le))return Ze(Le.slice(Z.length))}var Bt={Math,Int8Array,Int32Array,Uint8Array,Float32Array,Float64Array},ut={a:km,b:f,c:d,d:rn,e:fn,f:Lt,g:Rt,h:ye,i:wn,j:Tt,k:qe,l:Dn,m:Je,n:Pt,o:vt,p:Fe},Ce=(function(Le,it,Dt){"almost asm";var He=new Le.Int8Array(Dt),h=new Le.Int32Array(Dt),sr=new Le.Uint8Array(Dt),Ii=new Le.Float32Array(Dt),ie=new Le.Float64Array(Dt),or=it.o|0,ol=it.p|0,fo=Le.Math.floor,Qs=Le.Math.abs,bs=Le.Math.sqrt,ii=Le.Math.cos,zi=Le.Math.sin,oT=Le.Math.tan,xce=Le.Math.acos,Wx=Le.Math.asin,jG=Le.Math.atan,Sa=Le.Math.atan2,b1=Le.Math.ceil,al=Le.Math.imul,iL=Le.Math.min,yce=Le.Math.max,Hf=Le.Math.clz32,bce=it.a,On=it.b,ee=it.c,di=it.d,XG=it.e,wce=it.f,Sce=it.g,Tce=it.h,Ece=it.i,Q=28416;function Mce(p){return He=new Int8Array(p),sr=new Uint8Array(p),h=new Int32Array(p),Ii=new Float32Array(p),ie=new Float64Array(p),Dt=p,!0}function Cce(p){p=p|0;var m=0;return m=Q,Q=Q+p|0,Q=Q+15&-16,m|0}function Rce(){return Q|0}function Ice(p){p=p|0,Q=p}function Pce(p,m){p=p|0,m=m|0,Q=p}function Lce(p,m){p=p|0,m=m|0;var g=0,_=0,v=0;return(p|0)<0?(m=2,m|0):(p|0)>13780509?(m=uT(15,m)|0,m|0):(g=((p|0)<0)<<31>>31,v=wr(p|0,g|0,3,0)|0,_=ee()|0,g=At(p|0,g|0,1,0)|0,g=wr(v|0,_|0,g|0,ee()|0)|0,g=At(g|0,ee()|0,1,0)|0,p=ee()|0,h[m>>2]=g,h[m+4>>2]=p,m=0,m|0)}function $G(p,m,g,_){return p=p|0,m=m|0,g=g|0,_=_|0,YG(p,m,g,_,0)|0}function YG(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0;if(M=Q,Q=Q+16|0,b=M,!(ZG(p,m,g,_,v)|0))return _=0,Q=M,_|0;do if((g|0)>=0){if((g|0)>13780509){if(x=uT(15,b)|0,x|0)break;E=b,b=h[E>>2]|0,E=h[E+4>>2]|0}else x=((g|0)<0)<<31>>31,N=wr(g|0,x|0,3,0)|0,E=ee()|0,x=At(g|0,x|0,1,0)|0,x=wr(N|0,E|0,x|0,ee()|0)|0,x=At(x|0,ee()|0,1,0)|0,E=ee()|0,h[b>>2]=x,h[b+4>>2]=E,b=x;if(cp(_|0,0,b<<3|0)|0,v|0){cp(v|0,0,b<<2|0)|0,x=sh(p,m,g,_,v,b,E,0)|0;break}x=Ta(b,4)|0,x?(N=sh(p,m,g,_,x,b,E,0)|0,_t(x),x=N):x=13}else x=2;while(!1);return N=x,Q=M,N|0}function ZG(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0;if(ae=Q,Q=Q+16|0,X=ae,K=ae+8|0,j=X,h[j>>2]=p,h[j+4>>2]=m,(g|0)<0)return K=2,Q=ae,K|0;if(x=_,h[x>>2]=p,h[x+4>>2]=m,x=(v|0)!=0,x&&(h[v>>2]=0),Zi(p,m)|0)return K=9,Q=ae,K|0;h[K>>2]=0;e:do if((g|0)>=1)if(x)for(U=1,N=0,q=0,j=1,x=p;;){if(!(N|q)){if(x=Js(x,m,4,K,X)|0,x|0)break e;if(m=X,x=h[m>>2]|0,m=h[m+4>>2]|0,Zi(x,m)|0){x=9;break e}}if(x=Js(x,m,h[26864+(q<<2)>>2]|0,K,X)|0,x|0)break e;if(m=X,x=h[m>>2]|0,m=h[m+4>>2]|0,p=_+(U<<3)|0,h[p>>2]=x,h[p+4>>2]=m,h[v+(U<<2)>>2]=j,p=N+1|0,b=(p|0)==(j|0),E=q+1|0,M=(E|0)==6,Zi(x,m)|0){x=9;break e}if(j=j+(M&b&1)|0,(j|0)>(g|0)){x=0;break}else U=U+1|0,N=b?0:p,q=b?M?0:E:q}else for(U=1,N=0,q=0,j=1,x=p;;){if(!(N|q)){if(x=Js(x,m,4,K,X)|0,x|0)break e;if(m=X,x=h[m>>2]|0,m=h[m+4>>2]|0,Zi(x,m)|0){x=9;break e}}if(x=Js(x,m,h[26864+(q<<2)>>2]|0,K,X)|0,x|0)break e;if(m=X,x=h[m>>2]|0,m=h[m+4>>2]|0,p=_+(U<<3)|0,h[p>>2]=x,h[p+4>>2]=m,p=N+1|0,b=(p|0)==(j|0),E=q+1|0,M=(E|0)==6,Zi(x,m)|0){x=9;break e}if(j=j+(M&b&1)|0,(j|0)>(g|0)){x=0;break}else U=U+1|0,N=b?0:p,q=b?M?0:E:q}else x=0;while(!1);return K=x,Q=ae,K|0}function sh(p,m,g,_,v,x,b,E){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0,x=x|0,b=b|0,E=E|0;var M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0;if(ae=Q,Q=Q+16|0,X=ae+8|0,K=ae,M=Wf(p|0,m|0,x|0,b|0)|0,U=ee()|0,q=_+(M<<3)|0,ue=q,xe=h[ue>>2]|0,ue=h[ue+4>>2]|0,N=(xe|0)==(p|0)&(ue|0)==(m|0),!((xe|0)==0&(ue|0)==0|N))do M=At(M|0,U|0,1,0)|0,M=lp(M|0,ee()|0,x|0,b|0)|0,U=ee()|0,q=_+(M<<3)|0,xe=q,ue=h[xe>>2]|0,xe=h[xe+4>>2]|0,N=(ue|0)==(p|0)&(xe|0)==(m|0);while(!((ue|0)==0&(xe|0)==0|N));if(M=v+(M<<2)|0,N&&(h[M>>2]|0)<=(E|0)||(xe=q,h[xe>>2]=p,h[xe+4>>2]=m,h[M>>2]=E,(E|0)>=(g|0)))return xe=0,Q=ae,xe|0;switch(N=E+1|0,h[X>>2]=0,M=Js(p,m,2,X,K)|0,M|0){case 9:{j=9;break}case 0:{M=K,M=sh(h[M>>2]|0,h[M+4>>2]|0,g,_,v,x,b,N)|0,M||(j=9);break}default:}e:do if((j|0)==9){switch(h[X>>2]=0,M=Js(p,m,3,X,K)|0,M|0){case 9:break;case 0:{if(M=K,M=sh(h[M>>2]|0,h[M+4>>2]|0,g,_,v,x,b,N)|0,M|0)break e;break}default:break e}switch(h[X>>2]=0,M=Js(p,m,1,X,K)|0,M|0){case 9:break;case 0:{if(M=K,M=sh(h[M>>2]|0,h[M+4>>2]|0,g,_,v,x,b,N)|0,M|0)break e;break}default:break e}switch(h[X>>2]=0,M=Js(p,m,5,X,K)|0,M|0){case 9:break;case 0:{if(M=K,M=sh(h[M>>2]|0,h[M+4>>2]|0,g,_,v,x,b,N)|0,M|0)break e;break}default:break e}switch(h[X>>2]=0,M=Js(p,m,4,X,K)|0,M|0){case 9:break;case 0:{if(M=K,M=sh(h[M>>2]|0,h[M+4>>2]|0,g,_,v,x,b,N)|0,M|0)break e;break}default:break e}switch(h[X>>2]=0,M=Js(p,m,6,X,K)|0,M|0){case 9:break;case 0:{if(M=K,M=sh(h[M>>2]|0,h[M+4>>2]|0,g,_,v,x,b,N)|0,M|0)break e;break}default:break e}return xe=0,Q=ae,xe|0}while(!1);return xe=M,Q=ae,xe|0}function Js(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0;if(g>>>0>6)return v=1,v|0;b=(h[_>>2]|0)%6|0,h[_>>2]=b;e:do if((b|0)>0)for(x=0;;){switch(g|0){case 1:{g=5;break}case 5:{g=4;break}case 4:{g=6;break}case 6:{g=2;break}case 2:{g=3;break}case 3:{g=1;break}default:}if(x=x+1|0,(x|0)==(b|0))break e}while(!1);if(q=tt(p|0,m|0,45)|0,ee()|0,U=q&127,U>>>0>121)return v=5,v|0;M=ll(p,m)|0,x=tt(p|0,m|0,52)|0,ee()|0,x=x&15;e:do if(!x)N=15;else{for(;;){if(b=(15-x|0)*3|0,E=tt(p|0,m|0,b|0)|0,ee()|0,E=E&7,(E|0)==7){m=5;break}if(K=(xc(x)|0)==0,x=x+-1|0,j=ft(7,0,b|0)|0,m=m&~(ee()|0),X=ft(h[(K?432:16)+(E*28|0)+(g<<2)>>2]|0,0,b|0)|0,b=ee()|0,g=h[(K?640:224)+(E*28|0)+(g<<2)>>2]|0,p=X|p&~j,m=b|m,!g){g=0;break e}if(!x){N=15;break e}}return m|0}while(!1);(N|0)==15&&(K=h[848+(U*28|0)+(g<<2)>>2]|0,X=ft(K|0,0,45)|0,p=X|p,m=ee()|0|m&-1040385,g=h[4272+(U*28|0)+(g<<2)>>2]|0,(K&127|0)==127&&(K=ft(h[848+(U*28|0)+20>>2]|0,0,45)|0,m=ee()|0|m&-1040385,g=h[4272+(U*28|0)+20>>2]|0,p=zm(K|p,m)|0,m=ee()|0,h[_>>2]=(h[_>>2]|0)+1)),E=tt(p|0,m|0,45)|0,ee()|0,E=E&127;e:do if(yr(E)|0){t:do if((ll(p,m)|0)==1){if((U|0)!=(E|0))if(eq(E,h[7696+(U*28|0)>>2]|0)|0){p=mL(p,m)|0,b=1,m=ee()|0;break}else di(27634,26928,533,26936);switch(M|0){case 3:{p=zm(p,m)|0,m=ee()|0,h[_>>2]=(h[_>>2]|0)+1,b=0;break t}case 5:{p=mL(p,m)|0,m=ee()|0,h[_>>2]=(h[_>>2]|0)+5,b=0;break t}case 0:return K=9,K|0;default:return K=1,K|0}}else b=0;while(!1);if((g|0)>0){x=0;do p=pL(p,m)|0,m=ee()|0,x=x+1|0;while((x|0)!=(g|0))}if((U|0)!=(E|0)){if(!(rL(E)|0)){if((b|0)!=0|(ll(p,m)|0)!=5)break;h[_>>2]=(h[_>>2]|0)+1;break}switch(q&127){case 8:case 118:break e;default:}(ll(p,m)|0)!=3&&(h[_>>2]=(h[_>>2]|0)+1)}}else if((g|0)>0){x=0;do p=zm(p,m)|0,m=ee()|0,x=x+1|0;while((x|0)!=(g|0))}while(!1);return h[_>>2]=((h[_>>2]|0)+g|0)%6|0,K=v,h[K>>2]=p,h[K+4>>2]=m,K=0,K|0}function Dce(p,m,g,_){return p=p|0,m=m|0,g=g|0,_=_|0,KG(p,m,g,_)|0?(cp(_|0,0,g*48|0)|0,_=Nce(p,m,g,_)|0,_|0):(_=0,_|0)}function KG(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0;if(K=Q,Q=Q+16|0,j=K,X=K+8|0,q=j,h[q>>2]=p,h[q+4>>2]=m,(g|0)<0)return X=2,Q=K,X|0;if(!g)return X=_,h[X>>2]=p,h[X+4>>2]=m,X=0,Q=K,X|0;h[X>>2]=0;e:do if(Zi(p,m)|0)p=9;else{v=0,q=p;do{if(p=Js(q,m,4,X,j)|0,p|0)break e;if(m=j,q=h[m>>2]|0,m=h[m+4>>2]|0,v=v+1|0,Zi(q,m)|0){p=9;break e}}while((v|0)<(g|0));U=_,h[U>>2]=q,h[U+4>>2]=m,U=g+-1|0,N=0,p=1;do{if(v=26864+(N<<2)|0,(N|0)==5)for(b=h[v>>2]|0,x=0,v=p;;){if(p=j,p=Js(h[p>>2]|0,h[p+4>>2]|0,b,X,j)|0,p|0)break e;if((x|0)!=(U|0))if(M=j,E=h[M>>2]|0,M=h[M+4>>2]|0,p=_+(v<<3)|0,h[p>>2]=E,h[p+4>>2]=M,!(Zi(E,M)|0))p=v+1|0;else{p=9;break e}else p=v;if(x=x+1|0,(x|0)>=(g|0))break;v=p}else for(b=j,M=h[v>>2]|0,E=0,v=p,x=h[b>>2]|0,b=h[b+4>>2]|0;;){if(p=Js(x,b,M,X,j)|0,p|0)break e;if(b=j,x=h[b>>2]|0,b=h[b+4>>2]|0,p=_+(v<<3)|0,h[p>>2]=x,h[p+4>>2]=b,p=v+1|0,Zi(x,b)|0){p=9;break e}if(E=E+1|0,(E|0)>=(g|0))break;v=p}N=N+1|0}while(N>>>0<6);p=j,p=(q|0)==(h[p>>2]|0)&&(m|0)==(h[p+4>>2]|0)?0:9}while(!1);return X=p,Q=K,X|0}function Nce(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0;if(q=Q,Q=Q+16|0,b=q,!g)return h[_>>2]=p,h[_+4>>2]=m,_=0,Q=q,_|0;do if((g|0)>=0){if((g|0)>13780509){if(v=uT(15,b)|0,v|0)break;x=b,v=h[x>>2]|0,x=h[x+4>>2]|0}else v=((g|0)<0)<<31>>31,U=wr(g|0,v|0,3,0)|0,x=ee()|0,v=At(g|0,v|0,1,0)|0,v=wr(U|0,x|0,v|0,ee()|0)|0,v=At(v|0,ee()|0,1,0)|0,x=ee()|0,U=b,h[U>>2]=v,h[U+4>>2]=x;if(N=Ta(v,8)|0,!N)v=13;else{if(U=Ta(v,4)|0,!U){_t(N),v=13;break}if(v=sh(p,m,g,N,U,v,x,0)|0,v|0){_t(N),_t(U);break}if(m=h[b>>2]|0,b=h[b+4>>2]|0,(b|0)>0|(b|0)==0&m>>>0>0){v=0,E=0,M=0;do p=N+(E<<3)|0,x=h[p>>2]|0,p=h[p+4>>2]|0,!((x|0)==0&(p|0)==0)&&(h[U+(E<<2)>>2]|0)==(g|0)&&(j=_+(v<<3)|0,h[j>>2]=x,h[j+4>>2]=p,v=v+1|0),E=At(E|0,M|0,1,0)|0,M=ee()|0;while((M|0)<(b|0)|(M|0)==(b|0)&E>>>0<m>>>0)}_t(N),_t(U),v=0}}else v=2;while(!1);return j=v,Q=q,j|0}function aT(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0;for(E=Q,Q=Q+16|0,x=E,b=E+8|0,v=(Zi(p,m)|0)==0,v=v?1:2;;){if(h[b>>2]=0,N=(Js(p,m,v,b,x)|0)==0,M=x,N&((h[M>>2]|0)==(g|0)?(h[M+4>>2]|0)==(_|0):0)){p=4;break}if(v=v+1|0,v>>>0>=7){v=7,p=4;break}}return(p|0)==4?(Q=E,v|0):0}function Fce(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0;if(E=Q,Q=Q+48|0,v=E+16|0,x=E+8|0,b=E,g=Jx(g)|0,g|0)return b=g,Q=E,b|0;if(N=p,M=h[N+4>>2]|0,g=x,h[g>>2]=h[N>>2],h[g+4>>2]=M,vq(x,v),g=rq(v,m,b)|0,!g){if(m=h[x>>2]|0,x=h[p+8>>2]|0,(x|0)>0){v=h[p+12>>2]|0,g=0;do m=(h[v+(g<<3)>>2]|0)+m|0,g=g+1|0;while((g|0)<(x|0))}g=b,v=h[g>>2]|0,g=h[g+4>>2]|0,x=((m|0)<0)<<31>>31,(g|0)<(x|0)|(g|0)==(x|0)&v>>>0<m>>>0?(g=b,h[g>>2]=m,h[g+4>>2]=x,g=x):m=v,M=At(m|0,g|0,12,0)|0,N=ee()|0,g=b,h[g>>2]=M,h[g+4>>2]=N,g=_,h[g>>2]=M,h[g+4>>2]=N,g=0}return N=g,Q=E,N|0}function QG(p,m,g,_,v,x,b){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0,x=x|0,b=b|0;var E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0,be=0,gt=0,je=0,Ut=0,lt=0,pt=0,pi=0,bi=0,Ro=0,Vn=0,wi=0,Ea=0;if(bi=Q,Q=Q+64|0,Ut=bi+48|0,lt=bi+32|0,pt=bi+24|0,Be=bi+8|0,Ke=bi,M=h[p>>2]|0,(M|0)<=0)return pi=0,Q=bi,pi|0;for(Me=p+4|0,be=Ut+8|0,gt=lt+8|0,je=Be+8|0,E=0,we=0;;){N=h[Me>>2]|0,se=N+(we<<4)|0,h[Ut>>2]=h[se>>2],h[Ut+4>>2]=h[se+4>>2],h[Ut+8>>2]=h[se+8>>2],h[Ut+12>>2]=h[se+12>>2],(we|0)==(M+-1|0)?(h[lt>>2]=h[N>>2],h[lt+4>>2]=h[N+4>>2],h[lt+8>>2]=h[N+8>>2],h[lt+12>>2]=h[N+12>>2]):(se=N+(we+1<<4)|0,h[lt>>2]=h[se>>2],h[lt+4>>2]=h[se+4>>2],h[lt+8>>2]=h[se+8>>2],h[lt+12>>2]=h[se+12>>2]),M=Zce(Ut,lt,_,pt)|0;e:do if(M)N=0,E=M;else if(M=pt,N=h[M>>2]|0,M=h[M+4>>2]|0,(M|0)>0|(M|0)==0&N>>>0>0){xe=0,se=0;t:for(;;){if(Vn=1/(+(N>>>0)+4294967296*+(M|0)),Ea=+ie[Ut>>3],M=eo(N|0,M|0,xe|0,se|0)|0,wi=+(M>>>0)+4294967296*+(ee()|0),Ro=+(xe>>>0)+4294967296*+(se|0),ie[Be>>3]=Vn*(Ea*wi)+Vn*(+ie[lt>>3]*Ro),ie[je>>3]=Vn*(+ie[be>>3]*wi)+Vn*(+ie[gt>>3]*Ro),M=AL(Be,_,Ke)|0,M|0){E=M;break}ue=Ke,ae=h[ue>>2]|0,ue=h[ue+4>>2]|0,j=Wf(ae|0,ue|0,m|0,g|0)|0,U=ee()|0,M=b+(j<<3)|0,q=M,N=h[q>>2]|0,q=h[q+4>>2]|0;n:do if((N|0)==0&(q|0)==0)Ae=M,pi=16;else for(X=0,K=0;;){if((X|0)>(g|0)|(X|0)==(g|0)&K>>>0>m>>>0){E=1;break t}if((N|0)==(ae|0)&(q|0)==(ue|0))break n;if(M=At(j|0,U|0,1,0)|0,j=lp(M|0,ee()|0,m|0,g|0)|0,U=ee()|0,K=At(K|0,X|0,1,0)|0,X=ee()|0,M=b+(j<<3)|0,q=M,N=h[q>>2]|0,q=h[q+4>>2]|0,(N|0)==0&(q|0)==0){Ae=M,pi=16;break}}while(!1);if((pi|0)==16&&(pi=0,!((ae|0)==0&(ue|0)==0))&&(K=Ae,h[K>>2]=ae,h[K+4>>2]=ue,K=x+(h[v>>2]<<3)|0,h[K>>2]=ae,h[K+4>>2]=ue,K=v,K=At(h[K>>2]|0,h[K+4>>2]|0,1,0)|0,ae=ee()|0,ue=v,h[ue>>2]=K,h[ue+4>>2]=ae),xe=At(xe|0,se|0,1,0)|0,se=ee()|0,M=pt,N=h[M>>2]|0,M=h[M+4>>2]|0,!((M|0)>(se|0)|(M|0)==(se|0)&N>>>0>xe>>>0)){N=1;break e}}N=0}else N=1;while(!1);if(we=we+1|0,!N){pi=21;break}if(M=h[p>>2]|0,(we|0)>=(M|0)){E=0,pi=21;break}}return(pi|0)==21?(Q=bi,E|0):0}function Bce(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0,be=0,gt=0,je=0,Ut=0,lt=0,pt=0,pi=0,bi=0,Ro=0,Vn=0,wi=0;if(wi=Q,Q=Q+112|0,pi=wi+80|0,M=wi+72|0,bi=wi,Ro=wi+56|0,v=Jx(g)|0,v|0)return Vn=v,Q=wi,Vn|0;if(N=p+8|0,Vn=br((h[N>>2]<<5)+32|0)|0,!Vn)return Vn=13,Q=wi,Vn|0;if(wL(p,Vn),v=Jx(g)|0,!v){if(lt=p,pt=h[lt+4>>2]|0,v=M,h[v>>2]=h[lt>>2],h[v+4>>2]=pt,vq(M,pi),v=rq(pi,m,bi)|0,v)lt=0,pt=0;else{if(v=h[M>>2]|0,x=h[N>>2]|0,(x|0)>0){b=h[p+12>>2]|0,g=0;do v=(h[b+(g<<3)>>2]|0)+v|0,g=g+1|0;while((g|0)!=(x|0));g=v}else g=v;v=bi,x=h[v>>2]|0,v=h[v+4>>2]|0,b=((g|0)<0)<<31>>31,(v|0)<(b|0)|(v|0)==(b|0)&x>>>0<g>>>0?(v=bi,h[v>>2]=g,h[v+4>>2]=b,v=b):g=x,lt=At(g|0,v|0,12,0)|0,pt=ee()|0,v=bi,h[v>>2]=lt,h[v+4>>2]=pt,v=0}if(!v){if(g=Ta(lt,8)|0,!g)return _t(Vn),Vn=13,Q=wi,Vn|0;if(E=Ta(lt,8)|0,!E)return _t(Vn),_t(g),Vn=13,Q=wi,Vn|0;je=pi,h[je>>2]=0,h[je+4>>2]=0,je=p,Ut=h[je+4>>2]|0,v=M,h[v>>2]=h[je>>2],h[v+4>>2]=Ut,v=QG(M,lt,pt,m,pi,g,E)|0;e:do if(v)_t(g),_t(E),_t(Vn);else{t:do if((h[N>>2]|0)>0){for(b=p+12|0,x=0;v=QG((h[b>>2]|0)+(x<<3)|0,lt,pt,m,pi,g,E)|0,x=x+1|0,!(v|0);)if((x|0)>=(h[N>>2]|0))break t;_t(g),_t(E),_t(Vn);break e}while(!1);(pt|0)>0|(pt|0)==0<>>>0>0&&cp(E|0,0,lt<<3|0)|0,Ut=pi,je=h[Ut+4>>2]|0;t:do if((je|0)>0|(je|0)==0&(h[Ut>>2]|0)>>>0>0){Me=g,be=E,gt=g,je=E,Ut=g,v=g,Ae=g,Be=E,Ke=E,g=E;n:for(;;){for(ue=0,xe=0,se=0,we=0,x=0,b=0;;){E=bi,M=E+56|0;do h[E>>2]=0,E=E+4|0;while((E|0)<(M|0));if(m=Me+(ue<<3)|0,N=h[m>>2]|0,m=h[m+4>>2]|0,ZG(N,m,1,bi,0)|0){E=bi,M=E+56|0;do h[E>>2]=0,E=E+4|0;while((E|0)<(M|0));E=Ta(7,4)|0,E|0&&(sh(N,m,1,bi,E,7,0,0)|0,_t(E))}for(ae=0;;){K=bi+(ae<<3)|0,X=h[K>>2]|0,K=h[K+4>>2]|0;i:do if((X|0)==0&(K|0)==0)E=x,M=b;else{if(U=Wf(X|0,K|0,lt|0,pt|0)|0,N=ee()|0,E=_+(U<<3)|0,m=E,M=h[m>>2]|0,m=h[m+4>>2]|0,!((M|0)==0&(m|0)==0)){q=0,j=0;do{if((q|0)>(pt|0)|(q|0)==(pt|0)&j>>>0>lt>>>0)break n;if((M|0)==(X|0)&(m|0)==(K|0)){E=x,M=b;break i}E=At(U|0,N|0,1,0)|0,U=lp(E|0,ee()|0,lt|0,pt|0)|0,N=ee()|0,j=At(j|0,q|0,1,0)|0,q=ee()|0,E=_+(U<<3)|0,m=E,M=h[m>>2]|0,m=h[m+4>>2]|0}while(!((M|0)==0&(m|0)==0))}if((X|0)==0&(K|0)==0){E=x,M=b;break}T1(X,K,Ro)|0,SL(p,Vn,Ro)|0&&(j=At(x|0,b|0,1,0)|0,b=ee()|0,q=E,h[q>>2]=X,h[q+4>>2]=K,x=be+(x<<3)|0,h[x>>2]=X,h[x+4>>2]=K,x=j),E=x,M=b}while(!1);if(ae=ae+1|0,ae>>>0>=7)break;x=E,b=M}if(ue=At(ue|0,xe|0,1,0)|0,xe=ee()|0,se=At(se|0,we|0,1,0)|0,we=ee()|0,b=pi,x=h[b>>2]|0,b=h[b+4>>2]|0,(we|0)<(b|0)|(we|0)==(b|0)&se>>>0<x>>>0)x=E,b=M;else break}if((b|0)>0|(b|0)==0&x>>>0>0){x=0,b=0;do we=Me+(x<<3)|0,h[we>>2]=0,h[we+4>>2]=0,x=At(x|0,b|0,1,0)|0,b=ee()|0,we=pi,se=h[we+4>>2]|0;while((b|0)<(se|0)|((b|0)==(se|0)?x>>>0<(h[we>>2]|0)>>>0:0))}if(we=pi,h[we>>2]=E,h[we+4>>2]=M,(M|0)>0|(M|0)==0&E>>>0>0)ae=g,ue=Ke,xe=Ut,se=Be,we=be,g=Ae,Ke=v,Be=gt,Ae=ae,v=ue,Ut=je,je=xe,gt=se,be=Me,Me=we;else break t}_t(gt),_t(je),_t(Vn),v=1;break e}else v=E;while(!1);_t(Vn),_t(g),_t(v),v=0}while(!1);return Vn=v,Q=wi,Vn|0}}return _t(Vn),Vn=v,Q=wi,Vn|0}function Oce(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0;if(E=Q,Q=Q+16|0,b=E,p=Qce(p,m,((m|0)<0)<<31>>31,b)|0,p|0)return b=p,Q=E,b|0;if(x=Due(b,g)|0,g=b+4|0,(h[b>>2]|0)>0){m=0;do{if(v=h[g>>2]|0,_=v+(m<<4)+4|0,_t(h[_>>2]|0),h[_>>2]=0,h[v+(m<<4)>>2]=0,_=v+(m<<4)+8|0,v=v+(m<<4)+12|0,(h[_>>2]|0)>0){p=0;do M=h[v>>2]|0,N=M+(p<<3)+4|0,_t(h[N>>2]|0),h[N>>2]=0,h[M+(p<<3)>>2]=0,p=p+1|0;while((p|0)<(h[_>>2]|0))}_t(h[v>>2]|0),h[v>>2]=0,h[_>>2]=0,m=m+1|0}while((m|0)<(h[b>>2]|0))}return _t(h[g>>2]|0),h[g>>2]=0,h[b>>2]=0,N=x,Q=E,N|0}function _c(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0;if(b=h[p>>2]|0,(b|0)<=0)return v=0,_=0,b=v<0,_=12.566370614359172-_,_=v+_,v=b?_:v,ie[m>>3]=v,0;if(x=h[p+4>>2]|0,p=(b|0)!=1&1,E=+ie[x>>3]*.5+.7853981633974483,v=+ie[x+(p<<4)>>3]*.5+.7853981633974483,g=+zi(+E)*+zi(+v),_=+ie[x+(p<<4)+8>>3]-+ie[x+8>>3],g=+Sa(+(+zi(+_)*g),+(+ii(+E)*+ii(+v)+ +ii(+_)*g))*-2,_=g+0,g=_-g,(b|0)==1)return E=_,v=g,b=E<0,v=12.566370614359172-v,v=E+v,E=b?v:E,ie[m>>3]=E,0;for(p=1,v=_;U=p,p=p+1|0,q=(p|0)%(b|0)|0,N=+ie[x+(U<<4)>>3]*.5+.7853981633974483,M=+ie[x+(q<<4)>>3]*.5+.7853981633974483,_=+zi(+N)*+zi(+M),E=+ie[x+(q<<4)+8>>3]-+ie[x+(U<<4)+8>>3],g=+Sa(+(+zi(+E)*_),+(+ii(+N)*+ii(+M)+ +ii(+E)*_))*-2-g,_=v+g,g=_-v-g,!((p|0)>=(b|0));)v=_;return q=_<0,N=12.566370614359172-g,N=_+N,N=q?N:_,ie[m>>3]=N,0}function Uce(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0;return b=Q,Q=Q+192|0,_=b+176|0,v=b,x=b+168|0,p=Vm(p,m,v)|0,p|0?(x=p,Q=b,x|0):(h[x>>2]=h[v>>2],h[x+4>>2]=v+8,h[_>>2]=h[x>>2],h[_+4>>2]=h[x+4>>2],_c(_,g)|0,x=0,Q=b,x|0)}function kce(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0;return b=Q,Q=Q+192|0,_=b+176|0,v=b,x=b+168|0,p=Vm(p,m,v)|0,p?(x=p,Q=b,x|0):(h[x>>2]=h[v>>2],h[x+4>>2]=v+8,h[_>>2]=h[x>>2],h[_+4>>2]=h[x+4>>2],_c(_,g)|0,ie[g>>3]=+ie[g>>3]*4058973249931477e-8,x=0,Q=b,x|0)}function zce(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0;return b=Q,Q=Q+192|0,_=b+176|0,v=b,x=b+168|0,p=Vm(p,m,v)|0,p?(x=p,Q=b,x|0):(h[x>>2]=h[v>>2],h[x+4>>2]=v+8,h[_>>2]=h[x>>2],h[_+4>>2]=h[x+4>>2],_c(_,g)|0,ie[g>>3]=+ie[g>>3]*4058973249931477e-8*1e6,x=0,Q=b,x|0)}function yr(p){return p=p|0,p>>>0>121?(p=0,p|0):(p=h[7696+(p*28|0)+16>>2]|0,p|0)}function rL(p){return p=p|0,(p|0)==4|(p|0)==117|0}function JG(p){return p=p|0,h[11120+((h[p>>2]|0)*216|0)+((h[p+4>>2]|0)*72|0)+((h[p+8>>2]|0)*24|0)+(h[p+12>>2]<<3)>>2]|0}function Vce(p){return p=p|0,h[11120+((h[p>>2]|0)*216|0)+((h[p+4>>2]|0)*72|0)+((h[p+8>>2]|0)*24|0)+(h[p+12>>2]<<3)+4>>2]|0}function Gce(p,m){p=p|0,m=m|0,p=7696+(p*28|0)|0,h[m>>2]=h[p>>2],h[m+4>>2]=h[p+4>>2],h[m+8>>2]=h[p+8>>2],h[m+12>>2]=h[p+12>>2]}function qce(p,m){p=p|0,m=m|0;var g=0,_=0;if(m>>>0>20)return m=-1,m|0;do if((h[11120+(m*216|0)>>2]|0)!=(p|0))if((h[11120+(m*216|0)+8>>2]|0)!=(p|0))if((h[11120+(m*216|0)+16>>2]|0)!=(p|0))if((h[11120+(m*216|0)+24>>2]|0)!=(p|0))if((h[11120+(m*216|0)+32>>2]|0)!=(p|0))if((h[11120+(m*216|0)+40>>2]|0)!=(p|0))if((h[11120+(m*216|0)+48>>2]|0)!=(p|0))if((h[11120+(m*216|0)+56>>2]|0)!=(p|0))if((h[11120+(m*216|0)+64>>2]|0)!=(p|0))if((h[11120+(m*216|0)+72>>2]|0)!=(p|0))if((h[11120+(m*216|0)+80>>2]|0)!=(p|0))if((h[11120+(m*216|0)+88>>2]|0)!=(p|0))if((h[11120+(m*216|0)+96>>2]|0)!=(p|0))if((h[11120+(m*216|0)+104>>2]|0)!=(p|0))if((h[11120+(m*216|0)+112>>2]|0)!=(p|0))if((h[11120+(m*216|0)+120>>2]|0)!=(p|0))if((h[11120+(m*216|0)+128>>2]|0)!=(p|0))if((h[11120+(m*216|0)+136>>2]|0)==(p|0))p=2,g=1,_=2;else{if((h[11120+(m*216|0)+144>>2]|0)==(p|0)){p=0,g=2,_=0;break}if((h[11120+(m*216|0)+152>>2]|0)==(p|0)){p=0,g=2,_=1;break}if((h[11120+(m*216|0)+160>>2]|0)==(p|0)){p=0,g=2,_=2;break}if((h[11120+(m*216|0)+168>>2]|0)==(p|0)){p=1,g=2,_=0;break}if((h[11120+(m*216|0)+176>>2]|0)==(p|0)){p=1,g=2,_=1;break}if((h[11120+(m*216|0)+184>>2]|0)==(p|0)){p=1,g=2,_=2;break}if((h[11120+(m*216|0)+192>>2]|0)==(p|0)){p=2,g=2,_=0;break}if((h[11120+(m*216|0)+200>>2]|0)==(p|0)){p=2,g=2,_=1;break}if((h[11120+(m*216|0)+208>>2]|0)==(p|0)){p=2,g=2,_=2;break}else p=-1;return p|0}else p=2,g=1,_=1;else p=2,g=1,_=0;else p=1,g=1,_=2;else p=1,g=1,_=1;else p=1,g=1,_=0;else p=0,g=1,_=2;else p=0,g=1,_=1;else p=0,g=1,_=0;else p=2,g=0,_=2;else p=2,g=0,_=1;else p=2,g=0,_=0;else p=1,g=0,_=2;else p=1,g=0,_=1;else p=1,g=0,_=0;else p=0,g=0,_=2;else p=0,g=0,_=1;else p=0,g=0,_=0;while(!1);return m=h[11120+(m*216|0)+(g*72|0)+(p*24|0)+(_<<3)+4>>2]|0,m|0}function eq(p,m){return p=p|0,m=m|0,(h[7696+(p*28|0)+20>>2]|0)==(m|0)?(m=1,m|0):(m=(h[7696+(p*28|0)+24>>2]|0)==(m|0),m|0)}function sL(p,m){return p=p|0,m=m|0,h[848+(p*28|0)+(m<<2)>>2]|0}function oL(p,m){return p=p|0,m=m|0,(h[848+(p*28|0)>>2]|0)==(m|0)?(m=0,m|0):(h[848+(p*28|0)+4>>2]|0)==(m|0)?(m=1,m|0):(h[848+(p*28|0)+8>>2]|0)==(m|0)?(m=2,m|0):(h[848+(p*28|0)+12>>2]|0)==(m|0)?(m=3,m|0):(h[848+(p*28|0)+16>>2]|0)==(m|0)?(m=4,m|0):(h[848+(p*28|0)+20>>2]|0)==(m|0)?(m=5,m|0):((h[848+(p*28|0)+24>>2]|0)==(m|0)?6:7)|0}function Hce(){return 122}function Wce(p){p=p|0;var m=0,g=0,_=0;m=0;do ft(m|0,0,45)|0,_=ee()|0|134225919,g=p+(m<<3)|0,h[g>>2]=-1,h[g+4>>2]=_,m=m+1|0;while((m|0)!=122);return 0}function jce(p){p=p|0;var m=0,g=0,_=0;return _=+ie[p+16>>3],g=+ie[p+24>>3],m=_-g,+(_<g?m+6.283185307179586:m)}function Xce(p){return p=p|0,+ie[p+16>>3]<+ie[p+24>>3]|0}function $ce(p){return p=p|0,+(+ie[p>>3]-+ie[p+8>>3])}function tq(p,m){p=p|0,m=m|0;var g=0,_=0,v=0;return g=+ie[m>>3],!(g>=+ie[p+8>>3])||!(g<=+ie[p>>3])?(m=0,m|0):(_=+ie[p+16>>3],g=+ie[p+24>>3],v=+ie[m+8>>3],m=v>=g,p=v<=_&1,_<g?m&&(p=1):m||(p=0),m=(p|0)!=0,m|0)}function aL(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0;return+ie[p>>3]<+ie[m+8>>3]||+ie[p+8>>3]>+ie[m>>3]?(_=0,_|0):(x=+ie[p+16>>3],g=p+24|0,U=+ie[g>>3],b=x<U,_=m+16|0,N=+ie[_>>3],v=m+24|0,M=+ie[v>>3],E=N<M,m=U-N<M-x,p=b?E|m?1:2:0,m=E?b?1:m?2:1:0,x=+kl(x,p),x<+kl(+ie[v>>3],m)||(U=+kl(+ie[g>>3],p),U>+kl(+ie[_>>3],m))?(E=0,E|0):(E=1,E|0))}function Yce(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0;x=+ie[p+16>>3],M=+ie[p+24>>3],p=x<M,E=+ie[m+16>>3],b=+ie[m+24>>3],v=E<b,m=M-E<b-x,h[g>>2]=p?v|m?1:2:0,h[_>>2]=v?p?1:m?2:1:0}function nq(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0;return+ie[p>>3]<+ie[m>>3]||+ie[p+8>>3]>+ie[m+8>>3]?(_=0,_|0):(_=p+16|0,M=+ie[_>>3],x=+ie[p+24>>3],b=M<x,g=m+16|0,U=+ie[g>>3],v=m+24|0,N=+ie[v>>3],E=U<N,m=x-U<N-M,p=b?E|m?1:2:0,m=E?b?1:m?2:1:0,x=+kl(x,p),x<=+kl(+ie[v>>3],m)?(U=+kl(+ie[_>>3],p),E=U>=+kl(+ie[g>>3],m),E|0):(E=0,E|0))}function iq(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0;v=Q,Q=Q+176|0,_=v,h[_>>2]=4,E=+ie[m>>3],ie[_+8>>3]=E,x=+ie[m+16>>3],ie[_+16>>3]=x,ie[_+24>>3]=E,E=+ie[m+24>>3],ie[_+32>>3]=E,b=+ie[m+8>>3],ie[_+40>>3]=b,ie[_+48>>3]=E,ie[_+56>>3]=b,ie[_+64>>3]=x,m=_+72|0,g=m+96|0;do h[m>>2]=0,m=m+4|0;while((m|0)<(g|0));fu(p|0,_|0,168)|0,Q=v}function rq(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0;K=Q,Q=Q+288|0,U=K+264|0,q=K+96|0,N=K,E=N,M=E+96|0;do h[E>>2]=0,E=E+4|0;while((E|0)<(M|0));return m=vL(m,N)|0,m|0?(X=m,Q=K,X|0):(M=N,N=h[M>>2]|0,M=h[M+4>>2]|0,T1(N,M,U)|0,Vm(N,M,q)|0,b=+Zx(U,q+8|0),ie[U>>3]=+ie[p>>3],M=U+8|0,ie[M>>3]=+ie[p+16>>3],ie[q>>3]=+ie[p+8>>3],N=q+8|0,ie[N>>3]=+ie[p+24>>3],v=+Zx(U,q),ue=+ie[M>>3]-+ie[N>>3],x=+Qs(+ue),ae=+ie[U>>3]-+ie[q>>3],_=+Qs(+ae),!(ue==0|ae==0)&&(ue=+Pq(+x,+_),ue=+b1(+(v*v/+gT(+(ue/+gT(+x,+_)),3)/(b*(b*2.59807621135)*.8))),ie[or>>3]=ue,j=~~ue>>>0,X=+Qs(ue)>=1?ue>0?~~+iL(+fo(ue/4294967296),4294967295)>>>0:~~+b1((ue-+(~~ue>>>0))/4294967296)>>>0:0,(h[or+4>>2]&2146435072|0)!=2146435072)?(q=(j|0)==0&(X|0)==0,m=g,h[m>>2]=q?1:j,h[m+4>>2]=q?0:X,m=0):m=1,X=m,Q=K,X|0)}function Zce(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0;N=Q,Q=Q+288|0,b=N+264|0,E=N+96|0,M=N,v=M,x=v+96|0;do h[v>>2]=0,v=v+4|0;while((v|0)<(x|0));return g=vL(g,M)|0,g|0?(_=g,Q=N,_|0):(g=M,v=h[g>>2]|0,g=h[g+4>>2]|0,T1(v,g,b)|0,Vm(v,g,E)|0,U=+Zx(b,E+8|0),U=+b1(+(+Zx(p,m)/(U*2))),ie[or>>3]=U,g=~~U>>>0,v=+Qs(U)>=1?U>0?~~+iL(+fo(U/4294967296),4294967295)>>>0:~~+b1((U-+(~~U>>>0))/4294967296)>>>0:0,(h[or+4>>2]&2146435072|0)==2146435072?(_=1,Q=N,_|0):(M=(g|0)==0&(v|0)==0,h[_>>2]=M?1:g,h[_+4>>2]=M?0:v,_=0,Q=N,_|0))}function Kce(p,m){p=p|0,m=+m;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0;x=p+16|0,b=+ie[x>>3],g=p+24|0,v=+ie[g>>3],_=b-v,_=b<v?_+6.283185307179586:_,N=+ie[p>>3],E=p+8|0,M=+ie[E>>3],U=N-M,_=(_*m-_)*.5,m=(U*m-U)*.5,N=N+m,ie[p>>3]=N>1.5707963267948966?1.5707963267948966:N,m=M-m,ie[E>>3]=m<-1.5707963267948966?-1.5707963267948966:m,m=b+_,m=m>3.141592653589793?m+-6.283185307179586:m,ie[x>>3]=m<-3.141592653589793?m+6.283185307179586:m,m=v-_,m=m>3.141592653589793?m+-6.283185307179586:m,ie[g>>3]=m<-3.141592653589793?m+6.283185307179586:m}function Qce(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0,be=0,gt=0,je=0,Ut=0,lt=0,pt=0;if(pt=Q,Q=Q+224|0,gt=pt,Be=pt+48|0,M=(g|0)>0|(g|0)==0&m>>>0>0,M&(g>>>0>0|(g|0)==0&m>>>0>17895697))return lt=14,Q=pt,lt|0;if((g|0)<0)return lt=2,Q=pt,lt|0;if((m|0)==0&(g|0)==0)return h[_>>2]=0,h[_+4>>2]=0,lt=0,Q=pt,lt|0;for(v=p,v=hL(h[v>>2]|0,h[v+4>>2]|0)|0,b=0,E=0;;){if(x=p+(b<<3)|0,lt=x,!(cT(h[lt>>2]|0,h[lt+4>>2]|0)|0)){v=5,je=159;break}if(lt=x,lt=(hL(h[lt>>2]|0,h[lt+4>>2]|0)|0)==(v|0),b=At(b|0,E|0,1,0)|0,E=ee()|0,!lt){v=12,je=159;break}if(!((E|0)<(g|0)|(E|0)==(g|0)&b>>>0<m>>>0)){je=8;break}}if((je|0)==8){do if((g|0)>0|(g|0)==0&m>>>0>1){if(v=m<<3,b=br(v)|0,!b)return lt=13,Q=pt,lt|0;for(fu(b|0,p|0,v|0)|0,dT(b,m,8,1),v=1,x=0;Ut=b+(v<<3)|0,lt=b+(v+-1<<3)|0,lt=(h[Ut>>2]|0)==(h[lt>>2]|0)?(h[Ut+4>>2]|0)==(h[lt+4>>2]|0):0,v=At(v|0,x|0,1,0)|0,x=ee()|0,!lt;)if(!((x|0)<(g|0)|(x|0)==(g|0)&v>>>0<m>>>0)){je=14;break}if((je|0)==14){_t(b);break}return _t(b),lt=10,Q=pt,lt|0}while(!1);if(v=wr(m|0,g|0,6,0)|0,x=ee()|0,M){b=0,E=0;do lt=p+(E<<3)|0,lt=((Zi(h[lt>>2]|0,h[lt+4>>2]|0)|0)!=0)<<31>>31,v=At(v|0,x|0,lt|0,((lt|0)<0)<<31>>31|0)|0,x=ee()|0,E=At(E|0,b|0,1,0)|0,b=ee()|0;while((b|0)<(g|0)|(b|0)==(g|0)&E>>>0<m>>>0);Ae=v,we=x}else Ae=v,we=x;if(xe=wr(Ae|0,we|0,10,0)|0,se=ee()|0,Ut=br(Ae<<5)|0,!Ut)return lt=13,Q=pt,lt|0;if(lt=Ta(xe,4)|0,!lt)return _t(Ut),lt=13,Q=pt,lt|0;e:do if(M){for(be=p,lL(h[be>>2]|0,h[be+4>>2]|0,gt)|0,X=Ut,K=0,ae=0,v=0,ue=0;;){M=gt,M=(h[M>>2]|0)==0&(h[M+4>>2]|0)==0,x=M?26990:26995,b=M?5:6,E=0,M=gt+((M&1)<<3)|0,N=At(b|0,E|0,-1,-1)|0,U=ee()|0,q=0,j=0;do Me=M+(q<<3)|0,Ke=h[Me+4>>2]|0,be=X+(q<<5)|0,h[be>>2]=h[Me>>2],h[be+4>>2]=Ke,He[X+(q<<5)+9>>0]=0,He[X+(q<<5)+8>>0]=0,h[X+(q<<5)+20>>2]=X,be=X+(q<<5)+24|0,h[be>>2]=1,h[be+4>>2]=0,be=He[x+q>>0]|0,Ke=At(N|0,U|0,q|0,j|0)|0,Ke=Wf(Ke|0,ee()|0,b|0,E|0)|0,ee()|0,Ke=He[x+Ke>>0]|0,q=At(q|0,j|0,1,0)|0,j=ee()|0,Me=He[x+((q|0)==(b|0)&(j|0)==(E|0)?0:q)>>0]|0,be=be&255,h[X+(be<<5)+16>>2]=X+((Ke&255)<<5),h[X+(be<<5)+12>>2]=X+((Me&255)<<5);while(j>>>0<E>>>0|(j|0)==(E|0)&q>>>0<b>>>0);if(K=At(K|0,ae|0,1,0)|0,ae=ee()|0,v=At(b|0,E|0,v|0,ue|0)|0,ue=ee()|0,!((ae|0)<(g|0)|(ae|0)==(g|0)&K>>>0<m>>>0))break e;be=p+(K<<3)|0,lL(h[be>>2]|0,h[be+4>>2]|0,gt)|0||(X=Ut+(v<<5)|0)}di(27634,26956,108,26975)}while(!1);if((we|0)>0|(we|0)==0&Ae>>>0>0){E=0,M=0;do{if(x=Ut+(E<<5)|0,b=h[x>>2]|0,x=h[x+4>>2]|0,v=tt(b|0,x|0,30)|0,x=wr(v^b|0,(ee()|0)^x|0,484763065,-1084733587)|0,b=ee()|0,v=tt(x|0,b|0,27)|0,b=wr(v^x|0,(ee()|0)^b|0,321982955,-1798288965)|0,x=ee()|0,v=tt(b|0,x|0,31)|0,x=Wf(v^b|0,(ee()|0)^x|0,xe|0,se|0)|0,b=ee()|0,v=lt+(x<<2)|0,h[v>>2]|0)do v=At(x|0,b|0,1,0)|0,x=lp(v|0,ee()|0,xe|0,se|0)|0,b=ee()|0,v=lt+(x<<2)|0;while((h[v>>2]|0)!=0);h[v>>2]=Ut+(E<<5),E=At(E|0,M|0,1,0)|0,M=ee()|0}while((M|0)<(we|0)|(M|0)==(we|0)&E>>>0<Ae>>>0);q=0,j=0;do{if(E=Ut+(q<<5)|0,M=Ut+(q<<5)+9|0,!(He[M>>0]|0)){if(be=E,oq(h[be>>2]|0,h[be+4>>2]|0,gt)|0){je=39;break}U=gt,N=h[U>>2]|0,U=h[U+4>>2]|0,x=tt(N|0,U|0,30)|0,x=wr(x^N|0,(ee()|0)^U|0,484763065,-1084733587)|0,b=ee()|0,v=tt(x|0,b|0,27)|0,b=wr(v^x|0,(ee()|0)^b|0,321982955,-1798288965)|0,x=ee()|0,v=tt(b|0,x|0,31)|0,x=Wf(v^b|0,(ee()|0)^x|0,xe|0,se|0)|0,b=ee()|0,v=h[lt+(x<<2)>>2]|0;e:do if(v|0){for(;be=v,!((h[be>>2]|0)==(N|0)&&(h[be+4>>2]|0)==(U|0));)if(v=At(x|0,b|0,1,0)|0,x=lp(v|0,ee()|0,xe|0,se|0)|0,b=ee()|0,v=h[lt+(x<<2)>>2]|0,!v)break e;He[M>>0]=1,He[v+9>>0]=1,x=v+16|0,be=Ut+(q<<5)+12|0,h[(h[be>>2]|0)+16>>2]=h[x>>2],g=v+12|0,Me=h[Ut+(q<<5)+16>>2]|0,h[Me+12>>2]=h[g>>2],h[(h[g>>2]|0)+16>>2]=Me,h[(h[x>>2]|0)+12>>2]=h[be>>2],x=lT(E)|0,be=lT(v)|0,v=x+24|0,g=h[v+4>>2]|0,Me=be+24|0,Ke=h[Me+4>>2]|0,Me=(g|0)<(Ke|0)|((g|0)==(Ke|0)?(h[v>>2]|0)>>>0<(h[Me>>2]|0)>>>0:0),v=Me?x:be,x=Me?be:x,(x|0)!=(v|0)&&(Ke=v+24|0,be=x+24|0,Me=be,Ke=At(h[Me>>2]|0,h[Me+4>>2]|0,h[Ke>>2]|0,h[Ke+4>>2]|0)|0,Me=ee()|0,h[be>>2]=Ke,h[be+4>>2]=Me,h[v+20>>2]=x)}while(!1)}q=At(q|0,j|0,1,0)|0,j=ee()|0}while((j|0)<(we|0)|(j|0)==(we|0)&q>>>0<Ae>>>0);(je|0)==39&&di(27634,26956,258,27001),v=0,x=0;do He[Ut+(v<<5)+8>>0]=0,v=At(v|0,x|0,1,0)|0,x=ee()|0;while((x|0)<(we|0)|(x|0)==(we|0)&v>>>0<Ae>>>0);for(N=0,b=0,M=0,U=0;;){if(v=Ut+(N<<5)|0,(He[Ut+(N<<5)+8>>0]|0)==0&&(He[Ut+(N<<5)+9>>0]|0)==0){E=v,x=h[E>>2]|0,E=h[E+4>>2]|0;do He[v+8>>0]=1,v=h[v+12>>2]|0,be=v;while(!((h[be>>2]|0)==(x|0)&&(h[be+4>>2]|0)==(E|0)));b=At(b|0,M|0,1,0)|0,E=ee()|0}else E=M;if(N=At(N|0,U|0,1,0)|0,U=ee()|0,(U|0)<(we|0)|(U|0)==(we|0)&N>>>0<Ae>>>0)M=E;else break}v=0,x=0;do He[Ut+(v<<5)+8>>0]=0,v=At(v|0,x|0,1,0)|0,x=ee()|0;while((x|0)<(we|0)|(x|0)==(we|0)&v>>>0<Ae>>>0);Me=b,Ke=E,v=1}else Me=0,Ke=0,v=0;be=br(Me*24|0)|0;e:do if(be|0){t:do if(v){p=0,xe=0,g=0,m=0;n:for(;;){if(v=Ut+(p<<5)|0,(He[Ut+(p<<5)+8>>0]|0)==0&&(He[Ut+(p<<5)+9>>0]|0)==0){ue=v,ae=h[ue>>2]|0,ue=h[ue+4>>2]|0,x=0,b=0;do x=At(x|0,b|0,2,0)|0,b=ee()|0,v=h[v+12>>2]|0,se=v;while(!((h[se>>2]|0)==(ae|0)&&(h[se+4>>2]|0)==(ue|0)));if(K=br(x<<4)|0,!K)break;x=ae,b=ue,X=0,j=0,E=0,M=0;do{if(jx(x,b,Be)|0){je=69;break n}if(se=h[Be>>2]|0,U=se+-1|0,q=((U|0)<0)<<31>>31,(se|0)>1){b=E,N=0,x=M,E=0;do se=K+(b<<4)|0,M=Be+8+(N<<4)|0,h[se>>2]=h[M>>2],h[se+4>>2]=h[M+4>>2],h[se+8>>2]=h[M+8>>2],h[se+12>>2]=h[M+12>>2],b=At(b|0,x|0,1,0)|0,x=ee()|0,N=At(N|0,E|0,1,0)|0,E=ee()|0;while((E|0)<(q|0)|(E|0)==(q|0)&N>>>0<U>>>0);E=b,M=x}X=At(X|0,j|0,U|0,q|0)|0,j=ee()|0,He[v+8>>0]=1,v=h[v+12>>2]|0,b=v,x=h[b>>2]|0,b=h[b+4>>2]|0}while(!((x|0)==(ae|0)&(b|0)==(ue|0)));if(x=Jue(K,X<<4)|0,!x){je=75;break}ue=lT(v)|0,se=h[ue+4>>2]|0,v=be+(g*24|0)|0,h[v>>2]=h[ue>>2],h[v+4>>2]=se,v=be+(g*24|0)+16|0,h[v>>2]=X,h[be+(g*24|0)+20>>2]=x,h[gt>>2]=h[v>>2],h[gt+4>>2]=h[v+4>>2],_c(gt,be+(g*24|0)+8|0)|0,x=At(g|0,xe|0,1,0)|0,v=ee()|0}else x=g,v=xe;if(p=At(p|0,m|0,1,0)|0,m=ee()|0,(m|0)<(we|0)|(m|0)==(we|0)&p>>>0<Ae>>>0)xe=v,g=x;else break t}if((je|0)==69?di(27634,26956,351,27016):(je|0)==75&&_t(K),(xe|0)>0|(xe|0)==0&g>>>0>0)for(E=0,M=0,v=g,b=xe;x=h[be+(E*24|0)+20>>2]|0,x?(_t(x),x=xe,v=g):x=b,E=At(E|0,M|0,1,0)|0,M=ee()|0,(M|0)<(x|0)|(M|0)==(x|0)&E>>>0<v>>>0;)b=x;_t(be);break e}while(!1);dT(be,Me,24,2);t:do if((Me|0)==0&(Ke|0)==0){if(se=br(192)|0,se|0){if(h[se+16>>2]=0,h[se+20>>2]=0,j=se+8|0,h[j>>2]=3,v=br(48)|0,X=se+12|0,h[X>>2]=v,v|0){h[v>>2]=h[3860],h[v+4>>2]=h[3861],h[v+8>>2]=h[3862],h[v+12>>2]=h[3863],q=v+16|0,h[q>>2]=h[3864],h[q+4>>2]=h[3865],h[q+8>>2]=h[3866],h[q+12>>2]=h[3867],q=v+32|0,h[q>>2]=h[3868],h[q+4>>2]=h[3869],h[q+8>>2]=h[3870],h[q+12>>2]=h[3871],h[gt>>2]=h[j>>2],h[gt+4>>2]=h[j+4>>2],_c(gt,se)|0,h[se+40>>2]=0,h[se+44>>2]=0,q=se+32|0,h[q>>2]=3,v=br(48)|0,K=se+36|0,h[K>>2]=v;do if(!v)E=0,M=1;else{if(h[v>>2]=h[3872],h[v+4>>2]=h[3873],h[v+8>>2]=h[3874],h[v+12>>2]=h[3875],U=v+16|0,h[U>>2]=h[3876],h[U+4>>2]=h[3877],h[U+8>>2]=h[3878],h[U+12>>2]=h[3879],U=v+32|0,h[U>>2]=h[3880],h[U+4>>2]=h[3881],h[U+8>>2]=h[3882],h[U+12>>2]=h[3883],h[gt>>2]=h[q>>2],h[gt+4>>2]=h[q+4>>2],_c(gt,se+24|0)|0,h[se+64>>2]=0,h[se+68>>2]=0,U=se+56|0,h[U>>2]=3,v=br(48)|0,ae=se+60|0,h[ae>>2]=v,!v){E=0,M=2;break}if(h[v>>2]=h[3884],h[v+4>>2]=h[3885],h[v+8>>2]=h[3886],h[v+12>>2]=h[3887],N=v+16|0,h[N>>2]=h[3888],h[N+4>>2]=h[3889],h[N+8>>2]=h[3890],h[N+12>>2]=h[3891],N=v+32|0,h[N>>2]=h[3892],h[N+4>>2]=h[3893],h[N+8>>2]=h[3894],h[N+12>>2]=h[3895],h[gt>>2]=h[U>>2],h[gt+4>>2]=h[U+4>>2],_c(gt,se+48|0)|0,h[se+88>>2]=0,h[se+92>>2]=0,N=se+80|0,h[N>>2]=3,v=br(48)|0,ue=se+84|0,h[ue>>2]=v,!v){E=0,M=3;break}if(h[v>>2]=h[3896],h[v+4>>2]=h[3897],h[v+8>>2]=h[3898],h[v+12>>2]=h[3899],M=v+16|0,h[M>>2]=h[3900],h[M+4>>2]=h[3901],h[M+8>>2]=h[3902],h[M+12>>2]=h[3903],M=v+32|0,h[M>>2]=h[3904],h[M+4>>2]=h[3905],h[M+8>>2]=h[3906],h[M+12>>2]=h[3907],h[gt>>2]=h[N>>2],h[gt+4>>2]=h[N+4>>2],_c(gt,se+72|0)|0,h[se+112>>2]=0,h[se+116>>2]=0,M=se+104|0,h[M>>2]=3,v=br(48)|0,p=se+108|0,h[p>>2]=v,!v){E=0,M=4;break}if(h[v>>2]=h[3908],h[v+4>>2]=h[3909],h[v+8>>2]=h[3910],h[v+12>>2]=h[3911],E=v+16|0,h[E>>2]=h[3912],h[E+4>>2]=h[3913],h[E+8>>2]=h[3914],h[E+12>>2]=h[3915],E=v+32|0,h[E>>2]=h[3916],h[E+4>>2]=h[3917],h[E+8>>2]=h[3918],h[E+12>>2]=h[3919],h[gt>>2]=h[M>>2],h[gt+4>>2]=h[M+4>>2],_c(gt,se+96|0)|0,h[se+136>>2]=0,h[se+140>>2]=0,E=se+128|0,h[E>>2]=3,v=br(48)|0,m=se+132|0,h[m>>2]=v,!v){E=0,M=5;break}if(h[v>>2]=h[3920],h[v+4>>2]=h[3921],h[v+8>>2]=h[3922],h[v+12>>2]=h[3923],b=v+16|0,h[b>>2]=h[3924],h[b+4>>2]=h[3925],h[b+8>>2]=h[3926],h[b+12>>2]=h[3927],b=v+32|0,h[b>>2]=h[3928],h[b+4>>2]=h[3929],h[b+8>>2]=h[3930],h[b+12>>2]=h[3931],h[gt>>2]=h[E>>2],h[gt+4>>2]=h[E+4>>2],_c(gt,se+120|0)|0,h[se+160>>2]=0,h[se+164>>2]=0,b=se+152|0,h[b>>2]=3,v=br(48)|0,g=se+156|0,h[g>>2]=v,!v){E=0,M=6;break}if(h[v>>2]=h[3932],h[v+4>>2]=h[3933],h[v+8>>2]=h[3934],h[v+12>>2]=h[3935],x=v+16|0,h[x>>2]=h[3936],h[x+4>>2]=h[3937],h[x+8>>2]=h[3938],h[x+12>>2]=h[3939],x=v+32|0,h[x>>2]=h[3940],h[x+4>>2]=h[3941],h[x+8>>2]=h[3942],h[x+12>>2]=h[3943],h[gt>>2]=h[b>>2],h[gt+4>>2]=h[b+4>>2],_c(gt,se+144|0)|0,h[se+184>>2]=0,h[se+188>>2]=0,x=se+176|0,h[x>>2]=3,v=br(48)|0,xe=se+180|0,h[xe>>2]=v,!v){E=0,M=7;break}if(h[v>>2]=h[3944],h[v+4>>2]=h[3945],h[v+8>>2]=h[3946],h[v+12>>2]=h[3947],Be=v+16|0,h[Be>>2]=h[3948],h[Be+4>>2]=h[3949],h[Be+8>>2]=h[3950],h[Be+12>>2]=h[3951],v=v+32|0,h[v>>2]=h[3952],h[v+4>>2]=h[3953],h[v+8>>2]=h[3954],h[v+12>>2]=h[3955],h[gt>>2]=h[x>>2],h[gt+4>>2]=h[x+4>>2],_c(gt,se+168|0)|0,dT(se,8,24,3),v=br(128)|0,h[_+4>>2]=v,v|0){h[_>>2]=8,h[v>>2]=h[j>>2],h[v+4>>2]=h[j+4>>2],h[v+8>>2]=h[j+8>>2],h[v+12>>2]=h[j+12>>2],je=v+16|0,h[je>>2]=h[q>>2],h[je+4>>2]=h[q+4>>2],h[je+8>>2]=h[q+8>>2],h[je+12>>2]=h[q+12>>2],je=v+32|0,h[je>>2]=h[U>>2],h[je+4>>2]=h[U+4>>2],h[je+8>>2]=h[U+8>>2],h[je+12>>2]=h[U+12>>2],je=v+48|0,h[je>>2]=h[N>>2],h[je+4>>2]=h[N+4>>2],h[je+8>>2]=h[N+8>>2],h[je+12>>2]=h[N+12>>2],je=v+64|0,h[je>>2]=h[M>>2],h[je+4>>2]=h[M+4>>2],h[je+8>>2]=h[M+8>>2],h[je+12>>2]=h[M+12>>2],je=v+80|0,h[je>>2]=h[E>>2],h[je+4>>2]=h[E+4>>2],h[je+8>>2]=h[E+8>>2],h[je+12>>2]=h[E+12>>2],je=v+96|0,h[je>>2]=h[b>>2],h[je+4>>2]=h[b+4>>2],h[je+8>>2]=h[b+8>>2],h[je+12>>2]=h[b+12>>2],je=v+112|0,h[je>>2]=h[x>>2],h[je+4>>2]=h[x+4>>2],h[je+8>>2]=h[x+8>>2],h[je+12>>2]=h[x+12>>2],_t(se),je=158;break t}v=h[X>>2]|0,v|0&&_t(v),v=h[K>>2]|0,v|0&&_t(v),v=h[ae>>2]|0,v|0&&_t(v),v=h[ue>>2]|0,v|0&&_t(v),v=h[p>>2]|0,v|0&&_t(v),v=h[m>>2]|0,v|0&&_t(v),v=h[g>>2]|0,v|0&&_t(v),v=h[xe>>2]|0,v|0&&_t(v),_t(se);break t}while(!1);v=0,b=0;do x=h[se+(v*24|0)+12>>2]|0,x|0&&_t(x),v=At(v|0,b|0,1,0)|0,b=ee()|0;while(b>>>0<E>>>0|(b|0)==(E|0)&v>>>0<M>>>0)}_t(se),je=152}}else{if((Ke|0)>0|(Ke|0)==0&Me>>>0>0){b=0,E=0,M=0,x=0,v=0,N=0;do Be=be+(b*24|0)|0,gt=E,E=h[Be>>2]|0,je=M,M=h[Be+4>>2]|0,x=At(x|0,v|0,((E|0)!=(gt|0)|(M|0)!=(je|0))&1|0,0)|0,v=ee()|0,b=At(b|0,N|0,1,0)|0,N=ee()|0;while((N|0)<(Ke|0)|(N|0)==(Ke|0)&b>>>0<Me>>>0);ue=x,ae=v}else ue=0,ae=0;if(p=br(ue*24|0)|0,p){n:do if((Ke|0)>=0){for(j=0,X=0,x=0,b=0,K=0,E=0;;){if(!((j|0)==(Me|0)&(X|0)==(Ke|0))&&(gt=be+(x*24|0)|0,je=be+(j*24|0)|0,(h[gt>>2]|0)==(h[je>>2]|0)?(h[gt+4>>2]|0)==(h[je+4>>2]|0):0))v=K;else{if(U=be+(x*24|0)|0,je=eo(j|0,X|0,x|0,b|0)|0,gt=ee()|0,q=At(je|0,gt|0,-1,-1)|0,b=ee()|0,(gt|0)>0|(gt|0)==0&je>>>0>1){if(v=br(q<<3)|0,!v)break;M=0,N=0;do je=M,M=At(M|0,N|0,1,0)|0,N=ee()|0,Be=U+(M*24|0)+16|0,gt=h[Be+4>>2]|0,je=v+(je<<3)|0,h[je>>2]=h[Be>>2],h[je+4>>2]=gt;while((N|0)<(b|0)|(N|0)==(b|0)&M>>>0<q>>>0)}else v=0;gt=be+(x*24|0)+16|0,je=h[gt+4>>2]|0,b=p+(E*24|0)+8|0,h[b>>2]=h[gt>>2],h[b+4>>2]=je,h[p+(E*24|0)+16>>2]=q,h[p+(E*24|0)+20>>2]=v,ie[p+(E*24|0)>>3]=+ie[be+(x*24|0)+8>>3],E=At(E|0,K|0,1,0)|0,x=j,b=X,v=ee()|0}if(je=j,j=At(j|0,X|0,1,0)|0,gt=X,X=ee()|0,(gt|0)<(Ke|0)|(gt|0)==(Ke|0)&je>>>0<Me>>>0)K=v;else break n}if((K|0)>0|(K|0)==0&E>>>0>0){v=0,b=0;do x=h[p+(v*24|0)+20>>2]|0,x|0&&_t(x),v=At(v|0,b|0,1,0)|0,b=ee()|0;while((b|0)<(K|0)|(b|0)==(K|0)&v>>>0<E>>>0)}_t(p),je=152;break t}while(!1);if(dT(p,ue,24,3),v=br(ue<<4)|0,b=_+4|0,h[b>>2]=v,v){h[_>>2]=ue;do if((ae|0)>0|(ae|0)==0&ue>>>0>0){if(_=p+8|0,h[v>>2]=h[_>>2],h[v+4>>2]=h[_+4>>2],h[v+8>>2]=h[_+8>>2],h[v+12>>2]=h[_+12>>2],(ue|0)==1&(ae|0)==0||(_=v+16|0,je=p+32|0,h[_>>2]=h[je>>2],h[_+4>>2]=h[je+4>>2],h[_+8>>2]=h[je+8>>2],h[_+12>>2]=h[je+12>>2],!((ae|0)>0|(ae|0)==0&ue>>>0>2)))break;v=2,x=0;do _=(h[b>>2]|0)+(v<<4)|0,je=p+(v*24|0)+8|0,h[_>>2]=h[je>>2],h[_+4>>2]=h[je+4>>2],h[_+8>>2]=h[je+8>>2],h[_+12>>2]=h[je+12>>2],v=At(v|0,x|0,1,0)|0,x=ee()|0;while((x|0)<(ae|0)|(x|0)==(ae|0)&v>>>0<ue>>>0)}while(!1);_t(p),je=158;break}else{if((ae|0)>0|(ae|0)==0&ue>>>0>0){v=0,b=0;do x=h[p+(v*24|0)+20>>2]|0,x|0&&_t(x),v=At(v|0,b|0,1,0)|0,b=ee()|0;while((b|0)<(ae|0)|(b|0)==(ae|0)&v>>>0<ue>>>0)}_t(p),je=152;break}}else je=152}while(!1);if((je|0)==158)return _t(Ut),_t(lt),_t(be),lt=0,Q=pt,lt|0;if((je|0)==152&&(Ke|0)>0|(Ke|0)==0&Me>>>0>0)for(E=0,M=0,v=Me,b=Ke;x=h[be+(E*24|0)+20>>2]|0,x?(_t(x),x=Ke,v=Me):x=b,E=At(E|0,M|0,1,0)|0,M=ee()|0,(M|0)<(x|0)|(M|0)==(x|0)&E>>>0<v>>>0;)b=x;return _t(be),_t(Ut),_t(lt),lt=13,Q=pt,lt|0}while(!1);return _t(Ut),_t(lt),lt=13,Q=pt,lt|0}else if((je|0)==159)return Q=pt,v|0;return 0}function Jce(p,m){p=p|0,m=m|0;var g=0,_=0;return _=p,p=h[_>>2]|0,_=h[_+4>>2]|0,g=m,m=h[g>>2]|0,g=h[g+4>>2]|0,(_>>>0<g>>>0|(_|0)==(g|0)&p>>>0<m>>>0?-1:(_>>>0>g>>>0|(_|0)==(g|0)&p>>>0>m>>>0)&1)|0}function lT(p){p=p|0;var m=0,g=0;return m=p+20|0,g=h[m>>2]|0,(g|0)==(p|0)?p|0:(g=lT(g)|0,h[m>>2]=g,g|0)}function eue(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0;return E=p,b=h[E>>2]|0,E=h[E+4>>2]|0,x=m,v=h[x>>2]|0,x=h[x+4>>2]|0,E>>>0<x>>>0|(E|0)==(x|0)&b>>>0<v>>>0?(m=-1,m|0):E>>>0>x>>>0|(E|0)==(x|0)&b>>>0>v>>>0?(m=1,m|0):(_=+ie[p+8>>3],g=+ie[m+8>>3],_<g?(m=-1,m|0):(m=_>g&1,m|0))}function tue(p,m){p=p|0,m=m|0;var g=0,_=0;return _=+ie[p>>3],g=+ie[m>>3],(_>g?-1:_<g&1)|0}function nue(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0;if(q=Q,Q=Q+64|0,U=q,E=q+56|0,!(!0&(m&2013265920|0)==134217728&(!0&(_&2013265920|0)==134217728)))return v=5,Q=q,v|0;if((p|0)==(g|0)&(m|0)==(_|0))return h[v>>2]=0,v=0,Q=q,v|0;if(b=tt(p|0,m|0,52)|0,ee()|0,b=b&15,N=tt(g|0,_|0,52)|0,ee()|0,(b|0)!=(N&15|0))return v=12,Q=q,v|0;if(x=b+-1|0,b>>>0>1){dL(p,m,x,U)|0,dL(g,_,x,E)|0,N=U,M=h[N>>2]|0,N=h[N+4>>2]|0;e:do if((M|0)==(h[E>>2]|0)&&(N|0)==(h[E+4>>2]|0)){b=(b^15)*3|0,x=tt(p|0,m|0,b|0)|0,ee()|0,x=x&7,b=tt(g|0,_|0,b|0)|0,ee()|0,b=b&7;do if((x|0)==0|(b|0)==0)h[v>>2]=1,x=0;else if((x|0)==7)x=5;else{if((x|0)==1|(b|0)==1&&Zi(M,N)|0){x=5;break}if((h[15824+(x<<2)>>2]|0)!=(b|0)&&(h[15856+(x<<2)>>2]|0)!=(b|0))break e;h[v>>2]=1,x=0}while(!1);return v=x,Q=q,v|0}while(!1)}x=U,b=x+56|0;do h[x>>2]=0,x=x+4|0;while((x|0)<(b|0));return $G(p,m,1,U)|0,m=U,!((h[m>>2]|0)==(g|0)&&(h[m+4>>2]|0)==(_|0))&&(m=U+8|0,!((h[m>>2]|0)==(g|0)&&(h[m+4>>2]|0)==(_|0)))&&(m=U+16|0,!((h[m>>2]|0)==(g|0)&&(h[m+4>>2]|0)==(_|0)))&&(m=U+24|0,!((h[m>>2]|0)==(g|0)&&(h[m+4>>2]|0)==(_|0)))&&(m=U+32|0,!((h[m>>2]|0)==(g|0)&&(h[m+4>>2]|0)==(_|0)))&&(m=U+40|0,!((h[m>>2]|0)==(g|0)&&(h[m+4>>2]|0)==(_|0)))?(x=U+48|0,x=((h[x>>2]|0)==(g|0)?(h[x+4>>2]|0)==(_|0):0)&1):x=1,h[v>>2]=x,v=0,Q=q,v|0}function iue(p,m,g,_,v){return p=p|0,m=m|0,g=g|0,_=_|0,v=v|0,g=aT(p,m,g,_)|0,(g|0)==7?(v=11,v|0):(_=ft(g|0,0,56)|0,m=m&-2130706433|(ee()|0)|268435456,h[v>>2]=p|_,h[v+4>>2]=m,v=0,v|0)}function rue(p,m,g){return p=p|0,m=m|0,g=g|0,!0&(m&2013265920|0)==268435456?(h[g>>2]=p,h[g+4>>2]=m&-2130706433|134217728,g=0,g|0):(g=6,g|0)}function sue(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0;return v=Q,Q=Q+16|0,_=v,h[_>>2]=0,!0&(m&2013265920|0)==268435456?(x=tt(p|0,m|0,56)|0,ee()|0,_=Js(p,m&-2130706433|134217728,x&7,_,g)|0,Q=v,_|0):(_=6,Q=v,_|0)}function sq(p,m){p=p|0,m=m|0;var g=0;switch(g=tt(p|0,m|0,56)|0,ee()|0,g&7){case 0:case 7:return g=0,g|0;default:}return g=m&-2130706433|134217728,!(!0&(m&2013265920|0)==268435456)||!0&(m&117440512|0)==16777216&(Zi(p,g)|0)!=0?(g=0,g|0):(g=cT(p,g)|0,g|0)}function oue(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0;return v=Q,Q=Q+16|0,_=v,!0&(m&2013265920|0)==268435456?(x=m&-2130706433|134217728,b=g,h[b>>2]=p,h[b+4>>2]=x,h[_>>2]=0,m=tt(p|0,m|0,56)|0,ee()|0,_=Js(p,x,m&7,_,g+8|0)|0,Q=v,_|0):(_=6,Q=v,_|0)}function lL(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0;return v=(Zi(p,m)|0)==0,m=m&-2130706433,_=g,h[_>>2]=v?p:0,h[_+4>>2]=v?m|285212672:0,_=g+8|0,h[_>>2]=p,h[_+4>>2]=m|301989888,_=g+16|0,h[_>>2]=p,h[_+4>>2]=m|318767104,_=g+24|0,h[_>>2]=p,h[_+4>>2]=m|335544320,_=g+32|0,h[_>>2]=p,h[_+4>>2]=m|352321536,g=g+40|0,h[g>>2]=p,h[g+4>>2]=m|369098752,0}function jx(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0;return b=Q,Q=Q+16|0,v=b,x=m&-2130706433|134217728,!0&(m&2013265920|0)==268435456?(_=tt(p|0,m|0,56)|0,ee()|0,_=Zue(p,x,_&7)|0,(_|0)==-1?(h[g>>2]=0,x=6,Q=b,x|0):(S1(p,x,v)|0&&di(27634,27035,282,27050),m=tt(p|0,m|0,52)|0,ee()|0,m=m&15,Zi(p,x)|0?cL(v,m,_,2,g):uL(v,m,_,2,g),x=0,Q=b,x|0)):(x=6,Q=b,x|0)}function oq(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0;return b=Q,Q=Q+16|0,_=b+8|0,v=b,x=m&-2130706433|134217728,!0&(m&2013265920|0)==268435456?(h[_>>2]=0,m=tt(p|0,m|0,56)|0,ee()|0,m=Js(p,x,m&7,_,v)|0,m|0?(g=m,Q=b,g|0):(_=h[v>>2]|0,v=h[v+4>>2]|0,m=aT(_,v,p,x)|0,(m|0)==7?(g=11,Q=b,g|0):(p=ft(m|0,0,56)|0,x=v&-2130706433|(ee()|0)|268435456,h[g>>2]=_|p,h[g+4>>2]=x,g=0,Q=b,g|0))):(g=6,Q=b,g|0)}function aue(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0;h[g>>2]=0,N=+ie[p>>3],U=+ie[p+8>>3],M=+ie[p+16>>3],v=0,x=5,_=5,p=0;do ae=+ie[15888+(v*24|0)>>3]-N,K=+ie[15888+(v*24|0)+8>>3]-U,b=+ie[15888+(v*24|0)+16>>3]-M,b=ae*ae+K*K+b*b,b<_&&(h[g>>2]=v,x=b,p=v,_=b),v=v+1|0;while((v|0)!=20);if(x=+xce(+(1-x*.5)),x<1e-16)M=0,b=0;else{if(Ae=+ie[16368+(p*24|0)>>3],se=+ie[15888+(p*24|0)>>3],we=+ie[15888+(p*24|0)+8>>3],xe=+ie[15888+(p*24|0)+16>>3],Be=-(xe+(se*0+we*0)),b=se*Be+0,ae=we*Be+0,Be=xe*Be+1,ue=+bs(+(Be*Be+(b*b+ae*ae))),ue=ue>0?1/ue:0,b=b*ue,ae=ae*ue,ue=Be*ue,Be=-(N*se+U*we+M*xe),K=N+se*Be,_=U+we*Be,N=M+xe*Be,U=+bs(+(N*N+(K*K+_*_))),U=U>0?1/U:0,K=K*U,_=_*U,U=N*U,_=+Yx(Ae-+Yx(+Sa(+(U*(we*b-se*ae)+(K*(xe*ae-we*ue)+_*(se*ue-xe*b))),+(ue*U+(b*K+ae*_))))),xc(m)|0?b=+Yx(_+-.3334731722518321):b=_,_=+oT(+x)*2.618033988749896,(m|0)>0){p=0;do _=_*2.6457513110645907,p=p+1|0;while((p|0)!=(m|0))}M=+ii(+b)*_,b=+zi(+b)*_}m=g+4|0,X=g+12|0,h[X>>2]=0,x=+Qs(+b)*1.1547005383792515,_=+Qs(+M)+x*.5,p=~~_,v=~~x,_=_-+(p|0),x=x-+(v|0);do if(_<.5)if(_<.3333333333333333)if(h[m>>2]=p,x<(_+1)*.5){h[g+8>>2]=v;break}else{v=v+1|0,h[g+8>>2]=v;break}else if(Be=1-_,v=(!(x<Be)&1)+v|0,h[g+8>>2]=v,Be<=x&x<_*2){p=p+1|0,h[m>>2]=p;break}else{h[m>>2]=p;break}else{if(!(_<.6666666666666666))if(p=p+1|0,h[m>>2]=p,x<_*.5){h[g+8>>2]=v;break}else{v=v+1|0,h[g+8>>2]=v;break}if(x<1-_){if(h[g+8>>2]=v,_*2+-1<x){h[m>>2]=p;break}}else v=v+1|0,h[g+8>>2]=v;p=p+1|0,h[m>>2]=p}while(!1);do if(M<0)if(v&1){j=(v+1|0)/2|0,j=eo(p|0,((p|0)<0)<<31>>31|0,j|0,((j|0)<0)<<31>>31|0)|0,p=~~(+(p|0)-((+(j>>>0)+4294967296*+(ee()|0))*2+1)),h[m>>2]=p,j=m;break}else{j=(v|0)/2|0,j=eo(p|0,((p|0)<0)<<31>>31|0,j|0,((j|0)<0)<<31>>31|0)|0,p=~~(+(p|0)-(+(j>>>0)+4294967296*+(ee()|0))*2),h[m>>2]=p,j=m;break}else j=m;while(!1);q=g+8|0,m=0-v|0,b<0?(g=p-((v<<1|1|0)/2|0)|0,h[j>>2]=g,h[q>>2]=m,v=m):g=p,p=v-g|0,m=0-g|0,(g|0)<0?(h[q>>2]=p,h[X>>2]=m,h[j>>2]=0,E=0):(p=v,E=g,m=0),g=E-p|0,v=m-p|0,(p|0)<0?(h[j>>2]=g,h[X>>2]=v,h[q>>2]=0,E=g,p=0):v=m,g=E-v|0,m=p-v|0,(v|0)<0?(h[j>>2]=g,h[q>>2]=m,h[X>>2]=0,v=0):(m=p,g=E),p=(m|0)<(g|0)?m:g,p=(v|0)<(p|0)?v:p,!((p|0)<=0)&&(h[j>>2]=g-p,h[q>>2]=m-p,h[X>>2]=v-p)}function lue(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0;_=Q,Q=Q+16|0,v=_,b=h[p+12>>2]|0,x=+((h[p+8>>2]|0)-b|0),ie[v>>3]=+((h[p+4>>2]|0)-b|0)-x*.5,ie[v+8>>3]=x*.8660254037844386,Xx(v,h[p>>2]|0,m,0,g),Q=_}function Xx(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0;if(x=+Yue(p),x<1e-16){m=15888+(m*24|0)|0,h[v>>2]=h[m>>2],h[v+4>>2]=h[m+4>>2],h[v+8>>2]=h[m+8>>2],h[v+12>>2]=h[m+12>>2],h[v+16>>2]=h[m+16>>2],h[v+20>>2]=h[m+20>>2];return}if(b=+Sa(+ +ie[p+8>>3],+ +ie[p>>3]),(g|0)>0){p=0;do x=x*.37796447300922725,p=p+1|0;while((p|0)!=(g|0))}E=x*.3333333333333333,_?(g=(xc(g)|0)==0,x=+jG(+((g?E:E*.37796447300922725)*.381966011250105))):(x=+jG(+(x*.381966011250105)),xc(g)|0&&(b=+Yx(b+.3334731722518321))),q=+Yx(+ie[16368+(m*24|0)>>3]-b),E=+ie[15888+(m*24|0)>>3],U=+ie[15888+(m*24|0)+8>>3],ae=+ie[15888+(m*24|0)+16>>3],X=-(ae+(E*0+U*0)),N=E*X+0,b=U*X+0,X=ae*X+1,j=+bs(+(X*X+(N*N+b*b))),j=j>0?1/j:0,N=N*j,b=b*j,j=X*j,X=+ii(+q),q=+zi(+q),ue=+ii(+x),K=+zi(+x),M=ue*E+K*(X*N+q*(ae*b-U*j)),x=ue*U+K*(X*b+q*(E*j-ae*N)),b=ue*ae+K*(X*j+q*(U*N-E*b)),E=+bs(+(b*b+(M*M+x*x))),E=E>0?1/E:0,ie[v>>3]=M*E,ie[v+8>>3]=x*E,ie[v+16>>3]=b*E}function cL(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0,be=0,gt=0,je=0,Ut=0,lt=0,pt=0,pi=0,bi=0,Ro=0,Vn=0,wi=0,Ea=0,Bs=0,os=0,Os=0,ws=0,cl=0,po=0,mo=0,bc=0,Io=0,Pi=0,Gm=0;if(cl=Q,Q=Q+256|0,x=cl+240|0,pi=cl+224|0,os=cl,Os=cl+208|0,ws=cl+192|0,bi=cl+168|0,Ro=cl+152|0,Vn=cl+136|0,wi=cl+120|0,Ea=cl+104|0,Bs=cl+80|0,h[x>>2]=m,h[pi>>2]=h[p>>2],h[pi+4>>2]=h[p+4>>2],h[pi+8>>2]=h[p+8>>2],h[pi+12>>2]=h[p+12>>2],aq(pi,x,os),h[v>>2]=0,pi=_+g+((_|0)==5&1)|0,(pi|0)<=(g|0)){Q=cl;return}Ae=h[x>>2]|0,we=Os+4|0,xe=Os+8|0,se=Os+12|0,Be=ws+8|0,Ke=g+5|0,Me=16848+(Ae<<2)|0,be=bi+8|0,gt=16928+(Ae<<2)|0,je=Ro+8|0,Ut=Vn+8|0,lt=wi+8|0,pt=ws+8|0,X=bi+8|0,ae=bi+16|0,K=Bs+8|0,ue=Bs+16|0,j=g,_=0,b=0,E=0,M=0;e:for(;;){q=os+(((j|0)%5|0)<<4)|0,h[Os>>2]=h[q>>2],h[Os+4>>2]=h[q+4>>2],h[Os+8>>2]=h[q+8>>2],h[Os+12>>2]=h[q+12>>2];do;while((w1(Os,Ae,0,1)|0)==2);if((j|0)>(g|0)&(xc(m)|0)!=0){if(q=h[Os>>2]|0,p=h[we>>2]|0,N=h[xe>>2]|0,x=h[se>>2]|0,po=+(E-M|0),ie[ws>>3]=+(b-M|0)-po*.5,ie[Be>>3]=po*.8660254037844386,M=h[17008+(q*80|0)+(_<<2)>>2]|0,U=h[18608+(q*80|0)+(M*20|0)>>2]|0,E=h[18608+(q*80|0)+(M*20|0)+16>>2]|0,(E|0)>0){b=0,_=N;do Io=x+p|0,Pi=(Io|0)<0,N=_+p-(Pi?Io:0)|0,bc=(N|0)<0,mo=x+_-(Pi?Io:0)-(bc?N:0)|0,x=(mo|0)<0,p=(Pi?0:Io)-(bc?N:0)-(x?mo:0)|0,_=(bc?0:N)-(x?mo:0)|0,mo=x?0:mo,x=(_|0)<(p|0)?_:p,x=(mo|0)<(x|0)?mo:x,N=(x|0)>0,p=p-(N?x:0)|0,_=_-(N?x:0)|0,x=mo-(N?x:0)|0,b=b+1|0;while((b|0)<(E|0))}else _=N;switch(Pi=(h[Me>>2]|0)*3|0,mo=(al(Pi,h[18608+(q*80|0)+(M*20|0)+4>>2]|0)|0)+p|0,N=(al(Pi,h[18608+(q*80|0)+(M*20|0)+8>>2]|0)|0)+_|0,Pi=(al(Pi,h[18608+(q*80|0)+(M*20|0)+12>>2]|0)|0)+x|0,M=(mo|0)<0,N=N-(M?mo:0)|0,bc=(N|0)<0,Pi=Pi+(M?0-mo|0:0)+(bc?0-N|0:0)|0,Io=(Pi|0)<0,mo=(M?0:mo)-(bc?N:0)-(Io?Pi:0)|0,N=(bc?0:N)-(Io?Pi:0)|0,Pi=Io?0:Pi,Io=(N|0)<(mo|0)?N:mo,Io=(Pi|0)<(Io|0)?Pi:Io,bc=(Io|0)>0,Pi=Pi-(bc?Io:0)|0,po=+(N-(bc?Io:0)-Pi|0),ie[bi>>3]=+(mo-(bc?Io:0)-Pi|0)-po*.5,ie[be>>3]=po*.8660254037844386,po=+(h[gt>>2]|0),ie[Ro>>3]=po*3,ie[je>>3]=0,Gm=po*-1.5,ie[Vn>>3]=Gm,ie[Ut>>3]=po*2.598076211353316,ie[wi>>3]=Gm,ie[lt>>3]=po*-2.598076211353316,h[17008+(U*80|0)+(q<<2)>>2]|0){case 1:{p=Vn,_=Ro;break}case 3:{p=wi,_=Vn;break}case 2:{p=Ro,_=wi;break}default:{p=12;break e}}yq(ws,bi,_,p,Ea),Xx(Ea,U,Ae,1,Bs),Pi=h[v>>2]|0,po=+Wx(+ +ie[ue>>3]),Gm=+Sa(+ +ie[K>>3],+ +ie[Bs>>3]),ie[v+8+(Pi<<4)>>3]=po,ie[v+8+(Pi<<4)+8>>3]=Gm,h[v>>2]=(h[v>>2]|0)+1}if((j|0)<(Ke|0)&&(Pi=h[se>>2]|0,po=+((h[xe>>2]|0)-Pi|0),ie[ws>>3]=+((h[we>>2]|0)-Pi|0)-po*.5,ie[pt>>3]=po*.8660254037844386,Xx(ws,h[Os>>2]|0,Ae,1,bi),Pi=h[v>>2]|0,po=+Wx(+ +ie[ae>>3]),Gm=+Sa(+ +ie[X>>3],+ +ie[bi>>3]),ie[v+8+(Pi<<4)>>3]=po,ie[v+8+(Pi<<4)+8>>3]=Gm,h[v>>2]=(h[v>>2]|0)+1),j=j+1|0,(j|0)>=(pi|0)){p=3;break}else _=h[Os>>2]|0,b=h[we>>2]|0,E=h[xe>>2]|0,M=h[se>>2]|0}if((p|0)==3){Q=cl;return}else(p|0)==12&&di(27073,27120,599,27130)}function aq(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0;K=Q,Q=Q+128|0,_=K+64|0,v=K,x=_,b=20208,E=x+60|0;do h[x>>2]=h[b>>2],x=x+4|0,b=b+4|0;while((x|0)<(E|0));x=v,b=20272,E=x+60|0;do h[x>>2]=h[b>>2],x=x+4|0,b=b+4|0;while((x|0)<(E|0));if(U=(xc(h[m>>2]|0)|0)==0,U=U?_:v,X=p+4|0,x=h[X>>2]|0,q=p+8|0,_=h[q>>2]|0,j=p+12|0,v=h[j>>2]|0,b=_+(x<<1)|0,h[X>>2]=b,_=v+(_<<1)|0,h[q>>2]=_,x=(v<<1)+x|0,h[j>>2]=x,v=_-b|0,E=x-b|0,(b|0)<0&&(h[q>>2]=v,h[j>>2]=E,h[X>>2]=0,_=v,b=0,x=E),E=b-_|0,v=x-_|0,(_|0)<0?(h[X>>2]=E,h[j>>2]=v,h[q>>2]=0,_=0):(v=x,E=b),b=E-v|0,x=_-v|0,(v|0)<0?(h[X>>2]=b,h[q>>2]=x,h[j>>2]=0,v=0):(x=_,b=E),_=(x|0)<(b|0)?x:b,_=(v|0)<(_|0)?v:_,(_|0)>0&&(v=v-_|0,x=x-_|0,b=b-_|0,h[X>>2]=b,h[q>>2]=x,h[j>>2]=v),M=(x<<1)+b|0,E=v+(b<<1)|0,h[X>>2]=E,h[q>>2]=M,x=(v<<1)+x|0,h[j>>2]=x,_=M-E|0,v=x-E|0,(E|0)<0?(h[q>>2]=_,h[j>>2]=v,h[X>>2]=0,E=0,x=v):_=M,b=E-_|0,v=x-_|0,(_|0)<0?(h[X>>2]=b,h[j>>2]=v,h[q>>2]=0,E=b,_=0):v=x,b=E-v|0,x=_-v|0,(v|0)<0?(h[X>>2]=b,h[q>>2]=x,h[j>>2]=0,v=0):(x=_,b=E),_=(x|0)<(b|0)?x:b,_=(v|0)<(_|0)?v:_,(_|0)>0&&(h[X>>2]=b-_,h[q>>2]=x-_,h[j>>2]=v-_),xc(h[m>>2]|0)|0&&(x=h[X>>2]|0,b=h[q>>2]|0,v=h[j>>2]|0,_=(b*3|0)+x|0,x=v+(x*3|0)|0,h[X>>2]=x,h[q>>2]=_,b=(v*3|0)+b|0,h[j>>2]=b,v=_-x|0,E=b-x|0,(x|0)<0?(h[q>>2]=v,h[j>>2]=E,h[X>>2]=0,_=v,M=0):(M=x,E=b),x=M-_|0,v=E-_|0,(_|0)<0?(h[X>>2]=x,h[j>>2]=v,h[q>>2]=0,M=x,b=0):(b=_,v=E),x=M-v|0,_=b-v|0,(v|0)<0?(h[X>>2]=x,h[q>>2]=_,h[j>>2]=0,b=_,v=0):x=M,_=(b|0)<(x|0)?b:x,_=(v|0)<(_|0)?v:_,(_|0)>0&&(h[X>>2]=x-_,h[q>>2]=b-_,h[j>>2]=v-_),h[m>>2]=(h[m>>2]|0)+1),h[g>>2]=h[p>>2],v=h[q>>2]|0,_=h[j>>2]|0,m=h[U+4>>2]|0,N=h[U+8>>2]|0,b=(h[U>>2]|0)+(h[X>>2]|0)|0,M=g+4|0,h[M>>2]=b,v=m+v|0,m=g+8|0,h[m>>2]=v,_=N+_|0,N=g+12|0,h[N>>2]=_,x=v-b|0,(b|0)<0&&(_=_-b|0,h[m>>2]=x,h[N>>2]=_,h[M>>2]=0,v=x,b=0),(v|0)<0&&(b=b-v|0,h[M>>2]=b,_=_-v|0,h[N>>2]=_,h[m>>2]=0,v=0),E=b-_|0,x=v-_|0,(_|0)<0?(h[M>>2]=E,h[m>>2]=x,h[N>>2]=0,b=E,_=0):x=v,v=(x|0)<(b|0)?x:b,v=(_|0)<(v|0)?_:v,(v|0)>0&&(h[M>>2]=b-v,h[m>>2]=x-v,h[N>>2]=_-v),h[g+16>>2]=h[p>>2],v=h[q>>2]|0,_=h[j>>2]|0,m=h[U+16>>2]|0,N=h[U+20>>2]|0,b=(h[U+12>>2]|0)+(h[X>>2]|0)|0,M=g+20|0,h[M>>2]=b,v=m+v|0,m=g+24|0,h[m>>2]=v,_=N+_|0,N=g+28|0,h[N>>2]=_,x=v-b|0,(b|0)<0&&(_=_-b|0,h[m>>2]=x,h[N>>2]=_,h[M>>2]=0,v=x,b=0),(v|0)<0&&(b=b-v|0,h[M>>2]=b,_=_-v|0,h[N>>2]=_,h[m>>2]=0,v=0),E=b-_|0,x=v-_|0,(_|0)<0?(h[M>>2]=E,h[m>>2]=x,h[N>>2]=0,b=E,_=0):x=v,v=(x|0)<(b|0)?x:b,v=(_|0)<(v|0)?_:v,(v|0)>0&&(h[M>>2]=b-v,h[m>>2]=x-v,h[N>>2]=_-v),h[g+32>>2]=h[p>>2],v=h[q>>2]|0,_=h[j>>2]|0,m=h[U+28>>2]|0,N=h[U+32>>2]|0,b=(h[U+24>>2]|0)+(h[X>>2]|0)|0,M=g+36|0,h[M>>2]=b,v=m+v|0,m=g+40|0,h[m>>2]=v,_=N+_|0,N=g+44|0,h[N>>2]=_,x=v-b|0,(b|0)<0&&(_=_-b|0,h[m>>2]=x,h[N>>2]=_,h[M>>2]=0,v=x,b=0),(v|0)<0&&(b=b-v|0,h[M>>2]=b,_=_-v|0,h[N>>2]=_,h[m>>2]=0,v=0),E=b-_|0,x=v-_|0,(_|0)<0?(h[M>>2]=E,h[m>>2]=x,h[N>>2]=0,b=E,_=0):x=v,v=(x|0)<(b|0)?x:b,v=(_|0)<(v|0)?_:v,(v|0)>0&&(h[M>>2]=b-v,h[m>>2]=x-v,h[N>>2]=_-v),h[g+48>>2]=h[p>>2],v=h[q>>2]|0,_=h[j>>2]|0,m=h[U+40>>2]|0,N=h[U+44>>2]|0,b=(h[U+36>>2]|0)+(h[X>>2]|0)|0,M=g+52|0,h[M>>2]=b,v=m+v|0,m=g+56|0,h[m>>2]=v,_=N+_|0,N=g+60|0,h[N>>2]=_,x=v-b|0,(b|0)<0&&(_=_-b|0,h[m>>2]=x,h[N>>2]=_,h[M>>2]=0,v=x,b=0),(v|0)<0&&(b=b-v|0,h[M>>2]=b,_=_-v|0,h[N>>2]=_,h[m>>2]=0,v=0),E=b-_|0,x=v-_|0,(_|0)<0?(h[M>>2]=E,h[m>>2]=x,h[N>>2]=0,b=E,_=0):x=v,v=(x|0)<(b|0)?x:b,v=(_|0)<(v|0)?_:v,(v|0)>0&&(h[M>>2]=b-v,h[m>>2]=x-v,h[N>>2]=_-v),h[g+64>>2]=h[p>>2],x=h[q>>2]|0,_=h[j>>2]|0,N=h[U+52>>2]|0,M=h[U+56>>2]|0,b=(h[U+48>>2]|0)+(h[X>>2]|0)|0,m=g+68|0,h[m>>2]=b,x=N+x|0,N=g+72|0,h[N>>2]=x,_=M+_|0,M=g+76|0,h[M>>2]=_,v=x-b|0,(b|0)<0?(_=_-b|0,h[N>>2]=v,h[M>>2]=_,h[m>>2]=0,x=0):(v=x,x=b),(v|0)<0&&(x=x-v|0,h[m>>2]=x,_=_-v|0,h[M>>2]=_,h[N>>2]=0,v=0),E=x-_|0,b=v-_|0,(_|0)<0?(h[m>>2]=E,h[N>>2]=b,h[M>>2]=0,x=E,_=0):b=v,v=(b|0)<(x|0)?b:x,v=(_|0)<(v|0)?_:v,(v|0)<=0){Q=K;return}h[m>>2]=x-v,h[N>>2]=b-v,h[M>>2]=_-v,Q=K}function w1(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0;if(j=h[16928+(m<<2)>>2]|0,q=(_|0)!=0,j=q?j*3|0:j,U=p+4|0,E=h[U>>2]|0,N=p+8|0,x=h[N>>2]|0,q){if(b=p+12|0,_=h[b>>2]|0,v=x+E+_|0,(v|0)==(j|0))return j=1,j|0;M=b}else M=p+12|0,v=h[M>>2]|0,_=v,v=x+E+v|0;if((v|0)<=(j|0))return j=0,j|0;do if((_|0)>0){if(v=h[p>>2]|0,(x|0)>0){v=18608+(v*80|0)+60|0,b=E;break}v=18608+(v*80|0)+40|0,g?(b=E-j|0,g=x+b|0,X=(g|0)<0,x=_+x-(X?g:0)|0,E=(x|0)<0,_=_+b-(X?g:0)-(E?x:0)|0,b=(_|0)<0,g=(X?0:g)-(E?x:0)-(b?_:0)|0,x=(E?0:x)-(b?_:0)|0,_=b?0:_,b=(x|0)<(g|0)?x:g,b=(_|0)<(b|0)?_:b,E=(b|0)>0,x=x-(E?b:0)|0,_=_-(E?b:0)|0,b=g-(E?b:0)+j|0,h[U>>2]=b,h[N>>2]=x,h[M>>2]=_):b=E}else v=18608+((h[p>>2]|0)*80|0)+20|0,b=E;while(!1);if(h[p>>2]=h[v>>2],E=h[v+16>>2]|0,(E|0)>0){g=0;do X=_+b|0,K=(X|0)<0,xe=K?X:0,ae=x+b-xe|0,ue=(ae|0)<0,p=ue?ae:0,b=_+x-xe-p|0,x=(b|0)<0,_=x?0:b,b=x?b:0,x=(ue?0:ae)-b|0,b=(K?0:X)-p-b|0,p=(x|0)<(b|0)?x:b,p=(_|0)<(p|0)?_:p,(p|0)>0&&(b=b-p|0,x=x-p|0,_=_-p|0),g=g+1|0;while((g|0)<(E|0));h[U>>2]=b,h[N>>2]=x,h[M>>2]=_}return ae=h[16848+(m<<2)>>2]|0,ae=q?ae*3|0:ae,ue=al(ae,h[v+8>>2]|0)|0,xe=al(ae,h[v+12>>2]|0)|0,b=(al(ae,h[v+4>>2]|0)|0)+b|0,h[U>>2]=b,x=ue+x|0,h[N>>2]=x,_=xe+_|0,h[M>>2]=_,v=x-b|0,(b|0)<0?(_=_-b|0,h[N>>2]=v,h[M>>2]=_,h[U>>2]=0,x=0):(v=x,x=b),(v|0)<0?(p=x-v|0,h[U>>2]=p,_=_-v|0,h[M>>2]=_,h[N>>2]=0,b=0):(p=x,b=v),x=p-_|0,v=b-_|0,(_|0)<0?(h[U>>2]=x,h[N>>2]=v,h[M>>2]=0,_=0):(v=b,x=p),b=(v|0)<(x|0)?v:x,b=(_|0)<(b|0)?_:b,(b|0)>0&&(x=x-b|0,v=v-b|0,_=_-b|0,h[U>>2]=x,h[N>>2]=v,h[M>>2]=_),q?(xe=(v+x+_|0)==(j|0)?1:2,xe|0):(xe=2,xe|0)}function cue(p,m){p=p|0,m=m|0;var g=0;do g=w1(p,m,0,1)|0;while((g|0)==2);return g|0}function uL(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0,be=0,gt=0,je=0,Ut=0,lt=0,pt=0,pi=0,bi=0,Ro=0,Vn=0,wi=0,Ea=0,Bs=0,os=0,Os=0,ws=0;if(Bs=Q,Q=Q+272|0,x=Bs+256|0,b=Bs+240|0,Vn=Bs,wi=Bs+224|0,Ea=Bs+208|0,je=Bs+184|0,Ut=Bs+168|0,lt=Bs+152|0,pt=Bs+136|0,pi=Bs+120|0,bi=Bs+96|0,h[x>>2]=m,h[b>>2]=h[p>>2],h[b+4>>2]=h[p+4>>2],h[b+8>>2]=h[p+8>>2],h[b+12>>2]=h[p+12>>2],lq(b,x,Vn),h[v>>2]=0,gt=_+g+((_|0)==6&1)|0,(gt|0)<=(g|0)){Q=Bs;return}xe=h[x>>2]|0,se=g+6|0,we=Ea+8|0,Ae=je+8|0,Be=16928+(xe<<2)|0,Ke=Ut+8|0,Me=lt+8|0,be=pt+8|0,ae=h[b>>2]|0,j=wi+4|0,X=wi+8|0,K=wi+12|0,ue=Ea+8|0,M=je+8|0,U=je+16|0,N=bi+8|0,q=bi+16|0,b=0,E=g,_=-1;e:for(;;){if(x=(E|0)%6|0,p=Vn+(x<<4)|0,h[wi>>2]=h[p>>2],h[wi+4>>2]=h[p+4>>2],h[wi+8>>2]=h[p+8>>2],h[wi+12>>2]=h[p+12>>2],p=b,b=w1(wi,xe,0,1)|0,(E|0)>(g|0)&(xc(m)|0)!=0&&(Ro=h[wi>>2]|0,(p|0)!=1&(Ro|0)!=(_|0))){switch(ws=(x+5|0)%6|0,p=h[Vn+(ws<<4)+12>>2]|0,os=+((h[Vn+(ws<<4)+8>>2]|0)-p|0),ie[Ea>>3]=+((h[Vn+(ws<<4)+4>>2]|0)-p|0)-os*.5,ie[we>>3]=os*.8660254037844386,p=h[Vn+(x<<4)+12>>2]|0,os=+((h[Vn+(x<<4)+8>>2]|0)-p|0),ie[je>>3]=+((h[Vn+(x<<4)+4>>2]|0)-p|0)-os*.5,ie[Ae>>3]=os*.8660254037844386,os=+(h[Be>>2]|0),ie[Ut>>3]=os*3,ie[Ke>>3]=0,Os=os*-1.5,ie[lt>>3]=Os,ie[Me>>3]=os*2.598076211353316,ie[pt>>3]=Os,ie[be>>3]=os*-2.598076211353316,h[17008+(ae*80|0)+(((_|0)==(ae|0)?Ro:_)<<2)>>2]|0){case 1:{p=lt,_=Ut;break}case 3:{p=pt,_=lt;break}case 2:{p=Ut,_=pt;break}default:{p=8;break e}}yq(Ea,je,_,p,pi),!(bq(Ea,pi)|0)&&!(bq(je,pi)|0)&&(Xx(pi,ae,xe,1,bi),ws=h[v>>2]|0,os=+Wx(+ +ie[q>>3]),Os=+Sa(+ +ie[N>>3],+ +ie[bi>>3]),ie[v+8+(ws<<4)>>3]=os,ie[v+8+(ws<<4)+8>>3]=Os,h[v>>2]=(h[v>>2]|0)+1)}if((E|0)<(se|0)&&(ws=h[K>>2]|0,os=+((h[X>>2]|0)-ws|0),ie[Ea>>3]=+((h[j>>2]|0)-ws|0)-os*.5,ie[ue>>3]=os*.8660254037844386,Xx(Ea,h[wi>>2]|0,xe,1,je),ws=h[v>>2]|0,os=+Wx(+ +ie[U>>3]),Os=+Sa(+ +ie[M>>3],+ +ie[je>>3]),ie[v+8+(ws<<4)>>3]=os,ie[v+8+(ws<<4)+8>>3]=Os,h[v>>2]=(h[v>>2]|0)+1),E=E+1|0,(E|0)>=(gt|0)){p=3;break}else _=h[wi>>2]|0}if((p|0)==3){Q=Bs;return}else(p|0)==8&&di(27157,27120,766,27202)}function lq(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0;ae=Q,Q=Q+160|0,_=ae+80|0,v=ae,x=_,b=20336,E=x+72|0;do h[x>>2]=h[b>>2],x=x+4|0,b=b+4|0;while((x|0)<(E|0));x=v,b=20416,E=x+72|0;do h[x>>2]=h[b>>2],x=x+4|0,b=b+4|0;while((x|0)<(E|0));q=(xc(h[m>>2]|0)|0)==0,q=q?_:v,K=p+4|0,x=h[K>>2]|0,j=p+8|0,_=h[j>>2]|0,X=p+12|0,v=h[X>>2]|0,b=_+(x<<1)|0,h[K>>2]=b,_=v+(_<<1)|0,h[j>>2]=_,x=(v<<1)+x|0,h[X>>2]=x,v=_-b|0,E=x-b|0,(b|0)<0&&(h[j>>2]=v,h[X>>2]=E,h[K>>2]=0,_=v,b=0,x=E),E=b-_|0,v=x-_|0,(_|0)<0?(h[K>>2]=E,h[X>>2]=v,h[j>>2]=0,_=0):(v=x,E=b),b=E-v|0,x=_-v|0,(v|0)<0?(h[K>>2]=b,h[j>>2]=x,h[X>>2]=0,v=0):(x=_,b=E),_=(x|0)<(b|0)?x:b,_=(v|0)<(_|0)?v:_,(_|0)>0&&(v=v-_|0,x=x-_|0,b=b-_|0,h[K>>2]=b,h[j>>2]=x,h[X>>2]=v),M=(x<<1)+b|0,E=v+(b<<1)|0,h[K>>2]=E,h[j>>2]=M,x=(v<<1)+x|0,h[X>>2]=x,_=M-E|0,v=x-E|0,(E|0)<0?(h[j>>2]=_,h[X>>2]=v,h[K>>2]=0,E=0,x=v):_=M,b=E-_|0,v=x-_|0,(_|0)<0?(h[K>>2]=b,h[X>>2]=v,h[j>>2]=0,E=b,_=0):v=x,b=E-v|0,x=_-v|0,(v|0)<0?(h[K>>2]=b,h[j>>2]=x,h[X>>2]=0,v=0):(x=_,b=E),_=(x|0)<(b|0)?x:b,_=(v|0)<(_|0)?v:_,(_|0)>0&&(h[K>>2]=b-_,h[j>>2]=x-_,h[X>>2]=v-_),xc(h[m>>2]|0)|0&&(x=h[K>>2]|0,b=h[j>>2]|0,v=h[X>>2]|0,_=(b*3|0)+x|0,x=v+(x*3|0)|0,h[K>>2]=x,h[j>>2]=_,b=(v*3|0)+b|0,h[X>>2]=b,v=_-x|0,E=b-x|0,(x|0)<0?(h[j>>2]=v,h[X>>2]=E,h[K>>2]=0,_=v,M=0):(M=x,E=b),x=M-_|0,v=E-_|0,(_|0)<0?(h[K>>2]=x,h[X>>2]=v,h[j>>2]=0,M=x,b=0):(b=_,v=E),x=M-v|0,_=b-v|0,(v|0)<0?(h[K>>2]=x,h[j>>2]=_,h[X>>2]=0,b=_,v=0):x=M,_=(b|0)<(x|0)?b:x,_=(v|0)<(_|0)?v:_,(_|0)>0&&(h[K>>2]=x-_,h[j>>2]=b-_,h[X>>2]=v-_),h[m>>2]=(h[m>>2]|0)+1),M=0;do h[g+(M<<4)>>2]=h[p>>2],v=h[j>>2]|0,_=h[X>>2]|0,N=h[q+(M*12|0)+4>>2]|0,U=h[q+(M*12|0)+8>>2]|0,b=(h[q+(M*12|0)>>2]|0)+(h[K>>2]|0)|0,m=g+(M<<4)+4|0,h[m>>2]=b,v=N+v|0,N=g+(M<<4)+8|0,h[N>>2]=v,_=U+_|0,U=g+(M<<4)+12|0,h[U>>2]=_,x=v-b|0,(b|0)<0&&(_=_-b|0,h[N>>2]=x,h[U>>2]=_,h[m>>2]=0,v=x,b=0),(v|0)<0&&(b=b-v|0,h[m>>2]=b,_=_-v|0,h[U>>2]=_,h[N>>2]=0,v=0),E=b-_|0,x=v-_|0,(_|0)<0?(h[m>>2]=E,h[N>>2]=x,h[U>>2]=0,b=E,_=0):x=v,v=(x|0)<(b|0)?x:b,v=(_|0)<(v|0)?_:v,(v|0)>0&&(h[m>>2]=b-v,h[N>>2]=x-v,h[U>>2]=_-v),M=M+1|0;while((M|0)!=6);Q=ae}function hL(p,m){return p=p|0,m=m|0,m=tt(p|0,m|0,52)|0,ee()|0,m&15|0}function cq(p,m){return p=p|0,m=m|0,m=tt(p|0,m|0,45)|0,ee()|0,m&127|0}function uue(p,m,g,_){return p=p|0,m=m|0,g=g|0,_=_|0,(g+-1|0)>>>0>14?(_=4,_|0):(g=tt(p|0,m|0,(15-g|0)*3|0)|0,ee()|0,h[_>>2]=g&7,_=0,_|0)}function hue(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0;if(p>>>0>15)return _=4,_|0;if(m>>>0>121)return _=17,_|0;b=ft(p|0,0,52)|0,v=ee()|0,E=ft(m|0,0,45)|0,v=v|(ee()|0)|134225919;e:do if((p|0)>=1){for(E=1,b=(He[20496+m>>0]|0)!=0,x=-1;;){if(m=h[g+(E+-1<<2)>>2]|0,m>>>0>6){v=18,m=10;break}if(!((m|0)==0|b^1))if((m|0)==1){v=19,m=10;break}else b=0;if(N=(15-E|0)*3|0,M=ft(7,0,N|0)|0,v=v&~(ee()|0),m=ft(m|0,((m|0)<0)<<31>>31|0,N|0)|0,x=m|x&~M,v=ee()|0|v,(E|0)<(p|0))E=E+1|0;else break e}if((m|0)==10)return v|0}else x=-1;while(!1);return N=_,h[N>>2]=x,h[N+4>>2]=v,N=0,N|0}function cT(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0;return!(!0&(m&-16777216|0)==134217728)||(_=tt(p|0,m|0,52)|0,ee()|0,_=_&15,g=tt(p|0,m|0,45)|0,ee()|0,g=g&127,g>>>0>121)?(p=0,p|0):(b=(_^15)*3|0,v=tt(p|0,m|0,b|0)|0,b=ft(v|0,ee()|0,b|0)|0,v=ee()|0,x=eo(-1227133514,-1171,b|0,v|0)|0,!((b&613566756&x|0)==0&(v&4681&(ee()|0)|0)==0)||(b=(_*3|0)+19|0,x=ft(~p|0,~m|0,b|0)|0,b=tt(x|0,ee()|0,b|0)|0,!((_|0)==15|(b|0)==0&(ee()|0)==0))?(b=0,b|0):!(He[20496+g>>0]|0)||(m=m&8191,(p|0)==0&(m|0)==0)?(b=1,b|0):(b=ML(p|0,m|0,0)|0,ee()|0,((63-b|0)%3|0|0)!=0|0))}function fue(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0;return!0&(m&-16777216|0)==134217728&&(_=tt(p|0,m|0,52)|0,ee()|0,_=_&15,g=tt(p|0,m|0,45)|0,ee()|0,g=g&127,g>>>0<=121)&&(b=(_^15)*3|0,v=tt(p|0,m|0,b|0)|0,b=ft(v|0,ee()|0,b|0)|0,v=ee()|0,x=eo(-1227133514,-1171,b|0,v|0)|0,(b&613566756&x|0)==0&(v&4681&(ee()|0)|0)==0)&&(b=(_*3|0)+19|0,x=ft(~p|0,~m|0,b|0)|0,b=tt(x|0,ee()|0,b|0)|0,(_|0)==15|(b|0)==0&(ee()|0)==0)&&(!(He[20496+g>>0]|0)||(g=m&8191,(p|0)==0&(g|0)==0)||(b=ML(p|0,g|0,0)|0,ee()|0,(63-b|0)%3|0|0))||sq(p,m)|0?(b=1,b|0):(b=(wq(p,m)|0)!=0&1,b|0)}function fL(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0;if(v=ft(m|0,0,52)|0,x=ee()|0,g=ft(g|0,0,45)|0,g=x|(ee()|0)|134225919,(m|0)<1){x=-1,_=g,m=p,h[m>>2]=x,p=p+4|0,h[p>>2]=_;return}for(x=1,v=-1;b=(15-x|0)*3|0,E=ft(7,0,b|0)|0,g=g&~(ee()|0),b=ft(_|0,0,b|0)|0,v=v&~E|b,g=g|(ee()|0),(x|0)!=(m|0);)x=x+1|0;E=p,b=E,h[b>>2]=v,E=E+4|0,h[E>>2]=g}function dL(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0;if(x=tt(p|0,m|0,52)|0,ee()|0,x=x&15,g>>>0>15)return _=4,_|0;if((x|0)<(g|0))return _=12,_|0;if((x|0)==(g|0))return h[_>>2]=p,h[_+4>>2]=m,_=0,_|0;if(v=ft(g|0,0,52)|0,v=v|p,p=ee()|0|m&-15728641,(x|0)>(g|0))do m=ft(7,0,(14-g|0)*3|0)|0,g=g+1|0,v=m|v,p=ee()|0|p;while((g|0)<(x|0));return h[_>>2]=v,h[_+4>>2]=p,_=0,_|0}function $x(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0;if(x=tt(p|0,m|0,52)|0,ee()|0,x=x&15,!((g|0)<16&(x|0)<=(g|0)))return _=4,_|0;v=g-x|0,g=tt(p|0,m|0,45)|0,ee()|0;e:do if(!(yr(g&127)|0))g=op(7,0,v,((v|0)<0)<<31>>31)|0,v=ee()|0;else{t:do if(x|0){for(g=1;b=ft(7,0,(15-g|0)*3|0)|0,!!((b&p|0)==0&((ee()|0)&m|0)==0);)if(g>>>0<x>>>0)g=g+1|0;else break t;g=op(7,0,v,((v|0)<0)<<31>>31)|0,v=ee()|0;break e}while(!1);g=op(7,0,v,((v|0)<0)<<31>>31)|0,g=wr(g|0,ee()|0,5,0)|0,g=At(g|0,ee()|0,-5,-1)|0,g=ap(g|0,ee()|0,6,0)|0,g=At(g|0,ee()|0,1,0)|0,v=ee()|0}while(!1);return b=_,h[b>>2]=g,h[b+4>>2]=v,b=0,b|0}function Zi(p,m){p=p|0,m=m|0;var g=0,_=0,v=0;if(v=tt(p|0,m|0,45)|0,ee()|0,!(yr(v&127)|0))return v=0,v|0;v=tt(p|0,m|0,52)|0,ee()|0,v=v&15;e:do if(!v)g=0;else for(_=1;;){if(g=tt(p|0,m|0,(15-_|0)*3|0)|0,ee()|0,g=g&7,g|0)break e;if(_>>>0<v>>>0)_=_+1|0;else{g=0;break}}while(!1);return v=(g|0)==0&1,v|0}function due(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0;if(b=Q,Q=Q+16|0,x=b,_L(x,p,m,g),m=x,p=h[m>>2]|0,m=h[m+4>>2]|0,(p|0)==0&(m|0)==0)return Q=b,0;v=0,g=0;do E=_+(v<<3)|0,h[E>>2]=p,h[E+4>>2]=m,v=At(v|0,g|0,1,0)|0,g=ee()|0,xL(x),E=x,p=h[E>>2]|0,m=h[E+4>>2]|0;while(!((p|0)==0&(m|0)==0));return Q=b,0}function uq(p,m,g,_){return p=p|0,m=m|0,g=g|0,_=_|0,(_|0)<(g|0)?(g=m,_=p,On(g|0),_|0):(g=ft(-1,-1,((_-g|0)*3|0)+3|0)|0,_=ft(~g|0,~(ee()|0)|0,(15-_|0)*3|0)|0,g=~(ee()|0)&m,_=~_&p,On(g|0),_|0)}function hq(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0;return v=tt(p|0,m|0,52)|0,ee()|0,v=v&15,(g|0)<16&(v|0)<=(g|0)?((v|0)<(g|0)&&(v=ft(-1,-1,((g+-1-v|0)*3|0)+3|0)|0,v=ft(~v|0,~(ee()|0)|0,(15-g|0)*3|0)|0,m=~(ee()|0)&m,p=~v&p),v=ft(g|0,0,52)|0,g=m&-15728641|(ee()|0),h[_>>2]=p|v,h[_+4>>2]=g,_=0,_|0):(_=4,_|0)}function pue(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0,be=0,gt=0,je=0,Ut=0,lt=0,pt=0;if((g|0)==0&(_|0)==0)return pt=0,pt|0;if(v=p,x=h[v>>2]|0,v=h[v+4>>2]|0,!0&(v&15728640|0)==0){if(!((_|0)>0|(_|0)==0&g>>>0>0)||(pt=m,h[pt>>2]=x,h[pt+4>>2]=v,(g|0)==1&(_|0)==0))return pt=0,pt|0;v=1,x=0;do Ut=p+(v<<3)|0,lt=h[Ut+4>>2]|0,pt=m+(v<<3)|0,h[pt>>2]=h[Ut>>2],h[pt+4>>2]=lt,v=At(v|0,x|0,1,0)|0,x=ee()|0;while((x|0)<(_|0)|(x|0)==(_|0)&v>>>0<g>>>0);return v=0,v|0}if(je=g<<3,lt=br(je)|0,!lt)return pt=13,pt|0;if(fu(lt|0,p|0,je|0)|0,Ut=Ta(g,8)|0,!Ut)return _t(lt),pt=13,pt|0;e:for(;;){v=lt,N=h[v>>2]|0,v=h[v+4>>2]|0,be=tt(N|0,v|0,52)|0,ee()|0,be=be&15,gt=be+-1|0,Me=(be|0)!=0,Ke=(_|0)>0|(_|0)==0&g>>>0>0;t:do if(Me&Ke){if(se=ft(gt|0,0,52)|0,we=ee()|0,gt>>>0>15){if(!((N|0)==0&(v|0)==0)){pt=16;break e}for(x=0,p=0;;){if(x=At(x|0,p|0,1,0)|0,p=ee()|0,!((p|0)<(_|0)|(p|0)==(_|0)&x>>>0<g>>>0))break t;if(b=lt+(x<<3)|0,Be=h[b>>2]|0,b=h[b+4>>2]|0,!((Be|0)==0&(b|0)==0)){v=b,pt=16;break e}}}for(E=N,p=v,x=0,b=0;;){if(!((E|0)==0&(p|0)==0)){if(!(!0&(p&117440512|0)==0)){pt=21;break e}if(U=tt(E|0,p|0,52)|0,ee()|0,U=U&15,(U|0)<(gt|0)){v=12,pt=27;break e}if((U|0)!=(gt|0)&&(E=E|se,p=p&-15728641|we,U>>>0>=be>>>0)){M=gt;do Be=ft(7,0,(14-M|0)*3|0)|0,M=M+1|0,E=Be|E,p=ee()|0|p;while(M>>>0<U>>>0)}if(j=Wf(E|0,p|0,g|0,_|0)|0,X=ee()|0,M=Ut+(j<<3)|0,U=M,q=h[U>>2]|0,U=h[U+4>>2]|0,!((q|0)==0&(U|0)==0)){ue=0,xe=0;do{if((ue|0)>(_|0)|(ue|0)==(_|0)&xe>>>0>g>>>0){pt=31;break e}if((q|0)==(E|0)&(U&-117440513|0)==(p|0)){K=tt(q|0,U|0,56)|0,ee()|0,K=K&7,ae=K+1|0,Be=tt(q|0,U|0,45)|0,ee()|0;n:do if(!(yr(Be&127)|0))U=7;else{if(q=tt(q|0,U|0,52)|0,ee()|0,q=q&15,!q){U=6;break}for(U=1;;){if(Be=ft(7,0,(15-U|0)*3|0)|0,!((Be&E|0)==0&((ee()|0)&p|0)==0)){U=7;break n}if(U>>>0<q>>>0)U=U+1|0;else{U=6;break}}}while(!1);if((K+2|0)>>>0>U>>>0){pt=41;break e}Be=ft(ae|0,0,56)|0,p=ee()|0|p&-117440513,Ae=M,h[Ae>>2]=0,h[Ae+4>>2]=0,E=Be|E}else j=At(j|0,X|0,1,0)|0,j=lp(j|0,ee()|0,g|0,_|0)|0,X=ee()|0;xe=At(xe|0,ue|0,1,0)|0,ue=ee()|0,M=Ut+(j<<3)|0,U=M,q=h[U>>2]|0,U=h[U+4>>2]|0}while(!((q|0)==0&(U|0)==0))}Be=M,h[Be>>2]=E,h[Be+4>>2]=p}if(x=At(x|0,b|0,1,0)|0,b=ee()|0,!((b|0)<(_|0)|(b|0)==(_|0)&x>>>0<g>>>0))break t;p=lt+(x<<3)|0,E=h[p>>2]|0,p=h[p+4>>2]|0}}while(!1);if(Be=At(g|0,_|0,5,0)|0,Ae=ee()|0,Ae>>>0<0|(Ae|0)==0&Be>>>0<11){pt=85;break}if(Be=ap(g|0,_|0,6,0)|0,ee()|0,Be=Ta(Be,8)|0,!Be){pt=48;break}do if(Ke){for(ae=0,p=0,K=0,ue=0;;){if(U=Ut+(ae<<3)|0,b=U,x=h[b>>2]|0,b=h[b+4>>2]|0,(x|0)==0&(b|0)==0)Ae=K;else{q=tt(x|0,b|0,56)|0,ee()|0,q=q&7,E=q+1|0,j=b&-117440513,Ae=tt(x|0,b|0,45)|0,ee()|0;t:do if(yr(Ae&127)|0){if(X=tt(x|0,b|0,52)|0,ee()|0,X=X&15,X|0)for(M=1;;){if(Ae=ft(7,0,(15-M|0)*3|0)|0,!((x&Ae|0)==0&(j&(ee()|0)|0)==0))break t;if(M>>>0<X>>>0)M=M+1|0;else break}b=ft(E|0,0,56)|0,x=b|x,b=ee()|0|j,E=U,h[E>>2]=x,h[E+4>>2]=b,E=q+2|0}while(!1);(E|0)==7?(Ae=Be+(p<<3)|0,h[Ae>>2]=x,h[Ae+4>>2]=b&-117440513,p=At(p|0,K|0,1,0)|0,Ae=ee()|0):Ae=K}if(ae=At(ae|0,ue|0,1,0)|0,ue=ee()|0,(ue|0)<(_|0)|(ue|0)==(_|0)&ae>>>0<g>>>0)K=Ae;else break}if(Ke){if(xe=gt>>>0>15,se=ft(gt|0,0,52)|0,we=ee()|0,!Me){for(x=0,M=0,E=0,b=0;(N|0)==0&(v|0)==0||(gt=m+(x<<3)|0,h[gt>>2]=N,h[gt+4>>2]=v,x=At(x|0,M|0,1,0)|0,M=ee()|0),E=At(E|0,b|0,1,0)|0,b=ee()|0,!!((b|0)<(_|0)|(b|0)==(_|0)&E>>>0<g>>>0);)v=lt+(E<<3)|0,N=h[v>>2]|0,v=h[v+4>>2]|0;v=Ae;break}for(x=0,M=0,b=0,E=0;;){do if(!((N|0)==0&(v|0)==0)){if(X=tt(N|0,v|0,52)|0,ee()|0,X=X&15,xe|(X|0)<(gt|0)){pt=80;break e}if((X|0)!=(gt|0)){if(U=N|se,q=v&-15728641|we,X>>>0>=be>>>0){j=gt;do Me=ft(7,0,(14-j|0)*3|0)|0,j=j+1|0,U=Me|U,q=ee()|0|q;while(j>>>0<X>>>0)}}else U=N,q=v;K=Wf(U|0,q|0,g|0,_|0)|0,j=0,X=0,ue=ee()|0;do{if((j|0)>(_|0)|(j|0)==(_|0)&X>>>0>g>>>0){pt=81;break e}if(Me=Ut+(K<<3)|0,ae=h[Me+4>>2]|0,(ae&-117440513|0)==(q|0)&&(h[Me>>2]|0)==(U|0)){pt=65;break}Me=At(K|0,ue|0,1,0)|0,K=lp(Me|0,ee()|0,g|0,_|0)|0,ue=ee()|0,X=At(X|0,j|0,1,0)|0,j=ee()|0,Me=Ut+(K<<3)|0}while(!((h[Me>>2]|0)==(U|0)&&(h[Me+4>>2]|0)==(q|0)));if((pt|0)==65&&(pt=0,!0&(ae&117440512|0)==100663296))break;Me=m+(x<<3)|0,h[Me>>2]=N,h[Me+4>>2]=v,x=At(x|0,M|0,1,0)|0,M=ee()|0}while(!1);if(b=At(b|0,E|0,1,0)|0,E=ee()|0,!((E|0)<(_|0)|(E|0)==(_|0)&b>>>0<g>>>0))break;v=lt+(b<<3)|0,N=h[v>>2]|0,v=h[v+4>>2]|0}v=Ae}else x=0,v=Ae}else x=0,p=0,v=0;while(!1);if(cp(Ut|0,0,je|0)|0,fu(lt|0,Be|0,p<<3|0)|0,_t(Be),(p|0)==0&(v|0)==0){pt=89;break}else m=m+(x<<3)|0,_=v,g=p}if((pt|0)==16)!0&(v&117440512|0)==0?(v=4,pt=27):pt=21;else if((pt|0)==31)di(27634,27225,620,27235);else{if((pt|0)==41)return _t(lt),_t(Ut),pt=10,pt|0;if((pt|0)==48)return _t(lt),_t(Ut),pt=13,pt|0;(pt|0)==80?di(27634,27225,711,27235):(pt|0)==81?di(27634,27225,723,27235):(pt|0)==85&&(fu(m|0,lt|0,g<<3|0)|0,pt=89)}return(pt|0)==21?(_t(lt),_t(Ut),pt=5,pt|0):(pt|0)==27?(_t(lt),_t(Ut),pt=v,pt|0):(pt|0)==89?(_t(lt),_t(Ut),pt=0,pt|0):0}function mue(p,m,g,_,v,x,b){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0,x=x|0,b=b|0;var E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0;if(ae=Q,Q=Q+16|0,K=ae,!((g|0)>0|(g|0)==0&m>>>0>0))return K=0,Q=ae,K|0;if((b|0)>=16)return K=12,Q=ae,K|0;j=0,X=0,q=0,E=0;e:for(;;){if(N=p+(j<<3)|0,M=h[N>>2]|0,N=h[N+4>>2]|0,U=tt(M|0,N|0,52)|0,ee()|0,(U&15|0)>(b|0)){E=12,M=11;break}if(_L(K,M,N,b),U=K,N=h[U>>2]|0,U=h[U+4>>2]|0,(N|0)==0&(U|0)==0)M=q;else{M=q;do{if(!((E|0)<(x|0)|(E|0)==(x|0)&M>>>0<v>>>0)){M=10;break e}q=_+(M<<3)|0,h[q>>2]=N,h[q+4>>2]=U,M=At(M|0,E|0,1,0)|0,E=ee()|0,xL(K),q=K,N=h[q>>2]|0,U=h[q+4>>2]|0}while(!((N|0)==0&(U|0)==0))}if(j=At(j|0,X|0,1,0)|0,X=ee()|0,(X|0)<(g|0)|(X|0)==(g|0)&j>>>0<m>>>0)q=M;else{E=0,M=11;break}}return(M|0)==10?(K=14,Q=ae,K|0):(M|0)==11?(Q=ae,E|0):0}function Aue(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0;j=Q,Q=Q+16|0,q=j;e:do if((g|0)>0|(g|0)==0&m>>>0>0){for(N=0,b=0,x=0,U=0;;){if(M=p+(N<<3)|0,E=h[M>>2]|0,M=h[M+4>>2]|0,!((E|0)==0&(M|0)==0)&&(M=($x(E,M,_,q)|0)==0,E=q,b=At(h[E>>2]|0,h[E+4>>2]|0,b|0,x|0)|0,x=ee()|0,!M)){x=12;break}if(N=At(N|0,U|0,1,0)|0,U=ee()|0,!((U|0)<(g|0)|(U|0)==(g|0)&N>>>0<m>>>0))break e}return Q=j,x|0}else b=0,x=0;while(!1);return h[v>>2]=b,h[v+4>>2]=x,v=0,Q=j,v|0}function gue(p,m){return p=p|0,m=m|0,m=tt(p|0,m|0,52)|0,ee()|0,m&1|0}function ll(p,m){p=p|0,m=m|0;var g=0,_=0,v=0;if(v=tt(p|0,m|0,52)|0,ee()|0,v=v&15,!v)return v=0,v|0;for(_=1;;){if(g=tt(p|0,m|0,(15-_|0)*3|0)|0,ee()|0,g=g&7,g|0){_=5;break}if(_>>>0<v>>>0)_=_+1|0;else{g=0,_=5;break}}return(_|0)==5?g|0:0}function pL(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0;if(U=tt(p|0,m|0,52)|0,ee()|0,U=U&15,!U)return N=m,U=p,On(N|0),U|0;for(N=1,g=0;;){switch(_=(15-N|0)*3|0,E=ft(7,0,_|0)|0,M=ee()|0,x=p&~E,b=m&~M,p=tt(p|0,m|0,_|0)|0,ee()|0,p&7){case 1:{p=5;break}case 5:{p=4;break}case 4:{p=6;break}case 6:{p=2;break}case 2:{p=3;break}case 3:{p=1;break}default:p=p&7}_=ft(p|0,0,_|0)|0,v=ee()|0,p=_|x,m=v|b;e:do if(!g)if((_&E|0)==0&(v&M|0)==0)g=0;else if(b=tt(p|0,m|0,52)|0,ee()|0,b=b&15,!b)g=1;else{g=1;t:for(;;){switch(M=tt(p|0,m|0,(15-g|0)*3|0)|0,ee()|0,M&7){case 1:break t;case 0:break;default:{g=1;break e}}if(g>>>0<b>>>0)g=g+1|0;else{g=1;break e}}for(x=1;;){switch(v=(15-x|0)*3|0,g=tt(p|0,m|0,v|0)|0,ee()|0,_=ft(7,0,v|0)|0,_=p&~_,m=m&~(ee()|0),g&7){case 1:{p=5;break}case 5:{p=4;break}case 4:{p=6;break}case 6:{p=2;break}case 2:{p=3;break}case 3:{p=1;break}default:p=g&7}if(p=ft(p|0,0,v|0)|0,p=p|_,m=ee()|0|m,x>>>0<b>>>0)x=x+1|0;else{g=1;break e}}}while(!1);if(N>>>0<U>>>0)N=N+1|0;else break}return On(m|0),p|0}function zm(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0;if(b=tt(p|0,m|0,52)|0,ee()|0,b=b&15,!b)return x=m,b=p,On(x|0),b|0;for(x=1;;){switch(v=(15-x|0)*3|0,g=tt(p|0,m|0,v|0)|0,ee()|0,_=ft(7,0,v|0)|0,_=p&~_,m=m&~(ee()|0),g&7){case 1:{p=5;break}case 5:{p=4;break}case 4:{p=6;break}case 6:{p=2;break}case 2:{p=3;break}case 3:{p=1;break}default:p=g&7}if(p=ft(p|0,0,v|0)|0,p=p|_,m=ee()|0|m,x>>>0<b>>>0)x=x+1|0;else break}return On(m|0),p|0}function vue(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0;if(U=tt(p|0,m|0,52)|0,ee()|0,U=U&15,!U)return N=m,U=p,On(N|0),U|0;for(N=1,g=0;;){switch(_=(15-N|0)*3|0,E=ft(7,0,_|0)|0,M=ee()|0,x=p&~E,b=m&~M,p=tt(p|0,m|0,_|0)|0,ee()|0,p&7){case 1:{p=3;break}case 3:{p=2;break}case 2:{p=6;break}case 6:{p=4;break}case 4:{p=5;break}case 5:{p=1;break}default:p=p&7}_=ft(p|0,0,_|0)|0,v=ee()|0,p=_|x,m=v|b;e:do if(!g)if((_&E|0)==0&(v&M|0)==0)g=0;else if(b=tt(p|0,m|0,52)|0,ee()|0,b=b&15,!b)g=1;else{g=1;t:for(;;){switch(M=tt(p|0,m|0,(15-g|0)*3|0)|0,ee()|0,M&7){case 1:break t;case 0:break;default:{g=1;break e}}if(g>>>0<b>>>0)g=g+1|0;else{g=1;break e}}for(x=1;;){switch(g=(15-x|0)*3|0,_=ft(7,0,g|0)|0,_=p&~_,v=m&~(ee()|0),p=tt(p|0,m|0,g|0)|0,ee()|0,p&7){case 1:{p=3;break}case 3:{p=2;break}case 2:{p=6;break}case 6:{p=4;break}case 4:{p=5;break}case 5:{p=1;break}default:p=p&7}if(p=ft(p|0,0,g|0)|0,p=p|_,m=ee()|0|v,x>>>0<b>>>0)x=x+1|0;else{g=1;break e}}}while(!1);if(N>>>0<U>>>0)N=N+1|0;else break}return On(m|0),p|0}function mL(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0;if(b=tt(p|0,m|0,52)|0,ee()|0,b=b&15,!b)return x=m,b=p,On(x|0),b|0;for(x=1;;){switch(_=(15-x|0)*3|0,g=ft(7,0,_|0)|0,g=p&~g,v=m&~(ee()|0),p=tt(p|0,m|0,_|0)|0,ee()|0,p&7){case 1:{p=3;break}case 3:{p=2;break}case 2:{p=6;break}case 6:{p=4;break}case 4:{p=5;break}case 5:{p=1;break}default:p=p&7}if(p=ft(p|0,0,_|0)|0,p=p|g,m=ee()|0|v,x>>>0<b>>>0)x=x+1|0;else break}return On(m|0),p|0}function _ue(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0;if(Ae=Q,Q=Q+16|0,we=Ae,ft(m|0,0,52)|0,g=ee()|0|134225919,!m)return(h[p+4>>2]|0)>2||(h[p+8>>2]|0)>2||(h[p+12>>2]|0)>2?(se=0,we=0,On(se|0),Q=Ae,we|0):(ft(JG(p)|0,0,45)|0,se=ee()|0|g,we=-1,On(se|0),Q=Ae,we|0);h[we>>2]=h[p>>2],h[we+4>>2]=h[p+4>>2],h[we+8>>2]=h[p+8>>2],h[we+12>>2]=h[p+12>>2],se=we+4|0;e:do if((m|0)>0)for(ae=we+8|0,ue=we+12|0,K=m,q=h[ae>>2]|0,j=h[ue>>2]|0,m=-1,U=h[we+4>>2]|0;;){X=K,K=K+-1|0,p=U-j|0,_=q-j|0,X&1?(x=oh(+((p*3|0)-_|0)*.14285714285714285)|0,h[se>>2]=x,p=oh(+((_<<1)+p|0)*.14285714285714285)|0,h[ae>>2]=p,h[ue>>2]=0,_=p-x|0,v=0-x|0,(x|0)<0?(h[ae>>2]=_,h[ue>>2]=v,h[se>>2]=0,p=_,b=0):(b=x,v=0),x=b-p|0,_=v-p|0,(p|0)<0?(h[se>>2]=x,h[ue>>2]=_,h[ae>>2]=0,b=x,x=0):(_=v,x=p),p=b-_|0,v=x-_|0,(_|0)<0?(h[se>>2]=p,h[ae>>2]=v,h[ue>>2]=0,x=0):(v=x,p=b,x=_),_=(v|0)<(p|0)?v:p,_=(x|0)<(_|0)?x:_,(_|0)>0&&(x=x-_|0,v=v-_|0,p=p-_|0,h[se>>2]=p,h[ae>>2]=v,h[ue>>2]=x),Ke=v+(p*3|0)|0,Be=(Ke|0)<0,N=x+(v*3|0)-(Be?Ke:0)|0,M=(N|0)<0,_=(x*3|0)+p-(Be?Ke:0)-(M?N:0)|0,E=(_|0)<0,Me=E?0:_,b=(M?0:N)-(E?_:0)|0,_=(Be?0:Ke)-(M?N:0)-(E?_:0)|0,E=(b|0)<(_|0)?b:_,E=(Me|0)<(E|0)?Me:E,N=(E|0)>0,M=N?E:0,b=b-(N?E:0)|0,E=Me-(N?E:0)|0,N=x):(E=oh(+((p<<1)+_|0)*.14285714285714285)|0,h[se>>2]=E,v=oh(+((_*3|0)-p|0)*.14285714285714285)|0,h[ae>>2]=v,h[ue>>2]=0,_=v-E|0,p=0-E|0,(E|0)<0?(h[ae>>2]=_,h[ue>>2]=p,h[se>>2]=0,v=_,E=0):p=0,b=E-v|0,_=p-v|0,(v|0)<0?(h[se>>2]=b,h[ue>>2]=_,h[ae>>2]=0,x=_,v=0):(x=p,b=E),p=b-x|0,_=v-x|0,(x|0)<0?(h[se>>2]=p,h[ae>>2]=_,h[ue>>2]=0,v=_,x=0):p=b,_=(v|0)<(p|0)?v:p,_=(x|0)<(_|0)?x:_,(_|0)>0&&(x=x-_|0,v=v-_|0,p=p-_|0,h[se>>2]=p,h[ae>>2]=v,h[ue>>2]=x),Ke=x+(p*3|0)|0,Me=(Ke|0)<0,N=(v*3|0)+p-(Me?Ke:0)|0,M=(N|0)<0,_=(x*3|0)+v-(Me?Ke:0)-(M?N:0)|0,E=(_|0)<0,Be=E?0:_,b=(M?0:N)-(E?_:0)|0,_=(Me?0:Ke)-(M?N:0)-(E?_:0)|0,E=(b|0)<(_|0)?b:_,E=(Be|0)<(E|0)?Be:E,N=(E|0)>0,M=N?E:0,b=b-(N?E:0)|0,E=Be-(N?E:0)|0,N=x),_=U+(M-_)|0,x=(_|0)<0,M=q-b-(x?_:0)|0,b=(M|0)<0,j=j-E+(x?0-_|0:0)+(b?0-M|0:0)|0,U=(j|0)<0,E=U?0:j,Me=(b?0:M)-(U?j:0)|0,j=(x?0:_)-(b?M:0)-(U?j:0)|0,U=(Me|0)<(j|0)?Me:j,U=(E|0)<(U|0)?E:U,M=(U|0)>0,j=j-(M?U:0)|0,b=(15-X|0)*3|0,_=ft(7,0,b|0)|0,_=m&~_,x=g&~(ee()|0),q=(j|0)<0,Ke=q?j:0,Me=Me-(M?U:0)-Ke|0,Be=(Me|0)<0,Ke=(Be?0-Me|0:0)+(E-(M?U:0)-Ke)|0,g=(Ke|0)<0,m=g?0:Ke,Ke=g?Ke:0,g=(Be?0:Me)-Ke|0,Ke=(q?0:j)-(Be?Me:0)-Ke|0,Me=(g|0)<(Ke|0)?g:Ke,Me=(m|0)<(Me|0)?m:Me,Me=(Me|0)>0?Me:0,m=m-Me|0,g=g-Me|0;t:do switch(Ke-Me|0){case 0:switch(g|0){case 0:{m=(m|0)==0?0:(m|0)==1?1:7;break t}case 1:{m=(m|0)==0?2:(m|0)==1?3:7;break t}default:{xe=36;break t}}case 1:switch(g|0){case 0:{m=(m|0)==0?4:(m|0)==1?5:7;break t}case 1:if(m){xe=36;break t}else{m=6;break t}default:{xe=36;break t}}default:xe=36}while(!1);if((xe|0)==36&&(xe=0,m=7),m=ft(m|0,0,b|0)|0,m=m|_,g=ee()|0|x,(X|0)<=1)break e;q=v,j=N,U=p}else m=-1,p=h[se>>2]|0;while(!1);e:do if((p|0)<=2&&(h[we+8>>2]|0)<=2&&(h[we+12>>2]|0)<=2){if(_=JG(we)|0,p=ft(_|0,0,45)|0,m=p|m,p=ee()|0|g&-1040385,M=Vce(we)|0,!(yr(_)|0)){if((M|0)<=0)break;for(E=0;;){b=tt(m|0,p|0,52)|0,ee()|0,b=b&15;t:do if(b)for(x=1;;){switch(v=(15-x|0)*3|0,g=tt(m|0,p|0,v|0)|0,ee()|0,_=ft(7,0,v|0)|0,m=m&~_,_=p&~(ee()|0),g&7){case 1:{p=5;break}case 5:{p=4;break}case 4:{p=6;break}case 6:{p=2;break}case 2:{p=3;break}case 3:{p=1;break}default:p=g&7}if(p=ft(p|0,0,v|0)|0,m=p|m,p=ee()|0|_,x>>>0<b>>>0)x=x+1|0;else break t}while(!1);if(E=E+1|0,(E|0)==(M|0))break e}}b=tt(m|0,p|0,52)|0,ee()|0,b=b&15;t:do if(b){g=1;n:for(;;){switch(Me=tt(m|0,p|0,(15-g|0)*3|0)|0,ee()|0,Me&7){case 1:break n;case 0:break;default:break t}if(g>>>0<b>>>0)g=g+1|0;else break t}if(eq(_,h[we>>2]|0)|0)for(x=1;;){switch(g=(15-x|0)*3|0,_=ft(7,0,g|0)|0,_=m&~_,v=p&~(ee()|0),p=tt(m|0,p|0,g|0)|0,ee()|0,p&7){case 1:{p=3;break}case 3:{p=2;break}case 2:{p=6;break}case 6:{p=4;break}case 4:{p=5;break}case 5:{p=1;break}default:p=p&7}if(m=ft(p|0,0,g|0)|0,m=m|_,p=ee()|0|v,x>>>0<b>>>0)x=x+1|0;else break t}else for(x=1;;){switch(v=(15-x|0)*3|0,g=tt(m|0,p|0,v|0)|0,ee()|0,_=ft(7,0,v|0)|0,m=m&~_,_=p&~(ee()|0),g&7){case 1:{p=5;break}case 5:{p=4;break}case 4:{p=6;break}case 6:{p=2;break}case 2:{p=3;break}case 3:{p=1;break}default:p=g&7}if(p=ft(p|0,0,v|0)|0,m=p|m,p=ee()|0|_,x>>>0<b>>>0)x=x+1|0;else break t}}while(!1);if((M|0)>0){g=0;do m=pL(m,p)|0,p=ee()|0,g=g+1|0;while((g|0)!=(M|0))}}else m=0,p=0;while(!1);return Ke=p,Me=m,On(Ke|0),Q=Ae,Me|0}function xc(p){return p=p|0,(p|0)%2|0|0}function AL(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0;if(U=Q,Q=Q+64|0,E=U+24|0,M=U+48|0,N=U,m>>>0>15)return N=4,Q=U,N|0;if(x=+ie[p>>3],ie[or>>3]=x,(h[or+4>>2]&2146435072|0)==2146435072||(_=+ie[p+8>>3],ie[or>>3]=_,(h[or+4>>2]&2146435072|0)==2146435072))return N=3,Q=U,N|0;v=+ii(+x),q=v*+ii(+_),v=v*+zi(+_),_=+zi(+x),ie[N>>3]=q,ie[N+8>>3]=v,ie[N+16>>3]=_,ie[or>>3]=q;do if((h[or+4>>2]&2146435072|0)!=2146435072&&(ie[or>>3]=_,p=h[or+4>>2]|0,ie[or>>3]=v,!((h[or+4>>2]&2146435072|0)==2146435072|!0&(p&2146435072|0)==2146435072)))if(h[E>>2]=h[N>>2],h[E+4>>2]=h[N+4>>2],h[E+8>>2]=h[N+8>>2],h[E+12>>2]=h[N+12>>2],h[E+16>>2]=h[N+16>>2],h[E+20>>2]=h[N+20>>2],aue(E,m,M),M=_ue(M,m)|0,N=ee()|0,h[g>>2]=M,h[g+4>>2]=N,(M|0)==0&(N|0)==0)di(27634,27225,1073,27248);else{b=0;break}else b=2;while(!1);return N=b,Q=U,N|0}function gL(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0;if(X=g+4|0,K=tt(p|0,m|0,52)|0,ee()|0,K=K&15,j=tt(p|0,m|0,45)|0,ee()|0,_=(K|0)==0,yr(j&127)|0){if(_)return K=1,K|0;_=1}else{if(_)return K=0,K|0;(h[X>>2]|0)==0&&(h[g+8>>2]|0)==0?_=(h[g+12>>2]|0)!=0&1:_=1}for(j=g+8|0,q=g+12|0,U=1,g=h[X>>2]|0,b=h[j>>2]|0,x=h[q>>2]|0;v=g*3|0,E=b*3|0,N=x*3|0,U&1?(M=b+v|0,h[X>>2]=M,x=x+E|0,h[j>>2]=x,v=N+g|0,h[q>>2]=v,g=x-M|0,b=v-M|0,(M|0)<0?(h[j>>2]=g,h[q>>2]=b,h[X>>2]=0,E=0,v=b):(g=x,E=M),b=E-g|0,x=v-g|0,(g|0)<0?(h[X>>2]=b,h[q>>2]=x,h[j>>2]=0,E=b,v=0):(x=v,v=g),g=E-x|0,b=v-x|0,(x|0)<0?(h[X>>2]=g,h[j>>2]=b,h[q>>2]=0,x=0):(b=v,g=E),v=(b|0)<(g|0)?b:g,v=(x|0)<(v|0)?x:v,(v|0)>0&&(x=x-v|0,b=b-v|0,g=g-v|0,h[X>>2]=g,h[j>>2]=b,h[q>>2]=x)):(M=E+g|0,E=x+v|0,h[X>>2]=E,h[j>>2]=M,v=N+b|0,h[q>>2]=v,g=M-E|0,x=v-E|0,(E|0)<0?(h[j>>2]=g,h[q>>2]=x,h[X>>2]=0,E=0,v=x):g=M,b=E-g|0,x=v-g|0,(g|0)<0?(h[X>>2]=b,h[q>>2]=x,h[j>>2]=0,E=b,v=0):(x=v,v=g),g=E-x|0,b=v-x|0,(x|0)<0?(h[X>>2]=g,h[j>>2]=b,h[q>>2]=0,x=0):(b=v,g=E),v=(b|0)<(g|0)?b:g,v=(x|0)<(v|0)?x:v,(v|0)>0&&(x=x-v|0,b=b-v|0,g=g-v|0,h[X>>2]=g,h[j>>2]=b,h[q>>2]=x)),v=tt(p|0,m|0,(15-U|0)*3|0)|0,ee()|0,v=v&7,(v+-1|0)>>>0<6&&(M=h[22032+(v*12|0)+4>>2]|0,N=h[22032+(v*12|0)+8>>2]|0,E=(h[22032+(v*12|0)>>2]|0)+g|0,h[X>>2]=E,b=M+b|0,h[j>>2]=b,g=N+x|0,h[q>>2]=g,x=b-E|0,v=g-E|0,(E|0)<0&&(h[j>>2]=x,h[q>>2]=v,h[X>>2]=0,E=0,g=v,b=x),v=E-b|0,x=g-b|0,(b|0)<0?(h[X>>2]=v,h[q>>2]=x,h[j>>2]=0,E=v,b=0):x=g,g=E-x|0,v=b-x|0,(x|0)<0?(h[X>>2]=g,h[j>>2]=v,h[q>>2]=0,b=v,x=0):g=E,v=(b|0)<(g|0)?b:g,v=(x|0)<(v|0)?x:v,(v|0)>0&&(x=x-v|0,b=b-v|0,g=g-v|0,h[X>>2]=g,h[j>>2]=b,h[q>>2]=x)),U>>>0<K>>>0;)U=U+1|0;return _|0}function S1(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0;if(K=Q,Q=Q+16|0,q=K,j=tt(p|0,m|0,45)|0,ee()|0,j=j&127,j>>>0>121)return h[g>>2]=0,h[g+4>>2]=0,h[g+8>>2]=0,h[g+12>>2]=0,X=5,Q=K,X|0;e:do if((yr(j)|0)!=0&&(E=tt(p|0,m|0,52)|0,ee()|0,E=E&15,(E|0)!=0)){_=1;t:for(;;){switch(X=tt(p|0,m|0,(15-_|0)*3|0)|0,ee()|0,X&7){case 5:break t;case 0:break;default:{N=m;break e}}if(_>>>0<E>>>0)_=_+1|0;else{N=m;break e}}for(b=1,_=m;;){switch(m=(15-b|0)*3|0,v=ft(7,0,m|0)|0,v=p&~v,x=_&~(ee()|0),_=tt(p|0,_|0,m|0)|0,ee()|0,_&7){case 1:{_=3;break}case 3:{_=2;break}case 2:{_=6;break}case 6:{_=4;break}case 4:{_=5;break}case 5:{_=1;break}default:_=_&7}if(p=ft(_|0,0,m|0)|0,p=p|v,_=ee()|0|x,b>>>0<E>>>0)b=b+1|0;else{N=_;break e}}}else N=m;while(!1);if(X=7696+(j*28|0)|0,h[g>>2]=h[X>>2],h[g+4>>2]=h[X+4>>2],h[g+8>>2]=h[X+8>>2],h[g+12>>2]=h[X+12>>2],!(gL(p,N,g)|0))return X=0,Q=K,X|0;if(X=g+4|0,h[q>>2]=h[X>>2],h[q+4>>2]=h[X+4>>2],h[q+8>>2]=h[X+8>>2],M=tt(p|0,N|0,52)|0,ee()|0,U=M&15,M&1?(x=h[X>>2]|0,E=g+8|0,v=h[E>>2]|0,M=g+12|0,m=h[M>>2]|0,_=(v*3|0)+x|0,x=m+(x*3|0)|0,h[X>>2]=x,h[E>>2]=_,v=(m*3|0)+v|0,h[M>>2]=v,m=_-x|0,b=v-x|0,(x|0)<0&&(h[E>>2]=m,h[M>>2]=b,h[X>>2]=0,_=m,x=0,v=b),b=x-_|0,m=v-_|0,(_|0)<0?(h[X>>2]=b,h[M>>2]=m,h[E>>2]=0,_=0):(m=v,b=x),x=b-m|0,v=_-m|0,(m|0)<0?(h[X>>2]=x,h[E>>2]=v,h[M>>2]=0,m=0):(v=_,x=b),_=(v|0)<(x|0)?v:x,_=(m|0)<(_|0)?m:_,(_|0)>0&&(h[X>>2]=x-_,h[E>>2]=v-_,h[M>>2]=m-_),v=U+1|0):v=U,!(yr(j)|0))_=0;else{e:do if(!U)_=0;else for(m=1;;){if(_=tt(p|0,N|0,(15-m|0)*3|0)|0,ee()|0,_=_&7,_|0)break e;if(m>>>0<U>>>0)m=m+1|0;else{_=0;break}}while(!1);_=(_|0)==4&1}if(!(w1(g,v,_,0)|0))(v|0)!=(U|0)&&(h[X>>2]=h[q>>2],h[X+4>>2]=h[q+4>>2],h[X+8>>2]=h[q+8>>2]);else{if(yr(j)|0)do;while((w1(g,v,0,0)|0)!=0);(v|0)!=(U|0)&&(E=g+12|0,p=h[E>>2]|0,_=(h[X>>2]|0)-p|0,b=g+8|0,p=(h[b>>2]|0)-p|0,m=oh(+((_<<1)+p|0)*.14285714285714285)|0,h[X>>2]=m,_=oh(+((p*3|0)-_|0)*.14285714285714285)|0,h[b>>2]=_,h[E>>2]=0,p=_-m|0,v=0-m|0,(m|0)<0?(h[b>>2]=p,h[E>>2]=v,h[X>>2]=0,_=p,m=0):v=0,x=m-_|0,p=v-_|0,(_|0)<0?(h[X>>2]=x,h[E>>2]=p,h[b>>2]=0,m=x,_=0):p=v,x=m-p|0,v=_-p|0,(p|0)<0?(h[X>>2]=x,h[b>>2]=v,h[E>>2]=0,m=x,p=0):v=_,_=(v|0)<(m|0)?v:m,_=(p|0)<(_|0)?p:_,(_|0)>0&&(h[X>>2]=m-_,h[b>>2]=v-_,h[E>>2]=p-_))}return X=0,Q=K,X|0}function T1(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0;return b=Q,Q=Q+48|0,_=b+24|0,v=b,x=S1(p,m,_)|0,x?(Q=b,x|0):(x=tt(p|0,m|0,52)|0,ee()|0,lue(_,x&15,v),M=+Wx(+ +ie[v+16>>3]),E=+Sa(+ +ie[v+8>>3],+ +ie[v>>3]),ie[g>>3]=M,ie[g+8>>3]=E,x=0,Q=b,x|0)}function Vm(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0;if(b=Q,Q=Q+16|0,x=b,_=S1(p,m,x)|0,_|0)return x=_,Q=b,x|0;_=tt(p|0,m|0,45)|0,ee()|0,_=(yr(_&127)|0)==0,v=tt(p|0,m|0,52)|0,ee()|0,v=v&15;e:do if(!_){if(v|0)for(_=1;;){if(E=ft(7,0,(15-_|0)*3|0)|0,!((E&p|0)==0&((ee()|0)&m|0)==0))break e;if(_>>>0<v>>>0)_=_+1|0;else break}return cL(x,v,0,5,g),E=0,Q=b,E|0}while(!1);return uL(x,v,0,6,g),E=0,Q=b,E|0}function xue(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0;if(v=tt(p|0,m|0,45)|0,ee()|0,!(yr(v&127)|0))return v=2,h[g>>2]=v,0;if(v=tt(p|0,m|0,52)|0,ee()|0,v=v&15,!v)return v=5,h[g>>2]=v,0;for(_=1;;){if(x=ft(7,0,(15-_|0)*3|0)|0,!((x&p|0)==0&((ee()|0)&m|0)==0)){_=2,p=6;break}if(_>>>0<v>>>0)_=_+1|0;else{_=5,p=6;break}}return(p|0)==6&&(h[g>>2]=_),0}function fq(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0;q=Q,Q=Q+128|0,N=q+112|0,x=q+96|0,U=q,v=tt(p|0,m|0,52)|0,ee()|0,E=v&15,h[N>>2]=E,b=tt(p|0,m|0,45)|0,ee()|0,b=b&127;e:do if(yr(b)|0){if(E|0)for(_=1;;){if(M=ft(7,0,(15-_|0)*3|0)|0,!((M&p|0)==0&((ee()|0)&m|0)==0)){v=0;break e}if(_>>>0<E>>>0)_=_+1|0;else break}if(v&1)v=1;else return M=ft(E+1|0,0,52)|0,U=ee()|0|m&-15728641,N=ft(7,0,(14-E|0)*3|0)|0,U=fq((M|p)&~N,U&~(ee()|0),g)|0,Q=q,U|0}else v=0;while(!1);if(_=S1(p,m,x)|0,!_){v?(aq(x,N,U),M=5):(lq(x,N,U),M=6);e:do if(yr(b)|0)if(!E)p=5;else for(_=1;;){if(b=ft(7,0,(15-_|0)*3|0)|0,!((b&p|0)==0&((ee()|0)&m|0)==0)){p=2;break e}if(_>>>0<E>>>0)_=_+1|0;else{p=5;break}}else p=2;while(!1);cp(g|0,-1,p<<2|0)|0;e:do if(v)for(x=0;;){if(b=U+(x<<4)|0,cue(b,h[N>>2]|0)|0,b=h[b>>2]|0,E=h[g>>2]|0,(E|0)==-1|(E|0)==(b|0))_=g;else{v=0;do{if(v=v+1|0,v>>>0>=p>>>0){_=1;break e}_=g+(v<<2)|0,E=h[_>>2]|0}while(!((E|0)==-1|(E|0)==(b|0)))}if(h[_>>2]=b,x=x+1|0,x>>>0>=M>>>0){_=0;break}}else for(x=0;;){if(b=U+(x<<4)|0,w1(b,h[N>>2]|0,0,1)|0,b=h[b>>2]|0,E=h[g>>2]|0,(E|0)==-1|(E|0)==(b|0))_=g;else{v=0;do{if(v=v+1|0,v>>>0>=p>>>0){_=1;break e}_=g+(v<<2)|0,E=h[_>>2]|0}while(!((E|0)==-1|(E|0)==(b|0)))}if(h[_>>2]=b,x=x+1|0,x>>>0>=M>>>0){_=0;break}}while(!1)}return U=_,Q=q,U|0}function yue(){return 12}function vL(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0;if(p>>>0>15)return E=4,E|0;if(ft(p|0,0,52)|0,E=ee()|0|134225919,!p){g=0,_=0;do yr(_)|0&&(ft(_|0,0,45)|0,b=E|(ee()|0),p=m+(g<<3)|0,h[p>>2]=-1,h[p+4>>2]=b,g=g+1|0),_=_+1|0;while((_|0)!=122);return g=0,g|0}g=0,b=0;do{if(yr(b)|0){for(ft(b|0,0,45)|0,_=1,v=-1,x=E|(ee()|0);M=ft(7,0,(15-_|0)*3|0)|0,v=v&~M,x=x&~(ee()|0),(_|0)!=(p|0);)_=_+1|0;M=m+(g<<3)|0,h[M>>2]=v,h[M+4>>2]=x,g=g+1|0}b=b+1|0}while((b|0)!=122);return g=0,g|0}function bue(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0;if(se=Q,Q=Q+16|0,ue=se,xe=tt(p|0,m|0,52)|0,ee()|0,xe=xe&15,g>>>0>15)return xe=4,Q=se,xe|0;if((xe|0)<(g|0))return xe=12,Q=se,xe|0;if((xe|0)!=(g|0))if(x=ft(g|0,0,52)|0,x=x|p,E=ee()|0|m&-15728641,(xe|0)>(g|0)){M=g;do ae=ft(7,0,(14-M|0)*3|0)|0,M=M+1|0,x=ae|x,E=ee()|0|E;while((M|0)<(xe|0));ae=x}else ae=x;else ae=p,E=m;K=tt(ae|0,E|0,45)|0,ee()|0;e:do if(yr(K&127)|0){if(M=tt(ae|0,E|0,52)|0,ee()|0,M=M&15,M|0)for(x=1;;){if(K=ft(7,0,(15-x|0)*3|0)|0,!((K&ae|0)==0&((ee()|0)&E|0)==0)){N=33;break e}if(x>>>0<M>>>0)x=x+1|0;else break}if(K=_,h[K>>2]=0,h[K+4>>2]=0,(xe|0)>(g|0)){for(K=m&-15728641,X=xe;;){if(j=X,X=X+-1|0,X>>>0>15|(xe|0)<(X|0)){N=19;break}if((xe|0)!=(X|0))if(x=ft(X|0,0,52)|0,x=x|p,M=ee()|0|K,(xe|0)<(j|0))q=x;else{N=X;do q=ft(7,0,(14-N|0)*3|0)|0,N=N+1|0,x=q|x,M=ee()|0|M;while((N|0)<(xe|0));q=x}else q=p,M=m;if(U=tt(q|0,M|0,45)|0,ee()|0,!(yr(U&127)|0))x=0;else{U=tt(q|0,M|0,52)|0,ee()|0,U=U&15;t:do if(!U)x=0;else for(N=1;;){if(x=tt(q|0,M|0,(15-N|0)*3|0)|0,ee()|0,x=x&7,x|0)break t;if(N>>>0<U>>>0)N=N+1|0;else{x=0;break}}while(!1);x=(x|0)==0&1}if(M=tt(p|0,m|0,(15-j|0)*3|0)|0,ee()|0,M=M&7,(M|0)==7){v=5,N=42;break}if(x=(x|0)!=0,(M|0)==1&x){v=5,N=42;break}if(q=M+(((M|0)!=0&x)<<31>>31)|0,q|0&&(N=xe-j|0,N=op(7,0,N,((N|0)<0)<<31>>31)|0,U=ee()|0,x?(x=wr(N|0,U|0,5,0)|0,x=At(x|0,ee()|0,-5,-1)|0,x=ap(x|0,ee()|0,6,0)|0,x=At(x|0,ee()|0,1,0)|0,M=ee()|0):(x=N,M=U),j=q+-1|0,j=wr(N|0,U|0,j|0,((j|0)<0)<<31>>31|0)|0,j=At(x|0,M|0,j|0,ee()|0)|0,q=ee()|0,U=_,U=At(j|0,q|0,h[U>>2]|0,h[U+4>>2]|0)|0,q=ee()|0,j=_,h[j>>2]=U,h[j+4>>2]=q),(X|0)<=(g|0)){N=37;break}}if((N|0)==19)di(27634,27225,1407,27259);else if((N|0)==37){b=_,v=h[b+4>>2]|0,b=h[b>>2]|0;break}else if((N|0)==42)return Q=se,v|0}else v=0,b=0}else N=33;while(!1);e:do if((N|0)==33)if(K=_,h[K>>2]=0,h[K+4>>2]=0,(xe|0)>(g|0)){for(x=xe;;){if(v=tt(p|0,m|0,(15-x|0)*3|0)|0,ee()|0,v=v&7,(v|0)==7){v=5;break}if(b=xe-x|0,b=op(7,0,b,((b|0)<0)<<31>>31)|0,v=wr(b|0,ee()|0,v|0,0)|0,b=ee()|0,K=_,b=At(h[K>>2]|0,h[K+4>>2]|0,v|0,b|0)|0,v=ee()|0,K=_,h[K>>2]=b,h[K+4>>2]=v,x=x+-1|0,(x|0)<=(g|0))break e}return Q=se,v|0}else v=0,b=0;while(!1);return $x(ae,E,xe,ue)|0&&di(27634,27225,1367,27274),xe=ue,ue=h[xe+4>>2]|0,((v|0)>-1|(v|0)==-1&b>>>0>4294967295)&((ue|0)>(v|0)|((ue|0)==(v|0)?(h[xe>>2]|0)>>>0>b>>>0:0))?(xe=0,Q=se,xe|0):(di(27634,27225,1447,27259),0)}function wue(p,m,g,_,v,x){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0,x=x|0;var b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0;if(q=Q,Q=Q+16|0,b=q,v>>>0>15)return x=4,Q=q,x|0;if(E=tt(g|0,_|0,52)|0,ee()|0,E=E&15,(E|0)>(v|0))return x=12,Q=q,x|0;if($x(g,_,v,b)|0&&di(27634,27225,1367,27274),U=b,N=h[U+4>>2]|0,!(((m|0)>-1|(m|0)==-1&p>>>0>4294967295)&((N|0)>(m|0)|((N|0)==(m|0)?(h[U>>2]|0)>>>0>p>>>0:0))))return x=2,Q=q,x|0;U=v-E|0,v=ft(v|0,0,52)|0,M=ee()|0|_&-15728641,N=x,h[N>>2]=v|g,h[N+4>>2]=M,N=tt(g|0,_|0,45)|0,ee()|0;e:do if(yr(N&127)|0){if(E|0)for(b=1;;){if(N=ft(7,0,(15-b|0)*3|0)|0,!((N&g|0)==0&((ee()|0)&_|0)==0))break e;if(b>>>0<E>>>0)b=b+1|0;else break}if((U|0)<1)return x=0,Q=q,x|0;for(N=E^15,_=-1,M=1,b=1;;){E=U-M|0,E=op(7,0,E,((E|0)<0)<<31>>31)|0,g=ee()|0;do if(b)if(b=wr(E|0,g|0,5,0)|0,b=At(b|0,ee()|0,-5,-1)|0,b=ap(b|0,ee()|0,6,0)|0,v=ee()|0,(m|0)>(v|0)|(m|0)==(v|0)&p>>>0>b>>>0){m=At(p|0,m|0,-1,-1)|0,m=eo(m|0,ee()|0,b|0,v|0)|0,b=ee()|0,j=x,K=h[j>>2]|0,j=h[j+4>>2]|0,ae=(N+_|0)*3|0,X=ft(7,0,ae|0)|0,j=j&~(ee()|0),_=ap(m|0,b|0,E|0,g|0)|0,p=ee()|0,v=At(_|0,p|0,2,0)|0,ae=ft(v|0,ee()|0,ae|0)|0,j=ee()|0|j,v=x,h[v>>2]=ae|K&~X,h[v+4>>2]=j,p=wr(_|0,p|0,E|0,g|0)|0,p=eo(m|0,b|0,p|0,ee()|0)|0,b=0,m=ee()|0;break}else{ae=x,X=h[ae>>2]|0,ae=h[ae+4>>2]|0,K=ft(7,0,(N+_|0)*3|0)|0,ae=ae&~(ee()|0),b=x,h[b>>2]=X&~K,h[b+4>>2]=ae,b=1;break}else X=x,v=h[X>>2]|0,X=h[X+4>>2]|0,_=(N+_|0)*3|0,j=ft(7,0,_|0)|0,X=X&~(ee()|0),ae=ap(p|0,m|0,E|0,g|0)|0,b=ee()|0,_=ft(ae|0,b|0,_|0)|0,X=ee()|0|X,K=x,h[K>>2]=_|v&~j,h[K+4>>2]=X,b=wr(ae|0,b|0,E|0,g|0)|0,p=eo(p|0,m|0,b|0,ee()|0)|0,b=0,m=ee()|0;while(!1);if((U|0)>(M|0))_=~M,M=M+1|0;else{m=0;break}}return Q=q,m|0}while(!1);if((U|0)<1)return ae=0,Q=q,ae|0;for(v=E^15,b=1;;)if(K=U-b|0,K=op(7,0,K,((K|0)<0)<<31>>31)|0,ae=ee()|0,M=x,g=h[M>>2]|0,M=h[M+4>>2]|0,E=(v-b|0)*3|0,_=ft(7,0,E|0)|0,M=M&~(ee()|0),j=ap(p|0,m|0,K|0,ae|0)|0,X=ee()|0,E=ft(j|0,X|0,E|0)|0,M=ee()|0|M,N=x,h[N>>2]=E|g&~_,h[N+4>>2]=M,ae=wr(j|0,X|0,K|0,ae|0)|0,p=eo(p|0,m|0,ae|0,ee()|0)|0,m=ee()|0,(U|0)<=(b|0)){m=0;break}else b=b+1|0;return Q=q,m|0}function _L(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0;v=tt(m|0,g|0,52)|0,ee()|0,v=v&15,(m|0)==0&(g|0)==0|((_|0)>15|(v|0)>(_|0))?(x=-1,m=-1,g=0,v=0):(m=uq(m,g,v+1|0,_)|0,b=(ee()|0)&-15728641,g=ft(_|0,0,52)|0,g=m|g,b=b|(ee()|0),m=(Zi(g,b)|0)==0,x=v,m=m?-1:_,v=b),b=p,h[b>>2]=g,h[b+4>>2]=v,h[p+8>>2]=x,h[p+12>>2]=m}function dq(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0;if(v=tt(p|0,m|0,52)|0,ee()|0,v=v&15,x=_+8|0,h[x>>2]=v,(p|0)==0&(m|0)==0|((g|0)>15|(v|0)>(g|0))){g=_,h[g>>2]=0,h[g+4>>2]=0,h[x>>2]=-1,h[_+12>>2]=-1;return}if(p=uq(p,m,v+1|0,g)|0,x=(ee()|0)&-15728641,v=ft(g|0,0,52)|0,v=p|v,x=x|(ee()|0),p=_,h[p>>2]=v,h[p+4>>2]=x,p=_+12|0,Zi(v,x)|0){h[p>>2]=g;return}else{h[p>>2]=-1;return}}function xL(p){p=p|0;var m=0,g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0;if(g=p,m=h[g>>2]|0,g=h[g+4>>2]|0,!((m|0)==0&(g|0)==0)&&(_=tt(m|0,g|0,52)|0,ee()|0,_=_&15,E=ft(1,0,(_^15)*3|0)|0,m=At(E|0,ee()|0,m|0,g|0)|0,g=ee()|0,E=p,h[E>>2]=m,h[E+4>>2]=g,E=p+8|0,b=h[E>>2]|0,!((_|0)<(b|0)))){for(M=p+12|0,x=_;;){if((x|0)==(b|0)){_=5;break}if(N=(x|0)==(h[M>>2]|0),v=(15-x|0)*3|0,_=tt(m|0,g|0,v|0)|0,ee()|0,_=_&7,N&((_|0)==1&!0)){_=7;break}if(!((_|0)==7&!0)){_=10;break}if(N=ft(1,0,v|0)|0,m=At(m|0,g|0,N|0,ee()|0)|0,g=ee()|0,N=p,h[N>>2]=m,h[N+4>>2]=g,(x|0)>(b|0))x=x+-1|0;else{_=10;break}}if((_|0)==5){N=p,h[N>>2]=0,h[N+4>>2]=0,h[E>>2]=-1,h[M>>2]=-1;return}else if((_|0)==7){b=ft(1,0,v|0)|0,b=At(m|0,g|0,b|0,ee()|0)|0,E=ee()|0,N=p,h[N>>2]=b,h[N+4>>2]=E,h[M>>2]=x+-1;return}else if((_|0)==10)return}}function Yx(p){p=+p;var m=0;return m=p<0?p+6.283185307179586:p,+(p>=6.283185307179586?m+-6.283185307179586:m)}function kl(p,m){switch(p=+p,m=m|0,m|0){case 1:{p=p<0?p+6.283185307179586:p;break}case 2:{p=p>0?p+-6.283185307179586:p;break}default:}return+p}function Sue(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0;return v=+ie[m>>3],_=+ie[p>>3],x=+zi(+((v-_)*.5)),g=+zi(+((+ie[m+8>>3]-+ie[p+8>>3])*.5)),g=x*x+g*(+ii(+v)*+ii(+_)*g),+(+Sa(+ +bs(+g),+ +bs(+(1-g)))*2)}function Zx(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0;return v=+ie[m>>3],_=+ie[p>>3],x=+zi(+((v-_)*.5)),g=+zi(+((+ie[m+8>>3]-+ie[p+8>>3])*.5)),g=x*x+g*(+ii(+v)*+ii(+_)*g),+(+Sa(+ +bs(+g),+ +bs(+(1-g)))*2*6371.007180918475)}function Tue(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0;return v=+ie[m>>3],_=+ie[p>>3],x=+zi(+((v-_)*.5)),g=+zi(+((+ie[m+8>>3]-+ie[p+8>>3])*.5)),g=x*x+g*(+ii(+v)*+ii(+_)*g),+(+Sa(+ +bs(+g),+ +bs(+(1-g)))*2*6371.007180918475*1e3)}function pq(p,m){return p=p|0,m=m|0,p>>>0>15?(m=4,m|0):(ie[m>>3]=+ie[20624+(p<<3)>>3],m=0,m|0)}function Eue(p,m){return p=p|0,m=m|0,p>>>0>15?(m=4,m|0):(ie[m>>3]=+ie[20752+(p<<3)>>3],m=0,m|0)}function Mue(p,m){return p=p|0,m=m|0,p>>>0>15?(m=4,m|0):(ie[m>>3]=+ie[20880+(p<<3)>>3],m=0,m|0)}function Cue(p,m){return p=p|0,m=m|0,p>>>0>15?(m=4,m|0):(ie[m>>3]=+ie[21008+(p<<3)>>3],m=0,m|0)}function uT(p,m){p=p|0,m=m|0;var g=0;return p>>>0>15?(m=4,m|0):(g=op(7,0,p,((p|0)<0)<<31>>31)|0,g=wr(g|0,ee()|0,120,0)|0,p=ee()|0,h[m>>2]=g|2,h[m+4>>2]=p,m=0,m|0)}function Rue(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0;if(E=Q,Q=Q+176|0,b=E,p=jx(p,m,b)|0,p|0)return b=p,Q=E,b|0;if(ie[g>>3]=0,p=h[b>>2]|0,(p|0)<=1)return b=0,Q=E,b|0;m=p+-1|0,p=0,_=+ie[b+8>>3],v=+ie[b+16>>3],x=0;do p=p+1|0,N=_,_=+ie[b+8+(p<<4)>>3],U=+zi(+((_-N)*.5)),M=v,v=+ie[b+8+(p<<4)+8>>3],M=+zi(+((v-M)*.5)),M=U*U+M*(+ii(+_)*+ii(+N)*M),x=x+ +Sa(+ +bs(+M),+ +bs(+(1-M)))*2;while((p|0)<(m|0));return ie[g>>3]=x,b=0,Q=E,b|0}function Iue(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0;if(E=Q,Q=Q+176|0,b=E,p=jx(p,m,b)|0,p|0)return b=p,x=+ie[g>>3],x=x*6371.007180918475,ie[g>>3]=x,Q=E,b|0;if(ie[g>>3]=0,p=h[b>>2]|0,(p|0)<=1)return b=0,x=0,x=x*6371.007180918475,ie[g>>3]=x,Q=E,b|0;m=p+-1|0,p=0,_=+ie[b+8>>3],v=+ie[b+16>>3],x=0;do p=p+1|0,N=_,_=+ie[b+8+(p<<4)>>3],U=+zi(+((_-N)*.5)),M=v,v=+ie[b+8+(p<<4)+8>>3],M=+zi(+((v-M)*.5)),M=U*U+M*(+ii(+N)*+ii(+_)*M),x=x+ +Sa(+ +bs(+M),+ +bs(+(1-M)))*2;while((p|0)!=(m|0));return ie[g>>3]=x,b=0,U=x,U=U*6371.007180918475,ie[g>>3]=U,Q=E,b|0}function Pue(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0;if(E=Q,Q=Q+176|0,b=E,p=jx(p,m,b)|0,p|0)return b=p,x=+ie[g>>3],x=x*6371.007180918475,x=x*1e3,ie[g>>3]=x,Q=E,b|0;if(ie[g>>3]=0,p=h[b>>2]|0,(p|0)<=1)return b=0,x=0,x=x*6371.007180918475,x=x*1e3,ie[g>>3]=x,Q=E,b|0;m=p+-1|0,p=0,_=+ie[b+8>>3],v=+ie[b+16>>3],x=0;do p=p+1|0,N=_,_=+ie[b+8+(p<<4)>>3],U=+zi(+((_-N)*.5)),M=v,v=+ie[b+8+(p<<4)+8>>3],M=+zi(+((v-M)*.5)),M=U*U+M*(+ii(+N)*+ii(+_)*M),x=x+ +Sa(+ +bs(+M),+ +bs(+(1-M)))*2;while((p|0)!=(m|0));return ie[g>>3]=x,b=0,U=x,U=U*6371.007180918475,U=U*1e3,ie[g>>3]=U,Q=E,b|0}function Lue(p){p=p|0;var m=0,g=0,_=0,v=0,x=0,b=0,E=0;if(p)for(x=p+4|0,b=p+8|0,_=1,v=p;;){if(m=h[v>>2]|0,m|0)do{if(g=h[m>>2]|0,g|0)do E=g,g=h[g+16>>2]|0,_t(E);while((g|0)!=0);E=m,m=h[m+8>>2]|0,_t(E)}while((m|0)!=0);if(m=v,v=h[v+8>>2]|0,_?(h[p>>2]=0,h[x>>2]=0,h[b>>2]=0):_t(m),v)_=0;else break}}function Due(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0;if(h[m>>2]=0,ue=m+4|0,h[ue>>2]=0,xe=m+8|0,h[xe>>2]=0,ae=h[p>>2]|0,(ae|0)<=0)return m=0,m|0;K=p+4|0,p=m,X=0;e:for(;;){if(X){if(g=Ta(1,12)|0,!g){g=5;break}h[p+8>>2]=g,p=g}if(M=h[K>>2]|0,N=Ta(1,12)|0,!N){p=13,g=37;break}if(j=p+4|0,_=h[j>>2]|0,h[((_|0)==0?p:_+8|0)>>2]=N,h[j>>2]=N,_=h[M+(X<<4)>>2]|0,(_|0)<3){p=1,g=37;break}v=M+(X<<4)+4|0,x=N+4|0,g=0,b=0;do{if(E=b,b=br(24)|0,!b){p=13,g=37;break e}CL(b|0,(h[v>>2]|0)+(g<<4)|0,16)|0,h[b+16>>2]=0,E?h[E+16>>2]=b:h[N>>2]=b,h[x>>2]=b,g=g+1|0}while((g|0)<(_|0));if(q=h[M+(X<<4)+8>>2]|0,(q|0)>0){U=M+(X<<4)+12|0,M=0;do{if(_=h[U>>2]|0,g=N,N=Ta(1,12)|0,!N){p=13,g=37;break e}if(h[g+8>>2]=N,h[j>>2]=N,E=h[_+(M<<3)>>2]|0,(E|0)<3){p=1,g=37;break e}_=_+(M<<3)+4|0,v=N+4|0,g=0,x=0;do{if(b=x,x=br(24)|0,!x){p=13,g=37;break e}CL(x|0,(h[_>>2]|0)+(g<<4)|0,16)|0,h[x+16>>2]=0,b?h[b+16>>2]=x:h[N>>2]=x,h[v>>2]=x,g=g+1|0}while((g|0)<(E|0));M=M+1|0}while((M|0)<(q|0))}if(X=X+1|0,(X|0)>=(ae|0)){p=0,g=50;break}}if((g|0)==5){if(!m)return m=13,m|0;for(_=1,v=m;;){if(p=h[v>>2]|0,p|0)do{if(g=h[p>>2]|0,g|0)do ae=g,g=h[g+16>>2]|0,_t(ae);while((g|0)!=0);ae=p,p=h[p+8>>2]|0,_t(ae)}while((p|0)!=0);if(p=v,v=h[v+8>>2]|0,_?(h[m>>2]=0,h[ue>>2]=0,h[xe>>2]=0):_t(p),v)_=0;else{p=13;break}}return p|0}else if((g|0)==37){if(!m)return m=p,m|0;for(v=1,x=m;;){if(g=h[x>>2]|0,g|0)do{if(_=h[g>>2]|0,_|0)do ae=_,_=h[_+16>>2]|0,_t(ae);while((_|0)!=0);ae=g,g=h[g+8>>2]|0,_t(ae)}while((g|0)!=0);if(g=x,x=h[x+8>>2]|0,v?(h[m>>2]=0,h[ue>>2]=0,h[xe>>2]=0):_t(g),x)v=0;else break}return p|0}else if((g|0)==50)return p|0;return 0}function Kx(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0;if(xe=Q,Q=Q+16|0,ue=xe,U=tt(p|0,m|0,52)|0,ee()|0,U=U&15,X=tt(g|0,_|0,52)|0,ee()|0,(U|0)!=(X&15|0))return ue=12,Q=xe,ue|0;if(M=tt(p|0,m|0,45)|0,ee()|0,M=M&127,N=tt(g|0,_|0,45)|0,ee()|0,N=N&127,M>>>0>121|N>>>0>121)return ue=5,Q=xe,ue|0;if(X=(M|0)!=(N|0),X){if(b=oL(M,N)|0,(b|0)==7)return ue=1,Q=xe,ue|0;E=oL(N,M)|0,(E|0)==7?di(27291,27315,164,27325):(ae=b,x=E)}else ae=0,x=0;q=yr(M)|0,j=yr(N)|0,h[ue>>2]=0,h[ue+4>>2]=0,h[ue+8>>2]=0,h[ue+12>>2]=0;do if(ae){N=h[4272+(M*28|0)+(ae<<2)>>2]|0,b=(N|0)>0;e:do if(j)if(b)for(M=0,E=g,b=_;;){switch(E=vue(E,b)|0,b=ee()|0,x|0){case 5:case 1:{x=3;break}case 3:{x=2;break}case 2:{x=6;break}case 6:{x=4;break}case 4:{x=5;break}default:}if(M=M+1|0,(M|0)==(N|0)){N=x,M=E,E=b;break e}}else N=x,M=g,E=_;else if(b)for(M=0,E=g,b=_;;){switch(E=mL(E,b)|0,b=ee()|0,x|0){case 1:{x=3;break}case 3:{x=2;break}case 2:{x=6;break}case 6:{x=4;break}case 4:{x=5;break}case 5:{x=1;break}default:}if(M=M+1|0,(M|0)==(N|0)){N=x,M=E,E=b;break e}}else N=x,M=g,E=_;while(!1);if(gL(M,E,ue)|0,X||di(27340,27315,194,27325),b=(q|0)!=0,x=(j|0)!=0,b&x&&di(27367,27315,195,27325),b){if(x=ll(p,m)|0,(x|0)==7){x=5;break}if(He[21968+(x*7|0)+ae>>0]|0){x=1;break}j=h[21136+(x*28|0)+(ae<<2)>>2]|0,X=j}else if(x){if(x=ll(M,E)|0,(x|0)==7){x=5;break}if(He[21968+(x*7|0)+N>>0]|0){x=1;break}X=0,j=h[21136+(N*28|0)+(x<<2)>>2]|0}else X=0,j=0;if((X|j|0)>=0){if((j|0)>0){g=ue+4|0,_=ue+8|0,q=ue+12|0,N=0,E=h[g>>2]|0,b=h[_>>2]|0,x=h[q>>2]|0;do K=b+E|0,m=(K|0)<0,se=m?K:0,b=x+b-se|0,p=(b|0)<0,M=p?b:0,E=x+E-se-M|0,se=(E|0)<0,x=se?0:E,E=se?E:0,b=(p?0:b)-E|0,E=(m?0:K)-M-E|0,M=(b|0)<(E|0)?b:E,M=(x|0)<(M|0)?x:M,(M|0)>0&&(E=E-M|0,b=b-M|0,x=x-M|0),N=N+1|0;while((N|0)!=(j|0));h[g>>2]=E,h[_>>2]=b,h[q>>2]=x}if((ae+-1|0)>>>0<6?(x=h[22032+(ae*12|0)>>2]|0,E=h[22032+(ae*12|0)+4>>2]|0,se=h[22032+(ae*12|0)+8>>2]|0,b=(E|0)<(x|0)?E:x,b=(se|0)<(b|0)?se:b,b=(b|0)>0?b:0,x=x-b|0,E=E-b|0,b=se-b|0):(x=0,E=0,b=0),U)for(;;)if(M=x*3|0,N=E*3|0,g=b*3|0,xc(U)|0?(m=M+E|0,p=(m|0)<0,se=N+b-(p?m:0)|0,K=(se|0)<0,E=x+g-(p?m:0)-(K?se:0)|0,b=(E|0)<0,ae=b?0:E,M=(K?0:se)-(b?E:0)|0,E=(p?0:m)-(K?se:0)-(b?E:0)|0,b=(M|0)<(E|0)?M:E,b=(ae|0)<(b|0)?ae:b,se=(b|0)>0,x=se?b:0,M=M-(se?b:0)|0,b=ae-(se?b:0)|0):(K=M+b|0,m=(K|0)<0,se=N+x-(m?K:0)|0,x=(se|0)<0,E=g+E-(m?K:0)-(x?se:0)|0,b=(E|0)<0,ae=b?0:E,M=(x?0:se)-(b?E:0)|0,E=(m?0:K)-(x?se:0)-(b?E:0)|0,b=(M|0)<(E|0)?M:E,b=(ae|0)<(b|0)?ae:b,se=(b|0)>0,x=se?b:0,M=M-(se?b:0)|0,b=ae-(se?b:0)|0),x=E-x|0,(U|0)>1)U=U+-1|0,E=M;else{E=M;break}if((X|0)>0){M=0;do m=x+E|0,p=(m|0)<0,se=E+b-(p?m:0)|0,K=(se|0)<0,ae=x+b-(p?m:0)-(K?se:0)|0,x=(ae|0)<0,b=x?0:ae,E=(K?0:se)-(x?ae:0)|0,ae=(p?0:m)-(K?se:0)-(x?ae:0)|0,x=(E|0)<(ae|0)?E:ae,x=(b|0)<(x|0)?b:x,se=(x|0)>0,b=b-(se?x:0)|0,E=E-(se?x:0)|0,x=ae-(se?x:0)|0,M=M+1|0;while((M|0)!=(X|0))}g=ue+4|0,U=ue+8|0,ae=h[U>>2]|0,_=ue+12|0,se=h[_>>2]|0,M=(h[g>>2]|0)+x|0,h[g>>2]=M,E=ae+E|0,h[U>>2]=E,x=se+b|0,h[_>>2]=x,b=E-M|0,(M|0)<0?(x=x-M|0,h[U>>2]=b,h[_>>2]=x,h[g>>2]=0,E=0):(b=E,E=M),(b|0)<0&&(E=E-b|0,h[g>>2]=E,x=x-b|0,h[_>>2]=x,h[U>>2]=0,b=0),N=E-x|0,M=b-x|0,(x|0)<0?(h[g>>2]=N,h[U>>2]=M,h[_>>2]=0,E=N,x=0):M=b,b=(M|0)<(E|0)?M:E,b=(x|0)<(b|0)?x:b,(b|0)>0&&(h[g>>2]=E-b,h[U>>2]=M-b,h[_>>2]=x-b),K=77}else x=5}else if(gL(g,_,ue)|0,(q|0)!=0&(j|0)!=0)if((N|0)!=(M|0)&&di(27398,27315,264,27325),b=ll(p,m)|0,x=ll(g,_)|0,(b|0)==7|(x|0)==7)x=5;else if(He[21968+(b*7|0)+x>>0]|0)x=1;else if(g=h[21136+(b*28|0)+(x<<2)>>2]|0,(g|0)>0){U=ue+4|0,_=ue+8|0,q=ue+12|0,N=0,E=h[U>>2]|0,b=h[_>>2]|0,x=h[q>>2]|0;do ae=b+E|0,K=(ae|0)<0,p=K?ae:0,b=x+b-p|0,m=(b|0)<0,M=m?b:0,E=x+E-p-M|0,p=(E|0)<0,x=p?0:E,E=p?E:0,b=(m?0:b)-E|0,E=(K?0:ae)-M-E|0,M=(b|0)<(E|0)?b:E,M=(x|0)<(M|0)?x:M,(M|0)>0&&(E=E-M|0,b=b-M|0,x=x-M|0),N=N+1|0;while((N|0)!=(g|0));h[U>>2]=E,h[_>>2]=b,h[q>>2]=x,K=77}else K=77;else K=77;while(!1);return(K|0)==77&&(x=ue+4|0,h[v>>2]=h[x>>2],h[v+4>>2]=h[x+4>>2],h[v+8>>2]=h[x+8>>2],x=0),se=x,Q=xe,se|0}function mq(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0,be=0;if(x=tt(p|0,m|0,52)|0,ee()|0,x=x&15,Ae=tt(p|0,m|0,45)|0,ee()|0,Ae=Ae&127,Ae>>>0>121)return _=5,_|0;if(ue=yr(Ae)|0,ft(x|0,0,52)|0,E=ee()|0|134225919,b=_,h[b>>2]=-1,h[b+4>>2]=E,b=h[g>>2]|0,E=h[g+4>>2]|0,g=h[g+8>>2]|0,!x){m=(b|0)<0,xe=m?b:0,we=E-xe|0,ue=(we|0)<0,xe=(ue?0-we|0:0)+(g-xe)|0,g=(xe|0)<0,v=g?0:xe,xe=g?xe:0,g=(ue?0:we)-xe|0,xe=(m?0:b)-(ue?we:0)-xe|0,we=(g|0)<(xe|0)?g:xe,we=(v|0)<(we|0)?v:we,we=(we|0)>0?we:0,v=v-we|0,g=g-we|0;e:do switch(xe-we|0){case 0:switch(g|0){case 0:if(v){v=(v|0)==1?1:7,se=11;break e}else{v=0;break e}case 1:if(v){v=(v|0)==1?3:7,se=11;break e}else{v=2;break e}default:return _=1,_|0}case 1:switch(g|0){case 0:if(v){v=(v|0)==1?5:7,se=11;break e}else{v=4;break e}case 1:{if(v)v=1;else{v=6;break e}return v|0}default:return _=1,_|0}default:return _=1,_|0}while(!1);return(se|0)==11&&(v|0)==7||(v=sL(Ae,v)|0,(v|0)==127)?(_=1,_|0):(we=ft(v|0,0,45)|0,Ae=ee()|0,se=_,Ae=h[se+4>>2]&-1040385|Ae,h[_>>2]=h[se>>2]|we,h[_+4>>2]=Ae,_=0,_|0)}for(;;){if(ae=x,x=x+-1|0,K=b-g|0,X=E-g|0,M=K>>>0>715827881|X>>>0>715827881,xc(ae)|0){if(M){if(U=(K|0)>0,q=2147483647-K|0,j=-2147483648-K|0,U?(q|0)<(K|0):(j|0)>(K|0)){v=1,se=107;break}if(be=K<<1,U?(2147483647-be|0)<(K|0):(-2147483648-be|0)>(K|0)){v=1,se=107;break}if((X|0)>0?(2147483647-X|0)<(X|0):(-2147483648-X|0)>(X|0)){v=1,se=107;break}if(M=K*3|0,N=X<<1,(U?(q|0)<(N|0):(j|0)>(N|0))||((K|0)>-1?(M|-2147483648|0)>=(X|0):(M^-2147483648|0)<(X|0))){v=1,se=107;break}}else M=K*3|0,N=X<<1;if(q=oh(+(M-X|0)*.14285714285714285)|0,U=oh(+(N+K|0)*.14285714285714285)|0,N=(U|0)<(q|0),M=N?q:U,N=N?U:q,(N|0)<0){if((N|0)==-2147483648||((M|0)>0?(2147483647-M|0)<(N|0):(-2147483648-M|0)>(N|0))){se=24;break}if((M|0)>-1?(M|-2147483648|0)>=(N|0):(M^-2147483648|0)<(N|0)){se=24;break}}j=(q|0)<0,X=U-(j?q:0)|0,Ke=(X|0)<0,Be=(j?0-q|0:0)-(Ke?X:0)|0,K=(Be|0)<0,j=(j?0:q)-(Ke?X:0)-(K?Be:0)|0,X=(Ke?0:X)-(K?Be:0)|0,Be=K?0:Be,K=(X|0)<(j|0)?X:j,K=(Be|0)<(K|0)?Be:K,Ke=(K|0)>0,j=j-(Ke?K:0)|0,X=X-(Ke?K:0)|0,K=Be-(Ke?K:0)|0,Ke=(j*3|0)+X|0,Be=(Ke|0)<0,be=(X*3|0)+K-(Be?Ke:0)|0,M=(be|0)<0,q=(K*3|0)+j-(Be?Ke:0)-(M?be:0)|0,U=(q|0)<0,Me=U?0:q,N=(M?0:be)-(U?q:0)|0,q=(Be?0:Ke)-(M?be:0)-(U?q:0)|0,U=(N|0)<(q|0)?N:q,U=(Me|0)<(U|0)?Me:U,be=(U|0)>0,M=be?U:0,N=N-(be?U:0)|0,U=Me-(be?U:0)|0}else{if(M){if(N=(K|0)>0,N?(2147483647-K|0)<(K|0):(-2147483648-K|0)>(K|0)){v=1,se=107;break}if(M=K<<1,U=(X|0)>0,U?(2147483647-X|0)<(X|0):(-2147483648-X|0)>(X|0)){v=1,se=107;break}if(j=X<<1,U?(2147483647-j|0)<(X|0):(-2147483648-j|0)>(X|0)){v=1,se=107;break}if(N?(2147483647-M|0)<(X|0):(-2147483648-M|0)>(X|0)){v=1,se=107;break}if(N=X*3|0,(X|0)>-1?(N|-2147483648|0)>=(K|0):(N^-2147483648|0)<(K|0)){v=1,se=107;break}}else M=K<<1,N=X*3|0;if(q=oh(+(M+X|0)*.14285714285714285)|0,U=oh(+(N-K|0)*.14285714285714285)|0,N=(U|0)<(q|0),M=N?q:U,N=N?U:q,(N|0)<0){if((N|0)==-2147483648||((M|0)>0?(2147483647-M|0)<(N|0):(-2147483648-M|0)>(N|0))){se=36;break}if((M|0)>-1?(M|-2147483648|0)>=(N|0):(M^-2147483648|0)<(N|0)){se=36;break}}j=(q|0)<0,X=U-(j?q:0)|0,Me=(X|0)<0,be=(j?0-q|0:0)-(Me?X:0)|0,K=(be|0)<0,j=(j?0:q)-(Me?X:0)-(K?be:0)|0,X=(Me?0:X)-(K?be:0)|0,be=K?0:be,K=(X|0)<(j|0)?X:j,K=(be|0)<(K|0)?be:K,Me=(K|0)>0,j=j-(Me?K:0)|0,X=X-(Me?K:0)|0,K=be-(Me?K:0)|0,Me=(j*3|0)+K|0,be=(Me|0)<0,Be=(X*3|0)+j-(be?Me:0)|0,M=(Be|0)<0,q=(K*3|0)+X-(be?Me:0)-(M?Be:0)|0,U=(q|0)<0,Ke=U?0:q,N=(M?0:Be)-(U?q:0)|0,q=(be?0:Me)-(M?Be:0)-(U?q:0)|0,U=(N|0)<(q|0)?N:q,U=(Ke|0)<(U|0)?Ke:U,Be=(U|0)>0,M=Be?U:0,N=N-(Be?U:0)|0,U=Ke-(Be?U:0)|0}M=b+(M-q)|0,Me=(M|0)<0,N=E-N-(Me?M:0)|0,q=(N|0)<0,Be=g-U+(Me?0-M|0:0)+(q?0-N|0:0)|0,b=(Be|0)<0,U=b?0:Be,be=(q?0:N)-(b?Be:0)|0,Be=(Me?0:M)-(q?N:0)-(b?Be:0)|0,b=(be|0)<(Be|0)?be:Be,b=(U|0)<(b|0)?U:b,g=(b|0)>0,Be=Be-(g?b:0)|0,N=_,q=h[N>>2]|0,N=h[N+4>>2]|0,E=(15-ae|0)*3|0,M=ft(7,0,E|0)|0,M=q&~M,N=N&~(ee()|0),q=(Be|0)<0,Me=q?Be:0,be=be-(g?b:0)-Me|0,Ke=(be|0)<0,Me=(Ke?0-be|0:0)+(U-(g?b:0)-Me)|0,b=(Me|0)<0,g=b?0:Me,Me=b?Me:0,b=(Ke?0:be)-Me|0,Me=(q?0:Be)-(Ke?be:0)-Me|0,be=(b|0)<(Me|0)?b:Me,be=(g|0)<(be|0)?g:be,be=(be|0)>0?be:0,g=g-be|0,b=b-be|0;e:do switch(Me-be|0){case 0:switch(b|0){case 0:{g=(g|0)==0?0:(g|0)==1?1:7;break e}case 1:{g=(g|0)==0?2:(g|0)==1?3:7;break e}default:{se=45;break e}}case 1:switch(b|0){case 0:{g=(g|0)==0?4:(g|0)==1?5:7;break e}case 1:if(g){se=45;break e}else{g=6;break e}default:{se=45;break e}}default:se=45}while(!1);if((se|0)==45&&(se=0,g=7),Ke=ft(g|0,0,E|0)|0,Me=ee()|0|N,be=_,h[be>>2]=Ke|M,h[be+4>>2]=Me,(ae|0)<=1){se=47;break}else b=j,E=X,g=K}if((se|0)==24)di(27634,27425,416,27447);else if((se|0)==36)di(27634,27425,464,27461);else if((se|0)==47){if((j|0)>1|(X|0)>1|(K|0)>1)return be=1,be|0;Be=(j|0)<0,Me=Be?j:0,be=X-Me|0,Ke=(be|0)<0,Me=(Ke?0-be|0:0)+(K-Me)|0,x=(Me|0)<0,g=x?0:Me,Me=x?Me:0,x=(Ke?0:be)-Me|0,Me=(Be?0:j)-(Ke?be:0)-Me|0,be=(x|0)<(Me|0)?x:Me,be=(g|0)<(be|0)?g:be,be=(be|0)>0?be:0,g=g-be|0,x=x-be|0;e:do switch(Me-be|0){case 0:switch(x|0){case 0:{x=(g|0)==0?0:(g|0)==1?1:7;break e}case 1:{x=(g|0)==0?2:(g|0)==1?3:7;break e}default:{se=55;break e}}case 1:switch(x|0){case 0:{x=(g|0)==0?4:(g|0)==1?5:7;break e}case 1:if(g){se=55;break e}else{x=6;break e}default:{se=55;break e}}default:se=55}while(!1);(se|0)==55&&(x=7),E=sL(Ae,x)|0,(E|0)==127?N=0:N=yr(E)|0;e:do if(x){if(ue){if(g=ll(p,m)|0,(g|0)==7)return be=5,be|0;b=h[21344+(g*28|0)+(x<<2)>>2]|0;t:do if((b|0)>0)for(g=x,x=0;;){switch(g|0){case 1:{g=5;break}case 5:{g=4;break}case 4:{g=6;break}case 6:{g=2;break}case 2:{g=3;break}case 3:{g=1;break}default:}if(x=x+1|0,(x|0)==(b|0))break t}else g=x;while(!1);if((g|0)==1)return be=9,be|0;x=sL(Ae,g)|0,(x|0)==127&&di(27476,27315,415,27506),yr(x)|0?di(27521,27315,416,27506):(v=x,we=b,xe=g)}else v=E,we=0,xe=x;if(M=h[4272+(Ae*28|0)+(xe<<2)>>2]|0,(M|0)<=-1&&di(27552,27315,423,27506),!N){if((we|0)<0)return be=5,be|0;if(we|0){b=_,g=0,x=h[b>>2]|0,b=h[b+4>>2]|0;do x=zm(x,b)|0,b=ee()|0,be=_,h[be>>2]=x,h[be+4>>2]=b,g=g+1|0;while((g|0)<(we|0))}if((M|0)<=0){se=104;break}for(b=_,g=0,x=h[b>>2]|0,b=h[b+4>>2]|0;;)if(x=zm(x,b)|0,b=ee()|0,be=_,h[be>>2]=x,h[be+4>>2]=b,g=g+1|0,(g|0)==(M|0)){se=104;break e}}if(E=oL(v,Ae)|0,(E|0)==7&&di(27291,27315,432,27506),g=_,x=h[g>>2]|0,g=h[g+4>>2]|0,(M|0)>0){b=0;do x=zm(x,g)|0,g=ee()|0,be=_,h[be>>2]=x,h[be+4>>2]=g,b=b+1|0;while((b|0)!=(M|0))}if(g=ll(x,g)|0,(g|0)==7&&di(27634,27315,444,27506),x=rL(v)|0,x=h[(x?21760:21552)+(E*28|0)+(g<<2)>>2]|0,(x|0)<0&&di(27634,27315,458,27506),!x)se=104;else{E=_,g=0,b=h[E>>2]|0,E=h[E+4>>2]|0;do b=pL(b,E)|0,E=ee()|0,be=_,h[be>>2]=b,h[be+4>>2]=E,g=g+1|0;while((g|0)<(x|0));se=104}}else if((ue|0)!=0&(N|0)!=0){if(v=ll(p,m)|0,g=_,g=ll(h[g>>2]|0,h[g+4>>2]|0)|0,(v|0)==7|(g|0)==7||(g=h[21344+(v*28|0)+(g<<2)>>2]|0,(g|0)<0))return be=5,be|0;if(!g)v=E,se=105;else{b=_,v=0,x=h[b>>2]|0,b=h[b+4>>2]|0;do x=zm(x,b)|0,b=ee()|0,be=_,h[be>>2]=x,h[be+4>>2]=b,v=v+1|0;while((v|0)<(g|0));v=E,se=104}}else v=E,se=104;while(!1);return(se|0)==104&&N&&(se=105),(se|0)==105&&(be=_,(ll(h[be>>2]|0,h[be+4>>2]|0)|0)==1)?(be=9,be|0):(Me=_,Be=h[Me>>2]|0,Me=h[Me+4>>2]&-1040385,Ke=ft(v|0,0,45)|0,Me=Me|(ee()|0),be=_,h[be>>2]=Be|Ke,h[be+4>>2]=Me,be=0,be|0)}else if((se|0)==107)return v|0;return 0}function Nue(p,m,g,_,v,x){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0,x=x|0;var b=0,E=0;return E=Q,Q=Q+16|0,b=E,v|0?(b=15,Q=E,b|0):(p=Kx(p,m,g,_,b)|0,p||(v=h[b+4>>2]|0,p=h[b+8>>2]|0,h[x>>2]=(h[b>>2]|0)-p,h[x+4>>2]=v-p,p=0),b=p,Q=E,b|0)}function Fue(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0;return q=Q,Q=Q+16|0,U=q,_|0?(U=15,Q=q,U|0):(E=h[g>>2]|0,b=h[g+4>>2]|0,h[U>>2]=E,M=U+4|0,h[M>>2]=b,N=U+8|0,h[N>>2]=0,g=(b|0)<(E|0),_=g?E:b,g=g?b:E,(g|0)<0?!((g|0)==-2147483648||((_|0)>0?(2147483647-_|0)<(g|0):(-2147483648-_|0)>(g|0)))&&!((_|0)>-1?(_|-2147483648|0)>=(g|0):(_^-2147483648|0)<(g|0))?x=5:_=1:x=5,(x|0)==5&&(_=b-E|0,x=0-E|0,(E|0)<0?(h[M>>2]=_,h[N>>2]=x,h[U>>2]=0,E=0):(_=b,x=0),b=E-_|0,g=x-_|0,(_|0)<0?(h[U>>2]=b,h[N>>2]=g,h[M>>2]=0,E=b,_=0):g=x,b=E-g|0,x=_-g|0,(g|0)<0?(h[U>>2]=b,h[M>>2]=x,h[N>>2]=0,g=0):(x=_,b=E),_=(x|0)<(b|0)?x:b,_=(g|0)<(_|0)?g:_,(_|0)>0&&(h[U>>2]=b-_,h[M>>2]=x-_,h[N>>2]=g-_),_=mq(p,m,U,v)|0),U=_,Q=q,U|0)}function yL(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0;return M=Q,Q=Q+32|0,b=M+12|0,E=M,x=Kx(p,m,p,m,b)|0,x|0?(E=x,Q=M,E|0):(p=Kx(p,m,g,_,E)|0,p|0?(E=p,Q=M,E|0):(p=(h[b>>2]|0)-(h[E>>2]|0)|0,N=(p|0)<0,_=N?0-p|0:0,g=_+((h[b+4>>2]|0)-(h[E+4>>2]|0))|0,m=(g|0)<0,_=(h[b+8>>2]|0)-(h[E+8>>2]|0)+_+(m?0-g|0:0)|0,x=(_|0)<0,b=x?0:_,_=x?_:0,x=(m?0:g)-_|0,_=(N?0:p)-(m?g:0)-_|0,E=(x|0)<(_|0)?x:_,E=(b|0)<(E|0)?b:E,E=(E|0)>0?E:0,b=b-E|0,x=x-E|0,E=_-E|0,E=(E|0)>-1?E:0-E|0,x=(x|0)>-1?x:0-x|0,b=(b|0)>-1?b:0-b|0,b=(x|0)>(b|0)?x:b,b=(E|0)>(b|0)?E:b,E=v,h[E>>2]=b,h[E+4>>2]=((b|0)<0)<<31>>31,E=0,Q=M,E|0))}function Bue(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0;return b=Q,Q=Q+16|0,x=b,p=yL(p,m,g,_,x)|0,p|0?(x=p,Q=b,x|0):(g=x,g=At(h[g>>2]|0,h[g+4>>2]|0,1,0)|0,_=ee()|0,x=v,h[x>>2]=g,h[x+4>>2]=_,x=0,Q=b,x|0)}function Oue(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0;return M=Q,Q=Q+16|0,x=M,b=yL(p,m,g,_,x)|0,b|0?(v=b,Q=M,v|0):(b=x,x=h[b>>2]|0,b=h[b+4>>2]|0,(x|0)==0&(b|0)==0?(h[v>>2]=p,h[v+4>>2]=m,v=0,Q=M,v|0):(E=Aq(p,m,g,_,x,b,v,0,0,1,0)|0,E?(v=(Aq(g,_,p,m,x,b,v,x,b,-1,-1)|0)==0,v=v?0:E,Q=M,v|0):(v=0,Q=M,v|0)))}function Aq(p,m,g,_,v,x,b,E,M,N,U){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0,x=x|0,b=b|0,E=E|0,M=M|0,N=N|0,U=U|0;var q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0,be=0,gt=0,je=0,Ut=0,lt=0;if(Ut=Q,Q=Q+48|0,q=Ut+24|0,j=Ut+12|0,je=Ut,h[q>>2]=0,h[q+4>>2]=0,h[q+8>>2]=0,h[j>>2]=0,h[j+4>>2]=0,h[j+8>>2]=0,Kx(p,m,p,m,q)|0&&di(27634,27315,696,27575),Kx(p,m,g,_,j)|0&&di(27634,27315,701,27575),ae=q+8|0,_=h[ae>>2]|0,g=_-(h[q>>2]|0)|0,h[q>>2]=g,gt=q+4|0,_=(h[gt>>2]|0)-_|0,h[gt>>2]=_,gt=_+g|0,q=0-gt|0,h[ae>>2]=q,ae=j+8|0,se=h[ae>>2]|0,xe=se-(h[j>>2]|0)|0,h[j>>2]=xe,be=j+4|0,se=(h[be>>2]|0)-se|0,h[be>>2]=se,be=se+xe|0,h[ae>>2]=0-be,Me=1/(+(v>>>0)+4294967296*+(x|0)),Be=Me*+(xe-g|0),Ke=Me*+(se-_|0),Me=Me*+(gt-be|0),h[je>>2]=g,be=je+4|0,h[be>>2]=_,gt=je+8|0,h[gt>>2]=q,(x|0)<0)return N=0,Q=Ut,N|0;for(Ae=+(g|0),we=+(_|0),ue=+(q|0),xe=0,se=0;;){if(K=+(xe>>>0)+4294967296*+(se|0),lt=Be*K+Ae,X=Ke*K+we,K=Me*K+ue,_=~~+vT(+lt),q=~~+vT(+X),g=~~+vT(+K),lt=+Qs(+(+(_|0)-lt)),X=+Qs(+(+(q|0)-X)),K=+Qs(+(+(g|0)-K)),lt>X<>K?(j=g+q|0,_=0-j|0):(j=0-_|0,X>K&&(q=j-g|0)),h[be>>2]=q,h[je>>2]=j,h[gt>>2]=0,g=_+q|0,(_|0)>0?(h[be>>2]=g,h[gt>>2]=_,h[je>>2]=0,j=0):(g=q,_=0),(g|0)<0?(q=j-g|0,h[je>>2]=q,_=_-g|0,h[gt>>2]=_,h[be>>2]=0,j=q-_|0,g=0-_|0,(_|0)<0?(h[je>>2]=j,h[be>>2]=g,h[gt>>2]=0,ae=g,_=0):(ae=0,j=q)):ae=g,g=(ae|0)<(j|0)?ae:j,g=(_|0)<(g|0)?_:g,(g|0)>0&&(h[je>>2]=j-g,h[be>>2]=ae-g,h[gt>>2]=_-g),g=wr(xe|0,se|0,N|0,U|0)|0,g=At(g|0,ee()|0,E|0,M|0)|0,ee()|0,g=mq(p,m,je,b+(g<<3)|0)|0,g|0){_=20;break}if(ae=xe,xe=At(xe|0,se|0,1,0)|0,j=se,se=ee()|0,!((j|0)<(x|0)|(j|0)==(x|0)&ae>>>0<v>>>0)){g=0,_=20;break}}return(_|0)==20?(Q=Ut,g|0):0}function op(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0;if((g|0)==0&(_|0)==0)return v=0,x=1,On(v|0),x|0;x=p,v=m,p=1,m=0;do b=(g&1|0)==0&!0,p=wr((b?1:x)|0,(b?0:v)|0,p|0,m|0)|0,m=ee()|0,g=Iq(g|0,_|0,1)|0,_=ee()|0,x=wr(x|0,v|0,x|0,v|0)|0,v=ee()|0;while(!((g|0)==0&(_|0)==0));return On(m|0),p|0}function bL(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0;E=Q,Q=Q+16|0,x=E,b=tt(p|0,m|0,52)|0,ee()|0,b=b&15;do if(b){if(v=T1(p,m,x)|0,!v){N=+ie[x>>3],M=1/+ii(+N),U=+ie[26032+(b<<3)>>3],ie[g>>3]=N+U,ie[g+8>>3]=N-U,N=+ie[x+8>>3],M=U*M,ie[g+16>>3]=M+N,ie[g+24>>3]=N-M;break}return b=v,Q=E,b|0}else{if(v=tt(p|0,m|0,45)|0,ee()|0,v=v&127,v>>>0>121)return b=5,Q=E,b|0;x=22128+(v<<5)|0,h[g>>2]=h[x>>2],h[g+4>>2]=h[x+4>>2],h[g+8>>2]=h[x+8>>2],h[g+12>>2]=h[x+12>>2],h[g+16>>2]=h[x+16>>2],h[g+20>>2]=h[x+20>>2],h[g+24>>2]=h[x+24>>2],h[g+28>>2]=h[x+28>>2];break}while(!1);return Kce(g,_?1.4:1.1),_=26160+(b<<3)|0,(h[_>>2]|0)==(p|0)&&(h[_+4>>2]|0)==(m|0)&&(ie[g>>3]=1.5707963267948966),b=26288+(b<<3)|0,(h[b>>2]|0)==(p|0)&&(h[b+4>>2]|0)==(m|0)&&(ie[g+8>>3]=-1.5707963267948966),+ie[g>>3]!=1.5707963267948966&&+ie[g+8>>3]!=-1.5707963267948966?(b=0,Q=E,b|0):(ie[g+16>>3]=3.141592653589793,ie[g+24>>3]=-3.141592653589793,b=0,Q=E,b|0)}function Uue(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0;N=Q,Q=Q+48|0,b=N+32|0,x=N+40|0,E=N,fL(b,0,0,0),M=h[b>>2]|0,b=h[b+4>>2]|0;do if(g>>>0<=15){if(v=Jx(_)|0,v|0){_=E,h[_>>2]=0,h[_+4>>2]=0,h[E+8>>2]=v,h[E+12>>2]=-1,_=E+16|0,M=E+29|0,h[_>>2]=0,h[_+4>>2]=0,h[_+8>>2]=0,He[_+12>>0]=0,He[M>>0]=He[x>>0]|0,He[M+1>>0]=He[x+1>>0]|0,He[M+2>>0]=He[x+2>>0]|0;break}if(v=Ta((h[m+8>>2]|0)+1|0,32)|0,v){wL(m,v),U=E,h[U>>2]=M,h[U+4>>2]=b,h[E+8>>2]=0,h[E+12>>2]=g,h[E+16>>2]=_,h[E+20>>2]=m,h[E+24>>2]=v,He[E+28>>0]=0,M=E+29|0,He[M>>0]=He[x>>0]|0,He[M+1>>0]=He[x+1>>0]|0,He[M+2>>0]=He[x+2>>0]|0;break}else{_=E,h[_>>2]=0,h[_+4>>2]=0,h[E+8>>2]=13,h[E+12>>2]=-1,_=E+16|0,M=E+29|0,h[_>>2]=0,h[_+4>>2]=0,h[_+8>>2]=0,He[_+12>>0]=0,He[M>>0]=He[x>>0]|0,He[M+1>>0]=He[x+1>>0]|0,He[M+2>>0]=He[x+2>>0]|0;break}}else M=E,h[M>>2]=0,h[M+4>>2]=0,h[E+8>>2]=4,h[E+12>>2]=-1,M=E+16|0,U=E+29|0,h[M>>2]=0,h[M+4>>2]=0,h[M+8>>2]=0,He[M+12>>0]=0,He[U>>0]=He[x>>0]|0,He[U+1>>0]=He[x+1>>0]|0,He[U+2>>0]=He[x+2>>0]|0;while(!1);hT(E),h[p>>2]=h[E>>2],h[p+4>>2]=h[E+4>>2],h[p+8>>2]=h[E+8>>2],h[p+12>>2]=h[E+12>>2],h[p+16>>2]=h[E+16>>2],h[p+20>>2]=h[E+20>>2],h[p+24>>2]=h[E+24>>2],h[p+28>>2]=h[E+28>>2],Q=N}function hT(p){p=p|0;var m=0,g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0;if(Ae=Q,Q=Q+336|0,X=Ae+168|0,K=Ae,_=p,g=h[_>>2]|0,_=h[_+4>>2]|0,(g|0)==0&(_|0)==0){Q=Ae;return}if(m=p+28|0,He[m>>0]|0?(g=gq(g,_)|0,_=ee()|0):He[m>>0]=1,we=p+20|0,!(h[h[we>>2]>>2]|0)){m=p+24|0,g=h[m>>2]|0,g|0&&_t(g),se=p,h[se>>2]=0,h[se+4>>2]=0,h[p+8>>2]=0,h[we>>2]=0,h[p+12>>2]=-1,h[p+16>>2]=0,h[m>>2]=0,Q=Ae;return}se=p+16|0,m=h[se>>2]|0,v=m&15;e:do if((g|0)==0&(_|0)==0)xe=p+24|0;else{ae=p+12|0,q=(v|0)==3,U=m&255,M=(v|1|0)==3,j=p+24|0,N=(v+-1|0)>>>0<3,b=(v|2|0)==3,E=K+8|0;t:for(;;){if(x=tt(g|0,_|0,52)|0,ee()|0,x=x&15,(x|0)==(h[ae>>2]|0)){switch(U&15){case 0:case 2:case 3:{if(v=T1(g,_,X)|0,v|0){ue=15;break t}if(SL(h[we>>2]|0,h[j>>2]|0,X)|0){ue=19;break t}break}default:}if(M&&(v=h[(h[we>>2]|0)+4>>2]|0,h[X>>2]=h[v>>2],h[X+4>>2]=h[v+4>>2],h[X+8>>2]=h[v+8>>2],h[X+12>>2]=h[v+12>>2],tq(26896,X)|0)){if(AL(h[(h[we>>2]|0)+4>>2]|0,x,K)|0){ue=25;break}if(v=K,(h[v>>2]|0)==(g|0)&&(h[v+4>>2]|0)==(_|0)){ue=29;break}}if(N){if(v=Vm(g,_,X)|0,v|0){ue=32;break}if(bL(g,_,K,0)|0){ue=36;break}if(b&&_q(h[we>>2]|0,h[j>>2]|0,X,K)|0){ue=42;break}if(M&&xq(h[we>>2]|0,h[j>>2]|0,X,K)|0){ue=42;break}}if(q){if(m=bL(g,_,X,1)|0,v=h[j>>2]|0,m|0){ue=45;break}if(aL(v,X)|0){if(iq(K,X),nq(X,h[j>>2]|0)|0){ue=53;break}if(SL(h[we>>2]|0,h[j>>2]|0,E)|0){ue=53;break}if(xq(h[we>>2]|0,h[j>>2]|0,K,X)|0){ue=53;break}}}}do if((x|0)<(h[ae>>2]|0)){if(m=bL(g,_,X,1)|0,v=h[j>>2]|0,m|0){ue=58;break t}if(!(aL(v,X)|0)){ue=73;break}if(nq(h[j>>2]|0,X)|0&&(iq(K,X),_q(h[we>>2]|0,h[j>>2]|0,K,X)|0)){ue=65;break t}if(g=hq(g,_,x+1|0,K)|0,g|0){ue=67;break t}_=K,g=h[_>>2]|0,_=h[_+4>>2]|0}else ue=73;while(!1);if((ue|0)==73&&(ue=0,g=gq(g,_)|0,_=ee()|0),(g|0)==0&(_|0)==0){xe=j;break e}}switch(ue|0){case 15:{m=h[j>>2]|0,m|0&&_t(m),ue=p,h[ue>>2]=0,h[ue+4>>2]=0,h[we>>2]=0,h[ae>>2]=-1,h[se>>2]=0,h[j>>2]=0,h[p+8>>2]=v,ue=20;break}case 19:{h[p>>2]=g,h[p+4>>2]=_,ue=20;break}case 25:{di(27634,27600,470,27611);break}case 29:{h[p>>2]=g,h[p+4>>2]=_,Q=Ae;return}case 32:{m=h[j>>2]|0,m|0&&_t(m),xe=p,h[xe>>2]=0,h[xe+4>>2]=0,h[we>>2]=0,h[ae>>2]=-1,h[se>>2]=0,h[j>>2]=0,h[p+8>>2]=v,Q=Ae;return}case 36:{di(27634,27600,493,27611);break}case 42:{h[p>>2]=g,h[p+4>>2]=_,Q=Ae;return}case 45:{v|0&&_t(v),ue=p,h[ue>>2]=0,h[ue+4>>2]=0,h[we>>2]=0,h[ae>>2]=-1,h[se>>2]=0,h[j>>2]=0,h[p+8>>2]=m,ue=55;break}case 53:{h[p>>2]=g,h[p+4>>2]=_,ue=55;break}case 58:{v|0&&_t(v),ue=p,h[ue>>2]=0,h[ue+4>>2]=0,h[we>>2]=0,h[ae>>2]=-1,h[se>>2]=0,h[j>>2]=0,h[p+8>>2]=m,ue=71;break}case 65:{h[p>>2]=g,h[p+4>>2]=_,ue=71;break}case 67:{m=h[j>>2]|0,m|0&&_t(m),xe=p,h[xe>>2]=0,h[xe+4>>2]=0,h[we>>2]=0,h[ae>>2]=-1,h[se>>2]=0,h[j>>2]=0,h[p+8>>2]=g,Q=Ae;return}}if((ue|0)==20){Q=Ae;return}else if((ue|0)==55){Q=Ae;return}else if((ue|0)==71){Q=Ae;return}}while(!1);m=h[xe>>2]|0,m|0&&_t(m),ue=p,h[ue>>2]=0,h[ue+4>>2]=0,h[p+8>>2]=0,h[we>>2]=0,h[p+12>>2]=-1,h[se>>2]=0,h[xe>>2]=0,Q=Ae}function gq(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0;q=Q,Q=Q+16|0,U=q,_=tt(p|0,m|0,52)|0,ee()|0,_=_&15,g=tt(p|0,m|0,45)|0,ee()|0;do if(_){for(;g=ft(_+4095|0,0,52)|0,v=ee()|0|m&-15728641,x=(15-_|0)*3|0,b=ft(7,0,x|0)|0,E=ee()|0,g=g|p|b,v=v|E,M=tt(p|0,m|0,x|0)|0,ee()|0,M=M&7,_=_+-1|0,!(M>>>0<6);)if(_)m=v,p=g;else{N=4;break}if((N|0)==4){g=tt(g|0,v|0,45)|0,ee()|0;break}return U=(M|0)==0&(Zi(g,v)|0)!=0,U=ft((U?2:1)+M|0,0,x|0)|0,N=ee()|0|m&~E,U=U|p&~b,On(N|0),Q=q,U|0}while(!1);return g=g&127,g>>>0>120?(N=0,U=0,On(N|0),Q=q,U|0):(fL(U,0,g+1|0,0),N=h[U+4>>2]|0,U=h[U>>2]|0,On(N|0),Q=q,U|0)}function kue(p,m,g,_,v,x){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0,x=x|0;var b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0;ue=Q,Q=Q+160|0,q=ue+80|0,E=ue+64|0,j=ue+112|0,ae=ue,Uue(q,p,m,g),N=q,_L(E,h[N>>2]|0,h[N+4>>2]|0,m),N=E,M=h[N>>2]|0,N=h[N+4>>2]|0,b=h[q+8>>2]|0,X=j+4|0,h[X>>2]=h[q>>2],h[X+4>>2]=h[q+4>>2],h[X+8>>2]=h[q+8>>2],h[X+12>>2]=h[q+12>>2],h[X+16>>2]=h[q+16>>2],h[X+20>>2]=h[q+20>>2],h[X+24>>2]=h[q+24>>2],h[X+28>>2]=h[q+28>>2],X=ae,h[X>>2]=M,h[X+4>>2]=N,X=ae+8|0,h[X>>2]=b,p=ae+12|0,m=j,g=p+36|0;do h[p>>2]=h[m>>2],p=p+4|0,m=m+4|0;while((p|0)<(g|0));if(j=ae+48|0,h[j>>2]=h[E>>2],h[j+4>>2]=h[E+4>>2],h[j+8>>2]=h[E+8>>2],h[j+12>>2]=h[E+12>>2],(M|0)==0&(N|0)==0)return ae=b,Q=ue,ae|0;g=ae+16|0,U=ae+24|0,q=ae+28|0,b=0,E=0,m=M,p=N;do{if(!((b|0)<(v|0)|(b|0)==(v|0)&E>>>0<_>>>0)){K=4;break}if(N=E,E=At(E|0,b|0,1,0)|0,b=ee()|0,N=x+(N<<3)|0,h[N>>2]=m,h[N+4>>2]=p,xL(j),p=j,m=h[p>>2]|0,p=h[p+4>>2]|0,(m|0)==0&(p|0)==0){if(hT(g),m=g,p=h[m>>2]|0,m=h[m+4>>2]|0,(p|0)==0&(m|0)==0){K=10;break}dq(p,m,h[q>>2]|0,j),p=j,m=h[p>>2]|0,p=h[p+4>>2]|0}N=ae,h[N>>2]=m,h[N+4>>2]=p}while(!((m|0)==0&(p|0)==0));return(K|0)==4?(p=ae+40|0,m=h[p>>2]|0,m|0&&_t(m),K=ae+16|0,h[K>>2]=0,h[K+4>>2]=0,h[U>>2]=0,h[ae+36>>2]=0,h[q>>2]=-1,h[ae+32>>2]=0,h[p>>2]=0,dq(0,0,0,j),h[ae>>2]=0,h[ae+4>>2]=0,h[X>>2]=0,ae=14,Q=ue,ae|0):((K|0)==10&&(h[ae>>2]=0,h[ae+4>>2]=0,h[X>>2]=h[U>>2]),ae=h[X>>2]|0,Q=ue,ae|0)}function zue(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0;if(q=Q,Q=Q+48|0,M=q+32|0,E=q+40|0,N=q,!(h[p>>2]|0))return U=_,h[U>>2]=0,h[U+4>>2]=0,U=0,Q=q,U|0;fL(M,0,0,0),b=M,v=h[b>>2]|0,b=h[b+4>>2]|0;do if(m>>>0>15)U=N,h[U>>2]=0,h[U+4>>2]=0,h[N+8>>2]=4,h[N+12>>2]=-1,U=N+16|0,g=N+29|0,h[U>>2]=0,h[U+4>>2]=0,h[U+8>>2]=0,He[U+12>>0]=0,He[g>>0]=He[E>>0]|0,He[g+1>>0]=He[E+1>>0]|0,He[g+2>>0]=He[E+2>>0]|0,g=4,U=9;else{if(g=Jx(g)|0,g|0){M=N,h[M>>2]=0,h[M+4>>2]=0,h[N+8>>2]=g,h[N+12>>2]=-1,M=N+16|0,U=N+29|0,h[M>>2]=0,h[M+4>>2]=0,h[M+8>>2]=0,He[M+12>>0]=0,He[U>>0]=He[E>>0]|0,He[U+1>>0]=He[E+1>>0]|0,He[U+2>>0]=He[E+2>>0]|0,U=9;break}if(g=Ta((h[p+8>>2]|0)+1|0,32)|0,!g){U=N,h[U>>2]=0,h[U+4>>2]=0,h[N+8>>2]=13,h[N+12>>2]=-1,U=N+16|0,g=N+29|0,h[U>>2]=0,h[U+4>>2]=0,h[U+8>>2]=0,He[U+12>>0]=0,He[g>>0]=He[E>>0]|0,He[g+1>>0]=He[E+1>>0]|0,He[g+2>>0]=He[E+2>>0]|0,g=13,U=9;break}wL(p,g),X=N,h[X>>2]=v,h[X+4>>2]=b,b=N+8|0,h[b>>2]=0,h[N+12>>2]=m,h[N+20>>2]=p,h[N+24>>2]=g,He[N+28>>0]=0,v=N+29|0,He[v>>0]=He[E>>0]|0,He[v+1>>0]=He[E+1>>0]|0,He[v+2>>0]=He[E+2>>0]|0,h[N+16>>2]=3,j=+$ce(g),j=j*+jce(g),x=+Qs(+ +ie[g>>3]),x=j/+ii(+ +gT(+x,+ +Qs(+ +ie[g+8>>3])))*6371.007180918475*6371.007180918475,v=N+12|0,g=h[v>>2]|0;e:do if((g|0)>0)do{if(pq(g+-1|0,M)|0,!(x/+ie[M>>3]>10))break e;X=h[v>>2]|0,g=X+-1|0,h[v>>2]=g}while((X|0)>1);while(!1);if(hT(N),v=_,h[v>>2]=0,h[v+4>>2]=0,v=N,g=h[v>>2]|0,v=h[v+4>>2]|0,!((g|0)==0&(v|0)==0))do $x(g,v,m,M)|0,E=M,p=_,E=At(h[p>>2]|0,h[p+4>>2]|0,h[E>>2]|0,h[E+4>>2]|0)|0,p=ee()|0,X=_,h[X>>2]=E,h[X+4>>2]=p,hT(N),X=N,g=h[X>>2]|0,v=h[X+4>>2]|0;while(!((g|0)==0&(v|0)==0));g=h[b>>2]|0}while(!1);return X=g,Q=q,X|0}function Qx(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0;if(!(tq(m,g)|0)||(m=Xce(m)|0,_=+ie[g>>3],v=+ie[g+8>>3],v=m&v<0?v+6.283185307179586:v,j=h[p>>2]|0,(j|0)<=0))return j=0,j|0;if(q=h[p+4>>2]|0,m){m=0,U=v,g=-1,p=0;e:for(;;){for(N=p;b=+ie[q+(N<<4)>>3],v=+ie[q+(N<<4)+8>>3],p=(g+2|0)%(j|0)|0,x=+ie[q+(p<<4)>>3],E=+ie[q+(p<<4)+8>>3],b>x?(M=b,b=E):(M=x,x=b,b=v,v=E),_=_==x|_==M?_+2220446049250313e-31:_,!!(_<x|_>M);)if(g=N+1|0,(g|0)>=(j|0)){g=22;break e}else p=N,N=g,g=p;if(E=b<0?b+6.283185307179586:b,b=v<0?v+6.283185307179586:v,U=E==U|b==U?U+-2220446049250313e-31:U,M=E+(b-E)*((_-x)/(M-x)),(M<0?M+6.283185307179586:M)>U&&(m=m^1),p=N+1|0,(p|0)>=(j|0)){g=22;break}else g=N}if((g|0)==22)return m|0}else{m=0,U=v,g=-1,p=0;e:for(;;){for(N=p;b=+ie[q+(N<<4)>>3],v=+ie[q+(N<<4)+8>>3],p=(g+2|0)%(j|0)|0,x=+ie[q+(p<<4)>>3],E=+ie[q+(p<<4)+8>>3],b>x?(M=b,b=E):(M=x,x=b,b=v,v=E),_=_==x|_==M?_+2220446049250313e-31:_,!!(_<x|_>M);)if(g=N+1|0,(g|0)>=(j|0)){g=22;break e}else p=N,N=g,g=p;if(U=b==U|v==U?U+-2220446049250313e-31:U,b+(v-b)*((_-x)/(M-x))>U&&(m=m^1),p=N+1|0,(p|0)>=(j|0)){g=22;break}else g=N}if((g|0)==22)return m|0}return 0}function vq(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0;if(K=h[p>>2]|0,!K){h[m>>2]=0,h[m+4>>2]=0,h[m+8>>2]=0,h[m+12>>2]=0,h[m+16>>2]=0,h[m+20>>2]=0,h[m+24>>2]=0,h[m+28>>2]=0;return}if(ae=m+8|0,ie[ae>>3]=17976931348623157e292,ue=m+24|0,ie[ue>>3]=17976931348623157e292,ie[m>>3]=-17976931348623157e292,xe=m+16|0,ie[xe>>3]=-17976931348623157e292,!((K|0)<=0)){for(j=h[p+4>>2]|0,N=17976931348623157e292,U=-17976931348623157e292,q=0,p=-1,x=17976931348623157e292,b=17976931348623157e292,M=-17976931348623157e292,_=-17976931348623157e292,X=0;g=+ie[j+(X<<4)>>3],E=+ie[j+(X<<4)+8>>3],p=p+2|0,v=+ie[j+(((p|0)==(K|0)?0:p)<<4)+8>>3],g<x&&(ie[ae>>3]=g,x=g),E<b&&(ie[ue>>3]=E,b=E),g>M?ie[m>>3]=g:g=M,E>_&&(ie[xe>>3]=E,_=E),N=E>0&E<N?E:N,U=E<0&E>U?E:U,q=q|+Qs(+(E-v))>3.141592653589793,p=X+1|0,(p|0)!=(K|0);)se=X,M=g,X=p,p=se;q&&(ie[xe>>3]=U,ie[ue>>3]=N)}}function Jx(p){return p=p|0,(p>>>0<4?0:15)|0}function wL(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0;if(K=h[p>>2]|0,K){if(ae=m+8|0,ie[ae>>3]=17976931348623157e292,ue=m+24|0,ie[ue>>3]=17976931348623157e292,ie[m>>3]=-17976931348623157e292,xe=m+16|0,ie[xe>>3]=-17976931348623157e292,(K|0)>0){for(v=h[p+4>>2]|0,j=17976931348623157e292,X=-17976931348623157e292,_=0,g=-1,M=17976931348623157e292,N=17976931348623157e292,q=-17976931348623157e292,b=-17976931348623157e292,se=0;x=+ie[v+(se<<4)>>3],U=+ie[v+(se<<4)+8>>3],Ke=g+2|0,E=+ie[v+(((Ke|0)==(K|0)?0:Ke)<<4)+8>>3],x<M&&(ie[ae>>3]=x,M=x),U<N&&(ie[ue>>3]=U,N=U),x>q?ie[m>>3]=x:x=q,U>b&&(ie[xe>>3]=U,b=U),j=U>0&U<j?U:j,X=U<0&U>X?U:X,_=_|+Qs(+(U-E))>3.141592653589793,g=se+1|0,(g|0)!=(K|0);)Ke=se,q=x,se=g,g=Ke;_&&(ie[xe>>3]=X,ie[ue>>3]=j)}}else h[m>>2]=0,h[m+4>>2]=0,h[m+8>>2]=0,h[m+12>>2]=0,h[m+16>>2]=0,h[m+20>>2]=0,h[m+24>>2]=0,h[m+28>>2]=0;if(Ke=p+8|0,g=h[Ke>>2]|0,!((g|0)<=0)){Be=p+12|0,Ae=0;do if(v=h[Be>>2]|0,_=Ae,Ae=Ae+1|0,ue=m+(Ae<<5)|0,xe=h[v+(_<<3)>>2]|0,xe){if(se=m+(Ae<<5)+8|0,ie[se>>3]=17976931348623157e292,p=m+(Ae<<5)+24|0,ie[p>>3]=17976931348623157e292,ie[ue>>3]=-17976931348623157e292,we=m+(Ae<<5)+16|0,ie[we>>3]=-17976931348623157e292,(xe|0)>0){for(K=h[v+(_<<3)+4>>2]|0,j=17976931348623157e292,X=-17976931348623157e292,v=0,_=-1,ae=0,M=17976931348623157e292,N=17976931348623157e292,U=-17976931348623157e292,b=-17976931348623157e292;x=+ie[K+(ae<<4)>>3],q=+ie[K+(ae<<4)+8>>3],_=_+2|0,E=+ie[K+(((_|0)==(xe|0)?0:_)<<4)+8>>3],x<M&&(ie[se>>3]=x,M=x),q<N&&(ie[p>>3]=q,N=q),x>U?ie[ue>>3]=x:x=U,q>b&&(ie[we>>3]=q,b=q),j=q>0&q<j?q:j,X=q<0&q>X?q:X,v=v|+Qs(+(q-E))>3.141592653589793,_=ae+1|0,(_|0)!=(xe|0);)Me=ae,ae=_,U=x,_=Me;v&&(ie[we>>3]=X,ie[p>>3]=j)}}else h[ue>>2]=0,h[ue+4>>2]=0,h[ue+8>>2]=0,h[ue+12>>2]=0,h[ue+16>>2]=0,h[ue+20>>2]=0,h[ue+24>>2]=0,h[ue+28>>2]=0,g=h[Ke>>2]|0;while((Ae|0)<(g|0))}}function SL(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0;if(!(Qx(p,m,g)|0))return v=0,v|0;if(v=p+8|0,(h[v>>2]|0)<=0)return v=1,v|0;for(_=p+12|0,p=0;;){if(x=p,p=p+1|0,Qx((h[_>>2]|0)+(x<<3)|0,m+(p<<5)|0,g)|0){p=0,_=6;break}if((p|0)>=(h[v>>2]|0)){p=1,_=6;break}}return(_|0)==6?p|0:0}function _q(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0;if(N=Q,Q=Q+16|0,E=N,b=g+8|0,!(Qx(p,m,b)|0))return M=0,Q=N,M|0;M=p+8|0;e:do if((h[M>>2]|0)>0){for(x=p+12|0,v=0;;){if(U=v,v=v+1|0,Qx((h[x>>2]|0)+(U<<3)|0,m+(v<<5)|0,b)|0){v=0;break}if((v|0)>=(h[M>>2]|0))break e}return Q=N,v|0}while(!1);if(fT(p,m,g,_)|0)return U=0,Q=N,U|0;h[E>>2]=h[g>>2],h[E+4>>2]=b,v=h[M>>2]|0;e:do if((v|0)>0)for(p=p+12|0,b=0,x=v;;){if(v=h[p>>2]|0,(h[v+(b<<3)>>2]|0)>0){if(Qx(E,_,h[v+(b<<3)+4>>2]|0)|0){v=0;break e}if(v=b+1|0,fT((h[p>>2]|0)+(b<<3)|0,m+(v<<5)|0,g,_)|0){v=0;break e}x=h[M>>2]|0}else v=b+1|0;if((v|0)<(x|0))b=v;else{v=1;break}}else v=1;while(!1);return U=v,Q=N,U|0}function fT(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0,Ke=0,Me=0,be=0;if(Ke=Q,Q=Q+176|0,se=Ke+172|0,v=Ke+168|0,we=Ke,!(aL(m,_)|0))return p=0,Q=Ke,p|0;if(Yce(m,_,se,v),fu(we|0,g|0,168)|0,(h[g>>2]|0)>0){m=0;do Me=we+8+(m<<4)+8|0,xe=+kl(+ie[Me>>3],h[v>>2]|0),ie[Me>>3]=xe,m=m+1|0;while((m|0)<(h[g>>2]|0))}ae=+ie[_>>3],ue=+ie[_+8>>3],xe=+kl(+ie[_+16>>3],h[v>>2]|0),X=+kl(+ie[_+24>>3],h[v>>2]|0);e:do if((h[p>>2]|0)>0){if(_=p+4|0,v=h[we>>2]|0,(v|0)<=0){for(m=0;;)if(m=m+1|0,(m|0)>=(h[p>>2]|0)){m=0;break e}}for(g=0;;){if(m=h[_>>2]|0,j=+ie[m+(g<<4)>>3],K=+kl(+ie[m+(g<<4)+8>>3],h[se>>2]|0),m=h[_>>2]|0,g=g+1|0,Me=(g|0)%(h[p>>2]|0)|0,x=+ie[m+(Me<<4)>>3],b=+kl(+ie[m+(Me<<4)+8>>3],h[se>>2]|0),!(j>=ae)|!(x>=ae)&&!(j<=ue)|!(x<=ue)&&!(K<=X)|!(b<=X)&&!(K>=xe)|!(b>=xe)){q=x-j,N=b-K,m=0;do if(be=m,m=m+1|0,Me=(m|0)==(v|0)?0:m,x=+ie[we+8+(be<<4)+8>>3],b=+ie[we+8+(Me<<4)+8>>3]-x,E=+ie[we+8+(be<<4)>>3],M=+ie[we+8+(Me<<4)>>3]-E,U=q*b-N*M,U!=0&&(Ae=K-x,Be=j-E,M=(Ae*M-b*Be)/U,!(M<0|M>1))&&(U=(q*Ae-N*Be)/U,U>=0&U<=1)){m=1;break e}while((m|0)<(v|0))}if((g|0)>=(h[p>>2]|0)){m=0;break}}}else m=0;while(!1);return be=m,Q=Ke,be|0}function xq(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0;if(fT(p,m,g,_)|0)return x=1,x|0;if(x=p+8|0,(h[x>>2]|0)<=0)return x=0,x|0;for(v=p+12|0,p=0;;){if(b=p,p=p+1|0,fT((h[v>>2]|0)+(b<<3)|0,m+(p<<5)|0,g,_)|0){p=1,v=6;break}if((p|0)>=(h[x>>2]|0)){p=0,v=6;break}}return(v|0)==6?p|0:0}function Vue(){return 8}function Gue(){return 16}function que(){return 168}function Hue(){return 8}function Wue(){return 16}function jue(){return 12}function Xue(){return 8}function $ue(p){return p=p|0,+(+((h[p>>2]|0)>>>0)+4294967296*+(h[p+4>>2]|0))}function Yue(p){p=p|0;var m=0,g=0;return g=+ie[p>>3],m=+ie[p+8>>3],+ +bs(+(g*g+m*m))}function yq(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0;N=+ie[p>>3],M=+ie[m>>3]-N,E=+ie[p+8>>3],b=+ie[m+8>>3]-E,q=+ie[g>>3],x=+ie[_>>3]-q,j=+ie[g+8>>3],U=+ie[_+8>>3]-j,x=(x*(E-j)-(N-q)*U)/(M*U-b*x),ie[v>>3]=N+M*x,ie[v+8>>3]=E+b*x}function bq(p,m){return p=p|0,m=m|0,+Qs(+(+ie[p>>3]-+ie[m>>3]))<11920928955078125e-23?(m=+Qs(+(+ie[p+8>>3]-+ie[m+8>>3]))<11920928955078125e-23,m|0):(m=0,m|0)}function Zue(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0;if(x=Q,Q=Q+16|0,v=x,_=Zi(p,m)|0,(g+-1|0)>>>0>5||(_=(_|0)!=0,(g|0)==1&_))return v=-1,Q=x,v|0;do if(ey(p,m,v)|0)_=-1;else if(_){_=((h[26416+(g<<2)>>2]|0)+5-(h[v>>2]|0)|0)%5|0;break}else{_=((h[26448+(g<<2)>>2]|0)+6-(h[v>>2]|0)|0)%6|0;break}while(!1);return v=_,Q=x,v|0}function ey(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0;if(U=Q,Q=Q+32|0,E=U+16|0,M=U,_=S1(p,m,E)|0,_|0)return g=_,Q=U,g|0;x=cq(p,m)|0,N=ll(p,m)|0,Gce(x,M),_=qce(x,h[E>>2]|0)|0;do if(yr(x)|0){do switch(x|0){case 4:{v=0;break}case 14:{v=1;break}case 24:{v=2;break}case 38:{v=3;break}case 49:{v=4;break}case 58:{v=5;break}case 63:{v=6;break}case 72:{v=7;break}case 83:{v=8;break}case 97:{v=9;break}case 107:{v=10;break}case 117:{v=11;break}default:di(27634,27636,75,27645)}while(!1);if(b=h[26480+(v*24|0)+8>>2]|0,m=h[26480+(v*24|0)+16>>2]|0,p=h[E>>2]|0,(p|0)!=(h[M>>2]|0)&&(M=rL(x)|0,p=h[E>>2]|0,M|(p|0)==(m|0)&&(_=(_+1|0)%6|0)),(N|0)==3&(p|0)==(m|0)){_=(_+5|0)%6|0;break}(N|0)==5&(p|0)==(b|0)&&(_=(_+1|0)%6|0)}while(!1);return h[g>>2]=_,g=0,Q=U,g|0}function yc(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0;if(we=Q,Q=Q+32|0,se=we+24|0,ue=we+20|0,K=we+8|0,X=we+16|0,j=we,M=(Zi(p,m)|0)==0,M=M?6:5,U=tt(p|0,m|0,52)|0,ee()|0,U=U&15,M>>>0<=g>>>0)return _=2,Q=we,_|0;q=(U|0)==0,!q&&(ae=ft(7,0,(U^15)*3|0)|0,(ae&p|0)==0&((ee()|0)&m|0)==0)?v=g:x=4;e:do if((x|0)==4){if(v=(Zi(p,m)|0)!=0,((v?4:5)|0)<(g|0)||ey(p,m,se)|0||(x=(h[se>>2]|0)+g|0,v?v=26768+(((x|0)%5|0)<<2)|0:v=26800+(((x|0)%6|0)<<2)|0,ae=h[v>>2]|0,(ae|0)==7))return _=1,Q=we,_|0;h[ue>>2]=0,v=Js(p,m,ae,ue,K)|0;do if(!v){if(E=K,N=h[E>>2]|0,E=h[E+4>>2]|0,b=E>>>0<m>>>0|(E|0)==(m|0)&N>>>0<p>>>0,x=b?N:p,b=b?E:m,!q&&(q=ft(7,0,(U^15)*3|0)|0,(N&q|0)==0&(E&(ee()|0)|0)==0))v=g;else{if(E=(g+-1+M|0)%(M|0)|0,v=Zi(p,m)|0,(E|0)<0&&di(27634,27636,248,27661),M=(v|0)!=0,((M?4:5)|0)<(E|0)&&di(27634,27636,248,27661),ey(p,m,se)|0&&di(27634,27636,248,27661),v=(h[se>>2]|0)+E|0,M?v=26768+(((v|0)%5|0)<<2)|0:v=26800+(((v|0)%6|0)<<2)|0,E=h[v>>2]|0,(E|0)==7&&di(27634,27636,248,27661),h[X>>2]=0,v=Js(p,m,E,X,j)|0,v|0)break;N=j,M=h[N>>2]|0,N=h[N+4>>2]|0;do if(N>>>0<b>>>0|(N|0)==(b|0)&M>>>0<x>>>0){if(Zi(M,N)|0?x=aT(M,N,p,m)|0:x=h[26864+((((h[X>>2]|0)+(h[26832+(E<<2)>>2]|0)|0)%6|0)<<2)>>2]|0,v=Zi(M,N)|0,(x+-1|0)>>>0>5){v=-1,x=M,b=N;break}if(v=(v|0)!=0,(x|0)==1&v){v=-1,x=M,b=N;break}do if(ey(M,N,se)|0)v=-1;else if(v){v=((h[26416+(x<<2)>>2]|0)+5-(h[se>>2]|0)|0)%5|0;break}else{v=((h[26448+(x<<2)>>2]|0)+6-(h[se>>2]|0)|0)%6|0;break}while(!1);x=M,b=N}else v=g;while(!1);E=K,N=h[E>>2]|0,E=h[E+4>>2]|0}if((x|0)==(N|0)&(b|0)==(E|0)){if(M=(Zi(N,E)|0)!=0,M?p=aT(N,E,p,m)|0:p=h[26864+((((h[ue>>2]|0)+(h[26832+(ae<<2)>>2]|0)|0)%6|0)<<2)>>2]|0,v=Zi(N,E)|0,(p+-1|0)>>>0<=5&&(xe=(v|0)!=0,!((p|0)==1&xe)))do if(ey(N,E,se)|0)v=-1;else if(xe){v=((h[26416+(p<<2)>>2]|0)+5-(h[se>>2]|0)|0)%5|0;break}else{v=((h[26448+(p<<2)>>2]|0)+6-(h[se>>2]|0)|0)%6|0;break}while(!1);else v=-1;v=v+1|0,v=(v|0)==6|M&(v|0)==5?0:v}m=b,p=x;break e}while(!1);return _=v,Q=we,_|0}while(!1);return xe=ft(v|0,0,56)|0,se=ee()|0|m&-2130706433|536870912,h[_>>2]=xe|p,h[_+4>>2]=se,_=0,Q=we,_|0}function Kue(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0;return x=(Zi(p,m)|0)==0,_=yc(p,m,0,g)|0,v=(_|0)==0,x?!v||(_=yc(p,m,1,g+8|0)|0,_|0)||(_=yc(p,m,2,g+16|0)|0,_|0)||(_=yc(p,m,3,g+24|0)|0,_|0)||(_=yc(p,m,4,g+32|0)|0,_)?(x=_,x|0):yc(p,m,5,g+40|0)|0:!v||(_=yc(p,m,1,g+8|0)|0,_|0)||(_=yc(p,m,2,g+16|0)|0,_|0)||(_=yc(p,m,3,g+24|0)|0,_|0)||(_=yc(p,m,4,g+32|0)|0,_|0)?(x=_,x|0):(x=g+40|0,h[x>>2]=0,h[x+4>>2]=0,x=0,x|0)}function Que(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0,M=0;return M=Q,Q=Q+192|0,v=M,x=M+168|0,b=tt(p|0,m|0,56)|0,ee()|0,b=b&7,E=m&-2130706433|134217728,_=S1(p,E,x)|0,_|0?(E=_,Q=M,E|0):(m=tt(p|0,m|0,52)|0,ee()|0,m=m&15,Zi(p,E)|0?cL(x,m,b,1,v):uL(x,m,b,1,v),E=v+8|0,h[g>>2]=h[E>>2],h[g+4>>2]=h[E+4>>2],h[g+8>>2]=h[E+8>>2],h[g+12>>2]=h[E+12>>2],E=0,Q=M,E|0)}function wq(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0;return v=Q,Q=Q+16|0,g=v,!(!0&(m&2013265920|0)==536870912)||(_=m&-2130706433|134217728,!(cT(p,_)|0))?(_=0,Q=v,_|0):(x=tt(p|0,m|0,56)|0,ee()|0,x=(yc(p,_,x&7,g)|0)==0,_=g,_=x&((h[_>>2]|0)==(p|0)?(h[_+4>>2]|0)==(m|0):0)&1,Q=v,_|0)}function Sq(){return 27680}function dT(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0;q=Q,Q=Q+208|0,M=q,N=q+192|0,b=al(g,m)|0,E=N,h[E>>2]=1,h[E+4>>2]=0;e:do if(b|0){for(E=0-g|0,h[M+4>>2]=g,h[M>>2]=g,v=2,m=g,x=g;m=m+g+x|0,h[M+(v<<2)>>2]=m,m>>>0<b>>>0;)j=x,v=v+1|0,x=m,m=j;if(x=p+b+E|0,x>>>0>p>>>0){b=x,v=1,m=1;do{do if((m&3|0)!=3)if(m=v+-1|0,(h[M+(m<<2)>>2]|0)>>>0<(b-p|0)>>>0?TL(p,g,_,v,M):mT(p,g,_,N,v,0,M),(v|0)==1){AT(N,1),v=0;break}else{AT(N,m),v=1;break}else TL(p,g,_,v,M),pT(N,2),v=v+2|0;while(!1);m=h[N>>2]|1,h[N>>2]=m,p=p+g|0}while(p>>>0<x>>>0)}else v=1,m=1;for(mT(p,g,_,N,v,0,M),x=N+4|0;;){if((v|0)==1&(m|0)==1)if(h[x>>2]|0)U=19;else break e;else(v|0)<2?U=19:(AT(N,2),j=v+-2|0,h[N>>2]=h[N>>2]^7,pT(N,1),mT(p+(0-(h[M+(j<<2)>>2]|0))+E|0,g,_,N,v+-1|0,1,M),AT(N,1),m=h[N>>2]|1,h[N>>2]=m,p=p+E|0,mT(p,g,_,N,j,1,M),v=j);(U|0)==19&&(U=0,m=Tq(N)|0,pT(N,m),p=p+E|0,v=m+v|0,m=h[N>>2]|0)}}while(!1);Q=q}function TL(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0;q=Q,Q=Q+240|0,U=q,h[U>>2]=p;e:do if((_|0)>1)for(N=0-m|0,E=p,x=_,_=1,b=p;;){if(E=E+N|0,M=x+-2|0,p=E+(0-(h[v+(M<<2)>>2]|0))|0,(hp[g&3](b,p)|0)>-1&&(hp[g&3](b,E)|0)>-1||(b=U+(_<<2)|0,(hp[g&3](p,E)|0)>-1?(h[b>>2]=p,x=x+-1|0):(h[b>>2]=E,p=E,x=M),_=_+1|0,(x|0)<=1))break e;E=p,b=h[U>>2]|0}else _=1;while(!1);Mq(m,U,_),Q=q}function pT(p,m){p=p|0,m=m|0;var g=0,_=0,v=0;v=p+4|0,m>>>0>31?(_=h[v>>2]|0,h[p>>2]=_,h[v>>2]=0,m=m+-32|0,g=0):(g=h[v>>2]|0,_=h[p>>2]|0),h[p>>2]=g<<32-m|_>>>m,h[v>>2]=g>>>m}function mT(p,m,g,_,v,x,b){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0,x=x|0,b=b|0;var E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0;X=Q,Q=Q+240|0,q=X+232|0,j=X,K=h[_>>2]|0,h[q>>2]=K,M=h[_+4>>2]|0,N=q+4|0,h[N>>2]=M,h[j>>2]=p;e:do if((K|0)!=1|(M|0)!=0&&(U=0-m|0,E=p+(0-(h[b+(v<<2)>>2]|0))|0,(hp[g&3](E,p)|0)>=1))for(_=1,x=(x|0)==0,M=E;;){if(x&(v|0)>1){if(x=p+U|0,E=h[b+(v+-2<<2)>>2]|0,(hp[g&3](x,M)|0)>-1){E=10;break e}if((hp[g&3](x+(0-E)|0,M)|0)>-1){E=10;break e}}if(x=_+1|0,h[j+(_<<2)>>2]=M,K=Tq(q)|0,pT(q,K),v=K+v|0,!((h[q>>2]|0)!=1|(h[N>>2]|0)!=0)){_=x,p=M,E=10;break e}if(p=M+(0-(h[b+(v<<2)>>2]|0))|0,(hp[g&3](p,h[j>>2]|0)|0)<1){p=M,_=x,x=0,E=9;break}else K=M,_=x,x=1,M=p,p=K}else _=1,E=9;while(!1);(E|0)==9&&(x|0)==0&&(E=10),(E|0)==10&&(Mq(m,j,_),TL(p,m,g,v,b)),Q=X}function AT(p,m){p=p|0,m=m|0;var g=0,_=0,v=0;v=p+4|0,m>>>0>31?(_=h[p>>2]|0,h[v>>2]=_,h[p>>2]=0,m=m+-32|0,g=0):(g=h[p>>2]|0,_=h[v>>2]|0),h[v>>2]=g>>>(32-m|0)|_<<m,h[p>>2]=g<<m}function Tq(p){p=p|0;var m=0;return m=Eq((h[p>>2]|0)+-1|0)|0,m?m|0:(m=Eq(h[p+4>>2]|0)|0,((m|0)==0?0:m+32|0)|0)}function Eq(p){p=p|0;var m=0;if(p)if(p&1)p=0;else for(m=p,p=0;p=p+1|0,!(m&2);)m=m>>>1;else p=32;return p|0}function Mq(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0,E=0;b=Q,Q=Q+256|0,_=b;e:do if((g|0)>=2&&(x=m+(g<<2)|0,h[x>>2]=_,p|0))for(;;){v=p>>>0<256?p:256,fu(_|0,h[m>>2]|0,v|0)|0,_=0;do E=m+(_<<2)|0,_=_+1|0,fu(h[E>>2]|0,h[m+(_<<2)>>2]|0,v|0)|0,h[E>>2]=(h[E>>2]|0)+v;while((_|0)!=(g|0));if(p=p-v|0,!p)break e;_=h[x>>2]|0}while(!1);Q=b}function oh(p){return p=+p,~~+Lq(+p)|0}function br(p){p=p|0;var m=0,g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0,ae=0,ue=0,xe=0,se=0,we=0,Ae=0,Be=0;Be=Q,Q=Q+16|0,j=Be;do if(p>>>0<245){if(N=p>>>0<11?16:p+11&-8,p=N>>>3,q=h[6921]|0,g=q>>>p,g&3|0)return m=(g&1^1)+p|0,p=27724+(m<<1<<2)|0,g=p+8|0,_=h[g>>2]|0,v=_+8|0,x=h[v>>2]|0,(x|0)==(p|0)?h[6921]=q&~(1<<m):(h[x+12>>2]=p,h[g>>2]=x),Ae=m<<3,h[_+4>>2]=Ae|3,Ae=_+Ae+4|0,h[Ae>>2]=h[Ae>>2]|1,Ae=v,Q=Be,Ae|0;if(U=h[6923]|0,N>>>0>U>>>0){if(g|0)return m=2<<p,m=g<<p&(m|0-m),m=(m&0-m)+-1|0,E=m>>>12&16,m=m>>>E,g=m>>>5&8,m=m>>>g,x=m>>>2&4,m=m>>>x,p=m>>>1&2,m=m>>>p,_=m>>>1&1,_=(g|E|x|p|_)+(m>>>_)|0,m=27724+(_<<1<<2)|0,p=m+8|0,x=h[p>>2]|0,E=x+8|0,g=h[E>>2]|0,(g|0)==(m|0)?(p=q&~(1<<_),h[6921]=p):(h[g+12>>2]=m,h[p>>2]=g,p=q),Ae=_<<3,b=Ae-N|0,h[x+4>>2]=N|3,v=x+N|0,h[v+4>>2]=b|1,h[x+Ae>>2]=b,U|0&&(_=h[6926]|0,m=U>>>3,g=27724+(m<<1<<2)|0,m=1<<m,p&m?(p=g+8|0,m=h[p>>2]|0):(h[6921]=p|m,m=g,p=g+8|0),h[p>>2]=_,h[m+12>>2]=_,h[_+8>>2]=m,h[_+12>>2]=g),h[6923]=b,h[6926]=v,Ae=E,Q=Be,Ae|0;if(x=h[6922]|0,x){for(g=(x&0-x)+-1|0,v=g>>>12&16,g=g>>>v,_=g>>>5&8,g=g>>>_,b=g>>>2&4,g=g>>>b,E=g>>>1&2,g=g>>>E,M=g>>>1&1,M=h[27988+((_|v|b|E|M)+(g>>>M)<<2)>>2]|0,g=M,E=M,M=(h[M+4>>2]&-8)-N|0;p=h[g+16>>2]|0,!(!p&&(p=h[g+20>>2]|0,!p));)b=(h[p+4>>2]&-8)-N|0,v=b>>>0<M>>>0,g=p,E=v?p:E,M=v?b:M;if(b=E+N|0,b>>>0>E>>>0){v=h[E+24>>2]|0,m=h[E+12>>2]|0;do if((m|0)==(E|0)){if(p=E+20|0,m=h[p>>2]|0,!m&&(p=E+16|0,m=h[p>>2]|0,!m)){g=0;break}for(;;)if(_=m+20|0,g=h[_>>2]|0,g)m=g,p=_;else if(_=m+16|0,g=h[_>>2]|0,g)m=g,p=_;else break;h[p>>2]=0,g=m}else g=h[E+8>>2]|0,h[g+12>>2]=m,h[m+8>>2]=g,g=m;while(!1);do if(v|0){if(m=h[E+28>>2]|0,p=27988+(m<<2)|0,(E|0)==(h[p>>2]|0)){if(h[p>>2]=g,!g){h[6922]=x&~(1<<m);break}}else if(Ae=v+16|0,h[((h[Ae>>2]|0)==(E|0)?Ae:v+20|0)>>2]=g,!g)break;h[g+24>>2]=v,m=h[E+16>>2]|0,m|0&&(h[g+16>>2]=m,h[m+24>>2]=g),m=h[E+20>>2]|0,m|0&&(h[g+20>>2]=m,h[m+24>>2]=g)}while(!1);return M>>>0<16?(Ae=M+N|0,h[E+4>>2]=Ae|3,Ae=E+Ae+4|0,h[Ae>>2]=h[Ae>>2]|1):(h[E+4>>2]=N|3,h[b+4>>2]=M|1,h[b+M>>2]=M,U|0&&(_=h[6926]|0,m=U>>>3,g=27724+(m<<1<<2)|0,m=1<<m,m&q?(p=g+8|0,m=h[p>>2]|0):(h[6921]=m|q,m=g,p=g+8|0),h[p>>2]=_,h[m+12>>2]=_,h[_+8>>2]=m,h[_+12>>2]=g),h[6923]=M,h[6926]=b),Ae=E+8|0,Q=Be,Ae|0}else q=N}else q=N}else q=N}else if(p>>>0<=4294967231)if(p=p+11|0,N=p&-8,_=h[6922]|0,_){v=0-N|0,p=p>>>8,p?N>>>0>16777215?M=31:(q=(p+1048320|0)>>>16&8,ae=p<<q,E=(ae+520192|0)>>>16&4,ae=ae<<E,M=(ae+245760|0)>>>16&2,M=14-(E|q|M)+(ae<<M>>>15)|0,M=N>>>(M+7|0)&1|M<<1):M=0,g=h[27988+(M<<2)>>2]|0;e:do if(!g)g=0,p=0,ae=61;else for(p=0,E=N<<((M|0)==31?0:25-(M>>>1)|0),x=0;;){if(b=(h[g+4>>2]&-8)-N|0,b>>>0<v>>>0)if(b)p=g,v=b;else{p=g,v=0,ae=65;break e}if(ae=h[g+20>>2]|0,g=h[g+16+(E>>>31<<2)>>2]|0,x=(ae|0)==0|(ae|0)==(g|0)?x:ae,g)E=E<<1;else{g=x,ae=61;break}}while(!1);if((ae|0)==61){if((g|0)==0&(p|0)==0){if(p=2<<M,p=(p|0-p)&_,!p){q=N;break}q=(p&0-p)+-1|0,b=q>>>12&16,q=q>>>b,x=q>>>5&8,q=q>>>x,E=q>>>2&4,q=q>>>E,M=q>>>1&2,q=q>>>M,g=q>>>1&1,p=0,g=h[27988+((x|b|E|M|g)+(q>>>g)<<2)>>2]|0}g?ae=65:(E=p,b=v)}if((ae|0)==65)for(x=g;;)if(q=(h[x+4>>2]&-8)-N|0,g=q>>>0<v>>>0,v=g?q:v,p=g?x:p,g=h[x+16>>2]|0,g||(g=h[x+20>>2]|0),g)x=g;else{E=p,b=v;break}if((E|0)!=0&&b>>>0<((h[6923]|0)-N|0)>>>0&&(U=E+N|0,U>>>0>E>>>0)){x=h[E+24>>2]|0,m=h[E+12>>2]|0;do if((m|0)==(E|0)){if(p=E+20|0,m=h[p>>2]|0,!m&&(p=E+16|0,m=h[p>>2]|0,!m)){m=0;break}for(;;)if(v=m+20|0,g=h[v>>2]|0,g)m=g,p=v;else if(v=m+16|0,g=h[v>>2]|0,g)m=g,p=v;else break;h[p>>2]=0}else Ae=h[E+8>>2]|0,h[Ae+12>>2]=m,h[m+8>>2]=Ae;while(!1);do if(x){if(p=h[E+28>>2]|0,g=27988+(p<<2)|0,(E|0)==(h[g>>2]|0)){if(h[g>>2]=m,!m){_=_&~(1<<p),h[6922]=_;break}}else if(Ae=x+16|0,h[((h[Ae>>2]|0)==(E|0)?Ae:x+20|0)>>2]=m,!m)break;h[m+24>>2]=x,p=h[E+16>>2]|0,p|0&&(h[m+16>>2]=p,h[p+24>>2]=m),p=h[E+20>>2]|0,p&&(h[m+20>>2]=p,h[p+24>>2]=m)}while(!1);e:do if(b>>>0<16)Ae=b+N|0,h[E+4>>2]=Ae|3,Ae=E+Ae+4|0,h[Ae>>2]=h[Ae>>2]|1;else{if(h[E+4>>2]=N|3,h[U+4>>2]=b|1,h[U+b>>2]=b,m=b>>>3,b>>>0<256){g=27724+(m<<1<<2)|0,p=h[6921]|0,m=1<<m,p&m?(p=g+8|0,m=h[p>>2]|0):(h[6921]=p|m,m=g,p=g+8|0),h[p>>2]=U,h[m+12>>2]=U,h[U+8>>2]=m,h[U+12>>2]=g;break}if(m=b>>>8,m?b>>>0>16777215?g=31:(we=(m+1048320|0)>>>16&8,Ae=m<<we,se=(Ae+520192|0)>>>16&4,Ae=Ae<<se,g=(Ae+245760|0)>>>16&2,g=14-(se|we|g)+(Ae<<g>>>15)|0,g=b>>>(g+7|0)&1|g<<1):g=0,m=27988+(g<<2)|0,h[U+28>>2]=g,p=U+16|0,h[p+4>>2]=0,h[p>>2]=0,p=1<<g,!(_&p)){h[6922]=_|p,h[m>>2]=U,h[U+24>>2]=m,h[U+12>>2]=U,h[U+8>>2]=U;break}m=h[m>>2]|0;t:do if((h[m+4>>2]&-8|0)!=(b|0)){for(_=b<<((g|0)==31?0:25-(g>>>1)|0);g=m+16+(_>>>31<<2)|0,p=h[g>>2]|0,!!p;)if((h[p+4>>2]&-8|0)==(b|0)){m=p;break t}else _=_<<1,m=p;h[g>>2]=U,h[U+24>>2]=m,h[U+12>>2]=U,h[U+8>>2]=U;break e}while(!1);we=m+8|0,Ae=h[we>>2]|0,h[Ae+12>>2]=U,h[we>>2]=U,h[U+8>>2]=Ae,h[U+12>>2]=m,h[U+24>>2]=0}while(!1);return Ae=E+8|0,Q=Be,Ae|0}else q=N}else q=N;else q=-1;while(!1);if(g=h[6923]|0,g>>>0>=q>>>0)return m=g-q|0,p=h[6926]|0,m>>>0>15?(Ae=p+q|0,h[6926]=Ae,h[6923]=m,h[Ae+4>>2]=m|1,h[p+g>>2]=m,h[p+4>>2]=q|3):(h[6923]=0,h[6926]=0,h[p+4>>2]=g|3,Ae=p+g+4|0,h[Ae>>2]=h[Ae>>2]|1),Ae=p+8|0,Q=Be,Ae|0;if(b=h[6924]|0,b>>>0>q>>>0)return se=b-q|0,h[6924]=se,Ae=h[6927]|0,we=Ae+q|0,h[6927]=we,h[we+4>>2]=se|1,h[Ae+4>>2]=q|3,Ae=Ae+8|0,Q=Be,Ae|0;if(h[7039]|0?p=h[7041]|0:(h[7041]=4096,h[7040]=4096,h[7042]=-1,h[7043]=-1,h[7044]=0,h[7032]=0,h[7039]=j&-16^1431655768,p=4096),E=q+48|0,M=q+47|0,x=p+M|0,v=0-p|0,N=x&v,N>>>0<=q>>>0||(p=h[7031]|0,p|0&&(U=h[7029]|0,j=U+N|0,j>>>0<=U>>>0|j>>>0>p>>>0)))return Ae=0,Q=Be,Ae|0;e:do if(h[7032]&4)m=0,ae=143;else{g=h[6927]|0;t:do if(g){for(_=28132;j=h[_>>2]|0,!(j>>>0<=g>>>0&&(j+(h[_+4>>2]|0)|0)>>>0>g>>>0);)if(p=h[_+8>>2]|0,p)_=p;else{ae=128;break t}if(m=x-b&v,m>>>0<2147483647)if(p=up(m|0)|0,(p|0)==((h[_>>2]|0)+(h[_+4>>2]|0)|0)){if((p|0)!=-1){b=m,x=p,ae=145;break e}}else _=p,ae=136;else m=0}else ae=128;while(!1);do if((ae|0)==128)if(g=up(0)|0,(g|0)!=-1&&(m=g,X=h[7040]|0,K=X+-1|0,m=((K&m|0)==0?0:(K+m&0-X)-m|0)+N|0,X=h[7029]|0,K=m+X|0,m>>>0>q>>>0&m>>>0<2147483647)){if(j=h[7031]|0,j|0&&K>>>0<=X>>>0|K>>>0>j>>>0){m=0;break}if(p=up(m|0)|0,(p|0)==(g|0)){b=m,x=g,ae=145;break e}else _=p,ae=136}else m=0;while(!1);do if((ae|0)==136){if(g=0-m|0,!(E>>>0>m>>>0&(m>>>0<2147483647&(_|0)!=-1)))if((_|0)==-1){m=0;break}else{b=m,x=_,ae=145;break e}if(p=h[7041]|0,p=M-m+p&0-p,p>>>0>=2147483647){b=m,x=_,ae=145;break e}if((up(p|0)|0)==-1){up(g|0)|0,m=0;break}else{b=p+m|0,x=_,ae=145;break e}}while(!1);h[7032]=h[7032]|4,ae=143}while(!1);if((ae|0)==143&&N>>>0<2147483647&&(se=up(N|0)|0,K=up(0)|0,ue=K-se|0,xe=ue>>>0>(q+40|0)>>>0,!((se|0)==-1|xe^1|se>>>0<K>>>0&((se|0)!=-1&(K|0)!=-1)^1))&&(b=xe?ue:m,x=se,ae=145),(ae|0)==145){m=(h[7029]|0)+b|0,h[7029]=m,m>>>0>(h[7030]|0)>>>0&&(h[7030]=m),M=h[6927]|0;e:do if(M){for(m=28132;;){if(p=h[m>>2]|0,g=h[m+4>>2]|0,(x|0)==(p+g|0)){ae=154;break}if(_=h[m+8>>2]|0,_)m=_;else break}if((ae|0)==154&&(we=m+4|0,(h[m+12>>2]&8|0)==0)&&x>>>0>M>>>0&p>>>0<=M>>>0){h[we>>2]=g+b,Ae=(h[6924]|0)+b|0,se=M+8|0,se=(se&7|0)==0?0:0-se&7,we=M+se|0,se=Ae-se|0,h[6927]=we,h[6924]=se,h[we+4>>2]=se|1,h[M+Ae+4>>2]=40,h[6928]=h[7043];break}for(x>>>0<(h[6925]|0)>>>0&&(h[6925]=x),g=x+b|0,m=28132;;){if((h[m>>2]|0)==(g|0)){ae=162;break}if(p=h[m+8>>2]|0,p)m=p;else break}if((ae|0)==162&&(h[m+12>>2]&8|0)==0){h[m>>2]=x,U=m+4|0,h[U>>2]=(h[U>>2]|0)+b,U=x+8|0,U=x+((U&7|0)==0?0:0-U&7)|0,m=g+8|0,m=g+((m&7|0)==0?0:0-m&7)|0,N=U+q|0,E=m-U-q|0,h[U+4>>2]=q|3;t:do if((M|0)==(m|0))Ae=(h[6924]|0)+E|0,h[6924]=Ae,h[6927]=N,h[N+4>>2]=Ae|1;else{if((h[6926]|0)==(m|0)){Ae=(h[6923]|0)+E|0,h[6923]=Ae,h[6926]=N,h[N+4>>2]=Ae|1,h[N+Ae>>2]=Ae;break}if(p=h[m+4>>2]|0,(p&3|0)==1){b=p&-8,_=p>>>3;n:do if(p>>>0<256)if(p=h[m+8>>2]|0,g=h[m+12>>2]|0,(g|0)==(p|0)){h[6921]=h[6921]&~(1<<_);break}else{h[p+12>>2]=g,h[g+8>>2]=p;break}else{x=h[m+24>>2]|0,p=h[m+12>>2]|0;do if((p|0)==(m|0)){if(g=m+16|0,_=g+4|0,p=h[_>>2]|0,p)g=_;else if(p=h[g>>2]|0,!p){p=0;break}for(;;)if(v=p+20|0,_=h[v>>2]|0,_)p=_,g=v;else if(v=p+16|0,_=h[v>>2]|0,_)p=_,g=v;else break;h[g>>2]=0}else Ae=h[m+8>>2]|0,h[Ae+12>>2]=p,h[p+8>>2]=Ae;while(!1);if(!x)break;g=h[m+28>>2]|0,_=27988+(g<<2)|0;do if((h[_>>2]|0)!=(m|0)){if(Ae=x+16|0,h[((h[Ae>>2]|0)==(m|0)?Ae:x+20|0)>>2]=p,!p)break n}else{if(h[_>>2]=p,p|0)break;h[6922]=h[6922]&~(1<<g);break n}while(!1);if(h[p+24>>2]=x,g=m+16|0,_=h[g>>2]|0,_|0&&(h[p+16>>2]=_,h[_+24>>2]=p),g=h[g+4>>2]|0,!g)break;h[p+20>>2]=g,h[g+24>>2]=p}while(!1);m=m+b|0,v=b+E|0}else v=E;if(m=m+4|0,h[m>>2]=h[m>>2]&-2,h[N+4>>2]=v|1,h[N+v>>2]=v,m=v>>>3,v>>>0<256){g=27724+(m<<1<<2)|0,p=h[6921]|0,m=1<<m,p&m?(p=g+8|0,m=h[p>>2]|0):(h[6921]=p|m,m=g,p=g+8|0),h[p>>2]=N,h[m+12>>2]=N,h[N+8>>2]=m,h[N+12>>2]=g;break}m=v>>>8;do if(!m)_=0;else{if(v>>>0>16777215){_=31;break}we=(m+1048320|0)>>>16&8,Ae=m<<we,se=(Ae+520192|0)>>>16&4,Ae=Ae<<se,_=(Ae+245760|0)>>>16&2,_=14-(se|we|_)+(Ae<<_>>>15)|0,_=v>>>(_+7|0)&1|_<<1}while(!1);if(m=27988+(_<<2)|0,h[N+28>>2]=_,p=N+16|0,h[p+4>>2]=0,h[p>>2]=0,p=h[6922]|0,g=1<<_,!(p&g)){h[6922]=p|g,h[m>>2]=N,h[N+24>>2]=m,h[N+12>>2]=N,h[N+8>>2]=N;break}m=h[m>>2]|0;n:do if((h[m+4>>2]&-8|0)!=(v|0)){for(_=v<<((_|0)==31?0:25-(_>>>1)|0);g=m+16+(_>>>31<<2)|0,p=h[g>>2]|0,!!p;)if((h[p+4>>2]&-8|0)==(v|0)){m=p;break n}else _=_<<1,m=p;h[g>>2]=N,h[N+24>>2]=m,h[N+12>>2]=N,h[N+8>>2]=N;break t}while(!1);we=m+8|0,Ae=h[we>>2]|0,h[Ae+12>>2]=N,h[we>>2]=N,h[N+8>>2]=Ae,h[N+12>>2]=m,h[N+24>>2]=0}while(!1);return Ae=U+8|0,Q=Be,Ae|0}for(m=28132;p=h[m>>2]|0,!(p>>>0<=M>>>0&&(Ae=p+(h[m+4>>2]|0)|0,Ae>>>0>M>>>0));)m=h[m+8>>2]|0;v=Ae+-47|0,p=v+8|0,p=v+((p&7|0)==0?0:0-p&7)|0,v=M+16|0,p=p>>>0<v>>>0?M:p,m=p+8|0,g=b+-40|0,se=x+8|0,se=(se&7|0)==0?0:0-se&7,we=x+se|0,se=g-se|0,h[6927]=we,h[6924]=se,h[we+4>>2]=se|1,h[x+g+4>>2]=40,h[6928]=h[7043],g=p+4|0,h[g>>2]=27,h[m>>2]=h[7033],h[m+4>>2]=h[7034],h[m+8>>2]=h[7035],h[m+12>>2]=h[7036],h[7033]=x,h[7034]=b,h[7036]=0,h[7035]=m,m=p+24|0;do we=m,m=m+4|0,h[m>>2]=7;while((we+8|0)>>>0<Ae>>>0);if((p|0)!=(M|0)){if(x=p-M|0,h[g>>2]=h[g>>2]&-2,h[M+4>>2]=x|1,h[p>>2]=x,m=x>>>3,x>>>0<256){g=27724+(m<<1<<2)|0,p=h[6921]|0,m=1<<m,p&m?(p=g+8|0,m=h[p>>2]|0):(h[6921]=p|m,m=g,p=g+8|0),h[p>>2]=M,h[m+12>>2]=M,h[M+8>>2]=m,h[M+12>>2]=g;break}if(m=x>>>8,m?x>>>0>16777215?_=31:(we=(m+1048320|0)>>>16&8,Ae=m<<we,se=(Ae+520192|0)>>>16&4,Ae=Ae<<se,_=(Ae+245760|0)>>>16&2,_=14-(se|we|_)+(Ae<<_>>>15)|0,_=x>>>(_+7|0)&1|_<<1):_=0,g=27988+(_<<2)|0,h[M+28>>2]=_,h[M+20>>2]=0,h[v>>2]=0,m=h[6922]|0,p=1<<_,!(m&p)){h[6922]=m|p,h[g>>2]=M,h[M+24>>2]=g,h[M+12>>2]=M,h[M+8>>2]=M;break}m=h[g>>2]|0;t:do if((h[m+4>>2]&-8|0)!=(x|0)){for(_=x<<((_|0)==31?0:25-(_>>>1)|0);g=m+16+(_>>>31<<2)|0,p=h[g>>2]|0,!!p;)if((h[p+4>>2]&-8|0)==(x|0)){m=p;break t}else _=_<<1,m=p;h[g>>2]=M,h[M+24>>2]=m,h[M+12>>2]=M,h[M+8>>2]=M;break e}while(!1);we=m+8|0,Ae=h[we>>2]|0,h[Ae+12>>2]=M,h[we>>2]=M,h[M+8>>2]=Ae,h[M+12>>2]=m,h[M+24>>2]=0}}else Ae=h[6925]|0,(Ae|0)==0|x>>>0<Ae>>>0&&(h[6925]=x),h[7033]=x,h[7034]=b,h[7036]=0,h[6930]=h[7039],h[6929]=-1,h[6934]=27724,h[6933]=27724,h[6936]=27732,h[6935]=27732,h[6938]=27740,h[6937]=27740,h[6940]=27748,h[6939]=27748,h[6942]=27756,h[6941]=27756,h[6944]=27764,h[6943]=27764,h[6946]=27772,h[6945]=27772,h[6948]=27780,h[6947]=27780,h[6950]=27788,h[6949]=27788,h[6952]=27796,h[6951]=27796,h[6954]=27804,h[6953]=27804,h[6956]=27812,h[6955]=27812,h[6958]=27820,h[6957]=27820,h[6960]=27828,h[6959]=27828,h[6962]=27836,h[6961]=27836,h[6964]=27844,h[6963]=27844,h[6966]=27852,h[6965]=27852,h[6968]=27860,h[6967]=27860,h[6970]=27868,h[6969]=27868,h[6972]=27876,h[6971]=27876,h[6974]=27884,h[6973]=27884,h[6976]=27892,h[6975]=27892,h[6978]=27900,h[6977]=27900,h[6980]=27908,h[6979]=27908,h[6982]=27916,h[6981]=27916,h[6984]=27924,h[6983]=27924,h[6986]=27932,h[6985]=27932,h[6988]=27940,h[6987]=27940,h[6990]=27948,h[6989]=27948,h[6992]=27956,h[6991]=27956,h[6994]=27964,h[6993]=27964,h[6996]=27972,h[6995]=27972,Ae=b+-40|0,se=x+8|0,se=(se&7|0)==0?0:0-se&7,we=x+se|0,se=Ae-se|0,h[6927]=we,h[6924]=se,h[we+4>>2]=se|1,h[x+Ae+4>>2]=40,h[6928]=h[7043];while(!1);if(m=h[6924]|0,m>>>0>q>>>0)return se=m-q|0,h[6924]=se,Ae=h[6927]|0,we=Ae+q|0,h[6927]=we,h[we+4>>2]=se|1,h[Ae+4>>2]=q|3,Ae=Ae+8|0,Q=Be,Ae|0}return Ae=Sq()|0,h[Ae>>2]=12,Ae=0,Q=Be,Ae|0}function _t(p){p=p|0;var m=0,g=0,_=0,v=0,x=0,b=0,E=0,M=0;if(p){g=p+-8|0,v=h[6925]|0,p=h[p+-4>>2]|0,m=p&-8,M=g+m|0;do if(p&1)E=g,b=g;else{if(_=h[g>>2]|0,!(p&3)||(b=g+(0-_)|0,x=_+m|0,b>>>0<v>>>0))return;if((h[6926]|0)==(b|0)){if(p=M+4|0,m=h[p>>2]|0,(m&3|0)!=3){E=b,m=x;break}h[6923]=x,h[p>>2]=m&-2,h[b+4>>2]=x|1,h[b+x>>2]=x;return}if(g=_>>>3,_>>>0<256)if(p=h[b+8>>2]|0,m=h[b+12>>2]|0,(m|0)==(p|0)){h[6921]=h[6921]&~(1<<g),E=b,m=x;break}else{h[p+12>>2]=m,h[m+8>>2]=p,E=b,m=x;break}v=h[b+24>>2]|0,p=h[b+12>>2]|0;do if((p|0)==(b|0)){if(m=b+16|0,g=m+4|0,p=h[g>>2]|0,p)m=g;else if(p=h[m>>2]|0,!p){p=0;break}for(;;)if(_=p+20|0,g=h[_>>2]|0,g)p=g,m=_;else if(_=p+16|0,g=h[_>>2]|0,g)p=g,m=_;else break;h[m>>2]=0}else E=h[b+8>>2]|0,h[E+12>>2]=p,h[p+8>>2]=E;while(!1);if(v){if(m=h[b+28>>2]|0,g=27988+(m<<2)|0,(h[g>>2]|0)==(b|0)){if(h[g>>2]=p,!p){h[6922]=h[6922]&~(1<<m),E=b,m=x;break}}else if(E=v+16|0,h[((h[E>>2]|0)==(b|0)?E:v+20|0)>>2]=p,!p){E=b,m=x;break}h[p+24>>2]=v,m=b+16|0,g=h[m>>2]|0,g|0&&(h[p+16>>2]=g,h[g+24>>2]=p),m=h[m+4>>2]|0,m?(h[p+20>>2]=m,h[m+24>>2]=p,E=b,m=x):(E=b,m=x)}else E=b,m=x}while(!1);if(!(b>>>0>=M>>>0)&&(p=M+4|0,_=h[p>>2]|0,!!(_&1))){if(_&2)h[p>>2]=_&-2,h[E+4>>2]=m|1,h[b+m>>2]=m,v=m;else{if((h[6927]|0)==(M|0)){if(M=(h[6924]|0)+m|0,h[6924]=M,h[6927]=E,h[E+4>>2]=M|1,(E|0)!=(h[6926]|0))return;h[6926]=0,h[6923]=0;return}if((h[6926]|0)==(M|0)){M=(h[6923]|0)+m|0,h[6923]=M,h[6926]=b,h[E+4>>2]=M|1,h[b+M>>2]=M;return}v=(_&-8)+m|0,g=_>>>3;do if(_>>>0<256)if(m=h[M+8>>2]|0,p=h[M+12>>2]|0,(p|0)==(m|0)){h[6921]=h[6921]&~(1<<g);break}else{h[m+12>>2]=p,h[p+8>>2]=m;break}else{x=h[M+24>>2]|0,p=h[M+12>>2]|0;do if((p|0)==(M|0)){if(m=M+16|0,g=m+4|0,p=h[g>>2]|0,p)m=g;else if(p=h[m>>2]|0,!p){g=0;break}for(;;)if(_=p+20|0,g=h[_>>2]|0,g)p=g,m=_;else if(_=p+16|0,g=h[_>>2]|0,g)p=g,m=_;else break;h[m>>2]=0,g=p}else g=h[M+8>>2]|0,h[g+12>>2]=p,h[p+8>>2]=g,g=p;while(!1);if(x|0){if(p=h[M+28>>2]|0,m=27988+(p<<2)|0,(h[m>>2]|0)==(M|0)){if(h[m>>2]=g,!g){h[6922]=h[6922]&~(1<<p);break}}else if(_=x+16|0,h[((h[_>>2]|0)==(M|0)?_:x+20|0)>>2]=g,!g)break;h[g+24>>2]=x,p=M+16|0,m=h[p>>2]|0,m|0&&(h[g+16>>2]=m,h[m+24>>2]=g),p=h[p+4>>2]|0,p|0&&(h[g+20>>2]=p,h[p+24>>2]=g)}}while(!1);if(h[E+4>>2]=v|1,h[b+v>>2]=v,(E|0)==(h[6926]|0)){h[6923]=v;return}}if(p=v>>>3,v>>>0<256){g=27724+(p<<1<<2)|0,m=h[6921]|0,p=1<<p,m&p?(m=g+8|0,p=h[m>>2]|0):(h[6921]=m|p,p=g,m=g+8|0),h[m>>2]=E,h[p+12>>2]=E,h[E+8>>2]=p,h[E+12>>2]=g;return}p=v>>>8,p?v>>>0>16777215?_=31:(b=(p+1048320|0)>>>16&8,M=p<<b,x=(M+520192|0)>>>16&4,M=M<<x,_=(M+245760|0)>>>16&2,_=14-(x|b|_)+(M<<_>>>15)|0,_=v>>>(_+7|0)&1|_<<1):_=0,p=27988+(_<<2)|0,h[E+28>>2]=_,h[E+20>>2]=0,h[E+16>>2]=0,m=h[6922]|0,g=1<<_;e:do if(!(m&g))h[6922]=m|g,h[p>>2]=E,h[E+24>>2]=p,h[E+12>>2]=E,h[E+8>>2]=E;else{p=h[p>>2]|0;t:do if((h[p+4>>2]&-8|0)!=(v|0)){for(_=v<<((_|0)==31?0:25-(_>>>1)|0);g=p+16+(_>>>31<<2)|0,m=h[g>>2]|0,!!m;)if((h[m+4>>2]&-8|0)==(v|0)){p=m;break t}else _=_<<1,p=m;h[g>>2]=E,h[E+24>>2]=p,h[E+12>>2]=E,h[E+8>>2]=E;break e}while(!1);b=p+8|0,M=h[b>>2]|0,h[M+12>>2]=E,h[b>>2]=E,h[E+8>>2]=M,h[E+12>>2]=p,h[E+24>>2]=0}while(!1);if(M=(h[6929]|0)+-1|0,h[6929]=M,!(M|0)){for(p=28140;p=h[p>>2]|0,p;)p=p+8|0;h[6929]=-1}}}}function Ta(p,m){p=p|0,m=m|0;var g=0;return p?(g=al(m,p)|0,(m|p)>>>0>65535&&(g=((g>>>0)/(p>>>0)|0|0)==(m|0)?g:-1)):g=0,p=br(g)|0,!p||!(h[p+-4>>2]&3)||cp(p|0,0,g|0)|0,p|0}function Jue(p,m){p=p|0,m=m|0;var g=0,_=0;return p?m>>>0>4294967231?(m=Sq()|0,h[m>>2]=12,m=0,m|0):(g=ehe(p+-8|0,m>>>0<11?16:m+11&-8)|0,g|0?(m=g+8|0,m|0):(g=br(m)|0,g?(_=h[p+-4>>2]|0,_=(_&-8)-((_&3|0)==0?8:4)|0,fu(g|0,p|0,(_>>>0<m>>>0?_:m)|0)|0,_t(p),m=g,m|0):(m=0,m|0))):(m=br(m)|0,m|0)}function ehe(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0,M=0,N=0,U=0,q=0;if(U=p+4|0,q=h[U>>2]|0,g=q&-8,E=p+g|0,!(q&3))return m>>>0<256?(p=0,p|0):(g>>>0>=(m+4|0)>>>0&&(g-m|0)>>>0<=h[7041]<<1>>>0||(p=0),p|0);if(g>>>0>=m>>>0)return g=g-m|0,g>>>0<=15||(N=p+m|0,h[U>>2]=q&1|m|2,h[N+4>>2]=g|3,q=E+4|0,h[q>>2]=h[q>>2]|1,Cq(N,g)),p|0;if((h[6927]|0)==(E|0))return N=(h[6924]|0)+g|0,g=N-m|0,_=p+m|0,N>>>0<=m>>>0?(p=0,p|0):(h[U>>2]=q&1|m|2,h[_+4>>2]=g|1,h[6927]=_,h[6924]=g,p|0);if((h[6926]|0)==(E|0))return _=(h[6923]|0)+g|0,_>>>0<m>>>0?(p=0,p|0):(g=_-m|0,g>>>0>15?(N=p+m|0,_=p+_|0,h[U>>2]=q&1|m|2,h[N+4>>2]=g|1,h[_>>2]=g,_=_+4|0,h[_>>2]=h[_>>2]&-2,_=N):(h[U>>2]=q&1|_|2,_=p+_+4|0,h[_>>2]=h[_>>2]|1,_=0,g=0),h[6923]=g,h[6926]=_,p|0);if(_=h[E+4>>2]|0,_&2|0||(M=(_&-8)+g|0,M>>>0<m>>>0))return p=0,p|0;N=M-m|0,v=_>>>3;do if(_>>>0<256)if(_=h[E+8>>2]|0,g=h[E+12>>2]|0,(g|0)==(_|0)){h[6921]=h[6921]&~(1<<v);break}else{h[_+12>>2]=g,h[g+8>>2]=_;break}else{b=h[E+24>>2]|0,g=h[E+12>>2]|0;do if((g|0)==(E|0)){if(_=E+16|0,v=_+4|0,g=h[v>>2]|0,g)_=v;else if(g=h[_>>2]|0,!g){v=0;break}for(;;)if(x=g+20|0,v=h[x>>2]|0,v)g=v,_=x;else if(x=g+16|0,v=h[x>>2]|0,v)g=v,_=x;else break;h[_>>2]=0,v=g}else v=h[E+8>>2]|0,h[v+12>>2]=g,h[g+8>>2]=v,v=g;while(!1);if(b|0){if(g=h[E+28>>2]|0,_=27988+(g<<2)|0,(h[_>>2]|0)==(E|0)){if(h[_>>2]=v,!v){h[6922]=h[6922]&~(1<<g);break}}else if(x=b+16|0,h[((h[x>>2]|0)==(E|0)?x:b+20|0)>>2]=v,!v)break;h[v+24>>2]=b,g=E+16|0,_=h[g>>2]|0,_|0&&(h[v+16>>2]=_,h[_+24>>2]=v),g=h[g+4>>2]|0,g|0&&(h[v+20>>2]=g,h[g+24>>2]=v)}}while(!1);return N>>>0<16?(h[U>>2]=q&1|M|2,q=p+M+4|0,h[q>>2]=h[q>>2]|1,p|0):(E=p+m|0,h[U>>2]=q&1|m|2,h[E+4>>2]=N|3,q=p+M+4|0,h[q>>2]=h[q>>2]|1,Cq(E,N),p|0)}function Cq(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0,b=0,E=0;E=p+m|0,g=h[p+4>>2]|0;do if(g&1)b=p;else{if(v=h[p>>2]|0,!(g&3))return;if(b=p+(0-v)|0,m=v+m|0,(h[6926]|0)==(b|0)){if(p=E+4|0,g=h[p>>2]|0,(g&3|0)!=3)break;h[6923]=m,h[p>>2]=g&-2,h[b+4>>2]=m|1,h[E>>2]=m;return}if(_=v>>>3,v>>>0<256)if(p=h[b+8>>2]|0,g=h[b+12>>2]|0,(g|0)==(p|0)){h[6921]=h[6921]&~(1<<_);break}else{h[p+12>>2]=g,h[g+8>>2]=p;break}x=h[b+24>>2]|0,p=h[b+12>>2]|0;do if((p|0)==(b|0)){if(g=b+16|0,_=g+4|0,p=h[_>>2]|0,p)g=_;else if(p=h[g>>2]|0,!p){p=0;break}for(;;)if(v=p+20|0,_=h[v>>2]|0,_)p=_,g=v;else if(v=p+16|0,_=h[v>>2]|0,_)p=_,g=v;else break;h[g>>2]=0}else v=h[b+8>>2]|0,h[v+12>>2]=p,h[p+8>>2]=v;while(!1);if(x){if(g=h[b+28>>2]|0,_=27988+(g<<2)|0,(h[_>>2]|0)==(b|0)){if(h[_>>2]=p,!p){h[6922]=h[6922]&~(1<<g);break}}else if(v=x+16|0,h[((h[v>>2]|0)==(b|0)?v:x+20|0)>>2]=p,!p)break;h[p+24>>2]=x,g=b+16|0,_=h[g>>2]|0,_|0&&(h[p+16>>2]=_,h[_+24>>2]=p),g=h[g+4>>2]|0,g&&(h[p+20>>2]=g,h[g+24>>2]=p)}}while(!1);if(p=E+4|0,_=h[p>>2]|0,_&2)h[p>>2]=_&-2,h[b+4>>2]=m|1,h[b+m>>2]=m,v=m;else{if((h[6927]|0)==(E|0)){if(E=(h[6924]|0)+m|0,h[6924]=E,h[6927]=b,h[b+4>>2]=E|1,(b|0)!=(h[6926]|0))return;h[6926]=0,h[6923]=0;return}if((h[6926]|0)==(E|0)){E=(h[6923]|0)+m|0,h[6923]=E,h[6926]=b,h[b+4>>2]=E|1,h[b+E>>2]=E;return}v=(_&-8)+m|0,g=_>>>3;do if(_>>>0<256)if(p=h[E+8>>2]|0,m=h[E+12>>2]|0,(m|0)==(p|0)){h[6921]=h[6921]&~(1<<g);break}else{h[p+12>>2]=m,h[m+8>>2]=p;break}else{x=h[E+24>>2]|0,m=h[E+12>>2]|0;do if((m|0)==(E|0)){if(p=E+16|0,g=p+4|0,m=h[g>>2]|0,m)p=g;else if(m=h[p>>2]|0,!m){g=0;break}for(;;)if(_=m+20|0,g=h[_>>2]|0,g)m=g,p=_;else if(_=m+16|0,g=h[_>>2]|0,g)m=g,p=_;else break;h[p>>2]=0,g=m}else g=h[E+8>>2]|0,h[g+12>>2]=m,h[m+8>>2]=g,g=m;while(!1);if(x|0){if(m=h[E+28>>2]|0,p=27988+(m<<2)|0,(h[p>>2]|0)==(E|0)){if(h[p>>2]=g,!g){h[6922]=h[6922]&~(1<<m);break}}else if(_=x+16|0,h[((h[_>>2]|0)==(E|0)?_:x+20|0)>>2]=g,!g)break;h[g+24>>2]=x,m=E+16|0,p=h[m>>2]|0,p|0&&(h[g+16>>2]=p,h[p+24>>2]=g),m=h[m+4>>2]|0,m|0&&(h[g+20>>2]=m,h[m+24>>2]=g)}}while(!1);if(h[b+4>>2]=v|1,h[b+v>>2]=v,(b|0)==(h[6926]|0)){h[6923]=v;return}}if(m=v>>>3,v>>>0<256){g=27724+(m<<1<<2)|0,p=h[6921]|0,m=1<<m,p&m?(p=g+8|0,m=h[p>>2]|0):(h[6921]=p|m,m=g,p=g+8|0),h[p>>2]=b,h[m+12>>2]=b,h[b+8>>2]=m,h[b+12>>2]=g;return}if(m=v>>>8,m?v>>>0>16777215?_=31:(x=(m+1048320|0)>>>16&8,E=m<<x,g=(E+520192|0)>>>16&4,E=E<<g,_=(E+245760|0)>>>16&2,_=14-(g|x|_)+(E<<_>>>15)|0,_=v>>>(_+7|0)&1|_<<1):_=0,m=27988+(_<<2)|0,h[b+28>>2]=_,h[b+20>>2]=0,h[b+16>>2]=0,p=h[6922]|0,g=1<<_,!(p&g)){h[6922]=p|g,h[m>>2]=b,h[b+24>>2]=m,h[b+12>>2]=b,h[b+8>>2]=b;return}m=h[m>>2]|0;e:do if((h[m+4>>2]&-8|0)!=(v|0)){for(_=v<<((_|0)==31?0:25-(_>>>1)|0);g=m+16+(_>>>31<<2)|0,p=h[g>>2]|0,!!p;)if((h[p+4>>2]&-8|0)==(v|0)){m=p;break e}else _=_<<1,m=p;h[g>>2]=b,h[b+24>>2]=m,h[b+12>>2]=b,h[b+8>>2]=b;return}while(!1);x=m+8|0,E=h[x>>2]|0,h[E+12>>2]=b,h[x>>2]=b,h[b+8>>2]=E,h[b+12>>2]=m,h[b+24>>2]=0}function At(p,m,g,_){return p=p|0,m=m|0,g=g|0,_=_|0,g=p+g>>>0,On(m+_+(g>>>0<p>>>0|0)>>>0|0),g|0|0}function eo(p,m,g,_){return p=p|0,m=m|0,g=g|0,_=_|0,_=m-_-(g>>>0>p>>>0|0)>>>0,On(_|0),p-g>>>0|0|0}function Rq(p){return p=p|0,(p?31-(Hf(p^p-1)|0)|0:32)|0}function EL(p,m,g,_,v){p=p|0,m=m|0,g=g|0,_=_|0,v=v|0;var x=0,b=0,E=0,M=0,N=0,U=0,q=0,j=0,X=0,K=0;if(U=p,M=m,N=M,b=g,j=_,E=j,!N)return x=(v|0)!=0,E?x?(h[v>>2]=p|0,h[v+4>>2]=m&0,j=0,v=0,On(j|0),v|0):(j=0,v=0,On(j|0),v|0):(x&&(h[v>>2]=(U>>>0)%(b>>>0),h[v+4>>2]=0),j=0,v=(U>>>0)/(b>>>0)>>>0,On(j|0),v|0);x=(E|0)==0;do if(b){if(!x){if(x=(Hf(E|0)|0)-(Hf(N|0)|0)|0,x>>>0<=31){q=x+1|0,E=31-x|0,m=x-31>>31,b=q,p=U>>>(q>>>0)&m|N<<E,m=N>>>(q>>>0)&m,x=0,E=U<<E;break}return v?(h[v>>2]=p|0,h[v+4>>2]=M|m&0,j=0,v=0,On(j|0),v|0):(j=0,v=0,On(j|0),v|0)}if(x=b-1|0,x&b|0){E=(Hf(b|0)|0)+33-(Hf(N|0)|0)|0,K=64-E|0,q=32-E|0,M=q>>31,X=E-32|0,m=X>>31,b=E,p=q-1>>31&N>>>(X>>>0)|(N<<q|U>>>(E>>>0))&m,m=m&N>>>(E>>>0),x=U<<K&M,E=(N<<K|U>>>(X>>>0))&M|U<<q&E-33>>31;break}return v|0&&(h[v>>2]=x&U,h[v+4>>2]=0),(b|0)==1?(X=M|m&0,K=p|0|0,On(X|0),K|0):(K=Rq(b|0)|0,X=N>>>(K>>>0)|0,K=N<<32-K|U>>>(K>>>0)|0,On(X|0),K|0)}else{if(x)return v|0&&(h[v>>2]=(N>>>0)%(b>>>0),h[v+4>>2]=0),X=0,K=(N>>>0)/(b>>>0)>>>0,On(X|0),K|0;if(!U)return v|0&&(h[v>>2]=0,h[v+4>>2]=(N>>>0)%(E>>>0)),X=0,K=(N>>>0)/(E>>>0)>>>0,On(X|0),K|0;if(x=E-1|0,!(x&E))return v|0&&(h[v>>2]=p|0,h[v+4>>2]=x&N|m&0),X=0,K=N>>>((Rq(E|0)|0)>>>0),On(X|0),K|0;if(x=(Hf(E|0)|0)-(Hf(N|0)|0)|0,x>>>0<=30){m=x+1|0,E=31-x|0,b=m,p=N<<E|U>>>(m>>>0),m=N>>>(m>>>0),x=0,E=U<<E;break}return v?(h[v>>2]=p|0,h[v+4>>2]=M|m&0,X=0,K=0,On(X|0),K|0):(X=0,K=0,On(X|0),K|0)}while(!1);if(!b)N=E,M=0,E=0;else{q=g|0|0,U=j|_&0,N=At(q|0,U|0,-1,-1)|0,g=ee()|0,M=E,E=0;do _=M,M=x>>>31|M<<1,x=E|x<<1,_=p<<1|_>>>31|0,j=p>>>31|m<<1|0,eo(N|0,g|0,_|0,j|0)|0,K=ee()|0,X=K>>31|((K|0)<0?-1:0)<<1,E=X&1,p=eo(_|0,j|0,X&q|0,(((K|0)<0?-1:0)>>31|((K|0)<0?-1:0)<<1)&U|0)|0,m=ee()|0,b=b-1|0;while((b|0)!=0);N=M,M=0}return b=0,v|0&&(h[v>>2]=p,h[v+4>>2]=m),X=(x|0)>>>31|(N|b)<<1|(b<<1|x>>>31)&0|M,K=(x<<1|0)&-2|E,On(X|0),K|0}function ap(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0;return N=m>>31|((m|0)<0?-1:0)<<1,M=((m|0)<0?-1:0)>>31|((m|0)<0?-1:0)<<1,x=_>>31|((_|0)<0?-1:0)<<1,v=((_|0)<0?-1:0)>>31|((_|0)<0?-1:0)<<1,E=eo(N^p|0,M^m|0,N|0,M|0)|0,b=ee()|0,p=x^N,m=v^M,eo((EL(E,b,eo(x^g|0,v^_|0,x|0,v|0)|0,ee()|0,0)|0)^p|0,(ee()|0)^m|0,p|0,m|0)|0}function the(p,m){p=p|0,m=m|0;var g=0,_=0,v=0,x=0;return x=p&65535,v=m&65535,g=al(v,x)|0,_=p>>>16,p=(g>>>16)+(al(v,_)|0)|0,v=m>>>16,m=al(v,x)|0,On((p>>>16)+(al(v,_)|0)+(((p&65535)+m|0)>>>16)|0),p+m<<16|g&65535|0|0}function wr(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0;return v=p,x=g,g=the(v,x)|0,p=ee()|0,On((al(m,x)|0)+(al(_,v)|0)+p|p&0|0),g|0|0|0}function lp(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0,b=0,E=0,M=0,N=0;return v=Q,Q=Q+16|0,E=v|0,b=m>>31|((m|0)<0?-1:0)<<1,x=((m|0)<0?-1:0)>>31|((m|0)<0?-1:0)<<1,N=_>>31|((_|0)<0?-1:0)<<1,M=((_|0)<0?-1:0)>>31|((_|0)<0?-1:0)<<1,p=eo(b^p|0,x^m|0,b|0,x|0)|0,m=ee()|0,EL(p,m,eo(N^g|0,M^_|0,N|0,M|0)|0,ee()|0,E)|0,_=eo(h[E>>2]^b|0,h[E+4>>2]^x|0,b|0,x|0)|0,g=ee()|0,Q=v,On(g|0),_|0}function Wf(p,m,g,_){p=p|0,m=m|0,g=g|0,_=_|0;var v=0,x=0;return x=Q,Q=Q+16|0,v=x|0,EL(p,m,g,_,v)|0,Q=x,On(h[v+4>>2]|0),h[v>>2]|0|0}function Iq(p,m,g){return p=p|0,m=m|0,g=g|0,(g|0)<32?(On(m>>g|0),p>>>g|(m&(1<<g)-1)<<32-g):(On(((m|0)<0?-1:0)|0),m>>g-32|0)}function tt(p,m,g){return p=p|0,m=m|0,g=g|0,(g|0)<32?(On(m>>>g|0),p>>>g|(m&(1<<g)-1)<<32-g):(On(0),m>>>g-32|0)}function ft(p,m,g){return p=p|0,m=m|0,g=g|0,(g|0)<32?(On(m<<g|(p&(1<<g)-1<<32-g)>>>32-g|0),p<<g):(On(p<<g-32|0),0)}function ML(p,m,g){return p=p|0,m=m|0,g=g|0,m=Hf(m)|0,(m|0)==32&&(m=m+(Hf(p)|0)|0),On(0),m|0}function Pq(p,m){return p=+p,m=+m,p!=p?+m:m!=m?+p:+yce(+p,+m)}function gT(p,m){return p=+p,m=+m,p!=p?+m:m!=m?+p:+iL(+p,+m)}function vT(p){return p=+p,p>=0?+fo(p+.5):+b1(p-.5)}function fu(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0;if((g|0)>=8192)return Sce(p|0,m|0,g|0)|0,p|0;if(x=p|0,v=p+g|0,(p&3)==(m&3)){for(;p&3;){if(!g)return x|0;He[p>>0]=He[m>>0]|0,p=p+1|0,m=m+1|0,g=g-1|0}for(g=v&-4|0,_=g-64|0;(p|0)<=(_|0);)h[p>>2]=h[m>>2],h[p+4>>2]=h[m+4>>2],h[p+8>>2]=h[m+8>>2],h[p+12>>2]=h[m+12>>2],h[p+16>>2]=h[m+16>>2],h[p+20>>2]=h[m+20>>2],h[p+24>>2]=h[m+24>>2],h[p+28>>2]=h[m+28>>2],h[p+32>>2]=h[m+32>>2],h[p+36>>2]=h[m+36>>2],h[p+40>>2]=h[m+40>>2],h[p+44>>2]=h[m+44>>2],h[p+48>>2]=h[m+48>>2],h[p+52>>2]=h[m+52>>2],h[p+56>>2]=h[m+56>>2],h[p+60>>2]=h[m+60>>2],p=p+64|0,m=m+64|0;for(;(p|0)<(g|0);)h[p>>2]=h[m>>2],p=p+4|0,m=m+4|0}else for(g=v-4|0;(p|0)<(g|0);)He[p>>0]=He[m>>0]|0,He[p+1>>0]=He[m+1>>0]|0,He[p+2>>0]=He[m+2>>0]|0,He[p+3>>0]=He[m+3>>0]|0,p=p+4|0,m=m+4|0;for(;(p|0)<(v|0);)He[p>>0]=He[m>>0]|0,p=p+1|0,m=m+1|0;return x|0}function CL(p,m,g){p=p|0,m=m|0,g=g|0;var _=0;if((m|0)<(p|0)&(p|0)<(m+g|0)){for(_=p,m=m+g|0,p=p+g|0;(g|0)>0;)p=p-1|0,m=m-1|0,g=g-1|0,He[p>>0]=He[m>>0]|0;p=_}else fu(p,m,g)|0;return p|0}function cp(p,m,g){p=p|0,m=m|0,g=g|0;var _=0,v=0,x=0,b=0;if(x=p+g|0,m=m&255,(g|0)>=67){for(;p&3;)He[p>>0]=m,p=p+1|0;for(_=x&-4|0,b=m|m<<8|m<<16|m<<24,v=_-64|0;(p|0)<=(v|0);)h[p>>2]=b,h[p+4>>2]=b,h[p+8>>2]=b,h[p+12>>2]=b,h[p+16>>2]=b,h[p+20>>2]=b,h[p+24>>2]=b,h[p+28>>2]=b,h[p+32>>2]=b,h[p+36>>2]=b,h[p+40>>2]=b,h[p+44>>2]=b,h[p+48>>2]=b,h[p+52>>2]=b,h[p+56>>2]=b,h[p+60>>2]=b,p=p+64|0;for(;(p|0)<(_|0);)h[p>>2]=b,p=p+4|0}for(;(p|0)<(x|0);)He[p>>0]=m,p=p+1|0;return x-g|0}function Lq(p){return p=+p,p>=0?+fo(p+.5):+b1(p-.5)}function up(p){p=p|0;var m=0,g=0,_=0;return _=wce()|0,g=h[ol>>2]|0,m=g+p|0,(p|0)>0&(m|0)<(g|0)|(m|0)<0?(Ece(m|0)|0,XG(12),-1):(m|0)>(_|0)&&!(Tce(m|0)|0)?(XG(12),-1):(h[ol>>2]=m,g|0)}function nhe(p,m,g){return p=p|0,m=m|0,g=g|0,hp[p&3](m|0,g|0)|0}function ihe(p,m){return p=p|0,m=m|0,bce(0),0}var hp=[ihe,Jce,eue,tue];return{___divdi3:ap,___muldi3:wr,___remdi3:lp,___uremdi3:Wf,_areNeighborCells:nue,_bitshift64Ashr:Iq,_bitshift64Lshr:tt,_bitshift64Shl:ft,_calloc:Ta,_cellAreaKm2:kce,_cellAreaM2:zce,_cellAreaRads2:Uce,_cellToBoundary:Vm,_cellToCenterChild:hq,_cellToChildPos:bue,_cellToChildren:due,_cellToChildrenSize:$x,_cellToLatLng:T1,_cellToLocalIj:Nue,_cellToParent:dL,_cellToVertex:yc,_cellToVertexes:Kue,_cellsToDirectedEdge:iue,_cellsToLinkedMultiPolygon:Oce,_childPosToCell:wue,_compactCells:pue,_constructCell:hue,_destroyLinkedMultiPolygon:Lue,_directedEdgeToBoundary:jx,_directedEdgeToCells:oue,_edgeLengthKm:Iue,_edgeLengthM:Pue,_edgeLengthRads:Rue,_emscripten_replace_memory:Mce,_free:_t,_getBaseCellNumber:cq,_getDirectedEdgeDestination:sue,_getDirectedEdgeOrigin:rue,_getHexagonAreaAvgKm2:pq,_getHexagonAreaAvgM2:Eue,_getHexagonEdgeLengthAvgKm:Mue,_getHexagonEdgeLengthAvgM:Cue,_getIcosahedronFaces:fq,_getIndexDigit:uue,_getNumCells:uT,_getPentagons:vL,_getRes0Cells:Wce,_getResolution:hL,_greatCircleDistanceKm:Zx,_greatCircleDistanceM:Tue,_greatCircleDistanceRads:Sue,_gridDisk:$G,_gridDiskDistances:YG,_gridDistance:yL,_gridPathCells:Oue,_gridPathCellsSize:Bue,_gridRing:Dce,_gridRingUnsafe:KG,_i64Add:At,_i64Subtract:eo,_isPentagon:Zi,_isResClassIII:gue,_isValidCell:cT,_isValidDirectedEdge:sq,_isValidIndex:fue,_isValidVertex:wq,_latLngToCell:AL,_llvm_ctlz_i64:ML,_llvm_maxnum_f64:Pq,_llvm_minnum_f64:gT,_llvm_round_f64:vT,_localIjToCell:Fue,_malloc:br,_maxFaceCount:xue,_maxGridDiskSize:Lce,_maxPolygonToCellsSize:Fce,_maxPolygonToCellsSizeExperimental:zue,_memcpy:fu,_memmove:CL,_memset:cp,_originToDirectedEdges:lL,_pentagonCount:yue,_polygonToCells:Bce,_polygonToCellsExperimental:kue,_readInt64AsDoubleFromPointer:$ue,_res0CellCount:Hce,_reverseDirectedEdge:oq,_round:Lq,_sbrk:up,_sizeOfCellBoundary:que,_sizeOfCoordIJ:Xue,_sizeOfGeoLoop:Hue,_sizeOfGeoPolygon:Wue,_sizeOfH3Index:Vue,_sizeOfLatLng:Gue,_sizeOfLinkedGeoPolygon:jue,_uncompactCells:mue,_uncompactCellsSize:Aue,_vertexToLatLng:Que,dynCall_iii:nhe,establishStackSpace:Pce,stackAlloc:Cce,stackRestore:Ice,stackSave:Rce}})(Bt,ut,W),Yt=e.___divdi3=Ce.___divdi3,nr=e.___muldi3=Ce.___muldi3,Fn=e.___remdi3=Ce.___remdi3,is=e.___uremdi3=Ce.___uremdi3,Lr=e._areNeighborCells=Ce._areNeighborCells,Fl=e._bitshift64Ashr=Ce._bitshift64Ashr,wa=e._bitshift64Lshr=Ce._bitshift64Lshr,Bl=e._bitshift64Shl=Ce._bitshift64Shl,rl=e._calloc=Ce._calloc,xr=e._cellAreaKm2=Ce._cellAreaKm2,Ks=e._cellAreaM2=Ce._cellAreaM2,Ol=e._cellAreaRads2=Ce._cellAreaRads2,rh=e._cellToBoundary=Ce._cellToBoundary,rT=e._cellToCenterChild=Ce._cellToCenterChild,YP=e._cellToChildPos=Ce._cellToChildPos,ZP=e._cellToChildren=Ce._cellToChildren,qx=e._cellToChildrenSize=Ce._cellToChildrenSize,KP=e._cellToLatLng=Ce._cellToLatLng,Hx=e._cellToLocalIj=Ce._cellToLocalIj,QP=e._cellToParent=Ce._cellToParent,JP=e._cellToVertex=Ce._cellToVertex,UG=e._cellToVertexes=Ce._cellToVertexes,kG=e._cellsToDirectedEdge=Ce._cellsToDirectedEdge,zG=e._cellsToLinkedMultiPolygon=Ce._cellsToLinkedMultiPolygon,VG=e._childPosToCell=Ce._childPosToCell,ne=e._compactCells=Ce._compactCells,Se=e._constructCell=Ce._constructCell,ke=e._destroyLinkedMultiPolygon=Ce._destroyLinkedMultiPolygon,De=e._directedEdgeToBoundary=Ce._directedEdgeToBoundary,Ne=e._directedEdgeToCells=Ce._directedEdgeToCells,qt=e._edgeLengthKm=Ce._edgeLengthKm,Qt=e._edgeLengthM=Ce._edgeLengthM,Vt=e._edgeLengthRads=Ce._edgeLengthRads,sn=e._emscripten_replace_memory=Ce._emscripten_replace_memory,pn=e._free=Ce._free,Wn=e._getBaseCellNumber=Ce._getBaseCellNumber,Jn=e._getDirectedEdgeDestination=Ce._getDirectedEdgeDestination,gn=e._getDirectedEdgeOrigin=Ce._getDirectedEdgeOrigin,Yi=e._getHexagonAreaAvgKm2=Ce._getHexagonAreaAvgKm2,rs=e._getHexagonAreaAvgM2=Ce._getHexagonAreaAvgM2,qr=e._getHexagonEdgeLengthAvgKm=Ce._getHexagonEdgeLengthAvgKm,ir=e._getHexagonEdgeLengthAvgM=Ce._getHexagonEdgeLengthAvgM,Co=e._getIcosahedronFaces=Ce._getIcosahedronFaces,Zt=e._getIndexDigit=Ce._getIndexDigit,sl=e._getNumCells=Ce._getNumCells,yi=e._getPentagons=Ce._getPentagons,Ul=e._getRes0Cells=Ce._getRes0Cells,hu=e._getResolution=Ce._getResolution,Vf=e._greatCircleDistanceKm=Ce._greatCircleDistanceKm,Om=e._greatCircleDistanceM=Ce._greatCircleDistanceM,rr=e._greatCircleDistanceRads=Ce._greatCircleDistanceRads,ss=e._gridDisk=Ce._gridDisk,Gf=e._gridDiskDistances=Ce._gridDiskDistances,pr=e._gridDistance=Ce._gridDistance,qf=e._gridPathCells=Ce._gridPathCells,Um=e._gridPathCellsSize=Ce._gridPathCellsSize,eL=e._gridRing=Ce._gridRing,d8e=e._gridRingUnsafe=Ce._gridRingUnsafe,p8e=e._i64Add=Ce._i64Add,m8e=e._i64Subtract=Ce._i64Subtract,A8e=e._isPentagon=Ce._isPentagon,g8e=e._isResClassIII=Ce._isResClassIII,v8e=e._isValidCell=Ce._isValidCell,_8e=e._isValidDirectedEdge=Ce._isValidDirectedEdge,x8e=e._isValidIndex=Ce._isValidIndex,y8e=e._isValidVertex=Ce._isValidVertex,b8e=e._latLngToCell=Ce._latLngToCell,w8e=e._llvm_ctlz_i64=Ce._llvm_ctlz_i64,S8e=e._llvm_maxnum_f64=Ce._llvm_maxnum_f64,T8e=e._llvm_minnum_f64=Ce._llvm_minnum_f64,E8e=e._llvm_round_f64=Ce._llvm_round_f64,M8e=e._localIjToCell=Ce._localIjToCell,C8e=e._malloc=Ce._malloc,R8e=e._maxFaceCount=Ce._maxFaceCount,I8e=e._maxGridDiskSize=Ce._maxGridDiskSize,P8e=e._maxPolygonToCellsSize=Ce._maxPolygonToCellsSize,L8e=e._maxPolygonToCellsSizeExperimental=Ce._maxPolygonToCellsSizeExperimental,D8e=e._memcpy=Ce._memcpy,N8e=e._memmove=Ce._memmove,F8e=e._memset=Ce._memset,B8e=e._originToDirectedEdges=Ce._originToDirectedEdges,O8e=e._pentagonCount=Ce._pentagonCount,U8e=e._polygonToCells=Ce._polygonToCells,k8e=e._polygonToCellsExperimental=Ce._polygonToCellsExperimental,z8e=e._readInt64AsDoubleFromPointer=Ce._readInt64AsDoubleFromPointer,V8e=e._res0CellCount=Ce._res0CellCount,G8e=e._reverseDirectedEdge=Ce._reverseDirectedEdge,q8e=e._round=Ce._round,H8e=e._sbrk=Ce._sbrk,W8e=e._sizeOfCellBoundary=Ce._sizeOfCellBoundary,j8e=e._sizeOfCoordIJ=Ce._sizeOfCoordIJ,X8e=e._sizeOfGeoLoop=Ce._sizeOfGeoLoop,$8e=e._sizeOfGeoPolygon=Ce._sizeOfGeoPolygon,Y8e=e._sizeOfH3Index=Ce._sizeOfH3Index,Z8e=e._sizeOfLatLng=Ce._sizeOfLatLng,K8e=e._sizeOfLinkedGeoPolygon=Ce._sizeOfLinkedGeoPolygon,Q8e=e._uncompactCells=Ce._uncompactCells,J8e=e._uncompactCellsSize=Ce._uncompactCellsSize,eFe=e._vertexToLatLng=Ce._vertexToLatLng,tFe=e.establishStackSpace=Ce.establishStackSpace,GG=e.stackAlloc=Ce.stackAlloc,vce=e.stackRestore=Ce.stackRestore,_ce=e.stackSave=Ce.stackSave,nFe=e.dynCall_iii=Ce.dynCall_iii;if(e.asm=Ce,e.cwrap=I,e.setValue=y,e.getValue=w,le){Te(le)||(le=o(le));{vi("memory initializer");var tL=function(Le){Le.byteLength&&(Le=new Uint8Array(Le)),H.set(Le,A),e.memoryInitializerRequest&&delete e.memoryInitializerRequest.response,zn("memory initializer")},qG=function(){a(le,tL,function(){throw"could not load memory initializer "+le})},HG=St(le);if(HG)tL(HG.buffer);else if(e.memoryInitializerRequest){var WG=function(){var Le=e.memoryInitializerRequest,it=Le.response;if(Le.status!==200&&Le.status!==0){var Dt=St(e.memoryInitializerRequestURL);if(Dt)it=Dt.buffer;else{console.warn("a problem seems to have happened with Module.memoryInitializerRequest, status: "+Le.status+", retrying "+le),qG();return}}tL(it)};e.memoryInitializerRequest.response?setTimeout(WG,0):e.memoryInitializerRequest.addEventListener("load",WG)}else qG()}}var sT;_e=function Le(){sT||nL(),sT||(_e=Le)};function nL(Le){if(Le=Le||r,tn>0||(It(),tn>0))return;function it(){sT||(sT=!0,!S&&(dn(),Gt(),e.onRuntimeInitialized&&e.onRuntimeInitialized(),$e()))}e.setStatus?(e.setStatus("Running..."),setTimeout(function(){setTimeout(function(){e.setStatus("")},1),it()},1)):it()}e.run=nL;function km(Le){throw e.onAbort&&e.onAbort(Le),Le+="",l(Le),c(Le),S=!0,"abort("+Le+"). Build with -s ASSERTIONS=1 for more info."}if(e.abort=km,e.preInit)for(typeof e.preInit=="function"&&(e.preInit=[e.preInit]);e.preInit.length>0;)e.preInit.pop()();return nL(),i})(typeof Ai=="object"?Ai:{}),En="number",Sn=En,z_=En,Cn=En,Rn=En,wo=En,jt=En,GSe=[["sizeOfH3Index",En],["sizeOfLatLng",En],["sizeOfCellBoundary",En],["sizeOfGeoLoop",En],["sizeOfGeoPolygon",En],["sizeOfLinkedGeoPolygon",En],["sizeOfCoordIJ",En],["readInt64AsDoubleFromPointer",En],["isValidCell",z_,[Cn,Rn]],["isValidIndex",z_,[Cn,Rn]],["latLngToCell",Sn,[En,En,wo,jt]],["cellToLatLng",Sn,[Cn,Rn,jt]],["cellToBoundary",Sn,[Cn,Rn,jt]],["maxGridDiskSize",Sn,[En,jt]],["gridDisk",Sn,[Cn,Rn,En,jt]],["gridDiskDistances",Sn,[Cn,Rn,En,jt,jt]],["gridRing",Sn,[Cn,Rn,En,jt]],["gridRingUnsafe",Sn,[Cn,Rn,En,jt]],["maxPolygonToCellsSize",Sn,[jt,wo,En,jt]],["polygonToCells",Sn,[jt,wo,En,jt]],["maxPolygonToCellsSizeExperimental",Sn,[jt,wo,En,jt]],["polygonToCellsExperimental",Sn,[jt,wo,En,En,En,jt]],["cellsToLinkedMultiPolygon",Sn,[jt,En,jt]],["destroyLinkedMultiPolygon",null,[jt]],["compactCells",Sn,[jt,jt,En,En]],["uncompactCells",Sn,[jt,En,En,jt,En,wo]],["uncompactCellsSize",Sn,[jt,En,En,wo,jt]],["isPentagon",z_,[Cn,Rn]],["isResClassIII",z_,[Cn,Rn]],["getBaseCellNumber",En,[Cn,Rn]],["getResolution",En,[Cn,Rn]],["getIndexDigit",En,[Cn,Rn,En]],["constructCell",Sn,[En,En,jt,jt]],["maxFaceCount",Sn,[Cn,Rn,jt]],["getIcosahedronFaces",Sn,[Cn,Rn,jt]],["cellToParent",Sn,[Cn,Rn,wo,jt]],["cellToChildren",Sn,[Cn,Rn,wo,jt]],["cellToCenterChild",Sn,[Cn,Rn,wo,jt]],["cellToChildrenSize",Sn,[Cn,Rn,wo,jt]],["cellToChildPos",Sn,[Cn,Rn,wo,jt]],["childPosToCell",Sn,[En,En,Cn,Rn,wo,jt]],["areNeighborCells",Sn,[Cn,Rn,Cn,Rn,jt]],["cellsToDirectedEdge",Sn,[Cn,Rn,Cn,Rn,jt]],["getDirectedEdgeOrigin",Sn,[Cn,Rn,jt]],["getDirectedEdgeDestination",Sn,[Cn,Rn,jt]],["isValidDirectedEdge",z_,[Cn,Rn]],["directedEdgeToCells",Sn,[Cn,Rn,jt]],["originToDirectedEdges",Sn,[Cn,Rn,jt]],["directedEdgeToBoundary",Sn,[Cn,Rn,jt]],["reverseDirectedEdge",Sn,[Cn,Rn,jt]],["gridDistance",Sn,[Cn,Rn,Cn,Rn,jt]],["gridPathCells",Sn,[Cn,Rn,Cn,Rn,jt]],["gridPathCellsSize",Sn,[Cn,Rn,Cn,Rn,jt]],["cellToLocalIj",Sn,[Cn,Rn,Cn,Rn,En,jt]],["localIjToCell",Sn,[Cn,Rn,jt,En,jt]],["getHexagonAreaAvgM2",Sn,[wo,jt]],["getHexagonAreaAvgKm2",Sn,[wo,jt]],["getHexagonEdgeLengthAvgM",Sn,[wo,jt]],["getHexagonEdgeLengthAvgKm",Sn,[wo,jt]],["greatCircleDistanceM",En,[jt,jt]],["greatCircleDistanceKm",En,[jt,jt]],["greatCircleDistanceRads",En,[jt,jt]],["cellAreaM2",Sn,[Cn,Rn,jt]],["cellAreaKm2",Sn,[Cn,Rn,jt]],["cellAreaRads2",Sn,[Cn,Rn,jt]],["edgeLengthM",Sn,[Cn,Rn,jt]],["edgeLengthKm",Sn,[Cn,Rn,jt]],["edgeLengthRads",Sn,[Cn,Rn,jt]],["getNumCells",Sn,[wo,jt]],["getRes0Cells",Sn,[jt]],["res0CellCount",En],["getPentagons",Sn,[En,jt]],["pentagonCount",En],["cellToVertex",Sn,[Cn,Rn,En,jt]],["cellToVertexes",Sn,[Cn,Rn,jt]],["vertexToLatLng",Sn,[Cn,Rn,jt]],["isValidVertex",z_,[Cn,Rn]]],qSe=0,HSe=1,WSe=2,jSe=3,xee=4,XSe=5,$Se=6,YSe=7,ZSe=8,KSe=9,QSe=10,JSe=11,eTe=12,tTe=13,nTe=14,iTe=15,rTe=16,sTe=17,oTe=18,aTe=19,Is={};Is[qSe]="Success";Is[HSe]="The operation failed but a more specific error is not available";Is[WSe]="Argument was outside of acceptable range";Is[jSe]="Latitude or longitude arguments were outside of acceptable range";Is[xee]="Resolution argument was outside of acceptable range";Is[XSe]="Cell argument was not valid";Is[$Se]="Directed edge argument was not valid";Is[YSe]="Undirected edge argument was not valid";Is[ZSe]="Vertex argument was not valid";Is[KSe]="Pentagon distortion was encountered";Is[QSe]="Duplicate input";Is[JSe]="Cell arguments were not neighbors";Is[eTe]="Cell arguments had incompatible resolutions";Is[tTe]="Memory allocation failed";Is[nTe]="Bounds of provided memory were insufficient";Is[iTe]="Mode or flags argument was not valid";Is[rTe]="Index argument was not valid";Is[sTe]="Base cell number was outside of acceptable range";Is[oTe]="Child indexing digits invalid";Is[aTe]="Child indexing digits refer to a deleted subsequence";var lTe=1e3,yee=1001,bee=1002,fR={};fR[lTe]="Unknown unit";fR[yee]="Array length out of bounds";fR[bee]="Got unexpected null value for H3 index";var cTe="Unknown error";function wee(i,e,t){var n=t&&"value"in t,r=new Error((i[e]||cTe)+" (code: "+e+(n?", value: "+t.value:"")+")");return r.code=e,r}function See(i,e){var t=arguments.length===2?{value:e}:{};return wee(Is,i,t)}function Tee(i,e){var t=arguments.length===2?{value:e}:{};return wee(fR,i,t)}function Ow(i){if(i!==0)throw See(i)}var Rl={};GSe.forEach(function(e){Rl[e[0]]=Ai.cwrap.apply(Ai,e)});var V_=16;var Uw=4;var G_=8,uTe=8,uR=Rl.sizeOfH3Index(),CO=Rl.sizeOfLatLng(),hTe=Rl.sizeOfCellBoundary(),fTe=Rl.sizeOfGeoPolygon(),Bw=Rl.sizeOfGeoLoop(),dlt=Rl.sizeOfLinkedGeoPolygon(),plt=Rl.sizeOfCoordIJ();function dTe(i){if(typeof i!="number"||i<0||i>15||Math.floor(i)!==i)throw See(xee,i);return i}function pTe(i){if(!i)throw Tee(bee);return i}var mTe=Math.pow(2,32)-1,mlt=Math.pow(2,31)-1;function ATe(i){if(i>mTe)throw Tee(yee,i);return i}var gTe=/[^0-9a-fA-F]/;function Eee(i){if(Array.isArray(i)&&i.length===2&&Number.isInteger(i[0])&&Number.isInteger(i[1]))return i;if(typeof i!="string"||gTe.test(i))return[0,0];var e=parseInt(i.substring(0,i.length-8),V_),t=parseInt(i.substring(i.length-8),V_);return[t,e]}function vee(i){if(i>=0)return i.toString(V_);i=i&2147483647;var e=Mee(8,i.toString(V_)),t=(parseInt(e[0],V_)+8).toString(V_);return e=t+e.substring(1),e}function vTe(i,e){return vee(e)+Mee(8,vee(i))}function Mee(i,e){for(var t=i-e.length,n="",r=0;r<t;r++)n+="0";return n=n+e,n}var Alt=Math.pow(2,32);function _ee(i,e,t){for(var n=i.length,r=Ai._calloc(n,CO),s=t?1:0,o=t?0:1,a=0;a<n*2;a+=2)Ai.HEAPF64.set([i[a/2][s],i[a/2][o]].map(Pee),r/G_+a);return Ai.HEAPU32.set([n,r],e/Uw),e}function _Te(i,e){var t=i.length-1,n=Ai._calloc(fTe),r=0,s=r+Bw,o=s+Uw;_ee(i[0],n+r,e);var a;if(t>0){a=Ai._calloc(t,Bw);for(var l=0;l<t;l++)_ee(i[l+1],a+Bw*l,e)}return Ai.setValue(n+s,t,"i32"),Ai.setValue(n+o,a,"i32"),n}function xTe(i){var e=0,t=e+Bw,n=t+Uw,r=Uw;Ai._free(Ai.getValue(i+e+r,"i8*"));var s=Ai.getValue(i+t,"i32");if(s>0){for(var o=Ai.getValue(i+n,"i32"),a=0;a<s;a++)Ai._free(Ai.getValue(o+Bw*a+r,"i8*"));Ai._free(o)}Ai._free(i)}function Cee(i,e){e===void 0&&(e=0);var t=Ai.getValue(i+uR*e,"i32"),n=Ai.getValue(i+uR*e+Uw,"i32");return n?vTe(t,n):null}function yTe(i){return Rl.readInt64AsDoubleFromPointer(i)}function bTe(i,e){for(var t=[],n=0;n<e;n++){var r=Cee(i,n);r!==null&&t.push(r)}return t}function hR(i){return TTe(Ai.getValue(i,"double"))}function Ree(i){return[hR(i),hR(i+G_)]}function wTe(i){return[hR(i+G_),hR(i)]}function STe(i,e,t){for(var n=Ai.getValue(i,"i32"),r=i+G_,s=[],o=e?wTe:Ree,a=0;a<n*2;a+=2)s.push(o(r+G_*a));return t&&s.push(s[0]),s}function Iee(i,e,t){var n=Ai._malloc(CO);Ai.HEAPF64.set([i,e].map(Pee),n/G_);var r=Ai._malloc(uR);try{return Ow(Rl.latLngToCell(n,t,r)),pTe(Cee(r))}finally{Ai._free(r),Ai._free(n)}}function RO(i){var e=Ai._malloc(CO),t=Eee(i),n=t[0],r=t[1];try{return Ow(Rl.cellToLatLng(n,r,e)),Ree(e)}finally{Ai._free(e)}}function IO(i,e){var t=Ai._malloc(hTe),n=Eee(i),r=n[0],s=n[1];try{return Ow(Rl.cellToBoundary(r,s,t)),STe(t,e,e)}finally{Ai._free(t)}}function PO(i,e,t){if(dTe(e),t=!!t,i.length===0||i[0].length===0)return[];var n=typeof i[0][0]=="number"?[i]:i,r=_Te(n,t),s=Ai._malloc(uTe);try{Ow(Rl.maxPolygonToCellsSize(r,e,0,s));var o=ATe(yTe(s)),a=Ai._calloc(o,uR);try{return Ow(Rl.polygonToCells(r,e,0,a)),bTe(a,o)}finally{Ai._free(a)}}finally{Ai._free(s),xTe(r)}}function Pee(i){return i*Math.PI/180}function TTe(i){return i*180/Math.PI}function LO(i){return i=Math.max(0,Math.min(1,i)),"rgb("+Math.max(0,Math.min(255,Math.round(34.61+i*(1172.33-i*(10793.56-i*(33300.12-i*(38394.49-i*14825.05)))))))+", "+Math.max(0,Math.min(255,Math.round(23.31+i*(557.33+i*(1225.33-i*(3574.96-i*(1073.77+i*707.56)))))))+", "+Math.max(0,Math.min(255,Math.round(27.2+i*(3211.1-i*(15327.97-i*(27814-i*(22569.18-i*6838.66)))))))+")"}var ETe=["alphaMap","alphaTest","anisotropy","anisotropyMap","anisotropyRotation","aoMap","aoMapIntensity","attenuationColor","attenuationDistance","bumpMap","clearcoat","clearcoatMap","clearcoatNormalMap","clearcoatNormalScale","clearcoatRoughness","color","dispersion","displacementMap","emissive","emissiveIntensity","emissiveMap","envMap","envMapIntensity","envMapRotation","gradientMap","ior","iridescence","iridescenceIOR","iridescenceMap","iridescenceThicknessMap","lightMap","lightMapIntensity","map","matcap","metalness","metalnessMap","normalMap","normalScale","opacity","roughness","roughnessMap","sheen","sheenColor","sheenColorMap","sheenRoughnessMap","shininess","specular","specularColor","specularColorMap","specularIntensity","specularIntensityMap","specularMap","thickness","transmission","transmissionMap"],Lee=new WeakMap,Dee=new WeakMap,Nee=new WeakMap,gU=class{constructor(e){this.renderObjects=new WeakMap,this.hasNode=this.containsNode(e),this.hasAnimation=e.object.isSkinnedMesh===!0,this.refreshUniforms=ETe,this.renderId=0}firstInitialization(e){return this.renderObjects.has(e)===!1?(this.getRenderObjectData(e),!0):!1}needsVelocity(e){let t=e.getMRT();return t!==null&&t.has("velocity")}getRenderObjectData(e){let t=this.renderObjects.get(e);if(t===void 0){let{geometry:n,object:r}=e;if(t={geometryId:n.id,worldMatrix:r.matrixWorld.clone()},r.center&&(t.center=r.center.clone()),r.morphTargetInfluences&&(t.morphTargetInfluences=r.morphTargetInfluences.slice()),e.bundle!==null&&(t.version=e.bundle.version),e.material.transmission>0){let{width:a,height:l}=e.context;t.bufferWidth=a,t.bufferHeight=l}let{environmentIntensity:s,environmentRotation:o}=e.scene;t.environmentIntensity=s,t.environmentRotation=o.clone(),t.lights=this.getLightsData(e.lightsNode.getLights(),[]),this.renderObjects.set(e,t)}return t}getAttributesData(e){let t={};for(let n in e){let r=e[n];t[n]={id:r.isInterleavedBufferAttribute?r.data.uuid:r.id,version:r.isInterleavedBufferAttribute?r.data.version:r.version}}return t}containsNode(e){let t=e.material;for(let n in t)if(t[n]&&t[n].isNode)return!0;return!!(e.context.modelViewMatrix||e.context.modelNormalViewMatrix||e.context.getAO||e.context.getShadow)}getGeometryData(e){let t=Nee.get(e);return t===void 0&&(t={_renderId:-1,_equal:!1,attributes:this.getAttributesData(e.attributes),indexId:e.index?e.index.id:null,indexVersion:e.index?e.index.version:null,drawRange:{start:e.drawRange.start,count:e.drawRange.count}},Nee.set(e,t)),t}getMaterialData(e){let t=Dee.get(e);if(t===void 0){t={_renderId:-1,_equal:!1};for(let n of this.refreshUniforms){let r=e[n];r!=null&&(typeof r=="object"&&r.clone!==void 0?r.isTexture===!0?t[n]={id:r.id,version:0}:t[n]=r.clone():t[n]=r)}Dee.set(e,t)}return t}equals(e,t,n){let{object:r,material:s,geometry:o}=e,a=this.getRenderObjectData(e);if(a.worldMatrix.equals(r.matrixWorld)!==!0)return a.worldMatrix.copy(r.matrixWorld),!1;let l=this.getMaterialData(e.material);if(l._renderId!==n){l._renderId=n;for(let f in l){let d=l[f],A=s[f];if(f!=="_renderId"&&f!=="_equal"){if(d.equals!==void 0){if(d.equals(A)===!1)return d.copy(A),l._equal=!1,!1}else if(A.isTexture===!0){if(d.id!==A.id||d.version!==A.version)return d.id=A.id,d.version=A.version,l._equal=!1,!1}else if(d!==A)return l[f]=A,l._equal=!1,!1}}if(l.transmission>0){let{width:f,height:d}=e.context;if(a.bufferWidth!==f||a.bufferHeight!==d)return a.bufferWidth=f,a.bufferHeight=d,l._equal=!1,!1}l._equal=!0}else if(l._equal===!1)return!1;if(a.geometryId!==o.id)return a.geometryId=o.id,!1;let c=this.getGeometryData(e.geometry);if(c._renderId!==n){c._renderId=n;let f=o.attributes,d=c.attributes,A=0,y=0;for(let I in f)A++;for(let I in d){y++;let F=d[I],D=f[I];if(D===void 0)return delete d[I],c._equal=!1,!1;let L=D.isInterleavedBufferAttribute?D.data.uuid:D.id,C=D.isInterleavedBufferAttribute?D.data.version:D.version;if(F.id!==L||F.version!==C)return F.id=L,F.version=C,c._equal=!1,!1}if(y!==A)return c.attributes=this.getAttributesData(f),c._equal=!1,!1;let w=o.index,S=c.indexId,T=c.indexVersion,R=w?w.id:null,P=w?w.version:null;if(S!==R||T!==P)return c.indexId=R,c.indexVersion=P,c._equal=!1,!1;if(c.drawRange.start!==o.drawRange.start||c.drawRange.count!==o.drawRange.count)return c.drawRange.start=o.drawRange.start,c.drawRange.count=o.drawRange.count,c._equal=!1,!1;c._equal=!0}else if(c._equal===!1)return!1;if(a.morphTargetInfluences){let f=!1;for(let d=0;d<a.morphTargetInfluences.length;d++)a.morphTargetInfluences[d]!==r.morphTargetInfluences[d]&&(a.morphTargetInfluences[d]=r.morphTargetInfluences[d],f=!0);if(f)return!1}if(a.lights){for(let f=0;f<t.length;f++)if(a.lights[f].map!==t[f].map)return!1}let u=e.scene;return u.environment!==null&&s.envMap===null&&(a.environmentIntensity!==u.environmentIntensity||a.environmentRotation.equals(u.environmentRotation)===!1)?(a.environmentIntensity=u.environmentIntensity,a.environmentRotation.copy(u.environmentRotation),!1):a.center&&a.center.equals(r.center)===!1?(a.center.copy(r.center),!1):(e.bundle!==null&&(a.version=e.bundle.version),!0)}getLightsData(e,t){t.length=0;for(let n of e)n.isSpotLight===!0&&n.map!==null&&t.push({map:n.map.version});return t}getLights(e,t){let n=Lee.get(e);return n===void 0&&(n={renderId:-1,lightsData:[]},Lee.set(e,n)),n.renderId===t||(n.renderId=t,this.getLightsData(e.getLights(),n.lightsData)),n.lightsData}needsRefresh(e,t){if(this.hasNode||this.hasAnimation||this.firstInitialization(e)||this.needsVelocity(t.renderer))return!0;let{renderId:n}=t;if(this.renderId!==n)return this.renderId=n,!0;let r=e.object.static===!0,s=e.bundle!==null&&e.bundle.static===!0&&this.getRenderObjectData(e).version===e.bundle.version;if(r||s)return!1;let o=this.getLights(e.lightsNode,n);return this.equals(e,o,n)!==!0}},MTe=[/^StackTrace\.js$/,/^TSLCore\.js$/,/^.*Node\.js$/,/^three\.webgpu.*\.js$/];function CTe(i){let e=/(?:at\s+(.+?)\s+\()?(?:(.+?)@)?([^@\s()]+):(\d+):(\d+)/;return i.split(`4131+`).map(t=>{let n=t.match(e);if(!n)return null;let r=n[1]||n[2]||"",s=n[3].split("?")[0],o=parseInt(n[4],10),a=parseInt(n[5],10),l=s.split("/").pop();return{fn:r,file:l,line:o,column:a}}).filter(t=>t&&!MTe.some(n=>n.test(t.file)))}var es=class{constructor(e=null){this.isStackTrace=!0,this.stack=CTe(e||new Error().stack)}getLocation(){if(this.stack.length===0)return"[Unknown location]";let e=this.stack[0],t=e.fn;return`${t?`"${t}()" at `:""}"${e.file}:${e.line}"`}getError(e){if(this.stack.length===0)return e;let t=this.stack.map(n=>{let r=`${n.file}:${n.line}:${n.column}`;return n.fn?` at ${n.fn} (${r})`:` at ${r}`}).join(`41324132 `);return`${e}4133-${t}`}};function Y9(i,e=0){let t=3735928559^e,n=1103547991^e;if(Array.isArray(i))for(let r=0,s;r<i.length;r++)s=i[r],t=Math.imul(t^s,2654435761),n=Math.imul(n^s,1597334677);else for(let r=0,s;r<i.length;r++)s=i.charCodeAt(r),t=Math.imul(t^s,2654435761),n=Math.imul(n^s,1597334677);return t=Math.imul(t^t>>>16,2246822507),t^=Math.imul(n^n>>>13,3266489909),n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(t^t>>>13,3266489909),4294967296*(2097151&n)+(t>>>0)}var yx=i=>Y9(i),PS=i=>Y9(i),tS=(...i)=>Y9(i),cTe=new Map([[1,"float"],[2,"vec2"],[3,"vec3"],[4,"vec4"],[9,"mat3"],[16,"mat4"]]),Eee=new WeakMap;function $te(i){return cTe.get(i)}function QR(i){if(/[iu]?vec\d/.test(i))return i.startsWith("ivec")?Int32Array:i.startsWith("uvec")?Uint32Array:Float32Array;if(/mat\d/.test(i)||/float/.test(i))return Float32Array;if(/uint/.test(i))return Uint32Array;if(/int/.test(i))return Int32Array;throw new Error(`THREE.NodeUtils: Unsupported type: ${i}`)}function Yte(i){if(/float|int|uint|bool/.test(i))return 1;if(/vec2/.test(i))return 2;if(/vec3/.test(i))return 3;if(/vec4/.test(i)||/mat2/.test(i))return 4;if(/mat3/.test(i))return 9;if(/mat4/.test(i))return 16;ze(`TSL: Unsupported type: ${i}`,new es)}function uTe(i){if(/float|int|uint|bool/.test(i))return 1;if(/vec2/.test(i))return 2;if(/vec3/.test(i))return 3;if(/vec4/.test(i)||/mat2/.test(i))return 4;if(/mat3/.test(i))return 12;if(/mat4/.test(i))return 16;ze(`TSL: Unsupported type: ${i}`,new es)}function hTe(i){if(/float|int|uint|bool/.test(i))return 1;if(/vec2/.test(i))return 2;if(/vec3/.test(i)||/vec4/.test(i))return 4;if(/mat2/.test(i))return 2;if(/mat3/.test(i)||/mat4/.test(i))return 4;ze(`TSL: Unsupported type: ${i}`,new es)}function dm(i){if(i==null)return null;let e=typeof i;return i.isNode===!0?"node":e==="number"?"float":e==="boolean"?"bool":e==="string"?"string":e==="function"?"shader":i.isVector2===!0?"vec2":i.isVector3===!0?"vec3":i.isVector4===!0?"vec4":i.isMatrix2===!0?"mat2":i.isMatrix3===!0?"mat3":i.isMatrix4===!0?"mat4":i.isColor===!0?"color":i instanceof ArrayBuffer?"ArrayBuffer":null}function Z9(i,...e){let t=i?i.slice(-4):void 0;return e.length===1&&(t==="vec2"?e=[e[0],e[0]]:t==="vec3"?e=[e[0],e[0],e[0]]:t==="vec4"&&(e=[e[0],e[0],e[0],e[0]])),i==="color"?new zt(...e):t==="vec2"?new Oe(...e):t==="vec3"?new re(...e):t==="vec4"?new xn(...e):t==="mat2"?new c_(...e):t==="mat3"?new Mn(...e):t==="mat4"?new cn(...e):i==="bool"?e[0]||!1:i==="float"||i==="int"||i==="uint"?e[0]||0:i==="string"?e[0]||"":i==="ArrayBuffer"?dTe(e[0]):null}function Zte(i){let e=Eee.get(i);return e===void 0&&(e={},Eee.set(i,e)),e}function fTe(i){let e="",t=new Uint8Array(i);for(let n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return btoa(e)}function dTe(i){return Uint8Array.from(atob(i),e=>e.charCodeAt(0)).buffer}var ex={VERTEX:"vertex",FRAGMENT:"fragment"},yn={NONE:"none",FRAME:"frame",RENDER:"render",OBJECT:"object"},pTe={BOOLEAN:"bool",INTEGER:"int",FLOAT:"float",VECTOR2:"vec2",VECTOR3:"vec3",VECTOR4:"vec4",MATRIX2:"mat2",MATRIX3:"mat3",MATRIX4:"mat4"},$o={READ_ONLY:"readOnly",WRITE_ONLY:"writeOnly",READ_WRITE:"readWrite"},Kte=["fragment","vertex"],jR=["setup","analyze","generate"],XR=[...Kte,"compute"],c1=["x","y","z","w"],mTe={analyze:"setup",generate:"analyze"},ATe=0,Kt=class i extends la{static get type(){return"Node"}constructor(e=null){super(),this.nodeType=e,this.updateType=yn.NONE,this.updateBeforeType=yn.NONE,this.updateAfterType=yn.NONE,this.version=0,this.name="",this.global=!1,this.parents=!1,this.isNode=!0,this._beforeNodes=null,this._cacheKey=null,this._uuid=null,this._cacheKeyVersion=0,this.id=ATe++,this.stackTrace=null,i.captureStackTrace===!0&&(this.stackTrace=new es)}set needsUpdate(e){e===!0&&this.version++}get uuid(){return this._uuid===null&&(this._uuid=Bu.generateUUID()),this._uuid}get type(){return this.constructor.type}onUpdate(e,t){return this.updateType=t,this.update=e.bind(this),this}onFrameUpdate(e){return this.onUpdate(e,yn.FRAME)}onRenderUpdate(e){return this.onUpdate(e,yn.RENDER)}onObjectUpdate(e){return this.onUpdate(e,yn.OBJECT)}onReference(e){return this.updateReference=e.bind(this),this}updateReference(){return this}isGlobal(){return this.global}*getChildren(){for(let{childNode:e}of this._getChildren())yield e}dispose(){this.dispatchEvent({type:"dispose"})}traverse(e){e(this);for(let t of this.getChildren())t.traverse(e)}_getChildren(e=new Set){let t=[];e.add(this);for(let n of Object.getOwnPropertyNames(this)){let r=this[n];if(!(n.startsWith("_")===!0||e.has(r))){if(Array.isArray(r)===!0)for(let s=0;s<r.length;s++){let o=r[s];o&&o.isNode===!0&&t.push({property:n,index:s,childNode:o})}else if(r&&r.isNode===!0)t.push({property:n,childNode:r});else if(r&&Object.getPrototypeOf(r)===Object.prototype)for(let s in r){if(s.startsWith("_")===!0)continue;let o=r[s];o&&o.isNode===!0&&t.push({property:n,index:s,childNode:o})}}}return t}getCacheKey(e=!1,t=null){if(e=e||this.version!==this._cacheKeyVersion,e===!0||this._cacheKey===null){t===null&&(t=new Set);let n=[];for(let{property:r,childNode:s}of this._getChildren(t))n.push(yx(r.slice(0,-4)),s.getCacheKey(e,t));this._cacheKey=tS(PS(n),this.customCacheKey()),this._cacheKeyVersion=this.version}return this._cacheKey}customCacheKey(){return this.id}getScope(){return this}getHash(){return String(this.id)}getUpdateType(){return this.updateType}getUpdateBeforeType(){return this.updateBeforeType}getUpdateAfterType(){return this.updateAfterType}getElementType(e){let t=this.getNodeType(e);return e.getElementType(t)}getMemberType(){return"void"}getNodeType(e,t=null){let n=e.getDataFromNode(this),r;return t!==null?(n.typeFromOutput=n.typeFromOutput||{},r=n.typeFromOutput[t],r===void 0&&(r=this.generateNodeType(e,t),n.typeFromOutput[t]=r)):(r=n.type,r===void 0&&(r=this.generateNodeType(e),n.type=r)),r}generateNodeType(e,t=null){let n=e.getNodeProperties(this);return n.outputNode?n.outputNode.getNodeType(e,t):this.nodeType}getShared(e){let t=this.getHash(e),n=e.getNodeFromHash(t),r=null;if(n&&n!==this)r=n;else if(e.context.overrideNodes){let s=e.context.overrideNodes.get(this);if(s){let o=e.getDataFromNode(this);o.isOverwritten!==!0?(o.isOverwritten=!0,r=s(e).overrideNode(this,null),o.sharedNode=r):r=o.sharedNode}}return r||this}getArrayCount(){return null}setup(e){let t=e.getNodeProperties(this),n=0;for(let r of this.getChildren())t["node"+n++]=r;return t.outputNode||null}analyze(e,t=null){let n=e.increaseUsage(this);if(this.parents===!0){let r=e.getDataFromNode(this,"any");r.stages=r.stages||{},r.stages[e.shaderStage]=r.stages[e.shaderStage]||[],r.stages[e.shaderStage].push(t)}if(n===1){let r=e.getNodeProperties(this);for(let s of Object.values(r))s&&s.isNode===!0&&s.build(e,this)}}generate(e,t){let{outputNode:n}=e.getNodeProperties(this);if(n&&n.isNode===!0)return n.build(e,t)}updateBefore(){Xe("Abstract function.")}updateAfter(){Xe("Abstract function.")}update(){Xe("Abstract function.")}before(e){return this._beforeNodes===null&&(this._beforeNodes=[]),this._beforeNodes.push(e),this}build(e,t=null){let n=this.getShared(e);if(this!==n)return n.build(e,t);if(this._beforeNodes!==null){let l=this._beforeNodes;this._beforeNodes=null;for(let c of l)c.build(e,t);this._beforeNodes=l}let r=e.getDataFromNode(this);r.buildStages=r.buildStages||{},r.buildStages[e.buildStage]=!0;let s=mTe[e.buildStage];if(s&&r.buildStages[s]!==!0){let l=e.getBuildStage();e.setBuildStage(s),this.build(e),e.setBuildStage(l)}e.addChain(this);let o=null,a=e.getBuildStage();if(a==="setup"){e.addNode(this),this.updateReference(e);let l=e.getNodeProperties(this);if(l.initialized!==!0){l.initialized=!0,l.outputNode=this.setup(e)||l.outputNode||null;for(let c of Object.values(l))if(c&&c.isNode===!0){if(c.parents===!0){let u=e.getNodeProperties(c);u.parents=u.parents||[],u.parents.push(this)}c.build(e)}e.addSequentialNode(this)}o=l.outputNode}else if(a==="analyze")this.analyze(e,t);else if(a==="generate"){if(this.generate.length<2){let c=this.getNodeType(e),u=e.getDataFromNode(this);o=u.snippet,o===void 0?u.generated===void 0?(u.generated=!0,o=this.generate(e)||"",u.snippet=o):(Xe("Node: Recursion detected.",this),o="/* Recursion detected. */"):u.flowCodes!==void 0&&e.context.nodeBlock!==void 0&&e.addFlowCodeHierarchy(this,e.context.nodeBlock),o=e.format(o,c,t)}else o=this.generate(e,t)||"";o===""&&t!==null&&t!=="void"&&t!=="OutputType"&&(ze(`TSL: Invalid generated code, expected a "${t}".`),o=e.generateConst(t))}return e.removeChain(this),o}getSerializeChildren(){return this._getChildren()}serialize(e){let t=this.getSerializeChildren(),n={};for(let{property:r,index:s,childNode:o}of t)s!==void 0?(n[r]===void 0&&(n[r]=Number.isInteger(s)?[]:{}),n[r][s]=o.toJSON(e.meta).uuid):n[r]=o.toJSON(e.meta).uuid;Object.keys(n).length>0&&(e.inputNodes=n)}deserialize(e){if(e.inputNodes!==void 0){let t=e.meta.nodes;for(let n in e.inputNodes)if(Array.isArray(e.inputNodes[n])){let r=[];for(let s of e.inputNodes[n])r.push(t[s]);this[n]=r}else if(typeof e.inputNodes[n]=="object"){let r={};for(let s in e.inputNodes[n]){let o=e.inputNodes[n][s];r[s]=t[o]}this[n]=r}else{let r=e.inputNodes[n];this[n]=t[r]}}}toJSON(e){let{uuid:t,type:n}=this,r=e===void 0||typeof e=="string";r&&(e={textures:{},images:{},nodes:{}});let s=e.nodes[t];s===void 0&&(s={uuid:t,type:n,meta:e,metadata:{version:4.7,type:"Node",generator:"Node.toJSON"}},r!==!0&&(e.nodes[s.uuid]=s),this.serialize(s),delete s.meta);function o(a){let l=[];for(let c in a){let u=a[c];delete u.metadata,l.push(u)}return l}if(r){let a=o(e.textures),l=o(e.images),c=o(e.nodes);a.length>0&&(s.textures=a),l.length>0&&(s.images=l),c.length>0&&(s.nodes=c)}return s}};Kt.captureStackTrace=!1;var Qd=class extends Kt{static get type(){return"ArrayElementNode"}constructor(e,t){super(),this.node=e,this.indexNode=t,this.isArrayElementNode=!0}generateNodeType(e){return this.node.getElementType(e)}getMemberType(e,t){return this.node.getMemberType(e,t)}generate(e){let t=this.indexNode.getNodeType(e),n=this.node.build(e),r=this.indexNode.build(e,!e.isVector(t)&&e.isInteger(t)?t:"uint");return`${n}[ ${r} ]`}},JR=class extends Kt{static get type(){return"ConvertNode"}constructor(e,t){super(),this.node=e,this.convertTo=t}generateNodeType(e){let t=this.node.getNodeType(e),n=null;for(let r of this.convertTo.split("|"))(n===null||e.getTypeLength(t)===e.getTypeLength(r))&&(n=r);return n}serialize(e){super.serialize(e),e.convertTo=this.convertTo}deserialize(e){super.deserialize(e),this.convertTo=e.convertTo}generate(e,t){let n=this.node,r=this.getNodeType(e),s=n.build(e,r);return e.format(s,r,t)}},Rr=class extends Kt{static get type(){return"TempNode"}constructor(e=null){super(e),this.isTempNode=!0}hasDependencies(e){return e.getDataFromNode(this).usageCount>1}build(e,t){if(e.getBuildStage()==="generate"){let r=e.getVectorType(this.getNodeType(e,t)),s=e.getDataFromNode(this);if(s.propertyName!==void 0)return e.format(s.propertyName,r,t);if(r!=="void"&&t!=="void"&&this.hasDependencies(e)){let o=super.build(e,r),a=e.getVarFromNode(this,null,r),l=e.getPropertyName(a);return e.addLineFlowCode(`${l} = ${o}`,this),s.snippet=o,s.propertyName=l,e.format(s.propertyName,r,t)}}return super.build(e,t)}},uU=class extends Rr{static get type(){return"JoinNode"}constructor(e=[],t=null){super(t),this.nodes=e}generateNodeType(e){return this.nodeType!==null?e.getVectorType(this.nodeType):e.getTypeFromLength(this.nodes.reduce((t,n)=>t+e.getTypeLength(n.getNodeType(e)),0))}generate(e,t){let n=this.getNodeType(e),r=e.getTypeLength(n),s=this.nodes,o=e.getComponentType(n),a=[],l=0;for(let u of s){if(l>=r){ze(`TSL: Length of parameters exceeds maximum length of function '${n}()' type.`,this.stackTrace);break}let f=u.getNodeType(e),d=e.getTypeLength(f),A;if(l+d>r&&(ze(`TSL: Length of '${n}()' data exceeds maximum length of output type.`,this.stackTrace),d=r-l,f=e.getTypeFromLength(d)),l+=d,A=u.build(e,f),e.getComponentType(f)!==o){let w=e.getTypeFromLength(d,o);A=e.format(A,f,w)}a.push(A)}let c=`${e.getType(n)}( ${a.join(", ")} )`;return e.format(c,n,t)}},gTe=c1.join(""),e4=class extends Kt{static get type(){return"SplitNode"}constructor(e,t="x"){super(),this.node=e,this.components=t,this.isSplitNode=!0}getVectorLength(){let e=this.components.length;for(let t of this.components)e=Math.max(c1.indexOf(t)+1,e);return e}getComponentType(e){return e.getComponentType(this.node.getNodeType(e))}generateNodeType(e){return e.getTypeFromLength(this.components.length,this.getComponentType(e))}getScope(){return this.node.getScope()}generate(e,t){let n=this.node,r=e.getTypeLength(n.getNodeType(e)),s=null;if(r>1){let o=null;this.getVectorLength()>=r&&(o=e.getTypeFromLength(this.getVectorLength(),this.getComponentType(e)));let l=n.build(e,o);this.components.length===r&&this.components===gTe.slice(0,this.components.length)?s=e.format(l,o,t):s=e.format(`${l}.${this.components}`,this.getNodeType(e),t)}else s=n.build(e,t);return s}serialize(e){super.serialize(e),e.components=this.components}deserialize(e){super.deserialize(e),this.components=e.components}},hU=class extends Rr{static get type(){return"SetNode"}constructor(e,t,n){super(),this.sourceNode=e,this.components=t,this.targetNode=n}generateNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){let{sourceNode:t,components:n,targetNode:r}=this,s=this.getNodeType(e),o=e.getComponentType(r.getNodeType(e)),a=e.getTypeFromLength(n.length,o),l=r.build(e,a),c=t.build(e,s),u=e.getTypeLength(s),f=[];for(let d=0;d<u;d++){let A=c1[d];A===n[0]?(f.push(l),d+=n.length-1):f.push(c+"."+A)}return`${e.getType(s)}( ${f.join(", ")} )`}},fU=class extends Rr{static get type(){return"FlipNode"}constructor(e,t){super(),this.sourceNode=e,this.components=t}generateNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){let{components:t,sourceNode:n}=this,r=this.getNodeType(e),s=n.build(e),o=e.getVarFromNode(this),a=e.getPropertyName(o);e.addLineFlowCode(a+" = "+s,this);let l=e.getTypeLength(r),c=[],u=0;for(let f=0;f<l;f++){let d=c1[f];d===t[u]?(c.push("1.0 - "+(a+"."+d)),u++):c.push(a+"."+d)}return`${e.getType(r)}( ${c.join(", ")} )`}},uS=class extends Kt{static get type(){return"InputNode"}constructor(e,t=null){super(t),this.isInputNode=!0,this.value=e,this.precision=null}generateNodeType(){return this.nodeType===null?dm(this.value):this.nodeType}getInputType(e){return this.getNodeType(e)}setPrecision(e){return this.precision=e,this}serialize(e){super.serialize(e),e.value=this.value,this.value&&this.value.toArray&&(e.value=this.value.toArray()),e.valueType=dm(this.value),e.nodeType=this.nodeType,e.valueType==="ArrayBuffer"&&(e.value=fTe(e.value)),e.precision=this.precision}deserialize(e){super.deserialize(e),this.nodeType=e.nodeType,this.value=Array.isArray(e.value)?Z9(e.valueType,...e.value):e.value,this.precision=e.precision||null,this.value&&this.value.fromArray&&(this.value=this.value.fromArray(e.value))}generate(){Xe("Abstract function.")}},Mee=/float|u?int/,su=class extends uS{static get type(){return"ConstNode"}constructor(e,t=null){super(e,t),this.isConstNode=!0}generateConst(e){return e.generateConst(this.getNodeType(e),this.value)}generate(e,t){let n=this.getNodeType(e);return Mee.test(n)&&Mee.test(t)?e.generateConst(t,this.value):e.format(this.generateConst(e),n,t)}},dU=class extends Kt{static get type(){return"MemberNode"}constructor(e,t){super(),this.structNode=e,this.property=t,this.isMemberNode=!0}hasMember(e){return this.structNode.isMemberNode&&this.structNode.hasMember(e)===!1?!1:this.structNode.getMemberType(e,this.property)!=="void"}generateNodeType(e){return this.hasMember(e)===!1?"float":this.structNode.getMemberType(e,this.property)}getMemberType(e,t){if(this.hasMember(e)===!1)return"float";let n=this.getNodeType(e);return e.getStructTypeNode(n).getMemberType(e,t)}generate(e){if(this.hasMember(e)===!1){Xe(`TSL: Member "${this.property}" does not exist in struct.`,this.stackTrace);let n=this.getNodeType(e);return e.generateConst(n)}return this.structNode.build(e)+"."+this.property}},gm=null,pU=new Map;function Ue(i,e){if(pU.has(i)){Xe(`TSL: Redefinition of method chaining '${i}'.`);return}if(typeof e!="function")throw new Error(`THREE.TSL: Node element ${i} is not a function`);pU.set(i,e),i!=="assign"&&(Kt.prototype[i]=function(...t){return this.isStackNode?this.addToStack(e(...t)):e(this,...t)},Kt.prototype[i+"Assign"]=function(...t){return this.isStackNode?this.assign(t[0],e(...t)):this.assign(e(this,...t))})}var vTe=i=>i.replace(/r|s/g,"x").replace(/g|t/g,"y").replace(/b|p/g,"z").replace(/a|q/g,"w"),Cee=i=>vTe(i).split("").sort().join("");Kt.prototype.assign=function(...i){if(this.isStackNode!==!0)return gm!==null?gm.assign(this,...i):ze("TSL: No stack defined for assign operation. Make sure the assign is inside a Fn().",new es),this;{let e=pU.get("assign");return this.addToStack(e(...i))}};Kt.prototype.toVarIntent=function(){return this};Kt.prototype.get=function(i){return new dU(this,i)};var nS={};function cR(i,e,t){nS[i]=nS[e]=nS[t]={get(){this._cache=this._cache||{};let o=this._cache[i];return o===void 0&&(o=new e4(this,i),this._cache[i]=o),o},set(o){this[i].assign(Ht(o))}};let n=i.toUpperCase(),r=e.toUpperCase(),s=t.toUpperCase();Kt.prototype["set"+n]=Kt.prototype["set"+r]=Kt.prototype["set"+s]=function(o){let a=Cee(i);return new hU(this,a,Ht(o))},Kt.prototype["flip"+n]=Kt.prototype["flip"+r]=Kt.prototype["flip"+s]=function(){let o=Cee(i);return new fU(this,o)}}var af=["x","y","z","w"],lf=["r","g","b","a"],cf=["s","t","p","q"];for(let i=0;i<4;i++){let e=af[i],t=lf[i],n=cf[i];cR(e,t,n);for(let r=0;r<4;r++){e=af[i]+af[r],t=lf[i]+lf[r],n=cf[i]+cf[r],cR(e,t,n);for(let s=0;s<4;s++){e=af[i]+af[r]+af[s],t=lf[i]+lf[r]+lf[s],n=cf[i]+cf[r]+cf[s],cR(e,t,n);for(let o=0;o<4;o++)e=af[i]+af[r]+af[s]+af[o],t=lf[i]+lf[r]+lf[s]+lf[o],n=cf[i]+cf[r]+cf[s]+cf[o],cR(e,t,n)}}}for(let i=0;i<32;i++)nS[i]={get(){this._cache=this._cache||{};let e=this._cache[i];return e===void 0&&(e=new Qd(this,new su(i,"uint")),this._cache[i]=e),e},set(e){this[i].assign(Ht(e))}};Object.defineProperties(Kt.prototype,nS);var _Te=function(i,e=null){let t=dm(i);return t==="node"?i:e===null&&(t==="float"||t==="boolean")||t&&t!=="shader"&&t!=="string"?Ht(gU(i,e)):t==="shader"?i.isFn?i:me(i):i},xTe=function(i,e=null){for(let t in i)i[t]=Ht(i[t],e);return i},yTe=function(i,e=null){let t=i.length;for(let n=0;n<t;n++)i[n]=Ht(i[n],e);return i},Qte=function(i,e=null,t=null,n=null){function r(u){return n!==null?(u=Ht(Object.assign(u,n)),n.intent===!0&&(u=u.toVarIntent())):u=Ht(u),u}let s,o=e,a,l;function c(u){let f;return o?f=/[a-z]/i.test(o)?o+"()":o:f=i.type,a!==void 0&&u.length<a?(ze(`TSL: "${f}" parameter length is less than minimum required.`,new es),u.concat(new Array(a-u.length).fill(0))):l!==void 0&&u.length>l?(ze(`TSL: "${f}" parameter length exceeds limit.`,new es),u.slice(0,l)):u}return e===null?s=(...u)=>r(new i(...Xg(c(u)))):t!==null?(t=Ht(t),s=(...u)=>r(new i(e,...Xg(c(u)),t))):s=(...u)=>r(new i(e,...Xg(c(u)))),s.setParameterLength=(...u)=>(u.length===1?a=l=u[0]:u.length===2&&([a,l]=u),s),s.setName=u=>(o=u,s),s},bTe=function(i,...e){return new i(...Xg(e))},mU=class extends Kt{constructor(e,t){super(),this.shaderNode=e,this.rawInputs=t,this.isShaderCallNodeInternal=!0}generateNodeType(e){return this.shaderNode.nodeType||this.getOutputNode(e).getNodeType(e)}getElementType(e){return this.getOutputNode(e).getElementType(e)}getMemberType(e,t){return this.getOutputNode(e).getMemberType(e,t)}call(e){let{shaderNode:t,rawInputs:n}=this,r=e.getNodeProperties(t),s=e.getClosestSubBuild(t.subBuilds)||"",o=s||"default";if(r[o])return r[o];let a=e.subBuildFn,l=e.fnCall;e.subBuildFn=s,e.fnCall=this;let c=null;if(t.layout){if(n){let d=t.layout.inputs;if(Jte(n)){let A=n;for(let y=0;y<d.length;y++){let w=A[y];w&&w.isNode&&w.build(e)}}else{let A=n[0];for(let y of d){let w=A[y.name];w&&w.isNode&&w.build(e)}}}let u=e.buildFunctionNode(t);e.addInclude(u);let f=n?wTe(n):null;c=u.call(f)}else{let u=new Proxy(e,{get:(w,S,T)=>{let R;return Symbol.iterator===S?R=function*(){yield void 0}:R=Reflect.get(w,S,T),R}}),f=n?STe(n):null,d=Array.isArray(n)?n.length>0:n!==null,A=t.jsFunc,y=d||A.length>1?A(f,u):A(u);c=Ht(y)}return e.subBuildFn=a,e.fnCall=l,t.once&&(r[o]=c),c}setupOutput(e){return e.addStack(),e.stack.outputNode=this.call(e),e.removeStack()}getOutputNode(e){let t=e.getNodeProperties(this),n=e.getSubBuildOutput(this);return t[n]=t[n]||this.setupOutput(e),t[n].subBuild=e.getClosestSubBuild(this),t[n]}build(e,t=null){let n=null,r=e.getBuildStage(),s=e.getNodeProperties(this),o=e.getSubBuildOutput(this),a=this.getOutputNode(e),l=e.fnCall;if(e.fnCall=this,r==="setup"){let c=e.getSubBuildProperty("initialized",this);if(s[c]!==!0&&(s[c]=!0,s[o]=this.getOutputNode(e),s[o].build(e),this.shaderNode.subBuilds))for(let u of e.chaining){let f=e.getDataFromNode(u,"any");f.subBuilds=f.subBuilds||new Set;for(let d of this.shaderNode.subBuilds)f.subBuilds.add(d)}n=s[o]}else r==="analyze"?a.build(e,t):r==="generate"&&(n=a.build(e,t)||"");return e.fnCall=l,n}};function Jte(i){return i[0]&&(i[0].isNode||Object.getPrototypeOf(i[0])!==Object.prototype)}function wTe(i){let e;return dI(i),Jte(i)?e=[...i]:e=i[0],e}function STe(i){let e=0;return dI(i),new Proxy(i,{get:(t,n,r)=>{let s;if(n==="length")return s=i.length,s;if(Symbol.iterator===n)s=function*(){for(let o of i)yield Ht(o)};else{if(i.length>0)if(Object.getPrototypeOf(i[0])===Object.prototype){let o=i[0];o[n]===void 0?s=o[e++]:s=Reflect.get(o,n,r)}else i[0]instanceof Kt&&(i[n]===void 0?s=i[e++]:s=Reflect.get(i,n,r));else s=Reflect.get(t,n,r);s=Ht(s)}return s}})}var AU=class extends Kt{constructor(e,t){super(t),this.jsFunc=e,this.layout=null,this.global=!0,this.once=!1}setLayout(e){return this.layout=e,this}getLayout(){return this.layout}call(e=null){return new mU(this,e)}setup(){return this.call()}},TTe=[!1,!0],ETe=[0,1,2,3],MTe=[-1,-2],ene=[.5,1.5,1/3,1e-6,1e6,Math.PI,Math.PI*2,1/Math.PI,2/Math.PI,1/(Math.PI*2),Math.PI/2],K9=new Map;for(let i of TTe)K9.set(i,new su(i));var Q9=new Map;for(let i of ETe)Q9.set(i,new su(i,"uint"));var J9=new Map([...Q9].map(i=>new su(i.value,"int")));for(let i of MTe)J9.set(i,new su(i,"int"));var hI=new Map([...J9].map(i=>new su(i.value)));for(let i of ene)hI.set(i,new su(i));for(let i of ene)hI.set(-i,new su(-i));var fI={bool:K9,uint:Q9,ints:J9,float:hI},Ree=new Map([...K9,...hI]),gU=(i,e)=>Ree.has(i)?Ree.get(i):i.isNode===!0?i:new su(i,e),Zs=function(i,e=null){return(...t)=>{for(let r of t)if(r===void 0)return ze(`TSL: Invalid parameter for the type "${i}".`,new es),new su(0,i);if((t.length===0||!["bool","float","int","uint"].includes(i)&&t.every(r=>{let s=typeof r;return s!=="object"&&s!=="function"}))&&(t=[Z9(i,...t)]),t.length===1&&e!==null&&e.has(t[0]))return Jw(e.get(t[0]));if(t.length===1){let r=gU(t[0],i);return r.nodeType===i?Jw(r):Jw(new JR(r,i))}let n=t.map(r=>gU(r));return Jw(new uU(n,i))}};function hx(i){return i&&i.isNode&&i.traverse(e=>{e.isConstNode&&(i=e.value)}),!!i}var tne=i=>i!=null?i.nodeType||i.convertTo||(typeof i=="string"?i:null):null;function ix(i,e){return new AU(i,e)}var Ht=(i,e=null)=>_Te(i,e),Jw=(i,e=null)=>Ht(i,e).toVarIntent(),dI=(i,e=null)=>new xTe(i,e),Xg=(i,e=null)=>new yTe(i,e),$n=(i,e=null,t=null,n=null)=>new Qte(i,e,t,n),xt=(i,...e)=>new bTe(i,...e),ct=(i,e=null,t=null,n={})=>new Qte(i,e,t,{...n,intent:!0}),ez=(i,e)=>new Proxy(i,{get(t,n,r){return Reflect.get(e,n,r)},set(t,n,r){return Reflect.set(e,n,r)}}),CTe=0,vU=class extends Kt{constructor(e,t=null){super();let n=null;t!==null&&(typeof t=="object"?n=t.return:(typeof t=="string"?n=t:ze("TSL: Invalid layout type.",new es),t=null)),this.shaderNode=new ix(e,n),t!==null&&this.setLayout(t),this.isFn=!0}setLayout(e){let t=this.shaderNode.nodeType;if(typeof e.inputs!="object"){let n={name:"fn"+CTe++,type:t,inputs:[]};for(let r in e)r!=="return"&&n.inputs.push({name:r,type:e[r]});e=n}return this.shaderNode.setLayout(e),this}generateNodeType(e){return this.shaderNode.getNodeType(e)||"float"}call(...e){let t=this.shaderNode.call(e);return this.shaderNode.nodeType==="void"&&t.toStack(),t.toVarIntent()}once(e=null){return this.shaderNode.once=!0,this.shaderNode.subBuilds=e,this}generate(e){let t=this.getNodeType(e);return ze('TSL: "Fn()" was declared but not invoked. Try calling it like "Fn()( ...params )".',this.stackTrace),e.generateConst(t)}};function me(i,e=null){let t=new vU(i,e);return new Proxy(()=>{},{apply(n,r,s){return t.call(...s)},get(n,r,s){return Reflect.get(t,r,s)},set(n,r,s,o){return Reflect.set(t,r,s,o)}})}var hS=i=>{gm=i},tz=()=>gm,$t=(...i)=>gm.If(...i),RTe=(...i)=>gm.Switch(...i);function pI(i){return gm&&gm.addToStack(i),i}Ue("toStack",pI);var nne=new Zs("color"),oe=new Zs("float",fI.float),de=new Zs("int",fI.ints),rt=new Zs("uint",fI.uint),fc=new Zs("bool",fI.bool),dt=new Zs("vec2"),kr=new Zs("ivec2"),nz=new Zs("uvec2"),ine=new Zs("bvec2"),pe=new Zs("vec3"),iz=new Zs("ivec3"),u1=new Zs("uvec3"),rz=new Zs("bvec3"),Ft=new Zs("vec4"),sz=new Zs("ivec4"),oz=new Zs("uvec4"),rne=new Zs("bvec4"),mI=new Zs("mat2"),To=new Zs("mat3"),mm=new Zs("mat4");Ue("toColor",nne);Ue("toFloat",oe);Ue("toInt",de);Ue("toUint",rt);Ue("toBool",fc);Ue("toVec2",dt);Ue("toIVec2",kr);Ue("toUVec2",nz);Ue("toBVec2",ine);Ue("toVec3",pe);Ue("toIVec3",iz);Ue("toUVec3",u1);Ue("toBVec3",rz);Ue("toVec4",Ft);Ue("toIVec4",sz);Ue("toUVec4",oz);Ue("toBVec4",rne);Ue("toMat2",mI);Ue("toMat3",To);Ue("toMat4",mm);var sne=$n(Qd).setParameterLength(2),one=(i,e)=>new JR(Ht(i),e),ITe=(i,e)=>new e4(Ht(i),e);Ue("element",sne);Ue("convert",one);var PTe=i=>(Xe("TSL: append() has been renamed to Stack().",new es),pI(i));Ue("append",i=>(Xe("TSL: .append() has been renamed to .toStack().",new es),pI(i)));var gi=class extends Kt{static get type(){return"PropertyNode"}constructor(e,t=null,n=!1,r=null){super(e),this.name=t,this.varying=n,this.placeholderNode=Ht(r),this.isPropertyNode=!0,this.global=!0}getNodeType(e){let t=super.getNodeType(e);return t==="output"?e.getOutputType():t}customCacheKey(){return yx(this.type+":"+(this.name||"")+":"+(this.varying?"1":"0"))}getHash(e){return this.name||super.getHash(e)}generate(e){let t;if(this.varying===!0)t=e.getVaryingFromNode(this,this.name),t.needsInterpolation=!0;else if(t=e.getVarFromNode(this,this.name),this.placeholderNode!==null&&e.hasWriteUsage(this)===!1){let n=this.placeholderNode.build(e,this.getNodeType(e));e.addLineFlowCode(`${e.getPropertyName(t)} = ${n}`,this)}return e.getPropertyName(t)}},tp=(i,e,t=null)=>new gi(i,e,!1,t),h1=(i,e,t=null)=>new gi(i,e,!0,t),Bi=xt(gi,"vec4","DiffuseColor"),Vg=xt(gi,"vec3","DiffuseContribution"),_U=xt(gi,"vec3","EmissiveColor"),Af=xt(gi,"float","Roughness"),Kd=xt(gi,"float","Metalness"),t4=xt(gi,"float","Clearcoat"),sx=xt(gi,"float","ClearcoatRoughness"),lc=xt(gi,"vec3","Sheen"),lm=xt(gi,"float","SheenRoughness"),AI=xt(gi,"float","Iridescence"),n4=xt(gi,"float","IridescenceIOR"),i4=xt(gi,"float","IridescenceThickness"),r4=xt(gi,"float","AlphaT"),am=xt(gi,"float","Anisotropy"),iS=xt(gi,"vec3","AnisotropyT"),$g=xt(gi,"vec3","AnisotropyB"),vm=xt(gi,"color","SpecularColor"),qg=xt(gi,"color","SpecularColorBlended"),Hg=xt(gi,"float","SpecularF90"),s4=xt(gi,"float","Shininess"),ox=xt(gi,"output","Output"),Yg=xt(gi,"float","dashSize"),fS=xt(gi,"float","gapSize"),LTe=xt(gi,"float","pointWidth"),rS=xt(gi,"float","IOR"),o4=xt(gi,"float","Transmission"),az=xt(gi,"float","Thickness"),lz=xt(gi,"float","AttenuationDistance"),cz=xt(gi,"color","AttenuationColor"),uz=xt(gi,"float","Dispersion"),xU=xt(gi,"float","AmbientOcclusion",!1,1),a4=class extends Kt{static get type(){return"UniformGroupNode"}constructor(e,t=!1,n=1,r=null){super("string"),this.name=e,this.shared=t,this.order=n,this.updateType=r,this.isUniformGroup=!0}update(){this.needsUpdate=!0}serialize(e){super.serialize(e),e.name=this.name,e.version=this.version,e.shared=this.shared}deserialize(e){super.deserialize(e),this.name=e.name,this.version=e.version,this.shared=e.shared}},ane=(i,e=1,t=null)=>new a4(i,!1,e,t),gI=(i,e=0,t=null)=>new a4(i,!0,e,t),DTe=gI("frame",0,yn.FRAME),Jt=gI("render",0,yn.RENDER),lne=ane("object",1,yn.OBJECT),e1=class extends uS{static get type(){return"UniformNode"}constructor(e,t=null){super(e,t),this.isUniformNode=!0,this.name="",this.groupNode=lne}setName(e){return this.name=e,this}label(e){return Xe('TSL: "label()" has been deprecated. Use "setName()" instead.',new es),this.setName(e)}setGroup(e){return this.groupNode=e,this}getGroup(){return this.groupNode}getUniformHash(e){return this.getHash(e)}onUpdate(e,t){return e=e.bind(this),super.onUpdate(n=>{let r=e(n,this);r!==void 0&&(this.value=r)},t)}getInputType(e){let t=super.getInputType(e);return t==="bool"&&(t="uint"),t}generate(e,t){let n=this.getNodeType(e),r=this.getUniformHash(e),s=e.getNodeFromHash(r);s===void 0&&(e.setHashNode(this,r),s=this);let o=s.getInputType(e),a=e.getUniformFromNode(s,o,e.shaderStage,this.name||e.context.nodeName),l=e.getPropertyName(a);e.context.nodeName!==void 0&&delete e.context.nodeName;let c=l;if(n==="bool"){let u=e.getDataFromNode(this),f=u.propertyName;if(f===void 0){let d=e.getVarFromNode(this,null,"bool");f=e.getPropertyName(d),u.propertyName=f,c=e.format(l,o,n),e.addLineFlowCode(`${f} = ${c}`,this)}c=f}return e.format(c,n,t)}},Xt=(i,e)=>{let t=tne(e||i);if(t===i&&(i=Z9(t)),i&&i.isNode===!0){let n=i.value;i.traverse(r=>{r.isConstNode===!0&&(n=r.value)}),i=n}return new e1(i,t)},l4=class extends Rr{static get type(){return"ArrayNode"}constructor(e,t,n=null){super(e),this.count=t,this.values=n,this.isArrayNode=!0}getArrayCount(){return this.count}generateNodeType(e){return this.nodeType===null?this.values[0].getNodeType(e):this.nodeType}getElementType(e){return this.getNodeType(e)}getMemberType(e,t){return this.nodeType===null?this.values[0].getMemberType(e,t):super.getMemberType(e,t)}generate(e){let t=this.getNodeType(e);return e.generateArray(t,this.count,this.values)}},cne=(...i)=>{let e;if(i.length===1){let t=i[0];e=new l4(null,t.length,t)}else{let t=i[0],n=i[1];e=new l4(t,n)}return Ht(e)};Ue("toArray",(i,e)=>cne(Array(e).fill(i)));var yU=class extends Rr{static get type(){return"AssignNode"}constructor(e,t){super(),this.targetNode=e,this.sourceNode=t,this.isAssignNode=!0}hasDependencies(){return!1}generateNodeType(e,t){return t!=="void"?this.targetNode.getNodeType(e):"void"}needsSplitAssign(e){let{targetNode:t}=this;if(e.isAvailable("swizzleAssign")===!1&&t.isSplitNode&&t.components.length>1){let n=e.getTypeLength(t.node.getNodeType(e));return c1.join("").slice(0,n)!==t.components}return!1}setup(e){let{targetNode:t,sourceNode:n}=this,r=t.getScope(),s=e.getDataFromNode(r);s.assign=!0;let o=e.getNodeProperties(this);o.sourceNode=n,o.targetNode=t.context({assign:!0})}generate(e,t){let{targetNode:n,sourceNode:r}=e.getNodeProperties(this),s=this.needsSplitAssign(e),o=n.build(e),a=n.getNodeType(e),l=r.build(e,a),c=r.getNodeType(e),u=e.getDataFromNode(this),f;if(u.initialized===!0)t!=="void"&&(f=o);else if(s){let d=e.getVarFromNode(this,null,a),A=e.getPropertyName(d);e.addLineFlowCode(`${A} = ${l}`,this);let y=n.node,S=y.node.context({assign:!0}).build(e);for(let T=0;T<y.components.length;T++){let R=y.components[T];e.addLineFlowCode(`${S}.${R} = ${A}[ ${T} ]`,this)}t!=="void"&&(f=o)}else f=`${o} = ${l}`,(t==="void"||c==="void")&&(e.addLineFlowCode(f,this),t!=="void"&&(f=o));return u.initialized=!0,e.format(f,a,t)}},une=$n(yU).setParameterLength(2);Ue("assign",une);var bU=class extends Rr{static get type(){return"FunctionCallNode"}constructor(e=null,t={}){super(),this.functionNode=e,this.parameters=t}setParameters(e){return this.parameters=e,this}getParameters(){return this.parameters}generateNodeType(e){return this.functionNode.getNodeType(e)}getMemberType(e,t){return this.functionNode.getMemberType(e,t)}generate(e){let t=[],n=this.functionNode,r=n.getInputs(e),s=this.parameters,o=(l,c)=>{let u=c.type,f=u==="pointer",d;return f?d="&"+l.build(e):d=l.build(e,u),d};if(Array.isArray(s)){if(s.length>r.length)ze("TSL: The number of provided parameters exceeds the expected number of inputs in 'Fn()'."),s.length=r.length;else if(s.length<r.length)for(ze("TSL: The number of provided parameters is less than the expected number of inputs in 'Fn()'.");s.length<r.length;)s.push(oe(0));for(let l=0;l<s.length;l++)t.push(o(s[l],r[l]))}else for(let l of r){let c=s[l.name];c!==void 0?t.push(o(c,l)):(ze(`TSL: Input '${l.name}' not found in 'Fn()'.`),t.push(o(oe(0),l)))}return`${n.build(e,"property")}( ${t.join(", ")} )`}},hne=(i,...e)=>(e=e.length>1||e[0]&&e[0].isNode===!0?Xg(e):dI(e[0]),new bU(Ht(i),e));Ue("call",hne);var NTe={"==":"equal","!=":"notEqual","<":"lessThan",">":"greaterThan","<=":"lessThanEqual",">=":"greaterThanEqual","%":"mod"},ts=class i extends Rr{static get type(){return"OperatorNode"}constructor(e,t,n,...r){if(super(),r.length>0){let s=new i(e,t,n);for(let o=0;o<r.length-1;o++)s=new i(e,s,r[o]);t=s,n=r[r.length-1]}this.op=e,this.aNode=t,this.bNode=n,this.isOperatorNode=!0}getOperatorMethod(e,t){return e.getMethod(NTe[this.op],t)}generateNodeType(e,t=null){let n=this.op,r=this.aNode,s=this.bNode,o=r.getNodeType(e),a=s?s.getNodeType(e):null;if(o==="void"||a==="void")return t||"void";if(n==="%")return o;if(n==="~"||n==="&"||n==="|"||n==="^"||n===">>"||n==="<<")return e.getIntegerType(o);if(n==="&&"||n==="||"||n==="^^")return"bool";if(n==="!"){let l=e.getTypeLength(o);return l>1?`bvec${l}`:"bool"}else if(n==="=="||n==="!="||n==="<"||n===">"||n==="<="||n===">="){let l=Math.max(e.getTypeLength(o),e.getTypeLength(a));return l>1?`bvec${l}`:"bool"}else{if(e.isMatrix(o)){if(a==="float")return o;if(e.isVector(a))return e.getVectorFromMatrix(o);if(e.isMatrix(a))return o}else if(e.isMatrix(a)){if(o==="float")return a;if(e.isVector(o))return e.getVectorFromMatrix(a)}return e.getTypeLength(a)>e.getTypeLength(o)?a:o}}generate(e,t){let n=this.op,{aNode:r,bNode:s}=this,o=this.getNodeType(e,t),a=null,l=null;o!=="void"?(a=r.getNodeType(e),l=s?s.getNodeType(e):null,n==="<"||n===">"||n==="<="||n===">="||n==="=="||n==="!="?e.isVector(a)?l=a:e.isVector(l)?a=l:a!==l&&(a=l="float"):n===">>"||n==="<<"?(a=o,l=e.changeComponentType(l,"uint")):n==="%"?(a=o,l=e.isInteger(a)&&e.isInteger(l)?l:a):e.isMatrix(a)?l==="float"?l="float":e.isVector(l)?l=e.getVectorFromMatrix(a):e.isMatrix(l)||(a=l=o):e.isMatrix(l)?a==="float"?a="float":e.isVector(a)?a=e.getVectorFromMatrix(l):a=l=o:a=l=o):a=l=o;let c=r.build(e,a),u=s?s.build(e,l):null,f=e.getFunctionOperator(n);if(t!=="void"){let d=e.renderer.coordinateSystem===Uo;if(n==="=="||n==="!="||n==="<"||n===">"||n==="<="||n===">=")return d?e.isVector(a)?e.format(`${this.getOperatorMethod(e,t)}( ${c}, ${u} )`,o,t):e.format(`( ${c} ${n} ${u} )`,o,t):e.format(`( ${c} ${n} ${u} )`,o,t);if(n==="%")return e.isInteger(l)?e.format(`( ${c} % ${u} )`,o,t):e.format(`${this.getOperatorMethod(e,o)}( ${c}, ${u} )`,o,t);if(n==="!")return d&&e.isVector(a)?e.format(`not( ${c} )`,t):e.format(`( ${n} ${c} )`,a,t);if(n==="~")return e.format(`( ${n} ${c} )`,a,t);if(f)return e.format(`${f}( ${c}, ${u} )`,o,t);if(e.isMatrix(a)&&l==="float")return e.format(`( ${u} ${n} ${c} )`,o,t);if(a==="float"&&e.isMatrix(l))return e.format(`${c} ${n} ${u}`,o,t);{let A=`( ${c} ${n} ${u} )`;return!d&&o==="bool"&&e.isVector(a)&&e.isVector(l)&&(A=`all${A}`),e.format(A,o,t)}}else if(a!=="void")return f?e.format(`${f}( ${c}, ${u} )`,o,t):e.isMatrix(a)&&l==="float"?e.format(`${u} ${n} ${c}`,o,t):e.format(`${c} ${n} ${u}`,o,t)}serialize(e){super.serialize(e),e.op=this.op}deserialize(e){super.deserialize(e),this.op=e.op}},Ls=ct(ts,"+").setParameterLength(2,1/0).setName("add"),ai=ct(ts,"-").setParameterLength(2,1/0).setName("sub"),Tn=ct(ts,"*").setParameterLength(2,1/0).setName("mul"),dc=ct(ts,"/").setParameterLength(2,1/0).setName("div"),vI=ct(ts,"%").setParameterLength(2).setName("mod"),fne=ct(ts,"==").setParameterLength(2).setName("equal"),dne=ct(ts,"!=").setParameterLength(2).setName("notEqual"),pne=ct(ts,"<").setParameterLength(2).setName("lessThan"),hz=ct(ts,">").setParameterLength(2).setName("greaterThan"),mne=ct(ts,"<=").setParameterLength(2).setName("lessThanEqual"),Ane=ct(ts,">=").setParameterLength(2).setName("greaterThanEqual"),gne=ct(ts,"&&").setParameterLength(2,1/0).setName("and"),vne=ct(ts,"||").setParameterLength(2,1/0).setName("or"),_ne=ct(ts,"!").setParameterLength(1).setName("not"),xne=ct(ts,"^^").setParameterLength(2).setName("xor"),yne=ct(ts,"&").setParameterLength(2).setName("bitAnd"),bne=ct(ts,"~").setParameterLength(1).setName("bitNot"),wne=ct(ts,"|").setParameterLength(2).setName("bitOr"),Sne=ct(ts,"^").setParameterLength(2).setName("bitXor"),Tne=ct(ts,"<<").setParameterLength(2).setName("shiftLeft"),Ene=ct(ts,">>").setParameterLength(2).setName("shiftRight"),Mne=me(([i])=>(i.addAssign(1),i)),Cne=me(([i])=>(i.subAssign(1),i)),Rne=me(([i])=>{let e=de(i).toConst();return i.addAssign(1),e}),Ine=me(([i])=>{let e=de(i).toConst();return i.subAssign(1),e});Ue("add",Ls);Ue("sub",ai);Ue("mul",Tn);Ue("div",dc);Ue("mod",vI);Ue("equal",fne);Ue("notEqual",dne);Ue("lessThan",pne);Ue("greaterThan",hz);Ue("lessThanEqual",mne);Ue("greaterThanEqual",Ane);Ue("and",gne);Ue("or",vne);Ue("not",_ne);Ue("xor",xne);Ue("bitAnd",yne);Ue("bitNot",bne);Ue("bitOr",wne);Ue("bitXor",Sne);Ue("shiftLeft",Tne);Ue("shiftRight",Ene);Ue("incrementBefore",Mne);Ue("decrementBefore",Cne);Ue("increment",Rne);Ue("decrement",Ine);var Ie=class i extends Rr{static get type(){return"MathNode"}constructor(e,t,n=null,r=null){if(super(),(e===i.MAX||e===i.MIN)&&arguments.length>3){let s=new i(e,t,n);for(let o=3;o<arguments.length-1;o++)s=new i(e,s,arguments[o]);t=s,n=arguments[arguments.length-1],r=null}this.method=e,this.aNode=t,this.bNode=n,this.cNode=r,this.isMathNode=!0}getInputType(e){let t=this.aNode.getNodeType(e),n=this.bNode?this.bNode.getNodeType(e):null,r=this.cNode?this.cNode.getNodeType(e):null,s=e.isMatrix(t)?0:e.getTypeLength(t),o=e.isMatrix(n)?0:e.getTypeLength(n),a=e.isMatrix(r)?0:e.getTypeLength(r);return s>o&&s>a?t:o>a?n:a>s?r:t}generateNodeType(e){let t=this.method;return t===i.LENGTH||t===i.DISTANCE||t===i.DOT?"float":t===i.CROSS?"vec3":t===i.ALL||t===i.ANY?"bool":t===i.EQUALS?e.changeComponentType(this.aNode.getNodeType(e),"bool"):this.getInputType(e)}setup(e){let{aNode:t,bNode:n,method:r}=this,s=null;if(r===i.ONE_MINUS)s=ai(1,t);else if(r===i.RECIPROCAL)s=dc(1,t);else if(r===i.DIFFERENCE)s=fr(ai(t,n));else if(r===i.TRANSFORM_DIRECTION){let o,a;e.isMatrix(t.getNodeType(e))?(o=t,a=n):(o=n,a=t),s=xa(Tn(o,Ft(pe(a),0)).xyz)}return s!==null?s:super.setup(e)}generate(e,t){if(e.getNodeProperties(this).outputNode)return super.generate(e,t);let r=this.method,s=this.getNodeType(e),o=this.getInputType(e),a=this.aNode,l=this.bNode,c=this.cNode,u=e.renderer.coordinateSystem;if(r===i.NEGATE)return e.format("( - "+a.build(e,o)+" )",s,t);{let f=[];return r===i.CROSS?f.push(a.build(e,s),l.build(e,s)):u===Uo&&r===i.STEP?f.push(a.build(e,e.getTypeLength(a.getNodeType(e))===1?"float":o),l.build(e,o)):u===Uo&&(r===i.MIN||r===i.MAX)?f.push(a.build(e,o),l.build(e,e.getTypeLength(l.getNodeType(e))===1?"float":o)):r===i.REFRACT?f.push(a.build(e,o),l.build(e,o),c.build(e,"float")):r===i.MIX?f.push(a.build(e,o),l.build(e,o),c.build(e,e.getTypeLength(c.getNodeType(e))===1?"float":o)):(u===xl&&r===i.ATAN&&l!==null&&(r="atan2"),e.shaderStage!=="fragment"&&(r===i.DFDX||r===i.DFDY)&&(Xe(`TSL: '${r}' is not supported in the ${e.shaderStage} stage.`,this.stackTrace),r="/*"+r+"*/"),f.push(a.build(e,o)),l!==null&&f.push(l.build(e,o)),c!==null&&f.push(c.build(e,o))),e.format(`${e.getMethod(r,s)}( ${f.join(", ")} )`,s,t)}}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}};Ie.ALL="all";Ie.ANY="any";Ie.RADIANS="radians";Ie.DEGREES="degrees";Ie.EXP="exp";Ie.EXP2="exp2";Ie.LOG="log";Ie.LOG2="log2";Ie.SQRT="sqrt";Ie.INVERSE_SQRT="inversesqrt";Ie.FLOOR="floor";Ie.CEIL="ceil";Ie.NORMALIZE="normalize";Ie.FRACT="fract";Ie.SIN="sin";Ie.SINH="sinh";Ie.COS="cos";Ie.COSH="cosh";Ie.TAN="tan";Ie.TANH="tanh";Ie.ASIN="asin";Ie.ASINH="asinh";Ie.ACOS="acos";Ie.ACOSH="acosh";Ie.ATAN="atan";Ie.ATANH="atanh";Ie.ABS="abs";Ie.SIGN="sign";Ie.LENGTH="length";Ie.NEGATE="negate";Ie.ONE_MINUS="oneMinus";Ie.DFDX="dFdx";Ie.DFDY="dFdy";Ie.ROUND="round";Ie.RECIPROCAL="reciprocal";Ie.TRUNC="trunc";Ie.FWIDTH="fwidth";Ie.TRANSPOSE="transpose";Ie.DETERMINANT="determinant";Ie.INVERSE="inverse";Ie.EQUALS="equals";Ie.MIN="min";Ie.MAX="max";Ie.STEP="step";Ie.REFLECT="reflect";Ie.DISTANCE="distance";Ie.DIFFERENCE="difference";Ie.DOT="dot";Ie.CROSS="cross";Ie.POW="pow";Ie.TRANSFORM_DIRECTION="transformDirection";Ie.MIX="mix";Ie.CLAMP="clamp";Ie.REFRACT="refract";Ie.SMOOTHSTEP="smoothstep";Ie.FACEFORWARD="faceforward";var _I=oe(1e-6),FTe=oe(1e6),c4=oe(Math.PI),BTe=oe(Math.PI*2),OTe=oe(Math.PI*2),UTe=oe(Math.PI*.5),Pne=ct(Ie,Ie.ALL).setParameterLength(1),Lne=ct(Ie,Ie.ANY).setParameterLength(1),Dne=ct(Ie,Ie.RADIANS).setParameterLength(1),Nne=ct(Ie,Ie.DEGREES).setParameterLength(1),fz=ct(Ie,Ie.EXP).setParameterLength(1),fx=ct(Ie,Ie.EXP2).setParameterLength(1),xI=ct(Ie,Ie.LOG).setParameterLength(1),vf=ct(Ie,Ie.LOG2).setParameterLength(1),Ja=ct(Ie,Ie.SQRT).setParameterLength(1),dz=ct(Ie,Ie.INVERSE_SQRT).setParameterLength(1),_f=ct(Ie,Ie.FLOOR).setParameterLength(1),yI=ct(Ie,Ie.CEIL).setParameterLength(1),xa=ct(Ie,Ie.NORMALIZE).setParameterLength(1),$u=ct(Ie,Ie.FRACT).setParameterLength(1),Za=ct(Ie,Ie.SIN).setParameterLength(1),Fne=ct(Ie,Ie.SINH).setParameterLength(1),Hu=ct(Ie,Ie.COS).setParameterLength(1),Bne=ct(Ie,Ie.COSH).setParameterLength(1),One=ct(Ie,Ie.TAN).setParameterLength(1),Une=ct(Ie,Ie.TANH).setParameterLength(1),kne=ct(Ie,Ie.ASIN).setParameterLength(1),zne=ct(Ie,Ie.ASINH).setParameterLength(1),pz=ct(Ie,Ie.ACOS).setParameterLength(1),Vne=ct(Ie,Ie.ACOSH).setParameterLength(1),mz=ct(Ie,Ie.ATAN).setParameterLength(1,2),Gne=ct(Ie,Ie.ATANH).setParameterLength(1),fr=ct(Ie,Ie.ABS).setParameterLength(1),Az=ct(Ie,Ie.SIGN).setParameterLength(1),xf=ct(Ie,Ie.LENGTH).setParameterLength(1),gz=ct(Ie,Ie.NEGATE).setParameterLength(1),qne=ct(Ie,Ie.ONE_MINUS).setParameterLength(1),vz=ct(Ie,Ie.DFDX).setParameterLength(1),_z=ct(Ie,Ie.DFDY).setParameterLength(1),Hne=ct(Ie,Ie.ROUND).setParameterLength(1),Wne=ct(Ie,Ie.RECIPROCAL).setParameterLength(1),xz=ct(Ie,Ie.TRUNC).setParameterLength(1),yz=ct(Ie,Ie.FWIDTH).setParameterLength(1),jne=ct(Ie,Ie.TRANSPOSE).setParameterLength(1),Xne=ct(Ie,Ie.DETERMINANT).setParameterLength(1),$ne=ct(Ie,Ie.INVERSE).setParameterLength(1),Il=ct(Ie,Ie.MIN).setParameterLength(2,1/0),zr=ct(Ie,Ie.MAX).setParameterLength(2,1/0),t1=ct(Ie,Ie.STEP).setParameterLength(2),Yne=ct(Ie,Ie.REFLECT).setParameterLength(2),Zne=ct(Ie,Ie.DISTANCE).setParameterLength(2),Kne=ct(Ie,Ie.DIFFERENCE).setParameterLength(2),ou=ct(Ie,Ie.DOT).setParameterLength(2),Jd=ct(Ie,Ie.CROSS).setParameterLength(2),nu=ct(Ie,Ie.POW).setParameterLength(2),bz=i=>Tn(i,i),Qne=i=>Tn(i,i,i),wz=i=>Tn(i,i,i,i),Jne=ct(Ie,Ie.TRANSFORM_DIRECTION).setParameterLength(2),eie=(i,e)=>xa(Tn(e,Ft(pe(i),0)).xyz),tie=(i,e)=>xa(Ft(pe(i),0).mul(e).xyz),nie=i=>Tn(Az(i),nu(fr(i),1/3)),Sz=i=>ou(i,i),Qn=ct(Ie,Ie.MIX).setParameterLength(3),Yu=(i,e=0,t=1)=>new Ie(Ie.CLAMP,Ht(i),Ht(e),Ht(t)),bI=i=>Yu(i),Tz=ct(Ie,Ie.REFRACT).setParameterLength(3),pc=ct(Ie,Ie.SMOOTHSTEP).setParameterLength(3),Ez=ct(Ie,Ie.FACEFORWARD).setParameterLength(3),iie=me(([i])=>{let n=43758.5453,r=ou(i.xy,dt(12.9898,78.233)),s=vI(r,c4);return $u(Za(s).mul(n))}),rie=(i,e,t)=>Qn(e,t,i),sie=(i,e,t)=>pc(e,t,i),oie=(i,e)=>t1(e,i),kTe=Ez,zTe=dz;Ue("all",Pne);Ue("any",Lne);Ue("radians",Dne);Ue("degrees",Nne);Ue("exp",fz);Ue("exp2",fx);Ue("log",xI);Ue("log2",vf);Ue("sqrt",Ja);Ue("inverseSqrt",dz);Ue("floor",_f);Ue("ceil",yI);Ue("normalize",xa);Ue("fract",$u);Ue("sin",Za);Ue("sinh",Fne);Ue("cos",Hu);Ue("cosh",Bne);Ue("tan",One);Ue("tanh",Une);Ue("asin",kne);Ue("asinh",zne);Ue("acos",pz);Ue("acosh",Vne);Ue("atan",mz);Ue("atanh",Gne);Ue("abs",fr);Ue("sign",Az);Ue("length",xf);Ue("lengthSq",Sz);Ue("negate",gz);Ue("oneMinus",qne);Ue("dFdx",vz);Ue("dFdy",_z);Ue("round",Hne);Ue("reciprocal",Wne);Ue("trunc",xz);Ue("fwidth",yz);Ue("min",Il);Ue("max",zr);Ue("step",oie);Ue("reflect",Yne);Ue("distance",Zne);Ue("dot",ou);Ue("cross",Jd);Ue("pow",nu);Ue("pow2",bz);Ue("pow3",Qne);Ue("pow4",wz);Ue("transformDirection",Jne);Ue("transformNormalByViewMatrix",eie);Ue("transformNormalByInverseViewMatrix",tie);Ue("mix",rie);Ue("clamp",Yu);Ue("refract",Tz);Ue("smoothstep",sie);Ue("faceForward",Ez);Ue("difference",Kne);Ue("saturate",bI);Ue("cbrt",nie);Ue("transpose",jne);Ue("determinant",Xne);Ue("inverse",$ne);Ue("rand",iie);var wU=class extends Kt{static get type(){return"ConditionalNode"}constructor(e,t,n=null){super(),this.condNode=e,this.ifNode=t,this.elseNode=n}generateNodeType(e){let{ifNode:t,elseNode:n}=e.getNodeProperties(this);if(t===void 0)return e.flowBuildStage(this,"setup"),this.getNodeType(e);let r=t.getNodeType(e);if(n!==null){let s=n.getNodeType(e);if(e.getTypeLength(s)>e.getTypeLength(r))return s}return r}setup(e){let t=this.condNode,n=this.ifNode.isolate(),r=this.elseNode?this.elseNode.isolate():null,s=e.context.nodeBlock;e.getDataFromNode(n).parentNodeBlock=s,r!==null&&(e.getDataFromNode(r).parentNodeBlock=s);let o=e.context.uniformFlow,a=e.getNodeProperties(this);a.condNode=t,a.ifNode=o?n:n.context({nodeBlock:n}),a.elseNode=r?o?r:r.context({nodeBlock:r}):null}generate(e,t){let n=this.getNodeType(e),r=e.getDataFromNode(this);if(r.nodeProperty!==void 0)return r.nodeProperty;let{condNode:s,ifNode:o,elseNode:a}=e.getNodeProperties(this),l=e.currentFunctionNode,c=t!=="void",u=c?tp(n).build(e):"";r.nodeProperty=u;let f=s.build(e,"bool");if(e.context.uniformFlow&&a!==null){let y=o.build(e,n),w=a.build(e,n),S=e.getTernary(f,y,w);return e.format(S,n,t)}e.addFlowCode(`4133+${t}`}};function iz(i,e=0){let t=3735928559^e,n=1103547991^e;if(Array.isArray(i))for(let r=0,s;r<i.length;r++)s=i[r],t=Math.imul(t^s,2654435761),n=Math.imul(n^s,1597334677);else for(let r=0,s;r<i.length;r++)s=i.charCodeAt(r),t=Math.imul(t^s,2654435761),n=Math.imul(n^s,1597334677);return t=Math.imul(t^t>>>16,2246822507),t^=Math.imul(n^n>>>13,3266489909),n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(t^t>>>13,3266489909),4294967296*(2097151&n)+(t>>>0)}var wx=i=>iz(i),FS=i=>iz(i),sS=(...i)=>iz(i),RTe=new Map([[1,"float"],[2,"vec2"],[3,"vec3"],[4,"vec4"],[9,"mat3"],[16,"mat4"]]),Fee=new WeakMap;function ine(i){return RTe.get(i)}function n4(i){if(/[iu]?vec\d/.test(i))return i.startsWith("ivec")?Int32Array:i.startsWith("uvec")?Uint32Array:Float32Array;if(/mat\d/.test(i)||/float/.test(i))return Float32Array;if(/uint/.test(i))return Uint32Array;if(/int/.test(i))return Int32Array;throw new Error(`THREE.NodeUtils: Unsupported type: ${i}`)}function rne(i){if(/float|int|uint|bool/.test(i))return 1;if(/vec2/.test(i))return 2;if(/vec3/.test(i))return 3;if(/vec4/.test(i)||/mat2/.test(i))return 4;if(/mat3/.test(i))return 9;if(/mat4/.test(i))return 16;ze(`TSL: Unsupported type: ${i}`,new es)}function ITe(i){if(/float|int|uint|bool/.test(i))return 1;if(/vec2/.test(i))return 2;if(/vec3/.test(i))return 3;if(/vec4/.test(i)||/mat2/.test(i))return 4;if(/mat3/.test(i))return 12;if(/mat4/.test(i))return 16;ze(`TSL: Unsupported type: ${i}`,new es)}function PTe(i){if(/float|int|uint|bool/.test(i))return 1;if(/vec2/.test(i))return 2;if(/vec3/.test(i)||/vec4/.test(i))return 4;if(/mat2/.test(i))return 2;if(/mat3/.test(i)||/mat4/.test(i))return 4;ze(`TSL: Unsupported type: ${i}`,new es)}function dm(i){if(i==null)return null;let e=typeof i;return i.isNode===!0?"node":e==="number"?"float":e==="boolean"?"bool":e==="string"?"string":e==="function"?"shader":i.isVector2===!0?"vec2":i.isVector3===!0?"vec3":i.isVector4===!0?"vec4":i.isMatrix2===!0?"mat2":i.isMatrix3===!0?"mat3":i.isMatrix4===!0?"mat4":i.isColor===!0?"color":i instanceof ArrayBuffer?"ArrayBuffer":null}function rz(i,...e){let t=i?i.slice(-4):void 0;return e.length===1&&(t==="vec2"?e=[e[0],e[0]]:t==="vec3"?e=[e[0],e[0],e[0]]:t==="vec4"&&(e=[e[0],e[0],e[0],e[0]])),i==="color"?new zt(...e):t==="vec2"?new Oe(...e):t==="vec3"?new re(...e):t==="vec4"?new xn(...e):t==="mat2"?new h_(...e):t==="mat3"?new Mn(...e):t==="mat4"?new cn(...e):i==="bool"?e[0]||!1:i==="float"||i==="int"||i==="uint"?e[0]||0:i==="string"?e[0]||"":i==="ArrayBuffer"?DTe(e[0]):null}function sne(i){let e=Fee.get(i);return e===void 0&&(e={},Fee.set(i,e)),e}function LTe(i){let e="",t=new Uint8Array(i);for(let n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return btoa(e)}function DTe(i){return Uint8Array.from(atob(i),e=>e.charCodeAt(0)).buffer}var nx={VERTEX:"vertex",FRAGMENT:"fragment"},yn={NONE:"none",FRAME:"frame",RENDER:"render",OBJECT:"object"},NTe={BOOLEAN:"bool",INTEGER:"int",FLOAT:"float",VECTOR2:"vec2",VECTOR3:"vec3",VECTOR4:"vec4",MATRIX2:"mat2",MATRIX3:"mat3",MATRIX4:"mat4"},$o={READ_ONLY:"readOnly",WRITE_ONLY:"writeOnly",READ_WRITE:"readWrite"},one=["fragment","vertex"],ZR=["setup","analyze","generate"],KR=[...one,"compute"],c1=["x","y","z","w"],FTe={analyze:"setup",generate:"analyze"},BTe=0,Kt=class i extends la{static get type(){return"Node"}constructor(e=null){super(),this.nodeType=e,this.updateType=yn.NONE,this.updateBeforeType=yn.NONE,this.updateAfterType=yn.NONE,this.version=0,this.name="",this.global=!1,this.parents=!1,this.isNode=!0,this._beforeNodes=null,this._cacheKey=null,this._uuid=null,this._cacheKeyVersion=0,this.id=BTe++,this.stackTrace=null,i.captureStackTrace===!0&&(this.stackTrace=new es)}set needsUpdate(e){e===!0&&this.version++}get uuid(){return this._uuid===null&&(this._uuid=Uu.generateUUID()),this._uuid}get type(){return this.constructor.type}onUpdate(e,t){return this.updateType=t,this.update=e.bind(this),this}onFrameUpdate(e){return this.onUpdate(e,yn.FRAME)}onRenderUpdate(e){return this.onUpdate(e,yn.RENDER)}onObjectUpdate(e){return this.onUpdate(e,yn.OBJECT)}onReference(e){return this.updateReference=e.bind(this),this}updateReference(){return this}isGlobal(){return this.global}*getChildren(){for(let{childNode:e}of this._getChildren())yield e}dispose(){this.dispatchEvent({type:"dispose"})}traverse(e){e(this);for(let t of this.getChildren())t.traverse(e)}_getChildren(e=new Set){let t=[];e.add(this);for(let n of Object.getOwnPropertyNames(this)){let r=this[n];if(!(n.startsWith("_")===!0||e.has(r))){if(Array.isArray(r)===!0)for(let s=0;s<r.length;s++){let o=r[s];o&&o.isNode===!0&&t.push({property:n,index:s,childNode:o})}else if(r&&r.isNode===!0)t.push({property:n,childNode:r});else if(r&&Object.getPrototypeOf(r)===Object.prototype)for(let s in r){if(s.startsWith("_")===!0)continue;let o=r[s];o&&o.isNode===!0&&t.push({property:n,index:s,childNode:o})}}}return t}getCacheKey(e=!1,t=null){if(e=e||this.version!==this._cacheKeyVersion,e===!0||this._cacheKey===null){t===null&&(t=new Set);let n=[];for(let{property:r,childNode:s}of this._getChildren(t))n.push(wx(r.slice(0,-4)),s.getCacheKey(e,t));this._cacheKey=sS(FS(n),this.customCacheKey()),this._cacheKeyVersion=this.version}return this._cacheKey}customCacheKey(){return this.id}getScope(){return this}getHash(){return String(this.id)}getUpdateType(){return this.updateType}getUpdateBeforeType(){return this.updateBeforeType}getUpdateAfterType(){return this.updateAfterType}getElementType(e){let t=this.getNodeType(e);return e.getElementType(t)}getMemberType(){return"void"}getNodeType(e,t=null){let n=e.getDataFromNode(this),r;return t!==null?(n.typeFromOutput=n.typeFromOutput||{},r=n.typeFromOutput[t],r===void 0&&(r=this.generateNodeType(e,t),n.typeFromOutput[t]=r)):(r=n.type,r===void 0&&(r=this.generateNodeType(e),n.type=r)),r}generateNodeType(e,t=null){let n=e.getNodeProperties(this);return n.outputNode?n.outputNode.getNodeType(e,t):this.nodeType}getShared(e){let t=this.getHash(e),n=e.getNodeFromHash(t),r=null;if(n&&n!==this)r=n;else if(e.context.overrideNodes){let s=e.context.overrideNodes.get(this);if(s){let o=e.getDataFromNode(this);o.isOverwritten!==!0?(o.isOverwritten=!0,r=s(e).overrideNode(this,null),o.sharedNode=r):r=o.sharedNode}}return r||this}getArrayCount(){return null}setup(e){let t=e.getNodeProperties(this),n=0;for(let r of this.getChildren())t["node"+n++]=r;return t.outputNode||null}analyze(e,t=null){let n=e.increaseUsage(this);if(this.parents===!0){let r=e.getDataFromNode(this,"any");r.stages=r.stages||{},r.stages[e.shaderStage]=r.stages[e.shaderStage]||[],r.stages[e.shaderStage].push(t)}if(n===1){let r=e.getNodeProperties(this);for(let s of Object.values(r))s&&s.isNode===!0&&s.build(e,this)}}generate(e,t){let{outputNode:n}=e.getNodeProperties(this);if(n&&n.isNode===!0)return n.build(e,t)}updateBefore(){Xe("Abstract function.")}updateAfter(){Xe("Abstract function.")}update(){Xe("Abstract function.")}before(e){return this._beforeNodes===null&&(this._beforeNodes=[]),this._beforeNodes.push(e),this}build(e,t=null){let n=this.getShared(e);if(this!==n)return n.build(e,t);if(this._beforeNodes!==null){let l=this._beforeNodes;this._beforeNodes=null;for(let c of l)c.build(e,t);this._beforeNodes=l}let r=e.getDataFromNode(this);r.buildStages=r.buildStages||{},r.buildStages[e.buildStage]=!0;let s=FTe[e.buildStage];if(s&&r.buildStages[s]!==!0){let l=e.getBuildStage();e.setBuildStage(s),this.build(e),e.setBuildStage(l)}e.addChain(this);let o=null,a=e.getBuildStage();if(a==="setup"){e.addNode(this),this.updateReference(e);let l=e.getNodeProperties(this);if(l.initialized!==!0){l.initialized=!0,l.outputNode=this.setup(e)||l.outputNode||null;for(let c of Object.values(l))if(c&&c.isNode===!0){if(c.parents===!0){let u=e.getNodeProperties(c);u.parents=u.parents||[],u.parents.push(this)}c.build(e)}e.addSequentialNode(this)}o=l.outputNode}else if(a==="analyze")this.analyze(e,t);else if(a==="generate"){if(this.generate.length<2){let c=this.getNodeType(e),u=e.getDataFromNode(this);o=u.snippet,o===void 0?u.generated===void 0?(u.generated=!0,o=this.generate(e)||"",u.snippet=o):(Xe("Node: Recursion detected.",this),o="/* Recursion detected. */"):u.flowCodes!==void 0&&e.context.nodeBlock!==void 0&&e.addFlowCodeHierarchy(this,e.context.nodeBlock),o=e.format(o,c,t)}else o=this.generate(e,t)||"";o===""&&t!==null&&t!=="void"&&t!=="OutputType"&&(ze(`TSL: Invalid generated code, expected a "${t}".`),o=e.generateConst(t))}return e.removeChain(this),o}getSerializeChildren(){return this._getChildren()}serialize(e){let t=this.getSerializeChildren(),n={};for(let{property:r,index:s,childNode:o}of t)s!==void 0?(n[r]===void 0&&(n[r]=Number.isInteger(s)?[]:{}),n[r][s]=o.toJSON(e.meta).uuid):n[r]=o.toJSON(e.meta).uuid;Object.keys(n).length>0&&(e.inputNodes=n)}deserialize(e){if(e.inputNodes!==void 0){let t=e.meta.nodes;for(let n in e.inputNodes)if(Array.isArray(e.inputNodes[n])){let r=[];for(let s of e.inputNodes[n])r.push(t[s]);this[n]=r}else if(typeof e.inputNodes[n]=="object"){let r={};for(let s in e.inputNodes[n]){let o=e.inputNodes[n][s];r[s]=t[o]}this[n]=r}else{let r=e.inputNodes[n];this[n]=t[r]}}}toJSON(e){let{uuid:t,type:n}=this,r=e===void 0||typeof e=="string";r&&(e={textures:{},images:{},nodes:{}});let s=e.nodes[t];s===void 0&&(s={uuid:t,type:n,meta:e,metadata:{version:4.7,type:"Node",generator:"Node.toJSON"}},r!==!0&&(e.nodes[s.uuid]=s),this.serialize(s),delete s.meta);function o(a){let l=[];for(let c in a){let u=a[c];delete u.metadata,l.push(u)}return l}if(r){let a=o(e.textures),l=o(e.images),c=o(e.nodes);a.length>0&&(s.textures=a),l.length>0&&(s.images=l),c.length>0&&(s.nodes=c)}return s}};Kt.captureStackTrace=!1;var Kd=class extends Kt{static get type(){return"ArrayElementNode"}constructor(e,t){super(),this.node=e,this.indexNode=t,this.isArrayElementNode=!0}generateNodeType(e){return this.node.getElementType(e)}getMemberType(e,t){return this.node.getMemberType(e,t)}generate(e){let t=this.indexNode.getNodeType(e),n=this.node.build(e),r=this.indexNode.build(e,!e.isVector(t)&&e.isInteger(t)?t:"uint");return`${n}[ ${r} ]`}},i4=class extends Kt{static get type(){return"ConvertNode"}constructor(e,t){super(),this.node=e,this.convertTo=t}generateNodeType(e){let t=this.node.getNodeType(e),n=null;for(let r of this.convertTo.split("|"))(n===null||e.getTypeLength(t)===e.getTypeLength(r))&&(n=r);return n}serialize(e){super.serialize(e),e.convertTo=this.convertTo}deserialize(e){super.deserialize(e),this.convertTo=e.convertTo}generate(e,t){let n=this.node,r=this.getNodeType(e),s=n.build(e,r);return e.format(s,r,t)}},Rr=class extends Kt{static get type(){return"TempNode"}constructor(e=null){super(e),this.isTempNode=!0}hasDependencies(e){return e.getDataFromNode(this).usageCount>1}build(e,t){if(e.getBuildStage()==="generate"){let r=e.getVectorType(this.getNodeType(e,t)),s=e.getDataFromNode(this);if(s.propertyName!==void 0)return e.format(s.propertyName,r,t);if(r!=="void"&&t!=="void"&&this.hasDependencies(e)){let o=super.build(e,r),a=e.getVarFromNode(this,null,r),l=e.getPropertyName(a);return e.addLineFlowCode(`${l} = ${o}`,this),s.snippet=o,s.propertyName=l,e.format(s.propertyName,r,t)}}return super.build(e,t)}},vU=class extends Rr{static get type(){return"JoinNode"}constructor(e=[],t=null){super(t),this.nodes=e}generateNodeType(e){return this.nodeType!==null?e.getVectorType(this.nodeType):e.getTypeFromLength(this.nodes.reduce((t,n)=>t+e.getTypeLength(n.getNodeType(e)),0))}generate(e,t){let n=this.getNodeType(e),r=e.getTypeLength(n),s=this.nodes,o=e.getComponentType(n),a=[],l=0;for(let u of s){if(l>=r){ze(`TSL: Length of parameters exceeds maximum length of function '${n}()' type.`,this.stackTrace);break}let f=u.getNodeType(e),d=e.getTypeLength(f),A;if(l+d>r&&(ze(`TSL: Length of '${n}()' data exceeds maximum length of output type.`,this.stackTrace),d=r-l,f=e.getTypeFromLength(d)),l+=d,A=u.build(e,f),e.getComponentType(f)!==o){let w=e.getTypeFromLength(d,o);A=e.format(A,f,w)}a.push(A)}let c=`${e.getType(n)}( ${a.join(", ")} )`;return e.format(c,n,t)}},OTe=c1.join(""),r4=class extends Kt{static get type(){return"SplitNode"}constructor(e,t="x"){super(),this.node=e,this.components=t,this.isSplitNode=!0}getVectorLength(){let e=this.components.length;for(let t of this.components)e=Math.max(c1.indexOf(t)+1,e);return e}getComponentType(e){return e.getComponentType(this.node.getNodeType(e))}generateNodeType(e){return e.getTypeFromLength(this.components.length,this.getComponentType(e))}getScope(){return this.node.getScope()}generate(e,t){let n=this.node,r=e.getTypeLength(n.getNodeType(e)),s=null;if(r>1){let o=null;this.getVectorLength()>=r&&(o=e.getTypeFromLength(this.getVectorLength(),this.getComponentType(e)));let l=n.build(e,o);this.components.length===r&&this.components===OTe.slice(0,this.components.length)?s=e.format(l,o,t):s=e.format(`${l}.${this.components}`,this.getNodeType(e),t)}else s=n.build(e,t);return s}serialize(e){super.serialize(e),e.components=this.components}deserialize(e){super.deserialize(e),this.components=e.components}},_U=class extends Rr{static get type(){return"SetNode"}constructor(e,t,n){super(),this.sourceNode=e,this.components=t,this.targetNode=n}generateNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){let{sourceNode:t,components:n,targetNode:r}=this,s=this.getNodeType(e),o=e.getComponentType(r.getNodeType(e)),a=e.getTypeFromLength(n.length,o),l=r.build(e,a),c=t.build(e,s),u=e.getTypeLength(s),f=[];for(let d=0;d<u;d++){let A=c1[d];A===n[0]?(f.push(l),d+=n.length-1):f.push(c+"."+A)}return`${e.getType(s)}( ${f.join(", ")} )`}},xU=class extends Rr{static get type(){return"FlipNode"}constructor(e,t){super(),this.sourceNode=e,this.components=t}generateNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){let{components:t,sourceNode:n}=this,r=this.getNodeType(e),s=n.build(e),o=e.getVarFromNode(this),a=e.getPropertyName(o);e.addLineFlowCode(a+" = "+s,this);let l=e.getTypeLength(r),c=[],u=0;for(let f=0;f<l;f++){let d=c1[f];d===t[u]?(c.push("1.0 - "+(a+"."+d)),u++):c.push(a+"."+d)}return`${e.getType(r)}( ${c.join(", ")} )`}},pS=class extends Kt{static get type(){return"InputNode"}constructor(e,t=null){super(t),this.isInputNode=!0,this.value=e,this.precision=null}generateNodeType(){return this.nodeType===null?dm(this.value):this.nodeType}getInputType(e){return this.getNodeType(e)}setPrecision(e){return this.precision=e,this}serialize(e){super.serialize(e),e.value=this.value,this.value&&this.value.toArray&&(e.value=this.value.toArray()),e.valueType=dm(this.value),e.nodeType=this.nodeType,e.valueType==="ArrayBuffer"&&(e.value=LTe(e.value)),e.precision=this.precision}deserialize(e){super.deserialize(e),this.nodeType=e.nodeType,this.value=Array.isArray(e.value)?rz(e.valueType,...e.value):e.value,this.precision=e.precision||null,this.value&&this.value.fromArray&&(this.value=this.value.fromArray(e.value))}generate(){Xe("Abstract function.")}},Bee=/float|u?int/,ou=class extends pS{static get type(){return"ConstNode"}constructor(e,t=null){super(e,t),this.isConstNode=!0}generateConst(e){return e.generateConst(this.getNodeType(e),this.value)}generate(e,t){let n=this.getNodeType(e);return Bee.test(n)&&Bee.test(t)?e.generateConst(t,this.value):e.format(this.generateConst(e),n,t)}},yU=class extends Kt{static get type(){return"MemberNode"}constructor(e,t){super(),this.structNode=e,this.property=t,this.isMemberNode=!0}hasMember(e){return this.structNode.isMemberNode&&this.structNode.hasMember(e)===!1?!1:this.structNode.getMemberType(e,this.property)!=="void"}generateNodeType(e){return this.hasMember(e)===!1?"float":this.structNode.getMemberType(e,this.property)}getMemberType(e,t){if(this.hasMember(e)===!1)return"float";let n=this.getNodeType(e);return e.getStructTypeNode(n).getMemberType(e,t)}generate(e){if(this.hasMember(e)===!1){Xe(`TSL: Member "${this.property}" does not exist in struct.`,this.stackTrace);let n=this.getNodeType(e);return e.generateConst(n)}return this.structNode.build(e)+"."+this.property}},gm=null,bU=new Map;function Ue(i,e){if(bU.has(i)){Xe(`TSL: Redefinition of method chaining '${i}'.`);return}if(typeof e!="function")throw new Error(`THREE.TSL: Node element ${i} is not a function`);bU.set(i,e),i!=="assign"&&(Kt.prototype[i]=function(...t){return this.isStackNode?this.addToStack(e(...t)):e(this,...t)},Kt.prototype[i+"Assign"]=function(...t){return this.isStackNode?this.assign(t[0],e(...t)):this.assign(e(this,...t))})}var UTe=i=>i.replace(/r|s/g,"x").replace(/g|t/g,"y").replace(/b|p/g,"z").replace(/a|q/g,"w"),Oee=i=>UTe(i).split("").sort().join("");Kt.prototype.assign=function(...i){if(this.isStackNode!==!0)return gm!==null?gm.assign(this,...i):ze("TSL: No stack defined for assign operation. Make sure the assign is inside a Fn().",new es),this;{let e=bU.get("assign");return this.addToStack(e(...i))}};Kt.prototype.toVarIntent=function(){return this};Kt.prototype.get=function(i){return new yU(this,i)};var oS={};function dR(i,e,t){oS[i]=oS[e]=oS[t]={get(){this._cache=this._cache||{};let o=this._cache[i];return o===void 0&&(o=new r4(this,i),this._cache[i]=o),o},set(o){this[i].assign(Ht(o))}};let n=i.toUpperCase(),r=e.toUpperCase(),s=t.toUpperCase();Kt.prototype["set"+n]=Kt.prototype["set"+r]=Kt.prototype["set"+s]=function(o){let a=Oee(i);return new _U(this,a,Ht(o))},Kt.prototype["flip"+n]=Kt.prototype["flip"+r]=Kt.prototype["flip"+s]=function(){let o=Oee(i);return new xU(this,o)}}var lf=["x","y","z","w"],cf=["r","g","b","a"],uf=["s","t","p","q"];for(let i=0;i<4;i++){let e=lf[i],t=cf[i],n=uf[i];dR(e,t,n);for(let r=0;r<4;r++){e=lf[i]+lf[r],t=cf[i]+cf[r],n=uf[i]+uf[r],dR(e,t,n);for(let s=0;s<4;s++){e=lf[i]+lf[r]+lf[s],t=cf[i]+cf[r]+cf[s],n=uf[i]+uf[r]+uf[s],dR(e,t,n);for(let o=0;o<4;o++)e=lf[i]+lf[r]+lf[s]+lf[o],t=cf[i]+cf[r]+cf[s]+cf[o],n=uf[i]+uf[r]+uf[s]+uf[o],dR(e,t,n)}}}for(let i=0;i<32;i++)oS[i]={get(){this._cache=this._cache||{};let e=this._cache[i];return e===void 0&&(e=new Kd(this,new ou(i,"uint")),this._cache[i]=e),e},set(e){this[i].assign(Ht(e))}};Object.defineProperties(Kt.prototype,oS);var kTe=function(i,e=null){let t=dm(i);return t==="node"?i:e===null&&(t==="float"||t==="boolean")||t&&t!=="shader"&&t!=="string"?Ht(TU(i,e)):t==="shader"?i.isFn?i:me(i):i},zTe=function(i,e=null){for(let t in i)i[t]=Ht(i[t],e);return i},VTe=function(i,e=null){let t=i.length;for(let n=0;n<t;n++)i[n]=Ht(i[n],e);return i},ane=function(i,e=null,t=null,n=null){function r(u){return n!==null?(u=Ht(Object.assign(u,n)),n.intent===!0&&(u=u.toVarIntent())):u=Ht(u),u}let s,o=e,a,l;function c(u){let f;return o?f=/[a-z]/i.test(o)?o+"()":o:f=i.type,a!==void 0&&u.length<a?(ze(`TSL: "${f}" parameter length is less than minimum required.`,new es),u.concat(new Array(a-u.length).fill(0))):l!==void 0&&u.length>l?(ze(`TSL: "${f}" parameter length exceeds limit.`,new es),u.slice(0,l)):u}return e===null?s=(...u)=>r(new i(...Xg(c(u)))):t!==null?(t=Ht(t),s=(...u)=>r(new i(e,...Xg(c(u)),t))):s=(...u)=>r(new i(e,...Xg(c(u)))),s.setParameterLength=(...u)=>(u.length===1?a=l=u[0]:u.length===2&&([a,l]=u),s),s.setName=u=>(o=u,s),s},GTe=function(i,...e){return new i(...Xg(e))},wU=class extends Kt{constructor(e,t){super(),this.shaderNode=e,this.rawInputs=t,this.isShaderCallNodeInternal=!0}generateNodeType(e){return this.shaderNode.nodeType||this.getOutputNode(e).getNodeType(e)}getElementType(e){return this.getOutputNode(e).getElementType(e)}getMemberType(e,t){return this.getOutputNode(e).getMemberType(e,t)}call(e){let{shaderNode:t,rawInputs:n}=this,r=e.getNodeProperties(t),s=e.getClosestSubBuild(t.subBuilds)||"",o=s||"default";if(r[o])return r[o];let a=e.subBuildFn,l=e.fnCall;e.subBuildFn=s,e.fnCall=this;let c=null;if(t.layout){if(n){let d=t.layout.inputs;if(lne(n)){let A=n;for(let y=0;y<d.length;y++){let w=A[y];w&&w.isNode&&w.build(e)}}else{let A=n[0];for(let y of d){let w=A[y.name];w&&w.isNode&&w.build(e)}}}let u=e.buildFunctionNode(t);e.addInclude(u);let f=n?qTe(n):null;c=u.call(f)}else{let u=new Proxy(e,{get:(w,S,T)=>{let R;return Symbol.iterator===S?R=function*(){yield void 0}:R=Reflect.get(w,S,T),R}}),f=n?HTe(n):null,d=Array.isArray(n)?n.length>0:n!==null,A=t.jsFunc,y=d||A.length>1?A(f,u):A(u);c=Ht(y)}return e.subBuildFn=a,e.fnCall=l,t.once&&(r[o]=c),c}setupOutput(e){return e.addStack(),e.stack.outputNode=this.call(e),e.removeStack()}getOutputNode(e){let t=e.getNodeProperties(this),n=e.getSubBuildOutput(this);return t[n]=t[n]||this.setupOutput(e),t[n].subBuild=e.getClosestSubBuild(this),t[n]}build(e,t=null){let n=null,r=e.getBuildStage(),s=e.getNodeProperties(this),o=e.getSubBuildOutput(this),a=this.getOutputNode(e),l=e.fnCall;if(e.fnCall=this,r==="setup"){let c=e.getSubBuildProperty("initialized",this);if(s[c]!==!0&&(s[c]=!0,s[o]=this.getOutputNode(e),s[o].build(e),this.shaderNode.subBuilds))for(let u of e.chaining){let f=e.getDataFromNode(u,"any");f.subBuilds=f.subBuilds||new Set;for(let d of this.shaderNode.subBuilds)f.subBuilds.add(d)}n=s[o]}else r==="analyze"?a.build(e,t):r==="generate"&&(n=a.build(e,t)||"");return e.fnCall=l,n}};function lne(i){return i[0]&&(i[0].isNode||Object.getPrototypeOf(i[0])!==Object.prototype)}function qTe(i){let e;return gI(i),lne(i)?e=[...i]:e=i[0],e}function HTe(i){let e=0;return gI(i),new Proxy(i,{get:(t,n,r)=>{let s;if(n==="length")return s=i.length,s;if(Symbol.iterator===n)s=function*(){for(let o of i)yield Ht(o)};else{if(i.length>0)if(Object.getPrototypeOf(i[0])===Object.prototype){let o=i[0];o[n]===void 0?s=o[e++]:s=Reflect.get(o,n,r)}else i[0]instanceof Kt&&(i[n]===void 0?s=i[e++]:s=Reflect.get(i,n,r));else s=Reflect.get(t,n,r);s=Ht(s)}return s}})}var SU=class extends Kt{constructor(e,t){super(t),this.jsFunc=e,this.layout=null,this.global=!0,this.once=!1}setLayout(e){return this.layout=e,this}getLayout(){return this.layout}call(e=null){return new wU(this,e)}setup(){return this.call()}},WTe=[!1,!0],jTe=[0,1,2,3],XTe=[-1,-2],cne=[.5,1.5,1/3,1e-6,1e6,Math.PI,Math.PI*2,1/Math.PI,2/Math.PI,1/(Math.PI*2),Math.PI/2],sz=new Map;for(let i of WTe)sz.set(i,new ou(i));var oz=new Map;for(let i of jTe)oz.set(i,new ou(i,"uint"));var az=new Map([...oz].map(i=>new ou(i.value,"int")));for(let i of XTe)az.set(i,new ou(i,"int"));var mI=new Map([...az].map(i=>new ou(i.value)));for(let i of cne)mI.set(i,new ou(i));for(let i of cne)mI.set(-i,new ou(-i));var AI={bool:sz,uint:oz,ints:az,float:mI},Uee=new Map([...sz,...mI]),TU=(i,e)=>Uee.has(i)?Uee.get(i):i.isNode===!0?i:new ou(i,e),Zs=function(i,e=null){return(...t)=>{for(let r of t)if(r===void 0)return ze(`TSL: Invalid parameter for the type "${i}".`,new es),new ou(0,i);if((t.length===0||!["bool","float","int","uint"].includes(i)&&t.every(r=>{let s=typeof r;return s!=="object"&&s!=="function"}))&&(t=[rz(i,...t)]),t.length===1&&e!==null&&e.has(t[0]))return iS(e.get(t[0]));if(t.length===1){let r=TU(t[0],i);return r.nodeType===i?iS(r):iS(new i4(r,i))}let n=t.map(r=>TU(r));return iS(new vU(n,i))}};function dx(i){return i&&i.isNode&&i.traverse(e=>{e.isConstNode&&(i=e.value)}),!!i}var une=i=>i!=null?i.nodeType||i.convertTo||(typeof i=="string"?i:null):null;function sx(i,e){return new SU(i,e)}var Ht=(i,e=null)=>kTe(i,e),iS=(i,e=null)=>Ht(i,e).toVarIntent(),gI=(i,e=null)=>new zTe(i,e),Xg=(i,e=null)=>new VTe(i,e),$n=(i,e=null,t=null,n=null)=>new ane(i,e,t,n),xt=(i,...e)=>new GTe(i,...e),ct=(i,e=null,t=null,n={})=>new ane(i,e,t,{...n,intent:!0}),lz=(i,e)=>new Proxy(i,{get(t,n,r){return Reflect.get(e,n,r)},set(t,n,r){return Reflect.set(e,n,r)}}),$Te=0,EU=class extends Kt{constructor(e,t=null){super();let n=null;t!==null&&(typeof t=="object"?n=t.return:(typeof t=="string"?n=t:ze("TSL: Invalid layout type.",new es),t=null)),this.shaderNode=new sx(e,n),t!==null&&this.setLayout(t),this.isFn=!0}setLayout(e){let t=this.shaderNode.nodeType;if(typeof e.inputs!="object"){let n={name:"fn"+$Te++,type:t,inputs:[]};for(let r in e)r!=="return"&&n.inputs.push({name:r,type:e[r]});e=n}return this.shaderNode.setLayout(e),this}generateNodeType(e){return this.shaderNode.getNodeType(e)||"float"}call(...e){let t=this.shaderNode.call(e);return this.shaderNode.nodeType==="void"&&t.toStack(),t.toVarIntent()}once(e=null){return this.shaderNode.once=!0,this.shaderNode.subBuilds=e,this}generate(e){let t=this.getNodeType(e);return ze('TSL: "Fn()" was declared but not invoked. Try calling it like "Fn()( ...params )".',this.stackTrace),e.generateConst(t)}};function me(i,e=null){let t=new EU(i,e);return new Proxy(()=>{},{apply(n,r,s){return t.call(...s)},get(n,r,s){return Reflect.get(t,r,s)},set(n,r,s,o){return Reflect.set(t,r,s,o)}})}var mS=i=>{gm=i},cz=()=>gm,$t=(...i)=>gm.If(...i),YTe=(...i)=>gm.Switch(...i);function vI(i){return gm&&gm.addToStack(i),i}Ue("toStack",vI);var hne=new Zs("color"),oe=new Zs("float",AI.float),de=new Zs("int",AI.ints),rt=new Zs("uint",AI.uint),dc=new Zs("bool",AI.bool),dt=new Zs("vec2"),kr=new Zs("ivec2"),uz=new Zs("uvec2"),fne=new Zs("bvec2"),pe=new Zs("vec3"),hz=new Zs("ivec3"),u1=new Zs("uvec3"),fz=new Zs("bvec3"),Ft=new Zs("vec4"),dz=new Zs("ivec4"),pz=new Zs("uvec4"),dne=new Zs("bvec4"),_I=new Zs("mat2"),To=new Zs("mat3"),mm=new Zs("mat4");Ue("toColor",hne);Ue("toFloat",oe);Ue("toInt",de);Ue("toUint",rt);Ue("toBool",dc);Ue("toVec2",dt);Ue("toIVec2",kr);Ue("toUVec2",uz);Ue("toBVec2",fne);Ue("toVec3",pe);Ue("toIVec3",hz);Ue("toUVec3",u1);Ue("toBVec3",fz);Ue("toVec4",Ft);Ue("toIVec4",dz);Ue("toUVec4",pz);Ue("toBVec4",dne);Ue("toMat2",_I);Ue("toMat3",To);Ue("toMat4",mm);var pne=$n(Kd).setParameterLength(2),mne=(i,e)=>new i4(Ht(i),e),ZTe=(i,e)=>new r4(Ht(i),e);Ue("element",pne);Ue("convert",mne);var KTe=i=>(Xe("TSL: append() has been renamed to Stack().",new es),vI(i));Ue("append",i=>(Xe("TSL: .append() has been renamed to .toStack().",new es),vI(i)));var gi=class extends Kt{static get type(){return"PropertyNode"}constructor(e,t=null,n=!1,r=null){super(e),this.name=t,this.varying=n,this.placeholderNode=Ht(r),this.isPropertyNode=!0,this.global=!0}getNodeType(e){let t=super.getNodeType(e);return t==="output"?e.getOutputType():t}customCacheKey(){return wx(this.type+":"+(this.name||"")+":"+(this.varying?"1":"0"))}getHash(e){return this.name||super.getHash(e)}generate(e){let t;if(this.varying===!0)t=e.getVaryingFromNode(this,this.name),t.needsInterpolation=!0;else if(t=e.getVarFromNode(this,this.name),this.placeholderNode!==null&&e.hasWriteUsage(this)===!1){let n=this.placeholderNode.build(e,this.getNodeType(e));e.addLineFlowCode(`${e.getPropertyName(t)} = ${n}`,this)}return e.getPropertyName(t)}},ep=(i,e,t=null)=>new gi(i,e,!1,t),h1=(i,e,t=null)=>new gi(i,e,!0,t),Bi=xt(gi,"vec4","DiffuseColor"),Vg=xt(gi,"vec3","DiffuseContribution"),MU=xt(gi,"vec3","EmissiveColor"),gf=xt(gi,"float","Roughness"),Zd=xt(gi,"float","Metalness"),s4=xt(gi,"float","Clearcoat"),ax=xt(gi,"float","ClearcoatRoughness"),cc=xt(gi,"vec3","Sheen"),lm=xt(gi,"float","SheenRoughness"),xI=xt(gi,"float","Iridescence"),o4=xt(gi,"float","IridescenceIOR"),a4=xt(gi,"float","IridescenceThickness"),l4=xt(gi,"float","AlphaT"),am=xt(gi,"float","Anisotropy"),aS=xt(gi,"vec3","AnisotropyT"),$g=xt(gi,"vec3","AnisotropyB"),vm=xt(gi,"color","SpecularColor"),qg=xt(gi,"color","SpecularColorBlended"),Hg=xt(gi,"float","SpecularF90"),c4=xt(gi,"float","Shininess"),lx=xt(gi,"output","Output"),Yg=xt(gi,"float","dashSize"),AS=xt(gi,"float","gapSize"),QTe=xt(gi,"float","pointWidth"),lS=xt(gi,"float","IOR"),u4=xt(gi,"float","Transmission"),mz=xt(gi,"float","Thickness"),Az=xt(gi,"float","AttenuationDistance"),gz=xt(gi,"color","AttenuationColor"),vz=xt(gi,"float","Dispersion"),CU=xt(gi,"float","AmbientOcclusion",!1,1),h4=class extends Kt{static get type(){return"UniformGroupNode"}constructor(e,t=!1,n=1,r=null){super("string"),this.name=e,this.shared=t,this.order=n,this.updateType=r,this.isUniformGroup=!0}update(){this.needsUpdate=!0}serialize(e){super.serialize(e),e.name=this.name,e.version=this.version,e.shared=this.shared}deserialize(e){super.deserialize(e),this.name=e.name,this.version=e.version,this.shared=e.shared}},Ane=(i,e=1,t=null)=>new h4(i,!1,e,t),yI=(i,e=0,t=null)=>new h4(i,!0,e,t),JTe=yI("frame",0,yn.FRAME),Jt=yI("render",0,yn.RENDER),gne=Ane("object",1,yn.OBJECT),e1=class extends pS{static get type(){return"UniformNode"}constructor(e,t=null){super(e,t),this.isUniformNode=!0,this.name="",this.groupNode=gne}setName(e){return this.name=e,this}label(e){return Xe('TSL: "label()" has been deprecated. Use "setName()" instead.',new es),this.setName(e)}setGroup(e){return this.groupNode=e,this}getGroup(){return this.groupNode}getUniformHash(e){return this.getHash(e)}onUpdate(e,t){return e=e.bind(this),super.onUpdate(n=>{let r=e(n,this);r!==void 0&&(this.value=r)},t)}getInputType(e){let t=super.getInputType(e);return t==="bool"&&(t="uint"),t}generate(e,t){let n=this.getNodeType(e),r=this.getUniformHash(e),s=e.getNodeFromHash(r);s===void 0&&(e.setHashNode(this,r),s=this);let o=s.getInputType(e),a=e.getUniformFromNode(s,o,e.shaderStage,this.name||e.context.nodeName),l=e.getPropertyName(a);e.context.nodeName!==void 0&&delete e.context.nodeName;let c=l;if(n==="bool"){let u=e.getDataFromNode(this),f=u.propertyName;if(f===void 0){let d=e.getVarFromNode(this,null,"bool");f=e.getPropertyName(d),u.propertyName=f,c=e.format(l,o,n),e.addLineFlowCode(`${f} = ${c}`,this)}c=f}return e.format(c,n,t)}},Xt=(i,e)=>{let t=une(e||i);if(t===i&&(i=rz(t)),i&&i.isNode===!0){let n=i.value;i.traverse(r=>{r.isConstNode===!0&&(n=r.value)}),i=n}return new e1(i,t)},f4=class extends Rr{static get type(){return"ArrayNode"}constructor(e,t,n=null){super(e),this.count=t,this.values=n,this.isArrayNode=!0}getArrayCount(){return this.count}generateNodeType(e){return this.nodeType===null?this.values[0].getNodeType(e):this.nodeType}getElementType(e){return this.getNodeType(e)}getMemberType(e,t){return this.nodeType===null?this.values[0].getMemberType(e,t):super.getMemberType(e,t)}generate(e){let t=this.getNodeType(e);return e.generateArray(t,this.count,this.values)}},vne=(...i)=>{let e;if(i.length===1){let t=i[0];e=new f4(null,t.length,t)}else{let t=i[0],n=i[1];e=new f4(t,n)}return Ht(e)};Ue("toArray",(i,e)=>vne(Array(e).fill(i)));var RU=class extends Rr{static get type(){return"AssignNode"}constructor(e,t){super(),this.targetNode=e,this.sourceNode=t,this.isAssignNode=!0}hasDependencies(){return!1}generateNodeType(e,t){return t!=="void"?this.targetNode.getNodeType(e):"void"}needsSplitAssign(e){let{targetNode:t}=this;if(e.isAvailable("swizzleAssign")===!1&&t.isSplitNode&&t.components.length>1){let n=e.getTypeLength(t.node.getNodeType(e));return c1.join("").slice(0,n)!==t.components}return!1}setup(e){let{targetNode:t,sourceNode:n}=this,r=t.getScope(),s=e.getDataFromNode(r);s.assign=!0;let o=e.getNodeProperties(this);o.sourceNode=n,o.targetNode=t.context({assign:!0})}generate(e,t){let{targetNode:n,sourceNode:r}=e.getNodeProperties(this),s=this.needsSplitAssign(e),o=n.build(e),a=n.getNodeType(e),l=r.build(e,a),c=r.getNodeType(e),u=e.getDataFromNode(this),f;if(u.initialized===!0)t!=="void"&&(f=o);else if(s){let d=e.getVarFromNode(this,null,a),A=e.getPropertyName(d);e.addLineFlowCode(`${A} = ${l}`,this);let y=n.node,S=y.node.context({assign:!0}).build(e);for(let T=0;T<y.components.length;T++){let R=y.components[T];e.addLineFlowCode(`${S}.${R} = ${A}[ ${T} ]`,this)}t!=="void"&&(f=o)}else f=`${o} = ${l}`,(t==="void"||c==="void")&&(e.addLineFlowCode(f,this),t!=="void"&&(f=o));return u.initialized=!0,e.format(f,a,t)}},_ne=$n(RU).setParameterLength(2);Ue("assign",_ne);var IU=class extends Rr{static get type(){return"FunctionCallNode"}constructor(e=null,t={}){super(),this.functionNode=e,this.parameters=t}setParameters(e){return this.parameters=e,this}getParameters(){return this.parameters}generateNodeType(e){return this.functionNode.getNodeType(e)}getMemberType(e,t){return this.functionNode.getMemberType(e,t)}generate(e){let t=[],n=this.functionNode,r=n.getInputs(e),s=this.parameters,o=(l,c)=>{let u=c.type,f=u==="pointer",d;return f?d="&"+l.build(e):d=l.build(e,u),d};if(Array.isArray(s)){if(s.length>r.length)ze("TSL: The number of provided parameters exceeds the expected number of inputs in 'Fn()'."),s.length=r.length;else if(s.length<r.length)for(ze("TSL: The number of provided parameters is less than the expected number of inputs in 'Fn()'.");s.length<r.length;)s.push(oe(0));for(let l=0;l<s.length;l++)t.push(o(s[l],r[l]))}else for(let l of r){let c=s[l.name];c!==void 0?t.push(o(c,l)):(ze(`TSL: Input '${l.name}' not found in 'Fn()'.`),t.push(o(oe(0),l)))}return`${n.build(e,"property")}( ${t.join(", ")} )`}},xne=(i,...e)=>(e=e.length>1||e[0]&&e[0].isNode===!0?Xg(e):gI(e[0]),new IU(Ht(i),e));Ue("call",xne);var eEe={"==":"equal","!=":"notEqual","<":"lessThan",">":"greaterThan","<=":"lessThanEqual",">=":"greaterThanEqual","%":"mod"},ts=class i extends Rr{static get type(){return"OperatorNode"}constructor(e,t,n,...r){if(super(),r.length>0){let s=new i(e,t,n);for(let o=0;o<r.length-1;o++)s=new i(e,s,r[o]);t=s,n=r[r.length-1]}this.op=e,this.aNode=t,this.bNode=n,this.isOperatorNode=!0}getOperatorMethod(e,t){return e.getMethod(eEe[this.op],t)}generateNodeType(e,t=null){let n=this.op,r=this.aNode,s=this.bNode,o=r.getNodeType(e),a=s?s.getNodeType(e):null;if(o==="void"||a==="void")return t||"void";if(n==="%")return o;if(n==="~"||n==="&"||n==="|"||n==="^"||n===">>"||n==="<<")return e.getIntegerType(o);if(n==="&&"||n==="||"||n==="^^")return"bool";if(n==="!"){let l=e.getTypeLength(o);return l>1?`bvec${l}`:"bool"}else if(n==="=="||n==="!="||n==="<"||n===">"||n==="<="||n===">="){let l=Math.max(e.getTypeLength(o),e.getTypeLength(a));return l>1?`bvec${l}`:"bool"}else{if(e.isMatrix(o)){if(a==="float")return o;if(e.isVector(a))return e.getVectorFromMatrix(o);if(e.isMatrix(a))return o}else if(e.isMatrix(a)){if(o==="float")return a;if(e.isVector(o))return e.getVectorFromMatrix(a)}return e.getTypeLength(a)>e.getTypeLength(o)?a:o}}generate(e,t){let n=this.op,{aNode:r,bNode:s}=this,o=this.getNodeType(e,t),a=null,l=null;o!=="void"?(a=r.getNodeType(e),l=s?s.getNodeType(e):null,n==="<"||n===">"||n==="<="||n===">="||n==="=="||n==="!="?e.isVector(a)?l=a:e.isVector(l)?a=l:a!==l&&(a=l="float"):n===">>"||n==="<<"?(a=o,l=e.changeComponentType(l,"uint")):n==="%"?(a=o,l=e.isInteger(a)&&e.isInteger(l)?l:a):e.isMatrix(a)?l==="float"?l="float":e.isVector(l)?l=e.getVectorFromMatrix(a):e.isMatrix(l)||(a=l=o):e.isMatrix(l)?a==="float"?a="float":e.isVector(a)?a=e.getVectorFromMatrix(l):a=l=o:a=l=o):a=l=o;let c=r.build(e,a),u=s?s.build(e,l):null,f=e.getFunctionOperator(n);if(t!=="void"){let d=e.renderer.coordinateSystem===Uo;if(n==="=="||n==="!="||n==="<"||n===">"||n==="<="||n===">=")return d?e.isVector(a)?e.format(`${this.getOperatorMethod(e,t)}( ${c}, ${u} )`,o,t):e.format(`( ${c} ${n} ${u} )`,o,t):e.format(`( ${c} ${n} ${u} )`,o,t);if(n==="%")return e.isInteger(l)?e.format(`( ${c} % ${u} )`,o,t):e.format(`${this.getOperatorMethod(e,o)}( ${c}, ${u} )`,o,t);if(n==="!")return d&&e.isVector(a)?e.format(`not( ${c} )`,t):e.format(`( ${n} ${c} )`,a,t);if(n==="~")return e.format(`( ${n} ${c} )`,a,t);if(f)return e.format(`${f}( ${c}, ${u} )`,o,t);if(e.isMatrix(a)&&l==="float")return e.format(`( ${u} ${n} ${c} )`,o,t);if(a==="float"&&e.isMatrix(l))return e.format(`${c} ${n} ${u}`,o,t);{let A=`( ${c} ${n} ${u} )`;return!d&&o==="bool"&&e.isVector(a)&&e.isVector(l)&&(A=`all${A}`),e.format(A,o,t)}}else if(a!=="void")return f?e.format(`${f}( ${c}, ${u} )`,o,t):e.isMatrix(a)&&l==="float"?e.format(`${u} ${n} ${c}`,o,t):e.format(`${c} ${n} ${u}`,o,t)}serialize(e){super.serialize(e),e.op=this.op}deserialize(e){super.deserialize(e),this.op=e.op}},Ls=ct(ts,"+").setParameterLength(2,1/0).setName("add"),ai=ct(ts,"-").setParameterLength(2,1/0).setName("sub"),Tn=ct(ts,"*").setParameterLength(2,1/0).setName("mul"),pc=ct(ts,"/").setParameterLength(2,1/0).setName("div"),bI=ct(ts,"%").setParameterLength(2).setName("mod"),yne=ct(ts,"==").setParameterLength(2).setName("equal"),bne=ct(ts,"!=").setParameterLength(2).setName("notEqual"),wne=ct(ts,"<").setParameterLength(2).setName("lessThan"),_z=ct(ts,">").setParameterLength(2).setName("greaterThan"),Sne=ct(ts,"<=").setParameterLength(2).setName("lessThanEqual"),Tne=ct(ts,">=").setParameterLength(2).setName("greaterThanEqual"),Ene=ct(ts,"&&").setParameterLength(2,1/0).setName("and"),Mne=ct(ts,"||").setParameterLength(2,1/0).setName("or"),Cne=ct(ts,"!").setParameterLength(1).setName("not"),Rne=ct(ts,"^^").setParameterLength(2).setName("xor"),Ine=ct(ts,"&").setParameterLength(2).setName("bitAnd"),Pne=ct(ts,"~").setParameterLength(1).setName("bitNot"),Lne=ct(ts,"|").setParameterLength(2).setName("bitOr"),Dne=ct(ts,"^").setParameterLength(2).setName("bitXor"),Nne=ct(ts,"<<").setParameterLength(2).setName("shiftLeft"),Fne=ct(ts,">>").setParameterLength(2).setName("shiftRight"),Bne=me(([i])=>(i.addAssign(1),i)),One=me(([i])=>(i.subAssign(1),i)),Une=me(([i])=>{let e=de(i).toConst();return i.addAssign(1),e}),kne=me(([i])=>{let e=de(i).toConst();return i.subAssign(1),e});Ue("add",Ls);Ue("sub",ai);Ue("mul",Tn);Ue("div",pc);Ue("mod",bI);Ue("equal",yne);Ue("notEqual",bne);Ue("lessThan",wne);Ue("greaterThan",_z);Ue("lessThanEqual",Sne);Ue("greaterThanEqual",Tne);Ue("and",Ene);Ue("or",Mne);Ue("not",Cne);Ue("xor",Rne);Ue("bitAnd",Ine);Ue("bitNot",Pne);Ue("bitOr",Lne);Ue("bitXor",Dne);Ue("shiftLeft",Nne);Ue("shiftRight",Fne);Ue("incrementBefore",Bne);Ue("decrementBefore",One);Ue("increment",Une);Ue("decrement",kne);var Ie=class i extends Rr{static get type(){return"MathNode"}constructor(e,t,n=null,r=null){if(super(),(e===i.MAX||e===i.MIN)&&arguments.length>3){let s=new i(e,t,n);for(let o=3;o<arguments.length-1;o++)s=new i(e,s,arguments[o]);t=s,n=arguments[arguments.length-1],r=null}this.method=e,this.aNode=t,this.bNode=n,this.cNode=r,this.isMathNode=!0}getInputType(e){let t=this.aNode.getNodeType(e),n=this.bNode?this.bNode.getNodeType(e):null,r=this.cNode?this.cNode.getNodeType(e):null,s=e.isMatrix(t)?0:e.getTypeLength(t),o=e.isMatrix(n)?0:e.getTypeLength(n),a=e.isMatrix(r)?0:e.getTypeLength(r);return s>o&&s>a?t:o>a?n:a>s?r:t}generateNodeType(e){let t=this.method;return t===i.LENGTH||t===i.DISTANCE||t===i.DOT?"float":t===i.CROSS?"vec3":t===i.ALL||t===i.ANY?"bool":t===i.EQUALS?e.changeComponentType(this.aNode.getNodeType(e),"bool"):this.getInputType(e)}setup(e){let{aNode:t,bNode:n,method:r}=this,s=null;if(r===i.ONE_MINUS)s=ai(1,t);else if(r===i.RECIPROCAL)s=pc(1,t);else if(r===i.DIFFERENCE)s=fr(ai(t,n));else if(r===i.TRANSFORM_DIRECTION){let o,a;e.isMatrix(t.getNodeType(e))?(o=t,a=n):(o=n,a=t),s=xa(Tn(o,Ft(pe(a),0)).xyz)}return s!==null?s:super.setup(e)}generate(e,t){if(e.getNodeProperties(this).outputNode)return super.generate(e,t);let r=this.method,s=this.getNodeType(e),o=this.getInputType(e),a=this.aNode,l=this.bNode,c=this.cNode,u=e.renderer.coordinateSystem;if(r===i.NEGATE)return e.format("( - "+a.build(e,o)+" )",s,t);{let f=[];return r===i.CROSS?f.push(a.build(e,s),l.build(e,s)):u===Uo&&r===i.STEP?f.push(a.build(e,e.getTypeLength(a.getNodeType(e))===1?"float":o),l.build(e,o)):u===Uo&&(r===i.MIN||r===i.MAX)?f.push(a.build(e,o),l.build(e,e.getTypeLength(l.getNodeType(e))===1?"float":o)):r===i.REFRACT?f.push(a.build(e,o),l.build(e,o),c.build(e,"float")):r===i.MIX?f.push(a.build(e,o),l.build(e,o),c.build(e,e.getTypeLength(c.getNodeType(e))===1?"float":o)):(u===xl&&r===i.ATAN&&l!==null&&(r="atan2"),e.shaderStage!=="fragment"&&(r===i.DFDX||r===i.DFDY)&&(Xe(`TSL: '${r}' is not supported in the ${e.shaderStage} stage.`,this.stackTrace),r="/*"+r+"*/"),f.push(a.build(e,o)),l!==null&&f.push(l.build(e,o)),c!==null&&f.push(c.build(e,o))),e.format(`${e.getMethod(r,s)}( ${f.join(", ")} )`,s,t)}}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}};Ie.ALL="all";Ie.ANY="any";Ie.RADIANS="radians";Ie.DEGREES="degrees";Ie.EXP="exp";Ie.EXP2="exp2";Ie.LOG="log";Ie.LOG2="log2";Ie.SQRT="sqrt";Ie.INVERSE_SQRT="inversesqrt";Ie.FLOOR="floor";Ie.CEIL="ceil";Ie.NORMALIZE="normalize";Ie.FRACT="fract";Ie.SIN="sin";Ie.SINH="sinh";Ie.COS="cos";Ie.COSH="cosh";Ie.TAN="tan";Ie.TANH="tanh";Ie.ASIN="asin";Ie.ASINH="asinh";Ie.ACOS="acos";Ie.ACOSH="acosh";Ie.ATAN="atan";Ie.ATANH="atanh";Ie.ABS="abs";Ie.SIGN="sign";Ie.LENGTH="length";Ie.NEGATE="negate";Ie.ONE_MINUS="oneMinus";Ie.DFDX="dFdx";Ie.DFDY="dFdy";Ie.ROUND="round";Ie.RECIPROCAL="reciprocal";Ie.TRUNC="trunc";Ie.FWIDTH="fwidth";Ie.TRANSPOSE="transpose";Ie.DETERMINANT="determinant";Ie.INVERSE="inverse";Ie.EQUALS="equals";Ie.MIN="min";Ie.MAX="max";Ie.STEP="step";Ie.REFLECT="reflect";Ie.DISTANCE="distance";Ie.DIFFERENCE="difference";Ie.DOT="dot";Ie.CROSS="cross";Ie.POW="pow";Ie.TRANSFORM_DIRECTION="transformDirection";Ie.MIX="mix";Ie.CLAMP="clamp";Ie.REFRACT="refract";Ie.SMOOTHSTEP="smoothstep";Ie.FACEFORWARD="faceforward";var wI=oe(1e-6),tEe=oe(1e6),d4=oe(Math.PI),nEe=oe(Math.PI*2),iEe=oe(Math.PI*2),rEe=oe(Math.PI*.5),zne=ct(Ie,Ie.ALL).setParameterLength(1),Vne=ct(Ie,Ie.ANY).setParameterLength(1),Gne=ct(Ie,Ie.RADIANS).setParameterLength(1),qne=ct(Ie,Ie.DEGREES).setParameterLength(1),xz=ct(Ie,Ie.EXP).setParameterLength(1),px=ct(Ie,Ie.EXP2).setParameterLength(1),SI=ct(Ie,Ie.LOG).setParameterLength(1),_f=ct(Ie,Ie.LOG2).setParameterLength(1),el=ct(Ie,Ie.SQRT).setParameterLength(1),yz=ct(Ie,Ie.INVERSE_SQRT).setParameterLength(1),xf=ct(Ie,Ie.FLOOR).setParameterLength(1),TI=ct(Ie,Ie.CEIL).setParameterLength(1),xa=ct(Ie,Ie.NORMALIZE).setParameterLength(1),Zu=ct(Ie,Ie.FRACT).setParameterLength(1),Ka=ct(Ie,Ie.SIN).setParameterLength(1),Hne=ct(Ie,Ie.SINH).setParameterLength(1),ju=ct(Ie,Ie.COS).setParameterLength(1),Wne=ct(Ie,Ie.COSH).setParameterLength(1),jne=ct(Ie,Ie.TAN).setParameterLength(1),Xne=ct(Ie,Ie.TANH).setParameterLength(1),$ne=ct(Ie,Ie.ASIN).setParameterLength(1),Yne=ct(Ie,Ie.ASINH).setParameterLength(1),bz=ct(Ie,Ie.ACOS).setParameterLength(1),Zne=ct(Ie,Ie.ACOSH).setParameterLength(1),wz=ct(Ie,Ie.ATAN).setParameterLength(1,2),Kne=ct(Ie,Ie.ATANH).setParameterLength(1),fr=ct(Ie,Ie.ABS).setParameterLength(1),Sz=ct(Ie,Ie.SIGN).setParameterLength(1),yf=ct(Ie,Ie.LENGTH).setParameterLength(1),Tz=ct(Ie,Ie.NEGATE).setParameterLength(1),Qne=ct(Ie,Ie.ONE_MINUS).setParameterLength(1),Ez=ct(Ie,Ie.DFDX).setParameterLength(1),Mz=ct(Ie,Ie.DFDY).setParameterLength(1),Jne=ct(Ie,Ie.ROUND).setParameterLength(1),eie=ct(Ie,Ie.RECIPROCAL).setParameterLength(1),Cz=ct(Ie,Ie.TRUNC).setParameterLength(1),Rz=ct(Ie,Ie.FWIDTH).setParameterLength(1),tie=ct(Ie,Ie.TRANSPOSE).setParameterLength(1),nie=ct(Ie,Ie.DETERMINANT).setParameterLength(1),iie=ct(Ie,Ie.INVERSE).setParameterLength(1),Il=ct(Ie,Ie.MIN).setParameterLength(2,1/0),zr=ct(Ie,Ie.MAX).setParameterLength(2,1/0),t1=ct(Ie,Ie.STEP).setParameterLength(2),rie=ct(Ie,Ie.REFLECT).setParameterLength(2),sie=ct(Ie,Ie.DISTANCE).setParameterLength(2),oie=ct(Ie,Ie.DIFFERENCE).setParameterLength(2),au=ct(Ie,Ie.DOT).setParameterLength(2),Qd=ct(Ie,Ie.CROSS).setParameterLength(2),iu=ct(Ie,Ie.POW).setParameterLength(2),Iz=i=>Tn(i,i),aie=i=>Tn(i,i,i),Pz=i=>Tn(i,i,i,i),lie=ct(Ie,Ie.TRANSFORM_DIRECTION).setParameterLength(2),cie=(i,e)=>xa(Tn(e,Ft(pe(i),0)).xyz),uie=(i,e)=>xa(Ft(pe(i),0).mul(e).xyz),hie=i=>Tn(Sz(i),iu(fr(i),1/3)),Lz=i=>au(i,i),Qn=ct(Ie,Ie.MIX).setParameterLength(3),Ku=(i,e=0,t=1)=>new Ie(Ie.CLAMP,Ht(i),Ht(e),Ht(t)),EI=i=>Ku(i),Dz=ct(Ie,Ie.REFRACT).setParameterLength(3),mc=ct(Ie,Ie.SMOOTHSTEP).setParameterLength(3),Nz=ct(Ie,Ie.FACEFORWARD).setParameterLength(3),fie=me(([i])=>{let n=43758.5453,r=au(i.xy,dt(12.9898,78.233)),s=bI(r,d4);return Zu(Ka(s).mul(n))}),die=(i,e,t)=>Qn(e,t,i),pie=(i,e,t)=>mc(e,t,i),mie=(i,e)=>t1(e,i),sEe=Nz,oEe=yz;Ue("all",zne);Ue("any",Vne);Ue("radians",Gne);Ue("degrees",qne);Ue("exp",xz);Ue("exp2",px);Ue("log",SI);Ue("log2",_f);Ue("sqrt",el);Ue("inverseSqrt",yz);Ue("floor",xf);Ue("ceil",TI);Ue("normalize",xa);Ue("fract",Zu);Ue("sin",Ka);Ue("sinh",Hne);Ue("cos",ju);Ue("cosh",Wne);Ue("tan",jne);Ue("tanh",Xne);Ue("asin",$ne);Ue("asinh",Yne);Ue("acos",bz);Ue("acosh",Zne);Ue("atan",wz);Ue("atanh",Kne);Ue("abs",fr);Ue("sign",Sz);Ue("length",yf);Ue("lengthSq",Lz);Ue("negate",Tz);Ue("oneMinus",Qne);Ue("dFdx",Ez);Ue("dFdy",Mz);Ue("round",Jne);Ue("reciprocal",eie);Ue("trunc",Cz);Ue("fwidth",Rz);Ue("min",Il);Ue("max",zr);Ue("step",mie);Ue("reflect",rie);Ue("distance",sie);Ue("dot",au);Ue("cross",Qd);Ue("pow",iu);Ue("pow2",Iz);Ue("pow3",aie);Ue("pow4",Pz);Ue("transformDirection",lie);Ue("transformNormalByViewMatrix",cie);Ue("transformNormalByInverseViewMatrix",uie);Ue("mix",die);Ue("clamp",Ku);Ue("refract",Dz);Ue("smoothstep",pie);Ue("faceForward",Nz);Ue("difference",oie);Ue("saturate",EI);Ue("cbrt",hie);Ue("transpose",tie);Ue("determinant",nie);Ue("inverse",iie);Ue("rand",fie);var PU=class extends Kt{static get type(){return"ConditionalNode"}constructor(e,t,n=null){super(),this.condNode=e,this.ifNode=t,this.elseNode=n}generateNodeType(e){let{ifNode:t,elseNode:n}=e.getNodeProperties(this);if(t===void 0)return e.flowBuildStage(this,"setup"),this.getNodeType(e);let r=t.getNodeType(e);if(n!==null){let s=n.getNodeType(e);if(e.getTypeLength(s)>e.getTypeLength(r))return s}return r}setup(e){let t=this.condNode,n=this.ifNode.isolate(),r=this.elseNode?this.elseNode.isolate():null,s=e.context.nodeBlock;e.getDataFromNode(n).parentNodeBlock=s,r!==null&&(e.getDataFromNode(r).parentNodeBlock=s);let o=e.context.uniformFlow,a=e.getNodeProperties(this);a.condNode=t,a.ifNode=o?n:n.context({nodeBlock:n}),a.elseNode=r?o?r:r.context({nodeBlock:r}):null}generate(e,t){let n=this.getNodeType(e),r=e.getDataFromNode(this);if(r.nodeProperty!==void 0)return r.nodeProperty;let{condNode:s,ifNode:o,elseNode:a}=e.getNodeProperties(this),l=e.currentFunctionNode,c=t!=="void",u=c?ep(n).build(e):"";r.nodeProperty=u;let f=s.build(e,"bool");if(e.context.uniformFlow&&a!==null){let y=o.build(e,n),w=a.build(e,n),S=e.getTernary(f,y,w);return e.format(S,n,t)}e.addFlowCode(`41344134 ${e.tab}if ( ${f} ) {41354135 41364136 `).addFlowTab();let A=o.build(e,n);if(A&&(c?A=u+" = "+A+";":(A="return "+A+";",l===null&&(Xe("TSL: Return statement used in an inline 'Fn()'. Define a layout struct to allow return values.",this.stackTrace),A="// "+A))),e.removeFlowTab().addFlowCode(e.tab+" "+A+`@@ -4143,30 +4143,30 @@ ${e.tab}if ( ${f} ) {
41434143 41444144 `)}else e.addFlowCode(`41454145 4146-`);return e.format(u,n,t)}},_a=$n(wU).setParameterLength(2,3);Ue("select",_a);var dS=class extends Kt{static get type(){return"ContextNode"}constructor(e=null,t={}){super(),this.isContextNode=!0,this.node=e,this.value=t}getScope(){return this.node.getScope()}generateNodeType(e){return this.node.getNodeType(e)}getFlowContextData(){let e=[];return this.traverse(t=>{t.isContextNode===!0&&e.push(t.value)}),Object.assign({},...e)}getMemberType(e,t){return this.node.getMemberType(e,t)}analyze(e){let t=e.addContext(this.value);this.node.build(e),e.setContext(t)}setup(e){let t=e.addContext(this.value);this.node.build(e),e.setContext(t)}generate(e,t){let n=e.addContext(this.value),r=this.node.build(e,t);return e.setContext(n),r}},np=(i=null,e={})=>{let t=i;return(t===null||t.isNode!==!0)&&(e=t||e,t=null),new dS(t,e)},aie=i=>np(i,{uniformFlow:!0}),Mz=(i,e)=>np(i,{nodeName:e});function lie(i,e,t=null){return np(t,{getShadow:({light:n,shadowColorNode:r})=>e===n?r.mul(i):r})}function cie(i,e=null){return np(e,{getAO:(t,{material:n})=>n.transparent===!0?t:t!==null?t.mul(i):i})}function uie(i,e){return Xe('TSL: "label()" has been deprecated. Use "setName()" instead.'),Mz(i,e)}Ue("context",np);Ue("label",uie);Ue("uniformFlow",aie);Ue("setName",Mz);Ue("builtinShadowContext",(i,e,t)=>lie(e,t,i));Ue("builtinAOContext",(i,e)=>cie(e,i));var ax=class extends Kt{static get type(){return"VarNode"}constructor(e,t=null,n=!1){super(),this.node=e,this.name=t,this.global=!0,this.isVarNode=!0,this.readOnly=n,this.parents=!0,this.intent=!1}setIntent(e){return this.intent=e,this}isIntent(e){return e.getDataFromNode(this).forceDeclaration===!0?!1:this.intent}getIntent(){return this.intent}getMemberType(e,t){return this.node.getMemberType(e,t)}getElementType(e){return this.node.getElementType(e)}generateNodeType(e){return this.node.getNodeType(e)}getArrayCount(e){return this.node.getArrayCount(e)}isAssign(e){return e.getDataFromNode(this).assign}build(...e){let t=e[0],n=this.getShared(t);if(this!==n)return n.build(...e);if(this._hasStack(t)===!1&&t.buildStage==="setup"&&(t.context.nodeLoop||t.context.nodeBlock)){let r=!1;if(this.node.isShaderCallNodeInternal&&this.node.shaderNode.getLayout()===null&&t.fnCall&&t.fnCall.shaderNode&&t.getDataFromNode(this.node.shaderNode).hasLoop){let a=t.getDataFromNode(this);a.forceDeclaration=!0,r=!0}let s=t.getBaseStack();r?s.addToStackBefore(this):s.addToStack(this)}return this.isIntent(t)&&this.isAssign(t)!==!0?this.node.build(...e):super.build(...e)}generate(e){let{node:t,name:n,readOnly:r}=this,{renderer:s}=e,o=s.backend.isWebGPUBackend===!0,a=!1,l=!1;r&&(a=e.isDeterministic(t),l=o?r:a);let c=this.getNodeType(e);if(c=="void")return this.isIntent(e)!==!0&&ze('TSL: ".toVar()" can not be used with void type.',this.stackTrace),t.build(e);let u=e.getVectorType(c),f=t.build(e,u),d=e.getVarFromNode(this,n,u,void 0,l),A=e.getPropertyName(d),y=A;if(l)if(o)y=a?`const ${A}`:`let ${A}`;else{let w=t.getArrayCount(e);y=`const ${e.getVar(d.type,A,w)}`}return e.addLineFlowCode(`${y} = ${f}`,this),A}_hasStack(e){return e.getDataFromNode(this).stack!==void 0}},Cz=$n(ax),hie=(i,e=null)=>Cz(i,e).toStack(),fie=(i,e=null)=>Cz(i,e,!0).toStack(),die=i=>Cz(i).setIntent(!0).toStack();Ue("toVar",hie);Ue("toConst",fie);Ue("toVarIntent",die);var SU=class extends Kt{static get type(){return"SubBuild"}constructor(e,t,n=null){super(n),this.node=e,this.name=t,this.isSubBuildNode=!0}generateNodeType(e){if(this.nodeType!==null)return this.nodeType;e.addSubBuild(this.name);let t=this.node.getNodeType(e);return e.removeSubBuild(),t}build(e,...t){e.addSubBuild(this.name);let n=this.node.build(e,...t);return e.removeSubBuild(),n}},Zg=(i,e,t=null)=>new SU(Ht(i),e,t),TU=class extends Kt{static get type(){return"VaryingNode"}constructor(e,t=null){super(),this.node=Zg(e,"VERTEX"),this.name=t,this.isVaryingNode=!0,this.interpolationType=null,this.interpolationSampling=null,this.global=!0}setInterpolation(e,t=null){return this.interpolationType=e,this.interpolationSampling=t,this}getHash(e){return this.name||super.getHash(e)}generateNodeType(e){return this.node.getNodeType(e)}setupVarying(e){let t=e.getNodeProperties(this),n=t.varying;if(n===void 0){let r=this.name,s=this.getNodeType(e),o=this.interpolationType,a=this.interpolationSampling;t.varying=n=e.getVaryingFromNode(this,r,s,o,a),t.node=Zg(this.node,"VERTEX")}return n.needsInterpolation||(n.needsInterpolation=e.shaderStage==="fragment"),n}setup(e){this.setupVarying(e),e.flowNodeFromShaderStage(ex.VERTEX,this.node)}analyze(e){this.setupVarying(e),e.flowNodeFromShaderStage(ex.VERTEX,this.node)}generate(e){let t=e.getSubBuildProperty("property",e.currentStack),n=e.getNodeProperties(this),r=this.setupVarying(e);if(n[t]===void 0){let s=this.getNodeType(e),o=e.getPropertyName(r,ex.VERTEX);if(e.shaderStage===ex.VERTEX){let a=n.node.build(e,s);e.addLineFlowCode(`${o} = ${a}`,this)}else e.flowNodeFromShaderStage(ex.VERTEX,n.node,s,o);n[t]=o}return e.getPropertyName(r)}},bm=$n(TU).setParameterLength(1,2),pie=i=>bm(i);Ue("toVarying",bm);Ue("toVertexStage",pie);var mie=me(([i])=>{let e=i.mul(.9478672986).add(.0521327014).pow(2.4),t=i.mul(.0773993808),n=i.lessThanEqual(.04045);return Qn(e,t,n)}).setLayout({name:"sRGBTransferEOTF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),Aie=me(([i])=>{let e=i.pow(.41666).mul(1.055).sub(.055),t=i.mul(12.92),n=i.lessThanEqual(.0031308);return Qn(e,t,n)}).setLayout({name:"sRGBTransferOETF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),Rz="WorkingColorSpace",VTe="OutputColorSpace",pS=class extends Rr{static get type(){return"ColorSpaceNode"}constructor(e,t,n){super("vec4"),this.colorNode=e,this.source=t,this.target=n}resolveColorSpace(e,t){return t===Rz?ln.workingColorSpace:t===VTe?e.context.outputColorSpace||e.renderer.outputColorSpace:t}setup(e){let{colorNode:t}=this,n=this.resolveColorSpace(e,this.source),r=this.resolveColorSpace(e,this.target),s=t;return ln.enabled===!1||n===r||!n||!r||(ln.getTransfer(n)===kt&&(s=Ft(mie(s.rgb),s.a)),ln.getPrimaries(n)!==ln.getPrimaries(r)&&(s=Ft(To(ln._getMatrix(new Mn,n,r)).mul(s.rgb),s.a)),ln.getTransfer(r)===kt&&(s=Ft(Aie(s.rgb),s.a))),s}},gie=(i,e)=>new pS(Ht(i),Rz,e),wI=(i,e)=>new pS(Ht(i),e,Rz),GTe=(i,e,t)=>new pS(Ht(i),e,t);Ue("workingToColorSpace",gie);Ue("colorSpaceToWorking",wI);var qTe=class extends Qd{static get type(){return"ReferenceElementNode"}constructor(e,t){super(e,t),this.referenceNode=e,this.isReferenceElementNode=!0}generateNodeType(){return this.referenceNode.uniformType}generate(e){let t=super.generate(e),n=this.referenceNode.getNodeType(),r=this.getNodeType();return e.format(t,n,r)}},u4=class extends Kt{static get type(){return"ReferenceBaseNode"}constructor(e,t,n=null,r=null){super(),this.property=e,this.uniformType=t,this.object=n,this.count=r,this.properties=e.split("."),this.reference=n,this.node=null,this.group=null,this.updateType=yn.OBJECT}setGroup(e){return this.group=e,this}element(e){return new qTe(this,Ht(e))}setNodeType(e){let t=Xt(null,e);this.group!==null&&t.setGroup(this.group),this.node=t}generateNodeType(e){return this.node===null&&(this.updateReference(e),this.updateValue()),this.node.getNodeType(e)}getValueFromReference(e=this.reference){let{properties:t}=this,n=e[t[0]];for(let r=1;r<t.length;r++)n=n[t[r]];return n}updateReference(e){return this.reference=this.object!==null?this.object:e.object,this.reference}setup(){return this.updateValue(),this.node}update(){this.updateValue()}updateValue(){this.node===null&&this.setNodeType(this.uniformType);let e=this.getValueFromReference();Array.isArray(e)?this.node.array=e:this.node.value=e}},HTe=(i,e,t)=>new u4(i,e,t),EU=class extends u4{static get type(){return"RendererReferenceNode"}constructor(e,t,n=null){super(e,t,n),this.renderer=n,this.setGroup(Jt)}updateReference(e){return this.reference=this.renderer!==null?this.renderer:e.renderer,this.reference}},vie=(i,e,t=null)=>new EU(i,e,t),MU=class extends Rr{static get type(){return"ToneMappingNode"}constructor(e,t=xie,n=null){super("vec3"),this._toneMapping=e,this.exposureNode=t,this.colorNode=n}customCacheKey(){return tS(this._toneMapping)}setToneMapping(e){return this._toneMapping=e,this}getToneMapping(){return this._toneMapping}setup(e){let t=this.colorNode||e.context.color,n=this._toneMapping;if(n===ao)return t;let r=null,s=e.renderer.library.getToneMappingFunction(n);return s!==null?r=Ft(s(t.rgb,this.exposureNode),t.a):(ze("ToneMappingNode: Unsupported Tone Mapping configuration.",n),r=t),r}},_ie=(i,e,t)=>new MU(i,Ht(e),Ht(t)),xie=vie("toneMappingExposure","float");Ue("toneMapping",(i,e,t)=>_ie(e,t,i));var Iee=new WeakMap;function Pee(i,e){let t=Iee.get(i);return t===void 0&&(t=new Pd(i,e),Iee.set(i,t)),t}var mf=class extends uS{static get type(){return"BufferAttributeNode"}constructor(e,t=null,n=0,r=0){super(e,t),this.isBufferNode=!0,this.bufferType=t,this.bufferStride=n,this.bufferOffset=r,this.usage=r0,this.instanced=!1,this.attribute=null,this.global=!0,e&&e.isBufferAttribute===!0&&e.itemSize<=4&&(this.attribute=e,this.usage=e.usage,this.instanced=e.isInstancedBufferAttribute)}getHash(e){let t;if(this.bufferStride===0&&this.bufferOffset===0){let n=e.globalCache.getData(this.value);n===void 0&&(n={node:this},e.globalCache.setData(this.value,n)),t=n.node.id}else t=this.id;return String(t)}generateNodeType(e){return this.bufferType===null&&(this.bufferType=e.getTypeFromAttribute(this.attribute)),this.bufferType}setup(e){if(this.attribute!==null)return;let t=this.getNodeType(e),n=e.getTypeLength(t),r=this.value,s=this.bufferStride||n,o=this.bufferOffset,a;r.isInterleavedBuffer===!0?a=r:r.isBufferAttribute===!0?a=Pee(r.array,s):a=Pee(r,s);let l=new zo(a,n,o);a.setUsage(this.usage),this.attribute=l,this.attribute.isInstancedBufferAttribute=this.instanced}generate(e){let t=this.getNodeType(e),n=e.context.nodeName;n!==void 0&&delete e.context.nodeName;let r=e.getBufferAttributeFromNode(this,t,n),s=e.getPropertyName(r),o=null;if(e.shaderStage==="vertex"||e.shaderStage==="compute")this.name=s,o=s;else{let a;n&&(a=n+"Varying"),o=bm(this,a).build(e,t)}return o}getInputType(){return"bufferAttribute"}setUsage(e){return this.usage=e,this.attribute&&this.attribute.isBufferAttribute===!0&&(this.attribute.usage=e),this}setInstanced(e){return this.instanced=e,this}};function SI(i,e=null,t=0,n=0,r=r0,s=!1){return e==="mat3"||e===null&&i.itemSize===9?To(new mf(i,"vec3",9,0).setUsage(r).setInstanced(s),new mf(i,"vec3",9,3).setUsage(r).setInstanced(s),new mf(i,"vec3",9,6).setUsage(r).setInstanced(s)):e==="mat4"||e===null&&i.itemSize===16?mm(new mf(i,"vec4",16,0).setUsage(r).setInstanced(s),new mf(i,"vec4",16,4).setUsage(r).setInstanced(s),new mf(i,"vec4",16,8).setUsage(r).setInstanced(s),new mf(i,"vec4",16,12).setUsage(r).setInstanced(s)):new mf(i,e,t,n).setUsage(r)}var Iz=(i,e=null,t=0,n=0)=>SI(i,e,t,n),WTe=(i,e=null,t=0,n=0)=>SI(i,e,t,n,dg),TI=(i,e=null,t=0,n=0)=>SI(i,e,t,n,r0,!0),Pz=(i,e=null,t=0,n=0)=>SI(i,e,t,n,dg,!0);Ue("toAttribute",i=>Iz(i.value));var Ys=class i extends Kt{static get type(){return"IndexNode"}constructor(e){super("uint"),this.scope=e,this.isIndexNode=!0}generate(e){let t=this.getNodeType(e),n=this.scope,r;if(n===i.VERTEX)r=e.getVertexIndex();else if(n===i.INSTANCE)r=e.getInstanceIndex();else if(n===i.DRAW)r=e.getDrawIndex();else if(n===i.INVOCATION_LOCAL)r=e.getInvocationLocalIndex();else if(n===i.INVOCATION_SUBGROUP)r=e.getInvocationSubgroupIndex();else if(n===i.SUBGROUP)r=e.getSubgroupIndex();else throw new Error("THREE.IndexNode: Unknown scope: "+n);let s;return e.shaderStage==="vertex"||e.shaderStage==="compute"?s=r:s=bm(this).build(e,t),s}};Ys.VERTEX="vertex";Ys.INSTANCE="instance";Ys.SUBGROUP="subgroup";Ys.INVOCATION_LOCAL="invocationLocal";Ys.INVOCATION_SUBGROUP="invocationSubgroup";Ys.DRAW="draw";var yie=xt(Ys,Ys.VERTEX),Xu=xt(Ys,Ys.INSTANCE),jTe=xt(Ys,Ys.SUBGROUP),XTe=xt(Ys,Ys.INVOCATION_SUBGROUP),$Te=xt(Ys,Ys.INVOCATION_LOCAL),bie=xt(Ys,Ys.DRAW),CU=class extends Kt{static get type(){return"ComputeNode"}constructor(e,t){super("void"),this.isComputeNode=!0,this.computeNode=e,this.workgroupSize=t,this.count=null,this.dispatchSize=null,this.version=1,this.name="",this.updateBeforeType=yn.OBJECT,this.onInitFunction=null,this.countNode=null}dispose(){this.dispatchEvent({type:"dispose"})}setName(e){return this.name=e,this}label(e){return Xe('TSL: "label()" has been deprecated. Use "setName()" instead.',new es),this.setName(e)}onInit(e){return this.onInitFunction=e,this}updateBefore({renderer:e}){e.compute(this)}setup(e){this.count!==null&&this.countNode===null&&(this.countNode=Xt(this.count,"uint").onObjectUpdate(()=>this.count));let t=this.computeNode.build(e);if(t){let n=e.getNodeProperties(this);n.outputComputeNode=t.outputNode,t.outputNode=null}return t}generate(e,t){let{shaderStage:n}=e;if(n==="compute"){let r=this.computeNode.build(e,"void");if(r!==""&&e.addLineFlowCode(r,this),this.count!==null&&e.allowEarlyReturns===!0){let s=this.countNode.build(e,"uint"),o=Xu.build(e,"uint");e.flow.code=`${e.tab}if ( ${o} >= ${s} ) { return; }4146+`);return e.format(u,n,t)}},_a=$n(PU).setParameterLength(2,3);Ue("select",_a);var gS=class extends Kt{static get type(){return"ContextNode"}constructor(e=null,t={}){super(),this.isContextNode=!0,this.node=e,this.value=t}getScope(){return this.node.getScope()}generateNodeType(e){return this.node.getNodeType(e)}getFlowContextData(){let e=[];return this.traverse(t=>{t.isContextNode===!0&&e.push(t.value)}),Object.assign({},...e)}getMemberType(e,t){return this.node.getMemberType(e,t)}analyze(e){let t=e.addContext(this.value);this.node.build(e),e.setContext(t)}setup(e){let t=e.addContext(this.value);this.node.build(e),e.setContext(t)}generate(e,t){let n=e.addContext(this.value),r=this.node.build(e,t);return e.setContext(n),r}},tp=(i=null,e={})=>{let t=i;return(t===null||t.isNode!==!0)&&(e=t||e,t=null),new gS(t,e)},Aie=i=>tp(i,{uniformFlow:!0}),Fz=(i,e)=>tp(i,{nodeName:e});function gie(i,e,t=null){return tp(t,{getShadow:({light:n,shadowColorNode:r})=>e===n?r.mul(i):r})}function vie(i,e=null){return tp(e,{getAO:(t,{material:n})=>n.transparent===!0?t:t!==null?t.mul(i):i})}function _ie(i,e){return Xe('TSL: "label()" has been deprecated. Use "setName()" instead.'),Fz(i,e)}Ue("context",tp);Ue("label",_ie);Ue("uniformFlow",Aie);Ue("setName",Fz);Ue("builtinShadowContext",(i,e,t)=>gie(e,t,i));Ue("builtinAOContext",(i,e)=>vie(e,i));var cx=class extends Kt{static get type(){return"VarNode"}constructor(e,t=null,n=!1){super(),this.node=e,this.name=t,this.global=!0,this.isVarNode=!0,this.readOnly=n,this.parents=!0,this.intent=!1}setIntent(e){return this.intent=e,this}isIntent(e){return e.getDataFromNode(this).forceDeclaration===!0?!1:this.intent}getIntent(){return this.intent}getMemberType(e,t){return this.node.getMemberType(e,t)}getElementType(e){return this.node.getElementType(e)}generateNodeType(e){return this.node.getNodeType(e)}getArrayCount(e){return this.node.getArrayCount(e)}isAssign(e){return e.getDataFromNode(this).assign}build(...e){let t=e[0],n=this.getShared(t);if(this!==n)return n.build(...e);if(this._hasStack(t)===!1&&t.buildStage==="setup"&&(t.context.nodeLoop||t.context.nodeBlock)){let r=!1;if(this.node.isShaderCallNodeInternal&&this.node.shaderNode.getLayout()===null&&t.fnCall&&t.fnCall.shaderNode&&t.getDataFromNode(this.node.shaderNode).hasLoop){let a=t.getDataFromNode(this);a.forceDeclaration=!0,r=!0}let s=t.getBaseStack();r?s.addToStackBefore(this):s.addToStack(this)}return this.isIntent(t)&&this.isAssign(t)!==!0?this.node.build(...e):super.build(...e)}generate(e){let{node:t,name:n,readOnly:r}=this,{renderer:s}=e,o=s.backend.isWebGPUBackend===!0,a=!1,l=!1;r&&(a=e.isDeterministic(t),l=o?r:a);let c=this.getNodeType(e);if(c=="void")return this.isIntent(e)!==!0&&ze('TSL: ".toVar()" can not be used with void type.',this.stackTrace),t.build(e);let u=e.getVectorType(c),f=t.build(e,u),d=e.getVarFromNode(this,n,u,void 0,l),A=e.getPropertyName(d),y=A;if(l)if(o)y=a?`const ${A}`:`let ${A}`;else{let w=t.getArrayCount(e);y=`const ${e.getVar(d.type,A,w)}`}return e.addLineFlowCode(`${y} = ${f}`,this),A}_hasStack(e){return e.getDataFromNode(this).stack!==void 0}},Bz=$n(cx),xie=(i,e=null)=>Bz(i,e).toStack(),yie=(i,e=null)=>Bz(i,e,!0).toStack(),bie=i=>Bz(i).setIntent(!0).toStack();Ue("toVar",xie);Ue("toConst",yie);Ue("toVarIntent",bie);var LU=class extends Kt{static get type(){return"SubBuild"}constructor(e,t,n=null){super(n),this.node=e,this.name=t,this.isSubBuildNode=!0}generateNodeType(e){if(this.nodeType!==null)return this.nodeType;e.addSubBuild(this.name);let t=this.node.getNodeType(e);return e.removeSubBuild(),t}build(e,...t){e.addSubBuild(this.name);let n=this.node.build(e,...t);return e.removeSubBuild(),n}},Zg=(i,e,t=null)=>new LU(Ht(i),e,t),DU=class extends Kt{static get type(){return"VaryingNode"}constructor(e,t=null){super(),this.node=Zg(e,"VERTEX"),this.name=t,this.isVaryingNode=!0,this.interpolationType=null,this.interpolationSampling=null,this.global=!0}setInterpolation(e,t=null){return this.interpolationType=e,this.interpolationSampling=t,this}getHash(e){return this.name||super.getHash(e)}generateNodeType(e){return this.node.getNodeType(e)}setupVarying(e){let t=e.getNodeProperties(this),n=t.varying;if(n===void 0){let r=this.name,s=this.getNodeType(e),o=this.interpolationType,a=this.interpolationSampling;t.varying=n=e.getVaryingFromNode(this,r,s,o,a),t.node=Zg(this.node,"VERTEX")}return n.needsInterpolation||(n.needsInterpolation=e.shaderStage==="fragment"),n}setup(e){this.setupVarying(e),e.flowNodeFromShaderStage(nx.VERTEX,this.node)}analyze(e){this.setupVarying(e),e.flowNodeFromShaderStage(nx.VERTEX,this.node)}generate(e){let t=e.getSubBuildProperty("property",e.currentStack),n=e.getNodeProperties(this),r=this.setupVarying(e);if(n[t]===void 0){let s=this.getNodeType(e),o=e.getPropertyName(r,nx.VERTEX);if(e.shaderStage===nx.VERTEX){let a=n.node.build(e,s);e.addLineFlowCode(`${o} = ${a}`,this)}else e.flowNodeFromShaderStage(nx.VERTEX,n.node,s,o);n[t]=o}return e.getPropertyName(r)}},bm=$n(DU).setParameterLength(1,2),wie=i=>bm(i);Ue("toVarying",bm);Ue("toVertexStage",wie);var Sie=me(([i])=>{let e=i.mul(.9478672986).add(.0521327014).pow(2.4),t=i.mul(.0773993808),n=i.lessThanEqual(.04045);return Qn(e,t,n)}).setLayout({name:"sRGBTransferEOTF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),Tie=me(([i])=>{let e=i.pow(.41666).mul(1.055).sub(.055),t=i.mul(12.92),n=i.lessThanEqual(.0031308);return Qn(e,t,n)}).setLayout({name:"sRGBTransferOETF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),Oz="WorkingColorSpace",aEe="OutputColorSpace",vS=class extends Rr{static get type(){return"ColorSpaceNode"}constructor(e,t,n){super("vec4"),this.colorNode=e,this.source=t,this.target=n}resolveColorSpace(e,t){return t===Oz?ln.workingColorSpace:t===aEe?e.context.outputColorSpace||e.renderer.outputColorSpace:t}setup(e){let{colorNode:t}=this,n=this.resolveColorSpace(e,this.source),r=this.resolveColorSpace(e,this.target),s=t;return ln.enabled===!1||n===r||!n||!r||(ln.getTransfer(n)===kt&&(s=Ft(Sie(s.rgb),s.a)),ln.getPrimaries(n)!==ln.getPrimaries(r)&&(s=Ft(To(ln._getMatrix(new Mn,n,r)).mul(s.rgb),s.a)),ln.getTransfer(r)===kt&&(s=Ft(Tie(s.rgb),s.a))),s}},Eie=(i,e)=>new vS(Ht(i),Oz,e),MI=(i,e)=>new vS(Ht(i),e,Oz),lEe=(i,e,t)=>new vS(Ht(i),e,t);Ue("workingToColorSpace",Eie);Ue("colorSpaceToWorking",MI);var cEe=class extends Kd{static get type(){return"ReferenceElementNode"}constructor(e,t){super(e,t),this.referenceNode=e,this.isReferenceElementNode=!0}generateNodeType(){return this.referenceNode.uniformType}generate(e){let t=super.generate(e),n=this.referenceNode.getNodeType(),r=this.getNodeType();return e.format(t,n,r)}},p4=class extends Kt{static get type(){return"ReferenceBaseNode"}constructor(e,t,n=null,r=null){super(),this.property=e,this.uniformType=t,this.object=n,this.count=r,this.properties=e.split("."),this.reference=n,this.node=null,this.group=null,this.updateType=yn.OBJECT}setGroup(e){return this.group=e,this}element(e){return new cEe(this,Ht(e))}setNodeType(e){let t=Xt(null,e);this.group!==null&&t.setGroup(this.group),this.node=t}generateNodeType(e){return this.node===null&&(this.updateReference(e),this.updateValue()),this.node.getNodeType(e)}getValueFromReference(e=this.reference){let{properties:t}=this,n=e[t[0]];for(let r=1;r<t.length;r++)n=n[t[r]];return n}updateReference(e){return this.reference=this.object!==null?this.object:e.object,this.reference}setup(){return this.updateValue(),this.node}update(){this.updateValue()}updateValue(){this.node===null&&this.setNodeType(this.uniformType);let e=this.getValueFromReference();Array.isArray(e)?this.node.array=e:this.node.value=e}},uEe=(i,e,t)=>new p4(i,e,t),NU=class extends p4{static get type(){return"RendererReferenceNode"}constructor(e,t,n=null){super(e,t,n),this.renderer=n,this.setGroup(Jt)}updateReference(e){return this.reference=this.renderer!==null?this.renderer:e.renderer,this.reference}},Mie=(i,e,t=null)=>new NU(i,e,t),FU=class extends Rr{static get type(){return"ToneMappingNode"}constructor(e,t=Rie,n=null){super("vec3"),this._toneMapping=e,this.exposureNode=t,this.colorNode=n}customCacheKey(){return sS(this._toneMapping)}setToneMapping(e){return this._toneMapping=e,this}getToneMapping(){return this._toneMapping}setup(e){let t=this.colorNode||e.context.color,n=this._toneMapping;if(n===ao)return t;let r=null,s=e.renderer.library.getToneMappingFunction(n);return s!==null?r=Ft(s(t.rgb,this.exposureNode),t.a):(ze("ToneMappingNode: Unsupported Tone Mapping configuration.",n),r=t),r}},Cie=(i,e,t)=>new FU(i,Ht(e),Ht(t)),Rie=Mie("toneMappingExposure","float");Ue("toneMapping",(i,e,t)=>Cie(e,t,i));var kee=new WeakMap;function zee(i,e){let t=kee.get(i);return t===void 0&&(t=new Id(i,e),kee.set(i,t)),t}var Af=class extends pS{static get type(){return"BufferAttributeNode"}constructor(e,t=null,n=0,r=0){super(e,t),this.isBufferNode=!0,this.bufferType=t,this.bufferStride=n,this.bufferOffset=r,this.usage=r0,this.instanced=!1,this.attribute=null,this.global=!0,e&&e.isBufferAttribute===!0&&e.itemSize<=4&&(this.attribute=e,this.usage=e.usage,this.instanced=e.isInstancedBufferAttribute)}getHash(e){let t;if(this.bufferStride===0&&this.bufferOffset===0){let n=e.globalCache.getData(this.value);n===void 0&&(n={node:this},e.globalCache.setData(this.value,n)),t=n.node.id}else t=this.id;return String(t)}generateNodeType(e){return this.bufferType===null&&(this.bufferType=e.getTypeFromAttribute(this.attribute)),this.bufferType}setup(e){if(this.attribute!==null)return;let t=this.getNodeType(e),n=e.getTypeLength(t),r=this.value,s=this.bufferStride||n,o=this.bufferOffset,a;r.isInterleavedBuffer===!0?a=r:r.isBufferAttribute===!0?a=zee(r.array,s):a=zee(r,s);let l=new zo(a,n,o);a.setUsage(this.usage),this.attribute=l,this.attribute.isInstancedBufferAttribute=this.instanced}generate(e){let t=this.getNodeType(e),n=e.context.nodeName;n!==void 0&&delete e.context.nodeName;let r=e.getBufferAttributeFromNode(this,t,n),s=e.getPropertyName(r),o=null;if(e.shaderStage==="vertex"||e.shaderStage==="compute")this.name=s,o=s;else{let a;n&&(a=n+"Varying"),o=bm(this,a).build(e,t)}return o}getInputType(){return"bufferAttribute"}setUsage(e){return this.usage=e,this.attribute&&this.attribute.isBufferAttribute===!0&&(this.attribute.usage=e),this}setInstanced(e){return this.instanced=e,this}};function CI(i,e=null,t=0,n=0,r=r0,s=!1){return e==="mat3"||e===null&&i.itemSize===9?To(new Af(i,"vec3",9,0).setUsage(r).setInstanced(s),new Af(i,"vec3",9,3).setUsage(r).setInstanced(s),new Af(i,"vec3",9,6).setUsage(r).setInstanced(s)):e==="mat4"||e===null&&i.itemSize===16?mm(new Af(i,"vec4",16,0).setUsage(r).setInstanced(s),new Af(i,"vec4",16,4).setUsage(r).setInstanced(s),new Af(i,"vec4",16,8).setUsage(r).setInstanced(s),new Af(i,"vec4",16,12).setUsage(r).setInstanced(s)):new Af(i,e,t,n).setUsage(r)}var Uz=(i,e=null,t=0,n=0)=>CI(i,e,t,n),hEe=(i,e=null,t=0,n=0)=>CI(i,e,t,n,dg),RI=(i,e=null,t=0,n=0)=>CI(i,e,t,n,r0,!0),kz=(i,e=null,t=0,n=0)=>CI(i,e,t,n,dg,!0);Ue("toAttribute",i=>Uz(i.value));var Ys=class i extends Kt{static get type(){return"IndexNode"}constructor(e){super("uint"),this.scope=e,this.isIndexNode=!0}generate(e){let t=this.getNodeType(e),n=this.scope,r;if(n===i.VERTEX)r=e.getVertexIndex();else if(n===i.INSTANCE)r=e.getInstanceIndex();else if(n===i.DRAW)r=e.getDrawIndex();else if(n===i.INVOCATION_LOCAL)r=e.getInvocationLocalIndex();else if(n===i.INVOCATION_SUBGROUP)r=e.getInvocationSubgroupIndex();else if(n===i.SUBGROUP)r=e.getSubgroupIndex();else throw new Error("THREE.IndexNode: Unknown scope: "+n);let s;return e.shaderStage==="vertex"||e.shaderStage==="compute"?s=r:s=bm(this).build(e,t),s}};Ys.VERTEX="vertex";Ys.INSTANCE="instance";Ys.SUBGROUP="subgroup";Ys.INVOCATION_LOCAL="invocationLocal";Ys.INVOCATION_SUBGROUP="invocationSubgroup";Ys.DRAW="draw";var Iie=xt(Ys,Ys.VERTEX),Yu=xt(Ys,Ys.INSTANCE),fEe=xt(Ys,Ys.SUBGROUP),dEe=xt(Ys,Ys.INVOCATION_SUBGROUP),pEe=xt(Ys,Ys.INVOCATION_LOCAL),Pie=xt(Ys,Ys.DRAW),BU=class extends Kt{static get type(){return"ComputeNode"}constructor(e,t){super("void"),this.isComputeNode=!0,this.computeNode=e,this.workgroupSize=t,this.count=null,this.dispatchSize=null,this.version=1,this.name="",this.updateBeforeType=yn.OBJECT,this.onInitFunction=null,this.countNode=null}dispose(){this.dispatchEvent({type:"dispose"})}setName(e){return this.name=e,this}label(e){return Xe('TSL: "label()" has been deprecated. Use "setName()" instead.',new es),this.setName(e)}onInit(e){return this.onInitFunction=e,this}updateBefore({renderer:e}){e.compute(this)}setup(e){this.count!==null&&this.countNode===null&&(this.countNode=Xt(this.count,"uint").onObjectUpdate(()=>this.count));let t=this.computeNode.build(e);if(t){let n=e.getNodeProperties(this);n.outputComputeNode=t.outputNode,t.outputNode=null}return t}generate(e,t){let{shaderStage:n}=e;if(n==="compute"){let r=this.computeNode.build(e,"void");if(r!==""&&e.addLineFlowCode(r,this),this.count!==null&&e.allowEarlyReturns===!0){let s=this.countNode.build(e,"uint"),o=Yu.build(e,"uint");e.flow.code=`${e.tab}if ( ${o} >= ${s} ) { return; }41474147 4148-${e.flow.code}`}}else{let s=e.getNodeProperties(this).outputComputeNode;if(s)return s.build(e,t)}}},Lz=(i,e=[64])=>{(e.length===0||e.length>3)&&ze("TSL: compute() workgroupSize must have 1, 2, or 3 elements",new es);for(let t=0;t<e.length;t++){let n=e[t];(typeof n!="number"||n<=0||!Number.isInteger(n))&&ze(`TSL: compute() workgroupSize element at index [ ${t} ] must be a positive integer`,new es)}for(;e.length<3;)e.push(1);return new CU(Ht(i),e)},wie=(i,e,t)=>{let n=Lz(i,t);return typeof e=="number"?n.count=e:n.dispatchSize=e,n};Ue("compute",wie);Ue("computeKernel",Lz);var RU=class extends Kt{static get type(){return"IsolateNode"}constructor(e,t=!0){super(),this.node=e,this.parent=t,this.isIsolateNode=!0}generateNodeType(e){let t=e.getCache(),n=e.getCacheFromNode(this,this.parent);e.setCache(n);let r=this.node.getNodeType(e);return e.setCache(t),r}build(e,...t){let n=e.getCache(),r=e.getCacheFromNode(this,this.parent);e.setCache(r);let s=this.node.build(e,...t);return e.setCache(n),s}setParent(e){return this.parent=e,this}getParent(){return this.parent}},lx=i=>new RU(Ht(i));function Sie(i,e=!0){return Xe('TSL: "cache()" has been deprecated. Use "isolate()" instead.'),lx(i).setParent(e)}Ue("cache",Sie);Ue("isolate",lx);var IU=class extends Kt{static get type(){return"BypassNode"}constructor(e,t){super(),this.isBypassNode=!0,this.outputNode=e,this.callNode=t}generateNodeType(e){return this.outputNode.getNodeType(e)}generate(e){let t=this.callNode.build(e,"void");return t!==""&&e.addLineFlowCode(t,this),this.outputNode.build(e)}},Tie=$n(IU).setParameterLength(2);Ue("bypass",Tie);var Dz=me(([i,e,t,n=oe(0),r=oe(1),s=fc(!1)])=>{let o=i.sub(e).div(t.sub(e));return hx(s)&&(o=o.clamp()),o.mul(r.sub(n)).add(n)});function Eie(i,e,t,n=oe(0),r=oe(1)){return Dz(i,e,t,n,r,!0)}Ue("remap",Dz);Ue("remapClamp",Eie);var cx=class extends Kt{static get type(){return"ExpressionNode"}constructor(e="",t="void"){super(t),this.snippet=e}generate(e,t){let n=this.getNodeType(e),r=this.snippet;if(n==="void")e.addLineFlowCode(r,this);else return e.format(r,n,t)}},uc=$n(cx).setParameterLength(1,2),Mie=i=>(i?_a(i,uc("discard")):uc("discard")).toStack(),YTe=()=>uc("return").toStack();Ue("discard",Mie);var Nz=me(([i])=>Ft(i.rgb.mul(i.a),i.a),{color:"vec4",return:"vec4"}),Cie=me(([i])=>i.a.equal(0).select(Ft(0),Ft(i.rgb.div(i.a),i.a)),{color:"vec4",return:"vec4"}),PU=class extends Rr{static get type(){return"RenderOutputNode"}constructor(e,t,n){super("vec4"),this.colorNode=e,this._toneMapping=t,this.outputColorSpace=n,this.isRenderOutputNode=!0}setToneMapping(e){return this._toneMapping=e,this}getToneMapping(){return this._toneMapping}setup({context:e}){let t=this.colorNode||e.color;t=Ft(t.rgb,t.a.clamp(0,1)),t=Cie(t);let n=(this._toneMapping!==null?this._toneMapping:e.toneMapping)||ao,r=(this.outputColorSpace!==null?this.outputColorSpace:e.outputColorSpace)||ua;return n!==ao&&(t=t.toneMapping(n)),r!==ua&&r!==ln.workingColorSpace&&(t=t.workingToColorSpace(r)),t=Nz(t),t}},Fz=(i,e=null,t=null)=>new PU(Ht(i),e,t);Ue("renderOutput",Fz);var LU=class extends Rr{static get type(){return"DebugNode"}constructor(e,t=null){super(),this.node=e,this.callback=t}generateNodeType(e){return this.node.getNodeType(e)}setup(e){return this.node.build(e)}analyze(e){return this.node.build(e)}generate(e){let t=this.callback,n=this.node.build(e);if(t!==null)t(e,n);else{let r="--- TSL debug - "+e.shaderStage+" shader ---",s="-".repeat(r.length),o="";o+="// #"+r+`#4148+${e.flow.code}`}}else{let s=e.getNodeProperties(this).outputComputeNode;if(s)return s.build(e,t)}}},zz=(i,e=[64])=>{(e.length===0||e.length>3)&&ze("TSL: compute() workgroupSize must have 1, 2, or 3 elements",new es);for(let t=0;t<e.length;t++){let n=e[t];(typeof n!="number"||n<=0||!Number.isInteger(n))&&ze(`TSL: compute() workgroupSize element at index [ ${t} ] must be a positive integer`,new es)}for(;e.length<3;)e.push(1);return new BU(Ht(i),e)},Lie=(i,e,t)=>{let n=zz(i,t);return typeof e=="number"?n.count=e:n.dispatchSize=e,n};Ue("compute",Lie);Ue("computeKernel",zz);var OU=class extends Kt{static get type(){return"IsolateNode"}constructor(e,t=!0){super(),this.node=e,this.parent=t,this.isIsolateNode=!0}generateNodeType(e){let t=e.getCache(),n=e.getCacheFromNode(this,this.parent);e.setCache(n);let r=this.node.getNodeType(e);return e.setCache(t),r}build(e,...t){let n=e.getCache(),r=e.getCacheFromNode(this,this.parent);e.setCache(r);let s=this.node.build(e,...t);return e.setCache(n),s}setParent(e){return this.parent=e,this}getParent(){return this.parent}},ux=i=>new OU(Ht(i));function Die(i,e=!0){return Xe('TSL: "cache()" has been deprecated. Use "isolate()" instead.'),ux(i).setParent(e)}Ue("cache",Die);Ue("isolate",ux);var UU=class extends Kt{static get type(){return"BypassNode"}constructor(e,t){super(),this.isBypassNode=!0,this.outputNode=e,this.callNode=t}generateNodeType(e){return this.outputNode.getNodeType(e)}generate(e){let t=this.callNode.build(e,"void");return t!==""&&e.addLineFlowCode(t,this),this.outputNode.build(e)}},Nie=$n(UU).setParameterLength(2);Ue("bypass",Nie);var Vz=me(([i,e,t,n=oe(0),r=oe(1),s=dc(!1)])=>{let o=i.sub(e).div(t.sub(e));return dx(s)&&(o=o.clamp()),o.mul(r.sub(n)).add(n)});function Fie(i,e,t,n=oe(0),r=oe(1)){return Vz(i,e,t,n,r,!0)}Ue("remap",Vz);Ue("remapClamp",Fie);var hx=class extends Kt{static get type(){return"ExpressionNode"}constructor(e="",t="void"){super(t),this.snippet=e}generate(e,t){let n=this.getNodeType(e),r=this.snippet;if(n==="void")e.addLineFlowCode(r,this);else return e.format(r,n,t)}},hc=$n(hx).setParameterLength(1,2),Bie=i=>(i?_a(i,hc("discard")):hc("discard")).toStack(),mEe=()=>hc("return").toStack();Ue("discard",Bie);var Gz=me(([i])=>Ft(i.rgb.mul(i.a),i.a),{color:"vec4",return:"vec4"}),Oie=me(([i])=>i.a.equal(0).select(Ft(0),Ft(i.rgb.div(i.a),i.a)),{color:"vec4",return:"vec4"}),kU=class extends Rr{static get type(){return"RenderOutputNode"}constructor(e,t,n){super("vec4"),this.colorNode=e,this._toneMapping=t,this.outputColorSpace=n,this.isRenderOutputNode=!0}setToneMapping(e){return this._toneMapping=e,this}getToneMapping(){return this._toneMapping}setup({context:e}){let t=this.colorNode||e.color;t=Ft(t.rgb,t.a.clamp(0,1)),t=Oie(t);let n=(this._toneMapping!==null?this._toneMapping:e.toneMapping)||ao,r=(this.outputColorSpace!==null?this.outputColorSpace:e.outputColorSpace)||ua;return n!==ao&&(t=t.toneMapping(n)),r!==ua&&r!==ln.workingColorSpace&&(t=t.workingToColorSpace(r)),t=Gz(t),t}},qz=(i,e=null,t=null)=>new kU(Ht(i),e,t);Ue("renderOutput",qz);var zU=class extends Rr{static get type(){return"DebugNode"}constructor(e,t=null){super(),this.node=e,this.callback=t}generateNodeType(e){return this.node.getNodeType(e)}setup(e){return this.node.build(e)}analyze(e){return this.node.build(e)}generate(e){let t=this.callback,n=this.node.build(e);if(t!==null)t(e,n);else{let r="--- TSL debug - "+e.shaderStage+" shader ---",s="-".repeat(r.length),o="";o+="// #"+r+`#41494149 `,o+=e.flow.code.replace(/^\t/mg,"")+`41504150 `,o+="/* ... */ "+n+` /* ... */41514151 `,o+="// #"+s+`#4152-`,VA(o)}return n}},Rie=(i,e=null)=>new LU(Ht(i),e).toStack();Ue("debug",Rie);var h4=class extends la{constructor(){super(),this._renderer=null,this.currentFrame=null}get nodeFrame(){return this._renderer._nodes.nodeFrame}setRenderer(e){return this._renderer=e,this}getRenderer(){return this._renderer}init(){}begin(){}finish(){}inspect(){}computeAsync(){}beginCompute(){}finishCompute(){}beginRender(){}finishRender(){}copyTextureToTexture(){}copyFramebufferToTexture(){}},DU=class extends Kt{static get type(){return"InspectorNode"}constructor(e,t="",n=null){super(),this.node=e,this.name=t,this.callback=n,this.updateType=yn.FRAME,this.isInspectorNode=!0}getName(){return this.name||this.node.name}update(e){e.renderer.inspector.inspect(this)}generateNodeType(e){return this.node.getNodeType(e)}setup(e){let t=this.node;return e.context.inspector===!0&&this.callback!==null&&(t=this.callback(t)),e.renderer.backend.isWebGPUBackend!==!0&&e.renderer.inspector.constructor!==h4&&ni('TSL: ".toInspector()" is only available with WebGPU.'),t}};function Iie(i,e="",t=null){return i=Ht(i),i.before(new DU(i,e,t))}Ue("toInspector",Iie);function ZTe(i){Xe("TSL: AddNodeElement has been removed in favor of tree-shaking. Trying add",i)}var f4=class extends Kt{static get type(){return"AttributeNode"}constructor(e,t=null){super(t),this.global=!0,this._attributeName=e}getHash(e){return this.getAttributeName(e)}generateNodeType(e){let t=this.nodeType;if(t===null){let n=this.getAttributeName(e);if(e.hasGeometryAttribute(n)){let r=e.geometry.getAttribute(n);t=e.getTypeFromAttribute(r)}else t="float"}return t}setAttributeName(e){return this._attributeName=e,this}getAttributeName(){return this._attributeName}generate(e){let t=this.getAttributeName(e),n=this.getNodeType(e);if(e.hasGeometryAttribute(t)===!0){let s=e.geometry.getAttribute(t),o=e.getTypeFromAttribute(s),a=e.getAttribute(t,o);return e.shaderStage==="vertex"?e.format(a.name,o,n):bm(this).build(e,n)}else return Xe(`AttributeNode: Vertex attribute "${t}" not found on geometry.`),e.generateConst(n)}serialize(e){super.serialize(e),e.global=this.global,e._attributeName=this._attributeName}deserialize(e){super.deserialize(e),this.global=e.global,this._attributeName=e._attributeName}},hc=(i,e=null)=>new f4(i,e),Ui=(i=0)=>hc("uv"+(i>0?i:""),"vec2"),NU=class extends Kt{static get type(){return"TextureSizeNode"}constructor(e,t=null){super("uvec2"),this.isTextureSizeNode=!0,this.textureNode=e,this.levelNode=t}generate(e,t){let n=this.textureNode.build(e,"property"),r=this.levelNode===null?"0":this.levelNode.build(e,"int");return e.format(`${e.getMethod("textureDimensions")}( ${n}, ${r} )`,this.getNodeType(e),t)}},n1=$n(NU).setParameterLength(1,2),FU=class extends e1{static get type(){return"MaxMipLevelNode"}constructor(e){super(0),this._textureNode=e,this.updateType=yn.FRAME}get textureNode(){return this._textureNode}get texture(){return this._textureNode.value}update(){let e=this.texture,t=e.images,n=t&&t.length>0?t[0]&&t[0].image||t[0]:e.image;if(n&&n.width!==void 0){let{width:r,height:s}=n;this.value=Math.log2(Math.max(r,s))}}},Bz=$n(FU).setParameterLength(1),d4=class extends Error{constructor(e,t=null){super(e),this.name="NodeError",this.stackTrace=t}},Oz=new Hs,au=class extends e1{static get type(){return"TextureNode"}constructor(e=Oz,t=null,n=null,r=null){super(e),this.isTextureNode=!0,this.uvNode=t,this.levelNode=n,this.biasNode=r,this.compareNode=null,this.depthNode=null,this.gradNode=null,this.gatherNode=null,this.offsetNode=null,this.sampler=!0,this.updateMatrix=!1,this.updateType=yn.NONE,this.referenceNode=null,this._value=e,this._matrixUniform=null,this._flipYUniform=null,this.setUpdateMatrix(t===null)}set value(e){this.referenceNode?this.referenceNode.value=e:this._value=e}get value(){return this.referenceNode?this.referenceNode.value:this._value}getUniformHash(){return this.value.uuid}generateNodeType(){return this.value.isDepthTexture===!0?this.gatherNode===null?"float":"vec4":this.value.type===xi?"uvec4":this.value.type===Zr?"ivec4":"vec4"}getInputType(){return"texture"}getDefaultUV(){return Ui(this.value.channel)}updateReference(){return this.value}getTransformedUV(e){return this._matrixUniform===null&&(this._matrixUniform=Xt(this.value.matrix)),this._matrixUniform.mul(pe(e,1)).xy}setUpdateMatrix(e){return this.updateMatrix=e,this}setupUV(e,t){return e.isFlipY()&&(this._flipYUniform===null&&(this._flipYUniform=Xt(!1)),t=t.toVar(),this.sampler?t=this._flipYUniform.select(t.flipY(),t):t=this._flipYUniform.select(t.setY(de(n1(this,this.levelNode).y).sub(t.y).sub(1)),t)),t}setup(e){let t=e.getNodeProperties(this);t.referenceNode=this.referenceNode;let n=this.value;if(!n||n.isTexture!==!0)throw new d4("THREE.TSL: `texture( value )` function expects a valid instance of THREE.Texture().",this.stackTrace);let r=me(()=>{let l=this.uvNode;return(l===null||e.context.forceUVContext===!0)&&e.context.getUV&&(l=e.context.getUV(this,e)),l||(l=this.getDefaultUV()),this.updateMatrix===!0&&(l=this.getTransformedUV(l)),l=this.setupUV(e,l),this.updateType=this._matrixUniform!==null||this._flipYUniform!==null?yn.OBJECT:yn.NONE,l})(),s=this.levelNode;s===null&&e.context.getTextureLevel&&(s=e.context.getTextureLevel(this));let o=null,a=null;if(this.compareNode!==null)if(e.renderer.hasCompatibility(Ud.TEXTURE_COMPARE))o=this.compareNode;else{let l=n.compareFunction;l===null||l===h_||l===Yh||l===fg||l===Fu?a=this.compareNode:(o=this.compareNode,ni('TSL: Only "LessCompare", "LessEqualCompare", "GreaterCompare" and "GreaterEqualCompare" are supported for depth texture comparison fallback.'))}t.uvNode=r,t.levelNode=s,t.biasNode=this.biasNode,t.compareNode=o,t.compareStepNode=a,t.gradNode=this.gradNode,t.gatherNode=this.gatherNode,t.depthNode=this.depthNode,t.offsetNode=this.offsetNode}generateUV(e,t){return t.build(e,this.sampler===!0?"vec2":"ivec2")}generateOffset(e,t){return t.build(e,"ivec2")}generateSnippet(e,t,n,r,s,o,a,l,c,u,f){let d=this.value,A;return s?A=e.generateTextureBias(d,t,n,s,o,u):l?A=e.generateTextureGrad(d,t,n,l,o,u):c?a?A=e.generateTextureGatherCompare(d,t,n,a,o,u,f):A=e.generateTextureGather(d,t,n,c,o,u,f):a?A=e.generateTextureCompare(d,t,n,a,o,u):this.sampler===!1?A=e.generateTextureLoad(d,t,n,r,o,u):r?A=e.generateTextureLevel(d,t,n,r,o,u):A=e.generateTexture(d,t,n,o,u),A}generate(e,t){let n=this.value,r=e.getNodeProperties(this),s=super.generate(e,"property");if(/^sampler/.test(t))return s+"_sampler";if(e.isReference(t))return s;{let o=e.getDataFromNode(this),a=this.getNodeType(e),l=o.propertyName;if(l===void 0){let{uvNode:u,levelNode:f,biasNode:d,compareNode:A,compareStepNode:y,depthNode:w,gradNode:S,gatherNode:T,offsetNode:R}=r,P=this.generateUV(e,u),I=f?f.build(e,"float"):null,F=d?d.build(e,"float"):null,D=w?w.build(e,"int"):null,L=A?A.build(e,"float"):null,C=y?y.build(e,"float"):null,B=S?[S[0].build(e,"vec2"),S[1].build(e,"vec2")]:null,k=T?T.build(e,"int"):null,z=R?this.generateOffset(e,R):null,G=this._flipYUniform?this._flipYUniform.build(e,"bool"):null;k&&(a="vec4");let W=D;W===null&&n.isArrayTexture&&this.isTexture3DNode!==!0&&(W="0");let Y=e.getVarFromNode(this);l=e.getPropertyName(Y);let H=this.generateSnippet(e,s,P,I,F,W,L,B,k,z,G);if(C!==null){let $=n.compareFunction;$===fg||$===Fu?H=t1(uc(H,a),uc(C,"float")).build(e,a):H=t1(uc(C,"float"),uc(H,a)).build(e,a)}e.addLineFlowCode(`${l} = ${H}`,this),o.snippet=H,o.propertyName=l}let c=l;return e.needsToWorkingColorSpace(n)&&(c=wI(uc(c,a),n.colorSpace).setup(e).build(e,a)),e.format(c,a,t)}}setSampler(e){return this.sampler=e,this}getSampler(){return this.sampler}sample(e){let t=this.clone();return t.uvNode=Ht(e),t.referenceNode=this.getBase(),Ht(t)}load(e){return this.sample(e).setSampler(!1)}blur(e){let t=this.clone();t.biasNode=Ht(e).mul(Bz(t)),t.referenceNode=this.getBase();let n=t.value;return t.generateMipmaps===!1&&(n&&n.generateMipmaps===!1||n.minFilter===Ti||n.magFilter===Ti)&&(Xe("TSL: texture().blur() requires mipmaps and sampling. Use .generateMipmaps=true and .minFilter/.magFilter=THREE.LinearFilter in the Texture."),t.biasNode=null),Ht(t)}level(e){let t=this.clone();return t.levelNode=Ht(e),t.referenceNode=this.getBase(),Ht(t)}size(e){return n1(this,e)}bias(e){let t=this.clone();return t.biasNode=Ht(e),t.referenceNode=this.getBase(),Ht(t)}getBase(){return this.referenceNode?this.referenceNode.getBase():this}compare(e){let t=this.clone();return t.compareNode=Ht(e),t.referenceNode=this.getBase(),Ht(t)}grad(e,t){let n=this.clone();return n.gradNode=[Ht(e),Ht(t)],n.referenceNode=this.getBase(),Ht(n)}gather(e=0){let t=this.clone();return t.gatherNode=Ht(e),t.referenceNode=this.getBase(),Ht(t)}depth(e){let t=this.clone();return t.depthNode=Ht(e),t.referenceNode=this.getBase(),Ht(t)}offset(e){let t=this.clone();return t.offsetNode=Ht(e),t.referenceNode=this.getBase(),Ht(t)}serialize(e){super.serialize(e),e.value=this.value.toJSON(e.meta).uuid,e.sampler=this.sampler,e.updateMatrix=this.updateMatrix,e.updateType=this.updateType}deserialize(e){super.deserialize(e),this.value=e.meta.textures[e.value],this.sampler=e.sampler,this.updateMatrix=e.updateMatrix,this.updateType=e.updateType}update(){let e=this.value,t=this._matrixUniform;t!==null&&(t.value=e.matrix),e.matrixAutoUpdate===!0&&e.updateMatrix();let n=this._flipYUniform;n!==null&&(n.value=e.image instanceof ImageBitmap&&e.flipY===!0||e.isRenderTargetTexture===!0||e.isFramebufferTexture===!0||e.isDepthTexture===!0)}clone(){let e=new this.constructor(this.value,this.uvNode,this.levelNode,this.biasNode);return e.sampler=this.sampler,e.depthNode=this.depthNode,e.compareNode=this.compareNode,e.gradNode=this.gradNode,e.gatherNode=this.gatherNode,e.offsetNode=this.offsetNode,e}},KTe=$n(au).setParameterLength(1,4).setName("texture"),fi=(i=Oz,e=null,t=null,n=null)=>{let r;return i&&i.isTextureNode===!0?(r=Ht(i.clone()),r.referenceNode=i.getBase(),e!==null&&(r.uvNode=Ht(e)),t!==null&&(r.levelNode=Ht(t)),n!==null&&(r.biasNode=Ht(n))):r=KTe(i,e,t,n),r},QTe=(i=Oz)=>fi(i),_s=(...i)=>fi(...i).setSampler(!1),JTe=(i,e,t)=>fi(i,e).level(t),eEe=i=>(i.isNode===!0?i:fi(i)).convert("sampler"),tEe=i=>(i.isNode===!0?i:fi(i)).convert("samplerComparison"),mS=class extends e1{static get type(){return"BufferNode"}constructor(e,t,n=0){super(e,t),this.isBufferNode=!0,this.bufferType=t,this.bufferCount=n,this.updateRanges=[]}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}getElementType(e){return this.getNodeType(e)}getInputType(){return"buffer"}},bx=(i,e,t)=>new mS(i,e,t),BU=class extends Qd{static get type(){return"UniformArrayElementNode"}constructor(e,t){super(e,t),this.isArrayBufferElementNode=!0}generate(e){let t=super.generate(e),n=this.getNodeType(e),r=this.node.getPaddedType();return e.format(t,r,n)}},OU=class extends mS{static get type(){return"UniformArrayNode"}constructor(e,t=null){super(null),this.array=e,this.elementType=t===null?dm(e[0]):t,this.paddedType=this.getPaddedType(),this.updateType=yn.RENDER,this.isArrayBufferNode=!0}generateNodeType(){return this.paddedType}getElementType(){return this.elementType}getPaddedType(){let e=this.elementType,t="vec4";return e==="mat2"?t="mat2":/mat/.test(e)===!0?t="mat4":e.charAt(0)==="i"?t="ivec4":e.charAt(0)==="u"&&(t="uvec4"),t}update(){let{array:e,value:t}=this,n=this.elementType;if(n==="float"||n==="int"||n==="uint")for(let r=0;r<e.length;r++){let s=r*4;t[s]=e[r]}else if(n==="color")for(let r=0;r<e.length;r++){let s=r*4,o=e[r];t[s]=o.r,t[s+1]=o.g,t[s+2]=o.b||0}else if(n==="mat2")for(let r=0;r<e.length;r++){let s=r*4,o=e[r];t[s]=o.elements[0],t[s+1]=o.elements[1],t[s+2]=o.elements[2],t[s+3]=o.elements[3]}else if(n==="mat3")for(let r=0;r<e.length;r++){let s=r*16,o=e[r];t[s]=o.elements[0],t[s+1]=o.elements[1],t[s+2]=o.elements[2],t[s+4]=o.elements[3],t[s+5]=o.elements[4],t[s+6]=o.elements[5],t[s+8]=o.elements[6],t[s+9]=o.elements[7],t[s+10]=o.elements[8],t[s+15]=1}else if(n==="mat4")for(let r=0;r<e.length;r++){let s=r*16,o=e[r];for(let a=0;a<o.elements.length;a++)t[s+a]=o.elements[a]}else for(let r=0;r<e.length;r++){let s=r*4,o=e[r];t[s]=o.x,t[s+1]=o.y,t[s+2]=o.z||0,t[s+3]=o.w||0}}setup(e){let t=this.array.length,n=this.elementType,r=Float32Array,s=this.paddedType,o=e.getTypeLength(s);return n.charAt(0)==="i"&&(r=Int32Array),n.charAt(0)==="u"&&(r=Uint32Array),this.value=new r(t*o),this.bufferCount=t,this.bufferType=s,this.update(),super.setup(e)}element(e){return new BU(this,Ht(e))}},Xo=(i,e)=>new OU(i,e),UU=class extends Kt{constructor(e){super("float"),this.name=e,this.isBuiltinNode=!0}generate(){return this.name}},ip=$n(UU).setParameterLength(1),Fw,Bw,Yo=class i extends Kt{static get type(){return"ScreenNode"}constructor(e){super(),this.scope=e,this._output=null,this.isViewportNode=!0}generateNodeType(){return this.scope===i.DPR?"float":this.scope===i.VIEWPORT?"vec4":"vec2"}getUpdateType(){let e=yn.NONE;return(this.scope===i.SIZE||this.scope===i.VIEWPORT||this.scope===i.DPR)&&(e=yn.RENDER),this.updateType=e,e}update({renderer:e}){let t=e.getRenderTarget();this.scope===i.VIEWPORT?t!==null?Bw.copy(t.viewport):(e.getViewport(Bw),Bw.multiplyScalar(e.getPixelRatio())):this.scope===i.DPR?this._output.value=e.getPixelRatio():t!==null?(Fw.width=t.width,Fw.height=t.height):e.getDrawingBufferSize(Fw)}setup(){let e=this.scope,t=null;return e===i.SIZE?t=Xt(Fw||(Fw=new Oe)):e===i.VIEWPORT?t=Xt(Bw||(Bw=new xn)):e===i.DPR?t=Xt(1):t=dt(f1.div(i1)),this._output=t,t}generate(e){if(this.scope===i.COORDINATE){let t=e.getFragCoord();if(e.isFlipY()){let n=e.getNodeProperties(i1).outputNode.build(e);t=`${e.getType("vec2")}( ${t}.x, ${n}.y - ${t}.y )`}return t}return super.generate(e)}};Yo.COORDINATE="coordinate";Yo.VIEWPORT="viewport";Yo.SIZE="size";Yo.UV="uv";Yo.DPR="dpr";var Uz=xt(Yo,Yo.DPR),ju=xt(Yo,Yo.UV),i1=xt(Yo,Yo.SIZE),f1=xt(Yo,Yo.COORDINATE),ux=xt(Yo,Yo.VIEWPORT),kz=ux.zw,Pie=f1.sub(ux.xy),nEe=Pie.div(kz),iEe=me(()=>(Xe('TSL: "viewportResolution" is deprecated. Use "screenSize" instead.',new es),i1),"vec2").once()(),TO=null,uR=null,EO=null,hR=null,MO=null,fR=null,CO=null,dR=null,RO=null,pR=null,IO=null,mR=null,PO=null,AR=null,wm=Xt(0,"uint").setName("u_cameraIndex").setGroup(gI("cameraIndex")).toVarying("v_cameraIndex"),cm=Xt("float").setName("cameraNear").setGroup(Jt).onRenderUpdate(({camera:i})=>i.near),um=Xt("float").setName("cameraFar").setGroup(Jt).onRenderUpdate(({camera:i})=>i.far),Qa=me(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.projectionMatrix);uR===null?uR=Xo(t).setGroup(Jt).setName("cameraProjectionMatrices"):uR.array=t,e=uR.element(i.isMultiViewCamera?ip("gl_ViewID_OVR"):wm)}else TO===null&&(TO=Xt(i.projectionMatrix).setName("cameraProjectionMatrix").setGroup(Jt).onRenderUpdate(({camera:t})=>t.projectionMatrix)),e=TO;return e}).once()(),Lie=me(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.projectionMatrixInverse);hR===null?hR=Xo(t).setGroup(Jt).setName("cameraProjectionMatricesInverse"):hR.array=t,e=hR.element(i.isMultiViewCamera?ip("gl_ViewID_OVR"):wm)}else EO===null&&(EO=Xt(i.projectionMatrixInverse).setName("cameraProjectionMatrixInverse").setGroup(Jt).onRenderUpdate(({camera:t})=>t.projectionMatrixInverse)),e=EO;return e}).once()(),Sm=me(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.matrixWorldInverse);fR===null?fR=Xo(t).setGroup(Jt).setName("cameraViewMatrices"):fR.array=t,e=fR.element(i.isMultiViewCamera?ip("gl_ViewID_OVR"):wm)}else MO===null&&(MO=Xt(i.matrixWorldInverse).setName("cameraViewMatrix").setGroup(Jt).onRenderUpdate(({camera:t})=>t.matrixWorldInverse)),e=MO;return e}).once()(),LS=me(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.matrixWorld);dR===null?dR=Xo(t).setGroup(Jt).setName("cameraWorldMatrices"):dR.array=t,e=dR.element(i.isMultiViewCamera?ip("gl_ViewID_OVR"):wm)}else CO===null&&(CO=Xt(i.matrixWorld).setName("cameraWorldMatrix").setGroup(Jt).onRenderUpdate(({camera:t})=>t.matrixWorld)),e=CO;return e}).once()(),rEe=me(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.normalMatrix);pR===null?pR=Xo(t).setGroup(Jt).setName("cameraNormalMatrices"):pR.array=t,e=pR.element(i.isMultiViewCamera?ip("gl_ViewID_OVR"):wm)}else RO===null&&(RO=Xt(i.normalMatrix).setName("cameraNormalMatrix").setGroup(Jt).onRenderUpdate(({camera:t})=>t.normalMatrix)),e=RO;return e}).once()(),Die=me(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n=0,r=i.cameras.length;n<r;n++)t.push(new re);mR===null?mR=Xo(t).setGroup(Jt).setName("cameraPositions").onRenderUpdate(({camera:n},r)=>{let s=n.cameras,o=r.array;for(let a=0,l=s.length;a<l;a++)o[a].setFromMatrixPosition(s[a].matrixWorld)}):mR.array=t,e=mR.element(i.isMultiViewCamera?ip("gl_ViewID_OVR"):wm)}else IO===null&&(IO=Xt(new re).setName("cameraPosition").setGroup(Jt).onRenderUpdate(({camera:t},n)=>n.value.setFromMatrixPosition(t.matrixWorld))),e=IO;return e}).once()(),sEe=me(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.viewport);AR===null?AR=Xo(t,"vec4").setGroup(Jt).setName("cameraViewports"):AR.array=t,e=AR.element(wm)}else PO===null&&(PO=Ft(0,0,i1.x,i1.y).toConst("cameraViewport")),e=PO;return e}).once()(),Lee=new yl,Ds=class i extends Kt{static get type(){return"Object3DNode"}constructor(e,t=null){super(),this.scope=e,this.object3d=t,this.updateType=yn.OBJECT,this.uniformNode=new e1(null)}generateNodeType(){let e=this.scope;if(e===i.WORLD_MATRIX)return"mat4";if(e===i.POSITION||e===i.VIEW_POSITION||e===i.DIRECTION||e===i.SCALE)return"vec3";if(e===i.RADIUS)return"float"}update(e){let t=this.object3d,n=this.uniformNode,r=this.scope;if(r===i.WORLD_MATRIX)n.value=t.matrixWorld;else if(r===i.POSITION)n.value=n.value||new re,n.value.setFromMatrixPosition(t.matrixWorld);else if(r===i.SCALE)n.value=n.value||new re,n.value.setFromMatrixScale(t.matrixWorld);else if(r===i.DIRECTION)n.value=n.value||new re,t.getWorldDirection(n.value);else if(r===i.VIEW_POSITION){let s=e.camera;n.value=n.value||new re,n.value.setFromMatrixPosition(t.matrixWorld),n.value.applyMatrix4(s.matrixWorldInverse)}else if(r===i.RADIUS){let s=e.object.geometry;s.boundingSphere===null&&s.computeBoundingSphere(),Lee.copy(s.boundingSphere).applyMatrix4(t.matrixWorld),n.value=Lee.radius}}generate(e){let t=this.scope;return t===i.WORLD_MATRIX?this.uniformNode.nodeType="mat4":t===i.POSITION||t===i.VIEW_POSITION||t===i.DIRECTION||t===i.SCALE?this.uniformNode.nodeType="vec3":t===i.RADIUS&&(this.uniformNode.nodeType="float"),this.uniformNode.build(e)}serialize(e){super.serialize(e),e.scope=this.scope}deserialize(e){super.deserialize(e),this.scope=e.scope}};Ds.WORLD_MATRIX="worldMatrix";Ds.POSITION="position";Ds.SCALE="scale";Ds.VIEW_POSITION="viewPosition";Ds.DIRECTION="direction";Ds.RADIUS="radius";var oEe=$n(Ds,Ds.DIRECTION).setParameterLength(1),aEe=$n(Ds,Ds.WORLD_MATRIX).setParameterLength(1),lEe=$n(Ds,Ds.POSITION).setParameterLength(1),cEe=$n(Ds,Ds.SCALE).setParameterLength(1),uEe=$n(Ds,Ds.VIEW_POSITION).setParameterLength(1),hEe=$n(Ds,Ds.RADIUS).setParameterLength(1),Pl=class extends Ds{static get type(){return"ModelNode"}constructor(e){super(e)}update(e){this.object3d=e.object,super.update(e)}},fEe=xt(Pl,Pl.DIRECTION),iu=xt(Pl,Pl.WORLD_MATRIX),dEe=xt(Pl,Pl.POSITION),pEe=xt(Pl,Pl.SCALE),mEe=xt(Pl,Pl.VIEW_POSITION),AEe=xt(Pl,Pl.RADIUS),Nie=Xt(new Mn).onObjectUpdate(({object:i},e)=>e.value.getNormalMatrix(i.matrixWorld)),gEe=Xt(new cn).onObjectUpdate(({object:i},e)=>e.value.copy(i.matrixWorld).invert()),Sf=me(i=>i.context.modelViewMatrix||Fie).once()().toVar("modelViewMatrix"),Fie=Sm.mul(iu),kU=me(i=>(i.context.isHighPrecisionModelViewMatrix=!0,Xt("mat4").onObjectUpdate(({object:e,camera:t})=>e.modelViewMatrix.multiplyMatrices(t.matrixWorldInverse,e.matrixWorld)))).once()().toVar("highpModelViewMatrix"),zU=me(i=>{let e=i.context.isHighPrecisionModelViewMatrix;return Xt("mat3").onObjectUpdate(({object:t,camera:n})=>(e!==!0&&t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix)))}).once()().toVar("highpModelNormalViewMatrix"),Bie=me(i=>i.shaderStage!=="fragment"?(ni("TSL: `clipSpace` is only available in fragment stage."),Ft()):i.context.clipSpace.toVarying("v_clipSpace")).once()(),ga=hc("position","vec3"),Mr=ga.toVarying("positionLocal"),r1=ga.toVarying("positionPrevious"),yf=me(i=>iu.mul(Mr).xyz.toVarying(i.getSubBuildProperty("v_positionWorld")),"vec3").once(["POSITION"])(),zz=me(()=>Mr.transformDirection(iu).toVarying("v_positionWorldDirection").normalize().toVar("positionWorldDirection"),"vec3").once(["POSITION"])(),xs=me(i=>{if(i.shaderStage==="fragment"&&i.material.vertexNode){let e=Lie.mul(Bie);return e.xyz.div(e.w).toVar("positionView")}return i.context.setupPositionView().toVarying("v_positionView")},"vec3").once(["POSITION","VERTEX"])(),er=me(i=>{let e;return i.camera.isOrthographicCamera?e=pe(0,0,1):e=xs.negate().toVarying("v_positionViewDirection").normalize(),e.toVar("positionViewDirection")},"vec3").once(["POSITION"])(),VU=class extends Kt{static get type(){return"FrontFacingNode"}constructor(){super("bool"),this.isFrontFacingNode=!0}generate(e){if(e.shaderStage!=="fragment")return"true";let{material:t}=e;return t.side===mi?"false":e.getFrontFacing()}},Oie=xt(VU),Vz=oe(Oie).mul(2).sub(1),d1=me(([i],{material:e})=>{let t=e.side;return t===mi?i=i.mul(-1):t===vr&&(i=i.mul(Vz)),i}),vEe=i=>(ni('TSL: "directionToFaceDirection()" has been renamed to "negateOnBackSide()".'),d1(i)),EI=hc("normal","vec3"),ba=me(i=>i.geometry.hasAttribute("normal")===!1?(Xe('TSL: Vertex attribute "normal" not found on geometry.'),pe(0,1,0)):EI,"vec3").once()().toVar("normalLocal"),Uie=xs.dFdx().cross(xs.dFdy()).normalize().toVar("normalFlat"),dx=me(i=>{let e;return i.isFlatShading()?e=Uie:e=qz(ba).toVarying("v_normalViewGeometry").normalize(),e},"vec3").once()().toVar("normalViewGeometry"),kie=me(i=>{let e=dx.transformNormalByInverseViewMatrix(Sm);return i.isFlatShading()!==!0&&(e=e.toVarying("v_normalWorldGeometry")),e.normalize().toVar("normalWorldGeometry")},"vec3").once()(),hi=me(i=>{let e;return i.subBuildFn==="NORMAL"||i.subBuildFn==="VERTEX"?(e=dx,i.isFlatShading()!==!0&&(e=d1(e))):e=i.context.setupNormal().context({getUV:null,getTextureLevel:null}),e},"vec3").once(["NORMAL","VERTEX"])().toVar("normalView"),Tm=hi.transformNormalByInverseViewMatrix(Sm).toVar("normalWorld"),hm=me(({subBuildFn:i,context:e})=>{let t;return i==="NORMAL"||i==="VERTEX"?t=hi:t=e.setupClearcoatNormal().context({getUV:null,getTextureLevel:null}),t},"vec3").once(["NORMAL","VERTEX"])().toVar("clearcoatNormalView"),Gz=me(([i,e=iu])=>To(e).inverse().transpose().mul(i).normalize());Ue("transformNormal",Gz);var qz=me(([i],e)=>{let t=e.context.modelNormalViewMatrix;return t?i.transformNormalByViewMatrix(t):Nie.mul(i).transformNormalByViewMatrix(Sm)}),_Ee=me(()=>(Xe('TSL: "transformedNormalView" is deprecated. Use "normalView" instead.'),hi)).once(["NORMAL","VERTEX"])(),xEe=me(()=>(Xe('TSL: "transformedNormalWorld" is deprecated. Use "normalWorld" instead.'),Tm)).once(["NORMAL","VERTEX"])(),yEe=me(()=>(Xe('TSL: "transformedClearcoatNormalView" is deprecated. Use "clearcoatNormalView" instead.'),hm)).once(["NORMAL","VERTEX"])(),LO=new cn,zie=Xt(0).onReference(({material:i})=>i).onObjectUpdate(({material:i})=>i.refractionRatio),$R=Xt(1).onReference(({material:i})=>i).onObjectUpdate(function({material:i,scene:e}){return i.envMap?i.envMapIntensity:e.environmentIntensity}),p4=Xt(new cn).onReference(function(i){return i.material}).onObjectUpdate(function({material:i,scene:e}){let n=(e.environment!==null||e.environmentNode&&e.environmentNode.isNode)&&i.envMap===null?e.environmentRotation:i.envMapRotation;return n?LO.makeRotationFromEuler(n).transpose():LO.identity(),LO}),Vie=er.negate().reflect(hi),Gie=er.negate().refract(hi,zie),qie=Vie.transformDirection(LS).toVar("reflectVector"),Hie=Gie.transformDirection(LS).toVar("refractVector"),Wie=new Lh,GU=class extends au{static get type(){return"CubeTextureNode"}constructor(e,t=null,n=null,r=null){super(e,t,n,r),this.isCubeTextureNode=!0}getInputType(){return this.value.isDepthTexture===!0?"cubeDepthTexture":"cubeTexture"}getDefaultUV(){let e=this.value;return e.mapping===Jl?qie:e.mapping===Hc?Hie:(ze('CubeTextureNode: Mapping "%s" not supported.',e.mapping),pe(0,0,0))}setUpdateMatrix(){}setupUV(e,t){let n=this.value;return n.isDepthTexture===!0?e.renderer.coordinateSystem===xl?pe(t.x,t.y.negate(),t.z):t:(t=p4.mul(t),(e.renderer.coordinateSystem===xl||!n.isRenderTargetTexture)&&(t=pe(t.x.negate(),t.yz)),t)}generateUV(e,t){return t.build(e,this.sampler===!0?"vec3":"ivec3")}},Hz=$n(GU).setParameterLength(1,4).setName("cubeTexture"),Ka=(i=Wie,e=null,t=null,n=null)=>{let r;return i&&i.isCubeTextureNode===!0?(r=Ht(i.clone()),r.referenceNode=i,e!==null&&(r.uvNode=Ht(e)),t!==null&&(r.levelNode=Ht(t)),n!==null&&(r.biasNode=Ht(n))):r=Hz(i,e,t,n),r},bEe=(i=Wie)=>Hz(i),qU=class extends Qd{static get type(){return"ReferenceElementNode"}constructor(e,t){super(e,t),this.referenceNode=e,this.isReferenceElementNode=!0}generateNodeType(){return this.referenceNode.uniformType}generate(e){let t=super.generate(e),n=this.referenceNode.getNodeType(e),r=this.getNodeType(e);return e.format(t,n,r)}},px=class extends Kt{static get type(){return"ReferenceNode"}constructor(e,t,n=null,r=null){super(),this.property=e,this.uniformType=t,this.object=n,this.count=r,this.properties=e.split("."),this.reference=n,this.node=null,this.group=null,this.name=null,this.updateType=yn.OBJECT}element(e){return new qU(this,Ht(e))}setGroup(e){return this.group=e,this}setName(e){return this.name=e,this}label(e){return Xe('TSL: "label()" has been deprecated. Use "setName()" instead.'),this.setName(e)}setNodeType(e){let t=null;this.count!==null?t=bx(null,e,this.count):Array.isArray(this.getValueFromReference())?(t=Xo(null,e),t.updateType=yn.OBJECT):e==="texture"?t=fi(null):e==="cubeTexture"?t=Ka(null):t=Xt(null,e),this.group!==null&&t.setGroup(this.group),this.name!==null&&t.setName(this.name),this.node=t}generateNodeType(e){return this.node===null&&(this.updateReference(e),this.updateValue()),this.node.getNodeType(e)}getValueFromReference(e=this.reference){let{properties:t}=this,n=e[t[0]];for(let r=1;r<t.length;r++)n=n[t[r]];return n}updateReference(e){return this.reference=this.object!==null?this.object:e.object,this.reference}setup(){return this.updateValue(),this.node}update(){this.updateValue()}updateValue(){this.node===null&&this.setNodeType(this.uniformType);let e=this.getValueFromReference();Array.isArray(e)?this.node.array=e:this.node.value=e}},mr=(i,e,t)=>new px(i,e,t),jie=(i,e,t,n)=>new px(i,e,n,t),HU=class extends px{static get type(){return"MaterialReferenceNode"}constructor(e,t,n=null){super(e,t,n),this.material=n,this.isMaterialReferenceNode=!0}updateReference(e){return this.reference=this.material!==null?this.material:e.material,this.reference}},Yd=(i,e,t=null)=>new HU(i,e,t),Xie=Ui(),wEe=xs.dFdx(),SEe=xs.dFdy(),$ie=Xie.dFdx(),Yie=Xie.dFdy(),Zie=hi,Kie=SEe.cross(Zie),Qie=Zie.cross(wEe),WU=Kie.mul($ie.x).add(Qie.mul(Yie.x)),jU=Kie.mul($ie.y).add(Qie.mul(Yie.y)),Dee=WU.dot(WU).max(jU.dot(jU)),Jie=Dee.equal(0).select(0,Dee.inverseSqrt()),TEe=WU.mul(Jie).toVar("tangentViewFrame"),EEe=jU.mul(Jie).toVar("bitangentViewFrame"),MI=hc("tangent","vec4"),_m=MI.xyz.toVar("tangentLocal"),CI=me(i=>{let e;return i.subBuildFn==="VERTEX"||i.geometry.hasAttribute("tangent")?e=Sf.mul(Ft(_m,0)).xyz.toVarying("v_tangentView").normalize():e=TEe,i.isFlatShading()!==!0&&(e=d1(e)),e},"vec3").once(["NORMAL","VERTEX"])().toVar("tangentView"),ere=CI.transformDirection(LS).toVarying("v_tangentWorld").normalize().toVar("tangentWorld"),RI=me(([i,e],t)=>{let n=i.mul(MI.w).xyz;return t.subBuildFn==="NORMAL"&&t.isFlatShading()!==!0&&(n=n.toVarying(e)),n}).once(["NORMAL"]),MEe=RI(EI.cross(MI),"v_bitangentGeometry").normalize().toVar("bitangentGeometry"),CEe=RI(ba.cross(_m),"v_bitangentLocal").normalize().toVar("bitangentLocal"),tre=me(i=>{let e;return i.subBuildFn==="VERTEX"||i.geometry.hasAttribute("tangent")?e=RI(hi.cross(CI),"v_bitangentView").normalize():e=EEe,i.isFlatShading()!==!0&&(e=d1(e)),e},"vec3").once(["NORMAL","VERTEX"])().toVar("bitangentView"),REe=RI(Tm.cross(ere),"v_bitangentWorld").normalize().toVar("bitangentWorld"),Wg=To(CI,tre,hi).toVar("TBNViewMatrix"),nre=er.mul(Wg),IEe=(i,e)=>i.sub(nre.mul(e)),ire=me(()=>{let i=$g.cross(er);return i=i.cross($g).normalize(),i=Qn(i,hi,am.mul(Af.oneMinus()).oneMinus().pow2().pow2()).normalize(),i}).once()(),Wz=i=>Ht(i).mul(.5).add(.5),rre=i=>Ht(i).mul(2).sub(1),XU=i=>pe(i,Ja(bI(oe(1).sub(ou(i,i))))),PEe=i=>(ni('TSL: "directionToColor()" has been renamed to "packNormalToRGB()".'),Wz(i)),LEe=i=>(ni('TSL: "colorToDirection()" has been renamed to "unpackRGBToNormal()".'),rre(i)),$U=class extends Rr{static get type(){return"NormalMapNode"}constructor(e,t=null){super("vec3"),this.node=e,this.scaleNode=t,this.normalMapType=ec,this.unpackNormalMode=Pb}setup(e){let{normalMapType:t,scaleNode:n,unpackNormalMode:r}=this,s=this.node.mul(2).sub(1);if(t===ec?r===OM?s=XU(s.xy):r===V8?s=XU(s.yw):r!==Pb&&ze(`THREE.NodeMaterial: Unexpected unpack normal mode: ${r}`):r!==Pb&&ze(`THREE.NodeMaterial: Normal map type '${t}' is not compatible with unpack normal mode '${r}'`),n!==null){let a=n;e.isFlatShading()===!0&&(a=d1(a)),s=pe(s.xy.mul(a),s.z)}let o=null;return t===BM?o=qz(s):t===ec?o=Wg.mul(s).normalize():(ze(`NodeMaterial: Unsupported normal map type: ${t}`),o=hi),o}},YU=$n($U).setParameterLength(1,2),DEe=me(({textureNode:i,bumpScale:e})=>{let t=r=>i.isolate().context({getUV:s=>r(s.uvNode||Ui()),forceUVContext:!0}),n=oe(t(r=>r));return dt(oe(t(r=>r.add(r.dFdx()))).sub(n),oe(t(r=>r.add(r.dFdy()))).sub(n)).mul(e)}),NEe=me(i=>{let{surf_pos:e,surf_norm:t,dHdxy:n}=i,r=e.dFdx().normalize(),s=e.dFdy().normalize(),o=t,a=s.cross(o),l=o.cross(r),c=r.dot(a).mul(Vz),u=c.sign().mul(n.x.mul(a).add(n.y.mul(l)));return c.abs().mul(t).sub(u).normalize()}),ZU=class extends Rr{static get type(){return"BumpMapNode"}constructor(e,t=null){super("vec3"),this.textureNode=e,this.scaleNode=t}setup(e){if(e.material.wireframe===!0)return hi;let t=this.scaleNode!==null?this.scaleNode:1,n=DEe({textureNode:this.textureNode,bumpScale:t});return NEe({surf_pos:xs,surf_norm:hi,dHdxy:n})}},jz=$n(ZU).setParameterLength(1,2),Nee=new Map,at=class i extends Kt{static get type(){return"MaterialNode"}constructor(e){super(),this.scope=e}getCache(e,t){let n=Nee.get(e);return n===void 0&&(n=Yd(e,t),Nee.set(e,n)),n}getFloat(e){return this.getCache(e,"float")}getColor(e){return this.getCache(e,"color")}getTexture(e){return this.getCache(e==="map"?"map":e+"Map","texture")}setup(e){let t=e.context.material,n=this.scope,r=null;if(n===i.COLOR){let s=t.color!==void 0?this.getColor(n):pe();t.map&&t.map.isTexture===!0?r=s.mul(this.getTexture("map")):r=s}else if(n===i.OPACITY){let s=this.getFloat(n);t.alphaMap&&t.alphaMap.isTexture===!0?r=s.mul(this.getTexture("alpha")):r=s}else if(n===i.SPECULAR_STRENGTH)t.specularMap&&t.specularMap.isTexture===!0?r=this.getTexture("specular").r:r=oe(1);else if(n===i.SPECULAR_INTENSITY){let s=this.getFloat(n);t.specularIntensityMap&&t.specularIntensityMap.isTexture===!0?r=s.mul(this.getTexture(n).a):r=s}else if(n===i.SPECULAR_COLOR){let s=this.getColor(n);t.specularColorMap&&t.specularColorMap.isTexture===!0?r=s.mul(this.getTexture(n).rgb):r=s}else if(n===i.ROUGHNESS){let s=this.getFloat(n);t.roughnessMap&&t.roughnessMap.isTexture===!0?r=s.mul(this.getTexture(n).g):r=s}else if(n===i.METALNESS){let s=this.getFloat(n);t.metalnessMap&&t.metalnessMap.isTexture===!0?r=s.mul(this.getTexture(n).b):r=s}else if(n===i.EMISSIVE){let s=this.getFloat("emissiveIntensity"),o=this.getColor(n).mul(s);t.emissiveMap&&t.emissiveMap.isTexture===!0?r=o.mul(this.getTexture(n)):r=o}else if(n===i.NORMAL)t.normalMap?(r=YU(this.getTexture("normal"),this.getCache("normalScale","vec2")),r.normalMapType=t.normalMapType,(t.normalMap.format==js||t.normalMap.format==$h||t.normalMap.format==Xh)&&(r.unpackNormalMode=OM)):t.bumpMap?r=jz(this.getTexture("bump").r,this.getFloat("bumpScale")):r=hi;else if(n===i.CLEARCOAT){let s=this.getFloat(n);t.clearcoatMap&&t.clearcoatMap.isTexture===!0?r=s.mul(this.getTexture(n).r):r=s}else if(n===i.CLEARCOAT_ROUGHNESS){let s=this.getFloat(n);t.clearcoatRoughnessMap&&t.clearcoatRoughnessMap.isTexture===!0?r=s.mul(this.getTexture(n).r):r=s}else if(n===i.CLEARCOAT_NORMAL)t.clearcoatNormalMap?r=YU(this.getTexture(n),this.getCache(n+"Scale","vec2")):r=hi;else if(n===i.SHEEN){let s=this.getColor("sheenColor").mul(this.getFloat("sheen"));t.sheenColorMap&&t.sheenColorMap.isTexture===!0?r=s.mul(this.getTexture("sheenColor").rgb):r=s}else if(n===i.SHEEN_ROUGHNESS){let s=this.getFloat(n);t.sheenRoughnessMap&&t.sheenRoughnessMap.isTexture===!0?r=s.mul(this.getTexture(n).a):r=s,r=r.clamp(1e-4,1)}else if(n===i.ANISOTROPY)if(t.anisotropyMap&&t.anisotropyMap.isTexture===!0){let s=this.getTexture(n);r=mI(tx.x,tx.y,tx.y.negate(),tx.x).mul(s.rg.mul(2).sub(dt(1)).normalize().mul(s.b))}else r=tx;else if(n===i.IRIDESCENCE_THICKNESS){let s=mr("1","float",t.iridescenceThicknessRange);if(t.iridescenceThicknessMap){let o=mr("0","float",t.iridescenceThicknessRange);r=s.sub(o).mul(this.getTexture(n).g).add(o)}else r=s}else if(n===i.TRANSMISSION){let s=this.getFloat(n);t.transmissionMap?r=s.mul(this.getTexture(n).r):r=s}else if(n===i.THICKNESS){let s=this.getFloat(n);t.thicknessMap?r=s.mul(this.getTexture(n).g):r=s}else if(n===i.IOR)r=this.getFloat(n);else if(n===i.LIGHT_MAP)t.lightMap?r=this.getTexture(n).rgb.mul(this.getFloat("lightMapIntensity")):r=pe(0);else if(n===i.AO)t.aoMap?r=this.getTexture(n).r.sub(1).mul(this.getFloat("aoMapIntensity")).add(1):r=oe(1);else if(n===i.LINE_DASH_OFFSET)r=t.dashOffset?this.getFloat(n):oe(0);else{let s=this.getNodeType(e);r=this.getCache(n,s)}return r}};at.ALPHA_TEST="alphaTest";at.COLOR="color";at.OPACITY="opacity";at.SHININESS="shininess";at.SPECULAR="specular";at.SPECULAR_STRENGTH="specularStrength";at.SPECULAR_INTENSITY="specularIntensity";at.SPECULAR_COLOR="specularColor";at.REFLECTIVITY="reflectivity";at.ROUGHNESS="roughness";at.METALNESS="metalness";at.NORMAL="normal";at.CLEARCOAT="clearcoat";at.CLEARCOAT_ROUGHNESS="clearcoatRoughness";at.CLEARCOAT_NORMAL="clearcoatNormal";at.EMISSIVE="emissive";at.ROTATION="rotation";at.SHEEN="sheen";at.SHEEN_ROUGHNESS="sheenRoughness";at.ANISOTROPY="anisotropy";at.IRIDESCENCE="iridescence";at.IRIDESCENCE_IOR="iridescenceIOR";at.IRIDESCENCE_THICKNESS="iridescenceThickness";at.IOR="ior";at.TRANSMISSION="transmission";at.THICKNESS="thickness";at.ATTENUATION_DISTANCE="attenuationDistance";at.ATTENUATION_COLOR="attenuationColor";at.LINE_SCALE="scale";at.LINE_DASH_SIZE="dashSize";at.LINE_GAP_SIZE="gapSize";at.LINE_WIDTH="linewidth";at.LINE_DASH_OFFSET="dashOffset";at.POINT_SIZE="size";at.DISPERSION="dispersion";at.LIGHT_MAP="light";at.AO="ao";var sre=xt(at,at.ALPHA_TEST),ore=xt(at,at.COLOR),are=xt(at,at.SHININESS),lre=xt(at,at.EMISSIVE),Xz=xt(at,at.OPACITY),cre=xt(at,at.SPECULAR),KU=xt(at,at.SPECULAR_INTENSITY),ure=xt(at,at.SPECULAR_COLOR),sS=xt(at,at.SPECULAR_STRENGTH),YR=xt(at,at.REFLECTIVITY),hre=xt(at,at.ROUGHNESS),fre=xt(at,at.METALNESS),dre=xt(at,at.NORMAL),pre=xt(at,at.CLEARCOAT),mre=xt(at,at.CLEARCOAT_ROUGHNESS),Are=xt(at,at.CLEARCOAT_NORMAL),gre=xt(at,at.ROTATION),vre=xt(at,at.SHEEN),_re=xt(at,at.SHEEN_ROUGHNESS),xre=xt(at,at.ANISOTROPY),yre=xt(at,at.IRIDESCENCE),bre=xt(at,at.IRIDESCENCE_IOR),wre=xt(at,at.IRIDESCENCE_THICKNESS),Sre=xt(at,at.TRANSMISSION),Tre=xt(at,at.THICKNESS),Ere=xt(at,at.IOR),Mre=xt(at,at.ATTENUATION_DISTANCE),Cre=xt(at,at.ATTENUATION_COLOR),$z=xt(at,at.LINE_SCALE),Yz=xt(at,at.LINE_DASH_SIZE),Zz=xt(at,at.LINE_GAP_SIZE),m4=xt(at,at.LINE_WIDTH),Kz=xt(at,at.LINE_DASH_OFFSET),Rre=xt(at,at.POINT_SIZE),Ire=xt(at,at.DISPERSION),Qz=xt(at,at.LIGHT_MAP),Pre=xt(at,at.AO),tx=Xt(new Oe).onReference(function(i){return i.material}).onRenderUpdate(function({material:i}){this.value.set(i.anisotropy*Math.cos(i.anisotropyRotation),i.anisotropy*Math.sin(i.anisotropyRotation))}),Lre=me(i=>i.context.setupModelViewProjection(),"vec4").once()().toVarying("v_modelViewProjection"),el=class i extends Kt{static get type(){return"EventNode"}constructor(e,t){super("void"),this.eventType=e,this.callback=t,e===i.OBJECT?this.updateType=yn.OBJECT:e===i.MATERIAL?this.updateType=yn.RENDER:e===i.FRAME?this.updateType=yn.FRAME:e===i.BEFORE_OBJECT?this.updateBeforeType=yn.OBJECT:e===i.BEFORE_MATERIAL?this.updateBeforeType=yn.RENDER:e===i.BEFORE_FRAME&&(this.updateBeforeType=yn.FRAME)}update(e){this.callback(e)}updateBefore(e){this.callback(e)}};el.OBJECT="object";el.MATERIAL="material";el.FRAME="frame";el.BEFORE_OBJECT="beforeObject";el.BEFORE_MATERIAL="beforeMaterial";el.BEFORE_FRAME="beforeFrame";var wx=(i,e)=>new el(i,e).toStack(),DS=i=>wx(el.OBJECT,i),FEe=i=>wx(el.MATERIAL,i),Dre=i=>wx(el.FRAME,i),BEe=i=>wx(el.BEFORE_OBJECT,i),OEe=i=>wx(el.BEFORE_MATERIAL,i),UEe=i=>wx(el.BEFORE_FRAME,i),QU=class extends Qd{static get type(){return"StorageArrayElementNode"}constructor(e,t){super(e,t),this.isStorageArrayElementNode=!0}set storageBufferNode(e){this.node=e}get storageBufferNode(){return this.node}getMemberType(e,t){let n=this.storageBufferNode.structTypeNode;return n?n.getMemberType(e,t):"void"}setup(e){return e.isAvailable("storageBuffer")===!1&&this.node.isPBO===!0&&e.setupPBO(this.node),super.setup(e)}generate(e,t){let n,r=e.isContextAssign();if(e.isAvailable("storageBuffer")===!1?this.node.isPBO===!0&&r!==!0&&(this.node.value.isInstancedBufferAttribute||e.shaderStage!=="compute")?n=e.generatePBO(this):n=this.node.build(e):n=super.generate(e),r!==!0){let s=this.getNodeType(e);n=e.format(n,s,t)}return n}},kEe=$n(QU).setParameterLength(2),JU=class extends mS{static get type(){return"StorageBufferNode"}constructor(e,t=null,n=0){let r,s=null;t&&t.isStructTypeNode?(r="struct",s=t,(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)&&(n=e.count)):t===null&&(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)?(r=$te(e.itemSize),n=e.count):r=t,super(e,r,n),this.isStorageBufferNode=!0,this.structTypeNode=s,this.access=$o.READ_WRITE,this.isAtomic=!1,this.isPBO=!1,this._attribute=null,this._varying=null,this.global=!0,e.isStorageBufferAttribute!==!0&&e.isStorageInstancedBufferAttribute!==!0&&(e.isInstancedBufferAttribute?e.isStorageInstancedBufferAttribute=!0:e.isStorageBufferAttribute=!0)}getHash(e){let t;if(this.bufferCount===0){let n=e.globalCache.getData(this.value);n===void 0&&(n={node:this},e.globalCache.setData(this.value,n)),t=n.node.id}else t=this.id;return String(t)}getInputType(){return this.value.isIndirectStorageBufferAttribute?"indirectStorageBuffer":"storageBuffer"}element(e){return kEe(this,e)}setPBO(e){return this.isPBO=e,this}getPBO(){return this.isPBO}setAccess(e){return this.access=e,this}toReadOnly(){return this.setAccess($o.READ_ONLY)}setAtomic(e){return this.isAtomic=e,this}toAtomic(){return this.setAtomic(!0)}getAttributeData(){return this._attribute===null&&(this._attribute=Iz(this.value),this._varying=bm(this._attribute)),{attribute:this._attribute,varying:this._varying}}generateNodeType(e){if(this.structTypeNode!==null)return this.structTypeNode.getNodeType(e);if(e.isAvailable("storageBuffer")||e.isAvailable("indirectStorageBuffer"))return super.generateNodeType(e);let{attribute:t}=this.getAttributeData();return t.getNodeType(e)}getMemberType(e,t){return this.structTypeNode!==null?this.structTypeNode.getMemberType(e,t):"void"}generate(e){if(this.structTypeNode!==null&&this.structTypeNode.build(e),e.isAvailable("storageBuffer")||e.isAvailable("indirectStorageBuffer"))return super.generate(e);let{attribute:t,varying:n}=this.getAttributeData(),r=n.build(e);return e.registerTransform(r,t),r}},Am=(i,e=null,t=0)=>new JU(i,e,t),e7=new WeakMap,Fee=new WeakMap,t7=new WeakMap;function Nre(i,e){let t,n=Math.max(e.count,1);if(e.isStorageInstancedBufferAttribute===!0)t=Am(e,"mat4",n).element(Xu);else if(n*16*4<=i.getUniformBufferLimit())t=bx(e.array,"mat4",n).element(Xu);else{let o=e7.get(e);o||(o=new Nh(e.array,16,1),e7.set(e,o));let a=e.usage===dg?Pz:TI,l=[a(o,"vec4",16,0),a(o,"vec4",16,4),a(o,"vec4",16,8),a(o,"vec4",16,12)];t=mm(...l)}return t}function zEe(i,e,t){let n=t7.get(i);if(n===void 0){let r=e.clone();n={previousInstanceMatrix:r,node:Nre(t,r)},t7.set(i,n)}return n.node}var Jz=h1("vec3","vInstanceColor"),Fre=me(([i,e=null],t)=>{let n=i.isStorageInstancedBufferAttribute===!0,r=e&&e.isStorageInstancedBufferAttribute===!0,s=Nre(t,i),o=null;n||Math.max(i.count,1)*16*4>t.getUniformBufferLimit()&&(o=e7.get(i));let a=null,l=null;if(e)if(r)a=Am(e,"vec3",Math.max(e.count,1)).element(Xu);else{let u=Fee.get(e);u||(u=new Kl(e.array,3),Fee.set(e,u)),l=u;let f=e.usage===dg?Pz:TI;a=pe(f(u,"vec3",3,0))}(o!==null||l!==null)&&Dre(()=>{o!==null&&(o.clearUpdateRanges(),o.updateRanges.push(...i.updateRanges),i.version!==o.version&&(o.version=i.version)),e&&l!==null&&(l.clearUpdateRanges(),l.updateRanges.push(...e.updateRanges),e.version!==l.version&&(l.version=e.version))});let c=s.mul(Mr).xyz;if(Mr.assign(c),t.needsPreviousData()){let u=t.object;DS(({object:d})=>{t7.get(d).previousInstanceMatrix.array.set(i.array)});let f=zEe(u,i,t);r1.assign(f.mul(r1).xyz)}if(t.hasGeometryAttribute("normal")){let u=Gz(ba,s);ba.assign(u)}a!==null&&Jz.assign(a)},"void"),Bre=me(([i])=>{let{instanceMatrix:e,instanceColor:t}=i;Fre(e,t)},"void"),VEe=me(([i,e])=>{let t=de(n1(_s(i),0).x).toConst(),n=de(e),r=n.mod(t).toConst(),s=n.div(t).toConst();return _s(i,kr(r,s))}),GEe=me(([i,e])=>{let t=de(n1(_s(i),0).x).toConst(),n=de(e).mod(t).toConst(),r=de(e).div(t).toConst();return _s(i,kr(n,r)).x}),eV=h1("vec4","vBatchColor"),Ore=me(([i],e)=>{let t=e.getDrawIndex()===null?Xu:bie,n=GEe(i._indirectTexture,de(t)),r=i._matricesTexture,s=de(n1(_s(r),0).x).toConst(),o=oe(n).mul(4).toInt().toConst(),a=o.mod(s).toConst(),l=o.div(s).toConst(),c=mm(_s(r,kr(a,l)),_s(r,kr(a.add(1),l)),_s(r,kr(a.add(2),l)),_s(r,kr(a.add(3),l))),u=i._colorsTexture;if(u!==null){let y=VEe(u,n);eV.assign(y)}let f=To(c);Mr.assign(c.mul(Mr));let d=ba.div(pe(f[0].dot(f[0]),f[1].dot(f[1]),f[2].dot(f[2]))),A=f.mul(d).xyz;ba.assign(A),e.hasGeometryAttribute("tangent")&&_m.mulAssign(f)},"void"),A4=new WeakMap,g4=new WeakMap;function tV(i,e,t,n,r,s){let o=i.element(r.x),a=i.element(r.y),l=i.element(r.z),c=i.element(r.w),u=t.mul(e),f=Ls(o.mul(s.x).mul(u),a.mul(s.y).mul(u),l.mul(s.z).mul(u),c.mul(s.w).mul(u));return n.mul(f).xyz}function Ure(i,e,t,n,r,s,o){let a=i.element(s.x),l=i.element(s.y),c=i.element(s.z),u=i.element(s.w),f=Ls(o.x.mul(a),o.y.mul(l),o.z.mul(c),o.w.mul(u));f=r.mul(f).mul(n);let d=f.transformDirection(e).xyz,A=f.transformDirection(t).xyz;return{skinNormal:d,skinTangent:A}}function kre(i,e,t,n,r){let s=i.skeleton,o=g4.get(s);if(o===void 0){s.update();let a=new Float32Array(s.boneMatrices);o={previousBoneMatrices:a,node:bx(a,"mat4",s.bones.length)},g4.set(s,o)}return tV(o.node,r1,e,t,n,r)}var zre=me(([i],e)=>{let t=hc("skinIndex","uvec4"),n=hc("skinWeight","vec4"),r=mr("bindMatrix","mat4"),s=mr("bindMatrixInverse","mat4"),o=jie("skeleton.boneMatrices","mat4",i.skeleton.bones.length);if(DS(({object:l,frameId:c})=>{let u=l.skeleton;if(A4.get(u)!==c){A4.set(u,c);let f=g4.get(u);f!==void 0&&f.previousBoneMatrices.set(u.boneMatrices),u.update()}}),e.needsPreviousData()){let l=kre(i,r,s,t,n);r1.assign(l)}let a=tV(o,Mr,r,s,t,n);if(Mr.assign(a),e.hasGeometryAttribute("normal")){let{skinNormal:l,skinTangent:c}=Ure(o,ba,_m,r,s,t,n);ba.assign(l),e.hasGeometryAttribute("tangent")&&_m.assign(c)}},"void"),qEe=me(([i,e=null],t)=>{let n=Am(new Kl(i.geometry.getAttribute("position").array,3),"vec3").setPBO(!0).toReadOnly().element(Xu).toVar(),r=Am(new Kl(new Uint32Array(i.geometry.getAttribute("skinIndex").array),4),"uvec4").setPBO(!0).toReadOnly().element(Xu).toVar(),s=Am(new Kl(i.geometry.getAttribute("skinWeight").array,4),"vec4").setPBO(!0).toReadOnly().element(Xu).toVar(),o=Xt(i.bindMatrix,"mat4"),a=Xt(i.bindMatrixInverse,"mat4"),l=bx(i.skeleton.boneMatrices,"mat4",i.skeleton.bones.length),c=i.skeleton;if(DS(({frameId:f})=>{if(A4.get(c)!==f){A4.set(c,f);let d=g4.get(c);d!==void 0&&d.previousBoneMatrices.set(c.boneMatrices),c.update()}}),t.needsPreviousData()){let f=kre(i,o,a,r,s);r1.assign(f)}let u=tV(l,n,o,a,r,s);if(e!==null&&e.assign(u),t.hasGeometryAttribute("normal")){let{skinNormal:f,skinTangent:d}=Ure(l,ba,_m,o,a,r,s);ba.assign(f),t.hasGeometryAttribute("tangent")&&_m.assign(d)}return u}),n7=class extends Kt{static get type(){return"LoopNode"}constructor(e=[]){super("void"),this.params=e}getVarName(e){return String.fromCharCode(105+e)}getProperties(e){let t=e.getNodeProperties(this);if(t.stackNode!==void 0)return t;let n={};for(let a=0,l=this.params.length-1;a<l;a++){let c=this.params[a],u=c.isNode!==!0&&c.name||this.getVarName(a),f=c.isNode!==!0&&c.type||"int";n[u]=uc(u,f)}let r=e.addStack(),s=this.params[this.params.length-1](n);t.returnsNode=s.context({nodeLoop:s}),t.stackNode=r;let o=this.params[0];if(o.isNode!==!0&&typeof o.update=="function"){let a=me(this.params[0].update)(n);t.updateNode=a.context({nodeLoop:a})}return e.removeStack(),t}setup(e){if(this.getProperties(e),e.fnCall){let t=e.getDataFromNode(e.fnCall.shaderNode);t.hasLoop=!0}}generate(e){let t=this.getProperties(e),n=this.params,r=t.stackNode;for(let o=0,a=n.length-1;o<a;o++){let l=n[o],c=!1,u=null,f=null,d=null,A=null,y=null,w=null;l.isNode?l.getNodeType(e)==="bool"?(c=!0,A="bool",f=l.build(e,A)):(A="int",d=this.getVarName(o),u="0",f=l.build(e,A),y="<"):(A=l.type||"int",d=l.name||this.getVarName(o),u=l.start,f=l.end,y=l.condition,w=l.update,typeof u=="number"?u=e.generateConst(A,u):u&&u.isNode&&(u=u.build(e,A)),typeof f=="number"?f=e.generateConst(A,f):f&&f.isNode&&(f=f.build(e,A)),u!==void 0&&f===void 0?(u=u+" - 1",f="0",y=">="):f!==void 0&&u===void 0&&(u="0",y="<"),y===void 0&&(Number(u)>Number(f)?y=">=":y="<"));let S;if(c)S=`while ( ${f} )`;else{let T={start:u,end:f},R=T.start,P=T.end,I,F=()=>y.includes("<")?"+=":"-=";if(w!=null)switch(typeof w){case"function":I=e.flowStagesNode(t.updateNode,"void").code.replace(/\t|;/g,"");break;case"number":I=d+" "+F()+" "+e.generateConst(A,w);break;case"string":I=d+" "+w;break;default:w.isNode?I=d+" "+F()+" "+w.build(e):(ze("TSL: 'Loop( { update: ... } )' is not a function, string or number.",this.stackTrace),I="break /* invalid update */")}else A==="int"||A==="uint"?w=y.includes("<")?"++":"--":w=F()+" 1.",I=d+" "+w;let D=e.getVar(A,d)+" = "+R,L=d+" "+y+" "+P;S=`for ( ${D}; ${L}; ${I} )`}e.addFlowCode((o===0?`4152+`,VA(o)}return n}},Uie=(i,e=null)=>new zU(Ht(i),e).toStack();Ue("debug",Uie);var m4=class extends la{constructor(){super(),this._renderer=null,this.currentFrame=null}get nodeFrame(){return this._renderer._nodes.nodeFrame}setRenderer(e){return this._renderer=e,this}getRenderer(){return this._renderer}init(){}begin(){}finish(){}inspect(){}computeAsync(){}beginCompute(){}finishCompute(){}beginRender(){}finishRender(){}copyTextureToTexture(){}copyFramebufferToTexture(){}},VU=class extends Kt{static get type(){return"InspectorNode"}constructor(e,t="",n=null){super(),this.node=e,this.name=t,this.callback=n,this.updateType=yn.FRAME,this.isInspectorNode=!0}getName(){return this.name||this.node.name}update(e){e.renderer.inspector.inspect(this)}generateNodeType(e){return this.node.getNodeType(e)}setup(e){let t=this.node;return e.context.inspector===!0&&this.callback!==null&&(t=this.callback(t)),e.renderer.backend.isWebGPUBackend!==!0&&e.renderer.inspector.constructor!==m4&&ni('TSL: ".toInspector()" is only available with WebGPU.'),t}};function kie(i,e="",t=null){return i=Ht(i),i.before(new VU(i,e,t))}Ue("toInspector",kie);function AEe(i){Xe("TSL: AddNodeElement has been removed in favor of tree-shaking. Trying add",i)}var A4=class extends Kt{static get type(){return"AttributeNode"}constructor(e,t=null){super(t),this.global=!0,this._attributeName=e}getHash(e){return this.getAttributeName(e)}generateNodeType(e){let t=this.nodeType;if(t===null){let n=this.getAttributeName(e);if(e.hasGeometryAttribute(n)){let r=e.geometry.getAttribute(n);t=e.getTypeFromAttribute(r)}else t="float"}return t}setAttributeName(e){return this._attributeName=e,this}getAttributeName(){return this._attributeName}generate(e){let t=this.getAttributeName(e),n=this.getNodeType(e);if(e.hasGeometryAttribute(t)===!0){let s=e.geometry.getAttribute(t),o=e.getTypeFromAttribute(s),a=e.getAttribute(t,o);return e.shaderStage==="vertex"?e.format(a.name,o,n):bm(this).build(e,n)}else return Xe(`AttributeNode: Vertex attribute "${t}" not found on geometry.`),e.generateConst(n)}serialize(e){super.serialize(e),e.global=this.global,e._attributeName=this._attributeName}deserialize(e){super.deserialize(e),this.global=e.global,this._attributeName=e._attributeName}},fc=(i,e=null)=>new A4(i,e),Ui=(i=0)=>fc("uv"+(i>0?i:""),"vec2"),GU=class extends Kt{static get type(){return"TextureSizeNode"}constructor(e,t=null){super("uvec2"),this.isTextureSizeNode=!0,this.textureNode=e,this.levelNode=t}generate(e,t){let n=this.textureNode.build(e,"property"),r=this.levelNode===null?"0":this.levelNode.build(e,"int");return e.format(`${e.getMethod("textureDimensions")}( ${n}, ${r} )`,this.getNodeType(e),t)}},n1=$n(GU).setParameterLength(1,2),qU=class extends e1{static get type(){return"MaxMipLevelNode"}constructor(e){super(0),this._textureNode=e,this.updateType=yn.FRAME}get textureNode(){return this._textureNode}get texture(){return this._textureNode.value}update(){let e=this.texture,t=e.images,n=t&&t.length>0?t[0]&&t[0].image||t[0]:e.image;if(n&&n.width!==void 0){let{width:r,height:s}=n;this.value=Math.log2(Math.max(r,s))}}},Hz=$n(qU).setParameterLength(1),g4=class extends Error{constructor(e,t=null){super(e),this.name="NodeError",this.stackTrace=t}},Wz=new Hs,lu=class extends e1{static get type(){return"TextureNode"}constructor(e=Wz,t=null,n=null,r=null){super(e),this.isTextureNode=!0,this.uvNode=t,this.levelNode=n,this.biasNode=r,this.compareNode=null,this.depthNode=null,this.gradNode=null,this.gatherNode=null,this.offsetNode=null,this.sampler=!0,this.updateMatrix=!1,this.updateType=yn.NONE,this.referenceNode=null,this._value=e,this._matrixUniform=null,this._flipYUniform=null,this.setUpdateMatrix(t===null)}set value(e){this.referenceNode?this.referenceNode.value=e:this._value=e}get value(){return this.referenceNode?this.referenceNode.value:this._value}getUniformHash(){return this.value.uuid}generateNodeType(){return this.value.isDepthTexture===!0?this.gatherNode===null?"float":"vec4":this.value.type===xi?"uvec4":this.value.type===Zr?"ivec4":"vec4"}getInputType(){return"texture"}getDefaultUV(){return Ui(this.value.channel)}updateReference(){return this.value}getTransformedUV(e){return this._matrixUniform===null&&(this._matrixUniform=Xt(this.value.matrix)),this._matrixUniform.mul(pe(e,1)).xy}setUpdateMatrix(e){return this.updateMatrix=e,this}setupUV(e,t){return e.isFlipY()&&(this._flipYUniform===null&&(this._flipYUniform=Xt(!1)),t=t.toVar(),this.sampler?t=this._flipYUniform.select(t.flipY(),t):t=this._flipYUniform.select(t.setY(de(n1(this,this.levelNode).y).sub(t.y).sub(1)),t)),t}setup(e){let t=e.getNodeProperties(this);t.referenceNode=this.referenceNode;let n=this.value;if(!n||n.isTexture!==!0)throw new g4("THREE.TSL: `texture( value )` function expects a valid instance of THREE.Texture().",this.stackTrace);let r=me(()=>{let l=this.uvNode;return(l===null||e.context.forceUVContext===!0)&&e.context.getUV&&(l=e.context.getUV(this,e)),l||(l=this.getDefaultUV()),this.updateMatrix===!0&&(l=this.getTransformedUV(l)),l=this.setupUV(e,l),this.updateType=this._matrixUniform!==null||this._flipYUniform!==null?yn.OBJECT:yn.NONE,l})(),s=this.levelNode;s===null&&e.context.getTextureLevel&&(s=e.context.getTextureLevel(this));let o=null,a=null;if(this.compareNode!==null)if(e.renderer.hasCompatibility(Od.TEXTURE_COMPARE))o=this.compareNode;else{let l=n.compareFunction;l===null||l===d_||l===Zh||l===fg||l===Ou?a=this.compareNode:(o=this.compareNode,ni('TSL: Only "LessCompare", "LessEqualCompare", "GreaterCompare" and "GreaterEqualCompare" are supported for depth texture comparison fallback.'))}t.uvNode=r,t.levelNode=s,t.biasNode=this.biasNode,t.compareNode=o,t.compareStepNode=a,t.gradNode=this.gradNode,t.gatherNode=this.gatherNode,t.depthNode=this.depthNode,t.offsetNode=this.offsetNode}generateUV(e,t){return t.build(e,this.sampler===!0?"vec2":"ivec2")}generateOffset(e,t){return t.build(e,"ivec2")}generateSnippet(e,t,n,r,s,o,a,l,c,u,f){let d=this.value,A;return s?A=e.generateTextureBias(d,t,n,s,o,u):l?A=e.generateTextureGrad(d,t,n,l,o,u):c?a?A=e.generateTextureGatherCompare(d,t,n,a,o,u,f):A=e.generateTextureGather(d,t,n,c,o,u,f):a?A=e.generateTextureCompare(d,t,n,a,o,u):this.sampler===!1?A=e.generateTextureLoad(d,t,n,r,o,u):r?A=e.generateTextureLevel(d,t,n,r,o,u):A=e.generateTexture(d,t,n,o,u),A}generate(e,t){let n=this.value,r=e.getNodeProperties(this),s=super.generate(e,"property");if(/^sampler/.test(t))return s+"_sampler";if(e.isReference(t))return s;{let o=e.getDataFromNode(this),a=this.getNodeType(e),l=o.propertyName;if(l===void 0){let{uvNode:u,levelNode:f,biasNode:d,compareNode:A,compareStepNode:y,depthNode:w,gradNode:S,gatherNode:T,offsetNode:R}=r,P=this.generateUV(e,u),I=f?f.build(e,"float"):null,F=d?d.build(e,"float"):null,D=w?w.build(e,"int"):null,L=A?A.build(e,"float"):null,C=y?y.build(e,"float"):null,B=S?[S[0].build(e,"vec2"),S[1].build(e,"vec2")]:null,k=T?T.build(e,"int"):null,z=R?this.generateOffset(e,R):null,G=this._flipYUniform?this._flipYUniform.build(e,"bool"):null;k&&(a="vec4");let W=D;W===null&&n.isArrayTexture&&this.isTexture3DNode!==!0&&(W="0");let Y=e.getVarFromNode(this);l=e.getPropertyName(Y);let H=this.generateSnippet(e,s,P,I,F,W,L,B,k,z,G);if(C!==null){let $=n.compareFunction;$===fg||$===Ou?H=t1(hc(H,a),hc(C,"float")).build(e,a):H=t1(hc(C,"float"),hc(H,a)).build(e,a)}e.addLineFlowCode(`${l} = ${H}`,this),o.snippet=H,o.propertyName=l}let c=l;return e.needsToWorkingColorSpace(n)&&(c=MI(hc(c,a),n.colorSpace).setup(e).build(e,a)),e.format(c,a,t)}}setSampler(e){return this.sampler=e,this}getSampler(){return this.sampler}sample(e){let t=this.clone();return t.uvNode=Ht(e),t.referenceNode=this.getBase(),Ht(t)}load(e){return this.sample(e).setSampler(!1)}blur(e){let t=this.clone();t.biasNode=Ht(e).mul(Hz(t)),t.referenceNode=this.getBase();let n=t.value;return t.generateMipmaps===!1&&(n&&n.generateMipmaps===!1||n.minFilter===Ti||n.magFilter===Ti)&&(Xe("TSL: texture().blur() requires mipmaps and sampling. Use .generateMipmaps=true and .minFilter/.magFilter=THREE.LinearFilter in the Texture."),t.biasNode=null),Ht(t)}level(e){let t=this.clone();return t.levelNode=Ht(e),t.referenceNode=this.getBase(),Ht(t)}size(e){return n1(this,e)}bias(e){let t=this.clone();return t.biasNode=Ht(e),t.referenceNode=this.getBase(),Ht(t)}getBase(){return this.referenceNode?this.referenceNode.getBase():this}compare(e){let t=this.clone();return t.compareNode=Ht(e),t.referenceNode=this.getBase(),Ht(t)}grad(e,t){let n=this.clone();return n.gradNode=[Ht(e),Ht(t)],n.referenceNode=this.getBase(),Ht(n)}gather(e=0){let t=this.clone();return t.gatherNode=Ht(e),t.referenceNode=this.getBase(),Ht(t)}depth(e){let t=this.clone();return t.depthNode=Ht(e),t.referenceNode=this.getBase(),Ht(t)}offset(e){let t=this.clone();return t.offsetNode=Ht(e),t.referenceNode=this.getBase(),Ht(t)}serialize(e){super.serialize(e),e.value=this.value.toJSON(e.meta).uuid,e.sampler=this.sampler,e.updateMatrix=this.updateMatrix,e.updateType=this.updateType}deserialize(e){super.deserialize(e),this.value=e.meta.textures[e.value],this.sampler=e.sampler,this.updateMatrix=e.updateMatrix,this.updateType=e.updateType}update(){let e=this.value,t=this._matrixUniform;t!==null&&(t.value=e.matrix),e.matrixAutoUpdate===!0&&e.updateMatrix();let n=this._flipYUniform;n!==null&&(n.value=e.image instanceof ImageBitmap&&e.flipY===!0||e.isRenderTargetTexture===!0||e.isFramebufferTexture===!0||e.isDepthTexture===!0)}clone(){let e=new this.constructor(this.value,this.uvNode,this.levelNode,this.biasNode);return e.sampler=this.sampler,e.depthNode=this.depthNode,e.compareNode=this.compareNode,e.gradNode=this.gradNode,e.gatherNode=this.gatherNode,e.offsetNode=this.offsetNode,e}},gEe=$n(lu).setParameterLength(1,4).setName("texture"),fi=(i=Wz,e=null,t=null,n=null)=>{let r;return i&&i.isTextureNode===!0?(r=Ht(i.clone()),r.referenceNode=i.getBase(),e!==null&&(r.uvNode=Ht(e)),t!==null&&(r.levelNode=Ht(t)),n!==null&&(r.biasNode=Ht(n))):r=gEe(i,e,t,n),r},vEe=(i=Wz)=>fi(i),_s=(...i)=>fi(...i).setSampler(!1),_Ee=(i,e,t)=>fi(i,e).level(t),xEe=i=>(i.isNode===!0?i:fi(i)).convert("sampler"),yEe=i=>(i.isNode===!0?i:fi(i)).convert("samplerComparison"),_S=class extends e1{static get type(){return"BufferNode"}constructor(e,t,n=0){super(e,t),this.isBufferNode=!0,this.bufferType=t,this.bufferCount=n,this.updateRanges=[]}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}getElementType(e){return this.getNodeType(e)}getInputType(){return"buffer"}},Sx=(i,e,t)=>new _S(i,e,t),HU=class extends Kd{static get type(){return"UniformArrayElementNode"}constructor(e,t){super(e,t),this.isArrayBufferElementNode=!0}generate(e){let t=super.generate(e),n=this.getNodeType(e),r=this.node.getPaddedType();return e.format(t,r,n)}},WU=class extends _S{static get type(){return"UniformArrayNode"}constructor(e,t=null){super(null),this.array=e,this.elementType=t===null?dm(e[0]):t,this.paddedType=this.getPaddedType(),this.updateType=yn.RENDER,this.isArrayBufferNode=!0}generateNodeType(){return this.paddedType}getElementType(){return this.elementType}getPaddedType(){let e=this.elementType,t="vec4";return e==="mat2"?t="mat2":/mat/.test(e)===!0?t="mat4":e.charAt(0)==="i"?t="ivec4":e.charAt(0)==="u"&&(t="uvec4"),t}update(){let{array:e,value:t}=this,n=this.elementType;if(n==="float"||n==="int"||n==="uint")for(let r=0;r<e.length;r++){let s=r*4;t[s]=e[r]}else if(n==="color")for(let r=0;r<e.length;r++){let s=r*4,o=e[r];t[s]=o.r,t[s+1]=o.g,t[s+2]=o.b||0}else if(n==="mat2")for(let r=0;r<e.length;r++){let s=r*4,o=e[r];t[s]=o.elements[0],t[s+1]=o.elements[1],t[s+2]=o.elements[2],t[s+3]=o.elements[3]}else if(n==="mat3")for(let r=0;r<e.length;r++){let s=r*16,o=e[r];t[s]=o.elements[0],t[s+1]=o.elements[1],t[s+2]=o.elements[2],t[s+4]=o.elements[3],t[s+5]=o.elements[4],t[s+6]=o.elements[5],t[s+8]=o.elements[6],t[s+9]=o.elements[7],t[s+10]=o.elements[8],t[s+15]=1}else if(n==="mat4")for(let r=0;r<e.length;r++){let s=r*16,o=e[r];for(let a=0;a<o.elements.length;a++)t[s+a]=o.elements[a]}else for(let r=0;r<e.length;r++){let s=r*4,o=e[r];t[s]=o.x,t[s+1]=o.y,t[s+2]=o.z||0,t[s+3]=o.w||0}}setup(e){let t=this.array.length,n=this.elementType,r=Float32Array,s=this.paddedType,o=e.getTypeLength(s);return n.charAt(0)==="i"&&(r=Int32Array),n.charAt(0)==="u"&&(r=Uint32Array),this.value=new r(t*o),this.bufferCount=t,this.bufferType=s,this.update(),super.setup(e)}element(e){return new HU(this,Ht(e))}},Xo=(i,e)=>new WU(i,e),jU=class extends Kt{constructor(e){super("float"),this.name=e,this.isBuiltinNode=!0}generate(){return this.name}},np=$n(jU).setParameterLength(1),kw,zw,Yo=class i extends Kt{static get type(){return"ScreenNode"}constructor(e){super(),this.scope=e,this._output=null,this.isViewportNode=!0}generateNodeType(){return this.scope===i.DPR?"float":this.scope===i.VIEWPORT?"vec4":"vec2"}getUpdateType(){let e=yn.NONE;return(this.scope===i.SIZE||this.scope===i.VIEWPORT||this.scope===i.DPR)&&(e=yn.RENDER),this.updateType=e,e}update({renderer:e}){let t=e.getRenderTarget();this.scope===i.VIEWPORT?t!==null?zw.copy(t.viewport):(e.getViewport(zw),zw.multiplyScalar(e.getPixelRatio())):this.scope===i.DPR?this._output.value=e.getPixelRatio():t!==null?(kw.width=t.width,kw.height=t.height):e.getDrawingBufferSize(kw)}setup(){let e=this.scope,t=null;return e===i.SIZE?t=Xt(kw||(kw=new Oe)):e===i.VIEWPORT?t=Xt(zw||(zw=new xn)):e===i.DPR?t=Xt(1):t=dt(f1.div(i1)),this._output=t,t}generate(e){if(this.scope===i.COORDINATE){let t=e.getFragCoord();if(e.isFlipY()){let n=e.getNodeProperties(i1).outputNode.build(e);t=`${e.getType("vec2")}( ${t}.x, ${n}.y - ${t}.y )`}return t}return super.generate(e)}};Yo.COORDINATE="coordinate";Yo.VIEWPORT="viewport";Yo.SIZE="size";Yo.UV="uv";Yo.DPR="dpr";var jz=xt(Yo,Yo.DPR),$u=xt(Yo,Yo.UV),i1=xt(Yo,Yo.SIZE),f1=xt(Yo,Yo.COORDINATE),fx=xt(Yo,Yo.VIEWPORT),Xz=fx.zw,zie=f1.sub(fx.xy),bEe=zie.div(Xz),wEe=me(()=>(Xe('TSL: "viewportResolution" is deprecated. Use "screenSize" instead.',new es),i1),"vec2").once()(),DO=null,pR=null,NO=null,mR=null,FO=null,AR=null,BO=null,gR=null,OO=null,vR=null,UO=null,_R=null,kO=null,xR=null,wm=Xt(0,"uint").setName("u_cameraIndex").setGroup(yI("cameraIndex")).toVarying("v_cameraIndex"),cm=Xt("float").setName("cameraNear").setGroup(Jt).onRenderUpdate(({camera:i})=>i.near),um=Xt("float").setName("cameraFar").setGroup(Jt).onRenderUpdate(({camera:i})=>i.far),Ja=me(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.projectionMatrix);pR===null?pR=Xo(t).setGroup(Jt).setName("cameraProjectionMatrices"):pR.array=t,e=pR.element(i.isMultiViewCamera?np("gl_ViewID_OVR"):wm)}else DO===null&&(DO=Xt(i.projectionMatrix).setName("cameraProjectionMatrix").setGroup(Jt).onRenderUpdate(({camera:t})=>t.projectionMatrix)),e=DO;return e}).once()(),Vie=me(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.projectionMatrixInverse);mR===null?mR=Xo(t).setGroup(Jt).setName("cameraProjectionMatricesInverse"):mR.array=t,e=mR.element(i.isMultiViewCamera?np("gl_ViewID_OVR"):wm)}else NO===null&&(NO=Xt(i.projectionMatrixInverse).setName("cameraProjectionMatrixInverse").setGroup(Jt).onRenderUpdate(({camera:t})=>t.projectionMatrixInverse)),e=NO;return e}).once()(),Sm=me(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.matrixWorldInverse);AR===null?AR=Xo(t).setGroup(Jt).setName("cameraViewMatrices"):AR.array=t,e=AR.element(i.isMultiViewCamera?np("gl_ViewID_OVR"):wm)}else FO===null&&(FO=Xt(i.matrixWorldInverse).setName("cameraViewMatrix").setGroup(Jt).onRenderUpdate(({camera:t})=>t.matrixWorldInverse)),e=FO;return e}).once()(),BS=me(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.matrixWorld);gR===null?gR=Xo(t).setGroup(Jt).setName("cameraWorldMatrices"):gR.array=t,e=gR.element(i.isMultiViewCamera?np("gl_ViewID_OVR"):wm)}else BO===null&&(BO=Xt(i.matrixWorld).setName("cameraWorldMatrix").setGroup(Jt).onRenderUpdate(({camera:t})=>t.matrixWorld)),e=BO;return e}).once()(),SEe=me(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.normalMatrix);vR===null?vR=Xo(t).setGroup(Jt).setName("cameraNormalMatrices"):vR.array=t,e=vR.element(i.isMultiViewCamera?np("gl_ViewID_OVR"):wm)}else OO===null&&(OO=Xt(i.normalMatrix).setName("cameraNormalMatrix").setGroup(Jt).onRenderUpdate(({camera:t})=>t.normalMatrix)),e=OO;return e}).once()(),Gie=me(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n=0,r=i.cameras.length;n<r;n++)t.push(new re);_R===null?_R=Xo(t).setGroup(Jt).setName("cameraPositions").onRenderUpdate(({camera:n},r)=>{let s=n.cameras,o=r.array;for(let a=0,l=s.length;a<l;a++)o[a].setFromMatrixPosition(s[a].matrixWorld)}):_R.array=t,e=_R.element(i.isMultiViewCamera?np("gl_ViewID_OVR"):wm)}else UO===null&&(UO=Xt(new re).setName("cameraPosition").setGroup(Jt).onRenderUpdate(({camera:t},n)=>n.value.setFromMatrixPosition(t.matrixWorld))),e=UO;return e}).once()(),TEe=me(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.viewport);xR===null?xR=Xo(t,"vec4").setGroup(Jt).setName("cameraViewports"):xR.array=t,e=xR.element(wm)}else kO===null&&(kO=Ft(0,0,i1.x,i1.y).toConst("cameraViewport")),e=kO;return e}).once()(),Vee=new yl,Ds=class i extends Kt{static get type(){return"Object3DNode"}constructor(e,t=null){super(),this.scope=e,this.object3d=t,this.updateType=yn.OBJECT,this.uniformNode=new e1(null)}generateNodeType(){let e=this.scope;if(e===i.WORLD_MATRIX)return"mat4";if(e===i.POSITION||e===i.VIEW_POSITION||e===i.DIRECTION||e===i.SCALE)return"vec3";if(e===i.RADIUS)return"float"}update(e){let t=this.object3d,n=this.uniformNode,r=this.scope;if(r===i.WORLD_MATRIX)n.value=t.matrixWorld;else if(r===i.POSITION)n.value=n.value||new re,n.value.setFromMatrixPosition(t.matrixWorld);else if(r===i.SCALE)n.value=n.value||new re,n.value.setFromMatrixScale(t.matrixWorld);else if(r===i.DIRECTION)n.value=n.value||new re,t.getWorldDirection(n.value);else if(r===i.VIEW_POSITION){let s=e.camera;n.value=n.value||new re,n.value.setFromMatrixPosition(t.matrixWorld),n.value.applyMatrix4(s.matrixWorldInverse)}else if(r===i.RADIUS){let s=e.object.geometry;s.boundingSphere===null&&s.computeBoundingSphere(),Vee.copy(s.boundingSphere).applyMatrix4(t.matrixWorld),n.value=Vee.radius}}generate(e){let t=this.scope;return t===i.WORLD_MATRIX?this.uniformNode.nodeType="mat4":t===i.POSITION||t===i.VIEW_POSITION||t===i.DIRECTION||t===i.SCALE?this.uniformNode.nodeType="vec3":t===i.RADIUS&&(this.uniformNode.nodeType="float"),this.uniformNode.build(e)}serialize(e){super.serialize(e),e.scope=this.scope}deserialize(e){super.deserialize(e),this.scope=e.scope}};Ds.WORLD_MATRIX="worldMatrix";Ds.POSITION="position";Ds.SCALE="scale";Ds.VIEW_POSITION="viewPosition";Ds.DIRECTION="direction";Ds.RADIUS="radius";var EEe=$n(Ds,Ds.DIRECTION).setParameterLength(1),MEe=$n(Ds,Ds.WORLD_MATRIX).setParameterLength(1),CEe=$n(Ds,Ds.POSITION).setParameterLength(1),REe=$n(Ds,Ds.SCALE).setParameterLength(1),IEe=$n(Ds,Ds.VIEW_POSITION).setParameterLength(1),PEe=$n(Ds,Ds.RADIUS).setParameterLength(1),Pl=class extends Ds{static get type(){return"ModelNode"}constructor(e){super(e)}update(e){this.object3d=e.object,super.update(e)}},LEe=xt(Pl,Pl.DIRECTION),ru=xt(Pl,Pl.WORLD_MATRIX),DEe=xt(Pl,Pl.POSITION),NEe=xt(Pl,Pl.SCALE),FEe=xt(Pl,Pl.VIEW_POSITION),BEe=xt(Pl,Pl.RADIUS),qie=Xt(new Mn).onObjectUpdate(({object:i},e)=>e.value.getNormalMatrix(i.matrixWorld)),OEe=Xt(new cn).onObjectUpdate(({object:i},e)=>e.value.copy(i.matrixWorld).invert()),Tf=me(i=>i.context.modelViewMatrix||Hie).once()().toVar("modelViewMatrix"),Hie=Sm.mul(ru),XU=me(i=>(i.context.isHighPrecisionModelViewMatrix=!0,Xt("mat4").onObjectUpdate(({object:e,camera:t})=>e.modelViewMatrix.multiplyMatrices(t.matrixWorldInverse,e.matrixWorld)))).once()().toVar("highpModelViewMatrix"),$U=me(i=>{let e=i.context.isHighPrecisionModelViewMatrix;return Xt("mat3").onObjectUpdate(({object:t,camera:n})=>(e!==!0&&t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix)))}).once()().toVar("highpModelNormalViewMatrix"),Wie=me(i=>i.shaderStage!=="fragment"?(ni("TSL: `clipSpace` is only available in fragment stage."),Ft()):i.context.clipSpace.toVarying("v_clipSpace")).once()(),ga=fc("position","vec3"),Mr=ga.toVarying("positionLocal"),r1=ga.toVarying("positionPrevious"),bf=me(i=>ru.mul(Mr).xyz.toVarying(i.getSubBuildProperty("v_positionWorld")),"vec3").once(["POSITION"])(),$z=me(()=>Mr.transformDirection(ru).toVarying("v_positionWorldDirection").normalize().toVar("positionWorldDirection"),"vec3").once(["POSITION"])(),xs=me(i=>{if(i.shaderStage==="fragment"&&i.material.vertexNode){let e=Vie.mul(Wie);return e.xyz.div(e.w).toVar("positionView")}return i.context.setupPositionView().toVarying("v_positionView")},"vec3").once(["POSITION","VERTEX"])(),er=me(i=>{let e;return i.camera.isOrthographicCamera?e=pe(0,0,1):e=xs.negate().toVarying("v_positionViewDirection").normalize(),e.toVar("positionViewDirection")},"vec3").once(["POSITION"])(),YU=class extends Kt{static get type(){return"FrontFacingNode"}constructor(){super("bool"),this.isFrontFacingNode=!0}generate(e){if(e.shaderStage!=="fragment")return"true";let{material:t}=e;return t.side===mi?"false":e.getFrontFacing()}},jie=xt(YU),Yz=oe(jie).mul(2).sub(1),d1=me(([i],{material:e})=>{let t=e.side;return t===mi?i=i.mul(-1):t===vr&&(i=i.mul(Yz)),i}),UEe=i=>(ni('TSL: "directionToFaceDirection()" has been renamed to "negateOnBackSide()".'),d1(i)),II=fc("normal","vec3"),ba=me(i=>i.geometry.hasAttribute("normal")===!1?(Xe('TSL: Vertex attribute "normal" not found on geometry.'),pe(0,1,0)):II,"vec3").once()().toVar("normalLocal"),Xie=xs.dFdx().cross(xs.dFdy()).normalize().toVar("normalFlat"),mx=me(i=>{let e;return i.isFlatShading()?e=Xie:e=Kz(ba).toVarying("v_normalViewGeometry").normalize(),e},"vec3").once()().toVar("normalViewGeometry"),$ie=me(i=>{let e=mx.transformNormalByInverseViewMatrix(Sm);return i.isFlatShading()!==!0&&(e=e.toVarying("v_normalWorldGeometry")),e.normalize().toVar("normalWorldGeometry")},"vec3").once()(),hi=me(i=>{let e;return i.subBuildFn==="NORMAL"||i.subBuildFn==="VERTEX"?(e=mx,i.isFlatShading()!==!0&&(e=d1(e))):e=i.context.setupNormal().context({getUV:null,getTextureLevel:null}),e},"vec3").once(["NORMAL","VERTEX"])().toVar("normalView"),Tm=hi.transformNormalByInverseViewMatrix(Sm).toVar("normalWorld"),hm=me(({subBuildFn:i,context:e})=>{let t;return i==="NORMAL"||i==="VERTEX"?t=hi:t=e.setupClearcoatNormal().context({getUV:null,getTextureLevel:null}),t},"vec3").once(["NORMAL","VERTEX"])().toVar("clearcoatNormalView"),Zz=me(([i,e=ru])=>To(e).inverse().transpose().mul(i).normalize());Ue("transformNormal",Zz);var Kz=me(([i],e)=>{let t=e.context.modelNormalViewMatrix;return t?i.transformNormalByViewMatrix(t):qie.mul(i).transformNormalByViewMatrix(Sm)}),kEe=me(()=>(Xe('TSL: "transformedNormalView" is deprecated. Use "normalView" instead.'),hi)).once(["NORMAL","VERTEX"])(),zEe=me(()=>(Xe('TSL: "transformedNormalWorld" is deprecated. Use "normalWorld" instead.'),Tm)).once(["NORMAL","VERTEX"])(),VEe=me(()=>(Xe('TSL: "transformedClearcoatNormalView" is deprecated. Use "clearcoatNormalView" instead.'),hm)).once(["NORMAL","VERTEX"])(),zO=new cn,Yie=Xt(0).onReference(({material:i})=>i).onObjectUpdate(({material:i})=>i.refractionRatio),QR=Xt(1).onReference(({material:i})=>i).onObjectUpdate(function({material:i,scene:e}){return i.envMap?i.envMapIntensity:e.environmentIntensity}),v4=Xt(new cn).onReference(function(i){return i.material}).onObjectUpdate(function({material:i,scene:e}){let n=(e.environment!==null||e.environmentNode&&e.environmentNode.isNode)&&i.envMap===null?e.environmentRotation:i.envMapRotation;return n?zO.makeRotationFromEuler(n).transpose():zO.identity(),zO}),Zie=er.negate().reflect(hi),Kie=er.negate().refract(hi,Yie),Qie=Zie.transformDirection(BS).toVar("reflectVector"),Jie=Kie.transformDirection(BS).toVar("refractVector"),ere=new Dh,ZU=class extends lu{static get type(){return"CubeTextureNode"}constructor(e,t=null,n=null,r=null){super(e,t,n,r),this.isCubeTextureNode=!0}getInputType(){return this.value.isDepthTexture===!0?"cubeDepthTexture":"cubeTexture"}getDefaultUV(){let e=this.value;return e.mapping===ec?Qie:e.mapping===Wc?Jie:(ze('CubeTextureNode: Mapping "%s" not supported.',e.mapping),pe(0,0,0))}setUpdateMatrix(){}setupUV(e,t){let n=this.value;return n.isDepthTexture===!0?e.renderer.coordinateSystem===xl?pe(t.x,t.y.negate(),t.z):t:(t=v4.mul(t),(e.renderer.coordinateSystem===xl||!n.isRenderTargetTexture)&&(t=pe(t.x.negate(),t.yz)),t)}generateUV(e,t){return t.build(e,this.sampler===!0?"vec3":"ivec3")}},Qz=$n(ZU).setParameterLength(1,4).setName("cubeTexture"),Qa=(i=ere,e=null,t=null,n=null)=>{let r;return i&&i.isCubeTextureNode===!0?(r=Ht(i.clone()),r.referenceNode=i,e!==null&&(r.uvNode=Ht(e)),t!==null&&(r.levelNode=Ht(t)),n!==null&&(r.biasNode=Ht(n))):r=Qz(i,e,t,n),r},GEe=(i=ere)=>Qz(i),KU=class extends Kd{static get type(){return"ReferenceElementNode"}constructor(e,t){super(e,t),this.referenceNode=e,this.isReferenceElementNode=!0}generateNodeType(){return this.referenceNode.uniformType}generate(e){let t=super.generate(e),n=this.referenceNode.getNodeType(e),r=this.getNodeType(e);return e.format(t,n,r)}},Ax=class extends Kt{static get type(){return"ReferenceNode"}constructor(e,t,n=null,r=null){super(),this.property=e,this.uniformType=t,this.object=n,this.count=r,this.properties=e.split("."),this.reference=n,this.node=null,this.group=null,this.name=null,this.updateType=yn.OBJECT}element(e){return new KU(this,Ht(e))}setGroup(e){return this.group=e,this}setName(e){return this.name=e,this}label(e){return Xe('TSL: "label()" has been deprecated. Use "setName()" instead.'),this.setName(e)}setNodeType(e){let t=null;this.count!==null?t=Sx(null,e,this.count):Array.isArray(this.getValueFromReference())?(t=Xo(null,e),t.updateType=yn.OBJECT):e==="texture"?t=fi(null):e==="cubeTexture"?t=Qa(null):t=Xt(null,e),this.group!==null&&t.setGroup(this.group),this.name!==null&&t.setName(this.name),this.node=t}generateNodeType(e){return this.node===null&&(this.updateReference(e),this.updateValue()),this.node.getNodeType(e)}getValueFromReference(e=this.reference){let{properties:t}=this,n=e[t[0]];for(let r=1;r<t.length;r++)n=n[t[r]];return n}updateReference(e){return this.reference=this.object!==null?this.object:e.object,this.reference}setup(){return this.updateValue(),this.node}update(){this.updateValue()}updateValue(){this.node===null&&this.setNodeType(this.uniformType);let e=this.getValueFromReference();Array.isArray(e)?this.node.array=e:this.node.value=e}},mr=(i,e,t)=>new Ax(i,e,t),tre=(i,e,t,n)=>new Ax(i,e,n,t),QU=class extends Ax{static get type(){return"MaterialReferenceNode"}constructor(e,t,n=null){super(e,t,n),this.material=n,this.isMaterialReferenceNode=!0}updateReference(e){return this.reference=this.material!==null?this.material:e.material,this.reference}},$d=(i,e,t=null)=>new QU(i,e,t),nre=Ui(),qEe=xs.dFdx(),HEe=xs.dFdy(),ire=nre.dFdx(),rre=nre.dFdy(),sre=hi,ore=HEe.cross(sre),are=sre.cross(qEe),JU=ore.mul(ire.x).add(are.mul(rre.x)),e7=ore.mul(ire.y).add(are.mul(rre.y)),Gee=JU.dot(JU).max(e7.dot(e7)),lre=Gee.equal(0).select(0,Gee.inverseSqrt()),WEe=JU.mul(lre).toVar("tangentViewFrame"),jEe=e7.mul(lre).toVar("bitangentViewFrame"),PI=fc("tangent","vec4"),_m=PI.xyz.toVar("tangentLocal"),LI=me(i=>{let e;return i.subBuildFn==="VERTEX"||i.geometry.hasAttribute("tangent")?e=Tf.mul(Ft(_m,0)).xyz.toVarying("v_tangentView").normalize():e=WEe,i.isFlatShading()!==!0&&(e=d1(e)),e},"vec3").once(["NORMAL","VERTEX"])().toVar("tangentView"),cre=LI.transformDirection(BS).toVarying("v_tangentWorld").normalize().toVar("tangentWorld"),DI=me(([i,e],t)=>{let n=i.mul(PI.w).xyz;return t.subBuildFn==="NORMAL"&&t.isFlatShading()!==!0&&(n=n.toVarying(e)),n}).once(["NORMAL"]),XEe=DI(II.cross(PI),"v_bitangentGeometry").normalize().toVar("bitangentGeometry"),$Ee=DI(ba.cross(_m),"v_bitangentLocal").normalize().toVar("bitangentLocal"),ure=me(i=>{let e;return i.subBuildFn==="VERTEX"||i.geometry.hasAttribute("tangent")?e=DI(hi.cross(LI),"v_bitangentView").normalize():e=jEe,i.isFlatShading()!==!0&&(e=d1(e)),e},"vec3").once(["NORMAL","VERTEX"])().toVar("bitangentView"),YEe=DI(Tm.cross(cre),"v_bitangentWorld").normalize().toVar("bitangentWorld"),Wg=To(LI,ure,hi).toVar("TBNViewMatrix"),hre=er.mul(Wg),ZEe=(i,e)=>i.sub(hre.mul(e)),fre=me(()=>{let i=$g.cross(er);return i=i.cross($g).normalize(),i=Qn(i,hi,am.mul(gf.oneMinus()).oneMinus().pow2().pow2()).normalize(),i}).once()(),Jz=i=>Ht(i).mul(.5).add(.5),dre=i=>Ht(i).mul(2).sub(1),t7=i=>pe(i,el(EI(oe(1).sub(au(i,i))))),KEe=i=>(ni('TSL: "directionToColor()" has been renamed to "packNormalToRGB()".'),Jz(i)),QEe=i=>(ni('TSL: "colorToDirection()" has been renamed to "unpackRGBToNormal()".'),dre(i)),n7=class extends Rr{static get type(){return"NormalMapNode"}constructor(e,t=null){super("vec3"),this.node=e,this.scaleNode=t,this.normalMapType=tc,this.unpackNormalMode=Fb}setup(e){let{normalMapType:t,scaleNode:n,unpackNormalMode:r}=this,s=this.node.mul(2).sub(1);if(t===tc?r===VM?s=t7(s.xy):r===Y8?s=t7(s.yw):r!==Fb&&ze(`THREE.NodeMaterial: Unexpected unpack normal mode: ${r}`):r!==Fb&&ze(`THREE.NodeMaterial: Normal map type '${t}' is not compatible with unpack normal mode '${r}'`),n!==null){let a=n;e.isFlatShading()===!0&&(a=d1(a)),s=pe(s.xy.mul(a),s.z)}let o=null;return t===zM?o=Kz(s):t===tc?o=Wg.mul(s).normalize():(ze(`NodeMaterial: Unsupported normal map type: ${t}`),o=hi),o}},i7=$n(n7).setParameterLength(1,2),JEe=me(({textureNode:i,bumpScale:e})=>{let t=r=>i.isolate().context({getUV:s=>r(s.uvNode||Ui()),forceUVContext:!0}),n=oe(t(r=>r));return dt(oe(t(r=>r.add(r.dFdx()))).sub(n),oe(t(r=>r.add(r.dFdy()))).sub(n)).mul(e)}),e3e=me(i=>{let{surf_pos:e,surf_norm:t,dHdxy:n}=i,r=e.dFdx().normalize(),s=e.dFdy().normalize(),o=t,a=s.cross(o),l=o.cross(r),c=r.dot(a).mul(Yz),u=c.sign().mul(n.x.mul(a).add(n.y.mul(l)));return c.abs().mul(t).sub(u).normalize()}),r7=class extends Rr{static get type(){return"BumpMapNode"}constructor(e,t=null){super("vec3"),this.textureNode=e,this.scaleNode=t}setup(e){if(e.material.wireframe===!0)return hi;let t=this.scaleNode!==null?this.scaleNode:1,n=JEe({textureNode:this.textureNode,bumpScale:t});return e3e({surf_pos:xs,surf_norm:hi,dHdxy:n})}},eV=$n(r7).setParameterLength(1,2),qee=new Map,at=class i extends Kt{static get type(){return"MaterialNode"}constructor(e){super(),this.scope=e}getCache(e,t){let n=qee.get(e);return n===void 0&&(n=$d(e,t),qee.set(e,n)),n}getFloat(e){return this.getCache(e,"float")}getColor(e){return this.getCache(e,"color")}getTexture(e){return this.getCache(e==="map"?"map":e+"Map","texture")}setup(e){let t=e.context.material,n=this.scope,r=null;if(n===i.COLOR){let s=t.color!==void 0?this.getColor(n):pe();t.map&&t.map.isTexture===!0?r=s.mul(this.getTexture("map")):r=s}else if(n===i.OPACITY){let s=this.getFloat(n);t.alphaMap&&t.alphaMap.isTexture===!0?r=s.mul(this.getTexture("alpha")):r=s}else if(n===i.SPECULAR_STRENGTH)t.specularMap&&t.specularMap.isTexture===!0?r=this.getTexture("specular").r:r=oe(1);else if(n===i.SPECULAR_INTENSITY){let s=this.getFloat(n);t.specularIntensityMap&&t.specularIntensityMap.isTexture===!0?r=s.mul(this.getTexture(n).a):r=s}else if(n===i.SPECULAR_COLOR){let s=this.getColor(n);t.specularColorMap&&t.specularColorMap.isTexture===!0?r=s.mul(this.getTexture(n).rgb):r=s}else if(n===i.ROUGHNESS){let s=this.getFloat(n);t.roughnessMap&&t.roughnessMap.isTexture===!0?r=s.mul(this.getTexture(n).g):r=s}else if(n===i.METALNESS){let s=this.getFloat(n);t.metalnessMap&&t.metalnessMap.isTexture===!0?r=s.mul(this.getTexture(n).b):r=s}else if(n===i.EMISSIVE){let s=this.getFloat("emissiveIntensity"),o=this.getColor(n).mul(s);t.emissiveMap&&t.emissiveMap.isTexture===!0?r=o.mul(this.getTexture(n)):r=o}else if(n===i.NORMAL)t.normalMap?(r=i7(this.getTexture("normal"),this.getCache("normalScale","vec2")),r.normalMapType=t.normalMapType,(t.normalMap.format==js||t.normalMap.format==Yh||t.normalMap.format==$h)&&(r.unpackNormalMode=VM)):t.bumpMap?r=eV(this.getTexture("bump").r,this.getFloat("bumpScale")):r=hi;else if(n===i.CLEARCOAT){let s=this.getFloat(n);t.clearcoatMap&&t.clearcoatMap.isTexture===!0?r=s.mul(this.getTexture(n).r):r=s}else if(n===i.CLEARCOAT_ROUGHNESS){let s=this.getFloat(n);t.clearcoatRoughnessMap&&t.clearcoatRoughnessMap.isTexture===!0?r=s.mul(this.getTexture(n).r):r=s}else if(n===i.CLEARCOAT_NORMAL)t.clearcoatNormalMap?r=i7(this.getTexture(n),this.getCache(n+"Scale","vec2")):r=hi;else if(n===i.SHEEN){let s=this.getColor("sheenColor").mul(this.getFloat("sheen"));t.sheenColorMap&&t.sheenColorMap.isTexture===!0?r=s.mul(this.getTexture("sheenColor").rgb):r=s}else if(n===i.SHEEN_ROUGHNESS){let s=this.getFloat(n);t.sheenRoughnessMap&&t.sheenRoughnessMap.isTexture===!0?r=s.mul(this.getTexture(n).a):r=s,r=r.clamp(1e-4,1)}else if(n===i.ANISOTROPY)if(t.anisotropyMap&&t.anisotropyMap.isTexture===!0){let s=this.getTexture(n);r=_I(ix.x,ix.y,ix.y.negate(),ix.x).mul(s.rg.mul(2).sub(dt(1)).normalize().mul(s.b))}else r=ix;else if(n===i.IRIDESCENCE_THICKNESS){let s=mr("1","float",t.iridescenceThicknessRange);if(t.iridescenceThicknessMap){let o=mr("0","float",t.iridescenceThicknessRange);r=s.sub(o).mul(this.getTexture(n).g).add(o)}else r=s}else if(n===i.TRANSMISSION){let s=this.getFloat(n);t.transmissionMap?r=s.mul(this.getTexture(n).r):r=s}else if(n===i.THICKNESS){let s=this.getFloat(n);t.thicknessMap?r=s.mul(this.getTexture(n).g):r=s}else if(n===i.IOR)r=this.getFloat(n);else if(n===i.LIGHT_MAP)t.lightMap?r=this.getTexture(n).rgb.mul(this.getFloat("lightMapIntensity")):r=pe(0);else if(n===i.AO)t.aoMap?r=this.getTexture(n).r.sub(1).mul(this.getFloat("aoMapIntensity")).add(1):r=oe(1);else if(n===i.LINE_DASH_OFFSET)r=t.dashOffset?this.getFloat(n):oe(0);else{let s=this.getNodeType(e);r=this.getCache(n,s)}return r}};at.ALPHA_TEST="alphaTest";at.COLOR="color";at.OPACITY="opacity";at.SHININESS="shininess";at.SPECULAR="specular";at.SPECULAR_STRENGTH="specularStrength";at.SPECULAR_INTENSITY="specularIntensity";at.SPECULAR_COLOR="specularColor";at.REFLECTIVITY="reflectivity";at.ROUGHNESS="roughness";at.METALNESS="metalness";at.NORMAL="normal";at.CLEARCOAT="clearcoat";at.CLEARCOAT_ROUGHNESS="clearcoatRoughness";at.CLEARCOAT_NORMAL="clearcoatNormal";at.EMISSIVE="emissive";at.ROTATION="rotation";at.SHEEN="sheen";at.SHEEN_ROUGHNESS="sheenRoughness";at.ANISOTROPY="anisotropy";at.IRIDESCENCE="iridescence";at.IRIDESCENCE_IOR="iridescenceIOR";at.IRIDESCENCE_THICKNESS="iridescenceThickness";at.IOR="ior";at.TRANSMISSION="transmission";at.THICKNESS="thickness";at.ATTENUATION_DISTANCE="attenuationDistance";at.ATTENUATION_COLOR="attenuationColor";at.LINE_SCALE="scale";at.LINE_DASH_SIZE="dashSize";at.LINE_GAP_SIZE="gapSize";at.LINE_WIDTH="linewidth";at.LINE_DASH_OFFSET="dashOffset";at.POINT_SIZE="size";at.DISPERSION="dispersion";at.LIGHT_MAP="light";at.AO="ao";var pre=xt(at,at.ALPHA_TEST),mre=xt(at,at.COLOR),Are=xt(at,at.SHININESS),gre=xt(at,at.EMISSIVE),tV=xt(at,at.OPACITY),vre=xt(at,at.SPECULAR),s7=xt(at,at.SPECULAR_INTENSITY),_re=xt(at,at.SPECULAR_COLOR),cS=xt(at,at.SPECULAR_STRENGTH),JR=xt(at,at.REFLECTIVITY),xre=xt(at,at.ROUGHNESS),yre=xt(at,at.METALNESS),bre=xt(at,at.NORMAL),wre=xt(at,at.CLEARCOAT),Sre=xt(at,at.CLEARCOAT_ROUGHNESS),Tre=xt(at,at.CLEARCOAT_NORMAL),Ere=xt(at,at.ROTATION),Mre=xt(at,at.SHEEN),Cre=xt(at,at.SHEEN_ROUGHNESS),Rre=xt(at,at.ANISOTROPY),Ire=xt(at,at.IRIDESCENCE),Pre=xt(at,at.IRIDESCENCE_IOR),Lre=xt(at,at.IRIDESCENCE_THICKNESS),Dre=xt(at,at.TRANSMISSION),Nre=xt(at,at.THICKNESS),Fre=xt(at,at.IOR),Bre=xt(at,at.ATTENUATION_DISTANCE),Ore=xt(at,at.ATTENUATION_COLOR),nV=xt(at,at.LINE_SCALE),iV=xt(at,at.LINE_DASH_SIZE),rV=xt(at,at.LINE_GAP_SIZE),_4=xt(at,at.LINE_WIDTH),sV=xt(at,at.LINE_DASH_OFFSET),Ure=xt(at,at.POINT_SIZE),kre=xt(at,at.DISPERSION),oV=xt(at,at.LIGHT_MAP),zre=xt(at,at.AO),ix=Xt(new Oe).onReference(function(i){return i.material}).onRenderUpdate(function({material:i}){this.value.set(i.anisotropy*Math.cos(i.anisotropyRotation),i.anisotropy*Math.sin(i.anisotropyRotation))}),Vre=me(i=>i.context.setupModelViewProjection(),"vec4").once()().toVarying("v_modelViewProjection"),tl=class i extends Kt{static get type(){return"EventNode"}constructor(e,t){super("void"),this.eventType=e,this.callback=t,e===i.OBJECT?this.updateType=yn.OBJECT:e===i.MATERIAL?this.updateType=yn.RENDER:e===i.FRAME?this.updateType=yn.FRAME:e===i.BEFORE_OBJECT?this.updateBeforeType=yn.OBJECT:e===i.BEFORE_MATERIAL?this.updateBeforeType=yn.RENDER:e===i.BEFORE_FRAME&&(this.updateBeforeType=yn.FRAME)}update(e){this.callback(e)}updateBefore(e){this.callback(e)}};tl.OBJECT="object";tl.MATERIAL="material";tl.FRAME="frame";tl.BEFORE_OBJECT="beforeObject";tl.BEFORE_MATERIAL="beforeMaterial";tl.BEFORE_FRAME="beforeFrame";var Tx=(i,e)=>new tl(i,e).toStack(),OS=i=>Tx(tl.OBJECT,i),t3e=i=>Tx(tl.MATERIAL,i),Gre=i=>Tx(tl.FRAME,i),n3e=i=>Tx(tl.BEFORE_OBJECT,i),i3e=i=>Tx(tl.BEFORE_MATERIAL,i),r3e=i=>Tx(tl.BEFORE_FRAME,i),o7=class extends Kd{static get type(){return"StorageArrayElementNode"}constructor(e,t){super(e,t),this.isStorageArrayElementNode=!0}set storageBufferNode(e){this.node=e}get storageBufferNode(){return this.node}getMemberType(e,t){let n=this.storageBufferNode.structTypeNode;return n?n.getMemberType(e,t):"void"}setup(e){return e.isAvailable("storageBuffer")===!1&&this.node.isPBO===!0&&e.setupPBO(this.node),super.setup(e)}generate(e,t){let n,r=e.isContextAssign();if(e.isAvailable("storageBuffer")===!1?this.node.isPBO===!0&&r!==!0&&(this.node.value.isInstancedBufferAttribute||e.shaderStage!=="compute")?n=e.generatePBO(this):n=this.node.build(e):n=super.generate(e),r!==!0){let s=this.getNodeType(e);n=e.format(n,s,t)}return n}},s3e=$n(o7).setParameterLength(2),a7=class extends _S{static get type(){return"StorageBufferNode"}constructor(e,t=null,n=0){let r,s=null;t&&t.isStructTypeNode?(r="struct",s=t,(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)&&(n=e.count)):t===null&&(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)?(r=ine(e.itemSize),n=e.count):r=t,super(e,r,n),this.isStorageBufferNode=!0,this.structTypeNode=s,this.access=$o.READ_WRITE,this.isAtomic=!1,this.isPBO=!1,this._attribute=null,this._varying=null,this.global=!0,e.isStorageBufferAttribute!==!0&&e.isStorageInstancedBufferAttribute!==!0&&(e.isInstancedBufferAttribute?e.isStorageInstancedBufferAttribute=!0:e.isStorageBufferAttribute=!0)}getHash(e){let t;if(this.bufferCount===0){let n=e.globalCache.getData(this.value);n===void 0&&(n={node:this},e.globalCache.setData(this.value,n)),t=n.node.id}else t=this.id;return String(t)}getInputType(){return this.value.isIndirectStorageBufferAttribute?"indirectStorageBuffer":"storageBuffer"}element(e){return s3e(this,e)}setPBO(e){return this.isPBO=e,this}getPBO(){return this.isPBO}setAccess(e){return this.access=e,this}toReadOnly(){return this.setAccess($o.READ_ONLY)}setAtomic(e){return this.isAtomic=e,this}toAtomic(){return this.setAtomic(!0)}getAttributeData(){return this._attribute===null&&(this._attribute=Uz(this.value),this._varying=bm(this._attribute)),{attribute:this._attribute,varying:this._varying}}generateNodeType(e){if(this.structTypeNode!==null)return this.structTypeNode.getNodeType(e);if(e.isAvailable("storageBuffer")||e.isAvailable("indirectStorageBuffer"))return super.generateNodeType(e);let{attribute:t}=this.getAttributeData();return t.getNodeType(e)}getMemberType(e,t){return this.structTypeNode!==null?this.structTypeNode.getMemberType(e,t):"void"}generate(e){if(this.structTypeNode!==null&&this.structTypeNode.build(e),e.isAvailable("storageBuffer")||e.isAvailable("indirectStorageBuffer"))return super.generate(e);let{attribute:t,varying:n}=this.getAttributeData(),r=n.build(e);return e.registerTransform(r,t),r}},Am=(i,e=null,t=0)=>new a7(i,e,t),l7=new WeakMap,Hee=new WeakMap,c7=new WeakMap;function qre(i,e){let t,n=Math.max(e.count,1);if(e.isStorageInstancedBufferAttribute===!0)t=Am(e,"mat4",n).element(Yu);else if(n*16*4<=i.getUniformBufferLimit())t=Sx(e.array,"mat4",n).element(Yu);else{let o=l7.get(e);o||(o=new Fh(e.array,16,1),l7.set(e,o));let a=e.usage===dg?kz:RI,l=[a(o,"vec4",16,0),a(o,"vec4",16,4),a(o,"vec4",16,8),a(o,"vec4",16,12)];t=mm(...l)}return t}function o3e(i,e,t){let n=c7.get(i);if(n===void 0){let r=e.clone();n={previousInstanceMatrix:r,node:qre(t,r)},c7.set(i,n)}return n.node}var aV=h1("vec3","vInstanceColor"),Hre=me(([i,e=null],t)=>{let n=i.isStorageInstancedBufferAttribute===!0,r=e&&e.isStorageInstancedBufferAttribute===!0,s=qre(t,i),o=null;n||Math.max(i.count,1)*16*4>t.getUniformBufferLimit()&&(o=l7.get(i));let a=null,l=null;if(e)if(r)a=Am(e,"vec3",Math.max(e.count,1)).element(Yu);else{let u=Hee.get(e);u||(u=new Ql(e.array,3),Hee.set(e,u)),l=u;let f=e.usage===dg?kz:RI;a=pe(f(u,"vec3",3,0))}(o!==null||l!==null)&&Gre(()=>{o!==null&&(o.clearUpdateRanges(),o.updateRanges.push(...i.updateRanges),i.version!==o.version&&(o.version=i.version)),e&&l!==null&&(l.clearUpdateRanges(),l.updateRanges.push(...e.updateRanges),e.version!==l.version&&(l.version=e.version))});let c=s.mul(Mr).xyz;if(Mr.assign(c),t.needsPreviousData()){let u=t.object;OS(({object:d})=>{c7.get(d).previousInstanceMatrix.array.set(i.array)});let f=o3e(u,i,t);r1.assign(f.mul(r1).xyz)}if(t.hasGeometryAttribute("normal")){let u=Zz(ba,s);ba.assign(u)}a!==null&&aV.assign(a)},"void"),Wre=me(([i])=>{let{instanceMatrix:e,instanceColor:t}=i;Hre(e,t)},"void"),a3e=me(([i,e])=>{let t=de(n1(_s(i),0).x).toConst(),n=de(e),r=n.mod(t).toConst(),s=n.div(t).toConst();return _s(i,kr(r,s))}),l3e=me(([i,e])=>{let t=de(n1(_s(i),0).x).toConst(),n=de(e).mod(t).toConst(),r=de(e).div(t).toConst();return _s(i,kr(n,r)).x}),lV=h1("vec4","vBatchColor"),jre=me(([i],e)=>{let t=e.getDrawIndex()===null?Yu:Pie,n=l3e(i._indirectTexture,de(t)),r=i._matricesTexture,s=de(n1(_s(r),0).x).toConst(),o=oe(n).mul(4).toInt().toConst(),a=o.mod(s).toConst(),l=o.div(s).toConst(),c=mm(_s(r,kr(a,l)),_s(r,kr(a.add(1),l)),_s(r,kr(a.add(2),l)),_s(r,kr(a.add(3),l))),u=i._colorsTexture;if(u!==null){let y=a3e(u,n);lV.assign(y)}let f=To(c);Mr.assign(c.mul(Mr));let d=ba.div(pe(f[0].dot(f[0]),f[1].dot(f[1]),f[2].dot(f[2]))),A=f.mul(d).xyz;ba.assign(A),e.hasGeometryAttribute("tangent")&&_m.mulAssign(f)},"void"),x4=new WeakMap,y4=new WeakMap;function cV(i,e,t,n,r,s){let o=i.element(r.x),a=i.element(r.y),l=i.element(r.z),c=i.element(r.w),u=t.mul(e),f=Ls(o.mul(s.x).mul(u),a.mul(s.y).mul(u),l.mul(s.z).mul(u),c.mul(s.w).mul(u));return n.mul(f).xyz}function Xre(i,e,t,n,r,s,o){let a=i.element(s.x),l=i.element(s.y),c=i.element(s.z),u=i.element(s.w),f=Ls(o.x.mul(a),o.y.mul(l),o.z.mul(c),o.w.mul(u));f=r.mul(f).mul(n);let d=f.transformDirection(e).xyz,A=f.transformDirection(t).xyz;return{skinNormal:d,skinTangent:A}}function $re(i,e,t,n,r){let s=i.skeleton,o=y4.get(s);if(o===void 0){s.update();let a=new Float32Array(s.boneMatrices);o={previousBoneMatrices:a,node:Sx(a,"mat4",s.bones.length)},y4.set(s,o)}return cV(o.node,r1,e,t,n,r)}var Yre=me(([i],e)=>{let t=fc("skinIndex","uvec4"),n=fc("skinWeight","vec4"),r=mr("bindMatrix","mat4"),s=mr("bindMatrixInverse","mat4"),o=tre("skeleton.boneMatrices","mat4",i.skeleton.bones.length);if(OS(({object:l,frameId:c})=>{let u=l.skeleton;if(x4.get(u)!==c){x4.set(u,c);let f=y4.get(u);f!==void 0&&f.previousBoneMatrices.set(u.boneMatrices),u.update()}}),e.needsPreviousData()){let l=$re(i,r,s,t,n);r1.assign(l)}let a=cV(o,Mr,r,s,t,n);if(Mr.assign(a),e.hasGeometryAttribute("normal")){let{skinNormal:l,skinTangent:c}=Xre(o,ba,_m,r,s,t,n);ba.assign(l),e.hasGeometryAttribute("tangent")&&_m.assign(c)}},"void"),c3e=me(([i,e=null],t)=>{let n=Am(new Ql(i.geometry.getAttribute("position").array,3),"vec3").setPBO(!0).toReadOnly().element(Yu).toVar(),r=Am(new Ql(new Uint32Array(i.geometry.getAttribute("skinIndex").array),4),"uvec4").setPBO(!0).toReadOnly().element(Yu).toVar(),s=Am(new Ql(i.geometry.getAttribute("skinWeight").array,4),"vec4").setPBO(!0).toReadOnly().element(Yu).toVar(),o=Xt(i.bindMatrix,"mat4"),a=Xt(i.bindMatrixInverse,"mat4"),l=Sx(i.skeleton.boneMatrices,"mat4",i.skeleton.bones.length),c=i.skeleton;if(OS(({frameId:f})=>{if(x4.get(c)!==f){x4.set(c,f);let d=y4.get(c);d!==void 0&&d.previousBoneMatrices.set(c.boneMatrices),c.update()}}),t.needsPreviousData()){let f=$re(i,o,a,r,s);r1.assign(f)}let u=cV(l,n,o,a,r,s);if(e!==null&&e.assign(u),t.hasGeometryAttribute("normal")){let{skinNormal:f,skinTangent:d}=Xre(l,ba,_m,o,a,r,s);ba.assign(f),t.hasGeometryAttribute("tangent")&&_m.assign(d)}return u}),u7=class extends Kt{static get type(){return"LoopNode"}constructor(e=[]){super("void"),this.params=e}getVarName(e){return String.fromCharCode(105+e)}getProperties(e){let t=e.getNodeProperties(this);if(t.stackNode!==void 0)return t;let n={};for(let a=0,l=this.params.length-1;a<l;a++){let c=this.params[a],u=c.isNode!==!0&&c.name||this.getVarName(a),f=c.isNode!==!0&&c.type||"int";n[u]=hc(u,f)}let r=e.addStack(),s=this.params[this.params.length-1](n);t.returnsNode=s.context({nodeLoop:s}),t.stackNode=r;let o=this.params[0];if(o.isNode!==!0&&typeof o.update=="function"){let a=me(this.params[0].update)(n);t.updateNode=a.context({nodeLoop:a})}return e.removeStack(),t}setup(e){if(this.getProperties(e),e.fnCall){let t=e.getDataFromNode(e.fnCall.shaderNode);t.hasLoop=!0}}generate(e){let t=this.getProperties(e),n=this.params,r=t.stackNode;for(let o=0,a=n.length-1;o<a;o++){let l=n[o],c=!1,u=null,f=null,d=null,A=null,y=null,w=null;l.isNode?l.getNodeType(e)==="bool"?(c=!0,A="bool",f=l.build(e,A)):(A="int",d=this.getVarName(o),u="0",f=l.build(e,A),y="<"):(A=l.type||"int",d=l.name||this.getVarName(o),u=l.start,f=l.end,y=l.condition,w=l.update,typeof u=="number"?u=e.generateConst(A,u):u&&u.isNode&&(u=u.build(e,A)),typeof f=="number"?f=e.generateConst(A,f):f&&f.isNode&&(f=f.build(e,A)),u!==void 0&&f===void 0?(u=u+" - 1",f="0",y=">="):f!==void 0&&u===void 0&&(u="0",y="<"),y===void 0&&(Number(u)>Number(f)?y=">=":y="<"));let S;if(c)S=`while ( ${f} )`;else{let T={start:u,end:f},R=T.start,P=T.end,I,F=()=>y.includes("<")?"+=":"-=";if(w!=null)switch(typeof w){case"function":I=e.flowStagesNode(t.updateNode,"void").code.replace(/\t|;/g,"");break;case"number":I=d+" "+F()+" "+e.generateConst(A,w);break;case"string":I=d+" "+w;break;default:w.isNode?I=d+" "+F()+" "+w.build(e):(ze("TSL: 'Loop( { update: ... } )' is not a function, string or number.",this.stackTrace),I="break /* invalid update */")}else A==="int"||A==="uint"?w=y.includes("<")?"++":"--":w=F()+" 1.",I=d+" "+w;let D=e.getVar(A,d)+" = "+R,L=d+" "+y+" "+P;S=`for ( ${D}; ${L}; ${I} )`}e.addFlowCode((o===0?`41534153 `:"")+e.tab+S+` {41544154 41554155 `).addFlowTab()}let s=r.build(e,"void");t.returnsNode.build(e,"void"),e.removeFlowTab().addFlowCode(`41564156 `+e.tab+s);for(let o=0,a=this.params.length-1;o<a;o++)e.addFlowCode((o===0?"":e.tab)+`}41574157 4158-`).removeFlowTab();e.addFlowTab()}},Oi=(...i)=>new n7(Xg(i,"int")).toStack(),HEe=()=>uc("continue").toStack(),Vre=()=>uc("break").toStack(),DO=new WeakMap,rc=new xn,Bee=new WeakMap,Oee=me(({bufferMap:i,influence:e,stride:t,width:n,depth:r,offset:s})=>{let o=de(yie).mul(t).add(s),a=o.div(n),l=o.sub(a.mul(n));return _s(i,kr(l,a)).depth(r).xyz.mul(e)});function WEe(i){let e=i.morphAttributes.position!==void 0,t=i.morphAttributes.normal!==void 0,n=i.morphAttributes.color!==void 0,r=i.morphAttributes.position||i.morphAttributes.normal||i.morphAttributes.color,s=r!==void 0?r.length:0,o=DO.get(i);if(o===void 0||o.count!==s){let T=function(){w.dispose(),DO.delete(i),i.removeEventListener("dispose",T)};o!==void 0&&o.texture.dispose();let a=i.morphAttributes.position||[],l=i.morphAttributes.normal||[],c=i.morphAttributes.color||[],u=0;e===!0&&(u=1),t===!0&&(u=2),n===!0&&(u=3);let f=i.attributes.position.count*u,d=1,A=4096;f>A&&(d=Math.ceil(f/A),f=A);let y=new Float32Array(f*d*4*s),w=new GA(y,f,d,s);w.type=cr,w.needsUpdate=!0;let S=u*4;for(let R=0;R<s;R++){let P=a[R],I=l[R],F=c[R],D=f*d*4*R;for(let L=0;L<P.count;L++){let C=L*S;e===!0&&(rc.fromBufferAttribute(P,L),y[D+C+0]=rc.x,y[D+C+1]=rc.y,y[D+C+2]=rc.z,y[D+C+3]=0),t===!0&&(rc.fromBufferAttribute(I,L),y[D+C+4]=rc.x,y[D+C+5]=rc.y,y[D+C+6]=rc.z,y[D+C+7]=0),n===!0&&(rc.fromBufferAttribute(F,L),y[D+C+8]=rc.x,y[D+C+9]=rc.y,y[D+C+10]=rc.z,y[D+C+11]=F.itemSize===4?rc.w:1)}}o={count:s,texture:w,stride:u,size:new Oe(f,d)},DO.set(i,o),i.addEventListener("dispose",T)}return o}var Gre=me(([i])=>{let{geometry:e}=i,t=e.morphAttributes.position!==void 0,n=e.hasAttribute("normal")&&e.morphAttributes.normal!==void 0,r=e.morphAttributes.position||e.morphAttributes.normal||e.morphAttributes.color,s=r!==void 0?r.length:0;if(s===0)return;let o=Bee.get(i);(o===void 0||o.count!==s)&&(o={base:Xt(1),influences:i.morphTargetInfluences?Xo(i.morphTargetInfluences,"float"):null,count:s},Bee.set(i,o));let{base:a,influences:l}=o,{texture:c,stride:u,size:f}=WEe(e);t===!0&&Mr.mulAssign(a),n===!0&&ba.mulAssign(a);let d=de(f.width);Oi(s,({i:A})=>{let y=oe(0).toVar();i.count>1&&i.morphTexture!==null&&i.morphTexture!==void 0?y.assign(_s(i.morphTexture,kr(de(A).add(1),de(Xu))).r):y.assign(l.element(A).toVar()),$t(y.notEqual(0),()=>{t===!0&&Mr.addAssign(Oee({bufferMap:c,influence:y,stride:u,width:d,depth:A,offset:de(0)})),n===!0&&ba.addAssign(Oee({bufferMap:c,influence:y,stride:u,width:d,depth:A,offset:de(1)}))})}),DS(({object:A})=>{let{base:y,influences:w}=o;A.geometry.morphTargetsRelative?y.value=1:y.value=1-A.morphTargetInfluences.reduce((S,T)=>S+T,0),w&&(w.array=A.morphTargetInfluences,w.update())})},"void"),xm=class extends Kt{static get type(){return"LightingNode"}constructor(){super("vec3"),this.isLightingNode=!0}},i7=class extends xm{static get type(){return"AONode"}constructor(e=null){super(),this.aoNode=e}setup(e){e.context.ambientOcclusion.mulAssign(this.aoNode)}},r7=class extends dS{static get type(){return"LightingContextNode"}constructor(e,t=null,n=[],r=null,s=null){super(e),this.lightingModel=t,this.materialLightings=n,this.backdropNode=r,this.backdropAlphaNode=s,this._value=null}getContext(){let{materialLightings:e,backdropNode:t,backdropAlphaNode:n}=this,r=pe().toVar("directDiffuse"),s=pe().toVar("directSpecular"),o=pe().toVar("indirectDiffuse"),a=pe().toVar("indirectSpecular"),l={directDiffuse:r,directSpecular:s,indirectDiffuse:o,indirectSpecular:a};return{radiance:pe().toVar("radiance"),irradiance:pe().toVar("irradiance"),iblIrradiance:pe().toVar("iblIrradiance"),ambientOcclusion:oe(1).toVar("ambientOcclusion"),reflectedLight:l,materialLightings:e,backdrop:t,backdropAlpha:n}}setup(e){return this.value=this._value||(this._value=this.getContext()),this.value.lightingModel=this.lightingModel||e.context.lightingModel,super.setup(e)}},qre=$n(r7),s7=class extends xm{static get type(){return"IrradianceNode"}constructor(e){super(),this.node=e}setup(e){e.context.irradiance.addAssign(this.node)}},Ng=new Oe,mx=class extends au{static get type(){return"ViewportTextureNode"}constructor(e=ju,t=null,n=null){let r=null;n===null?(r=new XA,r.minFilter=Vo,n=r):r=n,super(n,e,t),this.generateMipmaps=!1,this.defaultFramebuffer=r,this.isOutputTextureNode=!0,this.updateBeforeType=yn.RENDER,this._cacheTextures=new WeakMap}getTextureForReference(e=null){let t,n;if(this.referenceNode?(t=this.referenceNode.defaultFramebuffer,n=this.referenceNode._cacheTextures):(t=this.defaultFramebuffer,n=this._cacheTextures),e===null)return t;if(n.has(e)===!1){let r=t.clone();n.set(e,r)}return n.get(e)}updateReference(e){let t=e.renderer,n=t.getRenderTarget(),r=t.getCanvasTarget(),s=n||r;return this.value=this.getTextureForReference(s),this.value}updateBefore(e){let t=e.renderer,n=t.getRenderTarget(),r=t.getCanvasTarget(),s=n||r;s===null?t.getDrawingBufferSize(Ng):s.getDrawingBufferSize?s.getDrawingBufferSize(Ng):Ng.set(s.width,s.height);let o=this.getTextureForReference(s);(o.image.width!==Ng.width||o.image.height!==Ng.height)&&(o.image.width=Ng.width,o.image.height=Ng.height,o.needsUpdate=!0);let a=o.generateMipmaps;o.generateMipmaps=this.generateMipmaps,t.copyFramebufferToTexture(o),o.generateMipmaps=a}clone(){let e=new this.constructor(this.uvNode,this.levelNode,this.value);return e.generateMipmaps=this.generateMipmaps,e}},jEe=$n(mx).setParameterLength(0,3),nV=$n(mx,null,null,{generateMipmaps:!0}).setParameterLength(0,3),XEe=nV(),Hre=(i=ju,e=null)=>XEe.sample(i,e),NO=null,o7=class extends mx{static get type(){return"ViewportDepthTextureNode"}constructor(e=ju,t=null,n=null){n===null&&(NO===null&&(NO=new Cs),n=NO),super(e,t,n)}},iV=$n(o7).setParameterLength(0,3),Zu=class i extends Kt{static get type(){return"ViewportDepthNode"}constructor(e,t=null){super("float"),this.scope=e,this.valueNode=t,this.isViewportDepthNode=!0}generate(e){let{scope:t}=this;return t===i.DEPTH_BASE?e.getFragDepth():super.generate(e)}setup({camera:e}){let{scope:t}=this,n=this.valueNode,r=null;if(t===i.DEPTH_BASE)n!==null&&(r=Xre().assign(n));else if(t===i.DEPTH)e.isPerspectiveCamera?r=rV(xs.z,cm,um):r=Kg(xs.z,cm,um);else if(t===i.LINEAR_DEPTH)if(n!==null)if(e.isPerspectiveCamera){let s=II(n,cm,um);r=Kg(s,cm,um)}else r=n;else r=Kg(xs.z,cm,um);return r}};Zu.DEPTH_BASE="depthBase";Zu.DEPTH="depth";Zu.LINEAR_DEPTH="linearDepth";var Kg=(i,e,t)=>i.add(e).div(e.sub(t)),$Ee=(i,e,t)=>i.add(t).div(t.sub(e)),Wre=me(([i,e,t],n)=>n.renderer.reversedDepthBuffer===!0?t.sub(e).mul(i).sub(t):e.sub(t).mul(i).sub(e)),rV=(i,e,t)=>e.add(i).mul(t).div(t.sub(e).mul(i)),jre=(i,e,t)=>e.mul(i.add(t)).div(i.mul(e.sub(t))),II=me(([i,e,t],n)=>n.renderer.reversedDepthBuffer===!0?e.mul(t).div(e.sub(t).mul(i).sub(e)):e.mul(t).div(t.sub(e).mul(i).sub(t))),PI=(i,e,t)=>{e=e.max(1e-6).toVar();let n=vf(i.negate().div(e)),r=vf(t.div(e));return n.div(r)},YEe=(i,e,t)=>{let n=i.mul(xI(t.div(e)));return oe(Math.E).pow(n).mul(e).negate()},Xre=$n(Zu,Zu.DEPTH_BASE),sV=xt(Zu,Zu.DEPTH),v4=$n(Zu,Zu.LINEAR_DEPTH).setParameterLength(0,1),ZEe=v4(iV());sV.assign=i=>Xre(i);var Tf=class i extends Kt{static get type(){return"ClippingNode"}constructor(e=i.DEFAULT){super(),this.scope=e}setup(e){super.setup(e);let t=e.clippingContext,{intersectionPlanes:n,unionPlanes:r}=t;return this.hardwareClipping=e.hardwareClipping,this.scope===i.ALPHA_TO_COVERAGE?this.setupAlphaToCoverage(n,r):this.scope===i.HARDWARE?this.setupHardwareClipping(r,e):this.setupDefault(n,r)}setupAlphaToCoverage(e,t){return me(()=>{let n=oe().toVar("distanceToPlane"),r=oe().toVar("distanceToGradient"),s=oe(1).toVar("clipOpacity"),o=t.length;if(this.hardwareClipping===!1&&o>0){let l=Xo(t).setGroup(Jt);Oi(o,({i:c})=>{let u=l.element(c);n.assign(xs.dot(u.xyz).negate().add(u.w)),r.assign(n.fwidth().div(2)),s.mulAssign(pc(r.negate(),r,n))})}let a=e.length;if(a>0){let l=Xo(e).setGroup(Jt),c=oe(1).toVar("intersectionClipOpacity");Oi(a,({i:u})=>{let f=l.element(u);n.assign(xs.dot(f.xyz).negate().add(f.w)),r.assign(n.fwidth().div(2)),c.mulAssign(pc(r.negate(),r,n).oneMinus())}),s.mulAssign(c.oneMinus())}Bi.a.mulAssign(s),Bi.a.equal(0).discard()})()}setupDefault(e,t){return me(()=>{let n=t.length;if(this.hardwareClipping===!1&&n>0){let s=Xo(t).setGroup(Jt);Oi(n,({i:o})=>{let a=s.element(o);xs.dot(a.xyz).greaterThan(a.w).discard()})}let r=e.length;if(r>0){let s=Xo(e).setGroup(Jt),o=fc(!0).toVar("clipped");Oi(r,({i:a})=>{let l=s.element(a);o.assign(xs.dot(l.xyz).greaterThan(l.w).and(o))}),o.discard()}})()}setupHardwareClipping(e,t){let n=e.length;return t.enableHardwareClipping(n),me(()=>{let r=Xo(e).setGroup(Jt),s=ip(t.getClipDistance());Oi(n,({i:o})=>{let a=r.element(o),l=xs.dot(a.xyz).sub(a.w).negate();s.element(o).assign(l)})})()}};Tf.ALPHA_TO_COVERAGE="alphaToCoverage";Tf.DEFAULT="default";Tf.HARDWARE="hardware";var KEe=()=>new Tf,QEe=()=>new Tf(Tf.ALPHA_TO_COVERAGE),JEe=()=>new Tf(Tf.HARDWARE),e3e=.05,Uee=me(([i])=>$u(Tn(1e4,Za(Tn(17,i.x).add(Tn(.1,i.y)))).mul(Ls(.1,fr(Za(Tn(13,i.y).add(i.x))))))),kee=me(([i])=>Uee(dt(Uee(i.xy),i.z))),t3e=me(([i])=>{let e=zr(xf(vz(i.xyz)),xf(_z(i.xyz))),t=oe(1).div(oe(e3e).mul(e)).toVar("pixScale"),n=dt(fx(_f(vf(t))),fx(yI(vf(t)))),r=dt(kee(_f(n.x.mul(i.xyz))),kee(_f(n.y.mul(i.xyz)))),s=$u(vf(t)),o=Ls(Tn(s.oneMinus(),r.x),Tn(s,r.y)),a=Il(s,s.oneMinus()),l=pe(o.mul(o).div(Tn(2,a).mul(ai(1,a))),o.sub(Tn(.5,a)).div(ai(1,a)),ai(1,ai(1,o).mul(ai(1,o)).div(Tn(2,a).mul(ai(1,a))))),c=o.lessThan(a.oneMinus()).select(o.lessThan(a).select(l.x,l.y),l.z);return Yu(c,1e-6,1)}).setLayout({name:"getAlphaHashThreshold",type:"float",inputs:[{name:"position",type:"vec3"}]}),a7=class extends f4{static get type(){return"VertexColorNode"}constructor(e){super(null,"vec4"),this.isVertexColorNode=!0,this.index=e}getAttributeName(){let e=this.index;return"color"+(e>0?e:"")}generate(e){let t=this.getAttributeName(e),n=e.hasGeometryAttribute(t),r;return n===!0?r=super.generate(e):r=e.generateConst(this.nodeType,new xn(1,1,1,1)),r}serialize(e){super.serialize(e),e.index=this.index}deserialize(e){super.deserialize(e),this.index=e.index}},$re=(i=0)=>new a7(i),Ir=class extends Ws{static get type(){return"NodeMaterial"}get type(){return this.constructor.type}set type(e){}constructor(){super(),this.isNodeMaterial=!0,this.fog=!0,this.lights=!1,this.lightsNode=null,this.envNode=null,this.aoNode=null,this.colorNode=null,this.normalNode=null,this.opacityNode=null,this.backdropNode=null,this.backdropAlphaNode=null,this.alphaTestNode=null,this.maskNode=null,this.maskShadowNode=null,this.positionNode=null,this.geometryNode=null,this.depthNode=null,this.receivedShadowPositionNode=null,this.castShadowPositionNode=null,this.receivedShadowNode=null,this.castShadowNode=null,this.outputNode=null,this.mrtNode=null,this.fragmentNode=null,this.vertexNode=null,this.contextNode=null}_getNodeChildren(){let e=[];for(let t of Object.getOwnPropertyNames(this)){if(t.startsWith("_")===!0)continue;let n=this[t];n&&n.isNode===!0&&e.push({property:t,childNode:n})}return e}customProgramCacheKey(){let e=[];for(let{property:t,childNode:n}of this._getNodeChildren())e.push(yx(t.slice(0,-4)),n.getCacheKey());return this.type+PS(e)}build(e){this.setup(e)}setupObserver(e){return new cU(e)}setup(e){e.context.setupNormal=()=>Zg(this.setupNormal(e),"NORMAL","vec3"),e.context.setupPositionView=()=>this.setupPositionView(e),e.context.setupModelViewProjection=()=>this.setupModelViewProjection(e);let t=e.renderer,n=t.getRenderTarget();e.addStack();let r=this.setupVertex(e),s=Zg(this.vertexNode||r,"VERTEX");e.context.clipSpace=s,e.stack.outputNode=s,this.setupHardwareClipping(e),this.geometryNode!==null&&(e.stack.outputNode=e.stack.outputNode.bypass(this.geometryNode)),e.addFlow("vertex",e.removeStack()),e.addStack();let o,a=this.setupClipping(e);if((this.depthWrite===!0||this.depthTest===!0)&&(n!==null?n.depthBuffer===!0&&this.setupDepth(e):t.depth===!0&&this.setupDepth(e)),this.fragmentNode===null){this.setupDiffuseColor(e),this.setupAmbientOcclusion(e),this.setupVariants(e);let l=this.setupLighting(e);a!==null&&e.stack.addToStack(a);let c=Ft(l,Bi.a).max(0);o=this.setupOutput(e,c),ox.assign(o);let u=this.outputNode!==null;if(u&&(o=this.outputNode),e.context.getOutput&&(o=e.context.getOutput(o,e)),n!==null){let f=t.getMRT(),d=this.mrtNode;f!==null?(u&&ox.assign(o),o=f,d!==null&&(o=f.merge(d))):d!==null&&(o=d)}}else{let l=this.fragmentNode;l.isOutputStructNode!==!0&&(l=l.convert(e.getOutputType())),o=this.setupOutput(e,l)}e.stack.outputNode=o,e.addFlow("fragment",e.removeStack()),e.observer=this.setupObserver(e)}setupClipping(e){if(e.clippingContext===null)return null;let{unionPlanes:t,intersectionPlanes:n}=e.clippingContext,r=null;if(t.length>0||n.length>0){let s=e.renderer.currentSamples;this.alphaToCoverage&&s>1?r=QEe():e.stack.addToStack(KEe())}return r}setupHardwareClipping(e){if(e.hardwareClipping=!1,e.clippingContext===null)return;let t=e.clippingContext.unionPlanes.length;t>0&&t<=8&&e.isAvailable("clipDistance")&&(e.stack.addToStack(JEe()),e.hardwareClipping=!0)}setupDepth(e){let{renderer:t,camera:n}=e,r=this.depthNode;if(r===null){let s=t.getMRT();s&&s.has("depth")?r=s.get("depth"):t.logarithmicDepthBuffer===!0&&(n.isPerspectiveCamera?r=PI(xs.z,cm,um):r=Kg(xs.z,cm,um))}r!==null&&sV.assign(r).toStack()}setupPositionView(){return Sf.mul(Mr).xyz}setupModelViewProjection(){return Qa.mul(xs)}setupVertex(e){return e.addStack(),this.setupPosition(e),e.context.position=e.removeStack(),Lre}setupPosition(e){let{object:t,geometry:n}=e;if((n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color)&&Gre(t),t.isSkinnedMesh===!0&&zre(t),this.displacementMap){let r=Yd("displacementMap","texture"),s=Yd("displacementScale","float"),o=Yd("displacementBias","float");Mr.addAssign(ba.normalize().mul(r.x.mul(s).add(o)))}return t.isBatchedMesh&&Ore(t),t.isInstancedMesh&&t.instanceMatrix&&t.instanceMatrix.isInstancedBufferAttribute===!0&&Bre(t),this.positionNode!==null&&Mr.assign(Zg(this.positionNode,"POSITION","vec3")),Mr}setupDiffuseColor(e){let{object:t,geometry:n}=e;this.maskNode!==null&&fc(this.maskNode).not().discard();let r=this.colorNode?Ft(this.colorNode):ore;this.vertexColors===!0&&n.hasAttribute("color")&&(r=r.mul($re())),t.instanceColor&&(r=Jz.mul(r)),t.isBatchedMesh&&t._colorsTexture&&(r=eV.mul(r)),Bi.assign(r);let s=this.opacityNode?oe(this.opacityNode):Xz;Bi.a.assign(Bi.a.mul(s));let o=null;(this.alphaTestNode!==null||this.alphaTest>0)&&(o=this.alphaTestNode!==null?oe(this.alphaTestNode):sre,this.alphaToCoverage===!0?(Bi.a=pc(o,o.add(yz(Bi.a)),Bi.a),Bi.a.lessThanEqual(0).discard()):Bi.a.lessThanEqual(o).discard()),this.alphaHash===!0&&Bi.a.lessThan(t3e(Mr)).discard(),e.isOpaque()&&Bi.a.assign(1)}setupVariants(){}setupOutgoingLight(){return this.lights===!0?pe(0):Bi.rgb}setupNormal(){return this.normalNode?pe(this.normalNode):dre}setupEnvironment(){let e=null;return this.envNode?e=this.envNode:this.envMap&&(e=this.envMap.isCubeTexture?Yd("envMap","cubeTexture"):Yd("envMap","texture")),e}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new s7(Qz)),t}setupMaterialLightings(e){let t=[];if(e.renderer.lighting.enabled===!1)return t;let n=this.setupEnvironment(e);n&&n.isLightingNode&&t.push(n);let r=this.setupLightMap(e);return r&&r.isLightingNode&&t.push(r),e.context.ambientOcclusion&&t.push(new i7(e.context.ambientOcclusion)),t}setupAmbientOcclusion(e){let t=this.aoNode;t===null&&e.material.aoMap&&(t=Pre),e.context.getAO&&(t=e.context.getAO(t,e)),t!==null&&(xU.assign(t),e.context.ambientOcclusion=xU)}setupLightingModel(){}setupLighting(e){let{material:t}=e,{backdropNode:n,backdropAlphaNode:r,emissiveNode:s}=this,o=this.lights===!0||this.lightsNode!==null,a=this.lights===!0?this.setupMaterialLightings(e):[],l=o?this.lightsNode||e.lightsNode:null,c=this.setupOutgoingLight(e);if(l&&(a.length>0||l.getScope().hasLights)){let u=this.setupLightingModel(e)||null;c=qre(l,u,a,n,r)}else n!==null&&(c=pe(r!==null?Qn(c,n,r):n));return(s&&s.isNode===!0||t.emissive&&t.emissive.isColor===!0)&&(_U.assign(pe(s||lre)),c=c.add(_U)),c}setupFog(e,t){let n=e.fogNode;return n&&(ox.assign(t),t=Ft(n.toVar())),t}setupPremultipliedAlpha(e,t){return Nz(t)}setupOutput(e,t){return this.fog===!0&&(t=this.setupFog(e,t)),this.premultipliedAlpha===!0&&(t=this.setupPremultipliedAlpha(e,t)),t}setDefaultValues(e){for(let n in e){let r=e[n];this[n]===void 0&&(this[n]=r,r&&r.clone&&(this[n]=r.clone()))}let t=Object.getOwnPropertyDescriptors(e.constructor.prototype);for(let n in t)Object.getOwnPropertyDescriptor(this.constructor.prototype,n)===void 0&&t[n].get!==void 0&&Object.defineProperty(this.constructor.prototype,n,t[n])}toJSON(e){let t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{},nodes:{}});let n=Ws.prototype.toJSON.call(this,e);n.inputNodes={};for(let{property:s,childNode:o}of this._getNodeChildren())n.inputNodes[s]=o.toJSON(e).uuid;function r(s){let o=[];for(let a in s){let l=s[a];delete l.metadata,o.push(l)}return o}if(t){let s=r(e.textures),o=r(e.images),a=r(e.nodes);s.length>0&&(n.textures=s),o.length>0&&(n.images=o),a.length>0&&(n.nodes=a)}return n}copy(e){let t=Object.getOwnPropertyDescriptors(this.constructor.prototype);for(let n in t)if(t[n].set!==void 0&&e[n]!==void 0){let r=e[n];this[n]&&this[n].copy!==void 0?this[n].copy(r):this[n]=r}for(let n in this)if(!/^(?:is[A-Z]|_)|^(?:id|uuid|version|type|userData|clippingPlanes)$/.test(n)&&this[n]!==void 0&&e[n]!==void 0){let r=e[n];this[n]&&this[n].copy!==void 0?this[n].copy(r):this[n]=r}return this.clippingPlanes=e.clippingPlanes?e.clippingPlanes.map(n=>n.clone()):null,this.userData=JSON.parse(JSON.stringify(e.userData)),this}},n3e=new Pu,l7=class extends Ir{static get type(){return"LineBasicNodeMaterial"}constructor(e){super(),this.isLineBasicNodeMaterial=!0,this.setDefaultValues(n3e),this.setValues(e)}},i3e=new J2,c7=class extends Ir{static get type(){return"LineDashedNodeMaterial"}constructor(e){super(),this.isLineDashedNodeMaterial=!0,this.setDefaultValues(i3e),this.dashOffset=0,this.offsetNode=null,this.dashScaleNode=null,this.dashSizeNode=null,this.gapSizeNode=null,this.setValues(e)}setupVariants(){let e=this.offsetNode?oe(this.offsetNode):Kz,t=this.dashScaleNode?oe(this.dashScaleNode):$z,n=this.dashSizeNode?oe(this.dashSizeNode):Yz,r=this.gapSizeNode?oe(this.gapSizeNode):Zz;Yg.assign(n),fS.assign(r);let s=bm(hc("lineDistance").mul(t));(e?s.add(e):s).mod(Yg.add(fS)).greaterThan(Yg).discard()}};var ZR=h1("vec3","worldStart"),u7=h1("vec3","worldEnd"),Yre=h1("float","lineDistance"),zg=h1("vec4","worldPos"),zee=me(({start:i,end:e})=>{let t=Qa.element(2).element(2),n=Qa.element(3).element(2);return t.greaterThan(0).select(n.negate().div(t.add(1)),n.mul(-.5).div(t)).sub(i.z).div(e.z.sub(i.z))},{start:"vec4",end:"vec4",return:"float"}),r3e=me(({p1:i,p2:e,p3:t,p4:n})=>{let r=i.sub(t),s=n.sub(t),o=e.sub(i),a=r.dot(s),l=s.dot(o),c=r.dot(o),u=s.dot(s),d=o.dot(o).mul(u).sub(l.mul(l)),y=a.mul(l).sub(c.mul(u)).div(d).clamp(),w=a.add(l.mul(y)).div(u).clamp();return dt(y,w)},{p1:"vec3",p2:"vec3",p3:"vec3",p4:"vec3",return:"vec2"}),elt=me(({material:i})=>{let e=i._useDash,t=i._useWorldUnits,n=hc("instanceStart"),r=hc("instanceEnd"),s=Ft(Sf.mul(Ft(n,1))).toVar("start"),o=Ft(Sf.mul(Ft(r,1))).toVar("end"),a,l;e&&(a=oe(hc("instanceDistanceStart")).toVar("distanceStart"),l=oe(hc("instanceDistanceEnd")).toVar("distanceEnd")),t&&(ZR.assign(s.xyz),u7.assign(o.xyz));let c=ux.z.div(ux.w),u=Qa.element(2).element(3).equal(-1);if($t(u,()=>{$t(s.z.lessThan(0).and(o.z.greaterThan(0)),()=>{let T=zee({start:s,end:o});o.assign(Ft(Qn(s.xyz,o.xyz,T),o.w)),e&&l.assign(Qn(a,l,T))}).ElseIf(o.z.lessThan(0).and(s.z.greaterThanEqual(0)),()=>{let T=zee({start:o,end:s});s.assign(Ft(Qn(o.xyz,s.xyz,T),s.w)),e&&a.assign(Qn(l,a,T))})}),e){let T=i.dashScaleNode?oe(i.dashScaleNode):$z,R=i.offsetNode?oe(i.offsetNode):Kz,P=ga.y.lessThan(.5).select(T.mul(a),T.mul(l));P=P.add(R),Yre.assign(P)}let f=Qa.mul(s),d=Qa.mul(o),A=f.xyz.div(f.w),y=d.xyz.div(d.w),w=y.xy.sub(A.xy).toVar();w.x.assign(w.x.mul(c)),w.assign(w.normalize());let S=Ft().toVar();if(t){let T=o.xyz.sub(s.xyz).normalize(),R=Qn(s.xyz,o.xyz,.5).normalize(),P=T.cross(R).normalize(),I=T.cross(P);zg.assign(ga.y.lessThan(.5).select(s,o));let F=m4.mul(.5);zg.addAssign(Ft(ga.x.lessThan(0).select(P.mul(F),P.mul(F).negate()),0)),e||(zg.addAssign(Ft(ga.y.lessThan(.5).select(T.mul(F).negate(),T.mul(F)),0)),zg.addAssign(Ft(I.mul(F),0)),$t(ga.y.greaterThan(1).or(ga.y.lessThan(0)),()=>{zg.subAssign(Ft(I.mul(2).mul(F),0))})),S.assign(Qa.mul(zg));let D=pe().toVar();D.assign(ga.y.lessThan(.5).select(A,y)),S.z.assign(D.z.mul(S.w))}else{let T=dt(w.y,w.x.negate()).toVar("offset");w.x.assign(w.x.div(c)),T.x.assign(T.x.div(c)),T.assign(ga.x.lessThan(0).select(T.negate(),T)),$t(ga.y.lessThan(0),()=>{T.assign(T.sub(w))}).ElseIf(ga.y.greaterThan(1),()=>{T.assign(T.add(w))}),T.assign(T.mul(m4)),T.assign(T.div(ux.w.div(Uz))),S.assign(ga.y.lessThan(.5).select(f,d)),T.assign(T.mul(S.w)),S.assign(S.add(Ft(T,0,0)))}return S})(),tlt=me(({material:i,renderer:e})=>{let t=i._useAlphaToCoverage,n=i._useDash,r=i._useWorldUnits,s=Ui();if(n){let a=i.dashSizeNode?oe(i.dashSizeNode):Yz,l=i.gapSizeNode?oe(i.gapSizeNode):Zz;Yg.assign(a),fS.assign(l),s.y.lessThan(-1).or(s.y.greaterThan(1)).discard(),Yre.mod(Yg.add(fS)).greaterThan(Yg).discard()}let o=oe(1).toVar("alpha");if(r){let a=zg.xyz.normalize().mul(1e5),l=u7.sub(ZR),c=r3e({p1:ZR,p2:u7,p3:pe(0,0,0),p4:a}),u=ZR.add(l.mul(c.x)),f=a.mul(c.y),y=u.sub(f).length().div(m4);if(!n)if(t&&e.currentSamples>0){let w=y.fwidth();o.assign(pc(w.negate().add(.5),w.add(.5),y).oneMinus())}else y.greaterThan(.5).discard()}else if(t&&e.currentSamples>0){let a=s.x,l=s.y.greaterThan(0).select(s.y.sub(1),s.y.add(1)),c=a.mul(a).add(l.mul(l)),u=oe(c.fwidth()).toVar("dlen");$t(s.y.abs().greaterThan(1),()=>{o.assign(pc(u.oneMinus(),u.add(1),c).oneMinus())})}else $t(s.y.abs().greaterThan(1),()=>{let a=s.x,l=s.y.greaterThan(0).select(s.y.sub(1),s.y.add(1));a.mul(a).add(l.mul(l)).greaterThan(1).discard()});return o})();var s3e=new K2,h7=class extends Ir{static get type(){return"MeshNormalNodeMaterial"}constructor(e){super(),this.isMeshNormalNodeMaterial=!0,this.setDefaultValues(s3e),this.setValues(e)}setupDiffuseColor(){let e=this.opacityNode?oe(this.opacityNode):Xz;Bi.assign(wI(Ft(Wz(hi),e),Fr))}},oV=me(([i=zz])=>{let e=i.z.atan(i.x).mul(1/(Math.PI*2)).add(.5),t=i.y.clamp(-1,1).asin().mul(1/Math.PI).add(.5);return dt(e,t)}),f7=me(([i=Ui()])=>{let e=i.x.sub(.5).mul(Math.PI*2),t=i.y.sub(.5).mul(Math.PI),n=t.cos(),r=n.mul(e.cos()),s=t.sin(),o=n.mul(e.sin());return pe(r,s,o)}),_4=class extends Fa{constructor(e=1,t={}){super(e,e,t),this.isCubeRenderTarget=!0;let n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new Lh(r),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){let n=t.minFilter,r=t.generateMipmaps;t.generateMipmaps=!0,this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let s=new Lu(5,5,5),o=oV(zz),a=new Ir;a.colorNode=fi(t,o,0),a.side=mi,a.blending=ps;let l=new Hn(s,a),c=new o0;c.add(l),t.minFilter===Vo&&(t.minFilter=Mi);let u=new o_(1,10,this),f=e.getMRT();return e.setMRT(null),u.update(e,c),e.setMRT(f),t.minFilter=n,t.generateMipmaps=r,l.geometry.dispose(),l.material.dispose(),this}clear(e,t=!0,n=!0,r=!0){let s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,n,r);e.setRenderTarget(s)}},oS=new WeakMap,d7=class extends Rr{static get type(){return"CubeMapNode"}constructor(e){super("vec3"),this.envNode=e,this._cubeTexture=null,this._cubeTextureNode=Ka(null);let t=new Lh;t.isRenderTargetTexture=!0,this._defaultTexture=t,this.updateBeforeType=yn.RENDER}updateBefore(e){let{renderer:t,material:n}=e,r=this.envNode;if(r.isTextureNode||r.isMaterialReferenceNode){let s=r.isTextureNode?r.value:n[r.property];if(s&&s.isTexture){let o=s.mapping;if(o===m0||o===A0){if(oS.has(s)){let a=oS.get(s);Vee(a,s.mapping),this._cubeTexture=a}else{let a=s.image;if(o3e(a)){let l=new _4(a.height);l.fromEquirectangularTexture(t,s),Vee(l.texture,s.mapping),this._cubeTexture=l.texture,oS.set(s,l.texture),s.addEventListener("dispose",Zre)}else this._cubeTexture=this._defaultTexture}this._cubeTextureNode.value=this._cubeTexture}else this._cubeTextureNode=this.envNode}}}setup(e){return this.updateBefore(e),this._cubeTextureNode}};function o3e(i){return i==null?!1:i.height>0}function Zre(i){let e=i.target;e.removeEventListener("dispose",Zre);let t=oS.get(e);t!==void 0&&(oS.delete(e),t.dispose())}function Vee(i,e){e===m0?i.mapping=Jl:e===A0&&(i.mapping=Hc)}var Kre=$n(d7).setParameterLength(1),AS=class extends xm{static get type(){return"BasicEnvironmentNode"}constructor(e=null){super(),this.envNode=e}setup(e){e.context.environment=Kre(this.envNode)}},p7=class extends xm{static get type(){return"BasicLightMapNode"}constructor(e=null){super(),this.lightMapNode=e}setup(e){let t=oe(1/Math.PI);e.context.irradianceLightMap=this.lightMapNode.mul(t)}},Ax=class{start(e){e.lightsNode.setupLights(e,e.lightsNode.getLightNodes(e)),this.indirect(e)}finish(){}direct(){}directRectArea(){}indirect(){}ambientOcclusion(){}},x4=class extends Ax{constructor(){super()}indirect({context:e}){let t=e.ambientOcclusion,n=e.reflectedLight,r=e.irradianceLightMap;n.indirectDiffuse.assign(Ft(0)),r?n.indirectDiffuse.addAssign(r):n.indirectDiffuse.addAssign(Ft(1,1,1,0)),n.indirectDiffuse.mulAssign(t),n.indirectDiffuse.mulAssign(Bi.rgb)}finish(e){let{material:t,context:n}=e,r=n.outgoingLight,s=e.context.environment;if(s)switch(t.combine){case ig:r.rgb.assign(Qn(r.rgb,r.rgb.mul(s.rgb),sS.mul(YR)));break;case DM:r.rgb.assign(Qn(r.rgb,s.rgb,sS.mul(YR)));break;case NM:r.rgb.addAssign(s.rgb.mul(sS.mul(YR)));break;default:Xe("BasicLightingModel: Unsupported .combine value:",t.combine);break}}},a3e=new fs,m7=class extends Ir{static get type(){return"MeshBasicNodeMaterial"}constructor(e){super(),this.isMeshBasicNodeMaterial=!0,this.lights=!0,this.setDefaultValues(a3e),this.setValues(e)}setupNormal(){return d1(dx)}setupEnvironment(e){let t=super.setupEnvironment(e);return t?new AS(t):null}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new p7(Qz)),t}setupOutgoingLight(){return Bi.rgb}setupLightingModel(){return new x4}},gx=me(({f0:i,f90:e,dotVH:t})=>{let n=t.mul(-5.55473).sub(6.98316).mul(t).exp2();return i.mul(n.oneMinus()).add(e.mul(n))}),s1=me(i=>i.diffuseColor.mul(1/Math.PI)),l3e=()=>oe(.25),c3e=me(({dotNH:i})=>s4.mul(oe(.5)).add(1).mul(oe(1/Math.PI)).mul(i.pow(s4))),u3e=me(({lightDirection:i})=>{let e=i.add(er).normalize(),t=hi.dot(e).clamp(),n=er.dot(e).clamp(),r=gx({f0:vm,f90:1,dotVH:n}),s=l3e(),o=c3e({dotNH:t});return r.mul(s).mul(o)}),y4=class extends x4{constructor(e=!0){super(),this.specular=e}direct({lightDirection:e,lightColor:t,reflectedLight:n}){let s=hi.dot(e).clamp().mul(t);n.directDiffuse.addAssign(s.mul(s1({diffuseColor:Bi.rgb}))),this.specular===!0&&n.directSpecular.addAssign(s.mul(u3e({lightDirection:e})).mul(sS))}indirect(e){let{ambientOcclusion:t,irradiance:n,reflectedLight:r}=e.context;r.indirectDiffuse.addAssign(n.mul(s1({diffuseColor:Bi}))),r.indirectDiffuse.mulAssign(t)}},h3e=new Va,A7=class extends Ir{static get type(){return"MeshLambertNodeMaterial"}constructor(e){super(),this.isMeshLambertNodeMaterial=!0,this.lights=!0,this.setDefaultValues(h3e),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t?new AS(t):null}setupLightingModel(){return new y4(!1)}},f3e=new QA,g7=class extends Ir{static get type(){return"MeshPhongNodeMaterial"}constructor(e){super(),this.isMeshPhongNodeMaterial=!0,this.lights=!0,this.shininessNode=null,this.specularNode=null,this.setDefaultValues(f3e),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t?new AS(t):null}setupLightingModel(){return new y4}setupVariants(){let e=(this.shininessNode?oe(this.shininessNode):are).max(1e-4);s4.assign(e);let t=this.specularNode||cre;vm.assign(t)}},Qre=me(i=>{if(i.geometry.hasAttribute("normal")===!1)return oe(0);let e=dx.dFdx().abs().max(dx.dFdy().abs());return e.x.max(e.y).max(e.z)}),aV=me(i=>{let{roughness:e}=i,t=Qre(),n=e.max(.0525);return n=n.add(t),n=n.min(1),n}),Jre=me(({alpha:i,dotNL:e,dotNV:t})=>{let n=i.pow2(),r=e.mul(n.add(n.oneMinus().mul(t.pow2())).sqrt()),s=t.mul(n.add(n.oneMinus().mul(e.pow2())).sqrt());return dc(.5,r.add(s).max(_I))}).setLayout({name:"V_GGX_SmithCorrelated",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNL",type:"float"},{name:"dotNV",type:"float"}]}),d3e=me(({alphaT:i,alphaB:e,dotTV:t,dotBV:n,dotTL:r,dotBL:s,dotNV:o,dotNL:a})=>{let l=a.mul(pe(i.mul(t),e.mul(n),o).length()),c=o.mul(pe(i.mul(r),e.mul(s),a).length());return dc(.5,l.add(c).max(_I))}).setLayout({name:"V_GGX_SmithCorrelated_Anisotropic",type:"float",inputs:[{name:"alphaT",type:"float",qualifier:"in"},{name:"alphaB",type:"float",qualifier:"in"},{name:"dotTV",type:"float",qualifier:"in"},{name:"dotBV",type:"float",qualifier:"in"},{name:"dotTL",type:"float",qualifier:"in"},{name:"dotBL",type:"float",qualifier:"in"},{name:"dotNV",type:"float",qualifier:"in"},{name:"dotNL",type:"float",qualifier:"in"}]}),ese=me(({alpha:i,dotNH:e})=>{let t=i.pow2(),n=e.pow2().mul(t.oneMinus()).oneMinus();return t.div(n.pow2()).mul(1/Math.PI)}).setLayout({name:"D_GGX",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNH",type:"float"}]}),p3e=oe(1/Math.PI),m3e=me(({alphaT:i,alphaB:e,dotNH:t,dotTH:n,dotBH:r})=>{let s=i.mul(e),o=pe(e.mul(n),i.mul(r),s.mul(t)),a=o.dot(o),l=s.div(a);return p3e.mul(s.mul(l.pow2()))}).setLayout({name:"D_GGX_Anisotropic",type:"float",inputs:[{name:"alphaT",type:"float",qualifier:"in"},{name:"alphaB",type:"float",qualifier:"in"},{name:"dotNH",type:"float",qualifier:"in"},{name:"dotTH",type:"float",qualifier:"in"},{name:"dotBH",type:"float",qualifier:"in"}]}),lV=me(({lightDirection:i,f0:e,f90:t,roughness:n,f:r,normalView:s=hi,USE_IRIDESCENCE:o,USE_ANISOTROPY:a})=>{let l=n.pow2(),c=i.add(er).normalize(),u=s.dot(i).clamp(),f=s.dot(er).clamp(),d=s.dot(c).clamp(),A=er.dot(c).clamp(),y=gx({f0:e,f90:t,dotVH:A}),w,S;if(hx(o)&&(y=AI.mix(y,r)),hx(a)){let T=iS.dot(i),R=iS.dot(er),P=iS.dot(c),I=$g.dot(i),F=$g.dot(er),D=$g.dot(c);w=d3e({alphaT:r4,alphaB:l,dotTV:R,dotBV:F,dotTL:T,dotBL:I,dotNV:f,dotNL:u}),S=m3e({alphaT:r4,alphaB:l,dotNH:d,dotTH:P,dotBH:D})}else w=Jre({alpha:l,dotNL:u,dotNV:f}),S=ese({alpha:l,dotNH:d});return y.mul(w).mul(S)}),A3e=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]),uf=null,gS=me(({roughness:i,dotNV:e})=>{uf===null&&(uf=new jA(A3e,16,16,js,Wi),uf.name="DFG_LUT",uf.minFilter=Mi,uf.magFilter=Mi,uf.wrapS=aa,uf.wrapT=aa,uf.generateMipmaps=!1,uf.needsUpdate=!0);let t=dt(i,e);return fi(uf,t).rg}),g3e=me(({lightDirection:i,f0:e,f90:t,roughness:n,f:r,USE_IRIDESCENCE:s,USE_ANISOTROPY:o})=>{let a=lV({lightDirection:i,f0:e,f90:t,roughness:n,f:r,USE_IRIDESCENCE:s,USE_ANISOTROPY:o}),l=hi.dot(i).clamp(),c=hi.dot(er).clamp(),u=gS({roughness:n,dotNV:c}),f=gS({roughness:n,dotNV:l}),d=e.mul(u.x).add(t.mul(u.y)),A=e.mul(f.x).add(t.mul(f.y)),y=u.x.add(u.y),w=f.x.add(f.y),S=oe(1).sub(y),T=oe(1).sub(w),R=e.add(e.oneMinus().mul(.047619)),P=d.mul(A).mul(R).div(oe(1).sub(S.mul(T).mul(R).mul(R)).add(_I)),I=S.mul(T),F=P.mul(I);return a.add(F)}),tse=me(i=>{let{dotNV:e,specularColor:t,specularF90:n,roughness:r}=i,s=gS({dotNV:e,roughness:r});return t.mul(s.x).add(n.mul(s.y))}),v7=me(({f:i,f90:e,dotVH:t})=>{let n=t.oneMinus().saturate(),r=n.mul(n),s=n.mul(r,r).clamp(0,.9999);return i.sub(pe(e).mul(s)).div(s.oneMinus())}).setLayout({name:"Schlick_to_F0",type:"vec3",inputs:[{name:"f",type:"vec3"},{name:"f90",type:"float"},{name:"dotVH",type:"float"}]}),v3e=me(({roughness:i,dotNH:e})=>{let t=i.pow2(),n=oe(1).div(t),s=e.pow2().oneMinus().max(.0078125);return oe(2).add(n).mul(s.pow(n.mul(.5))).div(2*Math.PI)}).setLayout({name:"D_Charlie",type:"float",inputs:[{name:"roughness",type:"float"},{name:"dotNH",type:"float"}]}),_3e=me(({dotNV:i,dotNL:e})=>oe(1).div(oe(4).mul(e.add(i).sub(e.mul(i))))).setLayout({name:"V_Neubelt",type:"float",inputs:[{name:"dotNV",type:"float"},{name:"dotNL",type:"float"}]}),x3e=me(({lightDirection:i})=>{let e=i.add(er).normalize(),t=hi.dot(i).clamp(),n=hi.dot(er).clamp(),r=hi.dot(e).clamp(),s=v3e({roughness:lm,dotNH:r}),o=_3e({dotNV:n,dotNL:t});return lc.mul(s).mul(o)}),Gee=me(({N:i,V:e,roughness:t})=>{let s=.0078125,o=i.dot(e).saturate(),a=dt(t,o.oneMinus().sqrt());return a.assign(a.mul(.984375).add(s)),a}).setLayout({name:"LTC_Uv",type:"vec2",inputs:[{name:"N",type:"vec3"},{name:"V",type:"vec3"},{name:"roughness",type:"float"}]}),y3e=me(({f:i})=>{let e=i.length();return zr(e.mul(e).add(i.z).div(e.add(1)),0)}).setLayout({name:"LTC_ClippedSphereFormFactor",type:"float",inputs:[{name:"f",type:"vec3"}]}),gR=me(({v1:i,v2:e})=>{let t=i.dot(e),n=t.abs().toVar(),r=n.mul(.0145206).add(.4965155).mul(n).add(.8543985).toVar(),s=n.add(4.1616724).mul(n).add(3.417594).toVar(),o=r.div(s),a=t.greaterThan(0).select(o,zr(t.mul(t).oneMinus(),1e-7).inverseSqrt().mul(.5).sub(o));return i.cross(e).mul(a)}).setLayout({name:"LTC_EdgeVectorFormFactor",type:"vec3",inputs:[{name:"v1",type:"vec3"},{name:"v2",type:"vec3"}]}),FO=me(({N:i,V:e,P:t,mInv:n,p0:r,p1:s,p2:o,p3:a})=>{let l=s.sub(r).toVar(),c=a.sub(r).toVar(),u=l.cross(c),f=pe().toVar();return $t(u.dot(t.sub(r)).greaterThanEqual(0),()=>{let d=e.sub(i.mul(e.dot(i))).normalize(),A=i.cross(d).negate(),y=n.mul(To(d,A,i).transpose()).toVar(),w=y.mul(r.sub(t)).normalize().toVar(),S=y.mul(s.sub(t)).normalize().toVar(),T=y.mul(o.sub(t)).normalize().toVar(),R=y.mul(a.sub(t)).normalize().toVar(),P=pe(0).toVar();P.addAssign(gR({v1:w,v2:S})),P.addAssign(gR({v1:S,v2:T})),P.addAssign(gR({v1:T,v2:R})),P.addAssign(gR({v1:R,v2:w})),f.assign(pe(y3e({f:P})))}),f}).setLayout({name:"LTC_Evaluate",type:"vec3",inputs:[{name:"N",type:"vec3"},{name:"V",type:"vec3"},{name:"P",type:"vec3"},{name:"mInv",type:"mat3"},{name:"p0",type:"vec3"},{name:"p1",type:"vec3"},{name:"p2",type:"vec3"},{name:"p3",type:"vec3"}]});var LI=1/6,nse=i=>Tn(LI,Tn(i,Tn(i,i.negate().add(3)).sub(3)).add(1)),_7=i=>Tn(LI,Tn(i,Tn(i,Tn(3,i).sub(6))).add(4)),ise=i=>Tn(LI,Tn(i,Tn(i,Tn(-3,i).add(3)).add(3)).add(1)),x7=i=>Tn(LI,nu(i,3)),qee=i=>nse(i).add(_7(i)),Hee=i=>ise(i).add(x7(i)),Wee=i=>Ls(-1,_7(i).div(nse(i).add(_7(i)))),jee=i=>Ls(1,x7(i).div(ise(i).add(x7(i)))),Xee=(i,e,t)=>{let n=i.uvNode,r=Tn(n,e.zw).add(.5),s=_f(r),o=$u(r),a=qee(o.x),l=Hee(o.x),c=Wee(o.x),u=jee(o.x),f=Wee(o.y),d=jee(o.y),A=dt(s.x.add(c),s.y.add(f)).sub(.5).mul(e.xy),y=dt(s.x.add(u),s.y.add(f)).sub(.5).mul(e.xy),w=dt(s.x.add(c),s.y.add(d)).sub(.5).mul(e.xy),S=dt(s.x.add(u),s.y.add(d)).sub(.5).mul(e.xy),T=qee(o.y).mul(Ls(a.mul(i.sample(A).level(t)),l.mul(i.sample(y).level(t)))),R=Hee(o.y).mul(Ls(a.mul(i.sample(w).level(t)),l.mul(i.sample(S).level(t))));return T.add(R)},cV=me(([i,e])=>{let t=dt(i.size(de(e))),n=dt(i.size(de(e.add(1)))),r=dc(1,t),s=dc(1,n),o=Xee(i,Ft(r,t),_f(e)),a=Xee(i,Ft(s,n),yI(e));return $u(e).mix(o,a)}),b3e=me(([i,e])=>{let t=e.mul(Bz(i));return cV(i,t)}),$ee=me(([i,e,t,n,r])=>{let s=pe(Tz(e.negate(),xa(i),dc(1,n))),o=pe(xf(r[0].xyz),xf(r[1].xyz),xf(r[2].xyz));return xa(s).mul(t.mul(o))}).setLayout({name:"getVolumeTransmissionRay",type:"vec3",inputs:[{name:"n",type:"vec3"},{name:"v",type:"vec3"},{name:"thickness",type:"float"},{name:"ior",type:"float"},{name:"modelMatrix",type:"mat4"}]}),w3e=me(([i,e])=>i.mul(Yu(e.mul(2).sub(2),0,1))).setLayout({name:"applyIorToRoughness",type:"float",inputs:[{name:"roughness",type:"float"},{name:"ior",type:"float"}]}),S3e=nV(),T3e=Hre(),Yee=me(([i,e,t],{material:n})=>{let s=(n.side===mi?S3e:T3e).sample(i),o=vf(i1.x).mul(w3e(e,t));return cV(s,o)}),Zee=me(([i,e,t])=>($t(t.notEqual(0),()=>{let n=xI(e).negate().div(t);return fz(n.negate().mul(i))}),pe(1))).setLayout({name:"volumeAttenuation",type:"vec3",inputs:[{name:"transmissionDistance",type:"float"},{name:"attenuationColor",type:"vec3"},{name:"attenuationDistance",type:"float"}]}),E3e=me(([i,e,t,n,r,s,o,a,l,c,u,f,d,A,y])=>{let w,S;if(y){w=Ft().toVar(),S=pe().toVar();let F=u.sub(1).mul(y.mul(.025)),D=pe(u.sub(F),u,u.add(F));Oi({start:0,end:3},({i:L})=>{let C=D.element(L),B=$ee(i,e,f,C,a),k=o.add(B),z=c.mul(l.mul(Ft(k,1))),G=dt(z.xy.div(z.w)).toVar();G.addAssign(1),G.divAssign(2),G.assign(dt(G.x,G.y.oneMinus()));let W=Yee(G,t,C);w.element(L).assign(W.element(L)),w.a.addAssign(W.a),S.element(L).assign(n.element(L).mul(Zee(xf(B),d,A).element(L)))}),w.a.divAssign(3)}else{let F=$ee(i,e,f,u,a),D=o.add(F),L=c.mul(l.mul(Ft(D,1))),C=dt(L.xy.div(L.w)).toVar();C.addAssign(1),C.divAssign(2),C.assign(dt(C.x,C.y.oneMinus())),w=Yee(C,t,u),S=n.mul(Zee(xf(F),d,A))}let T=S.rgb.mul(w.rgb),R=i.dot(e).clamp(),P=pe(tse({dotNV:R,specularColor:r,specularF90:s,roughness:t})),I=S.r.add(S.g,S.b).div(3);return Ft(P.oneMinus().mul(T),w.a.oneMinus().mul(I).oneMinus())}),M3e=To(3.2404542,-.969266,.0556434,-1.5371385,1.8760108,-.2040259,-.4985314,.041556,1.0572252),C3e=i=>{let e=i.sqrt();return pe(1).add(e).div(pe(1).sub(e))},Kee=(i,e)=>i.sub(e).div(i.add(e)).pow2(),R3e=(i,e)=>{let t=i.mul(2*Math.PI*1e-9),n=pe(54856e-17,44201e-17,52481e-17),r=pe(1681e3,1795300,2208400),s=pe(43278e5,93046e5,66121e5),o=oe(9747e-17*Math.sqrt(2*Math.PI*45282e5)).mul(t.mul(2239900).add(e.x).cos()).mul(t.pow2().mul(-45282e5).exp()),a=n.mul(s.mul(2*Math.PI).sqrt()).mul(r.mul(t).add(e).cos()).mul(t.pow2().negate().mul(s).exp());return a=pe(a.x.add(o),a.y,a.z).div(10685e-11),M3e.mul(a)},Qee=me(({outsideIOR:i,eta2:e,cosTheta1:t,thinFilmThickness:n,baseF0:r})=>{let s=Qn(i,e,pc(0,.03,n)),a=i.div(s).pow2().mul(t.pow2().oneMinus()).oneMinus();$t(a.lessThan(0),()=>pe(1));let l=a.sqrt(),c=Kee(s,i),u=gx({f0:c,f90:1,dotVH:t}),f=u.oneMinus(),d=s.lessThan(i).select(Math.PI,0),A=oe(Math.PI).sub(d),y=C3e(r.clamp(0,.9999)),w=Kee(y,s.toVec3()),S=gx({f0:w,f90:1,dotVH:l}),T=pe(y.x.lessThan(s).select(Math.PI,0),y.y.lessThan(s).select(Math.PI,0),y.z.lessThan(s).select(Math.PI,0)),R=s.mul(n,l,2),P=pe(A).add(T),I=u.mul(S).clamp(1e-5,.9999),F=I.sqrt(),D=f.pow2().mul(S).div(pe(1).sub(I)),C=u.add(D).toVar(),B=D.sub(f).toVar();return Oi({start:1,end:2,condition:"<=",name:"m"},({m:k})=>{B.mulAssign(F);let z=R3e(oe(k).mul(R),oe(k).mul(P)).mul(2);C.addAssign(B.mul(z))}),C.max(pe(0))}).setLayout({name:"evalIridescence",type:"vec3",inputs:[{name:"outsideIOR",type:"float"},{name:"eta2",type:"float"},{name:"cosTheta1",type:"float"},{name:"thinFilmThickness",type:"float"},{name:"baseF0",type:"vec3"}]}),Ow=me(({normal:i,viewDir:e,roughness:t})=>{let n=i.dot(e).saturate(),r=t.mul(t),s=t.add(.1).reciprocal(),o=oe(-1.9362).add(t.mul(1.0678)).add(r.mul(.4573)).sub(s.mul(.8469)),a=oe(-.6014).add(t.mul(.5538)).sub(r.mul(.467)).sub(s.mul(.1255));return o.mul(n).add(a).exp().saturate()}),Uw=pe(.04),vR=oe(1),b4=class extends Ax{constructor(e=!1,t=!1,n=!1,r=!1,s=!1,o=!1){super(),this.clearcoat=e,this.sheen=t,this.iridescence=n,this.anisotropy=r,this.transmission=s,this.dispersion=o,this.clearcoatRadiance=null,this.clearcoatSpecularDirect=null,this.clearcoatSpecularIndirect=null,this.sheenSpecularDirect=null,this.sheenSpecularIndirect=null,this.iridescenceFresnel=null,this.iridescenceF0=null,this.iridescenceF0Dielectric=null,this.iridescenceF0Metallic=null}start(e){if(this.clearcoat===!0&&(this.clearcoatRadiance=pe().toVar("clearcoatRadiance"),this.clearcoatSpecularDirect=pe().toVar("clearcoatSpecularDirect"),this.clearcoatSpecularIndirect=pe().toVar("clearcoatSpecularIndirect")),this.sheen===!0&&(this.sheenSpecularDirect=pe().toVar("sheenSpecularDirect"),this.sheenSpecularIndirect=pe().toVar("sheenSpecularIndirect")),this.iridescence===!0){let t=hi.dot(er).clamp(),n=Qee({outsideIOR:oe(1),eta2:n4,cosTheta1:t,thinFilmThickness:i4,baseF0:vm}),r=Qee({outsideIOR:oe(1),eta2:n4,cosTheta1:t,thinFilmThickness:i4,baseF0:Bi.rgb});this.iridescenceFresnel=Qn(n,r,Kd),this.iridescenceF0Dielectric=v7({f:n,f90:1,dotVH:t}),this.iridescenceF0Metallic=v7({f:r,f90:1,dotVH:t}),this.iridescenceF0=Qn(this.iridescenceF0Dielectric,this.iridescenceF0Metallic,Kd)}if(this.transmission===!0){let t=yf,n=Die.sub(yf).normalize(),r=Tm,s=e.context;s.backdrop=E3e(r,n,Af,Vg,qg,Hg,t,iu,Sm,Qa,rS,az,cz,lz,this.dispersion?uz:null),s.backdropAlpha=o4,Bi.a.mulAssign(Qn(1,s.backdrop.a,o4))}super.start(e)}computeMultiscattering(e,t,n,r,s=null){let o=hi.dot(er).clamp(),a=gS({roughness:Af,dotNV:o}),l=s?AI.mix(r,s):r,c=l.mul(a.x).add(n.mul(a.y)),f=a.x.add(a.y).oneMinus(),d=l.add(l.oneMinus().mul(.047619)),A=c.mul(d).div(f.mul(d).oneMinus());e.addAssign(c),t.addAssign(A.mul(f))}direct({lightDirection:e,lightColor:t,reflectedLight:n}){let s=hi.dot(e).clamp().mul(t).toVar();if(this.sheen===!0){this.sheenSpecularDirect.addAssign(s.mul(x3e({lightDirection:e})));let o=Ow({normal:hi,viewDir:er,roughness:lm}),a=Ow({normal:hi,viewDir:e,roughness:lm}),l=lc.r.max(lc.g).max(lc.b).mul(o.max(a)).oneMinus();s.mulAssign(l)}if(this.clearcoat===!0){let a=hm.dot(e).clamp().mul(t);this.clearcoatSpecularDirect.addAssign(a.mul(lV({lightDirection:e,f0:Uw,f90:vR,roughness:sx,normalView:hm})))}n.directDiffuse.addAssign(s.mul(s1({diffuseColor:Vg}))),n.directSpecular.addAssign(s.mul(g3e({lightDirection:e,f0:qg,f90:1,roughness:Af,f:this.iridescenceFresnel,USE_IRIDESCENCE:this.iridescence,USE_ANISOTROPY:this.anisotropy})))}directRectArea({lightColor:e,lightPosition:t,halfWidth:n,halfHeight:r,reflectedLight:s,ltc_1:o,ltc_2:a}){let l=t.add(n).sub(r),c=t.sub(n).sub(r),u=t.sub(n).add(r),f=t.add(n).add(r),d=hi,A=er,y=xs.toVar(),w=Gee({N:d,V:A,roughness:Af}),S=o.sample(w).toVar(),T=a.sample(w).toVar(),R=To(pe(S.x,0,S.y),pe(0,1,0),pe(S.z,0,S.w)).toVar(),P=qg.mul(T.x).add(Hg.sub(qg).mul(T.y)).toVar();if(s.directSpecular.addAssign(e.mul(P).mul(FO({N:d,V:A,P:y,mInv:R,p0:l,p1:c,p2:u,p3:f}))),s.directDiffuse.addAssign(e.mul(Vg).mul(FO({N:d,V:A,P:y,mInv:To(1,0,0,0,1,0,0,0,1),p0:l,p1:c,p2:u,p3:f}))),this.clearcoat===!0){let I=hm,F=Gee({N:I,V:A,roughness:sx}),D=o.sample(F),L=a.sample(F),C=To(pe(D.x,0,D.y),pe(0,1,0),pe(D.z,0,D.w)),B=Uw.mul(L.x).add(vR.sub(Uw).mul(L.y));this.clearcoatSpecularDirect.addAssign(e.mul(B).mul(FO({N:I,V:A,P:y,mInv:C,p0:l,p1:c,p2:u,p3:f})))}}indirect(e){this.indirectDiffuse(e),this.indirectSpecular(e),this.ambientOcclusion(e)}indirectDiffuse(e){let{irradiance:t,reflectedLight:n}=e.context,r=t.mul(s1({diffuseColor:Vg})).toVar();if(this.sheen===!0){let s=Ow({normal:hi,viewDir:er,roughness:lm}),o=lc.r.max(lc.g).max(lc.b).mul(s).oneMinus();r.mulAssign(o)}n.indirectDiffuse.addAssign(r)}indirectSpecular(e){let{radiance:t,iblIrradiance:n,reflectedLight:r}=e.context;if(this.sheen===!0&&this.sheenSpecularIndirect.addAssign(n.mul(lc,Ow({normal:hi,viewDir:er,roughness:lm}))),this.clearcoat===!0){let S=hm.dot(er).clamp(),T=tse({dotNV:S,specularColor:Uw,specularF90:vR,roughness:sx});this.clearcoatSpecularIndirect.addAssign(this.clearcoatRadiance.mul(T))}let s=pe().toVar("singleScatteringDielectric"),o=pe().toVar("multiScatteringDielectric"),a=pe().toVar("singleScatteringMetallic"),l=pe().toVar("multiScatteringMetallic");this.computeMultiscattering(s,o,Hg,vm,this.iridescenceF0Dielectric),this.computeMultiscattering(a,l,Hg,Bi.rgb,this.iridescenceF0Metallic);let c=Qn(s,a,Kd),u=Qn(o,l,Kd),f=s.add(o),d=Vg.mul(f.oneMinus()),A=n.mul(1/Math.PI),y=t.mul(c).add(u.mul(A)).toVar(),w=d.mul(A).toVar();if(this.sheen===!0){let S=Ow({normal:hi,viewDir:er,roughness:lm}),T=lc.r.max(lc.g).max(lc.b).mul(S).oneMinus();y.mulAssign(T),w.mulAssign(T)}r.indirectSpecular.addAssign(y),r.indirectDiffuse.addAssign(w)}ambientOcclusion(e){let{ambientOcclusion:t,reflectedLight:n}=e.context,s=hi.dot(er).clamp().add(t),o=Af.mul(-16).oneMinus().negate().exp2(),a=t.sub(s.pow(o).oneMinus()).clamp();this.clearcoat===!0&&this.clearcoatSpecularIndirect.mulAssign(t),this.sheen===!0&&this.sheenSpecularIndirect.mulAssign(t),n.indirectDiffuse.mulAssign(t),n.indirectSpecular.mulAssign(a)}finish({context:e}){let{outgoingLight:t}=e;if(this.clearcoat===!0){let n=hm.dot(er).clamp(),r=gx({dotVH:n,f0:Uw,f90:vR}),s=t.mul(t4.mul(r).oneMinus()).add(this.clearcoatSpecularDirect.add(this.clearcoatSpecularIndirect).mul(t4));t.assign(s)}if(this.sheen===!0){let n=t.add(this.sheenSpecularDirect,this.sheenSpecularIndirect.mul(1/Math.PI));t.assign(n)}}},Jee=oe(1),y7=oe(-2),_R=oe(.8),BO=oe(-1),xR=oe(.4),OO=oe(2),yR=oe(.305),UO=oe(3),ete=oe(.21),I3e=oe(4),tte=oe(4),P3e=oe(16),L3e=me(([i])=>{let e=pe(fr(i)).toVar(),t=oe(-1).toVar();return $t(e.x.greaterThan(e.z),()=>{$t(e.x.greaterThan(e.y),()=>{t.assign(_a(i.x.greaterThan(0),0,3))}).Else(()=>{t.assign(_a(i.y.greaterThan(0),1,4))})}).Else(()=>{$t(e.z.greaterThan(e.y),()=>{t.assign(_a(i.z.greaterThan(0),2,5))}).Else(()=>{t.assign(_a(i.y.greaterThan(0),1,4))})}),t}).setLayout({name:"getFace",type:"float",inputs:[{name:"direction",type:"vec3"}]}),D3e=me(([i,e])=>{let t=dt().toVar();return $t(e.equal(0),()=>{t.assign(dt(i.z,i.y).div(fr(i.x)))}).ElseIf(e.equal(1),()=>{t.assign(dt(i.x.negate(),i.z.negate()).div(fr(i.y)))}).ElseIf(e.equal(2),()=>{t.assign(dt(i.x.negate(),i.y).div(fr(i.z)))}).ElseIf(e.equal(3),()=>{t.assign(dt(i.z.negate(),i.y).div(fr(i.x)))}).ElseIf(e.equal(4),()=>{t.assign(dt(i.x.negate(),i.z).div(fr(i.y)))}).Else(()=>{t.assign(dt(i.x,i.y).div(fr(i.z)))}),Tn(.5,t.add(1))}).setLayout({name:"getUV",type:"vec2",inputs:[{name:"direction",type:"vec3"},{name:"face",type:"float"}]}),N3e=me(([i])=>{let e=oe(0).toVar();return $t(i.greaterThanEqual(_R),()=>{e.assign(Jee.sub(i).mul(BO.sub(y7)).div(Jee.sub(_R)).add(y7))}).ElseIf(i.greaterThanEqual(xR),()=>{e.assign(_R.sub(i).mul(OO.sub(BO)).div(_R.sub(xR)).add(BO))}).ElseIf(i.greaterThanEqual(yR),()=>{e.assign(xR.sub(i).mul(UO.sub(OO)).div(xR.sub(yR)).add(OO))}).ElseIf(i.greaterThanEqual(ete),()=>{e.assign(yR.sub(i).mul(I3e.sub(UO)).div(yR.sub(ete)).add(UO))}).Else(()=>{e.assign(oe(-2).mul(vf(Tn(1.16,i))))}),e}).setLayout({name:"roughnessToMip",type:"float",inputs:[{name:"roughness",type:"float"}]}),rse=me(([i,e])=>{let t=i.toVar();t.assign(Tn(2,t).sub(1));let n=pe(t,1).toVar();return $t(e.equal(0),()=>{n.assign(n.zyx)}).ElseIf(e.equal(1),()=>{n.assign(n.xzy),n.xz.mulAssign(-1)}).ElseIf(e.equal(2),()=>{n.x.mulAssign(-1)}).ElseIf(e.equal(3),()=>{n.assign(n.zyx),n.xz.mulAssign(-1)}).ElseIf(e.equal(4),()=>{n.assign(n.xzy),n.xy.mulAssign(-1)}).ElseIf(e.equal(5),()=>{n.z.mulAssign(-1)}),n}).setLayout({name:"getDirection",type:"vec3",inputs:[{name:"uv",type:"vec2"},{name:"face",type:"float"}]}),sse=me(([i,e,t,n,r,s])=>{let o=oe(t),a=pe(e),l=Yu(N3e(o),y7,s),c=$u(l),u=_f(l),f=pe(vS(i,a,u,n,r,s)).toVar();return $t(c.notEqual(0),()=>{let d=pe(vS(i,a,u.add(1),n,r,s)).toVar();f.assign(Qn(f,d,c))}),f}),vS=me(([i,e,t,n,r,s])=>{let o=oe(t).toVar(),a=pe(e),l=oe(L3e(a)).toVar(),c=oe(zr(tte.sub(o),0)).toVar();o.assign(zr(o,tte));let u=oe(fx(o)).toVar(),f=dt(D3e(a,l).mul(u.sub(2)).add(1)).toVar();return $t(l.greaterThan(2),()=>{f.y.addAssign(u),l.subAssign(3)}),f.x.addAssign(l.mul(u)),f.x.addAssign(c.mul(Tn(3,P3e))),f.y.addAssign(Tn(4,fx(s).sub(u))),f.x.mulAssign(n),f.y.mulAssign(r),i.sample(f).grad(dt(),dt())}),kO=me(({envMap:i,mipInt:e,outputDirection:t,theta:n,axis:r,CUBEUV_TEXEL_WIDTH:s,CUBEUV_TEXEL_HEIGHT:o,CUBEUV_MAX_MIP:a})=>{let l=Hu(n),c=t.mul(l).add(r.cross(t).mul(Za(n))).add(r.mul(r.dot(t).mul(l.oneMinus())));return vS(i,c,e,s,o,a)}),ose=me(({n:i,latitudinal:e,poleAxis:t,outputDirection:n,weights:r,samples:s,dTheta:o,mipInt:a,envMap:l,CUBEUV_TEXEL_WIDTH:c,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:f})=>{let d=pe(_a(e,t,Jd(t,n))).toVar();$t(d.equal(pe(0)),()=>{d.assign(pe(n.z,0,n.x.negate()))}),d.assign(xa(d));let A=pe().toVar();return A.addAssign(r.element(0).mul(kO({theta:0,axis:d,outputDirection:n,mipInt:a,envMap:l,CUBEUV_TEXEL_WIDTH:c,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:f}))),Oi({start:de(1),end:i},({i:y})=>{$t(y.greaterThanEqual(s),()=>{Vre()});let w=oe(o.mul(oe(y))).toVar();A.addAssign(r.element(y).mul(kO({theta:w.mul(-1),axis:d,outputDirection:n,mipInt:a,envMap:l,CUBEUV_TEXEL_WIDTH:c,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:f}))),A.addAssign(r.element(y).mul(kO({theta:w,axis:d,outputDirection:n,mipInt:a,envMap:l,CUBEUV_TEXEL_WIDTH:c,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:f})))}),Ft(A,1)}),F3e=me(([i])=>{let e=rt(i).toVar();return e.assign(e.shiftLeft(rt(16)).bitOr(e.shiftRight(rt(16)))),e.assign(e.bitAnd(rt(1431655765)).shiftLeft(rt(1)).bitOr(e.bitAnd(rt(2863311530)).shiftRight(rt(1)))),e.assign(e.bitAnd(rt(858993459)).shiftLeft(rt(2)).bitOr(e.bitAnd(rt(3435973836)).shiftRight(rt(2)))),e.assign(e.bitAnd(rt(252645135)).shiftLeft(rt(4)).bitOr(e.bitAnd(rt(4042322160)).shiftRight(rt(4)))),e.assign(e.bitAnd(rt(16711935)).shiftLeft(rt(8)).bitOr(e.bitAnd(rt(4278255360)).shiftRight(rt(8)))),oe(e).mul(23283064365386963e-26)}),B3e=me(([i,e])=>dt(oe(i).div(oe(e)),F3e(i))),O3e=me(([i,e,t])=>{let n=t.mul(t).toConst(),r=pe(1,0,0).toConst(),s=Jd(e,r).toConst(),o=Ja(i.x).toConst(),a=Tn(2,3.14159265359).mul(i.y).toConst(),l=o.mul(Hu(a)).toConst(),c=o.mul(Za(a)).toVar(),u=Tn(.5,e.z.add(1)).toConst();c.assign(u.oneMinus().mul(Ja(l.mul(l).oneMinus())).add(u.mul(c)));let f=r.mul(l).add(s.mul(c)).add(e.mul(Ja(zr(0,l.mul(l).add(c.mul(c)).oneMinus()))));return xa(pe(n.mul(f.x),n.mul(f.y),zr(0,f.z)))}),ase=me(({roughness:i,mipInt:e,envMap:t,N_immutable:n,GGX_SAMPLES:r,CUBEUV_TEXEL_WIDTH:s,CUBEUV_TEXEL_HEIGHT:o,CUBEUV_MAX_MIP:a})=>{let l=pe(n).toVar(),c=pe(0).toVar(),u=oe(0).toVar();return $t(i.lessThan(.001),()=>{c.assign(vS(t,l,e,s,o,a))}).Else(()=>{let f=_a(fr(l.z).lessThan(.999),pe(0,0,1),pe(1,0,0)),d=xa(Jd(f,l)).toVar(),A=Jd(l,d).toVar();Oi({start:rt(0),end:r},({i:y})=>{let w=B3e(y,r),S=O3e(w,pe(0,0,1),i),T=xa(d.mul(S.x).add(A.mul(S.y)).add(l.mul(S.z))),R=xa(T.mul(ou(l,T).mul(2)).sub(l)),P=zr(ou(l,R),0);$t(P.greaterThan(0),()=>{let I=vS(t,R,e,s,o,a);c.addAssign(I.mul(P)),u.addAssign(P)})}),$t(u.greaterThan(0),()=>{c.assign(c.div(u))})}),Ft(c,1)}),pm=4,nte=[.125,.215,.35,.446,.526,.582],Gg=20,U3e=512,kw=new Du(-1,1,1,-1,0,1),k3e=new $r(90,1),ite=new zt,zO=null,VO=0,GO=0,z3e=new re,w4=new WeakMap,V3e=[3,1,5,0,4,2],qO=rse(Ui(),hc("faceIndex")).normalize(),DI=pe(qO.x,qO.y,qO.z),b7=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._blurMaterial=null,this._ggxMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._backgroundBox=null}get _hasInitialized(){return this._renderer.hasInitialized()}fromScene(e,t=0,n=.1,r=100,s={}){let{size:o=256,position:a=z3e,renderTarget:l=null}=s;if(this._setSize(o),this._hasInitialized===!1)throw new Error('THREE.PMREMGenerator: .fromScene() called before the backend is initialized. Use "await renderer.init();" before using this method.');zO=this._renderer.getRenderTarget(),VO=this._renderer.getActiveCubeFace(),GO=this._renderer.getActiveMipmapLevel();let c=l||this._allocateTarget(!0);return this._init(c),this._sceneToCubeUV(e,n,r,c,a),t>0&&this._blur(c,0,0,t),this._applyPMREM(c),this._cleanup(c),c}async fromSceneAsync(e,t=0,n=.1,r=100,s={}){return ni('PMREMGenerator: ".fromSceneAsync()" is deprecated. Use "await renderer.init()" instead.'),await this._renderer.init(),this.fromScene(e,t,n,r,s)}fromEquirectangular(e,t=null){if(this._hasInitialized===!1)throw new Error('THREE.PMREMGenerator: .fromEquirectangular() called before the backend is initialized. Use "await renderer.init();" before using this method.');return this._fromTexture(e,t)}async fromEquirectangularAsync(e,t=null){return ni('PMREMGenerator: ".fromEquirectangularAsync()" is deprecated. Use "await renderer.init()" instead.'),await this._renderer.init(),this._fromTexture(e,t)}fromCubemap(e,t=null){if(this._hasInitialized===!1)throw new Error('THREE.PMREMGenerator: .fromCubemap() called before the backend is initialized. Use "await renderer.init();" before using this method.');return this._fromTexture(e,t)}async fromCubemapAsync(e,t=null){return ni('PMREMGenerator: ".fromCubemapAsync()" is deprecated. Use "await renderer.init()" instead.'),await this._renderer.init(),this._fromTexture(e,t)}async compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=ste(),await this._compileMaterial(this._cubemapMaterial))}async compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=ote(),await this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSizeFromTexture(e){e.mapping===Jl||e.mapping===Hc?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4)}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(zO,VO,GO),e.scissorTest=!1,this._setViewport(e,0,0,e.width,e.height)}_fromTexture(e,t){this._setSizeFromTexture(e),zO=this._renderer.getRenderTarget(),VO=this._renderer.getActiveCubeFace(),GO=this._renderer.getActiveMipmapLevel();let n=t||this._allocateTarget(!1);return this._init(n),this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTarget(e){let t=3*Math.max(this._cubeSize,112),n=4*this._cubeSize;return rte(t,n,e)}_init(e){if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e.width||this._pingPongRenderTarget.height!==e.height){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=rte(e.width,e.height);let{_lodMax:t}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=G3e(t)),this._blurMaterial=q3e(t,e.width,e.height),this._ggxMaterial=H3e(t,e.width,e.height)}}async _compileMaterial(e){let t=new Hn(new Xn,e);await this._renderer.compile(t,kw)}_sceneToCubeUV(e,t,n,r,s){let o=k3e;o.near=t,o.far=n;let a=[1,1,1,1,-1,1],l=[1,-1,1,-1,1,-1],c=this._renderer,u=c.autoClear;c.getClearColor(ite),c.autoClear=!1,this._backgroundBox===null&&(this._backgroundBox=new Hn(new Lu,new fs({name:"PMREM.Background",side:mi,depthWrite:!1,depthTest:!1})));let f=this._backgroundBox,d=f.material,A=!1,y=e.background;y?y.isColor&&(d.color.copy(y),e.background=null,A=!0):(d.color.copy(ite),A=!0),c.setRenderTarget(r),c.clear(),A&&c.render(f,o);for(let w=0;w<6;w++){let S=w%3;S===0?(o.up.set(0,a[w],0),o.position.set(s.x,s.y,s.z),o.lookAt(s.x+l[w],s.y,s.z)):S===1?(o.up.set(0,0,a[w]),o.position.set(s.x,s.y,s.z),o.lookAt(s.x,s.y+l[w],s.z)):(o.up.set(0,a[w],0),o.position.set(s.x,s.y,s.z),o.lookAt(s.x,s.y,s.z+l[w]));let T=this._cubeSize;this._setViewport(r,S*T,w>2?T:0,T,T),c.render(e,o)}c.autoClear=u,e.background=y}_textureToCubeUV(e,t){let n=this._renderer,r=e.mapping===Jl||e.mapping===Hc;r?this._cubemapMaterial===null&&(this._cubemapMaterial=ste(e)):this._equirectMaterial===null&&(this._equirectMaterial=ote(e));let s=r?this._cubemapMaterial:this._equirectMaterial;s.fragmentNode.value=e;let o=this._lodMeshes[0];o.material=s;let a=this._cubeSize;this._setViewport(t,0,0,3*a,2*a),n.setRenderTarget(t),n.render(o,kw)}_applyPMREM(e){let t=this._renderer,n=t.autoClear;t.autoClear=!1;let r=this._lodMeshes.length;for(let s=1;s<r;s++)this._applyGGXFilter(e,s-1,s);t.autoClear=n}_applyGGXFilter(e,t,n){let r=this._renderer,s=this._pingPongRenderTarget,o=this._ggxMaterial,a=this._lodMeshes[n];a.material=o;let l=w4.get(o),c=n/(this._lodMeshes.length-1),u=t/(this._lodMeshes.length-1),f=Math.sqrt(c*c-u*u),d=0+c*1.25,A=f*d,{_lodMax:y}=this,w=this._sizeLods[n],S=3*w*(n>y-pm?n-y+pm:0),T=4*(this._cubeSize-w);e.texture.frame=(e.texture.frame||0)+1,l.envMap.value=e.texture,l.roughness.value=A,l.mipInt.value=y-t,this._setViewport(s,S,T,3*w,2*w),r.setRenderTarget(s),r.render(a,kw),s.texture.frame=(s.texture.frame||0)+1,l.envMap.value=s.texture,l.roughness.value=0,l.mipInt.value=y-n,this._setViewport(e,S,T,3*w,2*w),r.setRenderTarget(e),r.render(a,kw)}_blur(e,t,n,r,s){let o=this._pingPongRenderTarget;this._halfBlur(e,o,t,n,r,"latitudinal",s),this._halfBlur(o,e,n,n,r,"longitudinal",s)}_halfBlur(e,t,n,r,s,o,a){let l=this._renderer,c=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&ze("blur direction must be either latitudinal or longitudinal!");let u=3,f=this._lodMeshes[r];f.material=c;let d=w4.get(c),A=this._sizeLods[n]-1,y=isFinite(s)?Math.PI/(2*A):2*Math.PI/(2*Gg-1),w=s/y,S=isFinite(s)?1+Math.floor(u*w):Gg;S>Gg&&Xe(`sigmaRadians, ${s}, is too large and will clip, as it requested ${S} samples when the maximum is set to ${Gg}`);let T=[],R=0;for(let L=0;L<Gg;++L){let C=L/w,B=Math.exp(-C*C/2);T.push(B),L===0?R+=B:L<S&&(R+=2*B)}for(let L=0;L<T.length;L++)T[L]=T[L]/R;e.texture.frame=(e.texture.frame||0)+1,d.envMap.value=e.texture,d.samples.value=S,d.weights.array=T,d.latitudinal.value=o==="latitudinal"?1:0,a&&(d.poleAxis.value=a);let{_lodMax:P}=this;d.dTheta.value=y,d.mipInt.value=P-n;let I=this._sizeLods[r],F=3*I*(r>P-pm?r-P+pm:0),D=4*(this._cubeSize-I);this._setViewport(t,F,D,3*I,2*I),l.setRenderTarget(t),l.render(f,kw)}_setViewport(e,t,n,r,s){this._renderer.isWebGLRenderer?(e.viewport.set(t,e.height-s-n,r,s),e.scissor.set(t,e.height-s-n,r,s)):(e.viewport.set(t,n,r,s),e.scissor.set(t,n,r,s))}};function G3e(i){let e=[],t=[],n=[],r=i,s=i-pm+1+nte.length;for(let o=0;o<s;o++){let a=Math.pow(2,r);e.push(a);let l=1/a;o>i-pm?l=nte[o-i+pm-1]:o===0&&(l=0),t.push(l);let c=1/(a-2),u=-c,f=1+c,d=[u,u,f,u,f,f,u,u,f,f,u,f],A=6,y=6,w=3,S=2,T=1,R=new Float32Array(w*y*A),P=new Float32Array(S*y*A),I=new Float32Array(T*y*A);for(let D=0;D<A;D++){let L=D%3*2/3-1,C=D>2?0:-1,B=[L,C,0,L+2/3,C,0,L+2/3,C+1,0,L,C,0,L+2/3,C+1,0,L,C+1,0],k=V3e[D];R.set(B,w*y*k),P.set(d,S*y*k);let z=[k,k,k,k,k,k];I.set(z,T*y*k)}let F=new Xn;F.setAttribute("position",new Hi(R,w)),F.setAttribute("uv",new Hi(P,S)),F.setAttribute("faceIndex",new Hi(I,T)),n.push(new Hn(F,null)),r>pm&&r--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function rte(i,e,t){let n={magFilter:Mi,minFilter:Mi,generateMipmaps:!1,type:Wi,format:Or,colorSpace:n0,depthBuffer:t},r=new Fa(i,e,n);return r.texture.mapping=Uh,r.texture.name="PMREM.cubeUv",r.texture.isPMREMTexture=!0,r.scissorTest=!0,r}function NI(i){let e=new Ir;return e.depthTest=!1,e.depthWrite=!1,e.blending=ps,e.name=`PMREM_${i}`,e}function q3e(i,e,t){let n=Xo(new Array(Gg).fill(0)),r=Xt(new re(0,1,0)),s=Xt(0),o=oe(Gg),a=Xt(0),l=Xt(1),c=fi(),u=Xt(0),f=oe(1/e),d=oe(1/t),A=oe(i),y={n:o,latitudinal:a,weights:n,poleAxis:r,outputDirection:DI,dTheta:s,samples:l,envMap:c,mipInt:u,CUBEUV_TEXEL_WIDTH:f,CUBEUV_TEXEL_HEIGHT:d,CUBEUV_MAX_MIP:A},w=NI("blur");return w.fragmentNode=ose({...y,latitudinal:a.equal(1)}),w4.set(w,y),w}function H3e(i,e,t){let n=fi(),r=Xt(0),s=Xt(0),o=oe(1/e),a=oe(1/t),l=oe(i),c={envMap:n,roughness:r,mipInt:s,CUBEUV_TEXEL_WIDTH:o,CUBEUV_TEXEL_HEIGHT:a,CUBEUV_MAX_MIP:l},u=NI("ggx");return u.fragmentNode=ase({...c,N_immutable:DI,GGX_SAMPLES:rt(U3e)}),w4.set(u,c),u}function ste(i){let e=NI("cubemap");return e.fragmentNode=Ka(i,DI),e}function ote(i){let e=NI("equirect");return e.fragmentNode=fi(i,oV(DI),0),e}var ate=new WeakMap;function W3e(i){let e=Math.log2(i)-2,t=1/i;return{texelWidth:1/(3*Math.max(Math.pow(2,e),112)),texelHeight:t,maxMip:e}}function j3e(i,e,t){let n=X3e(e),r=n.get(i);if((r!==void 0?r.pmremVersion:-1)!==i.pmremVersion){let o=i.image;if(i.isCubeTexture)if($3e(o))r=t.fromCubemap(i,r);else return null;else if(Y3e(o))r=t.fromEquirectangular(i,r);else return null;if(r.pmremVersion=i.pmremVersion,n.has(i)===!1){let a=()=>{i.removeEventListener("dispose",a);let l=n.get(i);l!==void 0&&(l.dispose(),n.delete(i))};i.addEventListener("dispose",a)}n.set(i,r)}return r.texture}function X3e(i){let e=ate.get(i);return e===void 0&&(e=new WeakMap,ate.set(i,e)),e}var w7=class extends Rr{static get type(){return"PMREMNode"}constructor(e,t=null,n=null){super("vec3"),this._value=e,this._pmrem=null,this.uvNode=t,this.levelNode=n,this._generator=null;let r=new Hs;r.isRenderTargetTexture=!0,this._texture=fi(r),this._width=Xt(0),this._height=Xt(0),this._maxMip=Xt(0),this.updateBeforeType=yn.RENDER}set value(e){this._value=e,this._pmrem=null}get value(){return this._value}updateFromTexture(e){let t=W3e(e.image.height);this._texture.value=e,this._width.value=t.texelWidth,this._height.value=t.texelHeight,this._maxMip.value=t.maxMip}updateBefore(e){let t=this._pmrem,n=t?t.pmremVersion:-1,r=this._value;n!==r.pmremVersion&&(r.isPMREMTexture===!0||r.mapping===Uh?t=r:t=j3e(r,e.renderer,this._generator),t!==null&&(this._pmrem=t,this.updateFromTexture(t)))}setup(e){this._generator===null&&(this._generator=new b7(e.renderer)),this.updateBefore(e);let t=this.uvNode;t===null&&e.context.getUV&&(t=e.context.getUV(this,e)),t=this._pmrem.isRenderTargetTexture?p4.mul(pe(t.x,t.y.negate(),t.z)):p4.mul(t);let n=this.levelNode;return n===null&&e.context.getTextureLevel&&(n=e.context.getTextureLevel(this)),sse(this._texture,t,n,this._width,this._height,this._maxMip)}dispose(){super.dispose(),this._generator!==null&&this._generator.dispose()}};function $3e(i){if(i==null)return!1;let e=0,t=6;for(let n=0;n<t;n++)i[n]!==void 0&&e++;return e===t}function Y3e(i){return i==null?!1:i.height>0}var uV=$n(w7).setParameterLength(1,3),lte=new WeakMap,S7=class extends xm{static get type(){return"EnvironmentNode"}constructor(e=null){super(),this.envNode=e}setup(e){let{material:t}=e,n=this.envNode;if(n.isTextureNode||n.isMaterialReferenceNode){let f=n.isTextureNode?n.value:t[n.property],d=this._getPMREMNodeCache(e.renderer),A=d.get(f);A===void 0&&(A=uV(f),d.set(f,A)),n=A}let s=t.useAnisotropy===!0||t.anisotropy>0?ire:hi,o=n.context(cte(Af,s)).mul($R),a=n.context(Z3e(Tm)).mul(Math.PI).mul($R),l=lx(o),c=lx(a);e.context.radiance.addAssign(l),e.context.iblIrradiance.addAssign(c);let u=e.context.lightingModel.clearcoatRadiance;if(u){let f=n.context(cte(sx,hm)).mul($R),d=lx(f);u.addAssign(d)}}_getPMREMNodeCache(e){let t=lte.get(e);return t===void 0&&(t=new WeakMap,lte.set(e,t)),t}},cte=(i,e)=>{let t=null;return{getUV:()=>(t===null&&(t=er.negate().reflect(e),t=wz(i).mix(t,e).normalize(),t=t.transformDirection(LS)),t),getTextureLevel:()=>i}},Z3e=i=>({getUV:()=>i,getTextureLevel:()=>oe(1)}),K3e=new s_,S4=class extends Ir{static get type(){return"MeshStandardNodeMaterial"}constructor(e){super(),this.isMeshStandardNodeMaterial=!0,this.lights=!0,this.emissiveNode=null,this.metalnessNode=null,this.roughnessNode=null,this.setDefaultValues(K3e),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t===null&&e.environmentNode&&(t=e.environmentNode),t?new S7(t):null}setupLightingModel(){return new b4}setupSpecular(){let e=Qn(pe(.04),Bi.rgb,Kd);vm.assign(pe(.04)),qg.assign(e),Hg.assign(1)}setupVariants(){let e=this.metalnessNode?oe(this.metalnessNode):fre;Kd.assign(e);let t=this.roughnessNode?oe(this.roughnessNode):hre;t=aV({roughness:t}),Af.assign(t),this.setupSpecular(),Vg.assign(Bi.rgb.mul(e.oneMinus()))}},Q3e=new Y2,T7=class extends S4{static get type(){return"MeshPhysicalNodeMaterial"}constructor(e){super(),this.isMeshPhysicalNodeMaterial=!0,this.clearcoatNode=null,this.clearcoatRoughnessNode=null,this.clearcoatNormalNode=null,this.sheenNode=null,this.sheenRoughnessNode=null,this.iridescenceNode=null,this.iridescenceIORNode=null,this.iridescenceThicknessNode=null,this.specularIntensityNode=null,this.specularColorNode=null,this.iorNode=null,this.transmissionNode=null,this.thicknessNode=null,this.attenuationDistanceNode=null,this.attenuationColorNode=null,this.dispersionNode=null,this.anisotropyNode=null,this.setDefaultValues(Q3e),this.setValues(e)}get useClearcoat(){return this.clearcoat>0||this.clearcoatNode!==null}get useIridescence(){return this.iridescence>0||this.iridescenceNode!==null}get useSheen(){return this.sheen>0||this.sheenNode!==null}get useAnisotropy(){return this.anisotropy>0||this.anisotropyNode!==null}get useTransmission(){return this.transmission>0||this.transmissionNode!==null}get useDispersion(){return this.dispersion>0||this.dispersionNode!==null}setupSpecular(){let e=this.iorNode?oe(this.iorNode):Ere;rS.assign(e),vm.assign(Il(bz(rS.sub(1).div(rS.add(1))).mul(ure),pe(1)).mul(KU)),qg.assign(Qn(vm,Bi.rgb,Kd)),Hg.assign(Qn(KU,1,Kd))}setupLightingModel(){return new b4(this.useClearcoat,this.useSheen,this.useIridescence,this.useAnisotropy,this.useTransmission,this.useDispersion)}setupVariants(e){if(super.setupVariants(e),this.useClearcoat){let t=this.clearcoatNode?oe(this.clearcoatNode):pre,n=this.clearcoatRoughnessNode?oe(this.clearcoatRoughnessNode):mre;t4.assign(t),sx.assign(aV({roughness:n}))}if(this.useSheen){let t=this.sheenNode?pe(this.sheenNode):vre,n=this.sheenRoughnessNode?oe(this.sheenRoughnessNode):_re;lc.assign(t),lm.assign(n)}if(this.useIridescence){let t=this.iridescenceNode?oe(this.iridescenceNode):yre,n=this.iridescenceIORNode?oe(this.iridescenceIORNode):bre,r=this.iridescenceThicknessNode?oe(this.iridescenceThicknessNode):wre;AI.assign(t),n4.assign(n),i4.assign(r)}if(this.useAnisotropy){let t=(this.anisotropyNode?dt(this.anisotropyNode):xre).toVar();am.assign(t.length()),$t(am.equal(0),()=>{t.assign(dt(1,0))}).Else(()=>{t.divAssign(dt(am)),am.assign(am.saturate())}),r4.assign(am.pow2().mix(Af.pow2(),1)),iS.assign(Wg[0].mul(t.x).add(Wg[1].mul(t.y))),$g.assign(Wg[1].mul(t.x).sub(Wg[0].mul(t.y)))}if(this.useTransmission){let t=this.transmissionNode?oe(this.transmissionNode):Sre,n=this.thicknessNode?oe(this.thicknessNode):Tre,r=this.attenuationDistanceNode?oe(this.attenuationDistanceNode):Mre,s=this.attenuationColorNode?pe(this.attenuationColorNode):Cre;if(o4.assign(t),az.assign(n),lz.assign(r),cz.assign(s),this.useDispersion){let o=this.dispersionNode?oe(this.dispersionNode):Ire;uz.assign(o)}}}setupClearcoatNormal(){return this.clearcoatNormalNode?pe(this.clearcoatNormalNode):Are}setup(e){e.context.setupClearcoatNormal=()=>Zg(this.setupClearcoatNormal(e),"NORMAL","vec3"),super.setup(e)}};var J3e=me(({normal:i,lightDirection:e,builder:t})=>{let n=i.dot(e),r=dt(n.mul(.5).add(.5),0);if(t.material.gradientMap){let s=Yd("gradientMap","texture").context({getUV:()=>r});return pe(s.r)}else{let s=r.fwidth().mul(.5);return Qn(pe(.7),pe(1),pc(oe(.7).sub(s.x),oe(.7).add(s.x),r.x))}}),E7=class extends Ax{direct({lightDirection:e,lightColor:t,reflectedLight:n},r){let s=J3e({normal:EI,lightDirection:e,builder:r}).mul(t);n.directDiffuse.addAssign(s.mul(s1({diffuseColor:Bi.rgb})))}indirect(e){let{ambientOcclusion:t,irradiance:n,reflectedLight:r}=e.context;r.indirectDiffuse.addAssign(n.mul(s1({diffuseColor:Bi}))),r.indirectDiffuse.mulAssign(t)}},eMe=new Z2,M7=class extends Ir{static get type(){return"MeshToonNodeMaterial"}constructor(e){super(),this.isMeshToonNodeMaterial=!0,this.lights=!0,this.setDefaultValues(eMe),this.setValues(e)}setupLightingModel(){return new E7}},lse=me(()=>{let i=pe(er.z,0,er.x.negate()).normalize(),e=er.cross(i);return dt(i.dot(hi),e.dot(hi)).mul(.495).add(.5)}).once(["NORMAL","VERTEX"])().toVar("matcapUV"),tMe=new Q2,C7=class extends Ir{static get type(){return"MeshMatcapNodeMaterial"}constructor(e){super(),this.isMeshMatcapNodeMaterial=!0,this.setDefaultValues(tMe),this.setValues(e)}setupVariants(e){let t=lse,n;e.material.matcap?n=Yd("matcap","texture").context({getUV:()=>t}):n=pe(Qn(.2,.8,t.y)),Bi.rgb.mulAssign(n.rgb)}},R7=class extends Rr{static get type(){return"RotateNode"}constructor(e,t){super(),this.positionNode=e,this.rotationNode=t}generateNodeType(e){return this.positionNode.getNodeType(e)}setup(e){let{rotationNode:t,positionNode:n}=this;if(this.getNodeType(e)==="vec2"){let s=t.cos(),o=t.sin();return mI(s,o,o.negate(),s).mul(n)}else{let s=t,o=mm(Ft(1,0,0,0),Ft(0,Hu(s.x),Za(s.x).negate(),0),Ft(0,Za(s.x),Hu(s.x),0),Ft(0,0,0,1)),a=mm(Ft(Hu(s.y),0,Za(s.y),0),Ft(0,1,0,0),Ft(Za(s.y).negate(),0,Hu(s.y),0),Ft(0,0,0,1)),l=mm(Ft(Hu(s.z),Za(s.z).negate(),0,0),Ft(Za(s.z),Hu(s.z),0,0),Ft(0,0,1,0),Ft(0,0,0,1));return o.mul(a).mul(l).mul(Ft(n,1)).xyz}}},NS=$n(R7).setParameterLength(2),nMe=new Ph,T4=class extends Ir{static get type(){return"SpriteNodeMaterial"}constructor(e){super(),this.isSpriteNodeMaterial=!0,this._useSizeAttenuation=!0,this.positionNode=null,this.rotationNode=null,this.scaleNode=null,this.transparent=!0,this.setDefaultValues(nMe),this.setValues(e)}setupPositionView(e){let{object:t,camera:n}=e,{positionNode:r,rotationNode:s,scaleNode:o,sizeAttenuation:a}=this,l=Sf.mul(pe(r||0)),c=dt(iu[0].xyz.length(),iu[1].xyz.length());o!==null&&(c=c.mul(dt(o))),n.isPerspectiveCamera&&a===!1&&(c=c.mul(l.z.negate()));let u=ga.xy;if(t.center&&t.center.isVector2===!0){let A=HTe("center","vec2",t);u=u.sub(A.sub(.5))}u=u.mul(c);let f=oe(s||gre),d=NS(u,f);return Ft(l.xy.add(d),l.zw)}get sizeAttenuation(){return this._useSizeAttenuation}set sizeAttenuation(e){this._useSizeAttenuation!==e&&(this._useSizeAttenuation=e,this.needsUpdate=!0)}},iMe=new l0,rMe=new Oe,I7=class extends T4{static get type(){return"PointsNodeMaterial"}constructor(e){super(),this.sizeNode=null,this.isPointsNodeMaterial=!0,this.setDefaultValues(iMe),this.setValues(e)}setupPositionView(){let{positionNode:e}=this;return Sf.mul(pe(e||Mr)).xyz}setupVertexSprite(e){let{material:t,camera:n}=e,{rotationNode:r,scaleNode:s,sizeNode:o,sizeAttenuation:a}=this,l=super.setupVertex(e);if(t.isNodeMaterial!==!0)return l;let c=o!==null?dt(o):Rre;c=c.mul(Uz),n.isPerspectiveCamera&&a===!0&&(c=c.mul(sMe.div(xs.z.negate()))),s&&s.isNode&&(c=c.mul(dt(s)));let u=ga.xy;if(r&&r.isNode){let f=oe(r);u=NS(u,f)}return u=u.mul(c),u=u.div(kz.div(2)),u=u.mul(l.w),l=l.add(Ft(u,0,0)),l}setupVertex(e){return e.object.isPoints?super.setupVertex(e):this.setupVertexSprite(e)}get alphaToCoverage(){return this._useAlphaToCoverage}set alphaToCoverage(e){this._useAlphaToCoverage!==e&&(this._useAlphaToCoverage=e,this.needsUpdate=!0)}},sMe=Xt(1).onFrameUpdate(function({renderer:i}){let e=i.getSize(rMe);this.value=.5*e.y}),P7=class extends Ax{constructor(){super(),this.shadowNode=oe(1).toVar("shadowMask")}direct({lightNode:e}){e.shadowNode!==null&&this.shadowNode.mulAssign(e.shadowNode)}finish({context:e}){Bi.a.mulAssign(this.shadowNode.oneMinus()),e.outgoingLight.rgb.assign(Bi.rgb)}},oMe=new $2,L7=class extends Ir{static get type(){return"ShadowNodeMaterial"}constructor(e){super(),this.isShadowNodeMaterial=!0,this.lights=!0,this.transparent=!0,this.setDefaultValues(oMe),this.setValues(e)}setupLightingModel(){return new P7}},nlt=tp("vec3"),ilt=tp("vec3"),rlt=tp("vec3");var D7=class{constructor(e,t,n){this.renderer=e,this.nodes=t,this.info=n,this._context=typeof self<"u"?self:null,this._animationLoop=null,this._requestId=null}start(){let e=(t,n)=>{this._requestId=this._context.requestAnimationFrame(e),this.info.autoReset===!0&&this.info.reset(),this.nodes.nodeFrame.update(),this.info.frame=this.nodes.nodeFrame.frameId,this.renderer._inspector.begin(),this._animationLoop!==null&&this._animationLoop(t,n),this.renderer._inspector.finish()};e()}stop(){this._context!==null&&this._context.cancelAnimationFrame(this._requestId),this._requestId=null}getAnimationLoop(){return this._animationLoop}setAnimationLoop(e){this._animationLoop=e}getContext(){return this._context}setContext(e){this._context=e}dispose(){this.stop()}},Ef=class{constructor(){this.weakMaps={}}_getWeakMap(e){let t=e.length,n=this.weakMaps[t];return n===void 0&&(n=new WeakMap,this.weakMaps[t]=n),n}get(e){let t=this._getWeakMap(e);for(let n=0;n<e.length-1;n++)if(t=t.get(e[n]),t===void 0)return;return t.get(e[e.length-1])}set(e,t){let n=this._getWeakMap(e);for(let r=0;r<e.length-1;r++){let s=e[r];n.has(s)===!1&&n.set(s,new WeakMap),n=n.get(s)}return n.set(e[e.length-1],t),this}delete(e){let t=this._getWeakMap(e);for(let n=0;n<e.length-1;n++)if(t=t.get(e[n]),t===void 0)return!1;return t.delete(e[e.length-1])}},aMe=0,ute=new WeakMap;function lMe(i){let e=Object.keys(i),t=ute.get(i.constructor);if(t===void 0){t=[];let n=Object.getPrototypeOf(i);for(;n;){let r=Object.getOwnPropertyDescriptors(n);for(let s in r){let o=r[s];o&&typeof o.get=="function"&&t.push(s)}n=Object.getPrototypeOf(n)}ute.set(i.constructor,t)}for(let n=0;n<t.length;n++)e.push(t[n]);return e}var N7=class{constructor(e,t,n,r,s,o,a,l,c,u){this.id=aMe++,this._nodes=e,this._geometries=t,this.renderer=n,this.object=r,this.material=s,this.scene=o,this.camera=a,this.lightsNode=l,this.context=c,this.geometry=r.geometry,this.version=s.version,this.drawRange=null,this.attributes=null,this.attributesId=null,this.pipeline=null,this.group=null,this.vertexBuffers=null,this.drawParams=null,this.bundle=null,this.clippingContext=u,this.clippingContextCacheKey=u!==null?u.cacheKey:"",this.initialNodesCacheKey=this.getDynamicCacheKey(),this.initialCacheKey=this.getCacheKey(),this._nodeBuilderState=null,this._bindings=null,this._monitor=null,this._sourceMaterial=n._currentSourceMaterial,this.onDispose=null,this.isRenderObject=!0,this.onMaterialDispose=()=>{this.dispose()},this.onGeometryDispose=()=>{this.attributes=null,this.attributesId=null},this.material.addEventListener("dispose",this.onMaterialDispose),this.geometry.addEventListener("dispose",this.onGeometryDispose),this._sourceMaterial!==null&&this._sourceMaterial.addEventListener("dispose",this.onMaterialDispose)}updateClipping(e){this.clippingContext=e}get clippingNeedsUpdate(){return this.clippingContext===null||this.clippingContext.cacheKey===this.clippingContextCacheKey?!1:(this.clippingContextCacheKey=this.clippingContext.cacheKey,!0)}get hardwareClippingPlanes(){return this.getNodeBuilderState().hardwareClipping===!0?this.clippingContext.unionClippingCount:0}getNodeBuilderState(){return this._nodeBuilderState||(this._nodeBuilderState=this._nodes.getForRender(this))}getMonitor(){return this._monitor||(this._monitor=this.getNodeBuilderState().observer)}getBindings(){return this._bindings||(this._bindings=this.getNodeBuilderState().createBindings())}getBindingGroup(e){for(let t of this.getBindings())if(t.name===e)return t}getIndex(){return this._geometries.getIndex(this)}getIndirect(){return this._geometries.getIndirect(this)}getIndirectOffset(){return this._geometries.getIndirectOffset(this)}getChainArray(){return[this.object,this.material,this.context,this.lightsNode]}setGeometry(e){this.geometry=e,this.attributes=null,this.attributesId=null}getAttributes(){if(this.attributes!==null)return this.attributes;let e=this.getNodeBuilderState().nodeAttributes,t=this.geometry,n=[],r=new Set,s={};for(let o of e){let a;if(o.node&&o.node.attribute?a=o.node.attribute:(a=t.getAttribute(o.name),a!==void 0&&(a.isInterleavedBufferAttribute?s[o.name]=a.data.uuid:s[o.name]=a.id)),a===void 0)continue;n.push(a);let l=a.isInterleavedBufferAttribute?a.data:a;r.add(l)}return this.attributes=n,this.attributesId=s,this.vertexBuffers=Array.from(r.values()),n}getVertexBuffers(){return this.vertexBuffers===null&&this.getAttributes(),this.vertexBuffers}getDrawParameters(){let{object:e,material:t,geometry:n,group:r,drawRange:s}=this,o=this.drawParams||(this.drawParams={vertexCount:0,firstVertex:0,instanceCount:0,firstInstance:0}),a=this.getIndex(),l=a!==null,c=1;if(n.isInstancedBufferGeometry===!0?c=n.instanceCount:e.count!==void 0&&(c=Math.max(0,e.count)),c===0)return null;if(o.instanceCount=c,e.isBatchedMesh===!0)return o;let u=1;t.wireframe===!0&&!e.isPoints&&!e.isLineSegments&&!e.isLine&&!e.isLineLoop&&(u=2);let f=s.start*u,d=(s.start+s.count)*u;r!==null&&(f=Math.max(f,r.start*u),d=Math.min(d,(r.start+r.count)*u));let A=n.attributes.position,y=1/0;l?y=a.count:A!=null&&(y=A.count),f=Math.max(f,0),d=Math.min(d,y);let w=d-f;return w<0||w===1/0?null:(o.vertexCount=w,o.firstVertex=f,o)}getGeometryCacheKey(){let{geometry:e}=this,t="";for(let n of Object.keys(e.attributes).sort()){let r=e.attributes[n];t+=n+",",r.data&&(t+=r.data.stride+","),r.offset&&(t+=r.offset+","),r.itemSize&&(t+=r.itemSize+","),r.normalized&&(t+="n,")}for(let n of Object.keys(e.morphAttributes).sort()){let r=e.morphAttributes[n];t+="morph-"+n+",";for(let s=0,o=r.length;s<o;s++){let a=r[s];t+=a.id+","}}return e.index&&(t+="index,"),t}getMaterialCacheKey(){let{object:e,material:t,renderer:n}=this,r=t.customProgramCacheKey();for(let s of lMe(t)){if(/^(is[A-Z]|_)|^(visible|version|uuid|name|opacity|userData)$/.test(s))continue;let o=t[s],a;if(o!==null){let l=typeof o;l==="number"?s==="side"?a=String(o):a=o!==0?"1":"0":l==="object"?(a="{",o.isTexture&&(a+=o.mapping,n.backend.isWebGPUBackend===!0&&(a+=o.magFilter,a+=o.minFilter,a+=o.wrapS,a+=o.wrapT,a+=o.wrapR)),a+="}"):a=String(o)}else a=String(o);r+=a+","}return r+=this.clippingContextCacheKey+",",e.geometry&&(r+=this.getGeometryCacheKey()),e.skeleton&&(r+=e.skeleton.bones.length+","),e.isBatchedMesh&&(r+=e._matricesTexture.uuid+",",e._colorsTexture!==null&&(r+=e._colorsTexture.uuid+",")),(e.isInstancedMesh||e.count>1)&&(r+=e.uuid+","),r+=this.context.id+",",r+=e.receiveShadow+",",yx(r)}get needsGeometryUpdate(){if(this.geometry.id!==this.object.geometry.id)return!0;if(this.attributes!==null){let e=this.attributesId;for(let t in e){let n=this.geometry.getAttribute(t);if(n===void 0)return!0;let r=n.isInterleavedBufferAttribute?n.data.uuid:n.id;if(e[t]!==r)return!0}}return!1}get needsUpdate(){return this.initialNodesCacheKey!==this.getDynamicCacheKey()||this.clippingNeedsUpdate}getDynamicCacheKey(){let e=0;return this.material.isShadowPassMaterial!==!0&&(e=this._nodes.getCacheKey(this.scene,this.lightsNode)),this.camera.isArrayCamera&&(e=tS(e,this.camera.cameras.length)),this.object.receiveShadow&&(e=tS(e,1)),e=tS(e,this.renderer.contextNode.id,this.renderer.contextNode.version),e}getCacheKey(){return this.getMaterialCacheKey()+this.getDynamicCacheKey()}dispose(){this.material.removeEventListener("dispose",this.onMaterialDispose),this.geometry.removeEventListener("dispose",this.onGeometryDispose),this._sourceMaterial!==null&&this._sourceMaterial.removeEventListener("dispose",this.onMaterialDispose),this.onDispose()}},hf=[],F7=class{constructor(e,t,n,r,s,o){this.renderer=e,this.nodes=t,this.geometries=n,this.pipelines=r,this.bindings=s,this.info=o,this.chainMaps={}}get(e,t,n,r,s,o,a,l){let c=this.getChainMap(l);hf[0]=e,hf[1]=t,hf[2]=o,hf[3]=s;let u=c.get(hf);return u===void 0?(u=this.createRenderObject(this.nodes,this.geometries,this.renderer,e,t,n,r,s,o,a,l),c.set(hf,u)):(u.camera=r,u.updateClipping(a),u.needsGeometryUpdate&&u.setGeometry(e.geometry),(u.version!==t.version||u.needsUpdate)&&(u.initialCacheKey!==u.getCacheKey()?(u.dispose(),u=this.get(e,t,n,r,s,o,a,l)):u.version=t.version)),hf[0]=null,hf[1]=null,hf[2]=null,hf[3]=null,u}getChainMap(e="default"){return this.chainMaps[e]||(this.chainMaps[e]=new Ef)}dispose(){this.chainMaps={}}createRenderObject(e,t,n,r,s,o,a,l,c,u,f){let d=this.getChainMap(f),A=new N7(e,t,n,r,s,o,a,l,c,u);return A.onDispose=()=>{this.pipelines.delete(A),this.bindings.deleteForRender(A),this.nodes.delete(A),d.delete(A.getChainArray())},A}},Mf=class{constructor(){this.data=new WeakMap}get(e){let t=this.data.get(e);return t===void 0&&(t={},this.data.set(e,t)),t}delete(e){let t=null;return this.data.has(e)&&(t=this.data.get(e),this.data.delete(e)),t}has(e){return this.data.has(e)}dispose(){this.data=new WeakMap}},ru={VERTEX:1,INDEX:2,STORAGE:3,INDIRECT:4},fm=16,cMe=211,uMe=212,B7=class extends Mf{constructor(e,t){super(),this.backend=e,this.info=t}delete(e){let t=super.delete(e);return t!==null&&(this.backend.destroyAttribute(e),this.info.destroyAttribute(e)),t}update(e,t){let n=this.get(e);if(n.version===void 0)t===ru.VERTEX?(this.backend.createAttribute(e),this.info.createAttribute(e)):t===ru.INDEX?(this.backend.createIndexAttribute(e),this.info.createIndexAttribute(e)):t===ru.STORAGE?(this.backend.createStorageAttribute(e),this.info.createStorageAttribute(e)):t===ru.INDIRECT&&(this.backend.createIndirectStorageAttribute(e),this.info.createIndirectStorageAttribute(e)),n.version=this._getBufferAttribute(e).version;else{let r=this._getBufferAttribute(e);(n.version<r.version||r.usage===dg)&&(this.backend.updateAttribute(e),n.version=r.version)}}_getBufferAttribute(e){return e.isInterleavedBufferAttribute&&(e=e.data),e}};function cse(i){return i.index!==null?i.index.version:i.attributes.position.version}function use(i){return i.index!==null?i.index.id:i.attributes.position.id}function hte(i){let e=[],t=i.index,n=i.attributes.position;if(t!==null){let s=t.array;for(let o=0,a=s.length;o<a;o+=3){let l=s[o+0],c=s[o+1],u=s[o+2];e.push(l,c,c,u,u,l)}}else{let s=n.array;for(let o=0,a=s.length/3-1;o<a;o+=3){let l=o+0,c=o+1,u=o+2;e.push(l,c,c,u,u,l)}}let r=new(n.count>=65535?HA:qA)(e,1);return r.version=cse(i),r.__id=use(i),r}var O7=class extends Mf{constructor(e,t){super(),this.attributes=e,this.info=t,this.wireframes=new WeakMap,this.attributeCall=new WeakMap,this._geometryDisposeListeners=new Map}has(e){let t=e.geometry;return super.has(t)&&this.get(t).initialized===!0}updateForRender(e){this.has(e)===!1&&this.initGeometry(e),this.updateAttributes(e)}initGeometry(e){let t=e.geometry,n=this.get(t);n.initialized=!0,this.info.memory.geometries++;let r=()=>{this.info.memory.geometries--;let s=t.index,o=e.getAttributes();s!==null&&this.attributes.delete(s);for(let l of o)this.attributes.delete(l);let a=this.wireframes.get(t);a!==void 0&&this.attributes.delete(a),t.removeEventListener("dispose",r),this._geometryDisposeListeners.delete(t)};t.addEventListener("dispose",r),this._geometryDisposeListeners.set(t,r)}updateAttributes(e){let t=e.getAttributes();for(let s of t)s.isStorageBufferAttribute||s.isStorageInstancedBufferAttribute?this.updateAttribute(s,ru.STORAGE):this.updateAttribute(s,ru.VERTEX);let n=this.getIndex(e);n!==null&&this.updateAttribute(n,ru.INDEX);let r=e.geometry.indirect;r!==null&&this.updateAttribute(r,ru.INDIRECT)}updateAttribute(e,t){let n=this.info.render.calls;e.isInterleavedBufferAttribute?this.attributeCall.get(e)===void 0?(this.attributes.update(e,t),this.attributeCall.set(e,n)):this.attributeCall.get(e.data)!==n&&(this.attributes.update(e,t),this.attributeCall.set(e.data,n),this.attributeCall.set(e,n)):this.attributeCall.get(e)!==n&&(this.attributes.update(e,t),this.attributeCall.set(e,n))}getIndirect(e){return e.geometry.indirect}getIndirectOffset(e){return e.geometry.indirectOffset}getIndex(e){let{geometry:t,material:n}=e,r=t.index;if(n.wireframe===!0){let s=this.wireframes,o=s.get(t);o===void 0?(o=hte(t),s.set(t,o)):(o.version!==cse(t)||o.__id!==use(t))&&(this.attributes.delete(o),o=hte(t),s.set(t,o)),r=o}return r}dispose(){for(let[e,t]of this._geometryDisposeListeners.entries())e.removeEventListener("dispose",t);this._geometryDisposeListeners.clear()}},U7=class{constructor(){this.autoReset=!0,this.frame=0,this.calls=0,this.render={calls:0,frameCalls:0,drawCalls:0,triangles:0,points:0,lines:0,timestamp:0},this.compute={calls:0,frameCalls:0,timestamp:0},this.memory={attributes:0,attributesSize:0,geometries:0,indexAttributes:0,indexAttributesSize:0,indirectStorageAttributes:0,indirectStorageAttributesSize:0,programs:0,programsSize:0,readbackBuffers:0,readbackBuffersSize:0,renderTargets:0,storageAttributes:0,storageAttributesSize:0,textures:0,texturesSize:0,uniformBuffers:0,uniformBuffersSize:0,total:0},this.memoryMap=new Map}update(e,t,n){this.render.drawCalls++,e.isMesh||e.isSprite?this.render.triangles+=n*(t/3):e.isPoints?this.render.points+=n*t:e.isLineSegments?this.render.lines+=n*(t/2):e.isLine?this.render.lines+=n*(t-1):ze("WebGPUInfo: Unknown object type.")}reset(){this.render.drawCalls=0,this.render.frameCalls=0,this.compute.frameCalls=0,this.render.triangles=0,this.render.points=0,this.render.lines=0}dispose(){this.reset(),this.calls=0,this.render.calls=0,this.compute.calls=0,this.render.timestamp=0,this.compute.timestamp=0;for(let e in this.memory)this.memory[e]=0;this.memoryMap.clear()}createTexture(e){let t=this._getTextureMemorySize(e);this.memoryMap.set(e,t),this.memory.textures++,this.memory.total+=t,this.memory.texturesSize+=t}destroyTexture(e){let t=this.memoryMap.get(e)||0;this.memoryMap.delete(e),this.memory.textures--,this.memory.total-=t,this.memory.texturesSize-=t}_createAttribute(e,t){let n=this._getAttributeMemorySize(e);this.memoryMap.set(e,{size:n,type:t}),this.memory[t]++,this.memory.total+=n,this.memory[t+"Size"]+=n}createAttribute(e){this._createAttribute(e,"attributes")}createIndexAttribute(e){this._createAttribute(e,"indexAttributes")}createStorageAttribute(e){this._createAttribute(e,"storageAttributes")}createIndirectStorageAttribute(e){this._createAttribute(e,"indirectStorageAttributes")}destroyAttribute(e){let t=this.memoryMap.get(e);t&&(this.memoryMap.delete(e),this.memory[t.type]--,this.memory.total-=t.size,this.memory[t.type+"Size"]-=t.size)}createReadbackBuffer(e){let t=e.maxByteLength;this.memoryMap.set(e,{size:t,type:"readbackBuffers"}),this.memory.readbackBuffers++,this.memory.total+=t,this.memory.readbackBuffersSize+=t}destroyReadbackBuffer(e){let{size:t}=this.memoryMap.get(e);this.memoryMap.delete(e),this.memory.readbackBuffers--,this.memory.total-=t,this.memory.readbackBuffersSize-=t}createUniformBuffer(e){let t=e.byteLength;this.memoryMap.set(e,{size:t,type:"uniformBuffers"}),this.memory.uniformBuffers++,this.memory.total+=t,this.memory.uniformBuffersSize+=t}destroyUniformBuffer(e){let t=this.memoryMap.get(e);t&&(this.memoryMap.delete(e),this.memory.uniformBuffers--,this.memory.total-=t.size,this.memory.uniformBuffersSize-=t.size)}createProgram(e){let t=e.code.length;this.memoryMap.set(e,t),this.memory.programs++,this.memory.total+=t,this.memory.programsSize+=t}destroyProgram(e){let t=this.memoryMap.get(e)||0;this.memoryMap.delete(e),this.memory.programs--,this.memory.total-=t,this.memory.programsSize-=t}_getTextureMemorySize(e){if(e.isCompressedTexture)return 1;let t=1;e.type===kh||e.type===Ji?t=1:e.type===zh||e.type===wl||e.type===Wi?t=2:(e.type===Zr||e.type===xi||e.type===cr)&&(t=4);let n=4;e.format===u_||e.format===Od||e.format===Vh||e.format===Gs||e.format===xo?n=1:e.format===js||e.format===Gh?n=2:(e.format===Bd||e.format===Ib)&&(n=3);let r=t*n;e.type===rg||e.type===sg?r=2:(e.type===ca||e.type===og||e.type===ag)&&(r=4);let s=e.width||1,o=e.height||1,a=e.isCubeTexture?6:e.depth||1,l=s*o*a*r,c=e.mipmaps;if(c&&c.length>0){let u=0;for(let f=0;f<c.length;f++){let d=c[f];if(d.data)u+=d.data.byteLength;else{let A=d.width||Math.max(1,s>>f),y=d.height||Math.max(1,o>>f);u+=A*y*a*r}}l+=u}else e.generateMipmaps&&(l=l*1.333);return Math.round(l)}_getAttributeMemorySize(e){return e.isInterleavedBufferAttribute&&(e=e.data),e.array?e.array.byteLength:e.count&&e.itemSize?e.count*e.itemSize*4:0}},E4=class{constructor(e){this.cacheKey=e,this.usedTimes=0}},k7=class extends E4{constructor(e,t,n){super(e),this.vertexProgram=t,this.fragmentProgram=n}},z7=class extends E4{constructor(e,t){super(e),this.computeProgram=t,this.isComputePipeline=!0}},hMe=0,aS=class{constructor(e,t,n,r=null,s=null){this.id=hMe++,this.code=e,this.stage=t,this.name=n,this.transforms=r,this.attributes=s,this.usedTimes=0}},V7=class extends Mf{constructor(e,t,n){super(),this.backend=e,this.nodes=t,this.info=n,this.bindings=null,this.caches=new Map,this.programs={vertex:new Map,fragment:new Map,compute:new Map}}getForCompute(e,t){let{backend:n}=this,r=this.get(e);if(this._needsComputeUpdate(e)){let s=r.pipeline;s&&(s.usedTimes--,s.computeProgram.usedTimes--);let o=this.nodes.getForCompute(e),a=this.programs.compute.get(o.computeShader);a===void 0&&(s&&s.computeProgram.usedTimes===0&&this._releaseProgram(s.computeProgram),a=new aS(o.computeShader,"compute",e.name,o.transforms,o.nodeAttributes),this.programs.compute.set(o.computeShader,a),n.createProgram(a),this.info.createProgram(a));let l=this._getComputeCacheKey(e,a),c=this.caches.get(l);c===void 0&&(s&&s.usedTimes===0&&this._releasePipeline(s),c=this._getComputePipeline(e,a,l,t)),c.usedTimes++,a.usedTimes++,r.version=e.version,r.pipeline=c}return r.pipeline}getForRender(e,t=null){let{backend:n}=this,r=this.get(e);if(this._needsRenderUpdate(e)){let s=r.pipeline;s&&(s.usedTimes--,s.vertexProgram.usedTimes--,s.fragmentProgram.usedTimes--);let o=e.getNodeBuilderState(),a=e.material?e.material.name:"",l=this.programs.vertex.get(o.vertexShader);l===void 0&&(s&&s.vertexProgram.usedTimes===0&&this._releaseProgram(s.vertexProgram),l=new aS(o.vertexShader,"vertex",a),this.programs.vertex.set(o.vertexShader,l),n.createProgram(l),this.info.createProgram(l));let c=this.programs.fragment.get(o.fragmentShader);c===void 0&&(s&&s.fragmentProgram.usedTimes===0&&this._releaseProgram(s.fragmentProgram),c=new aS(o.fragmentShader,"fragment",a),this.programs.fragment.set(o.fragmentShader,c),n.createProgram(c),this.info.createProgram(c));let u=this._getRenderCacheKey(e,l,c),f=this.caches.get(u);f===void 0?(s&&s.usedTimes===0&&this._releasePipeline(s),f=this._getRenderPipeline(e,l,c,u,t)):e.pipeline=f,f.usedTimes++,l.usedTimes++,c.usedTimes++,r.pipeline=f}return r.pipeline}isReady(e){let n=this.get(e).pipeline;if(n===void 0)return!1;let r=this.backend.get(n);return r.pipeline!==void 0&&r.pipeline!==null}delete(e){let t=this.get(e).pipeline;return t&&(t.usedTimes--,t.usedTimes===0&&this._releasePipeline(t),t.isComputePipeline?(t.computeProgram.usedTimes--,t.computeProgram.usedTimes===0&&this._releaseProgram(t.computeProgram)):(t.fragmentProgram.usedTimes--,t.vertexProgram.usedTimes--,t.vertexProgram.usedTimes===0&&this._releaseProgram(t.vertexProgram),t.fragmentProgram.usedTimes===0&&this._releaseProgram(t.fragmentProgram))),super.delete(e)}dispose(){super.dispose(),this.caches=new Map,this.programs={vertex:new Map,fragment:new Map,compute:new Map}}updateForRender(e){this.getForRender(e)}_getComputePipeline(e,t,n,r){n=n||this._getComputeCacheKey(e,t);let s=this.caches.get(n);return s===void 0&&(s=new z7(n,t),this.caches.set(n,s),this.backend.createComputePipeline(s,r)),s}_getRenderPipeline(e,t,n,r,s){r=r||this._getRenderCacheKey(e,t,n);let o=this.caches.get(r);return o===void 0&&(o=new k7(r,t,n),this.caches.set(r,o),e.pipeline=o,this.backend.createRenderPipeline(e,s)),o}_getComputeCacheKey(e,t){return e.id+","+t.id}_getRenderCacheKey(e,t,n){return t.id+","+n.id+","+this.backend.getRenderCacheKey(e)}_releasePipeline(e){this.caches.delete(e.cacheKey)}_releaseProgram(e){let t=e.code,n=e.stage;this.programs[n].delete(t),this.info.destroyProgram(e)}_needsComputeUpdate(e){let t=this.get(e);return t.pipeline===void 0||t.version!==e.version}_needsRenderUpdate(e){return this.get(e).pipeline===void 0||this.backend.needsRenderUpdate(e)}},G7=class extends Mf{constructor(e,t,n,r,s,o){super(),this.backend=e,this.textures=n,this.pipelines=s,this.attributes=r,this.nodes=t,this.info=o,this.pipelines.bindings=this}getForRender(e){let t=e.getBindings(),n=this.get(e);return n.initialized!==!0&&(this._createBindings(t),n.initialized=!0),t}getForCompute(e){let t=this.nodes.getForCompute(e).bindings,n=this.get(e);return(n.initialized!==!0||n.bindings!==t)&&(n.bindings!==void 0&&this._destroyBindings(n.bindings),this._createBindings(t),n.initialized=!0,n.bindings=t),t}updateForCompute(e){this._updateBindings(this.getForCompute(e))}updateForRender(e){this._updateBindings(this.getForRender(e))}deleteForCompute(e){let n=this.get(e).bindings||this.nodes.getForCompute(e).bindings;this._destroyBindings(n),this.delete(e)}deleteForRender(e){let t=e.getBindings();this._destroyBindings(t),this.delete(e)}_createBindings(e){for(let t of e){let n=this.get(t);if(n.bindGroup===void 0){for(let r of t.bindings)if(r.isUniformBuffer)this.backend.createUniformBuffer(r),this.info.createUniformBuffer(r);else if(r.isSampledTexture)this.textures.updateTexture(r.texture);else if(r.isSampler)this.textures.updateSampler(r);else if(r.isStorageBuffer){let s=r.attribute,o=s.isIndirectStorageBufferAttribute?ru.INDIRECT:ru.STORAGE;this.attributes.update(s,o)}this.backend.createBindings(t,e,0),n.bindGroup=t,n.usedTimes=1}else n.usedTimes++}}_destroyBindings(e){for(let t of e){let n=this.get(t);if(n.usedTimes--,n.usedTimes===0){for(let r of t.bindings)r.isUniformBuffer?(this.backend.destroyUniformBuffer(r),this.info.destroyUniformBuffer(r),r.release()):r.isSampler&&(r.isSampledTexture!==!0&&this.backend.destroySampler(r),r.release());this.backend.deleteBindGroupData(t),this.delete(t)}}}_updateBindings(e){for(let t of e)this._update(t,e)}_update(e,t){let{backend:n}=this,r=!1,s=!0,o=0,a=0;for(let l of e.bindings)if(this.nodes.updateGroup(l)!==!1){if(l.isStorageBuffer){let u=l.attribute,f=u.isIndirectStorageBufferAttribute?ru.INDIRECT:ru.STORAGE,d=n.get(l);this.attributes.update(u,f),d.attribute!==u&&(d.attribute=u,r=!0)}if(l.isUniformBuffer)l.update()&&n.updateBinding(l);else if(l.isSampledTexture){let u=l.update(),f=l.texture,d=this.textures.get(f);if(u&&(this.textures.updateTexture(f),l.generation!==d.generation&&(l.generation=d.generation,r=!0),d.bindGroups.add(e)),n.get(f).externalTexture!==void 0||d.isDefaultTexture?s=!1:(o=o*10+f.id,a+=f.version),f.isStorageTexture===!0&&f.mipmapsAutoUpdate===!0){let y=this.get(f);l.store===!0?y.needsMipmap=!0:this.textures.needsMipmaps(f)&&y.needsMipmap===!0&&(this.backend.generateMipmaps(f),y.needsMipmap=!1)}}else if(l.isSampler&&l.update()){let f=this.textures.updateSampler(l);l.samplerKey!==f&&(l.samplerKey=f,r=!0)}l.isBuffer&&l.updateRanges.length>0&&l.clearUpdateRanges()}r===!0&&this.backend.updateBindings(e,t,s?o:0,a)}},fMe=Object.freeze([]);function dMe(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?i.z-e.z:i.id-e.id}function fte(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?e.z-i.z:i.id-e.id}function dte(i){return(i.transmission>0||i.transmissionNode&&i.transmissionNode.isNode)&&i.side===vr&&i.forceSinglePass===!1}var q7=class{constructor(e,t,n){this.renderItems=[],this.renderItemsIndex=0,this.opaque=[],this.transparentDoublePass=[],this.transparent=[],this.bundles=[],this.lighting=e,this.lightsNode=e.getNode(t),this.lightsArray=[],this.scene=t,this.camera=n,this.occlusionQueryCount=0,this._lastOcclusionObject=null}begin(){return this.renderItemsIndex=0,this.opaque.length=0,this.transparentDoublePass.length=0,this.transparent.length=0,this.bundles.length=0,this.lightsArray.length=0,this.occlusionQueryCount=0,this}getNextRenderItem(e,t,n,r,s,o,a){let l=this.renderItems[this.renderItemsIndex];return l===void 0?(l={id:e.id,object:e,geometry:t,material:n,groupOrder:r,renderOrder:e.renderOrder,z:s,group:o,clippingContext:a},this.renderItems[this.renderItemsIndex]=l):(l.id=e.id,l.object=e,l.geometry=t,l.material=n,l.groupOrder=r,l.renderOrder=e.renderOrder,l.z=s,l.group=o,l.clippingContext=a),this.renderItemsIndex++,l}push(e,t,n,r,s,o,a){let l=this.getNextRenderItem(e,t,n,r,s,o,a);e.occlusionTest===!0&&this._lastOcclusionObject!==e&&(this.occlusionQueryCount++,this._lastOcclusionObject=e),n.transparent===!0||n.transmission>0||n.transmissionNode&&n.transmissionNode.isNode||n.backdropNode&&n.backdropNode.isNode?(dte(n)&&this.transparentDoublePass.push(l),this.transparent.push(l)):this.opaque.push(l)}unshift(e,t,n,r,s,o,a){let l=this.getNextRenderItem(e,t,n,r,s,o,a);n.transparent===!0||n.transmission>0||n.transmissionNode&&n.transmissionNode.isNode||n.backdropNode&&n.backdropNode.isNode?(dte(n)&&this.transparentDoublePass.unshift(l),this.transparent.unshift(l)):this.opaque.unshift(l)}pushBundle(e){this.bundles.push(e)}pushLight(e){this.lightsArray.push(e)}sort(e,t,n){this.opaque.length>1&&this.opaque.sort(e||dMe),this.transparentDoublePass.length>1&&this.transparentDoublePass.sort(t||fte),this.transparent.length>1&&this.transparent.sort(t||fte),n&&(this.opaque.reverse(),this.transparentDoublePass.reverse(),this.transparent.reverse())}finish(){this.lightsNode.setLights(this.lighting.enabled?this.lightsArray:fMe);for(let e=this.renderItemsIndex,t=this.renderItems.length;e<t;e++){let n=this.renderItems[e];if(n.id===null)break;n.id=null,n.object=null,n.geometry=null,n.material=null,n.groupOrder=null,n.renderOrder=null,n.z=null,n.group=null,n.clippingContext=null}this._lastOcclusionObject=null}},V_=[],H7=class{constructor(e){this.lighting=e,this.lists=new Ef}get(e,t){let n=this.lists;V_[0]=e,V_[1]=t;let r=n.get(V_);return r===void 0&&(r=new q7(this.lighting,e,t),n.set(V_,r)),V_[0]=null,V_[1]=null,r}dispose(){this.lists=new Ef}},pMe=0,W7=class{constructor(){this.id=pMe++,this.mrt=null,this.color=!0,this.clearColor=!0,this.clearColorValue={r:0,g:0,b:0,a:1},this.depth=!0,this.clearDepth=!0,this.clearDepthValue=1,this.stencil=!1,this.clearStencil=!0,this.clearStencilValue=1,this.viewport=!1,this.viewportValue=new xn,this.scissor=!1,this.scissorValue=new xn,this.renderTarget=null,this.textures=null,this.depthTexture=null,this.activeCubeFace=0,this.activeMipmapLevel=0,this.sampleCount=1,this.width=0,this.height=0,this.occlusionQueryCount=0,this.clippingContext=null,this.camera=null,this.isRenderContext=!0}getCacheKey(){return hse(this)}};function hse(i){let{textures:e,activeCubeFace:t,activeMipmapLevel:n}=i,r=[t,n];for(let s of e)r.push(s.id);return PS(r)}var j7=class{constructor(e){this.renderer=e,this._renderContexts={}}get(e=null,t=null,n=0){let r;if(e===null)r="default";else{let l=e.texture.format,c=e.texture.type;r=`${e.textures.length}:${l}:${c}:${e.samples}:${e.depthBuffer}:${e.stencilBuffer}`}let s=t!==null?t.id:"default",o=r+"-"+s+"-"+n,a=this._renderContexts[o];return a===void 0&&(a=new W7,a.mrt=t,this._renderContexts[o]=a),e!==null&&(a.sampleCount=e.samples===0?1:e.samples),a.clearDepthValue=this.renderer.getClearDepth(),a.clearStencilValue=this.renderer.getClearStencil(),a}dispose(){this._renderContexts={}}},mMe=new re,X7=class extends Mf{constructor(e,t,n){super(),this.renderer=e,this.backend=t,this.info=n,this._htmlTextures=new Set}updateRenderTarget(e,t=0){let n=this.get(e),r=e.samples===0?1:e.samples,s=n.depthTextureMips||(n.depthTextureMips={}),o=e.textures,a=this.getSize(o[0]),l=a.width>>t,c=a.height>>t,u=e.depthTexture||s[t],f=e.depthBuffer===!0||e.stencilBuffer===!0,d=!1,A=u!==void 0&&u.image!==void 0&&u.image.depth>1,y=a.depth>1&&(e.useArrayDepthTexture||e.multiview||A);u===void 0&&f&&(u=new Cs,u.format=e.stencilBuffer?xo:Gs,u.type=e.stencilBuffer?ca:xi,u.image.width=l,u.image.height=c,u.image.depth=a.depth,u.renderTarget=e,s[t]=u),u&&(u.isArrayTexture=y),(n.width!==a.width||a.height!==n.height)&&(d=!0,u&&(u.needsUpdate=!0,u.image.width=l,u.image.height=c,u.image.depth=y?a.depth:1)),n.width=a.width,n.height=a.height,n.textures=o,n.depthTexture=u||null,n.depth=e.depthBuffer,n.stencil=e.stencilBuffer,n.renderTarget=e,n.sampleCount!==r&&(d=!0,u&&(u.needsUpdate=!0),n.sampleCount=r);let w={sampleCount:r};if(e.isXRRenderTarget!==!0){for(let S=0;S<o.length;S++){let T=o[S];d&&(T.needsUpdate=!0),this.updateTexture(T,w)}u&&this.updateTexture(u,w)}n.initialized!==!0&&(n.initialized=!0,this.info.memory.renderTargets++,n.onDispose=()=>{this._destroyRenderTarget(e)},e.addEventListener("dispose",n.onDispose))}updateTexture(e,t={}){let n=this.get(e);if(n.initialized===!0&&n.version===e.version)return;let r=e.isRenderTargetTexture||e.isDepthTexture||e.isFramebufferTexture,s=this.backend;if(r&&n.initialized===!0&&s.destroyTexture(e),e.isFramebufferTexture){let c=this.renderer.getRenderTarget();c?e.type=c.texture.type:e.type=Ji}if(e.isHTMLTexture&&e.image){let c=this.renderer.domElement;if("requestPaint"in c){if(c.hasAttribute("layoutsubtree")||c.setAttribute("layoutsubtree","true"),e.image.parentNode!==c&&c.appendChild(e.image),this._htmlTextures.size===0){let u=this._htmlTextures;c.onpaint=f=>{let d=f&&f.changedElements;for(let A of u)(!d||d.includes(A.image))&&(A.needsUpdate=!0)}}this._htmlTextures.add(e)}}let{width:o,height:a,depth:l}=this.getSize(e);if(t.width=o,t.height=a,t.depth=l,t.needsMipmaps=this.needsMipmaps(e),t.levels=t.needsMipmaps?this.getMipLevels(e,o,a):1,e.isCubeTexture&&e.mipmaps.length>0&&t.levels++,r||e.isStorageTexture===!0||e.isExternalTexture===!0)s.createTexture(e,t),n.generation=e.version;else if(e.version>0){let c=e.image;if(c===void 0)Xe("Renderer: Texture marked for update but image is undefined.");else if(c.complete===!1)Xe("Renderer: Texture marked for update but image is incomplete.");else{if(e.images){let f=[];for(let d of e.images)f.push(d);t.images=f}else t.image=c;(n.isDefaultTexture===void 0||n.isDefaultTexture===!0)&&(s.createTexture(e,t),n.isDefaultTexture=!1,n.generation=e.version),e.source.dataReady===!0&&s.updateTexture(e,t);let u=e.isStorageTexture===!0&&e.mipmapsAutoUpdate===!1;t.needsMipmaps&&e.mipmaps.length===0&&!u&&s.generateMipmaps(e),e.onUpdate&&e.onUpdate(e)}}else s.createDefaultTexture(e),n.isDefaultTexture=!0,n.generation=e.version;n.initialized!==!0&&(n.initialized=!0,n.generation=e.version,n.bindGroups=new Set,this.info.createTexture(e),e.isVideoTexture&&ln.enabled===!0&&ln.getTransfer(e.colorSpace)!==kt&&Xe("WebGPURenderer: Video textures must use a color space with a sRGB transfer function, e.g. SRGBColorSpace."),n.onDispose=()=>{this._destroyTexture(e)},e.addEventListener("dispose",n.onDispose)),n.version=e.version}updateSampler(e){return this.backend.updateSampler(e)}getSize(e,t=mMe){let n=e.images?e.images[0]:e.image;return n?(n.image!==void 0&&(n=n.image),e.isHTMLTexture?(t.width=n.offsetWidth||1,t.height=n.offsetHeight||1,t.depth=1):typeof HTMLVideoElement<"u"&&n instanceof HTMLVideoElement?(t.width=n.videoWidth||1,t.height=n.videoHeight||1,t.depth=1):typeof VideoFrame<"u"&&n instanceof VideoFrame?(t.width=n.displayWidth||1,t.height=n.displayHeight||1,t.depth=1):(t.width=n.width||1,t.height=n.height||1,t.depth=e.isCubeTexture?6:n.depth||1)):t.width=t.height=t.depth=1,t}getMipLevels(e,t,n){let r;return e.mipmaps.length>0?r=e.mipmaps.length:e.isCompressedTexture===!0?r=1:r=Math.floor(Math.log2(Math.max(t,n)))+1,r}needsMipmaps(e){return e.generateMipmaps===!0||e.mipmaps.length>0}_destroyRenderTarget(e){if(this.has(e)===!0){let t=this.get(e),n=t.textures,r=t.depthTexture;e.removeEventListener("dispose",t.onDispose);for(let s=0;s<n.length;s++)this._destroyTexture(n[s]);r&&this._destroyTexture(r),this.delete(e),this.backend.delete(e),this.info.memory.renderTargets--}}_destroyTexture(e){if(this.has(e)===!0){let t=this.get(e);e.removeEventListener("dispose",t.onDispose);let n=t.isDefaultTexture;if(this.backend.destroyTexture(e,n),t.bindGroups)for(let r of t.bindGroups){let s=this.backend.get(r);s.groups=void 0,s.versions=void 0;for(let o of r.bindings)o.isSampler&&o.texture===e&&(o.isSampledTexture!==!0&&this.backend.destroySampler(o),o.reset(),o.release())}this._htmlTextures.delete(e),this.delete(e),this.info.destroyTexture(e)}}},_S=class extends zt{constructor(e,t,n,r=1){super(e,t,n),this.a=r}set(e,t,n,r=1){return this.a=r,super.set(e,t,n)}copy(e){return e.a!==void 0&&(this.a=e.a),super.copy(e)}clone(){return new this.constructor(this.r,this.g,this.b,this.a)}},M4=class extends dS{static get type(){return"OverrideContextNode"}constructor(e,t=null){super(t,{overrideNodes:e}),this.isOverrideContextNode=!0}getFlowContextData(){let e=[];this.traverse(r=>{r.isOverrideContextNode===!0&&e.push(r.value.overrideNodes)});let t=new Map(e.flatMap(r=>Array.from(r.entries()))),n=super.getFlowContextData();return n.overrideNodes=t,n}};function fse(i,e=null,t=null){if(e&&e.isNode){let n=e;e=()=>n}return new M4(new Map([[i,e]]),t)}Ue("overrideNode",(i,e,t)=>fse(e,t,i));function dse(i,e=null){let t=new Map;for(let[n,r]of i){let s=r!==null?typeof r=="function"?r:()=>r:null;t.set(n,s)}return new M4(t,e)}Ue("overrideNodes",(i,e)=>dse(e,i));var C4=class extends gi{static get type(){return"ParameterNode"}constructor(e,t=null){super(e,t),this.isParameterNode=!0}getMemberType(e,t){let n=this.getNodeType(e),r=e.getStructTypeNode(n),s;return r!==null?s=r.getMemberType(e,t):(ze(`TSL: Member "${t}" not found in struct "${n}".`,new es),s="float"),s}getHash(){return String(this.id)}generate(){return this.name}},AMe=(i,e)=>new C4(i,e),$7=class extends Kt{static get type(){return"StackNode"}constructor(e=null){super(),this.nodes=[],this.outputNode=null,this.parent=e,this._currentCond=null,this._expressionNode=null,this._currentNode=null,this._nodeDataLibrary=new Map,this.isStackNode=!0}getElementType(e){return this.outputNode?this.outputNode.getElementType(e):"void"}generateNodeType(e){return this.outputNode?this.outputNode.getNodeType(e):"void"}getMemberType(e,t){return this.outputNode?this.outputNode.getMemberType(e,t):"void"}addToStack(e,t=-1){if(e.isNode!==!0)return ze("TSL: Invalid node added to stack.",new es),this;if(t===-1)if(this._currentNode){let n=this._nodeDataLibrary.get(this._currentNode);n===void 0&&(n={delta:0},this._nodeDataLibrary.set(this._currentNode,n)),n.delta++,t=this.nodes.indexOf(this._currentNode)+n.delta}else t=this.nodes.length;return this.nodes.splice(t,0,e),this}addToStackBefore(e){let t=this._currentNode?this.nodes.indexOf(this._currentNode):0;return this.addToStack(e,t)}If(e,t){let n=new ix(t);return this._currentCond=_a(e,n),this.addToStack(this._currentCond)}ElseIf(e,t){let n=new ix(t),r=_a(e,n);return this._currentCond.elseNode=r,this._currentCond=r,this}Else(e){return this._currentCond.elseNode=new ix(e),this}Switch(e){return this._expressionNode=Ht(e),this}Case(...e){let t=[];if(e.length>=2)for(let a=0;a<e.length-1;a++)t.push(this._expressionNode.equal(Ht(e[a])));else ze("TSL: Invalid parameter length. Case() requires at least two parameters.",new es);let n=e[e.length-1],r=new ix(n),s=t[0];for(let a=1;a<t.length;a++)s=s.or(t[a]);let o=_a(s,r);return this._currentCond===null?(this._currentCond=o,this.addToStack(this._currentCond)):(this._currentCond.elseNode=o,this._currentCond=o,this)}Default(e){return this.Else(e),this}setup(e){let t=e.getNodeProperties(this),n=0;for(let r of this.getChildren())r.isVarNode&&r.isIntent(e)&&r.isAssign(e)!==!0||(t["node"+n++]=r);return t.outputNode||null}build(e,...t){let n=tz(),r=e.buildStage;hS(this),e.setActiveStack(this);for(let o=0;o<this.nodes.length;o++){let a=this.nodes[o],l=this._currentNode;if(this._currentNode=a,!(a.isVarNode&&a.isIntent(e)&&a.isAssign(e)!==!0)){if(r==="setup")a.build(e);else if(r==="analyze")a.build(e,this);else if(r==="generate"){let c=e.getDataFromNode(a,"any").stages,u=c&&c[e.shaderStage];if(a.isVarNode&&u&&u.length===1&&u[0]&&u[0].isStackNode)continue;a.build(e,"void")}this._currentNode=l}}let s;if(this.outputNode){let o=this.outputNode.build(e,...t);(e.buildStage!=="generate"||this.outputNode.getNodeType(e)!=="void")&&(s=o)}else s=super.build(e,...t);return hS(n),e.removeActiveStack(this),s}},KR=$n($7).setParameterLength(0,1);function gMe(i){return Object.entries(i).map(([e,t])=>typeof t=="string"?{name:e,type:t,atomic:!1}:{name:e,type:t.type,atomic:t.atomic||!1})}var Y7=class extends Kt{static get type(){return"StructTypeNode"}constructor(e,t=null){super("struct"),this.membersLayout=gMe(e),this.name=t,this.isStructTypeNode=!0}getLength(){let e=1,t=0;for(let n of this.membersLayout){let r=n.type,s=uTe(r),o=hTe(r);e=Math.max(e,o);let l=t%e%o;l!==0&&(t+=o-l),t+=s}return Math.ceil(t/e)*e}getMemberType(e,t){let n=this.membersLayout.find(r=>r.name===t);return n?n.type:"void"}generateNodeType(e){return e.getStructTypeFromNode(this,this.membersLayout,this.name).name}setup(e){e.getStructTypeFromNode(this,this.membersLayout,this.name),e.addInclude(this)}generate(e){return this.getNodeType(e)}},Z7=class extends Kt{static get type(){return"StructNode"}constructor(e,t){super("vec3"),this.structTypeNode=e,this.values=t,this.isStructNode=!0}generateNodeType(e){return this.structTypeNode.getNodeType(e)}getMemberType(e,t){return this.structTypeNode.getMemberType(e,t)}_getChildren(){let e=super._getChildren(),t=e.find(n=>n.childNode===this.structTypeNode);return e.splice(e.indexOf(t),1),e.push(t),e}generate(e){let t=e.getVarFromNode(this),n=t.type,r=e.getPropertyName(t);return e.addLineFlowCode(`${r} = ${e.generateStruct(n,this.structTypeNode.membersLayout,this.values)}`,this),t.name}},vMe=(i,e=null)=>{let t=new Y7(i,e);return ez((...r)=>{let s=null;if(r.length>0)if(r[0].isNode){s={};let o=Object.keys(i);for(let a=0;a<r.length;a++)s[o[a]]=r[a]}else s=r[0];return new Z7(t,s)},t)},R4=class extends Kt{static get type(){return"OutputStructNode"}constructor(...e){super(),this.members=e,this.isOutputStructNode=!0}generateNodeType(){return"OutputType"}generate(e){let t=e.getDataFromNode(this);if(t.membersLayout===void 0){let o=this.members,a=[];for(let l=0;l<o.length;l++){let c="m"+l,u=o[l].getNodeType(e);a.push({name:c,type:u,index:l})}t.membersLayout=a,t.structType=e.getOutputStructTypeFromNode(this,t.membersLayout)}let n=e.getOutputStructName(),r=this.members,s=n!==""?n+".":"";for(let o=0;o<r.length;o++){let a=r[o].build(e,t.membersLayout[o].type);e.addLineFlowCode(`${s}m${o} = ${a}`,this)}return n}},_Me=$n(R4),I4=class{constructor(e=Ms){this.blending=e,this.blendSrc=e0,this.blendDst=t0,this.blendEquation=oo,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.premultiplyAlpha=!1}copy(e){return this.blending=e.blending,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.premultiplyAlpha=e.premultiplyAlpha,this}clone(){return new this.constructor().copy(this)}},xMe=new I4(ps),yMe=new I4(hb);function pse(i,e){for(let t=0;t<i.length;t++)if(i[t].name===e)return t;return-1}var K7=class extends R4{static get type(){return"MRTNode"}constructor(e){super(),this.outputNodes=e,this.blendModes={output:yMe},this.isMRTNode=!0}setBlendMode(e,t){return this.blendModes[e]=t,this}getBlendMode(e){return this.blendModes[e]||xMe}has(e){return this.outputNodes[e]!==void 0}get(e){return this.outputNodes[e]}merge(e){let t={...this.outputNodes,...e.outputNodes},n={...this.blendModes,...e.blendModes},r=mse(t);return r.blendings=n,r}setup(e){let t=this.outputNodes,n=e.renderer.getRenderTarget(),r=[],s=n.textures;for(let o in t){let a=pse(s,o);if(a===-1)continue;let l=e.getOutputType(a);r[a]=t[o].convert(l)}return this.members=r,super.setup(e)}},mse=$n(K7),o1=class extends Rr{static get type(){return"BitcastNode"}constructor(e,t,n=null){super(),this.valueNode=e,this.conversionType=t,this.inputType=n,this.isBitcastNode=!0}generateNodeType(e){if(this.inputType!==null){let t=this.valueNode.getNodeType(e),n=e.getTypeLength(t);return e.getTypeFromLength(n,this.conversionType)}return this.conversionType}generate(e){let t=this.getNodeType(e),n="";if(this.inputType!==null){let r=this.valueNode.getNodeType(e);n=e.getTypeLength(r)===1?this.inputType:e.changeComponentType(r,this.inputType)}else n=this.valueNode.getNodeType(e);return`${e.getBitcastMethod(t,n)}( ${this.valueNode.build(e,n)} )`}},Ase=ct(o1).setParameterLength(2),bMe=i=>new o1(i,"int","float"),gse=i=>new o1(i,"uint","float"),wMe=i=>new o1(i,"float","int"),SMe=i=>new o1(i,"float","uint"),bR={},Ku=class i extends Ie{static get type(){return"BitcountNode"}constructor(e,t){super(e,t),this.isBitcountNode=!0}_resolveElementType(e,t,n){n==="int"?t.assign(Ase(e,"uint")):t.assign(e)}_returnDataNode(e){switch(e){case"uint":return rt;case"int":return de;case"uvec2":return nz;case"uvec3":return u1;case"uvec4":return oz;case"ivec2":return kr;case"ivec3":return iz;case"ivec4":return sz}}_createTrailingZerosBaseLayout(e,t){let n=this._returnDataNode(t);return me(([s])=>{let o=rt(0);this._resolveElementType(s,o,t);let a=oe(o.bitAnd(gz(o))),c=gse(a).shiftRight(23).sub(127);return n(c)}).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}_createLeadingZerosBaseLayout(e,t){let n=this._returnDataNode(t);return me(([s])=>{$t(s.equal(rt(0)),()=>rt(32));let o=rt(0),a=rt(0);return this._resolveElementType(s,o,t),$t(o.shiftRight(16).equal(0),()=>{a.addAssign(16),o.shiftLeftAssign(16)}),$t(o.shiftRight(24).equal(0),()=>{a.addAssign(8),o.shiftLeftAssign(8)}),$t(o.shiftRight(28).equal(0),()=>{a.addAssign(4),o.shiftLeftAssign(4)}),$t(o.shiftRight(30).equal(0),()=>{a.addAssign(2),o.shiftLeftAssign(2)}),$t(o.shiftRight(31).equal(0),()=>{a.addAssign(1)}),n(a)}).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}_createOneBitsBaseLayout(e,t){let n=this._returnDataNode(t);return me(([s])=>{let o=rt(0);this._resolveElementType(s,o,t),o.assign(o.sub(o.shiftRight(rt(1)).bitAnd(rt(1431655765)))),o.assign(o.bitAnd(rt(858993459)).add(o.shiftRight(rt(2)).bitAnd(rt(858993459))));let a=o.add(o.shiftRight(rt(4))).bitAnd(rt(252645135)).mul(rt(16843009)).shiftRight(rt(24));return n(a)}).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}_createMainLayout(e,t,n,r){let s=this._returnDataNode(t);return me(([a])=>{if(n===1)return s(r(a));{let l=s(0),c=["x","y","z","w"];for(let u=0;u<n;u++){let f=c[u];l[f].assign(r(a[f]))}return l}}).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}setup(e){let{method:t,aNode:n}=this,{renderer:r}=e;if(r.backend.isWebGPUBackend)return super.setup(e);let s=this.getInputType(e),o=e.getElementType(s),a=e.getTypeLength(s),l=`${t}_base_${o}`,c=`${t}_${s}`,u=bR[l];if(u===void 0){switch(t){case i.COUNT_LEADING_ZEROS:{u=this._createLeadingZerosBaseLayout(l,o);break}case i.COUNT_TRAILING_ZEROS:{u=this._createTrailingZerosBaseLayout(l,o);break}case i.COUNT_ONE_BITS:{u=this._createOneBitsBaseLayout(l,o);break}}bR[l]=u}let f=bR[c];return f===void 0&&(f=this._createMainLayout(c,s,a,u),bR[c]=f),me(()=>f(n))()}};Ku.COUNT_TRAILING_ZEROS="countTrailingZeros";Ku.COUNT_LEADING_ZEROS="countLeadingZeros";Ku.COUNT_ONE_BITS="countOneBits";var TMe=ct(Ku,Ku.COUNT_TRAILING_ZEROS).setParameterLength(1),EMe=ct(Ku,Ku.COUNT_LEADING_ZEROS).setParameterLength(1),MMe=ct(Ku,Ku.COUNT_ONE_BITS).setParameterLength(1),CMe=me(([i])=>{let e=i.toUint().mul(747796405).add(2891336453),t=e.shiftRight(e.shiftRight(28).add(4)).bitXor(e).mul(277803737);return t.shiftRight(22).bitXor(t).toFloat().mul(1/2**32)}),Q7=(i,e)=>nu(Tn(4,i.mul(ai(1,i))),e),RMe=(i,e)=>i.lessThan(.5)?Q7(i.mul(2),e).div(2):ai(1,Q7(Tn(ai(1,i),2),e).div(2)),IMe=(i,e,t)=>nu(dc(nu(i,e),Ls(nu(i,e),nu(ai(1,i),t))),1/e),PMe=(i,e)=>Za(c4.mul(e.mul(i).sub(1))).div(c4.mul(e.mul(i).sub(1))),xS=class extends Rr{static get type(){return"PackFloatNode"}constructor(e,t){super(),this.vectorNode=t,this.encoding=e,this.isPackFloatNode=!0}generateNodeType(){return"uint"}generate(e){let t=this.vectorNode.getNodeType(e);return`${e.getFloatPackingMethod(this.encoding)}(${this.vectorNode.build(e,t)})`}},LMe=ct(xS,"snorm").setParameterLength(1),DMe=ct(xS,"unorm").setParameterLength(1),NMe=ct(xS,"float16").setParameterLength(1),yS=class extends Rr{static get type(){return"UnpackFloatNode"}constructor(e,t){super(),this.uintNode=t,this.encoding=e,this.isUnpackFloatNode=!0}generateNodeType(){return"vec2"}generate(e){let t=this.uintNode.getNodeType(e);return`${e.getFloatUnpackingMethod(this.encoding)}(${this.uintNode.build(e,t)})`}},FMe=ct(yS,"snorm").setParameterLength(1),BMe=ct(yS,"unorm").setParameterLength(1),OMe=ct(yS,"float16").setParameterLength(1),$d=me(([i])=>i.fract().sub(.5).abs()).setLayout({name:"tri",type:"float",inputs:[{name:"x",type:"float"}]}),UMe=me(([i])=>pe($d(i.z.add($d(i.y.mul(1)))),$d(i.z.add($d(i.x.mul(1)))),$d(i.y.add($d(i.x.mul(1)))))).setLayout({name:"tri3",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),kMe=me(([i,e,t])=>{let n=pe(i).toVar(),r=oe(1.4).toVar(),s=oe(0).toVar(),o=pe(n).toVar();return Oi({start:oe(0),end:oe(3),type:"float",condition:"<="},()=>{let a=pe(UMe(o.mul(2))).toVar();n.addAssign(a.add(t.mul(oe(.1).mul(e)))),o.mulAssign(1.8),r.mulAssign(1.5),n.mulAssign(1.2);let l=oe($d(n.z.add($d(n.x.add($d(n.y)))))).toVar();s.addAssign(l.div(r)),o.addAssign(.14)}),s}).setLayout({name:"triNoise3D",type:"float",inputs:[{name:"position",type:"vec3"},{name:"speed",type:"float"},{name:"time",type:"float"}]}),J7=class extends Kt{static get type(){return"FunctionOverloadingNode"}constructor(e=[],...t){super(),this.functionNodes=e,this.parametersNodes=t,this._candidateFn=null,this.global=!0}generateNodeType(e){return this.getCandidateFn(e).shaderNode.layout.type}getCandidateFn(e){let t=this.parametersNodes,n=this._candidateFn;if(n===null){let r=null,s=-1;for(let o of this.functionNodes){let l=o.shaderNode.layout;if(l===null)throw new Error("THREE.FunctionOverloadingNode: FunctionNode must be a layout.");let c=l.inputs;if(t.length===c.length){let u=0;for(let f=0;f<t.length;f++){let d=t[f],A=c[f];d.getNodeType(e)===A.type&&u++}u>s&&(r=o,s=u)}}this._candidateFn=n=r}return n}setup(e){return this.getCandidateFn(e)(...this.parametersNodes)}},zMe=$n(J7),Zo=i=>(...e)=>zMe(i,...e),Sx=Xt(0).setGroup(Jt).onRenderUpdate(i=>i.time),VMe=Xt(0).setGroup(Jt).onRenderUpdate(i=>i.deltaTime),vse=Xt(0,"uint").setGroup(Jt).onRenderUpdate(i=>i.frameId),GMe=(i=Sx)=>i.add(.75).mul(Math.PI*2).sin().mul(.5).add(.5),qMe=(i=Sx)=>i.fract().round(),HMe=(i=Sx)=>i.add(.5).fract().mul(2).sub(1).abs(),WMe=(i=Sx)=>i.fract();function jMe(i,e=null){return np(e,{getUV:typeof i=="function"?i:()=>i})}var XMe=me(([i,e,t=dt(.5)])=>NS(i.sub(t),e).add(t)),$Me=me(([i,e,t=dt(.5)])=>{let n=i.sub(t),r=n.dot(n),o=r.mul(r).mul(e);return i.add(n.mul(o))}),YMe=me(({position:i=null,horizontal:e=!0,vertical:t=!1})=>{let n;i!==null?(n=iu.toVar(),n[3][0]=i.x,n[3][1]=i.y,n[3][2]=i.z):n=iu;let r=Sm.mul(n);return hx(e)&&(r[0][0]=iu[0].length(),r[0][1]=0,r[0][2]=0),hx(t)&&(r[1][0]=0,r[1][1]=iu[1].length(),r[1][2]=0),r[2][0]=0,r[2][1]=0,r[2][2]=1,Qa.mul(r).mul(Mr)}),ZMe=me(([i=null])=>{let e=v4();return v4(iV(i)).sub(e).lessThan(0).select(ju,i)}),KMe=me(([i,e=Ui(),t=oe(0)])=>{let n=i.x,r=i.y,s=t.mod(n.mul(r)).floor(),o=s.mod(n),a=r.sub(s.add(1).div(n).ceil()),l=i.reciprocal(),c=dt(o,a);return e.add(c).mul(l)}),_se=me(([i,e=null,t=null,n=oe(1),r=Mr,s=ba])=>{let o=s.abs().normalize();o=o.div(o.dot(pe(1)));let a=r.yz.mul(n),l=r.zx.mul(n),c=r.xy.mul(n),u=i.value,f=e!==null?e.value:u,d=t!==null?t.value:u,A=fi(u,a).mul(o.x),y=fi(f,l).mul(o.y),w=fi(d,c).mul(o.z);return Ls(A,y,w)}),QMe=(...i)=>_se(...i),G_=new Da,Fg=new re,q_=new re,HO=new re,zw=new cn,wR=new re(0,0,-1),ff=new xn,Vw=new re,SR=new re,Gw=new xn,TR=new Oe,P4=new Fa,JMe=ju.flipX();P4.depthTexture=new Cs(1,1);var ER=!1,ek=class i extends au{static get type(){return"ReflectorNode"}constructor(e={}){super(e.defaultTexture||P4.texture,JMe),this._reflectorBaseNode=e.reflector||new tk(this,e),this._depthNode=null,this.setUpdateMatrix(!1)}get reflector(){return this._reflectorBaseNode}get target(){return this._reflectorBaseNode.target}getDepthNode(){if(this._depthNode===null){if(this._reflectorBaseNode.depth!==!0)throw new Error("THREE.ReflectorNode: Depth node can only be requested when the reflector is created with { depth: true }. ");this._depthNode=new i({defaultTexture:P4.depthTexture,reflector:this._reflectorBaseNode})}return this._depthNode}setup(e){return e.object.isQuadMesh||this._reflectorBaseNode.build(e),super.setup(e)}clone(){let e=new this.constructor(this.reflectorNode);return e.uvNode=this.uvNode,e.levelNode=this.levelNode,e.biasNode=this.biasNode,e.sampler=this.sampler,e.depthNode=this.depthNode,e.compareNode=this.compareNode,e.gradNode=this.gradNode,e.gatherNode=this.gatherNode,e.offsetNode=this.offsetNode,e._reflectorBaseNode=this._reflectorBaseNode,e}dispose(){super.dispose(),this._reflectorBaseNode.dispose()}},tk=class extends Kt{static get type(){return"ReflectorBaseNode"}constructor(e,t={}){super();let{target:n=new lr,resolutionScale:r=1,generateMipmaps:s=!1,bounces:o=!0,depth:a=!1,samples:l=0}=t;this.textureNode=e,this.target=n,this.resolutionScale=r,t.resolution!==void 0&&(ni('ReflectorNode: The "resolution" parameter has been renamed to "resolutionScale".'),this.resolutionScale=t.resolution),this.generateMipmaps=s,this.bounces=o,this.depth=a,this.samples=l,this.updateBeforeType=o?yn.RENDER:yn.FRAME,this.virtualCameras=new WeakMap,this.renderTargets=new Map,this.forceUpdate=!1,this.hasOutput=!1}_updateResolution(e,t){let n=this.resolutionScale;t.getDrawingBufferSize(TR),e.setSize(Math.round(TR.width*n),Math.round(TR.height*n))}setup(e){return this._updateResolution(P4,e.renderer),super.setup(e)}dispose(){super.dispose();for(let e of this.renderTargets.values())e.dispose()}getVirtualCamera(e){let t=this.virtualCameras.get(e);return t===void 0&&(t=e.clone(),this.virtualCameras.set(e,t)),t}getRenderTarget(e){let t=this.renderTargets.get(e);return t===void 0&&(t=new Fa(0,0,{type:Wi,samples:this.samples}),this.generateMipmaps===!0&&(t.texture.minFilter=U8,t.texture.generateMipmaps=!0),this.depth===!0&&(t.depthTexture=new Cs),this.renderTargets.set(e,t)),t}updateBefore(e){if(this.bounces===!1&&ER)return!1;ER=!0;let{scene:t,camera:n,renderer:r,material:s}=e,{target:o}=this,a=this.getVirtualCamera(n),l=this.getRenderTarget(a);r.getDrawingBufferSize(TR),this._updateResolution(l,r),q_.setFromMatrixPosition(o.matrixWorld),HO.setFromMatrixPosition(n.matrixWorld),zw.extractRotation(o.matrixWorld),Fg.set(0,0,1),Fg.applyMatrix4(zw),Vw.subVectors(q_,HO);let c=Vw.dot(Fg)>0,u=!1;if(c===!0&&this.forceUpdate===!1){if(this.hasOutput===!1){ER=!1;return}u=!0}Vw.reflect(Fg).negate(),Vw.add(q_),zw.extractRotation(n.matrixWorld),wR.set(0,0,-1),wR.applyMatrix4(zw),wR.add(HO),SR.subVectors(q_,wR),SR.reflect(Fg).negate(),SR.add(q_),a.coordinateSystem=n.coordinateSystem,a.position.copy(Vw),a.up.set(0,1,0),a.up.applyMatrix4(zw),a.up.reflect(Fg),a.lookAt(SR),a.near=n.near,a.far=n.far,a.updateMatrixWorld(),a.projectionMatrix.copy(n.projectionMatrix),G_.setFromNormalAndCoplanarPoint(Fg,q_),G_.applyMatrix4(a.matrixWorldInverse),ff.set(G_.normal.x,G_.normal.y,G_.normal.z,G_.constant);let f=a.projectionMatrix;Gw.x=(Math.sign(ff.x)+f.elements[8])/f.elements[0],Gw.y=(Math.sign(ff.y)+f.elements[9])/f.elements[5],Gw.z=-1,Gw.w=(1+f.elements[10])/f.elements[14],ff.multiplyScalar(1/ff.dot(Gw));let d=0;f.elements[2]=ff.x,f.elements[6]=ff.y,f.elements[10]=r.coordinateSystem===xl?ff.z-d:ff.z+1-d,f.elements[14]=ff.w,this.textureNode.value=l.texture,this.depth===!0&&(this.textureNode.getDepthNode().value=l.depthTexture),s.visible=!1;let A=r.getRenderTarget(),y=r.getMRT(),w=r.autoClear;r.setMRT(null),r.setRenderTarget(l),r.autoClear=!0;let S=t.name;t.name=(t.name||"Scene")+" [ Reflector ]",u?(r.clear(),this.hasOutput=!1):(r.render(t,a),this.hasOutput=!0),t.name=S,r.setMRT(y),r.setRenderTarget(A),r.autoClear=w,s.visible=!0,ER=!1,this.forceUpdate=!1}get resolution(){return ni('ReflectorNode: The "resolution" property has been renamed to "resolutionScale".'),this.resolutionScale}set resolution(e){ni('ReflectorNode: The "resolution" property has been renamed to "resolutionScale".'),this.resolutionScale=e}},eCe=i=>new ek(i),WO=new Du(-1,1,1,-1,0,1),nk=class extends Xn{constructor(e=!1){super();let t=e===!1?[0,-1,0,1,2,1]:[0,2,0,0,2,0];this.setAttribute("position",new Ln([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new Ln(t,2))}},tCe=new nk,bS=class extends Hn{constructor(e=null){super(tCe,e),this.camera=WO,this.isQuadMesh=!0}async renderAsync(e){ni('QuadMesh: "renderAsync()" has been deprecated. Use "render()" and "await renderer.init();" when creating the renderer.'),await e.init(),e.render(this,WO)}render(e){e.render(this,WO)}},nCe=new Oe,ik=class extends au{static get type(){return"RTTNode"}constructor(e,t=null,n=null,r={type:Wi}){let s=new Fa(t,n,r);super(s.texture,Ui()),this.isRTTNode=!0,this.node=e,this.width=t,this.height=n,this.renderTarget=s,this.textureNeedsUpdate=!0,this.autoUpdate=!0,this._resolutionScale=1,this._rttNode=null,this._quadMesh=new bS(new Ir),this.updateBeforeType=yn.RENDER}get autoResize(){return this.width===null}setup(e){return this._rttNode=this.node.context(e.getSharedContext()),this._quadMesh.material.name="RTT",this._quadMesh.material.needsUpdate=!0,super.setup(e)}setSize(e,t){let n=Math.floor(e*this._resolutionScale),r=Math.floor(t*this._resolutionScale);this.renderTarget.setSize(n,r),this.textureNeedsUpdate=!0}setResolutionScale(e){return this._resolutionScale=e,this.autoResize===!1&&this.setSize(this.width,this.height),this}getResolutionScale(){return this._resolutionScale}updateBefore({renderer:e}){if(this.textureNeedsUpdate===!1&&this.autoUpdate===!1)return;this.textureNeedsUpdate=!1;let t=e.getRenderTarget();if(this.autoResize===!0){let r=e.getDrawingBufferSize(nCe),s=Math.floor(r.width*this._resolutionScale),o=Math.floor(r.height*this._resolutionScale);(s!==this.renderTarget.width||o!==this.renderTarget.height)&&(this.renderTarget.setSize(s,o),this.textureNeedsUpdate=!0)}let n="RTT";this.node.name&&(n=this.node.name+" [ "+n+" ]"),this._quadMesh.material.fragmentNode=this._rttNode,this._quadMesh.name=n,e.setRenderTarget(this.renderTarget),this._quadMesh.render(e),e.setRenderTarget(t)}clone(){let e=new au(this.value,this.uvNode,this.levelNode);return e.sampler=this.sampler,e.referenceNode=this,e}},xse=(i,...e)=>new ik(Ht(i),...e),iCe=(i,...e)=>i.isSampleNode||i.isTextureNode?i:i.isPassNode?i.getTextureNode():xse(i,...e),nx=me(([i,e,t],n)=>{let r;n.renderer.coordinateSystem===xl?(i=dt(i.x,i.y.oneMinus()).mul(2).sub(1),r=Ft(pe(i,e),1)):r=Ft(pe(i.x,i.y.oneMinus(),e).mul(2).sub(1),1);let s=Ft(t.mul(r));return s.xyz.div(s.w)}),rCe=me(([i,e])=>{let t=e.mul(Ft(i,1)),n=t.xy.div(t.w).mul(.5).add(.5).toVar();return dt(n.x,n.y.oneMinus())}),sCe=me(([i,e,t])=>{let n=n1(_s(e)),r=kr(i.mul(n)).toVar(),s=_s(e,r).toVar(),o=_s(e,r.sub(kr(2,0))).toVar(),a=_s(e,r.sub(kr(1,0))).toVar(),l=_s(e,r.add(kr(1,0))).toVar(),c=_s(e,r.add(kr(2,0))).toVar(),u=_s(e,r.add(kr(0,2))).toVar(),f=_s(e,r.add(kr(0,1))).toVar(),d=_s(e,r.sub(kr(0,1))).toVar(),A=_s(e,r.sub(kr(0,2))).toVar(),y=fr(ai(oe(2).mul(a).sub(o),s)).toVar(),w=fr(ai(oe(2).mul(l).sub(c),s)).toVar(),S=fr(ai(oe(2).mul(f).sub(u),s)).toVar(),T=fr(ai(oe(2).mul(d).sub(A),s)).toVar(),R=nx(i,s,t).toVar(),P=y.lessThan(w).select(R.sub(nx(i.sub(dt(oe(1).div(n.x),0)),a,t)),R.negate().add(nx(i.add(dt(oe(1).div(n.x),0)),l,t))),I=S.lessThan(T).select(R.sub(nx(i.add(dt(0,oe(1).div(n.y))),f,t)),R.negate().add(nx(i.sub(dt(0,oe(1).div(n.y))),d,t)));return xa(Jd(P,I))}),hV=me(([i])=>$u(oe(52.9829189).mul($u(ou(i,dt(.06711056,.00583715)))))).setLayout({name:"interleavedGradientNoise",type:"float",inputs:[{name:"position",type:"vec2"}]}),Wu=me(([i,e,t])=>{let n=oe(2.399963229728653),r=Ja(oe(i).add(.5).div(oe(e))),s=oe(i).mul(n).add(t);return dt(Hu(s),Za(s)).mul(r)}).setLayout({name:"vogelDiskSample",type:"vec2",inputs:[{name:"sampleIndex",type:"int"},{name:"samplesCount",type:"int"},{name:"phi",type:"float"}]}),rk=class extends Kt{static get type(){return"SampleNode"}constructor(e,t=null){super(),this.callback=e,this.uvNode=t,this.isSampleNode=!0}setup(){return this.sample(Ui())}sample(e){return this.callback(e)}},oCe=(i,e=null)=>new rk(i,Ht(e)),a1=class extends Kl{constructor(e,t,n=Float32Array){let r=ArrayBuffer.isView(e)?e:new n(e*t);super(r,t),this.isStorageInstancedBufferAttribute=!0}},sk=class extends Hi{constructor(e,t,n=Float32Array){let r=ArrayBuffer.isView(e)?e:new n(e*t);super(r,t),this.isStorageBufferAttribute=!0}},aCe=(i,e="float")=>{let t,n;e.isStructTypeNode===!0?(t=e.getLength(),n=QR("float")):(t=Yte(e),n=QR(e));let r=new sk(i,t,n);return Am(r,e,i)},lCe=(i,e="float")=>{let t,n;e.isStructTypeNode===!0?(t=e.getLength(),n=QR("float")):(t=Yte(e),n=QR(e));let r=new a1(i,t,n);return Am(r,e,r.count)},ok=class extends Kt{static get type(){return"PointUVNode"}constructor(){super("vec2"),this.isPointUVNode=!0}generate(){return"vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y )"}},cCe=xt(ok),jO=new cn,yse=Xt(0).setGroup(Jt).onRenderUpdate(({scene:i})=>i.backgroundBlurriness),ak=Xt(1).setGroup(Jt).onRenderUpdate(({scene:i})=>i.backgroundIntensity),bse=Xt(new cn).setGroup(Jt).onRenderUpdate(({scene:i})=>{let e=i.background;return e!==null&&e.isTexture&&e.mapping!==Cb||i.backgroundNode&&i.backgroundNode.isNode?jO.makeRotationFromEuler(i.backgroundRotation).transpose():jO.identity(),jO}),L4=class extends au{static get type(){return"StorageTextureNode"}constructor(e,t,n=null){super(e,t),this.storeNode=n,this.mipLevel=0,this.isStorageTextureNode=!0,this.access=$o.WRITE_ONLY}getInputType(){return"storageTexture"}getTransformedUV(e){return e}setup(e){super.setup(e);let t=e.getNodeProperties(this);return t.storeNode=this.storeNode,t}setAccess(e){return this.access=e,this}setMipLevel(e){return this.mipLevel=e,this}generate(e,t){return this.storeNode!==null?(this.generateStore(e),""):super.generate(e,t)}generateSnippet(e,t,n,r,s,o,a,l,c){let u=this.value;return e.generateStorageTextureLoad(u,t,n,r,o,c)}toReadWrite(){return this.setAccess($o.READ_WRITE)}toReadOnly(){return this.setAccess($o.READ_ONLY)}toWriteOnly(){return this.setAccess($o.WRITE_ONLY)}store(e,t){let n=this.clone();return n.referenceNode=this.getBase(),n.uvNode=e,n.storeNode=t,t!==null&&n.toStack(),n}generateStore(e){let t=e.getNodeProperties(this),{uvNode:n,storeNode:r,depthNode:s}=t,o=super.generate(e,"property"),a=n.build(e,this.value.is3DTexture===!0?"uvec3":"uvec2"),l=r.build(e,"vec4"),c=s?s.build(e,"int"):null,u=e.generateTextureStore(this.value,o,a,c,l);e.addLineFlowCode(u,this)}clone(){let e=super.clone();return e.storeNode=this.storeNode,e.mipLevel=this.mipLevel,e.access=this.access,e}},wse=$n(L4).setParameterLength(1,3),uCe=(i,e,t)=>{let n;return i.isStorageTextureNode===!0?n=i.store(e,t):(n=wse(i,e,t),t!==null&&n.toStack()),n},lk=class extends L4{static get type(){return"StorageTexture3DNode"}constructor(e,t,n=null){super(e,t,n),this.isStorageTexture3DNode=!0}getDefaultUV(){return pe(.5,.5,.5)}setUpdateMatrix(){}generateUV(e,t){return t.build(e,this.sampler===!0?"vec3":"ivec3")}generateOffset(e,t){return t.build(e,"ivec3")}},hCe=$n(lk).setParameterLength(1,3),fCe=me(({texture:i,uv:e})=>{let n=pe().toVar();return $t(e.x.lessThan(1e-4),()=>{n.assign(pe(1,0,0))}).ElseIf(e.y.lessThan(1e-4),()=>{n.assign(pe(0,1,0))}).ElseIf(e.z.lessThan(1e-4),()=>{n.assign(pe(0,0,1))}).ElseIf(e.x.greaterThan(1-1e-4),()=>{n.assign(pe(-1,0,0))}).ElseIf(e.y.greaterThan(1-1e-4),()=>{n.assign(pe(0,-1,0))}).ElseIf(e.z.greaterThan(1-1e-4),()=>{n.assign(pe(0,0,-1))}).Else(()=>{let s=i.sample(e.add(pe(-.01,0,0))).r.sub(i.sample(e.add(pe(.01,0,0))).r),o=i.sample(e.add(pe(0,-.01,0))).r.sub(i.sample(e.add(pe(0,.01,0))).r),a=i.sample(e.add(pe(0,0,-.01))).r.sub(i.sample(e.add(pe(0,0,.01))).r);n.assign(pe(s,o,a))}),n.normalize()}),ck=class extends au{static get type(){return"Texture3DNode"}constructor(e,t=null,n=null){super(e,t,n),this.isTexture3DNode=!0}getInputType(){return"texture3D"}getDefaultUV(){return pe(.5,.5,.5)}setUpdateMatrix(){}generateUV(e,t){return t.build(e,this.sampler===!0?"vec3":"ivec3")}generateOffset(e,t){return t.build(e,"ivec3")}normal(e){return fCe({texture:this,uv:e})}},fV=$n(ck).setParameterLength(1,3),dCe=(...i)=>fV(...i).setSampler(!1),pCe=(i,e,t)=>fV(i,e).level(t),uk=class extends px{static get type(){return"UserDataNode"}constructor(e,t,n=null){super(e,t,n),this.userData=n}updateReference(e){return this.reference=this.userData!==null?this.userData:e.object.userData,this.reference}},mCe=(i,e,t)=>new uk(i,e,t),pte=new WeakMap,hk=class extends Rr{static get type(){return"VelocityNode"}constructor(){super("vec2"),this.projectionMatrix=null,this.updateType=yn.OBJECT,this.updateAfterType=yn.OBJECT,this.previousModelWorldMatrix=Xt(new cn),this.previousProjectionMatrix=Xt(new cn).setGroup(Jt),this.previousCameraViewMatrix=Xt(new cn)}setProjectionMatrix(e){this.projectionMatrix=e}update({frameId:e,camera:t,object:n}){let r=mte(n);this.previousModelWorldMatrix.value.copy(r);let s=Sse(t);s.frameId!==e&&(s.frameId=e,s.previousProjectionMatrix===void 0?(s.previousProjectionMatrix=new cn,s.previousCameraViewMatrix=new cn,s.currentProjectionMatrix=new cn,s.currentCameraViewMatrix=new cn,s.previousProjectionMatrix.copy(this.projectionMatrix||t.projectionMatrix),s.previousCameraViewMatrix.copy(t.matrixWorldInverse)):(s.previousProjectionMatrix.copy(s.currentProjectionMatrix),s.previousCameraViewMatrix.copy(s.currentCameraViewMatrix)),s.currentProjectionMatrix.copy(this.projectionMatrix||t.projectionMatrix),s.currentCameraViewMatrix.copy(t.matrixWorldInverse),this.previousProjectionMatrix.value.copy(s.previousProjectionMatrix),this.previousCameraViewMatrix.value.copy(s.previousCameraViewMatrix))}updateAfter({object:e}){mte(e).copy(e.matrixWorld)}setup(){let e=this.projectionMatrix===null?Qa:Xt(this.projectionMatrix),t=this.previousCameraViewMatrix.mul(this.previousModelWorldMatrix),n=e.mul(Sf).mul(Mr),r=this.previousProjectionMatrix.mul(t).mul(r1),s=n.xy.div(n.w),o=r.xy.div(r.w);return ai(s,o)}};function Sse(i){let e=pte.get(i);return e===void 0&&(e={},pte.set(i,e)),e}function mte(i,e=0){let t=Sse(i),n=t[e];return n===void 0&&(t[e]=n=new cn,t[e].copy(i.matrixWorld)),n}var ACe=xt(hk),gCe=me(([i,e])=>Il(1,i.oneMinus().div(e)).oneMinus()).setLayout({name:"blendBurn",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),vCe=me(([i,e])=>Il(i.div(e.oneMinus()),1)).setLayout({name:"blendDodge",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),_Ce=me(([i,e])=>i.oneMinus().mul(e.oneMinus()).oneMinus()).setLayout({name:"blendScreen",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),xCe=me(([i,e])=>Qn(i.mul(2).mul(e),i.oneMinus().mul(2).mul(e.oneMinus()).oneMinus(),t1(.5,i))).setLayout({name:"blendOverlay",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),yCe=me(([i,e])=>{let t=e.a.add(i.a.mul(e.a.oneMinus()));return Ft(e.rgb.mul(e.a).add(i.rgb.mul(i.a).mul(e.a.oneMinus())).div(t),t)}).setLayout({name:"blendColor",type:"vec4",inputs:[{name:"base",type:"vec4"},{name:"blend",type:"vec4"}]}),bCe=me(([i])=>dV(i.rgb)),wCe=me(([i,e=oe(1)])=>e.mix(dV(i.rgb),i.rgb).max(0)),SCe=me(([i,e=oe(0)])=>{let t=Ls(i.r,i.g,i.b).div(3),n=i.r.max(i.g.max(i.b)),r=n.sub(t).mul(e).mul(-3);return Qn(i.rgb,n,r).max(0)}),TCe=me(([i,e=oe(1)])=>{let t=pe(.57735,.57735,.57735),n=e.cos();return pe(i.rgb.mul(n).add(t.cross(i.rgb).mul(e.sin()).add(t.mul(ou(t,i.rgb).mul(n.oneMinus()))))).max(0)}),dV=(i,e=pe(ln.getLuminanceCoefficients(new re)))=>ou(i,e),ECe=me(([i,e=pe(1),t=pe(0),n=pe(1),r=oe(1),s=pe(ln.getLuminanceCoefficients(new re,n0))])=>{let o=i.rgb.dot(pe(s)),a=zr(i.rgb.mul(e).add(t),0),l=a.pow(n);return $t(a.r.greaterThan(0),()=>{a.r.assign(l.r)}),$t(a.g.greaterThan(0),()=>{a.g.assign(l.g)}),$t(a.b.greaterThan(0),()=>{a.b.assign(l.b)}),a.assign(o.add(a.sub(o).mul(r)).max(0)),Ft(a.rgb,i.a)}),MCe=me(([i,e])=>i.mul(e).floor().div(e)),MR=null,fk=class extends mx{static get type(){return"ViewportSharedTextureNode"}constructor(e=ju,t=null){MR===null&&(MR=new XA),super(e,t,MR)}getTextureForReference(){return MR}updateReference(){return this}},CCe=$n(fk).setParameterLength(0,2),CR=new Oe,D4=class extends au{static get type(){return"PassTextureNode"}constructor(e,t){super(t),this.passNode=e,this.isPassTextureNode=!0,this.setUpdateMatrix(!1)}setup(e){let t=e.getNodeProperties(this);return t.passNode=this.passNode,super.setup(e)}clone(){return new this.constructor(this.passNode,this.value)}},N4=class extends D4{static get type(){return"PassMultipleTextureNode"}constructor(e,t,n=!1){super(e,null),this.textureName=t,this.previousTexture=n,this.isPassMultipleTextureNode=!0}updateTexture(){this.value=this.previousTexture?this.passNode.getPreviousTexture(this.textureName):this.passNode.getTexture(this.textureName)}setup(e){return this.updateTexture(),super.setup(e)}clone(){let e=new this.constructor(this.passNode,this.textureName,this.previousTexture);return e.uvNode=this.uvNode,e.levelNode=this.levelNode,e.biasNode=this.biasNode,e.sampler=this.sampler,e.depthNode=this.depthNode,e.compareNode=this.compareNode,e.gradNode=this.gradNode,e.gatherNode=this.gatherNode,e.offsetNode=this.offsetNode,e}},Cf=class i extends Rr{static get type(){return"PassNode"}constructor(e,t,n,r={}){super("vec4"),this.scope=e,this.scene=t,this.camera=n,this.options=r,this._width=1,this._height=1;let s=new Fa(this._width,this._height,{type:Wi,...r});s.texture.name="output";let o=null;(this.scope===i.DEPTH||r.depthBuffer!==!1)&&(o=new Cs,o.isRenderTargetTexture=!0,o.name="depth",s.depthTexture=o),this.renderTarget=s,this.overrideMaterial=null,this.transparent=!0,this.opaque=!0,this.contextNode=null,this._contextNodeCache=null,this._textures={output:s.texture},o!==null&&(this._textures.depth=o),this._textureNodes={},this._linearDepthNodes={},this._viewZNodes={},this._previousTextures={},this._previousTextureNodes={},this._cameraNear=Xt(0),this._cameraFar=Xt(0),this._mrt=null,this._layers=null,this._resolutionScale=1,this._viewport=null,this._scissor=null,this.isPassNode=!0,this.updateBeforeType=yn.FRAME,this.global=!0}setResolutionScale(e){return this._resolutionScale=e,this}getResolutionScale(){return this._resolutionScale}setResolution(e){return Xe("PassNode: .setResolution() is deprecated. Use .setResolutionScale() instead."),this.setResolutionScale(e)}getResolution(){return Xe("PassNode: .getResolution() is deprecated. Use .getResolutionScale() instead."),this.getResolutionScale()}setLayers(e){return this._layers=e,this}getLayers(){return this._layers}setMRT(e){return this._mrt=e,this}getMRT(){return this._mrt}getTexture(e){let t=this._textures[e];if(t===void 0){if(e==="depth")throw new Error("THREE.PassNode: Depth texture is not available for this pass.");t=this.renderTarget.texture.clone(),t.name=e,this._textures[e]=t,this.renderTarget.textures.push(t)}return t}getPreviousTexture(e){let t=this._previousTextures[e];return t===void 0&&(t=this.getTexture(e).clone(),this._previousTextures[e]=t),t}toggleTexture(e){let t=this._previousTextures[e];if(t!==void 0){let n=this._textures[e],r=this.renderTarget.textures.indexOf(n);this.renderTarget.textures[r]=t,this._textures[e]=t,this._previousTextures[e]=n,this._textureNodes[e].updateTexture(),this._previousTextureNodes[e].updateTexture()}}getTextureNode(e="output"){let t=this._textureNodes[e];return t===void 0&&(t=new N4(this,e),t.updateTexture(),this._textureNodes[e]=t),t}getPreviousTextureNode(e="output"){let t=this._previousTextureNodes[e];return t===void 0&&(this._textureNodes[e]===void 0&&this.getTextureNode(e),t=new N4(this,e,!0),t.updateTexture(),this._previousTextureNodes[e]=t),t}getViewZNode(e="depth"){let t=this._viewZNodes[e];if(t===void 0){let n=this._cameraNear,r=this._cameraFar;this._viewZNodes[e]=t=II(this.getTextureNode(e),n,r)}return t}getLinearDepthNode(e="depth"){let t=this._linearDepthNodes[e];if(t===void 0){let n=this._cameraNear,r=this._cameraFar,s=this.getViewZNode(e);this._linearDepthNodes[e]=t=Kg(s,n,r)}return t}async compileAsync(e){let t=e.getRenderTarget(),n=e.getMRT();e.setRenderTarget(this.renderTarget),e.setMRT(this._mrt),await e.compileAsync(this.scene,this.camera),e.setRenderTarget(t),e.setMRT(n)}setup({renderer:e}){return this.renderTarget.samples=this.options.samples===void 0?e.samples:this.options.samples,this.renderTarget.texture.type=e.getOutputBufferType(),e.reversedDepthBuffer===!0&&this.renderTarget.depthTexture!==null&&(this.renderTarget.depthTexture.type=cr),this.scope===i.COLOR?this.getTextureNode():this.getLinearDepthNode()}updateBefore(e){let{renderer:t}=e,{scene:n}=this,r,s=t.getOutputRenderTarget();s&&s.isXRRenderTarget===!0?(r=t.xr.getCamera(),t.xr.updateCamera(r),CR.set(s.width,s.height)):(r=this.camera,t.getDrawingBufferSize(CR)),this.setSize(CR.width,CR.height);let o=t.getRenderTarget(),a=t.getMRT(),l=t.autoClear,c=t.transparent,u=t.opaque,f=r.layers.mask,d=t.contextNode,A=n.overrideMaterial;this._cameraNear.value=r.near,this._cameraFar.value=r.far,this._layers!==null&&(r.layers.mask=this._layers.mask);for(let w in this._previousTextures)this.toggleTexture(w);this.overrideMaterial!==null&&(n.overrideMaterial=this.overrideMaterial),t.setRenderTarget(this.renderTarget),t.setMRT(this._mrt),t.autoClear=!0,t.transparent=this.transparent,t.opaque=this.opaque,this.contextNode!==null&&((this._contextNodeCache===null||this._contextNodeCache.version!==this.version)&&(this._contextNodeCache={version:this.version,context:np({...t.contextNode.getFlowContextData(),...this.contextNode.getFlowContextData()})}),t.contextNode=this._contextNodeCache.context);let y=n.name;n.name=this.name?this.name:n.name,t.render(n,r),n.name=y,n.overrideMaterial=A,t.setRenderTarget(o),t.setMRT(a),t.autoClear=l,t.transparent=c,t.opaque=u,t.contextNode=d,r.layers.mask=f}setSize(e,t){this._width=e,this._height=t;let n=Math.floor(this._width*this._resolutionScale),r=Math.floor(this._height*this._resolutionScale);this.renderTarget.setSize(n,r),this._scissor!==null?(this.renderTarget.scissor.copy(this._scissor).multiplyScalar(this._resolutionScale).floor(),this.renderTarget.scissorTest=!0):this.renderTarget.scissorTest=!1,this._viewport!==null&&this.renderTarget.viewport.copy(this._viewport).multiplyScalar(this._resolutionScale).floor()}setScissor(e,t,n,r){e===null?this._scissor=null:(this._scissor===null&&(this._scissor=new xn),e.isVector4?this._scissor.copy(e):this._scissor.set(e,t,n,r))}setViewport(e,t,n,r){e===null?this._viewport=null:(this._viewport===null&&(this._viewport=new xn),e.isVector4?this._viewport.copy(e):this._viewport.set(e,t,n,r))}dispose(){this.renderTarget.dispose()}};Cf.COLOR="color";Cf.DEPTH="depth";var RCe=(i,e,t)=>new Cf(Cf.COLOR,i,e,t),ICe=(i,e)=>new D4(i,e),PCe=(i,e,t)=>new Cf(Cf.DEPTH,i,e,t),dk=class extends Cf{static get type(){return"ToonOutlinePassNode"}constructor(e,t,n,r,s){super(Cf.COLOR,e,t),this.colorNode=n,this.thicknessNode=r,this.alphaNode=s,this._materialCache=new WeakMap,this.name="Outline Pass"}updateBefore(e){let{renderer:t}=e,n=t.getRenderObjectFunction();t.setRenderObjectFunction((r,s,o,a,l,c,u,f)=>{if((l.isMeshToonMaterial||l.isMeshToonNodeMaterial)&&l.wireframe===!1){let d=this._getOutlineMaterial(l);t.renderObject(r,s,o,a,d,c,u,f)}t.renderObject(r,s,o,a,l,c,u,f)}),super.updateBefore(e),t.setRenderObjectFunction(n)}_createMaterial(){let e=new Ir;e.isMeshToonOutlineMaterial=!0,e.name="Toon_Outline",e.side=mi;let t=ba.negate(),n=Qa.mul(Sf),r=oe(1),s=n.mul(Ft(Mr,1)),o=n.mul(Ft(Mr.add(t),1)),a=xa(s.sub(o));return e.vertexNode=s.add(a.mul(this.thicknessNode).mul(s.w).mul(r)),e.colorNode=Ft(this.colorNode,this.alphaNode),e}_getOutlineMaterial(e){let t=this._materialCache.get(e);return t===void 0&&(t=this._createMaterial(),this._materialCache.set(e,t)),t}},LCe=(i,e,t=new zt(0,0,0),n=.003,r=1)=>new dk(i,e,Ht(t),Ht(n),Ht(r)),Tse=me(([i,e])=>i.mul(e).clamp()).setLayout({name:"linearToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),Ese=me(([i,e])=>(i=i.mul(e),i.div(i.add(1)).clamp())).setLayout({name:"reinhardToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),Mse=me(([i,e])=>{i=i.mul(e),i=i.sub(.004).max(0);let t=i.mul(i.mul(6.2).add(.5)),n=i.mul(i.mul(6.2).add(1.7)).add(.06);return t.div(n).pow(2.2)}).setLayout({name:"cineonToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),DCe=me(([i])=>{let e=i.mul(i.add(.0245786)).sub(90537e-9),t=i.mul(i.add(.432951).mul(.983729)).add(.238081);return e.div(t)}),Cse=me(([i,e])=>{let t=To(.59719,.35458,.04823,.076,.90834,.01566,.0284,.13383,.83777),n=To(1.60475,-.53108,-.07367,-.10208,1.10813,-.00605,-.00327,-.07276,1.07602);return i=i.mul(e).div(.6),i=t.mul(i),i=DCe(i),i=n.mul(i),i.clamp()}).setLayout({name:"acesFilmicToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),NCe=To(pe(1.6605,-.1246,-.0182),pe(-.5876,1.1329,-.1006),pe(-.0728,-.0083,1.1187)),FCe=To(pe(.6274,.0691,.0164),pe(.3293,.9195,.088),pe(.0433,.0113,.8956)),BCe=me(([i])=>{let e=pe(i).toVar(),t=pe(e.mul(e)).toVar(),n=pe(t.mul(t)).toVar();return oe(15.5).mul(n.mul(t)).sub(Tn(40.14,n.mul(e))).add(Tn(31.96,n).sub(Tn(6.868,t.mul(e))).add(Tn(.4298,t).add(Tn(.1191,e).sub(.00232))))}),Rse=me(([i,e])=>{let t=pe(i).toVar(),n=To(pe(.856627153315983,.137318972929847,.11189821299995),pe(.0951212405381588,.761241990602591,.0767994186031903),pe(.0482516061458583,.101439036467562,.811302368396859)),r=To(pe(1.1271005818144368,-.1413297634984383,-.14132976349843826),pe(-.11060664309660323,1.157823702216272,-.11060664309660294),pe(-.016493938717834573,-.016493938717834257,1.2519364065950405)),s=oe(-12.47393),o=oe(4.026069);return t.mulAssign(e),t.assign(FCe.mul(t)),t.assign(n.mul(t)),t.assign(zr(t,1e-10)),t.assign(vf(t)),t.assign(t.sub(s).div(o.sub(s))),t.assign(Yu(t,0,1)),t.assign(BCe(t)),t.assign(r.mul(t)),t.assign(nu(zr(pe(0),t),pe(2.2))),t.assign(NCe.mul(t)),t.assign(Yu(t,0,1)),t}).setLayout({name:"agxToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),Ise=me(([i,e])=>{let t=oe(.76),n=oe(.15);i=i.mul(e);let r=Il(i.r,Il(i.g,i.b)),s=_a(r.lessThan(.08),r.sub(Tn(6.25,r.mul(r))),.04);i.subAssign(s);let o=zr(i.r,zr(i.g,i.b));$t(o.lessThan(t),()=>i);let a=ai(1,t),l=ai(1,a.mul(a).div(o.add(a.sub(t))));i.mulAssign(l.div(o));let c=ai(1,dc(1,n.mul(o.sub(l)).add(1)));return Qn(i,pe(l),c)}).setLayout({name:"neutralToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),hr=class extends Kt{static get type(){return"CodeNode"}constructor(e="",t=[],n=""){super("code"),this.isCodeNode=!0,this.global=!0,this.code=e,this.includes=t,this.language=n}setIncludes(e){return this.includes=e,this}getIncludes(){return this.includes}generate(e){let t=this.getIncludes(e);for(let r of t)r.build(e);let n=e.getCodeFromNode(this,this.getNodeType(e));return n.code=this.code,n.code}serialize(e){super.serialize(e),e.code=this.code,e.language=this.language}deserialize(e){super.deserialize(e),this.code=e.code,this.language=e.language}},FI=$n(hr).setParameterLength(1,3),OCe=(i,e)=>FI(i,e,"js"),UCe=(i,e)=>FI(i,e,"wgsl"),kCe=(i,e)=>FI(i,e,"glsl"),F4=class extends hr{static get type(){return"FunctionNode"}constructor(e="",t=[],n=""){super(e,t,n)}generateNodeType(e){return this.getNodeFunction(e).type}getMemberType(e,t){let n=this.getNodeType(e);return e.getStructTypeNode(n).getMemberType(e,t)}getInputs(e){return this.getNodeFunction(e).inputs}getNodeFunction(e){let t=e.getDataFromNode(this),n=t.nodeFunction;return n===void 0&&(n=e.parser.parseFunction(this.code),t.nodeFunction=n),n}generate(e,t){super.generate(e);let n=this.getNodeFunction(e),r=n.name,s=n.type,o=e.getCodeFromNode(this,s);r!==""&&(o.name=r);let a=e.getPropertyName(o),l=this.getNodeFunction(e).getCode(a);return o.code=l+`4159-`,t==="property"?a:e.format(`${a}()`,s,t)}},Pse=(i,e=[],t="")=>{let n=new F4(i,e,t);return ez((...s)=>n.call(...s),n)},zCe=(i,e)=>Pse(i,e,"glsl"),VCe=(i,e)=>Pse(i,e,"wgsl");function pV(i){let e,t=i.context.getViewZ;return t!==void 0&&(e=t(this)),(e||xs.z).negate()}var Lse=me(([i,e],t)=>{let n=pV(t);return pc(i,e,n)}),Dse=me(([i],e)=>{let t=pV(e);return i.mul(i,t,t).negate().exp().oneMinus()}),GCe=me(([i,e],t)=>{let n=pV(t),s=e.sub(yf.y).max(0).toConst().mul(n).toConst();return i.mul(i,s,s).negate().exp().oneMinus()}),pk=me(([i,e])=>Ft(e.toFloat().mix(ox.rgb,i.toVec3()),ox.a)),Bg=null,Og=null,mk=class extends Kt{static get type(){return"RangeNode"}constructor(e=oe(),t=oe()){super(),this.minNode=e,this.maxNode=t}getVectorLength(e){let t=this.getConstNode(this.minNode),n=this.getConstNode(this.maxNode),r=e.getTypeLength(dm(t.value)),s=e.getTypeLength(dm(n.value));return r>s?r:s}generateNodeType(e){return e.object.count>1?e.getTypeFromLength(this.getVectorLength(e)):"float"}getConstNode(e){let t=null;if(e.traverse(n=>{n.isConstNode===!0&&(t=n)}),t===null)throw new d4('THREE.TSL: No "ConstNode" found in node graph.',this.stackTrace);return t}setup(e){let t=e.object,n=null;if(t.count>1){let r=this.getConstNode(this.minNode),s=this.getConstNode(this.maxNode),o=r.value,a=s.value,l=e.getTypeLength(dm(o)),c=e.getTypeLength(dm(a));Bg=Bg||new xn,Og=Og||new xn,Bg.setScalar(0),Og.setScalar(0),l===1?Bg.setScalar(o):o.isColor?Bg.set(o.r,o.g,o.b,1):Bg.set(o.x,o.y,o.z||0,o.w||0),c===1?Og.setScalar(a):a.isColor?Og.set(a.r,a.g,a.b,1):Og.set(a.x,a.y,a.z||0,a.w||0);let u=4,f=u*t.count,d=new Float32Array(f);for(let w=0;w<f;w++){let S=w%u,T=Bg.getComponent(S),R=Og.getComponent(S);d[w]=Bu.lerp(T,R,Math.random())}let A=this.getNodeType(e);if(t.count*4*4<=e.getUniformBufferLimit())n=bx(d,"vec4",t.count).element(Xu).convert(A);else{let w=new Kl(d,4);e.geometry.setAttribute("__range"+this.id,w),n=TI(w).convert(A)}}else n=oe(0);return n}},qCe=$n(mk).setParameterLength(2),Ak=class extends Kt{static get type(){return"ComputeBuiltinNode"}constructor(e,t){super(t),this._builtinName=e}getHash(e){return this.getBuiltinName(e)}generateNodeType(){return this.nodeType}setBuiltinName(e){return this._builtinName=e,this}getBuiltinName(){return this._builtinName}hasBuiltin(e){return e.hasBuiltin(this._builtinName)}generate(e,t){let n=this.getBuiltinName(e),r=this.getNodeType(e);return e.shaderStage==="compute"?e.format(n,r,t):(Xe(`ComputeBuiltinNode: Compute built-in value ${n} can not be accessed in the ${e.shaderStage} stage`),e.generateConst(r))}serialize(e){super.serialize(e),e.global=this.global,e._builtinName=this._builtinName}deserialize(e){super.deserialize(e),this.global=e.global,this._builtinName=e._builtinName}},FS=(i,e)=>new Ak(i,e),HCe=FS("numWorkgroups","uvec3"),WCe=FS("workgroupId","uvec3"),jCe=FS("globalId","uvec3"),XCe=FS("localId","uvec3"),$Ce=FS("subgroupSize","uint"),gk=class extends Kt{constructor(e){super(),this.scope=e,this.isBarrierNode=!0}setup(e){e.allowEarlyReturns=!1,e.allowGlobalVariables=!1}generate(e){let{scope:t}=this,{renderer:n}=e;n.backend.isWebGLBackend===!0?e.addFlowCode(` // ${t}Barrier 4160-`):e.addLineFlowCode(`${t}Barrier()`,this)}},mV=$n(gk),YCe=()=>mV("workgroup").toStack(),ZCe=()=>mV("storage").toStack(),KCe=()=>mV("texture").toStack(),vk=class extends Qd{constructor(e,t){super(e,t),this.isWorkgroupInfoElementNode=!0}generate(e,t){let n,r=e.isContextAssign();if(n=super.generate(e),r!==!0){let s=this.getNodeType(e);n=e.format(n,s,t)}return n}},_k=class extends Kt{constructor(e,t,n=0){super(t),this.bufferType=t,this.bufferCount=n,this.isWorkgroupInfoNode=!0,this.elementType=t,this.scope=e,this.name=""}setName(e){return this.name=e,this}label(e){return Xe('TSL: "label()" has been deprecated. Use "setName()" instead.',new es),this.setName(e)}setScope(e){return this.scope=e,this}getElementType(){return this.elementType}getInputType(){return`${this.scope}Array`}element(e){return new vk(this,e)}generate(e){let t=this.name!==""?this.name:`${this.scope}Array_${this.id}`;return e.getScopedArray(t,this.scope.toLowerCase(),this.bufferType,this.bufferCount)}},QCe=(i,e)=>new _k("Workgroup",i,e),Ns=class extends Kt{static get type(){return"AtomicFunctionNode"}constructor(e,t,n){super("uint"),this.method=e,this.pointerNode=t,this.valueNode=n,this.parents=!0}getInputType(e){return this.pointerNode.getNodeType(e)}generateNodeType(e){return this.getInputType(e)}generate(e){let t=e.getNodeProperties(this),n=t.parents,r=this.method,s=this.getNodeType(e),o=this.getInputType(e),a=this.pointerNode,l=this.valueNode,c=[];c.push(`&${a.build(e,o)}`),l!==null&&c.push(l.build(e,o));let u=`${e.getMethod(r,s)}( ${c.join(", ")} )`;if(n?n.length===1&&n[0].isStackNode===!0:!1)e.addLineFlowCode(u,this);else return t.constNode===void 0&&(t.constNode=uc(u,s).toConst()),t.constNode.build(e)}};Ns.ATOMIC_LOAD="atomicLoad";Ns.ATOMIC_STORE="atomicStore";Ns.ATOMIC_ADD="atomicAdd";Ns.ATOMIC_SUB="atomicSub";Ns.ATOMIC_MAX="atomicMax";Ns.ATOMIC_MIN="atomicMin";Ns.ATOMIC_AND="atomicAnd";Ns.ATOMIC_OR="atomicOr";Ns.ATOMIC_XOR="atomicXor";var JCe=$n(Ns),If=(i,e,t)=>JCe(i,e,t).toStack(),eRe=i=>If(Ns.ATOMIC_LOAD,i,null),tRe=(i,e)=>If(Ns.ATOMIC_STORE,i,e),nRe=(i,e)=>If(Ns.ATOMIC_ADD,i,e),iRe=(i,e)=>If(Ns.ATOMIC_SUB,i,e),rRe=(i,e)=>If(Ns.ATOMIC_MAX,i,e),sRe=(i,e)=>If(Ns.ATOMIC_MIN,i,e),oRe=(i,e)=>If(Ns.ATOMIC_AND,i,e),aRe=(i,e)=>If(Ns.ATOMIC_OR,i,e),lRe=(i,e)=>If(Ns.ATOMIC_XOR,i,e),Ot=class i extends Rr{static get type(){return"SubgroupFunctionNode"}constructor(e,t=null,n=null){super(),this.method=e,this.aNode=t,this.bNode=n}getInputType(e){let t=this.aNode?this.aNode.getNodeType(e):null,n=this.bNode?this.bNode.getNodeType(e):null,r=e.isMatrix(t)?0:e.getTypeLength(t),s=e.isMatrix(n)?0:e.getTypeLength(n);return r>s?t:n}generateNodeType(e){let t=this.method;return t===i.SUBGROUP_ELECT?"bool":t===i.SUBGROUP_BALLOT?"uvec4":this.getInputType(e)}generate(e,t){let n=this.method,r=this.getNodeType(e),s=this.getInputType(e),o=this.aNode,a=this.bNode,l=[];if(n===i.SUBGROUP_BROADCAST||n===i.SUBGROUP_SHUFFLE||n===i.QUAD_BROADCAST){let u=a.getNodeType(e);l.push(o.build(e,r),a.build(e,u==="float"?"int":r))}else n===i.SUBGROUP_SHUFFLE_XOR||n===i.SUBGROUP_SHUFFLE_DOWN||n===i.SUBGROUP_SHUFFLE_UP?l.push(o.build(e,r),a.build(e,"uint")):(o!==null&&l.push(o.build(e,s)),a!==null&&l.push(a.build(e,s)));let c=l.length===0?"()":`( ${l.join(", ")} )`;return e.format(`${e.getMethod(n,r)}${c}`,r,t)}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}};Ot.SUBGROUP_ELECT="subgroupElect";Ot.SUBGROUP_BALLOT="subgroupBallot";Ot.SUBGROUP_ADD="subgroupAdd";Ot.SUBGROUP_INCLUSIVE_ADD="subgroupInclusiveAdd";Ot.SUBGROUP_EXCLUSIVE_AND="subgroupExclusiveAdd";Ot.SUBGROUP_MUL="subgroupMul";Ot.SUBGROUP_INCLUSIVE_MUL="subgroupInclusiveMul";Ot.SUBGROUP_EXCLUSIVE_MUL="subgroupExclusiveMul";Ot.SUBGROUP_AND="subgroupAnd";Ot.SUBGROUP_OR="subgroupOr";Ot.SUBGROUP_XOR="subgroupXor";Ot.SUBGROUP_MIN="subgroupMin";Ot.SUBGROUP_MAX="subgroupMax";Ot.SUBGROUP_ALL="subgroupAll";Ot.SUBGROUP_ANY="subgroupAny";Ot.SUBGROUP_BROADCAST_FIRST="subgroupBroadcastFirst";Ot.QUAD_SWAP_X="quadSwapX";Ot.QUAD_SWAP_Y="quadSwapY";Ot.QUAD_SWAP_DIAGONAL="quadSwapDiagonal";Ot.SUBGROUP_BROADCAST="subgroupBroadcast";Ot.SUBGROUP_SHUFFLE="subgroupShuffle";Ot.SUBGROUP_SHUFFLE_XOR="subgroupShuffleXor";Ot.SUBGROUP_SHUFFLE_UP="subgroupShuffleUp";Ot.SUBGROUP_SHUFFLE_DOWN="subgroupShuffleDown";Ot.QUAD_BROADCAST="quadBroadcast";var cRe=ct(Ot,Ot.SUBGROUP_ELECT).setParameterLength(0),uRe=ct(Ot,Ot.SUBGROUP_BALLOT).setParameterLength(1),hRe=ct(Ot,Ot.SUBGROUP_ADD).setParameterLength(1),fRe=ct(Ot,Ot.SUBGROUP_INCLUSIVE_ADD).setParameterLength(1),dRe=ct(Ot,Ot.SUBGROUP_EXCLUSIVE_AND).setParameterLength(1),pRe=ct(Ot,Ot.SUBGROUP_MUL).setParameterLength(1),mRe=ct(Ot,Ot.SUBGROUP_INCLUSIVE_MUL).setParameterLength(1),ARe=ct(Ot,Ot.SUBGROUP_EXCLUSIVE_MUL).setParameterLength(1),gRe=ct(Ot,Ot.SUBGROUP_AND).setParameterLength(1),vRe=ct(Ot,Ot.SUBGROUP_OR).setParameterLength(1),_Re=ct(Ot,Ot.SUBGROUP_XOR).setParameterLength(1),xRe=ct(Ot,Ot.SUBGROUP_MIN).setParameterLength(1),yRe=ct(Ot,Ot.SUBGROUP_MAX).setParameterLength(1),bRe=ct(Ot,Ot.SUBGROUP_ALL).setParameterLength(0),wRe=ct(Ot,Ot.SUBGROUP_ANY).setParameterLength(0),SRe=ct(Ot,Ot.SUBGROUP_BROADCAST_FIRST).setParameterLength(2),TRe=ct(Ot,Ot.QUAD_SWAP_X).setParameterLength(1),ERe=ct(Ot,Ot.QUAD_SWAP_Y).setParameterLength(1),MRe=ct(Ot,Ot.QUAD_SWAP_DIAGONAL).setParameterLength(1),CRe=ct(Ot,Ot.SUBGROUP_BROADCAST).setParameterLength(2),RRe=ct(Ot,Ot.SUBGROUP_SHUFFLE).setParameterLength(2),IRe=ct(Ot,Ot.SUBGROUP_SHUFFLE_XOR).setParameterLength(2),PRe=ct(Ot,Ot.SUBGROUP_SHUFFLE_UP).setParameterLength(2),LRe=ct(Ot,Ot.SUBGROUP_SHUFFLE_DOWN).setParameterLength(2),DRe=ct(Ot,Ot.QUAD_BROADCAST).setParameterLength(1),RR;function BI(i){RR=RR||new WeakMap;let e=RR.get(i);return e===void 0&&RR.set(i,e={}),e}function OI(i){let e=BI(i);return e.shadowMatrix||(e.shadowMatrix=Xt("mat4").setGroup(Jt).onRenderUpdate(t=>((i.castShadow!==!0||t.renderer.shadowMap.enabled===!1)&&(i.shadow.camera.coordinateSystem!==t.camera.coordinateSystem&&(i.shadow.camera.coordinateSystem=t.camera.coordinateSystem,i.shadow.camera.updateProjectionMatrix()),i.shadow.updateMatrices(i)),i.shadow.matrix)))}function Nse(i,e=yf){let t=OI(i).mul(e);return t.xyz.div(t.w)}function AV(i){let e=BI(i);return e.position||(e.position=Xt(new re).setGroup(Jt).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(i.matrixWorld)))}function Fse(i){let e=BI(i);return e.targetPosition||(e.targetPosition=Xt(new re).setGroup(Jt).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(i.target.matrixWorld)))}function gV(i){let e=BI(i);return e.viewPosition||(e.viewPosition=Xt(new re).setGroup(Jt).onRenderUpdate(({camera:t},n)=>{n.value=n.value||new re,n.value.setFromMatrixPosition(i.matrixWorld),n.value.applyMatrix4(t.matrixWorldInverse)}))}var vV=i=>Sm.transformDirection(AV(i).sub(Fse(i))),NRe=tp("vec3","totalDiffuse"),FRe=tp("vec3","totalSpecular"),BRe=tp("vec3","outgoingLight"),ORe=i=>i.sort((e,t)=>e.id-t.id),URe=(i,e)=>{for(let t of e)if(t.isAnalyticLightNode&&t.light.id===i)return t;return null},XO=new WeakMap,qw=[],wS=class extends Kt{static get type(){return"LightsNode"}constructor(){super("vec3"),this.totalDiffuseNode=NRe,this.totalSpecularNode=FRe,this.outgoingLightNode=BRe,this._lights=[],this.global=!0}customCacheKey(){let e=this._lights;for(let n=0;n<e.length;n++){let r=e[n];if(qw.push(r.id),qw.push(r.castShadow?1:0),r.isSpotLight===!0){let s=r.map!==null?r.map.id:-1,o=r.colorNode?r.colorNode.getCacheKey():-1;qw.push(s,o)}}let t=PS(qw);return qw.length=0,t}getHash(e){let t=e.getDataFromNode(this);if(t.lightNodesHash===void 0){let n=this.setupLightsNode(e);t.lightNodes=n;let r=[];for(let s of n)r.push(s.getHash());t.lightNodesHash="lights-"+r.join(",")}return t.lightNodesHash}analyze(e){let t=e.getNodeProperties(this);for(let n of t.nodes)n.build(e);t.outputNode.build(e)}setupLightsNode(e){let t=e.getDataFromNode(this),n=[],r=t.lightNodes||null,s=e.context.materialLightings,o=ORe([...s,...this._lights]),a=e.renderer.library;for(let l of o)if(l.isNode)n.push(l);else{let c=null;if(r!==null&&(c=URe(l.id,r)),c===null){let u=a.getLightNodeClass(l.constructor);if(u===null){Xe(`LightsNode.setupNodeLights: Light node not found for ${l.constructor.name}`);continue}XO.has(l)===!1&&XO.set(l,new u(l)),c=XO.get(l)}n.push(c)}return n}setupDirectLight(e,t,n){let{lightingModel:r,reflectedLight:s}=e.context;r.direct({...n,lightNode:t,reflectedLight:s},e)}setupDirectRectAreaLight(e,t,n){let{lightingModel:r,reflectedLight:s}=e.context;r.directRectArea({...n,lightNode:t,reflectedLight:s},e)}setupLights(e,t){for(let n of t)n.build(e)}getLightNodes(e){let t=e.getDataFromNode(this);return t.lightNodes===void 0&&(t.lightNodes=this.setupLightsNode(e)),t.lightNodes}setup(e){let t=e.lightsNode;e.lightsNode=this;let n=this.outgoingLightNode,r=e.context,s=r.lightingModel,o=e.getNodeProperties(this);if(s){let{totalDiffuseNode:a,totalSpecularNode:l}=this;r.outgoingLight=n;let c=e.addStack();o.nodes=c.nodes,s.start(e);let{backdrop:u,backdropAlpha:f}=r,{directDiffuse:d,directSpecular:A,indirectDiffuse:y,indirectSpecular:w}=r.reflectedLight,S=d.add(y);u!==null&&(f!==null?S=pe(f.mix(S,u)):S=pe(u)),a.assign(S),l.assign(A.add(w)),n.assign(a.add(l)),s.finish(e),n=n.bypass(e.removeStack())}else o.nodes=[];return e.lightsNode=t,n}setLights(e){return this._lights=e,this}getLights(){return this._lights}get hasLights(){return this._lights.length>0}},kRe=(i=[])=>new wS().setLights(i),xk=class extends Kt{static get type(){return"ShadowBaseNode"}constructor(e){super(),this.light=e,this.updateBeforeType=yn.RENDER,this.isShadowBaseNode=!0}setupShadowPosition({context:e,material:t}){_V.assign(t.receivedShadowPositionNode||e.shadowPositionWorld||yf)}},_V=tp("vec3","shadowPositionWorld");function zRe(i,e={}){return e.toneMapping=i.toneMapping,e.toneMappingExposure=i.toneMappingExposure,e.outputColorSpace=i.outputColorSpace,e.renderTarget=i.getRenderTarget(),e.activeCubeFace=i.getActiveCubeFace(),e.activeMipmapLevel=i.getActiveMipmapLevel(),e.renderObjectFunction=i.getRenderObjectFunction(),e.pixelRatio=i.getPixelRatio(),e.mrt=i.getMRT(),e.clearColor=i.getClearColor(e.clearColor||new zt),e.clearAlpha=i.getClearAlpha(),e.autoClear=i.autoClear,e.scissorTest=i.getScissorTest(),e}function VRe(i,e){return e=zRe(i,e),i.setMRT(null),i.setRenderObjectFunction(null),i.setClearColor(0,1),i.autoClear=!0,e}function GRe(i,e){i.toneMapping=e.toneMapping,i.toneMappingExposure=e.toneMappingExposure,i.outputColorSpace=e.outputColorSpace,i.setRenderTarget(e.renderTarget,e.activeCubeFace,e.activeMipmapLevel),i.setRenderObjectFunction(e.renderObjectFunction),i.setPixelRatio(e.pixelRatio),i.setMRT(e.mrt),i.setClearColor(e.clearColor,e.clearAlpha),i.autoClear=e.autoClear,i.setScissorTest(e.scissorTest)}function qRe(i,e={}){return e.background=i.background,e.backgroundNode=i.backgroundNode,e.overrideMaterial=i.overrideMaterial,e}function HRe(i,e){return e=qRe(i,e),i.background=null,i.backgroundNode=null,i.overrideMaterial=null,e}function WRe(i,e){i.background=e.background,i.backgroundNode=e.backgroundNode,i.overrideMaterial=e.overrideMaterial}function jRe(i,e,t){return t=VRe(i,t),t=HRe(e,t),t}function XRe(i,e,t){GRe(i,t),WRe(e,t)}var B4=new WeakMap,Bse=me(({depthTexture:i,shadowCoord:e,depthLayer:t})=>{let n=fi(i,e.xy).setName("t_basic");return i.isArrayTexture&&(n=n.depth(t)),n.compare(e.z)}),Ose=me(({depthTexture:i,shadowCoord:e,shadow:t,depthLayer:n})=>{let r=(u,f)=>{let d=fi(i,u);return i.isArrayTexture&&(d=d.depth(n)),d.compare(f)},s=mr("mapSize","vec2",t).setGroup(Jt),o=mr("radius","float",t).setGroup(Jt),a=dt(1).div(s),l=o.mul(a.x),c=hV(f1.xy).mul(6.28318530718);return Ls(r(e.xy.add(Wu(0,5,c).mul(l)),e.z),r(e.xy.add(Wu(1,5,c).mul(l)),e.z),r(e.xy.add(Wu(2,5,c).mul(l)),e.z),r(e.xy.add(Wu(3,5,c).mul(l)),e.z),r(e.xy.add(Wu(4,5,c).mul(l)),e.z)).mul(1/5)}),Use=me(({depthTexture:i,shadowCoord:e,shadow:t,depthLayer:n})=>{let r=mr("mapSize","vec2",t).setGroup(Jt),s=dt(1).div(r),o=e.xy,a=$u(o.mul(r).add(.5)).toConst();o.subAssign(a.sub(.5).mul(s));let l=A=>{let y=fi(i,o).offset(A).gather();return i.isArrayTexture&&(y=y.depth(n)),y.compare(e.z)},c=l(kr(-1,1)).toConst(),u=l(kr(1,1)).toConst(),f=l(kr(-1,-1)).toConst(),d=l(kr(1,-1)).toConst();return Ls(Qn(c.x,u.y,a.x).add(c.y).add(u.x).mul(a.y),Qn(c.w,u.z,a.x).add(c.z).add(u.w),Qn(f.x,d.y,a.x).add(f.y).add(d.x),Qn(f.w,d.z,a.x).add(f.z).add(d.w).mul(a.y.oneMinus())).mul(1/9)}),kse=me(({depthTexture:i,shadowCoord:e,depthLayer:t},n)=>{let r=fi(i).sample(e.xy);i.isArrayTexture&&(r=r.depth(t)),r=r.rg;let s=r.x,o=zr(1e-7,r.y.mul(r.y)),a=n.renderer.reversedDepthBuffer?t1(s,e.z):t1(e.z,s),l=oe(1).toVar();return $t(a.notEqual(1),()=>{let c=e.z.sub(s),u=o.div(o.add(c.mul(c)));u=Yu(ai(u,.3).div(.65)),l.assign(zr(a,u))}),l}),zse=i=>{let e=B4.get(i);return e===void 0&&(e=new Ir,e.colorNode=Ft(0,0,0,1),e.isShadowPassMaterial=!0,e.name="ShadowMaterial",e.blending=ps,e.fog=!1,B4.set(i,e)),e},Vse=i=>{let e=B4.get(i);e!==void 0&&(e.dispose(),B4.delete(i))},Ate=new Ef,H_=[],Gse=(i,e,t,n)=>{H_[0]=i,H_[1]=e;let r=Ate.get(H_);return(r===void 0||r.shadowType!==t||r.useVelocity!==n)&&(r=(s,o,a,l,c,u,f,d,A)=>{(s.castShadow===!0||s.receiveShadow&&t===qc)&&(n&&(Zte(s).useVelocity=!0),s.onBeforeShadow(i,s,a,e.camera,l,o.overrideMaterial,u),i.renderObject(s,o,a,l,c,u,f,d,A),s.onAfterShadow(i,s,a,e.camera,l,o.overrideMaterial,u))},r.shadowType=t,r.useVelocity=n,Ate.set(H_,r)),H_[0]=null,H_[1]=null,r},$Re=me(({samples:i,radius:e,size:t,shadowPass:n,depthLayer:r})=>{let s=oe(0).toVar("meanVertical"),o=oe(0).toVar("squareMeanVertical"),a=i.lessThanEqual(oe(1)).select(oe(0),oe(2).div(i.sub(1))),l=i.lessThanEqual(oe(1)).select(oe(0),oe(-1));Oi({start:de(0),end:de(i),type:"int",condition:"<"},({i:u})=>{let f=l.add(oe(u).mul(a)),d=n.sample(Ls(f1.xy,dt(0,f).mul(e)).div(t));n.value.isArrayTexture&&(d=d.depth(r)),d=d.x,s.addAssign(d),o.addAssign(d.mul(d))}),s.divAssign(i),o.divAssign(i);let c=Ja(o.sub(s.mul(s)).max(0));return dt(s,c)}),YRe=me(({samples:i,radius:e,size:t,shadowPass:n,depthLayer:r})=>{let s=oe(0).toVar("meanHorizontal"),o=oe(0).toVar("squareMeanHorizontal"),a=i.lessThanEqual(oe(1)).select(oe(0),oe(2).div(i.sub(1))),l=i.lessThanEqual(oe(1)).select(oe(0),oe(-1));Oi({start:de(0),end:de(i),type:"int",condition:"<"},({i:u})=>{let f=l.add(oe(u).mul(a)),d=n.sample(Ls(f1.xy,dt(f,0).mul(e)).div(t));n.value.isArrayTexture&&(d=d.depth(r)),s.addAssign(d.x),o.addAssign(Ls(d.y.mul(d.y),d.x.mul(d.x)))}),s.divAssign(i),o.divAssign(i);let c=Ja(o.sub(s.mul(s)).max(0));return dt(s,c)}),ZRe=[Bse,Ose,Use,kse],$O,IR=new bS,O4=class extends xk{static get type(){return"ShadowNode"}constructor(e,t=null){super(e),this.shadow=t||e.shadow,this.shadowMap=null,this.vsmShadowMapVertical=null,this.vsmShadowMapHorizontal=null,this.vsmMaterialVertical=null,this.vsmMaterialHorizontal=null,this._node=null,this._currentShadowType=null,this._cameraFrameId=new WeakMap,this.isShadowNode=!0,this.depthLayer=0}setupShadowFilter(e,{filterFn:t,depthTexture:n,shadowCoord:r,shadow:s,depthLayer:o}){let a=r.x.greaterThanEqual(0).and(r.x.lessThanEqual(1)).and(r.y.greaterThanEqual(0)).and(r.y.lessThanEqual(1)).and(r.z.lessThanEqual(1)),l=t({depthTexture:n,shadowCoord:r,shadow:s,depthLayer:o});return a.select(l,oe(1))}setupShadowCoord(e,t){let{shadow:n}=this,{renderer:r}=e,s=n.biasNode||mr("bias","float",n).setGroup(Jt),o=t,a;if(n.camera.isOrthographicCamera||r.logarithmicDepthBuffer!==!0)o=o.xyz.div(o.w),a=o.z;else{let l=o.w;o=o.xy.div(l);let c=mr("near","float",n.camera).setGroup(Jt),u=mr("far","float",n.camera).setGroup(Jt);a=PI(l.negate(),c,u)}return o=pe(o.x,o.y.oneMinus(),r.reversedDepthBuffer?a.sub(s):a.add(s)),o}getShadowFilterFn(e){return ZRe[e]}setupRenderTarget(e,t){let n=new Cs(e.mapSize.width,e.mapSize.height);n.name="ShadowDepthTexture",n.compareFunction=t.renderer.reversedDepthBuffer?Fu:Yh;let r=t.createRenderTarget(e.mapSize.width,e.mapSize.height);return r.texture.name="ShadowMap",r.texture.type=e.mapType,r.depthTexture=n,{shadowMap:r,depthTexture:n}}setupShadow(e){let{renderer:t,camera:n}=e,{light:r,shadow:s}=this,{depthTexture:o,shadowMap:a}=this.setupRenderTarget(s,e),l=t.shadowMap.type,c=t.hasCompatibility(Ud.TEXTURE_COMPARE);if((l===p0||l===IM)&&c?(o.minFilter=Mi,o.magFilter=Mi):(o.minFilter=Ti,o.magFilter=Ti),s.camera.coordinateSystem=n.coordinateSystem,s.camera.updateProjectionMatrix(),l===qc&&s.isPointLightShadow!==!0){o.compareFunction=null,a.depth>1?(a._vsmShadowMapVertical||(a._vsmShadowMapVertical=e.createRenderTarget(s.mapSize.width,s.mapSize.height,{format:js,type:Wi,depth:a.depth,depthBuffer:!1}),a._vsmShadowMapVertical.texture.name="VSMVertical"),this.vsmShadowMapVertical=a._vsmShadowMapVertical,a._vsmShadowMapHorizontal||(a._vsmShadowMapHorizontal=e.createRenderTarget(s.mapSize.width,s.mapSize.height,{format:js,type:Wi,depth:a.depth,depthBuffer:!1}),a._vsmShadowMapHorizontal.texture.name="VSMHorizontal"),this.vsmShadowMapHorizontal=a._vsmShadowMapHorizontal):(this.vsmShadowMapVertical=e.createRenderTarget(s.mapSize.width,s.mapSize.height,{format:js,type:Wi,depthBuffer:!1}),this.vsmShadowMapHorizontal=e.createRenderTarget(s.mapSize.width,s.mapSize.height,{format:js,type:Wi,depthBuffer:!1}));let D=fi(o);o.isArrayTexture&&(D=D.depth(this.depthLayer));let L=fi(this.vsmShadowMapVertical.texture);o.isArrayTexture&&(L=L.depth(this.depthLayer));let C=mr("blurSamples","float",s).setGroup(Jt),B=mr("radius","float",s).setGroup(Jt),k=mr("mapSize","vec2",s).setGroup(Jt),z=this.vsmMaterialVertical||(this.vsmMaterialVertical=new Ir);z.fragmentNode=$Re({samples:C,radius:B,size:k,shadowPass:D,depthLayer:this.depthLayer}).context(e.getSharedContext()),z.name="VSMVertical",z=this.vsmMaterialHorizontal||(this.vsmMaterialHorizontal=new Ir),z.fragmentNode=YRe({samples:C,radius:B,size:k,shadowPass:L,depthLayer:this.depthLayer}).context(e.getSharedContext()),z.name="VSMHorizontal"}let u=mr("intensity","float",s).setGroup(Jt),f=mr("normalBias","float",s).setGroup(Jt),d=OI(r),A=Tm.mul(f),y;!t.highPrecision||e.material.receivedShadowPositionNode||e.context.shadowPositionWorld?y=d.mul(_V.add(A)):y=Xt("mat4").onObjectUpdate(({object:L},C)=>C.value.multiplyMatrices(d.value,L.matrixWorld)).mul(Mr).add(d.mul(Ft(A,0)));let w=this.setupShadowCoord(e,y),S=s.filterNode||this.getShadowFilterFn(t.shadowMap.type)||null;if(S===null)throw new Error("THREE.WebGPURenderer: Shadow map type not supported yet.");let T=l===qc&&s.isPointLightShadow!==!0?this.vsmShadowMapHorizontal.texture:o,R=this.setupShadowFilter(e,{filterFn:S,shadowTexture:a.texture,depthTexture:T,shadowCoord:w,shadow:s,depthLayer:this.depthLayer}),P;t.shadowMap.transmitted===!0&&(a.texture.isCubeTexture?P=Ka(a.texture,w.xyz):(P=fi(a.texture,w),o.isArrayTexture&&(P=P.depth(this.depthLayer))));let I;P?I=Qn(1,R.rgb.mix(P,1),u.mul(P.a)).toVar():I=Qn(1,R,u).toVar(),this.shadowMap=a,this.shadow.map=a;let F=`${this.light.type} Shadow [ ${this.light.name||"ID: "+this.light.id} ]`;return P&&I.toInspector(`${F} / Color`,()=>this.shadowMap.texture.isCubeTexture?Ka(this.shadowMap.texture,f7()):fi(this.shadowMap.texture)),I.toInspector(`${F} / Depth`,()=>{let D=mr("near","float",this.shadow.camera),L=mr("far","float",this.shadow.camera),C;this.shadowMap.texture.isCubeTexture?C=Ka(this.shadowMap.depthTexture,f7()).r:C=fi(this.shadowMap.depthTexture).r;let B;return this.shadow.camera.isPerspectiveCamera?B=II(C,D,L):B=Wre(C,D,L),B=Kg(B,D,L),B.oneMinus()})}setup(e){if(e.renderer.shadowMap.enabled!==!1)return me(()=>{let t=e.renderer.shadowMap.type;this._currentShadowType!==t&&(this._reset(),this._node=null);let n=this._node;return this.setupShadowPosition(e),n===null&&(this._node=n=this.setupShadow(e),this._currentShadowType=t),e.material.receivedShadowNode&&(n=e.material.receivedShadowNode(n)),n})()}renderShadow(e){let{shadow:t,shadowMap:n,light:r}=this,{renderer:s,scene:o}=e;t.updateMatrices(r),n.setSize(t.mapSize.width,t.mapSize.height,n.depth);let a=o.name;o.name=`Shadow Map [ ${r.name||"ID: "+r.id} ]`,s.render(o,t.camera),o.name=a}updateShadow(e){let{shadowMap:t,light:n,shadow:r}=this,{renderer:s,scene:o,camera:a}=e,l=s.shadowMap.type,c=t.depthTexture.version;this._depthVersionCached=c;let u=r.camera.layers.mask;(r.camera.layers.mask&4294967294)===0&&(r.camera.layers.mask=a.layers.mask);let f=s.getRenderObjectFunction(),d=s.getMRT(),A=d?d.has("velocity"):!1;$O=jRe(s,o,$O),o.overrideMaterial=zse(n),s.setRenderObjectFunction(Gse(s,r,l,A)),s.setClearColor(0,0),s.setRenderTarget(t),this.renderShadow(e),s.setRenderObjectFunction(f),l===qc&&r.isPointLightShadow!==!0&&this.vsmPass(s),r.camera.layers.mask=u,XRe(s,o,$O)}vsmPass(e){let{shadow:t}=this,n=this.shadowMap.depth;this.vsmShadowMapVertical.setSize(t.mapSize.width,t.mapSize.height,n),this.vsmShadowMapHorizontal.setSize(t.mapSize.width,t.mapSize.height,n),e.setRenderTarget(this.vsmShadowMapVertical),IR.material=this.vsmMaterialVertical,IR.render(e),e.setRenderTarget(this.vsmShadowMapHorizontal),IR.material=this.vsmMaterialHorizontal,IR.render(e)}dispose(){this._reset(),super.dispose()}_reset(){this._currentShadowType=null,Vse(this.light),this.shadowMap&&(this.shadowMap.dispose(),this.shadowMap=null),this.vsmShadowMapVertical!==null&&(this.vsmShadowMapVertical.dispose(),this.vsmShadowMapVertical=null,this.vsmMaterialVertical.dispose(),this.vsmMaterialVertical=null),this.vsmShadowMapHorizontal!==null&&(this.vsmShadowMapHorizontal.dispose(),this.vsmShadowMapHorizontal=null,this.vsmMaterialHorizontal.dispose(),this.vsmMaterialHorizontal=null)}updateBefore(e){let{shadow:t}=this,n=t.needsUpdate||t.autoUpdate;n&&(this._cameraFrameId[e.camera]===e.frameId&&(n=!1),this._cameraFrameId[e.camera]=e.frameId),n&&(this.updateShadow(e),this.shadowMap.depthTexture.version===this._depthVersionCached&&(t.needsUpdate=!1))}},qse=(i,e)=>new O4(i,e),KRe=new zt,gte=new cn,Hw=new re,YO=new re,QRe=[new re(1,0,0),new re(-1,0,0),new re(0,-1,0),new re(0,1,0),new re(0,0,1),new re(0,0,-1)],JRe=[new re(0,-1,0),new re(0,-1,0),new re(0,0,-1),new re(0,0,1),new re(0,-1,0),new re(0,-1,0)],e4e=[new re(1,0,0),new re(-1,0,0),new re(0,1,0),new re(0,-1,0),new re(0,0,1),new re(0,0,-1)],t4e=[new re(0,-1,0),new re(0,-1,0),new re(0,0,1),new re(0,0,-1),new re(0,-1,0),new re(0,-1,0)],Hse=me(({depthTexture:i,bd3D:e,dp:t})=>Ka(i,e).compare(t)),Wse=me(({depthTexture:i,bd3D:e,dp:t,shadow:n})=>{let r=mr("radius","float",n).setGroup(Jt),s=mr("mapSize","vec2",n).setGroup(Jt),o=r.div(s.x),a=fr(e),l=xa(Jd(e,a.x.greaterThan(a.z).select(pe(0,1,0),pe(1,0,0)))),c=Jd(e,l),u=hV(f1.xy).mul(6.28318530718),f=Wu(0,5,u),d=Wu(1,5,u),A=Wu(2,5,u),y=Wu(3,5,u),w=Wu(4,5,u);return Ka(i,e.add(l.mul(f.x).add(c.mul(f.y)).mul(o))).compare(t).add(Ka(i,e.add(l.mul(d.x).add(c.mul(d.y)).mul(o))).compare(t)).add(Ka(i,e.add(l.mul(A.x).add(c.mul(A.y)).mul(o))).compare(t)).add(Ka(i,e.add(l.mul(y.x).add(c.mul(y.y)).mul(o))).compare(t)).add(Ka(i,e.add(l.mul(w.x).add(c.mul(w.y)).mul(o))).compare(t)).mul(1/5)}),n4e=me(({filterFn:i,depthTexture:e,shadowCoord:t,shadow:n},r)=>{let s=t.xyz.toConst(),o=s.abs().toConst(),a=o.x.max(o.y).max(o.z),l=Xt("float").setGroup(Jt).onRenderUpdate(()=>n.camera.near),c=Xt("float").setGroup(Jt).onRenderUpdate(()=>n.camera.far),u=mr("bias","float",n).setGroup(Jt),f=oe(1).toVar();return $t(a.sub(c).lessThanEqual(0).and(a.sub(l).greaterThanEqual(0)),()=>{let d;r.renderer.reversedDepthBuffer?(d=jre(a.negate(),l,c),d.subAssign(u)):r.renderer.logarithmicDepthBuffer?(d=PI(a.negate(),l,c),d.addAssign(u)):(d=rV(a.negate(),l,c),d.addAssign(u));let A=s.normalize();f.assign(i({depthTexture:e,bd3D:A,dp:d,shadow:n}))}),f}),yk=class extends O4{static get type(){return"PointShadowNode"}constructor(e,t=null){super(e,t)}getShadowFilterFn(e){return e===B8?Hse:Wse}setupShadowCoord(e,t){return t}setupShadowFilter(e,{filterFn:t,depthTexture:n,shadowCoord:r,shadow:s}){return n4e({filterFn:t,depthTexture:n,shadowCoord:r,shadow:s})}setupRenderTarget(e,t){let n=new e_(e.mapSize.width);n.name="PointShadowDepthTexture",n.compareFunction=t.renderer.reversedDepthBuffer?Fu:Yh;let r=t.createCubeRenderTarget(e.mapSize.width);return r.texture.name="PointShadowMap",r.depthTexture=n,{shadowMap:r,depthTexture:n}}renderShadow(e){let{shadow:t,shadowMap:n,light:r}=this,{renderer:s,scene:o}=e,a=t.camera,l=t.matrix,c=s.coordinateSystem===xl,u=c?QRe:e4e,f=c?JRe:t4e;n.setSize(t.mapSize.width,t.mapSize.width);let d=s.autoClear,A=s.getClearColor(KRe),y=s.getClearAlpha();s.autoClear=!1,s.setClearColor(t.clearColor,t.clearAlpha);for(let w=0;w<6;w++){s.setRenderTarget(n,w),s.clear();let S=r.distance||a.far;S!==a.far&&(a.far=S,a.updateProjectionMatrix()),Hw.setFromMatrixPosition(r.matrixWorld),a.position.copy(Hw),YO.copy(a.position),YO.add(u[w]),a.up.copy(f[w]),a.lookAt(YO),a.updateMatrixWorld(),l.makeTranslation(-Hw.x,-Hw.y,-Hw.z),gte.multiplyMatrices(a.projectionMatrix,a.matrixWorldInverse),t._frustum.setFromProjectionMatrix(gte,a.coordinateSystem,a.reversedDepth);let T=o.name;o.name=`Point Light Shadow [ ${r.name||"ID: "+r.id} ] - Face ${w+1}`,s.render(o,a),o.name=T}s.autoClear=d,s.setClearColor(A,y)}},jse=(i,e)=>new yk(i,e),ep=class extends xm{static get type(){return"AnalyticLightNode"}constructor(e=null){super(),this.light=e,this.color=new zt,this.colorNode=e&&e.colorNode||Xt(this.color).setGroup(Jt),this.baseColorNode=null,this.shadowNode=null,this.shadowColorNode=null,this.isAnalyticLightNode=!0,this.updateType=yn.FRAME,e&&e.shadow&&(this._shadowDisposeListener=()=>{this.disposeShadow()},e.addEventListener("dispose",this._shadowDisposeListener))}dispose(){this._shadowDisposeListener&&this.light.removeEventListener("dispose",this._shadowDisposeListener),super.dispose()}disposeShadow(){this.shadowNode!==null&&(this.shadowNode.dispose(),this.shadowNode=null),this.shadowColorNode=null,this.baseColorNode!==null&&(this.colorNode=this.baseColorNode,this.baseColorNode=null)}getHash(){return this.light.uuid}getLightVector(e){return gV(this.light).sub(e.context.positionView||xs)}setupDirect(){}setupDirectRectArea(){}setupShadowNode(){return qse(this.light)}setupShadow(e){let{renderer:t}=e;if(t.shadowMap.enabled===!1)return;let n=this.shadowColorNode;if(n===null){let r=this.light.shadow.shadowNode,s;r!==void 0?s=Ht(r):s=this.setupShadowNode(),this.shadowNode=s,this.shadowColorNode=n=this.colorNode.mul(s),this.baseColorNode=this.colorNode}e.context.getShadow&&(n=e.context.getShadow(this,e)),this.colorNode=n}setup(e){this.colorNode=this.baseColorNode||this.colorNode,this.light.castShadow?e.object.receiveShadow&&this.setupShadow(e):this.shadowNode!==null&&(this.shadowNode.dispose(),this.shadowNode=null,this.shadowColorNode=null);let t=this.setupDirect(e),n=this.setupDirectRectArea(e);t&&e.lightsNode.setupDirectLight(e,this,t),n&&e.lightsNode.setupDirectRectAreaLight(e,this,n)}update(){let{light:e}=this;this.color.copy(e.color).multiplyScalar(e.intensity)}},xV=me(({lightDistance:i,cutoffDistance:e,decayExponent:t})=>{let n=i.pow(t).max(.01).reciprocal();return e.greaterThan(0).select(n.mul(i.div(e).pow4().oneMinus().clamp().pow2()),n)}),Xse=({color:i,lightVector:e,cutoffDistance:t,decayExponent:n})=>{let r=e.normalize(),s=e.length(),o=xV({lightDistance:s,cutoffDistance:t,decayExponent:n}),a=i.mul(o);return{lightDirection:r,lightColor:a}},bk=class extends ep{static get type(){return"PointLightNode"}constructor(e=null){super(e),this.cutoffDistanceNode=Xt(0).setGroup(Jt),this.decayExponentNode=Xt(2).setGroup(Jt)}update(e){let{light:t}=this;super.update(e),this.cutoffDistanceNode.value=t.distance,this.decayExponentNode.value=t.decay}setupShadowNode(){return jse(this.light)}setupDirect(e){return Xse({color:this.colorNode,lightVector:this.getLightVector(e),cutoffDistance:this.cutoffDistanceNode,decayExponent:this.decayExponentNode})}},i4e=me(([i=Ui()])=>{let e=i.mul(2),t=e.x.floor(),n=e.y.floor();return t.add(n).mod(2).sign()}),r4e=me(([i=Ui()],{renderer:e,material:t})=>{let n=Sz(i.mul(2).sub(1)),r;if(t.alphaToCoverage&&e.currentSamples>0){let s=oe(n.fwidth()).toVar();r=pc(s.oneMinus(),s.add(1),n).oneMinus()}else r=_a(n.greaterThan(1),0,1);return r}),lS=me(([i,e,t])=>{let n=oe(t).toVar(),r=oe(e).toVar(),s=fc(i).toVar();return _a(s,r,n).uniformFlow()}).setLayout({name:"mx_select",type:"float",inputs:[{name:"b",type:"bool"},{name:"t",type:"float"},{name:"f",type:"float"}]}),U4=me(([i,e])=>{let t=fc(e).toVar(),n=oe(i).toVar();return _a(t,n.negate(),n).uniformFlow()}).setLayout({name:"mx_negate_if",type:"float",inputs:[{name:"val",type:"float"},{name:"b",type:"bool"}]}),Ps=me(([i])=>{let e=oe(i).toVar();return de(_f(e))}).setLayout({name:"mx_floor",type:"int",inputs:[{name:"x",type:"float"}]}),Cr=me(([i,e])=>{let t=oe(i).toVar();return e.assign(Ps(t)),t.sub(oe(e))}),s4e=me(([i,e,t,n,r,s])=>{let o=oe(s).toVar(),a=oe(r).toVar(),l=oe(n).toVar(),c=oe(t).toVar(),u=oe(e).toVar(),f=oe(i).toVar(),d=oe(ai(1,a)).toVar();return ai(1,o).mul(f.mul(d).add(u.mul(a))).add(o.mul(c.mul(d).add(l.mul(a))))}).setLayout({name:"mx_bilerp_0",type:"float",inputs:[{name:"v0",type:"float"},{name:"v1",type:"float"},{name:"v2",type:"float"},{name:"v3",type:"float"},{name:"s",type:"float"},{name:"t",type:"float"}]}),o4e=me(([i,e,t,n,r,s])=>{let o=oe(s).toVar(),a=oe(r).toVar(),l=pe(n).toVar(),c=pe(t).toVar(),u=pe(e).toVar(),f=pe(i).toVar(),d=oe(ai(1,a)).toVar();return ai(1,o).mul(f.mul(d).add(u.mul(a))).add(o.mul(c.mul(d).add(l.mul(a))))}).setLayout({name:"mx_bilerp_1",type:"vec3",inputs:[{name:"v0",type:"vec3"},{name:"v1",type:"vec3"},{name:"v2",type:"vec3"},{name:"v3",type:"vec3"},{name:"s",type:"float"},{name:"t",type:"float"}]}),$se=Zo([s4e,o4e]),a4e=me(([i,e,t,n,r,s,o,a,l,c,u])=>{let f=oe(u).toVar(),d=oe(c).toVar(),A=oe(l).toVar(),y=oe(a).toVar(),w=oe(o).toVar(),S=oe(s).toVar(),T=oe(r).toVar(),R=oe(n).toVar(),P=oe(t).toVar(),I=oe(e).toVar(),F=oe(i).toVar(),D=oe(ai(1,A)).toVar(),L=oe(ai(1,d)).toVar();return oe(ai(1,f)).toVar().mul(L.mul(F.mul(D).add(I.mul(A))).add(d.mul(P.mul(D).add(R.mul(A))))).add(f.mul(L.mul(T.mul(D).add(S.mul(A))).add(d.mul(w.mul(D).add(y.mul(A))))))}).setLayout({name:"mx_trilerp_0",type:"float",inputs:[{name:"v0",type:"float"},{name:"v1",type:"float"},{name:"v2",type:"float"},{name:"v3",type:"float"},{name:"v4",type:"float"},{name:"v5",type:"float"},{name:"v6",type:"float"},{name:"v7",type:"float"},{name:"s",type:"float"},{name:"t",type:"float"},{name:"r",type:"float"}]}),l4e=me(([i,e,t,n,r,s,o,a,l,c,u])=>{let f=oe(u).toVar(),d=oe(c).toVar(),A=oe(l).toVar(),y=pe(a).toVar(),w=pe(o).toVar(),S=pe(s).toVar(),T=pe(r).toVar(),R=pe(n).toVar(),P=pe(t).toVar(),I=pe(e).toVar(),F=pe(i).toVar(),D=oe(ai(1,A)).toVar(),L=oe(ai(1,d)).toVar();return oe(ai(1,f)).toVar().mul(L.mul(F.mul(D).add(I.mul(A))).add(d.mul(P.mul(D).add(R.mul(A))))).add(f.mul(L.mul(T.mul(D).add(S.mul(A))).add(d.mul(w.mul(D).add(y.mul(A))))))}).setLayout({name:"mx_trilerp_1",type:"vec3",inputs:[{name:"v0",type:"vec3"},{name:"v1",type:"vec3"},{name:"v2",type:"vec3"},{name:"v3",type:"vec3"},{name:"v4",type:"vec3"},{name:"v5",type:"vec3"},{name:"v6",type:"vec3"},{name:"v7",type:"vec3"},{name:"s",type:"float"},{name:"t",type:"float"},{name:"r",type:"float"}]}),Yse=Zo([a4e,l4e]),c4e=me(([i,e,t])=>{let n=oe(t).toVar(),r=oe(e).toVar(),s=rt(i).toVar(),o=rt(s.bitAnd(rt(7))).toVar(),a=oe(lS(o.lessThan(rt(4)),r,n)).toVar(),l=oe(Tn(2,lS(o.lessThan(rt(4)),n,r))).toVar();return U4(a,fc(o.bitAnd(rt(1)))).add(U4(l,fc(o.bitAnd(rt(2)))))}).setLayout({name:"mx_gradient_float_0",type:"float",inputs:[{name:"hash",type:"uint"},{name:"x",type:"float"},{name:"y",type:"float"}]}),u4e=me(([i,e,t,n])=>{let r=oe(n).toVar(),s=oe(t).toVar(),o=oe(e).toVar(),a=rt(i).toVar(),l=rt(a.bitAnd(rt(15))).toVar(),c=oe(lS(l.lessThan(rt(8)),o,s)).toVar(),u=oe(lS(l.lessThan(rt(4)),s,lS(l.equal(rt(12)).or(l.equal(rt(14))),o,r))).toVar();return U4(c,fc(l.bitAnd(rt(1)))).add(U4(u,fc(l.bitAnd(rt(2)))))}).setLayout({name:"mx_gradient_float_1",type:"float",inputs:[{name:"hash",type:"uint"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]}),So=Zo([c4e,u4e]),h4e=me(([i,e,t])=>{let n=oe(t).toVar(),r=oe(e).toVar(),s=u1(i).toVar();return pe(So(s.x,r,n),So(s.y,r,n),So(s.z,r,n))}).setLayout({name:"mx_gradient_vec3_0",type:"vec3",inputs:[{name:"hash",type:"uvec3"},{name:"x",type:"float"},{name:"y",type:"float"}]}),f4e=me(([i,e,t,n])=>{let r=oe(n).toVar(),s=oe(t).toVar(),o=oe(e).toVar(),a=u1(i).toVar();return pe(So(a.x,o,s,r),So(a.y,o,s,r),So(a.z,o,s,r))}).setLayout({name:"mx_gradient_vec3_1",type:"vec3",inputs:[{name:"hash",type:"uvec3"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]}),eu=Zo([h4e,f4e]),d4e=me(([i])=>{let e=oe(i).toVar();return Tn(.6616,e)}).setLayout({name:"mx_gradient_scale2d_0",type:"float",inputs:[{name:"v",type:"float"}]}),p4e=me(([i])=>{let e=oe(i).toVar();return Tn(.982,e)}).setLayout({name:"mx_gradient_scale3d_0",type:"float",inputs:[{name:"v",type:"float"}]}),m4e=me(([i])=>{let e=pe(i).toVar();return Tn(.6616,e)}).setLayout({name:"mx_gradient_scale2d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),Zse=Zo([d4e,m4e]),A4e=me(([i])=>{let e=pe(i).toVar();return Tn(.982,e)}).setLayout({name:"mx_gradient_scale3d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),Kse=Zo([p4e,A4e]),cc=me(([i,e])=>{let t=de(e).toVar(),n=rt(i).toVar();return n.shiftLeft(t).bitOr(n.shiftRight(de(32).sub(t)))}).setLayout({name:"mx_rotl32",type:"uint",inputs:[{name:"x",type:"uint"},{name:"k",type:"int"}]}),Qse=me(([i,e,t])=>{i.subAssign(t),i.bitXorAssign(cc(t,de(4))),t.addAssign(e),e.subAssign(i),e.bitXorAssign(cc(i,de(6))),i.addAssign(t),t.subAssign(e),t.bitXorAssign(cc(e,de(8))),e.addAssign(i),i.subAssign(t),i.bitXorAssign(cc(t,de(16))),t.addAssign(e),e.subAssign(i),e.bitXorAssign(cc(i,de(19))),i.addAssign(t),t.subAssign(e),t.bitXorAssign(cc(e,de(4))),e.addAssign(i)}),BS=me(([i,e,t])=>{let n=rt(t).toVar(),r=rt(e).toVar(),s=rt(i).toVar();return n.bitXorAssign(r),n.subAssign(cc(r,de(14))),s.bitXorAssign(n),s.subAssign(cc(n,de(11))),r.bitXorAssign(s),r.subAssign(cc(s,de(25))),n.bitXorAssign(r),n.subAssign(cc(r,de(16))),s.bitXorAssign(n),s.subAssign(cc(n,de(4))),r.bitXorAssign(s),r.subAssign(cc(s,de(14))),n.bitXorAssign(r),n.subAssign(cc(r,de(24))),n}).setLayout({name:"mx_bjfinal",type:"uint",inputs:[{name:"a",type:"uint"},{name:"b",type:"uint"},{name:"c",type:"uint"}]}),ya=me(([i])=>{let e=rt(i).toVar();return oe(e).div(oe(rt(de(4294967295))))}).setLayout({name:"mx_bits_to_01",type:"float",inputs:[{name:"bits",type:"uint"}]}),bf=me(([i])=>{let e=oe(i).toVar();return e.mul(e).mul(e).mul(e.mul(e.mul(6).sub(15)).add(10))}).setLayout({name:"mx_fade",type:"float",inputs:[{name:"t",type:"float"}]}),g4e=me(([i])=>{let e=de(i).toVar(),t=rt(rt(1)).toVar(),n=rt(rt(de(3735928559)).add(t.shiftLeft(rt(2))).add(rt(13))).toVar();return BS(n.add(rt(e)),n,n)}).setLayout({name:"mx_hash_int_0",type:"uint",inputs:[{name:"x",type:"int"}]}),v4e=me(([i,e])=>{let t=de(e).toVar(),n=de(i).toVar(),r=rt(rt(2)).toVar(),s=rt().toVar(),o=rt().toVar(),a=rt().toVar();return s.assign(o.assign(a.assign(rt(de(3735928559)).add(r.shiftLeft(rt(2))).add(rt(13))))),s.addAssign(rt(n)),o.addAssign(rt(t)),BS(s,o,a)}).setLayout({name:"mx_hash_int_1",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),_4e=me(([i,e,t])=>{let n=de(t).toVar(),r=de(e).toVar(),s=de(i).toVar(),o=rt(rt(3)).toVar(),a=rt().toVar(),l=rt().toVar(),c=rt().toVar();return a.assign(l.assign(c.assign(rt(de(3735928559)).add(o.shiftLeft(rt(2))).add(rt(13))))),a.addAssign(rt(s)),l.addAssign(rt(r)),c.addAssign(rt(n)),BS(a,l,c)}).setLayout({name:"mx_hash_int_2",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),x4e=me(([i,e,t,n])=>{let r=de(n).toVar(),s=de(t).toVar(),o=de(e).toVar(),a=de(i).toVar(),l=rt(rt(4)).toVar(),c=rt().toVar(),u=rt().toVar(),f=rt().toVar();return c.assign(u.assign(f.assign(rt(de(3735928559)).add(l.shiftLeft(rt(2))).add(rt(13))))),c.addAssign(rt(a)),u.addAssign(rt(o)),f.addAssign(rt(s)),Qse(c,u,f),c.addAssign(rt(r)),BS(c,u,f)}).setLayout({name:"mx_hash_int_3",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xx",type:"int"}]}),y4e=me(([i,e,t,n,r])=>{let s=de(r).toVar(),o=de(n).toVar(),a=de(t).toVar(),l=de(e).toVar(),c=de(i).toVar(),u=rt(rt(5)).toVar(),f=rt().toVar(),d=rt().toVar(),A=rt().toVar();return f.assign(d.assign(A.assign(rt(de(3735928559)).add(u.shiftLeft(rt(2))).add(rt(13))))),f.addAssign(rt(c)),d.addAssign(rt(l)),A.addAssign(rt(a)),Qse(f,d,A),f.addAssign(rt(o)),d.addAssign(rt(s)),BS(f,d,A)}).setLayout({name:"mx_hash_int_4",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xx",type:"int"},{name:"yy",type:"int"}]}),Xi=Zo([g4e,v4e,_4e,x4e,y4e]),b4e=me(([i,e])=>{let t=de(e).toVar(),n=de(i).toVar(),r=rt(Xi(n,t)).toVar(),s=u1().toVar();return s.x.assign(r.bitAnd(de(255))),s.y.assign(r.shiftRight(de(8)).bitAnd(de(255))),s.z.assign(r.shiftRight(de(16)).bitAnd(de(255))),s}).setLayout({name:"mx_hash_vec3_0",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),w4e=me(([i,e,t])=>{let n=de(t).toVar(),r=de(e).toVar(),s=de(i).toVar(),o=rt(Xi(s,r,n)).toVar(),a=u1().toVar();return a.x.assign(o.bitAnd(de(255))),a.y.assign(o.shiftRight(de(8)).bitAnd(de(255))),a.z.assign(o.shiftRight(de(16)).bitAnd(de(255))),a}).setLayout({name:"mx_hash_vec3_1",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),tu=Zo([b4e,w4e]),S4e=me(([i])=>{let e=dt(i).toVar(),t=de().toVar(),n=de().toVar(),r=oe(Cr(e.x,t)).toVar(),s=oe(Cr(e.y,n)).toVar(),o=oe(bf(r)).toVar(),a=oe(bf(s)).toVar(),l=oe($se(So(Xi(t,n),r,s),So(Xi(t.add(de(1)),n),r.sub(1),s),So(Xi(t,n.add(de(1))),r,s.sub(1)),So(Xi(t.add(de(1)),n.add(de(1))),r.sub(1),s.sub(1)),o,a)).toVar();return Zse(l)}).setLayout({name:"mx_perlin_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"}]}),T4e=me(([i])=>{let e=pe(i).toVar(),t=de().toVar(),n=de().toVar(),r=de().toVar(),s=oe(Cr(e.x,t)).toVar(),o=oe(Cr(e.y,n)).toVar(),a=oe(Cr(e.z,r)).toVar(),l=oe(bf(s)).toVar(),c=oe(bf(o)).toVar(),u=oe(bf(a)).toVar(),f=oe(Yse(So(Xi(t,n,r),s,o,a),So(Xi(t.add(de(1)),n,r),s.sub(1),o,a),So(Xi(t,n.add(de(1)),r),s,o.sub(1),a),So(Xi(t.add(de(1)),n.add(de(1)),r),s.sub(1),o.sub(1),a),So(Xi(t,n,r.add(de(1))),s,o,a.sub(1)),So(Xi(t.add(de(1)),n,r.add(de(1))),s.sub(1),o,a.sub(1)),So(Xi(t,n.add(de(1)),r.add(de(1))),s,o.sub(1),a.sub(1)),So(Xi(t.add(de(1)),n.add(de(1)),r.add(de(1))),s.sub(1),o.sub(1),a.sub(1)),l,c,u)).toVar();return Kse(f)}).setLayout({name:"mx_perlin_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"}]}),yV=Zo([S4e,T4e]),E4e=me(([i])=>{let e=dt(i).toVar(),t=de().toVar(),n=de().toVar(),r=oe(Cr(e.x,t)).toVar(),s=oe(Cr(e.y,n)).toVar(),o=oe(bf(r)).toVar(),a=oe(bf(s)).toVar(),l=pe($se(eu(tu(t,n),r,s),eu(tu(t.add(de(1)),n),r.sub(1),s),eu(tu(t,n.add(de(1))),r,s.sub(1)),eu(tu(t.add(de(1)),n.add(de(1))),r.sub(1),s.sub(1)),o,a)).toVar();return Zse(l)}).setLayout({name:"mx_perlin_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),M4e=me(([i])=>{let e=pe(i).toVar(),t=de().toVar(),n=de().toVar(),r=de().toVar(),s=oe(Cr(e.x,t)).toVar(),o=oe(Cr(e.y,n)).toVar(),a=oe(Cr(e.z,r)).toVar(),l=oe(bf(s)).toVar(),c=oe(bf(o)).toVar(),u=oe(bf(a)).toVar(),f=pe(Yse(eu(tu(t,n,r),s,o,a),eu(tu(t.add(de(1)),n,r),s.sub(1),o,a),eu(tu(t,n.add(de(1)),r),s,o.sub(1),a),eu(tu(t.add(de(1)),n.add(de(1)),r),s.sub(1),o.sub(1),a),eu(tu(t,n,r.add(de(1))),s,o,a.sub(1)),eu(tu(t.add(de(1)),n,r.add(de(1))),s.sub(1),o,a.sub(1)),eu(tu(t,n.add(de(1)),r.add(de(1))),s,o.sub(1),a.sub(1)),eu(tu(t.add(de(1)),n.add(de(1)),r.add(de(1))),s.sub(1),o.sub(1),a.sub(1)),l,c,u)).toVar();return Kse(f)}).setLayout({name:"mx_perlin_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),OS=Zo([E4e,M4e]),C4e=me(([i])=>{let e=oe(i).toVar(),t=de(Ps(e)).toVar();return ya(Xi(t))}).setLayout({name:"mx_cell_noise_float_0",type:"float",inputs:[{name:"p",type:"float"}]}),R4e=me(([i])=>{let e=dt(i).toVar(),t=de(Ps(e.x)).toVar(),n=de(Ps(e.y)).toVar();return ya(Xi(t,n))}).setLayout({name:"mx_cell_noise_float_1",type:"float",inputs:[{name:"p",type:"vec2"}]}),I4e=me(([i])=>{let e=pe(i).toVar(),t=de(Ps(e.x)).toVar(),n=de(Ps(e.y)).toVar(),r=de(Ps(e.z)).toVar();return ya(Xi(t,n,r))}).setLayout({name:"mx_cell_noise_float_2",type:"float",inputs:[{name:"p",type:"vec3"}]}),P4e=me(([i])=>{let e=Ft(i).toVar(),t=de(Ps(e.x)).toVar(),n=de(Ps(e.y)).toVar(),r=de(Ps(e.z)).toVar(),s=de(Ps(e.w)).toVar();return ya(Xi(t,n,r,s))}).setLayout({name:"mx_cell_noise_float_3",type:"float",inputs:[{name:"p",type:"vec4"}]}),L4e=Zo([C4e,R4e,I4e,P4e]),D4e=me(([i])=>{let e=oe(i).toVar(),t=de(Ps(e)).toVar();return pe(ya(Xi(t,de(0))),ya(Xi(t,de(1))),ya(Xi(t,de(2))))}).setLayout({name:"mx_cell_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"float"}]}),N4e=me(([i])=>{let e=dt(i).toVar(),t=de(Ps(e.x)).toVar(),n=de(Ps(e.y)).toVar();return pe(ya(Xi(t,n,de(0))),ya(Xi(t,n,de(1))),ya(Xi(t,n,de(2))))}).setLayout({name:"mx_cell_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),F4e=me(([i])=>{let e=pe(i).toVar(),t=de(Ps(e.x)).toVar(),n=de(Ps(e.y)).toVar(),r=de(Ps(e.z)).toVar();return pe(ya(Xi(t,n,r,de(0))),ya(Xi(t,n,r,de(1))),ya(Xi(t,n,r,de(2))))}).setLayout({name:"mx_cell_noise_vec3_2",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),B4e=me(([i])=>{let e=Ft(i).toVar(),t=de(Ps(e.x)).toVar(),n=de(Ps(e.y)).toVar(),r=de(Ps(e.z)).toVar(),s=de(Ps(e.w)).toVar();return pe(ya(Xi(t,n,r,s,de(0))),ya(Xi(t,n,r,s,de(1))),ya(Xi(t,n,r,s,de(2))))}).setLayout({name:"mx_cell_noise_vec3_3",type:"vec3",inputs:[{name:"p",type:"vec4"}]}),UI=Zo([D4e,N4e,F4e,B4e]),k4=me(([i,e,t,n])=>{let r=oe(n).toVar(),s=oe(t).toVar(),o=de(e).toVar(),a=pe(i).toVar(),l=oe(0).toVar(),c=oe(1).toVar();return Oi(o,()=>{l.addAssign(c.mul(yV(a))),c.mulAssign(r),a.mulAssign(s)}),l}).setLayout({name:"mx_fractal_noise_float",type:"float",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),kI=me(([i,e,t,n])=>{let r=oe(n).toVar(),s=oe(t).toVar(),o=de(e).toVar(),a=pe(i).toVar(),l=pe(0).toVar(),c=oe(1).toVar();return Oi(o,()=>{l.addAssign(c.mul(OS(a))),c.mulAssign(r),a.mulAssign(s)}),l}).setLayout({name:"mx_fractal_noise_vec3",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),O4e=me(([i,e,t,n])=>{let r=oe(n).toVar(),s=oe(t).toVar(),o=de(e).toVar(),a=pe(i).toVar();return dt(k4(a,o,s,r),k4(a.add(pe(de(19),de(193),de(17))),o,s,r))}).setLayout({name:"mx_fractal_noise_vec2",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),U4e=me(([i,e,t,n])=>{let r=oe(n).toVar(),s=oe(t).toVar(),o=de(e).toVar(),a=pe(i).toVar(),l=pe(kI(a,o,s,r)).toVar(),c=oe(k4(a.add(pe(de(19),de(193),de(17))),o,s,r)).toVar();return Ft(l,c)}).setLayout({name:"mx_fractal_noise_vec4",type:"vec4",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),k4e=me(([i,e,t,n,r,s,o])=>{let a=de(o).toVar(),l=oe(s).toVar(),c=de(r).toVar(),u=de(n).toVar(),f=de(t).toVar(),d=de(e).toVar(),A=dt(i).toVar(),y=pe(UI(dt(d.add(u),f.add(c)))).toVar(),w=dt(y.x,y.y).toVar();w.subAssign(.5),w.mulAssign(l),w.addAssign(.5);let S=dt(dt(oe(d),oe(f)).add(w)).toVar(),T=dt(S.sub(A)).toVar();return $t(a.equal(de(2)),()=>fr(T.x).add(fr(T.y))),$t(a.equal(de(3)),()=>zr(fr(T.x),fr(T.y))),ou(T,T)}).setLayout({name:"mx_worley_distance_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"x",type:"int"},{name:"y",type:"int"},{name:"xoff",type:"int"},{name:"yoff",type:"int"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),z4e=me(([i,e,t,n,r,s,o,a,l])=>{let c=de(l).toVar(),u=oe(a).toVar(),f=de(o).toVar(),d=de(s).toVar(),A=de(r).toVar(),y=de(n).toVar(),w=de(t).toVar(),S=de(e).toVar(),T=pe(i).toVar(),R=pe(UI(pe(S.add(A),w.add(d),y.add(f)))).toVar();R.subAssign(.5),R.mulAssign(u),R.addAssign(.5);let P=pe(pe(oe(S),oe(w),oe(y)).add(R)).toVar(),I=pe(P.sub(T)).toVar();return $t(c.equal(de(2)),()=>fr(I.x).add(fr(I.y)).add(fr(I.z))),$t(c.equal(de(3)),()=>zr(fr(I.x),fr(I.y),fr(I.z))),ou(I,I)}).setLayout({name:"mx_worley_distance_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xoff",type:"int"},{name:"yoff",type:"int"},{name:"zoff",type:"int"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),Tx=Zo([k4e,z4e]),V4e=me(([i,e,t])=>{let n=de(t).toVar(),r=oe(e).toVar(),s=dt(i).toVar(),o=de().toVar(),a=de().toVar(),l=dt(Cr(s.x,o),Cr(s.y,a)).toVar(),c=oe(1e6).toVar();return Oi({start:-1,end:de(1),name:"x",condition:"<="},({x:u})=>{Oi({start:-1,end:de(1),name:"y",condition:"<="},({y:f})=>{let d=oe(Tx(l,u,f,o,a,r,n)).toVar();c.assign(Il(c,d))})}),$t(n.equal(de(0)),()=>{c.assign(Ja(c))}),c}).setLayout({name:"mx_worley_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),G4e=me(([i,e,t])=>{let n=de(t).toVar(),r=oe(e).toVar(),s=dt(i).toVar(),o=de().toVar(),a=de().toVar(),l=dt(Cr(s.x,o),Cr(s.y,a)).toVar(),c=dt(1e6,1e6).toVar();return Oi({start:-1,end:de(1),name:"x",condition:"<="},({x:u})=>{Oi({start:-1,end:de(1),name:"y",condition:"<="},({y:f})=>{let d=oe(Tx(l,u,f,o,a,r,n)).toVar();$t(d.lessThan(c.x),()=>{c.y.assign(c.x),c.x.assign(d)}).ElseIf(d.lessThan(c.y),()=>{c.y.assign(d)})})}),$t(n.equal(de(0)),()=>{c.assign(Ja(c))}),c}).setLayout({name:"mx_worley_noise_vec2_0",type:"vec2",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),q4e=me(([i,e,t])=>{let n=de(t).toVar(),r=oe(e).toVar(),s=dt(i).toVar(),o=de().toVar(),a=de().toVar(),l=dt(Cr(s.x,o),Cr(s.y,a)).toVar(),c=pe(1e6,1e6,1e6).toVar();return Oi({start:-1,end:de(1),name:"x",condition:"<="},({x:u})=>{Oi({start:-1,end:de(1),name:"y",condition:"<="},({y:f})=>{let d=oe(Tx(l,u,f,o,a,r,n)).toVar();$t(d.lessThan(c.x),()=>{c.z.assign(c.y),c.y.assign(c.x),c.x.assign(d)}).ElseIf(d.lessThan(c.y),()=>{c.z.assign(c.y),c.y.assign(d)}).ElseIf(d.lessThan(c.z),()=>{c.z.assign(d)})})}),$t(n.equal(de(0)),()=>{c.assign(Ja(c))}),c}).setLayout({name:"mx_worley_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),H4e=me(([i,e,t])=>{let n=de(t).toVar(),r=oe(e).toVar(),s=pe(i).toVar(),o=de().toVar(),a=de().toVar(),l=de().toVar(),c=pe(Cr(s.x,o),Cr(s.y,a),Cr(s.z,l)).toVar(),u=oe(1e6).toVar();return Oi({start:-1,end:de(1),name:"x",condition:"<="},({x:f})=>{Oi({start:-1,end:de(1),name:"y",condition:"<="},({y:d})=>{Oi({start:-1,end:de(1),name:"z",condition:"<="},({z:A})=>{let y=oe(Tx(c,f,d,A,o,a,l,r,n)).toVar();u.assign(Il(u,y))})})}),$t(n.equal(de(0)),()=>{u.assign(Ja(u))}),u}).setLayout({name:"mx_worley_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),W4e=Zo([V4e,H4e]),j4e=me(([i,e,t])=>{let n=de(t).toVar(),r=oe(e).toVar(),s=pe(i).toVar(),o=de().toVar(),a=de().toVar(),l=de().toVar(),c=pe(Cr(s.x,o),Cr(s.y,a),Cr(s.z,l)).toVar(),u=dt(1e6,1e6).toVar();return Oi({start:-1,end:de(1),name:"x",condition:"<="},({x:f})=>{Oi({start:-1,end:de(1),name:"y",condition:"<="},({y:d})=>{Oi({start:-1,end:de(1),name:"z",condition:"<="},({z:A})=>{let y=oe(Tx(c,f,d,A,o,a,l,r,n)).toVar();$t(y.lessThan(u.x),()=>{u.y.assign(u.x),u.x.assign(y)}).ElseIf(y.lessThan(u.y),()=>{u.y.assign(y)})})})}),$t(n.equal(de(0)),()=>{u.assign(Ja(u))}),u}).setLayout({name:"mx_worley_noise_vec2_1",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),X4e=Zo([G4e,j4e]),$4e=me(([i,e,t])=>{let n=de(t).toVar(),r=oe(e).toVar(),s=pe(i).toVar(),o=de().toVar(),a=de().toVar(),l=de().toVar(),c=pe(Cr(s.x,o),Cr(s.y,a),Cr(s.z,l)).toVar(),u=pe(1e6,1e6,1e6).toVar();return Oi({start:-1,end:de(1),name:"x",condition:"<="},({x:f})=>{Oi({start:-1,end:de(1),name:"y",condition:"<="},({y:d})=>{Oi({start:-1,end:de(1),name:"z",condition:"<="},({z:A})=>{let y=oe(Tx(c,f,d,A,o,a,l,r,n)).toVar();$t(y.lessThan(u.x),()=>{u.z.assign(u.y),u.y.assign(u.x),u.x.assign(y)}).ElseIf(y.lessThan(u.y),()=>{u.z.assign(u.y),u.y.assign(y)}).ElseIf(y.lessThan(u.z),()=>{u.z.assign(y)})})})}),$t(n.equal(de(0)),()=>{u.assign(Ja(u))}),u}).setLayout({name:"mx_worley_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),bV=Zo([q4e,$4e]),Y4e=me(([i,e,t,n,r,s,o,a,l,c,u])=>{let f=de(i).toVar(),d=dt(e).toVar(),A=dt(t).toVar(),y=dt(n).toVar(),w=oe(r).toVar(),S=oe(s).toVar(),T=oe(o).toVar(),R=fc(a).toVar(),P=de(l).toVar(),I=oe(c).toVar(),F=oe(u).toVar(),D=d.mul(A).add(y),L=oe(0).toVar();return $t(f.equal(de(0)),()=>{L.assign(OS(D))}),$t(f.equal(de(1)),()=>{L.assign(UI(D))}),$t(f.equal(de(2)),()=>{L.assign(bV(D,w,de(0)))}),$t(f.equal(de(3)),()=>{L.assign(kI(pe(D,0),P,I,F))}),L.assign(L.mul(T.sub(S)).add(S)),$t(R,()=>{L.assign(Yu(L,S,T))}),L}).setLayout({name:"mx_unifiednoise2d",type:"float",inputs:[{name:"noiseType",type:"int"},{name:"texcoord",type:"vec2"},{name:"freq",type:"vec2"},{name:"offset",type:"vec2"},{name:"jitter",type:"float"},{name:"outmin",type:"float"},{name:"outmax",type:"float"},{name:"clampoutput",type:"bool"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),Z4e=me(([i,e,t,n,r,s,o,a,l,c,u])=>{let f=de(i).toVar(),d=pe(e).toVar(),A=pe(t).toVar(),y=pe(n).toVar(),w=oe(r).toVar(),S=oe(s).toVar(),T=oe(o).toVar(),R=fc(a).toVar(),P=de(l).toVar(),I=oe(c).toVar(),F=oe(u).toVar(),D=d.mul(A).add(y),L=oe(0).toVar();return $t(f.equal(de(0)),()=>{L.assign(OS(D))}),$t(f.equal(de(1)),()=>{L.assign(UI(D))}),$t(f.equal(de(2)),()=>{L.assign(bV(D,w,de(0)))}),$t(f.equal(de(3)),()=>{L.assign(kI(D,P,I,F))}),L.assign(L.mul(T.sub(S)).add(S)),$t(R,()=>{L.assign(Yu(L,S,T))}),L}).setLayout({name:"mx_unifiednoise3d",type:"float",inputs:[{name:"noiseType",type:"int"},{name:"position",type:"vec3"},{name:"freq",type:"vec3"},{name:"offset",type:"vec3"},{name:"jitter",type:"float"},{name:"outmin",type:"float"},{name:"outmax",type:"float"},{name:"clampoutput",type:"bool"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),K4e=me(([i])=>{let e=i.y,t=i.z,n=pe().toVar();return $t(e.lessThan(1e-4),()=>{n.assign(pe(t,t,t))}).Else(()=>{let r=i.x;r=r.sub(_f(r)).mul(6).toVar();let s=de(xz(r)),o=r.sub(oe(s)),a=t.mul(e.oneMinus()),l=t.mul(e.mul(o).oneMinus()),c=t.mul(e.mul(o.oneMinus()).oneMinus());$t(s.equal(de(0)),()=>{n.assign(pe(t,c,a))}).ElseIf(s.equal(de(1)),()=>{n.assign(pe(l,t,a))}).ElseIf(s.equal(de(2)),()=>{n.assign(pe(a,t,c))}).ElseIf(s.equal(de(3)),()=>{n.assign(pe(a,l,t))}).ElseIf(s.equal(de(4)),()=>{n.assign(pe(c,a,t))}).Else(()=>{n.assign(pe(t,a,l))})}),n}).setLayout({name:"mx_hsvtorgb",type:"vec3",inputs:[{name:"hsv",type:"vec3"}]}),Q4e=me(([i])=>{let e=pe(i).toVar(),t=oe(e.x).toVar(),n=oe(e.y).toVar(),r=oe(e.z).toVar(),s=oe(Il(t,Il(n,r))).toVar(),o=oe(zr(t,zr(n,r))).toVar(),a=oe(o.sub(s)).toVar(),l=oe().toVar(),c=oe().toVar(),u=oe().toVar();return u.assign(o),$t(o.greaterThan(0),()=>{c.assign(a.div(o))}).Else(()=>{c.assign(0)}),$t(c.lessThanEqual(0),()=>{l.assign(0)}).Else(()=>{$t(t.greaterThanEqual(o),()=>{l.assign(n.sub(r).div(a))}).ElseIf(n.greaterThanEqual(o),()=>{l.assign(Ls(2,r.sub(t).div(a)))}).Else(()=>{l.assign(Ls(4,t.sub(n).div(a)))}),l.mulAssign(1/6),$t(l.lessThan(0),()=>{l.addAssign(1)})}),pe(l,c,u)}).setLayout({name:"mx_rgbtohsv",type:"vec3",inputs:[{name:"c",type:"vec3"}]}),J4e=me(([i])=>{let e=pe(i).toVar(),t=rz(hz(e,pe(.04045))).toVar(),n=pe(e.div(12.92)).toVar(),r=pe(nu(zr(e.add(pe(.055)),pe(0)).div(1.055),pe(2.4))).toVar();return Qn(n,r,t)}).setLayout({name:"mx_srgb_texture_to_lin_rec709",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),Jse=(i,e)=>{i=oe(i),e=oe(e);let t=dt(e.dFdx(),e.dFdy()).length().mul(.7071067811865476);return pc(i.sub(t),i.add(t),e)},eoe=(i,e,t,n)=>Qn(i,e,t[n].clamp()),eIe=(i,e,t=Ui())=>eoe(i,e,t,"x"),tIe=(i,e,t=Ui())=>eoe(i,e,t,"y"),nIe=(i,e,t,n,r=Ui())=>{let s=r.x.clamp(),o=r.y.clamp(),a=Qn(i,e,s),l=Qn(t,n,s);return Qn(a,l,o)},toe=(i,e,t,n,r)=>Qn(i,e,Jse(t,n[r])),iIe=(i,e,t,n=Ui())=>toe(i,e,t,n,"x"),rIe=(i,e,t,n=Ui())=>toe(i,e,t,n,"y"),sIe=(i=1,e=0,t=Ui())=>t.mul(i).add(e),oIe=(i,e=1)=>(i=oe(i),i.abs().pow(e).mul(i.sign())),aIe=(i,e=1,t=.5)=>oe(i).sub(t).mul(e).add(t),lIe=(i=Ui(),e=1,t=0)=>yV(i.convert("vec2|vec3")).mul(e).add(t),cIe=(i=Ui(),e=1,t=0)=>OS(i.convert("vec2|vec3")).mul(e).add(t),uIe=(i=Ui(),e=1,t=0)=>(i=i.convert("vec2|vec3"),Ft(OS(i),yV(i.add(dt(19,73)))).mul(e).add(t)),hIe=(i,e=Ui(),t=dt(1,1),n=dt(0,0),r=1,s=0,o=1,a=!1,l=1,c=2,u=.5)=>Y4e(i,e.convert("vec2|vec3"),t,n,r,s,o,a,l,c,u),fIe=(i,e=Ui(),t=dt(1,1),n=dt(0,0),r=1,s=0,o=1,a=!1,l=1,c=2,u=.5)=>Z4e(i,e.convert("vec2|vec3"),t,n,r,s,o,a,l,c,u),dIe=(i=Ui(),e=1)=>W4e(i.convert("vec2|vec3"),e,de(1)),pIe=(i=Ui(),e=1)=>X4e(i.convert("vec2|vec3"),e,de(1)),mIe=(i=Ui(),e=1)=>bV(i.convert("vec2|vec3"),e,de(1)),AIe=(i=Ui())=>L4e(i.convert("vec2|vec3")),gIe=(i=Ui(),e=3,t=2,n=.5,r=1)=>k4(i,de(e),t,n).mul(r),vIe=(i=Ui(),e=3,t=2,n=.5,r=1)=>O4e(i,de(e),t,n).mul(r),_Ie=(i=Ui(),e=3,t=2,n=.5,r=1)=>kI(i,de(e),t,n).mul(r),xIe=(i=Ui(),e=3,t=2,n=.5,r=1)=>U4e(i,de(e),t,n).mul(r),yIe=(i,e=oe(0))=>Ls(i,e),bIe=(i,e=oe(0))=>ai(i,e),wIe=(i,e=oe(1))=>Tn(i,e),SIe=(i,e=oe(1))=>dc(i,e),TIe=(i,e=oe(1))=>vI(i,e),EIe=(i,e=oe(1))=>nu(i,e),MIe=(i=oe(0),e=oe(1))=>mz(i,e),CIe=()=>Sx,RIe=()=>vse,IIe=(i,e=oe(1))=>ai(e,i),PIe=(i,e,t,n)=>i.greaterThan(e).mix(t,n),LIe=(i,e,t,n)=>i.greaterThanEqual(e).mix(t,n),DIe=(i,e,t,n)=>i.equal(e).mix(t,n),NIe=(i,e=null)=>{if(typeof e=="string"){let t={x:0,r:0,y:1,g:1,z:2,b:2,w:3,a:3},n=e.replace(/^out/,"").toLowerCase();if(t[n]!==void 0)return i.element(t[n])}if(typeof e=="number")return i.element(e);if(typeof e=="string"&&e.length===1){let t={x:0,r:0,y:1,g:1,z:2,b:2,w:3,a:3};if(t[e]!==void 0)return i.element(t[e])}return i},FIe=(i,e=dt(.5,.5),t=dt(1,1),n=oe(0),r=dt(0,0))=>{let s=i;if(e&&(s=s.sub(e)),t&&(s=s.mul(t)),n){let o=n.mul(Math.PI/180),a=o.cos(),l=o.sin();s=dt(s.x.mul(a).sub(s.y.mul(l)),s.x.mul(l).add(s.y.mul(a)))}return e&&(s=s.add(e)),r&&(s=s.add(r)),s},BIe=(i,e)=>{i=dt(i),e=oe(e);let t=e.mul(Math.PI/180);return NS(i,t)},OIe=(i,e,t)=>{i=pe(i),e=oe(e),t=pe(t);let n=e.mul(Math.PI/180),r=t.normalize(),s=n.cos(),o=n.sin(),a=oe(1).sub(s);return i.mul(s).add(r.cross(i).mul(o)).add(r.mul(r.dot(i)).mul(a))},UIe=(i,e)=>(i=pe(i),e=oe(e),jz(i,e)),kIe=me(([i,e,t])=>{let n=xa(i).toVar(),r=ai(oe(.5).mul(e.sub(t)),yf).div(n).toVar(),s=ai(oe(-.5).mul(e.sub(t)),yf).div(n).toVar(),o=pe().toVar();o.x=n.x.greaterThan(oe(0)).select(r.x,s.x),o.y=n.y.greaterThan(oe(0)).select(r.y,s.y),o.z=n.z.greaterThan(oe(0)).select(r.z,s.z);let a=Il(o.x,o.y,o.z).toVar();return yf.add(n.mul(a)).toVar().sub(t)}),noe=me(([i,e])=>{let t=i.x,n=i.y,r=i.z,s=e.element(0).mul(.886227);return s=s.add(e.element(1).mul(2*.511664).mul(n)),s=s.add(e.element(2).mul(2*.511664).mul(r)),s=s.add(e.element(3).mul(2*.511664).mul(t)),s=s.add(e.element(4).mul(2*.429043).mul(t).mul(n)),s=s.add(e.element(5).mul(2*.429043).mul(n).mul(r)),s=s.add(e.element(6).mul(r.mul(r).mul(.743125).sub(.247708))),s=s.add(e.element(7).mul(2*.429043).mul(t).mul(r)),s=s.add(e.element(8).mul(.429043).mul(Tn(t,t).sub(Tn(n,n)))),s}),V=Object.freeze({__proto__:null,BRDF_GGX:lV,BRDF_Lambert:s1,BasicPointShadowFilter:Hse,BasicShadowFilter:Bse,Break:Vre,Const:fie,Continue:HEe,DFGLUT:gS,D_GGX:ese,Discard:Mie,EPSILON:_I,F_Schlick:gx,Fn:me,HALF_PI:UTe,INFINITY:FTe,If:$t,Loop:Oi,NodeAccess:$o,NodeShaderStage:ex,NodeType:pTe,NodeUpdateType:yn,OnBeforeFrameUpdate:UEe,OnBeforeMaterialUpdate:OEe,OnBeforeObjectUpdate:BEe,OnFrameUpdate:Dre,OnMaterialUpdate:FEe,OnObjectUpdate:DS,PCFShadowFilter:Ose,PCFSoftShadowFilter:Use,PI:c4,PI2:BTe,PointShadowFilter:Wse,Return:YTe,Schlick_to_F0:v7,ShaderNode:ix,Stack:pI,Switch:RTe,TBNViewMatrix:Wg,TWO_PI:OTe,VSMShadowFilter:kse,V_GGX_SmithCorrelated:Jre,Var:hie,VarIntent:die,abs:fr,acesFilmicToneMapping:Cse,acos:pz,acosh:Vne,add:Ls,addMethodChaining:Ue,addNodeElement:ZTe,agxToneMapping:Rse,all:Pne,alphaT:r4,ambientOcclusion:xU,and:gne,anisotropy:am,anisotropyB:$g,anisotropyT:iS,any:Lne,append:PTe,array:cne,asin:kne,asinh:zne,assign:une,atan:mz,atanh:Gne,atomicAdd:nRe,atomicAnd:oRe,atomicFunc:If,atomicLoad:eRe,atomicMax:rRe,atomicMin:sRe,atomicOr:aRe,atomicStore:tRe,atomicSub:iRe,atomicXor:lRe,attenuationColor:cz,attenuationDistance:lz,attribute:hc,attributeArray:aCe,backgroundBlurriness:yse,backgroundIntensity:ak,backgroundRotation:bse,batch:Ore,batchColor:eV,bentNormalView:ire,billboarding:YMe,bitAnd:yne,bitNot:bne,bitOr:wne,bitXor:Sne,bitangentGeometry:MEe,bitangentLocal:CEe,bitangentView:tre,bitangentWorld:REe,bitcast:Ase,blendBurn:gCe,blendColor:yCe,blendDodge:vCe,blendOverlay:xCe,blendScreen:_Ce,blur:ose,bool:fc,buffer:bx,bufferAttribute:Iz,builtin:ip,builtinAOContext:cie,builtinShadowContext:lie,bumpMap:jz,bvec2:ine,bvec3:rz,bvec4:rne,bypass:Tie,cache:Sie,call:hne,cameraFar:um,cameraIndex:wm,cameraNear:cm,cameraNormalMatrix:rEe,cameraPosition:Die,cameraProjectionMatrix:Qa,cameraProjectionMatrixInverse:Lie,cameraViewMatrix:Sm,cameraViewport:sEe,cameraWorldMatrix:LS,cbrt:nie,cdl:ECe,ceil:yI,checker:i4e,cineonToneMapping:Mse,clamp:Yu,clearcoat:t4,clearcoatNormalView:hm,clearcoatRoughness:sx,clipSpace:Bie,code:FI,color:nne,colorSpaceToWorking:wI,colorToDirection:LEe,compute:wie,computeKernel:Lz,computeSkinning:qEe,context:np,convert:one,convertColorSpace:GTe,convertToTexture:iCe,cos:Hu,cosh:Bne,countLeadingZeros:EMe,countOneBits:MMe,countTrailingZeros:TMe,cross:Jd,cubeTexture:Ka,cubeTextureBase:Hz,dFdx:vz,dFdy:_z,dashSize:Yg,debug:Rie,decrement:Ine,decrementBefore:Cne,defaultBuildStages:jR,defaultShaderStages:Kte,defined:hx,degrees:Nne,deltaTime:VMe,densityFogFactor:Dse,depth:sV,depthPass:PCe,determinant:Xne,difference:Kne,diffuseColor:Bi,diffuseContribution:Vg,directPointLight:Xse,directionToColor:PEe,directionToFaceDirection:vEe,dispersion:uz,disposeShadowMaterial:Vse,distance:Zne,div:dc,dot:ou,drawIndex:bie,dynamicBufferAttribute:WTe,element:sne,emissive:_U,equal:fne,equirectDirection:f7,equirectUV:oV,exp:fz,exp2:fx,exponentialHeightFogFactor:GCe,expression:uc,faceDirection:Vz,faceForward:Ez,faceforward:kTe,float:oe,floatBitsToInt:bMe,floatBitsToUint:gse,floor:_f,fog:pk,fract:$u,frameGroup:DTe,frameId:vse,frontFacing:Oie,fwidth:yz,gain:RMe,gapSize:fS,getConstNodeType:tne,getCurrentStack:tz,getDirection:rse,getDistanceAttenuation:xV,getGeometryRoughness:Qre,getNormalFromDepth:sCe,getParallaxCorrectNormal:kIe,getRoughness:aV,getScreenPosition:rCe,getShIrradianceAt:noe,getShadowMaterial:zse,getShadowRenderObjectFunction:Gse,getTextureIndex:pse,getViewPosition:nx,ggxConvolution:ase,globalId:jCe,glsl:kCe,glslFn:zCe,grayscale:bCe,greaterThan:hz,greaterThanEqual:Ane,hash:CMe,highpModelNormalViewMatrix:zU,highpModelViewMatrix:kU,hue:TCe,increment:Rne,incrementBefore:Mne,inspector:Iie,instance:Fre,instanceColor:Jz,instanceIndex:Xu,instancedArray:lCe,instancedBufferAttribute:TI,instancedDynamicBufferAttribute:Pz,instancedMesh:Bre,int:de,intBitsToFloat:wMe,interleavedGradientNoise:hV,inverse:$ne,inverseSqrt:dz,inversesqrt:zTe,invocationLocalIndex:$Te,invocationSubgroupIndex:XTe,ior:rS,iridescence:AI,iridescenceIOR:n4,iridescenceThickness:i4,isolate:lx,ivec2:kr,ivec3:iz,ivec4:sz,js:OCe,label:uie,length:xf,lengthSq:Sz,lessThan:pne,lessThanEqual:mne,lightPosition:AV,lightProjectionUV:Nse,lightShadowMatrix:OI,lightTargetDirection:vV,lightTargetPosition:Fse,lightViewPosition:gV,lightingContext:qre,lights:kRe,linearDepth:v4,linearToneMapping:Tse,localId:XCe,log:xI,log2:vf,logarithmicDepthToViewZ:YEe,luminance:dV,mat2:mI,mat3:To,mat4:mm,matcapUV:lse,materialAO:Pre,materialAlphaTest:sre,materialAnisotropy:xre,materialAnisotropyVector:tx,materialAttenuationColor:Cre,materialAttenuationDistance:Mre,materialClearcoat:pre,materialClearcoatNormal:Are,materialClearcoatRoughness:mre,materialColor:ore,materialDispersion:Ire,materialEmissive:lre,materialEnvIntensity:$R,materialEnvRotation:p4,materialIOR:Ere,materialIridescence:yre,materialIridescenceIOR:bre,materialIridescenceThickness:wre,materialLightMap:Qz,materialLineDashOffset:Kz,materialLineDashSize:Yz,materialLineGapSize:Zz,materialLineScale:$z,materialLineWidth:m4,materialMetalness:fre,materialNormal:dre,materialOpacity:Xz,materialPointSize:Rre,materialReference:Yd,materialReflectivity:YR,materialRefractionRatio:zie,materialRotation:gre,materialRoughness:hre,materialSheen:vre,materialSheenRoughness:_re,materialShininess:are,materialSpecular:cre,materialSpecularColor:ure,materialSpecularIntensity:KU,materialSpecularStrength:sS,materialThickness:Tre,materialTransmission:Sre,max:zr,maxMipLevel:Bz,mediumpModelViewMatrix:Fie,metalness:Kd,min:Il,mix:Qn,mixElement:rie,mod:vI,modelDirection:fEe,modelNormalMatrix:Nie,modelPosition:dEe,modelRadius:AEe,modelScale:pEe,modelViewMatrix:Sf,modelViewPosition:mEe,modelViewProjection:Lre,modelWorldMatrix:iu,modelWorldMatrixInverse:gEe,morphReference:Gre,mrt:mse,mul:Tn,mx_aastep:Jse,mx_add:yIe,mx_atan2:MIe,mx_cell_noise_float:AIe,mx_contrast:aIe,mx_divide:SIe,mx_fractal_noise_float:gIe,mx_fractal_noise_vec2:vIe,mx_fractal_noise_vec3:_Ie,mx_fractal_noise_vec4:xIe,mx_frame:RIe,mx_heighttonormal:UIe,mx_hsvtorgb:K4e,mx_ifequal:DIe,mx_ifgreater:PIe,mx_ifgreatereq:LIe,mx_invert:IIe,mx_modulo:TIe,mx_multiply:wIe,mx_noise_float:lIe,mx_noise_vec3:cIe,mx_noise_vec4:uIe,mx_place2d:FIe,mx_power:EIe,mx_ramp4:nIe,mx_ramplr:eIe,mx_ramptb:tIe,mx_rgbtohsv:Q4e,mx_rotate2d:BIe,mx_rotate3d:OIe,mx_safepower:oIe,mx_separate:NIe,mx_splitlr:iIe,mx_splittb:rIe,mx_srgb_texture_to_lin_rec709:J4e,mx_subtract:bIe,mx_timer:CIe,mx_transform_uv:sIe,mx_unifiednoise2d:hIe,mx_unifiednoise3d:fIe,mx_worley_noise_float:dIe,mx_worley_noise_vec2:pIe,mx_worley_noise_vec3:mIe,negate:gz,negateOnBackSide:d1,neutralToneMapping:Ise,nodeArray:Xg,nodeImmutable:xt,nodeObject:Ht,nodeObjectIntent:Jw,nodeObjects:dI,nodeProxy:$n,nodeProxyConstructor:ez,nodeProxyIntent:ct,normalFlat:Uie,normalGeometry:EI,normalLocal:ba,normalMap:YU,normalView:hi,normalViewGeometry:dx,normalWorld:Tm,normalWorldGeometry:kie,normalize:xa,not:_ne,notEqual:dne,numWorkgroups:HCe,objectDirection:oEe,objectGroup:lne,objectPosition:lEe,objectRadius:hEe,objectScale:cEe,objectViewPosition:uEe,objectWorldMatrix:aEe,oneMinus:qne,or:vne,orthographicDepthToViewZ:Wre,oscSawtooth:WMe,oscSine:GMe,oscSquare:qMe,oscTriangle:HMe,output:ox,outputStruct:_Me,overloadingFn:Zo,overrideNode:fse,overrideNodes:dse,packHalf2x16:NMe,packNormalToRGB:Wz,packSnorm2x16:LMe,packUnorm2x16:DMe,parabola:Q7,parallaxDirection:nre,parallaxUV:IEe,parameter:AMe,pass:RCe,passTexture:ICe,pcurve:IMe,perspectiveDepthToViewZ:II,pmremTexture:uV,pointShadow:jse,pointUV:cCe,pointWidth:LTe,positionGeometry:ga,positionLocal:Mr,positionPrevious:r1,positionView:xs,positionViewDirection:er,positionWorld:yf,positionWorldDirection:zz,posterize:MCe,pow:nu,pow2:bz,pow3:Qne,pow4:wz,premultiplyAlpha:Nz,property:tp,quadBroadcast:DRe,quadSwapDiagonal:MRe,quadSwapX:TRe,quadSwapY:ERe,radians:Dne,rand:iie,range:qCe,rangeFogFactor:Lse,reciprocal:Wne,reference:mr,referenceBuffer:jie,reflect:Yne,reflectVector:qie,reflectView:Vie,reflector:eCe,refract:Tz,refractVector:Hie,refractView:Gie,reinhardToneMapping:Ese,remap:Dz,remapClamp:Eie,renderGroup:Jt,renderOutput:Fz,rendererReference:vie,replaceDefaultUV:jMe,rotate:NS,rotateUV:XMe,roughness:Af,round:Hne,rtt:xse,sRGBTransferEOTF:mie,sRGBTransferOETF:Aie,sample:oCe,sampler:eEe,samplerComparison:tEe,saturate:bI,saturation:wCe,screenCoordinate:f1,screenDPR:Uz,screenSize:i1,screenUV:ju,select:_a,setCurrentStack:hS,setName:Mz,shaderStages:XR,shadow:qse,shadowPositionWorld:_V,shapeCircle:r4e,sharedUniformGroup:gI,sheen:lc,sheenRoughness:lm,shiftLeft:Tne,shiftRight:Ene,shininess:s4,sign:Az,sin:Za,sinc:PMe,sinh:Fne,skinning:zre,smoothstep:pc,smoothstepElement:sie,specularColor:vm,specularColorBlended:qg,specularF90:Hg,spherizeUV:$Me,split:ITe,spritesheetUV:KMe,sqrt:Ja,stack:KR,step:t1,stepElement:oie,storage:Am,storageBarrier:ZCe,storageTexture:wse,storageTexture3D:hCe,struct:vMe,sub:ai,subBuild:Zg,subgroupAdd:hRe,subgroupAll:bRe,subgroupAnd:gRe,subgroupAny:wRe,subgroupBallot:uRe,subgroupBroadcast:CRe,subgroupBroadcastFirst:SRe,subgroupElect:cRe,subgroupExclusiveAdd:dRe,subgroupExclusiveMul:ARe,subgroupInclusiveAdd:fRe,subgroupInclusiveMul:mRe,subgroupIndex:jTe,subgroupMax:yRe,subgroupMin:xRe,subgroupMul:pRe,subgroupOr:vRe,subgroupShuffle:RRe,subgroupShuffleDown:LRe,subgroupShuffleUp:PRe,subgroupShuffleXor:IRe,subgroupSize:$Ce,subgroupXor:_Re,tan:One,tangentGeometry:MI,tangentLocal:_m,tangentView:CI,tangentWorld:ere,tanh:Une,texture:fi,texture3D:fV,texture3DLevel:pCe,texture3DLoad:dCe,textureBarrier:KCe,textureBicubic:b3e,textureBicubicLevel:cV,textureCubeUV:sse,textureLevel:JTe,textureLoad:_s,textureSize:n1,textureStore:uCe,thickness:az,time:Sx,toneMapping:_ie,toneMappingExposure:xie,toonOutlinePass:LCe,transformDirection:Jne,transformNormal:Gz,transformNormalByInverseViewMatrix:tie,transformNormalByViewMatrix:eie,transformNormalToView:qz,transformedClearcoatNormalView:yEe,transformedNormalView:_Ee,transformedNormalWorld:xEe,transmission:o4,transpose:jne,triNoise3D:kMe,triplanarTexture:QMe,triplanarTextures:_se,trunc:xz,uint:rt,uintBitsToFloat:SMe,uniform:Xt,uniformArray:Xo,uniformCubeTexture:bEe,uniformFlow:aie,uniformGroup:ane,uniformTexture:QTe,unpackHalf2x16:OMe,unpackNormal:XU,unpackRGBToNormal:rre,unpackSnorm2x16:FMe,unpackUnorm2x16:BMe,unpremultiplyAlpha:Cie,userData:mCe,uv:Ui,uvec2:nz,uvec3:u1,uvec4:oz,varying:bm,varyingProperty:h1,vec2:dt,vec3:pe,vec4:Ft,vectorComponents:c1,velocity:ACe,vertexColor:$re,vertexIndex:yie,vertexStage:pie,vibrance:SCe,viewZToLogarithmicDepth:PI,viewZToOrthographicDepth:Kg,viewZToPerspectiveDepth:rV,viewZToReversedOrthographicDepth:$Ee,viewZToReversedPerspectiveDepth:jre,viewport:ux,viewportCoordinate:Pie,viewportDepthTexture:iV,viewportLinearDepth:ZEe,viewportMipTexture:nV,viewportOpaqueMipTexture:Hre,viewportResolution:iEe,viewportSafeUV:ZMe,viewportSharedTexture:CCe,viewportSize:kz,viewportTexture:jEe,viewportUV:nEe,vogelDiskSample:Wu,wgsl:UCe,wgslFn:VCe,workgroupArray:QCe,workgroupBarrier:YCe,workgroupId:WCe,workingToColorSpace:gie,xor:xne}),Gu=new _S,wk=class extends Mf{constructor(e,t){super(),this.renderer=e,this.nodes=t}update(e,t,n){let r=this.renderer,s=this.nodes.getBackgroundNode(e)||e.background,o=!1;if(s===null)r._clearColor.getRGB(Gu),Gu.a=r._clearColor.a;else if(s.isColor===!0)s.getRGB(Gu),Gu.a=1,o=!0;else if(s.isNode===!0){let l=this.get(e),c=s;Gu.copy(r._clearColor);let u=l.backgroundMesh;if(u===void 0){let P=function(){s.removeEventListener("dispose",P),u.material.dispose(),u.geometry.dispose()},d=Ft(c).mul(ak).context({getUV:()=>bse.mul(kie),getTextureLevel:()=>yse}),A=Qa.element(3).element(3).equal(1),y=dc(1,Qa.element(1).element(1)).mul(3),w=A.select(Mr.mul(y),Mr),S=Sf.mul(Ft(w,0)),T=Qa.mul(Ft(S.xyz,1));T=T.setZ(T.w);let R=new Ir;R.name="Background.material",R.side=mi,R.depthTest=!1,R.depthWrite=!1,R.allowOverride=!1,R.fog=!1,R.lights=!1,R.vertexNode=T,R.colorNode=d,l.backgroundMeshNode=d,l.backgroundMesh=u=new Hn(new za(1,32,32),R),u.frustumCulled=!1,u.name="Background.mesh",s.addEventListener("dispose",P)}let f=c.getCacheKey();l.backgroundCacheKey!==f&&(l.backgroundMeshNode.node=Ft(c).mul(ak),l.backgroundMeshNode.needsUpdate=!0,u.material.needsUpdate=!0,l.backgroundCacheKey=f),t.unshift(u,u.geometry,u.material,0,0,null,null)}else ze("Renderer: Unsupported background configuration.",s);let a=r.xr.getEnvironmentBlendMode();if(a==="additive"?Gu.set(0,0,0,1):a==="alpha-blend"&&Gu.set(0,0,0,0),r.autoClear===!0||o===!0){let l=n.clearColorValue;l.r=Gu.r,l.g=Gu.g,l.b=Gu.b,l.a=Gu.a,(r.backend.isWebGLBackend===!0||r.alpha===!0)&&(l.r*=l.a,l.g*=l.a,l.b*=l.a),n.depthClearValue=r.getClearDepth(),n.stencilClearValue=r.getClearStencil(),n.clearColor=r.autoClearColor===!0,n.clearDepth=r.autoClearDepth===!0,n.clearStencil=r.autoClearStencil===!0}else n.clearColor=!1,n.clearDepth=!1,n.clearStencil=!1}},zIe=0,SS=class{constructor(e="",t=[]){this.name=e,this.bindings=t,this.id=zIe++}},Sk=class{constructor(e,t,n,r,s,o,a,l,c,u,f=[]){this.vertexShader=e,this.fragmentShader=t,this.computeShader=n,this.transforms=f,this.nodeAttributes=r,this.bindings=s,this.updateNodes=o,this.updateBeforeNodes=a,this.updateAfterNodes=l,this.observer=c,this.hardwareClipping=u,this.usedTimes=0}createBindings(){let e=[];for(let t of this.bindings)if(t.bindings[0].groupNode.shared!==!0){let r=new SS(t.name,[]);e.push(r);for(let s of t.bindings)r.bindings.push(s.clone())}else e.push(t);return e}},z4=class{constructor(e,t,n=null){this.isNodeAttribute=!0,this.name=e,this.type=t,this.node=n}},Tk=class{constructor(e,t,n){this.isNodeUniform=!0,this.name=e,this.type=t,this.node=n}get value(){return this.node.value}set value(e){this.node.value=e}get id(){return this.node.id}get groupNode(){return this.node.groupNode}},V4=class{constructor(e,t,n=!1,r=null){this.isNodeVar=!0,this.name=e,this.type=t,this.readOnly=n,this.count=r}},Ek=class extends V4{constructor(e,t,n=null,r=null){super(e,t),this.needsInterpolation=!1,this.isNodeVarying=!0,this.interpolationType=n,this.interpolationSampling=r}},Mk=class{constructor(e,t,n=""){this.name=e,this.type=t,this.code=n,Object.defineProperty(this,"isNodeCode",{value:!0})}},VIe=0,cS=class{constructor(e=null){this.id=VIe++,this.nodesData=new WeakMap,this.parent=e}getData(e){let t=this.nodesData.get(e);return t===void 0&&this.parent!==null&&(t=this.parent.getData(e)),t}setData(e,t){this.nodesData.set(e,t)}},Ck=class{constructor(e,t){this.name=e,this.members=t,this.output=!1}},Rf=class{constructor(e,t){this.name=e,this.value=t,this.boundary=0,this.itemSize=0,this.offset=0,this.index=-1}setValue(e){this.value=e}getValue(){return this.value}},Rk=class extends Rf{constructor(e,t=0){super(e,t),this.isNumberUniform=!0,this.boundary=4,this.itemSize=1}},Ik=class extends Rf{constructor(e,t=new Oe){super(e,t),this.isVector2Uniform=!0,this.boundary=8,this.itemSize=2}},Pk=class extends Rf{constructor(e,t=new re){super(e,t),this.isVector3Uniform=!0,this.boundary=16,this.itemSize=3}},Lk=class extends Rf{constructor(e,t=new xn){super(e,t),this.isVector4Uniform=!0,this.boundary=16,this.itemSize=4}},Dk=class extends Rf{constructor(e,t=new zt){super(e,t),this.isColorUniform=!0,this.boundary=16,this.itemSize=3}},Nk=class extends Rf{constructor(e,t=new c_){super(e,t),this.isMatrix2Uniform=!0,this.boundary=8,this.itemSize=4}},Fk=class extends Rf{constructor(e,t=new Mn){super(e,t),this.isMatrix3Uniform=!0,this.boundary=48,this.itemSize=12}},Bk=class extends Rf{constructor(e,t=new cn){super(e,t),this.isMatrix4Uniform=!0,this.boundary=64,this.itemSize=16}},Ok=class extends Rk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},Uk=class extends Ik{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},kk=class extends Pk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},zk=class extends Lk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},Vk=class extends Dk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},Gk=class extends Nk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},qk=class extends Fk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},Hk=class extends Bk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},GIe=0,vte=new WeakMap,_te=new WeakMap,qIe=new WeakMap,HIe=new Map([[Int8Array,"int"],[Int16Array,"int"],[Int32Array,"int"],[Uint8Array,"uint"],[Uint16Array,"uint"],[Uint32Array,"uint"],[Float32Array,"float"]]),PR=i=>/e/g.test(i)?String(i).replace(/\+/g,""):(i=Number(i),i+(i%1?"":".0")),ioe=i=>{if(i.writeUsageCount>0)return!0;if(i.subBuildsCache!==void 0){for(let e in i.subBuildsCache)if(ioe(i.subBuildsCache[e]))return!0}return!1},G4=class{constructor(e,t,n){this.object=e,this.material=e&&e.material||null,this.geometry=e&&e.geometry||null,this.renderer=t,this.parser=n,this.scene=null,this.camera=null,this.nodes=new Set,this.sequentialNodes=new Set,this.updateNodes=[],this.updateBeforeNodes=[],this.updateAfterNodes=[],this.hashNodes={},this.observer=null,this.lightsNode=null,this.environmentNode=null,this.fogNode=null,this.clippingContext=null,this.hardwareClipping=!1,this.vertexShader=null,this.fragmentShader=null,this.computeShader=null,this.flowNodes={vertex:[],fragment:[],compute:[]},this.flowCode={vertex:"",fragment:"",compute:""},this.uniforms={vertex:[],fragment:[],compute:[],index:0},this.structs={vertex:[],fragment:[],compute:[],index:0},this.types={vertex:[],fragment:[],compute:[],index:0},this.bindings={vertex:{},fragment:{},compute:{}},this.bindingsIndexes={},this.bindGroups=null,this.attributes=[],this.bufferAttributes=[],this.varyings=[],this.codes={},this.vars={},this.declarations={},this.flow={code:""},this.chaining=[],this.stack=KR(),this.stacks=[],this.tab=" ",this.currentFunctionNode=null,this.context={material:this.material},this.cache=new cS,this.globalCache=this.cache,this.flowsData=new WeakMap,this.shaderStage=null,this.buildStage=null,this.subBuildLayers=[],this.activeStacks=[],this.subBuildFn=null,this.fnCall=null,Object.defineProperty(this,"id",{value:GIe++})}isFlatShading(){return this.material.flatShading===!0||this.geometry.hasAttribute("normal")===!1}isOpaque(){let e=this.material;return e.transparent===!1&&e.blending===Ms&&e.alphaToCoverage===!1}createRenderTarget(e,t,n){return new Fa(e,t,n)}createCubeRenderTarget(e,t){return new _4(e,t)}includes(e){return this.nodes.has(e)}getOutputType(e=0){let t="vec4",n=this.renderer.getRenderTarget();if(n!==null){let r=n.textures[e].type,s=n.textures[e].format,o="vec";r===Zr?o="ivec":r===xi&&(o="uvec"),s===Od||s===Vh?r===Zr?t="int":r===xi?t="uint":t="float":s===js||s===Gh?t=`${o}2`:s===Bd||s===Ib?t=`${o}3`:t=`${o}4`}return t}getOutputStructName(){}_getBindGroup(e,t){let n=t[0].groupNode,r=n.shared;if(r)for(let o=1;o<t.length;o++)n!==t[o].groupNode&&(r=!1);let s;if(r){let o="";for(let u of t)if(u.isNodeUniformsGroup){u.uniforms.sort((f,d)=>f.nodeUniform.node.id-d.nodeUniform.node.id);for(let f of u.uniforms)o+=f.nodeUniform.node.id}else o+=u.nodeUniform.id;let a=this.renderer._currentRenderContext||this.renderer,l=vte.get(a);l===void 0&&(l=new Map,vte.set(a,l));let c=yx(o);s=l.get(c),s===void 0&&(s=new SS(e,t),l.set(c,s))}else s=new SS(e,t);return s}getBindGroupArray(e,t){let n=this.bindings[t],r=n[e];return r===void 0&&(this.bindingsIndexes[e]===void 0&&(this.bindingsIndexes[e]={binding:0,group:Object.keys(this.bindingsIndexes).length}),n[e]=r=[]),r}getBindings(){let e=this.bindGroups;if(e===null){let t={},n=this.bindings;for(let r of XR)for(let s in n[r]){let o=n[r][s],a=t[s]||(t[s]=[]);for(let l of o)a.includes(l)===!1&&a.push(l)}e=[];for(let r in t){let s=t[r],o=this._getBindGroup(r,s);e.push(o)}this.bindGroups=e}return e}sortBindingGroups(){let e=this.getBindings();e.sort((t,n)=>t.bindings[0].groupNode.order-n.bindings[0].groupNode.order);for(let t=0;t<e.length;t++){let n=e[t];this.bindingsIndexes[n.name].group=t}}setHashNode(e,t){this.hashNodes[t]=e}addNode(e){this.nodes.has(e)===!1&&(this.nodes.add(e),this.setHashNode(e,e.getHash(this)))}addSequentialNode(e){let t=e.getUpdateBeforeType(),n=e.getUpdateAfterType();(t!==yn.NONE||n!==yn.NONE)&&this.sequentialNodes.add(e)}buildUpdateNodes(){for(let e of this.nodes)e.getUpdateType()!==yn.NONE&&this.updateNodes.push(e);for(let e of this.sequentialNodes){let t=e.getUpdateBeforeType(),n=e.getUpdateAfterType();t!==yn.NONE&&this.updateBeforeNodes.push(e),n!==yn.NONE&&this.updateAfterNodes.push(e)}}get currentNode(){return this.chaining[this.chaining.length-1]}isFilteredTexture(e){return e.magFilter===Mi||e.magFilter===g0||e.magFilter===Wc||e.magFilter===Vo||e.minFilter===Mi||e.minFilter===g0||e.minFilter===Wc||e.minFilter===Vo}getUniformBufferLimit(){return this.renderer.backend.capabilities.getUniformBufferLimit()}addChain(e){this.chaining.push(e)}removeChain(e){if(this.chaining.pop()!==e)throw new Error("THREE.NodeBuilder: Invalid node chaining!")}getMethod(e){return e}getTernary(){return null}getNodeFromHash(e){return this.hashNodes[e]}addFlow(e,t){return this.flowNodes[e].push(t),t}setContext(e){this.context=e}getContext(){return this.context}addContext(e){let t=this.getContext();return this.setContext({...this.context,...e}),t}getSharedContext(){let e={...this.context};return delete e.material,delete e.getUV,delete e.getOutput,delete e.getTextureLevel,delete e.getAO,delete e.getShadow,e}setCache(e){this.cache=e}getCache(){return this.cache}getCacheFromNode(e,t=!0){let n=this.getDataFromNode(e);return n.cache===void 0&&(n.cache=new cS(t?this.getCache():null)),n.cache}isAvailable(){return!1}getVertexIndex(){Xe("Abstract function.")}getInstanceIndex(){Xe("Abstract function.")}getDrawIndex(){Xe("Abstract function.")}getFrontFacing(){Xe("Abstract function.")}getFragCoord(){Xe("Abstract function.")}isFlipY(){return!1}isContextAssign(){return this.context.assign===!0}increaseUsage(e){let t=this.getDataFromNode(e);return t.usageCount=t.usageCount===void 0?1:t.usageCount+1,this.isContextAssign()?t.writeUsageCount=t.writeUsageCount===void 0?1:t.writeUsageCount+1:t.readUsageCount=t.readUsageCount===void 0?1:t.readUsageCount+1,t.usageCount}hasWriteUsage(e){let t=e.getShared(this),r=(t.isGlobal(this)?this.globalCache:this.cache).getData(t);if(r!==void 0){for(let s in r)if(ioe(r[s]))return!0}return!1}generateTexture(){Xe("Abstract function.")}generateTextureLod(){Xe("Abstract function.")}generateArrayDeclaration(e,t){return this.getType(e)+"[ "+t+" ]"}generateArray(e,t,n=null){let r=this.generateArrayDeclaration(e,t)+"( ";for(let s=0;s<t;s++){let o=n?n[s]:null;o!==null?r+=o.build(this,e):r+=this.generateConst(e),s<t-1&&(r+=", ")}return r+=" )",r}generateStruct(e,t,n=null){let r=[];for(let s of t){let{name:o,type:a}=s;n&&n[o]&&n[o].isNode?r.push(n[o].build(this,a)):r.push(this.generateConst(a))}return e+"( "+r.join(", ")+" )"}generateConst(e,t=null){if(t===null&&(e==="float"||e==="int"||e==="uint"?t=0:e==="bool"?t=!1:e==="color"?t=new zt:e==="vec2"||e==="uvec2"||e==="ivec2"?t=new Oe:e==="vec3"||e==="uvec3"||e==="ivec3"?t=new re:(e==="vec4"||e==="uvec4"||e==="ivec4")&&(t=new xn)),e==="float")return PR(t);if(e==="int")return`${Math.round(t)}`;if(e==="uint")return t>=0?`${Math.round(t)}u`:"0u";if(e==="bool")return t?"true":"false";if(e==="color")return`${this.getType("vec3")}( ${PR(t.r)}, ${PR(t.g)}, ${PR(t.b)} )`;let n=this.getTypeLength(e),r=this.getComponentType(e),s=o=>this.generateConst(r,o);if(n===2)return`${this.getType(e)}( ${s(t.x)}, ${s(t.y)} )`;if(n===3)return`${this.getType(e)}( ${s(t.x)}, ${s(t.y)}, ${s(t.z)} )`;if(n===4&&e!=="mat2")return`${this.getType(e)}( ${s(t.x)}, ${s(t.y)}, ${s(t.z)}, ${s(t.w)} )`;if(n>=4&&t&&(t.isMatrix2||t.isMatrix3||t.isMatrix4))return`${this.getType(e)}( ${t.elements.map(s).join(", ")} )`;if(n>4)return`${this.getType(e)}()`;throw new Error(`THREE.NodeBuilder: Type '${e}' not found in generate constant attempt.`)}getType(e){return e==="color"?"vec3":e}hasGeometryAttribute(e){return this.geometry&&this.geometry.getAttribute(e)!==void 0}getAttribute(e,t){let n=this.attributes;for(let s of n)if(s.name===e)return s;let r=new z4(e,t);return this.registerDeclaration(r),n.push(r),r}getPropertyName(e){return e.name}isVector(e){return/vec\d/.test(e)}isMatrix(e){return/mat\d/.test(e)}isReference(e){return e==="void"||e==="property"||e==="sampler"||e==="samplerComparison"||e==="texture"||e==="cubeTexture"||e==="storageTexture"||e==="depthTexture"||e==="texture3D"}needsToWorkingColorSpace(){return!1}getComponentTypeFromTexture(e){let t=e.type;return e.isDepthTexture===!0?"float":t===Zr?"int":t===xi?"uint":"float"}getElementType(e){return e==="mat2"?"vec2":e==="mat3"?"vec3":e==="mat4"?"vec4":this.getComponentType(e)}getComponentType(e){if(e=this.getVectorType(e),e==="float"||e==="bool"||e==="int"||e==="uint")return e;let t=/(b|i|u|)(vec|mat)([2-4])/.exec(e);return t===null?null:t[1]==="b"?"bool":t[1]==="i"?"int":t[1]==="u"?"uint":"float"}getVectorType(e){return e==="color"?"vec3":e==="texture"||e==="cubeTexture"||e==="storageTexture"||e==="texture3D"?"vec4":e}getTypeFromLength(e,t="float"){if(e===1)return t;let n=$te(e),r=t==="float"?"":t[0];return/mat2/.test(t)===!0&&(n=n.replace("vec","mat")),r+n}getTypeFromArray(e){return HIe.get(e.constructor)}isInteger(e){return/int|uint|(i|u)vec/.test(e)}getTypeFromAttribute(e){let t=e;e.isInterleavedBufferAttribute&&(t=e.data);let n=t.array,r=e.itemSize,s=e.normalized,o;return!(e instanceof Qv)&&s!==!0&&(o=this.getTypeFromArray(n)),this.getTypeFromLength(r,o)}getTypeLength(e){let t=this.getVectorType(e),n=/vec([2-4])/.exec(t);return n!==null?Number(n[1]):t==="float"||t==="bool"||t==="int"||t==="uint"?1:/mat2/.test(e)===!0?4:/mat3/.test(e)===!0?9:/mat4/.test(e)===!0?16:0}getVectorFromMatrix(e){return e.replace("mat","vec")}changeComponentType(e,t){return this.getTypeFromLength(this.getTypeLength(e),t)}getIntegerType(e){let t=this.getComponentType(e);return t==="int"||t==="uint"?e:this.changeComponentType(e,"int")}setActiveStack(e){this.activeStacks.push(e)}removeActiveStack(e){if(this.activeStacks[this.activeStacks.length-1]===e)this.activeStacks.pop();else throw new Error("THREE.NodeBuilder: Invalid active stack removal.")}getActiveStack(){return this.activeStacks[this.activeStacks.length-1]}getBaseStack(){return this.activeStacks[0]}addStack(){this.stack=KR(this.stack);let e=tz();return this.stacks.push(e),hS(this.stack),this.stack}removeStack(){let e=this.stack;for(let t of e.nodes){let n=this.getDataFromNode(t);n.stack=e}return this.stack=e.parent,hS(this.stacks.pop()),e}getDataFromNode(e,t=this.shaderStage,n=null){n=n===null?e.isGlobal(this)?this.globalCache:this.cache:n;let r=n.getData(e);r===void 0&&(r={},n.setData(e,r)),r[t]===void 0&&(r[t]={});let s=r[t];if(this.subBuildLayers.length===0)return s;let o=r.any?r.any.subBuilds:null,a=this.getClosestSubBuild(o);return a&&(s.subBuildsCache===void 0&&(s.subBuildsCache={}),s=s.subBuildsCache[a]||(s.subBuildsCache[a]={}),s.subBuilds=o),s}getNodeProperties(e,t="any"){let n=this.getDataFromNode(e,t);return n.properties||(n.properties={outputNode:null})}getBufferAttributeFromNode(e,t,n=null){let r=this.getDataFromNode(e,"vertex"),s=r.bufferAttribute;if(s===void 0){let o=this.uniforms.index++;n===null&&(n="nodeAttribute"+o),s=new z4(n,t,e),this.bufferAttributes.push(s),r.bufferAttribute=s}return s}getStructTypeNode(e,t=this.shaderStage){return this.types[t][e]||null}getStructTypeFromNode(e,t,n=null,r=this.shaderStage){let s=this.getDataFromNode(e,r,this.globalCache),o=s.structType;if(o===void 0){let a=this.structs.index++;n===null&&(n="StructType"+a),o=new Ck(n,t),this.structs[r].push(o),this.types[r][n]=e,s.structType=o}return o}getOutputStructTypeFromNode(e,t){let n=this.getStructTypeFromNode(e,t,"OutputType","fragment");return n.output=!0,n}getUniformFromNode(e,t,n=this.shaderStage,r=null){let s=this.getDataFromNode(e,n,this.globalCache),o=s.uniform;if(o===void 0){let a=this.uniforms.index++;o=new Tk(r||"nodeUniform"+a,t,e),this.uniforms[n].push(o),this.registerDeclaration(o),s.uniform=o}return o}getVarFromNode(e,t=null,n=e.getNodeType(this),r=this.shaderStage,s=!1){let o=this.getDataFromNode(e,r),a=this.getSubBuildProperty("variable",o.subBuilds),l=o[a];if(l===void 0){let c=s?"_const":"_var",u=this.vars[r]||(this.vars[r]=[]),f=this.vars[c]||(this.vars[c]=0);t===null&&(t=(s?"nodeConst":"nodeVar")+f,this.vars[c]++),a!=="variable"&&(t=this.getSubBuildProperty(t,o.subBuilds));let d=e.getArrayCount(this);l=new V4(t,n,s,d),s||u.push(l),this.registerDeclaration(l),o[a]=l}return l}isDeterministic(e){if(e.isMathNode)return this.isDeterministic(e.aNode)&&(e.bNode?this.isDeterministic(e.bNode):!0)&&(e.cNode?this.isDeterministic(e.cNode):!0);if(e.isOperatorNode)return this.isDeterministic(e.aNode)&&(e.bNode?this.isDeterministic(e.bNode):!0);if(e.isArrayNode){if(e.values!==null){for(let t of e.values)if(!this.isDeterministic(t))return!1}return!0}else if(e.isConstNode)return!0;return!1}getVaryingFromNode(e,t=null,n=e.getNodeType(this),r=null,s=null){let o=this.getDataFromNode(e,"any"),a=this.getSubBuildProperty("varying",o.subBuilds),l=o[a];if(l===void 0){let c=this.varyings,u=c.length;t===null&&(t="nodeVarying"+u),a!=="varying"&&(t=this.getSubBuildProperty(t,o.subBuilds)),l=new Ek(t,n,r,s),c.push(l),this.registerDeclaration(l),o[a]=l}return l}registerDeclaration(e){let t=this.shaderStage,n=this.declarations[t]||(this.declarations[t]={}),r=e.name,s=r,o=this.getPropertyName(e),a=1;for(;n[o]!==void 0;)s=r+"_"+a++,e.name=s,o=this.getPropertyName(e);s!==r&&Xe(`TSL: Declaration name '${r}' of '${e.type}' already in use. Renamed to '${s}'.`),n[o]=e}getCodeFromNode(e,t,n=this.shaderStage){let r=this.getDataFromNode(e),s=r.code;if(s===void 0){let o=this.codes[n]||(this.codes[n]=[]),a=o.length;s=new Mk("nodeCode"+a,t),o.push(s),r.code=s}return s}addFlowCodeHierarchy(e,t){let{flowCodes:n,flowCodeBlock:r}=this.getDataFromNode(e),s=!0,o=t;for(;o;){if(r.get(o)===!0){s=!1;break}o=this.getDataFromNode(o).parentNodeBlock}if(s)for(let a of n)this.addLineFlowCode(a)}addLineFlowCodeBlock(e,t,n){let r=this.getDataFromNode(e),s=r.flowCodes||(r.flowCodes=[]),o=r.flowCodeBlock||(r.flowCodeBlock=new WeakMap);s.push(t),o.set(n,!0)}addLineFlowCode(e,t=null){return e===""?this:(t!==null&&this.context.nodeBlock&&this.addLineFlowCodeBlock(t,e,this.context.nodeBlock),e=this.tab+e,/;\s*$/.test(e)||(e=e+`;4161-`),this.flow.code+=e,this)}addFlowCode(e){return this.flow.code+=e,this}addFlowTab(){return this.tab+=" ",this}removeFlowTab(){return this.tab=this.tab.slice(0,-1),this}getFlowData(e){return this.flowsData.get(e)}flowNode(e){let t=e.getNodeType(this),n=this.flowChildNode(e,t);return this.flowsData.set(e,n),n}addInclude(e){this.currentFunctionNode!==null&&this.currentFunctionNode.includes.push(e)}buildFunctionNode(e){let t=this.renderer.backend,n=_te.get(t);n===void 0&&(n=new WeakMap,_te.set(t,n));let r=n.get(e);if(r===void 0){r=new F4;let s=this.currentFunctionNode;this.currentFunctionNode=r,r.code=this.buildFunctionCode(e),this.currentFunctionNode=s,n.set(e,r)}return r}flowShaderNode(e){let t=e.layout,n={[Symbol.iterator](){let o=0,a=Object.values(this);return{next:()=>({value:a[o],done:o++>=a.length})}}};for(let o of t.inputs)n[o.name]=new C4(o.type,o.name);e.layout=null;let r=e.call(n),s=this.flowStagesNode(r,t.type);return e.layout=t,s}flowBuildStage(e,t,n=null){let r=this.getBuildStage();this.setBuildStage(t);let s=e.build(this,n);return this.setBuildStage(r),s}flowStagesNode(e,t=null){let n=this.flow,r=this.vars,s=this.declarations,o=this.cache,a=this.buildStage,l=this.stack,c={code:""};this.flow=c,this.vars={},this.declarations={},this.cache=new cS,this.stack=KR();for(let u of jR)this.setBuildStage(u),c.result=e.build(this,t);return c.vars=this.getVars(this.shaderStage),this.flow=n,this.vars=r,this.declarations=s,this.cache=o,this.stack=l,this.setBuildStage(a),c}getFunctionOperator(){return null}buildFunctionCode(){Xe("Abstract function.")}flowChildNode(e,t=null){let n=this.flow,r={code:""};return this.flow=r,r.result=e.build(this,t),this.flow=n,r}flowNodeFromShaderStage(e,t,n=null,r=null){let s=this.tab,o=this.cache,a=this.shaderStage,l=this.context;this.setShaderStage(e);let c={...this.context};delete c.nodeBlock,this.cache=this.globalCache,this.tab=" ",this.context=c;let u=null;if(this.buildStage==="generate"){let f=this.flowChildNode(t,n);r!==null&&(f.code+=`${this.tab+r} = ${f.result};4158+`).removeFlowTab();e.addFlowTab()}},Oi=(...i)=>new u7(Xg(i,"int")).toStack(),u3e=()=>hc("continue").toStack(),Zre=()=>hc("break").toStack(),VO=new WeakMap,sc=new xn,Wee=new WeakMap,jee=me(({bufferMap:i,influence:e,stride:t,width:n,depth:r,offset:s})=>{let o=de(Iie).mul(t).add(s),a=o.div(n),l=o.sub(a.mul(n));return _s(i,kr(l,a)).depth(r).xyz.mul(e)});function h3e(i){let e=i.morphAttributes.position!==void 0,t=i.morphAttributes.normal!==void 0,n=i.morphAttributes.color!==void 0,r=i.morphAttributes.position||i.morphAttributes.normal||i.morphAttributes.color,s=r!==void 0?r.length:0,o=VO.get(i);if(o===void 0||o.count!==s){let T=function(){w.dispose(),VO.delete(i),i.removeEventListener("dispose",T)};o!==void 0&&o.texture.dispose();let a=i.morphAttributes.position||[],l=i.morphAttributes.normal||[],c=i.morphAttributes.color||[],u=0;e===!0&&(u=1),t===!0&&(u=2),n===!0&&(u=3);let f=i.attributes.position.count*u,d=1,A=4096;f>A&&(d=Math.ceil(f/A),f=A);let y=new Float32Array(f*d*4*s),w=new GA(y,f,d,s);w.type=cr,w.needsUpdate=!0;let S=u*4;for(let R=0;R<s;R++){let P=a[R],I=l[R],F=c[R],D=f*d*4*R;for(let L=0;L<P.count;L++){let C=L*S;e===!0&&(sc.fromBufferAttribute(P,L),y[D+C+0]=sc.x,y[D+C+1]=sc.y,y[D+C+2]=sc.z,y[D+C+3]=0),t===!0&&(sc.fromBufferAttribute(I,L),y[D+C+4]=sc.x,y[D+C+5]=sc.y,y[D+C+6]=sc.z,y[D+C+7]=0),n===!0&&(sc.fromBufferAttribute(F,L),y[D+C+8]=sc.x,y[D+C+9]=sc.y,y[D+C+10]=sc.z,y[D+C+11]=F.itemSize===4?sc.w:1)}}o={count:s,texture:w,stride:u,size:new Oe(f,d)},VO.set(i,o),i.addEventListener("dispose",T)}return o}var Kre=me(([i])=>{let{geometry:e}=i,t=e.morphAttributes.position!==void 0,n=e.hasAttribute("normal")&&e.morphAttributes.normal!==void 0,r=e.morphAttributes.position||e.morphAttributes.normal||e.morphAttributes.color,s=r!==void 0?r.length:0;if(s===0)return;let o=Wee.get(i);(o===void 0||o.count!==s)&&(o={base:Xt(1),influences:i.morphTargetInfluences?Xo(i.morphTargetInfluences,"float"):null,count:s},Wee.set(i,o));let{base:a,influences:l}=o,{texture:c,stride:u,size:f}=h3e(e);t===!0&&Mr.mulAssign(a),n===!0&&ba.mulAssign(a);let d=de(f.width);Oi(s,({i:A})=>{let y=oe(0).toVar();i.count>1&&i.morphTexture!==null&&i.morphTexture!==void 0?y.assign(_s(i.morphTexture,kr(de(A).add(1),de(Yu))).r):y.assign(l.element(A).toVar()),$t(y.notEqual(0),()=>{t===!0&&Mr.addAssign(jee({bufferMap:c,influence:y,stride:u,width:d,depth:A,offset:de(0)})),n===!0&&ba.addAssign(jee({bufferMap:c,influence:y,stride:u,width:d,depth:A,offset:de(1)}))})}),OS(({object:A})=>{let{base:y,influences:w}=o;A.geometry.morphTargetsRelative?y.value=1:y.value=1-A.morphTargetInfluences.reduce((S,T)=>S+T,0),w&&(w.array=A.morphTargetInfluences,w.update())})},"void"),xm=class extends Kt{static get type(){return"LightingNode"}constructor(){super("vec3"),this.isLightingNode=!0}},h7=class extends xm{static get type(){return"AONode"}constructor(e=null){super(),this.aoNode=e}setup(e){e.context.ambientOcclusion.mulAssign(this.aoNode)}},f7=class extends gS{static get type(){return"LightingContextNode"}constructor(e,t=null,n=[],r=null,s=null){super(e),this.lightingModel=t,this.materialLightings=n,this.backdropNode=r,this.backdropAlphaNode=s,this._value=null}getContext(){let{materialLightings:e,backdropNode:t,backdropAlphaNode:n}=this,r=pe().toVar("directDiffuse"),s=pe().toVar("directSpecular"),o=pe().toVar("indirectDiffuse"),a=pe().toVar("indirectSpecular"),l={directDiffuse:r,directSpecular:s,indirectDiffuse:o,indirectSpecular:a};return{radiance:pe().toVar("radiance"),irradiance:pe().toVar("irradiance"),iblIrradiance:pe().toVar("iblIrradiance"),ambientOcclusion:oe(1).toVar("ambientOcclusion"),reflectedLight:l,materialLightings:e,backdrop:t,backdropAlpha:n}}setup(e){return this.value=this._value||(this._value=this.getContext()),this.value.lightingModel=this.lightingModel||e.context.lightingModel,super.setup(e)}},Qre=$n(f7),d7=class extends xm{static get type(){return"IrradianceNode"}constructor(e){super(),this.node=e}setup(e){e.context.irradiance.addAssign(this.node)}},Ng=new Oe,gx=class extends lu{static get type(){return"ViewportTextureNode"}constructor(e=$u,t=null,n=null){let r=null;n===null?(r=new XA,r.minFilter=Vo,n=r):r=n,super(n,e,t),this.generateMipmaps=!1,this.defaultFramebuffer=r,this.isOutputTextureNode=!0,this.updateBeforeType=yn.RENDER,this._cacheTextures=new WeakMap}getTextureForReference(e=null){let t,n;if(this.referenceNode?(t=this.referenceNode.defaultFramebuffer,n=this.referenceNode._cacheTextures):(t=this.defaultFramebuffer,n=this._cacheTextures),e===null)return t;if(n.has(e)===!1){let r=t.clone();n.set(e,r)}return n.get(e)}updateReference(e){let t=e.renderer,n=t.getRenderTarget(),r=t.getCanvasTarget(),s=n||r;return this.value=this.getTextureForReference(s),this.value}updateBefore(e){let t=e.renderer,n=t.getRenderTarget(),r=t.getCanvasTarget(),s=n||r;s===null?t.getDrawingBufferSize(Ng):s.getDrawingBufferSize?s.getDrawingBufferSize(Ng):Ng.set(s.width,s.height);let o=this.getTextureForReference(s);(o.image.width!==Ng.width||o.image.height!==Ng.height)&&(o.image.width=Ng.width,o.image.height=Ng.height,o.needsUpdate=!0);let a=o.generateMipmaps;o.generateMipmaps=this.generateMipmaps,t.copyFramebufferToTexture(o),o.generateMipmaps=a}clone(){let e=new this.constructor(this.uvNode,this.levelNode,this.value);return e.generateMipmaps=this.generateMipmaps,e}},f3e=$n(gx).setParameterLength(0,3),uV=$n(gx,null,null,{generateMipmaps:!0}).setParameterLength(0,3),d3e=uV(),Jre=(i=$u,e=null)=>d3e.sample(i,e),GO=null,p7=class extends gx{static get type(){return"ViewportDepthTextureNode"}constructor(e=$u,t=null,n=null){n===null&&(GO===null&&(GO=new Cs),n=GO),super(e,t,n)}},hV=$n(p7).setParameterLength(0,3),Qu=class i extends Kt{static get type(){return"ViewportDepthNode"}constructor(e,t=null){super("float"),this.scope=e,this.valueNode=t,this.isViewportDepthNode=!0}generate(e){let{scope:t}=this;return t===i.DEPTH_BASE?e.getFragDepth():super.generate(e)}setup({camera:e}){let{scope:t}=this,n=this.valueNode,r=null;if(t===i.DEPTH_BASE)n!==null&&(r=nse().assign(n));else if(t===i.DEPTH)e.isPerspectiveCamera?r=fV(xs.z,cm,um):r=Kg(xs.z,cm,um);else if(t===i.LINEAR_DEPTH)if(n!==null)if(e.isPerspectiveCamera){let s=NI(n,cm,um);r=Kg(s,cm,um)}else r=n;else r=Kg(xs.z,cm,um);return r}};Qu.DEPTH_BASE="depthBase";Qu.DEPTH="depth";Qu.LINEAR_DEPTH="linearDepth";var Kg=(i,e,t)=>i.add(e).div(e.sub(t)),p3e=(i,e,t)=>i.add(t).div(t.sub(e)),ese=me(([i,e,t],n)=>n.renderer.reversedDepthBuffer===!0?t.sub(e).mul(i).sub(t):e.sub(t).mul(i).sub(e)),fV=(i,e,t)=>e.add(i).mul(t).div(t.sub(e).mul(i)),tse=(i,e,t)=>e.mul(i.add(t)).div(i.mul(e.sub(t))),NI=me(([i,e,t],n)=>n.renderer.reversedDepthBuffer===!0?e.mul(t).div(e.sub(t).mul(i).sub(e)):e.mul(t).div(t.sub(e).mul(i).sub(t))),FI=(i,e,t)=>{e=e.max(1e-6).toVar();let n=_f(i.negate().div(e)),r=_f(t.div(e));return n.div(r)},m3e=(i,e,t)=>{let n=i.mul(SI(t.div(e)));return oe(Math.E).pow(n).mul(e).negate()},nse=$n(Qu,Qu.DEPTH_BASE),dV=xt(Qu,Qu.DEPTH),b4=$n(Qu,Qu.LINEAR_DEPTH).setParameterLength(0,1),A3e=b4(hV());dV.assign=i=>nse(i);var Ef=class i extends Kt{static get type(){return"ClippingNode"}constructor(e=i.DEFAULT){super(),this.scope=e}setup(e){super.setup(e);let t=e.clippingContext,{intersectionPlanes:n,unionPlanes:r}=t;return this.hardwareClipping=e.hardwareClipping,this.scope===i.ALPHA_TO_COVERAGE?this.setupAlphaToCoverage(n,r):this.scope===i.HARDWARE?this.setupHardwareClipping(r,e):this.setupDefault(n,r)}setupAlphaToCoverage(e,t){return me(()=>{let n=oe().toVar("distanceToPlane"),r=oe().toVar("distanceToGradient"),s=oe(1).toVar("clipOpacity"),o=t.length;if(this.hardwareClipping===!1&&o>0){let l=Xo(t).setGroup(Jt);Oi(o,({i:c})=>{let u=l.element(c);n.assign(xs.dot(u.xyz).negate().add(u.w)),r.assign(n.fwidth().div(2)),s.mulAssign(mc(r.negate(),r,n))})}let a=e.length;if(a>0){let l=Xo(e).setGroup(Jt),c=oe(1).toVar("intersectionClipOpacity");Oi(a,({i:u})=>{let f=l.element(u);n.assign(xs.dot(f.xyz).negate().add(f.w)),r.assign(n.fwidth().div(2)),c.mulAssign(mc(r.negate(),r,n).oneMinus())}),s.mulAssign(c.oneMinus())}Bi.a.mulAssign(s),Bi.a.equal(0).discard()})()}setupDefault(e,t){return me(()=>{let n=t.length;if(this.hardwareClipping===!1&&n>0){let s=Xo(t).setGroup(Jt);Oi(n,({i:o})=>{let a=s.element(o);xs.dot(a.xyz).greaterThan(a.w).discard()})}let r=e.length;if(r>0){let s=Xo(e).setGroup(Jt),o=dc(!0).toVar("clipped");Oi(r,({i:a})=>{let l=s.element(a);o.assign(xs.dot(l.xyz).greaterThan(l.w).and(o))}),o.discard()}})()}setupHardwareClipping(e,t){let n=e.length;return t.enableHardwareClipping(n),me(()=>{let r=Xo(e).setGroup(Jt),s=np(t.getClipDistance());Oi(n,({i:o})=>{let a=r.element(o),l=xs.dot(a.xyz).sub(a.w).negate();s.element(o).assign(l)})})()}};Ef.ALPHA_TO_COVERAGE="alphaToCoverage";Ef.DEFAULT="default";Ef.HARDWARE="hardware";var g3e=()=>new Ef,v3e=()=>new Ef(Ef.ALPHA_TO_COVERAGE),_3e=()=>new Ef(Ef.HARDWARE),x3e=.05,Xee=me(([i])=>Zu(Tn(1e4,Ka(Tn(17,i.x).add(Tn(.1,i.y)))).mul(Ls(.1,fr(Ka(Tn(13,i.y).add(i.x))))))),$ee=me(([i])=>Xee(dt(Xee(i.xy),i.z))),y3e=me(([i])=>{let e=zr(yf(Ez(i.xyz)),yf(Mz(i.xyz))),t=oe(1).div(oe(x3e).mul(e)).toVar("pixScale"),n=dt(px(xf(_f(t))),px(TI(_f(t)))),r=dt($ee(xf(n.x.mul(i.xyz))),$ee(xf(n.y.mul(i.xyz)))),s=Zu(_f(t)),o=Ls(Tn(s.oneMinus(),r.x),Tn(s,r.y)),a=Il(s,s.oneMinus()),l=pe(o.mul(o).div(Tn(2,a).mul(ai(1,a))),o.sub(Tn(.5,a)).div(ai(1,a)),ai(1,ai(1,o).mul(ai(1,o)).div(Tn(2,a).mul(ai(1,a))))),c=o.lessThan(a.oneMinus()).select(o.lessThan(a).select(l.x,l.y),l.z);return Ku(c,1e-6,1)}).setLayout({name:"getAlphaHashThreshold",type:"float",inputs:[{name:"position",type:"vec3"}]}),m7=class extends A4{static get type(){return"VertexColorNode"}constructor(e){super(null,"vec4"),this.isVertexColorNode=!0,this.index=e}getAttributeName(){let e=this.index;return"color"+(e>0?e:"")}generate(e){let t=this.getAttributeName(e),n=e.hasGeometryAttribute(t),r;return n===!0?r=super.generate(e):r=e.generateConst(this.nodeType,new xn(1,1,1,1)),r}serialize(e){super.serialize(e),e.index=this.index}deserialize(e){super.deserialize(e),this.index=e.index}},ise=(i=0)=>new m7(i),Ir=class extends Ws{static get type(){return"NodeMaterial"}get type(){return this.constructor.type}set type(e){}constructor(){super(),this.isNodeMaterial=!0,this.fog=!0,this.lights=!1,this.lightsNode=null,this.envNode=null,this.aoNode=null,this.colorNode=null,this.normalNode=null,this.opacityNode=null,this.backdropNode=null,this.backdropAlphaNode=null,this.alphaTestNode=null,this.maskNode=null,this.maskShadowNode=null,this.positionNode=null,this.geometryNode=null,this.depthNode=null,this.receivedShadowPositionNode=null,this.castShadowPositionNode=null,this.receivedShadowNode=null,this.castShadowNode=null,this.outputNode=null,this.mrtNode=null,this.fragmentNode=null,this.vertexNode=null,this.contextNode=null}_getNodeChildren(){let e=[];for(let t of Object.getOwnPropertyNames(this)){if(t.startsWith("_")===!0)continue;let n=this[t];n&&n.isNode===!0&&e.push({property:t,childNode:n})}return e}customProgramCacheKey(){let e=[];for(let{property:t,childNode:n}of this._getNodeChildren())e.push(wx(t.slice(0,-4)),n.getCacheKey());return this.type+FS(e)}build(e){this.setup(e)}setupObserver(e){return new gU(e)}setup(e){e.context.setupNormal=()=>Zg(this.setupNormal(e),"NORMAL","vec3"),e.context.setupPositionView=()=>this.setupPositionView(e),e.context.setupModelViewProjection=()=>this.setupModelViewProjection(e);let t=e.renderer,n=t.getRenderTarget();e.addStack();let r=this.setupVertex(e),s=Zg(this.vertexNode||r,"VERTEX");e.context.clipSpace=s,e.stack.outputNode=s,this.setupHardwareClipping(e),this.geometryNode!==null&&(e.stack.outputNode=e.stack.outputNode.bypass(this.geometryNode)),e.addFlow("vertex",e.removeStack()),e.addStack();let o,a=this.setupClipping(e);if((this.depthWrite===!0||this.depthTest===!0)&&(n!==null?n.depthBuffer===!0&&this.setupDepth(e):t.depth===!0&&this.setupDepth(e)),this.fragmentNode===null){this.setupDiffuseColor(e),this.setupAmbientOcclusion(e),this.setupVariants(e);let l=this.setupLighting(e);a!==null&&e.stack.addToStack(a);let c=Ft(l,Bi.a).max(0);o=this.setupOutput(e,c),lx.assign(o);let u=this.outputNode!==null;if(u&&(o=this.outputNode),e.context.getOutput&&(o=e.context.getOutput(o,e)),n!==null){let f=t.getMRT(),d=this.mrtNode;f!==null?(u&&lx.assign(o),o=f,d!==null&&(o=f.merge(d))):d!==null&&(o=d)}}else{let l=this.fragmentNode;l.isOutputStructNode!==!0&&(l=l.convert(e.getOutputType())),o=this.setupOutput(e,l)}e.stack.outputNode=o,e.addFlow("fragment",e.removeStack()),e.observer=this.setupObserver(e)}setupClipping(e){if(e.clippingContext===null)return null;let{unionPlanes:t,intersectionPlanes:n}=e.clippingContext,r=null;if(t.length>0||n.length>0){let s=e.renderer.currentSamples;this.alphaToCoverage&&s>1?r=v3e():e.stack.addToStack(g3e())}return r}setupHardwareClipping(e){if(e.hardwareClipping=!1,e.clippingContext===null)return;let t=e.clippingContext.unionPlanes.length;t>0&&t<=8&&e.isAvailable("clipDistance")&&(e.stack.addToStack(_3e()),e.hardwareClipping=!0)}setupDepth(e){let{renderer:t,camera:n}=e,r=this.depthNode;if(r===null){let s=t.getMRT();s&&s.has("depth")?r=s.get("depth"):t.logarithmicDepthBuffer===!0&&(n.isPerspectiveCamera?r=FI(xs.z,cm,um):r=Kg(xs.z,cm,um))}r!==null&&dV.assign(r).toStack()}setupPositionView(){return Tf.mul(Mr).xyz}setupModelViewProjection(){return Ja.mul(xs)}setupVertex(e){return e.addStack(),this.setupPosition(e),e.context.position=e.removeStack(),Vre}setupPosition(e){let{object:t,geometry:n}=e;if((n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color)&&Kre(t),t.isSkinnedMesh===!0&&Yre(t),this.displacementMap){let r=$d("displacementMap","texture"),s=$d("displacementScale","float"),o=$d("displacementBias","float");Mr.addAssign(ba.normalize().mul(r.x.mul(s).add(o)))}return t.isBatchedMesh&&jre(t),t.isInstancedMesh&&t.instanceMatrix&&t.instanceMatrix.isInstancedBufferAttribute===!0&&Wre(t),this.positionNode!==null&&Mr.assign(Zg(this.positionNode,"POSITION","vec3")),Mr}setupDiffuseColor(e){let{object:t,geometry:n}=e;this.maskNode!==null&&dc(this.maskNode).not().discard();let r=this.colorNode?Ft(this.colorNode):mre;this.vertexColors===!0&&n.hasAttribute("color")&&(r=r.mul(ise())),t.instanceColor&&(r=aV.mul(r)),t.isBatchedMesh&&t._colorsTexture&&(r=lV.mul(r)),Bi.assign(r);let s=this.opacityNode?oe(this.opacityNode):tV;Bi.a.assign(Bi.a.mul(s));let o=null;(this.alphaTestNode!==null||this.alphaTest>0)&&(o=this.alphaTestNode!==null?oe(this.alphaTestNode):pre,this.alphaToCoverage===!0?(Bi.a=mc(o,o.add(Rz(Bi.a)),Bi.a),Bi.a.lessThanEqual(0).discard()):Bi.a.lessThanEqual(o).discard()),this.alphaHash===!0&&Bi.a.lessThan(y3e(Mr)).discard(),e.isOpaque()&&Bi.a.assign(1)}setupVariants(){}setupOutgoingLight(){return this.lights===!0?pe(0):Bi.rgb}setupNormal(){return this.normalNode?pe(this.normalNode):bre}setupEnvironment(){let e=null;return this.envNode?e=this.envNode:this.envMap&&(e=this.envMap.isCubeTexture?$d("envMap","cubeTexture"):$d("envMap","texture")),e}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new d7(oV)),t}setupMaterialLightings(e){let t=[];if(e.renderer.lighting.enabled===!1)return t;let n=this.setupEnvironment(e);n&&n.isLightingNode&&t.push(n);let r=this.setupLightMap(e);return r&&r.isLightingNode&&t.push(r),e.context.ambientOcclusion&&t.push(new h7(e.context.ambientOcclusion)),t}setupAmbientOcclusion(e){let t=this.aoNode;t===null&&e.material.aoMap&&(t=zre),e.context.getAO&&(t=e.context.getAO(t,e)),t!==null&&(CU.assign(t),e.context.ambientOcclusion=CU)}setupLightingModel(){}setupLighting(e){let{material:t}=e,{backdropNode:n,backdropAlphaNode:r,emissiveNode:s}=this,o=this.lights===!0||this.lightsNode!==null,a=this.lights===!0?this.setupMaterialLightings(e):[],l=o?this.lightsNode||e.lightsNode:null,c=this.setupOutgoingLight(e);if(l&&(a.length>0||l.getScope().hasLights)){let u=this.setupLightingModel(e)||null;c=Qre(l,u,a,n,r)}else n!==null&&(c=pe(r!==null?Qn(c,n,r):n));return(s&&s.isNode===!0||t.emissive&&t.emissive.isColor===!0)&&(MU.assign(pe(s||gre)),c=c.add(MU)),c}setupFog(e,t){let n=e.fogNode;return n&&(lx.assign(t),t=Ft(n.toVar())),t}setupPremultipliedAlpha(e,t){return Gz(t)}setupOutput(e,t){return this.fog===!0&&(t=this.setupFog(e,t)),this.premultipliedAlpha===!0&&(t=this.setupPremultipliedAlpha(e,t)),t}setDefaultValues(e){for(let n in e){let r=e[n];this[n]===void 0&&(this[n]=r,r&&r.clone&&(this[n]=r.clone()))}let t=Object.getOwnPropertyDescriptors(e.constructor.prototype);for(let n in t)Object.getOwnPropertyDescriptor(this.constructor.prototype,n)===void 0&&t[n].get!==void 0&&Object.defineProperty(this.constructor.prototype,n,t[n])}toJSON(e){let t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{},nodes:{}});let n=Ws.prototype.toJSON.call(this,e);n.inputNodes={};for(let{property:s,childNode:o}of this._getNodeChildren())n.inputNodes[s]=o.toJSON(e).uuid;function r(s){let o=[];for(let a in s){let l=s[a];delete l.metadata,o.push(l)}return o}if(t){let s=r(e.textures),o=r(e.images),a=r(e.nodes);s.length>0&&(n.textures=s),o.length>0&&(n.images=o),a.length>0&&(n.nodes=a)}return n}copy(e){let t=Object.getOwnPropertyDescriptors(this.constructor.prototype);for(let n in t)if(t[n].set!==void 0&&e[n]!==void 0){let r=e[n];this[n]&&this[n].copy!==void 0?this[n].copy(r):this[n]=r}for(let n in this)if(!/^(?:is[A-Z]|_)|^(?:id|uuid|version|type|userData|clippingPlanes)$/.test(n)&&this[n]!==void 0&&e[n]!==void 0){let r=e[n];this[n]&&this[n].copy!==void 0?this[n].copy(r):this[n]=r}return this.clippingPlanes=e.clippingPlanes?e.clippingPlanes.map(n=>n.clone()):null,this.userData=JSON.parse(JSON.stringify(e.userData)),this}},b3e=new Du,A7=class extends Ir{static get type(){return"LineBasicNodeMaterial"}constructor(e){super(),this.isLineBasicNodeMaterial=!0,this.setDefaultValues(b3e),this.setValues(e)}},w3e=new ib,g7=class extends Ir{static get type(){return"LineDashedNodeMaterial"}constructor(e){super(),this.isLineDashedNodeMaterial=!0,this.setDefaultValues(w3e),this.dashOffset=0,this.offsetNode=null,this.dashScaleNode=null,this.dashSizeNode=null,this.gapSizeNode=null,this.setValues(e)}setupVariants(){let e=this.offsetNode?oe(this.offsetNode):sV,t=this.dashScaleNode?oe(this.dashScaleNode):nV,n=this.dashSizeNode?oe(this.dashSizeNode):iV,r=this.gapSizeNode?oe(this.gapSizeNode):rV;Yg.assign(n),AS.assign(r);let s=bm(fc("lineDistance").mul(t));(e?s.add(e):s).mod(Yg.add(AS)).greaterThan(Yg).discard()}};var e4=h1("vec3","worldStart"),v7=h1("vec3","worldEnd"),rse=h1("float","lineDistance"),zg=h1("vec4","worldPos"),Yee=me(({start:i,end:e})=>{let t=Ja.element(2).element(2),n=Ja.element(3).element(2);return t.greaterThan(0).select(n.negate().div(t.add(1)),n.mul(-.5).div(t)).sub(i.z).div(e.z.sub(i.z))},{start:"vec4",end:"vec4",return:"float"}),S3e=me(({p1:i,p2:e,p3:t,p4:n})=>{let r=i.sub(t),s=n.sub(t),o=e.sub(i),a=r.dot(s),l=s.dot(o),c=r.dot(o),u=s.dot(s),d=o.dot(o).mul(u).sub(l.mul(l)),y=a.mul(l).sub(c.mul(u)).div(d).clamp(),w=a.add(l.mul(y)).div(u).clamp();return dt(y,w)},{p1:"vec3",p2:"vec3",p3:"vec3",p4:"vec3",return:"vec2"}),wlt=me(({material:i})=>{let e=i._useDash,t=i._useWorldUnits,n=fc("instanceStart"),r=fc("instanceEnd"),s=Ft(Tf.mul(Ft(n,1))).toVar("start"),o=Ft(Tf.mul(Ft(r,1))).toVar("end"),a,l;e&&(a=oe(fc("instanceDistanceStart")).toVar("distanceStart"),l=oe(fc("instanceDistanceEnd")).toVar("distanceEnd")),t&&(e4.assign(s.xyz),v7.assign(o.xyz));let c=fx.z.div(fx.w),u=Ja.element(2).element(3).equal(-1);if($t(u,()=>{$t(s.z.lessThan(0).and(o.z.greaterThan(0)),()=>{let T=Yee({start:s,end:o});o.assign(Ft(Qn(s.xyz,o.xyz,T),o.w)),e&&l.assign(Qn(a,l,T))}).ElseIf(o.z.lessThan(0).and(s.z.greaterThanEqual(0)),()=>{let T=Yee({start:o,end:s});s.assign(Ft(Qn(o.xyz,s.xyz,T),s.w)),e&&a.assign(Qn(l,a,T))})}),e){let T=i.dashScaleNode?oe(i.dashScaleNode):nV,R=i.offsetNode?oe(i.offsetNode):sV,P=ga.y.lessThan(.5).select(T.mul(a),T.mul(l));P=P.add(R),rse.assign(P)}let f=Ja.mul(s),d=Ja.mul(o),A=f.xyz.div(f.w),y=d.xyz.div(d.w),w=y.xy.sub(A.xy).toVar();w.x.assign(w.x.mul(c)),w.assign(w.normalize());let S=Ft().toVar();if(t){let T=o.xyz.sub(s.xyz).normalize(),R=Qn(s.xyz,o.xyz,.5).normalize(),P=T.cross(R).normalize(),I=T.cross(P);zg.assign(ga.y.lessThan(.5).select(s,o));let F=_4.mul(.5);zg.addAssign(Ft(ga.x.lessThan(0).select(P.mul(F),P.mul(F).negate()),0)),e||(zg.addAssign(Ft(ga.y.lessThan(.5).select(T.mul(F).negate(),T.mul(F)),0)),zg.addAssign(Ft(I.mul(F),0)),$t(ga.y.greaterThan(1).or(ga.y.lessThan(0)),()=>{zg.subAssign(Ft(I.mul(2).mul(F),0))})),S.assign(Ja.mul(zg));let D=pe().toVar();D.assign(ga.y.lessThan(.5).select(A,y)),S.z.assign(D.z.mul(S.w))}else{let T=dt(w.y,w.x.negate()).toVar("offset");w.x.assign(w.x.div(c)),T.x.assign(T.x.div(c)),T.assign(ga.x.lessThan(0).select(T.negate(),T)),$t(ga.y.lessThan(0),()=>{T.assign(T.sub(w))}).ElseIf(ga.y.greaterThan(1),()=>{T.assign(T.add(w))}),T.assign(T.mul(_4)),T.assign(T.div(fx.w.div(jz))),S.assign(ga.y.lessThan(.5).select(f,d)),T.assign(T.mul(S.w)),S.assign(S.add(Ft(T,0,0)))}return S})(),Slt=me(({material:i,renderer:e})=>{let t=i._useAlphaToCoverage,n=i._useDash,r=i._useWorldUnits,s=Ui();if(n){let a=i.dashSizeNode?oe(i.dashSizeNode):iV,l=i.gapSizeNode?oe(i.gapSizeNode):rV;Yg.assign(a),AS.assign(l),s.y.lessThan(-1).or(s.y.greaterThan(1)).discard(),rse.mod(Yg.add(AS)).greaterThan(Yg).discard()}let o=oe(1).toVar("alpha");if(r){let a=zg.xyz.normalize().mul(1e5),l=v7.sub(e4),c=S3e({p1:e4,p2:v7,p3:pe(0,0,0),p4:a}),u=e4.add(l.mul(c.x)),f=a.mul(c.y),y=u.sub(f).length().div(_4);if(!n)if(t&&e.currentSamples>0){let w=y.fwidth();o.assign(mc(w.negate().add(.5),w.add(.5),y).oneMinus())}else y.greaterThan(.5).discard()}else if(t&&e.currentSamples>0){let a=s.x,l=s.y.greaterThan(0).select(s.y.sub(1),s.y.add(1)),c=a.mul(a).add(l.mul(l)),u=oe(c.fwidth()).toVar("dlen");$t(s.y.abs().greaterThan(1),()=>{o.assign(mc(u.oneMinus(),u.add(1),c).oneMinus())})}else $t(s.y.abs().greaterThan(1),()=>{let a=s.x,l=s.y.greaterThan(0).select(s.y.sub(1),s.y.add(1));a.mul(a).add(l.mul(l)).greaterThan(1).discard()});return o})();var T3e=new tb,_7=class extends Ir{static get type(){return"MeshNormalNodeMaterial"}constructor(e){super(),this.isMeshNormalNodeMaterial=!0,this.setDefaultValues(T3e),this.setValues(e)}setupDiffuseColor(){let e=this.opacityNode?oe(this.opacityNode):tV;Bi.assign(MI(Ft(Jz(hi),e),Fr))}},pV=me(([i=$z])=>{let e=i.z.atan(i.x).mul(1/(Math.PI*2)).add(.5),t=i.y.clamp(-1,1).asin().mul(1/Math.PI).add(.5);return dt(e,t)}),x7=me(([i=Ui()])=>{let e=i.x.sub(.5).mul(Math.PI*2),t=i.y.sub(.5).mul(Math.PI),n=t.cos(),r=n.mul(e.cos()),s=t.sin(),o=n.mul(e.sin());return pe(r,s,o)}),w4=class extends Ba{constructor(e=1,t={}){super(e,e,t),this.isCubeRenderTarget=!0;let n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new Dh(r),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){let n=t.minFilter,r=t.generateMipmaps;t.generateMipmaps=!0,this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let s=new Nu(5,5,5),o=pV($z),a=new Ir;a.colorNode=fi(t,o,0),a.side=mi,a.blending=ps;let l=new Hn(s,a),c=new o0;c.add(l),t.minFilter===Vo&&(t.minFilter=Mi);let u=new l_(1,10,this),f=e.getMRT();return e.setMRT(null),u.update(e,c),e.setMRT(f),t.minFilter=n,t.generateMipmaps=r,l.geometry.dispose(),l.material.dispose(),this}clear(e,t=!0,n=!0,r=!0){let s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,n,r);e.setRenderTarget(s)}},uS=new WeakMap,y7=class extends Rr{static get type(){return"CubeMapNode"}constructor(e){super("vec3"),this.envNode=e,this._cubeTexture=null,this._cubeTextureNode=Qa(null);let t=new Dh;t.isRenderTargetTexture=!0,this._defaultTexture=t,this.updateBeforeType=yn.RENDER}updateBefore(e){let{renderer:t,material:n}=e,r=this.envNode;if(r.isTextureNode||r.isMaterialReferenceNode){let s=r.isTextureNode?r.value:n[r.property];if(s&&s.isTexture){let o=s.mapping;if(o===m0||o===A0){if(uS.has(s)){let a=uS.get(s);Zee(a,s.mapping),this._cubeTexture=a}else{let a=s.image;if(E3e(a)){let l=new w4(a.height);l.fromEquirectangularTexture(t,s),Zee(l.texture,s.mapping),this._cubeTexture=l.texture,uS.set(s,l.texture),s.addEventListener("dispose",sse)}else this._cubeTexture=this._defaultTexture}this._cubeTextureNode.value=this._cubeTexture}else this._cubeTextureNode=this.envNode}}}setup(e){return this.updateBefore(e),this._cubeTextureNode}};function E3e(i){return i==null?!1:i.height>0}function sse(i){let e=i.target;e.removeEventListener("dispose",sse);let t=uS.get(e);t!==void 0&&(uS.delete(e),t.dispose())}function Zee(i,e){e===m0?i.mapping=ec:e===A0&&(i.mapping=Wc)}var ose=$n(y7).setParameterLength(1),xS=class extends xm{static get type(){return"BasicEnvironmentNode"}constructor(e=null){super(),this.envNode=e}setup(e){e.context.environment=ose(this.envNode)}},b7=class extends xm{static get type(){return"BasicLightMapNode"}constructor(e=null){super(),this.lightMapNode=e}setup(e){let t=oe(1/Math.PI);e.context.irradianceLightMap=this.lightMapNode.mul(t)}},vx=class{start(e){e.lightsNode.setupLights(e,e.lightsNode.getLightNodes(e)),this.indirect(e)}finish(){}direct(){}directRectArea(){}indirect(){}ambientOcclusion(){}},S4=class extends vx{constructor(){super()}indirect({context:e}){let t=e.ambientOcclusion,n=e.reflectedLight,r=e.irradianceLightMap;n.indirectDiffuse.assign(Ft(0)),r?n.indirectDiffuse.addAssign(r):n.indirectDiffuse.addAssign(Ft(1,1,1,0)),n.indirectDiffuse.mulAssign(t),n.indirectDiffuse.mulAssign(Bi.rgb)}finish(e){let{material:t,context:n}=e,r=n.outgoingLight,s=e.context.environment;if(s)switch(t.combine){case ig:r.rgb.assign(Qn(r.rgb,r.rgb.mul(s.rgb),cS.mul(JR)));break;case OM:r.rgb.assign(Qn(r.rgb,s.rgb,cS.mul(JR)));break;case UM:r.rgb.addAssign(s.rgb.mul(cS.mul(JR)));break;default:Xe("BasicLightingModel: Unsupported .combine value:",t.combine);break}}},M3e=new fs,w7=class extends Ir{static get type(){return"MeshBasicNodeMaterial"}constructor(e){super(),this.isMeshBasicNodeMaterial=!0,this.lights=!0,this.setDefaultValues(M3e),this.setValues(e)}setupNormal(){return d1(mx)}setupEnvironment(e){let t=super.setupEnvironment(e);return t?new xS(t):null}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new b7(oV)),t}setupOutgoingLight(){return Bi.rgb}setupLightingModel(){return new S4}},_x=me(({f0:i,f90:e,dotVH:t})=>{let n=t.mul(-5.55473).sub(6.98316).mul(t).exp2();return i.mul(n.oneMinus()).add(e.mul(n))}),s1=me(i=>i.diffuseColor.mul(1/Math.PI)),C3e=()=>oe(.25),R3e=me(({dotNH:i})=>c4.mul(oe(.5)).add(1).mul(oe(1/Math.PI)).mul(i.pow(c4))),I3e=me(({lightDirection:i})=>{let e=i.add(er).normalize(),t=hi.dot(e).clamp(),n=er.dot(e).clamp(),r=_x({f0:vm,f90:1,dotVH:n}),s=C3e(),o=R3e({dotNH:t});return r.mul(s).mul(o)}),T4=class extends S4{constructor(e=!0){super(),this.specular=e}direct({lightDirection:e,lightColor:t,reflectedLight:n}){let s=hi.dot(e).clamp().mul(t);n.directDiffuse.addAssign(s.mul(s1({diffuseColor:Bi.rgb}))),this.specular===!0&&n.directSpecular.addAssign(s.mul(I3e({lightDirection:e})).mul(cS))}indirect(e){let{ambientOcclusion:t,irradiance:n,reflectedLight:r}=e.context;r.indirectDiffuse.addAssign(n.mul(s1({diffuseColor:Bi}))),r.indirectDiffuse.mulAssign(t)}},P3e=new Ga,S7=class extends Ir{static get type(){return"MeshLambertNodeMaterial"}constructor(e){super(),this.isMeshLambertNodeMaterial=!0,this.lights=!0,this.setDefaultValues(P3e),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t?new xS(t):null}setupLightingModel(){return new T4(!1)}},L3e=new QA,T7=class extends Ir{static get type(){return"MeshPhongNodeMaterial"}constructor(e){super(),this.isMeshPhongNodeMaterial=!0,this.lights=!0,this.shininessNode=null,this.specularNode=null,this.setDefaultValues(L3e),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t?new xS(t):null}setupLightingModel(){return new T4}setupVariants(){let e=(this.shininessNode?oe(this.shininessNode):Are).max(1e-4);c4.assign(e);let t=this.specularNode||vre;vm.assign(t)}},ase=me(i=>{if(i.geometry.hasAttribute("normal")===!1)return oe(0);let e=mx.dFdx().abs().max(mx.dFdy().abs());return e.x.max(e.y).max(e.z)}),mV=me(i=>{let{roughness:e}=i,t=ase(),n=e.max(.0525);return n=n.add(t),n=n.min(1),n}),lse=me(({alpha:i,dotNL:e,dotNV:t})=>{let n=i.pow2(),r=e.mul(n.add(n.oneMinus().mul(t.pow2())).sqrt()),s=t.mul(n.add(n.oneMinus().mul(e.pow2())).sqrt());return pc(.5,r.add(s).max(wI))}).setLayout({name:"V_GGX_SmithCorrelated",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNL",type:"float"},{name:"dotNV",type:"float"}]}),D3e=me(({alphaT:i,alphaB:e,dotTV:t,dotBV:n,dotTL:r,dotBL:s,dotNV:o,dotNL:a})=>{let l=a.mul(pe(i.mul(t),e.mul(n),o).length()),c=o.mul(pe(i.mul(r),e.mul(s),a).length());return pc(.5,l.add(c).max(wI))}).setLayout({name:"V_GGX_SmithCorrelated_Anisotropic",type:"float",inputs:[{name:"alphaT",type:"float",qualifier:"in"},{name:"alphaB",type:"float",qualifier:"in"},{name:"dotTV",type:"float",qualifier:"in"},{name:"dotBV",type:"float",qualifier:"in"},{name:"dotTL",type:"float",qualifier:"in"},{name:"dotBL",type:"float",qualifier:"in"},{name:"dotNV",type:"float",qualifier:"in"},{name:"dotNL",type:"float",qualifier:"in"}]}),cse=me(({alpha:i,dotNH:e})=>{let t=i.pow2(),n=e.pow2().mul(t.oneMinus()).oneMinus();return t.div(n.pow2()).mul(1/Math.PI)}).setLayout({name:"D_GGX",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNH",type:"float"}]}),N3e=oe(1/Math.PI),F3e=me(({alphaT:i,alphaB:e,dotNH:t,dotTH:n,dotBH:r})=>{let s=i.mul(e),o=pe(e.mul(n),i.mul(r),s.mul(t)),a=o.dot(o),l=s.div(a);return N3e.mul(s.mul(l.pow2()))}).setLayout({name:"D_GGX_Anisotropic",type:"float",inputs:[{name:"alphaT",type:"float",qualifier:"in"},{name:"alphaB",type:"float",qualifier:"in"},{name:"dotNH",type:"float",qualifier:"in"},{name:"dotTH",type:"float",qualifier:"in"},{name:"dotBH",type:"float",qualifier:"in"}]}),AV=me(({lightDirection:i,f0:e,f90:t,roughness:n,f:r,normalView:s=hi,USE_IRIDESCENCE:o,USE_ANISOTROPY:a})=>{let l=n.pow2(),c=i.add(er).normalize(),u=s.dot(i).clamp(),f=s.dot(er).clamp(),d=s.dot(c).clamp(),A=er.dot(c).clamp(),y=_x({f0:e,f90:t,dotVH:A}),w,S;if(dx(o)&&(y=xI.mix(y,r)),dx(a)){let T=aS.dot(i),R=aS.dot(er),P=aS.dot(c),I=$g.dot(i),F=$g.dot(er),D=$g.dot(c);w=D3e({alphaT:l4,alphaB:l,dotTV:R,dotBV:F,dotTL:T,dotBL:I,dotNV:f,dotNL:u}),S=F3e({alphaT:l4,alphaB:l,dotNH:d,dotTH:P,dotBH:D})}else w=lse({alpha:l,dotNL:u,dotNV:f}),S=cse({alpha:l,dotNH:d});return y.mul(w).mul(S)}),B3e=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]),hf=null,yS=me(({roughness:i,dotNV:e})=>{hf===null&&(hf=new jA(B3e,16,16,js,Wi),hf.name="DFG_LUT",hf.minFilter=Mi,hf.magFilter=Mi,hf.wrapS=aa,hf.wrapT=aa,hf.generateMipmaps=!1,hf.needsUpdate=!0);let t=dt(i,e);return fi(hf,t).rg}),O3e=me(({lightDirection:i,f0:e,f90:t,roughness:n,f:r,USE_IRIDESCENCE:s,USE_ANISOTROPY:o})=>{let a=AV({lightDirection:i,f0:e,f90:t,roughness:n,f:r,USE_IRIDESCENCE:s,USE_ANISOTROPY:o}),l=hi.dot(i).clamp(),c=hi.dot(er).clamp(),u=yS({roughness:n,dotNV:c}),f=yS({roughness:n,dotNV:l}),d=e.mul(u.x).add(t.mul(u.y)),A=e.mul(f.x).add(t.mul(f.y)),y=u.x.add(u.y),w=f.x.add(f.y),S=oe(1).sub(y),T=oe(1).sub(w),R=e.add(e.oneMinus().mul(.047619)),P=d.mul(A).mul(R).div(oe(1).sub(S.mul(T).mul(R).mul(R)).add(wI)),I=S.mul(T),F=P.mul(I);return a.add(F)}),use=me(i=>{let{dotNV:e,specularColor:t,specularF90:n,roughness:r}=i,s=yS({dotNV:e,roughness:r});return t.mul(s.x).add(n.mul(s.y))}),E7=me(({f:i,f90:e,dotVH:t})=>{let n=t.oneMinus().saturate(),r=n.mul(n),s=n.mul(r,r).clamp(0,.9999);return i.sub(pe(e).mul(s)).div(s.oneMinus())}).setLayout({name:"Schlick_to_F0",type:"vec3",inputs:[{name:"f",type:"vec3"},{name:"f90",type:"float"},{name:"dotVH",type:"float"}]}),U3e=me(({roughness:i,dotNH:e})=>{let t=i.pow2(),n=oe(1).div(t),s=e.pow2().oneMinus().max(.0078125);return oe(2).add(n).mul(s.pow(n.mul(.5))).div(2*Math.PI)}).setLayout({name:"D_Charlie",type:"float",inputs:[{name:"roughness",type:"float"},{name:"dotNH",type:"float"}]}),k3e=me(({dotNV:i,dotNL:e})=>oe(1).div(oe(4).mul(e.add(i).sub(e.mul(i))))).setLayout({name:"V_Neubelt",type:"float",inputs:[{name:"dotNV",type:"float"},{name:"dotNL",type:"float"}]}),z3e=me(({lightDirection:i})=>{let e=i.add(er).normalize(),t=hi.dot(i).clamp(),n=hi.dot(er).clamp(),r=hi.dot(e).clamp(),s=U3e({roughness:lm,dotNH:r}),o=k3e({dotNV:n,dotNL:t});return cc.mul(s).mul(o)}),Kee=me(({N:i,V:e,roughness:t})=>{let s=.0078125,o=i.dot(e).saturate(),a=dt(t,o.oneMinus().sqrt());return a.assign(a.mul(.984375).add(s)),a}).setLayout({name:"LTC_Uv",type:"vec2",inputs:[{name:"N",type:"vec3"},{name:"V",type:"vec3"},{name:"roughness",type:"float"}]}),V3e=me(({f:i})=>{let e=i.length();return zr(e.mul(e).add(i.z).div(e.add(1)),0)}).setLayout({name:"LTC_ClippedSphereFormFactor",type:"float",inputs:[{name:"f",type:"vec3"}]}),yR=me(({v1:i,v2:e})=>{let t=i.dot(e),n=t.abs().toVar(),r=n.mul(.0145206).add(.4965155).mul(n).add(.8543985).toVar(),s=n.add(4.1616724).mul(n).add(3.417594).toVar(),o=r.div(s),a=t.greaterThan(0).select(o,zr(t.mul(t).oneMinus(),1e-7).inverseSqrt().mul(.5).sub(o));return i.cross(e).mul(a)}).setLayout({name:"LTC_EdgeVectorFormFactor",type:"vec3",inputs:[{name:"v1",type:"vec3"},{name:"v2",type:"vec3"}]}),qO=me(({N:i,V:e,P:t,mInv:n,p0:r,p1:s,p2:o,p3:a})=>{let l=s.sub(r).toVar(),c=a.sub(r).toVar(),u=l.cross(c),f=pe().toVar();return $t(u.dot(t.sub(r)).greaterThanEqual(0),()=>{let d=e.sub(i.mul(e.dot(i))).normalize(),A=i.cross(d).negate(),y=n.mul(To(d,A,i).transpose()).toVar(),w=y.mul(r.sub(t)).normalize().toVar(),S=y.mul(s.sub(t)).normalize().toVar(),T=y.mul(o.sub(t)).normalize().toVar(),R=y.mul(a.sub(t)).normalize().toVar(),P=pe(0).toVar();P.addAssign(yR({v1:w,v2:S})),P.addAssign(yR({v1:S,v2:T})),P.addAssign(yR({v1:T,v2:R})),P.addAssign(yR({v1:R,v2:w})),f.assign(pe(V3e({f:P})))}),f}).setLayout({name:"LTC_Evaluate",type:"vec3",inputs:[{name:"N",type:"vec3"},{name:"V",type:"vec3"},{name:"P",type:"vec3"},{name:"mInv",type:"mat3"},{name:"p0",type:"vec3"},{name:"p1",type:"vec3"},{name:"p2",type:"vec3"},{name:"p3",type:"vec3"}]});var BI=1/6,hse=i=>Tn(BI,Tn(i,Tn(i,i.negate().add(3)).sub(3)).add(1)),M7=i=>Tn(BI,Tn(i,Tn(i,Tn(3,i).sub(6))).add(4)),fse=i=>Tn(BI,Tn(i,Tn(i,Tn(-3,i).add(3)).add(3)).add(1)),C7=i=>Tn(BI,iu(i,3)),Qee=i=>hse(i).add(M7(i)),Jee=i=>fse(i).add(C7(i)),ete=i=>Ls(-1,M7(i).div(hse(i).add(M7(i)))),tte=i=>Ls(1,C7(i).div(fse(i).add(C7(i)))),nte=(i,e,t)=>{let n=i.uvNode,r=Tn(n,e.zw).add(.5),s=xf(r),o=Zu(r),a=Qee(o.x),l=Jee(o.x),c=ete(o.x),u=tte(o.x),f=ete(o.y),d=tte(o.y),A=dt(s.x.add(c),s.y.add(f)).sub(.5).mul(e.xy),y=dt(s.x.add(u),s.y.add(f)).sub(.5).mul(e.xy),w=dt(s.x.add(c),s.y.add(d)).sub(.5).mul(e.xy),S=dt(s.x.add(u),s.y.add(d)).sub(.5).mul(e.xy),T=Qee(o.y).mul(Ls(a.mul(i.sample(A).level(t)),l.mul(i.sample(y).level(t)))),R=Jee(o.y).mul(Ls(a.mul(i.sample(w).level(t)),l.mul(i.sample(S).level(t))));return T.add(R)},gV=me(([i,e])=>{let t=dt(i.size(de(e))),n=dt(i.size(de(e.add(1)))),r=pc(1,t),s=pc(1,n),o=nte(i,Ft(r,t),xf(e)),a=nte(i,Ft(s,n),TI(e));return Zu(e).mix(o,a)}),G3e=me(([i,e])=>{let t=e.mul(Hz(i));return gV(i,t)}),ite=me(([i,e,t,n,r])=>{let s=pe(Dz(e.negate(),xa(i),pc(1,n))),o=pe(yf(r[0].xyz),yf(r[1].xyz),yf(r[2].xyz));return xa(s).mul(t.mul(o))}).setLayout({name:"getVolumeTransmissionRay",type:"vec3",inputs:[{name:"n",type:"vec3"},{name:"v",type:"vec3"},{name:"thickness",type:"float"},{name:"ior",type:"float"},{name:"modelMatrix",type:"mat4"}]}),q3e=me(([i,e])=>i.mul(Ku(e.mul(2).sub(2),0,1))).setLayout({name:"applyIorToRoughness",type:"float",inputs:[{name:"roughness",type:"float"},{name:"ior",type:"float"}]}),H3e=uV(),W3e=Jre(),rte=me(([i,e,t],{material:n})=>{let s=(n.side===mi?H3e:W3e).sample(i),o=_f(i1.x).mul(q3e(e,t));return gV(s,o)}),ste=me(([i,e,t])=>($t(t.notEqual(0),()=>{let n=SI(e).negate().div(t);return xz(n.negate().mul(i))}),pe(1))).setLayout({name:"volumeAttenuation",type:"vec3",inputs:[{name:"transmissionDistance",type:"float"},{name:"attenuationColor",type:"vec3"},{name:"attenuationDistance",type:"float"}]}),j3e=me(([i,e,t,n,r,s,o,a,l,c,u,f,d,A,y])=>{let w,S;if(y){w=Ft().toVar(),S=pe().toVar();let F=u.sub(1).mul(y.mul(.025)),D=pe(u.sub(F),u,u.add(F));Oi({start:0,end:3},({i:L})=>{let C=D.element(L),B=ite(i,e,f,C,a),k=o.add(B),z=c.mul(l.mul(Ft(k,1))),G=dt(z.xy.div(z.w)).toVar();G.addAssign(1),G.divAssign(2),G.assign(dt(G.x,G.y.oneMinus()));let W=rte(G,t,C);w.element(L).assign(W.element(L)),w.a.addAssign(W.a),S.element(L).assign(n.element(L).mul(ste(yf(B),d,A).element(L)))}),w.a.divAssign(3)}else{let F=ite(i,e,f,u,a),D=o.add(F),L=c.mul(l.mul(Ft(D,1))),C=dt(L.xy.div(L.w)).toVar();C.addAssign(1),C.divAssign(2),C.assign(dt(C.x,C.y.oneMinus())),w=rte(C,t,u),S=n.mul(ste(yf(F),d,A))}let T=S.rgb.mul(w.rgb),R=i.dot(e).clamp(),P=pe(use({dotNV:R,specularColor:r,specularF90:s,roughness:t})),I=S.r.add(S.g,S.b).div(3);return Ft(P.oneMinus().mul(T),w.a.oneMinus().mul(I).oneMinus())}),X3e=To(3.2404542,-.969266,.0556434,-1.5371385,1.8760108,-.2040259,-.4985314,.041556,1.0572252),$3e=i=>{let e=i.sqrt();return pe(1).add(e).div(pe(1).sub(e))},ote=(i,e)=>i.sub(e).div(i.add(e)).pow2(),Y3e=(i,e)=>{let t=i.mul(2*Math.PI*1e-9),n=pe(54856e-17,44201e-17,52481e-17),r=pe(1681e3,1795300,2208400),s=pe(43278e5,93046e5,66121e5),o=oe(9747e-17*Math.sqrt(2*Math.PI*45282e5)).mul(t.mul(2239900).add(e.x).cos()).mul(t.pow2().mul(-45282e5).exp()),a=n.mul(s.mul(2*Math.PI).sqrt()).mul(r.mul(t).add(e).cos()).mul(t.pow2().negate().mul(s).exp());return a=pe(a.x.add(o),a.y,a.z).div(10685e-11),X3e.mul(a)},ate=me(({outsideIOR:i,eta2:e,cosTheta1:t,thinFilmThickness:n,baseF0:r})=>{let s=Qn(i,e,mc(0,.03,n)),a=i.div(s).pow2().mul(t.pow2().oneMinus()).oneMinus();$t(a.lessThan(0),()=>pe(1));let l=a.sqrt(),c=ote(s,i),u=_x({f0:c,f90:1,dotVH:t}),f=u.oneMinus(),d=s.lessThan(i).select(Math.PI,0),A=oe(Math.PI).sub(d),y=$3e(r.clamp(0,.9999)),w=ote(y,s.toVec3()),S=_x({f0:w,f90:1,dotVH:l}),T=pe(y.x.lessThan(s).select(Math.PI,0),y.y.lessThan(s).select(Math.PI,0),y.z.lessThan(s).select(Math.PI,0)),R=s.mul(n,l,2),P=pe(A).add(T),I=u.mul(S).clamp(1e-5,.9999),F=I.sqrt(),D=f.pow2().mul(S).div(pe(1).sub(I)),C=u.add(D).toVar(),B=D.sub(f).toVar();return Oi({start:1,end:2,condition:"<=",name:"m"},({m:k})=>{B.mulAssign(F);let z=Y3e(oe(k).mul(R),oe(k).mul(P)).mul(2);C.addAssign(B.mul(z))}),C.max(pe(0))}).setLayout({name:"evalIridescence",type:"vec3",inputs:[{name:"outsideIOR",type:"float"},{name:"eta2",type:"float"},{name:"cosTheta1",type:"float"},{name:"thinFilmThickness",type:"float"},{name:"baseF0",type:"vec3"}]}),Vw=me(({normal:i,viewDir:e,roughness:t})=>{let n=i.dot(e).saturate(),r=t.mul(t),s=t.add(.1).reciprocal(),o=oe(-1.9362).add(t.mul(1.0678)).add(r.mul(.4573)).sub(s.mul(.8469)),a=oe(-.6014).add(t.mul(.5538)).sub(r.mul(.467)).sub(s.mul(.1255));return o.mul(n).add(a).exp().saturate()}),Gw=pe(.04),bR=oe(1),E4=class extends vx{constructor(e=!1,t=!1,n=!1,r=!1,s=!1,o=!1){super(),this.clearcoat=e,this.sheen=t,this.iridescence=n,this.anisotropy=r,this.transmission=s,this.dispersion=o,this.clearcoatRadiance=null,this.clearcoatSpecularDirect=null,this.clearcoatSpecularIndirect=null,this.sheenSpecularDirect=null,this.sheenSpecularIndirect=null,this.iridescenceFresnel=null,this.iridescenceF0=null,this.iridescenceF0Dielectric=null,this.iridescenceF0Metallic=null}start(e){if(this.clearcoat===!0&&(this.clearcoatRadiance=pe().toVar("clearcoatRadiance"),this.clearcoatSpecularDirect=pe().toVar("clearcoatSpecularDirect"),this.clearcoatSpecularIndirect=pe().toVar("clearcoatSpecularIndirect")),this.sheen===!0&&(this.sheenSpecularDirect=pe().toVar("sheenSpecularDirect"),this.sheenSpecularIndirect=pe().toVar("sheenSpecularIndirect")),this.iridescence===!0){let t=hi.dot(er).clamp(),n=ate({outsideIOR:oe(1),eta2:o4,cosTheta1:t,thinFilmThickness:a4,baseF0:vm}),r=ate({outsideIOR:oe(1),eta2:o4,cosTheta1:t,thinFilmThickness:a4,baseF0:Bi.rgb});this.iridescenceFresnel=Qn(n,r,Zd),this.iridescenceF0Dielectric=E7({f:n,f90:1,dotVH:t}),this.iridescenceF0Metallic=E7({f:r,f90:1,dotVH:t}),this.iridescenceF0=Qn(this.iridescenceF0Dielectric,this.iridescenceF0Metallic,Zd)}if(this.transmission===!0){let t=bf,n=Gie.sub(bf).normalize(),r=Tm,s=e.context;s.backdrop=j3e(r,n,gf,Vg,qg,Hg,t,ru,Sm,Ja,lS,mz,gz,Az,this.dispersion?vz:null),s.backdropAlpha=u4,Bi.a.mulAssign(Qn(1,s.backdrop.a,u4))}super.start(e)}computeMultiscattering(e,t,n,r,s=null){let o=hi.dot(er).clamp(),a=yS({roughness:gf,dotNV:o}),l=s?xI.mix(r,s):r,c=l.mul(a.x).add(n.mul(a.y)),f=a.x.add(a.y).oneMinus(),d=l.add(l.oneMinus().mul(.047619)),A=c.mul(d).div(f.mul(d).oneMinus());e.addAssign(c),t.addAssign(A.mul(f))}direct({lightDirection:e,lightColor:t,reflectedLight:n}){let s=hi.dot(e).clamp().mul(t).toVar();if(this.sheen===!0){this.sheenSpecularDirect.addAssign(s.mul(z3e({lightDirection:e})));let o=Vw({normal:hi,viewDir:er,roughness:lm}),a=Vw({normal:hi,viewDir:e,roughness:lm}),l=cc.r.max(cc.g).max(cc.b).mul(o.max(a)).oneMinus();s.mulAssign(l)}if(this.clearcoat===!0){let a=hm.dot(e).clamp().mul(t);this.clearcoatSpecularDirect.addAssign(a.mul(AV({lightDirection:e,f0:Gw,f90:bR,roughness:ax,normalView:hm})))}n.directDiffuse.addAssign(s.mul(s1({diffuseColor:Vg}))),n.directSpecular.addAssign(s.mul(O3e({lightDirection:e,f0:qg,f90:1,roughness:gf,f:this.iridescenceFresnel,USE_IRIDESCENCE:this.iridescence,USE_ANISOTROPY:this.anisotropy})))}directRectArea({lightColor:e,lightPosition:t,halfWidth:n,halfHeight:r,reflectedLight:s,ltc_1:o,ltc_2:a}){let l=t.add(n).sub(r),c=t.sub(n).sub(r),u=t.sub(n).add(r),f=t.add(n).add(r),d=hi,A=er,y=xs.toVar(),w=Kee({N:d,V:A,roughness:gf}),S=o.sample(w).toVar(),T=a.sample(w).toVar(),R=To(pe(S.x,0,S.y),pe(0,1,0),pe(S.z,0,S.w)).toVar(),P=qg.mul(T.x).add(Hg.sub(qg).mul(T.y)).toVar();if(s.directSpecular.addAssign(e.mul(P).mul(qO({N:d,V:A,P:y,mInv:R,p0:l,p1:c,p2:u,p3:f}))),s.directDiffuse.addAssign(e.mul(Vg).mul(qO({N:d,V:A,P:y,mInv:To(1,0,0,0,1,0,0,0,1),p0:l,p1:c,p2:u,p3:f}))),this.clearcoat===!0){let I=hm,F=Kee({N:I,V:A,roughness:ax}),D=o.sample(F),L=a.sample(F),C=To(pe(D.x,0,D.y),pe(0,1,0),pe(D.z,0,D.w)),B=Gw.mul(L.x).add(bR.sub(Gw).mul(L.y));this.clearcoatSpecularDirect.addAssign(e.mul(B).mul(qO({N:I,V:A,P:y,mInv:C,p0:l,p1:c,p2:u,p3:f})))}}indirect(e){this.indirectDiffuse(e),this.indirectSpecular(e),this.ambientOcclusion(e)}indirectDiffuse(e){let{irradiance:t,reflectedLight:n}=e.context,r=t.mul(s1({diffuseColor:Vg})).toVar();if(this.sheen===!0){let s=Vw({normal:hi,viewDir:er,roughness:lm}),o=cc.r.max(cc.g).max(cc.b).mul(s).oneMinus();r.mulAssign(o)}n.indirectDiffuse.addAssign(r)}indirectSpecular(e){let{radiance:t,iblIrradiance:n,reflectedLight:r}=e.context;if(this.sheen===!0&&this.sheenSpecularIndirect.addAssign(n.mul(cc,Vw({normal:hi,viewDir:er,roughness:lm}))),this.clearcoat===!0){let S=hm.dot(er).clamp(),T=use({dotNV:S,specularColor:Gw,specularF90:bR,roughness:ax});this.clearcoatSpecularIndirect.addAssign(this.clearcoatRadiance.mul(T))}let s=pe().toVar("singleScatteringDielectric"),o=pe().toVar("multiScatteringDielectric"),a=pe().toVar("singleScatteringMetallic"),l=pe().toVar("multiScatteringMetallic");this.computeMultiscattering(s,o,Hg,vm,this.iridescenceF0Dielectric),this.computeMultiscattering(a,l,Hg,Bi.rgb,this.iridescenceF0Metallic);let c=Qn(s,a,Zd),u=Qn(o,l,Zd),f=s.add(o),d=Vg.mul(f.oneMinus()),A=n.mul(1/Math.PI),y=t.mul(c).add(u.mul(A)).toVar(),w=d.mul(A).toVar();if(this.sheen===!0){let S=Vw({normal:hi,viewDir:er,roughness:lm}),T=cc.r.max(cc.g).max(cc.b).mul(S).oneMinus();y.mulAssign(T),w.mulAssign(T)}r.indirectSpecular.addAssign(y),r.indirectDiffuse.addAssign(w)}ambientOcclusion(e){let{ambientOcclusion:t,reflectedLight:n}=e.context,s=hi.dot(er).clamp().add(t),o=gf.mul(-16).oneMinus().negate().exp2(),a=t.sub(s.pow(o).oneMinus()).clamp();this.clearcoat===!0&&this.clearcoatSpecularIndirect.mulAssign(t),this.sheen===!0&&this.sheenSpecularIndirect.mulAssign(t),n.indirectDiffuse.mulAssign(t),n.indirectSpecular.mulAssign(a)}finish({context:e}){let{outgoingLight:t}=e;if(this.clearcoat===!0){let n=hm.dot(er).clamp(),r=_x({dotVH:n,f0:Gw,f90:bR}),s=t.mul(s4.mul(r).oneMinus()).add(this.clearcoatSpecularDirect.add(this.clearcoatSpecularIndirect).mul(s4));t.assign(s)}if(this.sheen===!0){let n=t.add(this.sheenSpecularDirect,this.sheenSpecularIndirect.mul(1/Math.PI));t.assign(n)}}},lte=oe(1),R7=oe(-2),wR=oe(.8),HO=oe(-1),SR=oe(.4),WO=oe(2),TR=oe(.305),jO=oe(3),cte=oe(.21),Z3e=oe(4),ute=oe(4),K3e=oe(16),Q3e=me(([i])=>{let e=pe(fr(i)).toVar(),t=oe(-1).toVar();return $t(e.x.greaterThan(e.z),()=>{$t(e.x.greaterThan(e.y),()=>{t.assign(_a(i.x.greaterThan(0),0,3))}).Else(()=>{t.assign(_a(i.y.greaterThan(0),1,4))})}).Else(()=>{$t(e.z.greaterThan(e.y),()=>{t.assign(_a(i.z.greaterThan(0),2,5))}).Else(()=>{t.assign(_a(i.y.greaterThan(0),1,4))})}),t}).setLayout({name:"getFace",type:"float",inputs:[{name:"direction",type:"vec3"}]}),J3e=me(([i,e])=>{let t=dt().toVar();return $t(e.equal(0),()=>{t.assign(dt(i.z,i.y).div(fr(i.x)))}).ElseIf(e.equal(1),()=>{t.assign(dt(i.x.negate(),i.z.negate()).div(fr(i.y)))}).ElseIf(e.equal(2),()=>{t.assign(dt(i.x.negate(),i.y).div(fr(i.z)))}).ElseIf(e.equal(3),()=>{t.assign(dt(i.z.negate(),i.y).div(fr(i.x)))}).ElseIf(e.equal(4),()=>{t.assign(dt(i.x.negate(),i.z).div(fr(i.y)))}).Else(()=>{t.assign(dt(i.x,i.y).div(fr(i.z)))}),Tn(.5,t.add(1))}).setLayout({name:"getUV",type:"vec2",inputs:[{name:"direction",type:"vec3"},{name:"face",type:"float"}]}),eMe=me(([i])=>{let e=oe(0).toVar();return $t(i.greaterThanEqual(wR),()=>{e.assign(lte.sub(i).mul(HO.sub(R7)).div(lte.sub(wR)).add(R7))}).ElseIf(i.greaterThanEqual(SR),()=>{e.assign(wR.sub(i).mul(WO.sub(HO)).div(wR.sub(SR)).add(HO))}).ElseIf(i.greaterThanEqual(TR),()=>{e.assign(SR.sub(i).mul(jO.sub(WO)).div(SR.sub(TR)).add(WO))}).ElseIf(i.greaterThanEqual(cte),()=>{e.assign(TR.sub(i).mul(Z3e.sub(jO)).div(TR.sub(cte)).add(jO))}).Else(()=>{e.assign(oe(-2).mul(_f(Tn(1.16,i))))}),e}).setLayout({name:"roughnessToMip",type:"float",inputs:[{name:"roughness",type:"float"}]}),dse=me(([i,e])=>{let t=i.toVar();t.assign(Tn(2,t).sub(1));let n=pe(t,1).toVar();return $t(e.equal(0),()=>{n.assign(n.zyx)}).ElseIf(e.equal(1),()=>{n.assign(n.xzy),n.xz.mulAssign(-1)}).ElseIf(e.equal(2),()=>{n.x.mulAssign(-1)}).ElseIf(e.equal(3),()=>{n.assign(n.zyx),n.xz.mulAssign(-1)}).ElseIf(e.equal(4),()=>{n.assign(n.xzy),n.xy.mulAssign(-1)}).ElseIf(e.equal(5),()=>{n.z.mulAssign(-1)}),n}).setLayout({name:"getDirection",type:"vec3",inputs:[{name:"uv",type:"vec2"},{name:"face",type:"float"}]}),pse=me(([i,e,t,n,r,s])=>{let o=oe(t),a=pe(e),l=Ku(eMe(o),R7,s),c=Zu(l),u=xf(l),f=pe(bS(i,a,u,n,r,s)).toVar();return $t(c.notEqual(0),()=>{let d=pe(bS(i,a,u.add(1),n,r,s)).toVar();f.assign(Qn(f,d,c))}),f}),bS=me(([i,e,t,n,r,s])=>{let o=oe(t).toVar(),a=pe(e),l=oe(Q3e(a)).toVar(),c=oe(zr(ute.sub(o),0)).toVar();o.assign(zr(o,ute));let u=oe(px(o)).toVar(),f=dt(J3e(a,l).mul(u.sub(2)).add(1)).toVar();return $t(l.greaterThan(2),()=>{f.y.addAssign(u),l.subAssign(3)}),f.x.addAssign(l.mul(u)),f.x.addAssign(c.mul(Tn(3,K3e))),f.y.addAssign(Tn(4,px(s).sub(u))),f.x.mulAssign(n),f.y.mulAssign(r),i.sample(f).grad(dt(),dt())}),XO=me(({envMap:i,mipInt:e,outputDirection:t,theta:n,axis:r,CUBEUV_TEXEL_WIDTH:s,CUBEUV_TEXEL_HEIGHT:o,CUBEUV_MAX_MIP:a})=>{let l=ju(n),c=t.mul(l).add(r.cross(t).mul(Ka(n))).add(r.mul(r.dot(t).mul(l.oneMinus())));return bS(i,c,e,s,o,a)}),mse=me(({n:i,latitudinal:e,poleAxis:t,outputDirection:n,weights:r,samples:s,dTheta:o,mipInt:a,envMap:l,CUBEUV_TEXEL_WIDTH:c,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:f})=>{let d=pe(_a(e,t,Qd(t,n))).toVar();$t(d.equal(pe(0)),()=>{d.assign(pe(n.z,0,n.x.negate()))}),d.assign(xa(d));let A=pe().toVar();return A.addAssign(r.element(0).mul(XO({theta:0,axis:d,outputDirection:n,mipInt:a,envMap:l,CUBEUV_TEXEL_WIDTH:c,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:f}))),Oi({start:de(1),end:i},({i:y})=>{$t(y.greaterThanEqual(s),()=>{Zre()});let w=oe(o.mul(oe(y))).toVar();A.addAssign(r.element(y).mul(XO({theta:w.mul(-1),axis:d,outputDirection:n,mipInt:a,envMap:l,CUBEUV_TEXEL_WIDTH:c,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:f}))),A.addAssign(r.element(y).mul(XO({theta:w,axis:d,outputDirection:n,mipInt:a,envMap:l,CUBEUV_TEXEL_WIDTH:c,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:f})))}),Ft(A,1)}),tMe=me(([i])=>{let e=rt(i).toVar();return e.assign(e.shiftLeft(rt(16)).bitOr(e.shiftRight(rt(16)))),e.assign(e.bitAnd(rt(1431655765)).shiftLeft(rt(1)).bitOr(e.bitAnd(rt(2863311530)).shiftRight(rt(1)))),e.assign(e.bitAnd(rt(858993459)).shiftLeft(rt(2)).bitOr(e.bitAnd(rt(3435973836)).shiftRight(rt(2)))),e.assign(e.bitAnd(rt(252645135)).shiftLeft(rt(4)).bitOr(e.bitAnd(rt(4042322160)).shiftRight(rt(4)))),e.assign(e.bitAnd(rt(16711935)).shiftLeft(rt(8)).bitOr(e.bitAnd(rt(4278255360)).shiftRight(rt(8)))),oe(e).mul(23283064365386963e-26)}),nMe=me(([i,e])=>dt(oe(i).div(oe(e)),tMe(i))),iMe=me(([i,e,t])=>{let n=t.mul(t).toConst(),r=pe(1,0,0).toConst(),s=Qd(e,r).toConst(),o=el(i.x).toConst(),a=Tn(2,3.14159265359).mul(i.y).toConst(),l=o.mul(ju(a)).toConst(),c=o.mul(Ka(a)).toVar(),u=Tn(.5,e.z.add(1)).toConst();c.assign(u.oneMinus().mul(el(l.mul(l).oneMinus())).add(u.mul(c)));let f=r.mul(l).add(s.mul(c)).add(e.mul(el(zr(0,l.mul(l).add(c.mul(c)).oneMinus()))));return xa(pe(n.mul(f.x),n.mul(f.y),zr(0,f.z)))}),Ase=me(({roughness:i,mipInt:e,envMap:t,N_immutable:n,GGX_SAMPLES:r,CUBEUV_TEXEL_WIDTH:s,CUBEUV_TEXEL_HEIGHT:o,CUBEUV_MAX_MIP:a})=>{let l=pe(n).toVar(),c=pe(0).toVar(),u=oe(0).toVar();return $t(i.lessThan(.001),()=>{c.assign(bS(t,l,e,s,o,a))}).Else(()=>{let f=_a(fr(l.z).lessThan(.999),pe(0,0,1),pe(1,0,0)),d=xa(Qd(f,l)).toVar(),A=Qd(l,d).toVar();Oi({start:rt(0),end:r},({i:y})=>{let w=nMe(y,r),S=iMe(w,pe(0,0,1),i),T=xa(d.mul(S.x).add(A.mul(S.y)).add(l.mul(S.z))),R=xa(T.mul(au(l,T).mul(2)).sub(l)),P=zr(au(l,R),0);$t(P.greaterThan(0),()=>{let I=bS(t,R,e,s,o,a);c.addAssign(I.mul(P)),u.addAssign(P)})}),$t(u.greaterThan(0),()=>{c.assign(c.div(u))})}),Ft(c,1)}),pm=4,hte=[.125,.215,.35,.446,.526,.582],Gg=20,rMe=512,qw=new Fu(-1,1,1,-1,0,1),sMe=new $r(90,1),fte=new zt,$O=null,YO=0,ZO=0,oMe=new re,M4=new WeakMap,aMe=[3,1,5,0,4,2],KO=dse(Ui(),fc("faceIndex")).normalize(),OI=pe(KO.x,KO.y,KO.z),I7=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._blurMaterial=null,this._ggxMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._backgroundBox=null}get _hasInitialized(){return this._renderer.hasInitialized()}fromScene(e,t=0,n=.1,r=100,s={}){let{size:o=256,position:a=oMe,renderTarget:l=null}=s;if(this._setSize(o),this._hasInitialized===!1)throw new Error('THREE.PMREMGenerator: .fromScene() called before the backend is initialized. Use "await renderer.init();" before using this method.');$O=this._renderer.getRenderTarget(),YO=this._renderer.getActiveCubeFace(),ZO=this._renderer.getActiveMipmapLevel();let c=l||this._allocateTarget(!0);return this._init(c),this._sceneToCubeUV(e,n,r,c,a),t>0&&this._blur(c,0,0,t),this._applyPMREM(c),this._cleanup(c),c}async fromSceneAsync(e,t=0,n=.1,r=100,s={}){return ni('PMREMGenerator: ".fromSceneAsync()" is deprecated. Use "await renderer.init()" instead.'),await this._renderer.init(),this.fromScene(e,t,n,r,s)}fromEquirectangular(e,t=null){if(this._hasInitialized===!1)throw new Error('THREE.PMREMGenerator: .fromEquirectangular() called before the backend is initialized. Use "await renderer.init();" before using this method.');return this._fromTexture(e,t)}async fromEquirectangularAsync(e,t=null){return ni('PMREMGenerator: ".fromEquirectangularAsync()" is deprecated. Use "await renderer.init()" instead.'),await this._renderer.init(),this._fromTexture(e,t)}fromCubemap(e,t=null){if(this._hasInitialized===!1)throw new Error('THREE.PMREMGenerator: .fromCubemap() called before the backend is initialized. Use "await renderer.init();" before using this method.');return this._fromTexture(e,t)}async fromCubemapAsync(e,t=null){return ni('PMREMGenerator: ".fromCubemapAsync()" is deprecated. Use "await renderer.init()" instead.'),await this._renderer.init(),this._fromTexture(e,t)}async compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=pte(),await this._compileMaterial(this._cubemapMaterial))}async compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=mte(),await this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSizeFromTexture(e){e.mapping===ec||e.mapping===Wc?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4)}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget($O,YO,ZO),e.scissorTest=!1,this._setViewport(e,0,0,e.width,e.height)}_fromTexture(e,t){this._setSizeFromTexture(e),$O=this._renderer.getRenderTarget(),YO=this._renderer.getActiveCubeFace(),ZO=this._renderer.getActiveMipmapLevel();let n=t||this._allocateTarget(!1);return this._init(n),this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTarget(e){let t=3*Math.max(this._cubeSize,112),n=4*this._cubeSize;return dte(t,n,e)}_init(e){if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e.width||this._pingPongRenderTarget.height!==e.height){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=dte(e.width,e.height);let{_lodMax:t}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=lMe(t)),this._blurMaterial=cMe(t,e.width,e.height),this._ggxMaterial=uMe(t,e.width,e.height)}}async _compileMaterial(e){let t=new Hn(new Xn,e);await this._renderer.compile(t,qw)}_sceneToCubeUV(e,t,n,r,s){let o=sMe;o.near=t,o.far=n;let a=[1,1,1,1,-1,1],l=[1,-1,1,-1,1,-1],c=this._renderer,u=c.autoClear;c.getClearColor(fte),c.autoClear=!1,this._backgroundBox===null&&(this._backgroundBox=new Hn(new Nu,new fs({name:"PMREM.Background",side:mi,depthWrite:!1,depthTest:!1})));let f=this._backgroundBox,d=f.material,A=!1,y=e.background;y?y.isColor&&(d.color.copy(y),e.background=null,A=!0):(d.color.copy(fte),A=!0),c.setRenderTarget(r),c.clear(),A&&c.render(f,o);for(let w=0;w<6;w++){let S=w%3;S===0?(o.up.set(0,a[w],0),o.position.set(s.x,s.y,s.z),o.lookAt(s.x+l[w],s.y,s.z)):S===1?(o.up.set(0,0,a[w]),o.position.set(s.x,s.y,s.z),o.lookAt(s.x,s.y+l[w],s.z)):(o.up.set(0,a[w],0),o.position.set(s.x,s.y,s.z),o.lookAt(s.x,s.y,s.z+l[w]));let T=this._cubeSize;this._setViewport(r,S*T,w>2?T:0,T,T),c.render(e,o)}c.autoClear=u,e.background=y}_textureToCubeUV(e,t){let n=this._renderer,r=e.mapping===ec||e.mapping===Wc;r?this._cubemapMaterial===null&&(this._cubemapMaterial=pte(e)):this._equirectMaterial===null&&(this._equirectMaterial=mte(e));let s=r?this._cubemapMaterial:this._equirectMaterial;s.fragmentNode.value=e;let o=this._lodMeshes[0];o.material=s;let a=this._cubeSize;this._setViewport(t,0,0,3*a,2*a),n.setRenderTarget(t),n.render(o,qw)}_applyPMREM(e){let t=this._renderer,n=t.autoClear;t.autoClear=!1;let r=this._lodMeshes.length;for(let s=1;s<r;s++)this._applyGGXFilter(e,s-1,s);t.autoClear=n}_applyGGXFilter(e,t,n){let r=this._renderer,s=this._pingPongRenderTarget,o=this._ggxMaterial,a=this._lodMeshes[n];a.material=o;let l=M4.get(o),c=n/(this._lodMeshes.length-1),u=t/(this._lodMeshes.length-1),f=Math.sqrt(c*c-u*u),d=0+c*1.25,A=f*d,{_lodMax:y}=this,w=this._sizeLods[n],S=3*w*(n>y-pm?n-y+pm:0),T=4*(this._cubeSize-w);e.texture.frame=(e.texture.frame||0)+1,l.envMap.value=e.texture,l.roughness.value=A,l.mipInt.value=y-t,this._setViewport(s,S,T,3*w,2*w),r.setRenderTarget(s),r.render(a,qw),s.texture.frame=(s.texture.frame||0)+1,l.envMap.value=s.texture,l.roughness.value=0,l.mipInt.value=y-n,this._setViewport(e,S,T,3*w,2*w),r.setRenderTarget(e),r.render(a,qw)}_blur(e,t,n,r,s){let o=this._pingPongRenderTarget;this._halfBlur(e,o,t,n,r,"latitudinal",s),this._halfBlur(o,e,n,n,r,"longitudinal",s)}_halfBlur(e,t,n,r,s,o,a){let l=this._renderer,c=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&ze("blur direction must be either latitudinal or longitudinal!");let u=3,f=this._lodMeshes[r];f.material=c;let d=M4.get(c),A=this._sizeLods[n]-1,y=isFinite(s)?Math.PI/(2*A):2*Math.PI/(2*Gg-1),w=s/y,S=isFinite(s)?1+Math.floor(u*w):Gg;S>Gg&&Xe(`sigmaRadians, ${s}, is too large and will clip, as it requested ${S} samples when the maximum is set to ${Gg}`);let T=[],R=0;for(let L=0;L<Gg;++L){let C=L/w,B=Math.exp(-C*C/2);T.push(B),L===0?R+=B:L<S&&(R+=2*B)}for(let L=0;L<T.length;L++)T[L]=T[L]/R;e.texture.frame=(e.texture.frame||0)+1,d.envMap.value=e.texture,d.samples.value=S,d.weights.array=T,d.latitudinal.value=o==="latitudinal"?1:0,a&&(d.poleAxis.value=a);let{_lodMax:P}=this;d.dTheta.value=y,d.mipInt.value=P-n;let I=this._sizeLods[r],F=3*I*(r>P-pm?r-P+pm:0),D=4*(this._cubeSize-I);this._setViewport(t,F,D,3*I,2*I),l.setRenderTarget(t),l.render(f,qw)}_setViewport(e,t,n,r,s){this._renderer.isWebGLRenderer?(e.viewport.set(t,e.height-s-n,r,s),e.scissor.set(t,e.height-s-n,r,s)):(e.viewport.set(t,n,r,s),e.scissor.set(t,n,r,s))}};function lMe(i){let e=[],t=[],n=[],r=i,s=i-pm+1+hte.length;for(let o=0;o<s;o++){let a=Math.pow(2,r);e.push(a);let l=1/a;o>i-pm?l=hte[o-i+pm-1]:o===0&&(l=0),t.push(l);let c=1/(a-2),u=-c,f=1+c,d=[u,u,f,u,f,f,u,u,f,f,u,f],A=6,y=6,w=3,S=2,T=1,R=new Float32Array(w*y*A),P=new Float32Array(S*y*A),I=new Float32Array(T*y*A);for(let D=0;D<A;D++){let L=D%3*2/3-1,C=D>2?0:-1,B=[L,C,0,L+2/3,C,0,L+2/3,C+1,0,L,C,0,L+2/3,C+1,0,L,C+1,0],k=aMe[D];R.set(B,w*y*k),P.set(d,S*y*k);let z=[k,k,k,k,k,k];I.set(z,T*y*k)}let F=new Xn;F.setAttribute("position",new Hi(R,w)),F.setAttribute("uv",new Hi(P,S)),F.setAttribute("faceIndex",new Hi(I,T)),n.push(new Hn(F,null)),r>pm&&r--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function dte(i,e,t){let n={magFilter:Mi,minFilter:Mi,generateMipmaps:!1,type:Wi,format:Or,colorSpace:n0,depthBuffer:t},r=new Ba(i,e,n);return r.texture.mapping=kh,r.texture.name="PMREM.cubeUv",r.texture.isPMREMTexture=!0,r.scissorTest=!0,r}function UI(i){let e=new Ir;return e.depthTest=!1,e.depthWrite=!1,e.blending=ps,e.name=`PMREM_${i}`,e}function cMe(i,e,t){let n=Xo(new Array(Gg).fill(0)),r=Xt(new re(0,1,0)),s=Xt(0),o=oe(Gg),a=Xt(0),l=Xt(1),c=fi(),u=Xt(0),f=oe(1/e),d=oe(1/t),A=oe(i),y={n:o,latitudinal:a,weights:n,poleAxis:r,outputDirection:OI,dTheta:s,samples:l,envMap:c,mipInt:u,CUBEUV_TEXEL_WIDTH:f,CUBEUV_TEXEL_HEIGHT:d,CUBEUV_MAX_MIP:A},w=UI("blur");return w.fragmentNode=mse({...y,latitudinal:a.equal(1)}),M4.set(w,y),w}function uMe(i,e,t){let n=fi(),r=Xt(0),s=Xt(0),o=oe(1/e),a=oe(1/t),l=oe(i),c={envMap:n,roughness:r,mipInt:s,CUBEUV_TEXEL_WIDTH:o,CUBEUV_TEXEL_HEIGHT:a,CUBEUV_MAX_MIP:l},u=UI("ggx");return u.fragmentNode=Ase({...c,N_immutable:OI,GGX_SAMPLES:rt(rMe)}),M4.set(u,c),u}function pte(i){let e=UI("cubemap");return e.fragmentNode=Qa(i,OI),e}function mte(i){let e=UI("equirect");return e.fragmentNode=fi(i,pV(OI),0),e}var Ate=new WeakMap;function hMe(i){let e=Math.log2(i)-2,t=1/i;return{texelWidth:1/(3*Math.max(Math.pow(2,e),112)),texelHeight:t,maxMip:e}}function fMe(i,e,t){let n=dMe(e),r=n.get(i);if((r!==void 0?r.pmremVersion:-1)!==i.pmremVersion){let o=i.image;if(i.isCubeTexture)if(pMe(o))r=t.fromCubemap(i,r);else return null;else if(mMe(o))r=t.fromEquirectangular(i,r);else return null;if(r.pmremVersion=i.pmremVersion,n.has(i)===!1){let a=()=>{i.removeEventListener("dispose",a);let l=n.get(i);l!==void 0&&(l.dispose(),n.delete(i))};i.addEventListener("dispose",a)}n.set(i,r)}return r.texture}function dMe(i){let e=Ate.get(i);return e===void 0&&(e=new WeakMap,Ate.set(i,e)),e}var P7=class extends Rr{static get type(){return"PMREMNode"}constructor(e,t=null,n=null){super("vec3"),this._value=e,this._pmrem=null,this.uvNode=t,this.levelNode=n,this._generator=null;let r=new Hs;r.isRenderTargetTexture=!0,this._texture=fi(r),this._width=Xt(0),this._height=Xt(0),this._maxMip=Xt(0),this.updateBeforeType=yn.RENDER}set value(e){this._value=e,this._pmrem=null}get value(){return this._value}updateFromTexture(e){let t=hMe(e.image.height);this._texture.value=e,this._width.value=t.texelWidth,this._height.value=t.texelHeight,this._maxMip.value=t.maxMip}updateBefore(e){let t=this._pmrem,n=t?t.pmremVersion:-1,r=this._value;n!==r.pmremVersion&&(r.isPMREMTexture===!0||r.mapping===kh?t=r:t=fMe(r,e.renderer,this._generator),t!==null&&(this._pmrem=t,this.updateFromTexture(t)))}setup(e){this._generator===null&&(this._generator=new I7(e.renderer)),this.updateBefore(e);let t=this.uvNode;t===null&&e.context.getUV&&(t=e.context.getUV(this,e)),t=this._pmrem.isRenderTargetTexture?v4.mul(pe(t.x,t.y.negate(),t.z)):v4.mul(t);let n=this.levelNode;return n===null&&e.context.getTextureLevel&&(n=e.context.getTextureLevel(this)),pse(this._texture,t,n,this._width,this._height,this._maxMip)}dispose(){super.dispose(),this._generator!==null&&this._generator.dispose()}};function pMe(i){if(i==null)return!1;let e=0,t=6;for(let n=0;n<t;n++)i[n]!==void 0&&e++;return e===t}function mMe(i){return i==null?!1:i.height>0}var vV=$n(P7).setParameterLength(1,3),gte=new WeakMap,L7=class extends xm{static get type(){return"EnvironmentNode"}constructor(e=null){super(),this.envNode=e}setup(e){let{material:t}=e,n=this.envNode;if(n.isTextureNode||n.isMaterialReferenceNode){let f=n.isTextureNode?n.value:t[n.property],d=this._getPMREMNodeCache(e.renderer),A=d.get(f);A===void 0&&(A=vV(f),d.set(f,A)),n=A}let s=t.useAnisotropy===!0||t.anisotropy>0?fre:hi,o=n.context(vte(gf,s)).mul(QR),a=n.context(AMe(Tm)).mul(Math.PI).mul(QR),l=ux(o),c=ux(a);e.context.radiance.addAssign(l),e.context.iblIrradiance.addAssign(c);let u=e.context.lightingModel.clearcoatRadiance;if(u){let f=n.context(vte(ax,hm)).mul(QR),d=ux(f);u.addAssign(d)}}_getPMREMNodeCache(e){let t=gte.get(e);return t===void 0&&(t=new WeakMap,gte.set(e,t)),t}},vte=(i,e)=>{let t=null;return{getUV:()=>(t===null&&(t=er.negate().reflect(e),t=Pz(i).mix(t,e).normalize(),t=t.transformDirection(BS)),t),getTextureLevel:()=>i}},AMe=i=>({getUV:()=>i,getTextureLevel:()=>oe(1)}),gMe=new a_,C4=class extends Ir{static get type(){return"MeshStandardNodeMaterial"}constructor(e){super(),this.isMeshStandardNodeMaterial=!0,this.lights=!0,this.emissiveNode=null,this.metalnessNode=null,this.roughnessNode=null,this.setDefaultValues(gMe),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t===null&&e.environmentNode&&(t=e.environmentNode),t?new L7(t):null}setupLightingModel(){return new E4}setupSpecular(){let e=Qn(pe(.04),Bi.rgb,Zd);vm.assign(pe(.04)),qg.assign(e),Hg.assign(1)}setupVariants(){let e=this.metalnessNode?oe(this.metalnessNode):yre;Zd.assign(e);let t=this.roughnessNode?oe(this.roughnessNode):xre;t=mV({roughness:t}),gf.assign(t),this.setupSpecular(),Vg.assign(Bi.rgb.mul(e.oneMinus()))}},vMe=new J2,D7=class extends C4{static get type(){return"MeshPhysicalNodeMaterial"}constructor(e){super(),this.isMeshPhysicalNodeMaterial=!0,this.clearcoatNode=null,this.clearcoatRoughnessNode=null,this.clearcoatNormalNode=null,this.sheenNode=null,this.sheenRoughnessNode=null,this.iridescenceNode=null,this.iridescenceIORNode=null,this.iridescenceThicknessNode=null,this.specularIntensityNode=null,this.specularColorNode=null,this.iorNode=null,this.transmissionNode=null,this.thicknessNode=null,this.attenuationDistanceNode=null,this.attenuationColorNode=null,this.dispersionNode=null,this.anisotropyNode=null,this.setDefaultValues(vMe),this.setValues(e)}get useClearcoat(){return this.clearcoat>0||this.clearcoatNode!==null}get useIridescence(){return this.iridescence>0||this.iridescenceNode!==null}get useSheen(){return this.sheen>0||this.sheenNode!==null}get useAnisotropy(){return this.anisotropy>0||this.anisotropyNode!==null}get useTransmission(){return this.transmission>0||this.transmissionNode!==null}get useDispersion(){return this.dispersion>0||this.dispersionNode!==null}setupSpecular(){let e=this.iorNode?oe(this.iorNode):Fre;lS.assign(e),vm.assign(Il(Iz(lS.sub(1).div(lS.add(1))).mul(_re),pe(1)).mul(s7)),qg.assign(Qn(vm,Bi.rgb,Zd)),Hg.assign(Qn(s7,1,Zd))}setupLightingModel(){return new E4(this.useClearcoat,this.useSheen,this.useIridescence,this.useAnisotropy,this.useTransmission,this.useDispersion)}setupVariants(e){if(super.setupVariants(e),this.useClearcoat){let t=this.clearcoatNode?oe(this.clearcoatNode):wre,n=this.clearcoatRoughnessNode?oe(this.clearcoatRoughnessNode):Sre;s4.assign(t),ax.assign(mV({roughness:n}))}if(this.useSheen){let t=this.sheenNode?pe(this.sheenNode):Mre,n=this.sheenRoughnessNode?oe(this.sheenRoughnessNode):Cre;cc.assign(t),lm.assign(n)}if(this.useIridescence){let t=this.iridescenceNode?oe(this.iridescenceNode):Ire,n=this.iridescenceIORNode?oe(this.iridescenceIORNode):Pre,r=this.iridescenceThicknessNode?oe(this.iridescenceThicknessNode):Lre;xI.assign(t),o4.assign(n),a4.assign(r)}if(this.useAnisotropy){let t=(this.anisotropyNode?dt(this.anisotropyNode):Rre).toVar();am.assign(t.length()),$t(am.equal(0),()=>{t.assign(dt(1,0))}).Else(()=>{t.divAssign(dt(am)),am.assign(am.saturate())}),l4.assign(am.pow2().mix(gf.pow2(),1)),aS.assign(Wg[0].mul(t.x).add(Wg[1].mul(t.y))),$g.assign(Wg[1].mul(t.x).sub(Wg[0].mul(t.y)))}if(this.useTransmission){let t=this.transmissionNode?oe(this.transmissionNode):Dre,n=this.thicknessNode?oe(this.thicknessNode):Nre,r=this.attenuationDistanceNode?oe(this.attenuationDistanceNode):Bre,s=this.attenuationColorNode?pe(this.attenuationColorNode):Ore;if(u4.assign(t),mz.assign(n),Az.assign(r),gz.assign(s),this.useDispersion){let o=this.dispersionNode?oe(this.dispersionNode):kre;vz.assign(o)}}}setupClearcoatNormal(){return this.clearcoatNormalNode?pe(this.clearcoatNormalNode):Tre}setup(e){e.context.setupClearcoatNormal=()=>Zg(this.setupClearcoatNormal(e),"NORMAL","vec3"),super.setup(e)}};var _Me=me(({normal:i,lightDirection:e,builder:t})=>{let n=i.dot(e),r=dt(n.mul(.5).add(.5),0);if(t.material.gradientMap){let s=$d("gradientMap","texture").context({getUV:()=>r});return pe(s.r)}else{let s=r.fwidth().mul(.5);return Qn(pe(.7),pe(1),mc(oe(.7).sub(s.x),oe(.7).add(s.x),r.x))}}),N7=class extends vx{direct({lightDirection:e,lightColor:t,reflectedLight:n},r){let s=_Me({normal:II,lightDirection:e,builder:r}).mul(t);n.directDiffuse.addAssign(s.mul(s1({diffuseColor:Bi.rgb})))}indirect(e){let{ambientOcclusion:t,irradiance:n,reflectedLight:r}=e.context;r.indirectDiffuse.addAssign(n.mul(s1({diffuseColor:Bi}))),r.indirectDiffuse.mulAssign(t)}},xMe=new eb,F7=class extends Ir{static get type(){return"MeshToonNodeMaterial"}constructor(e){super(),this.isMeshToonNodeMaterial=!0,this.lights=!0,this.setDefaultValues(xMe),this.setValues(e)}setupLightingModel(){return new N7}},gse=me(()=>{let i=pe(er.z,0,er.x.negate()).normalize(),e=er.cross(i);return dt(i.dot(hi),e.dot(hi)).mul(.495).add(.5)}).once(["NORMAL","VERTEX"])().toVar("matcapUV"),yMe=new nb,B7=class extends Ir{static get type(){return"MeshMatcapNodeMaterial"}constructor(e){super(),this.isMeshMatcapNodeMaterial=!0,this.setDefaultValues(yMe),this.setValues(e)}setupVariants(e){let t=gse,n;e.material.matcap?n=$d("matcap","texture").context({getUV:()=>t}):n=pe(Qn(.2,.8,t.y)),Bi.rgb.mulAssign(n.rgb)}},O7=class extends Rr{static get type(){return"RotateNode"}constructor(e,t){super(),this.positionNode=e,this.rotationNode=t}generateNodeType(e){return this.positionNode.getNodeType(e)}setup(e){let{rotationNode:t,positionNode:n}=this;if(this.getNodeType(e)==="vec2"){let s=t.cos(),o=t.sin();return _I(s,o,o.negate(),s).mul(n)}else{let s=t,o=mm(Ft(1,0,0,0),Ft(0,ju(s.x),Ka(s.x).negate(),0),Ft(0,Ka(s.x),ju(s.x),0),Ft(0,0,0,1)),a=mm(Ft(ju(s.y),0,Ka(s.y),0),Ft(0,1,0,0),Ft(Ka(s.y).negate(),0,ju(s.y),0),Ft(0,0,0,1)),l=mm(Ft(ju(s.z),Ka(s.z).negate(),0,0),Ft(Ka(s.z),ju(s.z),0,0),Ft(0,0,1,0),Ft(0,0,0,1));return o.mul(a).mul(l).mul(Ft(n,1)).xyz}}},US=$n(O7).setParameterLength(2),bMe=new Lh,R4=class extends Ir{static get type(){return"SpriteNodeMaterial"}constructor(e){super(),this.isSpriteNodeMaterial=!0,this._useSizeAttenuation=!0,this.positionNode=null,this.rotationNode=null,this.scaleNode=null,this.transparent=!0,this.setDefaultValues(bMe),this.setValues(e)}setupPositionView(e){let{object:t,camera:n}=e,{positionNode:r,rotationNode:s,scaleNode:o,sizeAttenuation:a}=this,l=Tf.mul(pe(r||0)),c=dt(ru[0].xyz.length(),ru[1].xyz.length());o!==null&&(c=c.mul(dt(o))),n.isPerspectiveCamera&&a===!1&&(c=c.mul(l.z.negate()));let u=ga.xy;if(t.center&&t.center.isVector2===!0){let A=uEe("center","vec2",t);u=u.sub(A.sub(.5))}u=u.mul(c);let f=oe(s||Ere),d=US(u,f);return Ft(l.xy.add(d),l.zw)}get sizeAttenuation(){return this._useSizeAttenuation}set sizeAttenuation(e){this._useSizeAttenuation!==e&&(this._useSizeAttenuation=e,this.needsUpdate=!0)}},wMe=new l0,SMe=new Oe,U7=class extends R4{static get type(){return"PointsNodeMaterial"}constructor(e){super(),this.sizeNode=null,this.isPointsNodeMaterial=!0,this.setDefaultValues(wMe),this.setValues(e)}setupPositionView(){let{positionNode:e}=this;return Tf.mul(pe(e||Mr)).xyz}setupVertexSprite(e){let{material:t,camera:n}=e,{rotationNode:r,scaleNode:s,sizeNode:o,sizeAttenuation:a}=this,l=super.setupVertex(e);if(t.isNodeMaterial!==!0)return l;let c=o!==null?dt(o):Ure;c=c.mul(jz),n.isPerspectiveCamera&&a===!0&&(c=c.mul(TMe.div(xs.z.negate()))),s&&s.isNode&&(c=c.mul(dt(s)));let u=ga.xy;if(r&&r.isNode){let f=oe(r);u=US(u,f)}return u=u.mul(c),u=u.div(Xz.div(2)),u=u.mul(l.w),l=l.add(Ft(u,0,0)),l}setupVertex(e){return e.object.isPoints?super.setupVertex(e):this.setupVertexSprite(e)}get alphaToCoverage(){return this._useAlphaToCoverage}set alphaToCoverage(e){this._useAlphaToCoverage!==e&&(this._useAlphaToCoverage=e,this.needsUpdate=!0)}},TMe=Xt(1).onFrameUpdate(function({renderer:i}){let e=i.getSize(SMe);this.value=.5*e.y}),k7=class extends vx{constructor(){super(),this.shadowNode=oe(1).toVar("shadowMask")}direct({lightNode:e}){e.shadowNode!==null&&this.shadowNode.mulAssign(e.shadowNode)}finish({context:e}){Bi.a.mulAssign(this.shadowNode.oneMinus()),e.outgoingLight.rgb.assign(Bi.rgb)}},EMe=new Q2,z7=class extends Ir{static get type(){return"ShadowNodeMaterial"}constructor(e){super(),this.isShadowNodeMaterial=!0,this.lights=!0,this.transparent=!0,this.setDefaultValues(EMe),this.setValues(e)}setupLightingModel(){return new k7}},Tlt=ep("vec3"),Elt=ep("vec3"),Mlt=ep("vec3");var V7=class{constructor(e,t,n){this.renderer=e,this.nodes=t,this.info=n,this._context=typeof self<"u"?self:null,this._animationLoop=null,this._requestId=null}start(){let e=(t,n)=>{this._requestId=this._context.requestAnimationFrame(e),this.info.autoReset===!0&&this.info.reset(),this.nodes.nodeFrame.update(),this.info.frame=this.nodes.nodeFrame.frameId,this.renderer._inspector.begin(),this._animationLoop!==null&&this._animationLoop(t,n),this.renderer._inspector.finish()};e()}stop(){this._context!==null&&this._context.cancelAnimationFrame(this._requestId),this._requestId=null}getAnimationLoop(){return this._animationLoop}setAnimationLoop(e){this._animationLoop=e}getContext(){return this._context}setContext(e){this._context=e}dispose(){this.stop()}},Mf=class{constructor(){this.weakMaps={}}_getWeakMap(e){let t=e.length,n=this.weakMaps[t];return n===void 0&&(n=new WeakMap,this.weakMaps[t]=n),n}get(e){let t=this._getWeakMap(e);for(let n=0;n<e.length-1;n++)if(t=t.get(e[n]),t===void 0)return;return t.get(e[e.length-1])}set(e,t){let n=this._getWeakMap(e);for(let r=0;r<e.length-1;r++){let s=e[r];n.has(s)===!1&&n.set(s,new WeakMap),n=n.get(s)}return n.set(e[e.length-1],t),this}delete(e){let t=this._getWeakMap(e);for(let n=0;n<e.length-1;n++)if(t=t.get(e[n]),t===void 0)return!1;return t.delete(e[e.length-1])}},MMe=0,_te=new WeakMap;function CMe(i){let e=Object.keys(i),t=_te.get(i.constructor);if(t===void 0){t=[];let n=Object.getPrototypeOf(i);for(;n;){let r=Object.getOwnPropertyDescriptors(n);for(let s in r){let o=r[s];o&&typeof o.get=="function"&&t.push(s)}n=Object.getPrototypeOf(n)}_te.set(i.constructor,t)}for(let n=0;n<t.length;n++)e.push(t[n]);return e}var G7=class{constructor(e,t,n,r,s,o,a,l,c,u){this.id=MMe++,this._nodes=e,this._geometries=t,this.renderer=n,this.object=r,this.material=s,this.scene=o,this.camera=a,this.lightsNode=l,this.context=c,this.geometry=r.geometry,this.version=s.version,this.drawRange=null,this.attributes=null,this.attributesId=null,this.pipeline=null,this.group=null,this.vertexBuffers=null,this.drawParams=null,this.bundle=null,this.clippingContext=u,this.clippingContextCacheKey=u!==null?u.cacheKey:"",this.initialNodesCacheKey=this.getDynamicCacheKey(),this.initialCacheKey=this.getCacheKey(),this._nodeBuilderState=null,this._bindings=null,this._monitor=null,this._sourceMaterial=n._currentSourceMaterial,this.onDispose=null,this.isRenderObject=!0,this.onMaterialDispose=()=>{this.dispose()},this.onGeometryDispose=()=>{this.attributes=null,this.attributesId=null},this.material.addEventListener("dispose",this.onMaterialDispose),this.geometry.addEventListener("dispose",this.onGeometryDispose),this._sourceMaterial!==null&&this._sourceMaterial.addEventListener("dispose",this.onMaterialDispose)}updateClipping(e){this.clippingContext=e}get clippingNeedsUpdate(){return this.clippingContext===null||this.clippingContext.cacheKey===this.clippingContextCacheKey?!1:(this.clippingContextCacheKey=this.clippingContext.cacheKey,!0)}get hardwareClippingPlanes(){return this.getNodeBuilderState().hardwareClipping===!0?this.clippingContext.unionClippingCount:0}getNodeBuilderState(){return this._nodeBuilderState||(this._nodeBuilderState=this._nodes.getForRender(this))}getMonitor(){return this._monitor||(this._monitor=this.getNodeBuilderState().observer)}getBindings(){return this._bindings||(this._bindings=this.getNodeBuilderState().createBindings())}getBindingGroup(e){for(let t of this.getBindings())if(t.name===e)return t}getIndex(){return this._geometries.getIndex(this)}getIndirect(){return this._geometries.getIndirect(this)}getIndirectOffset(){return this._geometries.getIndirectOffset(this)}getChainArray(){return[this.object,this.material,this.context,this.lightsNode]}setGeometry(e){this.geometry=e,this.attributes=null,this.attributesId=null}getAttributes(){if(this.attributes!==null)return this.attributes;let e=this.getNodeBuilderState().nodeAttributes,t=this.geometry,n=[],r=new Set,s={};for(let o of e){let a;if(o.node&&o.node.attribute?a=o.node.attribute:(a=t.getAttribute(o.name),a!==void 0&&(a.isInterleavedBufferAttribute?s[o.name]=a.data.uuid:s[o.name]=a.id)),a===void 0)continue;n.push(a);let l=a.isInterleavedBufferAttribute?a.data:a;r.add(l)}return this.attributes=n,this.attributesId=s,this.vertexBuffers=Array.from(r.values()),n}getVertexBuffers(){return this.vertexBuffers===null&&this.getAttributes(),this.vertexBuffers}getDrawParameters(){let{object:e,material:t,geometry:n,group:r,drawRange:s}=this,o=this.drawParams||(this.drawParams={vertexCount:0,firstVertex:0,instanceCount:0,firstInstance:0}),a=this.getIndex(),l=a!==null,c=1;if(n.isInstancedBufferGeometry===!0?c=n.instanceCount:e.count!==void 0&&(c=Math.max(0,e.count)),c===0)return null;if(o.instanceCount=c,e.isBatchedMesh===!0)return o;let u=1;t.wireframe===!0&&!e.isPoints&&!e.isLineSegments&&!e.isLine&&!e.isLineLoop&&(u=2);let f=s.start*u,d=(s.start+s.count)*u;r!==null&&(f=Math.max(f,r.start*u),d=Math.min(d,(r.start+r.count)*u));let A=n.attributes.position,y=1/0;l?y=a.count:A!=null&&(y=A.count),f=Math.max(f,0),d=Math.min(d,y);let w=d-f;return w<0||w===1/0?null:(o.vertexCount=w,o.firstVertex=f,o)}getGeometryCacheKey(){let{geometry:e}=this,t="";for(let n of Object.keys(e.attributes).sort()){let r=e.attributes[n];t+=n+",",r.data&&(t+=r.data.stride+","),r.offset&&(t+=r.offset+","),r.itemSize&&(t+=r.itemSize+","),r.normalized&&(t+="n,")}for(let n of Object.keys(e.morphAttributes).sort()){let r=e.morphAttributes[n];t+="morph-"+n+",";for(let s=0,o=r.length;s<o;s++){let a=r[s];t+=a.id+","}}return e.index&&(t+="index,"),t}getMaterialCacheKey(){let{object:e,material:t,renderer:n}=this,r=t.customProgramCacheKey();for(let s of CMe(t)){if(/^(is[A-Z]|_)|^(visible|version|uuid|name|opacity|userData)$/.test(s))continue;let o=t[s],a;if(o!==null){let l=typeof o;l==="number"?s==="side"?a=String(o):a=o!==0?"1":"0":l==="object"?(a="{",o.isTexture&&(a+=o.mapping,n.backend.isWebGPUBackend===!0&&(a+=o.magFilter,a+=o.minFilter,a+=o.wrapS,a+=o.wrapT,a+=o.wrapR)),a+="}"):a=String(o)}else a=String(o);r+=a+","}return r+=this.clippingContextCacheKey+",",e.geometry&&(r+=this.getGeometryCacheKey()),e.skeleton&&(r+=e.skeleton.bones.length+","),e.isBatchedMesh&&(r+=e._matricesTexture.uuid+",",e._colorsTexture!==null&&(r+=e._colorsTexture.uuid+",")),(e.isInstancedMesh||e.count>1)&&(r+=e.uuid+","),r+=this.context.id+",",r+=e.receiveShadow+",",wx(r)}get needsGeometryUpdate(){if(this.geometry.id!==this.object.geometry.id)return!0;if(this.attributes!==null){let e=this.attributesId;for(let t in e){let n=this.geometry.getAttribute(t);if(n===void 0)return!0;let r=n.isInterleavedBufferAttribute?n.data.uuid:n.id;if(e[t]!==r)return!0}}return!1}get needsUpdate(){return this.initialNodesCacheKey!==this.getDynamicCacheKey()||this.clippingNeedsUpdate}getDynamicCacheKey(){let e=0;return this.material.isShadowPassMaterial!==!0&&(e=this._nodes.getCacheKey(this.scene,this.lightsNode)),this.camera.isArrayCamera&&(e=sS(e,this.camera.cameras.length)),this.object.receiveShadow&&(e=sS(e,1)),e=sS(e,this.renderer.contextNode.id,this.renderer.contextNode.version),e}getCacheKey(){return this.getMaterialCacheKey()+this.getDynamicCacheKey()}dispose(){this.material.removeEventListener("dispose",this.onMaterialDispose),this.geometry.removeEventListener("dispose",this.onGeometryDispose),this._sourceMaterial!==null&&this._sourceMaterial.removeEventListener("dispose",this.onMaterialDispose),this.onDispose()}},ff=[],q7=class{constructor(e,t,n,r,s,o){this.renderer=e,this.nodes=t,this.geometries=n,this.pipelines=r,this.bindings=s,this.info=o,this.chainMaps={}}get(e,t,n,r,s,o,a,l){let c=this.getChainMap(l);ff[0]=e,ff[1]=t,ff[2]=o,ff[3]=s;let u=c.get(ff);return u===void 0?(u=this.createRenderObject(this.nodes,this.geometries,this.renderer,e,t,n,r,s,o,a,l),c.set(ff,u)):(u.camera=r,u.updateClipping(a),u.needsGeometryUpdate&&u.setGeometry(e.geometry),(u.version!==t.version||u.needsUpdate)&&(u.initialCacheKey!==u.getCacheKey()?(u.dispose(),u=this.get(e,t,n,r,s,o,a,l)):u.version=t.version)),ff[0]=null,ff[1]=null,ff[2]=null,ff[3]=null,u}getChainMap(e="default"){return this.chainMaps[e]||(this.chainMaps[e]=new Mf)}dispose(){this.chainMaps={}}createRenderObject(e,t,n,r,s,o,a,l,c,u,f){let d=this.getChainMap(f),A=new G7(e,t,n,r,s,o,a,l,c,u);return A.onDispose=()=>{this.pipelines.delete(A),this.bindings.deleteForRender(A),this.nodes.delete(A),d.delete(A.getChainArray())},A}},Cf=class{constructor(){this.data=new WeakMap}get(e){let t=this.data.get(e);return t===void 0&&(t={},this.data.set(e,t)),t}delete(e){let t=null;return this.data.has(e)&&(t=this.data.get(e),this.data.delete(e)),t}has(e){return this.data.has(e)}dispose(){this.data=new WeakMap}},su={VERTEX:1,INDEX:2,STORAGE:3,INDIRECT:4},fm=16,RMe=211,IMe=212,H7=class extends Cf{constructor(e,t){super(),this.backend=e,this.info=t}delete(e){let t=super.delete(e);return t!==null&&(this.backend.destroyAttribute(e),this.info.destroyAttribute(e)),t}update(e,t){let n=this.get(e);if(n.version===void 0)t===su.VERTEX?(this.backend.createAttribute(e),this.info.createAttribute(e)):t===su.INDEX?(this.backend.createIndexAttribute(e),this.info.createIndexAttribute(e)):t===su.STORAGE?(this.backend.createStorageAttribute(e),this.info.createStorageAttribute(e)):t===su.INDIRECT&&(this.backend.createIndirectStorageAttribute(e),this.info.createIndirectStorageAttribute(e)),n.version=this._getBufferAttribute(e).version;else{let r=this._getBufferAttribute(e);(n.version<r.version||r.usage===dg)&&(this.backend.updateAttribute(e),n.version=r.version)}}_getBufferAttribute(e){return e.isInterleavedBufferAttribute&&(e=e.data),e}};function vse(i){return i.index!==null?i.index.version:i.attributes.position.version}function _se(i){return i.index!==null?i.index.id:i.attributes.position.id}function xte(i){let e=[],t=i.index,n=i.attributes.position;if(t!==null){let s=t.array;for(let o=0,a=s.length;o<a;o+=3){let l=s[o+0],c=s[o+1],u=s[o+2];e.push(l,c,c,u,u,l)}}else{let s=n.array;for(let o=0,a=s.length/3-1;o<a;o+=3){let l=o+0,c=o+1,u=o+2;e.push(l,c,c,u,u,l)}}let r=new(n.count>=65535?HA:qA)(e,1);return r.version=vse(i),r.__id=_se(i),r}var W7=class extends Cf{constructor(e,t){super(),this.attributes=e,this.info=t,this.wireframes=new WeakMap,this.attributeCall=new WeakMap,this._geometryDisposeListeners=new Map}has(e){let t=e.geometry;return super.has(t)&&this.get(t).initialized===!0}updateForRender(e){this.has(e)===!1&&this.initGeometry(e),this.updateAttributes(e)}initGeometry(e){let t=e.geometry,n=this.get(t);n.initialized=!0,this.info.memory.geometries++;let r=()=>{this.info.memory.geometries--;let s=t.index,o=e.getAttributes();s!==null&&this.attributes.delete(s);for(let l of o)this.attributes.delete(l);let a=this.wireframes.get(t);a!==void 0&&this.attributes.delete(a),t.removeEventListener("dispose",r),this._geometryDisposeListeners.delete(t)};t.addEventListener("dispose",r),this._geometryDisposeListeners.set(t,r)}updateAttributes(e){let t=e.getAttributes();for(let s of t)s.isStorageBufferAttribute||s.isStorageInstancedBufferAttribute?this.updateAttribute(s,su.STORAGE):this.updateAttribute(s,su.VERTEX);let n=this.getIndex(e);n!==null&&this.updateAttribute(n,su.INDEX);let r=e.geometry.indirect;r!==null&&this.updateAttribute(r,su.INDIRECT)}updateAttribute(e,t){let n=this.info.render.calls;e.isInterleavedBufferAttribute?this.attributeCall.get(e)===void 0?(this.attributes.update(e,t),this.attributeCall.set(e,n)):this.attributeCall.get(e.data)!==n&&(this.attributes.update(e,t),this.attributeCall.set(e.data,n),this.attributeCall.set(e,n)):this.attributeCall.get(e)!==n&&(this.attributes.update(e,t),this.attributeCall.set(e,n))}getIndirect(e){return e.geometry.indirect}getIndirectOffset(e){return e.geometry.indirectOffset}getIndex(e){let{geometry:t,material:n}=e,r=t.index;if(n.wireframe===!0){let s=this.wireframes,o=s.get(t);o===void 0?(o=xte(t),s.set(t,o)):(o.version!==vse(t)||o.__id!==_se(t))&&(this.attributes.delete(o),o=xte(t),s.set(t,o)),r=o}return r}dispose(){for(let[e,t]of this._geometryDisposeListeners.entries())e.removeEventListener("dispose",t);this._geometryDisposeListeners.clear()}},j7=class{constructor(){this.autoReset=!0,this.frame=0,this.calls=0,this.render={calls:0,frameCalls:0,drawCalls:0,triangles:0,points:0,lines:0,timestamp:0},this.compute={calls:0,frameCalls:0,timestamp:0},this.memory={attributes:0,attributesSize:0,geometries:0,indexAttributes:0,indexAttributesSize:0,indirectStorageAttributes:0,indirectStorageAttributesSize:0,programs:0,programsSize:0,readbackBuffers:0,readbackBuffersSize:0,renderTargets:0,storageAttributes:0,storageAttributesSize:0,textures:0,texturesSize:0,uniformBuffers:0,uniformBuffersSize:0,total:0},this.memoryMap=new Map}update(e,t,n){this.render.drawCalls++,e.isMesh||e.isSprite?this.render.triangles+=n*(t/3):e.isPoints?this.render.points+=n*t:e.isLineSegments?this.render.lines+=n*(t/2):e.isLine?this.render.lines+=n*(t-1):ze("WebGPUInfo: Unknown object type.")}reset(){this.render.drawCalls=0,this.render.frameCalls=0,this.compute.frameCalls=0,this.render.triangles=0,this.render.points=0,this.render.lines=0}dispose(){this.reset(),this.calls=0,this.render.calls=0,this.compute.calls=0,this.render.timestamp=0,this.compute.timestamp=0;for(let e in this.memory)this.memory[e]=0;this.memoryMap.clear()}createTexture(e){let t=this._getTextureMemorySize(e);this.memoryMap.set(e,t),this.memory.textures++,this.memory.total+=t,this.memory.texturesSize+=t}destroyTexture(e){let t=this.memoryMap.get(e)||0;this.memoryMap.delete(e),this.memory.textures--,this.memory.total-=t,this.memory.texturesSize-=t}_createAttribute(e,t){let n=this._getAttributeMemorySize(e);this.memoryMap.set(e,{size:n,type:t}),this.memory[t]++,this.memory.total+=n,this.memory[t+"Size"]+=n}createAttribute(e){this._createAttribute(e,"attributes")}createIndexAttribute(e){this._createAttribute(e,"indexAttributes")}createStorageAttribute(e){this._createAttribute(e,"storageAttributes")}createIndirectStorageAttribute(e){this._createAttribute(e,"indirectStorageAttributes")}destroyAttribute(e){let t=this.memoryMap.get(e);t&&(this.memoryMap.delete(e),this.memory[t.type]--,this.memory.total-=t.size,this.memory[t.type+"Size"]-=t.size)}createReadbackBuffer(e){let t=e.maxByteLength;this.memoryMap.set(e,{size:t,type:"readbackBuffers"}),this.memory.readbackBuffers++,this.memory.total+=t,this.memory.readbackBuffersSize+=t}destroyReadbackBuffer(e){let{size:t}=this.memoryMap.get(e);this.memoryMap.delete(e),this.memory.readbackBuffers--,this.memory.total-=t,this.memory.readbackBuffersSize-=t}createUniformBuffer(e){let t=e.byteLength;this.memoryMap.set(e,{size:t,type:"uniformBuffers"}),this.memory.uniformBuffers++,this.memory.total+=t,this.memory.uniformBuffersSize+=t}destroyUniformBuffer(e){let t=this.memoryMap.get(e);t&&(this.memoryMap.delete(e),this.memory.uniformBuffers--,this.memory.total-=t.size,this.memory.uniformBuffersSize-=t.size)}createProgram(e){let t=e.code.length;this.memoryMap.set(e,t),this.memory.programs++,this.memory.total+=t,this.memory.programsSize+=t}destroyProgram(e){let t=this.memoryMap.get(e)||0;this.memoryMap.delete(e),this.memory.programs--,this.memory.total-=t,this.memory.programsSize-=t}_getTextureMemorySize(e){if(e.isCompressedTexture)return 1;let t=1;e.type===zh||e.type===Ji?t=1:e.type===Vh||e.type===wl||e.type===Wi?t=2:(e.type===Zr||e.type===xi||e.type===cr)&&(t=4);let n=4;e.format===f_||e.format===Bd||e.format===Gh||e.format===Gs||e.format===xo?n=1:e.format===js||e.format===qh?n=2:(e.format===Fd||e.format===Nb)&&(n=3);let r=t*n;e.type===rg||e.type===sg?r=2:(e.type===ca||e.type===og||e.type===ag)&&(r=4);let s=e.width||1,o=e.height||1,a=e.isCubeTexture?6:e.depth||1,l=s*o*a*r,c=e.mipmaps;if(c&&c.length>0){let u=0;for(let f=0;f<c.length;f++){let d=c[f];if(d.data)u+=d.data.byteLength;else{let A=d.width||Math.max(1,s>>f),y=d.height||Math.max(1,o>>f);u+=A*y*a*r}}l+=u}else e.generateMipmaps&&(l=l*1.333);return Math.round(l)}_getAttributeMemorySize(e){return e.isInterleavedBufferAttribute&&(e=e.data),e.array?e.array.byteLength:e.count&&e.itemSize?e.count*e.itemSize*4:0}},I4=class{constructor(e){this.cacheKey=e,this.usedTimes=0}},X7=class extends I4{constructor(e,t,n){super(e),this.vertexProgram=t,this.fragmentProgram=n}},$7=class extends I4{constructor(e,t){super(e),this.computeProgram=t,this.isComputePipeline=!0}},PMe=0,hS=class{constructor(e,t,n,r=null,s=null){this.id=PMe++,this.code=e,this.stage=t,this.name=n,this.transforms=r,this.attributes=s,this.usedTimes=0}},Y7=class extends Cf{constructor(e,t,n){super(),this.backend=e,this.nodes=t,this.info=n,this.bindings=null,this.caches=new Map,this.programs={vertex:new Map,fragment:new Map,compute:new Map}}getForCompute(e,t){let{backend:n}=this,r=this.get(e);if(this._needsComputeUpdate(e)){let s=r.pipeline;s&&(s.usedTimes--,s.computeProgram.usedTimes--);let o=this.nodes.getForCompute(e),a=this.programs.compute.get(o.computeShader);a===void 0&&(s&&s.computeProgram.usedTimes===0&&this._releaseProgram(s.computeProgram),a=new hS(o.computeShader,"compute",e.name,o.transforms,o.nodeAttributes),this.programs.compute.set(o.computeShader,a),n.createProgram(a),this.info.createProgram(a));let l=this._getComputeCacheKey(e,a),c=this.caches.get(l);c===void 0&&(s&&s.usedTimes===0&&this._releasePipeline(s),c=this._getComputePipeline(e,a,l,t)),c.usedTimes++,a.usedTimes++,r.version=e.version,r.pipeline=c}return r.pipeline}getForRender(e,t=null){let{backend:n}=this,r=this.get(e);if(this._needsRenderUpdate(e)){let s=r.pipeline;s&&(s.usedTimes--,s.vertexProgram.usedTimes--,s.fragmentProgram.usedTimes--);let o=e.getNodeBuilderState(),a=e.material?e.material.name:"",l=this.programs.vertex.get(o.vertexShader);l===void 0&&(s&&s.vertexProgram.usedTimes===0&&this._releaseProgram(s.vertexProgram),l=new hS(o.vertexShader,"vertex",a),this.programs.vertex.set(o.vertexShader,l),n.createProgram(l),this.info.createProgram(l));let c=this.programs.fragment.get(o.fragmentShader);c===void 0&&(s&&s.fragmentProgram.usedTimes===0&&this._releaseProgram(s.fragmentProgram),c=new hS(o.fragmentShader,"fragment",a),this.programs.fragment.set(o.fragmentShader,c),n.createProgram(c),this.info.createProgram(c));let u=this._getRenderCacheKey(e,l,c),f=this.caches.get(u);f===void 0?(s&&s.usedTimes===0&&this._releasePipeline(s),f=this._getRenderPipeline(e,l,c,u,t)):e.pipeline=f,f.usedTimes++,l.usedTimes++,c.usedTimes++,r.pipeline=f}return r.pipeline}isReady(e){let n=this.get(e).pipeline;if(n===void 0)return!1;let r=this.backend.get(n);return r.pipeline!==void 0&&r.pipeline!==null}delete(e){let t=this.get(e).pipeline;return t&&(t.usedTimes--,t.usedTimes===0&&this._releasePipeline(t),t.isComputePipeline?(t.computeProgram.usedTimes--,t.computeProgram.usedTimes===0&&this._releaseProgram(t.computeProgram)):(t.fragmentProgram.usedTimes--,t.vertexProgram.usedTimes--,t.vertexProgram.usedTimes===0&&this._releaseProgram(t.vertexProgram),t.fragmentProgram.usedTimes===0&&this._releaseProgram(t.fragmentProgram))),super.delete(e)}dispose(){super.dispose(),this.caches=new Map,this.programs={vertex:new Map,fragment:new Map,compute:new Map}}updateForRender(e){this.getForRender(e)}_getComputePipeline(e,t,n,r){n=n||this._getComputeCacheKey(e,t);let s=this.caches.get(n);return s===void 0&&(s=new $7(n,t),this.caches.set(n,s),this.backend.createComputePipeline(s,r)),s}_getRenderPipeline(e,t,n,r,s){r=r||this._getRenderCacheKey(e,t,n);let o=this.caches.get(r);return o===void 0&&(o=new X7(r,t,n),this.caches.set(r,o),e.pipeline=o,this.backend.createRenderPipeline(e,s)),o}_getComputeCacheKey(e,t){return e.id+","+t.id}_getRenderCacheKey(e,t,n){return t.id+","+n.id+","+this.backend.getRenderCacheKey(e)}_releasePipeline(e){this.caches.delete(e.cacheKey)}_releaseProgram(e){let t=e.code,n=e.stage;this.programs[n].delete(t),this.info.destroyProgram(e)}_needsComputeUpdate(e){let t=this.get(e);return t.pipeline===void 0||t.version!==e.version}_needsRenderUpdate(e){return this.get(e).pipeline===void 0||this.backend.needsRenderUpdate(e)}},Z7=class extends Cf{constructor(e,t,n,r,s,o){super(),this.backend=e,this.textures=n,this.pipelines=s,this.attributes=r,this.nodes=t,this.info=o,this.pipelines.bindings=this}getForRender(e){let t=e.getBindings(),n=this.get(e);return n.initialized!==!0&&(this._createBindings(t),n.initialized=!0),t}getForCompute(e){let t=this.nodes.getForCompute(e).bindings,n=this.get(e);return(n.initialized!==!0||n.bindings!==t)&&(n.bindings!==void 0&&this._destroyBindings(n.bindings),this._createBindings(t),n.initialized=!0,n.bindings=t),t}updateForCompute(e){this._updateBindings(this.getForCompute(e))}updateForRender(e){this._updateBindings(this.getForRender(e))}deleteForCompute(e){let n=this.get(e).bindings||this.nodes.getForCompute(e).bindings;this._destroyBindings(n),this.delete(e)}deleteForRender(e){let t=e.getBindings();this._destroyBindings(t),this.delete(e)}_createBindings(e){for(let t of e){let n=this.get(t);if(n.bindGroup===void 0){for(let r of t.bindings)if(r.isUniformBuffer)this.backend.createUniformBuffer(r),this.info.createUniformBuffer(r);else if(r.isSampledTexture)this.textures.updateTexture(r.texture);else if(r.isSampler)this.textures.updateSampler(r);else if(r.isStorageBuffer){let s=r.attribute,o=s.isIndirectStorageBufferAttribute?su.INDIRECT:su.STORAGE;this.attributes.update(s,o)}this.backend.createBindings(t,e,0),n.bindGroup=t,n.usedTimes=1}else n.usedTimes++}}_destroyBindings(e){for(let t of e){let n=this.get(t);if(n.usedTimes--,n.usedTimes===0){for(let r of t.bindings)r.isUniformBuffer?(this.backend.destroyUniformBuffer(r),this.info.destroyUniformBuffer(r),r.release()):r.isSampler&&(r.isSampledTexture!==!0&&this.backend.destroySampler(r),r.release());this.backend.deleteBindGroupData(t),this.delete(t)}}}_updateBindings(e){for(let t of e)this._update(t,e)}_update(e,t){let{backend:n}=this,r=!1,s=!0,o=0,a=0;for(let l of e.bindings)if(this.nodes.updateGroup(l)!==!1){if(l.isStorageBuffer){let u=l.attribute,f=u.isIndirectStorageBufferAttribute?su.INDIRECT:su.STORAGE,d=n.get(l);this.attributes.update(u,f),d.attribute!==u&&(d.attribute=u,r=!0)}if(l.isUniformBuffer)l.update()&&n.updateBinding(l);else if(l.isSampledTexture){let u=l.update(),f=l.texture,d=this.textures.get(f);if(u&&(this.textures.updateTexture(f),l.generation!==d.generation&&(l.generation=d.generation,r=!0),d.bindGroups.add(e)),n.get(f).externalTexture!==void 0||d.isDefaultTexture?s=!1:(o=o*10+f.id,a+=f.version),f.isStorageTexture===!0&&f.mipmapsAutoUpdate===!0){let y=this.get(f);l.store===!0?y.needsMipmap=!0:this.textures.needsMipmaps(f)&&y.needsMipmap===!0&&(this.backend.generateMipmaps(f),y.needsMipmap=!1)}}else if(l.isSampler&&l.update()){let f=this.textures.updateSampler(l);l.samplerKey!==f&&(l.samplerKey=f,r=!0)}l.isBuffer&&l.updateRanges.length>0&&l.clearUpdateRanges()}r===!0&&this.backend.updateBindings(e,t,s?o:0,a)}},LMe=Object.freeze([]);function DMe(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?i.z-e.z:i.id-e.id}function yte(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?e.z-i.z:i.id-e.id}function bte(i){return(i.transmission>0||i.transmissionNode&&i.transmissionNode.isNode)&&i.side===vr&&i.forceSinglePass===!1}var K7=class{constructor(e,t,n){this.renderItems=[],this.renderItemsIndex=0,this.opaque=[],this.transparentDoublePass=[],this.transparent=[],this.bundles=[],this.lighting=e,this.lightsNode=e.getNode(t),this.lightsArray=[],this.scene=t,this.camera=n,this.occlusionQueryCount=0,this._lastOcclusionObject=null}begin(){return this.renderItemsIndex=0,this.opaque.length=0,this.transparentDoublePass.length=0,this.transparent.length=0,this.bundles.length=0,this.lightsArray.length=0,this.occlusionQueryCount=0,this}getNextRenderItem(e,t,n,r,s,o,a){let l=this.renderItems[this.renderItemsIndex];return l===void 0?(l={id:e.id,object:e,geometry:t,material:n,groupOrder:r,renderOrder:e.renderOrder,z:s,group:o,clippingContext:a},this.renderItems[this.renderItemsIndex]=l):(l.id=e.id,l.object=e,l.geometry=t,l.material=n,l.groupOrder=r,l.renderOrder=e.renderOrder,l.z=s,l.group=o,l.clippingContext=a),this.renderItemsIndex++,l}push(e,t,n,r,s,o,a){let l=this.getNextRenderItem(e,t,n,r,s,o,a);e.occlusionTest===!0&&this._lastOcclusionObject!==e&&(this.occlusionQueryCount++,this._lastOcclusionObject=e),n.transparent===!0||n.transmission>0||n.transmissionNode&&n.transmissionNode.isNode||n.backdropNode&&n.backdropNode.isNode?(bte(n)&&this.transparentDoublePass.push(l),this.transparent.push(l)):this.opaque.push(l)}unshift(e,t,n,r,s,o,a){let l=this.getNextRenderItem(e,t,n,r,s,o,a);n.transparent===!0||n.transmission>0||n.transmissionNode&&n.transmissionNode.isNode||n.backdropNode&&n.backdropNode.isNode?(bte(n)&&this.transparentDoublePass.unshift(l),this.transparent.unshift(l)):this.opaque.unshift(l)}pushBundle(e){this.bundles.push(e)}pushLight(e){this.lightsArray.push(e)}sort(e,t,n){this.opaque.length>1&&this.opaque.sort(e||DMe),this.transparentDoublePass.length>1&&this.transparentDoublePass.sort(t||yte),this.transparent.length>1&&this.transparent.sort(t||yte),n&&(this.opaque.reverse(),this.transparentDoublePass.reverse(),this.transparent.reverse())}finish(){this.lightsNode.setLights(this.lighting.enabled?this.lightsArray:LMe);for(let e=this.renderItemsIndex,t=this.renderItems.length;e<t;e++){let n=this.renderItems[e];if(n.id===null)break;n.id=null,n.object=null,n.geometry=null,n.material=null,n.groupOrder=null,n.renderOrder=null,n.z=null,n.group=null,n.clippingContext=null}this._lastOcclusionObject=null}},q_=[],Q7=class{constructor(e){this.lighting=e,this.lists=new Mf}get(e,t){let n=this.lists;q_[0]=e,q_[1]=t;let r=n.get(q_);return r===void 0&&(r=new K7(this.lighting,e,t),n.set(q_,r)),q_[0]=null,q_[1]=null,r}dispose(){this.lists=new Mf}},NMe=0,J7=class{constructor(){this.id=NMe++,this.mrt=null,this.color=!0,this.clearColor=!0,this.clearColorValue={r:0,g:0,b:0,a:1},this.depth=!0,this.clearDepth=!0,this.clearDepthValue=1,this.stencil=!1,this.clearStencil=!0,this.clearStencilValue=1,this.viewport=!1,this.viewportValue=new xn,this.scissor=!1,this.scissorValue=new xn,this.renderTarget=null,this.textures=null,this.depthTexture=null,this.activeCubeFace=0,this.activeMipmapLevel=0,this.sampleCount=1,this.width=0,this.height=0,this.occlusionQueryCount=0,this.clippingContext=null,this.camera=null,this.isRenderContext=!0}getCacheKey(){return xse(this)}};function xse(i){let{textures:e,activeCubeFace:t,activeMipmapLevel:n}=i,r=[t,n];for(let s of e)r.push(s.id);return FS(r)}var ek=class{constructor(e){this.renderer=e,this._renderContexts={}}get(e=null,t=null,n=0){let r;if(e===null)r="default";else{let l=e.texture.format,c=e.texture.type;r=`${e.textures.length}:${l}:${c}:${e.samples}:${e.depthBuffer}:${e.stencilBuffer}`}let s=t!==null?t.id:"default",o=r+"-"+s+"-"+n,a=this._renderContexts[o];return a===void 0&&(a=new J7,a.mrt=t,this._renderContexts[o]=a),e!==null&&(a.sampleCount=e.samples===0?1:e.samples),a.clearDepthValue=this.renderer.getClearDepth(),a.clearStencilValue=this.renderer.getClearStencil(),a}dispose(){this._renderContexts={}}},FMe=new re,tk=class extends Cf{constructor(e,t,n){super(),this.renderer=e,this.backend=t,this.info=n,this._htmlTextures=new Set}updateRenderTarget(e,t=0){let n=this.get(e),r=e.samples===0?1:e.samples,s=n.depthTextureMips||(n.depthTextureMips={}),o=e.textures,a=this.getSize(o[0]),l=a.width>>t,c=a.height>>t,u=e.depthTexture||s[t],f=e.depthBuffer===!0||e.stencilBuffer===!0,d=!1,A=u!==void 0&&u.image!==void 0&&u.image.depth>1,y=a.depth>1&&(e.useArrayDepthTexture||e.multiview||A);u===void 0&&f&&(u=new Cs,u.format=e.stencilBuffer?xo:Gs,u.type=e.stencilBuffer?ca:xi,u.image.width=l,u.image.height=c,u.image.depth=a.depth,u.renderTarget=e,s[t]=u),u&&(u.isArrayTexture=y),(n.width!==a.width||a.height!==n.height)&&(d=!0,u&&(u.needsUpdate=!0,u.image.width=l,u.image.height=c,u.image.depth=y?a.depth:1)),n.width=a.width,n.height=a.height,n.textures=o,n.depthTexture=u||null,n.depth=e.depthBuffer,n.stencil=e.stencilBuffer,n.renderTarget=e,n.sampleCount!==r&&(d=!0,u&&(u.needsUpdate=!0),n.sampleCount=r);let w={sampleCount:r};if(e.isXRRenderTarget!==!0){for(let S=0;S<o.length;S++){let T=o[S];d&&(T.needsUpdate=!0),this.updateTexture(T,w)}u&&this.updateTexture(u,w)}n.initialized!==!0&&(n.initialized=!0,this.info.memory.renderTargets++,n.onDispose=()=>{this._destroyRenderTarget(e)},e.addEventListener("dispose",n.onDispose))}updateTexture(e,t={}){let n=this.get(e);if(n.initialized===!0&&n.version===e.version)return;let r=e.isRenderTargetTexture||e.isDepthTexture||e.isFramebufferTexture,s=this.backend;if(r&&n.initialized===!0&&s.destroyTexture(e),e.isFramebufferTexture){let c=this.renderer.getRenderTarget();c?e.type=c.texture.type:e.type=Ji}if(e.isHTMLTexture&&e.image){let c=this.renderer.domElement;if("requestPaint"in c){if(c.hasAttribute("layoutsubtree")||c.setAttribute("layoutsubtree","true"),e.image.parentNode!==c&&c.appendChild(e.image),this._htmlTextures.size===0){let u=this._htmlTextures;c.onpaint=f=>{let d=f&&f.changedElements;for(let A of u)(!d||d.includes(A.image))&&(A.needsUpdate=!0)}}this._htmlTextures.add(e)}}let{width:o,height:a,depth:l}=this.getSize(e);if(t.width=o,t.height=a,t.depth=l,t.needsMipmaps=this.needsMipmaps(e),t.levels=t.needsMipmaps?this.getMipLevels(e,o,a):1,e.isCubeTexture&&e.mipmaps.length>0&&t.levels++,r||e.isStorageTexture===!0||e.isExternalTexture===!0)s.createTexture(e,t),n.generation=e.version;else if(e.version>0){let c=e.image;if(c===void 0)Xe("Renderer: Texture marked for update but image is undefined.");else if(c.complete===!1)Xe("Renderer: Texture marked for update but image is incomplete.");else{if(e.images){let f=[];for(let d of e.images)f.push(d);t.images=f}else t.image=c;(n.isDefaultTexture===void 0||n.isDefaultTexture===!0)&&(s.createTexture(e,t),n.isDefaultTexture=!1,n.generation=e.version),e.source.dataReady===!0&&s.updateTexture(e,t);let u=e.isStorageTexture===!0&&e.mipmapsAutoUpdate===!1;t.needsMipmaps&&e.mipmaps.length===0&&!u&&s.generateMipmaps(e),e.onUpdate&&e.onUpdate(e)}}else s.createDefaultTexture(e),n.isDefaultTexture=!0,n.generation=e.version;n.initialized!==!0&&(n.initialized=!0,n.generation=e.version,n.bindGroups=new Set,this.info.createTexture(e),e.isVideoTexture&&ln.enabled===!0&&ln.getTransfer(e.colorSpace)!==kt&&Xe("WebGPURenderer: Video textures must use a color space with a sRGB transfer function, e.g. SRGBColorSpace."),n.onDispose=()=>{this._destroyTexture(e)},e.addEventListener("dispose",n.onDispose)),n.version=e.version}updateSampler(e){return this.backend.updateSampler(e)}getSize(e,t=FMe){let n=e.images?e.images[0]:e.image;return n?(n.image!==void 0&&(n=n.image),e.isHTMLTexture?(t.width=n.offsetWidth||1,t.height=n.offsetHeight||1,t.depth=1):typeof HTMLVideoElement<"u"&&n instanceof HTMLVideoElement?(t.width=n.videoWidth||1,t.height=n.videoHeight||1,t.depth=1):typeof VideoFrame<"u"&&n instanceof VideoFrame?(t.width=n.displayWidth||1,t.height=n.displayHeight||1,t.depth=1):(t.width=n.width||1,t.height=n.height||1,t.depth=e.isCubeTexture?6:n.depth||1)):t.width=t.height=t.depth=1,t}getMipLevels(e,t,n){let r;return e.mipmaps.length>0?r=e.mipmaps.length:e.isCompressedTexture===!0?r=1:r=Math.floor(Math.log2(Math.max(t,n)))+1,r}needsMipmaps(e){return e.generateMipmaps===!0||e.mipmaps.length>0}_destroyRenderTarget(e){if(this.has(e)===!0){let t=this.get(e),n=t.textures,r=t.depthTexture;e.removeEventListener("dispose",t.onDispose);for(let s=0;s<n.length;s++)this._destroyTexture(n[s]);r&&this._destroyTexture(r),this.delete(e),this.backend.delete(e),this.info.memory.renderTargets--}}_destroyTexture(e){if(this.has(e)===!0){let t=this.get(e);e.removeEventListener("dispose",t.onDispose);let n=t.isDefaultTexture;if(this.backend.destroyTexture(e,n),t.bindGroups)for(let r of t.bindGroups){let s=this.backend.get(r);s.groups=void 0,s.versions=void 0;for(let o of r.bindings)o.isSampler&&o.texture===e&&(o.isSampledTexture!==!0&&this.backend.destroySampler(o),o.reset(),o.release())}this._htmlTextures.delete(e),this.delete(e),this.info.destroyTexture(e)}}},wS=class extends zt{constructor(e,t,n,r=1){super(e,t,n),this.a=r}set(e,t,n,r=1){return this.a=r,super.set(e,t,n)}copy(e){return e.a!==void 0&&(this.a=e.a),super.copy(e)}clone(){return new this.constructor(this.r,this.g,this.b,this.a)}},P4=class extends gS{static get type(){return"OverrideContextNode"}constructor(e,t=null){super(t,{overrideNodes:e}),this.isOverrideContextNode=!0}getFlowContextData(){let e=[];this.traverse(r=>{r.isOverrideContextNode===!0&&e.push(r.value.overrideNodes)});let t=new Map(e.flatMap(r=>Array.from(r.entries()))),n=super.getFlowContextData();return n.overrideNodes=t,n}};function yse(i,e=null,t=null){if(e&&e.isNode){let n=e;e=()=>n}return new P4(new Map([[i,e]]),t)}Ue("overrideNode",(i,e,t)=>yse(e,t,i));function bse(i,e=null){let t=new Map;for(let[n,r]of i){let s=r!==null?typeof r=="function"?r:()=>r:null;t.set(n,s)}return new P4(t,e)}Ue("overrideNodes",(i,e)=>bse(e,i));var L4=class extends gi{static get type(){return"ParameterNode"}constructor(e,t=null){super(e,t),this.isParameterNode=!0}getMemberType(e,t){let n=this.getNodeType(e),r=e.getStructTypeNode(n),s;return r!==null?s=r.getMemberType(e,t):(ze(`TSL: Member "${t}" not found in struct "${n}".`,new es),s="float"),s}getHash(){return String(this.id)}generate(){return this.name}},BMe=(i,e)=>new L4(i,e),nk=class extends Kt{static get type(){return"StackNode"}constructor(e=null){super(),this.nodes=[],this.outputNode=null,this.parent=e,this._currentCond=null,this._expressionNode=null,this._currentNode=null,this._nodeDataLibrary=new Map,this.isStackNode=!0}getElementType(e){return this.outputNode?this.outputNode.getElementType(e):"void"}generateNodeType(e){return this.outputNode?this.outputNode.getNodeType(e):"void"}getMemberType(e,t){return this.outputNode?this.outputNode.getMemberType(e,t):"void"}addToStack(e,t=-1){if(e.isNode!==!0)return ze("TSL: Invalid node added to stack.",new es),this;if(t===-1)if(this._currentNode){let n=this._nodeDataLibrary.get(this._currentNode);n===void 0&&(n={delta:0},this._nodeDataLibrary.set(this._currentNode,n)),n.delta++,t=this.nodes.indexOf(this._currentNode)+n.delta}else t=this.nodes.length;return this.nodes.splice(t,0,e),this}addToStackBefore(e){let t=this._currentNode?this.nodes.indexOf(this._currentNode):0;return this.addToStack(e,t)}If(e,t){let n=new sx(t);return this._currentCond=_a(e,n),this.addToStack(this._currentCond)}ElseIf(e,t){let n=new sx(t),r=_a(e,n);return this._currentCond.elseNode=r,this._currentCond=r,this}Else(e){return this._currentCond.elseNode=new sx(e),this}Switch(e){return this._expressionNode=Ht(e),this}Case(...e){let t=[];if(e.length>=2)for(let a=0;a<e.length-1;a++)t.push(this._expressionNode.equal(Ht(e[a])));else ze("TSL: Invalid parameter length. Case() requires at least two parameters.",new es);let n=e[e.length-1],r=new sx(n),s=t[0];for(let a=1;a<t.length;a++)s=s.or(t[a]);let o=_a(s,r);return this._currentCond===null?(this._currentCond=o,this.addToStack(this._currentCond)):(this._currentCond.elseNode=o,this._currentCond=o,this)}Default(e){return this.Else(e),this}setup(e){let t=e.getNodeProperties(this),n=0;for(let r of this.getChildren())r.isVarNode&&r.isIntent(e)&&r.isAssign(e)!==!0||(t["node"+n++]=r);return t.outputNode||null}build(e,...t){let n=cz(),r=e.buildStage;mS(this),e.setActiveStack(this);for(let o=0;o<this.nodes.length;o++){let a=this.nodes[o],l=this._currentNode;if(this._currentNode=a,!(a.isVarNode&&a.isIntent(e)&&a.isAssign(e)!==!0)){if(r==="setup")a.build(e);else if(r==="analyze")a.build(e,this);else if(r==="generate"){let c=e.getDataFromNode(a,"any").stages,u=c&&c[e.shaderStage];if(a.isVarNode&&u&&u.length===1&&u[0]&&u[0].isStackNode)continue;a.build(e,"void")}this._currentNode=l}}let s;if(this.outputNode){let o=this.outputNode.build(e,...t);(e.buildStage!=="generate"||this.outputNode.getNodeType(e)!=="void")&&(s=o)}else s=super.build(e,...t);return mS(n),e.removeActiveStack(this),s}},t4=$n(nk).setParameterLength(0,1);function OMe(i){return Object.entries(i).map(([e,t])=>typeof t=="string"?{name:e,type:t,atomic:!1}:{name:e,type:t.type,atomic:t.atomic||!1})}var ik=class extends Kt{static get type(){return"StructTypeNode"}constructor(e,t=null){super("struct"),this.membersLayout=OMe(e),this.name=t,this.isStructTypeNode=!0}getLength(){let e=1,t=0;for(let n of this.membersLayout){let r=n.type,s=ITe(r),o=PTe(r);e=Math.max(e,o);let l=t%e%o;l!==0&&(t+=o-l),t+=s}return Math.ceil(t/e)*e}getMemberType(e,t){let n=this.membersLayout.find(r=>r.name===t);return n?n.type:"void"}generateNodeType(e){return e.getStructTypeFromNode(this,this.membersLayout,this.name).name}setup(e){e.getStructTypeFromNode(this,this.membersLayout,this.name),e.addInclude(this)}generate(e){return this.getNodeType(e)}},rk=class extends Kt{static get type(){return"StructNode"}constructor(e,t){super("vec3"),this.structTypeNode=e,this.values=t,this.isStructNode=!0}generateNodeType(e){return this.structTypeNode.getNodeType(e)}getMemberType(e,t){return this.structTypeNode.getMemberType(e,t)}_getChildren(){let e=super._getChildren(),t=e.find(n=>n.childNode===this.structTypeNode);return e.splice(e.indexOf(t),1),e.push(t),e}generate(e){let t=e.getVarFromNode(this),n=t.type,r=e.getPropertyName(t);return e.addLineFlowCode(`${r} = ${e.generateStruct(n,this.structTypeNode.membersLayout,this.values)}`,this),t.name}},UMe=(i,e=null)=>{let t=new ik(i,e);return lz((...r)=>{let s=null;if(r.length>0)if(r[0].isNode){s={};let o=Object.keys(i);for(let a=0;a<r.length;a++)s[o[a]]=r[a]}else s=r[0];return new rk(t,s)},t)},D4=class extends Kt{static get type(){return"OutputStructNode"}constructor(...e){super(),this.members=e,this.isOutputStructNode=!0}generateNodeType(){return"OutputType"}generate(e){let t=e.getDataFromNode(this);if(t.membersLayout===void 0){let o=this.members,a=[];for(let l=0;l<o.length;l++){let c="m"+l,u=o[l].getNodeType(e);a.push({name:c,type:u,index:l})}t.membersLayout=a,t.structType=e.getOutputStructTypeFromNode(this,t.membersLayout)}let n=e.getOutputStructName(),r=this.members,s=n!==""?n+".":"";for(let o=0;o<r.length;o++){let a=r[o].build(e,t.membersLayout[o].type);e.addLineFlowCode(`${s}m${o} = ${a}`,this)}return n}},kMe=$n(D4),N4=class{constructor(e=Ms){this.blending=e,this.blendSrc=e0,this.blendDst=t0,this.blendEquation=oo,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.premultiplyAlpha=!1}copy(e){return this.blending=e.blending,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.premultiplyAlpha=e.premultiplyAlpha,this}clone(){return new this.constructor().copy(this)}},zMe=new N4(ps),VMe=new N4(mb);function wse(i,e){for(let t=0;t<i.length;t++)if(i[t].name===e)return t;return-1}var sk=class extends D4{static get type(){return"MRTNode"}constructor(e){super(),this.outputNodes=e,this.blendModes={output:VMe},this.isMRTNode=!0}setBlendMode(e,t){return this.blendModes[e]=t,this}getBlendMode(e){return this.blendModes[e]||zMe}has(e){return this.outputNodes[e]!==void 0}get(e){return this.outputNodes[e]}merge(e){let t={...this.outputNodes,...e.outputNodes},n={...this.blendModes,...e.blendModes},r=Sse(t);return r.blendings=n,r}setup(e){let t=this.outputNodes,n=e.renderer.getRenderTarget(),r=[],s=n.textures;for(let o in t){let a=wse(s,o);if(a===-1)continue;let l=e.getOutputType(a);r[a]=t[o].convert(l)}return this.members=r,super.setup(e)}},Sse=$n(sk),o1=class extends Rr{static get type(){return"BitcastNode"}constructor(e,t,n=null){super(),this.valueNode=e,this.conversionType=t,this.inputType=n,this.isBitcastNode=!0}generateNodeType(e){if(this.inputType!==null){let t=this.valueNode.getNodeType(e),n=e.getTypeLength(t);return e.getTypeFromLength(n,this.conversionType)}return this.conversionType}generate(e){let t=this.getNodeType(e),n="";if(this.inputType!==null){let r=this.valueNode.getNodeType(e);n=e.getTypeLength(r)===1?this.inputType:e.changeComponentType(r,this.inputType)}else n=this.valueNode.getNodeType(e);return`${e.getBitcastMethod(t,n)}( ${this.valueNode.build(e,n)} )`}},Tse=ct(o1).setParameterLength(2),GMe=i=>new o1(i,"int","float"),Ese=i=>new o1(i,"uint","float"),qMe=i=>new o1(i,"float","int"),HMe=i=>new o1(i,"float","uint"),ER={},Ju=class i extends Ie{static get type(){return"BitcountNode"}constructor(e,t){super(e,t),this.isBitcountNode=!0}_resolveElementType(e,t,n){n==="int"?t.assign(Tse(e,"uint")):t.assign(e)}_returnDataNode(e){switch(e){case"uint":return rt;case"int":return de;case"uvec2":return uz;case"uvec3":return u1;case"uvec4":return pz;case"ivec2":return kr;case"ivec3":return hz;case"ivec4":return dz}}_createTrailingZerosBaseLayout(e,t){let n=this._returnDataNode(t);return me(([s])=>{let o=rt(0);this._resolveElementType(s,o,t);let a=oe(o.bitAnd(Tz(o))),c=Ese(a).shiftRight(23).sub(127);return n(c)}).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}_createLeadingZerosBaseLayout(e,t){let n=this._returnDataNode(t);return me(([s])=>{$t(s.equal(rt(0)),()=>rt(32));let o=rt(0),a=rt(0);return this._resolveElementType(s,o,t),$t(o.shiftRight(16).equal(0),()=>{a.addAssign(16),o.shiftLeftAssign(16)}),$t(o.shiftRight(24).equal(0),()=>{a.addAssign(8),o.shiftLeftAssign(8)}),$t(o.shiftRight(28).equal(0),()=>{a.addAssign(4),o.shiftLeftAssign(4)}),$t(o.shiftRight(30).equal(0),()=>{a.addAssign(2),o.shiftLeftAssign(2)}),$t(o.shiftRight(31).equal(0),()=>{a.addAssign(1)}),n(a)}).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}_createOneBitsBaseLayout(e,t){let n=this._returnDataNode(t);return me(([s])=>{let o=rt(0);this._resolveElementType(s,o,t),o.assign(o.sub(o.shiftRight(rt(1)).bitAnd(rt(1431655765)))),o.assign(o.bitAnd(rt(858993459)).add(o.shiftRight(rt(2)).bitAnd(rt(858993459))));let a=o.add(o.shiftRight(rt(4))).bitAnd(rt(252645135)).mul(rt(16843009)).shiftRight(rt(24));return n(a)}).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}_createMainLayout(e,t,n,r){let s=this._returnDataNode(t);return me(([a])=>{if(n===1)return s(r(a));{let l=s(0),c=["x","y","z","w"];for(let u=0;u<n;u++){let f=c[u];l[f].assign(r(a[f]))}return l}}).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}setup(e){let{method:t,aNode:n}=this,{renderer:r}=e;if(r.backend.isWebGPUBackend)return super.setup(e);let s=this.getInputType(e),o=e.getElementType(s),a=e.getTypeLength(s),l=`${t}_base_${o}`,c=`${t}_${s}`,u=ER[l];if(u===void 0){switch(t){case i.COUNT_LEADING_ZEROS:{u=this._createLeadingZerosBaseLayout(l,o);break}case i.COUNT_TRAILING_ZEROS:{u=this._createTrailingZerosBaseLayout(l,o);break}case i.COUNT_ONE_BITS:{u=this._createOneBitsBaseLayout(l,o);break}}ER[l]=u}let f=ER[c];return f===void 0&&(f=this._createMainLayout(c,s,a,u),ER[c]=f),me(()=>f(n))()}};Ju.COUNT_TRAILING_ZEROS="countTrailingZeros";Ju.COUNT_LEADING_ZEROS="countLeadingZeros";Ju.COUNT_ONE_BITS="countOneBits";var WMe=ct(Ju,Ju.COUNT_TRAILING_ZEROS).setParameterLength(1),jMe=ct(Ju,Ju.COUNT_LEADING_ZEROS).setParameterLength(1),XMe=ct(Ju,Ju.COUNT_ONE_BITS).setParameterLength(1),$Me=me(([i])=>{let e=i.toUint().mul(747796405).add(2891336453),t=e.shiftRight(e.shiftRight(28).add(4)).bitXor(e).mul(277803737);return t.shiftRight(22).bitXor(t).toFloat().mul(1/2**32)}),ok=(i,e)=>iu(Tn(4,i.mul(ai(1,i))),e),YMe=(i,e)=>i.lessThan(.5)?ok(i.mul(2),e).div(2):ai(1,ok(Tn(ai(1,i),2),e).div(2)),ZMe=(i,e,t)=>iu(pc(iu(i,e),Ls(iu(i,e),iu(ai(1,i),t))),1/e),KMe=(i,e)=>Ka(d4.mul(e.mul(i).sub(1))).div(d4.mul(e.mul(i).sub(1))),SS=class extends Rr{static get type(){return"PackFloatNode"}constructor(e,t){super(),this.vectorNode=t,this.encoding=e,this.isPackFloatNode=!0}generateNodeType(){return"uint"}generate(e){let t=this.vectorNode.getNodeType(e);return`${e.getFloatPackingMethod(this.encoding)}(${this.vectorNode.build(e,t)})`}},QMe=ct(SS,"snorm").setParameterLength(1),JMe=ct(SS,"unorm").setParameterLength(1),eCe=ct(SS,"float16").setParameterLength(1),TS=class extends Rr{static get type(){return"UnpackFloatNode"}constructor(e,t){super(),this.uintNode=t,this.encoding=e,this.isUnpackFloatNode=!0}generateNodeType(){return"vec2"}generate(e){let t=this.uintNode.getNodeType(e);return`${e.getFloatUnpackingMethod(this.encoding)}(${this.uintNode.build(e,t)})`}},tCe=ct(TS,"snorm").setParameterLength(1),nCe=ct(TS,"unorm").setParameterLength(1),iCe=ct(TS,"float16").setParameterLength(1),Xd=me(([i])=>i.fract().sub(.5).abs()).setLayout({name:"tri",type:"float",inputs:[{name:"x",type:"float"}]}),rCe=me(([i])=>pe(Xd(i.z.add(Xd(i.y.mul(1)))),Xd(i.z.add(Xd(i.x.mul(1)))),Xd(i.y.add(Xd(i.x.mul(1)))))).setLayout({name:"tri3",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),sCe=me(([i,e,t])=>{let n=pe(i).toVar(),r=oe(1.4).toVar(),s=oe(0).toVar(),o=pe(n).toVar();return Oi({start:oe(0),end:oe(3),type:"float",condition:"<="},()=>{let a=pe(rCe(o.mul(2))).toVar();n.addAssign(a.add(t.mul(oe(.1).mul(e)))),o.mulAssign(1.8),r.mulAssign(1.5),n.mulAssign(1.2);let l=oe(Xd(n.z.add(Xd(n.x.add(Xd(n.y)))))).toVar();s.addAssign(l.div(r)),o.addAssign(.14)}),s}).setLayout({name:"triNoise3D",type:"float",inputs:[{name:"position",type:"vec3"},{name:"speed",type:"float"},{name:"time",type:"float"}]}),ak=class extends Kt{static get type(){return"FunctionOverloadingNode"}constructor(e=[],...t){super(),this.functionNodes=e,this.parametersNodes=t,this._candidateFn=null,this.global=!0}generateNodeType(e){return this.getCandidateFn(e).shaderNode.layout.type}getCandidateFn(e){let t=this.parametersNodes,n=this._candidateFn;if(n===null){let r=null,s=-1;for(let o of this.functionNodes){let l=o.shaderNode.layout;if(l===null)throw new Error("THREE.FunctionOverloadingNode: FunctionNode must be a layout.");let c=l.inputs;if(t.length===c.length){let u=0;for(let f=0;f<t.length;f++){let d=t[f],A=c[f];d.getNodeType(e)===A.type&&u++}u>s&&(r=o,s=u)}}this._candidateFn=n=r}return n}setup(e){return this.getCandidateFn(e)(...this.parametersNodes)}},oCe=$n(ak),Zo=i=>(...e)=>oCe(i,...e),Ex=Xt(0).setGroup(Jt).onRenderUpdate(i=>i.time),aCe=Xt(0).setGroup(Jt).onRenderUpdate(i=>i.deltaTime),Mse=Xt(0,"uint").setGroup(Jt).onRenderUpdate(i=>i.frameId),lCe=(i=Ex)=>i.add(.75).mul(Math.PI*2).sin().mul(.5).add(.5),cCe=(i=Ex)=>i.fract().round(),uCe=(i=Ex)=>i.add(.5).fract().mul(2).sub(1).abs(),hCe=(i=Ex)=>i.fract();function fCe(i,e=null){return tp(e,{getUV:typeof i=="function"?i:()=>i})}var dCe=me(([i,e,t=dt(.5)])=>US(i.sub(t),e).add(t)),pCe=me(([i,e,t=dt(.5)])=>{let n=i.sub(t),r=n.dot(n),o=r.mul(r).mul(e);return i.add(n.mul(o))}),mCe=me(({position:i=null,horizontal:e=!0,vertical:t=!1})=>{let n;i!==null?(n=ru.toVar(),n[3][0]=i.x,n[3][1]=i.y,n[3][2]=i.z):n=ru;let r=Sm.mul(n);return dx(e)&&(r[0][0]=ru[0].length(),r[0][1]=0,r[0][2]=0),dx(t)&&(r[1][0]=0,r[1][1]=ru[1].length(),r[1][2]=0),r[2][0]=0,r[2][1]=0,r[2][2]=1,Ja.mul(r).mul(Mr)}),ACe=me(([i=null])=>{let e=b4();return b4(hV(i)).sub(e).lessThan(0).select($u,i)}),gCe=me(([i,e=Ui(),t=oe(0)])=>{let n=i.x,r=i.y,s=t.mod(n.mul(r)).floor(),o=s.mod(n),a=r.sub(s.add(1).div(n).ceil()),l=i.reciprocal(),c=dt(o,a);return e.add(c).mul(l)}),Cse=me(([i,e=null,t=null,n=oe(1),r=Mr,s=ba])=>{let o=s.abs().normalize();o=o.div(o.dot(pe(1)));let a=r.yz.mul(n),l=r.zx.mul(n),c=r.xy.mul(n),u=i.value,f=e!==null?e.value:u,d=t!==null?t.value:u,A=fi(u,a).mul(o.x),y=fi(f,l).mul(o.y),w=fi(d,c).mul(o.z);return Ls(A,y,w)}),vCe=(...i)=>Cse(...i),H_=new Na,Fg=new re,W_=new re,QO=new re,Hw=new cn,MR=new re(0,0,-1),df=new xn,Ww=new re,CR=new re,jw=new xn,RR=new Oe,F4=new Ba,_Ce=$u.flipX();F4.depthTexture=new Cs(1,1);var IR=!1,lk=class i extends lu{static get type(){return"ReflectorNode"}constructor(e={}){super(e.defaultTexture||F4.texture,_Ce),this._reflectorBaseNode=e.reflector||new ck(this,e),this._depthNode=null,this.setUpdateMatrix(!1)}get reflector(){return this._reflectorBaseNode}get target(){return this._reflectorBaseNode.target}getDepthNode(){if(this._depthNode===null){if(this._reflectorBaseNode.depth!==!0)throw new Error("THREE.ReflectorNode: Depth node can only be requested when the reflector is created with { depth: true }. ");this._depthNode=new i({defaultTexture:F4.depthTexture,reflector:this._reflectorBaseNode})}return this._depthNode}setup(e){return e.object.isQuadMesh||this._reflectorBaseNode.build(e),super.setup(e)}clone(){let e=new this.constructor(this.reflectorNode);return e.uvNode=this.uvNode,e.levelNode=this.levelNode,e.biasNode=this.biasNode,e.sampler=this.sampler,e.depthNode=this.depthNode,e.compareNode=this.compareNode,e.gradNode=this.gradNode,e.gatherNode=this.gatherNode,e.offsetNode=this.offsetNode,e._reflectorBaseNode=this._reflectorBaseNode,e}dispose(){super.dispose(),this._reflectorBaseNode.dispose()}},ck=class extends Kt{static get type(){return"ReflectorBaseNode"}constructor(e,t={}){super();let{target:n=new lr,resolutionScale:r=1,generateMipmaps:s=!1,bounces:o=!0,depth:a=!1,samples:l=0}=t;this.textureNode=e,this.target=n,this.resolutionScale=r,t.resolution!==void 0&&(ni('ReflectorNode: The "resolution" parameter has been renamed to "resolutionScale".'),this.resolutionScale=t.resolution),this.generateMipmaps=s,this.bounces=o,this.depth=a,this.samples=l,this.updateBeforeType=o?yn.RENDER:yn.FRAME,this.virtualCameras=new WeakMap,this.renderTargets=new Map,this.forceUpdate=!1,this.hasOutput=!1}_updateResolution(e,t){let n=this.resolutionScale;t.getDrawingBufferSize(RR),e.setSize(Math.round(RR.width*n),Math.round(RR.height*n))}setup(e){return this._updateResolution(F4,e.renderer),super.setup(e)}dispose(){super.dispose();for(let e of this.renderTargets.values())e.dispose()}getVirtualCamera(e){let t=this.virtualCameras.get(e);return t===void 0&&(t=e.clone(),this.virtualCameras.set(e,t)),t}getRenderTarget(e){let t=this.renderTargets.get(e);return t===void 0&&(t=new Ba(0,0,{type:Wi,samples:this.samples}),this.generateMipmaps===!0&&(t.texture.minFilter=j8,t.texture.generateMipmaps=!0),this.depth===!0&&(t.depthTexture=new Cs),this.renderTargets.set(e,t)),t}updateBefore(e){if(this.bounces===!1&&IR)return!1;IR=!0;let{scene:t,camera:n,renderer:r,material:s}=e,{target:o}=this,a=this.getVirtualCamera(n),l=this.getRenderTarget(a);r.getDrawingBufferSize(RR),this._updateResolution(l,r),W_.setFromMatrixPosition(o.matrixWorld),QO.setFromMatrixPosition(n.matrixWorld),Hw.extractRotation(o.matrixWorld),Fg.set(0,0,1),Fg.applyMatrix4(Hw),Ww.subVectors(W_,QO);let c=Ww.dot(Fg)>0,u=!1;if(c===!0&&this.forceUpdate===!1){if(this.hasOutput===!1){IR=!1;return}u=!0}Ww.reflect(Fg).negate(),Ww.add(W_),Hw.extractRotation(n.matrixWorld),MR.set(0,0,-1),MR.applyMatrix4(Hw),MR.add(QO),CR.subVectors(W_,MR),CR.reflect(Fg).negate(),CR.add(W_),a.coordinateSystem=n.coordinateSystem,a.position.copy(Ww),a.up.set(0,1,0),a.up.applyMatrix4(Hw),a.up.reflect(Fg),a.lookAt(CR),a.near=n.near,a.far=n.far,a.updateMatrixWorld(),a.projectionMatrix.copy(n.projectionMatrix),H_.setFromNormalAndCoplanarPoint(Fg,W_),H_.applyMatrix4(a.matrixWorldInverse),df.set(H_.normal.x,H_.normal.y,H_.normal.z,H_.constant);let f=a.projectionMatrix;jw.x=(Math.sign(df.x)+f.elements[8])/f.elements[0],jw.y=(Math.sign(df.y)+f.elements[9])/f.elements[5],jw.z=-1,jw.w=(1+f.elements[10])/f.elements[14],df.multiplyScalar(1/df.dot(jw));let d=0;f.elements[2]=df.x,f.elements[6]=df.y,f.elements[10]=r.coordinateSystem===xl?df.z-d:df.z+1-d,f.elements[14]=df.w,this.textureNode.value=l.texture,this.depth===!0&&(this.textureNode.getDepthNode().value=l.depthTexture),s.visible=!1;let A=r.getRenderTarget(),y=r.getMRT(),w=r.autoClear;r.setMRT(null),r.setRenderTarget(l),r.autoClear=!0;let S=t.name;t.name=(t.name||"Scene")+" [ Reflector ]",u?(r.clear(),this.hasOutput=!1):(r.render(t,a),this.hasOutput=!0),t.name=S,r.setMRT(y),r.setRenderTarget(A),r.autoClear=w,s.visible=!0,IR=!1,this.forceUpdate=!1}get resolution(){return ni('ReflectorNode: The "resolution" property has been renamed to "resolutionScale".'),this.resolutionScale}set resolution(e){ni('ReflectorNode: The "resolution" property has been renamed to "resolutionScale".'),this.resolutionScale=e}},xCe=i=>new lk(i),JO=new Fu(-1,1,1,-1,0,1),uk=class extends Xn{constructor(e=!1){super();let t=e===!1?[0,-1,0,1,2,1]:[0,2,0,0,2,0];this.setAttribute("position",new Ln([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new Ln(t,2))}},yCe=new uk,ES=class extends Hn{constructor(e=null){super(yCe,e),this.camera=JO,this.isQuadMesh=!0}async renderAsync(e){ni('QuadMesh: "renderAsync()" has been deprecated. Use "render()" and "await renderer.init();" when creating the renderer.'),await e.init(),e.render(this,JO)}render(e){e.render(this,JO)}},bCe=new Oe,hk=class extends lu{static get type(){return"RTTNode"}constructor(e,t=null,n=null,r={type:Wi}){let s=new Ba(t,n,r);super(s.texture,Ui()),this.isRTTNode=!0,this.node=e,this.width=t,this.height=n,this.renderTarget=s,this.textureNeedsUpdate=!0,this.autoUpdate=!0,this._resolutionScale=1,this._rttNode=null,this._quadMesh=new ES(new Ir),this.updateBeforeType=yn.RENDER}get autoResize(){return this.width===null}setup(e){return this._rttNode=this.node.context(e.getSharedContext()),this._quadMesh.material.name="RTT",this._quadMesh.material.needsUpdate=!0,super.setup(e)}setSize(e,t){let n=Math.floor(e*this._resolutionScale),r=Math.floor(t*this._resolutionScale);this.renderTarget.setSize(n,r),this.textureNeedsUpdate=!0}setResolutionScale(e){return this._resolutionScale=e,this.autoResize===!1&&this.setSize(this.width,this.height),this}getResolutionScale(){return this._resolutionScale}updateBefore({renderer:e}){if(this.textureNeedsUpdate===!1&&this.autoUpdate===!1)return;this.textureNeedsUpdate=!1;let t=e.getRenderTarget();if(this.autoResize===!0){let r=e.getDrawingBufferSize(bCe),s=Math.floor(r.width*this._resolutionScale),o=Math.floor(r.height*this._resolutionScale);(s!==this.renderTarget.width||o!==this.renderTarget.height)&&(this.renderTarget.setSize(s,o),this.textureNeedsUpdate=!0)}let n="RTT";this.node.name&&(n=this.node.name+" [ "+n+" ]"),this._quadMesh.material.fragmentNode=this._rttNode,this._quadMesh.name=n,e.setRenderTarget(this.renderTarget),this._quadMesh.render(e),e.setRenderTarget(t)}clone(){let e=new lu(this.value,this.uvNode,this.levelNode);return e.sampler=this.sampler,e.referenceNode=this,e}},Rse=(i,...e)=>new hk(Ht(i),...e),wCe=(i,...e)=>i.isSampleNode||i.isTextureNode?i:i.isPassNode?i.getTextureNode():Rse(i,...e),rx=me(([i,e,t],n)=>{let r;n.renderer.coordinateSystem===xl?(i=dt(i.x,i.y.oneMinus()).mul(2).sub(1),r=Ft(pe(i,e),1)):r=Ft(pe(i.x,i.y.oneMinus(),e).mul(2).sub(1),1);let s=Ft(t.mul(r));return s.xyz.div(s.w)}),SCe=me(([i,e])=>{let t=e.mul(Ft(i,1)),n=t.xy.div(t.w).mul(.5).add(.5).toVar();return dt(n.x,n.y.oneMinus())}),TCe=me(([i,e,t])=>{let n=n1(_s(e)),r=kr(i.mul(n)).toVar(),s=_s(e,r).toVar(),o=_s(e,r.sub(kr(2,0))).toVar(),a=_s(e,r.sub(kr(1,0))).toVar(),l=_s(e,r.add(kr(1,0))).toVar(),c=_s(e,r.add(kr(2,0))).toVar(),u=_s(e,r.add(kr(0,2))).toVar(),f=_s(e,r.add(kr(0,1))).toVar(),d=_s(e,r.sub(kr(0,1))).toVar(),A=_s(e,r.sub(kr(0,2))).toVar(),y=fr(ai(oe(2).mul(a).sub(o),s)).toVar(),w=fr(ai(oe(2).mul(l).sub(c),s)).toVar(),S=fr(ai(oe(2).mul(f).sub(u),s)).toVar(),T=fr(ai(oe(2).mul(d).sub(A),s)).toVar(),R=rx(i,s,t).toVar(),P=y.lessThan(w).select(R.sub(rx(i.sub(dt(oe(1).div(n.x),0)),a,t)),R.negate().add(rx(i.add(dt(oe(1).div(n.x),0)),l,t))),I=S.lessThan(T).select(R.sub(rx(i.add(dt(0,oe(1).div(n.y))),f,t)),R.negate().add(rx(i.sub(dt(0,oe(1).div(n.y))),d,t)));return xa(Qd(P,I))}),_V=me(([i])=>Zu(oe(52.9829189).mul(Zu(au(i,dt(.06711056,.00583715)))))).setLayout({name:"interleavedGradientNoise",type:"float",inputs:[{name:"position",type:"vec2"}]}),Xu=me(([i,e,t])=>{let n=oe(2.399963229728653),r=el(oe(i).add(.5).div(oe(e))),s=oe(i).mul(n).add(t);return dt(ju(s),Ka(s)).mul(r)}).setLayout({name:"vogelDiskSample",type:"vec2",inputs:[{name:"sampleIndex",type:"int"},{name:"samplesCount",type:"int"},{name:"phi",type:"float"}]}),fk=class extends Kt{static get type(){return"SampleNode"}constructor(e,t=null){super(),this.callback=e,this.uvNode=t,this.isSampleNode=!0}setup(){return this.sample(Ui())}sample(e){return this.callback(e)}},ECe=(i,e=null)=>new fk(i,Ht(e)),a1=class extends Ql{constructor(e,t,n=Float32Array){let r=ArrayBuffer.isView(e)?e:new n(e*t);super(r,t),this.isStorageInstancedBufferAttribute=!0}},dk=class extends Hi{constructor(e,t,n=Float32Array){let r=ArrayBuffer.isView(e)?e:new n(e*t);super(r,t),this.isStorageBufferAttribute=!0}},MCe=(i,e="float")=>{let t,n;e.isStructTypeNode===!0?(t=e.getLength(),n=n4("float")):(t=rne(e),n=n4(e));let r=new dk(i,t,n);return Am(r,e,i)},CCe=(i,e="float")=>{let t,n;e.isStructTypeNode===!0?(t=e.getLength(),n=n4("float")):(t=rne(e),n=n4(e));let r=new a1(i,t,n);return Am(r,e,r.count)},pk=class extends Kt{static get type(){return"PointUVNode"}constructor(){super("vec2"),this.isPointUVNode=!0}generate(){return"vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y )"}},RCe=xt(pk),eU=new cn,Ise=Xt(0).setGroup(Jt).onRenderUpdate(({scene:i})=>i.backgroundBlurriness),mk=Xt(1).setGroup(Jt).onRenderUpdate(({scene:i})=>i.backgroundIntensity),Pse=Xt(new cn).setGroup(Jt).onRenderUpdate(({scene:i})=>{let e=i.background;return e!==null&&e.isTexture&&e.mapping!==Lb||i.backgroundNode&&i.backgroundNode.isNode?eU.makeRotationFromEuler(i.backgroundRotation).transpose():eU.identity(),eU}),B4=class extends lu{static get type(){return"StorageTextureNode"}constructor(e,t,n=null){super(e,t),this.storeNode=n,this.mipLevel=0,this.isStorageTextureNode=!0,this.access=$o.WRITE_ONLY}getInputType(){return"storageTexture"}getTransformedUV(e){return e}setup(e){super.setup(e);let t=e.getNodeProperties(this);return t.storeNode=this.storeNode,t}setAccess(e){return this.access=e,this}setMipLevel(e){return this.mipLevel=e,this}generate(e,t){return this.storeNode!==null?(this.generateStore(e),""):super.generate(e,t)}generateSnippet(e,t,n,r,s,o,a,l,c){let u=this.value;return e.generateStorageTextureLoad(u,t,n,r,o,c)}toReadWrite(){return this.setAccess($o.READ_WRITE)}toReadOnly(){return this.setAccess($o.READ_ONLY)}toWriteOnly(){return this.setAccess($o.WRITE_ONLY)}store(e,t){let n=this.clone();return n.referenceNode=this.getBase(),n.uvNode=e,n.storeNode=t,t!==null&&n.toStack(),n}generateStore(e){let t=e.getNodeProperties(this),{uvNode:n,storeNode:r,depthNode:s}=t,o=super.generate(e,"property"),a=n.build(e,this.value.is3DTexture===!0?"uvec3":"uvec2"),l=r.build(e,"vec4"),c=s?s.build(e,"int"):null,u=e.generateTextureStore(this.value,o,a,c,l);e.addLineFlowCode(u,this)}clone(){let e=super.clone();return e.storeNode=this.storeNode,e.mipLevel=this.mipLevel,e.access=this.access,e}},Lse=$n(B4).setParameterLength(1,3),ICe=(i,e,t)=>{let n;return i.isStorageTextureNode===!0?n=i.store(e,t):(n=Lse(i,e,t),t!==null&&n.toStack()),n},Ak=class extends B4{static get type(){return"StorageTexture3DNode"}constructor(e,t,n=null){super(e,t,n),this.isStorageTexture3DNode=!0}getDefaultUV(){return pe(.5,.5,.5)}setUpdateMatrix(){}generateUV(e,t){return t.build(e,this.sampler===!0?"vec3":"ivec3")}generateOffset(e,t){return t.build(e,"ivec3")}},PCe=$n(Ak).setParameterLength(1,3),LCe=me(({texture:i,uv:e})=>{let n=pe().toVar();return $t(e.x.lessThan(1e-4),()=>{n.assign(pe(1,0,0))}).ElseIf(e.y.lessThan(1e-4),()=>{n.assign(pe(0,1,0))}).ElseIf(e.z.lessThan(1e-4),()=>{n.assign(pe(0,0,1))}).ElseIf(e.x.greaterThan(1-1e-4),()=>{n.assign(pe(-1,0,0))}).ElseIf(e.y.greaterThan(1-1e-4),()=>{n.assign(pe(0,-1,0))}).ElseIf(e.z.greaterThan(1-1e-4),()=>{n.assign(pe(0,0,-1))}).Else(()=>{let s=i.sample(e.add(pe(-.01,0,0))).r.sub(i.sample(e.add(pe(.01,0,0))).r),o=i.sample(e.add(pe(0,-.01,0))).r.sub(i.sample(e.add(pe(0,.01,0))).r),a=i.sample(e.add(pe(0,0,-.01))).r.sub(i.sample(e.add(pe(0,0,.01))).r);n.assign(pe(s,o,a))}),n.normalize()}),gk=class extends lu{static get type(){return"Texture3DNode"}constructor(e,t=null,n=null){super(e,t,n),this.isTexture3DNode=!0}getInputType(){return"texture3D"}getDefaultUV(){return pe(.5,.5,.5)}setUpdateMatrix(){}generateUV(e,t){return t.build(e,this.sampler===!0?"vec3":"ivec3")}generateOffset(e,t){return t.build(e,"ivec3")}normal(e){return LCe({texture:this,uv:e})}},xV=$n(gk).setParameterLength(1,3),DCe=(...i)=>xV(...i).setSampler(!1),NCe=(i,e,t)=>xV(i,e).level(t),vk=class extends Ax{static get type(){return"UserDataNode"}constructor(e,t,n=null){super(e,t,n),this.userData=n}updateReference(e){return this.reference=this.userData!==null?this.userData:e.object.userData,this.reference}},FCe=(i,e,t)=>new vk(i,e,t),wte=new WeakMap,_k=class extends Rr{static get type(){return"VelocityNode"}constructor(){super("vec2"),this.projectionMatrix=null,this.updateType=yn.OBJECT,this.updateAfterType=yn.OBJECT,this.previousModelWorldMatrix=Xt(new cn),this.previousProjectionMatrix=Xt(new cn).setGroup(Jt),this.previousCameraViewMatrix=Xt(new cn)}setProjectionMatrix(e){this.projectionMatrix=e}update({frameId:e,camera:t,object:n}){let r=Ste(n);this.previousModelWorldMatrix.value.copy(r);let s=Dse(t);s.frameId!==e&&(s.frameId=e,s.previousProjectionMatrix===void 0?(s.previousProjectionMatrix=new cn,s.previousCameraViewMatrix=new cn,s.currentProjectionMatrix=new cn,s.currentCameraViewMatrix=new cn,s.previousProjectionMatrix.copy(this.projectionMatrix||t.projectionMatrix),s.previousCameraViewMatrix.copy(t.matrixWorldInverse)):(s.previousProjectionMatrix.copy(s.currentProjectionMatrix),s.previousCameraViewMatrix.copy(s.currentCameraViewMatrix)),s.currentProjectionMatrix.copy(this.projectionMatrix||t.projectionMatrix),s.currentCameraViewMatrix.copy(t.matrixWorldInverse),this.previousProjectionMatrix.value.copy(s.previousProjectionMatrix),this.previousCameraViewMatrix.value.copy(s.previousCameraViewMatrix))}updateAfter({object:e}){Ste(e).copy(e.matrixWorld)}setup(){let e=this.projectionMatrix===null?Ja:Xt(this.projectionMatrix),t=this.previousCameraViewMatrix.mul(this.previousModelWorldMatrix),n=e.mul(Tf).mul(Mr),r=this.previousProjectionMatrix.mul(t).mul(r1),s=n.xy.div(n.w),o=r.xy.div(r.w);return ai(s,o)}};function Dse(i){let e=wte.get(i);return e===void 0&&(e={},wte.set(i,e)),e}function Ste(i,e=0){let t=Dse(i),n=t[e];return n===void 0&&(t[e]=n=new cn,t[e].copy(i.matrixWorld)),n}var BCe=xt(_k),OCe=me(([i,e])=>Il(1,i.oneMinus().div(e)).oneMinus()).setLayout({name:"blendBurn",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),UCe=me(([i,e])=>Il(i.div(e.oneMinus()),1)).setLayout({name:"blendDodge",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),kCe=me(([i,e])=>i.oneMinus().mul(e.oneMinus()).oneMinus()).setLayout({name:"blendScreen",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),zCe=me(([i,e])=>Qn(i.mul(2).mul(e),i.oneMinus().mul(2).mul(e.oneMinus()).oneMinus(),t1(.5,i))).setLayout({name:"blendOverlay",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),VCe=me(([i,e])=>{let t=e.a.add(i.a.mul(e.a.oneMinus()));return Ft(e.rgb.mul(e.a).add(i.rgb.mul(i.a).mul(e.a.oneMinus())).div(t),t)}).setLayout({name:"blendColor",type:"vec4",inputs:[{name:"base",type:"vec4"},{name:"blend",type:"vec4"}]}),GCe=me(([i])=>yV(i.rgb)),qCe=me(([i,e=oe(1)])=>e.mix(yV(i.rgb),i.rgb).max(0)),HCe=me(([i,e=oe(0)])=>{let t=Ls(i.r,i.g,i.b).div(3),n=i.r.max(i.g.max(i.b)),r=n.sub(t).mul(e).mul(-3);return Qn(i.rgb,n,r).max(0)}),WCe=me(([i,e=oe(1)])=>{let t=pe(.57735,.57735,.57735),n=e.cos();return pe(i.rgb.mul(n).add(t.cross(i.rgb).mul(e.sin()).add(t.mul(au(t,i.rgb).mul(n.oneMinus()))))).max(0)}),yV=(i,e=pe(ln.getLuminanceCoefficients(new re)))=>au(i,e),jCe=me(([i,e=pe(1),t=pe(0),n=pe(1),r=oe(1),s=pe(ln.getLuminanceCoefficients(new re,n0))])=>{let o=i.rgb.dot(pe(s)),a=zr(i.rgb.mul(e).add(t),0),l=a.pow(n);return $t(a.r.greaterThan(0),()=>{a.r.assign(l.r)}),$t(a.g.greaterThan(0),()=>{a.g.assign(l.g)}),$t(a.b.greaterThan(0),()=>{a.b.assign(l.b)}),a.assign(o.add(a.sub(o).mul(r)).max(0)),Ft(a.rgb,i.a)}),XCe=me(([i,e])=>i.mul(e).floor().div(e)),PR=null,xk=class extends gx{static get type(){return"ViewportSharedTextureNode"}constructor(e=$u,t=null){PR===null&&(PR=new XA),super(e,t,PR)}getTextureForReference(){return PR}updateReference(){return this}},$Ce=$n(xk).setParameterLength(0,2),LR=new Oe,O4=class extends lu{static get type(){return"PassTextureNode"}constructor(e,t){super(t),this.passNode=e,this.isPassTextureNode=!0,this.setUpdateMatrix(!1)}setup(e){let t=e.getNodeProperties(this);return t.passNode=this.passNode,super.setup(e)}clone(){return new this.constructor(this.passNode,this.value)}},U4=class extends O4{static get type(){return"PassMultipleTextureNode"}constructor(e,t,n=!1){super(e,null),this.textureName=t,this.previousTexture=n,this.isPassMultipleTextureNode=!0}updateTexture(){this.value=this.previousTexture?this.passNode.getPreviousTexture(this.textureName):this.passNode.getTexture(this.textureName)}setup(e){return this.updateTexture(),super.setup(e)}clone(){let e=new this.constructor(this.passNode,this.textureName,this.previousTexture);return e.uvNode=this.uvNode,e.levelNode=this.levelNode,e.biasNode=this.biasNode,e.sampler=this.sampler,e.depthNode=this.depthNode,e.compareNode=this.compareNode,e.gradNode=this.gradNode,e.gatherNode=this.gatherNode,e.offsetNode=this.offsetNode,e}},Rf=class i extends Rr{static get type(){return"PassNode"}constructor(e,t,n,r={}){super("vec4"),this.scope=e,this.scene=t,this.camera=n,this.options=r,this._width=1,this._height=1;let s=new Ba(this._width,this._height,{type:Wi,...r});s.texture.name="output";let o=null;(this.scope===i.DEPTH||r.depthBuffer!==!1)&&(o=new Cs,o.isRenderTargetTexture=!0,o.name="depth",s.depthTexture=o),this.renderTarget=s,this.overrideMaterial=null,this.transparent=!0,this.opaque=!0,this.contextNode=null,this._contextNodeCache=null,this._textures={output:s.texture},o!==null&&(this._textures.depth=o),this._textureNodes={},this._linearDepthNodes={},this._viewZNodes={},this._previousTextures={},this._previousTextureNodes={},this._cameraNear=Xt(0),this._cameraFar=Xt(0),this._mrt=null,this._layers=null,this._resolutionScale=1,this._viewport=null,this._scissor=null,this.isPassNode=!0,this.updateBeforeType=yn.FRAME,this.global=!0}setResolutionScale(e){return this._resolutionScale=e,this}getResolutionScale(){return this._resolutionScale}setResolution(e){return Xe("PassNode: .setResolution() is deprecated. Use .setResolutionScale() instead."),this.setResolutionScale(e)}getResolution(){return Xe("PassNode: .getResolution() is deprecated. Use .getResolutionScale() instead."),this.getResolutionScale()}setLayers(e){return this._layers=e,this}getLayers(){return this._layers}setMRT(e){return this._mrt=e,this}getMRT(){return this._mrt}getTexture(e){let t=this._textures[e];if(t===void 0){if(e==="depth")throw new Error("THREE.PassNode: Depth texture is not available for this pass.");t=this.renderTarget.texture.clone(),t.name=e,this._textures[e]=t,this.renderTarget.textures.push(t)}return t}getPreviousTexture(e){let t=this._previousTextures[e];return t===void 0&&(t=this.getTexture(e).clone(),this._previousTextures[e]=t),t}toggleTexture(e){let t=this._previousTextures[e];if(t!==void 0){let n=this._textures[e],r=this.renderTarget.textures.indexOf(n);this.renderTarget.textures[r]=t,this._textures[e]=t,this._previousTextures[e]=n,this._textureNodes[e].updateTexture(),this._previousTextureNodes[e].updateTexture()}}getTextureNode(e="output"){let t=this._textureNodes[e];return t===void 0&&(t=new U4(this,e),t.updateTexture(),this._textureNodes[e]=t),t}getPreviousTextureNode(e="output"){let t=this._previousTextureNodes[e];return t===void 0&&(this._textureNodes[e]===void 0&&this.getTextureNode(e),t=new U4(this,e,!0),t.updateTexture(),this._previousTextureNodes[e]=t),t}getViewZNode(e="depth"){let t=this._viewZNodes[e];if(t===void 0){let n=this._cameraNear,r=this._cameraFar;this._viewZNodes[e]=t=NI(this.getTextureNode(e),n,r)}return t}getLinearDepthNode(e="depth"){let t=this._linearDepthNodes[e];if(t===void 0){let n=this._cameraNear,r=this._cameraFar,s=this.getViewZNode(e);this._linearDepthNodes[e]=t=Kg(s,n,r)}return t}async compileAsync(e){let t=e.getRenderTarget(),n=e.getMRT();e.setRenderTarget(this.renderTarget),e.setMRT(this._mrt),await e.compileAsync(this.scene,this.camera),e.setRenderTarget(t),e.setMRT(n)}setup({renderer:e}){return this.renderTarget.samples=this.options.samples===void 0?e.samples:this.options.samples,this.renderTarget.texture.type=e.getOutputBufferType(),e.reversedDepthBuffer===!0&&this.renderTarget.depthTexture!==null&&(this.renderTarget.depthTexture.type=cr),this.scope===i.COLOR?this.getTextureNode():this.getLinearDepthNode()}updateBefore(e){let{renderer:t}=e,{scene:n}=this,r,s=t.getOutputRenderTarget();s&&s.isXRRenderTarget===!0?(r=t.xr.getCamera(),t.xr.updateCamera(r),LR.set(s.width,s.height)):(r=this.camera,t.getDrawingBufferSize(LR)),this.setSize(LR.width,LR.height);let o=t.getRenderTarget(),a=t.getMRT(),l=t.autoClear,c=t.transparent,u=t.opaque,f=r.layers.mask,d=t.contextNode,A=n.overrideMaterial;this._cameraNear.value=r.near,this._cameraFar.value=r.far,this._layers!==null&&(r.layers.mask=this._layers.mask);for(let w in this._previousTextures)this.toggleTexture(w);this.overrideMaterial!==null&&(n.overrideMaterial=this.overrideMaterial),t.setRenderTarget(this.renderTarget),t.setMRT(this._mrt),t.autoClear=!0,t.transparent=this.transparent,t.opaque=this.opaque,this.contextNode!==null&&((this._contextNodeCache===null||this._contextNodeCache.version!==this.version)&&(this._contextNodeCache={version:this.version,context:tp({...t.contextNode.getFlowContextData(),...this.contextNode.getFlowContextData()})}),t.contextNode=this._contextNodeCache.context);let y=n.name;n.name=this.name?this.name:n.name,t.render(n,r),n.name=y,n.overrideMaterial=A,t.setRenderTarget(o),t.setMRT(a),t.autoClear=l,t.transparent=c,t.opaque=u,t.contextNode=d,r.layers.mask=f}setSize(e,t){this._width=e,this._height=t;let n=Math.floor(this._width*this._resolutionScale),r=Math.floor(this._height*this._resolutionScale);this.renderTarget.setSize(n,r),this._scissor!==null?(this.renderTarget.scissor.copy(this._scissor).multiplyScalar(this._resolutionScale).floor(),this.renderTarget.scissorTest=!0):this.renderTarget.scissorTest=!1,this._viewport!==null&&this.renderTarget.viewport.copy(this._viewport).multiplyScalar(this._resolutionScale).floor()}setScissor(e,t,n,r){e===null?this._scissor=null:(this._scissor===null&&(this._scissor=new xn),e.isVector4?this._scissor.copy(e):this._scissor.set(e,t,n,r))}setViewport(e,t,n,r){e===null?this._viewport=null:(this._viewport===null&&(this._viewport=new xn),e.isVector4?this._viewport.copy(e):this._viewport.set(e,t,n,r))}dispose(){this.renderTarget.dispose()}};Rf.COLOR="color";Rf.DEPTH="depth";var YCe=(i,e,t)=>new Rf(Rf.COLOR,i,e,t),ZCe=(i,e)=>new O4(i,e),KCe=(i,e,t)=>new Rf(Rf.DEPTH,i,e,t),yk=class extends Rf{static get type(){return"ToonOutlinePassNode"}constructor(e,t,n,r,s){super(Rf.COLOR,e,t),this.colorNode=n,this.thicknessNode=r,this.alphaNode=s,this._materialCache=new WeakMap,this.name="Outline Pass"}updateBefore(e){let{renderer:t}=e,n=t.getRenderObjectFunction();t.setRenderObjectFunction((r,s,o,a,l,c,u,f)=>{if((l.isMeshToonMaterial||l.isMeshToonNodeMaterial)&&l.wireframe===!1){let d=this._getOutlineMaterial(l);t.renderObject(r,s,o,a,d,c,u,f)}t.renderObject(r,s,o,a,l,c,u,f)}),super.updateBefore(e),t.setRenderObjectFunction(n)}_createMaterial(){let e=new Ir;e.isMeshToonOutlineMaterial=!0,e.name="Toon_Outline",e.side=mi;let t=ba.negate(),n=Ja.mul(Tf),r=oe(1),s=n.mul(Ft(Mr,1)),o=n.mul(Ft(Mr.add(t),1)),a=xa(s.sub(o));return e.vertexNode=s.add(a.mul(this.thicknessNode).mul(s.w).mul(r)),e.colorNode=Ft(this.colorNode,this.alphaNode),e}_getOutlineMaterial(e){let t=this._materialCache.get(e);return t===void 0&&(t=this._createMaterial(),this._materialCache.set(e,t)),t}},QCe=(i,e,t=new zt(0,0,0),n=.003,r=1)=>new yk(i,e,Ht(t),Ht(n),Ht(r)),Nse=me(([i,e])=>i.mul(e).clamp()).setLayout({name:"linearToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),Fse=me(([i,e])=>(i=i.mul(e),i.div(i.add(1)).clamp())).setLayout({name:"reinhardToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),Bse=me(([i,e])=>{i=i.mul(e),i=i.sub(.004).max(0);let t=i.mul(i.mul(6.2).add(.5)),n=i.mul(i.mul(6.2).add(1.7)).add(.06);return t.div(n).pow(2.2)}).setLayout({name:"cineonToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),JCe=me(([i])=>{let e=i.mul(i.add(.0245786)).sub(90537e-9),t=i.mul(i.add(.432951).mul(.983729)).add(.238081);return e.div(t)}),Ose=me(([i,e])=>{let t=To(.59719,.35458,.04823,.076,.90834,.01566,.0284,.13383,.83777),n=To(1.60475,-.53108,-.07367,-.10208,1.10813,-.00605,-.00327,-.07276,1.07602);return i=i.mul(e).div(.6),i=t.mul(i),i=JCe(i),i=n.mul(i),i.clamp()}).setLayout({name:"acesFilmicToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),eRe=To(pe(1.6605,-.1246,-.0182),pe(-.5876,1.1329,-.1006),pe(-.0728,-.0083,1.1187)),tRe=To(pe(.6274,.0691,.0164),pe(.3293,.9195,.088),pe(.0433,.0113,.8956)),nRe=me(([i])=>{let e=pe(i).toVar(),t=pe(e.mul(e)).toVar(),n=pe(t.mul(t)).toVar();return oe(15.5).mul(n.mul(t)).sub(Tn(40.14,n.mul(e))).add(Tn(31.96,n).sub(Tn(6.868,t.mul(e))).add(Tn(.4298,t).add(Tn(.1191,e).sub(.00232))))}),Use=me(([i,e])=>{let t=pe(i).toVar(),n=To(pe(.856627153315983,.137318972929847,.11189821299995),pe(.0951212405381588,.761241990602591,.0767994186031903),pe(.0482516061458583,.101439036467562,.811302368396859)),r=To(pe(1.1271005818144368,-.1413297634984383,-.14132976349843826),pe(-.11060664309660323,1.157823702216272,-.11060664309660294),pe(-.016493938717834573,-.016493938717834257,1.2519364065950405)),s=oe(-12.47393),o=oe(4.026069);return t.mulAssign(e),t.assign(tRe.mul(t)),t.assign(n.mul(t)),t.assign(zr(t,1e-10)),t.assign(_f(t)),t.assign(t.sub(s).div(o.sub(s))),t.assign(Ku(t,0,1)),t.assign(nRe(t)),t.assign(r.mul(t)),t.assign(iu(zr(pe(0),t),pe(2.2))),t.assign(eRe.mul(t)),t.assign(Ku(t,0,1)),t}).setLayout({name:"agxToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),kse=me(([i,e])=>{let t=oe(.76),n=oe(.15);i=i.mul(e);let r=Il(i.r,Il(i.g,i.b)),s=_a(r.lessThan(.08),r.sub(Tn(6.25,r.mul(r))),.04);i.subAssign(s);let o=zr(i.r,zr(i.g,i.b));$t(o.lessThan(t),()=>i);let a=ai(1,t),l=ai(1,a.mul(a).div(o.add(a.sub(t))));i.mulAssign(l.div(o));let c=ai(1,pc(1,n.mul(o.sub(l)).add(1)));return Qn(i,pe(l),c)}).setLayout({name:"neutralToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),hr=class extends Kt{static get type(){return"CodeNode"}constructor(e="",t=[],n=""){super("code"),this.isCodeNode=!0,this.global=!0,this.code=e,this.includes=t,this.language=n}setIncludes(e){return this.includes=e,this}getIncludes(){return this.includes}generate(e){let t=this.getIncludes(e);for(let r of t)r.build(e);let n=e.getCodeFromNode(this,this.getNodeType(e));return n.code=this.code,n.code}serialize(e){super.serialize(e),e.code=this.code,e.language=this.language}deserialize(e){super.deserialize(e),this.code=e.code,this.language=e.language}},kI=$n(hr).setParameterLength(1,3),iRe=(i,e)=>kI(i,e,"js"),rRe=(i,e)=>kI(i,e,"wgsl"),sRe=(i,e)=>kI(i,e,"glsl"),k4=class extends hr{static get type(){return"FunctionNode"}constructor(e="",t=[],n=""){super(e,t,n)}generateNodeType(e){return this.getNodeFunction(e).type}getMemberType(e,t){let n=this.getNodeType(e);return e.getStructTypeNode(n).getMemberType(e,t)}getInputs(e){return this.getNodeFunction(e).inputs}getNodeFunction(e){let t=e.getDataFromNode(this),n=t.nodeFunction;return n===void 0&&(n=e.parser.parseFunction(this.code),t.nodeFunction=n),n}generate(e,t){super.generate(e);let n=this.getNodeFunction(e),r=n.name,s=n.type,o=e.getCodeFromNode(this,s);r!==""&&(o.name=r);let a=e.getPropertyName(o),l=this.getNodeFunction(e).getCode(a);return o.code=l+`4159+`,t==="property"?a:e.format(`${a}()`,s,t)}},zse=(i,e=[],t="")=>{let n=new k4(i,e,t);return lz((...s)=>n.call(...s),n)},oRe=(i,e)=>zse(i,e,"glsl"),aRe=(i,e)=>zse(i,e,"wgsl");function bV(i){let e,t=i.context.getViewZ;return t!==void 0&&(e=t(this)),(e||xs.z).negate()}var Vse=me(([i,e],t)=>{let n=bV(t);return mc(i,e,n)}),Gse=me(([i],e)=>{let t=bV(e);return i.mul(i,t,t).negate().exp().oneMinus()}),lRe=me(([i,e],t)=>{let n=bV(t),s=e.sub(bf.y).max(0).toConst().mul(n).toConst();return i.mul(i,s,s).negate().exp().oneMinus()}),bk=me(([i,e])=>Ft(e.toFloat().mix(lx.rgb,i.toVec3()),lx.a)),Bg=null,Og=null,wk=class extends Kt{static get type(){return"RangeNode"}constructor(e=oe(),t=oe()){super(),this.minNode=e,this.maxNode=t}getVectorLength(e){let t=this.getConstNode(this.minNode),n=this.getConstNode(this.maxNode),r=e.getTypeLength(dm(t.value)),s=e.getTypeLength(dm(n.value));return r>s?r:s}generateNodeType(e){return e.object.count>1?e.getTypeFromLength(this.getVectorLength(e)):"float"}getConstNode(e){let t=null;if(e.traverse(n=>{n.isConstNode===!0&&(t=n)}),t===null)throw new g4('THREE.TSL: No "ConstNode" found in node graph.',this.stackTrace);return t}setup(e){let t=e.object,n=null;if(t.count>1){let r=this.getConstNode(this.minNode),s=this.getConstNode(this.maxNode),o=r.value,a=s.value,l=e.getTypeLength(dm(o)),c=e.getTypeLength(dm(a));Bg=Bg||new xn,Og=Og||new xn,Bg.setScalar(0),Og.setScalar(0),l===1?Bg.setScalar(o):o.isColor?Bg.set(o.r,o.g,o.b,1):Bg.set(o.x,o.y,o.z||0,o.w||0),c===1?Og.setScalar(a):a.isColor?Og.set(a.r,a.g,a.b,1):Og.set(a.x,a.y,a.z||0,a.w||0);let u=4,f=u*t.count,d=new Float32Array(f);for(let w=0;w<f;w++){let S=w%u,T=Bg.getComponent(S),R=Og.getComponent(S);d[w]=Uu.lerp(T,R,Math.random())}let A=this.getNodeType(e);if(t.count*4*4<=e.getUniformBufferLimit())n=Sx(d,"vec4",t.count).element(Yu).convert(A);else{let w=new Ql(d,4);e.geometry.setAttribute("__range"+this.id,w),n=RI(w).convert(A)}}else n=oe(0);return n}},cRe=$n(wk).setParameterLength(2),Sk=class extends Kt{static get type(){return"ComputeBuiltinNode"}constructor(e,t){super(t),this._builtinName=e}getHash(e){return this.getBuiltinName(e)}generateNodeType(){return this.nodeType}setBuiltinName(e){return this._builtinName=e,this}getBuiltinName(){return this._builtinName}hasBuiltin(e){return e.hasBuiltin(this._builtinName)}generate(e,t){let n=this.getBuiltinName(e),r=this.getNodeType(e);return e.shaderStage==="compute"?e.format(n,r,t):(Xe(`ComputeBuiltinNode: Compute built-in value ${n} can not be accessed in the ${e.shaderStage} stage`),e.generateConst(r))}serialize(e){super.serialize(e),e.global=this.global,e._builtinName=this._builtinName}deserialize(e){super.deserialize(e),this.global=e.global,this._builtinName=e._builtinName}},kS=(i,e)=>new Sk(i,e),uRe=kS("numWorkgroups","uvec3"),hRe=kS("workgroupId","uvec3"),fRe=kS("globalId","uvec3"),dRe=kS("localId","uvec3"),pRe=kS("subgroupSize","uint"),Tk=class extends Kt{constructor(e){super(),this.scope=e,this.isBarrierNode=!0}setup(e){e.allowEarlyReturns=!1,e.allowGlobalVariables=!1}generate(e){let{scope:t}=this,{renderer:n}=e;n.backend.isWebGLBackend===!0?e.addFlowCode(` // ${t}Barrier 4160+`):e.addLineFlowCode(`${t}Barrier()`,this)}},wV=$n(Tk),mRe=()=>wV("workgroup").toStack(),ARe=()=>wV("storage").toStack(),gRe=()=>wV("texture").toStack(),Ek=class extends Kd{constructor(e,t){super(e,t),this.isWorkgroupInfoElementNode=!0}generate(e,t){let n,r=e.isContextAssign();if(n=super.generate(e),r!==!0){let s=this.getNodeType(e);n=e.format(n,s,t)}return n}},Mk=class extends Kt{constructor(e,t,n=0){super(t),this.bufferType=t,this.bufferCount=n,this.isWorkgroupInfoNode=!0,this.elementType=t,this.scope=e,this.name=""}setName(e){return this.name=e,this}label(e){return Xe('TSL: "label()" has been deprecated. Use "setName()" instead.',new es),this.setName(e)}setScope(e){return this.scope=e,this}getElementType(){return this.elementType}getInputType(){return`${this.scope}Array`}element(e){return new Ek(this,e)}generate(e){let t=this.name!==""?this.name:`${this.scope}Array_${this.id}`;return e.getScopedArray(t,this.scope.toLowerCase(),this.bufferType,this.bufferCount)}},vRe=(i,e)=>new Mk("Workgroup",i,e),Ns=class extends Kt{static get type(){return"AtomicFunctionNode"}constructor(e,t,n){super("uint"),this.method=e,this.pointerNode=t,this.valueNode=n,this.parents=!0}getInputType(e){return this.pointerNode.getNodeType(e)}generateNodeType(e){return this.getInputType(e)}generate(e){let t=e.getNodeProperties(this),n=t.parents,r=this.method,s=this.getNodeType(e),o=this.getInputType(e),a=this.pointerNode,l=this.valueNode,c=[];c.push(`&${a.build(e,o)}`),l!==null&&c.push(l.build(e,o));let u=`${e.getMethod(r,s)}( ${c.join(", ")} )`;if(n?n.length===1&&n[0].isStackNode===!0:!1)e.addLineFlowCode(u,this);else return t.constNode===void 0&&(t.constNode=hc(u,s).toConst()),t.constNode.build(e)}};Ns.ATOMIC_LOAD="atomicLoad";Ns.ATOMIC_STORE="atomicStore";Ns.ATOMIC_ADD="atomicAdd";Ns.ATOMIC_SUB="atomicSub";Ns.ATOMIC_MAX="atomicMax";Ns.ATOMIC_MIN="atomicMin";Ns.ATOMIC_AND="atomicAnd";Ns.ATOMIC_OR="atomicOr";Ns.ATOMIC_XOR="atomicXor";var _Re=$n(Ns),Pf=(i,e,t)=>_Re(i,e,t).toStack(),xRe=i=>Pf(Ns.ATOMIC_LOAD,i,null),yRe=(i,e)=>Pf(Ns.ATOMIC_STORE,i,e),bRe=(i,e)=>Pf(Ns.ATOMIC_ADD,i,e),wRe=(i,e)=>Pf(Ns.ATOMIC_SUB,i,e),SRe=(i,e)=>Pf(Ns.ATOMIC_MAX,i,e),TRe=(i,e)=>Pf(Ns.ATOMIC_MIN,i,e),ERe=(i,e)=>Pf(Ns.ATOMIC_AND,i,e),MRe=(i,e)=>Pf(Ns.ATOMIC_OR,i,e),CRe=(i,e)=>Pf(Ns.ATOMIC_XOR,i,e),Ot=class i extends Rr{static get type(){return"SubgroupFunctionNode"}constructor(e,t=null,n=null){super(),this.method=e,this.aNode=t,this.bNode=n}getInputType(e){let t=this.aNode?this.aNode.getNodeType(e):null,n=this.bNode?this.bNode.getNodeType(e):null,r=e.isMatrix(t)?0:e.getTypeLength(t),s=e.isMatrix(n)?0:e.getTypeLength(n);return r>s?t:n}generateNodeType(e){let t=this.method;return t===i.SUBGROUP_ELECT?"bool":t===i.SUBGROUP_BALLOT?"uvec4":this.getInputType(e)}generate(e,t){let n=this.method,r=this.getNodeType(e),s=this.getInputType(e),o=this.aNode,a=this.bNode,l=[];if(n===i.SUBGROUP_BROADCAST||n===i.SUBGROUP_SHUFFLE||n===i.QUAD_BROADCAST){let u=a.getNodeType(e);l.push(o.build(e,r),a.build(e,u==="float"?"int":r))}else n===i.SUBGROUP_SHUFFLE_XOR||n===i.SUBGROUP_SHUFFLE_DOWN||n===i.SUBGROUP_SHUFFLE_UP?l.push(o.build(e,r),a.build(e,"uint")):(o!==null&&l.push(o.build(e,s)),a!==null&&l.push(a.build(e,s)));let c=l.length===0?"()":`( ${l.join(", ")} )`;return e.format(`${e.getMethod(n,r)}${c}`,r,t)}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}};Ot.SUBGROUP_ELECT="subgroupElect";Ot.SUBGROUP_BALLOT="subgroupBallot";Ot.SUBGROUP_ADD="subgroupAdd";Ot.SUBGROUP_INCLUSIVE_ADD="subgroupInclusiveAdd";Ot.SUBGROUP_EXCLUSIVE_AND="subgroupExclusiveAdd";Ot.SUBGROUP_MUL="subgroupMul";Ot.SUBGROUP_INCLUSIVE_MUL="subgroupInclusiveMul";Ot.SUBGROUP_EXCLUSIVE_MUL="subgroupExclusiveMul";Ot.SUBGROUP_AND="subgroupAnd";Ot.SUBGROUP_OR="subgroupOr";Ot.SUBGROUP_XOR="subgroupXor";Ot.SUBGROUP_MIN="subgroupMin";Ot.SUBGROUP_MAX="subgroupMax";Ot.SUBGROUP_ALL="subgroupAll";Ot.SUBGROUP_ANY="subgroupAny";Ot.SUBGROUP_BROADCAST_FIRST="subgroupBroadcastFirst";Ot.QUAD_SWAP_X="quadSwapX";Ot.QUAD_SWAP_Y="quadSwapY";Ot.QUAD_SWAP_DIAGONAL="quadSwapDiagonal";Ot.SUBGROUP_BROADCAST="subgroupBroadcast";Ot.SUBGROUP_SHUFFLE="subgroupShuffle";Ot.SUBGROUP_SHUFFLE_XOR="subgroupShuffleXor";Ot.SUBGROUP_SHUFFLE_UP="subgroupShuffleUp";Ot.SUBGROUP_SHUFFLE_DOWN="subgroupShuffleDown";Ot.QUAD_BROADCAST="quadBroadcast";var RRe=ct(Ot,Ot.SUBGROUP_ELECT).setParameterLength(0),IRe=ct(Ot,Ot.SUBGROUP_BALLOT).setParameterLength(1),PRe=ct(Ot,Ot.SUBGROUP_ADD).setParameterLength(1),LRe=ct(Ot,Ot.SUBGROUP_INCLUSIVE_ADD).setParameterLength(1),DRe=ct(Ot,Ot.SUBGROUP_EXCLUSIVE_AND).setParameterLength(1),NRe=ct(Ot,Ot.SUBGROUP_MUL).setParameterLength(1),FRe=ct(Ot,Ot.SUBGROUP_INCLUSIVE_MUL).setParameterLength(1),BRe=ct(Ot,Ot.SUBGROUP_EXCLUSIVE_MUL).setParameterLength(1),ORe=ct(Ot,Ot.SUBGROUP_AND).setParameterLength(1),URe=ct(Ot,Ot.SUBGROUP_OR).setParameterLength(1),kRe=ct(Ot,Ot.SUBGROUP_XOR).setParameterLength(1),zRe=ct(Ot,Ot.SUBGROUP_MIN).setParameterLength(1),VRe=ct(Ot,Ot.SUBGROUP_MAX).setParameterLength(1),GRe=ct(Ot,Ot.SUBGROUP_ALL).setParameterLength(0),qRe=ct(Ot,Ot.SUBGROUP_ANY).setParameterLength(0),HRe=ct(Ot,Ot.SUBGROUP_BROADCAST_FIRST).setParameterLength(2),WRe=ct(Ot,Ot.QUAD_SWAP_X).setParameterLength(1),jRe=ct(Ot,Ot.QUAD_SWAP_Y).setParameterLength(1),XRe=ct(Ot,Ot.QUAD_SWAP_DIAGONAL).setParameterLength(1),$Re=ct(Ot,Ot.SUBGROUP_BROADCAST).setParameterLength(2),YRe=ct(Ot,Ot.SUBGROUP_SHUFFLE).setParameterLength(2),ZRe=ct(Ot,Ot.SUBGROUP_SHUFFLE_XOR).setParameterLength(2),KRe=ct(Ot,Ot.SUBGROUP_SHUFFLE_UP).setParameterLength(2),QRe=ct(Ot,Ot.SUBGROUP_SHUFFLE_DOWN).setParameterLength(2),JRe=ct(Ot,Ot.QUAD_BROADCAST).setParameterLength(1),DR;function zI(i){DR=DR||new WeakMap;let e=DR.get(i);return e===void 0&&DR.set(i,e={}),e}function VI(i){let e=zI(i);return e.shadowMatrix||(e.shadowMatrix=Xt("mat4").setGroup(Jt).onRenderUpdate(t=>((i.castShadow!==!0||t.renderer.shadowMap.enabled===!1)&&(i.shadow.camera.coordinateSystem!==t.camera.coordinateSystem&&(i.shadow.camera.coordinateSystem=t.camera.coordinateSystem,i.shadow.camera.updateProjectionMatrix()),i.shadow.updateMatrices(i)),i.shadow.matrix)))}function qse(i,e=bf){let t=VI(i).mul(e);return t.xyz.div(t.w)}function SV(i){let e=zI(i);return e.position||(e.position=Xt(new re).setGroup(Jt).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(i.matrixWorld)))}function Hse(i){let e=zI(i);return e.targetPosition||(e.targetPosition=Xt(new re).setGroup(Jt).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(i.target.matrixWorld)))}function TV(i){let e=zI(i);return e.viewPosition||(e.viewPosition=Xt(new re).setGroup(Jt).onRenderUpdate(({camera:t},n)=>{n.value=n.value||new re,n.value.setFromMatrixPosition(i.matrixWorld),n.value.applyMatrix4(t.matrixWorldInverse)}))}var EV=i=>Sm.transformDirection(SV(i).sub(Hse(i))),e4e=ep("vec3","totalDiffuse"),t4e=ep("vec3","totalSpecular"),n4e=ep("vec3","outgoingLight"),i4e=i=>i.sort((e,t)=>e.id-t.id),r4e=(i,e)=>{for(let t of e)if(t.isAnalyticLightNode&&t.light.id===i)return t;return null},tU=new WeakMap,Xw=[],MS=class extends Kt{static get type(){return"LightsNode"}constructor(){super("vec3"),this.totalDiffuseNode=e4e,this.totalSpecularNode=t4e,this.outgoingLightNode=n4e,this._lights=[],this.global=!0}customCacheKey(){let e=this._lights;for(let n=0;n<e.length;n++){let r=e[n];if(Xw.push(r.id),Xw.push(r.castShadow?1:0),r.isSpotLight===!0){let s=r.map!==null?r.map.id:-1,o=r.colorNode?r.colorNode.getCacheKey():-1;Xw.push(s,o)}}let t=FS(Xw);return Xw.length=0,t}getHash(e){let t=e.getDataFromNode(this);if(t.lightNodesHash===void 0){let n=this.setupLightsNode(e);t.lightNodes=n;let r=[];for(let s of n)r.push(s.getHash());t.lightNodesHash="lights-"+r.join(",")}return t.lightNodesHash}analyze(e){let t=e.getNodeProperties(this);for(let n of t.nodes)n.build(e);t.outputNode.build(e)}setupLightsNode(e){let t=e.getDataFromNode(this),n=[],r=t.lightNodes||null,s=e.context.materialLightings,o=i4e([...s,...this._lights]),a=e.renderer.library;for(let l of o)if(l.isNode)n.push(l);else{let c=null;if(r!==null&&(c=r4e(l.id,r)),c===null){let u=a.getLightNodeClass(l.constructor);if(u===null){Xe(`LightsNode.setupNodeLights: Light node not found for ${l.constructor.name}`);continue}tU.has(l)===!1&&tU.set(l,new u(l)),c=tU.get(l)}n.push(c)}return n}setupDirectLight(e,t,n){let{lightingModel:r,reflectedLight:s}=e.context;r.direct({...n,lightNode:t,reflectedLight:s},e)}setupDirectRectAreaLight(e,t,n){let{lightingModel:r,reflectedLight:s}=e.context;r.directRectArea({...n,lightNode:t,reflectedLight:s},e)}setupLights(e,t){for(let n of t)n.build(e)}getLightNodes(e){let t=e.getDataFromNode(this);return t.lightNodes===void 0&&(t.lightNodes=this.setupLightsNode(e)),t.lightNodes}setup(e){let t=e.lightsNode;e.lightsNode=this;let n=this.outgoingLightNode,r=e.context,s=r.lightingModel,o=e.getNodeProperties(this);if(s){let{totalDiffuseNode:a,totalSpecularNode:l}=this;r.outgoingLight=n;let c=e.addStack();o.nodes=c.nodes,s.start(e);let{backdrop:u,backdropAlpha:f}=r,{directDiffuse:d,directSpecular:A,indirectDiffuse:y,indirectSpecular:w}=r.reflectedLight,S=d.add(y);u!==null&&(f!==null?S=pe(f.mix(S,u)):S=pe(u)),a.assign(S),l.assign(A.add(w)),n.assign(a.add(l)),s.finish(e),n=n.bypass(e.removeStack())}else o.nodes=[];return e.lightsNode=t,n}setLights(e){return this._lights=e,this}getLights(){return this._lights}get hasLights(){return this._lights.length>0}},s4e=(i=[])=>new MS().setLights(i),Ck=class extends Kt{static get type(){return"ShadowBaseNode"}constructor(e){super(),this.light=e,this.updateBeforeType=yn.RENDER,this.isShadowBaseNode=!0}setupShadowPosition({context:e,material:t}){MV.assign(t.receivedShadowPositionNode||e.shadowPositionWorld||bf)}},MV=ep("vec3","shadowPositionWorld");function o4e(i,e={}){return e.toneMapping=i.toneMapping,e.toneMappingExposure=i.toneMappingExposure,e.outputColorSpace=i.outputColorSpace,e.renderTarget=i.getRenderTarget(),e.activeCubeFace=i.getActiveCubeFace(),e.activeMipmapLevel=i.getActiveMipmapLevel(),e.renderObjectFunction=i.getRenderObjectFunction(),e.pixelRatio=i.getPixelRatio(),e.mrt=i.getMRT(),e.clearColor=i.getClearColor(e.clearColor||new zt),e.clearAlpha=i.getClearAlpha(),e.autoClear=i.autoClear,e.scissorTest=i.getScissorTest(),e}function a4e(i,e){return e=o4e(i,e),i.setMRT(null),i.setRenderObjectFunction(null),i.setClearColor(0,1),i.autoClear=!0,e}function l4e(i,e){i.toneMapping=e.toneMapping,i.toneMappingExposure=e.toneMappingExposure,i.outputColorSpace=e.outputColorSpace,i.setRenderTarget(e.renderTarget,e.activeCubeFace,e.activeMipmapLevel),i.setRenderObjectFunction(e.renderObjectFunction),i.setPixelRatio(e.pixelRatio),i.setMRT(e.mrt),i.setClearColor(e.clearColor,e.clearAlpha),i.autoClear=e.autoClear,i.setScissorTest(e.scissorTest)}function c4e(i,e={}){return e.background=i.background,e.backgroundNode=i.backgroundNode,e.overrideMaterial=i.overrideMaterial,e}function u4e(i,e){return e=c4e(i,e),i.background=null,i.backgroundNode=null,i.overrideMaterial=null,e}function h4e(i,e){i.background=e.background,i.backgroundNode=e.backgroundNode,i.overrideMaterial=e.overrideMaterial}function f4e(i,e,t){return t=a4e(i,t),t=u4e(e,t),t}function d4e(i,e,t){l4e(i,t),h4e(e,t)}var z4=new WeakMap,Wse=me(({depthTexture:i,shadowCoord:e,depthLayer:t})=>{let n=fi(i,e.xy).setName("t_basic");return i.isArrayTexture&&(n=n.depth(t)),n.compare(e.z)}),jse=me(({depthTexture:i,shadowCoord:e,shadow:t,depthLayer:n})=>{let r=(u,f)=>{let d=fi(i,u);return i.isArrayTexture&&(d=d.depth(n)),d.compare(f)},s=mr("mapSize","vec2",t).setGroup(Jt),o=mr("radius","float",t).setGroup(Jt),a=dt(1).div(s),l=o.mul(a.x),c=_V(f1.xy).mul(6.28318530718);return Ls(r(e.xy.add(Xu(0,5,c).mul(l)),e.z),r(e.xy.add(Xu(1,5,c).mul(l)),e.z),r(e.xy.add(Xu(2,5,c).mul(l)),e.z),r(e.xy.add(Xu(3,5,c).mul(l)),e.z),r(e.xy.add(Xu(4,5,c).mul(l)),e.z)).mul(1/5)}),Xse=me(({depthTexture:i,shadowCoord:e,shadow:t,depthLayer:n})=>{let r=mr("mapSize","vec2",t).setGroup(Jt),s=dt(1).div(r),o=e.xy,a=Zu(o.mul(r).add(.5)).toConst();o.subAssign(a.sub(.5).mul(s));let l=A=>{let y=fi(i,o).offset(A).gather();return i.isArrayTexture&&(y=y.depth(n)),y.compare(e.z)},c=l(kr(-1,1)).toConst(),u=l(kr(1,1)).toConst(),f=l(kr(-1,-1)).toConst(),d=l(kr(1,-1)).toConst();return Ls(Qn(c.x,u.y,a.x).add(c.y).add(u.x).mul(a.y),Qn(c.w,u.z,a.x).add(c.z).add(u.w),Qn(f.x,d.y,a.x).add(f.y).add(d.x),Qn(f.w,d.z,a.x).add(f.z).add(d.w).mul(a.y.oneMinus())).mul(1/9)}),$se=me(({depthTexture:i,shadowCoord:e,depthLayer:t},n)=>{let r=fi(i).sample(e.xy);i.isArrayTexture&&(r=r.depth(t)),r=r.rg;let s=r.x,o=zr(1e-7,r.y.mul(r.y)),a=n.renderer.reversedDepthBuffer?t1(s,e.z):t1(e.z,s),l=oe(1).toVar();return $t(a.notEqual(1),()=>{let c=e.z.sub(s),u=o.div(o.add(c.mul(c)));u=Ku(ai(u,.3).div(.65)),l.assign(zr(a,u))}),l}),Yse=i=>{let e=z4.get(i);return e===void 0&&(e=new Ir,e.colorNode=Ft(0,0,0,1),e.isShadowPassMaterial=!0,e.name="ShadowMaterial",e.blending=ps,e.fog=!1,z4.set(i,e)),e},Zse=i=>{let e=z4.get(i);e!==void 0&&(e.dispose(),z4.delete(i))},Tte=new Mf,j_=[],Kse=(i,e,t,n)=>{j_[0]=i,j_[1]=e;let r=Tte.get(j_);return(r===void 0||r.shadowType!==t||r.useVelocity!==n)&&(r=(s,o,a,l,c,u,f,d,A)=>{(s.castShadow===!0||s.receiveShadow&&t===Hc)&&(n&&(sne(s).useVelocity=!0),s.onBeforeShadow(i,s,a,e.camera,l,o.overrideMaterial,u),i.renderObject(s,o,a,l,c,u,f,d,A),s.onAfterShadow(i,s,a,e.camera,l,o.overrideMaterial,u))},r.shadowType=t,r.useVelocity=n,Tte.set(j_,r)),j_[0]=null,j_[1]=null,r},p4e=me(({samples:i,radius:e,size:t,shadowPass:n,depthLayer:r})=>{let s=oe(0).toVar("meanVertical"),o=oe(0).toVar("squareMeanVertical"),a=i.lessThanEqual(oe(1)).select(oe(0),oe(2).div(i.sub(1))),l=i.lessThanEqual(oe(1)).select(oe(0),oe(-1));Oi({start:de(0),end:de(i),type:"int",condition:"<"},({i:u})=>{let f=l.add(oe(u).mul(a)),d=n.sample(Ls(f1.xy,dt(0,f).mul(e)).div(t));n.value.isArrayTexture&&(d=d.depth(r)),d=d.x,s.addAssign(d),o.addAssign(d.mul(d))}),s.divAssign(i),o.divAssign(i);let c=el(o.sub(s.mul(s)).max(0));return dt(s,c)}),m4e=me(({samples:i,radius:e,size:t,shadowPass:n,depthLayer:r})=>{let s=oe(0).toVar("meanHorizontal"),o=oe(0).toVar("squareMeanHorizontal"),a=i.lessThanEqual(oe(1)).select(oe(0),oe(2).div(i.sub(1))),l=i.lessThanEqual(oe(1)).select(oe(0),oe(-1));Oi({start:de(0),end:de(i),type:"int",condition:"<"},({i:u})=>{let f=l.add(oe(u).mul(a)),d=n.sample(Ls(f1.xy,dt(f,0).mul(e)).div(t));n.value.isArrayTexture&&(d=d.depth(r)),s.addAssign(d.x),o.addAssign(Ls(d.y.mul(d.y),d.x.mul(d.x)))}),s.divAssign(i),o.divAssign(i);let c=el(o.sub(s.mul(s)).max(0));return dt(s,c)}),A4e=[Wse,jse,Xse,$se],nU,NR=new ES,V4=class extends Ck{static get type(){return"ShadowNode"}constructor(e,t=null){super(e),this.shadow=t||e.shadow,this.shadowMap=null,this.vsmShadowMapVertical=null,this.vsmShadowMapHorizontal=null,this.vsmMaterialVertical=null,this.vsmMaterialHorizontal=null,this._node=null,this._currentShadowType=null,this._cameraFrameId=new WeakMap,this.isShadowNode=!0,this.depthLayer=0}setupShadowFilter(e,{filterFn:t,depthTexture:n,shadowCoord:r,shadow:s,depthLayer:o}){let a=r.x.greaterThanEqual(0).and(r.x.lessThanEqual(1)).and(r.y.greaterThanEqual(0)).and(r.y.lessThanEqual(1)).and(r.z.lessThanEqual(1)),l=t({depthTexture:n,shadowCoord:r,shadow:s,depthLayer:o});return a.select(l,oe(1))}setupShadowCoord(e,t){let{shadow:n}=this,{renderer:r}=e,s=n.biasNode||mr("bias","float",n).setGroup(Jt),o=t,a;if(n.camera.isOrthographicCamera||r.logarithmicDepthBuffer!==!0)o=o.xyz.div(o.w),a=o.z;else{let l=o.w;o=o.xy.div(l);let c=mr("near","float",n.camera).setGroup(Jt),u=mr("far","float",n.camera).setGroup(Jt);a=FI(l.negate(),c,u)}return o=pe(o.x,o.y.oneMinus(),r.reversedDepthBuffer?a.sub(s):a.add(s)),o}getShadowFilterFn(e){return A4e[e]}setupRenderTarget(e,t){let n=new Cs(e.mapSize.width,e.mapSize.height);n.name="ShadowDepthTexture",n.compareFunction=t.renderer.reversedDepthBuffer?Ou:Zh;let r=t.createRenderTarget(e.mapSize.width,e.mapSize.height);return r.texture.name="ShadowMap",r.texture.type=e.mapType,r.depthTexture=n,{shadowMap:r,depthTexture:n}}setupShadow(e){let{renderer:t,camera:n}=e,{light:r,shadow:s}=this,{depthTexture:o,shadowMap:a}=this.setupRenderTarget(s,e),l=t.shadowMap.type,c=t.hasCompatibility(Od.TEXTURE_COMPARE);if((l===p0||l===NM)&&c?(o.minFilter=Mi,o.magFilter=Mi):(o.minFilter=Ti,o.magFilter=Ti),s.camera.coordinateSystem=n.coordinateSystem,s.camera.updateProjectionMatrix(),l===Hc&&s.isPointLightShadow!==!0){o.compareFunction=null,a.depth>1?(a._vsmShadowMapVertical||(a._vsmShadowMapVertical=e.createRenderTarget(s.mapSize.width,s.mapSize.height,{format:js,type:Wi,depth:a.depth,depthBuffer:!1}),a._vsmShadowMapVertical.texture.name="VSMVertical"),this.vsmShadowMapVertical=a._vsmShadowMapVertical,a._vsmShadowMapHorizontal||(a._vsmShadowMapHorizontal=e.createRenderTarget(s.mapSize.width,s.mapSize.height,{format:js,type:Wi,depth:a.depth,depthBuffer:!1}),a._vsmShadowMapHorizontal.texture.name="VSMHorizontal"),this.vsmShadowMapHorizontal=a._vsmShadowMapHorizontal):(this.vsmShadowMapVertical=e.createRenderTarget(s.mapSize.width,s.mapSize.height,{format:js,type:Wi,depthBuffer:!1}),this.vsmShadowMapHorizontal=e.createRenderTarget(s.mapSize.width,s.mapSize.height,{format:js,type:Wi,depthBuffer:!1}));let D=fi(o);o.isArrayTexture&&(D=D.depth(this.depthLayer));let L=fi(this.vsmShadowMapVertical.texture);o.isArrayTexture&&(L=L.depth(this.depthLayer));let C=mr("blurSamples","float",s).setGroup(Jt),B=mr("radius","float",s).setGroup(Jt),k=mr("mapSize","vec2",s).setGroup(Jt),z=this.vsmMaterialVertical||(this.vsmMaterialVertical=new Ir);z.fragmentNode=p4e({samples:C,radius:B,size:k,shadowPass:D,depthLayer:this.depthLayer}).context(e.getSharedContext()),z.name="VSMVertical",z=this.vsmMaterialHorizontal||(this.vsmMaterialHorizontal=new Ir),z.fragmentNode=m4e({samples:C,radius:B,size:k,shadowPass:L,depthLayer:this.depthLayer}).context(e.getSharedContext()),z.name="VSMHorizontal"}let u=mr("intensity","float",s).setGroup(Jt),f=mr("normalBias","float",s).setGroup(Jt),d=VI(r),A=Tm.mul(f),y;!t.highPrecision||e.material.receivedShadowPositionNode||e.context.shadowPositionWorld?y=d.mul(MV.add(A)):y=Xt("mat4").onObjectUpdate(({object:L},C)=>C.value.multiplyMatrices(d.value,L.matrixWorld)).mul(Mr).add(d.mul(Ft(A,0)));let w=this.setupShadowCoord(e,y),S=s.filterNode||this.getShadowFilterFn(t.shadowMap.type)||null;if(S===null)throw new Error("THREE.WebGPURenderer: Shadow map type not supported yet.");let T=l===Hc&&s.isPointLightShadow!==!0?this.vsmShadowMapHorizontal.texture:o,R=this.setupShadowFilter(e,{filterFn:S,shadowTexture:a.texture,depthTexture:T,shadowCoord:w,shadow:s,depthLayer:this.depthLayer}),P;t.shadowMap.transmitted===!0&&(a.texture.isCubeTexture?P=Qa(a.texture,w.xyz):(P=fi(a.texture,w),o.isArrayTexture&&(P=P.depth(this.depthLayer))));let I;P?I=Qn(1,R.rgb.mix(P,1),u.mul(P.a)).toVar():I=Qn(1,R,u).toVar(),this.shadowMap=a,this.shadow.map=a;let F=`${this.light.type} Shadow [ ${this.light.name||"ID: "+this.light.id} ]`;return P&&I.toInspector(`${F} / Color`,()=>this.shadowMap.texture.isCubeTexture?Qa(this.shadowMap.texture,x7()):fi(this.shadowMap.texture)),I.toInspector(`${F} / Depth`,()=>{let D=mr("near","float",this.shadow.camera),L=mr("far","float",this.shadow.camera),C;this.shadowMap.texture.isCubeTexture?C=Qa(this.shadowMap.depthTexture,x7()).r:C=fi(this.shadowMap.depthTexture).r;let B;return this.shadow.camera.isPerspectiveCamera?B=NI(C,D,L):B=ese(C,D,L),B=Kg(B,D,L),B.oneMinus()})}setup(e){if(e.renderer.shadowMap.enabled!==!1)return me(()=>{let t=e.renderer.shadowMap.type;this._currentShadowType!==t&&(this._reset(),this._node=null);let n=this._node;return this.setupShadowPosition(e),n===null&&(this._node=n=this.setupShadow(e),this._currentShadowType=t),e.material.receivedShadowNode&&(n=e.material.receivedShadowNode(n)),n})()}renderShadow(e){let{shadow:t,shadowMap:n,light:r}=this,{renderer:s,scene:o}=e;t.updateMatrices(r),n.setSize(t.mapSize.width,t.mapSize.height,n.depth);let a=o.name;o.name=`Shadow Map [ ${r.name||"ID: "+r.id} ]`,s.render(o,t.camera),o.name=a}updateShadow(e){let{shadowMap:t,light:n,shadow:r}=this,{renderer:s,scene:o,camera:a}=e,l=s.shadowMap.type,c=t.depthTexture.version;this._depthVersionCached=c;let u=r.camera.layers.mask;(r.camera.layers.mask&4294967294)===0&&(r.camera.layers.mask=a.layers.mask);let f=s.getRenderObjectFunction(),d=s.getMRT(),A=d?d.has("velocity"):!1;nU=f4e(s,o,nU),o.overrideMaterial=Yse(n),s.setRenderObjectFunction(Kse(s,r,l,A)),s.setClearColor(0,0),s.setRenderTarget(t),this.renderShadow(e),s.setRenderObjectFunction(f),l===Hc&&r.isPointLightShadow!==!0&&this.vsmPass(s),r.camera.layers.mask=u,d4e(s,o,nU)}vsmPass(e){let{shadow:t}=this,n=this.shadowMap.depth;this.vsmShadowMapVertical.setSize(t.mapSize.width,t.mapSize.height,n),this.vsmShadowMapHorizontal.setSize(t.mapSize.width,t.mapSize.height,n),e.setRenderTarget(this.vsmShadowMapVertical),NR.material=this.vsmMaterialVertical,NR.render(e),e.setRenderTarget(this.vsmShadowMapHorizontal),NR.material=this.vsmMaterialHorizontal,NR.render(e)}dispose(){this._reset(),super.dispose()}_reset(){this._currentShadowType=null,Zse(this.light),this.shadowMap&&(this.shadowMap.dispose(),this.shadowMap=null),this.vsmShadowMapVertical!==null&&(this.vsmShadowMapVertical.dispose(),this.vsmShadowMapVertical=null,this.vsmMaterialVertical.dispose(),this.vsmMaterialVertical=null),this.vsmShadowMapHorizontal!==null&&(this.vsmShadowMapHorizontal.dispose(),this.vsmShadowMapHorizontal=null,this.vsmMaterialHorizontal.dispose(),this.vsmMaterialHorizontal=null)}updateBefore(e){let{shadow:t}=this,n=t.needsUpdate||t.autoUpdate;n&&(this._cameraFrameId[e.camera]===e.frameId&&(n=!1),this._cameraFrameId[e.camera]=e.frameId),n&&(this.updateShadow(e),this.shadowMap.depthTexture.version===this._depthVersionCached&&(t.needsUpdate=!1))}},Qse=(i,e)=>new V4(i,e),g4e=new zt,Ete=new cn,$w=new re,iU=new re,v4e=[new re(1,0,0),new re(-1,0,0),new re(0,-1,0),new re(0,1,0),new re(0,0,1),new re(0,0,-1)],_4e=[new re(0,-1,0),new re(0,-1,0),new re(0,0,-1),new re(0,0,1),new re(0,-1,0),new re(0,-1,0)],x4e=[new re(1,0,0),new re(-1,0,0),new re(0,1,0),new re(0,-1,0),new re(0,0,1),new re(0,0,-1)],y4e=[new re(0,-1,0),new re(0,-1,0),new re(0,0,1),new re(0,0,-1),new re(0,-1,0),new re(0,-1,0)],Jse=me(({depthTexture:i,bd3D:e,dp:t})=>Qa(i,e).compare(t)),eoe=me(({depthTexture:i,bd3D:e,dp:t,shadow:n})=>{let r=mr("radius","float",n).setGroup(Jt),s=mr("mapSize","vec2",n).setGroup(Jt),o=r.div(s.x),a=fr(e),l=xa(Qd(e,a.x.greaterThan(a.z).select(pe(0,1,0),pe(1,0,0)))),c=Qd(e,l),u=_V(f1.xy).mul(6.28318530718),f=Xu(0,5,u),d=Xu(1,5,u),A=Xu(2,5,u),y=Xu(3,5,u),w=Xu(4,5,u);return Qa(i,e.add(l.mul(f.x).add(c.mul(f.y)).mul(o))).compare(t).add(Qa(i,e.add(l.mul(d.x).add(c.mul(d.y)).mul(o))).compare(t)).add(Qa(i,e.add(l.mul(A.x).add(c.mul(A.y)).mul(o))).compare(t)).add(Qa(i,e.add(l.mul(y.x).add(c.mul(y.y)).mul(o))).compare(t)).add(Qa(i,e.add(l.mul(w.x).add(c.mul(w.y)).mul(o))).compare(t)).mul(1/5)}),b4e=me(({filterFn:i,depthTexture:e,shadowCoord:t,shadow:n},r)=>{let s=t.xyz.toConst(),o=s.abs().toConst(),a=o.x.max(o.y).max(o.z),l=Xt("float").setGroup(Jt).onRenderUpdate(()=>n.camera.near),c=Xt("float").setGroup(Jt).onRenderUpdate(()=>n.camera.far),u=mr("bias","float",n).setGroup(Jt),f=oe(1).toVar();return $t(a.sub(c).lessThanEqual(0).and(a.sub(l).greaterThanEqual(0)),()=>{let d;r.renderer.reversedDepthBuffer?(d=tse(a.negate(),l,c),d.subAssign(u)):r.renderer.logarithmicDepthBuffer?(d=FI(a.negate(),l,c),d.addAssign(u)):(d=fV(a.negate(),l,c),d.addAssign(u));let A=s.normalize();f.assign(i({depthTexture:e,bd3D:A,dp:d,shadow:n}))}),f}),Rk=class extends V4{static get type(){return"PointShadowNode"}constructor(e,t=null){super(e,t)}getShadowFilterFn(e){return e===H8?Jse:eoe}setupShadowCoord(e,t){return t}setupShadowFilter(e,{filterFn:t,depthTexture:n,shadowCoord:r,shadow:s}){return b4e({filterFn:t,depthTexture:n,shadowCoord:r,shadow:s})}setupRenderTarget(e,t){let n=new n_(e.mapSize.width);n.name="PointShadowDepthTexture",n.compareFunction=t.renderer.reversedDepthBuffer?Ou:Zh;let r=t.createCubeRenderTarget(e.mapSize.width);return r.texture.name="PointShadowMap",r.depthTexture=n,{shadowMap:r,depthTexture:n}}renderShadow(e){let{shadow:t,shadowMap:n,light:r}=this,{renderer:s,scene:o}=e,a=t.camera,l=t.matrix,c=s.coordinateSystem===xl,u=c?v4e:x4e,f=c?_4e:y4e;n.setSize(t.mapSize.width,t.mapSize.width);let d=s.autoClear,A=s.getClearColor(g4e),y=s.getClearAlpha();s.autoClear=!1,s.setClearColor(t.clearColor,t.clearAlpha);for(let w=0;w<6;w++){s.setRenderTarget(n,w),s.clear();let S=r.distance||a.far;S!==a.far&&(a.far=S,a.updateProjectionMatrix()),$w.setFromMatrixPosition(r.matrixWorld),a.position.copy($w),iU.copy(a.position),iU.add(u[w]),a.up.copy(f[w]),a.lookAt(iU),a.updateMatrixWorld(),l.makeTranslation(-$w.x,-$w.y,-$w.z),Ete.multiplyMatrices(a.projectionMatrix,a.matrixWorldInverse),t._frustum.setFromProjectionMatrix(Ete,a.coordinateSystem,a.reversedDepth);let T=o.name;o.name=`Point Light Shadow [ ${r.name||"ID: "+r.id} ] - Face ${w+1}`,s.render(o,a),o.name=T}s.autoClear=d,s.setClearColor(A,y)}},toe=(i,e)=>new Rk(i,e),Jd=class extends xm{static get type(){return"AnalyticLightNode"}constructor(e=null){super(),this.light=e,this.color=new zt,this.colorNode=e&&e.colorNode||Xt(this.color).setGroup(Jt),this.baseColorNode=null,this.shadowNode=null,this.shadowColorNode=null,this.isAnalyticLightNode=!0,this.updateType=yn.FRAME,e&&e.shadow&&(this._shadowDisposeListener=()=>{this.disposeShadow()},e.addEventListener("dispose",this._shadowDisposeListener))}dispose(){this._shadowDisposeListener&&this.light.removeEventListener("dispose",this._shadowDisposeListener),super.dispose()}disposeShadow(){this.shadowNode!==null&&(this.shadowNode.dispose(),this.shadowNode=null),this.shadowColorNode=null,this.baseColorNode!==null&&(this.colorNode=this.baseColorNode,this.baseColorNode=null)}getHash(){return this.light.uuid}getLightVector(e){return TV(this.light).sub(e.context.positionView||xs)}setupDirect(){}setupDirectRectArea(){}setupShadowNode(){return Qse(this.light)}setupShadow(e){let{renderer:t}=e;if(t.shadowMap.enabled===!1)return;let n=this.shadowColorNode;if(n===null){let r=this.light.shadow.shadowNode,s;r!==void 0?s=Ht(r):s=this.setupShadowNode(),this.shadowNode=s,this.shadowColorNode=n=this.colorNode.mul(s),this.baseColorNode=this.colorNode}e.context.getShadow&&(n=e.context.getShadow(this,e)),this.colorNode=n}setup(e){this.colorNode=this.baseColorNode||this.colorNode,this.light.castShadow?e.object.receiveShadow&&this.setupShadow(e):this.shadowNode!==null&&(this.shadowNode.dispose(),this.shadowNode=null,this.shadowColorNode=null);let t=this.setupDirect(e),n=this.setupDirectRectArea(e);t&&e.lightsNode.setupDirectLight(e,this,t),n&&e.lightsNode.setupDirectRectAreaLight(e,this,n)}update(){let{light:e}=this;this.color.copy(e.color).multiplyScalar(e.intensity)}},CV=me(({lightDistance:i,cutoffDistance:e,decayExponent:t})=>{let n=i.pow(t).max(.01).reciprocal();return e.greaterThan(0).select(n.mul(i.div(e).pow4().oneMinus().clamp().pow2()),n)}),noe=({color:i,lightVector:e,cutoffDistance:t,decayExponent:n})=>{let r=e.normalize(),s=e.length(),o=CV({lightDistance:s,cutoffDistance:t,decayExponent:n}),a=i.mul(o);return{lightDirection:r,lightColor:a}},Ik=class extends Jd{static get type(){return"PointLightNode"}constructor(e=null){super(e),this.cutoffDistanceNode=Xt(0).setGroup(Jt),this.decayExponentNode=Xt(2).setGroup(Jt)}update(e){let{light:t}=this;super.update(e),this.cutoffDistanceNode.value=t.distance,this.decayExponentNode.value=t.decay}setupShadowNode(){return toe(this.light)}setupDirect(e){return noe({color:this.colorNode,lightVector:this.getLightVector(e),cutoffDistance:this.cutoffDistanceNode,decayExponent:this.decayExponentNode})}},w4e=me(([i=Ui()])=>{let e=i.mul(2),t=e.x.floor(),n=e.y.floor();return t.add(n).mod(2).sign()}),S4e=me(([i=Ui()],{renderer:e,material:t})=>{let n=Lz(i.mul(2).sub(1)),r;if(t.alphaToCoverage&&e.currentSamples>0){let s=oe(n.fwidth()).toVar();r=mc(s.oneMinus(),s.add(1),n).oneMinus()}else r=_a(n.greaterThan(1),0,1);return r}),fS=me(([i,e,t])=>{let n=oe(t).toVar(),r=oe(e).toVar(),s=dc(i).toVar();return _a(s,r,n).uniformFlow()}).setLayout({name:"mx_select",type:"float",inputs:[{name:"b",type:"bool"},{name:"t",type:"float"},{name:"f",type:"float"}]}),G4=me(([i,e])=>{let t=dc(e).toVar(),n=oe(i).toVar();return _a(t,n.negate(),n).uniformFlow()}).setLayout({name:"mx_negate_if",type:"float",inputs:[{name:"val",type:"float"},{name:"b",type:"bool"}]}),Ps=me(([i])=>{let e=oe(i).toVar();return de(xf(e))}).setLayout({name:"mx_floor",type:"int",inputs:[{name:"x",type:"float"}]}),Cr=me(([i,e])=>{let t=oe(i).toVar();return e.assign(Ps(t)),t.sub(oe(e))}),T4e=me(([i,e,t,n,r,s])=>{let o=oe(s).toVar(),a=oe(r).toVar(),l=oe(n).toVar(),c=oe(t).toVar(),u=oe(e).toVar(),f=oe(i).toVar(),d=oe(ai(1,a)).toVar();return ai(1,o).mul(f.mul(d).add(u.mul(a))).add(o.mul(c.mul(d).add(l.mul(a))))}).setLayout({name:"mx_bilerp_0",type:"float",inputs:[{name:"v0",type:"float"},{name:"v1",type:"float"},{name:"v2",type:"float"},{name:"v3",type:"float"},{name:"s",type:"float"},{name:"t",type:"float"}]}),E4e=me(([i,e,t,n,r,s])=>{let o=oe(s).toVar(),a=oe(r).toVar(),l=pe(n).toVar(),c=pe(t).toVar(),u=pe(e).toVar(),f=pe(i).toVar(),d=oe(ai(1,a)).toVar();return ai(1,o).mul(f.mul(d).add(u.mul(a))).add(o.mul(c.mul(d).add(l.mul(a))))}).setLayout({name:"mx_bilerp_1",type:"vec3",inputs:[{name:"v0",type:"vec3"},{name:"v1",type:"vec3"},{name:"v2",type:"vec3"},{name:"v3",type:"vec3"},{name:"s",type:"float"},{name:"t",type:"float"}]}),ioe=Zo([T4e,E4e]),M4e=me(([i,e,t,n,r,s,o,a,l,c,u])=>{let f=oe(u).toVar(),d=oe(c).toVar(),A=oe(l).toVar(),y=oe(a).toVar(),w=oe(o).toVar(),S=oe(s).toVar(),T=oe(r).toVar(),R=oe(n).toVar(),P=oe(t).toVar(),I=oe(e).toVar(),F=oe(i).toVar(),D=oe(ai(1,A)).toVar(),L=oe(ai(1,d)).toVar();return oe(ai(1,f)).toVar().mul(L.mul(F.mul(D).add(I.mul(A))).add(d.mul(P.mul(D).add(R.mul(A))))).add(f.mul(L.mul(T.mul(D).add(S.mul(A))).add(d.mul(w.mul(D).add(y.mul(A))))))}).setLayout({name:"mx_trilerp_0",type:"float",inputs:[{name:"v0",type:"float"},{name:"v1",type:"float"},{name:"v2",type:"float"},{name:"v3",type:"float"},{name:"v4",type:"float"},{name:"v5",type:"float"},{name:"v6",type:"float"},{name:"v7",type:"float"},{name:"s",type:"float"},{name:"t",type:"float"},{name:"r",type:"float"}]}),C4e=me(([i,e,t,n,r,s,o,a,l,c,u])=>{let f=oe(u).toVar(),d=oe(c).toVar(),A=oe(l).toVar(),y=pe(a).toVar(),w=pe(o).toVar(),S=pe(s).toVar(),T=pe(r).toVar(),R=pe(n).toVar(),P=pe(t).toVar(),I=pe(e).toVar(),F=pe(i).toVar(),D=oe(ai(1,A)).toVar(),L=oe(ai(1,d)).toVar();return oe(ai(1,f)).toVar().mul(L.mul(F.mul(D).add(I.mul(A))).add(d.mul(P.mul(D).add(R.mul(A))))).add(f.mul(L.mul(T.mul(D).add(S.mul(A))).add(d.mul(w.mul(D).add(y.mul(A))))))}).setLayout({name:"mx_trilerp_1",type:"vec3",inputs:[{name:"v0",type:"vec3"},{name:"v1",type:"vec3"},{name:"v2",type:"vec3"},{name:"v3",type:"vec3"},{name:"v4",type:"vec3"},{name:"v5",type:"vec3"},{name:"v6",type:"vec3"},{name:"v7",type:"vec3"},{name:"s",type:"float"},{name:"t",type:"float"},{name:"r",type:"float"}]}),roe=Zo([M4e,C4e]),R4e=me(([i,e,t])=>{let n=oe(t).toVar(),r=oe(e).toVar(),s=rt(i).toVar(),o=rt(s.bitAnd(rt(7))).toVar(),a=oe(fS(o.lessThan(rt(4)),r,n)).toVar(),l=oe(Tn(2,fS(o.lessThan(rt(4)),n,r))).toVar();return G4(a,dc(o.bitAnd(rt(1)))).add(G4(l,dc(o.bitAnd(rt(2)))))}).setLayout({name:"mx_gradient_float_0",type:"float",inputs:[{name:"hash",type:"uint"},{name:"x",type:"float"},{name:"y",type:"float"}]}),I4e=me(([i,e,t,n])=>{let r=oe(n).toVar(),s=oe(t).toVar(),o=oe(e).toVar(),a=rt(i).toVar(),l=rt(a.bitAnd(rt(15))).toVar(),c=oe(fS(l.lessThan(rt(8)),o,s)).toVar(),u=oe(fS(l.lessThan(rt(4)),s,fS(l.equal(rt(12)).or(l.equal(rt(14))),o,r))).toVar();return G4(c,dc(l.bitAnd(rt(1)))).add(G4(u,dc(l.bitAnd(rt(2)))))}).setLayout({name:"mx_gradient_float_1",type:"float",inputs:[{name:"hash",type:"uint"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]}),So=Zo([R4e,I4e]),P4e=me(([i,e,t])=>{let n=oe(t).toVar(),r=oe(e).toVar(),s=u1(i).toVar();return pe(So(s.x,r,n),So(s.y,r,n),So(s.z,r,n))}).setLayout({name:"mx_gradient_vec3_0",type:"vec3",inputs:[{name:"hash",type:"uvec3"},{name:"x",type:"float"},{name:"y",type:"float"}]}),L4e=me(([i,e,t,n])=>{let r=oe(n).toVar(),s=oe(t).toVar(),o=oe(e).toVar(),a=u1(i).toVar();return pe(So(a.x,o,s,r),So(a.y,o,s,r),So(a.z,o,s,r))}).setLayout({name:"mx_gradient_vec3_1",type:"vec3",inputs:[{name:"hash",type:"uvec3"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]}),tu=Zo([P4e,L4e]),D4e=me(([i])=>{let e=oe(i).toVar();return Tn(.6616,e)}).setLayout({name:"mx_gradient_scale2d_0",type:"float",inputs:[{name:"v",type:"float"}]}),N4e=me(([i])=>{let e=oe(i).toVar();return Tn(.982,e)}).setLayout({name:"mx_gradient_scale3d_0",type:"float",inputs:[{name:"v",type:"float"}]}),F4e=me(([i])=>{let e=pe(i).toVar();return Tn(.6616,e)}).setLayout({name:"mx_gradient_scale2d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),soe=Zo([D4e,F4e]),B4e=me(([i])=>{let e=pe(i).toVar();return Tn(.982,e)}).setLayout({name:"mx_gradient_scale3d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),ooe=Zo([N4e,B4e]),uc=me(([i,e])=>{let t=de(e).toVar(),n=rt(i).toVar();return n.shiftLeft(t).bitOr(n.shiftRight(de(32).sub(t)))}).setLayout({name:"mx_rotl32",type:"uint",inputs:[{name:"x",type:"uint"},{name:"k",type:"int"}]}),aoe=me(([i,e,t])=>{i.subAssign(t),i.bitXorAssign(uc(t,de(4))),t.addAssign(e),e.subAssign(i),e.bitXorAssign(uc(i,de(6))),i.addAssign(t),t.subAssign(e),t.bitXorAssign(uc(e,de(8))),e.addAssign(i),i.subAssign(t),i.bitXorAssign(uc(t,de(16))),t.addAssign(e),e.subAssign(i),e.bitXorAssign(uc(i,de(19))),i.addAssign(t),t.subAssign(e),t.bitXorAssign(uc(e,de(4))),e.addAssign(i)}),zS=me(([i,e,t])=>{let n=rt(t).toVar(),r=rt(e).toVar(),s=rt(i).toVar();return n.bitXorAssign(r),n.subAssign(uc(r,de(14))),s.bitXorAssign(n),s.subAssign(uc(n,de(11))),r.bitXorAssign(s),r.subAssign(uc(s,de(25))),n.bitXorAssign(r),n.subAssign(uc(r,de(16))),s.bitXorAssign(n),s.subAssign(uc(n,de(4))),r.bitXorAssign(s),r.subAssign(uc(s,de(14))),n.bitXorAssign(r),n.subAssign(uc(r,de(24))),n}).setLayout({name:"mx_bjfinal",type:"uint",inputs:[{name:"a",type:"uint"},{name:"b",type:"uint"},{name:"c",type:"uint"}]}),ya=me(([i])=>{let e=rt(i).toVar();return oe(e).div(oe(rt(de(4294967295))))}).setLayout({name:"mx_bits_to_01",type:"float",inputs:[{name:"bits",type:"uint"}]}),wf=me(([i])=>{let e=oe(i).toVar();return e.mul(e).mul(e).mul(e.mul(e.mul(6).sub(15)).add(10))}).setLayout({name:"mx_fade",type:"float",inputs:[{name:"t",type:"float"}]}),O4e=me(([i])=>{let e=de(i).toVar(),t=rt(rt(1)).toVar(),n=rt(rt(de(3735928559)).add(t.shiftLeft(rt(2))).add(rt(13))).toVar();return zS(n.add(rt(e)),n,n)}).setLayout({name:"mx_hash_int_0",type:"uint",inputs:[{name:"x",type:"int"}]}),U4e=me(([i,e])=>{let t=de(e).toVar(),n=de(i).toVar(),r=rt(rt(2)).toVar(),s=rt().toVar(),o=rt().toVar(),a=rt().toVar();return s.assign(o.assign(a.assign(rt(de(3735928559)).add(r.shiftLeft(rt(2))).add(rt(13))))),s.addAssign(rt(n)),o.addAssign(rt(t)),zS(s,o,a)}).setLayout({name:"mx_hash_int_1",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),k4e=me(([i,e,t])=>{let n=de(t).toVar(),r=de(e).toVar(),s=de(i).toVar(),o=rt(rt(3)).toVar(),a=rt().toVar(),l=rt().toVar(),c=rt().toVar();return a.assign(l.assign(c.assign(rt(de(3735928559)).add(o.shiftLeft(rt(2))).add(rt(13))))),a.addAssign(rt(s)),l.addAssign(rt(r)),c.addAssign(rt(n)),zS(a,l,c)}).setLayout({name:"mx_hash_int_2",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),z4e=me(([i,e,t,n])=>{let r=de(n).toVar(),s=de(t).toVar(),o=de(e).toVar(),a=de(i).toVar(),l=rt(rt(4)).toVar(),c=rt().toVar(),u=rt().toVar(),f=rt().toVar();return c.assign(u.assign(f.assign(rt(de(3735928559)).add(l.shiftLeft(rt(2))).add(rt(13))))),c.addAssign(rt(a)),u.addAssign(rt(o)),f.addAssign(rt(s)),aoe(c,u,f),c.addAssign(rt(r)),zS(c,u,f)}).setLayout({name:"mx_hash_int_3",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xx",type:"int"}]}),V4e=me(([i,e,t,n,r])=>{let s=de(r).toVar(),o=de(n).toVar(),a=de(t).toVar(),l=de(e).toVar(),c=de(i).toVar(),u=rt(rt(5)).toVar(),f=rt().toVar(),d=rt().toVar(),A=rt().toVar();return f.assign(d.assign(A.assign(rt(de(3735928559)).add(u.shiftLeft(rt(2))).add(rt(13))))),f.addAssign(rt(c)),d.addAssign(rt(l)),A.addAssign(rt(a)),aoe(f,d,A),f.addAssign(rt(o)),d.addAssign(rt(s)),zS(f,d,A)}).setLayout({name:"mx_hash_int_4",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xx",type:"int"},{name:"yy",type:"int"}]}),Xi=Zo([O4e,U4e,k4e,z4e,V4e]),G4e=me(([i,e])=>{let t=de(e).toVar(),n=de(i).toVar(),r=rt(Xi(n,t)).toVar(),s=u1().toVar();return s.x.assign(r.bitAnd(de(255))),s.y.assign(r.shiftRight(de(8)).bitAnd(de(255))),s.z.assign(r.shiftRight(de(16)).bitAnd(de(255))),s}).setLayout({name:"mx_hash_vec3_0",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),q4e=me(([i,e,t])=>{let n=de(t).toVar(),r=de(e).toVar(),s=de(i).toVar(),o=rt(Xi(s,r,n)).toVar(),a=u1().toVar();return a.x.assign(o.bitAnd(de(255))),a.y.assign(o.shiftRight(de(8)).bitAnd(de(255))),a.z.assign(o.shiftRight(de(16)).bitAnd(de(255))),a}).setLayout({name:"mx_hash_vec3_1",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),nu=Zo([G4e,q4e]),H4e=me(([i])=>{let e=dt(i).toVar(),t=de().toVar(),n=de().toVar(),r=oe(Cr(e.x,t)).toVar(),s=oe(Cr(e.y,n)).toVar(),o=oe(wf(r)).toVar(),a=oe(wf(s)).toVar(),l=oe(ioe(So(Xi(t,n),r,s),So(Xi(t.add(de(1)),n),r.sub(1),s),So(Xi(t,n.add(de(1))),r,s.sub(1)),So(Xi(t.add(de(1)),n.add(de(1))),r.sub(1),s.sub(1)),o,a)).toVar();return soe(l)}).setLayout({name:"mx_perlin_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"}]}),W4e=me(([i])=>{let e=pe(i).toVar(),t=de().toVar(),n=de().toVar(),r=de().toVar(),s=oe(Cr(e.x,t)).toVar(),o=oe(Cr(e.y,n)).toVar(),a=oe(Cr(e.z,r)).toVar(),l=oe(wf(s)).toVar(),c=oe(wf(o)).toVar(),u=oe(wf(a)).toVar(),f=oe(roe(So(Xi(t,n,r),s,o,a),So(Xi(t.add(de(1)),n,r),s.sub(1),o,a),So(Xi(t,n.add(de(1)),r),s,o.sub(1),a),So(Xi(t.add(de(1)),n.add(de(1)),r),s.sub(1),o.sub(1),a),So(Xi(t,n,r.add(de(1))),s,o,a.sub(1)),So(Xi(t.add(de(1)),n,r.add(de(1))),s.sub(1),o,a.sub(1)),So(Xi(t,n.add(de(1)),r.add(de(1))),s,o.sub(1),a.sub(1)),So(Xi(t.add(de(1)),n.add(de(1)),r.add(de(1))),s.sub(1),o.sub(1),a.sub(1)),l,c,u)).toVar();return ooe(f)}).setLayout({name:"mx_perlin_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"}]}),RV=Zo([H4e,W4e]),j4e=me(([i])=>{let e=dt(i).toVar(),t=de().toVar(),n=de().toVar(),r=oe(Cr(e.x,t)).toVar(),s=oe(Cr(e.y,n)).toVar(),o=oe(wf(r)).toVar(),a=oe(wf(s)).toVar(),l=pe(ioe(tu(nu(t,n),r,s),tu(nu(t.add(de(1)),n),r.sub(1),s),tu(nu(t,n.add(de(1))),r,s.sub(1)),tu(nu(t.add(de(1)),n.add(de(1))),r.sub(1),s.sub(1)),o,a)).toVar();return soe(l)}).setLayout({name:"mx_perlin_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),X4e=me(([i])=>{let e=pe(i).toVar(),t=de().toVar(),n=de().toVar(),r=de().toVar(),s=oe(Cr(e.x,t)).toVar(),o=oe(Cr(e.y,n)).toVar(),a=oe(Cr(e.z,r)).toVar(),l=oe(wf(s)).toVar(),c=oe(wf(o)).toVar(),u=oe(wf(a)).toVar(),f=pe(roe(tu(nu(t,n,r),s,o,a),tu(nu(t.add(de(1)),n,r),s.sub(1),o,a),tu(nu(t,n.add(de(1)),r),s,o.sub(1),a),tu(nu(t.add(de(1)),n.add(de(1)),r),s.sub(1),o.sub(1),a),tu(nu(t,n,r.add(de(1))),s,o,a.sub(1)),tu(nu(t.add(de(1)),n,r.add(de(1))),s.sub(1),o,a.sub(1)),tu(nu(t,n.add(de(1)),r.add(de(1))),s,o.sub(1),a.sub(1)),tu(nu(t.add(de(1)),n.add(de(1)),r.add(de(1))),s.sub(1),o.sub(1),a.sub(1)),l,c,u)).toVar();return ooe(f)}).setLayout({name:"mx_perlin_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),VS=Zo([j4e,X4e]),$4e=me(([i])=>{let e=oe(i).toVar(),t=de(Ps(e)).toVar();return ya(Xi(t))}).setLayout({name:"mx_cell_noise_float_0",type:"float",inputs:[{name:"p",type:"float"}]}),Y4e=me(([i])=>{let e=dt(i).toVar(),t=de(Ps(e.x)).toVar(),n=de(Ps(e.y)).toVar();return ya(Xi(t,n))}).setLayout({name:"mx_cell_noise_float_1",type:"float",inputs:[{name:"p",type:"vec2"}]}),Z4e=me(([i])=>{let e=pe(i).toVar(),t=de(Ps(e.x)).toVar(),n=de(Ps(e.y)).toVar(),r=de(Ps(e.z)).toVar();return ya(Xi(t,n,r))}).setLayout({name:"mx_cell_noise_float_2",type:"float",inputs:[{name:"p",type:"vec3"}]}),K4e=me(([i])=>{let e=Ft(i).toVar(),t=de(Ps(e.x)).toVar(),n=de(Ps(e.y)).toVar(),r=de(Ps(e.z)).toVar(),s=de(Ps(e.w)).toVar();return ya(Xi(t,n,r,s))}).setLayout({name:"mx_cell_noise_float_3",type:"float",inputs:[{name:"p",type:"vec4"}]}),Q4e=Zo([$4e,Y4e,Z4e,K4e]),J4e=me(([i])=>{let e=oe(i).toVar(),t=de(Ps(e)).toVar();return pe(ya(Xi(t,de(0))),ya(Xi(t,de(1))),ya(Xi(t,de(2))))}).setLayout({name:"mx_cell_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"float"}]}),eIe=me(([i])=>{let e=dt(i).toVar(),t=de(Ps(e.x)).toVar(),n=de(Ps(e.y)).toVar();return pe(ya(Xi(t,n,de(0))),ya(Xi(t,n,de(1))),ya(Xi(t,n,de(2))))}).setLayout({name:"mx_cell_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),tIe=me(([i])=>{let e=pe(i).toVar(),t=de(Ps(e.x)).toVar(),n=de(Ps(e.y)).toVar(),r=de(Ps(e.z)).toVar();return pe(ya(Xi(t,n,r,de(0))),ya(Xi(t,n,r,de(1))),ya(Xi(t,n,r,de(2))))}).setLayout({name:"mx_cell_noise_vec3_2",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),nIe=me(([i])=>{let e=Ft(i).toVar(),t=de(Ps(e.x)).toVar(),n=de(Ps(e.y)).toVar(),r=de(Ps(e.z)).toVar(),s=de(Ps(e.w)).toVar();return pe(ya(Xi(t,n,r,s,de(0))),ya(Xi(t,n,r,s,de(1))),ya(Xi(t,n,r,s,de(2))))}).setLayout({name:"mx_cell_noise_vec3_3",type:"vec3",inputs:[{name:"p",type:"vec4"}]}),GI=Zo([J4e,eIe,tIe,nIe]),q4=me(([i,e,t,n])=>{let r=oe(n).toVar(),s=oe(t).toVar(),o=de(e).toVar(),a=pe(i).toVar(),l=oe(0).toVar(),c=oe(1).toVar();return Oi(o,()=>{l.addAssign(c.mul(RV(a))),c.mulAssign(r),a.mulAssign(s)}),l}).setLayout({name:"mx_fractal_noise_float",type:"float",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),qI=me(([i,e,t,n])=>{let r=oe(n).toVar(),s=oe(t).toVar(),o=de(e).toVar(),a=pe(i).toVar(),l=pe(0).toVar(),c=oe(1).toVar();return Oi(o,()=>{l.addAssign(c.mul(VS(a))),c.mulAssign(r),a.mulAssign(s)}),l}).setLayout({name:"mx_fractal_noise_vec3",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),iIe=me(([i,e,t,n])=>{let r=oe(n).toVar(),s=oe(t).toVar(),o=de(e).toVar(),a=pe(i).toVar();return dt(q4(a,o,s,r),q4(a.add(pe(de(19),de(193),de(17))),o,s,r))}).setLayout({name:"mx_fractal_noise_vec2",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),rIe=me(([i,e,t,n])=>{let r=oe(n).toVar(),s=oe(t).toVar(),o=de(e).toVar(),a=pe(i).toVar(),l=pe(qI(a,o,s,r)).toVar(),c=oe(q4(a.add(pe(de(19),de(193),de(17))),o,s,r)).toVar();return Ft(l,c)}).setLayout({name:"mx_fractal_noise_vec4",type:"vec4",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),sIe=me(([i,e,t,n,r,s,o])=>{let a=de(o).toVar(),l=oe(s).toVar(),c=de(r).toVar(),u=de(n).toVar(),f=de(t).toVar(),d=de(e).toVar(),A=dt(i).toVar(),y=pe(GI(dt(d.add(u),f.add(c)))).toVar(),w=dt(y.x,y.y).toVar();w.subAssign(.5),w.mulAssign(l),w.addAssign(.5);let S=dt(dt(oe(d),oe(f)).add(w)).toVar(),T=dt(S.sub(A)).toVar();return $t(a.equal(de(2)),()=>fr(T.x).add(fr(T.y))),$t(a.equal(de(3)),()=>zr(fr(T.x),fr(T.y))),au(T,T)}).setLayout({name:"mx_worley_distance_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"x",type:"int"},{name:"y",type:"int"},{name:"xoff",type:"int"},{name:"yoff",type:"int"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),oIe=me(([i,e,t,n,r,s,o,a,l])=>{let c=de(l).toVar(),u=oe(a).toVar(),f=de(o).toVar(),d=de(s).toVar(),A=de(r).toVar(),y=de(n).toVar(),w=de(t).toVar(),S=de(e).toVar(),T=pe(i).toVar(),R=pe(GI(pe(S.add(A),w.add(d),y.add(f)))).toVar();R.subAssign(.5),R.mulAssign(u),R.addAssign(.5);let P=pe(pe(oe(S),oe(w),oe(y)).add(R)).toVar(),I=pe(P.sub(T)).toVar();return $t(c.equal(de(2)),()=>fr(I.x).add(fr(I.y)).add(fr(I.z))),$t(c.equal(de(3)),()=>zr(fr(I.x),fr(I.y),fr(I.z))),au(I,I)}).setLayout({name:"mx_worley_distance_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xoff",type:"int"},{name:"yoff",type:"int"},{name:"zoff",type:"int"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),Mx=Zo([sIe,oIe]),aIe=me(([i,e,t])=>{let n=de(t).toVar(),r=oe(e).toVar(),s=dt(i).toVar(),o=de().toVar(),a=de().toVar(),l=dt(Cr(s.x,o),Cr(s.y,a)).toVar(),c=oe(1e6).toVar();return Oi({start:-1,end:de(1),name:"x",condition:"<="},({x:u})=>{Oi({start:-1,end:de(1),name:"y",condition:"<="},({y:f})=>{let d=oe(Mx(l,u,f,o,a,r,n)).toVar();c.assign(Il(c,d))})}),$t(n.equal(de(0)),()=>{c.assign(el(c))}),c}).setLayout({name:"mx_worley_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),lIe=me(([i,e,t])=>{let n=de(t).toVar(),r=oe(e).toVar(),s=dt(i).toVar(),o=de().toVar(),a=de().toVar(),l=dt(Cr(s.x,o),Cr(s.y,a)).toVar(),c=dt(1e6,1e6).toVar();return Oi({start:-1,end:de(1),name:"x",condition:"<="},({x:u})=>{Oi({start:-1,end:de(1),name:"y",condition:"<="},({y:f})=>{let d=oe(Mx(l,u,f,o,a,r,n)).toVar();$t(d.lessThan(c.x),()=>{c.y.assign(c.x),c.x.assign(d)}).ElseIf(d.lessThan(c.y),()=>{c.y.assign(d)})})}),$t(n.equal(de(0)),()=>{c.assign(el(c))}),c}).setLayout({name:"mx_worley_noise_vec2_0",type:"vec2",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),cIe=me(([i,e,t])=>{let n=de(t).toVar(),r=oe(e).toVar(),s=dt(i).toVar(),o=de().toVar(),a=de().toVar(),l=dt(Cr(s.x,o),Cr(s.y,a)).toVar(),c=pe(1e6,1e6,1e6).toVar();return Oi({start:-1,end:de(1),name:"x",condition:"<="},({x:u})=>{Oi({start:-1,end:de(1),name:"y",condition:"<="},({y:f})=>{let d=oe(Mx(l,u,f,o,a,r,n)).toVar();$t(d.lessThan(c.x),()=>{c.z.assign(c.y),c.y.assign(c.x),c.x.assign(d)}).ElseIf(d.lessThan(c.y),()=>{c.z.assign(c.y),c.y.assign(d)}).ElseIf(d.lessThan(c.z),()=>{c.z.assign(d)})})}),$t(n.equal(de(0)),()=>{c.assign(el(c))}),c}).setLayout({name:"mx_worley_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),uIe=me(([i,e,t])=>{let n=de(t).toVar(),r=oe(e).toVar(),s=pe(i).toVar(),o=de().toVar(),a=de().toVar(),l=de().toVar(),c=pe(Cr(s.x,o),Cr(s.y,a),Cr(s.z,l)).toVar(),u=oe(1e6).toVar();return Oi({start:-1,end:de(1),name:"x",condition:"<="},({x:f})=>{Oi({start:-1,end:de(1),name:"y",condition:"<="},({y:d})=>{Oi({start:-1,end:de(1),name:"z",condition:"<="},({z:A})=>{let y=oe(Mx(c,f,d,A,o,a,l,r,n)).toVar();u.assign(Il(u,y))})})}),$t(n.equal(de(0)),()=>{u.assign(el(u))}),u}).setLayout({name:"mx_worley_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),hIe=Zo([aIe,uIe]),fIe=me(([i,e,t])=>{let n=de(t).toVar(),r=oe(e).toVar(),s=pe(i).toVar(),o=de().toVar(),a=de().toVar(),l=de().toVar(),c=pe(Cr(s.x,o),Cr(s.y,a),Cr(s.z,l)).toVar(),u=dt(1e6,1e6).toVar();return Oi({start:-1,end:de(1),name:"x",condition:"<="},({x:f})=>{Oi({start:-1,end:de(1),name:"y",condition:"<="},({y:d})=>{Oi({start:-1,end:de(1),name:"z",condition:"<="},({z:A})=>{let y=oe(Mx(c,f,d,A,o,a,l,r,n)).toVar();$t(y.lessThan(u.x),()=>{u.y.assign(u.x),u.x.assign(y)}).ElseIf(y.lessThan(u.y),()=>{u.y.assign(y)})})})}),$t(n.equal(de(0)),()=>{u.assign(el(u))}),u}).setLayout({name:"mx_worley_noise_vec2_1",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),dIe=Zo([lIe,fIe]),pIe=me(([i,e,t])=>{let n=de(t).toVar(),r=oe(e).toVar(),s=pe(i).toVar(),o=de().toVar(),a=de().toVar(),l=de().toVar(),c=pe(Cr(s.x,o),Cr(s.y,a),Cr(s.z,l)).toVar(),u=pe(1e6,1e6,1e6).toVar();return Oi({start:-1,end:de(1),name:"x",condition:"<="},({x:f})=>{Oi({start:-1,end:de(1),name:"y",condition:"<="},({y:d})=>{Oi({start:-1,end:de(1),name:"z",condition:"<="},({z:A})=>{let y=oe(Mx(c,f,d,A,o,a,l,r,n)).toVar();$t(y.lessThan(u.x),()=>{u.z.assign(u.y),u.y.assign(u.x),u.x.assign(y)}).ElseIf(y.lessThan(u.y),()=>{u.z.assign(u.y),u.y.assign(y)}).ElseIf(y.lessThan(u.z),()=>{u.z.assign(y)})})})}),$t(n.equal(de(0)),()=>{u.assign(el(u))}),u}).setLayout({name:"mx_worley_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),IV=Zo([cIe,pIe]),mIe=me(([i,e,t,n,r,s,o,a,l,c,u])=>{let f=de(i).toVar(),d=dt(e).toVar(),A=dt(t).toVar(),y=dt(n).toVar(),w=oe(r).toVar(),S=oe(s).toVar(),T=oe(o).toVar(),R=dc(a).toVar(),P=de(l).toVar(),I=oe(c).toVar(),F=oe(u).toVar(),D=d.mul(A).add(y),L=oe(0).toVar();return $t(f.equal(de(0)),()=>{L.assign(VS(D))}),$t(f.equal(de(1)),()=>{L.assign(GI(D))}),$t(f.equal(de(2)),()=>{L.assign(IV(D,w,de(0)))}),$t(f.equal(de(3)),()=>{L.assign(qI(pe(D,0),P,I,F))}),L.assign(L.mul(T.sub(S)).add(S)),$t(R,()=>{L.assign(Ku(L,S,T))}),L}).setLayout({name:"mx_unifiednoise2d",type:"float",inputs:[{name:"noiseType",type:"int"},{name:"texcoord",type:"vec2"},{name:"freq",type:"vec2"},{name:"offset",type:"vec2"},{name:"jitter",type:"float"},{name:"outmin",type:"float"},{name:"outmax",type:"float"},{name:"clampoutput",type:"bool"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),AIe=me(([i,e,t,n,r,s,o,a,l,c,u])=>{let f=de(i).toVar(),d=pe(e).toVar(),A=pe(t).toVar(),y=pe(n).toVar(),w=oe(r).toVar(),S=oe(s).toVar(),T=oe(o).toVar(),R=dc(a).toVar(),P=de(l).toVar(),I=oe(c).toVar(),F=oe(u).toVar(),D=d.mul(A).add(y),L=oe(0).toVar();return $t(f.equal(de(0)),()=>{L.assign(VS(D))}),$t(f.equal(de(1)),()=>{L.assign(GI(D))}),$t(f.equal(de(2)),()=>{L.assign(IV(D,w,de(0)))}),$t(f.equal(de(3)),()=>{L.assign(qI(D,P,I,F))}),L.assign(L.mul(T.sub(S)).add(S)),$t(R,()=>{L.assign(Ku(L,S,T))}),L}).setLayout({name:"mx_unifiednoise3d",type:"float",inputs:[{name:"noiseType",type:"int"},{name:"position",type:"vec3"},{name:"freq",type:"vec3"},{name:"offset",type:"vec3"},{name:"jitter",type:"float"},{name:"outmin",type:"float"},{name:"outmax",type:"float"},{name:"clampoutput",type:"bool"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),gIe=me(([i])=>{let e=i.y,t=i.z,n=pe().toVar();return $t(e.lessThan(1e-4),()=>{n.assign(pe(t,t,t))}).Else(()=>{let r=i.x;r=r.sub(xf(r)).mul(6).toVar();let s=de(Cz(r)),o=r.sub(oe(s)),a=t.mul(e.oneMinus()),l=t.mul(e.mul(o).oneMinus()),c=t.mul(e.mul(o.oneMinus()).oneMinus());$t(s.equal(de(0)),()=>{n.assign(pe(t,c,a))}).ElseIf(s.equal(de(1)),()=>{n.assign(pe(l,t,a))}).ElseIf(s.equal(de(2)),()=>{n.assign(pe(a,t,c))}).ElseIf(s.equal(de(3)),()=>{n.assign(pe(a,l,t))}).ElseIf(s.equal(de(4)),()=>{n.assign(pe(c,a,t))}).Else(()=>{n.assign(pe(t,a,l))})}),n}).setLayout({name:"mx_hsvtorgb",type:"vec3",inputs:[{name:"hsv",type:"vec3"}]}),vIe=me(([i])=>{let e=pe(i).toVar(),t=oe(e.x).toVar(),n=oe(e.y).toVar(),r=oe(e.z).toVar(),s=oe(Il(t,Il(n,r))).toVar(),o=oe(zr(t,zr(n,r))).toVar(),a=oe(o.sub(s)).toVar(),l=oe().toVar(),c=oe().toVar(),u=oe().toVar();return u.assign(o),$t(o.greaterThan(0),()=>{c.assign(a.div(o))}).Else(()=>{c.assign(0)}),$t(c.lessThanEqual(0),()=>{l.assign(0)}).Else(()=>{$t(t.greaterThanEqual(o),()=>{l.assign(n.sub(r).div(a))}).ElseIf(n.greaterThanEqual(o),()=>{l.assign(Ls(2,r.sub(t).div(a)))}).Else(()=>{l.assign(Ls(4,t.sub(n).div(a)))}),l.mulAssign(1/6),$t(l.lessThan(0),()=>{l.addAssign(1)})}),pe(l,c,u)}).setLayout({name:"mx_rgbtohsv",type:"vec3",inputs:[{name:"c",type:"vec3"}]}),_Ie=me(([i])=>{let e=pe(i).toVar(),t=fz(_z(e,pe(.04045))).toVar(),n=pe(e.div(12.92)).toVar(),r=pe(iu(zr(e.add(pe(.055)),pe(0)).div(1.055),pe(2.4))).toVar();return Qn(n,r,t)}).setLayout({name:"mx_srgb_texture_to_lin_rec709",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),loe=(i,e)=>{i=oe(i),e=oe(e);let t=dt(e.dFdx(),e.dFdy()).length().mul(.7071067811865476);return mc(i.sub(t),i.add(t),e)},coe=(i,e,t,n)=>Qn(i,e,t[n].clamp()),xIe=(i,e,t=Ui())=>coe(i,e,t,"x"),yIe=(i,e,t=Ui())=>coe(i,e,t,"y"),bIe=(i,e,t,n,r=Ui())=>{let s=r.x.clamp(),o=r.y.clamp(),a=Qn(i,e,s),l=Qn(t,n,s);return Qn(a,l,o)},uoe=(i,e,t,n,r)=>Qn(i,e,loe(t,n[r])),wIe=(i,e,t,n=Ui())=>uoe(i,e,t,n,"x"),SIe=(i,e,t,n=Ui())=>uoe(i,e,t,n,"y"),TIe=(i=1,e=0,t=Ui())=>t.mul(i).add(e),EIe=(i,e=1)=>(i=oe(i),i.abs().pow(e).mul(i.sign())),MIe=(i,e=1,t=.5)=>oe(i).sub(t).mul(e).add(t),CIe=(i=Ui(),e=1,t=0)=>RV(i.convert("vec2|vec3")).mul(e).add(t),RIe=(i=Ui(),e=1,t=0)=>VS(i.convert("vec2|vec3")).mul(e).add(t),IIe=(i=Ui(),e=1,t=0)=>(i=i.convert("vec2|vec3"),Ft(VS(i),RV(i.add(dt(19,73)))).mul(e).add(t)),PIe=(i,e=Ui(),t=dt(1,1),n=dt(0,0),r=1,s=0,o=1,a=!1,l=1,c=2,u=.5)=>mIe(i,e.convert("vec2|vec3"),t,n,r,s,o,a,l,c,u),LIe=(i,e=Ui(),t=dt(1,1),n=dt(0,0),r=1,s=0,o=1,a=!1,l=1,c=2,u=.5)=>AIe(i,e.convert("vec2|vec3"),t,n,r,s,o,a,l,c,u),DIe=(i=Ui(),e=1)=>hIe(i.convert("vec2|vec3"),e,de(1)),NIe=(i=Ui(),e=1)=>dIe(i.convert("vec2|vec3"),e,de(1)),FIe=(i=Ui(),e=1)=>IV(i.convert("vec2|vec3"),e,de(1)),BIe=(i=Ui())=>Q4e(i.convert("vec2|vec3")),OIe=(i=Ui(),e=3,t=2,n=.5,r=1)=>q4(i,de(e),t,n).mul(r),UIe=(i=Ui(),e=3,t=2,n=.5,r=1)=>iIe(i,de(e),t,n).mul(r),kIe=(i=Ui(),e=3,t=2,n=.5,r=1)=>qI(i,de(e),t,n).mul(r),zIe=(i=Ui(),e=3,t=2,n=.5,r=1)=>rIe(i,de(e),t,n).mul(r),VIe=(i,e=oe(0))=>Ls(i,e),GIe=(i,e=oe(0))=>ai(i,e),qIe=(i,e=oe(1))=>Tn(i,e),HIe=(i,e=oe(1))=>pc(i,e),WIe=(i,e=oe(1))=>bI(i,e),jIe=(i,e=oe(1))=>iu(i,e),XIe=(i=oe(0),e=oe(1))=>wz(i,e),$Ie=()=>Ex,YIe=()=>Mse,ZIe=(i,e=oe(1))=>ai(e,i),KIe=(i,e,t,n)=>i.greaterThan(e).mix(t,n),QIe=(i,e,t,n)=>i.greaterThanEqual(e).mix(t,n),JIe=(i,e,t,n)=>i.equal(e).mix(t,n),ePe=(i,e=null)=>{if(typeof e=="string"){let t={x:0,r:0,y:1,g:1,z:2,b:2,w:3,a:3},n=e.replace(/^out/,"").toLowerCase();if(t[n]!==void 0)return i.element(t[n])}if(typeof e=="number")return i.element(e);if(typeof e=="string"&&e.length===1){let t={x:0,r:0,y:1,g:1,z:2,b:2,w:3,a:3};if(t[e]!==void 0)return i.element(t[e])}return i},tPe=(i,e=dt(.5,.5),t=dt(1,1),n=oe(0),r=dt(0,0))=>{let s=i;if(e&&(s=s.sub(e)),t&&(s=s.mul(t)),n){let o=n.mul(Math.PI/180),a=o.cos(),l=o.sin();s=dt(s.x.mul(a).sub(s.y.mul(l)),s.x.mul(l).add(s.y.mul(a)))}return e&&(s=s.add(e)),r&&(s=s.add(r)),s},nPe=(i,e)=>{i=dt(i),e=oe(e);let t=e.mul(Math.PI/180);return US(i,t)},iPe=(i,e,t)=>{i=pe(i),e=oe(e),t=pe(t);let n=e.mul(Math.PI/180),r=t.normalize(),s=n.cos(),o=n.sin(),a=oe(1).sub(s);return i.mul(s).add(r.cross(i).mul(o)).add(r.mul(r.dot(i)).mul(a))},rPe=(i,e)=>(i=pe(i),e=oe(e),eV(i,e)),sPe=me(([i,e,t])=>{let n=xa(i).toVar(),r=ai(oe(.5).mul(e.sub(t)),bf).div(n).toVar(),s=ai(oe(-.5).mul(e.sub(t)),bf).div(n).toVar(),o=pe().toVar();o.x=n.x.greaterThan(oe(0)).select(r.x,s.x),o.y=n.y.greaterThan(oe(0)).select(r.y,s.y),o.z=n.z.greaterThan(oe(0)).select(r.z,s.z);let a=Il(o.x,o.y,o.z).toVar();return bf.add(n.mul(a)).toVar().sub(t)}),hoe=me(([i,e])=>{let t=i.x,n=i.y,r=i.z,s=e.element(0).mul(.886227);return s=s.add(e.element(1).mul(2*.511664).mul(n)),s=s.add(e.element(2).mul(2*.511664).mul(r)),s=s.add(e.element(3).mul(2*.511664).mul(t)),s=s.add(e.element(4).mul(2*.429043).mul(t).mul(n)),s=s.add(e.element(5).mul(2*.429043).mul(n).mul(r)),s=s.add(e.element(6).mul(r.mul(r).mul(.743125).sub(.247708))),s=s.add(e.element(7).mul(2*.429043).mul(t).mul(r)),s=s.add(e.element(8).mul(.429043).mul(Tn(t,t).sub(Tn(n,n)))),s}),V=Object.freeze({__proto__:null,BRDF_GGX:AV,BRDF_Lambert:s1,BasicPointShadowFilter:Jse,BasicShadowFilter:Wse,Break:Zre,Const:yie,Continue:u3e,DFGLUT:yS,D_GGX:cse,Discard:Bie,EPSILON:wI,F_Schlick:_x,Fn:me,HALF_PI:rEe,INFINITY:tEe,If:$t,Loop:Oi,NodeAccess:$o,NodeShaderStage:nx,NodeType:NTe,NodeUpdateType:yn,OnBeforeFrameUpdate:r3e,OnBeforeMaterialUpdate:i3e,OnBeforeObjectUpdate:n3e,OnFrameUpdate:Gre,OnMaterialUpdate:t3e,OnObjectUpdate:OS,PCFShadowFilter:jse,PCFSoftShadowFilter:Xse,PI:d4,PI2:nEe,PointShadowFilter:eoe,Return:mEe,Schlick_to_F0:E7,ShaderNode:sx,Stack:vI,Switch:YTe,TBNViewMatrix:Wg,TWO_PI:iEe,VSMShadowFilter:$se,V_GGX_SmithCorrelated:lse,Var:xie,VarIntent:bie,abs:fr,acesFilmicToneMapping:Ose,acos:bz,acosh:Zne,add:Ls,addMethodChaining:Ue,addNodeElement:AEe,agxToneMapping:Use,all:zne,alphaT:l4,ambientOcclusion:CU,and:Ene,anisotropy:am,anisotropyB:$g,anisotropyT:aS,any:Vne,append:KTe,array:vne,asin:$ne,asinh:Yne,assign:_ne,atan:wz,atanh:Kne,atomicAdd:bRe,atomicAnd:ERe,atomicFunc:Pf,atomicLoad:xRe,atomicMax:SRe,atomicMin:TRe,atomicOr:MRe,atomicStore:yRe,atomicSub:wRe,atomicXor:CRe,attenuationColor:gz,attenuationDistance:Az,attribute:fc,attributeArray:MCe,backgroundBlurriness:Ise,backgroundIntensity:mk,backgroundRotation:Pse,batch:jre,batchColor:lV,bentNormalView:fre,billboarding:mCe,bitAnd:Ine,bitNot:Pne,bitOr:Lne,bitXor:Dne,bitangentGeometry:XEe,bitangentLocal:$Ee,bitangentView:ure,bitangentWorld:YEe,bitcast:Tse,blendBurn:OCe,blendColor:VCe,blendDodge:UCe,blendOverlay:zCe,blendScreen:kCe,blur:mse,bool:dc,buffer:Sx,bufferAttribute:Uz,builtin:np,builtinAOContext:vie,builtinShadowContext:gie,bumpMap:eV,bvec2:fne,bvec3:fz,bvec4:dne,bypass:Nie,cache:Die,call:xne,cameraFar:um,cameraIndex:wm,cameraNear:cm,cameraNormalMatrix:SEe,cameraPosition:Gie,cameraProjectionMatrix:Ja,cameraProjectionMatrixInverse:Vie,cameraViewMatrix:Sm,cameraViewport:TEe,cameraWorldMatrix:BS,cbrt:hie,cdl:jCe,ceil:TI,checker:w4e,cineonToneMapping:Bse,clamp:Ku,clearcoat:s4,clearcoatNormalView:hm,clearcoatRoughness:ax,clipSpace:Wie,code:kI,color:hne,colorSpaceToWorking:MI,colorToDirection:QEe,compute:Lie,computeKernel:zz,computeSkinning:c3e,context:tp,convert:mne,convertColorSpace:lEe,convertToTexture:wCe,cos:ju,cosh:Wne,countLeadingZeros:jMe,countOneBits:XMe,countTrailingZeros:WMe,cross:Qd,cubeTexture:Qa,cubeTextureBase:Qz,dFdx:Ez,dFdy:Mz,dashSize:Yg,debug:Uie,decrement:kne,decrementBefore:One,defaultBuildStages:ZR,defaultShaderStages:one,defined:dx,degrees:qne,deltaTime:aCe,densityFogFactor:Gse,depth:dV,depthPass:KCe,determinant:nie,difference:oie,diffuseColor:Bi,diffuseContribution:Vg,directPointLight:noe,directionToColor:KEe,directionToFaceDirection:UEe,dispersion:vz,disposeShadowMaterial:Zse,distance:sie,div:pc,dot:au,drawIndex:Pie,dynamicBufferAttribute:hEe,element:pne,emissive:MU,equal:yne,equirectDirection:x7,equirectUV:pV,exp:xz,exp2:px,exponentialHeightFogFactor:lRe,expression:hc,faceDirection:Yz,faceForward:Nz,faceforward:sEe,float:oe,floatBitsToInt:GMe,floatBitsToUint:Ese,floor:xf,fog:bk,fract:Zu,frameGroup:JTe,frameId:Mse,frontFacing:jie,fwidth:Rz,gain:YMe,gapSize:AS,getConstNodeType:une,getCurrentStack:cz,getDirection:dse,getDistanceAttenuation:CV,getGeometryRoughness:ase,getNormalFromDepth:TCe,getParallaxCorrectNormal:sPe,getRoughness:mV,getScreenPosition:SCe,getShIrradianceAt:hoe,getShadowMaterial:Yse,getShadowRenderObjectFunction:Kse,getTextureIndex:wse,getViewPosition:rx,ggxConvolution:Ase,globalId:fRe,glsl:sRe,glslFn:oRe,grayscale:GCe,greaterThan:_z,greaterThanEqual:Tne,hash:$Me,highpModelNormalViewMatrix:$U,highpModelViewMatrix:XU,hue:WCe,increment:Une,incrementBefore:Bne,inspector:kie,instance:Hre,instanceColor:aV,instanceIndex:Yu,instancedArray:CCe,instancedBufferAttribute:RI,instancedDynamicBufferAttribute:kz,instancedMesh:Wre,int:de,intBitsToFloat:qMe,interleavedGradientNoise:_V,inverse:iie,inverseSqrt:yz,inversesqrt:oEe,invocationLocalIndex:pEe,invocationSubgroupIndex:dEe,ior:lS,iridescence:xI,iridescenceIOR:o4,iridescenceThickness:a4,isolate:ux,ivec2:kr,ivec3:hz,ivec4:dz,js:iRe,label:_ie,length:yf,lengthSq:Lz,lessThan:wne,lessThanEqual:Sne,lightPosition:SV,lightProjectionUV:qse,lightShadowMatrix:VI,lightTargetDirection:EV,lightTargetPosition:Hse,lightViewPosition:TV,lightingContext:Qre,lights:s4e,linearDepth:b4,linearToneMapping:Nse,localId:dRe,log:SI,log2:_f,logarithmicDepthToViewZ:m3e,luminance:yV,mat2:_I,mat3:To,mat4:mm,matcapUV:gse,materialAO:zre,materialAlphaTest:pre,materialAnisotropy:Rre,materialAnisotropyVector:ix,materialAttenuationColor:Ore,materialAttenuationDistance:Bre,materialClearcoat:wre,materialClearcoatNormal:Tre,materialClearcoatRoughness:Sre,materialColor:mre,materialDispersion:kre,materialEmissive:gre,materialEnvIntensity:QR,materialEnvRotation:v4,materialIOR:Fre,materialIridescence:Ire,materialIridescenceIOR:Pre,materialIridescenceThickness:Lre,materialLightMap:oV,materialLineDashOffset:sV,materialLineDashSize:iV,materialLineGapSize:rV,materialLineScale:nV,materialLineWidth:_4,materialMetalness:yre,materialNormal:bre,materialOpacity:tV,materialPointSize:Ure,materialReference:$d,materialReflectivity:JR,materialRefractionRatio:Yie,materialRotation:Ere,materialRoughness:xre,materialSheen:Mre,materialSheenRoughness:Cre,materialShininess:Are,materialSpecular:vre,materialSpecularColor:_re,materialSpecularIntensity:s7,materialSpecularStrength:cS,materialThickness:Nre,materialTransmission:Dre,max:zr,maxMipLevel:Hz,mediumpModelViewMatrix:Hie,metalness:Zd,min:Il,mix:Qn,mixElement:die,mod:bI,modelDirection:LEe,modelNormalMatrix:qie,modelPosition:DEe,modelRadius:BEe,modelScale:NEe,modelViewMatrix:Tf,modelViewPosition:FEe,modelViewProjection:Vre,modelWorldMatrix:ru,modelWorldMatrixInverse:OEe,morphReference:Kre,mrt:Sse,mul:Tn,mx_aastep:loe,mx_add:VIe,mx_atan2:XIe,mx_cell_noise_float:BIe,mx_contrast:MIe,mx_divide:HIe,mx_fractal_noise_float:OIe,mx_fractal_noise_vec2:UIe,mx_fractal_noise_vec3:kIe,mx_fractal_noise_vec4:zIe,mx_frame:YIe,mx_heighttonormal:rPe,mx_hsvtorgb:gIe,mx_ifequal:JIe,mx_ifgreater:KIe,mx_ifgreatereq:QIe,mx_invert:ZIe,mx_modulo:WIe,mx_multiply:qIe,mx_noise_float:CIe,mx_noise_vec3:RIe,mx_noise_vec4:IIe,mx_place2d:tPe,mx_power:jIe,mx_ramp4:bIe,mx_ramplr:xIe,mx_ramptb:yIe,mx_rgbtohsv:vIe,mx_rotate2d:nPe,mx_rotate3d:iPe,mx_safepower:EIe,mx_separate:ePe,mx_splitlr:wIe,mx_splittb:SIe,mx_srgb_texture_to_lin_rec709:_Ie,mx_subtract:GIe,mx_timer:$Ie,mx_transform_uv:TIe,mx_unifiednoise2d:PIe,mx_unifiednoise3d:LIe,mx_worley_noise_float:DIe,mx_worley_noise_vec2:NIe,mx_worley_noise_vec3:FIe,negate:Tz,negateOnBackSide:d1,neutralToneMapping:kse,nodeArray:Xg,nodeImmutable:xt,nodeObject:Ht,nodeObjectIntent:iS,nodeObjects:gI,nodeProxy:$n,nodeProxyConstructor:lz,nodeProxyIntent:ct,normalFlat:Xie,normalGeometry:II,normalLocal:ba,normalMap:i7,normalView:hi,normalViewGeometry:mx,normalWorld:Tm,normalWorldGeometry:$ie,normalize:xa,not:Cne,notEqual:bne,numWorkgroups:uRe,objectDirection:EEe,objectGroup:gne,objectPosition:CEe,objectRadius:PEe,objectScale:REe,objectViewPosition:IEe,objectWorldMatrix:MEe,oneMinus:Qne,or:Mne,orthographicDepthToViewZ:ese,oscSawtooth:hCe,oscSine:lCe,oscSquare:cCe,oscTriangle:uCe,output:lx,outputStruct:kMe,overloadingFn:Zo,overrideNode:yse,overrideNodes:bse,packHalf2x16:eCe,packNormalToRGB:Jz,packSnorm2x16:QMe,packUnorm2x16:JMe,parabola:ok,parallaxDirection:hre,parallaxUV:ZEe,parameter:BMe,pass:YCe,passTexture:ZCe,pcurve:ZMe,perspectiveDepthToViewZ:NI,pmremTexture:vV,pointShadow:toe,pointUV:RCe,pointWidth:QTe,positionGeometry:ga,positionLocal:Mr,positionPrevious:r1,positionView:xs,positionViewDirection:er,positionWorld:bf,positionWorldDirection:$z,posterize:XCe,pow:iu,pow2:Iz,pow3:aie,pow4:Pz,premultiplyAlpha:Gz,property:ep,quadBroadcast:JRe,quadSwapDiagonal:XRe,quadSwapX:WRe,quadSwapY:jRe,radians:Gne,rand:fie,range:cRe,rangeFogFactor:Vse,reciprocal:eie,reference:mr,referenceBuffer:tre,reflect:rie,reflectVector:Qie,reflectView:Zie,reflector:xCe,refract:Dz,refractVector:Jie,refractView:Kie,reinhardToneMapping:Fse,remap:Vz,remapClamp:Fie,renderGroup:Jt,renderOutput:qz,rendererReference:Mie,replaceDefaultUV:fCe,rotate:US,rotateUV:dCe,roughness:gf,round:Jne,rtt:Rse,sRGBTransferEOTF:Sie,sRGBTransferOETF:Tie,sample:ECe,sampler:xEe,samplerComparison:yEe,saturate:EI,saturation:qCe,screenCoordinate:f1,screenDPR:jz,screenSize:i1,screenUV:$u,select:_a,setCurrentStack:mS,setName:Fz,shaderStages:KR,shadow:Qse,shadowPositionWorld:MV,shapeCircle:S4e,sharedUniformGroup:yI,sheen:cc,sheenRoughness:lm,shiftLeft:Nne,shiftRight:Fne,shininess:c4,sign:Sz,sin:Ka,sinc:KMe,sinh:Hne,skinning:Yre,smoothstep:mc,smoothstepElement:pie,specularColor:vm,specularColorBlended:qg,specularF90:Hg,spherizeUV:pCe,split:ZTe,spritesheetUV:gCe,sqrt:el,stack:t4,step:t1,stepElement:mie,storage:Am,storageBarrier:ARe,storageTexture:Lse,storageTexture3D:PCe,struct:UMe,sub:ai,subBuild:Zg,subgroupAdd:PRe,subgroupAll:GRe,subgroupAnd:ORe,subgroupAny:qRe,subgroupBallot:IRe,subgroupBroadcast:$Re,subgroupBroadcastFirst:HRe,subgroupElect:RRe,subgroupExclusiveAdd:DRe,subgroupExclusiveMul:BRe,subgroupInclusiveAdd:LRe,subgroupInclusiveMul:FRe,subgroupIndex:fEe,subgroupMax:VRe,subgroupMin:zRe,subgroupMul:NRe,subgroupOr:URe,subgroupShuffle:YRe,subgroupShuffleDown:QRe,subgroupShuffleUp:KRe,subgroupShuffleXor:ZRe,subgroupSize:pRe,subgroupXor:kRe,tan:jne,tangentGeometry:PI,tangentLocal:_m,tangentView:LI,tangentWorld:cre,tanh:Xne,texture:fi,texture3D:xV,texture3DLevel:NCe,texture3DLoad:DCe,textureBarrier:gRe,textureBicubic:G3e,textureBicubicLevel:gV,textureCubeUV:pse,textureLevel:_Ee,textureLoad:_s,textureSize:n1,textureStore:ICe,thickness:mz,time:Ex,toneMapping:Cie,toneMappingExposure:Rie,toonOutlinePass:QCe,transformDirection:lie,transformNormal:Zz,transformNormalByInverseViewMatrix:uie,transformNormalByViewMatrix:cie,transformNormalToView:Kz,transformedClearcoatNormalView:VEe,transformedNormalView:kEe,transformedNormalWorld:zEe,transmission:u4,transpose:tie,triNoise3D:sCe,triplanarTexture:vCe,triplanarTextures:Cse,trunc:Cz,uint:rt,uintBitsToFloat:HMe,uniform:Xt,uniformArray:Xo,uniformCubeTexture:GEe,uniformFlow:Aie,uniformGroup:Ane,uniformTexture:vEe,unpackHalf2x16:iCe,unpackNormal:t7,unpackRGBToNormal:dre,unpackSnorm2x16:tCe,unpackUnorm2x16:nCe,unpremultiplyAlpha:Oie,userData:FCe,uv:Ui,uvec2:uz,uvec3:u1,uvec4:pz,varying:bm,varyingProperty:h1,vec2:dt,vec3:pe,vec4:Ft,vectorComponents:c1,velocity:BCe,vertexColor:ise,vertexIndex:Iie,vertexStage:wie,vibrance:HCe,viewZToLogarithmicDepth:FI,viewZToOrthographicDepth:Kg,viewZToPerspectiveDepth:fV,viewZToReversedOrthographicDepth:p3e,viewZToReversedPerspectiveDepth:tse,viewport:fx,viewportCoordinate:zie,viewportDepthTexture:hV,viewportLinearDepth:A3e,viewportMipTexture:uV,viewportOpaqueMipTexture:Jre,viewportResolution:wEe,viewportSafeUV:ACe,viewportSharedTexture:$Ce,viewportSize:Xz,viewportTexture:f3e,viewportUV:bEe,vogelDiskSample:Xu,wgsl:rRe,wgslFn:aRe,workgroupArray:vRe,workgroupBarrier:mRe,workgroupId:hRe,workingToColorSpace:Eie,xor:Rne}),Hu=new wS,Pk=class extends Cf{constructor(e,t){super(),this.renderer=e,this.nodes=t}update(e,t,n){let r=this.renderer,s=this.nodes.getBackgroundNode(e)||e.background,o=!1;if(s===null)r._clearColor.getRGB(Hu),Hu.a=r._clearColor.a;else if(s.isColor===!0)s.getRGB(Hu),Hu.a=1,o=!0;else if(s.isNode===!0){let l=this.get(e),c=s;Hu.copy(r._clearColor);let u=l.backgroundMesh;if(u===void 0){let P=function(){s.removeEventListener("dispose",P),u.material.dispose(),u.geometry.dispose()},d=Ft(c).mul(mk).context({getUV:()=>Pse.mul($ie),getTextureLevel:()=>Ise}),A=Ja.element(3).element(3).equal(1),y=pc(1,Ja.element(1).element(1)).mul(3),w=A.select(Mr.mul(y),Mr),S=Tf.mul(Ft(w,0)),T=Ja.mul(Ft(S.xyz,1));T=T.setZ(T.w);let R=new Ir;R.name="Background.material",R.side=mi,R.depthTest=!1,R.depthWrite=!1,R.allowOverride=!1,R.fog=!1,R.lights=!1,R.vertexNode=T,R.colorNode=d,l.backgroundMeshNode=d,l.backgroundMesh=u=new Hn(new Va(1,32,32),R),u.frustumCulled=!1,u.name="Background.mesh",s.addEventListener("dispose",P)}let f=c.getCacheKey();l.backgroundCacheKey!==f&&(l.backgroundMeshNode.node=Ft(c).mul(mk),l.backgroundMeshNode.needsUpdate=!0,u.material.needsUpdate=!0,l.backgroundCacheKey=f),t.unshift(u,u.geometry,u.material,0,0,null,null)}else ze("Renderer: Unsupported background configuration.",s);let a=r.xr.getEnvironmentBlendMode();if(a==="additive"?Hu.set(0,0,0,1):a==="alpha-blend"&&Hu.set(0,0,0,0),r.autoClear===!0||o===!0){let l=n.clearColorValue;l.r=Hu.r,l.g=Hu.g,l.b=Hu.b,l.a=Hu.a,(r.backend.isWebGLBackend===!0||r.alpha===!0)&&(l.r*=l.a,l.g*=l.a,l.b*=l.a),n.depthClearValue=r.getClearDepth(),n.stencilClearValue=r.getClearStencil(),n.clearColor=r.autoClearColor===!0,n.clearDepth=r.autoClearDepth===!0,n.clearStencil=r.autoClearStencil===!0}else n.clearColor=!1,n.clearDepth=!1,n.clearStencil=!1}},oPe=0,CS=class{constructor(e="",t=[]){this.name=e,this.bindings=t,this.id=oPe++}},Lk=class{constructor(e,t,n,r,s,o,a,l,c,u,f=[]){this.vertexShader=e,this.fragmentShader=t,this.computeShader=n,this.transforms=f,this.nodeAttributes=r,this.bindings=s,this.updateNodes=o,this.updateBeforeNodes=a,this.updateAfterNodes=l,this.observer=c,this.hardwareClipping=u,this.usedTimes=0}createBindings(){let e=[];for(let t of this.bindings)if(t.bindings[0].groupNode.shared!==!0){let r=new CS(t.name,[]);e.push(r);for(let s of t.bindings)r.bindings.push(s.clone())}else e.push(t);return e}},H4=class{constructor(e,t,n=null){this.isNodeAttribute=!0,this.name=e,this.type=t,this.node=n}},Dk=class{constructor(e,t,n){this.isNodeUniform=!0,this.name=e,this.type=t,this.node=n}get value(){return this.node.value}set value(e){this.node.value=e}get id(){return this.node.id}get groupNode(){return this.node.groupNode}},W4=class{constructor(e,t,n=!1,r=null){this.isNodeVar=!0,this.name=e,this.type=t,this.readOnly=n,this.count=r}},Nk=class extends W4{constructor(e,t,n=null,r=null){super(e,t),this.needsInterpolation=!1,this.isNodeVarying=!0,this.interpolationType=n,this.interpolationSampling=r}},Fk=class{constructor(e,t,n=""){this.name=e,this.type=t,this.code=n,Object.defineProperty(this,"isNodeCode",{value:!0})}},aPe=0,dS=class{constructor(e=null){this.id=aPe++,this.nodesData=new WeakMap,this.parent=e}getData(e){let t=this.nodesData.get(e);return t===void 0&&this.parent!==null&&(t=this.parent.getData(e)),t}setData(e,t){this.nodesData.set(e,t)}},Bk=class{constructor(e,t){this.name=e,this.members=t,this.output=!1}},If=class{constructor(e,t){this.name=e,this.value=t,this.boundary=0,this.itemSize=0,this.offset=0,this.index=-1}setValue(e){this.value=e}getValue(){return this.value}},Ok=class extends If{constructor(e,t=0){super(e,t),this.isNumberUniform=!0,this.boundary=4,this.itemSize=1}},Uk=class extends If{constructor(e,t=new Oe){super(e,t),this.isVector2Uniform=!0,this.boundary=8,this.itemSize=2}},kk=class extends If{constructor(e,t=new re){super(e,t),this.isVector3Uniform=!0,this.boundary=16,this.itemSize=3}},zk=class extends If{constructor(e,t=new xn){super(e,t),this.isVector4Uniform=!0,this.boundary=16,this.itemSize=4}},Vk=class extends If{constructor(e,t=new zt){super(e,t),this.isColorUniform=!0,this.boundary=16,this.itemSize=3}},Gk=class extends If{constructor(e,t=new h_){super(e,t),this.isMatrix2Uniform=!0,this.boundary=8,this.itemSize=4}},qk=class extends If{constructor(e,t=new Mn){super(e,t),this.isMatrix3Uniform=!0,this.boundary=48,this.itemSize=12}},Hk=class extends If{constructor(e,t=new cn){super(e,t),this.isMatrix4Uniform=!0,this.boundary=64,this.itemSize=16}},Wk=class extends Ok{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},jk=class extends Uk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},Xk=class extends kk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},$k=class extends zk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},Yk=class extends Vk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},Zk=class extends Gk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},Kk=class extends qk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},Qk=class extends Hk{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},lPe=0,Mte=new WeakMap,Cte=new WeakMap,cPe=new WeakMap,uPe=new Map([[Int8Array,"int"],[Int16Array,"int"],[Int32Array,"int"],[Uint8Array,"uint"],[Uint16Array,"uint"],[Uint32Array,"uint"],[Float32Array,"float"]]),FR=i=>/e/g.test(i)?String(i).replace(/\+/g,""):(i=Number(i),i+(i%1?"":".0")),foe=i=>{if(i.writeUsageCount>0)return!0;if(i.subBuildsCache!==void 0){for(let e in i.subBuildsCache)if(foe(i.subBuildsCache[e]))return!0}return!1},j4=class{constructor(e,t,n){this.object=e,this.material=e&&e.material||null,this.geometry=e&&e.geometry||null,this.renderer=t,this.parser=n,this.scene=null,this.camera=null,this.nodes=new Set,this.sequentialNodes=new Set,this.updateNodes=[],this.updateBeforeNodes=[],this.updateAfterNodes=[],this.hashNodes={},this.observer=null,this.lightsNode=null,this.environmentNode=null,this.fogNode=null,this.clippingContext=null,this.hardwareClipping=!1,this.vertexShader=null,this.fragmentShader=null,this.computeShader=null,this.flowNodes={vertex:[],fragment:[],compute:[]},this.flowCode={vertex:"",fragment:"",compute:""},this.uniforms={vertex:[],fragment:[],compute:[],index:0},this.structs={vertex:[],fragment:[],compute:[],index:0},this.types={vertex:[],fragment:[],compute:[],index:0},this.bindings={vertex:{},fragment:{},compute:{}},this.bindingsIndexes={},this.bindGroups=null,this.attributes=[],this.bufferAttributes=[],this.varyings=[],this.codes={},this.vars={},this.declarations={},this.flow={code:""},this.chaining=[],this.stack=t4(),this.stacks=[],this.tab=" ",this.currentFunctionNode=null,this.context={material:this.material},this.cache=new dS,this.globalCache=this.cache,this.flowsData=new WeakMap,this.shaderStage=null,this.buildStage=null,this.subBuildLayers=[],this.activeStacks=[],this.subBuildFn=null,this.fnCall=null,Object.defineProperty(this,"id",{value:lPe++})}isFlatShading(){return this.material.flatShading===!0||this.geometry.hasAttribute("normal")===!1}isOpaque(){let e=this.material;return e.transparent===!1&&e.blending===Ms&&e.alphaToCoverage===!1}createRenderTarget(e,t,n){return new Ba(e,t,n)}createCubeRenderTarget(e,t){return new w4(e,t)}includes(e){return this.nodes.has(e)}getOutputType(e=0){let t="vec4",n=this.renderer.getRenderTarget();if(n!==null){let r=n.textures[e].type,s=n.textures[e].format,o="vec";r===Zr?o="ivec":r===xi&&(o="uvec"),s===Bd||s===Gh?r===Zr?t="int":r===xi?t="uint":t="float":s===js||s===qh?t=`${o}2`:s===Fd||s===Nb?t=`${o}3`:t=`${o}4`}return t}getOutputStructName(){}_getBindGroup(e,t){let n=t[0].groupNode,r=n.shared;if(r)for(let o=1;o<t.length;o++)n!==t[o].groupNode&&(r=!1);let s;if(r){let o="";for(let u of t)if(u.isNodeUniformsGroup){u.uniforms.sort((f,d)=>f.nodeUniform.node.id-d.nodeUniform.node.id);for(let f of u.uniforms)o+=f.nodeUniform.node.id}else o+=u.nodeUniform.id;let a=this.renderer._currentRenderContext||this.renderer,l=Mte.get(a);l===void 0&&(l=new Map,Mte.set(a,l));let c=wx(o);s=l.get(c),s===void 0&&(s=new CS(e,t),l.set(c,s))}else s=new CS(e,t);return s}getBindGroupArray(e,t){let n=this.bindings[t],r=n[e];return r===void 0&&(this.bindingsIndexes[e]===void 0&&(this.bindingsIndexes[e]={binding:0,group:Object.keys(this.bindingsIndexes).length}),n[e]=r=[]),r}getBindings(){let e=this.bindGroups;if(e===null){let t={},n=this.bindings;for(let r of KR)for(let s in n[r]){let o=n[r][s],a=t[s]||(t[s]=[]);for(let l of o)a.includes(l)===!1&&a.push(l)}e=[];for(let r in t){let s=t[r],o=this._getBindGroup(r,s);e.push(o)}this.bindGroups=e}return e}sortBindingGroups(){let e=this.getBindings();e.sort((t,n)=>t.bindings[0].groupNode.order-n.bindings[0].groupNode.order);for(let t=0;t<e.length;t++){let n=e[t];this.bindingsIndexes[n.name].group=t}}setHashNode(e,t){this.hashNodes[t]=e}addNode(e){this.nodes.has(e)===!1&&(this.nodes.add(e),this.setHashNode(e,e.getHash(this)))}addSequentialNode(e){let t=e.getUpdateBeforeType(),n=e.getUpdateAfterType();(t!==yn.NONE||n!==yn.NONE)&&this.sequentialNodes.add(e)}buildUpdateNodes(){for(let e of this.nodes)e.getUpdateType()!==yn.NONE&&this.updateNodes.push(e);for(let e of this.sequentialNodes){let t=e.getUpdateBeforeType(),n=e.getUpdateAfterType();t!==yn.NONE&&this.updateBeforeNodes.push(e),n!==yn.NONE&&this.updateAfterNodes.push(e)}}get currentNode(){return this.chaining[this.chaining.length-1]}isFilteredTexture(e){return e.magFilter===Mi||e.magFilter===g0||e.magFilter===jc||e.magFilter===Vo||e.minFilter===Mi||e.minFilter===g0||e.minFilter===jc||e.minFilter===Vo}getUniformBufferLimit(){return this.renderer.backend.capabilities.getUniformBufferLimit()}addChain(e){this.chaining.push(e)}removeChain(e){if(this.chaining.pop()!==e)throw new Error("THREE.NodeBuilder: Invalid node chaining!")}getMethod(e){return e}getTernary(){return null}getNodeFromHash(e){return this.hashNodes[e]}addFlow(e,t){return this.flowNodes[e].push(t),t}setContext(e){this.context=e}getContext(){return this.context}addContext(e){let t=this.getContext();return this.setContext({...this.context,...e}),t}getSharedContext(){let e={...this.context};return delete e.material,delete e.getUV,delete e.getOutput,delete e.getTextureLevel,delete e.getAO,delete e.getShadow,e}setCache(e){this.cache=e}getCache(){return this.cache}getCacheFromNode(e,t=!0){let n=this.getDataFromNode(e);return n.cache===void 0&&(n.cache=new dS(t?this.getCache():null)),n.cache}isAvailable(){return!1}getVertexIndex(){Xe("Abstract function.")}getInstanceIndex(){Xe("Abstract function.")}getDrawIndex(){Xe("Abstract function.")}getFrontFacing(){Xe("Abstract function.")}getFragCoord(){Xe("Abstract function.")}isFlipY(){return!1}isContextAssign(){return this.context.assign===!0}increaseUsage(e){let t=this.getDataFromNode(e);return t.usageCount=t.usageCount===void 0?1:t.usageCount+1,this.isContextAssign()?t.writeUsageCount=t.writeUsageCount===void 0?1:t.writeUsageCount+1:t.readUsageCount=t.readUsageCount===void 0?1:t.readUsageCount+1,t.usageCount}hasWriteUsage(e){let t=e.getShared(this),r=(t.isGlobal(this)?this.globalCache:this.cache).getData(t);if(r!==void 0){for(let s in r)if(foe(r[s]))return!0}return!1}generateTexture(){Xe("Abstract function.")}generateTextureLod(){Xe("Abstract function.")}generateArrayDeclaration(e,t){return this.getType(e)+"[ "+t+" ]"}generateArray(e,t,n=null){let r=this.generateArrayDeclaration(e,t)+"( ";for(let s=0;s<t;s++){let o=n?n[s]:null;o!==null?r+=o.build(this,e):r+=this.generateConst(e),s<t-1&&(r+=", ")}return r+=" )",r}generateStruct(e,t,n=null){let r=[];for(let s of t){let{name:o,type:a}=s;n&&n[o]&&n[o].isNode?r.push(n[o].build(this,a)):r.push(this.generateConst(a))}return e+"( "+r.join(", ")+" )"}generateConst(e,t=null){if(t===null&&(e==="float"||e==="int"||e==="uint"?t=0:e==="bool"?t=!1:e==="color"?t=new zt:e==="vec2"||e==="uvec2"||e==="ivec2"?t=new Oe:e==="vec3"||e==="uvec3"||e==="ivec3"?t=new re:(e==="vec4"||e==="uvec4"||e==="ivec4")&&(t=new xn)),e==="float")return FR(t);if(e==="int")return`${Math.round(t)}`;if(e==="uint")return t>=0?`${Math.round(t)}u`:"0u";if(e==="bool")return t?"true":"false";if(e==="color")return`${this.getType("vec3")}( ${FR(t.r)}, ${FR(t.g)}, ${FR(t.b)} )`;let n=this.getTypeLength(e),r=this.getComponentType(e),s=o=>this.generateConst(r,o);if(n===2)return`${this.getType(e)}( ${s(t.x)}, ${s(t.y)} )`;if(n===3)return`${this.getType(e)}( ${s(t.x)}, ${s(t.y)}, ${s(t.z)} )`;if(n===4&&e!=="mat2")return`${this.getType(e)}( ${s(t.x)}, ${s(t.y)}, ${s(t.z)}, ${s(t.w)} )`;if(n>=4&&t&&(t.isMatrix2||t.isMatrix3||t.isMatrix4))return`${this.getType(e)}( ${t.elements.map(s).join(", ")} )`;if(n>4)return`${this.getType(e)}()`;throw new Error(`THREE.NodeBuilder: Type '${e}' not found in generate constant attempt.`)}getType(e){return e==="color"?"vec3":e}hasGeometryAttribute(e){return this.geometry&&this.geometry.getAttribute(e)!==void 0}getAttribute(e,t){let n=this.attributes;for(let s of n)if(s.name===e)return s;let r=new H4(e,t);return this.registerDeclaration(r),n.push(r),r}getPropertyName(e){return e.name}isVector(e){return/vec\d/.test(e)}isMatrix(e){return/mat\d/.test(e)}isReference(e){return e==="void"||e==="property"||e==="sampler"||e==="samplerComparison"||e==="texture"||e==="cubeTexture"||e==="storageTexture"||e==="depthTexture"||e==="texture3D"}needsToWorkingColorSpace(){return!1}getComponentTypeFromTexture(e){let t=e.type;return e.isDepthTexture===!0?"float":t===Zr?"int":t===xi?"uint":"float"}getElementType(e){return e==="mat2"?"vec2":e==="mat3"?"vec3":e==="mat4"?"vec4":this.getComponentType(e)}getComponentType(e){if(e=this.getVectorType(e),e==="float"||e==="bool"||e==="int"||e==="uint")return e;let t=/(b|i|u|)(vec|mat)([2-4])/.exec(e);return t===null?null:t[1]==="b"?"bool":t[1]==="i"?"int":t[1]==="u"?"uint":"float"}getVectorType(e){return e==="color"?"vec3":e==="texture"||e==="cubeTexture"||e==="storageTexture"||e==="texture3D"?"vec4":e}getTypeFromLength(e,t="float"){if(e===1)return t;let n=ine(e),r=t==="float"?"":t[0];return/mat2/.test(t)===!0&&(n=n.replace("vec","mat")),r+n}getTypeFromArray(e){return uPe.get(e.constructor)}isInteger(e){return/int|uint|(i|u)vec/.test(e)}getTypeFromAttribute(e){let t=e;e.isInterleavedBufferAttribute&&(t=e.data);let n=t.array,r=e.itemSize,s=e.normalized,o;return!(e instanceof e_)&&s!==!0&&(o=this.getTypeFromArray(n)),this.getTypeFromLength(r,o)}getTypeLength(e){let t=this.getVectorType(e),n=/vec([2-4])/.exec(t);return n!==null?Number(n[1]):t==="float"||t==="bool"||t==="int"||t==="uint"?1:/mat2/.test(e)===!0?4:/mat3/.test(e)===!0?9:/mat4/.test(e)===!0?16:0}getVectorFromMatrix(e){return e.replace("mat","vec")}changeComponentType(e,t){return this.getTypeFromLength(this.getTypeLength(e),t)}getIntegerType(e){let t=this.getComponentType(e);return t==="int"||t==="uint"?e:this.changeComponentType(e,"int")}setActiveStack(e){this.activeStacks.push(e)}removeActiveStack(e){if(this.activeStacks[this.activeStacks.length-1]===e)this.activeStacks.pop();else throw new Error("THREE.NodeBuilder: Invalid active stack removal.")}getActiveStack(){return this.activeStacks[this.activeStacks.length-1]}getBaseStack(){return this.activeStacks[0]}addStack(){this.stack=t4(this.stack);let e=cz();return this.stacks.push(e),mS(this.stack),this.stack}removeStack(){let e=this.stack;for(let t of e.nodes){let n=this.getDataFromNode(t);n.stack=e}return this.stack=e.parent,mS(this.stacks.pop()),e}getDataFromNode(e,t=this.shaderStage,n=null){n=n===null?e.isGlobal(this)?this.globalCache:this.cache:n;let r=n.getData(e);r===void 0&&(r={},n.setData(e,r)),r[t]===void 0&&(r[t]={});let s=r[t];if(this.subBuildLayers.length===0)return s;let o=r.any?r.any.subBuilds:null,a=this.getClosestSubBuild(o);return a&&(s.subBuildsCache===void 0&&(s.subBuildsCache={}),s=s.subBuildsCache[a]||(s.subBuildsCache[a]={}),s.subBuilds=o),s}getNodeProperties(e,t="any"){let n=this.getDataFromNode(e,t);return n.properties||(n.properties={outputNode:null})}getBufferAttributeFromNode(e,t,n=null){let r=this.getDataFromNode(e,"vertex"),s=r.bufferAttribute;if(s===void 0){let o=this.uniforms.index++;n===null&&(n="nodeAttribute"+o),s=new H4(n,t,e),this.bufferAttributes.push(s),r.bufferAttribute=s}return s}getStructTypeNode(e,t=this.shaderStage){return this.types[t][e]||null}getStructTypeFromNode(e,t,n=null,r=this.shaderStage){let s=this.getDataFromNode(e,r,this.globalCache),o=s.structType;if(o===void 0){let a=this.structs.index++;n===null&&(n="StructType"+a),o=new Bk(n,t),this.structs[r].push(o),this.types[r][n]=e,s.structType=o}return o}getOutputStructTypeFromNode(e,t){let n=this.getStructTypeFromNode(e,t,"OutputType","fragment");return n.output=!0,n}getUniformFromNode(e,t,n=this.shaderStage,r=null){let s=this.getDataFromNode(e,n,this.globalCache),o=s.uniform;if(o===void 0){let a=this.uniforms.index++;o=new Dk(r||"nodeUniform"+a,t,e),this.uniforms[n].push(o),this.registerDeclaration(o),s.uniform=o}return o}getVarFromNode(e,t=null,n=e.getNodeType(this),r=this.shaderStage,s=!1){let o=this.getDataFromNode(e,r),a=this.getSubBuildProperty("variable",o.subBuilds),l=o[a];if(l===void 0){let c=s?"_const":"_var",u=this.vars[r]||(this.vars[r]=[]),f=this.vars[c]||(this.vars[c]=0);t===null&&(t=(s?"nodeConst":"nodeVar")+f,this.vars[c]++),a!=="variable"&&(t=this.getSubBuildProperty(t,o.subBuilds));let d=e.getArrayCount(this);l=new W4(t,n,s,d),s||u.push(l),this.registerDeclaration(l),o[a]=l}return l}isDeterministic(e){if(e.isMathNode)return this.isDeterministic(e.aNode)&&(e.bNode?this.isDeterministic(e.bNode):!0)&&(e.cNode?this.isDeterministic(e.cNode):!0);if(e.isOperatorNode)return this.isDeterministic(e.aNode)&&(e.bNode?this.isDeterministic(e.bNode):!0);if(e.isArrayNode){if(e.values!==null){for(let t of e.values)if(!this.isDeterministic(t))return!1}return!0}else if(e.isConstNode)return!0;return!1}getVaryingFromNode(e,t=null,n=e.getNodeType(this),r=null,s=null){let o=this.getDataFromNode(e,"any"),a=this.getSubBuildProperty("varying",o.subBuilds),l=o[a];if(l===void 0){let c=this.varyings,u=c.length;t===null&&(t="nodeVarying"+u),a!=="varying"&&(t=this.getSubBuildProperty(t,o.subBuilds)),l=new Nk(t,n,r,s),c.push(l),this.registerDeclaration(l),o[a]=l}return l}registerDeclaration(e){let t=this.shaderStage,n=this.declarations[t]||(this.declarations[t]={}),r=e.name,s=r,o=this.getPropertyName(e),a=1;for(;n[o]!==void 0;)s=r+"_"+a++,e.name=s,o=this.getPropertyName(e);s!==r&&Xe(`TSL: Declaration name '${r}' of '${e.type}' already in use. Renamed to '${s}'.`),n[o]=e}getCodeFromNode(e,t,n=this.shaderStage){let r=this.getDataFromNode(e),s=r.code;if(s===void 0){let o=this.codes[n]||(this.codes[n]=[]),a=o.length;s=new Fk("nodeCode"+a,t),o.push(s),r.code=s}return s}addFlowCodeHierarchy(e,t){let{flowCodes:n,flowCodeBlock:r}=this.getDataFromNode(e),s=!0,o=t;for(;o;){if(r.get(o)===!0){s=!1;break}o=this.getDataFromNode(o).parentNodeBlock}if(s)for(let a of n)this.addLineFlowCode(a)}addLineFlowCodeBlock(e,t,n){let r=this.getDataFromNode(e),s=r.flowCodes||(r.flowCodes=[]),o=r.flowCodeBlock||(r.flowCodeBlock=new WeakMap);s.push(t),o.set(n,!0)}addLineFlowCode(e,t=null){return e===""?this:(t!==null&&this.context.nodeBlock&&this.addLineFlowCodeBlock(t,e,this.context.nodeBlock),e=this.tab+e,/;\s*$/.test(e)||(e=e+`;4161+`),this.flow.code+=e,this)}addFlowCode(e){return this.flow.code+=e,this}addFlowTab(){return this.tab+=" ",this}removeFlowTab(){return this.tab=this.tab.slice(0,-1),this}getFlowData(e){return this.flowsData.get(e)}flowNode(e){let t=e.getNodeType(this),n=this.flowChildNode(e,t);return this.flowsData.set(e,n),n}addInclude(e){this.currentFunctionNode!==null&&this.currentFunctionNode.includes.push(e)}buildFunctionNode(e){let t=this.renderer.backend,n=Cte.get(t);n===void 0&&(n=new WeakMap,Cte.set(t,n));let r=n.get(e);if(r===void 0){r=new k4;let s=this.currentFunctionNode;this.currentFunctionNode=r,r.code=this.buildFunctionCode(e),this.currentFunctionNode=s,n.set(e,r)}return r}flowShaderNode(e){let t=e.layout,n={[Symbol.iterator](){let o=0,a=Object.values(this);return{next:()=>({value:a[o],done:o++>=a.length})}}};for(let o of t.inputs)n[o.name]=new L4(o.type,o.name);e.layout=null;let r=e.call(n),s=this.flowStagesNode(r,t.type);return e.layout=t,s}flowBuildStage(e,t,n=null){let r=this.getBuildStage();this.setBuildStage(t);let s=e.build(this,n);return this.setBuildStage(r),s}flowStagesNode(e,t=null){let n=this.flow,r=this.vars,s=this.declarations,o=this.cache,a=this.buildStage,l=this.stack,c={code:""};this.flow=c,this.vars={},this.declarations={},this.cache=new dS,this.stack=t4();for(let u of ZR)this.setBuildStage(u),c.result=e.build(this,t);return c.vars=this.getVars(this.shaderStage),this.flow=n,this.vars=r,this.declarations=s,this.cache=o,this.stack=l,this.setBuildStage(a),c}getFunctionOperator(){return null}buildFunctionCode(){Xe("Abstract function.")}flowChildNode(e,t=null){let n=this.flow,r={code:""};return this.flow=r,r.result=e.build(this,t),this.flow=n,r}flowNodeFromShaderStage(e,t,n=null,r=null){let s=this.tab,o=this.cache,a=this.shaderStage,l=this.context;this.setShaderStage(e);let c={...this.context};delete c.nodeBlock,this.cache=this.globalCache,this.tab=" ",this.context=c;let u=null;if(this.buildStage==="generate"){let f=this.flowChildNode(t,n);r!==null&&(f.code+=`${this.tab+r} = ${f.result};41624162 `),this.flowCode[e]=this.flowCode[e]+f.code,u=f}else u=t.build(this);return this.setShaderStage(a),this.cache=o,this.tab=s,this.context=l,u}getAttributesArray(){return this.attributes.concat(this.bufferAttributes)}getAttributes(){Xe("Abstract function.")}getVaryings(){Xe("Abstract function.")}getVar(e,t,n=null){return`${n!==null?this.generateArrayDeclaration(e,n):this.getType(e)} ${t}`}getVars(e,t=!1){let n=[],r=this.vars[e];if(r!==void 0)for(let s of r)n.push(`${this.getVar(s.type,s.name,s.count)};`);return n.join(t?`41634163 `:`41644164 `)}getUniforms(){Xe("Abstract function.")}getCodes(e){let t=this.codes[e],n="";if(t!==void 0)for(let r of t)n+=r.code+`4165-`;return n}getHash(){return this.vertexShader+this.fragmentShader+this.computeShader}setShaderStage(e){this.shaderStage=e}getShaderStage(){return this.shaderStage}setBuildStage(e){this.buildStage=e}getBuildStage(){return this.buildStage}buildCode(){Xe("Abstract function.")}get subBuild(){return this.subBuildLayers[this.subBuildLayers.length-1]||null}addSubBuild(e){this.subBuildLayers.push(e)}removeSubBuild(){return this.subBuildLayers.pop()}getClosestSubBuild(e){let t;if(e&&e.isNode?e.isShaderCallNodeInternal?t=e.shaderNode.subBuilds:e.isStackNode?t=[e.subBuild]:t=this.getDataFromNode(e,"any").subBuilds:e instanceof Set?t=[...e]:t=e,!t)return null;let n=this.subBuildLayers;for(let r=t.length-1;r>=0;r--){let s=t[r];if(n.includes(s))return s}return null}getSubBuildOutput(e){return this.getSubBuildProperty("outputNode",e)}getSubBuildProperty(e="",t=null){let n;t!==null?n=this.getClosestSubBuild(t):n=this.subBuildFn;let r;return n?r=e?n+"_"+e:n:r=e,r}prebuild(){let{object:e,renderer:t,material:n}=this;if(t.contextNode.isContextNode===!0?this.context={...this.context,...t.contextNode.getFlowContextData()}:ze('NodeBuilder: "renderer.contextNode" must be an instance of `context()`.'),n&&n.contextNode&&(n.contextNode.isContextNode===!0?this.context={...this.context,...n.contextNode.getFlowContextData()}:ze('NodeBuilder: "material.contextNode" must be an instance of `context()`.')),n!==null){let r=t.library.fromMaterial(n);r===null&&(ze(`NodeBuilder: Material "${n.type}" is not compatible.`),r=new Ir),r.build(this)}else this.addFlow("compute",e)}build(){this.prebuild();for(let e of jR){this.setBuildStage(e),this.context.position&&this.context.position.isNode&&this.flowNodeFromShaderStage("vertex",this.context.position);for(let t of XR){this.setShaderStage(t);let n=this.flowNodes[t];for(let r of n)e==="generate"?this.flowNode(r):r.build(this)}}return this.setBuildStage(null),this.setShaderStage(null),this.buildCode(),this.buildUpdateNodes(),this}async buildAsync(){this.prebuild();for(let e of jR){this.setBuildStage(e),this.context.position&&this.context.position.isNode&&this.flowNodeFromShaderStage("vertex",this.context.position);for(let t of XR){this.setShaderStage(t);let n=this.flowNodes[t];for(let r of n)e==="generate"?this.flowNode(r):r.build(this);await iF()}}return this.setBuildStage(null),this.setShaderStage(null),this.buildCode(),this.buildUpdateNodes(),this}getSharedDataFromNode(e){let t=qIe.get(e);return t===void 0&&(t={}),t}getNodeUniform(e,t){let n=this.getSharedDataFromNode(e),r=n.cache;if(r===void 0){if(t==="float"||t==="int"||t==="uint")r=new Ok(e);else if(t==="vec2"||t==="ivec2"||t==="uvec2")r=new Uk(e);else if(t==="vec3"||t==="ivec3"||t==="uvec3")r=new kk(e);else if(t==="vec4"||t==="ivec4"||t==="uvec4")r=new zk(e);else if(t==="color")r=new Vk(e);else if(t==="mat2")r=new Gk(e);else if(t==="mat3")r=new qk(e);else if(t==="mat4")r=new Hk(e);else throw new Error(`THREE.NodeBuilder: Uniform "${t}" not implemented.`);n.cache=r}return r}format(e,t,n){if(t=this.getVectorType(t),n=this.getVectorType(n),t===n||n===null||this.isReference(n))return e;let r=this.getTypeLength(t),s=this.getTypeLength(n);return r===16&&s===9?`${this.getType(n)}( ${e}[ 0 ].xyz, ${e}[ 1 ].xyz, ${e}[ 2 ].xyz )`:r===9&&s===4?`${this.getType(n)}( ${e}[ 0 ].xy, ${e}[ 1 ].xy )`:r>4||s>4||s===0?e:r===s?`${this.getType(n)}( ${e} )`:r>s?(e=n==="bool"?`all( ${e} )`:`${e}.${"xyz".slice(0,s)}`,this.format(e,this.getTypeFromLength(s,this.getComponentType(t)),n)):s===4&&r>1?`${this.getType(n)}( ${this.format(e,t,"vec3")}, 1.0 )`:r===2?`${this.getType(n)}( ${this.format(e,t,"vec2")}, 0.0 )`:(r===1&&s>1&&t!==this.getComponentType(n)&&(e=`${this.getType(this.getComponentType(n))}( ${e} )`),`${this.getType(n)}( ${e} )`)}getSignature(){return`// Three.js r${"185"} - Node System4166-`}needsPreviousData(){let e=this.renderer.getMRT();return e&&e.has("velocity")||Zte(this.object).useVelocity===!0}},q4=class{constructor(){this.time=0,this.deltaTime=0,this.frameId=0,this.renderId=0,this.updateMap=new WeakMap,this.updateBeforeMap=new WeakMap,this.updateAfterMap=new WeakMap,this.renderer=null,this.material=null,this.camera=null,this.object=null,this.scene=null}_getMaps(e,t){let n=e.get(t);return n===void 0&&(n={renderId:0,frameId:0},e.set(t,n)),n}updateBeforeNode(e){let t=e.getUpdateBeforeType(),n=e.updateReference(this);if(t===yn.FRAME){let r=this._getMaps(this.updateBeforeMap,n);if(r.frameId!==this.frameId){let s=r.frameId;r.frameId=this.frameId,e.updateBefore(this)===!1&&(r.frameId=s)}}else if(t===yn.RENDER){let r=this._getMaps(this.updateBeforeMap,n);if(r.renderId!==this.renderId){let s=r.renderId;r.renderId=this.renderId,e.updateBefore(this)===!1&&(r.renderId=s)}}else t===yn.OBJECT&&e.updateBefore(this)}updateAfterNode(e){let t=e.getUpdateAfterType(),n=e.updateReference(this);if(t===yn.FRAME){let r=this._getMaps(this.updateAfterMap,n);r.frameId!==this.frameId&&e.updateAfter(this)!==!1&&(r.frameId=this.frameId)}else if(t===yn.RENDER){let r=this._getMaps(this.updateAfterMap,n);r.renderId!==this.renderId&&e.updateAfter(this)!==!1&&(r.renderId=this.renderId)}else t===yn.OBJECT&&e.updateAfter(this)}updateNode(e){let t=e.getUpdateType(),n=e.updateReference(this);if(t===yn.FRAME){let r=this._getMaps(this.updateMap,n);r.frameId!==this.frameId&&e.update(this)!==!1&&(r.frameId=this.frameId)}else if(t===yn.RENDER){let r=this._getMaps(this.updateMap,n);r.renderId!==this.renderId&&e.update(this)!==!1&&(r.renderId=this.renderId)}else t===yn.OBJECT&&e.update(this)}update(){this.frameId++,this.lastTime===void 0&&(this.lastTime=performance.now()),this.deltaTime=(performance.now()-this.lastTime)/1e3,this.lastTime=performance.now(),this.time+=this.deltaTime}},TS=class{constructor(e,t,n=null,r="",s=!1){this.type=e,this.name=t,this.count=n,this.qualifier=r,this.isConst=s}};TS.isNodeFunctionInput=!0;var Wk=class extends ep{static get type(){return"AmbientLightNode"}constructor(e=null){super(e)}setup({context:e}){e.irradiance.addAssign(this.colorNode)}},jk=class extends ep{static get type(){return"DirectionalLightNode"}constructor(e=null){super(e)}setupDirect(){let e=this.colorNode;return{lightDirection:vV(this.light),lightColor:e}}},Xk=class extends ep{static get type(){return"HemisphereLightNode"}constructor(e=null){super(e),this.lightPositionNode=AV(e),this.lightDirectionNode=this.lightPositionNode.normalize(),this.groundColorNode=Xt(new zt).setGroup(Jt)}update(e){let{light:t}=this;super.update(e),this.lightPositionNode.object3d=t,this.groundColorNode.value.copy(t.groundColor).multiplyScalar(t.intensity)}setup(e){let{colorNode:t,groundColorNode:n,lightDirectionNode:r}=this,o=Tm.dot(r).mul(.5).add(.5),a=Qn(n,t,o);e.context.irradiance.addAssign(a)}},ES=class extends ep{static get type(){return"SpotLightNode"}constructor(e=null){super(e),this.coneCosNode=Xt(0).setGroup(Jt),this.penumbraCosNode=Xt(0).setGroup(Jt),this.cutoffDistanceNode=Xt(0).setGroup(Jt),this.decayExponentNode=Xt(0).setGroup(Jt),this.colorNode=Xt(this.color).setGroup(Jt)}update(e){super.update(e);let{light:t}=this;this.coneCosNode.value=Math.cos(t.angle),this.penumbraCosNode.value=Math.cos(t.angle*(1-t.penumbra)),this.cutoffDistanceNode.value=t.distance,this.decayExponentNode.value=t.decay}getSpotAttenuation(e,t){let{coneCosNode:n,penumbraCosNode:r}=this;return pc(n,r,t)}getLightCoord(e){let t=e.getNodeProperties(this),n=t.projectionUV;return n===void 0&&(n=Nse(this.light,e.context.positionWorld),t.projectionUV=n),n}setupDirect(e){let{colorNode:t,cutoffDistanceNode:n,decayExponentNode:r,light:s}=this,o=this.getLightVector(e),a=o.normalize(),l=a.dot(vV(s)),c=this.getSpotAttenuation(e,l),u=o.length(),f=xV({lightDistance:u,cutoffDistance:n,decayExponent:r}),d=t.mul(c).mul(f),A,y;return s.colorNode?(y=this.getLightCoord(e),A=s.colorNode(y)):s.map&&(y=this.getLightCoord(e),A=fi(s.map,y.xy).onRenderUpdate(()=>s.map)),A&&(d=y.mul(2).sub(1).abs().lessThan(1).all().select(d.mul(A),d)),{lightColor:d,lightDirection:a}}},$k=class extends ES{static get type(){return"IESSpotLightNode"}constructor(e=null){super(e),this._iesTextureNode=null}getSpotAttenuation(e,t){let n=this.light.iesMap,r=null;if(n&&n.isTexture===!0){let s=t.acos().mul(1/Math.PI);this._iesTextureNode=fi(n,dt(s,0),0),r=this._iesTextureNode.r}else r=super.getSpotAttenuation(e,t);return r}update(e){super.update(e),this._iesTextureNode!==null&&this.light.iesMap&&(this._iesTextureNode.value=this.light.iesMap)}},Yk=class extends ep{static get type(){return"LightProbeNode"}constructor(e=null){super(e);let t=[];for(let n=0;n<9;n++)t.push(new re);this.lightProbe=Xo(t)}update(e){let{light:t}=this;super.update(e);for(let n=0;n<9;n++)this.lightProbe.array[n].copy(t.sh.coefficients[n]).multiplyScalar(t.intensity)}setup(e){let t=noe(Tm,this.lightProbe);e.context.irradiance.addAssign(t)}},WIe=me(([i,e])=>{let t=i.abs().sub(e);return xf(zr(t,0)).add(Il(zr(t.x,t.y),0))}),Zk=class extends ES{static get type(){return"ProjectorLightNode"}update(e){super.update(e);let t=this.light;if(this.penumbraCosNode.value=Math.min(Math.cos(t.angle*(1-t.penumbra)),.99999),t.aspect===null){let n=1;t.map!==null&&(n=t.map.width/t.map.height),t.shadow.aspect=n}else t.shadow.aspect=t.aspect}getSpotAttenuation(e){let t=oe(0),n=this.penumbraCosNode,r=OI(this.light).mul(e.context.positionWorld||yf);return $t(r.w.greaterThan(0),()=>{let s=r.xyz.div(r.w),o=WIe(s.xy.sub(dt(.5)),dt(.5)),a=dc(-1,ai(1,pz(n)).sub(1));t.assign(bI(o.mul(-2).mul(a)))}),t}},ZO=new cn,LR=new cn,Ww=null,Kk=class extends ep{static get type(){return"RectAreaLightNode"}constructor(e=null){super(e),this.halfHeight=Xt(new re).setGroup(Jt),this.halfWidth=Xt(new re).setGroup(Jt),this.updateType=yn.RENDER}update(e){super.update(e);let{light:t}=this,n=e.camera.matrixWorldInverse;LR.identity(),ZO.copy(t.matrixWorld),ZO.premultiply(n),LR.extractRotation(ZO),this.halfWidth.value.set(t.width*.5,0,0),this.halfHeight.value.set(0,t.height*.5,0),this.halfWidth.value.applyMatrix4(LR),this.halfHeight.value.applyMatrix4(LR)}setupDirectRectArea(e){let t,n;e.isAvailable("float32Filterable")?(t=fi(Ww.LTC_FLOAT_1),n=fi(Ww.LTC_FLOAT_2)):(t=fi(Ww.LTC_HALF_1),n=fi(Ww.LTC_HALF_2));let{colorNode:r,light:s}=this,o=gV(s);return{lightColor:r,lightPosition:o,halfWidth:this.halfWidth,halfHeight:this.halfHeight,ltc_1:t,ltc_2:n}}static setLTC(e){Ww=e}},H4=class{parseFunction(){Xe("Abstract function.")}},MS=class{constructor(e,t,n="",r=""){this.type=e,this.inputs=t,this.name=n,this.precision=r}getCode(){Xe("Abstract function.")}};MS.isNodeFunction=!0;var jIe=/^\s*(highp|mediump|lowp)?\s*([a-z_0-9]+)\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)/i,XIe=/[a-z_0-9]+/ig,xte="#pragma main",$Ie=i=>{i=i.trim();let e=i.indexOf(xte),t=e!==-1?i.slice(e+xte.length):i,n=t.match(jIe);if(n!==null&&n.length===5){let r=n[4],s=[],o=null;for(;(o=XIe.exec(r))!==null;)s.push(o);let a=[],l=0;for(;l<s.length;){let y=s[l][0]==="const";y===!0&&l++;let w=s[l][0];w==="in"||w==="out"||w==="inout"?l++:w="";let S=s[l++][0],T=Number.parseInt(s[l][0]);Number.isNaN(T)===!1?l++:T=null;let R=s[l++][0];a.push(new TS(S,R,T,w,y))}let c=t.substring(n[0].length),u=n[3]!==void 0?n[3]:"",f=n[2],d=n[1]!==void 0?n[1]:"",A=e!==-1?i.slice(0,e):"";return{type:f,inputs:a,name:u,precision:d,inputsCode:r,blockCode:c,headerCode:A}}else throw new Error("THREE.FunctionNode: Function is not a GLSL code.")},Qk=class extends MS{constructor(e){let{type:t,inputs:n,name:r,precision:s,inputsCode:o,blockCode:a,headerCode:l}=$Ie(e);super(t,n,r,s),this.inputsCode=o,this.blockCode=a,this.headerCode=l}getCode(e=this.name){let t,n=this.blockCode;if(n!==""){let{type:r,inputsCode:s,headerCode:o,precision:a}=this,l=`${r} ${e} ( ${s.trim()} )`;a!==""&&(l=`${a} ${l}`),t=o+l+n}else t="";return t}},Jk=class extends H4{parseFunction(e){return new Qk(e)}},Kc=[],Hd=[],yte=Xt(0,"int").setGroup(Jt),e9=class extends Mf{constructor(e,t){super(),this.renderer=e,this.backend=t,this.nodeFrame=new q4,this.nodeBuilderCache=new Map,this.callHashCache=new Ef,this.groupsData=new Ef,this._buildQueue=[],this._buildInProgress=!1,this.cacheLib={}}updateGroup(e){let t=e.groupNode;if(t.updateType===yn.OBJECT)return!0;Kc[0]=t,Kc[1]=e;let n=this.groupsData.get(Kc);return n===void 0&&this.groupsData.set(Kc,n={}),Kc[0]=null,Kc[1]=null,n.version!==t.version?(n.version=t.version,!0):!1}getForRenderCacheKey(e){return e.initialCacheKey}_createNodeBuilder(e,t){let n=this.backend.createNodeBuilder(e.object,this.renderer);return n.scene=e.scene,n.material=t,n.camera=e.camera,n.context.material=t,n.lightsNode=e.lightsNode,n.environmentNode=this.getEnvironmentNode(e.scene),n.fogNode=this.getFogNode(e.scene),n.clippingContext=e.clippingContext,this.renderer.getOutputRenderTarget()&&this.renderer.getOutputRenderTarget().multiview&&n.enableMultiview(),n}getForRender(e,t=!1){let n=this.get(e),r=n.nodeBuilderState;if(r===void 0){let{nodeBuilderCache:s}=this,o=this.getForRenderCacheKey(e);if(r=s.get(o),r===void 0){let a=async()=>{let l=this._createNodeBuilder(e,e.material);try{t?await l.buildAsync():l.build()}catch(c){l=this._createNodeBuilder(e,new Ir),t?await l.buildAsync():l.build(),ze("TSL: "+c)}return l};if(t)return a().then(l=>(r=this._createNodeBuilderState(l),s.set(o,r),r.usedTimes++,n.nodeBuilderState=r,r));{let l=this._createNodeBuilder(e,e.material);try{l.build()}catch(c){l=this._createNodeBuilder(e,new Ir),l.build();let u=c.stackTrace;!u&&c.stack&&(u=new es(c.stack)),ze("TSL: "+c,u)}r=this._createNodeBuilderState(l),s.set(o,r)}}r.usedTimes++,n.nodeBuilderState=r}return r}getForRenderAsync(e){let t=this.getForRender(e,!0);return t.then?t:Promise.resolve(t)}getForRenderDeferred(e){let t=this.get(e);if(t.nodeBuilderState!==void 0)return t.nodeBuilderState;let n=this.getForRenderCacheKey(e),r=this.nodeBuilderCache.get(n);return r!==void 0?(r.usedTimes++,t.nodeBuilderState=r,r):(t.pendingBuild!==!0&&(t.pendingBuild=!0,this._buildQueue.push(()=>this.getForRenderAsync(e).then(()=>{t.pendingBuild=!1})),this._processBuildQueue()),null)}_processBuildQueue(){if(this._buildInProgress||this._buildQueue.length===0)return;this._buildInProgress=!0,this._buildQueue.shift()().then(()=>{this._buildInProgress=!1,this._processBuildQueue()})}delete(e){if(e.isRenderObject){let t=this.get(e).nodeBuilderState;t!==void 0&&(t.usedTimes--,t.usedTimes===0&&this.nodeBuilderCache.delete(this.getForRenderCacheKey(e)))}return super.delete(e)}getForCompute(e){let t=this.get(e),n=t.nodeBuilderState;if(n===void 0||t.version!==e.version){let r=this.backend.createNodeBuilder(e,this.renderer);r.build(),n=this._createNodeBuilderState(r),t.nodeBuilderState=n,t.version=e.version}return n}_createNodeBuilderState(e){return new Sk(e.vertexShader,e.fragmentShader,e.computeShader,e.getAttributesArray(),e.getBindings(),e.updateNodes,e.updateBeforeNodes,e.updateAfterNodes,e.observer,e.hardwareClipping,e.transforms)}getEnvironmentNode(e){if(this.renderer.lighting.enabled===!1)return null;this.updateEnvironment(e);let t=null;if(e.environmentNode&&e.environmentNode.isNode)t=e.environmentNode;else{let n=this.get(e);n.environmentNode&&(t=n.environmentNode)}return t}getBackgroundNode(e){this.updateBackground(e);let t=null;if(e.backgroundNode&&e.backgroundNode.isNode)t=e.backgroundNode;else{let n=this.get(e);n.backgroundNode&&(t=n.backgroundNode)}return t}getFogNode(e){return this.updateFog(e),e.fogNode||this.get(e).fogNode||null}getCacheKey(e,t){Kc[0]=e,Kc[1]=t;let n=this.renderer.info.calls,r=this.callHashCache.get(Kc)||{};if(r.callId!==n){if(Hd.push(this.renderer.getOutputRenderTarget()&&this.renderer.getOutputRenderTarget().multiview?1:0),Hd.push(this.renderer.lighting.enabled?1:0),this.renderer.lighting.enabled){Hd.push(t.getCacheKey(!0)),Hd.push(this.renderer.shadowMap.enabled?1:0),Hd.push(this.renderer.shadowMap.type);let o=this.getEnvironmentNode(e);o&&Hd.push(o.getCacheKey())}let s=this.getFogNode(e);s&&Hd.push(s.getCacheKey()),r.callId=n,r.cacheKey=PS(Hd),this.callHashCache.set(Kc,r),Hd.length=0}return Kc[0]=null,Kc[1]=null,r.cacheKey}get isToneMappingState(){return!this.renderer.getRenderTarget()}updateBackground(e){let t=this.get(e),n=e.background;if(n){let r=e.backgroundBlurriness===0&&t.backgroundBlurriness>0||e.backgroundBlurriness>0&&t.backgroundBlurriness===0;if(t.background!==n||r){let s=this.getCacheNode("background",n,()=>{if(n.isCubeTexture===!0||n.mapping===m0||n.mapping===A0||n.mapping===Uh){if(e.backgroundBlurriness>0||n.mapping===Uh)return uV(n);{let o;return n.isCubeTexture===!0?o=Ka(n):o=fi(n),Kre(o)}}else{if(n.isTexture===!0)return fi(n,ju.flipY()).setUpdateMatrix(!0);n.isColor!==!0&&ze("WebGPUNodes: Unsupported background configuration.",n)}},r);t.backgroundNode=s,t.background=n,t.backgroundBlurriness=e.backgroundBlurriness}}else t.backgroundNode&&(delete t.backgroundNode,delete t.background)}getCacheNode(e,t,n,r=!1){let s=this.cacheLib[e]||(this.cacheLib[e]=new WeakMap),o=s.get(t);return(o===void 0||r)&&(o=n(),s.set(t,o)),o}updateFog(e){let t=this.get(e),n=e.fog;if(n){if(t.fog!==n){let r=this.getCacheNode("fog",n,()=>{if(n.isFogExp2){let s=mr("color","color",n).setGroup(Jt),o=mr("density","float",n).setGroup(Jt);return pk(s,Dse(o))}else if(n.isFog){let s=mr("color","color",n).setGroup(Jt),o=mr("near","float",n).setGroup(Jt),a=mr("far","float",n).setGroup(Jt);return pk(s,Lse(o,a))}else ze("Renderer: Unsupported fog configuration.",n)});t.fogNode=r,t.fog=n}}else delete t.fogNode,delete t.fog}updateEnvironment(e){let t=this.get(e),n=e.environment;if(n){if(t.environment!==n){let r=this.getCacheNode("environment",n,()=>{if(n.isCubeTexture===!0)return Ka(n);if(n.isTexture===!0)return fi(n);ze("Nodes: Unsupported environment configuration.",n)});t.environmentNode=r,t.environment=n}}else t.environmentNode&&(delete t.environmentNode,delete t.environment)}getNodeFrame(e=this.renderer,t=null,n=null,r=null,s=null){let o=this.nodeFrame;return o.renderer=e,o.scene=t,o.object=n,o.camera=r,o.material=s,o}getNodeFrameForRender(e){return this.getNodeFrame(e.renderer,e.scene,e.object,e.camera,e.material)}getOutputCacheKey(){let e=this.renderer;return e.toneMapping+","+e.currentColorSpace+","+e.xr.isPresenting}getOutputNode(e){let t=this.renderer,n;return e.isArrayTexture?this.backend.isWebGLBackend?n=fi(e,ju).depth(ip("gl_ViewID_OVR")).renderOutput(t.toneMapping,t.currentColorSpace):n=fi(e,ju).depth(yte).renderOutput(t.toneMapping,t.currentColorSpace):n=fi(e,ju).renderOutput(t.toneMapping,t.currentColorSpace),n}setOutputLayerIndex(e){yte.value=e}updateBefore(e){let t=e.getNodeBuilderState();for(let n of t.updateBeforeNodes)this.getNodeFrameForRender(e).updateBeforeNode(n)}updateAfter(e){let t=e.getNodeBuilderState();for(let n of t.updateAfterNodes)this.getNodeFrameForRender(e).updateAfterNode(n)}updateForCompute(e){let t=this.getNodeFrame(),n=this.getForCompute(e);for(let r of n.updateNodes)t.updateNode(r)}updateForRender(e){let t=this.getNodeFrameForRender(e),n=e.getNodeBuilderState();for(let r of n.updateNodes)t.updateNode(r)}needsRefresh(e){let t=this.getNodeFrameForRender(e);return e.getMonitor().needsRefresh(e,t)}dispose(){super.dispose(),this.nodeFrame=new q4,this.nodeBuilderCache=new Map,this.cacheLib={}}},KO=new Da,W4=class i{constructor(e=null){this.version=0,this.clipIntersection=null,this.cacheKey="",this.shadowPass=!1,this.viewMatrix=new cn,this.viewNormalMatrix=new Mn,this.clippingGroupContexts=new WeakMap,this.intersectionPlanes=[],this.unionPlanes=[],this.parentVersion=null,e!==null&&(this.viewMatrix=e.viewMatrix,this.viewNormalMatrix=e.viewNormalMatrix,this.clippingGroupContexts=e.clippingGroupContexts,this.shadowPass=e.shadowPass)}projectPlanes(e,t,n){let r=e.length;for(let s=0;s<r;s++){KO.copy(e[s]).applyMatrix4(this.viewMatrix,this.viewNormalMatrix);let o=t[n+s],a=KO.normal;o.x=-a.x,o.y=-a.y,o.z=-a.z,o.w=KO.constant}}updateGlobal(e,t){this.shadowPass=e.overrideMaterial!==null&&e.overrideMaterial.isShadowPassMaterial,this.viewMatrix.copy(t.matrixWorldInverse),this.viewNormalMatrix.getNormalMatrix(this.viewMatrix)}update(e,t){let n=!1;e.version!==this.parentVersion&&(this.intersectionPlanes=Array.from(e.intersectionPlanes),this.unionPlanes=Array.from(e.unionPlanes),this.parentVersion=e.version),this.clipIntersection!==t.clipIntersection&&(this.clipIntersection=t.clipIntersection,this.clipIntersection?this.unionPlanes.length=e.unionPlanes.length:this.intersectionPlanes.length=e.intersectionPlanes.length);let r=t.clippingPlanes,s=r.length,o,a;if(this.clipIntersection?(o=this.intersectionPlanes,a=e.intersectionPlanes.length):(o=this.unionPlanes,a=e.unionPlanes.length),o.length!==a+s){o.length=a+s;for(let l=0;l<s;l++)o[a+l]=new xn;n=!0}this.projectPlanes(r,o,a),n&&(this.version++,this.cacheKey=`${this.intersectionPlanes.length}:${this.unionPlanes.length}`)}getGroupContext(e){if(this.shadowPass&&!e.clipShadows)return this;let t=this.clippingGroupContexts.get(e);return t===void 0&&(t=new i(this),this.clippingGroupContexts.set(e,t)),t.update(this,e),t}get unionClippingCount(){return this.unionPlanes.length}},t9=class{constructor(e,t,n){this.bundleGroup=e,this.camera=t,this.renderContext=n}},nm=[],n9=class{constructor(){this.bundles=new Ef}get(e,t,n){let r=this.bundles;nm[0]=e,nm[1]=t,nm[2]=n;let s=r.get(nm);return s===void 0&&(s=new t9(e,t,n),r.set(nm,s)),nm[0]=null,nm[1]=null,nm[2]=null,s}dispose(){this.bundles=new Ef}},j4=class{constructor(){this.lightNodes=new WeakMap,this.materialNodes=new Map,this.toneMappingNodes=new Map}fromMaterial(e){if(e.isNodeMaterial)return e;let t=null,n=this.getMaterialNodeClass(e.type);if(n!==null){t=new n;for(let r in e)t[r]=e[r]}return t}addToneMapping(e,t){this.addType(e,t,this.toneMappingNodes)}getToneMappingFunction(e){return this.toneMappingNodes.get(e)||null}getMaterialNodeClass(e){return this.materialNodes.get(e)||null}addMaterial(e,t){this.addType(e,t,this.materialNodes)}getLightNodeClass(e){return this.lightNodes.get(e)||null}addLight(e,t){this.addClass(e,t,this.lightNodes)}addType(e,t,n){if(n.has(t)){Xe(`Redefinition of node ${t}`);return}if(typeof e!="function")throw new Error(`THREE.NodeLibrary: Node class ${e.name} is not a class.`);if(typeof t=="function"||typeof t=="object")throw new Error(`THREE.NodeLibrary: Base class ${t} is not a class.`);n.set(t,e)}addClass(e,t,n){if(n.has(t)){Xe(`Redefinition of node ${t.name}`);return}if(typeof e!="function")throw new Error(`THREE.NodeLibrary: Node class ${e.name} is not a class.`);if(typeof t!="function")throw new Error(`THREE.NodeLibrary: Base class ${t.name} is not a class.`);n.set(t,e)}},YIe=new wS,bte=new WeakMap,i9=class{constructor(){this.enabled=!0,this._cache=[]}createNode(e=[]){return new wS().setLights(e)}getNode(e){if(e.isScene!==!0&&e.isGroup!==!0)return YIe;let t=bte.get(e);return t===void 0&&(t=this.createNode(),bte.set(e,t)),t}beginRender(e){this._cache.push(this.getNode(e).getLights())}finishRender(e){this.getNode(e).setLights(this._cache.pop())}},jg=class extends Fa{constructor(e=1,t=1,n={}){super(e,t,n),this.isXRRenderTarget=!0,this._hasExternalTextures=!1,this._autoAllocateDepthBuffer=!0,this._isOpaqueFramebuffer=!1}copy(e){return super.copy(e),this._hasExternalTextures=e._hasExternalTextures,this._autoAllocateDepthBuffer=e._autoAllocateDepthBuffer,this._isOpaqueFramebuffer=e._isOpaqueFramebuffer,this}},wte=new re,Ste=new re,Tte=new WeakMap,r9=class extends la{constructor(e,t=!1){super(),this.enabled=!1,this.isPresenting=!1,this.cameraAutoUpdate=!0,this._renderer=e,this._cameraL=new $r,this._cameraL.viewport=new xn,this._cameraL.matrixWorldAutoUpdate=!1,this._cameraR=new $r,this._cameraR.viewport=new xn,this._cameraR.matrixWorldAutoUpdate=!1,this._cameras=[this._cameraL,this._cameraR],this._cameraXR=new a_,this._currentDepthNear=null,this._currentDepthFar=null,this._controllers=[],this._controllerInputSources=[],this._xrRenderTarget=null,this._layers=[],this._sessionUsesLayers=!1,this._supportsGlBinding=typeof XRWebGLBinding<"u",this._supportsWebGPUBinding=typeof globalThis.XRGPUBinding<"u",this._createXRLayer=tPe.bind(this),this._gl=null,this._currentAnimationContext=null,this._currentAnimationLoop=null,this._currentPixelRatio=null,this._currentSamples=null,this._currentSize=new Oe,this._onSessionEvent=QIe.bind(this),this._onSessionEnd=JIe.bind(this),this._onInputSourcesChange=ePe.bind(this),this._onAnimationFrame=nPe.bind(this),this._referenceSpace=null,this._referenceSpaceType="local-floor",this._customReferenceSpace=null,this._framebufferScaleFactor=1,this._foveation=1,this._session=null,this._glBaseLayer=null,this._glBinding=null,this._webgpuBinding=null,this._glProjLayer=null,this._xrFrame=null,this._supportsLayers=this._supportsGlBinding&&"createProjectionLayer"in XRWebGLBinding.prototype,this._useMultiviewIfPossible=t,this._useMultiview=!1}getController(e){return this._getController(e).getTargetRaySpace()}getControllerGrip(e){return this._getController(e).getGripSpace()}getHand(e){return this._getController(e).getHandSpace()}getFoveation(){return this._foveation}setFoveation(e){this._foveation=e,this._glProjLayer!==null&&(this._glProjLayer.fixedFoveation=e),this._glBaseLayer!==null&&this._glBaseLayer.fixedFoveation!==void 0&&(this._glBaseLayer.fixedFoveation=e)}getFramebufferScaleFactor(){return this._framebufferScaleFactor}setFramebufferScaleFactor(e){this._framebufferScaleFactor=e,this.isPresenting===!0&&Xe("XRManager: Cannot change framebuffer scale while presenting.")}getReferenceSpaceType(){return this._referenceSpaceType}setReferenceSpaceType(e){this._referenceSpaceType=e,this.isPresenting===!0&&Xe("XRManager: Cannot change reference space type while presenting.")}getReferenceSpace(){return this._customReferenceSpace||this._referenceSpace}setReferenceSpace(e){this._customReferenceSpace=e}getCamera(){return this._cameraXR}getEnvironmentBlendMode(){if(this._session!==null)return this._session.environmentBlendMode}getBaseLayer(){return this._glProjLayer!==null?this._glProjLayer:this._glBaseLayer}getBinding(){return this._glBinding===null&&this._supportsGlBinding&&(this._glBinding=new XRWebGLBinding(this._session,this._gl)),this._glBinding}foveateBoundTexture(e){if(e.isPostProcessingRenderTarget!==!0||this.isPresenting!==!0||this._glProjLayer===null)return;let t=this._renderer.backend;if(t===void 0||t.isWebGLBackend!==!0||t.state===null)return;let n=this._renderer.getOutputRenderTarget();if(n===null||n.isXRRenderTarget!==!0)return;let r=this.getBinding();if(r===null||typeof r.foveateBoundTexture!="function")return;this._renderer._textures.updateRenderTarget(e);let{textureGPU:s,glTextureType:o}=t.get(e.texture);if(!(s===void 0||o===void 0)&&e._xrFoveationTextureGPU!==s){e._xrFoveationTextureGPU=s,t.state.bindTexture(o,s);try{r.foveateBoundTexture(o,this.getFoveation())}catch(a){ni(`XRManager: Unable to foveate bound XR post-processing texture. ${a.name}: ${a.message}`)}finally{t.state.unbindTexture()}}}getWebGPUBinding(){return this._webgpuBinding===null&&this._supportsWebGPUBinding&&(this._webgpuBinding=new globalThis.XRGPUBinding(this._session,this._renderer.backend.device)),this._webgpuBinding}_isWebGPUSession(){return this._renderer.backend.isWebGPUBackend===!0&&this._session!==null&&this._session.enabledFeatures.includes("webgpu")}_validateWebGPUSession(){let e=this._renderer;if(e.backend.isWebGPUBackend===!0){if(this._session.enabledFeatures.includes("webgpu")===!1)throw new Error('THREE.XRManager: WebGPU XR sessions require the "webgpu" session feature. Use VRButtonGPU/XRButton with "webgpu" enabled or use a WebGL backend.');e.samples>0&&(ni("THREE.XRManager: WebGPU XR does not support MSAA yet. Disabling MSAA for this XR session."),this._currentSamples===null&&(this._currentSamples=e.samples),e._samples=0)}}async _initWebGPUSession(e){let t=this.getWebGPUBinding(),n=t.createProjectionLayer({colorFormat:t.getPreferredColorFormat(),depthStencilFormat:"depth24plus"});this._glProjLayer=n,e.updateRenderState({layers:[n]}),this._referenceSpace=await e.requestReferenceSpace(this.getReferenceSpaceType()),this._xrRenderTarget=new Fa(n.textureWidth,n.textureHeight,{depth:2,minFilter:Mi,magFilter:Mi,depthBuffer:!0,multiview:!1,useArrayDepthTexture:!0,samples:0}),this._xrRenderTarget.texture.isArrayTexture=!0,this._useMultiviewIfPossible===!0&&ni("THREE.XRManager: WebGPU XR does not support multiview yet. Disabling multiview for this XR session."),this._useMultiview=!1}_disposeWebGPUSession(){let e=this._renderer,t=this._xrRenderTarget;if(t===null||e.backend.isWebGPUBackend!==!0)return;let n=e.backend,r=e._textures,s=n.get?n.get(t):null;s&&(s.descriptors=void 0);let o=a=>{a!=null&&(n.delete&&n.delete(a),r.delete&&r.delete(a))};for(let a=0;a<t.textures.length;a++)o(t.textures[a]);o(t.depthTexture),o(t),e._renderContexts&&e._renderContexts.dispose&&e._renderContexts.dispose(),t.dispose()}_getWebGPUViewData(e){let t=this.getWebGPUBinding(),n={colorTexture:null,viewDescriptors:[],viewports:[]};for(let r=0;r<e.length;r++){let s=t.getViewSubImage(this._glProjLayer,e[r]);n.colorTexture===null&&(n.colorTexture=s.colorTexture),n.viewports.push(s.viewport),s.getViewDescriptor&&n.viewDescriptors.push(s.getViewDescriptor())}return n}getFrame(){return this._xrFrame}useMultiview(){return this._useMultiview}createQuadLayer(e,t,n,r,s,o,a,l={}){let c=new KA(e,t),u=new jg(s,o,{format:Or,type:Ji,depthTexture:new Cs(s,o,l.stencil?ca:xi,void 0,void 0,void 0,void 0,void 0,void 0,l.stencil?xo:Gs),stencilBuffer:l.stencil,resolveDepthBuffer:!1,resolveStencilBuffer:!1});u._autoAllocateDepthBuffer=!0;let f=new fs({color:16777215,side:ko});f.map=u.texture,f.map.offset.y=1,f.map.repeat.y=-1;let d=new Hn(c,f);d.position.copy(n),d.quaternion.copy(r);let A={type:"quad",width:e,height:t,translation:n,quaternion:r,pixelwidth:s,pixelheight:o,plane:d,material:f,rendercall:a,renderTarget:u};if(this._layers.push(A),this._session!==null){A.plane.material=new fs({color:16777215,side:ko}),A.plane.material.blending=Fd,A.plane.material.blendEquation=oo,A.plane.material.blendSrc=Nu,A.plane.material.blendDst=Nu,A.xrlayer=this._createXRLayer(A);let y=this._session.renderState.layers;y.unshift(A.xrlayer),this._session.updateRenderState({layers:y})}else u.isXRRenderTarget=!1;return d}createCylinderLayer(e,t,n,r,s,o,a,l,c={}){let u=new $A(e,e,e*t/n,64,64,!0,Math.PI-t/2,t),f=new jg(o,a,{format:Or,type:Ji,depthTexture:new Cs(o,a,c.stencil?ca:xi,void 0,void 0,void 0,void 0,void 0,void 0,c.stencil?xo:Gs),stencilBuffer:c.stencil,resolveDepthBuffer:!1,resolveStencilBuffer:!1});f._autoAllocateDepthBuffer=!0;let d=new fs({color:16777215,side:mi});d.map=f.texture,d.map.offset.y=1,d.map.repeat.y=-1;let A=new Hn(u,d);A.position.copy(r),A.quaternion.copy(s);let y={type:"cylinder",radius:e,centralAngle:t,aspectratio:n,translation:r,quaternion:s,pixelwidth:o,pixelheight:a,plane:A,material:d,rendercall:l,renderTarget:f};if(this._layers.push(y),this._session!==null){y.plane.material=new fs({color:16777215,side:mi}),y.plane.material.blending=Fd,y.plane.material.blendEquation=oo,y.plane.material.blendSrc=Nu,y.plane.material.blendDst=Nu,y.xrlayer=this._createXRLayer(y);let w=this._session.renderState.layers;w.unshift(y.xrlayer),this._session.updateRenderState({layers:w})}else f.isXRRenderTarget=!1;return A}renderLayers(){let e=new re,t=new qs,n=this._renderer,r=this.isPresenting;this.isPresenting=!1;let s=new Oe;n.getSize(s);let o=n.getRenderTarget();for(let a of this._layers){a.renderTarget.isXRRenderTarget=this._session!==null,a.renderTarget._hasExternalTextures=a.renderTarget.isXRRenderTarget;let l=n.contextNode,c;if(a.renderTarget.isXRRenderTarget&&this._sessionUsesLayers){a.xrlayer.transform=new XRRigidTransform(a.plane.getWorldPosition(e),a.plane.getWorldQuaternion(t));let u=this._glBinding.getSubImage(a.xrlayer,this._xrFrame);n.backend.setXRRenderTargetTextures(a.renderTarget,u.colorTexture,void 0),n._setXRLayerSize(a.renderTarget.width,a.renderTarget.height),c=Tte.get(l),c===void 0&&(c=l.context({getOutput:f=>Fz(f,n.toneMapping,n.outputColorSpace)}),Tte.set(l,c))}else c=l;n.contextNode=c,n.setRenderTarget(a.renderTarget),a.rendercall(),n.contextNode=l}n.setRenderTarget(o),n._setXRLayerSize(s.x,s.y),this.isPresenting=r}getSession(){return this._session}async setSession(e){let t=this._renderer;t.initialized===!1&&await t.init(),this._gl=t.getContext();let n=this._gl;if(this._session=e,e!==null){if(e.addEventListener("select",this._onSessionEvent),e.addEventListener("selectstart",this._onSessionEvent),e.addEventListener("selectend",this._onSessionEvent),e.addEventListener("squeeze",this._onSessionEvent),e.addEventListener("squeezestart",this._onSessionEvent),e.addEventListener("squeezeend",this._onSessionEvent),e.addEventListener("end",this._onSessionEnd),e.addEventListener("inputsourceschange",this._onInputSourcesChange),this._validateWebGPUSession(),this._currentPixelRatio=t.getPixelRatio(),t.getSize(this._currentSize),this._currentAnimationContext=t._animation.getContext(),this._currentAnimationLoop=t._animation.getAnimationLoop(),t._animation.stop(),this._isWebGPUSession())await this._initWebGPUSession(e);else if(this._supportsLayers===!0){let r=null,s=null,o=null,a=n.getContextAttributes();await t.backend.makeXRCompatible(),this.setFoveation(this.getFoveation()),t.depth&&(o=t.stencil?n.DEPTH24_STENCIL8:n.DEPTH_COMPONENT24,r=t.stencil?xo:Gs,s=t.stencil?ca:xi);let l={colorFormat:n.RGBA8,depthFormat:o,scaleFactor:this._framebufferScaleFactor,clearOnAccess:!1};this._useMultiviewIfPossible&&t.hasFeature("OVR_multiview2")&&(l.textureType="texture-array",this._useMultiview=!0),this._glBinding=this.getBinding();let c=this._glBinding.createProjectionLayer(l),u=[c];this._glProjLayer=c,t.setPixelRatio(1),t._setXRLayerSize(c.textureWidth,c.textureHeight);let f=this._useMultiview?2:1,d=new Cs(c.textureWidth,c.textureHeight,s,void 0,void 0,void 0,void 0,void 0,void 0,r,f);if(this._xrRenderTarget=new jg(c.textureWidth,c.textureHeight,{format:Or,type:Ji,colorSpace:t.outputColorSpace,depthTexture:d,stencilBuffer:t.stencil,samples:a.antialias?4:0,resolveDepthBuffer:c.ignoreDepthValues===!1,resolveStencilBuffer:c.ignoreDepthValues===!1,depth:this._useMultiview?2:1,multiview:this._useMultiview}),this._xrRenderTarget._hasExternalTextures=!0,this._xrRenderTarget.depth=this._useMultiview?2:1,this._sessionUsesLayers=e.enabledFeatures.includes("layers"),this._referenceSpace=await e.requestReferenceSpace(this.getReferenceSpaceType()),this._sessionUsesLayers)for(let A of this._layers)A.plane.material=new fs({color:16777215,side:A.type==="cylinder"?mi:ko}),A.plane.material.blending=Fd,A.plane.material.blendEquation=oo,A.plane.material.blendSrc=Nu,A.plane.material.blendDst=Nu,A.xrlayer=this._createXRLayer(A),u.unshift(A.xrlayer);e.updateRenderState({layers:u})}else{await t.backend.makeXRCompatible(),this.setFoveation(this.getFoveation());let r={antialias:t.currentSamples>0,alpha:!0,depth:t.depth,stencil:t.stencil,framebufferScaleFactor:this.getFramebufferScaleFactor()},s=new XRWebGLLayer(e,n,r);this._glBaseLayer=s,e.updateRenderState({baseLayer:s}),t.setPixelRatio(1),t._setXRLayerSize(s.framebufferWidth,s.framebufferHeight),this._xrRenderTarget=new jg(s.framebufferWidth,s.framebufferHeight,{format:Or,type:Ji,colorSpace:t.outputColorSpace,stencilBuffer:t.stencil,resolveDepthBuffer:s.ignoreDepthValues===!1,resolveStencilBuffer:s.ignoreDepthValues===!1}),this._xrRenderTarget._isOpaqueFramebuffer=!0,this._referenceSpace=await e.requestReferenceSpace(this.getReferenceSpaceType())}t._animation.setAnimationLoop(this._onAnimationFrame),t._animation.setContext(e),t._animation.start(),this.isPresenting=!0,this.dispatchEvent({type:"sessionstart"})}}updateCamera(e){let t=this._session;if(t===null)return;let n=e.near,r=e.far,s=this._cameraXR,o=this._cameraL,a=this._cameraR;s.near=a.near=o.near=n,s.far=a.far=o.far=r,s.isMultiViewCamera=this._useMultiview,(this._currentDepthNear!==s.near||this._currentDepthFar!==s.far)&&(t.updateRenderState({depthNear:s.near,depthFar:s.far}),this._currentDepthNear=s.near,this._currentDepthFar=s.far),s.layers.mask=e.layers.mask|6,o.layers.mask=s.layers.mask&-5,a.layers.mask=s.layers.mask&-3;let l=e.parent,c=s.cameras;Ete(s,l);for(let u=0;u<c.length;u++)Ete(c[u],l);c.length===2?ZIe(s,o,a):s.projectionMatrix.copy(o.projectionMatrix),KIe(e,s,l)}_getController(e){let t=this._controllers[e];return t===void 0&&(t=new s0,this._controllers[e]=t),t}};function ZIe(i,e,t){wte.setFromMatrixPosition(e.matrixWorld),Ste.setFromMatrixPosition(t.matrixWorld);let n=wte.distanceTo(Ste),r=e.projectionMatrix.elements,s=t.projectionMatrix.elements,o=r[14]/(r[10]-1),a=r[14]/(r[10]+1),l=(r[9]+1)/r[5],c=(r[9]-1)/r[5],u=(r[8]-1)/r[0],f=(s[8]+1)/s[0],d=o*u,A=o*f,y=n/(-u+f),w=y*-u;if(e.matrixWorld.decompose(i.position,i.quaternion,i.scale),i.translateX(w),i.translateZ(y),i.matrixWorld.compose(i.position,i.quaternion,i.scale),i.matrixWorldInverse.copy(i.matrixWorld).invert(),r[10]===-1)i.projectionMatrix.copy(e.projectionMatrix),i.projectionMatrixInverse.copy(e.projectionMatrixInverse);else{let S=o+y,T=a+y,R=d-w,P=A+(n-w),I=l*a/T*S,F=c*a/T*S;i.projectionMatrix.makePerspective(R,P,I,F,S,T),i.projectionMatrixInverse.copy(i.projectionMatrix).invert()}}function Ete(i,e){e===null?i.matrixWorld.copy(i.matrix):i.matrixWorld.multiplyMatrices(e.matrixWorld,i.matrix),i.matrixWorldInverse.copy(i.matrixWorld).invert()}function KIe(i,e,t){t===null?i.matrix.copy(e.matrixWorld):(i.matrix.copy(t.matrixWorld),i.matrix.invert(),i.matrix.multiply(e.matrixWorld)),i.matrix.decompose(i.position,i.quaternion,i.scale),i.updateMatrixWorld(!0),i.projectionMatrix.copy(e.projectionMatrix),i.projectionMatrixInverse.copy(e.projectionMatrixInverse),i.isPerspectiveCamera&&(i.fov=Id*2*Math.atan(1/i.projectionMatrix.elements[5]),i.zoom=1)}function QIe(i){let e=this._controllerInputSources.indexOf(i.inputSource);if(e===-1)return;let t=this._controllers[e];if(t!==void 0){let n=this.getReferenceSpace();t.update(i.inputSource,i.frame,n),t.dispatchEvent({type:i.type,data:i.inputSource})}}function JIe(){let i=this._session,e=this._renderer;i.removeEventListener("select",this._onSessionEvent),i.removeEventListener("selectstart",this._onSessionEvent),i.removeEventListener("selectend",this._onSessionEvent),i.removeEventListener("squeeze",this._onSessionEvent),i.removeEventListener("squeezestart",this._onSessionEvent),i.removeEventListener("squeezeend",this._onSessionEvent),i.removeEventListener("end",this._onSessionEnd),i.removeEventListener("inputsourceschange",this._onInputSourcesChange);for(let t=0;t<this._controllers.length;t++){let n=this._controllerInputSources[t];n!==null&&(this._controllerInputSources[t]=null,this._controllers[t].disconnect(n))}if(this._currentDepthNear=null,this._currentDepthFar=null,this._currentSamples!==null&&(e._samples=this._currentSamples,this._currentSamples=null),e._resetXRState(),this._disposeWebGPUSession(),this._session=null,this._xrRenderTarget=null,this._glBinding=null,this._webgpuBinding=null,this._glBaseLayer=null,this._glProjLayer=null,this._sessionUsesLayers===!0)for(let t of this._layers)t.renderTarget=new jg(t.pixelwidth,t.pixelheight,{format:Or,type:Ji,depthTexture:new Cs(t.pixelwidth,t.pixelheight,t.stencilBuffer?ca:xi,void 0,void 0,void 0,void 0,void 0,void 0,t.stencilBuffer?xo:Gs),stencilBuffer:t.stencilBuffer,resolveDepthBuffer:!1,resolveStencilBuffer:!1}),t.renderTarget.isXRRenderTarget=!1,t.plane.material=t.material,t.material.map=t.renderTarget.texture,t.material.map.offset.y=1,t.material.map.repeat.y=-1,delete t.xrlayer;this.isPresenting=!1,this._useMultiview=!1,e._animation.stop(),e._animation.setAnimationLoop(this._currentAnimationLoop),e._animation.setContext(this._currentAnimationContext),e._animation.start(),e.setPixelRatio(this._currentPixelRatio),e.setSize(this._currentSize.width,this._currentSize.height,!1),this.dispatchEvent({type:"sessionend"})}function ePe(i){let e=this._controllers,t=this._controllerInputSources;for(let n=0;n<i.removed.length;n++){let r=i.removed[n],s=t.indexOf(r);s>=0&&(t[s]=null,e[s].disconnect(r))}for(let n=0;n<i.added.length;n++){let r=i.added[n],s=t.indexOf(r);if(s===-1){for(let a=0;a<e.length;a++)if(a>=t.length){t.push(r),s=a;break}else if(t[a]===null){t[a]=r,s=a;break}if(s===-1)break}let o=e[s];o&&o.connect(r)}}function tPe(i){return i.type==="quad"?this._glBinding.createQuadLayer({transform:new XRRigidTransform(i.translation,i.quaternion),width:i.width/2,height:i.height/2,space:this._referenceSpace,viewPixelWidth:i.pixelwidth,viewPixelHeight:i.pixelheight,clearOnAccess:!1}):this._glBinding.createCylinderLayer({transform:new XRRigidTransform(i.translation,i.quaternion),radius:i.radius,centralAngle:i.centralAngle,aspectRatio:i.aspectRatio,space:this._referenceSpace,viewPixelWidth:i.pixelwidth,viewPixelHeight:i.pixelheight,clearOnAccess:!1})}function nPe(i,e){if(e===void 0)return;let t=this._cameraXR,n=this._renderer,r=n.backend,s=this._glBaseLayer,o=this.getReferenceSpace(),a=e.getViewerPose(o);if(this._xrFrame=e,a!==null){let l=a.views,c=this._isWebGPUSession()?this._getWebGPUViewData(l):null;this._glBaseLayer!==null&&c===null&&r.setXRTarget(s.framebuffer);let u=!1;l.length!==t.cameras.length&&(t.cameras.length=0,u=!0);for(let d=0;d<l.length;d++){let A=l[d],y;if(c!==null)y=c.viewports[d];else if(this._supportsLayers===!0){let S=this._glBinding.getViewSubImage(this._glProjLayer,A);y=S.viewport,d===0&&r.setXRRenderTargetTextures(this._xrRenderTarget,S.colorTexture,this._glProjLayer.ignoreDepthValues&&!this._useMultiview?void 0:S.depthStencilTexture)}else y=s.getViewport(A);let w=this._cameras[d];w===void 0&&(w=new $r,w.layers.enable(d),w.viewport=new xn,w.matrixWorldAutoUpdate=!1,this._cameras[d]=w),w.matrix.fromArray(A.transform.matrix),w.matrix.decompose(w.position,w.quaternion,w.scale),w.projectionMatrix.fromArray(A.projectionMatrix),w.projectionMatrixInverse.copy(w.projectionMatrix).invert(),w.viewport.set(y.x,y.y,y.width,y.height),d===0&&(t.matrix.copy(w.matrix),t.matrix.decompose(t.position,t.quaternion,t.scale)),u===!0&&t.cameras.push(w)}c!==null&&c.colorTexture!==null&&r.setXRRenderTargetTextures(this._xrRenderTarget,c.colorTexture,c.viewDescriptors),n.setOutputRenderTarget(this._xrRenderTarget);let f=n._getFrameBufferTarget();n.xr.foveateBoundTexture(f)}for(let l=0;l<this._controllers.length;l++){let c=this._controllerInputSources[l],u=this._controllers[l];c!==null&&u!==void 0&&u.update(c,e,o)}this._currentAnimationLoop&&this._currentAnimationLoop(i,e),e.detectedPlanes&&this.dispatchEvent({type:"planesdetected",data:e}),this._xrFrame=null}var s9=class extends la{constructor(e){super(),this.domElement=e,this._pixelRatio=1,this._width=this.domElement.width,this._height=this.domElement.height,this._viewport=new xn(0,0,this._width,this._height),this._scissor=new xn(0,0,this._width,this._height),this._scissorTest=!1,this.colorTexture=new XA,this.depthTexture=new Cs}getPixelRatio(){return this._pixelRatio}getDrawingBufferSize(e){return e.set(this._width*this._pixelRatio,this._height*this._pixelRatio).floor()}getSize(e){return e.set(this._width,this._height)}setPixelRatio(e=1){this._pixelRatio!==e&&(this._pixelRatio=e,this.setSize(this._width,this._height,!1))}setDrawingBufferSize(e,t,n){this.xr&&this.xr.isPresenting||(this._width=e,this._height=t,this._pixelRatio=n,this.domElement.width=Math.floor(e*n),this.domElement.height=Math.floor(t*n),this.setViewport(0,0,e,t),this._dispatchResize())}setSize(e,t,n=!0){this.xr&&this.xr.isPresenting||(this._width=e,this._height=t,this.domElement.width=Math.floor(e*this._pixelRatio),this.domElement.height=Math.floor(t*this._pixelRatio),n===!0&&(this.domElement.style.width=e+"px",this.domElement.style.height=t+"px"),this.setViewport(0,0,e,t),this._dispatchResize())}getScissor(e){let t=this._scissor;return e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height,e}setScissor(e,t,n,r){let s=this._scissor;e.isVector4?s.copy(e):s.set(e,t,n,r)}getScissorTest(){return this._scissorTest}setScissorTest(e){this._scissorTest=e}getViewport(e){return e.copy(this._viewport)}setViewport(e,t,n,r,s=0,o=1){let a=this._viewport;e.isVector4?a.copy(e):a.set(e,t,n,r),a.minDepth=s,a.maxDepth=o}_dispatchResize(){this.dispatchEvent({type:"resize"})}dispose(){this.dispatchEvent({type:"dispose"})}},Mte=new o0,W_=new Oe,QO=new xn,DR=new Gc,NR=new D2,j_=new cn,Wd=new xn,iPe={[ko]:mi,[mi]:ko,[vr]:vr},o9=class{constructor(e,t={}){this.isRenderer=!0;let{logarithmicDepthBuffer:n=!1,reversedDepthBuffer:r=!1,alpha:s=!0,depth:o=!0,stencil:a=!1,antialias:l=!1,samples:c=0,getFallback:u=null,outputBufferType:f=Wi,multiview:d=!1}=t;this.backend=e,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.alpha=s,this.logarithmicDepthBuffer=n,this.reversedDepthBuffer=r,this.outputColorSpace=Fr,this.toneMapping=ao,this.toneMappingExposure=1,this.sortObjects=!0,this.depth=o,this.stencil=a,this.info=new U7,this.contextNode=np(),this.library=new j4,this.lighting=new i9,this._samples=c||l===!0?4:0,this._onCanvasTargetResize=this._onCanvasTargetResize.bind(this),this._canvasTarget=new s9(e.getDomElement()),this._canvasTarget.addEventListener("resize",this._onCanvasTargetResize),this._canvasTarget.isDefaultCanvasTarget=!0,this._inspector=new h4,this._inspector.setRenderer(this),this._getFallback=u,this._attributes=null,this._geometries=null,this._nodes=null,this._animation=null,this._bindings=null,this._objects=null,this._pipelines=null,this._bundles=null,this._renderLists=null,this._renderContexts=null,this._textures=null,this._background=null,this._quadCache=new Map,this._currentRenderContext=null,this._opaqueSort=null,this._transparentSort=null,this._frameBufferTargets=new Map;let A=this.alpha===!0?0:1;this._clearColor=new _S(0,0,0,A),this._clearDepth=1,this._clearStencil=0,this._renderTarget=null,this._activeCubeFace=0,this._activeMipmapLevel=0,this._outputRenderTarget=null,this._mrt=null,this._renderObjectFunction=null,this._currentRenderObjectFunction=null,this._currentRenderBundle=null,this._handleObjectFunction=this._renderObjectDirect,this._isDeviceLost=!1,this.onDeviceLost=this._onDeviceLost,this.onError=this._onError,this._outputBufferType=f,this._cacheShadowNodes=new WeakMap,this._initialized=!1,this._callDepth=-1,this._initPromise=null,this._compilationPromises=null,this._currentSourceMaterial=null,this.transparent=!0,this.opaque=!0,this.shadowMap={enabled:!1,transmitted:!1,type:p0},this.xr=new r9(this,d),this.debug={checkShaderErrors:!0,onShaderError:null,getShaderAsync:async(y,w,S)=>{await this.compileAsync(S,w,y);let R=this.needsFrameBufferTarget&&this._renderTarget===null?this._getFrameBufferTarget():this._renderTarget||this._outputRenderTarget,P=this._renderLists.get(y,w),I=this._renderContexts.get(R,this._mrt),F=y.overrideMaterial||S.material,D=this._objects.get(S,F,y,w,P.lightsNode,I,I.clippingContext),{fragmentShader:L,vertexShader:C}=D.getNodeBuilderState();return{fragmentShader:L,vertexShader:C}}}}async init(){return this._initPromise!==null?this._initPromise:(this._initPromise=new Promise(async(e,t)=>{let n=this.backend;try{await n.init(this)}catch(r){if(this._getFallback!==null)try{this.backend=n=this._getFallback(r),await n.init(this)}catch(s){t(s);return}else{t(r);return}}this._nodes=new e9(this,n),this._animation=new D7(this,this._nodes,this.info),this._attributes=new B7(n,this.info),this._background=new wk(this,this._nodes),this._geometries=new O7(this._attributes,this.info),this._textures=new X7(this,n,this.info),this._pipelines=new V7(n,this._nodes,this.info),this._bindings=new G7(n,this._nodes,this._textures,this._attributes,this._pipelines,this.info),this._objects=new F7(this,this._nodes,this._geometries,this._pipelines,this._bindings,this.info),this._renderLists=new H7(this.lighting),this._bundles=new n9,this._renderContexts=new j7(this),this._animation.start(),this._initialized=!0,this._inspector.init(),e(this)}),this._initPromise)}get domElement(){return this._canvasTarget.domElement}get coordinateSystem(){return this.backend.coordinateSystem}async compileAsync(e,t,n=null){if(this._isDeviceLost===!0)return;this._initialized===!1&&await this.init();let r=this._nodes.nodeFrame,s=r.renderId,o=this._currentRenderContext,a=this._currentRenderObjectFunction,l=this._handleObjectFunction,c=this._compilationPromises;n===null&&(n=e);let u=e.isScene===!0?e:n.isScene===!0?n:Mte,d=this.needsFrameBufferTarget&&this._renderTarget===null?this._getFrameBufferTarget():this._renderTarget||this._outputRenderTarget,A=this._renderContexts.get(d,this._mrt),y=this._activeMipmapLevel,w=[];this._currentRenderContext=A,this._currentRenderObjectFunction=this.renderObject,this._handleObjectFunction=this._createObjectPipeline,this._compilationPromises=w,r.renderId++,r.update(),A.depth=this.depth,A.stencil=this.stencil,A.clippingContext||(A.clippingContext=new W4),A.clippingContext.updateGlobal(u,t),e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t=this._updateCamera(t),u.onBeforeRender(this,e,t,d);let S=t.isArrayCamera?NR:DR;t.isArrayCamera?S.setFromArrayCamera(t):(j_.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),S.setFromProjectionMatrix(j_,t.coordinateSystem,t.reversedDepth));let T=this._renderLists.get(u,t);if(T.begin(),this._projectObject(e,t,0,T,A.clippingContext),n!==e&&n.traverseVisible(function(D){D.isLight&&D.layers.test(t.layers)&&T.pushLight(D)}),T.finish(),d!==null){this._textures.updateRenderTarget(d,y);let D=this._textures.get(d);A.textures=D.textures,A.depthTexture=D.depthTexture}else A.textures=null,A.depthTexture=null;n!==e?this._background.update(n,T,A):this._background.update(u,T,A);let R=T.opaque,P=T.transparent,I=T.transparentDoublePass,F=T.lightsNode;this.opaque===!0&&R.length>0&&this._renderObjects(R,t,u,F),this.transparent===!0&&P.length>0&&this._renderTransparents(P,I,t,u,F),r.renderId=s,this._currentRenderContext=o,this._currentRenderObjectFunction=a,this._handleObjectFunction=l,this._compilationPromises=c;for(let D of w){let L=this._objects.get(D.object,D.material,D.scene,D.camera,D.lightsNode,D.renderContext,D.clippingContext,D.passId);L.drawRange=D.object.geometry.drawRange,L.group=D.group,await this._nodes.getForRenderAsync(L),this._nodes.updateBefore(L),this._geometries.updateForRender(L),this._nodes.updateForRender(L),this._bindings.updateForRender(L);let C=[];this._pipelines.getForRender(L,C),C.length>0&&await Promise.all(C),this._nodes.updateAfter(L),await iF()}}async renderAsync(e,t){ni('Renderer: "renderAsync()" has been deprecated. Use "render()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.render(e,t)}async waitForGPU(){ze("Renderer: waitForGPU() has been removed. Read https://github.com/mrdoob/three.js/issues/32012 for more information.")}set inspector(e){this._inspector!==null&&this._inspector.setRenderer(null),this._inspector=e,this._inspector.setRenderer(this)}get inspector(){return this._inspector}set highPrecision(e){let t=this.contextNode.value;e===!0?(t.modelViewMatrix=kU,t.modelNormalViewMatrix=zU):this.highPrecision&&(delete t.modelViewMatrix,delete t.modelNormalViewMatrix)}get highPrecision(){let e=this.contextNode.value;return e.modelViewMatrix===kU&&e.modelNormalViewMatrix===zU}setMRT(e){return this._mrt=e,this}getMRT(){return this._mrt}getOutputBufferType(){return this._outputBufferType}getColorBufferType(){return ni('Renderer: ".getColorBufferType()" has been renamed to ".getOutputBufferType()".'),this.getOutputBufferType()}_onDeviceLost(e){let t=`THREE.WebGPURenderer: ${e.api} Device Lost:4165+`;return n}getHash(){return this.vertexShader+this.fragmentShader+this.computeShader}setShaderStage(e){this.shaderStage=e}getShaderStage(){return this.shaderStage}setBuildStage(e){this.buildStage=e}getBuildStage(){return this.buildStage}buildCode(){Xe("Abstract function.")}get subBuild(){return this.subBuildLayers[this.subBuildLayers.length-1]||null}addSubBuild(e){this.subBuildLayers.push(e)}removeSubBuild(){return this.subBuildLayers.pop()}getClosestSubBuild(e){let t;if(e&&e.isNode?e.isShaderCallNodeInternal?t=e.shaderNode.subBuilds:e.isStackNode?t=[e.subBuild]:t=this.getDataFromNode(e,"any").subBuilds:e instanceof Set?t=[...e]:t=e,!t)return null;let n=this.subBuildLayers;for(let r=t.length-1;r>=0;r--){let s=t[r];if(n.includes(s))return s}return null}getSubBuildOutput(e){return this.getSubBuildProperty("outputNode",e)}getSubBuildProperty(e="",t=null){let n;t!==null?n=this.getClosestSubBuild(t):n=this.subBuildFn;let r;return n?r=e?n+"_"+e:n:r=e,r}prebuild(){let{object:e,renderer:t,material:n}=this;if(t.contextNode.isContextNode===!0?this.context={...this.context,...t.contextNode.getFlowContextData()}:ze('NodeBuilder: "renderer.contextNode" must be an instance of `context()`.'),n&&n.contextNode&&(n.contextNode.isContextNode===!0?this.context={...this.context,...n.contextNode.getFlowContextData()}:ze('NodeBuilder: "material.contextNode" must be an instance of `context()`.')),n!==null){let r=t.library.fromMaterial(n);r===null&&(ze(`NodeBuilder: Material "${n.type}" is not compatible.`),r=new Ir),r.build(this)}else this.addFlow("compute",e)}build(){this.prebuild();for(let e of ZR){this.setBuildStage(e),this.context.position&&this.context.position.isNode&&this.flowNodeFromShaderStage("vertex",this.context.position);for(let t of KR){this.setShaderStage(t);let n=this.flowNodes[t];for(let r of n)e==="generate"?this.flowNode(r):r.build(this)}}return this.setBuildStage(null),this.setShaderStage(null),this.buildCode(),this.buildUpdateNodes(),this}async buildAsync(){this.prebuild();for(let e of ZR){this.setBuildStage(e),this.context.position&&this.context.position.isNode&&this.flowNodeFromShaderStage("vertex",this.context.position);for(let t of KR){this.setShaderStage(t);let n=this.flowNodes[t];for(let r of n)e==="generate"?this.flowNode(r):r.build(this);await hF()}}return this.setBuildStage(null),this.setShaderStage(null),this.buildCode(),this.buildUpdateNodes(),this}getSharedDataFromNode(e){let t=cPe.get(e);return t===void 0&&(t={}),t}getNodeUniform(e,t){let n=this.getSharedDataFromNode(e),r=n.cache;if(r===void 0){if(t==="float"||t==="int"||t==="uint")r=new Wk(e);else if(t==="vec2"||t==="ivec2"||t==="uvec2")r=new jk(e);else if(t==="vec3"||t==="ivec3"||t==="uvec3")r=new Xk(e);else if(t==="vec4"||t==="ivec4"||t==="uvec4")r=new $k(e);else if(t==="color")r=new Yk(e);else if(t==="mat2")r=new Zk(e);else if(t==="mat3")r=new Kk(e);else if(t==="mat4")r=new Qk(e);else throw new Error(`THREE.NodeBuilder: Uniform "${t}" not implemented.`);n.cache=r}return r}format(e,t,n){if(t=this.getVectorType(t),n=this.getVectorType(n),t===n||n===null||this.isReference(n))return e;let r=this.getTypeLength(t),s=this.getTypeLength(n);return r===16&&s===9?`${this.getType(n)}( ${e}[ 0 ].xyz, ${e}[ 1 ].xyz, ${e}[ 2 ].xyz )`:r===9&&s===4?`${this.getType(n)}( ${e}[ 0 ].xy, ${e}[ 1 ].xy )`:r>4||s>4||s===0?e:r===s?`${this.getType(n)}( ${e} )`:r>s?(e=n==="bool"?`all( ${e} )`:`${e}.${"xyz".slice(0,s)}`,this.format(e,this.getTypeFromLength(s,this.getComponentType(t)),n)):s===4&&r>1?`${this.getType(n)}( ${this.format(e,t,"vec3")}, 1.0 )`:r===2?`${this.getType(n)}( ${this.format(e,t,"vec2")}, 0.0 )`:(r===1&&s>1&&t!==this.getComponentType(n)&&(e=`${this.getType(this.getComponentType(n))}( ${e} )`),`${this.getType(n)}( ${e} )`)}getSignature(){return`// Three.js r${"185"} - Node System4166+`}needsPreviousData(){let e=this.renderer.getMRT();return e&&e.has("velocity")||sne(this.object).useVelocity===!0}},X4=class{constructor(){this.time=0,this.deltaTime=0,this.frameId=0,this.renderId=0,this.updateMap=new WeakMap,this.updateBeforeMap=new WeakMap,this.updateAfterMap=new WeakMap,this.renderer=null,this.material=null,this.camera=null,this.object=null,this.scene=null}_getMaps(e,t){let n=e.get(t);return n===void 0&&(n={renderId:0,frameId:0},e.set(t,n)),n}updateBeforeNode(e){let t=e.getUpdateBeforeType(),n=e.updateReference(this);if(t===yn.FRAME){let r=this._getMaps(this.updateBeforeMap,n);if(r.frameId!==this.frameId){let s=r.frameId;r.frameId=this.frameId,e.updateBefore(this)===!1&&(r.frameId=s)}}else if(t===yn.RENDER){let r=this._getMaps(this.updateBeforeMap,n);if(r.renderId!==this.renderId){let s=r.renderId;r.renderId=this.renderId,e.updateBefore(this)===!1&&(r.renderId=s)}}else t===yn.OBJECT&&e.updateBefore(this)}updateAfterNode(e){let t=e.getUpdateAfterType(),n=e.updateReference(this);if(t===yn.FRAME){let r=this._getMaps(this.updateAfterMap,n);r.frameId!==this.frameId&&e.updateAfter(this)!==!1&&(r.frameId=this.frameId)}else if(t===yn.RENDER){let r=this._getMaps(this.updateAfterMap,n);r.renderId!==this.renderId&&e.updateAfter(this)!==!1&&(r.renderId=this.renderId)}else t===yn.OBJECT&&e.updateAfter(this)}updateNode(e){let t=e.getUpdateType(),n=e.updateReference(this);if(t===yn.FRAME){let r=this._getMaps(this.updateMap,n);r.frameId!==this.frameId&&e.update(this)!==!1&&(r.frameId=this.frameId)}else if(t===yn.RENDER){let r=this._getMaps(this.updateMap,n);r.renderId!==this.renderId&&e.update(this)!==!1&&(r.renderId=this.renderId)}else t===yn.OBJECT&&e.update(this)}update(){this.frameId++,this.lastTime===void 0&&(this.lastTime=performance.now()),this.deltaTime=(performance.now()-this.lastTime)/1e3,this.lastTime=performance.now(),this.time+=this.deltaTime}},RS=class{constructor(e,t,n=null,r="",s=!1){this.type=e,this.name=t,this.count=n,this.qualifier=r,this.isConst=s}};RS.isNodeFunctionInput=!0;var Jk=class extends Jd{static get type(){return"AmbientLightNode"}constructor(e=null){super(e)}setup({context:e}){e.irradiance.addAssign(this.colorNode)}},e9=class extends Jd{static get type(){return"DirectionalLightNode"}constructor(e=null){super(e)}setupDirect(){let e=this.colorNode;return{lightDirection:EV(this.light),lightColor:e}}},t9=class extends Jd{static get type(){return"HemisphereLightNode"}constructor(e=null){super(e),this.lightPositionNode=SV(e),this.lightDirectionNode=this.lightPositionNode.normalize(),this.groundColorNode=Xt(new zt).setGroup(Jt)}update(e){let{light:t}=this;super.update(e),this.lightPositionNode.object3d=t,this.groundColorNode.value.copy(t.groundColor).multiplyScalar(t.intensity)}setup(e){let{colorNode:t,groundColorNode:n,lightDirectionNode:r}=this,o=Tm.dot(r).mul(.5).add(.5),a=Qn(n,t,o);e.context.irradiance.addAssign(a)}},IS=class extends Jd{static get type(){return"SpotLightNode"}constructor(e=null){super(e),this.coneCosNode=Xt(0).setGroup(Jt),this.penumbraCosNode=Xt(0).setGroup(Jt),this.cutoffDistanceNode=Xt(0).setGroup(Jt),this.decayExponentNode=Xt(0).setGroup(Jt),this.colorNode=Xt(this.color).setGroup(Jt)}update(e){super.update(e);let{light:t}=this;this.coneCosNode.value=Math.cos(t.angle),this.penumbraCosNode.value=Math.cos(t.angle*(1-t.penumbra)),this.cutoffDistanceNode.value=t.distance,this.decayExponentNode.value=t.decay}getSpotAttenuation(e,t){let{coneCosNode:n,penumbraCosNode:r}=this;return mc(n,r,t)}getLightCoord(e){let t=e.getNodeProperties(this),n=t.projectionUV;return n===void 0&&(n=qse(this.light,e.context.positionWorld),t.projectionUV=n),n}setupDirect(e){let{colorNode:t,cutoffDistanceNode:n,decayExponentNode:r,light:s}=this,o=this.getLightVector(e),a=o.normalize(),l=a.dot(EV(s)),c=this.getSpotAttenuation(e,l),u=o.length(),f=CV({lightDistance:u,cutoffDistance:n,decayExponent:r}),d=t.mul(c).mul(f),A,y;return s.colorNode?(y=this.getLightCoord(e),A=s.colorNode(y)):s.map&&(y=this.getLightCoord(e),A=fi(s.map,y.xy).onRenderUpdate(()=>s.map)),A&&(d=y.mul(2).sub(1).abs().lessThan(1).all().select(d.mul(A),d)),{lightColor:d,lightDirection:a}}},n9=class extends IS{static get type(){return"IESSpotLightNode"}constructor(e=null){super(e),this._iesTextureNode=null}getSpotAttenuation(e,t){let n=this.light.iesMap,r=null;if(n&&n.isTexture===!0){let s=t.acos().mul(1/Math.PI);this._iesTextureNode=fi(n,dt(s,0),0),r=this._iesTextureNode.r}else r=super.getSpotAttenuation(e,t);return r}update(e){super.update(e),this._iesTextureNode!==null&&this.light.iesMap&&(this._iesTextureNode.value=this.light.iesMap)}},i9=class extends Jd{static get type(){return"LightProbeNode"}constructor(e=null){super(e);let t=[];for(let n=0;n<9;n++)t.push(new re);this.lightProbe=Xo(t)}update(e){let{light:t}=this;super.update(e);for(let n=0;n<9;n++)this.lightProbe.array[n].copy(t.sh.coefficients[n]).multiplyScalar(t.intensity)}setup(e){let t=hoe(Tm,this.lightProbe);e.context.irradiance.addAssign(t)}},hPe=me(([i,e])=>{let t=i.abs().sub(e);return yf(zr(t,0)).add(Il(zr(t.x,t.y),0))}),r9=class extends IS{static get type(){return"ProjectorLightNode"}update(e){super.update(e);let t=this.light;if(this.penumbraCosNode.value=Math.min(Math.cos(t.angle*(1-t.penumbra)),.99999),t.aspect===null){let n=1;t.map!==null&&(n=t.map.width/t.map.height),t.shadow.aspect=n}else t.shadow.aspect=t.aspect}getSpotAttenuation(e){let t=oe(0),n=this.penumbraCosNode,r=VI(this.light).mul(e.context.positionWorld||bf);return $t(r.w.greaterThan(0),()=>{let s=r.xyz.div(r.w),o=hPe(s.xy.sub(dt(.5)),dt(.5)),a=pc(-1,ai(1,bz(n)).sub(1));t.assign(EI(o.mul(-2).mul(a)))}),t}},rU=new cn,BR=new cn,Yw=null,s9=class extends Jd{static get type(){return"RectAreaLightNode"}constructor(e=null){super(e),this.halfHeight=Xt(new re).setGroup(Jt),this.halfWidth=Xt(new re).setGroup(Jt),this.updateType=yn.RENDER}update(e){super.update(e);let{light:t}=this,n=e.camera.matrixWorldInverse;BR.identity(),rU.copy(t.matrixWorld),rU.premultiply(n),BR.extractRotation(rU),this.halfWidth.value.set(t.width*.5,0,0),this.halfHeight.value.set(0,t.height*.5,0),this.halfWidth.value.applyMatrix4(BR),this.halfHeight.value.applyMatrix4(BR)}setupDirectRectArea(e){let t,n;e.isAvailable("float32Filterable")?(t=fi(Yw.LTC_FLOAT_1),n=fi(Yw.LTC_FLOAT_2)):(t=fi(Yw.LTC_HALF_1),n=fi(Yw.LTC_HALF_2));let{colorNode:r,light:s}=this,o=TV(s);return{lightColor:r,lightPosition:o,halfWidth:this.halfWidth,halfHeight:this.halfHeight,ltc_1:t,ltc_2:n}}static setLTC(e){Yw=e}},$4=class{parseFunction(){Xe("Abstract function.")}},PS=class{constructor(e,t,n="",r=""){this.type=e,this.inputs=t,this.name=n,this.precision=r}getCode(){Xe("Abstract function.")}};PS.isNodeFunction=!0;var fPe=/^\s*(highp|mediump|lowp)?\s*([a-z_0-9]+)\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)/i,dPe=/[a-z_0-9]+/ig,Rte="#pragma main",pPe=i=>{i=i.trim();let e=i.indexOf(Rte),t=e!==-1?i.slice(e+Rte.length):i,n=t.match(fPe);if(n!==null&&n.length===5){let r=n[4],s=[],o=null;for(;(o=dPe.exec(r))!==null;)s.push(o);let a=[],l=0;for(;l<s.length;){let y=s[l][0]==="const";y===!0&&l++;let w=s[l][0];w==="in"||w==="out"||w==="inout"?l++:w="";let S=s[l++][0],T=Number.parseInt(s[l][0]);Number.isNaN(T)===!1?l++:T=null;let R=s[l++][0];a.push(new RS(S,R,T,w,y))}let c=t.substring(n[0].length),u=n[3]!==void 0?n[3]:"",f=n[2],d=n[1]!==void 0?n[1]:"",A=e!==-1?i.slice(0,e):"";return{type:f,inputs:a,name:u,precision:d,inputsCode:r,blockCode:c,headerCode:A}}else throw new Error("THREE.FunctionNode: Function is not a GLSL code.")},o9=class extends PS{constructor(e){let{type:t,inputs:n,name:r,precision:s,inputsCode:o,blockCode:a,headerCode:l}=pPe(e);super(t,n,r,s),this.inputsCode=o,this.blockCode=a,this.headerCode=l}getCode(e=this.name){let t,n=this.blockCode;if(n!==""){let{type:r,inputsCode:s,headerCode:o,precision:a}=this,l=`${r} ${e} ( ${s.trim()} )`;a!==""&&(l=`${a} ${l}`),t=o+l+n}else t="";return t}},a9=class extends $4{parseFunction(e){return new o9(e)}},Qc=[],qd=[],Ite=Xt(0,"int").setGroup(Jt),l9=class extends Cf{constructor(e,t){super(),this.renderer=e,this.backend=t,this.nodeFrame=new X4,this.nodeBuilderCache=new Map,this.callHashCache=new Mf,this.groupsData=new Mf,this._buildQueue=[],this._buildInProgress=!1,this.cacheLib={}}updateGroup(e){let t=e.groupNode;if(t.updateType===yn.OBJECT)return!0;Qc[0]=t,Qc[1]=e;let n=this.groupsData.get(Qc);return n===void 0&&this.groupsData.set(Qc,n={}),Qc[0]=null,Qc[1]=null,n.version!==t.version?(n.version=t.version,!0):!1}getForRenderCacheKey(e){return e.initialCacheKey}_createNodeBuilder(e,t){let n=this.backend.createNodeBuilder(e.object,this.renderer);return n.scene=e.scene,n.material=t,n.camera=e.camera,n.context.material=t,n.lightsNode=e.lightsNode,n.environmentNode=this.getEnvironmentNode(e.scene),n.fogNode=this.getFogNode(e.scene),n.clippingContext=e.clippingContext,this.renderer.getOutputRenderTarget()&&this.renderer.getOutputRenderTarget().multiview&&n.enableMultiview(),n}getForRender(e,t=!1){let n=this.get(e),r=n.nodeBuilderState;if(r===void 0){let{nodeBuilderCache:s}=this,o=this.getForRenderCacheKey(e);if(r=s.get(o),r===void 0){let a=async()=>{let l=this._createNodeBuilder(e,e.material);try{t?await l.buildAsync():l.build()}catch(c){l=this._createNodeBuilder(e,new Ir),t?await l.buildAsync():l.build(),ze("TSL: "+c)}return l};if(t)return a().then(l=>(r=this._createNodeBuilderState(l),s.set(o,r),r.usedTimes++,n.nodeBuilderState=r,r));{let l=this._createNodeBuilder(e,e.material);try{l.build()}catch(c){l=this._createNodeBuilder(e,new Ir),l.build();let u=c.stackTrace;!u&&c.stack&&(u=new es(c.stack)),ze("TSL: "+c,u)}r=this._createNodeBuilderState(l),s.set(o,r)}}r.usedTimes++,n.nodeBuilderState=r}return r}getForRenderAsync(e){let t=this.getForRender(e,!0);return t.then?t:Promise.resolve(t)}getForRenderDeferred(e){let t=this.get(e);if(t.nodeBuilderState!==void 0)return t.nodeBuilderState;let n=this.getForRenderCacheKey(e),r=this.nodeBuilderCache.get(n);return r!==void 0?(r.usedTimes++,t.nodeBuilderState=r,r):(t.pendingBuild!==!0&&(t.pendingBuild=!0,this._buildQueue.push(()=>this.getForRenderAsync(e).then(()=>{t.pendingBuild=!1})),this._processBuildQueue()),null)}_processBuildQueue(){if(this._buildInProgress||this._buildQueue.length===0)return;this._buildInProgress=!0,this._buildQueue.shift()().then(()=>{this._buildInProgress=!1,this._processBuildQueue()})}delete(e){if(e.isRenderObject){let t=this.get(e).nodeBuilderState;t!==void 0&&(t.usedTimes--,t.usedTimes===0&&this.nodeBuilderCache.delete(this.getForRenderCacheKey(e)))}return super.delete(e)}getForCompute(e){let t=this.get(e),n=t.nodeBuilderState;if(n===void 0||t.version!==e.version){let r=this.backend.createNodeBuilder(e,this.renderer);r.build(),n=this._createNodeBuilderState(r),t.nodeBuilderState=n,t.version=e.version}return n}_createNodeBuilderState(e){return new Lk(e.vertexShader,e.fragmentShader,e.computeShader,e.getAttributesArray(),e.getBindings(),e.updateNodes,e.updateBeforeNodes,e.updateAfterNodes,e.observer,e.hardwareClipping,e.transforms)}getEnvironmentNode(e){if(this.renderer.lighting.enabled===!1)return null;this.updateEnvironment(e);let t=null;if(e.environmentNode&&e.environmentNode.isNode)t=e.environmentNode;else{let n=this.get(e);n.environmentNode&&(t=n.environmentNode)}return t}getBackgroundNode(e){this.updateBackground(e);let t=null;if(e.backgroundNode&&e.backgroundNode.isNode)t=e.backgroundNode;else{let n=this.get(e);n.backgroundNode&&(t=n.backgroundNode)}return t}getFogNode(e){return this.updateFog(e),e.fogNode||this.get(e).fogNode||null}getCacheKey(e,t){Qc[0]=e,Qc[1]=t;let n=this.renderer.info.calls,r=this.callHashCache.get(Qc)||{};if(r.callId!==n){if(qd.push(this.renderer.getOutputRenderTarget()&&this.renderer.getOutputRenderTarget().multiview?1:0),qd.push(this.renderer.lighting.enabled?1:0),this.renderer.lighting.enabled){qd.push(t.getCacheKey(!0)),qd.push(this.renderer.shadowMap.enabled?1:0),qd.push(this.renderer.shadowMap.type);let o=this.getEnvironmentNode(e);o&&qd.push(o.getCacheKey())}let s=this.getFogNode(e);s&&qd.push(s.getCacheKey()),r.callId=n,r.cacheKey=FS(qd),this.callHashCache.set(Qc,r),qd.length=0}return Qc[0]=null,Qc[1]=null,r.cacheKey}get isToneMappingState(){return!this.renderer.getRenderTarget()}updateBackground(e){let t=this.get(e),n=e.background;if(n){let r=e.backgroundBlurriness===0&&t.backgroundBlurriness>0||e.backgroundBlurriness>0&&t.backgroundBlurriness===0;if(t.background!==n||r){let s=this.getCacheNode("background",n,()=>{if(n.isCubeTexture===!0||n.mapping===m0||n.mapping===A0||n.mapping===kh){if(e.backgroundBlurriness>0||n.mapping===kh)return vV(n);{let o;return n.isCubeTexture===!0?o=Qa(n):o=fi(n),ose(o)}}else{if(n.isTexture===!0)return fi(n,$u.flipY()).setUpdateMatrix(!0);n.isColor!==!0&&ze("WebGPUNodes: Unsupported background configuration.",n)}},r);t.backgroundNode=s,t.background=n,t.backgroundBlurriness=e.backgroundBlurriness}}else t.backgroundNode&&(delete t.backgroundNode,delete t.background)}getCacheNode(e,t,n,r=!1){let s=this.cacheLib[e]||(this.cacheLib[e]=new WeakMap),o=s.get(t);return(o===void 0||r)&&(o=n(),s.set(t,o)),o}updateFog(e){let t=this.get(e),n=e.fog;if(n){if(t.fog!==n){let r=this.getCacheNode("fog",n,()=>{if(n.isFogExp2){let s=mr("color","color",n).setGroup(Jt),o=mr("density","float",n).setGroup(Jt);return bk(s,Gse(o))}else if(n.isFog){let s=mr("color","color",n).setGroup(Jt),o=mr("near","float",n).setGroup(Jt),a=mr("far","float",n).setGroup(Jt);return bk(s,Vse(o,a))}else ze("Renderer: Unsupported fog configuration.",n)});t.fogNode=r,t.fog=n}}else delete t.fogNode,delete t.fog}updateEnvironment(e){let t=this.get(e),n=e.environment;if(n){if(t.environment!==n){let r=this.getCacheNode("environment",n,()=>{if(n.isCubeTexture===!0)return Qa(n);if(n.isTexture===!0)return fi(n);ze("Nodes: Unsupported environment configuration.",n)});t.environmentNode=r,t.environment=n}}else t.environmentNode&&(delete t.environmentNode,delete t.environment)}getNodeFrame(e=this.renderer,t=null,n=null,r=null,s=null){let o=this.nodeFrame;return o.renderer=e,o.scene=t,o.object=n,o.camera=r,o.material=s,o}getNodeFrameForRender(e){return this.getNodeFrame(e.renderer,e.scene,e.object,e.camera,e.material)}getOutputCacheKey(){let e=this.renderer;return e.toneMapping+","+e.currentColorSpace+","+e.xr.isPresenting}getOutputNode(e){let t=this.renderer,n;return e.isArrayTexture?this.backend.isWebGLBackend?n=fi(e,$u).depth(np("gl_ViewID_OVR")).renderOutput(t.toneMapping,t.currentColorSpace):n=fi(e,$u).depth(Ite).renderOutput(t.toneMapping,t.currentColorSpace):n=fi(e,$u).renderOutput(t.toneMapping,t.currentColorSpace),n}setOutputLayerIndex(e){Ite.value=e}updateBefore(e){let t=e.getNodeBuilderState();for(let n of t.updateBeforeNodes)this.getNodeFrameForRender(e).updateBeforeNode(n)}updateAfter(e){let t=e.getNodeBuilderState();for(let n of t.updateAfterNodes)this.getNodeFrameForRender(e).updateAfterNode(n)}updateForCompute(e){let t=this.getNodeFrame(),n=this.getForCompute(e);for(let r of n.updateNodes)t.updateNode(r)}updateForRender(e){let t=this.getNodeFrameForRender(e),n=e.getNodeBuilderState();for(let r of n.updateNodes)t.updateNode(r)}needsRefresh(e){let t=this.getNodeFrameForRender(e);return e.getMonitor().needsRefresh(e,t)}dispose(){super.dispose(),this.nodeFrame=new X4,this.nodeBuilderCache=new Map,this.cacheLib={}}},sU=new Na,Y4=class i{constructor(e=null){this.version=0,this.clipIntersection=null,this.cacheKey="",this.shadowPass=!1,this.viewMatrix=new cn,this.viewNormalMatrix=new Mn,this.clippingGroupContexts=new WeakMap,this.intersectionPlanes=[],this.unionPlanes=[],this.parentVersion=null,e!==null&&(this.viewMatrix=e.viewMatrix,this.viewNormalMatrix=e.viewNormalMatrix,this.clippingGroupContexts=e.clippingGroupContexts,this.shadowPass=e.shadowPass)}projectPlanes(e,t,n){let r=e.length;for(let s=0;s<r;s++){sU.copy(e[s]).applyMatrix4(this.viewMatrix,this.viewNormalMatrix);let o=t[n+s],a=sU.normal;o.x=-a.x,o.y=-a.y,o.z=-a.z,o.w=sU.constant}}updateGlobal(e,t){this.shadowPass=e.overrideMaterial!==null&&e.overrideMaterial.isShadowPassMaterial,this.viewMatrix.copy(t.matrixWorldInverse),this.viewNormalMatrix.getNormalMatrix(this.viewMatrix)}update(e,t){let n=!1;e.version!==this.parentVersion&&(this.intersectionPlanes=Array.from(e.intersectionPlanes),this.unionPlanes=Array.from(e.unionPlanes),this.parentVersion=e.version),this.clipIntersection!==t.clipIntersection&&(this.clipIntersection=t.clipIntersection,this.clipIntersection?this.unionPlanes.length=e.unionPlanes.length:this.intersectionPlanes.length=e.intersectionPlanes.length);let r=t.clippingPlanes,s=r.length,o,a;if(this.clipIntersection?(o=this.intersectionPlanes,a=e.intersectionPlanes.length):(o=this.unionPlanes,a=e.unionPlanes.length),o.length!==a+s){o.length=a+s;for(let l=0;l<s;l++)o[a+l]=new xn;n=!0}this.projectPlanes(r,o,a),n&&(this.version++,this.cacheKey=`${this.intersectionPlanes.length}:${this.unionPlanes.length}`)}getGroupContext(e){if(this.shadowPass&&!e.clipShadows)return this;let t=this.clippingGroupContexts.get(e);return t===void 0&&(t=new i(this),this.clippingGroupContexts.set(e,t)),t.update(this,e),t}get unionClippingCount(){return this.unionPlanes.length}},c9=class{constructor(e,t,n){this.bundleGroup=e,this.camera=t,this.renderContext=n}},nm=[],u9=class{constructor(){this.bundles=new Mf}get(e,t,n){let r=this.bundles;nm[0]=e,nm[1]=t,nm[2]=n;let s=r.get(nm);return s===void 0&&(s=new c9(e,t,n),r.set(nm,s)),nm[0]=null,nm[1]=null,nm[2]=null,s}dispose(){this.bundles=new Mf}},Z4=class{constructor(){this.lightNodes=new WeakMap,this.materialNodes=new Map,this.toneMappingNodes=new Map}fromMaterial(e){if(e.isNodeMaterial)return e;let t=null,n=this.getMaterialNodeClass(e.type);if(n!==null){t=new n;for(let r in e)t[r]=e[r]}return t}addToneMapping(e,t){this.addType(e,t,this.toneMappingNodes)}getToneMappingFunction(e){return this.toneMappingNodes.get(e)||null}getMaterialNodeClass(e){return this.materialNodes.get(e)||null}addMaterial(e,t){this.addType(e,t,this.materialNodes)}getLightNodeClass(e){return this.lightNodes.get(e)||null}addLight(e,t){this.addClass(e,t,this.lightNodes)}addType(e,t,n){if(n.has(t)){Xe(`Redefinition of node ${t}`);return}if(typeof e!="function")throw new Error(`THREE.NodeLibrary: Node class ${e.name} is not a class.`);if(typeof t=="function"||typeof t=="object")throw new Error(`THREE.NodeLibrary: Base class ${t} is not a class.`);n.set(t,e)}addClass(e,t,n){if(n.has(t)){Xe(`Redefinition of node ${t.name}`);return}if(typeof e!="function")throw new Error(`THREE.NodeLibrary: Node class ${e.name} is not a class.`);if(typeof t!="function")throw new Error(`THREE.NodeLibrary: Base class ${t.name} is not a class.`);n.set(t,e)}},mPe=new MS,Pte=new WeakMap,h9=class{constructor(){this.enabled=!0,this._cache=[]}createNode(e=[]){return new MS().setLights(e)}getNode(e){if(e.isScene!==!0&&e.isGroup!==!0)return mPe;let t=Pte.get(e);return t===void 0&&(t=this.createNode(),Pte.set(e,t)),t}beginRender(e){this._cache.push(this.getNode(e).getLights())}finishRender(e){this.getNode(e).setLights(this._cache.pop())}},jg=class extends Ba{constructor(e=1,t=1,n={}){super(e,t,n),this.isXRRenderTarget=!0,this._hasExternalTextures=!1,this._autoAllocateDepthBuffer=!0,this._isOpaqueFramebuffer=!1}copy(e){return super.copy(e),this._hasExternalTextures=e._hasExternalTextures,this._autoAllocateDepthBuffer=e._autoAllocateDepthBuffer,this._isOpaqueFramebuffer=e._isOpaqueFramebuffer,this}},Lte=new re,Dte=new re,Nte=new WeakMap,f9=class extends la{constructor(e,t=!1){super(),this.enabled=!1,this.isPresenting=!1,this.cameraAutoUpdate=!0,this._renderer=e,this._cameraL=new $r,this._cameraL.viewport=new xn,this._cameraL.matrixWorldAutoUpdate=!1,this._cameraR=new $r,this._cameraR.viewport=new xn,this._cameraR.matrixWorldAutoUpdate=!1,this._cameras=[this._cameraL,this._cameraR],this._cameraXR=new c_,this._currentDepthNear=null,this._currentDepthFar=null,this._controllers=[],this._controllerInputSources=[],this._xrRenderTarget=null,this._layers=[],this._sessionUsesLayers=!1,this._supportsGlBinding=typeof XRWebGLBinding<"u",this._supportsWebGPUBinding=typeof globalThis.XRGPUBinding<"u",this._createXRLayer=yPe.bind(this),this._gl=null,this._currentAnimationContext=null,this._currentAnimationLoop=null,this._currentPixelRatio=null,this._currentSamples=null,this._currentSize=new Oe,this._onSessionEvent=vPe.bind(this),this._onSessionEnd=_Pe.bind(this),this._onInputSourcesChange=xPe.bind(this),this._onAnimationFrame=bPe.bind(this),this._referenceSpace=null,this._referenceSpaceType="local-floor",this._customReferenceSpace=null,this._framebufferScaleFactor=1,this._foveation=1,this._session=null,this._glBaseLayer=null,this._glBinding=null,this._webgpuBinding=null,this._glProjLayer=null,this._xrFrame=null,this._supportsLayers=this._supportsGlBinding&&"createProjectionLayer"in XRWebGLBinding.prototype,this._useMultiviewIfPossible=t,this._useMultiview=!1}getController(e){return this._getController(e).getTargetRaySpace()}getControllerGrip(e){return this._getController(e).getGripSpace()}getHand(e){return this._getController(e).getHandSpace()}getFoveation(){return this._foveation}setFoveation(e){this._foveation=e,this._glProjLayer!==null&&(this._glProjLayer.fixedFoveation=e),this._glBaseLayer!==null&&this._glBaseLayer.fixedFoveation!==void 0&&(this._glBaseLayer.fixedFoveation=e)}getFramebufferScaleFactor(){return this._framebufferScaleFactor}setFramebufferScaleFactor(e){this._framebufferScaleFactor=e,this.isPresenting===!0&&Xe("XRManager: Cannot change framebuffer scale while presenting.")}getReferenceSpaceType(){return this._referenceSpaceType}setReferenceSpaceType(e){this._referenceSpaceType=e,this.isPresenting===!0&&Xe("XRManager: Cannot change reference space type while presenting.")}getReferenceSpace(){return this._customReferenceSpace||this._referenceSpace}setReferenceSpace(e){this._customReferenceSpace=e}getCamera(){return this._cameraXR}getEnvironmentBlendMode(){if(this._session!==null)return this._session.environmentBlendMode}getBaseLayer(){return this._glProjLayer!==null?this._glProjLayer:this._glBaseLayer}getBinding(){return this._glBinding===null&&this._supportsGlBinding&&(this._glBinding=new XRWebGLBinding(this._session,this._gl)),this._glBinding}foveateBoundTexture(e){if(e.isPostProcessingRenderTarget!==!0||this.isPresenting!==!0||this._glProjLayer===null)return;let t=this._renderer.backend;if(t===void 0||t.isWebGLBackend!==!0||t.state===null)return;let n=this._renderer.getOutputRenderTarget();if(n===null||n.isXRRenderTarget!==!0)return;let r=this.getBinding();if(r===null||typeof r.foveateBoundTexture!="function")return;this._renderer._textures.updateRenderTarget(e);let{textureGPU:s,glTextureType:o}=t.get(e.texture);if(!(s===void 0||o===void 0)&&e._xrFoveationTextureGPU!==s){e._xrFoveationTextureGPU=s,t.state.bindTexture(o,s);try{r.foveateBoundTexture(o,this.getFoveation())}catch(a){ni(`XRManager: Unable to foveate bound XR post-processing texture. ${a.name}: ${a.message}`)}finally{t.state.unbindTexture()}}}getWebGPUBinding(){return this._webgpuBinding===null&&this._supportsWebGPUBinding&&(this._webgpuBinding=new globalThis.XRGPUBinding(this._session,this._renderer.backend.device)),this._webgpuBinding}_isWebGPUSession(){return this._renderer.backend.isWebGPUBackend===!0&&this._session!==null&&this._session.enabledFeatures.includes("webgpu")}_validateWebGPUSession(){let e=this._renderer;if(e.backend.isWebGPUBackend===!0){if(this._session.enabledFeatures.includes("webgpu")===!1)throw new Error('THREE.XRManager: WebGPU XR sessions require the "webgpu" session feature. Use VRButtonGPU/XRButton with "webgpu" enabled or use a WebGL backend.');e.samples>0&&(ni("THREE.XRManager: WebGPU XR does not support MSAA yet. Disabling MSAA for this XR session."),this._currentSamples===null&&(this._currentSamples=e.samples),e._samples=0)}}async _initWebGPUSession(e){let t=this.getWebGPUBinding(),n=t.createProjectionLayer({colorFormat:t.getPreferredColorFormat(),depthStencilFormat:"depth24plus"});this._glProjLayer=n,e.updateRenderState({layers:[n]}),this._referenceSpace=await e.requestReferenceSpace(this.getReferenceSpaceType()),this._xrRenderTarget=new Ba(n.textureWidth,n.textureHeight,{depth:2,minFilter:Mi,magFilter:Mi,depthBuffer:!0,multiview:!1,useArrayDepthTexture:!0,samples:0}),this._xrRenderTarget.texture.isArrayTexture=!0,this._useMultiviewIfPossible===!0&&ni("THREE.XRManager: WebGPU XR does not support multiview yet. Disabling multiview for this XR session."),this._useMultiview=!1}_disposeWebGPUSession(){let e=this._renderer,t=this._xrRenderTarget;if(t===null||e.backend.isWebGPUBackend!==!0)return;let n=e.backend,r=e._textures,s=n.get?n.get(t):null;s&&(s.descriptors=void 0);let o=a=>{a!=null&&(n.delete&&n.delete(a),r.delete&&r.delete(a))};for(let a=0;a<t.textures.length;a++)o(t.textures[a]);o(t.depthTexture),o(t),e._renderContexts&&e._renderContexts.dispose&&e._renderContexts.dispose(),t.dispose()}_getWebGPUViewData(e){let t=this.getWebGPUBinding(),n={colorTexture:null,viewDescriptors:[],viewports:[]};for(let r=0;r<e.length;r++){let s=t.getViewSubImage(this._glProjLayer,e[r]);n.colorTexture===null&&(n.colorTexture=s.colorTexture),n.viewports.push(s.viewport),s.getViewDescriptor&&n.viewDescriptors.push(s.getViewDescriptor())}return n}getFrame(){return this._xrFrame}useMultiview(){return this._useMultiview}createQuadLayer(e,t,n,r,s,o,a,l={}){let c=new KA(e,t),u=new jg(s,o,{format:Or,type:Ji,depthTexture:new Cs(s,o,l.stencil?ca:xi,void 0,void 0,void 0,void 0,void 0,void 0,l.stencil?xo:Gs),stencilBuffer:l.stencil,resolveDepthBuffer:!1,resolveStencilBuffer:!1});u._autoAllocateDepthBuffer=!0;let f=new fs({color:16777215,side:ko});f.map=u.texture,f.map.offset.y=1,f.map.repeat.y=-1;let d=new Hn(c,f);d.position.copy(n),d.quaternion.copy(r);let A={type:"quad",width:e,height:t,translation:n,quaternion:r,pixelwidth:s,pixelheight:o,plane:d,material:f,rendercall:a,renderTarget:u};if(this._layers.push(A),this._session!==null){A.plane.material=new fs({color:16777215,side:ko}),A.plane.material.blending=Nd,A.plane.material.blendEquation=oo,A.plane.material.blendSrc=Bu,A.plane.material.blendDst=Bu,A.xrlayer=this._createXRLayer(A);let y=this._session.renderState.layers;y.unshift(A.xrlayer),this._session.updateRenderState({layers:y})}else u.isXRRenderTarget=!1;return d}createCylinderLayer(e,t,n,r,s,o,a,l,c={}){let u=new $A(e,e,e*t/n,64,64,!0,Math.PI-t/2,t),f=new jg(o,a,{format:Or,type:Ji,depthTexture:new Cs(o,a,c.stencil?ca:xi,void 0,void 0,void 0,void 0,void 0,void 0,c.stencil?xo:Gs),stencilBuffer:c.stencil,resolveDepthBuffer:!1,resolveStencilBuffer:!1});f._autoAllocateDepthBuffer=!0;let d=new fs({color:16777215,side:mi});d.map=f.texture,d.map.offset.y=1,d.map.repeat.y=-1;let A=new Hn(u,d);A.position.copy(r),A.quaternion.copy(s);let y={type:"cylinder",radius:e,centralAngle:t,aspectratio:n,translation:r,quaternion:s,pixelwidth:o,pixelheight:a,plane:A,material:d,rendercall:l,renderTarget:f};if(this._layers.push(y),this._session!==null){y.plane.material=new fs({color:16777215,side:mi}),y.plane.material.blending=Nd,y.plane.material.blendEquation=oo,y.plane.material.blendSrc=Bu,y.plane.material.blendDst=Bu,y.xrlayer=this._createXRLayer(y);let w=this._session.renderState.layers;w.unshift(y.xrlayer),this._session.updateRenderState({layers:w})}else f.isXRRenderTarget=!1;return A}renderLayers(){let e=new re,t=new qs,n=this._renderer,r=this.isPresenting;this.isPresenting=!1;let s=new Oe;n.getSize(s);let o=n.getRenderTarget();for(let a of this._layers){a.renderTarget.isXRRenderTarget=this._session!==null,a.renderTarget._hasExternalTextures=a.renderTarget.isXRRenderTarget;let l=n.contextNode,c;if(a.renderTarget.isXRRenderTarget&&this._sessionUsesLayers){a.xrlayer.transform=new XRRigidTransform(a.plane.getWorldPosition(e),a.plane.getWorldQuaternion(t));let u=this._glBinding.getSubImage(a.xrlayer,this._xrFrame);n.backend.setXRRenderTargetTextures(a.renderTarget,u.colorTexture,void 0),n._setXRLayerSize(a.renderTarget.width,a.renderTarget.height),c=Nte.get(l),c===void 0&&(c=l.context({getOutput:f=>qz(f,n.toneMapping,n.outputColorSpace)}),Nte.set(l,c))}else c=l;n.contextNode=c,n.setRenderTarget(a.renderTarget),a.rendercall(),n.contextNode=l}n.setRenderTarget(o),n._setXRLayerSize(s.x,s.y),this.isPresenting=r}getSession(){return this._session}async setSession(e){let t=this._renderer;t.initialized===!1&&await t.init(),this._gl=t.getContext();let n=this._gl;if(this._session=e,e!==null){if(e.addEventListener("select",this._onSessionEvent),e.addEventListener("selectstart",this._onSessionEvent),e.addEventListener("selectend",this._onSessionEvent),e.addEventListener("squeeze",this._onSessionEvent),e.addEventListener("squeezestart",this._onSessionEvent),e.addEventListener("squeezeend",this._onSessionEvent),e.addEventListener("end",this._onSessionEnd),e.addEventListener("inputsourceschange",this._onInputSourcesChange),this._validateWebGPUSession(),this._currentPixelRatio=t.getPixelRatio(),t.getSize(this._currentSize),this._currentAnimationContext=t._animation.getContext(),this._currentAnimationLoop=t._animation.getAnimationLoop(),t._animation.stop(),this._isWebGPUSession())await this._initWebGPUSession(e);else if(this._supportsLayers===!0){let r=null,s=null,o=null,a=n.getContextAttributes();await t.backend.makeXRCompatible(),this.setFoveation(this.getFoveation()),t.depth&&(o=t.stencil?n.DEPTH24_STENCIL8:n.DEPTH_COMPONENT24,r=t.stencil?xo:Gs,s=t.stencil?ca:xi);let l={colorFormat:n.RGBA8,depthFormat:o,scaleFactor:this._framebufferScaleFactor,clearOnAccess:!1};this._useMultiviewIfPossible&&t.hasFeature("OVR_multiview2")&&(l.textureType="texture-array",this._useMultiview=!0),this._glBinding=this.getBinding();let c=this._glBinding.createProjectionLayer(l),u=[c];this._glProjLayer=c,t.setPixelRatio(1),t._setXRLayerSize(c.textureWidth,c.textureHeight);let f=this._useMultiview?2:1,d=new Cs(c.textureWidth,c.textureHeight,s,void 0,void 0,void 0,void 0,void 0,void 0,r,f);if(this._xrRenderTarget=new jg(c.textureWidth,c.textureHeight,{format:Or,type:Ji,colorSpace:t.outputColorSpace,depthTexture:d,stencilBuffer:t.stencil,samples:a.antialias?4:0,resolveDepthBuffer:c.ignoreDepthValues===!1,resolveStencilBuffer:c.ignoreDepthValues===!1,depth:this._useMultiview?2:1,multiview:this._useMultiview}),this._xrRenderTarget._hasExternalTextures=!0,this._xrRenderTarget.depth=this._useMultiview?2:1,this._sessionUsesLayers=e.enabledFeatures.includes("layers"),this._referenceSpace=await e.requestReferenceSpace(this.getReferenceSpaceType()),this._sessionUsesLayers)for(let A of this._layers)A.plane.material=new fs({color:16777215,side:A.type==="cylinder"?mi:ko}),A.plane.material.blending=Nd,A.plane.material.blendEquation=oo,A.plane.material.blendSrc=Bu,A.plane.material.blendDst=Bu,A.xrlayer=this._createXRLayer(A),u.unshift(A.xrlayer);e.updateRenderState({layers:u})}else{await t.backend.makeXRCompatible(),this.setFoveation(this.getFoveation());let r={antialias:t.currentSamples>0,alpha:!0,depth:t.depth,stencil:t.stencil,framebufferScaleFactor:this.getFramebufferScaleFactor()},s=new XRWebGLLayer(e,n,r);this._glBaseLayer=s,e.updateRenderState({baseLayer:s}),t.setPixelRatio(1),t._setXRLayerSize(s.framebufferWidth,s.framebufferHeight),this._xrRenderTarget=new jg(s.framebufferWidth,s.framebufferHeight,{format:Or,type:Ji,colorSpace:t.outputColorSpace,stencilBuffer:t.stencil,resolveDepthBuffer:s.ignoreDepthValues===!1,resolveStencilBuffer:s.ignoreDepthValues===!1}),this._xrRenderTarget._isOpaqueFramebuffer=!0,this._referenceSpace=await e.requestReferenceSpace(this.getReferenceSpaceType())}t._animation.setAnimationLoop(this._onAnimationFrame),t._animation.setContext(e),t._animation.start(),this.isPresenting=!0,this.dispatchEvent({type:"sessionstart"})}}updateCamera(e){let t=this._session;if(t===null)return;let n=e.near,r=e.far,s=this._cameraXR,o=this._cameraL,a=this._cameraR;s.near=a.near=o.near=n,s.far=a.far=o.far=r,s.isMultiViewCamera=this._useMultiview,(this._currentDepthNear!==s.near||this._currentDepthFar!==s.far)&&(t.updateRenderState({depthNear:s.near,depthFar:s.far}),this._currentDepthNear=s.near,this._currentDepthFar=s.far),s.layers.mask=e.layers.mask|6,o.layers.mask=s.layers.mask&-5,a.layers.mask=s.layers.mask&-3;let l=e.parent,c=s.cameras;Fte(s,l);for(let u=0;u<c.length;u++)Fte(c[u],l);c.length===2?APe(s,o,a):s.projectionMatrix.copy(o.projectionMatrix),gPe(e,s,l)}_getController(e){let t=this._controllers[e];return t===void 0&&(t=new s0,this._controllers[e]=t),t}};function APe(i,e,t){Lte.setFromMatrixPosition(e.matrixWorld),Dte.setFromMatrixPosition(t.matrixWorld);let n=Lte.distanceTo(Dte),r=e.projectionMatrix.elements,s=t.projectionMatrix.elements,o=r[14]/(r[10]-1),a=r[14]/(r[10]+1),l=(r[9]+1)/r[5],c=(r[9]-1)/r[5],u=(r[8]-1)/r[0],f=(s[8]+1)/s[0],d=o*u,A=o*f,y=n/(-u+f),w=y*-u;if(e.matrixWorld.decompose(i.position,i.quaternion,i.scale),i.translateX(w),i.translateZ(y),i.matrixWorld.compose(i.position,i.quaternion,i.scale),i.matrixWorldInverse.copy(i.matrixWorld).invert(),r[10]===-1)i.projectionMatrix.copy(e.projectionMatrix),i.projectionMatrixInverse.copy(e.projectionMatrixInverse);else{let S=o+y,T=a+y,R=d-w,P=A+(n-w),I=l*a/T*S,F=c*a/T*S;i.projectionMatrix.makePerspective(R,P,I,F,S,T),i.projectionMatrixInverse.copy(i.projectionMatrix).invert()}}function Fte(i,e){e===null?i.matrixWorld.copy(i.matrix):i.matrixWorld.multiplyMatrices(e.matrixWorld,i.matrix),i.matrixWorldInverse.copy(i.matrixWorld).invert()}function gPe(i,e,t){t===null?i.matrix.copy(e.matrixWorld):(i.matrix.copy(t.matrixWorld),i.matrix.invert(),i.matrix.multiply(e.matrixWorld)),i.matrix.decompose(i.position,i.quaternion,i.scale),i.updateMatrixWorld(!0),i.projectionMatrix.copy(e.projectionMatrix),i.projectionMatrixInverse.copy(e.projectionMatrixInverse),i.isPerspectiveCamera&&(i.fov=Rd*2*Math.atan(1/i.projectionMatrix.elements[5]),i.zoom=1)}function vPe(i){let e=this._controllerInputSources.indexOf(i.inputSource);if(e===-1)return;let t=this._controllers[e];if(t!==void 0){let n=this.getReferenceSpace();t.update(i.inputSource,i.frame,n),t.dispatchEvent({type:i.type,data:i.inputSource})}}function _Pe(){let i=this._session,e=this._renderer;i.removeEventListener("select",this._onSessionEvent),i.removeEventListener("selectstart",this._onSessionEvent),i.removeEventListener("selectend",this._onSessionEvent),i.removeEventListener("squeeze",this._onSessionEvent),i.removeEventListener("squeezestart",this._onSessionEvent),i.removeEventListener("squeezeend",this._onSessionEvent),i.removeEventListener("end",this._onSessionEnd),i.removeEventListener("inputsourceschange",this._onInputSourcesChange);for(let t=0;t<this._controllers.length;t++){let n=this._controllerInputSources[t];n!==null&&(this._controllerInputSources[t]=null,this._controllers[t].disconnect(n))}if(this._currentDepthNear=null,this._currentDepthFar=null,this._currentSamples!==null&&(e._samples=this._currentSamples,this._currentSamples=null),e._resetXRState(),this._disposeWebGPUSession(),this._session=null,this._xrRenderTarget=null,this._glBinding=null,this._webgpuBinding=null,this._glBaseLayer=null,this._glProjLayer=null,this._sessionUsesLayers===!0)for(let t of this._layers)t.renderTarget=new jg(t.pixelwidth,t.pixelheight,{format:Or,type:Ji,depthTexture:new Cs(t.pixelwidth,t.pixelheight,t.stencilBuffer?ca:xi,void 0,void 0,void 0,void 0,void 0,void 0,t.stencilBuffer?xo:Gs),stencilBuffer:t.stencilBuffer,resolveDepthBuffer:!1,resolveStencilBuffer:!1}),t.renderTarget.isXRRenderTarget=!1,t.plane.material=t.material,t.material.map=t.renderTarget.texture,t.material.map.offset.y=1,t.material.map.repeat.y=-1,delete t.xrlayer;this.isPresenting=!1,this._useMultiview=!1,e._animation.stop(),e._animation.setAnimationLoop(this._currentAnimationLoop),e._animation.setContext(this._currentAnimationContext),e._animation.start(),e.setPixelRatio(this._currentPixelRatio),e.setSize(this._currentSize.width,this._currentSize.height,!1),this.dispatchEvent({type:"sessionend"})}function xPe(i){let e=this._controllers,t=this._controllerInputSources;for(let n=0;n<i.removed.length;n++){let r=i.removed[n],s=t.indexOf(r);s>=0&&(t[s]=null,e[s].disconnect(r))}for(let n=0;n<i.added.length;n++){let r=i.added[n],s=t.indexOf(r);if(s===-1){for(let a=0;a<e.length;a++)if(a>=t.length){t.push(r),s=a;break}else if(t[a]===null){t[a]=r,s=a;break}if(s===-1)break}let o=e[s];o&&o.connect(r)}}function yPe(i){return i.type==="quad"?this._glBinding.createQuadLayer({transform:new XRRigidTransform(i.translation,i.quaternion),width:i.width/2,height:i.height/2,space:this._referenceSpace,viewPixelWidth:i.pixelwidth,viewPixelHeight:i.pixelheight,clearOnAccess:!1}):this._glBinding.createCylinderLayer({transform:new XRRigidTransform(i.translation,i.quaternion),radius:i.radius,centralAngle:i.centralAngle,aspectRatio:i.aspectRatio,space:this._referenceSpace,viewPixelWidth:i.pixelwidth,viewPixelHeight:i.pixelheight,clearOnAccess:!1})}function bPe(i,e){if(e===void 0)return;let t=this._cameraXR,n=this._renderer,r=n.backend,s=this._glBaseLayer,o=this.getReferenceSpace(),a=e.getViewerPose(o);if(this._xrFrame=e,a!==null){let l=a.views,c=this._isWebGPUSession()?this._getWebGPUViewData(l):null;this._glBaseLayer!==null&&c===null&&r.setXRTarget(s.framebuffer);let u=!1;l.length!==t.cameras.length&&(t.cameras.length=0,u=!0);for(let d=0;d<l.length;d++){let A=l[d],y;if(c!==null)y=c.viewports[d];else if(this._supportsLayers===!0){let S=this._glBinding.getViewSubImage(this._glProjLayer,A);y=S.viewport,d===0&&r.setXRRenderTargetTextures(this._xrRenderTarget,S.colorTexture,this._glProjLayer.ignoreDepthValues&&!this._useMultiview?void 0:S.depthStencilTexture)}else y=s.getViewport(A);let w=this._cameras[d];w===void 0&&(w=new $r,w.layers.enable(d),w.viewport=new xn,w.matrixWorldAutoUpdate=!1,this._cameras[d]=w),w.matrix.fromArray(A.transform.matrix),w.matrix.decompose(w.position,w.quaternion,w.scale),w.projectionMatrix.fromArray(A.projectionMatrix),w.projectionMatrixInverse.copy(w.projectionMatrix).invert(),w.viewport.set(y.x,y.y,y.width,y.height),d===0&&(t.matrix.copy(w.matrix),t.matrix.decompose(t.position,t.quaternion,t.scale)),u===!0&&t.cameras.push(w)}c!==null&&c.colorTexture!==null&&r.setXRRenderTargetTextures(this._xrRenderTarget,c.colorTexture,c.viewDescriptors),n.setOutputRenderTarget(this._xrRenderTarget);let f=n._getFrameBufferTarget();n.xr.foveateBoundTexture(f)}for(let l=0;l<this._controllers.length;l++){let c=this._controllerInputSources[l],u=this._controllers[l];c!==null&&u!==void 0&&u.update(c,e,o)}this._currentAnimationLoop&&this._currentAnimationLoop(i,e),e.detectedPlanes&&this.dispatchEvent({type:"planesdetected",data:e}),this._xrFrame=null}var d9=class extends la{constructor(e){super(),this.domElement=e,this._pixelRatio=1,this._width=this.domElement.width,this._height=this.domElement.height,this._viewport=new xn(0,0,this._width,this._height),this._scissor=new xn(0,0,this._width,this._height),this._scissorTest=!1,this.colorTexture=new XA,this.depthTexture=new Cs}getPixelRatio(){return this._pixelRatio}getDrawingBufferSize(e){return e.set(this._width*this._pixelRatio,this._height*this._pixelRatio).floor()}getSize(e){return e.set(this._width,this._height)}setPixelRatio(e=1){this._pixelRatio!==e&&(this._pixelRatio=e,this.setSize(this._width,this._height,!1))}setDrawingBufferSize(e,t,n){this.xr&&this.xr.isPresenting||(this._width=e,this._height=t,this._pixelRatio=n,this.domElement.width=Math.floor(e*n),this.domElement.height=Math.floor(t*n),this.setViewport(0,0,e,t),this._dispatchResize())}setSize(e,t,n=!0){this.xr&&this.xr.isPresenting||(this._width=e,this._height=t,this.domElement.width=Math.floor(e*this._pixelRatio),this.domElement.height=Math.floor(t*this._pixelRatio),n===!0&&(this.domElement.style.width=e+"px",this.domElement.style.height=t+"px"),this.setViewport(0,0,e,t),this._dispatchResize())}getScissor(e){let t=this._scissor;return e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height,e}setScissor(e,t,n,r){let s=this._scissor;e.isVector4?s.copy(e):s.set(e,t,n,r)}getScissorTest(){return this._scissorTest}setScissorTest(e){this._scissorTest=e}getViewport(e){return e.copy(this._viewport)}setViewport(e,t,n,r,s=0,o=1){let a=this._viewport;e.isVector4?a.copy(e):a.set(e,t,n,r),a.minDepth=s,a.maxDepth=o}_dispatchResize(){this.dispatchEvent({type:"resize"})}dispose(){this.dispatchEvent({type:"dispose"})}},Bte=new o0,X_=new Oe,oU=new xn,OR=new qc,UR=new O2,$_=new cn,Hd=new xn,wPe={[ko]:mi,[mi]:ko,[vr]:vr},p9=class{constructor(e,t={}){this.isRenderer=!0;let{logarithmicDepthBuffer:n=!1,reversedDepthBuffer:r=!1,alpha:s=!0,depth:o=!0,stencil:a=!1,antialias:l=!1,samples:c=0,getFallback:u=null,outputBufferType:f=Wi,multiview:d=!1}=t;this.backend=e,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.alpha=s,this.logarithmicDepthBuffer=n,this.reversedDepthBuffer=r,this.outputColorSpace=Fr,this.toneMapping=ao,this.toneMappingExposure=1,this.sortObjects=!0,this.depth=o,this.stencil=a,this.info=new j7,this.contextNode=tp(),this.library=new Z4,this.lighting=new h9,this._samples=c||l===!0?4:0,this._onCanvasTargetResize=this._onCanvasTargetResize.bind(this),this._canvasTarget=new d9(e.getDomElement()),this._canvasTarget.addEventListener("resize",this._onCanvasTargetResize),this._canvasTarget.isDefaultCanvasTarget=!0,this._inspector=new m4,this._inspector.setRenderer(this),this._getFallback=u,this._attributes=null,this._geometries=null,this._nodes=null,this._animation=null,this._bindings=null,this._objects=null,this._pipelines=null,this._bundles=null,this._renderLists=null,this._renderContexts=null,this._textures=null,this._background=null,this._quadCache=new Map,this._currentRenderContext=null,this._opaqueSort=null,this._transparentSort=null,this._frameBufferTargets=new Map;let A=this.alpha===!0?0:1;this._clearColor=new wS(0,0,0,A),this._clearDepth=1,this._clearStencil=0,this._renderTarget=null,this._activeCubeFace=0,this._activeMipmapLevel=0,this._outputRenderTarget=null,this._mrt=null,this._renderObjectFunction=null,this._currentRenderObjectFunction=null,this._currentRenderBundle=null,this._handleObjectFunction=this._renderObjectDirect,this._isDeviceLost=!1,this.onDeviceLost=this._onDeviceLost,this.onError=this._onError,this._outputBufferType=f,this._cacheShadowNodes=new WeakMap,this._initialized=!1,this._callDepth=-1,this._initPromise=null,this._compilationPromises=null,this._currentSourceMaterial=null,this.transparent=!0,this.opaque=!0,this.shadowMap={enabled:!1,transmitted:!1,type:p0},this.xr=new f9(this,d),this.debug={checkShaderErrors:!0,onShaderError:null,getShaderAsync:async(y,w,S)=>{await this.compileAsync(S,w,y);let R=this.needsFrameBufferTarget&&this._renderTarget===null?this._getFrameBufferTarget():this._renderTarget||this._outputRenderTarget,P=this._renderLists.get(y,w),I=this._renderContexts.get(R,this._mrt),F=y.overrideMaterial||S.material,D=this._objects.get(S,F,y,w,P.lightsNode,I,I.clippingContext),{fragmentShader:L,vertexShader:C}=D.getNodeBuilderState();return{fragmentShader:L,vertexShader:C}}}}async init(){return this._initPromise!==null?this._initPromise:(this._initPromise=new Promise(async(e,t)=>{let n=this.backend;try{await n.init(this)}catch(r){if(this._getFallback!==null)try{this.backend=n=this._getFallback(r),await n.init(this)}catch(s){t(s);return}else{t(r);return}}this._nodes=new l9(this,n),this._animation=new V7(this,this._nodes,this.info),this._attributes=new H7(n,this.info),this._background=new Pk(this,this._nodes),this._geometries=new W7(this._attributes,this.info),this._textures=new tk(this,n,this.info),this._pipelines=new Y7(n,this._nodes,this.info),this._bindings=new Z7(n,this._nodes,this._textures,this._attributes,this._pipelines,this.info),this._objects=new q7(this,this._nodes,this._geometries,this._pipelines,this._bindings,this.info),this._renderLists=new Q7(this.lighting),this._bundles=new u9,this._renderContexts=new ek(this),this._animation.start(),this._initialized=!0,this._inspector.init(),e(this)}),this._initPromise)}get domElement(){return this._canvasTarget.domElement}get coordinateSystem(){return this.backend.coordinateSystem}async compileAsync(e,t,n=null){if(this._isDeviceLost===!0)return;this._initialized===!1&&await this.init();let r=this._nodes.nodeFrame,s=r.renderId,o=this._currentRenderContext,a=this._currentRenderObjectFunction,l=this._handleObjectFunction,c=this._compilationPromises;n===null&&(n=e);let u=e.isScene===!0?e:n.isScene===!0?n:Bte,d=this.needsFrameBufferTarget&&this._renderTarget===null?this._getFrameBufferTarget():this._renderTarget||this._outputRenderTarget,A=this._renderContexts.get(d,this._mrt),y=this._activeMipmapLevel,w=[];this._currentRenderContext=A,this._currentRenderObjectFunction=this.renderObject,this._handleObjectFunction=this._createObjectPipeline,this._compilationPromises=w,r.renderId++,r.update(),A.depth=this.depth,A.stencil=this.stencil,A.clippingContext||(A.clippingContext=new Y4),A.clippingContext.updateGlobal(u,t),e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t=this._updateCamera(t),u.onBeforeRender(this,e,t,d);let S=t.isArrayCamera?UR:OR;t.isArrayCamera?S.setFromArrayCamera(t):($_.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),S.setFromProjectionMatrix($_,t.coordinateSystem,t.reversedDepth));let T=this._renderLists.get(u,t);if(T.begin(),this._projectObject(e,t,0,T,A.clippingContext),n!==e&&n.traverseVisible(function(D){D.isLight&&D.layers.test(t.layers)&&T.pushLight(D)}),T.finish(),d!==null){this._textures.updateRenderTarget(d,y);let D=this._textures.get(d);A.textures=D.textures,A.depthTexture=D.depthTexture}else A.textures=null,A.depthTexture=null;n!==e?this._background.update(n,T,A):this._background.update(u,T,A);let R=T.opaque,P=T.transparent,I=T.transparentDoublePass,F=T.lightsNode;this.opaque===!0&&R.length>0&&this._renderObjects(R,t,u,F),this.transparent===!0&&P.length>0&&this._renderTransparents(P,I,t,u,F),r.renderId=s,this._currentRenderContext=o,this._currentRenderObjectFunction=a,this._handleObjectFunction=l,this._compilationPromises=c;for(let D of w){let L=this._objects.get(D.object,D.material,D.scene,D.camera,D.lightsNode,D.renderContext,D.clippingContext,D.passId);L.drawRange=D.object.geometry.drawRange,L.group=D.group,await this._nodes.getForRenderAsync(L),this._nodes.updateBefore(L),this._geometries.updateForRender(L),this._nodes.updateForRender(L),this._bindings.updateForRender(L);let C=[];this._pipelines.getForRender(L,C),C.length>0&&await Promise.all(C),this._nodes.updateAfter(L),await hF()}}async renderAsync(e,t){ni('Renderer: "renderAsync()" has been deprecated. Use "render()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.render(e,t)}async waitForGPU(){ze("Renderer: waitForGPU() has been removed. Read https://github.com/mrdoob/three.js/issues/32012 for more information.")}set inspector(e){this._inspector!==null&&this._inspector.setRenderer(null),this._inspector=e,this._inspector.setRenderer(this)}get inspector(){return this._inspector}set highPrecision(e){let t=this.contextNode.value;e===!0?(t.modelViewMatrix=XU,t.modelNormalViewMatrix=$U):this.highPrecision&&(delete t.modelViewMatrix,delete t.modelNormalViewMatrix)}get highPrecision(){let e=this.contextNode.value;return e.modelViewMatrix===XU&&e.modelNormalViewMatrix===$U}setMRT(e){return this._mrt=e,this}getMRT(){return this._mrt}getOutputBufferType(){return this._outputBufferType}getColorBufferType(){return ni('Renderer: ".getColorBufferType()" has been renamed to ".getOutputBufferType()".'),this.getOutputBufferType()}_onDeviceLost(e){let t=`THREE.WebGPURenderer: ${e.api} Device Lost:41674167 41684168 Message: ${e.message}`;e.reason&&(t+=`4169-Reason: ${e.reason}`),ze(t),this._isDeviceLost=!0}_onError(e){let t=`WebGPURenderer: Uncaptured ${e.api} ${e.type}`;e.message&&(t+=`: ${e.message}`),ze(t)}_bundleNeedsUpdate(e,t){return t.bundleGPU===void 0||e.version!==t.version}_renderBundle(e,t,n){let{bundleGroup:r,camera:s,renderList:o}=e,a=this._currentRenderContext,l=this._bundles.get(r,s,a),c=this.backend.get(l);if(this._bundleNeedsUpdate(r,c)){this.backend.beginBundle(a),this._currentRenderBundle=l;let{transparentDoublePass:f,transparent:d,opaque:A}=o;this.opaque===!0&&A.length>0&&this._renderObjects(A,s,t,n),this.transparent===!0&&d.length>0&&this._renderTransparents(d,f,s,t,n),this._currentRenderBundle=null,this.backend.finishBundle(a,l),c.version=r.version}else{let{renderObjects:f}=c;for(let d=0,A=f.length;d<A;d++){let y=f[d];this._nodes.needsRefresh(y)&&(this._nodes.updateBefore(y),this._geometries.updateForRender(y),this._nodes.updateForRender(y),this._bindings.updateForRender(y),this._nodes.updateAfter(y))}}this.backend.addBundle(a,l)}render(e,t){if(this._initialized===!1)throw new Error('THREE.Renderer: .render() called before the backend is initialized. Use "await renderer.init();" before rendering.');this._renderScene(e,t)}get initialized(){return this._initialized}_renderOutputLayers(e,t){if(t.texture.isArrayTexture!==!0||t.texture.image.depth<=1){this._renderScene(e,e.camera,!1);return}let n=this._activeCubeFace;try{for(let r=0;r<t.texture.image.depth;r++)this._nodes.setOutputLayerIndex(r),this._activeCubeFace=r,this._renderScene(e,e.camera,!1)}finally{this._nodes.setOutputLayerIndex(0),this._activeCubeFace=n}}_getFrameBufferTarget(){let{currentToneMapping:e,currentColorSpace:t}=this,n=e!==ao,r=t!==ln.workingColorSpace;if(n===!1&&r===!1)return null;let{width:s,height:o}=this.getDrawingBufferSize(W_),{depth:a,stencil:l}=this,c=this._outputRenderTarget||this._canvasTarget,u=this._frameBufferTargets.get(c);if(u===void 0){u=new Fa(s,o,{depthBuffer:a,stencilBuffer:l,type:this._outputBufferType,format:Or,colorSpace:ln.workingColorSpace,generateMipmaps:!1,minFilter:Mi,magFilter:Mi,samples:this.samples}),u.isPostProcessingRenderTarget=!0;let S=()=>{c.removeEventListener("dispose",S),u.dispose(),this._frameBufferTargets.delete(c)};c.addEventListener("dispose",S),this._frameBufferTargets.set(c,u)}let f=this.getOutputRenderTarget();u.depthBuffer=a,u.stencilBuffer=l,f!==null?u.setSize(f.width,f.height,f.depth):u.setSize(s,o,1);let d=this._outputRenderTarget?this._outputRenderTarget.viewport:c._viewport,A=this._outputRenderTarget?this._outputRenderTarget.scissor:c._scissor,y=this._outputRenderTarget?1:c._pixelRatio,w=this._outputRenderTarget?this._outputRenderTarget.scissorTest:c._scissorTest;return u.viewport.copy(d),u.scissor.copy(A),u.viewport.multiplyScalar(y),u.scissor.multiplyScalar(y),u.scissorTest=w,u.multiview=f!==null?f.multiview:!1,u.useArrayDepthTexture=f!==null?f.useArrayDepthTexture:!1,u.resolveDepthBuffer=f!==null?f.resolveDepthBuffer:!0,u._autoAllocateDepthBuffer=f!==null?f._autoAllocateDepthBuffer:!1,u}_renderScene(e,t,n=!0){if(this._isDeviceLost===!0)return;let r=n?this._getFrameBufferTarget():null,s=this._nodes.nodeFrame,o=s.renderId,a=this._currentRenderContext,l=this._currentRenderObjectFunction,c=this._handleObjectFunction;this.lighting.beginRender(e),this._callDepth++;let u=e.isScene===!0?e:Mte,f=this._renderTarget||this._outputRenderTarget,d=this._activeCubeFace,A=this._activeMipmapLevel,y;if(r!==null?(y=r,this.setRenderTarget(y)):y=f,y!==null&&y.depthBuffer===!0){let W=this._textures.get(y);W.depthInitialized!==!0&&((this.autoClear===!1||this.autoClear===!0&&this.autoClearDepth===!1)&&this.clearDepth(),W.depthInitialized=!0)}let w=this._renderContexts.get(y,this._mrt,this._callDepth);this._currentRenderContext=w,this._currentRenderObjectFunction=this._renderObjectFunction||this.renderObject,this._handleObjectFunction=this._renderObjectDirect,this.info.calls++,this.info.render.calls++,this.info.render.frameCalls++,s.renderId=this.info.calls,this.backend.updateTimeStampUID(w),this.inspector.beginRender(this.backend.getTimestampUID(w),e,t,y),e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t=this._updateCamera(t);let S=this._canvasTarget,T=S._viewport,R=S._scissor,P=S._pixelRatio;y!==null&&(T=y.viewport,R=y.scissor,P=1),this.getDrawingBufferSize(W_),QO.set(0,0,W_.width,W_.height);let I=T.minDepth===void 0?0:T.minDepth,F=T.maxDepth===void 0?1:T.maxDepth;w.viewportValue.copy(T).multiplyScalar(P).floor(),w.viewportValue.width>>=A,w.viewportValue.height>>=A,w.viewportValue.minDepth=I,w.viewportValue.maxDepth=F,w.viewport=w.viewportValue.equals(QO)===!1,w.scissorValue.copy(R).multiplyScalar(P).floor(),w.scissor=S._scissorTest&&w.scissorValue.equals(QO)===!1,w.scissorValue.width>>=A,w.scissorValue.height>>=A,w.clippingContext||(w.clippingContext=new W4),w.clippingContext.updateGlobal(u,t),u.onBeforeRender(this,e,t,y);let D=t.isArrayCamera?NR:DR;t.isArrayCamera?D.setFromArrayCamera(t):(j_.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),D.setFromProjectionMatrix(j_,t.coordinateSystem,t.reversedDepth));let L=this._renderLists.get(e,t);if(L.begin(),this._projectObject(e,t,0,L,w.clippingContext),L.finish(),this.sortObjects===!0&&L.sort(this._opaqueSort,this._transparentSort,t.reversedDepth),y!==null){this._textures.updateRenderTarget(y,A);let W=this._textures.get(y);w.textures=W.textures,w.depthTexture=W.depthTexture,w.width=W.width,w.height=W.height,w.renderTarget=y,w.depth=y.depthBuffer,w.stencil=y.stencilBuffer}else w.textures=null,w.depthTexture=null,w.width=W_.width,w.height=W_.height,w.depth=this.depth,w.stencil=this.stencil;w.width>>=A,w.height>>=A,w.activeCubeFace=d,w.activeMipmapLevel=A,w.occlusionQueryCount=L.occlusionQueryCount,w.scissorValue.max(Wd.set(0,0,0,0)),w.scissorValue.x+w.scissorValue.width>w.width&&(w.scissorValue.width=Math.max(w.width-w.scissorValue.x,0)),w.scissorValue.y+w.scissorValue.height>w.height&&(w.scissorValue.height=Math.max(w.height-w.scissorValue.y,0)),this._background.update(u,L,w),w.camera=t,this.backend.beginRender(w);let{bundles:C,lightsNode:B,transparentDoublePass:k,transparent:z,opaque:G}=L;return C.length>0&&this._renderBundles(C,u,B),this.opaque===!0&&G.length>0&&this._renderObjects(G,t,u,B),this.transparent===!0&&z.length>0&&this._renderTransparents(z,k,t,u,B),this.backend.finishRender(w),s.renderId=o,this._currentRenderContext=a,this._currentRenderObjectFunction=l,this._handleObjectFunction=c,this.lighting.finishRender(e),this._callDepth--,r!==null&&(this.setRenderTarget(f,d,A),this._renderOutput(y)),u.onAfterRender(this,e,t,y),this.inspector.finishRender(this.backend.getTimestampUID(w)),w}_setXRLayerSize(e,t){this._canvasTarget._width=e,this._canvasTarget._height=t,this.setViewport(0,0,e,t)}_renderOutput(e){let t=this._nodes.getOutputCacheKey(),n=this._quadCache.get(e.texture),r;if(n===void 0){r=new bS(new Ir),r.name="Output Color Transform",r.material.name="outputColorTransform",r.material.fragmentNode=this._nodes.getOutputNode(e.texture),n={quad:r,cacheKey:t},this._quadCache.set(e.texture,n);let a=()=>{r.material.dispose(),this._quadCache.delete(e.texture),e.texture.removeEventListener("dispose",a)};e.texture.addEventListener("dispose",a)}else r=n.quad,n.cacheKey!==t&&(r.material.fragmentNode=this._nodes.getOutputNode(e.texture),r.material.needsUpdate=!0,n.cacheKey=t);let s=this.autoClear,o=this.xr.enabled;this.autoClear=!1,this.xr.enabled=!1,this._renderOutputLayers(r,e),this.autoClear=s,this.xr.enabled=o}getMaxAnisotropy(){return this.backend.capabilities.getMaxAnisotropy()}getActiveCubeFace(){return this._activeCubeFace}getActiveMipmapLevel(){return this._activeMipmapLevel}async setAnimationLoop(e){this._initialized===!1&&await this.init(),this._animation.setAnimationLoop(e)}getAnimationLoop(){return this._animation.getAnimationLoop()}async getArrayBufferAsync(e,t=null,n=0,r=-1){if(t!==null&&t.isReadbackBuffer&&this.info.memoryMap.has(t)===!1){this.info.createReadbackBuffer(t);let s=()=>{t.removeEventListener("dispose",s),this.info.destroyReadbackBuffer(t)};t.addEventListener("dispose",s)}if(n%4!==0||r>0&&r%4!==0)throw new Error('THREE.Renderer: "getArrayBufferAsync()" offset and count must be a multiple of 4.');return await this.backend.getArrayBufferAsync(e,t,n,r)}getContext(){return this.backend.getContext()}getPixelRatio(){return this._canvasTarget.getPixelRatio()}getDrawingBufferSize(e){return this._canvasTarget.getDrawingBufferSize(e)}getSize(e){return this._canvasTarget.getSize(e)}setPixelRatio(e=1){this._canvasTarget.setPixelRatio(e)}setDrawingBufferSize(e,t,n){this.xr&&this.xr.isPresenting||this._canvasTarget.setDrawingBufferSize(e,t,n)}setSize(e,t,n=!0){this.xr&&this.xr.isPresenting||this._canvasTarget.setSize(e,t,n)}setOpaqueSort(e){this._opaqueSort=e}setTransparentSort(e){this._transparentSort=e}getScissor(e){return this._canvasTarget.getScissor(e)}setScissor(e,t,n,r){this._canvasTarget.setScissor(e,t,n,r)}getScissorTest(){return this._canvasTarget.getScissorTest()}setScissorTest(e){this._canvasTarget.setScissorTest(e),this.backend.setScissorTest(e)}getViewport(e){return this._canvasTarget.getViewport(e)}setViewport(e,t,n,r,s=0,o=1){this._canvasTarget.setViewport(e,t,n,r,s,o)}getClearColor(e){return e.copy(this._clearColor)}setClearColor(e,t=1){this._clearColor.set(e),this._clearColor.a=t}getClearAlpha(){return this._clearColor.a}setClearAlpha(e){this._clearColor.a=e}getClearDepth(){return this.reversedDepthBuffer===!0?1-this._clearDepth:this._clearDepth}setClearDepth(e){this._clearDepth=e}getClearStencil(){return this._clearStencil}setClearStencil(e){this._clearStencil=e}isOccluded(e){let t=this._currentRenderContext;return t&&this.backend.isOccluded(t,e)}clear(e=!0,t=!0,n=!0){if(this._initialized===!1)throw new Error('THREE.Renderer: .clear() called before the backend is initialized. Use "await renderer.init();" before using this method.');let r=this._renderTarget||this._getFrameBufferTarget(),s=null;if(r!==null){this._textures.updateRenderTarget(r);let o=this._textures.get(r);s=this._renderContexts.get(r,null,-1),s.textures=o.textures,s.depthTexture=o.depthTexture,s.width=o.width,s.height=o.height,s.renderTarget=r,s.depth=r.depthBuffer,s.stencil=r.stencilBuffer;let a=this.backend.getClearColor();s.clearColorValue.r=a.r,s.clearColorValue.g=a.g,s.clearColorValue.b=a.b,s.clearColorValue.a=a.a,s.clearDepthValue=this.getClearDepth(),s.clearStencilValue=this.getClearStencil(),s.activeCubeFace=this.getActiveCubeFace(),s.activeMipmapLevel=this.getActiveMipmapLevel(),r.depthBuffer===!0&&(o.depthInitialized=!0)}this.backend.clear(e,t,n,s),r!==null&&this._renderTarget===null&&this._renderOutput(r)}clearColor(){this.clear(!0,!1,!1)}clearDepth(){this.clear(!1,!0,!1)}clearStencil(){this.clear(!1,!1,!0)}async clearAsync(e=!0,t=!0,n=!0){ni('Renderer: "clearAsync()" has been deprecated. Use "clear()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.clear(e,t,n)}async clearColorAsync(){ni('Renderer: "clearColorAsync()" has been deprecated. Use "clearColor()" and "await renderer.init();" when creating the renderer.'),this.clear(!0,!1,!1)}async clearDepthAsync(){ni('Renderer: "clearDepthAsync()" has been deprecated. Use "clearDepth()" and "await renderer.init();" when creating the renderer.'),this.clear(!1,!0,!1)}async clearStencilAsync(){ni('Renderer: "clearStencilAsync()" has been deprecated. Use "clearStencil()" and "await renderer.init();" when creating the renderer.'),this.clear(!1,!1,!0)}get needsFrameBufferTarget(){let e=this.currentToneMapping!==ao,t=this.currentColorSpace!==ln.workingColorSpace;return e||t}get samples(){return this._samples}get currentSamples(){let e=this._samples;return this._renderTarget!==null?e=this._renderTarget.samples:this.needsFrameBufferTarget&&(e=0),e}get currentToneMapping(){return this.isOutputTarget?this.toneMapping:ao}get currentColorSpace(){return this.isOutputTarget?this.outputColorSpace:ln.workingColorSpace}get isOutputTarget(){return this._renderTarget===this._outputRenderTarget||this._renderTarget===null}dispose(){if(this._initialized===!0){this.info.dispose(),this.backend.dispose(),this._animation.dispose(),this._objects.dispose(),this._geometries.dispose(),this._pipelines.dispose(),this._nodes.dispose(),this._bindings.dispose(),this._renderLists.dispose(),this._renderContexts.dispose(),this._textures.dispose();for(let e of this._frameBufferTargets.keys())e.dispose();Object.values(this.backend.timestampQueryPool).forEach(e=>{e!==null&&e.dispose()})}this.setRenderTarget(null),this.setAnimationLoop(null)}setRenderTarget(e,t=0,n=0){this._renderTarget=e,this._activeCubeFace=t,this._activeMipmapLevel=n}getRenderTarget(){return this._renderTarget}setOutputRenderTarget(e){this._outputRenderTarget=e}getOutputRenderTarget(){return this._outputRenderTarget}setCanvasTarget(e){this._canvasTarget.removeEventListener("resize",this._onCanvasTargetResize),this._canvasTarget=e,this._canvasTarget.addEventListener("resize",this._onCanvasTargetResize)}getCanvasTarget(){return this._canvasTarget}_resetXRState(){this.backend.setXRTarget(null),this.setOutputRenderTarget(null),this.setRenderTarget(null);for(let e of this._frameBufferTargets.keys())e.dispose()}setRenderObjectFunction(e){this._renderObjectFunction=e}getRenderObjectFunction(){return this._renderObjectFunction}compute(e,t=null){if(this._isDeviceLost===!0)return;if(this._initialized===!1)return Xe("Renderer: .compute() called before the backend is initialized. Try using .computeAsync() instead."),this.computeAsync(e,t);let n=this._nodes.nodeFrame,r=n.renderId;this.info.calls++,this.info.compute.calls++,this.info.compute.frameCalls++,n.renderId=this.info.calls,this.backend.updateTimeStampUID(e),this.inspector.beginCompute(this.backend.getTimestampUID(e),e);let s=this.backend,o=this._pipelines,a=this._bindings,l=this._nodes,c=Array.isArray(e)?e:[e];if(c[0]===void 0||c[0].isComputeNode!==!0)throw new Error("THREE.Renderer: .compute() expects a ComputeNode.");s.beginCompute(e);for(let u of c){if(o.has(u)===!1){let A=()=>{u.removeEventListener("dispose",A),o.delete(u),a.deleteForCompute(u),l.delete(u)};u.addEventListener("dispose",A);let y=u.onInitFunction;y!==null&&y.call(u,{renderer:this})}l.updateForCompute(u),a.updateForCompute(u);let f=a.getForCompute(u),d=o.getForCompute(u,f);s.compute(e,u,f,d,t)}s.finishCompute(e),n.renderId=r,this.inspector.finishCompute(this.backend.getTimestampUID(e))}async computeAsync(e,t=null){this._initialized===!1&&await this.init(),this.compute(e,t)}async hasFeatureAsync(e){return ni('Renderer: "hasFeatureAsync()" has been deprecated. Use "hasFeature()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.hasFeature(e)}async resolveTimestampsAsync(e="render"){return this._initialized===!1&&await this.init(),this.backend.resolveTimestampsAsync(e)}hasFeature(e){if(this._initialized===!1)throw new Error('THREE.Renderer: .hasFeature() called before the backend is initialized. Use "await renderer.init();" before using this method.');return this.backend.hasFeature(e)}hasInitialized(){return this._initialized}async initTextureAsync(e){ni('Renderer: "initTextureAsync()" has been deprecated. Use "initTexture()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.initTexture(e)}initTexture(e){if(this._initialized===!1)throw new Error('THREE.Renderer: .initTexture() called before the backend is initialized. Use "await renderer.init();" before using this method.');this._textures.updateTexture(e)}initRenderTarget(e){if(this._initialized===!1)throw new Error('THREE.Renderer: .initRenderTarget() called before the backend is initialized. Use "await renderer.init();" before using this method.');this._textures.updateRenderTarget(e);let t=this._textures.get(e),n=this._renderContexts.get(e);n.textures=t.textures,n.depthTexture=t.depthTexture,n.width=t.width,n.height=t.height,n.renderTarget=e,n.depth=e.depthBuffer,n.stencil=e.stencilBuffer,this.backend.initRenderTarget(n)}copyFramebufferToTexture(e,t=null){if(t!==null)if(t.isVector2)t=Wd.set(t.x,t.y,e.image.width,e.image.height).floor();else if(t.isVector4)t=Wd.copy(t).floor();else{ze("Renderer.copyFramebufferToTexture: Invalid rectangle.");return}else t=Wd.set(0,0,e.image.width,e.image.height);let n=this._currentRenderContext,r;n!==null?r=n.renderTarget:(r=this._renderTarget||this._getFrameBufferTarget(),r!==null&&(this._textures.updateRenderTarget(r),n=this._textures.get(r))),this._textures.updateTexture(e,{renderTarget:r}),this.backend.copyFramebufferToTexture(e,n,t),this._inspector.copyFramebufferToTexture(e)}copyTextureToTexture(e,t,n=null,r=null,s=0,o=0){this._textures.updateTexture(e),this._textures.updateTexture(t),this.backend.copyTextureToTexture(e,t,n,r,s,o),this._inspector.copyTextureToTexture(e,t)}async readRenderTargetPixelsAsync(e,t,n,r,s,o=0,a=0){return this.backend.copyTextureToBuffer(e.textures[o],t,n,r,s,a)}_projectObject(e,t,n,r,s){if(e.visible===!1)return;if(e.layers.test(t.layers)){if(e.isGroup)n=e.renderOrder,e.isClippingGroup&&e.enabled&&(s=s.getGroupContext(e));else if(e.isLOD)e.autoUpdate===!0&&e.update(t);else if(e.isLight)r.pushLight(e);else if(e.isSprite){let l=t.isArrayCamera?NR:DR;if(!e.frustumCulled||l.intersectsSprite(e)){this.sortObjects===!0&&Wd.setFromMatrixPosition(e.matrixWorld).applyMatrix4(j_);let{geometry:c,material:u}=e;u.visible&&r.push(e,c,u,n,Wd.z,null,s)}}else if(e.isLineLoop)ze("Renderer: Objects of type THREE.LineLoop are not supported. Please use THREE.Line or THREE.LineSegments.");else if(e.isMesh||e.isLine||e.isPoints){let l=t.isArrayCamera?NR:DR;if(!e.frustumCulled||l.intersectsObject(e)){let{geometry:c,material:u}=e;if(this.sortObjects===!0&&(c.boundingSphere===null&&c.computeBoundingSphere(),Wd.copy(c.boundingSphere.center).applyMatrix4(e.matrixWorld).applyMatrix4(j_)),Array.isArray(u)){let f=c.groups;for(let d=0,A=f.length;d<A;d++){let y=f[d],w=u[y.materialIndex];w&&w.visible&&r.push(e,c,w,n,Wd.z,y,s)}}else u.visible&&r.push(e,c,u,n,Wd.z,null,s)}}}if(e.isBundleGroup===!0&&this.backend.beginBundle!==void 0){let l=r;r=this._renderLists.get(e,t);let c=this._bundles.get(e,t,this._currentRenderContext),u=this.backend.get(c);if(this._bundleNeedsUpdate(e,u)){r.begin(),u.renderObjects===void 0?u.renderObjects=[]:u.renderObjects.length=0;let d=e.children;for(let A=0,y=d.length;A<y;A++)this._projectObject(d[A],t,n,r,s);r.finish()}l.pushBundle({bundleGroup:e,camera:t,renderList:r});return}let a=e.children;for(let l=0,c=a.length;l<c;l++)this._projectObject(a[l],t,n,r,s)}_renderBundles(e,t,n){for(let r of e)this._renderBundle(r,t,n)}_renderTransparents(e,t,n,r,s){if(t.length>0){for(let{material:o}of t)o.side=mi;this._renderObjects(t,n,r,s,"backSide");for(let{material:o}of t)o.side=ko;this._renderObjects(e,n,r,s);for(let{material:o}of t)o.side=vr}else this._renderObjects(e,n,r,s)}_renderObjects(e,t,n,r,s=null){for(let o=0,a=e.length;o<a;o++){let{object:l,geometry:c,material:u,group:f,clippingContext:d}=e[o];this._currentRenderObjectFunction(l,n,t,c,u,f,r,d,s)}}_getShadowNodes(e){let t=e.version,n=this._cacheShadowNodes.get(e);if(n===void 0||n.version!==t){let r=e.map&&e.map.isTexture,s=e.colorNode&&e.colorNode.isNode,o=e.castShadowNode&&e.castShadowNode.isNode,a=e.maskShadowNode&&e.maskShadowNode.isNode||e.maskNode&&e.maskNode.isNode,l=null,c=null,u=null;if(r||s||o||a){let f,d;if(o?(f=e.castShadowNode.rgb,d=e.castShadowNode.a,this.shadowMap.transmitted!==!0&&ni("Renderer: `shadowMap.transmitted` needs to be set to `true` when using `material.castShadowNode`.")):(f=pe(0),d=oe(1)),r&&(d=d.mul(mr("map","texture",e).a)),s&&(d=d.mul(e.colorNode.a)),c=Ft(f,d),a){let A=e.maskShadowNode||e.maskNode;c=me(([y])=>(A.not().discard(),y))(c)}}e.depthNode&&e.depthNode.isNode&&(u=e.depthNode),e.castShadowPositionNode&&e.castShadowPositionNode.isNode?l=e.castShadowPositionNode:e.positionNode&&e.positionNode.isNode&&(l=e.positionNode),n={version:t,colorNode:c,depthNode:u,positionNode:l},this._cacheShadowNodes.set(e,n)}return n}_updateCamera(e){let t=this.xr;if(t.isPresenting===!1){let n=!1;if(this.reversedDepthBuffer===!0&&e.reversedDepth!==!0){if(e._reversedDepth=!0,e.isArrayCamera)for(let s of e.cameras)s._reversedDepth=!0;n=!0}let r=this.coordinateSystem;if(e.coordinateSystem!==r){if(e.coordinateSystem=r,e.isArrayCamera)for(let s of e.cameras)s.coordinateSystem=r;n=!0}if(n===!0&&(e.updateProjectionMatrix(),e.isArrayCamera))for(let s of e.cameras)s.updateProjectionMatrix()}return e.parent===null&&e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t.enabled===!0&&t.isPresenting===!0&&(t.cameraAutoUpdate===!0&&t.updateCamera(e),e=t.getCamera()),e}renderObject(e,t,n,r,s,o,a,l=null,c=null){let u=!1,f,d,A,y,w,S,T,R=this._currentSourceMaterial;if(e.onBeforeRender(this,t,n,r,s,o),s.allowOverride===!0&&t.overrideMaterial!==null){this._currentSourceMaterial=s;let P=t.overrideMaterial;if(u=!0,f=P.isNodeMaterial?P.colorNode:null,d=P.isNodeMaterial?P.depthNode:null,A=P.isNodeMaterial?P.positionNode:null,y=t.overrideMaterial.side,w=P.displacementMap,S=P.displacementScale,T=P.displacementBias,s.positionNode&&s.positionNode.isNode&&(P.positionNode=s.positionNode),P.alphaTest=s.alphaTest,P.alphaMap=s.alphaMap,P.displacementMap=s.displacementMap,P.displacementScale=s.displacementScale,P.displacementBias=s.displacementBias,P.transparent=s.transparent||s.transmission>0||s.transmissionNode&&s.transmissionNode.isNode||s.backdropNode&&s.backdropNode.isNode,P.isShadowPassMaterial){let{colorNode:I,depthNode:F,positionNode:D}=this._getShadowNodes(s);this.shadowMap.type===qc?P.side=s.shadowSide!==null?s.shadowSide:s.side:P.side=s.shadowSide!==null?s.shadowSide:iPe[s.side],I!==null&&(P.colorNode=I),F!==null&&(P.depthNode=F),D!==null&&(P.positionNode=D)}s=P}s.transparent===!0&&s.side===vr&&s.forceSinglePass===!1?(s.side=mi,this._handleObjectFunction(e,s,t,n,a,o,l,"backSide"),s.side=ko,this._handleObjectFunction(e,s,t,n,a,o,l,c),s.side=vr):this._handleObjectFunction(e,s,t,n,a,o,l,c),u&&(t.overrideMaterial.colorNode=f,t.overrideMaterial.depthNode=d,t.overrideMaterial.positionNode=A,t.overrideMaterial.side=y,t.overrideMaterial.displacementMap=w,t.overrideMaterial.displacementScale=S,t.overrideMaterial.displacementBias=T),this._currentSourceMaterial=R,e.onAfterRender(this,t,n,r,s,o)}hasCompatibility(e){if(this._initialized===!1)throw new Error('THREE.Renderer: .hasCompatibility() called before the backend is initialized. Use "await renderer.init();" before using this method.');return this.backend.hasCompatibility(e)}_renderObjectDirect(e,t,n,r,s,o,a,l){let c=this._objects.get(e,t,n,r,s,this._currentRenderContext,a,l);c.drawRange=e.geometry.drawRange,c.group=o,this._currentRenderBundle!==null&&(this.backend.get(this._currentRenderBundle).renderObjects.push(c),c.bundle=this._currentRenderBundle.bundleGroup);let u=this._nodes.needsRefresh(c);u&&(this._nodes.updateBefore(c),this._geometries.updateForRender(c),this._nodes.updateForRender(c),this._bindings.updateForRender(c)),this._pipelines.updateForRender(c),this._pipelines.isReady(c)&&(this.backend.draw(c,this.info),u&&this._nodes.updateAfter(c))}_createObjectPipeline(e,t,n,r,s,o,a,l){if(this._compilationPromises!==null){this._compilationPromises.push({object:e,material:t,scene:n,camera:r,lightsNode:s,group:o,clippingContext:a,passId:l,renderContext:this._currentRenderContext});return}let c=this._objects.get(e,t,n,r,s,this._currentRenderContext,a,l);c.drawRange=e.geometry.drawRange,c.group=o,this._nodes.updateBefore(c),this._geometries.updateForRender(c),this._nodes.updateForRender(c),this._bindings.updateForRender(c),this._pipelines.getForRender(c,this._compilationPromises),this._nodes.updateAfter(c)}_onCanvasTargetResize(){this._initialized&&this.backend.updateSize()}get compile(){return this.compileAsync}},X4=class{constructor(e=""){this.name=e,this.visibility=0}setVisibility(e){this.visibility|=e}getVisibility(){return this.visibility}clone(){return Object.assign(new this.constructor,this)}};function roe(i){return i+(fm-i%fm)%fm}var $4=class extends X4{constructor(e,t=null){super(e),this.isBuffer=!0,this.bytesPerElement=Float32Array.BYTES_PER_ELEMENT,this._buffer=t,this._updateRanges=[]}get updateRanges(){return this._updateRanges}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}get byteLength(){return roe(this._buffer.byteLength)}get buffer(){return this._buffer}update(){return!0}release(){this._buffer=null}},Y4=class extends $4{constructor(e,t=null){super(e,t),this.isUniformBuffer=!0}},rPe=0,Z4=class extends Y4{constructor(e,t){super("UniformBuffer_"+rPe++,e?e.value:null),this.nodeUniform=e,this.groupNode=t,this.isNodeUniformBuffer=!0}set updateRanges(e){this.nodeUniform.updateRanges=e}get updateRanges(){return this.nodeUniform.updateRanges}addUpdateRange(e,t){this.nodeUniform.addUpdateRange(e,t)}clearUpdateRanges(){this.nodeUniform.clearUpdateRanges()}get byteLength(){return roe(this.buffer.byteLength)}get buffer(){return this.nodeUniform.value}},a9=class extends Y4{constructor(e){super(e),this.isUniformsGroup=!0,this._values=null,this.uniforms=[],this._updateRangeCache=new Map,this._addedIndices=new Set}addUniformUpdateRange(e){let t=e.index;if(this._addedIndices.has(t))return;let n=this._updateRangeCache.get(t);n===void 0&&(n={start:0,count:0},this._updateRangeCache.set(t,n)),n.start=e.offset,n.count=e.itemSize,this._addedIndices.add(t),this.updateRanges.push(n)}clearUpdateRanges(){this._addedIndices.clear(),super.clearUpdateRanges()}addUniform(e){return this.uniforms.push(e),this}removeUniform(e){let t=this.uniforms.indexOf(e);return t!==-1&&this.uniforms.splice(t,1),this}get values(){return this._values===null&&(this._values=Array.from(this.buffer)),this._values}get buffer(){let e=this._buffer;if(e===null){let t=this.byteLength;e=new Float32Array(new ArrayBuffer(t)),this._buffer=e}return e}get byteLength(){let e=this.bytesPerElement,t=0;for(let n=0,r=this.uniforms.length;n<r;n++){let s=this.uniforms[n],o=s.boundary,a=s.itemSize*e,l=t%fm,c=l%o,u=l+c;t+=c,u!==0&&fm-u<a&&(t+=fm-u),s.offset=t/e,s.index=n,t+=a}return Math.ceil(t/fm)*fm}update(){let e=!1;for(let t of this.uniforms)this.updateByType(t)===!0&&(e=!0);return e}release(){super.release(),this._values=null}updateByType(e){if(e.isNumberUniform)return this.updateNumber(e);if(e.isVector2Uniform)return this.updateVector2(e);if(e.isVector3Uniform)return this.updateVector3(e);if(e.isVector4Uniform)return this.updateVector4(e);if(e.isColorUniform)return this.updateColor(e);if(e.isMatrix3Uniform)return this.updateMatrix3(e);if(e.isMatrix4Uniform)return this.updateMatrix4(e);ze("WebGPUUniformsGroup: Unsupported uniform type.",e)}updateNumber(e){let t=!1,n=this.values,r=e.getValue(),s=e.offset,o=e.getType();if(n[s]!==r){let a=this._getBufferForType(o);a[s]=n[s]=r,t=!0,this.addUniformUpdateRange(e)}return t}updateVector2(e){let t=!1,n=this.values,r=e.getValue(),s=e.offset,o=e.getType();if(n[s+0]!==r.x||n[s+1]!==r.y){let a=this._getBufferForType(o);a[s+0]=n[s+0]=r.x,a[s+1]=n[s+1]=r.y,t=!0,this.addUniformUpdateRange(e)}return t}updateVector3(e){let t=!1,n=this.values,r=e.getValue(),s=e.offset,o=e.getType();if(n[s+0]!==r.x||n[s+1]!==r.y||n[s+2]!==r.z){let a=this._getBufferForType(o);a[s+0]=n[s+0]=r.x,a[s+1]=n[s+1]=r.y,a[s+2]=n[s+2]=r.z,t=!0,this.addUniformUpdateRange(e)}return t}updateVector4(e){let t=!1,n=this.values,r=e.getValue(),s=e.offset,o=e.getType();if(n[s+0]!==r.x||n[s+1]!==r.y||n[s+2]!==r.z||n[s+3]!==r.w){let a=this._getBufferForType(o);a[s+0]=n[s+0]=r.x,a[s+1]=n[s+1]=r.y,a[s+2]=n[s+2]=r.z,a[s+3]=n[s+3]=r.w,t=!0,this.addUniformUpdateRange(e)}return t}updateColor(e){let t=!1,n=this.values,r=e.getValue(),s=e.offset;if(n[s+0]!==r.r||n[s+1]!==r.g||n[s+2]!==r.b){let o=this.buffer;o[s+0]=n[s+0]=r.r,o[s+1]=n[s+1]=r.g,o[s+2]=n[s+2]=r.b,t=!0,this.addUniformUpdateRange(e)}return t}updateMatrix3(e){let t=!1,n=this.values,r=e.getValue().elements,s=e.offset;if(n[s+0]!==r[0]||n[s+1]!==r[1]||n[s+2]!==r[2]||n[s+4]!==r[3]||n[s+5]!==r[4]||n[s+6]!==r[5]||n[s+8]!==r[6]||n[s+9]!==r[7]||n[s+10]!==r[8]){let o=this.buffer;o[s+0]=n[s+0]=r[0],o[s+1]=n[s+1]=r[1],o[s+2]=n[s+2]=r[2],o[s+4]=n[s+4]=r[3],o[s+5]=n[s+5]=r[4],o[s+6]=n[s+6]=r[5],o[s+8]=n[s+8]=r[6],o[s+9]=n[s+9]=r[7],o[s+10]=n[s+10]=r[8],t=!0,this.addUniformUpdateRange(e)}return t}updateMatrix4(e){let t=!1,n=this.values,r=e.getValue().elements,s=e.offset;return oPe(n,r,s)===!1&&(this.buffer.set(r,s),sPe(n,r,s),t=!0,this.addUniformUpdateRange(e)),t}_getBufferForType(e){return e==="int"||e==="ivec2"||e==="ivec3"||e==="ivec4"?new Int32Array(this.buffer.buffer):e==="uint"||e==="uvec2"||e==="uvec3"||e==="uvec4"?new Uint32Array(this.buffer.buffer):this.buffer}};function sPe(i,e,t){for(let n=0,r=e.length;n<r;n++)i[t+n]=e[n]}function oPe(i,e,t){for(let n=0,r=e.length;n<r;n++)if(i[t+n]!==e[n])return!1;return!0}var aPe=0,K4=class extends a9{constructor(e,t){super(e),this.id=aPe++,this.groupNode=t,this.isNodeUniformsGroup=!0}},Q4=class extends X4{constructor(e,t){super(e),this._texture=t,this.version=-1,this.generation=null,this.samplerKey="",this.isSampler=!0}set texture(e){this._texture!==e&&(this._texture=e,this.reset())}get texture(){return this._texture}update(){let{texture:e,version:t}=this;return t!==e.version?(this.version=e.version,!0):!1}reset(){this.generation=null,this.version=-1}release(){this._texture=null}},lPe=0,l9=class extends Q4{constructor(e,t){super(e,t),this.id=lPe++,this.store=!1,this.mipLevel=0,this.isSampledTexture=!0}},vx=class extends l9{constructor(e,t,n,r=null){super(e,t?t.value:null),this.textureNode=t,this.groupNode=n,this.access=r}update(){let{textureNode:e}=this;return this.texture!==e.value?(this.texture=e.value,!0):super.update()}},J4=class extends vx{constructor(e,t,n,r=null){super(e,t,n,r),this.isSampledCubeTexture=!0}},CS=class extends vx{constructor(e,t,n,r=null){super(e,t,n,r),this.isSampledTexture3D=!0}},Cte={bitcast_int_uint:new hr("uint tsl_bitcast_int_to_uint ( int x ) { return floatBitsToUint( intBitsToFloat ( x ) ); }"),bitcast_uint_int:new hr("uint tsl_bitcast_uint_to_int ( uint x ) { return floatBitsToInt( uintBitsToFloat ( x ) ); }"),textureGather:new hr(`4169+Reason: ${e.reason}`),ze(t),this._isDeviceLost=!0}_onError(e){let t=`WebGPURenderer: Uncaptured ${e.api} ${e.type}`;e.message&&(t+=`: ${e.message}`),ze(t)}_bundleNeedsUpdate(e,t){return t.bundleGPU===void 0||e.version!==t.version}_renderBundle(e,t,n){let{bundleGroup:r,camera:s,renderList:o}=e,a=this._currentRenderContext,l=this._bundles.get(r,s,a),c=this.backend.get(l);if(this._bundleNeedsUpdate(r,c)){this.backend.beginBundle(a),this._currentRenderBundle=l;let{transparentDoublePass:f,transparent:d,opaque:A}=o;this.opaque===!0&&A.length>0&&this._renderObjects(A,s,t,n),this.transparent===!0&&d.length>0&&this._renderTransparents(d,f,s,t,n),this._currentRenderBundle=null,this.backend.finishBundle(a,l),c.version=r.version}else{let{renderObjects:f}=c;for(let d=0,A=f.length;d<A;d++){let y=f[d];this._nodes.needsRefresh(y)&&(this._nodes.updateBefore(y),this._geometries.updateForRender(y),this._nodes.updateForRender(y),this._bindings.updateForRender(y),this._nodes.updateAfter(y))}}this.backend.addBundle(a,l)}render(e,t){if(this._initialized===!1)throw new Error('THREE.Renderer: .render() called before the backend is initialized. Use "await renderer.init();" before rendering.');this._renderScene(e,t)}get initialized(){return this._initialized}_renderOutputLayers(e,t){if(t.texture.isArrayTexture!==!0||t.texture.image.depth<=1){this._renderScene(e,e.camera,!1);return}let n=this._activeCubeFace;try{for(let r=0;r<t.texture.image.depth;r++)this._nodes.setOutputLayerIndex(r),this._activeCubeFace=r,this._renderScene(e,e.camera,!1)}finally{this._nodes.setOutputLayerIndex(0),this._activeCubeFace=n}}_getFrameBufferTarget(){let{currentToneMapping:e,currentColorSpace:t}=this,n=e!==ao,r=t!==ln.workingColorSpace;if(n===!1&&r===!1)return null;let{width:s,height:o}=this.getDrawingBufferSize(X_),{depth:a,stencil:l}=this,c=this._outputRenderTarget||this._canvasTarget,u=this._frameBufferTargets.get(c);if(u===void 0){u=new Ba(s,o,{depthBuffer:a,stencilBuffer:l,type:this._outputBufferType,format:Or,colorSpace:ln.workingColorSpace,generateMipmaps:!1,minFilter:Mi,magFilter:Mi,samples:this.samples}),u.isPostProcessingRenderTarget=!0;let S=()=>{c.removeEventListener("dispose",S),u.dispose(),this._frameBufferTargets.delete(c)};c.addEventListener("dispose",S),this._frameBufferTargets.set(c,u)}let f=this.getOutputRenderTarget();u.depthBuffer=a,u.stencilBuffer=l,f!==null?u.setSize(f.width,f.height,f.depth):u.setSize(s,o,1);let d=this._outputRenderTarget?this._outputRenderTarget.viewport:c._viewport,A=this._outputRenderTarget?this._outputRenderTarget.scissor:c._scissor,y=this._outputRenderTarget?1:c._pixelRatio,w=this._outputRenderTarget?this._outputRenderTarget.scissorTest:c._scissorTest;return u.viewport.copy(d),u.scissor.copy(A),u.viewport.multiplyScalar(y),u.scissor.multiplyScalar(y),u.scissorTest=w,u.multiview=f!==null?f.multiview:!1,u.useArrayDepthTexture=f!==null?f.useArrayDepthTexture:!1,u.resolveDepthBuffer=f!==null?f.resolveDepthBuffer:!0,u._autoAllocateDepthBuffer=f!==null?f._autoAllocateDepthBuffer:!1,u}_renderScene(e,t,n=!0){if(this._isDeviceLost===!0)return;let r=n?this._getFrameBufferTarget():null,s=this._nodes.nodeFrame,o=s.renderId,a=this._currentRenderContext,l=this._currentRenderObjectFunction,c=this._handleObjectFunction;this.lighting.beginRender(e),this._callDepth++;let u=e.isScene===!0?e:Bte,f=this._renderTarget||this._outputRenderTarget,d=this._activeCubeFace,A=this._activeMipmapLevel,y;if(r!==null?(y=r,this.setRenderTarget(y)):y=f,y!==null&&y.depthBuffer===!0){let W=this._textures.get(y);W.depthInitialized!==!0&&((this.autoClear===!1||this.autoClear===!0&&this.autoClearDepth===!1)&&this.clearDepth(),W.depthInitialized=!0)}let w=this._renderContexts.get(y,this._mrt,this._callDepth);this._currentRenderContext=w,this._currentRenderObjectFunction=this._renderObjectFunction||this.renderObject,this._handleObjectFunction=this._renderObjectDirect,this.info.calls++,this.info.render.calls++,this.info.render.frameCalls++,s.renderId=this.info.calls,this.backend.updateTimeStampUID(w),this.inspector.beginRender(this.backend.getTimestampUID(w),e,t,y),e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t=this._updateCamera(t);let S=this._canvasTarget,T=S._viewport,R=S._scissor,P=S._pixelRatio;y!==null&&(T=y.viewport,R=y.scissor,P=1),this.getDrawingBufferSize(X_),oU.set(0,0,X_.width,X_.height);let I=T.minDepth===void 0?0:T.minDepth,F=T.maxDepth===void 0?1:T.maxDepth;w.viewportValue.copy(T).multiplyScalar(P).floor(),w.viewportValue.width>>=A,w.viewportValue.height>>=A,w.viewportValue.minDepth=I,w.viewportValue.maxDepth=F,w.viewport=w.viewportValue.equals(oU)===!1,w.scissorValue.copy(R).multiplyScalar(P).floor(),w.scissor=S._scissorTest&&w.scissorValue.equals(oU)===!1,w.scissorValue.width>>=A,w.scissorValue.height>>=A,w.clippingContext||(w.clippingContext=new Y4),w.clippingContext.updateGlobal(u,t),u.onBeforeRender(this,e,t,y);let D=t.isArrayCamera?UR:OR;t.isArrayCamera?D.setFromArrayCamera(t):($_.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),D.setFromProjectionMatrix($_,t.coordinateSystem,t.reversedDepth));let L=this._renderLists.get(e,t);if(L.begin(),this._projectObject(e,t,0,L,w.clippingContext),L.finish(),this.sortObjects===!0&&L.sort(this._opaqueSort,this._transparentSort,t.reversedDepth),y!==null){this._textures.updateRenderTarget(y,A);let W=this._textures.get(y);w.textures=W.textures,w.depthTexture=W.depthTexture,w.width=W.width,w.height=W.height,w.renderTarget=y,w.depth=y.depthBuffer,w.stencil=y.stencilBuffer}else w.textures=null,w.depthTexture=null,w.width=X_.width,w.height=X_.height,w.depth=this.depth,w.stencil=this.stencil;w.width>>=A,w.height>>=A,w.activeCubeFace=d,w.activeMipmapLevel=A,w.occlusionQueryCount=L.occlusionQueryCount,w.scissorValue.max(Hd.set(0,0,0,0)),w.scissorValue.x+w.scissorValue.width>w.width&&(w.scissorValue.width=Math.max(w.width-w.scissorValue.x,0)),w.scissorValue.y+w.scissorValue.height>w.height&&(w.scissorValue.height=Math.max(w.height-w.scissorValue.y,0)),this._background.update(u,L,w),w.camera=t,this.backend.beginRender(w);let{bundles:C,lightsNode:B,transparentDoublePass:k,transparent:z,opaque:G}=L;return C.length>0&&this._renderBundles(C,u,B),this.opaque===!0&&G.length>0&&this._renderObjects(G,t,u,B),this.transparent===!0&&z.length>0&&this._renderTransparents(z,k,t,u,B),this.backend.finishRender(w),s.renderId=o,this._currentRenderContext=a,this._currentRenderObjectFunction=l,this._handleObjectFunction=c,this.lighting.finishRender(e),this._callDepth--,r!==null&&(this.setRenderTarget(f,d,A),this._renderOutput(y)),u.onAfterRender(this,e,t,y),this.inspector.finishRender(this.backend.getTimestampUID(w)),w}_setXRLayerSize(e,t){this._canvasTarget._width=e,this._canvasTarget._height=t,this.setViewport(0,0,e,t)}_renderOutput(e){let t=this._nodes.getOutputCacheKey(),n=this._quadCache.get(e.texture),r;if(n===void 0){r=new ES(new Ir),r.name="Output Color Transform",r.material.name="outputColorTransform",r.material.fragmentNode=this._nodes.getOutputNode(e.texture),n={quad:r,cacheKey:t},this._quadCache.set(e.texture,n);let a=()=>{r.material.dispose(),this._quadCache.delete(e.texture),e.texture.removeEventListener("dispose",a)};e.texture.addEventListener("dispose",a)}else r=n.quad,n.cacheKey!==t&&(r.material.fragmentNode=this._nodes.getOutputNode(e.texture),r.material.needsUpdate=!0,n.cacheKey=t);let s=this.autoClear,o=this.xr.enabled;this.autoClear=!1,this.xr.enabled=!1,this._renderOutputLayers(r,e),this.autoClear=s,this.xr.enabled=o}getMaxAnisotropy(){return this.backend.capabilities.getMaxAnisotropy()}getActiveCubeFace(){return this._activeCubeFace}getActiveMipmapLevel(){return this._activeMipmapLevel}async setAnimationLoop(e){this._initialized===!1&&await this.init(),this._animation.setAnimationLoop(e)}getAnimationLoop(){return this._animation.getAnimationLoop()}async getArrayBufferAsync(e,t=null,n=0,r=-1){if(t!==null&&t.isReadbackBuffer&&this.info.memoryMap.has(t)===!1){this.info.createReadbackBuffer(t);let s=()=>{t.removeEventListener("dispose",s),this.info.destroyReadbackBuffer(t)};t.addEventListener("dispose",s)}if(n%4!==0||r>0&&r%4!==0)throw new Error('THREE.Renderer: "getArrayBufferAsync()" offset and count must be a multiple of 4.');return await this.backend.getArrayBufferAsync(e,t,n,r)}getContext(){return this.backend.getContext()}getPixelRatio(){return this._canvasTarget.getPixelRatio()}getDrawingBufferSize(e){return this._canvasTarget.getDrawingBufferSize(e)}getSize(e){return this._canvasTarget.getSize(e)}setPixelRatio(e=1){this._canvasTarget.setPixelRatio(e)}setDrawingBufferSize(e,t,n){this.xr&&this.xr.isPresenting||this._canvasTarget.setDrawingBufferSize(e,t,n)}setSize(e,t,n=!0){this.xr&&this.xr.isPresenting||this._canvasTarget.setSize(e,t,n)}setOpaqueSort(e){this._opaqueSort=e}setTransparentSort(e){this._transparentSort=e}getScissor(e){return this._canvasTarget.getScissor(e)}setScissor(e,t,n,r){this._canvasTarget.setScissor(e,t,n,r)}getScissorTest(){return this._canvasTarget.getScissorTest()}setScissorTest(e){this._canvasTarget.setScissorTest(e),this.backend.setScissorTest(e)}getViewport(e){return this._canvasTarget.getViewport(e)}setViewport(e,t,n,r,s=0,o=1){this._canvasTarget.setViewport(e,t,n,r,s,o)}getClearColor(e){return e.copy(this._clearColor)}setClearColor(e,t=1){this._clearColor.set(e),this._clearColor.a=t}getClearAlpha(){return this._clearColor.a}setClearAlpha(e){this._clearColor.a=e}getClearDepth(){return this.reversedDepthBuffer===!0?1-this._clearDepth:this._clearDepth}setClearDepth(e){this._clearDepth=e}getClearStencil(){return this._clearStencil}setClearStencil(e){this._clearStencil=e}isOccluded(e){let t=this._currentRenderContext;return t&&this.backend.isOccluded(t,e)}clear(e=!0,t=!0,n=!0){if(this._initialized===!1)throw new Error('THREE.Renderer: .clear() called before the backend is initialized. Use "await renderer.init();" before using this method.');let r=this._renderTarget||this._getFrameBufferTarget(),s=null;if(r!==null){this._textures.updateRenderTarget(r);let o=this._textures.get(r);s=this._renderContexts.get(r,null,-1),s.textures=o.textures,s.depthTexture=o.depthTexture,s.width=o.width,s.height=o.height,s.renderTarget=r,s.depth=r.depthBuffer,s.stencil=r.stencilBuffer;let a=this.backend.getClearColor();s.clearColorValue.r=a.r,s.clearColorValue.g=a.g,s.clearColorValue.b=a.b,s.clearColorValue.a=a.a,s.clearDepthValue=this.getClearDepth(),s.clearStencilValue=this.getClearStencil(),s.activeCubeFace=this.getActiveCubeFace(),s.activeMipmapLevel=this.getActiveMipmapLevel(),r.depthBuffer===!0&&(o.depthInitialized=!0)}this.backend.clear(e,t,n,s),r!==null&&this._renderTarget===null&&this._renderOutput(r)}clearColor(){this.clear(!0,!1,!1)}clearDepth(){this.clear(!1,!0,!1)}clearStencil(){this.clear(!1,!1,!0)}async clearAsync(e=!0,t=!0,n=!0){ni('Renderer: "clearAsync()" has been deprecated. Use "clear()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.clear(e,t,n)}async clearColorAsync(){ni('Renderer: "clearColorAsync()" has been deprecated. Use "clearColor()" and "await renderer.init();" when creating the renderer.'),this.clear(!0,!1,!1)}async clearDepthAsync(){ni('Renderer: "clearDepthAsync()" has been deprecated. Use "clearDepth()" and "await renderer.init();" when creating the renderer.'),this.clear(!1,!0,!1)}async clearStencilAsync(){ni('Renderer: "clearStencilAsync()" has been deprecated. Use "clearStencil()" and "await renderer.init();" when creating the renderer.'),this.clear(!1,!1,!0)}get needsFrameBufferTarget(){let e=this.currentToneMapping!==ao,t=this.currentColorSpace!==ln.workingColorSpace;return e||t}get samples(){return this._samples}get currentSamples(){let e=this._samples;return this._renderTarget!==null?e=this._renderTarget.samples:this.needsFrameBufferTarget&&(e=0),e}get currentToneMapping(){return this.isOutputTarget?this.toneMapping:ao}get currentColorSpace(){return this.isOutputTarget?this.outputColorSpace:ln.workingColorSpace}get isOutputTarget(){return this._renderTarget===this._outputRenderTarget||this._renderTarget===null}dispose(){if(this._initialized===!0){this.info.dispose(),this.backend.dispose(),this._animation.dispose(),this._objects.dispose(),this._geometries.dispose(),this._pipelines.dispose(),this._nodes.dispose(),this._bindings.dispose(),this._renderLists.dispose(),this._renderContexts.dispose(),this._textures.dispose();for(let e of this._frameBufferTargets.keys())e.dispose();Object.values(this.backend.timestampQueryPool).forEach(e=>{e!==null&&e.dispose()})}this.setRenderTarget(null),this.setAnimationLoop(null)}setRenderTarget(e,t=0,n=0){this._renderTarget=e,this._activeCubeFace=t,this._activeMipmapLevel=n}getRenderTarget(){return this._renderTarget}setOutputRenderTarget(e){this._outputRenderTarget=e}getOutputRenderTarget(){return this._outputRenderTarget}setCanvasTarget(e){this._canvasTarget.removeEventListener("resize",this._onCanvasTargetResize),this._canvasTarget=e,this._canvasTarget.addEventListener("resize",this._onCanvasTargetResize)}getCanvasTarget(){return this._canvasTarget}_resetXRState(){this.backend.setXRTarget(null),this.setOutputRenderTarget(null),this.setRenderTarget(null);for(let e of this._frameBufferTargets.keys())e.dispose()}setRenderObjectFunction(e){this._renderObjectFunction=e}getRenderObjectFunction(){return this._renderObjectFunction}compute(e,t=null){if(this._isDeviceLost===!0)return;if(this._initialized===!1)return Xe("Renderer: .compute() called before the backend is initialized. Try using .computeAsync() instead."),this.computeAsync(e,t);let n=this._nodes.nodeFrame,r=n.renderId;this.info.calls++,this.info.compute.calls++,this.info.compute.frameCalls++,n.renderId=this.info.calls,this.backend.updateTimeStampUID(e),this.inspector.beginCompute(this.backend.getTimestampUID(e),e);let s=this.backend,o=this._pipelines,a=this._bindings,l=this._nodes,c=Array.isArray(e)?e:[e];if(c[0]===void 0||c[0].isComputeNode!==!0)throw new Error("THREE.Renderer: .compute() expects a ComputeNode.");s.beginCompute(e);for(let u of c){if(o.has(u)===!1){let A=()=>{u.removeEventListener("dispose",A),o.delete(u),a.deleteForCompute(u),l.delete(u)};u.addEventListener("dispose",A);let y=u.onInitFunction;y!==null&&y.call(u,{renderer:this})}l.updateForCompute(u),a.updateForCompute(u);let f=a.getForCompute(u),d=o.getForCompute(u,f);s.compute(e,u,f,d,t)}s.finishCompute(e),n.renderId=r,this.inspector.finishCompute(this.backend.getTimestampUID(e))}async computeAsync(e,t=null){this._initialized===!1&&await this.init(),this.compute(e,t)}async hasFeatureAsync(e){return ni('Renderer: "hasFeatureAsync()" has been deprecated. Use "hasFeature()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.hasFeature(e)}async resolveTimestampsAsync(e="render"){return this._initialized===!1&&await this.init(),this.backend.resolveTimestampsAsync(e)}hasFeature(e){if(this._initialized===!1)throw new Error('THREE.Renderer: .hasFeature() called before the backend is initialized. Use "await renderer.init();" before using this method.');return this.backend.hasFeature(e)}hasInitialized(){return this._initialized}async initTextureAsync(e){ni('Renderer: "initTextureAsync()" has been deprecated. Use "initTexture()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.initTexture(e)}initTexture(e){if(this._initialized===!1)throw new Error('THREE.Renderer: .initTexture() called before the backend is initialized. Use "await renderer.init();" before using this method.');this._textures.updateTexture(e)}initRenderTarget(e){if(this._initialized===!1)throw new Error('THREE.Renderer: .initRenderTarget() called before the backend is initialized. Use "await renderer.init();" before using this method.');this._textures.updateRenderTarget(e);let t=this._textures.get(e),n=this._renderContexts.get(e);n.textures=t.textures,n.depthTexture=t.depthTexture,n.width=t.width,n.height=t.height,n.renderTarget=e,n.depth=e.depthBuffer,n.stencil=e.stencilBuffer,this.backend.initRenderTarget(n)}copyFramebufferToTexture(e,t=null){if(t!==null)if(t.isVector2)t=Hd.set(t.x,t.y,e.image.width,e.image.height).floor();else if(t.isVector4)t=Hd.copy(t).floor();else{ze("Renderer.copyFramebufferToTexture: Invalid rectangle.");return}else t=Hd.set(0,0,e.image.width,e.image.height);let n=this._currentRenderContext,r;n!==null?r=n.renderTarget:(r=this._renderTarget||this._getFrameBufferTarget(),r!==null&&(this._textures.updateRenderTarget(r),n=this._textures.get(r))),this._textures.updateTexture(e,{renderTarget:r}),this.backend.copyFramebufferToTexture(e,n,t),this._inspector.copyFramebufferToTexture(e)}copyTextureToTexture(e,t,n=null,r=null,s=0,o=0){this._textures.updateTexture(e),this._textures.updateTexture(t),this.backend.copyTextureToTexture(e,t,n,r,s,o),this._inspector.copyTextureToTexture(e,t)}async readRenderTargetPixelsAsync(e,t,n,r,s,o=0,a=0){return this.backend.copyTextureToBuffer(e.textures[o],t,n,r,s,a)}_projectObject(e,t,n,r,s){if(e.visible===!1)return;if(e.layers.test(t.layers)){if(e.isGroup)n=e.renderOrder,e.isClippingGroup&&e.enabled&&(s=s.getGroupContext(e));else if(e.isLOD)e.autoUpdate===!0&&e.update(t);else if(e.isLight)r.pushLight(e);else if(e.isSprite){let l=t.isArrayCamera?UR:OR;if(!e.frustumCulled||l.intersectsSprite(e)){this.sortObjects===!0&&Hd.setFromMatrixPosition(e.matrixWorld).applyMatrix4($_);let{geometry:c,material:u}=e;u.visible&&r.push(e,c,u,n,Hd.z,null,s)}}else if(e.isLineLoop)ze("Renderer: Objects of type THREE.LineLoop are not supported. Please use THREE.Line or THREE.LineSegments.");else if(e.isMesh||e.isLine||e.isPoints){let l=t.isArrayCamera?UR:OR;if(!e.frustumCulled||l.intersectsObject(e)){let{geometry:c,material:u}=e;if(this.sortObjects===!0&&(c.boundingSphere===null&&c.computeBoundingSphere(),Hd.copy(c.boundingSphere.center).applyMatrix4(e.matrixWorld).applyMatrix4($_)),Array.isArray(u)){let f=c.groups;for(let d=0,A=f.length;d<A;d++){let y=f[d],w=u[y.materialIndex];w&&w.visible&&r.push(e,c,w,n,Hd.z,y,s)}}else u.visible&&r.push(e,c,u,n,Hd.z,null,s)}}}if(e.isBundleGroup===!0&&this.backend.beginBundle!==void 0){let l=r;r=this._renderLists.get(e,t);let c=this._bundles.get(e,t,this._currentRenderContext),u=this.backend.get(c);if(this._bundleNeedsUpdate(e,u)){r.begin(),u.renderObjects===void 0?u.renderObjects=[]:u.renderObjects.length=0;let d=e.children;for(let A=0,y=d.length;A<y;A++)this._projectObject(d[A],t,n,r,s);r.finish()}l.pushBundle({bundleGroup:e,camera:t,renderList:r});return}let a=e.children;for(let l=0,c=a.length;l<c;l++)this._projectObject(a[l],t,n,r,s)}_renderBundles(e,t,n){for(let r of e)this._renderBundle(r,t,n)}_renderTransparents(e,t,n,r,s){if(t.length>0){for(let{material:o}of t)o.side=mi;this._renderObjects(t,n,r,s,"backSide");for(let{material:o}of t)o.side=ko;this._renderObjects(e,n,r,s);for(let{material:o}of t)o.side=vr}else this._renderObjects(e,n,r,s)}_renderObjects(e,t,n,r,s=null){for(let o=0,a=e.length;o<a;o++){let{object:l,geometry:c,material:u,group:f,clippingContext:d}=e[o];this._currentRenderObjectFunction(l,n,t,c,u,f,r,d,s)}}_getShadowNodes(e){let t=e.version,n=this._cacheShadowNodes.get(e);if(n===void 0||n.version!==t){let r=e.map&&e.map.isTexture,s=e.colorNode&&e.colorNode.isNode,o=e.castShadowNode&&e.castShadowNode.isNode,a=e.maskShadowNode&&e.maskShadowNode.isNode||e.maskNode&&e.maskNode.isNode,l=null,c=null,u=null;if(r||s||o||a){let f,d;if(o?(f=e.castShadowNode.rgb,d=e.castShadowNode.a,this.shadowMap.transmitted!==!0&&ni("Renderer: `shadowMap.transmitted` needs to be set to `true` when using `material.castShadowNode`.")):(f=pe(0),d=oe(1)),r&&(d=d.mul(mr("map","texture",e).a)),s&&(d=d.mul(e.colorNode.a)),c=Ft(f,d),a){let A=e.maskShadowNode||e.maskNode;c=me(([y])=>(A.not().discard(),y))(c)}}e.depthNode&&e.depthNode.isNode&&(u=e.depthNode),e.castShadowPositionNode&&e.castShadowPositionNode.isNode?l=e.castShadowPositionNode:e.positionNode&&e.positionNode.isNode&&(l=e.positionNode),n={version:t,colorNode:c,depthNode:u,positionNode:l},this._cacheShadowNodes.set(e,n)}return n}_updateCamera(e){let t=this.xr;if(t.isPresenting===!1){let n=!1;if(this.reversedDepthBuffer===!0&&e.reversedDepth!==!0){if(e._reversedDepth=!0,e.isArrayCamera)for(let s of e.cameras)s._reversedDepth=!0;n=!0}let r=this.coordinateSystem;if(e.coordinateSystem!==r){if(e.coordinateSystem=r,e.isArrayCamera)for(let s of e.cameras)s.coordinateSystem=r;n=!0}if(n===!0&&(e.updateProjectionMatrix(),e.isArrayCamera))for(let s of e.cameras)s.updateProjectionMatrix()}return e.parent===null&&e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t.enabled===!0&&t.isPresenting===!0&&(t.cameraAutoUpdate===!0&&t.updateCamera(e),e=t.getCamera()),e}renderObject(e,t,n,r,s,o,a,l=null,c=null){let u=!1,f,d,A,y,w,S,T,R=this._currentSourceMaterial;if(e.onBeforeRender(this,t,n,r,s,o),s.allowOverride===!0&&t.overrideMaterial!==null){this._currentSourceMaterial=s;let P=t.overrideMaterial;if(u=!0,f=P.isNodeMaterial?P.colorNode:null,d=P.isNodeMaterial?P.depthNode:null,A=P.isNodeMaterial?P.positionNode:null,y=t.overrideMaterial.side,w=P.displacementMap,S=P.displacementScale,T=P.displacementBias,s.positionNode&&s.positionNode.isNode&&(P.positionNode=s.positionNode),P.alphaTest=s.alphaTest,P.alphaMap=s.alphaMap,P.displacementMap=s.displacementMap,P.displacementScale=s.displacementScale,P.displacementBias=s.displacementBias,P.transparent=s.transparent||s.transmission>0||s.transmissionNode&&s.transmissionNode.isNode||s.backdropNode&&s.backdropNode.isNode,P.isShadowPassMaterial){let{colorNode:I,depthNode:F,positionNode:D}=this._getShadowNodes(s);this.shadowMap.type===Hc?P.side=s.shadowSide!==null?s.shadowSide:s.side:P.side=s.shadowSide!==null?s.shadowSide:wPe[s.side],I!==null&&(P.colorNode=I),F!==null&&(P.depthNode=F),D!==null&&(P.positionNode=D)}s=P}s.transparent===!0&&s.side===vr&&s.forceSinglePass===!1?(s.side=mi,this._handleObjectFunction(e,s,t,n,a,o,l,"backSide"),s.side=ko,this._handleObjectFunction(e,s,t,n,a,o,l,c),s.side=vr):this._handleObjectFunction(e,s,t,n,a,o,l,c),u&&(t.overrideMaterial.colorNode=f,t.overrideMaterial.depthNode=d,t.overrideMaterial.positionNode=A,t.overrideMaterial.side=y,t.overrideMaterial.displacementMap=w,t.overrideMaterial.displacementScale=S,t.overrideMaterial.displacementBias=T),this._currentSourceMaterial=R,e.onAfterRender(this,t,n,r,s,o)}hasCompatibility(e){if(this._initialized===!1)throw new Error('THREE.Renderer: .hasCompatibility() called before the backend is initialized. Use "await renderer.init();" before using this method.');return this.backend.hasCompatibility(e)}_renderObjectDirect(e,t,n,r,s,o,a,l){let c=this._objects.get(e,t,n,r,s,this._currentRenderContext,a,l);c.drawRange=e.geometry.drawRange,c.group=o,this._currentRenderBundle!==null&&(this.backend.get(this._currentRenderBundle).renderObjects.push(c),c.bundle=this._currentRenderBundle.bundleGroup);let u=this._nodes.needsRefresh(c);u&&(this._nodes.updateBefore(c),this._geometries.updateForRender(c),this._nodes.updateForRender(c),this._bindings.updateForRender(c)),this._pipelines.updateForRender(c),this._pipelines.isReady(c)&&(this.backend.draw(c,this.info),u&&this._nodes.updateAfter(c))}_createObjectPipeline(e,t,n,r,s,o,a,l){if(this._compilationPromises!==null){this._compilationPromises.push({object:e,material:t,scene:n,camera:r,lightsNode:s,group:o,clippingContext:a,passId:l,renderContext:this._currentRenderContext});return}let c=this._objects.get(e,t,n,r,s,this._currentRenderContext,a,l);c.drawRange=e.geometry.drawRange,c.group=o,this._nodes.updateBefore(c),this._geometries.updateForRender(c),this._nodes.updateForRender(c),this._bindings.updateForRender(c),this._pipelines.getForRender(c,this._compilationPromises),this._nodes.updateAfter(c)}_onCanvasTargetResize(){this._initialized&&this.backend.updateSize()}get compile(){return this.compileAsync}},K4=class{constructor(e=""){this.name=e,this.visibility=0}setVisibility(e){this.visibility|=e}getVisibility(){return this.visibility}clone(){return Object.assign(new this.constructor,this)}};function doe(i){return i+(fm-i%fm)%fm}var Q4=class extends K4{constructor(e,t=null){super(e),this.isBuffer=!0,this.bytesPerElement=Float32Array.BYTES_PER_ELEMENT,this._buffer=t,this._updateRanges=[]}get updateRanges(){return this._updateRanges}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}get byteLength(){return doe(this._buffer.byteLength)}get buffer(){return this._buffer}update(){return!0}release(){this._buffer=null}},J4=class extends Q4{constructor(e,t=null){super(e,t),this.isUniformBuffer=!0}},SPe=0,eI=class extends J4{constructor(e,t){super("UniformBuffer_"+SPe++,e?e.value:null),this.nodeUniform=e,this.groupNode=t,this.isNodeUniformBuffer=!0}set updateRanges(e){this.nodeUniform.updateRanges=e}get updateRanges(){return this.nodeUniform.updateRanges}addUpdateRange(e,t){this.nodeUniform.addUpdateRange(e,t)}clearUpdateRanges(){this.nodeUniform.clearUpdateRanges()}get byteLength(){return doe(this.buffer.byteLength)}get buffer(){return this.nodeUniform.value}},m9=class extends J4{constructor(e){super(e),this.isUniformsGroup=!0,this._values=null,this.uniforms=[],this._updateRangeCache=new Map,this._addedIndices=new Set}addUniformUpdateRange(e){let t=e.index;if(this._addedIndices.has(t))return;let n=this._updateRangeCache.get(t);n===void 0&&(n={start:0,count:0},this._updateRangeCache.set(t,n)),n.start=e.offset,n.count=e.itemSize,this._addedIndices.add(t),this.updateRanges.push(n)}clearUpdateRanges(){this._addedIndices.clear(),super.clearUpdateRanges()}addUniform(e){return this.uniforms.push(e),this}removeUniform(e){let t=this.uniforms.indexOf(e);return t!==-1&&this.uniforms.splice(t,1),this}get values(){return this._values===null&&(this._values=Array.from(this.buffer)),this._values}get buffer(){let e=this._buffer;if(e===null){let t=this.byteLength;e=new Float32Array(new ArrayBuffer(t)),this._buffer=e}return e}get byteLength(){let e=this.bytesPerElement,t=0;for(let n=0,r=this.uniforms.length;n<r;n++){let s=this.uniforms[n],o=s.boundary,a=s.itemSize*e,l=t%fm,c=l%o,u=l+c;t+=c,u!==0&&fm-u<a&&(t+=fm-u),s.offset=t/e,s.index=n,t+=a}return Math.ceil(t/fm)*fm}update(){let e=!1;for(let t of this.uniforms)this.updateByType(t)===!0&&(e=!0);return e}release(){super.release(),this._values=null}updateByType(e){if(e.isNumberUniform)return this.updateNumber(e);if(e.isVector2Uniform)return this.updateVector2(e);if(e.isVector3Uniform)return this.updateVector3(e);if(e.isVector4Uniform)return this.updateVector4(e);if(e.isColorUniform)return this.updateColor(e);if(e.isMatrix3Uniform)return this.updateMatrix3(e);if(e.isMatrix4Uniform)return this.updateMatrix4(e);ze("WebGPUUniformsGroup: Unsupported uniform type.",e)}updateNumber(e){let t=!1,n=this.values,r=e.getValue(),s=e.offset,o=e.getType();if(n[s]!==r){let a=this._getBufferForType(o);a[s]=n[s]=r,t=!0,this.addUniformUpdateRange(e)}return t}updateVector2(e){let t=!1,n=this.values,r=e.getValue(),s=e.offset,o=e.getType();if(n[s+0]!==r.x||n[s+1]!==r.y){let a=this._getBufferForType(o);a[s+0]=n[s+0]=r.x,a[s+1]=n[s+1]=r.y,t=!0,this.addUniformUpdateRange(e)}return t}updateVector3(e){let t=!1,n=this.values,r=e.getValue(),s=e.offset,o=e.getType();if(n[s+0]!==r.x||n[s+1]!==r.y||n[s+2]!==r.z){let a=this._getBufferForType(o);a[s+0]=n[s+0]=r.x,a[s+1]=n[s+1]=r.y,a[s+2]=n[s+2]=r.z,t=!0,this.addUniformUpdateRange(e)}return t}updateVector4(e){let t=!1,n=this.values,r=e.getValue(),s=e.offset,o=e.getType();if(n[s+0]!==r.x||n[s+1]!==r.y||n[s+2]!==r.z||n[s+3]!==r.w){let a=this._getBufferForType(o);a[s+0]=n[s+0]=r.x,a[s+1]=n[s+1]=r.y,a[s+2]=n[s+2]=r.z,a[s+3]=n[s+3]=r.w,t=!0,this.addUniformUpdateRange(e)}return t}updateColor(e){let t=!1,n=this.values,r=e.getValue(),s=e.offset;if(n[s+0]!==r.r||n[s+1]!==r.g||n[s+2]!==r.b){let o=this.buffer;o[s+0]=n[s+0]=r.r,o[s+1]=n[s+1]=r.g,o[s+2]=n[s+2]=r.b,t=!0,this.addUniformUpdateRange(e)}return t}updateMatrix3(e){let t=!1,n=this.values,r=e.getValue().elements,s=e.offset;if(n[s+0]!==r[0]||n[s+1]!==r[1]||n[s+2]!==r[2]||n[s+4]!==r[3]||n[s+5]!==r[4]||n[s+6]!==r[5]||n[s+8]!==r[6]||n[s+9]!==r[7]||n[s+10]!==r[8]){let o=this.buffer;o[s+0]=n[s+0]=r[0],o[s+1]=n[s+1]=r[1],o[s+2]=n[s+2]=r[2],o[s+4]=n[s+4]=r[3],o[s+5]=n[s+5]=r[4],o[s+6]=n[s+6]=r[5],o[s+8]=n[s+8]=r[6],o[s+9]=n[s+9]=r[7],o[s+10]=n[s+10]=r[8],t=!0,this.addUniformUpdateRange(e)}return t}updateMatrix4(e){let t=!1,n=this.values,r=e.getValue().elements,s=e.offset;return EPe(n,r,s)===!1&&(this.buffer.set(r,s),TPe(n,r,s),t=!0,this.addUniformUpdateRange(e)),t}_getBufferForType(e){return e==="int"||e==="ivec2"||e==="ivec3"||e==="ivec4"?new Int32Array(this.buffer.buffer):e==="uint"||e==="uvec2"||e==="uvec3"||e==="uvec4"?new Uint32Array(this.buffer.buffer):this.buffer}};function TPe(i,e,t){for(let n=0,r=e.length;n<r;n++)i[t+n]=e[n]}function EPe(i,e,t){for(let n=0,r=e.length;n<r;n++)if(i[t+n]!==e[n])return!1;return!0}var MPe=0,tI=class extends m9{constructor(e,t){super(e),this.id=MPe++,this.groupNode=t,this.isNodeUniformsGroup=!0}},nI=class extends K4{constructor(e,t){super(e),this._texture=t,this.version=-1,this.generation=null,this.samplerKey="",this.isSampler=!0}set texture(e){this._texture!==e&&(this._texture=e,this.reset())}get texture(){return this._texture}update(){let{texture:e,version:t}=this;return t!==e.version?(this.version=e.version,!0):!1}reset(){this.generation=null,this.version=-1}release(){this._texture=null}},CPe=0,A9=class extends nI{constructor(e,t){super(e,t),this.id=CPe++,this.store=!1,this.mipLevel=0,this.isSampledTexture=!0}},xx=class extends A9{constructor(e,t,n,r=null){super(e,t?t.value:null),this.textureNode=t,this.groupNode=n,this.access=r}update(){let{textureNode:e}=this;return this.texture!==e.value?(this.texture=e.value,!0):super.update()}},iI=class extends xx{constructor(e,t,n,r=null){super(e,t,n,r),this.isSampledCubeTexture=!0}},LS=class extends xx{constructor(e,t,n,r=null){super(e,t,n,r),this.isSampledTexture3D=!0}},Ote={bitcast_int_uint:new hr("uint tsl_bitcast_int_to_uint ( int x ) { return floatBitsToUint( intBitsToFloat ( x ) ); }"),bitcast_uint_int:new hr("uint tsl_bitcast_uint_to_int ( uint x ) { return floatBitsToInt( uintBitsToFloat ( x ) ); }"),textureGather:new hr(`41704170 vec4 tsl_textureGather( const int comp, sampler2D map, vec2 coord, ivec2 offset, bool flipY ) {41714171 if ( flipY ) offset.y = - offset.y;41724172 vec2 size = vec2( textureSize( map, 0 ) );@@ -4222,7 +4222,7 @@ vec4 tsl_textureGatherCompare_array( sampler2DArrayShadow map, vec3 coord, ivec2
42224222 );42234223 return flipY ? ret.wzyx : ret;42244224 }4225-`)},cPe={textureDimensions:"textureSize",equals:"equal",bitcast_float_int:"floatBitsToInt",bitcast_int_float:"intBitsToFloat",bitcast_uint_float:"uintBitsToFloat",bitcast_float_uint:"floatBitsToUint",bitcast_uint_int:"tsl_bitcast_uint_to_int",bitcast_int_uint:"tsl_bitcast_int_to_uint",floatpack_snorm_2x16:"packSnorm2x16",floatpack_unorm_2x16:"packUnorm2x16",floatpack_float16_2x16:"packHalf2x16",floatunpack_snorm_2x16:"unpackSnorm2x16",floatunpack_unorm_2x16:"unpackUnorm2x16",floatunpack_float16_2x16:"unpackHalf2x16"},Rte={low:"lowp",medium:"mediump",high:"highp"},Ite={swizzleAssign:!0,storageBuffer:!1},Pte={perspective:"smooth",linear:"noperspective"},Lte={centroid:"centroid"},Dte=`4225+`)},RPe={textureDimensions:"textureSize",equals:"equal",bitcast_float_int:"floatBitsToInt",bitcast_int_float:"intBitsToFloat",bitcast_uint_float:"uintBitsToFloat",bitcast_float_uint:"floatBitsToUint",bitcast_uint_int:"tsl_bitcast_uint_to_int",bitcast_int_uint:"tsl_bitcast_int_to_uint",floatpack_snorm_2x16:"packSnorm2x16",floatpack_unorm_2x16:"packUnorm2x16",floatpack_float16_2x16:"packHalf2x16",floatunpack_snorm_2x16:"unpackSnorm2x16",floatunpack_unorm_2x16:"unpackUnorm2x16",floatunpack_float16_2x16:"unpackHalf2x16"},Ute={low:"lowp",medium:"mediump",high:"highp"},kte={swizzleAssign:!0,storageBuffer:!1},zte={perspective:"smooth",linear:"noperspective"},Vte={centroid:"centroid"},Gte=`42264226 precision highp float;42274227 precision highp int;42284228 precision highp sampler2D;@@ -4243,17 +4243,17 @@ precision highp isampler2DArray;
42434243 precision highp sampler2DShadow;42444244 precision highp sampler2DArrayShadow;42454245 precision highp samplerCubeShadow;4246-`,c9=class extends G4{constructor(e,t){super(e,t,new Jk),this.uniformGroups={},this.transforms=[],this.extensions={},this.builtins={vertex:[],fragment:[],compute:[]}}needsToWorkingColorSpace(e){return e.isVideoTexture===!0&&e.colorSpace!==ua}_include(e){let t=Cte[e];return t.build(this),this.addInclude(t),t}getMethod(e){return Cte[e]!==void 0&&this._include(e),cPe[e]||e}getBitcastMethod(e,t){return this.getMethod(`bitcast_${t}_${e}`)}getFloatPackingMethod(e){return this.getMethod(`floatpack_${e}_2x16`)}getFloatUnpackingMethod(e){return this.getMethod(`floatunpack_${e}_2x16`)}getTernary(e,t,n){return`${e} ? ${t} : ${n}`}getOutputStructName(){return""}buildFunctionCode(e){let t=e.layout,n=this.flowShaderNode(e),r=[];for(let o of t.inputs)r.push(this.getType(o.type)+" "+o.name);return`${this.getType(t.type)} ${t.name}( ${r.join(", ")} ) {4246+`,g9=class extends j4{constructor(e,t){super(e,t,new a9),this.uniformGroups={},this.transforms=[],this.extensions={},this.builtins={vertex:[],fragment:[],compute:[]}}needsToWorkingColorSpace(e){return e.isVideoTexture===!0&&e.colorSpace!==ua}_include(e){let t=Ote[e];return t.build(this),this.addInclude(t),t}getMethod(e){return Ote[e]!==void 0&&this._include(e),RPe[e]||e}getBitcastMethod(e,t){return this.getMethod(`bitcast_${t}_${e}`)}getFloatPackingMethod(e){return this.getMethod(`floatpack_${e}_2x16`)}getFloatUnpackingMethod(e){return this.getMethod(`floatunpack_${e}_2x16`)}getTernary(e,t,n){return`${e} ? ${t} : ${n}`}getOutputStructName(){return""}buildFunctionCode(e){let t=e.layout,n=this.flowShaderNode(e),r=[];for(let o of t.inputs)r.push(this.getType(o.type)+" "+o.name);return`${this.getType(t.type)} ${t.name}( ${r.join(", ")} ) {42474247 42484248 ${n.vars}42494249 42504250 ${n.code}42514251 return ${n.result};42524252 4253-}`}setupPBO(e){let t=e.value;if(t.pbo===void 0){let n=t.array,r=t.count*t.itemSize,{itemSize:s}=t,o=t.array.constructor.name.toLowerCase().includes("int"),a=o?Vh:Od;s===2?a=o?Gh:js:s===3?a=o?Ib:Bd:s===4&&(a=o?v0:Or);let l={Float32Array:cr,Uint8Array:Ji,Uint16Array:wl,Uint32Array:xi,Int8Array:kh,Int16Array:zh,Int32Array:Zr,Uint8ClampedArray:Ji},c=Math.pow(2,Math.ceil(Math.log2(Math.sqrt(r/s)))),u=Math.ceil(r/s/c);c*u*s<r&&u++;let f=c*u*s,d=new n.constructor(f);d.set(n,0),t.array=d;let A=new jA(t.array,c,u,a,l[t.array.constructor.name]||cr);A.needsUpdate=!0,A.isPBOTexture=!0;let y=new au(A,null,null);y.setPrecision("high"),t.pboNode=y,t.pbo=y.value,this.getUniformFromNode(t.pboNode,"texture",this.shaderStage,this.context.nodeName)}}getPropertyName(e,t=this.shaderStage){return e.isNodeUniform&&e.node.isTextureNode!==!0&&e.node.isBufferNode!==!0?e.name:super.getPropertyName(e,t)}generatePBO(e){let{node:t,indexNode:n}=e,r=t.value;if(this.renderer.backend.has(r)){let u=this.renderer.backend.get(r);u.pbo=r.pbo}let s=this.getUniformFromNode(r.pboNode,"texture",this.shaderStage,this.context.nodeName),o=this.getPropertyName(s);this.increaseUsage(n);let a=n.build(this,"uint"),l=this.getDataFromNode(e),c=l.propertyName;if(c===void 0){let u=this.getVarFromNode(e);c=this.getPropertyName(u);let f=this.getDataFromNode(t),d=f.propertySizeName;d===void 0&&(d=c+"Size",this.getVarFromNode(t,d,"uint"),this.addLineFlowCode(`${d} = uint( textureSize( ${o}, 0 ).x )`,e),f.propertySizeName=d);let{itemSize:A}=r,y="."+c1.join("").slice(0,A),w=`ivec2(${a} % ${d}, ${a} / ${d})`,S=this.generateTextureLoad(null,o,w,"0",null,null),T="vec4";r.pbo.type===xi?T="uvec4":r.pbo.type===Zr&&(T="ivec4"),this.addLineFlowCode(`${c} = ${T}(${S})${y}`,e),l.propertyName=c}return c}generateTextureLoad(e,t,n,r,s,o){r===null&&(r="0");let a;return s?o?a=`texelFetchOffset( ${t}, ivec3( ${n}, ${s} ), int( ${r} ), ${o} )`:a=`texelFetch( ${t}, ivec3( ${n}, ${s} ), int( ${r} ) )`:o?a=`texelFetchOffset( ${t}, ${n}, int( ${r} ), ${o} )`:a=`texelFetch( ${t}, ${n}, int( ${r} ) )`,e!==null&&e.isDepthTexture&&(a+=".x"),a}generateTexture(e,t,n,r,s){return r&&(n=`vec3( ${n}, ${r} )`),e.isDepthTexture?s?`textureOffset( ${t}, ${n}, ${s} ).x`:`texture( ${t}, ${n} ).x`:s?`textureOffset( ${t}, ${n}, ${s} )`:`texture( ${t}, ${n} )`}generateTextureLevel(e,t,n,r,s,o){return s&&(n=`vec3( ${n}, ${s} )`),o?`textureLodOffset( ${t}, ${n}, ${r}, ${o} )`:`textureLod( ${t}, ${n}, ${r} )`}generateTextureBias(e,t,n,r,s,o){return s&&(n=`vec3( ${n}, ${s} )`),o?`textureOffset( ${t}, ${n}, ${o}, ${r} )`:`texture( ${t}, ${n}, ${r} )`}generateTextureGrad(e,t,n,r,s,o){return s&&(n=`vec3( ${n}, ${s} )`),o?`textureGradOffset( ${t}, ${n}, ${r[0]}, ${r[1]}, ${o} )`:`textureGrad( ${t}, ${n}, ${r[0]}, ${r[1]} )`}generateTextureCompare(e,t,n,r,s,o,a=this.shaderStage){if(a==="fragment")return e.isCubeTexture?`texture( ${t}, vec4( ${n}, ${r} ) )`:s?o?`textureOffset( ${t}, vec4( ${n}, ${s}, ${r} ), ${o} )`:`texture( ${t}, vec4( ${n}, ${s}, ${r} ) )`:o?`textureOffset( ${t}, vec3( ${n}, ${r} ), ${o} )`:`texture( ${t}, vec3( ${n}, ${r} ) )`;ze(`WebGPURenderer: THREE.DepthTexture.compareFunction() does not support ${a} shader.`)}generateTextureGather(e,t,n,r,s,o,a){return e.isDepthTexture&&(r="0"),o===null&&(o="ivec2( 0 )"),a===null&&(a="false"),s?(this._include("textureGatherArray"),`tsl_textureGather_array( ${r}, ${t}, vec3( ${n}, ${s} ), ${o}, ${a} )`):(this._include("textureGather"),`tsl_textureGather( ${r}, ${t}, ${n}, ${o}, ${a} )`)}generateTextureGatherCompare(e,t,n,r,s,o,a){return o===null&&(o="ivec2( 0 )"),a===null&&(a="false"),s?(this._include("textureGatherCompareArray"),`tsl_textureGatherCompare_array( ${t}, vec3( ${n}, ${s} ), ${o}, ${r}, ${a} )`):(this._include("textureGatherCompare"),`tsl_textureGatherCompare( ${t}, ${n}, ${o}, ${r}, ${a} )`)}getUniforms(e){let t=this.uniforms[e],n=[],r={};for(let o of t){let a=null,l=!1;if(o.type==="texture"||o.type==="texture3D"){let c=o.node,u=c.value,f="";(u.isDataTexture===!0||u.isData3DTexture===!0)&&(u.type===xi?f="u":u.type===Zr&&(f="i")),o.type==="texture3D"&&u.isArrayTexture===!1?a=`${f}sampler3D ${o.name};`:u.compareFunction&&c.compareNode!==null?u.isArrayTexture===!0?a=`sampler2DArrayShadow ${o.name};`:a=`sampler2DShadow ${o.name};`:u.isArrayTexture===!0||u.isDataArrayTexture===!0||u.isCompressedArrayTexture===!0?a=`${f}sampler2DArray ${o.name};`:a=`${f}sampler2D ${o.name};`}else if(o.type==="cubeTexture")a=`samplerCube ${o.name};`;else if(o.type==="cubeDepthTexture")o.node.value.compareFunction?a=`samplerCubeShadow ${o.name};`:a=`samplerCube ${o.name};`;else if(o.type==="buffer"){let c=o.node,u=this.getType(c.bufferType),f=c.bufferCount,d=f>0?f:"";a=`${c.name} {4253+}`}setupPBO(e){let t=e.value;if(t.pbo===void 0){let n=t.array,r=t.count*t.itemSize,{itemSize:s}=t,o=t.array.constructor.name.toLowerCase().includes("int"),a=o?Gh:Bd;s===2?a=o?qh:js:s===3?a=o?Nb:Fd:s===4&&(a=o?v0:Or);let l={Float32Array:cr,Uint8Array:Ji,Uint16Array:wl,Uint32Array:xi,Int8Array:zh,Int16Array:Vh,Int32Array:Zr,Uint8ClampedArray:Ji},c=Math.pow(2,Math.ceil(Math.log2(Math.sqrt(r/s)))),u=Math.ceil(r/s/c);c*u*s<r&&u++;let f=c*u*s,d=new n.constructor(f);d.set(n,0),t.array=d;let A=new jA(t.array,c,u,a,l[t.array.constructor.name]||cr);A.needsUpdate=!0,A.isPBOTexture=!0;let y=new lu(A,null,null);y.setPrecision("high"),t.pboNode=y,t.pbo=y.value,this.getUniformFromNode(t.pboNode,"texture",this.shaderStage,this.context.nodeName)}}getPropertyName(e,t=this.shaderStage){return e.isNodeUniform&&e.node.isTextureNode!==!0&&e.node.isBufferNode!==!0?e.name:super.getPropertyName(e,t)}generatePBO(e){let{node:t,indexNode:n}=e,r=t.value;if(this.renderer.backend.has(r)){let u=this.renderer.backend.get(r);u.pbo=r.pbo}let s=this.getUniformFromNode(r.pboNode,"texture",this.shaderStage,this.context.nodeName),o=this.getPropertyName(s);this.increaseUsage(n);let a=n.build(this,"uint"),l=this.getDataFromNode(e),c=l.propertyName;if(c===void 0){let u=this.getVarFromNode(e);c=this.getPropertyName(u);let f=this.getDataFromNode(t),d=f.propertySizeName;d===void 0&&(d=c+"Size",this.getVarFromNode(t,d,"uint"),this.addLineFlowCode(`${d} = uint( textureSize( ${o}, 0 ).x )`,e),f.propertySizeName=d);let{itemSize:A}=r,y="."+c1.join("").slice(0,A),w=`ivec2(${a} % ${d}, ${a} / ${d})`,S=this.generateTextureLoad(null,o,w,"0",null,null),T="vec4";r.pbo.type===xi?T="uvec4":r.pbo.type===Zr&&(T="ivec4"),this.addLineFlowCode(`${c} = ${T}(${S})${y}`,e),l.propertyName=c}return c}generateTextureLoad(e,t,n,r,s,o){r===null&&(r="0");let a;return s?o?a=`texelFetchOffset( ${t}, ivec3( ${n}, ${s} ), int( ${r} ), ${o} )`:a=`texelFetch( ${t}, ivec3( ${n}, ${s} ), int( ${r} ) )`:o?a=`texelFetchOffset( ${t}, ${n}, int( ${r} ), ${o} )`:a=`texelFetch( ${t}, ${n}, int( ${r} ) )`,e!==null&&e.isDepthTexture&&(a+=".x"),a}generateTexture(e,t,n,r,s){return r&&(n=`vec3( ${n}, ${r} )`),e.isDepthTexture?s?`textureOffset( ${t}, ${n}, ${s} ).x`:`texture( ${t}, ${n} ).x`:s?`textureOffset( ${t}, ${n}, ${s} )`:`texture( ${t}, ${n} )`}generateTextureLevel(e,t,n,r,s,o){return s&&(n=`vec3( ${n}, ${s} )`),o?`textureLodOffset( ${t}, ${n}, ${r}, ${o} )`:`textureLod( ${t}, ${n}, ${r} )`}generateTextureBias(e,t,n,r,s,o){return s&&(n=`vec3( ${n}, ${s} )`),o?`textureOffset( ${t}, ${n}, ${o}, ${r} )`:`texture( ${t}, ${n}, ${r} )`}generateTextureGrad(e,t,n,r,s,o){return s&&(n=`vec3( ${n}, ${s} )`),o?`textureGradOffset( ${t}, ${n}, ${r[0]}, ${r[1]}, ${o} )`:`textureGrad( ${t}, ${n}, ${r[0]}, ${r[1]} )`}generateTextureCompare(e,t,n,r,s,o,a=this.shaderStage){if(a==="fragment")return e.isCubeTexture?`texture( ${t}, vec4( ${n}, ${r} ) )`:s?o?`textureOffset( ${t}, vec4( ${n}, ${s}, ${r} ), ${o} )`:`texture( ${t}, vec4( ${n}, ${s}, ${r} ) )`:o?`textureOffset( ${t}, vec3( ${n}, ${r} ), ${o} )`:`texture( ${t}, vec3( ${n}, ${r} ) )`;ze(`WebGPURenderer: THREE.DepthTexture.compareFunction() does not support ${a} shader.`)}generateTextureGather(e,t,n,r,s,o,a){return e.isDepthTexture&&(r="0"),o===null&&(o="ivec2( 0 )"),a===null&&(a="false"),s?(this._include("textureGatherArray"),`tsl_textureGather_array( ${r}, ${t}, vec3( ${n}, ${s} ), ${o}, ${a} )`):(this._include("textureGather"),`tsl_textureGather( ${r}, ${t}, ${n}, ${o}, ${a} )`)}generateTextureGatherCompare(e,t,n,r,s,o,a){return o===null&&(o="ivec2( 0 )"),a===null&&(a="false"),s?(this._include("textureGatherCompareArray"),`tsl_textureGatherCompare_array( ${t}, vec3( ${n}, ${s} ), ${o}, ${r}, ${a} )`):(this._include("textureGatherCompare"),`tsl_textureGatherCompare( ${t}, ${n}, ${o}, ${r}, ${a} )`)}getUniforms(e){let t=this.uniforms[e],n=[],r={};for(let o of t){let a=null,l=!1;if(o.type==="texture"||o.type==="texture3D"){let c=o.node,u=c.value,f="";(u.isDataTexture===!0||u.isData3DTexture===!0)&&(u.type===xi?f="u":u.type===Zr&&(f="i")),o.type==="texture3D"&&u.isArrayTexture===!1?a=`${f}sampler3D ${o.name};`:u.compareFunction&&c.compareNode!==null?u.isArrayTexture===!0?a=`sampler2DArrayShadow ${o.name};`:a=`sampler2DShadow ${o.name};`:u.isArrayTexture===!0||u.isDataArrayTexture===!0||u.isCompressedArrayTexture===!0?a=`${f}sampler2DArray ${o.name};`:a=`${f}sampler2D ${o.name};`}else if(o.type==="cubeTexture")a=`samplerCube ${o.name};`;else if(o.type==="cubeDepthTexture")o.node.value.compareFunction?a=`samplerCubeShadow ${o.name};`:a=`samplerCube ${o.name};`;else if(o.type==="buffer"){let c=o.node,u=this.getType(c.bufferType),f=c.bufferCount,d=f>0?f:"";a=`${c.name} {42544254 ${u} ${o.name}[${d}];42554255 };4256-`}else{let c=o.groupNode.name;if(r[c]===void 0){let u=this.uniformGroups[c];if(u!==void 0){let f=[];for(let d of u.uniforms){let A=d.getType(),y=this.getVectorType(A),w=d.nodeUniform.node.precision,S=`${y} ${d.name};`;w!==null&&(S=Rte[w]+" "+S),f.push(" "+S)}r[c]=f}}l=!0}if(!l){let c=o.node.precision;c!==null&&(a=Rte[c]+" "+a),a="uniform "+a,n.push(a)}}let s="";for(let o in r){let a=r[o];s+=this._getGLSLUniformStruct(o,a.join(`4256+`}else{let c=o.groupNode.name;if(r[c]===void 0){let u=this.uniformGroups[c];if(u!==void 0){let f=[];for(let d of u.uniforms){let A=d.getType(),y=this.getVectorType(A),w=d.nodeUniform.node.precision,S=`${y} ${d.name};`;w!==null&&(S=Ute[w]+" "+S),f.push(" "+S)}r[c]=f}}l=!0}if(!l){let c=o.node.precision;c!==null&&(a=Ute[c]+" "+a),a="uniform "+a,n.push(a)}}let s="";for(let o in r){let a=r[o];s+=this._getGLSLUniformStruct(o,a.join(`42574257 `))+`42584258 `}return s+=n.join(`42594259 `),s}getTypeFromAttribute(e){let t=super.getTypeFromAttribute(e);if(/^[iu]/.test(t)&&e.gpuType!==Zr){let n=e;e.isInterleavedBufferAttribute&&(n=e.data);let r=n.array;r instanceof Uint32Array||r instanceof Int32Array||(t=t.slice(1))}return t}getAttributes(e){let t="";if(e==="vertex"||e==="compute"){let n=this.getAttributesArray(),r=0;for(let s of n)t+=`layout( location = ${r++} ) in ${s.type} ${s.name};@@ -4266,14 +4266,14 @@ ${n.code}
42664266 `)+`42674267 42684268 `+t.join(`4269-`)}getVaryings(e){let t="",n=this.varyings;if(e==="vertex"||e==="compute")for(let r of n){e==="compute"&&(r.needsInterpolation=!0);let s=this.getType(r.type);if(r.needsInterpolation)if(r.interpolationType){let o=Pte[r.interpolationType]||r.interpolationType,a=Lte[r.interpolationSampling]||"";t+=`${o} ${a} out ${s} ${r.name};4269+`)}getVaryings(e){let t="",n=this.varyings;if(e==="vertex"||e==="compute")for(let r of n){e==="compute"&&(r.needsInterpolation=!0);let s=this.getType(r.type);if(r.needsInterpolation)if(r.interpolationType){let o=zte[r.interpolationType]||r.interpolationType,a=Vte[r.interpolationSampling]||"";t+=`${o} ${a} out ${s} ${r.name};42704270 `}else{let o=s.includes("int")||s.includes("uv")||s.includes("iv")?"flat ":"";t+=`${o}out ${s} ${r.name};42714271 `}else t+=`${s} ${r.name};4272-`}else if(e==="fragment"){for(let r of n)if(r.needsInterpolation){let s=this.getType(r.type);if(r.interpolationType){let o=Pte[r.interpolationType]||r.interpolationType,a=Lte[r.interpolationSampling]||"";t+=`${o} ${a} in ${s} ${r.name};4272+`}else if(e==="fragment"){for(let r of n)if(r.needsInterpolation){let s=this.getType(r.type);if(r.interpolationType){let o=zte[r.interpolationType]||r.interpolationType,a=Vte[r.interpolationSampling]||"";t+=`${o} ${a} in ${s} ${r.name};42734273 `}else{let o=s.includes("int")||s.includes("uv")||s.includes("iv")?"flat ":"";t+=`${o}in ${s} ${r.name};42744274 `}}}for(let r of this.builtins[e])t+=`${r};42754275 `;return t}getVertexIndex(){return"uint( gl_VertexID )"}getInstanceIndex(){return"uint( gl_InstanceID )"}getInvocationLocalIndex(){return`uint( gl_InstanceID ) % ${this.object.workgroupSize.reduce((n,r)=>n*r,1)}u`}getSubgroupSize(){ze("GLSLNodeBuilder: WebGLBackend does not support the subgroupSize node")}getInvocationSubgroupIndex(){ze("GLSLNodeBuilder: WebGLBackend does not support the invocationSubgroupIndex node")}getSubgroupIndex(){ze("GLSLNodeBuilder: WebGLBackend does not support the subgroupIndex node")}getDrawIndex(){return this.renderer.backend.extensions.has("WEBGL_multi_draw")?"uint( gl_DrawID )":"nodeUniformDrawId"}getFrontFacing(){return"gl_FrontFacing"}getFragCoord(){return"gl_FragCoord.xy"}getFragDepth(){return"gl_FragDepth"}enableExtension(e,t,n=this.shaderStage){let r=this.extensions[n]||(this.extensions[n]=new Map);r.has(e)===!1&&r.set(e,{name:e,behavior:t})}getExtensions(e){let t=[];if(e==="vertex"){let r=this.renderer.backend.extensions;this.object.isBatchedMesh&&r.has("WEBGL_multi_draw")&&this.enableExtension("GL_ANGLE_multi_draw","require",e)}let n=this.extensions[e];if(n!==void 0)for(let{name:r,behavior:s}of n.values())t.push(`#extension ${r} : ${s}`);return t.join(`4276-`)}getClipDistance(){return"gl_ClipDistance"}isAvailable(e){let t=Ite[e];if(t===void 0){let n;switch(t=!1,e){case"float32Filterable":n="OES_texture_float_linear";break;case"clipDistance":n="WEBGL_clip_cull_distance";break}if(n!==void 0){let r=this.renderer.backend.extensions;r.has(n)&&(r.get(n),t=!0)}Ite[e]=t}return t}isFlipY(){return!0}enableHardwareClipping(e){this.enableExtension("GL_ANGLE_clip_cull_distance","require"),this.builtins.vertex.push(`out float gl_ClipDistance[ ${e} ]`)}enableMultiview(){this.enableExtension("GL_OVR_multiview2","require","fragment"),this.enableExtension("GL_OVR_multiview2","require","vertex"),this.builtins.vertex.push("layout(num_views = 2) in")}registerTransform(e,t){this.transforms.push({varyingName:e,attributeNode:t})}getTransforms(){let e=this.transforms,t="";for(let n=0;n<e.length;n++){let r=e[n],s=this.getPropertyName(r.attributeNode);s&&(t+=`${r.varyingName} = ${s};4276+`)}getClipDistance(){return"gl_ClipDistance"}isAvailable(e){let t=kte[e];if(t===void 0){let n;switch(t=!1,e){case"float32Filterable":n="OES_texture_float_linear";break;case"clipDistance":n="WEBGL_clip_cull_distance";break}if(n!==void 0){let r=this.renderer.backend.extensions;r.has(n)&&(r.get(n),t=!0)}kte[e]=t}return t}isFlipY(){return!0}enableHardwareClipping(e){this.enableExtension("GL_ANGLE_clip_cull_distance","require"),this.builtins.vertex.push(`out float gl_ClipDistance[ ${e} ]`)}enableMultiview(){this.enableExtension("GL_OVR_multiview2","require","fragment"),this.enableExtension("GL_OVR_multiview2","require","vertex"),this.builtins.vertex.push("layout(num_views = 2) in")}registerTransform(e,t){this.transforms.push({varyingName:e,attributeNode:t})}getTransforms(){let e=this.transforms,t="";for(let n=0;n<e.length;n++){let r=e[n],s=this.getPropertyName(r.attributeNode);s&&(t+=`${r.varyingName} = ${s};42774277 `)}return t}_getGLSLUniformStruct(e,t){return`42784278 layout( std140 ) uniform ${e} {42794279 ${t}@@ -4285,7 +4285,7 @@ ${this.getSignature()}
42854285 ${e.extensions}42864286 42874287 // precision4288-${Dte}4288+${Gte}42894289 42904290 // structs42914291 ${e.structs}@@ -4324,7 +4324,7 @@ ${this.getSignature()}
43244324 ${e.extensions}43254325 43264326 // precision4327-${Dte}4327+${Gte}43284328 43294329 // structs43304330 ${e.structs}@@ -4355,7 +4355,7 @@ void main() {
43554355 `,a===s&&t!=="compute"&&(n+=`// result43564356 `,t==="vertex"?(n+="gl_Position = ",n+=`${this.format(l.result,s.getNodeType(this),"vec4")};`):t==="fragment"&&(a.outputNode.isOutputStructNode||(n+="fragColor = ",n+=`${this.format(l.result,s.getNodeType(this),this.getOutputType())};`)))}let o=e[t];if(o.extensions=this.getExtensions(t),o.uniforms=this.getUniforms(t),o.attributes=this.getAttributes(t),o.varyings=this.getVaryings(t),o.vars=this.getVars(t,!0),o.structs=this.getStructs(t),o.codes=this.getCodes(t),o.transforms=this.getTransforms(t),o.flow=n,t==="vertex"){let a=this.renderer.backend.extensions;this.object.isBatchedMesh&&a.has("WEBGL_multi_draw")===!1&&(o.uniforms+=`43574357 uniform uint nodeUniformDrawId;4358-`)}}this.material!==null?(this.vertexShader=this._getGLSLVertexCode(e.vertex),this.fragmentShader=this._getGLSLFragmentCode(e.fragment)):this.computeShader=this._getGLSLVertexCode(e.compute)}getUniformFromNode(e,t,n,r=null){let s=super.getUniformFromNode(e,t,n,r),o=this.getDataFromNode(e,n,this.globalCache),a=o.uniformGPU;if(a===void 0){let l=e.groupNode,c=l.name,u=this.getBindGroupArray(c,n);if(t==="texture")a=new vx(s.name,s.node,l),u.push(a);else if(t==="cubeTexture"||t==="cubeDepthTexture")a=new J4(s.name,s.node,l),u.push(a);else if(t==="texture3D")a=new CS(s.name,s.node,l),u.push(a);else if(t==="buffer"){s.name=`buffer${e.id}`;let f=this.getSharedDataFromNode(e),d=f.buffer;d===void 0&&(e.name=`NodeBuffer_${e.id}`,d=new Z4(e,l),d.name=e.name,f.buffer=d),u.push(d),a=d}else{let f=this.uniformGroups[c];f===void 0?(f=new K4(c,l),this.uniformGroups[c]=f,u.push(f)):u.indexOf(f)===-1&&u.push(f),a=this.getNodeUniform(s,t);let d=a.name;f.uniforms.some(y=>y.name===d)||f.addUniform(a)}o.uniformGPU=a}return s}},JO=null,X_=null,eI=class{constructor(e={}){this.parameters=Object.assign({},e),this.data=new WeakMap,this.renderer=null,this.domElement=null,this.timestampQueryPool={[jc.RENDER]:null,[jc.COMPUTE]:null},this.trackTimestamp=e.trackTimestamp===!0}async init(e){this.renderer=e}get coordinateSystem(){}beginRender(){}finishRender(){}setXRTarget(){}beginCompute(){}finishCompute(){}draw(){}compute(){}createProgram(){}destroyProgram(){}createBindings(){}updateBindings(){}updateBinding(){}createRenderPipeline(){}createComputePipeline(){}needsRenderUpdate(){}getRenderCacheKey(){}createNodeBuilder(){}updateSampler(){}destroySampler(){}createDefaultTexture(){}createTexture(){}updateTexture(){}generateMipmaps(){}destroyTexture(){}async copyTextureToBuffer(){}copyTextureToTexture(){}copyFramebufferToTexture(){}createAttribute(){}createIndexAttribute(){}createStorageAttribute(){}createUniformBuffer(){}destroyUniformBuffer(){}updateAttribute(){}destroyAttribute(){}getContext(){}updateSize(){}updateViewport(){}updateTimeStampUID(e){let t=this.get(e),n=this.renderer.info.frame,r;e.isComputeNode===!0?r="c:"+this.renderer.info.compute.frameCalls:r="r:"+this.renderer.info.render.frameCalls,t.timestampUID=r+":"+e.id+":f"+n}getTimestampUID(e){return this.get(e).timestampUID}getTimestampFrames(e){let t=this.timestampQueryPool[e];return t?t.getTimestampFrames():[]}_getQueryPool(e){let t=e.startsWith("c:")?jc.COMPUTE:jc.RENDER;return this.timestampQueryPool[t]}getTimestamp(e){return this._getQueryPool(e).getTimestamp(e)}get hasTimestamp(){return!1}hasTimestampQuery(e){return this._getQueryPool(e).hasTimestampQuery(e)}isOccluded(){}async resolveTimestampsAsync(e="render"){if(!this.trackTimestamp){ni("WebGPURenderer: Timestamp tracking is disabled.");return}let t=this.timestampQueryPool[e];if(!t)return;let n=await t.resolveQueriesAsync();return this.renderer.info[e].timestamp=n,n}async getArrayBufferAsync(){}async hasFeatureAsync(){}hasFeature(){}getDrawingBufferSize(){return JO=JO||new Oe,this.renderer.getDrawingBufferSize(JO)}setScissorTest(){}getClearColor(){let e=this.renderer;return X_=X_||new _S,e.getClearColor(X_),X_.getRGB(X_),X_}getDomElement(){let e=this.domElement;return e===null&&(e=this.parameters.canvas!==void 0?this.parameters.canvas:UM(),"setAttribute"in e&&e.setAttribute("data-engine",`three.js r${"185"} webgpu`),this.domElement=e),e}hasCompatibility(){return!1}initRenderTarget(){}set(e,t){this.data.set(e,t)}get(e){let t=this.data.get(e);return t===void 0&&(t={},this.data.set(e,t)),t}has(e){return this.data.has(e)}delete(e){this.data.delete(e)}deleteBindGroupData(){}dispose(){}},uPe=0,u9=class{constructor(e,t){this.buffers=[e.bufferGPU,t],this.type=e.type,this.bufferType=e.bufferType,this.pbo=e.pbo,this.byteLength=e.byteLength,this.bytesPerElement=e.BYTES_PER_ELEMENT,this.version=e.version,this.isInteger=e.isInteger,this.activeBufferIndex=0,this.baseId=e.id}get id(){return`${this.baseId}|${this.activeBufferIndex}`}get bufferGPU(){return this.buffers[this.activeBufferIndex]}get transformBuffer(){return this.buffers[this.activeBufferIndex^1]}switchBuffers(){this.activeBufferIndex^=1}},h9=class{constructor(e){this.backend=e}createAttribute(e,t){let n=this.backend,{gl:r}=n,s=e.array,o=e.usage||r.STATIC_DRAW,a=e.isInterleavedBufferAttribute?e.data:e,l=n.get(a),c=l.bufferGPU;c===void 0&&(c=this._createBuffer(r,t,s,o),l.bufferGPU=c,l.bufferType=t,l.version=a.version);let u;if(s instanceof Float32Array)u=r.FLOAT;else if(typeof Float16Array<"u"&&s instanceof Float16Array)u=r.HALF_FLOAT;else if(s instanceof Uint16Array)e.isFloat16BufferAttribute?u=r.HALF_FLOAT:u=r.UNSIGNED_SHORT;else if(s instanceof Int16Array)u=r.SHORT;else if(s instanceof Uint32Array)u=r.UNSIGNED_INT;else if(s instanceof Int32Array)u=r.INT;else if(s instanceof Int8Array)u=r.BYTE;else if(s instanceof Uint8Array)u=r.UNSIGNED_BYTE;else if(s instanceof Uint8ClampedArray)u=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLBackend: Unsupported buffer data format: "+s);let f={bufferGPU:c,bufferType:t,type:u,byteLength:s.byteLength,bytesPerElement:s.BYTES_PER_ELEMENT,version:e.version,pbo:e.pbo,isInteger:u===r.INT||u===r.UNSIGNED_INT||e.gpuType===Zr,id:uPe++};if(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute){let d=this._createBuffer(r,t,s,o);f=new u9(f,d)}n.set(e,f)}updateAttribute(e){let t=this.backend,{gl:n}=t,r=e.array,s=e.isInterleavedBufferAttribute?e.data:e,o=t.get(s),a=o.bufferType,l=e.isInterleavedBufferAttribute?e.data.updateRanges:e.updateRanges;if(n.bindBuffer(a,o.bufferGPU),l.length===0)n.bufferSubData(a,0,r);else{for(let c=0,u=l.length;c<u;c++){let f=l[c];n.bufferSubData(a,f.start*r.BYTES_PER_ELEMENT,r,f.start,f.count)}s.clearUpdateRanges()}n.bindBuffer(a,null),o.version=s.version}destroyAttribute(e){let t=this.backend,{gl:n}=t;e.isInterleavedBufferAttribute&&t.delete(e.data);let r=t.get(e);n.deleteBuffer(r.bufferGPU),t.delete(e)}async getArrayBufferAsync(e,t=null,n=0,r=-1){let s=this.backend,{gl:o}=s,a=e.isInterleavedBufferAttribute?e.data:e,l=s.get(a),{bufferGPU:c}=l,u=r===-1?l.byteLength-n:r,f;if(t===null)f=new Uint8Array(new ArrayBuffer(u));else if(t.isReadbackBuffer){if(t._mapped===!0)throw new Error("THREE.WebGPURenderer: ReadbackBuffer must be released before being used again.");let d=()=>{t.buffer=null,t._mapped=!1,t.removeEventListener("release",d),t.removeEventListener("dispose",d)};t.addEventListener("release",d),t.addEventListener("dispose",d),f=new Uint8Array(new ArrayBuffer(u)),t.buffer=f.buffer}else f=new Uint8Array(t);return o.bindBuffer(o.COPY_READ_BUFFER,c),o.getBufferSubData(o.COPY_READ_BUFFER,n,f),o.bindBuffer(o.COPY_READ_BUFFER,null),o.bindBuffer(o.COPY_WRITE_BUFFER,null),t&&t.isReadbackBuffer?t:f.buffer}_createBuffer(e,t,n,r){let s=e.createBuffer();return e.bindBuffer(t,s),e.bufferData(t,n,r),e.bindBuffer(t,null),s}},jw,jd,f9=class{constructor(e){this.backend=e,this.gl=this.backend.gl,this.enabled={},this.parameters={},this.currentFlipSided=null,this.currentCullFace=null,this.currentProgram=null,this.currentBlendingEnabled=!1,this.currentBlending=null,this.currentBlendSrc=null,this.currentBlendDst=null,this.currentBlendSrcAlpha=null,this.currentBlendDstAlpha=null,this.currentPremultipledAlpha=null,this.currentPolygonOffsetFactor=null,this.currentPolygonOffsetUnits=null,this.currentColorMask=null,this.currentDepthReversed=!1,this.currentDepthFunc=null,this.currentDepthMask=null,this.currentStencilFunc=null,this.currentStencilRef=null,this.currentStencilFuncMask=null,this.currentStencilFail=null,this.currentStencilZFail=null,this.currentStencilZPass=null,this.currentStencilMask=null,this.currentLineWidth=null,this.currentClippingPlanes=0,this.currentVAO=null,this.currentIndex=null,this.currentBoundFramebuffers={},this.currentDrawbuffers=new WeakMap,this.maxTextures=this.gl.getParameter(this.gl.MAX_TEXTURE_IMAGE_UNITS),this.currentTextureSlot=null,this.currentBoundTextures={},this.currentBoundBufferBases={},this._init()}_init(){let e=this.gl;jw={[oo]:e.FUNC_ADD,[fb]:e.FUNC_SUBTRACT,[db]:e.FUNC_REVERSE_SUBTRACT},jd={[Nu]:e.ZERO,[pb]:e.ONE,[mb]:e.SRC_COLOR,[e0]:e.SRC_ALPHA,[yb]:e.SRC_ALPHA_SATURATE,[_b]:e.DST_COLOR,[gb]:e.DST_ALPHA,[Ab]:e.ONE_MINUS_SRC_COLOR,[t0]:e.ONE_MINUS_SRC_ALPHA,[xb]:e.ONE_MINUS_DST_COLOR,[vb]:e.ONE_MINUS_DST_ALPHA};let t=e.getParameter(e.SCISSOR_BOX),n=e.getParameter(e.VIEWPORT);this.currentScissor=new xn().fromArray(t),this.currentViewport=new xn().fromArray(n),this._tempVec4=new xn}enable(e){let{enabled:t}=this;t[e]!==!0&&(this.gl.enable(e),t[e]=!0)}disable(e){let{enabled:t}=this;t[e]!==!1&&(this.gl.disable(e),t[e]=!1)}setFlipSided(e){if(this.currentFlipSided!==e){let{gl:t}=this;e?t.frontFace(t.CW):t.frontFace(t.CCW),this.currentFlipSided=e}}setCullFace(e){let{gl:t}=this;e!==CM?(this.enable(t.CULL_FACE),e!==this.currentCullFace&&(e===ub?t.cullFace(t.BACK):e===RM?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):this.disable(t.CULL_FACE),this.currentCullFace=e}setLineWidth(e){let{currentLineWidth:t,gl:n}=this;e!==t&&(n.lineWidth(e),this.currentLineWidth=e)}setMRTBlending(e,t,n){let r=this.gl,s=this.backend.drawBuffersIndexedExt;if(!s){ni("WebGPURenderer: Multiple Render Targets (MRT) blending configuration is not fully supported in compatibility mode. The material blending will be used for all render targets.");return}for(let o=0;o<e.length;o++){let a=e[o],l=null;if(t!==null){let c=t.getBlendMode(a.name);c.blending===hb?l=n:c.blending!==ps&&(l=c)}else l=n;l!==null?this._setMRTBlendingIndex(o,l):s.blendFuncSeparateiOES(o,r.ONE,r.ZERO,r.ONE,r.ZERO)}}_setMRTBlendingIndex(e,t){let{gl:n}=this,r=this.backend.drawBuffersIndexedExt,s=t.blending,o=t.blendSrc,a=t.blendDst,l=t.blendEquation,c=t.premultipliedAlpha;if(s===Fd){let u=t.blendSrcAlpha!==null?t.blendSrcAlpha:o,f=t.blendDstAlpha!==null?t.blendDstAlpha:a,d=t.blendEquationAlpha!==null?t.blendEquationAlpha:l;r.blendEquationSeparateiOES(e,jw[l],jw[d]),r.blendFuncSeparateiOES(e,jd[o],jd[a],jd[u],jd[f])}else if(r.blendEquationSeparateiOES(e,n.FUNC_ADD,n.FUNC_ADD),c)switch(s){case Ms:r.blendFuncSeparateiOES(e,n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case Fh:r.blendFuncSeparateiOES(e,n.ONE,n.ONE,n.ONE,n.ONE);break;case Bh:r.blendFuncSeparateiOES(e,n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case Oh:r.blendFuncSeparateiOES(e,n.DST_COLOR,n.ONE_MINUS_SRC_ALPHA,n.ZERO,n.ONE);break;default:r.blendFuncSeparateiOES(e,n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break}else switch(s){case Ms:r.blendFuncSeparateiOES(e,n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case Fh:r.blendFuncSeparateiOES(e,n.SRC_ALPHA,n.ONE,n.ONE,n.ONE);break;case Bh:r.blendFuncSeparateiOES(e,n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case Oh:r.blendFuncSeparateiOES(e,n.DST_COLOR,n.ONE_MINUS_SRC_ALPHA,n.ZERO,n.ONE);break;default:r.blendFuncSeparateiOES(e,n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break}}setBlending(e,t,n,r,s,o,a,l){let{gl:c}=this;if(e===ps){this.currentBlendingEnabled===!0&&(this.disable(c.BLEND),this.currentBlendingEnabled=!1);return}if(this.currentBlendingEnabled===!1&&(this.enable(c.BLEND),this.currentBlendingEnabled=!0),e!==Fd){if(e!==this.currentBlending||l!==this.currentPremultipledAlpha){if((this.currentBlendEquation!==oo||this.currentBlendEquationAlpha!==oo)&&(c.blendEquation(c.FUNC_ADD),this.currentBlendEquation=oo,this.currentBlendEquationAlpha=oo),l)switch(e){case Ms:c.blendFuncSeparate(c.ONE,c.ONE_MINUS_SRC_ALPHA,c.ONE,c.ONE_MINUS_SRC_ALPHA);break;case Fh:c.blendFunc(c.ONE,c.ONE);break;case Bh:c.blendFuncSeparate(c.ZERO,c.ONE_MINUS_SRC_COLOR,c.ZERO,c.ONE);break;case Oh:c.blendFuncSeparate(c.DST_COLOR,c.ONE_MINUS_SRC_ALPHA,c.ZERO,c.ONE);break;default:ze("WebGLState: Invalid blending: ",e);break}else switch(e){case Ms:c.blendFuncSeparate(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA,c.ONE,c.ONE_MINUS_SRC_ALPHA);break;case Fh:c.blendFuncSeparate(c.SRC_ALPHA,c.ONE,c.ONE,c.ONE);break;case Bh:ze("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case Oh:ze("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:ze("WebGLState: Invalid blending: ",e);break}this.currentBlendSrc=null,this.currentBlendDst=null,this.currentBlendSrcAlpha=null,this.currentBlendDstAlpha=null,this.currentBlending=e,this.currentPremultipledAlpha=l}return}s=s||t,o=o||n,a=a||r,(t!==this.currentBlendEquation||s!==this.currentBlendEquationAlpha)&&(c.blendEquationSeparate(jw[t],jw[s]),this.currentBlendEquation=t,this.currentBlendEquationAlpha=s),(n!==this.currentBlendSrc||r!==this.currentBlendDst||o!==this.currentBlendSrcAlpha||a!==this.currentBlendDstAlpha)&&(c.blendFuncSeparate(jd[n],jd[r],jd[o],jd[a]),this.currentBlendSrc=n,this.currentBlendDst=r,this.currentBlendSrcAlpha=o,this.currentBlendDstAlpha=a),this.currentBlending=e,this.currentPremultipledAlpha=!1}setColorMask(e){this.currentColorMask!==e&&(this.gl.colorMask(e,e,e,e),this.currentColorMask=e)}setDepthTest(e){let{gl:t}=this;e?this.enable(t.DEPTH_TEST):this.disable(t.DEPTH_TEST)}setReversedDepth(e){if(this.currentDepthReversed!==e){let t=this.backend.extensions.get("EXT_clip_control");e?t.clipControlEXT(t.LOWER_LEFT_EXT,t.ZERO_TO_ONE_EXT):t.clipControlEXT(t.LOWER_LEFT_EXT,t.NEGATIVE_ONE_TO_ONE_EXT),this.currentDepthReversed=e}}setDepthMask(e){this.currentDepthMask!==e&&(this.gl.depthMask(e),this.currentDepthMask=e)}setDepthFunc(e){if(this.currentDepthReversed&&(e=Bb[e]),this.currentDepthFunc!==e){let{gl:t}=this;switch(e){case NA:t.depthFunc(t.NEVER);break;case FA:t.depthFunc(t.ALWAYS);break;case BA:t.depthFunc(t.LESS);break;case Ih:t.depthFunc(t.LEQUAL);break;case OA:t.depthFunc(t.EQUAL);break;case UA:t.depthFunc(t.GEQUAL);break;case kA:t.depthFunc(t.GREATER);break;case zA:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}this.currentDepthFunc=e}}scissor(e,t,n,r){let s=this._tempVec4.set(e,t,n,r);if(this.currentScissor.equals(s)===!1){let{gl:o}=this;o.scissor(s.x,s.y,s.z,s.w),this.currentScissor.copy(s)}}viewport(e,t,n,r){let s=this._tempVec4.set(e,t,n,r);if(this.currentViewport.equals(s)===!1){let{gl:o}=this;o.viewport(s.x,s.y,s.z,s.w),this.currentViewport.copy(s)}}setScissorTest(e){let t=this.gl;e?this.enable(t.SCISSOR_TEST):this.disable(t.SCISSOR_TEST)}setStencilTest(e){let{gl:t}=this;e?this.enable(t.STENCIL_TEST):this.disable(t.STENCIL_TEST)}setStencilMask(e){this.currentStencilMask!==e&&(this.gl.stencilMask(e),this.currentStencilMask=e)}setStencilFunc(e,t,n){(this.currentStencilFunc!==e||this.currentStencilRef!==t||this.currentStencilFuncMask!==n)&&(this.gl.stencilFunc(e,t,n),this.currentStencilFunc=e,this.currentStencilRef=t,this.currentStencilFuncMask=n)}setStencilOp(e,t,n){(this.currentStencilFail!==e||this.currentStencilZFail!==t||this.currentStencilZPass!==n)&&(this.gl.stencilOp(e,t,n),this.currentStencilFail=e,this.currentStencilZFail=t,this.currentStencilZPass=n)}setMaterial(e,t,n){let{gl:r}=this;e.side===vr?this.disable(r.CULL_FACE):this.enable(r.CULL_FACE);let s=e.side===mi;t&&(s=!s),this.setFlipSided(s),e.blending===Ms&&e.transparent===!1?this.setBlending(ps):this.setBlending(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha),this.setDepthFunc(e.depthFunc),this.setDepthTest(e.depthTest),this.setDepthMask(e.depthWrite),this.setColorMask(e.colorWrite);let o=e.stencilWrite;if(this.setStencilTest(o),o&&(this.setStencilMask(e.stencilWriteMask),this.setStencilFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),this.setStencilOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),this.setPolygonOffset(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits),e.alphaToCoverage===!0&&this.backend.renderer.currentSamples>0?this.enable(r.SAMPLE_ALPHA_TO_COVERAGE):this.disable(r.SAMPLE_ALPHA_TO_COVERAGE),n>0&&this.currentClippingPlanes!==n)for(let l=0;l<8;l++)l<n?this.enable(12288+l):this.disable(12288+l)}setPolygonOffset(e,t,n){let{gl:r}=this;e?(this.enable(r.POLYGON_OFFSET_FILL),(this.currentPolygonOffsetFactor!==t||this.currentPolygonOffsetUnits!==n)&&(r.polygonOffset(t,n),this.currentPolygonOffsetFactor=t,this.currentPolygonOffsetUnits=n)):this.disable(r.POLYGON_OFFSET_FILL)}useProgram(e){return this.currentProgram!==e?(this.gl.useProgram(e),this.currentProgram=e,!0):!1}setVertexState(e,t=null){let n=this.gl;return this.currentVAO!==e||this.currentIndex!==t?(n.bindVertexArray(e),t!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t),this.currentVAO=e,this.currentIndex=t,!0):!1}resetVertexState(){let e=this.gl;e.bindVertexArray(null),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null),this.currentVAO=null,this.currentIndex=null}bindFramebuffer(e,t){let{gl:n,currentBoundFramebuffers:r}=this;return r[e]!==t?(n.bindFramebuffer(e,t),r[e]=t,e===n.DRAW_FRAMEBUFFER&&(r[n.FRAMEBUFFER]=t),e===n.FRAMEBUFFER&&(r[n.DRAW_FRAMEBUFFER]=t),!0):!1}drawBuffers(e,t){let{gl:n}=this,r=[],s=!1;if(e.textures!==null){r=this.currentDrawbuffers.get(t),r===void 0&&(r=[],this.currentDrawbuffers.set(t,r));let o=e.textures;if(r.length!==o.length||r[0]!==n.COLOR_ATTACHMENT0){for(let a=0,l=o.length;a<l;a++)r[a]=n.COLOR_ATTACHMENT0+a;r.length=o.length,s=!0}}else r[0]!==n.BACK&&(r[0]=n.BACK,s=!0);s&&n.drawBuffers(r)}activeTexture(e){let{gl:t,currentTextureSlot:n,maxTextures:r}=this;e===void 0&&(e=t.TEXTURE0+r-1),n!==e&&(t.activeTexture(e),this.currentTextureSlot=e)}bindTexture(e,t,n){let{gl:r,currentTextureSlot:s,currentBoundTextures:o,maxTextures:a}=this;n===void 0&&(s===null?n=r.TEXTURE0+a-1:n=s);let l=o[n];l===void 0&&(l={type:void 0,texture:void 0},o[n]=l),(l.type!==e||l.texture!==t)&&(s!==n&&(r.activeTexture(n),this.currentTextureSlot=n),r.bindTexture(e,t),l.type=e,l.texture=t)}bindBufferBase(e,t,n){let{gl:r}=this,s=`${e}-${t}`;return this.currentBoundBufferBases[s]!==n?(r.bindBufferBase(e,t,n),this.currentBoundBufferBases[s]=n,!0):!1}unbindTexture(){let{gl:e,currentTextureSlot:t,currentBoundTextures:n}=this,r=n[t];r!==void 0&&r.type!==void 0&&(e.bindTexture(r.type,null),r.type=void 0,r.texture=void 0)}getParameter(e){let{gl:t,parameters:n}=this;return n[e]!==void 0?n[e]:t.getParameter(e)}pixelStorei(e,t){let{gl:n,parameters:r}=this;r[e]!==t&&(n.pixelStorei(e,t),r[e]=t)}},d9=class{constructor(e){this.backend=e,this.gl=this.backend.gl,this.extensions=e.extensions}convert(e,t=ua){let{gl:n,extensions:r}=this,s,o=ln.getTransfer(t);if(e===Ji)return n.UNSIGNED_BYTE;if(e===rg)return n.UNSIGNED_SHORT_4_4_4_4;if(e===sg)return n.UNSIGNED_SHORT_5_5_5_1;if(e===og)return n.UNSIGNED_INT_5_9_9_9_REV;if(e===ag)return n.UNSIGNED_INT_10F_11F_11F_REV;if(e===kh)return n.BYTE;if(e===zh)return n.SHORT;if(e===wl)return n.UNSIGNED_SHORT;if(e===Zr)return n.INT;if(e===xi)return n.UNSIGNED_INT;if(e===cr)return n.FLOAT;if(e===Wi)return n.HALF_FLOAT;if(e===u_)return n.ALPHA;if(e===Bd)return n.RGB;if(e===Or)return n.RGBA;if(e===Gs)return n.DEPTH_COMPONENT;if(e===xo)return n.DEPTH_STENCIL;if(e===Od)return n.RED;if(e===Vh)return n.RED_INTEGER;if(e===js)return n.RG;if(e===Gh)return n.RG_INTEGER;if(e===v0)return n.RGBA_INTEGER;if(e===qh||e===Hh||e===Wh||e===jh)if(o===kt)if(s=r.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(e===qh)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(e===Hh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(e===Wh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(e===jh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=r.get("WEBGL_compressed_texture_s3tc"),s!==null){if(e===qh)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===Hh)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===Wh)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===jh)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(e===lg||e===cg||e===ug||e===hg)if(s=r.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(e===lg)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===cg)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===ug)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===hg)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(e===_0||e===x0||e===y0||e===b0||e===w0||e===Xh||e===S0)if(s=r.get("WEBGL_compressed_texture_etc"),s!==null){if(e===_0||e===x0)return o===kt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(e===y0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(e===b0)return s.COMPRESSED_R11_EAC;if(e===w0)return s.COMPRESSED_SIGNED_R11_EAC;if(e===Xh)return s.COMPRESSED_RG11_EAC;if(e===S0)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(e===T0||e===E0||e===M0||e===C0||e===R0||e===I0||e===P0||e===L0||e===D0||e===N0||e===F0||e===B0||e===O0||e===U0)if(s=r.get("WEBGL_compressed_texture_astc"),s!==null){if(e===T0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(e===E0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(e===M0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(e===C0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(e===R0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(e===I0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(e===P0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(e===L0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(e===D0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(e===N0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(e===F0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(e===B0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(e===O0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(e===U0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(e===k0||e===z0||e===V0)if(s=r.get("EXT_texture_compression_bptc"),s!==null){if(e===k0)return o===kt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(e===z0)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(e===V0)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(e===G0||e===q0||e===$h||e===H0)if(s=r.get("EXT_texture_compression_rgtc"),s!==null){if(e===G0)return s.COMPRESSED_RED_RGTC1_EXT;if(e===q0)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(e===$h)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(e===H0)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return e===ca?n.UNSIGNED_INT_24_8:n[e]!==void 0?n[e]:null}_clientWaitAsync(){let{gl:e}=this,t=e.fenceSync(e.SYNC_GPU_COMMANDS_COMPLETE,0);return e.flush(),new Promise((n,r)=>{function s(){let o=e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0);if(o===e.WAIT_FAILED){e.deleteSync(t),r();return}if(o===e.TIMEOUT_EXPIRED){requestAnimationFrame(s);return}e.deleteSync(t),n()}s()})}},Nte=!1,FR,eU,Fte,p9=class{constructor(e){this.backend=e,this.gl=e.gl,this.extensions=e.extensions,this.defaultTextures={},this._srcFramebuffer=null,this._dstFramebuffer=null,Nte===!1&&(this._init(),Nte=!0)}_init(){let e=this.gl;FR={[Cd]:e.REPEAT,[aa]:e.CLAMP_TO_EDGE,[Rd]:e.MIRRORED_REPEAT},eU={[Ti]:e.NEAREST,[Rb]:e.NEAREST_MIPMAP_NEAREST,[Wc]:e.NEAREST_MIPMAP_LINEAR,[Mi]:e.LINEAR,[g0]:e.LINEAR_MIPMAP_NEAREST,[Vo]:e.LINEAR_MIPMAP_LINEAR},Fte={[Lb]:e.NEVER,[Fb]:e.ALWAYS,[h_]:e.LESS,[Yh]:e.LEQUAL,[Db]:e.EQUAL,[Fu]:e.GEQUAL,[fg]:e.GREATER,[Nb]:e.NOTEQUAL}}getGLTextureType(e){let{gl:t}=this,n;return e.isCubeTexture===!0?n=t.TEXTURE_CUBE_MAP:e.isArrayTexture===!0||e.isDataArrayTexture===!0||e.isCompressedArrayTexture===!0?n=t.TEXTURE_2D_ARRAY:e.isData3DTexture===!0?n=t.TEXTURE_3D:n=t.TEXTURE_2D,n}getInternalFormat(e,t,n,r,s,o=!1){let{gl:a,extensions:l}=this;if(e!==null){if(a[e]!==void 0)return a[e];Xe("WebGLBackend: Attempt to use non-existing WebGL internal format '"+e+"'")}let c=null;r&&(c=l.get("EXT_texture_norm16"),c||Xe("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let u=t;if(t===a.RED&&(n===a.FLOAT&&(u=a.R32F),n===a.HALF_FLOAT&&(u=a.R16F),n===a.UNSIGNED_BYTE&&(u=a.R8),n===a.BYTE&&(u=a.R8_SNORM),n===a.UNSIGNED_SHORT&&c&&(u=c.R16_EXT),n===a.SHORT&&c&&(u=c.R16_SNORM_EXT)),t===a.RED_INTEGER&&(n===a.UNSIGNED_BYTE&&(u=a.R8UI),n===a.UNSIGNED_SHORT&&(u=a.R16UI),n===a.UNSIGNED_INT&&(u=a.R32UI),n===a.BYTE&&(u=a.R8I),n===a.SHORT&&(u=a.R16I),n===a.INT&&(u=a.R32I)),t===a.RG&&(n===a.FLOAT&&(u=a.RG32F),n===a.HALF_FLOAT&&(u=a.RG16F),n===a.UNSIGNED_BYTE&&(u=a.RG8),n===a.BYTE&&(u=a.RG8_SNORM),n===a.UNSIGNED_SHORT&&c&&(u=c.RG16_EXT),n===a.SHORT&&c&&(u=c.RG16_SNORM_EXT)),t===a.RG_INTEGER&&(n===a.UNSIGNED_BYTE&&(u=a.RG8UI),n===a.UNSIGNED_SHORT&&(u=a.RG16UI),n===a.UNSIGNED_INT&&(u=a.RG32UI),n===a.BYTE&&(u=a.RG8I),n===a.SHORT&&(u=a.RG16I),n===a.INT&&(u=a.RG32I)),t===a.RGB){let f=o?i0:ln.getTransfer(s);n===a.FLOAT&&(u=a.RGB32F),n===a.HALF_FLOAT&&(u=a.RGB16F),n===a.UNSIGNED_BYTE&&(u=f===kt?a.SRGB8:a.RGB8),n===a.BYTE&&(u=a.RGB8_SNORM),n===a.UNSIGNED_SHORT&&c&&(u=c.RGB16_EXT),n===a.SHORT&&c&&(u=c.RGB16_SNORM_EXT),n===a.UNSIGNED_SHORT_5_6_5&&(u=a.RGB565),n===a.UNSIGNED_SHORT_5_5_5_1&&(u=a.RGB5_A1),n===a.UNSIGNED_SHORT_4_4_4_4&&(u=a.RGB4),n===a.UNSIGNED_INT_5_9_9_9_REV&&(u=a.RGB9_E5),n===a.UNSIGNED_INT_10F_11F_11F_REV&&(u=a.R11F_G11F_B10F)}if(t===a.RGB_INTEGER&&(n===a.UNSIGNED_BYTE&&(u=a.RGB8UI),n===a.UNSIGNED_SHORT&&(u=a.RGB16UI),n===a.UNSIGNED_INT&&(u=a.RGB32UI),n===a.BYTE&&(u=a.RGB8I),n===a.SHORT&&(u=a.RGB16I),n===a.INT&&(u=a.RGB32I)),t===a.RGBA){let f=o?i0:ln.getTransfer(s);n===a.FLOAT&&(u=a.RGBA32F),n===a.HALF_FLOAT&&(u=a.RGBA16F),n===a.UNSIGNED_BYTE&&(u=f===kt?a.SRGB8_ALPHA8:a.RGBA8),n===a.BYTE&&(u=a.RGBA8_SNORM),n===a.UNSIGNED_SHORT&&c&&(u=c.RGBA16_EXT),n===a.SHORT&&c&&(u=c.RGBA16_SNORM_EXT),n===a.UNSIGNED_SHORT_4_4_4_4&&(u=a.RGBA4),n===a.UNSIGNED_SHORT_5_5_5_1&&(u=a.RGB5_A1)}return t===a.RGBA_INTEGER&&(n===a.UNSIGNED_BYTE&&(u=a.RGBA8UI),n===a.UNSIGNED_SHORT&&(u=a.RGBA16UI),n===a.UNSIGNED_INT&&(u=a.RGBA32UI),n===a.BYTE&&(u=a.RGBA8I),n===a.SHORT&&(u=a.RGBA16I),n===a.INT&&(u=a.RGBA32I)),t===a.DEPTH_COMPONENT&&(n===a.UNSIGNED_SHORT&&(u=a.DEPTH_COMPONENT16),n===a.UNSIGNED_INT&&(u=a.DEPTH_COMPONENT24),n===a.FLOAT&&(u=a.DEPTH_COMPONENT32F)),t===a.DEPTH_STENCIL&&n===a.UNSIGNED_INT_24_8&&(u=a.DEPTH24_STENCIL8),(u===a.R16F||u===a.R32F||u===a.RG16F||u===a.RG32F||u===a.RGBA16F||u===a.RGBA32F)&&l.get("EXT_color_buffer_float"),u}setTextureParameters(e,t){let{gl:n,extensions:r,backend:s}=this,{state:o}=this.backend,a=ln.getPrimaries(ln.workingColorSpace),l=t.colorSpace===ua?null:ln.getPrimaries(t.colorSpace),c=t.colorSpace===ua||a===l?n.NONE:n.BROWSER_DEFAULT_WEBGL;o.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,t.flipY),o.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),o.pixelStorei(n.UNPACK_ALIGNMENT,t.unpackAlignment),o.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,c),n.texParameteri(e,n.TEXTURE_WRAP_S,FR[t.wrapS]),n.texParameteri(e,n.TEXTURE_WRAP_T,FR[t.wrapT]),(e===n.TEXTURE_3D||e===n.TEXTURE_2D_ARRAY)&&(t.isArrayTexture||n.texParameteri(e,n.TEXTURE_WRAP_R,FR[t.wrapR])),n.texParameteri(e,n.TEXTURE_MAG_FILTER,eU[t.magFilter]);let u=t.mipmaps!==void 0&&t.mipmaps.length>0,f=t.minFilter===Mi&&u?Vo:t.minFilter;if(n.texParameteri(e,n.TEXTURE_MIN_FILTER,eU[f]),t.compareFunction&&(n.texParameteri(e,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(e,n.TEXTURE_COMPARE_FUNC,Fte[t.compareFunction])),r.has("EXT_texture_filter_anisotropic")===!0){if(t.magFilter===Ti||t.minFilter!==Wc&&t.minFilter!==Vo||t.type===cr&&r.has("OES_texture_float_linear")===!1)return;if(t.anisotropy>1){let d=r.get("EXT_texture_filter_anisotropic");n.texParameterf(e,d.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(t.anisotropy,s.capabilities.getMaxAnisotropy()))}}}createDefaultTexture(e){let{gl:t,backend:n,defaultTextures:r}=this,s=this.getGLTextureType(e),o=r[s];o===void 0&&(o=t.createTexture(),n.state.bindTexture(s,o),t.texParameteri(s,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(s,t.TEXTURE_MAG_FILTER,t.NEAREST),r[s]=o),n.set(e,{textureGPU:o,glTextureType:s})}createTexture(e,t){let{gl:n,backend:r}=this,s,o,a,l,c;if(e.isExternalTexture===!0)s=e.sourceTexture,o=this.getGLTextureType(e);else{let{levels:u,width:f,height:d,depth:A}=t;a=r.utils.convert(e.format,e.colorSpace),l=r.utils.convert(e.type),c=this.getInternalFormat(e.internalFormat,a,l,e.normalized,e.colorSpace,e.isVideoTexture),s=n.createTexture(),o=this.getGLTextureType(e),r.state.bindTexture(o,s),this.setTextureParameters(o,e),e.isArrayTexture||e.isDataArrayTexture||e.isCompressedArrayTexture?n.texStorage3D(n.TEXTURE_2D_ARRAY,u,c,f,d,A):e.isData3DTexture?n.texStorage3D(n.TEXTURE_3D,u,c,f,d,A):e.isVideoTexture||n.texStorage2D(o,u,c,f,d)}r.set(e,{textureGPU:s,glTextureType:o,glFormat:a,glType:l,glInternalFormat:c})}copyBufferToTexture(e,t){let{gl:n,backend:r}=this,{state:s}=r,{textureGPU:o,glTextureType:a,glFormat:l,glType:c}=r.get(t),{width:u,height:f}=t.source.data;n.bindBuffer(n.PIXEL_UNPACK_BUFFER,e),r.state.bindTexture(a,o),s.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!1),s.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),n.texSubImage2D(a,0,0,0,u,f,l,c,0),n.bindBuffer(n.PIXEL_UNPACK_BUFFER,null),r.state.unbindTexture()}updateTexture(e,t){let{gl:n}=this,{width:r,height:s}=t,{textureGPU:o,glTextureType:a,glFormat:l,glType:c,glInternalFormat:u}=this.backend.get(e);if(!(e.isRenderTargetTexture||o===void 0))if(this.backend.state.bindTexture(a,o),this.setTextureParameters(a,e),e.isCompressedTexture){let f=e.mipmaps,d=t.image;for(let A=0;A<f.length;A++){let y=f[A];e.isCompressedArrayTexture?e.format!==n.RGBA?l!==null?n.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,A,0,0,0,y.width,y.height,d.depth,l,y.data):Xe("WebGLBackend: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texSubImage3D(n.TEXTURE_2D_ARRAY,A,0,0,0,y.width,y.height,d.depth,l,c,y.data):l!==null?n.compressedTexSubImage2D(n.TEXTURE_2D,A,0,0,y.width,y.height,l,y.data):Xe("WebGLBackend: Unsupported compressed texture format")}}else if(e.isCubeTexture){let f=t.images,d=e.mipmaps;for(let A=0;A<6;A++){let y=BR(f[A]);n.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+A,0,0,0,r,s,l,c,y);for(let w=0;w<d.length;w++){let S=d[w],T=BR(S.images[A]);n.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+A,w+1,0,0,T.width,T.height,l,c,T)}}}else if(e.isDataArrayTexture||e.isArrayTexture){let f=t.image;if(e.layerUpdates.size>0){let d=Ob(f.width,f.height,e.format,e.type);for(let A of e.layerUpdates){let y=f.data.subarray(A*d/f.data.BYTES_PER_ELEMENT,(A+1)*d/f.data.BYTES_PER_ELEMENT);n.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,A,f.width,f.height,1,l,c,y)}e.clearLayerUpdates()}else n.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,f.width,f.height,f.depth,l,c,f.data)}else if(e.isData3DTexture){let f=t.image;n.texSubImage3D(n.TEXTURE_3D,0,0,0,0,f.width,f.height,f.depth,l,c,f.data)}else if(e.isVideoTexture)e.update(),n.texImage2D(a,0,u,l,c,t.image);else if(e.isHTMLTexture)typeof n.texElementImage2D=="function"&&(n.texElementImage2D.length===3?n.texElementImage2D(n.TEXTURE_2D,n.RGBA8,t.image):n.texElementImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,t.image));else{let f=e.mipmaps;if(f.length>0)for(let d=0,A=f.length;d<A;d++){let y=f[d],w=BR(y);n.texSubImage2D(a,d,0,0,y.width,y.height,l,c,w)}else{let d=BR(t.image);n.texSubImage2D(a,0,0,0,r,s,l,c,d)}}}generateMipmaps(e){let{gl:t,backend:n}=this,{textureGPU:r,glTextureType:s}=n.get(e);n.state.bindTexture(s,r),t.generateMipmap(s)}deallocateRenderBuffers(e){let{gl:t,backend:n}=this;if(e){let r=n.get(e);if(r.renderBufferStorageSetup=void 0,r.framebuffers){for(let s in r.framebuffers)t.deleteFramebuffer(r.framebuffers[s]);delete r.framebuffers}if(r.depthRenderbuffer&&(t.deleteRenderbuffer(r.depthRenderbuffer),delete r.depthRenderbuffer),r.stencilRenderbuffer&&(t.deleteRenderbuffer(r.stencilRenderbuffer),delete r.stencilRenderbuffer),r.msaaFrameBuffer&&(t.deleteFramebuffer(r.msaaFrameBuffer),delete r.msaaFrameBuffer),r.msaaRenderbuffers){for(let s=0;s<r.msaaRenderbuffers.length;s++)t.deleteRenderbuffer(r.msaaRenderbuffers[s]);delete r.msaaRenderbuffers}}}destroyTexture(e,t=!1){let{gl:n,backend:r}=this,{textureGPU:s,renderTarget:o}=r.get(e);this.deallocateRenderBuffers(o),t===!1&&e.isExternalTexture!==!0&&n.deleteTexture(s),r.delete(e)}copyTextureToTexture(e,t,n=null,r=null,s=0,o=0){let{gl:a,backend:l}=this,{state:c}=this.backend,{textureGPU:u,glTextureType:f,glType:d,glFormat:A}=l.get(t);c.bindTexture(f,u);let y,w,S,T,R,P,I,F,D,L=e.isCompressedTexture?e.mipmaps[o]:e.image;if(n!==null)y=n.max.x-n.min.x,w=n.max.y-n.min.y,S=n.isBox3?n.max.z-n.min.z:1,T=n.min.x,R=n.min.y,P=n.isBox3?n.min.z:0;else{let H=Math.pow(2,-s);y=Math.floor(L.width*H),w=Math.floor(L.height*H),e.isDataArrayTexture||e.isArrayTexture?S=L.depth:e.isData3DTexture?S=Math.floor(L.depth*H):S=1,T=0,R=0,P=0}r!==null?(I=r.x,F=r.y,D=r.z):(I=0,F=0,D=0),c.pixelStorei(a.UNPACK_FLIP_Y_WEBGL,t.flipY),c.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),c.pixelStorei(a.UNPACK_ALIGNMENT,t.unpackAlignment);let C=c.getParameter(a.UNPACK_ROW_LENGTH),B=c.getParameter(a.UNPACK_IMAGE_HEIGHT),k=c.getParameter(a.UNPACK_SKIP_PIXELS),z=c.getParameter(a.UNPACK_SKIP_ROWS),G=c.getParameter(a.UNPACK_SKIP_IMAGES);c.pixelStorei(a.UNPACK_ROW_LENGTH,L.width),c.pixelStorei(a.UNPACK_IMAGE_HEIGHT,L.height),c.pixelStorei(a.UNPACK_SKIP_PIXELS,T),c.pixelStorei(a.UNPACK_SKIP_ROWS,R),c.pixelStorei(a.UNPACK_SKIP_IMAGES,P);let W=e.isDataArrayTexture||e.isData3DTexture||t.isArrayTexture,Y=t.isDataArrayTexture||t.isData3DTexture||t.isArrayTexture;if(e.isDepthTexture){let H=l.get(e),$=l.get(t),J=l.get(H.renderTarget),te=l.get($.renderTarget),ce=J.framebuffers[H.cacheKey],he=te.framebuffers[$.cacheKey],ve=c.currentBoundFramebuffers[a.READ_FRAMEBUFFER]??null,Re=c.currentBoundFramebuffers[a.DRAW_FRAMEBUFFER]??null;c.bindFramebuffer(a.READ_FRAMEBUFFER,ce),c.bindFramebuffer(a.DRAW_FRAMEBUFFER,he);for(let Qe=0;Qe<S;Qe++)W&&(a.framebufferTextureLayer(a.READ_FRAMEBUFFER,a.COLOR_ATTACHMENT0,H.textureGPU,s,P+Qe),a.framebufferTextureLayer(a.DRAW_FRAMEBUFFER,a.COLOR_ATTACHMENT0,u,o,D+Qe)),a.blitFramebuffer(T,R,y,w,I,F,y,w,a.DEPTH_BUFFER_BIT,a.NEAREST);c.bindFramebuffer(a.READ_FRAMEBUFFER,ve),c.bindFramebuffer(a.DRAW_FRAMEBUFFER,Re)}else if(s!==0||e.isRenderTargetTexture||l.has(e)){let H=l.get(e);this._srcFramebuffer===null&&(this._srcFramebuffer=a.createFramebuffer()),this._dstFramebuffer===null&&(this._dstFramebuffer=a.createFramebuffer());let $=c.currentBoundFramebuffers[a.READ_FRAMEBUFFER]??null,J=c.currentBoundFramebuffers[a.DRAW_FRAMEBUFFER]??null;c.bindFramebuffer(a.READ_FRAMEBUFFER,this._srcFramebuffer),c.bindFramebuffer(a.DRAW_FRAMEBUFFER,this._dstFramebuffer);for(let te=0;te<S;te++)W?a.framebufferTextureLayer(a.READ_FRAMEBUFFER,a.COLOR_ATTACHMENT0,H.textureGPU,s,P+te):a.framebufferTexture2D(a.READ_FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,H.textureGPU,s),Y?a.framebufferTextureLayer(a.DRAW_FRAMEBUFFER,a.COLOR_ATTACHMENT0,u,o,D+te):a.framebufferTexture2D(a.DRAW_FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,u,o),s!==0?a.blitFramebuffer(T,R,y,w,I,F,y,w,a.COLOR_BUFFER_BIT,a.NEAREST):Y?a.copyTexSubImage3D(f,o,I,F,D+te,T,R,y,w):a.copyTexSubImage2D(f,o,I,F,T,R,y,w);c.bindFramebuffer(a.READ_FRAMEBUFFER,$),c.bindFramebuffer(a.DRAW_FRAMEBUFFER,J)}else Y?e.isDataTexture||e.isData3DTexture?a.texSubImage3D(f,o,I,F,D,y,w,S,A,d,L.data):t.isCompressedArrayTexture?a.compressedTexSubImage3D(f,o,I,F,D,y,w,S,A,L.data):a.texSubImage3D(f,o,I,F,D,y,w,S,A,d,L):e.isDataTexture?a.texSubImage2D(a.TEXTURE_2D,o,I,F,y,w,A,d,L.data):e.isCompressedTexture?a.compressedTexSubImage2D(a.TEXTURE_2D,o,I,F,L.width,L.height,A,L.data):a.texSubImage2D(a.TEXTURE_2D,o,I,F,y,w,A,d,L);c.pixelStorei(a.UNPACK_ROW_LENGTH,C),c.pixelStorei(a.UNPACK_IMAGE_HEIGHT,B),c.pixelStorei(a.UNPACK_SKIP_PIXELS,k),c.pixelStorei(a.UNPACK_SKIP_ROWS,z),c.pixelStorei(a.UNPACK_SKIP_IMAGES,G),o===0&&t.generateMipmaps&&a.generateMipmap(f),c.unbindTexture()}copyFramebufferToTexture(e,t,n){let{gl:r}=this,{state:s}=this.backend,{textureGPU:o}=this.backend.get(e),{x:a,y:l,z:c,w:u}=n,f=e.isDepthTexture===!0||t.renderTarget&&t.renderTarget.samples>0,d=t.renderTarget?t.renderTarget.height:this.backend.getDrawingBufferSize().y;if(f){let A=a!==0||l!==0,y,w;if(e.isDepthTexture===!0?(y=r.DEPTH_BUFFER_BIT,w=r.DEPTH_ATTACHMENT,t.stencil&&(y|=r.STENCIL_BUFFER_BIT)):(y=r.COLOR_BUFFER_BIT,w=r.COLOR_ATTACHMENT0),A){let S=this.backend.get(t.renderTarget),T=S.framebuffers[t.getCacheKey()],R=S.msaaFrameBuffer;s.bindFramebuffer(r.DRAW_FRAMEBUFFER,T),s.bindFramebuffer(r.READ_FRAMEBUFFER,R);let P=d-l-u;r.blitFramebuffer(a,P,a+c,P+u,a,P,a+c,P+u,y,r.NEAREST),s.bindFramebuffer(r.READ_FRAMEBUFFER,T),s.bindTexture(r.TEXTURE_2D,o),r.copyTexSubImage2D(r.TEXTURE_2D,0,0,0,a,P,c,u),s.unbindTexture()}else{let S=r.createFramebuffer();s.bindFramebuffer(r.DRAW_FRAMEBUFFER,S),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,w,r.TEXTURE_2D,o,0),r.blitFramebuffer(0,0,c,u,0,0,c,u,y,r.NEAREST),r.deleteFramebuffer(S)}}else s.bindTexture(r.TEXTURE_2D,o),r.copyTexSubImage2D(r.TEXTURE_2D,0,0,0,a,d-u-l,c,u),s.unbindTexture();e.generateMipmaps&&this.generateMipmaps(e),this.backend._setFramebuffer(t)}setupRenderBufferStorage(e,t,n,r=!1){let{gl:s}=this,o=t.renderTarget,{depthTexture:a,depthBuffer:l,stencilBuffer:c,width:u,height:f}=o;if(s.bindRenderbuffer(s.RENDERBUFFER,e),l&&!c){let d=s.DEPTH_COMPONENT24;r===!0?this.extensions.get("WEBGL_multisampled_render_to_texture").renderbufferStorageMultisampleEXT(s.RENDERBUFFER,o.samples,d,u,f):n>0?(a&&a.isDepthTexture&&a.type===s.FLOAT&&(d=s.DEPTH_COMPONENT32F),s.renderbufferStorageMultisample(s.RENDERBUFFER,n,d,u,f)):s.renderbufferStorage(s.RENDERBUFFER,d,u,f),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.RENDERBUFFER,e)}else l&&c&&(n>0?s.renderbufferStorageMultisample(s.RENDERBUFFER,n,s.DEPTH24_STENCIL8,u,f):s.renderbufferStorage(s.RENDERBUFFER,s.DEPTH_STENCIL,u,f),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_STENCIL_ATTACHMENT,s.RENDERBUFFER,e));s.bindRenderbuffer(s.RENDERBUFFER,null)}async copyTextureToBuffer(e,t,n,r,s,o){let{backend:a,gl:l}=this,{textureGPU:c,glFormat:u,glType:f}=this.backend.get(e),d=l.createFramebuffer();a.state.bindFramebuffer(l.READ_FRAMEBUFFER,d);let A=e.isCubeTexture?l.TEXTURE_CUBE_MAP_POSITIVE_X+o:l.TEXTURE_2D;l.framebufferTexture2D(l.READ_FRAMEBUFFER,l.COLOR_ATTACHMENT0,A,c,0);let y=this._getTypedArrayType(f),w=this._getBytesPerTexel(f,u),T=r*s*w,R=l.createBuffer();l.bindBuffer(l.PIXEL_PACK_BUFFER,R),l.bufferData(l.PIXEL_PACK_BUFFER,T,l.STREAM_READ),l.readPixels(t,n,r,s,u,f,0),l.bindBuffer(l.PIXEL_PACK_BUFFER,null),await a.utils._clientWaitAsync();let P=new y(T/y.BYTES_PER_ELEMENT);return l.bindBuffer(l.PIXEL_PACK_BUFFER,R),l.getBufferSubData(l.PIXEL_PACK_BUFFER,0,P),l.bindBuffer(l.PIXEL_PACK_BUFFER,null),a.state.bindFramebuffer(l.READ_FRAMEBUFFER,null),l.deleteFramebuffer(d),P}_getTypedArrayType(e){let{gl:t}=this;if(e===t.UNSIGNED_BYTE)return Uint8Array;if(e===t.UNSIGNED_SHORT_4_4_4_4||e===t.UNSIGNED_SHORT_5_5_5_1||e===t.UNSIGNED_SHORT_5_6_5||e===t.UNSIGNED_SHORT)return Uint16Array;if(e===t.UNSIGNED_INT)return Uint32Array;if(e===t.HALF_FLOAT)return Uint16Array;if(e===t.FLOAT)return Float32Array;throw new Error(`THREE.WebGLTextureUtils: Unsupported WebGL type: ${e}`)}_getBytesPerTexel(e,t){let{gl:n}=this,r=0;if(e===n.UNSIGNED_BYTE&&(r=1),(e===n.UNSIGNED_SHORT_4_4_4_4||e===n.UNSIGNED_SHORT_5_5_5_1||e===n.UNSIGNED_SHORT_5_6_5||e===n.UNSIGNED_SHORT||e===n.HALF_FLOAT)&&(r=2),(e===n.UNSIGNED_INT||e===n.FLOAT)&&(r=4),t===n.RGBA)return r*4;if(t===n.RGB)return r*3;if(t===n.ALPHA)return r}dispose(){let{gl:e}=this;this._srcFramebuffer!==null&&e.deleteFramebuffer(this._srcFramebuffer),this._dstFramebuffer!==null&&e.deleteFramebuffer(this._dstFramebuffer)}};function BR(i){return i.isDataTexture?i.image.data:typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas?i:i.data}var m9=class{constructor(e){this.backend=e,this.gl=this.backend.gl,this.availableExtensions=this.gl.getSupportedExtensions(),this.extensions={}}get(e){let t=this.extensions[e];return t===void 0&&(t=this.gl.getExtension(e),this.extensions[e]=t),t}has(e){return this.availableExtensions.includes(e)}},A9=class{constructor(e){this.backend=e,this.maxAnisotropy=null,this.maxUniformBlockSize=null}getMaxAnisotropy(){if(this.maxAnisotropy!==null)return this.maxAnisotropy;let e=this.backend.gl,t=this.backend.extensions;if(t.has("EXT_texture_filter_anisotropic")===!0){let n=t.get("EXT_texture_filter_anisotropic");this.maxAnisotropy=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else this.maxAnisotropy=0;return this.maxAnisotropy}getUniformBufferLimit(){if(this.maxUniformBlockSize!==null)return this.maxUniformBlockSize;let e=this.backend.gl;return this.maxUniformBlockSize=e.getParameter(e.MAX_UNIFORM_BLOCK_SIZE),this.maxUniformBlockSize}},Bte={WEBGL_multi_draw:"WEBGL_multi_draw",WEBGL_compressed_texture_astc:"texture-compression-astc",WEBGL_compressed_texture_etc:"texture-compression-etc2",WEBGL_compressed_texture_etc1:"texture-compression-etc1",WEBGL_compressed_texture_pvrtc:"texture-compression-pvrtc",WEBGL_compressed_texture_s3tc:"texture-compression-s3tc",EXT_texture_compression_bptc:"texture-compression-bc",EXT_disjoint_timer_query_webgl2:"timestamp-query",OVR_multiview2:"OVR_multiview2"},g9=class{constructor(e){this.gl=e.gl,this.extensions=e.extensions,this.info=e.renderer.info,this.mode=null,this.index=0,this.type=null,this.object=null}render(e,t){let{gl:n,mode:r,object:s,type:o,info:a,index:l}=this;l!==0?n.drawElements(r,t,o,e):n.drawArrays(r,e,t),a.update(s,t,1)}renderInstances(e,t,n){let{gl:r,mode:s,type:o,index:a,object:l,info:c}=this;n!==0&&(a!==0?r.drawElementsInstanced(s,t,o,e,n):r.drawArraysInstanced(s,e,t,n),c.update(l,t,n))}renderMultiDraw(e,t,n){let{extensions:r,mode:s,object:o,info:a}=this;if(n===0)return;let l=r.get("WEBGL_multi_draw");if(l===null)for(let c=0;c<n;c++)this.render(e[c],t[c]);else{this.index!==0?l.multiDrawElementsWEBGL(s,t,0,this.type,e,0,n):l.multiDrawArraysWEBGL(s,e,0,t,0,n);let c=0;for(let u=0;u<n;u++)c+=t[u];a.update(o,c,1)}}},tI=class{constructor(e=256){this.trackTimestamp=!0,this.maxQueries=e,this.currentQueryIndex=0,this.queryOffsets=new Map,this.isDisposed=!1,this.lastValue=0,this.frames=[],this.pendingResolve=!1,this.timestamps=new Map}getTimestampFrames(){return this.frames}getTimestamp(e){let t=this.timestamps.get(e);return t===void 0&&(Xe(`TimestampQueryPool: No timestamp available for uid ${e}.`),t=0),t}hasTimestampQuery(e){return this.timestamps.has(e)}allocateQueriesForContext(){}async resolveQueriesAsync(){}dispose(){}},v9=class extends tI{constructor(e,t,n=2048){if(super(n),this.gl=e,this.type=t,this.ext=e.getExtension("EXT_disjoint_timer_query_webgl2")||e.getExtension("EXT_disjoint_timer_query"),!this.ext){Xe("EXT_disjoint_timer_query not supported; timestamps will be disabled."),this.trackTimestamp=!1;return}this.queries=[];for(let r=0;r<this.maxQueries;r++)this.queries.push(e.createQuery());this.activeQuery=null,this.queryStates=new Map}allocateQueriesForContext(e){if(!this.trackTimestamp)return null;if(this.currentQueryIndex+2>this.maxQueries)return ni(`WebGLTimestampQueryPool [${this.type}]: Maximum number of queries exceeded, when using trackTimestamp it is necessary to resolves the queries via renderer.resolveTimestampsAsync( THREE.TimestampQuery.${this.type.toUpperCase()} ).`),null;let t=this.currentQueryIndex;return this.currentQueryIndex+=2,this.queryStates.set(t,"inactive"),this.queryOffsets.set(e,t),t}beginQuery(e){if(!this.trackTimestamp||this.isDisposed)return;let t=this.queryOffsets.get(e);if(t==null||this.activeQuery!==null)return;let n=this.queries[t];if(n)try{this.queryStates.get(t)==="inactive"&&(this.gl.beginQuery(this.ext.TIME_ELAPSED_EXT,n),this.activeQuery=t,this.queryStates.set(t,"started"))}catch(r){ze("Error in beginQuery:",r),this.activeQuery=null,this.queryStates.set(t,"inactive")}}endQuery(e){if(!this.trackTimestamp||this.isDisposed)return;let t=this.queryOffsets.get(e);if(t!=null&&this.activeQuery===t)try{this.gl.endQuery(this.ext.TIME_ELAPSED_EXT),this.queryStates.set(t,"ended"),this.activeQuery=null}catch(n){ze("Error in endQuery:",n),this.queryStates.set(t,"inactive"),this.activeQuery=null}}async resolveQueriesAsync(){if(!this.trackTimestamp||this.pendingResolve)return this.lastValue;this.pendingResolve=!0;try{let e=new Map;for(let[s,o]of this.queryOffsets)if(this.queryStates.get(o)==="ended"){let l=this.queries[o];e.set(s,this.resolveQuery(l))}if(e.size===0)return this.lastValue;let t={},n=[];for(let[s,o]of e){let a=s.match(/^(.*):f(\d+)$/),l=parseInt(a[2]);n.includes(l)===!1&&n.push(l),t[l]===void 0&&(t[l]=0);let c=await o;this.timestamps.set(s,c),t[l]+=c}let r=t[n[n.length-1]];return this.lastValue=r,this.frames=n,this.currentQueryIndex=0,this.queryOffsets.clear(),this.queryStates.clear(),this.activeQuery=null,r}catch(e){return ze("Error resolving queries:",e),this.lastValue}finally{this.pendingResolve=!1}}async resolveQuery(e){return new Promise(t=>{if(this.isDisposed){t(this.lastValue);return}let n,r=!1,s=()=>{n&&(clearTimeout(n),n=null)},o=l=>{r||(r=!0,s(),t(l))},a=()=>{if(this.isDisposed){o(this.lastValue);return}try{if(this.gl.getParameter(this.ext.GPU_DISJOINT_EXT)){o(this.lastValue);return}if(!this.gl.getQueryParameter(e,this.gl.QUERY_RESULT_AVAILABLE)){n=setTimeout(a,1);return}let u=this.gl.getQueryParameter(e,this.gl.QUERY_RESULT);t(Number(u)/1e6)}catch(l){ze("Error checking query:",l),t(this.lastValue)}};a()})}dispose(){if(!this.isDisposed&&(this.isDisposed=!0,!!this.trackTimestamp)){for(let e of this.queries)this.gl.deleteQuery(e);this.queries=[],this.queryStates.clear(),this.queryOffsets.clear(),this.lastValue=0,this.activeQuery=null}}},nI=class extends eI{constructor(e={}){super(e),this.isWebGLBackend=!0,this.attributeUtils=null,this.extensions=null,this.capabilities=null,this.textureUtils=null,this.bufferRenderer=null,this.gl=null,this.state=null,this.utils=null,this.vaoCache={},this.transformFeedbackCache={},this.discard=!1,this.disjoint=null,this.parallel=null,this._currentContext=null,this._knownBindings=new WeakSet,this._supportsInvalidateFramebuffer=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),this._xrFramebuffer=null}init(e){super.init(e);let t=this.parameters,n={antialias:e.currentSamples>0,alpha:!0,depth:e.depth,stencil:e.stencil},r=t.context!==void 0?t.context:e.domElement.getContext("webgl2",n);function s(o){o.preventDefault();let a={api:"WebGL",message:o.statusMessage||"Unknown reason",reason:null,originalEvent:o};e.onDeviceLost(a)}this._onContextLost=s,e.domElement.addEventListener("webglcontextlost",s,!1),this.gl=r,this.extensions=new m9(this),this.capabilities=new A9(this),this.attributeUtils=new h9(this),this.textureUtils=new p9(this),this.bufferRenderer=new g9(this),this.state=new f9(this),this.utils=new d9(this),this.extensions.get("EXT_color_buffer_float"),this.extensions.get("WEBGL_clip_cull_distance"),this.extensions.get("OES_texture_float_linear"),this.extensions.get("EXT_color_buffer_half_float"),this.extensions.get("WEBGL_multisampled_render_to_texture"),this.extensions.get("WEBGL_render_shared_exponent"),this.extensions.get("WEBGL_multi_draw"),this.extensions.get("OVR_multiview2"),this.extensions.get("EXT_clip_control"),this.disjoint=this.extensions.get("EXT_disjoint_timer_query_webgl2"),this.parallel=this.extensions.get("KHR_parallel_shader_compile"),this.drawBuffersIndexedExt=this.extensions.get("OES_draw_buffers_indexed"),t.reversedDepthBuffer&&(this.extensions.has("EXT_clip_control")?e.reversedDepthBuffer=!0:(Xe("WebGPURenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer."),e.reversedDepthBuffer=!1)),e.reversedDepthBuffer&&this.state.setReversedDepth(!0)}get coordinateSystem(){return Uo}get hasTimestamp(){return this.disjoint!==null}async getArrayBufferAsync(e,t=null,n=0,r=-1){return await this.attributeUtils.getArrayBufferAsync(e,t,n,r)}async makeXRCompatible(){this.gl.getContextAttributes().xrCompatible!==!0&&await this.gl.makeXRCompatible()}setXRTarget(e){this._xrFramebuffer=e}setXRRenderTargetTextures(e,t,n=null){let r=this.gl;if(this.set(e.texture,{textureGPU:t,glInternalFormat:r.RGBA8}),n!==null){let s=e.stencilBuffer?r.DEPTH24_STENCIL8:r.DEPTH_COMPONENT24;this.set(e.depthTexture,{textureGPU:n,glInternalFormat:s}),this.extensions.has("WEBGL_multisampled_render_to_texture")===!0&&e._autoAllocateDepthBuffer===!0&&e.multiview===!1&&Xe("WebGLBackend: Render-to-texture extension was disabled because an external texture was provided"),e._autoAllocateDepthBuffer=!1}}initTimestampQuery(e,t){if(!this.disjoint||!this.trackTimestamp)return;this.timestampQueryPool[e]||(this.timestampQueryPool[e]=new v9(this.gl,e,2048));let n=this.timestampQueryPool[e];n.allocateQueriesForContext(t)!==null&&n.beginQuery(t)}prepareTimestampBuffer(e,t){if(!this.disjoint||!this.trackTimestamp)return;this.timestampQueryPool[e].endQuery(t)}getContext(){return this.gl}beginRender(e){let{state:t}=this,n=this.get(e);if(e.viewport)this.updateViewport(e);else{let{width:s,height:o}=this.getDrawingBufferSize();t.viewport(0,0,s,o)}if(e.scissor)this.updateScissor(e);else{let{width:s,height:o}=this.getDrawingBufferSize();t.scissor(0,0,s,o)}this.initTimestampQuery(jc.RENDER,this.getTimestampUID(e)),n.previousContext=this._currentContext,this._currentContext=e,this._setFramebuffer(e),this.clear(e.clearColor,e.clearDepth,e.clearStencil,e,!1);let r=e.occlusionQueryCount;r>0&&(n.currentOcclusionQueries=n.occlusionQueries,n.currentOcclusionQueryObjects=n.occlusionQueryObjects,n.lastOcclusionObject=null,n.occlusionQueries=new Array(r),n.occlusionQueryObjects=new Array(r),n.occlusionQueryIndex=0)}finishRender(e){let{gl:t,state:n}=this,r=this.get(e),s=r.previousContext;n.resetVertexState();let o=e.occlusionQueryCount;o>0&&(o>r.occlusionQueryIndex&&t.endQuery(t.ANY_SAMPLES_PASSED),this.resolveOccludedAsync(e));let a=e.textures;if(a!==null)for(let l=0;l<a.length;l++){let c=a[l];c.generateMipmaps&&this.generateMipmaps(c)}if(this._currentContext=s,this._resolveRenderTarget(e),s!==null){if(this._setFramebuffer(s),s.viewport)this.updateViewport(s);else{let{width:l,height:c}=this.getDrawingBufferSize();n.viewport(0,0,l,c)}if(s.scissor)this.updateScissor(s);else{let{width:l,height:c}=this.getDrawingBufferSize();n.scissor(0,0,l,c)}}this.prepareTimestampBuffer(jc.RENDER,this.getTimestampUID(e))}resolveOccludedAsync(e){let t=this.get(e),{currentOcclusionQueries:n,currentOcclusionQueryObjects:r}=t;if(n&&r){let s=new WeakSet,{gl:o}=this;t.currentOcclusionQueryObjects=null,t.currentOcclusionQueries=null;let a=()=>{let l=0;for(let c=0;c<n.length;c++){let u=n[c];u!==null&&o.getQueryParameter(u,o.QUERY_RESULT_AVAILABLE)&&(o.getQueryParameter(u,o.QUERY_RESULT)===0&&s.add(r[c]),n[c]=null,o.deleteQuery(u),l++)}l<n.length?requestAnimationFrame(a):t.occluded=s};a()}}isOccluded(e,t){let n=this.get(e);return n.occluded&&n.occluded.has(t)}updateViewport(e){let{state:t}=this,{x:n,y:r,width:s,height:o}=e.viewportValue;t.viewport(n,e.height-o-r,s,o)}updateScissor(e){let{state:t}=this,{x:n,y:r,width:s,height:o}=e.scissorValue;t.scissor(n,e.height-o-r,s,o)}setScissorTest(e){this.state.setScissorTest(e)}getClearColor(){let e=super.getClearColor();return e.r*=e.a,e.g*=e.a,e.b*=e.a,e}clear(e,t,n,r=null,s=!0,o=!0){let{gl:a,renderer:l}=this;r===null&&(r={textures:null,clearColorValue:this.getClearColor()});let c=0;if(e&&(c|=a.COLOR_BUFFER_BIT),t&&(c|=a.DEPTH_BUFFER_BIT),n&&(c|=a.STENCIL_BUFFER_BIT),c!==0){let u;r.clearColorValue?u=r.clearColorValue:u=this.getClearColor();let f=l.getClearDepth(),d=l.getClearStencil();if(t&&this.state.setDepthMask(!0),r.textures===null)a.clearColor(u.r,u.g,u.b,u.a),a.clear(c);else{if(s&&this._setFramebuffer(r),e)for(let A=0;A<r.textures.length;A++)A===0?a.clearBufferfv(a.COLOR,A,[u.r,u.g,u.b,u.a]):a.clearBufferfv(a.COLOR,A,[0,0,0,1]);t&&n?a.clearBufferfi(a.DEPTH_STENCIL,0,f,d):t?a.clearBufferfv(a.DEPTH,0,[f]):n&&a.clearBufferiv(a.STENCIL,0,[d]),s&&o&&this._resolveRenderTarget(r),s&&this._currentContext!==null&&this._currentContext!==r&&this._setFramebuffer(this._currentContext)}}}beginCompute(e){let{state:t,gl:n}=this;t.bindFramebuffer(n.FRAMEBUFFER,null),this.initTimestampQuery(jc.COMPUTE,this.getTimestampUID(e))}compute(e,t,n,r,s=null){let{state:o,gl:a}=this;this.discard===!1&&(o.enable(a.RASTERIZER_DISCARD),this.discard=!0);let{programGPU:l,transformBuffers:c,attributes:u}=this.get(r),f=this._getVaoKey(u),d=this.vaoCache[f];d===void 0?this.vaoCache[f]=this._createVao(u):o.setVertexState(d),o.useProgram(l),this._bindUniforms(n);let A=this._getTransformFeedback(c);a.bindTransformFeedback(a.TRANSFORM_FEEDBACK,A),a.beginTransformFeedback(a.POINTS),s=s!==null?s:t.count,Array.isArray(s)?(ni("WebGLBackend.compute(): The count parameter must be a single number, not an array."),s=s[0]):s&&typeof s=="object"&&s.isIndirectStorageBufferAttribute&&(ni("WebGLBackend.compute(): The count parameter must be a single number, not IndirectStorageBufferAttribute"),s=t.count),u[0].isStorageInstancedBufferAttribute?a.drawArraysInstanced(a.POINTS,0,1,s):a.drawArrays(a.POINTS,0,s),a.endTransformFeedback(),a.bindTransformFeedback(a.TRANSFORM_FEEDBACK,null);for(let y=0;y<c.length;y++){let w=c[y];w.pbo&&this.has(w.pbo)&&this.textureUtils.copyBufferToTexture(w.transformBuffer,w.pbo),w.switchBuffers()}}finishCompute(e){let{state:t,gl:n}=this;this.discard=!1,t.disable(n.RASTERIZER_DISCARD),this.prepareTimestampBuffer(jc.COMPUTE,this.getTimestampUID(e)),this._currentContext&&this._setFramebuffer(this._currentContext)}_isRenderCameraDepthArray(e){return e.depthTexture&&e.depthTexture.isArrayTexture&&e.camera.isArrayCamera}_draw(e,t,n,r,s,o){if(e.isBatchedMesh)if(this.hasFeature("WEBGL_multi_draw")===!1){let{gl:a}=this,l=a.getUniformLocation(o,"nodeUniformDrawId"),c=e._multiDrawStarts,u=e._multiDrawCounts,f=e._multiDrawCount;for(let d=0;d<f;d++)a.uniform1ui(l,d),t.render(c[d],u[d])}else t.renderMultiDraw(e._multiDrawStarts,e._multiDrawCounts,e._multiDrawCount);else s>1?t.renderInstances(n,r,s):t.render(n,r)}draw(e){let{object:t,pipeline:n,material:r,context:s,hardwareClippingPlanes:o}=e,{programGPU:a}=this.get(n),{gl:l,state:c}=this,u=this.get(s),f=e.getDrawParameters();if(f===null)return;this._bindUniforms(e.getBindings());let d=t.isMesh&&t.matrixWorld.determinantAffine()<0;c.setMaterial(r,d,o),s.mrt!==null&&s.textures!==null&&c.setMRTBlending(s.textures,s.mrt,r),c.useProgram(a);let A=e.getAttributes(),y=this.get(A),w=y.vaoGPU;if(w===void 0){let L=this._getVaoKey(A);w=this.vaoCache[L],w===void 0&&(w=this._createVao(A),this.vaoCache[L]=w,y.vaoGPU=w)}let S=e.getIndex(),T=S!==null?this.get(S).bufferGPU:null;c.setVertexState(w,T);let R=u.lastOcclusionObject;if(R!==t&&R!==void 0){if(R!==null&&R.occlusionTest===!0&&(l.endQuery(l.ANY_SAMPLES_PASSED),u.occlusionQueryIndex++),t.occlusionTest===!0){let L=l.createQuery();l.beginQuery(l.ANY_SAMPLES_PASSED,L),u.occlusionQueries[u.occlusionQueryIndex]=L,u.occlusionQueryObjects[u.occlusionQueryIndex]=t}u.lastOcclusionObject=t}let P=this.bufferRenderer;t.isPoints?P.mode=l.POINTS:t.isLineSegments?P.mode=l.LINES:t.isLine?P.mode=l.LINE_STRIP:t.isLineLoop?P.mode=l.LINE_LOOP:r.wireframe===!0?(c.setLineWidth(r.wireframeLinewidth*this.renderer.getPixelRatio()),P.mode=l.LINES):P.mode=l.TRIANGLES;let{vertexCount:I,instanceCount:F}=f,{firstVertex:D}=f;if(P.object=t,S!==null){D*=S.array.BYTES_PER_ELEMENT;let L=this.get(S);P.index=S.count,P.type=L.type}else P.index=0;if(e.camera.isArrayCamera===!0&&e.camera.cameras.length>0&&e.camera.isMultiViewCamera===!1){let L=this.get(e.camera),C=e.camera.cameras,B=e.getBindingGroup("cameraIndex").bindings[0];if(L.indexesGPU===void 0||L.indexesGPU.length!==C.length){let H=new Uint32Array([0,0,0,0]),$=[];for(let J=0,te=C.length;J<te;J++){let ce=l.createBuffer();H[0]=J,l.bindBuffer(l.UNIFORM_BUFFER,ce),l.bufferData(l.UNIFORM_BUFFER,H,l.STATIC_DRAW),$.push(ce)}L.indexesGPU=$}let k=0;e:for(let H of e.getBindings())for(let $ of H.bindings){if($===B)break e;($.isUniformsGroup||$.isUniformBuffer)&&k++}let z=this.renderer.getPixelRatio(),G=this._currentContext.renderTarget,W=this._isRenderCameraDepthArray(this._currentContext),Y=this._currentContext.activeCubeFace;if(W){let H=this.get(G.depthTexture);if(H.clearedRenderId!==this.renderer._nodes.nodeFrame.renderId){H.clearedRenderId=this.renderer._nodes.nodeFrame.renderId;let{stencilBuffer:$}=G;for(let J=0,te=C.length;J<te;J++)this.renderer._activeCubeFace=J,this._currentContext.activeCubeFace=J,this._setFramebuffer(this._currentContext),this.clear(!1,!0,$,this._currentContext,!1,!1);this.renderer._activeCubeFace=Y,this._currentContext.activeCubeFace=Y}}for(let H=0,$=C.length;H<$;H++){let J=C[H];if(t.layers.test(J.layers)){W&&(this.renderer._activeCubeFace=H,this._currentContext.activeCubeFace=H,this._setFramebuffer(this._currentContext));let te=J.viewport;if(te!==void 0){let ce=te.x*z,he=te.y*z,ve=te.width*z,Re=te.height*z;c.viewport(Math.floor(ce),Math.floor(e.context.height-Re-he),Math.floor(ve),Math.floor(Re))}c.bindBufferBase(l.UNIFORM_BUFFER,k,L.indexesGPU[H]),this._draw(t,P,D,I,F,a)}this._currentContext.activeCubeFace=Y,this.renderer._activeCubeFace=Y}}else this._draw(t,P,D,I,F,a)}needsRenderUpdate(){return!1}getRenderCacheKey(){return""}createDefaultTexture(e){this.textureUtils.createDefaultTexture(e)}createTexture(e,t){this.textureUtils.createTexture(e,t)}updateTexture(e,t){this.textureUtils.updateTexture(e,t)}generateMipmaps(e){this.textureUtils.generateMipmaps(e)}destroyTexture(e,t=!1){this.textureUtils.destroyTexture(e,t)}async copyTextureToBuffer(e,t,n,r,s,o){return this.textureUtils.copyTextureToBuffer(e,t,n,r,s,o)}updateSampler(){return""}createNodeBuilder(e,t){return new c9(e,t)}createProgram(e){let t=this.gl,{stage:n,code:r}=e,s=n==="fragment"?t.createShader(t.FRAGMENT_SHADER):t.createShader(t.VERTEX_SHADER);t.shaderSource(s,r),t.compileShader(s),this.set(e,{shaderGPU:s})}destroyProgram(e){this.delete(e)}createRenderPipeline(e,t){let n=this.gl,r=e.pipeline,{fragmentProgram:s,vertexProgram:o}=r,a=n.createProgram(),l=this.get(s).shaderGPU,c=this.get(o).shaderGPU;if(n.attachShader(a,l),n.attachShader(a,c),n.linkProgram(a),this.set(r,{programGPU:a,fragmentShader:l,vertexShader:c}),t!==null&&this.parallel){let u=new Promise(f=>{let d=this.parallel,A=()=>{n.getProgramParameter(a,d.COMPLETION_STATUS_KHR)?(this._completeCompile(e,r),f()):requestAnimationFrame(A)};A()});t.push(u);return}this._completeCompile(e,r)}_handleSource(e,t){let n=e.split(`4358+`)}}this.material!==null?(this.vertexShader=this._getGLSLVertexCode(e.vertex),this.fragmentShader=this._getGLSLFragmentCode(e.fragment)):this.computeShader=this._getGLSLVertexCode(e.compute)}getUniformFromNode(e,t,n,r=null){let s=super.getUniformFromNode(e,t,n,r),o=this.getDataFromNode(e,n,this.globalCache),a=o.uniformGPU;if(a===void 0){let l=e.groupNode,c=l.name,u=this.getBindGroupArray(c,n);if(t==="texture")a=new xx(s.name,s.node,l),u.push(a);else if(t==="cubeTexture"||t==="cubeDepthTexture")a=new iI(s.name,s.node,l),u.push(a);else if(t==="texture3D")a=new LS(s.name,s.node,l),u.push(a);else if(t==="buffer"){s.name=`buffer${e.id}`;let f=this.getSharedDataFromNode(e),d=f.buffer;d===void 0&&(e.name=`NodeBuffer_${e.id}`,d=new eI(e,l),d.name=e.name,f.buffer=d),u.push(d),a=d}else{let f=this.uniformGroups[c];f===void 0?(f=new tI(c,l),this.uniformGroups[c]=f,u.push(f)):u.indexOf(f)===-1&&u.push(f),a=this.getNodeUniform(s,t);let d=a.name;f.uniforms.some(y=>y.name===d)||f.addUniform(a)}o.uniformGPU=a}return s}},aU=null,Y_=null,rI=class{constructor(e={}){this.parameters=Object.assign({},e),this.data=new WeakMap,this.renderer=null,this.domElement=null,this.timestampQueryPool={[Xc.RENDER]:null,[Xc.COMPUTE]:null},this.trackTimestamp=e.trackTimestamp===!0}async init(e){this.renderer=e}get coordinateSystem(){}beginRender(){}finishRender(){}setXRTarget(){}beginCompute(){}finishCompute(){}draw(){}compute(){}createProgram(){}destroyProgram(){}createBindings(){}updateBindings(){}updateBinding(){}createRenderPipeline(){}createComputePipeline(){}needsRenderUpdate(){}getRenderCacheKey(){}createNodeBuilder(){}updateSampler(){}destroySampler(){}createDefaultTexture(){}createTexture(){}updateTexture(){}generateMipmaps(){}destroyTexture(){}async copyTextureToBuffer(){}copyTextureToTexture(){}copyFramebufferToTexture(){}createAttribute(){}createIndexAttribute(){}createStorageAttribute(){}createUniformBuffer(){}destroyUniformBuffer(){}updateAttribute(){}destroyAttribute(){}getContext(){}updateSize(){}updateViewport(){}updateTimeStampUID(e){let t=this.get(e),n=this.renderer.info.frame,r;e.isComputeNode===!0?r="c:"+this.renderer.info.compute.frameCalls:r="r:"+this.renderer.info.render.frameCalls,t.timestampUID=r+":"+e.id+":f"+n}getTimestampUID(e){return this.get(e).timestampUID}getTimestampFrames(e){let t=this.timestampQueryPool[e];return t?t.getTimestampFrames():[]}_getQueryPool(e){let t=e.startsWith("c:")?Xc.COMPUTE:Xc.RENDER;return this.timestampQueryPool[t]}getTimestamp(e){return this._getQueryPool(e).getTimestamp(e)}get hasTimestamp(){return!1}hasTimestampQuery(e){return this._getQueryPool(e).hasTimestampQuery(e)}isOccluded(){}async resolveTimestampsAsync(e="render"){if(!this.trackTimestamp){ni("WebGPURenderer: Timestamp tracking is disabled.");return}let t=this.timestampQueryPool[e];if(!t)return;let n=await t.resolveQueriesAsync();return this.renderer.info[e].timestamp=n,n}async getArrayBufferAsync(){}async hasFeatureAsync(){}hasFeature(){}getDrawingBufferSize(){return aU=aU||new Oe,this.renderer.getDrawingBufferSize(aU)}setScissorTest(){}getClearColor(){let e=this.renderer;return Y_=Y_||new wS,e.getClearColor(Y_),Y_.getRGB(Y_),Y_}getDomElement(){let e=this.domElement;return e===null&&(e=this.parameters.canvas!==void 0?this.parameters.canvas:GM(),"setAttribute"in e&&e.setAttribute("data-engine",`three.js r${"185"} webgpu`),this.domElement=e),e}hasCompatibility(){return!1}initRenderTarget(){}set(e,t){this.data.set(e,t)}get(e){let t=this.data.get(e);return t===void 0&&(t={},this.data.set(e,t)),t}has(e){return this.data.has(e)}delete(e){this.data.delete(e)}deleteBindGroupData(){}dispose(){}},IPe=0,v9=class{constructor(e,t){this.buffers=[e.bufferGPU,t],this.type=e.type,this.bufferType=e.bufferType,this.pbo=e.pbo,this.byteLength=e.byteLength,this.bytesPerElement=e.BYTES_PER_ELEMENT,this.version=e.version,this.isInteger=e.isInteger,this.activeBufferIndex=0,this.baseId=e.id}get id(){return`${this.baseId}|${this.activeBufferIndex}`}get bufferGPU(){return this.buffers[this.activeBufferIndex]}get transformBuffer(){return this.buffers[this.activeBufferIndex^1]}switchBuffers(){this.activeBufferIndex^=1}},_9=class{constructor(e){this.backend=e}createAttribute(e,t){let n=this.backend,{gl:r}=n,s=e.array,o=e.usage||r.STATIC_DRAW,a=e.isInterleavedBufferAttribute?e.data:e,l=n.get(a),c=l.bufferGPU;c===void 0&&(c=this._createBuffer(r,t,s,o),l.bufferGPU=c,l.bufferType=t,l.version=a.version);let u;if(s instanceof Float32Array)u=r.FLOAT;else if(typeof Float16Array<"u"&&s instanceof Float16Array)u=r.HALF_FLOAT;else if(s instanceof Uint16Array)e.isFloat16BufferAttribute?u=r.HALF_FLOAT:u=r.UNSIGNED_SHORT;else if(s instanceof Int16Array)u=r.SHORT;else if(s instanceof Uint32Array)u=r.UNSIGNED_INT;else if(s instanceof Int32Array)u=r.INT;else if(s instanceof Int8Array)u=r.BYTE;else if(s instanceof Uint8Array)u=r.UNSIGNED_BYTE;else if(s instanceof Uint8ClampedArray)u=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLBackend: Unsupported buffer data format: "+s);let f={bufferGPU:c,bufferType:t,type:u,byteLength:s.byteLength,bytesPerElement:s.BYTES_PER_ELEMENT,version:e.version,pbo:e.pbo,isInteger:u===r.INT||u===r.UNSIGNED_INT||e.gpuType===Zr,id:IPe++};if(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute){let d=this._createBuffer(r,t,s,o);f=new v9(f,d)}n.set(e,f)}updateAttribute(e){let t=this.backend,{gl:n}=t,r=e.array,s=e.isInterleavedBufferAttribute?e.data:e,o=t.get(s),a=o.bufferType,l=e.isInterleavedBufferAttribute?e.data.updateRanges:e.updateRanges;if(n.bindBuffer(a,o.bufferGPU),l.length===0)n.bufferSubData(a,0,r);else{for(let c=0,u=l.length;c<u;c++){let f=l[c];n.bufferSubData(a,f.start*r.BYTES_PER_ELEMENT,r,f.start,f.count)}s.clearUpdateRanges()}n.bindBuffer(a,null),o.version=s.version}destroyAttribute(e){let t=this.backend,{gl:n}=t;e.isInterleavedBufferAttribute&&t.delete(e.data);let r=t.get(e);n.deleteBuffer(r.bufferGPU),t.delete(e)}async getArrayBufferAsync(e,t=null,n=0,r=-1){let s=this.backend,{gl:o}=s,a=e.isInterleavedBufferAttribute?e.data:e,l=s.get(a),{bufferGPU:c}=l,u=r===-1?l.byteLength-n:r,f;if(t===null)f=new Uint8Array(new ArrayBuffer(u));else if(t.isReadbackBuffer){if(t._mapped===!0)throw new Error("THREE.WebGPURenderer: ReadbackBuffer must be released before being used again.");let d=()=>{t.buffer=null,t._mapped=!1,t.removeEventListener("release",d),t.removeEventListener("dispose",d)};t.addEventListener("release",d),t.addEventListener("dispose",d),f=new Uint8Array(new ArrayBuffer(u)),t.buffer=f.buffer}else f=new Uint8Array(t);return o.bindBuffer(o.COPY_READ_BUFFER,c),o.getBufferSubData(o.COPY_READ_BUFFER,n,f),o.bindBuffer(o.COPY_READ_BUFFER,null),o.bindBuffer(o.COPY_WRITE_BUFFER,null),t&&t.isReadbackBuffer?t:f.buffer}_createBuffer(e,t,n,r){let s=e.createBuffer();return e.bindBuffer(t,s),e.bufferData(t,n,r),e.bindBuffer(t,null),s}},Zw,Wd,x9=class{constructor(e){this.backend=e,this.gl=this.backend.gl,this.enabled={},this.parameters={},this.currentFlipSided=null,this.currentCullFace=null,this.currentProgram=null,this.currentBlendingEnabled=!1,this.currentBlending=null,this.currentBlendSrc=null,this.currentBlendDst=null,this.currentBlendSrcAlpha=null,this.currentBlendDstAlpha=null,this.currentPremultipledAlpha=null,this.currentPolygonOffsetFactor=null,this.currentPolygonOffsetUnits=null,this.currentColorMask=null,this.currentDepthReversed=!1,this.currentDepthFunc=null,this.currentDepthMask=null,this.currentStencilFunc=null,this.currentStencilRef=null,this.currentStencilFuncMask=null,this.currentStencilFail=null,this.currentStencilZFail=null,this.currentStencilZPass=null,this.currentStencilMask=null,this.currentLineWidth=null,this.currentClippingPlanes=0,this.currentVAO=null,this.currentIndex=null,this.currentBoundFramebuffers={},this.currentDrawbuffers=new WeakMap,this.maxTextures=this.gl.getParameter(this.gl.MAX_TEXTURE_IMAGE_UNITS),this.currentTextureSlot=null,this.currentBoundTextures={},this.currentBoundBufferBases={},this._init()}_init(){let e=this.gl;Zw={[oo]:e.FUNC_ADD,[Ab]:e.FUNC_SUBTRACT,[gb]:e.FUNC_REVERSE_SUBTRACT},Wd={[Bu]:e.ZERO,[vb]:e.ONE,[_b]:e.SRC_COLOR,[e0]:e.SRC_ALPHA,[Tb]:e.SRC_ALPHA_SATURATE,[wb]:e.DST_COLOR,[yb]:e.DST_ALPHA,[xb]:e.ONE_MINUS_SRC_COLOR,[t0]:e.ONE_MINUS_SRC_ALPHA,[Sb]:e.ONE_MINUS_DST_COLOR,[bb]:e.ONE_MINUS_DST_ALPHA};let t=e.getParameter(e.SCISSOR_BOX),n=e.getParameter(e.VIEWPORT);this.currentScissor=new xn().fromArray(t),this.currentViewport=new xn().fromArray(n),this._tempVec4=new xn}enable(e){let{enabled:t}=this;t[e]!==!0&&(this.gl.enable(e),t[e]=!0)}disable(e){let{enabled:t}=this;t[e]!==!1&&(this.gl.disable(e),t[e]=!1)}setFlipSided(e){if(this.currentFlipSided!==e){let{gl:t}=this;e?t.frontFace(t.CW):t.frontFace(t.CCW),this.currentFlipSided=e}}setCullFace(e){let{gl:t}=this;e!==LM?(this.enable(t.CULL_FACE),e!==this.currentCullFace&&(e===pb?t.cullFace(t.BACK):e===DM?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):this.disable(t.CULL_FACE),this.currentCullFace=e}setLineWidth(e){let{currentLineWidth:t,gl:n}=this;e!==t&&(n.lineWidth(e),this.currentLineWidth=e)}setMRTBlending(e,t,n){let r=this.gl,s=this.backend.drawBuffersIndexedExt;if(!s){ni("WebGPURenderer: Multiple Render Targets (MRT) blending configuration is not fully supported in compatibility mode. The material blending will be used for all render targets.");return}for(let o=0;o<e.length;o++){let a=e[o],l=null;if(t!==null){let c=t.getBlendMode(a.name);c.blending===mb?l=n:c.blending!==ps&&(l=c)}else l=n;l!==null?this._setMRTBlendingIndex(o,l):s.blendFuncSeparateiOES(o,r.ONE,r.ZERO,r.ONE,r.ZERO)}}_setMRTBlendingIndex(e,t){let{gl:n}=this,r=this.backend.drawBuffersIndexedExt,s=t.blending,o=t.blendSrc,a=t.blendDst,l=t.blendEquation,c=t.premultipliedAlpha;if(s===Nd){let u=t.blendSrcAlpha!==null?t.blendSrcAlpha:o,f=t.blendDstAlpha!==null?t.blendDstAlpha:a,d=t.blendEquationAlpha!==null?t.blendEquationAlpha:l;r.blendEquationSeparateiOES(e,Zw[l],Zw[d]),r.blendFuncSeparateiOES(e,Wd[o],Wd[a],Wd[u],Wd[f])}else if(r.blendEquationSeparateiOES(e,n.FUNC_ADD,n.FUNC_ADD),c)switch(s){case Ms:r.blendFuncSeparateiOES(e,n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case Bh:r.blendFuncSeparateiOES(e,n.ONE,n.ONE,n.ONE,n.ONE);break;case Oh:r.blendFuncSeparateiOES(e,n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case Uh:r.blendFuncSeparateiOES(e,n.DST_COLOR,n.ONE_MINUS_SRC_ALPHA,n.ZERO,n.ONE);break;default:r.blendFuncSeparateiOES(e,n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break}else switch(s){case Ms:r.blendFuncSeparateiOES(e,n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case Bh:r.blendFuncSeparateiOES(e,n.SRC_ALPHA,n.ONE,n.ONE,n.ONE);break;case Oh:r.blendFuncSeparateiOES(e,n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case Uh:r.blendFuncSeparateiOES(e,n.DST_COLOR,n.ONE_MINUS_SRC_ALPHA,n.ZERO,n.ONE);break;default:r.blendFuncSeparateiOES(e,n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break}}setBlending(e,t,n,r,s,o,a,l){let{gl:c}=this;if(e===ps){this.currentBlendingEnabled===!0&&(this.disable(c.BLEND),this.currentBlendingEnabled=!1);return}if(this.currentBlendingEnabled===!1&&(this.enable(c.BLEND),this.currentBlendingEnabled=!0),e!==Nd){if(e!==this.currentBlending||l!==this.currentPremultipledAlpha){if((this.currentBlendEquation!==oo||this.currentBlendEquationAlpha!==oo)&&(c.blendEquation(c.FUNC_ADD),this.currentBlendEquation=oo,this.currentBlendEquationAlpha=oo),l)switch(e){case Ms:c.blendFuncSeparate(c.ONE,c.ONE_MINUS_SRC_ALPHA,c.ONE,c.ONE_MINUS_SRC_ALPHA);break;case Bh:c.blendFunc(c.ONE,c.ONE);break;case Oh:c.blendFuncSeparate(c.ZERO,c.ONE_MINUS_SRC_COLOR,c.ZERO,c.ONE);break;case Uh:c.blendFuncSeparate(c.DST_COLOR,c.ONE_MINUS_SRC_ALPHA,c.ZERO,c.ONE);break;default:ze("WebGLState: Invalid blending: ",e);break}else switch(e){case Ms:c.blendFuncSeparate(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA,c.ONE,c.ONE_MINUS_SRC_ALPHA);break;case Bh:c.blendFuncSeparate(c.SRC_ALPHA,c.ONE,c.ONE,c.ONE);break;case Oh:ze("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case Uh:ze("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:ze("WebGLState: Invalid blending: ",e);break}this.currentBlendSrc=null,this.currentBlendDst=null,this.currentBlendSrcAlpha=null,this.currentBlendDstAlpha=null,this.currentBlending=e,this.currentPremultipledAlpha=l}return}s=s||t,o=o||n,a=a||r,(t!==this.currentBlendEquation||s!==this.currentBlendEquationAlpha)&&(c.blendEquationSeparate(Zw[t],Zw[s]),this.currentBlendEquation=t,this.currentBlendEquationAlpha=s),(n!==this.currentBlendSrc||r!==this.currentBlendDst||o!==this.currentBlendSrcAlpha||a!==this.currentBlendDstAlpha)&&(c.blendFuncSeparate(Wd[n],Wd[r],Wd[o],Wd[a]),this.currentBlendSrc=n,this.currentBlendDst=r,this.currentBlendSrcAlpha=o,this.currentBlendDstAlpha=a),this.currentBlending=e,this.currentPremultipledAlpha=!1}setColorMask(e){this.currentColorMask!==e&&(this.gl.colorMask(e,e,e,e),this.currentColorMask=e)}setDepthTest(e){let{gl:t}=this;e?this.enable(t.DEPTH_TEST):this.disable(t.DEPTH_TEST)}setReversedDepth(e){if(this.currentDepthReversed!==e){let t=this.backend.extensions.get("EXT_clip_control");e?t.clipControlEXT(t.LOWER_LEFT_EXT,t.ZERO_TO_ONE_EXT):t.clipControlEXT(t.LOWER_LEFT_EXT,t.NEGATIVE_ONE_TO_ONE_EXT),this.currentDepthReversed=e}}setDepthMask(e){this.currentDepthMask!==e&&(this.gl.depthMask(e),this.currentDepthMask=e)}setDepthFunc(e){if(this.currentDepthReversed&&(e=zb[e]),this.currentDepthFunc!==e){let{gl:t}=this;switch(e){case NA:t.depthFunc(t.NEVER);break;case FA:t.depthFunc(t.ALWAYS);break;case BA:t.depthFunc(t.LESS);break;case Ph:t.depthFunc(t.LEQUAL);break;case OA:t.depthFunc(t.EQUAL);break;case UA:t.depthFunc(t.GEQUAL);break;case kA:t.depthFunc(t.GREATER);break;case zA:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}this.currentDepthFunc=e}}scissor(e,t,n,r){let s=this._tempVec4.set(e,t,n,r);if(this.currentScissor.equals(s)===!1){let{gl:o}=this;o.scissor(s.x,s.y,s.z,s.w),this.currentScissor.copy(s)}}viewport(e,t,n,r){let s=this._tempVec4.set(e,t,n,r);if(this.currentViewport.equals(s)===!1){let{gl:o}=this;o.viewport(s.x,s.y,s.z,s.w),this.currentViewport.copy(s)}}setScissorTest(e){let t=this.gl;e?this.enable(t.SCISSOR_TEST):this.disable(t.SCISSOR_TEST)}setStencilTest(e){let{gl:t}=this;e?this.enable(t.STENCIL_TEST):this.disable(t.STENCIL_TEST)}setStencilMask(e){this.currentStencilMask!==e&&(this.gl.stencilMask(e),this.currentStencilMask=e)}setStencilFunc(e,t,n){(this.currentStencilFunc!==e||this.currentStencilRef!==t||this.currentStencilFuncMask!==n)&&(this.gl.stencilFunc(e,t,n),this.currentStencilFunc=e,this.currentStencilRef=t,this.currentStencilFuncMask=n)}setStencilOp(e,t,n){(this.currentStencilFail!==e||this.currentStencilZFail!==t||this.currentStencilZPass!==n)&&(this.gl.stencilOp(e,t,n),this.currentStencilFail=e,this.currentStencilZFail=t,this.currentStencilZPass=n)}setMaterial(e,t,n){let{gl:r}=this;e.side===vr?this.disable(r.CULL_FACE):this.enable(r.CULL_FACE);let s=e.side===mi;t&&(s=!s),this.setFlipSided(s),e.blending===Ms&&e.transparent===!1?this.setBlending(ps):this.setBlending(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha),this.setDepthFunc(e.depthFunc),this.setDepthTest(e.depthTest),this.setDepthMask(e.depthWrite),this.setColorMask(e.colorWrite);let o=e.stencilWrite;if(this.setStencilTest(o),o&&(this.setStencilMask(e.stencilWriteMask),this.setStencilFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),this.setStencilOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),this.setPolygonOffset(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits),e.alphaToCoverage===!0&&this.backend.renderer.currentSamples>0?this.enable(r.SAMPLE_ALPHA_TO_COVERAGE):this.disable(r.SAMPLE_ALPHA_TO_COVERAGE),n>0&&this.currentClippingPlanes!==n)for(let l=0;l<8;l++)l<n?this.enable(12288+l):this.disable(12288+l)}setPolygonOffset(e,t,n){let{gl:r}=this;e?(this.enable(r.POLYGON_OFFSET_FILL),(this.currentPolygonOffsetFactor!==t||this.currentPolygonOffsetUnits!==n)&&(r.polygonOffset(t,n),this.currentPolygonOffsetFactor=t,this.currentPolygonOffsetUnits=n)):this.disable(r.POLYGON_OFFSET_FILL)}useProgram(e){return this.currentProgram!==e?(this.gl.useProgram(e),this.currentProgram=e,!0):!1}setVertexState(e,t=null){let n=this.gl;return this.currentVAO!==e||this.currentIndex!==t?(n.bindVertexArray(e),t!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t),this.currentVAO=e,this.currentIndex=t,!0):!1}resetVertexState(){let e=this.gl;e.bindVertexArray(null),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null),this.currentVAO=null,this.currentIndex=null}bindFramebuffer(e,t){let{gl:n,currentBoundFramebuffers:r}=this;return r[e]!==t?(n.bindFramebuffer(e,t),r[e]=t,e===n.DRAW_FRAMEBUFFER&&(r[n.FRAMEBUFFER]=t),e===n.FRAMEBUFFER&&(r[n.DRAW_FRAMEBUFFER]=t),!0):!1}drawBuffers(e,t){let{gl:n}=this,r=[],s=!1;if(e.textures!==null){r=this.currentDrawbuffers.get(t),r===void 0&&(r=[],this.currentDrawbuffers.set(t,r));let o=e.textures;if(r.length!==o.length||r[0]!==n.COLOR_ATTACHMENT0){for(let a=0,l=o.length;a<l;a++)r[a]=n.COLOR_ATTACHMENT0+a;r.length=o.length,s=!0}}else r[0]!==n.BACK&&(r[0]=n.BACK,s=!0);s&&n.drawBuffers(r)}activeTexture(e){let{gl:t,currentTextureSlot:n,maxTextures:r}=this;e===void 0&&(e=t.TEXTURE0+r-1),n!==e&&(t.activeTexture(e),this.currentTextureSlot=e)}bindTexture(e,t,n){let{gl:r,currentTextureSlot:s,currentBoundTextures:o,maxTextures:a}=this;n===void 0&&(s===null?n=r.TEXTURE0+a-1:n=s);let l=o[n];l===void 0&&(l={type:void 0,texture:void 0},o[n]=l),(l.type!==e||l.texture!==t)&&(s!==n&&(r.activeTexture(n),this.currentTextureSlot=n),r.bindTexture(e,t),l.type=e,l.texture=t)}bindBufferBase(e,t,n){let{gl:r}=this,s=`${e}-${t}`;return this.currentBoundBufferBases[s]!==n?(r.bindBufferBase(e,t,n),this.currentBoundBufferBases[s]=n,!0):!1}unbindTexture(){let{gl:e,currentTextureSlot:t,currentBoundTextures:n}=this,r=n[t];r!==void 0&&r.type!==void 0&&(e.bindTexture(r.type,null),r.type=void 0,r.texture=void 0)}getParameter(e){let{gl:t,parameters:n}=this;return n[e]!==void 0?n[e]:t.getParameter(e)}pixelStorei(e,t){let{gl:n,parameters:r}=this;r[e]!==t&&(n.pixelStorei(e,t),r[e]=t)}},y9=class{constructor(e){this.backend=e,this.gl=this.backend.gl,this.extensions=e.extensions}convert(e,t=ua){let{gl:n,extensions:r}=this,s,o=ln.getTransfer(t);if(e===Ji)return n.UNSIGNED_BYTE;if(e===rg)return n.UNSIGNED_SHORT_4_4_4_4;if(e===sg)return n.UNSIGNED_SHORT_5_5_5_1;if(e===og)return n.UNSIGNED_INT_5_9_9_9_REV;if(e===ag)return n.UNSIGNED_INT_10F_11F_11F_REV;if(e===zh)return n.BYTE;if(e===Vh)return n.SHORT;if(e===wl)return n.UNSIGNED_SHORT;if(e===Zr)return n.INT;if(e===xi)return n.UNSIGNED_INT;if(e===cr)return n.FLOAT;if(e===Wi)return n.HALF_FLOAT;if(e===f_)return n.ALPHA;if(e===Fd)return n.RGB;if(e===Or)return n.RGBA;if(e===Gs)return n.DEPTH_COMPONENT;if(e===xo)return n.DEPTH_STENCIL;if(e===Bd)return n.RED;if(e===Gh)return n.RED_INTEGER;if(e===js)return n.RG;if(e===qh)return n.RG_INTEGER;if(e===v0)return n.RGBA_INTEGER;if(e===Hh||e===Wh||e===jh||e===Xh)if(o===kt)if(s=r.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(e===Hh)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(e===Wh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(e===jh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(e===Xh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=r.get("WEBGL_compressed_texture_s3tc"),s!==null){if(e===Hh)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===Wh)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===jh)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===Xh)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(e===lg||e===cg||e===ug||e===hg)if(s=r.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(e===lg)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===cg)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===ug)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===hg)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(e===_0||e===x0||e===y0||e===b0||e===w0||e===$h||e===S0)if(s=r.get("WEBGL_compressed_texture_etc"),s!==null){if(e===_0||e===x0)return o===kt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(e===y0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(e===b0)return s.COMPRESSED_R11_EAC;if(e===w0)return s.COMPRESSED_SIGNED_R11_EAC;if(e===$h)return s.COMPRESSED_RG11_EAC;if(e===S0)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(e===T0||e===E0||e===M0||e===C0||e===R0||e===I0||e===P0||e===L0||e===D0||e===N0||e===F0||e===B0||e===O0||e===U0)if(s=r.get("WEBGL_compressed_texture_astc"),s!==null){if(e===T0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(e===E0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(e===M0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(e===C0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(e===R0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(e===I0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(e===P0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(e===L0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(e===D0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(e===N0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(e===F0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(e===B0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(e===O0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(e===U0)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(e===k0||e===z0||e===V0)if(s=r.get("EXT_texture_compression_bptc"),s!==null){if(e===k0)return o===kt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(e===z0)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(e===V0)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(e===G0||e===q0||e===Yh||e===H0)if(s=r.get("EXT_texture_compression_rgtc"),s!==null){if(e===G0)return s.COMPRESSED_RED_RGTC1_EXT;if(e===q0)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(e===Yh)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(e===H0)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return e===ca?n.UNSIGNED_INT_24_8:n[e]!==void 0?n[e]:null}_clientWaitAsync(){let{gl:e}=this,t=e.fenceSync(e.SYNC_GPU_COMMANDS_COMPLETE,0);return e.flush(),new Promise((n,r)=>{function s(){let o=e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0);if(o===e.WAIT_FAILED){e.deleteSync(t),r();return}if(o===e.TIMEOUT_EXPIRED){requestAnimationFrame(s);return}e.deleteSync(t),n()}s()})}},qte=!1,kR,lU,Hte,b9=class{constructor(e){this.backend=e,this.gl=e.gl,this.extensions=e.extensions,this.defaultTextures={},this._srcFramebuffer=null,this._dstFramebuffer=null,qte===!1&&(this._init(),qte=!0)}_init(){let e=this.gl;kR={[Md]:e.REPEAT,[aa]:e.CLAMP_TO_EDGE,[Cd]:e.MIRRORED_REPEAT},lU={[Ti]:e.NEAREST,[Db]:e.NEAREST_MIPMAP_NEAREST,[jc]:e.NEAREST_MIPMAP_LINEAR,[Mi]:e.LINEAR,[g0]:e.LINEAR_MIPMAP_NEAREST,[Vo]:e.LINEAR_MIPMAP_LINEAR},Hte={[Bb]:e.NEVER,[kb]:e.ALWAYS,[d_]:e.LESS,[Zh]:e.LEQUAL,[Ob]:e.EQUAL,[Ou]:e.GEQUAL,[fg]:e.GREATER,[Ub]:e.NOTEQUAL}}getGLTextureType(e){let{gl:t}=this,n;return e.isCubeTexture===!0?n=t.TEXTURE_CUBE_MAP:e.isArrayTexture===!0||e.isDataArrayTexture===!0||e.isCompressedArrayTexture===!0?n=t.TEXTURE_2D_ARRAY:e.isData3DTexture===!0?n=t.TEXTURE_3D:n=t.TEXTURE_2D,n}getInternalFormat(e,t,n,r,s,o=!1){let{gl:a,extensions:l}=this;if(e!==null){if(a[e]!==void 0)return a[e];Xe("WebGLBackend: Attempt to use non-existing WebGL internal format '"+e+"'")}let c=null;r&&(c=l.get("EXT_texture_norm16"),c||Xe("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let u=t;if(t===a.RED&&(n===a.FLOAT&&(u=a.R32F),n===a.HALF_FLOAT&&(u=a.R16F),n===a.UNSIGNED_BYTE&&(u=a.R8),n===a.BYTE&&(u=a.R8_SNORM),n===a.UNSIGNED_SHORT&&c&&(u=c.R16_EXT),n===a.SHORT&&c&&(u=c.R16_SNORM_EXT)),t===a.RED_INTEGER&&(n===a.UNSIGNED_BYTE&&(u=a.R8UI),n===a.UNSIGNED_SHORT&&(u=a.R16UI),n===a.UNSIGNED_INT&&(u=a.R32UI),n===a.BYTE&&(u=a.R8I),n===a.SHORT&&(u=a.R16I),n===a.INT&&(u=a.R32I)),t===a.RG&&(n===a.FLOAT&&(u=a.RG32F),n===a.HALF_FLOAT&&(u=a.RG16F),n===a.UNSIGNED_BYTE&&(u=a.RG8),n===a.BYTE&&(u=a.RG8_SNORM),n===a.UNSIGNED_SHORT&&c&&(u=c.RG16_EXT),n===a.SHORT&&c&&(u=c.RG16_SNORM_EXT)),t===a.RG_INTEGER&&(n===a.UNSIGNED_BYTE&&(u=a.RG8UI),n===a.UNSIGNED_SHORT&&(u=a.RG16UI),n===a.UNSIGNED_INT&&(u=a.RG32UI),n===a.BYTE&&(u=a.RG8I),n===a.SHORT&&(u=a.RG16I),n===a.INT&&(u=a.RG32I)),t===a.RGB){let f=o?i0:ln.getTransfer(s);n===a.FLOAT&&(u=a.RGB32F),n===a.HALF_FLOAT&&(u=a.RGB16F),n===a.UNSIGNED_BYTE&&(u=f===kt?a.SRGB8:a.RGB8),n===a.BYTE&&(u=a.RGB8_SNORM),n===a.UNSIGNED_SHORT&&c&&(u=c.RGB16_EXT),n===a.SHORT&&c&&(u=c.RGB16_SNORM_EXT),n===a.UNSIGNED_SHORT_5_6_5&&(u=a.RGB565),n===a.UNSIGNED_SHORT_5_5_5_1&&(u=a.RGB5_A1),n===a.UNSIGNED_SHORT_4_4_4_4&&(u=a.RGB4),n===a.UNSIGNED_INT_5_9_9_9_REV&&(u=a.RGB9_E5),n===a.UNSIGNED_INT_10F_11F_11F_REV&&(u=a.R11F_G11F_B10F)}if(t===a.RGB_INTEGER&&(n===a.UNSIGNED_BYTE&&(u=a.RGB8UI),n===a.UNSIGNED_SHORT&&(u=a.RGB16UI),n===a.UNSIGNED_INT&&(u=a.RGB32UI),n===a.BYTE&&(u=a.RGB8I),n===a.SHORT&&(u=a.RGB16I),n===a.INT&&(u=a.RGB32I)),t===a.RGBA){let f=o?i0:ln.getTransfer(s);n===a.FLOAT&&(u=a.RGBA32F),n===a.HALF_FLOAT&&(u=a.RGBA16F),n===a.UNSIGNED_BYTE&&(u=f===kt?a.SRGB8_ALPHA8:a.RGBA8),n===a.BYTE&&(u=a.RGBA8_SNORM),n===a.UNSIGNED_SHORT&&c&&(u=c.RGBA16_EXT),n===a.SHORT&&c&&(u=c.RGBA16_SNORM_EXT),n===a.UNSIGNED_SHORT_4_4_4_4&&(u=a.RGBA4),n===a.UNSIGNED_SHORT_5_5_5_1&&(u=a.RGB5_A1)}return t===a.RGBA_INTEGER&&(n===a.UNSIGNED_BYTE&&(u=a.RGBA8UI),n===a.UNSIGNED_SHORT&&(u=a.RGBA16UI),n===a.UNSIGNED_INT&&(u=a.RGBA32UI),n===a.BYTE&&(u=a.RGBA8I),n===a.SHORT&&(u=a.RGBA16I),n===a.INT&&(u=a.RGBA32I)),t===a.DEPTH_COMPONENT&&(n===a.UNSIGNED_SHORT&&(u=a.DEPTH_COMPONENT16),n===a.UNSIGNED_INT&&(u=a.DEPTH_COMPONENT24),n===a.FLOAT&&(u=a.DEPTH_COMPONENT32F)),t===a.DEPTH_STENCIL&&n===a.UNSIGNED_INT_24_8&&(u=a.DEPTH24_STENCIL8),(u===a.R16F||u===a.R32F||u===a.RG16F||u===a.RG32F||u===a.RGBA16F||u===a.RGBA32F)&&l.get("EXT_color_buffer_float"),u}setTextureParameters(e,t){let{gl:n,extensions:r,backend:s}=this,{state:o}=this.backend,a=ln.getPrimaries(ln.workingColorSpace),l=t.colorSpace===ua?null:ln.getPrimaries(t.colorSpace),c=t.colorSpace===ua||a===l?n.NONE:n.BROWSER_DEFAULT_WEBGL;o.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,t.flipY),o.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),o.pixelStorei(n.UNPACK_ALIGNMENT,t.unpackAlignment),o.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,c),n.texParameteri(e,n.TEXTURE_WRAP_S,kR[t.wrapS]),n.texParameteri(e,n.TEXTURE_WRAP_T,kR[t.wrapT]),(e===n.TEXTURE_3D||e===n.TEXTURE_2D_ARRAY)&&(t.isArrayTexture||n.texParameteri(e,n.TEXTURE_WRAP_R,kR[t.wrapR])),n.texParameteri(e,n.TEXTURE_MAG_FILTER,lU[t.magFilter]);let u=t.mipmaps!==void 0&&t.mipmaps.length>0,f=t.minFilter===Mi&&u?Vo:t.minFilter;if(n.texParameteri(e,n.TEXTURE_MIN_FILTER,lU[f]),t.compareFunction&&(n.texParameteri(e,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(e,n.TEXTURE_COMPARE_FUNC,Hte[t.compareFunction])),r.has("EXT_texture_filter_anisotropic")===!0){if(t.magFilter===Ti||t.minFilter!==jc&&t.minFilter!==Vo||t.type===cr&&r.has("OES_texture_float_linear")===!1)return;if(t.anisotropy>1){let d=r.get("EXT_texture_filter_anisotropic");n.texParameterf(e,d.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(t.anisotropy,s.capabilities.getMaxAnisotropy()))}}}createDefaultTexture(e){let{gl:t,backend:n,defaultTextures:r}=this,s=this.getGLTextureType(e),o=r[s];o===void 0&&(o=t.createTexture(),n.state.bindTexture(s,o),t.texParameteri(s,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(s,t.TEXTURE_MAG_FILTER,t.NEAREST),r[s]=o),n.set(e,{textureGPU:o,glTextureType:s})}createTexture(e,t){let{gl:n,backend:r}=this,s,o,a,l,c;if(e.isExternalTexture===!0)s=e.sourceTexture,o=this.getGLTextureType(e);else{let{levels:u,width:f,height:d,depth:A}=t;a=r.utils.convert(e.format,e.colorSpace),l=r.utils.convert(e.type),c=this.getInternalFormat(e.internalFormat,a,l,e.normalized,e.colorSpace,e.isVideoTexture),s=n.createTexture(),o=this.getGLTextureType(e),r.state.bindTexture(o,s),this.setTextureParameters(o,e),e.isArrayTexture||e.isDataArrayTexture||e.isCompressedArrayTexture?n.texStorage3D(n.TEXTURE_2D_ARRAY,u,c,f,d,A):e.isData3DTexture?n.texStorage3D(n.TEXTURE_3D,u,c,f,d,A):e.isVideoTexture||n.texStorage2D(o,u,c,f,d)}r.set(e,{textureGPU:s,glTextureType:o,glFormat:a,glType:l,glInternalFormat:c})}copyBufferToTexture(e,t){let{gl:n,backend:r}=this,{state:s}=r,{textureGPU:o,glTextureType:a,glFormat:l,glType:c}=r.get(t),{width:u,height:f}=t.source.data;n.bindBuffer(n.PIXEL_UNPACK_BUFFER,e),r.state.bindTexture(a,o),s.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!1),s.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),n.texSubImage2D(a,0,0,0,u,f,l,c,0),n.bindBuffer(n.PIXEL_UNPACK_BUFFER,null),r.state.unbindTexture()}updateTexture(e,t){let{gl:n}=this,{width:r,height:s}=t,{textureGPU:o,glTextureType:a,glFormat:l,glType:c,glInternalFormat:u}=this.backend.get(e);if(!(e.isRenderTargetTexture||o===void 0))if(this.backend.state.bindTexture(a,o),this.setTextureParameters(a,e),e.isCompressedTexture){let f=e.mipmaps,d=t.image;for(let A=0;A<f.length;A++){let y=f[A];e.isCompressedArrayTexture?e.format!==n.RGBA?l!==null?n.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,A,0,0,0,y.width,y.height,d.depth,l,y.data):Xe("WebGLBackend: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texSubImage3D(n.TEXTURE_2D_ARRAY,A,0,0,0,y.width,y.height,d.depth,l,c,y.data):l!==null?n.compressedTexSubImage2D(n.TEXTURE_2D,A,0,0,y.width,y.height,l,y.data):Xe("WebGLBackend: Unsupported compressed texture format")}}else if(e.isCubeTexture){let f=t.images,d=e.mipmaps;for(let A=0;A<6;A++){let y=zR(f[A]);n.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+A,0,0,0,r,s,l,c,y);for(let w=0;w<d.length;w++){let S=d[w],T=zR(S.images[A]);n.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+A,w+1,0,0,T.width,T.height,l,c,T)}}}else if(e.isDataArrayTexture||e.isArrayTexture){let f=t.image;if(e.layerUpdates.size>0){let d=Vb(f.width,f.height,e.format,e.type);for(let A of e.layerUpdates){let y=f.data.subarray(A*d/f.data.BYTES_PER_ELEMENT,(A+1)*d/f.data.BYTES_PER_ELEMENT);n.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,A,f.width,f.height,1,l,c,y)}e.clearLayerUpdates()}else n.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,f.width,f.height,f.depth,l,c,f.data)}else if(e.isData3DTexture){let f=t.image;n.texSubImage3D(n.TEXTURE_3D,0,0,0,0,f.width,f.height,f.depth,l,c,f.data)}else if(e.isVideoTexture)e.update(),n.texImage2D(a,0,u,l,c,t.image);else if(e.isHTMLTexture)typeof n.texElementImage2D=="function"&&(n.texElementImage2D.length===3?n.texElementImage2D(n.TEXTURE_2D,n.RGBA8,t.image):n.texElementImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,t.image));else{let f=e.mipmaps;if(f.length>0)for(let d=0,A=f.length;d<A;d++){let y=f[d],w=zR(y);n.texSubImage2D(a,d,0,0,y.width,y.height,l,c,w)}else{let d=zR(t.image);n.texSubImage2D(a,0,0,0,r,s,l,c,d)}}}generateMipmaps(e){let{gl:t,backend:n}=this,{textureGPU:r,glTextureType:s}=n.get(e);n.state.bindTexture(s,r),t.generateMipmap(s)}deallocateRenderBuffers(e){let{gl:t,backend:n}=this;if(e){let r=n.get(e);if(r.renderBufferStorageSetup=void 0,r.framebuffers){for(let s in r.framebuffers)t.deleteFramebuffer(r.framebuffers[s]);delete r.framebuffers}if(r.depthRenderbuffer&&(t.deleteRenderbuffer(r.depthRenderbuffer),delete r.depthRenderbuffer),r.stencilRenderbuffer&&(t.deleteRenderbuffer(r.stencilRenderbuffer),delete r.stencilRenderbuffer),r.msaaFrameBuffer&&(t.deleteFramebuffer(r.msaaFrameBuffer),delete r.msaaFrameBuffer),r.msaaRenderbuffers){for(let s=0;s<r.msaaRenderbuffers.length;s++)t.deleteRenderbuffer(r.msaaRenderbuffers[s]);delete r.msaaRenderbuffers}}}destroyTexture(e,t=!1){let{gl:n,backend:r}=this,{textureGPU:s,renderTarget:o}=r.get(e);this.deallocateRenderBuffers(o),t===!1&&e.isExternalTexture!==!0&&n.deleteTexture(s),r.delete(e)}copyTextureToTexture(e,t,n=null,r=null,s=0,o=0){let{gl:a,backend:l}=this,{state:c}=this.backend,{textureGPU:u,glTextureType:f,glType:d,glFormat:A}=l.get(t);c.bindTexture(f,u);let y,w,S,T,R,P,I,F,D,L=e.isCompressedTexture?e.mipmaps[o]:e.image;if(n!==null)y=n.max.x-n.min.x,w=n.max.y-n.min.y,S=n.isBox3?n.max.z-n.min.z:1,T=n.min.x,R=n.min.y,P=n.isBox3?n.min.z:0;else{let H=Math.pow(2,-s);y=Math.floor(L.width*H),w=Math.floor(L.height*H),e.isDataArrayTexture||e.isArrayTexture?S=L.depth:e.isData3DTexture?S=Math.floor(L.depth*H):S=1,T=0,R=0,P=0}r!==null?(I=r.x,F=r.y,D=r.z):(I=0,F=0,D=0),c.pixelStorei(a.UNPACK_FLIP_Y_WEBGL,t.flipY),c.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),c.pixelStorei(a.UNPACK_ALIGNMENT,t.unpackAlignment);let C=c.getParameter(a.UNPACK_ROW_LENGTH),B=c.getParameter(a.UNPACK_IMAGE_HEIGHT),k=c.getParameter(a.UNPACK_SKIP_PIXELS),z=c.getParameter(a.UNPACK_SKIP_ROWS),G=c.getParameter(a.UNPACK_SKIP_IMAGES);c.pixelStorei(a.UNPACK_ROW_LENGTH,L.width),c.pixelStorei(a.UNPACK_IMAGE_HEIGHT,L.height),c.pixelStorei(a.UNPACK_SKIP_PIXELS,T),c.pixelStorei(a.UNPACK_SKIP_ROWS,R),c.pixelStorei(a.UNPACK_SKIP_IMAGES,P);let W=e.isDataArrayTexture||e.isData3DTexture||t.isArrayTexture,Y=t.isDataArrayTexture||t.isData3DTexture||t.isArrayTexture;if(e.isDepthTexture){let H=l.get(e),$=l.get(t),J=l.get(H.renderTarget),te=l.get($.renderTarget),ce=J.framebuffers[H.cacheKey],he=te.framebuffers[$.cacheKey],ve=c.currentBoundFramebuffers[a.READ_FRAMEBUFFER]??null,Re=c.currentBoundFramebuffers[a.DRAW_FRAMEBUFFER]??null;c.bindFramebuffer(a.READ_FRAMEBUFFER,ce),c.bindFramebuffer(a.DRAW_FRAMEBUFFER,he);for(let Qe=0;Qe<S;Qe++)W&&(a.framebufferTextureLayer(a.READ_FRAMEBUFFER,a.COLOR_ATTACHMENT0,H.textureGPU,s,P+Qe),a.framebufferTextureLayer(a.DRAW_FRAMEBUFFER,a.COLOR_ATTACHMENT0,u,o,D+Qe)),a.blitFramebuffer(T,R,y,w,I,F,y,w,a.DEPTH_BUFFER_BIT,a.NEAREST);c.bindFramebuffer(a.READ_FRAMEBUFFER,ve),c.bindFramebuffer(a.DRAW_FRAMEBUFFER,Re)}else if(s!==0||e.isRenderTargetTexture||l.has(e)){let H=l.get(e);this._srcFramebuffer===null&&(this._srcFramebuffer=a.createFramebuffer()),this._dstFramebuffer===null&&(this._dstFramebuffer=a.createFramebuffer());let $=c.currentBoundFramebuffers[a.READ_FRAMEBUFFER]??null,J=c.currentBoundFramebuffers[a.DRAW_FRAMEBUFFER]??null;c.bindFramebuffer(a.READ_FRAMEBUFFER,this._srcFramebuffer),c.bindFramebuffer(a.DRAW_FRAMEBUFFER,this._dstFramebuffer);for(let te=0;te<S;te++)W?a.framebufferTextureLayer(a.READ_FRAMEBUFFER,a.COLOR_ATTACHMENT0,H.textureGPU,s,P+te):a.framebufferTexture2D(a.READ_FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,H.textureGPU,s),Y?a.framebufferTextureLayer(a.DRAW_FRAMEBUFFER,a.COLOR_ATTACHMENT0,u,o,D+te):a.framebufferTexture2D(a.DRAW_FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,u,o),s!==0?a.blitFramebuffer(T,R,y,w,I,F,y,w,a.COLOR_BUFFER_BIT,a.NEAREST):Y?a.copyTexSubImage3D(f,o,I,F,D+te,T,R,y,w):a.copyTexSubImage2D(f,o,I,F,T,R,y,w);c.bindFramebuffer(a.READ_FRAMEBUFFER,$),c.bindFramebuffer(a.DRAW_FRAMEBUFFER,J)}else Y?e.isDataTexture||e.isData3DTexture?a.texSubImage3D(f,o,I,F,D,y,w,S,A,d,L.data):t.isCompressedArrayTexture?a.compressedTexSubImage3D(f,o,I,F,D,y,w,S,A,L.data):a.texSubImage3D(f,o,I,F,D,y,w,S,A,d,L):e.isDataTexture?a.texSubImage2D(a.TEXTURE_2D,o,I,F,y,w,A,d,L.data):e.isCompressedTexture?a.compressedTexSubImage2D(a.TEXTURE_2D,o,I,F,L.width,L.height,A,L.data):a.texSubImage2D(a.TEXTURE_2D,o,I,F,y,w,A,d,L);c.pixelStorei(a.UNPACK_ROW_LENGTH,C),c.pixelStorei(a.UNPACK_IMAGE_HEIGHT,B),c.pixelStorei(a.UNPACK_SKIP_PIXELS,k),c.pixelStorei(a.UNPACK_SKIP_ROWS,z),c.pixelStorei(a.UNPACK_SKIP_IMAGES,G),o===0&&t.generateMipmaps&&a.generateMipmap(f),c.unbindTexture()}copyFramebufferToTexture(e,t,n){let{gl:r}=this,{state:s}=this.backend,{textureGPU:o}=this.backend.get(e),{x:a,y:l,z:c,w:u}=n,f=e.isDepthTexture===!0||t.renderTarget&&t.renderTarget.samples>0,d=t.renderTarget?t.renderTarget.height:this.backend.getDrawingBufferSize().y;if(f){let A=a!==0||l!==0,y,w;if(e.isDepthTexture===!0?(y=r.DEPTH_BUFFER_BIT,w=r.DEPTH_ATTACHMENT,t.stencil&&(y|=r.STENCIL_BUFFER_BIT)):(y=r.COLOR_BUFFER_BIT,w=r.COLOR_ATTACHMENT0),A){let S=this.backend.get(t.renderTarget),T=S.framebuffers[t.getCacheKey()],R=S.msaaFrameBuffer;s.bindFramebuffer(r.DRAW_FRAMEBUFFER,T),s.bindFramebuffer(r.READ_FRAMEBUFFER,R);let P=d-l-u;r.blitFramebuffer(a,P,a+c,P+u,a,P,a+c,P+u,y,r.NEAREST),s.bindFramebuffer(r.READ_FRAMEBUFFER,T),s.bindTexture(r.TEXTURE_2D,o),r.copyTexSubImage2D(r.TEXTURE_2D,0,0,0,a,P,c,u),s.unbindTexture()}else{let S=r.createFramebuffer();s.bindFramebuffer(r.DRAW_FRAMEBUFFER,S),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,w,r.TEXTURE_2D,o,0),r.blitFramebuffer(0,0,c,u,0,0,c,u,y,r.NEAREST),r.deleteFramebuffer(S)}}else s.bindTexture(r.TEXTURE_2D,o),r.copyTexSubImage2D(r.TEXTURE_2D,0,0,0,a,d-u-l,c,u),s.unbindTexture();e.generateMipmaps&&this.generateMipmaps(e),this.backend._setFramebuffer(t)}setupRenderBufferStorage(e,t,n,r=!1){let{gl:s}=this,o=t.renderTarget,{depthTexture:a,depthBuffer:l,stencilBuffer:c,width:u,height:f}=o;if(s.bindRenderbuffer(s.RENDERBUFFER,e),l&&!c){let d=s.DEPTH_COMPONENT24;r===!0?this.extensions.get("WEBGL_multisampled_render_to_texture").renderbufferStorageMultisampleEXT(s.RENDERBUFFER,o.samples,d,u,f):n>0?(a&&a.isDepthTexture&&a.type===s.FLOAT&&(d=s.DEPTH_COMPONENT32F),s.renderbufferStorageMultisample(s.RENDERBUFFER,n,d,u,f)):s.renderbufferStorage(s.RENDERBUFFER,d,u,f),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.RENDERBUFFER,e)}else l&&c&&(n>0?s.renderbufferStorageMultisample(s.RENDERBUFFER,n,s.DEPTH24_STENCIL8,u,f):s.renderbufferStorage(s.RENDERBUFFER,s.DEPTH_STENCIL,u,f),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_STENCIL_ATTACHMENT,s.RENDERBUFFER,e));s.bindRenderbuffer(s.RENDERBUFFER,null)}async copyTextureToBuffer(e,t,n,r,s,o){let{backend:a,gl:l}=this,{textureGPU:c,glFormat:u,glType:f}=this.backend.get(e),d=l.createFramebuffer();a.state.bindFramebuffer(l.READ_FRAMEBUFFER,d);let A=e.isCubeTexture?l.TEXTURE_CUBE_MAP_POSITIVE_X+o:l.TEXTURE_2D;l.framebufferTexture2D(l.READ_FRAMEBUFFER,l.COLOR_ATTACHMENT0,A,c,0);let y=this._getTypedArrayType(f),w=this._getBytesPerTexel(f,u),T=r*s*w,R=l.createBuffer();l.bindBuffer(l.PIXEL_PACK_BUFFER,R),l.bufferData(l.PIXEL_PACK_BUFFER,T,l.STREAM_READ),l.readPixels(t,n,r,s,u,f,0),l.bindBuffer(l.PIXEL_PACK_BUFFER,null),await a.utils._clientWaitAsync();let P=new y(T/y.BYTES_PER_ELEMENT);return l.bindBuffer(l.PIXEL_PACK_BUFFER,R),l.getBufferSubData(l.PIXEL_PACK_BUFFER,0,P),l.bindBuffer(l.PIXEL_PACK_BUFFER,null),a.state.bindFramebuffer(l.READ_FRAMEBUFFER,null),l.deleteFramebuffer(d),P}_getTypedArrayType(e){let{gl:t}=this;if(e===t.UNSIGNED_BYTE)return Uint8Array;if(e===t.UNSIGNED_SHORT_4_4_4_4||e===t.UNSIGNED_SHORT_5_5_5_1||e===t.UNSIGNED_SHORT_5_6_5||e===t.UNSIGNED_SHORT)return Uint16Array;if(e===t.UNSIGNED_INT)return Uint32Array;if(e===t.HALF_FLOAT)return Uint16Array;if(e===t.FLOAT)return Float32Array;throw new Error(`THREE.WebGLTextureUtils: Unsupported WebGL type: ${e}`)}_getBytesPerTexel(e,t){let{gl:n}=this,r=0;if(e===n.UNSIGNED_BYTE&&(r=1),(e===n.UNSIGNED_SHORT_4_4_4_4||e===n.UNSIGNED_SHORT_5_5_5_1||e===n.UNSIGNED_SHORT_5_6_5||e===n.UNSIGNED_SHORT||e===n.HALF_FLOAT)&&(r=2),(e===n.UNSIGNED_INT||e===n.FLOAT)&&(r=4),t===n.RGBA)return r*4;if(t===n.RGB)return r*3;if(t===n.ALPHA)return r}dispose(){let{gl:e}=this;this._srcFramebuffer!==null&&e.deleteFramebuffer(this._srcFramebuffer),this._dstFramebuffer!==null&&e.deleteFramebuffer(this._dstFramebuffer)}};function zR(i){return i.isDataTexture?i.image.data:typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas?i:i.data}var w9=class{constructor(e){this.backend=e,this.gl=this.backend.gl,this.availableExtensions=this.gl.getSupportedExtensions(),this.extensions={}}get(e){let t=this.extensions[e];return t===void 0&&(t=this.gl.getExtension(e),this.extensions[e]=t),t}has(e){return this.availableExtensions.includes(e)}},S9=class{constructor(e){this.backend=e,this.maxAnisotropy=null,this.maxUniformBlockSize=null}getMaxAnisotropy(){if(this.maxAnisotropy!==null)return this.maxAnisotropy;let e=this.backend.gl,t=this.backend.extensions;if(t.has("EXT_texture_filter_anisotropic")===!0){let n=t.get("EXT_texture_filter_anisotropic");this.maxAnisotropy=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else this.maxAnisotropy=0;return this.maxAnisotropy}getUniformBufferLimit(){if(this.maxUniformBlockSize!==null)return this.maxUniformBlockSize;let e=this.backend.gl;return this.maxUniformBlockSize=e.getParameter(e.MAX_UNIFORM_BLOCK_SIZE),this.maxUniformBlockSize}},Wte={WEBGL_multi_draw:"WEBGL_multi_draw",WEBGL_compressed_texture_astc:"texture-compression-astc",WEBGL_compressed_texture_etc:"texture-compression-etc2",WEBGL_compressed_texture_etc1:"texture-compression-etc1",WEBGL_compressed_texture_pvrtc:"texture-compression-pvrtc",WEBGL_compressed_texture_s3tc:"texture-compression-s3tc",EXT_texture_compression_bptc:"texture-compression-bc",EXT_disjoint_timer_query_webgl2:"timestamp-query",OVR_multiview2:"OVR_multiview2"},T9=class{constructor(e){this.gl=e.gl,this.extensions=e.extensions,this.info=e.renderer.info,this.mode=null,this.index=0,this.type=null,this.object=null}render(e,t){let{gl:n,mode:r,object:s,type:o,info:a,index:l}=this;l!==0?n.drawElements(r,t,o,e):n.drawArrays(r,e,t),a.update(s,t,1)}renderInstances(e,t,n){let{gl:r,mode:s,type:o,index:a,object:l,info:c}=this;n!==0&&(a!==0?r.drawElementsInstanced(s,t,o,e,n):r.drawArraysInstanced(s,e,t,n),c.update(l,t,n))}renderMultiDraw(e,t,n){let{extensions:r,mode:s,object:o,info:a}=this;if(n===0)return;let l=r.get("WEBGL_multi_draw");if(l===null)for(let c=0;c<n;c++)this.render(e[c],t[c]);else{this.index!==0?l.multiDrawElementsWEBGL(s,t,0,this.type,e,0,n):l.multiDrawArraysWEBGL(s,e,0,t,0,n);let c=0;for(let u=0;u<n;u++)c+=t[u];a.update(o,c,1)}}},sI=class{constructor(e=256){this.trackTimestamp=!0,this.maxQueries=e,this.currentQueryIndex=0,this.queryOffsets=new Map,this.isDisposed=!1,this.lastValue=0,this.frames=[],this.pendingResolve=!1,this.timestamps=new Map}getTimestampFrames(){return this.frames}getTimestamp(e){let t=this.timestamps.get(e);return t===void 0&&(Xe(`TimestampQueryPool: No timestamp available for uid ${e}.`),t=0),t}hasTimestampQuery(e){return this.timestamps.has(e)}allocateQueriesForContext(){}async resolveQueriesAsync(){}dispose(){}},E9=class extends sI{constructor(e,t,n=2048){if(super(n),this.gl=e,this.type=t,this.ext=e.getExtension("EXT_disjoint_timer_query_webgl2")||e.getExtension("EXT_disjoint_timer_query"),!this.ext){Xe("EXT_disjoint_timer_query not supported; timestamps will be disabled."),this.trackTimestamp=!1;return}this.queries=[];for(let r=0;r<this.maxQueries;r++)this.queries.push(e.createQuery());this.activeQuery=null,this.queryStates=new Map}allocateQueriesForContext(e){if(!this.trackTimestamp)return null;if(this.currentQueryIndex+2>this.maxQueries)return ni(`WebGLTimestampQueryPool [${this.type}]: Maximum number of queries exceeded, when using trackTimestamp it is necessary to resolves the queries via renderer.resolveTimestampsAsync( THREE.TimestampQuery.${this.type.toUpperCase()} ).`),null;let t=this.currentQueryIndex;return this.currentQueryIndex+=2,this.queryStates.set(t,"inactive"),this.queryOffsets.set(e,t),t}beginQuery(e){if(!this.trackTimestamp||this.isDisposed)return;let t=this.queryOffsets.get(e);if(t==null||this.activeQuery!==null)return;let n=this.queries[t];if(n)try{this.queryStates.get(t)==="inactive"&&(this.gl.beginQuery(this.ext.TIME_ELAPSED_EXT,n),this.activeQuery=t,this.queryStates.set(t,"started"))}catch(r){ze("Error in beginQuery:",r),this.activeQuery=null,this.queryStates.set(t,"inactive")}}endQuery(e){if(!this.trackTimestamp||this.isDisposed)return;let t=this.queryOffsets.get(e);if(t!=null&&this.activeQuery===t)try{this.gl.endQuery(this.ext.TIME_ELAPSED_EXT),this.queryStates.set(t,"ended"),this.activeQuery=null}catch(n){ze("Error in endQuery:",n),this.queryStates.set(t,"inactive"),this.activeQuery=null}}async resolveQueriesAsync(){if(!this.trackTimestamp||this.pendingResolve)return this.lastValue;this.pendingResolve=!0;try{let e=new Map;for(let[s,o]of this.queryOffsets)if(this.queryStates.get(o)==="ended"){let l=this.queries[o];e.set(s,this.resolveQuery(l))}if(e.size===0)return this.lastValue;let t={},n=[];for(let[s,o]of e){let a=s.match(/^(.*):f(\d+)$/),l=parseInt(a[2]);n.includes(l)===!1&&n.push(l),t[l]===void 0&&(t[l]=0);let c=await o;this.timestamps.set(s,c),t[l]+=c}let r=t[n[n.length-1]];return this.lastValue=r,this.frames=n,this.currentQueryIndex=0,this.queryOffsets.clear(),this.queryStates.clear(),this.activeQuery=null,r}catch(e){return ze("Error resolving queries:",e),this.lastValue}finally{this.pendingResolve=!1}}async resolveQuery(e){return new Promise(t=>{if(this.isDisposed){t(this.lastValue);return}let n,r=!1,s=()=>{n&&(clearTimeout(n),n=null)},o=l=>{r||(r=!0,s(),t(l))},a=()=>{if(this.isDisposed){o(this.lastValue);return}try{if(this.gl.getParameter(this.ext.GPU_DISJOINT_EXT)){o(this.lastValue);return}if(!this.gl.getQueryParameter(e,this.gl.QUERY_RESULT_AVAILABLE)){n=setTimeout(a,1);return}let u=this.gl.getQueryParameter(e,this.gl.QUERY_RESULT);t(Number(u)/1e6)}catch(l){ze("Error checking query:",l),t(this.lastValue)}};a()})}dispose(){if(!this.isDisposed&&(this.isDisposed=!0,!!this.trackTimestamp)){for(let e of this.queries)this.gl.deleteQuery(e);this.queries=[],this.queryStates.clear(),this.queryOffsets.clear(),this.lastValue=0,this.activeQuery=null}}},oI=class extends rI{constructor(e={}){super(e),this.isWebGLBackend=!0,this.attributeUtils=null,this.extensions=null,this.capabilities=null,this.textureUtils=null,this.bufferRenderer=null,this.gl=null,this.state=null,this.utils=null,this.vaoCache={},this.transformFeedbackCache={},this.discard=!1,this.disjoint=null,this.parallel=null,this._currentContext=null,this._knownBindings=new WeakSet,this._supportsInvalidateFramebuffer=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),this._xrFramebuffer=null}init(e){super.init(e);let t=this.parameters,n={antialias:e.currentSamples>0,alpha:!0,depth:e.depth,stencil:e.stencil},r=t.context!==void 0?t.context:e.domElement.getContext("webgl2",n);function s(o){o.preventDefault();let a={api:"WebGL",message:o.statusMessage||"Unknown reason",reason:null,originalEvent:o};e.onDeviceLost(a)}this._onContextLost=s,e.domElement.addEventListener("webglcontextlost",s,!1),this.gl=r,this.extensions=new w9(this),this.capabilities=new S9(this),this.attributeUtils=new _9(this),this.textureUtils=new b9(this),this.bufferRenderer=new T9(this),this.state=new x9(this),this.utils=new y9(this),this.extensions.get("EXT_color_buffer_float"),this.extensions.get("WEBGL_clip_cull_distance"),this.extensions.get("OES_texture_float_linear"),this.extensions.get("EXT_color_buffer_half_float"),this.extensions.get("WEBGL_multisampled_render_to_texture"),this.extensions.get("WEBGL_render_shared_exponent"),this.extensions.get("WEBGL_multi_draw"),this.extensions.get("OVR_multiview2"),this.extensions.get("EXT_clip_control"),this.disjoint=this.extensions.get("EXT_disjoint_timer_query_webgl2"),this.parallel=this.extensions.get("KHR_parallel_shader_compile"),this.drawBuffersIndexedExt=this.extensions.get("OES_draw_buffers_indexed"),t.reversedDepthBuffer&&(this.extensions.has("EXT_clip_control")?e.reversedDepthBuffer=!0:(Xe("WebGPURenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer."),e.reversedDepthBuffer=!1)),e.reversedDepthBuffer&&this.state.setReversedDepth(!0)}get coordinateSystem(){return Uo}get hasTimestamp(){return this.disjoint!==null}async getArrayBufferAsync(e,t=null,n=0,r=-1){return await this.attributeUtils.getArrayBufferAsync(e,t,n,r)}async makeXRCompatible(){this.gl.getContextAttributes().xrCompatible!==!0&&await this.gl.makeXRCompatible()}setXRTarget(e){this._xrFramebuffer=e}setXRRenderTargetTextures(e,t,n=null){let r=this.gl;if(this.set(e.texture,{textureGPU:t,glInternalFormat:r.RGBA8}),n!==null){let s=e.stencilBuffer?r.DEPTH24_STENCIL8:r.DEPTH_COMPONENT24;this.set(e.depthTexture,{textureGPU:n,glInternalFormat:s}),this.extensions.has("WEBGL_multisampled_render_to_texture")===!0&&e._autoAllocateDepthBuffer===!0&&e.multiview===!1&&Xe("WebGLBackend: Render-to-texture extension was disabled because an external texture was provided"),e._autoAllocateDepthBuffer=!1}}initTimestampQuery(e,t){if(!this.disjoint||!this.trackTimestamp)return;this.timestampQueryPool[e]||(this.timestampQueryPool[e]=new E9(this.gl,e,2048));let n=this.timestampQueryPool[e];n.allocateQueriesForContext(t)!==null&&n.beginQuery(t)}prepareTimestampBuffer(e,t){if(!this.disjoint||!this.trackTimestamp)return;this.timestampQueryPool[e].endQuery(t)}getContext(){return this.gl}beginRender(e){let{state:t}=this,n=this.get(e);if(e.viewport)this.updateViewport(e);else{let{width:s,height:o}=this.getDrawingBufferSize();t.viewport(0,0,s,o)}if(e.scissor)this.updateScissor(e);else{let{width:s,height:o}=this.getDrawingBufferSize();t.scissor(0,0,s,o)}this.initTimestampQuery(Xc.RENDER,this.getTimestampUID(e)),n.previousContext=this._currentContext,this._currentContext=e,this._setFramebuffer(e),this.clear(e.clearColor,e.clearDepth,e.clearStencil,e,!1);let r=e.occlusionQueryCount;r>0&&(n.currentOcclusionQueries=n.occlusionQueries,n.currentOcclusionQueryObjects=n.occlusionQueryObjects,n.lastOcclusionObject=null,n.occlusionQueries=new Array(r),n.occlusionQueryObjects=new Array(r),n.occlusionQueryIndex=0)}finishRender(e){let{gl:t,state:n}=this,r=this.get(e),s=r.previousContext;n.resetVertexState();let o=e.occlusionQueryCount;o>0&&(o>r.occlusionQueryIndex&&t.endQuery(t.ANY_SAMPLES_PASSED),this.resolveOccludedAsync(e));let a=e.textures;if(a!==null)for(let l=0;l<a.length;l++){let c=a[l];c.generateMipmaps&&this.generateMipmaps(c)}if(this._currentContext=s,this._resolveRenderTarget(e),s!==null){if(this._setFramebuffer(s),s.viewport)this.updateViewport(s);else{let{width:l,height:c}=this.getDrawingBufferSize();n.viewport(0,0,l,c)}if(s.scissor)this.updateScissor(s);else{let{width:l,height:c}=this.getDrawingBufferSize();n.scissor(0,0,l,c)}}this.prepareTimestampBuffer(Xc.RENDER,this.getTimestampUID(e))}resolveOccludedAsync(e){let t=this.get(e),{currentOcclusionQueries:n,currentOcclusionQueryObjects:r}=t;if(n&&r){let s=new WeakSet,{gl:o}=this;t.currentOcclusionQueryObjects=null,t.currentOcclusionQueries=null;let a=()=>{let l=0;for(let c=0;c<n.length;c++){let u=n[c];u!==null&&o.getQueryParameter(u,o.QUERY_RESULT_AVAILABLE)&&(o.getQueryParameter(u,o.QUERY_RESULT)===0&&s.add(r[c]),n[c]=null,o.deleteQuery(u),l++)}l<n.length?requestAnimationFrame(a):t.occluded=s};a()}}isOccluded(e,t){let n=this.get(e);return n.occluded&&n.occluded.has(t)}updateViewport(e){let{state:t}=this,{x:n,y:r,width:s,height:o}=e.viewportValue;t.viewport(n,e.height-o-r,s,o)}updateScissor(e){let{state:t}=this,{x:n,y:r,width:s,height:o}=e.scissorValue;t.scissor(n,e.height-o-r,s,o)}setScissorTest(e){this.state.setScissorTest(e)}getClearColor(){let e=super.getClearColor();return e.r*=e.a,e.g*=e.a,e.b*=e.a,e}clear(e,t,n,r=null,s=!0,o=!0){let{gl:a,renderer:l}=this;r===null&&(r={textures:null,clearColorValue:this.getClearColor()});let c=0;if(e&&(c|=a.COLOR_BUFFER_BIT),t&&(c|=a.DEPTH_BUFFER_BIT),n&&(c|=a.STENCIL_BUFFER_BIT),c!==0){let u;r.clearColorValue?u=r.clearColorValue:u=this.getClearColor();let f=l.getClearDepth(),d=l.getClearStencil();if(t&&this.state.setDepthMask(!0),r.textures===null)a.clearColor(u.r,u.g,u.b,u.a),a.clear(c);else{if(s&&this._setFramebuffer(r),e)for(let A=0;A<r.textures.length;A++)A===0?a.clearBufferfv(a.COLOR,A,[u.r,u.g,u.b,u.a]):a.clearBufferfv(a.COLOR,A,[0,0,0,1]);t&&n?a.clearBufferfi(a.DEPTH_STENCIL,0,f,d):t?a.clearBufferfv(a.DEPTH,0,[f]):n&&a.clearBufferiv(a.STENCIL,0,[d]),s&&o&&this._resolveRenderTarget(r),s&&this._currentContext!==null&&this._currentContext!==r&&this._setFramebuffer(this._currentContext)}}}beginCompute(e){let{state:t,gl:n}=this;t.bindFramebuffer(n.FRAMEBUFFER,null),this.initTimestampQuery(Xc.COMPUTE,this.getTimestampUID(e))}compute(e,t,n,r,s=null){let{state:o,gl:a}=this;this.discard===!1&&(o.enable(a.RASTERIZER_DISCARD),this.discard=!0);let{programGPU:l,transformBuffers:c,attributes:u}=this.get(r),f=this._getVaoKey(u),d=this.vaoCache[f];d===void 0?this.vaoCache[f]=this._createVao(u):o.setVertexState(d),o.useProgram(l),this._bindUniforms(n);let A=this._getTransformFeedback(c);a.bindTransformFeedback(a.TRANSFORM_FEEDBACK,A),a.beginTransformFeedback(a.POINTS),s=s!==null?s:t.count,Array.isArray(s)?(ni("WebGLBackend.compute(): The count parameter must be a single number, not an array."),s=s[0]):s&&typeof s=="object"&&s.isIndirectStorageBufferAttribute&&(ni("WebGLBackend.compute(): The count parameter must be a single number, not IndirectStorageBufferAttribute"),s=t.count),u[0].isStorageInstancedBufferAttribute?a.drawArraysInstanced(a.POINTS,0,1,s):a.drawArrays(a.POINTS,0,s),a.endTransformFeedback(),a.bindTransformFeedback(a.TRANSFORM_FEEDBACK,null);for(let y=0;y<c.length;y++){let w=c[y];w.pbo&&this.has(w.pbo)&&this.textureUtils.copyBufferToTexture(w.transformBuffer,w.pbo),w.switchBuffers()}}finishCompute(e){let{state:t,gl:n}=this;this.discard=!1,t.disable(n.RASTERIZER_DISCARD),this.prepareTimestampBuffer(Xc.COMPUTE,this.getTimestampUID(e)),this._currentContext&&this._setFramebuffer(this._currentContext)}_isRenderCameraDepthArray(e){return e.depthTexture&&e.depthTexture.isArrayTexture&&e.camera.isArrayCamera}_draw(e,t,n,r,s,o){if(e.isBatchedMesh)if(this.hasFeature("WEBGL_multi_draw")===!1){let{gl:a}=this,l=a.getUniformLocation(o,"nodeUniformDrawId"),c=e._multiDrawStarts,u=e._multiDrawCounts,f=e._multiDrawCount;for(let d=0;d<f;d++)a.uniform1ui(l,d),t.render(c[d],u[d])}else t.renderMultiDraw(e._multiDrawStarts,e._multiDrawCounts,e._multiDrawCount);else s>1?t.renderInstances(n,r,s):t.render(n,r)}draw(e){let{object:t,pipeline:n,material:r,context:s,hardwareClippingPlanes:o}=e,{programGPU:a}=this.get(n),{gl:l,state:c}=this,u=this.get(s),f=e.getDrawParameters();if(f===null)return;this._bindUniforms(e.getBindings());let d=t.isMesh&&t.matrixWorld.determinantAffine()<0;c.setMaterial(r,d,o),s.mrt!==null&&s.textures!==null&&c.setMRTBlending(s.textures,s.mrt,r),c.useProgram(a);let A=e.getAttributes(),y=this.get(A),w=y.vaoGPU;if(w===void 0){let L=this._getVaoKey(A);w=this.vaoCache[L],w===void 0&&(w=this._createVao(A),this.vaoCache[L]=w,y.vaoGPU=w)}let S=e.getIndex(),T=S!==null?this.get(S).bufferGPU:null;c.setVertexState(w,T);let R=u.lastOcclusionObject;if(R!==t&&R!==void 0){if(R!==null&&R.occlusionTest===!0&&(l.endQuery(l.ANY_SAMPLES_PASSED),u.occlusionQueryIndex++),t.occlusionTest===!0){let L=l.createQuery();l.beginQuery(l.ANY_SAMPLES_PASSED,L),u.occlusionQueries[u.occlusionQueryIndex]=L,u.occlusionQueryObjects[u.occlusionQueryIndex]=t}u.lastOcclusionObject=t}let P=this.bufferRenderer;t.isPoints?P.mode=l.POINTS:t.isLineSegments?P.mode=l.LINES:t.isLine?P.mode=l.LINE_STRIP:t.isLineLoop?P.mode=l.LINE_LOOP:r.wireframe===!0?(c.setLineWidth(r.wireframeLinewidth*this.renderer.getPixelRatio()),P.mode=l.LINES):P.mode=l.TRIANGLES;let{vertexCount:I,instanceCount:F}=f,{firstVertex:D}=f;if(P.object=t,S!==null){D*=S.array.BYTES_PER_ELEMENT;let L=this.get(S);P.index=S.count,P.type=L.type}else P.index=0;if(e.camera.isArrayCamera===!0&&e.camera.cameras.length>0&&e.camera.isMultiViewCamera===!1){let L=this.get(e.camera),C=e.camera.cameras,B=e.getBindingGroup("cameraIndex").bindings[0];if(L.indexesGPU===void 0||L.indexesGPU.length!==C.length){let H=new Uint32Array([0,0,0,0]),$=[];for(let J=0,te=C.length;J<te;J++){let ce=l.createBuffer();H[0]=J,l.bindBuffer(l.UNIFORM_BUFFER,ce),l.bufferData(l.UNIFORM_BUFFER,H,l.STATIC_DRAW),$.push(ce)}L.indexesGPU=$}let k=0;e:for(let H of e.getBindings())for(let $ of H.bindings){if($===B)break e;($.isUniformsGroup||$.isUniformBuffer)&&k++}let z=this.renderer.getPixelRatio(),G=this._currentContext.renderTarget,W=this._isRenderCameraDepthArray(this._currentContext),Y=this._currentContext.activeCubeFace;if(W){let H=this.get(G.depthTexture);if(H.clearedRenderId!==this.renderer._nodes.nodeFrame.renderId){H.clearedRenderId=this.renderer._nodes.nodeFrame.renderId;let{stencilBuffer:$}=G;for(let J=0,te=C.length;J<te;J++)this.renderer._activeCubeFace=J,this._currentContext.activeCubeFace=J,this._setFramebuffer(this._currentContext),this.clear(!1,!0,$,this._currentContext,!1,!1);this.renderer._activeCubeFace=Y,this._currentContext.activeCubeFace=Y}}for(let H=0,$=C.length;H<$;H++){let J=C[H];if(t.layers.test(J.layers)){W&&(this.renderer._activeCubeFace=H,this._currentContext.activeCubeFace=H,this._setFramebuffer(this._currentContext));let te=J.viewport;if(te!==void 0){let ce=te.x*z,he=te.y*z,ve=te.width*z,Re=te.height*z;c.viewport(Math.floor(ce),Math.floor(e.context.height-Re-he),Math.floor(ve),Math.floor(Re))}c.bindBufferBase(l.UNIFORM_BUFFER,k,L.indexesGPU[H]),this._draw(t,P,D,I,F,a)}this._currentContext.activeCubeFace=Y,this.renderer._activeCubeFace=Y}}else this._draw(t,P,D,I,F,a)}needsRenderUpdate(){return!1}getRenderCacheKey(){return""}createDefaultTexture(e){this.textureUtils.createDefaultTexture(e)}createTexture(e,t){this.textureUtils.createTexture(e,t)}updateTexture(e,t){this.textureUtils.updateTexture(e,t)}generateMipmaps(e){this.textureUtils.generateMipmaps(e)}destroyTexture(e,t=!1){this.textureUtils.destroyTexture(e,t)}async copyTextureToBuffer(e,t,n,r,s,o){return this.textureUtils.copyTextureToBuffer(e,t,n,r,s,o)}updateSampler(){return""}createNodeBuilder(e,t){return new g9(e,t)}createProgram(e){let t=this.gl,{stage:n,code:r}=e,s=n==="fragment"?t.createShader(t.FRAGMENT_SHADER):t.createShader(t.VERTEX_SHADER);t.shaderSource(s,r),t.compileShader(s),this.set(e,{shaderGPU:s})}destroyProgram(e){this.delete(e)}createRenderPipeline(e,t){let n=this.gl,r=e.pipeline,{fragmentProgram:s,vertexProgram:o}=r,a=n.createProgram(),l=this.get(s).shaderGPU,c=this.get(o).shaderGPU;if(n.attachShader(a,l),n.attachShader(a,c),n.linkProgram(a),this.set(r,{programGPU:a,fragmentShader:l,vertexShader:c}),t!==null&&this.parallel){let u=new Promise(f=>{let d=this.parallel,A=()=>{n.getProgramParameter(a,d.COMPLETION_STATUS_KHR)?(this._completeCompile(e,r),f()):requestAnimationFrame(A)};A()});t.push(u);return}this._completeCompile(e,r)}_handleSource(e,t){let n=e.split(`43594359 `),r=[],s=Math.max(t-6,0),o=Math.min(t+6,n.length);for(let a=s;a<o;a++){let l=a+1;r.push(`${l===t?">":" "} ${l}: ${n[a]}`)}return r.join(`43604360 `)}_getShaderErrors(e,t,n){let r=e.getShaderParameter(t,e.COMPILE_STATUS),o=(e.getShaderInfoLog(t)||"").trim();if(r&&o==="")return"";let a=/ERROR: 0:(\d+)/.exec(o);if(a){let l=parseInt(a[1]);return n.toUpperCase()+`43614361 @@ -4367,7 +4367,7 @@ Program Info Log: `+o+`
43674367 `+a+`43684368 `+l)}else o!==""&&Xe("WebGLProgram: Program Info Log:",o)}}_completeCompile(e,t){let{state:n,gl:r}=this,s=this.get(t),{programGPU:o,fragmentShader:a,vertexShader:l}=s;r.getProgramParameter(o,r.LINK_STATUS)===!1&&this._logProgramError(o,a,l),n.useProgram(o);let c=e.getBindings();this._setupBindings(c,o),this.set(t,{programGPU:o,pipeline:o})}createComputePipeline(e,t){let{state:n,gl:r}=this,s={stage:"fragment",code:`#version 300 es43694369 precision highp float;4370-void main() {}`};this.createProgram(s);let{computeProgram:o}=e,a=r.createProgram(),l=this.get(s).shaderGPU,c=this.get(o).shaderGPU,u=o.transforms,f=[],d=[];for(let S=0;S<u.length;S++){let T=u[S];f.push(T.varyingName),d.push(T.attributeNode)}r.attachShader(a,l),r.attachShader(a,c),r.transformFeedbackVaryings(a,f,r.SEPARATE_ATTRIBS),r.linkProgram(a),r.getProgramParameter(a,r.LINK_STATUS)===!1&&this._logProgramError(a,l,c),n.useProgram(a),this._setupBindings(t,a);let A=o.attributes,y=[],w=[];for(let S=0;S<A.length;S++){let T=A[S].node.attribute;y.push(T),this.has(T)||this.attributeUtils.createAttribute(T,r.ARRAY_BUFFER)}for(let S=0;S<d.length;S++){let T=d[S].attribute;this.has(T)||this.attributeUtils.createAttribute(T,r.ARRAY_BUFFER);let R=this.get(T);w.push(R)}this.set(e,{programGPU:a,transformBuffers:w,attributes:y})}createBindings(e,t){if(this._knownBindings.has(t)===!1){this._knownBindings.add(t);let n=0,r=0;for(let s of t){this.set(s,{textures:r,uniformBuffers:n});for(let o of s.bindings)o.isUniformBuffer&&n++,o.isSampledTexture&&r++}}this.updateBindings(e,t)}updateBindings(e){let{gl:t}=this;for(let n of e.bindings){let r=this.get(n);if(n.isUniformsGroup||n.isUniformBuffer){let s=n.buffer,o=r.bufferGPU;t.bindBuffer(t.UNIFORM_BUFFER,o);let a=n.updateRanges;if(t.bindBuffer(t.UNIFORM_BUFFER,o),a.length===0)t.bufferData(t.UNIFORM_BUFFER,s,t.DYNAMIC_DRAW);else{let l=f_(s),c=l?1:s.BYTES_PER_ELEMENT;for(let u=0,f=a.length;u<f;u++){let d=a[u],A=d.start*c,y=d.count*c,w=A*(l?s.BYTES_PER_ELEMENT:1);t.bufferSubData(t.UNIFORM_BUFFER,w,s,A,y)}}this.set(n,r)}else if(n.isSampledTexture){let{textureGPU:s,glTextureType:o}=this.get(n.texture);r.textureGPU=s,r.glTextureType=o,this.set(n,r)}}}updateBinding(e){let t=this.gl;if(e.isUniformsGroup||e.isUniformBuffer){let r=this.get(e).bufferGPU,s=e.buffer,o=e.updateRanges;if(t.bindBuffer(t.UNIFORM_BUFFER,r),o.length===0)t.bufferData(t.UNIFORM_BUFFER,s,t.DYNAMIC_DRAW);else{let a=f_(s),l=a?1:s.BYTES_PER_ELEMENT,c=o[0].start;for(let u=0,f=o.length;u<f;u++){let d=o[u],A=o[u+1],y=d.start+d.count;if(A!==void 0&&A.start===y)continue;let w=c*l,S=(y-c)*l,T=w*(a?s.BYTES_PER_ELEMENT:1);t.bufferSubData(t.UNIFORM_BUFFER,T,s,w,S),A!==void 0&&(c=A.start)}}}}createUniformBuffer(e){let t=this.get(e);if(t.bufferGPU===void 0){let n=this.gl,r=e.buffer;t.bufferGPU=n.createBuffer(),n.bindBuffer(n.UNIFORM_BUFFER,t.bufferGPU),n.bufferData(n.UNIFORM_BUFFER,r.byteLength,n.DYNAMIC_DRAW)}}destroyUniformBuffer(e){let t=this.get(e);this.gl.deleteBuffer(t.bufferGPU),this.delete(e)}createIndexAttribute(e){let t=this.gl;this.attributeUtils.createAttribute(e,t.ELEMENT_ARRAY_BUFFER)}createAttribute(e){if(this.has(e))return;let t=this.gl;this.attributeUtils.createAttribute(e,t.ARRAY_BUFFER)}createStorageAttribute(e){if(this.has(e))return;let t=this.gl;this.attributeUtils.createAttribute(e,t.ARRAY_BUFFER)}updateAttribute(e){this.attributeUtils.updateAttribute(e)}destroyAttribute(e){this.attributeUtils.destroyAttribute(e)}hasFeature(e){let t=Object.keys(Bte).filter(r=>Bte[r]===e),n=this.extensions;for(let r=0;r<t.length;r++)if(n.has(t[r]))return!0;return!1}copyTextureToTexture(e,t,n=null,r=null,s=0,o=0){this.textureUtils.copyTextureToTexture(e,t,n,r,s,o)}copyFramebufferToTexture(e,t,n){this.textureUtils.copyFramebufferToTexture(e,t,n)}hasCompatibility(e){return e===Ud.TEXTURE_COMPARE?!0:super.hasCompatibility(e)}initRenderTarget(e){let{gl:t,state:n}=this;this._setFramebuffer(e),n.bindFramebuffer(t.FRAMEBUFFER,null)}_setFramebuffer(e){let{gl:t,state:n}=this,r=null;if(e.textures!==null){let s=e.renderTarget,o=this.get(s),{samples:a,depthBuffer:l,stencilBuffer:c}=s,u=s.isCubeRenderTarget===!0,f=s.isRenderTarget3D===!0,d=s.depth>1,A=s.isXRRenderTarget===!0,y=A===!0&&s._hasExternalTextures===!0,w=o.msaaFrameBuffer,S=o.depthRenderbuffer,T=this.extensions.get("WEBGL_multisampled_render_to_texture"),R=this.extensions.get("OVR_multiview2"),P=this._useMultisampledExtension(s),I=hse(e),F;if(u?(o.cubeFramebuffers||(o.cubeFramebuffers={}),F=o.cubeFramebuffers[I]):A&&y===!1?F=this._xrFramebuffer:(o.framebuffers||(o.framebuffers={}),F=o.framebuffers[I]),F===void 0){F=t.createFramebuffer(),n.bindFramebuffer(t.FRAMEBUFFER,F);let D=e.textures,L=[];if(u){o.cubeFramebuffers[I]=F;let{textureGPU:B}=this.get(D[0]),k=this.renderer._activeCubeFace,z=this.renderer._activeMipmapLevel;t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+k,B,z)}else{o.framebuffers[I]=F;for(let B=0;B<D.length;B++){let k=D[B],z=this.get(k);z.renderTarget=e.renderTarget,z.cacheKey=I;let G=t.COLOR_ATTACHMENT0+B;if(s.multiview)R.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,G,z.textureGPU,0,a,0,2);else if(f||d){let W=this.renderer._activeCubeFace,Y=this.renderer._activeMipmapLevel;t.framebufferTextureLayer(t.FRAMEBUFFER,G,z.textureGPU,Y,W)}else if(P)T.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,G,t.TEXTURE_2D,z.textureGPU,0,a);else{let W=this.renderer._activeMipmapLevel;t.framebufferTexture2D(t.FRAMEBUFFER,G,t.TEXTURE_2D,z.textureGPU,W)}}}let C=c?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;if(s._autoAllocateDepthBuffer===!0){let B=t.createRenderbuffer();this.textureUtils.setupRenderBufferStorage(B,e,0,P),o.xrDepthRenderbuffer=B,L.push(c?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT),t.bindRenderbuffer(t.RENDERBUFFER,B),t.framebufferRenderbuffer(t.FRAMEBUFFER,C,t.RENDERBUFFER,B)}else if(e.depthTexture!==null){L.push(c?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT);let B=this.get(e.depthTexture);if(B.renderTarget=e.renderTarget,B.cacheKey=I,s.multiview)R.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,C,B.textureGPU,0,a,0,2);else if(y&&P)T.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,C,t.TEXTURE_2D,B.textureGPU,0,a);else if(e.depthTexture.isArrayTexture){let k=this.renderer._activeCubeFace;t.framebufferTextureLayer(t.FRAMEBUFFER,C,B.textureGPU,0,k)}else if(e.depthTexture.isCubeTexture){let k=this.renderer._activeCubeFace;t.framebufferTexture2D(t.FRAMEBUFFER,C,t.TEXTURE_CUBE_MAP_POSITIVE_X+k,B.textureGPU,0)}else t.framebufferTexture2D(t.FRAMEBUFFER,C,t.TEXTURE_2D,B.textureGPU,0)}o.depthInvalidationArray=L}else{if(this._isRenderCameraDepthArray(e)){n.bindFramebuffer(t.FRAMEBUFFER,F);let L=this.renderer._activeCubeFace,C=this.get(e.depthTexture),B=c?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.framebufferTextureLayer(t.FRAMEBUFFER,B,C.textureGPU,0,L)}if((A||P||s.multiview)&&s._isOpaqueFramebuffer!==!0){n.bindFramebuffer(t.FRAMEBUFFER,F);let L=this.get(e.textures[0]);s.multiview?R.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,L.textureGPU,0,a,0,2):P?T.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,L.textureGPU,0,a):t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,L.textureGPU,0);let C=c?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;if(s._autoAllocateDepthBuffer===!0){let B=o.xrDepthRenderbuffer;t.bindRenderbuffer(t.RENDERBUFFER,B),t.framebufferRenderbuffer(t.FRAMEBUFFER,C,t.RENDERBUFFER,B)}else{let B=this.get(e.depthTexture);s.multiview?R.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,C,B.textureGPU,0,a,0,2):P?T.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,C,t.TEXTURE_2D,B.textureGPU,0,a):t.framebufferTexture2D(t.FRAMEBUFFER,C,t.TEXTURE_2D,B.textureGPU,0)}}}if(a>0&&P===!1&&!s.multiview){if(w===void 0){let D=[];w=t.createFramebuffer(),n.bindFramebuffer(t.FRAMEBUFFER,w);let L=[],C=e.textures;for(let B=0;B<C.length;B++){L[B]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,L[B]),D.push(t.COLOR_ATTACHMENT0+B);let k=e.textures[B],z=this.get(k);t.renderbufferStorageMultisample(t.RENDERBUFFER,a,z.glInternalFormat,e.width,e.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+B,t.RENDERBUFFER,L[B])}if(t.bindRenderbuffer(t.RENDERBUFFER,null),o.msaaFrameBuffer=w,o.msaaRenderbuffers=L,l&&S===void 0){S=t.createRenderbuffer(),this.textureUtils.setupRenderBufferStorage(S,e,a),o.depthRenderbuffer=S;let B=c?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;D.push(B)}o.invalidationArray=D}r=o.msaaFrameBuffer}else r=F;n.drawBuffers(e,F)}n.bindFramebuffer(t.FRAMEBUFFER,r)}_getVaoKey(e){let t="";for(let n=0;n<e.length;n++){let r=this.get(e[n]);t+=":"+r.id}return t}_createVao(e){let{gl:t}=this,n=t.createVertexArray();t.bindVertexArray(n);for(let r=0;r<e.length;r++){let s=e[r],o=this.get(s);t.bindBuffer(t.ARRAY_BUFFER,o.bufferGPU),t.enableVertexAttribArray(r);let a,l;s.isInterleavedBufferAttribute===!0?(a=s.data.stride*o.bytesPerElement,l=s.offset*o.bytesPerElement):(a=0,l=0),o.isInteger?t.vertexAttribIPointer(r,s.itemSize,o.type,a,l):t.vertexAttribPointer(r,s.itemSize,o.type,s.normalized,a,l),s.isInstancedBufferAttribute&&!s.isInterleavedBufferAttribute?t.vertexAttribDivisor(r,s.meshPerAttribute):s.isInterleavedBufferAttribute&&s.data.isInstancedInterleavedBuffer&&t.vertexAttribDivisor(r,s.data.meshPerAttribute)}return t.bindBuffer(t.ARRAY_BUFFER,null),n}_getTransformFeedback(e){let t="";for(let s=0;s<e.length;s++)t+=":"+e[s].id;let n=this.transformFeedbackCache[t];if(n!==void 0)return n;let{gl:r}=this;n=r.createTransformFeedback(),r.bindTransformFeedback(r.TRANSFORM_FEEDBACK,n);for(let s=0;s<e.length;s++){let o=e[s];r.bindBufferBase(r.TRANSFORM_FEEDBACK_BUFFER,s,o.transformBuffer)}return r.bindTransformFeedback(r.TRANSFORM_FEEDBACK,null),this.transformFeedbackCache[t]=n,n}_setupBindings(e,t){let n=this.gl,r=0,s=0;for(let o of e)for(let a of o.bindings)if(a.isUniformsGroup||a.isUniformBuffer){let l=r++,c=n.getUniformBlockIndex(t,a.name);n.uniformBlockBinding(t,c,l)}else if(a.isSampledTexture){let l=s++,c=n.getUniformLocation(t,a.name);n.uniform1i(c,l)}}_bindUniforms(e){let{gl:t,state:n}=this,r=0,s=0;for(let o of e)for(let a of o.bindings){let l=this.get(a);if(a.isUniformsGroup||a.isUniformBuffer){let c=r++;n.bindBufferBase(t.UNIFORM_BUFFER,c,l.bufferGPU)}else if(a.isSampledTexture){let c=s++;n.bindTexture(l.glTextureType,l.textureGPU,t.TEXTURE0+c)}}}_resolveRenderTarget(e){let{gl:t,state:n}=this,r=e.renderTarget;if(e.textures!==null&&r){let s=this.get(r);if(r.samples>0&&this._useMultisampledExtension(r)===!1){let o=s.framebuffers[e.getCacheKey()],a=t.COLOR_BUFFER_BIT;r.resolveDepthBuffer&&(r.depthBuffer&&(a|=t.DEPTH_BUFFER_BIT),r.stencilBuffer&&r.resolveStencilBuffer&&(a|=t.STENCIL_BUFFER_BIT));let l=s.msaaFrameBuffer,c=s.msaaRenderbuffers,u=e.textures,f=u.length>1;if(n.bindFramebuffer(t.READ_FRAMEBUFFER,l),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,o),f)for(let d=0;d<u.length;d++)t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0+d,t.RENDERBUFFER,null),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+d,t.TEXTURE_2D,null,0);for(let d=0;d<u.length;d++){if(f){let{textureGPU:A}=this.get(u[d]);t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,c[d]),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,A,0)}if(e.scissor){let{x:A,y,width:w,height:S}=e.scissorValue,T=e.height-S-y;t.blitFramebuffer(A,T,A+w,T+S,A,T,A+w,T+S,a,t.NEAREST)}else t.blitFramebuffer(0,0,e.width,e.height,0,0,e.width,e.height,a,t.NEAREST)}if(f)for(let d=0;d<u.length;d++){let{textureGPU:A}=this.get(u[d]);t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0+d,t.RENDERBUFFER,c[d]),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+d,t.TEXTURE_2D,A,0)}this._supportsInvalidateFramebuffer===!0&&t.invalidateFramebuffer(t.READ_FRAMEBUFFER,s.invalidationArray)}else if(r.resolveDepthBuffer===!1&&s.framebuffers){let o=s.framebuffers[e.getCacheKey()];n.bindFramebuffer(t.DRAW_FRAMEBUFFER,o),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,s.depthInvalidationArray)}}}_useMultisampledExtension(e){return e.multiview===!0?!0:e.samples>0&&this.extensions.has("WEBGL_multisampled_render_to_texture")===!0&&e._autoAllocateDepthBuffer!==!1}dispose(){this.textureUtils!==null&&this.textureUtils.dispose();let e=this.extensions.get("WEBGL_lose_context");e&&e.loseContext(),this.renderer.domElement.removeEventListener("webglcontextlost",this._onContextLost)}},eS={PointList:"point-list",LineList:"line-list",LineStrip:"line-strip",TriangleList:"triangle-list"},wf=typeof self<"u"&&self.GPUShaderStage?self.GPUShaderStage:{VERTEX:1,FRAGMENT:2,COMPUTE:4},Wo={Never:"never",Less:"less",Equal:"equal",LessEqual:"less-equal",Greater:"greater",NotEqual:"not-equal",GreaterEqual:"greater-equal",Always:"always"},Ya={Store:"store"},Fi={Load:"load",Clear:"clear"},Ote={CCW:"ccw",CW:"cw"},Ute={None:"none",Back:"back"},iI={Uint16:"uint16",Uint32:"uint32"},fe={R8Unorm:"r8unorm",R8Snorm:"r8snorm",R8Uint:"r8uint",R8Sint:"r8sint",R16Uint:"r16uint",R16Sint:"r16sint",R16Float:"r16float",RG8Unorm:"rg8unorm",RG8Snorm:"rg8snorm",RG8Uint:"rg8uint",RG8Sint:"rg8sint",R16Unorm:"r16unorm",R16Snorm:"r16snorm",R32Uint:"r32uint",R32Sint:"r32sint",R32Float:"r32float",RG16Uint:"rg16uint",RG16Sint:"rg16sint",RG16Float:"rg16float",RGBA8Unorm:"rgba8unorm",RGBA8UnormSRGB:"rgba8unorm-srgb",RGBA8Snorm:"rgba8snorm",RGBA8Uint:"rgba8uint",RGBA8Sint:"rgba8sint",BGRA8Unorm:"bgra8unorm",BGRA8UnormSRGB:"bgra8unorm-srgb",RG16Unorm:"rg16unorm",RG16Snorm:"rg16snorm",RGB9E5UFloat:"rgb9e5ufloat",RGB10A2Unorm:"rgb10a2unorm",RG11B10UFloat:"rg11b10ufloat",RG32Uint:"rg32uint",RG32Sint:"rg32sint",RG32Float:"rg32float",RGBA16Uint:"rgba16uint",RGBA16Sint:"rgba16sint",RGBA16Float:"rgba16float",RGBA16Unorm:"rgba16unorm",RGBA16Snorm:"rgba16snorm",RGBA32Uint:"rgba32uint",RGBA32Sint:"rgba32sint",RGBA32Float:"rgba32float",Depth16Unorm:"depth16unorm",Depth24Plus:"depth24plus",Depth24PlusStencil8:"depth24plus-stencil8",Depth32Float:"depth32float",Depth32FloatStencil8:"depth32float-stencil8",BC1RGBAUnorm:"bc1-rgba-unorm",BC1RGBAUnormSRGB:"bc1-rgba-unorm-srgb",BC2RGBAUnorm:"bc2-rgba-unorm",BC2RGBAUnormSRGB:"bc2-rgba-unorm-srgb",BC3RGBAUnorm:"bc3-rgba-unorm",BC3RGBAUnormSRGB:"bc3-rgba-unorm-srgb",BC4RUnorm:"bc4-r-unorm",BC4RSnorm:"bc4-r-snorm",BC5RGUnorm:"bc5-rg-unorm",BC5RGSnorm:"bc5-rg-snorm",BC6HRGBUFloat:"bc6h-rgb-ufloat",BC6HRGBFloat:"bc6h-rgb-float",BC7RGBAUnorm:"bc7-rgba-unorm",BC7RGBAUnormSRGB:"bc7-rgba-unorm-srgb",ETC2RGB8Unorm:"etc2-rgb8unorm",ETC2RGB8UnormSRGB:"etc2-rgb8unorm-srgb",ETC2RGB8A1Unorm:"etc2-rgb8a1unorm",ETC2RGB8A1UnormSRGB:"etc2-rgb8a1unorm-srgb",ETC2RGBA8Unorm:"etc2-rgba8unorm",ETC2RGBA8UnormSRGB:"etc2-rgba8unorm-srgb",EACR11Unorm:"eac-r11unorm",EACR11Snorm:"eac-r11snorm",EACRG11Unorm:"eac-rg11unorm",EACRG11Snorm:"eac-rg11snorm",ASTC4x4Unorm:"astc-4x4-unorm",ASTC4x4UnormSRGB:"astc-4x4-unorm-srgb",ASTC5x4Unorm:"astc-5x4-unorm",ASTC5x4UnormSRGB:"astc-5x4-unorm-srgb",ASTC5x5Unorm:"astc-5x5-unorm",ASTC5x5UnormSRGB:"astc-5x5-unorm-srgb",ASTC6x5Unorm:"astc-6x5-unorm",ASTC6x5UnormSRGB:"astc-6x5-unorm-srgb",ASTC6x6Unorm:"astc-6x6-unorm",ASTC6x6UnormSRGB:"astc-6x6-unorm-srgb",ASTC8x5Unorm:"astc-8x5-unorm",ASTC8x5UnormSRGB:"astc-8x5-unorm-srgb",ASTC8x6Unorm:"astc-8x6-unorm",ASTC8x6UnormSRGB:"astc-8x6-unorm-srgb",ASTC8x8Unorm:"astc-8x8-unorm",ASTC8x8UnormSRGB:"astc-8x8-unorm-srgb",ASTC10x5Unorm:"astc-10x5-unorm",ASTC10x5UnormSRGB:"astc-10x5-unorm-srgb",ASTC10x6Unorm:"astc-10x6-unorm",ASTC10x6UnormSRGB:"astc-10x6-unorm-srgb",ASTC10x8Unorm:"astc-10x8-unorm",ASTC10x8UnormSRGB:"astc-10x8-unorm-srgb",ASTC10x10Unorm:"astc-10x10-unorm",ASTC10x10UnormSRGB:"astc-10x10-unorm-srgb",ASTC12x10Unorm:"astc-12x10-unorm",ASTC12x10UnormSRGB:"astc-12x10-unorm-srgb",ASTC12x12Unorm:"astc-12x12-unorm",ASTC12x12UnormSRGB:"astc-12x12-unorm-srgb"},tU={ClampToEdge:"clamp-to-edge",Repeat:"repeat",MirrorRepeat:"mirror-repeat"},Jc={Linear:"linear",Nearest:"nearest"},ui={Zero:"zero",One:"one",Src:"src",OneMinusSrc:"one-minus-src",SrcAlpha:"src-alpha",OneMinusSrcAlpha:"one-minus-src-alpha",Dst:"dst",OneMinusDst:"one-minus-dst",DstAlpha:"dst-alpha",OneMinusDstAlpha:"one-minus-dst-alpha",SrcAlphaSaturated:"src-alpha-saturated",Constant:"constant",OneMinusConstant:"one-minus-constant"},Ug={Add:"add",Subtract:"subtract",ReverseSubtract:"reverse-subtract",Min:"min",Max:"max"},kte={None:0,All:15},im={Keep:"keep",Zero:"zero",Replace:"replace",Invert:"invert",IncrementClamp:"increment-clamp",DecrementClamp:"decrement-clamp",IncrementWrap:"increment-wrap",DecrementWrap:"decrement-wrap"},nU={Storage:"storage",ReadOnlyStorage:"read-only-storage"},iU={WriteOnly:"write-only",ReadOnly:"read-only",ReadWrite:"read-write"},zte={NonFiltering:"non-filtering",Comparison:"comparison"},kg={Float:"float",UnfilterableFloat:"unfilterable-float",Depth:"depth",SInt:"sint",UInt:"uint"},Vte={TwoD:"2d",ThreeD:"3d"},jo={TwoD:"2d",TwoDArray:"2d-array",Cube:"cube",ThreeD:"3d"},hPe={All:"all"},OR={Vertex:"vertex",Instance:"instance"},rI={CoreFeaturesAndLimits:"core-features-and-limits",DepthClipControl:"depth-clip-control",Depth32FloatStencil8:"depth32float-stencil8",TextureCompressionBC:"texture-compression-bc",TextureCompressionBCSliced3D:"texture-compression-bc-sliced-3d",TextureCompressionETC2:"texture-compression-etc2",TextureCompressionASTC:"texture-compression-astc",TextureCompressionASTCSliced3D:"texture-compression-astc-sliced-3d",TimestampQuery:"timestamp-query",IndirectFirstInstance:"indirect-first-instance",ShaderF16:"shader-f16",RG11B10UFloat:"rg11b10ufloat-renderable",BGRA8UNormStorage:"bgra8unorm-storage",Float32Filterable:"float32-filterable",Float32Blendable:"float32-blendable",ClipDistances:"clip-distances",DualSourceBlending:"dual-source-blending",Subgroups:"subgroups",TextureFormatsTier1:"texture-formats-tier1",TextureFormatsTier2:"texture-formats-tier2"},Gte={"texture-compression-s3tc":"texture-compression-bc","texture-compression-etc1":"texture-compression-etc2"},_9=class extends Q4{constructor(e,t,n){super(e,t?t.value:null),this.textureNode=t,this.groupNode=n}update(){let{textureNode:e}=this;return this.texture!==e.value?(this.texture=e.value,!0):super.update()}},x9=class extends $4{constructor(e,t){super(e,t?t.array:null),this._attribute=t,this.isStorageBuffer=!0}get attribute(){return this._attribute}},fPe=0,y9=class extends x9{constructor(e,t){super("StorageBuffer_"+fPe++,e?e.value:null),this.nodeUniform=e,this.access=e?e.access:$o.READ_WRITE,this.groupNode=t}get attribute(){return this.nodeUniform.value}get buffer(){return this.nodeUniform.value.array}},rU=[null],b9=class{constructor(e){this.backend=e,this._preferredCanvasFormat=null}getCurrentDepthStencilFormat(e){let t;return e.depth&&(e.depthTexture!==null?t=this.getTextureFormatGPU(e.depthTexture):e.stencil?this.backend.renderer.reversedDepthBuffer===!0?t=fe.Depth32FloatStencil8:t=fe.Depth24PlusStencil8:this.backend.renderer.reversedDepthBuffer===!0?t=fe.Depth32Float:t=fe.Depth24Plus),t}getTextureFormatGPU(e){return this.backend.get(e).format}getTextureSampleData(e){let t;if(e.isFramebufferTexture)t=1;else if(e.isDepthTexture&&!e.renderTarget){let s=this.backend.renderer,o=s.getRenderTarget();t=o?o.samples:s.currentSamples}else e.renderTarget&&(t=e.renderTarget.samples);t=this.getSampleCount(t||1);let n=t>1&&e.renderTarget!==null&&e.isDepthTexture!==!0&&e.isFramebufferTexture!==!0;return{samples:t,primarySamples:n?1:t,isMSAA:n}}getCurrentColorFormat(e){let t;return e.textures!==null?t=this.getTextureFormatGPU(e.textures[0]):t=this.getPreferredCanvasFormat(),t}getCurrentColorFormats(e){return e.textures!==null?e.textures.map(t=>this.getTextureFormatGPU(t)):[this.getPreferredCanvasFormat()]}getCurrentColorSpace(e){return e.textures!==null?e.textures[0].colorSpace:this.backend.renderer.outputColorSpace}getPrimitiveTopology(e,t){if(e.isPoints)return eS.PointList;if(e.isLineSegments||e.isMesh&&t.wireframe===!0)return eS.LineList;if(e.isLine)return eS.LineStrip;if(e.isMesh)return eS.TriangleList}getSampleCount(e){return e>=4?4:1}getSampleCountRenderContext(e){return e.textures!==null?this.getSampleCount(e.sampleCount):this.getSampleCount(this.backend.renderer.currentSamples)}getPreferredCanvasFormat(){let t=this.backend.parameters.outputType;if(t===void 0)return this._preferredCanvasFormat===null&&(this._preferredCanvasFormat=navigator.gpu.getPreferredCanvasFormat()),this._preferredCanvasFormat;if(t===Ji)return fe.BGRA8Unorm;if(t===Wi)return fe.RGBA16Float;throw new Error("THREE.WebGPUUtils: Unsupported output buffer type.")}};function gf(i,e){rU[0]=e,i.queue.submit(rU),rU[0]=null}var sI=class{constructor(){this.label="",this.layout=null,this.entries=[]}reset(){this.label="",this.layout=null,this.entries.length=0}},ym=class{constructor(){this.label="",this.size=0,this.usage=0,this.mappedAtCreation=!1}reset(){this.label="",this.size=0,this.usage=0,this.mappedAtCreation=!1}},l1=class{constructor(){this.label=""}reset(){this.label=""}},oI=class{constructor(){this.label="",this.colorFormats=null,this.depthStencilFormat=void 0,this.sampleCount=1,this.depthReadOnly=!1,this.stencilReadOnly=!1}reset(){this.label="",this.colorFormats=null,this.depthStencilFormat=void 0,this.sampleCount=1,this.depthReadOnly=!1,this.stencilReadOnly=!1}},Qg=class{constructor(){this.view=null,this.depthSlice=void 0,this.resolveTarget=void 0,this.clearValue=void 0,this.loadOp=void 0,this.storeOp=void 0}reset(){this.view=null,this.depthSlice=void 0,this.resolveTarget=void 0,this.clearValue=void 0,this.loadOp=void 0,this.storeOp=void 0}},Jg=class{constructor(){this.label="",this.colorAttachments=[],this.depthStencilAttachment=void 0,this.occlusionQuerySet=void 0,this.timestampWrites=void 0,this.maxDrawCount=5e7}reset(){this.label="",this.colorAttachments.length=0,this.depthStencilAttachment=void 0,this.occlusionQuerySet=void 0,this.timestampWrites=void 0,this.maxDrawCount=5e7}},aI=class{constructor(){this.label="",this.layout=null,this.vertex=null,this.primitive={},this.depthStencil=void 0,this.multisample=new w9,this.fragment=null}reset(){this.label="",this.layout=null,this.vertex=null,this.primitive={},this.depthStencil=void 0,this.multisample.reset(),this.fragment=null}},w9=class{constructor(){this.count=1,this.mask=4294967295,this.alphaToCoverageEnabled=!1}reset(){this.count=1,this.mask=4294967295,this.alphaToCoverageEnabled=!1}},lI=class{constructor(){this.label="",this.code="",this.compilationHints=[]}reset(){this.label="",this.code="",this.compilationHints.length=0}},RS=class{constructor(){this.label="",this.size={width:0,height:1,depthOrArrayLayers:1},this.mipLevelCount=1,this.sampleCount=1,this.dimension="2d",this.format=void 0,this.usage=void 0,this.viewFormats=[],this.textureBindingViewDimension=void 0}reset(){this.label="",this.size.width=0,this.size.height=1,this.size.depthOrArrayLayers=1,this.mipLevelCount=1,this.sampleCount=1,this.dimension="2d",this.format=void 0,this.usage=void 0,this.viewFormats.length=0,this.textureBindingViewDimension=void 0}},IS=class{constructor(){this.label="",this.format=void 0,this.dimension=void 0,this.usage=0,this.aspect="all",this.baseMipLevel=0,this.mipLevelCount=void 0,this.baseArrayLayer=0,this.arrayLayerCount=void 0,this.swizzle="rgba"}reset(){this.label="",this.format=void 0,this.dimension=void 0,this.usage=0,this.aspect="all",this.baseMipLevel=0,this.mipLevelCount=void 0,this.baseArrayLayer=0,this.arrayLayerCount=void 0,this.swizzle="rgba"}},rm=new sI,sm=new ym,UR=new l1,sU=new oI,oU=new Jg,$_=new aI,Xw=new Qg,kR=new lI,Y_=new RS,vs=new IS,S9=class extends Mf{constructor(e){super(),this.device=e;let t=`4370+void main() {}`};this.createProgram(s);let{computeProgram:o}=e,a=r.createProgram(),l=this.get(s).shaderGPU,c=this.get(o).shaderGPU,u=o.transforms,f=[],d=[];for(let S=0;S<u.length;S++){let T=u[S];f.push(T.varyingName),d.push(T.attributeNode)}r.attachShader(a,l),r.attachShader(a,c),r.transformFeedbackVaryings(a,f,r.SEPARATE_ATTRIBS),r.linkProgram(a),r.getProgramParameter(a,r.LINK_STATUS)===!1&&this._logProgramError(a,l,c),n.useProgram(a),this._setupBindings(t,a);let A=o.attributes,y=[],w=[];for(let S=0;S<A.length;S++){let T=A[S].node.attribute;y.push(T),this.has(T)||this.attributeUtils.createAttribute(T,r.ARRAY_BUFFER)}for(let S=0;S<d.length;S++){let T=d[S].attribute;this.has(T)||this.attributeUtils.createAttribute(T,r.ARRAY_BUFFER);let R=this.get(T);w.push(R)}this.set(e,{programGPU:a,transformBuffers:w,attributes:y})}createBindings(e,t){if(this._knownBindings.has(t)===!1){this._knownBindings.add(t);let n=0,r=0;for(let s of t){this.set(s,{textures:r,uniformBuffers:n});for(let o of s.bindings)o.isUniformBuffer&&n++,o.isSampledTexture&&r++}}this.updateBindings(e,t)}updateBindings(e){let{gl:t}=this;for(let n of e.bindings){let r=this.get(n);if(n.isUniformsGroup||n.isUniformBuffer){let s=n.buffer,o=r.bufferGPU;t.bindBuffer(t.UNIFORM_BUFFER,o);let a=n.updateRanges;if(t.bindBuffer(t.UNIFORM_BUFFER,o),a.length===0)t.bufferData(t.UNIFORM_BUFFER,s,t.DYNAMIC_DRAW);else{let l=p_(s),c=l?1:s.BYTES_PER_ELEMENT;for(let u=0,f=a.length;u<f;u++){let d=a[u],A=d.start*c,y=d.count*c,w=A*(l?s.BYTES_PER_ELEMENT:1);t.bufferSubData(t.UNIFORM_BUFFER,w,s,A,y)}}this.set(n,r)}else if(n.isSampledTexture){let{textureGPU:s,glTextureType:o}=this.get(n.texture);r.textureGPU=s,r.glTextureType=o,this.set(n,r)}}}updateBinding(e){let t=this.gl;if(e.isUniformsGroup||e.isUniformBuffer){let r=this.get(e).bufferGPU,s=e.buffer,o=e.updateRanges;if(t.bindBuffer(t.UNIFORM_BUFFER,r),o.length===0)t.bufferData(t.UNIFORM_BUFFER,s,t.DYNAMIC_DRAW);else{let a=p_(s),l=a?1:s.BYTES_PER_ELEMENT,c=o[0].start;for(let u=0,f=o.length;u<f;u++){let d=o[u],A=o[u+1],y=d.start+d.count;if(A!==void 0&&A.start===y)continue;let w=c*l,S=(y-c)*l,T=w*(a?s.BYTES_PER_ELEMENT:1);t.bufferSubData(t.UNIFORM_BUFFER,T,s,w,S),A!==void 0&&(c=A.start)}}}}createUniformBuffer(e){let t=this.get(e);if(t.bufferGPU===void 0){let n=this.gl,r=e.buffer;t.bufferGPU=n.createBuffer(),n.bindBuffer(n.UNIFORM_BUFFER,t.bufferGPU),n.bufferData(n.UNIFORM_BUFFER,r.byteLength,n.DYNAMIC_DRAW)}}destroyUniformBuffer(e){let t=this.get(e);this.gl.deleteBuffer(t.bufferGPU),this.delete(e)}createIndexAttribute(e){let t=this.gl;this.attributeUtils.createAttribute(e,t.ELEMENT_ARRAY_BUFFER)}createAttribute(e){if(this.has(e))return;let t=this.gl;this.attributeUtils.createAttribute(e,t.ARRAY_BUFFER)}createStorageAttribute(e){if(this.has(e))return;let t=this.gl;this.attributeUtils.createAttribute(e,t.ARRAY_BUFFER)}updateAttribute(e){this.attributeUtils.updateAttribute(e)}destroyAttribute(e){this.attributeUtils.destroyAttribute(e)}hasFeature(e){let t=Object.keys(Wte).filter(r=>Wte[r]===e),n=this.extensions;for(let r=0;r<t.length;r++)if(n.has(t[r]))return!0;return!1}copyTextureToTexture(e,t,n=null,r=null,s=0,o=0){this.textureUtils.copyTextureToTexture(e,t,n,r,s,o)}copyFramebufferToTexture(e,t,n){this.textureUtils.copyFramebufferToTexture(e,t,n)}hasCompatibility(e){return e===Od.TEXTURE_COMPARE?!0:super.hasCompatibility(e)}initRenderTarget(e){let{gl:t,state:n}=this;this._setFramebuffer(e),n.bindFramebuffer(t.FRAMEBUFFER,null)}_setFramebuffer(e){let{gl:t,state:n}=this,r=null;if(e.textures!==null){let s=e.renderTarget,o=this.get(s),{samples:a,depthBuffer:l,stencilBuffer:c}=s,u=s.isCubeRenderTarget===!0,f=s.isRenderTarget3D===!0,d=s.depth>1,A=s.isXRRenderTarget===!0,y=A===!0&&s._hasExternalTextures===!0,w=o.msaaFrameBuffer,S=o.depthRenderbuffer,T=this.extensions.get("WEBGL_multisampled_render_to_texture"),R=this.extensions.get("OVR_multiview2"),P=this._useMultisampledExtension(s),I=xse(e),F;if(u?(o.cubeFramebuffers||(o.cubeFramebuffers={}),F=o.cubeFramebuffers[I]):A&&y===!1?F=this._xrFramebuffer:(o.framebuffers||(o.framebuffers={}),F=o.framebuffers[I]),F===void 0){F=t.createFramebuffer(),n.bindFramebuffer(t.FRAMEBUFFER,F);let D=e.textures,L=[];if(u){o.cubeFramebuffers[I]=F;let{textureGPU:B}=this.get(D[0]),k=this.renderer._activeCubeFace,z=this.renderer._activeMipmapLevel;t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+k,B,z)}else{o.framebuffers[I]=F;for(let B=0;B<D.length;B++){let k=D[B],z=this.get(k);z.renderTarget=e.renderTarget,z.cacheKey=I;let G=t.COLOR_ATTACHMENT0+B;if(s.multiview)R.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,G,z.textureGPU,0,a,0,2);else if(f||d){let W=this.renderer._activeCubeFace,Y=this.renderer._activeMipmapLevel;t.framebufferTextureLayer(t.FRAMEBUFFER,G,z.textureGPU,Y,W)}else if(P)T.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,G,t.TEXTURE_2D,z.textureGPU,0,a);else{let W=this.renderer._activeMipmapLevel;t.framebufferTexture2D(t.FRAMEBUFFER,G,t.TEXTURE_2D,z.textureGPU,W)}}}let C=c?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;if(s._autoAllocateDepthBuffer===!0){let B=t.createRenderbuffer();this.textureUtils.setupRenderBufferStorage(B,e,0,P),o.xrDepthRenderbuffer=B,L.push(c?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT),t.bindRenderbuffer(t.RENDERBUFFER,B),t.framebufferRenderbuffer(t.FRAMEBUFFER,C,t.RENDERBUFFER,B)}else if(e.depthTexture!==null){L.push(c?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT);let B=this.get(e.depthTexture);if(B.renderTarget=e.renderTarget,B.cacheKey=I,s.multiview)R.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,C,B.textureGPU,0,a,0,2);else if(y&&P)T.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,C,t.TEXTURE_2D,B.textureGPU,0,a);else if(e.depthTexture.isArrayTexture){let k=this.renderer._activeCubeFace;t.framebufferTextureLayer(t.FRAMEBUFFER,C,B.textureGPU,0,k)}else if(e.depthTexture.isCubeTexture){let k=this.renderer._activeCubeFace;t.framebufferTexture2D(t.FRAMEBUFFER,C,t.TEXTURE_CUBE_MAP_POSITIVE_X+k,B.textureGPU,0)}else t.framebufferTexture2D(t.FRAMEBUFFER,C,t.TEXTURE_2D,B.textureGPU,0)}o.depthInvalidationArray=L}else{if(this._isRenderCameraDepthArray(e)){n.bindFramebuffer(t.FRAMEBUFFER,F);let L=this.renderer._activeCubeFace,C=this.get(e.depthTexture),B=c?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.framebufferTextureLayer(t.FRAMEBUFFER,B,C.textureGPU,0,L)}if((A||P||s.multiview)&&s._isOpaqueFramebuffer!==!0){n.bindFramebuffer(t.FRAMEBUFFER,F);let L=this.get(e.textures[0]);s.multiview?R.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,L.textureGPU,0,a,0,2):P?T.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,L.textureGPU,0,a):t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,L.textureGPU,0);let C=c?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;if(s._autoAllocateDepthBuffer===!0){let B=o.xrDepthRenderbuffer;t.bindRenderbuffer(t.RENDERBUFFER,B),t.framebufferRenderbuffer(t.FRAMEBUFFER,C,t.RENDERBUFFER,B)}else{let B=this.get(e.depthTexture);s.multiview?R.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,C,B.textureGPU,0,a,0,2):P?T.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,C,t.TEXTURE_2D,B.textureGPU,0,a):t.framebufferTexture2D(t.FRAMEBUFFER,C,t.TEXTURE_2D,B.textureGPU,0)}}}if(a>0&&P===!1&&!s.multiview){if(w===void 0){let D=[];w=t.createFramebuffer(),n.bindFramebuffer(t.FRAMEBUFFER,w);let L=[],C=e.textures;for(let B=0;B<C.length;B++){L[B]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,L[B]),D.push(t.COLOR_ATTACHMENT0+B);let k=e.textures[B],z=this.get(k);t.renderbufferStorageMultisample(t.RENDERBUFFER,a,z.glInternalFormat,e.width,e.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+B,t.RENDERBUFFER,L[B])}if(t.bindRenderbuffer(t.RENDERBUFFER,null),o.msaaFrameBuffer=w,o.msaaRenderbuffers=L,l&&S===void 0){S=t.createRenderbuffer(),this.textureUtils.setupRenderBufferStorage(S,e,a),o.depthRenderbuffer=S;let B=c?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;D.push(B)}o.invalidationArray=D}r=o.msaaFrameBuffer}else r=F;n.drawBuffers(e,F)}n.bindFramebuffer(t.FRAMEBUFFER,r)}_getVaoKey(e){let t="";for(let n=0;n<e.length;n++){let r=this.get(e[n]);t+=":"+r.id}return t}_createVao(e){let{gl:t}=this,n=t.createVertexArray();t.bindVertexArray(n);for(let r=0;r<e.length;r++){let s=e[r],o=this.get(s);t.bindBuffer(t.ARRAY_BUFFER,o.bufferGPU),t.enableVertexAttribArray(r);let a,l;s.isInterleavedBufferAttribute===!0?(a=s.data.stride*o.bytesPerElement,l=s.offset*o.bytesPerElement):(a=0,l=0),o.isInteger?t.vertexAttribIPointer(r,s.itemSize,o.type,a,l):t.vertexAttribPointer(r,s.itemSize,o.type,s.normalized,a,l),s.isInstancedBufferAttribute&&!s.isInterleavedBufferAttribute?t.vertexAttribDivisor(r,s.meshPerAttribute):s.isInterleavedBufferAttribute&&s.data.isInstancedInterleavedBuffer&&t.vertexAttribDivisor(r,s.data.meshPerAttribute)}return t.bindBuffer(t.ARRAY_BUFFER,null),n}_getTransformFeedback(e){let t="";for(let s=0;s<e.length;s++)t+=":"+e[s].id;let n=this.transformFeedbackCache[t];if(n!==void 0)return n;let{gl:r}=this;n=r.createTransformFeedback(),r.bindTransformFeedback(r.TRANSFORM_FEEDBACK,n);for(let s=0;s<e.length;s++){let o=e[s];r.bindBufferBase(r.TRANSFORM_FEEDBACK_BUFFER,s,o.transformBuffer)}return r.bindTransformFeedback(r.TRANSFORM_FEEDBACK,null),this.transformFeedbackCache[t]=n,n}_setupBindings(e,t){let n=this.gl,r=0,s=0;for(let o of e)for(let a of o.bindings)if(a.isUniformsGroup||a.isUniformBuffer){let l=r++,c=n.getUniformBlockIndex(t,a.name);n.uniformBlockBinding(t,c,l)}else if(a.isSampledTexture){let l=s++,c=n.getUniformLocation(t,a.name);n.uniform1i(c,l)}}_bindUniforms(e){let{gl:t,state:n}=this,r=0,s=0;for(let o of e)for(let a of o.bindings){let l=this.get(a);if(a.isUniformsGroup||a.isUniformBuffer){let c=r++;n.bindBufferBase(t.UNIFORM_BUFFER,c,l.bufferGPU)}else if(a.isSampledTexture){let c=s++;n.bindTexture(l.glTextureType,l.textureGPU,t.TEXTURE0+c)}}}_resolveRenderTarget(e){let{gl:t,state:n}=this,r=e.renderTarget;if(e.textures!==null&&r){let s=this.get(r);if(r.samples>0&&this._useMultisampledExtension(r)===!1){let o=s.framebuffers[e.getCacheKey()],a=t.COLOR_BUFFER_BIT;r.resolveDepthBuffer&&(r.depthBuffer&&(a|=t.DEPTH_BUFFER_BIT),r.stencilBuffer&&r.resolveStencilBuffer&&(a|=t.STENCIL_BUFFER_BIT));let l=s.msaaFrameBuffer,c=s.msaaRenderbuffers,u=e.textures,f=u.length>1;if(n.bindFramebuffer(t.READ_FRAMEBUFFER,l),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,o),f)for(let d=0;d<u.length;d++)t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0+d,t.RENDERBUFFER,null),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+d,t.TEXTURE_2D,null,0);for(let d=0;d<u.length;d++){if(f){let{textureGPU:A}=this.get(u[d]);t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,c[d]),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,A,0)}if(e.scissor){let{x:A,y,width:w,height:S}=e.scissorValue,T=e.height-S-y;t.blitFramebuffer(A,T,A+w,T+S,A,T,A+w,T+S,a,t.NEAREST)}else t.blitFramebuffer(0,0,e.width,e.height,0,0,e.width,e.height,a,t.NEAREST)}if(f)for(let d=0;d<u.length;d++){let{textureGPU:A}=this.get(u[d]);t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0+d,t.RENDERBUFFER,c[d]),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+d,t.TEXTURE_2D,A,0)}this._supportsInvalidateFramebuffer===!0&&t.invalidateFramebuffer(t.READ_FRAMEBUFFER,s.invalidationArray)}else if(r.resolveDepthBuffer===!1&&s.framebuffers){let o=s.framebuffers[e.getCacheKey()];n.bindFramebuffer(t.DRAW_FRAMEBUFFER,o),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,s.depthInvalidationArray)}}}_useMultisampledExtension(e){return e.multiview===!0?!0:e.samples>0&&this.extensions.has("WEBGL_multisampled_render_to_texture")===!0&&e._autoAllocateDepthBuffer!==!1}dispose(){this.textureUtils!==null&&this.textureUtils.dispose();let e=this.extensions.get("WEBGL_lose_context");e&&e.loseContext(),this.renderer.domElement.removeEventListener("webglcontextlost",this._onContextLost)}},rS={PointList:"point-list",LineList:"line-list",LineStrip:"line-strip",TriangleList:"triangle-list"},Sf=typeof self<"u"&&self.GPUShaderStage?self.GPUShaderStage:{VERTEX:1,FRAGMENT:2,COMPUTE:4},Wo={Never:"never",Less:"less",Equal:"equal",LessEqual:"less-equal",Greater:"greater",NotEqual:"not-equal",GreaterEqual:"greater-equal",Always:"always"},Za={Store:"store"},Fi={Load:"load",Clear:"clear"},jte={CCW:"ccw",CW:"cw"},Xte={None:"none",Back:"back"},aI={Uint16:"uint16",Uint32:"uint32"},fe={R8Unorm:"r8unorm",R8Snorm:"r8snorm",R8Uint:"r8uint",R8Sint:"r8sint",R16Uint:"r16uint",R16Sint:"r16sint",R16Float:"r16float",RG8Unorm:"rg8unorm",RG8Snorm:"rg8snorm",RG8Uint:"rg8uint",RG8Sint:"rg8sint",R16Unorm:"r16unorm",R16Snorm:"r16snorm",R32Uint:"r32uint",R32Sint:"r32sint",R32Float:"r32float",RG16Uint:"rg16uint",RG16Sint:"rg16sint",RG16Float:"rg16float",RGBA8Unorm:"rgba8unorm",RGBA8UnormSRGB:"rgba8unorm-srgb",RGBA8Snorm:"rgba8snorm",RGBA8Uint:"rgba8uint",RGBA8Sint:"rgba8sint",BGRA8Unorm:"bgra8unorm",BGRA8UnormSRGB:"bgra8unorm-srgb",RG16Unorm:"rg16unorm",RG16Snorm:"rg16snorm",RGB9E5UFloat:"rgb9e5ufloat",RGB10A2Unorm:"rgb10a2unorm",RG11B10UFloat:"rg11b10ufloat",RG32Uint:"rg32uint",RG32Sint:"rg32sint",RG32Float:"rg32float",RGBA16Uint:"rgba16uint",RGBA16Sint:"rgba16sint",RGBA16Float:"rgba16float",RGBA16Unorm:"rgba16unorm",RGBA16Snorm:"rgba16snorm",RGBA32Uint:"rgba32uint",RGBA32Sint:"rgba32sint",RGBA32Float:"rgba32float",Depth16Unorm:"depth16unorm",Depth24Plus:"depth24plus",Depth24PlusStencil8:"depth24plus-stencil8",Depth32Float:"depth32float",Depth32FloatStencil8:"depth32float-stencil8",BC1RGBAUnorm:"bc1-rgba-unorm",BC1RGBAUnormSRGB:"bc1-rgba-unorm-srgb",BC2RGBAUnorm:"bc2-rgba-unorm",BC2RGBAUnormSRGB:"bc2-rgba-unorm-srgb",BC3RGBAUnorm:"bc3-rgba-unorm",BC3RGBAUnormSRGB:"bc3-rgba-unorm-srgb",BC4RUnorm:"bc4-r-unorm",BC4RSnorm:"bc4-r-snorm",BC5RGUnorm:"bc5-rg-unorm",BC5RGSnorm:"bc5-rg-snorm",BC6HRGBUFloat:"bc6h-rgb-ufloat",BC6HRGBFloat:"bc6h-rgb-float",BC7RGBAUnorm:"bc7-rgba-unorm",BC7RGBAUnormSRGB:"bc7-rgba-unorm-srgb",ETC2RGB8Unorm:"etc2-rgb8unorm",ETC2RGB8UnormSRGB:"etc2-rgb8unorm-srgb",ETC2RGB8A1Unorm:"etc2-rgb8a1unorm",ETC2RGB8A1UnormSRGB:"etc2-rgb8a1unorm-srgb",ETC2RGBA8Unorm:"etc2-rgba8unorm",ETC2RGBA8UnormSRGB:"etc2-rgba8unorm-srgb",EACR11Unorm:"eac-r11unorm",EACR11Snorm:"eac-r11snorm",EACRG11Unorm:"eac-rg11unorm",EACRG11Snorm:"eac-rg11snorm",ASTC4x4Unorm:"astc-4x4-unorm",ASTC4x4UnormSRGB:"astc-4x4-unorm-srgb",ASTC5x4Unorm:"astc-5x4-unorm",ASTC5x4UnormSRGB:"astc-5x4-unorm-srgb",ASTC5x5Unorm:"astc-5x5-unorm",ASTC5x5UnormSRGB:"astc-5x5-unorm-srgb",ASTC6x5Unorm:"astc-6x5-unorm",ASTC6x5UnormSRGB:"astc-6x5-unorm-srgb",ASTC6x6Unorm:"astc-6x6-unorm",ASTC6x6UnormSRGB:"astc-6x6-unorm-srgb",ASTC8x5Unorm:"astc-8x5-unorm",ASTC8x5UnormSRGB:"astc-8x5-unorm-srgb",ASTC8x6Unorm:"astc-8x6-unorm",ASTC8x6UnormSRGB:"astc-8x6-unorm-srgb",ASTC8x8Unorm:"astc-8x8-unorm",ASTC8x8UnormSRGB:"astc-8x8-unorm-srgb",ASTC10x5Unorm:"astc-10x5-unorm",ASTC10x5UnormSRGB:"astc-10x5-unorm-srgb",ASTC10x6Unorm:"astc-10x6-unorm",ASTC10x6UnormSRGB:"astc-10x6-unorm-srgb",ASTC10x8Unorm:"astc-10x8-unorm",ASTC10x8UnormSRGB:"astc-10x8-unorm-srgb",ASTC10x10Unorm:"astc-10x10-unorm",ASTC10x10UnormSRGB:"astc-10x10-unorm-srgb",ASTC12x10Unorm:"astc-12x10-unorm",ASTC12x10UnormSRGB:"astc-12x10-unorm-srgb",ASTC12x12Unorm:"astc-12x12-unorm",ASTC12x12UnormSRGB:"astc-12x12-unorm-srgb"},cU={ClampToEdge:"clamp-to-edge",Repeat:"repeat",MirrorRepeat:"mirror-repeat"},eu={Linear:"linear",Nearest:"nearest"},ui={Zero:"zero",One:"one",Src:"src",OneMinusSrc:"one-minus-src",SrcAlpha:"src-alpha",OneMinusSrcAlpha:"one-minus-src-alpha",Dst:"dst",OneMinusDst:"one-minus-dst",DstAlpha:"dst-alpha",OneMinusDstAlpha:"one-minus-dst-alpha",SrcAlphaSaturated:"src-alpha-saturated",Constant:"constant",OneMinusConstant:"one-minus-constant"},Ug={Add:"add",Subtract:"subtract",ReverseSubtract:"reverse-subtract",Min:"min",Max:"max"},$te={None:0,All:15},im={Keep:"keep",Zero:"zero",Replace:"replace",Invert:"invert",IncrementClamp:"increment-clamp",DecrementClamp:"decrement-clamp",IncrementWrap:"increment-wrap",DecrementWrap:"decrement-wrap"},uU={Storage:"storage",ReadOnlyStorage:"read-only-storage"},hU={WriteOnly:"write-only",ReadOnly:"read-only",ReadWrite:"read-write"},Yte={NonFiltering:"non-filtering",Comparison:"comparison"},kg={Float:"float",UnfilterableFloat:"unfilterable-float",Depth:"depth",SInt:"sint",UInt:"uint"},Zte={TwoD:"2d",ThreeD:"3d"},jo={TwoD:"2d",TwoDArray:"2d-array",Cube:"cube",ThreeD:"3d"},PPe={All:"all"},VR={Vertex:"vertex",Instance:"instance"},lI={CoreFeaturesAndLimits:"core-features-and-limits",DepthClipControl:"depth-clip-control",Depth32FloatStencil8:"depth32float-stencil8",TextureCompressionBC:"texture-compression-bc",TextureCompressionBCSliced3D:"texture-compression-bc-sliced-3d",TextureCompressionETC2:"texture-compression-etc2",TextureCompressionASTC:"texture-compression-astc",TextureCompressionASTCSliced3D:"texture-compression-astc-sliced-3d",TimestampQuery:"timestamp-query",IndirectFirstInstance:"indirect-first-instance",ShaderF16:"shader-f16",RG11B10UFloat:"rg11b10ufloat-renderable",BGRA8UNormStorage:"bgra8unorm-storage",Float32Filterable:"float32-filterable",Float32Blendable:"float32-blendable",ClipDistances:"clip-distances",DualSourceBlending:"dual-source-blending",Subgroups:"subgroups",TextureFormatsTier1:"texture-formats-tier1",TextureFormatsTier2:"texture-formats-tier2"},Kte={"texture-compression-s3tc":"texture-compression-bc","texture-compression-etc1":"texture-compression-etc2"},M9=class extends nI{constructor(e,t,n){super(e,t?t.value:null),this.textureNode=t,this.groupNode=n}update(){let{textureNode:e}=this;return this.texture!==e.value?(this.texture=e.value,!0):super.update()}},C9=class extends Q4{constructor(e,t){super(e,t?t.array:null),this._attribute=t,this.isStorageBuffer=!0}get attribute(){return this._attribute}},LPe=0,R9=class extends C9{constructor(e,t){super("StorageBuffer_"+LPe++,e?e.value:null),this.nodeUniform=e,this.access=e?e.access:$o.READ_WRITE,this.groupNode=t}get attribute(){return this.nodeUniform.value}get buffer(){return this.nodeUniform.value.array}},fU=[null],I9=class{constructor(e){this.backend=e,this._preferredCanvasFormat=null}getCurrentDepthStencilFormat(e){let t;return e.depth&&(e.depthTexture!==null?t=this.getTextureFormatGPU(e.depthTexture):e.stencil?this.backend.renderer.reversedDepthBuffer===!0?t=fe.Depth32FloatStencil8:t=fe.Depth24PlusStencil8:this.backend.renderer.reversedDepthBuffer===!0?t=fe.Depth32Float:t=fe.Depth24Plus),t}getTextureFormatGPU(e){return this.backend.get(e).format}getTextureSampleData(e){let t;if(e.isFramebufferTexture)t=1;else if(e.isDepthTexture&&!e.renderTarget){let s=this.backend.renderer,o=s.getRenderTarget();t=o?o.samples:s.currentSamples}else e.renderTarget&&(t=e.renderTarget.samples);t=this.getSampleCount(t||1);let n=t>1&&e.renderTarget!==null&&e.isDepthTexture!==!0&&e.isFramebufferTexture!==!0;return{samples:t,primarySamples:n?1:t,isMSAA:n}}getCurrentColorFormat(e){let t;return e.textures!==null?t=this.getTextureFormatGPU(e.textures[0]):t=this.getPreferredCanvasFormat(),t}getCurrentColorFormats(e){return e.textures!==null?e.textures.map(t=>this.getTextureFormatGPU(t)):[this.getPreferredCanvasFormat()]}getCurrentColorSpace(e){return e.textures!==null?e.textures[0].colorSpace:this.backend.renderer.outputColorSpace}getPrimitiveTopology(e,t){if(e.isPoints)return rS.PointList;if(e.isLineSegments||e.isMesh&&t.wireframe===!0)return rS.LineList;if(e.isLine)return rS.LineStrip;if(e.isMesh)return rS.TriangleList}getSampleCount(e){return e>=4?4:1}getSampleCountRenderContext(e){return e.textures!==null?this.getSampleCount(e.sampleCount):this.getSampleCount(this.backend.renderer.currentSamples)}getPreferredCanvasFormat(){let t=this.backend.parameters.outputType;if(t===void 0)return this._preferredCanvasFormat===null&&(this._preferredCanvasFormat=navigator.gpu.getPreferredCanvasFormat()),this._preferredCanvasFormat;if(t===Ji)return fe.BGRA8Unorm;if(t===Wi)return fe.RGBA16Float;throw new Error("THREE.WebGPUUtils: Unsupported output buffer type.")}};function vf(i,e){fU[0]=e,i.queue.submit(fU),fU[0]=null}var cI=class{constructor(){this.label="",this.layout=null,this.entries=[]}reset(){this.label="",this.layout=null,this.entries.length=0}},ym=class{constructor(){this.label="",this.size=0,this.usage=0,this.mappedAtCreation=!1}reset(){this.label="",this.size=0,this.usage=0,this.mappedAtCreation=!1}},l1=class{constructor(){this.label=""}reset(){this.label=""}},uI=class{constructor(){this.label="",this.colorFormats=null,this.depthStencilFormat=void 0,this.sampleCount=1,this.depthReadOnly=!1,this.stencilReadOnly=!1}reset(){this.label="",this.colorFormats=null,this.depthStencilFormat=void 0,this.sampleCount=1,this.depthReadOnly=!1,this.stencilReadOnly=!1}},Qg=class{constructor(){this.view=null,this.depthSlice=void 0,this.resolveTarget=void 0,this.clearValue=void 0,this.loadOp=void 0,this.storeOp=void 0}reset(){this.view=null,this.depthSlice=void 0,this.resolveTarget=void 0,this.clearValue=void 0,this.loadOp=void 0,this.storeOp=void 0}},Jg=class{constructor(){this.label="",this.colorAttachments=[],this.depthStencilAttachment=void 0,this.occlusionQuerySet=void 0,this.timestampWrites=void 0,this.maxDrawCount=5e7}reset(){this.label="",this.colorAttachments.length=0,this.depthStencilAttachment=void 0,this.occlusionQuerySet=void 0,this.timestampWrites=void 0,this.maxDrawCount=5e7}},hI=class{constructor(){this.label="",this.layout=null,this.vertex=null,this.primitive={},this.depthStencil=void 0,this.multisample=new P9,this.fragment=null}reset(){this.label="",this.layout=null,this.vertex=null,this.primitive={},this.depthStencil=void 0,this.multisample.reset(),this.fragment=null}},P9=class{constructor(){this.count=1,this.mask=4294967295,this.alphaToCoverageEnabled=!1}reset(){this.count=1,this.mask=4294967295,this.alphaToCoverageEnabled=!1}},fI=class{constructor(){this.label="",this.code="",this.compilationHints=[]}reset(){this.label="",this.code="",this.compilationHints.length=0}},DS=class{constructor(){this.label="",this.size={width:0,height:1,depthOrArrayLayers:1},this.mipLevelCount=1,this.sampleCount=1,this.dimension="2d",this.format=void 0,this.usage=void 0,this.viewFormats=[],this.textureBindingViewDimension=void 0}reset(){this.label="",this.size.width=0,this.size.height=1,this.size.depthOrArrayLayers=1,this.mipLevelCount=1,this.sampleCount=1,this.dimension="2d",this.format=void 0,this.usage=void 0,this.viewFormats.length=0,this.textureBindingViewDimension=void 0}},NS=class{constructor(){this.label="",this.format=void 0,this.dimension=void 0,this.usage=0,this.aspect="all",this.baseMipLevel=0,this.mipLevelCount=void 0,this.baseArrayLayer=0,this.arrayLayerCount=void 0,this.swizzle="rgba"}reset(){this.label="",this.format=void 0,this.dimension=void 0,this.usage=0,this.aspect="all",this.baseMipLevel=0,this.mipLevelCount=void 0,this.baseArrayLayer=0,this.arrayLayerCount=void 0,this.swizzle="rgba"}},rm=new cI,sm=new ym,GR=new l1,dU=new uI,pU=new Jg,Z_=new hI,Kw=new Qg,qR=new fI,K_=new DS,vs=new NS,L9=class extends Cf{constructor(e){super(),this.device=e;let t=`43714371 struct VarysStruct {43724372 @builtin( position ) Position: vec4f,43734373 @location( 0 ) vTex : vec2f,@@ -4441,7 +4441,7 @@ fn main_cube( Varys: VarysStruct ) -> @location( 0 ) vec4<f32> {
44414441 return textureSample( imgCube, imgSampler, faceMat[ Varys.vBaseArrayLayer ] * vec3f( fract( Varys.vTex ), 1 ) );44424442 44434443 }4444-`;this.mipmapSampler=e.createSampler({minFilter:Jc.Linear}),this.flipYSampler=e.createSampler({minFilter:Jc.Nearest}),sm.size=4,sm.usage=GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,this.flipUniformBuffer=e.createBuffer(sm),sm.reset(),e.queue.writeBuffer(this.flipUniformBuffer,0,new Uint32Array([1])),sm.size=4,sm.usage=GPUBufferUsage.UNIFORM,this.noFlipUniformBuffer=e.createBuffer(sm),sm.reset(),this.transferPipelines={},kR.label="mipmap",kR.code=t,this.mipmapShaderModule=e.createShaderModule(kR),kR.reset()}getTransferPipeline(e,t){t=t||"2d-array";let n=`${e}-${t}`,r=this.transferPipelines[n];return r===void 0&&($_.label=`mipmap-${e}-${t}`,$_.vertex={module:this.mipmapShaderModule},$_.fragment={module:this.mipmapShaderModule,entryPoint:`main_${t.replace("-","_")}`,targets:[{format:e}]},$_.layout="auto",r=this.device.createRenderPipeline($_),$_.reset(),this.transferPipelines[n]=r),r}flipY(e,t,n=0){let r=t.format,{width:s,height:o}=t.size;Y_.size.width=s,Y_.size.height=o,Y_.format=r,Y_.usage=GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING;let a=this.device.createTexture(Y_);Y_.reset();let l=this.getTransferPipeline(r,e.textureBindingViewDimension),c=this.getTransferPipeline(r,a.textureBindingViewDimension),u=this.device.createCommandEncoder(UR),f=(d,A,y,w,S,T)=>{let R=d.getBindGroupLayout(0);vs.dimension=A.textureBindingViewDimension||"2d-array",vs.mipLevelCount=1;let P=A.createView(vs);vs.reset(),rm.layout=R,rm.entries.push({binding:0,resource:this.flipYSampler},{binding:1,resource:P},{binding:2,resource:{buffer:T?this.flipUniformBuffer:this.noFlipUniformBuffer}});let I=this.device.createBindGroup(rm);rm.reset(),vs.dimension="2d",vs.mipLevelCount=1,vs.baseArrayLayer=S,vs.arrayLayerCount=1;let F=w.createView(vs);vs.reset(),Xw.view=F,Xw.loadOp=Fi.Clear,Xw.storeOp=Ya.Store,oU.colorAttachments.push(Xw);let D=u.beginRenderPass(oU);oU.reset(),Xw.reset(),D.setPipeline(d),D.setBindGroup(0,I),D.draw(3,1,0,y),D.end()};f(l,e,n,a,0,!1),f(c,a,0,e,n,!0),gf(this.device,u.finish()),a.destroy()}generateMipmaps(e,t=null){let n=this.get(e),r=n.layers||this._mipmapCreateBundles(e),s=t;s===null&&(UR.label="mipmapEncoder",s=this.device.createCommandEncoder(UR),UR.reset()),this._mipmapRunBundles(s,r),t===null&&gf(this.device,s.finish()),n.layers=r}_mipmapCreateBundles(e){let t=e.textureBindingViewDimension||"2d-array",n=this.getTransferPipeline(e.format,t),r=n.getBindGroupLayout(0),s=[];for(let o=1;o<e.mipLevelCount;o++)for(let a=0;a<e.depthOrArrayLayers;a++){vs.dimension=t,vs.baseMipLevel=o-1,vs.mipLevelCount=1;let l=e.createView(vs);vs.reset(),rm.layout=r,rm.entries.push({binding:0,resource:this.mipmapSampler},{binding:1,resource:l},{binding:2,resource:{buffer:this.noFlipUniformBuffer}});let c=this.device.createBindGroup(rm);rm.reset(),vs.dimension="2d",vs.baseMipLevel=o,vs.mipLevelCount=1,vs.baseArrayLayer=a,vs.arrayLayerCount=1;let u=e.createView(vs);vs.reset();let f=new Qg;f.view=u,f.loadOp=Fi.Clear,f.storeOp=Ya.Store;let d=new Jg;d.colorAttachments.push(f),sU.colorFormats=[e.format];let A=this.device.createRenderBundleEncoder(sU);sU.reset(),A.setPipeline(n),A.setBindGroup(0,c),A.draw(3,1,0,a),s.push({renderBundles:[A.finish()],passDescriptor:d})}return s}_mipmapRunBundles(e,t){let n=t.length;for(let r=0;r<n;r++){let s=t[r],o=e.beginRenderPass(s.passDescriptor);o.executeBundles(s.renderBundles),o.end()}}},T9=class{constructor(){this.label="",this.addressModeU="clamp-to-edge",this.addressModeV="clamp-to-edge",this.addressModeW="clamp-to-edge",this.magFilter="nearest",this.minFilter="nearest",this.mipmapFilter="nearest",this.lodMinClamp=0,this.lodMaxClamp=32,this.compare=void 0,this.maxAnisotropy=1}reset(){this.label="",this.addressModeU="clamp-to-edge",this.addressModeV="clamp-to-edge",this.addressModeW="clamp-to-edge",this.magFilter="nearest",this.minFilter="nearest",this.mipmapFilter="nearest",this.lodMinClamp=0,this.lodMaxClamp=32,this.compare=void 0,this.maxAnisotropy=1}},_x=class{constructor(){this.texture=null,this.mipLevel=0,this.origin={x:0,y:0,z:0},this.aspect="all"}reset(){this.texture=null,this.mipLevel=0,this.origin.x=0,this.origin.y=0,this.origin.z=0,this.aspect="all"}},E9=class{constructor(){this.buffer=null,this.offset=0,this.bytesPerRow=void 0,this.rowsPerImage=void 0}reset(){this.buffer=null,this.offset=0,this.bytesPerRow=void 0,this.rowsPerImage=void 0}},M9=class{constructor(){this.offset=0,this.bytesPerRow=void 0,this.rowsPerImage=void 0}reset(){this.offset=0,this.bytesPerRow=void 0,this.rowsPerImage=void 0}},C9=class{constructor(){this.source=null,this.origin={x:0,y:0},this.flipY=!1}reset(){this.source=null,this.origin.x=0,this.origin.y=0,this.flipY=!1}},R9=class extends _x{constructor(){super(),this.colorSpace="srgb",this.premultipliedAlpha=!1}reset(){super.reset(),this.colorSpace="srgb",this.premultipliedAlpha=!1}},cI=class{constructor(){this.width=0,this.height=1,this.depthOrArrayLayers=1}reset(){this.width=0,this.height=1,this.depthOrArrayLayers=1}},zR=new ym,dPe=new l1,pa=new T9,va=new _x,VR=new E9,Zd=new M9,GR=new C9,Z_=new R9,om=new RS,Aa=new cI,pPe={[Lb]:"never",[h_]:"less",[Db]:"equal",[Yh]:"less-equal",[fg]:"greater",[Fu]:"greater-equal",[Fb]:"always",[Nb]:"not-equal"},mPe=[0,1,3,2,4,5];function qte(i,e,t,n,r,s,o,a,l,c){va.texture=e,va.mipLevel=t,va.origin.z=n,Zd.offset=n*s,Zd.bytesPerRow=o,Zd.rowsPerImage=a,Aa.width=l,Aa.height=c,i.queue.writeTexture(va,r.data,Zd,Aa),va.reset(),Zd.reset(),Aa.reset()}var I9=class{constructor(e){this.backend=e,this._passUtils=null,this.defaultTexture={},this.defaultCubeTexture={},this.defaultVideoFrame=null,this._samplerCache=new Map}updateSampler(e){let t=this.backend,n=e.texture,r=e.textureNode,s=n.minFilter+"-"+n.magFilter+"-"+n.wrapS+"-"+n.wrapT+"-"+(n.wrapR||"0")+"-"+n.anisotropy+"-"+(n.isDepthTexture===!0?1:0)+"-"+(n.compareFunction!==null&&r.compareNode!==null?n.compareFunction:0),o=this._samplerCache.get(s);if(o===void 0){pa.addressModeU=this._convertAddressMode(n.wrapS),pa.addressModeV=this._convertAddressMode(n.wrapT),pa.addressModeW=this._convertAddressMode(n.wrapR),pa.magFilter=this._convertFilterMode(n.magFilter),pa.minFilter=this._convertFilterMode(n.minFilter),pa.mipmapFilter=this._convertMipmapFilterMode(n.minFilter),n.isDepthTexture&&(n.compareFunction===null||r.compareNode===null)&&(pa.magFilter=Jc.Nearest,pa.minFilter=Jc.Nearest,pa.mipmapFilter=Jc.Nearest),pa.magFilter===Jc.Linear&&pa.minFilter===Jc.Linear&&pa.mipmapFilter===Jc.Linear&&(pa.maxAnisotropy=n.anisotropy),n.isDepthTexture&&n.compareFunction!==null&&r.compareNode!==null&&t.hasCompatibility(Ud.TEXTURE_COMPARE)&&(pa.compare=pPe[n.compareFunction]);let l=t.device.createSampler(pa);pa.reset(),o={sampler:l,usedTimes:0},this._samplerCache.set(s,o)}let a=t.get(e);return a.sampler!==o.sampler&&(this._releaseSampler(a),a.samplerKey=s,a.sampler=o.sampler,o.usedTimes++),s}destroySampler(e){this._releaseSampler(this.backend.get(e))}_releaseSampler(e){if(e.sampler!==void 0){let t=this._samplerCache.get(e.samplerKey);t.usedTimes--,t.usedTimes===0&&this._samplerCache.delete(e.samplerKey),e.sampler=void 0,e.samplerKey=void 0}}createDefaultTexture(e){let t,n=P9(e,this.backend.device);e.isCubeTexture?t=this._getDefaultCubeTextureGPU(n):t=this._getDefaultTextureGPU(n),this.backend.get(e).texture=t}createTexture(e,t={}){let n=this.backend,r=n.get(e);if(r.initialized){if(r.externalTexture===!0)return;throw new Error("THREE.WebGPUTextureUtils: Texture already initialized.")}if(e.isExternalTexture){r.texture=e.sourceTexture,r.initialized=!0;return}t.needsMipmaps===void 0&&(t.needsMipmaps=!1),t.levels===void 0&&(t.levels=1),t.depth===void 0&&(t.depth=1);let{width:s,height:o,depth:a,levels:l}=t;e.isFramebufferTexture&&(t.renderTarget?t.format=this.backend.utils.getCurrentColorFormat(t.renderTarget):t.format=this.backend.utils.getPreferredCanvasFormat());let c=this._getDimension(e),u=e.internalFormat||t.format||P9(e,n.device);r.format=u;let{samples:f,primarySamples:d,isMSAA:A}=n.utils.getTextureSampleData(e),y=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC;e.isStorageTexture===!0&&(y|=GPUTextureUsage.STORAGE_BINDING),e.isCompressedTexture!==!0&&e.isCompressedArrayTexture!==!0&&u!==fe.RGB9E5UFloat&&(y|=GPUTextureUsage.RENDER_ATTACHMENT);let w=new RS;if(w.label=e.name,w.size.width=s,w.size.height=o,w.size.depthOrArrayLayers=a,w.mipLevelCount=l,w.sampleCount=d,w.dimension=c,w.format=u,w.usage=y,u===void 0){Xe("WebGPURenderer: Texture format not supported."),this.createDefaultTexture(e);return}e.isCubeTexture&&(w.textureBindingViewDimension=jo.Cube);try{r.texture=n.device.createTexture(w)}catch{Xe("WebGPURenderer: Failed to create texture with descriptor:",w),this.createDefaultTexture(e);return}if(A){let S=Object.assign({},w);S.label=S.label+"-msaa",S.sampleCount=f,S.mipLevelCount=1,r.msaaTexture=n.device.createTexture(S)}r.initialized=!0,r.textureDescriptorGPU=w}destroyTexture(e,t=!1){let n=this.backend,r=n.get(e);r.texture!==void 0&&t===!1&&e.isExternalTexture!==!0&&r.texture.destroy(),r.msaaTexture!==void 0&&r.msaaTexture.destroy(),n.delete(e)}generateMipmaps(e,t=null){let n=this.backend.get(e);this._generateMipmaps(n.texture,t)}getColorBuffer(){let e=this.backend,t=e.renderer.getCanvasTarget(),{width:n,height:r}=e.getDrawingBufferSize(),s=e.renderer.currentSamples,o=t.colorTexture,a=e.get(o);if(o.width===n&&o.height===r&&o.samples===s)return a.texture;let l=a.texture;return l&&l.destroy(),om.label="colorBuffer",om.size.width=n,om.size.height=r,om.sampleCount=e.utils.getSampleCount(e.renderer.currentSamples),om.format=e.utils.getPreferredCanvasFormat(),om.usage=GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,l=e.device.createTexture(om),om.reset(),o.source.width=n,o.source.height=r,o.samples=s,a.texture=l,l}getDepthBuffer(e=!0,t=!1){let n=this.backend,r=n.renderer.getCanvasTarget(),{width:s,height:o}=n.getDrawingBufferSize(),a=n.renderer.currentSamples,l=r.depthTexture;if(l.width===s&&l.height===o&&l.samples===a&&l.depth===e&&l.stencil===t)return n.get(l).texture;let c=n.get(l).texture,u,f;if(t?(u=xo,f=n.renderer.reversedDepthBuffer===!0?cr:ca):e&&(u=Gs,f=n.renderer.reversedDepthBuffer===!0?cr:xi),c!==void 0){if(l.image.width===s&&l.image.height===o&&l.format===u&&l.type===f&&l.samples===a)return c;this.destroyTexture(l)}return l.name="depthBuffer",l.format=u,l.type=f,l.image.width=s,l.image.height=o,l.samples=a,this.createTexture(l,{width:s,height:o}),n.get(l).texture}updateTexture(e,t){let n=this.backend.get(e),r=e.mipmaps,{textureDescriptorGPU:s}=n;if(!(e.isRenderTargetTexture||s===void 0)){if(e.isDataTexture)if(r.length>0)for(let o=0,a=r.length;o<a;o++){let l=r[o];this._copyBufferToTexture(l,n.texture,s,0,e.flipY,0,o)}else this._copyBufferToTexture(t.image,n.texture,s,0,e.flipY);else if(e.isArrayTexture||e.isDataArrayTexture||e.isData3DTexture)if(e.layerUpdates&&e.layerUpdates.size>0){for(let o of e.layerUpdates)this._copyBufferToTexture(t.image,n.texture,s,o,e.flipY,o);e.clearLayerUpdates()}else for(let o=0;o<t.image.depth;o++)this._copyBufferToTexture(t.image,n.texture,s,o,e.flipY,o);else if(e.isCompressedTexture||e.isCompressedArrayTexture)e.isCompressedArrayTexture&&e.layerUpdates.size>0?(this._copyCompressedBufferToTexture(e.mipmaps,n.texture,s,e.layerUpdates),e.clearLayerUpdates()):this._copyCompressedBufferToTexture(e.mipmaps,n.texture,s);else if(e.isCubeTexture)this._copyCubeMapToTexture(e,n.texture,s);else if(e.isHTMLTexture){let o=this.backend.device,a=this.backend.renderer.domElement,l=e.image;if(typeof o.queue.copyElementImageToTexture!="function")return;if(!n.hasPaintCallback){n.hasPaintCallback=!0,a.requestPaint();return}let c=s.size.width,u=s.size.height;o.queue.copyElementImageToTexture.length===2?o.queue.copyElementImageToTexture({source:l},{destination:{texture:n.texture},width:c,height:u}):o.queue.copyElementImageToTexture(l,c,u,{texture:n.texture}),e.flipY&&this._flipY(n.texture,s)}else if(r.length>0)for(let o=0,a=r.length;o<a;o++){let l=r[o];this._copyImageToTexture(l,n.texture,s,0,e.flipY,e.premultiplyAlpha,o)}else this._copyImageToTexture(t.image,n.texture,s,0,e.flipY,e.premultiplyAlpha);n.version=e.version}}async copyTextureToBuffer(e,t,n,r,s,o){let a=this.backend.device,l=this.backend.get(e),c=l.texture,u=l.textureDescriptorGPU.format,f=this._getBytesPerTexel(u),d=r*f;d=Math.ceil(d/256)*256,zR.size=(s-1)*d+r*f,zR.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ;let A=a.createBuffer(zR);zR.reset();let y=a.createCommandEncoder(dPe);va.texture=c,va.origin.x=t,va.origin.y=n,va.origin.z=o,VR.buffer=A,VR.bytesPerRow=d,Aa.width=r,Aa.height=s,y.copyTextureToBuffer(va,VR,Aa),va.reset(),VR.reset(),Aa.reset();let w=this._getTypedArrayType(u);gf(a,y.finish()),await A.mapAsync(GPUMapMode.READ);let S=A.getMappedRange().slice();return A.destroy(),new w(S)}dispose(){this._samplerCache.clear()}_getDefaultTextureGPU(e){let t=this.defaultTexture[e];if(t===void 0){let n=new Hs;n.minFilter=Ti,n.magFilter=Ti,this.createTexture(n,{width:1,height:1,format:e}),this.defaultTexture[e]=t=n}return this.backend.get(t).texture}_getDefaultCubeTextureGPU(e){let t=this.defaultCubeTexture[e];if(t===void 0){let n=new Lh;n.minFilter=Ti,n.magFilter=Ti,this.createTexture(n,{width:1,height:1,depth:6}),this.defaultCubeTexture[e]=t=n}return this.backend.get(t).texture}_copyCubeMapToTexture(e,t,n){let r=e.images,s=e.mipmaps;for(let o=0;o<6;o++){let a=r[o],l=e.flipY===!0?mPe[o]:o;a.isDataTexture?this._copyBufferToTexture(a.image,t,n,l,e.flipY):this._copyImageToTexture(a,t,n,l,e.flipY,e.premultiplyAlpha);for(let c=0;c<s.length;c++){let f=s[c].images[o];f.isDataTexture?this._copyBufferToTexture(f.image,t,n,l,e.flipY,0,c+1):this._copyImageToTexture(f,t,n,l,e.flipY,e.premultiplyAlpha,c+1)}}}_copyImageToTexture(e,t,n,r,s,o,a=0){let l=this.backend.device,c=a>0?e.width:n.size.width,u=a>0?e.height:n.size.height;GR.source=e,GR.flipY=s,Z_.texture=t,Z_.mipLevel=a,Z_.origin.z=r,Z_.premultipliedAlpha=o,Aa.width=c,Aa.height=u;try{l.queue.copyExternalImageToTexture(GR,Z_,Aa)}catch{}finally{GR.reset(),Z_.reset(),Aa.reset()}}_getPassUtils(){let e=this._passUtils;return e===null&&(this._passUtils=e=new S9(this.backend.device)),e}_generateMipmaps(e,t=null){this._getPassUtils().generateMipmaps(e,t)}_flipY(e,t,n=0){this._getPassUtils().flipY(e,t,n)}_copyBufferToTexture(e,t,n,r,s,o=0,a=0){let l=this.backend.device,c=e.data,u=this._getBytesPerTexel(n.format),f=e.width*u;va.texture=t,va.mipLevel=a,va.origin.z=r,Zd.offset=e.width*e.height*u*o,Zd.bytesPerRow=f,Aa.width=e.width,Aa.height=e.height,l.queue.writeTexture(va,c,Zd,Aa),va.reset(),Zd.reset(),Aa.reset(),s===!0&&this._flipY(t,n,r)}_copyCompressedBufferToTexture(e,t,n,r=null){let s=this.backend.device,o=this._getBlockData(n.format),a=n.size.depthOrArrayLayers>1,l=r&&r.size>0?r:null;for(let c=0;c<e.length;c++){let u=e[c],f=u.width,d=u.height,A=a?n.size.depthOrArrayLayers:1,y=Math.ceil(f/o.width)*o.byteLength,w=Math.ceil(d/o.height),S=y*w,T=Math.ceil(f/o.width)*o.width,R=w*o.height;if(l!==null)for(let P of l)qte(s,t,c,P,u,S,y,w,T,R);else for(let P=0;P<A;P++)qte(s,t,c,P,u,S,y,w,T,R)}}_getBlockData(e){if(e===fe.BC1RGBAUnorm||e===fe.BC1RGBAUnormSRGB)return{byteLength:8,width:4,height:4};if(e===fe.BC2RGBAUnorm||e===fe.BC2RGBAUnormSRGB)return{byteLength:16,width:4,height:4};if(e===fe.BC3RGBAUnorm||e===fe.BC3RGBAUnormSRGB)return{byteLength:16,width:4,height:4};if(e===fe.BC4RUnorm||e===fe.BC4RSnorm)return{byteLength:8,width:4,height:4};if(e===fe.BC5RGUnorm||e===fe.BC5RGSnorm)return{byteLength:16,width:4,height:4};if(e===fe.BC6HRGBUFloat||e===fe.BC6HRGBFloat)return{byteLength:16,width:4,height:4};if(e===fe.BC7RGBAUnorm||e===fe.BC7RGBAUnormSRGB)return{byteLength:16,width:4,height:4};if(e===fe.ETC2RGB8Unorm||e===fe.ETC2RGB8UnormSRGB)return{byteLength:8,width:4,height:4};if(e===fe.ETC2RGB8A1Unorm||e===fe.ETC2RGB8A1UnormSRGB)return{byteLength:8,width:4,height:4};if(e===fe.ETC2RGBA8Unorm||e===fe.ETC2RGBA8UnormSRGB)return{byteLength:16,width:4,height:4};if(e===fe.EACR11Unorm)return{byteLength:8,width:4,height:4};if(e===fe.EACR11Snorm)return{byteLength:8,width:4,height:4};if(e===fe.EACRG11Unorm)return{byteLength:16,width:4,height:4};if(e===fe.EACRG11Snorm)return{byteLength:16,width:4,height:4};if(e===fe.ASTC4x4Unorm||e===fe.ASTC4x4UnormSRGB)return{byteLength:16,width:4,height:4};if(e===fe.ASTC5x4Unorm||e===fe.ASTC5x4UnormSRGB)return{byteLength:16,width:5,height:4};if(e===fe.ASTC5x5Unorm||e===fe.ASTC5x5UnormSRGB)return{byteLength:16,width:5,height:5};if(e===fe.ASTC6x5Unorm||e===fe.ASTC6x5UnormSRGB)return{byteLength:16,width:6,height:5};if(e===fe.ASTC6x6Unorm||e===fe.ASTC6x6UnormSRGB)return{byteLength:16,width:6,height:6};if(e===fe.ASTC8x5Unorm||e===fe.ASTC8x5UnormSRGB)return{byteLength:16,width:8,height:5};if(e===fe.ASTC8x6Unorm||e===fe.ASTC8x6UnormSRGB)return{byteLength:16,width:8,height:6};if(e===fe.ASTC8x8Unorm||e===fe.ASTC8x8UnormSRGB)return{byteLength:16,width:8,height:8};if(e===fe.ASTC10x5Unorm||e===fe.ASTC10x5UnormSRGB)return{byteLength:16,width:10,height:5};if(e===fe.ASTC10x6Unorm||e===fe.ASTC10x6UnormSRGB)return{byteLength:16,width:10,height:6};if(e===fe.ASTC10x8Unorm||e===fe.ASTC10x8UnormSRGB)return{byteLength:16,width:10,height:8};if(e===fe.ASTC10x10Unorm||e===fe.ASTC10x10UnormSRGB)return{byteLength:16,width:10,height:10};if(e===fe.ASTC12x10Unorm||e===fe.ASTC12x10UnormSRGB)return{byteLength:16,width:12,height:10};if(e===fe.ASTC12x12Unorm||e===fe.ASTC12x12UnormSRGB)return{byteLength:16,width:12,height:12}}_convertAddressMode(e){let t=tU.ClampToEdge;return e===Cd?t=tU.Repeat:e===Rd&&(t=tU.MirrorRepeat),t}_convertFilterMode(e){let t=Jc.Linear;return(e===Ti||e===Rb||e===Wc)&&(t=Jc.Nearest),t}_convertMipmapFilterMode(e){return e===Wc||e===Vo?Jc.Linear:Jc.Nearest}_getBytesPerTexel(e){if(e===fe.R8Unorm||e===fe.R8Snorm||e===fe.R8Uint||e===fe.R8Sint)return 1;if(e===fe.R16Uint||e===fe.R16Sint||e===fe.R16Float||e===fe.RG8Unorm||e===fe.RG8Snorm||e===fe.RG8Uint||e===fe.RG8Sint||e===fe.R16Unorm||e===fe.R16Snorm)return 2;if(e===fe.R32Uint||e===fe.R32Sint||e===fe.R32Float||e===fe.RG16Uint||e===fe.RG16Sint||e===fe.RG16Float||e===fe.RGBA8Unorm||e===fe.RGBA8UnormSRGB||e===fe.RGBA8Snorm||e===fe.RGBA8Uint||e===fe.RGBA8Sint||e===fe.BGRA8Unorm||e===fe.BGRA8UnormSRGB||e===fe.RG16Unorm||e===fe.RG16Snorm||e===fe.RGB9E5UFloat||e===fe.RGB10A2Unorm||e===fe.RG11B10UFloat||e===fe.Depth32Float||e===fe.Depth24Plus||e===fe.Depth24PlusStencil8||e===fe.Depth32FloatStencil8)return 4;if(e===fe.RG32Uint||e===fe.RG32Sint||e===fe.RG32Float||e===fe.RGBA16Uint||e===fe.RGBA16Sint||e===fe.RGBA16Float||e===fe.RGBA16Unorm||e===fe.RGBA16Snorm)return 8;if(e===fe.RGBA32Uint||e===fe.RGBA32Sint||e===fe.RGBA32Float)return 16}_getTypedArrayType(e){if(e===fe.R8Uint)return Uint8Array;if(e===fe.R8Sint)return Int8Array;if(e===fe.R8Unorm)return Uint8Array;if(e===fe.R8Snorm)return Int8Array;if(e===fe.RG8Uint)return Uint8Array;if(e===fe.RG8Sint)return Int8Array;if(e===fe.RG8Unorm)return Uint8Array;if(e===fe.RG8Snorm)return Int8Array;if(e===fe.RGBA8Uint)return Uint8Array;if(e===fe.RGBA8Sint)return Int8Array;if(e===fe.RGBA8Unorm||e===fe.RGBA8UnormSRGB)return Uint8Array;if(e===fe.RGBA8Snorm)return Int8Array;if(e===fe.R16Uint)return Uint16Array;if(e===fe.R16Sint)return Int16Array;if(e===fe.RG16Uint)return Uint16Array;if(e===fe.RG16Sint)return Int16Array;if(e===fe.RGBA16Uint)return Uint16Array;if(e===fe.RGBA16Sint)return Int16Array;if(e===fe.R16Float||e===fe.RG16Float||e===fe.RGBA16Float||e===fe.R16Unorm)return Uint16Array;if(e===fe.R16Snorm)return Int16Array;if(e===fe.RG16Unorm)return Uint16Array;if(e===fe.RG16Snorm)return Int16Array;if(e===fe.RGBA16Unorm)return Uint16Array;if(e===fe.RGBA16Snorm)return Int16Array;if(e===fe.R32Uint)return Uint32Array;if(e===fe.R32Sint)return Int32Array;if(e===fe.R32Float)return Float32Array;if(e===fe.RG32Uint)return Uint32Array;if(e===fe.RG32Sint)return Int32Array;if(e===fe.RG32Float)return Float32Array;if(e===fe.RGBA32Uint)return Uint32Array;if(e===fe.RGBA32Sint)return Int32Array;if(e===fe.RGBA32Float)return Float32Array;if(e===fe.BGRA8Unorm||e===fe.BGRA8UnormSRGB)return Uint8Array;if(e===fe.RGB10A2Unorm||e===fe.RGB9E5UFloat||e===fe.RG11B10UFloat)return Uint32Array;if(e===fe.Depth32Float)return Float32Array;if(e===fe.Depth24Plus||e===fe.Depth24PlusStencil8)return Uint32Array;if(e===fe.Depth32FloatStencil8)return Float32Array}_getDimension(e){let t;return e.is3DTexture||e.isData3DTexture?t=Vte.ThreeD:t=Vte.TwoD,t}};function P9(i,e){let t=i.format,n=i.type,r=i.normalized,s=i.colorSpace,o=ln.getTransfer(s),a,l=!1;if(r&&(l=e.features.has(rI.TextureFormatsTier1),l===!1&&Xe("WebGPURenderer: Unable to use normalized textures without texture-formats-tier1 feature.")),i.isCompressedTexture===!0||i.isCompressedArrayTexture===!0)switch(t){case qh:case Hh:a=o===kt?fe.BC1RGBAUnormSRGB:fe.BC1RGBAUnorm;break;case Wh:a=o===kt?fe.BC2RGBAUnormSRGB:fe.BC2RGBAUnorm;break;case jh:a=o===kt?fe.BC3RGBAUnormSRGB:fe.BC3RGBAUnorm;break;case G0:a=fe.BC4RUnorm;break;case q0:a=fe.BC4RSnorm;break;case $h:a=fe.BC5RGUnorm;break;case H0:a=fe.BC5RGSnorm;break;case k0:a=o===kt?fe.BC7RGBAUnormSRGB:fe.BC7RGBAUnorm;break;case z0:a=fe.BC6HRGBFloat;break;case V0:a=fe.BC6HRGBUFloat;break;case x0:case _0:a=o===kt?fe.ETC2RGB8UnormSRGB:fe.ETC2RGB8Unorm;break;case y0:a=o===kt?fe.ETC2RGBA8UnormSRGB:fe.ETC2RGBA8Unorm;break;case b0:a=fe.EACR11Unorm;break;case w0:a=fe.EACR11Snorm;break;case Xh:a=fe.EACRG11Unorm;break;case S0:a=fe.EACRG11Snorm;break;case T0:a=o===kt?fe.ASTC4x4UnormSRGB:fe.ASTC4x4Unorm;break;case E0:a=o===kt?fe.ASTC5x4UnormSRGB:fe.ASTC5x4Unorm;break;case M0:a=o===kt?fe.ASTC5x5UnormSRGB:fe.ASTC5x5Unorm;break;case C0:a=o===kt?fe.ASTC6x5UnormSRGB:fe.ASTC6x5Unorm;break;case R0:a=o===kt?fe.ASTC6x6UnormSRGB:fe.ASTC6x6Unorm;break;case I0:a=o===kt?fe.ASTC8x5UnormSRGB:fe.ASTC8x5Unorm;break;case P0:a=o===kt?fe.ASTC8x6UnormSRGB:fe.ASTC8x6Unorm;break;case L0:a=o===kt?fe.ASTC8x8UnormSRGB:fe.ASTC8x8Unorm;break;case D0:a=o===kt?fe.ASTC10x5UnormSRGB:fe.ASTC10x5Unorm;break;case N0:a=o===kt?fe.ASTC10x6UnormSRGB:fe.ASTC10x6Unorm;break;case F0:a=o===kt?fe.ASTC10x8UnormSRGB:fe.ASTC10x8Unorm;break;case B0:a=o===kt?fe.ASTC10x10UnormSRGB:fe.ASTC10x10Unorm;break;case O0:a=o===kt?fe.ASTC12x10UnormSRGB:fe.ASTC12x10Unorm;break;case U0:a=o===kt?fe.ASTC12x12UnormSRGB:fe.ASTC12x12Unorm;break;case Or:a=o===kt?fe.RGBA8UnormSRGB:fe.RGBA8Unorm;break;default:ze("WebGPURenderer: Unsupported texture format.",t)}else switch(t){case Or:switch(n){case kh:a=fe.RGBA8Snorm;break;case zh:a=l?fe.RGBA16Snorm:fe.RGBA16Sint;break;case wl:a=l?fe.RGBA16Unorm:fe.RGBA16Uint;break;case xi:a=fe.RGBA32Uint;break;case Zr:a=fe.RGBA32Sint;break;case Ji:a=o===kt?fe.RGBA8UnormSRGB:fe.RGBA8Unorm;break;case Wi:a=fe.RGBA16Float;break;case cr:a=fe.RGBA32Float;break;default:ze("WebGPURenderer: Unsupported texture type with RGBAFormat.",n)}break;case Bd:switch(n){case og:a=fe.RGB9E5UFloat;break;case ag:a=fe.RG11B10UFloat;break;default:ze("WebGPURenderer: Unsupported texture type with RGBFormat.",n)}break;case Od:switch(n){case kh:a=fe.R8Snorm;break;case zh:a=l?fe.R16Snorm:fe.R16Sint;break;case wl:a=l?fe.R16Unorm:fe.R16Uint;break;case xi:a=fe.R32Uint;break;case Zr:a=fe.R32Sint;break;case Ji:a=fe.R8Unorm;break;case Wi:a=fe.R16Float;break;case cr:a=fe.R32Float;break;default:ze("WebGPURenderer: Unsupported texture type with RedFormat.",n)}break;case js:switch(n){case kh:a=fe.RG8Snorm;break;case zh:a=l?fe.RG16Snorm:fe.RG16Sint;break;case wl:a=l?fe.RG16Unorm:fe.RG16Uint;break;case xi:a=fe.RG32Uint;break;case Zr:a=fe.RG32Sint;break;case Ji:a=fe.RG8Unorm;break;case Wi:a=fe.RG16Float;break;case cr:a=fe.RG32Float;break;default:ze("WebGPURenderer: Unsupported texture type with RGFormat.",n)}break;case Gs:switch(n){case wl:a=fe.Depth16Unorm;break;case xi:a=fe.Depth24Plus;break;case cr:a=fe.Depth32Float;break;default:ze("WebGPURenderer: Unsupported texture type with DepthFormat.",n)}break;case xo:switch(n){case ca:a=fe.Depth24PlusStencil8;break;case cr:e&&e.features.has(rI.Depth32FloatStencil8)===!1&&ze('WebGPURenderer: Depth textures with DepthStencilFormat + FloatType can only be used with the "depth32float-stencil8" GPU feature.'),a=fe.Depth32FloatStencil8;break;default:ze("WebGPURenderer: Unsupported texture type with DepthStencilFormat.",n)}break;case Vh:switch(n){case Zr:a=fe.R32Sint;break;case xi:a=fe.R32Uint;break;default:ze("WebGPURenderer: Unsupported texture type with RedIntegerFormat.",n)}break;case Gh:switch(n){case Zr:a=fe.RG32Sint;break;case xi:a=fe.RG32Uint;break;default:ze("WebGPURenderer: Unsupported texture type with RGIntegerFormat.",n)}break;case v0:switch(n){case Zr:a=fe.RGBA32Sint;break;case xi:a=fe.RGBA32Uint;break;default:ze("WebGPURenderer: Unsupported texture type with RGBAIntegerFormat.",n)}break;default:ze("WebGPURenderer: Unsupported texture format.",t)}return a}var APe=/^[fn]*\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)\s*[\-\>]*\s*([a-z_0-9]+(?:<[\s\S]+?>)?)/i,gPe=/([a-z_0-9]+)\s*:\s*([a-z_0-9]+(?:<[\s\S]+?>)?)/ig,Hte={f32:"float",i32:"int",u32:"uint",bool:"bool","vec2<f32>":"vec2","vec2<i32>":"ivec2","vec2<u32>":"uvec2","vec2<bool>":"bvec2",vec2f:"vec2",vec2i:"ivec2",vec2u:"uvec2",vec2b:"bvec2","vec3<f32>":"vec3","vec3<i32>":"ivec3","vec3<u32>":"uvec3","vec3<bool>":"bvec3",vec3f:"vec3",vec3i:"ivec3",vec3u:"uvec3",vec3b:"bvec3","vec4<f32>":"vec4","vec4<i32>":"ivec4","vec4<u32>":"uvec4","vec4<bool>":"bvec4",vec4f:"vec4",vec4i:"ivec4",vec4u:"uvec4",vec4b:"bvec4","mat2x2<f32>":"mat2",mat2x2f:"mat2","mat3x3<f32>":"mat3",mat3x3f:"mat3","mat4x4<f32>":"mat4",mat4x4f:"mat4",sampler:"sampler",texture_1d:"texture",texture_2d:"texture",texture_2d_array:"texture",texture_multisampled_2d:"cubeTexture",texture_depth_2d:"depthTexture",texture_depth_2d_array:"depthTexture",texture_depth_multisampled_2d:"depthTexture",texture_depth_cube:"depthTexture",texture_depth_cube_array:"depthTexture",texture_3d:"texture3D",texture_cube:"cubeTexture",texture_cube_array:"cubeTexture",texture_storage_1d:"storageTexture",texture_storage_2d:"storageTexture",texture_storage_2d_array:"storageTexture",texture_storage_3d:"storageTexture"},vPe=i=>{i=i.trim();let e=i.match(APe);if(e!==null&&e.length===4){let t=e[2],n=[],r=null;for(;(r=gPe.exec(t))!==null;)n.push({name:r[1],type:r[2]});let s=[];for(let u=0;u<n.length;u++){let{name:f,type:d}=n[u],A=d;A.startsWith("ptr")?A="pointer":(A.startsWith("texture")&&(A=d.split("<")[0]),A=Hte[A]),s.push(new TS(A,f))}let o=i.substring(e[0].length),a=e[3]||"void",l=e[1]!==void 0?e[1]:"";return{type:Hte[a]||a,inputs:s,name:l,inputsCode:t,blockCode:o,outputType:a}}else throw new Error("THREE.WGSLNodeFunction: Function is not a WGSL code.")},L9=class extends MS{constructor(e){let{type:t,inputs:n,name:r,inputsCode:s,blockCode:o,outputType:a}=vPe(e);super(t,n,r),this.inputsCode=s,this.blockCode=o,this.outputType=a}getCode(e=this.name){let t=this.outputType!=="void"?"-> "+this.outputType:"";return`fn ${e} ( ${this.inputsCode.trim()} ) ${t}`+this.blockCode}},D9=class extends H4{parseFunction(e){return new L9(e)}},_Pe={[$o.READ_ONLY]:"read",[$o.WRITE_ONLY]:"write",[$o.READ_WRITE]:"read_write"},Wte={[Cd]:"repeat",[aa]:"clamp",[Rd]:"mirror"},aU={vertex:wf.VERTEX,fragment:wf.FRAGMENT,compute:wf.COMPUTE},jte={instance:!0,swizzleAssign:!1,storageBuffer:!0},xPe={"^^":"tsl_xor"},yPe={float:"f32",int:"i32",uint:"u32",bool:"bool",color:"vec3<f32>",vec2:"vec2<f32>",ivec2:"vec2<i32>",uvec2:"vec2<u32>",bvec2:"vec2<bool>",vec3:"vec3<f32>",ivec3:"vec3<i32>",uvec3:"vec3<u32>",bvec3:"vec3<bool>",vec4:"vec4<f32>",ivec4:"vec4<i32>",uvec4:"vec4<u32>",bvec4:"vec4<bool>",mat2:"mat2x2<f32>",mat3:"mat3x3<f32>",mat4:"mat4x4<f32>"},Xte={},$w={tsl_xor:new hr("fn tsl_xor( a : bool, b : bool ) -> bool { return ( a || b ) && !( a && b ); }"),mod_float:new hr("fn tsl_mod_float( x : f32, y : f32 ) -> f32 { return x - y * floor( x / y ); }"),mod_vec2:new hr("fn tsl_mod_vec2( x : vec2f, y : vec2f ) -> vec2f { return x - y * floor( x / y ); }"),mod_vec3:new hr("fn tsl_mod_vec3( x : vec3f, y : vec3f ) -> vec3f { return x - y * floor( x / y ); }"),mod_vec4:new hr("fn tsl_mod_vec4( x : vec4f, y : vec4f ) -> vec4f { return x - y * floor( x / y ); }"),equals_bool:new hr("fn tsl_equals_bool( a : bool, b : bool ) -> bool { return a == b; }"),equals_bvec2:new hr("fn tsl_equals_bvec2( a : vec2f, b : vec2f ) -> vec2<bool> { return vec2<bool>( a.x == b.x, a.y == b.y ); }"),equals_bvec3:new hr("fn tsl_equals_bvec3( a : vec3f, b : vec3f ) -> vec3<bool> { return vec3<bool>( a.x == b.x, a.y == b.y, a.z == b.z ); }"),equals_bvec4:new hr("fn tsl_equals_bvec4( a : vec4f, b : vec4f ) -> vec4<bool> { return vec4<bool>( a.x == b.x, a.y == b.y, a.z == b.z, a.w == b.w ); }"),repeatWrapping_float:new hr("fn tsl_repeatWrapping_float( coord: f32 ) -> f32 { return fract( coord ); }"),mirrorWrapping_float:new hr("fn tsl_mirrorWrapping_float( coord: f32 ) -> f32 { let mirrored = fract( coord * 0.5 ) * 2.0; return 1.0 - abs( 1.0 - mirrored ); }"),clampWrapping_float:new hr("fn tsl_clampWrapping_float( coord: f32 ) -> f32 { return clamp( coord, 0.0, 1.0 ); }"),inverse_mat2:new hr(`4444+`;this.mipmapSampler=e.createSampler({minFilter:eu.Linear}),this.flipYSampler=e.createSampler({minFilter:eu.Nearest}),sm.size=4,sm.usage=GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,this.flipUniformBuffer=e.createBuffer(sm),sm.reset(),e.queue.writeBuffer(this.flipUniformBuffer,0,new Uint32Array([1])),sm.size=4,sm.usage=GPUBufferUsage.UNIFORM,this.noFlipUniformBuffer=e.createBuffer(sm),sm.reset(),this.transferPipelines={},qR.label="mipmap",qR.code=t,this.mipmapShaderModule=e.createShaderModule(qR),qR.reset()}getTransferPipeline(e,t){t=t||"2d-array";let n=`${e}-${t}`,r=this.transferPipelines[n];return r===void 0&&(Z_.label=`mipmap-${e}-${t}`,Z_.vertex={module:this.mipmapShaderModule},Z_.fragment={module:this.mipmapShaderModule,entryPoint:`main_${t.replace("-","_")}`,targets:[{format:e}]},Z_.layout="auto",r=this.device.createRenderPipeline(Z_),Z_.reset(),this.transferPipelines[n]=r),r}flipY(e,t,n=0){let r=t.format,{width:s,height:o}=t.size;K_.size.width=s,K_.size.height=o,K_.format=r,K_.usage=GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING;let a=this.device.createTexture(K_);K_.reset();let l=this.getTransferPipeline(r,e.textureBindingViewDimension),c=this.getTransferPipeline(r,a.textureBindingViewDimension),u=this.device.createCommandEncoder(GR),f=(d,A,y,w,S,T)=>{let R=d.getBindGroupLayout(0);vs.dimension=A.textureBindingViewDimension||"2d-array",vs.mipLevelCount=1;let P=A.createView(vs);vs.reset(),rm.layout=R,rm.entries.push({binding:0,resource:this.flipYSampler},{binding:1,resource:P},{binding:2,resource:{buffer:T?this.flipUniformBuffer:this.noFlipUniformBuffer}});let I=this.device.createBindGroup(rm);rm.reset(),vs.dimension="2d",vs.mipLevelCount=1,vs.baseArrayLayer=S,vs.arrayLayerCount=1;let F=w.createView(vs);vs.reset(),Kw.view=F,Kw.loadOp=Fi.Clear,Kw.storeOp=Za.Store,pU.colorAttachments.push(Kw);let D=u.beginRenderPass(pU);pU.reset(),Kw.reset(),D.setPipeline(d),D.setBindGroup(0,I),D.draw(3,1,0,y),D.end()};f(l,e,n,a,0,!1),f(c,a,0,e,n,!0),vf(this.device,u.finish()),a.destroy()}generateMipmaps(e,t=null){let n=this.get(e),r=n.layers||this._mipmapCreateBundles(e),s=t;s===null&&(GR.label="mipmapEncoder",s=this.device.createCommandEncoder(GR),GR.reset()),this._mipmapRunBundles(s,r),t===null&&vf(this.device,s.finish()),n.layers=r}_mipmapCreateBundles(e){let t=e.textureBindingViewDimension||"2d-array",n=this.getTransferPipeline(e.format,t),r=n.getBindGroupLayout(0),s=[];for(let o=1;o<e.mipLevelCount;o++)for(let a=0;a<e.depthOrArrayLayers;a++){vs.dimension=t,vs.baseMipLevel=o-1,vs.mipLevelCount=1;let l=e.createView(vs);vs.reset(),rm.layout=r,rm.entries.push({binding:0,resource:this.mipmapSampler},{binding:1,resource:l},{binding:2,resource:{buffer:this.noFlipUniformBuffer}});let c=this.device.createBindGroup(rm);rm.reset(),vs.dimension="2d",vs.baseMipLevel=o,vs.mipLevelCount=1,vs.baseArrayLayer=a,vs.arrayLayerCount=1;let u=e.createView(vs);vs.reset();let f=new Qg;f.view=u,f.loadOp=Fi.Clear,f.storeOp=Za.Store;let d=new Jg;d.colorAttachments.push(f),dU.colorFormats=[e.format];let A=this.device.createRenderBundleEncoder(dU);dU.reset(),A.setPipeline(n),A.setBindGroup(0,c),A.draw(3,1,0,a),s.push({renderBundles:[A.finish()],passDescriptor:d})}return s}_mipmapRunBundles(e,t){let n=t.length;for(let r=0;r<n;r++){let s=t[r],o=e.beginRenderPass(s.passDescriptor);o.executeBundles(s.renderBundles),o.end()}}},D9=class{constructor(){this.label="",this.addressModeU="clamp-to-edge",this.addressModeV="clamp-to-edge",this.addressModeW="clamp-to-edge",this.magFilter="nearest",this.minFilter="nearest",this.mipmapFilter="nearest",this.lodMinClamp=0,this.lodMaxClamp=32,this.compare=void 0,this.maxAnisotropy=1}reset(){this.label="",this.addressModeU="clamp-to-edge",this.addressModeV="clamp-to-edge",this.addressModeW="clamp-to-edge",this.magFilter="nearest",this.minFilter="nearest",this.mipmapFilter="nearest",this.lodMinClamp=0,this.lodMaxClamp=32,this.compare=void 0,this.maxAnisotropy=1}},yx=class{constructor(){this.texture=null,this.mipLevel=0,this.origin={x:0,y:0,z:0},this.aspect="all"}reset(){this.texture=null,this.mipLevel=0,this.origin.x=0,this.origin.y=0,this.origin.z=0,this.aspect="all"}},N9=class{constructor(){this.buffer=null,this.offset=0,this.bytesPerRow=void 0,this.rowsPerImage=void 0}reset(){this.buffer=null,this.offset=0,this.bytesPerRow=void 0,this.rowsPerImage=void 0}},F9=class{constructor(){this.offset=0,this.bytesPerRow=void 0,this.rowsPerImage=void 0}reset(){this.offset=0,this.bytesPerRow=void 0,this.rowsPerImage=void 0}},B9=class{constructor(){this.source=null,this.origin={x:0,y:0},this.flipY=!1}reset(){this.source=null,this.origin.x=0,this.origin.y=0,this.flipY=!1}},O9=class extends yx{constructor(){super(),this.colorSpace="srgb",this.premultipliedAlpha=!1}reset(){super.reset(),this.colorSpace="srgb",this.premultipliedAlpha=!1}},dI=class{constructor(){this.width=0,this.height=1,this.depthOrArrayLayers=1}reset(){this.width=0,this.height=1,this.depthOrArrayLayers=1}},HR=new ym,DPe=new l1,pa=new D9,va=new yx,WR=new N9,Yd=new F9,jR=new B9,Q_=new O9,om=new DS,Aa=new dI,NPe={[Bb]:"never",[d_]:"less",[Ob]:"equal",[Zh]:"less-equal",[fg]:"greater",[Ou]:"greater-equal",[kb]:"always",[Ub]:"not-equal"},FPe=[0,1,3,2,4,5];function Qte(i,e,t,n,r,s,o,a,l,c){va.texture=e,va.mipLevel=t,va.origin.z=n,Yd.offset=n*s,Yd.bytesPerRow=o,Yd.rowsPerImage=a,Aa.width=l,Aa.height=c,i.queue.writeTexture(va,r.data,Yd,Aa),va.reset(),Yd.reset(),Aa.reset()}var U9=class{constructor(e){this.backend=e,this._passUtils=null,this.defaultTexture={},this.defaultCubeTexture={},this.defaultVideoFrame=null,this._samplerCache=new Map}updateSampler(e){let t=this.backend,n=e.texture,r=e.textureNode,s=n.minFilter+"-"+n.magFilter+"-"+n.wrapS+"-"+n.wrapT+"-"+(n.wrapR||"0")+"-"+n.anisotropy+"-"+(n.isDepthTexture===!0?1:0)+"-"+(n.compareFunction!==null&&r.compareNode!==null?n.compareFunction:0),o=this._samplerCache.get(s);if(o===void 0){pa.addressModeU=this._convertAddressMode(n.wrapS),pa.addressModeV=this._convertAddressMode(n.wrapT),pa.addressModeW=this._convertAddressMode(n.wrapR),pa.magFilter=this._convertFilterMode(n.magFilter),pa.minFilter=this._convertFilterMode(n.minFilter),pa.mipmapFilter=this._convertMipmapFilterMode(n.minFilter),n.isDepthTexture&&(n.compareFunction===null||r.compareNode===null)&&(pa.magFilter=eu.Nearest,pa.minFilter=eu.Nearest,pa.mipmapFilter=eu.Nearest),pa.magFilter===eu.Linear&&pa.minFilter===eu.Linear&&pa.mipmapFilter===eu.Linear&&(pa.maxAnisotropy=n.anisotropy),n.isDepthTexture&&n.compareFunction!==null&&r.compareNode!==null&&t.hasCompatibility(Od.TEXTURE_COMPARE)&&(pa.compare=NPe[n.compareFunction]);let l=t.device.createSampler(pa);pa.reset(),o={sampler:l,usedTimes:0},this._samplerCache.set(s,o)}let a=t.get(e);return a.sampler!==o.sampler&&(this._releaseSampler(a),a.samplerKey=s,a.sampler=o.sampler,o.usedTimes++),s}destroySampler(e){this._releaseSampler(this.backend.get(e))}_releaseSampler(e){if(e.sampler!==void 0){let t=this._samplerCache.get(e.samplerKey);t.usedTimes--,t.usedTimes===0&&this._samplerCache.delete(e.samplerKey),e.sampler=void 0,e.samplerKey=void 0}}createDefaultTexture(e){let t,n=k9(e,this.backend.device);e.isCubeTexture?t=this._getDefaultCubeTextureGPU(n):t=this._getDefaultTextureGPU(n),this.backend.get(e).texture=t}createTexture(e,t={}){let n=this.backend,r=n.get(e);if(r.initialized){if(r.externalTexture===!0)return;throw new Error("THREE.WebGPUTextureUtils: Texture already initialized.")}if(e.isExternalTexture){r.texture=e.sourceTexture,r.initialized=!0;return}t.needsMipmaps===void 0&&(t.needsMipmaps=!1),t.levels===void 0&&(t.levels=1),t.depth===void 0&&(t.depth=1);let{width:s,height:o,depth:a,levels:l}=t;e.isFramebufferTexture&&(t.renderTarget?t.format=this.backend.utils.getCurrentColorFormat(t.renderTarget):t.format=this.backend.utils.getPreferredCanvasFormat());let c=this._getDimension(e),u=e.internalFormat||t.format||k9(e,n.device);r.format=u;let{samples:f,primarySamples:d,isMSAA:A}=n.utils.getTextureSampleData(e),y=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC;e.isStorageTexture===!0&&(y|=GPUTextureUsage.STORAGE_BINDING),e.isCompressedTexture!==!0&&e.isCompressedArrayTexture!==!0&&u!==fe.RGB9E5UFloat&&(y|=GPUTextureUsage.RENDER_ATTACHMENT);let w=new DS;if(w.label=e.name,w.size.width=s,w.size.height=o,w.size.depthOrArrayLayers=a,w.mipLevelCount=l,w.sampleCount=d,w.dimension=c,w.format=u,w.usage=y,u===void 0){Xe("WebGPURenderer: Texture format not supported."),this.createDefaultTexture(e);return}e.isCubeTexture&&(w.textureBindingViewDimension=jo.Cube);try{r.texture=n.device.createTexture(w)}catch{Xe("WebGPURenderer: Failed to create texture with descriptor:",w),this.createDefaultTexture(e);return}if(A){let S=Object.assign({},w);S.label=S.label+"-msaa",S.sampleCount=f,S.mipLevelCount=1,r.msaaTexture=n.device.createTexture(S)}r.initialized=!0,r.textureDescriptorGPU=w}destroyTexture(e,t=!1){let n=this.backend,r=n.get(e);r.texture!==void 0&&t===!1&&e.isExternalTexture!==!0&&r.texture.destroy(),r.msaaTexture!==void 0&&r.msaaTexture.destroy(),n.delete(e)}generateMipmaps(e,t=null){let n=this.backend.get(e);this._generateMipmaps(n.texture,t)}getColorBuffer(){let e=this.backend,t=e.renderer.getCanvasTarget(),{width:n,height:r}=e.getDrawingBufferSize(),s=e.renderer.currentSamples,o=t.colorTexture,a=e.get(o);if(o.width===n&&o.height===r&&o.samples===s)return a.texture;let l=a.texture;return l&&l.destroy(),om.label="colorBuffer",om.size.width=n,om.size.height=r,om.sampleCount=e.utils.getSampleCount(e.renderer.currentSamples),om.format=e.utils.getPreferredCanvasFormat(),om.usage=GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,l=e.device.createTexture(om),om.reset(),o.source.width=n,o.source.height=r,o.samples=s,a.texture=l,l}getDepthBuffer(e=!0,t=!1){let n=this.backend,r=n.renderer.getCanvasTarget(),{width:s,height:o}=n.getDrawingBufferSize(),a=n.renderer.currentSamples,l=r.depthTexture;if(l.width===s&&l.height===o&&l.samples===a&&l.depth===e&&l.stencil===t)return n.get(l).texture;let c=n.get(l).texture,u,f;if(t?(u=xo,f=n.renderer.reversedDepthBuffer===!0?cr:ca):e&&(u=Gs,f=n.renderer.reversedDepthBuffer===!0?cr:xi),c!==void 0){if(l.image.width===s&&l.image.height===o&&l.format===u&&l.type===f&&l.samples===a)return c;this.destroyTexture(l)}return l.name="depthBuffer",l.format=u,l.type=f,l.image.width=s,l.image.height=o,l.samples=a,this.createTexture(l,{width:s,height:o}),n.get(l).texture}updateTexture(e,t){let n=this.backend.get(e),r=e.mipmaps,{textureDescriptorGPU:s}=n;if(!(e.isRenderTargetTexture||s===void 0)){if(e.isDataTexture)if(r.length>0)for(let o=0,a=r.length;o<a;o++){let l=r[o];this._copyBufferToTexture(l,n.texture,s,0,e.flipY,0,o)}else this._copyBufferToTexture(t.image,n.texture,s,0,e.flipY);else if(e.isArrayTexture||e.isDataArrayTexture||e.isData3DTexture)if(e.layerUpdates&&e.layerUpdates.size>0){for(let o of e.layerUpdates)this._copyBufferToTexture(t.image,n.texture,s,o,e.flipY,o);e.clearLayerUpdates()}else for(let o=0;o<t.image.depth;o++)this._copyBufferToTexture(t.image,n.texture,s,o,e.flipY,o);else if(e.isCompressedTexture||e.isCompressedArrayTexture)e.isCompressedArrayTexture&&e.layerUpdates.size>0?(this._copyCompressedBufferToTexture(e.mipmaps,n.texture,s,e.layerUpdates),e.clearLayerUpdates()):this._copyCompressedBufferToTexture(e.mipmaps,n.texture,s);else if(e.isCubeTexture)this._copyCubeMapToTexture(e,n.texture,s);else if(e.isHTMLTexture){let o=this.backend.device,a=this.backend.renderer.domElement,l=e.image;if(typeof o.queue.copyElementImageToTexture!="function")return;if(!n.hasPaintCallback){n.hasPaintCallback=!0,a.requestPaint();return}let c=s.size.width,u=s.size.height;o.queue.copyElementImageToTexture.length===2?o.queue.copyElementImageToTexture({source:l},{destination:{texture:n.texture},width:c,height:u}):o.queue.copyElementImageToTexture(l,c,u,{texture:n.texture}),e.flipY&&this._flipY(n.texture,s)}else if(r.length>0)for(let o=0,a=r.length;o<a;o++){let l=r[o];this._copyImageToTexture(l,n.texture,s,0,e.flipY,e.premultiplyAlpha,o)}else this._copyImageToTexture(t.image,n.texture,s,0,e.flipY,e.premultiplyAlpha);n.version=e.version}}async copyTextureToBuffer(e,t,n,r,s,o){let a=this.backend.device,l=this.backend.get(e),c=l.texture,u=l.textureDescriptorGPU.format,f=this._getBytesPerTexel(u),d=r*f;d=Math.ceil(d/256)*256,HR.size=(s-1)*d+r*f,HR.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ;let A=a.createBuffer(HR);HR.reset();let y=a.createCommandEncoder(DPe);va.texture=c,va.origin.x=t,va.origin.y=n,va.origin.z=o,WR.buffer=A,WR.bytesPerRow=d,Aa.width=r,Aa.height=s,y.copyTextureToBuffer(va,WR,Aa),va.reset(),WR.reset(),Aa.reset();let w=this._getTypedArrayType(u);vf(a,y.finish()),await A.mapAsync(GPUMapMode.READ);let S=A.getMappedRange().slice();return A.destroy(),new w(S)}dispose(){this._samplerCache.clear()}_getDefaultTextureGPU(e){let t=this.defaultTexture[e];if(t===void 0){let n=new Hs;n.minFilter=Ti,n.magFilter=Ti,this.createTexture(n,{width:1,height:1,format:e}),this.defaultTexture[e]=t=n}return this.backend.get(t).texture}_getDefaultCubeTextureGPU(e){let t=this.defaultCubeTexture[e];if(t===void 0){let n=new Dh;n.minFilter=Ti,n.magFilter=Ti,this.createTexture(n,{width:1,height:1,depth:6}),this.defaultCubeTexture[e]=t=n}return this.backend.get(t).texture}_copyCubeMapToTexture(e,t,n){let r=e.images,s=e.mipmaps;for(let o=0;o<6;o++){let a=r[o],l=e.flipY===!0?FPe[o]:o;a.isDataTexture?this._copyBufferToTexture(a.image,t,n,l,e.flipY):this._copyImageToTexture(a,t,n,l,e.flipY,e.premultiplyAlpha);for(let c=0;c<s.length;c++){let f=s[c].images[o];f.isDataTexture?this._copyBufferToTexture(f.image,t,n,l,e.flipY,0,c+1):this._copyImageToTexture(f,t,n,l,e.flipY,e.premultiplyAlpha,c+1)}}}_copyImageToTexture(e,t,n,r,s,o,a=0){let l=this.backend.device,c=a>0?e.width:n.size.width,u=a>0?e.height:n.size.height;jR.source=e,jR.flipY=s,Q_.texture=t,Q_.mipLevel=a,Q_.origin.z=r,Q_.premultipliedAlpha=o,Aa.width=c,Aa.height=u;try{l.queue.copyExternalImageToTexture(jR,Q_,Aa)}catch{}finally{jR.reset(),Q_.reset(),Aa.reset()}}_getPassUtils(){let e=this._passUtils;return e===null&&(this._passUtils=e=new L9(this.backend.device)),e}_generateMipmaps(e,t=null){this._getPassUtils().generateMipmaps(e,t)}_flipY(e,t,n=0){this._getPassUtils().flipY(e,t,n)}_copyBufferToTexture(e,t,n,r,s,o=0,a=0){let l=this.backend.device,c=e.data,u=this._getBytesPerTexel(n.format),f=e.width*u;va.texture=t,va.mipLevel=a,va.origin.z=r,Yd.offset=e.width*e.height*u*o,Yd.bytesPerRow=f,Aa.width=e.width,Aa.height=e.height,l.queue.writeTexture(va,c,Yd,Aa),va.reset(),Yd.reset(),Aa.reset(),s===!0&&this._flipY(t,n,r)}_copyCompressedBufferToTexture(e,t,n,r=null){let s=this.backend.device,o=this._getBlockData(n.format),a=n.size.depthOrArrayLayers>1,l=r&&r.size>0?r:null;for(let c=0;c<e.length;c++){let u=e[c],f=u.width,d=u.height,A=a?n.size.depthOrArrayLayers:1,y=Math.ceil(f/o.width)*o.byteLength,w=Math.ceil(d/o.height),S=y*w,T=Math.ceil(f/o.width)*o.width,R=w*o.height;if(l!==null)for(let P of l)Qte(s,t,c,P,u,S,y,w,T,R);else for(let P=0;P<A;P++)Qte(s,t,c,P,u,S,y,w,T,R)}}_getBlockData(e){if(e===fe.BC1RGBAUnorm||e===fe.BC1RGBAUnormSRGB)return{byteLength:8,width:4,height:4};if(e===fe.BC2RGBAUnorm||e===fe.BC2RGBAUnormSRGB)return{byteLength:16,width:4,height:4};if(e===fe.BC3RGBAUnorm||e===fe.BC3RGBAUnormSRGB)return{byteLength:16,width:4,height:4};if(e===fe.BC4RUnorm||e===fe.BC4RSnorm)return{byteLength:8,width:4,height:4};if(e===fe.BC5RGUnorm||e===fe.BC5RGSnorm)return{byteLength:16,width:4,height:4};if(e===fe.BC6HRGBUFloat||e===fe.BC6HRGBFloat)return{byteLength:16,width:4,height:4};if(e===fe.BC7RGBAUnorm||e===fe.BC7RGBAUnormSRGB)return{byteLength:16,width:4,height:4};if(e===fe.ETC2RGB8Unorm||e===fe.ETC2RGB8UnormSRGB)return{byteLength:8,width:4,height:4};if(e===fe.ETC2RGB8A1Unorm||e===fe.ETC2RGB8A1UnormSRGB)return{byteLength:8,width:4,height:4};if(e===fe.ETC2RGBA8Unorm||e===fe.ETC2RGBA8UnormSRGB)return{byteLength:16,width:4,height:4};if(e===fe.EACR11Unorm)return{byteLength:8,width:4,height:4};if(e===fe.EACR11Snorm)return{byteLength:8,width:4,height:4};if(e===fe.EACRG11Unorm)return{byteLength:16,width:4,height:4};if(e===fe.EACRG11Snorm)return{byteLength:16,width:4,height:4};if(e===fe.ASTC4x4Unorm||e===fe.ASTC4x4UnormSRGB)return{byteLength:16,width:4,height:4};if(e===fe.ASTC5x4Unorm||e===fe.ASTC5x4UnormSRGB)return{byteLength:16,width:5,height:4};if(e===fe.ASTC5x5Unorm||e===fe.ASTC5x5UnormSRGB)return{byteLength:16,width:5,height:5};if(e===fe.ASTC6x5Unorm||e===fe.ASTC6x5UnormSRGB)return{byteLength:16,width:6,height:5};if(e===fe.ASTC6x6Unorm||e===fe.ASTC6x6UnormSRGB)return{byteLength:16,width:6,height:6};if(e===fe.ASTC8x5Unorm||e===fe.ASTC8x5UnormSRGB)return{byteLength:16,width:8,height:5};if(e===fe.ASTC8x6Unorm||e===fe.ASTC8x6UnormSRGB)return{byteLength:16,width:8,height:6};if(e===fe.ASTC8x8Unorm||e===fe.ASTC8x8UnormSRGB)return{byteLength:16,width:8,height:8};if(e===fe.ASTC10x5Unorm||e===fe.ASTC10x5UnormSRGB)return{byteLength:16,width:10,height:5};if(e===fe.ASTC10x6Unorm||e===fe.ASTC10x6UnormSRGB)return{byteLength:16,width:10,height:6};if(e===fe.ASTC10x8Unorm||e===fe.ASTC10x8UnormSRGB)return{byteLength:16,width:10,height:8};if(e===fe.ASTC10x10Unorm||e===fe.ASTC10x10UnormSRGB)return{byteLength:16,width:10,height:10};if(e===fe.ASTC12x10Unorm||e===fe.ASTC12x10UnormSRGB)return{byteLength:16,width:12,height:10};if(e===fe.ASTC12x12Unorm||e===fe.ASTC12x12UnormSRGB)return{byteLength:16,width:12,height:12}}_convertAddressMode(e){let t=cU.ClampToEdge;return e===Md?t=cU.Repeat:e===Cd&&(t=cU.MirrorRepeat),t}_convertFilterMode(e){let t=eu.Linear;return(e===Ti||e===Db||e===jc)&&(t=eu.Nearest),t}_convertMipmapFilterMode(e){return e===jc||e===Vo?eu.Linear:eu.Nearest}_getBytesPerTexel(e){if(e===fe.R8Unorm||e===fe.R8Snorm||e===fe.R8Uint||e===fe.R8Sint)return 1;if(e===fe.R16Uint||e===fe.R16Sint||e===fe.R16Float||e===fe.RG8Unorm||e===fe.RG8Snorm||e===fe.RG8Uint||e===fe.RG8Sint||e===fe.R16Unorm||e===fe.R16Snorm)return 2;if(e===fe.R32Uint||e===fe.R32Sint||e===fe.R32Float||e===fe.RG16Uint||e===fe.RG16Sint||e===fe.RG16Float||e===fe.RGBA8Unorm||e===fe.RGBA8UnormSRGB||e===fe.RGBA8Snorm||e===fe.RGBA8Uint||e===fe.RGBA8Sint||e===fe.BGRA8Unorm||e===fe.BGRA8UnormSRGB||e===fe.RG16Unorm||e===fe.RG16Snorm||e===fe.RGB9E5UFloat||e===fe.RGB10A2Unorm||e===fe.RG11B10UFloat||e===fe.Depth32Float||e===fe.Depth24Plus||e===fe.Depth24PlusStencil8||e===fe.Depth32FloatStencil8)return 4;if(e===fe.RG32Uint||e===fe.RG32Sint||e===fe.RG32Float||e===fe.RGBA16Uint||e===fe.RGBA16Sint||e===fe.RGBA16Float||e===fe.RGBA16Unorm||e===fe.RGBA16Snorm)return 8;if(e===fe.RGBA32Uint||e===fe.RGBA32Sint||e===fe.RGBA32Float)return 16}_getTypedArrayType(e){if(e===fe.R8Uint)return Uint8Array;if(e===fe.R8Sint)return Int8Array;if(e===fe.R8Unorm)return Uint8Array;if(e===fe.R8Snorm)return Int8Array;if(e===fe.RG8Uint)return Uint8Array;if(e===fe.RG8Sint)return Int8Array;if(e===fe.RG8Unorm)return Uint8Array;if(e===fe.RG8Snorm)return Int8Array;if(e===fe.RGBA8Uint)return Uint8Array;if(e===fe.RGBA8Sint)return Int8Array;if(e===fe.RGBA8Unorm||e===fe.RGBA8UnormSRGB)return Uint8Array;if(e===fe.RGBA8Snorm)return Int8Array;if(e===fe.R16Uint)return Uint16Array;if(e===fe.R16Sint)return Int16Array;if(e===fe.RG16Uint)return Uint16Array;if(e===fe.RG16Sint)return Int16Array;if(e===fe.RGBA16Uint)return Uint16Array;if(e===fe.RGBA16Sint)return Int16Array;if(e===fe.R16Float||e===fe.RG16Float||e===fe.RGBA16Float||e===fe.R16Unorm)return Uint16Array;if(e===fe.R16Snorm)return Int16Array;if(e===fe.RG16Unorm)return Uint16Array;if(e===fe.RG16Snorm)return Int16Array;if(e===fe.RGBA16Unorm)return Uint16Array;if(e===fe.RGBA16Snorm)return Int16Array;if(e===fe.R32Uint)return Uint32Array;if(e===fe.R32Sint)return Int32Array;if(e===fe.R32Float)return Float32Array;if(e===fe.RG32Uint)return Uint32Array;if(e===fe.RG32Sint)return Int32Array;if(e===fe.RG32Float)return Float32Array;if(e===fe.RGBA32Uint)return Uint32Array;if(e===fe.RGBA32Sint)return Int32Array;if(e===fe.RGBA32Float)return Float32Array;if(e===fe.BGRA8Unorm||e===fe.BGRA8UnormSRGB)return Uint8Array;if(e===fe.RGB10A2Unorm||e===fe.RGB9E5UFloat||e===fe.RG11B10UFloat)return Uint32Array;if(e===fe.Depth32Float)return Float32Array;if(e===fe.Depth24Plus||e===fe.Depth24PlusStencil8)return Uint32Array;if(e===fe.Depth32FloatStencil8)return Float32Array}_getDimension(e){let t;return e.is3DTexture||e.isData3DTexture?t=Zte.ThreeD:t=Zte.TwoD,t}};function k9(i,e){let t=i.format,n=i.type,r=i.normalized,s=i.colorSpace,o=ln.getTransfer(s),a,l=!1;if(r&&(l=e.features.has(lI.TextureFormatsTier1),l===!1&&Xe("WebGPURenderer: Unable to use normalized textures without texture-formats-tier1 feature.")),i.isCompressedTexture===!0||i.isCompressedArrayTexture===!0)switch(t){case Hh:case Wh:a=o===kt?fe.BC1RGBAUnormSRGB:fe.BC1RGBAUnorm;break;case jh:a=o===kt?fe.BC2RGBAUnormSRGB:fe.BC2RGBAUnorm;break;case Xh:a=o===kt?fe.BC3RGBAUnormSRGB:fe.BC3RGBAUnorm;break;case G0:a=fe.BC4RUnorm;break;case q0:a=fe.BC4RSnorm;break;case Yh:a=fe.BC5RGUnorm;break;case H0:a=fe.BC5RGSnorm;break;case k0:a=o===kt?fe.BC7RGBAUnormSRGB:fe.BC7RGBAUnorm;break;case z0:a=fe.BC6HRGBFloat;break;case V0:a=fe.BC6HRGBUFloat;break;case x0:case _0:a=o===kt?fe.ETC2RGB8UnormSRGB:fe.ETC2RGB8Unorm;break;case y0:a=o===kt?fe.ETC2RGBA8UnormSRGB:fe.ETC2RGBA8Unorm;break;case b0:a=fe.EACR11Unorm;break;case w0:a=fe.EACR11Snorm;break;case $h:a=fe.EACRG11Unorm;break;case S0:a=fe.EACRG11Snorm;break;case T0:a=o===kt?fe.ASTC4x4UnormSRGB:fe.ASTC4x4Unorm;break;case E0:a=o===kt?fe.ASTC5x4UnormSRGB:fe.ASTC5x4Unorm;break;case M0:a=o===kt?fe.ASTC5x5UnormSRGB:fe.ASTC5x5Unorm;break;case C0:a=o===kt?fe.ASTC6x5UnormSRGB:fe.ASTC6x5Unorm;break;case R0:a=o===kt?fe.ASTC6x6UnormSRGB:fe.ASTC6x6Unorm;break;case I0:a=o===kt?fe.ASTC8x5UnormSRGB:fe.ASTC8x5Unorm;break;case P0:a=o===kt?fe.ASTC8x6UnormSRGB:fe.ASTC8x6Unorm;break;case L0:a=o===kt?fe.ASTC8x8UnormSRGB:fe.ASTC8x8Unorm;break;case D0:a=o===kt?fe.ASTC10x5UnormSRGB:fe.ASTC10x5Unorm;break;case N0:a=o===kt?fe.ASTC10x6UnormSRGB:fe.ASTC10x6Unorm;break;case F0:a=o===kt?fe.ASTC10x8UnormSRGB:fe.ASTC10x8Unorm;break;case B0:a=o===kt?fe.ASTC10x10UnormSRGB:fe.ASTC10x10Unorm;break;case O0:a=o===kt?fe.ASTC12x10UnormSRGB:fe.ASTC12x10Unorm;break;case U0:a=o===kt?fe.ASTC12x12UnormSRGB:fe.ASTC12x12Unorm;break;case Or:a=o===kt?fe.RGBA8UnormSRGB:fe.RGBA8Unorm;break;default:ze("WebGPURenderer: Unsupported texture format.",t)}else switch(t){case Or:switch(n){case zh:a=fe.RGBA8Snorm;break;case Vh:a=l?fe.RGBA16Snorm:fe.RGBA16Sint;break;case wl:a=l?fe.RGBA16Unorm:fe.RGBA16Uint;break;case xi:a=fe.RGBA32Uint;break;case Zr:a=fe.RGBA32Sint;break;case Ji:a=o===kt?fe.RGBA8UnormSRGB:fe.RGBA8Unorm;break;case Wi:a=fe.RGBA16Float;break;case cr:a=fe.RGBA32Float;break;default:ze("WebGPURenderer: Unsupported texture type with RGBAFormat.",n)}break;case Fd:switch(n){case og:a=fe.RGB9E5UFloat;break;case ag:a=fe.RG11B10UFloat;break;default:ze("WebGPURenderer: Unsupported texture type with RGBFormat.",n)}break;case Bd:switch(n){case zh:a=fe.R8Snorm;break;case Vh:a=l?fe.R16Snorm:fe.R16Sint;break;case wl:a=l?fe.R16Unorm:fe.R16Uint;break;case xi:a=fe.R32Uint;break;case Zr:a=fe.R32Sint;break;case Ji:a=fe.R8Unorm;break;case Wi:a=fe.R16Float;break;case cr:a=fe.R32Float;break;default:ze("WebGPURenderer: Unsupported texture type with RedFormat.",n)}break;case js:switch(n){case zh:a=fe.RG8Snorm;break;case Vh:a=l?fe.RG16Snorm:fe.RG16Sint;break;case wl:a=l?fe.RG16Unorm:fe.RG16Uint;break;case xi:a=fe.RG32Uint;break;case Zr:a=fe.RG32Sint;break;case Ji:a=fe.RG8Unorm;break;case Wi:a=fe.RG16Float;break;case cr:a=fe.RG32Float;break;default:ze("WebGPURenderer: Unsupported texture type with RGFormat.",n)}break;case Gs:switch(n){case wl:a=fe.Depth16Unorm;break;case xi:a=fe.Depth24Plus;break;case cr:a=fe.Depth32Float;break;default:ze("WebGPURenderer: Unsupported texture type with DepthFormat.",n)}break;case xo:switch(n){case ca:a=fe.Depth24PlusStencil8;break;case cr:e&&e.features.has(lI.Depth32FloatStencil8)===!1&&ze('WebGPURenderer: Depth textures with DepthStencilFormat + FloatType can only be used with the "depth32float-stencil8" GPU feature.'),a=fe.Depth32FloatStencil8;break;default:ze("WebGPURenderer: Unsupported texture type with DepthStencilFormat.",n)}break;case Gh:switch(n){case Zr:a=fe.R32Sint;break;case xi:a=fe.R32Uint;break;default:ze("WebGPURenderer: Unsupported texture type with RedIntegerFormat.",n)}break;case qh:switch(n){case Zr:a=fe.RG32Sint;break;case xi:a=fe.RG32Uint;break;default:ze("WebGPURenderer: Unsupported texture type with RGIntegerFormat.",n)}break;case v0:switch(n){case Zr:a=fe.RGBA32Sint;break;case xi:a=fe.RGBA32Uint;break;default:ze("WebGPURenderer: Unsupported texture type with RGBAIntegerFormat.",n)}break;default:ze("WebGPURenderer: Unsupported texture format.",t)}return a}var BPe=/^[fn]*\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)\s*[\-\>]*\s*([a-z_0-9]+(?:<[\s\S]+?>)?)/i,OPe=/([a-z_0-9]+)\s*:\s*([a-z_0-9]+(?:<[\s\S]+?>)?)/ig,Jte={f32:"float",i32:"int",u32:"uint",bool:"bool","vec2<f32>":"vec2","vec2<i32>":"ivec2","vec2<u32>":"uvec2","vec2<bool>":"bvec2",vec2f:"vec2",vec2i:"ivec2",vec2u:"uvec2",vec2b:"bvec2","vec3<f32>":"vec3","vec3<i32>":"ivec3","vec3<u32>":"uvec3","vec3<bool>":"bvec3",vec3f:"vec3",vec3i:"ivec3",vec3u:"uvec3",vec3b:"bvec3","vec4<f32>":"vec4","vec4<i32>":"ivec4","vec4<u32>":"uvec4","vec4<bool>":"bvec4",vec4f:"vec4",vec4i:"ivec4",vec4u:"uvec4",vec4b:"bvec4","mat2x2<f32>":"mat2",mat2x2f:"mat2","mat3x3<f32>":"mat3",mat3x3f:"mat3","mat4x4<f32>":"mat4",mat4x4f:"mat4",sampler:"sampler",texture_1d:"texture",texture_2d:"texture",texture_2d_array:"texture",texture_multisampled_2d:"cubeTexture",texture_depth_2d:"depthTexture",texture_depth_2d_array:"depthTexture",texture_depth_multisampled_2d:"depthTexture",texture_depth_cube:"depthTexture",texture_depth_cube_array:"depthTexture",texture_3d:"texture3D",texture_cube:"cubeTexture",texture_cube_array:"cubeTexture",texture_storage_1d:"storageTexture",texture_storage_2d:"storageTexture",texture_storage_2d_array:"storageTexture",texture_storage_3d:"storageTexture"},UPe=i=>{i=i.trim();let e=i.match(BPe);if(e!==null&&e.length===4){let t=e[2],n=[],r=null;for(;(r=OPe.exec(t))!==null;)n.push({name:r[1],type:r[2]});let s=[];for(let u=0;u<n.length;u++){let{name:f,type:d}=n[u],A=d;A.startsWith("ptr")?A="pointer":(A.startsWith("texture")&&(A=d.split("<")[0]),A=Jte[A]),s.push(new RS(A,f))}let o=i.substring(e[0].length),a=e[3]||"void",l=e[1]!==void 0?e[1]:"";return{type:Jte[a]||a,inputs:s,name:l,inputsCode:t,blockCode:o,outputType:a}}else throw new Error("THREE.WGSLNodeFunction: Function is not a WGSL code.")},z9=class extends PS{constructor(e){let{type:t,inputs:n,name:r,inputsCode:s,blockCode:o,outputType:a}=UPe(e);super(t,n,r),this.inputsCode=s,this.blockCode=o,this.outputType=a}getCode(e=this.name){let t=this.outputType!=="void"?"-> "+this.outputType:"";return`fn ${e} ( ${this.inputsCode.trim()} ) ${t}`+this.blockCode}},V9=class extends $4{parseFunction(e){return new z9(e)}},kPe={[$o.READ_ONLY]:"read",[$o.WRITE_ONLY]:"write",[$o.READ_WRITE]:"read_write"},ene={[Md]:"repeat",[aa]:"clamp",[Cd]:"mirror"},mU={vertex:Sf.VERTEX,fragment:Sf.FRAGMENT,compute:Sf.COMPUTE},tne={instance:!0,swizzleAssign:!1,storageBuffer:!0},zPe={"^^":"tsl_xor"},VPe={float:"f32",int:"i32",uint:"u32",bool:"bool",color:"vec3<f32>",vec2:"vec2<f32>",ivec2:"vec2<i32>",uvec2:"vec2<u32>",bvec2:"vec2<bool>",vec3:"vec3<f32>",ivec3:"vec3<i32>",uvec3:"vec3<u32>",bvec3:"vec3<bool>",vec4:"vec4<f32>",ivec4:"vec4<i32>",uvec4:"vec4<u32>",bvec4:"vec4<bool>",mat2:"mat2x2<f32>",mat3:"mat3x3<f32>",mat4:"mat4x4<f32>"},nne={},Qw={tsl_xor:new hr("fn tsl_xor( a : bool, b : bool ) -> bool { return ( a || b ) && !( a && b ); }"),mod_float:new hr("fn tsl_mod_float( x : f32, y : f32 ) -> f32 { return x - y * floor( x / y ); }"),mod_vec2:new hr("fn tsl_mod_vec2( x : vec2f, y : vec2f ) -> vec2f { return x - y * floor( x / y ); }"),mod_vec3:new hr("fn tsl_mod_vec3( x : vec3f, y : vec3f ) -> vec3f { return x - y * floor( x / y ); }"),mod_vec4:new hr("fn tsl_mod_vec4( x : vec4f, y : vec4f ) -> vec4f { return x - y * floor( x / y ); }"),equals_bool:new hr("fn tsl_equals_bool( a : bool, b : bool ) -> bool { return a == b; }"),equals_bvec2:new hr("fn tsl_equals_bvec2( a : vec2f, b : vec2f ) -> vec2<bool> { return vec2<bool>( a.x == b.x, a.y == b.y ); }"),equals_bvec3:new hr("fn tsl_equals_bvec3( a : vec3f, b : vec3f ) -> vec3<bool> { return vec3<bool>( a.x == b.x, a.y == b.y, a.z == b.z ); }"),equals_bvec4:new hr("fn tsl_equals_bvec4( a : vec4f, b : vec4f ) -> vec4<bool> { return vec4<bool>( a.x == b.x, a.y == b.y, a.z == b.z, a.w == b.w ); }"),repeatWrapping_float:new hr("fn tsl_repeatWrapping_float( coord: f32 ) -> f32 { return fract( coord ); }"),mirrorWrapping_float:new hr("fn tsl_mirrorWrapping_float( coord: f32 ) -> f32 { let mirrored = fract( coord * 0.5 ) * 2.0; return 1.0 - abs( 1.0 - mirrored ); }"),clampWrapping_float:new hr("fn tsl_clampWrapping_float( coord: f32 ) -> f32 { return clamp( coord, 0.0, 1.0 ); }"),inverse_mat2:new hr(`44454445 fn tsl_inverse_mat2( m : mat2x2<f32> ) -> mat2x2<f32> {44464446 44474447 let det = m[ 0 ][ 0 ] * m[ 1 ][ 1 ] - m[ 0 ][ 1 ] * m[ 1 ][ 0 ];@@ -4559,17 +4559,17 @@ fn tsl_biquadraticTexture_array( map : texture_2d_array<f32>, coord : vec2f, iRe
45594559 return mix( mix( rg1, rg2, f.x ), mix( rg3, rg4, f.x ), f.y );45604560 45614561 }4562-`)},bPe={dFdx:"dpdx",dFdy:"- dpdy",mod_float:"tsl_mod_float",mod_vec2:"tsl_mod_vec2",mod_vec3:"tsl_mod_vec3",mod_vec4:"tsl_mod_vec4",equals_bool:"tsl_equals_bool",equals_bvec2:"tsl_equals_bvec2",equals_bvec3:"tsl_equals_bvec3",equals_bvec4:"tsl_equals_bvec4",inverse_mat2:"tsl_inverse_mat2",inverse_mat3:"tsl_inverse_mat3",inverse_mat4:"tsl_inverse_mat4",inversesqrt:"inverseSqrt",bitcast:"bitcast<f32>",floatpack_snorm_2x16:"pack2x16snorm",floatpack_unorm_2x16:"pack2x16unorm",floatpack_float16_2x16:"pack2x16float",floatunpack_snorm_2x16:"unpack2x16snorm",floatunpack_unorm_2x16:"unpack2x16unorm",floatunpack_float16_2x16:"unpack2x16float"},soe="";(typeof navigator<"u"&&/Firefox|Deno/g.test(navigator.userAgent))!==!0&&(soe+=`diagnostic( off, derivative_uniformity );4563-`);var N9=class extends G4{constructor(e,t){super(e,t,new D9),this.uniformGroups={},this.uniformGroupsBindings={},this.builtins={},this.directives={},this.scopedArrays=new Map,this.allowEarlyReturns=!0,this.allowGlobalVariables=!0}_generateTextureSample(e,t,n,r,s,o=this.shaderStage){return o==="fragment"?r?s?`textureSample( ${t}, ${t}_sampler, ${n}, ${r}, ${s} )`:`textureSample( ${t}, ${t}_sampler, ${n}, ${r} )`:s?`textureSample( ${t}, ${t}_sampler, ${n}, ${s} )`:`textureSample( ${t}, ${t}_sampler, ${n} )`:this.generateTextureSampleLevel(e,t,n,"0",r)}generateTextureSampleLevel(e,t,n,r,s,o){return this.isUnfilterable(e)===!1?s?o?`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${s}, ${r}, ${o} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${s}, ${r} )`:o?`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${r}, ${o} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${r} )`:this.isFilteredTexture(e)?this.generateFilteredTexture(e,t,n,o,r,s):this.generateTextureLod(e,t,n,s,o,r)}generateWrapFunction(e){let t=`tsl_coord_${Wte[e.wrapS]}S_${Wte[e.wrapT]}T_${e.is3DTexture||e.isData3DTexture?"3d":"2d"}`,n=Xte[t];if(n===void 0){let r=[],s=e.is3DTexture||e.isData3DTexture?"vec3f":"vec2f",o=`fn ${t}( coord : ${s} ) -> ${s} {4562+`)},GPe={dFdx:"dpdx",dFdy:"- dpdy",mod_float:"tsl_mod_float",mod_vec2:"tsl_mod_vec2",mod_vec3:"tsl_mod_vec3",mod_vec4:"tsl_mod_vec4",equals_bool:"tsl_equals_bool",equals_bvec2:"tsl_equals_bvec2",equals_bvec3:"tsl_equals_bvec3",equals_bvec4:"tsl_equals_bvec4",inverse_mat2:"tsl_inverse_mat2",inverse_mat3:"tsl_inverse_mat3",inverse_mat4:"tsl_inverse_mat4",inversesqrt:"inverseSqrt",bitcast:"bitcast<f32>",floatpack_snorm_2x16:"pack2x16snorm",floatpack_unorm_2x16:"pack2x16unorm",floatpack_float16_2x16:"pack2x16float",floatunpack_snorm_2x16:"unpack2x16snorm",floatunpack_unorm_2x16:"unpack2x16unorm",floatunpack_float16_2x16:"unpack2x16float"},poe="";(typeof navigator<"u"&&/Firefox|Deno/g.test(navigator.userAgent))!==!0&&(poe+=`diagnostic( off, derivative_uniformity );4563+`);var G9=class extends j4{constructor(e,t){super(e,t,new V9),this.uniformGroups={},this.uniformGroupsBindings={},this.builtins={},this.directives={},this.scopedArrays=new Map,this.allowEarlyReturns=!0,this.allowGlobalVariables=!0}_generateTextureSample(e,t,n,r,s,o=this.shaderStage){return o==="fragment"?r?s?`textureSample( ${t}, ${t}_sampler, ${n}, ${r}, ${s} )`:`textureSample( ${t}, ${t}_sampler, ${n}, ${r} )`:s?`textureSample( ${t}, ${t}_sampler, ${n}, ${s} )`:`textureSample( ${t}, ${t}_sampler, ${n} )`:this.generateTextureSampleLevel(e,t,n,"0",r)}generateTextureSampleLevel(e,t,n,r,s,o){return this.isUnfilterable(e)===!1?s?o?`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${s}, ${r}, ${o} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${s}, ${r} )`:o?`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${r}, ${o} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${r} )`:this.isFilteredTexture(e)?this.generateFilteredTexture(e,t,n,o,r,s):this.generateTextureLod(e,t,n,s,o,r)}generateWrapFunction(e){let t=`tsl_coord_${ene[e.wrapS]}S_${ene[e.wrapT]}T_${e.is3DTexture||e.isData3DTexture?"3d":"2d"}`,n=nne[t];if(n===void 0){let r=[],s=e.is3DTexture||e.isData3DTexture?"vec3f":"vec2f",o=`fn ${t}( coord : ${s} ) -> ${s} {45644564 45654565 return ${s}(4566-`,a=(l,c)=>{l===Cd?(r.push($w.repeatWrapping_float),o+=` tsl_repeatWrapping_float( coord.${c} )`):l===aa?(r.push($w.clampWrapping_float),o+=` tsl_clampWrapping_float( coord.${c} )`):l===Rd?(r.push($w.mirrorWrapping_float),o+=` tsl_mirrorWrapping_float( coord.${c} )`):(o+=` coord.${c}`,Xe(`WebGPURenderer: Unsupported texture wrap type "${l}" for vertex shader.`))};a(e.wrapS,"x"),o+=`,4566+`,a=(l,c)=>{l===Md?(r.push(Qw.repeatWrapping_float),o+=` tsl_repeatWrapping_float( coord.${c} )`):l===aa?(r.push(Qw.clampWrapping_float),o+=` tsl_clampWrapping_float( coord.${c} )`):l===Cd?(r.push(Qw.mirrorWrapping_float),o+=` tsl_mirrorWrapping_float( coord.${c} )`):(o+=` coord.${c}`,Xe(`WebGPURenderer: Unsupported texture wrap type "${l}" for vertex shader.`))};a(e.wrapS,"x"),o+=`,45674567 `,a(e.wrapT,"y"),(e.is3DTexture||e.isData3DTexture)&&(o+=`,45684568 `,a(e.wrapR,"z")),o+=`45694569 );45704570 45714571 }4572-`,Xte[t]=n=new hr(o,r)}return n.build(this),t}generateArrayDeclaration(e,t){return`array< ${this.getType(e)}, ${t} >`}generateTextureDimension(e,t,n){let r=this.getDataFromNode(e,this.shaderStage,this.cache);r.dimensionsSnippet===void 0&&(r.dimensionsSnippet={});let s=r.dimensionsSnippet[n];if(r.dimensionsSnippet[n]===void 0){let o,a,{primarySamples:l}=this.renderer.backend.utils.getTextureSampleData(e),c=l>1;e.is3DTexture||e.isData3DTexture?a="vec3<u32>":a="vec2<u32>",c||e.isStorageTexture?o=t:o=`${t}${n?`, u32( ${n} )`:""}`,s=new ax(new cx(`textureDimensions( ${o} )`,a)),r.dimensionsSnippet[n]=s,(e.isArrayTexture||e.isDataArrayTexture||e.is3DTexture||e.isData3DTexture)&&(r.arrayLayerCount=new ax(new cx(`textureNumLayers(${t})`,"u32"))),e.isTextureCube&&(r.cubeFaceCount=new ax(new cx("6u","u32")))}return s.build(this)}generateFilteredTexture(e,t,n,r,s="0u",o){let a=this.generateWrapFunction(e),l=this.generateTextureDimension(e,t,s);return r&&(n=`${n} + vec2<f32>(${r}) / ${l}`),o?(this._include("biquadraticTextureArray"),`tsl_biquadraticTexture_array( ${t}, ${a}( ${n} ), ${l}, u32( ${o} ), u32( ${s} ) )`):(this._include("biquadraticTexture"),`tsl_biquadraticTexture( ${t}, ${a}( ${n} ), ${l}, u32( ${s} ) )`)}generateTextureLod(e,t,n,r,s,o="0u"){if(e.isCubeTexture===!0){s&&(n=`${n} + vec3<f32>(${s})`);let A=e.isDepthTexture?"u32":"f32";return`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${A}( ${o} ) )`}let a=this.generateWrapFunction(e),l=this.generateTextureDimension(e,t,o),c=e.is3DTexture||e.isData3DTexture?"vec3":"vec2",u=c==="vec3"?"vec3<u32>( 1, 1, 1 )":"vec2<u32>( 1, 1 )";s&&(n=`${n} + ${c}<f32>(${s}) / ${c}<f32>( ${l} )`);let f=`${c}<f32>( 0 )`,d=`${c}<f32>( ${l} - ${u} )`;return n=`${c}<u32>( clamp( floor( ${a}( ${n} ) * ${c}<f32>( ${l} ) ), ${f}, ${d} ) )`,this.generateTextureLoad(e,t,n,o,r,null)}generateStorageTextureLoad(e,t,n,r,s,o){o&&(n=`${n} + ${o}`);let a;return s?a=`textureLoad( ${t}, ${n}, ${s} )`:a=`textureLoad( ${t}, ${n} )`,a}generateTextureLoad(e,t,n,r,s,o){r===null&&(r="0u"),o&&(n=`${n} + ${o}`);let a;return s?a=`textureLoad( ${t}, ${n}, ${s}, u32( ${r} ) )`:(a=`textureLoad( ${t}, ${n}, u32( ${r} ) )`,this.renderer.backend.compatibilityMode&&e.isDepthTexture&&(a+=".x")),a}generateTextureStore(e,t,n,r,s){let o;return r?o=`textureStore( ${t}, ${n}, ${r}, ${s} )`:o=`textureStore( ${t}, ${n}, ${s} )`,o}isSampleCompare(e){return e.isDepthTexture===!0&&e.compareFunction!==null&&this.renderer.hasCompatibility(Ud.TEXTURE_COMPARE)}isUnfilterable(e){return this.getComponentTypeFromTexture(e)!=="float"||!this.isAvailable("float32Filterable")&&e.type===cr||this.isSampleCompare(e)===!1&&e.minFilter===Ti&&e.magFilter===Ti||this.renderer.backend.utils.getTextureSampleData(e).primarySamples>1}generateTexture(e,t,n,r,s,o=this.shaderStage){let a=null;return this.isUnfilterable(e)?a=this.generateTextureLod(e,t,n,r,s,"0",o):a=this._generateTextureSample(e,t,n,r,s,o),a}generateTextureGrad(e,t,n,r,s,o,a=this.shaderStage){if(a==="fragment")return s?o?`textureSampleGrad( ${t}, ${t}_sampler, ${n}, ${s}, ${r[0]}, ${r[1]}, ${o} )`:`textureSampleGrad( ${t}, ${t}_sampler, ${n}, ${s}, ${r[0]}, ${r[1]} )`:o?`textureSampleGrad( ${t}, ${t}_sampler, ${n}, ${r[0]}, ${r[1]}, ${o} )`:`textureSampleGrad( ${t}, ${t}_sampler, ${n}, ${r[0]}, ${r[1]} )`;ze(`WebGPURenderer: THREE.TextureNode.gradient() does not support ${a} shader.`)}generateTextureCompare(e,t,n,r,s,o,a=this.shaderStage){if(a==="fragment")return e.isDepthTexture===!0&&e.isArrayTexture===!0?o?`textureSampleCompare( ${t}, ${t}_sampler, ${n}, ${s}, ${r}, ${o} )`:`textureSampleCompare( ${t}, ${t}_sampler, ${n}, ${s}, ${r} )`:o?`textureSampleCompare( ${t}, ${t}_sampler, ${n}, ${r}, ${o} )`:`textureSampleCompare( ${t}, ${t}_sampler, ${n}, ${r} )`;ze(`WebGPURenderer: THREE.DepthTexture.compareFunction() does not support ${a} shader.`)}generateTextureGather(e,t,n,r,s,o){let a=e.isDepthTexture===!0?"":`${r}, `;return s?o?`textureGather( ${a}${t}, ${t}_sampler, ${n}, ${s}, ${o} )`:`textureGather( ${a}${t}, ${t}_sampler, ${n}, ${s} )`:o?`textureGather( ${a}${t}, ${t}_sampler, ${n}, ${o} )`:`textureGather( ${a}${t}, ${t}_sampler, ${n})`}generateTextureGatherCompare(e,t,n,r,s,o){return s?o?`textureGatherCompare( ${t}, ${t}_sampler, ${n}, ${s}, ${r}, ${o} )`:`textureGatherCompare( ${t}, ${t}_sampler, ${n}, ${s}, ${r})`:o?`textureGatherCompare( ${t}, ${t}_sampler, ${n}, ${r}, ${o} )`:`textureGatherCompare( ${t}, ${t}_sampler, ${n}, ${r})`}generateTextureLevel(e,t,n,r,s,o){return this.isUnfilterable(e)===!1?s?o?`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${s}, ${r}, ${o} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${s}, ${r} )`:o?`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${r}, ${o} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${r} )`:this.isFilteredTexture(e)?this.generateFilteredTexture(e,t,n,o,r,s):this.generateTextureLod(e,t,n,s,o,r)}generateTextureBias(e,t,n,r,s,o,a=this.shaderStage){if(a==="fragment")return s?o?`textureSampleBias( ${t}, ${t}_sampler, ${n}, ${s}, ${r}, ${o} )`:`textureSampleBias( ${t}, ${t}_sampler, ${n}, ${s}, ${r} )`:o?`textureSampleBias( ${t}, ${t}_sampler, ${n}, ${r}, ${o} )`:`textureSampleBias( ${t}, ${t}_sampler, ${n}, ${r} )`;ze(`WebGPURenderer: THREE.TextureNode.biasNode does not support ${a} shader.`)}getPropertyName(e,t=this.shaderStage){if(e.isNodeVarying===!0&&e.needsInterpolation===!0){if(t==="vertex")return`varyings.${e.name}`}else if(e.isNodeUniform===!0){let n=e.name,r=e.type;return r==="texture"||r==="cubeTexture"||r==="cubeDepthTexture"||r==="storageTexture"||r==="texture3D"?n:r==="buffer"||r==="storageBuffer"||r==="indirectStorageBuffer"?this.isCustomStruct(e)?n:n+".value":e.groupNode.name+"."+n}return super.getPropertyName(e)}getOutputStructName(){return"output"}getFunctionOperator(e){let t=xPe[e];return t!==void 0?(this._include(t),t):null}getNodeAccess(e,t){return t!=="compute"?e.isAtomic===!0?(Xe("WebGPURenderer: Atomic operations are only supported in compute shaders."),$o.READ_WRITE):$o.READ_ONLY:e.access}getStorageAccess(e,t){return _Pe[this.getNodeAccess(e,t)]}getUniformFromNode(e,t,n,r=null){let s=super.getUniformFromNode(e,t,n,r),o=this.getDataFromNode(e,n,this.globalCache);if(o.uniformGPU===void 0){let a,l=e.groupNode,c=l.name,u=this.getBindGroupArray(c,n);if(t==="texture"||t==="cubeTexture"||t==="cubeDepthTexture"||t==="storageTexture"||t==="texture3D"){let f=null,d=this.getNodeAccess(e,n);if(t==="texture"||t==="storageTexture"?e.value.is3DTexture===!0?f=new CS(s.name,s.node,l,d):f=new vx(s.name,s.node,l,d):t==="cubeTexture"||t==="cubeDepthTexture"?f=new J4(s.name,s.node,l,d):t==="texture3D"&&(f=new CS(s.name,s.node,l,d)),f.store=e.isStorageTextureNode===!0,f.mipLevel=f.store?e.mipLevel:0,f.setVisibility(aU[n]),e.value.isCubeTexture===!0||this.isUnfilterable(e.value)===!1&&f.store===!1||e.gatherNode!==null){let y=new _9(`${s.name}_sampler`,s.node,l);y.setVisibility(aU[n]),u.push(y,f),a=[y,f]}else u.push(f),a=[f]}else if(t==="buffer"||t==="storageBuffer"||t==="indirectStorageBuffer"){let f=this.getSharedDataFromNode(e),d=f.buffer;if(d===void 0){let A=t==="buffer"?Z4:y9;d=new A(e,l),f.buffer=d}d.setVisibility(d.getVisibility()|aU[n]),u.push(d),a=d,s.name=r||"NodeBuffer_"+s.id}else{let f=this.uniformGroups[c];f===void 0&&(f=new K4(c,l),f.setVisibility(wf.VERTEX|wf.FRAGMENT|wf.COMPUTE),this.uniformGroups[c]=f),u.indexOf(f)===-1&&u.push(f),a=this.getNodeUniform(s,t);let d=a.name;f.uniforms.some(y=>y.name===d)||f.addUniform(a)}o.uniformGPU=a}return s}getBuiltin(e,t,n,r=this.shaderStage){let s=this.builtins[r]||(this.builtins[r]=new Map);return s.has(e)===!1&&s.set(e,{name:e,property:t,type:n}),t}hasBuiltin(e,t=this.shaderStage){return this.builtins[t]!==void 0&&this.builtins[t].has(e)}getVertexIndex(){return this.shaderStage==="vertex"?this.getBuiltin("vertex_index","vertexIndex","u32","attribute"):"vertexIndex"}buildFunctionCode(e){let t=e.layout,n=this.flowShaderNode(e),r=[];for(let o of t.inputs)r.push(o.name+" : "+this.getType(o.type));let s=`fn ${t.name}( ${r.join(", ")} ) -> ${this.getType(t.type)} {4572+`,nne[t]=n=new hr(o,r)}return n.build(this),t}generateArrayDeclaration(e,t){return`array< ${this.getType(e)}, ${t} >`}generateTextureDimension(e,t,n){let r=this.getDataFromNode(e,this.shaderStage,this.cache);r.dimensionsSnippet===void 0&&(r.dimensionsSnippet={});let s=r.dimensionsSnippet[n];if(r.dimensionsSnippet[n]===void 0){let o,a,{primarySamples:l}=this.renderer.backend.utils.getTextureSampleData(e),c=l>1;e.is3DTexture||e.isData3DTexture?a="vec3<u32>":a="vec2<u32>",c||e.isStorageTexture?o=t:o=`${t}${n?`, u32( ${n} )`:""}`,s=new cx(new hx(`textureDimensions( ${o} )`,a)),r.dimensionsSnippet[n]=s,(e.isArrayTexture||e.isDataArrayTexture||e.is3DTexture||e.isData3DTexture)&&(r.arrayLayerCount=new cx(new hx(`textureNumLayers(${t})`,"u32"))),e.isTextureCube&&(r.cubeFaceCount=new cx(new hx("6u","u32")))}return s.build(this)}generateFilteredTexture(e,t,n,r,s="0u",o){let a=this.generateWrapFunction(e),l=this.generateTextureDimension(e,t,s);return r&&(n=`${n} + vec2<f32>(${r}) / ${l}`),o?(this._include("biquadraticTextureArray"),`tsl_biquadraticTexture_array( ${t}, ${a}( ${n} ), ${l}, u32( ${o} ), u32( ${s} ) )`):(this._include("biquadraticTexture"),`tsl_biquadraticTexture( ${t}, ${a}( ${n} ), ${l}, u32( ${s} ) )`)}generateTextureLod(e,t,n,r,s,o="0u"){if(e.isCubeTexture===!0){s&&(n=`${n} + vec3<f32>(${s})`);let A=e.isDepthTexture?"u32":"f32";return`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${A}( ${o} ) )`}let a=this.generateWrapFunction(e),l=this.generateTextureDimension(e,t,o),c=e.is3DTexture||e.isData3DTexture?"vec3":"vec2",u=c==="vec3"?"vec3<u32>( 1, 1, 1 )":"vec2<u32>( 1, 1 )";s&&(n=`${n} + ${c}<f32>(${s}) / ${c}<f32>( ${l} )`);let f=`${c}<f32>( 0 )`,d=`${c}<f32>( ${l} - ${u} )`;return n=`${c}<u32>( clamp( floor( ${a}( ${n} ) * ${c}<f32>( ${l} ) ), ${f}, ${d} ) )`,this.generateTextureLoad(e,t,n,o,r,null)}generateStorageTextureLoad(e,t,n,r,s,o){o&&(n=`${n} + ${o}`);let a;return s?a=`textureLoad( ${t}, ${n}, ${s} )`:a=`textureLoad( ${t}, ${n} )`,a}generateTextureLoad(e,t,n,r,s,o){r===null&&(r="0u"),o&&(n=`${n} + ${o}`);let a;return s?a=`textureLoad( ${t}, ${n}, ${s}, u32( ${r} ) )`:(a=`textureLoad( ${t}, ${n}, u32( ${r} ) )`,this.renderer.backend.compatibilityMode&&e.isDepthTexture&&(a+=".x")),a}generateTextureStore(e,t,n,r,s){let o;return r?o=`textureStore( ${t}, ${n}, ${r}, ${s} )`:o=`textureStore( ${t}, ${n}, ${s} )`,o}isSampleCompare(e){return e.isDepthTexture===!0&&e.compareFunction!==null&&this.renderer.hasCompatibility(Od.TEXTURE_COMPARE)}isUnfilterable(e){return this.getComponentTypeFromTexture(e)!=="float"||!this.isAvailable("float32Filterable")&&e.type===cr||this.isSampleCompare(e)===!1&&e.minFilter===Ti&&e.magFilter===Ti||this.renderer.backend.utils.getTextureSampleData(e).primarySamples>1}generateTexture(e,t,n,r,s,o=this.shaderStage){let a=null;return this.isUnfilterable(e)?a=this.generateTextureLod(e,t,n,r,s,"0",o):a=this._generateTextureSample(e,t,n,r,s,o),a}generateTextureGrad(e,t,n,r,s,o,a=this.shaderStage){if(a==="fragment")return s?o?`textureSampleGrad( ${t}, ${t}_sampler, ${n}, ${s}, ${r[0]}, ${r[1]}, ${o} )`:`textureSampleGrad( ${t}, ${t}_sampler, ${n}, ${s}, ${r[0]}, ${r[1]} )`:o?`textureSampleGrad( ${t}, ${t}_sampler, ${n}, ${r[0]}, ${r[1]}, ${o} )`:`textureSampleGrad( ${t}, ${t}_sampler, ${n}, ${r[0]}, ${r[1]} )`;ze(`WebGPURenderer: THREE.TextureNode.gradient() does not support ${a} shader.`)}generateTextureCompare(e,t,n,r,s,o,a=this.shaderStage){if(a==="fragment")return e.isDepthTexture===!0&&e.isArrayTexture===!0?o?`textureSampleCompare( ${t}, ${t}_sampler, ${n}, ${s}, ${r}, ${o} )`:`textureSampleCompare( ${t}, ${t}_sampler, ${n}, ${s}, ${r} )`:o?`textureSampleCompare( ${t}, ${t}_sampler, ${n}, ${r}, ${o} )`:`textureSampleCompare( ${t}, ${t}_sampler, ${n}, ${r} )`;ze(`WebGPURenderer: THREE.DepthTexture.compareFunction() does not support ${a} shader.`)}generateTextureGather(e,t,n,r,s,o){let a=e.isDepthTexture===!0?"":`${r}, `;return s?o?`textureGather( ${a}${t}, ${t}_sampler, ${n}, ${s}, ${o} )`:`textureGather( ${a}${t}, ${t}_sampler, ${n}, ${s} )`:o?`textureGather( ${a}${t}, ${t}_sampler, ${n}, ${o} )`:`textureGather( ${a}${t}, ${t}_sampler, ${n})`}generateTextureGatherCompare(e,t,n,r,s,o){return s?o?`textureGatherCompare( ${t}, ${t}_sampler, ${n}, ${s}, ${r}, ${o} )`:`textureGatherCompare( ${t}, ${t}_sampler, ${n}, ${s}, ${r})`:o?`textureGatherCompare( ${t}, ${t}_sampler, ${n}, ${r}, ${o} )`:`textureGatherCompare( ${t}, ${t}_sampler, ${n}, ${r})`}generateTextureLevel(e,t,n,r,s,o){return this.isUnfilterable(e)===!1?s?o?`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${s}, ${r}, ${o} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${s}, ${r} )`:o?`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${r}, ${o} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${r} )`:this.isFilteredTexture(e)?this.generateFilteredTexture(e,t,n,o,r,s):this.generateTextureLod(e,t,n,s,o,r)}generateTextureBias(e,t,n,r,s,o,a=this.shaderStage){if(a==="fragment")return s?o?`textureSampleBias( ${t}, ${t}_sampler, ${n}, ${s}, ${r}, ${o} )`:`textureSampleBias( ${t}, ${t}_sampler, ${n}, ${s}, ${r} )`:o?`textureSampleBias( ${t}, ${t}_sampler, ${n}, ${r}, ${o} )`:`textureSampleBias( ${t}, ${t}_sampler, ${n}, ${r} )`;ze(`WebGPURenderer: THREE.TextureNode.biasNode does not support ${a} shader.`)}getPropertyName(e,t=this.shaderStage){if(e.isNodeVarying===!0&&e.needsInterpolation===!0){if(t==="vertex")return`varyings.${e.name}`}else if(e.isNodeUniform===!0){let n=e.name,r=e.type;return r==="texture"||r==="cubeTexture"||r==="cubeDepthTexture"||r==="storageTexture"||r==="texture3D"?n:r==="buffer"||r==="storageBuffer"||r==="indirectStorageBuffer"?this.isCustomStruct(e)?n:n+".value":e.groupNode.name+"."+n}return super.getPropertyName(e)}getOutputStructName(){return"output"}getFunctionOperator(e){let t=zPe[e];return t!==void 0?(this._include(t),t):null}getNodeAccess(e,t){return t!=="compute"?e.isAtomic===!0?(Xe("WebGPURenderer: Atomic operations are only supported in compute shaders."),$o.READ_WRITE):$o.READ_ONLY:e.access}getStorageAccess(e,t){return kPe[this.getNodeAccess(e,t)]}getUniformFromNode(e,t,n,r=null){let s=super.getUniformFromNode(e,t,n,r),o=this.getDataFromNode(e,n,this.globalCache);if(o.uniformGPU===void 0){let a,l=e.groupNode,c=l.name,u=this.getBindGroupArray(c,n);if(t==="texture"||t==="cubeTexture"||t==="cubeDepthTexture"||t==="storageTexture"||t==="texture3D"){let f=null,d=this.getNodeAccess(e,n);if(t==="texture"||t==="storageTexture"?e.value.is3DTexture===!0?f=new LS(s.name,s.node,l,d):f=new xx(s.name,s.node,l,d):t==="cubeTexture"||t==="cubeDepthTexture"?f=new iI(s.name,s.node,l,d):t==="texture3D"&&(f=new LS(s.name,s.node,l,d)),f.store=e.isStorageTextureNode===!0,f.mipLevel=f.store?e.mipLevel:0,f.setVisibility(mU[n]),e.value.isCubeTexture===!0||this.isUnfilterable(e.value)===!1&&f.store===!1||e.gatherNode!==null){let y=new M9(`${s.name}_sampler`,s.node,l);y.setVisibility(mU[n]),u.push(y,f),a=[y,f]}else u.push(f),a=[f]}else if(t==="buffer"||t==="storageBuffer"||t==="indirectStorageBuffer"){let f=this.getSharedDataFromNode(e),d=f.buffer;if(d===void 0){let A=t==="buffer"?eI:R9;d=new A(e,l),f.buffer=d}d.setVisibility(d.getVisibility()|mU[n]),u.push(d),a=d,s.name=r||"NodeBuffer_"+s.id}else{let f=this.uniformGroups[c];f===void 0&&(f=new tI(c,l),f.setVisibility(Sf.VERTEX|Sf.FRAGMENT|Sf.COMPUTE),this.uniformGroups[c]=f),u.indexOf(f)===-1&&u.push(f),a=this.getNodeUniform(s,t);let d=a.name;f.uniforms.some(y=>y.name===d)||f.addUniform(a)}o.uniformGPU=a}return s}getBuiltin(e,t,n,r=this.shaderStage){let s=this.builtins[r]||(this.builtins[r]=new Map);return s.has(e)===!1&&s.set(e,{name:e,property:t,type:n}),t}hasBuiltin(e,t=this.shaderStage){return this.builtins[t]!==void 0&&this.builtins[t].has(e)}getVertexIndex(){return this.shaderStage==="vertex"?this.getBuiltin("vertex_index","vertexIndex","u32","attribute"):"vertexIndex"}buildFunctionCode(e){let t=e.layout,n=this.flowShaderNode(e),r=[];for(let o of t.inputs)r.push(o.name+" : "+this.getType(o.type));let s=`fn ${t.name}( ${r.join(", ")} ) -> ${this.getType(t.type)} {45734573 ${n.vars}45744574 ${n.code}45754575 `;return n.result&&(s+=` return ${n.result};@@ -4591,7 +4591,7 @@ ${n.code}
45914591 ${r.join(`45924592 `)}45934593 `}getVaryings(e){let t=[];if(e==="vertex"&&this.getBuiltin("position","builtinClipSpace","vec4<f32>","vertex"),e==="vertex"||e==="fragment"){let s=this.varyings,o=this.vars[e],a=0;for(let l=0;l<s.length;l++){let c=s[l];if(c.needsInterpolation){let u=`@location( ${a++} )`;if(c.interpolationType){let f=c.interpolationSampling!==null?`, ${c.interpolationSampling} )`:" )";u+=` @interpolate( ${c.interpolationType}${f}`}else/^(int|uint|ivec|uvec)/.test(c.type)&&(u+=" @interpolate(flat, either)");t.push(`${u} ${c.name} : ${this.getType(c.type)}`)}else e==="vertex"&&o.includes(c)===!1&&o.push(c)}}let n=this.getBuiltins(e);n&&t.push(n);let r=t.join(`,4594- `);return e==="vertex"?this._getWGSLStruct("VaryingsStruct"," "+r):r}isCustomStruct(e){let t=e.value,n=e.node,r=(t.isBufferAttribute||t.isInstancedBufferAttribute)&&n.structTypeNode!==null,s=n.value&&n.value.array&&typeof n.value.itemSize=="number"&&n.value.array.length>n.value.itemSize;return r&&!s}getUniforms(e){let t=this.renderer.backend,n=this.uniforms[e],r=[],s=[],o=[],a={};for(let c of n){let u=c.groupNode.name,f=this.bindingsIndexes[u];if(c.type==="texture"||c.type==="cubeTexture"||c.type==="cubeDepthTexture"||c.type==="storageTexture"||c.type==="texture3D"){let d=c.node,A=d.value;(A.isCubeTexture===!0||this.isUnfilterable(A)===!1&&d.isStorageTextureNode!==!0||d.gatherNode!==null)&&(this.isSampleCompare(A)&&d.compareNode!==null?r.push(`@binding( ${f.binding++} ) @group( ${f.group} ) var ${c.name}_sampler : sampler_comparison;`):r.push(`@binding( ${f.binding++} ) @group( ${f.group} ) var ${c.name}_sampler : sampler;`));let w,S="",{primarySamples:T}=t.utils.getTextureSampleData(A);if(T>1&&(S="_multisampled"),A.isCubeTexture===!0&&A.isDepthTexture===!0)w="texture_depth_cube";else if(A.isCubeTexture===!0)w="texture_cube<f32>";else if(A.isDepthTexture===!0)t.compatibilityMode&&A.compareFunction===null?w=`texture${S}_2d<f32>`:w=`texture_depth${S}_2d${A.isArrayTexture===!0?"_array":""}`;else if(c.node.isStorageTextureNode===!0){let R=P9(A,t.device),P=this.getStorageAccess(c.node,e),I=c.node.value.is3DTexture,F=c.node.value.isArrayTexture;w=`texture_storage_${I?"3d":`2d${F?"_array":""}`}<${R}, ${P}>`}else if(A.isArrayTexture===!0||A.isDataArrayTexture===!0||A.isCompressedArrayTexture===!0)w="texture_2d_array<f32>";else if(A.is3DTexture===!0||A.isData3DTexture===!0)w="texture_3d<f32>";else{let R=this.getComponentTypeFromTexture(A).charAt(0);w=`texture${S}_2d<${R}32>`}r.push(`@binding( ${f.binding++} ) @group( ${f.group} ) var ${c.name} : ${w};`)}else if(c.type==="buffer"||c.type==="storageBuffer"||c.type==="indirectStorageBuffer"){let d=c.node,A=this.getType(d.getNodeType(this)),y=d.bufferCount,w=y>0&&c.type==="buffer"?", "+y:"",S=d.isStorageBufferNode?`storage, ${this.getStorageAccess(d,e)}`:"uniform";if(this.isCustomStruct(c))s.push(`@binding( ${f.binding++} ) @group( ${f.group} ) var<${S}> ${c.name} : ${A};`);else{let R=` value : array< ${d.isAtomic?`atomic<${A}>`:`${A}`}${w} >`;s.push(this._getWGSLStructBinding(c.name,R,S,f.binding++,f.group))}}else{let d=c.groupNode.name;if(a[d]===void 0){let A=this.uniformGroups[d];if(A!==void 0){let y=[];for(let S of A.uniforms){let T=S.getType(),R=this.getType(this.getVectorType(T));y.push(` ${S.name} : ${R}`)}let w=this.uniformGroupsBindings[d];w===void 0&&(w={index:f.binding++,id:f.group},this.uniformGroupsBindings[d]=w),a[d]={index:w.index,id:w.id,snippets:y}}}}}for(let c in a){let u=a[c];o.push(this._getWGSLStructBinding(c,u.snippets.join(`,4594+ `);return e==="vertex"?this._getWGSLStruct("VaryingsStruct"," "+r):r}isCustomStruct(e){let t=e.value,n=e.node,r=(t.isBufferAttribute||t.isInstancedBufferAttribute)&&n.structTypeNode!==null,s=n.value&&n.value.array&&typeof n.value.itemSize=="number"&&n.value.array.length>n.value.itemSize;return r&&!s}getUniforms(e){let t=this.renderer.backend,n=this.uniforms[e],r=[],s=[],o=[],a={};for(let c of n){let u=c.groupNode.name,f=this.bindingsIndexes[u];if(c.type==="texture"||c.type==="cubeTexture"||c.type==="cubeDepthTexture"||c.type==="storageTexture"||c.type==="texture3D"){let d=c.node,A=d.value;(A.isCubeTexture===!0||this.isUnfilterable(A)===!1&&d.isStorageTextureNode!==!0||d.gatherNode!==null)&&(this.isSampleCompare(A)&&d.compareNode!==null?r.push(`@binding( ${f.binding++} ) @group( ${f.group} ) var ${c.name}_sampler : sampler_comparison;`):r.push(`@binding( ${f.binding++} ) @group( ${f.group} ) var ${c.name}_sampler : sampler;`));let w,S="",{primarySamples:T}=t.utils.getTextureSampleData(A);if(T>1&&(S="_multisampled"),A.isCubeTexture===!0&&A.isDepthTexture===!0)w="texture_depth_cube";else if(A.isCubeTexture===!0)w="texture_cube<f32>";else if(A.isDepthTexture===!0)t.compatibilityMode&&A.compareFunction===null?w=`texture${S}_2d<f32>`:w=`texture_depth${S}_2d${A.isArrayTexture===!0?"_array":""}`;else if(c.node.isStorageTextureNode===!0){let R=k9(A,t.device),P=this.getStorageAccess(c.node,e),I=c.node.value.is3DTexture,F=c.node.value.isArrayTexture;w=`texture_storage_${I?"3d":`2d${F?"_array":""}`}<${R}, ${P}>`}else if(A.isArrayTexture===!0||A.isDataArrayTexture===!0||A.isCompressedArrayTexture===!0)w="texture_2d_array<f32>";else if(A.is3DTexture===!0||A.isData3DTexture===!0)w="texture_3d<f32>";else{let R=this.getComponentTypeFromTexture(A).charAt(0);w=`texture${S}_2d<${R}32>`}r.push(`@binding( ${f.binding++} ) @group( ${f.group} ) var ${c.name} : ${w};`)}else if(c.type==="buffer"||c.type==="storageBuffer"||c.type==="indirectStorageBuffer"){let d=c.node,A=this.getType(d.getNodeType(this)),y=d.bufferCount,w=y>0&&c.type==="buffer"?", "+y:"",S=d.isStorageBufferNode?`storage, ${this.getStorageAccess(d,e)}`:"uniform";if(this.isCustomStruct(c))s.push(`@binding( ${f.binding++} ) @group( ${f.group} ) var<${S}> ${c.name} : ${A};`);else{let R=` value : array< ${d.isAtomic?`atomic<${A}>`:`${A}`}${w} >`;s.push(this._getWGSLStructBinding(c.name,R,S,f.binding++,f.group))}}else{let d=c.groupNode.name;if(a[d]===void 0){let A=this.uniformGroups[d];if(A!==void 0){let y=[];for(let S of A.uniforms){let T=S.getType(),R=this.getType(this.getVectorType(T));y.push(` ${S.name} : ${R}`)}let w=this.uniformGroupsBindings[d];w===void 0&&(w={index:f.binding++,id:f.group},this.uniformGroupsBindings[d]=w),a[d]={index:w.index,id:w.id,snippets:y}}}}}for(let c in a){let u=a[c];o.push(this._getWGSLStructBinding(c,u.snippets.join(`,45954595 `),"uniform",u.index,u.id))}return[...r,...s,...o].join(`45964596 `)}buildCode(){let e=this.material!==null?{fragment:{},vertex:{}}:{compute:{}};this.sortBindingGroups();for(let t in e){this.shaderStage=t;let n=this.allowGlobalVariables,r=e[t];r.uniforms=this.getUniforms(t),r.attributes=this.getAttributes(t),r.varyings=this.getVaryings(t),r.structs=this.getStructs(t),r.vars=this.getVars(t,n),r.codes=this.getCodes(t),r.directives=this.getDirectives(t),r.scopedArrays=this.getScopedArrays(t);let s=`// code45974597 @@ -4604,7 +4604,7 @@ ${n.code}
46044604 `+y),r.returnType="OutputStruct",r.structs+=this._getWGSLStruct("OutputStruct",A),r.structs+=`46054605 var<private> output : OutputStruct;`,s+=`output.color = ${this.format(f.result,a.getNodeType(this),this.getOutputType())};46064606 4607- return output;`}}}r.flow=s}if(this.shaderStage=null,this.material!==null)this.vertexShader=this._getWGSLVertexCode(e.vertex),this.fragmentShader=this._getWGSLFragmentCode(e.fragment);else{let t=this.object.workgroupSize;this.computeShader=this._getWGSLComputeCode(e.compute,t)}}getMethod(e,t=null){let n;return t!==null&&(n=this._getWGSLMethod(e+"_"+t)),n===void 0&&(n=this._getWGSLMethod(e)),n||e}getBitcastMethod(e){return`bitcast<${this.getType(e)}>`}getFloatPackingMethod(e){return this.getMethod(`floatpack_${e}_2x16`)}getFloatUnpackingMethod(e){return this.getMethod(`floatunpack_${e}_2x16`)}getTernary(e,t,n){return`select( ${n}, ${t}, ${e} )`}getType(e){return yPe[e]||e}isAvailable(e){let t=jte[e];return t===void 0&&(e==="float32Filterable"?t=this.renderer.hasFeature("float32-filterable"):e==="clipDistance"&&(t=this.renderer.hasFeature("clip-distances")),jte[e]=t),t}_getWGSLMethod(e){return $w[e]!==void 0&&this._include(e),bPe[e]}_include(e){let t=$w[e];return t.build(this),this.addInclude(t),t}_getWGSLVertexCode(e){return`${this.getSignature()}4607+ return output;`}}}r.flow=s}if(this.shaderStage=null,this.material!==null)this.vertexShader=this._getWGSLVertexCode(e.vertex),this.fragmentShader=this._getWGSLFragmentCode(e.fragment);else{let t=this.object.workgroupSize;this.computeShader=this._getWGSLComputeCode(e.compute,t)}}getMethod(e,t=null){let n;return t!==null&&(n=this._getWGSLMethod(e+"_"+t)),n===void 0&&(n=this._getWGSLMethod(e)),n||e}getBitcastMethod(e){return`bitcast<${this.getType(e)}>`}getFloatPackingMethod(e){return this.getMethod(`floatpack_${e}_2x16`)}getFloatUnpackingMethod(e){return this.getMethod(`floatunpack_${e}_2x16`)}getTernary(e,t,n){return`select( ${n}, ${t}, ${e} )`}getType(e){return VPe[e]||e}isAvailable(e){let t=tne[e];return t===void 0&&(e==="float32Filterable"?t=this.renderer.hasFeature("float32-filterable"):e==="clipDistance"&&(t=this.renderer.hasFeature("clip-distances")),tne[e]=t),t}_getWGSLMethod(e){return Qw[e]!==void 0&&this._include(e),GPe[e]}_include(e){let t=Qw[e];return t.build(this),this.addInclude(t),t}_getWGSLVertexCode(e){return`${this.getSignature()}46084608 // directives46094609 ${e.directives}46104610 @@ -4635,7 +4635,7 @@ fn main( ${e.attributes} ) -> VaryingsStruct {
46354635 }46364636 `}_getWGSLFragmentCode(e){return`${this.getSignature()}46374637 // global4638-${soe}4638+${poe}46394639 46404640 // structs46414641 ${e.structs}@@ -4698,10 +4698,10 @@ struct ${e} {
46984698 ${t}46994699 };`}_getWGSLStructBinding(e,t,n,r=0,s=0){let o=e+"Struct";return`${this._getWGSLStruct(o,t)}47004700 @binding( ${r} ) @group( ${s} )4701-var<${n}> ${e} : ${o};`}},ma=new ym,lU=new l1,ooe=new Map([[Int8Array,["sint8","snorm8"]],[Uint8Array,["uint8","unorm8"]],[Int16Array,["sint16","snorm16"]],[Uint16Array,["uint16","unorm16"]],[Int32Array,["sint32","snorm32"]],[Uint32Array,["uint32","unorm32"]],[Float32Array,["float32"]]]);typeof Float16Array<"u"&&ooe.set(Float16Array,["float16"]);var wPe=new Map([[Qv,["float16"]]]),SPe=new Map([[Int32Array,"sint32"],[Int16Array,"sint32"],[Uint32Array,"uint32"],[Uint16Array,"uint32"],[Float32Array,"float32"]]),F9=class{constructor(e){this.backend=e}createAttribute(e,t){let n=this._getBufferAttribute(e),r=this.backend,s=r.get(n),o=s.buffer;if(o===void 0){let a=r.device,l=n.array;if(e.normalized===!1){if(l.constructor===Int16Array||l.constructor===Int8Array)l=new Int32Array(l);else if((l.constructor===Uint16Array||l.constructor===Uint8Array)&&(l=new Uint32Array(l),t&GPUBufferUsage.INDEX))for(let d=0;d<l.length;d++)l[d]===65535&&(l[d]=4294967295)}n.array=l;let c;if((n.isStorageBufferAttribute||n.isStorageInstancedBufferAttribute)&&n.itemSize===3)c=4;else if(n.itemSize>1&&n.itemSize*l.BYTES_PER_ELEMENT%4!==0){let d=n.itemSize*l.BYTES_PER_ELEMENT;c=Math.floor((d+3)/4)*4/l.BYTES_PER_ELEMENT}if(c!==void 0){let d=n.itemSize,A=new l.constructor(n.count*c);for(let y=0;y<n.count;y++)A.set(l.subarray(y*d,y*d+d),y*c);(n.isStorageBufferAttribute||n.isStorageInstancedBufferAttribute)&&(n.itemSize=c,n.array=A),l=A,s._itemSize=d,s._paddedItemSize=c}let u=l.byteLength,f=u+(4-u%4)%4;ma.label=n.name,ma.size=f,ma.usage=t,ma.mappedAtCreation=!0,o=a.createBuffer(ma),ma.reset(),new l.constructor(o.getMappedRange()).set(l),o.unmap(),s.buffer=o}}updateAttribute(e){let t=this._getBufferAttribute(e),n=this.backend,r=n.device,s=n.get(t),o=n.get(t).buffer,a=t.array,l=s._itemSize,c=s._paddedItemSize;if(c!==void 0){a=new a.constructor(t.count*c);for(let f=0;f<t.count;f++)a.set(t.array.subarray(f*l,f*l+l),f*c);(t.isStorageBufferAttribute||t.isStorageInstancedBufferAttribute)&&(t.array=a)}let u=t.updateRanges;if(u.length===0)r.queue.writeBuffer(o,0,a,0);else{let f=f_(a),d=f?1:a.BYTES_PER_ELEMENT;for(let A=0,y=u.length;A<y;A++){let w=u[A],S,T;if(c!==void 0){let P=Math.floor(w.start/l),I=Math.ceil((w.start+w.count)/l)-P;S=P*c*d,T=I*c*d}else S=w.start*d,T=w.count*d;let R=S*(f?a.BYTES_PER_ELEMENT:1);r.queue.writeBuffer(o,R,a,S,T)}t.clearUpdateRanges()}}createShaderVertexBuffers(e){let t=e.getAttributes(),n=new Map;for(let r=0;r<t.length;r++){let s=t[r],o=s.array.BYTES_PER_ELEMENT,a=this._getBufferAttribute(s),l=n.get(a);if(l===void 0){let f,d;s.isInterleavedBufferAttribute===!0?(f=s.data.stride*o,d=s.data.isInstancedInterleavedBuffer?OR.Instance:OR.Vertex):(f=s.itemSize*o,d=s.isInstancedBufferAttribute?OR.Instance:OR.Vertex,s.itemSize>1&&f%4!==0&&(f=Math.floor((f+3)/4)*4)),s.normalized===!1&&(s.array.constructor===Int16Array||s.array.constructor===Uint16Array)&&(f=4),l={arrayStride:f,attributes:[],stepMode:d},n.set(a,l)}let c=this._getVertexFormat(s),u=s.isInterleavedBufferAttribute===!0?s.offset*o:0;l.attributes.push({shaderLocation:r,offset:u,format:c})}return Array.from(n.values())}destroyAttribute(e){let t=this.backend;t.get(this._getBufferAttribute(e)).buffer.destroy(),t.delete(e)}async getArrayBufferAsync(e,t=null,n=0,r=-1){let s=this.backend,o=s.device,l=s.get(this._getBufferAttribute(e)).buffer,c=r===-1?l.size-n:r,u;if(t!==null&&t.isReadbackBuffer){let A=s.get(t);if(t._mapped===!0)throw new Error("THREE.WebGPUAttributeUtils: ReadbackBuffer must be released before being used again.");if(t._mapped=!0,A.readBufferGPU===void 0){ma.label=`${t.name}_readback`,ma.size=t.maxByteLength,ma.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,u=o.createBuffer(ma),ma.reset();let y=()=>{t.buffer=null,t._mapped=!1,u.unmap()},w=()=>{t.buffer=null,t._mapped=!1,u.destroy(),s.delete(t),t.removeEventListener("release",y),t.removeEventListener("dispose",w)};t.addEventListener("release",y),t.addEventListener("dispose",w),A.readBufferGPU=u}else u=A.readBufferGPU}else ma.label=`${e.name}_readback`,ma.size=c,ma.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,u=o.createBuffer(ma),ma.reset();lU.label=`readback_encoder_${e.name}`;let f=o.createCommandEncoder(lU);lU.reset(),f.copyBufferToBuffer(l,n,u,0,c);let d=f.finish();if(gf(o,d),await u.mapAsync(GPUMapMode.READ,0,c),t===null){let y=u.getMappedRange(0,c).slice();return u.destroy(),y}else{if(t.isReadbackBuffer)return t.buffer=u.getMappedRange(0,c),t;{let A=u.getMappedRange(0,c);return new Uint8Array(t).set(new Uint8Array(A)),u.destroy(),t}}}_getVertexFormat(e){let{itemSize:t,normalized:n}=e,r=e.array.constructor,s=e.constructor,o;if(t===1)o=SPe.get(r);else{let l=(wPe.get(s)||ooe.get(r))[n?1:0];if(l){let c=r.BYTES_PER_ELEMENT*t,f=Math.floor((c+3)/4)*4/r.BYTES_PER_ELEMENT;if(f%1)throw new Error("THREE.WebGPUAttributeUtils: Bad vertex format item size.");o=`${l}x${f}`}}return o||ze("WebGPUAttributeUtils: Vertex format not supported yet."),o}_getBufferAttribute(e){return e.isInterleavedBufferAttribute&&(e=e.data),e}},sc=new sI,Yw=new ym,K_=new IS,B9=class{constructor(e){this.layoutGPU=e,this.usedTimes=0}},O9=class{constructor(e){this.backend=e,this._bindGroupLayoutCache=new Map}createBindingsLayout(e){let t=this.backend,n=t.device,r=t.get(e);if(r.layout)return r.layout.layoutGPU;let s=this._createLayoutEntries(e),o=yx(JSON.stringify(s)),a=this._bindGroupLayoutCache.get(o);return a===void 0&&(a=new B9(n.createBindGroupLayout({entries:s})),this._bindGroupLayoutCache.set(o,a)),a.usedTimes++,r.layout=a,r.layoutKey=o,a.layoutGPU}createBindings(e,t,n,r=0){let{backend:s}=this,o=s.get(e),a=this.createBindingsLayout(e),l;n>0&&(o.groups===void 0&&(o.groups=[],o.versions=[]),o.versions[n]===r&&(l=o.groups[n])),l===void 0&&(l=this.createBindGroup(e,a),n>0&&(o.groups[n]=l,o.versions[n]=r)),o.group=l}updateBinding(e){let t=this.backend,n=t.device,r=e.buffer,s=t.get(e).buffer,o=e.updateRanges;if(o.length===0)n.queue.writeBuffer(s,0,r,0);else{let a=f_(r),l=a?1:r.BYTES_PER_ELEMENT,c=o[0].start;for(let u=0,f=o.length;u<f;u++){let d=o[u],A=o[u+1],y=d.start+d.count;if(A!==void 0&&A.start===y)continue;let w=c*l,S=(y-c)*l,T=w*(a?r.BYTES_PER_ELEMENT:1);n.queue.writeBuffer(s,T,r,w,S),A!==void 0&&(c=A.start)}}}createBindGroupIndex(e,t){let r=this.backend.device,s=GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,o=e[0];Yw.label="bindingCameraIndex_"+o,Yw.size=16,Yw.usage=s;let a=r.createBuffer(Yw);Yw.reset(),r.queue.writeBuffer(a,0,e,0),sc.label="bindGroupCameraIndex_"+o,sc.layout=t,sc.entries.push({binding:0,resource:{buffer:a}});let l=r.createBindGroup(sc);return sc.reset(),l}createBindGroup(e,t){let n=this.backend,r=n.device,s=0;sc.label="bindGroup_"+e.name,sc.layout=t;for(let a of e.bindings){if(a.isUniformBuffer){let l=n.get(a);sc.entries.push({binding:s,resource:{buffer:l.buffer}})}else if(a.isStorageBuffer){let l=n.get(a.attribute).buffer;sc.entries.push({binding:s,resource:{buffer:l}})}else if(a.isSampledTexture){let l=n.get(a.texture),c;if(l.externalTexture!==void 0)c=r.importExternalTexture({source:l.externalTexture});else{let u=a.store?1:l.texture.mipLevelCount,f=a.store?a.mipLevel:0,d=`view-${l.texture.width}-${l.texture.height}`;if(l.texture.depthOrArrayLayers>1&&(d+=`-${l.texture.depthOrArrayLayers}`),d+=`-${u}-${f}`,c=l[d],c===void 0){let A=hPe.All,y;a.isSampledCubeTexture?y=jo.Cube:a.texture.isArrayTexture||a.texture.isDataArrayTexture||a.texture.isCompressedArrayTexture?y=jo.TwoDArray:a.isSampledTexture3D?y=jo.ThreeD:y=jo.TwoD,K_.aspect=A,K_.dimension=y,K_.mipLevelCount=u,K_.baseMipLevel=f,c=l[d]=l.texture.createView(K_),K_.reset()}}sc.entries.push({binding:s,resource:c})}else if(a.isSampler){let l=n.get(a);sc.entries.push({binding:s,resource:l.sampler})}s++}let o=r.createBindGroup(sc);return sc.reset(),o}_createLayoutEntries(e){let t=[],n=0;for(let r of e.bindings){let s=this.backend,o={binding:n,visibility:r.visibility};if(r.isUniformBuffer||r.isStorageBuffer){let a={};r.isStorageBuffer&&(r.visibility&wf.COMPUTE&&(r.access===$o.READ_WRITE||r.access===$o.WRITE_ONLY)?a.type=nU.Storage:a.type=nU.ReadOnlyStorage),o.buffer=a}else if(r.isSampledTexture&&r.store){let a={};a.format=this.backend.get(r.texture).texture.format;let l=r.access;l===$o.READ_WRITE?a.access=iU.ReadWrite:l===$o.WRITE_ONLY?a.access=iU.WriteOnly:a.access=iU.ReadOnly,r.texture.isArrayTexture?a.viewDimension=jo.TwoDArray:r.texture.is3DTexture&&(a.viewDimension=jo.ThreeD),o.storageTexture=a}else if(r.isSampledTexture){let a={},{primarySamples:l}=s.utils.getTextureSampleData(r.texture);if(l>1&&(a.multisampled=!0,r.texture.isDepthTexture||(a.sampleType=kg.UnfilterableFloat)),r.texture.isDepthTexture)s.compatibilityMode&&r.texture.compareFunction===null?a.sampleType=kg.UnfilterableFloat:a.sampleType=kg.Depth;else{let c=r.texture.type;c===Zr?a.sampleType=kg.SInt:c===xi?a.sampleType=kg.UInt:c===cr&&(this.backend.hasFeature("float32-filterable")?a.sampleType=kg.Float:a.sampleType=kg.UnfilterableFloat)}r.isSampledCubeTexture?a.viewDimension=jo.Cube:r.texture.isArrayTexture||r.texture.isDataArrayTexture||r.texture.isCompressedArrayTexture?a.viewDimension=jo.TwoDArray:r.isSampledTexture3D&&(a.viewDimension=jo.ThreeD),o.texture=a}else if(r.isSampler){let a={};r.texture.isDepthTexture&&(r.texture.compareFunction!==null&&r.textureNode.compareNode!==null&&s.hasCompatibility(Ud.TEXTURE_COMPARE)?a.type=zte.Comparison:a.type=zte.NonFiltering),o.sampler=a}else ze(`WebGPUBindingUtils: Unsupported binding "${r}".`);t.push(o),n++}return t}deleteBindGroupData(e){let{backend:t}=this,n=t.get(e);n.layout&&(n.layout.usedTimes--,n.layout.usedTimes===0&&this._bindGroupLayoutCache.delete(n.layoutKey),n.layout=void 0,n.layoutKey=void 0)}dispose(){this._bindGroupLayoutCache.clear()}},U9=class{constructor(e){this.backend=e}getMaxAnisotropy(){return 16}getUniformBufferLimit(){return this.backend.device.limits.maxUniformBufferBindingSize}},k9=class{constructor(){this.label="",this.layout=null,this.compute=null}reset(){this.label="",this.layout=null,this.compute=null}},z9=class{constructor(){this.label="",this.bindGroupLayouts=null}reset(){this.label="",this.bindGroupLayouts=null}},Zw=new k9,Q_=new z9,J_=new oI,oc=new aI,V9=class{constructor(e){this.backend=e}_getSampleCount(e){return this.backend.utils.getSampleCountRenderContext(e)}createRenderPipeline(e,t){let{object:n,material:r,geometry:s,pipeline:o}=e,{vertexProgram:a,fragmentProgram:l}=o,c=this.backend,u=c.device,f=c.utils,d=c.get(o),A=[];for(let H of e.getBindings()){let $=c.get(H),{layoutGPU:J}=$.layout;A.push(J)}let y=c.attributeUtils.createShaderVertexBuffers(e),w;r.blending!==ps&&(r.blending!==Ms||r.transparent!==!1)&&(w=this._getBlending(r));let S={};r.stencilWrite===!0&&(S={compare:this._getStencilCompare(r),failOp:this._getStencilOperation(r.stencilFail),depthFailOp:this._getStencilOperation(r.stencilZFail),passOp:this._getStencilOperation(r.stencilZPass)});let T=this._getColorWriteMask(r),R=[];if(e.context.textures!==null){let H=e.context.textures,$=e.context.mrt;for(let J=0;J<H.length;J++){let te=H[J],ce=f.getTextureFormatGPU(te),he;if($!==null)if(this.backend.compatibilityMode!==!0){let ve=$.getBlendMode(te.name);ve.blending===hb?he=w:ve.blending!==ps&&(he=this._getBlending(ve))}else ni("WebGPURenderer: Multiple Render Targets (MRT) blending configuration is not fully supported in compatibility mode. The material blending will be used for all render targets."),he=w;else he=w;R.push({format:ce,blend:he,writeMask:T})}}else{let H=f.getCurrentColorFormat(e.context);R.push({format:H,blend:w,writeMask:T})}let P=c.get(a).module,I=c.get(l).module,F=this._getPrimitiveState(n,s,r),D=this._getDepthCompare(r),L=f.getCurrentDepthStencilFormat(e.context),C=this._getSampleCount(e.context);Q_.bindGroupLayouts=A;let B=u.createPipelineLayout(Q_);Q_.reset(),oc.label=`renderPipeline_${r.name||r.type}_${r.id}`,oc.vertex=Object.assign({},P,{buffers:y}),oc.fragment=Object.assign({},I,{targets:R}),oc.primitive=F,oc.multisample.count=C,oc.multisample.alphaToCoverageEnabled=r.alphaToCoverage&&C>1,oc.layout=B;let k={},z=e.context.depth,G=e.context.stencil;(z===!0||G===!0)&&(z===!0&&(k.format=L,k.depthWriteEnabled=r.depthWrite,k.depthCompare=D),G===!0&&(k.stencilFront=S,k.stencilBack=S,k.stencilReadMask=r.stencilFuncMask,k.stencilWriteMask=r.stencilWriteMask),r.polygonOffset===!0&&F.topology===eS.TriangleList&&(k.depthBias=r.polygonOffsetUnits,k.depthBiasSlopeScale=r.polygonOffsetFactor,k.depthBiasClamp=0),oc.depthStencil=k),u.pushErrorScope("validation");let W=[{program:a,module:P.module},{program:l,module:I.module}],Y=oc.label;if(t===null)d.pipeline=u.createRenderPipeline(oc),oc.reset(),u.popErrorScope().then(H=>{H!==null&&(d.error=!0,ze(`WebGPURenderer: Render pipeline creation failed (${Y}): ${H.message}`),this._reportShaderDiagnostics(W,Y))});else{let H=new Promise(async $=>{try{let J=null,te=null;try{te=u.createRenderPipelineAsync(oc)}catch(he){J=he}if(oc.reset(),te!==null)try{d.pipeline=await te}catch(he){J=he}let ce=await u.popErrorScope();if(ce!==null||J!==null){d.error=!0;let he=ce&&ce.message||J&&J.message||"unknown";ze(`WebGPURenderer: Async render pipeline creation failed (${Y}): ${he}`),await this._reportShaderDiagnostics(W,Y)}}finally{$()}});t.push(H)}}createBundleEncoder(e,t="renderBundleEncoder"){let n=this.backend,{utils:r,device:s}=n,o=r.getCurrentDepthStencilFormat(e),a=r.getCurrentColorFormats(e),l=this._getSampleCount(e);J_.label=t,J_.colorFormats=a,J_.depthStencilFormat=o,J_.sampleCount=l;let c=s.createRenderBundleEncoder(J_);return J_.reset(),c}createComputePipeline(e,t){let n=this.backend,r=n.device,s=n.get(e.computeProgram).module,o=n.get(e),a=[];for(let f of t){let d=n.get(f),{layoutGPU:A}=d.layout;a.push(A)}let l=e.computeProgram,c=`computePipeline_${l.stage}${l.name?`_${l.name}`:""}`;r.pushErrorScope("validation"),Q_.bindGroupLayouts=a;let u=r.createPipelineLayout(Q_);Q_.reset(),Zw.label=c,Zw.compute=s,Zw.layout=u,o.pipeline=r.createComputePipeline(Zw),Zw.reset(),r.popErrorScope().then(f=>{f!==null&&(o.error=!0,ze(`WebGPURenderer: Compute pipeline creation failed (${c}): ${f.message}`),this._reportShaderDiagnostics([{program:l,module:s.module}],c))})}async _reportShaderDiagnostics(e,t){for(let{program:n,module:r}of e){let s=await r.getCompilationInfo();if(s.messages.length===0)continue;let o=n.code.split(`4701+var<${n}> ${e} : ${o};`}},ma=new ym,AU=new l1,moe=new Map([[Int8Array,["sint8","snorm8"]],[Uint8Array,["uint8","unorm8"]],[Int16Array,["sint16","snorm16"]],[Uint16Array,["uint16","unorm16"]],[Int32Array,["sint32","snorm32"]],[Uint32Array,["uint32","unorm32"]],[Float32Array,["float32"]]]);typeof Float16Array<"u"&&moe.set(Float16Array,["float16"]);var qPe=new Map([[e_,["float16"]]]),HPe=new Map([[Int32Array,"sint32"],[Int16Array,"sint32"],[Uint32Array,"uint32"],[Uint16Array,"uint32"],[Float32Array,"float32"]]),q9=class{constructor(e){this.backend=e}createAttribute(e,t){let n=this._getBufferAttribute(e),r=this.backend,s=r.get(n),o=s.buffer;if(o===void 0){let a=r.device,l=n.array;if(e.normalized===!1){if(l.constructor===Int16Array||l.constructor===Int8Array)l=new Int32Array(l);else if((l.constructor===Uint16Array||l.constructor===Uint8Array)&&(l=new Uint32Array(l),t&GPUBufferUsage.INDEX))for(let d=0;d<l.length;d++)l[d]===65535&&(l[d]=4294967295)}n.array=l;let c;if((n.isStorageBufferAttribute||n.isStorageInstancedBufferAttribute)&&n.itemSize===3)c=4;else if(n.itemSize>1&&n.itemSize*l.BYTES_PER_ELEMENT%4!==0){let d=n.itemSize*l.BYTES_PER_ELEMENT;c=Math.floor((d+3)/4)*4/l.BYTES_PER_ELEMENT}if(c!==void 0){let d=n.itemSize,A=new l.constructor(n.count*c);for(let y=0;y<n.count;y++)A.set(l.subarray(y*d,y*d+d),y*c);(n.isStorageBufferAttribute||n.isStorageInstancedBufferAttribute)&&(n.itemSize=c,n.array=A),l=A,s._itemSize=d,s._paddedItemSize=c}let u=l.byteLength,f=u+(4-u%4)%4;ma.label=n.name,ma.size=f,ma.usage=t,ma.mappedAtCreation=!0,o=a.createBuffer(ma),ma.reset(),new l.constructor(o.getMappedRange()).set(l),o.unmap(),s.buffer=o}}updateAttribute(e){let t=this._getBufferAttribute(e),n=this.backend,r=n.device,s=n.get(t),o=n.get(t).buffer,a=t.array,l=s._itemSize,c=s._paddedItemSize;if(c!==void 0){a=new a.constructor(t.count*c);for(let f=0;f<t.count;f++)a.set(t.array.subarray(f*l,f*l+l),f*c);(t.isStorageBufferAttribute||t.isStorageInstancedBufferAttribute)&&(t.array=a)}let u=t.updateRanges;if(u.length===0)r.queue.writeBuffer(o,0,a,0);else{let f=p_(a),d=f?1:a.BYTES_PER_ELEMENT;for(let A=0,y=u.length;A<y;A++){let w=u[A],S,T;if(c!==void 0){let P=Math.floor(w.start/l),I=Math.ceil((w.start+w.count)/l)-P;S=P*c*d,T=I*c*d}else S=w.start*d,T=w.count*d;let R=S*(f?a.BYTES_PER_ELEMENT:1);r.queue.writeBuffer(o,R,a,S,T)}t.clearUpdateRanges()}}createShaderVertexBuffers(e){let t=e.getAttributes(),n=new Map;for(let r=0;r<t.length;r++){let s=t[r],o=s.array.BYTES_PER_ELEMENT,a=this._getBufferAttribute(s),l=n.get(a);if(l===void 0){let f,d;s.isInterleavedBufferAttribute===!0?(f=s.data.stride*o,d=s.data.isInstancedInterleavedBuffer?VR.Instance:VR.Vertex):(f=s.itemSize*o,d=s.isInstancedBufferAttribute?VR.Instance:VR.Vertex,s.itemSize>1&&f%4!==0&&(f=Math.floor((f+3)/4)*4)),s.normalized===!1&&(s.array.constructor===Int16Array||s.array.constructor===Uint16Array)&&(f=4),l={arrayStride:f,attributes:[],stepMode:d},n.set(a,l)}let c=this._getVertexFormat(s),u=s.isInterleavedBufferAttribute===!0?s.offset*o:0;l.attributes.push({shaderLocation:r,offset:u,format:c})}return Array.from(n.values())}destroyAttribute(e){let t=this.backend;t.get(this._getBufferAttribute(e)).buffer.destroy(),t.delete(e)}async getArrayBufferAsync(e,t=null,n=0,r=-1){let s=this.backend,o=s.device,l=s.get(this._getBufferAttribute(e)).buffer,c=r===-1?l.size-n:r,u;if(t!==null&&t.isReadbackBuffer){let A=s.get(t);if(t._mapped===!0)throw new Error("THREE.WebGPUAttributeUtils: ReadbackBuffer must be released before being used again.");if(t._mapped=!0,A.readBufferGPU===void 0){ma.label=`${t.name}_readback`,ma.size=t.maxByteLength,ma.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,u=o.createBuffer(ma),ma.reset();let y=()=>{t.buffer=null,t._mapped=!1,u.unmap()},w=()=>{t.buffer=null,t._mapped=!1,u.destroy(),s.delete(t),t.removeEventListener("release",y),t.removeEventListener("dispose",w)};t.addEventListener("release",y),t.addEventListener("dispose",w),A.readBufferGPU=u}else u=A.readBufferGPU}else ma.label=`${e.name}_readback`,ma.size=c,ma.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,u=o.createBuffer(ma),ma.reset();AU.label=`readback_encoder_${e.name}`;let f=o.createCommandEncoder(AU);AU.reset(),f.copyBufferToBuffer(l,n,u,0,c);let d=f.finish();if(vf(o,d),await u.mapAsync(GPUMapMode.READ,0,c),t===null){let y=u.getMappedRange(0,c).slice();return u.destroy(),y}else{if(t.isReadbackBuffer)return t.buffer=u.getMappedRange(0,c),t;{let A=u.getMappedRange(0,c);return new Uint8Array(t).set(new Uint8Array(A)),u.destroy(),t}}}_getVertexFormat(e){let{itemSize:t,normalized:n}=e,r=e.array.constructor,s=e.constructor,o;if(t===1)o=HPe.get(r);else{let l=(qPe.get(s)||moe.get(r))[n?1:0];if(l){let c=r.BYTES_PER_ELEMENT*t,f=Math.floor((c+3)/4)*4/r.BYTES_PER_ELEMENT;if(f%1)throw new Error("THREE.WebGPUAttributeUtils: Bad vertex format item size.");o=`${l}x${f}`}}return o||ze("WebGPUAttributeUtils: Vertex format not supported yet."),o}_getBufferAttribute(e){return e.isInterleavedBufferAttribute&&(e=e.data),e}},oc=new cI,Jw=new ym,J_=new NS,H9=class{constructor(e){this.layoutGPU=e,this.usedTimes=0}},W9=class{constructor(e){this.backend=e,this._bindGroupLayoutCache=new Map}createBindingsLayout(e){let t=this.backend,n=t.device,r=t.get(e);if(r.layout)return r.layout.layoutGPU;let s=this._createLayoutEntries(e),o=wx(JSON.stringify(s)),a=this._bindGroupLayoutCache.get(o);return a===void 0&&(a=new H9(n.createBindGroupLayout({entries:s})),this._bindGroupLayoutCache.set(o,a)),a.usedTimes++,r.layout=a,r.layoutKey=o,a.layoutGPU}createBindings(e,t,n,r=0){let{backend:s}=this,o=s.get(e),a=this.createBindingsLayout(e),l;n>0&&(o.groups===void 0&&(o.groups=[],o.versions=[]),o.versions[n]===r&&(l=o.groups[n])),l===void 0&&(l=this.createBindGroup(e,a),n>0&&(o.groups[n]=l,o.versions[n]=r)),o.group=l}updateBinding(e){let t=this.backend,n=t.device,r=e.buffer,s=t.get(e).buffer,o=e.updateRanges;if(o.length===0)n.queue.writeBuffer(s,0,r,0);else{let a=p_(r),l=a?1:r.BYTES_PER_ELEMENT,c=o[0].start;for(let u=0,f=o.length;u<f;u++){let d=o[u],A=o[u+1],y=d.start+d.count;if(A!==void 0&&A.start===y)continue;let w=c*l,S=(y-c)*l,T=w*(a?r.BYTES_PER_ELEMENT:1);n.queue.writeBuffer(s,T,r,w,S),A!==void 0&&(c=A.start)}}}createBindGroupIndex(e,t){let r=this.backend.device,s=GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,o=e[0];Jw.label="bindingCameraIndex_"+o,Jw.size=16,Jw.usage=s;let a=r.createBuffer(Jw);Jw.reset(),r.queue.writeBuffer(a,0,e,0),oc.label="bindGroupCameraIndex_"+o,oc.layout=t,oc.entries.push({binding:0,resource:{buffer:a}});let l=r.createBindGroup(oc);return oc.reset(),l}createBindGroup(e,t){let n=this.backend,r=n.device,s=0;oc.label="bindGroup_"+e.name,oc.layout=t;for(let a of e.bindings){if(a.isUniformBuffer){let l=n.get(a);oc.entries.push({binding:s,resource:{buffer:l.buffer}})}else if(a.isStorageBuffer){let l=n.get(a.attribute).buffer;oc.entries.push({binding:s,resource:{buffer:l}})}else if(a.isSampledTexture){let l=n.get(a.texture),c;if(l.externalTexture!==void 0)c=r.importExternalTexture({source:l.externalTexture});else{let u=a.store?1:l.texture.mipLevelCount,f=a.store?a.mipLevel:0,d=`view-${l.texture.width}-${l.texture.height}`;if(l.texture.depthOrArrayLayers>1&&(d+=`-${l.texture.depthOrArrayLayers}`),d+=`-${u}-${f}`,c=l[d],c===void 0){let A=PPe.All,y;a.isSampledCubeTexture?y=jo.Cube:a.texture.isArrayTexture||a.texture.isDataArrayTexture||a.texture.isCompressedArrayTexture?y=jo.TwoDArray:a.isSampledTexture3D?y=jo.ThreeD:y=jo.TwoD,J_.aspect=A,J_.dimension=y,J_.mipLevelCount=u,J_.baseMipLevel=f,c=l[d]=l.texture.createView(J_),J_.reset()}}oc.entries.push({binding:s,resource:c})}else if(a.isSampler){let l=n.get(a);oc.entries.push({binding:s,resource:l.sampler})}s++}let o=r.createBindGroup(oc);return oc.reset(),o}_createLayoutEntries(e){let t=[],n=0;for(let r of e.bindings){let s=this.backend,o={binding:n,visibility:r.visibility};if(r.isUniformBuffer||r.isStorageBuffer){let a={};r.isStorageBuffer&&(r.visibility&Sf.COMPUTE&&(r.access===$o.READ_WRITE||r.access===$o.WRITE_ONLY)?a.type=uU.Storage:a.type=uU.ReadOnlyStorage),o.buffer=a}else if(r.isSampledTexture&&r.store){let a={};a.format=this.backend.get(r.texture).texture.format;let l=r.access;l===$o.READ_WRITE?a.access=hU.ReadWrite:l===$o.WRITE_ONLY?a.access=hU.WriteOnly:a.access=hU.ReadOnly,r.texture.isArrayTexture?a.viewDimension=jo.TwoDArray:r.texture.is3DTexture&&(a.viewDimension=jo.ThreeD),o.storageTexture=a}else if(r.isSampledTexture){let a={},{primarySamples:l}=s.utils.getTextureSampleData(r.texture);if(l>1&&(a.multisampled=!0,r.texture.isDepthTexture||(a.sampleType=kg.UnfilterableFloat)),r.texture.isDepthTexture)s.compatibilityMode&&r.texture.compareFunction===null?a.sampleType=kg.UnfilterableFloat:a.sampleType=kg.Depth;else{let c=r.texture.type;c===Zr?a.sampleType=kg.SInt:c===xi?a.sampleType=kg.UInt:c===cr&&(this.backend.hasFeature("float32-filterable")?a.sampleType=kg.Float:a.sampleType=kg.UnfilterableFloat)}r.isSampledCubeTexture?a.viewDimension=jo.Cube:r.texture.isArrayTexture||r.texture.isDataArrayTexture||r.texture.isCompressedArrayTexture?a.viewDimension=jo.TwoDArray:r.isSampledTexture3D&&(a.viewDimension=jo.ThreeD),o.texture=a}else if(r.isSampler){let a={};r.texture.isDepthTexture&&(r.texture.compareFunction!==null&&r.textureNode.compareNode!==null&&s.hasCompatibility(Od.TEXTURE_COMPARE)?a.type=Yte.Comparison:a.type=Yte.NonFiltering),o.sampler=a}else ze(`WebGPUBindingUtils: Unsupported binding "${r}".`);t.push(o),n++}return t}deleteBindGroupData(e){let{backend:t}=this,n=t.get(e);n.layout&&(n.layout.usedTimes--,n.layout.usedTimes===0&&this._bindGroupLayoutCache.delete(n.layoutKey),n.layout=void 0,n.layoutKey=void 0)}dispose(){this._bindGroupLayoutCache.clear()}},j9=class{constructor(e){this.backend=e}getMaxAnisotropy(){return 16}getUniformBufferLimit(){return this.backend.device.limits.maxUniformBufferBindingSize}},X9=class{constructor(){this.label="",this.layout=null,this.compute=null}reset(){this.label="",this.layout=null,this.compute=null}},$9=class{constructor(){this.label="",this.bindGroupLayouts=null}reset(){this.label="",this.bindGroupLayouts=null}},eS=new X9,ex=new $9,tx=new uI,ac=new hI,Y9=class{constructor(e){this.backend=e}_getSampleCount(e){return this.backend.utils.getSampleCountRenderContext(e)}createRenderPipeline(e,t){let{object:n,material:r,geometry:s,pipeline:o}=e,{vertexProgram:a,fragmentProgram:l}=o,c=this.backend,u=c.device,f=c.utils,d=c.get(o),A=[];for(let H of e.getBindings()){let $=c.get(H),{layoutGPU:J}=$.layout;A.push(J)}let y=c.attributeUtils.createShaderVertexBuffers(e),w;r.blending!==ps&&(r.blending!==Ms||r.transparent!==!1)&&(w=this._getBlending(r));let S={};r.stencilWrite===!0&&(S={compare:this._getStencilCompare(r),failOp:this._getStencilOperation(r.stencilFail),depthFailOp:this._getStencilOperation(r.stencilZFail),passOp:this._getStencilOperation(r.stencilZPass)});let T=this._getColorWriteMask(r),R=[];if(e.context.textures!==null){let H=e.context.textures,$=e.context.mrt;for(let J=0;J<H.length;J++){let te=H[J],ce=f.getTextureFormatGPU(te),he;if($!==null)if(this.backend.compatibilityMode!==!0){let ve=$.getBlendMode(te.name);ve.blending===mb?he=w:ve.blending!==ps&&(he=this._getBlending(ve))}else ni("WebGPURenderer: Multiple Render Targets (MRT) blending configuration is not fully supported in compatibility mode. The material blending will be used for all render targets."),he=w;else he=w;R.push({format:ce,blend:he,writeMask:T})}}else{let H=f.getCurrentColorFormat(e.context);R.push({format:H,blend:w,writeMask:T})}let P=c.get(a).module,I=c.get(l).module,F=this._getPrimitiveState(n,s,r),D=this._getDepthCompare(r),L=f.getCurrentDepthStencilFormat(e.context),C=this._getSampleCount(e.context);ex.bindGroupLayouts=A;let B=u.createPipelineLayout(ex);ex.reset(),ac.label=`renderPipeline_${r.name||r.type}_${r.id}`,ac.vertex=Object.assign({},P,{buffers:y}),ac.fragment=Object.assign({},I,{targets:R}),ac.primitive=F,ac.multisample.count=C,ac.multisample.alphaToCoverageEnabled=r.alphaToCoverage&&C>1,ac.layout=B;let k={},z=e.context.depth,G=e.context.stencil;(z===!0||G===!0)&&(z===!0&&(k.format=L,k.depthWriteEnabled=r.depthWrite,k.depthCompare=D),G===!0&&(k.stencilFront=S,k.stencilBack=S,k.stencilReadMask=r.stencilFuncMask,k.stencilWriteMask=r.stencilWriteMask),r.polygonOffset===!0&&F.topology===rS.TriangleList&&(k.depthBias=r.polygonOffsetUnits,k.depthBiasSlopeScale=r.polygonOffsetFactor,k.depthBiasClamp=0),ac.depthStencil=k),u.pushErrorScope("validation");let W=[{program:a,module:P.module},{program:l,module:I.module}],Y=ac.label;if(t===null)d.pipeline=u.createRenderPipeline(ac),ac.reset(),u.popErrorScope().then(H=>{H!==null&&(d.error=!0,ze(`WebGPURenderer: Render pipeline creation failed (${Y}): ${H.message}`),this._reportShaderDiagnostics(W,Y))});else{let H=new Promise(async $=>{try{let J=null,te=null;try{te=u.createRenderPipelineAsync(ac)}catch(he){J=he}if(ac.reset(),te!==null)try{d.pipeline=await te}catch(he){J=he}let ce=await u.popErrorScope();if(ce!==null||J!==null){d.error=!0;let he=ce&&ce.message||J&&J.message||"unknown";ze(`WebGPURenderer: Async render pipeline creation failed (${Y}): ${he}`),await this._reportShaderDiagnostics(W,Y)}}finally{$()}});t.push(H)}}createBundleEncoder(e,t="renderBundleEncoder"){let n=this.backend,{utils:r,device:s}=n,o=r.getCurrentDepthStencilFormat(e),a=r.getCurrentColorFormats(e),l=this._getSampleCount(e);tx.label=t,tx.colorFormats=a,tx.depthStencilFormat=o,tx.sampleCount=l;let c=s.createRenderBundleEncoder(tx);return tx.reset(),c}createComputePipeline(e,t){let n=this.backend,r=n.device,s=n.get(e.computeProgram).module,o=n.get(e),a=[];for(let f of t){let d=n.get(f),{layoutGPU:A}=d.layout;a.push(A)}let l=e.computeProgram,c=`computePipeline_${l.stage}${l.name?`_${l.name}`:""}`;r.pushErrorScope("validation"),ex.bindGroupLayouts=a;let u=r.createPipelineLayout(ex);ex.reset(),eS.label=c,eS.compute=s,eS.layout=u,o.pipeline=r.createComputePipeline(eS),eS.reset(),r.popErrorScope().then(f=>{f!==null&&(o.error=!0,ze(`WebGPURenderer: Compute pipeline creation failed (${c}): ${f.message}`),this._reportShaderDiagnostics([{program:l,module:s.module}],c))})}async _reportShaderDiagnostics(e,t){for(let{program:n,module:r}of e){let s=await r.getCompilationInfo();if(s.messages.length===0)continue;let o=n.code.split(`47024702 `);for(let a of s.messages){let l=a.lineNum>0?` at line ${a.lineNum}${a.linePos>0?`:${a.linePos}`:""}`:"",c=`WebGPURenderer [${t} / ${n.stage} ${a.type}]${l}: ${a.message}`,u="";a.lineNum>0&&a.lineNum<=o.length&&(u=`47034703 ${o[a.lineNum-1]}`,a.linePos>0&&(u+=`4704- ${" ".repeat(a.linePos-1)}^`)),(a.type==="error"?ze:Xe)(c+u)}}}_getBlending(e){let t,n,r=e.blending,s=e.blendSrc,o=e.blendDst,a=e.blendEquation;if(r===Fd){let l=e.blendSrcAlpha!==null?e.blendSrcAlpha:s,c=e.blendDstAlpha!==null?e.blendDstAlpha:o,u=e.blendEquationAlpha!==null?e.blendEquationAlpha:a;t={srcFactor:this._getBlendFactor(s),dstFactor:this._getBlendFactor(o),operation:this._getBlendOperation(a)},n={srcFactor:this._getBlendFactor(l),dstFactor:this._getBlendFactor(c),operation:this._getBlendOperation(u)}}else{let l=e.premultipliedAlpha,c=(u,f,d,A)=>{t={srcFactor:u,dstFactor:f,operation:Ug.Add},n={srcFactor:d,dstFactor:A,operation:Ug.Add}};if(l)switch(r){case Ms:c(ui.One,ui.OneMinusSrcAlpha,ui.One,ui.OneMinusSrcAlpha);break;case Fh:c(ui.One,ui.One,ui.One,ui.One);break;case Bh:c(ui.Zero,ui.OneMinusSrc,ui.Zero,ui.One);break;case Oh:c(ui.Dst,ui.OneMinusSrcAlpha,ui.Zero,ui.One);break}else switch(r){case Ms:c(ui.SrcAlpha,ui.OneMinusSrcAlpha,ui.One,ui.OneMinusSrcAlpha);break;case Fh:c(ui.SrcAlpha,ui.One,ui.One,ui.One);break;case Bh:ze(`WebGPURenderer: "SubtractiveBlending" requires "${e.isMaterial?"material":"blendMode"}.premultipliedAlpha = true".`);break;case Oh:ze(`WebGPURenderer: "MultiplyBlending" requires "${e.isMaterial?"material":"blendMode"}.premultipliedAlpha = true".`);break}}if(t!==void 0&&n!==void 0)return{color:t,alpha:n};ze("WebGPURenderer: Invalid blending: ",r)}_getBlendFactor(e){let t;switch(e){case Nu:t=ui.Zero;break;case pb:t=ui.One;break;case mb:t=ui.Src;break;case Ab:t=ui.OneMinusSrc;break;case e0:t=ui.SrcAlpha;break;case t0:t=ui.OneMinusSrcAlpha;break;case _b:t=ui.Dst;break;case xb:t=ui.OneMinusDst;break;case gb:t=ui.DstAlpha;break;case vb:t=ui.OneMinusDstAlpha;break;case yb:t=ui.SrcAlphaSaturated;break;case cMe:t=ui.Constant;break;case uMe:t=ui.OneMinusConstant;break;default:ze("WebGPURenderer: Blend factor not supported.",e)}return t}_getStencilCompare(e){let t,n=e.stencilFunc;switch(n){case Y8:t=Wo.Never;break;case L2:t=Wo.Always;break;case Z8:t=Wo.Less;break;case Q8:t=Wo.LessEqual;break;case K8:t=Wo.Equal;break;case tF:t=Wo.GreaterEqual;break;case J8:t=Wo.Greater;break;case eF:t=Wo.NotEqual;break;default:ze("WebGPURenderer: Invalid stencil function.",n)}return t}_getStencilOperation(e){let t;switch(e){case Sd:t=im.Keep;break;case G8:t=im.Zero;break;case q8:t=im.Replace;break;case $8:t=im.Invert;break;case H8:t=im.IncrementClamp;break;case W8:t=im.DecrementClamp;break;case j8:t=im.IncrementWrap;break;case X8:t=im.DecrementWrap;break;default:ze("WebGPURenderer: Invalid stencil operation.",t)}return t}_getBlendOperation(e){let t;switch(e){case oo:t=Ug.Add;break;case fb:t=Ug.Subtract;break;case db:t=Ug.ReverseSubtract;break;case PM:t=Ug.Min;break;case LM:t=Ug.Max;break;default:ze("WebGPUPipelineUtils: Blend equation not supported.",e)}return t}_getPrimitiveState(e,t,n){let r={},s=this.backend.utils;r.topology=s.getPrimitiveTopology(e,n),t.index!==null&&e.isLine===!0&&e.isLineSegments!==!0&&(r.stripIndexFormat=t.index.array instanceof Uint16Array?iI.Uint16:iI.Uint32);let o=n.side===mi;return e.isMesh&&e.matrixWorld.determinantAffine()<0&&(o=!o),r.frontFace=o===!0?Ote.CW:Ote.CCW,r.cullMode=n.side===vr?Ute.None:Ute.Back,r}_getColorWriteMask(e){return e.colorWrite===!0?kte.All:kte.None}_getDepthCompare(e){let t;if(e.depthTest===!1)t=Wo.Always;else{let n=this.backend.parameters.reversedDepthBuffer?Bb[e.depthFunc]:e.depthFunc;switch(n){case NA:t=Wo.Never;break;case FA:t=Wo.Always;break;case BA:t=Wo.Less;break;case Ih:t=Wo.LessEqual;break;case OA:t=Wo.Equal;break;case UA:t=Wo.GreaterEqual;break;case kA:t=Wo.Greater;break;case zA:t=Wo.NotEqual;break;default:ze("WebGPUPipelineUtils: Invalid depth function.",n)}}return t}},uI=class{constructor(){this.label="",this.type=void 0,this.count=0}reset(){this.label="",this.type=void 0,this.count=0}},df=new ym,TPe=new l1,Kw=new uI,G9=class extends tI{constructor(e,t,n=2048){super(n),this.device=e,this.type=t,Kw.label=`queryset_global_timestamp_${t}`,Kw.type="timestamp",Kw.count=this.maxQueries,this.querySet=this.device.createQuerySet(Kw),Kw.reset();let r=this.maxQueries*8;df.label=`buffer_timestamp_resolve_${t}`,df.size=r,df.usage=GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC,this.resolveBuffer=this.device.createBuffer(df),df.reset(),df.label=`buffer_timestamp_result_${t}`,df.size=r,df.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,this.resultBuffer=this.device.createBuffer(df),df.reset()}allocateQueriesForContext(e){if(!this.trackTimestamp||this.isDisposed)return null;if(this.currentQueryIndex+2>this.maxQueries)return ni(`WebGPUTimestampQueryPool [${this.type}]: Maximum number of queries exceeded, when using trackTimestamp it is necessary to resolves the queries via renderer.resolveTimestampsAsync( THREE.TimestampQuery.${this.type.toUpperCase()} ).`),null;let t=this.currentQueryIndex;return this.currentQueryIndex+=2,this.queryOffsets.set(e,t),t}async resolveQueriesAsync(){if(!this.trackTimestamp||this.currentQueryIndex===0||this.isDisposed)return this.lastValue;if(this.pendingResolve)return this.pendingResolve;this.pendingResolve=this._resolveQueries();try{return await this.pendingResolve}finally{this.pendingResolve=null}}async _resolveQueries(){if(this.isDisposed)return this.lastValue;try{if(this.resultBuffer.mapState!=="unmapped")return this.lastValue;let e=new Map(this.queryOffsets),t=this.currentQueryIndex,n=t*8;this.currentQueryIndex=0,this.queryOffsets.clear();let r=this.device.createCommandEncoder(TPe);r.resolveQuerySet(this.querySet,0,t,this.resolveBuffer,0),r.copyBufferToBuffer(this.resolveBuffer,0,this.resultBuffer,0,n);let s=r.finish();if(gf(this.device,s),this.resultBuffer.mapState!=="unmapped")return this.lastValue;if(await this.resultBuffer.mapAsync(GPUMapMode.READ,0,n),this.isDisposed)return this.resultBuffer.mapState==="mapped"&&this.resultBuffer.unmap(),this.lastValue;let o=new BigUint64Array(this.resultBuffer.getMappedRange(0,n)),a={},l=[];for(let[u,f]of e){let d=u.match(/^(.*):f(\d+)$/),A=parseInt(d[2]);l.includes(A)===!1&&l.push(A),a[A]===void 0&&(a[A]=0);let y=o[f],w=o[f+1],S=Number(w-y)/1e6;this.timestamps.set(u,S),a[A]+=S}let c=a[l[l.length-1]];return this.resultBuffer.unmap(),this.lastValue=c,this.frames=l,c}catch(e){return ze("Error resolving queries:",e),this.resultBuffer.mapState==="mapped"&&this.resultBuffer.unmap(),this.lastValue}}async dispose(){if(!this.isDisposed){if(this.isDisposed=!0,this.pendingResolve)try{await this.pendingResolve}catch(e){ze("Error waiting for pending resolve:",e)}if(this.resultBuffer&&this.resultBuffer.mapState==="mapped")try{this.resultBuffer.unmap()}catch(e){ze("Error unmapping buffer:",e)}this.querySet&&(this.querySet.destroy(),this.querySet=null),this.resolveBuffer&&(this.resolveBuffer.destroy(),this.resolveBuffer=null),this.resultBuffer&&(this.resultBuffer.destroy(),this.resultBuffer=null),this.queryOffsets.clear(),this.pendingResolve=null}}},q9=class{constructor(){this.label="",this.timestampWrites=void 0}reset(){this.label="",this.timestampWrites=void 0}},rx=class{constructor(){this.view=null,this.depthLoadOp=void 0,this.depthStoreOp=void 0,this.depthClearValue=void 0,this.depthReadOnly=!1,this.stencilLoadOp=void 0,this.stencilStoreOp=void 0,this.stencilClearValue=0,this.stencilReadOnly=!1}reset(){this.view=null,this.depthLoadOp=void 0,this.depthStoreOp=void 0,this.depthClearValue=void 0,this.depthReadOnly=!1,this.stencilLoadOp=void 0,this.stencilStoreOp=void 0,this.stencilClearValue=0,this.stencilReadOnly=!1}},H9=class{constructor(){this.querySet=null,this.beginningOfPassWriteIndex=void 0,this.endOfPassWriteIndex=void 0}reset(){this.querySet=null,this.beginningOfPassWriteIndex=void 0,this.endOfPassWriteIndex=void 0}},qu={r:0,g:0,b:0,a:1},ac=new ym,$a=new l1,qR=new q9,Qw=new uI,HR=new lI,WR=new H9,Qc=new _x,pf=new _x,Er=new IS,Xd=new cI,W9=class extends eI{constructor(e={}){super(e),this.isWebGPUBackend=!0,this.parameters.alpha=e.alpha===void 0?!0:e.alpha,this.parameters.requiredLimits=e.requiredLimits===void 0?{}:e.requiredLimits,this.compatibilityMode=null,this.device=null,this.defaultRenderPassdescriptor=null,this.utils=new b9(this),this.attributeUtils=new F9(this),this.bindingUtils=new O9(this),this.capabilities=new U9(this),this.pipelineUtils=new V9(this),this.textureUtils=new I9(this),this.occludedResolveCache=new Map;let t=typeof navigator>"u"?!0:/Android/.test(navigator.userAgent)===!1;this._compatibility={[Ud.TEXTURE_COMPARE]:t}}async init(e){await super.init(e);let t=this.parameters,n;if(t.device===void 0){let r={powerPreference:t.powerPreference,featureLevel:"compatibility",xrCompatible:e.xr.enabled},s=typeof navigator<"u"?await navigator.gpu.requestAdapter(r):null;if(s===null)throw new Error("THREE.WebGPUBackend: Unable to create WebGPU adapter.");let o=Object.values(rI),a=[];for(let c of o)s.features.has(c)&&a.push(c);let l={requiredFeatures:a,requiredLimits:t.requiredLimits};n=await s.requestDevice(l)}else n=t.device;this.compatibilityMode=!n.features.has("core-features-and-limits"),this.compatibilityMode&&(e._samples=0),n.lost.then(r=>{if(r.reason==="destroyed")return;let s={api:"WebGPU",message:r.message||"Unknown reason",reason:r.reason||null,originalEvent:r};e.onDeviceLost(s)}),n.onuncapturederror=r=>{let s=r.error,o=s&&s.constructor?s.constructor.name:"GPUError",a=s&&s.message||"Unknown uncaptured GPU error";e.onError({api:"WebGPU",type:o,message:a,originalEvent:r})},this.device=n,this.trackTimestamp=this.trackTimestamp&&this.hasFeature(rI.TimestampQuery),this.updateSize()}setXRRenderTargetTextures(e,t,n=null){this.set(e.texture,{texture:t,format:t.format,externalTexture:!0,xrViewDescriptors:n,initialized:!0})}get context(){let e=this.renderer.getCanvasTarget(),t=this.get(e),n=t.context;if(n===void 0){let r=this.parameters;e.isDefaultCanvasTarget===!0&&r.context!==void 0?n=r.context:n=e.domElement.getContext("webgpu"),"setAttribute"in e.domElement&&e.domElement.setAttribute("data-engine",`three.js r${"185"} webgpu`);let s=r.alpha?"premultiplied":"opaque",o=r.outputType===Wi?"extended":"standard";n.configure({device:this.device,format:this.utils.getPreferredCanvasFormat(),usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,alphaMode:s,toneMapping:{mode:o}}),t.context=n}return n}get coordinateSystem(){return xl}get hasTimestamp(){return!0}async getArrayBufferAsync(e,t=null,n=0,r=-1){return await this.attributeUtils.getArrayBufferAsync(e,t,n,r)}getContext(){return this.context}_getDefaultRenderPassDescriptor(){let e=this.renderer,t=e.getCanvasTarget(),n=this.get(t),r=e.currentSamples,s=n.descriptor;if(s===void 0||n.samples!==r){if(s=new Jg,s.colorAttachments.push(new Qg),e.depth===!0||e.stencil===!0){let l=new rx;l.view=this.textureUtils.getDepthBuffer(e.depth,e.stencil).createView(),s.depthStencilAttachment=l}let a=s.colorAttachments[0];r>0?a.view=this.textureUtils.getColorBuffer().createView():a.resolveTarget=void 0,n.descriptor=s,n.samples=r}let o=s.colorAttachments[0];return r>0?o.resolveTarget=this.context.getCurrentTexture().createView():o.view=this.context.getCurrentTexture().createView(),s}_isRenderCameraDepthArray(e){let t=e.camera;return e.depthTexture&&e.depthTexture.isArrayTexture===!0&&t!==null&&t.isArrayCamera===!0}_hasExternalTexture(e){let t=e.textures;if(t===null)return!1;for(let n=0;n<t.length;n++)if(this.get(t[n]).externalTexture===!0)return!0;return!1}_createExternalTextureViews(e,t){let n=[],r=e.camera;if(t.xrViewDescriptors&&r!==null&&r.isArrayCamera===!0)for(let s=0;s<t.xrViewDescriptors.length;s++)n.push({view:t.texture.createView(t.xrViewDescriptors[s]),resolveTarget:void 0,depthSlice:void 0});else n.push({view:t.texture.createView({dimension:jo.TwoD,baseArrayLayer:e.activeCubeFace,arrayLayerCount:1}),resolveTarget:void 0,depthSlice:void 0});return n}_getRenderPassDescriptor(e,t={}){let n=e.renderTarget,r=this.get(n),s=this._hasExternalTexture(e),o=r.descriptors;(o===void 0||r.width!==n.width||r.height!==n.height||r.samples!==n.samples||s)&&(o={},r.descriptors=o);let a=e.getCacheKey(),l=o[a];if(l===void 0||s){let u=e.textures,f=[],d,A=this._isRenderCameraDepthArray(e);for(let w=0;w<u.length;w++){let S=this.get(u[w]);if(S.externalTexture===!0){f.push(...this._createExternalTextureViews(e,S));continue}if(Er.label=`colorAttachment_${w}`,Er.baseMipLevel=e.activeMipmapLevel,Er.mipLevelCount=1,Er.baseArrayLayer=e.activeCubeFace,Er.arrayLayerCount=1,Er.dimension=jo.TwoD,n.isRenderTarget3D)d=e.activeCubeFace,Er.baseArrayLayer=0,Er.dimension=jo.ThreeD;else if(n.isRenderTarget&&u[w].image.depth>1)if(A===!0){let T=e.camera.cameras;for(let R=0;R<T.length;R++){Er.baseArrayLayer=R,Er.arrayLayerCount=1,Er.dimension=jo.TwoD;let P=S.texture.createView(Er);f.push({view:P,resolveTarget:void 0,depthSlice:void 0})}}else Er.dimension=jo.TwoDArray;if(A!==!0){let T=S.texture.createView(Er),R,P;S.msaaTexture!==void 0?(R=S.msaaTexture.createView(),P=T):(R=T,P=void 0),f.push({view:R,resolveTarget:P,depthSlice:d})}Er.reset()}let y=[];for(let w=0;w<f.length;w++){let S=f[w],T=new Qg;T.view=S.view,T.depthSlice=S.depthSlice,T.resolveTarget=S.resolveTarget,y.push(T)}if(l={textureViews:f,colorAttachments:y,descriptor:new Jg},e.depth){let w=this.get(e.depthTexture);(e.depthTexture.isArrayTexture||e.depthTexture.isCubeTexture)&&(Er.dimension=jo.TwoD,Er.arrayLayerCount=1,Er.baseArrayLayer=e.activeCubeFace);let S=new rx;S.view=w.texture.createView(Er),l.depthStencilAttachment=S,Er.reset()}o[a]=l,r.width=n.width,r.height=n.height,r.samples=n.samples,r.activeMipmapLevel=e.activeMipmapLevel,r.activeCubeFace=e.activeCubeFace}let c=l.descriptor;c.reset();for(let u=0;u<l.colorAttachments.length;u++){let f=l.colorAttachments[u],d={r:0,g:0,b:0,a:1};u===0&&t.clearValue&&(d=t.clearValue),f.loadOp=t.loadOp||Fi.Load,f.storeOp=t.storeOp||Ya.Store,f.clearValue=d,c.colorAttachments.push(f)}return l.depthStencilAttachment&&(c.depthStencilAttachment=l.depthStencilAttachment),c}beginRender(e){let t=this.get(e),n=this.device,r=e.occlusionQueryCount,s;r>0&&(t.currentOcclusionQuerySet&&t.currentOcclusionQuerySet.destroy(),t.currentOcclusionQueryBuffer&&t.currentOcclusionQueryBuffer.destroy(),t.currentOcclusionQuerySet=t.occlusionQuerySet,t.currentOcclusionQueryBuffer=t.occlusionQueryBuffer,t.currentOcclusionQueryObjects=t.occlusionQueryObjects,Qw.label=`occlusionQuerySet_${e.id}`,Qw.type="occlusion",Qw.count=r,s=n.createQuerySet(Qw),Qw.reset(),t.occlusionQuerySet=s,t.occlusionQueryIndex=0,t.occlusionQueryObjects=new Array(r),t.lastOcclusionObject=null);let o;e.textures===null?o=this._getDefaultRenderPassDescriptor():o=this._getRenderPassDescriptor(e,{loadOp:Fi.Load}),this.initTimestampQuery(jc.RENDER,this.getTimestampUID(e),o),o.occlusionQuerySet=s;let a=o.depthStencilAttachment;if(e.textures!==null){let c=o.colorAttachments;for(let u=0;u<c.length;u++){let f=c[u];e.clearColor?(u===0?f.clearValue=e.clearColorValue:(qu.r=0,qu.g=0,qu.b=0,qu.a=1,f.clearValue=qu),f.loadOp=Fi.Clear):f.loadOp=Fi.Load,f.storeOp=Ya.Store}}else{let c=o.colorAttachments[0];e.clearColor?(c.clearValue=e.clearColorValue,c.loadOp=Fi.Clear):c.loadOp=Fi.Load,c.storeOp=Ya.Store}e.depth&&(e.clearDepth?(a.depthClearValue=e.clearDepthValue,a.depthLoadOp=Fi.Clear):a.depthLoadOp=Fi.Load,a.depthStoreOp=Ya.Store),e.stencil&&(e.clearStencil?(a.stencilClearValue=e.clearStencilValue,a.stencilLoadOp=Fi.Clear):a.stencilLoadOp=Fi.Load,a.stencilStoreOp=Ya.Store),$a.label="renderContext_"+e.id;let l=n.createCommandEncoder($a);if($a.reset(),this._isRenderCameraDepthArray(e)===!0){let c=e.camera.cameras;!t.layerDescriptors||t.layerDescriptors.length!==c.length?this._createArrayCameraLayerDescriptors(e,t,o,c):this._updateArrayCameraLayerDescriptors(e,t,c),t.bundleEncoders=[],t.bundleSets=[];for(let u=0;u<c.length;u++){let f=this.pipelineUtils.createBundleEncoder(e,"renderBundleArrayCamera_"+u),d={attributes:{},bindingGroups:[],pipeline:null,index:null};t.bundleEncoders.push(f),t.bundleSets.push(d)}t.currentPass=null}else{let c=l.beginRenderPass(o);t.currentPass=c,e.viewport&&this.updateViewport(e),e.scissor&&this.updateScissor(e)}t.descriptor=o,t.encoder=l,t.currentSets={attributes:{},bindingGroups:[],pipeline:null,index:null},t.renderBundles=[]}_createArrayCameraLayerDescriptors(e,t,n,r){let s=n.depthStencilAttachment;t.layerDescriptors=[];let o=this.get(e.depthTexture);o.viewCache||(o.viewCache=[]);for(let a=0;a<r.length;a++){let l=n.colorAttachments[0],c=new Qg;c.view=n.colorAttachments[a].view,c.depthSlice=l.depthSlice,c.resolveTarget=l.resolveTarget,c.loadOp=l.loadOp,c.storeOp=l.storeOp,c.clearValue=l.clearValue;let u=new Jg;if(u.label=n.label,u.occlusionQuerySet=n.occlusionQuerySet,u.timestampWrites=n.timestampWrites,u.colorAttachments.push(c),n.depthStencilAttachment){let f=a;o.viewCache[f]||(Er.dimension=jo.TwoD,Er.baseArrayLayer=a,Er.arrayLayerCount=1,o.viewCache[f]=o.texture.createView(Er),Er.reset());let d=new rx;d.view=o.viewCache[f],d.depthLoadOp=s.depthLoadOp||Fi.Clear,d.depthStoreOp=s.depthStoreOp||Ya.Store,d.depthClearValue=s.depthClearValue||1,e.stencil&&(d.stencilLoadOp=s.stencilLoadOp,d.stencilStoreOp=s.stencilStoreOp,d.stencilClearValue=s.stencilClearValue),u.depthStencilAttachment=d}else{let f=new rx;f.view=s.view,f.depthLoadOp=s.depthLoadOp,f.depthStoreOp=s.depthStoreOp,f.depthClearValue=s.depthClearValue,f.depthReadOnly=s.depthReadOnly,f.stencilLoadOp=s.stencilLoadOp,f.stencilStoreOp=s.stencilStoreOp,f.stencilClearValue=s.stencilClearValue,f.stencilReadOnly=s.stencilReadOnly,u.depthStencilAttachment=f}t.layerDescriptors.push(u)}}_updateArrayCameraLayerDescriptors(e,t,n){for(let r=0;r<n.length;r++){let s=t.layerDescriptors[r];if(s.depthStencilAttachment){let o=s.depthStencilAttachment;e.depth&&(e.clearDepth?(o.depthClearValue=e.clearDepthValue,o.depthLoadOp=Fi.Clear):o.depthLoadOp=Fi.Load),e.stencil&&(e.clearStencil?(o.stencilClearValue=e.clearStencilValue,o.stencilLoadOp=Fi.Clear):o.stencilLoadOp=Fi.Load)}}}finishRender(e){let t=this.get(e),n=e.occlusionQueryCount;t.renderBundles.length>0&&t.currentPass.executeBundles(t.renderBundles),n>t.occlusionQueryIndex&&t.currentPass.endOcclusionQuery();let r=t.encoder;if(this._isRenderCameraDepthArray(e)===!0){let s=[];for(let o=0;o<t.bundleEncoders.length;o++){let a=t.bundleEncoders[o];s.push(a.finish())}for(let o=0;o<t.layerDescriptors.length;o++)if(o<s.length){let a=t.layerDescriptors[o],l=r.beginRenderPass(a);if(e.viewport){let{x:c,y:u,width:f,height:d,minDepth:A,maxDepth:y}=e.viewportValue;l.setViewport(c,u,f,d,A,y)}if(e.scissor){let{x:c,y:u,width:f,height:d}=e.scissorValue;l.setScissorRect(c,u,f,d)}l.executeBundles([s[o]]),l.end()}}else t.currentPass&&t.currentPass.end();if(n>0){let s=n*8,o=this.occludedResolveCache.get(s);o===void 0&&(ac.size=s,ac.usage=GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC,o=this.device.createBuffer(ac),ac.reset(),this.occludedResolveCache.set(s,o)),ac.size=s,ac.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ;let a=this.device.createBuffer(ac);ac.reset(),t.encoder.resolveQuerySet(t.occlusionQuerySet,0,n,o,0),t.encoder.copyBufferToBuffer(o,0,a,0,s),t.occlusionQueryBuffer=a,this.resolveOccludedAsync(e)}if(gf(this.device,t.encoder.finish()),e.textures!==null){let s=e.textures;for(let o=0;o<s.length;o++){let a=s[o];a.generateMipmaps===!0&&this.textureUtils.generateMipmaps(a)}}}isOccluded(e,t){let n=this.get(e);return n.occluded&&n.occluded.has(t)}async resolveOccludedAsync(e){let t=this.get(e),{currentOcclusionQueryBuffer:n,currentOcclusionQueryObjects:r}=t;if(n&&r){let s=new WeakSet;t.currentOcclusionQueryObjects=null,t.currentOcclusionQueryBuffer=null,await n.mapAsync(GPUMapMode.READ);let o=n.getMappedRange(),a=new BigUint64Array(o);for(let l=0;l<r.length;l++)a[l]===BigInt(0)&&s.add(r[l]);n.destroy(),t.occluded=s}}updateViewport(e){let{currentPass:t}=this.get(e),{x:n,y:r,width:s,height:o,minDepth:a,maxDepth:l}=e.viewportValue;t.setViewport(n,r,s,o,a,l)}updateScissor(e){let{currentPass:t}=this.get(e),{x:n,y:r,width:s,height:o}=e.scissorValue;t.setScissorRect(n,r,s,o)}getClearColor(){let e=super.getClearColor();return this.renderer.alpha===!0&&(e.r*=e.a,e.g*=e.a,e.b*=e.a),e}clear(e,t,n,r=null){let s=this.device,o=this.renderer,a=[],l,c,u;if(e){let A=this.getClearColor();qu.r=A.r,qu.g=A.g,qu.b=A.b,qu.a=A.a}if(r===null){c=o.depth,u=o.stencil;let A=this._getDefaultRenderPassDescriptor();if(e){a=A.colorAttachments;let y=a[0];y.clearValue=qu,y.loadOp=Fi.Clear,y.storeOp=Ya.Store}(c||u)&&(l=A.depthStencilAttachment)}else{c=r.depth,u=r.stencil;let A={loadOp:e?Fi.Clear:Fi.Load,clearValue:e?qu:void 0};c&&(A.depthLoadOp=t?Fi.Clear:Fi.Load,A.depthClearValue=t?o.getClearDepth():void 0,A.depthStoreOp=Ya.Store),u&&(A.stencilLoadOp=n?Fi.Clear:Fi.Load,A.stencilClearValue=n?o.getClearStencil():void 0,A.stencilStoreOp=Ya.Store);let y=this._getRenderPassDescriptor(r,A);a=y.colorAttachments,l=y.depthStencilAttachment}c&&l&&(t?(l.depthLoadOp=Fi.Clear,l.depthClearValue=o.getClearDepth(),l.depthStoreOp=Ya.Store):(l.depthLoadOp=Fi.Load,l.depthStoreOp=Ya.Store)),u&&l&&(n?(l.stencilLoadOp=Fi.Clear,l.stencilClearValue=o.getClearStencil(),l.stencilStoreOp=Ya.Store):(l.stencilLoadOp=Fi.Load,l.stencilStoreOp=Ya.Store)),$a.label="clear";let f=s.createCommandEncoder($a);$a.reset(),f.beginRenderPass({colorAttachments:a,depthStencilAttachment:l}).end(),gf(s,f.finish())}beginCompute(e){let t=this.get(e),n="computeGroup_"+e.id;qR.label=n,$a.label=n,this.initTimestampQuery(jc.COMPUTE,this.getTimestampUID(e),qR),t.cmdEncoderGPU=this.device.createCommandEncoder($a),t.passEncoderGPU=t.cmdEncoderGPU.beginComputePass(qR),t.currentPipeline=null,$a.reset(),qR.reset()}compute(e,t,n,r,s=null){let o=this.get(t),a=this.get(e),{passEncoderGPU:l}=a,c=this.get(r).pipeline;a.currentPipeline!==c&&(l.setPipeline(c),a.currentPipeline=c);for(let u=0,f=n.length;u<f;u++){let d=n[u],A=this.get(d);l.setBindGroup(u,A.group)}if(s===null&&(s=t.dispatchSize||t.count),s&&s.isIndirectStorageBufferAttribute){let u=this.get(s).buffer;l.dispatchWorkgroupsIndirect(u,0);return}if(typeof s=="number"){let u=s;if(o.dispatchSize===void 0||o.count!==u){o.dispatchSize=[0,1,1],o.count=u;let f=t.workgroupSize,d=f[0];for(let w=1;w<f.length;w++)d*=f[w];let A=Math.ceil(u/d),y=this.device.limits.maxComputeWorkgroupsPerDimension;s=[A,1,1],A>y&&(s[0]=Math.min(A,y),s[1]=Math.ceil(A/y)),o.dispatchSize=s}s=o.dispatchSize}l.dispatchWorkgroups(s[0],s[1]||1,s[2]||1)}finishCompute(e){let t=this.get(e);t.passEncoderGPU.end(),gf(this.device,t.cmdEncoderGPU.finish())}_draw(e,t,n,r,s,o,a,l,c){let{object:u,material:f,context:d}=e,A=e.getIndex(),y=A!==null;c.pipeline!==r&&(l.setPipeline(r),c.pipeline=r);let w=c.bindingGroups;for(let S=0,T=s.length;S<T;S++){let R=s[S];if(w[S]!==R.id){let P=this.get(R);l.setBindGroup(S,P.group),w[S]=R.id}}if(y===!0&&c.index!==A){let S=this.get(A).buffer,T=A.array instanceof Uint16Array?iI.Uint16:iI.Uint32;l.setIndexBuffer(S,T),c.index=A}for(let S=0,T=o.length;S<T;S++){let R=o[S];if(c.attributes[S]!==R){let P=this.get(R).buffer;l.setVertexBuffer(S,P),c.attributes[S]=R}}if(d.stencil===!0&&f.stencilWrite===!0&&n.currentStencilRef!==f.stencilRef&&(l.setStencilReference(f.stencilRef),n.currentStencilRef=f.stencilRef),u.isBatchedMesh===!0){let S=u._multiDrawStarts,T=u._multiDrawCounts,R=u._multiDrawCount,P=y===!0?A.array.BYTES_PER_ELEMENT:1;f.wireframe&&(P=u.geometry.attributes.position.count>65535?4:2);for(let I=0;I<R;I++)y===!0?l.drawIndexed(T[I],1,S[I]/P,0,I):l.draw(T[I],1,S[I],I),t.update(u,T[I],1)}else if(y===!0){let{vertexCount:S,instanceCount:T,firstVertex:R}=a,P=e.getIndirect();if(P!==null){let I=this.get(P).buffer,F=e.getIndirectOffset(),D=Array.isArray(F)?F:[F];for(let L=0;L<D.length;L++)l.drawIndexedIndirect(I,D[L])}else l.drawIndexed(S,T,R,0,0);t.update(u,S,T)}else{let{vertexCount:S,instanceCount:T,firstVertex:R}=a,P=e.getIndirect();if(P!==null){let I=this.get(P).buffer,F=e.getIndirectOffset(),D=Array.isArray(F)?F:[F];for(let L=0;L<D.length;L++)l.drawIndirect(I,D[L])}else l.draw(S,T,R,0);t.update(u,S,T)}}draw(e,t){let{object:n,context:r,pipeline:s}=e,o=this.get(r),a=this.get(s),l=a.pipeline;if(a.error===!0)return;let c=e.getDrawParameters();if(c===null)return;let u=e.getBindings(),f=e.getVertexBuffers();if(e.camera.isArrayCamera&&e.camera.cameras.length>0){let d=this.get(e.camera),A=e.camera.cameras,y=e.getBindingGroup("cameraIndex");if(d.indexesGPU===void 0||d.indexesGPU.length!==A.length){let S=this.get(y),T=[],R=new Uint32Array([0,0,0,0]);for(let P=0,I=A.length;P<I;P++){R[0]=P;let{layoutGPU:F}=S.layout,D=this.bindingUtils.createBindGroupIndex(R,F);T.push(D)}d.indexesGPU=T}let w=this.renderer.getPixelRatio();for(let S=0,T=A.length;S<T;S++){let R=A[S];if(n.layers.test(R.layers)){let P=R.viewport,I=o.currentPass,F=o.currentSets,D=o.bundleEncoders!==void 0;if(D){let L=o.bundleEncoders[S],C=o.bundleSets[S];I=L,F=C}if(P&&!D&&I.setViewport(Math.floor(P.x*w),Math.floor(P.y*w),Math.floor(P.width*w),Math.floor(P.height*w),r.viewportValue.minDepth,r.viewportValue.maxDepth),y&&d.indexesGPU){let L=u.indexOf(y);I.setBindGroup(L,d.indexesGPU[S]),F.bindingGroups[L]=y.id}this._draw(e,t,o,l,u,f,c,I,F)}}}else if(o.currentPass){if(o.occlusionQuerySet!==void 0){let d=o.lastOcclusionObject;d!==n&&(d!==null&&d.occlusionTest===!0&&(o.currentPass.endOcclusionQuery(),o.occlusionQueryIndex++),n.occlusionTest===!0&&(o.currentPass.beginOcclusionQuery(o.occlusionQueryIndex),o.occlusionQueryObjects[o.occlusionQueryIndex]=n),o.lastOcclusionObject=n)}this._draw(e,t,o,l,u,f,c,o.currentPass,o.currentSets)}}needsRenderUpdate(e){let t=this.get(e),{object:n,material:r}=e,s=this.utils,o=s.getSampleCountRenderContext(e.context),a=s.getCurrentColorSpace(e.context),l=s.getCurrentColorFormat(e.context),c=s.getCurrentDepthStencilFormat(e.context),u=s.getPrimitiveTopology(n,r),f=n.isMesh&&n.matrixWorld.determinantAffine()<0,d=!1;return(t.material!==r||t.materialVersion!==r.version||t.transparent!==r.transparent||t.blending!==r.blending||t.premultipliedAlpha!==r.premultipliedAlpha||t.blendSrc!==r.blendSrc||t.blendDst!==r.blendDst||t.blendEquation!==r.blendEquation||t.blendSrcAlpha!==r.blendSrcAlpha||t.blendDstAlpha!==r.blendDstAlpha||t.blendEquationAlpha!==r.blendEquationAlpha||t.colorWrite!==r.colorWrite||t.depthWrite!==r.depthWrite||t.depthTest!==r.depthTest||t.depthFunc!==r.depthFunc||t.stencilWrite!==r.stencilWrite||t.stencilFunc!==r.stencilFunc||t.stencilFail!==r.stencilFail||t.stencilZFail!==r.stencilZFail||t.stencilZPass!==r.stencilZPass||t.stencilFuncMask!==r.stencilFuncMask||t.stencilWriteMask!==r.stencilWriteMask||t.side!==r.side||t.alphaToCoverage!==r.alphaToCoverage||t.sampleCount!==o||t.colorSpace!==a||t.colorFormat!==l||t.depthStencilFormat!==c||t.primitiveTopology!==u||t.frontFaceCW!==f||t.clippingContextCacheKey!==e.clippingContextCacheKey)&&(t.material=r,t.materialVersion=r.version,t.transparent=r.transparent,t.blending=r.blending,t.premultipliedAlpha=r.premultipliedAlpha,t.blendSrc=r.blendSrc,t.blendDst=r.blendDst,t.blendEquation=r.blendEquation,t.blendSrcAlpha=r.blendSrcAlpha,t.blendDstAlpha=r.blendDstAlpha,t.blendEquationAlpha=r.blendEquationAlpha,t.colorWrite=r.colorWrite,t.depthWrite=r.depthWrite,t.depthTest=r.depthTest,t.depthFunc=r.depthFunc,t.stencilWrite=r.stencilWrite,t.stencilFunc=r.stencilFunc,t.stencilFail=r.stencilFail,t.stencilZFail=r.stencilZFail,t.stencilZPass=r.stencilZPass,t.stencilFuncMask=r.stencilFuncMask,t.stencilWriteMask=r.stencilWriteMask,t.side=r.side,t.alphaToCoverage=r.alphaToCoverage,t.sampleCount=o,t.colorSpace=a,t.colorFormat=l,t.depthStencilFormat=c,t.primitiveTopology=u,t.frontFaceCW=f,t.clippingContextCacheKey=e.clippingContextCacheKey,d=!0),d}getRenderCacheKey(e){let{object:t,material:n}=e,r=this.utils,s=e.context,o=t.isMesh&&t.matrixWorld.determinantAffine()<0;return[n.transparent,n.blending,n.premultipliedAlpha,n.blendSrc,n.blendDst,n.blendEquation,n.blendSrcAlpha,n.blendDstAlpha,n.blendEquationAlpha,n.colorWrite,n.depthWrite,n.depthTest,n.depthFunc,n.stencilWrite,n.stencilFunc,n.stencilFail,n.stencilZFail,n.stencilZPass,n.stencilFuncMask,n.stencilWriteMask,n.side,o,r.getSampleCountRenderContext(s),r.getCurrentColorSpace(s),r.getCurrentColorFormat(s),r.getCurrentDepthStencilFormat(s),r.getPrimitiveTopology(t,n),e.getGeometryCacheKey(),e.clippingContextCacheKey].join()}updateSampler(e){return this.textureUtils.updateSampler(e)}destroySampler(e){this.textureUtils.destroySampler(e)}createDefaultTexture(e){return this.textureUtils.createDefaultTexture(e)}createTexture(e,t){this.textureUtils.createTexture(e,t)}updateTexture(e,t){this.textureUtils.updateTexture(e,t)}generateMipmaps(e){this.textureUtils.generateMipmaps(e)}destroyTexture(e,t=!1){this.textureUtils.destroyTexture(e,t)}async copyTextureToBuffer(e,t,n,r,s,o){return this.textureUtils.copyTextureToBuffer(e,t,n,r,s,o)}initTimestampQuery(e,t,n){if(!this.trackTimestamp)return;this.timestampQueryPool[e]||(this.timestampQueryPool[e]=new G9(this.device,e,2048));let r=this.timestampQueryPool[e],s=r.allocateQueriesForContext(t);WR.querySet=r.querySet,WR.beginningOfPassWriteIndex=s,WR.endOfPassWriteIndex=s+1,n.timestampWrites=WR}createNodeBuilder(e,t){return new N9(e,t)}createProgram(e){let t=this.get(e);HR.label=e.stage+(e.name!==""?`_${e.name}`:""),HR.code=e.code,t.module={module:this.device.createShaderModule(HR),entryPoint:"main"},HR.reset()}destroyProgram(e){this.delete(e)}createRenderPipeline(e,t){this.pipelineUtils.createRenderPipeline(e,t)}createComputePipeline(e,t){this.pipelineUtils.createComputePipeline(e,t)}beginBundle(e){let t=this.get(e);t._currentPass=t.currentPass,t._currentSets=t.currentSets,t.currentSets={attributes:{},bindingGroups:[],pipeline:null,index:null},t.currentPass=this.pipelineUtils.createBundleEncoder(e)}finishBundle(e,t){let n=this.get(e),s=n.currentPass.finish();this.get(t).bundleGPU=s,n.currentSets=n._currentSets,n.currentPass=n._currentPass}addBundle(e,t){this.get(e).renderBundles.push(this.get(t).bundleGPU)}createUniformBuffer(e){let t=this.get(e);if(t.buffer===void 0){let n=e.byteLength,r=GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,s=[];e.visibility&wf.VERTEX&&s.push("vertex"),e.visibility&wf.FRAGMENT&&s.push("fragment"),e.visibility&wf.COMPUTE&&s.push("compute");let o=`(${s.join(",")})`;ac.label=`bindingBuffer${e.id}_${e.name}_${o}`,ac.size=n,ac.usage=r;let a=this.device.createBuffer(ac);ac.reset(),t.buffer=a}}destroyUniformBuffer(e){this.get(e).buffer.destroy(),this.delete(e)}createBindings(e,t,n,r){this.bindingUtils.createBindings(e,t,n,r)}updateBindings(e,t,n,r){this.bindingUtils.createBindings(e,t,n,r)}updateBinding(e){this.bindingUtils.updateBinding(e)}deleteBindGroupData(e){this.bindingUtils.deleteBindGroupData(e)}createIndexAttribute(e){let t=GPUBufferUsage.INDEX|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST;(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)&&(t|=GPUBufferUsage.STORAGE),this.attributeUtils.createAttribute(e,t)}createAttribute(e){this.attributeUtils.createAttribute(e,GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST)}createStorageAttribute(e){this.attributeUtils.createAttribute(e,GPUBufferUsage.STORAGE|GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST)}createIndirectStorageAttribute(e){this.attributeUtils.createAttribute(e,GPUBufferUsage.STORAGE|GPUBufferUsage.INDIRECT|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST)}updateAttribute(e){this.attributeUtils.updateAttribute(e)}destroyAttribute(e){this.attributeUtils.destroyAttribute(e)}updateSize(){this.delete(this.renderer.getCanvasTarget())}hasFeature(e){return Gte[e]!==void 0&&(e=Gte[e]),this.device.features.has(e)}copyTextureToTexture(e,t,n=null,r=null,s=0,o=0){let a=0,l=0,c=0,u=0,f=0,d=0,A=e.image.width,y=e.image.height,w=1;n!==null&&(n.isBox3===!0?(u=n.min.x,f=n.min.y,d=n.min.z,A=n.max.x-n.min.x,y=n.max.y-n.min.y,w=n.max.z-n.min.z):(u=n.min.x,f=n.min.y,A=n.max.x-n.min.x,y=n.max.y-n.min.y,w=1)),r!==null&&(a=r.x,l=r.y,c=r.z||0),$a.label="copyTextureToTexture_"+e.id+"_"+t.id;let S=this.device.createCommandEncoder($a);$a.reset();let T=this.get(e).texture,R=this.get(t).texture;Qc.texture=T,Qc.mipLevel=s,Qc.origin.x=u,Qc.origin.y=f,Qc.origin.z=d,pf.texture=R,pf.mipLevel=o,pf.origin.x=a,pf.origin.y=l,pf.origin.z=c,Xd.width=A,Xd.height=y,Xd.depthOrArrayLayers=w,S.copyTextureToTexture(Qc,pf,Xd),Qc.reset(),pf.reset(),Xd.reset(),gf(this.device,S.finish()),o===0&&t.generateMipmaps&&this.textureUtils.generateMipmaps(t)}copyFramebufferToTexture(e,t,n){let r=this.get(t),s=null;t.renderTarget?e.isDepthTexture?s=this.get(t.depthTexture).texture:s=this.get(t.textures[0]).texture:e.isDepthTexture?s=this.textureUtils.getDepthBuffer(t.depth,t.stencil):s=this.context.getCurrentTexture();let o=this.get(e).texture;if(s.format!==o.format){ze("WebGPUBackend: copyFramebufferToTexture: Source and destination formats do not match.",s.format,o.format);return}let a;if(r.currentPass?(r.currentPass.end(),a=r.encoder):($a.label="copyFramebufferToTexture_"+e.id,a=this.device.createCommandEncoder($a),$a.reset()),Qc.texture=s,Qc.origin.x=n.x,Qc.origin.y=n.y,pf.texture=o,Xd.width=n.z,Xd.height=n.w,a.copyTextureToTexture(Qc,pf,Xd),Qc.reset(),pf.reset(),Xd.reset(),e.generateMipmaps&&this.textureUtils.generateMipmaps(e,a),r.currentPass){let{descriptor:l}=r;for(let c=0;c<l.colorAttachments.length;c++)l.colorAttachments[c].loadOp=Fi.Load;t.depth&&(l.depthStencilAttachment.depthLoadOp=Fi.Load),t.stencil&&(l.depthStencilAttachment.stencilLoadOp=Fi.Load),r.currentPass=a.beginRenderPass(l),r.currentSets={attributes:{},bindingGroups:[],pipeline:null,index:null},t.viewport&&this.updateViewport(t),t.scissor&&this.updateScissor(t)}else gf(this.device,a.finish())}hasCompatibility(e){return this._compatibility[e]!==void 0?this._compatibility[e]:super.hasCompatibility(e)}dispose(){if(this.bindingUtils.dispose(),this.textureUtils.dispose(),this.occludedResolveCache){for(let e of this.occludedResolveCache.values())e.destroy();this.occludedResolveCache.clear()}if(this.timestampQueryPool)for(let e of Object.values(this.timestampQueryPool))e!==null&&e.dispose();this.parameters.device===void 0&&this.device!==null&&this.device.destroy()}},j9=class extends JA{constructor(e,t,n,r,s,o){super(e,t,n,r,s,o),this.iesMap=null}copy(e,t){return super.copy(e,t),this.iesMap=e.iesMap,this}},X9=class extends JA{constructor(e,t,n,r,s,o){super(e,t,n,r,s,o),this.aspect=null}copy(e,t){return super.copy(e,t),this.aspect=e.aspect,this}},$9=class extends j4{constructor(){super(),this.addMaterial(g7,"MeshPhongMaterial"),this.addMaterial(S4,"MeshStandardMaterial"),this.addMaterial(T7,"MeshPhysicalMaterial"),this.addMaterial(M7,"MeshToonMaterial"),this.addMaterial(m7,"MeshBasicMaterial"),this.addMaterial(A7,"MeshLambertMaterial"),this.addMaterial(h7,"MeshNormalMaterial"),this.addMaterial(C7,"MeshMatcapMaterial"),this.addMaterial(l7,"LineBasicMaterial"),this.addMaterial(c7,"LineDashedMaterial"),this.addMaterial(I7,"PointsMaterial"),this.addMaterial(T4,"SpriteMaterial"),this.addMaterial(L7,"ShadowMaterial"),this.addLight(bk,ib),this.addLight(jk,eg),this.addLight(Kk,rb),this.addLight(ES,JA),this.addLight(Wk,tg),this.addLight(Xk,tb),this.addLight(Yk,sb),this.addLight($k,j9),this.addLight(Zk,X9),this.addToneMapping(Tse,bb),this.addToneMapping(Ese,wb),this.addToneMapping(Mse,Sb),this.addToneMapping(Cse,Tb),this.addToneMapping(Rse,Eb),this.addToneMapping(Ise,Mb)}},xx=class extends o9{constructor(e={}){let t;e.forceWebGL?t=nI:(t=W9,e.getFallback=()=>(Xe("WebGPURenderer: WebGPU is not available, running under WebGL2 backend."),new nI(e)));let n=new t(e);super(n,e),this.library=new $9,this.isWebGPURenderer=!0,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}};var alt=V.BRDF_GGX,llt=V.BRDF_Lambert,clt=V.BasicPointShadowFilter,ult=V.BasicShadowFilter,hlt=V.Break,flt=V.Const,dlt=V.Continue,plt=V.DFGLUT,mlt=V.D_GGX,Alt=V.Discard,glt=V.EPSILON,vlt=V.F_Schlick,aoe=V.Fn,_lt=V.INFINITY,loe=V.If,coe=V.Loop,xlt=V.NodeAccess,ylt=V.NodeShaderStage,blt=V.NodeType,wlt=V.NodeUpdateType,Slt=V.PCFShadowFilter,Tlt=V.PCFSoftShadowFilter,Elt=V.PI,Mlt=V.PI2,Clt=V.TWO_PI,Rlt=V.HALF_PI,Ilt=V.PointShadowFilter,Plt=V.Return,Llt=V.Schlick_to_F0,Dlt=V.ShaderNode,Nlt=V.Stack,Flt=V.Switch,Blt=V.TBNViewMatrix,Olt=V.VSMShadowFilter,Ult=V.V_GGX_SmithCorrelated,klt=V.Var,zlt=V.VarIntent,Vlt=V.abs,Glt=V.acesFilmicToneMapping,qlt=V.acos,Hlt=V.acosh,Wlt=V.add,jlt=V.addMethodChaining,Xlt=V.addNodeElement,$lt=V.agxToneMapping,Ylt=V.all,Zlt=V.alphaT,Klt=V.ambientOcclusion,Qlt=V.and,Jlt=V.anisotropy,ect=V.anisotropyB,tct=V.anisotropyT,nct=V.any,ict=V.append,rct=V.array,uoe=V.asin,sct=V.asinh,oct=V.assign,act=V.atan,lct=V.atanh,cct=V.atomicAdd,uct=V.atomicAnd,hct=V.atomicFunc,fct=V.atomicLoad,dct=V.atomicMax,pct=V.atomicMin,mct=V.atomicOr,Act=V.atomicStore,gct=V.atomicSub,vct=V.atomicXor,_ct=V.attenuationColor,xct=V.attenuationDistance,yct=V.attribute,bct=V.attributeArray,wct=V.backgroundBlurriness,Sct=V.backgroundIntensity,Tct=V.backgroundRotation,Ect=V.batch,Mct=V.bentNormalView,Cct=V.billboarding,Rct=V.bitAnd,Ict=V.bitNot,Pct=V.bitOr,Lct=V.bitXor,Dct=V.bitangentGeometry,Nct=V.bitangentLocal,Fct=V.bitangentView,Bct=V.bitangentWorld,Oct=V.bitcast,Uct=V.blendBurn,kct=V.blendColor,zct=V.blendDodge,Vct=V.blendOverlay,Gct=V.blendScreen,qct=V.blur,Hct=V.bool,Wct=V.buffer,jct=V.bufferAttribute,Xct=V.bumpMap,$ct=V.builtin,Yct=V.builtinAOContext,Zct=V.builtinShadowContext,Kct=V.bvec2,Qct=V.bvec3,Jct=V.bvec4,eut=V.bypass,tut=V.cache,nut=V.call,iut=V.cameraFar,rut=V.cameraIndex,sut=V.cameraNear,out=V.cameraNormalMatrix,aut=V.cameraPosition,lut=V.cameraProjectionMatrix,cut=V.cameraProjectionMatrixInverse,uut=V.cameraViewMatrix,hut=V.cameraViewport,fut=V.cameraWorldMatrix,dut=V.cbrt,put=V.cdl,mut=V.ceil,Aut=V.checker,gut=V.cineonToneMapping,vut=V.clamp,_ut=V.clearcoat,xut=V.clearcoatNormalView,yut=V.clearcoatRoughness,but=V.clipSpace,wut=V.code,Sut=V.color,Tut=V.colorSpaceToWorking,Eut=V.colorToDirection,Mut=V.compute,Cut=V.computeKernel,Rut=V.computeSkinning,Iut=V.context,Put=V.convert,Lut=V.convertColorSpace,Dut=V.convertToTexture,Nut=V.countLeadingZeros,Fut=V.countOneBits,But=V.countTrailingZeros,hoe=V.cos,Out=V.cosh,Uut=V.cross,kut=V.cubeTexture,zut=V.cubeTextureBase,Vut=V.dFdx,Gut=V.dFdy,qut=V.dashSize,Hut=V.debug,Wut=V.decrement,jut=V.decrementBefore,Xut=V.defaultBuildStages,$ut=V.defaultShaderStages,Yut=V.defined,Zut=V.degrees,Kut=V.deltaTime,Qut=V.densityFog,Jut=V.densityFogFactor,eht=V.depth,tht=V.depthPass,nht=V.determinant,iht=V.difference,rht=V.diffuseColor,sht=V.directPointLight,oht=V.directionToColor,aht=V.directionToFaceDirection,lht=V.dispersion,cht=V.distance,uht=V.div,hht=V.dot,fht=V.drawIndex,dht=V.dynamicBufferAttribute,pht=V.element,mht=V.emissive,Aht=V.equal,ght=V.equirectDirection,vht=V.equirectUV,foe=V.exp,_ht=V.exp2,xht=V.exponentialHeightFogFactor,yht=V.expression,bht=V.faceDirection,wht=V.faceForward,Sht=V.faceforward,doe=V.float,Tht=V.floatBitsToInt,Eht=V.floatBitsToUint,Mht=V.floor,Cht=V.fog,Rht=V.fract,Iht=V.frameGroup,Pht=V.frameId,Lht=V.frontFacing,Dht=V.fwidth,Nht=V.gain,Fht=V.gapSize,Bht=V.getConstNodeType,Oht=V.getCurrentStack,Uht=V.getDirection,kht=V.getDistanceAttenuation,zht=V.getGeometryRoughness,Vht=V.getNormalFromDepth,Ght=V.interleavedGradientNoise,qht=V.vogelDiskSample,Hht=V.getParallaxCorrectNormal,Wht=V.getRoughness,jht=V.getScreenPosition,Xht=V.getShIrradianceAt,$ht=V.getShadowMaterial,Yht=V.getShadowRenderObjectFunction,Zht=V.getTextureIndex,Kht=V.getViewPosition,Qht=V.globalId,Jht=V.glsl,eft=V.glslFn,tft=V.grayscale,nft=V.greaterThan,ift=V.greaterThanEqual,rft=V.hash,sft=V.highpModelNormalViewMatrix,oft=V.highpModelViewMatrix,aft=V.hue,lft=V.increment,cft=V.incrementBefore,uft=V.instance,poe=V.instanceIndex,hft=V.instancedArray,fft=V.instancedBufferAttribute,dft=V.instancedDynamicBufferAttribute,pft=V.instancedMesh,mft=V.int,Aft=V.intBitsToFloat,gft=V.inverse,vft=V.inverseSqrt,_ft=V.inversesqrt,xft=V.invocationLocalIndex,yft=V.invocationSubgroupIndex,bft=V.ior,wft=V.iridescence,Sft=V.iridescenceIOR,Tft=V.iridescenceThickness,Eft=V.ivec2,Mft=V.ivec3,Cft=V.ivec4,Rft=V.js,Ift=V.label,Pft=V.length,Lft=V.lengthSq,Dft=V.lessThan,Nft=V.lessThanEqual,Fft=V.lightPosition,Bft=V.lightProjectionUV,Oft=V.lightShadowMatrix,Uft=V.lightTargetDirection,kft=V.lightTargetPosition,zft=V.lightViewPosition,Vft=V.lightingContext,Gft=V.lights,qft=V.linearDepth,Hft=V.linearToneMapping,Wft=V.localId,jft=V.log,Xft=V.log2,$ft=V.logarithmicDepthToViewZ,Yft=V.luminance,Zft=V.mat2,Kft=V.mat3,Qft=V.mat4,Jft=V.matcapUV,edt=V.materialAO,tdt=V.materialAlphaTest,ndt=V.materialAnisotropy,idt=V.materialAnisotropyVector,rdt=V.materialAttenuationColor,sdt=V.materialAttenuationDistance,odt=V.materialClearcoat,adt=V.materialClearcoatNormal,ldt=V.materialClearcoatRoughness,cdt=V.materialColor,udt=V.materialDispersion,hdt=V.materialEmissive,fdt=V.materialEnvIntensity,ddt=V.materialEnvRotation,pdt=V.materialIOR,mdt=V.materialIridescence,Adt=V.materialIridescenceIOR,gdt=V.materialIridescenceThickness,vdt=V.materialLightMap,_dt=V.materialLineDashOffset,xdt=V.materialLineDashSize,ydt=V.materialLineGapSize,bdt=V.materialLineScale,wdt=V.materialLineWidth,Sdt=V.materialMetalness,Tdt=V.materialNormal,Edt=V.materialOpacity,Mdt=V.materialPointSize,Cdt=V.materialReference,Rdt=V.materialReflectivity,Idt=V.materialRefractionRatio,Pdt=V.materialRotation,Ldt=V.materialRoughness,Ddt=V.materialSheen,Ndt=V.materialSheenRoughness,Fdt=V.materialShininess,Bdt=V.materialSpecular,Odt=V.materialSpecularColor,Udt=V.materialSpecularIntensity,kdt=V.materialSpecularStrength,zdt=V.materialThickness,Vdt=V.materialTransmission,Gdt=V.max,qdt=V.maxMipLevel,Hdt=V.mediumpModelViewMatrix,Wdt=V.metalness,jdt=V.min,Xdt=V.mix,$dt=V.mixElement,Ydt=V.mod,Zdt=V.modelDirection,Kdt=V.modelNormalMatrix,Qdt=V.modelPosition,Jdt=V.modelRadius,ept=V.modelScale,tpt=V.modelViewMatrix,npt=V.modelViewPosition,ipt=V.modelViewProjection,rpt=V.modelWorldMatrix,spt=V.modelWorldMatrixInverse,opt=V.morphReference,apt=V.mrt,lpt=V.mul,cpt=V.mx_aastep,upt=V.mx_add,hpt=V.mx_atan2,fpt=V.mx_cell_noise_float,dpt=V.mx_contrast,ppt=V.mx_divide,mpt=V.mx_fractal_noise_float,Apt=V.mx_fractal_noise_vec2,gpt=V.mx_fractal_noise_vec3,vpt=V.mx_fractal_noise_vec4,_pt=V.mx_frame,xpt=V.mx_heighttonormal,ypt=V.mx_hsvtorgb,bpt=V.mx_ifequal,wpt=V.mx_ifgreater,Spt=V.mx_ifgreatereq,Tpt=V.mx_invert,Ept=V.mx_modulo,Mpt=V.mx_multiply,Cpt=V.mx_noise_float,Rpt=V.mx_noise_vec3,Ipt=V.mx_noise_vec4,Ppt=V.mx_place2d,Lpt=V.mx_power,Dpt=V.mx_ramp4,Npt=V.mx_ramplr,Fpt=V.mx_ramptb,Bpt=V.mx_rgbtohsv,Opt=V.mx_rotate2d,Upt=V.mx_rotate3d,kpt=V.mx_safepower,zpt=V.mx_separate,Vpt=V.mx_splitlr,Gpt=V.mx_splittb,qpt=V.mx_srgb_texture_to_lin_rec709,Hpt=V.mx_subtract,Wpt=V.mx_timer,jpt=V.mx_transform_uv,Xpt=V.mx_unifiednoise2d,$pt=V.mx_unifiednoise3d,Ypt=V.mx_worley_noise_float,Zpt=V.mx_worley_noise_vec2,Kpt=V.mx_worley_noise_vec3,moe=V.negate,Qpt=V.negateOnBackSide,Jpt=V.neutralToneMapping,e0t=V.nodeArray,t0t=V.nodeImmutable,n0t=V.nodeObject,i0t=V.nodeObjectIntent,r0t=V.nodeObjects,s0t=V.nodeProxy,o0t=V.nodeProxyIntent,a0t=V.normalFlat,l0t=V.normalGeometry,c0t=V.normalLocal,u0t=V.normalMap,h0t=V.normalView,f0t=V.normalViewGeometry,d0t=V.normalWorld,p0t=V.normalWorldGeometry,m0t=V.normalize,A0t=V.not,g0t=V.notEqual,v0t=V.numWorkgroups,_0t=V.objectDirection,x0t=V.objectGroup,y0t=V.objectPosition,b0t=V.objectRadius,w0t=V.objectScale,S0t=V.objectViewPosition,T0t=V.objectWorldMatrix,E0t=V.OnBeforeObjectUpdate,M0t=V.OnBeforeMaterialUpdate,C0t=V.OnObjectUpdate,R0t=V.OnMaterialUpdate,I0t=V.oneMinus,P0t=V.or,L0t=V.orthographicDepthToViewZ,D0t=V.oscSawtooth,N0t=V.oscSine,F0t=V.oscSquare,B0t=V.oscTriangle,O0t=V.output,U0t=V.outputStruct,k0t=V.overloadingFn,z0t=V.overrideNode,V0t=V.overrideNodes,G0t=V.packHalf2x16,q0t=V.packSnorm2x16,H0t=V.packUnorm2x16,W0t=V.packNormalToRGB,j0t=V.parabola,X0t=V.parallaxDirection,$0t=V.parallaxUV,Y0t=V.parameter,Z0t=V.pass,K0t=V.passTexture,Q0t=V.pcurve,J0t=V.perspectiveDepthToViewZ,emt=V.pmremTexture,tmt=V.pointShadow,nmt=V.pointUV,imt=V.pointWidth,rmt=V.positionGeometry,smt=V.positionLocal,omt=V.positionPrevious,amt=V.positionView,lmt=V.positionViewDirection,cmt=V.positionWorld,umt=V.positionWorldDirection,hmt=V.posterize,fmt=V.pow,dmt=V.pow2,pmt=V.pow3,mmt=V.pow4,Amt=V.premultiplyAlpha,gmt=V.property,vmt=V.radians,_mt=V.rand,xmt=V.range,ymt=V.rangeFog,bmt=V.rangeFogFactor,wmt=V.reciprocal,Smt=V.reference,Tmt=V.referenceBuffer,Emt=V.reflect,Mmt=V.reflectVector,Cmt=V.reflectView,Rmt=V.reflector,Imt=V.refract,Pmt=V.refractVector,Lmt=V.refractView,Dmt=V.reinhardToneMapping,Nmt=V.remap,Fmt=V.remapClamp,Bmt=V.renderGroup,Omt=V.renderOutput,Umt=V.rendererReference,kmt=V.replaceDefaultUV,zmt=V.rotate,Vmt=V.rotateUV,Gmt=V.roughness,qmt=V.round,Hmt=V.rtt,Wmt=V.sRGBTransferEOTF,jmt=V.sRGBTransferOETF,Xmt=V.sample,$mt=V.sampler,Ymt=V.samplerComparison,Zmt=V.saturate,Kmt=V.saturation,Qmt=V.screen,Jmt=V.screenCoordinate,eAt=V.screenDPR,tAt=V.screenSize,nAt=V.screenUV,iAt=V.select,rAt=V.setCurrentStack,sAt=V.setName,oAt=V.shaderStages,aAt=V.shadow,lAt=V.shadowPositionWorld,cAt=V.shapeCircle,uAt=V.sharedUniformGroup,hAt=V.sheen,fAt=V.sheenRoughness,dAt=V.shiftLeft,pAt=V.shiftRight,mAt=V.shininess,AAt=V.sign,Aoe=V.sin,gAt=V.sinh,vAt=V.sinc,_At=V.skinning,xAt=V.smoothstep,yAt=V.smoothstepElement,bAt=V.specularColor,wAt=V.specularF90,SAt=V.spherizeUV,TAt=V.split,EAt=V.spritesheetUV,goe=V.sqrt,MAt=V.stack,CAt=V.step,RAt=V.stepElement,voe=V.storage,IAt=V.storageBarrier,PAt=V.storageTexture,LAt=V.storageTexture3D,DAt=V.struct,NAt=V.sub,FAt=V.subgroupAdd,BAt=V.subgroupAll,OAt=V.subgroupAnd,UAt=V.subgroupAny,kAt=V.subgroupBallot,zAt=V.subgroupBroadcast,VAt=V.subgroupBroadcastFirst,GAt=V.subBuild,qAt=V.subgroupElect,HAt=V.subgroupExclusiveAdd,WAt=V.subgroupExclusiveMul,jAt=V.subgroupInclusiveAdd,XAt=V.subgroupInclusiveMul,$At=V.subgroupIndex,YAt=V.subgroupMax,ZAt=V.subgroupMin,KAt=V.subgroupMul,QAt=V.subgroupOr,JAt=V.subgroupShuffle,egt=V.subgroupShuffleDown,tgt=V.subgroupShuffleUp,ngt=V.subgroupShuffleXor,igt=V.subgroupSize,rgt=V.subgroupXor,sgt=V.tan,ogt=V.tanh,agt=V.tangentGeometry,lgt=V.tangentLocal,cgt=V.tangentView,ugt=V.tangentWorld,hgt=V.texture,fgt=V.texture3D,dgt=V.textureBarrier,pgt=V.textureBicubic,mgt=V.textureBicubicLevel,Agt=V.textureCubeUV,ggt=V.textureLoad,vgt=V.textureSize,_gt=V.textureLevel,xgt=V.textureStore,ygt=V.thickness,bgt=V.time,wgt=V.toneMapping,Sgt=V.toneMappingExposure,Tgt=V.toonOutlinePass,Egt=V.transformDirection,Mgt=V.transformNormal,Cgt=V.transformNormalByInverseViewMatrix,Rgt=V.transformNormalByViewMatrix,Igt=V.transformNormalToView,Pgt=V.transformedClearcoatNormalView,Lgt=V.transformedNormalView,Dgt=V.transformedNormalWorld,Ngt=V.transmission,Fgt=V.transpose,Bgt=V.triNoise3D,Ogt=V.triplanarTexture,Ugt=V.triplanarTextures,kgt=V.trunc,zgt=V.uint,Vgt=V.uintBitsToFloat,_oe=V.uniform,Ggt=V.uniformArray,qgt=V.uniformCubeTexture,Hgt=V.uniformGroup,Wgt=V.uniformFlow,jgt=V.uniformTexture,Xgt=V.unpackHalf2x16,$gt=V.unpackSnorm2x16,Ygt=V.unpackUnorm2x16,Zgt=V.unpackRGBToNormal,Kgt=V.unpremultiplyAlpha,Qgt=V.userData,Jgt=V.uv,e1t=V.uvec2,t1t=V.uvec3,n1t=V.uvec4,i1t=V.varying,r1t=V.varyingProperty,s1t=V.vec2,o1t=V.vec3,a1t=V.vec4,l1t=V.vectorComponents,c1t=V.velocity,u1t=V.vertexColor,h1t=V.vertexIndex,f1t=V.vertexStage,d1t=V.vibrance,p1t=V.viewZToLogarithmicDepth,m1t=V.viewZToOrthographicDepth,A1t=V.viewZToPerspectiveDepth,g1t=V.viewZToReversedOrthographicDepth,v1t=V.viewZToReversedPerspectiveDepth,_1t=V.viewport,x1t=V.viewportCoordinate,y1t=V.viewportDepthTexture,b1t=V.viewportLinearDepth,w1t=V.viewportMipTexture,S1t=V.viewportOpaqueMipTexture,T1t=V.viewportResolution,E1t=V.viewportSafeUV,M1t=V.viewportSharedTexture,C1t=V.viewportSize,R1t=V.viewportTexture,I1t=V.viewportUV,P1t=V.wgsl,L1t=V.wgslFn,D1t=V.workgroupArray,N1t=V.workgroupBarrier,F1t=V.workgroupId,B1t=V.workingToColorSpace,O1t=V.xor;var xoe=new Ua,zI=new re,Ex=class extends ob{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";let e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],t=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],n=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(n),this.setAttribute("position",new Ln(e,3)),this.setAttribute("uv",new Ln(t,2))}applyMatrix4(e){let t=this.attributes.instanceStart,n=this.attributes.instanceEnd;return t!==void 0&&(t.applyMatrix4(e),n.applyMatrix4(e),t.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));let n=new Nh(t,6,1);return this.setAttribute("instanceStart",new zo(n,3,0)),this.setAttribute("instanceEnd",new zo(n,3,3)),this.instanceCount=this.attributes.instanceStart.count,this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));let n=new Nh(t,6,1);return this.setAttribute("instanceColorStart",new zo(n,3,0)),this.setAttribute("instanceColorEnd",new zo(n,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new X2(e.geometry)),this}fromLineSegments(e){let t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Ua);let e=this.attributes.instanceStart,t=this.attributes.instanceEnd;e!==void 0&&t!==void 0&&(this.boundingBox.setFromBufferAttribute(e),xoe.setFromBufferAttribute(t),this.boundingBox.union(xoe))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new yl),this.boundingBox===null&&this.computeBoundingBox();let e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(e!==void 0&&t!==void 0){let n=this.boundingSphere.center;this.boundingBox.getCenter(n);let r=0;for(let s=0,o=e.count;s<o;s++)zI.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(zI)),zI.fromBufferAttribute(t,s),r=Math.max(r,n.distanceToSquared(zI));this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}};Nt.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new Oe},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}};qa.line={uniforms:mg.merge([Nt.common,Nt.fog,Nt.line]),vertexShader:`4704+ ${" ".repeat(a.linePos-1)}^`)),(a.type==="error"?ze:Xe)(c+u)}}}_getBlending(e){let t,n,r=e.blending,s=e.blendSrc,o=e.blendDst,a=e.blendEquation;if(r===Nd){let l=e.blendSrcAlpha!==null?e.blendSrcAlpha:s,c=e.blendDstAlpha!==null?e.blendDstAlpha:o,u=e.blendEquationAlpha!==null?e.blendEquationAlpha:a;t={srcFactor:this._getBlendFactor(s),dstFactor:this._getBlendFactor(o),operation:this._getBlendOperation(a)},n={srcFactor:this._getBlendFactor(l),dstFactor:this._getBlendFactor(c),operation:this._getBlendOperation(u)}}else{let l=e.premultipliedAlpha,c=(u,f,d,A)=>{t={srcFactor:u,dstFactor:f,operation:Ug.Add},n={srcFactor:d,dstFactor:A,operation:Ug.Add}};if(l)switch(r){case Ms:c(ui.One,ui.OneMinusSrcAlpha,ui.One,ui.OneMinusSrcAlpha);break;case Bh:c(ui.One,ui.One,ui.One,ui.One);break;case Oh:c(ui.Zero,ui.OneMinusSrc,ui.Zero,ui.One);break;case Uh:c(ui.Dst,ui.OneMinusSrcAlpha,ui.Zero,ui.One);break}else switch(r){case Ms:c(ui.SrcAlpha,ui.OneMinusSrcAlpha,ui.One,ui.OneMinusSrcAlpha);break;case Bh:c(ui.SrcAlpha,ui.One,ui.One,ui.One);break;case Oh:ze(`WebGPURenderer: "SubtractiveBlending" requires "${e.isMaterial?"material":"blendMode"}.premultipliedAlpha = true".`);break;case Uh:ze(`WebGPURenderer: "MultiplyBlending" requires "${e.isMaterial?"material":"blendMode"}.premultipliedAlpha = true".`);break}}if(t!==void 0&&n!==void 0)return{color:t,alpha:n};ze("WebGPURenderer: Invalid blending: ",r)}_getBlendFactor(e){let t;switch(e){case Bu:t=ui.Zero;break;case vb:t=ui.One;break;case _b:t=ui.Src;break;case xb:t=ui.OneMinusSrc;break;case e0:t=ui.SrcAlpha;break;case t0:t=ui.OneMinusSrcAlpha;break;case wb:t=ui.Dst;break;case Sb:t=ui.OneMinusDst;break;case yb:t=ui.DstAlpha;break;case bb:t=ui.OneMinusDstAlpha;break;case Tb:t=ui.SrcAlphaSaturated;break;case RMe:t=ui.Constant;break;case IMe:t=ui.OneMinusConstant;break;default:ze("WebGPURenderer: Blend factor not supported.",e)}return t}_getStencilCompare(e){let t,n=e.stencilFunc;switch(n){case iF:t=Wo.Never;break;case B2:t=Wo.Always;break;case rF:t=Wo.Less;break;case oF:t=Wo.LessEqual;break;case sF:t=Wo.Equal;break;case cF:t=Wo.GreaterEqual;break;case aF:t=Wo.Greater;break;case lF:t=Wo.NotEqual;break;default:ze("WebGPURenderer: Invalid stencil function.",n)}return t}_getStencilOperation(e){let t;switch(e){case wd:t=im.Keep;break;case Z8:t=im.Zero;break;case K8:t=im.Replace;break;case nF:t=im.Invert;break;case Q8:t=im.IncrementClamp;break;case J8:t=im.DecrementClamp;break;case eF:t=im.IncrementWrap;break;case tF:t=im.DecrementWrap;break;default:ze("WebGPURenderer: Invalid stencil operation.",t)}return t}_getBlendOperation(e){let t;switch(e){case oo:t=Ug.Add;break;case Ab:t=Ug.Subtract;break;case gb:t=Ug.ReverseSubtract;break;case FM:t=Ug.Min;break;case BM:t=Ug.Max;break;default:ze("WebGPUPipelineUtils: Blend equation not supported.",e)}return t}_getPrimitiveState(e,t,n){let r={},s=this.backend.utils;r.topology=s.getPrimitiveTopology(e,n),t.index!==null&&e.isLine===!0&&e.isLineSegments!==!0&&(r.stripIndexFormat=t.index.array instanceof Uint16Array?aI.Uint16:aI.Uint32);let o=n.side===mi;return e.isMesh&&e.matrixWorld.determinantAffine()<0&&(o=!o),r.frontFace=o===!0?jte.CW:jte.CCW,r.cullMode=n.side===vr?Xte.None:Xte.Back,r}_getColorWriteMask(e){return e.colorWrite===!0?$te.All:$te.None}_getDepthCompare(e){let t;if(e.depthTest===!1)t=Wo.Always;else{let n=this.backend.parameters.reversedDepthBuffer?zb[e.depthFunc]:e.depthFunc;switch(n){case NA:t=Wo.Never;break;case FA:t=Wo.Always;break;case BA:t=Wo.Less;break;case Ph:t=Wo.LessEqual;break;case OA:t=Wo.Equal;break;case UA:t=Wo.GreaterEqual;break;case kA:t=Wo.Greater;break;case zA:t=Wo.NotEqual;break;default:ze("WebGPUPipelineUtils: Invalid depth function.",n)}}return t}},pI=class{constructor(){this.label="",this.type=void 0,this.count=0}reset(){this.label="",this.type=void 0,this.count=0}},pf=new ym,WPe=new l1,tS=new pI,Z9=class extends sI{constructor(e,t,n=2048){super(n),this.device=e,this.type=t,tS.label=`queryset_global_timestamp_${t}`,tS.type="timestamp",tS.count=this.maxQueries,this.querySet=this.device.createQuerySet(tS),tS.reset();let r=this.maxQueries*8;pf.label=`buffer_timestamp_resolve_${t}`,pf.size=r,pf.usage=GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC,this.resolveBuffer=this.device.createBuffer(pf),pf.reset(),pf.label=`buffer_timestamp_result_${t}`,pf.size=r,pf.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,this.resultBuffer=this.device.createBuffer(pf),pf.reset()}allocateQueriesForContext(e){if(!this.trackTimestamp||this.isDisposed)return null;if(this.currentQueryIndex+2>this.maxQueries)return ni(`WebGPUTimestampQueryPool [${this.type}]: Maximum number of queries exceeded, when using trackTimestamp it is necessary to resolves the queries via renderer.resolveTimestampsAsync( THREE.TimestampQuery.${this.type.toUpperCase()} ).`),null;let t=this.currentQueryIndex;return this.currentQueryIndex+=2,this.queryOffsets.set(e,t),t}async resolveQueriesAsync(){if(!this.trackTimestamp||this.currentQueryIndex===0||this.isDisposed)return this.lastValue;if(this.pendingResolve)return this.pendingResolve;this.pendingResolve=this._resolveQueries();try{return await this.pendingResolve}finally{this.pendingResolve=null}}async _resolveQueries(){if(this.isDisposed)return this.lastValue;try{if(this.resultBuffer.mapState!=="unmapped")return this.lastValue;let e=new Map(this.queryOffsets),t=this.currentQueryIndex,n=t*8;this.currentQueryIndex=0,this.queryOffsets.clear();let r=this.device.createCommandEncoder(WPe);r.resolveQuerySet(this.querySet,0,t,this.resolveBuffer,0),r.copyBufferToBuffer(this.resolveBuffer,0,this.resultBuffer,0,n);let s=r.finish();if(vf(this.device,s),this.resultBuffer.mapState!=="unmapped")return this.lastValue;if(await this.resultBuffer.mapAsync(GPUMapMode.READ,0,n),this.isDisposed)return this.resultBuffer.mapState==="mapped"&&this.resultBuffer.unmap(),this.lastValue;let o=new BigUint64Array(this.resultBuffer.getMappedRange(0,n)),a={},l=[];for(let[u,f]of e){let d=u.match(/^(.*):f(\d+)$/),A=parseInt(d[2]);l.includes(A)===!1&&l.push(A),a[A]===void 0&&(a[A]=0);let y=o[f],w=o[f+1],S=Number(w-y)/1e6;this.timestamps.set(u,S),a[A]+=S}let c=a[l[l.length-1]];return this.resultBuffer.unmap(),this.lastValue=c,this.frames=l,c}catch(e){return ze("Error resolving queries:",e),this.resultBuffer.mapState==="mapped"&&this.resultBuffer.unmap(),this.lastValue}}async dispose(){if(!this.isDisposed){if(this.isDisposed=!0,this.pendingResolve)try{await this.pendingResolve}catch(e){ze("Error waiting for pending resolve:",e)}if(this.resultBuffer&&this.resultBuffer.mapState==="mapped")try{this.resultBuffer.unmap()}catch(e){ze("Error unmapping buffer:",e)}this.querySet&&(this.querySet.destroy(),this.querySet=null),this.resolveBuffer&&(this.resolveBuffer.destroy(),this.resolveBuffer=null),this.resultBuffer&&(this.resultBuffer.destroy(),this.resultBuffer=null),this.queryOffsets.clear(),this.pendingResolve=null}}},K9=class{constructor(){this.label="",this.timestampWrites=void 0}reset(){this.label="",this.timestampWrites=void 0}},ox=class{constructor(){this.view=null,this.depthLoadOp=void 0,this.depthStoreOp=void 0,this.depthClearValue=void 0,this.depthReadOnly=!1,this.stencilLoadOp=void 0,this.stencilStoreOp=void 0,this.stencilClearValue=0,this.stencilReadOnly=!1}reset(){this.view=null,this.depthLoadOp=void 0,this.depthStoreOp=void 0,this.depthClearValue=void 0,this.depthReadOnly=!1,this.stencilLoadOp=void 0,this.stencilStoreOp=void 0,this.stencilClearValue=0,this.stencilReadOnly=!1}},Q9=class{constructor(){this.querySet=null,this.beginningOfPassWriteIndex=void 0,this.endOfPassWriteIndex=void 0}reset(){this.querySet=null,this.beginningOfPassWriteIndex=void 0,this.endOfPassWriteIndex=void 0}},Wu={r:0,g:0,b:0,a:1},lc=new ym,Ya=new l1,XR=new K9,nS=new pI,$R=new fI,YR=new Q9,Jc=new yx,mf=new yx,Er=new NS,jd=new dI,J9=class extends rI{constructor(e={}){super(e),this.isWebGPUBackend=!0,this.parameters.alpha=e.alpha===void 0?!0:e.alpha,this.parameters.requiredLimits=e.requiredLimits===void 0?{}:e.requiredLimits,this.compatibilityMode=null,this.device=null,this.defaultRenderPassdescriptor=null,this.utils=new I9(this),this.attributeUtils=new q9(this),this.bindingUtils=new W9(this),this.capabilities=new j9(this),this.pipelineUtils=new Y9(this),this.textureUtils=new U9(this),this.occludedResolveCache=new Map;let t=typeof navigator>"u"?!0:/Android/.test(navigator.userAgent)===!1;this._compatibility={[Od.TEXTURE_COMPARE]:t}}async init(e){await super.init(e);let t=this.parameters,n;if(t.device===void 0){let r={powerPreference:t.powerPreference,featureLevel:"compatibility",xrCompatible:e.xr.enabled},s=typeof navigator<"u"?await navigator.gpu.requestAdapter(r):null;if(s===null)throw new Error("THREE.WebGPUBackend: Unable to create WebGPU adapter.");let o=Object.values(lI),a=[];for(let c of o)s.features.has(c)&&a.push(c);let l={requiredFeatures:a,requiredLimits:t.requiredLimits};n=await s.requestDevice(l)}else n=t.device;this.compatibilityMode=!n.features.has("core-features-and-limits"),this.compatibilityMode&&(e._samples=0),n.lost.then(r=>{if(r.reason==="destroyed")return;let s={api:"WebGPU",message:r.message||"Unknown reason",reason:r.reason||null,originalEvent:r};e.onDeviceLost(s)}),n.onuncapturederror=r=>{let s=r.error,o=s&&s.constructor?s.constructor.name:"GPUError",a=s&&s.message||"Unknown uncaptured GPU error";e.onError({api:"WebGPU",type:o,message:a,originalEvent:r})},this.device=n,this.trackTimestamp=this.trackTimestamp&&this.hasFeature(lI.TimestampQuery),this.updateSize()}setXRRenderTargetTextures(e,t,n=null){this.set(e.texture,{texture:t,format:t.format,externalTexture:!0,xrViewDescriptors:n,initialized:!0})}get context(){let e=this.renderer.getCanvasTarget(),t=this.get(e),n=t.context;if(n===void 0){let r=this.parameters;e.isDefaultCanvasTarget===!0&&r.context!==void 0?n=r.context:n=e.domElement.getContext("webgpu"),"setAttribute"in e.domElement&&e.domElement.setAttribute("data-engine",`three.js r${"185"} webgpu`);let s=r.alpha?"premultiplied":"opaque",o=r.outputType===Wi?"extended":"standard";n.configure({device:this.device,format:this.utils.getPreferredCanvasFormat(),usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,alphaMode:s,toneMapping:{mode:o}}),t.context=n}return n}get coordinateSystem(){return xl}get hasTimestamp(){return!0}async getArrayBufferAsync(e,t=null,n=0,r=-1){return await this.attributeUtils.getArrayBufferAsync(e,t,n,r)}getContext(){return this.context}_getDefaultRenderPassDescriptor(){let e=this.renderer,t=e.getCanvasTarget(),n=this.get(t),r=e.currentSamples,s=n.descriptor;if(s===void 0||n.samples!==r){if(s=new Jg,s.colorAttachments.push(new Qg),e.depth===!0||e.stencil===!0){let l=new ox;l.view=this.textureUtils.getDepthBuffer(e.depth,e.stencil).createView(),s.depthStencilAttachment=l}let a=s.colorAttachments[0];r>0?a.view=this.textureUtils.getColorBuffer().createView():a.resolveTarget=void 0,n.descriptor=s,n.samples=r}let o=s.colorAttachments[0];return r>0?o.resolveTarget=this.context.getCurrentTexture().createView():o.view=this.context.getCurrentTexture().createView(),s}_isRenderCameraDepthArray(e){let t=e.camera;return e.depthTexture&&e.depthTexture.isArrayTexture===!0&&t!==null&&t.isArrayCamera===!0}_hasExternalTexture(e){let t=e.textures;if(t===null)return!1;for(let n=0;n<t.length;n++)if(this.get(t[n]).externalTexture===!0)return!0;return!1}_createExternalTextureViews(e,t){let n=[],r=e.camera;if(t.xrViewDescriptors&&r!==null&&r.isArrayCamera===!0)for(let s=0;s<t.xrViewDescriptors.length;s++)n.push({view:t.texture.createView(t.xrViewDescriptors[s]),resolveTarget:void 0,depthSlice:void 0});else n.push({view:t.texture.createView({dimension:jo.TwoD,baseArrayLayer:e.activeCubeFace,arrayLayerCount:1}),resolveTarget:void 0,depthSlice:void 0});return n}_getRenderPassDescriptor(e,t={}){let n=e.renderTarget,r=this.get(n),s=this._hasExternalTexture(e),o=r.descriptors;(o===void 0||r.width!==n.width||r.height!==n.height||r.samples!==n.samples||s)&&(o={},r.descriptors=o);let a=e.getCacheKey(),l=o[a];if(l===void 0||s){let u=e.textures,f=[],d,A=this._isRenderCameraDepthArray(e);for(let w=0;w<u.length;w++){let S=this.get(u[w]);if(S.externalTexture===!0){f.push(...this._createExternalTextureViews(e,S));continue}if(Er.label=`colorAttachment_${w}`,Er.baseMipLevel=e.activeMipmapLevel,Er.mipLevelCount=1,Er.baseArrayLayer=e.activeCubeFace,Er.arrayLayerCount=1,Er.dimension=jo.TwoD,n.isRenderTarget3D)d=e.activeCubeFace,Er.baseArrayLayer=0,Er.dimension=jo.ThreeD;else if(n.isRenderTarget&&u[w].image.depth>1)if(A===!0){let T=e.camera.cameras;for(let R=0;R<T.length;R++){Er.baseArrayLayer=R,Er.arrayLayerCount=1,Er.dimension=jo.TwoD;let P=S.texture.createView(Er);f.push({view:P,resolveTarget:void 0,depthSlice:void 0})}}else Er.dimension=jo.TwoDArray;if(A!==!0){let T=S.texture.createView(Er),R,P;S.msaaTexture!==void 0?(R=S.msaaTexture.createView(),P=T):(R=T,P=void 0),f.push({view:R,resolveTarget:P,depthSlice:d})}Er.reset()}let y=[];for(let w=0;w<f.length;w++){let S=f[w],T=new Qg;T.view=S.view,T.depthSlice=S.depthSlice,T.resolveTarget=S.resolveTarget,y.push(T)}if(l={textureViews:f,colorAttachments:y,descriptor:new Jg},e.depth){let w=this.get(e.depthTexture);(e.depthTexture.isArrayTexture||e.depthTexture.isCubeTexture)&&(Er.dimension=jo.TwoD,Er.arrayLayerCount=1,Er.baseArrayLayer=e.activeCubeFace);let S=new ox;S.view=w.texture.createView(Er),l.depthStencilAttachment=S,Er.reset()}o[a]=l,r.width=n.width,r.height=n.height,r.samples=n.samples,r.activeMipmapLevel=e.activeMipmapLevel,r.activeCubeFace=e.activeCubeFace}let c=l.descriptor;c.reset();for(let u=0;u<l.colorAttachments.length;u++){let f=l.colorAttachments[u],d={r:0,g:0,b:0,a:1};u===0&&t.clearValue&&(d=t.clearValue),f.loadOp=t.loadOp||Fi.Load,f.storeOp=t.storeOp||Za.Store,f.clearValue=d,c.colorAttachments.push(f)}return l.depthStencilAttachment&&(c.depthStencilAttachment=l.depthStencilAttachment),c}beginRender(e){let t=this.get(e),n=this.device,r=e.occlusionQueryCount,s;r>0&&(t.currentOcclusionQuerySet&&t.currentOcclusionQuerySet.destroy(),t.currentOcclusionQueryBuffer&&t.currentOcclusionQueryBuffer.destroy(),t.currentOcclusionQuerySet=t.occlusionQuerySet,t.currentOcclusionQueryBuffer=t.occlusionQueryBuffer,t.currentOcclusionQueryObjects=t.occlusionQueryObjects,nS.label=`occlusionQuerySet_${e.id}`,nS.type="occlusion",nS.count=r,s=n.createQuerySet(nS),nS.reset(),t.occlusionQuerySet=s,t.occlusionQueryIndex=0,t.occlusionQueryObjects=new Array(r),t.lastOcclusionObject=null);let o;e.textures===null?o=this._getDefaultRenderPassDescriptor():o=this._getRenderPassDescriptor(e,{loadOp:Fi.Load}),this.initTimestampQuery(Xc.RENDER,this.getTimestampUID(e),o),o.occlusionQuerySet=s;let a=o.depthStencilAttachment;if(e.textures!==null){let c=o.colorAttachments;for(let u=0;u<c.length;u++){let f=c[u];e.clearColor?(u===0?f.clearValue=e.clearColorValue:(Wu.r=0,Wu.g=0,Wu.b=0,Wu.a=1,f.clearValue=Wu),f.loadOp=Fi.Clear):f.loadOp=Fi.Load,f.storeOp=Za.Store}}else{let c=o.colorAttachments[0];e.clearColor?(c.clearValue=e.clearColorValue,c.loadOp=Fi.Clear):c.loadOp=Fi.Load,c.storeOp=Za.Store}e.depth&&(e.clearDepth?(a.depthClearValue=e.clearDepthValue,a.depthLoadOp=Fi.Clear):a.depthLoadOp=Fi.Load,a.depthStoreOp=Za.Store),e.stencil&&(e.clearStencil?(a.stencilClearValue=e.clearStencilValue,a.stencilLoadOp=Fi.Clear):a.stencilLoadOp=Fi.Load,a.stencilStoreOp=Za.Store),Ya.label="renderContext_"+e.id;let l=n.createCommandEncoder(Ya);if(Ya.reset(),this._isRenderCameraDepthArray(e)===!0){let c=e.camera.cameras;!t.layerDescriptors||t.layerDescriptors.length!==c.length?this._createArrayCameraLayerDescriptors(e,t,o,c):this._updateArrayCameraLayerDescriptors(e,t,c),t.bundleEncoders=[],t.bundleSets=[];for(let u=0;u<c.length;u++){let f=this.pipelineUtils.createBundleEncoder(e,"renderBundleArrayCamera_"+u),d={attributes:{},bindingGroups:[],pipeline:null,index:null};t.bundleEncoders.push(f),t.bundleSets.push(d)}t.currentPass=null}else{let c=l.beginRenderPass(o);t.currentPass=c,e.viewport&&this.updateViewport(e),e.scissor&&this.updateScissor(e)}t.descriptor=o,t.encoder=l,t.currentSets={attributes:{},bindingGroups:[],pipeline:null,index:null},t.renderBundles=[]}_createArrayCameraLayerDescriptors(e,t,n,r){let s=n.depthStencilAttachment;t.layerDescriptors=[];let o=this.get(e.depthTexture);o.viewCache||(o.viewCache=[]);for(let a=0;a<r.length;a++){let l=n.colorAttachments[0],c=new Qg;c.view=n.colorAttachments[a].view,c.depthSlice=l.depthSlice,c.resolveTarget=l.resolveTarget,c.loadOp=l.loadOp,c.storeOp=l.storeOp,c.clearValue=l.clearValue;let u=new Jg;if(u.label=n.label,u.occlusionQuerySet=n.occlusionQuerySet,u.timestampWrites=n.timestampWrites,u.colorAttachments.push(c),n.depthStencilAttachment){let f=a;o.viewCache[f]||(Er.dimension=jo.TwoD,Er.baseArrayLayer=a,Er.arrayLayerCount=1,o.viewCache[f]=o.texture.createView(Er),Er.reset());let d=new ox;d.view=o.viewCache[f],d.depthLoadOp=s.depthLoadOp||Fi.Clear,d.depthStoreOp=s.depthStoreOp||Za.Store,d.depthClearValue=s.depthClearValue||1,e.stencil&&(d.stencilLoadOp=s.stencilLoadOp,d.stencilStoreOp=s.stencilStoreOp,d.stencilClearValue=s.stencilClearValue),u.depthStencilAttachment=d}else{let f=new ox;f.view=s.view,f.depthLoadOp=s.depthLoadOp,f.depthStoreOp=s.depthStoreOp,f.depthClearValue=s.depthClearValue,f.depthReadOnly=s.depthReadOnly,f.stencilLoadOp=s.stencilLoadOp,f.stencilStoreOp=s.stencilStoreOp,f.stencilClearValue=s.stencilClearValue,f.stencilReadOnly=s.stencilReadOnly,u.depthStencilAttachment=f}t.layerDescriptors.push(u)}}_updateArrayCameraLayerDescriptors(e,t,n){for(let r=0;r<n.length;r++){let s=t.layerDescriptors[r];if(s.depthStencilAttachment){let o=s.depthStencilAttachment;e.depth&&(e.clearDepth?(o.depthClearValue=e.clearDepthValue,o.depthLoadOp=Fi.Clear):o.depthLoadOp=Fi.Load),e.stencil&&(e.clearStencil?(o.stencilClearValue=e.clearStencilValue,o.stencilLoadOp=Fi.Clear):o.stencilLoadOp=Fi.Load)}}}finishRender(e){let t=this.get(e),n=e.occlusionQueryCount;t.renderBundles.length>0&&t.currentPass.executeBundles(t.renderBundles),n>t.occlusionQueryIndex&&t.currentPass.endOcclusionQuery();let r=t.encoder;if(this._isRenderCameraDepthArray(e)===!0){let s=[];for(let o=0;o<t.bundleEncoders.length;o++){let a=t.bundleEncoders[o];s.push(a.finish())}for(let o=0;o<t.layerDescriptors.length;o++)if(o<s.length){let a=t.layerDescriptors[o],l=r.beginRenderPass(a);if(e.viewport){let{x:c,y:u,width:f,height:d,minDepth:A,maxDepth:y}=e.viewportValue;l.setViewport(c,u,f,d,A,y)}if(e.scissor){let{x:c,y:u,width:f,height:d}=e.scissorValue;l.setScissorRect(c,u,f,d)}l.executeBundles([s[o]]),l.end()}}else t.currentPass&&t.currentPass.end();if(n>0){let s=n*8,o=this.occludedResolveCache.get(s);o===void 0&&(lc.size=s,lc.usage=GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC,o=this.device.createBuffer(lc),lc.reset(),this.occludedResolveCache.set(s,o)),lc.size=s,lc.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ;let a=this.device.createBuffer(lc);lc.reset(),t.encoder.resolveQuerySet(t.occlusionQuerySet,0,n,o,0),t.encoder.copyBufferToBuffer(o,0,a,0,s),t.occlusionQueryBuffer=a,this.resolveOccludedAsync(e)}if(vf(this.device,t.encoder.finish()),e.textures!==null){let s=e.textures;for(let o=0;o<s.length;o++){let a=s[o];a.generateMipmaps===!0&&this.textureUtils.generateMipmaps(a)}}}isOccluded(e,t){let n=this.get(e);return n.occluded&&n.occluded.has(t)}async resolveOccludedAsync(e){let t=this.get(e),{currentOcclusionQueryBuffer:n,currentOcclusionQueryObjects:r}=t;if(n&&r){let s=new WeakSet;t.currentOcclusionQueryObjects=null,t.currentOcclusionQueryBuffer=null,await n.mapAsync(GPUMapMode.READ);let o=n.getMappedRange(),a=new BigUint64Array(o);for(let l=0;l<r.length;l++)a[l]===BigInt(0)&&s.add(r[l]);n.destroy(),t.occluded=s}}updateViewport(e){let{currentPass:t}=this.get(e),{x:n,y:r,width:s,height:o,minDepth:a,maxDepth:l}=e.viewportValue;t.setViewport(n,r,s,o,a,l)}updateScissor(e){let{currentPass:t}=this.get(e),{x:n,y:r,width:s,height:o}=e.scissorValue;t.setScissorRect(n,r,s,o)}getClearColor(){let e=super.getClearColor();return this.renderer.alpha===!0&&(e.r*=e.a,e.g*=e.a,e.b*=e.a),e}clear(e,t,n,r=null){let s=this.device,o=this.renderer,a=[],l,c,u;if(e){let A=this.getClearColor();Wu.r=A.r,Wu.g=A.g,Wu.b=A.b,Wu.a=A.a}if(r===null){c=o.depth,u=o.stencil;let A=this._getDefaultRenderPassDescriptor();if(e){a=A.colorAttachments;let y=a[0];y.clearValue=Wu,y.loadOp=Fi.Clear,y.storeOp=Za.Store}(c||u)&&(l=A.depthStencilAttachment)}else{c=r.depth,u=r.stencil;let A={loadOp:e?Fi.Clear:Fi.Load,clearValue:e?Wu:void 0};c&&(A.depthLoadOp=t?Fi.Clear:Fi.Load,A.depthClearValue=t?o.getClearDepth():void 0,A.depthStoreOp=Za.Store),u&&(A.stencilLoadOp=n?Fi.Clear:Fi.Load,A.stencilClearValue=n?o.getClearStencil():void 0,A.stencilStoreOp=Za.Store);let y=this._getRenderPassDescriptor(r,A);a=y.colorAttachments,l=y.depthStencilAttachment}c&&l&&(t?(l.depthLoadOp=Fi.Clear,l.depthClearValue=o.getClearDepth(),l.depthStoreOp=Za.Store):(l.depthLoadOp=Fi.Load,l.depthStoreOp=Za.Store)),u&&l&&(n?(l.stencilLoadOp=Fi.Clear,l.stencilClearValue=o.getClearStencil(),l.stencilStoreOp=Za.Store):(l.stencilLoadOp=Fi.Load,l.stencilStoreOp=Za.Store)),Ya.label="clear";let f=s.createCommandEncoder(Ya);Ya.reset(),f.beginRenderPass({colorAttachments:a,depthStencilAttachment:l}).end(),vf(s,f.finish())}beginCompute(e){let t=this.get(e),n="computeGroup_"+e.id;XR.label=n,Ya.label=n,this.initTimestampQuery(Xc.COMPUTE,this.getTimestampUID(e),XR),t.cmdEncoderGPU=this.device.createCommandEncoder(Ya),t.passEncoderGPU=t.cmdEncoderGPU.beginComputePass(XR),t.currentPipeline=null,Ya.reset(),XR.reset()}compute(e,t,n,r,s=null){let o=this.get(t),a=this.get(e),{passEncoderGPU:l}=a,c=this.get(r).pipeline;a.currentPipeline!==c&&(l.setPipeline(c),a.currentPipeline=c);for(let u=0,f=n.length;u<f;u++){let d=n[u],A=this.get(d);l.setBindGroup(u,A.group)}if(s===null&&(s=t.dispatchSize||t.count),s&&s.isIndirectStorageBufferAttribute){let u=this.get(s).buffer;l.dispatchWorkgroupsIndirect(u,0);return}if(typeof s=="number"){let u=s;if(o.dispatchSize===void 0||o.count!==u){o.dispatchSize=[0,1,1],o.count=u;let f=t.workgroupSize,d=f[0];for(let w=1;w<f.length;w++)d*=f[w];let A=Math.ceil(u/d),y=this.device.limits.maxComputeWorkgroupsPerDimension;s=[A,1,1],A>y&&(s[0]=Math.min(A,y),s[1]=Math.ceil(A/y)),o.dispatchSize=s}s=o.dispatchSize}l.dispatchWorkgroups(s[0],s[1]||1,s[2]||1)}finishCompute(e){let t=this.get(e);t.passEncoderGPU.end(),vf(this.device,t.cmdEncoderGPU.finish())}_draw(e,t,n,r,s,o,a,l,c){let{object:u,material:f,context:d}=e,A=e.getIndex(),y=A!==null;c.pipeline!==r&&(l.setPipeline(r),c.pipeline=r);let w=c.bindingGroups;for(let S=0,T=s.length;S<T;S++){let R=s[S];if(w[S]!==R.id){let P=this.get(R);l.setBindGroup(S,P.group),w[S]=R.id}}if(y===!0&&c.index!==A){let S=this.get(A).buffer,T=A.array instanceof Uint16Array?aI.Uint16:aI.Uint32;l.setIndexBuffer(S,T),c.index=A}for(let S=0,T=o.length;S<T;S++){let R=o[S];if(c.attributes[S]!==R){let P=this.get(R).buffer;l.setVertexBuffer(S,P),c.attributes[S]=R}}if(d.stencil===!0&&f.stencilWrite===!0&&n.currentStencilRef!==f.stencilRef&&(l.setStencilReference(f.stencilRef),n.currentStencilRef=f.stencilRef),u.isBatchedMesh===!0){let S=u._multiDrawStarts,T=u._multiDrawCounts,R=u._multiDrawCount,P=y===!0?A.array.BYTES_PER_ELEMENT:1;f.wireframe&&(P=u.geometry.attributes.position.count>65535?4:2);for(let I=0;I<R;I++)y===!0?l.drawIndexed(T[I],1,S[I]/P,0,I):l.draw(T[I],1,S[I],I),t.update(u,T[I],1)}else if(y===!0){let{vertexCount:S,instanceCount:T,firstVertex:R}=a,P=e.getIndirect();if(P!==null){let I=this.get(P).buffer,F=e.getIndirectOffset(),D=Array.isArray(F)?F:[F];for(let L=0;L<D.length;L++)l.drawIndexedIndirect(I,D[L])}else l.drawIndexed(S,T,R,0,0);t.update(u,S,T)}else{let{vertexCount:S,instanceCount:T,firstVertex:R}=a,P=e.getIndirect();if(P!==null){let I=this.get(P).buffer,F=e.getIndirectOffset(),D=Array.isArray(F)?F:[F];for(let L=0;L<D.length;L++)l.drawIndirect(I,D[L])}else l.draw(S,T,R,0);t.update(u,S,T)}}draw(e,t){let{object:n,context:r,pipeline:s}=e,o=this.get(r),a=this.get(s),l=a.pipeline;if(a.error===!0)return;let c=e.getDrawParameters();if(c===null)return;let u=e.getBindings(),f=e.getVertexBuffers();if(e.camera.isArrayCamera&&e.camera.cameras.length>0){let d=this.get(e.camera),A=e.camera.cameras,y=e.getBindingGroup("cameraIndex");if(d.indexesGPU===void 0||d.indexesGPU.length!==A.length){let S=this.get(y),T=[],R=new Uint32Array([0,0,0,0]);for(let P=0,I=A.length;P<I;P++){R[0]=P;let{layoutGPU:F}=S.layout,D=this.bindingUtils.createBindGroupIndex(R,F);T.push(D)}d.indexesGPU=T}let w=this.renderer.getPixelRatio();for(let S=0,T=A.length;S<T;S++){let R=A[S];if(n.layers.test(R.layers)){let P=R.viewport,I=o.currentPass,F=o.currentSets,D=o.bundleEncoders!==void 0;if(D){let L=o.bundleEncoders[S],C=o.bundleSets[S];I=L,F=C}if(P&&!D&&I.setViewport(Math.floor(P.x*w),Math.floor(P.y*w),Math.floor(P.width*w),Math.floor(P.height*w),r.viewportValue.minDepth,r.viewportValue.maxDepth),y&&d.indexesGPU){let L=u.indexOf(y);I.setBindGroup(L,d.indexesGPU[S]),F.bindingGroups[L]=y.id}this._draw(e,t,o,l,u,f,c,I,F)}}}else if(o.currentPass){if(o.occlusionQuerySet!==void 0){let d=o.lastOcclusionObject;d!==n&&(d!==null&&d.occlusionTest===!0&&(o.currentPass.endOcclusionQuery(),o.occlusionQueryIndex++),n.occlusionTest===!0&&(o.currentPass.beginOcclusionQuery(o.occlusionQueryIndex),o.occlusionQueryObjects[o.occlusionQueryIndex]=n),o.lastOcclusionObject=n)}this._draw(e,t,o,l,u,f,c,o.currentPass,o.currentSets)}}needsRenderUpdate(e){let t=this.get(e),{object:n,material:r}=e,s=this.utils,o=s.getSampleCountRenderContext(e.context),a=s.getCurrentColorSpace(e.context),l=s.getCurrentColorFormat(e.context),c=s.getCurrentDepthStencilFormat(e.context),u=s.getPrimitiveTopology(n,r),f=n.isMesh&&n.matrixWorld.determinantAffine()<0,d=!1;return(t.material!==r||t.materialVersion!==r.version||t.transparent!==r.transparent||t.blending!==r.blending||t.premultipliedAlpha!==r.premultipliedAlpha||t.blendSrc!==r.blendSrc||t.blendDst!==r.blendDst||t.blendEquation!==r.blendEquation||t.blendSrcAlpha!==r.blendSrcAlpha||t.blendDstAlpha!==r.blendDstAlpha||t.blendEquationAlpha!==r.blendEquationAlpha||t.colorWrite!==r.colorWrite||t.depthWrite!==r.depthWrite||t.depthTest!==r.depthTest||t.depthFunc!==r.depthFunc||t.stencilWrite!==r.stencilWrite||t.stencilFunc!==r.stencilFunc||t.stencilFail!==r.stencilFail||t.stencilZFail!==r.stencilZFail||t.stencilZPass!==r.stencilZPass||t.stencilFuncMask!==r.stencilFuncMask||t.stencilWriteMask!==r.stencilWriteMask||t.side!==r.side||t.alphaToCoverage!==r.alphaToCoverage||t.sampleCount!==o||t.colorSpace!==a||t.colorFormat!==l||t.depthStencilFormat!==c||t.primitiveTopology!==u||t.frontFaceCW!==f||t.clippingContextCacheKey!==e.clippingContextCacheKey)&&(t.material=r,t.materialVersion=r.version,t.transparent=r.transparent,t.blending=r.blending,t.premultipliedAlpha=r.premultipliedAlpha,t.blendSrc=r.blendSrc,t.blendDst=r.blendDst,t.blendEquation=r.blendEquation,t.blendSrcAlpha=r.blendSrcAlpha,t.blendDstAlpha=r.blendDstAlpha,t.blendEquationAlpha=r.blendEquationAlpha,t.colorWrite=r.colorWrite,t.depthWrite=r.depthWrite,t.depthTest=r.depthTest,t.depthFunc=r.depthFunc,t.stencilWrite=r.stencilWrite,t.stencilFunc=r.stencilFunc,t.stencilFail=r.stencilFail,t.stencilZFail=r.stencilZFail,t.stencilZPass=r.stencilZPass,t.stencilFuncMask=r.stencilFuncMask,t.stencilWriteMask=r.stencilWriteMask,t.side=r.side,t.alphaToCoverage=r.alphaToCoverage,t.sampleCount=o,t.colorSpace=a,t.colorFormat=l,t.depthStencilFormat=c,t.primitiveTopology=u,t.frontFaceCW=f,t.clippingContextCacheKey=e.clippingContextCacheKey,d=!0),d}getRenderCacheKey(e){let{object:t,material:n}=e,r=this.utils,s=e.context,o=t.isMesh&&t.matrixWorld.determinantAffine()<0;return[n.transparent,n.blending,n.premultipliedAlpha,n.blendSrc,n.blendDst,n.blendEquation,n.blendSrcAlpha,n.blendDstAlpha,n.blendEquationAlpha,n.colorWrite,n.depthWrite,n.depthTest,n.depthFunc,n.stencilWrite,n.stencilFunc,n.stencilFail,n.stencilZFail,n.stencilZPass,n.stencilFuncMask,n.stencilWriteMask,n.side,o,r.getSampleCountRenderContext(s),r.getCurrentColorSpace(s),r.getCurrentColorFormat(s),r.getCurrentDepthStencilFormat(s),r.getPrimitiveTopology(t,n),e.getGeometryCacheKey(),e.clippingContextCacheKey].join()}updateSampler(e){return this.textureUtils.updateSampler(e)}destroySampler(e){this.textureUtils.destroySampler(e)}createDefaultTexture(e){return this.textureUtils.createDefaultTexture(e)}createTexture(e,t){this.textureUtils.createTexture(e,t)}updateTexture(e,t){this.textureUtils.updateTexture(e,t)}generateMipmaps(e){this.textureUtils.generateMipmaps(e)}destroyTexture(e,t=!1){this.textureUtils.destroyTexture(e,t)}async copyTextureToBuffer(e,t,n,r,s,o){return this.textureUtils.copyTextureToBuffer(e,t,n,r,s,o)}initTimestampQuery(e,t,n){if(!this.trackTimestamp)return;this.timestampQueryPool[e]||(this.timestampQueryPool[e]=new Z9(this.device,e,2048));let r=this.timestampQueryPool[e],s=r.allocateQueriesForContext(t);YR.querySet=r.querySet,YR.beginningOfPassWriteIndex=s,YR.endOfPassWriteIndex=s+1,n.timestampWrites=YR}createNodeBuilder(e,t){return new G9(e,t)}createProgram(e){let t=this.get(e);$R.label=e.stage+(e.name!==""?`_${e.name}`:""),$R.code=e.code,t.module={module:this.device.createShaderModule($R),entryPoint:"main"},$R.reset()}destroyProgram(e){this.delete(e)}createRenderPipeline(e,t){this.pipelineUtils.createRenderPipeline(e,t)}createComputePipeline(e,t){this.pipelineUtils.createComputePipeline(e,t)}beginBundle(e){let t=this.get(e);t._currentPass=t.currentPass,t._currentSets=t.currentSets,t.currentSets={attributes:{},bindingGroups:[],pipeline:null,index:null},t.currentPass=this.pipelineUtils.createBundleEncoder(e)}finishBundle(e,t){let n=this.get(e),s=n.currentPass.finish();this.get(t).bundleGPU=s,n.currentSets=n._currentSets,n.currentPass=n._currentPass}addBundle(e,t){this.get(e).renderBundles.push(this.get(t).bundleGPU)}createUniformBuffer(e){let t=this.get(e);if(t.buffer===void 0){let n=e.byteLength,r=GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,s=[];e.visibility&Sf.VERTEX&&s.push("vertex"),e.visibility&Sf.FRAGMENT&&s.push("fragment"),e.visibility&Sf.COMPUTE&&s.push("compute");let o=`(${s.join(",")})`;lc.label=`bindingBuffer${e.id}_${e.name}_${o}`,lc.size=n,lc.usage=r;let a=this.device.createBuffer(lc);lc.reset(),t.buffer=a}}destroyUniformBuffer(e){this.get(e).buffer.destroy(),this.delete(e)}createBindings(e,t,n,r){this.bindingUtils.createBindings(e,t,n,r)}updateBindings(e,t,n,r){this.bindingUtils.createBindings(e,t,n,r)}updateBinding(e){this.bindingUtils.updateBinding(e)}deleteBindGroupData(e){this.bindingUtils.deleteBindGroupData(e)}createIndexAttribute(e){let t=GPUBufferUsage.INDEX|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST;(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)&&(t|=GPUBufferUsage.STORAGE),this.attributeUtils.createAttribute(e,t)}createAttribute(e){this.attributeUtils.createAttribute(e,GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST)}createStorageAttribute(e){this.attributeUtils.createAttribute(e,GPUBufferUsage.STORAGE|GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST)}createIndirectStorageAttribute(e){this.attributeUtils.createAttribute(e,GPUBufferUsage.STORAGE|GPUBufferUsage.INDIRECT|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST)}updateAttribute(e){this.attributeUtils.updateAttribute(e)}destroyAttribute(e){this.attributeUtils.destroyAttribute(e)}updateSize(){this.delete(this.renderer.getCanvasTarget())}hasFeature(e){return Kte[e]!==void 0&&(e=Kte[e]),this.device.features.has(e)}copyTextureToTexture(e,t,n=null,r=null,s=0,o=0){let a=0,l=0,c=0,u=0,f=0,d=0,A=e.image.width,y=e.image.height,w=1;n!==null&&(n.isBox3===!0?(u=n.min.x,f=n.min.y,d=n.min.z,A=n.max.x-n.min.x,y=n.max.y-n.min.y,w=n.max.z-n.min.z):(u=n.min.x,f=n.min.y,A=n.max.x-n.min.x,y=n.max.y-n.min.y,w=1)),r!==null&&(a=r.x,l=r.y,c=r.z||0),Ya.label="copyTextureToTexture_"+e.id+"_"+t.id;let S=this.device.createCommandEncoder(Ya);Ya.reset();let T=this.get(e).texture,R=this.get(t).texture;Jc.texture=T,Jc.mipLevel=s,Jc.origin.x=u,Jc.origin.y=f,Jc.origin.z=d,mf.texture=R,mf.mipLevel=o,mf.origin.x=a,mf.origin.y=l,mf.origin.z=c,jd.width=A,jd.height=y,jd.depthOrArrayLayers=w,S.copyTextureToTexture(Jc,mf,jd),Jc.reset(),mf.reset(),jd.reset(),vf(this.device,S.finish()),o===0&&t.generateMipmaps&&this.textureUtils.generateMipmaps(t)}copyFramebufferToTexture(e,t,n){let r=this.get(t),s=null;t.renderTarget?e.isDepthTexture?s=this.get(t.depthTexture).texture:s=this.get(t.textures[0]).texture:e.isDepthTexture?s=this.textureUtils.getDepthBuffer(t.depth,t.stencil):s=this.context.getCurrentTexture();let o=this.get(e).texture;if(s.format!==o.format){ze("WebGPUBackend: copyFramebufferToTexture: Source and destination formats do not match.",s.format,o.format);return}let a;if(r.currentPass?(r.currentPass.end(),a=r.encoder):(Ya.label="copyFramebufferToTexture_"+e.id,a=this.device.createCommandEncoder(Ya),Ya.reset()),Jc.texture=s,Jc.origin.x=n.x,Jc.origin.y=n.y,mf.texture=o,jd.width=n.z,jd.height=n.w,a.copyTextureToTexture(Jc,mf,jd),Jc.reset(),mf.reset(),jd.reset(),e.generateMipmaps&&this.textureUtils.generateMipmaps(e,a),r.currentPass){let{descriptor:l}=r;for(let c=0;c<l.colorAttachments.length;c++)l.colorAttachments[c].loadOp=Fi.Load;t.depth&&(l.depthStencilAttachment.depthLoadOp=Fi.Load),t.stencil&&(l.depthStencilAttachment.stencilLoadOp=Fi.Load),r.currentPass=a.beginRenderPass(l),r.currentSets={attributes:{},bindingGroups:[],pipeline:null,index:null},t.viewport&&this.updateViewport(t),t.scissor&&this.updateScissor(t)}else vf(this.device,a.finish())}hasCompatibility(e){return this._compatibility[e]!==void 0?this._compatibility[e]:super.hasCompatibility(e)}dispose(){if(this.bindingUtils.dispose(),this.textureUtils.dispose(),this.occludedResolveCache){for(let e of this.occludedResolveCache.values())e.destroy();this.occludedResolveCache.clear()}if(this.timestampQueryPool)for(let e of Object.values(this.timestampQueryPool))e!==null&&e.dispose();this.parameters.device===void 0&&this.device!==null&&this.device.destroy()}},ez=class extends JA{constructor(e,t,n,r,s,o){super(e,t,n,r,s,o),this.iesMap=null}copy(e,t){return super.copy(e,t),this.iesMap=e.iesMap,this}},tz=class extends JA{constructor(e,t,n,r,s,o){super(e,t,n,r,s,o),this.aspect=null}copy(e,t){return super.copy(e,t),this.aspect=e.aspect,this}},nz=class extends Z4{constructor(){super(),this.addMaterial(T7,"MeshPhongMaterial"),this.addMaterial(C4,"MeshStandardMaterial"),this.addMaterial(D7,"MeshPhysicalMaterial"),this.addMaterial(F7,"MeshToonMaterial"),this.addMaterial(w7,"MeshBasicMaterial"),this.addMaterial(S7,"MeshLambertMaterial"),this.addMaterial(_7,"MeshNormalMaterial"),this.addMaterial(B7,"MeshMatcapMaterial"),this.addMaterial(A7,"LineBasicMaterial"),this.addMaterial(g7,"LineDashedMaterial"),this.addMaterial(U7,"PointsMaterial"),this.addMaterial(R4,"SpriteMaterial"),this.addMaterial(z7,"ShadowMaterial"),this.addLight(Ik,ab),this.addLight(e9,eg),this.addLight(s9,lb),this.addLight(IS,JA),this.addLight(Jk,tg),this.addLight(t9,sb),this.addLight(i9,cb),this.addLight(n9,ez),this.addLight(r9,tz),this.addToneMapping(Nse,Eb),this.addToneMapping(Fse,Mb),this.addToneMapping(Bse,Cb),this.addToneMapping(Ose,Rb),this.addToneMapping(Use,Ib),this.addToneMapping(kse,Pb)}},bx=class extends p9{constructor(e={}){let t;e.forceWebGL?t=oI:(t=J9,e.getFallback=()=>(Xe("WebGPURenderer: WebGPU is not available, running under WebGL2 backend."),new oI(e)));let n=new t(e);super(n,e),this.library=new nz,this.isWebGPURenderer=!0,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}};var Ilt=V.BRDF_GGX,Plt=V.BRDF_Lambert,Llt=V.BasicPointShadowFilter,Dlt=V.BasicShadowFilter,Nlt=V.Break,Flt=V.Const,Blt=V.Continue,Olt=V.DFGLUT,Ult=V.D_GGX,klt=V.Discard,zlt=V.EPSILON,Vlt=V.F_Schlick,Aoe=V.Fn,Glt=V.INFINITY,goe=V.If,voe=V.Loop,qlt=V.NodeAccess,Hlt=V.NodeShaderStage,Wlt=V.NodeType,jlt=V.NodeUpdateType,Xlt=V.PCFShadowFilter,$lt=V.PCFSoftShadowFilter,Ylt=V.PI,Zlt=V.PI2,Klt=V.TWO_PI,Qlt=V.HALF_PI,Jlt=V.PointShadowFilter,ect=V.Return,tct=V.Schlick_to_F0,nct=V.ShaderNode,ict=V.Stack,rct=V.Switch,sct=V.TBNViewMatrix,oct=V.VSMShadowFilter,act=V.V_GGX_SmithCorrelated,lct=V.Var,cct=V.VarIntent,uct=V.abs,hct=V.acesFilmicToneMapping,fct=V.acos,dct=V.acosh,pct=V.add,mct=V.addMethodChaining,Act=V.addNodeElement,gct=V.agxToneMapping,vct=V.all,_ct=V.alphaT,xct=V.ambientOcclusion,yct=V.and,bct=V.anisotropy,wct=V.anisotropyB,Sct=V.anisotropyT,Tct=V.any,Ect=V.append,Mct=V.array,_oe=V.asin,Cct=V.asinh,Rct=V.assign,Ict=V.atan,Pct=V.atanh,Lct=V.atomicAdd,Dct=V.atomicAnd,Nct=V.atomicFunc,Fct=V.atomicLoad,Bct=V.atomicMax,Oct=V.atomicMin,Uct=V.atomicOr,kct=V.atomicStore,zct=V.atomicSub,Vct=V.atomicXor,Gct=V.attenuationColor,qct=V.attenuationDistance,Hct=V.attribute,Wct=V.attributeArray,jct=V.backgroundBlurriness,Xct=V.backgroundIntensity,$ct=V.backgroundRotation,Yct=V.batch,Zct=V.bentNormalView,Kct=V.billboarding,Qct=V.bitAnd,Jct=V.bitNot,eut=V.bitOr,tut=V.bitXor,nut=V.bitangentGeometry,iut=V.bitangentLocal,rut=V.bitangentView,sut=V.bitangentWorld,out=V.bitcast,aut=V.blendBurn,lut=V.blendColor,cut=V.blendDodge,uut=V.blendOverlay,hut=V.blendScreen,fut=V.blur,dut=V.bool,put=V.buffer,mut=V.bufferAttribute,Aut=V.bumpMap,gut=V.builtin,vut=V.builtinAOContext,_ut=V.builtinShadowContext,xut=V.bvec2,yut=V.bvec3,but=V.bvec4,wut=V.bypass,Sut=V.cache,Tut=V.call,Eut=V.cameraFar,Mut=V.cameraIndex,Cut=V.cameraNear,Rut=V.cameraNormalMatrix,Iut=V.cameraPosition,Put=V.cameraProjectionMatrix,Lut=V.cameraProjectionMatrixInverse,Dut=V.cameraViewMatrix,Nut=V.cameraViewport,Fut=V.cameraWorldMatrix,But=V.cbrt,Out=V.cdl,Uut=V.ceil,kut=V.checker,zut=V.cineonToneMapping,Vut=V.clamp,Gut=V.clearcoat,qut=V.clearcoatNormalView,Hut=V.clearcoatRoughness,Wut=V.clipSpace,jut=V.code,Xut=V.color,$ut=V.colorSpaceToWorking,Yut=V.colorToDirection,Zut=V.compute,Kut=V.computeKernel,Qut=V.computeSkinning,Jut=V.context,eht=V.convert,tht=V.convertColorSpace,nht=V.convertToTexture,iht=V.countLeadingZeros,rht=V.countOneBits,sht=V.countTrailingZeros,xoe=V.cos,oht=V.cosh,aht=V.cross,lht=V.cubeTexture,cht=V.cubeTextureBase,uht=V.dFdx,hht=V.dFdy,fht=V.dashSize,dht=V.debug,pht=V.decrement,mht=V.decrementBefore,Aht=V.defaultBuildStages,ght=V.defaultShaderStages,vht=V.defined,_ht=V.degrees,xht=V.deltaTime,yht=V.densityFog,bht=V.densityFogFactor,wht=V.depth,Sht=V.depthPass,Tht=V.determinant,Eht=V.difference,Mht=V.diffuseColor,Cht=V.directPointLight,Rht=V.directionToColor,Iht=V.directionToFaceDirection,Pht=V.dispersion,Lht=V.distance,Dht=V.div,Nht=V.dot,Fht=V.drawIndex,Bht=V.dynamicBufferAttribute,Oht=V.element,Uht=V.emissive,kht=V.equal,zht=V.equirectDirection,Vht=V.equirectUV,yoe=V.exp,Ght=V.exp2,qht=V.exponentialHeightFogFactor,Hht=V.expression,Wht=V.faceDirection,jht=V.faceForward,Xht=V.faceforward,boe=V.float,$ht=V.floatBitsToInt,Yht=V.floatBitsToUint,Zht=V.floor,Kht=V.fog,Qht=V.fract,Jht=V.frameGroup,eft=V.frameId,tft=V.frontFacing,nft=V.fwidth,ift=V.gain,rft=V.gapSize,sft=V.getConstNodeType,oft=V.getCurrentStack,aft=V.getDirection,lft=V.getDistanceAttenuation,cft=V.getGeometryRoughness,uft=V.getNormalFromDepth,hft=V.interleavedGradientNoise,fft=V.vogelDiskSample,dft=V.getParallaxCorrectNormal,pft=V.getRoughness,mft=V.getScreenPosition,Aft=V.getShIrradianceAt,gft=V.getShadowMaterial,vft=V.getShadowRenderObjectFunction,_ft=V.getTextureIndex,xft=V.getViewPosition,yft=V.globalId,bft=V.glsl,wft=V.glslFn,Sft=V.grayscale,Tft=V.greaterThan,Eft=V.greaterThanEqual,Mft=V.hash,Cft=V.highpModelNormalViewMatrix,Rft=V.highpModelViewMatrix,Ift=V.hue,Pft=V.increment,Lft=V.incrementBefore,Dft=V.instance,woe=V.instanceIndex,Nft=V.instancedArray,Fft=V.instancedBufferAttribute,Bft=V.instancedDynamicBufferAttribute,Oft=V.instancedMesh,Uft=V.int,kft=V.intBitsToFloat,zft=V.inverse,Vft=V.inverseSqrt,Gft=V.inversesqrt,qft=V.invocationLocalIndex,Hft=V.invocationSubgroupIndex,Wft=V.ior,jft=V.iridescence,Xft=V.iridescenceIOR,$ft=V.iridescenceThickness,Yft=V.ivec2,Zft=V.ivec3,Kft=V.ivec4,Qft=V.js,Jft=V.label,edt=V.length,tdt=V.lengthSq,ndt=V.lessThan,idt=V.lessThanEqual,rdt=V.lightPosition,sdt=V.lightProjectionUV,odt=V.lightShadowMatrix,adt=V.lightTargetDirection,ldt=V.lightTargetPosition,cdt=V.lightViewPosition,udt=V.lightingContext,hdt=V.lights,fdt=V.linearDepth,ddt=V.linearToneMapping,pdt=V.localId,mdt=V.log,Adt=V.log2,gdt=V.logarithmicDepthToViewZ,vdt=V.luminance,_dt=V.mat2,xdt=V.mat3,ydt=V.mat4,bdt=V.matcapUV,wdt=V.materialAO,Sdt=V.materialAlphaTest,Tdt=V.materialAnisotropy,Edt=V.materialAnisotropyVector,Mdt=V.materialAttenuationColor,Cdt=V.materialAttenuationDistance,Rdt=V.materialClearcoat,Idt=V.materialClearcoatNormal,Pdt=V.materialClearcoatRoughness,Ldt=V.materialColor,Ddt=V.materialDispersion,Ndt=V.materialEmissive,Fdt=V.materialEnvIntensity,Bdt=V.materialEnvRotation,Odt=V.materialIOR,Udt=V.materialIridescence,kdt=V.materialIridescenceIOR,zdt=V.materialIridescenceThickness,Vdt=V.materialLightMap,Gdt=V.materialLineDashOffset,qdt=V.materialLineDashSize,Hdt=V.materialLineGapSize,Wdt=V.materialLineScale,jdt=V.materialLineWidth,Xdt=V.materialMetalness,$dt=V.materialNormal,Ydt=V.materialOpacity,Zdt=V.materialPointSize,Kdt=V.materialReference,Qdt=V.materialReflectivity,Jdt=V.materialRefractionRatio,ept=V.materialRotation,tpt=V.materialRoughness,npt=V.materialSheen,ipt=V.materialSheenRoughness,rpt=V.materialShininess,spt=V.materialSpecular,opt=V.materialSpecularColor,apt=V.materialSpecularIntensity,lpt=V.materialSpecularStrength,cpt=V.materialThickness,upt=V.materialTransmission,hpt=V.max,fpt=V.maxMipLevel,dpt=V.mediumpModelViewMatrix,ppt=V.metalness,mpt=V.min,Apt=V.mix,gpt=V.mixElement,vpt=V.mod,_pt=V.modelDirection,xpt=V.modelNormalMatrix,ypt=V.modelPosition,bpt=V.modelRadius,wpt=V.modelScale,Spt=V.modelViewMatrix,Tpt=V.modelViewPosition,Ept=V.modelViewProjection,Mpt=V.modelWorldMatrix,Cpt=V.modelWorldMatrixInverse,Rpt=V.morphReference,Ipt=V.mrt,Ppt=V.mul,Lpt=V.mx_aastep,Dpt=V.mx_add,Npt=V.mx_atan2,Fpt=V.mx_cell_noise_float,Bpt=V.mx_contrast,Opt=V.mx_divide,Upt=V.mx_fractal_noise_float,kpt=V.mx_fractal_noise_vec2,zpt=V.mx_fractal_noise_vec3,Vpt=V.mx_fractal_noise_vec4,Gpt=V.mx_frame,qpt=V.mx_heighttonormal,Hpt=V.mx_hsvtorgb,Wpt=V.mx_ifequal,jpt=V.mx_ifgreater,Xpt=V.mx_ifgreatereq,$pt=V.mx_invert,Ypt=V.mx_modulo,Zpt=V.mx_multiply,Kpt=V.mx_noise_float,Qpt=V.mx_noise_vec3,Jpt=V.mx_noise_vec4,e0t=V.mx_place2d,t0t=V.mx_power,n0t=V.mx_ramp4,i0t=V.mx_ramplr,r0t=V.mx_ramptb,s0t=V.mx_rgbtohsv,o0t=V.mx_rotate2d,a0t=V.mx_rotate3d,l0t=V.mx_safepower,c0t=V.mx_separate,u0t=V.mx_splitlr,h0t=V.mx_splittb,f0t=V.mx_srgb_texture_to_lin_rec709,d0t=V.mx_subtract,p0t=V.mx_timer,m0t=V.mx_transform_uv,A0t=V.mx_unifiednoise2d,g0t=V.mx_unifiednoise3d,v0t=V.mx_worley_noise_float,_0t=V.mx_worley_noise_vec2,x0t=V.mx_worley_noise_vec3,Soe=V.negate,y0t=V.negateOnBackSide,b0t=V.neutralToneMapping,w0t=V.nodeArray,S0t=V.nodeImmutable,T0t=V.nodeObject,E0t=V.nodeObjectIntent,M0t=V.nodeObjects,C0t=V.nodeProxy,R0t=V.nodeProxyIntent,I0t=V.normalFlat,P0t=V.normalGeometry,L0t=V.normalLocal,D0t=V.normalMap,N0t=V.normalView,F0t=V.normalViewGeometry,B0t=V.normalWorld,O0t=V.normalWorldGeometry,U0t=V.normalize,k0t=V.not,z0t=V.notEqual,V0t=V.numWorkgroups,G0t=V.objectDirection,q0t=V.objectGroup,H0t=V.objectPosition,W0t=V.objectRadius,j0t=V.objectScale,X0t=V.objectViewPosition,$0t=V.objectWorldMatrix,Y0t=V.OnBeforeObjectUpdate,Z0t=V.OnBeforeMaterialUpdate,K0t=V.OnObjectUpdate,Q0t=V.OnMaterialUpdate,J0t=V.oneMinus,emt=V.or,tmt=V.orthographicDepthToViewZ,nmt=V.oscSawtooth,imt=V.oscSine,rmt=V.oscSquare,smt=V.oscTriangle,omt=V.output,amt=V.outputStruct,lmt=V.overloadingFn,cmt=V.overrideNode,umt=V.overrideNodes,hmt=V.packHalf2x16,fmt=V.packSnorm2x16,dmt=V.packUnorm2x16,pmt=V.packNormalToRGB,mmt=V.parabola,Amt=V.parallaxDirection,gmt=V.parallaxUV,vmt=V.parameter,_mt=V.pass,xmt=V.passTexture,ymt=V.pcurve,bmt=V.perspectiveDepthToViewZ,wmt=V.pmremTexture,Smt=V.pointShadow,Tmt=V.pointUV,Emt=V.pointWidth,Mmt=V.positionGeometry,Cmt=V.positionLocal,Rmt=V.positionPrevious,Imt=V.positionView,Pmt=V.positionViewDirection,Lmt=V.positionWorld,Dmt=V.positionWorldDirection,Nmt=V.posterize,Fmt=V.pow,Bmt=V.pow2,Omt=V.pow3,Umt=V.pow4,kmt=V.premultiplyAlpha,zmt=V.property,Vmt=V.radians,Gmt=V.rand,qmt=V.range,Hmt=V.rangeFog,Wmt=V.rangeFogFactor,jmt=V.reciprocal,Xmt=V.reference,$mt=V.referenceBuffer,Ymt=V.reflect,Zmt=V.reflectVector,Kmt=V.reflectView,Qmt=V.reflector,Jmt=V.refract,eAt=V.refractVector,tAt=V.refractView,nAt=V.reinhardToneMapping,iAt=V.remap,rAt=V.remapClamp,sAt=V.renderGroup,oAt=V.renderOutput,aAt=V.rendererReference,lAt=V.replaceDefaultUV,cAt=V.rotate,uAt=V.rotateUV,hAt=V.roughness,fAt=V.round,dAt=V.rtt,pAt=V.sRGBTransferEOTF,mAt=V.sRGBTransferOETF,AAt=V.sample,gAt=V.sampler,vAt=V.samplerComparison,_At=V.saturate,xAt=V.saturation,yAt=V.screen,bAt=V.screenCoordinate,wAt=V.screenDPR,SAt=V.screenSize,TAt=V.screenUV,EAt=V.select,MAt=V.setCurrentStack,CAt=V.setName,RAt=V.shaderStages,IAt=V.shadow,PAt=V.shadowPositionWorld,LAt=V.shapeCircle,DAt=V.sharedUniformGroup,NAt=V.sheen,FAt=V.sheenRoughness,BAt=V.shiftLeft,OAt=V.shiftRight,UAt=V.shininess,kAt=V.sign,Toe=V.sin,zAt=V.sinh,VAt=V.sinc,GAt=V.skinning,qAt=V.smoothstep,HAt=V.smoothstepElement,WAt=V.specularColor,jAt=V.specularF90,XAt=V.spherizeUV,$At=V.split,YAt=V.spritesheetUV,Eoe=V.sqrt,ZAt=V.stack,KAt=V.step,QAt=V.stepElement,Moe=V.storage,JAt=V.storageBarrier,egt=V.storageTexture,tgt=V.storageTexture3D,ngt=V.struct,igt=V.sub,rgt=V.subgroupAdd,sgt=V.subgroupAll,ogt=V.subgroupAnd,agt=V.subgroupAny,lgt=V.subgroupBallot,cgt=V.subgroupBroadcast,ugt=V.subgroupBroadcastFirst,hgt=V.subBuild,fgt=V.subgroupElect,dgt=V.subgroupExclusiveAdd,pgt=V.subgroupExclusiveMul,mgt=V.subgroupInclusiveAdd,Agt=V.subgroupInclusiveMul,ggt=V.subgroupIndex,vgt=V.subgroupMax,_gt=V.subgroupMin,xgt=V.subgroupMul,ygt=V.subgroupOr,bgt=V.subgroupShuffle,wgt=V.subgroupShuffleDown,Sgt=V.subgroupShuffleUp,Tgt=V.subgroupShuffleXor,Egt=V.subgroupSize,Mgt=V.subgroupXor,Cgt=V.tan,Rgt=V.tanh,Igt=V.tangentGeometry,Pgt=V.tangentLocal,Lgt=V.tangentView,Dgt=V.tangentWorld,Ngt=V.texture,Fgt=V.texture3D,Bgt=V.textureBarrier,Ogt=V.textureBicubic,Ugt=V.textureBicubicLevel,kgt=V.textureCubeUV,zgt=V.textureLoad,Vgt=V.textureSize,Ggt=V.textureLevel,qgt=V.textureStore,Hgt=V.thickness,Wgt=V.time,jgt=V.toneMapping,Xgt=V.toneMappingExposure,$gt=V.toonOutlinePass,Ygt=V.transformDirection,Zgt=V.transformNormal,Kgt=V.transformNormalByInverseViewMatrix,Qgt=V.transformNormalByViewMatrix,Jgt=V.transformNormalToView,e1t=V.transformedClearcoatNormalView,t1t=V.transformedNormalView,n1t=V.transformedNormalWorld,i1t=V.transmission,r1t=V.transpose,s1t=V.triNoise3D,o1t=V.triplanarTexture,a1t=V.triplanarTextures,l1t=V.trunc,c1t=V.uint,u1t=V.uintBitsToFloat,Coe=V.uniform,h1t=V.uniformArray,f1t=V.uniformCubeTexture,d1t=V.uniformGroup,p1t=V.uniformFlow,m1t=V.uniformTexture,A1t=V.unpackHalf2x16,g1t=V.unpackSnorm2x16,v1t=V.unpackUnorm2x16,_1t=V.unpackRGBToNormal,x1t=V.unpremultiplyAlpha,y1t=V.userData,b1t=V.uv,w1t=V.uvec2,S1t=V.uvec3,T1t=V.uvec4,E1t=V.varying,M1t=V.varyingProperty,C1t=V.vec2,R1t=V.vec3,I1t=V.vec4,P1t=V.vectorComponents,L1t=V.velocity,D1t=V.vertexColor,N1t=V.vertexIndex,F1t=V.vertexStage,B1t=V.vibrance,O1t=V.viewZToLogarithmicDepth,U1t=V.viewZToOrthographicDepth,k1t=V.viewZToPerspectiveDepth,z1t=V.viewZToReversedOrthographicDepth,V1t=V.viewZToReversedPerspectiveDepth,G1t=V.viewport,q1t=V.viewportCoordinate,H1t=V.viewportDepthTexture,W1t=V.viewportLinearDepth,j1t=V.viewportMipTexture,X1t=V.viewportOpaqueMipTexture,$1t=V.viewportResolution,Y1t=V.viewportSafeUV,Z1t=V.viewportSharedTexture,K1t=V.viewportSize,Q1t=V.viewportTexture,J1t=V.viewportUV,evt=V.wgsl,tvt=V.wgslFn,nvt=V.workgroupArray,ivt=V.workgroupBarrier,rvt=V.workgroupId,svt=V.workingToColorSpace,ovt=V.xor;var Roe=new ka,HI=new re,Cx=class extends ub{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";let e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],t=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],n=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(n),this.setAttribute("position",new Ln(e,3)),this.setAttribute("uv",new Ln(t,2))}applyMatrix4(e){let t=this.attributes.instanceStart,n=this.attributes.instanceEnd;return t!==void 0&&(t.applyMatrix4(e),n.applyMatrix4(e),t.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));let n=new Fh(t,6,1);return this.setAttribute("instanceStart",new zo(n,3,0)),this.setAttribute("instanceEnd",new zo(n,3,3)),this.instanceCount=this.attributes.instanceStart.count,this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));let n=new Fh(t,6,1);return this.setAttribute("instanceColorStart",new zo(n,3,0)),this.setAttribute("instanceColorEnd",new zo(n,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new K2(e.geometry)),this}fromLineSegments(e){let t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new ka);let e=this.attributes.instanceStart,t=this.attributes.instanceEnd;e!==void 0&&t!==void 0&&(this.boundingBox.setFromBufferAttribute(e),Roe.setFromBufferAttribute(t),this.boundingBox.union(Roe))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new yl),this.boundingBox===null&&this.computeBoundingBox();let e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(e!==void 0&&t!==void 0){let n=this.boundingSphere.center;this.boundingBox.getCenter(n);let r=0;for(let s=0,o=e.count;s<o;s++)HI.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(HI)),HI.fromBufferAttribute(t,s),r=Math.max(r,n.distanceToSquared(HI));this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}};Nt.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new Oe},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}};Ha.line={uniforms:mg.merge([Nt.common,Nt.fog,Nt.line]),vertexShader:`47054705 #include <common>47064706 #include <color_pars_vertex>47074707 #include <fog_pars_vertex>@@ -5093,10 +5093,10 @@ var<${n}> ${e} : ${o};`}},ma=new ym,lU=new l1,ooe=new Map([[Int8Array,["sint8","
50935093 #include <premultiplied_alpha_fragment>50945094 50955095 }5096- `};var Pf=class extends ds{constructor(e){super({type:"LineMaterial",uniforms:mg.clone(qa.line.uniforms),vertexShader:qa.line.vertexShader,fragmentShader:qa.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,this.setValues(e)}get color(){return this.uniforms.diffuse.value}set color(e){this.uniforms.diffuse.value=e}get worldUnits(){return"WORLD_UNITS"in this.defines}set worldUnits(e){e===!0!==this.worldUnits&&(this.needsUpdate=!0),e===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}get linewidth(){return this.uniforms.linewidth.value}set linewidth(e){this.uniforms.linewidth&&(this.uniforms.linewidth.value=e)}get dashed(){return"USE_DASH"in this.defines}set dashed(e){e===!0!==this.dashed&&(this.needsUpdate=!0),e===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}get dashScale(){return this.uniforms.dashScale.value}set dashScale(e){this.uniforms.dashScale.value=e}get dashSize(){return this.uniforms.dashSize.value}set dashSize(e){this.uniforms.dashSize.value=e}get dashOffset(){return this.uniforms.dashOffset.value}set dashOffset(e){this.uniforms.dashOffset.value=e}get gapSize(){return this.uniforms.gapSize.value}set gapSize(e){this.uniforms.gapSize.value=e}get opacity(){return this.uniforms.opacity.value}set opacity(e){this.uniforms&&(this.uniforms.opacity.value=e)}get resolution(){return this.uniforms.resolution.value}set resolution(e){this.uniforms.resolution.value.copy(e)}get alphaToCoverage(){return"USE_ALPHA_TO_COVERAGE"in this.defines}set alphaToCoverage(e){this.defines&&(e===!0!==this.alphaToCoverage&&(this.needsUpdate=!0),e===!0?this.defines.USE_ALPHA_TO_COVERAGE="":delete this.defines.USE_ALPHA_TO_COVERAGE)}};var wV=new xn,yoe=new re,boe=new re,Ko=new xn,Qo=new xn,Lf=new xn,SV=new re,TV=new cn,Jo=new lb,woe=new re,VI=new Ua,GI=new yl,Df=new xn,Nf,p1;function Soe(i,e,t){return Df.set(0,0,-e,1).applyMatrix4(i.projectionMatrix),Df.multiplyScalar(1/Df.w),Df.x=p1/t.width,Df.y=p1/t.height,Df.applyMatrix4(i.projectionMatrixInverse),Df.multiplyScalar(1/Df.w),Math.abs(Math.max(Df.x,Df.y))}function MPe(i,e){let t=i.matrixWorld,n=i.geometry,r=n.attributes.instanceStart,s=n.attributes.instanceEnd,o=Math.min(n.instanceCount,r.count);for(let a=0,l=o;a<l;a++){Jo.start.fromBufferAttribute(r,a),Jo.end.fromBufferAttribute(s,a),Jo.applyMatrix4(t);let c=new re,u=new re;Nf.distanceSqToSegment(Jo.start,Jo.end,u,c),u.distanceTo(c)<p1*.5&&e.push({point:u,pointOnLine:c,distance:Nf.origin.distanceTo(u),object:i,face:null,faceIndex:a,uv:null,uv1:null})}}function CPe(i,e,t){let n=e.projectionMatrix,s=i.material.resolution,o=i.matrixWorld,a=i.geometry,l=a.attributes.instanceStart,c=a.attributes.instanceEnd,u=Math.min(a.instanceCount,l.count),f=-e.near;Nf.at(1,Lf),Lf.w=1,Lf.applyMatrix4(e.matrixWorldInverse),Lf.applyMatrix4(n),Lf.multiplyScalar(1/Lf.w),Lf.x*=s.x/2,Lf.y*=s.y/2,Lf.z=0,SV.copy(Lf),TV.multiplyMatrices(e.matrixWorldInverse,o);for(let d=0,A=u;d<A;d++){if(Ko.fromBufferAttribute(l,d),Qo.fromBufferAttribute(c,d),Ko.w=1,Qo.w=1,Ko.applyMatrix4(TV),Qo.applyMatrix4(TV),Ko.z>f&&Qo.z>f)continue;if(Ko.z>f){let P=Ko.z-Qo.z,I=(Ko.z-f)/P;Ko.lerp(Qo,I)}else if(Qo.z>f){let P=Qo.z-Ko.z,I=(Qo.z-f)/P;Qo.lerp(Ko,I)}Ko.applyMatrix4(n),Qo.applyMatrix4(n),Ko.multiplyScalar(1/Ko.w),Qo.multiplyScalar(1/Qo.w),Ko.x*=s.x/2,Ko.y*=s.y/2,Qo.x*=s.x/2,Qo.y*=s.y/2,Jo.start.copy(Ko),Jo.start.z=0,Jo.end.copy(Qo),Jo.end.z=0;let w=Jo.closestPointToPointParameter(SV,!0);Jo.at(w,woe);let S=Bu.lerp(Ko.z,Qo.z,w),T=S>=-1&&S<=1,R=SV.distanceTo(woe)<p1*.5;if(T&&R){Jo.start.fromBufferAttribute(l,d),Jo.end.fromBufferAttribute(c,d),Jo.start.applyMatrix4(o),Jo.end.applyMatrix4(o);let P=new re,I=new re;Nf.distanceSqToSegment(Jo.start,Jo.end,I,P),t.push({point:I,pointOnLine:P,distance:Nf.origin.distanceTo(I),object:i,face:null,faceIndex:d,uv:null,uv1:null})}}}var qI=class extends Hn{constructor(e=new Ex,t=new Pf({color:Math.random()*16777215})){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){let e=this.geometry,t=e.attributes.instanceStart,n=e.attributes.instanceEnd,r=new Float32Array(2*t.count);for(let o=0,a=0,l=t.count;o<l;o++,a+=2)yoe.fromBufferAttribute(t,o),boe.fromBufferAttribute(n,o),r[a]=a===0?0:r[a-1],r[a+1]=r[a]+yoe.distanceTo(boe);let s=new Nh(r,2,1);return e.setAttribute("instanceDistanceStart",new zo(s,1,0)),e.setAttribute("instanceDistanceEnd",new zo(s,1,1)),this}raycast(e,t){let n=this.material.worldUnits,r=e.camera;if(r===null&&!n&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.'),n===!1&&(this.material.resolution.x===0||this.material.resolution.y===0))return;let s=e.params.Line2!==void 0&&e.params.Line2.threshold||0;Nf=e.ray;let o=this.matrixWorld,a=this.geometry,l=this.material;p1=l.linewidth+s,a.boundingSphere===null&&a.computeBoundingSphere(),GI.copy(a.boundingSphere).applyMatrix4(o);let c;if(n)c=p1*.5;else{let f=Math.max(r.near,GI.distanceToPoint(Nf.origin));c=Soe(r,f,l.resolution)}if(GI.radius+=c,Nf.intersectsSphere(GI)===!1)return;a.boundingBox===null&&a.computeBoundingBox(),VI.copy(a.boundingBox).applyMatrix4(o);let u;if(n)u=p1*.5;else{let f=Math.max(r.near,VI.distanceToPoint(Nf.origin));u=Soe(r,f,l.resolution)}VI.expandByScalar(u),Nf.intersectsBox(VI)!==!1&&(n?MPe(this,t):CPe(this,r,t))}onBeforeRender(e){let t=this.material.uniforms;t&&t.resolution&&(e.getViewport(wV),this.material.uniforms.resolution.value.set(wV.z,wV.w))}};var Em=class extends Ex{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(e){let t=e.length-3,n=new Float32Array(2*t);for(let r=0;r<t;r+=3)n[2*r]=e[r],n[2*r+1]=e[r+1],n[2*r+2]=e[r+2],n[2*r+3]=e[r+3],n[2*r+4]=e[r+4],n[2*r+5]=e[r+5];return super.setPositions(n),this}setColors(e){let t=e.length-3,n=new Float32Array(2*t);for(let r=0;r<t;r+=3)n[2*r]=e[r],n[2*r+1]=e[r+1],n[2*r+2]=e[r+2],n[2*r+3]=e[r+3],n[2*r+4]=e[r+4],n[2*r+5]=e[r+5];return super.setColors(n),this}setFromPoints(e){let t=e.length-1,n=new Float32Array(6*t);for(let r=0;r<t;r++)n[6*r]=e[r].x,n[6*r+1]=e[r].y,n[6*r+2]=e[r].z||0,n[6*r+3]=e[r+1].x,n[6*r+4]=e[r+1].y,n[6*r+5]=e[r+1].z||0;return super.setPositions(n),this}fromLine(e){let t=e.geometry;return this.setPositions(t.attributes.position.array),this}};var Mx=class extends qI{constructor(e=new Em,t=new Pf({color:Math.random()*16777215})){super(e,t),this.isLine2=!0,this.type="Line2"}};var Cx=class{constructor(e){this.isFont=!0,this.type="Font",this.data=e}generateShapes(e,t=100,n="ltr"){let r=[],s=RPe(e,t,this.data,n);for(let o=0,a=s.length;o<a;o++)r.push(...s[o].toShapes());return r}};function RPe(i,e,t,n){let r=Array.from(i),s=e/t.resolution,o=(t.boundingBox.yMax-t.boundingBox.yMin+t.underlineThickness)*s,a=[],l=0,c=0;(n=="rtl"||n=="tb")&&r.reverse();for(let u=0;u<r.length;u++){let f=r[u];if(f===`5097-`)l=0,c-=o;else{let d=IPe(f,s,l,c,t);n=="tb"?(l=0,c+=t.ascender*s):l+=d.offsetX,a.push(d.path)}}return a}function IPe(i,e,t,n,r){let s=r.glyphs[i]||r.glyphs["?"];if(!s){console.error('THREE.Font: character "'+i+'" does not exists in font family '+r.familyName+".");return}let o=new cb,a,l,c,u,f,d,A,y;if(s.o){let w=s._cachedOutline||(s._cachedOutline=s.o.split(" "));for(let S=0,T=w.length;S<T;)switch(w[S++]){case"m":a=w[S++]*e+t,l=w[S++]*e+n,o.moveTo(a,l);break;case"l":a=w[S++]*e+t,l=w[S++]*e+n,o.lineTo(a,l);break;case"q":c=w[S++]*e+t,u=w[S++]*e+n,f=w[S++]*e+t,d=w[S++]*e+n,o.quadraticCurveTo(f,d,c,u);break;case"b":c=w[S++]*e+t,u=w[S++]*e+n,f=w[S++]*e+t,d=w[S++]*e+n,A=w[S++]*e+t,y=w[S++]*e+n,o.bezierCurveTo(f,d,A,y,c,u);break}}return{offsetX:s.ha*e,path:o}}var US=class i extends W2{constructor(e,t={}){let n=t.font;if(n===void 0)super();else{let r=n.generateShapes(e,t.size,t.direction);t.depth===void 0&&(t.depth=50),t.bevelThickness===void 0&&(t.bevelThickness=10),t.bevelSize===void 0&&(t.bevelSize=8),t.bevelEnabled===void 0&&(t.bevelEnabled=!1),super(r,t)}this.type="TextGeometry"}toJSON(){return super.toJSON()}static fromJSON(e){let t=e.options;return t.font=new Cx(t.font.data),new i(t.text,t)}};function IV(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function PPe(i){if(Array.isArray(i))return i}function LPe(i){if(Array.isArray(i))return IV(i)}function Boe(i,e,t){if(typeof i=="function"?i===e:i.has(e))return arguments.length<3?e:t;throw new TypeError("Private element is not present on this object")}function DPe(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function Toe(i,e,t,n,r,s,o){try{var a=i[s](o),l=a.value}catch(c){return void t(c)}a.done?e(l):Promise.resolve(l).then(n,r)}function NPe(i){return function(){var e=this,t=arguments;return new Promise(function(n,r){var s=i.apply(e,t);function o(l){Toe(s,n,r,o,a,"next",l)}function a(l){Toe(s,n,r,o,a,"throw",l)}o(void 0)})}}function ZI(i,e,t){return e=Lx(e),qPe(i,BV()?Reflect.construct(e,t||[],Lx(i).constructor):e.apply(i,t))}function FPe(i,e){if(e.has(i))throw new TypeError("Cannot initialize the same private elements twice on an object")}function KI(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function kS(i,e){return i.get(Boe(i,e))}function EV(i,e,t){FPe(i,e),e.set(i,t)}function MV(i,e,t){return i.set(Boe(i,e),t),t}function FV(i,e,t){if(BV())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var r=new(i.bind.apply(i,n));return r}function BPe(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,Ooe(n.key),n)}}function QI(i,e,t){return e&&BPe(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function Eo(i,e,t){return(e=Ooe(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function PV(){return PV=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(i,e,t){var n=HPe(i,e);if(n){var r=Object.getOwnPropertyDescriptor(n,e);return r.get?r.get.call(arguments.length<3?i:t):r.value}},PV.apply(null,arguments)}function Lx(i){return Lx=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Lx(i)}function JI(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),e&&DV(i,e)}function BV(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(BV=function(){return!!i})()}function OPe(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function UPe(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e===0){if(Object(t)!==t)return;l=!1}else for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function kPe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.5098-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function zPe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.5099-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Eoe(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function $i(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Eoe(Object(t),!0).forEach(function(n){Eo(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Eoe(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function VPe(i,e){if(i==null)return{};var t,n,r=GPe(i,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);for(n=0;n<s.length;n++)t=s[n],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(i,t)&&(r[t]=i[t])}return r}function GPe(i,e){if(i==null)return{};var t={};for(var n in i)if({}.hasOwnProperty.call(i,n)){if(e.indexOf(n)!==-1)continue;t[n]=i[n]}return t}function qPe(i,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return DPe(i)}function LV(){var i,e,t=typeof Symbol=="function"?Symbol:{},n=t.iterator||"@@iterator",r=t.toStringTag||"@@toStringTag";function s(A,y,w,S){var T=y&&y.prototype instanceof a?y:a,R=Object.create(T.prototype);return mc(R,"_invoke",(function(P,I,F){var D,L,C,B=0,k=F||[],z=!1,G={p:0,n:0,v:i,a:W,f:W.bind(i,4),d:function(Y,H){return D=Y,L=0,C=i,G.n=H,o}};function W(Y,H){for(L=Y,C=H,e=0;!z&&B&&!$&&e<k.length;e++){var $,J=k[e],te=G.p,ce=J[2];Y>3?($=ce===H)&&(C=J[(L=J[4])?5:(L=3,3)],J[4]=J[5]=i):J[0]<=te&&(($=Y<2&&te<J[1])?(L=0,G.v=H,G.n=J[1]):te<ce&&($=Y<3||J[0]>H||H>ce)&&(J[4]=Y,J[5]=H,G.n=ce,L=0))}if($||Y>1)return o;throw z=!0,H}return function(Y,H,$){if(B>1)throw TypeError("Generator is already running");for(z&&H===1&&W(H,$),L=H,C=$;(e=L<2?i:C)||!z;){D||(L?L<3?(L>1&&(G.n=-1),W(L,C)):G.n=C:G.v=C);try{if(B=2,D){if(L||(Y="next"),e=D[Y]){if(!(e=e.call(D,C)))throw TypeError("iterator result is not an object");if(!e.done)return e;C=e.value,L<2&&(L=0)}else L===1&&(e=D.return)&&e.call(D),L<2&&(C=TypeError("The iterator does not provide a '"+Y+"' method"),L=1);D=i}else if((e=(z=G.n<0)?C:P.call(I,G))!==o)break}catch(J){D=i,L=1,C=J}finally{B=1}}return{value:e,done:z}}})(A,w,S),!0),R}var o={};function a(){}function l(){}function c(){}e=Object.getPrototypeOf;var u=[][n]?e(e([][n]())):(mc(e={},n,function(){return this}),e),f=c.prototype=a.prototype=Object.create(u);function d(A){return Object.setPrototypeOf?Object.setPrototypeOf(A,c):(A.__proto__=c,mc(A,r,"GeneratorFunction")),A.prototype=Object.create(f),A}return l.prototype=c,mc(f,"constructor",c),mc(c,"constructor",l),l.displayName="GeneratorFunction",mc(c,r,"GeneratorFunction"),mc(f),mc(f,r,"Generator"),mc(f,n,function(){return this}),mc(f,"toString",function(){return"[object Generator]"}),(LV=function(){return{w:s,m:d}})()}function mc(i,e,t,n){var r=Object.defineProperty;try{r({},"",{})}catch{r=0}mc=function(s,o,a,l){function c(u,f){mc(s,u,function(d){return this._invoke(u,f,d)})}o?r?r(s,o,{value:a,enumerable:!l,configurable:!l,writable:!l}):s[o]=a:(c("next",0),c("throw",1),c("return",2))},mc(i,e,t,n)}function DV(i,e){return DV=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},DV(i,e)}function Pr(i,e){return PPe(i)||UPe(i,e)||Uoe(i,e)||kPe()}function HPe(i,e){for(;!{}.hasOwnProperty.call(i,e)&&(i=Lx(i))!==null;);return i}function CV(i,e,t,n){var r=PV(Lx(i.prototype),e,t);return typeof r=="function"?function(s){return r.apply(t,s)}:r}function tr(i){return LPe(i)||OPe(i)||Uoe(i)||zPe()}function WPe(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function Ooe(i){var e=WPe(i,"string");return typeof e=="symbol"?e:e+""}function Uoe(i,e){if(i){if(typeof i=="string")return IV(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?IV(i,e):void 0}}var koe=function(e){e instanceof Array?e.forEach(koe):(e.map&&e.map.dispose(),e.dispose())},Rm=function(e){e.geometry&&e.geometry.dispose(),e.material&&koe(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(Rm)},ns=function(e){if(e&&e.children)for(;e.children.length;){var t=e.children[0];e.remove(t),Rm(t)}};function tl(i,e){var t=new e;return{linkProp:function(r){return{default:t[r](),onChange:function(o,a){a[i][r](o)},triggerUpdate:!1}},linkMethod:function(r){return function(s){for(var o=s[i],a=arguments.length,l=new Array(a>1?a-1:0),c=1;c<a;c++)l[c-1]=arguments[c];var u=o[r].apply(o,l);return u===o?this:u}}}}var _r=100;function Moe(){return _r}function lu(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=(90-i)*Math.PI/180,r=(90-e)*Math.PI/180,s=_r*(1+t),o=Math.sin(n);return{x:s*o*Math.cos(r),y:s*Math.cos(n),z:s*o*Math.sin(r)}}function zoe(i){var e=i.x,t=i.y,n=i.z,r=Math.sqrt(e*e+t*t+n*n),s=Math.acos(t/r),o=Math.atan2(n,e);return{lat:90-s*180/Math.PI,lng:90-o*180/Math.PI-(o<-Math.PI/2?360:0),altitude:r/_r-1}}function A1(i){return i*Math.PI/180}var VS=window.THREE?window.THREE:{BackSide:mi,BufferAttribute:Hi,Color:zt,Mesh:Hn,ShaderMaterial:ds},jPe=`5096+ `};var Lf=class extends ds{constructor(e){super({type:"LineMaterial",uniforms:mg.clone(Ha.line.uniforms),vertexShader:Ha.line.vertexShader,fragmentShader:Ha.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,this.setValues(e)}get color(){return this.uniforms.diffuse.value}set color(e){this.uniforms.diffuse.value=e}get worldUnits(){return"WORLD_UNITS"in this.defines}set worldUnits(e){e===!0!==this.worldUnits&&(this.needsUpdate=!0),e===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}get linewidth(){return this.uniforms.linewidth.value}set linewidth(e){this.uniforms.linewidth&&(this.uniforms.linewidth.value=e)}get dashed(){return"USE_DASH"in this.defines}set dashed(e){e===!0!==this.dashed&&(this.needsUpdate=!0),e===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}get dashScale(){return this.uniforms.dashScale.value}set dashScale(e){this.uniforms.dashScale.value=e}get dashSize(){return this.uniforms.dashSize.value}set dashSize(e){this.uniforms.dashSize.value=e}get dashOffset(){return this.uniforms.dashOffset.value}set dashOffset(e){this.uniforms.dashOffset.value=e}get gapSize(){return this.uniforms.gapSize.value}set gapSize(e){this.uniforms.gapSize.value=e}get opacity(){return this.uniforms.opacity.value}set opacity(e){this.uniforms&&(this.uniforms.opacity.value=e)}get resolution(){return this.uniforms.resolution.value}set resolution(e){this.uniforms.resolution.value.copy(e)}get alphaToCoverage(){return"USE_ALPHA_TO_COVERAGE"in this.defines}set alphaToCoverage(e){this.defines&&(e===!0!==this.alphaToCoverage&&(this.needsUpdate=!0),e===!0?this.defines.USE_ALPHA_TO_COVERAGE="":delete this.defines.USE_ALPHA_TO_COVERAGE)}};var PV=new xn,Ioe=new re,Poe=new re,Ko=new xn,Qo=new xn,Df=new xn,LV=new re,DV=new cn,Jo=new fb,Loe=new re,WI=new ka,jI=new yl,Nf=new xn,Ff,p1;function Doe(i,e,t){return Nf.set(0,0,-e,1).applyMatrix4(i.projectionMatrix),Nf.multiplyScalar(1/Nf.w),Nf.x=p1/t.width,Nf.y=p1/t.height,Nf.applyMatrix4(i.projectionMatrixInverse),Nf.multiplyScalar(1/Nf.w),Math.abs(Math.max(Nf.x,Nf.y))}function XPe(i,e){let t=i.matrixWorld,n=i.geometry,r=n.attributes.instanceStart,s=n.attributes.instanceEnd,o=Math.min(n.instanceCount,r.count);for(let a=0,l=o;a<l;a++){Jo.start.fromBufferAttribute(r,a),Jo.end.fromBufferAttribute(s,a),Jo.applyMatrix4(t);let c=new re,u=new re;Ff.distanceSqToSegment(Jo.start,Jo.end,u,c),u.distanceTo(c)<p1*.5&&e.push({point:u,pointOnLine:c,distance:Ff.origin.distanceTo(u),object:i,face:null,faceIndex:a,uv:null,uv1:null})}}function $Pe(i,e,t){let n=e.projectionMatrix,s=i.material.resolution,o=i.matrixWorld,a=i.geometry,l=a.attributes.instanceStart,c=a.attributes.instanceEnd,u=Math.min(a.instanceCount,l.count),f=-e.near;Ff.at(1,Df),Df.w=1,Df.applyMatrix4(e.matrixWorldInverse),Df.applyMatrix4(n),Df.multiplyScalar(1/Df.w),Df.x*=s.x/2,Df.y*=s.y/2,Df.z=0,LV.copy(Df),DV.multiplyMatrices(e.matrixWorldInverse,o);for(let d=0,A=u;d<A;d++){if(Ko.fromBufferAttribute(l,d),Qo.fromBufferAttribute(c,d),Ko.w=1,Qo.w=1,Ko.applyMatrix4(DV),Qo.applyMatrix4(DV),Ko.z>f&&Qo.z>f)continue;if(Ko.z>f){let P=Ko.z-Qo.z,I=(Ko.z-f)/P;Ko.lerp(Qo,I)}else if(Qo.z>f){let P=Qo.z-Ko.z,I=(Qo.z-f)/P;Qo.lerp(Ko,I)}Ko.applyMatrix4(n),Qo.applyMatrix4(n),Ko.multiplyScalar(1/Ko.w),Qo.multiplyScalar(1/Qo.w),Ko.x*=s.x/2,Ko.y*=s.y/2,Qo.x*=s.x/2,Qo.y*=s.y/2,Jo.start.copy(Ko),Jo.start.z=0,Jo.end.copy(Qo),Jo.end.z=0;let w=Jo.closestPointToPointParameter(LV,!0);Jo.at(w,Loe);let S=Uu.lerp(Ko.z,Qo.z,w),T=S>=-1&&S<=1,R=LV.distanceTo(Loe)<p1*.5;if(T&&R){Jo.start.fromBufferAttribute(l,d),Jo.end.fromBufferAttribute(c,d),Jo.start.applyMatrix4(o),Jo.end.applyMatrix4(o);let P=new re,I=new re;Ff.distanceSqToSegment(Jo.start,Jo.end,I,P),t.push({point:I,pointOnLine:P,distance:Ff.origin.distanceTo(I),object:i,face:null,faceIndex:d,uv:null,uv1:null})}}}var XI=class extends Hn{constructor(e=new Cx,t=new Lf({color:Math.random()*16777215})){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){let e=this.geometry,t=e.attributes.instanceStart,n=e.attributes.instanceEnd,r=new Float32Array(2*t.count);for(let o=0,a=0,l=t.count;o<l;o++,a+=2)Ioe.fromBufferAttribute(t,o),Poe.fromBufferAttribute(n,o),r[a]=a===0?0:r[a-1],r[a+1]=r[a]+Ioe.distanceTo(Poe);let s=new Fh(r,2,1);return e.setAttribute("instanceDistanceStart",new zo(s,1,0)),e.setAttribute("instanceDistanceEnd",new zo(s,1,1)),this}raycast(e,t){let n=this.material.worldUnits,r=e.camera;if(r===null&&!n&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.'),n===!1&&(this.material.resolution.x===0||this.material.resolution.y===0))return;let s=e.params.Line2!==void 0&&e.params.Line2.threshold||0;Ff=e.ray;let o=this.matrixWorld,a=this.geometry,l=this.material;p1=l.linewidth+s,a.boundingSphere===null&&a.computeBoundingSphere(),jI.copy(a.boundingSphere).applyMatrix4(o);let c;if(n)c=p1*.5;else{let f=Math.max(r.near,jI.distanceToPoint(Ff.origin));c=Doe(r,f,l.resolution)}if(jI.radius+=c,Ff.intersectsSphere(jI)===!1)return;a.boundingBox===null&&a.computeBoundingBox(),WI.copy(a.boundingBox).applyMatrix4(o);let u;if(n)u=p1*.5;else{let f=Math.max(r.near,WI.distanceToPoint(Ff.origin));u=Doe(r,f,l.resolution)}WI.expandByScalar(u),Ff.intersectsBox(WI)!==!1&&(n?XPe(this,t):$Pe(this,r,t))}onBeforeRender(e){let t=this.material.uniforms;t&&t.resolution&&(e.getViewport(PV),this.material.uniforms.resolution.value.set(PV.z,PV.w))}};var Em=class extends Cx{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(e){let t=e.length-3,n=new Float32Array(2*t);for(let r=0;r<t;r+=3)n[2*r]=e[r],n[2*r+1]=e[r+1],n[2*r+2]=e[r+2],n[2*r+3]=e[r+3],n[2*r+4]=e[r+4],n[2*r+5]=e[r+5];return super.setPositions(n),this}setColors(e){let t=e.length-3,n=new Float32Array(2*t);for(let r=0;r<t;r+=3)n[2*r]=e[r],n[2*r+1]=e[r+1],n[2*r+2]=e[r+2],n[2*r+3]=e[r+3],n[2*r+4]=e[r+4],n[2*r+5]=e[r+5];return super.setColors(n),this}setFromPoints(e){let t=e.length-1,n=new Float32Array(6*t);for(let r=0;r<t;r++)n[6*r]=e[r].x,n[6*r+1]=e[r].y,n[6*r+2]=e[r].z||0,n[6*r+3]=e[r+1].x,n[6*r+4]=e[r+1].y,n[6*r+5]=e[r+1].z||0;return super.setPositions(n),this}fromLine(e){let t=e.geometry;return this.setPositions(t.attributes.position.array),this}};var Rx=class extends XI{constructor(e=new Em,t=new Lf({color:Math.random()*16777215})){super(e,t),this.isLine2=!0,this.type="Line2"}};var Ix=class{constructor(e){this.isFont=!0,this.type="Font",this.data=e}generateShapes(e,t=100,n="ltr"){let r=[],s=YPe(e,t,this.data,n);for(let o=0,a=s.length;o<a;o++)r.push(...s[o].toShapes());return r}};function YPe(i,e,t,n){let r=Array.from(i),s=e/t.resolution,o=(t.boundingBox.yMax-t.boundingBox.yMin+t.underlineThickness)*s,a=[],l=0,c=0;(n=="rtl"||n=="tb")&&r.reverse();for(let u=0;u<r.length;u++){let f=r[u];if(f===`5097+`)l=0,c-=o;else{let d=ZPe(f,s,l,c,t);n=="tb"?(l=0,c+=t.ascender*s):l+=d.offsetX,a.push(d.path)}}return a}function ZPe(i,e,t,n,r){let s=r.glyphs[i]||r.glyphs["?"];if(!s){console.error('THREE.Font: character "'+i+'" does not exists in font family '+r.familyName+".");return}let o=new db,a,l,c,u,f,d,A,y;if(s.o){let w=s._cachedOutline||(s._cachedOutline=s.o.split(" "));for(let S=0,T=w.length;S<T;)switch(w[S++]){case"m":a=w[S++]*e+t,l=w[S++]*e+n,o.moveTo(a,l);break;case"l":a=w[S++]*e+t,l=w[S++]*e+n,o.lineTo(a,l);break;case"q":c=w[S++]*e+t,u=w[S++]*e+n,f=w[S++]*e+t,d=w[S++]*e+n,o.quadraticCurveTo(f,d,c,u);break;case"b":c=w[S++]*e+t,u=w[S++]*e+n,f=w[S++]*e+t,d=w[S++]*e+n,A=w[S++]*e+t,y=w[S++]*e+n,o.bezierCurveTo(f,d,A,y,c,u);break}}return{offsetX:s.ha*e,path:o}}var GS=class i extends Y2{constructor(e,t={}){let n=t.font;if(n===void 0)super();else{let r=n.generateShapes(e,t.size,t.direction);t.depth===void 0&&(t.depth=50),t.bevelThickness===void 0&&(t.bevelThickness=10),t.bevelSize===void 0&&(t.bevelSize=8),t.bevelEnabled===void 0&&(t.bevelEnabled=!1),super(r,t)}this.type="TextGeometry"}toJSON(){return super.toJSON()}static fromJSON(e){let t=e.options;return t.font=new Ix(t.font.data),new i(t.text,t)}};function UV(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function KPe(i){if(Array.isArray(i))return i}function QPe(i){if(Array.isArray(i))return UV(i)}function Woe(i,e,t){if(typeof i=="function"?i===e:i.has(e))return arguments.length<3?e:t;throw new TypeError("Private element is not present on this object")}function JPe(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function Noe(i,e,t,n,r,s,o){try{var a=i[s](o),l=a.value}catch(c){return void t(c)}a.done?e(l):Promise.resolve(l).then(n,r)}function eLe(i){return function(){var e=this,t=arguments;return new Promise(function(n,r){var s=i.apply(e,t);function o(l){Noe(s,n,r,o,a,"next",l)}function a(l){Noe(s,n,r,o,a,"throw",l)}o(void 0)})}}function eP(i,e,t){return e=Nx(e),cLe(i,HV()?Reflect.construct(e,t||[],Nx(i).constructor):e.apply(i,t))}function tLe(i,e){if(e.has(i))throw new TypeError("Cannot initialize the same private elements twice on an object")}function tP(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function qS(i,e){return i.get(Woe(i,e))}function NV(i,e,t){tLe(i,e),e.set(i,t)}function FV(i,e,t){return i.set(Woe(i,e),t),t}function qV(i,e,t){if(HV())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var r=new(i.bind.apply(i,n));return r}function nLe(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,joe(n.key),n)}}function nP(i,e,t){return e&&nLe(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function Eo(i,e,t){return(e=joe(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function kV(){return kV=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(i,e,t){var n=uLe(i,e);if(n){var r=Object.getOwnPropertyDescriptor(n,e);return r.get?r.get.call(arguments.length<3?i:t):r.value}},kV.apply(null,arguments)}function Nx(i){return Nx=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Nx(i)}function iP(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),e&&VV(i,e)}function HV(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(HV=function(){return!!i})()}function iLe(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function rLe(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e===0){if(Object(t)!==t)return;l=!1}else for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function sLe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.5098+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function oLe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.5099+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Foe(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function $i(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Foe(Object(t),!0).forEach(function(n){Eo(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Foe(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function aLe(i,e){if(i==null)return{};var t,n,r=lLe(i,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);for(n=0;n<s.length;n++)t=s[n],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(i,t)&&(r[t]=i[t])}return r}function lLe(i,e){if(i==null)return{};var t={};for(var n in i)if({}.hasOwnProperty.call(i,n)){if(e.indexOf(n)!==-1)continue;t[n]=i[n]}return t}function cLe(i,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return JPe(i)}function zV(){var i,e,t=typeof Symbol=="function"?Symbol:{},n=t.iterator||"@@iterator",r=t.toStringTag||"@@toStringTag";function s(A,y,w,S){var T=y&&y.prototype instanceof a?y:a,R=Object.create(T.prototype);return Ac(R,"_invoke",(function(P,I,F){var D,L,C,B=0,k=F||[],z=!1,G={p:0,n:0,v:i,a:W,f:W.bind(i,4),d:function(Y,H){return D=Y,L=0,C=i,G.n=H,o}};function W(Y,H){for(L=Y,C=H,e=0;!z&&B&&!$&&e<k.length;e++){var $,J=k[e],te=G.p,ce=J[2];Y>3?($=ce===H)&&(C=J[(L=J[4])?5:(L=3,3)],J[4]=J[5]=i):J[0]<=te&&(($=Y<2&&te<J[1])?(L=0,G.v=H,G.n=J[1]):te<ce&&($=Y<3||J[0]>H||H>ce)&&(J[4]=Y,J[5]=H,G.n=ce,L=0))}if($||Y>1)return o;throw z=!0,H}return function(Y,H,$){if(B>1)throw TypeError("Generator is already running");for(z&&H===1&&W(H,$),L=H,C=$;(e=L<2?i:C)||!z;){D||(L?L<3?(L>1&&(G.n=-1),W(L,C)):G.n=C:G.v=C);try{if(B=2,D){if(L||(Y="next"),e=D[Y]){if(!(e=e.call(D,C)))throw TypeError("iterator result is not an object");if(!e.done)return e;C=e.value,L<2&&(L=0)}else L===1&&(e=D.return)&&e.call(D),L<2&&(C=TypeError("The iterator does not provide a '"+Y+"' method"),L=1);D=i}else if((e=(z=G.n<0)?C:P.call(I,G))!==o)break}catch(J){D=i,L=1,C=J}finally{B=1}}return{value:e,done:z}}})(A,w,S),!0),R}var o={};function a(){}function l(){}function c(){}e=Object.getPrototypeOf;var u=[][n]?e(e([][n]())):(Ac(e={},n,function(){return this}),e),f=c.prototype=a.prototype=Object.create(u);function d(A){return Object.setPrototypeOf?Object.setPrototypeOf(A,c):(A.__proto__=c,Ac(A,r,"GeneratorFunction")),A.prototype=Object.create(f),A}return l.prototype=c,Ac(f,"constructor",c),Ac(c,"constructor",l),l.displayName="GeneratorFunction",Ac(c,r,"GeneratorFunction"),Ac(f),Ac(f,r,"Generator"),Ac(f,n,function(){return this}),Ac(f,"toString",function(){return"[object Generator]"}),(zV=function(){return{w:s,m:d}})()}function Ac(i,e,t,n){var r=Object.defineProperty;try{r({},"",{})}catch{r=0}Ac=function(s,o,a,l){function c(u,f){Ac(s,u,function(d){return this._invoke(u,f,d)})}o?r?r(s,o,{value:a,enumerable:!l,configurable:!l,writable:!l}):s[o]=a:(c("next",0),c("throw",1),c("return",2))},Ac(i,e,t,n)}function VV(i,e){return VV=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},VV(i,e)}function Pr(i,e){return KPe(i)||rLe(i,e)||Xoe(i,e)||sLe()}function uLe(i,e){for(;!{}.hasOwnProperty.call(i,e)&&(i=Nx(i))!==null;);return i}function BV(i,e,t,n){var r=kV(Nx(i.prototype),e,t);return typeof r=="function"?function(s){return r.apply(t,s)}:r}function tr(i){return QPe(i)||iLe(i)||Xoe(i)||oLe()}function hLe(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function joe(i){var e=hLe(i,"string");return typeof e=="symbol"?e:e+""}function Xoe(i,e){if(i){if(typeof i=="string")return UV(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?UV(i,e):void 0}}var $oe=function(e){e instanceof Array?e.forEach($oe):(e.map&&e.map.dispose(),e.dispose())},Rm=function(e){e.geometry&&e.geometry.dispose(),e.material&&$oe(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(Rm)},ns=function(e){if(e&&e.children)for(;e.children.length;){var t=e.children[0];e.remove(t),Rm(t)}};function nl(i,e){var t=new e;return{linkProp:function(r){return{default:t[r](),onChange:function(o,a){a[i][r](o)},triggerUpdate:!1}},linkMethod:function(r){return function(s){for(var o=s[i],a=arguments.length,l=new Array(a>1?a-1:0),c=1;c<a;c++)l[c-1]=arguments[c];var u=o[r].apply(o,l);return u===o?this:u}}}}var _r=100;function Boe(){return _r}function cu(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=(90-i)*Math.PI/180,r=(90-e)*Math.PI/180,s=_r*(1+t),o=Math.sin(n);return{x:s*o*Math.cos(r),y:s*Math.cos(n),z:s*o*Math.sin(r)}}function Yoe(i){var e=i.x,t=i.y,n=i.z,r=Math.sqrt(e*e+t*t+n*n),s=Math.acos(t/r),o=Math.atan2(n,e);return{lat:90-s*180/Math.PI,lng:90-o*180/Math.PI-(o<-Math.PI/2?360:0),altitude:r/_r-1}}function A1(i){return i*Math.PI/180}var WS=window.THREE?window.THREE:{BackSide:mi,BufferAttribute:Hi,Color:zt,Mesh:Hn,ShaderMaterial:ds},fLe=`51005100 uniform float hollowRadius;51015101 51025102 varying vec3 vVertexWorldPosition;@@ -5116,7 +5116,7 @@ void main() {
51165116 vVertexAngularDistanceToHollowRadius = vertexAngle - edgeAngle;51175117 51185118 gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);5119-}`,XPe=`5119+}`,dLe=`51205120 uniform vec3 color;51215121 uniform float coefficient;51225122 uniform float power;@@ -5139,7 +5139,7 @@ void main() {
51395139 power51405140 );51415141 gl_FragColor = vec4(color, intensity);5142-}`;function $Pe(i,e,t,n){return new VS.ShaderMaterial({depthWrite:!1,transparent:!0,vertexShader:jPe,fragmentShader:XPe,uniforms:{coefficient:{value:i},color:{value:new VS.Color(e)},power:{value:t},hollowRadius:{value:n}}})}function YPe(i,e){for(var t=i.clone(),n=new Float32Array(i.attributes.position.count*3),r=0,s=n.length;r<s;r++){var o=i.attributes.normal.array[r],a=i.attributes.position.array[r];n[r]=a+o*e}return t.setAttribute("position",new VS.BufferAttribute(n,3)),t}var ZPe=(function(i){function e(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=r.color,o=s===void 0?"gold":s,a=r.size,l=a===void 0?2:a,c=r.coefficient,u=c===void 0?.5:c,f=r.power,d=f===void 0?1:f,A=r.hollowRadius,y=A===void 0?0:A,w=r.backside,S=w===void 0?!0:w;KI(this,e),n=ZI(this,e);var T=YPe(t,l),R=$Pe(u,o,d,y);return S&&(R.side=VS.BackSide),n.geometry=T,n.material=R,n}return JI(e,i),QI(e)})(VS.Mesh),Ff=window.THREE?window.THREE:{Color:zt,Group:Br,LineBasicMaterial:Pu,LineSegments:Jv,Mesh:Hn,MeshPhongMaterial:QA,SphereGeometry:za,SRGBColorSpace:Fr,TextureLoader:bl},Voe=Kr({props:{globeImageUrl:{},bumpImageUrl:{},showGlobe:{default:!0,onChange:function(e,t){t.globeGroup.visible=!!e},triggerUpdate:!1},showGraticules:{default:!1,onChange:function(e,t){t.graticulesObj.visible=!!e},triggerUpdate:!1},showAtmosphere:{default:!0,onChange:function(e,t){t.atmosphereObj&&(t.atmosphereObj.visible=!!e)},triggerUpdate:!1},atmosphereColor:{default:"lightskyblue"},atmosphereAltitude:{default:.15},globeCurvatureResolution:{default:4},globeTileEngineUrl:{onChange:function(e,t){t.tileEngine.tileUrl=e}},globeTileEngineMaxLevel:{default:17,onChange:function(e,t){t.tileEngine.maxLevel=e},triggerUpdate:!1},updatePov:{onChange:function(e,t){t.tileEngine.updatePov(e)},triggerUpdate:!1},onReady:{default:function(){},triggerUpdate:!1}},methods:{globeMaterial:function(e,t){return t!==void 0?(e.globeObj.material=t||e.defaultGlobeMaterial,this):e.globeObj.material},globeTileEngineClearCache:function(e){e.tileEngine.clearTiles()},_destructor:function(e){Rm(e.globeObj),Rm(e.tileEngine),Rm(e.graticulesObj)}},stateInit:function(){var e=new Ff.MeshPhongMaterial({color:0}),t=new Ff.Mesh(void 0,e);t.rotation.y=-Math.PI/2;var n=new _J(_r),r=new Ff.Group;r.__globeObjType="globe",r.add(t),r.add(n);var s=new Ff.LineSegments(new JB(SB(),_r,2),new Ff.LineBasicMaterial({color:"lightgrey",transparent:!0,opacity:.1}));return{globeGroup:r,globeObj:t,graticulesObj:s,defaultGlobeMaterial:e,tileEngine:n}},init:function(e,t){ns(e),t.scene=e,t.scene.add(t.globeGroup),t.scene.add(t.graticulesObj),t.ready=!1},update:function(e,t){var n=e.globeObj.material;if(e.tileEngine.visible=!(e.globeObj.visible=!e.globeTileEngineUrl),t.hasOwnProperty("globeCurvatureResolution")){var r;(r=e.globeObj.geometry)===null||r===void 0||r.dispose();var s=Math.max(4,Math.round(360/e.globeCurvatureResolution));e.globeObj.geometry=new Ff.SphereGeometry(_r,s,s/2),e.tileEngine.curvatureResolution=e.globeCurvatureResolution}if(t.hasOwnProperty("globeImageUrl")&&(e.globeImageUrl?new Ff.TextureLoader().load(e.globeImageUrl,function(a){var l;a.colorSpace=Ff.SRGBColorSpace,(l=n.map)===null||l===void 0||l.dispose(),n.map=a,n.color=null,n.needsUpdate=!0,!e.ready&&(e.ready=!0)&&setTimeout(e.onReady)}):!n.color&&(n.color=new Ff.Color(0))),t.hasOwnProperty("bumpImageUrl")&&(e.bumpImageUrl?e.bumpImageUrl&&new Ff.TextureLoader().load(e.bumpImageUrl,function(a){var l;(l=n.bumpMap)===null||l===void 0||l.dispose(),n.bumpMap=a,n.needsUpdate=!0}):(n.bumpMap=null,n.needsUpdate=!0)),(t.hasOwnProperty("atmosphereColor")||t.hasOwnProperty("atmosphereAltitude"))&&(e.atmosphereObj&&(e.scene.remove(e.atmosphereObj),Rm(e.atmosphereObj)),e.atmosphereColor&&e.atmosphereAltitude)){var o=e.atmosphereObj=new ZPe(e.globeObj.geometry,{color:e.atmosphereColor,size:_r*e.atmosphereAltitude,hollowRadius:_r,coefficient:.1,power:3.5});o.visible=!!e.showAtmosphere,o.__globeObjType="atmosphere",e.scene.add(o)}!e.ready&&(!e.globeImageUrl||e.globeTileEngineUrl)&&(e.ready=!0,e.onReady())}}),Bf=function(e){return isNaN(e)?parseInt(An(e).toHex(),16):e},th=function(e){return e&&isNaN(e)?Uu(e).opacity:1},Im=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r,s=1,o=/^rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d.eE+-]+)\s*\)$/.exec(e.trim().toLowerCase());if(o){var a=o.slice(1),l=Pr(a,4),c=l[0],u=l[1],f=l[2],d=l[3];r=new zt("rgb(".concat(+c,",").concat(+u,",").concat(+f,")")),s=Math.min(+d,1)}else r=new zt(e);n&&r.convertLinearToSRGB();var A=r.toArray();return t?[].concat(tr(A),[s]):A};function KPe(i,e,t){return i.opacity=e,i.transparent=e<1,i.depthWrite=e>=1,i}var Coe=window.THREE?window.THREE:{BufferAttribute:Hi};function Of(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Float32Array;if(e===1)return new Coe.BufferAttribute(new t(i),e);for(var n=new Coe.BufferAttribute(new t(i.length*e),e),r=0,s=i.length;r<s;r++)n.set(i[r],r*e);return n}function QPe(i){for(var e=i.itemSize,t=[],n=0;n<i.count;n++)t.push(i.array.slice(n*e,(n+1)*e));return t}var RV=new WeakMap,HI=new WeakMap,WI=new WeakMap,Ll=(function(i){function e(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=r.dataBindAttr,o=s===void 0?"__data":s,a=r.objBindAttr,l=a===void 0?"__threeObj":a,c=r.removeDelay,u=c===void 0?0:c;return KI(this,e),n=ZI(this,e),Eo(n,"scene",void 0),EV(n,RV,void 0),EV(n,HI,void 0),EV(n,WI,void 0),n.scene=t,MV(RV,n,o),MV(HI,n,l),MV(WI,n,u),n.onRemoveObj(function(){}),n}return JI(e,i),QI(e,[{key:"onCreateObj",value:function(n){var r=this;return CV(e,"onCreateObj",this)([function(s){var o=n(s);return s[kS(HI,r)]=o,o[kS(RV,r)]=s,r.scene.add(o),o}]),this}},{key:"onRemoveObj",value:function(n){var r=this;return CV(e,"onRemoveObj",this)([function(s,o){var a=CV(e,"getData",r)([s]);n(s,o);var l=function(){r.scene.remove(s),Rm(s),delete a[kS(HI,r)]};kS(WI,r)?setTimeout(l,kS(WI,r)):l()}]),this}}])})(VJ),Qu=window.THREE?window.THREE:{BufferGeometry:Xn,CylinderGeometry:$A,Matrix4:cn,Mesh:Hn,MeshLambertMaterial:Va,Object3D:lr,Vector3:re},Roe=Object.assign({},yw),Ioe=Roe.BufferGeometryUtils||Roe,Goe=Kr({props:{pointsData:{default:[]},pointLat:{default:"lat"},pointLng:{default:"lng"},pointColor:{default:function(){return"#ffffaa"}},pointAltitude:{default:.1},pointRadius:{default:.25},pointResolution:{default:12,triggerUpdate:!1},pointsMerge:{default:!1},pointsTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;ns(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Ll(e,{objBindAttr:"__threeObjPoint"})},update:function(e,t){var n=st(e.pointLat),r=st(e.pointLng),s=st(e.pointAltitude),o=st(e.pointRadius),a=st(e.pointColor),l=new Qu.CylinderGeometry(1,1,1,e.pointResolution);l.applyMatrix4(new Qu.Matrix4().makeRotationX(Math.PI/2)),l.applyMatrix4(new Qu.Matrix4().makeTranslation(0,0,-.5));var c=2*Math.PI*_r/360,u={};if(!e.pointsMerge&&t.hasOwnProperty("pointsMerge")&&ns(e.scene),e.dataMapper.scene=e.pointsMerge?new Qu.Object3D:e.scene,e.dataMapper.onCreateObj(A).onUpdateObj(y).digest(e.pointsData),e.pointsMerge){var f=e.pointsData.length?(Ioe.mergeGeometries||Ioe.mergeBufferGeometries)(e.pointsData.map(function(w){var S=e.dataMapper.getObj(w),T=S.geometry.clone();S.updateMatrix(),T.applyMatrix4(S.matrix);var R=Im(a(w));return T.setAttribute("color",Of(Array(T.getAttribute("position").count).fill(R),4)),T})):new Qu.BufferGeometry,d=new Qu.Mesh(f,new Qu.MeshLambertMaterial({color:16777215,transparent:!0,vertexColors:!0}));d.__globeObjType="points",d.__data=e.pointsData,e.dataMapper.clear(),ns(e.scene),e.scene.add(d)}function A(){var w=new Qu.Mesh(l);return w.__globeObjType="point",w}function y(w,S){var T=function(C){var B=w.__currentTargetD=C,k=B.r,z=B.alt,G=B.lat,W=B.lng;Object.assign(w.position,lu(G,W));var Y=e.pointsMerge?new Qu.Vector3(0,0,0):e.scene.localToWorld(new Qu.Vector3(0,0,0));w.lookAt(Y),w.scale.x=w.scale.y=Math.min(30,k)*c,w.scale.z=Math.max(z*_r,.1)},R={alt:+s(S),r:+o(S),lat:+n(S),lng:+r(S)},P=w.__currentTargetD||Object.assign({},R,{alt:-.001});if(Object.keys(R).some(function(L){return P[L]!==R[L]})&&(e.pointsMerge||!e.pointsTransitionDuration||e.pointsTransitionDuration<0?T(R):e.tweenGroup.add(new uo(P).to(R,e.pointsTransitionDuration).easing(Qr.Quadratic.InOut).onUpdate(T).onComplete(function(){e.tweenGroup.remove(this)}).start())),!e.pointsMerge){var I=a(S),F=I?th(I):0,D=!!F;w.visible=D,D&&(u.hasOwnProperty(I)||(u[I]=new Qu.MeshLambertMaterial({color:Bf(I),transparent:F<1,opacity:F})),w.material=u[I])}}}}),qoe=function(){return{uniforms:{dashOffset:{value:0},dashSize:{value:1},gapSize:{value:0},dashTranslate:{value:0}},vertexShader:`5142+}`;function pLe(i,e,t,n){return new WS.ShaderMaterial({depthWrite:!1,transparent:!0,vertexShader:fLe,fragmentShader:dLe,uniforms:{coefficient:{value:i},color:{value:new WS.Color(e)},power:{value:t},hollowRadius:{value:n}}})}function mLe(i,e){for(var t=i.clone(),n=new Float32Array(i.attributes.position.count*3),r=0,s=n.length;r<s;r++){var o=i.attributes.normal.array[r],a=i.attributes.position.array[r];n[r]=a+o*e}return t.setAttribute("position",new WS.BufferAttribute(n,3)),t}var ALe=(function(i){function e(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=r.color,o=s===void 0?"gold":s,a=r.size,l=a===void 0?2:a,c=r.coefficient,u=c===void 0?.5:c,f=r.power,d=f===void 0?1:f,A=r.hollowRadius,y=A===void 0?0:A,w=r.backside,S=w===void 0?!0:w;tP(this,e),n=eP(this,e);var T=mLe(t,l),R=pLe(u,o,d,y);return S&&(R.side=WS.BackSide),n.geometry=T,n.material=R,n}return iP(e,i),nP(e)})(WS.Mesh),Bf=window.THREE?window.THREE:{Color:zt,Group:Br,LineBasicMaterial:Du,LineSegments:t_,Mesh:Hn,MeshPhongMaterial:QA,SphereGeometry:Va,SRGBColorSpace:Fr,TextureLoader:bl},Zoe=Kr({props:{globeImageUrl:{},bumpImageUrl:{},showGlobe:{default:!0,onChange:function(e,t){t.globeGroup.visible=!!e},triggerUpdate:!1},showGraticules:{default:!1,onChange:function(e,t){t.graticulesObj.visible=!!e},triggerUpdate:!1},showAtmosphere:{default:!0,onChange:function(e,t){t.atmosphereObj&&(t.atmosphereObj.visible=!!e)},triggerUpdate:!1},atmosphereColor:{default:"lightskyblue"},atmosphereAltitude:{default:.15},globeCurvatureResolution:{default:4},globeTileEngineUrl:{onChange:function(e,t){t.tileEngine.tileUrl=e}},globeTileEngineMaxLevel:{default:17,onChange:function(e,t){t.tileEngine.maxLevel=e},triggerUpdate:!1},updatePov:{onChange:function(e,t){t.tileEngine.updatePov(e)},triggerUpdate:!1},onReady:{default:function(){},triggerUpdate:!1}},methods:{globeMaterial:function(e,t){return t!==void 0?(e.globeObj.material=t||e.defaultGlobeMaterial,this):e.globeObj.material},globeTileEngineClearCache:function(e){e.tileEngine.clearTiles()},_destructor:function(e){Rm(e.globeObj),Rm(e.tileEngine),Rm(e.graticulesObj)}},stateInit:function(){var e=new Bf.MeshPhongMaterial({color:0}),t=new Bf.Mesh(void 0,e);t.rotation.y=-Math.PI/2;var n=new CJ(_r),r=new Bf.Group;r.__globeObjType="globe",r.add(t),r.add(n);var s=new Bf.LineSegments(new aO(LB(),_r,2),new Bf.LineBasicMaterial({color:"lightgrey",transparent:!0,opacity:.1}));return{globeGroup:r,globeObj:t,graticulesObj:s,defaultGlobeMaterial:e,tileEngine:n}},init:function(e,t){ns(e),t.scene=e,t.scene.add(t.globeGroup),t.scene.add(t.graticulesObj),t.ready=!1},update:function(e,t){var n=e.globeObj.material;if(e.tileEngine.visible=!(e.globeObj.visible=!e.globeTileEngineUrl),t.hasOwnProperty("globeCurvatureResolution")){var r;(r=e.globeObj.geometry)===null||r===void 0||r.dispose();var s=Math.max(4,Math.round(360/e.globeCurvatureResolution));e.globeObj.geometry=new Bf.SphereGeometry(_r,s,s/2),e.tileEngine.curvatureResolution=e.globeCurvatureResolution}if(t.hasOwnProperty("globeImageUrl")&&(e.globeImageUrl?new Bf.TextureLoader().load(e.globeImageUrl,function(a){var l;a.colorSpace=Bf.SRGBColorSpace,(l=n.map)===null||l===void 0||l.dispose(),n.map=a,n.color=null,n.needsUpdate=!0,!e.ready&&(e.ready=!0)&&setTimeout(e.onReady)}):!n.color&&(n.color=new Bf.Color(0))),t.hasOwnProperty("bumpImageUrl")&&(e.bumpImageUrl?e.bumpImageUrl&&new Bf.TextureLoader().load(e.bumpImageUrl,function(a){var l;(l=n.bumpMap)===null||l===void 0||l.dispose(),n.bumpMap=a,n.needsUpdate=!0}):(n.bumpMap=null,n.needsUpdate=!0)),(t.hasOwnProperty("atmosphereColor")||t.hasOwnProperty("atmosphereAltitude"))&&(e.atmosphereObj&&(e.scene.remove(e.atmosphereObj),Rm(e.atmosphereObj)),e.atmosphereColor&&e.atmosphereAltitude)){var o=e.atmosphereObj=new ALe(e.globeObj.geometry,{color:e.atmosphereColor,size:_r*e.atmosphereAltitude,hollowRadius:_r,coefficient:.1,power:3.5});o.visible=!!e.showAtmosphere,o.__globeObjType="atmosphere",e.scene.add(o)}!e.ready&&(!e.globeImageUrl||e.globeTileEngineUrl)&&(e.ready=!0,e.onReady())}}),Of=function(e){return isNaN(e)?parseInt(An(e).toHex(),16):e},ih=function(e){return e&&isNaN(e)?zu(e).opacity:1},Im=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r,s=1,o=/^rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d.eE+-]+)\s*\)$/.exec(e.trim().toLowerCase());if(o){var a=o.slice(1),l=Pr(a,4),c=l[0],u=l[1],f=l[2],d=l[3];r=new zt("rgb(".concat(+c,",").concat(+u,",").concat(+f,")")),s=Math.min(+d,1)}else r=new zt(e);n&&r.convertLinearToSRGB();var A=r.toArray();return t?[].concat(tr(A),[s]):A};function gLe(i,e,t){return i.opacity=e,i.transparent=e<1,i.depthWrite=e>=1,i}var Ooe=window.THREE?window.THREE:{BufferAttribute:Hi};function Uf(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Float32Array;if(e===1)return new Ooe.BufferAttribute(new t(i),e);for(var n=new Ooe.BufferAttribute(new t(i.length*e),e),r=0,s=i.length;r<s;r++)n.set(i[r],r*e);return n}function vLe(i){for(var e=i.itemSize,t=[],n=0;n<i.count;n++)t.push(i.array.slice(n*e,(n+1)*e));return t}var OV=new WeakMap,$I=new WeakMap,YI=new WeakMap,Ll=(function(i){function e(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=r.dataBindAttr,o=s===void 0?"__data":s,a=r.objBindAttr,l=a===void 0?"__threeObj":a,c=r.removeDelay,u=c===void 0?0:c;return tP(this,e),n=eP(this,e),Eo(n,"scene",void 0),NV(n,OV,void 0),NV(n,$I,void 0),NV(n,YI,void 0),n.scene=t,FV(OV,n,o),FV($I,n,l),FV(YI,n,u),n.onRemoveObj(function(){}),n}return iP(e,i),nP(e,[{key:"onCreateObj",value:function(n){var r=this;return BV(e,"onCreateObj",this)([function(s){var o=n(s);return s[qS($I,r)]=o,o[qS(OV,r)]=s,r.scene.add(o),o}]),this}},{key:"onRemoveObj",value:function(n){var r=this;return BV(e,"onRemoveObj",this)([function(s,o){var a=BV(e,"getData",r)([s]);n(s,o);var l=function(){r.scene.remove(s),Rm(s),delete a[qS($I,r)]};qS(YI,r)?setTimeout(l,qS(YI,r)):l()}]),this}}])})(ZJ),eh=window.THREE?window.THREE:{BufferGeometry:Xn,CylinderGeometry:$A,Matrix4:cn,Mesh:Hn,MeshLambertMaterial:Ga,Object3D:lr,Vector3:re},Uoe=Object.assign({},Tw),koe=Uoe.BufferGeometryUtils||Uoe,Koe=Kr({props:{pointsData:{default:[]},pointLat:{default:"lat"},pointLng:{default:"lng"},pointColor:{default:function(){return"#ffffaa"}},pointAltitude:{default:.1},pointRadius:{default:.25},pointResolution:{default:12,triggerUpdate:!1},pointsMerge:{default:!1},pointsTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;ns(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Ll(e,{objBindAttr:"__threeObjPoint"})},update:function(e,t){var n=st(e.pointLat),r=st(e.pointLng),s=st(e.pointAltitude),o=st(e.pointRadius),a=st(e.pointColor),l=new eh.CylinderGeometry(1,1,1,e.pointResolution);l.applyMatrix4(new eh.Matrix4().makeRotationX(Math.PI/2)),l.applyMatrix4(new eh.Matrix4().makeTranslation(0,0,-.5));var c=2*Math.PI*_r/360,u={};if(!e.pointsMerge&&t.hasOwnProperty("pointsMerge")&&ns(e.scene),e.dataMapper.scene=e.pointsMerge?new eh.Object3D:e.scene,e.dataMapper.onCreateObj(A).onUpdateObj(y).digest(e.pointsData),e.pointsMerge){var f=e.pointsData.length?(koe.mergeGeometries||koe.mergeBufferGeometries)(e.pointsData.map(function(w){var S=e.dataMapper.getObj(w),T=S.geometry.clone();S.updateMatrix(),T.applyMatrix4(S.matrix);var R=Im(a(w));return T.setAttribute("color",Uf(Array(T.getAttribute("position").count).fill(R),4)),T})):new eh.BufferGeometry,d=new eh.Mesh(f,new eh.MeshLambertMaterial({color:16777215,transparent:!0,vertexColors:!0}));d.__globeObjType="points",d.__data=e.pointsData,e.dataMapper.clear(),ns(e.scene),e.scene.add(d)}function A(){var w=new eh.Mesh(l);return w.__globeObjType="point",w}function y(w,S){var T=function(C){var B=w.__currentTargetD=C,k=B.r,z=B.alt,G=B.lat,W=B.lng;Object.assign(w.position,cu(G,W));var Y=e.pointsMerge?new eh.Vector3(0,0,0):e.scene.localToWorld(new eh.Vector3(0,0,0));w.lookAt(Y),w.scale.x=w.scale.y=Math.min(30,k)*c,w.scale.z=Math.max(z*_r,.1)},R={alt:+s(S),r:+o(S),lat:+n(S),lng:+r(S)},P=w.__currentTargetD||Object.assign({},R,{alt:-.001});if(Object.keys(R).some(function(L){return P[L]!==R[L]})&&(e.pointsMerge||!e.pointsTransitionDuration||e.pointsTransitionDuration<0?T(R):e.tweenGroup.add(new uo(P).to(R,e.pointsTransitionDuration).easing(Qr.Quadratic.InOut).onUpdate(T).onComplete(function(){e.tweenGroup.remove(this)}).start())),!e.pointsMerge){var I=a(S),F=I?ih(I):0,D=!!F;w.visible=D,D&&(u.hasOwnProperty(I)||(u[I]=new eh.MeshLambertMaterial({color:Of(I),transparent:F<1,opacity:F})),w.material=u[I])}}}}),Qoe=function(){return{uniforms:{dashOffset:{value:0},dashSize:{value:1},gapSize:{value:0},dashTranslate:{value:0}},vertexShader:`51435143 `.concat(kn.common,`51445144 `).concat(kn.logdepthbuf_pars_vertex,`51455145 @@ -5179,7 +5179,7 @@ void main() {
51795179 51805180 `).concat(kn.logdepthbuf_fragment,`51815181 }5182- `)}},NV=function(e){return e.uniforms.uSurfaceRadius={type:"float",value:0},e.vertexShader=(`attribute float surfaceRadius;5182+ `)}},GV=function(e){return e.uniforms.uSurfaceRadius={type:"float",value:0},e.vertexShader=(`attribute float surfaceRadius;51835183 varying float vSurfaceRadius;51845184 varying vec3 vPos;51855185 `+e.vertexShader).replace("void main() {",["void main() {","vSurfaceRadius = surfaceRadius;","vPos = position;"].join(`@@ -5187,7 +5187,7 @@ varying vec3 vPos;
51875187 varying float vSurfaceRadius;51885188 varying vec3 vPos;51895189 `+e.fragmentShader).replace("void main() {",["void main() {","if (length(vPos) < max(uSurfaceRadius, vSurfaceRadius)) discard;"].join(`5190-`)),e},JPe=function(e){return e.vertexShader=`5190+`)),e},_Le=function(e){return e.vertexShader=`51915191 attribute float r;51925192 51935193 const float PI = 3.1415926535897932384626433832795;@@ -5220,7 +5220,7 @@ varying vec3 vPos;
52205220 gl_Position = projectionMatrix * modelViewMatrix * vec4(pos, 1.0);52215221 }52225222 `),`5223- `),e},OV=function(e,t){return e.onBeforeCompile=function(n){e.userData.shader=t(n)},e},eLe=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(r){return r};if(e.userData.shader)t(e.userData.shader.uniforms);else{var n=e.onBeforeCompile;e.onBeforeCompile=function(r){n(r),t(r.uniforms)}}},tLe=["stroke"],Ju=window.THREE?window.THREE:{BufferGeometry:Xn,CubicBezierCurve3:i_,Curve:ka,Group:Br,Line:a0,Mesh:Hn,NormalBlending:Ms,ShaderMaterial:ds,TubeGeometry:j2,Vector3:re},nLe=g1.default.default||g1.default,Hoe=Kr({props:{arcsData:{default:[]},arcStartLat:{default:"startLat"},arcStartLng:{default:"startLng"},arcStartAltitude:{default:0},arcEndLat:{default:"endLat"},arcEndLng:{default:"endLng"},arcEndAltitude:{default:0},arcColor:{default:function(){return"#ffffaa"}},arcAltitude:{},arcAltitudeAutoScale:{default:.5},arcStroke:{},arcCurveResolution:{default:64,triggerUpdate:!1},arcCircularResolution:{default:6,triggerUpdate:!1},arcDashLength:{default:1},arcDashGap:{default:0},arcDashInitialGap:{default:0},arcDashAnimateTime:{default:0},arcsTransitionDuration:{default:1e3,triggerUpdate:!1}},methods:{pauseAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.pause()},resumeAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.resume()},_destructor:function(e){var t;e.sharedMaterial.dispose(),(t=e.ticker)===null||t===void 0||t.dispose()}},stateInit:function(e){var t=e.tweenGroup;return{tweenGroup:t,ticker:new nLe,sharedMaterial:new Ju.ShaderMaterial($i($i({},qoe()),{},{transparent:!0,blending:Ju.NormalBlending}))}},init:function(e,t){ns(e),t.scene=e,t.dataMapper=new Ll(e,{objBindAttr:"__threeObjArc"}).onCreateObj(function(){var n=new Ju.Group;return n.__globeObjType="arc",n}),t.ticker.onTick.add(function(n,r){t.dataMapper.entries().map(function(s){var o=Pr(s,2),a=o[1];return a}).filter(function(s){return s.children.length&&s.children[0].material&&s.children[0].__dashAnimateStep}).forEach(function(s){var o=s.children[0],a=o.__dashAnimateStep*r,l=o.material.uniforms.dashTranslate.value%1e9;o.material.uniforms.dashTranslate.value=l+a})})},update:function(e){var t=st(e.arcStartLat),n=st(e.arcStartLng),r=st(e.arcStartAltitude),s=st(e.arcEndLat),o=st(e.arcEndLng),a=st(e.arcEndAltitude),l=st(e.arcAltitude),c=st(e.arcAltitudeAutoScale),u=st(e.arcStroke),f=st(e.arcColor),d=st(e.arcDashLength),A=st(e.arcDashGap),y=st(e.arcDashInitialGap),w=st(e.arcDashAnimateTime);e.dataMapper.onUpdateObj(function(P,I){var F=u(I),D=F!=null;if(!P.children.length||D!==(P.children[0].type==="Mesh")){ns(P);var L=D?new Ju.Mesh:new Ju.Line(new Ju.BufferGeometry);L.material=e.sharedMaterial.clone(),P.add(L)}var C=P.children[0];Object.assign(C.material.uniforms,{dashSize:{value:d(I)},gapSize:{value:A(I)},dashOffset:{value:y(I)}});var B=w(I);C.__dashAnimateStep=B>0?1e3/B:0;var k=T(f(I),e.arcCurveResolution,D?e.arcCircularResolution+1:1),z=R(e.arcCurveResolution,D?e.arcCircularResolution+1:1,!0);C.geometry.setAttribute("color",k),C.geometry.setAttribute("relDistance",z);var G=function($){var J=P.__currentTargetD=$,te=J.stroke,ce=VPe(J,tLe),he=S(ce);D?(C.geometry&&C.geometry.dispose(),C.geometry=new Ju.TubeGeometry(he,e.arcCurveResolution,te/2,e.arcCircularResolution),C.geometry.setAttribute("color",k),C.geometry.setAttribute("relDistance",z)):C.geometry.setFromPoints(he.getPoints(e.arcCurveResolution))},W={stroke:F,alt:l(I),altAutoScale:+c(I),startLat:+t(I),startLng:+n(I),startAlt:+r(I),endLat:+s(I),endLng:+o(I),endAlt:+a(I)},Y=P.__currentTargetD||Object.assign({},W,{altAutoScale:-.001});Object.keys(W).some(function(H){return Y[H]!==W[H]})&&(!e.arcsTransitionDuration||e.arcsTransitionDuration<0?G(W):e.tweenGroup.add(new uo(Y).to(W,e.arcsTransitionDuration).easing(Qr.Quadratic.InOut).onUpdate(G).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(e.arcsData);function S(P){var I=P.alt,F=P.altAutoScale,D=P.startLat,L=P.startLng,C=P.startAlt,B=P.endLat,k=P.endLng,z=P.endAlt,G=function(Ee){var Ve=Pr(Ee,3),Ye=Ve[0],Mt=Ve[1],Et=Ve[2],It=lu(Mt,Ye,Et),dn=It.x,Gt=It.y,$e=It.z;return new Ju.Vector3(dn,Gt,$e)},W=[L,D],Y=[k,B],H=I;if(H==null&&(H=Ml(W,Y)/2*F+Math.max(C,z)),H||C||z){var $=Cg(W,Y),J=function(Ee,Ve){return Ve+(Ve-Ee)*(Ee<Ve?.5:.25)},te=[.25,.75].map(function(mt){return[].concat(tr($(mt)),[J(mt<.5?C:z,H)])}),ce=Pr(te,2),he=ce[0],ve=ce[1],Re=FV(Ju.CubicBezierCurve3,tr([[].concat(W,[C]),he,ve,[].concat(Y,[z])].map(G)));return Re}else{var Qe=.001;return Fe.apply(void 0,tr([[].concat(W,[Qe]),[].concat(Y,[Qe])].map(G)))}function Fe(mt,Ee){var Ve=mt.angleTo(Ee),Ye=Ve===0?function(){return mt.clone()}:function(Et){return new Ju.Vector3().addVectors(mt.clone().multiplyScalar(Math.sin((1-Et)*Ve)),Ee.clone().multiplyScalar(Math.sin(Et*Ve))).divideScalar(Math.sin(Ve))},Mt=new Ju.Curve;return Mt.getPoint=Ye,Mt}}function T(P,I){var F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,D=I+1,L;if(P instanceof Array||P instanceof Function){var C=P instanceof Array?Tl().domain(P.map(function(H,$){return $/(P.length-1)})).range(P):P;L=function($){return Im(C($),!0,!0)}}else{var B=Im(P,!0,!0);L=function(){return B}}for(var k=[],z=0,G=D;z<G;z++)for(var W=L(z/(G-1)),Y=0;Y<F;Y++)k.push(W);return Of(k,4)}function R(P){for(var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,D=P+1,L=[],C=0,B=D;C<B;C++)for(var k=C/(B-1),z=0;z<I;z++)L.push(k);return F&&L.reverse(),Of(L,1)}}}),Mm=window.THREE?window.THREE:{BufferGeometry:Xn,DoubleSide:vr,Mesh:Hn,MeshLambertMaterial:Va,Object3D:lr},Poe=Object.assign({},yw),Loe=Poe.BufferGeometryUtils||Poe,Woe=Kr({props:{hexBinPointsData:{default:[]},hexBinPointLat:{default:"lat"},hexBinPointLng:{default:"lng"},hexBinPointWeight:{default:1},hexBinResolution:{default:4},hexMargin:{default:.2},hexTopCurvatureResolution:{default:5},hexTopColor:{default:function(){return"#ffffaa"}},hexSideColor:{default:function(){return"#ffffaa"}},hexAltitude:{default:function(e){var t=e.sumWeight;return t*.01}},hexBinMerge:{default:!1},hexTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;ns(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Ll(e,{objBindAttr:"__threeObjHexbin"})},update:function(e,t){var n=st(e.hexBinPointLat),r=st(e.hexBinPointLng),s=st(e.hexBinPointWeight),o=st(e.hexAltitude),a=st(e.hexTopColor),l=st(e.hexSideColor),c=st(e.hexMargin),u=lee(e.hexBinPointsData.map(function(R){return $i($i({},R),{},{h3Idx:yee(n(R),r(R),e.hexBinResolution)})}),"h3Idx"),f=Object.entries(u).map(function(R){var P=Pr(R,2),I=P[0],F=P[1];return{h3Idx:I,points:F,sumWeight:F.reduce(function(D,L){return D+ +s(L)},0)}}),d={};if(!e.hexBinMerge&&t.hasOwnProperty("hexBinMerge")&&ns(e.scene),e.dataMapper.scene=e.hexBinMerge?new Mm.Object3D:e.scene,e.dataMapper.id(function(R){return R.h3Idx}).onCreateObj(S).onUpdateObj(T).digest(f),e.hexBinMerge){var A=f.length?(Loe.mergeGeometries||Loe.mergeBufferGeometries)(f.map(function(R){var P=e.dataMapper.getObj(R),I=P.geometry.toNonIndexed();P.updateMatrix(),I.applyMatrix4(P.matrix);var F=Im(a(R)),D=Im(l(R)),L=I.getAttribute("position").count,C=I.groups[0].count;return I.setAttribute("color",Of(tr(new Array(L)).map(function(B,k){return k>=C?F:D}),4)),I})):new Mm.BufferGeometry,y=new Mm.MeshLambertMaterial({color:16777215,transparent:!0,vertexColors:!0,side:Mm.DoubleSide});y.onBeforeCompile=function(R){y.userData.shader=NV(R)};var w=new Mm.Mesh(A,y);w.__globeObjType="hexBinPoints",w.__data=f,e.dataMapper.clear(),ns(e.scene),e.scene.add(w)}function S(R){var P=new Mm.Mesh;P.__hexCenter=yO(R.h3Idx),P.__hexGeoJson=bO(R.h3Idx,!0).reverse();var I=P.__hexCenter[1];return P.__hexGeoJson.forEach(function(F){var D=F[0];Math.abs(I-D)>170&&(F[0]+=I>D?360:-360)}),P.__globeObjType="hexbin",P}function T(R,P){var I=function(J,te,ce){return J-(J-te)*ce},F=Math.max(0,Math.min(1,+c(P))),D=Pr(R.__hexCenter,2),L=D[0],C=D[1],B=F===0?R.__hexGeoJson:R.__hexGeoJson.map(function($){var J=Pr($,2),te=J[0],ce=J[1];return[[te,C],[ce,L]].map(function(he){var ve=Pr(he,2),Re=ve[0],Qe=ve[1];return I(Re,Qe,F)})}),k=e.hexTopCurvatureResolution;R.geometry&&R.geometry.dispose(),R.geometry=new sR([B],0,_r,!1,!0,!0,k);var z={alt:+o(P)},G=function(J){var te=R.__currentTargetD=J,ce=te.alt;R.scale.x=R.scale.y=R.scale.z=1+ce;var he=_r/(ce+1);R.geometry.setAttribute("surfaceRadius",Of(Array(R.geometry.getAttribute("position").count).fill(he),1))},W=R.__currentTargetD||Object.assign({},z,{alt:-.001});if(Object.keys(z).some(function($){return W[$]!==z[$]})&&(e.hexBinMerge||!e.hexTransitionDuration||e.hexTransitionDuration<0?G(z):e.tweenGroup.add(new uo(W).to(z,e.hexTransitionDuration).easing(Qr.Quadratic.InOut).onUpdate(G).onComplete(function(){e.tweenGroup.remove(this)}).start())),!e.hexBinMerge){var Y=l(P),H=a(P);[Y,H].forEach(function($){if(!d.hasOwnProperty($)){var J=th($);d[$]=OV(new Mm.MeshLambertMaterial({color:Bf($),transparent:J<1,opacity:J,side:Mm.DoubleSide}),NV)}}),R.material=[Y,H].map(function($){return d[$]})}}}}),joe=function(e){return e*e},rp=function(e){return e*Math.PI/180};function iLe(i,e){var t=Math.sqrt,n=Math.cos,r=function(u){return joe(Math.sin(u/2))},s=rp(i[1]),o=rp(e[1]),a=rp(i[0]),l=rp(e[0]);return 2*Math.asin(t(r(o-s)+n(s)*n(o)*r(l-a)))}var rLe=Math.sqrt(2*Math.PI);function sLe(i,e){return Math.exp(-joe(i/e)/2)/(e*rLe)}var oLe=function(e){var t=Pr(e,2),n=t[0],r=t[1],s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=o.lngAccessor,l=a===void 0?function(S){return S[0]}:a,c=o.latAccessor,u=c===void 0?function(S){return S[1]}:c,f=o.weightAccessor,d=f===void 0?function(){return 1}:f,A=o.bandwidth,y=[n,r],w=A*Math.PI/180;return tC(s.map(function(S){var T=d(S);if(!T)return 0;var R=iLe(y,[l(S),u(S)]);return sLe(R,w)*T}))},aLe=(function(){var i=NPe(LV().m(function e(t){var n,r,s,o,a,l,c,u,f,d,A,y,w,S,T,R,P,I,F,D,L,C,B,k,z,G,W,Y,H,$,J,te,ce,he,ve,Re,Qe,Fe,mt,Ee,Ve=arguments,Ye,Mt,Et;return LV().w(function(It){for(;;)switch(It.n){case 0:if(r=Ve.length>1&&Ve[1]!==void 0?Ve[1]:[],s=Ve.length>2&&Ve[2]!==void 0?Ve[2]:{},o=s.lngAccessor,a=o===void 0?function(dn){return dn[0]}:o,l=s.latAccessor,c=l===void 0?function(dn){return dn[1]}:l,u=s.weightAccessor,f=u===void 0?function(){return 1}:u,d=s.bandwidth,(n=navigator)!==null&&n!==void 0&&n.gpu){It.n=1;break}return console.warn("WebGPU not enabled in browser. Please consider enabling it to improve performance."),It.a(2,t.map(function(dn){return oLe(dn,r,{lngAccessor:a,latAccessor:c,weightAccessor:f,bandwidth:d})}));case 1:return A=4,y=aoe,w=loe,S=_oe,T=voe,R=doe,P=poe,I=coe,F=goe,D=Aoe,L=hoe,C=uoe,B=foe,k=moe,z=T(new a1(new Float32Array(t.flat().map(rp)),2),"vec2",t.length),G=T(new a1(new Float32Array(r.map(function(dn){return[rp(a(dn)),rp(c(dn)),f(dn)]}).flat()),3),"vec3",r.length),W=new a1(t.length,1),Y=T(W,"float",t.length),H=R(Math.PI),$=F(H.mul(2)),J=function(Gt){return Gt.mul(Gt)},te=function(Gt){return J(D(Gt.div(2)))},ce=function(Gt,$e){var ot=R(Gt[1]),nt=R($e[1]),bt=R(Gt[0]),yt=R($e[0]);return R(2).mul(C(F(te(nt.sub(ot)).add(L(ot).mul(L(nt)).mul(te(yt.sub(bt)))))))},he=function(Gt,$e){return B(k(J(Gt.div($e)).div(2))).div($e.mul($))},ve=S(rp(d)),Re=S(rp(d*A)),Qe=S(r.length),Fe=y(function(){var dn=z.element(P),Gt=Y.element(P);Gt.assign(0),I(Qe,function($e){var ot=$e.i,nt=G.element(ot),bt=nt.z;w(bt,function(){var yt=ce(nt.xy,dn.xy);w(yt&&yt.lessThan(Re),function(){Gt.addAssign(he(yt,ve).mul(bt))})})})}),mt=Fe().compute(t.length),Ee=new xx,It.n=2,Ee.computeAsync(mt);case 2:return Ye=Array,Mt=Float32Array,It.n=3,Ee.getArrayBufferAsync(W);case 3:return Et=It.v,It.a(2,Ye.from.call(Ye,new Mt(Et)))}},e)}));return function(t){return i.apply(this,arguments)}})(),jI=window.THREE?window.THREE:{Mesh:Hn,MeshLambertMaterial:Va,SphereGeometry:za},lLe=3.5,cLe=.1,Doe=100,uLe=function(e){var t=Uu(SO(e));return t.opacity=Math.cbrt(e),t.formatRgb()},Xoe=Kr({props:{heatmapsData:{default:[]},heatmapPoints:{default:function(e){return e}},heatmapPointLat:{default:function(e){return e[0]}},heatmapPointLng:{default:function(e){return e[1]}},heatmapPointWeight:{default:1},heatmapBandwidth:{default:2.5},heatmapColorFn:{default:function(){return uLe}},heatmapColorSaturation:{default:1.5},heatmapBaseAltitude:{default:.01},heatmapTopAltitude:{},heatmapsTransitionDuration:{default:0,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;ns(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Ll(e,{objBindAttr:"__threeObjHeatmap"}).onCreateObj(function(){var s=new jI.Mesh(new jI.SphereGeometry(_r),OV(new jI.MeshLambertMaterial({vertexColors:!0,transparent:!0}),JPe));return s.__globeObjType="heatmap",s})},update:function(e){var t=st(e.heatmapPoints),n=st(e.heatmapPointLat),r=st(e.heatmapPointLng),s=st(e.heatmapPointWeight),o=st(e.heatmapBandwidth),a=st(e.heatmapColorFn),l=st(e.heatmapColorSaturation),c=st(e.heatmapBaseAltitude),u=st(e.heatmapTopAltitude);e.dataMapper.onUpdateObj(function(f,d){var A=o(d),y=a(d),w=l(d),S=c(d),T=u(d),R=t(d).map(function(L){var C=n(L),B=r(L),k=lu(C,B),z=k.x,G=k.y,W=k.z;return{x:z,y:G,z:W,lat:C,lng:B,weight:s(L)}}),P=Math.max(cLe,A/lLe),I=Math.ceil(360/(P||-1));f.geometry.parameters.widthSegments!==I&&(f.geometry.dispose(),f.geometry=new jI.SphereGeometry(_r,I,I/2));var F=QPe(f.geometry.getAttribute("position")),D=F.map(function(L){var C=Pr(L,3),B=C[0],k=C[1],z=C[2],G=zoe({x:B,y:k,z}),W=G.lng,Y=G.lat;return[W,Y]});aLe(D,R,{latAccessor:function(C){return C.lat},lngAccessor:function(C){return C.lng},weightAccessor:function(C){return C.weight},bandwidth:A}).then(function(L){var C=tr(new Array(Doe)).map(function(G,W){return Im(y(W/(Doe-1)))}),B=function(W){var Y=f.__currentTargetD=W,H=Y.kdeVals,$=Y.topAlt,J=Y.saturation,te=JM(H.map(Math.abs))||1e-15,ce=Qb([0,te/J],C);f.geometry.setAttribute("color",Of(H.map(function(ve){return ce(Math.abs(ve))}),4));var he=Tl([0,te],[_r*(1+S),_r*(1+($||S))]);f.geometry.setAttribute("r",Of(H.map(he)))},k={kdeVals:L,topAlt:T,saturation:w},z=f.__currentTargetD||Object.assign({},k,{kdeVals:L.map(function(){return 0}),topAlt:T&&S,saturation:.5});z.kdeVals.length!==L.length&&(z.kdeVals=L.slice()),Object.keys(k).some(function(G){return z[G]!==k[G]})&&(!e.heatmapsTransitionDuration||e.heatmapsTransitionDuration<0?B(k):e.tweenGroup.add(new uo(z).to(k,e.heatmapsTransitionDuration).easing(Qr.Quadratic.InOut).onUpdate(B).onComplete(function(){e.tweenGroup.remove(this)}).start()))})}).digest(e.heatmapsData)}}),Cm=window.THREE?window.THREE:{DoubleSide:vr,Group:Br,LineBasicMaterial:Pu,LineSegments:Jv,Mesh:Hn,MeshBasicMaterial:fs},$oe=Kr({props:{polygonsData:{default:[]},polygonGeoJsonGeometry:{default:"geometry"},polygonSideColor:{default:function(){return"#ffffaa"}},polygonSideMaterial:{},polygonCapColor:{default:function(){return"#ffffaa"}},polygonCapMaterial:{},polygonStrokeColor:{},polygonAltitude:{default:.01},polygonCapCurvatureResolution:{default:5},polygonsTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;ns(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Ll(e,{objBindAttr:"__threeObjPolygon"}).id(function(s){return s.id}).onCreateObj(function(){var s=new Cm.Group;return s.__defaultSideMaterial=OV(new Cm.MeshBasicMaterial({side:Cm.DoubleSide,depthWrite:!0}),NV),s.__defaultCapMaterial=new Cm.MeshBasicMaterial({side:Cm.DoubleSide,depthWrite:!0}),s.add(new Cm.Mesh(void 0,[s.__defaultSideMaterial,s.__defaultCapMaterial])),s.add(new Cm.LineSegments(void 0,new Cm.LineBasicMaterial)),s.__globeObjType="polygon",s})},update:function(e){var t=st(e.polygonGeoJsonGeometry),n=st(e.polygonAltitude),r=st(e.polygonCapCurvatureResolution),s=st(e.polygonCapColor),o=st(e.polygonCapMaterial),a=st(e.polygonSideColor),l=st(e.polygonSideMaterial),c=st(e.polygonStrokeColor),u=[];e.polygonsData.forEach(function(f){var d={data:f,capColor:s(f),capMaterial:o(f),sideColor:a(f),sideMaterial:l(f),strokeColor:c(f),altitude:+n(f),capCurvatureResolution:+r(f)},A=t(f),y=f.__id||"".concat(Math.round(Math.random()*1e9));f.__id=y,A.type==="Polygon"?u.push($i({id:"".concat(y,"_0"),coords:A.coordinates},d)):A.type==="MultiPolygon"?u.push.apply(u,tr(A.coordinates.map(function(w,S){return $i({id:"".concat(y,"_").concat(S),coords:w},d)}))):console.warn("Unsupported GeoJson geometry type: ".concat(A.type,". Skipping geometry..."))}),e.dataMapper.onUpdateObj(function(f,d){var A=d.coords,y=d.capColor,w=d.capMaterial,S=d.sideColor,T=d.sideMaterial,R=d.strokeColor,P=d.altitude,I=d.capCurvatureResolution,F=Pr(f.children,2),D=F[0],L=F[1],C=!!R;L.visible=C;var B=!!(y||w),k=!!(S||T);hLe(D.geometry.parameters||{},{polygonGeoJson:A,curvatureResolution:I,closedTop:B,includeSides:k})||(D.geometry&&D.geometry.dispose(),D.geometry=new sR(A,0,_r,!1,B,k,I)),C&&(!L.geometry.parameters||L.geometry.parameters.geoJson.coordinates!==A||L.geometry.parameters.resolution!==I)&&(L.geometry&&L.geometry.dispose(),L.geometry=new JB({type:"Polygon",coordinates:A},_r,I));var z=k?0:-1,G=B?k?1:0:-1;if(z>=0&&(D.material[z]=T||f.__defaultSideMaterial),G>=0&&(D.material[G]=w||f.__defaultCapMaterial),[[!T&&S,z],[!w&&y,G]].forEach(function(te){var ce=Pr(te,2),he=ce[0],ve=ce[1];if(!(!he||ve<0)){var Re=D.material[ve],Qe=th(he);Re.color.set(Bf(he)),Re.transparent=Qe<1,Re.opacity=Qe}}),C){var W=L.material,Y=th(R);W.color.set(Bf(R)),W.transparent=Y<1,W.opacity=Y}var H={alt:P},$=function(ce){var he=f.__currentTargetD=ce,ve=he.alt;D.scale.x=D.scale.y=D.scale.z=1+ve,C&&(L.scale.x=L.scale.y=L.scale.z=1+ve+1e-4),eLe(f.__defaultSideMaterial,function(Re){return Re.uSurfaceRadius.value=_r/(ve+1)})},J=f.__currentTargetD||Object.assign({},H,{alt:-.001});Object.keys(H).some(function(te){return J[te]!==H[te]})&&(!e.polygonsTransitionDuration||e.polygonsTransitionDuration<0||J.alt===H.alt?$(H):e.tweenGroup.add(new uo(J).to(H,e.polygonsTransitionDuration).easing(Qr.Quadratic.InOut).onUpdate($).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(u)}});function hLe(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:function(){return function(n,r){return n===r}};return Object.entries(e).every(function(n){var r=Pr(n,2),s=r[0],o=r[1];return i.hasOwnProperty(s)&&t(s)(i[s],o)})}var Rx=window.THREE?window.THREE:{BufferGeometry:Xn,DoubleSide:vr,Mesh:Hn,MeshLambertMaterial:Va,Vector3:re},Noe=Object.assign({},yw),Foe=Noe.BufferGeometryUtils||Noe,Yoe=Kr({props:{hexPolygonsData:{default:[]},hexPolygonGeoJsonGeometry:{default:"geometry"},hexPolygonColor:{default:function(){return"#ffffaa"}},hexPolygonAltitude:{default:.001},hexPolygonResolution:{default:3},hexPolygonMargin:{default:.2},hexPolygonUseDots:{default:!1},hexPolygonCurvatureResolution:{default:5},hexPolygonDotResolution:{default:12},hexPolygonsTransitionDuration:{default:0,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;ns(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Ll(e,{objBindAttr:"__threeObjHexPolygon"}).onCreateObj(function(){var s=new Rx.Mesh(void 0,new Rx.MeshLambertMaterial({side:Rx.DoubleSide}));return s.__globeObjType="hexPolygon",s})},update:function(e){var t=st(e.hexPolygonGeoJsonGeometry),n=st(e.hexPolygonColor),r=st(e.hexPolygonAltitude),s=st(e.hexPolygonResolution),o=st(e.hexPolygonMargin),a=st(e.hexPolygonUseDots),l=st(e.hexPolygonCurvatureResolution),c=st(e.hexPolygonDotResolution);e.dataMapper.onUpdateObj(function(u,f){var d=t(f),A=s(f),y=r(f),w=Math.max(0,Math.min(1,+o(f))),S=a(f),T=l(f),R=c(f),P=n(f),I=th(P);u.material.color.set(Bf(P)),u.material.transparent=I<1,u.material.opacity=I;var F={alt:y,margin:w,curvatureResolution:T},D={geoJson:d,h3Res:A},L=u.__currentTargetD||Object.assign({},F,{alt:-.001}),C=u.__currentMemD||D;if(Object.keys(F).some(function(G){return L[G]!==F[G]})||Object.keys(D).some(function(G){return C[G]!==D[G]})){u.__currentMemD=D;var B=[];d.type==="Polygon"?wO(d.coordinates,A,!0).forEach(function(G){return B.push(G)}):d.type==="MultiPolygon"?d.coordinates.forEach(function(G){return wO(G,A,!0).forEach(function(W){return B.push(W)})}):console.warn("Unsupported GeoJson geometry type: ".concat(d.type,". Skipping geometry..."));var k=B.map(function(G){var W=yO(G),Y=bO(G,!0).reverse(),H=W[1];return Y.forEach(function($){var J=$[0];Math.abs(H-J)>170&&($[0]+=H>J?360:-360)}),{h3Idx:G,hexCenter:W,hexGeoJson:Y}}),z=function(W){var Y=u.__currentTargetD=W,H=Y.alt,$=Y.margin,J=Y.curvatureResolution;u.geometry&&u.geometry.dispose(),u.geometry=k.length?(Foe.mergeGeometries||Foe.mergeBufferGeometries)(k.map(function(te){var ce=Pr(te.hexCenter,2),he=ce[0],ve=ce[1];if(S){var Re=lu(he,ve,H),Qe=lu(te.hexGeoJson[0][1],te.hexGeoJson[0][0],H),Fe=.85*(1-$)*new Rx.Vector3(Re.x,Re.y,Re.z).distanceTo(new Rx.Vector3(Qe.x,Qe.y,Qe.z)),mt=new t_(Fe,R);return mt.rotateX(A1(-he)),mt.rotateY(A1(ve)),mt.translate(Re.x,Re.y,Re.z),mt}else{var Ee=function(Mt,Et,It){return Mt-(Mt-Et)*It},Ve=$===0?te.hexGeoJson:te.hexGeoJson.map(function(Ye){var Mt=Pr(Ye,2),Et=Mt[0],It=Mt[1];return[[Et,ve],[It,he]].map(function(dn){var Gt=Pr(dn,2),$e=Gt[0],ot=Gt[1];return Ee($e,ot,$)})});return new sR([Ve],_r,_r*(1+H),!1,!0,!1,J)}})):new Rx.BufferGeometry};!e.hexPolygonsTransitionDuration||e.hexPolygonsTransitionDuration<0?z(F):e.tweenGroup.add(new uo(L).to(F,e.hexPolygonsTransitionDuration).easing(Qr.Quadratic.InOut).onUpdate(z).onComplete(function(){e.tweenGroup.remove(this)}).start())}}).digest(e.hexPolygonsData)}}),fLe=window.THREE?window.THREE:{Vector3:re};function dLe(i,e){var t=function(o,a){var l=o[o.length-1];return[].concat(tr(o),tr(Array(a-o.length).fill(l)))},n=Math.max(i.length,e.length),r=kF.apply(void 0,tr([i,e].map(function(s){return s.map(function(o){var a=o.x,l=o.y,c=o.z;return[a,l,c]})}).map(function(s){return t(s,n)})));return function(s){return s===0?i:s===1?e:r(s).map(function(o){var a=Pr(o,3),l=a[0],c=a[1],u=a[2];return new fLe.Vector3(l,c,u)})}}var m1=window.THREE?window.THREE:{BufferGeometry:Xn,Color:zt,Group:Br,Line:a0,NormalBlending:Ms,ShaderMaterial:ds,Vector3:re},pLe=g1.default.default||g1.default,Zoe=Kr({props:{pathsData:{default:[]},pathPoints:{default:function(e){return e}},pathPointLat:{default:function(e){return e[0]}},pathPointLng:{default:function(e){return e[1]}},pathPointAlt:{default:.001},pathResolution:{default:2},pathColor:{default:function(){return"#ffffaa"}},pathStroke:{},pathDashLength:{default:1},pathDashGap:{default:0},pathDashInitialGap:{default:0},pathDashAnimateTime:{default:0},pathTransitionDuration:{default:1e3,triggerUpdate:!1},rendererSize:{}},methods:{pauseAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.pause()},resumeAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.resume()},_destructor:function(e){var t;(t=e.ticker)===null||t===void 0||t.dispose()}},stateInit:function(e){var t=e.tweenGroup;return{tweenGroup:t,ticker:new pLe,sharedMaterial:new m1.ShaderMaterial($i($i({},qoe()),{},{transparent:!0,blending:m1.NormalBlending}))}},init:function(e,t){ns(e),t.scene=e,t.dataMapper=new Ll(e,{objBindAttr:"__threeObjPath"}).onCreateObj(function(){var n=new m1.Group;return n.__globeObjType="path",n}),t.ticker.onTick.add(function(n,r){t.dataMapper.entries().map(function(s){var o=Pr(s,2),a=o[1];return a}).filter(function(s){return s.children.length&&s.children[0].material&&s.children[0].__dashAnimateStep}).forEach(function(s){var o=s.children[0],a=o.__dashAnimateStep*r;if(o.type==="Line"){var l=o.material.uniforms.dashTranslate.value%1e9;o.material.uniforms.dashTranslate.value=l+a}else if(o.type==="Line2"){for(var c=o.material.dashOffset-a,u=o.material.dashSize+o.material.gapSize;c<=-u;)c+=u;o.material.dashOffset=c}})})},update:function(e){var t=st(e.pathPoints),n=st(e.pathPointLat),r=st(e.pathPointLng),s=st(e.pathPointAlt),o=st(e.pathStroke),a=st(e.pathColor),l=st(e.pathDashLength),c=st(e.pathDashGap),u=st(e.pathDashInitialGap),f=st(e.pathDashAnimateTime);e.dataMapper.onUpdateObj(function(S,T){var R=o(T),P=R!=null;if(!S.children.length||P===(S.children[0].type==="Line")){ns(S);var I=P?new Mx(new Em,new Pf):new m1.Line(new m1.BufferGeometry,e.sharedMaterial.clone());S.add(I)}var F=S.children[0],D=A(t(T),n,r,s,e.pathResolution),L=f(T);if(F.__dashAnimateStep=L>0?1e3/L:0,P){F.material.resolution=e.rendererSize;{var k=l(T),z=c(T),G=u(T);F.material.dashed=z>0,F.material.dashed?F.material.defines.USE_DASH="":delete F.material.defines.USE_DASH,F.material.dashed&&(F.material.dashScale=1/d(D),F.material.dashSize=k,F.material.gapSize=z,F.material.dashOffset=-G)}{var W=a(T);if(W instanceof Array){var Y=y(a(T),D.length-1,1,!1);F.geometry.setColors(Y.array),F.material.vertexColors=!0}else{var H=W,$=th(H);F.material.color=new m1.Color(Bf(H)),F.material.transparent=$<1,F.material.opacity=$,F.material.vertexColors=!1}}F.material.needsUpdate=!0}else{Object.assign(F.material.uniforms,{dashSize:{value:l(T)},gapSize:{value:c(T)},dashOffset:{value:u(T)}});var C=y(a(T),D.length),B=w(D.length,1,!0);F.geometry.setAttribute("color",C),F.geometry.setAttribute("relDistance",B)}var J=dLe(S.__currentTargetD&&S.__currentTargetD.points||[D[0]],D),te=function(Re){var Qe=S.__currentTargetD=Re,Fe=Qe.stroke,mt=Qe.interpolK,Ee=S.__currentTargetD.points=J(mt);if(P){var Ve;F.geometry.setPositions((Ve=[]).concat.apply(Ve,tr(Ee.map(function(Ye){var Mt=Ye.x,Et=Ye.y,It=Ye.z;return[Mt,Et,It]})))),F.material.linewidth=Fe,F.material.dashed&&F.computeLineDistances()}else F.geometry.setFromPoints(Ee),F.geometry.computeBoundingSphere()},ce={stroke:R,interpolK:1},he=Object.assign({},S.__currentTargetD||ce,{interpolK:0});Object.keys(ce).some(function(ve){return he[ve]!==ce[ve]})&&(!e.pathTransitionDuration||e.pathTransitionDuration<0?te(ce):e.tweenGroup.add(new uo(he).to(ce,e.pathTransitionDuration).easing(Qr.Quadratic.InOut).onUpdate(te).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(e.pathsData);function d(S){var T=0,R;return S.forEach(function(P){R&&(T+=R.distanceTo(P)),R=P}),T}function A(S,T,R,P,I){var F=function(B,k,z){for(var G=[],W=1;W<=z;W++)G.push(B+(k-B)*W/(z+1));return G},D=function(){var B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,z=[],G=null;return B.forEach(function(W){if(G){for(;Math.abs(G[1]-W[1])>180;)G[1]+=360*(G[1]<W[1]?1:-1);var Y=Math.sqrt(Math.pow(W[0]-G[0],2)+Math.pow(W[1]-G[1],2));if(Y>k)for(var H=Math.floor(Y/k),$=F(G[0],W[0],H),J=F(G[1],W[1],H),te=F(G[2],W[2],H),ce=0,he=$.length;ce<he;ce++)z.push([$[ce],J[ce],te[ce]])}z.push(G=W)}),z},L=function(B){var k=Pr(B,3),z=k[0],G=k[1],W=k[2],Y=lu(z,G,W),H=Y.x,$=Y.y,J=Y.z;return new m1.Vector3(H,$,J)};return D(S.map(function(C){return[T(C),R(C),P(C)]}),I).map(L)}function y(S,T){var R=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,P=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,I=T+1,F;if(S instanceof Array||S instanceof Function){var D=S instanceof Array?Tl().domain(S.map(function(W,Y){return Y/(S.length-1)})).range(S):S;F=function(Y){return Im(D(Y),P,!0)}}else{var L=Im(S,P,!0);F=function(){return L}}for(var C=[],B=0,k=I;B<k;B++)for(var z=F(B/(k-1)),G=0;G<R;G++)C.push(z);return Of(C,P?4:3)}function w(S){for(var T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,R=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,P=S+1,I=[],F=0,D=P;F<D;F++)for(var L=F/(D-1),C=0;C<T;C++)I.push(L);return R&&I.reverse(),Of(I,1)}}}),XI=window.THREE?window.THREE:{Euler:Oa,Mesh:Hn,MeshLambertMaterial:Va,SphereGeometry:za},Koe=Kr({props:{tilesData:{default:[]},tileLat:{default:"lat"},tileLng:{default:"lng"},tileAltitude:{default:.01},tileWidth:{default:1},tileHeight:{default:1},tileUseGlobeProjection:{default:!0},tileMaterial:{default:function(){return new XI.MeshLambertMaterial({color:"#ffbb88",opacity:.4,transparent:!0})}},tileCurvatureResolution:{default:5},tilesTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;ns(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Ll(e,{objBindAttr:"__threeObjTile"}).onCreateObj(function(){var s=new XI.Mesh;return s.__globeObjType="tile",s})},update:function(e){var t=st(e.tileLat),n=st(e.tileLng),r=st(e.tileAltitude),s=st(e.tileWidth),o=st(e.tileHeight),a=st(e.tileUseGlobeProjection),l=st(e.tileMaterial),c=st(e.tileCurvatureResolution);e.dataMapper.onUpdateObj(function(u,f){u.material=l(f);var d=a(f),A=c(f),y=function(R){var P=u.__currentTargetD=R,I=P.lat,F=P.lng,D=P.alt,L=P.width,C=P.height,B=Ix(F),k=Ix(-I);u.geometry&&u.geometry.dispose(),u.geometry=new XI.SphereGeometry(_r*(1+D),Math.ceil(L/(A||-1)),Math.ceil(C/(A||-1)),Ix(90-L/2)+(d?B:0),Ix(L),Ix(90-C/2)+(d?k:0),Ix(C)),d||u.setRotationFromEuler(new XI.Euler(k,B,0,"YXZ"))},w={lat:+t(f),lng:+n(f),alt:+r(f),width:+s(f),height:+o(f)},S=u.__currentTargetD||Object.assign({},w,{width:0,height:0});Object.keys(w).some(function(T){return S[T]!==w[T]})&&(!e.tilesTransitionDuration||e.tilesTransitionDuration<0?y(w):e.tweenGroup.add(new uo(S).to(w,e.tilesTransitionDuration).easing(Qr.Quadratic.InOut).onUpdate(y).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(e.tilesData)}}),Ix=function(e){return e*Math.PI/180},zS=window.THREE?window.THREE:{BufferGeometry:Xn,Color:zt,Points:N2,PointsMaterial:l0},Qoe=Kr({props:{particlesData:{default:[]},particlesList:{default:function(e){return e}},particleLat:{default:"lat"},particleLng:{default:"lng"},particleAltitude:{default:.01},particlesSize:{default:.5},particlesSizeAttenuation:{default:!0},particlesColor:{default:function(){return"white"}},particlesTexture:{}},init:function(e,t){ns(e),t.scene=e,t.dataMapper=new Ll(e,{objBindAttr:"__threeObjParticles"}).onCreateObj(function(){var n=new zS.Points(new zS.BufferGeometry,new zS.PointsMaterial);return n.__globeObjType="particles",n}).onUpdateObj(function(n,r){var s=st(t.particlesList),o=st(t.particleLat),a=st(t.particleLng),l=st(t.particleAltitude);n.geometry.setAttribute("position",Of(s(r).map(function(c){return Object.values(lu(o(c),a(c),l(c)))}),3))})},update:function(e,t){["particlesData","particlesList","particleLat","particleLng","particleAltitude"].some(function(a){return t.hasOwnProperty(a)})&&e.dataMapper.digest(e.particlesData);var n=st(e.particlesColor),r=st(e.particlesSize),s=st(e.particlesSizeAttenuation),o=st(e.particlesTexture);e.dataMapper.entries().forEach(function(a){var l=Pr(a,2),c=l[0],u=l[1];if(u.material.size=r(c),u.material.sizeAttenuation=s(c),e.particlesTexture)u.material.color=new zS.Color(16777215),u.material.transparent=!1,u.material.alphaTest=.5,u.material.map=o(c);else{var f=n(c),d=th(f);u.material.color=new zS.Color(Bf(f)),u.material.transparent=d<1,u.material.opacity=d,u.material.alphaTest=0}})}}),mLe=window.THREE?window.THREE:{BufferGeometry:Xn},ALe=(function(i){function e(){var t,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:32;KI(this,e),t=ZI(this,e),t.type="CircleLineGeometry",t.parameters={radius:n,segmentCount:r};for(var s=[],o=0;o<=r;o++){var a=(o/r-.25)*Math.PI*2;s.push({x:Math.cos(a)*n,y:Math.sin(a)*n,z:0})}return t.setFromPoints(s),t}return JI(e,i),QI(e)})(mLe.BufferGeometry),Px=window.THREE?window.THREE:{Color:zt,Group:Br,Line:a0,LineBasicMaterial:Pu,Vector3:re},gLe=g1.default.default||g1.default,Joe=Kr({props:{ringsData:{default:[]},ringLat:{default:"lat"},ringLng:{default:"lng"},ringAltitude:{default:.0015},ringColor:{default:function(){return"#ffffaa"},triggerUpdate:!1},ringResolution:{default:64,triggerUpdate:!1},ringMaxRadius:{default:2,triggerUpdate:!1},ringPropagationSpeed:{default:1,triggerUpdate:!1},ringRepeatPeriod:{default:700,triggerUpdate:!1}},methods:{pauseAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.pause()},resumeAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.resume()},_destructor:function(e){var t;(t=e.ticker)===null||t===void 0||t.dispose()}},init:function(e,t,n){var r=n.tweenGroup;ns(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Ll(e,{objBindAttr:"__threeObjRing",removeDelay:3e4}).onCreateObj(function(){var s=new Px.Group;return s.__globeObjType="ring",s}),t.ticker=new gLe,t.ticker.onTick.add(function(s){if(t.ringsData.length){var o=st(t.ringColor),a=st(t.ringAltitude),l=st(t.ringMaxRadius),c=st(t.ringPropagationSpeed),u=st(t.ringRepeatPeriod);t.dataMapper.entries().filter(function(f){var d=Pr(f,2),A=d[1];return A}).forEach(function(f){var d=Pr(f,2),A=d[0],y=d[1];if((y.__nextRingTime||0)<=s){var w=u(A)/1e3;y.__nextRingTime=s+(w<=0?1/0:w);var S=new Px.Line(new ALe(1,t.ringResolution),new Px.LineBasicMaterial),T=o(A),R=T instanceof Array||T instanceof Function,P;R?T instanceof Array?(P=Tl().domain(T.map(function(z,G){return G/(T.length-1)})).range(T),S.material.transparent=T.some(function(z){return th(z)<1})):(P=T,S.material.transparent=!0):(S.material.color=new Px.Color(Bf(T)),KPe(S.material,th(T)));var I=_r*(1+a(A)),F=l(A),D=F*Math.PI/180,L=c(A),C=L<=0,B=function(G){var W=G.t,Y=(C?1-W:W)*D;if(S.scale.x=S.scale.y=I*Math.sin(Y),S.position.z=I*(1-Math.cos(Y)),R){var H=P(W);S.material.color=new Px.Color(Bf(H)),S.material.transparent&&(S.material.opacity=th(H))}};if(L===0)B({t:0}),y.add(S);else{var k=Math.abs(F/L)*1e3;t.tweenGroup.add(new uo({t:0}).to({t:1},k).onUpdate(B).onStart(function(){return y.add(S)}).onComplete(function(){t.tweenGroup.remove(this),y.remove(S),Rm(S)}).start())}}})}})},update:function(e){var t=st(e.ringLat),n=st(e.ringLng),r=st(e.ringAltitude),s=e.scene.localToWorld(new Px.Vector3(0,0,0));e.dataMapper.onUpdateObj(function(o,a){var l=t(a),c=n(a),u=r(a);Object.assign(o.position,lu(l,c,u)),o.lookAt(s)}).digest(e.ringsData)}}),vLe={0:{x_min:73,x_max:715,ha:792,o:"m 394 -29 q 153 129 242 -29 q 73 479 73 272 q 152 829 73 687 q 394 989 241 989 q 634 829 545 989 q 715 479 715 684 q 635 129 715 270 q 394 -29 546 -29 m 394 89 q 546 211 489 89 q 598 479 598 322 q 548 748 598 640 q 394 871 491 871 q 241 748 298 871 q 190 479 190 637 q 239 211 190 319 q 394 89 296 89 "},1:{x_min:215.671875,x_max:574,ha:792,o:"m 574 0 l 442 0 l 442 697 l 215 697 l 215 796 q 386 833 330 796 q 475 986 447 875 l 574 986 l 574 0 "},2:{x_min:59,x_max:731,ha:792,o:"m 731 0 l 59 0 q 197 314 59 188 q 457 487 199 315 q 598 691 598 580 q 543 819 598 772 q 411 867 488 867 q 272 811 328 867 q 209 630 209 747 l 81 630 q 182 901 81 805 q 408 986 271 986 q 629 909 536 986 q 731 694 731 826 q 613 449 731 541 q 378 316 495 383 q 201 122 235 234 l 731 122 l 731 0 "},3:{x_min:54,x_max:737,ha:792,o:"m 737 284 q 635 55 737 141 q 399 -25 541 -25 q 156 52 248 -25 q 54 308 54 140 l 185 308 q 245 147 185 202 q 395 96 302 96 q 539 140 484 96 q 602 280 602 190 q 510 429 602 390 q 324 454 451 454 l 324 565 q 487 584 441 565 q 565 719 565 617 q 515 835 565 791 q 395 879 466 879 q 255 824 307 879 q 203 661 203 769 l 78 661 q 166 909 78 822 q 387 992 250 992 q 603 921 513 992 q 701 723 701 844 q 669 607 701 656 q 578 524 637 558 q 696 434 655 499 q 737 284 737 369 "},4:{x_min:48,x_max:742.453125,ha:792,o:"m 742 243 l 602 243 l 602 0 l 476 0 l 476 243 l 48 243 l 48 368 l 476 958 l 602 958 l 602 354 l 742 354 l 742 243 m 476 354 l 476 792 l 162 354 l 476 354 "},5:{x_min:54.171875,x_max:738,ha:792,o:"m 738 314 q 626 60 738 153 q 382 -23 526 -23 q 155 47 248 -23 q 54 256 54 125 l 183 256 q 259 132 204 174 q 382 91 314 91 q 533 149 471 91 q 602 314 602 213 q 538 469 602 411 q 386 528 475 528 q 284 506 332 528 q 197 439 237 484 l 81 439 l 159 958 l 684 958 l 684 840 l 254 840 l 214 579 q 306 627 258 612 q 407 643 354 643 q 636 552 540 643 q 738 314 738 457 "},6:{x_min:53,x_max:739,ha:792,o:"m 739 312 q 633 62 739 162 q 400 -31 534 -31 q 162 78 257 -31 q 53 439 53 206 q 178 859 53 712 q 441 986 284 986 q 643 912 559 986 q 732 713 732 833 l 601 713 q 544 830 594 786 q 426 875 494 875 q 268 793 331 875 q 193 517 193 697 q 301 597 240 570 q 427 624 362 624 q 643 540 552 624 q 739 312 739 451 m 603 298 q 540 461 603 400 q 404 516 484 516 q 268 461 323 516 q 207 300 207 401 q 269 137 207 198 q 405 83 325 83 q 541 137 486 83 q 603 298 603 197 "},7:{x_min:58.71875,x_max:730.953125,ha:792,o:"m 730 839 q 469 448 560 641 q 335 0 378 255 l 192 0 q 328 441 235 252 q 593 830 421 630 l 58 830 l 58 958 l 730 958 l 730 839 "},8:{x_min:55,x_max:736,ha:792,o:"m 571 527 q 694 424 652 491 q 736 280 736 358 q 648 71 736 158 q 395 -26 551 -26 q 142 69 238 -26 q 55 279 55 157 q 96 425 55 359 q 220 527 138 491 q 120 615 153 562 q 88 726 88 668 q 171 904 88 827 q 395 986 261 986 q 618 905 529 986 q 702 727 702 830 q 670 616 702 667 q 571 527 638 565 m 394 565 q 519 610 475 565 q 563 717 563 655 q 521 823 563 781 q 392 872 474 872 q 265 824 312 872 q 224 720 224 783 q 265 613 224 656 q 394 565 312 565 m 395 91 q 545 150 488 91 q 597 280 597 204 q 546 408 597 355 q 395 465 492 465 q 244 408 299 465 q 194 280 194 356 q 244 150 194 203 q 395 91 299 91 "},9:{x_min:53,x_max:739,ha:792,o:"m 739 524 q 619 94 739 241 q 362 -32 516 -32 q 150 47 242 -32 q 59 244 59 126 l 191 244 q 246 129 191 176 q 373 82 301 82 q 526 161 466 82 q 597 440 597 255 q 363 334 501 334 q 130 432 216 334 q 53 650 53 521 q 134 880 53 786 q 383 986 226 986 q 659 841 566 986 q 739 524 739 719 m 388 449 q 535 514 480 449 q 585 658 585 573 q 535 805 585 744 q 388 873 480 873 q 242 809 294 873 q 191 658 191 745 q 239 514 191 572 q 388 449 292 449 "},\u03BF:{x_min:0,x_max:712,ha:815,o:"m 356 -25 q 96 88 192 -25 q 0 368 0 201 q 92 642 0 533 q 356 761 192 761 q 617 644 517 761 q 712 368 712 533 q 619 91 712 201 q 356 -25 520 -25 m 356 85 q 527 175 465 85 q 583 369 583 255 q 528 562 583 484 q 356 651 466 651 q 189 560 250 651 q 135 369 135 481 q 187 177 135 257 q 356 85 250 85 "},S:{x_min:0,x_max:788,ha:890,o:"m 788 291 q 662 54 788 144 q 397 -26 550 -26 q 116 68 226 -26 q 0 337 0 168 l 131 337 q 200 152 131 220 q 384 85 269 85 q 557 129 479 85 q 650 270 650 183 q 490 429 650 379 q 194 513 341 470 q 33 739 33 584 q 142 964 33 881 q 388 1041 242 1041 q 644 957 543 1041 q 756 716 756 867 l 625 716 q 561 874 625 816 q 395 933 497 933 q 243 891 309 933 q 164 759 164 841 q 325 609 164 656 q 625 526 475 568 q 788 291 788 454 "},"\xA6":{x_min:343,x_max:449,ha:792,o:"m 449 462 l 343 462 l 343 986 l 449 986 l 449 462 m 449 -242 l 343 -242 l 343 280 l 449 280 l 449 -242 "},"/":{x_min:183.25,x_max:608.328125,ha:792,o:"m 608 1041 l 266 -129 l 183 -129 l 520 1041 l 608 1041 "},\u03A4:{x_min:-.4375,x_max:777.453125,ha:839,o:"m 777 893 l 458 893 l 458 0 l 319 0 l 319 892 l 0 892 l 0 1013 l 777 1013 l 777 893 "},y:{x_min:0,x_max:684.78125,ha:771,o:"m 684 738 l 388 -83 q 311 -216 356 -167 q 173 -279 252 -279 q 97 -266 133 -279 l 97 -149 q 132 -155 109 -151 q 168 -160 155 -160 q 240 -114 213 -160 q 274 -26 248 -98 l 0 738 l 137 737 l 341 139 l 548 737 l 684 738 "},\u03A0:{x_min:0,x_max:803,ha:917,o:"m 803 0 l 667 0 l 667 886 l 140 886 l 140 0 l 0 0 l 0 1012 l 803 1012 l 803 0 "},\u0390:{x_min:-111,x_max:339,ha:361,o:"m 339 800 l 229 800 l 229 925 l 339 925 l 339 800 m -1 800 l -111 800 l -111 925 l -1 925 l -1 800 m 284 3 q 233 -10 258 -5 q 182 -15 207 -15 q 85 26 119 -15 q 42 200 42 79 l 42 737 l 167 737 l 168 215 q 172 141 168 157 q 226 101 183 101 q 248 103 239 101 q 284 112 257 104 l 284 3 m 302 1040 l 113 819 l 30 819 l 165 1040 l 302 1040 "},g:{x_min:0,x_max:686,ha:838,o:"m 686 34 q 586 -213 686 -121 q 331 -306 487 -306 q 131 -252 216 -306 q 31 -84 31 -190 l 155 -84 q 228 -174 166 -138 q 345 -207 284 -207 q 514 -109 454 -207 q 564 89 564 -27 q 461 6 521 36 q 335 -23 401 -23 q 88 100 184 -23 q 0 370 0 215 q 87 634 0 522 q 330 758 183 758 q 457 728 398 758 q 564 644 515 699 l 564 737 l 686 737 l 686 34 m 582 367 q 529 560 582 481 q 358 652 468 652 q 189 561 250 652 q 135 369 135 482 q 189 176 135 255 q 361 85 251 85 q 529 176 468 85 q 582 367 582 255 "},"\xB2":{x_min:0,x_max:442,ha:539,o:"m 442 383 l 0 383 q 91 566 0 492 q 260 668 176 617 q 354 798 354 727 q 315 875 354 845 q 227 905 277 905 q 136 869 173 905 q 99 761 99 833 l 14 761 q 82 922 14 864 q 232 974 141 974 q 379 926 316 974 q 442 797 442 878 q 351 635 442 704 q 183 539 321 611 q 92 455 92 491 l 442 455 l 442 383 "},"\u2013":{x_min:0,x_max:705.5625,ha:803,o:"m 705 334 l 0 334 l 0 410 l 705 410 l 705 334 "},\u039A:{x_min:0,x_max:819.5625,ha:893,o:"m 819 0 l 650 0 l 294 509 l 139 356 l 139 0 l 0 0 l 0 1013 l 139 1013 l 139 526 l 626 1013 l 809 1013 l 395 600 l 819 0 "},\u0192:{x_min:-46.265625,x_max:392,ha:513,o:"m 392 651 l 259 651 l 79 -279 l -46 -278 l 134 651 l 14 651 l 14 751 l 135 751 q 151 948 135 900 q 304 1041 185 1041 q 334 1040 319 1041 q 392 1034 348 1039 l 392 922 q 337 931 360 931 q 271 883 287 931 q 260 793 260 853 l 260 751 l 392 751 l 392 651 "},e:{x_min:0,x_max:714,ha:813,o:"m 714 326 l 140 326 q 200 157 140 227 q 359 87 260 87 q 488 130 431 87 q 561 245 545 174 l 697 245 q 577 48 670 123 q 358 -26 484 -26 q 97 85 195 -26 q 0 363 0 197 q 94 642 0 529 q 358 765 195 765 q 626 627 529 765 q 714 326 714 503 m 576 429 q 507 583 564 522 q 355 650 445 650 q 206 583 266 650 q 140 429 152 522 l 576 429 "},\u03CC:{x_min:0,x_max:712,ha:815,o:"m 356 -25 q 94 91 194 -25 q 0 368 0 202 q 92 642 0 533 q 356 761 192 761 q 617 644 517 761 q 712 368 712 533 q 619 91 712 201 q 356 -25 520 -25 m 356 85 q 527 175 465 85 q 583 369 583 255 q 528 562 583 484 q 356 651 466 651 q 189 560 250 651 q 135 369 135 481 q 187 177 135 257 q 356 85 250 85 m 576 1040 l 387 819 l 303 819 l 438 1040 l 576 1040 "},J:{x_min:0,x_max:588,ha:699,o:"m 588 279 q 287 -26 588 -26 q 58 73 126 -26 q 0 327 0 158 l 133 327 q 160 172 133 227 q 288 96 198 96 q 426 171 391 96 q 449 336 449 219 l 449 1013 l 588 1013 l 588 279 "},"\xBB":{x_min:-1,x_max:503,ha:601,o:"m 503 302 l 280 136 l 281 256 l 429 373 l 281 486 l 280 608 l 503 440 l 503 302 m 221 302 l 0 136 l 0 255 l 145 372 l 0 486 l -1 608 l 221 440 l 221 302 "},"\xA9":{x_min:-3,x_max:1008,ha:1106,o:"m 502 -7 q 123 151 263 -7 q -3 501 -3 294 q 123 851 -3 706 q 502 1011 263 1011 q 881 851 739 1011 q 1008 501 1008 708 q 883 151 1008 292 q 502 -7 744 -7 m 502 60 q 830 197 709 60 q 940 501 940 322 q 831 805 940 681 q 502 944 709 944 q 174 805 296 944 q 65 501 65 680 q 173 197 65 320 q 502 60 294 60 m 741 394 q 661 246 731 302 q 496 190 591 190 q 294 285 369 190 q 228 497 228 370 q 295 714 228 625 q 499 813 370 813 q 656 762 588 813 q 733 625 724 711 l 634 625 q 589 704 629 673 q 498 735 550 735 q 377 666 421 735 q 334 504 334 597 q 374 340 334 408 q 490 272 415 272 q 589 304 549 272 q 638 394 628 337 l 741 394 "},\u03CE:{x_min:0,x_max:922,ha:1030,o:"m 687 1040 l 498 819 l 415 819 l 549 1040 l 687 1040 m 922 339 q 856 97 922 203 q 650 -26 780 -26 q 538 9 587 -26 q 461 103 489 44 q 387 12 436 46 q 277 -22 339 -22 q 69 97 147 -22 q 0 338 0 202 q 45 551 0 444 q 161 737 84 643 l 302 737 q 175 552 219 647 q 124 336 124 446 q 155 179 124 248 q 275 88 197 88 q 375 163 341 88 q 400 294 400 219 l 400 572 l 524 572 l 524 294 q 561 135 524 192 q 643 88 591 88 q 762 182 719 88 q 797 341 797 257 q 745 555 797 450 q 619 737 705 637 l 760 737 q 874 551 835 640 q 922 339 922 444 "},"^":{x_min:193.0625,x_max:598.609375,ha:792,o:"m 598 772 l 515 772 l 395 931 l 277 772 l 193 772 l 326 1013 l 462 1013 l 598 772 "},"\xAB":{x_min:0,x_max:507.203125,ha:604,o:"m 506 136 l 284 302 l 284 440 l 506 608 l 507 485 l 360 371 l 506 255 l 506 136 m 222 136 l 0 302 l 0 440 l 222 608 l 221 486 l 73 373 l 222 256 l 222 136 "},D:{x_min:0,x_max:828,ha:935,o:"m 389 1013 q 714 867 593 1013 q 828 521 828 729 q 712 161 828 309 q 382 0 587 0 l 0 0 l 0 1013 l 389 1013 m 376 124 q 607 247 523 124 q 681 510 681 355 q 607 771 681 662 q 376 896 522 896 l 139 896 l 139 124 l 376 124 "},"\u2219":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 "},\u00FF:{x_min:0,x_max:47,ha:125,o:"m 47 3 q 37 -7 47 -7 q 28 0 30 -7 q 39 -4 32 -4 q 45 3 45 -1 l 37 0 q 28 9 28 0 q 39 19 28 19 l 47 16 l 47 19 l 47 3 m 37 1 q 44 8 44 1 q 37 16 44 16 q 30 8 30 16 q 37 1 30 1 m 26 1 l 23 22 l 14 0 l 3 22 l 3 3 l 0 25 l 13 1 l 22 25 l 26 1 "},w:{x_min:0,x_max:1009.71875,ha:1100,o:"m 1009 738 l 783 0 l 658 0 l 501 567 l 345 0 l 222 0 l 0 738 l 130 738 l 284 174 l 432 737 l 576 738 l 721 173 l 881 737 l 1009 738 "},$:{x_min:0,x_max:700,ha:793,o:"m 664 717 l 542 717 q 490 825 531 785 q 381 872 450 865 l 381 551 q 620 446 540 522 q 700 241 700 370 q 618 45 700 116 q 381 -25 536 -25 l 381 -152 l 307 -152 l 307 -25 q 81 62 162 -25 q 0 297 0 149 l 124 297 q 169 146 124 204 q 307 81 215 89 l 307 441 q 80 536 148 469 q 13 725 13 603 q 96 910 13 839 q 307 982 180 982 l 307 1077 l 381 1077 l 381 982 q 574 917 494 982 q 664 717 664 845 m 307 565 l 307 872 q 187 831 233 872 q 142 724 142 791 q 180 618 142 656 q 307 565 218 580 m 381 76 q 562 237 562 96 q 517 361 562 313 q 381 423 472 409 l 381 76 "},"\\":{x_min:-.015625,x_max:425.0625,ha:522,o:"m 425 -129 l 337 -129 l 0 1041 l 83 1041 l 425 -129 "},\u00B5:{x_min:0,x_max:697.21875,ha:747,o:"m 697 -4 q 629 -14 658 -14 q 498 97 513 -14 q 422 9 470 41 q 313 -23 374 -23 q 207 4 258 -23 q 119 81 156 32 l 119 -278 l 0 -278 l 0 738 l 124 738 l 124 343 q 165 173 124 246 q 308 83 216 83 q 452 178 402 83 q 493 359 493 255 l 493 738 l 617 738 l 617 214 q 623 136 617 160 q 673 92 637 92 q 697 96 684 92 l 697 -4 "},\u0399:{x_min:42,x_max:181,ha:297,o:"m 181 0 l 42 0 l 42 1013 l 181 1013 l 181 0 "},\u038E:{x_min:0,x_max:1144.5,ha:1214,o:"m 1144 1012 l 807 416 l 807 0 l 667 0 l 667 416 l 325 1012 l 465 1012 l 736 533 l 1004 1012 l 1144 1012 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},"\u2019":{x_min:0,x_max:139,ha:236,o:"m 139 851 q 102 737 139 784 q 0 669 65 690 l 0 734 q 59 787 42 741 q 72 873 72 821 l 0 873 l 0 1013 l 139 1013 l 139 851 "},\u039D:{x_min:0,x_max:801,ha:915,o:"m 801 0 l 651 0 l 131 822 l 131 0 l 0 0 l 0 1013 l 151 1013 l 670 191 l 670 1013 l 801 1013 l 801 0 "},"-":{x_min:8.71875,x_max:350.390625,ha:478,o:"m 350 317 l 8 317 l 8 428 l 350 428 l 350 317 "},Q:{x_min:0,x_max:968,ha:1072,o:"m 954 5 l 887 -79 l 744 35 q 622 -11 687 2 q 483 -26 556 -26 q 127 130 262 -26 q 0 504 0 279 q 127 880 0 728 q 484 1041 262 1041 q 841 884 708 1041 q 968 507 968 735 q 933 293 968 398 q 832 104 899 188 l 954 5 m 723 191 q 802 330 777 248 q 828 499 828 412 q 744 790 828 673 q 483 922 650 922 q 228 791 322 922 q 142 505 142 673 q 227 221 142 337 q 487 91 323 91 q 632 123 566 91 l 520 215 l 587 301 l 723 191 "},\u03C2:{x_min:1,x_max:676.28125,ha:740,o:"m 676 460 l 551 460 q 498 595 542 546 q 365 651 448 651 q 199 578 263 651 q 136 401 136 505 q 266 178 136 241 q 508 106 387 142 q 640 -50 640 62 q 625 -158 640 -105 q 583 -278 611 -211 l 465 -278 q 498 -182 490 -211 q 515 -80 515 -126 q 381 12 515 -15 q 134 91 197 51 q 1 388 1 179 q 100 651 1 542 q 354 761 199 761 q 587 680 498 761 q 676 460 676 599 "},M:{x_min:0,x_max:954,ha:1067,o:"m 954 0 l 819 0 l 819 869 l 537 0 l 405 0 l 128 866 l 128 0 l 0 0 l 0 1013 l 200 1013 l 472 160 l 757 1013 l 954 1013 l 954 0 "},\u03A8:{x_min:0,x_max:1006,ha:1094,o:"m 1006 678 q 914 319 1006 429 q 571 200 814 200 l 571 0 l 433 0 l 433 200 q 92 319 194 200 q 0 678 0 429 l 0 1013 l 139 1013 l 139 679 q 191 417 139 492 q 433 326 255 326 l 433 1013 l 571 1013 l 571 326 l 580 326 q 813 423 747 326 q 868 679 868 502 l 868 1013 l 1006 1013 l 1006 678 "},C:{x_min:0,x_max:886,ha:944,o:"m 886 379 q 760 87 886 201 q 455 -26 634 -26 q 112 136 236 -26 q 0 509 0 283 q 118 882 0 737 q 469 1041 245 1041 q 748 955 630 1041 q 879 708 879 859 l 745 708 q 649 862 724 805 q 473 920 573 920 q 219 791 312 920 q 136 509 136 675 q 217 229 136 344 q 470 99 311 99 q 672 179 591 99 q 753 379 753 259 l 886 379 "},"!":{x_min:0,x_max:138,ha:236,o:"m 138 684 q 116 409 138 629 q 105 244 105 299 l 33 244 q 16 465 33 313 q 0 684 0 616 l 0 1013 l 138 1013 l 138 684 m 138 0 l 0 0 l 0 151 l 138 151 l 138 0 "},"{":{x_min:0,x_max:480.5625,ha:578,o:"m 480 -286 q 237 -213 303 -286 q 187 -45 187 -159 q 194 48 187 -15 q 201 141 201 112 q 164 264 201 225 q 0 314 118 314 l 0 417 q 164 471 119 417 q 201 605 201 514 q 199 665 201 644 q 193 772 193 769 q 241 941 193 887 q 480 1015 308 1015 l 480 915 q 336 866 375 915 q 306 742 306 828 q 310 662 306 717 q 314 577 314 606 q 288 452 314 500 q 176 365 256 391 q 289 275 257 337 q 314 143 314 226 q 313 84 314 107 q 310 -11 310 -5 q 339 -131 310 -94 q 480 -182 377 -182 l 480 -286 "},X:{x_min:-.015625,x_max:854.15625,ha:940,o:"m 854 0 l 683 0 l 423 409 l 166 0 l 0 0 l 347 519 l 18 1013 l 186 1013 l 428 637 l 675 1013 l 836 1013 l 504 520 l 854 0 "},"#":{x_min:0,x_max:963.890625,ha:1061,o:"m 963 690 l 927 590 l 719 590 l 655 410 l 876 410 l 840 310 l 618 310 l 508 -3 l 393 -2 l 506 309 l 329 310 l 215 -2 l 102 -3 l 212 310 l 0 310 l 36 410 l 248 409 l 312 590 l 86 590 l 120 690 l 347 690 l 459 1006 l 573 1006 l 462 690 l 640 690 l 751 1006 l 865 1006 l 754 690 l 963 690 m 606 590 l 425 590 l 362 410 l 543 410 l 606 590 "},\u03B9:{x_min:42,x_max:284,ha:361,o:"m 284 3 q 233 -10 258 -5 q 182 -15 207 -15 q 85 26 119 -15 q 42 200 42 79 l 42 738 l 167 738 l 168 215 q 172 141 168 157 q 226 101 183 101 q 248 103 239 101 q 284 112 257 104 l 284 3 "},\u0386:{x_min:0,x_max:906.953125,ha:982,o:"m 283 1040 l 88 799 l 5 799 l 145 1040 l 283 1040 m 906 0 l 756 0 l 650 303 l 251 303 l 143 0 l 0 0 l 376 1012 l 529 1012 l 906 0 m 609 421 l 452 866 l 293 421 l 609 421 "},")":{x_min:0,x_max:318,ha:415,o:"m 318 365 q 257 25 318 191 q 87 -290 197 -141 l 0 -290 q 140 21 93 -128 q 193 360 193 189 q 141 704 193 537 q 0 1024 97 850 l 87 1024 q 257 706 197 871 q 318 365 318 542 "},\u03B5:{x_min:0,x_max:634.71875,ha:714,o:"m 634 234 q 527 38 634 110 q 300 -25 433 -25 q 98 29 183 -25 q 0 204 0 93 q 37 314 0 265 q 128 390 67 353 q 56 460 82 419 q 26 555 26 505 q 114 712 26 654 q 295 763 191 763 q 499 700 416 763 q 589 515 589 631 l 478 515 q 419 618 464 580 q 307 657 374 657 q 207 630 253 657 q 151 547 151 598 q 238 445 151 469 q 389 434 280 434 l 389 331 l 349 331 q 206 315 255 331 q 125 210 125 287 q 183 107 125 145 q 302 76 233 76 q 436 117 379 76 q 509 234 493 159 l 634 234 "},\u0394:{x_min:0,x_max:952.78125,ha:1028,o:"m 952 0 l 0 0 l 400 1013 l 551 1013 l 952 0 m 762 124 l 476 867 l 187 124 l 762 124 "},"}":{x_min:0,x_max:481,ha:578,o:"m 481 314 q 318 262 364 314 q 282 136 282 222 q 284 65 282 97 q 293 -58 293 -48 q 241 -217 293 -166 q 0 -286 174 -286 l 0 -182 q 143 -130 105 -182 q 171 -2 171 -93 q 168 81 171 22 q 165 144 165 140 q 188 275 165 229 q 306 365 220 339 q 191 455 224 391 q 165 588 165 505 q 168 681 165 624 q 171 742 171 737 q 141 865 171 827 q 0 915 102 915 l 0 1015 q 243 942 176 1015 q 293 773 293 888 q 287 675 293 741 q 282 590 282 608 q 318 466 282 505 q 481 417 364 417 l 481 314 "},"\u2030":{x_min:-3,x_max:1672,ha:1821,o:"m 846 0 q 664 76 732 0 q 603 244 603 145 q 662 412 603 344 q 846 489 729 489 q 1027 412 959 489 q 1089 244 1089 343 q 1029 76 1089 144 q 846 0 962 0 m 845 103 q 945 143 910 103 q 981 243 981 184 q 947 340 981 301 q 845 385 910 385 q 745 342 782 385 q 709 243 709 300 q 742 147 709 186 q 845 103 781 103 m 888 986 l 284 -25 l 199 -25 l 803 986 l 888 986 m 241 468 q 58 545 126 468 q -3 715 -3 615 q 56 881 -3 813 q 238 958 124 958 q 421 881 353 958 q 483 712 483 813 q 423 544 483 612 q 241 468 356 468 m 241 855 q 137 811 175 855 q 100 710 100 768 q 136 612 100 653 q 240 572 172 572 q 344 614 306 572 q 382 713 382 656 q 347 810 382 771 q 241 855 308 855 m 1428 0 q 1246 76 1314 0 q 1185 244 1185 145 q 1244 412 1185 344 q 1428 489 1311 489 q 1610 412 1542 489 q 1672 244 1672 343 q 1612 76 1672 144 q 1428 0 1545 0 m 1427 103 q 1528 143 1492 103 q 1564 243 1564 184 q 1530 340 1564 301 q 1427 385 1492 385 q 1327 342 1364 385 q 1291 243 1291 300 q 1324 147 1291 186 q 1427 103 1363 103 "},a:{x_min:0,x_max:698.609375,ha:794,o:"m 698 0 q 661 -12 679 -7 q 615 -17 643 -17 q 536 12 564 -17 q 500 96 508 41 q 384 6 456 37 q 236 -25 312 -25 q 65 31 130 -25 q 0 194 0 88 q 118 390 0 334 q 328 435 180 420 q 488 483 476 451 q 495 523 495 504 q 442 619 495 584 q 325 654 389 654 q 209 617 257 654 q 152 513 161 580 l 33 513 q 123 705 33 633 q 332 772 207 772 q 528 712 448 772 q 617 531 617 645 l 617 163 q 624 108 617 126 q 664 90 632 90 l 698 94 l 698 0 m 491 262 l 491 372 q 272 329 350 347 q 128 201 128 294 q 166 113 128 144 q 264 83 205 83 q 414 130 346 83 q 491 262 491 183 "},"\u2014":{x_min:0,x_max:941.671875,ha:1039,o:"m 941 334 l 0 334 l 0 410 l 941 410 l 941 334 "},"=":{x_min:8.71875,x_max:780.953125,ha:792,o:"m 780 510 l 8 510 l 8 606 l 780 606 l 780 510 m 780 235 l 8 235 l 8 332 l 780 332 l 780 235 "},N:{x_min:0,x_max:801,ha:914,o:"m 801 0 l 651 0 l 131 823 l 131 0 l 0 0 l 0 1013 l 151 1013 l 670 193 l 670 1013 l 801 1013 l 801 0 "},\u03C1:{x_min:0,x_max:712,ha:797,o:"m 712 369 q 620 94 712 207 q 362 -26 521 -26 q 230 2 292 -26 q 119 83 167 30 l 119 -278 l 0 -278 l 0 362 q 91 643 0 531 q 355 764 190 764 q 617 647 517 764 q 712 369 712 536 m 583 366 q 530 559 583 480 q 359 651 469 651 q 190 562 252 651 q 135 370 135 483 q 189 176 135 257 q 359 85 250 85 q 528 175 466 85 q 583 366 583 254 "},"\xAF":{x_min:0,x_max:941.671875,ha:938,o:"m 941 1033 l 0 1033 l 0 1109 l 941 1109 l 941 1033 "},Z:{x_min:0,x_max:779,ha:849,o:"m 779 0 l 0 0 l 0 113 l 621 896 l 40 896 l 40 1013 l 779 1013 l 778 887 l 171 124 l 779 124 l 779 0 "},u:{x_min:0,x_max:617,ha:729,o:"m 617 0 l 499 0 l 499 110 q 391 10 460 45 q 246 -25 322 -25 q 61 58 127 -25 q 0 258 0 136 l 0 738 l 125 738 l 125 284 q 156 148 125 202 q 273 82 197 82 q 433 165 369 82 q 493 340 493 243 l 493 738 l 617 738 l 617 0 "},k:{x_min:0,x_max:612.484375,ha:697,o:"m 612 738 l 338 465 l 608 0 l 469 0 l 251 382 l 121 251 l 121 0 l 0 0 l 0 1013 l 121 1013 l 121 402 l 456 738 l 612 738 "},\u0397:{x_min:0,x_max:803,ha:917,o:"m 803 0 l 667 0 l 667 475 l 140 475 l 140 0 l 0 0 l 0 1013 l 140 1013 l 140 599 l 667 599 l 667 1013 l 803 1013 l 803 0 "},\u0391:{x_min:0,x_max:906.953125,ha:985,o:"m 906 0 l 756 0 l 650 303 l 251 303 l 143 0 l 0 0 l 376 1013 l 529 1013 l 906 0 m 609 421 l 452 866 l 293 421 l 609 421 "},s:{x_min:0,x_max:604,ha:697,o:"m 604 217 q 501 36 604 104 q 292 -23 411 -23 q 86 43 166 -23 q 0 238 0 114 l 121 237 q 175 122 121 164 q 300 85 223 85 q 415 112 363 85 q 479 207 479 147 q 361 309 479 276 q 140 372 141 370 q 21 544 21 426 q 111 708 21 647 q 298 761 190 761 q 492 705 413 761 q 583 531 583 643 l 462 531 q 412 625 462 594 q 298 657 363 657 q 199 636 242 657 q 143 558 143 608 q 262 454 143 486 q 484 394 479 397 q 604 217 604 341 "},B:{x_min:0,x_max:778,ha:876,o:"m 580 546 q 724 469 670 535 q 778 311 778 403 q 673 83 778 171 q 432 0 575 0 l 0 0 l 0 1013 l 411 1013 q 629 957 541 1013 q 732 768 732 892 q 691 633 732 693 q 580 546 650 572 m 393 899 l 139 899 l 139 588 l 379 588 q 521 624 462 588 q 592 744 592 667 q 531 859 592 819 q 393 899 471 899 m 419 124 q 566 169 504 124 q 635 303 635 219 q 559 436 635 389 q 402 477 494 477 l 139 477 l 139 124 l 419 124 "},"\u2026":{x_min:0,x_max:614,ha:708,o:"m 142 0 l 0 0 l 0 151 l 142 151 l 142 0 m 378 0 l 236 0 l 236 151 l 378 151 l 378 0 m 614 0 l 472 0 l 472 151 l 614 151 l 614 0 "},"?":{x_min:0,x_max:607,ha:704,o:"m 607 777 q 543 599 607 674 q 422 474 482 537 q 357 272 357 391 l 236 272 q 297 487 236 395 q 411 619 298 490 q 474 762 474 691 q 422 885 474 838 q 301 933 371 933 q 179 880 228 933 q 124 706 124 819 l 0 706 q 94 963 0 872 q 302 1044 177 1044 q 511 973 423 1044 q 607 777 607 895 m 370 0 l 230 0 l 230 151 l 370 151 l 370 0 "},H:{x_min:0,x_max:803,ha:915,o:"m 803 0 l 667 0 l 667 475 l 140 475 l 140 0 l 0 0 l 0 1013 l 140 1013 l 140 599 l 667 599 l 667 1013 l 803 1013 l 803 0 "},\u03BD:{x_min:0,x_max:675,ha:761,o:"m 675 738 l 404 0 l 272 0 l 0 738 l 133 738 l 340 147 l 541 738 l 675 738 "},c:{x_min:1,x_max:701.390625,ha:775,o:"m 701 264 q 584 53 681 133 q 353 -26 487 -26 q 91 91 188 -26 q 1 370 1 201 q 92 645 1 537 q 353 761 190 761 q 572 688 479 761 q 690 493 666 615 l 556 493 q 487 606 545 562 q 356 650 428 650 q 186 563 246 650 q 134 372 134 487 q 188 179 134 258 q 359 88 250 88 q 492 136 437 88 q 566 264 548 185 l 701 264 "},"\xB6":{x_min:0,x_max:566.671875,ha:678,o:"m 21 892 l 52 892 l 98 761 l 145 892 l 176 892 l 178 741 l 157 741 l 157 867 l 108 741 l 88 741 l 40 871 l 40 741 l 21 741 l 21 892 m 308 854 l 308 731 q 252 691 308 691 q 227 691 240 691 q 207 696 213 695 l 207 712 l 253 706 q 288 733 288 706 l 288 763 q 244 741 279 741 q 193 797 193 741 q 261 860 193 860 q 287 860 273 860 q 308 854 302 855 m 288 842 l 263 843 q 213 796 213 843 q 248 756 213 756 q 288 796 288 756 l 288 842 m 566 988 l 502 988 l 502 -1 l 439 -1 l 439 988 l 317 988 l 317 -1 l 252 -1 l 252 602 q 81 653 155 602 q 0 805 0 711 q 101 989 0 918 q 309 1053 194 1053 l 566 1053 l 566 988 "},\u03B2:{x_min:0,x_max:660,ha:745,o:"m 471 550 q 610 450 561 522 q 660 280 660 378 q 578 64 660 151 q 367 -22 497 -22 q 239 5 299 -22 q 126 82 178 32 l 126 -278 l 0 -278 l 0 593 q 54 903 0 801 q 318 1042 127 1042 q 519 964 436 1042 q 603 771 603 887 q 567 644 603 701 q 471 550 532 586 m 337 79 q 476 138 418 79 q 535 279 535 198 q 427 437 535 386 q 226 477 344 477 l 226 583 q 398 620 329 583 q 486 762 486 668 q 435 884 486 833 q 312 935 384 935 q 169 861 219 935 q 126 698 126 797 l 126 362 q 170 169 126 242 q 337 79 224 79 "},\u039C:{x_min:0,x_max:954,ha:1068,o:"m 954 0 l 819 0 l 819 868 l 537 0 l 405 0 l 128 865 l 128 0 l 0 0 l 0 1013 l 199 1013 l 472 158 l 758 1013 l 954 1013 l 954 0 "},\u038C:{x_min:.109375,x_max:1120,ha:1217,o:"m 1120 505 q 994 132 1120 282 q 642 -29 861 -29 q 290 130 422 -29 q 167 505 167 280 q 294 883 167 730 q 650 1046 430 1046 q 999 882 868 1046 q 1120 505 1120 730 m 977 504 q 896 784 977 669 q 644 915 804 915 q 391 785 484 915 q 307 504 307 669 q 391 224 307 339 q 644 95 486 95 q 894 224 803 95 q 977 504 977 339 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},\u0389:{x_min:0,x_max:1158,ha:1275,o:"m 1158 0 l 1022 0 l 1022 475 l 496 475 l 496 0 l 356 0 l 356 1012 l 496 1012 l 496 599 l 1022 599 l 1022 1012 l 1158 1012 l 1158 0 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},"\u2022":{x_min:0,x_max:663.890625,ha:775,o:"m 663 529 q 566 293 663 391 q 331 196 469 196 q 97 294 194 196 q 0 529 0 393 q 96 763 0 665 q 331 861 193 861 q 566 763 469 861 q 663 529 663 665 "},"\xA5":{x_min:.1875,x_max:819.546875,ha:886,o:"m 563 561 l 697 561 l 696 487 l 520 487 l 482 416 l 482 380 l 697 380 l 695 308 l 482 308 l 482 0 l 342 0 l 342 308 l 125 308 l 125 380 l 342 380 l 342 417 l 303 487 l 125 487 l 125 561 l 258 561 l 0 1013 l 140 1013 l 411 533 l 679 1013 l 819 1013 l 563 561 "},"(":{x_min:0,x_max:318.0625,ha:415,o:"m 318 -290 l 230 -290 q 61 23 122 -142 q 0 365 0 190 q 62 712 0 540 q 230 1024 119 869 l 318 1024 q 175 705 219 853 q 125 360 125 542 q 176 22 125 187 q 318 -290 223 -127 "},U:{x_min:0,x_max:796,ha:904,o:"m 796 393 q 681 93 796 212 q 386 -25 566 -25 q 101 95 208 -25 q 0 393 0 211 l 0 1013 l 138 1013 l 138 391 q 204 191 138 270 q 394 107 276 107 q 586 191 512 107 q 656 391 656 270 l 656 1013 l 796 1013 l 796 393 "},\u03B3:{x_min:.5,x_max:744.953125,ha:822,o:"m 744 737 l 463 54 l 463 -278 l 338 -278 l 338 54 l 154 495 q 104 597 124 569 q 13 651 67 651 l 0 651 l 0 751 l 39 753 q 168 711 121 753 q 242 594 207 676 l 403 208 l 617 737 l 744 737 "},\u03B1:{x_min:0,x_max:765.5625,ha:809,o:"m 765 -4 q 698 -14 726 -14 q 564 97 586 -14 q 466 7 525 40 q 337 -26 407 -26 q 88 98 186 -26 q 0 369 0 212 q 88 637 0 525 q 337 760 184 760 q 465 728 407 760 q 563 637 524 696 l 563 739 l 685 739 l 685 222 q 693 141 685 168 q 748 94 708 94 q 765 96 760 94 l 765 -4 m 584 371 q 531 562 584 485 q 360 653 470 653 q 192 566 254 653 q 135 379 135 489 q 186 181 135 261 q 358 84 247 84 q 528 176 465 84 q 584 371 584 260 "},F:{x_min:0,x_max:683.328125,ha:717,o:"m 683 888 l 140 888 l 140 583 l 613 583 l 613 458 l 140 458 l 140 0 l 0 0 l 0 1013 l 683 1013 l 683 888 "},"\xAD":{x_min:0,x_max:705.5625,ha:803,o:"m 705 334 l 0 334 l 0 410 l 705 410 l 705 334 "},":":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 m 142 0 l 0 0 l 0 151 l 142 151 l 142 0 "},\u03A7:{x_min:0,x_max:854.171875,ha:935,o:"m 854 0 l 683 0 l 423 409 l 166 0 l 0 0 l 347 519 l 18 1013 l 186 1013 l 427 637 l 675 1013 l 836 1013 l 504 521 l 854 0 "},"*":{x_min:116,x_max:674,ha:792,o:"m 674 768 l 475 713 l 610 544 l 517 477 l 394 652 l 272 478 l 178 544 l 314 713 l 116 766 l 153 876 l 341 812 l 342 1013 l 446 1013 l 446 811 l 635 874 l 674 768 "},"\u2020":{x_min:0,x_max:777,ha:835,o:"m 458 804 l 777 804 l 777 683 l 458 683 l 458 0 l 319 0 l 319 681 l 0 683 l 0 804 l 319 804 l 319 1015 l 458 1013 l 458 804 "},"\xB0":{x_min:0,x_max:347,ha:444,o:"m 173 802 q 43 856 91 802 q 0 977 0 905 q 45 1101 0 1049 q 173 1153 90 1153 q 303 1098 255 1153 q 347 977 347 1049 q 303 856 347 905 q 173 802 256 802 m 173 884 q 238 910 214 884 q 262 973 262 937 q 239 1038 262 1012 q 173 1064 217 1064 q 108 1037 132 1064 q 85 973 85 1010 q 108 910 85 937 q 173 884 132 884 "},V:{x_min:0,x_max:862.71875,ha:940,o:"m 862 1013 l 505 0 l 361 0 l 0 1013 l 143 1013 l 434 165 l 718 1012 l 862 1013 "},\u039E:{x_min:0,x_max:734.71875,ha:763,o:"m 723 889 l 9 889 l 9 1013 l 723 1013 l 723 889 m 673 463 l 61 463 l 61 589 l 673 589 l 673 463 m 734 0 l 0 0 l 0 124 l 734 124 l 734 0 "},"\xA0":{x_min:0,x_max:0,ha:853},\u03AB:{x_min:.328125,x_max:819.515625,ha:889,o:"m 588 1046 l 460 1046 l 460 1189 l 588 1189 l 588 1046 m 360 1046 l 232 1046 l 232 1189 l 360 1189 l 360 1046 m 819 1012 l 482 416 l 482 0 l 342 0 l 342 416 l 0 1012 l 140 1012 l 411 533 l 679 1012 l 819 1012 "},"\u201D":{x_min:0,x_max:347,ha:454,o:"m 139 851 q 102 737 139 784 q 0 669 65 690 l 0 734 q 59 787 42 741 q 72 873 72 821 l 0 873 l 0 1013 l 139 1013 l 139 851 m 347 851 q 310 737 347 784 q 208 669 273 690 l 208 734 q 267 787 250 741 q 280 873 280 821 l 208 873 l 208 1013 l 347 1013 l 347 851 "},"@":{x_min:0,x_max:1260,ha:1357,o:"m 1098 -45 q 877 -160 1001 -117 q 633 -203 752 -203 q 155 -29 327 -203 q 0 360 0 127 q 176 802 0 616 q 687 1008 372 1008 q 1123 854 969 1008 q 1260 517 1260 718 q 1155 216 1260 341 q 868 82 1044 82 q 772 106 801 82 q 737 202 737 135 q 647 113 700 144 q 527 82 594 82 q 367 147 420 82 q 314 312 314 212 q 401 565 314 452 q 639 690 498 690 q 810 588 760 690 l 849 668 l 938 668 q 877 441 900 532 q 833 226 833 268 q 853 182 833 198 q 902 167 873 167 q 1088 272 1012 167 q 1159 512 1159 372 q 1051 793 1159 681 q 687 925 925 925 q 248 747 415 925 q 97 361 97 586 q 226 26 97 159 q 627 -122 370 -122 q 856 -87 737 -122 q 1061 8 976 -53 l 1098 -45 m 786 488 q 738 580 777 545 q 643 615 700 615 q 483 517 548 615 q 425 322 425 430 q 457 203 425 250 q 552 156 490 156 q 722 273 665 156 q 786 488 738 309 "},\u038A:{x_min:0,x_max:499,ha:613,o:"m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 m 499 0 l 360 0 l 360 1012 l 499 1012 l 499 0 "},i:{x_min:14,x_max:136,ha:275,o:"m 136 873 l 14 873 l 14 1013 l 136 1013 l 136 873 m 136 0 l 14 0 l 14 737 l 136 737 l 136 0 "},\u0392:{x_min:0,x_max:778,ha:877,o:"m 580 545 q 724 468 671 534 q 778 310 778 402 q 673 83 778 170 q 432 0 575 0 l 0 0 l 0 1013 l 411 1013 q 629 957 541 1013 q 732 768 732 891 q 691 632 732 692 q 580 545 650 571 m 393 899 l 139 899 l 139 587 l 379 587 q 521 623 462 587 q 592 744 592 666 q 531 859 592 819 q 393 899 471 899 m 419 124 q 566 169 504 124 q 635 302 635 219 q 559 435 635 388 q 402 476 494 476 l 139 476 l 139 124 l 419 124 "},\u03C5:{x_min:0,x_max:617,ha:725,o:"m 617 352 q 540 94 617 199 q 308 -24 455 -24 q 76 94 161 -24 q 0 352 0 199 l 0 739 l 126 739 l 126 355 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 355 492 257 l 492 739 l 617 739 l 617 352 "},"]":{x_min:0,x_max:275,ha:372,o:"m 275 -281 l 0 -281 l 0 -187 l 151 -187 l 151 920 l 0 920 l 0 1013 l 275 1013 l 275 -281 "},m:{x_min:0,x_max:1019,ha:1128,o:"m 1019 0 l 897 0 l 897 454 q 860 591 897 536 q 739 660 816 660 q 613 586 659 660 q 573 436 573 522 l 573 0 l 447 0 l 447 455 q 412 591 447 535 q 294 657 372 657 q 165 586 213 657 q 122 437 122 521 l 122 0 l 0 0 l 0 738 l 117 738 l 117 640 q 202 730 150 697 q 316 763 254 763 q 437 730 381 763 q 525 642 494 697 q 621 731 559 700 q 753 763 682 763 q 943 694 867 763 q 1019 512 1019 625 l 1019 0 "},\u03C7:{x_min:8.328125,x_max:780.5625,ha:815,o:"m 780 -278 q 715 -294 747 -294 q 616 -257 663 -294 q 548 -175 576 -227 l 379 133 l 143 -277 l 9 -277 l 313 254 l 163 522 q 127 586 131 580 q 36 640 91 640 q 8 637 27 640 l 8 752 l 52 757 q 162 719 113 757 q 236 627 200 690 l 383 372 l 594 737 l 726 737 l 448 250 l 625 -69 q 670 -153 647 -110 q 743 -188 695 -188 q 780 -184 759 -188 l 780 -278 "},\u03AF:{x_min:42,x_max:326.71875,ha:361,o:"m 284 3 q 233 -10 258 -5 q 182 -15 207 -15 q 85 26 119 -15 q 42 200 42 79 l 42 737 l 167 737 l 168 215 q 172 141 168 157 q 226 101 183 101 q 248 102 239 101 q 284 112 257 104 l 284 3 m 326 1040 l 137 819 l 54 819 l 189 1040 l 326 1040 "},\u0396:{x_min:0,x_max:779.171875,ha:850,o:"m 779 0 l 0 0 l 0 113 l 620 896 l 40 896 l 40 1013 l 779 1013 l 779 887 l 170 124 l 779 124 l 779 0 "},R:{x_min:0,x_max:781.953125,ha:907,o:"m 781 0 l 623 0 q 587 242 590 52 q 407 433 585 433 l 138 433 l 138 0 l 0 0 l 0 1013 l 396 1013 q 636 946 539 1013 q 749 731 749 868 q 711 597 749 659 q 608 502 674 534 q 718 370 696 474 q 729 207 722 352 q 781 26 736 62 l 781 0 m 373 551 q 533 594 465 551 q 614 731 614 645 q 532 859 614 815 q 373 896 465 896 l 138 896 l 138 551 l 373 551 "},o:{x_min:0,x_max:713,ha:821,o:"m 357 -25 q 94 91 194 -25 q 0 368 0 202 q 93 642 0 533 q 357 761 193 761 q 618 644 518 761 q 713 368 713 533 q 619 91 713 201 q 357 -25 521 -25 m 357 85 q 528 175 465 85 q 584 369 584 255 q 529 562 584 484 q 357 651 467 651 q 189 560 250 651 q 135 369 135 481 q 187 177 135 257 q 357 85 250 85 "},K:{x_min:0,x_max:819.46875,ha:906,o:"m 819 0 l 649 0 l 294 509 l 139 355 l 139 0 l 0 0 l 0 1013 l 139 1013 l 139 526 l 626 1013 l 809 1013 l 395 600 l 819 0 "},",":{x_min:0,x_max:142,ha:239,o:"m 142 -12 q 105 -132 142 -82 q 0 -205 68 -182 l 0 -138 q 57 -82 40 -124 q 70 0 70 -51 l 0 0 l 0 151 l 142 151 l 142 -12 "},d:{x_min:0,x_max:683,ha:796,o:"m 683 0 l 564 0 l 564 93 q 456 6 516 38 q 327 -25 395 -25 q 87 100 181 -25 q 0 365 0 215 q 90 639 0 525 q 343 763 187 763 q 564 647 486 763 l 564 1013 l 683 1013 l 683 0 m 582 373 q 529 562 582 484 q 361 653 468 653 q 190 561 253 653 q 135 365 135 479 q 189 175 135 254 q 358 85 251 85 q 529 178 468 85 q 582 373 582 258 "},"\xA8":{x_min:-109,x_max:247,ha:232,o:"m 247 1046 l 119 1046 l 119 1189 l 247 1189 l 247 1046 m 19 1046 l -109 1046 l -109 1189 l 19 1189 l 19 1046 "},E:{x_min:0,x_max:736.109375,ha:789,o:"m 736 0 l 0 0 l 0 1013 l 725 1013 l 725 889 l 139 889 l 139 585 l 677 585 l 677 467 l 139 467 l 139 125 l 736 125 l 736 0 "},Y:{x_min:0,x_max:820,ha:886,o:"m 820 1013 l 482 416 l 482 0 l 342 0 l 342 416 l 0 1013 l 140 1013 l 411 534 l 679 1012 l 820 1013 "},'"':{x_min:0,x_max:299,ha:396,o:"m 299 606 l 203 606 l 203 988 l 299 988 l 299 606 m 96 606 l 0 606 l 0 988 l 96 988 l 96 606 "},"\u2039":{x_min:17.984375,x_max:773.609375,ha:792,o:"m 773 40 l 18 376 l 17 465 l 773 799 l 773 692 l 159 420 l 773 149 l 773 40 "},"\u201E":{x_min:0,x_max:364,ha:467,o:"m 141 -12 q 104 -132 141 -82 q 0 -205 67 -182 l 0 -138 q 56 -82 40 -124 q 69 0 69 -51 l 0 0 l 0 151 l 141 151 l 141 -12 m 364 -12 q 327 -132 364 -82 q 222 -205 290 -182 l 222 -138 q 279 -82 262 -124 q 292 0 292 -51 l 222 0 l 222 151 l 364 151 l 364 -12 "},\u03B4:{x_min:1,x_max:710,ha:810,o:"m 710 360 q 616 87 710 196 q 356 -28 518 -28 q 99 82 197 -28 q 1 356 1 192 q 100 606 1 509 q 355 703 199 703 q 180 829 288 754 q 70 903 124 866 l 70 1012 l 643 1012 l 643 901 l 258 901 q 462 763 422 794 q 636 592 577 677 q 710 360 710 485 m 584 365 q 552 501 584 447 q 451 602 521 555 q 372 611 411 611 q 197 541 258 611 q 136 355 136 472 q 190 171 136 245 q 358 85 252 85 q 528 173 465 85 q 584 365 584 252 "},\u03AD:{x_min:0,x_max:634.71875,ha:714,o:"m 634 234 q 527 38 634 110 q 300 -25 433 -25 q 98 29 183 -25 q 0 204 0 93 q 37 313 0 265 q 128 390 67 352 q 56 459 82 419 q 26 555 26 505 q 114 712 26 654 q 295 763 191 763 q 499 700 416 763 q 589 515 589 631 l 478 515 q 419 618 464 580 q 307 657 374 657 q 207 630 253 657 q 151 547 151 598 q 238 445 151 469 q 389 434 280 434 l 389 331 l 349 331 q 206 315 255 331 q 125 210 125 287 q 183 107 125 145 q 302 76 233 76 q 436 117 379 76 q 509 234 493 159 l 634 234 m 520 1040 l 331 819 l 248 819 l 383 1040 l 520 1040 "},\u03C9:{x_min:0,x_max:922,ha:1031,o:"m 922 339 q 856 97 922 203 q 650 -26 780 -26 q 538 9 587 -26 q 461 103 489 44 q 387 12 436 46 q 277 -22 339 -22 q 69 97 147 -22 q 0 339 0 203 q 45 551 0 444 q 161 738 84 643 l 302 738 q 175 553 219 647 q 124 336 124 446 q 155 179 124 249 q 275 88 197 88 q 375 163 341 88 q 400 294 400 219 l 400 572 l 524 572 l 524 294 q 561 135 524 192 q 643 88 591 88 q 762 182 719 88 q 797 342 797 257 q 745 556 797 450 q 619 738 705 638 l 760 738 q 874 551 835 640 q 922 339 922 444 "},"\xB4":{x_min:0,x_max:96,ha:251,o:"m 96 606 l 0 606 l 0 988 l 96 988 l 96 606 "},"\xB1":{x_min:11,x_max:781,ha:792,o:"m 781 490 l 446 490 l 446 255 l 349 255 l 349 490 l 11 490 l 11 586 l 349 586 l 349 819 l 446 819 l 446 586 l 781 586 l 781 490 m 781 21 l 11 21 l 11 115 l 781 115 l 781 21 "},"|":{x_min:343,x_max:449,ha:792,o:"m 449 462 l 343 462 l 343 986 l 449 986 l 449 462 m 449 -242 l 343 -242 l 343 280 l 449 280 l 449 -242 "},\u03CB:{x_min:0,x_max:617,ha:725,o:"m 482 800 l 372 800 l 372 925 l 482 925 l 482 800 m 239 800 l 129 800 l 129 925 l 239 925 l 239 800 m 617 352 q 540 93 617 199 q 308 -24 455 -24 q 76 93 161 -24 q 0 352 0 199 l 0 738 l 126 738 l 126 354 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 354 492 257 l 492 738 l 617 738 l 617 352 "},"\xA7":{x_min:0,x_max:593,ha:690,o:"m 593 425 q 554 312 593 369 q 467 233 516 254 q 537 83 537 172 q 459 -74 537 -12 q 288 -133 387 -133 q 115 -69 184 -133 q 47 96 47 -6 l 166 96 q 199 7 166 40 q 288 -26 232 -26 q 371 -5 332 -26 q 420 60 420 21 q 311 201 420 139 q 108 309 210 255 q 0 490 0 383 q 33 602 0 551 q 124 687 66 654 q 75 743 93 712 q 58 812 58 773 q 133 984 58 920 q 300 1043 201 1043 q 458 987 394 1043 q 529 814 529 925 l 411 814 q 370 908 404 877 q 289 939 336 939 q 213 911 246 939 q 180 841 180 883 q 286 720 180 779 q 484 612 480 615 q 593 425 593 534 m 467 409 q 355 544 467 473 q 196 630 228 612 q 146 587 162 609 q 124 525 124 558 q 239 387 124 462 q 398 298 369 315 q 448 345 429 316 q 467 409 467 375 "},b:{x_min:0,x_max:685,ha:783,o:"m 685 372 q 597 99 685 213 q 347 -25 501 -25 q 219 5 277 -25 q 121 93 161 36 l 121 0 l 0 0 l 0 1013 l 121 1013 l 121 634 q 214 723 157 692 q 341 754 272 754 q 591 637 493 754 q 685 372 685 526 m 554 356 q 499 550 554 470 q 328 644 437 644 q 162 556 223 644 q 108 369 108 478 q 160 176 108 256 q 330 83 221 83 q 498 169 435 83 q 554 356 554 245 "},q:{x_min:0,x_max:683,ha:876,o:"m 683 -278 l 564 -278 l 564 97 q 474 8 533 39 q 345 -23 415 -23 q 91 93 188 -23 q 0 364 0 203 q 87 635 0 522 q 337 760 184 760 q 466 727 408 760 q 564 637 523 695 l 564 737 l 683 737 l 683 -278 m 582 375 q 527 564 582 488 q 358 652 466 652 q 190 565 253 652 q 135 377 135 488 q 189 179 135 261 q 361 84 251 84 q 530 179 469 84 q 582 375 582 260 "},\u03A9:{x_min:-.171875,x_max:969.5625,ha:1068,o:"m 969 0 l 555 0 l 555 123 q 744 308 675 194 q 814 558 814 423 q 726 812 814 709 q 484 922 633 922 q 244 820 334 922 q 154 567 154 719 q 223 316 154 433 q 412 123 292 199 l 412 0 l 0 0 l 0 124 l 217 124 q 68 327 122 210 q 15 572 15 444 q 144 911 15 781 q 484 1041 274 1041 q 822 909 691 1041 q 953 569 953 777 q 899 326 953 443 q 750 124 846 210 l 969 124 l 969 0 "},\u03CD:{x_min:0,x_max:617,ha:725,o:"m 617 352 q 540 93 617 199 q 308 -24 455 -24 q 76 93 161 -24 q 0 352 0 199 l 0 738 l 126 738 l 126 354 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 354 492 257 l 492 738 l 617 738 l 617 352 m 535 1040 l 346 819 l 262 819 l 397 1040 l 535 1040 "},z:{x_min:-.015625,x_max:613.890625,ha:697,o:"m 613 0 l 0 0 l 0 100 l 433 630 l 20 630 l 20 738 l 594 738 l 593 636 l 163 110 l 613 110 l 613 0 "},"\u2122":{x_min:0,x_max:894,ha:1e3,o:"m 389 951 l 229 951 l 229 503 l 160 503 l 160 951 l 0 951 l 0 1011 l 389 1011 l 389 951 m 894 503 l 827 503 l 827 939 l 685 503 l 620 503 l 481 937 l 481 503 l 417 503 l 417 1011 l 517 1011 l 653 580 l 796 1010 l 894 1011 l 894 503 "},\u03AE:{x_min:.78125,x_max:697,ha:810,o:"m 697 -278 l 572 -278 l 572 454 q 540 587 572 536 q 425 650 501 650 q 271 579 337 650 q 206 420 206 509 l 206 0 l 81 0 l 81 489 q 73 588 81 562 q 0 644 56 644 l 0 741 q 68 755 38 755 q 158 721 124 755 q 200 630 193 687 q 297 726 234 692 q 434 761 359 761 q 620 692 544 761 q 697 516 697 624 l 697 -278 m 479 1040 l 290 819 l 207 819 l 341 1040 l 479 1040 "},\u0398:{x_min:0,x_max:960,ha:1056,o:"m 960 507 q 833 129 960 280 q 476 -32 698 -32 q 123 129 255 -32 q 0 507 0 280 q 123 883 0 732 q 476 1045 255 1045 q 832 883 696 1045 q 960 507 960 732 m 817 500 q 733 789 817 669 q 476 924 639 924 q 223 792 317 924 q 142 507 142 675 q 222 222 142 339 q 476 89 315 89 q 730 218 636 89 q 817 500 817 334 m 716 449 l 243 449 l 243 571 l 716 571 l 716 449 "},"\xAE":{x_min:-3,x_max:1008,ha:1106,o:"m 503 532 q 614 562 566 532 q 672 658 672 598 q 614 747 672 716 q 503 772 569 772 l 338 772 l 338 532 l 503 532 m 502 -7 q 123 151 263 -7 q -3 501 -3 294 q 123 851 -3 706 q 502 1011 263 1011 q 881 851 739 1011 q 1008 501 1008 708 q 883 151 1008 292 q 502 -7 744 -7 m 502 60 q 830 197 709 60 q 940 501 940 322 q 831 805 940 681 q 502 944 709 944 q 174 805 296 944 q 65 501 65 680 q 173 197 65 320 q 502 60 294 60 m 788 146 l 678 146 q 653 316 655 183 q 527 449 652 449 l 338 449 l 338 146 l 241 146 l 241 854 l 518 854 q 688 808 621 854 q 766 658 766 755 q 739 563 766 607 q 668 497 713 519 q 751 331 747 472 q 788 164 756 190 l 788 146 "},"~":{x_min:0,x_max:833,ha:931,o:"m 833 958 q 778 753 833 831 q 594 665 716 665 q 402 761 502 665 q 240 857 302 857 q 131 795 166 857 q 104 665 104 745 l 0 665 q 54 867 0 789 q 237 958 116 958 q 429 861 331 958 q 594 765 527 765 q 704 827 670 765 q 729 958 729 874 l 833 958 "},\u0395:{x_min:0,x_max:736.21875,ha:778,o:"m 736 0 l 0 0 l 0 1013 l 725 1013 l 725 889 l 139 889 l 139 585 l 677 585 l 677 467 l 139 467 l 139 125 l 736 125 l 736 0 "},"\xB3":{x_min:0,x_max:450,ha:547,o:"m 450 552 q 379 413 450 464 q 220 366 313 366 q 69 414 130 366 q 0 567 0 470 l 85 567 q 126 470 85 504 q 225 437 168 437 q 320 467 280 437 q 360 552 360 498 q 318 632 360 608 q 213 657 276 657 q 195 657 203 657 q 176 657 181 657 l 176 722 q 279 733 249 722 q 334 815 334 752 q 300 881 334 856 q 220 907 267 907 q 133 875 169 907 q 97 781 97 844 l 15 781 q 78 926 15 875 q 220 972 135 972 q 364 930 303 972 q 426 817 426 888 q 344 697 426 733 q 421 642 392 681 q 450 552 450 603 "},"[":{x_min:0,x_max:273.609375,ha:371,o:"m 273 -281 l 0 -281 l 0 1013 l 273 1013 l 273 920 l 124 920 l 124 -187 l 273 -187 l 273 -281 "},L:{x_min:0,x_max:645.828125,ha:696,o:"m 645 0 l 0 0 l 0 1013 l 140 1013 l 140 126 l 645 126 l 645 0 "},\u03C3:{x_min:0,x_max:803.390625,ha:894,o:"m 803 628 l 633 628 q 713 368 713 512 q 618 93 713 204 q 357 -25 518 -25 q 94 91 194 -25 q 0 368 0 201 q 94 644 0 533 q 356 761 194 761 q 481 750 398 761 q 608 739 564 739 l 803 739 l 803 628 m 360 85 q 529 180 467 85 q 584 374 584 262 q 527 566 584 490 q 352 651 463 651 q 187 559 247 651 q 135 368 135 478 q 189 175 135 254 q 360 85 251 85 "},\u03B6:{x_min:0,x_max:573,ha:642,o:"m 573 -40 q 553 -162 573 -97 q 510 -278 543 -193 l 400 -278 q 441 -187 428 -219 q 462 -90 462 -132 q 378 -14 462 -14 q 108 45 197 -14 q 0 290 0 117 q 108 631 0 462 q 353 901 194 767 l 55 901 l 55 1012 l 561 1012 l 561 924 q 261 669 382 831 q 128 301 128 489 q 243 117 128 149 q 458 98 350 108 q 573 -40 573 80 "},\u03B8:{x_min:0,x_max:674,ha:778,o:"m 674 496 q 601 160 674 304 q 336 -26 508 -26 q 73 153 165 -26 q 0 485 0 296 q 72 840 0 683 q 343 1045 166 1045 q 605 844 516 1045 q 674 496 674 692 m 546 579 q 498 798 546 691 q 336 935 437 935 q 178 798 237 935 q 126 579 137 701 l 546 579 m 546 475 l 126 475 q 170 233 126 348 q 338 80 230 80 q 504 233 447 80 q 546 475 546 346 "},\u039F:{x_min:0,x_max:958,ha:1054,o:"m 485 1042 q 834 883 703 1042 q 958 511 958 735 q 834 136 958 287 q 481 -26 701 -26 q 126 130 261 -26 q 0 504 0 279 q 127 880 0 729 q 485 1042 263 1042 m 480 98 q 731 225 638 98 q 815 504 815 340 q 733 783 815 670 q 480 913 640 913 q 226 785 321 913 q 142 504 142 671 q 226 224 142 339 q 480 98 319 98 "},\u0393:{x_min:0,x_max:705.28125,ha:749,o:"m 705 886 l 140 886 l 140 0 l 0 0 l 0 1012 l 705 1012 l 705 886 "}," ":{x_min:0,x_max:0,ha:375},"%":{x_min:-3,x_max:1089,ha:1186,o:"m 845 0 q 663 76 731 0 q 602 244 602 145 q 661 412 602 344 q 845 489 728 489 q 1027 412 959 489 q 1089 244 1089 343 q 1029 76 1089 144 q 845 0 962 0 m 844 103 q 945 143 909 103 q 981 243 981 184 q 947 340 981 301 q 844 385 909 385 q 744 342 781 385 q 708 243 708 300 q 741 147 708 186 q 844 103 780 103 m 888 986 l 284 -25 l 199 -25 l 803 986 l 888 986 m 241 468 q 58 545 126 468 q -3 715 -3 615 q 56 881 -3 813 q 238 958 124 958 q 421 881 353 958 q 483 712 483 813 q 423 544 483 612 q 241 468 356 468 m 241 855 q 137 811 175 855 q 100 710 100 768 q 136 612 100 653 q 240 572 172 572 q 344 614 306 572 q 382 713 382 656 q 347 810 382 771 q 241 855 308 855 "},P:{x_min:0,x_max:726,ha:806,o:"m 424 1013 q 640 931 555 1013 q 726 719 726 850 q 637 506 726 587 q 413 426 548 426 l 140 426 l 140 0 l 0 0 l 0 1013 l 424 1013 m 379 889 l 140 889 l 140 548 l 372 548 q 522 589 459 548 q 593 720 593 637 q 528 845 593 801 q 379 889 463 889 "},\u0388:{x_min:0,x_max:1078.21875,ha:1118,o:"m 1078 0 l 342 0 l 342 1013 l 1067 1013 l 1067 889 l 481 889 l 481 585 l 1019 585 l 1019 467 l 481 467 l 481 125 l 1078 125 l 1078 0 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},\u038F:{x_min:.125,x_max:1136.546875,ha:1235,o:"m 1136 0 l 722 0 l 722 123 q 911 309 842 194 q 981 558 981 423 q 893 813 981 710 q 651 923 800 923 q 411 821 501 923 q 321 568 321 720 q 390 316 321 433 q 579 123 459 200 l 579 0 l 166 0 l 166 124 l 384 124 q 235 327 289 210 q 182 572 182 444 q 311 912 182 782 q 651 1042 441 1042 q 989 910 858 1042 q 1120 569 1120 778 q 1066 326 1120 443 q 917 124 1013 210 l 1136 124 l 1136 0 m 277 1040 l 83 800 l 0 800 l 140 1041 l 277 1040 "},_:{x_min:0,x_max:705.5625,ha:803,o:"m 705 -334 l 0 -334 l 0 -234 l 705 -234 l 705 -334 "},\u03AA:{x_min:-110,x_max:246,ha:275,o:"m 246 1046 l 118 1046 l 118 1189 l 246 1189 l 246 1046 m 18 1046 l -110 1046 l -110 1189 l 18 1189 l 18 1046 m 136 0 l 0 0 l 0 1012 l 136 1012 l 136 0 "},"+":{x_min:23,x_max:768,ha:792,o:"m 768 372 l 444 372 l 444 0 l 347 0 l 347 372 l 23 372 l 23 468 l 347 468 l 347 840 l 444 840 l 444 468 l 768 468 l 768 372 "},"\xBD":{x_min:0,x_max:1050,ha:1149,o:"m 1050 0 l 625 0 q 712 178 625 108 q 878 277 722 187 q 967 385 967 328 q 932 456 967 429 q 850 484 897 484 q 759 450 798 484 q 721 352 721 416 l 640 352 q 706 502 640 448 q 851 551 766 551 q 987 509 931 551 q 1050 385 1050 462 q 976 251 1050 301 q 829 179 902 215 q 717 68 740 133 l 1050 68 l 1050 0 m 834 985 l 215 -28 l 130 -28 l 750 984 l 834 985 m 224 422 l 142 422 l 142 811 l 0 811 l 0 867 q 104 889 62 867 q 164 973 157 916 l 224 973 l 224 422 "},\u03A1:{x_min:0,x_max:720,ha:783,o:"m 424 1013 q 637 933 554 1013 q 720 723 720 853 q 633 508 720 591 q 413 426 546 426 l 140 426 l 140 0 l 0 0 l 0 1013 l 424 1013 m 378 889 l 140 889 l 140 548 l 371 548 q 521 589 458 548 q 592 720 592 637 q 527 845 592 801 q 378 889 463 889 "},"'":{x_min:0,x_max:139,ha:236,o:"m 139 851 q 102 737 139 784 q 0 669 65 690 l 0 734 q 59 787 42 741 q 72 873 72 821 l 0 873 l 0 1013 l 139 1013 l 139 851 "},\u00AA:{x_min:0,x_max:350,ha:397,o:"m 350 625 q 307 616 328 616 q 266 631 281 616 q 247 673 251 645 q 190 628 225 644 q 116 613 156 613 q 32 641 64 613 q 0 722 0 669 q 72 826 0 800 q 247 866 159 846 l 247 887 q 220 934 247 916 q 162 953 194 953 q 104 934 129 953 q 76 882 80 915 l 16 882 q 60 976 16 941 q 166 1011 104 1011 q 266 979 224 1011 q 308 891 308 948 l 308 706 q 311 679 308 688 q 331 670 315 670 l 350 672 l 350 625 m 247 757 l 247 811 q 136 790 175 798 q 64 726 64 773 q 83 682 64 697 q 132 667 103 667 q 207 690 174 667 q 247 757 247 718 "},"\u0385":{x_min:0,x_max:450,ha:553,o:"m 450 800 l 340 800 l 340 925 l 450 925 l 450 800 m 406 1040 l 212 800 l 129 800 l 269 1040 l 406 1040 m 110 800 l 0 800 l 0 925 l 110 925 l 110 800 "},T:{x_min:0,x_max:777,ha:835,o:"m 777 894 l 458 894 l 458 0 l 319 0 l 319 894 l 0 894 l 0 1013 l 777 1013 l 777 894 "},\u03A6:{x_min:0,x_max:915,ha:997,o:"m 527 0 l 389 0 l 389 122 q 110 231 220 122 q 0 509 0 340 q 110 785 0 677 q 389 893 220 893 l 389 1013 l 527 1013 l 527 893 q 804 786 693 893 q 915 509 915 679 q 805 231 915 341 q 527 122 696 122 l 527 0 m 527 226 q 712 310 641 226 q 779 507 779 389 q 712 705 779 627 q 527 787 641 787 l 527 226 m 389 226 l 389 787 q 205 698 275 775 q 136 505 136 620 q 206 308 136 391 q 389 226 276 226 "},"\u204B":{x_min:0,x_max:0,ha:694},j:{x_min:-77.78125,x_max:167,ha:349,o:"m 167 871 l 42 871 l 42 1013 l 167 1013 l 167 871 m 167 -80 q 121 -231 167 -184 q -26 -278 76 -278 l -77 -278 l -77 -164 l -41 -164 q 26 -143 11 -164 q 42 -65 42 -122 l 42 737 l 167 737 l 167 -80 "},\u03A3:{x_min:0,x_max:756.953125,ha:819,o:"m 756 0 l 0 0 l 0 107 l 395 523 l 22 904 l 22 1013 l 745 1013 l 745 889 l 209 889 l 566 523 l 187 125 l 756 125 l 756 0 "},"\u203A":{x_min:18.0625,x_max:774,ha:792,o:"m 774 376 l 18 40 l 18 149 l 631 421 l 18 692 l 18 799 l 774 465 l 774 376 "},"<":{x_min:17.984375,x_max:773.609375,ha:792,o:"m 773 40 l 18 376 l 17 465 l 773 799 l 773 692 l 159 420 l 773 149 l 773 40 "},"\xA3":{x_min:0,x_max:704.484375,ha:801,o:"m 704 41 q 623 -10 664 5 q 543 -26 583 -26 q 359 15 501 -26 q 243 36 288 36 q 158 23 197 36 q 73 -21 119 10 l 6 76 q 125 195 90 150 q 175 331 175 262 q 147 443 175 383 l 0 443 l 0 512 l 108 512 q 43 734 43 623 q 120 929 43 854 q 358 1010 204 1010 q 579 936 487 1010 q 678 729 678 857 l 678 684 l 552 684 q 504 838 552 780 q 362 896 457 896 q 216 852 263 896 q 176 747 176 815 q 199 627 176 697 q 248 512 217 574 l 468 512 l 468 443 l 279 443 q 297 356 297 398 q 230 194 297 279 q 153 107 211 170 q 227 133 190 125 q 293 142 264 142 q 410 119 339 142 q 516 96 482 96 q 579 105 550 96 q 648 142 608 115 l 704 41 "},t:{x_min:0,x_max:367,ha:458,o:"m 367 0 q 312 -5 339 -2 q 262 -8 284 -8 q 145 28 183 -8 q 108 143 108 64 l 108 638 l 0 638 l 0 738 l 108 738 l 108 944 l 232 944 l 232 738 l 367 738 l 367 638 l 232 638 l 232 185 q 248 121 232 140 q 307 102 264 102 q 345 104 330 102 q 367 107 360 107 l 367 0 "},"\xAC":{x_min:0,x_max:706,ha:803,o:"m 706 411 l 706 158 l 630 158 l 630 335 l 0 335 l 0 411 l 706 411 "},\u03BB:{x_min:0,x_max:750,ha:803,o:"m 750 -7 q 679 -15 716 -15 q 538 59 591 -15 q 466 214 512 97 l 336 551 l 126 0 l 0 0 l 270 705 q 223 837 247 770 q 116 899 190 899 q 90 898 100 899 l 90 1004 q 152 1011 125 1011 q 298 938 244 1011 q 373 783 326 901 l 605 192 q 649 115 629 136 q 716 95 669 95 l 736 95 q 750 97 745 97 l 750 -7 "},W:{x_min:0,x_max:1263.890625,ha:1351,o:"m 1263 1013 l 995 0 l 859 0 l 627 837 l 405 0 l 265 0 l 0 1013 l 136 1013 l 342 202 l 556 1013 l 701 1013 l 921 207 l 1133 1012 l 1263 1013 "},">":{x_min:18.0625,x_max:774,ha:792,o:"m 774 376 l 18 40 l 18 149 l 631 421 l 18 692 l 18 799 l 774 465 l 774 376 "},v:{x_min:0,x_max:675.15625,ha:761,o:"m 675 738 l 404 0 l 272 0 l 0 738 l 133 737 l 340 147 l 541 737 l 675 738 "},\u03C4:{x_min:.28125,x_max:644.5,ha:703,o:"m 644 628 l 382 628 l 382 179 q 388 120 382 137 q 436 91 401 91 q 474 94 447 91 q 504 97 501 97 l 504 0 q 454 -9 482 -5 q 401 -14 426 -14 q 278 67 308 -14 q 260 233 260 118 l 260 628 l 0 628 l 0 739 l 644 739 l 644 628 "},\u03BE:{x_min:0,x_max:624.9375,ha:699,o:"m 624 -37 q 608 -153 624 -96 q 563 -278 593 -211 l 454 -278 q 491 -183 486 -200 q 511 -83 511 -126 q 484 -23 511 -44 q 370 1 452 1 q 323 0 354 1 q 283 -1 293 -1 q 84 76 169 -1 q 0 266 0 154 q 56 431 0 358 q 197 538 108 498 q 94 613 134 562 q 54 730 54 665 q 77 823 54 780 q 143 901 101 867 l 27 901 l 27 1012 l 576 1012 l 576 901 l 380 901 q 244 863 303 901 q 178 745 178 820 q 312 600 178 636 q 532 582 380 582 l 532 479 q 276 455 361 479 q 118 281 118 410 q 165 173 118 217 q 274 120 208 133 q 494 101 384 110 q 624 -37 624 76 "},"&":{x_min:-3,x_max:894.25,ha:992,o:"m 894 0 l 725 0 l 624 123 q 471 0 553 40 q 306 -41 390 -41 q 168 -7 231 -41 q 62 92 105 26 q 14 187 31 139 q -3 276 -3 235 q 55 433 -3 358 q 248 581 114 508 q 170 689 196 640 q 137 817 137 751 q 214 985 137 922 q 384 1041 284 1041 q 548 988 483 1041 q 622 824 622 928 q 563 666 622 739 q 431 556 516 608 l 621 326 q 649 407 639 361 q 663 493 653 426 l 781 493 q 703 229 781 352 l 894 0 m 504 818 q 468 908 504 877 q 384 940 433 940 q 293 907 331 940 q 255 818 255 875 q 289 714 255 767 q 363 628 313 678 q 477 729 446 682 q 504 818 504 771 m 556 209 l 314 499 q 179 395 223 449 q 135 283 135 341 q 146 222 135 253 q 183 158 158 192 q 333 80 241 80 q 556 209 448 80 "},\u039B:{x_min:0,x_max:862.5,ha:942,o:"m 862 0 l 719 0 l 426 847 l 143 0 l 0 0 l 356 1013 l 501 1013 l 862 0 "},I:{x_min:41,x_max:180,ha:293,o:"m 180 0 l 41 0 l 41 1013 l 180 1013 l 180 0 "},G:{x_min:0,x_max:921,ha:1011,o:"m 921 0 l 832 0 l 801 136 q 655 15 741 58 q 470 -28 568 -28 q 126 133 259 -28 q 0 499 0 284 q 125 881 0 731 q 486 1043 259 1043 q 763 957 647 1043 q 905 709 890 864 l 772 709 q 668 866 747 807 q 486 926 589 926 q 228 795 322 926 q 142 507 142 677 q 228 224 142 342 q 483 94 323 94 q 712 195 625 94 q 796 435 796 291 l 477 435 l 477 549 l 921 549 l 921 0 "},\u03B0:{x_min:0,x_max:617,ha:725,o:"m 524 800 l 414 800 l 414 925 l 524 925 l 524 800 m 183 800 l 73 800 l 73 925 l 183 925 l 183 800 m 617 352 q 540 93 617 199 q 308 -24 455 -24 q 76 93 161 -24 q 0 352 0 199 l 0 738 l 126 738 l 126 354 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 354 492 257 l 492 738 l 617 738 l 617 352 m 489 1040 l 300 819 l 216 819 l 351 1040 l 489 1040 "},"`":{x_min:0,x_max:138.890625,ha:236,o:"m 138 699 l 0 699 l 0 861 q 36 974 0 929 q 138 1041 72 1020 l 138 977 q 82 931 95 969 q 69 839 69 893 l 138 839 l 138 699 "},"\xB7":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 "},\u03A5:{x_min:.328125,x_max:819.515625,ha:889,o:"m 819 1013 l 482 416 l 482 0 l 342 0 l 342 416 l 0 1013 l 140 1013 l 411 533 l 679 1013 l 819 1013 "},r:{x_min:0,x_max:355.5625,ha:432,o:"m 355 621 l 343 621 q 179 569 236 621 q 122 411 122 518 l 122 0 l 0 0 l 0 737 l 117 737 l 117 604 q 204 719 146 686 q 355 753 262 753 l 355 621 "},x:{x_min:0,x_max:675,ha:764,o:"m 675 0 l 525 0 l 331 286 l 144 0 l 0 0 l 256 379 l 12 738 l 157 737 l 336 473 l 516 738 l 661 738 l 412 380 l 675 0 "},\u03BC:{x_min:0,x_max:696.609375,ha:747,o:"m 696 -4 q 628 -14 657 -14 q 498 97 513 -14 q 422 8 470 41 q 313 -24 374 -24 q 207 3 258 -24 q 120 80 157 31 l 120 -278 l 0 -278 l 0 738 l 124 738 l 124 343 q 165 172 124 246 q 308 82 216 82 q 451 177 402 82 q 492 358 492 254 l 492 738 l 616 738 l 616 214 q 623 136 616 160 q 673 92 636 92 q 696 95 684 92 l 696 -4 "},h:{x_min:0,x_max:615,ha:724,o:"m 615 472 l 615 0 l 490 0 l 490 454 q 456 590 490 535 q 338 654 416 654 q 186 588 251 654 q 122 436 122 522 l 122 0 l 0 0 l 0 1013 l 122 1013 l 122 633 q 218 727 149 694 q 362 760 287 760 q 552 676 484 760 q 615 472 615 600 "},".":{x_min:0,x_max:142,ha:239,o:"m 142 0 l 0 0 l 0 151 l 142 151 l 142 0 "},\u03C6:{x_min:-2,x_max:878,ha:974,o:"m 496 -279 l 378 -279 l 378 -17 q 101 88 204 -17 q -2 367 -2 194 q 68 626 -2 510 q 283 758 151 758 l 283 646 q 167 537 209 626 q 133 373 133 462 q 192 177 133 254 q 378 93 259 93 l 378 758 q 445 764 426 763 q 476 765 464 765 q 765 659 653 765 q 878 377 878 553 q 771 96 878 209 q 496 -17 665 -17 l 496 -279 m 496 93 l 514 93 q 687 183 623 93 q 746 380 746 265 q 691 569 746 491 q 522 658 629 658 l 496 656 l 496 93 "},";":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 m 142 -12 q 105 -132 142 -82 q 0 -206 68 -182 l 0 -138 q 58 -82 43 -123 q 68 0 68 -56 l 0 0 l 0 151 l 142 151 l 142 -12 "},f:{x_min:0,x_max:378,ha:472,o:"m 378 638 l 246 638 l 246 0 l 121 0 l 121 638 l 0 638 l 0 738 l 121 738 q 137 935 121 887 q 290 1028 171 1028 q 320 1027 305 1028 q 378 1021 334 1026 l 378 908 q 323 918 346 918 q 257 870 273 918 q 246 780 246 840 l 246 738 l 378 738 l 378 638 "},"\u201C":{x_min:1,x_max:348.21875,ha:454,o:"m 140 670 l 1 670 l 1 830 q 37 943 1 897 q 140 1011 74 990 l 140 947 q 82 900 97 940 q 68 810 68 861 l 140 810 l 140 670 m 348 670 l 209 670 l 209 830 q 245 943 209 897 q 348 1011 282 990 l 348 947 q 290 900 305 940 q 276 810 276 861 l 348 810 l 348 670 "},A:{x_min:.03125,x_max:906.953125,ha:1008,o:"m 906 0 l 756 0 l 648 303 l 251 303 l 142 0 l 0 0 l 376 1013 l 529 1013 l 906 0 m 610 421 l 452 867 l 293 421 l 610 421 "},"\u2018":{x_min:1,x_max:139.890625,ha:236,o:"m 139 670 l 1 670 l 1 830 q 37 943 1 897 q 139 1011 74 990 l 139 947 q 82 900 97 940 q 68 810 68 861 l 139 810 l 139 670 "},\u03CA:{x_min:-70,x_max:283,ha:361,o:"m 283 800 l 173 800 l 173 925 l 283 925 l 283 800 m 40 800 l -70 800 l -70 925 l 40 925 l 40 800 m 283 3 q 232 -10 257 -5 q 181 -15 206 -15 q 84 26 118 -15 q 41 200 41 79 l 41 737 l 166 737 l 167 215 q 171 141 167 157 q 225 101 182 101 q 247 103 238 101 q 283 112 256 104 l 283 3 "},\u03C0:{x_min:-.21875,x_max:773.21875,ha:857,o:"m 773 -7 l 707 -11 q 575 40 607 -11 q 552 174 552 77 l 552 226 l 552 626 l 222 626 l 222 0 l 97 0 l 97 626 l 0 626 l 0 737 l 773 737 l 773 626 l 676 626 l 676 171 q 695 103 676 117 q 773 90 714 90 l 773 -7 "},\u03AC:{x_min:0,x_max:765.5625,ha:809,o:"m 765 -4 q 698 -14 726 -14 q 564 97 586 -14 q 466 7 525 40 q 337 -26 407 -26 q 88 98 186 -26 q 0 369 0 212 q 88 637 0 525 q 337 760 184 760 q 465 727 407 760 q 563 637 524 695 l 563 738 l 685 738 l 685 222 q 693 141 685 168 q 748 94 708 94 q 765 95 760 94 l 765 -4 m 584 371 q 531 562 584 485 q 360 653 470 653 q 192 566 254 653 q 135 379 135 489 q 186 181 135 261 q 358 84 247 84 q 528 176 465 84 q 584 371 584 260 m 604 1040 l 415 819 l 332 819 l 466 1040 l 604 1040 "},O:{x_min:0,x_max:958,ha:1057,o:"m 485 1041 q 834 882 702 1041 q 958 512 958 734 q 834 136 958 287 q 481 -26 702 -26 q 126 130 261 -26 q 0 504 0 279 q 127 880 0 728 q 485 1041 263 1041 m 480 98 q 731 225 638 98 q 815 504 815 340 q 733 783 815 669 q 480 912 640 912 q 226 784 321 912 q 142 504 142 670 q 226 224 142 339 q 480 98 319 98 "},n:{x_min:0,x_max:615,ha:724,o:"m 615 463 l 615 0 l 490 0 l 490 454 q 453 592 490 537 q 331 656 410 656 q 178 585 240 656 q 117 421 117 514 l 117 0 l 0 0 l 0 738 l 117 738 l 117 630 q 218 728 150 693 q 359 764 286 764 q 552 675 484 764 q 615 463 615 593 "},l:{x_min:41,x_max:166,ha:279,o:"m 166 0 l 41 0 l 41 1013 l 166 1013 l 166 0 "},"\xA4":{x_min:40.09375,x_max:728.796875,ha:825,o:"m 728 304 l 649 224 l 512 363 q 383 331 458 331 q 256 363 310 331 l 119 224 l 40 304 l 177 441 q 150 553 150 493 q 184 673 150 621 l 40 818 l 119 898 l 267 749 q 321 766 291 759 q 384 773 351 773 q 447 766 417 773 q 501 749 477 759 l 649 898 l 728 818 l 585 675 q 612 618 604 648 q 621 553 621 587 q 591 441 621 491 l 728 304 m 384 682 q 280 643 318 682 q 243 551 243 604 q 279 461 243 499 q 383 423 316 423 q 487 461 449 423 q 525 553 525 500 q 490 641 525 605 q 384 682 451 682 "},\u03BA:{x_min:0,x_max:632.328125,ha:679,o:"m 632 0 l 482 0 l 225 384 l 124 288 l 124 0 l 0 0 l 0 738 l 124 738 l 124 446 l 433 738 l 596 738 l 312 466 l 632 0 "},p:{x_min:0,x_max:685,ha:786,o:"m 685 364 q 598 96 685 205 q 350 -23 504 -23 q 121 89 205 -23 l 121 -278 l 0 -278 l 0 738 l 121 738 l 121 633 q 220 726 159 691 q 351 761 280 761 q 598 636 504 761 q 685 364 685 522 m 557 371 q 501 560 557 481 q 330 651 437 651 q 162 559 223 651 q 108 366 108 479 q 162 177 108 254 q 333 87 224 87 q 502 178 441 87 q 557 371 557 258 "},"\u2021":{x_min:0,x_max:777,ha:835,o:"m 458 238 l 458 0 l 319 0 l 319 238 l 0 238 l 0 360 l 319 360 l 319 681 l 0 683 l 0 804 l 319 804 l 319 1015 l 458 1013 l 458 804 l 777 804 l 777 683 l 458 683 l 458 360 l 777 360 l 777 238 l 458 238 "},\u03C8:{x_min:0,x_max:808,ha:907,o:"m 465 -278 l 341 -278 l 341 -15 q 87 102 180 -15 q 0 378 0 210 l 0 739 l 133 739 l 133 379 q 182 195 133 275 q 341 98 242 98 l 341 922 l 465 922 l 465 98 q 623 195 563 98 q 675 382 675 278 l 675 742 l 808 742 l 808 381 q 720 104 808 213 q 466 -13 627 -13 l 465 -278 "},\u03B7:{x_min:.78125,x_max:697,ha:810,o:"m 697 -278 l 572 -278 l 572 454 q 540 587 572 536 q 425 650 501 650 q 271 579 337 650 q 206 420 206 509 l 206 0 l 81 0 l 81 489 q 73 588 81 562 q 0 644 56 644 l 0 741 q 68 755 38 755 q 158 720 124 755 q 200 630 193 686 q 297 726 234 692 q 434 761 359 761 q 620 692 544 761 q 697 516 697 624 l 697 -278 "}},_Le="normal",xLe=1189,yLe=-100,bLe="normal",wLe={yMin:-334,xMin:-111,yMax:1189,xMax:1672},SLe=1e3,TLe={postscript_name:"Helvetiker-Regular",version_string:"Version 1.00 2004 initial release",vendor_url:"http://www.magenta.gr/",full_font_name:"Helvetiker",font_family_name:"Helvetiker",copyright:"Copyright (c) \u039Cagenta ltd, 2004",description:"",trademark:"",designer:"",designer_url:"",unique_font_identifier:"\u039Cagenta ltd:Helvetiker:22-10-104",license_url:"http://www.ellak.gr/fonts/MgOpen/license.html",license_description:`Copyright (c) 2004 by MAGENTA Ltd. All Rights Reserved.\r5223+ `),e},WV=function(e,t){return e.onBeforeCompile=function(n){e.userData.shader=t(n)},e},xLe=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(r){return r};if(e.userData.shader)t(e.userData.shader.uniforms);else{var n=e.onBeforeCompile;e.onBeforeCompile=function(r){n(r),t(r.uniforms)}}},yLe=["stroke"],th=window.THREE?window.THREE:{BufferGeometry:Xn,CubicBezierCurve3:s_,Curve:za,Group:Br,Line:a0,Mesh:Hn,NormalBlending:Ms,ShaderMaterial:ds,TubeGeometry:Z2,Vector3:re},bLe=g1.default.default||g1.default,Joe=Kr({props:{arcsData:{default:[]},arcStartLat:{default:"startLat"},arcStartLng:{default:"startLng"},arcStartAltitude:{default:0},arcEndLat:{default:"endLat"},arcEndLng:{default:"endLng"},arcEndAltitude:{default:0},arcColor:{default:function(){return"#ffffaa"}},arcAltitude:{},arcAltitudeAutoScale:{default:.5},arcStroke:{},arcCurveResolution:{default:64,triggerUpdate:!1},arcCircularResolution:{default:6,triggerUpdate:!1},arcDashLength:{default:1},arcDashGap:{default:0},arcDashInitialGap:{default:0},arcDashAnimateTime:{default:0},arcsTransitionDuration:{default:1e3,triggerUpdate:!1}},methods:{pauseAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.pause()},resumeAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.resume()},_destructor:function(e){var t;e.sharedMaterial.dispose(),(t=e.ticker)===null||t===void 0||t.dispose()}},stateInit:function(e){var t=e.tweenGroup;return{tweenGroup:t,ticker:new bLe,sharedMaterial:new th.ShaderMaterial($i($i({},Qoe()),{},{transparent:!0,blending:th.NormalBlending}))}},init:function(e,t){ns(e),t.scene=e,t.dataMapper=new Ll(e,{objBindAttr:"__threeObjArc"}).onCreateObj(function(){var n=new th.Group;return n.__globeObjType="arc",n}),t.ticker.onTick.add(function(n,r){t.dataMapper.entries().map(function(s){var o=Pr(s,2),a=o[1];return a}).filter(function(s){return s.children.length&&s.children[0].material&&s.children[0].__dashAnimateStep}).forEach(function(s){var o=s.children[0],a=o.__dashAnimateStep*r,l=o.material.uniforms.dashTranslate.value%1e9;o.material.uniforms.dashTranslate.value=l+a})})},update:function(e){var t=st(e.arcStartLat),n=st(e.arcStartLng),r=st(e.arcStartAltitude),s=st(e.arcEndLat),o=st(e.arcEndLng),a=st(e.arcEndAltitude),l=st(e.arcAltitude),c=st(e.arcAltitudeAutoScale),u=st(e.arcStroke),f=st(e.arcColor),d=st(e.arcDashLength),A=st(e.arcDashGap),y=st(e.arcDashInitialGap),w=st(e.arcDashAnimateTime);e.dataMapper.onUpdateObj(function(P,I){var F=u(I),D=F!=null;if(!P.children.length||D!==(P.children[0].type==="Mesh")){ns(P);var L=D?new th.Mesh:new th.Line(new th.BufferGeometry);L.material=e.sharedMaterial.clone(),P.add(L)}var C=P.children[0];Object.assign(C.material.uniforms,{dashSize:{value:d(I)},gapSize:{value:A(I)},dashOffset:{value:y(I)}});var B=w(I);C.__dashAnimateStep=B>0?1e3/B:0;var k=T(f(I),e.arcCurveResolution,D?e.arcCircularResolution+1:1),z=R(e.arcCurveResolution,D?e.arcCircularResolution+1:1,!0);C.geometry.setAttribute("color",k),C.geometry.setAttribute("relDistance",z);var G=function($){var J=P.__currentTargetD=$,te=J.stroke,ce=aLe(J,yLe),he=S(ce);D?(C.geometry&&C.geometry.dispose(),C.geometry=new th.TubeGeometry(he,e.arcCurveResolution,te/2,e.arcCircularResolution),C.geometry.setAttribute("color",k),C.geometry.setAttribute("relDistance",z)):C.geometry.setFromPoints(he.getPoints(e.arcCurveResolution))},W={stroke:F,alt:l(I),altAutoScale:+c(I),startLat:+t(I),startLng:+n(I),startAlt:+r(I),endLat:+s(I),endLng:+o(I),endAlt:+a(I)},Y=P.__currentTargetD||Object.assign({},W,{altAutoScale:-.001});Object.keys(W).some(function(H){return Y[H]!==W[H]})&&(!e.arcsTransitionDuration||e.arcsTransitionDuration<0?G(W):e.tweenGroup.add(new uo(Y).to(W,e.arcsTransitionDuration).easing(Qr.Quadratic.InOut).onUpdate(G).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(e.arcsData);function S(P){var I=P.alt,F=P.altAutoScale,D=P.startLat,L=P.startLng,C=P.startAlt,B=P.endLat,k=P.endLng,z=P.endAlt,G=function(Ee){var Ve=Pr(Ee,3),Ye=Ve[0],Mt=Ve[1],Et=Ve[2],It=cu(Mt,Ye,Et),dn=It.x,Gt=It.y,$e=It.z;return new th.Vector3(dn,Gt,$e)},W=[L,D],Y=[k,B],H=I;if(H==null&&(H=Ml(W,Y)/2*F+Math.max(C,z)),H||C||z){var $=Cg(W,Y),J=function(Ee,Ve){return Ve+(Ve-Ee)*(Ee<Ve?.5:.25)},te=[.25,.75].map(function(mt){return[].concat(tr($(mt)),[J(mt<.5?C:z,H)])}),ce=Pr(te,2),he=ce[0],ve=ce[1],Re=qV(th.CubicBezierCurve3,tr([[].concat(W,[C]),he,ve,[].concat(Y,[z])].map(G)));return Re}else{var Qe=.001;return Fe.apply(void 0,tr([[].concat(W,[Qe]),[].concat(Y,[Qe])].map(G)))}function Fe(mt,Ee){var Ve=mt.angleTo(Ee),Ye=Ve===0?function(){return mt.clone()}:function(Et){return new th.Vector3().addVectors(mt.clone().multiplyScalar(Math.sin((1-Et)*Ve)),Ee.clone().multiplyScalar(Math.sin(Et*Ve))).divideScalar(Math.sin(Ve))},Mt=new th.Curve;return Mt.getPoint=Ye,Mt}}function T(P,I){var F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,D=I+1,L;if(P instanceof Array||P instanceof Function){var C=P instanceof Array?Tl().domain(P.map(function(H,$){return $/(P.length-1)})).range(P):P;L=function($){return Im(C($),!0,!0)}}else{var B=Im(P,!0,!0);L=function(){return B}}for(var k=[],z=0,G=D;z<G;z++)for(var W=L(z/(G-1)),Y=0;Y<F;Y++)k.push(W);return Uf(k,4)}function R(P){for(var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,D=P+1,L=[],C=0,B=D;C<B;C++)for(var k=C/(B-1),z=0;z<I;z++)L.push(k);return F&&L.reverse(),Uf(L,1)}}}),Mm=window.THREE?window.THREE:{BufferGeometry:Xn,DoubleSide:vr,Mesh:Hn,MeshLambertMaterial:Ga,Object3D:lr},zoe=Object.assign({},Tw),Voe=zoe.BufferGeometryUtils||zoe,eae=Kr({props:{hexBinPointsData:{default:[]},hexBinPointLat:{default:"lat"},hexBinPointLng:{default:"lng"},hexBinPointWeight:{default:1},hexBinResolution:{default:4},hexMargin:{default:.2},hexTopCurvatureResolution:{default:5},hexTopColor:{default:function(){return"#ffffaa"}},hexSideColor:{default:function(){return"#ffffaa"}},hexAltitude:{default:function(e){var t=e.sumWeight;return t*.01}},hexBinMerge:{default:!1},hexTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;ns(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Ll(e,{objBindAttr:"__threeObjHexbin"})},update:function(e,t){var n=st(e.hexBinPointLat),r=st(e.hexBinPointLng),s=st(e.hexBinPointWeight),o=st(e.hexAltitude),a=st(e.hexTopColor),l=st(e.hexSideColor),c=st(e.hexMargin),u=gee(e.hexBinPointsData.map(function(R){return $i($i({},R),{},{h3Idx:Iee(n(R),r(R),e.hexBinResolution)})}),"h3Idx"),f=Object.entries(u).map(function(R){var P=Pr(R,2),I=P[0],F=P[1];return{h3Idx:I,points:F,sumWeight:F.reduce(function(D,L){return D+ +s(L)},0)}}),d={};if(!e.hexBinMerge&&t.hasOwnProperty("hexBinMerge")&&ns(e.scene),e.dataMapper.scene=e.hexBinMerge?new Mm.Object3D:e.scene,e.dataMapper.id(function(R){return R.h3Idx}).onCreateObj(S).onUpdateObj(T).digest(f),e.hexBinMerge){var A=f.length?(Voe.mergeGeometries||Voe.mergeBufferGeometries)(f.map(function(R){var P=e.dataMapper.getObj(R),I=P.geometry.toNonIndexed();P.updateMatrix(),I.applyMatrix4(P.matrix);var F=Im(a(R)),D=Im(l(R)),L=I.getAttribute("position").count,C=I.groups[0].count;return I.setAttribute("color",Uf(tr(new Array(L)).map(function(B,k){return k>=C?F:D}),4)),I})):new Mm.BufferGeometry,y=new Mm.MeshLambertMaterial({color:16777215,transparent:!0,vertexColors:!0,side:Mm.DoubleSide});y.onBeforeCompile=function(R){y.userData.shader=GV(R)};var w=new Mm.Mesh(A,y);w.__globeObjType="hexBinPoints",w.__data=f,e.dataMapper.clear(),ns(e.scene),e.scene.add(w)}function S(R){var P=new Mm.Mesh;P.__hexCenter=RO(R.h3Idx),P.__hexGeoJson=IO(R.h3Idx,!0).reverse();var I=P.__hexCenter[1];return P.__hexGeoJson.forEach(function(F){var D=F[0];Math.abs(I-D)>170&&(F[0]+=I>D?360:-360)}),P.__globeObjType="hexbin",P}function T(R,P){var I=function(J,te,ce){return J-(J-te)*ce},F=Math.max(0,Math.min(1,+c(P))),D=Pr(R.__hexCenter,2),L=D[0],C=D[1],B=F===0?R.__hexGeoJson:R.__hexGeoJson.map(function($){var J=Pr($,2),te=J[0],ce=J[1];return[[te,C],[ce,L]].map(function(he){var ve=Pr(he,2),Re=ve[0],Qe=ve[1];return I(Re,Qe,F)})}),k=e.hexTopCurvatureResolution;R.geometry&&R.geometry.dispose(),R.geometry=new cR([B],0,_r,!1,!0,!0,k);var z={alt:+o(P)},G=function(J){var te=R.__currentTargetD=J,ce=te.alt;R.scale.x=R.scale.y=R.scale.z=1+ce;var he=_r/(ce+1);R.geometry.setAttribute("surfaceRadius",Uf(Array(R.geometry.getAttribute("position").count).fill(he),1))},W=R.__currentTargetD||Object.assign({},z,{alt:-.001});if(Object.keys(z).some(function($){return W[$]!==z[$]})&&(e.hexBinMerge||!e.hexTransitionDuration||e.hexTransitionDuration<0?G(z):e.tweenGroup.add(new uo(W).to(z,e.hexTransitionDuration).easing(Qr.Quadratic.InOut).onUpdate(G).onComplete(function(){e.tweenGroup.remove(this)}).start())),!e.hexBinMerge){var Y=l(P),H=a(P);[Y,H].forEach(function($){if(!d.hasOwnProperty($)){var J=ih($);d[$]=WV(new Mm.MeshLambertMaterial({color:Of($),transparent:J<1,opacity:J,side:Mm.DoubleSide}),GV)}}),R.material=[Y,H].map(function($){return d[$]})}}}}),tae=function(e){return e*e},ip=function(e){return e*Math.PI/180};function wLe(i,e){var t=Math.sqrt,n=Math.cos,r=function(u){return tae(Math.sin(u/2))},s=ip(i[1]),o=ip(e[1]),a=ip(i[0]),l=ip(e[0]);return 2*Math.asin(t(r(o-s)+n(s)*n(o)*r(l-a)))}var SLe=Math.sqrt(2*Math.PI);function TLe(i,e){return Math.exp(-tae(i/e)/2)/(e*SLe)}var ELe=function(e){var t=Pr(e,2),n=t[0],r=t[1],s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=o.lngAccessor,l=a===void 0?function(S){return S[0]}:a,c=o.latAccessor,u=c===void 0?function(S){return S[1]}:c,f=o.weightAccessor,d=f===void 0?function(){return 1}:f,A=o.bandwidth,y=[n,r],w=A*Math.PI/180;return sC(s.map(function(S){var T=d(S);if(!T)return 0;var R=wLe(y,[l(S),u(S)]);return TLe(R,w)*T}))},MLe=(function(){var i=eLe(zV().m(function e(t){var n,r,s,o,a,l,c,u,f,d,A,y,w,S,T,R,P,I,F,D,L,C,B,k,z,G,W,Y,H,$,J,te,ce,he,ve,Re,Qe,Fe,mt,Ee,Ve=arguments,Ye,Mt,Et;return zV().w(function(It){for(;;)switch(It.n){case 0:if(r=Ve.length>1&&Ve[1]!==void 0?Ve[1]:[],s=Ve.length>2&&Ve[2]!==void 0?Ve[2]:{},o=s.lngAccessor,a=o===void 0?function(dn){return dn[0]}:o,l=s.latAccessor,c=l===void 0?function(dn){return dn[1]}:l,u=s.weightAccessor,f=u===void 0?function(){return 1}:u,d=s.bandwidth,(n=navigator)!==null&&n!==void 0&&n.gpu){It.n=1;break}return console.warn("WebGPU not enabled in browser. Please consider enabling it to improve performance."),It.a(2,t.map(function(dn){return ELe(dn,r,{lngAccessor:a,latAccessor:c,weightAccessor:f,bandwidth:d})}));case 1:return A=4,y=Aoe,w=goe,S=Coe,T=Moe,R=boe,P=woe,I=voe,F=Eoe,D=Toe,L=xoe,C=_oe,B=yoe,k=Soe,z=T(new a1(new Float32Array(t.flat().map(ip)),2),"vec2",t.length),G=T(new a1(new Float32Array(r.map(function(dn){return[ip(a(dn)),ip(c(dn)),f(dn)]}).flat()),3),"vec3",r.length),W=new a1(t.length,1),Y=T(W,"float",t.length),H=R(Math.PI),$=F(H.mul(2)),J=function(Gt){return Gt.mul(Gt)},te=function(Gt){return J(D(Gt.div(2)))},ce=function(Gt,$e){var ot=R(Gt[1]),nt=R($e[1]),bt=R(Gt[0]),yt=R($e[0]);return R(2).mul(C(F(te(nt.sub(ot)).add(L(ot).mul(L(nt)).mul(te(yt.sub(bt)))))))},he=function(Gt,$e){return B(k(J(Gt.div($e)).div(2))).div($e.mul($))},ve=S(ip(d)),Re=S(ip(d*A)),Qe=S(r.length),Fe=y(function(){var dn=z.element(P),Gt=Y.element(P);Gt.assign(0),I(Qe,function($e){var ot=$e.i,nt=G.element(ot),bt=nt.z;w(bt,function(){var yt=ce(nt.xy,dn.xy);w(yt&&yt.lessThan(Re),function(){Gt.addAssign(he(yt,ve).mul(bt))})})})}),mt=Fe().compute(t.length),Ee=new bx,It.n=2,Ee.computeAsync(mt);case 2:return Ye=Array,Mt=Float32Array,It.n=3,Ee.getArrayBufferAsync(W);case 3:return Et=It.v,It.a(2,Ye.from.call(Ye,new Mt(Et)))}},e)}));return function(t){return i.apply(this,arguments)}})(),ZI=window.THREE?window.THREE:{Mesh:Hn,MeshLambertMaterial:Ga,SphereGeometry:Va},CLe=3.5,RLe=.1,Goe=100,ILe=function(e){var t=zu(LO(e));return t.opacity=Math.cbrt(e),t.formatRgb()},nae=Kr({props:{heatmapsData:{default:[]},heatmapPoints:{default:function(e){return e}},heatmapPointLat:{default:function(e){return e[0]}},heatmapPointLng:{default:function(e){return e[1]}},heatmapPointWeight:{default:1},heatmapBandwidth:{default:2.5},heatmapColorFn:{default:function(){return ILe}},heatmapColorSaturation:{default:1.5},heatmapBaseAltitude:{default:.01},heatmapTopAltitude:{},heatmapsTransitionDuration:{default:0,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;ns(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Ll(e,{objBindAttr:"__threeObjHeatmap"}).onCreateObj(function(){var s=new ZI.Mesh(new ZI.SphereGeometry(_r),WV(new ZI.MeshLambertMaterial({vertexColors:!0,transparent:!0}),_Le));return s.__globeObjType="heatmap",s})},update:function(e){var t=st(e.heatmapPoints),n=st(e.heatmapPointLat),r=st(e.heatmapPointLng),s=st(e.heatmapPointWeight),o=st(e.heatmapBandwidth),a=st(e.heatmapColorFn),l=st(e.heatmapColorSaturation),c=st(e.heatmapBaseAltitude),u=st(e.heatmapTopAltitude);e.dataMapper.onUpdateObj(function(f,d){var A=o(d),y=a(d),w=l(d),S=c(d),T=u(d),R=t(d).map(function(L){var C=n(L),B=r(L),k=cu(C,B),z=k.x,G=k.y,W=k.z;return{x:z,y:G,z:W,lat:C,lng:B,weight:s(L)}}),P=Math.max(RLe,A/CLe),I=Math.ceil(360/(P||-1));f.geometry.parameters.widthSegments!==I&&(f.geometry.dispose(),f.geometry=new ZI.SphereGeometry(_r,I,I/2));var F=vLe(f.geometry.getAttribute("position")),D=F.map(function(L){var C=Pr(L,3),B=C[0],k=C[1],z=C[2],G=Yoe({x:B,y:k,z}),W=G.lng,Y=G.lat;return[W,Y]});MLe(D,R,{latAccessor:function(C){return C.lat},lngAccessor:function(C){return C.lng},weightAccessor:function(C){return C.weight},bandwidth:A}).then(function(L){var C=tr(new Array(Goe)).map(function(G,W){return Im(y(W/(Goe-1)))}),B=function(W){var Y=f.__currentTargetD=W,H=Y.kdeVals,$=Y.topAlt,J=Y.saturation,te=iC(H.map(Math.abs))||1e-15,ce=nw([0,te/J],C);f.geometry.setAttribute("color",Uf(H.map(function(ve){return ce(Math.abs(ve))}),4));var he=Tl([0,te],[_r*(1+S),_r*(1+($||S))]);f.geometry.setAttribute("r",Uf(H.map(he)))},k={kdeVals:L,topAlt:T,saturation:w},z=f.__currentTargetD||Object.assign({},k,{kdeVals:L.map(function(){return 0}),topAlt:T&&S,saturation:.5});z.kdeVals.length!==L.length&&(z.kdeVals=L.slice()),Object.keys(k).some(function(G){return z[G]!==k[G]})&&(!e.heatmapsTransitionDuration||e.heatmapsTransitionDuration<0?B(k):e.tweenGroup.add(new uo(z).to(k,e.heatmapsTransitionDuration).easing(Qr.Quadratic.InOut).onUpdate(B).onComplete(function(){e.tweenGroup.remove(this)}).start()))})}).digest(e.heatmapsData)}}),Cm=window.THREE?window.THREE:{DoubleSide:vr,Group:Br,LineBasicMaterial:Du,LineSegments:t_,Mesh:Hn,MeshBasicMaterial:fs},iae=Kr({props:{polygonsData:{default:[]},polygonGeoJsonGeometry:{default:"geometry"},polygonSideColor:{default:function(){return"#ffffaa"}},polygonSideMaterial:{},polygonCapColor:{default:function(){return"#ffffaa"}},polygonCapMaterial:{},polygonStrokeColor:{},polygonAltitude:{default:.01},polygonCapCurvatureResolution:{default:5},polygonsTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;ns(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Ll(e,{objBindAttr:"__threeObjPolygon"}).id(function(s){return s.id}).onCreateObj(function(){var s=new Cm.Group;return s.__defaultSideMaterial=WV(new Cm.MeshBasicMaterial({side:Cm.DoubleSide,depthWrite:!0}),GV),s.__defaultCapMaterial=new Cm.MeshBasicMaterial({side:Cm.DoubleSide,depthWrite:!0}),s.add(new Cm.Mesh(void 0,[s.__defaultSideMaterial,s.__defaultCapMaterial])),s.add(new Cm.LineSegments(void 0,new Cm.LineBasicMaterial)),s.__globeObjType="polygon",s})},update:function(e){var t=st(e.polygonGeoJsonGeometry),n=st(e.polygonAltitude),r=st(e.polygonCapCurvatureResolution),s=st(e.polygonCapColor),o=st(e.polygonCapMaterial),a=st(e.polygonSideColor),l=st(e.polygonSideMaterial),c=st(e.polygonStrokeColor),u=[];e.polygonsData.forEach(function(f){var d={data:f,capColor:s(f),capMaterial:o(f),sideColor:a(f),sideMaterial:l(f),strokeColor:c(f),altitude:+n(f),capCurvatureResolution:+r(f)},A=t(f),y=f.__id||"".concat(Math.round(Math.random()*1e9));f.__id=y,A.type==="Polygon"?u.push($i({id:"".concat(y,"_0"),coords:A.coordinates},d)):A.type==="MultiPolygon"?u.push.apply(u,tr(A.coordinates.map(function(w,S){return $i({id:"".concat(y,"_").concat(S),coords:w},d)}))):console.warn("Unsupported GeoJson geometry type: ".concat(A.type,". Skipping geometry..."))}),e.dataMapper.onUpdateObj(function(f,d){var A=d.coords,y=d.capColor,w=d.capMaterial,S=d.sideColor,T=d.sideMaterial,R=d.strokeColor,P=d.altitude,I=d.capCurvatureResolution,F=Pr(f.children,2),D=F[0],L=F[1],C=!!R;L.visible=C;var B=!!(y||w),k=!!(S||T);PLe(D.geometry.parameters||{},{polygonGeoJson:A,curvatureResolution:I,closedTop:B,includeSides:k})||(D.geometry&&D.geometry.dispose(),D.geometry=new cR(A,0,_r,!1,B,k,I)),C&&(!L.geometry.parameters||L.geometry.parameters.geoJson.coordinates!==A||L.geometry.parameters.resolution!==I)&&(L.geometry&&L.geometry.dispose(),L.geometry=new aO({type:"Polygon",coordinates:A},_r,I));var z=k?0:-1,G=B?k?1:0:-1;if(z>=0&&(D.material[z]=T||f.__defaultSideMaterial),G>=0&&(D.material[G]=w||f.__defaultCapMaterial),[[!T&&S,z],[!w&&y,G]].forEach(function(te){var ce=Pr(te,2),he=ce[0],ve=ce[1];if(!(!he||ve<0)){var Re=D.material[ve],Qe=ih(he);Re.color.set(Of(he)),Re.transparent=Qe<1,Re.opacity=Qe}}),C){var W=L.material,Y=ih(R);W.color.set(Of(R)),W.transparent=Y<1,W.opacity=Y}var H={alt:P},$=function(ce){var he=f.__currentTargetD=ce,ve=he.alt;D.scale.x=D.scale.y=D.scale.z=1+ve,C&&(L.scale.x=L.scale.y=L.scale.z=1+ve+1e-4),xLe(f.__defaultSideMaterial,function(Re){return Re.uSurfaceRadius.value=_r/(ve+1)})},J=f.__currentTargetD||Object.assign({},H,{alt:-.001});Object.keys(H).some(function(te){return J[te]!==H[te]})&&(!e.polygonsTransitionDuration||e.polygonsTransitionDuration<0||J.alt===H.alt?$(H):e.tweenGroup.add(new uo(J).to(H,e.polygonsTransitionDuration).easing(Qr.Quadratic.InOut).onUpdate($).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(u)}});function PLe(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:function(){return function(n,r){return n===r}};return Object.entries(e).every(function(n){var r=Pr(n,2),s=r[0],o=r[1];return i.hasOwnProperty(s)&&t(s)(i[s],o)})}var Px=window.THREE?window.THREE:{BufferGeometry:Xn,DoubleSide:vr,Mesh:Hn,MeshLambertMaterial:Ga,Vector3:re},qoe=Object.assign({},Tw),Hoe=qoe.BufferGeometryUtils||qoe,rae=Kr({props:{hexPolygonsData:{default:[]},hexPolygonGeoJsonGeometry:{default:"geometry"},hexPolygonColor:{default:function(){return"#ffffaa"}},hexPolygonAltitude:{default:.001},hexPolygonResolution:{default:3},hexPolygonMargin:{default:.2},hexPolygonUseDots:{default:!1},hexPolygonCurvatureResolution:{default:5},hexPolygonDotResolution:{default:12},hexPolygonsTransitionDuration:{default:0,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;ns(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Ll(e,{objBindAttr:"__threeObjHexPolygon"}).onCreateObj(function(){var s=new Px.Mesh(void 0,new Px.MeshLambertMaterial({side:Px.DoubleSide}));return s.__globeObjType="hexPolygon",s})},update:function(e){var t=st(e.hexPolygonGeoJsonGeometry),n=st(e.hexPolygonColor),r=st(e.hexPolygonAltitude),s=st(e.hexPolygonResolution),o=st(e.hexPolygonMargin),a=st(e.hexPolygonUseDots),l=st(e.hexPolygonCurvatureResolution),c=st(e.hexPolygonDotResolution);e.dataMapper.onUpdateObj(function(u,f){var d=t(f),A=s(f),y=r(f),w=Math.max(0,Math.min(1,+o(f))),S=a(f),T=l(f),R=c(f),P=n(f),I=ih(P);u.material.color.set(Of(P)),u.material.transparent=I<1,u.material.opacity=I;var F={alt:y,margin:w,curvatureResolution:T},D={geoJson:d,h3Res:A},L=u.__currentTargetD||Object.assign({},F,{alt:-.001}),C=u.__currentMemD||D;if(Object.keys(F).some(function(G){return L[G]!==F[G]})||Object.keys(D).some(function(G){return C[G]!==D[G]})){u.__currentMemD=D;var B=[];d.type==="Polygon"?PO(d.coordinates,A,!0).forEach(function(G){return B.push(G)}):d.type==="MultiPolygon"?d.coordinates.forEach(function(G){return PO(G,A,!0).forEach(function(W){return B.push(W)})}):console.warn("Unsupported GeoJson geometry type: ".concat(d.type,". Skipping geometry..."));var k=B.map(function(G){var W=RO(G),Y=IO(G,!0).reverse(),H=W[1];return Y.forEach(function($){var J=$[0];Math.abs(H-J)>170&&($[0]+=H>J?360:-360)}),{h3Idx:G,hexCenter:W,hexGeoJson:Y}}),z=function(W){var Y=u.__currentTargetD=W,H=Y.alt,$=Y.margin,J=Y.curvatureResolution;u.geometry&&u.geometry.dispose(),u.geometry=k.length?(Hoe.mergeGeometries||Hoe.mergeBufferGeometries)(k.map(function(te){var ce=Pr(te.hexCenter,2),he=ce[0],ve=ce[1];if(S){var Re=cu(he,ve,H),Qe=cu(te.hexGeoJson[0][1],te.hexGeoJson[0][0],H),Fe=.85*(1-$)*new Px.Vector3(Re.x,Re.y,Re.z).distanceTo(new Px.Vector3(Qe.x,Qe.y,Qe.z)),mt=new i_(Fe,R);return mt.rotateX(A1(-he)),mt.rotateY(A1(ve)),mt.translate(Re.x,Re.y,Re.z),mt}else{var Ee=function(Mt,Et,It){return Mt-(Mt-Et)*It},Ve=$===0?te.hexGeoJson:te.hexGeoJson.map(function(Ye){var Mt=Pr(Ye,2),Et=Mt[0],It=Mt[1];return[[Et,ve],[It,he]].map(function(dn){var Gt=Pr(dn,2),$e=Gt[0],ot=Gt[1];return Ee($e,ot,$)})});return new cR([Ve],_r,_r*(1+H),!1,!0,!1,J)}})):new Px.BufferGeometry};!e.hexPolygonsTransitionDuration||e.hexPolygonsTransitionDuration<0?z(F):e.tweenGroup.add(new uo(L).to(F,e.hexPolygonsTransitionDuration).easing(Qr.Quadratic.InOut).onUpdate(z).onComplete(function(){e.tweenGroup.remove(this)}).start())}}).digest(e.hexPolygonsData)}}),LLe=window.THREE?window.THREE:{Vector3:re};function DLe(i,e){var t=function(o,a){var l=o[o.length-1];return[].concat(tr(o),tr(Array(a-o.length).fill(l)))},n=Math.max(i.length,e.length),r=XF.apply(void 0,tr([i,e].map(function(s){return s.map(function(o){var a=o.x,l=o.y,c=o.z;return[a,l,c]})}).map(function(s){return t(s,n)})));return function(s){return s===0?i:s===1?e:r(s).map(function(o){var a=Pr(o,3),l=a[0],c=a[1],u=a[2];return new LLe.Vector3(l,c,u)})}}var m1=window.THREE?window.THREE:{BufferGeometry:Xn,Color:zt,Group:Br,Line:a0,NormalBlending:Ms,ShaderMaterial:ds,Vector3:re},NLe=g1.default.default||g1.default,sae=Kr({props:{pathsData:{default:[]},pathPoints:{default:function(e){return e}},pathPointLat:{default:function(e){return e[0]}},pathPointLng:{default:function(e){return e[1]}},pathPointAlt:{default:.001},pathResolution:{default:2},pathColor:{default:function(){return"#ffffaa"}},pathStroke:{},pathDashLength:{default:1},pathDashGap:{default:0},pathDashInitialGap:{default:0},pathDashAnimateTime:{default:0},pathTransitionDuration:{default:1e3,triggerUpdate:!1},rendererSize:{}},methods:{pauseAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.pause()},resumeAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.resume()},_destructor:function(e){var t;(t=e.ticker)===null||t===void 0||t.dispose()}},stateInit:function(e){var t=e.tweenGroup;return{tweenGroup:t,ticker:new NLe,sharedMaterial:new m1.ShaderMaterial($i($i({},Qoe()),{},{transparent:!0,blending:m1.NormalBlending}))}},init:function(e,t){ns(e),t.scene=e,t.dataMapper=new Ll(e,{objBindAttr:"__threeObjPath"}).onCreateObj(function(){var n=new m1.Group;return n.__globeObjType="path",n}),t.ticker.onTick.add(function(n,r){t.dataMapper.entries().map(function(s){var o=Pr(s,2),a=o[1];return a}).filter(function(s){return s.children.length&&s.children[0].material&&s.children[0].__dashAnimateStep}).forEach(function(s){var o=s.children[0],a=o.__dashAnimateStep*r;if(o.type==="Line"){var l=o.material.uniforms.dashTranslate.value%1e9;o.material.uniforms.dashTranslate.value=l+a}else if(o.type==="Line2"){for(var c=o.material.dashOffset-a,u=o.material.dashSize+o.material.gapSize;c<=-u;)c+=u;o.material.dashOffset=c}})})},update:function(e){var t=st(e.pathPoints),n=st(e.pathPointLat),r=st(e.pathPointLng),s=st(e.pathPointAlt),o=st(e.pathStroke),a=st(e.pathColor),l=st(e.pathDashLength),c=st(e.pathDashGap),u=st(e.pathDashInitialGap),f=st(e.pathDashAnimateTime);e.dataMapper.onUpdateObj(function(S,T){var R=o(T),P=R!=null;if(!S.children.length||P===(S.children[0].type==="Line")){ns(S);var I=P?new Rx(new Em,new Lf):new m1.Line(new m1.BufferGeometry,e.sharedMaterial.clone());S.add(I)}var F=S.children[0],D=A(t(T),n,r,s,e.pathResolution),L=f(T);if(F.__dashAnimateStep=L>0?1e3/L:0,P){F.material.resolution=e.rendererSize;{var k=l(T),z=c(T),G=u(T);F.material.dashed=z>0,F.material.dashed?F.material.defines.USE_DASH="":delete F.material.defines.USE_DASH,F.material.dashed&&(F.material.dashScale=1/d(D),F.material.dashSize=k,F.material.gapSize=z,F.material.dashOffset=-G)}{var W=a(T);if(W instanceof Array){var Y=y(a(T),D.length-1,1,!1);F.geometry.setColors(Y.array),F.material.vertexColors=!0}else{var H=W,$=ih(H);F.material.color=new m1.Color(Of(H)),F.material.transparent=$<1,F.material.opacity=$,F.material.vertexColors=!1}}F.material.needsUpdate=!0}else{Object.assign(F.material.uniforms,{dashSize:{value:l(T)},gapSize:{value:c(T)},dashOffset:{value:u(T)}});var C=y(a(T),D.length),B=w(D.length,1,!0);F.geometry.setAttribute("color",C),F.geometry.setAttribute("relDistance",B)}var J=DLe(S.__currentTargetD&&S.__currentTargetD.points||[D[0]],D),te=function(Re){var Qe=S.__currentTargetD=Re,Fe=Qe.stroke,mt=Qe.interpolK,Ee=S.__currentTargetD.points=J(mt);if(P){var Ve;F.geometry.setPositions((Ve=[]).concat.apply(Ve,tr(Ee.map(function(Ye){var Mt=Ye.x,Et=Ye.y,It=Ye.z;return[Mt,Et,It]})))),F.material.linewidth=Fe,F.material.dashed&&F.computeLineDistances()}else F.geometry.setFromPoints(Ee),F.geometry.computeBoundingSphere()},ce={stroke:R,interpolK:1},he=Object.assign({},S.__currentTargetD||ce,{interpolK:0});Object.keys(ce).some(function(ve){return he[ve]!==ce[ve]})&&(!e.pathTransitionDuration||e.pathTransitionDuration<0?te(ce):e.tweenGroup.add(new uo(he).to(ce,e.pathTransitionDuration).easing(Qr.Quadratic.InOut).onUpdate(te).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(e.pathsData);function d(S){var T=0,R;return S.forEach(function(P){R&&(T+=R.distanceTo(P)),R=P}),T}function A(S,T,R,P,I){var F=function(B,k,z){for(var G=[],W=1;W<=z;W++)G.push(B+(k-B)*W/(z+1));return G},D=function(){var B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,z=[],G=null;return B.forEach(function(W){if(G){for(;Math.abs(G[1]-W[1])>180;)G[1]+=360*(G[1]<W[1]?1:-1);var Y=Math.sqrt(Math.pow(W[0]-G[0],2)+Math.pow(W[1]-G[1],2));if(Y>k)for(var H=Math.floor(Y/k),$=F(G[0],W[0],H),J=F(G[1],W[1],H),te=F(G[2],W[2],H),ce=0,he=$.length;ce<he;ce++)z.push([$[ce],J[ce],te[ce]])}z.push(G=W)}),z},L=function(B){var k=Pr(B,3),z=k[0],G=k[1],W=k[2],Y=cu(z,G,W),H=Y.x,$=Y.y,J=Y.z;return new m1.Vector3(H,$,J)};return D(S.map(function(C){return[T(C),R(C),P(C)]}),I).map(L)}function y(S,T){var R=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,P=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,I=T+1,F;if(S instanceof Array||S instanceof Function){var D=S instanceof Array?Tl().domain(S.map(function(W,Y){return Y/(S.length-1)})).range(S):S;F=function(Y){return Im(D(Y),P,!0)}}else{var L=Im(S,P,!0);F=function(){return L}}for(var C=[],B=0,k=I;B<k;B++)for(var z=F(B/(k-1)),G=0;G<R;G++)C.push(z);return Uf(C,P?4:3)}function w(S){for(var T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,R=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,P=S+1,I=[],F=0,D=P;F<D;F++)for(var L=F/(D-1),C=0;C<T;C++)I.push(L);return R&&I.reverse(),Uf(I,1)}}}),KI=window.THREE?window.THREE:{Euler:Ua,Mesh:Hn,MeshLambertMaterial:Ga,SphereGeometry:Va},oae=Kr({props:{tilesData:{default:[]},tileLat:{default:"lat"},tileLng:{default:"lng"},tileAltitude:{default:.01},tileWidth:{default:1},tileHeight:{default:1},tileUseGlobeProjection:{default:!0},tileMaterial:{default:function(){return new KI.MeshLambertMaterial({color:"#ffbb88",opacity:.4,transparent:!0})}},tileCurvatureResolution:{default:5},tilesTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;ns(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Ll(e,{objBindAttr:"__threeObjTile"}).onCreateObj(function(){var s=new KI.Mesh;return s.__globeObjType="tile",s})},update:function(e){var t=st(e.tileLat),n=st(e.tileLng),r=st(e.tileAltitude),s=st(e.tileWidth),o=st(e.tileHeight),a=st(e.tileUseGlobeProjection),l=st(e.tileMaterial),c=st(e.tileCurvatureResolution);e.dataMapper.onUpdateObj(function(u,f){u.material=l(f);var d=a(f),A=c(f),y=function(R){var P=u.__currentTargetD=R,I=P.lat,F=P.lng,D=P.alt,L=P.width,C=P.height,B=Lx(F),k=Lx(-I);u.geometry&&u.geometry.dispose(),u.geometry=new KI.SphereGeometry(_r*(1+D),Math.ceil(L/(A||-1)),Math.ceil(C/(A||-1)),Lx(90-L/2)+(d?B:0),Lx(L),Lx(90-C/2)+(d?k:0),Lx(C)),d||u.setRotationFromEuler(new KI.Euler(k,B,0,"YXZ"))},w={lat:+t(f),lng:+n(f),alt:+r(f),width:+s(f),height:+o(f)},S=u.__currentTargetD||Object.assign({},w,{width:0,height:0});Object.keys(w).some(function(T){return S[T]!==w[T]})&&(!e.tilesTransitionDuration||e.tilesTransitionDuration<0?y(w):e.tweenGroup.add(new uo(S).to(w,e.tilesTransitionDuration).easing(Qr.Quadratic.InOut).onUpdate(y).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(e.tilesData)}}),Lx=function(e){return e*Math.PI/180},HS=window.THREE?window.THREE:{BufferGeometry:Xn,Color:zt,Points:U2,PointsMaterial:l0},aae=Kr({props:{particlesData:{default:[]},particlesList:{default:function(e){return e}},particleLat:{default:"lat"},particleLng:{default:"lng"},particleAltitude:{default:.01},particlesSize:{default:.5},particlesSizeAttenuation:{default:!0},particlesColor:{default:function(){return"white"}},particlesTexture:{}},init:function(e,t){ns(e),t.scene=e,t.dataMapper=new Ll(e,{objBindAttr:"__threeObjParticles"}).onCreateObj(function(){var n=new HS.Points(new HS.BufferGeometry,new HS.PointsMaterial);return n.__globeObjType="particles",n}).onUpdateObj(function(n,r){var s=st(t.particlesList),o=st(t.particleLat),a=st(t.particleLng),l=st(t.particleAltitude);n.geometry.setAttribute("position",Uf(s(r).map(function(c){return Object.values(cu(o(c),a(c),l(c)))}),3))})},update:function(e,t){["particlesData","particlesList","particleLat","particleLng","particleAltitude"].some(function(a){return t.hasOwnProperty(a)})&&e.dataMapper.digest(e.particlesData);var n=st(e.particlesColor),r=st(e.particlesSize),s=st(e.particlesSizeAttenuation),o=st(e.particlesTexture);e.dataMapper.entries().forEach(function(a){var l=Pr(a,2),c=l[0],u=l[1];if(u.material.size=r(c),u.material.sizeAttenuation=s(c),e.particlesTexture)u.material.color=new HS.Color(16777215),u.material.transparent=!1,u.material.alphaTest=.5,u.material.map=o(c);else{var f=n(c),d=ih(f);u.material.color=new HS.Color(Of(f)),u.material.transparent=d<1,u.material.opacity=d,u.material.alphaTest=0}})}}),FLe=window.THREE?window.THREE:{BufferGeometry:Xn},BLe=(function(i){function e(){var t,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:32;tP(this,e),t=eP(this,e),t.type="CircleLineGeometry",t.parameters={radius:n,segmentCount:r};for(var s=[],o=0;o<=r;o++){var a=(o/r-.25)*Math.PI*2;s.push({x:Math.cos(a)*n,y:Math.sin(a)*n,z:0})}return t.setFromPoints(s),t}return iP(e,i),nP(e)})(FLe.BufferGeometry),Dx=window.THREE?window.THREE:{Color:zt,Group:Br,Line:a0,LineBasicMaterial:Du,Vector3:re},OLe=g1.default.default||g1.default,lae=Kr({props:{ringsData:{default:[]},ringLat:{default:"lat"},ringLng:{default:"lng"},ringAltitude:{default:.0015},ringColor:{default:function(){return"#ffffaa"},triggerUpdate:!1},ringResolution:{default:64,triggerUpdate:!1},ringMaxRadius:{default:2,triggerUpdate:!1},ringPropagationSpeed:{default:1,triggerUpdate:!1},ringRepeatPeriod:{default:700,triggerUpdate:!1}},methods:{pauseAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.pause()},resumeAnimation:function(e){var t;(t=e.ticker)===null||t===void 0||t.resume()},_destructor:function(e){var t;(t=e.ticker)===null||t===void 0||t.dispose()}},init:function(e,t,n){var r=n.tweenGroup;ns(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Ll(e,{objBindAttr:"__threeObjRing",removeDelay:3e4}).onCreateObj(function(){var s=new Dx.Group;return s.__globeObjType="ring",s}),t.ticker=new OLe,t.ticker.onTick.add(function(s){if(t.ringsData.length){var o=st(t.ringColor),a=st(t.ringAltitude),l=st(t.ringMaxRadius),c=st(t.ringPropagationSpeed),u=st(t.ringRepeatPeriod);t.dataMapper.entries().filter(function(f){var d=Pr(f,2),A=d[1];return A}).forEach(function(f){var d=Pr(f,2),A=d[0],y=d[1];if((y.__nextRingTime||0)<=s){var w=u(A)/1e3;y.__nextRingTime=s+(w<=0?1/0:w);var S=new Dx.Line(new BLe(1,t.ringResolution),new Dx.LineBasicMaterial),T=o(A),R=T instanceof Array||T instanceof Function,P;R?T instanceof Array?(P=Tl().domain(T.map(function(z,G){return G/(T.length-1)})).range(T),S.material.transparent=T.some(function(z){return ih(z)<1})):(P=T,S.material.transparent=!0):(S.material.color=new Dx.Color(Of(T)),gLe(S.material,ih(T)));var I=_r*(1+a(A)),F=l(A),D=F*Math.PI/180,L=c(A),C=L<=0,B=function(G){var W=G.t,Y=(C?1-W:W)*D;if(S.scale.x=S.scale.y=I*Math.sin(Y),S.position.z=I*(1-Math.cos(Y)),R){var H=P(W);S.material.color=new Dx.Color(Of(H)),S.material.transparent&&(S.material.opacity=ih(H))}};if(L===0)B({t:0}),y.add(S);else{var k=Math.abs(F/L)*1e3;t.tweenGroup.add(new uo({t:0}).to({t:1},k).onUpdate(B).onStart(function(){return y.add(S)}).onComplete(function(){t.tweenGroup.remove(this),y.remove(S),Rm(S)}).start())}}})}})},update:function(e){var t=st(e.ringLat),n=st(e.ringLng),r=st(e.ringAltitude),s=e.scene.localToWorld(new Dx.Vector3(0,0,0));e.dataMapper.onUpdateObj(function(o,a){var l=t(a),c=n(a),u=r(a);Object.assign(o.position,cu(l,c,u)),o.lookAt(s)}).digest(e.ringsData)}}),ULe={0:{x_min:73,x_max:715,ha:792,o:"m 394 -29 q 153 129 242 -29 q 73 479 73 272 q 152 829 73 687 q 394 989 241 989 q 634 829 545 989 q 715 479 715 684 q 635 129 715 270 q 394 -29 546 -29 m 394 89 q 546 211 489 89 q 598 479 598 322 q 548 748 598 640 q 394 871 491 871 q 241 748 298 871 q 190 479 190 637 q 239 211 190 319 q 394 89 296 89 "},1:{x_min:215.671875,x_max:574,ha:792,o:"m 574 0 l 442 0 l 442 697 l 215 697 l 215 796 q 386 833 330 796 q 475 986 447 875 l 574 986 l 574 0 "},2:{x_min:59,x_max:731,ha:792,o:"m 731 0 l 59 0 q 197 314 59 188 q 457 487 199 315 q 598 691 598 580 q 543 819 598 772 q 411 867 488 867 q 272 811 328 867 q 209 630 209 747 l 81 630 q 182 901 81 805 q 408 986 271 986 q 629 909 536 986 q 731 694 731 826 q 613 449 731 541 q 378 316 495 383 q 201 122 235 234 l 731 122 l 731 0 "},3:{x_min:54,x_max:737,ha:792,o:"m 737 284 q 635 55 737 141 q 399 -25 541 -25 q 156 52 248 -25 q 54 308 54 140 l 185 308 q 245 147 185 202 q 395 96 302 96 q 539 140 484 96 q 602 280 602 190 q 510 429 602 390 q 324 454 451 454 l 324 565 q 487 584 441 565 q 565 719 565 617 q 515 835 565 791 q 395 879 466 879 q 255 824 307 879 q 203 661 203 769 l 78 661 q 166 909 78 822 q 387 992 250 992 q 603 921 513 992 q 701 723 701 844 q 669 607 701 656 q 578 524 637 558 q 696 434 655 499 q 737 284 737 369 "},4:{x_min:48,x_max:742.453125,ha:792,o:"m 742 243 l 602 243 l 602 0 l 476 0 l 476 243 l 48 243 l 48 368 l 476 958 l 602 958 l 602 354 l 742 354 l 742 243 m 476 354 l 476 792 l 162 354 l 476 354 "},5:{x_min:54.171875,x_max:738,ha:792,o:"m 738 314 q 626 60 738 153 q 382 -23 526 -23 q 155 47 248 -23 q 54 256 54 125 l 183 256 q 259 132 204 174 q 382 91 314 91 q 533 149 471 91 q 602 314 602 213 q 538 469 602 411 q 386 528 475 528 q 284 506 332 528 q 197 439 237 484 l 81 439 l 159 958 l 684 958 l 684 840 l 254 840 l 214 579 q 306 627 258 612 q 407 643 354 643 q 636 552 540 643 q 738 314 738 457 "},6:{x_min:53,x_max:739,ha:792,o:"m 739 312 q 633 62 739 162 q 400 -31 534 -31 q 162 78 257 -31 q 53 439 53 206 q 178 859 53 712 q 441 986 284 986 q 643 912 559 986 q 732 713 732 833 l 601 713 q 544 830 594 786 q 426 875 494 875 q 268 793 331 875 q 193 517 193 697 q 301 597 240 570 q 427 624 362 624 q 643 540 552 624 q 739 312 739 451 m 603 298 q 540 461 603 400 q 404 516 484 516 q 268 461 323 516 q 207 300 207 401 q 269 137 207 198 q 405 83 325 83 q 541 137 486 83 q 603 298 603 197 "},7:{x_min:58.71875,x_max:730.953125,ha:792,o:"m 730 839 q 469 448 560 641 q 335 0 378 255 l 192 0 q 328 441 235 252 q 593 830 421 630 l 58 830 l 58 958 l 730 958 l 730 839 "},8:{x_min:55,x_max:736,ha:792,o:"m 571 527 q 694 424 652 491 q 736 280 736 358 q 648 71 736 158 q 395 -26 551 -26 q 142 69 238 -26 q 55 279 55 157 q 96 425 55 359 q 220 527 138 491 q 120 615 153 562 q 88 726 88 668 q 171 904 88 827 q 395 986 261 986 q 618 905 529 986 q 702 727 702 830 q 670 616 702 667 q 571 527 638 565 m 394 565 q 519 610 475 565 q 563 717 563 655 q 521 823 563 781 q 392 872 474 872 q 265 824 312 872 q 224 720 224 783 q 265 613 224 656 q 394 565 312 565 m 395 91 q 545 150 488 91 q 597 280 597 204 q 546 408 597 355 q 395 465 492 465 q 244 408 299 465 q 194 280 194 356 q 244 150 194 203 q 395 91 299 91 "},9:{x_min:53,x_max:739,ha:792,o:"m 739 524 q 619 94 739 241 q 362 -32 516 -32 q 150 47 242 -32 q 59 244 59 126 l 191 244 q 246 129 191 176 q 373 82 301 82 q 526 161 466 82 q 597 440 597 255 q 363 334 501 334 q 130 432 216 334 q 53 650 53 521 q 134 880 53 786 q 383 986 226 986 q 659 841 566 986 q 739 524 739 719 m 388 449 q 535 514 480 449 q 585 658 585 573 q 535 805 585 744 q 388 873 480 873 q 242 809 294 873 q 191 658 191 745 q 239 514 191 572 q 388 449 292 449 "},\u03BF:{x_min:0,x_max:712,ha:815,o:"m 356 -25 q 96 88 192 -25 q 0 368 0 201 q 92 642 0 533 q 356 761 192 761 q 617 644 517 761 q 712 368 712 533 q 619 91 712 201 q 356 -25 520 -25 m 356 85 q 527 175 465 85 q 583 369 583 255 q 528 562 583 484 q 356 651 466 651 q 189 560 250 651 q 135 369 135 481 q 187 177 135 257 q 356 85 250 85 "},S:{x_min:0,x_max:788,ha:890,o:"m 788 291 q 662 54 788 144 q 397 -26 550 -26 q 116 68 226 -26 q 0 337 0 168 l 131 337 q 200 152 131 220 q 384 85 269 85 q 557 129 479 85 q 650 270 650 183 q 490 429 650 379 q 194 513 341 470 q 33 739 33 584 q 142 964 33 881 q 388 1041 242 1041 q 644 957 543 1041 q 756 716 756 867 l 625 716 q 561 874 625 816 q 395 933 497 933 q 243 891 309 933 q 164 759 164 841 q 325 609 164 656 q 625 526 475 568 q 788 291 788 454 "},"\xA6":{x_min:343,x_max:449,ha:792,o:"m 449 462 l 343 462 l 343 986 l 449 986 l 449 462 m 449 -242 l 343 -242 l 343 280 l 449 280 l 449 -242 "},"/":{x_min:183.25,x_max:608.328125,ha:792,o:"m 608 1041 l 266 -129 l 183 -129 l 520 1041 l 608 1041 "},\u03A4:{x_min:-.4375,x_max:777.453125,ha:839,o:"m 777 893 l 458 893 l 458 0 l 319 0 l 319 892 l 0 892 l 0 1013 l 777 1013 l 777 893 "},y:{x_min:0,x_max:684.78125,ha:771,o:"m 684 738 l 388 -83 q 311 -216 356 -167 q 173 -279 252 -279 q 97 -266 133 -279 l 97 -149 q 132 -155 109 -151 q 168 -160 155 -160 q 240 -114 213 -160 q 274 -26 248 -98 l 0 738 l 137 737 l 341 139 l 548 737 l 684 738 "},\u03A0:{x_min:0,x_max:803,ha:917,o:"m 803 0 l 667 0 l 667 886 l 140 886 l 140 0 l 0 0 l 0 1012 l 803 1012 l 803 0 "},\u0390:{x_min:-111,x_max:339,ha:361,o:"m 339 800 l 229 800 l 229 925 l 339 925 l 339 800 m -1 800 l -111 800 l -111 925 l -1 925 l -1 800 m 284 3 q 233 -10 258 -5 q 182 -15 207 -15 q 85 26 119 -15 q 42 200 42 79 l 42 737 l 167 737 l 168 215 q 172 141 168 157 q 226 101 183 101 q 248 103 239 101 q 284 112 257 104 l 284 3 m 302 1040 l 113 819 l 30 819 l 165 1040 l 302 1040 "},g:{x_min:0,x_max:686,ha:838,o:"m 686 34 q 586 -213 686 -121 q 331 -306 487 -306 q 131 -252 216 -306 q 31 -84 31 -190 l 155 -84 q 228 -174 166 -138 q 345 -207 284 -207 q 514 -109 454 -207 q 564 89 564 -27 q 461 6 521 36 q 335 -23 401 -23 q 88 100 184 -23 q 0 370 0 215 q 87 634 0 522 q 330 758 183 758 q 457 728 398 758 q 564 644 515 699 l 564 737 l 686 737 l 686 34 m 582 367 q 529 560 582 481 q 358 652 468 652 q 189 561 250 652 q 135 369 135 482 q 189 176 135 255 q 361 85 251 85 q 529 176 468 85 q 582 367 582 255 "},"\xB2":{x_min:0,x_max:442,ha:539,o:"m 442 383 l 0 383 q 91 566 0 492 q 260 668 176 617 q 354 798 354 727 q 315 875 354 845 q 227 905 277 905 q 136 869 173 905 q 99 761 99 833 l 14 761 q 82 922 14 864 q 232 974 141 974 q 379 926 316 974 q 442 797 442 878 q 351 635 442 704 q 183 539 321 611 q 92 455 92 491 l 442 455 l 442 383 "},"\u2013":{x_min:0,x_max:705.5625,ha:803,o:"m 705 334 l 0 334 l 0 410 l 705 410 l 705 334 "},\u039A:{x_min:0,x_max:819.5625,ha:893,o:"m 819 0 l 650 0 l 294 509 l 139 356 l 139 0 l 0 0 l 0 1013 l 139 1013 l 139 526 l 626 1013 l 809 1013 l 395 600 l 819 0 "},\u0192:{x_min:-46.265625,x_max:392,ha:513,o:"m 392 651 l 259 651 l 79 -279 l -46 -278 l 134 651 l 14 651 l 14 751 l 135 751 q 151 948 135 900 q 304 1041 185 1041 q 334 1040 319 1041 q 392 1034 348 1039 l 392 922 q 337 931 360 931 q 271 883 287 931 q 260 793 260 853 l 260 751 l 392 751 l 392 651 "},e:{x_min:0,x_max:714,ha:813,o:"m 714 326 l 140 326 q 200 157 140 227 q 359 87 260 87 q 488 130 431 87 q 561 245 545 174 l 697 245 q 577 48 670 123 q 358 -26 484 -26 q 97 85 195 -26 q 0 363 0 197 q 94 642 0 529 q 358 765 195 765 q 626 627 529 765 q 714 326 714 503 m 576 429 q 507 583 564 522 q 355 650 445 650 q 206 583 266 650 q 140 429 152 522 l 576 429 "},\u03CC:{x_min:0,x_max:712,ha:815,o:"m 356 -25 q 94 91 194 -25 q 0 368 0 202 q 92 642 0 533 q 356 761 192 761 q 617 644 517 761 q 712 368 712 533 q 619 91 712 201 q 356 -25 520 -25 m 356 85 q 527 175 465 85 q 583 369 583 255 q 528 562 583 484 q 356 651 466 651 q 189 560 250 651 q 135 369 135 481 q 187 177 135 257 q 356 85 250 85 m 576 1040 l 387 819 l 303 819 l 438 1040 l 576 1040 "},J:{x_min:0,x_max:588,ha:699,o:"m 588 279 q 287 -26 588 -26 q 58 73 126 -26 q 0 327 0 158 l 133 327 q 160 172 133 227 q 288 96 198 96 q 426 171 391 96 q 449 336 449 219 l 449 1013 l 588 1013 l 588 279 "},"\xBB":{x_min:-1,x_max:503,ha:601,o:"m 503 302 l 280 136 l 281 256 l 429 373 l 281 486 l 280 608 l 503 440 l 503 302 m 221 302 l 0 136 l 0 255 l 145 372 l 0 486 l -1 608 l 221 440 l 221 302 "},"\xA9":{x_min:-3,x_max:1008,ha:1106,o:"m 502 -7 q 123 151 263 -7 q -3 501 -3 294 q 123 851 -3 706 q 502 1011 263 1011 q 881 851 739 1011 q 1008 501 1008 708 q 883 151 1008 292 q 502 -7 744 -7 m 502 60 q 830 197 709 60 q 940 501 940 322 q 831 805 940 681 q 502 944 709 944 q 174 805 296 944 q 65 501 65 680 q 173 197 65 320 q 502 60 294 60 m 741 394 q 661 246 731 302 q 496 190 591 190 q 294 285 369 190 q 228 497 228 370 q 295 714 228 625 q 499 813 370 813 q 656 762 588 813 q 733 625 724 711 l 634 625 q 589 704 629 673 q 498 735 550 735 q 377 666 421 735 q 334 504 334 597 q 374 340 334 408 q 490 272 415 272 q 589 304 549 272 q 638 394 628 337 l 741 394 "},\u03CE:{x_min:0,x_max:922,ha:1030,o:"m 687 1040 l 498 819 l 415 819 l 549 1040 l 687 1040 m 922 339 q 856 97 922 203 q 650 -26 780 -26 q 538 9 587 -26 q 461 103 489 44 q 387 12 436 46 q 277 -22 339 -22 q 69 97 147 -22 q 0 338 0 202 q 45 551 0 444 q 161 737 84 643 l 302 737 q 175 552 219 647 q 124 336 124 446 q 155 179 124 248 q 275 88 197 88 q 375 163 341 88 q 400 294 400 219 l 400 572 l 524 572 l 524 294 q 561 135 524 192 q 643 88 591 88 q 762 182 719 88 q 797 341 797 257 q 745 555 797 450 q 619 737 705 637 l 760 737 q 874 551 835 640 q 922 339 922 444 "},"^":{x_min:193.0625,x_max:598.609375,ha:792,o:"m 598 772 l 515 772 l 395 931 l 277 772 l 193 772 l 326 1013 l 462 1013 l 598 772 "},"\xAB":{x_min:0,x_max:507.203125,ha:604,o:"m 506 136 l 284 302 l 284 440 l 506 608 l 507 485 l 360 371 l 506 255 l 506 136 m 222 136 l 0 302 l 0 440 l 222 608 l 221 486 l 73 373 l 222 256 l 222 136 "},D:{x_min:0,x_max:828,ha:935,o:"m 389 1013 q 714 867 593 1013 q 828 521 828 729 q 712 161 828 309 q 382 0 587 0 l 0 0 l 0 1013 l 389 1013 m 376 124 q 607 247 523 124 q 681 510 681 355 q 607 771 681 662 q 376 896 522 896 l 139 896 l 139 124 l 376 124 "},"\u2219":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 "},\u00FF:{x_min:0,x_max:47,ha:125,o:"m 47 3 q 37 -7 47 -7 q 28 0 30 -7 q 39 -4 32 -4 q 45 3 45 -1 l 37 0 q 28 9 28 0 q 39 19 28 19 l 47 16 l 47 19 l 47 3 m 37 1 q 44 8 44 1 q 37 16 44 16 q 30 8 30 16 q 37 1 30 1 m 26 1 l 23 22 l 14 0 l 3 22 l 3 3 l 0 25 l 13 1 l 22 25 l 26 1 "},w:{x_min:0,x_max:1009.71875,ha:1100,o:"m 1009 738 l 783 0 l 658 0 l 501 567 l 345 0 l 222 0 l 0 738 l 130 738 l 284 174 l 432 737 l 576 738 l 721 173 l 881 737 l 1009 738 "},$:{x_min:0,x_max:700,ha:793,o:"m 664 717 l 542 717 q 490 825 531 785 q 381 872 450 865 l 381 551 q 620 446 540 522 q 700 241 700 370 q 618 45 700 116 q 381 -25 536 -25 l 381 -152 l 307 -152 l 307 -25 q 81 62 162 -25 q 0 297 0 149 l 124 297 q 169 146 124 204 q 307 81 215 89 l 307 441 q 80 536 148 469 q 13 725 13 603 q 96 910 13 839 q 307 982 180 982 l 307 1077 l 381 1077 l 381 982 q 574 917 494 982 q 664 717 664 845 m 307 565 l 307 872 q 187 831 233 872 q 142 724 142 791 q 180 618 142 656 q 307 565 218 580 m 381 76 q 562 237 562 96 q 517 361 562 313 q 381 423 472 409 l 381 76 "},"\\":{x_min:-.015625,x_max:425.0625,ha:522,o:"m 425 -129 l 337 -129 l 0 1041 l 83 1041 l 425 -129 "},\u00B5:{x_min:0,x_max:697.21875,ha:747,o:"m 697 -4 q 629 -14 658 -14 q 498 97 513 -14 q 422 9 470 41 q 313 -23 374 -23 q 207 4 258 -23 q 119 81 156 32 l 119 -278 l 0 -278 l 0 738 l 124 738 l 124 343 q 165 173 124 246 q 308 83 216 83 q 452 178 402 83 q 493 359 493 255 l 493 738 l 617 738 l 617 214 q 623 136 617 160 q 673 92 637 92 q 697 96 684 92 l 697 -4 "},\u0399:{x_min:42,x_max:181,ha:297,o:"m 181 0 l 42 0 l 42 1013 l 181 1013 l 181 0 "},\u038E:{x_min:0,x_max:1144.5,ha:1214,o:"m 1144 1012 l 807 416 l 807 0 l 667 0 l 667 416 l 325 1012 l 465 1012 l 736 533 l 1004 1012 l 1144 1012 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},"\u2019":{x_min:0,x_max:139,ha:236,o:"m 139 851 q 102 737 139 784 q 0 669 65 690 l 0 734 q 59 787 42 741 q 72 873 72 821 l 0 873 l 0 1013 l 139 1013 l 139 851 "},\u039D:{x_min:0,x_max:801,ha:915,o:"m 801 0 l 651 0 l 131 822 l 131 0 l 0 0 l 0 1013 l 151 1013 l 670 191 l 670 1013 l 801 1013 l 801 0 "},"-":{x_min:8.71875,x_max:350.390625,ha:478,o:"m 350 317 l 8 317 l 8 428 l 350 428 l 350 317 "},Q:{x_min:0,x_max:968,ha:1072,o:"m 954 5 l 887 -79 l 744 35 q 622 -11 687 2 q 483 -26 556 -26 q 127 130 262 -26 q 0 504 0 279 q 127 880 0 728 q 484 1041 262 1041 q 841 884 708 1041 q 968 507 968 735 q 933 293 968 398 q 832 104 899 188 l 954 5 m 723 191 q 802 330 777 248 q 828 499 828 412 q 744 790 828 673 q 483 922 650 922 q 228 791 322 922 q 142 505 142 673 q 227 221 142 337 q 487 91 323 91 q 632 123 566 91 l 520 215 l 587 301 l 723 191 "},\u03C2:{x_min:1,x_max:676.28125,ha:740,o:"m 676 460 l 551 460 q 498 595 542 546 q 365 651 448 651 q 199 578 263 651 q 136 401 136 505 q 266 178 136 241 q 508 106 387 142 q 640 -50 640 62 q 625 -158 640 -105 q 583 -278 611 -211 l 465 -278 q 498 -182 490 -211 q 515 -80 515 -126 q 381 12 515 -15 q 134 91 197 51 q 1 388 1 179 q 100 651 1 542 q 354 761 199 761 q 587 680 498 761 q 676 460 676 599 "},M:{x_min:0,x_max:954,ha:1067,o:"m 954 0 l 819 0 l 819 869 l 537 0 l 405 0 l 128 866 l 128 0 l 0 0 l 0 1013 l 200 1013 l 472 160 l 757 1013 l 954 1013 l 954 0 "},\u03A8:{x_min:0,x_max:1006,ha:1094,o:"m 1006 678 q 914 319 1006 429 q 571 200 814 200 l 571 0 l 433 0 l 433 200 q 92 319 194 200 q 0 678 0 429 l 0 1013 l 139 1013 l 139 679 q 191 417 139 492 q 433 326 255 326 l 433 1013 l 571 1013 l 571 326 l 580 326 q 813 423 747 326 q 868 679 868 502 l 868 1013 l 1006 1013 l 1006 678 "},C:{x_min:0,x_max:886,ha:944,o:"m 886 379 q 760 87 886 201 q 455 -26 634 -26 q 112 136 236 -26 q 0 509 0 283 q 118 882 0 737 q 469 1041 245 1041 q 748 955 630 1041 q 879 708 879 859 l 745 708 q 649 862 724 805 q 473 920 573 920 q 219 791 312 920 q 136 509 136 675 q 217 229 136 344 q 470 99 311 99 q 672 179 591 99 q 753 379 753 259 l 886 379 "},"!":{x_min:0,x_max:138,ha:236,o:"m 138 684 q 116 409 138 629 q 105 244 105 299 l 33 244 q 16 465 33 313 q 0 684 0 616 l 0 1013 l 138 1013 l 138 684 m 138 0 l 0 0 l 0 151 l 138 151 l 138 0 "},"{":{x_min:0,x_max:480.5625,ha:578,o:"m 480 -286 q 237 -213 303 -286 q 187 -45 187 -159 q 194 48 187 -15 q 201 141 201 112 q 164 264 201 225 q 0 314 118 314 l 0 417 q 164 471 119 417 q 201 605 201 514 q 199 665 201 644 q 193 772 193 769 q 241 941 193 887 q 480 1015 308 1015 l 480 915 q 336 866 375 915 q 306 742 306 828 q 310 662 306 717 q 314 577 314 606 q 288 452 314 500 q 176 365 256 391 q 289 275 257 337 q 314 143 314 226 q 313 84 314 107 q 310 -11 310 -5 q 339 -131 310 -94 q 480 -182 377 -182 l 480 -286 "},X:{x_min:-.015625,x_max:854.15625,ha:940,o:"m 854 0 l 683 0 l 423 409 l 166 0 l 0 0 l 347 519 l 18 1013 l 186 1013 l 428 637 l 675 1013 l 836 1013 l 504 520 l 854 0 "},"#":{x_min:0,x_max:963.890625,ha:1061,o:"m 963 690 l 927 590 l 719 590 l 655 410 l 876 410 l 840 310 l 618 310 l 508 -3 l 393 -2 l 506 309 l 329 310 l 215 -2 l 102 -3 l 212 310 l 0 310 l 36 410 l 248 409 l 312 590 l 86 590 l 120 690 l 347 690 l 459 1006 l 573 1006 l 462 690 l 640 690 l 751 1006 l 865 1006 l 754 690 l 963 690 m 606 590 l 425 590 l 362 410 l 543 410 l 606 590 "},\u03B9:{x_min:42,x_max:284,ha:361,o:"m 284 3 q 233 -10 258 -5 q 182 -15 207 -15 q 85 26 119 -15 q 42 200 42 79 l 42 738 l 167 738 l 168 215 q 172 141 168 157 q 226 101 183 101 q 248 103 239 101 q 284 112 257 104 l 284 3 "},\u0386:{x_min:0,x_max:906.953125,ha:982,o:"m 283 1040 l 88 799 l 5 799 l 145 1040 l 283 1040 m 906 0 l 756 0 l 650 303 l 251 303 l 143 0 l 0 0 l 376 1012 l 529 1012 l 906 0 m 609 421 l 452 866 l 293 421 l 609 421 "},")":{x_min:0,x_max:318,ha:415,o:"m 318 365 q 257 25 318 191 q 87 -290 197 -141 l 0 -290 q 140 21 93 -128 q 193 360 193 189 q 141 704 193 537 q 0 1024 97 850 l 87 1024 q 257 706 197 871 q 318 365 318 542 "},\u03B5:{x_min:0,x_max:634.71875,ha:714,o:"m 634 234 q 527 38 634 110 q 300 -25 433 -25 q 98 29 183 -25 q 0 204 0 93 q 37 314 0 265 q 128 390 67 353 q 56 460 82 419 q 26 555 26 505 q 114 712 26 654 q 295 763 191 763 q 499 700 416 763 q 589 515 589 631 l 478 515 q 419 618 464 580 q 307 657 374 657 q 207 630 253 657 q 151 547 151 598 q 238 445 151 469 q 389 434 280 434 l 389 331 l 349 331 q 206 315 255 331 q 125 210 125 287 q 183 107 125 145 q 302 76 233 76 q 436 117 379 76 q 509 234 493 159 l 634 234 "},\u0394:{x_min:0,x_max:952.78125,ha:1028,o:"m 952 0 l 0 0 l 400 1013 l 551 1013 l 952 0 m 762 124 l 476 867 l 187 124 l 762 124 "},"}":{x_min:0,x_max:481,ha:578,o:"m 481 314 q 318 262 364 314 q 282 136 282 222 q 284 65 282 97 q 293 -58 293 -48 q 241 -217 293 -166 q 0 -286 174 -286 l 0 -182 q 143 -130 105 -182 q 171 -2 171 -93 q 168 81 171 22 q 165 144 165 140 q 188 275 165 229 q 306 365 220 339 q 191 455 224 391 q 165 588 165 505 q 168 681 165 624 q 171 742 171 737 q 141 865 171 827 q 0 915 102 915 l 0 1015 q 243 942 176 1015 q 293 773 293 888 q 287 675 293 741 q 282 590 282 608 q 318 466 282 505 q 481 417 364 417 l 481 314 "},"\u2030":{x_min:-3,x_max:1672,ha:1821,o:"m 846 0 q 664 76 732 0 q 603 244 603 145 q 662 412 603 344 q 846 489 729 489 q 1027 412 959 489 q 1089 244 1089 343 q 1029 76 1089 144 q 846 0 962 0 m 845 103 q 945 143 910 103 q 981 243 981 184 q 947 340 981 301 q 845 385 910 385 q 745 342 782 385 q 709 243 709 300 q 742 147 709 186 q 845 103 781 103 m 888 986 l 284 -25 l 199 -25 l 803 986 l 888 986 m 241 468 q 58 545 126 468 q -3 715 -3 615 q 56 881 -3 813 q 238 958 124 958 q 421 881 353 958 q 483 712 483 813 q 423 544 483 612 q 241 468 356 468 m 241 855 q 137 811 175 855 q 100 710 100 768 q 136 612 100 653 q 240 572 172 572 q 344 614 306 572 q 382 713 382 656 q 347 810 382 771 q 241 855 308 855 m 1428 0 q 1246 76 1314 0 q 1185 244 1185 145 q 1244 412 1185 344 q 1428 489 1311 489 q 1610 412 1542 489 q 1672 244 1672 343 q 1612 76 1672 144 q 1428 0 1545 0 m 1427 103 q 1528 143 1492 103 q 1564 243 1564 184 q 1530 340 1564 301 q 1427 385 1492 385 q 1327 342 1364 385 q 1291 243 1291 300 q 1324 147 1291 186 q 1427 103 1363 103 "},a:{x_min:0,x_max:698.609375,ha:794,o:"m 698 0 q 661 -12 679 -7 q 615 -17 643 -17 q 536 12 564 -17 q 500 96 508 41 q 384 6 456 37 q 236 -25 312 -25 q 65 31 130 -25 q 0 194 0 88 q 118 390 0 334 q 328 435 180 420 q 488 483 476 451 q 495 523 495 504 q 442 619 495 584 q 325 654 389 654 q 209 617 257 654 q 152 513 161 580 l 33 513 q 123 705 33 633 q 332 772 207 772 q 528 712 448 772 q 617 531 617 645 l 617 163 q 624 108 617 126 q 664 90 632 90 l 698 94 l 698 0 m 491 262 l 491 372 q 272 329 350 347 q 128 201 128 294 q 166 113 128 144 q 264 83 205 83 q 414 130 346 83 q 491 262 491 183 "},"\u2014":{x_min:0,x_max:941.671875,ha:1039,o:"m 941 334 l 0 334 l 0 410 l 941 410 l 941 334 "},"=":{x_min:8.71875,x_max:780.953125,ha:792,o:"m 780 510 l 8 510 l 8 606 l 780 606 l 780 510 m 780 235 l 8 235 l 8 332 l 780 332 l 780 235 "},N:{x_min:0,x_max:801,ha:914,o:"m 801 0 l 651 0 l 131 823 l 131 0 l 0 0 l 0 1013 l 151 1013 l 670 193 l 670 1013 l 801 1013 l 801 0 "},\u03C1:{x_min:0,x_max:712,ha:797,o:"m 712 369 q 620 94 712 207 q 362 -26 521 -26 q 230 2 292 -26 q 119 83 167 30 l 119 -278 l 0 -278 l 0 362 q 91 643 0 531 q 355 764 190 764 q 617 647 517 764 q 712 369 712 536 m 583 366 q 530 559 583 480 q 359 651 469 651 q 190 562 252 651 q 135 370 135 483 q 189 176 135 257 q 359 85 250 85 q 528 175 466 85 q 583 366 583 254 "},"\xAF":{x_min:0,x_max:941.671875,ha:938,o:"m 941 1033 l 0 1033 l 0 1109 l 941 1109 l 941 1033 "},Z:{x_min:0,x_max:779,ha:849,o:"m 779 0 l 0 0 l 0 113 l 621 896 l 40 896 l 40 1013 l 779 1013 l 778 887 l 171 124 l 779 124 l 779 0 "},u:{x_min:0,x_max:617,ha:729,o:"m 617 0 l 499 0 l 499 110 q 391 10 460 45 q 246 -25 322 -25 q 61 58 127 -25 q 0 258 0 136 l 0 738 l 125 738 l 125 284 q 156 148 125 202 q 273 82 197 82 q 433 165 369 82 q 493 340 493 243 l 493 738 l 617 738 l 617 0 "},k:{x_min:0,x_max:612.484375,ha:697,o:"m 612 738 l 338 465 l 608 0 l 469 0 l 251 382 l 121 251 l 121 0 l 0 0 l 0 1013 l 121 1013 l 121 402 l 456 738 l 612 738 "},\u0397:{x_min:0,x_max:803,ha:917,o:"m 803 0 l 667 0 l 667 475 l 140 475 l 140 0 l 0 0 l 0 1013 l 140 1013 l 140 599 l 667 599 l 667 1013 l 803 1013 l 803 0 "},\u0391:{x_min:0,x_max:906.953125,ha:985,o:"m 906 0 l 756 0 l 650 303 l 251 303 l 143 0 l 0 0 l 376 1013 l 529 1013 l 906 0 m 609 421 l 452 866 l 293 421 l 609 421 "},s:{x_min:0,x_max:604,ha:697,o:"m 604 217 q 501 36 604 104 q 292 -23 411 -23 q 86 43 166 -23 q 0 238 0 114 l 121 237 q 175 122 121 164 q 300 85 223 85 q 415 112 363 85 q 479 207 479 147 q 361 309 479 276 q 140 372 141 370 q 21 544 21 426 q 111 708 21 647 q 298 761 190 761 q 492 705 413 761 q 583 531 583 643 l 462 531 q 412 625 462 594 q 298 657 363 657 q 199 636 242 657 q 143 558 143 608 q 262 454 143 486 q 484 394 479 397 q 604 217 604 341 "},B:{x_min:0,x_max:778,ha:876,o:"m 580 546 q 724 469 670 535 q 778 311 778 403 q 673 83 778 171 q 432 0 575 0 l 0 0 l 0 1013 l 411 1013 q 629 957 541 1013 q 732 768 732 892 q 691 633 732 693 q 580 546 650 572 m 393 899 l 139 899 l 139 588 l 379 588 q 521 624 462 588 q 592 744 592 667 q 531 859 592 819 q 393 899 471 899 m 419 124 q 566 169 504 124 q 635 303 635 219 q 559 436 635 389 q 402 477 494 477 l 139 477 l 139 124 l 419 124 "},"\u2026":{x_min:0,x_max:614,ha:708,o:"m 142 0 l 0 0 l 0 151 l 142 151 l 142 0 m 378 0 l 236 0 l 236 151 l 378 151 l 378 0 m 614 0 l 472 0 l 472 151 l 614 151 l 614 0 "},"?":{x_min:0,x_max:607,ha:704,o:"m 607 777 q 543 599 607 674 q 422 474 482 537 q 357 272 357 391 l 236 272 q 297 487 236 395 q 411 619 298 490 q 474 762 474 691 q 422 885 474 838 q 301 933 371 933 q 179 880 228 933 q 124 706 124 819 l 0 706 q 94 963 0 872 q 302 1044 177 1044 q 511 973 423 1044 q 607 777 607 895 m 370 0 l 230 0 l 230 151 l 370 151 l 370 0 "},H:{x_min:0,x_max:803,ha:915,o:"m 803 0 l 667 0 l 667 475 l 140 475 l 140 0 l 0 0 l 0 1013 l 140 1013 l 140 599 l 667 599 l 667 1013 l 803 1013 l 803 0 "},\u03BD:{x_min:0,x_max:675,ha:761,o:"m 675 738 l 404 0 l 272 0 l 0 738 l 133 738 l 340 147 l 541 738 l 675 738 "},c:{x_min:1,x_max:701.390625,ha:775,o:"m 701 264 q 584 53 681 133 q 353 -26 487 -26 q 91 91 188 -26 q 1 370 1 201 q 92 645 1 537 q 353 761 190 761 q 572 688 479 761 q 690 493 666 615 l 556 493 q 487 606 545 562 q 356 650 428 650 q 186 563 246 650 q 134 372 134 487 q 188 179 134 258 q 359 88 250 88 q 492 136 437 88 q 566 264 548 185 l 701 264 "},"\xB6":{x_min:0,x_max:566.671875,ha:678,o:"m 21 892 l 52 892 l 98 761 l 145 892 l 176 892 l 178 741 l 157 741 l 157 867 l 108 741 l 88 741 l 40 871 l 40 741 l 21 741 l 21 892 m 308 854 l 308 731 q 252 691 308 691 q 227 691 240 691 q 207 696 213 695 l 207 712 l 253 706 q 288 733 288 706 l 288 763 q 244 741 279 741 q 193 797 193 741 q 261 860 193 860 q 287 860 273 860 q 308 854 302 855 m 288 842 l 263 843 q 213 796 213 843 q 248 756 213 756 q 288 796 288 756 l 288 842 m 566 988 l 502 988 l 502 -1 l 439 -1 l 439 988 l 317 988 l 317 -1 l 252 -1 l 252 602 q 81 653 155 602 q 0 805 0 711 q 101 989 0 918 q 309 1053 194 1053 l 566 1053 l 566 988 "},\u03B2:{x_min:0,x_max:660,ha:745,o:"m 471 550 q 610 450 561 522 q 660 280 660 378 q 578 64 660 151 q 367 -22 497 -22 q 239 5 299 -22 q 126 82 178 32 l 126 -278 l 0 -278 l 0 593 q 54 903 0 801 q 318 1042 127 1042 q 519 964 436 1042 q 603 771 603 887 q 567 644 603 701 q 471 550 532 586 m 337 79 q 476 138 418 79 q 535 279 535 198 q 427 437 535 386 q 226 477 344 477 l 226 583 q 398 620 329 583 q 486 762 486 668 q 435 884 486 833 q 312 935 384 935 q 169 861 219 935 q 126 698 126 797 l 126 362 q 170 169 126 242 q 337 79 224 79 "},\u039C:{x_min:0,x_max:954,ha:1068,o:"m 954 0 l 819 0 l 819 868 l 537 0 l 405 0 l 128 865 l 128 0 l 0 0 l 0 1013 l 199 1013 l 472 158 l 758 1013 l 954 1013 l 954 0 "},\u038C:{x_min:.109375,x_max:1120,ha:1217,o:"m 1120 505 q 994 132 1120 282 q 642 -29 861 -29 q 290 130 422 -29 q 167 505 167 280 q 294 883 167 730 q 650 1046 430 1046 q 999 882 868 1046 q 1120 505 1120 730 m 977 504 q 896 784 977 669 q 644 915 804 915 q 391 785 484 915 q 307 504 307 669 q 391 224 307 339 q 644 95 486 95 q 894 224 803 95 q 977 504 977 339 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},\u0389:{x_min:0,x_max:1158,ha:1275,o:"m 1158 0 l 1022 0 l 1022 475 l 496 475 l 496 0 l 356 0 l 356 1012 l 496 1012 l 496 599 l 1022 599 l 1022 1012 l 1158 1012 l 1158 0 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},"\u2022":{x_min:0,x_max:663.890625,ha:775,o:"m 663 529 q 566 293 663 391 q 331 196 469 196 q 97 294 194 196 q 0 529 0 393 q 96 763 0 665 q 331 861 193 861 q 566 763 469 861 q 663 529 663 665 "},"\xA5":{x_min:.1875,x_max:819.546875,ha:886,o:"m 563 561 l 697 561 l 696 487 l 520 487 l 482 416 l 482 380 l 697 380 l 695 308 l 482 308 l 482 0 l 342 0 l 342 308 l 125 308 l 125 380 l 342 380 l 342 417 l 303 487 l 125 487 l 125 561 l 258 561 l 0 1013 l 140 1013 l 411 533 l 679 1013 l 819 1013 l 563 561 "},"(":{x_min:0,x_max:318.0625,ha:415,o:"m 318 -290 l 230 -290 q 61 23 122 -142 q 0 365 0 190 q 62 712 0 540 q 230 1024 119 869 l 318 1024 q 175 705 219 853 q 125 360 125 542 q 176 22 125 187 q 318 -290 223 -127 "},U:{x_min:0,x_max:796,ha:904,o:"m 796 393 q 681 93 796 212 q 386 -25 566 -25 q 101 95 208 -25 q 0 393 0 211 l 0 1013 l 138 1013 l 138 391 q 204 191 138 270 q 394 107 276 107 q 586 191 512 107 q 656 391 656 270 l 656 1013 l 796 1013 l 796 393 "},\u03B3:{x_min:.5,x_max:744.953125,ha:822,o:"m 744 737 l 463 54 l 463 -278 l 338 -278 l 338 54 l 154 495 q 104 597 124 569 q 13 651 67 651 l 0 651 l 0 751 l 39 753 q 168 711 121 753 q 242 594 207 676 l 403 208 l 617 737 l 744 737 "},\u03B1:{x_min:0,x_max:765.5625,ha:809,o:"m 765 -4 q 698 -14 726 -14 q 564 97 586 -14 q 466 7 525 40 q 337 -26 407 -26 q 88 98 186 -26 q 0 369 0 212 q 88 637 0 525 q 337 760 184 760 q 465 728 407 760 q 563 637 524 696 l 563 739 l 685 739 l 685 222 q 693 141 685 168 q 748 94 708 94 q 765 96 760 94 l 765 -4 m 584 371 q 531 562 584 485 q 360 653 470 653 q 192 566 254 653 q 135 379 135 489 q 186 181 135 261 q 358 84 247 84 q 528 176 465 84 q 584 371 584 260 "},F:{x_min:0,x_max:683.328125,ha:717,o:"m 683 888 l 140 888 l 140 583 l 613 583 l 613 458 l 140 458 l 140 0 l 0 0 l 0 1013 l 683 1013 l 683 888 "},"\xAD":{x_min:0,x_max:705.5625,ha:803,o:"m 705 334 l 0 334 l 0 410 l 705 410 l 705 334 "},":":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 m 142 0 l 0 0 l 0 151 l 142 151 l 142 0 "},\u03A7:{x_min:0,x_max:854.171875,ha:935,o:"m 854 0 l 683 0 l 423 409 l 166 0 l 0 0 l 347 519 l 18 1013 l 186 1013 l 427 637 l 675 1013 l 836 1013 l 504 521 l 854 0 "},"*":{x_min:116,x_max:674,ha:792,o:"m 674 768 l 475 713 l 610 544 l 517 477 l 394 652 l 272 478 l 178 544 l 314 713 l 116 766 l 153 876 l 341 812 l 342 1013 l 446 1013 l 446 811 l 635 874 l 674 768 "},"\u2020":{x_min:0,x_max:777,ha:835,o:"m 458 804 l 777 804 l 777 683 l 458 683 l 458 0 l 319 0 l 319 681 l 0 683 l 0 804 l 319 804 l 319 1015 l 458 1013 l 458 804 "},"\xB0":{x_min:0,x_max:347,ha:444,o:"m 173 802 q 43 856 91 802 q 0 977 0 905 q 45 1101 0 1049 q 173 1153 90 1153 q 303 1098 255 1153 q 347 977 347 1049 q 303 856 347 905 q 173 802 256 802 m 173 884 q 238 910 214 884 q 262 973 262 937 q 239 1038 262 1012 q 173 1064 217 1064 q 108 1037 132 1064 q 85 973 85 1010 q 108 910 85 937 q 173 884 132 884 "},V:{x_min:0,x_max:862.71875,ha:940,o:"m 862 1013 l 505 0 l 361 0 l 0 1013 l 143 1013 l 434 165 l 718 1012 l 862 1013 "},\u039E:{x_min:0,x_max:734.71875,ha:763,o:"m 723 889 l 9 889 l 9 1013 l 723 1013 l 723 889 m 673 463 l 61 463 l 61 589 l 673 589 l 673 463 m 734 0 l 0 0 l 0 124 l 734 124 l 734 0 "},"\xA0":{x_min:0,x_max:0,ha:853},\u03AB:{x_min:.328125,x_max:819.515625,ha:889,o:"m 588 1046 l 460 1046 l 460 1189 l 588 1189 l 588 1046 m 360 1046 l 232 1046 l 232 1189 l 360 1189 l 360 1046 m 819 1012 l 482 416 l 482 0 l 342 0 l 342 416 l 0 1012 l 140 1012 l 411 533 l 679 1012 l 819 1012 "},"\u201D":{x_min:0,x_max:347,ha:454,o:"m 139 851 q 102 737 139 784 q 0 669 65 690 l 0 734 q 59 787 42 741 q 72 873 72 821 l 0 873 l 0 1013 l 139 1013 l 139 851 m 347 851 q 310 737 347 784 q 208 669 273 690 l 208 734 q 267 787 250 741 q 280 873 280 821 l 208 873 l 208 1013 l 347 1013 l 347 851 "},"@":{x_min:0,x_max:1260,ha:1357,o:"m 1098 -45 q 877 -160 1001 -117 q 633 -203 752 -203 q 155 -29 327 -203 q 0 360 0 127 q 176 802 0 616 q 687 1008 372 1008 q 1123 854 969 1008 q 1260 517 1260 718 q 1155 216 1260 341 q 868 82 1044 82 q 772 106 801 82 q 737 202 737 135 q 647 113 700 144 q 527 82 594 82 q 367 147 420 82 q 314 312 314 212 q 401 565 314 452 q 639 690 498 690 q 810 588 760 690 l 849 668 l 938 668 q 877 441 900 532 q 833 226 833 268 q 853 182 833 198 q 902 167 873 167 q 1088 272 1012 167 q 1159 512 1159 372 q 1051 793 1159 681 q 687 925 925 925 q 248 747 415 925 q 97 361 97 586 q 226 26 97 159 q 627 -122 370 -122 q 856 -87 737 -122 q 1061 8 976 -53 l 1098 -45 m 786 488 q 738 580 777 545 q 643 615 700 615 q 483 517 548 615 q 425 322 425 430 q 457 203 425 250 q 552 156 490 156 q 722 273 665 156 q 786 488 738 309 "},\u038A:{x_min:0,x_max:499,ha:613,o:"m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 m 499 0 l 360 0 l 360 1012 l 499 1012 l 499 0 "},i:{x_min:14,x_max:136,ha:275,o:"m 136 873 l 14 873 l 14 1013 l 136 1013 l 136 873 m 136 0 l 14 0 l 14 737 l 136 737 l 136 0 "},\u0392:{x_min:0,x_max:778,ha:877,o:"m 580 545 q 724 468 671 534 q 778 310 778 402 q 673 83 778 170 q 432 0 575 0 l 0 0 l 0 1013 l 411 1013 q 629 957 541 1013 q 732 768 732 891 q 691 632 732 692 q 580 545 650 571 m 393 899 l 139 899 l 139 587 l 379 587 q 521 623 462 587 q 592 744 592 666 q 531 859 592 819 q 393 899 471 899 m 419 124 q 566 169 504 124 q 635 302 635 219 q 559 435 635 388 q 402 476 494 476 l 139 476 l 139 124 l 419 124 "},\u03C5:{x_min:0,x_max:617,ha:725,o:"m 617 352 q 540 94 617 199 q 308 -24 455 -24 q 76 94 161 -24 q 0 352 0 199 l 0 739 l 126 739 l 126 355 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 355 492 257 l 492 739 l 617 739 l 617 352 "},"]":{x_min:0,x_max:275,ha:372,o:"m 275 -281 l 0 -281 l 0 -187 l 151 -187 l 151 920 l 0 920 l 0 1013 l 275 1013 l 275 -281 "},m:{x_min:0,x_max:1019,ha:1128,o:"m 1019 0 l 897 0 l 897 454 q 860 591 897 536 q 739 660 816 660 q 613 586 659 660 q 573 436 573 522 l 573 0 l 447 0 l 447 455 q 412 591 447 535 q 294 657 372 657 q 165 586 213 657 q 122 437 122 521 l 122 0 l 0 0 l 0 738 l 117 738 l 117 640 q 202 730 150 697 q 316 763 254 763 q 437 730 381 763 q 525 642 494 697 q 621 731 559 700 q 753 763 682 763 q 943 694 867 763 q 1019 512 1019 625 l 1019 0 "},\u03C7:{x_min:8.328125,x_max:780.5625,ha:815,o:"m 780 -278 q 715 -294 747 -294 q 616 -257 663 -294 q 548 -175 576 -227 l 379 133 l 143 -277 l 9 -277 l 313 254 l 163 522 q 127 586 131 580 q 36 640 91 640 q 8 637 27 640 l 8 752 l 52 757 q 162 719 113 757 q 236 627 200 690 l 383 372 l 594 737 l 726 737 l 448 250 l 625 -69 q 670 -153 647 -110 q 743 -188 695 -188 q 780 -184 759 -188 l 780 -278 "},\u03AF:{x_min:42,x_max:326.71875,ha:361,o:"m 284 3 q 233 -10 258 -5 q 182 -15 207 -15 q 85 26 119 -15 q 42 200 42 79 l 42 737 l 167 737 l 168 215 q 172 141 168 157 q 226 101 183 101 q 248 102 239 101 q 284 112 257 104 l 284 3 m 326 1040 l 137 819 l 54 819 l 189 1040 l 326 1040 "},\u0396:{x_min:0,x_max:779.171875,ha:850,o:"m 779 0 l 0 0 l 0 113 l 620 896 l 40 896 l 40 1013 l 779 1013 l 779 887 l 170 124 l 779 124 l 779 0 "},R:{x_min:0,x_max:781.953125,ha:907,o:"m 781 0 l 623 0 q 587 242 590 52 q 407 433 585 433 l 138 433 l 138 0 l 0 0 l 0 1013 l 396 1013 q 636 946 539 1013 q 749 731 749 868 q 711 597 749 659 q 608 502 674 534 q 718 370 696 474 q 729 207 722 352 q 781 26 736 62 l 781 0 m 373 551 q 533 594 465 551 q 614 731 614 645 q 532 859 614 815 q 373 896 465 896 l 138 896 l 138 551 l 373 551 "},o:{x_min:0,x_max:713,ha:821,o:"m 357 -25 q 94 91 194 -25 q 0 368 0 202 q 93 642 0 533 q 357 761 193 761 q 618 644 518 761 q 713 368 713 533 q 619 91 713 201 q 357 -25 521 -25 m 357 85 q 528 175 465 85 q 584 369 584 255 q 529 562 584 484 q 357 651 467 651 q 189 560 250 651 q 135 369 135 481 q 187 177 135 257 q 357 85 250 85 "},K:{x_min:0,x_max:819.46875,ha:906,o:"m 819 0 l 649 0 l 294 509 l 139 355 l 139 0 l 0 0 l 0 1013 l 139 1013 l 139 526 l 626 1013 l 809 1013 l 395 600 l 819 0 "},",":{x_min:0,x_max:142,ha:239,o:"m 142 -12 q 105 -132 142 -82 q 0 -205 68 -182 l 0 -138 q 57 -82 40 -124 q 70 0 70 -51 l 0 0 l 0 151 l 142 151 l 142 -12 "},d:{x_min:0,x_max:683,ha:796,o:"m 683 0 l 564 0 l 564 93 q 456 6 516 38 q 327 -25 395 -25 q 87 100 181 -25 q 0 365 0 215 q 90 639 0 525 q 343 763 187 763 q 564 647 486 763 l 564 1013 l 683 1013 l 683 0 m 582 373 q 529 562 582 484 q 361 653 468 653 q 190 561 253 653 q 135 365 135 479 q 189 175 135 254 q 358 85 251 85 q 529 178 468 85 q 582 373 582 258 "},"\xA8":{x_min:-109,x_max:247,ha:232,o:"m 247 1046 l 119 1046 l 119 1189 l 247 1189 l 247 1046 m 19 1046 l -109 1046 l -109 1189 l 19 1189 l 19 1046 "},E:{x_min:0,x_max:736.109375,ha:789,o:"m 736 0 l 0 0 l 0 1013 l 725 1013 l 725 889 l 139 889 l 139 585 l 677 585 l 677 467 l 139 467 l 139 125 l 736 125 l 736 0 "},Y:{x_min:0,x_max:820,ha:886,o:"m 820 1013 l 482 416 l 482 0 l 342 0 l 342 416 l 0 1013 l 140 1013 l 411 534 l 679 1012 l 820 1013 "},'"':{x_min:0,x_max:299,ha:396,o:"m 299 606 l 203 606 l 203 988 l 299 988 l 299 606 m 96 606 l 0 606 l 0 988 l 96 988 l 96 606 "},"\u2039":{x_min:17.984375,x_max:773.609375,ha:792,o:"m 773 40 l 18 376 l 17 465 l 773 799 l 773 692 l 159 420 l 773 149 l 773 40 "},"\u201E":{x_min:0,x_max:364,ha:467,o:"m 141 -12 q 104 -132 141 -82 q 0 -205 67 -182 l 0 -138 q 56 -82 40 -124 q 69 0 69 -51 l 0 0 l 0 151 l 141 151 l 141 -12 m 364 -12 q 327 -132 364 -82 q 222 -205 290 -182 l 222 -138 q 279 -82 262 -124 q 292 0 292 -51 l 222 0 l 222 151 l 364 151 l 364 -12 "},\u03B4:{x_min:1,x_max:710,ha:810,o:"m 710 360 q 616 87 710 196 q 356 -28 518 -28 q 99 82 197 -28 q 1 356 1 192 q 100 606 1 509 q 355 703 199 703 q 180 829 288 754 q 70 903 124 866 l 70 1012 l 643 1012 l 643 901 l 258 901 q 462 763 422 794 q 636 592 577 677 q 710 360 710 485 m 584 365 q 552 501 584 447 q 451 602 521 555 q 372 611 411 611 q 197 541 258 611 q 136 355 136 472 q 190 171 136 245 q 358 85 252 85 q 528 173 465 85 q 584 365 584 252 "},\u03AD:{x_min:0,x_max:634.71875,ha:714,o:"m 634 234 q 527 38 634 110 q 300 -25 433 -25 q 98 29 183 -25 q 0 204 0 93 q 37 313 0 265 q 128 390 67 352 q 56 459 82 419 q 26 555 26 505 q 114 712 26 654 q 295 763 191 763 q 499 700 416 763 q 589 515 589 631 l 478 515 q 419 618 464 580 q 307 657 374 657 q 207 630 253 657 q 151 547 151 598 q 238 445 151 469 q 389 434 280 434 l 389 331 l 349 331 q 206 315 255 331 q 125 210 125 287 q 183 107 125 145 q 302 76 233 76 q 436 117 379 76 q 509 234 493 159 l 634 234 m 520 1040 l 331 819 l 248 819 l 383 1040 l 520 1040 "},\u03C9:{x_min:0,x_max:922,ha:1031,o:"m 922 339 q 856 97 922 203 q 650 -26 780 -26 q 538 9 587 -26 q 461 103 489 44 q 387 12 436 46 q 277 -22 339 -22 q 69 97 147 -22 q 0 339 0 203 q 45 551 0 444 q 161 738 84 643 l 302 738 q 175 553 219 647 q 124 336 124 446 q 155 179 124 249 q 275 88 197 88 q 375 163 341 88 q 400 294 400 219 l 400 572 l 524 572 l 524 294 q 561 135 524 192 q 643 88 591 88 q 762 182 719 88 q 797 342 797 257 q 745 556 797 450 q 619 738 705 638 l 760 738 q 874 551 835 640 q 922 339 922 444 "},"\xB4":{x_min:0,x_max:96,ha:251,o:"m 96 606 l 0 606 l 0 988 l 96 988 l 96 606 "},"\xB1":{x_min:11,x_max:781,ha:792,o:"m 781 490 l 446 490 l 446 255 l 349 255 l 349 490 l 11 490 l 11 586 l 349 586 l 349 819 l 446 819 l 446 586 l 781 586 l 781 490 m 781 21 l 11 21 l 11 115 l 781 115 l 781 21 "},"|":{x_min:343,x_max:449,ha:792,o:"m 449 462 l 343 462 l 343 986 l 449 986 l 449 462 m 449 -242 l 343 -242 l 343 280 l 449 280 l 449 -242 "},\u03CB:{x_min:0,x_max:617,ha:725,o:"m 482 800 l 372 800 l 372 925 l 482 925 l 482 800 m 239 800 l 129 800 l 129 925 l 239 925 l 239 800 m 617 352 q 540 93 617 199 q 308 -24 455 -24 q 76 93 161 -24 q 0 352 0 199 l 0 738 l 126 738 l 126 354 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 354 492 257 l 492 738 l 617 738 l 617 352 "},"\xA7":{x_min:0,x_max:593,ha:690,o:"m 593 425 q 554 312 593 369 q 467 233 516 254 q 537 83 537 172 q 459 -74 537 -12 q 288 -133 387 -133 q 115 -69 184 -133 q 47 96 47 -6 l 166 96 q 199 7 166 40 q 288 -26 232 -26 q 371 -5 332 -26 q 420 60 420 21 q 311 201 420 139 q 108 309 210 255 q 0 490 0 383 q 33 602 0 551 q 124 687 66 654 q 75 743 93 712 q 58 812 58 773 q 133 984 58 920 q 300 1043 201 1043 q 458 987 394 1043 q 529 814 529 925 l 411 814 q 370 908 404 877 q 289 939 336 939 q 213 911 246 939 q 180 841 180 883 q 286 720 180 779 q 484 612 480 615 q 593 425 593 534 m 467 409 q 355 544 467 473 q 196 630 228 612 q 146 587 162 609 q 124 525 124 558 q 239 387 124 462 q 398 298 369 315 q 448 345 429 316 q 467 409 467 375 "},b:{x_min:0,x_max:685,ha:783,o:"m 685 372 q 597 99 685 213 q 347 -25 501 -25 q 219 5 277 -25 q 121 93 161 36 l 121 0 l 0 0 l 0 1013 l 121 1013 l 121 634 q 214 723 157 692 q 341 754 272 754 q 591 637 493 754 q 685 372 685 526 m 554 356 q 499 550 554 470 q 328 644 437 644 q 162 556 223 644 q 108 369 108 478 q 160 176 108 256 q 330 83 221 83 q 498 169 435 83 q 554 356 554 245 "},q:{x_min:0,x_max:683,ha:876,o:"m 683 -278 l 564 -278 l 564 97 q 474 8 533 39 q 345 -23 415 -23 q 91 93 188 -23 q 0 364 0 203 q 87 635 0 522 q 337 760 184 760 q 466 727 408 760 q 564 637 523 695 l 564 737 l 683 737 l 683 -278 m 582 375 q 527 564 582 488 q 358 652 466 652 q 190 565 253 652 q 135 377 135 488 q 189 179 135 261 q 361 84 251 84 q 530 179 469 84 q 582 375 582 260 "},\u03A9:{x_min:-.171875,x_max:969.5625,ha:1068,o:"m 969 0 l 555 0 l 555 123 q 744 308 675 194 q 814 558 814 423 q 726 812 814 709 q 484 922 633 922 q 244 820 334 922 q 154 567 154 719 q 223 316 154 433 q 412 123 292 199 l 412 0 l 0 0 l 0 124 l 217 124 q 68 327 122 210 q 15 572 15 444 q 144 911 15 781 q 484 1041 274 1041 q 822 909 691 1041 q 953 569 953 777 q 899 326 953 443 q 750 124 846 210 l 969 124 l 969 0 "},\u03CD:{x_min:0,x_max:617,ha:725,o:"m 617 352 q 540 93 617 199 q 308 -24 455 -24 q 76 93 161 -24 q 0 352 0 199 l 0 738 l 126 738 l 126 354 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 354 492 257 l 492 738 l 617 738 l 617 352 m 535 1040 l 346 819 l 262 819 l 397 1040 l 535 1040 "},z:{x_min:-.015625,x_max:613.890625,ha:697,o:"m 613 0 l 0 0 l 0 100 l 433 630 l 20 630 l 20 738 l 594 738 l 593 636 l 163 110 l 613 110 l 613 0 "},"\u2122":{x_min:0,x_max:894,ha:1e3,o:"m 389 951 l 229 951 l 229 503 l 160 503 l 160 951 l 0 951 l 0 1011 l 389 1011 l 389 951 m 894 503 l 827 503 l 827 939 l 685 503 l 620 503 l 481 937 l 481 503 l 417 503 l 417 1011 l 517 1011 l 653 580 l 796 1010 l 894 1011 l 894 503 "},\u03AE:{x_min:.78125,x_max:697,ha:810,o:"m 697 -278 l 572 -278 l 572 454 q 540 587 572 536 q 425 650 501 650 q 271 579 337 650 q 206 420 206 509 l 206 0 l 81 0 l 81 489 q 73 588 81 562 q 0 644 56 644 l 0 741 q 68 755 38 755 q 158 721 124 755 q 200 630 193 687 q 297 726 234 692 q 434 761 359 761 q 620 692 544 761 q 697 516 697 624 l 697 -278 m 479 1040 l 290 819 l 207 819 l 341 1040 l 479 1040 "},\u0398:{x_min:0,x_max:960,ha:1056,o:"m 960 507 q 833 129 960 280 q 476 -32 698 -32 q 123 129 255 -32 q 0 507 0 280 q 123 883 0 732 q 476 1045 255 1045 q 832 883 696 1045 q 960 507 960 732 m 817 500 q 733 789 817 669 q 476 924 639 924 q 223 792 317 924 q 142 507 142 675 q 222 222 142 339 q 476 89 315 89 q 730 218 636 89 q 817 500 817 334 m 716 449 l 243 449 l 243 571 l 716 571 l 716 449 "},"\xAE":{x_min:-3,x_max:1008,ha:1106,o:"m 503 532 q 614 562 566 532 q 672 658 672 598 q 614 747 672 716 q 503 772 569 772 l 338 772 l 338 532 l 503 532 m 502 -7 q 123 151 263 -7 q -3 501 -3 294 q 123 851 -3 706 q 502 1011 263 1011 q 881 851 739 1011 q 1008 501 1008 708 q 883 151 1008 292 q 502 -7 744 -7 m 502 60 q 830 197 709 60 q 940 501 940 322 q 831 805 940 681 q 502 944 709 944 q 174 805 296 944 q 65 501 65 680 q 173 197 65 320 q 502 60 294 60 m 788 146 l 678 146 q 653 316 655 183 q 527 449 652 449 l 338 449 l 338 146 l 241 146 l 241 854 l 518 854 q 688 808 621 854 q 766 658 766 755 q 739 563 766 607 q 668 497 713 519 q 751 331 747 472 q 788 164 756 190 l 788 146 "},"~":{x_min:0,x_max:833,ha:931,o:"m 833 958 q 778 753 833 831 q 594 665 716 665 q 402 761 502 665 q 240 857 302 857 q 131 795 166 857 q 104 665 104 745 l 0 665 q 54 867 0 789 q 237 958 116 958 q 429 861 331 958 q 594 765 527 765 q 704 827 670 765 q 729 958 729 874 l 833 958 "},\u0395:{x_min:0,x_max:736.21875,ha:778,o:"m 736 0 l 0 0 l 0 1013 l 725 1013 l 725 889 l 139 889 l 139 585 l 677 585 l 677 467 l 139 467 l 139 125 l 736 125 l 736 0 "},"\xB3":{x_min:0,x_max:450,ha:547,o:"m 450 552 q 379 413 450 464 q 220 366 313 366 q 69 414 130 366 q 0 567 0 470 l 85 567 q 126 470 85 504 q 225 437 168 437 q 320 467 280 437 q 360 552 360 498 q 318 632 360 608 q 213 657 276 657 q 195 657 203 657 q 176 657 181 657 l 176 722 q 279 733 249 722 q 334 815 334 752 q 300 881 334 856 q 220 907 267 907 q 133 875 169 907 q 97 781 97 844 l 15 781 q 78 926 15 875 q 220 972 135 972 q 364 930 303 972 q 426 817 426 888 q 344 697 426 733 q 421 642 392 681 q 450 552 450 603 "},"[":{x_min:0,x_max:273.609375,ha:371,o:"m 273 -281 l 0 -281 l 0 1013 l 273 1013 l 273 920 l 124 920 l 124 -187 l 273 -187 l 273 -281 "},L:{x_min:0,x_max:645.828125,ha:696,o:"m 645 0 l 0 0 l 0 1013 l 140 1013 l 140 126 l 645 126 l 645 0 "},\u03C3:{x_min:0,x_max:803.390625,ha:894,o:"m 803 628 l 633 628 q 713 368 713 512 q 618 93 713 204 q 357 -25 518 -25 q 94 91 194 -25 q 0 368 0 201 q 94 644 0 533 q 356 761 194 761 q 481 750 398 761 q 608 739 564 739 l 803 739 l 803 628 m 360 85 q 529 180 467 85 q 584 374 584 262 q 527 566 584 490 q 352 651 463 651 q 187 559 247 651 q 135 368 135 478 q 189 175 135 254 q 360 85 251 85 "},\u03B6:{x_min:0,x_max:573,ha:642,o:"m 573 -40 q 553 -162 573 -97 q 510 -278 543 -193 l 400 -278 q 441 -187 428 -219 q 462 -90 462 -132 q 378 -14 462 -14 q 108 45 197 -14 q 0 290 0 117 q 108 631 0 462 q 353 901 194 767 l 55 901 l 55 1012 l 561 1012 l 561 924 q 261 669 382 831 q 128 301 128 489 q 243 117 128 149 q 458 98 350 108 q 573 -40 573 80 "},\u03B8:{x_min:0,x_max:674,ha:778,o:"m 674 496 q 601 160 674 304 q 336 -26 508 -26 q 73 153 165 -26 q 0 485 0 296 q 72 840 0 683 q 343 1045 166 1045 q 605 844 516 1045 q 674 496 674 692 m 546 579 q 498 798 546 691 q 336 935 437 935 q 178 798 237 935 q 126 579 137 701 l 546 579 m 546 475 l 126 475 q 170 233 126 348 q 338 80 230 80 q 504 233 447 80 q 546 475 546 346 "},\u039F:{x_min:0,x_max:958,ha:1054,o:"m 485 1042 q 834 883 703 1042 q 958 511 958 735 q 834 136 958 287 q 481 -26 701 -26 q 126 130 261 -26 q 0 504 0 279 q 127 880 0 729 q 485 1042 263 1042 m 480 98 q 731 225 638 98 q 815 504 815 340 q 733 783 815 670 q 480 913 640 913 q 226 785 321 913 q 142 504 142 671 q 226 224 142 339 q 480 98 319 98 "},\u0393:{x_min:0,x_max:705.28125,ha:749,o:"m 705 886 l 140 886 l 140 0 l 0 0 l 0 1012 l 705 1012 l 705 886 "}," ":{x_min:0,x_max:0,ha:375},"%":{x_min:-3,x_max:1089,ha:1186,o:"m 845 0 q 663 76 731 0 q 602 244 602 145 q 661 412 602 344 q 845 489 728 489 q 1027 412 959 489 q 1089 244 1089 343 q 1029 76 1089 144 q 845 0 962 0 m 844 103 q 945 143 909 103 q 981 243 981 184 q 947 340 981 301 q 844 385 909 385 q 744 342 781 385 q 708 243 708 300 q 741 147 708 186 q 844 103 780 103 m 888 986 l 284 -25 l 199 -25 l 803 986 l 888 986 m 241 468 q 58 545 126 468 q -3 715 -3 615 q 56 881 -3 813 q 238 958 124 958 q 421 881 353 958 q 483 712 483 813 q 423 544 483 612 q 241 468 356 468 m 241 855 q 137 811 175 855 q 100 710 100 768 q 136 612 100 653 q 240 572 172 572 q 344 614 306 572 q 382 713 382 656 q 347 810 382 771 q 241 855 308 855 "},P:{x_min:0,x_max:726,ha:806,o:"m 424 1013 q 640 931 555 1013 q 726 719 726 850 q 637 506 726 587 q 413 426 548 426 l 140 426 l 140 0 l 0 0 l 0 1013 l 424 1013 m 379 889 l 140 889 l 140 548 l 372 548 q 522 589 459 548 q 593 720 593 637 q 528 845 593 801 q 379 889 463 889 "},\u0388:{x_min:0,x_max:1078.21875,ha:1118,o:"m 1078 0 l 342 0 l 342 1013 l 1067 1013 l 1067 889 l 481 889 l 481 585 l 1019 585 l 1019 467 l 481 467 l 481 125 l 1078 125 l 1078 0 m 277 1040 l 83 799 l 0 799 l 140 1040 l 277 1040 "},\u038F:{x_min:.125,x_max:1136.546875,ha:1235,o:"m 1136 0 l 722 0 l 722 123 q 911 309 842 194 q 981 558 981 423 q 893 813 981 710 q 651 923 800 923 q 411 821 501 923 q 321 568 321 720 q 390 316 321 433 q 579 123 459 200 l 579 0 l 166 0 l 166 124 l 384 124 q 235 327 289 210 q 182 572 182 444 q 311 912 182 782 q 651 1042 441 1042 q 989 910 858 1042 q 1120 569 1120 778 q 1066 326 1120 443 q 917 124 1013 210 l 1136 124 l 1136 0 m 277 1040 l 83 800 l 0 800 l 140 1041 l 277 1040 "},_:{x_min:0,x_max:705.5625,ha:803,o:"m 705 -334 l 0 -334 l 0 -234 l 705 -234 l 705 -334 "},\u03AA:{x_min:-110,x_max:246,ha:275,o:"m 246 1046 l 118 1046 l 118 1189 l 246 1189 l 246 1046 m 18 1046 l -110 1046 l -110 1189 l 18 1189 l 18 1046 m 136 0 l 0 0 l 0 1012 l 136 1012 l 136 0 "},"+":{x_min:23,x_max:768,ha:792,o:"m 768 372 l 444 372 l 444 0 l 347 0 l 347 372 l 23 372 l 23 468 l 347 468 l 347 840 l 444 840 l 444 468 l 768 468 l 768 372 "},"\xBD":{x_min:0,x_max:1050,ha:1149,o:"m 1050 0 l 625 0 q 712 178 625 108 q 878 277 722 187 q 967 385 967 328 q 932 456 967 429 q 850 484 897 484 q 759 450 798 484 q 721 352 721 416 l 640 352 q 706 502 640 448 q 851 551 766 551 q 987 509 931 551 q 1050 385 1050 462 q 976 251 1050 301 q 829 179 902 215 q 717 68 740 133 l 1050 68 l 1050 0 m 834 985 l 215 -28 l 130 -28 l 750 984 l 834 985 m 224 422 l 142 422 l 142 811 l 0 811 l 0 867 q 104 889 62 867 q 164 973 157 916 l 224 973 l 224 422 "},\u03A1:{x_min:0,x_max:720,ha:783,o:"m 424 1013 q 637 933 554 1013 q 720 723 720 853 q 633 508 720 591 q 413 426 546 426 l 140 426 l 140 0 l 0 0 l 0 1013 l 424 1013 m 378 889 l 140 889 l 140 548 l 371 548 q 521 589 458 548 q 592 720 592 637 q 527 845 592 801 q 378 889 463 889 "},"'":{x_min:0,x_max:139,ha:236,o:"m 139 851 q 102 737 139 784 q 0 669 65 690 l 0 734 q 59 787 42 741 q 72 873 72 821 l 0 873 l 0 1013 l 139 1013 l 139 851 "},\u00AA:{x_min:0,x_max:350,ha:397,o:"m 350 625 q 307 616 328 616 q 266 631 281 616 q 247 673 251 645 q 190 628 225 644 q 116 613 156 613 q 32 641 64 613 q 0 722 0 669 q 72 826 0 800 q 247 866 159 846 l 247 887 q 220 934 247 916 q 162 953 194 953 q 104 934 129 953 q 76 882 80 915 l 16 882 q 60 976 16 941 q 166 1011 104 1011 q 266 979 224 1011 q 308 891 308 948 l 308 706 q 311 679 308 688 q 331 670 315 670 l 350 672 l 350 625 m 247 757 l 247 811 q 136 790 175 798 q 64 726 64 773 q 83 682 64 697 q 132 667 103 667 q 207 690 174 667 q 247 757 247 718 "},"\u0385":{x_min:0,x_max:450,ha:553,o:"m 450 800 l 340 800 l 340 925 l 450 925 l 450 800 m 406 1040 l 212 800 l 129 800 l 269 1040 l 406 1040 m 110 800 l 0 800 l 0 925 l 110 925 l 110 800 "},T:{x_min:0,x_max:777,ha:835,o:"m 777 894 l 458 894 l 458 0 l 319 0 l 319 894 l 0 894 l 0 1013 l 777 1013 l 777 894 "},\u03A6:{x_min:0,x_max:915,ha:997,o:"m 527 0 l 389 0 l 389 122 q 110 231 220 122 q 0 509 0 340 q 110 785 0 677 q 389 893 220 893 l 389 1013 l 527 1013 l 527 893 q 804 786 693 893 q 915 509 915 679 q 805 231 915 341 q 527 122 696 122 l 527 0 m 527 226 q 712 310 641 226 q 779 507 779 389 q 712 705 779 627 q 527 787 641 787 l 527 226 m 389 226 l 389 787 q 205 698 275 775 q 136 505 136 620 q 206 308 136 391 q 389 226 276 226 "},"\u204B":{x_min:0,x_max:0,ha:694},j:{x_min:-77.78125,x_max:167,ha:349,o:"m 167 871 l 42 871 l 42 1013 l 167 1013 l 167 871 m 167 -80 q 121 -231 167 -184 q -26 -278 76 -278 l -77 -278 l -77 -164 l -41 -164 q 26 -143 11 -164 q 42 -65 42 -122 l 42 737 l 167 737 l 167 -80 "},\u03A3:{x_min:0,x_max:756.953125,ha:819,o:"m 756 0 l 0 0 l 0 107 l 395 523 l 22 904 l 22 1013 l 745 1013 l 745 889 l 209 889 l 566 523 l 187 125 l 756 125 l 756 0 "},"\u203A":{x_min:18.0625,x_max:774,ha:792,o:"m 774 376 l 18 40 l 18 149 l 631 421 l 18 692 l 18 799 l 774 465 l 774 376 "},"<":{x_min:17.984375,x_max:773.609375,ha:792,o:"m 773 40 l 18 376 l 17 465 l 773 799 l 773 692 l 159 420 l 773 149 l 773 40 "},"\xA3":{x_min:0,x_max:704.484375,ha:801,o:"m 704 41 q 623 -10 664 5 q 543 -26 583 -26 q 359 15 501 -26 q 243 36 288 36 q 158 23 197 36 q 73 -21 119 10 l 6 76 q 125 195 90 150 q 175 331 175 262 q 147 443 175 383 l 0 443 l 0 512 l 108 512 q 43 734 43 623 q 120 929 43 854 q 358 1010 204 1010 q 579 936 487 1010 q 678 729 678 857 l 678 684 l 552 684 q 504 838 552 780 q 362 896 457 896 q 216 852 263 896 q 176 747 176 815 q 199 627 176 697 q 248 512 217 574 l 468 512 l 468 443 l 279 443 q 297 356 297 398 q 230 194 297 279 q 153 107 211 170 q 227 133 190 125 q 293 142 264 142 q 410 119 339 142 q 516 96 482 96 q 579 105 550 96 q 648 142 608 115 l 704 41 "},t:{x_min:0,x_max:367,ha:458,o:"m 367 0 q 312 -5 339 -2 q 262 -8 284 -8 q 145 28 183 -8 q 108 143 108 64 l 108 638 l 0 638 l 0 738 l 108 738 l 108 944 l 232 944 l 232 738 l 367 738 l 367 638 l 232 638 l 232 185 q 248 121 232 140 q 307 102 264 102 q 345 104 330 102 q 367 107 360 107 l 367 0 "},"\xAC":{x_min:0,x_max:706,ha:803,o:"m 706 411 l 706 158 l 630 158 l 630 335 l 0 335 l 0 411 l 706 411 "},\u03BB:{x_min:0,x_max:750,ha:803,o:"m 750 -7 q 679 -15 716 -15 q 538 59 591 -15 q 466 214 512 97 l 336 551 l 126 0 l 0 0 l 270 705 q 223 837 247 770 q 116 899 190 899 q 90 898 100 899 l 90 1004 q 152 1011 125 1011 q 298 938 244 1011 q 373 783 326 901 l 605 192 q 649 115 629 136 q 716 95 669 95 l 736 95 q 750 97 745 97 l 750 -7 "},W:{x_min:0,x_max:1263.890625,ha:1351,o:"m 1263 1013 l 995 0 l 859 0 l 627 837 l 405 0 l 265 0 l 0 1013 l 136 1013 l 342 202 l 556 1013 l 701 1013 l 921 207 l 1133 1012 l 1263 1013 "},">":{x_min:18.0625,x_max:774,ha:792,o:"m 774 376 l 18 40 l 18 149 l 631 421 l 18 692 l 18 799 l 774 465 l 774 376 "},v:{x_min:0,x_max:675.15625,ha:761,o:"m 675 738 l 404 0 l 272 0 l 0 738 l 133 737 l 340 147 l 541 737 l 675 738 "},\u03C4:{x_min:.28125,x_max:644.5,ha:703,o:"m 644 628 l 382 628 l 382 179 q 388 120 382 137 q 436 91 401 91 q 474 94 447 91 q 504 97 501 97 l 504 0 q 454 -9 482 -5 q 401 -14 426 -14 q 278 67 308 -14 q 260 233 260 118 l 260 628 l 0 628 l 0 739 l 644 739 l 644 628 "},\u03BE:{x_min:0,x_max:624.9375,ha:699,o:"m 624 -37 q 608 -153 624 -96 q 563 -278 593 -211 l 454 -278 q 491 -183 486 -200 q 511 -83 511 -126 q 484 -23 511 -44 q 370 1 452 1 q 323 0 354 1 q 283 -1 293 -1 q 84 76 169 -1 q 0 266 0 154 q 56 431 0 358 q 197 538 108 498 q 94 613 134 562 q 54 730 54 665 q 77 823 54 780 q 143 901 101 867 l 27 901 l 27 1012 l 576 1012 l 576 901 l 380 901 q 244 863 303 901 q 178 745 178 820 q 312 600 178 636 q 532 582 380 582 l 532 479 q 276 455 361 479 q 118 281 118 410 q 165 173 118 217 q 274 120 208 133 q 494 101 384 110 q 624 -37 624 76 "},"&":{x_min:-3,x_max:894.25,ha:992,o:"m 894 0 l 725 0 l 624 123 q 471 0 553 40 q 306 -41 390 -41 q 168 -7 231 -41 q 62 92 105 26 q 14 187 31 139 q -3 276 -3 235 q 55 433 -3 358 q 248 581 114 508 q 170 689 196 640 q 137 817 137 751 q 214 985 137 922 q 384 1041 284 1041 q 548 988 483 1041 q 622 824 622 928 q 563 666 622 739 q 431 556 516 608 l 621 326 q 649 407 639 361 q 663 493 653 426 l 781 493 q 703 229 781 352 l 894 0 m 504 818 q 468 908 504 877 q 384 940 433 940 q 293 907 331 940 q 255 818 255 875 q 289 714 255 767 q 363 628 313 678 q 477 729 446 682 q 504 818 504 771 m 556 209 l 314 499 q 179 395 223 449 q 135 283 135 341 q 146 222 135 253 q 183 158 158 192 q 333 80 241 80 q 556 209 448 80 "},\u039B:{x_min:0,x_max:862.5,ha:942,o:"m 862 0 l 719 0 l 426 847 l 143 0 l 0 0 l 356 1013 l 501 1013 l 862 0 "},I:{x_min:41,x_max:180,ha:293,o:"m 180 0 l 41 0 l 41 1013 l 180 1013 l 180 0 "},G:{x_min:0,x_max:921,ha:1011,o:"m 921 0 l 832 0 l 801 136 q 655 15 741 58 q 470 -28 568 -28 q 126 133 259 -28 q 0 499 0 284 q 125 881 0 731 q 486 1043 259 1043 q 763 957 647 1043 q 905 709 890 864 l 772 709 q 668 866 747 807 q 486 926 589 926 q 228 795 322 926 q 142 507 142 677 q 228 224 142 342 q 483 94 323 94 q 712 195 625 94 q 796 435 796 291 l 477 435 l 477 549 l 921 549 l 921 0 "},\u03B0:{x_min:0,x_max:617,ha:725,o:"m 524 800 l 414 800 l 414 925 l 524 925 l 524 800 m 183 800 l 73 800 l 73 925 l 183 925 l 183 800 m 617 352 q 540 93 617 199 q 308 -24 455 -24 q 76 93 161 -24 q 0 352 0 199 l 0 738 l 126 738 l 126 354 q 169 185 126 257 q 312 98 220 98 q 451 185 402 98 q 492 354 492 257 l 492 738 l 617 738 l 617 352 m 489 1040 l 300 819 l 216 819 l 351 1040 l 489 1040 "},"`":{x_min:0,x_max:138.890625,ha:236,o:"m 138 699 l 0 699 l 0 861 q 36 974 0 929 q 138 1041 72 1020 l 138 977 q 82 931 95 969 q 69 839 69 893 l 138 839 l 138 699 "},"\xB7":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 "},\u03A5:{x_min:.328125,x_max:819.515625,ha:889,o:"m 819 1013 l 482 416 l 482 0 l 342 0 l 342 416 l 0 1013 l 140 1013 l 411 533 l 679 1013 l 819 1013 "},r:{x_min:0,x_max:355.5625,ha:432,o:"m 355 621 l 343 621 q 179 569 236 621 q 122 411 122 518 l 122 0 l 0 0 l 0 737 l 117 737 l 117 604 q 204 719 146 686 q 355 753 262 753 l 355 621 "},x:{x_min:0,x_max:675,ha:764,o:"m 675 0 l 525 0 l 331 286 l 144 0 l 0 0 l 256 379 l 12 738 l 157 737 l 336 473 l 516 738 l 661 738 l 412 380 l 675 0 "},\u03BC:{x_min:0,x_max:696.609375,ha:747,o:"m 696 -4 q 628 -14 657 -14 q 498 97 513 -14 q 422 8 470 41 q 313 -24 374 -24 q 207 3 258 -24 q 120 80 157 31 l 120 -278 l 0 -278 l 0 738 l 124 738 l 124 343 q 165 172 124 246 q 308 82 216 82 q 451 177 402 82 q 492 358 492 254 l 492 738 l 616 738 l 616 214 q 623 136 616 160 q 673 92 636 92 q 696 95 684 92 l 696 -4 "},h:{x_min:0,x_max:615,ha:724,o:"m 615 472 l 615 0 l 490 0 l 490 454 q 456 590 490 535 q 338 654 416 654 q 186 588 251 654 q 122 436 122 522 l 122 0 l 0 0 l 0 1013 l 122 1013 l 122 633 q 218 727 149 694 q 362 760 287 760 q 552 676 484 760 q 615 472 615 600 "},".":{x_min:0,x_max:142,ha:239,o:"m 142 0 l 0 0 l 0 151 l 142 151 l 142 0 "},\u03C6:{x_min:-2,x_max:878,ha:974,o:"m 496 -279 l 378 -279 l 378 -17 q 101 88 204 -17 q -2 367 -2 194 q 68 626 -2 510 q 283 758 151 758 l 283 646 q 167 537 209 626 q 133 373 133 462 q 192 177 133 254 q 378 93 259 93 l 378 758 q 445 764 426 763 q 476 765 464 765 q 765 659 653 765 q 878 377 878 553 q 771 96 878 209 q 496 -17 665 -17 l 496 -279 m 496 93 l 514 93 q 687 183 623 93 q 746 380 746 265 q 691 569 746 491 q 522 658 629 658 l 496 656 l 496 93 "},";":{x_min:0,x_max:142,ha:239,o:"m 142 585 l 0 585 l 0 738 l 142 738 l 142 585 m 142 -12 q 105 -132 142 -82 q 0 -206 68 -182 l 0 -138 q 58 -82 43 -123 q 68 0 68 -56 l 0 0 l 0 151 l 142 151 l 142 -12 "},f:{x_min:0,x_max:378,ha:472,o:"m 378 638 l 246 638 l 246 0 l 121 0 l 121 638 l 0 638 l 0 738 l 121 738 q 137 935 121 887 q 290 1028 171 1028 q 320 1027 305 1028 q 378 1021 334 1026 l 378 908 q 323 918 346 918 q 257 870 273 918 q 246 780 246 840 l 246 738 l 378 738 l 378 638 "},"\u201C":{x_min:1,x_max:348.21875,ha:454,o:"m 140 670 l 1 670 l 1 830 q 37 943 1 897 q 140 1011 74 990 l 140 947 q 82 900 97 940 q 68 810 68 861 l 140 810 l 140 670 m 348 670 l 209 670 l 209 830 q 245 943 209 897 q 348 1011 282 990 l 348 947 q 290 900 305 940 q 276 810 276 861 l 348 810 l 348 670 "},A:{x_min:.03125,x_max:906.953125,ha:1008,o:"m 906 0 l 756 0 l 648 303 l 251 303 l 142 0 l 0 0 l 376 1013 l 529 1013 l 906 0 m 610 421 l 452 867 l 293 421 l 610 421 "},"\u2018":{x_min:1,x_max:139.890625,ha:236,o:"m 139 670 l 1 670 l 1 830 q 37 943 1 897 q 139 1011 74 990 l 139 947 q 82 900 97 940 q 68 810 68 861 l 139 810 l 139 670 "},\u03CA:{x_min:-70,x_max:283,ha:361,o:"m 283 800 l 173 800 l 173 925 l 283 925 l 283 800 m 40 800 l -70 800 l -70 925 l 40 925 l 40 800 m 283 3 q 232 -10 257 -5 q 181 -15 206 -15 q 84 26 118 -15 q 41 200 41 79 l 41 737 l 166 737 l 167 215 q 171 141 167 157 q 225 101 182 101 q 247 103 238 101 q 283 112 256 104 l 283 3 "},\u03C0:{x_min:-.21875,x_max:773.21875,ha:857,o:"m 773 -7 l 707 -11 q 575 40 607 -11 q 552 174 552 77 l 552 226 l 552 626 l 222 626 l 222 0 l 97 0 l 97 626 l 0 626 l 0 737 l 773 737 l 773 626 l 676 626 l 676 171 q 695 103 676 117 q 773 90 714 90 l 773 -7 "},\u03AC:{x_min:0,x_max:765.5625,ha:809,o:"m 765 -4 q 698 -14 726 -14 q 564 97 586 -14 q 466 7 525 40 q 337 -26 407 -26 q 88 98 186 -26 q 0 369 0 212 q 88 637 0 525 q 337 760 184 760 q 465 727 407 760 q 563 637 524 695 l 563 738 l 685 738 l 685 222 q 693 141 685 168 q 748 94 708 94 q 765 95 760 94 l 765 -4 m 584 371 q 531 562 584 485 q 360 653 470 653 q 192 566 254 653 q 135 379 135 489 q 186 181 135 261 q 358 84 247 84 q 528 176 465 84 q 584 371 584 260 m 604 1040 l 415 819 l 332 819 l 466 1040 l 604 1040 "},O:{x_min:0,x_max:958,ha:1057,o:"m 485 1041 q 834 882 702 1041 q 958 512 958 734 q 834 136 958 287 q 481 -26 702 -26 q 126 130 261 -26 q 0 504 0 279 q 127 880 0 728 q 485 1041 263 1041 m 480 98 q 731 225 638 98 q 815 504 815 340 q 733 783 815 669 q 480 912 640 912 q 226 784 321 912 q 142 504 142 670 q 226 224 142 339 q 480 98 319 98 "},n:{x_min:0,x_max:615,ha:724,o:"m 615 463 l 615 0 l 490 0 l 490 454 q 453 592 490 537 q 331 656 410 656 q 178 585 240 656 q 117 421 117 514 l 117 0 l 0 0 l 0 738 l 117 738 l 117 630 q 218 728 150 693 q 359 764 286 764 q 552 675 484 764 q 615 463 615 593 "},l:{x_min:41,x_max:166,ha:279,o:"m 166 0 l 41 0 l 41 1013 l 166 1013 l 166 0 "},"\xA4":{x_min:40.09375,x_max:728.796875,ha:825,o:"m 728 304 l 649 224 l 512 363 q 383 331 458 331 q 256 363 310 331 l 119 224 l 40 304 l 177 441 q 150 553 150 493 q 184 673 150 621 l 40 818 l 119 898 l 267 749 q 321 766 291 759 q 384 773 351 773 q 447 766 417 773 q 501 749 477 759 l 649 898 l 728 818 l 585 675 q 612 618 604 648 q 621 553 621 587 q 591 441 621 491 l 728 304 m 384 682 q 280 643 318 682 q 243 551 243 604 q 279 461 243 499 q 383 423 316 423 q 487 461 449 423 q 525 553 525 500 q 490 641 525 605 q 384 682 451 682 "},\u03BA:{x_min:0,x_max:632.328125,ha:679,o:"m 632 0 l 482 0 l 225 384 l 124 288 l 124 0 l 0 0 l 0 738 l 124 738 l 124 446 l 433 738 l 596 738 l 312 466 l 632 0 "},p:{x_min:0,x_max:685,ha:786,o:"m 685 364 q 598 96 685 205 q 350 -23 504 -23 q 121 89 205 -23 l 121 -278 l 0 -278 l 0 738 l 121 738 l 121 633 q 220 726 159 691 q 351 761 280 761 q 598 636 504 761 q 685 364 685 522 m 557 371 q 501 560 557 481 q 330 651 437 651 q 162 559 223 651 q 108 366 108 479 q 162 177 108 254 q 333 87 224 87 q 502 178 441 87 q 557 371 557 258 "},"\u2021":{x_min:0,x_max:777,ha:835,o:"m 458 238 l 458 0 l 319 0 l 319 238 l 0 238 l 0 360 l 319 360 l 319 681 l 0 683 l 0 804 l 319 804 l 319 1015 l 458 1013 l 458 804 l 777 804 l 777 683 l 458 683 l 458 360 l 777 360 l 777 238 l 458 238 "},\u03C8:{x_min:0,x_max:808,ha:907,o:"m 465 -278 l 341 -278 l 341 -15 q 87 102 180 -15 q 0 378 0 210 l 0 739 l 133 739 l 133 379 q 182 195 133 275 q 341 98 242 98 l 341 922 l 465 922 l 465 98 q 623 195 563 98 q 675 382 675 278 l 675 742 l 808 742 l 808 381 q 720 104 808 213 q 466 -13 627 -13 l 465 -278 "},\u03B7:{x_min:.78125,x_max:697,ha:810,o:"m 697 -278 l 572 -278 l 572 454 q 540 587 572 536 q 425 650 501 650 q 271 579 337 650 q 206 420 206 509 l 206 0 l 81 0 l 81 489 q 73 588 81 562 q 0 644 56 644 l 0 741 q 68 755 38 755 q 158 720 124 755 q 200 630 193 686 q 297 726 234 692 q 434 761 359 761 q 620 692 544 761 q 697 516 697 624 l 697 -278 "}},kLe="normal",zLe=1189,VLe=-100,GLe="normal",qLe={yMin:-334,xMin:-111,yMax:1189,xMax:1672},HLe=1e3,WLe={postscript_name:"Helvetiker-Regular",version_string:"Version 1.00 2004 initial release",vendor_url:"http://www.magenta.gr/",full_font_name:"Helvetiker",font_family_name:"Helvetiker",copyright:"Copyright (c) \u039Cagenta ltd, 2004",description:"",trademark:"",designer:"",designer_url:"",unique_font_identifier:"\u039Cagenta ltd:Helvetiker:22-10-104",license_url:"http://www.ellak.gr/fonts/MgOpen/license.html",license_description:`Copyright (c) 2004 by MAGENTA Ltd. All Rights Reserved.\r52245224 \r52255225 Permission is hereby granted, free of charge, to any person obtaining a copy of the fonts accompanying this license ("Fonts") and associated documentation files (the "Font Software"), to reproduce and distribute the Font Software, including without limitation the rights to use, copy, merge, publish, distribute, and/or sell copies of the Font Software, and to permit persons to whom the Font Software is furnished to do so, subject to the following conditions: \r52265226 \r@@ -5232,7 +5232,7 @@ This License becomes null and void to the extent applicable to Fonts or Font Sof
52325232 \r52335233 The Font Software may be sold as part of a larger software package but no copy of one or more of the Font Software typefaces may be sold by itself. \r52345234 \r5235-THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL MAGENTA OR PERSONS OR BODIES IN CHARGE OF ADMINISTRATION AND MAINTENANCE OF THE FONT SOFTWARE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.`,manufacturer_name:"\u039Cagenta ltd",font_sub_family_name:"Regular"},ELe=-334,MLe="Helvetiker",CLe=1522,RLe=50,ILe={glyphs:vLe,cssFontWeight:_Le,ascender:xLe,underlinePosition:yLe,cssFontStyle:bLe,boundingBox:wLe,resolution:SLe,original_font_information:TLe,descender:ELe,familyName:MLe,lineHeight:CLe,underlineThickness:RLe},eh=$i($i({},window.THREE?window.THREE:{BoxGeometry:Lu,CircleGeometry:t_,DoubleSide:vr,Group:Br,Mesh:Hn,MeshLambertMaterial:Va,TextGeometry:US,Vector3:re}),{},{Font:Cx,TextGeometry:US}),eae=Kr({props:{labelsData:{default:[]},labelLat:{default:"lat"},labelLng:{default:"lng"},labelAltitude:{default:.002},labelText:{default:"text"},labelSize:{default:.5},labelTypeFace:{default:ILe,onChange:function(e,t){t.font=new eh.Font(e)}},labelColor:{default:function(){return"lightgrey"}},labelRotation:{default:0},labelResolution:{default:3},labelIncludeDot:{default:!0},labelDotRadius:{default:.1},labelDotOrientation:{default:function(){return"bottom"}},labelsTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;ns(e),t.scene=e,t.tweenGroup=r;var s=new eh.CircleGeometry(1,32);t.dataMapper=new Ll(e,{objBindAttr:"__threeObjLabel"}).onCreateObj(function(){var o=new eh.MeshLambertMaterial;o.side=vr;var a=new eh.Group;a.add(new eh.Mesh(s,o));var l=new eh.Mesh(void 0,o);a.add(l);var c=new eh.Mesh;return c.visible=!1,l.add(c),a.__globeObjType="label",a})},update:function(e){var t=st(e.labelLat),n=st(e.labelLng),r=st(e.labelAltitude),s=st(e.labelText),o=st(e.labelSize),a=st(e.labelRotation),l=st(e.labelColor),c=st(e.labelIncludeDot),u=st(e.labelDotRadius),f=st(e.labelDotOrientation),d=new Set(["right","top","bottom"]),A=2*Math.PI*_r/360;e.dataMapper.onUpdateObj(function(y,w){var S=Pr(y.children,2),T=S[0],R=S[1],P=Pr(R.children,1),I=P[0],F=l(w),D=th(F);R.material.color.set(Bf(F)),R.material.transparent=D<1,R.material.opacity=D;var L=c(w),C=f(w);!L||!d.has(C)&&(C="bottom");var B=L?+u(w)*A:1e-12;T.scale.x=T.scale.y=B;var k=+o(w)*A;if(R.geometry&&R.geometry.dispose(),R.geometry=new eh.TextGeometry(s(w),{font:e.font,size:k,depth:0,bevelEnabled:!0,bevelThickness:0,bevelSize:0,curveSegments:e.labelResolution}),I.geometry&&I.geometry.dispose(),R.geometry.computeBoundingBox(),I.geometry=FV(eh.BoxGeometry,tr(new eh.Vector3().subVectors(R.geometry.boundingBox.max,R.geometry.boundingBox.min).clampScalar(0,1/0).toArray())),C!=="right"&&R.geometry.center(),L){var z=B+k/2;C==="right"&&(R.position.x=z),R.position.y={right:-k/2,top:z+k/2,bottom:-z-k/2}[C]}var G=function($){var J=y.__currentTargetD=$,te=J.lat,ce=J.lng,he=J.alt,ve=J.rot,Re=J.scale;Object.assign(y.position,lu(te,ce,he)),y.lookAt(e.scene.localToWorld(new eh.Vector3(0,0,0))),y.rotateY(Math.PI),y.rotateZ(-ve*Math.PI/180),y.scale.x=y.scale.y=y.scale.z=Re},W={lat:+t(w),lng:+n(w),alt:+r(w),rot:+a(w),scale:1},Y=y.__currentTargetD||Object.assign({},W,{scale:1e-12});Object.keys(W).some(function(H){return Y[H]!==W[H]})&&(!e.labelsTransitionDuration||e.labelsTransitionDuration<0?G(W):e.tweenGroup.add(new uo(Y).to(W,e.labelsTransitionDuration).easing(Qr.Quadratic.InOut).onUpdate(G).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(e.labelsData)}}),PLe=$i($i({},window.THREE?window.THREE:{}),{},{CSS2DObject:jM}),tae=Kr({props:{htmlElementsData:{default:[]},htmlLat:{default:"lat"},htmlLng:{default:"lng"},htmlAltitude:{default:0},htmlElement:{},htmlElementVisibilityModifier:{triggerUpdate:!1},htmlTransitionDuration:{default:1e3,triggerUpdate:!1},isBehindGlobe:{onChange:function(){this.updateObjVisibility()},triggerUpdate:!1}},methods:{updateObjVisibility:function(e,t){if(e.dataMapper){var n=t?[t]:e.dataMapper.entries().map(function(r){var s=Pr(r,2),o=s[1];return o}).filter(function(r){return r});n.forEach(function(r){var s=!e.isBehindGlobe||!e.isBehindGlobe(r.position);e.htmlElementVisibilityModifier?(r.visible=!0,e.htmlElementVisibilityModifier(r.element,s)):r.visible=s})}}},init:function(e,t,n){var r=n.tweenGroup;ns(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Ll(e,{objBindAttr:"__threeObjHtml"}).onCreateObj(function(s){var o=st(t.htmlElement)(s),a=new PLe.CSS2DObject(o);return a.__globeObjType="html",a})},update:function(e,t){var n=this,r=st(e.htmlLat),s=st(e.htmlLng),o=st(e.htmlAltitude);t.hasOwnProperty("htmlElement")&&e.dataMapper.clear(),e.dataMapper.onUpdateObj(function(a,l){var c=function(d){var A=a.__currentTargetD=d,y=A.alt,w=A.lat,S=A.lng;Object.assign(a.position,lu(w,S,y)),n.updateObjVisibility(a)},u={lat:+r(l),lng:+s(l),alt:+o(l)};!e.htmlTransitionDuration||e.htmlTransitionDuration<0||!a.__currentTargetD?c(u):e.tweenGroup.add(new uo(a.__currentTargetD).to(u,e.htmlTransitionDuration).easing(Qr.Quadratic.InOut).onUpdate(c).onComplete(function(){e.tweenGroup.remove(this)}).start())}).digest(e.htmlElementsData)}}),$I=window.THREE?window.THREE:{Group:Br,Mesh:Hn,MeshLambertMaterial:Va,SphereGeometry:za},nae=Kr({props:{objectsData:{default:[]},objectLat:{default:"lat"},objectLng:{default:"lng"},objectAltitude:{default:.01},objectFacesSurface:{default:!0},objectRotation:{},objectThreeObject:{default:new $I.Mesh(new $I.SphereGeometry(1,16,8),new $I.MeshLambertMaterial({color:"#ffffaa",transparent:!0,opacity:.7}))}},init:function(e,t){ns(e),t.scene=e,t.dataMapper=new Ll(e,{objBindAttr:"__threeObjObject"}).onCreateObj(function(n){var r=st(t.objectThreeObject)(n);t.objectThreeObject===r&&(r=r.clone());var s=new $I.Group;return s.add(r),s.__globeObjType="object",s})},update:function(e,t){var n=st(e.objectLat),r=st(e.objectLng),s=st(e.objectAltitude),o=st(e.objectFacesSurface),a=st(e.objectRotation);t.hasOwnProperty("objectThreeObject")&&e.dataMapper.clear(),e.dataMapper.onUpdateObj(function(l,c){var u=+n(c),f=+r(c),d=+s(c);Object.assign(l.position,lu(u,f,d)),o(c)?l.setRotationFromEuler(new Oa(A1(-u),A1(f),0,"YXZ")):l.rotation.set(0,0,0);var A=l.children[0],y=a(c);y&&A.setRotationFromEuler(new Oa(A1(y.x||0),A1(y.y||0),A1(y.z||0)))}).digest(e.objectsData)}}),iae=Kr({props:{customLayerData:{default:[]},customThreeObject:{},customThreeObjectUpdate:{triggerUpdate:!1}},init:function(e,t){ns(e),t.scene=e,t.dataMapper=new Ll(e,{objBindAttr:"__threeObjCustom"}).onCreateObj(function(n){var r=st(t.customThreeObject)(n,_r);return r&&(t.customThreeObject===r&&(r=r.clone()),r.__globeObjType="custom"),r})},update:function(e,t){e.customThreeObjectUpdate||ns(e.scene);var n=st(e.customThreeObjectUpdate);t.hasOwnProperty("customThreeObject")&&e.dataMapper.clear(),e.dataMapper.onUpdateObj(function(r,s){return n(r,s,_r)}).digest(e.customLayerData)}}),YI=window.THREE?window.THREE:{Camera:Dd,Group:Br,Vector2:Oe,Vector3:re},LLe=["globeLayer","pointsLayer","arcsLayer","hexBinLayer","heatmapsLayer","polygonsLayer","hexedPolygonsLayer","pathsLayer","tilesLayer","particlesLayer","ringsLayer","labelsLayer","htmlElementsLayer","objectsLayer","customLayer"],rae=tl("globeLayer",Voe),DLe=Object.assign.apply(Object,tr(["globeImageUrl","bumpImageUrl","globeCurvatureResolution","globeTileEngineUrl","globeTileEngineMaxLevel","showGlobe","showGraticules","showAtmosphere","atmosphereColor","atmosphereAltitude"].map(function(i){return Eo({},i,rae.linkProp(i))}))),NLe=Object.assign.apply(Object,tr(["globeMaterial","globeTileEngineClearCache"].map(function(i){return Eo({},i,rae.linkMethod(i))}))),FLe=tl("pointsLayer",Goe),BLe=Object.assign.apply(Object,tr(["pointsData","pointLat","pointLng","pointColor","pointAltitude","pointRadius","pointResolution","pointsMerge","pointsTransitionDuration"].map(function(i){return Eo({},i,FLe.linkProp(i))}))),OLe=tl("arcsLayer",Hoe),ULe=Object.assign.apply(Object,tr(["arcsData","arcStartLat","arcStartLng","arcStartAltitude","arcEndLat","arcEndLng","arcEndAltitude","arcColor","arcAltitude","arcAltitudeAutoScale","arcStroke","arcCurveResolution","arcCircularResolution","arcDashLength","arcDashGap","arcDashInitialGap","arcDashAnimateTime","arcsTransitionDuration"].map(function(i){return Eo({},i,OLe.linkProp(i))}))),kLe=tl("hexBinLayer",Woe),zLe=Object.assign.apply(Object,tr(["hexBinPointsData","hexBinPointLat","hexBinPointLng","hexBinPointWeight","hexBinResolution","hexMargin","hexTopCurvatureResolution","hexTopColor","hexSideColor","hexAltitude","hexBinMerge","hexTransitionDuration"].map(function(i){return Eo({},i,kLe.linkProp(i))}))),VLe=tl("heatmapsLayer",Xoe),GLe=Object.assign.apply(Object,tr(["heatmapsData","heatmapPoints","heatmapPointLat","heatmapPointLng","heatmapPointWeight","heatmapBandwidth","heatmapColorFn","heatmapColorSaturation","heatmapBaseAltitude","heatmapTopAltitude","heatmapsTransitionDuration"].map(function(i){return Eo({},i,VLe.linkProp(i))}))),qLe=tl("hexedPolygonsLayer",Yoe),HLe=Object.assign.apply(Object,tr(["hexPolygonsData","hexPolygonGeoJsonGeometry","hexPolygonColor","hexPolygonAltitude","hexPolygonResolution","hexPolygonMargin","hexPolygonUseDots","hexPolygonCurvatureResolution","hexPolygonDotResolution","hexPolygonsTransitionDuration"].map(function(i){return Eo({},i,qLe.linkProp(i))}))),WLe=tl("polygonsLayer",$oe),jLe=Object.assign.apply(Object,tr(["polygonsData","polygonGeoJsonGeometry","polygonCapColor","polygonCapMaterial","polygonSideColor","polygonSideMaterial","polygonStrokeColor","polygonAltitude","polygonCapCurvatureResolution","polygonsTransitionDuration"].map(function(i){return Eo({},i,WLe.linkProp(i))}))),XLe=tl("pathsLayer",Zoe),$Le=Object.assign.apply(Object,tr(["pathsData","pathPoints","pathPointLat","pathPointLng","pathPointAlt","pathResolution","pathColor","pathStroke","pathDashLength","pathDashGap","pathDashInitialGap","pathDashAnimateTime","pathTransitionDuration"].map(function(i){return Eo({},i,XLe.linkProp(i))}))),YLe=tl("tilesLayer",Koe),ZLe=Object.assign.apply(Object,tr(["tilesData","tileLat","tileLng","tileAltitude","tileWidth","tileHeight","tileUseGlobeProjection","tileMaterial","tileCurvatureResolution","tilesTransitionDuration"].map(function(i){return Eo({},i,YLe.linkProp(i))}))),KLe=tl("particlesLayer",Qoe),QLe=Object.assign.apply(Object,tr(["particlesData","particlesList","particleLat","particleLng","particleAltitude","particlesSize","particlesSizeAttenuation","particlesColor","particlesTexture"].map(function(i){return Eo({},i,KLe.linkProp(i))}))),JLe=tl("ringsLayer",Joe),eDe=Object.assign.apply(Object,tr(["ringsData","ringLat","ringLng","ringAltitude","ringColor","ringResolution","ringMaxRadius","ringPropagationSpeed","ringRepeatPeriod"].map(function(i){return Eo({},i,JLe.linkProp(i))}))),tDe=tl("labelsLayer",eae),nDe=Object.assign.apply(Object,tr(["labelsData","labelLat","labelLng","labelAltitude","labelRotation","labelText","labelSize","labelTypeFace","labelColor","labelResolution","labelIncludeDot","labelDotRadius","labelDotOrientation","labelsTransitionDuration"].map(function(i){return Eo({},i,tDe.linkProp(i))}))),iDe=tl("htmlElementsLayer",tae),rDe=Object.assign.apply(Object,tr(["htmlElementsData","htmlLat","htmlLng","htmlAltitude","htmlElement","htmlElementVisibilityModifier","htmlTransitionDuration"].map(function(i){return Eo({},i,iDe.linkProp(i))}))),sDe=tl("objectsLayer",nae),oDe=Object.assign.apply(Object,tr(["objectsData","objectLat","objectLng","objectAltitude","objectRotation","objectFacesSurface","objectThreeObject"].map(function(i){return Eo({},i,sDe.linkProp(i))}))),aDe=tl("customLayer",iae),lDe=Object.assign.apply(Object,tr(["customLayerData","customThreeObject","customThreeObjectUpdate"].map(function(i){return Eo({},i,aDe.linkProp(i))}))),cDe=Kr({props:$i($i($i($i($i($i($i($i($i($i($i($i($i($i($i({onGlobeReady:{triggerUpdate:!1},rendererSize:{default:new YI.Vector2(window.innerWidth,window.innerHeight),onChange:function(e,t){t.pathsLayer.rendererSize(e)},triggerUpdate:!1}},DLe),BLe),ULe),zLe),GLe),jLe),HLe),$Le),ZLe),QLe),eDe),nDe),rDe),oDe),lDe),methods:$i({getGlobeRadius:Moe,getCoords:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return lu.apply(void 0,n)},toGeoCoords:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return zoe.apply(void 0,n)},setPointOfView:function(e,t){var n=t instanceof YI.Camera?t.position:t,r=Moe(),s=void 0;if(e.scene&&n){var o,a,l,c;s=function(f){o===void 0&&(o=n.clone().applyMatrix4(e.scene.matrixWorld.clone().invert())),a===void 0&&(a=o.length()),l===void 0&&(l=Math.sqrt(Math.pow(a,2)-Math.pow(r,2))),c===void 0&&(c=Math.acos(l/a));var d=o.distanceTo(f);if(d<l)return!1;var A=f.length(),y=Math.acos((Math.pow(a,2)+Math.pow(d,2)-Math.pow(A,2))/(2*a*d));return y<c}}e.layersThatNeedUpdatePov.forEach(function(u){return u.updatePov(t)}),e.layersThatNeedBehindGlobeChecker.forEach(function(u){return u.isBehindGlobe(s)})},pauseAnimation:function(e){return e.animationFrameRequestId!==null&&(cancelAnimationFrame(e.animationFrameRequestId),e.animationFrameRequestId=null),e.pausableLayers.forEach(function(t){var n;return(n=t.pauseAnimation)===null||n===void 0?void 0:n.call(t)}),this},resumeAnimation:function(e){return e.animationFrameRequestId===null&&this._animationCycle(),e.pausableLayers.forEach(function(t){var n;return(n=t.resumeAnimation)===null||n===void 0?void 0:n.call(t)}),this},_animationCycle:function(e){e.animationFrameRequestId=requestAnimationFrame(this._animationCycle),e.tweenGroup.update()},_destructor:function(e){this.pauseAnimation(),e.destructableLayers.forEach(function(t){return t._destructor()})}},NLe),stateInit:function(){var e=new vg,t={tweenGroup:e},n={globeLayer:Voe(t),pointsLayer:Goe(t),arcsLayer:Hoe(t),hexBinLayer:Woe(t),heatmapsLayer:Xoe(t),polygonsLayer:$oe(t),hexedPolygonsLayer:Yoe(t),pathsLayer:Zoe(t),tilesLayer:Koe(t),particlesLayer:Qoe(t),ringsLayer:Joe(t),labelsLayer:eae(t),htmlElementsLayer:tae(t),objectsLayer:nae(t),customLayer:iae(t)};return $i($i({tweenGroup:e},n),{},{layersThatNeedUpdatePov:Object.values(n).filter(function(r){return r.hasOwnProperty("updatePov")}),layersThatNeedBehindGlobeChecker:Object.values(n).filter(function(r){return r.hasOwnProperty("isBehindGlobe")}),destructableLayers:Object.values(n).filter(function(r){return r.hasOwnProperty("_destructor")}),pausableLayers:Object.values(n).filter(function(r){return r.hasOwnProperty("pauseAnimation")})})},init:function(e,t,n){var r=n.animateIn,s=r===void 0?!0:r,o=n.waitForGlobeReady,a=o===void 0?!0:o;ns(e),t.scene=e,t.scene.visible=!1,LLe.forEach(function(c){var u=new YI.Group;t.scene.add(u),t[c](u)});var l=function(){if(s){t.scene.scale.set(1e-6,1e-6,1e-6),t.tweenGroup.add(new uo({k:1e-6}).to({k:1},600).easing(Qr.Quadratic.Out).onUpdate(function(f){var d=f.k;return t.scene.scale.set(d,d,d)}).onComplete(function(){t.tweenGroup.remove(this)}).start());var u=new YI.Vector3(0,1,0);t.tweenGroup.add(new uo({rot:Math.PI*2}).to({rot:0},1200).easing(Qr.Quintic.Out).onUpdate(function(f){var d=f.rot;return t.scene.setRotationFromAxisAngle(u,d)}).onComplete(function(){t.tweenGroup.remove(this)}).start())}t.scene.visible=!0,t.onGlobeReady&&t.onGlobeReady()};a?t.globeLayer.onReady(l):l(),this._animationCycle()},update:function(e){}});function uDe(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Object,t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=(function(r){function s(){var o;KI(this,s);for(var a=arguments.length,l=new Array(a),c=0;c<a;c++)l[c]=arguments[c];return o=ZI(this,s,[].concat(l)),o.__kapsuleInstance=FV(i,[].concat(tr(t?[o]:[]),l)),o}return JI(s,r),QI(s)})(e);return Object.keys(i()).forEach(function(r){return n.prototype[r]=function(){var s,o=(s=this.__kapsuleInstance)[r].apply(s,arguments);return o===this.__kapsuleInstance?this:o}}),n}var hDe=window.THREE?window.THREE:{Group:Br},UV=uDe(cDe,hDe.Group,!0);var kV={type:"change"},GV={type:"start"},qV={type:"end"},sae=1e-6,ki={NONE:-1,ROTATE:0,ZOOM:1,PAN:2,TOUCH_ROTATE:3,TOUCH_ZOOM_PAN:4},eP=new Oe,Pm=new Oe,fDe=new re,tP=new re,zV=new re,Dx=new qs,oae=new re,nP=new re,VV=new re,iP=new re,rP=class extends Nd{constructor(e,t=null){super(e,t),this.screen={left:0,top:0,width:0,height:0},this.rotateSpeed=1,this.zoomSpeed=1.2,this.panSpeed=.3,this.noRotate=!1,this.noZoom=!1,this.noPan=!1,this.staticMoving=!1,this.dynamicDampingFactor=.2,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.keys=["KeyA","KeyS","KeyD"],this.mouseButtons={LEFT:Ga.ROTATE,MIDDLE:Ga.DOLLY,RIGHT:Ga.PAN},this.target=new re,this.state=ki.NONE,this.keyState=ki.NONE,this._lastPosition=new re,this._lastZoom=1,this._touchZoomDistanceStart=0,this._touchZoomDistanceEnd=0,this._lastAngle=0,this._eye=new re,this._movePrev=new Oe,this._moveCurr=new Oe,this._lastAxis=new re,this._zoomStart=new Oe,this._zoomEnd=new Oe,this._panStart=new Oe,this._panEnd=new Oe,this._pointers=[],this._pointerPositions={},this._onPointerMove=pDe.bind(this),this._onPointerDown=dDe.bind(this),this._onPointerUp=mDe.bind(this),this._onPointerCancel=ADe.bind(this),this._onContextMenu=wDe.bind(this),this._onMouseWheel=bDe.bind(this),this._onKeyDown=vDe.bind(this),this._onKeyUp=gDe.bind(this),this._onTouchStart=SDe.bind(this),this._onTouchMove=TDe.bind(this),this._onTouchEnd=EDe.bind(this),this._onMouseDown=_De.bind(this),this._onMouseMove=xDe.bind(this),this._onMouseUp=yDe.bind(this),this._target0=this.target.clone(),this._position0=this.object.position.clone(),this._up0=this.object.up.clone(),this._zoom0=this.object.zoom,t!==null&&(this.connect(t),this.handleResize()),this.update()}connect(e){super.connect(e),window.addEventListener("keydown",this._onKeyDown),window.addEventListener("keyup",this._onKeyUp),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerCancel),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.style.touchAction="none"}disconnect(){window.removeEventListener("keydown",this._onKeyDown),window.removeEventListener("keyup",this._onKeyUp),this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerCancel),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.domElement.style.touchAction=""}dispose(){this.disconnect()}handleResize(){let e=this.domElement.getBoundingClientRect(),t=this.domElement.ownerDocument.documentElement;this.screen.left=e.left+window.pageXOffset-t.clientLeft,this.screen.top=e.top+window.pageYOffset-t.clientTop,this.screen.width=e.width,this.screen.height=e.height}update(){this._eye.subVectors(this.object.position,this.target),this.noRotate||this._rotateCamera(),this.noZoom||this._zoomCamera(),this.noPan||this._panCamera(),this.object.position.addVectors(this.target,this._eye),this.object.isPerspectiveCamera?(this._checkDistances(),this.object.lookAt(this.target),this._lastPosition.distanceToSquared(this.object.position)>sae&&(this.dispatchEvent(kV),this._lastPosition.copy(this.object.position))):this.object.isOrthographicCamera?(this.object.lookAt(this.target),(this._lastPosition.distanceToSquared(this.object.position)>sae||this._lastZoom!==this.object.zoom)&&(this.dispatchEvent(kV),this._lastPosition.copy(this.object.position),this._lastZoom=this.object.zoom)):console.warn("THREE.TrackballControls: Unsupported camera type.")}reset(){this.state=ki.NONE,this.keyState=ki.NONE,this.target.copy(this._target0),this.object.position.copy(this._position0),this.object.up.copy(this._up0),this.object.zoom=this._zoom0,this.object.updateProjectionMatrix(),this._eye.subVectors(this.object.position,this.target),this.object.lookAt(this.target),this.dispatchEvent(kV),this._lastPosition.copy(this.object.position),this._lastZoom=this.object.zoom}_panCamera(){if(Pm.copy(this._panEnd).sub(this._panStart),Pm.lengthSq()){if(this.object.isOrthographicCamera){let e=(this.object.right-this.object.left)/this.object.zoom/this.domElement.clientWidth,t=(this.object.top-this.object.bottom)/this.object.zoom/this.domElement.clientWidth;Pm.x*=e,Pm.y*=t}Pm.multiplyScalar(this._eye.length()*this.panSpeed),tP.copy(this._eye).cross(this.object.up).setLength(Pm.x),tP.add(fDe.copy(this.object.up).setLength(Pm.y)),this.object.position.add(tP),this.target.add(tP),this.staticMoving?this._panStart.copy(this._panEnd):this._panStart.add(Pm.subVectors(this._panEnd,this._panStart).multiplyScalar(this.dynamicDampingFactor))}}_rotateCamera(){iP.set(this._moveCurr.x-this._movePrev.x,this._moveCurr.y-this._movePrev.y,0);let e=iP.length();e?(this._eye.copy(this.object.position).sub(this.target),oae.copy(this._eye).normalize(),nP.copy(this.object.up).normalize(),VV.crossVectors(nP,oae).normalize(),nP.setLength(this._moveCurr.y-this._movePrev.y),VV.setLength(this._moveCurr.x-this._movePrev.x),iP.copy(nP.add(VV)),zV.crossVectors(iP,this._eye).normalize(),e*=this.rotateSpeed,Dx.setFromAxisAngle(zV,e),this._eye.applyQuaternion(Dx),this.object.up.applyQuaternion(Dx),this._lastAxis.copy(zV),this._lastAngle=e):!this.staticMoving&&this._lastAngle&&(this._lastAngle*=Math.sqrt(1-this.dynamicDampingFactor),this._eye.copy(this.object.position).sub(this.target),Dx.setFromAxisAngle(this._lastAxis,this._lastAngle),this._eye.applyQuaternion(Dx),this.object.up.applyQuaternion(Dx)),this._movePrev.copy(this._moveCurr)}_zoomCamera(){let e;this.state===ki.TOUCH_ZOOM_PAN?(e=this._touchZoomDistanceStart/this._touchZoomDistanceEnd,this._touchZoomDistanceStart=this._touchZoomDistanceEnd,this.object.isPerspectiveCamera?this._eye.multiplyScalar(e):this.object.isOrthographicCamera?(this.object.zoom=Bu.clamp(this.object.zoom/e,this.minZoom,this.maxZoom),this._lastZoom!==this.object.zoom&&this.object.updateProjectionMatrix()):console.warn("THREE.TrackballControls: Unsupported camera type")):(e=1+(this._zoomEnd.y-this._zoomStart.y)*this.zoomSpeed,e!==1&&e>0&&(this.object.isPerspectiveCamera?this._eye.multiplyScalar(e):this.object.isOrthographicCamera?(this.object.zoom=Bu.clamp(this.object.zoom/e,this.minZoom,this.maxZoom),this._lastZoom!==this.object.zoom&&this.object.updateProjectionMatrix()):console.warn("THREE.TrackballControls: Unsupported camera type")),this.staticMoving?this._zoomStart.copy(this._zoomEnd):this._zoomStart.y+=(this._zoomEnd.y-this._zoomStart.y)*this.dynamicDampingFactor)}_getMouseOnScreen(e,t){return eP.set((e-this.screen.left)/this.screen.width,(t-this.screen.top)/this.screen.height),eP}_getMouseOnCircle(e,t){return eP.set((e-this.screen.width*.5-this.screen.left)/(this.screen.width*.5),(this.screen.height+2*(this.screen.top-t))/this.screen.width),eP}_addPointer(e){this._pointers.push(e)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t<this._pointers.length;t++)if(this._pointers[t].pointerId==e.pointerId){this._pointers.splice(t,1);return}}_trackPointer(e){let t=this._pointerPositions[e.pointerId];t===void 0&&(t=new Oe,this._pointerPositions[e.pointerId]=t),t.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){let t=e.pointerId===this._pointers[0].pointerId?this._pointers[1]:this._pointers[0];return this._pointerPositions[t.pointerId]}_checkDistances(){(!this.noZoom||!this.noPan)&&(this._eye.lengthSq()>this.maxDistance*this.maxDistance&&(this.object.position.addVectors(this.target,this._eye.setLength(this.maxDistance)),this._zoomStart.copy(this._zoomEnd)),this._eye.lengthSq()<this.minDistance*this.minDistance&&(this.object.position.addVectors(this.target,this._eye.setLength(this.minDistance)),this._zoomStart.copy(this._zoomEnd)))}};function dDe(i){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(i.pointerId),this.domElement.ownerDocument.addEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this._onPointerUp)),this._addPointer(i),i.pointerType==="touch"?this._onTouchStart(i):this._onMouseDown(i))}function pDe(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchMove(i):this._onMouseMove(i))}function mDe(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchEnd(i):this._onMouseUp(),this._removePointer(i),this._pointers.length===0&&(this.domElement.releasePointerCapture(i.pointerId),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp)))}function ADe(i){this._removePointer(i)}function gDe(){this.enabled!==!1&&(this.keyState=ki.NONE,window.addEventListener("keydown",this._onKeyDown))}function vDe(i){this.enabled!==!1&&(window.removeEventListener("keydown",this._onKeyDown),this.keyState===ki.NONE&&(i.code===this.keys[ki.ROTATE]&&!this.noRotate?this.keyState=ki.ROTATE:i.code===this.keys[ki.ZOOM]&&!this.noZoom?this.keyState=ki.ZOOM:i.code===this.keys[ki.PAN]&&!this.noPan&&(this.keyState=ki.PAN)))}function _De(i){let e;switch(i.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case Ga.DOLLY:this.state=ki.ZOOM;break;case Ga.ROTATE:this.state=ki.ROTATE;break;case Ga.PAN:this.state=ki.PAN;break;default:this.state=ki.NONE}let t=this.keyState!==ki.NONE?this.keyState:this.state;t===ki.ROTATE&&!this.noRotate?(this._moveCurr.copy(this._getMouseOnCircle(i.pageX,i.pageY)),this._movePrev.copy(this._moveCurr)):t===ki.ZOOM&&!this.noZoom?(this._zoomStart.copy(this._getMouseOnScreen(i.pageX,i.pageY)),this._zoomEnd.copy(this._zoomStart)):t===ki.PAN&&!this.noPan&&(this._panStart.copy(this._getMouseOnScreen(i.pageX,i.pageY)),this._panEnd.copy(this._panStart)),this.dispatchEvent(GV)}function xDe(i){let e=this.keyState!==ki.NONE?this.keyState:this.state;e===ki.ROTATE&&!this.noRotate?(this._movePrev.copy(this._moveCurr),this._moveCurr.copy(this._getMouseOnCircle(i.pageX,i.pageY))):e===ki.ZOOM&&!this.noZoom?this._zoomEnd.copy(this._getMouseOnScreen(i.pageX,i.pageY)):e===ki.PAN&&!this.noPan&&this._panEnd.copy(this._getMouseOnScreen(i.pageX,i.pageY))}function yDe(){this.state=ki.NONE,this.dispatchEvent(qV)}function bDe(i){if(this.enabled!==!1&&this.noZoom!==!0){switch(i.preventDefault(),i.deltaMode){case 2:this._zoomStart.y-=i.deltaY*.025;break;case 1:this._zoomStart.y-=i.deltaY*.01;break;default:this._zoomStart.y-=i.deltaY*25e-5;break}this.dispatchEvent(GV),this.dispatchEvent(qV)}}function wDe(i){this.enabled!==!1&&i.preventDefault()}function SDe(i){if(this._trackPointer(i),this._pointers.length===1)this.state=ki.TOUCH_ROTATE,this._moveCurr.copy(this._getMouseOnCircle(this._pointers[0].pageX,this._pointers[0].pageY)),this._movePrev.copy(this._moveCurr);else{this.state=ki.TOUCH_ZOOM_PAN;let e=this._pointers[0].pageX-this._pointers[1].pageX,t=this._pointers[0].pageY-this._pointers[1].pageY;this._touchZoomDistanceEnd=this._touchZoomDistanceStart=Math.sqrt(e*e+t*t);let n=(this._pointers[0].pageX+this._pointers[1].pageX)/2,r=(this._pointers[0].pageY+this._pointers[1].pageY)/2;this._panStart.copy(this._getMouseOnScreen(n,r)),this._panEnd.copy(this._panStart)}this.dispatchEvent(GV)}function TDe(i){if(this._trackPointer(i),this._pointers.length===1)this._movePrev.copy(this._moveCurr),this._moveCurr.copy(this._getMouseOnCircle(i.pageX,i.pageY));else{let e=this._getSecondPointerPosition(i),t=i.pageX-e.x,n=i.pageY-e.y;this._touchZoomDistanceEnd=Math.sqrt(t*t+n*n);let r=(i.pageX+e.x)/2,s=(i.pageY+e.y)/2;this._panEnd.copy(this._getMouseOnScreen(r,s))}}function EDe(i){switch(this._pointers.length){case 0:this.state=ki.NONE;break;case 1:this.state=ki.TOUCH_ROTATE,this._moveCurr.copy(this._getMouseOnCircle(i.pageX,i.pageY)),this._movePrev.copy(this._moveCurr);break;case 2:this.state=ki.TOUCH_ZOOM_PAN;for(let e=0;e<this._pointers.length;e++)if(this._pointers[e].pointerId!==i.pointerId){let t=this._pointerPositions[this._pointers[e].pointerId];this._moveCurr.copy(this._getMouseOnCircle(t.x,t.y)),this._movePrev.copy(this._moveCurr);break}break}this.dispatchEvent(qV)}var aae={type:"change"},WV={type:"start"},cae={type:"end"},sP=new Ld,lae=new Da,MDe=Math.cos(70*Bu.DEG2RAD),ho=new re,Dl=2*Math.PI,dr={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},HV=1e-6,oP=class extends Nd{constructor(e,t=null){super(e,t),this.state=dr.NONE,this.target=new re,this.cursor=new re,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.keyRotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:Ga.ROTATE,MIDDLE:Ga.DOLLY,RIGHT:Ga.PAN},this.touches={ONE:d0.ROTATE,TWO:d0.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._cursorStyle="auto",this._domElementKeyEvents=null,this._lastPosition=new re,this._lastQuaternion=new qs,this._lastTargetPosition=new re,this._quat=new qs().setFromUnitVectors(e.up,new re(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new l_,this._sphericalDelta=new l_,this._scale=1,this._panOffset=new re,this._rotateStart=new Oe,this._rotateEnd=new Oe,this._rotateDelta=new Oe,this._panStart=new Oe,this._panEnd=new Oe,this._panDelta=new Oe,this._dollyStart=new Oe,this._dollyEnd=new Oe,this._dollyDelta=new Oe,this._dollyDirection=new re,this._mouse=new Oe,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=RDe.bind(this),this._onPointerDown=CDe.bind(this),this._onPointerUp=IDe.bind(this),this._onContextMenu=ODe.bind(this),this._onMouseWheel=DDe.bind(this),this._onKeyDown=NDe.bind(this),this._onTouchStart=FDe.bind(this),this._onTouchMove=BDe.bind(this),this._onMouseDown=PDe.bind(this),this._onMouseMove=LDe.bind(this),this._interceptControlDown=UDe.bind(this),this._interceptControlUp=kDe.bind(this),this.domElement!==null&&this.connect(this.domElement),this.update()}set cursorStyle(e){this._cursorStyle=e,e==="grab"?this.domElement.style.cursor="grab":this.domElement.style.cursor="auto"}get cursorStyle(){return this._cursorStyle}connect(e){super.connect(e),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction=""}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(e){e.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=e}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(aae),this.update(),this.state=dr.NONE}pan(e,t){this._pan(e,t),this.update()}dollyIn(e){this._dollyIn(e),this.update()}dollyOut(e){this._dollyOut(e),this.update()}rotateLeft(e){this._rotateLeft(e),this.update()}rotateUp(e){this._rotateUp(e),this.update()}update(e=null){let t=this.object.position;ho.copy(t).sub(this.target),ho.applyQuaternion(this._quat),this._spherical.setFromVector3(ho),this.autoRotate&&this.state===dr.NONE&&this._rotateLeft(this._getAutoRotationAngle(e)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let n=this.minAzimuthAngle,r=this.maxAzimuthAngle;isFinite(n)&&isFinite(r)&&(n<-Math.PI?n+=Dl:n>Math.PI&&(n-=Dl),r<-Math.PI?r+=Dl:r>Math.PI&&(r-=Dl),n<=r?this._spherical.theta=Math.max(n,Math.min(r,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(n+r)/2?Math.max(n,this._spherical.theta):Math.min(r,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let s=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{let o=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),s=o!=this._spherical.radius}if(ho.setFromSpherical(this._spherical),ho.applyQuaternion(this._quatInverse),t.copy(this.target).add(ho),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let o=null;if(this.object.isPerspectiveCamera){let a=ho.length();o=this._clampDistance(a*this._scale);let l=a-o;this.object.position.addScaledVector(this._dollyDirection,l),this.object.updateMatrixWorld(),s=!!l}else if(this.object.isOrthographicCamera){let a=new re(this._mouse.x,this._mouse.y,0);a.unproject(this.object);let l=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),s=l!==this.object.zoom;let c=new re(this._mouse.x,this._mouse.y,0);c.unproject(this.object),this.object.position.sub(c).add(a),this.object.updateMatrixWorld(),o=ho.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;o!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position):(sP.origin.copy(this.object.position),sP.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(sP.direction))<MDe?this.object.lookAt(this.target):(lae.setFromNormalAndCoplanarPoint(this.object.up,this.target),sP.intersectPlane(lae,this.target))))}else if(this.object.isOrthographicCamera){let o=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),o!==this.object.zoom&&(this.object.updateProjectionMatrix(),s=!0)}return this._scale=1,this._performCursorZoom=!1,s||this._lastPosition.distanceToSquared(this.object.position)>HV||8*(1-this._lastQuaternion.dot(this.object.quaternion))>HV||this._lastTargetPosition.distanceToSquared(this.target)>HV?(this.dispatchEvent(aae),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?Dl/60*this.autoRotateSpeed*e:Dl/60/60*this.autoRotateSpeed}_getZoomScale(e){let t=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){ho.setFromMatrixColumn(t,0),ho.multiplyScalar(-e),this._panOffset.add(ho)}_panUp(e,t){this.screenSpacePanning===!0?ho.setFromMatrixColumn(t,1):(ho.setFromMatrixColumn(t,0),ho.crossVectors(this.object.up,ho)),ho.multiplyScalar(e),this._panOffset.add(ho)}_pan(e,t){let n=this.domElement;if(this.object.isPerspectiveCamera){let r=this.object.position;ho.copy(r).sub(this.target);let s=ho.length();s*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*s/n.clientHeight,this.object.matrix),this._panUp(2*t*s/n.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;let n=this.domElement.getBoundingClientRect(),r=e-n.left,s=t-n.top,o=n.width,a=n.height;this._mouse.x=r/o*2-1,this._mouse.y=-(s/a)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;this._rotateLeft(Dl*this._rotateDelta.x/t.clientHeight),this._rotateUp(Dl*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(Dl*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-Dl*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(Dl*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-Dl*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._rotateStart.set(n,r)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panStart.set(n,r)}}_handleTouchStartDolly(e){let t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,s=Math.sqrt(n*n+r*r);this._dollyStart.set(0,s)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{let n=this._getSecondPointerPosition(e),r=.5*(e.pageX+n.x),s=.5*(e.pageY+n.y);this._rotateEnd.set(r,s)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;this._rotateLeft(Dl*this._rotateDelta.x/t.clientHeight),this._rotateUp(Dl*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panEnd.set(n,r)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){let t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,s=Math.sqrt(n*n+r*r);this._dollyEnd.set(0,s),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);let o=(e.pageX+t.x)*.5,a=(e.pageY+t.y)*.5;this._updateZoomParameters(o,a)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId){this._pointers.splice(t,1);return}}_isTrackingPointer(e){for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId)return!0;return!1}_trackPointer(e){let t=this._pointerPositions[e.pointerId];t===void 0&&(t=new Oe,this._pointerPositions[e.pointerId]=t),t.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){let t=e.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[t]}_customWheelEvent(e){let t=e.deltaMode,n={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(t){case 1:n.deltaY*=16;break;case 2:n.deltaY*=100;break}return e.ctrlKey&&!this._controlActive&&(n.deltaY*=10),n}};function CDe(i){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(i.pointerId),this.domElement.ownerDocument.addEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(i)&&(this._addPointer(i),i.pointerType==="touch"?this._onTouchStart(i):this._onMouseDown(i),this._cursorStyle==="grab"&&(this.domElement.style.cursor="grabbing")))}function RDe(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchMove(i):this._onMouseMove(i))}function IDe(i){switch(this._removePointer(i),this._pointers.length){case 0:this.domElement.releasePointerCapture(i.pointerId),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(cae),this.state=dr.NONE,this._cursorStyle==="grab"&&(this.domElement.style.cursor="grab");break;case 1:let e=this._pointers[0],t=this._pointerPositions[e];this._onTouchStart({pointerId:e,pageX:t.x,pageY:t.y});break}}function PDe(i){let e;switch(i.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case Ga.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(i),this.state=dr.DOLLY;break;case Ga.ROTATE:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=dr.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=dr.ROTATE}break;case Ga.PAN:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=dr.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=dr.PAN}break;default:this.state=dr.NONE}this.state!==dr.NONE&&this.dispatchEvent(WV)}function LDe(i){switch(this.state){case dr.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(i);break;case dr.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(i);break;case dr.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(i);break}}function DDe(i){this.enabled===!1||this.enableZoom===!1||this.state!==dr.NONE||(i.preventDefault(),this.dispatchEvent(WV),this._handleMouseWheel(this._customWheelEvent(i)),this.dispatchEvent(cae))}function NDe(i){this.enabled!==!1&&this._handleKeyDown(i)}function FDe(i){switch(this._trackPointer(i),this._pointers.length){case 1:switch(this.touches.ONE){case d0.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(i),this.state=dr.TOUCH_ROTATE;break;case d0.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(i),this.state=dr.TOUCH_PAN;break;default:this.state=dr.NONE}break;case 2:switch(this.touches.TWO){case d0.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(i),this.state=dr.TOUCH_DOLLY_PAN;break;case d0.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(i),this.state=dr.TOUCH_DOLLY_ROTATE;break;default:this.state=dr.NONE}break;default:this.state=dr.NONE}this.state!==dr.NONE&&this.dispatchEvent(WV)}function BDe(i){switch(this._trackPointer(i),this.state){case dr.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(i),this.update();break;case dr.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(i),this.update();break;case dr.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(i),this.update();break;case dr.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(i),this.update();break;default:this.state=dr.NONE}}function ODe(i){this.enabled!==!1&&i.preventDefault()}function UDe(i){i.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function kDe(i){i.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}var zDe={type:"change"},uae=1e-6,hae=new qs,aP=class extends Nd{constructor(e,t=null){super(e,t),this.movementSpeed=1,this.rollSpeed=.005,this.dragToLook=!1,this.autoForward=!1,this._moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0},this._moveVector=new re(0,0,0),this._rotationVector=new re(0,0,0),this._lastQuaternion=new qs,this._lastPosition=new re,this._status=0,this._onKeyDown=VDe.bind(this),this._onKeyUp=GDe.bind(this),this._onPointerMove=HDe.bind(this),this._onPointerDown=qDe.bind(this),this._onPointerUp=WDe.bind(this),this._onPointerCancel=jDe.bind(this),this._onContextMenu=XDe.bind(this),t!==null&&this.connect(t)}connect(e){super.connect(e),window.addEventListener("keydown",this._onKeyDown),window.addEventListener("keyup",this._onKeyUp),this.domElement.addEventListener("pointermove",this._onPointerMove),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointerup",this._onPointerUp),this.domElement.addEventListener("pointercancel",this._onPointerCancel),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.style.touchAction="none"}disconnect(){window.removeEventListener("keydown",this._onKeyDown),window.removeEventListener("keyup",this._onKeyUp),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerCancel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.domElement.style.touchAction=""}dispose(){this.disconnect()}update(e){if(this.enabled===!1)return;let t=this.object,n=e*this.movementSpeed,r=e*this.rollSpeed;t.translateX(this._moveVector.x*n),t.translateY(this._moveVector.y*n),t.translateZ(this._moveVector.z*n),hae.set(this._rotationVector.x*r,this._rotationVector.y*r,this._rotationVector.z*r,1).normalize(),t.quaternion.multiply(hae),(this._lastPosition.distanceToSquared(t.position)>uae||8*(1-this._lastQuaternion.dot(t.quaternion))>uae)&&(this.dispatchEvent(zDe),this._lastQuaternion.copy(t.quaternion),this._lastPosition.copy(t.position))}_updateMovementVector(){let e=this._moveState.forward||this.autoForward&&!this._moveState.back?1:0;this._moveVector.x=-this._moveState.left+this._moveState.right,this._moveVector.y=-this._moveState.down+this._moveState.up,this._moveVector.z=-e+this._moveState.back}_updateRotationVector(){this._rotationVector.x=-this._moveState.pitchDown+this._moveState.pitchUp,this._rotationVector.y=-this._moveState.yawRight+this._moveState.yawLeft,this._rotationVector.z=-this._moveState.rollRight+this._moveState.rollLeft}_getContainerDimensions(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}}};function VDe(i){if(!(i.altKey||this.enabled===!1)){switch(i.code){case"ShiftLeft":case"ShiftRight":this.movementSpeedMultiplier=.1;break;case"KeyW":this._moveState.forward=1;break;case"KeyS":this._moveState.back=1;break;case"KeyA":this._moveState.left=1;break;case"KeyD":this._moveState.right=1;break;case"KeyR":this._moveState.up=1;break;case"KeyF":this._moveState.down=1;break;case"ArrowUp":this._moveState.pitchUp=1;break;case"ArrowDown":this._moveState.pitchDown=1;break;case"ArrowLeft":this._moveState.yawLeft=1;break;case"ArrowRight":this._moveState.yawRight=1;break;case"KeyQ":this._moveState.rollLeft=1;break;case"KeyE":this._moveState.rollRight=1;break}this._updateMovementVector(),this._updateRotationVector()}}function GDe(i){if(this.enabled!==!1){switch(i.code){case"ShiftLeft":case"ShiftRight":this.movementSpeedMultiplier=1;break;case"KeyW":this._moveState.forward=0;break;case"KeyS":this._moveState.back=0;break;case"KeyA":this._moveState.left=0;break;case"KeyD":this._moveState.right=0;break;case"KeyR":this._moveState.up=0;break;case"KeyF":this._moveState.down=0;break;case"ArrowUp":this._moveState.pitchUp=0;break;case"ArrowDown":this._moveState.pitchDown=0;break;case"ArrowLeft":this._moveState.yawLeft=0;break;case"ArrowRight":this._moveState.yawRight=0;break;case"KeyQ":this._moveState.rollLeft=0;break;case"KeyE":this._moveState.rollRight=0;break}this._updateMovementVector(),this._updateRotationVector()}}function qDe(i){if(this.enabled!==!1)if(this.dragToLook)this._status++;else{switch(i.button){case 0:this._moveState.forward=1;break;case 2:this._moveState.back=1;break}this._updateMovementVector()}}function HDe(i){if(this.enabled!==!1&&(!this.dragToLook||this._status>0)){let e=this._getContainerDimensions(),t=e.size[0]/2,n=e.size[1]/2;this._moveState.yawLeft=-(i.pageX-e.offset[0]-t)/t,this._moveState.pitchDown=(i.pageY-e.offset[1]-n)/n,this._updateRotationVector()}}function WDe(i){if(this.enabled!==!1){if(this.dragToLook)this._status--,this._moveState.yawLeft=this._moveState.pitchDown=0;else{switch(i.button){case 0:this._moveState.forward=0;break;case 2:this._moveState.back=0;break}this._updateMovementVector()}this._updateRotationVector()}}function jDe(){this.enabled!==!1&&(this.dragToLook?(this._status=0,this._moveState.yawLeft=this._moveState.pitchDown=0):(this._moveState.forward=0,this._moveState.back=0,this._updateMovementVector()),this._updateRotationVector())}function XDe(i){this.enabled!==!1&&i.preventDefault()}var fae={name:"CopyShader",uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:`5235+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL MAGENTA OR PERSONS OR BODIES IN CHARGE OF ADMINISTRATION AND MAINTENANCE OF THE FONT SOFTWARE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.`,manufacturer_name:"\u039Cagenta ltd",font_sub_family_name:"Regular"},jLe=-334,XLe="Helvetiker",$Le=1522,YLe=50,ZLe={glyphs:ULe,cssFontWeight:kLe,ascender:zLe,underlinePosition:VLe,cssFontStyle:GLe,boundingBox:qLe,resolution:HLe,original_font_information:WLe,descender:jLe,familyName:XLe,lineHeight:$Le,underlineThickness:YLe},nh=$i($i({},window.THREE?window.THREE:{BoxGeometry:Nu,CircleGeometry:i_,DoubleSide:vr,Group:Br,Mesh:Hn,MeshLambertMaterial:Ga,TextGeometry:GS,Vector3:re}),{},{Font:Ix,TextGeometry:GS}),cae=Kr({props:{labelsData:{default:[]},labelLat:{default:"lat"},labelLng:{default:"lng"},labelAltitude:{default:.002},labelText:{default:"text"},labelSize:{default:.5},labelTypeFace:{default:ZLe,onChange:function(e,t){t.font=new nh.Font(e)}},labelColor:{default:function(){return"lightgrey"}},labelRotation:{default:0},labelResolution:{default:3},labelIncludeDot:{default:!0},labelDotRadius:{default:.1},labelDotOrientation:{default:function(){return"bottom"}},labelsTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;ns(e),t.scene=e,t.tweenGroup=r;var s=new nh.CircleGeometry(1,32);t.dataMapper=new Ll(e,{objBindAttr:"__threeObjLabel"}).onCreateObj(function(){var o=new nh.MeshLambertMaterial;o.side=vr;var a=new nh.Group;a.add(new nh.Mesh(s,o));var l=new nh.Mesh(void 0,o);a.add(l);var c=new nh.Mesh;return c.visible=!1,l.add(c),a.__globeObjType="label",a})},update:function(e){var t=st(e.labelLat),n=st(e.labelLng),r=st(e.labelAltitude),s=st(e.labelText),o=st(e.labelSize),a=st(e.labelRotation),l=st(e.labelColor),c=st(e.labelIncludeDot),u=st(e.labelDotRadius),f=st(e.labelDotOrientation),d=new Set(["right","top","bottom"]),A=2*Math.PI*_r/360;e.dataMapper.onUpdateObj(function(y,w){var S=Pr(y.children,2),T=S[0],R=S[1],P=Pr(R.children,1),I=P[0],F=l(w),D=ih(F);R.material.color.set(Of(F)),R.material.transparent=D<1,R.material.opacity=D;var L=c(w),C=f(w);!L||!d.has(C)&&(C="bottom");var B=L?+u(w)*A:1e-12;T.scale.x=T.scale.y=B;var k=+o(w)*A;if(R.geometry&&R.geometry.dispose(),R.geometry=new nh.TextGeometry(s(w),{font:e.font,size:k,depth:0,bevelEnabled:!0,bevelThickness:0,bevelSize:0,curveSegments:e.labelResolution}),I.geometry&&I.geometry.dispose(),R.geometry.computeBoundingBox(),I.geometry=qV(nh.BoxGeometry,tr(new nh.Vector3().subVectors(R.geometry.boundingBox.max,R.geometry.boundingBox.min).clampScalar(0,1/0).toArray())),C!=="right"&&R.geometry.center(),L){var z=B+k/2;C==="right"&&(R.position.x=z),R.position.y={right:-k/2,top:z+k/2,bottom:-z-k/2}[C]}var G=function($){var J=y.__currentTargetD=$,te=J.lat,ce=J.lng,he=J.alt,ve=J.rot,Re=J.scale;Object.assign(y.position,cu(te,ce,he)),y.lookAt(e.scene.localToWorld(new nh.Vector3(0,0,0))),y.rotateY(Math.PI),y.rotateZ(-ve*Math.PI/180),y.scale.x=y.scale.y=y.scale.z=Re},W={lat:+t(w),lng:+n(w),alt:+r(w),rot:+a(w),scale:1},Y=y.__currentTargetD||Object.assign({},W,{scale:1e-12});Object.keys(W).some(function(H){return Y[H]!==W[H]})&&(!e.labelsTransitionDuration||e.labelsTransitionDuration<0?G(W):e.tweenGroup.add(new uo(Y).to(W,e.labelsTransitionDuration).easing(Qr.Quadratic.InOut).onUpdate(G).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(e.labelsData)}}),KLe=$i($i({},window.THREE?window.THREE:{}),{},{CSS2DObject:ZM}),uae=Kr({props:{htmlElementsData:{default:[]},htmlLat:{default:"lat"},htmlLng:{default:"lng"},htmlAltitude:{default:0},htmlElement:{},htmlElementVisibilityModifier:{triggerUpdate:!1},htmlTransitionDuration:{default:1e3,triggerUpdate:!1},isBehindGlobe:{onChange:function(){this.updateObjVisibility()},triggerUpdate:!1}},methods:{updateObjVisibility:function(e,t){if(e.dataMapper){var n=t?[t]:e.dataMapper.entries().map(function(r){var s=Pr(r,2),o=s[1];return o}).filter(function(r){return r});n.forEach(function(r){var s=!e.isBehindGlobe||!e.isBehindGlobe(r.position);e.htmlElementVisibilityModifier?(r.visible=!0,e.htmlElementVisibilityModifier(r.element,s)):r.visible=s})}}},init:function(e,t,n){var r=n.tweenGroup;ns(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new Ll(e,{objBindAttr:"__threeObjHtml"}).onCreateObj(function(s){var o=st(t.htmlElement)(s),a=new KLe.CSS2DObject(o);return a.__globeObjType="html",a})},update:function(e,t){var n=this,r=st(e.htmlLat),s=st(e.htmlLng),o=st(e.htmlAltitude);t.hasOwnProperty("htmlElement")&&e.dataMapper.clear(),e.dataMapper.onUpdateObj(function(a,l){var c=function(d){var A=a.__currentTargetD=d,y=A.alt,w=A.lat,S=A.lng;Object.assign(a.position,cu(w,S,y)),n.updateObjVisibility(a)},u={lat:+r(l),lng:+s(l),alt:+o(l)};!e.htmlTransitionDuration||e.htmlTransitionDuration<0||!a.__currentTargetD?c(u):e.tweenGroup.add(new uo(a.__currentTargetD).to(u,e.htmlTransitionDuration).easing(Qr.Quadratic.InOut).onUpdate(c).onComplete(function(){e.tweenGroup.remove(this)}).start())}).digest(e.htmlElementsData)}}),QI=window.THREE?window.THREE:{Group:Br,Mesh:Hn,MeshLambertMaterial:Ga,SphereGeometry:Va},hae=Kr({props:{objectsData:{default:[]},objectLat:{default:"lat"},objectLng:{default:"lng"},objectAltitude:{default:.01},objectFacesSurface:{default:!0},objectRotation:{},objectThreeObject:{default:new QI.Mesh(new QI.SphereGeometry(1,16,8),new QI.MeshLambertMaterial({color:"#ffffaa",transparent:!0,opacity:.7}))}},init:function(e,t){ns(e),t.scene=e,t.dataMapper=new Ll(e,{objBindAttr:"__threeObjObject"}).onCreateObj(function(n){var r=st(t.objectThreeObject)(n);t.objectThreeObject===r&&(r=r.clone());var s=new QI.Group;return s.add(r),s.__globeObjType="object",s})},update:function(e,t){var n=st(e.objectLat),r=st(e.objectLng),s=st(e.objectAltitude),o=st(e.objectFacesSurface),a=st(e.objectRotation);t.hasOwnProperty("objectThreeObject")&&e.dataMapper.clear(),e.dataMapper.onUpdateObj(function(l,c){var u=+n(c),f=+r(c),d=+s(c);Object.assign(l.position,cu(u,f,d)),o(c)?l.setRotationFromEuler(new Ua(A1(-u),A1(f),0,"YXZ")):l.rotation.set(0,0,0);var A=l.children[0],y=a(c);y&&A.setRotationFromEuler(new Ua(A1(y.x||0),A1(y.y||0),A1(y.z||0)))}).digest(e.objectsData)}}),fae=Kr({props:{customLayerData:{default:[]},customThreeObject:{},customThreeObjectUpdate:{triggerUpdate:!1}},init:function(e,t){ns(e),t.scene=e,t.dataMapper=new Ll(e,{objBindAttr:"__threeObjCustom"}).onCreateObj(function(n){var r=st(t.customThreeObject)(n,_r);return r&&(t.customThreeObject===r&&(r=r.clone()),r.__globeObjType="custom"),r})},update:function(e,t){e.customThreeObjectUpdate||ns(e.scene);var n=st(e.customThreeObjectUpdate);t.hasOwnProperty("customThreeObject")&&e.dataMapper.clear(),e.dataMapper.onUpdateObj(function(r,s){return n(r,s,_r)}).digest(e.customLayerData)}}),JI=window.THREE?window.THREE:{Camera:Ld,Group:Br,Vector2:Oe,Vector3:re},QLe=["globeLayer","pointsLayer","arcsLayer","hexBinLayer","heatmapsLayer","polygonsLayer","hexedPolygonsLayer","pathsLayer","tilesLayer","particlesLayer","ringsLayer","labelsLayer","htmlElementsLayer","objectsLayer","customLayer"],dae=nl("globeLayer",Zoe),JLe=Object.assign.apply(Object,tr(["globeImageUrl","bumpImageUrl","globeCurvatureResolution","globeTileEngineUrl","globeTileEngineMaxLevel","showGlobe","showGraticules","showAtmosphere","atmosphereColor","atmosphereAltitude"].map(function(i){return Eo({},i,dae.linkProp(i))}))),eDe=Object.assign.apply(Object,tr(["globeMaterial","globeTileEngineClearCache"].map(function(i){return Eo({},i,dae.linkMethod(i))}))),tDe=nl("pointsLayer",Koe),nDe=Object.assign.apply(Object,tr(["pointsData","pointLat","pointLng","pointColor","pointAltitude","pointRadius","pointResolution","pointsMerge","pointsTransitionDuration"].map(function(i){return Eo({},i,tDe.linkProp(i))}))),iDe=nl("arcsLayer",Joe),rDe=Object.assign.apply(Object,tr(["arcsData","arcStartLat","arcStartLng","arcStartAltitude","arcEndLat","arcEndLng","arcEndAltitude","arcColor","arcAltitude","arcAltitudeAutoScale","arcStroke","arcCurveResolution","arcCircularResolution","arcDashLength","arcDashGap","arcDashInitialGap","arcDashAnimateTime","arcsTransitionDuration"].map(function(i){return Eo({},i,iDe.linkProp(i))}))),sDe=nl("hexBinLayer",eae),oDe=Object.assign.apply(Object,tr(["hexBinPointsData","hexBinPointLat","hexBinPointLng","hexBinPointWeight","hexBinResolution","hexMargin","hexTopCurvatureResolution","hexTopColor","hexSideColor","hexAltitude","hexBinMerge","hexTransitionDuration"].map(function(i){return Eo({},i,sDe.linkProp(i))}))),aDe=nl("heatmapsLayer",nae),lDe=Object.assign.apply(Object,tr(["heatmapsData","heatmapPoints","heatmapPointLat","heatmapPointLng","heatmapPointWeight","heatmapBandwidth","heatmapColorFn","heatmapColorSaturation","heatmapBaseAltitude","heatmapTopAltitude","heatmapsTransitionDuration"].map(function(i){return Eo({},i,aDe.linkProp(i))}))),cDe=nl("hexedPolygonsLayer",rae),uDe=Object.assign.apply(Object,tr(["hexPolygonsData","hexPolygonGeoJsonGeometry","hexPolygonColor","hexPolygonAltitude","hexPolygonResolution","hexPolygonMargin","hexPolygonUseDots","hexPolygonCurvatureResolution","hexPolygonDotResolution","hexPolygonsTransitionDuration"].map(function(i){return Eo({},i,cDe.linkProp(i))}))),hDe=nl("polygonsLayer",iae),fDe=Object.assign.apply(Object,tr(["polygonsData","polygonGeoJsonGeometry","polygonCapColor","polygonCapMaterial","polygonSideColor","polygonSideMaterial","polygonStrokeColor","polygonAltitude","polygonCapCurvatureResolution","polygonsTransitionDuration"].map(function(i){return Eo({},i,hDe.linkProp(i))}))),dDe=nl("pathsLayer",sae),pDe=Object.assign.apply(Object,tr(["pathsData","pathPoints","pathPointLat","pathPointLng","pathPointAlt","pathResolution","pathColor","pathStroke","pathDashLength","pathDashGap","pathDashInitialGap","pathDashAnimateTime","pathTransitionDuration"].map(function(i){return Eo({},i,dDe.linkProp(i))}))),mDe=nl("tilesLayer",oae),ADe=Object.assign.apply(Object,tr(["tilesData","tileLat","tileLng","tileAltitude","tileWidth","tileHeight","tileUseGlobeProjection","tileMaterial","tileCurvatureResolution","tilesTransitionDuration"].map(function(i){return Eo({},i,mDe.linkProp(i))}))),gDe=nl("particlesLayer",aae),vDe=Object.assign.apply(Object,tr(["particlesData","particlesList","particleLat","particleLng","particleAltitude","particlesSize","particlesSizeAttenuation","particlesColor","particlesTexture"].map(function(i){return Eo({},i,gDe.linkProp(i))}))),_De=nl("ringsLayer",lae),xDe=Object.assign.apply(Object,tr(["ringsData","ringLat","ringLng","ringAltitude","ringColor","ringResolution","ringMaxRadius","ringPropagationSpeed","ringRepeatPeriod"].map(function(i){return Eo({},i,_De.linkProp(i))}))),yDe=nl("labelsLayer",cae),bDe=Object.assign.apply(Object,tr(["labelsData","labelLat","labelLng","labelAltitude","labelRotation","labelText","labelSize","labelTypeFace","labelColor","labelResolution","labelIncludeDot","labelDotRadius","labelDotOrientation","labelsTransitionDuration"].map(function(i){return Eo({},i,yDe.linkProp(i))}))),wDe=nl("htmlElementsLayer",uae),SDe=Object.assign.apply(Object,tr(["htmlElementsData","htmlLat","htmlLng","htmlAltitude","htmlElement","htmlElementVisibilityModifier","htmlTransitionDuration"].map(function(i){return Eo({},i,wDe.linkProp(i))}))),TDe=nl("objectsLayer",hae),EDe=Object.assign.apply(Object,tr(["objectsData","objectLat","objectLng","objectAltitude","objectRotation","objectFacesSurface","objectThreeObject"].map(function(i){return Eo({},i,TDe.linkProp(i))}))),MDe=nl("customLayer",fae),CDe=Object.assign.apply(Object,tr(["customLayerData","customThreeObject","customThreeObjectUpdate"].map(function(i){return Eo({},i,MDe.linkProp(i))}))),RDe=Kr({props:$i($i($i($i($i($i($i($i($i($i($i($i($i($i($i({onGlobeReady:{triggerUpdate:!1},rendererSize:{default:new JI.Vector2(window.innerWidth,window.innerHeight),onChange:function(e,t){t.pathsLayer.rendererSize(e)},triggerUpdate:!1}},JLe),nDe),rDe),oDe),lDe),fDe),uDe),pDe),ADe),vDe),xDe),bDe),SDe),EDe),CDe),methods:$i({getGlobeRadius:Boe,getCoords:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return cu.apply(void 0,n)},toGeoCoords:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return Yoe.apply(void 0,n)},setPointOfView:function(e,t){var n=t instanceof JI.Camera?t.position:t,r=Boe(),s=void 0;if(e.scene&&n){var o,a,l,c;s=function(f){o===void 0&&(o=n.clone().applyMatrix4(e.scene.matrixWorld.clone().invert())),a===void 0&&(a=o.length()),l===void 0&&(l=Math.sqrt(Math.pow(a,2)-Math.pow(r,2))),c===void 0&&(c=Math.acos(l/a));var d=o.distanceTo(f);if(d<l)return!1;var A=f.length(),y=Math.acos((Math.pow(a,2)+Math.pow(d,2)-Math.pow(A,2))/(2*a*d));return y<c}}e.layersThatNeedUpdatePov.forEach(function(u){return u.updatePov(t)}),e.layersThatNeedBehindGlobeChecker.forEach(function(u){return u.isBehindGlobe(s)})},pauseAnimation:function(e){return e.animationFrameRequestId!==null&&(cancelAnimationFrame(e.animationFrameRequestId),e.animationFrameRequestId=null),e.pausableLayers.forEach(function(t){var n;return(n=t.pauseAnimation)===null||n===void 0?void 0:n.call(t)}),this},resumeAnimation:function(e){return e.animationFrameRequestId===null&&this._animationCycle(),e.pausableLayers.forEach(function(t){var n;return(n=t.resumeAnimation)===null||n===void 0?void 0:n.call(t)}),this},_animationCycle:function(e){e.animationFrameRequestId=requestAnimationFrame(this._animationCycle),e.tweenGroup.update()},_destructor:function(e){this.pauseAnimation(),e.destructableLayers.forEach(function(t){return t._destructor()})}},eDe),stateInit:function(){var e=new vg,t={tweenGroup:e},n={globeLayer:Zoe(t),pointsLayer:Koe(t),arcsLayer:Joe(t),hexBinLayer:eae(t),heatmapsLayer:nae(t),polygonsLayer:iae(t),hexedPolygonsLayer:rae(t),pathsLayer:sae(t),tilesLayer:oae(t),particlesLayer:aae(t),ringsLayer:lae(t),labelsLayer:cae(t),htmlElementsLayer:uae(t),objectsLayer:hae(t),customLayer:fae(t)};return $i($i({tweenGroup:e},n),{},{layersThatNeedUpdatePov:Object.values(n).filter(function(r){return r.hasOwnProperty("updatePov")}),layersThatNeedBehindGlobeChecker:Object.values(n).filter(function(r){return r.hasOwnProperty("isBehindGlobe")}),destructableLayers:Object.values(n).filter(function(r){return r.hasOwnProperty("_destructor")}),pausableLayers:Object.values(n).filter(function(r){return r.hasOwnProperty("pauseAnimation")})})},init:function(e,t,n){var r=n.animateIn,s=r===void 0?!0:r,o=n.waitForGlobeReady,a=o===void 0?!0:o;ns(e),t.scene=e,t.scene.visible=!1,QLe.forEach(function(c){var u=new JI.Group;t.scene.add(u),t[c](u)});var l=function(){if(s){t.scene.scale.set(1e-6,1e-6,1e-6),t.tweenGroup.add(new uo({k:1e-6}).to({k:1},600).easing(Qr.Quadratic.Out).onUpdate(function(f){var d=f.k;return t.scene.scale.set(d,d,d)}).onComplete(function(){t.tweenGroup.remove(this)}).start());var u=new JI.Vector3(0,1,0);t.tweenGroup.add(new uo({rot:Math.PI*2}).to({rot:0},1200).easing(Qr.Quintic.Out).onUpdate(function(f){var d=f.rot;return t.scene.setRotationFromAxisAngle(u,d)}).onComplete(function(){t.tweenGroup.remove(this)}).start())}t.scene.visible=!0,t.onGlobeReady&&t.onGlobeReady()};a?t.globeLayer.onReady(l):l(),this._animationCycle()},update:function(e){}});function IDe(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Object,t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=(function(r){function s(){var o;tP(this,s);for(var a=arguments.length,l=new Array(a),c=0;c<a;c++)l[c]=arguments[c];return o=eP(this,s,[].concat(l)),o.__kapsuleInstance=qV(i,[].concat(tr(t?[o]:[]),l)),o}return iP(s,r),nP(s)})(e);return Object.keys(i()).forEach(function(r){return n.prototype[r]=function(){var s,o=(s=this.__kapsuleInstance)[r].apply(s,arguments);return o===this.__kapsuleInstance?this:o}}),n}var PDe=window.THREE?window.THREE:{Group:Br},jV=IDe(RDe,PDe.Group,!0);var XV={type:"change"},ZV={type:"start"},KV={type:"end"},pae=1e-6,ki={NONE:-1,ROTATE:0,ZOOM:1,PAN:2,TOUCH_ROTATE:3,TOUCH_ZOOM_PAN:4},rP=new Oe,Pm=new Oe,LDe=new re,sP=new re,$V=new re,Fx=new qs,mae=new re,oP=new re,YV=new re,aP=new re,lP=class extends Dd{constructor(e,t=null){super(e,t),this.screen={left:0,top:0,width:0,height:0},this.rotateSpeed=1,this.zoomSpeed=1.2,this.panSpeed=.3,this.noRotate=!1,this.noZoom=!1,this.noPan=!1,this.staticMoving=!1,this.dynamicDampingFactor=.2,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.keys=["KeyA","KeyS","KeyD"],this.mouseButtons={LEFT:qa.ROTATE,MIDDLE:qa.DOLLY,RIGHT:qa.PAN},this.target=new re,this.state=ki.NONE,this.keyState=ki.NONE,this._lastPosition=new re,this._lastZoom=1,this._touchZoomDistanceStart=0,this._touchZoomDistanceEnd=0,this._lastAngle=0,this._eye=new re,this._movePrev=new Oe,this._moveCurr=new Oe,this._lastAxis=new re,this._zoomStart=new Oe,this._zoomEnd=new Oe,this._panStart=new Oe,this._panEnd=new Oe,this._pointers=[],this._pointerPositions={},this._onPointerMove=NDe.bind(this),this._onPointerDown=DDe.bind(this),this._onPointerUp=FDe.bind(this),this._onPointerCancel=BDe.bind(this),this._onContextMenu=qDe.bind(this),this._onMouseWheel=GDe.bind(this),this._onKeyDown=UDe.bind(this),this._onKeyUp=ODe.bind(this),this._onTouchStart=HDe.bind(this),this._onTouchMove=WDe.bind(this),this._onTouchEnd=jDe.bind(this),this._onMouseDown=kDe.bind(this),this._onMouseMove=zDe.bind(this),this._onMouseUp=VDe.bind(this),this._target0=this.target.clone(),this._position0=this.object.position.clone(),this._up0=this.object.up.clone(),this._zoom0=this.object.zoom,t!==null&&(this.connect(t),this.handleResize()),this.update()}connect(e){super.connect(e),window.addEventListener("keydown",this._onKeyDown),window.addEventListener("keyup",this._onKeyUp),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerCancel),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.style.touchAction="none"}disconnect(){window.removeEventListener("keydown",this._onKeyDown),window.removeEventListener("keyup",this._onKeyUp),this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerCancel),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.domElement.style.touchAction=""}dispose(){this.disconnect()}handleResize(){let e=this.domElement.getBoundingClientRect(),t=this.domElement.ownerDocument.documentElement;this.screen.left=e.left+window.pageXOffset-t.clientLeft,this.screen.top=e.top+window.pageYOffset-t.clientTop,this.screen.width=e.width,this.screen.height=e.height}update(){this._eye.subVectors(this.object.position,this.target),this.noRotate||this._rotateCamera(),this.noZoom||this._zoomCamera(),this.noPan||this._panCamera(),this.object.position.addVectors(this.target,this._eye),this.object.isPerspectiveCamera?(this._checkDistances(),this.object.lookAt(this.target),this._lastPosition.distanceToSquared(this.object.position)>pae&&(this.dispatchEvent(XV),this._lastPosition.copy(this.object.position))):this.object.isOrthographicCamera?(this.object.lookAt(this.target),(this._lastPosition.distanceToSquared(this.object.position)>pae||this._lastZoom!==this.object.zoom)&&(this.dispatchEvent(XV),this._lastPosition.copy(this.object.position),this._lastZoom=this.object.zoom)):console.warn("THREE.TrackballControls: Unsupported camera type.")}reset(){this.state=ki.NONE,this.keyState=ki.NONE,this.target.copy(this._target0),this.object.position.copy(this._position0),this.object.up.copy(this._up0),this.object.zoom=this._zoom0,this.object.updateProjectionMatrix(),this._eye.subVectors(this.object.position,this.target),this.object.lookAt(this.target),this.dispatchEvent(XV),this._lastPosition.copy(this.object.position),this._lastZoom=this.object.zoom}_panCamera(){if(Pm.copy(this._panEnd).sub(this._panStart),Pm.lengthSq()){if(this.object.isOrthographicCamera){let e=(this.object.right-this.object.left)/this.object.zoom/this.domElement.clientWidth,t=(this.object.top-this.object.bottom)/this.object.zoom/this.domElement.clientWidth;Pm.x*=e,Pm.y*=t}Pm.multiplyScalar(this._eye.length()*this.panSpeed),sP.copy(this._eye).cross(this.object.up).setLength(Pm.x),sP.add(LDe.copy(this.object.up).setLength(Pm.y)),this.object.position.add(sP),this.target.add(sP),this.staticMoving?this._panStart.copy(this._panEnd):this._panStart.add(Pm.subVectors(this._panEnd,this._panStart).multiplyScalar(this.dynamicDampingFactor))}}_rotateCamera(){aP.set(this._moveCurr.x-this._movePrev.x,this._moveCurr.y-this._movePrev.y,0);let e=aP.length();e?(this._eye.copy(this.object.position).sub(this.target),mae.copy(this._eye).normalize(),oP.copy(this.object.up).normalize(),YV.crossVectors(oP,mae).normalize(),oP.setLength(this._moveCurr.y-this._movePrev.y),YV.setLength(this._moveCurr.x-this._movePrev.x),aP.copy(oP.add(YV)),$V.crossVectors(aP,this._eye).normalize(),e*=this.rotateSpeed,Fx.setFromAxisAngle($V,e),this._eye.applyQuaternion(Fx),this.object.up.applyQuaternion(Fx),this._lastAxis.copy($V),this._lastAngle=e):!this.staticMoving&&this._lastAngle&&(this._lastAngle*=Math.sqrt(1-this.dynamicDampingFactor),this._eye.copy(this.object.position).sub(this.target),Fx.setFromAxisAngle(this._lastAxis,this._lastAngle),this._eye.applyQuaternion(Fx),this.object.up.applyQuaternion(Fx)),this._movePrev.copy(this._moveCurr)}_zoomCamera(){let e;this.state===ki.TOUCH_ZOOM_PAN?(e=this._touchZoomDistanceStart/this._touchZoomDistanceEnd,this._touchZoomDistanceStart=this._touchZoomDistanceEnd,this.object.isPerspectiveCamera?this._eye.multiplyScalar(e):this.object.isOrthographicCamera?(this.object.zoom=Uu.clamp(this.object.zoom/e,this.minZoom,this.maxZoom),this._lastZoom!==this.object.zoom&&this.object.updateProjectionMatrix()):console.warn("THREE.TrackballControls: Unsupported camera type")):(e=1+(this._zoomEnd.y-this._zoomStart.y)*this.zoomSpeed,e!==1&&e>0&&(this.object.isPerspectiveCamera?this._eye.multiplyScalar(e):this.object.isOrthographicCamera?(this.object.zoom=Uu.clamp(this.object.zoom/e,this.minZoom,this.maxZoom),this._lastZoom!==this.object.zoom&&this.object.updateProjectionMatrix()):console.warn("THREE.TrackballControls: Unsupported camera type")),this.staticMoving?this._zoomStart.copy(this._zoomEnd):this._zoomStart.y+=(this._zoomEnd.y-this._zoomStart.y)*this.dynamicDampingFactor)}_getMouseOnScreen(e,t){return rP.set((e-this.screen.left)/this.screen.width,(t-this.screen.top)/this.screen.height),rP}_getMouseOnCircle(e,t){return rP.set((e-this.screen.width*.5-this.screen.left)/(this.screen.width*.5),(this.screen.height+2*(this.screen.top-t))/this.screen.width),rP}_addPointer(e){this._pointers.push(e)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t<this._pointers.length;t++)if(this._pointers[t].pointerId==e.pointerId){this._pointers.splice(t,1);return}}_trackPointer(e){let t=this._pointerPositions[e.pointerId];t===void 0&&(t=new Oe,this._pointerPositions[e.pointerId]=t),t.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){let t=e.pointerId===this._pointers[0].pointerId?this._pointers[1]:this._pointers[0];return this._pointerPositions[t.pointerId]}_checkDistances(){(!this.noZoom||!this.noPan)&&(this._eye.lengthSq()>this.maxDistance*this.maxDistance&&(this.object.position.addVectors(this.target,this._eye.setLength(this.maxDistance)),this._zoomStart.copy(this._zoomEnd)),this._eye.lengthSq()<this.minDistance*this.minDistance&&(this.object.position.addVectors(this.target,this._eye.setLength(this.minDistance)),this._zoomStart.copy(this._zoomEnd)))}};function DDe(i){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(i.pointerId),this.domElement.ownerDocument.addEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this._onPointerUp)),this._addPointer(i),i.pointerType==="touch"?this._onTouchStart(i):this._onMouseDown(i))}function NDe(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchMove(i):this._onMouseMove(i))}function FDe(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchEnd(i):this._onMouseUp(),this._removePointer(i),this._pointers.length===0&&(this.domElement.releasePointerCapture(i.pointerId),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp)))}function BDe(i){this._removePointer(i)}function ODe(){this.enabled!==!1&&(this.keyState=ki.NONE,window.addEventListener("keydown",this._onKeyDown))}function UDe(i){this.enabled!==!1&&(window.removeEventListener("keydown",this._onKeyDown),this.keyState===ki.NONE&&(i.code===this.keys[ki.ROTATE]&&!this.noRotate?this.keyState=ki.ROTATE:i.code===this.keys[ki.ZOOM]&&!this.noZoom?this.keyState=ki.ZOOM:i.code===this.keys[ki.PAN]&&!this.noPan&&(this.keyState=ki.PAN)))}function kDe(i){let e;switch(i.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case qa.DOLLY:this.state=ki.ZOOM;break;case qa.ROTATE:this.state=ki.ROTATE;break;case qa.PAN:this.state=ki.PAN;break;default:this.state=ki.NONE}let t=this.keyState!==ki.NONE?this.keyState:this.state;t===ki.ROTATE&&!this.noRotate?(this._moveCurr.copy(this._getMouseOnCircle(i.pageX,i.pageY)),this._movePrev.copy(this._moveCurr)):t===ki.ZOOM&&!this.noZoom?(this._zoomStart.copy(this._getMouseOnScreen(i.pageX,i.pageY)),this._zoomEnd.copy(this._zoomStart)):t===ki.PAN&&!this.noPan&&(this._panStart.copy(this._getMouseOnScreen(i.pageX,i.pageY)),this._panEnd.copy(this._panStart)),this.dispatchEvent(ZV)}function zDe(i){let e=this.keyState!==ki.NONE?this.keyState:this.state;e===ki.ROTATE&&!this.noRotate?(this._movePrev.copy(this._moveCurr),this._moveCurr.copy(this._getMouseOnCircle(i.pageX,i.pageY))):e===ki.ZOOM&&!this.noZoom?this._zoomEnd.copy(this._getMouseOnScreen(i.pageX,i.pageY)):e===ki.PAN&&!this.noPan&&this._panEnd.copy(this._getMouseOnScreen(i.pageX,i.pageY))}function VDe(){this.state=ki.NONE,this.dispatchEvent(KV)}function GDe(i){if(this.enabled!==!1&&this.noZoom!==!0){switch(i.preventDefault(),i.deltaMode){case 2:this._zoomStart.y-=i.deltaY*.025;break;case 1:this._zoomStart.y-=i.deltaY*.01;break;default:this._zoomStart.y-=i.deltaY*25e-5;break}this.dispatchEvent(ZV),this.dispatchEvent(KV)}}function qDe(i){this.enabled!==!1&&i.preventDefault()}function HDe(i){if(this._trackPointer(i),this._pointers.length===1)this.state=ki.TOUCH_ROTATE,this._moveCurr.copy(this._getMouseOnCircle(this._pointers[0].pageX,this._pointers[0].pageY)),this._movePrev.copy(this._moveCurr);else{this.state=ki.TOUCH_ZOOM_PAN;let e=this._pointers[0].pageX-this._pointers[1].pageX,t=this._pointers[0].pageY-this._pointers[1].pageY;this._touchZoomDistanceEnd=this._touchZoomDistanceStart=Math.sqrt(e*e+t*t);let n=(this._pointers[0].pageX+this._pointers[1].pageX)/2,r=(this._pointers[0].pageY+this._pointers[1].pageY)/2;this._panStart.copy(this._getMouseOnScreen(n,r)),this._panEnd.copy(this._panStart)}this.dispatchEvent(ZV)}function WDe(i){if(this._trackPointer(i),this._pointers.length===1)this._movePrev.copy(this._moveCurr),this._moveCurr.copy(this._getMouseOnCircle(i.pageX,i.pageY));else{let e=this._getSecondPointerPosition(i),t=i.pageX-e.x,n=i.pageY-e.y;this._touchZoomDistanceEnd=Math.sqrt(t*t+n*n);let r=(i.pageX+e.x)/2,s=(i.pageY+e.y)/2;this._panEnd.copy(this._getMouseOnScreen(r,s))}}function jDe(i){switch(this._pointers.length){case 0:this.state=ki.NONE;break;case 1:this.state=ki.TOUCH_ROTATE,this._moveCurr.copy(this._getMouseOnCircle(i.pageX,i.pageY)),this._movePrev.copy(this._moveCurr);break;case 2:this.state=ki.TOUCH_ZOOM_PAN;for(let e=0;e<this._pointers.length;e++)if(this._pointers[e].pointerId!==i.pointerId){let t=this._pointerPositions[this._pointers[e].pointerId];this._moveCurr.copy(this._getMouseOnCircle(t.x,t.y)),this._movePrev.copy(this._moveCurr);break}break}this.dispatchEvent(KV)}var Aae={type:"change"},JV={type:"start"},vae={type:"end"},cP=new Pd,gae=new Na,XDe=Math.cos(70*Uu.DEG2RAD),ho=new re,Dl=2*Math.PI,dr={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},QV=1e-6,uP=class extends Dd{constructor(e,t=null){super(e,t),this.state=dr.NONE,this.target=new re,this.cursor=new re,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.keyRotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:qa.ROTATE,MIDDLE:qa.DOLLY,RIGHT:qa.PAN},this.touches={ONE:d0.ROTATE,TWO:d0.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._cursorStyle="auto",this._domElementKeyEvents=null,this._lastPosition=new re,this._lastQuaternion=new qs,this._lastTargetPosition=new re,this._quat=new qs().setFromUnitVectors(e.up,new re(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new u_,this._sphericalDelta=new u_,this._scale=1,this._panOffset=new re,this._rotateStart=new Oe,this._rotateEnd=new Oe,this._rotateDelta=new Oe,this._panStart=new Oe,this._panEnd=new Oe,this._panDelta=new Oe,this._dollyStart=new Oe,this._dollyEnd=new Oe,this._dollyDelta=new Oe,this._dollyDirection=new re,this._mouse=new Oe,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=YDe.bind(this),this._onPointerDown=$De.bind(this),this._onPointerUp=ZDe.bind(this),this._onContextMenu=iNe.bind(this),this._onMouseWheel=JDe.bind(this),this._onKeyDown=eNe.bind(this),this._onTouchStart=tNe.bind(this),this._onTouchMove=nNe.bind(this),this._onMouseDown=KDe.bind(this),this._onMouseMove=QDe.bind(this),this._interceptControlDown=rNe.bind(this),this._interceptControlUp=sNe.bind(this),this.domElement!==null&&this.connect(this.domElement),this.update()}set cursorStyle(e){this._cursorStyle=e,e==="grab"?this.domElement.style.cursor="grab":this.domElement.style.cursor="auto"}get cursorStyle(){return this._cursorStyle}connect(e){super.connect(e),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction=""}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(e){e.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=e}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(Aae),this.update(),this.state=dr.NONE}pan(e,t){this._pan(e,t),this.update()}dollyIn(e){this._dollyIn(e),this.update()}dollyOut(e){this._dollyOut(e),this.update()}rotateLeft(e){this._rotateLeft(e),this.update()}rotateUp(e){this._rotateUp(e),this.update()}update(e=null){let t=this.object.position;ho.copy(t).sub(this.target),ho.applyQuaternion(this._quat),this._spherical.setFromVector3(ho),this.autoRotate&&this.state===dr.NONE&&this._rotateLeft(this._getAutoRotationAngle(e)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let n=this.minAzimuthAngle,r=this.maxAzimuthAngle;isFinite(n)&&isFinite(r)&&(n<-Math.PI?n+=Dl:n>Math.PI&&(n-=Dl),r<-Math.PI?r+=Dl:r>Math.PI&&(r-=Dl),n<=r?this._spherical.theta=Math.max(n,Math.min(r,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(n+r)/2?Math.max(n,this._spherical.theta):Math.min(r,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let s=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{let o=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),s=o!=this._spherical.radius}if(ho.setFromSpherical(this._spherical),ho.applyQuaternion(this._quatInverse),t.copy(this.target).add(ho),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let o=null;if(this.object.isPerspectiveCamera){let a=ho.length();o=this._clampDistance(a*this._scale);let l=a-o;this.object.position.addScaledVector(this._dollyDirection,l),this.object.updateMatrixWorld(),s=!!l}else if(this.object.isOrthographicCamera){let a=new re(this._mouse.x,this._mouse.y,0);a.unproject(this.object);let l=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),s=l!==this.object.zoom;let c=new re(this._mouse.x,this._mouse.y,0);c.unproject(this.object),this.object.position.sub(c).add(a),this.object.updateMatrixWorld(),o=ho.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;o!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position):(cP.origin.copy(this.object.position),cP.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(cP.direction))<XDe?this.object.lookAt(this.target):(gae.setFromNormalAndCoplanarPoint(this.object.up,this.target),cP.intersectPlane(gae,this.target))))}else if(this.object.isOrthographicCamera){let o=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),o!==this.object.zoom&&(this.object.updateProjectionMatrix(),s=!0)}return this._scale=1,this._performCursorZoom=!1,s||this._lastPosition.distanceToSquared(this.object.position)>QV||8*(1-this._lastQuaternion.dot(this.object.quaternion))>QV||this._lastTargetPosition.distanceToSquared(this.target)>QV?(this.dispatchEvent(Aae),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?Dl/60*this.autoRotateSpeed*e:Dl/60/60*this.autoRotateSpeed}_getZoomScale(e){let t=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){ho.setFromMatrixColumn(t,0),ho.multiplyScalar(-e),this._panOffset.add(ho)}_panUp(e,t){this.screenSpacePanning===!0?ho.setFromMatrixColumn(t,1):(ho.setFromMatrixColumn(t,0),ho.crossVectors(this.object.up,ho)),ho.multiplyScalar(e),this._panOffset.add(ho)}_pan(e,t){let n=this.domElement;if(this.object.isPerspectiveCamera){let r=this.object.position;ho.copy(r).sub(this.target);let s=ho.length();s*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*s/n.clientHeight,this.object.matrix),this._panUp(2*t*s/n.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;let n=this.domElement.getBoundingClientRect(),r=e-n.left,s=t-n.top,o=n.width,a=n.height;this._mouse.x=r/o*2-1,this._mouse.y=-(s/a)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;this._rotateLeft(Dl*this._rotateDelta.x/t.clientHeight),this._rotateUp(Dl*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(Dl*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-Dl*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(Dl*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-Dl*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._rotateStart.set(n,r)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panStart.set(n,r)}}_handleTouchStartDolly(e){let t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,s=Math.sqrt(n*n+r*r);this._dollyStart.set(0,s)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{let n=this._getSecondPointerPosition(e),r=.5*(e.pageX+n.x),s=.5*(e.pageY+n.y);this._rotateEnd.set(r,s)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;this._rotateLeft(Dl*this._rotateDelta.x/t.clientHeight),this._rotateUp(Dl*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panEnd.set(n,r)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){let t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,s=Math.sqrt(n*n+r*r);this._dollyEnd.set(0,s),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);let o=(e.pageX+t.x)*.5,a=(e.pageY+t.y)*.5;this._updateZoomParameters(o,a)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId){this._pointers.splice(t,1);return}}_isTrackingPointer(e){for(let t=0;t<this._pointers.length;t++)if(this._pointers[t]==e.pointerId)return!0;return!1}_trackPointer(e){let t=this._pointerPositions[e.pointerId];t===void 0&&(t=new Oe,this._pointerPositions[e.pointerId]=t),t.set(e.pageX,e.pageY)}_getSecondPointerPosition(e){let t=e.pointerId===this._pointers[0]?this._pointers[1]:this._pointers[0];return this._pointerPositions[t]}_customWheelEvent(e){let t=e.deltaMode,n={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(t){case 1:n.deltaY*=16;break;case 2:n.deltaY*=100;break}return e.ctrlKey&&!this._controlActive&&(n.deltaY*=10),n}};function $De(i){this.enabled!==!1&&(this._pointers.length===0&&(this.domElement.setPointerCapture(i.pointerId),this.domElement.ownerDocument.addEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this._onPointerUp)),!this._isTrackingPointer(i)&&(this._addPointer(i),i.pointerType==="touch"?this._onTouchStart(i):this._onMouseDown(i),this._cursorStyle==="grab"&&(this.domElement.style.cursor="grabbing")))}function YDe(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchMove(i):this._onMouseMove(i))}function ZDe(i){switch(this._removePointer(i),this._pointers.length){case 0:this.domElement.releasePointerCapture(i.pointerId),this.domElement.ownerDocument.removeEventListener("pointermove",this._onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this._onPointerUp),this.dispatchEvent(vae),this.state=dr.NONE,this._cursorStyle==="grab"&&(this.domElement.style.cursor="grab");break;case 1:let e=this._pointers[0],t=this._pointerPositions[e];this._onTouchStart({pointerId:e,pageX:t.x,pageY:t.y});break}}function KDe(i){let e;switch(i.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT;break;default:e=-1}switch(e){case qa.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(i),this.state=dr.DOLLY;break;case qa.ROTATE:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=dr.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=dr.ROTATE}break;case qa.PAN:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=dr.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=dr.PAN}break;default:this.state=dr.NONE}this.state!==dr.NONE&&this.dispatchEvent(JV)}function QDe(i){switch(this.state){case dr.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(i);break;case dr.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(i);break;case dr.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(i);break}}function JDe(i){this.enabled===!1||this.enableZoom===!1||this.state!==dr.NONE||(i.preventDefault(),this.dispatchEvent(JV),this._handleMouseWheel(this._customWheelEvent(i)),this.dispatchEvent(vae))}function eNe(i){this.enabled!==!1&&this._handleKeyDown(i)}function tNe(i){switch(this._trackPointer(i),this._pointers.length){case 1:switch(this.touches.ONE){case d0.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(i),this.state=dr.TOUCH_ROTATE;break;case d0.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(i),this.state=dr.TOUCH_PAN;break;default:this.state=dr.NONE}break;case 2:switch(this.touches.TWO){case d0.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(i),this.state=dr.TOUCH_DOLLY_PAN;break;case d0.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(i),this.state=dr.TOUCH_DOLLY_ROTATE;break;default:this.state=dr.NONE}break;default:this.state=dr.NONE}this.state!==dr.NONE&&this.dispatchEvent(JV)}function nNe(i){switch(this._trackPointer(i),this.state){case dr.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(i),this.update();break;case dr.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(i),this.update();break;case dr.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(i),this.update();break;case dr.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(i),this.update();break;default:this.state=dr.NONE}}function iNe(i){this.enabled!==!1&&i.preventDefault()}function rNe(i){i.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function sNe(i){i.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}var oNe={type:"change"},_ae=1e-6,xae=new qs,hP=class extends Dd{constructor(e,t=null){super(e,t),this.movementSpeed=1,this.rollSpeed=.005,this.dragToLook=!1,this.autoForward=!1,this._moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0},this._moveVector=new re(0,0,0),this._rotationVector=new re(0,0,0),this._lastQuaternion=new qs,this._lastPosition=new re,this._status=0,this._onKeyDown=aNe.bind(this),this._onKeyUp=lNe.bind(this),this._onPointerMove=uNe.bind(this),this._onPointerDown=cNe.bind(this),this._onPointerUp=hNe.bind(this),this._onPointerCancel=fNe.bind(this),this._onContextMenu=dNe.bind(this),t!==null&&this.connect(t)}connect(e){super.connect(e),window.addEventListener("keydown",this._onKeyDown),window.addEventListener("keyup",this._onKeyUp),this.domElement.addEventListener("pointermove",this._onPointerMove),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointerup",this._onPointerUp),this.domElement.addEventListener("pointercancel",this._onPointerCancel),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.style.touchAction="none"}disconnect(){window.removeEventListener("keydown",this._onKeyDown),window.removeEventListener("keyup",this._onKeyUp),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerCancel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.domElement.style.touchAction=""}dispose(){this.disconnect()}update(e){if(this.enabled===!1)return;let t=this.object,n=e*this.movementSpeed,r=e*this.rollSpeed;t.translateX(this._moveVector.x*n),t.translateY(this._moveVector.y*n),t.translateZ(this._moveVector.z*n),xae.set(this._rotationVector.x*r,this._rotationVector.y*r,this._rotationVector.z*r,1).normalize(),t.quaternion.multiply(xae),(this._lastPosition.distanceToSquared(t.position)>_ae||8*(1-this._lastQuaternion.dot(t.quaternion))>_ae)&&(this.dispatchEvent(oNe),this._lastQuaternion.copy(t.quaternion),this._lastPosition.copy(t.position))}_updateMovementVector(){let e=this._moveState.forward||this.autoForward&&!this._moveState.back?1:0;this._moveVector.x=-this._moveState.left+this._moveState.right,this._moveVector.y=-this._moveState.down+this._moveState.up,this._moveVector.z=-e+this._moveState.back}_updateRotationVector(){this._rotationVector.x=-this._moveState.pitchDown+this._moveState.pitchUp,this._rotationVector.y=-this._moveState.yawRight+this._moveState.yawLeft,this._rotationVector.z=-this._moveState.rollRight+this._moveState.rollLeft}_getContainerDimensions(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}}};function aNe(i){if(!(i.altKey||this.enabled===!1)){switch(i.code){case"ShiftLeft":case"ShiftRight":this.movementSpeedMultiplier=.1;break;case"KeyW":this._moveState.forward=1;break;case"KeyS":this._moveState.back=1;break;case"KeyA":this._moveState.left=1;break;case"KeyD":this._moveState.right=1;break;case"KeyR":this._moveState.up=1;break;case"KeyF":this._moveState.down=1;break;case"ArrowUp":this._moveState.pitchUp=1;break;case"ArrowDown":this._moveState.pitchDown=1;break;case"ArrowLeft":this._moveState.yawLeft=1;break;case"ArrowRight":this._moveState.yawRight=1;break;case"KeyQ":this._moveState.rollLeft=1;break;case"KeyE":this._moveState.rollRight=1;break}this._updateMovementVector(),this._updateRotationVector()}}function lNe(i){if(this.enabled!==!1){switch(i.code){case"ShiftLeft":case"ShiftRight":this.movementSpeedMultiplier=1;break;case"KeyW":this._moveState.forward=0;break;case"KeyS":this._moveState.back=0;break;case"KeyA":this._moveState.left=0;break;case"KeyD":this._moveState.right=0;break;case"KeyR":this._moveState.up=0;break;case"KeyF":this._moveState.down=0;break;case"ArrowUp":this._moveState.pitchUp=0;break;case"ArrowDown":this._moveState.pitchDown=0;break;case"ArrowLeft":this._moveState.yawLeft=0;break;case"ArrowRight":this._moveState.yawRight=0;break;case"KeyQ":this._moveState.rollLeft=0;break;case"KeyE":this._moveState.rollRight=0;break}this._updateMovementVector(),this._updateRotationVector()}}function cNe(i){if(this.enabled!==!1)if(this.dragToLook)this._status++;else{switch(i.button){case 0:this._moveState.forward=1;break;case 2:this._moveState.back=1;break}this._updateMovementVector()}}function uNe(i){if(this.enabled!==!1&&(!this.dragToLook||this._status>0)){let e=this._getContainerDimensions(),t=e.size[0]/2,n=e.size[1]/2;this._moveState.yawLeft=-(i.pageX-e.offset[0]-t)/t,this._moveState.pitchDown=(i.pageY-e.offset[1]-n)/n,this._updateRotationVector()}}function hNe(i){if(this.enabled!==!1){if(this.dragToLook)this._status--,this._moveState.yawLeft=this._moveState.pitchDown=0;else{switch(i.button){case 0:this._moveState.forward=0;break;case 2:this._moveState.back=0;break}this._updateMovementVector()}this._updateRotationVector()}}function fNe(){this.enabled!==!1&&(this.dragToLook?(this._status=0,this._moveState.yawLeft=this._moveState.pitchDown=0):(this._moveState.forward=0,this._moveState.back=0,this._updateMovementVector()),this._updateRotationVector())}function dNe(i){this.enabled!==!1&&i.preventDefault()}var yae={name:"CopyShader",uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:`52365236 52375237 varying vec2 vUv;52385238 @@ -5255,8 +5255,8 @@ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
52555255 gl_FragColor = opacity * texel;52565256 52575257 5258- }`};var sp=class{constructor(){this.isPass=!0,this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}setSize(){}render(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}dispose(){}},$De=new Du(-1,1,1,-1,0,1),jV=class extends Xn{constructor(){super(),this.setAttribute("position",new Ln([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new Ln([0,2,0,0,2,0],2))}},YDe=new jV,lP=class{constructor(e){this._mesh=new Hn(YDe,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,$De)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}};var cP=class extends sp{constructor(e,t="tDiffuse"){super(),this.textureID=t,this.uniforms=null,this.material=null,e instanceof ds?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=mg.clone(e.uniforms),this.material=new ds({name:e.name!==void 0?e.name:"unspecified",defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this._fsQuad=new lP(this.material)}render(e,t,n){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=n.texture),this._fsQuad.material=this.material,this.renderToScreen?(e.setRenderTarget(null),this._fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this._fsQuad.render(e))}dispose(){this.material.dispose(),this._fsQuad.dispose()}};var GS=class extends sp{constructor(e,t){super(),this.scene=e,this.camera=t,this.clear=!0,this.needsSwap=!1,this.inverse=!1}render(e,t,n){let r=e.getContext(),s=e.state;s.buffers.color.setMask(!1),s.buffers.depth.setMask(!1),s.buffers.color.setLocked(!0),s.buffers.depth.setLocked(!0);let o,a;this.inverse?(o=0,a=1):(o=1,a=0),s.buffers.stencil.setTest(!0),s.buffers.stencil.setOp(r.REPLACE,r.REPLACE,r.REPLACE),s.buffers.stencil.setFunc(r.ALWAYS,o,4294967295),s.buffers.stencil.setClear(a),s.buffers.stencil.setLocked(!0),e.setRenderTarget(n),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),s.buffers.color.setLocked(!1),s.buffers.depth.setLocked(!1),s.buffers.color.setMask(!0),s.buffers.depth.setMask(!0),s.buffers.stencil.setLocked(!1),s.buffers.stencil.setFunc(r.EQUAL,1,4294967295),s.buffers.stencil.setOp(r.KEEP,r.KEEP,r.KEEP),s.buffers.stencil.setLocked(!0)}},uP=class extends sp{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}};var hP=class{constructor(e,t){if(this.renderer=e,this._pixelRatio=e.getPixelRatio(),t===void 0){let n=e.getSize(new Oe);this._width=n.width,this._height=n.height,t=new Ba(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:Wi}),t.texture.name="EffectComposer.rt1"}else this._width=t.width,this._height=t.height;this.renderTarget1=t,this.renderTarget2=t.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new cP(fae),this.copyPass.material.blending=ps,this.timer=new ng}swapBuffers(){let e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}addPass(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(e){let t=this.passes.indexOf(e);t!==-1&&this.passes.splice(t,1)}isLastEnabledPass(e){for(let t=e+1;t<this.passes.length;t++)if(this.passes[t].enabled)return!1;return!0}render(e){this.timer.update(),e===void 0&&(e=this.timer.getDelta());let t=this.renderer.getRenderTarget(),n=!1;for(let r=0,s=this.passes.length;r<s;r++){let o=this.passes[r];if(o.enabled!==!1){if(o.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(r),o.render(this.renderer,this.writeBuffer,this.readBuffer,e,n),o.needsSwap){if(n){let a=this.renderer.getContext(),l=this.renderer.state.buffers.stencil;l.setFunc(a.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),l.setFunc(a.EQUAL,1,4294967295)}this.swapBuffers()}GS!==void 0&&(o instanceof GS?n=!0:o instanceof uP&&(n=!1))}}this.renderer.setRenderTarget(t)}reset(e){if(e===void 0){let t=this.renderer.getSize(new Oe);this._pixelRatio=this.renderer.getPixelRatio(),this._width=t.width,this._height=t.height,e=this.renderTarget1.clone(),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=e,this.renderTarget2=e.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}setSize(e,t){this._width=e,this._height=t;let n=this._width*this._pixelRatio,r=this._height*this._pixelRatio;this.renderTarget1.setSize(n,r),this.renderTarget2.setSize(n,r);for(let s=0;s<this.passes.length;s++)this.passes[s].setSize(n,r)}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}dispose(){this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.copyPass.dispose()}};var fP=class extends sp{constructor(e,t,n=null,r=null,s=null){super(),this.scene=e,this.camera=t,this.overrideMaterial=n,this.clearColor=r,this.clearAlpha=s,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this.isRenderPass=!0,this._oldClearColor=new zt}render(e,t,n){let r=e.autoClear;e.autoClear=!1;let s,o;this.overrideMaterial!==null&&(o=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor!==null&&(e.getClearColor(this._oldClearColor),e.setClearColor(this.clearColor,e.getClearAlpha())),this.clearAlpha!==null&&(s=e.getClearAlpha(),e.setClearAlpha(this.clearAlpha)),this.clearDepth==!0&&e.clearDepth(),e.setRenderTarget(this.renderToScreen?null:n),this.clear===!0&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),e.render(this.scene,this.camera),this.clearColor!==null&&e.setClearColor(this._oldClearColor),this.clearAlpha!==null&&e.setClearAlpha(s),this.overrideMaterial!==null&&(this.scene.overrideMaterial=o),e.autoClear=r}};function nl(){return nl=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)({}).hasOwnProperty.call(t,n)&&(i[n]=t[n])}return i},nl.apply(null,arguments)}function dae(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function Lm(i,e){return Lm=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},Lm(i,e)}function pae(i,e){i.prototype=Object.create(e.prototype),i.prototype.constructor=i,Lm(i,e)}function dP(i){return dP=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},dP(i)}function mae(i){try{return Function.toString.call(i).indexOf("[native code]")!==-1}catch{return typeof i=="function"}}function XV(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(XV=function(){return!!i})()}function Aae(i,e,t){if(XV())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var r=new(i.bind.apply(i,n));return t&&Lm(r,t.prototype),r}function pP(i){var e=typeof Map=="function"?new Map:void 0;return pP=function(n){if(n===null||!mae(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(e!==void 0){if(e.has(n))return e.get(n);e.set(n,r)}function r(){return Aae(n,arguments,dP(this).constructor)}return r.prototype=Object.create(n.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),Lm(r,n)},pP(i)}var Nl=(function(i){pae(e,i);function e(t){var n;if(1)n=i.call(this,"An error occurred. See https://github.com/styled-components/polished/blob/main/src/internalHelpers/errors.md#"+t+" for more information.")||this;else for(var r,s,o;o<r;o++);return dae(n)}return e})(pP(Error));function gae(i,e){return i.substr(-e.length)===e}var ZDe=/^([+-]?(?:\d+|\d*\.\d+))([a-z]*|%)$/;function vae(i){if(typeof i!="string")return i;var e=i.match(ZDe);return e?parseFloat(i):i}var KDe=function(e){return function(t,n){n===void 0&&(n="16px");var r=t,s=n;if(typeof t=="string"){if(!gae(t,"px"))throw new Nl(69,e,t);r=vae(t)}if(typeof n=="string"){if(!gae(n,"px"))throw new Nl(70,e,n);s=vae(n)}if(typeof r=="string")throw new Nl(71,t,e);if(typeof s=="string")throw new Nl(72,n,e);return""+r/s+e}},xae=KDe,__t=xae("em");var x_t=xae("rem");function $V(i){return Math.round(i*255)}function QDe(i,e,t){return $V(i)+","+$V(e)+","+$V(t)}function qS(i,e,t,n){if(n===void 0&&(n=QDe),e===0)return n(t,t,t);var r=(i%360+360)%360/60,s=(1-Math.abs(2*t-1))*e,o=s*(1-Math.abs(r%2-1)),a=0,l=0,c=0;r>=0&&r<1?(a=s,l=o):r>=1&&r<2?(a=o,l=s):r>=2&&r<3?(l=s,c=o):r>=3&&r<4?(l=o,c=s):r>=4&&r<5?(a=o,c=s):r>=5&&r<6&&(a=s,c=o);var u=t-s/2,f=a+u,d=l+u,A=c+u;return n(f,d,A)}var _ae={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"639",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"};function JDe(i){if(typeof i!="string")return i;var e=i.toLowerCase();return _ae[e]?"#"+_ae[e]:i}var eNe=/^#[a-fA-F0-9]{6}$/,tNe=/^#[a-fA-F0-9]{8}$/,nNe=/^#[a-fA-F0-9]{3}$/,iNe=/^#[a-fA-F0-9]{4}$/,YV=/^rgb\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*\)$/i,rNe=/^rgb(?:a)?\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i,sNe=/^hsl\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i,oNe=/^hsl(?:a)?\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i;function Dm(i){if(typeof i!="string")throw new Nl(3);var e=JDe(i);if(e.match(eNe))return{red:parseInt(""+e[1]+e[2],16),green:parseInt(""+e[3]+e[4],16),blue:parseInt(""+e[5]+e[6],16)};if(e.match(tNe)){var t=parseFloat((parseInt(""+e[7]+e[8],16)/255).toFixed(2));return{red:parseInt(""+e[1]+e[2],16),green:parseInt(""+e[3]+e[4],16),blue:parseInt(""+e[5]+e[6],16),alpha:t}}if(e.match(nNe))return{red:parseInt(""+e[1]+e[1],16),green:parseInt(""+e[2]+e[2],16),blue:parseInt(""+e[3]+e[3],16)};if(e.match(iNe)){var n=parseFloat((parseInt(""+e[4]+e[4],16)/255).toFixed(2));return{red:parseInt(""+e[1]+e[1],16),green:parseInt(""+e[2]+e[2],16),blue:parseInt(""+e[3]+e[3],16),alpha:n}}var r=YV.exec(e);if(r)return{red:parseInt(""+r[1],10),green:parseInt(""+r[2],10),blue:parseInt(""+r[3],10)};var s=rNe.exec(e.substring(0,50));if(s)return{red:parseInt(""+s[1],10),green:parseInt(""+s[2],10),blue:parseInt(""+s[3],10),alpha:parseFloat(""+s[4])>1?parseFloat(""+s[4])/100:parseFloat(""+s[4])};var o=sNe.exec(e);if(o){var a=parseInt(""+o[1],10),l=parseInt(""+o[2],10)/100,c=parseInt(""+o[3],10)/100,u="rgb("+qS(a,l,c)+")",f=YV.exec(u);if(!f)throw new Nl(4,e,u);return{red:parseInt(""+f[1],10),green:parseInt(""+f[2],10),blue:parseInt(""+f[3],10)}}var d=oNe.exec(e.substring(0,50));if(d){var A=parseInt(""+d[1],10),y=parseInt(""+d[2],10)/100,w=parseInt(""+d[3],10)/100,S="rgb("+qS(A,y,w)+")",T=YV.exec(S);if(!T)throw new Nl(4,e,S);return{red:parseInt(""+T[1],10),green:parseInt(""+T[2],10),blue:parseInt(""+T[3],10),alpha:parseFloat(""+d[4])>1?parseFloat(""+d[4])/100:parseFloat(""+d[4])}}throw new Nl(5)}function aNe(i){var e=i.red/255,t=i.green/255,n=i.blue/255,r=Math.max(e,t,n),s=Math.min(e,t,n),o=(r+s)/2;if(r===s)return i.alpha!==void 0?{hue:0,saturation:0,lightness:o,alpha:i.alpha}:{hue:0,saturation:0,lightness:o};var a,l=r-s,c=o>.5?l/(2-r-s):l/(r+s);switch(r){case e:a=(t-n)/l+(t<n?6:0);break;case t:a=(n-e)/l+2;break;default:a=(e-t)/l+4;break}return a*=60,i.alpha!==void 0?{hue:a,saturation:c,lightness:o,alpha:i.alpha}:{hue:a,saturation:c,lightness:o}}function Nm(i){return aNe(Dm(i))}var lNe=function(e){return e.length===7&&e[1]===e[2]&&e[3]===e[4]&&e[5]===e[6]?"#"+e[1]+e[3]+e[5]:e},KV=lNe;function v1(i){var e=i.toString(16);return e.length===1?"0"+e:e}function ZV(i){return v1(Math.round(i*255))}function cNe(i,e,t){return KV("#"+ZV(i)+ZV(e)+ZV(t))}function mP(i,e,t){return qS(i,e,t,cNe)}function uNe(i,e,t){if(typeof i=="number"&&typeof e=="number"&&typeof t=="number")return mP(i,e,t);if(typeof i=="object"&&e===void 0&&t===void 0)return mP(i.hue,i.saturation,i.lightness);throw new Nl(1)}function hNe(i,e,t,n){if(typeof i=="number"&&typeof e=="number"&&typeof t=="number"&&typeof n=="number")return n>=1?mP(i,e,t):"rgba("+qS(i,e,t)+","+n+")";if(typeof i=="object"&&e===void 0&&t===void 0&&n===void 0)return i.alpha>=1?mP(i.hue,i.saturation,i.lightness):"rgba("+qS(i.hue,i.saturation,i.lightness)+","+i.alpha+")";throw new Nl(2)}function QV(i,e,t){if(typeof i=="number"&&typeof e=="number"&&typeof t=="number")return KV("#"+v1(i)+v1(e)+v1(t));if(typeof i=="object"&&e===void 0&&t===void 0)return KV("#"+v1(i.red)+v1(i.green)+v1(i.blue));throw new Nl(6)}function AP(i,e,t,n){if(typeof i=="string"&&typeof e=="number"){var r=Dm(i);return"rgba("+r.red+","+r.green+","+r.blue+","+e+")"}else{if(typeof i=="number"&&typeof e=="number"&&typeof t=="number"&&typeof n=="number")return n>=1?QV(i,e,t):"rgba("+i+","+e+","+t+","+n+")";if(typeof i=="object"&&e===void 0&&t===void 0&&n===void 0)return i.alpha>=1?QV(i.red,i.green,i.blue):"rgba("+i.red+","+i.green+","+i.blue+","+i.alpha+")"}throw new Nl(7)}var fNe=function(e){return typeof e.red=="number"&&typeof e.green=="number"&&typeof e.blue=="number"&&(typeof e.alpha!="number"||typeof e.alpha>"u")},dNe=function(e){return typeof e.red=="number"&&typeof e.green=="number"&&typeof e.blue=="number"&&typeof e.alpha=="number"},pNe=function(e){return typeof e.hue=="number"&&typeof e.saturation=="number"&&typeof e.lightness=="number"&&(typeof e.alpha!="number"||typeof e.alpha>"u")},mNe=function(e){return typeof e.hue=="number"&&typeof e.saturation=="number"&&typeof e.lightness=="number"&&typeof e.alpha=="number"};function Fm(i){if(typeof i!="object")throw new Nl(8);if(dNe(i))return AP(i);if(fNe(i))return QV(i);if(mNe(i))return hNe(i);if(pNe(i))return uNe(i);throw new Nl(8)}function yae(i,e,t){return function(){var r=t.concat(Array.prototype.slice.call(arguments));return r.length>=e?i.apply(this,r):yae(i,e,r)}}function Ac(i){return yae(i,i.length,[])}function ANe(i,e){if(e==="transparent")return e;var t=Nm(e);return Fm(nl({},t,{hue:t.hue+parseFloat(i)}))}var y_t=Ac(ANe);function Nx(i,e,t){return Math.max(i,Math.min(e,t))}function gNe(i,e){if(e==="transparent")return e;var t=Nm(e);return Fm(nl({},t,{lightness:Nx(0,1,t.lightness-parseFloat(i))}))}var b_t=Ac(gNe);function vNe(i,e){if(e==="transparent")return e;var t=Nm(e);return Fm(nl({},t,{saturation:Nx(0,1,t.saturation-parseFloat(i))}))}var w_t=Ac(vNe);function _Ne(i,e){if(e==="transparent")return e;var t=Nm(e);return Fm(nl({},t,{lightness:Nx(0,1,t.lightness+parseFloat(i))}))}var S_t=Ac(_Ne);function xNe(i,e,t){if(e==="transparent")return t;if(t==="transparent")return e;if(i===0)return t;var n=Dm(e),r=nl({},n,{alpha:typeof n.alpha=="number"?n.alpha:1}),s=Dm(t),o=nl({},s,{alpha:typeof s.alpha=="number"?s.alpha:1}),a=r.alpha-o.alpha,l=parseFloat(i)*2-1,c=l*a===-1?l:l+a,u=1+l*a,f=(c/u+1)/2,d=1-f,A={red:Math.floor(r.red*f+o.red*d),green:Math.floor(r.green*f+o.green*d),blue:Math.floor(r.blue*f+o.blue*d),alpha:r.alpha*parseFloat(i)+o.alpha*(1-parseFloat(i))};return AP(A)}var yNe=Ac(xNe),bae=yNe;function bNe(i,e){if(e==="transparent")return e;var t=Dm(e),n=typeof t.alpha=="number"?t.alpha:1,r=nl({},t,{alpha:Nx(0,1,(n*100+parseFloat(i)*100)/100)});return AP(r)}var wNe=Ac(bNe),wae=wNe;function SNe(i,e){if(e==="transparent")return e;var t=Nm(e);return Fm(nl({},t,{saturation:Nx(0,1,t.saturation+parseFloat(i))}))}var T_t=Ac(SNe);function TNe(i,e){return e==="transparent"?e:Fm(nl({},Nm(e),{hue:parseFloat(i)}))}var E_t=Ac(TNe);function ENe(i,e){return e==="transparent"?e:Fm(nl({},Nm(e),{lightness:parseFloat(i)}))}var M_t=Ac(ENe);function MNe(i,e){return e==="transparent"?e:Fm(nl({},Nm(e),{saturation:parseFloat(i)}))}var C_t=Ac(MNe);function CNe(i,e){return e==="transparent"?e:bae(parseFloat(i),"rgb(0, 0, 0)",e)}var R_t=Ac(CNe);function RNe(i,e){return e==="transparent"?e:bae(parseFloat(i),"rgb(255, 255, 255)",e)}var I_t=Ac(RNe);function INe(i,e){if(e==="transparent")return e;var t=Dm(e),n=typeof t.alpha=="number"?t.alpha:1,r=nl({},t,{alpha:Nx(0,1,+(n*100-parseFloat(i)*100).toFixed(2)/100)});return AP(r)}var P_t=Ac(INe);var gP="http://www.w3.org/1999/xhtml",JV={svg:"http://www.w3.org/2000/svg",xhtml:gP,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function vP(i){var e=i+="",t=e.indexOf(":");return t>=0&&(e=i.slice(0,t))!=="xmlns"&&(i=i.slice(t+1)),JV.hasOwnProperty(e)?{space:JV[e],local:i}:i}function PNe(i){return function(){var e=this.ownerDocument,t=this.namespaceURI;return t===gP&&e.documentElement.namespaceURI===gP?e.createElement(i):e.createElementNS(t,i)}}function LNe(i){return function(){return this.ownerDocument.createElementNS(i.space,i.local)}}function _P(i){var e=vP(i);return(e.local?LNe:PNe)(e)}function DNe(){}function xP(i){return i==null?DNe:function(){return this.querySelector(i)}}function Sae(i){typeof i!="function"&&(i=xP(i));for(var e=this._groups,t=e.length,n=new Array(t),r=0;r<t;++r)for(var s=e[r],o=s.length,a=n[r]=new Array(o),l,c,u=0;u<o;++u)(l=s[u])&&(c=i.call(l,l.__data__,u,s))&&("__data__"in l&&(c.__data__=l.__data__),a[u]=c);return new ys(n,this._parents)}function eG(i){return i==null?[]:Array.isArray(i)?i:Array.from(i)}function NNe(){return[]}function Tae(i){return i==null?NNe:function(){return this.querySelectorAll(i)}}function FNe(i){return function(){return eG(i.apply(this,arguments))}}function Eae(i){typeof i=="function"?i=FNe(i):i=Tae(i);for(var e=this._groups,t=e.length,n=[],r=[],s=0;s<t;++s)for(var o=e[s],a=o.length,l,c=0;c<a;++c)(l=o[c])&&(n.push(i.call(l,l.__data__,c,o)),r.push(l));return new ys(n,r)}function Mae(i){return function(){return this.matches(i)}}function yP(i){return function(e){return e.matches(i)}}var BNe=Array.prototype.find;function ONe(i){return function(){return BNe.call(this.children,i)}}function UNe(){return this.firstElementChild}function Cae(i){return this.select(i==null?UNe:ONe(typeof i=="function"?i:yP(i)))}var kNe=Array.prototype.filter;function zNe(){return Array.from(this.children)}function VNe(i){return function(){return kNe.call(this.children,i)}}function Rae(i){return this.selectAll(i==null?zNe:VNe(typeof i=="function"?i:yP(i)))}function Iae(i){typeof i!="function"&&(i=Mae(i));for(var e=this._groups,t=e.length,n=new Array(t),r=0;r<t;++r)for(var s=e[r],o=s.length,a=n[r]=[],l,c=0;c<o;++c)(l=s[c])&&i.call(l,l.__data__,c,s)&&a.push(l);return new ys(n,this._parents)}function bP(i){return new Array(i.length)}function Pae(){return new ys(this._enter||this._groups.map(bP),this._parents)}function HS(i,e){this.ownerDocument=i.ownerDocument,this.namespaceURI=i.namespaceURI,this._next=null,this._parent=i,this.__data__=e}HS.prototype={constructor:HS,appendChild:function(i){return this._parent.insertBefore(i,this._next)},insertBefore:function(i,e){return this._parent.insertBefore(i,e)},querySelector:function(i){return this._parent.querySelector(i)},querySelectorAll:function(i){return this._parent.querySelectorAll(i)}};function Lae(i){return function(){return i}}function GNe(i,e,t,n,r,s){for(var o=0,a,l=e.length,c=s.length;o<c;++o)(a=e[o])?(a.__data__=s[o],n[o]=a):t[o]=new HS(i,s[o]);for(;o<l;++o)(a=e[o])&&(r[o]=a)}function qNe(i,e,t,n,r,s,o){var a,l,c=new Map,u=e.length,f=s.length,d=new Array(u),A;for(a=0;a<u;++a)(l=e[a])&&(d[a]=A=o.call(l,l.__data__,a,e)+"",c.has(A)?r[a]=l:c.set(A,l));for(a=0;a<f;++a)A=o.call(i,s[a],a,s)+"",(l=c.get(A))?(n[a]=l,l.__data__=s[a],c.delete(A)):t[a]=new HS(i,s[a]);for(a=0;a<u;++a)(l=e[a])&&c.get(d[a])===l&&(r[a]=l)}function HNe(i){return i.__data__}function Dae(i,e){if(!arguments.length)return Array.from(this,HNe);var t=e?qNe:GNe,n=this._parents,r=this._groups;typeof i!="function"&&(i=Lae(i));for(var s=r.length,o=new Array(s),a=new Array(s),l=new Array(s),c=0;c<s;++c){var u=n[c],f=r[c],d=f.length,A=WNe(i.call(u,u&&u.__data__,c,n)),y=A.length,w=a[c]=new Array(y),S=o[c]=new Array(y),T=l[c]=new Array(d);t(u,f,w,S,T,A,e);for(var R=0,P=0,I,F;R<y;++R)if(I=w[R]){for(R>=P&&(P=R+1);!(F=S[P])&&++P<y;);I._next=F||null}}return o=new ys(o,n),o._enter=a,o._exit=l,o}function WNe(i){return typeof i=="object"&&"length"in i?i:Array.from(i)}function Nae(){return new ys(this._exit||this._groups.map(bP),this._parents)}function Fae(i,e,t){var n=this.enter(),r=this,s=this.exit();return typeof i=="function"?(n=i(n),n&&(n=n.selection())):n=n.append(i+""),e!=null&&(r=e(r),r&&(r=r.selection())),t==null?s.remove():t(s),n&&r?n.merge(r).order():r}function Bae(i){for(var e=i.selection?i.selection():i,t=this._groups,n=e._groups,r=t.length,s=n.length,o=Math.min(r,s),a=new Array(r),l=0;l<o;++l)for(var c=t[l],u=n[l],f=c.length,d=a[l]=new Array(f),A,y=0;y<f;++y)(A=c[y]||u[y])&&(d[y]=A);for(;l<r;++l)a[l]=t[l];return new ys(a,this._parents)}function Oae(){for(var i=this._groups,e=-1,t=i.length;++e<t;)for(var n=i[e],r=n.length-1,s=n[r],o;--r>=0;)(o=n[r])&&(s&&o.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(o,s),s=o);return this}function Uae(i){i||(i=jNe);function e(f,d){return f&&d?i(f.__data__,d.__data__):!f-!d}for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s){for(var o=t[s],a=o.length,l=r[s]=new Array(a),c,u=0;u<a;++u)(c=o[u])&&(l[u]=c);l.sort(e)}return new ys(r,this._parents).order()}function jNe(i,e){return i<e?-1:i>e?1:i>=e?0:NaN}function kae(){var i=arguments[0];return arguments[0]=this,i.apply(null,arguments),this}function zae(){return Array.from(this)}function Vae(){for(var i=this._groups,e=0,t=i.length;e<t;++e)for(var n=i[e],r=0,s=n.length;r<s;++r){var o=n[r];if(o)return o}return null}function Gae(){let i=0;for(let e of this)++i;return i}function qae(){return!this.node()}function Hae(i){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],s=0,o=r.length,a;s<o;++s)(a=r[s])&&i.call(a,a.__data__,s,r);return this}function XNe(i){return function(){this.removeAttribute(i)}}function $Ne(i){return function(){this.removeAttributeNS(i.space,i.local)}}function YNe(i,e){return function(){this.setAttribute(i,e)}}function ZNe(i,e){return function(){this.setAttributeNS(i.space,i.local,e)}}function KNe(i,e){return function(){var t=e.apply(this,arguments);t==null?this.removeAttribute(i):this.setAttribute(i,t)}}function QNe(i,e){return function(){var t=e.apply(this,arguments);t==null?this.removeAttributeNS(i.space,i.local):this.setAttributeNS(i.space,i.local,t)}}function Wae(i,e){var t=vP(i);if(arguments.length<2){var n=this.node();return t.local?n.getAttributeNS(t.space,t.local):n.getAttribute(t)}return this.each((e==null?t.local?$Ne:XNe:typeof e=="function"?t.local?QNe:KNe:t.local?ZNe:YNe)(t,e))}function wP(i){return i.ownerDocument&&i.ownerDocument.defaultView||i.document&&i||i.defaultView}function JNe(i){return function(){this.style.removeProperty(i)}}function e5e(i,e,t){return function(){this.style.setProperty(i,e,t)}}function t5e(i,e,t){return function(){var n=e.apply(this,arguments);n==null?this.style.removeProperty(i):this.style.setProperty(i,n,t)}}function jae(i,e,t){return arguments.length>1?this.each((e==null?JNe:typeof e=="function"?t5e:e5e)(i,e,t??"")):n5e(this.node(),i)}function n5e(i,e){return i.style.getPropertyValue(e)||wP(i).getComputedStyle(i,null).getPropertyValue(e)}function i5e(i){return function(){delete this[i]}}function r5e(i,e){return function(){this[i]=e}}function s5e(i,e){return function(){var t=e.apply(this,arguments);t==null?delete this[i]:this[i]=t}}function Xae(i,e){return arguments.length>1?this.each((e==null?i5e:typeof e=="function"?s5e:r5e)(i,e)):this.node()[i]}function $ae(i){return i.trim().split(/^|\s+/)}function tG(i){return i.classList||new Yae(i)}function Yae(i){this._node=i,this._names=$ae(i.getAttribute("class")||"")}Yae.prototype={add:function(i){var e=this._names.indexOf(i);e<0&&(this._names.push(i),this._node.setAttribute("class",this._names.join(" ")))},remove:function(i){var e=this._names.indexOf(i);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(i){return this._names.indexOf(i)>=0}};function Zae(i,e){for(var t=tG(i),n=-1,r=e.length;++n<r;)t.add(e[n])}function Kae(i,e){for(var t=tG(i),n=-1,r=e.length;++n<r;)t.remove(e[n])}function o5e(i){return function(){Zae(this,i)}}function a5e(i){return function(){Kae(this,i)}}function l5e(i,e){return function(){(e.apply(this,arguments)?Zae:Kae)(this,i)}}function Qae(i,e){var t=$ae(i+"");if(arguments.length<2){for(var n=tG(this.node()),r=-1,s=t.length;++r<s;)if(!n.contains(t[r]))return!1;return!0}return this.each((typeof e=="function"?l5e:e?o5e:a5e)(t,e))}function c5e(){this.textContent=""}function u5e(i){return function(){this.textContent=i}}function h5e(i){return function(){var e=i.apply(this,arguments);this.textContent=e??""}}function Jae(i){return arguments.length?this.each(i==null?c5e:(typeof i=="function"?h5e:u5e)(i)):this.node().textContent}function f5e(){this.innerHTML=""}function d5e(i){return function(){this.innerHTML=i}}function p5e(i){return function(){var e=i.apply(this,arguments);this.innerHTML=e??""}}function ele(i){return arguments.length?this.each(i==null?f5e:(typeof i=="function"?p5e:d5e)(i)):this.node().innerHTML}function m5e(){this.nextSibling&&this.parentNode.appendChild(this)}function tle(){return this.each(m5e)}function A5e(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function nle(){return this.each(A5e)}function ile(i){var e=typeof i=="function"?i:_P(i);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function g5e(){return null}function rle(i,e){var t=typeof i=="function"?i:_P(i),n=e==null?g5e:typeof e=="function"?e:xP(e);return this.select(function(){return this.insertBefore(t.apply(this,arguments),n.apply(this,arguments)||null)})}function v5e(){var i=this.parentNode;i&&i.removeChild(this)}function sle(){return this.each(v5e)}function _5e(){var i=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(i,this.nextSibling):i}function x5e(){var i=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(i,this.nextSibling):i}function ole(i){return this.select(i?x5e:_5e)}function ale(i){return arguments.length?this.property("__data__",i):this.node().__data__}function y5e(i){return function(e){i.call(this,e,this.__data__)}}function b5e(i){return i.trim().split(/^|\s+/).map(function(e){var t="",n=e.indexOf(".");return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function w5e(i){return function(){var e=this.__on;if(e){for(var t=0,n=-1,r=e.length,s;t<r;++t)s=e[t],(!i.type||s.type===i.type)&&s.name===i.name?this.removeEventListener(s.type,s.listener,s.options):e[++n]=s;++n?e.length=n:delete this.__on}}}function S5e(i,e,t){return function(){var n=this.__on,r,s=y5e(e);if(n){for(var o=0,a=n.length;o<a;++o)if((r=n[o]).type===i.type&&r.name===i.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=s,r.options=t),r.value=e;return}}this.addEventListener(i.type,s,t),r={type:i.type,name:i.name,value:e,listener:s,options:t},n?n.push(r):this.__on=[r]}}function lle(i,e,t){var n=b5e(i+""),r,s=n.length,o;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,c=a.length,u;l<c;++l)for(r=0,u=a[l];r<s;++r)if((o=n[r]).type===u.type&&o.name===u.name)return u.value}return}for(a=e?S5e:w5e,r=0;r<s;++r)this.each(a(n[r],e,t));return this}function cle(i,e,t){var n=wP(i),r=n.CustomEvent;typeof r=="function"?r=new r(e,t):(r=n.document.createEvent("Event"),t?(r.initEvent(e,t.bubbles,t.cancelable),r.detail=t.detail):r.initEvent(e,!1,!1)),i.dispatchEvent(r)}function T5e(i,e){return function(){return cle(this,i,e)}}function E5e(i,e){return function(){return cle(this,i,e.apply(this,arguments))}}function ule(i,e){return this.each((typeof e=="function"?E5e:T5e)(i,e))}function*hle(){for(var i=this._groups,e=0,t=i.length;e<t;++e)for(var n=i[e],r=0,s=n.length,o;r<s;++r)(o=n[r])&&(yield o)}var nG=[null];function ys(i,e){this._groups=i,this._parents=e}function M5e(){return new ys([[document.documentElement]],nG)}function C5e(){return this}ys.prototype=M5e.prototype={constructor:ys,select:Sae,selectAll:Eae,selectChild:Cae,selectChildren:Rae,filter:Iae,data:Dae,enter:Pae,exit:Nae,join:Fae,merge:Bae,selection:C5e,order:Oae,sort:Uae,call:kae,nodes:zae,node:Vae,size:Gae,empty:qae,each:Hae,attr:Wae,style:jae,property:Xae,classed:Qae,text:Jae,html:ele,raise:tle,lower:nle,append:ile,insert:rle,remove:sle,clone:ole,datum:ale,on:lle,dispatch:ule,[Symbol.iterator]:hle};function iG(i){return typeof i=="string"?new ys([[document.querySelector(i)]],[document.documentElement]):new ys([[i]],nG)}function fle(i){let e;for(;e=i.sourceEvent;)i=e;return i}function rG(i,e){if(i=fle(i),e===void 0&&(e=i.currentTarget),e){var t=e.ownerSVGElement||e;if(t.createSVGPoint){var n=t.createSVGPoint();return n.x=i.clientX,n.y=i.clientY,n=n.matrixTransform(e.getScreenCTM().inverse()),[n.x,n.y]}if(e.getBoundingClientRect){var r=e.getBoundingClientRect();return[i.clientX-r.left-e.clientLeft,i.clientY-r.top-e.clientTop]}}return[i.pageX,i.pageY]}var XS,Vr,gle,lG,Bm,dle,vle,_le,sG,TP,WS,xle,cG,oG,aG,R5e,MP={},CP=[],I5e=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,IP=Array.isArray;function Uf(i,e){for(var t in e)i[t]=e[t];return i}function uG(i){i&&i.parentNode&&i.parentNode.removeChild(i)}function P5e(i,e,t){var n,r,s,o={};for(s in e)s=="key"?n=e[s]:s=="ref"?r=e[s]:o[s]=e[s];if(arguments.length>2&&(o.children=arguments.length>3?XS.call(arguments,2):t),typeof i=="function"&&i.defaultProps!=null)for(s in i.defaultProps)o[s]===void 0&&(o[s]=i.defaultProps[s]);return jS(i,o,n,r,null)}function jS(i,e,t,n,r){var s={type:i,props:e,key:t,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r??++gle,__i:-1,__u:0};return r==null&&Vr.vnode!=null&&Vr.vnode(s),s}function PP(i){return i.children}function EP(i,e){this.props=i,this.context=e}function _1(i,e){if(e==null)return i.__?_1(i.__,i.__i+1):null;for(var t;e<i.__k.length;e++)if((t=i.__k[e])!=null&&t.__e!=null)return t.__e;return typeof i.type=="function"?_1(i):null}function L5e(i){if(i.__P&&i.__d){var e=i.__v,t=e.__e,n=[],r=[],s=Uf({},e);s.__v=e.__v+1,Vr.vnode&&Vr.vnode(s),hG(i.__P,s,e,i.__n,i.__P.namespaceURI,32&e.__u?[t]:null,n,t??_1(e),!!(32&e.__u),r),s.__v=e.__v,s.__.__k[s.__i]=s,Tle(n,s,r),e.__e=e.__=null,s.__e!=t&&yle(s)}}function yle(i){if((i=i.__)!=null&&i.__c!=null)return i.__e=i.__c.base=null,i.__k.some(function(e){if(e!=null&&e.__e!=null)return i.__e=i.__c.base=e.__e}),yle(i)}function ple(i){(!i.__d&&(i.__d=!0)&&Bm.push(i)&&!RP.__r++||dle!=Vr.debounceRendering)&&((dle=Vr.debounceRendering)||vle)(RP)}function RP(){try{for(var i,e=1;Bm.length;)Bm.length>e&&Bm.sort(_le),i=Bm.shift(),e=Bm.length,L5e(i)}finally{Bm.length=RP.__r=0}}function ble(i,e,t,n,r,s,o,a,l,c,u){var f,d,A,y,w,S,T=n&&n.__k||CP,R=e.length;for(l=D5e(t,e,T,l,R),f=0;f<R;f++)(A=t.__k[f])!=null&&(d=A.__i!=-1&&T[A.__i]||MP,A.__i=f,S=hG(i,A,d,r,s,o,a,l,c,u),y=A.__e,A.ref&&d.ref!=A.ref&&(d.ref&&fG(d.ref,null,A),u.push(A.ref,A.__c||y,A)),w==null&&y!=null&&(w=y),4&A.__u?(l=wle(A,l,i),d.__e&&(d.__e=null)):typeof A.type=="function"&&S!==void 0?l=S:y&&(l=y.nextSibling),A.__u&=-7);return t.__e=w,l}function D5e(i,e,t,n,r){var s,o,a,l,c,u=t.length,f=u,d=0;for(i.__k=new Array(r),s=0;s<r;s++)(o=e[s])!=null&&typeof o!="boolean"&&typeof o!="function"?(typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?o=i.__k[s]=jS(null,o,null,null,null):IP(o)?o=i.__k[s]=jS(PP,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=i.__k[s]=jS(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):i.__k[s]=o,l=s+d,o.__=i,o.__b=i.__b+1,a=null,(c=o.__i=N5e(o,t,l,f))!=-1&&(f--,(a=t[c])&&(a.__u|=2)),a==null||a.__v==null?(c==-1&&(r>u?d--:r<u&&d++),typeof o.type!="function"&&(o.__u|=4)):c!=l&&(c==l-1?d--:c==l+1?d++:(c>l?d--:d++,o.__u|=4))):i.__k[s]=null;if(f)for(s=0;s<u;s++)(a=t[s])!=null&&(2&a.__u)==0&&(a.__e==n&&(n=_1(a)),Mle(a,a));return n}function wle(i,e,t){var n,r;if(typeof i.type=="function"){for(n=i.__k,r=0;n&&r<n.length;r++)n[r]&&(n[r].__=i,e=wle(n[r],e,t));return e}i.__e!=e&&(e&&i.type&&!e.parentNode&&(e=_1(i)),e=t.insertBefore(i.__e,e||null));do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function N5e(i,e,t,n){var r,s,o,a=i.key,l=i.type,c=e[t],u=c!=null&&(2&c.__u)==0;if(c===null&&a==null||u&&a==c.key&&l==c.type)return t;if(n>(u?1:0)){for(r=t-1,s=t+1;r>=0||s<e.length;)if((c=e[o=r>=0?r--:s++])!=null&&(2&c.__u)==0&&a==c.key&&l==c.type)return o}return-1}function mle(i,e,t){e[0]=="-"?i.setProperty(e,t??""):i[e]=t==null?"":typeof t!="number"||I5e.test(e)?t:t+"px"}function SP(i,e,t,n,r){var s,o;e:if(e=="style")if(typeof t=="string")i.style.cssText=t;else{if(typeof n=="string"&&(i.style.cssText=n=""),n)for(e in n)t&&e in t||mle(i.style,e,"");if(t)for(e in t)n&&t[e]==n[e]||mle(i.style,e,t[e])}else if(e[0]=="o"&&e[1]=="n")s=e!=(e=e.replace(xle,"$1")),o=e.toLowerCase(),e=o in i||e=="onFocusOut"||e=="onFocusIn"?o.slice(2):e.slice(2),i.l||(i.l={}),i.l[e+s]=t,t?n?t[WS]=n[WS]:(t[WS]=cG,i.addEventListener(e,s?aG:oG,s)):i.removeEventListener(e,s?aG:oG,s);else{if(r=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in i)try{i[e]=t??"";break e}catch{}typeof t=="function"||(t==null||t===!1&&e[4]!="-"?i.removeAttribute(e):i.setAttribute(e,e=="popover"&&t==1?"":t))}}function Ale(i){return function(e){if(this.l){var t=this.l[e.type+i];if(e[TP]==null)e[TP]=cG++;else if(e[TP]<t[WS])return;return t(Vr.event?Vr.event(e):e)}}}function hG(i,e,t,n,r,s,o,a,l,c){var u,f,d,A,y,w,S,T,R,P,I,F,D,L,C,B,k=e.type;if(e.constructor!==void 0)return null;128&t.__u&&(l=!!(32&t.__u),s=[a=e.__e=t.__e]),(u=Vr.__b)&&u(e);e:if(typeof k=="function"){f=o.length;try{if(R=e.props,P=k.prototype&&k.prototype.render,I=(u=k.contextType)&&n[u.__c],F=u?I?I.props.value:u.__:n,t.__c?T=(d=e.__c=t.__c).__=d.__E:(P?e.__c=d=new k(R,F):(e.__c=d=new EP(R,F),d.constructor=k,d.render=B5e),I&&I.sub(d),d.state||(d.state={}),d.__n=n,A=d.__d=!0,d.__h=[],d._sb=[]),P&&d.__s==null&&(d.__s=d.state),P&&k.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=Uf({},d.__s)),Uf(d.__s,k.getDerivedStateFromProps(R,d.__s))),y=d.props,w=d.state,d.__v=e,A)P&&k.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),P&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(P&&k.getDerivedStateFromProps==null&&R!==y&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(R,F),e.__v==t.__v||!d.__e&&d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(R,d.__s,F)===!1){e.__v!=t.__v&&(d.props=R,d.state=d.__s,d.__d=!1),e.__e=t.__e,e.__k=t.__k,e.__k.some(function(z){z&&(z.__=e)}),CP.push.apply(d.__h,d._sb),d._sb=[],d.__h.length&&o.push(d),a=_1(t);break e}d.componentWillUpdate!=null&&d.componentWillUpdate(R,d.__s,F),P&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(y,w,S)})}if(d.context=F,d.props=R,d.__P=i,d.__e=!1,D=Vr.__r,L=0,P)d.state=d.__s,d.__d=!1,D&&D(e),u=d.render(d.props,d.state,d.context),CP.push.apply(d.__h,d._sb),d._sb=[];else do d.__d=!1,D&&D(e),u=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++L<25);d.state=d.__s,d.getChildContext!=null&&(n=Uf(Uf({},n),d.getChildContext())),P&&!A&&d.getSnapshotBeforeUpdate!=null&&(S=d.getSnapshotBeforeUpdate(y,w)),C=u!=null&&u.type===PP&&u.key==null?Ele(u.props.children):u,a=ble(i,IP(C)?C:[C],e,t,n,r,s,o,a,l,c),d.base=e.__e,e.__u&=-161,d.__h.length&&o.push(d),T&&(d.__E=d.__=null)}catch(z){if(o.length=f,e.__v=null,l||s!=null){if(z.then){for(e.__u|=l?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;s!=null&&(s[s.indexOf(a)]=null),e.__e=a}else if(s!=null)for(B=s.length;B--;)uG(s[B])}else e.__e=t.__e;e.__k==null&&(e.__k=t.__k||[]),z.then||Sle(e),Vr.__e(z,e,t)}}else s==null&&e.__v==t.__v?(e.__k=t.__k,e.__e=t.__e):a=e.__e=F5e(t.__e,e,t,n,r,s,o,l,c);return(u=Vr.diffed)&&u(e),128&e.__u?void 0:a}function Sle(i){i&&(i.__c&&(i.__c.__e=!0),i.__k&&i.__k.some(Sle))}function Tle(i,e,t){for(var n=0;n<t.length;n++)fG(t[n],t[++n],t[++n]);Vr.__c&&Vr.__c(e,i),i.some(function(r){try{i=r.__h,r.__h=[],i.some(function(s){s.call(r)})}catch(s){Vr.__e(s,r.__v)}})}function Ele(i){return typeof i!="object"||i==null||i.__b>0?i:IP(i)?i.map(Ele):i.constructor!==void 0?null:Uf({},i)}function F5e(i,e,t,n,r,s,o,a,l){var c,u,f,d,A,y,w,S=t.props||MP,T=e.props,R=e.type;if(R=="svg"?r="http://www.w3.org/2000/svg":R=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),s!=null){for(c=0;c<s.length;c++)if((A=s[c])&&"setAttribute"in A==!!R&&(R?A.localName==R:A.nodeType==3)){i=A,s[c]=null;break}}if(i==null){if(R==null)return document.createTextNode(T);i=document.createElementNS(r,R,T.is&&T),a&&(Vr.__m&&Vr.__m(e,s),a=!1),s=null}if(R==null)S===T||a&&i.data==T||(i.data=T);else{if(s=R=="textarea"&&T.defaultValue!=null?null:s&&XS.call(i.childNodes),!a&&s!=null)for(S={},c=0;c<i.attributes.length;c++)S[(A=i.attributes[c]).name]=A.value;for(c in S)A=S[c],c=="dangerouslySetInnerHTML"?f=A:c=="children"||c in T||c=="value"&&"defaultValue"in T||c=="checked"&&"defaultChecked"in T||SP(i,c,null,A,r);for(c in T)A=T[c],c=="children"?d=A:c=="dangerouslySetInnerHTML"?u=A:c=="value"?y=A:c=="checked"?w=A:a&&typeof A!="function"||S[c]===A||SP(i,c,A,S[c],r);if(u)a||f&&(u.__html==f.__html||u.__html==i.innerHTML)||(i.innerHTML=u.__html),e.__k=[];else if(f&&(i.innerHTML=""),ble(e.type=="template"?i.content:i,IP(d)?d:[d],e,t,n,R=="foreignObject"?"http://www.w3.org/1999/xhtml":r,s,o,s?s[0]:t.__k&&_1(t,0),a,l),s!=null)for(c=s.length;c--;)uG(s[c]);a&&R!="textarea"||(c="value",R=="progress"&&y==null?i.removeAttribute("value"):y!=null&&(y!==i[c]||R=="progress"&&!y||R=="option"&&y!=S[c])&&SP(i,c,y,S[c],r),c="checked",w!=null&&w!=i[c]&&SP(i,c,w,S[c],r))}return i}function fG(i,e,t){try{if(typeof i=="function"){var n=typeof i.__u=="function";n&&i.__u(),n&&e==null||(i.__u=i(e))}else i.current=e}catch(r){Vr.__e(r,t)}}function Mle(i,e,t){var n,r;if(Vr.unmount&&Vr.unmount(i),(n=i.ref)&&(n.current&&n.current!=i.__e||fG(n,null,e)),(n=i.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(s){Vr.__e(s,e)}n.base=n.__P=n.__n=null}if(n=i.__k)for(r=0;r<n.length;r++)n[r]&&Mle(n[r],e,t||typeof i.type!="function");t||uG(i.__e),i.__c=i.__=i.__e=void 0}function B5e(i,e,t){return this.constructor(i,t)}function Cle(i,e,t){var n,r,s,o;e==document&&(e=document.documentElement),Vr.__&&Vr.__(i,e),r=(n=typeof t=="function")?null:t&&t.__k||e.__k,s=[],o=[],hG(e,i=(!n&&t||e).__k=P5e(PP,null,[i]),r||MP,MP,e.namespaceURI,!n&&t?[t]:r?null:e.firstChild?XS.call(e.childNodes):null,s,!n&&t?t:r?r.__e:e.firstChild,n,o),Tle(s,i,o),i.props.children=null}function dG(i,e,t){var n,r,s,o,a=Uf({},i.props);for(s in i.type&&i.type.defaultProps&&(o=i.type.defaultProps),e)s=="key"?n=e[s]:s=="ref"?r=e[s]:a[s]=e[s]===void 0&&o!=null?o[s]:e[s];return arguments.length>2&&(a.children=arguments.length>3?XS.call(arguments,2):t),jS(i.type,a,n||i.key,r||i.ref,null)}XS=CP.slice,Vr={__e:function(i,e,t,n){for(var r,s,o;e=e.__;)if((r=e.__c)&&!r.__)try{if((s=r.constructor)&&s.getDerivedStateFromError!=null&&(r.setState(s.getDerivedStateFromError(i)),o=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(i,n||{}),o=r.__d),o)return r.__E=r}catch(a){i=a}throw i}},gle=0,lG=function(i){return i!=null&&i.constructor===void 0},EP.prototype.setState=function(i,e){var t;t=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Uf({},this.state),typeof i=="function"&&(i=i(Uf({},t),this.props)),i&&Uf(t,i),i!=null&&this.__v&&(e&&this._sb.push(e),ple(this))},EP.prototype.forceUpdate=function(i){this.__v&&(this.__e=!0,i&&this.__h.push(i),ple(this))},EP.prototype.render=PP,Bm=[],vle=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,_le=function(i,e){return i.__v.__b-e.__v.__b},RP.__r=0,sG=Math.random().toString(8),TP="__d"+sG,WS="__a"+sG,xle=/(PointerCapture)$|Capture$/i,cG=0,oG=Ale(!1),aG=Ale(!0),R5e=0;function Rle(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function O5e(i){if(Array.isArray(i))return i}function U5e(i,e,t){return(e=H5e(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function k5e(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function z5e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.5259-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ile(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function V5e(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ile(Object(t),!0).forEach(function(n){U5e(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Ile(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function G5e(i,e){return O5e(i)||k5e(i,e)||W5e(i,e)||z5e()}function q5e(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function H5e(i){var e=q5e(i,"string");return typeof e=="symbol"?e:e+""}function LP(i){"@babel/helpers - typeof";return LP=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},LP(i)}function W5e(i,e){if(i){if(typeof i=="string")return Rle(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Rle(i,e):void 0}}var pG=function(e){if(LP(e)!=="object")return e;var t=dG(e);if(t.props){var n;t.props=V5e({},t.props),t!=null&&(n=t.props)!==null&&n!==void 0&&n.children&&(t.props.children=Array.isArray(t.props.children)?t.props.children.map(pG):pG(t.props.children))}return t},j5e=function(e){return lG(dG(e))},X5e=function(e,t){delete t.__k,Cle(pG(e),t)};function $5e(i,e){e===void 0&&(e={});var t=e.insertAt;if(!(typeof document>"u")){var n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=i:r.appendChild(document.createTextNode(i))}}var Y5e=`.float-tooltip-kap {5258+ }`};var rp=class{constructor(){this.isPass=!0,this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}setSize(){}render(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}dispose(){}},pNe=new Fu(-1,1,1,-1,0,1),eG=class extends Xn{constructor(){super(),this.setAttribute("position",new Ln([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new Ln([0,2,0,0,2,0],2))}},mNe=new eG,fP=class{constructor(e){this._mesh=new Hn(mNe,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,pNe)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}};var dP=class extends rp{constructor(e,t="tDiffuse"){super(),this.textureID=t,this.uniforms=null,this.material=null,e instanceof ds?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=mg.clone(e.uniforms),this.material=new ds({name:e.name!==void 0?e.name:"unspecified",defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this._fsQuad=new fP(this.material)}render(e,t,n){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=n.texture),this._fsQuad.material=this.material,this.renderToScreen?(e.setRenderTarget(null),this._fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this._fsQuad.render(e))}dispose(){this.material.dispose(),this._fsQuad.dispose()}};var jS=class extends rp{constructor(e,t){super(),this.scene=e,this.camera=t,this.clear=!0,this.needsSwap=!1,this.inverse=!1}render(e,t,n){let r=e.getContext(),s=e.state;s.buffers.color.setMask(!1),s.buffers.depth.setMask(!1),s.buffers.color.setLocked(!0),s.buffers.depth.setLocked(!0);let o,a;this.inverse?(o=0,a=1):(o=1,a=0),s.buffers.stencil.setTest(!0),s.buffers.stencil.setOp(r.REPLACE,r.REPLACE,r.REPLACE),s.buffers.stencil.setFunc(r.ALWAYS,o,4294967295),s.buffers.stencil.setClear(a),s.buffers.stencil.setLocked(!0),e.setRenderTarget(n),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),s.buffers.color.setLocked(!1),s.buffers.depth.setLocked(!1),s.buffers.color.setMask(!0),s.buffers.depth.setMask(!0),s.buffers.stencil.setLocked(!1),s.buffers.stencil.setFunc(r.EQUAL,1,4294967295),s.buffers.stencil.setOp(r.KEEP,r.KEEP,r.KEEP),s.buffers.stencil.setLocked(!0)}},pP=class extends rp{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}};var mP=class{constructor(e,t){if(this.renderer=e,this._pixelRatio=e.getPixelRatio(),t===void 0){let n=e.getSize(new Oe);this._width=n.width,this._height=n.height,t=new Oa(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:Wi}),t.texture.name="EffectComposer.rt1"}else this._width=t.width,this._height=t.height;this.renderTarget1=t,this.renderTarget2=t.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new dP(yae),this.copyPass.material.blending=ps,this.timer=new ng}swapBuffers(){let e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}addPass(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(e){let t=this.passes.indexOf(e);t!==-1&&this.passes.splice(t,1)}isLastEnabledPass(e){for(let t=e+1;t<this.passes.length;t++)if(this.passes[t].enabled)return!1;return!0}render(e){this.timer.update(),e===void 0&&(e=this.timer.getDelta());let t=this.renderer.getRenderTarget(),n=!1;for(let r=0,s=this.passes.length;r<s;r++){let o=this.passes[r];if(o.enabled!==!1){if(o.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(r),o.render(this.renderer,this.writeBuffer,this.readBuffer,e,n),o.needsSwap){if(n){let a=this.renderer.getContext(),l=this.renderer.state.buffers.stencil;l.setFunc(a.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),l.setFunc(a.EQUAL,1,4294967295)}this.swapBuffers()}jS!==void 0&&(o instanceof jS?n=!0:o instanceof pP&&(n=!1))}}this.renderer.setRenderTarget(t)}reset(e){if(e===void 0){let t=this.renderer.getSize(new Oe);this._pixelRatio=this.renderer.getPixelRatio(),this._width=t.width,this._height=t.height,e=this.renderTarget1.clone(),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=e,this.renderTarget2=e.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}setSize(e,t){this._width=e,this._height=t;let n=this._width*this._pixelRatio,r=this._height*this._pixelRatio;this.renderTarget1.setSize(n,r),this.renderTarget2.setSize(n,r);for(let s=0;s<this.passes.length;s++)this.passes[s].setSize(n,r)}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}dispose(){this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.copyPass.dispose()}};var AP=class extends rp{constructor(e,t,n=null,r=null,s=null){super(),this.scene=e,this.camera=t,this.overrideMaterial=n,this.clearColor=r,this.clearAlpha=s,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this.isRenderPass=!0,this._oldClearColor=new zt}render(e,t,n){let r=e.autoClear;e.autoClear=!1;let s,o;this.overrideMaterial!==null&&(o=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor!==null&&(e.getClearColor(this._oldClearColor),e.setClearColor(this.clearColor,e.getClearAlpha())),this.clearAlpha!==null&&(s=e.getClearAlpha(),e.setClearAlpha(this.clearAlpha)),this.clearDepth==!0&&e.clearDepth(),e.setRenderTarget(this.renderToScreen?null:n),this.clear===!0&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),e.render(this.scene,this.camera),this.clearColor!==null&&e.setClearColor(this._oldClearColor),this.clearAlpha!==null&&e.setClearAlpha(s),this.overrideMaterial!==null&&(this.scene.overrideMaterial=o),e.autoClear=r}};function il(){return il=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)({}).hasOwnProperty.call(t,n)&&(i[n]=t[n])}return i},il.apply(null,arguments)}function bae(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function Lm(i,e){return Lm=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},Lm(i,e)}function wae(i,e){i.prototype=Object.create(e.prototype),i.prototype.constructor=i,Lm(i,e)}function gP(i){return gP=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},gP(i)}function Sae(i){try{return Function.toString.call(i).indexOf("[native code]")!==-1}catch{return typeof i=="function"}}function tG(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(tG=function(){return!!i})()}function Tae(i,e,t){if(tG())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var r=new(i.bind.apply(i,n));return t&&Lm(r,t.prototype),r}function vP(i){var e=typeof Map=="function"?new Map:void 0;return vP=function(n){if(n===null||!Sae(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(e!==void 0){if(e.has(n))return e.get(n);e.set(n,r)}function r(){return Tae(n,arguments,gP(this).constructor)}return r.prototype=Object.create(n.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),Lm(r,n)},vP(i)}var Nl=(function(i){wae(e,i);function e(t){var n;if(1)n=i.call(this,"An error occurred. See https://github.com/styled-components/polished/blob/main/src/internalHelpers/errors.md#"+t+" for more information.")||this;else for(var r,s,o;o<r;o++);return bae(n)}return e})(vP(Error));function Eae(i,e){return i.substr(-e.length)===e}var ANe=/^([+-]?(?:\d+|\d*\.\d+))([a-z]*|%)$/;function Mae(i){if(typeof i!="string")return i;var e=i.match(ANe);return e?parseFloat(i):i}var gNe=function(e){return function(t,n){n===void 0&&(n="16px");var r=t,s=n;if(typeof t=="string"){if(!Eae(t,"px"))throw new Nl(69,e,t);r=Mae(t)}if(typeof n=="string"){if(!Eae(n,"px"))throw new Nl(70,e,n);s=Mae(n)}if(typeof r=="string")throw new Nl(71,t,e);if(typeof s=="string")throw new Nl(72,n,e);return""+r/s+e}},Rae=gNe,G_t=Rae("em");var q_t=Rae("rem");function nG(i){return Math.round(i*255)}function vNe(i,e,t){return nG(i)+","+nG(e)+","+nG(t)}function XS(i,e,t,n){if(n===void 0&&(n=vNe),e===0)return n(t,t,t);var r=(i%360+360)%360/60,s=(1-Math.abs(2*t-1))*e,o=s*(1-Math.abs(r%2-1)),a=0,l=0,c=0;r>=0&&r<1?(a=s,l=o):r>=1&&r<2?(a=o,l=s):r>=2&&r<3?(l=s,c=o):r>=3&&r<4?(l=o,c=s):r>=4&&r<5?(a=o,c=s):r>=5&&r<6&&(a=s,c=o);var u=t-s/2,f=a+u,d=l+u,A=c+u;return n(f,d,A)}var Cae={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"639",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"};function _Ne(i){if(typeof i!="string")return i;var e=i.toLowerCase();return Cae[e]?"#"+Cae[e]:i}var xNe=/^#[a-fA-F0-9]{6}$/,yNe=/^#[a-fA-F0-9]{8}$/,bNe=/^#[a-fA-F0-9]{3}$/,wNe=/^#[a-fA-F0-9]{4}$/,iG=/^rgb\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*\)$/i,SNe=/^rgb(?:a)?\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i,TNe=/^hsl\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i,ENe=/^hsl(?:a)?\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i;function Dm(i){if(typeof i!="string")throw new Nl(3);var e=_Ne(i);if(e.match(xNe))return{red:parseInt(""+e[1]+e[2],16),green:parseInt(""+e[3]+e[4],16),blue:parseInt(""+e[5]+e[6],16)};if(e.match(yNe)){var t=parseFloat((parseInt(""+e[7]+e[8],16)/255).toFixed(2));return{red:parseInt(""+e[1]+e[2],16),green:parseInt(""+e[3]+e[4],16),blue:parseInt(""+e[5]+e[6],16),alpha:t}}if(e.match(bNe))return{red:parseInt(""+e[1]+e[1],16),green:parseInt(""+e[2]+e[2],16),blue:parseInt(""+e[3]+e[3],16)};if(e.match(wNe)){var n=parseFloat((parseInt(""+e[4]+e[4],16)/255).toFixed(2));return{red:parseInt(""+e[1]+e[1],16),green:parseInt(""+e[2]+e[2],16),blue:parseInt(""+e[3]+e[3],16),alpha:n}}var r=iG.exec(e);if(r)return{red:parseInt(""+r[1],10),green:parseInt(""+r[2],10),blue:parseInt(""+r[3],10)};var s=SNe.exec(e.substring(0,50));if(s)return{red:parseInt(""+s[1],10),green:parseInt(""+s[2],10),blue:parseInt(""+s[3],10),alpha:parseFloat(""+s[4])>1?parseFloat(""+s[4])/100:parseFloat(""+s[4])};var o=TNe.exec(e);if(o){var a=parseInt(""+o[1],10),l=parseInt(""+o[2],10)/100,c=parseInt(""+o[3],10)/100,u="rgb("+XS(a,l,c)+")",f=iG.exec(u);if(!f)throw new Nl(4,e,u);return{red:parseInt(""+f[1],10),green:parseInt(""+f[2],10),blue:parseInt(""+f[3],10)}}var d=ENe.exec(e.substring(0,50));if(d){var A=parseInt(""+d[1],10),y=parseInt(""+d[2],10)/100,w=parseInt(""+d[3],10)/100,S="rgb("+XS(A,y,w)+")",T=iG.exec(S);if(!T)throw new Nl(4,e,S);return{red:parseInt(""+T[1],10),green:parseInt(""+T[2],10),blue:parseInt(""+T[3],10),alpha:parseFloat(""+d[4])>1?parseFloat(""+d[4])/100:parseFloat(""+d[4])}}throw new Nl(5)}function MNe(i){var e=i.red/255,t=i.green/255,n=i.blue/255,r=Math.max(e,t,n),s=Math.min(e,t,n),o=(r+s)/2;if(r===s)return i.alpha!==void 0?{hue:0,saturation:0,lightness:o,alpha:i.alpha}:{hue:0,saturation:0,lightness:o};var a,l=r-s,c=o>.5?l/(2-r-s):l/(r+s);switch(r){case e:a=(t-n)/l+(t<n?6:0);break;case t:a=(n-e)/l+2;break;default:a=(e-t)/l+4;break}return a*=60,i.alpha!==void 0?{hue:a,saturation:c,lightness:o,alpha:i.alpha}:{hue:a,saturation:c,lightness:o}}function Nm(i){return MNe(Dm(i))}var CNe=function(e){return e.length===7&&e[1]===e[2]&&e[3]===e[4]&&e[5]===e[6]?"#"+e[1]+e[3]+e[5]:e},sG=CNe;function v1(i){var e=i.toString(16);return e.length===1?"0"+e:e}function rG(i){return v1(Math.round(i*255))}function RNe(i,e,t){return sG("#"+rG(i)+rG(e)+rG(t))}function _P(i,e,t){return XS(i,e,t,RNe)}function INe(i,e,t){if(typeof i=="number"&&typeof e=="number"&&typeof t=="number")return _P(i,e,t);if(typeof i=="object"&&e===void 0&&t===void 0)return _P(i.hue,i.saturation,i.lightness);throw new Nl(1)}function PNe(i,e,t,n){if(typeof i=="number"&&typeof e=="number"&&typeof t=="number"&&typeof n=="number")return n>=1?_P(i,e,t):"rgba("+XS(i,e,t)+","+n+")";if(typeof i=="object"&&e===void 0&&t===void 0&&n===void 0)return i.alpha>=1?_P(i.hue,i.saturation,i.lightness):"rgba("+XS(i.hue,i.saturation,i.lightness)+","+i.alpha+")";throw new Nl(2)}function oG(i,e,t){if(typeof i=="number"&&typeof e=="number"&&typeof t=="number")return sG("#"+v1(i)+v1(e)+v1(t));if(typeof i=="object"&&e===void 0&&t===void 0)return sG("#"+v1(i.red)+v1(i.green)+v1(i.blue));throw new Nl(6)}function xP(i,e,t,n){if(typeof i=="string"&&typeof e=="number"){var r=Dm(i);return"rgba("+r.red+","+r.green+","+r.blue+","+e+")"}else{if(typeof i=="number"&&typeof e=="number"&&typeof t=="number"&&typeof n=="number")return n>=1?oG(i,e,t):"rgba("+i+","+e+","+t+","+n+")";if(typeof i=="object"&&e===void 0&&t===void 0&&n===void 0)return i.alpha>=1?oG(i.red,i.green,i.blue):"rgba("+i.red+","+i.green+","+i.blue+","+i.alpha+")"}throw new Nl(7)}var LNe=function(e){return typeof e.red=="number"&&typeof e.green=="number"&&typeof e.blue=="number"&&(typeof e.alpha!="number"||typeof e.alpha>"u")},DNe=function(e){return typeof e.red=="number"&&typeof e.green=="number"&&typeof e.blue=="number"&&typeof e.alpha=="number"},NNe=function(e){return typeof e.hue=="number"&&typeof e.saturation=="number"&&typeof e.lightness=="number"&&(typeof e.alpha!="number"||typeof e.alpha>"u")},FNe=function(e){return typeof e.hue=="number"&&typeof e.saturation=="number"&&typeof e.lightness=="number"&&typeof e.alpha=="number"};function Fm(i){if(typeof i!="object")throw new Nl(8);if(DNe(i))return xP(i);if(LNe(i))return oG(i);if(FNe(i))return PNe(i);if(NNe(i))return INe(i);throw new Nl(8)}function Iae(i,e,t){return function(){var r=t.concat(Array.prototype.slice.call(arguments));return r.length>=e?i.apply(this,r):Iae(i,e,r)}}function gc(i){return Iae(i,i.length,[])}function BNe(i,e){if(e==="transparent")return e;var t=Nm(e);return Fm(il({},t,{hue:t.hue+parseFloat(i)}))}var H_t=gc(BNe);function Bx(i,e,t){return Math.max(i,Math.min(e,t))}function ONe(i,e){if(e==="transparent")return e;var t=Nm(e);return Fm(il({},t,{lightness:Bx(0,1,t.lightness-parseFloat(i))}))}var W_t=gc(ONe);function UNe(i,e){if(e==="transparent")return e;var t=Nm(e);return Fm(il({},t,{saturation:Bx(0,1,t.saturation-parseFloat(i))}))}var j_t=gc(UNe);function kNe(i,e){if(e==="transparent")return e;var t=Nm(e);return Fm(il({},t,{lightness:Bx(0,1,t.lightness+parseFloat(i))}))}var X_t=gc(kNe);function zNe(i,e,t){if(e==="transparent")return t;if(t==="transparent")return e;if(i===0)return t;var n=Dm(e),r=il({},n,{alpha:typeof n.alpha=="number"?n.alpha:1}),s=Dm(t),o=il({},s,{alpha:typeof s.alpha=="number"?s.alpha:1}),a=r.alpha-o.alpha,l=parseFloat(i)*2-1,c=l*a===-1?l:l+a,u=1+l*a,f=(c/u+1)/2,d=1-f,A={red:Math.floor(r.red*f+o.red*d),green:Math.floor(r.green*f+o.green*d),blue:Math.floor(r.blue*f+o.blue*d),alpha:r.alpha*parseFloat(i)+o.alpha*(1-parseFloat(i))};return xP(A)}var VNe=gc(zNe),Pae=VNe;function GNe(i,e){if(e==="transparent")return e;var t=Dm(e),n=typeof t.alpha=="number"?t.alpha:1,r=il({},t,{alpha:Bx(0,1,(n*100+parseFloat(i)*100)/100)});return xP(r)}var qNe=gc(GNe),Lae=qNe;function HNe(i,e){if(e==="transparent")return e;var t=Nm(e);return Fm(il({},t,{saturation:Bx(0,1,t.saturation+parseFloat(i))}))}var $_t=gc(HNe);function WNe(i,e){return e==="transparent"?e:Fm(il({},Nm(e),{hue:parseFloat(i)}))}var Y_t=gc(WNe);function jNe(i,e){return e==="transparent"?e:Fm(il({},Nm(e),{lightness:parseFloat(i)}))}var Z_t=gc(jNe);function XNe(i,e){return e==="transparent"?e:Fm(il({},Nm(e),{saturation:parseFloat(i)}))}var K_t=gc(XNe);function $Ne(i,e){return e==="transparent"?e:Pae(parseFloat(i),"rgb(0, 0, 0)",e)}var Q_t=gc($Ne);function YNe(i,e){return e==="transparent"?e:Pae(parseFloat(i),"rgb(255, 255, 255)",e)}var J_t=gc(YNe);function ZNe(i,e){if(e==="transparent")return e;var t=Dm(e),n=typeof t.alpha=="number"?t.alpha:1,r=il({},t,{alpha:Bx(0,1,+(n*100-parseFloat(i)*100).toFixed(2)/100)});return xP(r)}var ext=gc(ZNe);var yP="http://www.w3.org/1999/xhtml",aG={svg:"http://www.w3.org/2000/svg",xhtml:yP,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function bP(i){var e=i+="",t=e.indexOf(":");return t>=0&&(e=i.slice(0,t))!=="xmlns"&&(i=i.slice(t+1)),aG.hasOwnProperty(e)?{space:aG[e],local:i}:i}function KNe(i){return function(){var e=this.ownerDocument,t=this.namespaceURI;return t===yP&&e.documentElement.namespaceURI===yP?e.createElement(i):e.createElementNS(t,i)}}function QNe(i){return function(){return this.ownerDocument.createElementNS(i.space,i.local)}}function wP(i){var e=bP(i);return(e.local?QNe:KNe)(e)}function JNe(){}function SP(i){return i==null?JNe:function(){return this.querySelector(i)}}function Dae(i){typeof i!="function"&&(i=SP(i));for(var e=this._groups,t=e.length,n=new Array(t),r=0;r<t;++r)for(var s=e[r],o=s.length,a=n[r]=new Array(o),l,c,u=0;u<o;++u)(l=s[u])&&(c=i.call(l,l.__data__,u,s))&&("__data__"in l&&(c.__data__=l.__data__),a[u]=c);return new ys(n,this._parents)}function lG(i){return i==null?[]:Array.isArray(i)?i:Array.from(i)}function e5e(){return[]}function Nae(i){return i==null?e5e:function(){return this.querySelectorAll(i)}}function t5e(i){return function(){return lG(i.apply(this,arguments))}}function Fae(i){typeof i=="function"?i=t5e(i):i=Nae(i);for(var e=this._groups,t=e.length,n=[],r=[],s=0;s<t;++s)for(var o=e[s],a=o.length,l,c=0;c<a;++c)(l=o[c])&&(n.push(i.call(l,l.__data__,c,o)),r.push(l));return new ys(n,r)}function Bae(i){return function(){return this.matches(i)}}function TP(i){return function(e){return e.matches(i)}}var n5e=Array.prototype.find;function i5e(i){return function(){return n5e.call(this.children,i)}}function r5e(){return this.firstElementChild}function Oae(i){return this.select(i==null?r5e:i5e(typeof i=="function"?i:TP(i)))}var s5e=Array.prototype.filter;function o5e(){return Array.from(this.children)}function a5e(i){return function(){return s5e.call(this.children,i)}}function Uae(i){return this.selectAll(i==null?o5e:a5e(typeof i=="function"?i:TP(i)))}function kae(i){typeof i!="function"&&(i=Bae(i));for(var e=this._groups,t=e.length,n=new Array(t),r=0;r<t;++r)for(var s=e[r],o=s.length,a=n[r]=[],l,c=0;c<o;++c)(l=s[c])&&i.call(l,l.__data__,c,s)&&a.push(l);return new ys(n,this._parents)}function EP(i){return new Array(i.length)}function zae(){return new ys(this._enter||this._groups.map(EP),this._parents)}function $S(i,e){this.ownerDocument=i.ownerDocument,this.namespaceURI=i.namespaceURI,this._next=null,this._parent=i,this.__data__=e}$S.prototype={constructor:$S,appendChild:function(i){return this._parent.insertBefore(i,this._next)},insertBefore:function(i,e){return this._parent.insertBefore(i,e)},querySelector:function(i){return this._parent.querySelector(i)},querySelectorAll:function(i){return this._parent.querySelectorAll(i)}};function Vae(i){return function(){return i}}function l5e(i,e,t,n,r,s){for(var o=0,a,l=e.length,c=s.length;o<c;++o)(a=e[o])?(a.__data__=s[o],n[o]=a):t[o]=new $S(i,s[o]);for(;o<l;++o)(a=e[o])&&(r[o]=a)}function c5e(i,e,t,n,r,s,o){var a,l,c=new Map,u=e.length,f=s.length,d=new Array(u),A;for(a=0;a<u;++a)(l=e[a])&&(d[a]=A=o.call(l,l.__data__,a,e)+"",c.has(A)?r[a]=l:c.set(A,l));for(a=0;a<f;++a)A=o.call(i,s[a],a,s)+"",(l=c.get(A))?(n[a]=l,l.__data__=s[a],c.delete(A)):t[a]=new $S(i,s[a]);for(a=0;a<u;++a)(l=e[a])&&c.get(d[a])===l&&(r[a]=l)}function u5e(i){return i.__data__}function Gae(i,e){if(!arguments.length)return Array.from(this,u5e);var t=e?c5e:l5e,n=this._parents,r=this._groups;typeof i!="function"&&(i=Vae(i));for(var s=r.length,o=new Array(s),a=new Array(s),l=new Array(s),c=0;c<s;++c){var u=n[c],f=r[c],d=f.length,A=h5e(i.call(u,u&&u.__data__,c,n)),y=A.length,w=a[c]=new Array(y),S=o[c]=new Array(y),T=l[c]=new Array(d);t(u,f,w,S,T,A,e);for(var R=0,P=0,I,F;R<y;++R)if(I=w[R]){for(R>=P&&(P=R+1);!(F=S[P])&&++P<y;);I._next=F||null}}return o=new ys(o,n),o._enter=a,o._exit=l,o}function h5e(i){return typeof i=="object"&&"length"in i?i:Array.from(i)}function qae(){return new ys(this._exit||this._groups.map(EP),this._parents)}function Hae(i,e,t){var n=this.enter(),r=this,s=this.exit();return typeof i=="function"?(n=i(n),n&&(n=n.selection())):n=n.append(i+""),e!=null&&(r=e(r),r&&(r=r.selection())),t==null?s.remove():t(s),n&&r?n.merge(r).order():r}function Wae(i){for(var e=i.selection?i.selection():i,t=this._groups,n=e._groups,r=t.length,s=n.length,o=Math.min(r,s),a=new Array(r),l=0;l<o;++l)for(var c=t[l],u=n[l],f=c.length,d=a[l]=new Array(f),A,y=0;y<f;++y)(A=c[y]||u[y])&&(d[y]=A);for(;l<r;++l)a[l]=t[l];return new ys(a,this._parents)}function jae(){for(var i=this._groups,e=-1,t=i.length;++e<t;)for(var n=i[e],r=n.length-1,s=n[r],o;--r>=0;)(o=n[r])&&(s&&o.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(o,s),s=o);return this}function Xae(i){i||(i=f5e);function e(f,d){return f&&d?i(f.__data__,d.__data__):!f-!d}for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s){for(var o=t[s],a=o.length,l=r[s]=new Array(a),c,u=0;u<a;++u)(c=o[u])&&(l[u]=c);l.sort(e)}return new ys(r,this._parents).order()}function f5e(i,e){return i<e?-1:i>e?1:i>=e?0:NaN}function $ae(){var i=arguments[0];return arguments[0]=this,i.apply(null,arguments),this}function Yae(){return Array.from(this)}function Zae(){for(var i=this._groups,e=0,t=i.length;e<t;++e)for(var n=i[e],r=0,s=n.length;r<s;++r){var o=n[r];if(o)return o}return null}function Kae(){let i=0;for(let e of this)++i;return i}function Qae(){return!this.node()}function Jae(i){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],s=0,o=r.length,a;s<o;++s)(a=r[s])&&i.call(a,a.__data__,s,r);return this}function d5e(i){return function(){this.removeAttribute(i)}}function p5e(i){return function(){this.removeAttributeNS(i.space,i.local)}}function m5e(i,e){return function(){this.setAttribute(i,e)}}function A5e(i,e){return function(){this.setAttributeNS(i.space,i.local,e)}}function g5e(i,e){return function(){var t=e.apply(this,arguments);t==null?this.removeAttribute(i):this.setAttribute(i,t)}}function v5e(i,e){return function(){var t=e.apply(this,arguments);t==null?this.removeAttributeNS(i.space,i.local):this.setAttributeNS(i.space,i.local,t)}}function ele(i,e){var t=bP(i);if(arguments.length<2){var n=this.node();return t.local?n.getAttributeNS(t.space,t.local):n.getAttribute(t)}return this.each((e==null?t.local?p5e:d5e:typeof e=="function"?t.local?v5e:g5e:t.local?A5e:m5e)(t,e))}function MP(i){return i.ownerDocument&&i.ownerDocument.defaultView||i.document&&i||i.defaultView}function _5e(i){return function(){this.style.removeProperty(i)}}function x5e(i,e,t){return function(){this.style.setProperty(i,e,t)}}function y5e(i,e,t){return function(){var n=e.apply(this,arguments);n==null?this.style.removeProperty(i):this.style.setProperty(i,n,t)}}function tle(i,e,t){return arguments.length>1?this.each((e==null?_5e:typeof e=="function"?y5e:x5e)(i,e,t??"")):b5e(this.node(),i)}function b5e(i,e){return i.style.getPropertyValue(e)||MP(i).getComputedStyle(i,null).getPropertyValue(e)}function w5e(i){return function(){delete this[i]}}function S5e(i,e){return function(){this[i]=e}}function T5e(i,e){return function(){var t=e.apply(this,arguments);t==null?delete this[i]:this[i]=t}}function nle(i,e){return arguments.length>1?this.each((e==null?w5e:typeof e=="function"?T5e:S5e)(i,e)):this.node()[i]}function ile(i){return i.trim().split(/^|\s+/)}function cG(i){return i.classList||new rle(i)}function rle(i){this._node=i,this._names=ile(i.getAttribute("class")||"")}rle.prototype={add:function(i){var e=this._names.indexOf(i);e<0&&(this._names.push(i),this._node.setAttribute("class",this._names.join(" ")))},remove:function(i){var e=this._names.indexOf(i);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(i){return this._names.indexOf(i)>=0}};function sle(i,e){for(var t=cG(i),n=-1,r=e.length;++n<r;)t.add(e[n])}function ole(i,e){for(var t=cG(i),n=-1,r=e.length;++n<r;)t.remove(e[n])}function E5e(i){return function(){sle(this,i)}}function M5e(i){return function(){ole(this,i)}}function C5e(i,e){return function(){(e.apply(this,arguments)?sle:ole)(this,i)}}function ale(i,e){var t=ile(i+"");if(arguments.length<2){for(var n=cG(this.node()),r=-1,s=t.length;++r<s;)if(!n.contains(t[r]))return!1;return!0}return this.each((typeof e=="function"?C5e:e?E5e:M5e)(t,e))}function R5e(){this.textContent=""}function I5e(i){return function(){this.textContent=i}}function P5e(i){return function(){var e=i.apply(this,arguments);this.textContent=e??""}}function lle(i){return arguments.length?this.each(i==null?R5e:(typeof i=="function"?P5e:I5e)(i)):this.node().textContent}function L5e(){this.innerHTML=""}function D5e(i){return function(){this.innerHTML=i}}function N5e(i){return function(){var e=i.apply(this,arguments);this.innerHTML=e??""}}function cle(i){return arguments.length?this.each(i==null?L5e:(typeof i=="function"?N5e:D5e)(i)):this.node().innerHTML}function F5e(){this.nextSibling&&this.parentNode.appendChild(this)}function ule(){return this.each(F5e)}function B5e(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function hle(){return this.each(B5e)}function fle(i){var e=typeof i=="function"?i:wP(i);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function O5e(){return null}function dle(i,e){var t=typeof i=="function"?i:wP(i),n=e==null?O5e:typeof e=="function"?e:SP(e);return this.select(function(){return this.insertBefore(t.apply(this,arguments),n.apply(this,arguments)||null)})}function U5e(){var i=this.parentNode;i&&i.removeChild(this)}function ple(){return this.each(U5e)}function k5e(){var i=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(i,this.nextSibling):i}function z5e(){var i=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(i,this.nextSibling):i}function mle(i){return this.select(i?z5e:k5e)}function Ale(i){return arguments.length?this.property("__data__",i):this.node().__data__}function V5e(i){return function(e){i.call(this,e,this.__data__)}}function G5e(i){return i.trim().split(/^|\s+/).map(function(e){var t="",n=e.indexOf(".");return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function q5e(i){return function(){var e=this.__on;if(e){for(var t=0,n=-1,r=e.length,s;t<r;++t)s=e[t],(!i.type||s.type===i.type)&&s.name===i.name?this.removeEventListener(s.type,s.listener,s.options):e[++n]=s;++n?e.length=n:delete this.__on}}}function H5e(i,e,t){return function(){var n=this.__on,r,s=V5e(e);if(n){for(var o=0,a=n.length;o<a;++o)if((r=n[o]).type===i.type&&r.name===i.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=s,r.options=t),r.value=e;return}}this.addEventListener(i.type,s,t),r={type:i.type,name:i.name,value:e,listener:s,options:t},n?n.push(r):this.__on=[r]}}function gle(i,e,t){var n=G5e(i+""),r,s=n.length,o;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,c=a.length,u;l<c;++l)for(r=0,u=a[l];r<s;++r)if((o=n[r]).type===u.type&&o.name===u.name)return u.value}return}for(a=e?H5e:q5e,r=0;r<s;++r)this.each(a(n[r],e,t));return this}function vle(i,e,t){var n=MP(i),r=n.CustomEvent;typeof r=="function"?r=new r(e,t):(r=n.document.createEvent("Event"),t?(r.initEvent(e,t.bubbles,t.cancelable),r.detail=t.detail):r.initEvent(e,!1,!1)),i.dispatchEvent(r)}function W5e(i,e){return function(){return vle(this,i,e)}}function j5e(i,e){return function(){return vle(this,i,e.apply(this,arguments))}}function _le(i,e){return this.each((typeof e=="function"?j5e:W5e)(i,e))}function*xle(){for(var i=this._groups,e=0,t=i.length;e<t;++e)for(var n=i[e],r=0,s=n.length,o;r<s;++r)(o=n[r])&&(yield o)}var uG=[null];function ys(i,e){this._groups=i,this._parents=e}function X5e(){return new ys([[document.documentElement]],uG)}function $5e(){return this}ys.prototype=X5e.prototype={constructor:ys,select:Dae,selectAll:Fae,selectChild:Oae,selectChildren:Uae,filter:kae,data:Gae,enter:zae,exit:qae,join:Hae,merge:Wae,selection:$5e,order:jae,sort:Xae,call:$ae,nodes:Yae,node:Zae,size:Kae,empty:Qae,each:Jae,attr:ele,style:tle,property:nle,classed:ale,text:lle,html:cle,raise:ule,lower:hle,append:fle,insert:dle,remove:ple,clone:mle,datum:Ale,on:gle,dispatch:_le,[Symbol.iterator]:xle};function hG(i){return typeof i=="string"?new ys([[document.querySelector(i)]],[document.documentElement]):new ys([[i]],uG)}function yle(i){let e;for(;e=i.sourceEvent;)i=e;return i}function fG(i,e){if(i=yle(i),e===void 0&&(e=i.currentTarget),e){var t=e.ownerSVGElement||e;if(t.createSVGPoint){var n=t.createSVGPoint();return n.x=i.clientX,n.y=i.clientY,n=n.matrixTransform(e.getScreenCTM().inverse()),[n.x,n.y]}if(e.getBoundingClientRect){var r=e.getBoundingClientRect();return[i.clientX-r.left-e.clientLeft,i.clientY-r.top-e.clientTop]}}return[i.pageX,i.pageY]}var KS,Vr,Ele,AG,Bm,ble,Mle,Cle,dG,RP,YS,Rle,gG,pG,mG,Y5e,PP={},LP=[],Z5e=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,NP=Array.isArray;function kf(i,e){for(var t in e)i[t]=e[t];return i}function vG(i){i&&i.parentNode&&i.parentNode.removeChild(i)}function K5e(i,e,t){var n,r,s,o={};for(s in e)s=="key"?n=e[s]:s=="ref"?r=e[s]:o[s]=e[s];if(arguments.length>2&&(o.children=arguments.length>3?KS.call(arguments,2):t),typeof i=="function"&&i.defaultProps!=null)for(s in i.defaultProps)o[s]===void 0&&(o[s]=i.defaultProps[s]);return ZS(i,o,n,r,null)}function ZS(i,e,t,n,r){var s={type:i,props:e,key:t,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r??++Ele,__i:-1,__u:0};return r==null&&Vr.vnode!=null&&Vr.vnode(s),s}function FP(i){return i.children}function IP(i,e){this.props=i,this.context=e}function _1(i,e){if(e==null)return i.__?_1(i.__,i.__i+1):null;for(var t;e<i.__k.length;e++)if((t=i.__k[e])!=null&&t.__e!=null)return t.__e;return typeof i.type=="function"?_1(i):null}function Q5e(i){if(i.__P&&i.__d){var e=i.__v,t=e.__e,n=[],r=[],s=kf({},e);s.__v=e.__v+1,Vr.vnode&&Vr.vnode(s),_G(i.__P,s,e,i.__n,i.__P.namespaceURI,32&e.__u?[t]:null,n,t??_1(e),!!(32&e.__u),r),s.__v=e.__v,s.__.__k[s.__i]=s,Nle(n,s,r),e.__e=e.__=null,s.__e!=t&&Ile(s)}}function Ile(i){if((i=i.__)!=null&&i.__c!=null)return i.__e=i.__c.base=null,i.__k.some(function(e){if(e!=null&&e.__e!=null)return i.__e=i.__c.base=e.__e}),Ile(i)}function wle(i){(!i.__d&&(i.__d=!0)&&Bm.push(i)&&!DP.__r++||ble!=Vr.debounceRendering)&&((ble=Vr.debounceRendering)||Mle)(DP)}function DP(){try{for(var i,e=1;Bm.length;)Bm.length>e&&Bm.sort(Cle),i=Bm.shift(),e=Bm.length,Q5e(i)}finally{Bm.length=DP.__r=0}}function Ple(i,e,t,n,r,s,o,a,l,c,u){var f,d,A,y,w,S,T=n&&n.__k||LP,R=e.length;for(l=J5e(t,e,T,l,R),f=0;f<R;f++)(A=t.__k[f])!=null&&(d=A.__i!=-1&&T[A.__i]||PP,A.__i=f,S=_G(i,A,d,r,s,o,a,l,c,u),y=A.__e,A.ref&&d.ref!=A.ref&&(d.ref&&xG(d.ref,null,A),u.push(A.ref,A.__c||y,A)),w==null&&y!=null&&(w=y),4&A.__u?(l=Lle(A,l,i),d.__e&&(d.__e=null)):typeof A.type=="function"&&S!==void 0?l=S:y&&(l=y.nextSibling),A.__u&=-7);return t.__e=w,l}function J5e(i,e,t,n,r){var s,o,a,l,c,u=t.length,f=u,d=0;for(i.__k=new Array(r),s=0;s<r;s++)(o=e[s])!=null&&typeof o!="boolean"&&typeof o!="function"?(typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?o=i.__k[s]=ZS(null,o,null,null,null):NP(o)?o=i.__k[s]=ZS(FP,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=i.__k[s]=ZS(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):i.__k[s]=o,l=s+d,o.__=i,o.__b=i.__b+1,a=null,(c=o.__i=e6e(o,t,l,f))!=-1&&(f--,(a=t[c])&&(a.__u|=2)),a==null||a.__v==null?(c==-1&&(r>u?d--:r<u&&d++),typeof o.type!="function"&&(o.__u|=4)):c!=l&&(c==l-1?d--:c==l+1?d++:(c>l?d--:d++,o.__u|=4))):i.__k[s]=null;if(f)for(s=0;s<u;s++)(a=t[s])!=null&&(2&a.__u)==0&&(a.__e==n&&(n=_1(a)),Ble(a,a));return n}function Lle(i,e,t){var n,r;if(typeof i.type=="function"){for(n=i.__k,r=0;n&&r<n.length;r++)n[r]&&(n[r].__=i,e=Lle(n[r],e,t));return e}i.__e!=e&&(e&&i.type&&!e.parentNode&&(e=_1(i)),e=t.insertBefore(i.__e,e||null));do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function e6e(i,e,t,n){var r,s,o,a=i.key,l=i.type,c=e[t],u=c!=null&&(2&c.__u)==0;if(c===null&&a==null||u&&a==c.key&&l==c.type)return t;if(n>(u?1:0)){for(r=t-1,s=t+1;r>=0||s<e.length;)if((c=e[o=r>=0?r--:s++])!=null&&(2&c.__u)==0&&a==c.key&&l==c.type)return o}return-1}function Sle(i,e,t){e[0]=="-"?i.setProperty(e,t??""):i[e]=t==null?"":typeof t!="number"||Z5e.test(e)?t:t+"px"}function CP(i,e,t,n,r){var s,o;e:if(e=="style")if(typeof t=="string")i.style.cssText=t;else{if(typeof n=="string"&&(i.style.cssText=n=""),n)for(e in n)t&&e in t||Sle(i.style,e,"");if(t)for(e in t)n&&t[e]==n[e]||Sle(i.style,e,t[e])}else if(e[0]=="o"&&e[1]=="n")s=e!=(e=e.replace(Rle,"$1")),o=e.toLowerCase(),e=o in i||e=="onFocusOut"||e=="onFocusIn"?o.slice(2):e.slice(2),i.l||(i.l={}),i.l[e+s]=t,t?n?t[YS]=n[YS]:(t[YS]=gG,i.addEventListener(e,s?mG:pG,s)):i.removeEventListener(e,s?mG:pG,s);else{if(r=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in i)try{i[e]=t??"";break e}catch{}typeof t=="function"||(t==null||t===!1&&e[4]!="-"?i.removeAttribute(e):i.setAttribute(e,e=="popover"&&t==1?"":t))}}function Tle(i){return function(e){if(this.l){var t=this.l[e.type+i];if(e[RP]==null)e[RP]=gG++;else if(e[RP]<t[YS])return;return t(Vr.event?Vr.event(e):e)}}}function _G(i,e,t,n,r,s,o,a,l,c){var u,f,d,A,y,w,S,T,R,P,I,F,D,L,C,B,k=e.type;if(e.constructor!==void 0)return null;128&t.__u&&(l=!!(32&t.__u),s=[a=e.__e=t.__e]),(u=Vr.__b)&&u(e);e:if(typeof k=="function"){f=o.length;try{if(R=e.props,P=k.prototype&&k.prototype.render,I=(u=k.contextType)&&n[u.__c],F=u?I?I.props.value:u.__:n,t.__c?T=(d=e.__c=t.__c).__=d.__E:(P?e.__c=d=new k(R,F):(e.__c=d=new IP(R,F),d.constructor=k,d.render=n6e),I&&I.sub(d),d.state||(d.state={}),d.__n=n,A=d.__d=!0,d.__h=[],d._sb=[]),P&&d.__s==null&&(d.__s=d.state),P&&k.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=kf({},d.__s)),kf(d.__s,k.getDerivedStateFromProps(R,d.__s))),y=d.props,w=d.state,d.__v=e,A)P&&k.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),P&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(P&&k.getDerivedStateFromProps==null&&R!==y&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(R,F),e.__v==t.__v||!d.__e&&d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(R,d.__s,F)===!1){e.__v!=t.__v&&(d.props=R,d.state=d.__s,d.__d=!1),e.__e=t.__e,e.__k=t.__k,e.__k.some(function(z){z&&(z.__=e)}),LP.push.apply(d.__h,d._sb),d._sb=[],d.__h.length&&o.push(d),a=_1(t);break e}d.componentWillUpdate!=null&&d.componentWillUpdate(R,d.__s,F),P&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(y,w,S)})}if(d.context=F,d.props=R,d.__P=i,d.__e=!1,D=Vr.__r,L=0,P)d.state=d.__s,d.__d=!1,D&&D(e),u=d.render(d.props,d.state,d.context),LP.push.apply(d.__h,d._sb),d._sb=[];else do d.__d=!1,D&&D(e),u=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++L<25);d.state=d.__s,d.getChildContext!=null&&(n=kf(kf({},n),d.getChildContext())),P&&!A&&d.getSnapshotBeforeUpdate!=null&&(S=d.getSnapshotBeforeUpdate(y,w)),C=u!=null&&u.type===FP&&u.key==null?Fle(u.props.children):u,a=Ple(i,NP(C)?C:[C],e,t,n,r,s,o,a,l,c),d.base=e.__e,e.__u&=-161,d.__h.length&&o.push(d),T&&(d.__E=d.__=null)}catch(z){if(o.length=f,e.__v=null,l||s!=null){if(z.then){for(e.__u|=l?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;s!=null&&(s[s.indexOf(a)]=null),e.__e=a}else if(s!=null)for(B=s.length;B--;)vG(s[B])}else e.__e=t.__e;e.__k==null&&(e.__k=t.__k||[]),z.then||Dle(e),Vr.__e(z,e,t)}}else s==null&&e.__v==t.__v?(e.__k=t.__k,e.__e=t.__e):a=e.__e=t6e(t.__e,e,t,n,r,s,o,l,c);return(u=Vr.diffed)&&u(e),128&e.__u?void 0:a}function Dle(i){i&&(i.__c&&(i.__c.__e=!0),i.__k&&i.__k.some(Dle))}function Nle(i,e,t){for(var n=0;n<t.length;n++)xG(t[n],t[++n],t[++n]);Vr.__c&&Vr.__c(e,i),i.some(function(r){try{i=r.__h,r.__h=[],i.some(function(s){s.call(r)})}catch(s){Vr.__e(s,r.__v)}})}function Fle(i){return typeof i!="object"||i==null||i.__b>0?i:NP(i)?i.map(Fle):i.constructor!==void 0?null:kf({},i)}function t6e(i,e,t,n,r,s,o,a,l){var c,u,f,d,A,y,w,S=t.props||PP,T=e.props,R=e.type;if(R=="svg"?r="http://www.w3.org/2000/svg":R=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),s!=null){for(c=0;c<s.length;c++)if((A=s[c])&&"setAttribute"in A==!!R&&(R?A.localName==R:A.nodeType==3)){i=A,s[c]=null;break}}if(i==null){if(R==null)return document.createTextNode(T);i=document.createElementNS(r,R,T.is&&T),a&&(Vr.__m&&Vr.__m(e,s),a=!1),s=null}if(R==null)S===T||a&&i.data==T||(i.data=T);else{if(s=R=="textarea"&&T.defaultValue!=null?null:s&&KS.call(i.childNodes),!a&&s!=null)for(S={},c=0;c<i.attributes.length;c++)S[(A=i.attributes[c]).name]=A.value;for(c in S)A=S[c],c=="dangerouslySetInnerHTML"?f=A:c=="children"||c in T||c=="value"&&"defaultValue"in T||c=="checked"&&"defaultChecked"in T||CP(i,c,null,A,r);for(c in T)A=T[c],c=="children"?d=A:c=="dangerouslySetInnerHTML"?u=A:c=="value"?y=A:c=="checked"?w=A:a&&typeof A!="function"||S[c]===A||CP(i,c,A,S[c],r);if(u)a||f&&(u.__html==f.__html||u.__html==i.innerHTML)||(i.innerHTML=u.__html),e.__k=[];else if(f&&(i.innerHTML=""),Ple(e.type=="template"?i.content:i,NP(d)?d:[d],e,t,n,R=="foreignObject"?"http://www.w3.org/1999/xhtml":r,s,o,s?s[0]:t.__k&&_1(t,0),a,l),s!=null)for(c=s.length;c--;)vG(s[c]);a&&R!="textarea"||(c="value",R=="progress"&&y==null?i.removeAttribute("value"):y!=null&&(y!==i[c]||R=="progress"&&!y||R=="option"&&y!=S[c])&&CP(i,c,y,S[c],r),c="checked",w!=null&&w!=i[c]&&CP(i,c,w,S[c],r))}return i}function xG(i,e,t){try{if(typeof i=="function"){var n=typeof i.__u=="function";n&&i.__u(),n&&e==null||(i.__u=i(e))}else i.current=e}catch(r){Vr.__e(r,t)}}function Ble(i,e,t){var n,r;if(Vr.unmount&&Vr.unmount(i),(n=i.ref)&&(n.current&&n.current!=i.__e||xG(n,null,e)),(n=i.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(s){Vr.__e(s,e)}n.base=n.__P=n.__n=null}if(n=i.__k)for(r=0;r<n.length;r++)n[r]&&Ble(n[r],e,t||typeof i.type!="function");t||vG(i.__e),i.__c=i.__=i.__e=void 0}function n6e(i,e,t){return this.constructor(i,t)}function Ole(i,e,t){var n,r,s,o;e==document&&(e=document.documentElement),Vr.__&&Vr.__(i,e),r=(n=typeof t=="function")?null:t&&t.__k||e.__k,s=[],o=[],_G(e,i=(!n&&t||e).__k=K5e(FP,null,[i]),r||PP,PP,e.namespaceURI,!n&&t?[t]:r?null:e.firstChild?KS.call(e.childNodes):null,s,!n&&t?t:r?r.__e:e.firstChild,n,o),Nle(s,i,o),i.props.children=null}function yG(i,e,t){var n,r,s,o,a=kf({},i.props);for(s in i.type&&i.type.defaultProps&&(o=i.type.defaultProps),e)s=="key"?n=e[s]:s=="ref"?r=e[s]:a[s]=e[s]===void 0&&o!=null?o[s]:e[s];return arguments.length>2&&(a.children=arguments.length>3?KS.call(arguments,2):t),ZS(i.type,a,n||i.key,r||i.ref,null)}KS=LP.slice,Vr={__e:function(i,e,t,n){for(var r,s,o;e=e.__;)if((r=e.__c)&&!r.__)try{if((s=r.constructor)&&s.getDerivedStateFromError!=null&&(r.setState(s.getDerivedStateFromError(i)),o=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(i,n||{}),o=r.__d),o)return r.__E=r}catch(a){i=a}throw i}},Ele=0,AG=function(i){return i!=null&&i.constructor===void 0},IP.prototype.setState=function(i,e){var t;t=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=kf({},this.state),typeof i=="function"&&(i=i(kf({},t),this.props)),i&&kf(t,i),i!=null&&this.__v&&(e&&this._sb.push(e),wle(this))},IP.prototype.forceUpdate=function(i){this.__v&&(this.__e=!0,i&&this.__h.push(i),wle(this))},IP.prototype.render=FP,Bm=[],Mle=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Cle=function(i,e){return i.__v.__b-e.__v.__b},DP.__r=0,dG=Math.random().toString(8),RP="__d"+dG,YS="__a"+dG,Rle=/(PointerCapture)$|Capture$/i,gG=0,pG=Tle(!1),mG=Tle(!0),Y5e=0;function Ule(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function i6e(i){if(Array.isArray(i))return i}function r6e(i,e,t){return(e=u6e(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function s6e(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function o6e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.5259+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function kle(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function a6e(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?kle(Object(t),!0).forEach(function(n){r6e(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):kle(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function l6e(i,e){return i6e(i)||s6e(i,e)||h6e(i,e)||o6e()}function c6e(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function u6e(i){var e=c6e(i,"string");return typeof e=="symbol"?e:e+""}function BP(i){"@babel/helpers - typeof";return BP=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},BP(i)}function h6e(i,e){if(i){if(typeof i=="string")return Ule(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Ule(i,e):void 0}}var bG=function(e){if(BP(e)!=="object")return e;var t=yG(e);if(t.props){var n;t.props=a6e({},t.props),t!=null&&(n=t.props)!==null&&n!==void 0&&n.children&&(t.props.children=Array.isArray(t.props.children)?t.props.children.map(bG):bG(t.props.children))}return t},f6e=function(e){return AG(yG(e))},d6e=function(e,t){delete t.__k,Ole(bG(e),t)};function p6e(i,e){e===void 0&&(e={});var t=e.insertAt;if(!(typeof document>"u")){var n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=i:r.appendChild(document.createTextNode(i))}}var m6e=`.float-tooltip-kap {52605260 position: absolute;52615261 width: max-content; /* prevent shrinking near right edge */52625262 max-width: max(50%, 150px);@@ -5267,7 +5267,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
52675267 background: rgba(0,0,0,0.6);52685268 pointer-events: none;52695269 }5270-`;$5e(Y5e);var Ple=Kr({props:{content:{default:!1},offsetX:{triggerUpdate:!1},offsetY:{triggerUpdate:!1}},init:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=n.style,s=r===void 0?{}:r,o=!!e&&LP(e)==="object"&&!!e.node&&typeof e.node=="function",a=iG(o?e.node():e);a.style("position")==="static"&&a.style("position","relative"),t.tooltipEl=a.append("div").attr("class","float-tooltip-kap"),Object.entries(s).forEach(function(c){var u=G5e(c,2),f=u[0],d=u[1];return t.tooltipEl.style(f,d)}),t.tooltipEl.style("left","-10000px").style("display","none");var l="tooltip-".concat(Math.round(Math.random()*1e12));t.mouseInside=!1,a.on("mousemove.".concat(l),function(c){t.mouseInside=!0;var u=rG(c),f=a.node(),d=f.offsetWidth,A=f.offsetHeight,y=[t.offsetX===null||t.offsetX===void 0?"-".concat(u[0]/d*100,"%"):typeof t.offsetX=="number"?"calc(-50% + ".concat(t.offsetX,"px)"):t.offsetX,t.offsetY===null||t.offsetY===void 0?A>130&&A-u[1]<100?"calc(-100% - 6px)":"21px":typeof t.offsetY=="number"?t.offsetY<0?"calc(-100% - ".concat(Math.abs(t.offsetY),"px)"):"".concat(t.offsetY,"px"):t.offsetY];t.tooltipEl.style("left",u[0]+"px").style("top",u[1]+"px").style("transform","translate(".concat(y.join(","),")")),t.content&&t.tooltipEl.style("display","inline")}),a.on("mouseover.".concat(l),function(){t.mouseInside=!0,t.content&&t.tooltipEl.style("display","inline")}),a.on("mouseout.".concat(l),function(){t.mouseInside=!1,t.tooltipEl.style("display","none")})},update:function(e){e.tooltipEl.style("display",e.content&&e.mouseInside?"inline":"none"),e.content?e.content instanceof HTMLElement?(e.tooltipEl.text(""),e.tooltipEl.append(function(){return e.content})):typeof e.content=="string"?e.tooltipEl.html(e.content):j5e(e.content)?(e.tooltipEl.text(""),X5e(e.content,e.tooltipEl.node())):(e.tooltipEl.style("display","none"),console.warn("Tooltip content is invalid, skipping.",e.content,e.content.toString())):e.tooltipEl.text("")}});function Z5e(i,e){e===void 0&&(e={});var t=e.insertAt;if(!(typeof document>"u")){var n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=i:r.appendChild(document.createTextNode(i))}}var K5e=`.scene-nav-info {5270+`;p6e(m6e);var zle=Kr({props:{content:{default:!1},offsetX:{triggerUpdate:!1},offsetY:{triggerUpdate:!1}},init:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=n.style,s=r===void 0?{}:r,o=!!e&&BP(e)==="object"&&!!e.node&&typeof e.node=="function",a=hG(o?e.node():e);a.style("position")==="static"&&a.style("position","relative"),t.tooltipEl=a.append("div").attr("class","float-tooltip-kap"),Object.entries(s).forEach(function(c){var u=l6e(c,2),f=u[0],d=u[1];return t.tooltipEl.style(f,d)}),t.tooltipEl.style("left","-10000px").style("display","none");var l="tooltip-".concat(Math.round(Math.random()*1e12));t.mouseInside=!1,a.on("mousemove.".concat(l),function(c){t.mouseInside=!0;var u=fG(c),f=a.node(),d=f.offsetWidth,A=f.offsetHeight,y=[t.offsetX===null||t.offsetX===void 0?"-".concat(u[0]/d*100,"%"):typeof t.offsetX=="number"?"calc(-50% + ".concat(t.offsetX,"px)"):t.offsetX,t.offsetY===null||t.offsetY===void 0?A>130&&A-u[1]<100?"calc(-100% - 6px)":"21px":typeof t.offsetY=="number"?t.offsetY<0?"calc(-100% - ".concat(Math.abs(t.offsetY),"px)"):"".concat(t.offsetY,"px"):t.offsetY];t.tooltipEl.style("left",u[0]+"px").style("top",u[1]+"px").style("transform","translate(".concat(y.join(","),")")),t.content&&t.tooltipEl.style("display","inline")}),a.on("mouseover.".concat(l),function(){t.mouseInside=!0,t.content&&t.tooltipEl.style("display","inline")}),a.on("mouseout.".concat(l),function(){t.mouseInside=!1,t.tooltipEl.style("display","none")})},update:function(e){e.tooltipEl.style("display",e.content&&e.mouseInside?"inline":"none"),e.content?e.content instanceof HTMLElement?(e.tooltipEl.text(""),e.tooltipEl.append(function(){return e.content})):typeof e.content=="string"?e.tooltipEl.html(e.content):f6e(e.content)?(e.tooltipEl.text(""),d6e(e.content,e.tooltipEl.node())):(e.tooltipEl.style("display","none"),console.warn("Tooltip content is invalid, skipping.",e.content,e.content.toString())):e.tooltipEl.text("")}});function A6e(i,e){e===void 0&&(e={});var t=e.insertAt;if(!(typeof document>"u")){var n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=i:r.appendChild(document.createTextNode(i))}}var g6e=`.scene-nav-info {52715271 position: absolute;52725272 bottom: 5px;52735273 width: 100%;@@ -5282,9 +5282,9 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
52825282 52835283 .scene-container canvas:focus {52845284 outline: none;5285-}`;Z5e(K5e);function mG(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function Q5e(i){if(Array.isArray(i))return i}function J5e(i){if(Array.isArray(i))return mG(i)}function e6e(i,e,t){return(e=a6e(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function t6e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function n6e(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function i6e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.5286-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function r6e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.5287-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function s6e(i,e){return Q5e(i)||n6e(i,e)||Lle(i,e)||i6e()}function x1(i){return J5e(i)||t6e(i)||Lle(i)||r6e()}function o6e(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function a6e(i){var e=o6e(i,"string");return typeof e=="symbol"?e:e+""}function Lle(i,e){if(i){if(typeof i=="string")return mG(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?mG(i,e):void 0}}var Dle=function(e){e instanceof Array?e.forEach(Dle):(e.map&&e.map.dispose(),e.dispose())},Nle=function(e){e.geometry&&e.geometry.dispose(),e.material&&Dle(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(Nle)},l6e=function(e){for(;e.children.length;){var t=e.children[0];e.remove(t),Nle(t)}},Gr=window.THREE?window.THREE:{WebGLRenderer:qM,Scene:o0,PerspectiveCamera:$r,Raycaster:ab,SRGBColorSpace:Fr,TextureLoader:bl,Vector2:Oe,Vector3:re,Box3:Ua,Color:zt,Mesh:Hn,SphereGeometry:za,MeshBasicMaterial:fs,BackSide:mi,Timer:ng},AG=Kr({props:{width:{default:window.innerWidth,onChange:function(e,t,n){isNaN(e)&&(t.width=n)}},height:{default:window.innerHeight,onChange:function(e,t,n){isNaN(e)&&(t.height=n)}},viewOffset:{default:[0,0]},backgroundColor:{default:"#000011"},backgroundImageUrl:{},onBackgroundImageLoaded:{},showNavInfo:{default:!0},skyRadius:{default:5e4},objects:{default:[]},lights:{default:[]},enablePointerInteraction:{default:!0,onChange:function(e,t){t.hoverObj=null,t.tooltip&&t.tooltip.content(null)},triggerUpdate:!1},pointerRaycasterThrottleMs:{default:50,triggerUpdate:!1},lineHoverPrecision:{default:1,triggerUpdate:!1},pointsHoverPrecision:{default:1,triggerUpdate:!1},hoverOrderComparator:{triggerUpdate:!1},hoverFilter:{default:function(){return!0},triggerUpdate:!1},tooltipContent:{triggerUpdate:!1},hoverDuringDrag:{default:!1,triggerUpdate:!1},clickAfterDrag:{default:!1,triggerUpdate:!1},onHover:{default:function(){},triggerUpdate:!1},onClick:{default:function(){},triggerUpdate:!1},onRightClick:{triggerUpdate:!1}},methods:{tick:function(e){if(e.initialised){e.controls.enabled&&e.controls.update&&e.controls.update(Math.min(1,e.timer.update().getDelta())),e.postProcessingComposer?e.postProcessingComposer.render():e.renderer.render(e.scene,e.camera),e.extraRenderers.forEach(function(o){return o.render(e.scene,e.camera)});var t=+new Date;if(e.enablePointerInteraction&&t-e.lastRaycasterCheck>=e.pointerRaycasterThrottleMs){e.lastRaycasterCheck=t;var n=null;if(e.hoverDuringDrag||!e.isPointerDragging){var r=this.intersectingObjects(e.pointerPos.x,e.pointerPos.y);e.hoverOrderComparator&&r.sort(function(o,a){return e.hoverOrderComparator(o.object,a.object)});var s=r.find(function(o){return e.hoverFilter(o.object)})||null;n=s?s.object:null,e.intersection=s||null}n!==e.hoverObj&&(e.onHover(n,e.hoverObj,e.intersection),e.tooltip.content(n&&st(e.tooltipContent)(n,e.intersection)||null),e.hoverObj=n)}e.tweenGroup.update()}return this},getPointerPos:function(e){var t=e.pointerPos,n=t.x,r=t.y;return{x:n,y:r}},cameraPosition:function(e,t,n,r){var s=e.camera;if(t&&e.initialised){var o,a,l=t,c=n||{x:0,y:0,z:0};if((o=e.povPosTween)===null||o===void 0||o.end(),(a=e.povTgtTween)===null||a===void 0||a.end(),!r)d(l),A(c);else{var u=Object.assign({},s.position),f=y();e.tweenGroup.add(e.povPosTween=new uo(u).to(l,r).easing(Qr.Quadratic.Out).onUpdate(d).onComplete(function(){e.povPosTween=void 0,e.tweenGroup.remove(this)}).start()),e.tweenGroup.add(e.povTgtTween=new uo(f).to(c,r/3).easing(Qr.Quadratic.Out).onUpdate(A).onComplete(function(){e.povTgtTween=void 0,e.tweenGroup.remove(this)}).start())}return this}return Object.assign({},s.position,{lookAt:y()});function d(w){var S=w.x,T=w.y,R=w.z;S!==void 0&&(s.position.x=S),T!==void 0&&(s.position.y=T),R!==void 0&&(s.position.z=R)}function A(w){var S=new Gr.Vector3(w.x,w.y,w.z);e.controls.enabled&&e.controls.target?e.controls.target=S:s.lookAt(S)}function y(){return Object.assign(new Gr.Vector3(0,0,-1e3).applyQuaternion(s.quaternion).add(s.position))}},zoomToFit:function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:10,r=arguments.length,s=new Array(r>3?r-3:0),o=3;o<r;o++)s[o-3]=arguments[o];return this.fitToBbox(this.getBbox.apply(this,s),t,n)},fitToBbox:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:10,s=e.camera;if(t){var o=new Gr.Vector3(0,0,0),a=Math.max.apply(Math,x1(Object.entries(t).map(function(A){var y=s6e(A,2),w=y[0],S=y[1];return Math.max.apply(Math,x1(S.map(function(T){return Math.abs(o[w]-T)})))})))*2,l=(1-r*2/e.height)*s.fov,c=a/Math.atan(l*Math.PI/180),u=c/s.aspect,f=Math.max(c,u);if(f>0){var d=o.clone().sub(s.position).normalize().multiplyScalar(-f);this.cameraPosition(d,o,n)}}return this},getBbox:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){return!0},n=new Gr.Box3(new Gr.Vector3(0,0,0),new Gr.Vector3(0,0,0)),r=e.objects.filter(t);return r.length?(r.forEach(function(s){return n.expandByObject(s)}),Object.assign.apply(Object,x1(["x","y","z"].map(function(s){return e6e({},s,[n.min[s],n.max[s]])})))):null},getScreenCoords:function(e,t,n,r){var s=new Gr.Vector3(t,n,r);return s.project(this.camera()),{x:(s.x+1)*e.width/2,y:-(s.y-1)*e.height/2}},getSceneCoords:function(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,s=new Gr.Vector2(t/e.width*2-1,-(n/e.height)*2+1),o=new Gr.Raycaster;return o.setFromCamera(s,e.camera),Object.assign({},o.ray.at(r,new Gr.Vector3))},intersectingObjects:function(e,t,n){var r=new Gr.Vector2(t/e.width*2-1,-(n/e.height)*2+1),s=new Gr.Raycaster;return s.params.Line.threshold=e.lineHoverPrecision,s.params.Points.threshold=e.pointsHoverPrecision,s.setFromCamera(r,e.camera),s.intersectObjects(e.objects,!0)},renderer:function(e){return e.renderer},scene:function(e){return e.scene},camera:function(e){return e.camera},postProcessingComposer:function(e){return e.postProcessingComposer},controls:function(e){return e.controls},tbControls:function(e){return e.controls},_destructor:function(e){var t,n,r;l6e(e.scene),(t=e.controls)===null||t===void 0||t.dispose(),(n=e.renderer)===null||n===void 0||n.dispose(),(r=e.postProcessingComposer)===null||r===void 0||r.dispose()}},stateInit:function(){return{scene:new Gr.Scene,camera:new Gr.PerspectiveCamera,timer:new Gr.Timer,tweenGroup:new vg,lastRaycasterCheck:0}},init:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=n.controlType,s=r===void 0?"trackball":r,o=n.useWebGPU,a=o===void 0?!1:o,l=n.rendererConfig,c=l===void 0?{}:l,u=n.extraRenderers,f=u===void 0?[]:u,d=n.waitForLoadComplete,A=d===void 0?!0:d;e.innerHTML="",e.appendChild(t.container=document.createElement("div")),t.container.className="scene-container",t.container.style.position="relative",t.container.appendChild(t.navInfo=document.createElement("div")),t.navInfo.className="scene-nav-info",t.navInfo.textContent={orbit:"Left-click: rotate, Mouse-wheel/middle-click: zoom, Right-click: pan",trackball:"Left-click: rotate, Mouse-wheel/middle-click: zoom, Right-click: pan",fly:"WASD: move, R|F: up | down, Q|E: roll, up|down: pitch, left|right: yaw"}[s]||"",t.navInfo.style.display=t.showNavInfo?null:"none",t.tooltip=new Ple(t.container),t.pointerPos=new Gr.Vector2,t.pointerPos.x=-2,t.pointerPos.y=-2,["pointermove","pointerdown"].forEach(function(y){return t.container.addEventListener(y,function(w){if(y==="pointerdown"&&(t.isPointerPressed=!0),!t.isPointerDragging&&w.type==="pointermove"&&(w.pressure>0||t.isPointerPressed)&&(w.pointerType==="mouse"||w.movementX===void 0||[w.movementX,w.movementY].some(function(R){return Math.abs(R)>1}))&&(t.isPointerDragging=!0),t.enablePointerInteraction){var S=T(t.container);t.pointerPos.x=w.pageX-S.left,t.pointerPos.y=w.pageY-S.top}function T(R){var P=R.getBoundingClientRect(),I=window.pageXOffset||document.documentElement.scrollLeft,F=window.pageYOffset||document.documentElement.scrollTop;return{top:P.top+F,left:P.left+I}}},{passive:!0})}),t.container.addEventListener("pointerup",function(y){t.isPointerPressed&&(t.isPointerPressed=!1,!(t.isPointerDragging&&(t.isPointerDragging=!1,!t.clickAfterDrag))&&requestAnimationFrame(function(){y.button===0&&t.onClick(t.hoverObj||null,y,t.intersection),y.button===2&&t.onRightClick&&t.onRightClick(t.hoverObj||null,y,t.intersection)}))},{passive:!0,capture:!0}),t.container.addEventListener("contextmenu",function(y){t.onRightClick&&y.preventDefault()}),t.renderer=new(a?xx:Gr.WebGLRenderer)(Object.assign({antialias:!0,alpha:!0},c)),t.renderer.setPixelRatio(Math.min(2,window.devicePixelRatio)),t.container.appendChild(t.renderer.domElement),t.extraRenderers=f,t.extraRenderers.forEach(function(y){y.domElement.style.position="absolute",y.domElement.style.top="0px",y.domElement.style.pointerEvents="none",t.container.appendChild(y.domElement)}),t.postProcessingComposer=new hP(t.renderer),t.postProcessingComposer.addPass(new fP(t.scene,t.camera)),t.controls=new{trackball:rP,orbit:oP,fly:aP}[s](t.camera,t.renderer.domElement),s==="fly"&&(t.controls.movementSpeed=300,t.controls.rollSpeed=Math.PI/6,t.controls.dragToLook=!0),(s==="trackball"||s==="orbit")&&(t.controls.minDistance=.1,t.controls.maxDistance=t.skyRadius,t.controls.addEventListener("start",function(){t.controlsEngaged=!0}),t.controls.addEventListener("change",function(){t.controlsEngaged&&(t.controlsDragging=!0)}),t.controls.addEventListener("end",function(){t.controlsEngaged=!1,t.controlsDragging=!1})),[t.renderer,t.postProcessingComposer].concat(x1(t.extraRenderers)).forEach(function(y){return y.setSize(t.width,t.height)}),t.camera.aspect=t.width/t.height,t.camera.updateProjectionMatrix(),t.camera.position.z=1e3,t.scene.add(t.skysphere=new Gr.Mesh),t.skysphere.visible=!1,t.loadComplete=t.scene.visible=!A,window.scene=t.scene},update:function(e,t){if(e.width&&e.height&&(t.hasOwnProperty("width")||t.hasOwnProperty("height"))){var n,r=e.width,s=e.height;e.container.style.width="".concat(r,"px"),e.container.style.height="".concat(s,"px"),[e.renderer,e.postProcessingComposer].concat(x1(e.extraRenderers)).forEach(function(A){return A.setSize(r,s)}),e.camera.aspect=r/s;var o=e.viewOffset.slice(0,2);o.some(function(A){return A})&&(n=e.camera).setViewOffset.apply(n,[r,s].concat(x1(o),[r,s])),e.camera.updateProjectionMatrix()}if(t.hasOwnProperty("viewOffset")){var a,l=e.width,c=e.height,u=e.viewOffset.slice(0,2);u.some(function(A){return A})?(a=e.camera).setViewOffset.apply(a,[l,c].concat(x1(u),[l,c])):e.camera.clearViewOffset()}if(t.hasOwnProperty("skyRadius")&&e.skyRadius&&(e.controls.hasOwnProperty("maxDistance")&&t.skyRadius&&(e.controls.maxDistance=Math.min(e.controls.maxDistance,e.skyRadius)),e.camera.far=e.skyRadius*2.5,e.camera.updateProjectionMatrix(),e.skysphere.geometry=new Gr.SphereGeometry(e.skyRadius)),t.hasOwnProperty("backgroundColor")){var f=Dm(e.backgroundColor).alpha;f===void 0&&(f=1),e.renderer.setClearColor(new Gr.Color(wae(1,e.backgroundColor)),f)}t.hasOwnProperty("backgroundImageUrl")&&(e.backgroundImageUrl?new Gr.TextureLoader().load(e.backgroundImageUrl,function(A){A.colorSpace=Gr.SRGBColorSpace,e.skysphere.material=new Gr.MeshBasicMaterial({map:A,side:Gr.BackSide}),e.skysphere.visible=!0,e.onBackgroundImageLoaded&&setTimeout(e.onBackgroundImageLoaded),!e.loadComplete&&d()}):(e.skysphere.visible=!1,e.skysphere.material.map=null,!e.loadComplete&&d())),t.hasOwnProperty("showNavInfo")&&(e.navInfo.style.display=e.showNavInfo?null:"none"),t.hasOwnProperty("lights")&&((t.lights||[]).forEach(function(A){return e.scene.remove(A)}),e.lights.forEach(function(A){return e.scene.add(A)})),t.hasOwnProperty("objects")&&((t.objects||[]).forEach(function(A){return e.scene.remove(A)}),e.objects.forEach(function(A){return e.scene.add(A)}));function d(){e.loadComplete=e.scene.visible=!0}}});function c6e(i,e){e===void 0&&(e={});var t=e.insertAt;if(!(typeof document>"u")){var n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=i:r.appendChild(document.createTextNode(i))}}var u6e=`.scene-container .clickable {5285+}`;A6e(g6e);function wG(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function v6e(i){if(Array.isArray(i))return i}function _6e(i){if(Array.isArray(i))return wG(i)}function x6e(i,e,t){return(e=M6e(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function y6e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function b6e(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var n,r,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(i)).next,e!==0)for(;!(l=(n=s.call(t)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(u){c=!0,r=u}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw r}}return a}}function w6e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.5286+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function S6e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.5287+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function T6e(i,e){return v6e(i)||b6e(i,e)||Vle(i,e)||w6e()}function x1(i){return _6e(i)||y6e(i)||Vle(i)||S6e()}function E6e(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function M6e(i){var e=E6e(i,"string");return typeof e=="symbol"?e:e+""}function Vle(i,e){if(i){if(typeof i=="string")return wG(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?wG(i,e):void 0}}var Gle=function(e){e instanceof Array?e.forEach(Gle):(e.map&&e.map.dispose(),e.dispose())},qle=function(e){e.geometry&&e.geometry.dispose(),e.material&&Gle(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(qle)},C6e=function(e){for(;e.children.length;){var t=e.children[0];e.remove(t),qle(t)}},Gr=window.THREE?window.THREE:{WebGLRenderer:XM,Scene:o0,PerspectiveCamera:$r,Raycaster:hb,SRGBColorSpace:Fr,TextureLoader:bl,Vector2:Oe,Vector3:re,Box3:ka,Color:zt,Mesh:Hn,SphereGeometry:Va,MeshBasicMaterial:fs,BackSide:mi,Timer:ng},SG=Kr({props:{width:{default:window.innerWidth,onChange:function(e,t,n){isNaN(e)&&(t.width=n)}},height:{default:window.innerHeight,onChange:function(e,t,n){isNaN(e)&&(t.height=n)}},viewOffset:{default:[0,0]},backgroundColor:{default:"#000011"},backgroundImageUrl:{},onBackgroundImageLoaded:{},showNavInfo:{default:!0},skyRadius:{default:5e4},objects:{default:[]},lights:{default:[]},enablePointerInteraction:{default:!0,onChange:function(e,t){t.hoverObj=null,t.tooltip&&t.tooltip.content(null)},triggerUpdate:!1},pointerRaycasterThrottleMs:{default:50,triggerUpdate:!1},lineHoverPrecision:{default:1,triggerUpdate:!1},pointsHoverPrecision:{default:1,triggerUpdate:!1},hoverOrderComparator:{triggerUpdate:!1},hoverFilter:{default:function(){return!0},triggerUpdate:!1},tooltipContent:{triggerUpdate:!1},hoverDuringDrag:{default:!1,triggerUpdate:!1},clickAfterDrag:{default:!1,triggerUpdate:!1},onHover:{default:function(){},triggerUpdate:!1},onClick:{default:function(){},triggerUpdate:!1},onRightClick:{triggerUpdate:!1}},methods:{tick:function(e){if(e.initialised){e.controls.enabled&&e.controls.update&&e.controls.update(Math.min(1,e.timer.update().getDelta())),e.postProcessingComposer?e.postProcessingComposer.render():e.renderer.render(e.scene,e.camera),e.extraRenderers.forEach(function(o){return o.render(e.scene,e.camera)});var t=+new Date;if(e.enablePointerInteraction&&t-e.lastRaycasterCheck>=e.pointerRaycasterThrottleMs){e.lastRaycasterCheck=t;var n=null;if(e.hoverDuringDrag||!e.isPointerDragging){var r=this.intersectingObjects(e.pointerPos.x,e.pointerPos.y);e.hoverOrderComparator&&r.sort(function(o,a){return e.hoverOrderComparator(o.object,a.object)});var s=r.find(function(o){return e.hoverFilter(o.object)})||null;n=s?s.object:null,e.intersection=s||null}n!==e.hoverObj&&(e.onHover(n,e.hoverObj,e.intersection),e.tooltip.content(n&&st(e.tooltipContent)(n,e.intersection)||null),e.hoverObj=n)}e.tweenGroup.update()}return this},getPointerPos:function(e){var t=e.pointerPos,n=t.x,r=t.y;return{x:n,y:r}},cameraPosition:function(e,t,n,r){var s=e.camera;if(t&&e.initialised){var o,a,l=t,c=n||{x:0,y:0,z:0};if((o=e.povPosTween)===null||o===void 0||o.end(),(a=e.povTgtTween)===null||a===void 0||a.end(),!r)d(l),A(c);else{var u=Object.assign({},s.position),f=y();e.tweenGroup.add(e.povPosTween=new uo(u).to(l,r).easing(Qr.Quadratic.Out).onUpdate(d).onComplete(function(){e.povPosTween=void 0,e.tweenGroup.remove(this)}).start()),e.tweenGroup.add(e.povTgtTween=new uo(f).to(c,r/3).easing(Qr.Quadratic.Out).onUpdate(A).onComplete(function(){e.povTgtTween=void 0,e.tweenGroup.remove(this)}).start())}return this}return Object.assign({},s.position,{lookAt:y()});function d(w){var S=w.x,T=w.y,R=w.z;S!==void 0&&(s.position.x=S),T!==void 0&&(s.position.y=T),R!==void 0&&(s.position.z=R)}function A(w){var S=new Gr.Vector3(w.x,w.y,w.z);e.controls.enabled&&e.controls.target?e.controls.target=S:s.lookAt(S)}function y(){return Object.assign(new Gr.Vector3(0,0,-1e3).applyQuaternion(s.quaternion).add(s.position))}},zoomToFit:function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:10,r=arguments.length,s=new Array(r>3?r-3:0),o=3;o<r;o++)s[o-3]=arguments[o];return this.fitToBbox(this.getBbox.apply(this,s),t,n)},fitToBbox:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:10,s=e.camera;if(t){var o=new Gr.Vector3(0,0,0),a=Math.max.apply(Math,x1(Object.entries(t).map(function(A){var y=T6e(A,2),w=y[0],S=y[1];return Math.max.apply(Math,x1(S.map(function(T){return Math.abs(o[w]-T)})))})))*2,l=(1-r*2/e.height)*s.fov,c=a/Math.atan(l*Math.PI/180),u=c/s.aspect,f=Math.max(c,u);if(f>0){var d=o.clone().sub(s.position).normalize().multiplyScalar(-f);this.cameraPosition(d,o,n)}}return this},getBbox:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){return!0},n=new Gr.Box3(new Gr.Vector3(0,0,0),new Gr.Vector3(0,0,0)),r=e.objects.filter(t);return r.length?(r.forEach(function(s){return n.expandByObject(s)}),Object.assign.apply(Object,x1(["x","y","z"].map(function(s){return x6e({},s,[n.min[s],n.max[s]])})))):null},getScreenCoords:function(e,t,n,r){var s=new Gr.Vector3(t,n,r);return s.project(this.camera()),{x:(s.x+1)*e.width/2,y:-(s.y-1)*e.height/2}},getSceneCoords:function(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,s=new Gr.Vector2(t/e.width*2-1,-(n/e.height)*2+1),o=new Gr.Raycaster;return o.setFromCamera(s,e.camera),Object.assign({},o.ray.at(r,new Gr.Vector3))},intersectingObjects:function(e,t,n){var r=new Gr.Vector2(t/e.width*2-1,-(n/e.height)*2+1),s=new Gr.Raycaster;return s.params.Line.threshold=e.lineHoverPrecision,s.params.Points.threshold=e.pointsHoverPrecision,s.setFromCamera(r,e.camera),s.intersectObjects(e.objects,!0)},renderer:function(e){return e.renderer},scene:function(e){return e.scene},camera:function(e){return e.camera},postProcessingComposer:function(e){return e.postProcessingComposer},controls:function(e){return e.controls},tbControls:function(e){return e.controls},_destructor:function(e){var t,n,r;C6e(e.scene),(t=e.controls)===null||t===void 0||t.dispose(),(n=e.renderer)===null||n===void 0||n.dispose(),(r=e.postProcessingComposer)===null||r===void 0||r.dispose()}},stateInit:function(){return{scene:new Gr.Scene,camera:new Gr.PerspectiveCamera,timer:new Gr.Timer,tweenGroup:new vg,lastRaycasterCheck:0}},init:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=n.controlType,s=r===void 0?"trackball":r,o=n.useWebGPU,a=o===void 0?!1:o,l=n.rendererConfig,c=l===void 0?{}:l,u=n.extraRenderers,f=u===void 0?[]:u,d=n.waitForLoadComplete,A=d===void 0?!0:d;e.innerHTML="",e.appendChild(t.container=document.createElement("div")),t.container.className="scene-container",t.container.style.position="relative",t.container.appendChild(t.navInfo=document.createElement("div")),t.navInfo.className="scene-nav-info",t.navInfo.textContent={orbit:"Left-click: rotate, Mouse-wheel/middle-click: zoom, Right-click: pan",trackball:"Left-click: rotate, Mouse-wheel/middle-click: zoom, Right-click: pan",fly:"WASD: move, R|F: up | down, Q|E: roll, up|down: pitch, left|right: yaw"}[s]||"",t.navInfo.style.display=t.showNavInfo?null:"none",t.tooltip=new zle(t.container),t.pointerPos=new Gr.Vector2,t.pointerPos.x=-2,t.pointerPos.y=-2,["pointermove","pointerdown"].forEach(function(y){return t.container.addEventListener(y,function(w){if(y==="pointerdown"&&(t.isPointerPressed=!0),!t.isPointerDragging&&w.type==="pointermove"&&(w.pressure>0||t.isPointerPressed)&&(w.pointerType==="mouse"||w.movementX===void 0||[w.movementX,w.movementY].some(function(R){return Math.abs(R)>1}))&&(t.isPointerDragging=!0),t.enablePointerInteraction){var S=T(t.container);t.pointerPos.x=w.pageX-S.left,t.pointerPos.y=w.pageY-S.top}function T(R){var P=R.getBoundingClientRect(),I=window.pageXOffset||document.documentElement.scrollLeft,F=window.pageYOffset||document.documentElement.scrollTop;return{top:P.top+F,left:P.left+I}}},{passive:!0})}),t.container.addEventListener("pointerup",function(y){t.isPointerPressed&&(t.isPointerPressed=!1,!(t.isPointerDragging&&(t.isPointerDragging=!1,!t.clickAfterDrag))&&requestAnimationFrame(function(){y.button===0&&t.onClick(t.hoverObj||null,y,t.intersection),y.button===2&&t.onRightClick&&t.onRightClick(t.hoverObj||null,y,t.intersection)}))},{passive:!0,capture:!0}),t.container.addEventListener("contextmenu",function(y){t.onRightClick&&y.preventDefault()}),t.renderer=new(a?bx:Gr.WebGLRenderer)(Object.assign({antialias:!0,alpha:!0},c)),t.renderer.setPixelRatio(Math.min(2,window.devicePixelRatio)),t.container.appendChild(t.renderer.domElement),t.extraRenderers=f,t.extraRenderers.forEach(function(y){y.domElement.style.position="absolute",y.domElement.style.top="0px",y.domElement.style.pointerEvents="none",t.container.appendChild(y.domElement)}),t.postProcessingComposer=new mP(t.renderer),t.postProcessingComposer.addPass(new AP(t.scene,t.camera)),t.controls=new{trackball:lP,orbit:uP,fly:hP}[s](t.camera,t.renderer.domElement),s==="fly"&&(t.controls.movementSpeed=300,t.controls.rollSpeed=Math.PI/6,t.controls.dragToLook=!0),(s==="trackball"||s==="orbit")&&(t.controls.minDistance=.1,t.controls.maxDistance=t.skyRadius,t.controls.addEventListener("start",function(){t.controlsEngaged=!0}),t.controls.addEventListener("change",function(){t.controlsEngaged&&(t.controlsDragging=!0)}),t.controls.addEventListener("end",function(){t.controlsEngaged=!1,t.controlsDragging=!1})),[t.renderer,t.postProcessingComposer].concat(x1(t.extraRenderers)).forEach(function(y){return y.setSize(t.width,t.height)}),t.camera.aspect=t.width/t.height,t.camera.updateProjectionMatrix(),t.camera.position.z=1e3,t.scene.add(t.skysphere=new Gr.Mesh),t.skysphere.visible=!1,t.loadComplete=t.scene.visible=!A,window.scene=t.scene},update:function(e,t){if(e.width&&e.height&&(t.hasOwnProperty("width")||t.hasOwnProperty("height"))){var n,r=e.width,s=e.height;e.container.style.width="".concat(r,"px"),e.container.style.height="".concat(s,"px"),[e.renderer,e.postProcessingComposer].concat(x1(e.extraRenderers)).forEach(function(A){return A.setSize(r,s)}),e.camera.aspect=r/s;var o=e.viewOffset.slice(0,2);o.some(function(A){return A})&&(n=e.camera).setViewOffset.apply(n,[r,s].concat(x1(o),[r,s])),e.camera.updateProjectionMatrix()}if(t.hasOwnProperty("viewOffset")){var a,l=e.width,c=e.height,u=e.viewOffset.slice(0,2);u.some(function(A){return A})?(a=e.camera).setViewOffset.apply(a,[l,c].concat(x1(u),[l,c])):e.camera.clearViewOffset()}if(t.hasOwnProperty("skyRadius")&&e.skyRadius&&(e.controls.hasOwnProperty("maxDistance")&&t.skyRadius&&(e.controls.maxDistance=Math.min(e.controls.maxDistance,e.skyRadius)),e.camera.far=e.skyRadius*2.5,e.camera.updateProjectionMatrix(),e.skysphere.geometry=new Gr.SphereGeometry(e.skyRadius)),t.hasOwnProperty("backgroundColor")){var f=Dm(e.backgroundColor).alpha;f===void 0&&(f=1),e.renderer.setClearColor(new Gr.Color(Lae(1,e.backgroundColor)),f)}t.hasOwnProperty("backgroundImageUrl")&&(e.backgroundImageUrl?new Gr.TextureLoader().load(e.backgroundImageUrl,function(A){A.colorSpace=Gr.SRGBColorSpace,e.skysphere.material=new Gr.MeshBasicMaterial({map:A,side:Gr.BackSide}),e.skysphere.visible=!0,e.onBackgroundImageLoaded&&setTimeout(e.onBackgroundImageLoaded),!e.loadComplete&&d()}):(e.skysphere.visible=!1,e.skysphere.material.map=null,!e.loadComplete&&d())),t.hasOwnProperty("showNavInfo")&&(e.navInfo.style.display=e.showNavInfo?null:"none"),t.hasOwnProperty("lights")&&((t.lights||[]).forEach(function(A){return e.scene.remove(A)}),e.lights.forEach(function(A){return e.scene.add(A)})),t.hasOwnProperty("objects")&&((t.objects||[]).forEach(function(A){return e.scene.remove(A)}),e.objects.forEach(function(A){return e.scene.add(A)}));function d(){e.loadComplete=e.scene.visible=!0}}});function R6e(i,e){e===void 0&&(e={});var t=e.insertAt;if(!(typeof document>"u")){var n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=i:r.appendChild(document.createTextNode(i))}}var I6e=`.scene-container .clickable {52885288 cursor: pointer;5289-}`;c6e(u6e);function gG(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function h6e(i){if(Array.isArray(i))return gG(i)}function YS(i,e,t){return(e=g6e(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function f6e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function d6e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.5290-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Fle(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function y1(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Fle(Object(t),!0).forEach(function(n){YS(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Fle(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function p6e(i,e){if(i==null)return{};var t,n,r=m6e(i,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);for(n=0;n<s.length;n++)t=s[n],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(i,t)&&(r[t]=i[t])}return r}function m6e(i,e){if(i==null)return{};var t={};for(var n in i)if({}.hasOwnProperty.call(i,n)){if(e.indexOf(n)!==-1)continue;t[n]=i[n]}return t}function DP(i){return h6e(i)||f6e(i)||v6e(i)||d6e()}function A6e(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function g6e(i){var e=A6e(i,"string");return typeof e=="symbol"?e:e+""}function v6e(i,e){if(i){if(typeof i=="string")return gG(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?gG(i,e):void 0}}function Ble(i,e){var t=new e;return t._destructor&&t._destructor(),{linkProp:function(r){return{default:t[r](),onChange:function(o,a){a[i][r](o)},triggerUpdate:!1}},linkMethod:function(r){return function(s){for(var o=s[i],a=arguments.length,l=new Array(a>1?a-1:0),c=1;c<a;c++)l[c-1]=arguments[c];var u=o[r].apply(o,l);return u===o?this:u}}}}var _6e=["rendererConfig","waitForGlobeReady"],$S=y1(y1({},window.THREE?window.THREE:{AmbientLight:tg,DirectionalLight:eg,Vector2:Oe,REVISION:"185"}),{},{CSS2DRenderer:XM}),Ole=Ble("globe",UV),x6e=Object.assign.apply(Object,DP(["globeImageUrl","bumpImageUrl","globeTileEngineUrl","globeTileEngineMaxLevel","globeCurvatureResolution","showGlobe","showGraticules","showAtmosphere","atmosphereColor","atmosphereAltitude","onGlobeReady","pointsData","pointLat","pointLng","pointColor","pointAltitude","pointRadius","pointResolution","pointsMerge","pointsTransitionDuration","arcsData","arcStartLat","arcStartLng","arcStartAltitude","arcEndLat","arcEndLng","arcEndAltitude","arcColor","arcAltitude","arcAltitudeAutoScale","arcStroke","arcCurveResolution","arcCircularResolution","arcDashLength","arcDashGap","arcDashInitialGap","arcDashAnimateTime","arcsTransitionDuration","polygonsData","polygonGeoJsonGeometry","polygonCapColor","polygonCapMaterial","polygonSideColor","polygonSideMaterial","polygonStrokeColor","polygonAltitude","polygonCapCurvatureResolution","polygonsTransitionDuration","pathsData","pathPoints","pathPointLat","pathPointLng","pathPointAlt","pathResolution","pathColor","pathStroke","pathDashLength","pathDashGap","pathDashInitialGap","pathDashAnimateTime","pathTransitionDuration","heatmapsData","heatmapPoints","heatmapPointLat","heatmapPointLng","heatmapPointWeight","heatmapBandwidth","heatmapColorFn","heatmapColorSaturation","heatmapBaseAltitude","heatmapTopAltitude","heatmapsTransitionDuration","hexBinPointsData","hexBinPointLat","hexBinPointLng","hexBinPointWeight","hexBinResolution","hexMargin","hexTopCurvatureResolution","hexTopColor","hexSideColor","hexAltitude","hexBinMerge","hexTransitionDuration","hexPolygonsData","hexPolygonGeoJsonGeometry","hexPolygonColor","hexPolygonAltitude","hexPolygonResolution","hexPolygonMargin","hexPolygonUseDots","hexPolygonCurvatureResolution","hexPolygonDotResolution","hexPolygonsTransitionDuration","tilesData","tileLat","tileLng","tileAltitude","tileWidth","tileHeight","tileUseGlobeProjection","tileMaterial","tileCurvatureResolution","tilesTransitionDuration","particlesData","particlesList","particleLat","particleLng","particleAltitude","particlesSize","particlesSizeAttenuation","particlesColor","particlesTexture","ringsData","ringLat","ringLng","ringAltitude","ringColor","ringResolution","ringMaxRadius","ringPropagationSpeed","ringRepeatPeriod","labelsData","labelLat","labelLng","labelAltitude","labelRotation","labelText","labelSize","labelTypeFace","labelColor","labelResolution","labelIncludeDot","labelDotRadius","labelDotOrientation","labelsTransitionDuration","htmlElementsData","htmlLat","htmlLng","htmlAltitude","htmlElement","htmlElementVisibilityModifier","htmlTransitionDuration","objectsData","objectLat","objectLng","objectAltitude","objectRotation","objectFacesSurface","objectThreeObject","customLayerData","customThreeObject","customThreeObjectUpdate"].map(function(i){return YS({},i,Ole.linkProp(i))}))),y6e=Object.assign.apply(Object,DP(["globeMaterial","globeTileEngineClearCache","getGlobeRadius","getCoords","toGeoCoords"].map(function(i){return YS({},i,Ole.linkMethod(i))}))),Ule=Ble("renderObjs",AG),b6e=Object.assign.apply(Object,DP(["width","height","backgroundColor","backgroundImageUrl","enablePointerInteraction"].map(function(i){return YS({},i,Ule.linkProp(i))}))),w6e=Object.assign.apply(Object,DP(["lights","postProcessingComposer"].map(function(i){return YS({},i,Ule.linkMethod(i))}))),kle=Kr({props:y1(y1({onZoom:{triggerUpdate:!1},onGlobeClick:{triggerUpdate:!1},onGlobeRightClick:{triggerUpdate:!1},pointLabel:{default:"name",triggerUpdate:!1},onPointClick:{triggerUpdate:!1},onPointRightClick:{triggerUpdate:!1},onPointHover:{triggerUpdate:!1},arcLabel:{default:"name",triggerUpdate:!1},onArcClick:{triggerUpdate:!1},onArcRightClick:{triggerUpdate:!1},onArcHover:{triggerUpdate:!1},polygonLabel:{default:"name",triggerUpdate:!1},onPolygonClick:{triggerUpdate:!1},onPolygonRightClick:{triggerUpdate:!1},onPolygonHover:{triggerUpdate:!1},pathLabel:{default:"name",triggerUpdate:!1},onPathClick:{triggerUpdate:!1},onPathRightClick:{triggerUpdate:!1},onPathHover:{triggerUpdate:!1},onHeatmapClick:{triggerUpdate:!1},onHeatmapRightClick:{triggerUpdate:!1},onHeatmapHover:{triggerUpdate:!1},hexLabel:{triggerUpdate:!1},onHexClick:{triggerUpdate:!1},onHexRightClick:{triggerUpdate:!1},onHexHover:{triggerUpdate:!1},hexPolygonLabel:{triggerUpdate:!1},onHexPolygonClick:{triggerUpdate:!1},onHexPolygonRightClick:{triggerUpdate:!1},onHexPolygonHover:{triggerUpdate:!1},tileLabel:{default:"name",triggerUpdate:!1},onTileClick:{triggerUpdate:!1},onTileRightClick:{triggerUpdate:!1},onTileHover:{triggerUpdate:!1},particleLabel:{default:"name",triggerUpdate:!1},onParticleClick:{triggerUpdate:!1},onParticleRightClick:{triggerUpdate:!1},onParticleHover:{triggerUpdate:!1},labelLabel:{triggerUpdate:!1},onLabelClick:{triggerUpdate:!1},onLabelRightClick:{triggerUpdate:!1},onLabelHover:{triggerUpdate:!1},objectLabel:{default:"name",triggerUpdate:!1},onObjectClick:{triggerUpdate:!1},onObjectRightClick:{triggerUpdate:!1},onObjectHover:{triggerUpdate:!1},customLayerLabel:{default:"name",triggerUpdate:!1},onCustomLayerClick:{triggerUpdate:!1},onCustomLayerRightClick:{triggerUpdate:!1},onCustomLayerHover:{triggerUpdate:!1},pointerEventsFilter:{default:function(){return!0},triggerUpdate:!1},lineHoverPrecision:{default:.2,triggerUpdate:!1,onChange:function(e,t){t.renderObjs.lineHoverPrecision(e),t.renderObjs.pointsHoverPrecision(e)}},showPointerCursor:{default:!0,triggerUpdate:!1},globeOffset:{default:[0,0],triggerUpdate:!1,onChange:function(e,t){return Array.isArray(e)&&e.length===2&&t.renderObjs.viewOffset(e.map(function(n){return-n}))}}},x6e),b6e),methods:y1(y1({pauseAnimation:function(e){var t;return e.animationFrameRequestId!==null&&(cancelAnimationFrame(e.animationFrameRequestId),e.animationFrameRequestId=null),(t=e.globe)===null||t===void 0||t.pauseAnimation(),this},resumeAnimation:function(e){var t;return e.animationFrameRequestId===null&&this._animationCycle(),(t=e.globe)===null||t===void 0||t.resumeAnimation(),this},_animationCycle:function(e){e.renderObjs.tick(),e.tweenGroup.update(),e.animationFrameRequestId=requestAnimationFrame(this._animationCycle)},pointOfView:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=a();if(t.lat===void 0&&t.lng===void 0&&t.altitude===void 0)return r;var s,o=Object.assign({},r,t);if(["lat","lng","altitude"].forEach(function(c){return o[c]=+o[c]}),(s=e.povTween)===null||s===void 0||s.end(),!n)l(o);else{for(;r.lng-o.lng>180;)r.lng-=360;for(;r.lng-o.lng<-180;)r.lng+=360;e.tweenGroup.add(e.povTween=new uo(r).to(o,n).easing(Qr.Cubic.InOut).onUpdate(l).onComplete(function(){e.povTween=void 0,e.tweenGroup.remove(this)}).start())}return this;function a(){return e.globe.toGeoCoords(e.renderObjs.cameraPosition())}function l(c){var u=c.lat,f=c.lng,d=c.altitude;e.renderObjs.cameraPosition(e.globe.getCoords(u,f,d)),e.globe.setPointOfView(e.renderObjs.camera())}},getScreenCoords:function(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];var o=(t=e.globe).getCoords.apply(t,r);return e.renderObjs.getScreenCoords(o.x,o.y,o.z)},toGlobeCoords:function(e,t,n){var r=e.renderObjs.intersectingObjects(t,n).find(function(l){return(l.object.__globeObjType||l.object.parent.__globeObjType)==="globe"});if(!r)return null;var s=e.globe.toGeoCoords(r.point),o=s.lat,a=s.lng;return{lat:o,lng:a}},scene:function(e){return e.renderObjs.scene()},camera:function(e){return e.renderObjs.camera()},renderer:function(e){return e.renderObjs.renderer()},controls:function(e){return e.renderObjs.controls()},_destructor:function(e){this.pauseAnimation(),this.pointsData([]),this.arcsData([]),this.polygonsData([]),this.pathsData([]),this.heatmapsData([]),this.hexBinPointsData([]),this.hexPolygonsData([]),this.tilesData([]),this.particlesData([]),this.labelsData([]),this.htmlElementsData([]),this.objectsData([]),this.customLayerData([]),e.globe._destructor(),e.renderObjs._destructor()}},y6e),w6e),stateInit:function(e){var t=e.rendererConfig,n=e.waitForGlobeReady,r=n===void 0?!0:n,s=p6e(e,_6e),o=new UV(y1({waitForGlobeReady:r},s));return{globe:o,renderObjs:AG({controlType:"orbit",rendererConfig:t,waitForLoadComplete:r,extraRenderers:[new $S.CSS2DRenderer]}).skyRadius(o.getGlobeRadius()*500).showNavInfo(!1).objects([o]).lights([new $S.AmbientLight(13421772,Math.PI),new $S.DirectionalLight(16777215,.6*Math.PI)]),tweenGroup:new vg}},init:function(e,t){var n=this;e.innerHTML="",e.appendChild(t.container=document.createElement("div")),t.container.style.position="relative";var r=document.createElement("div");t.container.appendChild(r),t.renderObjs(r),t.globe.rendererSize(t.renderObjs.renderer().getSize(new $S.Vector2)),this.pointOfView({altitude:2.5});var s=t.globe.getGlobeRadius(),o=t.renderObjs.controls();t.renderObjs.camera().near=.05,o.minDistance=s+Math.max(.001,t.renderObjs.camera().near*1.1),o.maxDistance=s*100,o.enablePan=!1,o.enableDamping=!0,o.dampingFactor=.1,o.rotateSpeed=.3,o.zoomSpeed=.3,o.zoomToCursor=!0,o.addEventListener("change",function(){o.target.setScalar(0);var c=n.pointOfView();o.rotateSpeed=c.altitude*.3,o.zoomSpeed=Math.sqrt(c.altitude)*.5,t.globe.setPointOfView(t.renderObjs.camera()),t.onZoom&&t.onZoom(c)});var a=function(u){for(var f=u;f&&!f.hasOwnProperty("__globeObjType");)f=f.parent;return f},l={point:function(u){return u},arc:function(u){return u},polygon:function(u){return u.data},path:function(u){return u},heatmap:function(u){return u},hexbin:function(u){return u},hexPolygon:function(u){return u},tile:function(u){return u},particles:function(u,f){return!f||!f.hasOwnProperty("index")||u.length<=f.index?u:u[f.index]},label:function(u){return u},object:function(u){return u},custom:function(u){return u}};$S.REVISION<155&&(t.renderObjs.renderer().useLegacyLights=!1),t.renderObjs.hoverFilter(function(c){var u=a(c);if(!u)return!1;var f=u.__globeObjType;if(f!=="globe"&&!l.hasOwnProperty(f))return!1;var d=l.hasOwnProperty(f)&&u.__data?l[f](u.__data):null;return["points","hexBinPoints"].some(function(A){return A===f})&&Array.isArray(d)?!1:t.pointerEventsFilter(u,d)}).tooltipContent(function(c,u){var f={point:t.pointLabel,arc:t.arcLabel,polygon:t.polygonLabel,path:t.pathLabel,hexbin:t.hexLabel,hexPolygon:t.hexPolygonLabel,tile:t.tileLabel,particles:t.particleLabel,label:t.labelLabel,object:t.objectLabel,custom:t.customLayerLabel},d=a(c),A=d&&d.__globeObjType;return d&&A&&f.hasOwnProperty(A)&&l.hasOwnProperty(A)&&st(f[A])(l[A](d.__data,u))||""}).onHover(function(c,u,f){var d={point:t.onPointHover,arc:t.onArcHover,polygon:t.onPolygonHover,path:t.onPathHover,heatmap:t.onHeatmapHover,hexbin:t.onHexHover,hexPolygon:t.onHexPolygonHover,tile:t.onTileHover,particles:t.onParticleHover,label:t.onLabelHover,object:t.onObjectHover,custom:t.onCustomLayerHover},A={globe:t.onGlobeClick,point:t.onPointClick,arc:t.onArcClick,polygon:t.onPolygonClick,path:t.onPathClick,heatmap:t.onHeatmapClick,hexbin:t.onHexClick,hexPolygon:t.onHexPolygonClick,tile:t.onTileClick,particles:t.onParticleClick,label:t.onLabelClick,object:t.onObjectClick,custom:t.onCustomLayerClick},y=a(c);if(y&&!d.hasOwnProperty(y.__globeObjType)&&(y=null),y!==t.hoverObj){var w,S=t.hoverObj?t.hoverObj.__globeObjType:null,T=t.hoverData,R=y?y.__globeObjType:null,P=(w=y)!==null&&w!==void 0&&w.__data?l[R](y.__data,f):null;S&&S!==R&&d[S]&&d[S](null,T||null),R&&d[R]&&d[R](P,S===R?T:null),t.renderObjs.renderer().domElement.classList[R&&A[R]&&st(t.showPointerCursor)(R,P)?"add":"remove"]("clickable"),t.hoverObj=y,t.hoverData=P}}).onClick(function(c,u,f){if(c){var d={globe:t.onGlobeClick,point:t.onPointClick,arc:t.onArcClick,polygon:t.onPolygonClick,path:t.onPathClick,heatmap:t.onHeatmapClick,hexbin:t.onHexClick,hexPolygon:t.onHexPolygonClick,tile:t.onTileClick,particles:t.onParticleClick,label:t.onLabelClick,object:t.onObjectClick,custom:t.onCustomLayerClick},A=a(c),y=A.__globeObjType;if(A&&d.hasOwnProperty(y)&&d[y]){var w=[u],S=f!=null&&f.isVector3?f:f?.point;if(y==="globe"){var T=n.toGeoCoords(S),R=T.lat,P=T.lng;w.unshift({lat:R,lng:P})}else w.push(n.toGeoCoords(S));l.hasOwnProperty(y)&&w.unshift(l[y](A.__data,f)),d[y].apply(d,w)}}}).onRightClick(function(c,u,f){if(c){var d={globe:t.onGlobeRightClick,point:t.onPointRightClick,arc:t.onArcRightClick,polygon:t.onPolygonRightClick,path:t.onPathRightClick,heatmap:t.onHeatmapRightClick,hexbin:t.onHexRightClick,hexPolygon:t.onHexPolygonRightClick,tile:t.onTileRightClick,particles:t.onParticleRightClick,label:t.onLabelRightClick,object:t.onObjectRightClick,custom:t.onCustomLayerRightClick},A=a(c),y=A.__globeObjType;if(A&&d.hasOwnProperty(y)&&d[y]){var w=[u],S=f!=null&&f.isVector3?f:f?.point;if(y==="globe"){var T=n.toGeoCoords(S),R=T.lat,P=T.lng;w.unshift({lat:R,lng:P})}else w.push(n.toGeoCoords(S));l.hasOwnProperty(y)&&w.unshift(l[y](A.__data,f)),d[y].apply(d,w)}}}),this._animationCycle()}});var Gle=4,Fx=100,QS=Fx+.2,op=8,S6e=96,qle=.045,Hle=.08;function Bx(i,e,t){let n=(90-i)*Math.PI/180,r=(90-e)*Math.PI/180;return[t*Math.sin(n)*Math.cos(r),t*Math.cos(n),t*Math.sin(n)*Math.sin(r)]}var Yn=null,FP="",Fs={group:null,tiles:new Map,key:"",lens:""},Mo={group:null,cell:null,fitKey:""},cu={group:null,key:""},T6e=180,_G=null,Ox=new Map,UP=new Map,zle=new Map;function Wle(){let i=OT(O.world)==="sphere"&&uh(O.world)!==null;ge.globeToggle.hidden=!i,jle(),!i&&Yn&&(ZS(),Fs.group=null,Mo.group=null,Mo.cell=null,cu.group=null,cu.key="",Yn._destructor(),Yn=null,FP="",_G=null,ge.globe.replaceChildren())}function kP(){O.globeActive?jle():Yle()}var KS=2.5,BP=2,Ux=.08,zP=4;function E6e(i){let e=Number.isFinite(i)?i:BP;return cs(KS/2**(e-BP),Ux,zP)}function yG(i){let e=Number.isFinite(i)?Math.max(i,Ux/2):KS,t=(O.lens?.maxZoom??BP)+2;return cs(BP+Math.log2(KS/e),0,t)}function bG(i){if(!Yn||!O.globeActive)return;let e=Yn.pointOfView(),t=cs((Number.isFinite(e.altitude)?e.altitude:KS)/2**i,Ux,zP);Yn.pointOfView({altitude:t},180)}function jle(){let i=uh(O.world),e=O.engine?.getView();if(Yn&&O.globeActive&&i&&e){let t=Yn.pointOfView(),[n,r]=i.toWorld(t.lat,t.lng);Number.isFinite(n)&&Number.isFinite(r)&&(e.cancelAnimations(),e.setCenter([n,-r]),e.setZoom(yG(t.altitude)))}O.globeActive=!1,ge.globe.hidden=!0,ge.globeToggle.setAttribute("aria-pressed","false"),ge.viewport.hidden=!1,ZS(),O.overviewKey="",document.dispatchEvent(new Event("atlas:globe-camera"))}function Xle(){if(!Yn||!O.globeActive)return null;let i=Yn.pointOfView();return{lat:i.lat,lng:i.lng}}function $le(i,e,t){if(!Yn)return;let n=Yn.pointOfView().altitude;Yn.pointOfView({lat:i,lng:e,altitude:n},t?180:0)}async function Yle(){let i=uh(O.world);if(!i)return;if(O.globeActive=!0,ge.viewport.hidden=!0,ge.globe.hidden=!1,ge.globeToggle.setAttribute("aria-pressed","true"),O.overviewKey="",!Yn){Yn=kle({animateIn:!1})(ge.globe).backgroundColor("#0b0e12").showAtmosphere(!0).atmosphereColor("#8a6f5b").atmosphereAltitude(.12).objectLat(o=>o.lat).objectLng(o=>o.lng).objectAltitude(o=>o.pin===O.selectedPin?.03:.014).objectThreeObject(o=>U6e(o.pin)).objectLabel(o=>o.pin.location.title).onObjectClick(o=>Dy(o.pin)).onObjectHover(o=>{ge.globe.style.cursor=o?"pointer":""}).onZoom(()=>{document.dispatchEvent(new Event("atlas:globe-camera")),Vle(),NP(),k6e(),SG()}),document.addEventListener("atlas:selection",O6e),document.addEventListener("atlas:filters",vG),document.addEventListener("atlas:grid",()=>{OP(),vG(),NP()}),document.addEventListener("atlas:labels",NP),Yn.onGlobeClick(({lat:o,lng:a})=>{if(!O.gridEnabled)return;let l=uh(O.world);if(!l)return;let[c,u]=l.toWorld(o,a),f=Ts().descendTarget(O.gridCell,[c,-u]);f&&gA(f)});let s=Yn.controls();s.minDistance=Fx*(1+Ux),s.maxDistance=Fx*(1+zP),Fs.group=new Br,Yn.scene().add(Fs.group),Mo.group=new Br,Yn.scene().add(Mo.group),cu.group=new Br,Yn.scene().add(cu.group),window.__atlasGlobe={detail:Fs,grid:Mo,labels:cu,sprites:Ox}}TG();let e=O.engine?.getView(),t=e?.getCenter();if(t&&Number.isFinite(t[0])&&Number.isFinite(t[1])){let[s,o]=i.toLatLng(t[0],-t[1]);Yn.pointOfView({lat:s,lng:o,altitude:E6e(e.getZoom())})}else Yn.pointOfView({lat:10,lng:0,altitude:KS});let n=O.lens||O.world.lenses[0],r=`${O.volume.stamp}:${O.world.slug}:${n.tiles}`;if(FP!==r){FP=r;let s=await V6e(n);s&&FP===r&&Yn.globeImageUrl(s)}_G!==O.pins&&(_G=O.pins,Ox.clear(),UP.clear(),Yn.objectsData(z6e(i))),vG(),Jle(),Vle(),OP(),NP(),document.dispatchEvent(new Event("atlas:globe-camera"))}function OP(){if(!Yn||!Mo.group)return;for(let t of[...Mo.group.children])Mo.group.remove(t),t.geometry?.dispose(),t.material?.map?.dispose(),t.material?.dispose();let i=O.globeActive?uh(O.world):null;if(!i||!O.gridEnabled){Mo.cell=null;return}let e=Ts();for(let t of IE()){let n=Zle(t.ring,i),r=wG(n),s=RE(t,{subgridVisible:O.subgridVisible,labelled:R6e(t,r)});if(s){if(s.fill){let o=Kle(e.center(t.hash),i);Mo.group.add(I6e(n,o,s.fill))}Mo.group.add(D6e(n,s.line)),s.label&&Mo.group.add(N6e(s.label,r))}}Mo.cell!==null&&Mo.cell!==O.gridCell&&F6e(i),Mo.cell=O.gridCell,SG()}function Zle(i,e){return i.map(([t,n])=>e.toLatLng(t,-n))}function Kle(i,e){return e.toLatLng(i[0],-i[1])}function M6e(i){let e=[];for(let t=0;t<i.length-1;t++){let[n,r]=i[t],[s,o]=i[t+1],a=Math.max(Math.abs(s-n),Math.abs(o-r)),l=cs(Math.ceil(a/2),1,48);for(let c=0;c<l;c++){let u=c/l;e.push([n+(s-n)*u,r+(o-r)*u])}}return e}function wG(i){let e=-1/0,t=1/0,n=1/0,r=-1/0;for(let[s,o]of i)e=Math.max(e,s),t=Math.min(t,s),n=Math.min(n,o),r=Math.max(r,o);return{north:e,south:t,west:n,east:r}}function C6e(i){let e=Yn.pointOfView(),t=Math.max(e.altitude,Ux/2),n=50*Math.PI/180,r=2*t*Fx*Math.tan(n/2)/Math.max(1,ge.globe.clientHeight||1),s=Fx*Math.PI/180/r;return{width:Math.abs(i.east-i.west)*s,height:Math.abs(i.north-i.south)*s}}function R6e(i,e){let n=i.role==="neighbor"?Vi.neighborLabelSizePx:Vi.labelSizePx,r=`900 ${n}px ${Vi.labelFont}`,s=C6e(e);return e5(i.hash,r)+9<=s.width&&n+6<=s.height}function I6e(i,e,t){let n=QS+.12,r=M6e(i),s=wG(i),o=Math.max(s.east-s.west,s.north-s.south),a=cs(Math.ceil(o/6),2,24),l=Bx(e[0],e[1],n),c=r.map(([T,R])=>Bx(T,R,n)),u=[...l],f=[];for(let T=1;T<=a;T++){let R=T/a;for(let P of c){let I=l[0]+(P[0]-l[0])*R,F=l[1]+(P[1]-l[1])*R,D=l[2]+(P[2]-l[2])*R,L=n/(Math.hypot(I,F,D)||1);u.push(I*L,F*L,D*L)}}let d=r.length,A=(T,R)=>1+(T-1)*d+R%d;for(let T=0;T<d;T++)f.push(0,A(1,T),A(1,T+1));for(let T=1;T<a;T++)for(let R=0;R<d;R++)f.push(A(T,R),A(T+1,R),A(T,R+1)),f.push(A(T,R+1),A(T+1,R),A(T+1,R+1));let y=new Xn;y.setAttribute("position",new Ln(u,3)),y.setIndex(f);let w=new fs({color:t.color,transparent:!0,opacity:t.opacity,depthWrite:!1,side:2}),S=new Hn(y,w);return S.renderOrder=1,S}function NP(){if(!Yn||!cu.group)return;let i=O.globeActive&&O.labelsHeld,e=i?Yn.pointOfView():null,t=i?`${Math.round(e.lat)}:${Math.round(e.lng)}:${e.altitude.toFixed(2)}:${O.gridSystem}:${O.gridCell}`:"";if(t===cu.key)return;cu.key=t;for(let r of[...cu.group.children])cu.group.remove(r),r.material?.map?.dispose(),r.material?.dispose();if(!i)return;let n=[];for(let[r,s]of Ox){if(!s.visible)continue;let o=UP.get(r);if(!o)continue;let a=P6e(e,o);a>85||n.push({pin:r,stood:o,distance:a})}n.sort((r,s)=>r.distance-s.distance);for(let{pin:r,stood:s}of n.slice(0,T6e))cu.group.add(L6e(r,s));SG()}function SG(){if(!Yn)return;let i=Yn.camera().position,e=i.length()||1,t=Fx/e;for(let n of[Mo.group,cu.group])if(n)for(let r of n.children){if(!r.isSprite)continue;let s=r.position,o=s.length()||1,a=(s.x*i.x+s.y*i.y+s.z*i.z)/(o*e);r.visible=a>t}}function P6e(i,e){let t=Math.PI/180,n=Math.sin(i.lat*t)*Math.sin(e.lat*t)+Math.cos(i.lat*t)*Math.cos(e.lat*t)*Math.cos((i.lng-e.lng)*t);return Math.acos(cs(n,-1,1))*180/Math.PI}function L6e(i,e){let t=i.location.title,n=document.createElement("canvas"),r=n.getContext("2d"),s="600 26px Inter, system-ui, sans-serif";r.font=s;let o=Math.ceil(r.measureText(t).width)+24;n.width=o,n.height=40,r.font=s,r.textAlign="center",r.textBaseline="middle",r.fillStyle="rgba(10, 13, 17, 0.78)",r.fillRect(0,0,o,40),r.fillStyle="#e6ebf0",r.fillText(t,o/2,21);let a=new Ph({depthTest:!1,depthWrite:!1,sizeAttenuation:!1,transparent:!0});new bl().load(n.toDataURL("image/png"),u=>{a.map=u,a.needsUpdate=!0});let l=new WA(a);l.position.set(...Bx(e.lat,e.lng,QS+.4)),l.renderOrder=4;let c=.028;return l.scale.set(c*o/40,c,1),l.center.set(.5,0),l}function D6e(i,e){let t=[];for(let o=0;o<i.length-1;o++){let[a,l]=i[o],[c,u]=i[o+1],f=Math.max(Math.abs(c-a),Math.abs(u-l)),d=cs(Math.ceil(f/2),4,48);for(let A=0;A<d;A++){let y=A/d;t.push(...Bx(a+(c-a)*y,l+(u-l)*y,QS+.25))}}t.push(...t.slice(0,3));let n=new Em;n.setPositions(t);let r=new Pf({color:e.color,transparent:!0,opacity:e.opacity,linewidth:e.widthPx,depthWrite:!1});r.resolution.set(ge.globe.clientWidth||1,ge.globe.clientHeight||1);let s=new Mx(n,r);return s.computeLineDistances(),s.renderOrder=2,s}function N6e(i,e){let n=i.sizePx*2,r=`500 ${n}px ${Vi.labelFont}`,s=`900 ${n}px ${Vi.labelFont}`,o=document.createElement("canvas"),a=o.getContext("2d");a.font=r;let l=i.prefix?a.measureText(i.prefix).width:0;a.font=s;let c=a.measureText(i.final).width,u=10;o.width=Math.ceil(l+c+u*2),o.height=n+u*1.4,a.fillStyle=i.chip,a.fillRect(0,0,o.width,o.height),a.textBaseline="middle";let f=o.height/2+2;i.prefix&&(a.font=r,a.fillStyle=i.color,a.globalAlpha=Vi.prefixAlpha*i.textAlpha,a.fillText(i.prefix,u,f)),a.font=s,a.globalAlpha=i.textAlpha,a.fillStyle=i.color,a.fillText(i.final,u+l,f),a.globalAlpha=1;let d=new Ph({depthTest:!1,depthWrite:!1,transparent:!0,sizeAttenuation:!1});new bl().load(o.toDataURL("image/png"),R=>{d.map=R,d.needsUpdate=!0});let A=new WA(d),y=Math.abs(e.north-e.south)*.02,w=Math.abs(e.east-e.west)*.02;A.position.set(...Bx(e.south+y,e.east-w,QS+.35));let S=Math.max(1,ge.globe.clientHeight||1),T=o.height/2/S;return A.scale.set(T*o.width/o.height,T,1),A.center.set(1,0),A.renderOrder=3,A}function F6e(i){let t=IE().find(l=>l.role==="scope"||l.role==="leaf");if(!t)return;let[n,r]=Kle(Ts().center(t.hash),i),s=wG(Zle(t.ring,i)),o=Math.max(s.east-s.west,s.north-s.south),a=cs(o/45,Ux,zP);Yn.pointOfView({lat:n,lng:r,altitude:a},400)}function Vle(){if(!Yn||!Fs.group)return;let i=O.globeActive?O.lens||O.world.lenses[0]:null;if(!i){ZS();return}Fs.lens!==i.tiles&&(ZS(),Fs.lens=i.tiles);let e=Yn.pointOfView(),t=Math.min(Math.round(yG(e.altitude))+1,i.maxZoom);if(t<=Gle||!i.formats[t]){ZS(),Fs.key="";return}let n=2**t,r=n/2,s=360/n,o=Math.acos(1/(1+e.altitude))*180/Math.PI+s,a=Math.floor(((e.lng+180)%360+360)%360/s),l=Math.floor((90-e.lat)/s),c=Math.ceil(o/s);for(;(2*c+1)**2>S6e&&c>1;)c--;let u=new Set;for(let d=-c;d<=c;d++){let A=l+d;if(!(A<0||A>=r))for(let y=-c;y<=c;y++){let w=((a+y)%n+n)%n;u.add(`${t}/${w}/${A}`)}}let f=`${i.tiles}:${[...u].sort().join(",")}`;if(f!==Fs.key){Fs.key=f;for(let[d,A]of Fs.tiles)u.has(d)||(Fs.group.remove(A),Qle(A),Fs.tiles.delete(d));for(let d of u){if(Fs.tiles.has(d))continue;let[A,y,w]=d.split("/").map(Number),S=B6e(i,A,y,w);Fs.tiles.set(d,S),Fs.group.add(S)}}}function B6e(i,e,t,n){let r=360/2**e,s=-180+t*r,o=90-n*r,a=[],l=[],c=[];for(let w=0;w<=op;w++){let S=o-w/op*r;for(let T=0;T<=op;T++){let R=s+T/op*r;a.push(...Bx(S,R,QS)),l.push(T/op,1-w/op)}}let u=op+1;for(let w=0;w<op;w++)for(let S=0;S<op;S++){let T=w*u+S;c.push(T,T+u,T+1),c.push(T+1,T+u,T+u+1)}let f=new Xn;f.setAttribute("position",new Ln(a,3)),f.setAttribute("uv",new Ln(l,2)),f.setIndex(c);let d=new fs,A=new Hn(f,d);A.visible=!1;let y=`${O.volume.base}/tiles/${i.tiles}/${e}/${t}/${n}.${i.formats[e]}`;return new bl().load(y,w=>{w.colorSpace=Fr,d.map=w,d.needsUpdate=!0,A.visible=!0}),A}function ZS(){if(Fs.group){for(let i of Fs.tiles.values())Fs.group.remove(i),Qle(i);Fs.tiles.clear(),Fs.key=""}}function Qle(i){i.geometry.dispose(),i.material.map?.dispose(),i.material.dispose()}function Jle(){if(Yn){for(let[i,e]of Ox){let t=i===O.selectedPin;e.material=tce(i.category,t);let n=t?Hle:qle;e.scale.set(n,n,1)}Yn.objectAltitude(i=>i.pin===O.selectedPin?.03:.014)}}function O6e(){if(!Yn||!O.globeActive)return;Jle();let i=UP.get(O.selectedPin);if(i){let e=Yn.pointOfView().altitude;Yn.pointOfView({lat:i.lat,lng:i.lng,altitude:e},600)}}function ece(i){return!(i.filteredHidden||fl(i.category.id)||O.gridEnabled&&O.gridCell&&!Fp(i))}function vG(){if(!(!Yn||!O.globeActive))for(let[i,e]of Ox)e.visible=ece(i)}function U6e(i){let e=new WA(tce(i.category,i===O.selectedPin)),t=i===O.selectedPin?Hle:qle;return e.scale.set(t,t,1),e.visible=ece(i),Ox.set(i,e),e}function tce(i,e){let t=`${Ky(i)}:${e?"ringed":"plain"}`,n=zle.get(t);if(n)return n;n=new Ph({depthWrite:!1,sizeAttenuation:!1}),zle.set(t,n);let r=O.markerIcons.get(Ky(i)),s=o=>{let a=document.createElement("canvas");a.width=80,a.height=80;let l=a.getContext("2d");o?l.drawImage(o,8,8,64,64):(l.font="900 26px Inter, system-ui, sans-serif",l.textAlign="center",l.textBaseline="middle",l.lineWidth=6,l.strokeStyle=fA(),l.strokeText(wu(i.title),40,41),l.fillStyle=pA(i),l.fillText(wu(i.title),40,41)),e&&(l.beginPath(),l.arc(40,40,36,0,Math.PI*2),l.lineWidth=5,l.strokeStyle="#ffffff",l.stroke()),new bl().load(a.toDataURL("image/png"),c=>{n.map=c,n.needsUpdate=!0})};if(r){let o=new Image;o.onload=()=>s(o),o.onerror=()=>s(null),o.src=r}else s(null);return n}function nce(){O.globeActive&&Yle()}function TG(){!Yn||ge.globe.hidden||(Yn.width(ge.globe.clientWidth).height(ge.globe.clientHeight),OP())}function k6e(){if(!Yn||!O.globeActive||!O.gridEnabled)return;let i=Yn.pointOfView(),e=`${O.gridSystem}:${O.gridCell}:${Math.round(yG(i.altitude)*2)}`;e!==Mo.fitKey&&(Mo.fitKey=e,OP())}function z6e(i){let e=[];for(let t of O.pins){let[n,r]=pv(t.location.lat,t.location.lng),[s,o]=i.toLatLng(n,-r);e.push({lat:s,lng:o,pin:t}),UP.set(t,{lat:s,lng:o})}return e}async function V6e(i){let e=Math.min(Gle,i.maxZoom),t=i.formats[e];if(!t)return null;let n=2**e,r=n/2,s=document.createElement("canvas");s.width=n*256,s.height=r*256;let o=s.getContext("2d"),a=[];for(let l=0;l<r;l++)for(let c=0;c<n;c++){let u=`${O.volume.base}/tiles/${i.tiles}/${e}/${c}/${l}.${t}`;a.push(G6e(u).then(f=>{f&&o.drawImage(f,c*256,l*256,256,256)}))}return await Promise.all(a),s.toDataURL("image/jpeg",.92)}function G6e(i){return new Promise(e=>{let t=new Image;t.onload=()=>e(t),t.onerror=()=>e(null),t.src=i})}function ice(){let i=O.lens,e=ge.overviewCanvas,t=e.getContext("2d"),n=kf(),r=O.volume.tileGrid.size,s=O.volume.tileGrid.tileSize,o=n[2]-n[0],a=n[3]-n[1],l=0;for(;l<i.fullZoom&&Math.max(o,a)/r*s*2**l<168;)l++;let c=s*2**l/r;e.width=Math.max(1,Math.round(o*c)),e.height=Math.max(1,Math.round(a*c)),t.clearRect(0,0,e.width,e.height),i.background&&(t.fillStyle=i.background,t.fillRect(0,0,e.width,e.height));let u=++O.overviewRun,f=i.formats[l],d=Math.floor(n[0]/r*2**l),A=Math.ceil(n[2]/r*2**l),y=Math.floor(-n[3]/r*2**l),w=Math.ceil(-n[1]/r*2**l);for(let S=y;S<w;S++)for(let T=d;T<A;T++){if(!f||!GP(i,l,T,S))continue;let R=new Image;R.onload=()=>{O.overviewRun===u&&t.drawImage(R,T*s-n[0]*c,S*s+n[3]*c,s,s)},R.src=`${O.volume.base}/tiles/${encodeURIComponent(i.tiles)}/${l}/${T}/${S}.${f}`}kx()}function kx(){let i=Xle();if(i){let w=uh(O.world);if(!w||!O.lens)return;let S=kf(),[T,R]=w.toWorld(i.lat,i.lng),P=ge.overviewCanvas,I=cs((T-S[0])/(S[2]-S[0]),0,1),F=cs((R+S[3])/(S[3]-S[1]),0,1);O.overviewKey="",ge.overviewShelf.hidden=!1;let D=ge.overviewViewport.style,L=22;D.left=`${I*P.width-L/2}px`,D.top=`${F*P.height-L/2}px`,D.width=`${L}px`,D.height=`${L}px`;return}let e=O.engine?.getView();if(!e||!O.lens)return;let t=kf(),n=e.calculateExtent(O.engine.getSize()),r=t[2]-t[0],s=t[3]-t[1],o=(e.getResolution()||0)*4,a=n[0]<=t[0]+o&&n[1]<=t[1]+o&&n[2]>=t[2]-o&&n[3]>=t[3]-o,l=a?"hidden":n.map(Math.round).join(",");if(l===O.overviewKey||(O.overviewKey=l,ge.overviewShelf.hidden=a,a))return;let c=ge.overviewCanvas,u=cs((n[0]-t[0])/r,0,1),f=cs((n[2]-t[0])/r,0,1),d=cs((t[3]-n[3])/s,0,1),A=cs((t[3]-n[1])/s,0,1),y=ge.overviewViewport.style;y.left=`${u*c.width}px`,y.top=`${d*c.height}px`,y.width=`${Math.max(8,(f-u)*c.width)}px`,y.height=`${Math.max(8,(A-d)*c.height)}px`}function VP(i,e=!0){O.overviewDocked=i,i&&O.overviewPointer!==null&&(O.overviewPointer=null,zx()),ge.overviewShelf.classList.toggle("is-docked",i),ge.overviewDock.setAttribute("aria-expanded",String(!i));let t=i?"Bring the overview back":"Put the overview away";ge.overviewDock.setAttribute("aria-label",t),ge.overviewDock.title=t,e&&Wl()}function EG(i,e){let t=ge.overviewCanvas.getBoundingClientRect(),n=kf(),r=(a,l,c)=>cs((a-l)/(c-l),0,1);if(O.globeActive){let a=uh(O.world);if(!a)return;let l=n[0]+r(i.clientX,t.left,t.right)*(n[2]-n[0]),c=-n[3]+r(i.clientY,t.top,t.bottom)*(n[3]-n[1]),[u,f]=a.toLatLng(l,c);$le(u,f,e);return}let s=O.engine?.getView();if(!s||!O.lens)return;let o=[n[0]+r(i.clientX,t.left,t.right)*(n[2]-n[0]),n[3]-r(i.clientY,t.top,t.bottom)*(n[3]-n[1])];if(e){s.animate({center:o,duration:180});return}s.cancelAnimations(),s.setCenter(o)}function gc(i){return new xY({updateWhileAnimating:!0,...i})}function rce(){let i=O.volume.tileGrid.size,e=[0,-i,i,0];O.projection=new Tp({code:"ATLAS:PIXELS",units:"pixels",extent:e}),O.sources={grid:new vd({wrapX:!1}),gridContext:new vd({wrapX:!1}),zoneScrim:new vd({wrapX:!1}),zones:new vd({wrapX:!1}),zoneTitles:new vd({wrapX:!1}),text:new vd({wrapX:!1}),pins:new vd({wrapX:!1}),priority:new vd({wrapX:!1})},O.layers={raster:new y6({zIndex:0}),rasterDetail:new y6({zIndex:1}),grid:gc({source:O.sources.grid,style:JN,renderOrder:Uc,renderBuffer:40,zIndex:5}),zoneScrim:gc({source:O.sources.zoneScrim,style:EX,zIndex:6}),zones:gc({source:O.sources.zones,style:MX,renderBuffer:32,zIndex:10}),zoneTitles:gc({source:O.sources.zoneTitles,style:CX,renderOrder:Uc,renderBuffer:160,zIndex:20}),zoneTitleDetail:gc({source:O.sources.zoneTitles,style:RX,renderOrder:Uc,renderBuffer:160,zIndex:44}),text:gc({source:O.sources.text,style:xX,renderOrder:Uc,renderBuffer:220,zIndex:30}),textDetail:gc({source:O.sources.text,style:yX,renderOrder:Uc,renderBuffer:220,zIndex:45}),zoneText:gc({source:O.sources.text,style:bX,renderOrder:Uc,renderBuffer:220,zIndex:41}),pins:gc({source:O.sources.pins,style:gX,renderOrder:Uc,renderBuffer:48,zIndex:40}),zonePins:gc({source:O.sources.pins,style:vX,renderOrder:Uc,renderBuffer:48,zIndex:42}),pinLabels:gc({source:O.sources.pins,style:_X,renderOrder:Uc,renderBuffer:180,zIndex:45}),gridContext:gc({source:O.sources.gridContext,style:JN,renderOrder:Uc,renderBuffer:40,zIndex:48}),priority:gc({source:O.sources.priority,style:wX,renderOrder:Uc,renderBuffer:220,zIndex:50})},O.engine=new X$({target:ge.viewport,layers:Object.values(O.layers),controls:$E({attribution:!1,rotate:!1,zoom:!1}),interactions:e3({onFocusOnly:!1}),view:HP(5)}),O.engine.on("movestart",()=>{O.engine.getViewport().classList.add("is-dragging")}),O.engine.on("moveend",()=>{O.engine.getViewport().classList.remove("is-dragging"),O.overviewPointer===null&&zx()}),O.engine.on("postrender",kx),ge.viewport.addEventListener("wheel",()=>{document.activeElement!==ge.viewport&&ge.viewport.focus({preventScroll:!0})},{capture:!0,passive:!0}),O.engine.on("singleclick",t=>{if(O.gridEnabled){let r=O.engine.forEachFeatureAtPixel(t.pixel,s=>{let o=s.get("gridCell");return o&&o.role!=="leaf"&&o.role!=="scope"?o:null},{hitTolerance:1,layerFilter:s=>s===O.layers.grid||s===O.layers.gridContext});if(r){gA(r.hash);return}}let n=O.engine.forEachFeatureAtPixel(t.pixel,(r,s)=>qP(s)&&r.get("pin")||null,{hitTolerance:5,layerFilter:qP});n&&Dy(n)}),O.engine.on("pointermove",t=>{if(t.dragging){mv(null);return}let n=O.engine.forEachFeatureAtPixel(t.pixel,(o,a)=>qP(a)&&o.get("pin")||null,{hitTolerance:4,layerFilter:qP}),r=n&&ch(n.category)==="text"?null:n;mv(r||null);let s=O.gridEnabled&&O.engine.hasFeatureAtPixel(t.pixel,{layerFilter:o=>o===O.layers.grid||o===O.layers.gridContext});O.engine.getTargetElement().style.cursor=n||s?"pointer":""}),O.engine.getViewport().addEventListener("pointerleave",()=>mv(null))}function qP(i){return i===O.layers.pins||i===O.layers.zonePins||i===O.layers.pinLabels||i===O.layers.priority||i===O.layers.text||i===O.layers.textDetail||i===O.layers.zoneText}function HP(i,e=null){let t=O.volume.tileGrid.size,n=e||[0,-t,t,0];return new jl({projection:O.projection,center:[(n[0]+n[2])/2,(n[1]+n[3])/2],resolutions:MG(i),minZoom:0,maxZoom:i,extent:n,constrainResolution:!1,smoothResolutionConstraint:!1,showFullExtent:!0,zoom:0})}function MG(i){let e=O.volume.tileGrid.size/O.volume.tileGrid.tileSize;return Array.from({length:i+1},(t,n)=>e/2**n)}async function ud(i,e){O.volume=O.catalog.volumes.find(r=>r.slug===i)||O.catalog.volumes[0],O.engine||rce(),!e&&!O.restore&&(O.restore=av(O.volume.slug)),ge.volume.value=O.volume.slug,Hm(ge.world,O.volume.worlds,"title"),ge.world.disabled=O.volume.worlds.length===1,ge.world.title=ge.world.disabled?"This volume has one world":"Choose a world";let t=O.restore?.volume===O.volume.slug?O.restore:null,n=e&&O.volume.worlds.find(r=>r.slug===e)||t&&O.volume.worlds.find(r=>r.slug===t.world);await CG((n||O.volume.worlds[0]).slug)}async function CG(i){let e=O.volume.worlds.find(s=>s.slug===i)||O.volume.worlds[0],t=++O.worldRun;ge.loading.hidden=!1;let n;try{n=await ZX(e)}catch(s){console.error(`world ${e.slug} failed to load`,s),O.worldRun===t&&(ge.loading.hidden=!0,wA());return}if(O.worldRun!==t)return;O.settling=!0,O.world=n,document.documentElement.style.setProperty("--icon-outset-color",fA()),ge.world.value=O.world.slug,Hm(ge.lens,O.world.lenses,"name"),ge.lensField.hidden=O.world.lenses.length<2,O.styleCache.clear(),mv(null),O.gridCell="",O.gridSystem="geohash",O.hiddenCollections.clear(),O.labelOverrides.clear(),O.collapsedSections.clear(),O.collapsedSections.add("zones"),O.expandedCollections.clear(),O.expandedCollections.add("zones");for(let s of O.world.groups)for(let o of s.categories)o.visible||O.hiddenCollections.add(o.id);let r=O.restore?.world===O.world.slug?O.restore:null;r&&(O.hiddenCollections=new Set(r.hidden),O.collapsedSections=new Set(r.collapsed),O.expandedCollections=new Set(r.expanded||[]),O.labelOverrides=new Map(r.labels||[])),VP(!!O.restore?.overviewDocked,!1),yE(O.restore?!!O.restore.dockFolded:!0,!1),O.dockDismissed=!!O.restore?.dockDismissed,O.search="",ge.search.value="",ge.dock.hidden=!1,rd(),qX(),r5(),UX(),RG(r?cs(r.lens,0,O.world.lenses.length-1):0,!0),Wle(),O.restore=null,ge.sidebar.classList.remove("is-open"),ge.mobileLegend.setAttribute("aria-expanded","false"),Cj(),O.settling=!1,Wl()}function RG(i,e=!1){let t=O.lens;O.lens=O.world.lenses[i]||O.world.lenses[0];let n=O.lens,r=e?null:W6e(t,n),s=gh(n);if(ge.lens.value=String(O.world.lenses.indexOf(O.lens)),e)O.engine.setView(HP(s,kf()));else{let w=O.engine.getView(),S=HP(s,kf());S.setCenter(w.getCenter()),S.setZoom(w.getZoom()||0),O.engine.setView(S)}let o=++O.tileRun,a=0;O.tileStats={requested:0,loaded:0,errors:0,peakPending:0},ge.loading.hidden=!1;let l=w=>{w.on("tileloadstart",()=>{O.tileRun===o&&(a++,O.tileStats.requested++,O.tileStats.peakPending=Math.max(O.tileStats.peakPending,a))});let S=T=>{O.tileRun===o&&(a=Math.max(0,a-1),T?O.tileStats.errors++:O.tileStats.loaded++,a===0&&O.tileStats.loaded>0&&(ge.loading.hidden=!0))};return w.on("tileloadend",()=>S(!1)),w.on("tileloaderror",()=>S(!0)),w},c=(w,S)=>l(new Ej({projection:O.projection,tileGrid:new Ry({extent:[0,-O.volume.tileGrid.size,O.volume.tileGrid.size,0],origin:[0,0],resolutions:MG(w),tileSize:O.volume.tileGrid.tileSize}),cacheSize:64,interpolate:n.interpolate,transition:0,wrapX:!1,tileUrlFunction:([T,R,P])=>{let I=n.formats[T];if(!(!I||R<0||P<0||!S(T,R,P)))return`${O.volume.base}/tiles/${encodeURIComponent(n.tiles)}/${T}/${R}/${P}.${I}`}})),u=n.fullZoom??n.maxZoom,f=c(u,(w,S,T)=>GP(n,w,S,T)),d=O.layers.raster.getSource();O.layers.raster.setSource(f),O.layers.raster.setExtent(kf()),O.layers.raster.setBackground(n.background||void 0),d?.clear();let A=O.layers.rasterDetail.getSource();n.maxZoom>u?(O.layers.rasterDetail.setSource(c(n.maxZoom,(w,S,T)=>w>u&&GP(n,w,S,T))),O.layers.rasterDetail.setExtent(kf()),O.layers.rasterDetail.setVisible(!0)):O.layers.rasterDetail.setVisible(!1),A?.clear(),Gy(),O.gridEnabled&&(Fc(),O.layers.pins.changed(),O.layers.text.changed(),O.layers.priority.changed()),O.overviewKey="",ice();let y=e&&O.restore?.world===O.world.slug?O.restore:null;if(O.renderedShard!==(n.shard||0)&&(r5(),Nc()),y?.center&&Number.isFinite(y.zoom)){let w=O.engine.getView();w.setCenter(y.center),w.setZoom(y.zoom),O.fitZoom=y.zoom,bA()}else e?requestAnimationFrame(j6e):(r&&O.engine.getView().animate({center:r,duration:200}),bA());Wl()}function GP(i,e,t,n){let r=i.coverage?.[e];if(!r)return!0;let s=t-r.x,o=n-r.y;if(s<0||o<0||s>=r.w||o>=r.h)return!1;let a=H6e(i,e,r),l=o*r.w+s;return(a[l>>3]&1<<(l&7))!==0}function H6e(i,e,t){if(!t.decoded){let n=atob(t.bits),r=new Uint8Array(n.length);for(let s=0;s<n.length;s++)r[s]=n.charCodeAt(s);t.decoded=r}return t.decoded}function gh(i){return i.maxZoom+2}function zx(){bA(),Wl()}function W6e(i,e){if(!i||!e||!i.shard||!e.shard||i.shard===e.shard||!i.bounds||!e.bounds)return null;let n=O.engine?.getView()?.getCenter();if(!n)return null;let r=(n[0]-i.bounds.x)/i.bounds.width,s=(-n[1]-i.bounds.y)/i.bounds.height;return[e.bounds.x+cs(r,0,1)*e.bounds.width,-(e.bounds.y+cs(s,0,1)*e.bounds.height)]}function sce(){let e=document.querySelector(".app-shell").classList.toggle("sidebar-collapsed");ge.mobileLegend.setAttribute("aria-expanded",String(!e)),requestAnimationFrame(()=>O.engine?.updateSize())}function kf(){let i=O.volume.tileGrid.size,e=O.lens?.bounds||{x:0,y:0,width:i,height:i};return[e.x,-(e.y+e.height),e.x+e.width,-e.y]}function j6e(){if(!O.engine||!O.lens)return;let i=O.engine.getView();i.fit(kf(),{size:O.engine.getSize(),padding:[36,36,36,36],maxZoom:O.lens.maxZoom,duration:0}),O.fitZoom=i.getZoom()||0,bA()}function JS(i){let e=O.engine.getView(),t=e.getZoom()||0;e.animate({zoom:cs(t+i,O.lens.minZoom,gh(O.lens)),duration:140})}function bA(){let i=O.engine?.getView().getZoom();if(ge.viewport.dataset.zoom=Number.isFinite(i)?i.toFixed(3):"",!O.engine||!O.world){ge.visibleCount.textContent="0 features enabled";return}let e=O.engine.getView().calculateExtent(O.engine.getSize()),t=O.eligibleLocations,n=0;for(let r of O.pins){if(kc(r))continue;let[s,o]=r.coordinate;s>=e[0]&&s<=e[2]&&o>=e[1]&&o<=e[3]&&n++}if(!fl("zones")){t+=O.zoneRecords.size;for(let r of O.zoneRecords.values())Ar(r.extent,e)&&n++}ge.visibleCount.textContent=`${nd(t)} features enabled \xB7 ${nd(n)} in view`}function oce(){ge.volume.addEventListener("change",()=>{ud(ge.volume.value)}),ge.world.addEventListener("change",()=>{CG(ge.world.value)}),ge.addBundles.addEventListener("click",()=>{f5()}),ge.emptyOpen.addEventListener("click",()=>{f5()}),ge.lens.addEventListener("change",()=>{RG(Number(ge.lens.value)),nce()}),ge.globeToggle.addEventListener("click",()=>kP()),ge.legend.addEventListener("change",n=>{let r=n.target;if(r.dataset.sectionToggle){$X(r.dataset.sectionToggle);return}if(!r.dataset.collection)return;let s=cd(r.dataset.collection);r.checked?O.hiddenCollections.delete(s):O.hiddenCollections.add(s),kp(),Nc(),Ah()});let i=null,e=()=>{for(let s of ge.layers.querySelectorAll(".is-hovered"))s.classList.remove("is-hovered");if(!i)return;let r=document.elementFromPoint(i.x,i.y)?.closest(".category-row, .layer-header");r&&ge.layers.contains(r)&&r.classList.add("is-hovered")};ge.layers.addEventListener("pointermove",n=>{i={x:n.clientX,y:n.clientY},e()},{passive:!0}),ge.layers.addEventListener("pointerleave",()=>{i=null,e()}),ge.layers.addEventListener("scroll",e,{passive:!0}),ge.layers.addEventListener("click",n=>{let r=n.target.closest("[data-only-collection], [data-only-section]");if(r){n.preventDefault(),n.stopPropagation(),YX(r.dataset.onlyCollection?{collection:cd(r.dataset.onlyCollection)}:{section:r.dataset.onlySection});return}let s=n.target.closest("[data-expand-collection]");if(s){n.preventDefault(),n.stopPropagation(),WX(cd(s.dataset.expandCollection));return}let o=n.target.closest("[data-label-toggle]");if(o){n.preventDefault(),n.stopPropagation(),XX(cd(o.dataset.labelToggle));return}let a=n.target.closest("[data-zone]");if(a){BX(Number(a.dataset.zone));return}let l=n.target.closest("[data-section]");if(!l)return;let c=l.dataset.section;O.collapsedSections.has(c)?O.collapsedSections.delete(c):O.collapsedSections.add(c),WE()}),ge.layers.addEventListener("contextmenu",n=>{let r=n.target.closest("[data-zone]");r&&(n.preventDefault(),OX(Number(r.dataset.zone)))}),ge.soloChip.addEventListener("click",()=>Jy(!0)),on("#expand-all").addEventListener("click",()=>u5(!1)),on("#collapse-all").addEventListener("click",()=>u5(!0)),on("#show-all").addEventListener("click",()=>Jy(!0)),on("#hide-all").addEventListener("click",()=>Jy(!1)),ge.search.addEventListener("input",()=>{O.search=ge.search.value.trim().toLocaleLowerCase(),Nc(),O.search&&Ly()}),ge.dockFold.addEventListener("click",()=>{pN(!O.dockFolded)}),ge.searchResults.addEventListener("click",n=>{let r=n.target.closest("[data-location]");if(!r)return;let s=O.pinByID.get(Number(r.dataset.location));s&&mN(s)}),ge.detailLinks.addEventListener("click",n=>{let r=n.target.closest("[data-location]");if(!r)return;let s=O.pinByID.get(Number(r.dataset.location));s&&mN(s)}),on("#close-detail").addEventListener("click",rd),on("#zoom-in").addEventListener("click",()=>O.globeActive?bG(1):JS(1)),on("#zoom-out").addEventListener("click",()=>O.globeActive?bG(-1):JS(-1)),ge.gridBack.addEventListener("click",MN),ge.gridSystem.addEventListener("click",CN),ge.gridInput.addEventListener("input",()=>{let n=Ts(),r=n.normalizeInput(ge.gridInput.value);ge.gridInput.value=r,n.parseInput(r)!==null&&gA(r)}),ge.subgridToggle.addEventListener("click",()=>{Vy(!O.subgridVisible),ge.viewport.focus({preventScroll:!0})}),ge.gridInput.addEventListener("keydown",n=>{if(n.key===" "){n.preventDefault(),Vy(!O.subgridVisible);return}if(n.key==="`"){n.preventDefault(),ge.globeToggle.hidden||kP();return}n.key==="Escape"&&(n.preventDefault(),n.stopPropagation(),ge.viewport.focus({preventScroll:!0}))}),ge.viewport.addEventListener("keydown",n=>{if(!xE(n.target)){if(n.key==="+"||n.key==="=")JS(1);else if(n.key==="-")JS(-1);else if(n.key==="Escape")rd();else return;n.preventDefault()}}),window.addEventListener("contextmenu",n=>{xE(n.target)||n.preventDefault()}),window.addEventListener("keydown",n=>{if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="r"){n.preventDefault(),location.reload();return}if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="g"){n.preventDefault(),CN();return}if(!xE(n.target)){if(n.key==="`"&&!n.metaKey&&!n.ctrlKey&&!n.altKey){ge.globeToggle.hidden||(n.preventDefault(),kP());return}if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="k"){n.preventDefault(),ge.search.focus(),ge.search.select();return}if((n.metaKey||n.ctrlKey)&&n.altKey&&n.code==="KeyB"){n.preventDefault(),ge.dock.hidden||pN(!O.dockFolded);return}if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="b"){n.preventDefault(),sce();return}Yj(n)||n.key.toLocaleLowerCase()==="z"&&(n.preventDefault(),n.repeat||HE(!0))}}),window.addEventListener("keyup",n=>{n.key.toLocaleLowerCase()==="z"&&HE(!1)}),window.addEventListener("blur",()=>HE(!1)),window.addEventListener("hashchange",()=>{let n=lv();n.volume===O.volume?.slug&&n.world===O.world?.slug||(O.restore=null,ud(n.volume||O.catalog.volumes[0].slug,n.world))}),window.addEventListener("resize",()=>{O.engine?.updateSize(),kx(),TG()}),document.addEventListener("atlas:globe-camera",()=>kx()),ge.overview.addEventListener("pointerdown",n=>{O.overviewDocked||n.pointerType==="mouse"&&n.button!==0||(n.preventDefault(),ge.overview.setPointerCapture(n.pointerId),O.overviewPointer=n.pointerId,EG(n,!0))}),ge.overview.addEventListener("pointermove",n=>{O.overviewPointer===n.pointerId&&(n.preventDefault(),EG(n,!1))});let t=n=>{O.overviewPointer===n.pointerId&&(O.overviewPointer=null,zx())};ge.overview.addEventListener("pointerup",t),ge.overview.addEventListener("pointercancel",t),ge.overviewDock.addEventListener("click",()=>{VP(!O.overviewDocked),ge.viewport.focus({preventScroll:!0})}),ge.mobileLegend.addEventListener("click",()=>{let n=ge.sidebar.classList.toggle("is-open");ge.mobileLegend.setAttribute("aria-expanded",String(n))})}function ace(){let i=()=>({volume:O.volume?.title,world:O.world?.title,lens:O.lens?.name,zoom:O.engine?.getView().getZoom(),center:O.engine?.getView().getCenter(),resolution:O.engine?.getView().getResolution(),nativeMaxZoom:O.lens?.maxZoom,maxZoom:O.lens?gh(O.lens):null,interpolate:O.lens?.interpolate,tileStats:{...O.tileStats},pins:O.pins.length,eligibleLocations:O.eligibleLocations,domNodes:document.querySelectorAll("*").length,canvases:document.querySelectorAll("canvas").length,rasterCacheSize:64,labelsHeld:O.labelsHeld,hoveredPin:O.hoveredPin?.location.title||null,selectedPin:O.selectedPin?.location.title||null,fitZoom:O.fitZoom,filters:{hiddenCategories:[...O.hiddenCollections].sort(),collapsedSections:[...O.collapsedSections].sort()},ui:{sidebarCollapsed:document.querySelector(".app-shell")?.classList.contains("sidebar-collapsed")??!1,detailOpen:!ge.detail.hidden,detailTitle:ge.detail.hidden?null:ge.detailTitle.textContent||null,searchQuery:O.search,searchResultsVisible:!ge.searchResults.hidden,soloChip:ge.soloChip.hidden?null:ge.soloChip.textContent,visibleCountText:ge.visibleCount.textContent,overviewDocked:O.overviewDocked,dockFolded:O.dockFolded,dockDismissed:O.dockDismissed,subgridVisible:O.subgridVisible},zones:{visible:!O.hiddenCollections.has("zones"),count:O.zoneRecords.size,focused:O.zoneRecords.get(O.focusedZoneID)?.zone.title||null,highlighted:[...O.highlightedZones].map(e=>O.zoneRecords.get(e)?.zone.title).filter(Boolean),focusedPins:O.pins.filter(e=>!e.filteredHidden&&e.passesZoneFilters).length},grid:{enabled:O.gridEnabled,system:O.gridSystem,prefix:O.gridCell,maximumDepth:Qj(),extent:O.gridEnabled?RN():null,cells:[...O.sources.grid.getFeatures(),...O.sources.gridContext.getFeatures()].map(e=>e.get("gridCell")),priorityPins:O.gridCell?O.pins.filter(e=>!e.filteredHidden&&Fp(e)).length:0}});window.__atlasDebug={snapshot:i,setLayerVisible:(e,t)=>O.layers[e]?.setVisible(t),refreshCatalog:wA},window.render_game_to_text=()=>JSON.stringify({coordinateSystem:"ATLAS:PIXELS; origin top-left; x increases right; y decreases downward",...i()}),window.advanceTime=()=>O.engine?.renderSync()}async function lce(){oce();try{let i=await fetch("/data/catalog.json");if(!i.ok)throw new Error(`catalog request returned ${i.status}`);if(O.catalog=await i.json(),Hm(ge.volume,O.catalog.volumes,"title"),h5(),window.runtime?.EventsOn?.("atlas:catalog-changed",()=>{wA()}),O.catalog.volumes.length){let e=lv(),t=av(),n=t&&(!e.volume||e.volume===t.volume&&e.world===t.world);O.restore=n?t:null,await ud(e.volume||t?.volume||O.catalog.volumes[0].slug,e.world||t?.world),O.restore=null}else ge.loading.hidden=!0;ace(),requestAnimationFrame(()=>ge.viewport.focus({preventScroll:!0}))}catch(i){ge.loading.hidden=!0,ge.fatalMessage.textContent=i instanceof Error?i.message:String(i),ge.fatal.hidden=!1}}lce();})();5289+}`;R6e(I6e);function TG(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function P6e(i){if(Array.isArray(i))return TG(i)}function JS(i,e,t){return(e=O6e(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function L6e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function D6e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.5290+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Hle(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function y1(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Hle(Object(t),!0).forEach(function(n){JS(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Hle(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function N6e(i,e){if(i==null)return{};var t,n,r=F6e(i,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);for(n=0;n<s.length;n++)t=s[n],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(i,t)&&(r[t]=i[t])}return r}function F6e(i,e){if(i==null)return{};var t={};for(var n in i)if({}.hasOwnProperty.call(i,n)){if(e.indexOf(n)!==-1)continue;t[n]=i[n]}return t}function OP(i){return P6e(i)||L6e(i)||U6e(i)||D6e()}function B6e(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function O6e(i){var e=B6e(i,"string");return typeof e=="symbol"?e:e+""}function U6e(i,e){if(i){if(typeof i=="string")return TG(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?TG(i,e):void 0}}function Wle(i,e){var t=new e;return t._destructor&&t._destructor(),{linkProp:function(r){return{default:t[r](),onChange:function(o,a){a[i][r](o)},triggerUpdate:!1}},linkMethod:function(r){return function(s){for(var o=s[i],a=arguments.length,l=new Array(a>1?a-1:0),c=1;c<a;c++)l[c-1]=arguments[c];var u=o[r].apply(o,l);return u===o?this:u}}}}var k6e=["rendererConfig","waitForGlobeReady"],QS=y1(y1({},window.THREE?window.THREE:{AmbientLight:tg,DirectionalLight:eg,Vector2:Oe,REVISION:"185"}),{},{CSS2DRenderer:KM}),jle=Wle("globe",jV),z6e=Object.assign.apply(Object,OP(["globeImageUrl","bumpImageUrl","globeTileEngineUrl","globeTileEngineMaxLevel","globeCurvatureResolution","showGlobe","showGraticules","showAtmosphere","atmosphereColor","atmosphereAltitude","onGlobeReady","pointsData","pointLat","pointLng","pointColor","pointAltitude","pointRadius","pointResolution","pointsMerge","pointsTransitionDuration","arcsData","arcStartLat","arcStartLng","arcStartAltitude","arcEndLat","arcEndLng","arcEndAltitude","arcColor","arcAltitude","arcAltitudeAutoScale","arcStroke","arcCurveResolution","arcCircularResolution","arcDashLength","arcDashGap","arcDashInitialGap","arcDashAnimateTime","arcsTransitionDuration","polygonsData","polygonGeoJsonGeometry","polygonCapColor","polygonCapMaterial","polygonSideColor","polygonSideMaterial","polygonStrokeColor","polygonAltitude","polygonCapCurvatureResolution","polygonsTransitionDuration","pathsData","pathPoints","pathPointLat","pathPointLng","pathPointAlt","pathResolution","pathColor","pathStroke","pathDashLength","pathDashGap","pathDashInitialGap","pathDashAnimateTime","pathTransitionDuration","heatmapsData","heatmapPoints","heatmapPointLat","heatmapPointLng","heatmapPointWeight","heatmapBandwidth","heatmapColorFn","heatmapColorSaturation","heatmapBaseAltitude","heatmapTopAltitude","heatmapsTransitionDuration","hexBinPointsData","hexBinPointLat","hexBinPointLng","hexBinPointWeight","hexBinResolution","hexMargin","hexTopCurvatureResolution","hexTopColor","hexSideColor","hexAltitude","hexBinMerge","hexTransitionDuration","hexPolygonsData","hexPolygonGeoJsonGeometry","hexPolygonColor","hexPolygonAltitude","hexPolygonResolution","hexPolygonMargin","hexPolygonUseDots","hexPolygonCurvatureResolution","hexPolygonDotResolution","hexPolygonsTransitionDuration","tilesData","tileLat","tileLng","tileAltitude","tileWidth","tileHeight","tileUseGlobeProjection","tileMaterial","tileCurvatureResolution","tilesTransitionDuration","particlesData","particlesList","particleLat","particleLng","particleAltitude","particlesSize","particlesSizeAttenuation","particlesColor","particlesTexture","ringsData","ringLat","ringLng","ringAltitude","ringColor","ringResolution","ringMaxRadius","ringPropagationSpeed","ringRepeatPeriod","labelsData","labelLat","labelLng","labelAltitude","labelRotation","labelText","labelSize","labelTypeFace","labelColor","labelResolution","labelIncludeDot","labelDotRadius","labelDotOrientation","labelsTransitionDuration","htmlElementsData","htmlLat","htmlLng","htmlAltitude","htmlElement","htmlElementVisibilityModifier","htmlTransitionDuration","objectsData","objectLat","objectLng","objectAltitude","objectRotation","objectFacesSurface","objectThreeObject","customLayerData","customThreeObject","customThreeObjectUpdate"].map(function(i){return JS({},i,jle.linkProp(i))}))),V6e=Object.assign.apply(Object,OP(["globeMaterial","globeTileEngineClearCache","getGlobeRadius","getCoords","toGeoCoords"].map(function(i){return JS({},i,jle.linkMethod(i))}))),Xle=Wle("renderObjs",SG),G6e=Object.assign.apply(Object,OP(["width","height","backgroundColor","backgroundImageUrl","enablePointerInteraction"].map(function(i){return JS({},i,Xle.linkProp(i))}))),q6e=Object.assign.apply(Object,OP(["lights","postProcessingComposer"].map(function(i){return JS({},i,Xle.linkMethod(i))}))),$le=Kr({props:y1(y1({onZoom:{triggerUpdate:!1},onGlobeClick:{triggerUpdate:!1},onGlobeRightClick:{triggerUpdate:!1},pointLabel:{default:"name",triggerUpdate:!1},onPointClick:{triggerUpdate:!1},onPointRightClick:{triggerUpdate:!1},onPointHover:{triggerUpdate:!1},arcLabel:{default:"name",triggerUpdate:!1},onArcClick:{triggerUpdate:!1},onArcRightClick:{triggerUpdate:!1},onArcHover:{triggerUpdate:!1},polygonLabel:{default:"name",triggerUpdate:!1},onPolygonClick:{triggerUpdate:!1},onPolygonRightClick:{triggerUpdate:!1},onPolygonHover:{triggerUpdate:!1},pathLabel:{default:"name",triggerUpdate:!1},onPathClick:{triggerUpdate:!1},onPathRightClick:{triggerUpdate:!1},onPathHover:{triggerUpdate:!1},onHeatmapClick:{triggerUpdate:!1},onHeatmapRightClick:{triggerUpdate:!1},onHeatmapHover:{triggerUpdate:!1},hexLabel:{triggerUpdate:!1},onHexClick:{triggerUpdate:!1},onHexRightClick:{triggerUpdate:!1},onHexHover:{triggerUpdate:!1},hexPolygonLabel:{triggerUpdate:!1},onHexPolygonClick:{triggerUpdate:!1},onHexPolygonRightClick:{triggerUpdate:!1},onHexPolygonHover:{triggerUpdate:!1},tileLabel:{default:"name",triggerUpdate:!1},onTileClick:{triggerUpdate:!1},onTileRightClick:{triggerUpdate:!1},onTileHover:{triggerUpdate:!1},particleLabel:{default:"name",triggerUpdate:!1},onParticleClick:{triggerUpdate:!1},onParticleRightClick:{triggerUpdate:!1},onParticleHover:{triggerUpdate:!1},labelLabel:{triggerUpdate:!1},onLabelClick:{triggerUpdate:!1},onLabelRightClick:{triggerUpdate:!1},onLabelHover:{triggerUpdate:!1},objectLabel:{default:"name",triggerUpdate:!1},onObjectClick:{triggerUpdate:!1},onObjectRightClick:{triggerUpdate:!1},onObjectHover:{triggerUpdate:!1},customLayerLabel:{default:"name",triggerUpdate:!1},onCustomLayerClick:{triggerUpdate:!1},onCustomLayerRightClick:{triggerUpdate:!1},onCustomLayerHover:{triggerUpdate:!1},pointerEventsFilter:{default:function(){return!0},triggerUpdate:!1},lineHoverPrecision:{default:.2,triggerUpdate:!1,onChange:function(e,t){t.renderObjs.lineHoverPrecision(e),t.renderObjs.pointsHoverPrecision(e)}},showPointerCursor:{default:!0,triggerUpdate:!1},globeOffset:{default:[0,0],triggerUpdate:!1,onChange:function(e,t){return Array.isArray(e)&&e.length===2&&t.renderObjs.viewOffset(e.map(function(n){return-n}))}}},z6e),G6e),methods:y1(y1({pauseAnimation:function(e){var t;return e.animationFrameRequestId!==null&&(cancelAnimationFrame(e.animationFrameRequestId),e.animationFrameRequestId=null),(t=e.globe)===null||t===void 0||t.pauseAnimation(),this},resumeAnimation:function(e){var t;return e.animationFrameRequestId===null&&this._animationCycle(),(t=e.globe)===null||t===void 0||t.resumeAnimation(),this},_animationCycle:function(e){e.renderObjs.tick(),e.tweenGroup.update(),e.animationFrameRequestId=requestAnimationFrame(this._animationCycle)},pointOfView:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=a();if(t.lat===void 0&&t.lng===void 0&&t.altitude===void 0)return r;var s,o=Object.assign({},r,t);if(["lat","lng","altitude"].forEach(function(c){return o[c]=+o[c]}),(s=e.povTween)===null||s===void 0||s.end(),!n)l(o);else{for(;r.lng-o.lng>180;)r.lng-=360;for(;r.lng-o.lng<-180;)r.lng+=360;e.tweenGroup.add(e.povTween=new uo(r).to(o,n).easing(Qr.Cubic.InOut).onUpdate(l).onComplete(function(){e.povTween=void 0,e.tweenGroup.remove(this)}).start())}return this;function a(){return e.globe.toGeoCoords(e.renderObjs.cameraPosition())}function l(c){var u=c.lat,f=c.lng,d=c.altitude;e.renderObjs.cameraPosition(e.globe.getCoords(u,f,d)),e.globe.setPointOfView(e.renderObjs.camera())}},getScreenCoords:function(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];var o=(t=e.globe).getCoords.apply(t,r);return e.renderObjs.getScreenCoords(o.x,o.y,o.z)},toGlobeCoords:function(e,t,n){var r=e.renderObjs.intersectingObjects(t,n).find(function(l){return(l.object.__globeObjType||l.object.parent.__globeObjType)==="globe"});if(!r)return null;var s=e.globe.toGeoCoords(r.point),o=s.lat,a=s.lng;return{lat:o,lng:a}},scene:function(e){return e.renderObjs.scene()},camera:function(e){return e.renderObjs.camera()},renderer:function(e){return e.renderObjs.renderer()},controls:function(e){return e.renderObjs.controls()},_destructor:function(e){this.pauseAnimation(),this.pointsData([]),this.arcsData([]),this.polygonsData([]),this.pathsData([]),this.heatmapsData([]),this.hexBinPointsData([]),this.hexPolygonsData([]),this.tilesData([]),this.particlesData([]),this.labelsData([]),this.htmlElementsData([]),this.objectsData([]),this.customLayerData([]),e.globe._destructor(),e.renderObjs._destructor()}},V6e),q6e),stateInit:function(e){var t=e.rendererConfig,n=e.waitForGlobeReady,r=n===void 0?!0:n,s=N6e(e,k6e),o=new jV(y1({waitForGlobeReady:r},s));return{globe:o,renderObjs:SG({controlType:"orbit",rendererConfig:t,waitForLoadComplete:r,extraRenderers:[new QS.CSS2DRenderer]}).skyRadius(o.getGlobeRadius()*500).showNavInfo(!1).objects([o]).lights([new QS.AmbientLight(13421772,Math.PI),new QS.DirectionalLight(16777215,.6*Math.PI)]),tweenGroup:new vg}},init:function(e,t){var n=this;e.innerHTML="",e.appendChild(t.container=document.createElement("div")),t.container.style.position="relative";var r=document.createElement("div");t.container.appendChild(r),t.renderObjs(r),t.globe.rendererSize(t.renderObjs.renderer().getSize(new QS.Vector2)),this.pointOfView({altitude:2.5});var s=t.globe.getGlobeRadius(),o=t.renderObjs.controls();t.renderObjs.camera().near=.05,o.minDistance=s+Math.max(.001,t.renderObjs.camera().near*1.1),o.maxDistance=s*100,o.enablePan=!1,o.enableDamping=!0,o.dampingFactor=.1,o.rotateSpeed=.3,o.zoomSpeed=.3,o.zoomToCursor=!0,o.addEventListener("change",function(){o.target.setScalar(0);var c=n.pointOfView();o.rotateSpeed=c.altitude*.3,o.zoomSpeed=Math.sqrt(c.altitude)*.5,t.globe.setPointOfView(t.renderObjs.camera()),t.onZoom&&t.onZoom(c)});var a=function(u){for(var f=u;f&&!f.hasOwnProperty("__globeObjType");)f=f.parent;return f},l={point:function(u){return u},arc:function(u){return u},polygon:function(u){return u.data},path:function(u){return u},heatmap:function(u){return u},hexbin:function(u){return u},hexPolygon:function(u){return u},tile:function(u){return u},particles:function(u,f){return!f||!f.hasOwnProperty("index")||u.length<=f.index?u:u[f.index]},label:function(u){return u},object:function(u){return u},custom:function(u){return u}};QS.REVISION<155&&(t.renderObjs.renderer().useLegacyLights=!1),t.renderObjs.hoverFilter(function(c){var u=a(c);if(!u)return!1;var f=u.__globeObjType;if(f!=="globe"&&!l.hasOwnProperty(f))return!1;var d=l.hasOwnProperty(f)&&u.__data?l[f](u.__data):null;return["points","hexBinPoints"].some(function(A){return A===f})&&Array.isArray(d)?!1:t.pointerEventsFilter(u,d)}).tooltipContent(function(c,u){var f={point:t.pointLabel,arc:t.arcLabel,polygon:t.polygonLabel,path:t.pathLabel,hexbin:t.hexLabel,hexPolygon:t.hexPolygonLabel,tile:t.tileLabel,particles:t.particleLabel,label:t.labelLabel,object:t.objectLabel,custom:t.customLayerLabel},d=a(c),A=d&&d.__globeObjType;return d&&A&&f.hasOwnProperty(A)&&l.hasOwnProperty(A)&&st(f[A])(l[A](d.__data,u))||""}).onHover(function(c,u,f){var d={point:t.onPointHover,arc:t.onArcHover,polygon:t.onPolygonHover,path:t.onPathHover,heatmap:t.onHeatmapHover,hexbin:t.onHexHover,hexPolygon:t.onHexPolygonHover,tile:t.onTileHover,particles:t.onParticleHover,label:t.onLabelHover,object:t.onObjectHover,custom:t.onCustomLayerHover},A={globe:t.onGlobeClick,point:t.onPointClick,arc:t.onArcClick,polygon:t.onPolygonClick,path:t.onPathClick,heatmap:t.onHeatmapClick,hexbin:t.onHexClick,hexPolygon:t.onHexPolygonClick,tile:t.onTileClick,particles:t.onParticleClick,label:t.onLabelClick,object:t.onObjectClick,custom:t.onCustomLayerClick},y=a(c);if(y&&!d.hasOwnProperty(y.__globeObjType)&&(y=null),y!==t.hoverObj){var w,S=t.hoverObj?t.hoverObj.__globeObjType:null,T=t.hoverData,R=y?y.__globeObjType:null,P=(w=y)!==null&&w!==void 0&&w.__data?l[R](y.__data,f):null;S&&S!==R&&d[S]&&d[S](null,T||null),R&&d[R]&&d[R](P,S===R?T:null),t.renderObjs.renderer().domElement.classList[R&&A[R]&&st(t.showPointerCursor)(R,P)?"add":"remove"]("clickable"),t.hoverObj=y,t.hoverData=P}}).onClick(function(c,u,f){if(c){var d={globe:t.onGlobeClick,point:t.onPointClick,arc:t.onArcClick,polygon:t.onPolygonClick,path:t.onPathClick,heatmap:t.onHeatmapClick,hexbin:t.onHexClick,hexPolygon:t.onHexPolygonClick,tile:t.onTileClick,particles:t.onParticleClick,label:t.onLabelClick,object:t.onObjectClick,custom:t.onCustomLayerClick},A=a(c),y=A.__globeObjType;if(A&&d.hasOwnProperty(y)&&d[y]){var w=[u],S=f!=null&&f.isVector3?f:f?.point;if(y==="globe"){var T=n.toGeoCoords(S),R=T.lat,P=T.lng;w.unshift({lat:R,lng:P})}else w.push(n.toGeoCoords(S));l.hasOwnProperty(y)&&w.unshift(l[y](A.__data,f)),d[y].apply(d,w)}}}).onRightClick(function(c,u,f){if(c){var d={globe:t.onGlobeRightClick,point:t.onPointRightClick,arc:t.onArcRightClick,polygon:t.onPolygonRightClick,path:t.onPathRightClick,heatmap:t.onHeatmapRightClick,hexbin:t.onHexRightClick,hexPolygon:t.onHexPolygonRightClick,tile:t.onTileRightClick,particles:t.onParticleRightClick,label:t.onLabelRightClick,object:t.onObjectRightClick,custom:t.onCustomLayerRightClick},A=a(c),y=A.__globeObjType;if(A&&d.hasOwnProperty(y)&&d[y]){var w=[u],S=f!=null&&f.isVector3?f:f?.point;if(y==="globe"){var T=n.toGeoCoords(S),R=T.lat,P=T.lng;w.unshift({lat:R,lng:P})}else w.push(n.toGeoCoords(S));l.hasOwnProperty(y)&&w.unshift(l[y](A.__data,f)),d[y].apply(d,w)}}}),this._animationCycle()}});var Kle=4,Ox=100,nT=Ox+.2,sp=8,H6e=96,Qle=.045,Jle=.08;function Ux(i,e,t){let n=(90-i)*Math.PI/180,r=(90-e)*Math.PI/180;return[t*Math.sin(n)*Math.cos(r),t*Math.cos(n),t*Math.sin(n)*Math.sin(r)]}var Yn=null,kP="",Fs={group:null,tiles:new Map,key:"",lens:""},Mo={group:null,cell:null,fitKey:""},uu={group:null,key:""},W6e=180,MG=null,kx=new Map,GP=new Map,Yle=new Map;function ece(){let i=VT(O.world)==="sphere"&&hh(O.world)!==null;ge.globeToggle.hidden=!i,tce(),!i&&Yn&&(eT(),Fs.group=null,Mo.group=null,Mo.cell=null,uu.group=null,uu.key="",Yn._destructor(),Yn=null,kP="",MG=null,ge.globe.replaceChildren())}function qP(){O.globeActive?tce():rce()}var tT=2.5,zP=2,zx=.08,HP=4;function j6e(i){let e=Number.isFinite(i)?i:zP;return cs(tT/2**(e-zP),zx,HP)}function RG(i){let e=Number.isFinite(i)?Math.max(i,zx/2):tT,t=(O.lens?.maxZoom??zP)+2;return cs(zP+Math.log2(tT/e),0,t)}function IG(i){if(!Yn||!O.globeActive)return;let e=Yn.pointOfView(),t=cs((Number.isFinite(e.altitude)?e.altitude:tT)/2**i,zx,HP);Yn.pointOfView({altitude:t},180)}function tce(){let i=hh(O.world),e=O.engine?.getView();if(Yn&&O.globeActive&&i&&e){let t=Yn.pointOfView(),[n,r]=i.toWorld(t.lat,t.lng);Number.isFinite(n)&&Number.isFinite(r)&&(e.cancelAnimations(),e.setCenter([n,-r]),e.setZoom(RG(t.altitude)))}O.globeActive=!1,ge.globe.hidden=!0,ge.globeToggle.setAttribute("aria-pressed","false"),ge.viewport.hidden=!1,eT(),O.overviewKey="",document.dispatchEvent(new Event("atlas:globe-camera"))}function nce(){if(!Yn||!O.globeActive)return null;let i=Yn.pointOfView();return{lat:i.lat,lng:i.lng}}function ice(i,e,t){if(!Yn)return;let n=Yn.pointOfView().altitude;Yn.pointOfView({lat:i,lng:e,altitude:n},t?180:0)}async function rce(){let i=hh(O.world);if(!i)return;if(O.globeActive=!0,ge.viewport.hidden=!0,ge.globe.hidden=!1,ge.globeToggle.setAttribute("aria-pressed","true"),O.overviewKey="",!Yn){Yn=$le({animateIn:!1})(ge.globe).backgroundColor("#0b0e12").showAtmosphere(!0).atmosphereColor("#8a6f5b").atmosphereAltitude(.12).objectLat(o=>o.lat).objectLng(o=>o.lng).objectAltitude(o=>o.pin===O.selectedPin?.03:.014).objectThreeObject(o=>r8e(o.pin)).objectLabel(o=>o.pin.location.title).onObjectClick(o=>By(o.pin)).onObjectHover(o=>{ge.globe.style.cursor=o?"pointer":""}).onZoom(()=>{document.dispatchEvent(new Event("atlas:globe-camera")),Zle(),UP(),s8e(),LG()}),document.addEventListener("atlas:selection",i8e),document.addEventListener("atlas:filters",EG),document.addEventListener("atlas:grid",()=>{VP(),EG(),UP()}),document.addEventListener("atlas:labels",UP),Yn.onGlobeClick(({lat:o,lng:a})=>{if(!O.gridEnabled)return;let l=hh(O.world);if(!l)return;let[c,u]=l.toWorld(o,a),f=Ts().descendTarget(O.gridCell,[c,-u]);f&&gA(f)});let s=Yn.controls();s.minDistance=Ox*(1+zx),s.maxDistance=Ox*(1+HP),Fs.group=new Br,Yn.scene().add(Fs.group),Mo.group=new Br,Yn.scene().add(Mo.group),uu.group=new Br,Yn.scene().add(uu.group),window.__atlasGlobe={detail:Fs,grid:Mo,labels:uu,sprites:kx}}DG();let e=O.engine?.getView(),t=e?.getCenter();if(t&&Number.isFinite(t[0])&&Number.isFinite(t[1])){let[s,o]=i.toLatLng(t[0],-t[1]);Yn.pointOfView({lat:s,lng:o,altitude:j6e(e.getZoom())})}else Yn.pointOfView({lat:10,lng:0,altitude:tT});let n=O.lens||O.world.lenses[0],r=`${O.volume.stamp}:${O.world.slug}:${n.tiles}`;if(kP!==r){kP=r;let s=await a8e(n);s&&kP===r&&Yn.globeImageUrl(s)}MG!==O.pins&&(MG=O.pins,kx.clear(),GP.clear(),Yn.objectsData(o8e(i))),EG(),lce(),Zle(),VP(),UP(),document.dispatchEvent(new Event("atlas:globe-camera"))}function VP(){if(!Yn||!Mo.group)return;for(let t of[...Mo.group.children])Mo.group.remove(t),t.geometry?.dispose(),t.material?.map?.dispose(),t.material?.dispose();let i=O.globeActive?hh(O.world):null;if(!i||!O.gridEnabled){Mo.cell=null;return}let e=Ts();for(let t of NE()){let n=sce(t.ring,i),r=PG(n),s=DE(t,{subgridVisible:O.subgridVisible,labelled:Y6e(t,r)});if(s){if(s.fill){let o=oce(e.center(t.hash),i);Mo.group.add(Z6e(n,o,s.fill))}Mo.group.add(J6e(n,s.line)),s.label&&Mo.group.add(e8e(s.label,r))}}Mo.cell!==null&&Mo.cell!==O.gridCell&&t8e(i),Mo.cell=O.gridCell,LG()}function sce(i,e){return i.map(([t,n])=>e.toLatLng(t,-n))}function oce(i,e){return e.toLatLng(i[0],-i[1])}function X6e(i){let e=[];for(let t=0;t<i.length-1;t++){let[n,r]=i[t],[s,o]=i[t+1],a=Math.max(Math.abs(s-n),Math.abs(o-r)),l=cs(Math.ceil(a/2),1,48);for(let c=0;c<l;c++){let u=c/l;e.push([n+(s-n)*u,r+(o-r)*u])}}return e}function PG(i){let e=-1/0,t=1/0,n=1/0,r=-1/0;for(let[s,o]of i)e=Math.max(e,s),t=Math.min(t,s),n=Math.min(n,o),r=Math.max(r,o);return{north:e,south:t,west:n,east:r}}function $6e(i){let e=Yn.pointOfView(),t=Math.max(e.altitude,zx/2),n=50*Math.PI/180,r=2*t*Ox*Math.tan(n/2)/Math.max(1,ge.globe.clientHeight||1),s=Ox*Math.PI/180/r;return{width:Math.abs(i.east-i.west)*s,height:Math.abs(i.north-i.south)*s}}function Y6e(i,e){let n=i.role==="neighbor"?Vi.neighborLabelSizePx:Vi.labelSizePx,r=`900 ${n}px ${Vi.labelFont}`,s=$6e(e);return l5(i.hash,r)+9<=s.width&&n+6<=s.height}function Z6e(i,e,t){let n=nT+.12,r=X6e(i),s=PG(i),o=Math.max(s.east-s.west,s.north-s.south),a=cs(Math.ceil(o/6),2,24),l=Ux(e[0],e[1],n),c=r.map(([T,R])=>Ux(T,R,n)),u=[...l],f=[];for(let T=1;T<=a;T++){let R=T/a;for(let P of c){let I=l[0]+(P[0]-l[0])*R,F=l[1]+(P[1]-l[1])*R,D=l[2]+(P[2]-l[2])*R,L=n/(Math.hypot(I,F,D)||1);u.push(I*L,F*L,D*L)}}let d=r.length,A=(T,R)=>1+(T-1)*d+R%d;for(let T=0;T<d;T++)f.push(0,A(1,T),A(1,T+1));for(let T=1;T<a;T++)for(let R=0;R<d;R++)f.push(A(T,R),A(T+1,R),A(T,R+1)),f.push(A(T,R+1),A(T+1,R),A(T+1,R+1));let y=new Xn;y.setAttribute("position",new Ln(u,3)),y.setIndex(f);let w=new fs({color:t.color,transparent:!0,opacity:t.opacity,depthWrite:!1,side:2}),S=new Hn(y,w);return S.renderOrder=1,S}function UP(){if(!Yn||!uu.group)return;let i=O.globeActive&&O.labelsHeld,e=i?Yn.pointOfView():null,t=i?`${Math.round(e.lat)}:${Math.round(e.lng)}:${e.altitude.toFixed(2)}:${O.gridSystem}:${O.gridCell}`:"";if(t===uu.key)return;uu.key=t;for(let r of[...uu.group.children])uu.group.remove(r),r.material?.map?.dispose(),r.material?.dispose();if(!i)return;let n=[];for(let[r,s]of kx){if(!s.visible)continue;let o=GP.get(r);if(!o)continue;let a=K6e(e,o);a>85||n.push({pin:r,stood:o,distance:a})}n.sort((r,s)=>r.distance-s.distance);for(let{pin:r,stood:s}of n.slice(0,W6e))uu.group.add(Q6e(r,s));LG()}function LG(){if(!Yn)return;let i=Yn.camera().position,e=i.length()||1,t=Ox/e;for(let n of[Mo.group,uu.group])if(n)for(let r of n.children){if(!r.isSprite)continue;let s=r.position,o=s.length()||1,a=(s.x*i.x+s.y*i.y+s.z*i.z)/(o*e);r.visible=a>t}}function K6e(i,e){let t=Math.PI/180,n=Math.sin(i.lat*t)*Math.sin(e.lat*t)+Math.cos(i.lat*t)*Math.cos(e.lat*t)*Math.cos((i.lng-e.lng)*t);return Math.acos(cs(n,-1,1))*180/Math.PI}function Q6e(i,e){let t=i.location.title,n=document.createElement("canvas"),r=n.getContext("2d"),s="600 26px Inter, system-ui, sans-serif";r.font=s;let o=Math.ceil(r.measureText(t).width)+24;n.width=o,n.height=40,r.font=s,r.textAlign="center",r.textBaseline="middle",r.fillStyle="rgba(10, 13, 17, 0.78)",r.fillRect(0,0,o,40),r.fillStyle="#e6ebf0",r.fillText(t,o/2,21);let a=new Lh({depthTest:!1,depthWrite:!1,sizeAttenuation:!1,transparent:!0});new bl().load(n.toDataURL("image/png"),u=>{a.map=u,a.needsUpdate=!0});let l=new WA(a);l.position.set(...Ux(e.lat,e.lng,nT+.4)),l.renderOrder=4;let c=.028;return l.scale.set(c*o/40,c,1),l.center.set(.5,0),l}function J6e(i,e){let t=[];for(let o=0;o<i.length-1;o++){let[a,l]=i[o],[c,u]=i[o+1],f=Math.max(Math.abs(c-a),Math.abs(u-l)),d=cs(Math.ceil(f/2),4,48);for(let A=0;A<d;A++){let y=A/d;t.push(...Ux(a+(c-a)*y,l+(u-l)*y,nT+.25))}}t.push(...t.slice(0,3));let n=new Em;n.setPositions(t);let r=new Lf({color:e.color,transparent:!0,opacity:e.opacity,linewidth:e.widthPx,depthWrite:!1});r.resolution.set(ge.globe.clientWidth||1,ge.globe.clientHeight||1);let s=new Rx(n,r);return s.computeLineDistances(),s.renderOrder=2,s}function e8e(i,e){let n=i.sizePx*2,r=`500 ${n}px ${Vi.labelFont}`,s=`900 ${n}px ${Vi.labelFont}`,o=document.createElement("canvas"),a=o.getContext("2d");a.font=r;let l=i.prefix?a.measureText(i.prefix).width:0;a.font=s;let c=a.measureText(i.final).width,u=10;o.width=Math.ceil(l+c+u*2),o.height=n+u*1.4,a.fillStyle=i.chip,a.fillRect(0,0,o.width,o.height),a.textBaseline="middle";let f=o.height/2+2;i.prefix&&(a.font=r,a.fillStyle=i.color,a.globalAlpha=Vi.prefixAlpha*i.textAlpha,a.fillText(i.prefix,u,f)),a.font=s,a.globalAlpha=i.textAlpha,a.fillStyle=i.color,a.fillText(i.final,u+l,f),a.globalAlpha=1;let d=new Lh({depthTest:!1,depthWrite:!1,transparent:!0,sizeAttenuation:!1});new bl().load(o.toDataURL("image/png"),R=>{d.map=R,d.needsUpdate=!0});let A=new WA(d),y=Math.abs(e.north-e.south)*.02,w=Math.abs(e.east-e.west)*.02;A.position.set(...Ux(e.south+y,e.east-w,nT+.35));let S=Math.max(1,ge.globe.clientHeight||1),T=o.height/2/S;return A.scale.set(T*o.width/o.height,T,1),A.center.set(1,0),A.renderOrder=3,A}function t8e(i){let t=NE().find(l=>l.role==="scope"||l.role==="leaf");if(!t)return;let[n,r]=oce(Ts().center(t.hash),i),s=PG(sce(t.ring,i)),o=Math.max(s.east-s.west,s.north-s.south),a=cs(o/45,zx,HP);Yn.pointOfView({lat:n,lng:r,altitude:a},400)}function Zle(){if(!Yn||!Fs.group)return;let i=O.globeActive?O.lens||O.world.lenses[0]:null;if(!i){eT();return}Fs.lens!==i.tiles&&(eT(),Fs.lens=i.tiles);let e=Yn.pointOfView(),t=Math.min(Math.round(RG(e.altitude))+1,i.maxZoom);if(t<=Kle||!i.formats[t]){eT(),Fs.key="";return}let n=2**t,r=n/2,s=360/n,o=Math.acos(1/(1+e.altitude))*180/Math.PI+s,a=Math.floor(((e.lng+180)%360+360)%360/s),l=Math.floor((90-e.lat)/s),c=Math.ceil(o/s);for(;(2*c+1)**2>H6e&&c>1;)c--;let u=new Set;for(let d=-c;d<=c;d++){let A=l+d;if(!(A<0||A>=r))for(let y=-c;y<=c;y++){let w=((a+y)%n+n)%n;u.add(`${t}/${w}/${A}`)}}let f=`${i.tiles}:${[...u].sort().join(",")}`;if(f!==Fs.key){Fs.key=f;for(let[d,A]of Fs.tiles)u.has(d)||(Fs.group.remove(A),ace(A),Fs.tiles.delete(d));for(let d of u){if(Fs.tiles.has(d))continue;let[A,y,w]=d.split("/").map(Number),S=n8e(i,A,y,w);Fs.tiles.set(d,S),Fs.group.add(S)}}}function n8e(i,e,t,n){let r=360/2**e,s=-180+t*r,o=90-n*r,a=[],l=[],c=[];for(let w=0;w<=sp;w++){let S=o-w/sp*r;for(let T=0;T<=sp;T++){let R=s+T/sp*r;a.push(...Ux(S,R,nT)),l.push(T/sp,1-w/sp)}}let u=sp+1;for(let w=0;w<sp;w++)for(let S=0;S<sp;S++){let T=w*u+S;c.push(T,T+u,T+1),c.push(T+1,T+u,T+u+1)}let f=new Xn;f.setAttribute("position",new Ln(a,3)),f.setAttribute("uv",new Ln(l,2)),f.setIndex(c);let d=new fs,A=new Hn(f,d);A.visible=!1;let y=`${O.volume.base}/tiles/${i.tiles}/${e}/${t}/${n}.${i.formats[e]}`;return new bl().load(y,w=>{w.colorSpace=Fr,d.map=w,d.needsUpdate=!0,A.visible=!0}),A}function eT(){if(Fs.group){for(let i of Fs.tiles.values())Fs.group.remove(i),ace(i);Fs.tiles.clear(),Fs.key=""}}function ace(i){i.geometry.dispose(),i.material.map?.dispose(),i.material.dispose()}function lce(){if(Yn){for(let[i,e]of kx){let t=i===O.selectedPin;e.material=uce(i.category,t);let n=t?Jle:Qle;e.scale.set(n,n,1)}Yn.objectAltitude(i=>i.pin===O.selectedPin?.03:.014)}}function i8e(){if(!Yn||!O.globeActive)return;lce();let i=GP.get(O.selectedPin);if(i){let e=Yn.pointOfView().altitude;Yn.pointOfView({lat:i.lat,lng:i.lng,altitude:e},600)}}function cce(i){return!(i.filteredHidden||Pa(i.category.id)||O.gridEnabled&&O.gridCell&&!Fp(i))}function EG(){if(!(!Yn||!O.globeActive))for(let[i,e]of kx)e.visible=cce(i)}function r8e(i){let e=new WA(uce(i.category,i===O.selectedPin)),t=i===O.selectedPin?Jle:Qle;return e.scale.set(t,t,1),e.visible=cce(i),kx.set(i,e),e}function uce(i,e){let t=`${t2(i)}:${e?"ringed":"plain"}`,n=Yle.get(t);if(n)return n;n=new Lh({depthWrite:!1,sizeAttenuation:!1}),Yle.set(t,n);let r=O.markerIcons.get(t2(i)),s=o=>{let a=document.createElement("canvas");a.width=80,a.height=80;let l=a.getContext("2d");o?l.drawImage(o,8,8,64,64):(l.font="900 26px Inter, system-ui, sans-serif",l.textAlign="center",l.textBaseline="middle",l.lineWidth=6,l.strokeStyle=fA(),l.strokeText(Su(i.title),40,41),l.fillStyle=pA(i),l.fillText(Su(i.title),40,41)),e&&(l.beginPath(),l.arc(40,40,36,0,Math.PI*2),l.lineWidth=5,l.strokeStyle="#ffffff",l.stroke()),new bl().load(a.toDataURL("image/png"),c=>{n.map=c,n.needsUpdate=!0})};if(r){let o=new Image;o.onload=()=>s(o),o.onerror=()=>s(null),o.src=r}else s(null);return n}function hce(){O.globeActive&&rce()}function DG(){!Yn||ge.globe.hidden||(Yn.width(ge.globe.clientWidth).height(ge.globe.clientHeight),VP())}function s8e(){if(!Yn||!O.globeActive||!O.gridEnabled)return;let i=Yn.pointOfView(),e=`${O.gridSystem}:${O.gridCell}:${Math.round(RG(i.altitude)*2)}`;e!==Mo.fitKey&&(Mo.fitKey=e,VP())}function o8e(i){let e=[];for(let t of O.pins){let[n,r]=Av(t.location.lat,t.location.lng),[s,o]=i.toLatLng(n,-r);e.push({lat:s,lng:o,pin:t}),GP.set(t,{lat:s,lng:o})}return e}async function a8e(i){let e=Math.min(Kle,i.maxZoom),t=i.formats[e];if(!t)return null;let n=2**e,r=n/2,s=document.createElement("canvas");s.width=n*256,s.height=r*256;let o=s.getContext("2d"),a=[];for(let l=0;l<r;l++)for(let c=0;c<n;c++){let u=`${O.volume.base}/tiles/${i.tiles}/${e}/${c}/${l}.${t}`;a.push(l8e(u).then(f=>{f&&o.drawImage(f,c*256,l*256,256,256)}))}return await Promise.all(a),s.toDataURL("image/jpeg",.92)}function l8e(i){return new Promise(e=>{let t=new Image;t.onload=()=>e(t),t.onerror=()=>e(null),t.src=i})}function fce(){let i=O.lens,e=ge.overviewCanvas,t=e.getContext("2d"),n=zf(),r=O.volume.tileGrid.size,s=O.volume.tileGrid.tileSize,o=n[2]-n[0],a=n[3]-n[1],l=0;for(;l<i.fullZoom&&Math.max(o,a)/r*s*2**l<168;)l++;let c=s*2**l/r;e.width=Math.max(1,Math.round(o*c)),e.height=Math.max(1,Math.round(a*c)),t.clearRect(0,0,e.width,e.height),i.background&&(t.fillStyle=i.background,t.fillRect(0,0,e.width,e.height));let u=++O.overviewRun,f=i.formats[l],d=Math.floor(n[0]/r*2**l),A=Math.ceil(n[2]/r*2**l),y=Math.floor(-n[3]/r*2**l),w=Math.ceil(-n[1]/r*2**l);for(let S=y;S<w;S++)for(let T=d;T<A;T++){if(!f||!jP(i,l,T,S))continue;let R=new Image;R.onload=()=>{O.overviewRun===u&&t.drawImage(R,T*s-n[0]*c,S*s+n[3]*c,s,s)},R.src=`${O.volume.base}/tiles/${encodeURIComponent(i.tiles)}/${l}/${T}/${S}.${f}`}Vx()}function Vx(){let i=nce();if(i){let w=hh(O.world);if(!w||!O.lens)return;let S=zf(),[T,R]=w.toWorld(i.lat,i.lng),P=ge.overviewCanvas,I=cs((T-S[0])/(S[2]-S[0]),0,1),F=cs((R+S[3])/(S[3]-S[1]),0,1);O.overviewKey="",ge.overviewShelf.hidden=!1;let D=ge.overviewViewport.style,L=22;D.left=`${I*P.width-L/2}px`,D.top=`${F*P.height-L/2}px`,D.width=`${L}px`,D.height=`${L}px`;return}let e=O.engine?.getView();if(!e||!O.lens)return;let t=zf(),n=e.calculateExtent(O.engine.getSize()),r=t[2]-t[0],s=t[3]-t[1],o=(e.getResolution()||0)*4,a=n[0]<=t[0]+o&&n[1]<=t[1]+o&&n[2]>=t[2]-o&&n[3]>=t[3]-o,l=a?"hidden":n.map(Math.round).join(",");if(l===O.overviewKey||(O.overviewKey=l,ge.overviewShelf.hidden=a,a))return;let c=ge.overviewCanvas,u=cs((n[0]-t[0])/r,0,1),f=cs((n[2]-t[0])/r,0,1),d=cs((t[3]-n[3])/s,0,1),A=cs((t[3]-n[1])/s,0,1),y=ge.overviewViewport.style;y.left=`${u*c.width}px`,y.top=`${d*c.height}px`,y.width=`${Math.max(8,(f-u)*c.width)}px`,y.height=`${Math.max(8,(A-d)*c.height)}px`}function WP(i,e=!0){O.overviewDocked=i,i&&O.overviewPointer!==null&&(O.overviewPointer=null,Gx()),ge.overviewShelf.classList.toggle("is-docked",i),ge.overviewDock.setAttribute("aria-expanded",String(!i));let t=i?"Bring the overview back":"Put the overview away";ge.overviewDock.setAttribute("aria-label",t),ge.overviewDock.title=t,e&&Wl()}function NG(i,e){let t=ge.overviewCanvas.getBoundingClientRect(),n=zf(),r=(a,l,c)=>cs((a-l)/(c-l),0,1);if(O.globeActive){let a=hh(O.world);if(!a)return;let l=n[0]+r(i.clientX,t.left,t.right)*(n[2]-n[0]),c=-n[3]+r(i.clientY,t.top,t.bottom)*(n[3]-n[1]),[u,f]=a.toLatLng(l,c);ice(u,f,e);return}let s=O.engine?.getView();if(!s||!O.lens)return;let o=[n[0]+r(i.clientX,t.left,t.right)*(n[2]-n[0]),n[3]-r(i.clientY,t.top,t.bottom)*(n[3]-n[1])];if(e){s.animate({center:o,duration:180});return}s.cancelAnimations(),s.setCenter(o)}function vc(i){return new RY({updateWhileAnimating:!0,...i})}function dce(){let i=O.volume.tileGrid.size,e=[0,-i,i,0];O.projection=new Tp({code:"ATLAS:PIXELS",units:"pixels",extent:e}),O.sources={grid:new gd({wrapX:!1}),gridContext:new gd({wrapX:!1}),zoneScrim:new gd({wrapX:!1}),zones:new gd({wrapX:!1}),zoneTitles:new gd({wrapX:!1}),text:new gd({wrapX:!1}),pins:new gd({wrapX:!1}),priority:new gd({wrapX:!1})},O.layers={raster:new R6({zIndex:0}),rasterDetail:new R6({zIndex:1}),grid:vc({source:O.sources.grid,style:a5,renderOrder:kc,renderBuffer:40,zIndex:5}),zoneScrim:vc({source:O.sources.zoneScrim,style:BX,zIndex:6}),zones:vc({source:O.sources.zones,style:OX,renderBuffer:32,zIndex:10}),zoneTitles:vc({source:O.sources.zoneTitles,style:UX,renderOrder:kc,renderBuffer:160,zIndex:20}),zoneTitleDetail:vc({source:O.sources.zoneTitles,style:kX,renderOrder:kc,renderBuffer:160,zIndex:44}),text:vc({source:O.sources.text,style:IX,renderOrder:kc,renderBuffer:220,zIndex:30}),textDetail:vc({source:O.sources.text,style:PX,renderOrder:kc,renderBuffer:220,zIndex:45}),zoneText:vc({source:O.sources.text,style:LX,renderOrder:kc,renderBuffer:220,zIndex:41}),pins:vc({source:O.sources.pins,style:MX,renderOrder:kc,renderBuffer:48,zIndex:40}),zonePins:vc({source:O.sources.pins,style:CX,renderOrder:kc,renderBuffer:48,zIndex:42}),pinLabels:vc({source:O.sources.pins,style:RX,renderOrder:kc,renderBuffer:180,zIndex:45}),gridContext:vc({source:O.sources.gridContext,style:a5,renderOrder:kc,renderBuffer:40,zIndex:48}),priority:vc({source:O.sources.priority,style:DX,renderOrder:kc,renderBuffer:220,zIndex:50})},O.engine=new nY({target:ge.viewport,layers:Object.values(O.layers),controls:QE({attribution:!1,rotate:!1,zoom:!1}),interactions:r3({onFocusOnly:!1}),view:$P(5)}),O.engine.on("movestart",()=>{O.engine.getViewport().classList.add("is-dragging")}),O.engine.on("moveend",()=>{O.engine.getViewport().classList.remove("is-dragging"),O.overviewPointer===null&&Gx()}),O.engine.on("postrender",Vx),ge.viewport.addEventListener("wheel",()=>{document.activeElement!==ge.viewport&&ge.viewport.focus({preventScroll:!0})},{capture:!0,passive:!0}),O.engine.on("singleclick",t=>{if(O.gridEnabled){let r=O.engine.forEachFeatureAtPixel(t.pixel,s=>{let o=s.get("gridCell");return o&&o.role!=="leaf"&&o.role!=="scope"?o:null},{hitTolerance:1,layerFilter:s=>s===O.layers.grid||s===O.layers.gridContext});if(r){gA(r.hash);return}}let n=O.engine.forEachFeatureAtPixel(t.pixel,(r,s)=>XP(s)&&r.get("pin")||null,{hitTolerance:5,layerFilter:XP});n&&By(n)}),O.engine.on("pointermove",t=>{if(t.dragging){gv(null);return}let n=O.engine.forEachFeatureAtPixel(t.pixel,(o,a)=>XP(a)&&o.get("pin")||null,{hitTolerance:4,layerFilter:XP}),r=n&&uh(n.category)==="text"?null:n;gv(r||null);let s=O.gridEnabled&&O.engine.hasFeatureAtPixel(t.pixel,{layerFilter:o=>o===O.layers.grid||o===O.layers.gridContext});O.engine.getTargetElement().style.cursor=n||s?"pointer":""}),O.engine.getViewport().addEventListener("pointerleave",()=>gv(null))}function XP(i){return i===O.layers.pins||i===O.layers.zonePins||i===O.layers.pinLabels||i===O.layers.priority||i===O.layers.text||i===O.layers.textDetail||i===O.layers.zoneText}function $P(i,e=null){let t=O.volume.tileGrid.size,n=e||[0,-t,t,0];return new Xl({projection:O.projection,center:[(n[0]+n[2])/2,(n[1]+n[3])/2],resolutions:FG(i),minZoom:0,maxZoom:i,extent:n,constrainResolution:!1,smoothResolutionConstraint:!1,showFullExtent:!0,zoom:0})}function FG(i){let e=O.volume.tileGrid.size/O.volume.tileGrid.tileSize;return Array.from({length:i+1},(t,n)=>e/2**n)}async function cd(i,e){O.volume=O.catalog.volumes.find(r=>r.slug===i)||O.catalog.volumes[0],O.engine||dce(),!e&&!O.restore&&(O.restore=cv(O.volume.slug)),ge.volume.value=O.volume.slug,Hm(ge.world,O.volume.worlds,"title"),ge.world.disabled=O.volume.worlds.length===1,ge.world.title=ge.world.disabled?"This volume has one world":"Choose a world";let t=O.restore?.volume===O.volume.slug?O.restore:null,n=e&&O.volume.worlds.find(r=>r.slug===e)||t&&O.volume.worlds.find(r=>r.slug===t.world);await BG((n||O.volume.worlds[0]).slug)}async function BG(i){let e=O.volume.worlds.find(s=>s.slug===i)||O.volume.worlds[0],t=++O.worldRun;ge.loading.hidden=!1;let n;try{n=await s$(e)}catch(s){console.error(`world ${e.slug} failed to load`,s),O.worldRun===t&&(ge.loading.hidden=!0,wA());return}if(O.worldRun!==t)return;O.settling=!0,O.world=n,document.documentElement.style.setProperty("--icon-outset-color",fA()),ge.world.value=O.world.slug,Hm(ge.lens,O.world.lenses,"name"),ge.lensField.hidden=O.world.lenses.length<2,O.styleCache.clear(),gv(null),O.gridCell="",O.gridSystem="geohash",O.hiddenCollections.clear(),O.labelOverrides.clear(),O.collapsedSections.clear(),O.collapsedSections.add("zones"),O.expandedCollections.clear();for(let s of O.world.collections)s.kind!=="point"&&!s.group&&O.expandedCollections.add(s.id),s.visible||O.hiddenCollections.add(s.id);let r=O.restore?.world===O.world.slug?O.restore:null;r&&(O.hiddenCollections=new Set(r.hidden),O.collapsedSections=new Set(r.collapsed),O.expandedCollections=new Set(r.expanded||[]),O.labelOverrides=new Map(r.labels||[])),WP(!!O.restore?.overviewDocked,!1),TE(O.restore?!!O.restore.dockFolded:!0,!1),O.dockDismissed=!!O.restore?.dockDismissed,O.search="",ge.search.value="",ge.dock.hidden=!1,rd(),QX(),f5(),XX(),OG(r?cs(r.lens,0,O.world.lenses.length-1):0,!0),ece(),O.restore=null,ge.sidebar.classList.remove("is-open"),ge.mobileLegend.setAttribute("aria-expanded","false"),Oj(),O.settling=!1,Wl()}function OG(i,e=!1){let t=O.lens;O.lens=O.world.lenses[i]||O.world.lenses[0];let n=O.lens,r=e?null:h8e(t,n),s=vh(n);if(ge.lens.value=String(O.world.lenses.indexOf(O.lens)),e)O.engine.setView($P(s,zf()));else{let w=O.engine.getView(),S=$P(s,zf());S.setCenter(w.getCenter()),S.setZoom(w.getZoom()||0),O.engine.setView(S)}let o=++O.tileRun,a=0;O.tileStats={requested:0,loaded:0,errors:0,peakPending:0},ge.loading.hidden=!1;let l=w=>{w.on("tileloadstart",()=>{O.tileRun===o&&(a++,O.tileStats.requested++,O.tileStats.peakPending=Math.max(O.tileStats.peakPending,a))});let S=T=>{O.tileRun===o&&(a=Math.max(0,a-1),T?O.tileStats.errors++:O.tileStats.loaded++,a===0&&O.tileStats.loaded>0&&(ge.loading.hidden=!0))};return w.on("tileloadend",()=>S(!1)),w.on("tileloaderror",()=>S(!0)),w},c=(w,S)=>l(new Fj({projection:O.projection,tileGrid:new Ly({extent:[0,-O.volume.tileGrid.size,O.volume.tileGrid.size,0],origin:[0,0],resolutions:FG(w),tileSize:O.volume.tileGrid.tileSize}),cacheSize:64,interpolate:n.interpolate,transition:0,wrapX:!1,tileUrlFunction:([T,R,P])=>{let I=n.formats[T];if(!(!I||R<0||P<0||!S(T,R,P)))return`${O.volume.base}/tiles/${encodeURIComponent(n.tiles)}/${T}/${R}/${P}.${I}`}})),u=n.fullZoom??n.maxZoom,f=c(u,(w,S,T)=>jP(n,w,S,T)),d=O.layers.raster.getSource();O.layers.raster.setSource(f),O.layers.raster.setExtent(zf()),O.layers.raster.setBackground(n.background||void 0),d?.clear();let A=O.layers.rasterDetail.getSource();n.maxZoom>u?(O.layers.rasterDetail.setSource(c(n.maxZoom,(w,S,T)=>w>u&&jP(n,w,S,T))),O.layers.rasterDetail.setExtent(zf()),O.layers.rasterDetail.setVisible(!0)):O.layers.rasterDetail.setVisible(!1),A?.clear(),jy(),O.gridEnabled&&(Bc(),O.layers.pins.changed(),O.layers.text.changed(),O.layers.priority.changed()),O.overviewKey="",fce();let y=e&&O.restore?.world===O.world.slug?O.restore:null;if(O.renderedShard!==(n.shard||0)&&(f5(),Fc()),y?.center&&Number.isFinite(y.zoom)){let w=O.engine.getView();w.setCenter(y.center),w.setZoom(y.zoom),O.fitZoom=y.zoom,bA()}else e?requestAnimationFrame(f8e):(r&&O.engine.getView().animate({center:r,duration:200}),bA());Wl()}function jP(i,e,t,n){let r=i.coverage?.[e];if(!r)return!0;let s=t-r.x,o=n-r.y;if(s<0||o<0||s>=r.w||o>=r.h)return!1;let a=u8e(i,e,r),l=o*r.w+s;return(a[l>>3]&1<<(l&7))!==0}function u8e(i,e,t){if(!t.decoded){let n=atob(t.bits),r=new Uint8Array(n.length);for(let s=0;s<n.length;s++)r[s]=n.charCodeAt(s);t.decoded=r}return t.decoded}function vh(i){return i.maxZoom+2}function Gx(){bA(),Wl()}function h8e(i,e){if(!i||!e||!i.shard||!e.shard||i.shard===e.shard||!i.bounds||!e.bounds)return null;let n=O.engine?.getView()?.getCenter();if(!n)return null;let r=(n[0]-i.bounds.x)/i.bounds.width,s=(-n[1]-i.bounds.y)/i.bounds.height;return[e.bounds.x+cs(r,0,1)*e.bounds.width,-(e.bounds.y+cs(s,0,1)*e.bounds.height)]}function pce(){let e=document.querySelector(".app-shell").classList.toggle("sidebar-collapsed");ge.mobileLegend.setAttribute("aria-expanded",String(!e)),requestAnimationFrame(()=>O.engine?.updateSize())}function zf(){let i=O.volume.tileGrid.size,e=O.lens?.bounds||{x:0,y:0,width:i,height:i};return[e.x,-(e.y+e.height),e.x+e.width,-e.y]}function f8e(){if(!O.engine||!O.lens)return;let i=O.engine.getView();i.fit(zf(),{size:O.engine.getSize(),padding:[36,36,36,36],maxZoom:O.lens.maxZoom,duration:0}),O.fitZoom=i.getZoom()||0,bA()}function iT(i){let e=O.engine.getView(),t=e.getZoom()||0;e.animate({zoom:cs(t+i,O.lens.minZoom,vh(O.lens)),duration:140})}function bA(){let i=O.engine?.getView().getZoom();if(ge.viewport.dataset.zoom=Number.isFinite(i)?i.toFixed(3):"",!O.engine||!O.world){ge.visibleCount.textContent="0 features enabled";return}let e=O.engine.getView().calculateExtent(O.engine.getSize()),t=O.eligibleLocations,n=0;for(let r of O.pins){if(zc(r))continue;let[s,o]=r.coordinate;s>=e[0]&&s<=e[2]&&o>=e[1]&&o<=e[3]&&n++}for(let r of O.zoneRecords.values())Pa(r.zone.collectionId)||(t++,Ar(r.extent,e)&&n++);ge.visibleCount.textContent=`${jl(t)} features enabled \xB7 ${jl(n)} in view`}function mce(){ge.volume.addEventListener("change",()=>{cd(ge.volume.value)}),ge.world.addEventListener("change",()=>{BG(ge.world.value)}),ge.addBundles.addEventListener("click",()=>{x5()}),ge.emptyOpen.addEventListener("click",()=>{x5()}),ge.lens.addEventListener("change",()=>{OG(Number(ge.lens.value)),hce()}),ge.globeToggle.addEventListener("click",()=>qP()),ge.legend.addEventListener("change",n=>{let r=n.target;if(r.dataset.sectionToggle){i$(r.dataset.sectionToggle);return}if(!r.dataset.collection)return;let s=Tu(r.dataset.collection);r.checked?O.hiddenCollections.delete(s):O.hiddenCollections.add(s),kp(),Fc(),gh()});let i=null,e=()=>{for(let s of ge.layers.querySelectorAll(".is-hovered"))s.classList.remove("is-hovered");if(!i)return;let r=document.elementFromPoint(i.x,i.y)?.closest(".category-row, .layer-header");r&&ge.layers.contains(r)&&r.classList.add("is-hovered")};ge.layers.addEventListener("pointermove",n=>{i={x:n.clientX,y:n.clientY},e()},{passive:!0}),ge.layers.addEventListener("pointerleave",()=>{i=null,e()}),ge.layers.addEventListener("scroll",e,{passive:!0}),ge.layers.addEventListener("click",n=>{let r=n.target.closest("[data-only-collection], [data-only-section]");if(r){n.preventDefault(),n.stopPropagation(),r$(r.dataset.onlyCollection?{collection:Tu(r.dataset.onlyCollection)}:{section:r.dataset.onlySection});return}let s=n.target.closest("[data-expand-collection]");if(s){n.preventDefault(),n.stopPropagation(),e$(Tu(s.dataset.expandCollection));return}let o=n.target.closest("[data-label-toggle]");if(o){n.preventDefault(),n.stopPropagation(),n$(Tu(o.dataset.labelToggle));return}let a=n.target.closest("[data-zone]");if(a){m5(Number(a.dataset.zone));return}let l=n.target.closest("[data-section]");if(!l)return;let c=l.dataset.section;O.collapsedSections.has(c)?O.collapsedSections.delete(c):O.collapsedSections.add(c),YE()}),ge.layers.addEventListener("contextmenu",n=>{let r=n.target.closest("[data-zone]");r&&(n.preventDefault(),jX(Number(r.dataset.zone)))}),ge.soloChip.addEventListener("click",()=>i2(!0)),on("#expand-all").addEventListener("click",()=>v5(!1)),on("#collapse-all").addEventListener("click",()=>v5(!0)),on("#show-all").addEventListener("click",()=>i2(!0)),on("#hide-all").addEventListener("click",()=>i2(!1)),ge.search.addEventListener("input",()=>{O.search=ge.search.value.trim().toLocaleLowerCase(),Fc(),O.search&&Fy()}),ge.dockFold.addEventListener("click",()=>{_N(!O.dockFolded)}),ge.searchResults.addEventListener("click",n=>{let r=n.target.closest("[data-location], [data-zone]");if(!r)return;if(r.dataset.zone){m5(Number(r.dataset.zone));return}let s=O.pinByID.get(Number(r.dataset.location));s&&bN(s)}),ge.detailLinks.addEventListener("click",n=>{let r=n.target.closest("[data-location]");if(!r)return;let s=O.pinByID.get(Number(r.dataset.location));s&&bN(s)}),on("#close-detail").addEventListener("click",rd),on("#zoom-in").addEventListener("click",()=>O.globeActive?IG(1):iT(1)),on("#zoom-out").addEventListener("click",()=>O.globeActive?IG(-1):iT(-1)),ge.gridBack.addEventListener("click",FN),ge.gridSystem.addEventListener("click",BN),ge.gridInput.addEventListener("input",()=>{let n=Ts(),r=n.normalizeInput(ge.gridInput.value);ge.gridInput.value=r,n.parseInput(r)!==null&&gA(r)}),ge.subgridToggle.addEventListener("click",()=>{Wy(!O.subgridVisible),ge.viewport.focus({preventScroll:!0})}),ge.gridInput.addEventListener("keydown",n=>{if(n.key===" "){n.preventDefault(),Wy(!O.subgridVisible);return}if(n.key==="`"){n.preventDefault(),ge.globeToggle.hidden||qP();return}n.key==="Escape"&&(n.preventDefault(),n.stopPropagation(),ge.viewport.focus({preventScroll:!0}))}),ge.viewport.addEventListener("keydown",n=>{if(!SE(n.target)){if(n.key==="+"||n.key==="=")iT(1);else if(n.key==="-")iT(-1);else if(n.key==="Escape")rd();else return;n.preventDefault()}}),window.addEventListener("contextmenu",n=>{SE(n.target)||n.preventDefault()}),window.addEventListener("keydown",n=>{if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="r"){n.preventDefault(),location.reload();return}if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="g"){n.preventDefault(),BN();return}if(!SE(n.target)){if(n.key==="`"&&!n.metaKey&&!n.ctrlKey&&!n.altKey){ge.globeToggle.hidden||(n.preventDefault(),qP());return}if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="k"){n.preventDefault(),ge.search.focus(),ge.search.select();return}if((n.metaKey||n.ctrlKey)&&n.altKey&&n.code==="KeyB"){n.preventDefault(),ge.dock.hidden||_N(!O.dockFolded);return}if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="b"){n.preventDefault(),pce();return}sX(n)||n.key.toLocaleLowerCase()==="z"&&(n.preventDefault(),n.repeat||$E(!0))}}),window.addEventListener("keyup",n=>{n.key.toLocaleLowerCase()==="z"&&$E(!1)}),window.addEventListener("blur",()=>$E(!1)),window.addEventListener("hashchange",()=>{let n=uv();n.volume===O.volume?.slug&&n.world===O.world?.slug||(O.restore=null,cd(n.volume||O.catalog.volumes[0].slug,n.world))}),window.addEventListener("resize",()=>{O.engine?.updateSize(),Vx(),DG()}),document.addEventListener("atlas:globe-camera",()=>Vx()),ge.overview.addEventListener("pointerdown",n=>{O.overviewDocked||n.pointerType==="mouse"&&n.button!==0||(n.preventDefault(),ge.overview.setPointerCapture(n.pointerId),O.overviewPointer=n.pointerId,NG(n,!0))}),ge.overview.addEventListener("pointermove",n=>{O.overviewPointer===n.pointerId&&(n.preventDefault(),NG(n,!1))});let t=n=>{O.overviewPointer===n.pointerId&&(O.overviewPointer=null,Gx())};ge.overview.addEventListener("pointerup",t),ge.overview.addEventListener("pointercancel",t),ge.overviewDock.addEventListener("click",()=>{WP(!O.overviewDocked),ge.viewport.focus({preventScroll:!0})}),ge.mobileLegend.addEventListener("click",()=>{let n=ge.sidebar.classList.toggle("is-open");ge.mobileLegend.setAttribute("aria-expanded",String(n))})}function Ace(){let i=()=>({volume:O.volume?.title,world:O.world?.title,lens:O.lens?.name,zoom:O.engine?.getView().getZoom(),center:O.engine?.getView().getCenter(),resolution:O.engine?.getView().getResolution(),nativeMaxZoom:O.lens?.maxZoom,maxZoom:O.lens?vh(O.lens):null,interpolate:O.lens?.interpolate,tileStats:{...O.tileStats},pins:O.pins.length,eligibleLocations:O.eligibleLocations,domNodes:document.querySelectorAll("*").length,canvases:document.querySelectorAll("canvas").length,rasterCacheSize:64,labelsHeld:O.labelsHeld,hoveredPin:O.hoveredPin?.location.title||null,selectedPin:O.selectedPin?.location.title||null,fitZoom:O.fitZoom,filters:{hiddenCategories:[...O.hiddenCollections].sort(),collapsedSections:[...O.collapsedSections].sort()},ui:{sidebarCollapsed:document.querySelector(".app-shell")?.classList.contains("sidebar-collapsed")??!1,detailOpen:!ge.detail.hidden,detailTitle:ge.detail.hidden?null:ge.detailTitle.textContent||null,searchQuery:O.search,searchResultsVisible:!ge.searchResults.hidden,soloChip:ge.soloChip.hidden?null:ge.soloChip.textContent,visibleCountText:ge.visibleCount.textContent,overviewDocked:O.overviewDocked,dockFolded:O.dockFolded,dockDismissed:O.dockDismissed,subgridVisible:O.subgridVisible},zones:{visible:q1(),count:O.zoneRecords.size,focused:O.zoneRecords.get(O.focusedZoneID)?.zone.title||null,highlighted:[...O.highlightedZones].map(e=>O.zoneRecords.get(e)?.zone.title).filter(Boolean),focusedPins:O.pins.filter(e=>!e.filteredHidden&&e.passesZoneFilters).length},grid:{enabled:O.gridEnabled,system:O.gridSystem,prefix:O.gridCell,maximumDepth:lX(),extent:O.gridEnabled?ON():null,cells:[...O.sources.grid.getFeatures(),...O.sources.gridContext.getFeatures()].map(e=>e.get("gridCell")),priorityPins:O.gridCell?O.pins.filter(e=>!e.filteredHidden&&Fp(e)).length:0}});window.__atlasDebug={snapshot:i,setLayerVisible:(e,t)=>O.layers[e]?.setVisible(t),refreshCatalog:wA},window.render_game_to_text=()=>JSON.stringify({coordinateSystem:"ATLAS:PIXELS; origin top-left; x increases right; y decreases downward",...i()}),window.advanceTime=()=>O.engine?.renderSync()}async function gce(){mce();try{let i=await fetch("/data/catalog.json");if(!i.ok)throw new Error(`catalog request returned ${i.status}`);if(O.catalog=await i.json(),Hm(ge.volume,O.catalog.volumes,"title"),_5(),window.runtime?.EventsOn?.("atlas:catalog-changed",()=>{wA()}),O.catalog.volumes.length){let e=uv(),t=cv(),n=t&&(!e.volume||e.volume===t.volume&&e.world===t.world);O.restore=n?t:null,await cd(e.volume||t?.volume||O.catalog.volumes[0].slug,e.world||t?.world),O.restore=null}else ge.loading.hidden=!0;Ace(),requestAnimationFrame(()=>ge.viewport.focus({preventScroll:!0}))}catch(i){ge.loading.hidden=!0,ge.fatalMessage.textContent=i instanceof Error?i.message:String(i),ge.fatal.hidden=!1}}gce();})();@@ -1,8 +1,8 @@
11 import { state } from "./state.js";22 import { legendSections } from "./legend.js";33 4-// A map arrives in two pieces: its layers, categories and regions as JSON, and5-// its locations packed as parallel arrays. Nothing here is fetched until the4+// A map arrives in two pieces: its layers and collections as JSON, and its5+// point features packed as parallel arrays. Nothing here is fetched until the66 // map is opened, so the catalog can grow without the wait growing with it.77 export async function loadWorld(entry) {88 const [detailResponse, packedResponse] = await Promise.all([@@ -19,15 +19,17 @@ export async function loadWorld(entry) {
1919 detailResponse.json(),2020 packedResponse.arrayBuffer(),2121 ]);22- const categories = detail.groups.flatMap((group) => group.categories);23- unpackLocations(packed, categories);24- const sections = legendSections(detail.groups, detail.zones || []);22+ const collections = detail.collections || [];23+ unpackLocations(packed, collections);24+ const sections = legendSections(collections);2525 return {2626 ...entry,2727 grid: detail.grid,2828 lenses: detail.lenses,29- groups: detail.groups,30- zones: detail.zones || [],29+ collections,30+ // One index by id, because everything downstream -- the hide set, the31+ // label ladder, a zone asking after its own collection -- speaks in ids.32+ collectionsById: new Map(collections.map((collection) => [collection.id, collection])),3133 attrs: detail.attrs || {},3234 merged: detail.merged || [],3335 sections,@@ -35,44 +37,53 @@ export async function loadWorld(entry) {
3537 }3638 3739 // The reader of packLocations. Each field is a view straight onto the buffer,38-// laid out so no copying or realignment is needed to get at it.39-export function unpackLocations(buffer, categories) {40+// laid out so no copying or realignment is needed to get at it. The owner41+// column indexes the collections array; only a point collection may own a42+// packed location, and a payload saying otherwise is refused rather than43+// guessed at.44+export function unpackLocations(buffer, collections) {4045 const view = new DataView(buffer);4146 const magic = String.fromCharCode(...new Uint8Array(buffer, 0, 8));4247 if (magic !== "ATLASLOC") throw new Error("location payload is not in the expected form");4348 const version = view.getUint16(8, true);44- if (version !== 2) throw new Error(`location payload is version ${version}, and this reads 2`);49+ if (version !== 3) throw new Error(`location payload is version ${version}, and this reads 3`);4550 const count = view.getUint32(10, true);4651 4752 let at = 16;4853 const ids = new Int32Array(buffer, at, count);4954 const latitudes = new Float32Array(buffer, (at += count * 4), count);5055 const longitudes = new Float32Array(buffer, (at += count * 4), count);51- const regions = new Int32Array(buffer, (at += count * 4), count);56+ const members = new Int32Array(buffer, (at += count * 4), count);5257 const shards = new Int32Array(buffer, (at += count * 4), count);5358 const offsets = new Uint32Array(buffer, (at += count * 4), count + 1);5459 const owners = new Uint16Array(buffer, (at += (count + 1) * 4), count);5560 const titles = new Uint8Array(buffer, at + count * 2);5661 5762 const decoder = new TextDecoder();58- for (const category of categories) category.locations = [];63+ for (const collection of collections) {64+ if (collection.kind === "point") collection.locations = [];65+ }5966 for (let index = 0; index < count; index++) {60- categories[owners[index]].locations.push({67+ const owner = collections[owners[index]];68+ if (!owner || owner.kind !== "point") {69+ throw new Error(`location ${ids[index]} names collection ${owners[index]}, which is no point collection`);70+ }71+ owner.locations.push({6172 id: ids[index],6273 title: decoder.decode(titles.subarray(offsets[index], offsets[index + 1])),6374 lat: latitudes[index],6475 lng: longitudes[index],65- regionId: regions[index] || undefined,76+ memberId: members[index] || undefined,6677 shard: shards[index] || undefined,6778 });6879 }6980 }7081 7182 // Descriptions and cross-references are half the catalog by weight and are read72-// one pin at a time, so a map's are fetched the first time one of its pins is73-// opened, and not at all if none ever is. The cache is keyed by the volume's74-// stamped base as well as the map, so an updated bundle is never answered75-// with the words of the build it replaced.83+// one feature at a time, so a map's are fetched the first time one of its84+// features is opened, and not at all if none ever is. The cache is keyed by the85+// volume's stamped base as well as the map, so an updated bundle is never86+// answered with the words of the build it replaced.7687 export async function worldText() {7788 const key = `${state.volume.base}/${state.world.slug}`;7889 if (!state.textByWorld.has(key)) {@@ -1,23 +1,33 @@
1-// The filtering side of the coming collections model, spoken early against2-// the v2 wire. When the unified format lands, every feature will belong to a3-// named collection and highlighting will read AND across collections, OR4-// within one: two districts highlighted widens the question, a district and a5-// subwatershed narrows it to the ground they share. That logic lives here6-// now, while every zone still belongs to one implicit collection -- over a7-// single collection the AND is exactly the union the map has always drawn,8-// so nothing looks different until a second collection exists to conjoin.1+// The filtering side of the collections model. Every feature belongs to a2+// named collection, and highlighting reads AND across collections, OR within3+// one: two districts highlighted widens the question, a district and a4+// subwatershed narrows it to the ground they share.95 106 import { state } from "./state.js";117 12-// collectionOf names the collection a zone belongs to. The v2 wire never13-// says, so there is exactly one answer; at flag day this reads what the wire14-// declares, and nothing else has to learn the new vocabulary.8+// collectionOf names the collection a shape feature belongs to: the id it9+// was stamped with when its collection was rendered.1510 export function collectionOf(zone) {16- return "zones";11+ return zone?.collectionId;12+}13+14+// collectionFor answers with the collection itself, for anything that needs15+// its attributes -- the label ladder, the stroke width -- rather than its id.16+export function collectionFor(zone) {17+ return state.world?.collectionsById?.get(zone?.collectionId);18+}19+20+// anyShapeCollectionVisible says whether any ground is drawn at all: the21+// zone layers stay up while one shape collection is shown, and each feature's22+// own style answers for its collection from there.23+export function anyShapeCollectionVisible() {24+ return (state.world?.collections || []).some(25+ (collection) => collection.kind !== "point" && !isCollectionHidden(collection.id),26+ );1727 }1828 1929 // isCollectionHidden is the one question every renderer asks about a20-// collection: pins ask by their category's id, shape features ask through30+// collection: pins ask by their collection's id, shape features ask through2131 // collectionOf. Nothing outside the legend touches the set directly.2232 export function isCollectionHidden(collectionID) {2333 return state.hiddenCollections.has(collectionID);@@ -1,14 +1,16 @@
11 import { worldText } from "./catalog.js";22 import { applicableSystems } from "./cellsystems/index.js";33 import { geohashCellAt } from "./cellsystems/geohash.js";4+import { collectionFor, geometryContainsCoordinate } from "./collections.js";45 import { elements } from "./dom.js";56 import { syncLegendCheckboxes, syncSectionSwitches } from "./legend.js";67 import { viewMaxZoom } from "./navigation.js";7-import { applyPinFilters, refreshPrioritySource } from "./pins.js";8+import { applyPinFilters, onActiveShard, refreshPrioritySource } from "./pins.js";89 import { renderSearchResults, revealDock } from "./search.js";10+import { featureAttributeRows, geoMapping } from "./semconv.js";911 import { state } from "./state.js";1012 import { applyCategoryVisual, applyCategoryGlyph, colorFor, initials } from "./theme.js";11-import { cleanDescription } from "./util.js";13+import { cleanDescription, formatNumber } from "./util.js";1214 1315 export function revealPin(pin) {1416 state.hiddenCollections.delete(pin.category.id);@@ -32,9 +34,11 @@ export function showPin(pin, focus = false) {
3234 state.layers.textDetail.changed();3335 state.layers.priority.changed();3436 elements.detailTitle.textContent = pin.location.title;35- elements.detailCategory.textContent = `${pin.group.title} / ${pin.category.title}`;37+ elements.detailCategory.textContent =38+ [pin.category.group, pin.category.title].filter(Boolean).join(" / ");3639 elements.detailDescription.textContent = "";3740 elements.detailLinks.hidden = true;41+ clearFeatureRows();3842 fillPinText(pin);3943 elements.detailID.textContent = String(pin.location.id);4044 elements.detailCoordinates.textContent =@@ -87,11 +91,12 @@ export function showPin(pin, focus = false) {
8791 }8892 }8993 90-// showZone opens the panel on a zone: its title and kind, its prose when the91-// archive carries any -- fetched the same lazy way a pin's is -- and the92-// volume's own provenance. Ground has no single coordinate or cell, so those93-// rows step aside.94-export function showZone(zone) {94+// showFeature opens the panel on a shape feature: its title and collection,95+// its prose when the archive carries any -- fetched the same lazy way a96+// pin's is -- its measure on the ground where the world declares a geographic97+// mapping, and whatever attributes it carries in its own right. Ground has98+// no single coordinate or cell, so those rows step aside.99+export function showFeature(zone) {95100 state.selectedPin = null;96101 state.selectedZone = zone;97102 document.dispatchEvent(new Event("atlas:selection"));@@ -102,8 +107,11 @@ export function showZone(zone) {
102107 // about, so selection repaints the chips.103108 state.layers.zoneTitles.changed();104109 state.layers.zoneTitleDetail.changed();110+ const collection = collectionFor(zone);105111 elements.detailTitle.textContent = zone.title;106- elements.detailCategory.textContent = zone.subtitle || "Zone";112+ elements.detailCategory.textContent =113+ [collection?.group, collection?.title].filter(Boolean).join(" / ") ||114+ zone.subtitle || "Zone";107115 elements.detailDescription.textContent = "";108116 elements.detailLinks.hidden = true;109117 elements.detailLinks.replaceChildren();@@ -119,6 +127,8 @@ export function showZone(zone) {
119127 elements.detailDot.textContent = "";120128 elements.detailDot.removeAttribute("style");121129 elements.detailDot.style.setProperty("background", colorFor(zone.id));130+ clearFeatureRows();131+ renderFeatureRows([...featureMeasureRows(zone, collection), ...featureAttributeRows(zone.attrs)]);122132 if (zone.hasText) void fillZoneText(zone);123133 else elements.detailDescription.textContent = "No description is included in the archive.";124134 elements.detail.hidden = false;@@ -126,6 +136,122 @@ export function showZone(zone) {
126136 renderSearchResults();127137 }128138 139+// featureMeasureRows says what a feature's ground amounts to, in the units of140+// the planet -- so only where the world declares a mapping back to one. An141+// area gets its extent and how many visible locations stand inside it; a path142+// gets its length.143+function featureMeasureRows(zone, collection) {144+ const record = state.zoneRecords.get(zone.id);145+ if (!record || !collection) return [];146+ const rows = [];147+ const mapping = geoMapping(state.world);148+ if (collection.kind === "area") {149+ if (mapping) {150+ const km2 = record.geometries.reduce((sum, geometry) => sum + geometryAreaKm2(geometry, mapping), 0);151+ if (km2 > 0) rows.push({ label: "Area", value: formatKm2(km2) });152+ }153+ const inside = state.pins.filter((pin) =>154+ !pin.filteredHidden && onActiveShard(pin.location) &&155+ record.geometries.some((geometry) => geometryContainsCoordinate(geometry, pin.coordinate))).length;156+ rows.push({ label: "Locations inside", value: formatNumber(inside) });157+ }158+ if (collection.kind === "path" && mapping) {159+ const km = record.geometries.reduce((sum, geometry) => sum + geometryLengthKm(geometry, mapping), 0);160+ if (km > 0) rows.push({ label: "Length", value: formatKm(km) });161+ }162+ return rows;163+}164+165+// The measures below flatten small grounds locally: latitude and longitude166+// come back through the world's declared mapping, and a city-sized ring is167+// near enough planar that the shoelace over locally scaled kilometres is the168+// honest figure.169+const kmPerDegreeLat = 110.574;170+171+function toLatLng(mapping, [x, y]) {172+ return mapping.toLatLng(x, -y);173+}174+175+function ringAreaKm2(ring, mapping) {176+ const points = ring.map((position) => toLatLng(mapping, position));177+ if (points.length < 3) return 0;178+ const midLat = points.reduce((sum, point) => sum + point[0], 0) / points.length;179+ const kmPerDegreeLng = 111.320 * Math.cos((midLat * Math.PI) / 180);180+ let doubled = 0;181+ for (let index = 0, prior = points.length - 1; index < points.length; prior = index++) {182+ const [latA, lngA] = points[prior];183+ const [latB, lngB] = points[index];184+ doubled += lngA * kmPerDegreeLng * latB * kmPerDegreeLat -185+ lngB * kmPerDegreeLng * latA * kmPerDegreeLat;186+ }187+ return Math.abs(doubled) / 2;188+}189+190+function geometryAreaKm2(geometry, mapping) {191+ const polygons = geometry.getType() === "MultiPolygon"192+ ? geometry.getPolygons()193+ : geometry.getType() === "Polygon" ? [geometry] : [];194+ let total = 0;195+ for (const polygon of polygons) {196+ polygon.getLinearRings().forEach((ring, index) => {197+ const area = ringAreaKm2(ring.getCoordinates(), mapping);198+ total += index === 0 ? area : -area;199+ });200+ }201+ return Math.max(0, total);202+}203+204+function geometryLengthKm(geometry, mapping) {205+ const lines = geometry.getType() === "MultiLineString"206+ ? geometry.getCoordinates()207+ : geometry.getType() === "LineString" ? [geometry.getCoordinates()] : [];208+ let total = 0;209+ for (const line of lines) {210+ for (let index = 1; index < line.length; index++) {211+ const [latA, lngA] = toLatLng(mapping, line[index - 1]);212+ const [latB, lngB] = toLatLng(mapping, line[index]);213+ const midLat = ((latA + latB) / 2) * (Math.PI / 180);214+ const dx = (lngB - lngA) * 111.320 * Math.cos(midLat);215+ const dy = (latB - latA) * kmPerDegreeLat;216+ total += Math.hypot(dx, dy);217+ }218+ }219+ return total;220+}221+222+function formatKm2(km2) {223+ return `${km2 >= 10 ? formatNumber(Math.round(km2)) : km2.toFixed(2)} km²`;224+}225+226+function formatKm(km) {227+ if (km < 1) return `${Math.round(km * 1000)} m`;228+ return `${km >= 10 ? formatNumber(Math.round(km)) : km.toFixed(1)} km`;229+}230+231+// The card's own rows -- a feature's measures and attributes -- live in the232+// same definition list the fixed rows do, marked so the next selection can233+// sweep them.234+function clearFeatureRows() {235+ for (const stray of elements.detail.querySelectorAll("[data-feature-row]")) {236+ stray.remove();237+ }238+}239+240+function renderFeatureRows(rows) {241+ let anchor = elements.detailSourceField;242+ for (const row of rows) {243+ const field = document.createElement("div");244+ field.dataset.featureRow = "";245+ const term = document.createElement("dt");246+ term.textContent = row.label;247+ const value = document.createElement("dd");248+ value.textContent = row.value;249+ field.append(term, value);250+ anchor.after(field);251+ anchor = field;252+ }253+}254+129255 // The words belonging to a zone arrive with the same text payload a pin's130256 // do, and the same rule holds: a zone closed or changed while they were on131257 // the way is left alone.@@ -160,7 +286,7 @@ function pinSource(pin) {
160286 state.pinSourceIndex = { world: state.world, byID };161287 }162288 for (const account of merged) {163- if (!account.origin && pin.group.title === account.source) return account.source;289+ if (!account.origin && pin.category.group === account.source) return account.source;164290 }165291 return state.pinSourceIndex.byID.get(pin.location.id) || origin;166292 }@@ -177,6 +303,10 @@ export async function fillPinText(pin) {
177303 pin.location.links = entry.l || [];178304 elements.detailDescription.textContent =179305 cleanDescription(entry.d) || "No description is included in the archive.";306+ // A point feature's attributes travel with its text, so its card rows --307+ // the HUC-12 of a pin that knows its subwatershed -- arrive with the words.308+ clearFeatureRows();309+ renderFeatureRows(featureAttributeRows(entry.a));180310 renderDetailLinks(pin);181311 }182312 @@ -1,3 +1,4 @@
1+import { anyShapeCollectionVisible } from "./collections.js";12 import { elements } from "./dom.js";23 import { state } from "./state.js";34 import { viewMaxZoom } from "./navigation.js";@@ -49,7 +50,7 @@ export function exposeDiagnostics() {
4950 subgridVisible: state.subgridVisible,5051 },5152 zones: {52- visible: !state.hiddenCollections.has("zones"),53+ visible: anyShapeCollectionVisible(),5354 count: state.zoneRecords.size,5455 focused: state.zoneRecords.get(state.focusedZoneID)?.zone.title || null,5556 highlighted: [...state.highlightedZones]@@ -159,8 +159,12 @@ export function bindUIEvents() {
159159 foldDockByHand(!state.dockFolded);160160 });161161 elements.searchResults.addEventListener("click", (event) => {162- const result = event.target.closest("[data-location]");162+ const result = event.target.closest("[data-location], [data-zone]");163163 if (!result) return;164+ if (result.dataset.zone) {165+ jumpToZone(Number(result.dataset.zone));166+ return;167+ }164168 const pin = state.pinByID.get(Number(result.dataset.location));165169 if (pin) revealPin(pin);166170 });@@ -8,22 +8,27 @@ import { recountZoneTitles, syncZoneLayers } from "./zones.js";
88 import { applyCategoryVisual, applyCategoryGlyph, initials } from "./theme.js";99 import { formatNumber } from "./util.js";1010 11-// The sidebar is one legend tree now: shape collections, text labels, and pin11+// The sidebar is one legend tree: shape collections, text labels, and pin1212 // groups are all sections of the same list, each holding rows of the same13-// shape. On the v2 wire the zones have no collection of their own, so they14-// stand as one synthetic "Zones" pseudo-collection -- the same section key15-// navigation pre-collapses -- until the v3 wire names the real ones.16-export function legendSections(groups, zones = []) {13+// shape. Sections come from the wire's group strings, in order of first14+// appearance; an ungrouped shape collection files under the viewer's own15+// Zones section, which keeps the pre-collapse behaviour a place to land.16+export function legendSections(collections) {1717 const sections = [];18- const text = [];19- for (const group of groups) {20- const drawn = [];21- for (const category of group.categories) {22- (renderAs(category) === "text" ? text : drawn).push(category);23- }24- if (drawn.length) {25- sections.push({ key: `group-${group.id}`, title: group.title, collections: drawn });18+ const at = new Map();19+ const place = (key, title, collection) => {20+ if (!at.has(key)) {21+ at.set(key, sections.length);22+ sections.push({ key, title, collections: [] });2623 }24+ sections[at.get(key)].collections.push(collection);25+ };26+ const text = [];27+ const zones = [];28+ for (const collection of collections) {29+ if (collection.kind === "point" && renderAs(collection) === "text") text.push(collection);30+ else if (collection.kind !== "point" && !collection.group) zones.push(collection);31+ else place(`group-${collection.group}`, collection.group, collection);2732 }2833 // Categories drawn as text are labels for the ground itself -- Area, Region,2934 // Province -- and are read and edited as one set. Gathered here rather than@@ -31,13 +36,7 @@ export function legendSections(groups, zones = []) {
3136 // another kind of marker. Above the pin groups, under the zones: labels and3237 // boundaries both say where you are, rather than what is worth going to.3338 if (text.length) sections.unshift({ key: "text", title: "Text", collections: text });34- if (zones.length) {35- sections.unshift({36- key: "zones",37- title: "Zones",38- collections: [{ id: "zones", title: "Zones", kind: "area", features: zones }],39- });40- }39+ if (zones.length) sections.unshift({ key: "zones", title: "Zones", collections: zones });4140 return sections;4241 }4342 @@ -48,7 +47,7 @@ export function collectionKind(collection) {
4847 }4948 5049 export function collectionCount(collection) {51- return (collection.features || collection.locations).length;50+ return (collection.features || collection.locations || []).length;5251 }5352 5453 // Collection ids ride the DOM as strings, but point categories are known@@ -81,18 +81,18 @@ export async function selectWorld(slug) {
8181 state.hiddenCollections.clear();8282 state.labelOverrides.clear();8383 // Zones are a navigation aid, not the primary filter surface: keep boundaries84- // drawn but fold the section away so pin groups stay above the fold. The85- // pseudo-collection's own row starts unfolded, so the feature index is86- // there the moment the section is opened -- and in the DOM for anything87- // that reaches for a zone row without unfolding first.84+ // drawn but fold their section away so pin groups stay above the fold. The85+ // ungrouped shape collections that section holds start unfolded, so their86+ // feature indexes are there the moment the section is opened -- and in the87+ // DOM for anything that reaches for a zone row without unfolding first.8888 state.collapsedSections.clear();8989 state.collapsedSections.add("zones");9090 state.expandedCollections.clear();91- state.expandedCollections.add("zones");92- for (const group of state.world.groups) {93- for (const category of group.categories) {94- if (!category.visible) state.hiddenCollections.add(category.id);91+ for (const collection of state.world.collections) {92+ if (collection.kind !== "point" && !collection.group) {93+ state.expandedCollections.add(collection.id);9594 }95+ if (!collection.visible) state.hiddenCollections.add(collection.id);9696 }9797 const restore = state.restore?.world === state.world.slug ? state.restore : null;9898 if (restore) {@@ -364,11 +364,10 @@ export function updateVisibleCount() {
364364 const [x, y] = pin.coordinate;365365 if (x >= extent[0] && x <= extent[2] && y >= extent[1] && y <= extent[3]) inView++;366366 }367- if (!isCollectionHidden("zones")) {368- enabled += state.zoneRecords.size;369- for (const record of state.zoneRecords.values()) {370- if (intersects(record.extent, extent)) inView++;371- }367+ for (const record of state.zoneRecords.values()) {368+ if (isCollectionHidden(record.zone.collectionId)) continue;369+ enabled++;370+ if (intersects(record.extent, extent)) inView++;372371 }373372 elements.visibleCount.textContent =374373 `${formatNumber(enabled)} features enabled · ${formatNumber(inView)} in view`;@@ -19,29 +19,27 @@ export function buildPins() {
1919 state.sources.priority.clear();2020 state.pins = [];2121 state.pinByID.clear();22- for (const group of state.world.groups) {23- for (const category of group.categories) {24- if (renderAs(category) !== "text") prepareMarkerIcon(category);25- for (const location of category.locations) {26- const pin = {27- location,28- category,29- group,30- coordinate: project(location.lat, location.lng),31- filteredHidden: false,32- priority: pinPriority(category, location),33- feature: null,34- };35- pin.feature = new Feature({36- geometry: new Point(pin.coordinate),37- pin,38- priority: pin.priority,39- });40- state.pins.push(pin);41- state.pinByID.set(location.id, pin);42- if (renderAs(category) === "text") state.sources.text.addFeature(pin.feature);43- else state.sources.pins.addFeature(pin.feature);44- }22+ for (const category of state.world.collections) {23+ if (category.kind !== "point") continue;24+ if (renderAs(category) !== "text") prepareMarkerIcon(category);25+ for (const location of category.locations) {26+ const pin = {27+ location,28+ category,29+ coordinate: project(location.lat, location.lng),30+ filteredHidden: false,31+ priority: pinPriority(category, location),32+ feature: null,33+ };34+ pin.feature = new Feature({35+ geometry: new Point(pin.coordinate),36+ pin,37+ priority: pin.priority,38+ });39+ state.pins.push(pin);40+ state.pinByID.set(location.id, pin);41+ if (renderAs(category) === "text") state.sources.text.addFeature(pin.feature);42+ else state.sources.pins.addFeature(pin.feature);4543 }4644 }4745 applyPinFilters();@@ -1,3 +1,4 @@
1+import { isCollectionHidden } from "./collections.js";12 import { elements } from "./dom.js";23 import { saveSession } from "./session.js";34 import { state } from "./state.js";@@ -8,43 +9,35 @@ import { formatNumber } from "./util.js";
89 // the canvas; the list is a shortlist, and it says when it is one.910 const dockListLimit = 100;1011 11-// The dock's results pane: every location that survives the current search12-// and category filters, alphabetically, capped. With a search underway the13-// list is exactly the matches; with none it is a browsable index of what the14-// legend has left visible.12+// The dock's results pane: every feature that survives the current search and13+// collection filters, alphabetically, capped -- named shape features listed14+// beside the locations, since ground is as findable as anything standing on15+// it. With a search underway the list is exactly the matches; with none it is16+// a browsable index of what the legend has left visible.1517 export function renderSearchResults() {1618 if (!elements.searchResults) return;17- const eligible = state.pins18- .filter((pin) => !pin.filteredHidden)19- .sort((a, b) => a.location.title.localeCompare(b.location.title));19+ const eligible = [20+ ...state.pins21+ .filter((pin) => !pin.filteredHidden)22+ .map((pin) => ({ title: pin.location.title, pin })),23+ ...[...state.zoneRecords.values()]24+ .filter((record) => record.zone.title &&25+ !isCollectionHidden(record.zone.collectionId) &&26+ (!state.search || record.zone.title.toLocaleLowerCase().includes(state.search)))27+ .map((record) => ({ title: record.zone.title, record })),28+ ].sort((a, b) => a.title.localeCompare(b.title));2029 const shown = eligible.slice(0, dockListLimit);2130 const fragment = document.createDocumentFragment();2231 if (!shown.length) {2332 const empty = document.createElement("p");2433 empty.className = "search-empty";2534 empty.textContent = state.search26- ? "No visible locations match."27- : "Nothing is enabled. Show a category to list its locations.";35+ ? "No visible features match."36+ : "Nothing is enabled. Show a collection to list its features.";2837 fragment.append(empty);2938 }30- for (const pin of shown) {31- const button = document.createElement("button");32- button.type = "button";33- button.className = "search-result";34- if (state.selectedPin === pin) button.classList.add("is-selected");35- button.dataset.location = String(pin.location.id);36- applyCategoryVisual(button, pin.category);37- const dot = document.createElement("span");38- dot.className = "result-dot";39- applyCategoryGlyph(dot, pin.category, initials(pin.category.title));40- const copy = document.createElement("span");41- const title = document.createElement("strong");42- title.textContent = pin.location.title;43- const category = document.createElement("small");44- category.textContent = `${pin.category.title} · ${pin.group.title}`;45- copy.append(title, category);46- button.append(dot, copy);47- fragment.append(button);39+ for (const entry of shown) {40+ fragment.append(entry.pin ? pinResult(entry.pin) : zoneResult(entry.record));4841 }4942 if (eligible.length > shown.length) {5043 const note = document.createElement("p");@@ -58,6 +51,47 @@ export function renderSearchResults() {
5851 updateDockRail();5952 }6053 54+function pinResult(pin) {55+ const button = document.createElement("button");56+ button.type = "button";57+ button.className = "search-result";58+ if (state.selectedPin === pin) button.classList.add("is-selected");59+ button.dataset.location = String(pin.location.id);60+ applyCategoryVisual(button, pin.category);61+ const dot = document.createElement("span");62+ dot.className = "result-dot";63+ applyCategoryGlyph(dot, pin.category, initials(pin.category.title));64+ const copy = document.createElement("span");65+ const title = document.createElement("strong");66+ title.textContent = pin.location.title;67+ const category = document.createElement("small");68+ category.textContent = [pin.category.title, pin.category.group].filter(Boolean).join(" · ");69+ copy.append(title, category);70+ button.append(dot, copy);71+ return button;72+}73+74+// A shape feature's row wears a swatch of the zone's own colour where a pin75+// wears its category glyph, and jumps the way its legend row does.76+function zoneResult(record) {77+ const button = document.createElement("button");78+ button.type = "button";79+ button.className = "search-result";80+ if (state.selectedZone === record.zone) button.classList.add("is-selected");81+ button.dataset.zone = String(record.zone.id);82+ const dot = document.createElement("span");83+ dot.className = "result-dot";84+ dot.style.setProperty("background", record.color);85+ const copy = document.createElement("span");86+ const title = document.createElement("strong");87+ title.textContent = record.zone.title;88+ const collection = document.createElement("small");89+ collection.textContent = record.collection?.title || "Zone";90+ copy.append(title, collection);91+ button.append(dot, copy);92+ return button;93+}94+6195 // Folded, the dock is a rail with one word on it, and that word read the same6296 // whether or not a location was open: the map had a pin picked out and the6397 // only panel saying which one was the one just put away. The rail carries the@@ -78,7 +112,7 @@ export function updateDockRail() {
78112 79113 function updateDockReadout(count) {80114 elements.dockCount.textContent =81- `${formatNumber(count)} ${count === 1 ? "location" : "locations"}`;115+ `${formatNumber(count)} ${count === 1 ? "feature" : "features"}`;82116 if (state.search) {83117 elements.dockFlag.textContent = `“${state.search}”`;84118 elements.dockFlag.hidden = false;@@ -4,28 +4,53 @@
44 // used to carry the meaning; a key this build has never heard of is simply55 // ignored, because a bundle is never refused over vocabulary.66 7-import { collectionOf } from "./collections.js";7+import { collectionFor } from "./collections.js";88 import { state } from "./state.js";99 10+// The registry's vocabularies, mirrored: what shape of thing a collection11+// holds, and whether names draw unasked.12+export const geometryKinds = Object.freeze({ point: "point", path: "path", area: "area" });13+export const labelPolicies = Object.freeze({ always: "always", quiet: "quiet" });14+1015 // labelPolicy answers whether a zone's name draws on its own or waits to be1116 // asked: "always" or "quiet". The reader's per-collection override wins,12-// then the collection's declared word, then the zone's own. The v2 wire has13-// no collections to speak, so today the zone answers for its collection --14-// and silence means "always", which is what every bundle from before the15-// key already meant.17+// then the collection's declared word, then the kind's own default -- areas18+// speak unasked, which is what every map before the key already did, and19+// paths wait.1620 export function labelPolicy(zone, collection) {17- return state.labelOverrides.get(collection?.id ?? collectionOf(zone)) ??18- collection?.attrs?.["atlas.label.policy"] ??19- zone?.attrs?.["atlas.label.policy"] ??20- "always";21+ const declared = collection ?? collectionFor(zone);22+ const override = state.labelOverrides.get(declared?.id);23+ if (override) return override;24+ const curated = declared?.attrs?.["atlas.label.policy"];25+ if (curated) return curated;26+ return declared?.kind === geometryKinds.path ? labelPolicies.quiet : labelPolicies.always;27+}28+29+// renderAs answers how a point collection draws: "pin" or "text". This is30+// the one display rule the viewer holds, spelled once; a collection saying31+// nothing is markers, and since the v3 wire every producer says.32+export function renderAs(collection) {33+ return collection.attrs?.["atlas.render.as"] || "pin";2134 }2235 23-// renderAs answers how a category draws: "pin" or "text". This is the one24-// display rule the viewer holds, spelled once.25-export function renderAs(category) {26- const declared = category.attrs?.["atlas.render.as"];27- if (declared) return declared;28- return category.displayType === "text" ? "text" : "pin";36+// The labels the detail card gives a feature's own attributes. Anything in37+// the reserved rendering namespaces is machinery rather than material, and38+// the geographic pair already has rows of its own.39+const attributeLabels = { "atlas.hydro.huc12": "HUC-12" };40+const attributeHidden = new Set(["atlas.geo.lat", "atlas.geo.lon"]);41+const reservedPrefixes = ["atlas.render.", "atlas.label.", "atlas.stroke.", "atlas.geometry."];42+43+// featureAttributeRows turns a feature's attributes into the rows its card44+// shows: curated label where one exists, the raw key where none does, and45+// nothing at all for machinery.46+export function featureAttributeRows(attrs) {47+ const rows = [];48+ for (const [key, value] of Object.entries(attrs || {})) {49+ if (attributeHidden.has(key)) continue;50+ if (reservedPrefixes.some((prefix) => key.startsWith(prefix))) continue;51+ rows.push({ label: attributeLabels[key] || key, value });52+ }53+ return rows.sort((left, right) => left.label.localeCompare(right.label));2954 }3055 3156 // worldSurface answers what the map's raster pictures. A map that says@@ -7,10 +7,9 @@ export const state = {
77 projection: null,88 layers: null,99 sources: null,10- // One hide-set across every kind of collection: point categories by their11- // numeric ids, and -- until the v3 wire names real shape collections -- the12- // implicit "zones" pseudo-collection by that string. Nothing downstream13- // cares which kind an id names; it only asks isCollectionHidden.10+ // One hide-set across every kind of collection, keyed by the numeric ids11+ // the wire declares. Nothing downstream cares which kind an id names; it12+ // only asks isCollectionHidden.1413 hiddenCollections: new Set(),1514 collapsedSections: new Set(),1615 // Which area and path rows have their feature index unfolded in the legend.@@ -7,7 +7,7 @@ import {
77 Text,88 } from "ol/style.js";99 10-import { collectionOf, isCollectionHidden } from "./collections.js";10+import { anyShapeCollectionVisible, collectionFor, collectionOf, isCollectionHidden } from "./collections.js";1111 import { gridTheme } from "./constants.js";1212 import { gridCellVisual } from "./grid.js";1313 import { labelPolicy, renderAs } from "./semconv.js";@@ -358,7 +358,7 @@ export const zoneScrimFill = new Style({ fill: new Fill({ color: "rgba(5, 8, 16,
358358 // collection withdraws its highlights, so an all-hidden map has no scrim359359 // feature left to draw; the check covers the moment in between.360360 export function zoneScrimStyle() {361- return isCollectionHidden("zones") ? null : zoneScrimFill;361+ return anyShapeCollectionVisible() ? zoneScrimFill : null;362362 }363363 364364 export function zoneStyle(feature, resolution) {@@ -367,9 +367,11 @@ export function zoneStyle(feature, resolution) {
367367 const child = feature.get("child");368368 const highlighted = state.highlightedZones.has(zone.id);369369 const dimmed = zoneContextDimmed(zone.id);370- // A path zone carries its ground width: the stroke is the zone, drawn at371- // the width the world gives it rather than a width the screen does.372- const groundWidth = Number(zone.attrs?.["atlas.stroke.width_px"]) || 0;370+ // A path is a line and a weight, and the weight is its collection's to371+ // declare -- drawn at the width the world gives it rather than a width the372+ // screen does. A feature spelling a width of its own is still honoured.373+ const groundWidth = Number(zone.attrs?.["atlas.stroke.width_px"]) ||374+ Number(collectionFor(zone)?.attrs?.["atlas.stroke.width_px"]) || 0;373375 if (groundWidth > 0 && feature.getGeometry()?.getType() === "MultiLineString") {374376 return pathZoneStyle(zone, feature.get("color"), groundWidth / resolution, highlighted, dimmed);375377 }@@ -555,11 +557,11 @@ export function zoneContextDimmed(zoneID) {
555557 556558 export function zoneIsAncestorOf(candidateID, zoneID) {557559 const visited = new Set();558- let parentID = state.zoneRecords.get(zoneID)?.zone.parentRegionId;560+ let parentID = state.zoneRecords.get(zoneID)?.zone.parent;559561 while (parentID != null && !visited.has(parentID)) {560562 if (parentID === candidateID) return true;561563 visited.add(parentID);562- parentID = state.zoneRecords.get(parentID)?.zone.parentRegionId;564+ parentID = state.zoneRecords.get(parentID)?.zone.parent;563565 }564566 return false;565567 }@@ -5,18 +5,17 @@ import MultiLineString from "ol/geom/MultiLineString.js";
55 import MultiPolygon from "ol/geom/MultiPolygon.js";66 import Polygon from "ol/geom/Polygon.js";77 8-import { collectionOf, isCollectionHidden } from "./collections.js";8+import { anyShapeCollectionVisible, collectionOf, isCollectionHidden } from "./collections.js";99 import { elements } from "./dom.js";1010 import { state } from "./state.js";11-import { showZone } from "./detail.js";12-import { syncLegendCheckboxes, syncSectionSwitches } from "./legend.js";11+import { showFeature } from "./detail.js";12+import { collectionID, syncLegendCheckboxes, syncSectionSwitches } from "./legend.js";1313 import { viewMaxZoom } from "./navigation.js";1414 import { onActiveShard, refreshPinRendering, updateZonePinFocus } from "./pins.js";1515 import { labelPolicy } from "./semconv.js";1616 import { colorFor } from "./theme.js";1717 1818 export function renderZones() {19- const zones = (state.world.zones || []).filter(onActiveShard);2019 state.renderedShard = state.lens?.shard || 0;2120 state.sources.zones.clear();2221 state.sources.zoneTitles.clear();@@ -26,41 +25,50 @@ export function renderZones() {
2625 state.zoneTitleCount = 0;2726 syncZoneLayers();2827 29- for (const zone of zones) {30- const zoneExtent = createEmpty();31- const geometries = [];32- let hasGeometry = false;33- for (const rawGeometry of zone.features || []) {34- const geometry = projectZoneGeometry(rawGeometry);35- if (!geometry) continue;36- hasGeometry = true;37- geometries.push(geometry);38- extend(zoneExtent, geometry.getExtent());39- state.sources.zones.addFeature(new Feature({40- geometry,28+ for (const collection of state.world.collections) {29+ if (collection.kind === "point") continue;30+ for (const zone of collection.features || []) {31+ if (!onActiveShard(zone)) continue;32+ // Each shape feature learns its collection's id here, once, so33+ // everything downstream -- styles, filters, the label ladder -- can34+ // ask the feature alone.35+ zone.collectionId = collection.id;36+ const zoneExtent = createEmpty();37+ const geometries = [];38+ let hasGeometry = false;39+ for (const rawGeometry of zone.geometry || []) {40+ const geometry = projectZoneGeometry(rawGeometry);41+ if (!geometry) continue;42+ hasGeometry = true;43+ geometries.push(geometry);44+ extend(zoneExtent, geometry.getExtent());45+ state.sources.zones.addFeature(new Feature({46+ geometry,47+ zone,48+ color: colorFor(zone.id),49+ child: zone.parent != null,50+ }));51+ }52+ if (!hasGeometry) continue;53+ const color = colorFor(zone.id);54+ const center = zone.center ? project(zone.center.lat, zone.center.lng) : getCenter(zoneExtent);55+ const span = Math.max(zoneExtent[2] - zoneExtent[0], zoneExtent[3] - zoneExtent[1]);56+ state.sources.zoneTitles.addFeature(new Feature({57+ geometry: new Point(center),4158 zone,42- color: colorFor(zone.id),43- child: zone.parentRegionId != null,59+ color,60+ child: zone.parent != null,61+ span,62+ priority: (zone.parent == null ? 2_000_000 : 1_000_000) + Math.round(span),4463 }));64+ state.zoneRecords.set(zone.id, {65+ zone,66+ collection,67+ extent: zoneExtent.slice(),68+ geometries,69+ color,70+ });4571 }46- if (!hasGeometry) continue;47- const color = colorFor(zone.id);48- const center = zone.center ? project(zone.center.lat, zone.center.lng) : getCenter(zoneExtent);49- const span = Math.max(zoneExtent[2] - zoneExtent[0], zoneExtent[3] - zoneExtent[1]);50- state.sources.zoneTitles.addFeature(new Feature({51- geometry: new Point(center),52- zone,53- color,54- child: zone.parentRegionId != null,55- span,56- priority: (zone.parentRegionId == null ? 2_000_000 : 1_000_000) + Math.round(span),57- }));58- state.zoneRecords.set(zone.id, {59- zone,60- extent: zoneExtent.slice(),61- geometries,62- color,63- });6472 }6573 recountZoneTitles();6674 renderZoneScrim();@@ -118,14 +126,12 @@ export function orientRing(ring, clockwise) {
118126 }119127 120128 // The feature index under an unfolded shape row: one button per zone, in the121-// parent-first order of the ground itself. On the v2 wire every zone belongs122-// to the one pseudo-collection, so every container in the legend gets the123-// same list; at flag day each container asks for its own collection's124-// features.129+// parent-first order of the ground itself, each container listing its own130+// collection's features.125131 export function renderZoneIndex() {126132 for (const container of elements.legend.querySelectorAll(".feature-index")) {127133 const fragment = document.createDocumentFragment();128- for (const { zone, depth } of orderedZones()) {134+ for (const { zone, depth } of orderedZones(collectionID(container.dataset.featureIndex))) {129135 const record = state.zoneRecords.get(zone.id);130136 if (!record) continue;131137 const button = document.createElement("button");@@ -149,12 +155,14 @@ export function renderZoneIndex() {
149155 }150156 }151157 152-export function orderedZones() {153- const zones = [...state.zoneRecords.values()].map((record) => record.zone);158+export function orderedZones(collectionId) {159+ const zones = [...state.zoneRecords.values()]160+ .filter((record) => record.zone.collectionId === collectionId)161+ .map((record) => record.zone);154162 const zoneIDs = new Set(zones.map((zone) => zone.id));155163 const children = new Map();156164 for (const zone of zones) {157- const parentID = zoneIDs.has(zone.parentRegionId) ? zone.parentRegionId : null;165+ const parentID = zoneIDs.has(zone.parent) ? zone.parent : null;158166 if (!children.has(parentID)) children.set(parentID, []);159167 children.get(parentID).push(zone);160168 }@@ -183,7 +191,7 @@ export function orderedZones() {
183191 // withdraws the hidden collection's highlights -- a filter must not keep184192 // conditioning the map from under a layer the reader has put away.185193 export function syncZoneLayers() {186- const visible = !isCollectionHidden("zones");194+ const visible = anyShapeCollectionVisible();187195 state.layers.zoneScrim.setVisible(visible);188196 state.layers.zones.setVisible(visible);189197 state.layers.zoneTitles.setVisible(visible);@@ -208,7 +216,7 @@ export function jumpToZone(zoneID) {
208216 if (!record) return;209217 state.focusedZoneID = zoneID;210218 updateZoneIndexState();211- showZone(record.zone);219+ showFeature(record.zone);212220 state.engine.getView().fit(record.extent, {213221 size: state.engine.getSize(),214222 padding: [54, 54, 54, 54],@@ -1,7 +1,6 @@
11 // The highlight filter, run against real OpenLayers polygons but no map: the2-// rule is AND across collections and OR within one, and the one-collection3-// case must stay the union it has always been -- that equivalence is what4-// lets the machinery land ahead of the wire that needs it.2+// rule is AND across collections and OR within one, with every zone3+// answering to the collection id the wire stamped it with.54 import assert from "node:assert/strict";65 import test from "node:test";76 @@ -20,13 +19,24 @@ function square(x, y, size) {
2019 ]]);2120 }2221 23-function record(id, geometry) {24- return { zone: { id }, geometries: [geometry] };22+function record(id, geometry, collectionId = 41) {23+ return { zone: { id, collectionId }, geometries: [geometry] };2524 }2625 27-test("every v2 zone answers to the one implicit collection", () => {28- assert.equal(collectionOf({ id: 1 }), "zones");29- assert.equal(collectionOf({ id: 2 }), collectionOf({ id: 99 }));26+test("a zone answers with the collection id the wire stamped", () => {27+ assert.equal(collectionOf({ id: 1, collectionId: 41 }), 41);28+ assert.equal(collectionOf({ id: 2 }), undefined, "an unstamped zone claims nothing");29+});30+31+test("groupByCollection buckets records by their real collections", () => {32+ const groups = groupByCollection([33+ record(1, square(0, 0, 10), 41),34+ record(2, square(100, 100, 10), 41),35+ record(3, square(0, 0, 40), 42),36+ ]);37+ assert.equal(groups.size, 2);38+ assert.equal(groups.get(41).length, 2);39+ assert.equal(groups.get(42).length, 1);3040 });3141 3242 test("one collection, two zones: inside either is enough", () => {@@ -34,18 +44,18 @@ test("one collection, two zones: inside either is enough", () => {
3444 record(1, square(0, 0, 10)),3545 record(2, square(100, 100, 10)),3646 ]);37- assert.equal(groups.size, 1, "v2 zones share a single bucket");47+ assert.equal(groups.size, 1, "one collection, one bucket");3848 assert.equal(passesZoneFilters(groups, [5, 5]), true);3949 assert.equal(passesZoneFilters(groups, [105, 105]), true);4050 assert.equal(passesZoneFilters(groups, [50, 50]), false);4151 });4252 4353 test("two collections: only the overlap survives", () => {44- // Grouped by hand, the way the v3 reader will: overlapping squares in45- // different collections, so only their shared corner answers both.46- const groups = new Map([47- ["districts", [record(1, square(0, 0, 10))]],48- ["watersheds", [record(2, square(5, 5, 10))]],54+ // Overlapping squares in different collections, so only their shared55+ // corner answers both.56+ const groups = groupByCollection([57+ record(1, square(0, 0, 10), 41),58+ record(2, square(5, 5, 10), 42),4959 ]);5060 assert.equal(passesZoneFilters(groups, [7, 7]), true, "inside both");5161 assert.equal(passesZoneFilters(groups, [2, 2]), false, "district only");@@ -54,9 +64,10 @@ test("two collections: only the overlap survives", () => {
5464 });5565 5666 test("two collections, alternatives within one", () => {57- const groups = new Map([58- ["districts", [record(1, square(0, 0, 10)), record(2, square(20, 0, 10))]],59- ["watersheds", [record(3, square(0, 0, 40))]],67+ const groups = groupByCollection([68+ record(1, square(0, 0, 10), 41),69+ record(2, square(20, 0, 10), 41),70+ record(3, square(0, 0, 40), 42),6071 ]);6172 assert.equal(passesZoneFilters(groups, [5, 5]), true, "first district");6273 assert.equal(passesZoneFilters(groups, [25, 5]), true, "second district");@@ -1,37 +1,55 @@
11 // The label-policy ladder, pure and DOM-free: the reader's override2-// outranks the collection's declared word, which outranks the zone's own,3-// and silence all the way down means "always" -- the meaning every bundle4-// from before the key already carried.2+// outranks the collection's declared word, which outranks the kind's own3+// default -- areas speak unasked, paths wait -- and a zone answers through4+// the collection the wire stamped it with.55 import assert from "node:assert/strict";66 import test from "node:test";77 8-import { labelPolicy } from "../src/semconv.js";8+import { featureAttributeRows, labelPolicy, renderAs } from "../src/semconv.js";99 import { state } from "../src/state.js";1010 11-test("labelPolicy climbs override, collection, zone, default", () => {11+test("labelPolicy climbs override, collection, kind default", () => {1212 state.labelOverrides.clear();13- const quietZone = { attrs: { "atlas.label.policy": "quiet" } };13+ const districts = { id: 41, kind: "area", attrs: {} };14+ const hydro = { id: 42, kind: "area", attrs: { "atlas.label.policy": "quiet" } };15+ const creeks = { id: 43, kind: "path", attrs: { "atlas.stroke.width_px": "10" } };1416 15- assert.equal(labelPolicy({}), "always", "silence means always");16- assert.equal(labelPolicy({ attrs: {} }), "always");17- assert.equal(labelPolicy(quietZone), "quiet", "the zone's own word");17+ assert.equal(labelPolicy(null, districts), "always", "silence means always for areas");18+ assert.equal(labelPolicy(null, hydro), "quiet", "the collection's curated word");19+ assert.equal(labelPolicy(null, creeks), "quiet", "paths wait by default");1820 19- const collection = { id: "watersheds", attrs: { "atlas.label.policy": "always" } };20- assert.equal(labelPolicy(quietZone, collection), "always",21- "the collection outranks the zone");22-23- state.labelOverrides.set("watersheds", "quiet");24- assert.equal(labelPolicy(quietZone, collection), "quiet",25- "the reader outranks the producer");21+ state.labelOverrides.set(42, "always");22+ assert.equal(labelPolicy(null, hydro), "always", "the reader outranks the producer");2623 state.labelOverrides.clear();2724 });2825 29-test("a v2 zone answers overrides through its implicit collection", () => {26+test("a zone answers through the collection the wire stamped it with", () => {3027 state.labelOverrides.clear();31- const zone = { attrs: {} };32- assert.equal(labelPolicy(zone), "always");33- state.labelOverrides.set("zones", "quiet");34- assert.equal(labelPolicy(zone), "quiet",35- "no collection on the wire, yet the override still lands");28+ const hydro = { id: 42, kind: "area", attrs: { "atlas.label.policy": "quiet" } };29+ state.world = { collectionsById: new Map([[42, hydro]]) };30+ const zone = { id: 7, collectionId: 42 };31+ assert.equal(labelPolicy(zone), "quiet", "the collection speaks for its zone");32+ state.labelOverrides.set(42, "always");33+ assert.equal(labelPolicy(zone), "always", "the override lands by collection id");3634 state.labelOverrides.clear();35+ state.world = null;36+});37+38+test("renderAs reads the declared attribute alone", () => {39+ assert.equal(renderAs({ attrs: { "atlas.render.as": "text" } }), "text");40+ assert.equal(renderAs({ attrs: {} }), "pin", "silence means markers");41+ assert.equal(renderAs({}), "pin", "no attrs at all still means markers");42+});43+44+test("featureAttributeRows curates, labels, and skips machinery", () => {45+ const rows = featureAttributeRows({46+ "atlas.hydro.huc12": "170703010101",47+ "atlas.geo.lat": "44.05",48+ "atlas.geo.lon": "-121.3",49+ "atlas.stroke.width_px": "12",50+ "atlas.label.policy": "quiet",51+ });52+ assert.deepEqual(rows, [{ label: "HUC-12", value: "170703010101" }],53+ "only material survives: geo has rows of its own, rendering is machinery");54+ assert.deepEqual(featureAttributeRows(undefined), [], "no attrs, no rows");3755 });@@ -775,7 +775,9 @@ func declaredCollections(pairs []pairing) []mgdoc.CollectionDecl {
775775 if curated.Geometry == "line" {776776 attrs[semconv.KeyStrokeWidthPx] = strconv.FormatFloat(curated.StrokeWidth, 'f', -1, 64)777777 }778- if curated.Label != "" {778+ // Label policy is an area's word alone: a path is quiet by the779+ // registry's own default, so a line dataset's curation says nothing.780+ if curated.Label != "" && kind == semconv.GeometryArea {779781 attrs[semconv.KeyLabelPolicy] = curated.Label780782 }781783 out = append(out, mgdoc.CollectionDecl{@@ -835,16 +837,11 @@ func buildRegions(capture *Capture, pairs []pairing, ids *mgdoc.IDSpace, hydro *
835837 Title: scrub(key.Title),836838 Subtitle: scrub(title(key.Subtitle, curated.Title)),837839 // The zone says which declared collection it belongs838- // to, which is the whole reason declarations exist.840+ // to, which is the whole reason declarations exist:841+ // the collection speaks for its kind and its stroke,842+ // so the zone carries neither.839843 Collection: curated.Slug,840844 }841- // A zone made of lines declares its ground width, so a842- // reader can draw the path as the one stroke it is.843- if curated.Geometry == "line" && curated.StrokeWidth > 0 {844- zone.Attrs = map[string]string{845- semconv.KeyStrokeWidthPx: strconv.FormatFloat(curated.StrokeWidth, 'f', -1, 64),846- }847- }848845 buckets[key.Key] = zone849846 order = append(order, key.Key)850847 }@@ -245,9 +245,10 @@ func TestTranslateShapesTheDocument(t *testing.T) {
245245 246246 // The document declares its zone-making datasets as collections, in the247247 // same curated order, each saying its kind -- and its stroke, when its248- // features are lines -- in the registered vocabulary. The hydro layers248+ // features are lines -- in the registered vocabulary. The hydro areas249249 // declare quiet labels: the nation's water is the city's context, not250- // its headline.250+ // its headline. The stream lines say nothing, because a path is quiet251+ // by the registry's own default and label policy is an area's word.251252 wantDecls := []struct{ key, title, kind, label string }{252253 {"mpo-boundary", "MPO Boundary", "area", ""},253254 {"zoning", "Zoning", "area", ""},@@ -256,7 +257,7 @@ func TestTranslateShapesTheDocument(t *testing.T) {
256257 {"trails", "Paths & Trails", "path", ""},257258 {"watersheds", "Watersheds", "area", "quiet"},258259 {"subwatersheds", "Subwatersheds", "area", "quiet"},259- {"streams", "Streams", "path", "quiet"},260+ {"streams", "Streams", "path", ""},260261 {"waterbodies", "Waterbodies", "area", "quiet"},261262 }262263 if len(out.Collections) != len(wantDecls) {@@ -335,10 +336,10 @@ func TestTranslateShapesTheDocument(t *testing.T) {
335336 t.Fatalf("zone %q claims membership: %q %v", zone.Title, zone.Description, zone.Attrs)336337 }337338 }338- // A line zone in one subwatershed claims it alongside its stroke.339+ // A line zone in one subwatershed claims it; its stroke is its340+ // collection's to declare, never its own.339341 riley := out.Regions[5]340- if riley.Attrs[semconv.KeyHydroHUC12] != "170703010102" ||341- riley.Attrs[semconv.KeyStrokeWidthPx] != "12" {342+ if riley.Attrs[semconv.KeyHydroHUC12] != "170703010102" {342343 t.Fatalf("trail attrs are %v", riley.Attrs)343344 }344345 if out.Regions[1].Subtitle != "Zoning" {@@ -351,19 +352,14 @@ func TestTranslateShapesTheDocument(t *testing.T) {
351352 if trail.Subtitle != "Riley Ranch Nature Reserve" || len(trail.Features) != 1 {352353 t.Fatalf("trail zone is %+v", trail)353354 }354- // A line zone stays the line it is, and declares the width it is drawn355- // at. The v2 wire spells the collection's stroke on the zone, so its two356- // keys validate under the entities the registry attaches them to.357- if err := semconv.Validate(semconv.EntityCollection,358- map[string]string{semconv.KeyStrokeWidthPx: trail.Attrs[semconv.KeyStrokeWidthPx]}); err != nil {359- t.Fatalf("trail stroke: %v", err)360- }361- if err := semconv.Validate(semconv.EntityFeature,362- map[string]string{semconv.KeyHydroHUC12: trail.Attrs[semconv.KeyHydroHUC12]}); err != nil {355+ // A line zone stays the line it is. Its width lives on the collection356+ // declaration alone, so the zone's own attributes validate as the357+ // feature they attach to, with nothing borrowed.358+ if err := semconv.Validate(semconv.EntityFeature, trail.Attrs); err != nil {363359 t.Fatalf("trail attrs: %v", err)364360 }365- if trail.Attrs[semconv.KeyStrokeWidthPx] != "12" {366- t.Fatalf("trail declares width %q", trail.Attrs[semconv.KeyStrokeWidthPx])361+ if _, stroked := trail.Attrs[semconv.KeyStrokeWidthPx]; stroked {362+ t.Fatalf("the trail zone spells a stroke of its own: %v", trail.Attrs)367363 }368364 if trail.Features[0].Geometry.Type != "MultiLineString" {369365 t.Fatalf("trail geometry is %q", trail.Features[0].Geometry.Type)@@ -26,8 +26,11 @@ const (
2626 // FormatVersion is bumped when the layout changes shape. A reader refuses2727 // versions it does not know rather than guessing at them. Version 22828 // renamed the format's concepts -- game to volume, map to world, variant29- // to lens -- through the manifest and payload keys alike.30- FormatVersion = 229+ // to lens -- through the manifest and payload keys alike. Version 330+ // unified what a world holds: the payload's groups, zones, and pins31+ // became one collections array of point, path, and area features, and32+ // the manifest counts each kind instead of counting only pins.33+ FormatVersion = 33134 3235 // ManifestName is the entry the whole bundle is read through. The writer3336 // places it first in the archive so a listing shows it first, though the@@ -96,14 +99,19 @@ type Coordinate struct {
9699 // WorldEntry lists one world: enough to offer it and to open it, and nothing97100 // that only matters once it is open. The slug names the world's payload98101 // entries -- worlds/<slug>.json, .bin, and .text -- and is the world's99-// identity everywhere.102+// identity everywhere. Points, Paths, and Areas count the world's features103+// by kind -- every feature is exactly one of the three -- so a listing can104+// say how much a world holds without opening its payload, and validation105+// can hold the payload to the promise.100106 type WorldEntry struct {101107 Slug string `json:"slug"`102108 Title string `json:"title"`103109 Parent string `json:"parent,omitempty"`104110 IconOutset string `json:"iconOutset,omitempty"`105111 Center Coordinate `json:"center"`106- PinCount int `json:"pinCount"`112+ Points int `json:"points"`113+ Paths int `json:"paths"`114+ Areas int `json:"areas"`107115 UpdatedAt string `json:"updatedAt"`108116 }109117 @@ -83,8 +83,8 @@ func TestOpenRoundTripsWhatBuildWrites(t *testing.T) {
8383 if opened.Manifest.Volume.Slug != "fixture" {8484 t.Errorf("game slug = %q", opened.Manifest.Volume.Slug)8585 }86- if got := opened.Manifest.Worlds[0].PinCount; got != 2 {87- t.Errorf("pin count = %d, want 2", got)86+ if got := opened.Manifest.Worlds[0].Points; got != 2 {87+ t.Errorf("point count = %d, want 2", got)8888 }8989 if err := opened.Validate(); err != nil {9090 t.Errorf("a fixture bundle fails validation: %v", err)@@ -158,7 +158,7 @@ func TestValidateCatchesBrokenPromises(t *testing.T) {
158158 }159159 }160160 must(writer.AddDeflated("worlds/overworld.json",161- []byte(`{"lenses":[{"tiles":"overworld","minZoom":0,"maxZoom":0,"formats":["jpg"]}],"groups":[]}`)))161+ []byte(`{"lenses":[{"tiles":"overworld","minZoom":0,"maxZoom":0,"formats":["jpg"]}],"collections":[]}`)))162162 must(writer.AddStored("worlds/overworld.bin", bytes.NewReader(bundle.PackLocations(nil))))163163 must(writer.AddDeflated("worlds/overworld.text", []byte(`{}`)))164164 must(writer.AddStored("tiles/overworld/0/0/0.jpg", bytes.NewReader([]byte("raster"))))@@ -175,55 +175,140 @@ func TestValidateCatchesBrokenPromises(t *testing.T) {
175175 }176176 }177177 178-func TestValidateRefusesRuntimeURLsAndWrongCounts(t *testing.T) {179- build := func(text string, pins int) *bundle.Bundle {180- t.Helper()181- manifest := validManifest()182- manifest.Worlds[0].PinCount = pins183- path := filepath.Join(t.TempDir(), "fixture.atlas")184- file, err := os.Create(path)185- if err != nil {186- t.Fatal(err)187- }188- writer, err := bundle.NewWriter(file, manifest)189- if err != nil {190- t.Fatal(err)191- }192- steps := []error{193- writer.AddDeflated("worlds/overworld.json",194- []byte(`{"lenses":[{"tiles":"overworld","minZoom":0,"maxZoom":0,"formats":["jpg"]}],"groups":[]}`)),195- writer.AddStored("worlds/overworld.bin",196- bytes.NewReader(bundle.PackLocations([]bundle.Location{{ID: 1, Title: "Origin"}}))),197- writer.AddDeflated("worlds/overworld.text", []byte(text)),198- writer.AddStored("tiles/overworld/0/0/0.jpg", bytes.NewReader([]byte("raster"))),199- writer.Close(),200- file.Close(),201- }202- for _, err := range steps {203- if err != nil {204- t.Fatal(err)205- }206- }207- opened, err := bundle.Open(path)178+// buildForValidation writes a one-world bundle whose payload JSON, text, and179+// per-kind manifest counts a case chooses, so each promise Validate makes can180+// be broken one at a time.181+func buildForValidation(t *testing.T, detail, text string, points, paths, areas int) *bundle.Bundle {182+ t.Helper()183+ manifest := validManifest()184+ manifest.Worlds[0].Points = points185+ manifest.Worlds[0].Paths = paths186+ manifest.Worlds[0].Areas = areas187+ path := filepath.Join(t.TempDir(), "fixture.atlas")188+ file, err := os.Create(path)189+ if err != nil {190+ t.Fatal(err)191+ }192+ writer, err := bundle.NewWriter(file, manifest)193+ if err != nil {194+ t.Fatal(err)195+ }196+ // At most one location is packed however many the manifest promises, so197+ // a case can promise more than the payload holds.198+ locations := make([]bundle.Location, min(points, 1))199+ for index := range locations {200+ locations[index] = bundle.Location{ID: int64(index + 1), Title: "Origin"}201+ }202+ steps := []error{203+ writer.AddDeflated("worlds/overworld.json", []byte(detail)),204+ writer.AddStored("worlds/overworld.bin", bytes.NewReader(bundle.PackLocations(locations))),205+ writer.AddDeflated("worlds/overworld.text", []byte(text)),206+ writer.AddStored("tiles/overworld/0/0/0.jpg", bytes.NewReader([]byte("raster"))),207+ writer.Close(),208+ file.Close(),209+ }210+ for _, err := range steps {208211 if err != nil {209212 t.Fatal(err)210213 }211- t.Cleanup(func() { opened.Close() })212- return opened213214 }215+ opened, err := bundle.Open(path)216+ if err != nil {217+ t.Fatal(err)218+ }219+ t.Cleanup(func() { opened.Close() })220+ return opened221+}222+223+const validationLenses = `"lenses":[{"tiles":"overworld","minZoom":0,"maxZoom":0,"formats":["jpg"]}]`214224 215- if err := build(`{"1":{"d":"see https://mapgenie.io/x"}}`, 1).Validate(); err == nil ||216- !strings.Contains(err.Error(), "runtime URL") {225+func TestValidateRefusesRuntimeURLsAndWrongCounts(t *testing.T) {226+ pointOnly := `{` + validationLenses + `,"collections":[{"id":1,"title":"Marker","kind":"point","visible":true}]}`227+228+ if err := buildForValidation(t, pointOnly, `{"1":{"d":"see https://mapgenie.io/x"}}`, 1, 0, 0).229+ Validate(); err == nil || !strings.Contains(err.Error(), "runtime URL") {217230 t.Errorf("a payload carrying a live URL validates with %v", err)218231 }219- if err := build(`{}`, 7).Validate(); err == nil || !strings.Contains(err.Error(), "7") {220- t.Errorf("a wrong pin count validates with %v", err)232+ if err := buildForValidation(t, pointOnly, `{}`, 7, 0, 0).233+ Validate(); err == nil || !strings.Contains(err.Error(), "7") {234+ t.Errorf("a wrong point count validates with %v", err)221235 }222- if err := build(`{}`, 1).Validate(); err != nil {236+ if err := buildForValidation(t, pointOnly, `{}`, 1, 0, 0).Validate(); err != nil {223237 t.Errorf("a sound bundle is refused: %v", err)224238 }225239 }226240 241+// The v3 wire's structural promises: every collection is the kind it says,242+// paths carry their stroke, labels are curated only where labels draw, points243+// never inline, and the manifest's per-kind counts hold.244+func TestValidateHoldsCollectionsToTheirKinds(t *testing.T) {245+ area := func(attrs string) string {246+ return `{` + validationLenses + `,"collections":[{"id":9,"title":"Districts","kind":"area",` +247+ `"visible":true` + attrs + `,"features":[{"id":5,"title":"R-5",` +248+ `"geometry":[{"type":"MultiPolygon","coordinates":[[[[0,0],[1,0],[1,1],[0,0]]]]}]}]}]}`249+ }250+ line := `{"type":"MultiLineString","coordinates":[[[0,0],[1,1]]]}`251+ cases := []struct {252+ name string253+ detail string254+ paths, areas int255+ wantSomewhere string256+ }{257+ {258+ name: "geometry disagreeing with the declared kind",259+ detail: `{` + validationLenses + `,"collections":[{"id":9,"title":"Districts","kind":"area","visible":true,"features":[{"id":5,"title":"R-5","geometry":[` + line + `]}]}]}`,260+ areas: 1,261+ wantSomewhere: "inlines a MultiLineString",262+ },263+ {264+ name: "a path collection with no stroke width",265+ detail: `{` + validationLenses + `,"collections":[{"id":9,"title":"Creeks","kind":"path","visible":true,"features":[{"id":5,"title":"Big Dry Creek","geometry":[` + line + `]}]}]}`,266+ paths: 1,267+ wantSomewhere: "declares no atlas.stroke.width_px",268+ },269+ {270+ name: "a manifest counting more areas than the payload holds",271+ detail: area(""),272+ areas: 2,273+ wantSomewhere: "manifest says",274+ },275+ {276+ name: "a label policy on a path collection",277+ detail: `{` + validationLenses + `,"collections":[{"id":9,"title":"Creeks","kind":"path","visible":true,` +278+ `"attrs":{"atlas.stroke.width_px":"10","atlas.label.policy":"quiet"},` +279+ `"features":[{"id":5,"title":"Big Dry Creek","geometry":[` + line + `]}]}]}`,280+ paths: 1,281+ wantSomewhere: "label policy",282+ },283+ {284+ name: "a point collection carrying inline features",285+ detail: `{` + validationLenses + `,"collections":[{"id":1,"title":"Marker","kind":"point","visible":true,` +286+ `"features":[{"id":5,"title":"Stray","geometry":[]}]}]}`,287+ wantSomewhere: "inline features",288+ },289+ {290+ name: "a sound area collection",291+ detail: area(`,"attrs":{"atlas.label.policy":"quiet"}`),292+ areas: 1,293+ wantSomewhere: "",294+ },295+ }296+ for _, c := range cases {297+ t.Run(c.name, func(t *testing.T) {298+ err := buildForValidation(t, c.detail, `{}`, 0, c.paths, c.areas).Validate()299+ if c.wantSomewhere == "" {300+ if err != nil {301+ t.Fatalf("a sound bundle is refused: %v", err)302+ }303+ return304+ }305+ if err == nil || !strings.Contains(err.Error(), c.wantSomewhere) {306+ t.Fatalf("validated with %v, want a complaint about %q", err, c.wantSomewhere)307+ }308+ })309+ }310+}311+227312 // The file name is derived from nothing but the manifest, so the same build228313 // carries the same name wherever and whenever it is written.229314 func TestVersionedFileNameIsDeterministic(t *testing.T) {@@ -27,7 +27,7 @@ type Spec struct {
2727 }2828 2929 // WorldSpec describes one world of a fixture volume: a single layer two zoom30-// levels deep, one category, and the given pins. Merged, when set, rides30+// levels deep, one point collection, and the given pins. Merged, when set, rides3131 // into the payload's merged block verbatim, so a test can hand a world the3232 // provenance ledger a real composition would have written.3333 type WorldSpec struct {@@ -78,7 +78,7 @@ func Build(t testing.TB, dir string, spec Spec) string {
7878 manifest.Worlds = append(manifest.Worlds, bundle.WorldEntry{7979 Slug: m.Slug,8080 Title: m.Title,81- PinCount: len(m.Pins),81+ Points: len(m.Pins),8282 UpdatedAt: spec.CreatedAt,8383 })8484 }@@ -105,13 +105,9 @@ func Build(t testing.TB, dir string, spec Spec) string {
105105 "sourceZoom": 1,106106 "formats": []string{"jpg", "jpg"},107107 }},108- "groups": []map[string]any{{109- "id": 1,110- "title": "Markers",111- "categories": []map[string]any{{112- "id": 1, "title": "Marker", "iconAsset": "marker.svg",113- "displayType": "", "visible": true,114- }},108+ "collections": []map[string]any{{109+ "id": 1, "title": "Marker", "group": "Markers", "kind": "point",110+ "iconAsset": "marker.svg", "visible": true,115111 }},116112 }117113 if m.Merged != nil {@@ -10,19 +10,24 @@ const (
1010 locationMagic = "ATLASLOC"1111 // 2 added the shard column. A map split into layers offers one at a time,1212 // and without it every layer's locations were drawn over every other.13- locationVersion = 213+ // 3 moved the meaning without moving a byte: owner now indexes the world14+ // payload's collections array rather than a flattened category order, and15+ // the region column reads as Member -- the id of the area feature that16+ // contains the point, zero for none.17+ locationVersion = 31418 )1519 16-// Location is one pin as the packed payload carries it. Owner is the position17-// of the pin's category in the map's flattened category order, which is the18-// only category identity the viewer needs once the payload JSON has listed19-// the categories in that same order.20+// Location is one point feature as the packed payload carries it. Owner is21+// the position of the feature's collection in the world payload's22+// collections array, which is the only collection identity the viewer needs23+// once the payload JSON has listed the collections in that same order.24+// Member is the id of the area feature containing this point, zero for none.2025 type Location struct {2126 ID int642227 Title string2328 Lat float642429 Lng float6425- Region int6430+ Member int642631 Shard int642732 Owner uint162833 }@@ -64,7 +69,7 @@ func PackLocations(locations []Location) []byte {
6469 put32(math.Float32bits(float32(location.Lng)))6570 }6671 for _, location := range locations {67- put32(uint32(int32(location.Region)))72+ put32(uint32(int32(location.Member)))6873 }6974 for _, location := range locations {7075 put32(uint32(int32(location.Shard)))@@ -114,7 +119,7 @@ func UnpackLocations(data []byte) ([]Location, error) {
114119 }115120 next(count * 4)116121 for index := range out {117- out[index].Region = int64(int32(u32(index)))122+ out[index].Member = int64(int32(u32(index)))118123 }119124 next(count * 4)120125 for index := range out {@@ -123,8 +123,9 @@ func (b *Bundle) Close() error {
123123 }124124 125125 // payloadPeek is the sliver of a world payload that validation reads: which126-// pyramids its layers draw from, which icons its categories name, and what127-// the payload says of itself in the shared conventions.126+// pyramids its layers draw from, which icons its collections name, what kind127+// of features each collection declares and inlines, and what the payload128+// says of itself in the shared conventions.128129 type payloadPeek struct {129130 Lenses []struct {130131 Tiles string `json:"tiles"`@@ -132,16 +133,19 @@ type payloadPeek struct {
132133 MaxZoom int `json:"maxZoom"`133134 Formats []string `json:"formats"`134135 } `json:"lenses"`135- Groups []struct {136- Categories []struct {137- IconAsset string `json:"iconAsset"`138- DisplayType string `json:"displayType"`139- Attrs map[string]string `json:"attrs"`140- } `json:"categories"`141- } `json:"groups"`142- Zones []struct {143- Attrs map[string]string `json:"attrs"`144- } `json:"zones"`136+ Collections []struct {137+ ID int64 `json:"id"`138+ Title string `json:"title"`139+ Kind string `json:"kind"`140+ IconAsset string `json:"iconAsset"`141+ Attrs map[string]string `json:"attrs"`142+ Features []struct {143+ Geometry []struct {144+ Type string `json:"type"`145+ } `json:"geometry"`146+ Attrs map[string]string `json:"attrs"`147+ } `json:"features"`148+ } `json:"collections"`145149 Attrs map[string]string `json:"attrs"`146150 }147151 @@ -151,11 +155,13 @@ type textPeek struct {
151155 Attrs map[string]string `json:"a"`152156 }153157 154-// Validate checks the manifest's promises against the archive: // world has its three payloads, the packed locations agree with the advertised155-// pin count, every lens's tile levels hold tiles, every named icon exists,156-// and nothing carries a live URL -- Atlas runs with no network, so a URL in a157-// bundle is dead weight at best. Producers and importers run this; opening a158-// bundle at launch does not.158+// Validate checks the manifest's promises against the archive: every world159+// has its three payloads, the packed locations and inline shape features160+// agree with the advertised per-kind counts, every collection's features are161+// the kind it declares, every lens's tile levels hold tiles, every named162+// icon exists, and nothing carries a live URL -- Atlas runs with no network,163+// so a URL in a bundle is dead weight at best. Producers and importers run164+// this; opening a bundle at launch does not.159165 func (b *Bundle) Validate() error {160166 levels := make(map[string]int)161167 for name := range b.entries {@@ -190,9 +196,9 @@ func (b *Bundle) Validate() error {
190196 if err != nil {191197 return fmt.Errorf("world %s: %w", entry.Slug, err)192198 }193- if len(locations) != entry.PinCount {194- return fmt.Errorf("world %s packs %d locations, and the manifest says %d",195- entry.Slug, len(locations), entry.PinCount)199+ if len(locations) != entry.Points {200+ return fmt.Errorf("world %s packs %d locations, and the manifest says %d points",201+ entry.Slug, len(locations), entry.Points)196202 }197203 198204 var peek payloadPeek@@ -221,12 +227,8 @@ func (b *Bundle) Validate() error {
221227 }222228 }223229 }224- for _, group := range peek.Groups {225- for _, category := range group.Categories {226- if category.IconAsset != "" && !b.Has("icons/"+category.IconAsset) {227- return fmt.Errorf("world %s names a missing icon %s", entry.Slug, category.IconAsset)228- }229- }230+ if err := b.validateCollections(entry, peek, locations); err != nil {231+ return err230232 }231233 if b.Manifest.Conventions >= 1 {232234 if err := validateConventions(entry.Slug, peek, text); err != nil {@@ -237,12 +239,91 @@ func (b *Bundle) Validate() error {
237239 return nil238240 }239241 242+// validateCollections holds a world's collections array to the shape the243+// format declares, whatever vocabulary the bundle speaks: every collection a244+// known kind with a distinct id, point features packed rather than inlined,245+// inline geometry agreeing with its collection's kind, every path collection246+// carrying the stroke width a path is drawn at, label policy only where247+// labels draw on ground, the per-kind counts matching the manifest, and every248+// packed location owned by a point collection that exists.249+func (b *Bundle) validateCollections(entry WorldEntry, peek payloadPeek, locations []Location) error {250+ ids := make(map[int64]string, len(peek.Collections))251+ var paths, areas int252+ for _, collection := range peek.Collections {253+ if holder, taken := ids[collection.ID]; taken {254+ return fmt.Errorf("world %s collections %q and %q share id %d",255+ entry.Slug, holder, collection.Title, collection.ID)256+ }257+ ids[collection.ID] = collection.Title258+ if collection.IconAsset != "" && !b.Has("icons/"+collection.IconAsset) {259+ return fmt.Errorf("world %s names a missing icon %s", entry.Slug, collection.IconAsset)260+ }261+ switch collection.Kind {262+ case semconv.GeometryPoint:263+ if len(collection.Features) > 0 {264+ return fmt.Errorf("world %s point collection %q carries %d inline features; points ride the packed payload",265+ entry.Slug, collection.Title, len(collection.Features))266+ }267+ case semconv.GeometryPath, semconv.GeometryArea:268+ for _, feature := range collection.Features {269+ for _, geometry := range feature.Geometry {270+ if !geometryFitsKind(collection.Kind, geometry.Type) {271+ return fmt.Errorf("world %s %s collection %q inlines a %s",272+ entry.Slug, collection.Kind, collection.Title, geometry.Type)273+ }274+ }275+ }276+ if collection.Kind == semconv.GeometryPath {277+ paths += len(collection.Features)278+ if collection.Attrs[semconv.KeyStrokeWidthPx] == "" {279+ return fmt.Errorf("world %s path collection %q declares no %s",280+ entry.Slug, collection.Title, semconv.KeyStrokeWidthPx)281+ }282+ } else {283+ areas += len(collection.Features)284+ }285+ default:286+ return fmt.Errorf("world %s collection %q declares kind %q, which is none of point, path, area",287+ entry.Slug, collection.Title, collection.Kind)288+ }289+ if _, spoken := collection.Attrs[semconv.KeyLabelPolicy]; spoken && collection.Kind != semconv.GeometryArea {290+ return fmt.Errorf("world %s %s collection %q declares a label policy; only areas curate their labels",291+ entry.Slug, collection.Kind, collection.Title)292+ }293+ }294+ if paths != entry.Paths || areas != entry.Areas {295+ return fmt.Errorf("world %s inlines %d paths and %d areas, and the manifest says %d and %d",296+ entry.Slug, paths, areas, entry.Paths, entry.Areas)297+ }298+ for _, location := range locations {299+ if int(location.Owner) >= len(peek.Collections) ||300+ peek.Collections[location.Owner].Kind != semconv.GeometryPoint {301+ return fmt.Errorf("world %s location %d names collection index %d, which is no point collection",302+ entry.Slug, location.ID, location.Owner)303+ }304+ }305+ return nil306+}307+308+// geometryFitsKind says which GeoJSON geometry types a collection kind may309+// inline: ground for areas, lines for paths.310+func geometryFitsKind(kind, geometryType string) bool {311+ switch kind {312+ case semconv.GeometryArea:313+ return geometryType == "MultiPolygon" || geometryType == "Polygon"314+ case semconv.GeometryPath:315+ return geometryType == "MultiLineString" || geometryType == "LineString"316+ }317+ return false318+}319+240320 // validateConventions holds a declaring bundle to the vocabulary it claims:241-// every attribute registered and well-formed, the render attribute agreeing242-// with the legacy field it will one day retire, a declared standard icon243-// actually resolved, and a declared sphere carrying a mapping that parses.244-// A bundle that declares no conventions is not held to any -- the strictness245-// belongs to the claim.321+// every attribute registered, well-formed, and attached where the registry322+// says it lives -- collections speak for their kind, stroke, and labels;323+// features speak only for themselves -- a declared standard icon actually324+// resolved, a declared kind agreeing with the wire's own field, and a325+// declared sphere carrying a mapping that parses. A bundle that declares no326+// conventions is not held to any -- the strictness belongs to the claim.246327 func validateConventions(slug string, peek payloadPeek, text []byte) error {247328 if err := semconv.Validate(semconv.EntityWorld, peek.Attrs); err != nil {248329 return fmt.Errorf("world %s: %w", slug, err)@@ -257,43 +338,21 @@ func validateConventions(slug string, peek payloadPeek, text []byte) error {
257338 return fmt.Errorf("world %s: %w", slug, err)258339 }259340 }260- for _, zone := range peek.Zones {261- // A zone's attributes attach to the feature it is -- except its262- // stroke width, which the v2 wire spells on each zone though the263- // registry attaches it to the collection. The zone answers for its264- // collection until the unified wire moves the write.265- attrs := zone.Attrs266- if width, carried := attrs[semconv.KeyStrokeWidthPx]; carried {267- if err := semconv.Validate(semconv.EntityCollection,268- map[string]string{semconv.KeyStrokeWidthPx: width}); err != nil {269- return fmt.Errorf("world %s: %w", slug, err)270- }271- rest := make(map[string]string, len(attrs)-1)272- for key, value := range attrs {273- if key != semconv.KeyStrokeWidthPx {274- rest[key] = value275- }276- }277- attrs = rest341+ for _, collection := range peek.Collections {342+ if err := semconv.Validate(semconv.EntityCollection, collection.Attrs); err != nil {343+ return fmt.Errorf("world %s collection %q: %w", slug, collection.Title, err)278344 }279- if err := semconv.Validate(semconv.EntityFeature, attrs); err != nil {280- return fmt.Errorf("world %s: %w", slug, err)345+ if declared, spoken := collection.Attrs[semconv.KeyGeometryKind]; spoken && declared != collection.Kind {346+ return fmt.Errorf("world %s collection %q says kind %s while its attributes say %s",347+ slug, collection.Title, collection.Kind, declared)281348 }282- }283- for _, group := range peek.Groups {284- for _, category := range group.Categories {285- if err := semconv.Validate(semconv.EntityCollection, category.Attrs); err != nil {349+ if collection.Attrs[semconv.KeyIconStd] != "" && collection.IconAsset == "" {350+ return fmt.Errorf("world %s declares a standard icon that was never resolved", slug)351+ }352+ for _, feature := range collection.Features {353+ if err := semconv.Validate(semconv.EntityFeature, feature.Attrs); err != nil {286354 return fmt.Errorf("world %s: %w", slug, err)287355 }288- if declared, ok := category.Attrs[semconv.KeyRenderAs]; ok {289- if legacy := semconv.RenderAs(nil, category.DisplayType); declared != legacy {290- return fmt.Errorf("world %s renders a category as %s while its legacy field says %s",291- slug, declared, legacy)292- }293- }294- if category.Attrs[semconv.KeyIconStd] != "" && category.IconAsset == "" {295- return fmt.Errorf("world %s declares a standard icon that was never resolved", slug)296- }297356 }298357 }299358 var entries map[string]textPeek@@ -119,14 +119,18 @@ type HeldPin struct {
119119 120120 // worldDetail is the sliver of a world payload measurement reads.121121 type worldDetail struct {122- Attrs map[string]string `json:"attrs"`123- Groups []struct {124- Categories []struct {125- IconAsset string `json:"iconAsset"`126- DisplayType string `json:"displayType"`127- Attrs map[string]string `json:"attrs"`128- } `json:"categories"`129- } `json:"groups"`122+ Attrs map[string]string `json:"attrs"`123+ Collections []struct {124+ Kind string `json:"kind"`125+ Group string `json:"group"`126+ IconAsset string `json:"iconAsset"`127+ Attrs map[string]string `json:"attrs"`128+ Features []struct {129+ Geometry []struct {130+ Coordinates json.RawMessage `json:"coordinates"`131+ } `json:"geometry"`132+ } `json:"features"`133+ } `json:"collections"`130134 Merged []struct {131135 Source string `json:"source"`132136 DonorPins int `json:"donorPins"`@@ -139,11 +143,6 @@ type worldDetail struct {
139143 Rejected []HeldPin `json:"rejected"`140144 Alignment string `json:"alignment"`141145 } `json:"merged"`142- Zones []struct {143- Features []struct {144- Coordinates json.RawMessage `json:"coordinates"`145- } `json:"features"`146- } `json:"zones"`147146 Lenses []struct {148147 Name string `json:"name"`149148 MaxZoom int `json:"maxZoom"`@@ -270,7 +269,7 @@ func MeasureBundle(path string) (*Build, error) {
270269 var lengths []int271270 for _, entry := range manifest.Worlds {272271 b.MapSlugs = append(b.MapSlugs, entry.Slug)273- b.Pins += entry.PinCount272+ b.Pins += entry.Points274273 var text map[string]struct {275274 Description string `json:"d"`276275 Attrs map[string]string `json:"a"`@@ -308,33 +307,38 @@ func MeasureBundle(path string) (*Build, error) {
308307 for _, lens := range detail.Lenses {309308 b.Depth = max(b.Depth, lens.MaxZoom)310309 }311- b.Zones += len(detail.Zones)312- for _, zone := range detail.Zones {313- for _, feature := range zone.Features {314- b.Vertices += countVertices(feature.Coordinates)315- }316- }317- for _, group := range detail.Groups {318- b.Groups++319- for _, category := range group.Categories {320- b.Categories++321- b.UnknownAttrs += unknownAttrs(category.Attrs)322- if _, declared := category.Attrs[semconv.KeyRenderAs]; declared {323- b.RenderDeclared++324- }325- if category.Attrs[semconv.KeyIconStd] != "" {326- b.StdIcons++327- }328- // The conventions decide what a category is, so the metric329- // judging it reads the same attribute the viewer does.330- if semconv.RenderAs(category.Attrs, category.DisplayType) == semconv.RenderAsText {331- b.TextSets++332- continue333- }334- b.IconsWanted++335- if category.IconAsset != "" {336- b.IconsCarried++310+ groups := make(map[string]bool)311+ for _, collection := range detail.Collections {312+ b.UnknownAttrs += unknownAttrs(collection.Attrs)313+ if collection.Kind != semconv.GeometryPoint {314+ b.Zones += len(collection.Features)315+ for _, feature := range collection.Features {316+ for _, geometry := range feature.Geometry {317+ b.Vertices += countVertices(geometry.Coordinates)318+ }337319 }320+ continue321+ }322+ b.Categories++323+ if !groups[collection.Group] {324+ groups[collection.Group] = true325+ b.Groups++326+ }327+ if _, declared := collection.Attrs[semconv.KeyRenderAs]; declared {328+ b.RenderDeclared++329+ }330+ if collection.Attrs[semconv.KeyIconStd] != "" {331+ b.StdIcons++332+ }333+ // The conventions decide what a collection is, so the metric334+ // judging it reads the same attribute the viewer does.335+ if semconv.RenderAs(collection.Attrs, "") == semconv.RenderAsText {336+ b.TextSets++337+ continue338+ }339+ b.IconsWanted++340+ if collection.IconAsset != "" {341+ b.IconsCarried++338342 }339343 }340344 for _, merged := range detail.Merged {@@ -21,7 +21,7 @@ renamed `atlas.category.key` to `atlas.collection.key` to match.
2121 |---|---|---|---|---|2222 | `atlas.geometry.kind` | collection | `point` \| `path` \| `area` | stable | What shape of thing the collection holds. Declared once per collection; every feature in it is that kind, and readers pick rendering and UX by this key instead of sniffing geometry types. |2323 | `atlas.label.policy` | collection | `always` \| `quiet` | experimental | Whether an area collection's features wear their names on the map always, or quietly — only on highlight, selection, or an explicit reveal. Area collections only; absent means `always` for areas (today's look), and paths are always quiet. |24-| `atlas.render.as` | collection | `pin` \| `text` | stable | How a point collection's features draw: markers, or floating text labels. Absent, legacy `displayType` decides; absent both, `pin`. |24+| `atlas.render.as` | collection | `pin` \| `text` | stable | How a point collection's features draw: markers, or floating text labels. Absent means `pin`; the legacy `displayType` field no longer rides the wire, and only ingestion still reads it to speak this key for old captures. |2525 | `atlas.icon.std` | collection | `set/name`, e.g. `maki/mountain` | stable | Standard-library icon for a collection without artwork. Resolved to embedded bytes at build time; the app only sees the resolved asset. |2626 | `atlas.icon.kind` | collection | `glyph` \| `picture` | stable | Whether the icon asset is a monochrome glyph the viewer tints, or a picture drawn as-is. Names what the `.png` suffix used to imply. |2727 | `atlas.icon.outset` | world | `light` \| `dark` | stable | The rim a map's markers wear to stay legible against its art. |@@ -339,8 +339,9 @@ func Validate(entity Entity, attrs map[string]string) error {
339339 // and the legacy display_type field when no attribute speaks. This is the340340 // one rule the viewer used to hold as a string compare, spelled once for341341 // every consumer: text is text, and everything else is a pin. The legacy342-// parameter stays until flag day -- the generator still speaks for343-// MapGenie's displayType on the v2 wire.342+// parameter survives only at ingestion, where the generator speaks this key343+// for MapGenie captures that predate the conventions; the wire itself344+// carries no displayType any more.344345 func RenderAs(attrs map[string]string, legacyDisplayType string) string {345346 if value, declared := attrs[KeyRenderAs]; declared {346347 return value@@ -57,8 +57,10 @@ func TestRoutesServeEmbeddedExplorer(t *testing.T) {
5757 if body := rec.Body.String(); !strings.Contains(body, `id="layers"`) {5858 t.Fatal("root response does not contain the layers list")5959 }60- if body := rec.Body.String(); !strings.Contains(body, `id="zone-toggle"`) {61- t.Fatal("root response does not contain the zone boundaries switch")60+ // Zones stopped being a hard-coded switch when the legend became one61+ // tree: every collection, shape or point, renders into the same list.62+ if body := rec.Body.String(); !strings.Contains(body, `id="legend"`) {63+ t.Fatal("root response does not contain the legend tree")6264 }6365 }6466 @@ -321,15 +323,14 @@ type mapPayload struct {
321323 X, Y, Width, Height int322324 } `json:"surface"`323325 } `json:"lenses"`324- Groups []struct {325- Categories []struct {326- Title string `json:"title"`327- DisplayType string `json:"displayType"`328- Color string `json:"color"`329- IconAsset string `json:"iconAsset"`330- } `json:"categories"`331- } `json:"groups"`332- Zones []any `json:"zones"`326+ Collections []struct {327+ Title string `json:"title"`328+ Kind string `json:"kind"`329+ Color string `json:"color"`330+ IconAsset string `json:"iconAsset"`331+ Attrs map[string]string `json:"attrs"`332+ Features []any `json:"features"`333+ } `json:"collections"`333334 }334335 335336 func readBuiltPayload(t *testing.T, held *bundle.Bundle, slug string) mapPayload {@@ -500,18 +501,14 @@ func TestBuiltBundlesCarryTextLabelsAndZones(t *testing.T) {
500501 marathon := builtGame(t, games, "marathon")501502 cryo := builtMapSlug(t, marathon, "Cryo Archive")502503 payload := readBuiltPayload(t, marathon, cryo)503- var areaOrdinal = -1504- var ordinal int505- for _, group := range payload.Groups {506- for _, category := range group.Categories {507- if category.Title == "Area" && category.DisplayType == "text" {508- areaOrdinal = ordinal509- }510- ordinal++504+ areaOrdinal := -1505+ for index, collection := range payload.Collections {506+ if collection.Title == "Area" && collection.Attrs["atlas.render.as"] == "text" {507+ areaOrdinal = index511508 }512509 }513510 if areaOrdinal < 0 {514- t.Fatal("Cryo Archive has no text-display Area category")511+ t.Fatal("Cryo Archive has no text-rendered Area collection")515512 }516513 var foundPanopticon bool517514 for _, location := range readBuiltLocations(t, marathon, cryo) {@@ -520,13 +517,19 @@ func TestBuiltBundlesCarryTextLabelsAndZones(t *testing.T) {
520517 }521518 }522519 if !foundPanopticon {523- t.Error("PANOPTICON is not preserved as a text-display location")520+ t.Error("PANOPTICON is not preserved as a text-rendered location")524521 }525522 526523 forza := builtGame(t, games, "forza-horizon-6")527524 japan := readBuiltPayload(t, forza, builtMapSlug(t, forza, "Japan"))528- if len(japan.Zones) != 10 {529- t.Errorf("Forza Japan zones = %d, want 10", len(japan.Zones))525+ var zones int526+ for _, collection := range japan.Collections {527+ if collection.Kind != "point" {528+ zones += len(collection.Features)529+ }530+ }531+ if zones != 10 {532+ t.Errorf("Forza Japan zones = %d, want 10", zones)530533 }531534 var bounded int532535 for _, variant := range japan.Lenses {@@ -592,30 +595,28 @@ func TestBuiltBundlesCarryCategoryIconsAndColors(t *testing.T) {
592595 var foundPokemonCenter bool593596 for _, held := range games {594597 for _, entry := range held.Manifest.Worlds {595- for _, group := range readBuiltPayload(t, held, entry.Slug).Groups {596- for _, category := range group.Categories {597- if category.IconAsset != "" {598- iconAssets++599- if strings.Contains(category.IconAsset, "/") {600- t.Errorf("%s names icon %q, which is not bundle-relative",601- held.Manifest.Volume.Slug, category.IconAsset)602- }603- if !held.Has("icons/" + category.IconAsset) {604- t.Errorf("%s icon %q is missing", held.Manifest.Volume.Slug, category.IconAsset)605- }606- }607- if held.Manifest.Volume.Slug != "pokemon-red-blue-yellow" ||608- entry.Title != "Yellow" || category.Title != "Pokémon Center" {609- continue598+ for _, collection := range readBuiltPayload(t, held, entry.Slug).Collections {599+ if collection.IconAsset != "" {600+ iconAssets++601+ if strings.Contains(collection.IconAsset, "/") {602+ t.Errorf("%s names icon %q, which is not bundle-relative",603+ held.Manifest.Volume.Slug, collection.IconAsset)610604 }611- foundPokemonCenter = true612- if category.Color != "#38344C" {613- t.Errorf("Pokémon Center color = %q, want #38344C", category.Color)614- }615- if category.IconAsset == "" {616- t.Error("Pokémon Center has no icon asset")605+ if !held.Has("icons/" + collection.IconAsset) {606+ t.Errorf("%s icon %q is missing", held.Manifest.Volume.Slug, collection.IconAsset)617607 }618608 }609+ if held.Manifest.Volume.Slug != "pokemon-red-blue-yellow" ||610+ entry.Title != "Yellow" || collection.Title != "Pokémon Center" {611+ continue612+ }613+ foundPokemonCenter = true614+ if collection.Color != "#38344C" {615+ t.Errorf("Pokémon Center color = %q, want #38344C", collection.Color)616+ }617+ if collection.IconAsset == "" {618+ t.Error("Pokémon Center has no icon asset")619+ }619620 }620621 }621622 }@@ -11,6 +11,7 @@ import (
1111 "strings"1212 1313 "github.com/FelineStateMachine/atlas/internal/bundle"14+ "github.com/FelineStateMachine/atlas/internal/semconv"1415 )1516 1617 // policyRevision orders builds of the same capture. The data has not moved@@ -27,7 +28,8 @@ import (
2728 // 6 geometry declared: spheres say so, pins carry true coordinates2829 // 7 attribute-level merge resolution; ledgers name canonical source slugs2930 // 8 zone prose defers to the text payload; zones mark hasText30-const policyRevision = 831+// 9 format v3: one collections array of point, path, and area features32+const policyRevision = 93133 3234 // writeBundles packs each game into its own .atlas file, named by game,3335 // capture day, and stamp. The directory is a registry, not a mirror: a new@@ -69,12 +71,9 @@ func writeVolumeBundle(
6971 manifest := bundle.Manifest{7072 Format: bundle.Format,7173 FormatVersion: bundle.FormatVersion,72- // The manifest names the vocabulary the payloads actually speak, and73- // until the unified wire lands they still speak the v1 shapes -- the74- // registry's own Version moved ahead to 2, but stamping that here75- // would drift every bundle's identity over words no payload says yet.76- // Flag day writes semconv.Version again.77- Conventions: 1,74+ // The manifest names the vocabulary the payloads actually speak,75+ // which since the unified wire is the registry's own version.76+ Conventions: semconv.Version,7877 Volume: bundle.Volume{Slug: game.Slug, Title: game.Title},7978 Version: bundle.Version{Revision: policyRevision},8079 TileGrid: bundle.TileGrid{@@ -112,13 +111,16 @@ func writeVolumeBundle(
112111 stamp.Add("worlds/"+m.Slug+".bin", bundle.HashBytes(packed))113112 stamp.Add("worlds/"+m.Slug+".text", bundle.HashBytes(textJSON))114113 114+ counts := m.featureTally()115115 manifest.Worlds = append(manifest.Worlds, bundle.WorldEntry{116116 Slug: m.Slug,117117 Title: m.Title,118118 Parent: m.Parent,119119 IconOutset: m.IconOutset,120120 Center: bundle.Coordinate{Lat: m.Center.Latitude, Lng: m.Center.Longitude},121- PinCount: m.pinCount(),121+ Points: counts.Point,122+ Paths: counts.Path,123+ Areas: counts.Area,122124 UpdatedAt: m.UpdatedAt,123125 })124126 }@@ -266,52 +266,6 @@ type tileLensManifest struct {
266266 AlignedWith string `json:"alignedWith"`267267 }268268 269-// The v2 wire shapes. The catalog itself holds collections of features270-// (normalize.go); these structs exist only to be reconstructed at emission271-// time, so every byte a bundle says stays exactly what today's readers272-// expect until the wire itself is ready to move.273-type catalogGroup struct {274- ID int64 `json:"id"`275- Title string `json:"title"`276- Categories []catalogCategory `json:"categories"`277-}278-279-type catalogCategory struct {280- ID int64 `json:"id"`281- Title string `json:"title"`282- Icon string `json:"icon,omitempty"`283- IconAsset string `json:"iconAsset,omitempty"`284- // IconPicture marks an icon that already carries its own colours, as285- // against a monochrome glyph whose silhouette is tinted with the category286- // colour. Sliced marker sprites are pictures; icon-font glyphs are not.287- IconPicture bool `json:"iconPicture,omitempty"`288- Color string `json:"color,omitempty"`289- IconColor string `json:"iconColor,omitempty"`290- DisplayType string `json:"displayType"`291- Visible bool `json:"visible"`292- Locations []catalogLocation `json:"locations"`293- // Attrs speaks the conventions for this category -- how it renders, what294- // its icon is -- beside the legacy fields it will one day retire.295- Attrs map[string]string `json:"attrs,omitempty"`296-}297-298-type catalogLocation struct {299- ID int64 `json:"id"`300- Title string `json:"title"`301- Description string `json:"description,omitempty"`302- Latitude float64 `json:"lat"`303- Longitude float64 `json:"lng"`304- RegionID *int64 `json:"regionId,omitempty"`305- // Shard names the layer this location belongs to on a map split into306- // layers, and is absent on maps that are not.307- Shard int64 `json:"shard,omitempty"`308- Links []catalogLink `json:"links,omitempty"`309- // Attrs never rides the detail payload -- locations there are stripped310- // -- and ships instead in the text file beside the description, read311- // when a pin is opened.312- Attrs map[string]string `json:"-"`313-}314-315269 // catalogLink is a cross-reference the source wrote as a mapgenie URL, resolved316270 // to a location in this same map. Atlas is offline, so the URL itself is317271 // dropped and only the in-catalog target survives.@@ -320,24 +274,6 @@ type catalogLink struct {
320274 LocationID int64 `json:"locationId"`321275 }322276 323-// zone is emission-only, like the group tree above it: rebuilt from the324-// implicit region collection's features when a payload is written.325-type zone struct {326- ID int64 `json:"id"`327- Title string `json:"title"`328- Subtitle string `json:"subtitle,omitempty"`329- // Description never rides the detail payload: buildPayload defers it330- // into the text file and leaves HasText as the marker, so a reader331- // fetches a zone's prose only when its card opens.332- Description string `json:"-"`333- HasText bool `json:"hasText,omitempty"`334- ParentRegionID *int64 `json:"parentRegionId,omitempty"`335- Center *coordinate `json:"center,omitempty"`336- Shard int64 `json:"shard,omitempty"`337- Features []geometry `json:"features"`338- Attrs map[string]string `json:"attrs,omitempty"`339-}340-341277 var errWorldNotReady = errors.New("world is not ready for embedding")342278 343279 // preferredWorldOrder keeps a game's primary map ahead of secondary areas.@@ -497,13 +433,11 @@ func buildVolume(
497433 // registry names it by, so a ledger line and a plugin card point at498434 // each other without a translation table.499435 for index := range pieces {500- counts := pieces[index].featureTally()501436 pieces[index].Merged = []mergedSource{{502437 Source: sourceDisplayLabel(ref.Source),503438 Slug: canonicalSourceSlug(ref.Source),504439 Origin: true,505- DonorPins: counts.Point,506- DonorFeatures: counts,440+ DonorFeatures: pieces[index].featureTally(),507441 }}508442 }509443 game.Worlds = append(game.Worlds, pieces...)@@ -537,15 +471,18 @@ func speakConventions(game *catalogVolume) error {
537471 }538472 for collectionIndex := range m.Collections {539473 collection := &m.Collections[collectionIndex]474+ // Every collection's attributes mirror its kind, so the payload475+ // says in the registered vocabulary what the wire's own field476+ // says beside it, and a reader may trust either.477+ if _, declared := collection.Attrs[semconv.KeyGeometryKind]; !declared {478+ collection.Attrs = withAttr(collection.Attrs, semconv.KeyGeometryKind, collection.Kind)479+ }540480 if collection.Kind != kindPoint {541- // A declared collection's attributes are collection542- // attributes in the registry's own terms; the implicit543- // collection carries none and passes trivially.544481 if err := semconv.Validate(semconv.EntityCollection, collection.Attrs); err != nil {545482 return fmt.Errorf("world %s collection %q: %w", m.Slug, collection.Title, err)546483 }547484 for _, shape := range collection.Features {548- if err := validateShapeAttrs(shape.Attrs); err != nil {485+ if err := semconv.Validate(semconv.EntityFeature, shape.Attrs); err != nil {549486 return fmt.Errorf("world %s zone %q: %w", m.Slug, shape.Title, err)550487 }551488 }@@ -584,29 +521,6 @@ func speakConventions(game *catalogVolume) error {
584521 return nil585522 }586523 587-// validateShapeAttrs holds a shape feature's attributes to the registry as588-// the feature they attach to -- with one allowance that lasts until the589-// unified wire: the v2 wire spells a path collection's stroke width on each590-// zone, so the zone answers for its collection's one attribute here. Flag591-// day moves the write where the registry says the key lives and this592-// allowance goes with it.593-func validateShapeAttrs(attrs map[string]string) error {594- if width, carried := attrs[semconv.KeyStrokeWidthPx]; carried {595- if err := semconv.Validate(semconv.EntityCollection,596- map[string]string{semconv.KeyStrokeWidthPx: width}); err != nil {597- return err598- }599- rest := make(map[string]string, len(attrs)-1)600- for key, value := range attrs {601- if key != semconv.KeyStrokeWidthPx {602- rest[key] = value603- }604- }605- attrs = rest606- }607- return semconv.Validate(semconv.EntityFeature, attrs)608-}609-610524 // withAttr sets one attribute on a copy of the map, never the map itself: a611525 // split sheet's pieces share their source's attributes by reference, and612526 // speaking for one piece must not put words in another's mouth.@@ -141,8 +141,8 @@ func TestBuildPayloadPacksEveryColumn(t *testing.T) {
141141 if magic := string(packed[:8]); magic != "ATLASLOC" {142142 t.Fatalf("magic = %q, want %q", magic, "ATLASLOC")143143 }144- if version := binary.LittleEndian.Uint16(packed[8:]); version != 2 {145- t.Fatalf("version = %d, want 2", version)144+ if version := binary.LittleEndian.Uint16(packed[8:]); version != 3 {145+ t.Fatalf("version = %d, want 3", version)146146 }147147 count := int(binary.LittleEndian.Uint32(packed[10:]))148148 if count != 2 {@@ -161,8 +161,8 @@ func TestBuildPayloadPacksEveryColumn(t *testing.T) {
161161 if ids := column(0); ids[0] != 11 || ids[1] != 12 {162162 t.Fatalf("ids = %v, want [11 12]", ids)163163 }164- if regions := column(3); regions[0] != 0 || regions[1] != 77 {165- t.Fatalf("regions = %v, want [0 77]", regions)164+ if members := column(3); members[0] != 0 || members[1] != 77 {165+ t.Fatalf("members = %v, want [0 77]", members)166166 }167167 if shards := column(4); shards[0] != 1783 || shards[1] != 1785 {168168 t.Fatalf("shards = %v, want [1783 1785]", shards)@@ -94,14 +94,12 @@ type mergedSource struct {
9494 Slug string `json:"slug,omitempty"`9595 // Origin marks the account of the source the map itself came from, so a9696 // single-source map still says where it is from and a composed map's97- // unledgered pins have somewhere to answer to. DonorPins on an origin98- // account is simply the map's own count at composition.99- Origin bool `json:"origin,omitempty"`100- DonorPins int `json:"donorPins"`101- // DonorFeatures is the donor's whole offering counted per kind, points102- // included: DonorPins repeats its point count, the older spelling kept103- // for readers that predate shapes in the ledger.104- DonorFeatures featureCounts `json:"donorFeatures,omitempty"`97+ // unledgered pins have somewhere to answer to. DonorFeatures on an98+ // origin account is simply the map's own tally at composition.99+ Origin bool `json:"origin,omitempty"`100+ // DonorFeatures is the donor's whole offering counted per kind. The101+ // donorPins spelling it stood beside died with the v2 wire.102+ DonorFeatures featureCounts `json:"donorFeatures"`105103 Matched []mergedPair `json:"matched,omitempty"`106104 Added int `json:"added"`107105 // AddedShapes is reserved: no shape feature merges yet, so it is always@@ -437,7 +435,6 @@ func mergeWorld(
437435 })438436 }439437 for _, pin := range donorCollection.Features {440- merge.DonorPins++441438 merge.DonorFeatures.Point++442439 x, y := affine.Apply(443440 projectX(pin.Lng, donorGrid),@@ -518,13 +515,11 @@ func mergeWorld(
518515 }519516 520517 if len(keptCollections) > 0 {521- // The source-named group exists only on the wire; here it is a group522- // title and number the kept collections share, and the emission523- // regroups them under it exactly as the old group append did.524- groupID := mergedGroupID(winner)518+ // The kept collections file under a group named for their source, so519+ // the legend says where they came from without a section of its own520+ // machinery.525521 for index := range keptCollections {526522 keptCollections[index].Group = sourceLabel527- keptCollections[index].GroupID = groupID528523 }529524 winner.Collections = append(winner.Collections, keptCollections...)530525 }@@ -757,22 +752,6 @@ func carryIcon(winnerGame, donorGame *catalogVolume, collection *worldCollection
757752 return nil758753 }759754 760-// mergedGroupID numbers the source's group away from every id the map761-// already uses.762-func mergedGroupID(winner *catalogWorld) int64 {763- used := make(map[int64]bool)764- for _, collection := range winner.Collections {765- if collection.Kind == kindPoint {766- used[collection.GroupID] = true767- }768- }769- id := int64(1)770- for used[id] {771- id++772- }773- return id774-}775-776755 func sourceLabelOf(donor *catalogWorld, donorGame *catalogVolume) string {777756 for _, account := range donor.Merged {778757 if account.Origin {@@ -863,12 +842,6 @@ func enrichedCount(merge *mergedSource) int {
863842 // serving map held made worse. It fails the build rather than writing a864843 // bundle that quietly lost something -- or quietly agreed too much.865844 func mergeGate(merge *mergedSource, winner *catalogWorld) error {866- // The two spellings of the donor's point count are one number, or the867- // ledger is already lying to one of its readers.868- if merge.DonorPins != merge.DonorFeatures.Point {869- return fmt.Errorf("ledger speaks two point counts: donorPins %d, donorFeatures %d",870- merge.DonorPins, merge.DonorFeatures.Point)871- }872845 heldPoints, heldShapes := 0, 0873846 for _, held := range merge.Held {874847 if held.Reason == heldShapeReason {@@ -19,7 +19,7 @@ func fixtureMergeGrid() tileGrid {
1919 // and every donor pin resolves as matched.2020 func fixtureLandmarks(base int64) worldCollection {2121 collection := worldCollection{22- ID: 1, Title: "Landmarks", Group: "Markers", GroupID: 1,22+ ID: 1, Title: "Landmarks", Group: "Markers",2323 Kind: kindPoint, Icon: "landmark", Visible: true,2424 }2525 lats := []float64{40, 10, -20}@@ -54,7 +54,6 @@ func TestMergeWorldHoldsDonorShapeFeatures(t *testing.T) {
5454 },5555 Merged: []mergedSource{{5656 Source: "MapGenie", Slug: "mapgenie", Origin: true,57- DonorPins: 12,5857 DonorFeatures: featureCounts{Point: 12, Area: 1},5958 }},6059 }},@@ -75,7 +74,6 @@ func TestMergeWorldHoldsDonorShapeFeatures(t *testing.T) {
7574 },7675 Merged: []mergedSource{{7776 Source: "IGN Wiki", Slug: "ign-wiki", Origin: true,78- DonorPins: 12,7977 DonorFeatures: featureCounts{Point: 12, Path: 1, Area: 2},8078 }},8179 }},@@ -93,10 +91,6 @@ func TestMergeWorldHoldsDonorShapeFeatures(t *testing.T) {
9391 if account.DonorFeatures != (featureCounts{Point: 12, Path: 1, Area: 2}) {9492 t.Errorf("donor features counted as %+v", account.DonorFeatures)9593 }96- if account.DonorPins != account.DonorFeatures.Point {97- t.Errorf("donorPins %d disagrees with donorFeatures.point %d",98- account.DonorPins, account.DonorFeatures.Point)99- }10094 if len(account.Matched) != 12 || account.Added != 0 || account.AddedShapes != 0 {10195 t.Errorf("points resolved as %d matched, %d added, %d added shapes; want 12, 0, 0",10296 len(account.Matched), account.Added, account.AddedShapes)@@ -129,8 +123,7 @@ func gateWorld(counts featureCounts, collections ...worldCollection) *catalogWor
129123 Slug: "overworld",130124 Collections: collections,131125 Merged: []mergedSource{{132- Source: "MapGenie", Origin: true,133- DonorPins: counts.Point, DonorFeatures: counts,126+ Source: "MapGenie", Origin: true, DonorFeatures: counts,134127 }},135128 }136129 }@@ -142,12 +135,6 @@ func TestMergeGateAccountsPerKind(t *testing.T) {
142135 winner *catalogWorld143136 want string144137 }{145- {146- name: "the two point spellings must agree",147- merge: &mergedSource{DonorPins: 3, DonorFeatures: featureCounts{Point: 2}},148- winner: gateWorld(featureCounts{}),149- want: "two point counts",150- },151138 {152139 name: "every donor shape must be held",153140 merge: &mergedSource{DonorFeatures: featureCounts{Area: 1}},@@ -156,7 +143,7 @@ func TestMergeGateAccountsPerKind(t *testing.T) {
156143 },157144 {158145 name: "a held point never settles the shape account",159- merge: &mergedSource{DonorPins: 1, DonorFeatures: featureCounts{Point: 1, Area: 1},146+ merge: &mergedSource{DonorFeatures: featureCounts{Point: 1, Area: 1},160147 Held: []heldPin{{Donor: 5, Title: "Well", Reason: "named like another"}}},161148 winner: gateWorld(featureCounts{}),162149 want: "holds 0 shape features of the 1",@@ -194,7 +181,7 @@ func TestMergeGateAccountsPerKind(t *testing.T) {
194181 },195182 {196183 name: "a consistent account of every kind passes",197- merge: &mergedSource{DonorPins: 1, DonorFeatures: featureCounts{Point: 1, Path: 1, Area: 1},184+ merge: &mergedSource{DonorFeatures: featureCounts{Point: 1, Path: 1, Area: 1},198185 Held: []heldPin{199186 {Donor: 5, Title: "Well", Reason: "named like another"},200187 {Donor: 6, Title: "Race", Reason: heldShapeReason},@@ -2,6 +2,7 @@ package main
22 33 import (44 "fmt"5+ "hash/fnv"56 67 "github.com/FelineStateMachine/atlas/internal/semconv"78 )@@ -9,15 +10,12 @@ import (
910 // A map's contents used to mirror the MapGenie shape all the way through the1011 // generator: pins under groups and categories, regions standing apart as1112 // zones, and every pass over a map written twice because of it. The catalog12-// now holds one model instead -- collections of features, each feature a13-// geometry with attributes -- and the v2 wire keeps its exact bytes by being14-// reconstructed from that model at emission time. The wire can only move once15-// everything it says provably fits the model, and the byte-identical rebuild16-// is that proof.13+// holds one model instead -- collections of features, each feature a14+// geometry with attributes -- and since format v3 the wire says the same15+// thing the model does, so what this file normalizes is what a payload16+// carries.1717 18-// A collection's kind is the dimensionality of its features. Nothing19-// classifies geometry yet -- paths still travel as pretend areas -- so the20-// vocabulary is declared in full but only points and areas are spoken.18+// A collection's kind is the dimensionality of its features.2119 const (2220 kindPoint = "point"2321 kindPath = "path"@@ -30,26 +28,25 @@ const (
3028 const regionsCollectionKey = "regions"3129 3230 // worldCollection is one legend entry's worth of features: a category of33-// pins, or the world's regions gathered under the implicit key.31+// pins, or a curated set of shapes, or the world's undeclared regions32+// gathered under the implicit key.3433 type worldCollection struct {3534 ID int643635 // Key is the collection's curation and merge identity; legacy categories3736 // carry none and are still met by their icon key instead.3837 Key string3938 Title string40- // Group is the legend section this collection files under -- today's41- // group title -- and GroupID is the number that lets the v2 groups be42- // re-emitted byte-identically. The implicit region collection has neither.43- Group string44- GroupID int6445- // Kind is "point", "path" or "area". The implicit region collection says46- // "area" nominally; its features keep whatever geometry the source drew.39+ // Group is the legend section this collection files under. Shape40+ // collections usually carry none and gather in the viewer's own section.41+ Group string42+ // Kind is "point", "path" or "area".4743 Kind string4844 Icon, IconAsset string4945 IconPicture bool5046 Color, IconColor string51- // DisplayType is the legacy render field, kept only because the v2 wire52- // still spells it.47+ // DisplayType is MapGenie's legacy render field, never emitted: it exists48+ // only so speakConventions can derive atlas.render.as for captures from49+ // before the conventions.5350 DisplayType string5451 Visible bool5552 Attrs map[string]string@@ -72,8 +69,8 @@ type feature struct {
7269 Parent *int647370 Center *coordinate7471 Shard int6475- // HasText stays unset until the wire carries features directly: the v276- // emission derives its marker from Description at packing time.72+ // HasText is set at packing time, when the Description defers into the73+ // text payload and this marker is what the wire keeps of it.7774 HasText bool7875 Links []catalogLink7976 Attrs map[string]string@@ -96,7 +93,6 @@ func normalizeWorld(raw rawMap) ([]worldCollection, error) {
9693 ID: rawCategory.ID,9794 Title: rawCategory.Title,9895 Group: rawGroup.Title,99- GroupID: rawGroup.ID,10096 Kind: kindPoint,10197 Icon: rawCategory.Icon,10298 Color: resolvedCategoryColor(rawGroup, rawCategory),@@ -148,16 +144,18 @@ func normalizeWorld(raw rawMap) ([]worldCollection, error) {
148144 }149145 declaredAt[decl.Key] = len(declared)150146 declared = append(declared, worldCollection{151- Key: decl.Key,152- Title: decl.Title,153- Kind: kind,154- Attrs: decl.Attrs,147+ Key: decl.Key,148+ Title: decl.Title,149+ Kind: kind,150+ Visible: true,151+ Attrs: decl.Attrs,155152 })156153 }157154 implicit := worldCollection{158- Key: regionsCollectionKey,159- Title: "Regions",160- Kind: kindArea,155+ Key: regionsCollectionKey,156+ Title: "Regions",157+ Kind: kindArea,158+ Visible: true,161159 }162160 for _, rawRegion := range raw.Regions {163161 shape := feature{@@ -206,96 +204,52 @@ func normalizeWorld(raw rawMap) ([]worldCollection, error) {
206204 home.Features = append(home.Features, shape)207205 }208206 }209- for _, collection := range declared {210- if len(collection.Features) > 0 {211- collections = append(collections, collection)212- }207+ // Shape collections need numeric identities of their own on the wire --208+ // the viewer's hide and unfold sets are keyed by them -- and a source209+ // declares keys, not numbers, so the numbers are derived from the same210+ // stable names the way every other id in the pipeline is.211+ used := make(map[int64]string, len(collections))212+ for _, collection := range collections {213+ used[collection.ID] = collection.Title213214 }214- if len(implicit.Features) > 0 {215- collections = append(collections, implicit)216- }217- return collections, nil218-}219-220-// v2Groups rebuilds the wire's group tree from the collections. Categories221-// within a group were contiguous in every capture and every pass keeps them222-// so, which is why regrouping by first-seen GroupID reproduces the original223-// structure byte for byte.224-func (m catalogWorld) v2Groups() []catalogGroup {225- var groups []catalogGroup226- at := make(map[int64]int)227- for _, collection := range m.Collections {228- if collection.Kind != kindPoint {229- continue230- }231- index, seen := at[collection.GroupID]232- if !seen {233- index = len(groups)234- at[collection.GroupID] = index235- groups = append(groups, catalogGroup{ID: collection.GroupID, Title: collection.Group})236- }237- category := catalogCategory{238- ID: collection.ID,239- Title: collection.Title,240- Icon: collection.Icon,241- IconAsset: collection.IconAsset,242- IconPicture: collection.IconPicture,243- Color: collection.Color,244- IconColor: collection.IconColor,245- DisplayType: collection.DisplayType,246- Visible: collection.Visible,247- Attrs: collection.Attrs,215+ claim := func(key string) (int64, error) {216+ hash := fnv.New32a()217+ fmt.Fprintf(hash, "%d:collection:%s", raw.ID, key)218+ id := int64(hash.Sum32() & 0x7fffffff)219+ if id == 0 {220+ id = 1248221 }249- for _, f := range collection.Features {250- category.Locations = append(category.Locations, catalogLocation{251- ID: f.ID,252- Title: f.Title,253- Description: f.Description,254- Latitude: f.Lat,255- Longitude: f.Lng,256- RegionID: f.Member,257- Shard: f.Shard,258- Links: f.Links,259- Attrs: f.Attrs,260- })222+ if holder, taken := used[id]; taken {223+ return 0, fmt.Errorf("collection %q collides with %q on id %d", key, holder, id)261224 }262- groups[index].Categories = append(groups[index].Categories, category)225+ used[id] = key226+ return id, nil263227 }264- return groups265-}266-267-// v2Zones rebuilds the wire's zone list from the shape collections, each268-// collection's features in the order the capture told them and the269-// collections in declaration order. That concatenation is exactly the raw270-// region order: the one producer that declares collections emits its regions271-// grouped by dataset in the same curated order it declares them, and the272-// implicit collection -- last here -- is the whole list everywhere else.273-func (m catalogWorld) v2Zones() []zone {274- var zones []zone275- for _, collection := range m.Collections {276- if collection.Kind == kindPoint {228+ for _, collection := range declared {229+ if len(collection.Features) == 0 {277230 continue278231 }279- for _, f := range collection.Features {280- zones = append(zones, zone{281- ID: f.ID,282- Title: f.Title,283- Subtitle: f.Subtitle,284- Description: f.Description,285- ParentRegionID: f.Parent,286- Center: f.Center,287- Shard: f.Shard,288- Features: f.Geometry,289- Attrs: f.Attrs,290- })232+ id, err := claim(collection.Key)233+ if err != nil {234+ return nil, err291235 }236+ collection.ID = id237+ collections = append(collections, collection)292238 }293- return zones239+ if len(implicit.Features) > 0 {240+ id, err := claim(implicit.Key)241+ if err != nil {242+ return nil, err243+ }244+ implicit.ID = id245+ collections = append(collections, implicit)246+ }247+ return collections, nil294248 }295249 296250 // featureTally counts the map's features by kind: the origin account's view297-// of what the map holds, and the yardstick every merge audit measures the298-// composed map against.251+// of what the map holds, the manifest's per-kind counts, and the yardstick252+// every merge audit measures the composed map against.299253 func (m catalogWorld) featureTally() featureCounts {300254 var counts featureCounts301255 for _, collection := range m.Collections {@@ -310,9 +264,3 @@ func (m catalogWorld) featureTally() featureCounts {
310264 }311265 return counts312266 }313-314-// pinCount is how many point features the map holds, which is what the315-// manifest has always reported for it.316-func (m catalogWorld) pinCount() int {317- return m.featureTally().Point318-}@@ -9,15 +9,15 @@ import (
99 "github.com/FelineStateMachine/atlas/internal/semconv"1010 )1111 12-// The collections model only earns its place if the v2 wire can be rebuilt13-// from it without a byte moving: a capture normalized into collections and14-// re-emitted must say exactly what the old direct build said. This walks one15-// fixture through normalizeWorld and the emission-time reconstruction and16-// holds the result to the shapes the old code produced.17-func TestNormalizeWorldRoundTripsTheV2Shapes(t *testing.T) {12+// A capture normalizes into the same collections the wire now says: each13+// category a point collection carrying its group title and resolved colours,14+// the regions folded into the implicit area collection with a claimed id of15+// its own, and what never drew never surviving.16+func TestNormalizeWorldBuildsTheCollections(t *testing.T) {1817 oldTown := int64(9001)1918 ring := json.RawMessage(`[[[[0,0],[1,0],[1,1]]]]`)2019 raw := rawMap{20+ ID: 7,2121 Groups: []rawGroup{2222 {ID: 1, Title: "Districts", Color: "38344C", IconColor: "ffffff", Categories: []rawCategory{2323 {@@ -51,7 +51,7 @@ func TestNormalizeWorldRoundTripsTheV2Shapes(t *testing.T) {
5151 },5252 },5353 // A region whose geometry all came through empty has nothing to54- // draw, and the old build dropped it whole.54+ // draw, and the build drops it whole.5555 {ID: 9002, Title: "Ghost", Features: []rawFeature{{Geometry: geometry{Type: "Polygon"}}}},5656 },5757 }@@ -60,51 +60,50 @@ func TestNormalizeWorldRoundTripsTheV2Shapes(t *testing.T) {
6060 if err != nil {6161 t.Fatal(err)6262 }63- m := catalogWorld{Collections: collections}64-65- wantGroups := []catalogGroup{66- {ID: 1, Title: "Districts", Categories: []catalogCategory{67- {68- ID: 10, Title: "Shops", Icon: "shop", Color: "#AABBCC", IconColor: "#FFFFFF",69- DisplayType: "pin", Visible: true,70- Locations: []catalogLocation{{71- ID: 100, Title: "Bakery", Description: "Fresh bread.",72- Latitude: 1.5, Longitude: -2.25, RegionID: &oldTown,73- Attrs: map[string]string{"atlas.geo.lat": "39.8"},74- }},75- },76- {77- ID: 11, Title: "Signs", Icon: "sign", Color: "#38344C", IconColor: "#FFFFFF",78- DisplayType: "text",79- },80- }},81- {ID: 2, Title: "Nature", Categories: []catalogCategory{82- {ID: 12, Title: "Trees", Icon: "tree", Visible: true},83- }},63+ if len(collections) != 4 {64+ t.Fatalf("normalized into %d collections, want 4: %+v", len(collections), collections)65+ }66+ shops := collections[0]67+ if shops.ID != 10 || shops.Group != "Districts" || shops.Kind != kindPoint ||68+ shops.Color != "#AABBCC" || shops.IconColor != "#FFFFFF" || !shops.Visible {69+ t.Fatalf("shops normalized as %+v", shops)70+ }71+ wantBakery := feature{72+ ID: 100, Title: "Bakery", Description: "Fresh bread.",73+ Lat: 1.5, Lng: -2.25, Member: &oldTown,74+ Attrs: map[string]string{"atlas.geo.lat": "39.8"},75+ }76+ if len(shops.Features) != 1 || !reflect.DeepEqual(shops.Features[0], wantBakery) {77+ t.Fatalf("bakery normalized as %+v\nwant %+v", shops.Features, wantBakery)8478 }85- if got := m.v2Groups(); !reflect.DeepEqual(got, wantGroups) {86- t.Fatalf("v2 groups = %+v\nwant %+v", got, wantGroups)79+ if collections[1].ID != 11 || collections[1].DisplayType != "text" ||80+ collections[1].Color != "#38344C" || collections[2].Group != "Nature" {81+ t.Fatalf("point collections normalized as %+v", collections[1:3])8782 }8883 89- wantZones := []zone{{84+ implicit := collections[3]85+ if implicit.Key != regionsCollectionKey || implicit.Kind != kindArea || !implicit.Visible {86+ t.Fatalf("implicit collection = %+v", implicit)87+ }88+ if implicit.ID == 0 || implicit.ID != int64(int32(implicit.ID)) {89+ t.Fatalf("implicit collection id %d is no positive int31", implicit.ID)90+ }91+ wantOldTown := feature{9092 ID: 9001, Title: "Old Town", Subtitle: "OT", Description: "The old quarter.",9193 Center: &coordinate{Latitude: 3.25, Longitude: 12.5},92- Features: []geometry{{Type: "MultiPolygon", Coordinates: ring}},93- }}94- if got := m.v2Zones(); !reflect.DeepEqual(got, wantZones) {95- t.Fatalf("v2 zones = %+v\nwant %+v", got, wantZones)94+ Geometry: []geometry{{Type: "MultiPolygon", Coordinates: ring}},9695 }97-98- if got := m.pinCount(); got != 1 {99- t.Fatalf("pin count = %d, want 1", got)96+ if len(implicit.Features) != 1 || !reflect.DeepEqual(implicit.Features[0], wantOldTown) {97+ t.Fatalf("implicit features = %+v\nwant one Old Town", implicit.Features)10098 }101- last := collections[len(collections)-1]102- if last.Key != regionsCollectionKey || last.Kind != kindArea {103- t.Fatalf("implicit collection = {key %q, kind %q}, want {%q, %q}",104- last.Key, last.Kind, regionsCollectionKey, kindArea)99+100+ counts := catalogWorld{Collections: collections}.featureTally()101+ if counts != (featureCounts{Point: 1, Area: 1}) {102+ t.Fatalf("tally = %+v, want one point and one area", counts)105103 }106104 }107105 106+108107 // declaredFixture is a capture that declares its collections: an area109108 // collection and a path collection, a region claiming each, and one region110109 // claiming nothing, which still folds into the implicit collection.@@ -134,9 +133,7 @@ func declaredFixture() rawMap {
134133 }135134 136135 // Declared collections bucket the regions that claim them, in declaration137-// order after the point collections, the implicit collection last -- and the138-// v2 zone emission walks that order, which for a producer that declares in139-// its own region order is exactly the raw order the wire always said.136+// order after the point collections, the implicit collection last.140137 func TestNormalizeWorldBucketsDeclaredCollections(t *testing.T) {141138 collections, err := normalizeWorld(declaredFixture())142139 if err != nil {@@ -164,14 +161,6 @@ func TestNormalizeWorldBucketsDeclaredCollections(t *testing.T) {
164161 at, collections[at].Features, want)165162 }166163 }167- m := catalogWorld{Collections: collections}168- ids := []int64{}169- for _, z := range m.v2Zones() {170- ids = append(ids, z.ID)171- }172- if !reflect.DeepEqual(ids, []int64{1, 2, 3}) {173- t.Fatalf("v2 zones emit as %v, want the raw region order 1,2,3", ids)174- }175164 }176165 177166 func TestNormalizeWorldRefusals(t *testing.T) {@@ -13,24 +13,27 @@ import (
1313 //1414 // Each map splits three ways by when its parts are needed:1515 //16-// - maps/<slug>.json its layers, categories and regions, read when the map opens17-// - maps/<slug>.bin its locations, packed, read when the map opens18-// - maps/<slug>.text descriptions and cross-references, read when a pin is opened16+// - maps/<slug>.json its layers and collections, read when the map opens17+// - maps/<slug>.bin its point features, packed, read when the map opens18+// - maps/<slug>.text descriptions and cross-references, read when a feature is opened1919 //20-// Descriptions were half the catalog by weight and are read one pin at a time,21-// so they are the part most worth not loading. Locations are overwhelmingly22-// numbers, and numbers written as text cost several times what they measure.20+// Descriptions were half the catalog by weight and are read one feature at a21+// time, so they are the part most worth not loading. Point features are22+// overwhelmingly numbers, and numbers written as text cost several times what23+// they measure; shape features are mostly geometry either way, so they ride24+// the JSON inline under the collection that declares them.2325 24-// worldDetail is everything needed to draw a map except its locations, which25-// travel packed alongside.26+// worldDetail is everything needed to draw a map except its point features,27+// which travel packed alongside. Collections is the map's whole structure in28+// one flat array, order significant: the packed payload's owner column29+// indexes it.2630 type worldDetail struct {2731 // Grid travels with the layers it describes: a map cut from a window of its2832 // own is the only one that carries it, and it is needed exactly when the2933 // map is opened.30- Grid *worldGrid `json:"grid,omitempty"`31- Lenses []lens `json:"lenses"`32- Groups []catalogGroup `json:"groups"`33- Zones []zone `json:"zones,omitempty"`34+ Grid *worldGrid `json:"grid,omitempty"`35+ Lenses []lens `json:"lenses"`36+ Collections []wireCollection `json:"collections"`3437 // Attrs is the map speaking the shared conventions -- its geometry, its3538 // marker outset -- for any reader that knows the vocabulary.3639 Attrs map[string]string `json:"attrs,omitempty"`@@ -40,70 +43,134 @@ type worldDetail struct {
4043 Merged []mergedSource `json:"merged,omitempty"`4144 }4245 43-// locationText holds what only a selected pin needs.46+// wireCollection is one collection as the payload spells it. A point47+// collection carries no inline features -- its members ride the packed48+// payload, owned by this collection's index -- where a path or area49+// collection inlines its features whole.50+type wireCollection struct {51+ ID int64 `json:"id"`52+ Title string `json:"title"`53+ Group string `json:"group,omitempty"`54+ Kind string `json:"kind"`55+ Icon string `json:"icon,omitempty"`56+ IconAsset string `json:"iconAsset,omitempty"`57+ IconPicture bool `json:"iconPicture,omitempty"`58+ Color string `json:"color,omitempty"`59+ IconColor string `json:"iconColor,omitempty"`60+ Visible bool `json:"visible"`61+ Attrs map[string]string `json:"attrs,omitempty"`62+ Features []wireFeature `json:"features,omitempty"`63+}64+65+// wireFeature is one shape feature as the payload inlines it. Its prose66+// defers into the text payload behind the hasText marker, exactly the way a67+// point feature's does; its attributes stay inline, because a card needs them68+// the moment ground is asked about.69+type wireFeature struct {70+ ID int64 `json:"id"`71+ Title string `json:"title"`72+ Subtitle string `json:"subtitle,omitempty"`73+ HasText bool `json:"hasText,omitempty"`74+ Parent *int64 `json:"parent,omitempty"`75+ Center *coordinate `json:"center,omitempty"`76+ Shard int64 `json:"shard,omitempty"`77+ Geometry []geometry `json:"geometry"`78+ Attrs map[string]string `json:"attrs,omitempty"`79+}80+81+// locationText holds what only a selected feature needs.4482 type locationText struct {4583 Description string `json:"d,omitempty"`4684 Links []catalogLink `json:"l,omitempty"`47- // Attrs carries a pin's own conventions -- its true planetary85+ // Attrs carries a point feature's own conventions -- its true planetary4886 // coordinates, when a source published them -- read when its card opens,4987 // like everything else here.5088 Attrs map[string]string `json:"a,omitempty"`5189 }5290 53-// buildPayload splits one map three ways: its layers, categories and regions54-// as a detail structure, its locations packed, and its descriptions keyed by55-// location -- and by zone, since a zone's prose defers the same way a pin's56-// does. Zone and pin identifiers share one claimed space, so one map never57-// keys two things alike.91+// buildPayload splits one map three ways: its layers and collections as a92+// detail structure, its point features packed, and its descriptions keyed by93+// feature -- every kind defers its prose the same way. Feature identifiers94+// share one claimed space, so one map never keys two things alike.5895 //59-// The catalog holds collections of features; the v2 groups and zones are60-// rebuilt here, at the last moment before marshalling, so the wire's bytes61-// answer only to the reconstruction and not to how the model is arranged.96+// Point collections are written first and shape collections after, so a97+// packed location's owner is simply the ordinal of its collection among the98+// points -- and the wire order is the legend order: categories as the source99+// grouped them, then the curated shape collections, then the implicit one.62100 func buildPayload(m catalogWorld) (worldDetail, []byte, map[string]locationText) {63- // Categories keep their identity; their locations travel packed, each64- // carrying the position of its category in this same flattened order.65101 detail := worldDetail{Grid: m.Grid, Lenses: m.Lenses, Attrs: m.Attrs, Merged: m.Merged}66102 var locations []bundle.Location67103 text := make(map[string]locationText)68- for _, z := range m.v2Zones() {69- if z.Description != "" {70- text[strconv.FormatInt(z.ID, 10)] = locationText{Description: z.Description}71- z.HasText = true104+ for _, collection := range m.Collections {105+ if collection.Kind != kindPoint {106+ continue72107 }73- detail.Zones = append(detail.Zones, z)74- }75- var ordinal uint1676- for _, group := range m.v2Groups() {77- listed := catalogGroup{ID: group.ID, Title: group.Title}78- for _, category := range group.Categories {79- stripped := category80- stripped.Locations = nil81- listed.Categories = append(listed.Categories, stripped)82- for _, location := range category.Locations {83- var region int6484- if location.RegionID != nil {85- region = *location.RegionID86- }87- locations = append(locations, bundle.Location{88- ID: location.ID,89- Title: location.Title,90- Lat: location.Latitude,91- Lng: location.Longitude,92- Region: region,93- Shard: location.Shard,94- Owner: ordinal,95- })96- if location.Description != "" || len(location.Links) > 0 || len(location.Attrs) > 0 {97- text[strconv.FormatInt(location.ID, 10)] = locationText{98- Description: location.Description,99- Links: location.Links,100- Attrs: location.Attrs,101- }108+ owner := uint16(len(detail.Collections))109+ detail.Collections = append(detail.Collections, listedCollection(collection))110+ for _, pin := range collection.Features {111+ var member int64112+ if pin.Member != nil {113+ member = *pin.Member114+ }115+ locations = append(locations, bundle.Location{116+ ID: pin.ID,117+ Title: pin.Title,118+ Lat: pin.Lat,119+ Lng: pin.Lng,120+ Member: member,121+ Shard: pin.Shard,122+ Owner: owner,123+ })124+ if pin.Description != "" || len(pin.Links) > 0 || len(pin.Attrs) > 0 {125+ text[strconv.FormatInt(pin.ID, 10)] = locationText{126+ Description: pin.Description,127+ Links: pin.Links,128+ Attrs: pin.Attrs,102129 }103130 }104- ordinal++105131 }106- detail.Groups = append(detail.Groups, listed)132+ }133+ for _, collection := range m.Collections {134+ if collection.Kind == kindPoint {135+ continue136+ }137+ listed := listedCollection(collection)138+ for _, shape := range collection.Features {139+ feature := wireFeature{140+ ID: shape.ID,141+ Title: shape.Title,142+ Subtitle: shape.Subtitle,143+ Parent: shape.Parent,144+ Center: shape.Center,145+ Shard: shape.Shard,146+ Geometry: shape.Geometry,147+ Attrs: shape.Attrs,148+ }149+ if shape.Description != "" {150+ text[strconv.FormatInt(shape.ID, 10)] = locationText{Description: shape.Description}151+ feature.HasText = true152+ }153+ listed.Features = append(listed.Features, feature)154+ }155+ detail.Collections = append(detail.Collections, listed)107156 }108157 return detail, bundle.PackLocations(locations), text109158 }159+160+// listedCollection is the collection as the wire lists it, features left for161+// the caller to fill in or leave packed.162+func listedCollection(collection worldCollection) wireCollection {163+ return wireCollection{164+ ID: collection.ID,165+ Title: collection.Title,166+ Group: collection.Group,167+ Kind: collection.Kind,168+ Icon: collection.Icon,169+ IconAsset: collection.IconAsset,170+ IconPicture: collection.IconPicture,171+ Color: collection.Color,172+ IconColor: collection.IconColor,173+ Visible: collection.Visible,174+ Attrs: collection.Attrs,175+ }176+}@@ -4,39 +4,88 @@ import (
44 "encoding/json"55 "strings"66 "testing"7+8+ "github.com/FelineStateMachine/atlas/internal/bundle"9+ "github.com/FelineStateMachine/atlas/internal/semconv"710 )811 9-// A zone's prose defers into the text payload the way a pin's does: the10-// detail carries only the marker, and the words wait to be asked for.11-func TestBuildPayloadDefersZoneProse(t *testing.T) {12- world := catalogWorld{13- Collections: []worldCollection{{14- Key: regionsCollectionKey,15- Title: "Regions",16- Kind: kindArea,17- Features: []feature{18- {ID: 71, Title: "PF", Description: "Public facilities district."},19- {ID: 72, Title: "RS"},20- },21- }},22- }23- detail, _, text := buildPayload(world)12+// The wire emission mirrors the model: point collections first with their13+// features packed under their collection's index, shape collections after14+// with their features inline, prose deferred to the text payload either way.15+func TestBuildPayloadEmitsCollections(t *testing.T) {16+ collections, err := normalizeWorld(declaredFixture())17+ if err != nil {18+ t.Fatal(err)19+ }20+ detail, packed, text := buildPayload(catalogWorld{Collections: collections})21+ if len(detail.Collections) != 3 {22+ t.Fatalf("wire lists %d collections, want 3", len(detail.Collections))23+ }24+ districts, creeks, implicit := detail.Collections[0], detail.Collections[1], detail.Collections[2]25+ if districts.Kind != kindArea || len(districts.Features) != 1 || districts.Features[0].Title != "R-5" {26+ t.Fatalf("districts emit as %+v", districts)27+ }28+ if districts.Attrs[semconv.KeyLabelPolicy] != "quiet" {29+ t.Fatalf("districts lost their declared attrs on the wire: %v", districts.Attrs)30+ }31+ if creeks.Kind != kindPath || creeks.Attrs[semconv.KeyStrokeWidthPx] != "10" {32+ t.Fatalf("creeks emit as %+v", creeks)33+ }34+ if implicit.Kind != kindArea || implicit.Features[0].Title != "Old Town" {35+ t.Fatalf("implicit collection emits as %+v", implicit)36+ }37+ seen := map[int64]bool{districts.ID: true, creeks.ID: true, implicit.ID: true}38+ if len(seen) != 3 || seen[0] {39+ t.Fatalf("collection ids are not distinct and nonzero: %d %d %d",40+ districts.ID, creeks.ID, implicit.ID)41+ }42+ locations, err := bundle.UnpackLocations(packed)43+ if err != nil {44+ t.Fatal(err)45+ }46+ if len(locations) != 0 || len(text) != 0 {47+ t.Fatalf("a shapes-only world packed %d locations and %d texts", len(locations), len(text))48+ }49+}2450 25- entry, told := text["71"]26- if !told || entry.Description != "Public facilities district." {27- t.Fatalf("zone text = %+v, %v", entry, told)51+// A world with both kinds packs its points under the collection indexes the52+// wire lists, and defers every kind's prose behind the hasText marker.53+func TestBuildPayloadPacksOwnersAndDefersProse(t *testing.T) {54+ world := catalogWorld{Collections: []worldCollection{55+ {ID: 41, Kind: kindArea, Key: "districts", Title: "Districts", Visible: true,56+ Features: []feature{{ID: 9001, Title: "Old Town", Description: "The old quarter."}}},57+ {ID: 10, Kind: kindPoint, Title: "Shops", Visible: true,58+ Features: []feature{{ID: 100, Title: "Bakery", Description: "Fresh bread."}}},59+ {ID: 11, Kind: kindPoint, Title: "Signs", Visible: true,60+ Features: []feature{{ID: 101, Title: "Welcome"}}},61+ }}62+ detail, packed, text := buildPayload(world)63+ // Points lead the wire whatever order the model held them in.64+ if detail.Collections[0].ID != 10 || detail.Collections[1].ID != 11 || detail.Collections[2].ID != 41 {65+ t.Fatalf("wire order = %d %d %d, want points then shapes",66+ detail.Collections[0].ID, detail.Collections[1].ID, detail.Collections[2].ID)2867 }29- if _, told := text["72"]; told {30- t.Fatal("a quiet zone wrote text")68+ locations, err := bundle.UnpackLocations(packed)69+ if err != nil {70+ t.Fatal(err)71+ }72+ if len(locations) != 2 || locations[0].Owner != 0 || locations[1].Owner != 1 {73+ t.Fatalf("locations own %+v, want collection indexes 0 and 1", locations)74+ }75+ if entry, told := text["100"]; !told || entry.Description != "Fresh bread." {76+ t.Fatalf("pin text = %+v, %v", entry, told)77+ }78+ if entry, told := text["9001"]; !told || entry.Description != "The old quarter." {79+ t.Fatalf("zone text = %+v, %v", entry, told)3180 }32- if !detail.Zones[0].HasText || detail.Zones[1].HasText {33- t.Fatalf("hasText markers are %v/%v", detail.Zones[0].HasText, detail.Zones[1].HasText)81+ if !detail.Collections[2].Features[0].HasText {82+ t.Fatal("the zone's deferred prose left no hasText marker")3483 }3584 raw, err := json.Marshal(detail)3685 if err != nil {3786 t.Fatal(err)3887 }39- if strings.Contains(string(raw), "Public facilities") {40- t.Fatal("zone prose rode the detail payload")88+ if strings.Contains(string(raw), "quarter") || strings.Contains(string(raw), "bread") {89+ t.Fatal("prose rode the detail payload")4190 }4291 }