14740 lines
3.3 MiB
14740 lines
3.3 MiB
import{Q as pP,a3 as e_,_ as eU,r as Ps,a2 as zq,x as Uq,a4 as kq,d as ea,o as _x,c as gx,N as Vq,e as Xn,w as ic,l as is,A as jf,f as gr,m as tU,I as Hq,a5 as Gq,a6 as em,a7 as jq,n as dg,K as mL,M as _L,J as gL,O as yL,a8 as Wq}from"./index.064676a5.js";import{R as qq}from"./index.030fe210.js";import{d as Yq}from"./download.fe7036ba.js";function $q(e){return pP({url:"/hjjc/sxjg",method:"get",params:e})}function Xq(e){return pP({url:"/hjjc/gjmchqjwd",method:"get",params:e})}function Tb(e){return pP({url:"/hjjc/gjdevhsjqcx",method:"get",params:e})}function c(e){return e!=null}function E(e){this.name="DeveloperError",this.message=e;let t;try{throw new Error}catch(n){t=n.stack}this.stack=t}c(Object.create)&&(E.prototype=Object.create(Error.prototype),E.prototype.constructor=E);E.prototype.toString=function(){let e=`${this.name}: ${this.message}`;return c(this.stack)&&(e+=`
|
|
${this.stack.toString()}`),e};E.throwInstantiationError=function(){throw new E("This function defines an interface and should not be called directly.")};const Wo={};Wo.typeOf={};function Qq(e){return`${e} is required, actual value was undefined`}function k_(e,t,n){return`Expected ${n} to be typeof ${t}, actual typeof was ${e}`}Wo.defined=function(e,t){if(!c(t))throw new E(Qq(e))};Wo.typeOf.func=function(e,t){if(typeof t!="function")throw new E(k_(typeof t,"function",e))};Wo.typeOf.string=function(e,t){if(typeof t!="string")throw new E(k_(typeof t,"string",e))};Wo.typeOf.number=function(e,t){if(typeof t!="number")throw new E(k_(typeof t,"number",e))};Wo.typeOf.number.lessThan=function(e,t,n){if(Wo.typeOf.number(e,t),t>=n)throw new E(`Expected ${e} to be less than ${n}, actual value was ${t}`)};Wo.typeOf.number.lessThanOrEquals=function(e,t,n){if(Wo.typeOf.number(e,t),t>n)throw new E(`Expected ${e} to be less than or equal to ${n}, actual value was ${t}`)};Wo.typeOf.number.greaterThan=function(e,t,n){if(Wo.typeOf.number(e,t),t<=n)throw new E(`Expected ${e} to be greater than ${n}, actual value was ${t}`)};Wo.typeOf.number.greaterThanOrEquals=function(e,t,n){if(Wo.typeOf.number(e,t),t<n)throw new E(`Expected ${e} to be greater than or equal to ${n}, actual value was ${t}`)};Wo.typeOf.object=function(e,t){if(typeof t!="object")throw new E(k_(typeof t,"object",e))};Wo.typeOf.bool=function(e,t){if(typeof t!="boolean")throw new E(k_(typeof t,"boolean",e))};Wo.typeOf.bigint=function(e,t){if(typeof t!="bigint")throw new E(k_(typeof t,"bigint",e))};Wo.typeOf.number.equals=function(e,t,n,i){if(Wo.typeOf.number(e,n),Wo.typeOf.number(t,i),n!==i)throw new E(`${e} must be equal to ${t}, the actual values are ${n} and ${i}`)};const A=Wo;function y(e,t){return e!=null?e:t}y.EMPTY_OBJECT=Object.freeze({});var yd=function(e){e==null&&(e=new Date().getTime()),this.N=624,this.M=397,this.MATRIX_A=2567483615,this.UPPER_MASK=2147483648,this.LOWER_MASK=2147483647,this.mt=new Array(this.N),this.mti=this.N+1,e.constructor==Array?this.init_by_array(e,e.length):this.init_seed(e)};yd.prototype.init_seed=function(e){for(this.mt[0]=e>>>0,this.mti=1;this.mti<this.N;this.mti++){var e=this.mt[this.mti-1]^this.mt[this.mti-1]>>>30;this.mt[this.mti]=(((e&4294901760)>>>16)*1812433253<<16)+(e&65535)*1812433253+this.mti,this.mt[this.mti]>>>=0}};yd.prototype.init_by_array=function(e,t){var n,i,o;for(this.init_seed(19650218),n=1,i=0,o=this.N>t?this.N:t;o;o--){var r=this.mt[n-1]^this.mt[n-1]>>>30;this.mt[n]=(this.mt[n]^(((r&4294901760)>>>16)*1664525<<16)+(r&65535)*1664525)+e[i]+i,this.mt[n]>>>=0,n++,i++,n>=this.N&&(this.mt[0]=this.mt[this.N-1],n=1),i>=t&&(i=0)}for(o=this.N-1;o;o--){var r=this.mt[n-1]^this.mt[n-1]>>>30;this.mt[n]=(this.mt[n]^(((r&4294901760)>>>16)*1566083941<<16)+(r&65535)*1566083941)-n,this.mt[n]>>>=0,n++,n>=this.N&&(this.mt[0]=this.mt[this.N-1],n=1)}this.mt[0]=2147483648};yd.prototype.random_int=function(){var e,t=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var n;for(this.mti==this.N+1&&this.init_seed(5489),n=0;n<this.N-this.M;n++)e=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+this.M]^e>>>1^t[e&1];for(;n<this.N-1;n++)e=this.mt[n]&this.UPPER_MASK|this.mt[n+1]&this.LOWER_MASK,this.mt[n]=this.mt[n+(this.M-this.N)]^e>>>1^t[e&1];e=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK,this.mt[this.N-1]=this.mt[this.M-1]^e>>>1^t[e&1],this.mti=0}return e=this.mt[this.mti++],e^=e>>>11,e^=e<<7&2636928640,e^=e<<15&4022730752,e^=e>>>18,e>>>0};yd.prototype.random_int31=function(){return this.random_int()>>>1};yd.prototype.random_incl=function(){return this.random_int()*(1/4294967295)};yd.prototype.random=function(){return this.random_int()*(1/4294967296)};yd.prototype.random_excl=function(){return(this.random_int()+.5)*(1/4294967296)};yd.prototype.random_long=function(){var e=this.random_int()>>>5,t=this.random_int()>>>6;return(e*67108864+t)*(1/9007199254740992)};var fC=yd;const Be={};Be.EPSILON1=.1;Be.EPSILON2=.01;Be.EPSILON3=.001;Be.EPSILON4=1e-4;Be.EPSILON5=1e-5;Be.EPSILON6=1e-6;Be.EPSILON7=1e-7;Be.EPSILON8=1e-8;Be.EPSILON9=1e-9;Be.EPSILON10=1e-10;Be.EPSILON11=1e-11;Be.EPSILON12=1e-12;Be.EPSILON13=1e-13;Be.EPSILON14=1e-14;Be.EPSILON15=1e-15;Be.EPSILON16=1e-16;Be.EPSILON17=1e-17;Be.EPSILON18=1e-18;Be.EPSILON19=1e-19;Be.EPSILON20=1e-20;Be.EPSILON21=1e-21;Be.GRAVITATIONALPARAMETER=3986004418e5;Be.SOLAR_RADIUS=6955e5;Be.LUNAR_RADIUS=1737400;Be.SIXTY_FOUR_KILOBYTES=64*1024;Be.FOUR_GIGABYTES=4*1024*1024*1024;Be.sign=y(Math.sign,function(t){return t=+t,t===0||t!==t?t:t>0?1:-1});Be.signNotZero=function(e){return e<0?-1:1};Be.toSNorm=function(e,t){return t=y(t,255),Math.round((Be.clamp(e,-1,1)*.5+.5)*t)};Be.fromSNorm=function(e,t){return t=y(t,255),Be.clamp(e,0,t)/t*2-1};Be.normalize=function(e,t,n){return n=Math.max(n-t,0),n===0?0:Be.clamp((e-t)/n,0,1)};Be.sinh=y(Math.sinh,function(t){return(Math.exp(t)-Math.exp(-t))/2});Be.cosh=y(Math.cosh,function(t){return(Math.exp(t)+Math.exp(-t))/2});Be.lerp=function(e,t,n){return(1-n)*e+n*t};Be.PI=Math.PI;Be.ONE_OVER_PI=1/Math.PI;Be.PI_OVER_TWO=Math.PI/2;Be.PI_OVER_THREE=Math.PI/3;Be.PI_OVER_FOUR=Math.PI/4;Be.PI_OVER_SIX=Math.PI/6;Be.THREE_PI_OVER_TWO=3*Math.PI/2;Be.TWO_PI=2*Math.PI;Be.ONE_OVER_TWO_PI=1/(2*Math.PI);Be.RADIANS_PER_DEGREE=Math.PI/180;Be.DEGREES_PER_RADIAN=180/Math.PI;Be.RADIANS_PER_ARCSECOND=Be.RADIANS_PER_DEGREE/3600;Be.toRadians=function(e){if(!c(e))throw new E("degrees is required.");return e*Be.RADIANS_PER_DEGREE};Be.toDegrees=function(e){if(!c(e))throw new E("radians is required.");return e*Be.DEGREES_PER_RADIAN};Be.convertLongitudeRange=function(e){if(!c(e))throw new E("angle is required.");const t=Be.TWO_PI,n=e-Math.floor(e/t)*t;return n<-Math.PI?n+t:n>=Math.PI?n-t:n};Be.clampToLatitudeRange=function(e){if(!c(e))throw new E("angle is required.");return Be.clamp(e,-1*Be.PI_OVER_TWO,Be.PI_OVER_TWO)};Be.negativePiToPi=function(e){if(!c(e))throw new E("angle is required.");return e>=-Be.PI&&e<=Be.PI?e:Be.zeroToTwoPi(e+Be.PI)-Be.PI};Be.zeroToTwoPi=function(e){if(!c(e))throw new E("angle is required.");if(e>=0&&e<=Be.TWO_PI)return e;const t=Be.mod(e,Be.TWO_PI);return Math.abs(t)<Be.EPSILON14&&Math.abs(e)>Be.EPSILON14?Be.TWO_PI:t};Be.mod=function(e,t){if(!c(e))throw new E("m is required.");if(!c(t))throw new E("n is required.");if(t===0)throw new E("divisor cannot be 0.");return Be.sign(e)===Be.sign(t)&&Math.abs(e)<Math.abs(t)?e:(e%t+t)%t};Be.equalsEpsilon=function(e,t,n,i){if(!c(e))throw new E("left is required.");if(!c(t))throw new E("right is required.");n=y(n,0),i=y(i,n);const o=Math.abs(e-t);return o<=i||o<=n*Math.max(Math.abs(e),Math.abs(t))};Be.lessThan=function(e,t,n){if(!c(e))throw new E("first is required.");if(!c(t))throw new E("second is required.");if(!c(n))throw new E("absoluteEpsilon is required.");return e-t<-n};Be.lessThanOrEquals=function(e,t,n){if(!c(e))throw new E("first is required.");if(!c(t))throw new E("second is required.");if(!c(n))throw new E("absoluteEpsilon is required.");return e-t<n};Be.greaterThan=function(e,t,n){if(!c(e))throw new E("first is required.");if(!c(t))throw new E("second is required.");if(!c(n))throw new E("absoluteEpsilon is required.");return e-t>n};Be.greaterThanOrEquals=function(e,t,n){if(!c(e))throw new E("first is required.");if(!c(t))throw new E("second is required.");if(!c(n))throw new E("absoluteEpsilon is required.");return e-t>-n};const Ab=[1];Be.factorial=function(e){if(typeof e!="number"||e<0)throw new E("A number greater than or equal to 0 is required.");const t=Ab.length;if(e>=t){let n=Ab[t-1];for(let i=t;i<=e;i++){const o=n*i;Ab.push(o),n=o}}return Ab[e]};Be.incrementWrap=function(e,t,n){if(n=y(n,0),!c(e))throw new E("n is required.");if(t<=n)throw new E("maximumValue must be greater than minimumValue.");return++e,e>t&&(e=n),e};Be.isPowerOfTwo=function(e){if(typeof e!="number"||e<0||e>4294967295)throw new E("A number between 0 and (2^32)-1 is required.");return e!==0&&(e&e-1)===0};Be.nextPowerOfTwo=function(e){if(typeof e!="number"||e<0||e>2147483648)throw new E("A number between 0 and 2^31 is required.");return--e,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e,e};Be.previousPowerOfTwo=function(e){if(typeof e!="number"||e<0||e>4294967295)throw new E("A number between 0 and (2^32)-1 is required.");return e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e|=e>>32,e=(e>>>0)-(e>>>1),e};Be.clamp=function(e,t,n){return A.typeOf.number("value",e),A.typeOf.number("min",t),A.typeOf.number("max",n),e<t?t:e>n?n:e};let nU=new fC;Be.setRandomNumberSeed=function(e){if(!c(e))throw new E("seed is required.");nU=new fC(e)};Be.nextRandomNumber=function(){return nU.random()};Be.randomBetween=function(e,t){return Be.nextRandomNumber()*(t-e)+e};Be.acosClamped=function(e){if(!c(e))throw new E("value is required.");return Math.acos(Be.clamp(e,-1,1))};Be.asinClamped=function(e){if(!c(e))throw new E("value is required.");return Math.asin(Be.clamp(e,-1,1))};Be.chordLength=function(e,t){if(!c(e))throw new E("angle is required.");if(!c(t))throw new E("radius is required.");return 2*t*Math.sin(e*.5)};Be.logBase=function(e,t){if(!c(e))throw new E("number is required.");if(!c(t))throw new E("base is required.");return Math.log(e)/Math.log(t)};Be.cbrt=y(Math.cbrt,function(t){const n=Math.pow(Math.abs(t),.3333333333333333);return t<0?-n:n});Be.log2=y(Math.log2,function(t){return Math.log(t)*Math.LOG2E});Be.fog=function(e,t){const n=e*t;return 1-Math.exp(-(n*n))};Be.fastApproximateAtan=function(e){return A.typeOf.number("x",e),e*(-.1784*Math.abs(e)-.0663*e*e+1.0301)};Be.fastApproximateAtan2=function(e,t){A.typeOf.number("x",e),A.typeOf.number("y",t);let n,i=Math.abs(e);n=Math.abs(t);const o=Math.max(i,n);n=Math.min(i,n);const r=n/o;if(isNaN(r))throw new E("either x or y must be nonzero");return i=Be.fastApproximateAtan(r),i=Math.abs(t)>Math.abs(e)?Be.PI_OVER_TWO-i:i,i=e<0?Be.PI-i:i,i=t<0?-i:i,i};const R=Be;function d(e,t,n){this.x=y(e,0),this.y=y(t,0),this.z=y(n,0)}d.fromSpherical=function(e,t){A.typeOf.object("spherical",e),c(t)||(t=new d);const n=e.clock,i=e.cone,o=y(e.magnitude,1),r=o*Math.sin(i);return t.x=r*Math.cos(n),t.y=r*Math.sin(n),t.z=o*Math.cos(i),t};d.fromElements=function(e,t,n,i){return c(i)?(i.x=e,i.y=t,i.z=n,i):new d(e,t,n)};d.clone=function(e,t){if(!!c(e))return c(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t):new d(e.x,e.y,e.z)};d.fromCartesian4=d.clone;d.packedLength=3;d.pack=function(e,t,n){return A.typeOf.object("value",e),A.defined("array",t),n=y(n,0),t[n++]=e.x,t[n++]=e.y,t[n]=e.z,t};d.unpack=function(e,t,n){return A.defined("array",e),t=y(t,0),c(n)||(n=new d),n.x=e[t++],n.y=e[t++],n.z=e[t],n};d.packArray=function(e,t){A.defined("array",e);const n=e.length,i=n*3;if(!c(t))t=new Array(i);else{if(!Array.isArray(t)&&t.length!==i)throw new E("If result is a typed array, it must have exactly array.length * 3 elements");t.length!==i&&(t.length=i)}for(let o=0;o<n;++o)d.pack(e[o],t,o*3);return t};d.unpackArray=function(e,t){if(A.defined("array",e),A.typeOf.number.greaterThanOrEquals("array.length",e.length,3),e.length%3!==0)throw new E("array length must be a multiple of 3.");const n=e.length;c(t)?t.length=n/3:t=new Array(n/3);for(let i=0;i<n;i+=3){const o=i/3;t[o]=d.unpack(e,i,t[o])}return t};d.fromArray=d.unpack;d.maximumComponent=function(e){return A.typeOf.object("cartesian",e),Math.max(e.x,e.y,e.z)};d.minimumComponent=function(e){return A.typeOf.object("cartesian",e),Math.min(e.x,e.y,e.z)};d.minimumByComponent=function(e,t,n){return A.typeOf.object("first",e),A.typeOf.object("second",t),A.typeOf.object("result",n),n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n.z=Math.min(e.z,t.z),n};d.maximumByComponent=function(e,t,n){return A.typeOf.object("first",e),A.typeOf.object("second",t),A.typeOf.object("result",n),n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n.z=Math.max(e.z,t.z),n};d.clamp=function(e,t,n,i){A.typeOf.object("value",e),A.typeOf.object("min",t),A.typeOf.object("max",n),A.typeOf.object("result",i);const o=R.clamp(e.x,t.x,n.x),r=R.clamp(e.y,t.y,n.y),s=R.clamp(e.z,t.z,n.z);return i.x=o,i.y=r,i.z=s,i};d.magnitudeSquared=function(e){return A.typeOf.object("cartesian",e),e.x*e.x+e.y*e.y+e.z*e.z};d.magnitude=function(e){return Math.sqrt(d.magnitudeSquared(e))};const yx=new d;d.distance=function(e,t){return A.typeOf.object("left",e),A.typeOf.object("right",t),d.subtract(e,t,yx),d.magnitude(yx)};d.distanceSquared=function(e,t){return A.typeOf.object("left",e),A.typeOf.object("right",t),d.subtract(e,t,yx),d.magnitudeSquared(yx)};d.normalize=function(e,t){A.typeOf.object("cartesian",e),A.typeOf.object("result",t);const n=d.magnitude(e);if(t.x=e.x/n,t.y=e.y/n,t.z=e.z/n,isNaN(t.x)||isNaN(t.y)||isNaN(t.z))throw new E("normalized result is not a number");return t};d.dot=function(e,t){return A.typeOf.object("left",e),A.typeOf.object("right",t),e.x*t.x+e.y*t.y+e.z*t.z};d.multiplyComponents=function(e,t,n){return A.typeOf.object("left",e),A.typeOf.object("right",t),A.typeOf.object("result",n),n.x=e.x*t.x,n.y=e.y*t.y,n.z=e.z*t.z,n};d.divideComponents=function(e,t,n){return A.typeOf.object("left",e),A.typeOf.object("right",t),A.typeOf.object("result",n),n.x=e.x/t.x,n.y=e.y/t.y,n.z=e.z/t.z,n};d.add=function(e,t,n){return A.typeOf.object("left",e),A.typeOf.object("right",t),A.typeOf.object("result",n),n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n};d.subtract=function(e,t,n){return A.typeOf.object("left",e),A.typeOf.object("right",t),A.typeOf.object("result",n),n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n};d.multiplyByScalar=function(e,t,n){return A.typeOf.object("cartesian",e),A.typeOf.number("scalar",t),A.typeOf.object("result",n),n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n};d.divideByScalar=function(e,t,n){return A.typeOf.object("cartesian",e),A.typeOf.number("scalar",t),A.typeOf.object("result",n),n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n};d.negate=function(e,t){return A.typeOf.object("cartesian",e),A.typeOf.object("result",t),t.x=-e.x,t.y=-e.y,t.z=-e.z,t};d.abs=function(e,t){return A.typeOf.object("cartesian",e),A.typeOf.object("result",t),t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t};const bL=new d;d.lerp=function(e,t,n,i){return A.typeOf.object("start",e),A.typeOf.object("end",t),A.typeOf.number("t",n),A.typeOf.object("result",i),d.multiplyByScalar(t,n,bL),i=d.multiplyByScalar(e,1-n,i),d.add(bL,i,i)};const xb=new d,OE=new d;d.angleBetween=function(e,t){A.typeOf.object("left",e),A.typeOf.object("right",t),d.normalize(e,xb),d.normalize(t,OE);const n=d.dot(xb,OE),i=d.magnitude(d.cross(xb,OE,xb));return Math.atan2(i,n)};const Kq=new d;d.mostOrthogonalAxis=function(e,t){A.typeOf.object("cartesian",e),A.typeOf.object("result",t);const n=d.normalize(e,Kq);return d.abs(n,n),n.x<=n.y?n.x<=n.z?t=d.clone(d.UNIT_X,t):t=d.clone(d.UNIT_Z,t):n.y<=n.z?t=d.clone(d.UNIT_Y,t):t=d.clone(d.UNIT_Z,t),t};d.projectVector=function(e,t,n){A.defined("a",e),A.defined("b",t),A.defined("result",n);const i=d.dot(e,t)/d.dot(t,t);return d.multiplyByScalar(t,i,n)};d.equals=function(e,t){return e===t||c(e)&&c(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z};d.equalsArray=function(e,t,n){return e.x===t[n]&&e.y===t[n+1]&&e.z===t[n+2]};d.equalsEpsilon=function(e,t,n,i){return e===t||c(e)&&c(t)&&R.equalsEpsilon(e.x,t.x,n,i)&&R.equalsEpsilon(e.y,t.y,n,i)&&R.equalsEpsilon(e.z,t.z,n,i)};d.cross=function(e,t,n){A.typeOf.object("left",e),A.typeOf.object("right",t),A.typeOf.object("result",n);const i=e.x,o=e.y,r=e.z,s=t.x,a=t.y,l=t.z,u=o*l-r*a,h=r*s-i*l,f=i*a-o*s;return n.x=u,n.y=h,n.z=f,n};d.midpoint=function(e,t,n){return A.typeOf.object("left",e),A.typeOf.object("right",t),A.typeOf.object("result",n),n.x=(e.x+t.x)*.5,n.y=(e.y+t.y)*.5,n.z=(e.z+t.z)*.5,n};d.fromDegrees=function(e,t,n,i,o){return A.typeOf.number("longitude",e),A.typeOf.number("latitude",t),e=R.toRadians(e),t=R.toRadians(t),d.fromRadians(e,t,n,i,o)};let $a=new d,tm=new d;const Zq=new d(6378137*6378137,6378137*6378137,6356752314245179e-9*6356752314245179e-9);d.fromRadians=function(e,t,n,i,o){A.typeOf.number("longitude",e),A.typeOf.number("latitude",t),n=y(n,0);const r=c(i)?i.radiiSquared:Zq,s=Math.cos(t);$a.x=s*Math.cos(e),$a.y=s*Math.sin(e),$a.z=Math.sin(t),$a=d.normalize($a,$a),d.multiplyComponents(r,$a,tm);const a=Math.sqrt(d.dot($a,tm));return tm=d.divideByScalar(tm,a,tm),$a=d.multiplyByScalar($a,n,$a),c(o)||(o=new d),d.add(tm,$a,o)};d.fromDegreesArray=function(e,t,n){if(A.defined("coordinates",e),e.length<2||e.length%2!==0)throw new E("the number of coordinates must be a multiple of 2 and at least 2");const i=e.length;c(n)?n.length=i/2:n=new Array(i/2);for(let o=0;o<i;o+=2){const r=e[o],s=e[o+1],a=o/2;n[a]=d.fromDegrees(r,s,0,t,n[a])}return n};d.fromRadiansArray=function(e,t,n){if(A.defined("coordinates",e),e.length<2||e.length%2!==0)throw new E("the number of coordinates must be a multiple of 2 and at least 2");const i=e.length;c(n)?n.length=i/2:n=new Array(i/2);for(let o=0;o<i;o+=2){const r=e[o],s=e[o+1],a=o/2;n[a]=d.fromRadians(r,s,0,t,n[a])}return n};d.fromDegreesArrayHeights=function(e,t,n){if(A.defined("coordinates",e),e.length<3||e.length%3!==0)throw new E("the number of coordinates must be a multiple of 3 and at least 3");const i=e.length;c(n)?n.length=i/3:n=new Array(i/3);for(let o=0;o<i;o+=3){const r=e[o],s=e[o+1],a=e[o+2],l=o/3;n[l]=d.fromDegrees(r,s,a,t,n[l])}return n};d.fromRadiansArrayHeights=function(e,t,n){if(A.defined("coordinates",e),e.length<3||e.length%3!==0)throw new E("the number of coordinates must be a multiple of 3 and at least 3");const i=e.length;c(n)?n.length=i/3:n=new Array(i/3);for(let o=0;o<i;o+=3){const r=e[o],s=e[o+1],a=e[o+2],l=o/3;n[l]=d.fromRadians(r,s,a,t,n[l])}return n};d.ZERO=Object.freeze(new d(0,0,0));d.ONE=Object.freeze(new d(1,1,1));d.UNIT_X=Object.freeze(new d(1,0,0));d.UNIT_Y=Object.freeze(new d(0,1,0));d.UNIT_Z=Object.freeze(new d(0,0,1));d.prototype.clone=function(e){return d.clone(this,e)};d.prototype.equals=function(e){return d.equals(this,e)};d.prototype.equalsEpsilon=function(e,t,n){return d.equalsEpsilon(this,e,t,n)};d.prototype.toString=function(){return`(${this.x}, ${this.y}, ${this.z})`};function te(e,t,n,i){this.x=y(e,0),this.y=y(t,0),this.z=y(n,0),this.w=y(i,0)}te.fromElements=function(e,t,n,i,o){return c(o)?(o.x=e,o.y=t,o.z=n,o.w=i,o):new te(e,t,n,i)};te.fromColor=function(e,t){return A.typeOf.object("color",e),c(t)?(t.x=e.red,t.y=e.green,t.z=e.blue,t.w=e.alpha,t):new te(e.red,e.green,e.blue,e.alpha)};te.clone=function(e,t){if(!!c(e))return c(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t):new te(e.x,e.y,e.z,e.w)};te.packedLength=4;te.pack=function(e,t,n){return A.typeOf.object("value",e),A.defined("array",t),n=y(n,0),t[n++]=e.x,t[n++]=e.y,t[n++]=e.z,t[n]=e.w,t};te.unpack=function(e,t,n){return A.defined("array",e),t=y(t,0),c(n)||(n=new te),n.x=e[t++],n.y=e[t++],n.z=e[t++],n.w=e[t],n};te.packArray=function(e,t){A.defined("array",e);const n=e.length,i=n*4;if(!c(t))t=new Array(i);else{if(!Array.isArray(t)&&t.length!==i)throw new E("If result is a typed array, it must have exactly array.length * 4 elements");t.length!==i&&(t.length=i)}for(let o=0;o<n;++o)te.pack(e[o],t,o*4);return t};te.unpackArray=function(e,t){if(A.defined("array",e),A.typeOf.number.greaterThanOrEquals("array.length",e.length,4),e.length%4!==0)throw new E("array length must be a multiple of 4.");const n=e.length;c(t)?t.length=n/4:t=new Array(n/4);for(let i=0;i<n;i+=4){const o=i/4;t[o]=te.unpack(e,i,t[o])}return t};te.fromArray=te.unpack;te.maximumComponent=function(e){return A.typeOf.object("cartesian",e),Math.max(e.x,e.y,e.z,e.w)};te.minimumComponent=function(e){return A.typeOf.object("cartesian",e),Math.min(e.x,e.y,e.z,e.w)};te.minimumByComponent=function(e,t,n){return A.typeOf.object("first",e),A.typeOf.object("second",t),A.typeOf.object("result",n),n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n.z=Math.min(e.z,t.z),n.w=Math.min(e.w,t.w),n};te.maximumByComponent=function(e,t,n){return A.typeOf.object("first",e),A.typeOf.object("second",t),A.typeOf.object("result",n),n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n.z=Math.max(e.z,t.z),n.w=Math.max(e.w,t.w),n};te.clamp=function(e,t,n,i){A.typeOf.object("value",e),A.typeOf.object("min",t),A.typeOf.object("max",n),A.typeOf.object("result",i);const o=R.clamp(e.x,t.x,n.x),r=R.clamp(e.y,t.y,n.y),s=R.clamp(e.z,t.z,n.z),a=R.clamp(e.w,t.w,n.w);return i.x=o,i.y=r,i.z=s,i.w=a,i};te.magnitudeSquared=function(e){return A.typeOf.object("cartesian",e),e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w};te.magnitude=function(e){return Math.sqrt(te.magnitudeSquared(e))};const bx=new te;te.distance=function(e,t){return A.typeOf.object("left",e),A.typeOf.object("right",t),te.subtract(e,t,bx),te.magnitude(bx)};te.distanceSquared=function(e,t){return A.typeOf.object("left",e),A.typeOf.object("right",t),te.subtract(e,t,bx),te.magnitudeSquared(bx)};te.normalize=function(e,t){A.typeOf.object("cartesian",e),A.typeOf.object("result",t);const n=te.magnitude(e);if(t.x=e.x/n,t.y=e.y/n,t.z=e.z/n,t.w=e.w/n,isNaN(t.x)||isNaN(t.y)||isNaN(t.z)||isNaN(t.w))throw new E("normalized result is not a number");return t};te.dot=function(e,t){return A.typeOf.object("left",e),A.typeOf.object("right",t),e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w};te.multiplyComponents=function(e,t,n){return A.typeOf.object("left",e),A.typeOf.object("right",t),A.typeOf.object("result",n),n.x=e.x*t.x,n.y=e.y*t.y,n.z=e.z*t.z,n.w=e.w*t.w,n};te.divideComponents=function(e,t,n){return A.typeOf.object("left",e),A.typeOf.object("right",t),A.typeOf.object("result",n),n.x=e.x/t.x,n.y=e.y/t.y,n.z=e.z/t.z,n.w=e.w/t.w,n};te.add=function(e,t,n){return A.typeOf.object("left",e),A.typeOf.object("right",t),A.typeOf.object("result",n),n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n.w=e.w+t.w,n};te.subtract=function(e,t,n){return A.typeOf.object("left",e),A.typeOf.object("right",t),A.typeOf.object("result",n),n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n.w=e.w-t.w,n};te.multiplyByScalar=function(e,t,n){return A.typeOf.object("cartesian",e),A.typeOf.number("scalar",t),A.typeOf.object("result",n),n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n.w=e.w*t,n};te.divideByScalar=function(e,t,n){return A.typeOf.object("cartesian",e),A.typeOf.number("scalar",t),A.typeOf.object("result",n),n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n.w=e.w/t,n};te.negate=function(e,t){return A.typeOf.object("cartesian",e),A.typeOf.object("result",t),t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t};te.abs=function(e,t){return A.typeOf.object("cartesian",e),A.typeOf.object("result",t),t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t.w=Math.abs(e.w),t};const TL=new te;te.lerp=function(e,t,n,i){return A.typeOf.object("start",e),A.typeOf.object("end",t),A.typeOf.number("t",n),A.typeOf.object("result",i),te.multiplyByScalar(t,n,TL),i=te.multiplyByScalar(e,1-n,i),te.add(TL,i,i)};const Jq=new te;te.mostOrthogonalAxis=function(e,t){A.typeOf.object("cartesian",e),A.typeOf.object("result",t);const n=te.normalize(e,Jq);return te.abs(n,n),n.x<=n.y?n.x<=n.z?n.x<=n.w?t=te.clone(te.UNIT_X,t):t=te.clone(te.UNIT_W,t):n.z<=n.w?t=te.clone(te.UNIT_Z,t):t=te.clone(te.UNIT_W,t):n.y<=n.z?n.y<=n.w?t=te.clone(te.UNIT_Y,t):t=te.clone(te.UNIT_W,t):n.z<=n.w?t=te.clone(te.UNIT_Z,t):t=te.clone(te.UNIT_W,t),t};te.equals=function(e,t){return e===t||c(e)&&c(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z&&e.w===t.w};te.equalsArray=function(e,t,n){return e.x===t[n]&&e.y===t[n+1]&&e.z===t[n+2]&&e.w===t[n+3]};te.equalsEpsilon=function(e,t,n,i){return e===t||c(e)&&c(t)&&R.equalsEpsilon(e.x,t.x,n,i)&&R.equalsEpsilon(e.y,t.y,n,i)&&R.equalsEpsilon(e.z,t.z,n,i)&&R.equalsEpsilon(e.w,t.w,n,i)};te.ZERO=Object.freeze(new te(0,0,0,0));te.ONE=Object.freeze(new te(1,1,1,1));te.UNIT_X=Object.freeze(new te(1,0,0,0));te.UNIT_Y=Object.freeze(new te(0,1,0,0));te.UNIT_Z=Object.freeze(new te(0,0,1,0));te.UNIT_W=Object.freeze(new te(0,0,0,1));te.prototype.clone=function(e){return te.clone(this,e)};te.prototype.equals=function(e){return te.equals(this,e)};te.prototype.equalsEpsilon=function(e,t,n){return te.equalsEpsilon(this,e,t,n)};te.prototype.toString=function(){return`(${this.x}, ${this.y}, ${this.z}, ${this.w})`};const mP=new Float32Array(1),rs=new Uint8Array(mP.buffer),e7=new Uint32Array([287454020]),t7=new Uint8Array(e7.buffer),iU=t7[0]===68;te.packFloat=function(e,t){return A.typeOf.number("value",e),c(t)||(t=new te),mP[0]=e,iU?(t.x=rs[0],t.y=rs[1],t.z=rs[2],t.w=rs[3]):(t.x=rs[3],t.y=rs[2],t.z=rs[1],t.w=rs[0]),t};te.unpackFloat=function(e){return A.typeOf.object("packedFloat",e),iU?(rs[0]=e.x,rs[1]=e.y,rs[2]=e.z,rs[3]=e.w):(rs[0]=e.w,rs[1]=e.z,rs[2]=e.y,rs[3]=e.x),mP[0]};function $(e,t,n,i,o,r,s,a,l){this[0]=y(e,0),this[1]=y(i,0),this[2]=y(s,0),this[3]=y(t,0),this[4]=y(o,0),this[5]=y(a,0),this[6]=y(n,0),this[7]=y(r,0),this[8]=y(l,0)}$.packedLength=9;$.pack=function(e,t,n){return A.typeOf.object("value",e),A.defined("array",t),n=y(n,0),t[n++]=e[0],t[n++]=e[1],t[n++]=e[2],t[n++]=e[3],t[n++]=e[4],t[n++]=e[5],t[n++]=e[6],t[n++]=e[7],t[n++]=e[8],t};$.unpack=function(e,t,n){return A.defined("array",e),t=y(t,0),c(n)||(n=new $),n[0]=e[t++],n[1]=e[t++],n[2]=e[t++],n[3]=e[t++],n[4]=e[t++],n[5]=e[t++],n[6]=e[t++],n[7]=e[t++],n[8]=e[t++],n};$.packArray=function(e,t){A.defined("array",e);const n=e.length,i=n*9;if(!c(t))t=new Array(i);else{if(!Array.isArray(t)&&t.length!==i)throw new E("If result is a typed array, it must have exactly array.length * 9 elements");t.length!==i&&(t.length=i)}for(let o=0;o<n;++o)$.pack(e[o],t,o*9);return t};$.unpackArray=function(e,t){if(A.defined("array",e),A.typeOf.number.greaterThanOrEquals("array.length",e.length,9),e.length%9!==0)throw new E("array length must be a multiple of 9.");const n=e.length;c(t)?t.length=n/9:t=new Array(n/9);for(let i=0;i<n;i+=9){const o=i/9;t[o]=$.unpack(e,i,t[o])}return t};$.clone=function(e,t){if(!!c(e))return c(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t):new $(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8])};$.fromArray=$.unpack;$.fromColumnMajorArray=function(e,t){return A.defined("values",e),$.clone(e,t)};$.fromRowMajorArray=function(e,t){return A.defined("values",e),c(t)?(t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],t):new $(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])};$.fromQuaternion=function(e,t){A.typeOf.object("quaternion",e);const n=e.x*e.x,i=e.x*e.y,o=e.x*e.z,r=e.x*e.w,s=e.y*e.y,a=e.y*e.z,l=e.y*e.w,u=e.z*e.z,h=e.z*e.w,f=e.w*e.w,_=n-s-u+f,g=2*(i-h),m=2*(o+l),b=2*(i+h),T=-n+s-u+f,x=2*(a-r),C=2*(o-l),w=2*(a+r),v=-n-s+u+f;return c(t)?(t[0]=_,t[1]=b,t[2]=C,t[3]=g,t[4]=T,t[5]=w,t[6]=m,t[7]=x,t[8]=v,t):new $(_,g,m,b,T,x,C,w,v)};$.fromHeadingPitchRoll=function(e,t){A.typeOf.object("headingPitchRoll",e);const n=Math.cos(-e.pitch),i=Math.cos(-e.heading),o=Math.cos(e.roll),r=Math.sin(-e.pitch),s=Math.sin(-e.heading),a=Math.sin(e.roll),l=n*i,u=-o*s+a*r*i,h=a*s+o*r*i,f=n*s,_=o*i+a*r*s,g=-a*i+o*r*s,m=-r,b=a*n,T=o*n;return c(t)?(t[0]=l,t[1]=f,t[2]=m,t[3]=u,t[4]=_,t[5]=b,t[6]=h,t[7]=g,t[8]=T,t):new $(l,u,h,f,_,g,m,b,T)};$.fromScale=function(e,t){return A.typeOf.object("scale",e),c(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=0,t[4]=e.y,t[5]=0,t[6]=0,t[7]=0,t[8]=e.z,t):new $(e.x,0,0,0,e.y,0,0,0,e.z)};$.fromUniformScale=function(e,t){return A.typeOf.number("scale",e),c(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=0,t[4]=e,t[5]=0,t[6]=0,t[7]=0,t[8]=e,t):new $(e,0,0,0,e,0,0,0,e)};$.fromCrossProduct=function(e,t){return A.typeOf.object("vector",e),c(t)?(t[0]=0,t[1]=e.z,t[2]=-e.y,t[3]=-e.z,t[4]=0,t[5]=e.x,t[6]=e.y,t[7]=-e.x,t[8]=0,t):new $(0,-e.z,e.y,e.z,0,-e.x,-e.y,e.x,0)};$.fromRotationX=function(e,t){A.typeOf.number("angle",e);const n=Math.cos(e),i=Math.sin(e);return c(t)?(t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=n,t[5]=i,t[6]=0,t[7]=-i,t[8]=n,t):new $(1,0,0,0,n,-i,0,i,n)};$.fromRotationY=function(e,t){A.typeOf.number("angle",e);const n=Math.cos(e),i=Math.sin(e);return c(t)?(t[0]=n,t[1]=0,t[2]=-i,t[3]=0,t[4]=1,t[5]=0,t[6]=i,t[7]=0,t[8]=n,t):new $(n,0,i,0,1,0,-i,0,n)};$.fromRotationZ=function(e,t){A.typeOf.number("angle",e);const n=Math.cos(e),i=Math.sin(e);return c(t)?(t[0]=n,t[1]=i,t[2]=0,t[3]=-i,t[4]=n,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new $(n,-i,0,i,n,0,0,0,1)};$.toArray=function(e,t){return A.typeOf.object("matrix",e),c(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t):[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8]]};$.getElementIndex=function(e,t){return A.typeOf.number.greaterThanOrEquals("row",t,0),A.typeOf.number.lessThanOrEquals("row",t,2),A.typeOf.number.greaterThanOrEquals("column",e,0),A.typeOf.number.lessThanOrEquals("column",e,2),e*3+t};$.getColumn=function(e,t,n){A.typeOf.object("matrix",e),A.typeOf.number.greaterThanOrEquals("index",t,0),A.typeOf.number.lessThanOrEquals("index",t,2),A.typeOf.object("result",n);const i=t*3,o=e[i],r=e[i+1],s=e[i+2];return n.x=o,n.y=r,n.z=s,n};$.setColumn=function(e,t,n,i){A.typeOf.object("matrix",e),A.typeOf.number.greaterThanOrEquals("index",t,0),A.typeOf.number.lessThanOrEquals("index",t,2),A.typeOf.object("cartesian",n),A.typeOf.object("result",i),i=$.clone(e,i);const o=t*3;return i[o]=n.x,i[o+1]=n.y,i[o+2]=n.z,i};$.getRow=function(e,t,n){A.typeOf.object("matrix",e),A.typeOf.number.greaterThanOrEquals("index",t,0),A.typeOf.number.lessThanOrEquals("index",t,2),A.typeOf.object("result",n);const i=e[t],o=e[t+3],r=e[t+6];return n.x=i,n.y=o,n.z=r,n};$.setRow=function(e,t,n,i){return A.typeOf.object("matrix",e),A.typeOf.number.greaterThanOrEquals("index",t,0),A.typeOf.number.lessThanOrEquals("index",t,2),A.typeOf.object("cartesian",n),A.typeOf.object("result",i),i=$.clone(e,i),i[t]=n.x,i[t+3]=n.y,i[t+6]=n.z,i};const n7=new d;$.setScale=function(e,t,n){A.typeOf.object("matrix",e),A.typeOf.object("scale",t),A.typeOf.object("result",n);const i=$.getScale(e,n7),o=t.x/i.x,r=t.y/i.y,s=t.z/i.z;return n[0]=e[0]*o,n[1]=e[1]*o,n[2]=e[2]*o,n[3]=e[3]*r,n[4]=e[4]*r,n[5]=e[5]*r,n[6]=e[6]*s,n[7]=e[7]*s,n[8]=e[8]*s,n};const i7=new d;$.setUniformScale=function(e,t,n){A.typeOf.object("matrix",e),A.typeOf.number("scale",t),A.typeOf.object("result",n);const i=$.getScale(e,i7),o=t/i.x,r=t/i.y,s=t/i.z;return n[0]=e[0]*o,n[1]=e[1]*o,n[2]=e[2]*o,n[3]=e[3]*r,n[4]=e[4]*r,n[5]=e[5]*r,n[6]=e[6]*s,n[7]=e[7]*s,n[8]=e[8]*s,n};const LE=new d;$.getScale=function(e,t){return A.typeOf.object("matrix",e),A.typeOf.object("result",t),t.x=d.magnitude(d.fromElements(e[0],e[1],e[2],LE)),t.y=d.magnitude(d.fromElements(e[3],e[4],e[5],LE)),t.z=d.magnitude(d.fromElements(e[6],e[7],e[8],LE)),t};const AL=new d;$.getMaximumScale=function(e){return $.getScale(e,AL),d.maximumComponent(AL)};const o7=new d;$.setRotation=function(e,t,n){A.typeOf.object("matrix",e),A.typeOf.object("result",n);const i=$.getScale(e,o7);return n[0]=t[0]*i.x,n[1]=t[1]*i.x,n[2]=t[2]*i.x,n[3]=t[3]*i.y,n[4]=t[4]*i.y,n[5]=t[5]*i.y,n[6]=t[6]*i.z,n[7]=t[7]*i.z,n[8]=t[8]*i.z,n};const r7=new d;$.getRotation=function(e,t){A.typeOf.object("matrix",e),A.typeOf.object("result",t);const n=$.getScale(e,r7);return t[0]=e[0]/n.x,t[1]=e[1]/n.x,t[2]=e[2]/n.x,t[3]=e[3]/n.y,t[4]=e[4]/n.y,t[5]=e[5]/n.y,t[6]=e[6]/n.z,t[7]=e[7]/n.z,t[8]=e[8]/n.z,t};$.multiply=function(e,t,n){A.typeOf.object("left",e),A.typeOf.object("right",t),A.typeOf.object("result",n);const i=e[0]*t[0]+e[3]*t[1]+e[6]*t[2],o=e[1]*t[0]+e[4]*t[1]+e[7]*t[2],r=e[2]*t[0]+e[5]*t[1]+e[8]*t[2],s=e[0]*t[3]+e[3]*t[4]+e[6]*t[5],a=e[1]*t[3]+e[4]*t[4]+e[7]*t[5],l=e[2]*t[3]+e[5]*t[4]+e[8]*t[5],u=e[0]*t[6]+e[3]*t[7]+e[6]*t[8],h=e[1]*t[6]+e[4]*t[7]+e[7]*t[8],f=e[2]*t[6]+e[5]*t[7]+e[8]*t[8];return n[0]=i,n[1]=o,n[2]=r,n[3]=s,n[4]=a,n[5]=l,n[6]=u,n[7]=h,n[8]=f,n};$.add=function(e,t,n){return A.typeOf.object("left",e),A.typeOf.object("right",t),A.typeOf.object("result",n),n[0]=e[0]+t[0],n[1]=e[1]+t[1],n[2]=e[2]+t[2],n[3]=e[3]+t[3],n[4]=e[4]+t[4],n[5]=e[5]+t[5],n[6]=e[6]+t[6],n[7]=e[7]+t[7],n[8]=e[8]+t[8],n};$.subtract=function(e,t,n){return A.typeOf.object("left",e),A.typeOf.object("right",t),A.typeOf.object("result",n),n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n[3]=e[3]-t[3],n[4]=e[4]-t[4],n[5]=e[5]-t[5],n[6]=e[6]-t[6],n[7]=e[7]-t[7],n[8]=e[8]-t[8],n};$.multiplyByVector=function(e,t,n){A.typeOf.object("matrix",e),A.typeOf.object("cartesian",t),A.typeOf.object("result",n);const i=t.x,o=t.y,r=t.z,s=e[0]*i+e[3]*o+e[6]*r,a=e[1]*i+e[4]*o+e[7]*r,l=e[2]*i+e[5]*o+e[8]*r;return n.x=s,n.y=a,n.z=l,n};$.multiplyByScalar=function(e,t,n){return A.typeOf.object("matrix",e),A.typeOf.number("scalar",t),A.typeOf.object("result",n),n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n[4]=e[4]*t,n[5]=e[5]*t,n[6]=e[6]*t,n[7]=e[7]*t,n[8]=e[8]*t,n};$.multiplyByScale=function(e,t,n){return A.typeOf.object("matrix",e),A.typeOf.object("scale",t),A.typeOf.object("result",n),n[0]=e[0]*t.x,n[1]=e[1]*t.x,n[2]=e[2]*t.x,n[3]=e[3]*t.y,n[4]=e[4]*t.y,n[5]=e[5]*t.y,n[6]=e[6]*t.z,n[7]=e[7]*t.z,n[8]=e[8]*t.z,n};$.multiplyByUniformScale=function(e,t,n){return A.typeOf.object("matrix",e),A.typeOf.number("scale",t),A.typeOf.object("result",n),n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n[4]=e[4]*t,n[5]=e[5]*t,n[6]=e[6]*t,n[7]=e[7]*t,n[8]=e[8]*t,n};$.negate=function(e,t){return A.typeOf.object("matrix",e),A.typeOf.object("result",t),t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t};$.transpose=function(e,t){A.typeOf.object("matrix",e),A.typeOf.object("result",t);const n=e[0],i=e[3],o=e[6],r=e[1],s=e[4],a=e[7],l=e[2],u=e[5],h=e[8];return t[0]=n,t[1]=i,t[2]=o,t[3]=r,t[4]=s,t[5]=a,t[6]=l,t[7]=u,t[8]=h,t};function s7(e){let t=0;for(let n=0;n<9;++n){const i=e[n];t+=i*i}return Math.sqrt(t)}const dI=[1,0,0],hI=[2,2,1];function a7(e){let t=0;for(let n=0;n<3;++n){const i=e[$.getElementIndex(hI[n],dI[n])];t+=2*i*i}return Math.sqrt(t)}function c7(e,t){const n=R.EPSILON15;let i=0,o=1;for(let u=0;u<3;++u){const h=Math.abs(e[$.getElementIndex(hI[u],dI[u])]);h>i&&(o=u,i=h)}let r=1,s=0;const a=dI[o],l=hI[o];if(Math.abs(e[$.getElementIndex(l,a)])>n){const u=e[$.getElementIndex(l,l)],h=e[$.getElementIndex(a,a)],f=e[$.getElementIndex(l,a)],_=(u-h)/2/f;let g;_<0?g=-1/(-_+Math.sqrt(1+_*_)):g=1/(_+Math.sqrt(1+_*_)),r=1/Math.sqrt(1+g*g),s=g*r}return t=$.clone($.IDENTITY,t),t[$.getElementIndex(a,a)]=t[$.getElementIndex(l,l)]=r,t[$.getElementIndex(l,a)]=s,t[$.getElementIndex(a,l)]=-s,t}const Cb=new $,xL=new $;$.computeEigenDecomposition=function(e,t){A.typeOf.object("matrix",e);const n=R.EPSILON20,i=10;let o=0,r=0;c(t)||(t={});const s=t.unitary=$.clone($.IDENTITY,t.unitary),a=t.diagonal=$.clone(e,t.diagonal),l=n*s7(a);for(;r<i&&a7(a)>l;)c7(a,Cb),$.transpose(Cb,xL),$.multiply(a,Cb,a),$.multiply(xL,a,a),$.multiply(s,Cb,s),++o>2&&(++r,o=0);return t};$.abs=function(e,t){return A.typeOf.object("matrix",e),A.typeOf.object("result",t),t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t};$.determinant=function(e){A.typeOf.object("matrix",e);const t=e[0],n=e[3],i=e[6],o=e[1],r=e[4],s=e[7],a=e[2],l=e[5],u=e[8];return t*(r*u-l*s)+o*(l*i-n*u)+a*(n*s-r*i)};$.inverse=function(e,t){A.typeOf.object("matrix",e),A.typeOf.object("result",t);const n=e[0],i=e[1],o=e[2],r=e[3],s=e[4],a=e[5],l=e[6],u=e[7],h=e[8],f=$.determinant(e);if(Math.abs(f)<=R.EPSILON15)throw new E("matrix is not invertible");t[0]=s*h-u*a,t[1]=u*o-i*h,t[2]=i*a-s*o,t[3]=l*a-r*h,t[4]=n*h-l*o,t[5]=r*o-n*a,t[6]=r*u-l*s,t[7]=l*i-n*u,t[8]=n*s-r*i;const _=1/f;return $.multiplyByScalar(t,_,t)};const l7=new $;$.inverseTranspose=function(e,t){return A.typeOf.object("matrix",e),A.typeOf.object("result",t),$.inverse($.transpose(e,l7),t)};$.equals=function(e,t){return e===t||c(e)&&c(t)&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]};$.equalsEpsilon=function(e,t,n){return n=y(n,0),e===t||c(e)&&c(t)&&Math.abs(e[0]-t[0])<=n&&Math.abs(e[1]-t[1])<=n&&Math.abs(e[2]-t[2])<=n&&Math.abs(e[3]-t[3])<=n&&Math.abs(e[4]-t[4])<=n&&Math.abs(e[5]-t[5])<=n&&Math.abs(e[6]-t[6])<=n&&Math.abs(e[7]-t[7])<=n&&Math.abs(e[8]-t[8])<=n};$.IDENTITY=Object.freeze(new $(1,0,0,0,1,0,0,0,1));$.ZERO=Object.freeze(new $(0,0,0,0,0,0,0,0,0));$.COLUMN0ROW0=0;$.COLUMN0ROW1=1;$.COLUMN0ROW2=2;$.COLUMN1ROW0=3;$.COLUMN1ROW1=4;$.COLUMN1ROW2=5;$.COLUMN2ROW0=6;$.COLUMN2ROW1=7;$.COLUMN2ROW2=8;Object.defineProperties($.prototype,{length:{get:function(){return $.packedLength}}});$.prototype.clone=function(e){return $.clone(this,e)};$.prototype.equals=function(e){return $.equals(this,e)};$.equalsArray=function(e,t,n){return e[0]===t[n]&&e[1]===t[n+1]&&e[2]===t[n+2]&&e[3]===t[n+3]&&e[4]===t[n+4]&&e[5]===t[n+5]&&e[6]===t[n+6]&&e[7]===t[n+7]&&e[8]===t[n+8]};$.prototype.equalsEpsilon=function(e,t){return $.equalsEpsilon(this,e,t)};$.prototype.toString=function(){return`(${this[0]}, ${this[3]}, ${this[6]})
|
|
(${this[1]}, ${this[4]}, ${this[7]})
|
|
(${this[2]}, ${this[5]}, ${this[8]})`};function Te(e){this.name="RuntimeError",this.message=e;let t;try{throw new Error}catch(n){t=n.stack}this.stack=t}c(Object.create)&&(Te.prototype=Object.create(Error.prototype),Te.prototype.constructor=Te);Te.prototype.toString=function(){let e=`${this.name}: ${this.message}`;return c(this.stack)&&(e+=`
|
|
${this.stack.toString()}`),e};function L(e,t,n,i,o,r,s,a,l,u,h,f,_,g,m,b){this[0]=y(e,0),this[1]=y(o,0),this[2]=y(l,0),this[3]=y(_,0),this[4]=y(t,0),this[5]=y(r,0),this[6]=y(u,0),this[7]=y(g,0),this[8]=y(n,0),this[9]=y(s,0),this[10]=y(h,0),this[11]=y(m,0),this[12]=y(i,0),this[13]=y(a,0),this[14]=y(f,0),this[15]=y(b,0)}L.packedLength=16;L.pack=function(e,t,n){return A.typeOf.object("value",e),A.defined("array",t),n=y(n,0),t[n++]=e[0],t[n++]=e[1],t[n++]=e[2],t[n++]=e[3],t[n++]=e[4],t[n++]=e[5],t[n++]=e[6],t[n++]=e[7],t[n++]=e[8],t[n++]=e[9],t[n++]=e[10],t[n++]=e[11],t[n++]=e[12],t[n++]=e[13],t[n++]=e[14],t[n]=e[15],t};L.unpack=function(e,t,n){return A.defined("array",e),t=y(t,0),c(n)||(n=new L),n[0]=e[t++],n[1]=e[t++],n[2]=e[t++],n[3]=e[t++],n[4]=e[t++],n[5]=e[t++],n[6]=e[t++],n[7]=e[t++],n[8]=e[t++],n[9]=e[t++],n[10]=e[t++],n[11]=e[t++],n[12]=e[t++],n[13]=e[t++],n[14]=e[t++],n[15]=e[t],n};L.packArray=function(e,t){A.defined("array",e);const n=e.length,i=n*16;if(!c(t))t=new Array(i);else{if(!Array.isArray(t)&&t.length!==i)throw new E("If result is a typed array, it must have exactly array.length * 16 elements");t.length!==i&&(t.length=i)}for(let o=0;o<n;++o)L.pack(e[o],t,o*16);return t};L.unpackArray=function(e,t){if(A.defined("array",e),A.typeOf.number.greaterThanOrEquals("array.length",e.length,16),e.length%16!==0)throw new E("array length must be a multiple of 16.");const n=e.length;c(t)?t.length=n/16:t=new Array(n/16);for(let i=0;i<n;i+=16){const o=i/16;t[o]=L.unpack(e,i,t[o])}return t};L.clone=function(e,t){if(!!c(e))return c(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t):new L(e[0],e[4],e[8],e[12],e[1],e[5],e[9],e[13],e[2],e[6],e[10],e[14],e[3],e[7],e[11],e[15])};L.fromArray=L.unpack;L.fromColumnMajorArray=function(e,t){return A.defined("values",e),L.clone(e,t)};L.fromRowMajorArray=function(e,t){return A.defined("values",e),c(t)?(t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15],t):new L(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])};L.fromRotationTranslation=function(e,t,n){return A.typeOf.object("rotation",e),t=y(t,d.ZERO),c(n)?(n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=0,n[4]=e[3],n[5]=e[4],n[6]=e[5],n[7]=0,n[8]=e[6],n[9]=e[7],n[10]=e[8],n[11]=0,n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=1,n):new L(e[0],e[3],e[6],t.x,e[1],e[4],e[7],t.y,e[2],e[5],e[8],t.z,0,0,0,1)};L.fromTranslationQuaternionRotationScale=function(e,t,n,i){A.typeOf.object("translation",e),A.typeOf.object("rotation",t),A.typeOf.object("scale",n),c(i)||(i=new L);const o=n.x,r=n.y,s=n.z,a=t.x*t.x,l=t.x*t.y,u=t.x*t.z,h=t.x*t.w,f=t.y*t.y,_=t.y*t.z,g=t.y*t.w,m=t.z*t.z,b=t.z*t.w,T=t.w*t.w,x=a-f-m+T,C=2*(l-b),w=2*(u+g),v=2*(l+b),P=-a+f-m+T,N=2*(_-h),k=2*(u-g),M=2*(_+h),U=-a-f+m+T;return i[0]=x*o,i[1]=v*o,i[2]=k*o,i[3]=0,i[4]=C*r,i[5]=P*r,i[6]=M*r,i[7]=0,i[8]=w*s,i[9]=N*s,i[10]=U*s,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,i};L.fromTranslationRotationScale=function(e,t){return A.typeOf.object("translationRotationScale",e),L.fromTranslationQuaternionRotationScale(e.translation,e.rotation,e.scale,t)};L.fromTranslation=function(e,t){return A.typeOf.object("translation",e),L.fromRotationTranslation($.IDENTITY,e,t)};L.fromScale=function(e,t){return A.typeOf.object("scale",e),c(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e.y,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e.z,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t):new L(e.x,0,0,0,0,e.y,0,0,0,0,e.z,0,0,0,0,1)};L.fromUniformScale=function(e,t){return A.typeOf.number("scale",e),c(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t):new L(e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1)};L.fromRotation=function(e,t){return A.typeOf.object("rotation",e),c(t)||(t=new L),t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=0,t[4]=e[3],t[5]=e[4],t[6]=e[5],t[7]=0,t[8]=e[6],t[9]=e[7],t[10]=e[8],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t};const nm=new d,im=new d,hg=new d;L.fromCamera=function(e,t){A.typeOf.object("camera",e);const n=e.position,i=e.direction,o=e.up;A.typeOf.object("camera.position",n),A.typeOf.object("camera.direction",i),A.typeOf.object("camera.up",o),d.normalize(i,nm),d.normalize(d.cross(nm,o,im),im),d.normalize(d.cross(im,nm,hg),hg);const r=im.x,s=im.y,a=im.z,l=nm.x,u=nm.y,h=nm.z,f=hg.x,_=hg.y,g=hg.z,m=n.x,b=n.y,T=n.z,x=r*-m+s*-b+a*-T,C=f*-m+_*-b+g*-T,w=l*m+u*b+h*T;return c(t)?(t[0]=r,t[1]=f,t[2]=-l,t[3]=0,t[4]=s,t[5]=_,t[6]=-u,t[7]=0,t[8]=a,t[9]=g,t[10]=-h,t[11]=0,t[12]=x,t[13]=C,t[14]=w,t[15]=1,t):new L(r,s,a,x,f,_,g,C,-l,-u,-h,w,0,0,0,1)};L.computePerspectiveFieldOfView=function(e,t,n,i,o){A.typeOf.number.greaterThan("fovY",e,0),A.typeOf.number.lessThan("fovY",e,Math.PI),A.typeOf.number.greaterThan("near",n,0),A.typeOf.number.greaterThan("far",i,0),A.typeOf.object("result",o);const s=1/Math.tan(e*.5),a=s/t,l=(i+n)/(n-i),u=2*i*n/(n-i);return o[0]=a,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=s,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=l,o[11]=-1,o[12]=0,o[13]=0,o[14]=u,o[15]=0,o};L.computeOrthographicOffCenter=function(e,t,n,i,o,r,s){A.typeOf.number("left",e),A.typeOf.number("right",t),A.typeOf.number("bottom",n),A.typeOf.number("top",i),A.typeOf.number("near",o),A.typeOf.number("far",r),A.typeOf.object("result",s);let a=1/(t-e),l=1/(i-n),u=1/(r-o);const h=-(t+e)*a,f=-(i+n)*l,_=-(r+o)*u;return a*=2,l*=2,u*=-2,s[0]=a,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=l,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=u,s[11]=0,s[12]=h,s[13]=f,s[14]=_,s[15]=1,s};L.computePerspectiveOffCenter=function(e,t,n,i,o,r,s){A.typeOf.number("left",e),A.typeOf.number("right",t),A.typeOf.number("bottom",n),A.typeOf.number("top",i),A.typeOf.number("near",o),A.typeOf.number("far",r),A.typeOf.object("result",s);const a=2*o/(t-e),l=2*o/(i-n),u=(t+e)/(t-e),h=(i+n)/(i-n),f=-(r+o)/(r-o),_=-1,g=-2*r*o/(r-o);return s[0]=a,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=l,s[6]=0,s[7]=0,s[8]=u,s[9]=h,s[10]=f,s[11]=_,s[12]=0,s[13]=0,s[14]=g,s[15]=0,s};L.computeInfinitePerspectiveOffCenter=function(e,t,n,i,o,r){A.typeOf.number("left",e),A.typeOf.number("right",t),A.typeOf.number("bottom",n),A.typeOf.number("top",i),A.typeOf.number("near",o),A.typeOf.object("result",r);const s=2*o/(t-e),a=2*o/(i-n),l=(t+e)/(t-e),u=(i+n)/(i-n),h=-1,f=-1,_=-2*o;return r[0]=s,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=a,r[6]=0,r[7]=0,r[8]=l,r[9]=u,r[10]=h,r[11]=f,r[12]=0,r[13]=0,r[14]=_,r[15]=0,r};L.computeViewportTransformation=function(e,t,n,i){c(i)||(i=new L),e=y(e,y.EMPTY_OBJECT);const o=y(e.x,0),r=y(e.y,0),s=y(e.width,0),a=y(e.height,0);t=y(t,0),n=y(n,1);const l=s*.5,u=a*.5,h=(n-t)*.5,f=l,_=u,g=h,m=o+l,b=r+u,T=t+h,x=1;return i[0]=f,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=_,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=g,i[11]=0,i[12]=m,i[13]=b,i[14]=T,i[15]=x,i};L.computeView=function(e,t,n,i,o){return A.typeOf.object("position",e),A.typeOf.object("direction",t),A.typeOf.object("up",n),A.typeOf.object("right",i),A.typeOf.object("result",o),o[0]=i.x,o[1]=n.x,o[2]=-t.x,o[3]=0,o[4]=i.y,o[5]=n.y,o[6]=-t.y,o[7]=0,o[8]=i.z,o[9]=n.z,o[10]=-t.z,o[11]=0,o[12]=-d.dot(i,e),o[13]=-d.dot(n,e),o[14]=d.dot(t,e),o[15]=1,o};L.toArray=function(e,t){return A.typeOf.object("matrix",e),c(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t):[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15]]};L.getElementIndex=function(e,t){return A.typeOf.number.greaterThanOrEquals("row",t,0),A.typeOf.number.lessThanOrEquals("row",t,3),A.typeOf.number.greaterThanOrEquals("column",e,0),A.typeOf.number.lessThanOrEquals("column",e,3),e*4+t};L.getColumn=function(e,t,n){A.typeOf.object("matrix",e),A.typeOf.number.greaterThanOrEquals("index",t,0),A.typeOf.number.lessThanOrEquals("index",t,3),A.typeOf.object("result",n);const i=t*4,o=e[i],r=e[i+1],s=e[i+2],a=e[i+3];return n.x=o,n.y=r,n.z=s,n.w=a,n};L.setColumn=function(e,t,n,i){A.typeOf.object("matrix",e),A.typeOf.number.greaterThanOrEquals("index",t,0),A.typeOf.number.lessThanOrEquals("index",t,3),A.typeOf.object("cartesian",n),A.typeOf.object("result",i),i=L.clone(e,i);const o=t*4;return i[o]=n.x,i[o+1]=n.y,i[o+2]=n.z,i[o+3]=n.w,i};L.getRow=function(e,t,n){A.typeOf.object("matrix",e),A.typeOf.number.greaterThanOrEquals("index",t,0),A.typeOf.number.lessThanOrEquals("index",t,3),A.typeOf.object("result",n);const i=e[t],o=e[t+4],r=e[t+8],s=e[t+12];return n.x=i,n.y=o,n.z=r,n.w=s,n};L.setRow=function(e,t,n,i){return A.typeOf.object("matrix",e),A.typeOf.number.greaterThanOrEquals("index",t,0),A.typeOf.number.lessThanOrEquals("index",t,3),A.typeOf.object("cartesian",n),A.typeOf.object("result",i),i=L.clone(e,i),i[t]=n.x,i[t+4]=n.y,i[t+8]=n.z,i[t+12]=n.w,i};L.setTranslation=function(e,t,n){return A.typeOf.object("matrix",e),A.typeOf.object("translation",t),A.typeOf.object("result",n),n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[8]=e[8],n[9]=e[9],n[10]=e[10],n[11]=e[11],n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=e[15],n};const u7=new d;L.setScale=function(e,t,n){A.typeOf.object("matrix",e),A.typeOf.object("scale",t),A.typeOf.object("result",n);const i=L.getScale(e,u7),o=t.x/i.x,r=t.y/i.y,s=t.z/i.z;return n[0]=e[0]*o,n[1]=e[1]*o,n[2]=e[2]*o,n[3]=e[3],n[4]=e[4]*r,n[5]=e[5]*r,n[6]=e[6]*r,n[7]=e[7],n[8]=e[8]*s,n[9]=e[9]*s,n[10]=e[10]*s,n[11]=e[11],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n};const d7=new d;L.setUniformScale=function(e,t,n){A.typeOf.object("matrix",e),A.typeOf.number("scale",t),A.typeOf.object("result",n);const i=L.getScale(e,d7),o=t/i.x,r=t/i.y,s=t/i.z;return n[0]=e[0]*o,n[1]=e[1]*o,n[2]=e[2]*o,n[3]=e[3],n[4]=e[4]*r,n[5]=e[5]*r,n[6]=e[6]*r,n[7]=e[7],n[8]=e[8]*s,n[9]=e[9]*s,n[10]=e[10]*s,n[11]=e[11],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n};const RE=new d;L.getScale=function(e,t){return A.typeOf.object("matrix",e),A.typeOf.object("result",t),t.x=d.magnitude(d.fromElements(e[0],e[1],e[2],RE)),t.y=d.magnitude(d.fromElements(e[4],e[5],e[6],RE)),t.z=d.magnitude(d.fromElements(e[8],e[9],e[10],RE)),t};const CL=new d;L.getMaximumScale=function(e){return L.getScale(e,CL),d.maximumComponent(CL)};const h7=new d;L.setRotation=function(e,t,n){A.typeOf.object("matrix",e),A.typeOf.object("result",n);const i=L.getScale(e,h7);return n[0]=t[0]*i.x,n[1]=t[1]*i.x,n[2]=t[2]*i.x,n[3]=e[3],n[4]=t[3]*i.y,n[5]=t[4]*i.y,n[6]=t[5]*i.y,n[7]=e[7],n[8]=t[6]*i.z,n[9]=t[7]*i.z,n[10]=t[8]*i.z,n[11]=e[11],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n};const f7=new d;L.getRotation=function(e,t){A.typeOf.object("matrix",e),A.typeOf.object("result",t);const n=L.getScale(e,f7);return t[0]=e[0]/n.x,t[1]=e[1]/n.x,t[2]=e[2]/n.x,t[3]=e[4]/n.y,t[4]=e[5]/n.y,t[5]=e[6]/n.y,t[6]=e[8]/n.z,t[7]=e[9]/n.z,t[8]=e[10]/n.z,t};L.multiply=function(e,t,n){A.typeOf.object("left",e),A.typeOf.object("right",t),A.typeOf.object("result",n);const i=e[0],o=e[1],r=e[2],s=e[3],a=e[4],l=e[5],u=e[6],h=e[7],f=e[8],_=e[9],g=e[10],m=e[11],b=e[12],T=e[13],x=e[14],C=e[15],w=t[0],v=t[1],P=t[2],N=t[3],k=t[4],M=t[5],U=t[6],B=t[7],S=t[8],D=t[9],p=t[10],I=t[11],O=t[12],F=t[13],V=t[14],G=t[15],j=i*w+a*v+f*P+b*N,W=o*w+l*v+_*P+T*N,X=r*w+u*v+g*P+x*N,q=s*w+h*v+m*P+C*N,ee=i*k+a*M+f*U+b*B,Y=o*k+l*M+_*U+T*B,ne=r*k+u*M+g*U+x*B,Q=s*k+h*M+m*U+C*B,le=i*S+a*D+f*p+b*I,pe=o*S+l*D+_*p+T*I,re=r*S+u*D+g*p+x*I,de=s*S+h*D+m*p+C*I,fe=i*O+a*F+f*V+b*G,ye=o*O+l*F+_*V+T*G,Ce=r*O+u*F+g*V+x*G,we=s*O+h*F+m*V+C*G;return n[0]=j,n[1]=W,n[2]=X,n[3]=q,n[4]=ee,n[5]=Y,n[6]=ne,n[7]=Q,n[8]=le,n[9]=pe,n[10]=re,n[11]=de,n[12]=fe,n[13]=ye,n[14]=Ce,n[15]=we,n};L.add=function(e,t,n){return A.typeOf.object("left",e),A.typeOf.object("right",t),A.typeOf.object("result",n),n[0]=e[0]+t[0],n[1]=e[1]+t[1],n[2]=e[2]+t[2],n[3]=e[3]+t[3],n[4]=e[4]+t[4],n[5]=e[5]+t[5],n[6]=e[6]+t[6],n[7]=e[7]+t[7],n[8]=e[8]+t[8],n[9]=e[9]+t[9],n[10]=e[10]+t[10],n[11]=e[11]+t[11],n[12]=e[12]+t[12],n[13]=e[13]+t[13],n[14]=e[14]+t[14],n[15]=e[15]+t[15],n};L.subtract=function(e,t,n){return A.typeOf.object("left",e),A.typeOf.object("right",t),A.typeOf.object("result",n),n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n[3]=e[3]-t[3],n[4]=e[4]-t[4],n[5]=e[5]-t[5],n[6]=e[6]-t[6],n[7]=e[7]-t[7],n[8]=e[8]-t[8],n[9]=e[9]-t[9],n[10]=e[10]-t[10],n[11]=e[11]-t[11],n[12]=e[12]-t[12],n[13]=e[13]-t[13],n[14]=e[14]-t[14],n[15]=e[15]-t[15],n};L.multiplyTransformation=function(e,t,n){A.typeOf.object("left",e),A.typeOf.object("right",t),A.typeOf.object("result",n);const i=e[0],o=e[1],r=e[2],s=e[4],a=e[5],l=e[6],u=e[8],h=e[9],f=e[10],_=e[12],g=e[13],m=e[14],b=t[0],T=t[1],x=t[2],C=t[4],w=t[5],v=t[6],P=t[8],N=t[9],k=t[10],M=t[12],U=t[13],B=t[14],S=i*b+s*T+u*x,D=o*b+a*T+h*x,p=r*b+l*T+f*x,I=i*C+s*w+u*v,O=o*C+a*w+h*v,F=r*C+l*w+f*v,V=i*P+s*N+u*k,G=o*P+a*N+h*k,j=r*P+l*N+f*k,W=i*M+s*U+u*B+_,X=o*M+a*U+h*B+g,q=r*M+l*U+f*B+m;return n[0]=S,n[1]=D,n[2]=p,n[3]=0,n[4]=I,n[5]=O,n[6]=F,n[7]=0,n[8]=V,n[9]=G,n[10]=j,n[11]=0,n[12]=W,n[13]=X,n[14]=q,n[15]=1,n};L.multiplyByMatrix3=function(e,t,n){A.typeOf.object("matrix",e),A.typeOf.object("rotation",t),A.typeOf.object("result",n);const i=e[0],o=e[1],r=e[2],s=e[4],a=e[5],l=e[6],u=e[8],h=e[9],f=e[10],_=t[0],g=t[1],m=t[2],b=t[3],T=t[4],x=t[5],C=t[6],w=t[7],v=t[8],P=i*_+s*g+u*m,N=o*_+a*g+h*m,k=r*_+l*g+f*m,M=i*b+s*T+u*x,U=o*b+a*T+h*x,B=r*b+l*T+f*x,S=i*C+s*w+u*v,D=o*C+a*w+h*v,p=r*C+l*w+f*v;return n[0]=P,n[1]=N,n[2]=k,n[3]=0,n[4]=M,n[5]=U,n[6]=B,n[7]=0,n[8]=S,n[9]=D,n[10]=p,n[11]=0,n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n};L.multiplyByTranslation=function(e,t,n){A.typeOf.object("matrix",e),A.typeOf.object("translation",t),A.typeOf.object("result",n);const i=t.x,o=t.y,r=t.z,s=i*e[0]+o*e[4]+r*e[8]+e[12],a=i*e[1]+o*e[5]+r*e[9]+e[13],l=i*e[2]+o*e[6]+r*e[10]+e[14];return n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[8]=e[8],n[9]=e[9],n[10]=e[10],n[11]=e[11],n[12]=s,n[13]=a,n[14]=l,n[15]=e[15],n};L.multiplyByScale=function(e,t,n){A.typeOf.object("matrix",e),A.typeOf.object("scale",t),A.typeOf.object("result",n);const i=t.x,o=t.y,r=t.z;return i===1&&o===1&&r===1?L.clone(e,n):(n[0]=i*e[0],n[1]=i*e[1],n[2]=i*e[2],n[3]=e[3],n[4]=o*e[4],n[5]=o*e[5],n[6]=o*e[6],n[7]=e[7],n[8]=r*e[8],n[9]=r*e[9],n[10]=r*e[10],n[11]=e[11],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n)};L.multiplyByUniformScale=function(e,t,n){return A.typeOf.object("matrix",e),A.typeOf.number("scale",t),A.typeOf.object("result",n),n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3],n[4]=e[4]*t,n[5]=e[5]*t,n[6]=e[6]*t,n[7]=e[7],n[8]=e[8]*t,n[9]=e[9]*t,n[10]=e[10]*t,n[11]=e[11],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n};L.multiplyByVector=function(e,t,n){A.typeOf.object("matrix",e),A.typeOf.object("cartesian",t),A.typeOf.object("result",n);const i=t.x,o=t.y,r=t.z,s=t.w,a=e[0]*i+e[4]*o+e[8]*r+e[12]*s,l=e[1]*i+e[5]*o+e[9]*r+e[13]*s,u=e[2]*i+e[6]*o+e[10]*r+e[14]*s,h=e[3]*i+e[7]*o+e[11]*r+e[15]*s;return n.x=a,n.y=l,n.z=u,n.w=h,n};L.multiplyByPointAsVector=function(e,t,n){A.typeOf.object("matrix",e),A.typeOf.object("cartesian",t),A.typeOf.object("result",n);const i=t.x,o=t.y,r=t.z,s=e[0]*i+e[4]*o+e[8]*r,a=e[1]*i+e[5]*o+e[9]*r,l=e[2]*i+e[6]*o+e[10]*r;return n.x=s,n.y=a,n.z=l,n};L.multiplyByPoint=function(e,t,n){A.typeOf.object("matrix",e),A.typeOf.object("cartesian",t),A.typeOf.object("result",n);const i=t.x,o=t.y,r=t.z,s=e[0]*i+e[4]*o+e[8]*r+e[12],a=e[1]*i+e[5]*o+e[9]*r+e[13],l=e[2]*i+e[6]*o+e[10]*r+e[14];return n.x=s,n.y=a,n.z=l,n};L.multiplyByScalar=function(e,t,n){return A.typeOf.object("matrix",e),A.typeOf.number("scalar",t),A.typeOf.object("result",n),n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n[4]=e[4]*t,n[5]=e[5]*t,n[6]=e[6]*t,n[7]=e[7]*t,n[8]=e[8]*t,n[9]=e[9]*t,n[10]=e[10]*t,n[11]=e[11]*t,n[12]=e[12]*t,n[13]=e[13]*t,n[14]=e[14]*t,n[15]=e[15]*t,n};L.negate=function(e,t){return A.typeOf.object("matrix",e),A.typeOf.object("result",t),t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t[9]=-e[9],t[10]=-e[10],t[11]=-e[11],t[12]=-e[12],t[13]=-e[13],t[14]=-e[14],t[15]=-e[15],t};L.transpose=function(e,t){A.typeOf.object("matrix",e),A.typeOf.object("result",t);const n=e[1],i=e[2],o=e[3],r=e[6],s=e[7],a=e[11];return t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=n,t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=i,t[9]=r,t[10]=e[10],t[11]=e[14],t[12]=o,t[13]=s,t[14]=a,t[15]=e[15],t};L.abs=function(e,t){return A.typeOf.object("matrix",e),A.typeOf.object("result",t),t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t[9]=Math.abs(e[9]),t[10]=Math.abs(e[10]),t[11]=Math.abs(e[11]),t[12]=Math.abs(e[12]),t[13]=Math.abs(e[13]),t[14]=Math.abs(e[14]),t[15]=Math.abs(e[15]),t};L.equals=function(e,t){return e===t||c(e)&&c(t)&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[3]===t[3]&&e[7]===t[7]&&e[11]===t[11]&&e[15]===t[15]};L.equalsEpsilon=function(e,t,n){return n=y(n,0),e===t||c(e)&&c(t)&&Math.abs(e[0]-t[0])<=n&&Math.abs(e[1]-t[1])<=n&&Math.abs(e[2]-t[2])<=n&&Math.abs(e[3]-t[3])<=n&&Math.abs(e[4]-t[4])<=n&&Math.abs(e[5]-t[5])<=n&&Math.abs(e[6]-t[6])<=n&&Math.abs(e[7]-t[7])<=n&&Math.abs(e[8]-t[8])<=n&&Math.abs(e[9]-t[9])<=n&&Math.abs(e[10]-t[10])<=n&&Math.abs(e[11]-t[11])<=n&&Math.abs(e[12]-t[12])<=n&&Math.abs(e[13]-t[13])<=n&&Math.abs(e[14]-t[14])<=n&&Math.abs(e[15]-t[15])<=n};L.getTranslation=function(e,t){return A.typeOf.object("matrix",e),A.typeOf.object("result",t),t.x=e[12],t.y=e[13],t.z=e[14],t};L.getMatrix3=function(e,t){return A.typeOf.object("matrix",e),A.typeOf.object("result",t),t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t};const p7=new $,m7=new $,_7=new te,g7=new te(0,0,0,1);L.inverse=function(e,t){A.typeOf.object("matrix",e),A.typeOf.object("result",t);const n=e[0],i=e[4],o=e[8],r=e[12],s=e[1],a=e[5],l=e[9],u=e[13],h=e[2],f=e[6],_=e[10],g=e[14],m=e[3],b=e[7],T=e[11],x=e[15];let C=_*x,w=g*T,v=f*x,P=g*b,N=f*T,k=_*b,M=h*x,U=g*m,B=h*T,S=_*m,D=h*b,p=f*m;const I=C*a+P*l+N*u-(w*a+v*l+k*u),O=w*s+M*l+S*u-(C*s+U*l+B*u),F=v*s+U*a+D*u-(P*s+M*a+p*u),V=k*s+B*a+p*l-(N*s+S*a+D*l),G=w*i+v*o+k*r-(C*i+P*o+N*r),j=C*n+U*o+B*r-(w*n+M*o+S*r),W=P*n+M*i+p*r-(v*n+U*i+D*r),X=N*n+S*i+D*o-(k*n+B*i+p*o);C=o*u,w=r*l,v=i*u,P=r*a,N=i*l,k=o*a,M=n*u,U=r*s,B=n*l,S=o*s,D=n*a,p=i*s;const q=C*b+P*T+N*x-(w*b+v*T+k*x),ee=w*m+M*T+S*x-(C*m+U*T+B*x),Y=v*m+U*b+D*x-(P*m+M*b+p*x),ne=k*m+B*b+p*T-(N*m+S*b+D*T),Q=v*_+k*g+w*f-(N*g+C*f+P*_),le=B*g+C*h+U*_-(M*_+S*g+w*h),pe=M*f+p*g+P*h-(D*g+v*h+U*f),re=D*_+N*h+S*f-(B*f+p*_+k*h);let de=n*I+i*O+o*F+r*V;if(Math.abs(de)<R.EPSILON21){if($.equalsEpsilon(L.getMatrix3(e,p7),m7,R.EPSILON7)&&te.equals(L.getRow(e,3,_7),g7))return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=0,t[11]=0,t[12]=-e[12],t[13]=-e[13],t[14]=-e[14],t[15]=1,t;throw new Te("matrix is not invertible because its determinate is zero.")}return de=1/de,t[0]=I*de,t[1]=O*de,t[2]=F*de,t[3]=V*de,t[4]=G*de,t[5]=j*de,t[6]=W*de,t[7]=X*de,t[8]=q*de,t[9]=ee*de,t[10]=Y*de,t[11]=ne*de,t[12]=Q*de,t[13]=le*de,t[14]=pe*de,t[15]=re*de,t};L.inverseTransformation=function(e,t){A.typeOf.object("matrix",e),A.typeOf.object("result",t);const n=e[0],i=e[1],o=e[2],r=e[4],s=e[5],a=e[6],l=e[8],u=e[9],h=e[10],f=e[12],_=e[13],g=e[14],m=-n*f-i*_-o*g,b=-r*f-s*_-a*g,T=-l*f-u*_-h*g;return t[0]=n,t[1]=r,t[2]=l,t[3]=0,t[4]=i,t[5]=s,t[6]=u,t[7]=0,t[8]=o,t[9]=a,t[10]=h,t[11]=0,t[12]=m,t[13]=b,t[14]=T,t[15]=1,t};const y7=new L;L.inverseTranspose=function(e,t){return A.typeOf.object("matrix",e),A.typeOf.object("result",t),L.inverse(L.transpose(e,y7),t)};L.IDENTITY=Object.freeze(new L(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1));L.ZERO=Object.freeze(new L(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0));L.COLUMN0ROW0=0;L.COLUMN0ROW1=1;L.COLUMN0ROW2=2;L.COLUMN0ROW3=3;L.COLUMN1ROW0=4;L.COLUMN1ROW1=5;L.COLUMN1ROW2=6;L.COLUMN1ROW3=7;L.COLUMN2ROW0=8;L.COLUMN2ROW1=9;L.COLUMN2ROW2=10;L.COLUMN2ROW3=11;L.COLUMN3ROW0=12;L.COLUMN3ROW1=13;L.COLUMN3ROW2=14;L.COLUMN3ROW3=15;Object.defineProperties(L.prototype,{length:{get:function(){return L.packedLength}}});L.prototype.clone=function(e){return L.clone(this,e)};L.prototype.equals=function(e){return L.equals(this,e)};L.equalsArray=function(e,t,n){return e[0]===t[n]&&e[1]===t[n+1]&&e[2]===t[n+2]&&e[3]===t[n+3]&&e[4]===t[n+4]&&e[5]===t[n+5]&&e[6]===t[n+6]&&e[7]===t[n+7]&&e[8]===t[n+8]&&e[9]===t[n+9]&&e[10]===t[n+10]&&e[11]===t[n+11]&&e[12]===t[n+12]&&e[13]===t[n+13]&&e[14]===t[n+14]&&e[15]===t[n+15]};L.prototype.equalsEpsilon=function(e,t){return L.equalsEpsilon(this,e,t)};L.prototype.toString=function(){return`(${this[0]}, ${this[4]}, ${this[8]}, ${this[12]})
|
|
(${this[1]}, ${this[5]}, ${this[9]}, ${this[13]})
|
|
(${this[2]}, ${this[6]}, ${this[10]}, ${this[14]})
|
|
(${this[3]}, ${this[7]}, ${this[11]}, ${this[15]})`};const b7={DEPTH_BUFFER_BIT:256,STENCIL_BUFFER_BIT:1024,COLOR_BUFFER_BIT:16384,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,ZERO:0,ONE:1,SRC_COLOR:768,ONE_MINUS_SRC_COLOR:769,SRC_ALPHA:770,ONE_MINUS_SRC_ALPHA:771,DST_ALPHA:772,ONE_MINUS_DST_ALPHA:773,DST_COLOR:774,ONE_MINUS_DST_COLOR:775,SRC_ALPHA_SATURATE:776,FUNC_ADD:32774,BLEND_EQUATION:32777,BLEND_EQUATION_RGB:32777,BLEND_EQUATION_ALPHA:34877,FUNC_SUBTRACT:32778,FUNC_REVERSE_SUBTRACT:32779,BLEND_DST_RGB:32968,BLEND_SRC_RGB:32969,BLEND_DST_ALPHA:32970,BLEND_SRC_ALPHA:32971,CONSTANT_COLOR:32769,ONE_MINUS_CONSTANT_COLOR:32770,CONSTANT_ALPHA:32771,ONE_MINUS_CONSTANT_ALPHA:32772,BLEND_COLOR:32773,ARRAY_BUFFER:34962,ELEMENT_ARRAY_BUFFER:34963,ARRAY_BUFFER_BINDING:34964,ELEMENT_ARRAY_BUFFER_BINDING:34965,STREAM_DRAW:35040,STATIC_DRAW:35044,DYNAMIC_DRAW:35048,BUFFER_SIZE:34660,BUFFER_USAGE:34661,CURRENT_VERTEX_ATTRIB:34342,FRONT:1028,BACK:1029,FRONT_AND_BACK:1032,CULL_FACE:2884,BLEND:3042,DITHER:3024,STENCIL_TEST:2960,DEPTH_TEST:2929,SCISSOR_TEST:3089,POLYGON_OFFSET_FILL:32823,SAMPLE_ALPHA_TO_COVERAGE:32926,SAMPLE_COVERAGE:32928,NO_ERROR:0,INVALID_ENUM:1280,INVALID_VALUE:1281,INVALID_OPERATION:1282,OUT_OF_MEMORY:1285,CW:2304,CCW:2305,LINE_WIDTH:2849,ALIASED_POINT_SIZE_RANGE:33901,ALIASED_LINE_WIDTH_RANGE:33902,CULL_FACE_MODE:2885,FRONT_FACE:2886,DEPTH_RANGE:2928,DEPTH_WRITEMASK:2930,DEPTH_CLEAR_VALUE:2931,DEPTH_FUNC:2932,STENCIL_CLEAR_VALUE:2961,STENCIL_FUNC:2962,STENCIL_FAIL:2964,STENCIL_PASS_DEPTH_FAIL:2965,STENCIL_PASS_DEPTH_PASS:2966,STENCIL_REF:2967,STENCIL_VALUE_MASK:2963,STENCIL_WRITEMASK:2968,STENCIL_BACK_FUNC:34816,STENCIL_BACK_FAIL:34817,STENCIL_BACK_PASS_DEPTH_FAIL:34818,STENCIL_BACK_PASS_DEPTH_PASS:34819,STENCIL_BACK_REF:36003,STENCIL_BACK_VALUE_MASK:36004,STENCIL_BACK_WRITEMASK:36005,VIEWPORT:2978,SCISSOR_BOX:3088,COLOR_CLEAR_VALUE:3106,COLOR_WRITEMASK:3107,UNPACK_ALIGNMENT:3317,PACK_ALIGNMENT:3333,MAX_TEXTURE_SIZE:3379,MAX_VIEWPORT_DIMS:3386,SUBPIXEL_BITS:3408,RED_BITS:3410,GREEN_BITS:3411,BLUE_BITS:3412,ALPHA_BITS:3413,DEPTH_BITS:3414,STENCIL_BITS:3415,POLYGON_OFFSET_UNITS:10752,POLYGON_OFFSET_FACTOR:32824,TEXTURE_BINDING_2D:32873,SAMPLE_BUFFERS:32936,SAMPLES:32937,SAMPLE_COVERAGE_VALUE:32938,SAMPLE_COVERAGE_INVERT:32939,COMPRESSED_TEXTURE_FORMATS:34467,DONT_CARE:4352,FASTEST:4353,NICEST:4354,GENERATE_MIPMAP_HINT:33170,BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DEPTH_COMPONENT:6402,ALPHA:6406,RGB:6407,RGBA:6408,LUMINANCE:6409,LUMINANCE_ALPHA:6410,UNSIGNED_SHORT_4_4_4_4:32819,UNSIGNED_SHORT_5_5_5_1:32820,UNSIGNED_SHORT_5_6_5:33635,FRAGMENT_SHADER:35632,VERTEX_SHADER:35633,MAX_VERTEX_ATTRIBS:34921,MAX_VERTEX_UNIFORM_VECTORS:36347,MAX_VARYING_VECTORS:36348,MAX_COMBINED_TEXTURE_IMAGE_UNITS:35661,MAX_VERTEX_TEXTURE_IMAGE_UNITS:35660,MAX_TEXTURE_IMAGE_UNITS:34930,MAX_FRAGMENT_UNIFORM_VECTORS:36349,SHADER_TYPE:35663,DELETE_STATUS:35712,LINK_STATUS:35714,VALIDATE_STATUS:35715,ATTACHED_SHADERS:35717,ACTIVE_UNIFORMS:35718,ACTIVE_ATTRIBUTES:35721,SHADING_LANGUAGE_VERSION:35724,CURRENT_PROGRAM:35725,NEVER:512,LESS:513,EQUAL:514,LEQUAL:515,GREATER:516,NOTEQUAL:517,GEQUAL:518,ALWAYS:519,KEEP:7680,REPLACE:7681,INCR:7682,DECR:7683,INVERT:5386,INCR_WRAP:34055,DECR_WRAP:34056,VENDOR:7936,RENDERER:7937,VERSION:7938,NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987,TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,TEXTURE_2D:3553,TEXTURE:5890,TEXTURE_CUBE_MAP:34067,TEXTURE_BINDING_CUBE_MAP:34068,TEXTURE_CUBE_MAP_POSITIVE_X:34069,TEXTURE_CUBE_MAP_NEGATIVE_X:34070,TEXTURE_CUBE_MAP_POSITIVE_Y:34071,TEXTURE_CUBE_MAP_NEGATIVE_Y:34072,TEXTURE_CUBE_MAP_POSITIVE_Z:34073,TEXTURE_CUBE_MAP_NEGATIVE_Z:34074,MAX_CUBE_MAP_TEXTURE_SIZE:34076,TEXTURE0:33984,TEXTURE1:33985,TEXTURE2:33986,TEXTURE3:33987,TEXTURE4:33988,TEXTURE5:33989,TEXTURE6:33990,TEXTURE7:33991,TEXTURE8:33992,TEXTURE9:33993,TEXTURE10:33994,TEXTURE11:33995,TEXTURE12:33996,TEXTURE13:33997,TEXTURE14:33998,TEXTURE15:33999,TEXTURE16:34e3,TEXTURE17:34001,TEXTURE18:34002,TEXTURE19:34003,TEXTURE20:34004,TEXTURE21:34005,TEXTURE22:34006,TEXTURE23:34007,TEXTURE24:34008,TEXTURE25:34009,TEXTURE26:34010,TEXTURE27:34011,TEXTURE28:34012,TEXTURE29:34013,TEXTURE30:34014,TEXTURE31:34015,ACTIVE_TEXTURE:34016,REPEAT:10497,CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,INT_VEC2:35667,INT_VEC3:35668,INT_VEC4:35669,BOOL:35670,BOOL_VEC2:35671,BOOL_VEC3:35672,BOOL_VEC4:35673,FLOAT_MAT2:35674,FLOAT_MAT3:35675,FLOAT_MAT4:35676,SAMPLER_2D:35678,SAMPLER_CUBE:35680,VERTEX_ATTRIB_ARRAY_ENABLED:34338,VERTEX_ATTRIB_ARRAY_SIZE:34339,VERTEX_ATTRIB_ARRAY_STRIDE:34340,VERTEX_ATTRIB_ARRAY_TYPE:34341,VERTEX_ATTRIB_ARRAY_NORMALIZED:34922,VERTEX_ATTRIB_ARRAY_POINTER:34373,VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:34975,IMPLEMENTATION_COLOR_READ_TYPE:35738,IMPLEMENTATION_COLOR_READ_FORMAT:35739,COMPILE_STATUS:35713,LOW_FLOAT:36336,MEDIUM_FLOAT:36337,HIGH_FLOAT:36338,LOW_INT:36339,MEDIUM_INT:36340,HIGH_INT:36341,FRAMEBUFFER:36160,RENDERBUFFER:36161,RGBA4:32854,RGB5_A1:32855,RGB565:36194,DEPTH_COMPONENT16:33189,STENCIL_INDEX:6401,STENCIL_INDEX8:36168,DEPTH_STENCIL:34041,RENDERBUFFER_WIDTH:36162,RENDERBUFFER_HEIGHT:36163,RENDERBUFFER_INTERNAL_FORMAT:36164,RENDERBUFFER_RED_SIZE:36176,RENDERBUFFER_GREEN_SIZE:36177,RENDERBUFFER_BLUE_SIZE:36178,RENDERBUFFER_ALPHA_SIZE:36179,RENDERBUFFER_DEPTH_SIZE:36180,RENDERBUFFER_STENCIL_SIZE:36181,FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:36048,FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:36049,FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:36050,FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:36051,COLOR_ATTACHMENT0:36064,DEPTH_ATTACHMENT:36096,STENCIL_ATTACHMENT:36128,DEPTH_STENCIL_ATTACHMENT:33306,NONE:0,FRAMEBUFFER_COMPLETE:36053,FRAMEBUFFER_INCOMPLETE_ATTACHMENT:36054,FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:36055,FRAMEBUFFER_INCOMPLETE_DIMENSIONS:36057,FRAMEBUFFER_UNSUPPORTED:36061,FRAMEBUFFER_BINDING:36006,RENDERBUFFER_BINDING:36007,MAX_RENDERBUFFER_SIZE:34024,INVALID_FRAMEBUFFER_OPERATION:1286,UNPACK_FLIP_Y_WEBGL:37440,UNPACK_PREMULTIPLY_ALPHA_WEBGL:37441,CONTEXT_LOST_WEBGL:37442,UNPACK_COLORSPACE_CONVERSION_WEBGL:37443,BROWSER_DEFAULT_WEBGL:37444,COMPRESSED_RGB_S3TC_DXT1_EXT:33776,COMPRESSED_RGBA_S3TC_DXT1_EXT:33777,COMPRESSED_RGBA_S3TC_DXT3_EXT:33778,COMPRESSED_RGBA_S3TC_DXT5_EXT:33779,COMPRESSED_RGB_PVRTC_4BPPV1_IMG:35840,COMPRESSED_RGB_PVRTC_2BPPV1_IMG:35841,COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:35842,COMPRESSED_RGBA_PVRTC_2BPPV1_IMG:35843,COMPRESSED_RGBA_ASTC_4x4_WEBGL:37808,COMPRESSED_RGB_ETC1_WEBGL:36196,COMPRESSED_RGBA_BPTC_UNORM:36492,HALF_FLOAT_OES:36193,DOUBLE:5130,READ_BUFFER:3074,UNPACK_ROW_LENGTH:3314,UNPACK_SKIP_ROWS:3315,UNPACK_SKIP_PIXELS:3316,PACK_ROW_LENGTH:3330,PACK_SKIP_ROWS:3331,PACK_SKIP_PIXELS:3332,COLOR:6144,DEPTH:6145,STENCIL:6146,RED:6403,RGB8:32849,RGBA8:32856,RGB10_A2:32857,TEXTURE_BINDING_3D:32874,UNPACK_SKIP_IMAGES:32877,UNPACK_IMAGE_HEIGHT:32878,TEXTURE_3D:32879,TEXTURE_WRAP_R:32882,MAX_3D_TEXTURE_SIZE:32883,UNSIGNED_INT_2_10_10_10_REV:33640,MAX_ELEMENTS_VERTICES:33e3,MAX_ELEMENTS_INDICES:33001,TEXTURE_MIN_LOD:33082,TEXTURE_MAX_LOD:33083,TEXTURE_BASE_LEVEL:33084,TEXTURE_MAX_LEVEL:33085,MIN:32775,MAX:32776,DEPTH_COMPONENT24:33190,MAX_TEXTURE_LOD_BIAS:34045,TEXTURE_COMPARE_MODE:34892,TEXTURE_COMPARE_FUNC:34893,CURRENT_QUERY:34917,QUERY_RESULT:34918,QUERY_RESULT_AVAILABLE:34919,STREAM_READ:35041,STREAM_COPY:35042,STATIC_READ:35045,STATIC_COPY:35046,DYNAMIC_READ:35049,DYNAMIC_COPY:35050,MAX_DRAW_BUFFERS:34852,DRAW_BUFFER0:34853,DRAW_BUFFER1:34854,DRAW_BUFFER2:34855,DRAW_BUFFER3:34856,DRAW_BUFFER4:34857,DRAW_BUFFER5:34858,DRAW_BUFFER6:34859,DRAW_BUFFER7:34860,DRAW_BUFFER8:34861,DRAW_BUFFER9:34862,DRAW_BUFFER10:34863,DRAW_BUFFER11:34864,DRAW_BUFFER12:34865,DRAW_BUFFER13:34866,DRAW_BUFFER14:34867,DRAW_BUFFER15:34868,MAX_FRAGMENT_UNIFORM_COMPONENTS:35657,MAX_VERTEX_UNIFORM_COMPONENTS:35658,SAMPLER_3D:35679,SAMPLER_2D_SHADOW:35682,FRAGMENT_SHADER_DERIVATIVE_HINT:35723,PIXEL_PACK_BUFFER:35051,PIXEL_UNPACK_BUFFER:35052,PIXEL_PACK_BUFFER_BINDING:35053,PIXEL_UNPACK_BUFFER_BINDING:35055,FLOAT_MAT2x3:35685,FLOAT_MAT2x4:35686,FLOAT_MAT3x2:35687,FLOAT_MAT3x4:35688,FLOAT_MAT4x2:35689,FLOAT_MAT4x3:35690,SRGB:35904,SRGB8:35905,SRGB8_ALPHA8:35907,COMPARE_REF_TO_TEXTURE:34894,RGBA32F:34836,RGB32F:34837,RGBA16F:34842,RGB16F:34843,VERTEX_ATTRIB_ARRAY_INTEGER:35069,MAX_ARRAY_TEXTURE_LAYERS:35071,MIN_PROGRAM_TEXEL_OFFSET:35076,MAX_PROGRAM_TEXEL_OFFSET:35077,MAX_VARYING_COMPONENTS:35659,TEXTURE_2D_ARRAY:35866,TEXTURE_BINDING_2D_ARRAY:35869,R11F_G11F_B10F:35898,UNSIGNED_INT_10F_11F_11F_REV:35899,RGB9_E5:35901,UNSIGNED_INT_5_9_9_9_REV:35902,TRANSFORM_FEEDBACK_BUFFER_MODE:35967,MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS:35968,TRANSFORM_FEEDBACK_VARYINGS:35971,TRANSFORM_FEEDBACK_BUFFER_START:35972,TRANSFORM_FEEDBACK_BUFFER_SIZE:35973,TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:35976,RASTERIZER_DISCARD:35977,MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS:35978,MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS:35979,INTERLEAVED_ATTRIBS:35980,SEPARATE_ATTRIBS:35981,TRANSFORM_FEEDBACK_BUFFER:35982,TRANSFORM_FEEDBACK_BUFFER_BINDING:35983,RGBA32UI:36208,RGB32UI:36209,RGBA16UI:36214,RGB16UI:36215,RGBA8UI:36220,RGB8UI:36221,RGBA32I:36226,RGB32I:36227,RGBA16I:36232,RGB16I:36233,RGBA8I:36238,RGB8I:36239,RED_INTEGER:36244,RGB_INTEGER:36248,RGBA_INTEGER:36249,SAMPLER_2D_ARRAY:36289,SAMPLER_2D_ARRAY_SHADOW:36292,SAMPLER_CUBE_SHADOW:36293,UNSIGNED_INT_VEC2:36294,UNSIGNED_INT_VEC3:36295,UNSIGNED_INT_VEC4:36296,INT_SAMPLER_2D:36298,INT_SAMPLER_3D:36299,INT_SAMPLER_CUBE:36300,INT_SAMPLER_2D_ARRAY:36303,UNSIGNED_INT_SAMPLER_2D:36306,UNSIGNED_INT_SAMPLER_3D:36307,UNSIGNED_INT_SAMPLER_CUBE:36308,UNSIGNED_INT_SAMPLER_2D_ARRAY:36311,DEPTH_COMPONENT32F:36012,DEPTH32F_STENCIL8:36013,FLOAT_32_UNSIGNED_INT_24_8_REV:36269,FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING:33296,FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE:33297,FRAMEBUFFER_ATTACHMENT_RED_SIZE:33298,FRAMEBUFFER_ATTACHMENT_GREEN_SIZE:33299,FRAMEBUFFER_ATTACHMENT_BLUE_SIZE:33300,FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE:33301,FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE:33302,FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE:33303,FRAMEBUFFER_DEFAULT:33304,UNSIGNED_INT_24_8:34042,DEPTH24_STENCIL8:35056,UNSIGNED_NORMALIZED:35863,DRAW_FRAMEBUFFER_BINDING:36006,READ_FRAMEBUFFER:36008,DRAW_FRAMEBUFFER:36009,READ_FRAMEBUFFER_BINDING:36010,RENDERBUFFER_SAMPLES:36011,FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER:36052,MAX_COLOR_ATTACHMENTS:36063,COLOR_ATTACHMENT1:36065,COLOR_ATTACHMENT2:36066,COLOR_ATTACHMENT3:36067,COLOR_ATTACHMENT4:36068,COLOR_ATTACHMENT5:36069,COLOR_ATTACHMENT6:36070,COLOR_ATTACHMENT7:36071,COLOR_ATTACHMENT8:36072,COLOR_ATTACHMENT9:36073,COLOR_ATTACHMENT10:36074,COLOR_ATTACHMENT11:36075,COLOR_ATTACHMENT12:36076,COLOR_ATTACHMENT13:36077,COLOR_ATTACHMENT14:36078,COLOR_ATTACHMENT15:36079,FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:36182,MAX_SAMPLES:36183,HALF_FLOAT:5131,RG:33319,RG_INTEGER:33320,R8:33321,RG8:33323,R16F:33325,R32F:33326,RG16F:33327,RG32F:33328,R8I:33329,R8UI:33330,R16I:33331,R16UI:33332,R32I:33333,R32UI:33334,RG8I:33335,RG8UI:33336,RG16I:33337,RG16UI:33338,RG32I:33339,RG32UI:33340,VERTEX_ARRAY_BINDING:34229,R8_SNORM:36756,RG8_SNORM:36757,RGB8_SNORM:36758,RGBA8_SNORM:36759,SIGNED_NORMALIZED:36764,COPY_READ_BUFFER:36662,COPY_WRITE_BUFFER:36663,COPY_READ_BUFFER_BINDING:36662,COPY_WRITE_BUFFER_BINDING:36663,UNIFORM_BUFFER:35345,UNIFORM_BUFFER_BINDING:35368,UNIFORM_BUFFER_START:35369,UNIFORM_BUFFER_SIZE:35370,MAX_VERTEX_UNIFORM_BLOCKS:35371,MAX_FRAGMENT_UNIFORM_BLOCKS:35373,MAX_COMBINED_UNIFORM_BLOCKS:35374,MAX_UNIFORM_BUFFER_BINDINGS:35375,MAX_UNIFORM_BLOCK_SIZE:35376,MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS:35377,MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS:35379,UNIFORM_BUFFER_OFFSET_ALIGNMENT:35380,ACTIVE_UNIFORM_BLOCKS:35382,UNIFORM_TYPE:35383,UNIFORM_SIZE:35384,UNIFORM_BLOCK_INDEX:35386,UNIFORM_OFFSET:35387,UNIFORM_ARRAY_STRIDE:35388,UNIFORM_MATRIX_STRIDE:35389,UNIFORM_IS_ROW_MAJOR:35390,UNIFORM_BLOCK_BINDING:35391,UNIFORM_BLOCK_DATA_SIZE:35392,UNIFORM_BLOCK_ACTIVE_UNIFORMS:35394,UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES:35395,UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER:35396,UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER:35398,INVALID_INDEX:4294967295,MAX_VERTEX_OUTPUT_COMPONENTS:37154,MAX_FRAGMENT_INPUT_COMPONENTS:37157,MAX_SERVER_WAIT_TIMEOUT:37137,OBJECT_TYPE:37138,SYNC_CONDITION:37139,SYNC_STATUS:37140,SYNC_FLAGS:37141,SYNC_FENCE:37142,SYNC_GPU_COMMANDS_COMPLETE:37143,UNSIGNALED:37144,SIGNALED:37145,ALREADY_SIGNALED:37146,TIMEOUT_EXPIRED:37147,CONDITION_SATISFIED:37148,WAIT_FAILED:37149,SYNC_FLUSH_COMMANDS_BIT:1,VERTEX_ATTRIB_ARRAY_DIVISOR:35070,ANY_SAMPLES_PASSED:35887,ANY_SAMPLES_PASSED_CONSERVATIVE:36202,SAMPLER_BINDING:35097,RGB10_A2UI:36975,INT_2_10_10_10_REV:36255,TRANSFORM_FEEDBACK:36386,TRANSFORM_FEEDBACK_PAUSED:36387,TRANSFORM_FEEDBACK_ACTIVE:36388,TRANSFORM_FEEDBACK_BINDING:36389,COMPRESSED_R11_EAC:37488,COMPRESSED_SIGNED_R11_EAC:37489,COMPRESSED_RG11_EAC:37490,COMPRESSED_SIGNED_RG11_EAC:37491,COMPRESSED_RGB8_ETC2:37492,COMPRESSED_SRGB8_ETC2:37493,COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:37494,COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:37495,COMPRESSED_RGBA8_ETC2_EAC:37496,COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:37497,TEXTURE_IMMUTABLE_FORMAT:37167,MAX_ELEMENT_INDEX:36203,TEXTURE_IMMUTABLE_LEVELS:33503,MAX_TEXTURE_MAX_ANISOTROPY_EXT:34047},J=Object.freeze(b7),T7=new d;function Qe(e){this._size=e.size,this._datatype=e.datatype,this.getValue=e.getValue}const Pr={};Pr[J.FLOAT]="float";Pr[J.FLOAT_VEC2]="vec2";Pr[J.FLOAT_VEC3]="vec3";Pr[J.FLOAT_VEC4]="vec4";Pr[J.INT]="int";Pr[J.INT_VEC2]="ivec2";Pr[J.INT_VEC3]="ivec3";Pr[J.INT_VEC4]="ivec4";Pr[J.BOOL]="bool";Pr[J.BOOL_VEC2]="bvec2";Pr[J.BOOL_VEC3]="bvec3";Pr[J.BOOL_VEC4]="bvec4";Pr[J.FLOAT_MAT2]="mat2";Pr[J.FLOAT_MAT3]="mat3";Pr[J.FLOAT_MAT4]="mat4";Pr[J.SAMPLER_2D]="sampler2D";Pr[J.SAMPLER_CUBE]="samplerCube";Qe.prototype.getDeclaration=function(e){let t=`uniform ${Pr[this._datatype]} ${e}`;const n=this._size;return n===1?t+=";":t+=`[${n.toString()}];`,t};const A7={czm_viewport:new Qe({size:1,datatype:J.FLOAT_VEC4,getValue:function(e){return e.viewportCartesian4}}),czm_viewportOrthographic:new Qe({size:1,datatype:J.FLOAT_MAT4,getValue:function(e){return e.viewportOrthographic}}),czm_viewportTransformation:new Qe({size:1,datatype:J.FLOAT_MAT4,getValue:function(e){return e.viewportTransformation}}),czm_globeDepthTexture:new Qe({size:1,datatype:J.SAMPLER_2D,getValue:function(e){return e.globeDepthTexture}}),czm_model:new Qe({size:1,datatype:J.FLOAT_MAT4,getValue:function(e){return e.model}}),czm_inverseModel:new Qe({size:1,datatype:J.FLOAT_MAT4,getValue:function(e){return e.inverseModel}}),czm_view:new Qe({size:1,datatype:J.FLOAT_MAT4,getValue:function(e){return e.view}}),czm_view3D:new Qe({size:1,datatype:J.FLOAT_MAT4,getValue:function(e){return e.view3D}}),czm_viewRotation:new Qe({size:1,datatype:J.FLOAT_MAT3,getValue:function(e){return e.viewRotation}}),czm_viewRotation3D:new Qe({size:1,datatype:J.FLOAT_MAT3,getValue:function(e){return e.viewRotation3D}}),czm_inverseView:new Qe({size:1,datatype:J.FLOAT_MAT4,getValue:function(e){return e.inverseView}}),czm_inverseView3D:new Qe({size:1,datatype:J.FLOAT_MAT4,getValue:function(e){return e.inverseView3D}}),czm_inverseViewRotation:new Qe({size:1,datatype:J.FLOAT_MAT3,getValue:function(e){return e.inverseViewRotation}}),czm_inverseViewRotation3D:new Qe({size:1,datatype:J.FLOAT_MAT3,getValue:function(e){return e.inverseViewRotation3D}}),czm_projection:new Qe({size:1,datatype:J.FLOAT_MAT4,getValue:function(e){return e.projection}}),czm_inverseProjection:new Qe({size:1,datatype:J.FLOAT_MAT4,getValue:function(e){return e.inverseProjection}}),czm_infiniteProjection:new Qe({size:1,datatype:J.FLOAT_MAT4,getValue:function(e){return e.infiniteProjection}}),czm_modelView:new Qe({size:1,datatype:J.FLOAT_MAT4,getValue:function(e){return e.modelView}}),czm_modelView3D:new Qe({size:1,datatype:J.FLOAT_MAT4,getValue:function(e){return e.modelView3D}}),czm_modelViewRelativeToEye:new Qe({size:1,datatype:J.FLOAT_MAT4,getValue:function(e){return e.modelViewRelativeToEye}}),czm_inverseModelView:new Qe({size:1,datatype:J.FLOAT_MAT4,getValue:function(e){return e.inverseModelView}}),czm_inverseModelView3D:new Qe({size:1,datatype:J.FLOAT_MAT4,getValue:function(e){return e.inverseModelView3D}}),czm_viewProjection:new Qe({size:1,datatype:J.FLOAT_MAT4,getValue:function(e){return e.viewProjection}}),czm_inverseViewProjection:new Qe({size:1,datatype:J.FLOAT_MAT4,getValue:function(e){return e.inverseViewProjection}}),czm_modelViewProjection:new Qe({size:1,datatype:J.FLOAT_MAT4,getValue:function(e){return e.modelViewProjection}}),czm_inverseModelViewProjection:new Qe({size:1,datatype:J.FLOAT_MAT4,getValue:function(e){return e.inverseModelViewProjection}}),czm_modelViewProjectionRelativeToEye:new Qe({size:1,datatype:J.FLOAT_MAT4,getValue:function(e){return e.modelViewProjectionRelativeToEye}}),czm_modelViewInfiniteProjection:new Qe({size:1,datatype:J.FLOAT_MAT4,getValue:function(e){return e.modelViewInfiniteProjection}}),czm_orthographicIn3D:new Qe({size:1,datatype:J.FLOAT,getValue:function(e){return e.orthographicIn3D?1:0}}),czm_normal:new Qe({size:1,datatype:J.FLOAT_MAT3,getValue:function(e){return e.normal}}),czm_normal3D:new Qe({size:1,datatype:J.FLOAT_MAT3,getValue:function(e){return e.normal3D}}),czm_inverseNormal:new Qe({size:1,datatype:J.FLOAT_MAT3,getValue:function(e){return e.inverseNormal}}),czm_inverseNormal3D:new Qe({size:1,datatype:J.FLOAT_MAT3,getValue:function(e){return e.inverseNormal3D}}),czm_eyeHeight:new Qe({size:1,datatype:J.FLOAT,getValue:function(e){return e.eyeHeight}}),czm_eyeHeight2D:new Qe({size:1,datatype:J.FLOAT_VEC2,getValue:function(e){return e.eyeHeight2D}}),czm_eyeEllipsoidNormalEC:new Qe({size:1,datatype:J.FLOAT_VEC3,getValue:function(e){return e.eyeEllipsoidNormalEC}}),czm_eyeEllipsoidCurvature:new Qe({size:1,datatype:J.FLOAT_VEC2,getValue:function(e){return e.eyeEllipsoidCurvature}}),czm_modelToEnu:new Qe({size:1,datatype:J.FLOAT_MAT4,getValue:function(e){return e.modelToEnu}}),czm_enuToModel:new Qe({size:1,datatype:J.FLOAT_MAT4,getValue:function(e){return e.enuToModel}}),czm_entireFrustum:new Qe({size:1,datatype:J.FLOAT_VEC2,getValue:function(e){return e.entireFrustum}}),czm_currentFrustum:new Qe({size:1,datatype:J.FLOAT_VEC2,getValue:function(e){return e.currentFrustum}}),czm_frustumPlanes:new Qe({size:1,datatype:J.FLOAT_VEC4,getValue:function(e){return e.frustumPlanes}}),czm_farDepthFromNearPlusOne:new Qe({size:1,datatype:J.FLOAT,getValue:function(e){return e.farDepthFromNearPlusOne}}),czm_log2FarDepthFromNearPlusOne:new Qe({size:1,datatype:J.FLOAT,getValue:function(e){return e.log2FarDepthFromNearPlusOne}}),czm_oneOverLog2FarDepthFromNearPlusOne:new Qe({size:1,datatype:J.FLOAT,getValue:function(e){return e.oneOverLog2FarDepthFromNearPlusOne}}),czm_sunPositionWC:new Qe({size:1,datatype:J.FLOAT_VEC3,getValue:function(e){return e.sunPositionWC}}),czm_sunPositionColumbusView:new Qe({size:1,datatype:J.FLOAT_VEC3,getValue:function(e){return e.sunPositionColumbusView}}),czm_sunDirectionEC:new Qe({size:1,datatype:J.FLOAT_VEC3,getValue:function(e){return e.sunDirectionEC}}),czm_sunDirectionWC:new Qe({size:1,datatype:J.FLOAT_VEC3,getValue:function(e){return e.sunDirectionWC}}),czm_moonDirectionEC:new Qe({size:1,datatype:J.FLOAT_VEC3,getValue:function(e){return e.moonDirectionEC}}),czm_lightDirectionEC:new Qe({size:1,datatype:J.FLOAT_VEC3,getValue:function(e){return e.lightDirectionEC}}),czm_lightDirectionWC:new Qe({size:1,datatype:J.FLOAT_VEC3,getValue:function(e){return e.lightDirectionWC}}),czm_lightColor:new Qe({size:1,datatype:J.FLOAT_VEC3,getValue:function(e){return e.lightColor}}),czm_lightColorHdr:new Qe({size:1,datatype:J.FLOAT_VEC3,getValue:function(e){return e.lightColorHdr}}),czm_encodedCameraPositionMCHigh:new Qe({size:1,datatype:J.FLOAT_VEC3,getValue:function(e){return e.encodedCameraPositionMCHigh}}),czm_encodedCameraPositionMCLow:new Qe({size:1,datatype:J.FLOAT_VEC3,getValue:function(e){return e.encodedCameraPositionMCLow}}),czm_viewerPositionWC:new Qe({size:1,datatype:J.FLOAT_VEC3,getValue:function(e){return L.getTranslation(e.inverseView,T7)}}),czm_frameNumber:new Qe({size:1,datatype:J.FLOAT,getValue:function(e){return e.frameState.frameNumber}}),czm_morphTime:new Qe({size:1,datatype:J.FLOAT,getValue:function(e){return e.frameState.morphTime}}),czm_sceneMode:new Qe({size:1,datatype:J.FLOAT,getValue:function(e){return e.frameState.mode}}),czm_pass:new Qe({size:1,datatype:J.FLOAT,getValue:function(e){return e.pass}}),czm_backgroundColor:new Qe({size:1,datatype:J.FLOAT_VEC4,getValue:function(e){return e.backgroundColor}}),czm_brdfLut:new Qe({size:1,datatype:J.SAMPLER_2D,getValue:function(e){return e.brdfLut}}),czm_environmentMap:new Qe({size:1,datatype:J.SAMPLER_CUBE,getValue:function(e){return e.environmentMap}}),czm_specularEnvironmentMaps:new Qe({size:1,datatype:J.SAMPLER_2D,getValue:function(e){return e.specularEnvironmentMaps}}),czm_specularEnvironmentMapSize:new Qe({size:1,datatype:J.FLOAT_VEC2,getValue:function(e){return e.specularEnvironmentMapsDimensions}}),czm_specularEnvironmentMapsMaximumLOD:new Qe({size:1,datatype:J.FLOAT,getValue:function(e){return e.specularEnvironmentMapsMaximumLOD}}),czm_sphericalHarmonicCoefficients:new Qe({size:9,datatype:J.FLOAT_VEC3,getValue:function(e){return e.sphericalHarmonicCoefficients}}),czm_temeToPseudoFixed:new Qe({size:1,datatype:J.FLOAT_MAT3,getValue:function(e){return e.temeToPseudoFixedMatrix}}),czm_pixelRatio:new Qe({size:1,datatype:J.FLOAT,getValue:function(e){return e.pixelRatio}}),czm_fogDensity:new Qe({size:1,datatype:J.FLOAT,getValue:function(e){return e.fogDensity}}),czm_fogMinimumBrightness:new Qe({size:1,datatype:J.FLOAT,getValue:function(e){return e.fogMinimumBrightness}}),czm_atmosphereHsbShift:new Qe({size:1,datatype:J.FLOAT_VEC3,getValue:function(e){return e.atmosphereHsbShift}}),czm_atmosphereLightIntensity:new Qe({size:1,datatype:J.FLOAT,getValue:function(e){return e.atmosphereLightIntensity}}),czm_atmosphereRayleighCoefficient:new Qe({size:1,datatype:J.FLOAT_VEC3,getValue:function(e){return e.atmosphereRayleighCoefficient}}),czm_atmosphereRayleighScaleHeight:new Qe({size:1,datatype:J.FLOAT,getValue:function(e){return e.atmosphereRayleighScaleHeight}}),czm_atmosphereMieCoefficient:new Qe({size:1,datatype:J.FLOAT_VEC3,getValue:function(e){return e.atmosphereMieCoefficient}}),czm_atmosphereMieScaleHeight:new Qe({size:1,datatype:J.FLOAT,getValue:function(e){return e.atmosphereMieScaleHeight}}),czm_atmosphereMieAnisotropy:new Qe({size:1,datatype:J.FLOAT,getValue:function(e){return e.atmosphereMieAnisotropy}}),czm_atmosphereDynamicLighting:new Qe({size:1,datatype:J.FLOAT,getValue:function(e){return e.atmosphereDynamicLighting}}),czm_splitPosition:new Qe({size:1,datatype:J.FLOAT,getValue:function(e){return e.splitPosition}}),czm_geometricToleranceOverMeter:new Qe({size:1,datatype:J.FLOAT,getValue:function(e){return e.geometricToleranceOverMeter}}),czm_minimumDisableDepthTestDistance:new Qe({size:1,datatype:J.FLOAT,getValue:function(e){return e.minimumDisableDepthTestDistance}}),czm_invertClassificationColor:new Qe({size:1,datatype:J.FLOAT_VEC4,getValue:function(e){return e.invertClassificationColor}}),czm_gamma:new Qe({size:1,datatype:J.FLOAT,getValue:function(e){return e.gamma}}),czm_ellipsoidRadii:new Qe({size:1,datatype:J.FLOAT_VEC3,getValue:function(e){return e.ellipsoid.radii}}),czm_ellipsoidInverseRadii:new Qe({size:1,datatype:J.FLOAT_VEC3,getValue:function(e){return e.ellipsoid.oneOverRadii}})},DA=A7;function Wr(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function x7(){return!0}function ve(e,t){t=y(t,"This object was destroyed, i.e., destroy() was called.");function n(){throw new E(t)}for(const i in e)typeof e[i]=="function"&&(e[i]=n);e.isDestroyed=x7}const or={UNSIGNED_BYTE:J.UNSIGNED_BYTE,UNSIGNED_SHORT:J.UNSIGNED_SHORT,UNSIGNED_INT:J.UNSIGNED_INT};or.getSizeInBytes=function(e){switch(e){case or.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case or.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case or.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT}throw new E("indexDatatype is required and must be a valid IndexDatatype constant.")};or.fromSizeInBytes=function(e){switch(e){case 2:return or.UNSIGNED_SHORT;case 4:return or.UNSIGNED_INT;case 1:return or.UNSIGNED_BYTE;default:throw new E("Size in bytes cannot be mapped to an IndexDatatype")}};or.validate=function(e){return c(e)&&(e===or.UNSIGNED_BYTE||e===or.UNSIGNED_SHORT||e===or.UNSIGNED_INT)};or.createTypedArray=function(e,t){if(!c(e))throw new E("numberOfVertices is required.");return e>=R.SIXTY_FOUR_KILOBYTES?new Uint32Array(t):new Uint16Array(t)};or.createTypedArrayFromArrayBuffer=function(e,t,n,i){if(!c(e))throw new E("numberOfVertices is required.");if(!c(t))throw new E("sourceArray is required.");if(!c(n))throw new E("byteOffset is required.");return e>=R.SIXTY_FOUR_KILOBYTES?new Uint32Array(t,n,i):new Uint16Array(t,n,i)};or.fromTypedArray=function(e){if(e instanceof Uint8Array)return or.UNSIGNED_BYTE;if(e instanceof Uint16Array)return or.UNSIGNED_SHORT;if(e instanceof Uint32Array)return or.UNSIGNED_INT;throw new E("array must be a Uint8Array, Uint16Array, or Uint32Array.")};const je=Object.freeze(or),PA={STREAM_DRAW:J.STREAM_DRAW,STATIC_DRAW:J.STATIC_DRAW,DYNAMIC_DRAW:J.DYNAMIC_DRAW,validate:function(e){return e===PA.STREAM_DRAW||e===PA.STATIC_DRAW||e===PA.DYNAMIC_DRAW}},ke=Object.freeze(PA);function ct(e){if(e=y(e,y.EMPTY_OBJECT),A.defined("options.context",e.context),!c(e.typedArray)&&!c(e.sizeInBytes))throw new E("Either options.sizeInBytes or options.typedArray is required.");if(c(e.typedArray)&&c(e.sizeInBytes))throw new E("Cannot pass in both options.sizeInBytes and options.typedArray.");if(c(e.typedArray)&&(A.typeOf.object("options.typedArray",e.typedArray),A.typeOf.number("options.typedArray.byteLength",e.typedArray.byteLength)),!ke.validate(e.usage))throw new E("usage is invalid.");const t=e.context._gl,n=e.bufferTarget,i=e.typedArray;let o=e.sizeInBytes;const r=e.usage,s=c(i);s&&(o=i.byteLength),A.typeOf.number.greaterThan("sizeInBytes",o,0);const a=t.createBuffer();t.bindBuffer(n,a),t.bufferData(n,s?i:o,r),t.bindBuffer(n,null),this._id=Wr(),this._gl=t,this._webgl2=e.context._webgl2,this._bufferTarget=n,this._sizeInBytes=o,this._usage=r,this._buffer=a,this.vertexArrayDestroyable=!0}ct.createVertexBuffer=function(e){return A.defined("options.context",e.context),new ct({context:e.context,bufferTarget:J.ARRAY_BUFFER,typedArray:e.typedArray,sizeInBytes:e.sizeInBytes,usage:e.usage})};ct.createIndexBuffer=function(e){if(A.defined("options.context",e.context),!je.validate(e.indexDatatype))throw new E("Invalid indexDatatype.");if(e.indexDatatype===je.UNSIGNED_INT&&!e.context.elementIndexUint)throw new E("IndexDatatype.UNSIGNED_INT requires OES_element_index_uint, which is not supported on this system. Check context.elementIndexUint.");const t=e.context,n=e.indexDatatype,i=je.getSizeInBytes(n),o=new ct({context:t,bufferTarget:J.ELEMENT_ARRAY_BUFFER,typedArray:e.typedArray,sizeInBytes:e.sizeInBytes,usage:e.usage}),r=o.sizeInBytes/i;return Object.defineProperties(o,{indexDatatype:{get:function(){return n}},bytesPerIndex:{get:function(){return i}},numberOfIndices:{get:function(){return r}}}),o};Object.defineProperties(ct.prototype,{sizeInBytes:{get:function(){return this._sizeInBytes}},usage:{get:function(){return this._usage}}});ct.prototype._getBuffer=function(){return this._buffer};ct.prototype.copyFromArrayView=function(e,t){t=y(t,0),A.defined("arrayView",e),A.typeOf.number.lessThanOrEquals("offsetInBytes + arrayView.byteLength",t+e.byteLength,this._sizeInBytes);const n=this._gl,i=this._bufferTarget;n.bindBuffer(i,this._buffer),n.bufferSubData(i,t,e),n.bindBuffer(i,null)};ct.prototype.copyFromBuffer=function(e,t,n,i){if(!this._webgl2)throw new E("A WebGL 2 context is required.");if(!c(e))throw new E("readBuffer must be defined.");if(!c(i)||i<=0)throw new E("sizeInBytes must be defined and be greater than zero.");if(!c(t)||t<0||t+i>e._sizeInBytes)throw new E("readOffset must be greater than or equal to zero and readOffset + sizeInBytes must be less than of equal to readBuffer.sizeInBytes.");if(!c(n)||n<0||n+i>this._sizeInBytes)throw new E("writeOffset must be greater than or equal to zero and writeOffset + sizeInBytes must be less than of equal to this.sizeInBytes.");if(this._buffer===e._buffer&&(n>=t&&n<t+i||t>n&&t<n+i))throw new E("When readBuffer is equal to this, the ranges [readOffset + sizeInBytes) and [writeOffset, writeOffset + sizeInBytes) must not overlap.");if(this._bufferTarget===J.ELEMENT_ARRAY_BUFFER&&e._bufferTarget!==J.ELEMENT_ARRAY_BUFFER||this._bufferTarget!==J.ELEMENT_ARRAY_BUFFER&&e._bufferTarget===J.ELEMENT_ARRAY_BUFFER)throw new E("Can not copy an index buffer into another buffer type.");const o=J.COPY_READ_BUFFER,r=J.COPY_WRITE_BUFFER,s=this._gl;s.bindBuffer(r,this._buffer),s.bindBuffer(o,e._buffer),s.copyBufferSubData(o,r,t,n,i),s.bindBuffer(r,null),s.bindBuffer(o,null)};ct.prototype.getBufferData=function(e,t,n,i){if(t=y(t,0),n=y(n,0),!this._webgl2)throw new E("A WebGL 2 context is required.");if(!c(e))throw new E("arrayView is required.");let o,r,s=e.byteLength;if(c(i)?(o=i,c(s)?r=1:(s=e.length,r=e.BYTES_PER_ELEMENT)):c(s)?(o=s-n,r=1):(s=e.length,o=s-n,r=e.BYTES_PER_ELEMENT),n<0||n>s)throw new E("destinationOffset must be greater than zero and less than the arrayView length.");if(n+o>s)throw new E("destinationOffset + length must be less than or equal to the arrayViewLength.");if(t<0||t>this._sizeInBytes)throw new E("sourceOffset must be greater than zero and less than the buffers size.");if(t+o*r>this._sizeInBytes)throw new E("sourceOffset + length must be less than the buffers size.");const a=this._gl,l=J.COPY_READ_BUFFER;a.bindBuffer(l,this._buffer),a.getBufferSubData(l,t,e,n,i),a.bindBuffer(l,null)};ct.prototype.isDestroyed=function(){return!1};ct.prototype.destroy=function(){return this._gl.deleteBuffer(this._buffer),ve(this)};let Nd;const no={requestFullscreen:void 0,exitFullscreen:void 0,fullscreenEnabled:void 0,fullscreenElement:void 0,fullscreenchange:void 0,fullscreenerror:void 0},ta={};Object.defineProperties(ta,{element:{get:function(){if(!!ta.supportsFullscreen())return document[no.fullscreenElement]}},changeEventName:{get:function(){if(!!ta.supportsFullscreen())return no.fullscreenchange}},errorEventName:{get:function(){if(!!ta.supportsFullscreen())return no.fullscreenerror}},enabled:{get:function(){if(!!ta.supportsFullscreen())return document[no.fullscreenEnabled]}},fullscreen:{get:function(){if(!!ta.supportsFullscreen())return ta.element!==null}}});ta.supportsFullscreen=function(){if(c(Nd))return Nd;Nd=!1;const e=document.body;if(typeof e.requestFullscreen=="function")return no.requestFullscreen="requestFullscreen",no.exitFullscreen="exitFullscreen",no.fullscreenEnabled="fullscreenEnabled",no.fullscreenElement="fullscreenElement",no.fullscreenchange="fullscreenchange",no.fullscreenerror="fullscreenerror",Nd=!0,Nd;const t=["webkit","moz","o","ms","khtml"];let n;for(let i=0,o=t.length;i<o;++i){const r=t[i];n=`${r}RequestFullscreen`,typeof e[n]=="function"?(no.requestFullscreen=n,Nd=!0):(n=`${r}RequestFullScreen`,typeof e[n]=="function"&&(no.requestFullscreen=n,Nd=!0)),n=`${r}ExitFullscreen`,typeof document[n]=="function"?no.exitFullscreen=n:(n=`${r}CancelFullScreen`,typeof document[n]=="function"&&(no.exitFullscreen=n)),n=`${r}FullscreenEnabled`,document[n]!==void 0?no.fullscreenEnabled=n:(n=`${r}FullScreenEnabled`,document[n]!==void 0&&(no.fullscreenEnabled=n)),n=`${r}FullscreenElement`,document[n]!==void 0?no.fullscreenElement=n:(n=`${r}FullScreenElement`,document[n]!==void 0&&(no.fullscreenElement=n)),n=`${r}fullscreenchange`,document[`on${n}`]!==void 0&&(r==="ms"&&(n="MSFullscreenChange"),no.fullscreenchange=n),n=`${r}fullscreenerror`,document[`on${n}`]!==void 0&&(r==="ms"&&(n="MSFullscreenError"),no.fullscreenerror=n)}return Nd};ta.requestFullscreen=function(e,t){!ta.supportsFullscreen()||e[no.requestFullscreen]({vrDisplay:t})};ta.exitFullscreen=function(){!ta.supportsFullscreen()||document[no.exitFullscreen]()};ta._names=no;const Tr=ta;let ps;typeof navigator<"u"?ps=navigator:ps={};function cp(e){const t=e.split(".");for(let n=0,i=t.length;n<i;++n)t[n]=parseInt(t[n],10);return t}let Eb,oU;function _P(){if(!c(Eb)&&(Eb=!1,!pC())){const e=/ Chrome\/([\.0-9]+)/.exec(ps.userAgent);e!==null&&(Eb=!0,oU=cp(e[1]))}return Eb}function C7(){return _P()&&oU}let wb,rU;function sU(){if(!c(wb)&&(wb=!1,!_P()&&!pC()&&/ Safari\/[\.0-9]+/.test(ps.userAgent))){const e=/ Version\/([\.0-9]+)/.exec(ps.userAgent);e!==null&&(wb=!0,rU=cp(e[1]))}return wb}function E7(){return sU()&&rU}let Sb,fI;function aU(){if(!c(Sb)){Sb=!1;const e=/ AppleWebKit\/([\.0-9]+)(\+?)/.exec(ps.userAgent);e!==null&&(Sb=!0,fI=cp(e[1]),fI.isNightly=!!e[2])}return Sb}function w7(){return aU()&&fI}let fg,pI;function cU(){if(!c(fg)){fg=!1;let e;ps.appName==="Microsoft Internet Explorer"?(e=/MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(ps.userAgent),e!==null&&(fg=!0,pI=cp(e[1]))):ps.appName==="Netscape"&&(e=/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(ps.userAgent),e!==null&&(fg=!0,pI=cp(e[1])))}return fg}function S7(){return cU()&&pI}let vb,lU;function pC(){if(!c(vb)){vb=!1;const e=/ Edg\/([\.0-9]+)/.exec(ps.userAgent);e!==null&&(vb=!0,lU=cp(e[1]))}return vb}function v7(){return pC()&&lU}let Ib,gP;function mC(){if(!c(Ib)){Ib=!1;const e=/Firefox\/([\.0-9]+)/.exec(ps.userAgent);e!==null&&(Ib=!0,gP=cp(e[1]))}return Ib}let NE;function I7(){return c(NE)||(NE=/Windows/i.test(ps.appVersion)),NE}let ME;function D7(){return c(ME)||(ME=navigator.platform==="iPhone"||navigator.platform==="iPod"||navigator.platform==="iPad"),ME}function P7(){return mC()&&gP}let FE;function O7(){return c(FE)||(FE=!mC()&&typeof PointerEvent<"u"&&(!c(ps.pointerEnabled)||ps.pointerEnabled)),FE}let uU,Db;function dU(){if(!c(Db)){const e=document.createElement("canvas");e.setAttribute("style","image-rendering: -moz-crisp-edges;image-rendering: pixelated;");const t=e.style.imageRendering;Db=c(t)&&t!=="",Db&&(uU=t)}return Db}function L7(){return dU()?uU:void 0}function os(){if(!os.initialized)throw new E("You must call FeatureDetection.supportsWebP.initialize and wait for the promise to resolve before calling FeatureDetection.supportsWebP");return os._result}os._promise=void 0;os._result=void 0;os.initialize=function(){return c(os._promise)||(os._promise=new Promise(e=>{const t=new Image;t.onload=function(){os._result=t.width>0&&t.height>0,e(os._result)},t.onerror=function(){os._result=!1,e(os._result)},t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA"})),os._promise};Object.defineProperties(os,{initialized:{get:function(){return c(os._result)}}});const Nm=[];typeof ArrayBuffer<"u"&&(Nm.push(Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array),typeof Uint8ClampedArray<"u"&&Nm.push(Uint8ClampedArray),typeof Uint8ClampedArray<"u"&&Nm.push(Uint8ClampedArray),typeof BigInt64Array<"u"&&Nm.push(BigInt64Array),typeof BigUint64Array<"u"&&Nm.push(BigUint64Array));const Cc={isChrome:_P,chromeVersion:C7,isSafari:sU,safariVersion:E7,isWebkit:aU,webkitVersion:w7,isInternetExplorer:cU,internetExplorerVersion:S7,isEdge:pC,edgeVersion:v7,isFirefox:mC,firefoxVersion:P7,isWindows:I7,isIPadOrIOS:D7,hardwareConcurrency:y(ps.hardwareConcurrency,3),supportsPointerEvents:O7,supportsImageRenderingPixelated:dU,supportsWebP:os,imageRenderingValue:L7,typedArrayTypes:Nm};Cc.supportsBasis=function(e){return Cc.supportsWebAssembly()&&e.context.supportsBasis};Cc.supportsFullscreen=function(){return Tr.supportsFullscreen()};Cc.supportsTypedArrays=function(){return typeof ArrayBuffer<"u"};Cc.supportsBigInt64Array=function(){return typeof BigInt64Array<"u"};Cc.supportsBigUint64Array=function(){return typeof BigUint64Array<"u"};Cc.supportsBigInt=function(){return typeof BigInt<"u"};Cc.supportsWebWorkers=function(){return typeof Worker<"u"};Cc.supportsWebAssembly=function(){return typeof WebAssembly<"u"};Cc.supportsWebgl2=function(e){return A.defined("scene",e),e.context.webgl2};Cc.supportsEsmWebWorkers=function(){return!mC()||parseInt(gP)>=114};const Yt=Cc;function BE(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n*6<1?e+(t-e)*6*n:n*2<1?t:n*3<2?e+(t-e)*(2/3-n)*6:e}function z(e,t,n,i){this.red=y(e,1),this.green=y(t,1),this.blue=y(n,1),this.alpha=y(i,1)}z.fromCartesian4=function(e,t){return A.typeOf.object("cartesian",e),c(t)?(t.red=e.x,t.green=e.y,t.blue=e.z,t.alpha=e.w,t):new z(e.x,e.y,e.z,e.w)};z.fromBytes=function(e,t,n,i,o){return e=z.byteToFloat(y(e,255)),t=z.byteToFloat(y(t,255)),n=z.byteToFloat(y(n,255)),i=z.byteToFloat(y(i,255)),c(o)?(o.red=e,o.green=t,o.blue=n,o.alpha=i,o):new z(e,t,n,i)};z.fromAlpha=function(e,t,n){return A.typeOf.object("color",e),A.typeOf.number("alpha",t),c(n)?(n.red=e.red,n.green=e.green,n.blue=e.blue,n.alpha=t,n):new z(e.red,e.green,e.blue,t)};let zE,yP,Wu;Yt.supportsTypedArrays()&&(zE=new ArrayBuffer(4),yP=new Uint32Array(zE),Wu=new Uint8Array(zE));z.fromRgba=function(e,t){return yP[0]=e,z.fromBytes(Wu[0],Wu[1],Wu[2],Wu[3],t)};z.fromHsl=function(e,t,n,i,o){e=y(e,0)%1,t=y(t,0),n=y(n,0),i=y(i,1);let r=n,s=n,a=n;if(t!==0){let l;n<.5?l=n*(1+t):l=n+t-n*t;const u=2*n-l;r=BE(u,l,e+1/3),s=BE(u,l,e),a=BE(u,l,e-1/3)}return c(o)?(o.red=r,o.green=s,o.blue=a,o.alpha=i,o):new z(r,s,a,i)};z.fromRandom=function(e,t){e=y(e,y.EMPTY_OBJECT);let n=e.red;if(!c(n)){const s=y(e.minimumRed,0),a=y(e.maximumRed,1);A.typeOf.number.lessThanOrEquals("minimumRed",s,a),n=s+R.nextRandomNumber()*(a-s)}let i=e.green;if(!c(i)){const s=y(e.minimumGreen,0),a=y(e.maximumGreen,1);A.typeOf.number.lessThanOrEquals("minimumGreen",s,a),i=s+R.nextRandomNumber()*(a-s)}let o=e.blue;if(!c(o)){const s=y(e.minimumBlue,0),a=y(e.maximumBlue,1);A.typeOf.number.lessThanOrEquals("minimumBlue",s,a),o=s+R.nextRandomNumber()*(a-s)}let r=e.alpha;if(!c(r)){const s=y(e.minimumAlpha,0),a=y(e.maximumAlpha,1);A.typeOf.number.lessThanOrEquals("minumumAlpha",s,a),r=s+R.nextRandomNumber()*(a-s)}return c(t)?(t.red=n,t.green=i,t.blue=o,t.alpha=r,t):new z(n,i,o,r)};const R7=/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/i,N7=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i,M7=/^rgba?\s*\(\s*([0-9.]+%?)\s*[,\s]+\s*([0-9.]+%?)\s*[,\s]+\s*([0-9.]+%?)(?:\s*[,\s/]+\s*([0-9.]+))?\s*\)$/i,F7=/^hsla?\s*\(\s*([0-9.]+)\s*[,\s]+\s*([0-9.]+%)\s*[,\s]+\s*([0-9.]+%)(?:\s*[,\s/]+\s*([0-9.]+))?\s*\)$/i;z.fromCssColorString=function(e,t){A.typeOf.string("color",e),c(t)||(t=new z),e=e.trim();const n=z[e.toUpperCase()];if(c(n))return z.clone(n,t),t;let i=R7.exec(e);return i!==null?(t.red=parseInt(i[1],16)/15,t.green=parseInt(i[2],16)/15,t.blue=parseInt(i[3],16)/15,t.alpha=parseInt(y(i[4],"f"),16)/15,t):(i=N7.exec(e),i!==null?(t.red=parseInt(i[1],16)/255,t.green=parseInt(i[2],16)/255,t.blue=parseInt(i[3],16)/255,t.alpha=parseInt(y(i[4],"ff"),16)/255,t):(i=M7.exec(e),i!==null?(t.red=parseFloat(i[1])/(i[1].substr(-1)==="%"?100:255),t.green=parseFloat(i[2])/(i[2].substr(-1)==="%"?100:255),t.blue=parseFloat(i[3])/(i[3].substr(-1)==="%"?100:255),t.alpha=parseFloat(y(i[4],"1.0")),t):(i=F7.exec(e),i!==null?z.fromHsl(parseFloat(i[1])/360,parseFloat(i[2])/100,parseFloat(i[3])/100,parseFloat(y(i[4],"1.0")),t):(t=void 0,t))))};z.packedLength=4;z.pack=function(e,t,n){return A.typeOf.object("value",e),A.defined("array",t),n=y(n,0),t[n++]=e.red,t[n++]=e.green,t[n++]=e.blue,t[n]=e.alpha,t};z.unpack=function(e,t,n){return A.defined("array",e),t=y(t,0),c(n)||(n=new z),n.red=e[t++],n.green=e[t++],n.blue=e[t++],n.alpha=e[t],n};z.byteToFloat=function(e){return e/255};z.floatToByte=function(e){return e===1?255:e*256|0};z.clone=function(e,t){if(!!c(e))return c(t)?(t.red=e.red,t.green=e.green,t.blue=e.blue,t.alpha=e.alpha,t):new z(e.red,e.green,e.blue,e.alpha)};z.equals=function(e,t){return e===t||c(e)&&c(t)&&e.red===t.red&&e.green===t.green&&e.blue===t.blue&&e.alpha===t.alpha};z.equalsArray=function(e,t,n){return e.red===t[n]&&e.green===t[n+1]&&e.blue===t[n+2]&&e.alpha===t[n+3]};z.prototype.clone=function(e){return z.clone(this,e)};z.prototype.equals=function(e){return z.equals(this,e)};z.prototype.equalsEpsilon=function(e,t){return this===e||c(e)&&Math.abs(this.red-e.red)<=t&&Math.abs(this.green-e.green)<=t&&Math.abs(this.blue-e.blue)<=t&&Math.abs(this.alpha-e.alpha)<=t};z.prototype.toString=function(){return`(${this.red}, ${this.green}, ${this.blue}, ${this.alpha})`};z.prototype.toCssColorString=function(){const e=z.floatToByte(this.red),t=z.floatToByte(this.green),n=z.floatToByte(this.blue);return this.alpha===1?`rgb(${e},${t},${n})`:`rgba(${e},${t},${n},${this.alpha})`};z.prototype.toCssHexString=function(){let e=z.floatToByte(this.red).toString(16);e.length<2&&(e=`0${e}`);let t=z.floatToByte(this.green).toString(16);t.length<2&&(t=`0${t}`);let n=z.floatToByte(this.blue).toString(16);if(n.length<2&&(n=`0${n}`),this.alpha<1){let i=z.floatToByte(this.alpha).toString(16);return i.length<2&&(i=`0${i}`),`#${e}${t}${n}${i}`}return`#${e}${t}${n}`};z.prototype.toBytes=function(e){const t=z.floatToByte(this.red),n=z.floatToByte(this.green),i=z.floatToByte(this.blue),o=z.floatToByte(this.alpha);return c(e)?(e[0]=t,e[1]=n,e[2]=i,e[3]=o,e):[t,n,i,o]};z.prototype.toRgba=function(){return Wu[0]=z.floatToByte(this.red),Wu[1]=z.floatToByte(this.green),Wu[2]=z.floatToByte(this.blue),Wu[3]=z.floatToByte(this.alpha),yP[0]};z.prototype.brighten=function(e,t){return A.typeOf.number("magnitude",e),A.typeOf.number.greaterThanOrEquals("magnitude",e,0),A.typeOf.object("result",t),e=1-e,t.red=1-(1-this.red)*e,t.green=1-(1-this.green)*e,t.blue=1-(1-this.blue)*e,t.alpha=this.alpha,t};z.prototype.darken=function(e,t){return A.typeOf.number("magnitude",e),A.typeOf.number.greaterThanOrEquals("magnitude",e,0),A.typeOf.object("result",t),e=1-e,t.red=this.red*e,t.green=this.green*e,t.blue=this.blue*e,t.alpha=this.alpha,t};z.prototype.withAlpha=function(e,t){return z.fromAlpha(this,e,t)};z.add=function(e,t,n){return A.typeOf.object("left",e),A.typeOf.object("right",t),A.typeOf.object("result",n),n.red=e.red+t.red,n.green=e.green+t.green,n.blue=e.blue+t.blue,n.alpha=e.alpha+t.alpha,n};z.subtract=function(e,t,n){return A.typeOf.object("left",e),A.typeOf.object("right",t),A.typeOf.object("result",n),n.red=e.red-t.red,n.green=e.green-t.green,n.blue=e.blue-t.blue,n.alpha=e.alpha-t.alpha,n};z.multiply=function(e,t,n){return A.typeOf.object("left",e),A.typeOf.object("right",t),A.typeOf.object("result",n),n.red=e.red*t.red,n.green=e.green*t.green,n.blue=e.blue*t.blue,n.alpha=e.alpha*t.alpha,n};z.divide=function(e,t,n){return A.typeOf.object("left",e),A.typeOf.object("right",t),A.typeOf.object("result",n),n.red=e.red/t.red,n.green=e.green/t.green,n.blue=e.blue/t.blue,n.alpha=e.alpha/t.alpha,n};z.mod=function(e,t,n){return A.typeOf.object("left",e),A.typeOf.object("right",t),A.typeOf.object("result",n),n.red=e.red%t.red,n.green=e.green%t.green,n.blue=e.blue%t.blue,n.alpha=e.alpha%t.alpha,n};z.lerp=function(e,t,n,i){return A.typeOf.object("start",e),A.typeOf.object("end",t),A.typeOf.number("t",n),A.typeOf.object("result",i),i.red=R.lerp(e.red,t.red,n),i.green=R.lerp(e.green,t.green,n),i.blue=R.lerp(e.blue,t.blue,n),i.alpha=R.lerp(e.alpha,t.alpha,n),i};z.multiplyByScalar=function(e,t,n){return A.typeOf.object("color",e),A.typeOf.number("scalar",t),A.typeOf.object("result",n),n.red=e.red*t,n.green=e.green*t,n.blue=e.blue*t,n.alpha=e.alpha*t,n};z.divideByScalar=function(e,t,n){return A.typeOf.object("color",e),A.typeOf.number("scalar",t),A.typeOf.object("result",n),n.red=e.red/t,n.green=e.green/t,n.blue=e.blue/t,n.alpha=e.alpha/t,n};z.ALICEBLUE=Object.freeze(z.fromCssColorString("#F0F8FF"));z.ANTIQUEWHITE=Object.freeze(z.fromCssColorString("#FAEBD7"));z.AQUA=Object.freeze(z.fromCssColorString("#00FFFF"));z.AQUAMARINE=Object.freeze(z.fromCssColorString("#7FFFD4"));z.AZURE=Object.freeze(z.fromCssColorString("#F0FFFF"));z.BEIGE=Object.freeze(z.fromCssColorString("#F5F5DC"));z.BISQUE=Object.freeze(z.fromCssColorString("#FFE4C4"));z.BLACK=Object.freeze(z.fromCssColorString("#000000"));z.BLANCHEDALMOND=Object.freeze(z.fromCssColorString("#FFEBCD"));z.BLUE=Object.freeze(z.fromCssColorString("#0000FF"));z.BLUEVIOLET=Object.freeze(z.fromCssColorString("#8A2BE2"));z.BROWN=Object.freeze(z.fromCssColorString("#A52A2A"));z.BURLYWOOD=Object.freeze(z.fromCssColorString("#DEB887"));z.CADETBLUE=Object.freeze(z.fromCssColorString("#5F9EA0"));z.CHARTREUSE=Object.freeze(z.fromCssColorString("#7FFF00"));z.CHOCOLATE=Object.freeze(z.fromCssColorString("#D2691E"));z.CORAL=Object.freeze(z.fromCssColorString("#FF7F50"));z.CORNFLOWERBLUE=Object.freeze(z.fromCssColorString("#6495ED"));z.CORNSILK=Object.freeze(z.fromCssColorString("#FFF8DC"));z.CRIMSON=Object.freeze(z.fromCssColorString("#DC143C"));z.CYAN=Object.freeze(z.fromCssColorString("#00FFFF"));z.DARKBLUE=Object.freeze(z.fromCssColorString("#00008B"));z.DARKCYAN=Object.freeze(z.fromCssColorString("#008B8B"));z.DARKGOLDENROD=Object.freeze(z.fromCssColorString("#B8860B"));z.DARKGRAY=Object.freeze(z.fromCssColorString("#A9A9A9"));z.DARKGREEN=Object.freeze(z.fromCssColorString("#006400"));z.DARKGREY=z.DARKGRAY;z.DARKKHAKI=Object.freeze(z.fromCssColorString("#BDB76B"));z.DARKMAGENTA=Object.freeze(z.fromCssColorString("#8B008B"));z.DARKOLIVEGREEN=Object.freeze(z.fromCssColorString("#556B2F"));z.DARKORANGE=Object.freeze(z.fromCssColorString("#FF8C00"));z.DARKORCHID=Object.freeze(z.fromCssColorString("#9932CC"));z.DARKRED=Object.freeze(z.fromCssColorString("#8B0000"));z.DARKSALMON=Object.freeze(z.fromCssColorString("#E9967A"));z.DARKSEAGREEN=Object.freeze(z.fromCssColorString("#8FBC8F"));z.DARKSLATEBLUE=Object.freeze(z.fromCssColorString("#483D8B"));z.DARKSLATEGRAY=Object.freeze(z.fromCssColorString("#2F4F4F"));z.DARKSLATEGREY=z.DARKSLATEGRAY;z.DARKTURQUOISE=Object.freeze(z.fromCssColorString("#00CED1"));z.DARKVIOLET=Object.freeze(z.fromCssColorString("#9400D3"));z.DEEPPINK=Object.freeze(z.fromCssColorString("#FF1493"));z.DEEPSKYBLUE=Object.freeze(z.fromCssColorString("#00BFFF"));z.DIMGRAY=Object.freeze(z.fromCssColorString("#696969"));z.DIMGREY=z.DIMGRAY;z.DODGERBLUE=Object.freeze(z.fromCssColorString("#1E90FF"));z.FIREBRICK=Object.freeze(z.fromCssColorString("#B22222"));z.FLORALWHITE=Object.freeze(z.fromCssColorString("#FFFAF0"));z.FORESTGREEN=Object.freeze(z.fromCssColorString("#228B22"));z.FUCHSIA=Object.freeze(z.fromCssColorString("#FF00FF"));z.GAINSBORO=Object.freeze(z.fromCssColorString("#DCDCDC"));z.GHOSTWHITE=Object.freeze(z.fromCssColorString("#F8F8FF"));z.GOLD=Object.freeze(z.fromCssColorString("#FFD700"));z.GOLDENROD=Object.freeze(z.fromCssColorString("#DAA520"));z.GRAY=Object.freeze(z.fromCssColorString("#808080"));z.GREEN=Object.freeze(z.fromCssColorString("#008000"));z.GREENYELLOW=Object.freeze(z.fromCssColorString("#ADFF2F"));z.GREY=z.GRAY;z.HONEYDEW=Object.freeze(z.fromCssColorString("#F0FFF0"));z.HOTPINK=Object.freeze(z.fromCssColorString("#FF69B4"));z.INDIANRED=Object.freeze(z.fromCssColorString("#CD5C5C"));z.INDIGO=Object.freeze(z.fromCssColorString("#4B0082"));z.IVORY=Object.freeze(z.fromCssColorString("#FFFFF0"));z.KHAKI=Object.freeze(z.fromCssColorString("#F0E68C"));z.LAVENDER=Object.freeze(z.fromCssColorString("#E6E6FA"));z.LAVENDAR_BLUSH=Object.freeze(z.fromCssColorString("#FFF0F5"));z.LAWNGREEN=Object.freeze(z.fromCssColorString("#7CFC00"));z.LEMONCHIFFON=Object.freeze(z.fromCssColorString("#FFFACD"));z.LIGHTBLUE=Object.freeze(z.fromCssColorString("#ADD8E6"));z.LIGHTCORAL=Object.freeze(z.fromCssColorString("#F08080"));z.LIGHTCYAN=Object.freeze(z.fromCssColorString("#E0FFFF"));z.LIGHTGOLDENRODYELLOW=Object.freeze(z.fromCssColorString("#FAFAD2"));z.LIGHTGRAY=Object.freeze(z.fromCssColorString("#D3D3D3"));z.LIGHTGREEN=Object.freeze(z.fromCssColorString("#90EE90"));z.LIGHTGREY=z.LIGHTGRAY;z.LIGHTPINK=Object.freeze(z.fromCssColorString("#FFB6C1"));z.LIGHTSEAGREEN=Object.freeze(z.fromCssColorString("#20B2AA"));z.LIGHTSKYBLUE=Object.freeze(z.fromCssColorString("#87CEFA"));z.LIGHTSLATEGRAY=Object.freeze(z.fromCssColorString("#778899"));z.LIGHTSLATEGREY=z.LIGHTSLATEGRAY;z.LIGHTSTEELBLUE=Object.freeze(z.fromCssColorString("#B0C4DE"));z.LIGHTYELLOW=Object.freeze(z.fromCssColorString("#FFFFE0"));z.LIME=Object.freeze(z.fromCssColorString("#00FF00"));z.LIMEGREEN=Object.freeze(z.fromCssColorString("#32CD32"));z.LINEN=Object.freeze(z.fromCssColorString("#FAF0E6"));z.MAGENTA=Object.freeze(z.fromCssColorString("#FF00FF"));z.MAROON=Object.freeze(z.fromCssColorString("#800000"));z.MEDIUMAQUAMARINE=Object.freeze(z.fromCssColorString("#66CDAA"));z.MEDIUMBLUE=Object.freeze(z.fromCssColorString("#0000CD"));z.MEDIUMORCHID=Object.freeze(z.fromCssColorString("#BA55D3"));z.MEDIUMPURPLE=Object.freeze(z.fromCssColorString("#9370DB"));z.MEDIUMSEAGREEN=Object.freeze(z.fromCssColorString("#3CB371"));z.MEDIUMSLATEBLUE=Object.freeze(z.fromCssColorString("#7B68EE"));z.MEDIUMSPRINGGREEN=Object.freeze(z.fromCssColorString("#00FA9A"));z.MEDIUMTURQUOISE=Object.freeze(z.fromCssColorString("#48D1CC"));z.MEDIUMVIOLETRED=Object.freeze(z.fromCssColorString("#C71585"));z.MIDNIGHTBLUE=Object.freeze(z.fromCssColorString("#191970"));z.MINTCREAM=Object.freeze(z.fromCssColorString("#F5FFFA"));z.MISTYROSE=Object.freeze(z.fromCssColorString("#FFE4E1"));z.MOCCASIN=Object.freeze(z.fromCssColorString("#FFE4B5"));z.NAVAJOWHITE=Object.freeze(z.fromCssColorString("#FFDEAD"));z.NAVY=Object.freeze(z.fromCssColorString("#000080"));z.OLDLACE=Object.freeze(z.fromCssColorString("#FDF5E6"));z.OLIVE=Object.freeze(z.fromCssColorString("#808000"));z.OLIVEDRAB=Object.freeze(z.fromCssColorString("#6B8E23"));z.ORANGE=Object.freeze(z.fromCssColorString("#FFA500"));z.ORANGERED=Object.freeze(z.fromCssColorString("#FF4500"));z.ORCHID=Object.freeze(z.fromCssColorString("#DA70D6"));z.PALEGOLDENROD=Object.freeze(z.fromCssColorString("#EEE8AA"));z.PALEGREEN=Object.freeze(z.fromCssColorString("#98FB98"));z.PALETURQUOISE=Object.freeze(z.fromCssColorString("#AFEEEE"));z.PALEVIOLETRED=Object.freeze(z.fromCssColorString("#DB7093"));z.PAPAYAWHIP=Object.freeze(z.fromCssColorString("#FFEFD5"));z.PEACHPUFF=Object.freeze(z.fromCssColorString("#FFDAB9"));z.PERU=Object.freeze(z.fromCssColorString("#CD853F"));z.PINK=Object.freeze(z.fromCssColorString("#FFC0CB"));z.PLUM=Object.freeze(z.fromCssColorString("#DDA0DD"));z.POWDERBLUE=Object.freeze(z.fromCssColorString("#B0E0E6"));z.PURPLE=Object.freeze(z.fromCssColorString("#800080"));z.RED=Object.freeze(z.fromCssColorString("#FF0000"));z.ROSYBROWN=Object.freeze(z.fromCssColorString("#BC8F8F"));z.ROYALBLUE=Object.freeze(z.fromCssColorString("#4169E1"));z.SADDLEBROWN=Object.freeze(z.fromCssColorString("#8B4513"));z.SALMON=Object.freeze(z.fromCssColorString("#FA8072"));z.SANDYBROWN=Object.freeze(z.fromCssColorString("#F4A460"));z.SEAGREEN=Object.freeze(z.fromCssColorString("#2E8B57"));z.SEASHELL=Object.freeze(z.fromCssColorString("#FFF5EE"));z.SIENNA=Object.freeze(z.fromCssColorString("#A0522D"));z.SILVER=Object.freeze(z.fromCssColorString("#C0C0C0"));z.SKYBLUE=Object.freeze(z.fromCssColorString("#87CEEB"));z.SLATEBLUE=Object.freeze(z.fromCssColorString("#6A5ACD"));z.SLATEGRAY=Object.freeze(z.fromCssColorString("#708090"));z.SLATEGREY=z.SLATEGRAY;z.SNOW=Object.freeze(z.fromCssColorString("#FFFAFA"));z.SPRINGGREEN=Object.freeze(z.fromCssColorString("#00FF7F"));z.STEELBLUE=Object.freeze(z.fromCssColorString("#4682B4"));z.TAN=Object.freeze(z.fromCssColorString("#D2B48C"));z.TEAL=Object.freeze(z.fromCssColorString("#008080"));z.THISTLE=Object.freeze(z.fromCssColorString("#D8BFD8"));z.TOMATO=Object.freeze(z.fromCssColorString("#FF6347"));z.TURQUOISE=Object.freeze(z.fromCssColorString("#40E0D0"));z.VIOLET=Object.freeze(z.fromCssColorString("#EE82EE"));z.WHEAT=Object.freeze(z.fromCssColorString("#F5DEB3"));z.WHITE=Object.freeze(z.fromCssColorString("#FFFFFF"));z.WHITESMOKE=Object.freeze(z.fromCssColorString("#F5F5F5"));z.YELLOW=Object.freeze(z.fromCssColorString("#FFFF00"));z.YELLOWGREEN=Object.freeze(z.fromCssColorString("#9ACD32"));z.TRANSPARENT=Object.freeze(new z(0,0,0,0));function bi(e){e=y(e,y.EMPTY_OBJECT),this.color=e.color,this.depth=e.depth,this.stencil=e.stencil,this.renderState=e.renderState,this.framebuffer=e.framebuffer,this.owner=e.owner,this.pass=e.pass}bi.ALL=Object.freeze(new bi({color:new z(0,0,0,0),depth:1,stencil:0}));bi.prototype.execute=function(e,t){e.clear(this,t)};const B7={ENVIRONMENT:0,COMPUTE:1,GLOBE:2,TERRAIN_CLASSIFICATION:3,CESIUM_3D_TILE:4,CESIUM_3D_TILE_CLASSIFICATION:5,CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW:6,OPAQUE:7,TRANSLUCENT:8,VOXELS:9,OVERLAY:10,NUMBER_OF_PASSES:11},xe=Object.freeze(B7);function A_(e){e=y(e,y.EMPTY_OBJECT),this.vertexArray=e.vertexArray,this.fragmentShaderSource=e.fragmentShaderSource,this.shaderProgram=e.shaderProgram,this.uniformMap=e.uniformMap,this.outputTexture=e.outputTexture,this.preExecute=e.preExecute,this.postExecute=e.postExecute,this.canceled=e.canceled,this.persists=y(e.persists,!1),this.pass=xe.COMPUTE,this.owner=e.owner}A_.prototype.execute=function(e){e.execute(this)};function H(e,t){this.x=y(e,0),this.y=y(t,0)}H.fromElements=function(e,t,n){return c(n)?(n.x=e,n.y=t,n):new H(e,t)};H.clone=function(e,t){if(!!c(e))return c(t)?(t.x=e.x,t.y=e.y,t):new H(e.x,e.y)};H.fromCartesian3=H.clone;H.fromCartesian4=H.clone;H.packedLength=2;H.pack=function(e,t,n){return A.typeOf.object("value",e),A.defined("array",t),n=y(n,0),t[n++]=e.x,t[n]=e.y,t};H.unpack=function(e,t,n){return A.defined("array",e),t=y(t,0),c(n)||(n=new H),n.x=e[t++],n.y=e[t],n};H.packArray=function(e,t){A.defined("array",e);const n=e.length,i=n*2;if(!c(t))t=new Array(i);else{if(!Array.isArray(t)&&t.length!==i)throw new E("If result is a typed array, it must have exactly array.length * 2 elements");t.length!==i&&(t.length=i)}for(let o=0;o<n;++o)H.pack(e[o],t,o*2);return t};H.unpackArray=function(e,t){if(A.defined("array",e),A.typeOf.number.greaterThanOrEquals("array.length",e.length,2),e.length%2!==0)throw new E("array length must be a multiple of 2.");const n=e.length;c(t)?t.length=n/2:t=new Array(n/2);for(let i=0;i<n;i+=2){const o=i/2;t[o]=H.unpack(e,i,t[o])}return t};H.fromArray=H.unpack;H.maximumComponent=function(e){return A.typeOf.object("cartesian",e),Math.max(e.x,e.y)};H.minimumComponent=function(e){return A.typeOf.object("cartesian",e),Math.min(e.x,e.y)};H.minimumByComponent=function(e,t,n){return A.typeOf.object("first",e),A.typeOf.object("second",t),A.typeOf.object("result",n),n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n};H.maximumByComponent=function(e,t,n){return A.typeOf.object("first",e),A.typeOf.object("second",t),A.typeOf.object("result",n),n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n};H.clamp=function(e,t,n,i){A.typeOf.object("value",e),A.typeOf.object("min",t),A.typeOf.object("max",n),A.typeOf.object("result",i);const o=R.clamp(e.x,t.x,n.x),r=R.clamp(e.y,t.y,n.y);return i.x=o,i.y=r,i};H.magnitudeSquared=function(e){return A.typeOf.object("cartesian",e),e.x*e.x+e.y*e.y};H.magnitude=function(e){return Math.sqrt(H.magnitudeSquared(e))};const Tx=new H;H.distance=function(e,t){return A.typeOf.object("left",e),A.typeOf.object("right",t),H.subtract(e,t,Tx),H.magnitude(Tx)};H.distanceSquared=function(e,t){return A.typeOf.object("left",e),A.typeOf.object("right",t),H.subtract(e,t,Tx),H.magnitudeSquared(Tx)};H.normalize=function(e,t){A.typeOf.object("cartesian",e),A.typeOf.object("result",t);const n=H.magnitude(e);if(t.x=e.x/n,t.y=e.y/n,isNaN(t.x)||isNaN(t.y))throw new E("normalized result is not a number");return t};H.dot=function(e,t){return A.typeOf.object("left",e),A.typeOf.object("right",t),e.x*t.x+e.y*t.y};H.cross=function(e,t){return A.typeOf.object("left",e),A.typeOf.object("right",t),e.x*t.y-e.y*t.x};H.multiplyComponents=function(e,t,n){return A.typeOf.object("left",e),A.typeOf.object("right",t),A.typeOf.object("result",n),n.x=e.x*t.x,n.y=e.y*t.y,n};H.divideComponents=function(e,t,n){return A.typeOf.object("left",e),A.typeOf.object("right",t),A.typeOf.object("result",n),n.x=e.x/t.x,n.y=e.y/t.y,n};H.add=function(e,t,n){return A.typeOf.object("left",e),A.typeOf.object("right",t),A.typeOf.object("result",n),n.x=e.x+t.x,n.y=e.y+t.y,n};H.subtract=function(e,t,n){return A.typeOf.object("left",e),A.typeOf.object("right",t),A.typeOf.object("result",n),n.x=e.x-t.x,n.y=e.y-t.y,n};H.multiplyByScalar=function(e,t,n){return A.typeOf.object("cartesian",e),A.typeOf.number("scalar",t),A.typeOf.object("result",n),n.x=e.x*t,n.y=e.y*t,n};H.divideByScalar=function(e,t,n){return A.typeOf.object("cartesian",e),A.typeOf.number("scalar",t),A.typeOf.object("result",n),n.x=e.x/t,n.y=e.y/t,n};H.negate=function(e,t){return A.typeOf.object("cartesian",e),A.typeOf.object("result",t),t.x=-e.x,t.y=-e.y,t};H.abs=function(e,t){return A.typeOf.object("cartesian",e),A.typeOf.object("result",t),t.x=Math.abs(e.x),t.y=Math.abs(e.y),t};const EL=new H;H.lerp=function(e,t,n,i){return A.typeOf.object("start",e),A.typeOf.object("end",t),A.typeOf.number("t",n),A.typeOf.object("result",i),H.multiplyByScalar(t,n,EL),i=H.multiplyByScalar(e,1-n,i),H.add(EL,i,i)};const wL=new H,SL=new H;H.angleBetween=function(e,t){return A.typeOf.object("left",e),A.typeOf.object("right",t),H.normalize(e,wL),H.normalize(t,SL),R.acosClamped(H.dot(wL,SL))};const z7=new H;H.mostOrthogonalAxis=function(e,t){A.typeOf.object("cartesian",e),A.typeOf.object("result",t);const n=H.normalize(e,z7);return H.abs(n,n),n.x<=n.y?t=H.clone(H.UNIT_X,t):t=H.clone(H.UNIT_Y,t),t};H.equals=function(e,t){return e===t||c(e)&&c(t)&&e.x===t.x&&e.y===t.y};H.equalsArray=function(e,t,n){return e.x===t[n]&&e.y===t[n+1]};H.equalsEpsilon=function(e,t,n,i){return e===t||c(e)&&c(t)&&R.equalsEpsilon(e.x,t.x,n,i)&&R.equalsEpsilon(e.y,t.y,n,i)};H.ZERO=Object.freeze(new H(0,0));H.ONE=Object.freeze(new H(1,1));H.UNIT_X=Object.freeze(new H(1,0));H.UNIT_Y=Object.freeze(new H(0,1));H.prototype.clone=function(e){return H.clone(this,e)};H.prototype.equals=function(e){return H.equals(this,e)};H.prototype.equalsEpsilon=function(e,t,n){return H.equalsEpsilon(this,e,t,n)};H.prototype.toString=function(){return`(${this.x}, ${this.y})`};const U7=new d,k7=new d;function hU(e,t,n,i,o){if(!c(e))throw new E("cartesian is required.");if(!c(t))throw new E("oneOverRadii is required.");if(!c(n))throw new E("oneOverRadiiSquared is required.");if(!c(i))throw new E("centerToleranceSquared is required.");const r=e.x,s=e.y,a=e.z,l=t.x,u=t.y,h=t.z,f=r*r*l*l,_=s*s*u*u,g=a*a*h*h,m=f+_+g,b=Math.sqrt(1/m),T=d.multiplyByScalar(e,b,U7);if(m<i)return isFinite(b)?d.clone(T,o):void 0;const x=n.x,C=n.y,w=n.z,v=k7;v.x=T.x*x*2,v.y=T.y*C*2,v.z=T.z*w*2;let P=(1-b)*d.magnitude(e)/(.5*d.magnitude(v)),N=0,k,M,U,B,S,D,p,I,O,F,V;do{P-=N,U=1/(1+P*x),B=1/(1+P*C),S=1/(1+P*w),D=U*U,p=B*B,I=S*S,O=D*U,F=p*B,V=I*S,k=f*D+_*p+g*I-1,M=f*O*x+_*F*C+g*V*w;const G=-2*M;N=k/G}while(Math.abs(k)>R.EPSILON12);return c(o)?(o.x=r*U,o.y=s*B,o.z=a*S,o):new d(r*U,s*B,a*S)}function he(e,t,n){this.longitude=y(e,0),this.latitude=y(t,0),this.height=y(n,0)}he.fromRadians=function(e,t,n,i){return A.typeOf.number("longitude",e),A.typeOf.number("latitude",t),n=y(n,0),c(i)?(i.longitude=e,i.latitude=t,i.height=n,i):new he(e,t,n)};he.fromDegrees=function(e,t,n,i){return A.typeOf.number("longitude",e),A.typeOf.number("latitude",t),e=R.toRadians(e),t=R.toRadians(t),he.fromRadians(e,t,n,i)};const V7=new d,H7=new d,G7=new d,j7=new d(1/6378137,1/6378137,1/6356752314245179e-9),W7=new d(1/(6378137*6378137),1/(6378137*6378137),1/(6356752314245179e-9*6356752314245179e-9)),q7=R.EPSILON1;he.fromCartesian=function(e,t,n){const i=c(t)?t.oneOverRadii:j7,o=c(t)?t.oneOverRadiiSquared:W7,r=c(t)?t._centerToleranceSquared:q7,s=hU(e,i,o,r,H7);if(!c(s))return;let a=d.multiplyComponents(s,o,V7);a=d.normalize(a,a);const l=d.subtract(e,s,G7),u=Math.atan2(a.y,a.x),h=Math.asin(a.z),f=R.sign(d.dot(l,e))*d.magnitude(l);return c(n)?(n.longitude=u,n.latitude=h,n.height=f,n):new he(u,h,f)};he.toCartesian=function(e,t,n){return A.defined("cartographic",e),d.fromRadians(e.longitude,e.latitude,e.height,t,n)};he.clone=function(e,t){if(!!c(e))return c(t)?(t.longitude=e.longitude,t.latitude=e.latitude,t.height=e.height,t):new he(e.longitude,e.latitude,e.height)};he.equals=function(e,t){return e===t||c(e)&&c(t)&&e.longitude===t.longitude&&e.latitude===t.latitude&&e.height===t.height};he.equalsEpsilon=function(e,t,n){return n=y(n,0),e===t||c(e)&&c(t)&&Math.abs(e.longitude-t.longitude)<=n&&Math.abs(e.latitude-t.latitude)<=n&&Math.abs(e.height-t.height)<=n};he.ZERO=Object.freeze(new he(0,0,0));he.prototype.clone=function(e){return he.clone(this,e)};he.prototype.equals=function(e){return he.equals(this,e)};he.prototype.equalsEpsilon=function(e,t){return he.equalsEpsilon(this,e,t)};he.prototype.toString=function(){return`(${this.longitude}, ${this.latitude}, ${this.height})`};function fU(e,t,n,i){t=y(t,0),n=y(n,0),i=y(i,0),A.typeOf.number.greaterThanOrEquals("x",t,0),A.typeOf.number.greaterThanOrEquals("y",n,0),A.typeOf.number.greaterThanOrEquals("z",i,0),e._radii=new d(t,n,i),e._radiiSquared=new d(t*t,n*n,i*i),e._radiiToTheFourth=new d(t*t*t*t,n*n*n*n,i*i*i*i),e._oneOverRadii=new d(t===0?0:1/t,n===0?0:1/n,i===0?0:1/i),e._oneOverRadiiSquared=new d(t===0?0:1/(t*t),n===0?0:1/(n*n),i===0?0:1/(i*i)),e._minimumRadius=Math.min(t,n,i),e._maximumRadius=Math.max(t,n,i),e._centerToleranceSquared=R.EPSILON1,e._radiiSquared.z!==0&&(e._squaredXOverSquaredZ=e._radiiSquared.x/e._radiiSquared.z)}function ae(e,t,n){this._radii=void 0,this._radiiSquared=void 0,this._radiiToTheFourth=void 0,this._oneOverRadii=void 0,this._oneOverRadiiSquared=void 0,this._minimumRadius=void 0,this._maximumRadius=void 0,this._centerToleranceSquared=void 0,this._squaredXOverSquaredZ=void 0,fU(this,e,t,n)}Object.defineProperties(ae.prototype,{radii:{get:function(){return this._radii}},radiiSquared:{get:function(){return this._radiiSquared}},radiiToTheFourth:{get:function(){return this._radiiToTheFourth}},oneOverRadii:{get:function(){return this._oneOverRadii}},oneOverRadiiSquared:{get:function(){return this._oneOverRadiiSquared}},minimumRadius:{get:function(){return this._minimumRadius}},maximumRadius:{get:function(){return this._maximumRadius}}});ae.clone=function(e,t){if(!c(e))return;const n=e._radii;return c(t)?(d.clone(n,t._radii),d.clone(e._radiiSquared,t._radiiSquared),d.clone(e._radiiToTheFourth,t._radiiToTheFourth),d.clone(e._oneOverRadii,t._oneOverRadii),d.clone(e._oneOverRadiiSquared,t._oneOverRadiiSquared),t._minimumRadius=e._minimumRadius,t._maximumRadius=e._maximumRadius,t._centerToleranceSquared=e._centerToleranceSquared,t):new ae(n.x,n.y,n.z)};ae.fromCartesian3=function(e,t){return c(t)||(t=new ae),c(e)&&fU(t,e.x,e.y,e.z),t};ae.WGS84=Object.freeze(new ae(6378137,6378137,6356752314245179e-9));ae.UNIT_SPHERE=Object.freeze(new ae(1,1,1));ae.MOON=Object.freeze(new ae(R.LUNAR_RADIUS,R.LUNAR_RADIUS,R.LUNAR_RADIUS));ae.prototype.clone=function(e){return ae.clone(this,e)};ae.packedLength=d.packedLength;ae.pack=function(e,t,n){return A.typeOf.object("value",e),A.defined("array",t),n=y(n,0),d.pack(e._radii,t,n),t};ae.unpack=function(e,t,n){A.defined("array",e),t=y(t,0);const i=d.unpack(e,t);return ae.fromCartesian3(i,n)};ae.prototype.geocentricSurfaceNormal=d.normalize;ae.prototype.geodeticSurfaceNormalCartographic=function(e,t){A.typeOf.object("cartographic",e);const n=e.longitude,i=e.latitude,o=Math.cos(i),r=o*Math.cos(n),s=o*Math.sin(n),a=Math.sin(i);return c(t)||(t=new d),t.x=r,t.y=s,t.z=a,d.normalize(t,t)};ae.prototype.geodeticSurfaceNormal=function(e,t){if(A.typeOf.object("cartesian",e),isNaN(e.x)||isNaN(e.y)||isNaN(e.z))throw new E("cartesian has a NaN component");if(!d.equalsEpsilon(e,d.ZERO,R.EPSILON14))return c(t)||(t=new d),t=d.multiplyComponents(e,this._oneOverRadiiSquared,t),d.normalize(t,t)};const Y7=new d,$7=new d;ae.prototype.cartographicToCartesian=function(e,t){const n=Y7,i=$7;this.geodeticSurfaceNormalCartographic(e,n),d.multiplyComponents(this._radiiSquared,n,i);const o=Math.sqrt(d.dot(n,i));return d.divideByScalar(i,o,i),d.multiplyByScalar(n,e.height,n),c(t)||(t=new d),d.add(i,n,t)};ae.prototype.cartographicArrayToCartesianArray=function(e,t){A.defined("cartographics",e);const n=e.length;c(t)?t.length=n:t=new Array(n);for(let i=0;i<n;i++)t[i]=this.cartographicToCartesian(e[i],t[i]);return t};const X7=new d,Q7=new d,K7=new d;ae.prototype.cartesianToCartographic=function(e,t){const n=this.scaleToGeodeticSurface(e,Q7);if(!c(n))return;const i=this.geodeticSurfaceNormal(n,X7),o=d.subtract(e,n,K7),r=Math.atan2(i.y,i.x),s=Math.asin(i.z),a=R.sign(d.dot(o,e))*d.magnitude(o);return c(t)?(t.longitude=r,t.latitude=s,t.height=a,t):new he(r,s,a)};ae.prototype.cartesianArrayToCartographicArray=function(e,t){A.defined("cartesians",e);const n=e.length;c(t)?t.length=n:t=new Array(n);for(let i=0;i<n;++i)t[i]=this.cartesianToCartographic(e[i],t[i]);return t};ae.prototype.scaleToGeodeticSurface=function(e,t){return hU(e,this._oneOverRadii,this._oneOverRadiiSquared,this._centerToleranceSquared,t)};ae.prototype.scaleToGeocentricSurface=function(e,t){A.typeOf.object("cartesian",e),c(t)||(t=new d);const n=e.x,i=e.y,o=e.z,r=this._oneOverRadiiSquared,s=1/Math.sqrt(n*n*r.x+i*i*r.y+o*o*r.z);return d.multiplyByScalar(e,s,t)};ae.prototype.transformPositionToScaledSpace=function(e,t){return c(t)||(t=new d),d.multiplyComponents(e,this._oneOverRadii,t)};ae.prototype.transformPositionFromScaledSpace=function(e,t){return c(t)||(t=new d),d.multiplyComponents(e,this._radii,t)};ae.prototype.equals=function(e){return this===e||c(e)&&d.equals(this._radii,e._radii)};ae.prototype.toString=function(){return this._radii.toString()};ae.prototype.getSurfaceNormalIntersectionWithZAxis=function(e,t,n){if(A.typeOf.object("position",e),!R.equalsEpsilon(this._radii.x,this._radii.y,R.EPSILON15))throw new E("Ellipsoid must be an ellipsoid of revolution (radii.x == radii.y)");A.typeOf.number.greaterThan("Ellipsoid.radii.z",this._radii.z,0),t=y(t,0);const i=this._squaredXOverSquaredZ;if(c(n)||(n=new d),n.x=0,n.y=0,n.z=e.z*(1-i),!(Math.abs(n.z)>=this._radii.z-t))return n};const Z7=new d;ae.prototype.getLocalCurvature=function(e,t){A.typeOf.object("surfacePosition",e),c(t)||(t=new H);const n=this.getSurfaceNormalIntersectionWithZAxis(e,0,Z7),i=d.distance(e,n),o=this.minimumRadius*i/this.maximumRadius**2,r=i*o**2;return H.fromElements(1/i,1/r,t)};const J7=[.14887433898163,.43339539412925,.67940956829902,.86506336668898,.97390652851717,0],eY=[.29552422471475,.26926671930999,.21908636251598,.14945134915058,.066671344308684,0];function vL(e,t,n){A.typeOf.number("a",e),A.typeOf.number("b",t),A.typeOf.func("func",n);const i=.5*(t+e),o=.5*(t-e);let r=0;for(let s=0;s<5;s++){const a=o*J7[s];r+=eY[s]*(n(i+a)+n(i-a))}return r*=o,r}ae.prototype.surfaceArea=function(e){A.typeOf.object("rectangle",e);const t=e.west;let n=e.east;const i=e.south,o=e.north;for(;n<t;)n+=R.TWO_PI;const r=this._radiiSquared,s=r.x,a=r.y,l=r.z,u=s*a;return vL(i,o,function(h){const f=Math.cos(h),_=Math.sin(h);return Math.cos(h)*vL(t,n,function(g){const m=Math.cos(g),b=Math.sin(g);return Math.sqrt(u*_*_+l*(a*m*m+s*b*b)*f*f)})})};function co(e){this._ellipsoid=y(e,ae.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis}Object.defineProperties(co.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}});co.prototype.project=function(e,t){const n=this._semimajorAxis,i=e.longitude*n,o=e.latitude*n,r=e.height;return c(t)?(t.x=i,t.y=o,t.z=r,t):new d(i,o,r)};co.prototype.unproject=function(e,t){if(!c(e))throw new E("cartesian is required");const n=this._oneOverSemimajorAxis,i=e.x*n,o=e.y*n,r=e.z;return c(t)?(t.longitude=i,t.latitude=o,t.height=r,t):new he(i,o,r)};const tY={OUTSIDE:-1,INTERSECTING:0,INSIDE:1},Bt=Object.freeze(tY);function Hr(e,t,n){A.defined("array",e),A.defined("itemToFind",t),A.defined("comparator",n);let i=0,o=e.length-1,r,s;for(;i<=o;){if(r=~~((i+o)/2),s=n(e[r],t),s<0){i=r+1;continue}if(s>0){o=r-1;continue}return r}return~(o+1)}function bP(e,t,n,i,o){this.xPoleWander=e,this.yPoleWander=t,this.xPoleOffset=n,this.yPoleOffset=i,this.ut1MinusUtc=o}function $y(e){if(e===null||isNaN(e))throw new E("year is required and must be a number.");return e%4===0&&e%100!==0||e%400===0}const IL=[31,28,31,30,31,30,31,31,30,31,30,31];function L0(e,t,n,i,o,r,s,a){e=y(e,1),t=y(t,1),n=y(n,1),i=y(i,0),o=y(o,0),r=y(r,0),s=y(s,0),a=y(a,!1),b(),T(),this.year=e,this.month=t,this.day=n,this.hour=i,this.minute=o,this.second=r,this.millisecond=s,this.isLeapSecond=a;function b(){A.typeOf.number.greaterThanOrEquals("Year",e,1),A.typeOf.number.lessThanOrEquals("Year",e,9999),A.typeOf.number.greaterThanOrEquals("Month",t,1),A.typeOf.number.lessThanOrEquals("Month",t,12),A.typeOf.number.greaterThanOrEquals("Day",n,1),A.typeOf.number.lessThanOrEquals("Day",n,31),A.typeOf.number.greaterThanOrEquals("Hour",i,0),A.typeOf.number.lessThanOrEquals("Hour",i,23),A.typeOf.number.greaterThanOrEquals("Minute",o,0),A.typeOf.number.lessThanOrEquals("Minute",o,59),A.typeOf.bool("IsLeapSecond",a),A.typeOf.number.greaterThanOrEquals("Second",r,0),A.typeOf.number.lessThanOrEquals("Second",r,a?59+1:59),A.typeOf.number.greaterThanOrEquals("Millisecond",s,0),A.typeOf.number.lessThan("Millisecond",s,1e3)}function T(){const x=t===2&&$y(e)?IL[t-1]+1:IL[t-1];if(n>x)throw new E("Month and Day represents invalid date")}}function ei(e,t){this.julianDate=e,this.offset=t}const nY={SECONDS_PER_MILLISECOND:.001,SECONDS_PER_MINUTE:60,MINUTES_PER_HOUR:60,HOURS_PER_DAY:24,SECONDS_PER_HOUR:3600,MINUTES_PER_DAY:1440,SECONDS_PER_DAY:86400,DAYS_PER_JULIAN_CENTURY:36525,PICOSECOND:1e-9,MODIFIED_JULIAN_DATE_DIFFERENCE:24000005e-1},qn=Object.freeze(nY),iY={UTC:0,TAI:1},fn=Object.freeze(iY),pU=new L0,Pb=[31,28,31,30,31,30,31,31,30,31,30,31],Ob=29;function TP(e,t){return ie.compare(e.julianDate,t.julianDate)}const x_=new ei;function _C(e){x_.julianDate=e;const t=ie.leapSeconds;let n=Hr(t,x_,TP);n<0&&(n=~n),n>=t.length&&(n=t.length-1);let i=t[n].offset;n>0&&ie.secondsDifference(t[n].julianDate,e)>i&&(n--,i=t[n].offset),ie.addSeconds(e,i,e)}function DL(e,t){x_.julianDate=e;const n=ie.leapSeconds;let i=Hr(n,x_,TP);if(i<0&&(i=~i),i===0)return ie.addSeconds(e,-n[0].offset,t);if(i>=n.length)return ie.addSeconds(e,-n[i-1].offset,t);const o=ie.secondsDifference(n[i].julianDate,e);if(o===0)return ie.addSeconds(e,-n[i].offset,t);if(!(o<=1))return ie.addSeconds(e,-n[--i].offset,t)}function $h(e,t,n){const i=t/qn.SECONDS_PER_DAY|0;return e+=i,t-=qn.SECONDS_PER_DAY*i,t<0&&(e--,t+=qn.SECONDS_PER_DAY),n.dayNumber=e,n.secondsOfDay=t,n}function AP(e,t,n,i,o,r,s){const a=(t-14)/12|0,l=e+4800+a;let u=(1461*l/4|0)+(367*(t-2-12*a)/12|0)-(3*((l+100)/100|0)/4|0)+n-32075;i=i-12,i<0&&(i+=24);const h=r+(i*qn.SECONDS_PER_HOUR+o*qn.SECONDS_PER_MINUTE+s*qn.SECONDS_PER_MILLISECOND);return h>=43200&&(u-=1),[u,h]}const oY=/^(\d{4})$/,rY=/^(\d{4})-(\d{2})$/,sY=/^(\d{4})-?(\d{3})$/,aY=/^(\d{4})-?W(\d{2})-?(\d{1})?$/,cY=/^(\d{4})-?(\d{2})-?(\d{2})$/,xP=/([Z+\-])?(\d{2})?:?(\d{2})?$/,lY=/^(\d{2})(\.\d+)?/.source+xP.source,uY=/^(\d{2}):?(\d{2})(\.\d+)?/.source+xP.source,dY=/^(\d{2}):?(\d{2}):?(\d{2})(\.\d+)?/.source+xP.source,qc="Invalid ISO 8601 date.";function ie(e,t,n){this.dayNumber=void 0,this.secondsOfDay=void 0,e=y(e,0),t=y(t,0),n=y(n,fn.UTC);const i=e|0;t=t+(e-i)*qn.SECONDS_PER_DAY,$h(i,t,this),n===fn.UTC&&_C(this)}ie.fromGregorianDate=function(e,t){if(!(e instanceof L0))throw new E("date must be a valid GregorianDate.");const n=AP(e.year,e.month,e.day,e.hour,e.minute,e.second,e.millisecond);return c(t)?($h(n[0],n[1],t),_C(t),t):new ie(n[0],n[1],fn.UTC)};ie.fromDate=function(e,t){if(!(e instanceof Date)||isNaN(e.getTime()))throw new E("date must be a valid JavaScript Date.");const n=AP(e.getUTCFullYear(),e.getUTCMonth()+1,e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds());return c(t)?($h(n[0],n[1],t),_C(t),t):new ie(n[0],n[1],fn.UTC)};ie.fromIso8601=function(e,t){if(typeof e!="string")throw new E(qc);e=e.replace(",",".");let n=e.split("T"),i,o=1,r=1,s=0,a=0,l=0,u=0;const h=n[0],f=n[1];let _,g;if(!c(h))throw new E(qc);let m;if(n=h.match(cY),n!==null){if(m=h.split("-").length-1,m>0&&m!==2)throw new E(qc);i=+n[1],o=+n[2],r=+n[3]}else if(n=h.match(rY),n!==null)i=+n[1],o=+n[2];else if(n=h.match(oY),n!==null)i=+n[1];else{let C;if(n=h.match(sY),n!==null){if(i=+n[1],C=+n[2],g=$y(i),C<1||g&&C>366||!g&&C>365)throw new E(qc)}else if(n=h.match(aY),n!==null){i=+n[1];const w=+n[2],v=+n[3]||0;if(m=h.split("-").length-1,m>0&&(!c(n[3])&&m!==1||c(n[3])&&m!==2))throw new E(qc);const P=new Date(Date.UTC(i,0,4));C=w*7+v-P.getUTCDay()-3}else throw new E(qc);_=new Date(Date.UTC(i,0,1)),_.setUTCDate(C),o=_.getUTCMonth()+1,r=_.getUTCDate()}if(g=$y(i),o<1||o>12||r<1||(o!==2||!g)&&r>Pb[o-1]||g&&o===2&&r>Ob)throw new E(qc);let b;if(c(f)){if(n=f.match(dY),n!==null){if(m=f.split(":").length-1,m>0&&m!==2&&m!==3)throw new E(qc);s=+n[1],a=+n[2],l=+n[3],u=+(n[4]||0)*1e3,b=5}else if(n=f.match(uY),n!==null){if(m=f.split(":").length-1,m>2)throw new E(qc);s=+n[1],a=+n[2],l=+(n[3]||0)*60,b=4}else if(n=f.match(lY),n!==null)s=+n[1],a=+(n[2]||0)*60,b=3;else throw new E(qc);if(a>=60||l>=61||s>24||s===24&&(a>0||l>0||u>0))throw new E(qc);const C=n[b],w=+n[b+1],v=+(n[b+2]||0);switch(C){case"+":s=s-w,a=a-v;break;case"-":s=s+w,a=a+v;break;case"Z":break;default:a=a+new Date(Date.UTC(i,o-1,r,s,a)).getTimezoneOffset();break}}const T=l===60;for(T&&l--;a>=60;)a-=60,s++;for(;s>=24;)s-=24,r++;for(_=g&&o===2?Ob:Pb[o-1];r>_;)r-=_,o++,o>12&&(o-=12,i++),_=g&&o===2?Ob:Pb[o-1];for(;a<0;)a+=60,s--;for(;s<0;)s+=24,r--;for(;r<1;)o--,o<1&&(o+=12,i--),_=g&&o===2?Ob:Pb[o-1],r+=_;const x=AP(i,o,r,s,a,l,u);return c(t)?($h(x[0],x[1],t),_C(t)):t=new ie(x[0],x[1],fn.UTC),T&&ie.addSeconds(t,1,t),t};ie.now=function(e){return ie.fromDate(new Date,e)};const Lb=new ie(0,0,fn.TAI);ie.toGregorianDate=function(e,t){if(!c(e))throw new E("julianDate is required.");let n=!1,i=DL(e,Lb);c(i)||(ie.addSeconds(e,-1,Lb),i=DL(Lb,Lb),n=!0);let o=i.dayNumber;const r=i.secondsOfDay;r>=43200&&(o+=1);let s=o+68569|0;const a=4*s/146097|0;s=s-((146097*a+3)/4|0)|0;const l=4e3*(s+1)/1461001|0;s=s-(1461*l/4|0)+31|0;const u=80*s/2447|0,h=s-(2447*u/80|0)|0;s=u/11|0;const f=u+2-12*s|0,_=100*(a-49)+l+s|0;let g=r/qn.SECONDS_PER_HOUR|0,m=r-g*qn.SECONDS_PER_HOUR;const b=m/qn.SECONDS_PER_MINUTE|0;m=m-b*qn.SECONDS_PER_MINUTE;let T=m|0;const x=(m-T)/qn.SECONDS_PER_MILLISECOND;return g+=12,g>23&&(g-=24),n&&(T+=1),c(t)?(t.year=_,t.month=f,t.day=h,t.hour=g,t.minute=b,t.second=T,t.millisecond=x,t.isLeapSecond=n,t):new L0(_,f,h,g,b,T,x,n)};ie.toDate=function(e){if(!c(e))throw new E("julianDate is required.");const t=ie.toGregorianDate(e,pU);let n=t.second;return t.isLeapSecond&&(n-=1),new Date(Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,n,t.millisecond))};ie.toIso8601=function(e,t){if(!c(e))throw new E("julianDate is required.");const n=ie.toGregorianDate(e,pU);let i=n.year,o=n.month,r=n.day,s=n.hour;const a=n.minute,l=n.second,u=n.millisecond;i===1e4&&o===1&&r===1&&s===0&&a===0&&l===0&&u===0&&(i=9999,o=12,r=31,s=24);let h;return!c(t)&&u!==0?(h=(u*.01).toString().replace(".",""),`${i.toString().padStart(4,"0")}-${o.toString().padStart(2,"0")}-${r.toString().padStart(2,"0")}T${s.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}:${l.toString().padStart(2,"0")}.${h}Z`):!c(t)||t===0?`${i.toString().padStart(4,"0")}-${o.toString().padStart(2,"0")}-${r.toString().padStart(2,"0")}T${s.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}:${l.toString().padStart(2,"0")}Z`:(h=(u*.01).toFixed(t).replace(".","").slice(0,t),`${i.toString().padStart(4,"0")}-${o.toString().padStart(2,"0")}-${r.toString().padStart(2,"0")}T${s.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}:${l.toString().padStart(2,"0")}.${h}Z`)};ie.clone=function(e,t){if(!!c(e))return c(t)?(t.dayNumber=e.dayNumber,t.secondsOfDay=e.secondsOfDay,t):new ie(e.dayNumber,e.secondsOfDay,fn.TAI)};ie.compare=function(e,t){if(!c(e))throw new E("left is required.");if(!c(t))throw new E("right is required.");const n=e.dayNumber-t.dayNumber;return n!==0?n:e.secondsOfDay-t.secondsOfDay};ie.equals=function(e,t){return e===t||c(e)&&c(t)&&e.dayNumber===t.dayNumber&&e.secondsOfDay===t.secondsOfDay};ie.equalsEpsilon=function(e,t,n){return n=y(n,0),e===t||c(e)&&c(t)&&Math.abs(ie.secondsDifference(e,t))<=n};ie.totalDays=function(e){if(!c(e))throw new E("julianDate is required.");return e.dayNumber+e.secondsOfDay/qn.SECONDS_PER_DAY};ie.secondsDifference=function(e,t){if(!c(e))throw new E("left is required.");if(!c(t))throw new E("right is required.");return(e.dayNumber-t.dayNumber)*qn.SECONDS_PER_DAY+(e.secondsOfDay-t.secondsOfDay)};ie.daysDifference=function(e,t){if(!c(e))throw new E("left is required.");if(!c(t))throw new E("right is required.");const n=e.dayNumber-t.dayNumber,i=(e.secondsOfDay-t.secondsOfDay)/qn.SECONDS_PER_DAY;return n+i};ie.computeTaiMinusUtc=function(e){x_.julianDate=e;const t=ie.leapSeconds;let n=Hr(t,x_,TP);return n<0&&(n=~n,--n,n<0&&(n=0)),t[n].offset};ie.addSeconds=function(e,t,n){if(!c(e))throw new E("julianDate is required.");if(!c(t))throw new E("seconds is required.");if(!c(n))throw new E("result is required.");return $h(e.dayNumber,e.secondsOfDay+t,n)};ie.addMinutes=function(e,t,n){if(!c(e))throw new E("julianDate is required.");if(!c(t))throw new E("minutes is required.");if(!c(n))throw new E("result is required.");const i=e.secondsOfDay+t*qn.SECONDS_PER_MINUTE;return $h(e.dayNumber,i,n)};ie.addHours=function(e,t,n){if(!c(e))throw new E("julianDate is required.");if(!c(t))throw new E("hours is required.");if(!c(n))throw new E("result is required.");const i=e.secondsOfDay+t*qn.SECONDS_PER_HOUR;return $h(e.dayNumber,i,n)};ie.addDays=function(e,t,n){if(!c(e))throw new E("julianDate is required.");if(!c(t))throw new E("days is required.");if(!c(n))throw new E("result is required.");const i=e.dayNumber+t;return $h(i,e.secondsOfDay,n)};ie.lessThan=function(e,t){return ie.compare(e,t)<0};ie.lessThanOrEquals=function(e,t){return ie.compare(e,t)<=0};ie.greaterThan=function(e,t){return ie.compare(e,t)>0};ie.greaterThanOrEquals=function(e,t){return ie.compare(e,t)>=0};ie.prototype.clone=function(e){return ie.clone(this,e)};ie.prototype.equals=function(e){return ie.equals(this,e)};ie.prototype.equalsEpsilon=function(e,t){return ie.equalsEpsilon(this,e,t)};ie.prototype.toString=function(){return ie.toIso8601(this)};ie.leapSeconds=[new ei(new ie(2441317,43210,fn.TAI),10),new ei(new ie(2441499,43211,fn.TAI),11),new ei(new ie(2441683,43212,fn.TAI),12),new ei(new ie(2442048,43213,fn.TAI),13),new ei(new ie(2442413,43214,fn.TAI),14),new ei(new ie(2442778,43215,fn.TAI),15),new ei(new ie(2443144,43216,fn.TAI),16),new ei(new ie(2443509,43217,fn.TAI),17),new ei(new ie(2443874,43218,fn.TAI),18),new ei(new ie(2444239,43219,fn.TAI),19),new ei(new ie(2444786,43220,fn.TAI),20),new ei(new ie(2445151,43221,fn.TAI),21),new ei(new ie(2445516,43222,fn.TAI),22),new ei(new ie(2446247,43223,fn.TAI),23),new ei(new ie(2447161,43224,fn.TAI),24),new ei(new ie(2447892,43225,fn.TAI),25),new ei(new ie(2448257,43226,fn.TAI),26),new ei(new ie(2448804,43227,fn.TAI),27),new ei(new ie(2449169,43228,fn.TAI),28),new ei(new ie(2449534,43229,fn.TAI),29),new ei(new ie(2450083,43230,fn.TAI),30),new ei(new ie(2450630,43231,fn.TAI),31),new ei(new ie(2451179,43232,fn.TAI),32),new ei(new ie(2453736,43233,fn.TAI),33),new ei(new ie(2454832,43234,fn.TAI),34),new ei(new ie(2456109,43235,fn.TAI),35),new ei(new ie(2457204,43236,fn.TAI),36),new ei(new ie(2457754,43237,fn.TAI),37)];var mU={exports:{}},Rb={exports:{}};/*! https://mths.be/punycode v1.4.0 by @mathias */var PL;function hY(){return PL||(PL=1,function(e,t){(function(n){var i=t&&!t.nodeType&&t,o=e&&!e.nodeType&&e,r=typeof e_=="object"&&e_;(r.global===r||r.window===r||r.self===r)&&(n=r);var s,a=2147483647,l=36,u=1,h=26,f=38,_=700,g=72,m=128,b="-",T=/^xn--/,x=/[^\x20-\x7E]/,C=/[\x2E\u3002\uFF0E\uFF61]/g,w={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},v=l-u,P=Math.floor,N=String.fromCharCode,k;function M(W){throw new RangeError(w[W])}function U(W,X){for(var q=W.length,ee=[];q--;)ee[q]=X(W[q]);return ee}function B(W,X){var q=W.split("@"),ee="";q.length>1&&(ee=q[0]+"@",W=q[1]),W=W.replace(C,".");var Y=W.split("."),ne=U(Y,X).join(".");return ee+ne}function S(W){for(var X=[],q=0,ee=W.length,Y,ne;q<ee;)Y=W.charCodeAt(q++),Y>=55296&&Y<=56319&&q<ee?(ne=W.charCodeAt(q++),(ne&64512)==56320?X.push(((Y&1023)<<10)+(ne&1023)+65536):(X.push(Y),q--)):X.push(Y);return X}function D(W){return U(W,function(X){var q="";return X>65535&&(X-=65536,q+=N(X>>>10&1023|55296),X=56320|X&1023),q+=N(X),q}).join("")}function p(W){return W-48<10?W-22:W-65<26?W-65:W-97<26?W-97:l}function I(W,X){return W+22+75*(W<26)-((X!=0)<<5)}function O(W,X,q){var ee=0;for(W=q?P(W/_):W>>1,W+=P(W/X);W>v*h>>1;ee+=l)W=P(W/v);return P(ee+(v+1)*W/(W+f))}function F(W){var X=[],q=W.length,ee,Y=0,ne=m,Q=g,le,pe,re,de,fe,ye,Ce,we,Pe;for(le=W.lastIndexOf(b),le<0&&(le=0),pe=0;pe<le;++pe)W.charCodeAt(pe)>=128&&M("not-basic"),X.push(W.charCodeAt(pe));for(re=le>0?le+1:0;re<q;){for(de=Y,fe=1,ye=l;re>=q&&M("invalid-input"),Ce=p(W.charCodeAt(re++)),(Ce>=l||Ce>P((a-Y)/fe))&&M("overflow"),Y+=Ce*fe,we=ye<=Q?u:ye>=Q+h?h:ye-Q,!(Ce<we);ye+=l)Pe=l-we,fe>P(a/Pe)&&M("overflow"),fe*=Pe;ee=X.length+1,Q=O(Y-de,ee,de==0),P(Y/ee)>a-ne&&M("overflow"),ne+=P(Y/ee),Y%=ee,X.splice(Y++,0,ne)}return D(X)}function V(W){var X,q,ee,Y,ne,Q,le,pe,re,de,fe,ye=[],Ce,we,Pe,lt;for(W=S(W),Ce=W.length,X=m,q=0,ne=g,Q=0;Q<Ce;++Q)fe=W[Q],fe<128&&ye.push(N(fe));for(ee=Y=ye.length,Y&&ye.push(b);ee<Ce;){for(le=a,Q=0;Q<Ce;++Q)fe=W[Q],fe>=X&&fe<le&&(le=fe);for(we=ee+1,le-X>P((a-q)/we)&&M("overflow"),q+=(le-X)*we,X=le,Q=0;Q<Ce;++Q)if(fe=W[Q],fe<X&&++q>a&&M("overflow"),fe==X){for(pe=q,re=l;de=re<=ne?u:re>=ne+h?h:re-ne,!(pe<de);re+=l)lt=pe-de,Pe=l-de,ye.push(N(I(de+lt%Pe,0))),pe=P(lt/Pe);ye.push(N(I(pe,0))),ne=O(q,we,ee==Y),q=0,++ee}++q,++X}return ye.join("")}function G(W){return B(W,function(X){return T.test(X)?F(X.slice(4).toLowerCase()):X})}function j(W){return B(W,function(X){return x.test(X)?"xn--"+V(X):X})}if(s={version:"1.3.2",ucs2:{decode:S,encode:D},decode:F,encode:V,toASCII:j,toUnicode:G},i&&o)if(e.exports==i)o.exports=s;else for(k in s)s.hasOwnProperty(k)&&(i[k]=s[k]);else n.punycode=s})(e_)}(Rb,Rb.exports)),Rb.exports}var UE={exports:{}};/*!
|
|
* URI.js - Mutating URLs
|
|
* IPv6 Support
|
|
*
|
|
* Version: 1.19.11
|
|
*
|
|
* Author: Rodney Rehm
|
|
* Web: http://medialize.github.io/URI.js/
|
|
*
|
|
* Licensed under
|
|
* MIT License http://www.opensource.org/licenses/mit-license
|
|
*
|
|
*/var OL;function fY(){return OL||(OL=1,function(e){(function(t,n){e.exports?e.exports=n():t.IPv6=n(t)})(e_,function(t){var n=t&&t.IPv6;function i(r){var s=r.toLowerCase(),a=s.split(":"),l=a.length,u=8;a[0]===""&&a[1]===""&&a[2]===""?(a.shift(),a.shift()):a[0]===""&&a[1]===""?a.shift():a[l-1]===""&&a[l-2]===""&&a.pop(),l=a.length,a[l-1].indexOf(".")!==-1&&(u=7);var h;for(h=0;h<l&&a[h]!=="";h++);if(h<u)for(a.splice(h,1,"0000");a.length<u;)a.splice(h,0,"0000");for(var f,_=0;_<u;_++){f=a[_].split("");for(var g=0;g<3&&(f[0]==="0"&&f.length>1);g++)f.splice(0,1);a[_]=f.join("")}var m=-1,b=0,T=0,x=-1,C=!1;for(_=0;_<u;_++)C?a[_]==="0"?T+=1:(C=!1,T>b&&(m=x,b=T)):a[_]==="0"&&(C=!0,x=_,T=1);T>b&&(m=x,b=T),b>1&&a.splice(m,b,""),l=a.length;var w="";for(a[0]===""&&(w=":"),_=0;_<l&&(w+=a[_],_!==l-1);_++)w+=":";return a[l-1]===""&&(w+=":"),w}function o(){return t.IPv6===this&&(t.IPv6=n),this}return{best:i,noConflict:o}})}(UE)),UE.exports}var kE={exports:{}};/*!
|
|
* URI.js - Mutating URLs
|
|
* Second Level Domain (SLD) Support
|
|
*
|
|
* Version: 1.19.11
|
|
*
|
|
* Author: Rodney Rehm
|
|
* Web: http://medialize.github.io/URI.js/
|
|
*
|
|
* Licensed under
|
|
* MIT License http://www.opensource.org/licenses/mit-license
|
|
*
|
|
*/var LL;function pY(){return LL||(LL=1,function(e){(function(t,n){e.exports?e.exports=n():t.SecondLevelDomains=n(t)})(e_,function(t){var n=t&&t.SecondLevelDomains,i={list:{ac:" com gov mil net org ",ae:" ac co gov mil name net org pro sch ",af:" com edu gov net org ",al:" com edu gov mil net org ",ao:" co ed gv it og pb ",ar:" com edu gob gov int mil net org tur ",at:" ac co gv or ",au:" asn com csiro edu gov id net org ",ba:" co com edu gov mil net org rs unbi unmo unsa untz unze ",bb:" biz co com edu gov info net org store tv ",bh:" biz cc com edu gov info net org ",bn:" com edu gov net org ",bo:" com edu gob gov int mil net org tv ",br:" adm adv agr am arq art ato b bio blog bmd cim cng cnt com coop ecn edu eng esp etc eti far flog fm fnd fot fst g12 ggf gov imb ind inf jor jus lel mat med mil mus net nom not ntr odo org ppg pro psc psi qsl rec slg srv tmp trd tur tv vet vlog wiki zlg ",bs:" com edu gov net org ",bz:" du et om ov rg ",ca:" ab bc mb nb nf nl ns nt nu on pe qc sk yk ",ck:" biz co edu gen gov info net org ",cn:" ac ah bj com cq edu fj gd gov gs gx gz ha hb he hi hl hn jl js jx ln mil net nm nx org qh sc sd sh sn sx tj tw xj xz yn zj ",co:" com edu gov mil net nom org ",cr:" ac c co ed fi go or sa ",cy:" ac biz com ekloges gov ltd name net org parliament press pro tm ",do:" art com edu gob gov mil net org sld web ",dz:" art asso com edu gov net org pol ",ec:" com edu fin gov info med mil net org pro ",eg:" com edu eun gov mil name net org sci ",er:" com edu gov ind mil net org rochest w ",es:" com edu gob nom org ",et:" biz com edu gov info name net org ",fj:" ac biz com info mil name net org pro ",fk:" ac co gov net nom org ",fr:" asso com f gouv nom prd presse tm ",gg:" co net org ",gh:" com edu gov mil org ",gn:" ac com gov net org ",gr:" com edu gov mil net org ",gt:" com edu gob ind mil net org ",gu:" com edu gov net org ",hk:" com edu gov idv net org ",hu:" 2000 agrar bolt casino city co erotica erotika film forum games hotel info ingatlan jogasz konyvelo lakas media news org priv reklam sex shop sport suli szex tm tozsde utazas video ",id:" ac co go mil net or sch web ",il:" ac co gov idf k12 muni net org ",in:" ac co edu ernet firm gen gov i ind mil net nic org res ",iq:" com edu gov i mil net org ",ir:" ac co dnssec gov i id net org sch ",it:" edu gov ",je:" co net org ",jo:" com edu gov mil name net org sch ",jp:" ac ad co ed go gr lg ne or ",ke:" ac co go info me mobi ne or sc ",kh:" com edu gov mil net org per ",ki:" biz com de edu gov info mob net org tel ",km:" asso com coop edu gouv k medecin mil nom notaires pharmaciens presse tm veterinaire ",kn:" edu gov net org ",kr:" ac busan chungbuk chungnam co daegu daejeon es gangwon go gwangju gyeongbuk gyeonggi gyeongnam hs incheon jeju jeonbuk jeonnam k kg mil ms ne or pe re sc seoul ulsan ",kw:" com edu gov net org ",ky:" com edu gov net org ",kz:" com edu gov mil net org ",lb:" com edu gov net org ",lk:" assn com edu gov grp hotel int ltd net ngo org sch soc web ",lr:" com edu gov net org ",lv:" asn com conf edu gov id mil net org ",ly:" com edu gov id med net org plc sch ",ma:" ac co gov m net org press ",mc:" asso tm ",me:" ac co edu gov its net org priv ",mg:" com edu gov mil nom org prd tm ",mk:" com edu gov inf name net org pro ",ml:" com edu gov net org presse ",mn:" edu gov org ",mo:" com edu gov net org ",mt:" com edu gov net org ",mv:" aero biz com coop edu gov info int mil museum name net org pro ",mw:" ac co com coop edu gov int museum net org ",mx:" com edu gob net org ",my:" com edu gov mil name net org sch ",nf:" arts com firm info net other per rec store web ",ng:" biz com edu gov mil mobi name net org sch ",ni:" ac co com edu gob mil net nom org ",np:" com edu gov mil net org ",nr:" biz com edu gov info net org ",om:" ac biz co com edu gov med mil museum net org pro sch ",pe:" com edu gob mil net nom org sld ",ph:" com edu gov i mil net ngo org ",pk:" biz com edu fam gob gok gon gop gos gov net org web ",pl:" art bialystok biz com edu gda gdansk gorzow gov info katowice krakow lodz lublin mil net ngo olsztyn org poznan pwr radom slupsk szczecin torun warszawa waw wroc wroclaw zgora ",pr:" ac biz com edu est gov info isla name net org pro prof ",ps:" com edu gov net org plo sec ",pw:" belau co ed go ne or ",ro:" arts com firm info nom nt org rec store tm www ",rs:" ac co edu gov in org ",sb:" com edu gov net org ",sc:" com edu gov net org ",sh:" co com edu gov net nom org ",sl:" com edu gov net org ",st:" co com consulado edu embaixada gov mil net org principe saotome store ",sv:" com edu gob org red ",sz:" ac co org ",tr:" av bbs bel biz com dr edu gen gov info k12 name net org pol tel tsk tv web ",tt:" aero biz cat co com coop edu gov info int jobs mil mobi museum name net org pro tel travel ",tw:" club com ebiz edu game gov idv mil net org ",mu:" ac co com gov net or org ",mz:" ac co edu gov org ",na:" co com ",nz:" ac co cri geek gen govt health iwi maori mil net org parliament school ",pa:" abo ac com edu gob ing med net nom org sld ",pt:" com edu gov int net nome org publ ",py:" com edu gov mil net org ",qa:" com edu gov mil net org ",re:" asso com nom ",ru:" ac adygeya altai amur arkhangelsk astrakhan bashkiria belgorod bir bryansk buryatia cbg chel chelyabinsk chita chukotka chuvashia com dagestan e-burg edu gov grozny int irkutsk ivanovo izhevsk jar joshkar-ola kalmykia kaluga kamchatka karelia kazan kchr kemerovo khabarovsk khakassia khv kirov koenig komi kostroma kranoyarsk kuban kurgan kursk lipetsk magadan mari mari-el marine mil mordovia mosreg msk murmansk nalchik net nnov nov novosibirsk nsk omsk orenburg org oryol penza perm pp pskov ptz rnd ryazan sakhalin samara saratov simbirsk smolensk spb stavropol stv surgut tambov tatarstan tom tomsk tsaritsyn tsk tula tuva tver tyumen udm udmurtia ulan-ude vladikavkaz vladimir vladivostok volgograd vologda voronezh vrn vyatka yakutia yamal yekaterinburg yuzhno-sakhalinsk ",rw:" ac co com edu gouv gov int mil net ",sa:" com edu gov med net org pub sch ",sd:" com edu gov info med net org tv ",se:" a ac b bd c d e f g h i k l m n o org p parti pp press r s t tm u w x y z ",sg:" com edu gov idn net org per ",sn:" art com edu gouv org perso univ ",sy:" com edu gov mil net news org ",th:" ac co go in mi net or ",tj:" ac biz co com edu go gov info int mil name net nic org test web ",tn:" agrinet com defense edunet ens fin gov ind info intl mincom nat net org perso rnrt rns rnu tourism ",tz:" ac co go ne or ",ua:" biz cherkassy chernigov chernovtsy ck cn co com crimea cv dn dnepropetrovsk donetsk dp edu gov if in ivano-frankivsk kh kharkov kherson khmelnitskiy kiev kirovograd km kr ks kv lg lugansk lutsk lviv me mk net nikolaev od odessa org pl poltava pp rovno rv sebastopol sumy te ternopil uzhgorod vinnica vn zaporizhzhe zhitomir zp zt ",ug:" ac co go ne or org sc ",uk:" ac bl british-library co cym gov govt icnet jet lea ltd me mil mod national-library-scotland nel net nhs nic nls org orgn parliament plc police sch scot soc ",us:" dni fed isa kids nsn ",uy:" com edu gub mil net org ",ve:" co com edu gob info mil net org web ",vi:" co com k12 net org ",vn:" ac biz com edu gov health info int name net org pro ",ye:" co com gov ltd me net org plc ",yu:" ac co edu gov org ",za:" ac agric alt bourse city co cybernet db edu gov grondar iaccess imt inca landesign law mil net ngo nis nom olivetti org pix school tm web ",zm:" ac co com edu gov net org sch ",com:"ar br cn de eu gb gr hu jpn kr no qc ru sa se uk us uy za ",net:"gb jp se uk ",org:"ae",de:"com "},has:function(o){var r=o.lastIndexOf(".");if(r<=0||r>=o.length-1)return!1;var s=o.lastIndexOf(".",r-1);if(s<=0||s>=r-1)return!1;var a=i.list[o.slice(r+1)];return a?a.indexOf(" "+o.slice(s+1,r)+" ")>=0:!1},is:function(o){var r=o.lastIndexOf(".");if(r<=0||r>=o.length-1)return!1;var s=o.lastIndexOf(".",r-1);if(s>=0)return!1;var a=i.list[o.slice(r+1)];return a?a.indexOf(" "+o.slice(0,r)+" ")>=0:!1},get:function(o){var r=o.lastIndexOf(".");if(r<=0||r>=o.length-1)return null;var s=o.lastIndexOf(".",r-1);if(s<=0||s>=r-1)return null;var a=i.list[o.slice(r+1)];return!a||a.indexOf(" "+o.slice(s+1,r)+" ")<0?null:o.slice(s+1)},noConflict:function(){return t.SecondLevelDomains===this&&(t.SecondLevelDomains=n),this}};return i})}(kE)),kE.exports}/*!
|
|
* URI.js - Mutating URLs
|
|
*
|
|
* Version: 1.19.11
|
|
*
|
|
* Author: Rodney Rehm
|
|
* Web: http://medialize.github.io/URI.js/
|
|
*
|
|
* Licensed under
|
|
* MIT License http://www.opensource.org/licenses/mit-license
|
|
*
|
|
*/(function(e){(function(t,n){e.exports?e.exports=n(hY(),fY(),pY()):t.URI=n(t.punycode,t.IPv6,t.SecondLevelDomains,t)})(e_,function(t,n,i,o){var r=o&&o.URI;function s(p,I){var O=arguments.length>=1,F=arguments.length>=2;if(!(this instanceof s))return O?F?new s(p,I):new s(p):new s;if(p===void 0){if(O)throw new TypeError("undefined is not a valid argument for URI");typeof location<"u"?p=location.href+"":p=""}if(p===null&&O)throw new TypeError("null is not a valid argument for URI");return this.href(p),I!==void 0?this.absoluteTo(I):this}function a(p){return/^[0-9]+$/.test(p)}s.version="1.19.11";var l=s.prototype,u=Object.prototype.hasOwnProperty;function h(p){return p.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}function f(p){return p===void 0?"Undefined":String(Object.prototype.toString.call(p)).slice(8,-1)}function _(p){return f(p)==="Array"}function g(p,I){var O={},F,V;if(f(I)==="RegExp")O=null;else if(_(I))for(F=0,V=I.length;F<V;F++)O[I[F]]=!0;else O[I]=!0;for(F=0,V=p.length;F<V;F++){var G=O&&O[p[F]]!==void 0||!O&&I.test(p[F]);G&&(p.splice(F,1),V--,F--)}return p}function m(p,I){var O,F;if(_(I)){for(O=0,F=I.length;O<F;O++)if(!m(p,I[O]))return!1;return!0}var V=f(I);for(O=0,F=p.length;O<F;O++)if(V==="RegExp"){if(typeof p[O]=="string"&&p[O].match(I))return!0}else if(p[O]===I)return!0;return!1}function b(p,I){if(!_(p)||!_(I)||p.length!==I.length)return!1;p.sort(),I.sort();for(var O=0,F=p.length;O<F;O++)if(p[O]!==I[O])return!1;return!0}function T(p){var I=/^\/+|\/+$/g;return p.replace(I,"")}s._parts=function(){return{protocol:null,username:null,password:null,hostname:null,urn:null,port:null,path:null,query:null,fragment:null,preventInvalidHostname:s.preventInvalidHostname,duplicateQueryParameters:s.duplicateQueryParameters,escapeQuerySpace:s.escapeQuerySpace}},s.preventInvalidHostname=!1,s.duplicateQueryParameters=!1,s.escapeQuerySpace=!0,s.protocol_expression=/^[a-z][a-z0-9.+-]*$/i,s.idn_expression=/[^a-z0-9\._-]/i,s.punycode_expression=/(xn--)/i,s.ip4_expression=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,s.ip6_expression=/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/,s.find_uri_expression=/\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/ig,s.findUri={start:/\b(?:([a-z][a-z0-9.+-]*:\/\/)|www\.)/gi,end:/[\s\r\n]|$/,trim:/[`!()\[\]{};:'".,<>?«»“”„‘’]+$/,parens:/(\([^\)]*\)|\[[^\]]*\]|\{[^}]*\}|<[^>]*>)/g},s.leading_whitespace_expression=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,s.ascii_tab_whitespace=/[\u0009\u000A\u000D]+/g,s.defaultPorts={http:"80",https:"443",ftp:"21",gopher:"70",ws:"80",wss:"443"},s.hostProtocols=["http","https"],s.invalid_hostname_characters=/[^a-zA-Z0-9\.\-:_]/,s.domAttributes={a:"href",blockquote:"cite",link:"href",base:"href",script:"src",form:"action",img:"src",area:"href",iframe:"src",embed:"src",source:"src",track:"src",input:"src",audio:"src",video:"src"},s.getDomAttribute=function(p){if(!(!p||!p.nodeName)){var I=p.nodeName.toLowerCase();if(!(I==="input"&&p.type!=="image"))return s.domAttributes[I]}};function x(p){return escape(p)}function C(p){return encodeURIComponent(p).replace(/[!'()*]/g,x).replace(/\*/g,"%2A")}s.encode=C,s.decode=decodeURIComponent,s.iso8859=function(){s.encode=escape,s.decode=unescape},s.unicode=function(){s.encode=C,s.decode=decodeURIComponent},s.characters={pathname:{encode:{expression:/%(24|26|2B|2C|3B|3D|3A|40)/ig,map:{"%24":"$","%26":"&","%2B":"+","%2C":",","%3B":";","%3D":"=","%3A":":","%40":"@"}},decode:{expression:/[\/\?#]/g,map:{"/":"%2F","?":"%3F","#":"%23"}}},reserved:{encode:{expression:/%(21|23|24|26|27|28|29|2A|2B|2C|2F|3A|3B|3D|3F|40|5B|5D)/ig,map:{"%3A":":","%2F":"/","%3F":"?","%23":"#","%5B":"[","%5D":"]","%40":"@","%21":"!","%24":"$","%26":"&","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";","%3D":"="}}},urnpath:{encode:{expression:/%(21|24|27|28|29|2A|2B|2C|3B|3D|40)/ig,map:{"%21":"!","%24":"$","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";","%3D":"=","%40":"@"}},decode:{expression:/[\/\?#:]/g,map:{"/":"%2F","?":"%3F","#":"%23",":":"%3A"}}}},s.encodeQuery=function(p,I){var O=s.encode(p+"");return I===void 0&&(I=s.escapeQuerySpace),I?O.replace(/%20/g,"+"):O},s.decodeQuery=function(p,I){p+="",I===void 0&&(I=s.escapeQuerySpace);try{return s.decode(I?p.replace(/\+/g,"%20"):p)}catch{return p}};var w={encode:"encode",decode:"decode"},v,P=function(p,I){return function(O){try{return s[I](O+"").replace(s.characters[p][I].expression,function(F){return s.characters[p][I].map[F]})}catch{return O}}};for(v in w)s[v+"PathSegment"]=P("pathname",w[v]),s[v+"UrnPathSegment"]=P("urnpath",w[v]);var N=function(p,I,O){return function(F){var V;O?V=function(X){return s[I](s[O](X))}:V=s[I];for(var G=(F+"").split(p),j=0,W=G.length;j<W;j++)G[j]=V(G[j]);return G.join(p)}};s.decodePath=N("/","decodePathSegment"),s.decodeUrnPath=N(":","decodeUrnPathSegment"),s.recodePath=N("/","encodePathSegment","decode"),s.recodeUrnPath=N(":","encodeUrnPathSegment","decode"),s.encodeReserved=P("reserved","encode"),s.parse=function(p,I){var O;return I||(I={preventInvalidHostname:s.preventInvalidHostname}),p=p.replace(s.leading_whitespace_expression,""),p=p.replace(s.ascii_tab_whitespace,""),O=p.indexOf("#"),O>-1&&(I.fragment=p.substring(O+1)||null,p=p.substring(0,O)),O=p.indexOf("?"),O>-1&&(I.query=p.substring(O+1)||null,p=p.substring(0,O)),p=p.replace(/^(https?|ftp|wss?)?:+[/\\]*/i,"$1://"),p=p.replace(/^[/\\]{2,}/i,"//"),p.substring(0,2)==="//"?(I.protocol=null,p=p.substring(2),p=s.parseAuthority(p,I)):(O=p.indexOf(":"),O>-1&&(I.protocol=p.substring(0,O)||null,I.protocol&&!I.protocol.match(s.protocol_expression)?I.protocol=void 0:p.substring(O+1,O+3).replace(/\\/g,"/")==="//"?(p=p.substring(O+3),p=s.parseAuthority(p,I)):(p=p.substring(O+1),I.urn=!0))),I.path=p,I},s.parseHost=function(p,I){p||(p=""),p=p.replace(/\\/g,"/");var O=p.indexOf("/"),F,V;if(O===-1&&(O=p.length),p.charAt(0)==="[")F=p.indexOf("]"),I.hostname=p.substring(1,F)||null,I.port=p.substring(F+2,O)||null,I.port==="/"&&(I.port=null);else{var G=p.indexOf(":"),j=p.indexOf("/"),W=p.indexOf(":",G+1);W!==-1&&(j===-1||W<j)?(I.hostname=p.substring(0,O)||null,I.port=null):(V=p.substring(0,O).split(":"),I.hostname=V[0]||null,I.port=V[1]||null)}return I.hostname&&p.substring(O).charAt(0)!=="/"&&(O++,p="/"+p),I.preventInvalidHostname&&s.ensureValidHostname(I.hostname,I.protocol),I.port&&s.ensureValidPort(I.port),p.substring(O)||"/"},s.parseAuthority=function(p,I){return p=s.parseUserinfo(p,I),s.parseHost(p,I)},s.parseUserinfo=function(p,I){var O=p,F=p.indexOf("\\");F!==-1&&(p=p.replace(/\\/g,"/"));var V=p.indexOf("/"),G=p.lastIndexOf("@",V>-1?V:p.length-1),j;return G>-1&&(V===-1||G<V)?(j=p.substring(0,G).split(":"),I.username=j[0]?s.decode(j[0]):null,j.shift(),I.password=j[0]?s.decode(j.join(":")):null,p=O.substring(G+1)):(I.username=null,I.password=null),p},s.parseQuery=function(p,I){if(!p)return{};if(p=p.replace(/&+/g,"&").replace(/^\?*&*|&+$/g,""),!p)return{};for(var O={},F=p.split("&"),V=F.length,G,j,W,X=0;X<V;X++)G=F[X].split("="),j=s.decodeQuery(G.shift(),I),W=G.length?s.decodeQuery(G.join("="),I):null,j!=="__proto__"&&(u.call(O,j)?((typeof O[j]=="string"||O[j]===null)&&(O[j]=[O[j]]),O[j].push(W)):O[j]=W);return O},s.build=function(p){var I="",O=!1;return p.protocol&&(I+=p.protocol+":"),!p.urn&&(I||p.hostname)&&(I+="//",O=!0),I+=s.buildAuthority(p)||"",typeof p.path=="string"&&(p.path.charAt(0)!=="/"&&O&&(I+="/"),I+=p.path),typeof p.query=="string"&&p.query&&(I+="?"+p.query),typeof p.fragment=="string"&&p.fragment&&(I+="#"+p.fragment),I},s.buildHost=function(p){var I="";if(p.hostname)s.ip6_expression.test(p.hostname)?I+="["+p.hostname+"]":I+=p.hostname;else return"";return p.port&&(I+=":"+p.port),I},s.buildAuthority=function(p){return s.buildUserinfo(p)+s.buildHost(p)},s.buildUserinfo=function(p){var I="";return p.username&&(I+=s.encode(p.username)),p.password&&(I+=":"+s.encode(p.password)),I&&(I+="@"),I},s.buildQuery=function(p,I,O){var F="",V,G,j,W;for(G in p)if(G!=="__proto__"&&u.call(p,G))if(_(p[G]))for(V={},j=0,W=p[G].length;j<W;j++)p[G][j]!==void 0&&V[p[G][j]+""]===void 0&&(F+="&"+s.buildQueryParameter(G,p[G][j],O),I!==!0&&(V[p[G][j]+""]=!0));else p[G]!==void 0&&(F+="&"+s.buildQueryParameter(G,p[G],O));return F.substring(1)},s.buildQueryParameter=function(p,I,O){return s.encodeQuery(p,O)+(I!==null?"="+s.encodeQuery(I,O):"")},s.addQuery=function(p,I,O){if(typeof I=="object")for(var F in I)u.call(I,F)&&s.addQuery(p,F,I[F]);else if(typeof I=="string"){if(p[I]===void 0){p[I]=O;return}else typeof p[I]=="string"&&(p[I]=[p[I]]);_(O)||(O=[O]),p[I]=(p[I]||[]).concat(O)}else throw new TypeError("URI.addQuery() accepts an object, string as the name parameter")},s.setQuery=function(p,I,O){if(typeof I=="object")for(var F in I)u.call(I,F)&&s.setQuery(p,F,I[F]);else if(typeof I=="string")p[I]=O===void 0?null:O;else throw new TypeError("URI.setQuery() accepts an object, string as the name parameter")},s.removeQuery=function(p,I,O){var F,V,G;if(_(I))for(F=0,V=I.length;F<V;F++)p[I[F]]=void 0;else if(f(I)==="RegExp")for(G in p)I.test(G)&&(p[G]=void 0);else if(typeof I=="object")for(G in I)u.call(I,G)&&s.removeQuery(p,G,I[G]);else if(typeof I=="string")O!==void 0?f(O)==="RegExp"?!_(p[I])&&O.test(p[I])?p[I]=void 0:p[I]=g(p[I],O):p[I]===String(O)&&(!_(O)||O.length===1)?p[I]=void 0:_(p[I])&&(p[I]=g(p[I],O)):p[I]=void 0;else throw new TypeError("URI.removeQuery() accepts an object, string, RegExp as the first parameter")},s.hasQuery=function(p,I,O,F){switch(f(I)){case"String":break;case"RegExp":for(var V in p)if(u.call(p,V)&&I.test(V)&&(O===void 0||s.hasQuery(p,V,O)))return!0;return!1;case"Object":for(var G in I)if(u.call(I,G)&&!s.hasQuery(p,G,I[G]))return!1;return!0;default:throw new TypeError("URI.hasQuery() accepts a string, regular expression or object as the name parameter")}switch(f(O)){case"Undefined":return I in p;case"Boolean":var j=Boolean(_(p[I])?p[I].length:p[I]);return O===j;case"Function":return!!O(p[I],I,p);case"Array":if(!_(p[I]))return!1;var W=F?m:b;return W(p[I],O);case"RegExp":return _(p[I])?F?m(p[I],O):!1:Boolean(p[I]&&p[I].match(O));case"Number":O=String(O);case"String":return _(p[I])?F?m(p[I],O):!1:p[I]===O;default:throw new TypeError("URI.hasQuery() accepts undefined, boolean, string, number, RegExp, Function as the value parameter")}},s.joinPaths=function(){for(var p=[],I=[],O=0,F=0;F<arguments.length;F++){var V=new s(arguments[F]);p.push(V);for(var G=V.segment(),j=0;j<G.length;j++)typeof G[j]=="string"&&I.push(G[j]),G[j]&&O++}if(!I.length||!O)return new s("");var W=new s("").segment(I);return(p[0].path()===""||p[0].path().slice(0,1)==="/")&&W.path("/"+W.path()),W.normalize()},s.commonPath=function(p,I){var O=Math.min(p.length,I.length),F;for(F=0;F<O;F++)if(p.charAt(F)!==I.charAt(F)){F--;break}return F<1?p.charAt(0)===I.charAt(0)&&p.charAt(0)==="/"?"/":"":((p.charAt(F)!=="/"||I.charAt(F)!=="/")&&(F=p.substring(0,F).lastIndexOf("/")),p.substring(0,F+1))},s.withinString=function(p,I,O){O||(O={});var F=O.start||s.findUri.start,V=O.end||s.findUri.end,G=O.trim||s.findUri.trim,j=O.parens||s.findUri.parens,W=/[a-z0-9-]=["']?$/i;for(F.lastIndex=0;;){var X=F.exec(p);if(!X)break;var q=X.index;if(O.ignoreHtml){var ee=p.slice(Math.max(q-3,0),q);if(ee&&W.test(ee))continue}for(var Y=q+p.slice(q).search(V),ne=p.slice(q,Y),Q=-1;;){var le=j.exec(ne);if(!le)break;var pe=le.index+le[0].length;Q=Math.max(Q,pe)}if(Q>-1?ne=ne.slice(0,Q)+ne.slice(Q).replace(G,""):ne=ne.replace(G,""),!(ne.length<=X[0].length)&&!(O.ignore&&O.ignore.test(ne))){Y=q+ne.length;var re=I(ne,q,Y,p);if(re===void 0){F.lastIndex=Y;continue}re=String(re),p=p.slice(0,q)+re+p.slice(Y),F.lastIndex=q+re.length}}return F.lastIndex=0,p},s.ensureValidHostname=function(p,I){var O=!!p,F=!!I,V=!1;if(F&&(V=m(s.hostProtocols,I)),V&&!O)throw new TypeError("Hostname cannot be empty, if protocol is "+I);if(p&&p.match(s.invalid_hostname_characters)){if(!t)throw new TypeError('Hostname "'+p+'" contains characters other than [A-Z0-9.-:_] and Punycode.js is not available');if(t.toASCII(p).match(s.invalid_hostname_characters))throw new TypeError('Hostname "'+p+'" contains characters other than [A-Z0-9.-:_]')}},s.ensureValidPort=function(p){if(!!p){var I=Number(p);if(!(a(I)&&I>0&&I<65536))throw new TypeError('Port "'+p+'" is not a valid port')}},s.noConflict=function(p){if(p){var I={URI:this.noConflict()};return o.URITemplate&&typeof o.URITemplate.noConflict=="function"&&(I.URITemplate=o.URITemplate.noConflict()),o.IPv6&&typeof o.IPv6.noConflict=="function"&&(I.IPv6=o.IPv6.noConflict()),o.SecondLevelDomains&&typeof o.SecondLevelDomains.noConflict=="function"&&(I.SecondLevelDomains=o.SecondLevelDomains.noConflict()),I}else o.URI===this&&(o.URI=r);return this},l.build=function(p){return p===!0?this._deferred_build=!0:(p===void 0||this._deferred_build)&&(this._string=s.build(this._parts),this._deferred_build=!1),this},l.clone=function(){return new s(this)},l.valueOf=l.toString=function(){return this.build(!1)._string};function k(p){return function(I,O){return I===void 0?this._parts[p]||"":(this._parts[p]=I||null,this.build(!O),this)}}function M(p,I){return function(O,F){return O===void 0?this._parts[p]||"":(O!==null&&(O=O+"",O.charAt(0)===I&&(O=O.substring(1))),this._parts[p]=O,this.build(!F),this)}}l.protocol=k("protocol"),l.username=k("username"),l.password=k("password"),l.hostname=k("hostname"),l.port=k("port"),l.query=M("query","?"),l.fragment=M("fragment","#"),l.search=function(p,I){var O=this.query(p,I);return typeof O=="string"&&O.length?"?"+O:O},l.hash=function(p,I){var O=this.fragment(p,I);return typeof O=="string"&&O.length?"#"+O:O},l.pathname=function(p,I){if(p===void 0||p===!0){var O=this._parts.path||(this._parts.hostname?"/":"");return p?(this._parts.urn?s.decodeUrnPath:s.decodePath)(O):O}else return this._parts.urn?this._parts.path=p?s.recodeUrnPath(p):"":this._parts.path=p?s.recodePath(p):"/",this.build(!I),this},l.path=l.pathname,l.href=function(p,I){var O;if(p===void 0)return this.toString();this._string="",this._parts=s._parts();var F=p instanceof s,V=typeof p=="object"&&(p.hostname||p.path||p.pathname);if(p.nodeName){var G=s.getDomAttribute(p);p=p[G]||"",V=!1}if(!F&&V&&p.pathname!==void 0&&(p=p.toString()),typeof p=="string"||p instanceof String)this._parts=s.parse(String(p),this._parts);else if(F||V){var j=F?p._parts:p;for(O in j)O!=="query"&&u.call(this._parts,O)&&(this._parts[O]=j[O]);j.query&&this.query(j.query,!1)}else throw new TypeError("invalid input");return this.build(!I),this},l.is=function(p){var I=!1,O=!1,F=!1,V=!1,G=!1,j=!1,W=!1,X=!this._parts.urn;switch(this._parts.hostname&&(X=!1,O=s.ip4_expression.test(this._parts.hostname),F=s.ip6_expression.test(this._parts.hostname),I=O||F,V=!I,G=V&&i&&i.has(this._parts.hostname),j=V&&s.idn_expression.test(this._parts.hostname),W=V&&s.punycode_expression.test(this._parts.hostname)),p.toLowerCase()){case"relative":return X;case"absolute":return!X;case"domain":case"name":return V;case"sld":return G;case"ip":return I;case"ip4":case"ipv4":case"inet4":return O;case"ip6":case"ipv6":case"inet6":return F;case"idn":return j;case"url":return!this._parts.urn;case"urn":return!!this._parts.urn;case"punycode":return W}return null};var U=l.protocol,B=l.port,S=l.hostname;l.protocol=function(p,I){if(p&&(p=p.replace(/:(\/\/)?$/,""),!p.match(s.protocol_expression)))throw new TypeError('Protocol "'+p+`" contains characters other than [A-Z0-9.+-] or doesn't start with [A-Z]`);return U.call(this,p,I)},l.scheme=l.protocol,l.port=function(p,I){return this._parts.urn?p===void 0?"":this:(p!==void 0&&(p===0&&(p=null),p&&(p+="",p.charAt(0)===":"&&(p=p.substring(1)),s.ensureValidPort(p))),B.call(this,p,I))},l.hostname=function(p,I){if(this._parts.urn)return p===void 0?"":this;if(p!==void 0){var O={preventInvalidHostname:this._parts.preventInvalidHostname},F=s.parseHost(p,O);if(F!=="/")throw new TypeError('Hostname "'+p+'" contains characters other than [A-Z0-9.-]');p=O.hostname,this._parts.preventInvalidHostname&&s.ensureValidHostname(p,this._parts.protocol)}return S.call(this,p,I)},l.origin=function(p,I){if(this._parts.urn)return p===void 0?"":this;if(p===void 0){var O=this.protocol(),F=this.authority();return F?(O?O+"://":"")+this.authority():""}else{var V=s(p);return this.protocol(V.protocol()).authority(V.authority()).build(!I),this}},l.host=function(p,I){if(this._parts.urn)return p===void 0?"":this;if(p===void 0)return this._parts.hostname?s.buildHost(this._parts):"";var O=s.parseHost(p,this._parts);if(O!=="/")throw new TypeError('Hostname "'+p+'" contains characters other than [A-Z0-9.-]');return this.build(!I),this},l.authority=function(p,I){if(this._parts.urn)return p===void 0?"":this;if(p===void 0)return this._parts.hostname?s.buildAuthority(this._parts):"";var O=s.parseAuthority(p,this._parts);if(O!=="/")throw new TypeError('Hostname "'+p+'" contains characters other than [A-Z0-9.-]');return this.build(!I),this},l.userinfo=function(p,I){if(this._parts.urn)return p===void 0?"":this;if(p===void 0){var O=s.buildUserinfo(this._parts);return O&&O.substring(0,O.length-1)}else return p[p.length-1]!=="@"&&(p+="@"),s.parseUserinfo(p,this._parts),this.build(!I),this},l.resource=function(p,I){var O;return p===void 0?this.path()+this.search()+this.hash():(O=s.parse(p),this._parts.path=O.path,this._parts.query=O.query,this._parts.fragment=O.fragment,this.build(!I),this)},l.subdomain=function(p,I){if(this._parts.urn)return p===void 0?"":this;if(p===void 0){if(!this._parts.hostname||this.is("IP"))return"";var O=this._parts.hostname.length-this.domain().length-1;return this._parts.hostname.substring(0,O)||""}else{var F=this._parts.hostname.length-this.domain().length,V=this._parts.hostname.substring(0,F),G=new RegExp("^"+h(V));if(p&&p.charAt(p.length-1)!=="."&&(p+="."),p.indexOf(":")!==-1)throw new TypeError("Domains cannot contain colons");return p&&s.ensureValidHostname(p,this._parts.protocol),this._parts.hostname=this._parts.hostname.replace(G,p),this.build(!I),this}},l.domain=function(p,I){if(this._parts.urn)return p===void 0?"":this;if(typeof p=="boolean"&&(I=p,p=void 0),p===void 0){if(!this._parts.hostname||this.is("IP"))return"";var O=this._parts.hostname.match(/\./g);if(O&&O.length<2)return this._parts.hostname;var F=this._parts.hostname.length-this.tld(I).length-1;return F=this._parts.hostname.lastIndexOf(".",F-1)+1,this._parts.hostname.substring(F)||""}else{if(!p)throw new TypeError("cannot set domain empty");if(p.indexOf(":")!==-1)throw new TypeError("Domains cannot contain colons");if(s.ensureValidHostname(p,this._parts.protocol),!this._parts.hostname||this.is("IP"))this._parts.hostname=p;else{var V=new RegExp(h(this.domain())+"$");this._parts.hostname=this._parts.hostname.replace(V,p)}return this.build(!I),this}},l.tld=function(p,I){if(this._parts.urn)return p===void 0?"":this;if(typeof p=="boolean"&&(I=p,p=void 0),p===void 0){if(!this._parts.hostname||this.is("IP"))return"";var O=this._parts.hostname.lastIndexOf("."),F=this._parts.hostname.substring(O+1);return I!==!0&&i&&i.list[F.toLowerCase()]&&i.get(this._parts.hostname)||F}else{var V;if(p)if(p.match(/[^a-zA-Z0-9-]/))if(i&&i.is(p))V=new RegExp(h(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(V,p);else throw new TypeError('TLD "'+p+'" contains characters other than [A-Z0-9]');else{if(!this._parts.hostname||this.is("IP"))throw new ReferenceError("cannot set TLD on non-domain host");V=new RegExp(h(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(V,p)}else throw new TypeError("cannot set TLD empty");return this.build(!I),this}},l.directory=function(p,I){if(this._parts.urn)return p===void 0?"":this;if(p===void 0||p===!0){if(!this._parts.path&&!this._parts.hostname)return"";if(this._parts.path==="/")return"/";var O=this._parts.path.length-this.filename().length-1,F=this._parts.path.substring(0,O)||(this._parts.hostname?"/":"");return p?s.decodePath(F):F}else{var V=this._parts.path.length-this.filename().length,G=this._parts.path.substring(0,V),j=new RegExp("^"+h(G));return this.is("relative")||(p||(p="/"),p.charAt(0)!=="/"&&(p="/"+p)),p&&p.charAt(p.length-1)!=="/"&&(p+="/"),p=s.recodePath(p),this._parts.path=this._parts.path.replace(j,p),this.build(!I),this}},l.filename=function(p,I){if(this._parts.urn)return p===void 0?"":this;if(typeof p!="string"){if(!this._parts.path||this._parts.path==="/")return"";var O=this._parts.path.lastIndexOf("/"),F=this._parts.path.substring(O+1);return p?s.decodePathSegment(F):F}else{var V=!1;p.charAt(0)==="/"&&(p=p.substring(1)),p.match(/\.?\//)&&(V=!0);var G=new RegExp(h(this.filename())+"$");return p=s.recodePath(p),this._parts.path=this._parts.path.replace(G,p),V?this.normalizePath(I):this.build(!I),this}},l.suffix=function(p,I){if(this._parts.urn)return p===void 0?"":this;if(p===void 0||p===!0){if(!this._parts.path||this._parts.path==="/")return"";var O=this.filename(),F=O.lastIndexOf("."),V,G;return F===-1?"":(V=O.substring(F+1),G=/^[a-z0-9%]+$/i.test(V)?V:"",p?s.decodePathSegment(G):G)}else{p.charAt(0)==="."&&(p=p.substring(1));var j=this.suffix(),W;if(j)p?W=new RegExp(h(j)+"$"):W=new RegExp(h("."+j)+"$");else{if(!p)return this;this._parts.path+="."+s.recodePath(p)}return W&&(p=s.recodePath(p),this._parts.path=this._parts.path.replace(W,p)),this.build(!I),this}},l.segment=function(p,I,O){var F=this._parts.urn?":":"/",V=this.path(),G=V.substring(0,1)==="/",j=V.split(F);if(p!==void 0&&typeof p!="number"&&(O=I,I=p,p=void 0),p!==void 0&&typeof p!="number")throw new Error('Bad segment "'+p+'", must be 0-based integer');if(G&&j.shift(),p<0&&(p=Math.max(j.length+p,0)),I===void 0)return p===void 0?j:j[p];if(p===null||j[p]===void 0)if(_(I)){j=[];for(var W=0,X=I.length;W<X;W++)!I[W].length&&(!j.length||!j[j.length-1].length)||(j.length&&!j[j.length-1].length&&j.pop(),j.push(T(I[W])))}else(I||typeof I=="string")&&(I=T(I),j[j.length-1]===""?j[j.length-1]=I:j.push(I));else I?j[p]=T(I):j.splice(p,1);return G&&j.unshift(""),this.path(j.join(F),O)},l.segmentCoded=function(p,I,O){var F,V,G;if(typeof p!="number"&&(O=I,I=p,p=void 0),I===void 0){if(F=this.segment(p,I,O),!_(F))F=F!==void 0?s.decode(F):void 0;else for(V=0,G=F.length;V<G;V++)F[V]=s.decode(F[V]);return F}if(!_(I))I=typeof I=="string"||I instanceof String?s.encode(I):I;else for(V=0,G=I.length;V<G;V++)I[V]=s.encode(I[V]);return this.segment(p,I,O)};var D=l.query;return l.query=function(p,I){if(p===!0)return s.parseQuery(this._parts.query,this._parts.escapeQuerySpace);if(typeof p=="function"){var O=s.parseQuery(this._parts.query,this._parts.escapeQuerySpace),F=p.call(this,O);return this._parts.query=s.buildQuery(F||O,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),this.build(!I),this}else return p!==void 0&&typeof p!="string"?(this._parts.query=s.buildQuery(p,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),this.build(!I),this):D.call(this,p,I)},l.setQuery=function(p,I,O){var F=s.parseQuery(this._parts.query,this._parts.escapeQuerySpace);if(typeof p=="string"||p instanceof String)F[p]=I!==void 0?I:null;else if(typeof p=="object")for(var V in p)u.call(p,V)&&(F[V]=p[V]);else throw new TypeError("URI.addQuery() accepts an object, string as the name parameter");return this._parts.query=s.buildQuery(F,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),typeof p!="string"&&(O=I),this.build(!O),this},l.addQuery=function(p,I,O){var F=s.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return s.addQuery(F,p,I===void 0?null:I),this._parts.query=s.buildQuery(F,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),typeof p!="string"&&(O=I),this.build(!O),this},l.removeQuery=function(p,I,O){var F=s.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return s.removeQuery(F,p,I),this._parts.query=s.buildQuery(F,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),typeof p!="string"&&(O=I),this.build(!O),this},l.hasQuery=function(p,I,O){var F=s.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return s.hasQuery(F,p,I,O)},l.setSearch=l.setQuery,l.addSearch=l.addQuery,l.removeSearch=l.removeQuery,l.hasSearch=l.hasQuery,l.normalize=function(){return this._parts.urn?this.normalizeProtocol(!1).normalizePath(!1).normalizeQuery(!1).normalizeFragment(!1).build():this.normalizeProtocol(!1).normalizeHostname(!1).normalizePort(!1).normalizePath(!1).normalizeQuery(!1).normalizeFragment(!1).build()},l.normalizeProtocol=function(p){return typeof this._parts.protocol=="string"&&(this._parts.protocol=this._parts.protocol.toLowerCase(),this.build(!p)),this},l.normalizeHostname=function(p){return this._parts.hostname&&(this.is("IDN")&&t?this._parts.hostname=t.toASCII(this._parts.hostname):this.is("IPv6")&&n&&(this._parts.hostname=n.best(this._parts.hostname)),this._parts.hostname=this._parts.hostname.toLowerCase(),this.build(!p)),this},l.normalizePort=function(p){return typeof this._parts.protocol=="string"&&this._parts.port===s.defaultPorts[this._parts.protocol]&&(this._parts.port=null,this.build(!p)),this},l.normalizePath=function(p){var I=this._parts.path;if(!I)return this;if(this._parts.urn)return this._parts.path=s.recodeUrnPath(this._parts.path),this.build(!p),this;if(this._parts.path==="/")return this;I=s.recodePath(I);var O,F="",V,G;for(I.charAt(0)!=="/"&&(O=!0,I="/"+I),(I.slice(-3)==="/.."||I.slice(-2)==="/.")&&(I+="/"),I=I.replace(/(\/(\.\/)+)|(\/\.$)/g,"/").replace(/\/{2,}/g,"/"),O&&(F=I.substring(1).match(/^(\.\.\/)+/)||"",F&&(F=F[0]));V=I.search(/\/\.\.(\/|$)/),V!==-1;){if(V===0){I=I.substring(3);continue}G=I.substring(0,V).lastIndexOf("/"),G===-1&&(G=V),I=I.substring(0,G)+I.substring(V+3)}return O&&this.is("relative")&&(I=F+I.substring(1)),this._parts.path=I,this.build(!p),this},l.normalizePathname=l.normalizePath,l.normalizeQuery=function(p){return typeof this._parts.query=="string"&&(this._parts.query.length?this.query(s.parseQuery(this._parts.query,this._parts.escapeQuerySpace)):this._parts.query=null,this.build(!p)),this},l.normalizeFragment=function(p){return this._parts.fragment||(this._parts.fragment=null,this.build(!p)),this},l.normalizeSearch=l.normalizeQuery,l.normalizeHash=l.normalizeFragment,l.iso8859=function(){var p=s.encode,I=s.decode;s.encode=escape,s.decode=decodeURIComponent;try{this.normalize()}finally{s.encode=p,s.decode=I}return this},l.unicode=function(){var p=s.encode,I=s.decode;s.encode=C,s.decode=unescape;try{this.normalize()}finally{s.encode=p,s.decode=I}return this},l.readable=function(){var p=this.clone();p.username("").password("").normalize();var I="";if(p._parts.protocol&&(I+=p._parts.protocol+"://"),p._parts.hostname&&(p.is("punycode")&&t?(I+=t.toUnicode(p._parts.hostname),p._parts.port&&(I+=":"+p._parts.port)):I+=p.host()),p._parts.hostname&&p._parts.path&&p._parts.path.charAt(0)!=="/"&&(I+="/"),I+=p.path(!0),p._parts.query){for(var O="",F=0,V=p._parts.query.split("&"),G=V.length;F<G;F++){var j=(V[F]||"").split("=");O+="&"+s.decodeQuery(j[0],this._parts.escapeQuerySpace).replace(/&/g,"%26"),j[1]!==void 0&&(O+="="+s.decodeQuery(j[1],this._parts.escapeQuerySpace).replace(/&/g,"%26"))}I+="?"+O.substring(1)}return I+=s.decodeQuery(p.hash(),!0),I},l.absoluteTo=function(p){var I=this.clone(),O=["protocol","username","password","hostname","port"],F,V,G;if(this._parts.urn)throw new Error("URNs do not have any generally defined hierarchical components");if(p instanceof s||(p=new s(p)),I._parts.protocol||(I._parts.protocol=p._parts.protocol,this._parts.hostname))return I;for(V=0;G=O[V];V++)I._parts[G]=p._parts[G];return I._parts.path?(I._parts.path.substring(-2)===".."&&(I._parts.path+="/"),I.path().charAt(0)!=="/"&&(F=p.directory(),F=F||(p.path().indexOf("/")===0?"/":""),I._parts.path=(F?F+"/":"")+I._parts.path,I.normalizePath())):(I._parts.path=p._parts.path,I._parts.query||(I._parts.query=p._parts.query)),I.build(),I},l.relativeTo=function(p){var I=this.clone().normalize(),O,F,V,G,j;if(I._parts.urn)throw new Error("URNs do not have any generally defined hierarchical components");if(p=new s(p).normalize(),O=I._parts,F=p._parts,G=I.path(),j=p.path(),G.charAt(0)!=="/")throw new Error("URI is already relative");if(j.charAt(0)!=="/")throw new Error("Cannot calculate a URI relative to another relative URI");if(O.protocol===F.protocol&&(O.protocol=null),O.username!==F.username||O.password!==F.password||O.protocol!==null||O.username!==null||O.password!==null)return I.build();if(O.hostname===F.hostname&&O.port===F.port)O.hostname=null,O.port=null;else return I.build();if(G===j)return O.path="",I.build();if(V=s.commonPath(G,j),!V)return I.build();var W=F.path.substring(V.length).replace(/[^\/]*$/,"").replace(/.*?\//g,"../");return O.path=W+O.path.substring(V.length)||"./",I.build()},l.equals=function(p){var I=this.clone(),O=new s(p),F={},V={},G={},j,W,X;if(I.normalize(),O.normalize(),I.toString()===O.toString())return!0;if(j=I.query(),W=O.query(),I.query(""),O.query(""),I.toString()!==O.toString()||j.length!==W.length)return!1;F=s.parseQuery(j,this._parts.escapeQuerySpace),V=s.parseQuery(W,this._parts.escapeQuerySpace);for(X in F)if(u.call(F,X)){if(_(F[X])){if(!b(F[X],V[X]))return!1}else if(F[X]!==V[X])return!1;G[X]=!0}for(X in V)if(u.call(V,X)&&!G[X])return!1;return!0},l.preventInvalidHostname=function(p){return this._parts.preventInvalidHostname=!!p,this},l.duplicateQueryParameters=function(p){return this._parts.duplicateQueryParameters=!!p,this},l.escapeQuerySpace=function(p){return this._parts.escapeQuerySpace=!!p,this},s})})(mU);const Ec=mU.exports;function mY(e){return(e.length===0||e[e.length-1]!=="/")&&(e=`${e}/`),e}function Je(e,t){if(e===null||typeof e!="object")return e;t=y(t,!1);const n=new e.constructor;for(const i in e)if(e.hasOwnProperty(i)){let o=e[i];t&&(o=Je(o,t)),n[i]=o}return n}function jt(e,t,n){n=y(n,!1);const i={},o=c(e),r=c(t);let s,a,l;if(o)for(s in e)e.hasOwnProperty(s)&&(a=e[s],r&&n&&typeof a=="object"&&t.hasOwnProperty(s)?(l=t[s],typeof l=="object"?i[s]=jt(a,l,n):i[s]=a):i[s]=a);if(r)for(s in t)t.hasOwnProperty(s)&&!i.hasOwnProperty(s)&&(l=t[s],i[s]=l);return i}function R0(){let e,t;const n=new Promise(function(i,o){e=i,t=o});return{resolve:e,reject:t,promise:n}}function C_(e,t){let n;return typeof document<"u"&&(n=document),C_._implementation(e,t,n)}C_._implementation=function(e,t,n){if(!c(e))throw new E("relative uri is required.");if(!c(t)){if(typeof n>"u")return e;t=y(n.baseURI,n.location.href)}const i=new Ec(e);return i.scheme()!==""?i.toString():i.absoluteTo(t).toString()};function _Y(e,t){if(!c(e))throw new E("uri is required.");let n="";const i=e.lastIndexOf("/");return i!==-1&&(n=e.substring(0,i+1)),t&&(e=new Ec(e),e.query().length!==0&&(n+=`?${e.query()}`),e.fragment().length!==0&&(n+=`#${e.fragment()}`)),n}function gY(e){if(!c(e))throw new E("uri is required.");const t=new Ec(e);t.normalize();let n=t.path(),i=n.lastIndexOf("/");return i!==-1&&(n=n.substr(i+1)),i=n.lastIndexOf("."),i===-1?n="":n=n.substr(i+1),n}const RL={};function Ax(e,t,n){c(t)||(t=e.width),c(n)||(n=e.height);let i=RL[t];c(i)||(i={},RL[t]=i);let o=i[n];if(!c(o)){const r=document.createElement("canvas");r.width=t,r.height=n,o=r.getContext("2d",{willReadFrequently:!0}),o.globalCompositeOperation="copy",i[n]=o}return o.drawImage(e,0,0,t,n),o.getImageData(0,0,t,n).data}const yY=/^blob:/i;function _U(e){return A.typeOf.string("uri",e),yY.test(e)}let Vl;function gU(e){c(Vl)||(Vl=document.createElement("a")),Vl.href=window.location.href;const t=Vl.host,n=Vl.protocol;return Vl.href=e,Vl.href=Vl.href,n!==Vl.protocol||t!==Vl.host}const bY=/^data:/i;function CP(e){return A.typeOf.string("uri",e),bY.test(e)}function TY(e){const t=document.createElement("script");return t.async=!0,t.src=e,new Promise((n,i)=>{window.crossOriginIsolated&&t.setAttribute("crossorigin","anonymous");const o=document.getElementsByTagName("head")[0];t.onload=function(){t.onload=void 0,o.removeChild(t),n()},t.onerror=function(r){i(r)},o.appendChild(t)})}function AY(e){if(!c(e))throw new E("obj is required.");let t="";for(const n in e)if(e.hasOwnProperty(n)){const i=e[n],o=`${encodeURIComponent(n)}=`;if(Array.isArray(i))for(let r=0,s=i.length;r<s;++r)t+=`${o+encodeURIComponent(i[r])}&`;else t+=`${o+encodeURIComponent(i)}&`}return t=t.slice(0,-1),t}function xY(e){if(!c(e))throw new E("queryString is required.");const t={};if(e==="")return t;const n=e.replace(/\+/g,"%20").split(/[&;]/);for(let i=0,o=n.length;i<o;++i){const r=n[i].split("="),s=decodeURIComponent(r[0]);let a=r[1];c(a)?a=decodeURIComponent(a):a="";const l=t[s];typeof l=="string"?t[s]=[l,a]:Array.isArray(l)?l.push(a):t[s]=a}return t}const CY={UNISSUED:0,ISSUED:1,ACTIVE:2,RECEIVED:3,CANCELLED:4,FAILED:5},di=Object.freeze(CY),EY={TERRAIN:0,IMAGERY:1,TILES3D:2,OTHER:3},Ip=Object.freeze(EY);function iu(e){e=y(e,y.EMPTY_OBJECT);const t=y(e.throttleByServer,!1),n=y(e.throttle,!1);this.url=e.url,this.requestFunction=e.requestFunction,this.cancelFunction=e.cancelFunction,this.priorityFunction=e.priorityFunction,this.priority=y(e.priority,0),this.throttle=n,this.throttleByServer=t,this.type=y(e.type,Ip.OTHER),this.serverKey=e.serverKey,this.state=di.UNISSUED,this.deferred=void 0,this.cancelled=!1}iu.prototype.cancel=function(){this.cancelled=!0};iu.prototype.clone=function(e){return c(e)?(e.url=this.url,e.requestFunction=this.requestFunction,e.cancelFunction=this.cancelFunction,e.priorityFunction=this.priorityFunction,e.priority=this.priority,e.throttle=this.throttle,e.throttleByServer=this.throttleByServer,e.type=this.type,e.serverKey=this.serverKey,e.state=di.UNISSUED,e.deferred=void 0,e.cancelled=!1,e):new iu(this)};function wY(e){const t={};if(!e)return t;const n=e.split(`\r
|
|
`);for(let i=0;i<n.length;++i){const o=n[i],r=o.indexOf(": ");if(r>0){const s=o.substring(0,r),a=o.substring(r+2);t[s]=a}}return t}function E_(e,t,n){this.statusCode=e,this.response=t,this.responseHeaders=n,typeof this.responseHeaders=="string"&&(this.responseHeaders=wY(this.responseHeaders))}E_.prototype.toString=function(){let e="Request has failed.";return c(this.statusCode)&&(e+=` Status Code: ${this.statusCode}`),e};function Le(){this._listeners=[],this._scopes=[],this._toRemove=[],this._insideRaiseEvent=!1}Object.defineProperties(Le.prototype,{numberOfListeners:{get:function(){return this._listeners.length-this._toRemove.length}}});Le.prototype.addEventListener=function(e,t){A.typeOf.func("listener",e),this._listeners.push(e),this._scopes.push(t);const n=this;return function(){n.removeEventListener(e,t)}};Le.prototype.removeEventListener=function(e,t){A.typeOf.func("listener",e);const n=this._listeners,i=this._scopes;let o=-1;for(let r=0;r<n.length;r++)if(n[r]===e&&i[r]===t){o=r;break}return o!==-1?(this._insideRaiseEvent?(this._toRemove.push(o),n[o]=void 0,i[o]=void 0):(n.splice(o,1),i.splice(o,1)),!0):!1};function SY(e,t){return t-e}Le.prototype.raiseEvent=function(){this._insideRaiseEvent=!0;let e;const t=this._listeners,n=this._scopes;let i=t.length;for(e=0;e<i;e++){const r=t[e];c(r)&&t[e].apply(n[e],arguments)}const o=this._toRemove;if(i=o.length,i>0){for(o.sort(SY),e=0;e<i;e++){const r=o[e];t.splice(r,1),n.splice(r,1)}o.length=0}this._insideRaiseEvent=!1};function Dp(e){A.typeOf.object("options",e),A.defined("options.comparator",e.comparator),this._comparator=e.comparator,this._array=[],this._length=0,this._maximumLength=void 0}Object.defineProperties(Dp.prototype,{length:{get:function(){return this._length}},internalArray:{get:function(){return this._array}},maximumLength:{get:function(){return this._maximumLength},set:function(e){A.typeOf.number.greaterThanOrEquals("maximumLength",e,0);const t=this._length;if(e<t){const n=this._array;for(let i=e;i<t;++i)n[i]=void 0;this._length=e,n.length=e}this._maximumLength=e}},comparator:{get:function(){return this._comparator}}});function EP(e,t,n){const i=e[t];e[t]=e[n],e[n]=i}Dp.prototype.reserve=function(e){e=y(e,this._length),this._array.length=e};Dp.prototype.heapify=function(e){e=y(e,0);const t=this._length,n=this._comparator,i=this._array;let o=-1,r=!0;for(;r;){const s=2*(e+1),a=s-1;a<t&&n(i[a],i[e])<0?o=a:o=e,s<t&&n(i[s],i[o])<0&&(o=s),o!==e?(EP(i,o,e),e=o):r=!1}};Dp.prototype.resort=function(){const e=this._length;for(let t=Math.ceil(e/2);t>=0;--t)this.heapify(t)};Dp.prototype.insert=function(e){A.defined("element",e);const t=this._array,n=this._comparator,i=this._maximumLength;let o=this._length++;for(o<t.length?t[o]=e:t.push(e);o!==0;){const s=Math.floor((o-1)/2);if(n(t[o],t[s])<0)EP(t,o,s),o=s;else break}let r;return c(i)&&this._length>i&&(r=t[i],this._length=i),r};Dp.prototype.pop=function(e){if(e=y(e,0),this._length===0)return;A.typeOf.number.lessThan("index",e,this._length);const t=this._array,n=t[e];return EP(t,e,--this._length),this.heapify(e),t[this._length]=void 0,n};function vY(e,t){return e.priority-t.priority}const Un={numberOfAttemptedRequests:0,numberOfActiveRequests:0,numberOfCancelledRequests:0,numberOfCancelledActiveRequests:0,numberOfFailedRequests:0,numberOfActiveRequestsEver:0,lastNumberOfActiveRequests:0};let t_=20;const us=new Dp({comparator:vY});us.maximumLength=t_;us.reserve(t_);const Xl=[];let cd={};const IY=typeof document<"u"?new Ec(document.location.href):new Ec,gC=new Le;function Nn(){}Nn.maximumRequests=50;Nn.maximumRequestsPerServer=18;Nn.requestsByServer={};Nn.throttleRequests=!0;Nn.debugShowStatistics=!1;Nn.requestCompletedEvent=gC;Object.defineProperties(Nn,{statistics:{get:function(){return Un}},priorityHeapLength:{get:function(){return t_},set:function(e){if(e<t_)for(;us.length>e;){const t=us.pop();Xf(t)}t_=e,us.maximumLength=e,us.reserve(e)}}});function yU(e){c(e.priorityFunction)&&(e.priority=e.priorityFunction())}Nn.serverHasOpenSlots=function(e,t){t=y(t,1);const n=y(Nn.requestsByServer[e],Nn.maximumRequestsPerServer);return cd[e]+t<=n};Nn.heapHasOpenSlots=function(e){return us.length+e<=t_};function bU(e){return e.state===di.UNISSUED&&(e.state=di.ISSUED,e.deferred=R0()),e.deferred.promise}function DY(e){return function(t){if(e.state===di.CANCELLED)return;const n=e.deferred;--Un.numberOfActiveRequests,--cd[e.serverKey],gC.raiseEvent(),e.state=di.RECEIVED,e.deferred=void 0,n.resolve(t)}}function PY(e){return function(t){e.state!==di.CANCELLED&&(++Un.numberOfFailedRequests,--Un.numberOfActiveRequests,--cd[e.serverKey],gC.raiseEvent(t),e.state=di.FAILED,e.deferred.reject(t))}}function TU(e){const t=bU(e);return e.state=di.ACTIVE,Xl.push(e),++Un.numberOfActiveRequests,++Un.numberOfActiveRequestsEver,++cd[e.serverKey],e.requestFunction().then(DY(e)).catch(PY(e)),t}function Xf(e){const t=e.state===di.ACTIVE;if(e.state=di.CANCELLED,++Un.numberOfCancelledRequests,c(e.deferred)){const n=e.deferred;e.deferred=void 0,n.reject()}t&&(--Un.numberOfActiveRequests,--cd[e.serverKey],++Un.numberOfCancelledActiveRequests),c(e.cancelFunction)&&e.cancelFunction()}Nn.update=function(){let e,t,n=0;const i=Xl.length;for(e=0;e<i;++e){if(t=Xl[e],t.cancelled&&Xf(t),t.state!==di.ACTIVE){++n;continue}n>0&&(Xl[e-n]=t)}Xl.length-=n;const o=us.internalArray,r=us.length;for(e=0;e<r;++e)yU(o[e]);us.resort();const s=Math.max(Nn.maximumRequests-Xl.length,0);let a=0;for(;a<s&&us.length>0;){if(t=us.pop(),t.cancelled){Xf(t);continue}if(t.throttleByServer&&!Nn.serverHasOpenSlots(t.serverKey)){Xf(t);continue}TU(t),++a}OY()};Nn.getServerKey=function(e){A.typeOf.string("url",e);let t=new Ec(e);t.scheme()===""&&(t=t.absoluteTo(IY),t.normalize());let n=t.authority();/:/.test(n)||(n=`${n}:${t.scheme()==="https"?"443":"80"}`);const i=cd[n];return c(i)||(cd[n]=0),n};Nn.request=function(e){if(A.typeOf.object("request",e),A.typeOf.string("request.url",e.url),A.typeOf.func("request.requestFunction",e.requestFunction),CP(e.url)||_U(e.url))return gC.raiseEvent(),e.state=di.RECEIVED,e.requestFunction();if(++Un.numberOfAttemptedRequests,c(e.serverKey)||(e.serverKey=Nn.getServerKey(e.url)),Nn.throttleRequests&&e.throttleByServer&&!Nn.serverHasOpenSlots(e.serverKey))return;if(!Nn.throttleRequests||!e.throttle)return TU(e);if(Xl.length>=Nn.maximumRequests)return;yU(e);const t=us.insert(e);if(c(t)){if(t===e)return;Xf(t)}return bU(e)};function OY(){!Nn.debugShowStatistics||(Un.numberOfActiveRequests===0&&Un.lastNumberOfActiveRequests>0&&(Un.numberOfAttemptedRequests>0&&(console.log(`Number of attempted requests: ${Un.numberOfAttemptedRequests}`),Un.numberOfAttemptedRequests=0),Un.numberOfCancelledRequests>0&&(console.log(`Number of cancelled requests: ${Un.numberOfCancelledRequests}`),Un.numberOfCancelledRequests=0),Un.numberOfCancelledActiveRequests>0&&(console.log(`Number of cancelled active requests: ${Un.numberOfCancelledActiveRequests}`),Un.numberOfCancelledActiveRequests=0),Un.numberOfFailedRequests>0&&(console.log(`Number of failed requests: ${Un.numberOfFailedRequests}`),Un.numberOfFailedRequests=0)),Un.lastNumberOfActiveRequests=Un.numberOfActiveRequests)}Nn.clearForSpecs=function(){for(;us.length>0;){const t=us.pop();Xf(t)}const e=Xl.length;for(let t=0;t<e;++t)Xf(Xl[t]);Xl.length=0,cd={},Un.numberOfAttemptedRequests=0,Un.numberOfActiveRequests=0,Un.numberOfCancelledRequests=0,Un.numberOfCancelledActiveRequests=0,Un.numberOfFailedRequests=0,Un.numberOfActiveRequestsEver=0,Un.lastNumberOfActiveRequests=0};Nn.numberOfActiveRequestsByServer=function(e){return cd[e]};Nn.requestHeap=us;const N0={};let w_={};N0.add=function(e,t){if(!c(e))throw new E("host is required.");if(!c(t)||t<=0)throw new E("port is required to be greater than 0.");const n=`${e.toLowerCase()}:${t}`;c(w_[n])||(w_[n]=!0)};N0.remove=function(e,t){if(!c(e))throw new E("host is required.");if(!c(t)||t<=0)throw new E("port is required to be greater than 0.");const n=`${e.toLowerCase()}:${t}`;c(w_[n])&&delete w_[n]};function LY(e){const t=new Ec(e);t.normalize();let n=t.authority();if(n.length!==0){if(t.authority(n),n.indexOf("@")!==-1&&(n=n.split("@")[1]),n.indexOf(":")===-1){let i=t.scheme();if(i.length===0&&(i=window.location.protocol,i=i.substring(0,i.length-1)),i==="http")n+=":80";else if(i==="https")n+=":443";else return}return n}}N0.contains=function(e){if(!c(e))throw new E("url is required.");const t=LY(e);return!!(c(t)&&c(w_[t]))};N0.clear=function(){w_={}};const AU=N0,xU=function(){try{const e=new XMLHttpRequest;return e.open("GET","#",!0),e.responseType="blob",e.responseType==="blob"}catch{return!1}}();function Ae(e){e=y(e,y.EMPTY_OBJECT),typeof e=="string"&&(e={url:e}),A.typeOf.string("options.url",e.url),this._url=void 0,this._templateValues=Kl(e.templateValues,{}),this._queryParameters=Kl(e.queryParameters,{}),this.headers=Kl(e.headers,{}),this.request=y(e.request,new iu),this.proxy=e.proxy,this.retryCallback=e.retryCallback,this.retryAttempts=y(e.retryAttempts,0),this._retryCount=0,y(e.parseUrl,!0)?this.parseUrl(e.url,!0,!0):this._url=e.url,this._credits=e.credits}function Kl(e,t){return c(e)?Je(e):t}Ae.createIfNeeded=function(e){return e instanceof Ae?e.getDerivedResource({request:e.request}):typeof e!="string"?e:new Ae({url:e})};let om;Ae.supportsImageBitmapOptions=function(){if(c(om))return om;if(typeof createImageBitmap!="function")return om=Promise.resolve(!1),om;const e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAABGdBTUEAAE4g3rEiDgAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAADElEQVQI12Ng6GAAAAEUAIngE3ZiAAAAAElFTkSuQmCC";return om=Ae.fetchBlob({url:e}).then(function(t){const n={imageOrientation:"flipY",premultiplyAlpha:"none",colorSpaceConversion:"none"};return Promise.all([createImageBitmap(t,n),createImageBitmap(t)])}).then(function(t){const n=Ax(t[0]),i=Ax(t[1]);return n[1]!==i[1]}).catch(function(){return!1}),om};Object.defineProperties(Ae,{isBlobSupported:{get:function(){return xU}}});Object.defineProperties(Ae.prototype,{queryParameters:{get:function(){return this._queryParameters}},templateValues:{get:function(){return this._templateValues}},url:{get:function(){return this.getUrlComponent(!0,!0)},set:function(e){this.parseUrl(e,!1,!1)}},extension:{get:function(){return gY(this._url)}},isDataUri:{get:function(){return CP(this._url)}},isBlobUri:{get:function(){return _U(this._url)}},isCrossOriginUrl:{get:function(){return gU(this._url)}},hasHeaders:{get:function(){return Object.keys(this.headers).length>0}},credits:{get:function(){return this._credits}}});Ae.prototype.toString=function(){return this.getUrlComponent(!0,!0)};Ae.prototype.parseUrl=function(e,t,n,i){let o=new Ec(e);const r=RY(o.query());this._queryParameters=t?xx(r,this.queryParameters,n):r,o.search(""),o.fragment(""),c(i)&&o.scheme()===""&&(o=o.absoluteTo(C_(i))),this._url=o.toString()};function RY(e){return e.length===0?{}:e.indexOf("=")===-1?{[e]:void 0}:xY(e)}function xx(e,t,n){if(!n)return jt(e,t);const i=Je(e,!0);for(const o in t)if(t.hasOwnProperty(o)){let r=i[o];const s=t[o];c(r)?(Array.isArray(r)||(r=i[o]=[r]),i[o]=r.concat(s)):i[o]=Array.isArray(s)?s.slice():s}return i}Ae.prototype.getUrlComponent=function(e,t){if(this.isDataUri)return this._url;let n=this._url;e&&(n=`${n}${NY(this.queryParameters)}`),n=n.replace(/%7B/g,"{").replace(/%7D/g,"}");const i=this._templateValues;return Object.keys(i).length>0&&(n=n.replace(/{(.*?)}/g,function(o,r){const s=i[r];return c(s)?encodeURIComponent(s):o})),t&&c(this.proxy)&&(n=this.proxy.getURL(n)),n};function NY(e){const t=Object.keys(e);return t.length===0?"":t.length===1&&!c(e[t[0]])?`?${t[0]}`:`?${AY(e)}`}Ae.prototype.setQueryParameters=function(e,t){t?this._queryParameters=xx(this._queryParameters,e,!1):this._queryParameters=xx(e,this._queryParameters,!1)};Ae.prototype.appendQueryParameters=function(e){this._queryParameters=xx(e,this._queryParameters,!0)};Ae.prototype.setTemplateValues=function(e,t){t?this._templateValues=jt(this._templateValues,e):this._templateValues=jt(e,this._templateValues)};Ae.prototype.getDerivedResource=function(e){const t=this.clone();if(t._retryCount=0,c(e.url)){const n=y(e.preserveQueryParameters,!1);t.parseUrl(e.url,!0,n,this._url)}return c(e.queryParameters)&&(t._queryParameters=jt(e.queryParameters,t.queryParameters)),c(e.templateValues)&&(t._templateValues=jt(e.templateValues,t.templateValues)),c(e.headers)&&(t.headers=jt(e.headers,t.headers)),c(e.proxy)&&(t.proxy=e.proxy),c(e.request)&&(t.request=e.request),c(e.retryCallback)&&(t.retryCallback=e.retryCallback),c(e.retryAttempts)&&(t.retryAttempts=e.retryAttempts),t};Ae.prototype.retryOnError=function(e){const t=this.retryCallback;if(typeof t!="function"||this._retryCount>=this.retryAttempts)return Promise.resolve(!1);const n=this;return Promise.resolve(t(this,e)).then(function(i){return++n._retryCount,i})};Ae.prototype.clone=function(e){return c(e)?(e._url=this._url,e._queryParameters=Je(this._queryParameters),e._templateValues=Je(this._templateValues),e.headers=Je(this.headers),e.proxy=this.proxy,e.retryCallback=this.retryCallback,e.retryAttempts=this.retryAttempts,e._retryCount=0,e.request=this.request.clone(),e):new Ae({url:this._url,queryParameters:this.queryParameters,templateValues:this.templateValues,headers:this.headers,proxy:this.proxy,retryCallback:this.retryCallback,retryAttempts:this.retryAttempts,request:this.request.clone(),parseUrl:!1,credits:c(this.credits)?this.credits.slice():void 0})};Ae.prototype.getBaseUri=function(e){return _Y(this.getUrlComponent(e),e)};Ae.prototype.appendForwardSlash=function(){this._url=mY(this._url)};Ae.prototype.fetchArrayBuffer=function(){return this.fetch({responseType:"arraybuffer"})};Ae.fetchArrayBuffer=function(e){return new Ae(e).fetchArrayBuffer()};Ae.prototype.fetchBlob=function(){return this.fetch({responseType:"blob"})};Ae.fetchBlob=function(e){return new Ae(e).fetchBlob()};Ae.prototype.fetchImage=function(e){e=y(e,y.EMPTY_OBJECT);const t=y(e.preferImageBitmap,!1),n=y(e.preferBlob,!1),i=y(e.flipY,!1),o=y(e.skipColorSpaceConversion,!1);if(wP(this.request),!xU||this.isDataUri||this.isBlobUri||!this.hasHeaders&&!n)return mI({resource:this,flipY:i,skipColorSpaceConversion:o,preferImageBitmap:t});const r=this.fetchBlob();if(!c(r))return;let s,a,l,u;return Ae.supportsImageBitmapOptions().then(function(h){return s=h,a=s&&t,r}).then(function(h){if(!c(h))return;if(u=h,a)return Ae.createImageBitmapFromBlob(h,{flipY:i,premultiplyAlpha:!1,skipColorSpaceConversion:o});const f=window.URL.createObjectURL(h);return l=new Ae({url:f}),mI({resource:l,flipY:i,skipColorSpaceConversion:o,preferImageBitmap:!1})}).then(function(h){if(!!c(h))return h.blob=u,a||window.URL.revokeObjectURL(l.url),h}).catch(function(h){return c(l)&&window.URL.revokeObjectURL(l.url),h.blob=u,Promise.reject(h)})};function mI(e){const t=e.resource,n=e.flipY,i=e.skipColorSpaceConversion,o=e.preferImageBitmap,r=t.request;r.url=t.url,r.requestFunction=function(){let a=!1;!t.isDataUri&&!t.isBlobUri&&(a=t.isCrossOriginUrl);const l=R0();return Ae._Implementations.createImage(r,a,l,n,i,o),l.promise};const s=Nn.request(r);if(!!c(s))return s.catch(function(a){return r.state!==di.FAILED?Promise.reject(a):t.retryOnError(a).then(function(l){return l?(r.state=di.UNISSUED,r.deferred=void 0,mI({resource:t,flipY:n,skipColorSpaceConversion:i,preferImageBitmap:o})):Promise.reject(a)})})}Ae.fetchImage=function(e){return new Ae(e).fetchImage({flipY:e.flipY,skipColorSpaceConversion:e.skipColorSpaceConversion,preferBlob:e.preferBlob,preferImageBitmap:e.preferImageBitmap})};Ae.prototype.fetchText=function(){return this.fetch({responseType:"text"})};Ae.fetchText=function(e){return new Ae(e).fetchText()};Ae.prototype.fetchJson=function(){const e=this.fetch({responseType:"text",headers:{Accept:"application/json,*/*;q=0.01"}});if(!!c(e))return e.then(function(t){if(!!c(t))return JSON.parse(t)})};Ae.fetchJson=function(e){return new Ae(e).fetchJson()};Ae.prototype.fetchXML=function(){return this.fetch({responseType:"document",overrideMimeType:"text/xml"})};Ae.fetchXML=function(e){return new Ae(e).fetchXML()};Ae.prototype.fetchJsonp=function(e){e=y(e,"callback"),wP(this.request);let t;do t=`loadJsonp${R.nextRandomNumber().toString().substring(2,8)}`;while(c(window[t]));return CU(this,e,t)};function CU(e,t,n){const i={};i[t]=n,e.setQueryParameters(i);const o=e.request,r=e.url;o.url=r,o.requestFunction=function(){const a=R0();return window[n]=function(l){a.resolve(l);try{delete window[n]}catch{window[n]=void 0}},Ae._Implementations.loadAndExecuteScript(r,n,a),a.promise};const s=Nn.request(o);if(!!c(s))return s.catch(function(a){return o.state!==di.FAILED?Promise.reject(a):e.retryOnError(a).then(function(l){return l?(o.state=di.UNISSUED,o.deferred=void 0,CU(e,t,n)):Promise.reject(a)})})}Ae.fetchJsonp=function(e){return new Ae(e).fetchJsonp(e.callbackParameterName)};Ae.prototype._makeRequest=function(e){const t=this;wP(t.request);const n=t.request,i=t.url;n.url=i,n.requestFunction=function(){const r=e.responseType,s=jt(e.headers,t.headers),a=e.overrideMimeType,l=e.method,u=e.data,h=R0(),f=Ae._Implementations.loadWithXhr(i,r,l,u,s,h,a);return c(f)&&c(f.abort)&&(n.cancelFunction=function(){f.abort()}),h.promise};const o=Nn.request(n);if(!!c(o))return o.then(function(r){return n.cancelFunction=void 0,r}).catch(function(r){return n.cancelFunction=void 0,n.state!==di.FAILED?Promise.reject(r):t.retryOnError(r).then(function(s){return s?(n.state=di.UNISSUED,n.deferred=void 0,t.fetch(e)):Promise.reject(r)})})};function wP(e){if(e.state===di.ISSUED||e.state===di.ACTIVE)throw new Te("The Resource is already being fetched.");e.state=di.UNISSUED,e.deferred=void 0}const MY=/^data:(.*?)(;base64)?,(.*)$/;function OA(e,t){const n=decodeURIComponent(t);return e?atob(n):n}function NL(e,t){const n=OA(e,t),i=new ArrayBuffer(n.length),o=new Uint8Array(i);for(let r=0;r<n.length;r++)o[r]=n.charCodeAt(r);return i}function FY(e,t){t=y(t,"");const n=e[1],i=!!e[2],o=e[3];let r,s;switch(t){case"":case"text":return OA(i,o);case"arraybuffer":return NL(i,o);case"blob":return r=NL(i,o),new Blob([r],{type:n});case"document":return s=new DOMParser,s.parseFromString(OA(i,o),n);case"json":return JSON.parse(OA(i,o));default:throw new E(`Unhandled responseType: ${t}`)}}Ae.prototype.fetch=function(e){return e=Kl(e,{}),e.method="GET",this._makeRequest(e)};Ae.fetch=function(e){return new Ae(e).fetch({responseType:e.responseType,overrideMimeType:e.overrideMimeType})};Ae.prototype.delete=function(e){return e=Kl(e,{}),e.method="DELETE",this._makeRequest(e)};Ae.delete=function(e){return new Ae(e).delete({responseType:e.responseType,overrideMimeType:e.overrideMimeType,data:e.data})};Ae.prototype.head=function(e){return e=Kl(e,{}),e.method="HEAD",this._makeRequest(e)};Ae.head=function(e){return new Ae(e).head({responseType:e.responseType,overrideMimeType:e.overrideMimeType})};Ae.prototype.options=function(e){return e=Kl(e,{}),e.method="OPTIONS",this._makeRequest(e)};Ae.options=function(e){return new Ae(e).options({responseType:e.responseType,overrideMimeType:e.overrideMimeType})};Ae.prototype.post=function(e,t){return A.defined("data",e),t=Kl(t,{}),t.method="POST",t.data=e,this._makeRequest(t)};Ae.post=function(e){return new Ae(e).post(e.data,{responseType:e.responseType,overrideMimeType:e.overrideMimeType})};Ae.prototype.put=function(e,t){return A.defined("data",e),t=Kl(t,{}),t.method="PUT",t.data=e,this._makeRequest(t)};Ae.put=function(e){return new Ae(e).put(e.data,{responseType:e.responseType,overrideMimeType:e.overrideMimeType})};Ae.prototype.patch=function(e,t){return A.defined("data",e),t=Kl(t,{}),t.method="PATCH",t.data=e,this._makeRequest(t)};Ae.patch=function(e){return new Ae(e).patch(e.data,{responseType:e.responseType,overrideMimeType:e.overrideMimeType})};Ae._Implementations={};Ae._Implementations.loadImageElement=function(e,t,n){const i=new Image;i.onload=function(){i.naturalWidth===0&&i.naturalHeight===0&&i.width===0&&i.height===0&&(i.width=300,i.height=150),n.resolve(i)},i.onerror=function(o){n.reject(o)},t&&(AU.contains(e)?i.crossOrigin="use-credentials":i.crossOrigin=""),i.src=e};Ae._Implementations.createImage=function(e,t,n,i,o,r){const s=e.url;Ae.supportsImageBitmapOptions().then(function(a){if(!(a&&r)){Ae._Implementations.loadImageElement(s,t,n);return}const l="blob",u="GET",h=R0(),f=Ae._Implementations.loadWithXhr(s,l,u,void 0,void 0,h,void 0,void 0,void 0);return c(f)&&c(f.abort)&&(e.cancelFunction=function(){f.abort()}),h.promise.then(function(_){if(!c(_)){n.reject(new Te(`Successfully retrieved ${s} but it contained no content.`));return}return Ae.createImageBitmapFromBlob(_,{flipY:i,premultiplyAlpha:!1,skipColorSpaceConversion:o})}).then(function(_){n.resolve(_)})}).catch(function(a){n.reject(a)})};Ae.createImageBitmapFromBlob=function(e,t){return A.defined("options",t),A.typeOf.bool("options.flipY",t.flipY),A.typeOf.bool("options.premultiplyAlpha",t.premultiplyAlpha),A.typeOf.bool("options.skipColorSpaceConversion",t.skipColorSpaceConversion),createImageBitmap(e,{imageOrientation:t.flipY?"flipY":"none",premultiplyAlpha:t.premultiplyAlpha?"premultiply":"none",colorSpaceConversion:t.skipColorSpaceConversion?"none":"default"})};function BY(e,t,n,i,o,r,s){fetch(e,{method:n,headers:o}).then(async a=>{if(!a.ok){const l={};a.headers.forEach((u,h)=>{l[h]=u}),r.reject(new E_(a.status,a,l));return}switch(t){case"text":r.resolve(a.text());break;case"json":r.resolve(a.json());break;default:r.resolve(new Uint8Array(await a.arrayBuffer()).buffer);break}}).catch(()=>{r.reject(new E_)})}const zY=typeof XMLHttpRequest>"u";Ae._Implementations.loadWithXhr=function(e,t,n,i,o,r,s){const a=MY.exec(e);if(a!==null){r.resolve(FY(a,t));return}if(zY){BY(e,t,n,i,o,r);return}const l=new XMLHttpRequest;if(AU.contains(e)&&(l.withCredentials=!0),l.open(n,e,!0),c(s)&&c(l.overrideMimeType)&&l.overrideMimeType(s),c(o))for(const h in o)o.hasOwnProperty(h)&&l.setRequestHeader(h,o[h]);c(t)&&(l.responseType=t);let u=!1;return typeof e=="string"&&(u=e.indexOf("file://")===0||typeof window<"u"&&window.location.origin==="file://"),l.onload=function(){if((l.status<200||l.status>=300)&&!(u&&l.status===0)){r.reject(new E_(l.status,l.response,l.getAllResponseHeaders()));return}const h=l.response,f=l.responseType;if(n==="HEAD"||n==="OPTIONS"){const g=l.getAllResponseHeaders().trim().split(/[\r\n]+/),m={};g.forEach(function(b){const T=b.split(": "),x=T.shift();m[x]=T.join(": ")}),r.resolve(m);return}if(l.status===204)r.resolve(void 0);else if(c(h)&&(!c(t)||f===t))r.resolve(h);else if(t==="json"&&typeof h=="string")try{r.resolve(JSON.parse(h))}catch(_){r.reject(_)}else(f===""||f==="document")&&c(l.responseXML)&&l.responseXML.hasChildNodes()?r.resolve(l.responseXML):(f===""||f==="text")&&c(l.responseText)?r.resolve(l.responseText):r.reject(new Te("Invalid XMLHttpRequest response type."))},l.onerror=function(h){r.reject(new E_)},l.send(i),l};Ae._Implementations.loadAndExecuteScript=function(e,t,n){return TY(e).catch(function(i){n.reject(i)})};Ae._DefaultImplementations={};Ae._DefaultImplementations.createImage=Ae._Implementations.createImage;Ae._DefaultImplementations.loadWithXhr=Ae._Implementations.loadWithXhr;Ae._DefaultImplementations.loadAndExecuteScript=Ae._Implementations.loadAndExecuteScript;Ae.DEFAULT=Object.freeze(new Ae({url:typeof document>"u"?"":document.location.href.split("?")[0]}));function Xy(e){e=y(e,y.EMPTY_OBJECT),this._dates=void 0,this._samples=void 0,this._dateColumn=-1,this._xPoleWanderRadiansColumn=-1,this._yPoleWanderRadiansColumn=-1,this._ut1MinusUtcSecondsColumn=-1,this._xCelestialPoleOffsetRadiansColumn=-1,this._yCelestialPoleOffsetRadiansColumn=-1,this._taiMinusUtcSecondsColumn=-1,this._columnCount=0,this._lastIndex=-1,this._addNewLeapSeconds=y(e.addNewLeapSeconds,!0),c(e.data)?ML(this,e.data):ML(this,{columnNames:["dateIso8601","modifiedJulianDateUtc","xPoleWanderRadians","yPoleWanderRadians","ut1MinusUtcSeconds","lengthOfDayCorrectionSeconds","xCelestialPoleOffsetRadians","yCelestialPoleOffsetRadians","taiMinusUtcSeconds"],samples:[]})}Xy.fromUrl=async function(e,t){A.defined("url",e),t=y(t,y.EMPTY_OBJECT);const n=Ae.createIfNeeded(e);let i;try{i=await n.fetchJson()}catch{throw new Te(`An error occurred while retrieving the EOP data from the URL ${n.url}.`)}return new Xy({addNewLeapSeconds:t.addNewLeapSeconds,data:i})};Xy.NONE=Object.freeze({compute:function(e,t){return c(t)?(t.xPoleWander=0,t.yPoleWander=0,t.xPoleOffset=0,t.yPoleOffset=0,t.ut1MinusUtc=0):t=new bP(0,0,0,0,0),t}});Xy.prototype.compute=function(e,t){if(!c(this._samples))return;if(c(t)||(t=new bP(0,0,0,0,0)),this._samples.length===0)return t.xPoleWander=0,t.yPoleWander=0,t.xPoleOffset=0,t.yPoleOffset=0,t.ut1MinusUtc=0,t;const n=this._dates,i=this._lastIndex;let o=0,r=0;if(c(i)){const a=n[i],l=n[i+1],u=ie.lessThanOrEquals(a,e),h=!c(l),f=h||ie.greaterThanOrEquals(l,e);if(u&&f)return o=i,!h&&l.equals(e)&&++o,r=o+1,BL(this,n,this._samples,e,o,r,t),t}let s=Hr(n,e,ie.compare,this._dateColumn);return s>=0?(s<n.length-1&&n[s+1].equals(e)&&++s,o=s,r=s):(r=~s,o=r-1,o<0&&(o=0)),this._lastIndex=o,BL(this,n,this._samples,e,o,r,t),t};function UY(e,t){return ie.compare(e.julianDate,t)}function ML(e,t){if(!c(t.columnNames))throw new Te("Error in loaded EOP data: The columnNames property is required.");if(!c(t.samples))throw new Te("Error in loaded EOP data: The samples property is required.");const n=t.columnNames.indexOf("modifiedJulianDateUtc"),i=t.columnNames.indexOf("xPoleWanderRadians"),o=t.columnNames.indexOf("yPoleWanderRadians"),r=t.columnNames.indexOf("ut1MinusUtcSeconds"),s=t.columnNames.indexOf("xCelestialPoleOffsetRadians"),a=t.columnNames.indexOf("yCelestialPoleOffsetRadians"),l=t.columnNames.indexOf("taiMinusUtcSeconds");if(n<0||i<0||o<0||r<0||s<0||a<0||l<0)throw new Te("Error in loaded EOP data: The columnNames property must include modifiedJulianDateUtc, xPoleWanderRadians, yPoleWanderRadians, ut1MinusUtcSeconds, xCelestialPoleOffsetRadians, yCelestialPoleOffsetRadians, and taiMinusUtcSeconds columns");const u=e._samples=t.samples,h=e._dates=[];e._dateColumn=n,e._xPoleWanderRadiansColumn=i,e._yPoleWanderRadiansColumn=o,e._ut1MinusUtcSecondsColumn=r,e._xCelestialPoleOffsetRadiansColumn=s,e._yCelestialPoleOffsetRadiansColumn=a,e._taiMinusUtcSecondsColumn=l,e._columnCount=t.columnNames.length,e._lastIndex=void 0;let f;const _=e._addNewLeapSeconds;for(let g=0,m=u.length;g<m;g+=e._columnCount){const b=u[g+n],T=u[g+l],x=b+qn.MODIFIED_JULIAN_DATE_DIFFERENCE,C=new ie(x,T,fn.TAI);if(h.push(C),_){if(T!==f&&c(f)){const w=ie.leapSeconds,v=Hr(w,C,UY);if(v<0){const P=new ei(C,T);w.splice(~v,0,P)}}f=T}}}function FL(e,t,n,i,o){const r=n*i;o.xPoleWander=t[r+e._xPoleWanderRadiansColumn],o.yPoleWander=t[r+e._yPoleWanderRadiansColumn],o.xPoleOffset=t[r+e._xCelestialPoleOffsetRadiansColumn],o.yPoleOffset=t[r+e._yCelestialPoleOffsetRadiansColumn],o.ut1MinusUtc=t[r+e._ut1MinusUtcSecondsColumn]}function pg(e,t,n){return t+e*(n-t)}function BL(e,t,n,i,o,r,s){const a=e._columnCount;if(r>t.length-1)return s.xPoleWander=0,s.yPoleWander=0,s.xPoleOffset=0,s.yPoleOffset=0,s.ut1MinusUtc=0,s;const l=t[o],u=t[r];if(l.equals(u)||i.equals(l))return FL(e,n,o,a,s),s;if(i.equals(u))return FL(e,n,r,a,s),s;const h=ie.secondsDifference(i,l)/ie.secondsDifference(u,l),f=o*a,_=r*a;let g=n[f+e._ut1MinusUtcSecondsColumn],m=n[_+e._ut1MinusUtcSecondsColumn];const b=m-g;if(b>.5||b<-.5){const T=n[f+e._taiMinusUtcSecondsColumn],x=n[_+e._taiMinusUtcSecondsColumn];T!==x&&(u.equals(i)?g=m:m-=x-T)}return s.xPoleWander=pg(h,n[f+e._xPoleWanderRadiansColumn],n[_+e._xPoleWanderRadiansColumn]),s.yPoleWander=pg(h,n[f+e._yPoleWanderRadiansColumn],n[_+e._yPoleWanderRadiansColumn]),s.xPoleOffset=pg(h,n[f+e._xCelestialPoleOffsetRadiansColumn],n[_+e._xCelestialPoleOffsetRadiansColumn]),s.yPoleOffset=pg(h,n[f+e._yCelestialPoleOffsetRadiansColumn],n[_+e._yCelestialPoleOffsetRadiansColumn]),s.ut1MinusUtc=pg(h,g,m),s}function lr(e,t,n){this.heading=y(e,0),this.pitch=y(t,0),this.roll=y(n,0)}lr.fromQuaternion=function(e,t){if(!c(e))throw new E("quaternion is required");c(t)||(t=new lr);const n=2*(e.w*e.y-e.z*e.x),i=1-2*(e.x*e.x+e.y*e.y),o=2*(e.w*e.x+e.y*e.z),r=1-2*(e.y*e.y+e.z*e.z),s=2*(e.w*e.z+e.x*e.y);return t.heading=-Math.atan2(s,r),t.roll=Math.atan2(o,i),t.pitch=-R.asinClamped(n),t};lr.fromDegrees=function(e,t,n,i){if(!c(e))throw new E("heading is required");if(!c(t))throw new E("pitch is required");if(!c(n))throw new E("roll is required");return c(i)||(i=new lr),i.heading=e*R.RADIANS_PER_DEGREE,i.pitch=t*R.RADIANS_PER_DEGREE,i.roll=n*R.RADIANS_PER_DEGREE,i};lr.clone=function(e,t){if(!!c(e))return c(t)?(t.heading=e.heading,t.pitch=e.pitch,t.roll=e.roll,t):new lr(e.heading,e.pitch,e.roll)};lr.equals=function(e,t){return e===t||c(e)&&c(t)&&e.heading===t.heading&&e.pitch===t.pitch&&e.roll===t.roll};lr.equalsEpsilon=function(e,t,n,i){return e===t||c(e)&&c(t)&&R.equalsEpsilon(e.heading,t.heading,n,i)&&R.equalsEpsilon(e.pitch,t.pitch,n,i)&&R.equalsEpsilon(e.roll,t.roll,n,i)};lr.prototype.clone=function(e){return lr.clone(this,e)};lr.prototype.equals=function(e){return lr.equals(this,e)};lr.prototype.equalsEpsilon=function(e,t,n){return lr.equalsEpsilon(this,e,t,n)};lr.prototype.toString=function(){return`(${this.heading}, ${this.pitch}, ${this.roll})`};const EU=/((?:.*\/)|^)Cesium\.js(?:\?|\#|$)/;function kY(){const e=document.getElementsByTagName("script");for(let t=0,n=e.length;t<n;++t){const i=e[t].getAttribute("src"),o=EU.exec(i);if(o!==null)return o[1]}}let Nb;function wU(e){return typeof document>"u"?e:(c(Nb)||(Nb=document.createElement("a")),Nb.href=e,Nb.href)}let Uf;function SU(){var t;if(c(Uf))return Uf;let e;if(typeof CESIUM_BASE_URL<"u"?e=CESIUM_BASE_URL:c((t=import.meta)==null?void 0:t.url)?e=C_(".",import.meta.url):typeof define=="object"&&c(define.amd)&&!define.amd.toUrlUndefined&&c(require.toUrl)?e=C_("..",Zt("Core/buildModuleUrl.js")):e=kY(),!c(e))throw new E("Unable to determine Cesium base URL automatically, try defining a global variable called CESIUM_BASE_URL.");return Uf=new Ae({url:wU(e)}),Uf.appendForwardSlash(),Uf}function VY(e){return wU(require.toUrl(`../${e}`))}function vU(e){return SU().getDerivedResource({url:e}).url}let Mb;function Zt(e){return c(Mb)||(typeof define=="object"&&c(define.amd)&&!define.amd.toUrlUndefined&&c(require.toUrl)?Mb=VY:Mb=vU),Mb(e)}Zt._cesiumScriptRegex=EU;Zt._buildModuleUrlFromBaseUrl=vU;Zt._clearBaseResource=function(){Uf=void 0};Zt.setBaseUrl=function(e){Uf=Ae.DEFAULT.getDerivedResource({url:e})};Zt.getCesiumBaseUrl=SU;function IU(e,t,n){this.x=e,this.y=t,this.s=n}function SP(e){e=y(e,y.EMPTY_OBJECT),this._xysFileUrlTemplate=Ae.createIfNeeded(e.xysFileUrlTemplate),this._interpolationOrder=y(e.interpolationOrder,9),this._sampleZeroJulianEphemerisDate=y(e.sampleZeroJulianEphemerisDate,24423965e-1),this._sampleZeroDateTT=new ie(this._sampleZeroJulianEphemerisDate,0,fn.TAI),this._stepSizeDays=y(e.stepSizeDays,1),this._samplesPerXysFile=y(e.samplesPerXysFile,1e3),this._totalSamples=y(e.totalSamples,27426),this._samples=new Array(this._totalSamples*3),this._chunkDownloadsInProgress=[];const t=this._interpolationOrder,n=this._denominators=new Array(t+1),i=this._xTable=new Array(t+1),o=Math.pow(this._stepSizeDays,t);for(let r=0;r<=t;++r){n[r]=o,i[r]=r*this._stepSizeDays;for(let s=0;s<=t;++s)s!==r&&(n[r]*=r-s);n[r]=1/n[r]}this._work=new Array(t+1),this._coef=new Array(t+1)}const HY=new ie(0,0,fn.TAI);function _I(e,t,n){const i=HY;return i.dayNumber=t,i.secondsOfDay=n,ie.daysDifference(i,e._sampleZeroDateTT)}SP.prototype.preload=function(e,t,n,i){const o=_I(this,e,t),r=_I(this,n,i);let s=o/this._stepSizeDays-this._interpolationOrder/2|0;s<0&&(s=0);let a=r/this._stepSizeDays-this._interpolationOrder/2|0+this._interpolationOrder;a>=this._totalSamples&&(a=this._totalSamples-1);const l=s/this._samplesPerXysFile|0,u=a/this._samplesPerXysFile|0,h=[];for(let f=l;f<=u;++f)h.push(gI(this,f));return Promise.all(h)};SP.prototype.computeXysRadians=function(e,t,n){const i=_I(this,e,t);if(i<0)return;const o=i/this._stepSizeDays|0;if(o>=this._totalSamples)return;const r=this._interpolationOrder;let s=o-(r/2|0);s<0&&(s=0);let a=s+r;a>=this._totalSamples&&(a=this._totalSamples-1,s=a-r,s<0&&(s=0));let l=!1;const u=this._samples;if(c(u[s*3])||(gI(this,s/this._samplesPerXysFile|0),l=!0),c(u[a*3])||(gI(this,a/this._samplesPerXysFile|0),l=!0),l)return;c(n)?(n.x=0,n.y=0,n.s=0):n=new IU(0,0,0);const h=i-s*this._stepSizeDays,f=this._work,_=this._denominators,g=this._coef,m=this._xTable;let b,T;for(b=0;b<=r;++b)f[b]=h-m[b];for(b=0;b<=r;++b){for(g[b]=1,T=0;T<=r;++T)T!==b&&(g[b]*=f[T]);g[b]*=_[b];let x=(s+b)*3;n.x+=g[b]*u[x++],n.y+=g[b]*u[x++],n.s+=g[b]*u[x]}return n};function gI(e,t){if(e._chunkDownloadsInProgress[t])return e._chunkDownloadsInProgress[t];let n;const i=e._xysFileUrlTemplate;c(i)?n=i.getDerivedResource({templateValues:{0:t}}):n=new Ae({url:Zt(`Assets/IAU2006_XYS/IAU2006_XYS_${t}.json`)});const o=n.fetchJson().then(function(r){e._chunkDownloadsInProgress[t]=!1;const s=e._samples,a=r.samples,l=t*e._samplesPerXysFile*3;for(let u=0,h=a.length;u<h;++u)s[l+u]=a[u]});return e._chunkDownloadsInProgress[t]=o,o}function _e(e,t,n,i){this.x=y(e,0),this.y=y(t,0),this.z=y(n,0),this.w=y(i,0)}let mg=new d;_e.fromAxisAngle=function(e,t,n){A.typeOf.object("axis",e),A.typeOf.number("angle",t);const i=t/2,o=Math.sin(i);mg=d.normalize(e,mg);const r=mg.x*o,s=mg.y*o,a=mg.z*o,l=Math.cos(i);return c(n)?(n.x=r,n.y=s,n.z=a,n.w=l,n):new _e(r,s,a,l)};const GY=[1,2,0],jY=new Array(3);_e.fromRotationMatrix=function(e,t){A.typeOf.object("matrix",e);let n,i,o,r,s;const a=e[$.COLUMN0ROW0],l=e[$.COLUMN1ROW1],u=e[$.COLUMN2ROW2],h=a+l+u;if(h>0)n=Math.sqrt(h+1),s=.5*n,n=.5/n,i=(e[$.COLUMN1ROW2]-e[$.COLUMN2ROW1])*n,o=(e[$.COLUMN2ROW0]-e[$.COLUMN0ROW2])*n,r=(e[$.COLUMN0ROW1]-e[$.COLUMN1ROW0])*n;else{const f=GY;let _=0;l>a&&(_=1),u>a&&u>l&&(_=2);const g=f[_],m=f[g];n=Math.sqrt(e[$.getElementIndex(_,_)]-e[$.getElementIndex(g,g)]-e[$.getElementIndex(m,m)]+1);const b=jY;b[_]=.5*n,n=.5/n,s=(e[$.getElementIndex(m,g)]-e[$.getElementIndex(g,m)])*n,b[g]=(e[$.getElementIndex(g,_)]+e[$.getElementIndex(_,g)])*n,b[m]=(e[$.getElementIndex(m,_)]+e[$.getElementIndex(_,m)])*n,i=-b[0],o=-b[1],r=-b[2]}return c(t)?(t.x=i,t.y=o,t.z=r,t.w=s,t):new _e(i,o,r,s)};const zL=new _e;let UL=new _e,VE=new _e,kL=new _e;_e.fromHeadingPitchRoll=function(e,t){return A.typeOf.object("headingPitchRoll",e),kL=_e.fromAxisAngle(d.UNIT_X,e.roll,zL),VE=_e.fromAxisAngle(d.UNIT_Y,-e.pitch,t),t=_e.multiply(VE,kL,VE),UL=_e.fromAxisAngle(d.UNIT_Z,-e.heading,zL),_e.multiply(UL,t,t)};const Fb=new d,HE=new d,tl=new _e,VL=new _e,Bb=new _e;_e.packedLength=4;_e.pack=function(e,t,n){return A.typeOf.object("value",e),A.defined("array",t),n=y(n,0),t[n++]=e.x,t[n++]=e.y,t[n++]=e.z,t[n]=e.w,t};_e.unpack=function(e,t,n){return A.defined("array",e),t=y(t,0),c(n)||(n=new _e),n.x=e[t],n.y=e[t+1],n.z=e[t+2],n.w=e[t+3],n};_e.packedInterpolationLength=3;_e.convertPackedArrayForInterpolation=function(e,t,n,i){_e.unpack(e,n*4,Bb),_e.conjugate(Bb,Bb);for(let o=0,r=n-t+1;o<r;o++){const s=o*3;_e.unpack(e,(t+o)*4,tl),_e.multiply(tl,Bb,tl),tl.w<0&&_e.negate(tl,tl),_e.computeAxis(tl,Fb);const a=_e.computeAngle(tl);c(i)||(i=[]),i[s]=Fb.x*a,i[s+1]=Fb.y*a,i[s+2]=Fb.z*a}};_e.unpackInterpolationResult=function(e,t,n,i,o){c(o)||(o=new _e),d.fromArray(e,0,HE);const r=d.magnitude(HE);return _e.unpack(t,i*4,VL),r===0?_e.clone(_e.IDENTITY,tl):_e.fromAxisAngle(HE,r,tl),_e.multiply(tl,VL,o)};_e.clone=function(e,t){if(!!c(e))return c(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t):new _e(e.x,e.y,e.z,e.w)};_e.conjugate=function(e,t){return A.typeOf.object("quaternion",e),A.typeOf.object("result",t),t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=e.w,t};_e.magnitudeSquared=function(e){return A.typeOf.object("quaternion",e),e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w};_e.magnitude=function(e){return Math.sqrt(_e.magnitudeSquared(e))};_e.normalize=function(e,t){A.typeOf.object("result",t);const n=1/_e.magnitude(e),i=e.x*n,o=e.y*n,r=e.z*n,s=e.w*n;return t.x=i,t.y=o,t.z=r,t.w=s,t};_e.inverse=function(e,t){A.typeOf.object("result",t);const n=_e.magnitudeSquared(e);return t=_e.conjugate(e,t),_e.multiplyByScalar(t,1/n,t)};_e.add=function(e,t,n){return A.typeOf.object("left",e),A.typeOf.object("right",t),A.typeOf.object("result",n),n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n.w=e.w+t.w,n};_e.subtract=function(e,t,n){return A.typeOf.object("left",e),A.typeOf.object("right",t),A.typeOf.object("result",n),n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n.w=e.w-t.w,n};_e.negate=function(e,t){return A.typeOf.object("quaternion",e),A.typeOf.object("result",t),t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t};_e.dot=function(e,t){return A.typeOf.object("left",e),A.typeOf.object("right",t),e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w};_e.multiply=function(e,t,n){A.typeOf.object("left",e),A.typeOf.object("right",t),A.typeOf.object("result",n);const i=e.x,o=e.y,r=e.z,s=e.w,a=t.x,l=t.y,u=t.z,h=t.w,f=s*a+i*h+o*u-r*l,_=s*l-i*u+o*h+r*a,g=s*u+i*l-o*a+r*h,m=s*h-i*a-o*l-r*u;return n.x=f,n.y=_,n.z=g,n.w=m,n};_e.multiplyByScalar=function(e,t,n){return A.typeOf.object("quaternion",e),A.typeOf.number("scalar",t),A.typeOf.object("result",n),n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n.w=e.w*t,n};_e.divideByScalar=function(e,t,n){return A.typeOf.object("quaternion",e),A.typeOf.number("scalar",t),A.typeOf.object("result",n),n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n.w=e.w/t,n};_e.computeAxis=function(e,t){A.typeOf.object("quaternion",e),A.typeOf.object("result",t);const n=e.w;if(Math.abs(n-1)<R.EPSILON6||Math.abs(n+1)<R.EPSILON6)return t.x=1,t.y=t.z=0,t;const i=1/Math.sqrt(1-n*n);return t.x=e.x*i,t.y=e.y*i,t.z=e.z*i,t};_e.computeAngle=function(e){return A.typeOf.object("quaternion",e),Math.abs(e.w-1)<R.EPSILON6?0:2*Math.acos(e.w)};let GE=new _e;_e.lerp=function(e,t,n,i){return A.typeOf.object("start",e),A.typeOf.object("end",t),A.typeOf.number("t",n),A.typeOf.object("result",i),GE=_e.multiplyByScalar(t,n,GE),i=_e.multiplyByScalar(e,1-n,i),_e.add(GE,i,i)};let HL=new _e,jE=new _e,WE=new _e;_e.slerp=function(e,t,n,i){A.typeOf.object("start",e),A.typeOf.object("end",t),A.typeOf.number("t",n),A.typeOf.object("result",i);let o=_e.dot(e,t),r=t;if(o<0&&(o=-o,r=HL=_e.negate(t,HL)),1-o<R.EPSILON6)return _e.lerp(e,r,n,i);const s=Math.acos(o);return jE=_e.multiplyByScalar(e,Math.sin((1-n)*s),jE),WE=_e.multiplyByScalar(r,Math.sin(n*s),WE),i=_e.add(jE,WE,i),_e.multiplyByScalar(i,1/Math.sin(s),i)};_e.log=function(e,t){A.typeOf.object("quaternion",e),A.typeOf.object("result",t);const n=R.acosClamped(e.w);let i=0;return n!==0&&(i=n/Math.sin(n)),d.multiplyByScalar(e,i,t)};_e.exp=function(e,t){A.typeOf.object("cartesian",e),A.typeOf.object("result",t);const n=d.magnitude(e);let i=0;return n!==0&&(i=Math.sin(n)/n),t.x=e.x*i,t.y=e.y*i,t.z=e.z*i,t.w=Math.cos(n),t};const WY=new d,qY=new d,Iy=new _e,jm=new _e;_e.computeInnerQuadrangle=function(e,t,n,i){A.typeOf.object("q0",e),A.typeOf.object("q1",t),A.typeOf.object("q2",n),A.typeOf.object("result",i);const o=_e.conjugate(t,Iy);_e.multiply(o,n,jm);const r=_e.log(jm,WY);_e.multiply(o,e,jm);const s=_e.log(jm,qY);return d.add(r,s,r),d.multiplyByScalar(r,.25,r),d.negate(r,r),_e.exp(r,Iy),_e.multiply(t,Iy,i)};_e.squad=function(e,t,n,i,o,r){A.typeOf.object("q0",e),A.typeOf.object("q1",t),A.typeOf.object("s0",n),A.typeOf.object("s1",i),A.typeOf.number("t",o),A.typeOf.object("result",r);const s=_e.slerp(e,t,o,Iy),a=_e.slerp(n,i,o,jm);return _e.slerp(s,a,2*o*(1-o),r)};const YY=new _e,DU=1.9011074535173003,Cx=Yt.supportsTypedArrays()?new Float32Array(8):[],Ex=Yt.supportsTypedArrays()?new Float32Array(8):[],vu=Yt.supportsTypedArrays()?new Float32Array(8):[],Iu=Yt.supportsTypedArrays()?new Float32Array(8):[];for(let e=0;e<7;++e){const t=e+1,n=2*t+1;Cx[e]=1/(t*n),Ex[e]=t/n}Cx[7]=DU/(8*17);Ex[7]=DU*8/17;_e.fastSlerp=function(e,t,n,i){A.typeOf.object("start",e),A.typeOf.object("end",t),A.typeOf.number("t",n),A.typeOf.object("result",i);let o=_e.dot(e,t),r;o>=0?r=1:(r=-1,o=-o);const s=o-1,a=1-n,l=n*n,u=a*a;for(let g=7;g>=0;--g)vu[g]=(Cx[g]*l-Ex[g])*s,Iu[g]=(Cx[g]*u-Ex[g])*s;const h=r*n*(1+vu[0]*(1+vu[1]*(1+vu[2]*(1+vu[3]*(1+vu[4]*(1+vu[5]*(1+vu[6]*(1+vu[7])))))))),f=a*(1+Iu[0]*(1+Iu[1]*(1+Iu[2]*(1+Iu[3]*(1+Iu[4]*(1+Iu[5]*(1+Iu[6]*(1+Iu[7])))))))),_=_e.multiplyByScalar(e,f,YY);return _e.multiplyByScalar(t,h,i),_e.add(_,i,i)};_e.fastSquad=function(e,t,n,i,o,r){A.typeOf.object("q0",e),A.typeOf.object("q1",t),A.typeOf.object("s0",n),A.typeOf.object("s1",i),A.typeOf.number("t",o),A.typeOf.object("result",r);const s=_e.fastSlerp(e,t,o,Iy),a=_e.fastSlerp(n,i,o,jm);return _e.fastSlerp(s,a,2*o*(1-o),r)};_e.equals=function(e,t){return e===t||c(e)&&c(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z&&e.w===t.w};_e.equalsEpsilon=function(e,t,n){return n=y(n,0),e===t||c(e)&&c(t)&&Math.abs(e.x-t.x)<=n&&Math.abs(e.y-t.y)<=n&&Math.abs(e.z-t.z)<=n&&Math.abs(e.w-t.w)<=n};_e.ZERO=Object.freeze(new _e(0,0,0,0));_e.IDENTITY=Object.freeze(new _e(0,0,0,1));_e.prototype.clone=function(e){return _e.clone(this,e)};_e.prototype.equals=function(e){return _e.equals(this,e)};_e.prototype.equalsEpsilon=function(e,t){return _e.equalsEpsilon(this,e,t)};_e.prototype.toString=function(){return`(${this.x}, ${this.y}, ${this.z}, ${this.w})`};const Bn={},qE={up:{south:"east",north:"west",west:"south",east:"north"},down:{south:"west",north:"east",west:"north",east:"south"},south:{up:"west",down:"east",west:"down",east:"up"},north:{up:"east",down:"west",west:"up",east:"down"},west:{up:"north",down:"south",north:"down",south:"up"},east:{up:"south",down:"north",north:"up",south:"down"}},rm={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},YE={},Xs={east:new d,north:new d,up:new d,west:new d,south:new d,down:new d};let Md=new d,Fd=new d,Bd=new d;Bn.localFrameToFixedFrameGenerator=function(e,t){if(!qE.hasOwnProperty(e)||!qE[e].hasOwnProperty(t))throw new E("firstAxis and secondAxis must be east, north, up, west, south or down.");const n=qE[e][t];let i;const o=e+t;return c(YE[o])?i=YE[o]:(i=function(r,s,a){if(!c(r))throw new E("origin is required.");if(isNaN(r.x)||isNaN(r.y)||isNaN(r.z))throw new E("origin has a NaN component");if(c(a)||(a=new L),d.equalsEpsilon(r,d.ZERO,R.EPSILON14))d.unpack(rm[e],0,Md),d.unpack(rm[t],0,Fd),d.unpack(rm[n],0,Bd);else if(R.equalsEpsilon(r.x,0,R.EPSILON14)&&R.equalsEpsilon(r.y,0,R.EPSILON14)){const l=R.sign(r.z);d.unpack(rm[e],0,Md),e!=="east"&&e!=="west"&&d.multiplyByScalar(Md,l,Md),d.unpack(rm[t],0,Fd),t!=="east"&&t!=="west"&&d.multiplyByScalar(Fd,l,Fd),d.unpack(rm[n],0,Bd),n!=="east"&&n!=="west"&&d.multiplyByScalar(Bd,l,Bd)}else{s=y(s,ae.WGS84),s.geodeticSurfaceNormal(r,Xs.up);const l=Xs.up,u=Xs.east;u.x=-r.y,u.y=r.x,u.z=0,d.normalize(u,Xs.east),d.cross(l,u,Xs.north),d.multiplyByScalar(Xs.up,-1,Xs.down),d.multiplyByScalar(Xs.east,-1,Xs.west),d.multiplyByScalar(Xs.north,-1,Xs.south),Md=Xs[e],Fd=Xs[t],Bd=Xs[n]}return a[0]=Md.x,a[1]=Md.y,a[2]=Md.z,a[3]=0,a[4]=Fd.x,a[5]=Fd.y,a[6]=Fd.z,a[7]=0,a[8]=Bd.x,a[9]=Bd.y,a[10]=Bd.z,a[11]=0,a[12]=r.x,a[13]=r.y,a[14]=r.z,a[15]=1,a},YE[o]=i),i};Bn.eastNorthUpToFixedFrame=Bn.localFrameToFixedFrameGenerator("east","north");Bn.northEastDownToFixedFrame=Bn.localFrameToFixedFrameGenerator("north","east");Bn.northUpEastToFixedFrame=Bn.localFrameToFixedFrameGenerator("north","up");Bn.northWestUpToFixedFrame=Bn.localFrameToFixedFrameGenerator("north","west");const $Y=new _e,XY=new d(1,1,1),QY=new L;Bn.headingPitchRollToFixedFrame=function(e,t,n,i,o){A.typeOf.object("HeadingPitchRoll",t),i=y(i,Bn.eastNorthUpToFixedFrame);const r=_e.fromHeadingPitchRoll(t,$Y),s=L.fromTranslationQuaternionRotationScale(d.ZERO,r,XY,QY);return o=i(e,n,o),L.multiply(o,s,o)};const KY=new L,ZY=new $;Bn.headingPitchRollQuaternion=function(e,t,n,i,o){A.typeOf.object("HeadingPitchRoll",t);const r=Bn.headingPitchRollToFixedFrame(e,t,n,i,KY),s=L.getMatrix3(r,ZY);return _e.fromRotationMatrix(s,o)};const JY=new d(1,1,1),e$=new d,GL=new L,t$=new L,n$=new $,i$=new _e;Bn.fixedFrameToHeadingPitchRoll=function(e,t,n,i){A.defined("transform",e),t=y(t,ae.WGS84),n=y(n,Bn.eastNorthUpToFixedFrame),c(i)||(i=new lr);const o=L.getTranslation(e,e$);if(d.equals(o,d.ZERO))return i.heading=0,i.pitch=0,i.roll=0,i;let r=L.inverseTransformation(n(o,t,GL),GL),s=L.setScale(e,JY,t$);s=L.setTranslation(s,d.ZERO,s),r=L.multiply(r,s,r);let a=_e.fromRotationMatrix(L.getMatrix3(r,n$),i$);return a=_e.normalize(a,a),lr.fromQuaternion(a,i)};const o$=6*3600+41*60+50.54841,r$=8640184812866e-6,s$=.093104,a$=-62e-7,c$=11772758384668e-32,l$=72921158553e-15,u$=R.TWO_PI/86400;let zb=new ie;Bn.computeTemeToPseudoFixedMatrix=function(e,t){if(!c(e))throw new E("date is required.");zb=ie.addSeconds(e,-ie.computeTaiMinusUtc(e),zb);const n=zb.dayNumber,i=zb.secondsOfDay;let o;const r=n-2451545;i>=43200?o=(r+.5)/qn.DAYS_PER_JULIAN_CENTURY:o=(r-.5)/qn.DAYS_PER_JULIAN_CENTURY;const a=(o$+o*(r$+o*(s$+o*a$)))*u$%R.TWO_PI,l=l$+c$*(n-24515455e-1),u=(i+qn.SECONDS_PER_DAY*.5)%qn.SECONDS_PER_DAY,h=a+l*u,f=Math.cos(h),_=Math.sin(h);return c(t)?(t[0]=f,t[1]=-_,t[2]=0,t[3]=_,t[4]=f,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new $(f,_,0,-_,f,0,0,0,1)};Bn.iau2006XysData=new SP;Bn.earthOrientationParameters=Xy.NONE;const yI=32.184,d$=2451545;Bn.preloadIcrfFixed=function(e){const t=e.start.dayNumber,n=e.start.secondsOfDay+yI,i=e.stop.dayNumber,o=e.stop.secondsOfDay+yI;return Bn.iau2006XysData.preload(t,n,i,o)};Bn.computeIcrfToFixedMatrix=function(e,t){if(!c(e))throw new E("date is required.");c(t)||(t=new $);const n=Bn.computeFixedToIcrfMatrix(e,t);if(!!c(n))return $.transpose(n,t)};const h$=new IU(0,0,0),f$=new bP(0,0,0,0,0),$E=new $,XE=new $;Bn.computeFixedToIcrfMatrix=function(e,t){if(!c(e))throw new E("date is required.");c(t)||(t=new $);const n=Bn.earthOrientationParameters.compute(e,f$);if(!c(n))return;const i=e.dayNumber,o=e.secondsOfDay+yI,r=Bn.iau2006XysData.computeXysRadians(i,o,h$);if(!c(r))return;const s=r.x+n.xPoleOffset,a=r.y+n.yPoleOffset,l=1/(1+Math.sqrt(1-s*s-a*a)),u=$E;u[0]=1-l*s*s,u[3]=-l*s*a,u[6]=s,u[1]=-l*s*a,u[4]=1-l*a*a,u[7]=a,u[2]=-s,u[5]=-a,u[8]=1-l*(s*s+a*a);const h=$.fromRotationZ(-r.s,XE),f=$.multiply(u,h,$E),_=e.dayNumber,g=e.secondsOfDay-ie.computeTaiMinusUtc(e)+n.ut1MinusUtc,m=_-2451545,b=g/qn.SECONDS_PER_DAY;let T=.779057273264+b+.00273781191135448*(m+b);T=T%1*R.TWO_PI;const x=$.fromRotationZ(T,XE),C=$.multiply(f,x,$E),w=Math.cos(n.xPoleWander),v=Math.cos(n.yPoleWander),P=Math.sin(n.xPoleWander),N=Math.sin(n.yPoleWander);let k=i-d$+o/qn.SECONDS_PER_DAY;k/=36525;const M=-47e-6*k*R.RADIANS_PER_DEGREE/3600,U=Math.cos(M),B=Math.sin(M),S=XE;return S[0]=w*U,S[1]=w*B,S[2]=P,S[3]=-v*B+N*P*U,S[4]=v*U+N*P*B,S[5]=-N*w,S[6]=-N*B-v*P*U,S[7]=N*U-v*P*B,S[8]=v*w,$.multiply(C,S,t)};const p$=new te;Bn.pointToWindowCoordinates=function(e,t,n,i){return i=Bn.pointToGLWindowCoordinates(e,t,n,i),i.y=2*t[5]-i.y,i};Bn.pointToGLWindowCoordinates=function(e,t,n,i){if(!c(e))throw new E("modelViewProjectionMatrix is required.");if(!c(t))throw new E("viewportTransformation is required.");if(!c(n))throw new E("point is required.");c(i)||(i=new H);const o=p$;return L.multiplyByVector(e,te.fromElements(n.x,n.y,n.z,1,o),o),te.multiplyByScalar(o,1/o.w,o),L.multiplyByVector(t,o,o),H.fromCartesian4(o,i)};const m$=new d,_$=new d,g$=new d;Bn.rotationMatrixFromPositionVelocity=function(e,t,n,i){if(!c(e))throw new E("position is required.");if(!c(t))throw new E("velocity is required.");const o=y(n,ae.WGS84).geodeticSurfaceNormal(e,m$);let r=d.cross(t,o,_$);d.equalsEpsilon(r,d.ZERO,R.EPSILON6)&&(r=d.clone(d.UNIT_X,r));const s=d.cross(r,t,g$);return d.normalize(s,s),d.cross(t,s,r),d.negate(r,r),d.normalize(r,r),c(i)||(i=new $),i[0]=t.x,i[1]=t.y,i[2]=t.z,i[3]=r.x,i[4]=r.y,i[5]=r.z,i[6]=s.x,i[7]=s.y,i[8]=s.z,i};const PU=new L(0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,1),OU=new he,bI=new d,y$=new d,b$=new $,TI=new L,LU=new L;Bn.basisTo2D=function(e,t,n){if(!c(e))throw new E("projection is required.");if(!c(t))throw new E("matrix is required.");if(!c(n))throw new E("result is required.");const i=L.getTranslation(t,y$),o=e.ellipsoid;let r;if(d.equals(i,d.ZERO))r=d.clone(d.ZERO,bI);else{const h=o.cartesianToCartographic(i,OU);r=e.project(h,bI),d.fromElements(r.z,r.x,r.y,r)}const s=Bn.eastNorthUpToFixedFrame(i,o,TI),a=L.inverseTransformation(s,LU),l=L.getMatrix3(t,b$),u=L.multiplyByMatrix3(a,l,n);return L.multiply(PU,u,n),L.setTranslation(n,r,n),n};Bn.wgs84To2DModelMatrix=function(e,t,n){if(!c(e))throw new E("projection is required.");if(!c(t))throw new E("center is required.");if(!c(n))throw new E("result is required.");const i=e.ellipsoid,o=Bn.eastNorthUpToFixedFrame(t,i,TI),r=L.inverseTransformation(o,LU),s=i.cartesianToCartographic(t,OU),a=e.project(s,bI);d.fromElements(a.z,a.x,a.y,a);const l=L.fromTranslation(a,TI);return L.multiply(PU,r,n),L.multiply(l,n,n),n};const zt=Bn;function ce(e,t,n,i){this.west=y(e,0),this.south=y(t,0),this.east=y(n,0),this.north=y(i,0)}Object.defineProperties(ce.prototype,{width:{get:function(){return ce.computeWidth(this)}},height:{get:function(){return ce.computeHeight(this)}}});ce.packedLength=4;ce.pack=function(e,t,n){return A.typeOf.object("value",e),A.defined("array",t),n=y(n,0),t[n++]=e.west,t[n++]=e.south,t[n++]=e.east,t[n]=e.north,t};ce.unpack=function(e,t,n){return A.defined("array",e),t=y(t,0),c(n)||(n=new ce),n.west=e[t++],n.south=e[t++],n.east=e[t++],n.north=e[t],n};ce.computeWidth=function(e){A.typeOf.object("rectangle",e);let t=e.east;const n=e.west;return t<n&&(t+=R.TWO_PI),t-n};ce.computeHeight=function(e){return A.typeOf.object("rectangle",e),e.north-e.south};ce.fromDegrees=function(e,t,n,i,o){return e=R.toRadians(y(e,0)),t=R.toRadians(y(t,0)),n=R.toRadians(y(n,0)),i=R.toRadians(y(i,0)),c(o)?(o.west=e,o.south=t,o.east=n,o.north=i,o):new ce(e,t,n,i)};ce.fromRadians=function(e,t,n,i,o){return c(o)?(o.west=y(e,0),o.south=y(t,0),o.east=y(n,0),o.north=y(i,0),o):new ce(e,t,n,i)};ce.fromCartographicArray=function(e,t){A.defined("cartographics",e);let n=Number.MAX_VALUE,i=-Number.MAX_VALUE,o=Number.MAX_VALUE,r=-Number.MAX_VALUE,s=Number.MAX_VALUE,a=-Number.MAX_VALUE;for(let l=0,u=e.length;l<u;l++){const h=e[l];n=Math.min(n,h.longitude),i=Math.max(i,h.longitude),s=Math.min(s,h.latitude),a=Math.max(a,h.latitude);const f=h.longitude>=0?h.longitude:h.longitude+R.TWO_PI;o=Math.min(o,f),r=Math.max(r,f)}return i-n>r-o&&(n=o,i=r,i>R.PI&&(i=i-R.TWO_PI),n>R.PI&&(n=n-R.TWO_PI)),c(t)?(t.west=n,t.south=s,t.east=i,t.north=a,t):new ce(n,s,i,a)};ce.fromCartesianArray=function(e,t,n){A.defined("cartesians",e),t=y(t,ae.WGS84);let i=Number.MAX_VALUE,o=-Number.MAX_VALUE,r=Number.MAX_VALUE,s=-Number.MAX_VALUE,a=Number.MAX_VALUE,l=-Number.MAX_VALUE;for(let u=0,h=e.length;u<h;u++){const f=t.cartesianToCartographic(e[u]);i=Math.min(i,f.longitude),o=Math.max(o,f.longitude),a=Math.min(a,f.latitude),l=Math.max(l,f.latitude);const _=f.longitude>=0?f.longitude:f.longitude+R.TWO_PI;r=Math.min(r,_),s=Math.max(s,_)}return o-i>s-r&&(i=r,o=s,o>R.PI&&(o=o-R.TWO_PI),i>R.PI&&(i=i-R.TWO_PI)),c(n)?(n.west=i,n.south=a,n.east=o,n.north=l,n):new ce(i,a,o,l)};const T$=new d,A$=new d,x$=new d,C$=new d,E$=new d,AI=new Array(5);for(let e=0;e<AI.length;++e)AI[e]=new d;ce.fromBoundingSphere=function(e,t,n){A.typeOf.object("boundingSphere",e);const i=e.center,o=e.radius;if(c(t)||(t=ae.WGS84),c(n)||(n=new ce),d.equals(i,d.ZERO))return ce.clone(ce.MAX_VALUE,n),n;const r=zt.eastNorthUpToFixedFrame(i,t,T$),s=L.multiplyByPointAsVector(r,d.UNIT_X,A$);d.normalize(s,s);const a=L.multiplyByPointAsVector(r,d.UNIT_Y,x$);d.normalize(a,a),d.multiplyByScalar(a,o,a),d.multiplyByScalar(s,o,s);const l=d.negate(a,E$),u=d.negate(s,C$),h=AI;let f=h[0];return d.add(i,a,f),f=h[1],d.add(i,u,f),f=h[2],d.add(i,l,f),f=h[3],d.add(i,s,f),h[4]=i,ce.fromCartesianArray(h,t,n)};ce.clone=function(e,t){if(!!c(e))return c(t)?(t.west=e.west,t.south=e.south,t.east=e.east,t.north=e.north,t):new ce(e.west,e.south,e.east,e.north)};ce.equalsEpsilon=function(e,t,n){return n=y(n,0),e===t||c(e)&&c(t)&&Math.abs(e.west-t.west)<=n&&Math.abs(e.south-t.south)<=n&&Math.abs(e.east-t.east)<=n&&Math.abs(e.north-t.north)<=n};ce.prototype.clone=function(e){return ce.clone(this,e)};ce.prototype.equals=function(e){return ce.equals(this,e)};ce.equals=function(e,t){return e===t||c(e)&&c(t)&&e.west===t.west&&e.south===t.south&&e.east===t.east&&e.north===t.north};ce.prototype.equalsEpsilon=function(e,t){return ce.equalsEpsilon(this,e,t)};ce.validate=function(e){A.typeOf.object("rectangle",e);const t=e.north;A.typeOf.number.greaterThanOrEquals("north",t,-R.PI_OVER_TWO),A.typeOf.number.lessThanOrEquals("north",t,R.PI_OVER_TWO);const n=e.south;A.typeOf.number.greaterThanOrEquals("south",n,-R.PI_OVER_TWO),A.typeOf.number.lessThanOrEquals("south",n,R.PI_OVER_TWO);const i=e.west;A.typeOf.number.greaterThanOrEquals("west",i,-Math.PI),A.typeOf.number.lessThanOrEquals("west",i,Math.PI);const o=e.east;A.typeOf.number.greaterThanOrEquals("east",o,-Math.PI),A.typeOf.number.lessThanOrEquals("east",o,Math.PI)};ce.southwest=function(e,t){return A.typeOf.object("rectangle",e),c(t)?(t.longitude=e.west,t.latitude=e.south,t.height=0,t):new he(e.west,e.south)};ce.northwest=function(e,t){return A.typeOf.object("rectangle",e),c(t)?(t.longitude=e.west,t.latitude=e.north,t.height=0,t):new he(e.west,e.north)};ce.northeast=function(e,t){return A.typeOf.object("rectangle",e),c(t)?(t.longitude=e.east,t.latitude=e.north,t.height=0,t):new he(e.east,e.north)};ce.southeast=function(e,t){return A.typeOf.object("rectangle",e),c(t)?(t.longitude=e.east,t.latitude=e.south,t.height=0,t):new he(e.east,e.south)};ce.center=function(e,t){A.typeOf.object("rectangle",e);let n=e.east;const i=e.west;n<i&&(n+=R.TWO_PI);const o=R.negativePiToPi((i+n)*.5),r=(e.south+e.north)*.5;return c(t)?(t.longitude=o,t.latitude=r,t.height=0,t):new he(o,r)};ce.intersection=function(e,t,n){A.typeOf.object("rectangle",e),A.typeOf.object("otherRectangle",t);let i=e.east,o=e.west,r=t.east,s=t.west;i<o&&r>0?i+=R.TWO_PI:r<s&&i>0&&(r+=R.TWO_PI),i<o&&s<0?s+=R.TWO_PI:r<s&&o<0&&(o+=R.TWO_PI);const a=R.negativePiToPi(Math.max(o,s)),l=R.negativePiToPi(Math.min(i,r));if((e.west<e.east||t.west<t.east)&&l<=a)return;const u=Math.max(e.south,t.south),h=Math.min(e.north,t.north);if(!(u>=h))return c(n)?(n.west=a,n.south=u,n.east=l,n.north=h,n):new ce(a,u,l,h)};ce.simpleIntersection=function(e,t,n){A.typeOf.object("rectangle",e),A.typeOf.object("otherRectangle",t);const i=Math.max(e.west,t.west),o=Math.max(e.south,t.south),r=Math.min(e.east,t.east),s=Math.min(e.north,t.north);if(!(o>=s||i>=r))return c(n)?(n.west=i,n.south=o,n.east=r,n.north=s,n):new ce(i,o,r,s)};ce.union=function(e,t,n){A.typeOf.object("rectangle",e),A.typeOf.object("otherRectangle",t),c(n)||(n=new ce);let i=e.east,o=e.west,r=t.east,s=t.west;i<o&&r>0?i+=R.TWO_PI:r<s&&i>0&&(r+=R.TWO_PI),i<o&&s<0?s+=R.TWO_PI:r<s&&o<0&&(o+=R.TWO_PI);const a=R.negativePiToPi(Math.min(o,s)),l=R.negativePiToPi(Math.max(i,r));return n.west=a,n.south=Math.min(e.south,t.south),n.east=l,n.north=Math.max(e.north,t.north),n};ce.expand=function(e,t,n){return A.typeOf.object("rectangle",e),A.typeOf.object("cartographic",t),c(n)||(n=new ce),n.west=Math.min(e.west,t.longitude),n.south=Math.min(e.south,t.latitude),n.east=Math.max(e.east,t.longitude),n.north=Math.max(e.north,t.latitude),n};ce.contains=function(e,t){A.typeOf.object("rectangle",e),A.typeOf.object("cartographic",t);let n=t.longitude;const i=t.latitude,o=e.west;let r=e.east;return r<o&&(r+=R.TWO_PI,n<0&&(n+=R.TWO_PI)),(n>o||R.equalsEpsilon(n,o,R.EPSILON14))&&(n<r||R.equalsEpsilon(n,r,R.EPSILON14))&&i>=e.south&&i<=e.north};const w$=new he;ce.subsample=function(e,t,n,i){A.typeOf.object("rectangle",e),t=y(t,ae.WGS84),n=y(n,0),c(i)||(i=[]);let o=0;const r=e.north,s=e.south,a=e.east,l=e.west,u=w$;u.height=n,u.longitude=l,u.latitude=r,i[o]=t.cartographicToCartesian(u,i[o]),o++,u.longitude=a,i[o]=t.cartographicToCartesian(u,i[o]),o++,u.latitude=s,i[o]=t.cartographicToCartesian(u,i[o]),o++,u.longitude=l,i[o]=t.cartographicToCartesian(u,i[o]),o++,r<0?u.latitude=r:s>0?u.latitude=s:u.latitude=0;for(let h=1;h<8;++h)u.longitude=-Math.PI+h*R.PI_OVER_TWO,ce.contains(e,u)&&(i[o]=t.cartographicToCartesian(u,i[o]),o++);return u.latitude===0&&(u.longitude=l,i[o]=t.cartographicToCartesian(u,i[o]),o++,u.longitude=a,i[o]=t.cartographicToCartesian(u,i[o]),o++),i.length=o,i};ce.subsection=function(e,t,n,i,o,r){if(A.typeOf.object("rectangle",e),A.typeOf.number.greaterThanOrEquals("westLerp",t,0),A.typeOf.number.lessThanOrEquals("westLerp",t,1),A.typeOf.number.greaterThanOrEquals("southLerp",n,0),A.typeOf.number.lessThanOrEquals("southLerp",n,1),A.typeOf.number.greaterThanOrEquals("eastLerp",i,0),A.typeOf.number.lessThanOrEquals("eastLerp",i,1),A.typeOf.number.greaterThanOrEquals("northLerp",o,0),A.typeOf.number.lessThanOrEquals("northLerp",o,1),A.typeOf.number.lessThanOrEquals("westLerp",t,i),A.typeOf.number.lessThanOrEquals("southLerp",n,o),c(r)||(r=new ce),e.west<=e.east){const a=e.east-e.west;r.west=e.west+t*a,r.east=e.west+i*a}else{const a=R.TWO_PI+e.east-e.west;r.west=R.negativePiToPi(e.west+t*a),r.east=R.negativePiToPi(e.west+i*a)}const s=e.north-e.south;return r.south=e.south+n*s,r.north=e.south+o*s,t===1&&(r.west=e.east),i===1&&(r.east=e.east),n===1&&(r.south=e.north),o===1&&(r.north=e.north),r};ce.MAX_VALUE=Object.freeze(new ce(-Math.PI,-R.PI_OVER_TWO,Math.PI,R.PI_OVER_TWO));function Re(e,t,n,i){this.x=y(e,0),this.y=y(t,0),this.width=y(n,0),this.height=y(i,0)}Re.packedLength=4;Re.pack=function(e,t,n){return A.typeOf.object("value",e),A.defined("array",t),n=y(n,0),t[n++]=e.x,t[n++]=e.y,t[n++]=e.width,t[n]=e.height,t};Re.unpack=function(e,t,n){return A.defined("array",e),t=y(t,0),c(n)||(n=new Re),n.x=e[t++],n.y=e[t++],n.width=e[t++],n.height=e[t],n};Re.fromPoints=function(e,t){if(c(t)||(t=new Re),!c(e)||e.length===0)return t.x=0,t.y=0,t.width=0,t.height=0,t;const n=e.length;let i=e[0].x,o=e[0].y,r=e[0].x,s=e[0].y;for(let a=1;a<n;a++){const l=e[a],u=l.x,h=l.y;i=Math.min(u,i),r=Math.max(u,r),o=Math.min(h,o),s=Math.max(h,s)}return t.x=i,t.y=o,t.width=r-i,t.height=s-o,t};const S$=new co,v$=new he,I$=new he;Re.fromRectangle=function(e,t,n){if(c(n)||(n=new Re),!c(e))return n.x=0,n.y=0,n.width=0,n.height=0,n;t=y(t,S$);const i=t.project(ce.southwest(e,v$)),o=t.project(ce.northeast(e,I$));return H.subtract(o,i,o),n.x=i.x,n.y=i.y,n.width=o.x,n.height=o.y,n};Re.clone=function(e,t){if(!!c(e))return c(t)?(t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height,t):new Re(e.x,e.y,e.width,e.height)};Re.union=function(e,t,n){A.typeOf.object("left",e),A.typeOf.object("right",t),c(n)||(n=new Re);const i=Math.min(e.x,t.x),o=Math.min(e.y,t.y),r=Math.max(e.x+e.width,t.x+t.width),s=Math.max(e.y+e.height,t.y+t.height);return n.x=i,n.y=o,n.width=r-i,n.height=s-o,n};Re.expand=function(e,t,n){A.typeOf.object("rectangle",e),A.typeOf.object("point",t),n=Re.clone(e,n);const i=t.x-n.x,o=t.y-n.y;return i>n.width?n.width=i:i<0&&(n.width-=i,n.x=t.x),o>n.height?n.height=o:o<0&&(n.height-=o,n.y=t.y),n};Re.intersect=function(e,t){A.typeOf.object("left",e),A.typeOf.object("right",t);const n=e.x,i=e.y,o=t.x,r=t.y;return n>o+t.width||n+e.width<o||i+e.height<r||i>r+t.height?Bt.OUTSIDE:Bt.INTERSECTING};Re.equals=function(e,t){return e===t||c(e)&&c(t)&&e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height};Re.prototype.clone=function(e){return Re.clone(this,e)};Re.prototype.intersect=function(e){return Re.intersect(this,e)};Re.prototype.equals=function(e){return Re.equals(this,e)};const Br={POINTS:J.POINTS,LINES:J.LINES,LINE_LOOP:J.LINE_LOOP,LINE_STRIP:J.LINE_STRIP,TRIANGLES:J.TRIANGLES,TRIANGLE_STRIP:J.TRIANGLE_STRIP,TRIANGLE_FAN:J.TRIANGLE_FAN};Br.isLines=function(e){return e===Br.LINES||e===Br.LINE_LOOP||e===Br.LINE_STRIP};Br.isTriangles=function(e){return e===Br.TRIANGLES||e===Br.TRIANGLE_STRIP||e===Br.TRIANGLE_FAN};Br.validate=function(e){return e===Br.POINTS||e===Br.LINES||e===Br.LINE_LOOP||e===Br.LINE_STRIP||e===Br.TRIANGLES||e===Br.TRIANGLE_STRIP||e===Br.TRIANGLE_FAN};const ze=Object.freeze(Br),RU=`in vec4 position;
|
|
in vec2 textureCoordinates;
|
|
|
|
out vec2 v_textureCoordinates;
|
|
|
|
void main()
|
|
{
|
|
gl_Position = position;
|
|
v_textureCoordinates = textureCoordinates;
|
|
}
|
|
`,Wi={CULL:1,OCCLUDE:2,EXECUTE_IN_CLOSEST_FRUSTUM:4,DEBUG_SHOW_BOUNDING_VOLUME:8,CAST_SHADOWS:16,RECEIVE_SHADOWS:32,PICK_ONLY:64,DEPTH_FOR_TRANSLUCENT_CLASSIFICATION:128};function Ze(e){e=y(e,y.EMPTY_OBJECT),this._boundingVolume=e.boundingVolume,this._orientedBoundingBox=e.orientedBoundingBox,this._modelMatrix=e.modelMatrix,this._primitiveType=y(e.primitiveType,ze.TRIANGLES),this._vertexArray=e.vertexArray,this._count=e.count,this._offset=y(e.offset,0),this._instanceCount=y(e.instanceCount,0),this._shaderProgram=e.shaderProgram,this._uniformMap=e.uniformMap,this._renderState=e.renderState,this._framebuffer=e.framebuffer,this._pass=e.pass,this._owner=e.owner,this._debugOverlappingFrustums=0,this._pickId=e.pickId,this._flags=0,this.cull=y(e.cull,!0),this.occlude=y(e.occlude,!0),this.executeInClosestFrustum=y(e.executeInClosestFrustum,!1),this.debugShowBoundingVolume=y(e.debugShowBoundingVolume,!1),this.castShadows=y(e.castShadows,!1),this.receiveShadows=y(e.receiveShadows,!1),this.pickOnly=y(e.pickOnly,!1),this.depthForTranslucentClassification=y(e.depthForTranslucentClassification,!1),this.dirty=!0,this.lastDirtyTime=0,this.derivedCommands={}}function Kr(e,t){return(e._flags&t)===t}function zd(e,t,n){n?e._flags|=t:e._flags&=~t}Object.defineProperties(Ze.prototype,{boundingVolume:{get:function(){return this._boundingVolume},set:function(e){this._boundingVolume!==e&&(this._boundingVolume=e,this.dirty=!0)}},orientedBoundingBox:{get:function(){return this._orientedBoundingBox},set:function(e){this._orientedBoundingBox!==e&&(this._orientedBoundingBox=e,this.dirty=!0)}},cull:{get:function(){return Kr(this,Wi.CULL)},set:function(e){Kr(this,Wi.CULL)!==e&&(zd(this,Wi.CULL,e),this.dirty=!0)}},occlude:{get:function(){return Kr(this,Wi.OCCLUDE)},set:function(e){Kr(this,Wi.OCCLUDE)!==e&&(zd(this,Wi.OCCLUDE,e),this.dirty=!0)}},modelMatrix:{get:function(){return this._modelMatrix},set:function(e){this._modelMatrix!==e&&(this._modelMatrix=e,this.dirty=!0)}},primitiveType:{get:function(){return this._primitiveType},set:function(e){this._primitiveType!==e&&(this._primitiveType=e,this.dirty=!0)}},vertexArray:{get:function(){return this._vertexArray},set:function(e){this._vertexArray!==e&&(this._vertexArray=e,this.dirty=!0)}},count:{get:function(){return this._count},set:function(e){this._count!==e&&(this._count=e,this.dirty=!0)}},offset:{get:function(){return this._offset},set:function(e){this._offset!==e&&(this._offset=e,this.dirty=!0)}},instanceCount:{get:function(){return this._instanceCount},set:function(e){this._instanceCount!==e&&(this._instanceCount=e,this.dirty=!0)}},shaderProgram:{get:function(){return this._shaderProgram},set:function(e){this._shaderProgram!==e&&(this._shaderProgram=e,this.dirty=!0)}},castShadows:{get:function(){return Kr(this,Wi.CAST_SHADOWS)},set:function(e){Kr(this,Wi.CAST_SHADOWS)!==e&&(zd(this,Wi.CAST_SHADOWS,e),this.dirty=!0)}},receiveShadows:{get:function(){return Kr(this,Wi.RECEIVE_SHADOWS)},set:function(e){Kr(this,Wi.RECEIVE_SHADOWS)!==e&&(zd(this,Wi.RECEIVE_SHADOWS,e),this.dirty=!0)}},uniformMap:{get:function(){return this._uniformMap},set:function(e){this._uniformMap!==e&&(this._uniformMap=e,this.dirty=!0)}},renderState:{get:function(){return this._renderState},set:function(e){this._renderState!==e&&(this._renderState=e,this.dirty=!0)}},framebuffer:{get:function(){return this._framebuffer},set:function(e){this._framebuffer!==e&&(this._framebuffer=e,this.dirty=!0)}},pass:{get:function(){return this._pass},set:function(e){this._pass!==e&&(this._pass=e,this.dirty=!0)}},executeInClosestFrustum:{get:function(){return Kr(this,Wi.EXECUTE_IN_CLOSEST_FRUSTUM)},set:function(e){Kr(this,Wi.EXECUTE_IN_CLOSEST_FRUSTUM)!==e&&(zd(this,Wi.EXECUTE_IN_CLOSEST_FRUSTUM,e),this.dirty=!0)}},owner:{get:function(){return this._owner},set:function(e){this._owner!==e&&(this._owner=e,this.dirty=!0)}},debugShowBoundingVolume:{get:function(){return Kr(this,Wi.DEBUG_SHOW_BOUNDING_VOLUME)},set:function(e){Kr(this,Wi.DEBUG_SHOW_BOUNDING_VOLUME)!==e&&(zd(this,Wi.DEBUG_SHOW_BOUNDING_VOLUME,e),this.dirty=!0)}},debugOverlappingFrustums:{get:function(){return this._debugOverlappingFrustums},set:function(e){this._debugOverlappingFrustums!==e&&(this._debugOverlappingFrustums=e,this.dirty=!0)}},pickId:{get:function(){return this._pickId},set:function(e){this._pickId!==e&&(this._pickId=e,this.dirty=!0)}},pickOnly:{get:function(){return Kr(this,Wi.PICK_ONLY)},set:function(e){Kr(this,Wi.PICK_ONLY)!==e&&(zd(this,Wi.PICK_ONLY,e),this.dirty=!0)}},depthForTranslucentClassification:{get:function(){return Kr(this,Wi.DEPTH_FOR_TRANSLUCENT_CLASSIFICATION)},set:function(e){Kr(this,Wi.DEPTH_FOR_TRANSLUCENT_CLASSIFICATION)!==e&&(zd(this,Wi.DEPTH_FOR_TRANSLUCENT_CLASSIFICATION,e),this.dirty=!0)}}});Ze.shallowClone=function(e,t){if(!!c(e))return c(t)||(t=new Ze),t._boundingVolume=e._boundingVolume,t._orientedBoundingBox=e._orientedBoundingBox,t._modelMatrix=e._modelMatrix,t._primitiveType=e._primitiveType,t._vertexArray=e._vertexArray,t._count=e._count,t._offset=e._offset,t._instanceCount=e._instanceCount,t._shaderProgram=e._shaderProgram,t._uniformMap=e._uniformMap,t._renderState=e._renderState,t._framebuffer=e._framebuffer,t._pass=e._pass,t._owner=e._owner,t._debugOverlappingFrustums=e._debugOverlappingFrustums,t._pickId=e._pickId,t._flags=e._flags,t.dirty=!0,t.lastDirtyTime=0,t};Ze.prototype.execute=function(e,t){e.draw(this,t)};const Cn={UNSIGNED_BYTE:J.UNSIGNED_BYTE,UNSIGNED_SHORT:J.UNSIGNED_SHORT,UNSIGNED_INT:J.UNSIGNED_INT,FLOAT:J.FLOAT,HALF_FLOAT:J.HALF_FLOAT_OES,UNSIGNED_INT_24_8:J.UNSIGNED_INT_24_8,UNSIGNED_SHORT_4_4_4_4:J.UNSIGNED_SHORT_4_4_4_4,UNSIGNED_SHORT_5_5_5_1:J.UNSIGNED_SHORT_5_5_5_1,UNSIGNED_SHORT_5_6_5:J.UNSIGNED_SHORT_5_6_5};Cn.toWebGLConstant=function(e,t){switch(e){case Cn.UNSIGNED_BYTE:return J.UNSIGNED_BYTE;case Cn.UNSIGNED_SHORT:return J.UNSIGNED_SHORT;case Cn.UNSIGNED_INT:return J.UNSIGNED_INT;case Cn.FLOAT:return J.FLOAT;case Cn.HALF_FLOAT:return t.webgl2?J.HALF_FLOAT:J.HALF_FLOAT_OES;case Cn.UNSIGNED_INT_24_8:return J.UNSIGNED_INT_24_8;case Cn.UNSIGNED_SHORT_4_4_4_4:return J.UNSIGNED_SHORT_4_4_4_4;case Cn.UNSIGNED_SHORT_5_5_5_1:return J.UNSIGNED_SHORT_5_5_5_1;case Cn.UNSIGNED_SHORT_5_6_5:return Cn.UNSIGNED_SHORT_5_6_5}};Cn.isPacked=function(e){return e===Cn.UNSIGNED_INT_24_8||e===Cn.UNSIGNED_SHORT_4_4_4_4||e===Cn.UNSIGNED_SHORT_5_5_5_1||e===Cn.UNSIGNED_SHORT_5_6_5};Cn.sizeInBytes=function(e){switch(e){case Cn.UNSIGNED_BYTE:return 1;case Cn.UNSIGNED_SHORT:case Cn.UNSIGNED_SHORT_4_4_4_4:case Cn.UNSIGNED_SHORT_5_5_5_1:case Cn.UNSIGNED_SHORT_5_6_5:case Cn.HALF_FLOAT:return 2;case Cn.UNSIGNED_INT:case Cn.FLOAT:case Cn.UNSIGNED_INT_24_8:return 4}};Cn.validate=function(e){return e===Cn.UNSIGNED_BYTE||e===Cn.UNSIGNED_SHORT||e===Cn.UNSIGNED_INT||e===Cn.FLOAT||e===Cn.HALF_FLOAT||e===Cn.UNSIGNED_INT_24_8||e===Cn.UNSIGNED_SHORT_4_4_4_4||e===Cn.UNSIGNED_SHORT_5_5_5_1||e===Cn.UNSIGNED_SHORT_5_6_5};const Me=Object.freeze(Cn),Ne={DEPTH_COMPONENT:J.DEPTH_COMPONENT,DEPTH_STENCIL:J.DEPTH_STENCIL,ALPHA:J.ALPHA,RED:J.RED,RG:J.RG,RGB:J.RGB,RGBA:J.RGBA,LUMINANCE:J.LUMINANCE,LUMINANCE_ALPHA:J.LUMINANCE_ALPHA,RGB_DXT1:J.COMPRESSED_RGB_S3TC_DXT1_EXT,RGBA_DXT1:J.COMPRESSED_RGBA_S3TC_DXT1_EXT,RGBA_DXT3:J.COMPRESSED_RGBA_S3TC_DXT3_EXT,RGBA_DXT5:J.COMPRESSED_RGBA_S3TC_DXT5_EXT,RGB_PVRTC_4BPPV1:J.COMPRESSED_RGB_PVRTC_4BPPV1_IMG,RGB_PVRTC_2BPPV1:J.COMPRESSED_RGB_PVRTC_2BPPV1_IMG,RGBA_PVRTC_4BPPV1:J.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,RGBA_PVRTC_2BPPV1:J.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,RGBA_ASTC:J.COMPRESSED_RGBA_ASTC_4x4_WEBGL,RGB_ETC1:J.COMPRESSED_RGB_ETC1_WEBGL,RGB8_ETC2:J.COMPRESSED_RGB8_ETC2,RGBA8_ETC2_EAC:J.COMPRESSED_RGBA8_ETC2_EAC,RGBA_BC7:J.COMPRESSED_RGBA_BPTC_UNORM};Ne.componentsLength=function(e){switch(e){case Ne.RGB:return 3;case Ne.RGBA:return 4;case Ne.LUMINANCE_ALPHA:case Ne.RG:return 2;case Ne.ALPHA:case Ne.RED:case Ne.LUMINANCE:return 1;default:return 1}};Ne.validate=function(e){return e===Ne.DEPTH_COMPONENT||e===Ne.DEPTH_STENCIL||e===Ne.ALPHA||e===Ne.RED||e===Ne.RG||e===Ne.RGB||e===Ne.RGBA||e===Ne.LUMINANCE||e===Ne.LUMINANCE_ALPHA||e===Ne.RGB_DXT1||e===Ne.RGBA_DXT1||e===Ne.RGBA_DXT3||e===Ne.RGBA_DXT5||e===Ne.RGB_PVRTC_4BPPV1||e===Ne.RGB_PVRTC_2BPPV1||e===Ne.RGBA_PVRTC_4BPPV1||e===Ne.RGBA_PVRTC_2BPPV1||e===Ne.RGBA_ASTC||e===Ne.RGB_ETC1||e===Ne.RGB8_ETC2||e===Ne.RGBA8_ETC2_EAC||e===Ne.RGBA_BC7};Ne.isColorFormat=function(e){return e===Ne.RED||e===Ne.ALPHA||e===Ne.RGB||e===Ne.RGBA||e===Ne.LUMINANCE||e===Ne.LUMINANCE_ALPHA};Ne.isDepthFormat=function(e){return e===Ne.DEPTH_COMPONENT||e===Ne.DEPTH_STENCIL};Ne.isCompressedFormat=function(e){return e===Ne.RGB_DXT1||e===Ne.RGBA_DXT1||e===Ne.RGBA_DXT3||e===Ne.RGBA_DXT5||e===Ne.RGB_PVRTC_4BPPV1||e===Ne.RGB_PVRTC_2BPPV1||e===Ne.RGBA_PVRTC_4BPPV1||e===Ne.RGBA_PVRTC_2BPPV1||e===Ne.RGBA_ASTC||e===Ne.RGB_ETC1||e===Ne.RGB8_ETC2||e===Ne.RGBA8_ETC2_EAC||e===Ne.RGBA_BC7};Ne.isDXTFormat=function(e){return e===Ne.RGB_DXT1||e===Ne.RGBA_DXT1||e===Ne.RGBA_DXT3||e===Ne.RGBA_DXT5};Ne.isPVRTCFormat=function(e){return e===Ne.RGB_PVRTC_4BPPV1||e===Ne.RGB_PVRTC_2BPPV1||e===Ne.RGBA_PVRTC_4BPPV1||e===Ne.RGBA_PVRTC_2BPPV1};Ne.isASTCFormat=function(e){return e===Ne.RGBA_ASTC};Ne.isETC1Format=function(e){return e===Ne.RGB_ETC1};Ne.isETC2Format=function(e){return e===Ne.RGB8_ETC2||e===Ne.RGBA8_ETC2_EAC};Ne.isBC7Format=function(e){return e===Ne.RGBA_BC7};Ne.compressedTextureSizeInBytes=function(e,t,n){switch(e){case Ne.RGB_DXT1:case Ne.RGBA_DXT1:case Ne.RGB_ETC1:case Ne.RGB8_ETC2:return Math.floor((t+3)/4)*Math.floor((n+3)/4)*8;case Ne.RGBA_DXT3:case Ne.RGBA_DXT5:case Ne.RGBA_ASTC:case Ne.RGBA8_ETC2_EAC:return Math.floor((t+3)/4)*Math.floor((n+3)/4)*16;case Ne.RGB_PVRTC_4BPPV1:case Ne.RGBA_PVRTC_4BPPV1:return Math.floor((Math.max(t,8)*Math.max(n,8)*4+7)/8);case Ne.RGB_PVRTC_2BPPV1:case Ne.RGBA_PVRTC_2BPPV1:return Math.floor((Math.max(t,16)*Math.max(n,8)*2+7)/8);case Ne.RGBA_BC7:return Math.ceil(t/4)*Math.ceil(n/4)*16;default:return 0}};Ne.textureSizeInBytes=function(e,t,n,i){let o=Ne.componentsLength(e);return Me.isPacked(t)&&(o=1),o*Me.sizeInBytes(t)*n*i};Ne.alignmentInBytes=function(e,t,n){const i=Ne.textureSizeInBytes(e,t,n,1)%4;return i===0?4:i===2?2:1};Ne.createTypedArray=function(e,t,n,i){let o;const r=Me.sizeInBytes(t);r===Uint8Array.BYTES_PER_ELEMENT?o=Uint8Array:r===Uint16Array.BYTES_PER_ELEMENT?o=Uint16Array:r===Float32Array.BYTES_PER_ELEMENT&&t===Me.FLOAT?o=Float32Array:o=Uint32Array;const s=Ne.componentsLength(e)*n*i;return new o(s)};Ne.flipY=function(e,t,n,i,o){if(o===1)return e;const r=Ne.createTypedArray(t,n,i,o),s=Ne.componentsLength(t),a=i*s;for(let l=0;l<o;++l){const u=l*i*s,h=(o-l-1)*i*s;for(let f=0;f<a;++f)r[h+f]=e[u+f]}return r};Ne.toInternalFormat=function(e,t,n){if(!n.webgl2)return e;if(e===Ne.DEPTH_STENCIL)return J.DEPTH24_STENCIL8;if(e===Ne.DEPTH_COMPONENT){if(t===Me.UNSIGNED_SHORT)return J.DEPTH_COMPONENT16;if(t===Me.UNSIGNED_INT)return J.DEPTH_COMPONENT24}if(t===Me.FLOAT)switch(e){case Ne.RGBA:return J.RGBA32F;case Ne.RGB:return J.RGB32F;case Ne.RG:return J.RG32F;case Ne.RED:return J.R32F}if(t===Me.HALF_FLOAT)switch(e){case Ne.RGBA:return J.RGBA16F;case Ne.RGB:return J.RGB16F;case Ne.RG:return J.RG16F;case Ne.RED:return J.R16F}return e};const Ve=Object.freeze(Ne),qi={_maximumCombinedTextureImageUnits:0,_maximumCubeMapSize:0,_maximumFragmentUniformVectors:0,_maximumTextureImageUnits:0,_maximumRenderbufferSize:0,_maximumTextureSize:0,_maximumVaryingVectors:0,_maximumVertexAttributes:0,_maximumVertexTextureImageUnits:0,_maximumVertexUniformVectors:0,_minimumAliasedLineWidth:0,_maximumAliasedLineWidth:0,_minimumAliasedPointSize:0,_maximumAliasedPointSize:0,_maximumViewportWidth:0,_maximumViewportHeight:0,_maximumTextureFilterAnisotropy:0,_maximumDrawBuffers:0,_maximumColorAttachments:0,_maximumSamples:0,_highpFloatSupported:!1,_highpIntSupported:!1};Object.defineProperties(qi,{maximumCombinedTextureImageUnits:{get:function(){return qi._maximumCombinedTextureImageUnits}},maximumCubeMapSize:{get:function(){return qi._maximumCubeMapSize}},maximumFragmentUniformVectors:{get:function(){return qi._maximumFragmentUniformVectors}},maximumTextureImageUnits:{get:function(){return qi._maximumTextureImageUnits}},maximumRenderbufferSize:{get:function(){return qi._maximumRenderbufferSize}},maximumTextureSize:{get:function(){return qi._maximumTextureSize}},maximumVaryingVectors:{get:function(){return qi._maximumVaryingVectors}},maximumVertexAttributes:{get:function(){return qi._maximumVertexAttributes}},maximumVertexTextureImageUnits:{get:function(){return qi._maximumVertexTextureImageUnits}},maximumVertexUniformVectors:{get:function(){return qi._maximumVertexUniformVectors}},minimumAliasedLineWidth:{get:function(){return qi._minimumAliasedLineWidth}},maximumAliasedLineWidth:{get:function(){return qi._maximumAliasedLineWidth}},minimumAliasedPointSize:{get:function(){return qi._minimumAliasedPointSize}},maximumAliasedPointSize:{get:function(){return qi._maximumAliasedPointSize}},maximumViewportWidth:{get:function(){return qi._maximumViewportWidth}},maximumViewportHeight:{get:function(){return qi._maximumViewportHeight}},maximumTextureFilterAnisotropy:{get:function(){return qi._maximumTextureFilterAnisotropy}},maximumDrawBuffers:{get:function(){return qi._maximumDrawBuffers}},maximumColorAttachments:{get:function(){return qi._maximumColorAttachments}},maximumSamples:{get:function(){return qi._maximumSamples}},highpFloatSupported:{get:function(){return qi._highpFloatSupported}},highpIntSupported:{get:function(){return qi._highpIntSupported}}});const pt=qi;function QE(e,t,n){const i=e._gl;i.framebufferTexture2D(i.FRAMEBUFFER,t,n._target,n._texture,0)}function Ub(e,t,n){const i=e._gl;i.framebufferRenderbuffer(i.FRAMEBUFFER,t,i.RENDERBUFFER,n._getRenderbuffer())}function ur(e){e=y(e,y.EMPTY_OBJECT);const t=e.context;A.defined("options.context",t);const n=t._gl,i=pt.maximumColorAttachments;if(this._gl=n,this._framebuffer=n.createFramebuffer(),this._colorTextures=[],this._colorRenderbuffers=[],this._activeColorAttachments=[],this._depthTexture=void 0,this._depthRenderbuffer=void 0,this._stencilRenderbuffer=void 0,this._depthStencilTexture=void 0,this._depthStencilRenderbuffer=void 0,this.destroyAttachments=y(e.destroyAttachments,!0),c(e.colorTextures)&&c(e.colorRenderbuffers))throw new E("Cannot have both color texture and color renderbuffer attachments.");if(c(e.depthTexture)&&c(e.depthRenderbuffer))throw new E("Cannot have both a depth texture and depth renderbuffer attachment.");if(c(e.depthStencilTexture)&&c(e.depthStencilRenderbuffer))throw new E("Cannot have both a depth-stencil texture and depth-stencil renderbuffer attachment.");const o=c(e.depthTexture)||c(e.depthRenderbuffer),r=c(e.depthStencilTexture)||c(e.depthStencilRenderbuffer);if(o&&r)throw new E("Cannot have both a depth and depth-stencil attachment.");if(c(e.stencilRenderbuffer)&&r)throw new E("Cannot have both a stencil and depth-stencil attachment.");if(o&&c(e.stencilRenderbuffer))throw new E("Cannot have both a depth and stencil attachment.");this._bind();let s,a,l,u,h;if(c(e.colorTextures)){const f=e.colorTextures;if(u=this._colorTextures.length=this._activeColorAttachments.length=f.length,u>i)throw new E("The number of color attachments exceeds the number supported.");for(l=0;l<u;++l){if(s=f[l],!Ve.isColorFormat(s.pixelFormat))throw new E("The color-texture pixel-format must be a color format.");if(s.pixelDatatype===Me.FLOAT&&!t.colorBufferFloat)throw new E("The color texture pixel datatype is FLOAT and the WebGL implementation does not support the EXT_color_buffer_float or WEBGL_color_buffer_float extensions. See Context.colorBufferFloat.");if(s.pixelDatatype===Me.HALF_FLOAT&&!t.colorBufferHalfFloat)throw new E("The color texture pixel datatype is HALF_FLOAT and the WebGL implementation does not support the EXT_color_buffer_half_float extension. See Context.colorBufferHalfFloat.");h=this._gl.COLOR_ATTACHMENT0+l,QE(this,h,s),this._activeColorAttachments[l]=h,this._colorTextures[l]=s}}if(c(e.colorRenderbuffers)){const f=e.colorRenderbuffers;if(u=this._colorRenderbuffers.length=this._activeColorAttachments.length=f.length,u>i)throw new E("The number of color attachments exceeds the number supported.");for(l=0;l<u;++l)a=f[l],h=this._gl.COLOR_ATTACHMENT0+l,Ub(this,h,a),this._activeColorAttachments[l]=h,this._colorRenderbuffers[l]=a}if(c(e.depthTexture)){if(s=e.depthTexture,s.pixelFormat!==Ve.DEPTH_COMPONENT)throw new E("The depth-texture pixel-format must be DEPTH_COMPONENT.");QE(this,this._gl.DEPTH_ATTACHMENT,s),this._depthTexture=s}if(c(e.depthRenderbuffer)&&(a=e.depthRenderbuffer,Ub(this,this._gl.DEPTH_ATTACHMENT,a),this._depthRenderbuffer=a),c(e.stencilRenderbuffer)&&(a=e.stencilRenderbuffer,Ub(this,this._gl.STENCIL_ATTACHMENT,a),this._stencilRenderbuffer=a),c(e.depthStencilTexture)){if(s=e.depthStencilTexture,s.pixelFormat!==Ve.DEPTH_STENCIL)throw new E("The depth-stencil pixel-format must be DEPTH_STENCIL.");QE(this,this._gl.DEPTH_STENCIL_ATTACHMENT,s),this._depthStencilTexture=s}c(e.depthStencilRenderbuffer)&&(a=e.depthStencilRenderbuffer,Ub(this,this._gl.DEPTH_STENCIL_ATTACHMENT,a),this._depthStencilRenderbuffer=a),this._unBind()}Object.defineProperties(ur.prototype,{status:{get:function(){this._bind();const e=this._gl.checkFramebufferStatus(this._gl.FRAMEBUFFER);return this._unBind(),e}},numberOfColorAttachments:{get:function(){return this._activeColorAttachments.length}},depthTexture:{get:function(){return this._depthTexture}},depthRenderbuffer:{get:function(){return this._depthRenderbuffer}},stencilRenderbuffer:{get:function(){return this._stencilRenderbuffer}},depthStencilTexture:{get:function(){return this._depthStencilTexture}},depthStencilRenderbuffer:{get:function(){return this._depthStencilRenderbuffer}},hasDepthAttachment:{get:function(){return!!(this.depthTexture||this.depthRenderbuffer||this.depthStencilTexture||this.depthStencilRenderbuffer)}}});ur.prototype._bind=function(){const e=this._gl;e.bindFramebuffer(e.FRAMEBUFFER,this._framebuffer)};ur.prototype._unBind=function(){const e=this._gl;e.bindFramebuffer(e.FRAMEBUFFER,null)};ur.prototype.bindDraw=function(){const e=this._gl;e.bindFramebuffer(e.DRAW_FRAMEBUFFER,this._framebuffer)};ur.prototype.bindRead=function(){const e=this._gl;e.bindFramebuffer(e.READ_FRAMEBUFFER,this._framebuffer)};ur.prototype._getActiveColorAttachments=function(){return this._activeColorAttachments};ur.prototype.getColorTexture=function(e){if(!c(e)||e<0||e>=this._colorTextures.length)throw new E("index is required, must be greater than or equal to zero and must be less than the number of color attachments.");return this._colorTextures[e]};ur.prototype.getColorRenderbuffer=function(e){if(!c(e)||e<0||e>=this._colorRenderbuffers.length)throw new E("index is required, must be greater than or equal to zero and must be less than the number of color attachments.");return this._colorRenderbuffers[e]};ur.prototype.isDestroyed=function(){return!1};ur.prototype.destroy=function(){if(this.destroyAttachments){let e=0;const t=this._colorTextures;let n=t.length;for(;e<n;++e){const o=t[e];c(o)&&o.destroy()}const i=this._colorRenderbuffers;for(n=i.length,e=0;e<n;++e){const o=i[e];c(o)&&o.destroy()}this._depthTexture=this._depthTexture&&this._depthTexture.destroy(),this._depthRenderbuffer=this._depthRenderbuffer&&this._depthRenderbuffer.destroy(),this._stencilRenderbuffer=this._stencilRenderbuffer&&this._stencilRenderbuffer.destroy(),this._depthStencilTexture=this._depthStencilTexture&&this._depthStencilTexture.destroy(),this._depthStencilRenderbuffer=this._depthStencilRenderbuffer&&this._depthStencilRenderbuffer.destroy()}return this._gl.deleteFramebuffer(this._framebuffer),ve(this)};const LA={CLOCKWISE:J.CW,COUNTER_CLOCKWISE:J.CCW};LA.validate=function(e){return e===LA.CLOCKWISE||e===LA.COUNTER_CLOCKWISE};const wc=Object.freeze(LA);function NU(e){if(typeof e!="object"||e===null)return e;let t;const n=Object.keys(e);for(let i=0;i<n.length;i++)t=n[i],e.hasOwnProperty(t)&&t!=="_applyFunctions"&&(e[t]=NU(e[t]));return Object.freeze(e)}function jL(e){return e===J.FUNC_ADD||e===J.FUNC_SUBTRACT||e===J.FUNC_REVERSE_SUBTRACT||e===J.MIN||e===J.MAX}function kb(e){return e===J.ZERO||e===J.ONE||e===J.SRC_COLOR||e===J.ONE_MINUS_SRC_COLOR||e===J.DST_COLOR||e===J.ONE_MINUS_DST_COLOR||e===J.SRC_ALPHA||e===J.ONE_MINUS_SRC_ALPHA||e===J.DST_ALPHA||e===J.ONE_MINUS_DST_ALPHA||e===J.CONSTANT_COLOR||e===J.ONE_MINUS_CONSTANT_COLOR||e===J.CONSTANT_ALPHA||e===J.ONE_MINUS_CONSTANT_ALPHA||e===J.SRC_ALPHA_SATURATE}function D$(e){return e===J.FRONT||e===J.BACK||e===J.FRONT_AND_BACK}function P$(e){return e===J.NEVER||e===J.LESS||e===J.EQUAL||e===J.LEQUAL||e===J.GREATER||e===J.NOTEQUAL||e===J.GEQUAL||e===J.ALWAYS}function WL(e){return e===J.NEVER||e===J.LESS||e===J.EQUAL||e===J.LEQUAL||e===J.GREATER||e===J.NOTEQUAL||e===J.GEQUAL||e===J.ALWAYS}function sm(e){return e===J.ZERO||e===J.KEEP||e===J.REPLACE||e===J.INCR||e===J.DECR||e===J.INVERT||e===J.INCR_WRAP||e===J.DECR_WRAP}function Ue(e){const t=y(e,y.EMPTY_OBJECT),n=y(t.cull,y.EMPTY_OBJECT),i=y(t.polygonOffset,y.EMPTY_OBJECT),o=y(t.scissorTest,y.EMPTY_OBJECT),r=y(o.rectangle,y.EMPTY_OBJECT),s=y(t.depthRange,y.EMPTY_OBJECT),a=y(t.depthTest,y.EMPTY_OBJECT),l=y(t.colorMask,y.EMPTY_OBJECT),u=y(t.blending,y.EMPTY_OBJECT),h=y(u.color,y.EMPTY_OBJECT),f=y(t.stencilTest,y.EMPTY_OBJECT),_=y(f.frontOperation,y.EMPTY_OBJECT),g=y(f.backOperation,y.EMPTY_OBJECT),m=y(t.sampleCoverage,y.EMPTY_OBJECT),b=t.viewport;if(this.frontFace=y(t.frontFace,wc.COUNTER_CLOCKWISE),this.cull={enabled:y(n.enabled,!1),face:y(n.face,J.BACK)},this.lineWidth=y(t.lineWidth,1),this.polygonOffset={enabled:y(i.enabled,!1),factor:y(i.factor,0),units:y(i.units,0)},this.scissorTest={enabled:y(o.enabled,!1),rectangle:Re.clone(r)},this.depthRange={near:y(s.near,0),far:y(s.far,1)},this.depthTest={enabled:y(a.enabled,!1),func:y(a.func,J.LESS)},this.colorMask={red:y(l.red,!0),green:y(l.green,!0),blue:y(l.blue,!0),alpha:y(l.alpha,!0)},this.depthMask=y(t.depthMask,!0),this.stencilMask=y(t.stencilMask,-1),this.blending={enabled:y(u.enabled,!1),color:new z(y(h.red,0),y(h.green,0),y(h.blue,0),y(h.alpha,0)),equationRgb:y(u.equationRgb,J.FUNC_ADD),equationAlpha:y(u.equationAlpha,J.FUNC_ADD),functionSourceRgb:y(u.functionSourceRgb,J.ONE),functionSourceAlpha:y(u.functionSourceAlpha,J.ONE),functionDestinationRgb:y(u.functionDestinationRgb,J.ZERO),functionDestinationAlpha:y(u.functionDestinationAlpha,J.ZERO)},this.stencilTest={enabled:y(f.enabled,!1),frontFunction:y(f.frontFunction,J.ALWAYS),backFunction:y(f.backFunction,J.ALWAYS),reference:y(f.reference,0),mask:y(f.mask,-1),frontOperation:{fail:y(_.fail,J.KEEP),zFail:y(_.zFail,J.KEEP),zPass:y(_.zPass,J.KEEP)},backOperation:{fail:y(g.fail,J.KEEP),zFail:y(g.zFail,J.KEEP),zPass:y(g.zPass,J.KEEP)}},this.sampleCoverage={enabled:y(m.enabled,!1),value:y(m.value,1),invert:y(m.invert,!1)},this.viewport=c(b)?new Re(b.x,b.y,b.width,b.height):void 0,this.lineWidth<pt.minimumAliasedLineWidth||this.lineWidth>pt.maximumAliasedLineWidth)throw new E("renderState.lineWidth is out of range. Check minimumAliasedLineWidth and maximumAliasedLineWidth.");if(!wc.validate(this.frontFace))throw new E("Invalid renderState.frontFace.");if(!D$(this.cull.face))throw new E("Invalid renderState.cull.face.");if(this.scissorTest.rectangle.width<0||this.scissorTest.rectangle.height<0)throw new E("renderState.scissorTest.rectangle.width and renderState.scissorTest.rectangle.height must be greater than or equal to zero.");if(this.depthRange.near>this.depthRange.far)throw new E("renderState.depthRange.near can not be greater than renderState.depthRange.far.");if(this.depthRange.near<0)throw new E("renderState.depthRange.near must be greater than or equal to zero.");if(this.depthRange.far>1)throw new E("renderState.depthRange.far must be less than or equal to one.");if(!P$(this.depthTest.func))throw new E("Invalid renderState.depthTest.func.");if(this.blending.color.red<0||this.blending.color.red>1||this.blending.color.green<0||this.blending.color.green>1||this.blending.color.blue<0||this.blending.color.blue>1||this.blending.color.alpha<0||this.blending.color.alpha>1)throw new E("renderState.blending.color components must be greater than or equal to zero and less than or equal to one.");if(!jL(this.blending.equationRgb))throw new E("Invalid renderState.blending.equationRgb.");if(!jL(this.blending.equationAlpha))throw new E("Invalid renderState.blending.equationAlpha.");if(!kb(this.blending.functionSourceRgb))throw new E("Invalid renderState.blending.functionSourceRgb.");if(!kb(this.blending.functionSourceAlpha))throw new E("Invalid renderState.blending.functionSourceAlpha.");if(!kb(this.blending.functionDestinationRgb))throw new E("Invalid renderState.blending.functionDestinationRgb.");if(!kb(this.blending.functionDestinationAlpha))throw new E("Invalid renderState.blending.functionDestinationAlpha.");if(!WL(this.stencilTest.frontFunction))throw new E("Invalid renderState.stencilTest.frontFunction.");if(!WL(this.stencilTest.backFunction))throw new E("Invalid renderState.stencilTest.backFunction.");if(!sm(this.stencilTest.frontOperation.fail))throw new E("Invalid renderState.stencilTest.frontOperation.fail.");if(!sm(this.stencilTest.frontOperation.zFail))throw new E("Invalid renderState.stencilTest.frontOperation.zFail.");if(!sm(this.stencilTest.frontOperation.zPass))throw new E("Invalid renderState.stencilTest.frontOperation.zPass.");if(!sm(this.stencilTest.backOperation.fail))throw new E("Invalid renderState.stencilTest.backOperation.fail.");if(!sm(this.stencilTest.backOperation.zFail))throw new E("Invalid renderState.stencilTest.backOperation.zFail.");if(!sm(this.stencilTest.backOperation.zPass))throw new E("Invalid renderState.stencilTest.backOperation.zPass.");if(c(this.viewport)){if(this.viewport.width<0)throw new E("renderState.viewport.width must be greater than or equal to zero.");if(this.viewport.height<0)throw new E("renderState.viewport.height must be greater than or equal to zero.");if(this.viewport.width>pt.maximumViewportWidth)throw new E(`renderState.viewport.width must be less than or equal to the maximum viewport width (${pt.maximumViewportWidth.toString()}). Check maximumViewportWidth.`);if(this.viewport.height>pt.maximumViewportHeight)throw new E(`renderState.viewport.height must be less than or equal to the maximum viewport height (${pt.maximumViewportHeight.toString()}). Check maximumViewportHeight.`)}this.id=0,this._applyFunctions=[]}let O$=0,Ql={};Ue.fromCache=function(e){const t=JSON.stringify(e);let n=Ql[t];if(c(n))return++n.referenceCount,n.state;let i=new Ue(e);const o=JSON.stringify(i);return n=Ql[o],c(n)||(i.id=O$++,i=NU(i),n={referenceCount:0,state:i},Ql[o]=n),++n.referenceCount,Ql[t]={referenceCount:1,state:n.state},n.state};Ue.removeFromCache=function(e){const t=new Ue(e),n=JSON.stringify(t),i=Ql[n],o=JSON.stringify(e),r=Ql[o];c(r)&&(--r.referenceCount,r.referenceCount===0&&(delete Ql[o],c(i)&&--i.referenceCount)),c(i)&&i.referenceCount===0&&delete Ql[n]};Ue.getCache=function(){return Ql};Ue.clearCache=function(){Ql={}};function Pp(e,t,n){n?e.enable(t):e.disable(t)}function MU(e,t){e.frontFace(t.frontFace)}function FU(e,t){const n=t.cull,i=n.enabled;Pp(e,e.CULL_FACE,i),i&&e.cullFace(n.face)}function BU(e,t){e.lineWidth(t.lineWidth)}function zU(e,t){const n=t.polygonOffset,i=n.enabled;Pp(e,e.POLYGON_OFFSET_FILL,i),i&&e.polygonOffset(n.factor,n.units)}function UU(e,t,n){const i=t.scissorTest,o=c(n.scissorTest)?n.scissorTest.enabled:i.enabled;if(Pp(e,e.SCISSOR_TEST,o),o){const r=c(n.scissorTest)?n.scissorTest.rectangle:i.rectangle;e.scissor(r.x,r.y,r.width,r.height)}}function kU(e,t){const n=t.depthRange;e.depthRange(n.near,n.far)}function VU(e,t){const n=t.depthTest,i=n.enabled;Pp(e,e.DEPTH_TEST,i),i&&e.depthFunc(n.func)}function HU(e,t){const n=t.colorMask;e.colorMask(n.red,n.green,n.blue,n.alpha)}function GU(e,t){e.depthMask(t.depthMask)}function jU(e,t){e.stencilMask(t.stencilMask)}function L$(e,t){e.blendColor(t.red,t.green,t.blue,t.alpha)}function WU(e,t,n){const i=t.blending,o=c(n.blendingEnabled)?n.blendingEnabled:i.enabled;Pp(e,e.BLEND,o),o&&(L$(e,i.color),e.blendEquationSeparate(i.equationRgb,i.equationAlpha),e.blendFuncSeparate(i.functionSourceRgb,i.functionDestinationRgb,i.functionSourceAlpha,i.functionDestinationAlpha))}function qU(e,t){const n=t.stencilTest,i=n.enabled;if(Pp(e,e.STENCIL_TEST,i),i){const o=n.frontFunction,r=n.backFunction,s=n.reference,a=n.mask;e.stencilFunc(o,s,a),e.stencilFuncSeparate(e.BACK,r,s,a),e.stencilFuncSeparate(e.FRONT,o,s,a);const l=n.frontOperation,u=l.fail,h=l.zFail,f=l.zPass;e.stencilOpSeparate(e.FRONT,u,h,f);const _=n.backOperation,g=_.fail,m=_.zFail,b=_.zPass;e.stencilOpSeparate(e.BACK,g,m,b)}}function YU(e,t){const n=t.sampleCoverage,i=n.enabled;Pp(e,e.SAMPLE_COVERAGE,i),i&&e.sampleCoverage(n.value,n.invert)}const R$=new Re;function $U(e,t,n){let i=y(t.viewport,n.viewport);c(i)||(i=R$,i.width=n.context.drawingBufferWidth,i.height=n.context.drawingBufferHeight),n.context.uniformState.viewport=i,e.viewport(i.x,i.y,i.width,i.height)}Ue.apply=function(e,t,n){MU(e,t),FU(e,t),BU(e,t),zU(e,t),kU(e,t),VU(e,t),HU(e,t),GU(e,t),jU(e,t),qU(e,t),YU(e,t),UU(e,t,n),WU(e,t,n),$U(e,t,n)};function N$(e,t){const n=[];return e.frontFace!==t.frontFace&&n.push(MU),(e.cull.enabled!==t.cull.enabled||e.cull.face!==t.cull.face)&&n.push(FU),e.lineWidth!==t.lineWidth&&n.push(BU),(e.polygonOffset.enabled!==t.polygonOffset.enabled||e.polygonOffset.factor!==t.polygonOffset.factor||e.polygonOffset.units!==t.polygonOffset.units)&&n.push(zU),(e.depthRange.near!==t.depthRange.near||e.depthRange.far!==t.depthRange.far)&&n.push(kU),(e.depthTest.enabled!==t.depthTest.enabled||e.depthTest.func!==t.depthTest.func)&&n.push(VU),(e.colorMask.red!==t.colorMask.red||e.colorMask.green!==t.colorMask.green||e.colorMask.blue!==t.colorMask.blue||e.colorMask.alpha!==t.colorMask.alpha)&&n.push(HU),e.depthMask!==t.depthMask&&n.push(GU),e.stencilMask!==t.stencilMask&&n.push(jU),(e.stencilTest.enabled!==t.stencilTest.enabled||e.stencilTest.frontFunction!==t.stencilTest.frontFunction||e.stencilTest.backFunction!==t.stencilTest.backFunction||e.stencilTest.reference!==t.stencilTest.reference||e.stencilTest.mask!==t.stencilTest.mask||e.stencilTest.frontOperation.fail!==t.stencilTest.frontOperation.fail||e.stencilTest.frontOperation.zFail!==t.stencilTest.frontOperation.zFail||e.stencilTest.backOperation.fail!==t.stencilTest.backOperation.fail||e.stencilTest.backOperation.zFail!==t.stencilTest.backOperation.zFail||e.stencilTest.backOperation.zPass!==t.stencilTest.backOperation.zPass)&&n.push(qU),(e.sampleCoverage.enabled!==t.sampleCoverage.enabled||e.sampleCoverage.value!==t.sampleCoverage.value||e.sampleCoverage.invert!==t.sampleCoverage.invert)&&n.push(YU),n}Ue.partialApply=function(e,t,n,i,o,r){if(t!==n){let h=n._applyFunctions[t.id];c(h)||(h=N$(t,n),n._applyFunctions[t.id]=h);const f=h.length;for(let _=0;_<f;++_)h[_](e,n)}const s=c(i.scissorTest)?i.scissorTest:t.scissorTest,a=c(o.scissorTest)?o.scissorTest:n.scissorTest;(s!==a||r)&&UU(e,n,o);const l=c(i.blendingEnabled)?i.blendingEnabled:t.blending.enabled,u=c(o.blendingEnabled)?o.blendingEnabled:n.blending.enabled;(l!==u||u&&t.blending!==n.blending)&&WU(e,n,o),(t!==n||i!==o||i.context!==o.context)&&$U(e,n,o)};Ue.getState=function(e){if(!c(e))throw new E("renderState is required.");return{frontFace:e.frontFace,cull:{enabled:e.cull.enabled,face:e.cull.face},lineWidth:e.lineWidth,polygonOffset:{enabled:e.polygonOffset.enabled,factor:e.polygonOffset.factor,units:e.polygonOffset.units},scissorTest:{enabled:e.scissorTest.enabled,rectangle:Re.clone(e.scissorTest.rectangle)},depthRange:{near:e.depthRange.near,far:e.depthRange.far},depthTest:{enabled:e.depthTest.enabled,func:e.depthTest.func},colorMask:{red:e.colorMask.red,green:e.colorMask.green,blue:e.colorMask.blue,alpha:e.colorMask.alpha},depthMask:e.depthMask,stencilMask:e.stencilMask,blending:{enabled:e.blending.enabled,color:z.clone(e.blending.color),equationRgb:e.blending.equationRgb,equationAlpha:e.blending.equationAlpha,functionSourceRgb:e.blending.functionSourceRgb,functionSourceAlpha:e.blending.functionSourceAlpha,functionDestinationRgb:e.blending.functionDestinationRgb,functionDestinationAlpha:e.blending.functionDestinationAlpha},stencilTest:{enabled:e.stencilTest.enabled,frontFunction:e.stencilTest.frontFunction,backFunction:e.stencilTest.backFunction,reference:e.stencilTest.reference,mask:e.stencilTest.mask,frontOperation:{fail:e.stencilTest.frontOperation.fail,zFail:e.stencilTest.frontOperation.zFail,zPass:e.stencilTest.frontOperation.zPass},backOperation:{fail:e.stencilTest.backOperation.fail,zFail:e.stencilTest.backOperation.zFail,zPass:e.stencilTest.backOperation.zPass}},sampleCoverage:{enabled:e.sampleCoverage.enabled,value:e.sampleCoverage.value,invert:e.sampleCoverage.invert},viewport:c(e.viewport)?Re.clone(e.viewport):void 0}};function Xe(e,t,n,i){this[0]=y(e,0),this[1]=y(n,0),this[2]=y(t,0),this[3]=y(i,0)}Xe.packedLength=4;Xe.pack=function(e,t,n){return A.typeOf.object("value",e),A.defined("array",t),n=y(n,0),t[n++]=e[0],t[n++]=e[1],t[n++]=e[2],t[n++]=e[3],t};Xe.unpack=function(e,t,n){return A.defined("array",e),t=y(t,0),c(n)||(n=new Xe),n[0]=e[t++],n[1]=e[t++],n[2]=e[t++],n[3]=e[t++],n};Xe.packArray=function(e,t){A.defined("array",e);const n=e.length,i=n*4;if(!c(t))t=new Array(i);else{if(!Array.isArray(t)&&t.length!==i)throw new E("If result is a typed array, it must have exactly array.length * 4 elements");t.length!==i&&(t.length=i)}for(let o=0;o<n;++o)Xe.pack(e[o],t,o*4);return t};Xe.unpackArray=function(e,t){if(A.defined("array",e),A.typeOf.number.greaterThanOrEquals("array.length",e.length,4),e.length%4!==0)throw new E("array length must be a multiple of 4.");const n=e.length;c(t)?t.length=n/4:t=new Array(n/4);for(let i=0;i<n;i+=4){const o=i/4;t[o]=Xe.unpack(e,i,t[o])}return t};Xe.clone=function(e,t){if(!!c(e))return c(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t):new Xe(e[0],e[2],e[1],e[3])};Xe.fromArray=Xe.unpack;Xe.fromColumnMajorArray=function(e,t){return A.defined("values",e),Xe.clone(e,t)};Xe.fromRowMajorArray=function(e,t){return A.defined("values",e),c(t)?(t[0]=e[0],t[1]=e[2],t[2]=e[1],t[3]=e[3],t):new Xe(e[0],e[1],e[2],e[3])};Xe.fromScale=function(e,t){return A.typeOf.object("scale",e),c(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=e.y,t):new Xe(e.x,0,0,e.y)};Xe.fromUniformScale=function(e,t){return A.typeOf.number("scale",e),c(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=e,t):new Xe(e,0,0,e)};Xe.fromRotation=function(e,t){A.typeOf.number("angle",e);const n=Math.cos(e),i=Math.sin(e);return c(t)?(t[0]=n,t[1]=i,t[2]=-i,t[3]=n,t):new Xe(n,-i,i,n)};Xe.toArray=function(e,t){return A.typeOf.object("matrix",e),c(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t):[e[0],e[1],e[2],e[3]]};Xe.getElementIndex=function(e,t){return A.typeOf.number.greaterThanOrEquals("row",t,0),A.typeOf.number.lessThanOrEquals("row",t,1),A.typeOf.number.greaterThanOrEquals("column",e,0),A.typeOf.number.lessThanOrEquals("column",e,1),e*2+t};Xe.getColumn=function(e,t,n){A.typeOf.object("matrix",e),A.typeOf.number.greaterThanOrEquals("index",t,0),A.typeOf.number.lessThanOrEquals("index",t,1),A.typeOf.object("result",n);const i=t*2,o=e[i],r=e[i+1];return n.x=o,n.y=r,n};Xe.setColumn=function(e,t,n,i){A.typeOf.object("matrix",e),A.typeOf.number.greaterThanOrEquals("index",t,0),A.typeOf.number.lessThanOrEquals("index",t,1),A.typeOf.object("cartesian",n),A.typeOf.object("result",i),i=Xe.clone(e,i);const o=t*2;return i[o]=n.x,i[o+1]=n.y,i};Xe.getRow=function(e,t,n){A.typeOf.object("matrix",e),A.typeOf.number.greaterThanOrEquals("index",t,0),A.typeOf.number.lessThanOrEquals("index",t,1),A.typeOf.object("result",n);const i=e[t],o=e[t+2];return n.x=i,n.y=o,n};Xe.setRow=function(e,t,n,i){return A.typeOf.object("matrix",e),A.typeOf.number.greaterThanOrEquals("index",t,0),A.typeOf.number.lessThanOrEquals("index",t,1),A.typeOf.object("cartesian",n),A.typeOf.object("result",i),i=Xe.clone(e,i),i[t]=n.x,i[t+2]=n.y,i};const M$=new H;Xe.setScale=function(e,t,n){A.typeOf.object("matrix",e),A.typeOf.object("scale",t),A.typeOf.object("result",n);const i=Xe.getScale(e,M$),o=t.x/i.x,r=t.y/i.y;return n[0]=e[0]*o,n[1]=e[1]*o,n[2]=e[2]*r,n[3]=e[3]*r,n};const F$=new H;Xe.setUniformScale=function(e,t,n){A.typeOf.object("matrix",e),A.typeOf.number("scale",t),A.typeOf.object("result",n);const i=Xe.getScale(e,F$),o=t/i.x,r=t/i.y;return n[0]=e[0]*o,n[1]=e[1]*o,n[2]=e[2]*r,n[3]=e[3]*r,n};const qL=new H;Xe.getScale=function(e,t){return A.typeOf.object("matrix",e),A.typeOf.object("result",t),t.x=H.magnitude(H.fromElements(e[0],e[1],qL)),t.y=H.magnitude(H.fromElements(e[2],e[3],qL)),t};const YL=new H;Xe.getMaximumScale=function(e){return Xe.getScale(e,YL),H.maximumComponent(YL)};const B$=new H;Xe.setRotation=function(e,t,n){A.typeOf.object("matrix",e),A.typeOf.object("result",n);const i=Xe.getScale(e,B$);return n[0]=t[0]*i.x,n[1]=t[1]*i.x,n[2]=t[2]*i.y,n[3]=t[3]*i.y,n};const z$=new H;Xe.getRotation=function(e,t){A.typeOf.object("matrix",e),A.typeOf.object("result",t);const n=Xe.getScale(e,z$);return t[0]=e[0]/n.x,t[1]=e[1]/n.x,t[2]=e[2]/n.y,t[3]=e[3]/n.y,t};Xe.multiply=function(e,t,n){A.typeOf.object("left",e),A.typeOf.object("right",t),A.typeOf.object("result",n);const i=e[0]*t[0]+e[2]*t[1],o=e[0]*t[2]+e[2]*t[3],r=e[1]*t[0]+e[3]*t[1],s=e[1]*t[2]+e[3]*t[3];return n[0]=i,n[1]=r,n[2]=o,n[3]=s,n};Xe.add=function(e,t,n){return A.typeOf.object("left",e),A.typeOf.object("right",t),A.typeOf.object("result",n),n[0]=e[0]+t[0],n[1]=e[1]+t[1],n[2]=e[2]+t[2],n[3]=e[3]+t[3],n};Xe.subtract=function(e,t,n){return A.typeOf.object("left",e),A.typeOf.object("right",t),A.typeOf.object("result",n),n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n[3]=e[3]-t[3],n};Xe.multiplyByVector=function(e,t,n){A.typeOf.object("matrix",e),A.typeOf.object("cartesian",t),A.typeOf.object("result",n);const i=e[0]*t.x+e[2]*t.y,o=e[1]*t.x+e[3]*t.y;return n.x=i,n.y=o,n};Xe.multiplyByScalar=function(e,t,n){return A.typeOf.object("matrix",e),A.typeOf.number("scalar",t),A.typeOf.object("result",n),n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n};Xe.multiplyByScale=function(e,t,n){return A.typeOf.object("matrix",e),A.typeOf.object("scale",t),A.typeOf.object("result",n),n[0]=e[0]*t.x,n[1]=e[1]*t.x,n[2]=e[2]*t.y,n[3]=e[3]*t.y,n};Xe.multiplyByUniformScale=function(e,t,n){return A.typeOf.object("matrix",e),A.typeOf.number("scale",t),A.typeOf.object("result",n),n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n};Xe.negate=function(e,t){return A.typeOf.object("matrix",e),A.typeOf.object("result",t),t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t};Xe.transpose=function(e,t){A.typeOf.object("matrix",e),A.typeOf.object("result",t);const n=e[0],i=e[2],o=e[1],r=e[3];return t[0]=n,t[1]=i,t[2]=o,t[3]=r,t};Xe.abs=function(e,t){return A.typeOf.object("matrix",e),A.typeOf.object("result",t),t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t};Xe.equals=function(e,t){return e===t||c(e)&&c(t)&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]};Xe.equalsArray=function(e,t,n){return e[0]===t[n]&&e[1]===t[n+1]&&e[2]===t[n+2]&&e[3]===t[n+3]};Xe.equalsEpsilon=function(e,t,n){return n=y(n,0),e===t||c(e)&&c(t)&&Math.abs(e[0]-t[0])<=n&&Math.abs(e[1]-t[1])<=n&&Math.abs(e[2]-t[2])<=n&&Math.abs(e[3]-t[3])<=n};Xe.IDENTITY=Object.freeze(new Xe(1,0,0,1));Xe.ZERO=Object.freeze(new Xe(0,0,0,0));Xe.COLUMN0ROW0=0;Xe.COLUMN0ROW1=1;Xe.COLUMN1ROW0=2;Xe.COLUMN1ROW1=3;Object.defineProperties(Xe.prototype,{length:{get:function(){return Xe.packedLength}}});Xe.prototype.clone=function(e){return Xe.clone(this,e)};Xe.prototype.equals=function(e){return Xe.equals(this,e)};Xe.prototype.equalsEpsilon=function(e,t){return Xe.equalsEpsilon(this,e,t)};Xe.prototype.toString=function(){return`(${this[0]}, ${this[2]})
|
|
(${this[1]}, ${this[3]})`};function U$(e,t,n,i){switch(t.type){case e.FLOAT:return new XU(e,t,n,i);case e.FLOAT_VEC2:return new QU(e,t,n,i);case e.FLOAT_VEC3:return new KU(e,t,n,i);case e.FLOAT_VEC4:return new ZU(e,t,n,i);case e.SAMPLER_2D:case e.SAMPLER_CUBE:return new vP(e,t,n,i);case e.INT:case e.BOOL:return new JU(e,t,n,i);case e.INT_VEC2:case e.BOOL_VEC2:return new ek(e,t,n,i);case e.INT_VEC3:case e.BOOL_VEC3:return new tk(e,t,n,i);case e.INT_VEC4:case e.BOOL_VEC4:return new nk(e,t,n,i);case e.FLOAT_MAT2:return new ik(e,t,n,i);case e.FLOAT_MAT3:return new ok(e,t,n,i);case e.FLOAT_MAT4:return new rk(e,t,n,i);default:throw new Te(`Unrecognized uniform type: ${t.type} for uniform "${n}".`)}}function XU(e,t,n,i){this.name=n,this.value=void 0,this._value=0,this._gl=e,this._location=i}XU.prototype.set=function(){this.value!==this._value&&(this._value=this.value,this._gl.uniform1f(this._location,this.value))};function QU(e,t,n,i){this.name=n,this.value=void 0,this._value=new H,this._gl=e,this._location=i}QU.prototype.set=function(){const e=this.value;H.equals(e,this._value)||(H.clone(e,this._value),this._gl.uniform2f(this._location,e.x,e.y))};function KU(e,t,n,i){this.name=n,this.value=void 0,this._value=void 0,this._gl=e,this._location=i}KU.prototype.set=function(){const e=this.value;if(c(e.red))z.equals(e,this._value)||(this._value=z.clone(e,this._value),this._gl.uniform3f(this._location,e.red,e.green,e.blue));else if(c(e.x))d.equals(e,this._value)||(this._value=d.clone(e,this._value),this._gl.uniform3f(this._location,e.x,e.y,e.z));else throw new E(`Invalid vec3 value for uniform "${this.name}".`)};function ZU(e,t,n,i){this.name=n,this.value=void 0,this._value=void 0,this._gl=e,this._location=i}ZU.prototype.set=function(){const e=this.value;if(c(e.red))z.equals(e,this._value)||(this._value=z.clone(e,this._value),this._gl.uniform4f(this._location,e.red,e.green,e.blue,e.alpha));else if(c(e.x))te.equals(e,this._value)||(this._value=te.clone(e,this._value),this._gl.uniform4f(this._location,e.x,e.y,e.z,e.w));else throw new E(`Invalid vec4 value for uniform "${this.name}".`)};function vP(e,t,n,i){this.name=n,this.value=void 0,this._gl=e,this._location=i,this.textureUnitIndex=void 0}vP.prototype.set=function(){const e=this._gl;e.activeTexture(e.TEXTURE0+this.textureUnitIndex);const t=this.value;e.bindTexture(t._target,t._texture)};vP.prototype._setSampler=function(e){return this.textureUnitIndex=e,this._gl.uniform1i(this._location,e),e+1};function JU(e,t,n,i){this.name=n,this.value=void 0,this._value=0,this._gl=e,this._location=i}JU.prototype.set=function(){this.value!==this._value&&(this._value=this.value,this._gl.uniform1i(this._location,this.value))};function ek(e,t,n,i){this.name=n,this.value=void 0,this._value=new H,this._gl=e,this._location=i}ek.prototype.set=function(){const e=this.value;H.equals(e,this._value)||(H.clone(e,this._value),this._gl.uniform2i(this._location,e.x,e.y))};function tk(e,t,n,i){this.name=n,this.value=void 0,this._value=new d,this._gl=e,this._location=i}tk.prototype.set=function(){const e=this.value;d.equals(e,this._value)||(d.clone(e,this._value),this._gl.uniform3i(this._location,e.x,e.y,e.z))};function nk(e,t,n,i){this.name=n,this.value=void 0,this._value=new te,this._gl=e,this._location=i}nk.prototype.set=function(){const e=this.value;te.equals(e,this._value)||(te.clone(e,this._value),this._gl.uniform4i(this._location,e.x,e.y,e.z,e.w))};const k$=new Float32Array(4);function ik(e,t,n,i){this.name=n,this.value=void 0,this._value=new Xe,this._gl=e,this._location=i}ik.prototype.set=function(){if(!Xe.equalsArray(this.value,this._value,0)){Xe.clone(this.value,this._value);const e=Xe.toArray(this.value,k$);this._gl.uniformMatrix2fv(this._location,!1,e)}};const V$=new Float32Array(9);function ok(e,t,n,i){this.name=n,this.value=void 0,this._value=new $,this._gl=e,this._location=i}ok.prototype.set=function(){if(!$.equalsArray(this.value,this._value,0)){$.clone(this.value,this._value);const e=$.toArray(this.value,V$);this._gl.uniformMatrix3fv(this._location,!1,e)}};const H$=new Float32Array(16);function rk(e,t,n,i){this.name=n,this.value=void 0,this._value=new L,this._gl=e,this._location=i}rk.prototype.set=function(){if(!L.equalsArray(this.value,this._value,0)){L.clone(this.value,this._value);const e=L.toArray(this.value,H$);this._gl.uniformMatrix4fv(this._location,!1,e)}};function G$(e,t,n,i){switch(t.type){case e.FLOAT:return new sk(e,t,n,i);case e.FLOAT_VEC2:return new ak(e,t,n,i);case e.FLOAT_VEC3:return new ck(e,t,n,i);case e.FLOAT_VEC4:return new lk(e,t,n,i);case e.SAMPLER_2D:case e.SAMPLER_CUBE:return new IP(e,t,n,i);case e.INT:case e.BOOL:return new uk(e,t,n,i);case e.INT_VEC2:case e.BOOL_VEC2:return new dk(e,t,n,i);case e.INT_VEC3:case e.BOOL_VEC3:return new hk(e,t,n,i);case e.INT_VEC4:case e.BOOL_VEC4:return new fk(e,t,n,i);case e.FLOAT_MAT2:return new pk(e,t,n,i);case e.FLOAT_MAT3:return new mk(e,t,n,i);case e.FLOAT_MAT4:return new _k(e,t,n,i);default:throw new Te(`Unrecognized uniform type: ${t.type} for uniform "${n}".`)}}function sk(e,t,n,i){const o=i.length;this.name=n,this.value=new Array(o),this._value=new Float32Array(o),this._gl=e,this._location=i[0]}sk.prototype.set=function(){const e=this.value,t=e.length,n=this._value;let i=!1;for(let o=0;o<t;++o){const r=e[o];r!==n[o]&&(n[o]=r,i=!0)}i&&this._gl.uniform1fv(this._location,n)};function ak(e,t,n,i){const o=i.length;this.name=n,this.value=new Array(o),this._value=new Float32Array(o*2),this._gl=e,this._location=i[0]}ak.prototype.set=function(){const e=this.value,t=e.length,n=this._value;let i=!1,o=0;for(let r=0;r<t;++r){const s=e[r];H.equalsArray(s,n,o)||(H.pack(s,n,o),i=!0),o+=2}i&&this._gl.uniform2fv(this._location,n)};function ck(e,t,n,i){const o=i.length;this.name=n,this.value=new Array(o),this._value=new Float32Array(o*3),this._gl=e,this._location=i[0]}ck.prototype.set=function(){const e=this.value,t=e.length,n=this._value;let i=!1,o=0;for(let r=0;r<t;++r){const s=e[r];if(c(s.red))(s.red!==n[o]||s.green!==n[o+1]||s.blue!==n[o+2])&&(n[o]=s.red,n[o+1]=s.green,n[o+2]=s.blue,i=!0);else if(c(s.x))d.equalsArray(s,n,o)||(d.pack(s,n,o),i=!0);else throw new E("Invalid vec3 value.");o+=3}i&&this._gl.uniform3fv(this._location,n)};function lk(e,t,n,i){const o=i.length;this.name=n,this.value=new Array(o),this._value=new Float32Array(o*4),this._gl=e,this._location=i[0]}lk.prototype.set=function(){const e=this.value,t=e.length,n=this._value;let i=!1,o=0;for(let r=0;r<t;++r){const s=e[r];if(c(s.red))z.equalsArray(s,n,o)||(z.pack(s,n,o),i=!0);else if(c(s.x))te.equalsArray(s,n,o)||(te.pack(s,n,o),i=!0);else throw new E("Invalid vec4 value.");o+=4}i&&this._gl.uniform4fv(this._location,n)};function IP(e,t,n,i){const o=i.length;this.name=n,this.value=new Array(o),this._value=new Float32Array(o),this._gl=e,this._locations=i,this.textureUnitIndex=void 0}IP.prototype.set=function(){const e=this._gl,t=e.TEXTURE0+this.textureUnitIndex,n=this.value,i=n.length;for(let o=0;o<i;++o){const r=n[o];e.activeTexture(t+o),e.bindTexture(r._target,r._texture)}};IP.prototype._setSampler=function(e){this.textureUnitIndex=e;const t=this._locations,n=t.length;for(let i=0;i<n;++i){const o=e+i;this._gl.uniform1i(t[i],o)}return e+n};function uk(e,t,n,i){const o=i.length;this.name=n,this.value=new Array(o),this._value=new Int32Array(o),this._gl=e,this._location=i[0]}uk.prototype.set=function(){const e=this.value,t=e.length,n=this._value;let i=!1;for(let o=0;o<t;++o){const r=e[o];r!==n[o]&&(n[o]=r,i=!0)}i&&this._gl.uniform1iv(this._location,n)};function dk(e,t,n,i){const o=i.length;this.name=n,this.value=new Array(o),this._value=new Int32Array(o*2),this._gl=e,this._location=i[0]}dk.prototype.set=function(){const e=this.value,t=e.length,n=this._value;let i=!1,o=0;for(let r=0;r<t;++r){const s=e[r];H.equalsArray(s,n,o)||(H.pack(s,n,o),i=!0),o+=2}i&&this._gl.uniform2iv(this._location,n)};function hk(e,t,n,i){const o=i.length;this.name=n,this.value=new Array(o),this._value=new Int32Array(o*3),this._gl=e,this._location=i[0]}hk.prototype.set=function(){const e=this.value,t=e.length,n=this._value;let i=!1,o=0;for(let r=0;r<t;++r){const s=e[r];d.equalsArray(s,n,o)||(d.pack(s,n,o),i=!0),o+=3}i&&this._gl.uniform3iv(this._location,n)};function fk(e,t,n,i){const o=i.length;this.name=n,this.value=new Array(o),this._value=new Int32Array(o*4),this._gl=e,this._location=i[0]}fk.prototype.set=function(){const e=this.value,t=e.length,n=this._value;let i=!1,o=0;for(let r=0;r<t;++r){const s=e[r];te.equalsArray(s,n,o)||(te.pack(s,n,o),i=!0),o+=4}i&&this._gl.uniform4iv(this._location,n)};function pk(e,t,n,i){const o=i.length;this.name=n,this.value=new Array(o),this._value=new Float32Array(o*4),this._gl=e,this._location=i[0]}pk.prototype.set=function(){const e=this.value,t=e.length,n=this._value;let i=!1,o=0;for(let r=0;r<t;++r){const s=e[r];Xe.equalsArray(s,n,o)||(Xe.pack(s,n,o),i=!0),o+=4}i&&this._gl.uniformMatrix2fv(this._location,!1,n)};function mk(e,t,n,i){const o=i.length;this.name=n,this.value=new Array(o),this._value=new Float32Array(o*9),this._gl=e,this._location=i[0]}mk.prototype.set=function(){const e=this.value,t=e.length,n=this._value;let i=!1,o=0;for(let r=0;r<t;++r){const s=e[r];$.equalsArray(s,n,o)||($.pack(s,n,o),i=!0),o+=9}i&&this._gl.uniformMatrix3fv(this._location,!1,n)};function _k(e,t,n,i){const o=i.length;this.name=n,this.value=new Array(o),this._value=new Float32Array(o*16),this._gl=e,this._location=i[0]}_k.prototype.set=function(){const e=this.value,t=e.length,n=this._value;let i=!1,o=0;for(let r=0;r<t;++r){const s=e[r];L.equalsArray(s,n,o)||(L.pack(s,n,o),i=!0),o+=16}i&&this._gl.uniformMatrix4fv(this._location,!1,n)};let j$=0;function Jt(e){let t=e.vertexShaderText,n=e.fragmentShaderText;typeof spector<"u"&&(t=t.replace(/^#line/gm,"//#line"),n=n.replace(/^#line/gm,"//#line"));const i=W$(t,n);this._gl=e.gl,this._logShaderCompilation=e.logShaderCompilation,this._debugShaders=e.debugShaders,this._attributeLocations=e.attributeLocations,this._program=void 0,this._numberOfVertexAttributes=void 0,this._vertexAttributes=void 0,this._uniformsByName=void 0,this._uniforms=void 0,this._automaticUniforms=void 0,this._manualUniforms=void 0,this._duplicateUniformNames=i.duplicateUniformNames,this._cachedShader=void 0,this.maximumTextureUnitIndex=void 0,this._vertexShaderSource=e.vertexShaderSource,this._vertexShaderText=e.vertexShaderText,this._fragmentShaderSource=e.fragmentShaderSource,this._fragmentShaderText=i.fragmentShaderText,this.id=j$++}Jt.fromCache=function(e){return e=y(e,y.EMPTY_OBJECT),A.defined("options.context",e.context),e.context.shaderCache.getShaderProgram(e)};Jt.replaceCache=function(e){return e=y(e,y.EMPTY_OBJECT),A.defined("options.context",e.context),e.context.shaderCache.replaceShaderProgram(e)};Object.defineProperties(Jt.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},vertexAttributes:{get:function(){return RA(this),this._vertexAttributes}},numberOfVertexAttributes:{get:function(){return RA(this),this._numberOfVertexAttributes}},allUniforms:{get:function(){return RA(this),this._uniformsByName}}});function $L(e){const t=[],n=e.match(/uniform.*?(?![^{]*})(?=[=\[;])/g);if(c(n)){const i=n.length;for(let o=0;o<i;o++){const r=n[o].trim(),s=r.slice(r.lastIndexOf(" ")+1);t.push(s)}}return t}function W$(e,t){const n={};if(!pt.highpFloatSupported||!pt.highpIntSupported){let i,o,r,s;const a=$L(e),l=$L(t),u=a.length,h=l.length;for(i=0;i<u;i++)for(o=0;o<h;o++)if(a[i]===l[o]){r=a[i],s=`czm_mediump_${r}`;const f=new RegExp(`${r}\\b`,"g");t=t.replace(f,s),n[s]=r}}return{fragmentShaderText:t,duplicateUniformNames:n}}const Hl="[Cesium WebGL] ";function q$(e,t){const n=t._vertexShaderText,i=t._fragmentShaderText,o=e.createShader(e.VERTEX_SHADER);e.shaderSource(o,n),e.compileShader(o);const r=e.createShader(e.FRAGMENT_SHADER);e.shaderSource(r,i),e.compileShader(r);const s=e.createProgram();e.attachShader(s,o),e.attachShader(s,r);const a=t._attributeLocations;if(c(a))for(const _ in a)a.hasOwnProperty(_)&&e.bindAttribLocation(s,a[_],_);e.linkProgram(s);let l;if(e.getProgramParameter(s,e.LINK_STATUS))return t._logShaderCompilation&&(l=e.getShaderInfoLog(o),c(l)&&l.length>0&&console.log(`${Hl}Vertex shader compile log: ${l}`),l=e.getShaderInfoLog(r),c(l)&&l.length>0&&console.log(`${Hl}Fragment shader compile log: ${l}`),l=e.getProgramInfoLog(s),c(l)&&l.length>0&&console.log(`${Hl}Shader program link log: ${l}`)),e.deleteShader(o),e.deleteShader(r),s;let u;const h=t._debugShaders;throw e.getShaderParameter(r,e.COMPILE_STATUS)?e.getShaderParameter(o,e.COMPILE_STATUS)?(l=e.getProgramInfoLog(s),console.error(`${Hl}Shader program link log: ${l}`),f(o,"vertex"),f(r,"fragment"),u=`Program failed to link. Link log: ${l}`):(l=e.getShaderInfoLog(o),console.error(`${Hl}Vertex shader compile log: ${l}`),console.error(`${Hl} Vertex shader source:
|
|
${n}`),u=`Vertex shader failed to compile. Compile log: ${l}`):(l=e.getShaderInfoLog(r),console.error(`${Hl}Fragment shader compile log: ${l}`),console.error(`${Hl} Fragment shader source:
|
|
${i}`),u=`Fragment shader failed to compile. Compile log: ${l}`),e.deleteShader(o),e.deleteShader(r),e.deleteProgram(s),new Te(u);function f(_,g){if(!c(h))return;const m=h.getTranslatedShaderSource(_);if(m===""){console.error(`${Hl}${g} shader translation failed.`);return}console.error(`${Hl}Translated ${g} shaderSource:
|
|
${m}`)}}function Y$(e,t,n){const i={};for(let o=0;o<n;++o){const r=e.getActiveAttrib(t,o),s=e.getAttribLocation(t,r.name);i[r.name]={name:r.name,type:r.type,index:s}}return i}function $$(e,t){const n={},i=[],o=[],r=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let s=0;s<r;++s){const a=e.getActiveUniform(t,s),l="[0]",u=a.name.indexOf(l,a.name.length-l.length)!==-1?a.name.slice(0,a.name.length-3):a.name;if(u.indexOf("gl_")!==0)if(a.name.indexOf("[")<0){const h=e.getUniformLocation(t,u);if(h!==null){const f=U$(e,a,u,h);n[u]=f,i.push(f),f._setSampler&&o.push(f)}}else{let h,f,_,g;const m=u.indexOf("[");if(m>=0){if(h=n[u.slice(0,m)],!c(h))continue;f=h._locations,f.length<=1&&(_=h.value,g=e.getUniformLocation(t,u),g!==null&&(f.push(g),_.push(e.getUniform(t,g))))}else{f=[];for(let b=0;b<a.size;++b)g=e.getUniformLocation(t,`${u}[${b}]`),g!==null&&f.push(g);h=G$(e,a,u,f),n[u]=h,i.push(h),h._setSampler&&o.push(h)}}}return{uniformsByName:n,uniforms:i,samplerUniforms:o}}function X$(e,t){const n=[],i=[];for(const o in t)if(t.hasOwnProperty(o)){const r=t[o];let s=o;const a=e._duplicateUniformNames[s];c(a)&&(r.name=a,s=a);const l=DA[s];c(l)?n.push({uniform:r,automaticUniform:l}):i.push(r)}return{automaticUniforms:n,manualUniforms:i}}function Q$(e,t,n){e.useProgram(t);let i=0;const o=n.length;for(let r=0;r<o;++r)i=n[r]._setSampler(i);return e.useProgram(null),i}function RA(e){c(e._program)||gk(e)}function gk(e){const t=e._program,n=e._gl,i=q$(n,e,e._debugShaders),o=n.getProgramParameter(i,n.ACTIVE_ATTRIBUTES),r=$$(n,i),s=X$(e,r.uniformsByName);e._program=i,e._numberOfVertexAttributes=o,e._vertexAttributes=Y$(n,i,o),e._uniformsByName=r.uniformsByName,e._uniforms=r.uniforms,e._automaticUniforms=s.automaticUniforms,e._manualUniforms=s.manualUniforms,e.maximumTextureUnitIndex=Q$(n,i,r.samplerUniforms),t&&e._gl.deleteProgram(t),typeof spector<"u"&&(e._program.__SPECTOR_rebuildProgram=function(a,l,u,h){const f=e._vertexShaderText,_=e._fragmentShaderText,g=/ ! = /g;e._vertexShaderText=a.replace(g," != "),e._fragmentShaderText=l.replace(g," != ");try{gk(e),u(e._program)}catch(m){e._vertexShaderText=f,e._fragmentShaderText=_;const T=/(?:Compile|Link) error: ([^]*)/.exec(m.message);h(T?T[1]:m.message)}})}Jt.prototype._bind=function(){RA(this),this._gl.useProgram(this._program)};Jt.prototype._setUniforms=function(e,t,n){let i,o;if(c(e)){const a=this._manualUniforms;for(i=a.length,o=0;o<i;++o){const l=a[o];l.value=e[l.name]()}}const r=this._automaticUniforms;for(i=r.length,o=0;o<i;++o){const a=r[o];a.uniform.value=a.automaticUniform.getValue(t)}const s=this._uniforms;for(i=s.length,o=0;o<i;++o)s[o].set();if(n){const a=this._gl,l=this._program;if(a.validateProgram(l),!a.getProgramParameter(l,a.VALIDATE_STATUS))throw new E(`Program validation failed. Program info log: ${a.getProgramInfoLog(l)}`)}};Jt.prototype.isDestroyed=function(){return!1};Jt.prototype.destroy=function(){this._cachedShader.cache.releaseShaderProgram(this)};Jt.prototype.finalDestroy=function(){return this._gl.deleteProgram(this._program),ve(this)};function yC(e){this._context=e}let _g;const K$=new Ze({primitiveType:ze.TRIANGLES}),Z$=new bi({color:new z(0,0,0,0)});function J$(e,t){return new ur({context:e,colorTextures:[t],destroyAttachments:!1})}function eX(e,t){return Jt.fromCache({context:e,vertexShaderSource:RU,fragmentShaderSource:t,attributeLocations:{position:0,textureCoordinates:1}})}function tX(e,t){return(!c(_g)||_g.viewport.width!==e||_g.viewport.height!==t)&&(_g=Ue.fromCache({viewport:new Re(0,0,e,t)})),_g}yC.prototype.execute=function(e){if(A.defined("computeCommand",e),c(e.preExecute)&&e.preExecute(e),!c(e.fragmentShaderSource)&&!c(e.shaderProgram))throw new E("computeCommand.fragmentShaderSource or computeCommand.shaderProgram is required.");A.defined("computeCommand.outputTexture",e.outputTexture);const t=e.outputTexture,n=t.width,i=t.height,o=this._context,r=c(e.vertexArray)?e.vertexArray:o.getViewportQuadVertexArray(),s=c(e.shaderProgram)?e.shaderProgram:eX(o,e.fragmentShaderSource),a=J$(o,t),l=tX(n,i),u=e.uniformMap,h=Z$;h.framebuffer=a,h.renderState=l,h.execute(o);const f=K$;f.vertexArray=r,f.renderState=l,f.shaderProgram=s,f.uniformMap=u,f.framebuffer=a,f.execute(o),a.destroy(),e.persists||(s.destroy(),c(e.vertexArray)&&r.destroy()),c(e.postExecute)&&e.postExecute(t)};yC.prototype.isDestroyed=function(){return!1};yC.prototype.destroy=function(){return ve(this)};const Nt={BYTE:J.BYTE,UNSIGNED_BYTE:J.UNSIGNED_BYTE,SHORT:J.SHORT,UNSIGNED_SHORT:J.UNSIGNED_SHORT,INT:J.INT,UNSIGNED_INT:J.UNSIGNED_INT,FLOAT:J.FLOAT,DOUBLE:J.DOUBLE};Nt.getSizeInBytes=function(e){if(!c(e))throw new E("value is required.");switch(e){case Nt.BYTE:return Int8Array.BYTES_PER_ELEMENT;case Nt.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case Nt.SHORT:return Int16Array.BYTES_PER_ELEMENT;case Nt.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case Nt.INT:return Int32Array.BYTES_PER_ELEMENT;case Nt.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT;case Nt.FLOAT:return Float32Array.BYTES_PER_ELEMENT;case Nt.DOUBLE:return Float64Array.BYTES_PER_ELEMENT;default:throw new E("componentDatatype is not a valid value.")}};Nt.fromTypedArray=function(e){if(e instanceof Int8Array)return Nt.BYTE;if(e instanceof Uint8Array)return Nt.UNSIGNED_BYTE;if(e instanceof Int16Array)return Nt.SHORT;if(e instanceof Uint16Array)return Nt.UNSIGNED_SHORT;if(e instanceof Int32Array)return Nt.INT;if(e instanceof Uint32Array)return Nt.UNSIGNED_INT;if(e instanceof Float32Array)return Nt.FLOAT;if(e instanceof Float64Array)return Nt.DOUBLE;throw new E("array must be an Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, or Float64Array.")};Nt.validate=function(e){return c(e)&&(e===Nt.BYTE||e===Nt.UNSIGNED_BYTE||e===Nt.SHORT||e===Nt.UNSIGNED_SHORT||e===Nt.INT||e===Nt.UNSIGNED_INT||e===Nt.FLOAT||e===Nt.DOUBLE)};Nt.createTypedArray=function(e,t){if(!c(e))throw new E("componentDatatype is required.");if(!c(t))throw new E("valuesOrLength is required.");switch(e){case Nt.BYTE:return new Int8Array(t);case Nt.UNSIGNED_BYTE:return new Uint8Array(t);case Nt.SHORT:return new Int16Array(t);case Nt.UNSIGNED_SHORT:return new Uint16Array(t);case Nt.INT:return new Int32Array(t);case Nt.UNSIGNED_INT:return new Uint32Array(t);case Nt.FLOAT:return new Float32Array(t);case Nt.DOUBLE:return new Float64Array(t);default:throw new E("componentDatatype is not a valid value.")}};Nt.createArrayBufferView=function(e,t,n,i){if(!c(e))throw new E("componentDatatype is required.");if(!c(t))throw new E("buffer is required.");switch(n=y(n,0),i=y(i,(t.byteLength-n)/Nt.getSizeInBytes(e)),e){case Nt.BYTE:return new Int8Array(t,n,i);case Nt.UNSIGNED_BYTE:return new Uint8Array(t,n,i);case Nt.SHORT:return new Int16Array(t,n,i);case Nt.UNSIGNED_SHORT:return new Uint16Array(t,n,i);case Nt.INT:return new Int32Array(t,n,i);case Nt.UNSIGNED_INT:return new Uint32Array(t,n,i);case Nt.FLOAT:return new Float32Array(t,n,i);case Nt.DOUBLE:return new Float64Array(t,n,i);default:throw new E("componentDatatype is not a valid value.")}};Nt.fromName=function(e){switch(e){case"BYTE":return Nt.BYTE;case"UNSIGNED_BYTE":return Nt.UNSIGNED_BYTE;case"SHORT":return Nt.SHORT;case"UNSIGNED_SHORT":return Nt.UNSIGNED_SHORT;case"INT":return Nt.INT;case"UNSIGNED_INT":return Nt.UNSIGNED_INT;case"FLOAT":return Nt.FLOAT;case"DOUBLE":return Nt.DOUBLE;default:throw new E("name is not a valid value.")}};const Z=Object.freeze(Nt),XL={};function $n(e,t){if(!c(e))throw new E("identifier is required.");c(XL[e])||(XL[e]=!0,console.warn(y(t,e)))}$n.geometryOutlines="Entity geometry outlines are unsupported on terrain. Outlines will be disabled. To enable outlines, disable geometry terrain clamping by explicitly setting height to 0.";$n.geometryZIndex="Entity geometry with zIndex are unsupported when height or extrudedHeight are defined. zIndex will be ignored";$n.geometryHeightReference="Entity corridor, ellipse, polygon or rectangle with heightReference must also have a defined height. heightReference will be ignored";$n.geometryExtrudedHeightReference="Entity corridor, ellipse, polygon or rectangle with extrudedHeightReference must also have a defined extrudedHeight. extrudedHeightReference will be ignored";function Xh(e,t){if(!c(e)||!c(t))throw new E("identifier and message are required.");$n(e,t)}const nX={NONE:0,TRIANGLES:1,LINES:2,POLYLINES:3},Wm=Object.freeze(nX);function Tt(e){e=y(e,y.EMPTY_OBJECT),A.typeOf.object("options.attributes",e.attributes),this.attributes=e.attributes,this.indices=e.indices,this.primitiveType=y(e.primitiveType,ze.TRIANGLES),this.boundingSphere=e.boundingSphere,this.geometryType=y(e.geometryType,Wm.NONE),this.boundingSphereCV=e.boundingSphereCV,this.offsetAttribute=e.offsetAttribute}Tt.computeNumberOfVertices=function(e){A.typeOf.object("geometry",e);let t=-1;for(const n in e.attributes)if(e.attributes.hasOwnProperty(n)&&c(e.attributes[n])&&c(e.attributes[n].values)){const i=e.attributes[n],o=i.values.length/i.componentsPerAttribute;if(t!==o&&t!==-1)throw new E("All attribute lists must have the same number of attributes.");t=o}return t};const iX=new he,oX=new d,QL=new L,rX=[new he,new he,new he],sX=[new H,new H,new H],aX=[new H,new H,new H],cX=new d,lX=new _e,uX=new L,dX=new Xe;Tt._textureCoordinateRotationPoints=function(e,t,n,i){let o;const r=ce.center(i,iX),s=he.toCartesian(r,n,oX),a=zt.eastNorthUpToFixedFrame(s,n,QL),l=L.inverse(a,QL),u=sX,h=rX;h[0].longitude=i.west,h[0].latitude=i.south,h[1].longitude=i.west,h[1].latitude=i.north,h[2].longitude=i.east,h[2].latitude=i.south;let f=cX;for(o=0;o<3;o++)he.toCartesian(h[o],n,f),f=L.multiplyByPointAsVector(l,f,f),u[o].x=f.x,u[o].y=f.y;const _=_e.fromAxisAngle(d.UNIT_Z,-t,lX),g=$.fromQuaternion(_,uX),m=e.length;let b=Number.POSITIVE_INFINITY,T=Number.POSITIVE_INFINITY,x=Number.NEGATIVE_INFINITY,C=Number.NEGATIVE_INFINITY;for(o=0;o<m;o++)f=L.multiplyByPointAsVector(l,e[o],f),f=$.multiplyByVector(g,f,f),b=Math.min(b,f.x),T=Math.min(T,f.y),x=Math.max(x,f.x),C=Math.max(C,f.y);const w=Xe.fromRotation(t,dX),v=aX;v[0].x=b,v[0].y=T,v[1].x=b,v[1].y=C,v[2].x=x,v[2].y=T;const P=u[0],N=u[2].x-P.x,k=u[1].y-P.y;for(o=0;o<3;o++){const D=v[o];Xe.multiplyByVector(w,D,D),D.x=(D.x-P.x)/N,D.y=(D.y-P.y)/k}const M=v[0],U=v[1],B=v[2],S=new Array(6);return H.pack(M,S),H.pack(U,S,2),H.pack(B,S,4),S};function Ie(e){if(e=y(e,y.EMPTY_OBJECT),!c(e.componentDatatype))throw new E("options.componentDatatype is required.");if(!c(e.componentsPerAttribute))throw new E("options.componentsPerAttribute is required.");if(e.componentsPerAttribute<1||e.componentsPerAttribute>4)throw new E("options.componentsPerAttribute must be between 1 and 4.");if(!c(e.values))throw new E("options.values is required.");this.componentDatatype=e.componentDatatype,this.componentsPerAttribute=e.componentsPerAttribute,this.normalize=y(e.normalize,!1),this.values=e.values}function S_(e,t,n,i,o){this._format=e,this._datatype=t,this._width=n,this._height=i,this._buffer=o}Object.defineProperties(S_.prototype,{internalFormat:{get:function(){return this._format}},pixelDatatype:{get:function(){return this._datatype}},width:{get:function(){return this._width}},height:{get:function(){return this._height}},bufferView:{get:function(){return this._buffer}}});S_.clone=function(e){if(!!c(e))return new S_(e._format,e._datatype,e._width,e._height,e._buffer)};S_.prototype.clone=function(){return S_.clone(this)};function yk(){if(!c(Kn._canTransferArrayBuffer)){const e=DP("transferTypedArrayTest");e.postMessage=y(e.webkitPostMessage,e.postMessage);const t=99,n=new Int8Array([t]);try{e.postMessage({array:n},[n.buffer])}catch{return Kn._canTransferArrayBuffer=!1,Kn._canTransferArrayBuffer}Kn._canTransferArrayBuffer=new Promise(i=>{e.onmessage=function(o){const r=o.data.array,s=c(r)&&r[0]===t;i(s),e.terminate(),Kn._canTransferArrayBuffer=s}})}return Kn._canTransferArrayBuffer}const xI=new Le;function KE(e){let t;try{t=new Blob([e],{type:"application/javascript"})}catch{const o=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder,r=new o;r.append(e),t=r.getBlob("application/javascript")}return(window.URL||window.webkitURL).createObjectURL(t)}function DP(e){const t=new Ec(e),n=t.scheme().length!==0&&t.fragment().length===0,i={};let o;if(gU(e)){const s=`importScripts("${e}");`;return o=KE(s),new Worker(o,i)}const r=e.replace(/\.js$/,"");if(!n&&typeof CESIUM_WORKERS<"u"){const s=`
|
|
importScripts("${KE(CESIUM_WORKERS)}");
|
|
CesiumWorkers["${r}"]();
|
|
`;return o=KE(s),new Worker(o,i)}if(o=e,n||(o=Zt(`${Kn._workerModulePrefix+r}.js`)),!Yt.supportsEsmWebWorkers())throw new Te("This browser is not supported. Please update your browser to continue.");return i.type="module",new Worker(o,i)}async function hX(e,t){const n={modulePath:void 0,wasmBinaryFile:void 0,wasmBinary:void 0};if(!Yt.supportsWebAssembly()){if(!c(t.fallbackModulePath))throw new Te(`This browser does not support Web Assembly, and no backup module was provided for ${e._workerPath}`);return n.modulePath=Zt(t.fallbackModulePath),n}n.wasmBinaryFile=Zt(t.wasmBinaryFile);const i=await Ae.fetchArrayBuffer({url:n.wasmBinaryFile});return n.wasmBinary=i,n}function Kn(e,t){this._workerPath=e,this._maximumActiveTasks=y(t,Number.POSITIVE_INFINITY),this._activeTasks=0,this._nextID=0,this._webAssemblyPromise=void 0}const fX=(e,t,n,i)=>{const o=({data:r})=>{if(r.id===t){if(c(r.error)){let s=r.error;s.name==="RuntimeError"?(s=new Te(r.error.message),s.stack=r.error.stack):s.name==="DeveloperError"?(s=new E(r.error.message),s.stack=r.error.stack):s.name==="Error"&&(s=new Error(r.error.message),s.stack=r.error.stack),xI.raiseEvent(s),i(s)}else xI.raiseEvent(),n(r.result);e.removeEventListener("message",o)}};return o},pX=[];async function mX(e,t,n){const i=await Promise.resolve(yk());c(n)?i||(n.length=0):n=pX;const o=e._nextID++,r=new Promise((s,a)=>{e._worker.addEventListener("message",fX(e._worker,o,s,a))});return e._worker.postMessage({id:o,baseUrl:Zt.getCesiumBaseUrl().url,parameters:t,canTransferArrayBuffer:i},n),r}async function _X(e,t,n){++e._activeTasks;try{const i=await mX(e,t,n);return--e._activeTasks,i}catch(i){throw--e._activeTasks,i}}Kn.prototype.scheduleTask=function(e,t){if(c(this._worker)||(this._worker=DP(this._workerPath)),!(this._activeTasks>=this._maximumActiveTasks))return _X(this,e,t)};Kn.prototype.initWebAssemblyModule=async function(e){if(c(this._webAssemblyPromise))return this._webAssemblyPromise;const t=async()=>{const n=this._worker=DP(this._workerPath),i=await hX(this,e),o=await Promise.resolve(yk());let r;const s=i.wasmBinary;c(s)&&o&&(r=[s]);const a=new Promise((l,u)=>{n.onmessage=function({data:h}){c(h)?l(h.result):u(new Te("Could not configure wasm module"))}});return n.postMessage({canTransferArrayBuffer:o,parameters:{webAssemblyConfig:i}},r),a};return this._webAssemblyPromise=t(),this._webAssemblyPromise};Kn.prototype.isDestroyed=function(){return!1};Kn.prototype.destroy=function(){return c(this._worker)&&this._worker.terminate(),ve(this)};Kn.taskCompletedEvent=xI;Kn._defaultWorkerModulePrefix="Workers/";Kn._workerModulePrefix=Kn._defaultWorkerModulePrefix;Kn._canTransferArrayBuffer=void 0;function Qu(){}Qu._transcodeTaskProcessor=new Kn("transcodeKTX2",Number.POSITIVE_INFINITY);Qu._readyPromise=void 0;function gX(){const e=Qu._transcodeTaskProcessor.initWebAssemblyModule({wasmBinaryFile:"ThirdParty/basis_transcoder.wasm"}).then(function(t){if(t)return Qu._transcodeTaskProcessor;throw new Te("KTX2 transcoder could not be initialized.")});Qu._readyPromise=e}Qu.transcode=function(e,t){return A.defined("supportedTargetFormats",t),c(Qu._readyPromise)||gX(),Qu._readyPromise.then(function(n){let i;if(e instanceof ArrayBuffer){const o=new Uint8Array(e);return i={supportedTargetFormats:t,ktx2Buffer:o},n.scheduleTask(i,[e])}return i={supportedTargetFormats:t,ktx2Buffer:e},n.scheduleTask(i,[e.buffer])}).then(function(n){const i=n.length,o=Object.keys(n[0]),r=o.length;let s;for(s=0;s<i;s++){const a=n[s];for(let l=0;l<r;l++){const u=a[o[l]];a[o[l]]=new S_(u.internalFormat,u.datatype,u.width,u.height,u.levelBuffer)}}if(r===1){for(s=0;s<i;++s)n[s]=n[s][o[0]];i===1&&(n=n[0])}return n}).catch(function(n){throw n})};let bk;Op.setKTX2SupportedFormats=function(e,t,n,i,o,r){bk={s3tc:e,pvrtc:t,astc:n,etc:i,etc1:o,bc7:r}};function Op(e){A.defined("resourceOrUrlOrBuffer",e);let t;return e instanceof ArrayBuffer||ArrayBuffer.isView(e)?t=Promise.resolve(e):t=Ae.createIfNeeded(e).fetchArrayBuffer(),t.then(function(n){return Qu.transcode(n,bk)})}function zu(e,t,n,i,o,r,s,a,l,u,h){this._context=e,this._texture=t,this._textureTarget=n,this._targetFace=i,this._pixelDatatype=s,this._internalFormat=o,this._pixelFormat=r,this._size=a,this._preMultiplyAlpha=l,this._flipY=u,this._initialized=h}Object.defineProperties(zu.prototype,{pixelFormat:{get:function(){return this._pixelFormat}},pixelDatatype:{get:function(){return this._pixelDatatype}},_target:{get:function(){return this._targetFace}}});zu.prototype.copyFrom=function(e){A.defined("options",e);const t=y(e.xOffset,0),n=y(e.yOffset,0);if(A.defined("options.source",e.source),A.typeOf.number.greaterThanOrEquals("xOffset",t,0),A.typeOf.number.greaterThanOrEquals("yOffset",n,0),t+e.source.width>this._size)throw new E("xOffset + options.source.width must be less than or equal to width.");if(n+e.source.height>this._size)throw new E("yOffset + options.source.height must be less than or equal to height.");const i=e.source,o=this._context._gl,r=this._textureTarget,s=this._targetFace;o.activeTexture(o.TEXTURE0),o.bindTexture(r,this._texture);const a=i.width,l=i.height;let u=i.arrayBufferView;const h=this._size,f=this._pixelFormat,_=this._internalFormat,g=this._pixelDatatype,m=this._preMultiplyAlpha,b=this._flipY,T=y(e.skipColorSpaceConversion,!1);let x=4;c(u)&&(x=Ve.alignmentInBytes(f,g,a)),o.pixelStorei(o.UNPACK_ALIGNMENT,x),T?o.pixelStorei(o.UNPACK_COLORSPACE_CONVERSION_WEBGL,o.NONE):o.pixelStorei(o.UNPACK_COLORSPACE_CONVERSION_WEBGL,o.BROWSER_DEFAULT_WEBGL);let C=!1;if(!this._initialized){if(t===0&&n===0&&a===h&&l===h)c(u)?(o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,!1),b&&(u=Ve.flipY(u,f,g,h,h)),o.texImage2D(s,0,_,h,h,0,f,Me.toWebGLConstant(g,this._context),u)):(o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,m),o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,b),o.texImage2D(s,0,_,f,Me.toWebGLConstant(g,this._context),i)),C=!0;else{o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,!1);const w=Ve.createTypedArray(f,g,h,h);o.texImage2D(s,0,_,h,h,0,f,Me.toWebGLConstant(g,this._context),w)}this._initialized=!0}C||(c(u)?(o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,!1),b&&(u=Ve.flipY(u,f,g,a,l)),o.texSubImage2D(s,0,t,n,a,l,f,Me.toWebGLConstant(g,this._context),u)):(o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,m),o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,b),o.texSubImage2D(s,0,t,n,f,Me.toWebGLConstant(g,this._context),i))),o.bindTexture(r,null)};zu.prototype.copyFromFramebuffer=function(e,t,n,i,o,r){if(e=y(e,0),t=y(t,0),n=y(n,0),i=y(i,0),o=y(o,this._size),r=y(r,this._size),A.typeOf.number.greaterThanOrEquals("xOffset",e,0),A.typeOf.number.greaterThanOrEquals("yOffset",t,0),A.typeOf.number.greaterThanOrEquals("framebufferXOffset",n,0),A.typeOf.number.greaterThanOrEquals("framebufferYOffset",i,0),e+o>this._size)throw new E("xOffset + source.width must be less than or equal to width.");if(t+r>this._size)throw new E("yOffset + source.height must be less than or equal to height.");if(this._pixelDatatype===Me.FLOAT)throw new E("Cannot call copyFromFramebuffer when the texture pixel data type is FLOAT.");if(this._pixelDatatype===Me.HALF_FLOAT)throw new E("Cannot call copyFromFramebuffer when the texture pixel data type is HALF_FLOAT.");const s=this._context._gl,a=this._textureTarget;s.activeTexture(s.TEXTURE0),s.bindTexture(a,this._texture),s.copyTexSubImage2D(this._targetFace,0,e,t,n,i,o,r),s.bindTexture(a,null),this._initialized=!0};const NA={DONT_CARE:J.DONT_CARE,FASTEST:J.FASTEST,NICEST:J.NICEST,validate:function(e){return e===NA.DONT_CARE||e===NA.FASTEST||e===NA.NICEST}},v_=Object.freeze(NA),MA={NEAREST:J.NEAREST,LINEAR:J.LINEAR};MA.validate=function(e){return e===MA.NEAREST||e===MA.LINEAR};const Yo=Object.freeze(MA),Jd={NEAREST:J.NEAREST,LINEAR:J.LINEAR,NEAREST_MIPMAP_NEAREST:J.NEAREST_MIPMAP_NEAREST,LINEAR_MIPMAP_NEAREST:J.LINEAR_MIPMAP_NEAREST,NEAREST_MIPMAP_LINEAR:J.NEAREST_MIPMAP_LINEAR,LINEAR_MIPMAP_LINEAR:J.LINEAR_MIPMAP_LINEAR};Jd.validate=function(e){return e===Jd.NEAREST||e===Jd.LINEAR||e===Jd.NEAREST_MIPMAP_NEAREST||e===Jd.LINEAR_MIPMAP_NEAREST||e===Jd.NEAREST_MIPMAP_LINEAR||e===Jd.LINEAR_MIPMAP_LINEAR};const en=Object.freeze(Jd),FA={CLAMP_TO_EDGE:J.CLAMP_TO_EDGE,REPEAT:J.REPEAT,MIRRORED_REPEAT:J.MIRRORED_REPEAT,validate:function(e){return e===FA.CLAMP_TO_EDGE||e===FA.REPEAT||e===FA.MIRRORED_REPEAT}},Fn=Object.freeze(FA);function un(e){e=y(e,y.EMPTY_OBJECT);const t=y(e.wrapS,Fn.CLAMP_TO_EDGE),n=y(e.wrapT,Fn.CLAMP_TO_EDGE),i=y(e.minificationFilter,en.LINEAR),o=y(e.magnificationFilter,Yo.LINEAR),r=c(e.maximumAnisotropy)?e.maximumAnisotropy:1;if(!Fn.validate(t))throw new E("Invalid sampler.wrapS.");if(!Fn.validate(n))throw new E("Invalid sampler.wrapT.");if(!en.validate(i))throw new E("Invalid sampler.minificationFilter.");if(!Yo.validate(o))throw new E("Invalid sampler.magnificationFilter.");A.typeOf.number.greaterThanOrEquals("maximumAnisotropy",r,1),this._wrapS=t,this._wrapT=n,this._minificationFilter=i,this._magnificationFilter=o,this._maximumAnisotropy=r}Object.defineProperties(un.prototype,{wrapS:{get:function(){return this._wrapS}},wrapT:{get:function(){return this._wrapT}},minificationFilter:{get:function(){return this._minificationFilter}},magnificationFilter:{get:function(){return this._magnificationFilter}},maximumAnisotropy:{get:function(){return this._maximumAnisotropy}}});un.equals=function(e,t){return e===t||c(e)&&c(t)&&e._wrapS===t._wrapS&&e._wrapT===t._wrapT&&e._minificationFilter===t._minificationFilter&&e._magnificationFilter===t._magnificationFilter&&e._maximumAnisotropy===t._maximumAnisotropy};un.NEAREST=Object.freeze(new un({wrapS:Fn.CLAMP_TO_EDGE,wrapT:Fn.CLAMP_TO_EDGE,minificationFilter:en.NEAREST,magnificationFilter:Yo.NEAREST}));function Sl(e){e=y(e,y.EMPTY_OBJECT),A.defined("options.context",e.context);const t=e.context,n=e.source;let i,o;if(c(n)){const C=[n.positiveX,n.negativeX,n.positiveY,n.negativeY,n.positiveZ,n.negativeZ];if(!C[0]||!C[1]||!C[2]||!C[3]||!C[4]||!C[5])throw new E("options.source requires positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ faces.");i=C[0].width,o=C[0].height;for(let w=1;w<6;++w)if(Number(C[w].width)!==i||Number(C[w].height)!==o)throw new E("Each face in options.source must have the same width and height.")}else i=e.width,o=e.height;const r=i,s=y(e.pixelDatatype,Me.UNSIGNED_BYTE),a=y(e.pixelFormat,Ve.RGBA),l=Ve.toInternalFormat(a,s,t);if(!c(i)||!c(o))throw new E("options requires a source field to create an initialized cube map or width and height fields to create a blank cube map.");if(i!==o)throw new E("Width must equal height.");if(r<=0)throw new E("Width and height must be greater than zero.");if(r>pt.maximumCubeMapSize)throw new E(`Width and height must be less than or equal to the maximum cube map size (${pt.maximumCubeMapSize}). Check maximumCubeMapSize.`);if(!Ve.validate(a))throw new E("Invalid options.pixelFormat.");if(Ve.isDepthFormat(a))throw new E("options.pixelFormat cannot be DEPTH_COMPONENT or DEPTH_STENCIL.");if(!Me.validate(s))throw new E("Invalid options.pixelDatatype.");if(s===Me.FLOAT&&!t.floatingPointTexture)throw new E("When options.pixelDatatype is FLOAT, this WebGL implementation must support the OES_texture_float extension.");if(s===Me.HALF_FLOAT&&!t.halfFloatingPointTexture)throw new E("When options.pixelDatatype is HALF_FLOAT, this WebGL implementation must support the OES_texture_half_float extension.");const u=Ve.textureSizeInBytes(a,s,r,r)*6,h=e.preMultiplyAlpha||a===Ve.RGB||a===Ve.LUMINANCE,f=y(e.flipY,!0),_=y(e.skipColorSpaceConversion,!1),g=t._gl,m=g.TEXTURE_CUBE_MAP,b=g.createTexture();g.activeTexture(g.TEXTURE0),g.bindTexture(m,b);function T(C,w,v,P,N){let k=w.arrayBufferView;c(k)||(k=w.bufferView);let M=4;c(k)&&(M=Ve.alignmentInBytes(a,s,i)),g.pixelStorei(g.UNPACK_ALIGNMENT,M),N?g.pixelStorei(g.UNPACK_COLORSPACE_CONVERSION_WEBGL,g.NONE):g.pixelStorei(g.UNPACK_COLORSPACE_CONVERSION_WEBGL,g.BROWSER_DEFAULT_WEBGL),c(k)?(g.pixelStorei(g.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),g.pixelStorei(g.UNPACK_FLIP_Y_WEBGL,!1),P&&(k=Ve.flipY(k,a,s,r,r)),g.texImage2D(C,0,l,r,r,0,a,Me.toWebGLConstant(s,t),k)):(g.pixelStorei(g.UNPACK_PREMULTIPLY_ALPHA_WEBGL,v),g.pixelStorei(g.UNPACK_FLIP_Y_WEBGL,P),g.texImage2D(C,0,l,a,Me.toWebGLConstant(s,t),w))}c(n)?(T(g.TEXTURE_CUBE_MAP_POSITIVE_X,n.positiveX,h,f,_),T(g.TEXTURE_CUBE_MAP_NEGATIVE_X,n.negativeX,h,f,_),T(g.TEXTURE_CUBE_MAP_POSITIVE_Y,n.positiveY,h,f,_),T(g.TEXTURE_CUBE_MAP_NEGATIVE_Y,n.negativeY,h,f,_),T(g.TEXTURE_CUBE_MAP_POSITIVE_Z,n.positiveZ,h,f,_),T(g.TEXTURE_CUBE_MAP_NEGATIVE_Z,n.negativeZ,h,f,_)):(g.texImage2D(g.TEXTURE_CUBE_MAP_POSITIVE_X,0,l,r,r,0,a,Me.toWebGLConstant(s,t),null),g.texImage2D(g.TEXTURE_CUBE_MAP_NEGATIVE_X,0,l,r,r,0,a,Me.toWebGLConstant(s,t),null),g.texImage2D(g.TEXTURE_CUBE_MAP_POSITIVE_Y,0,l,r,r,0,a,Me.toWebGLConstant(s,t),null),g.texImage2D(g.TEXTURE_CUBE_MAP_NEGATIVE_Y,0,l,r,r,0,a,Me.toWebGLConstant(s,t),null),g.texImage2D(g.TEXTURE_CUBE_MAP_POSITIVE_Z,0,l,r,r,0,a,Me.toWebGLConstant(s,t),null),g.texImage2D(g.TEXTURE_CUBE_MAP_NEGATIVE_Z,0,l,r,r,0,a,Me.toWebGLConstant(s,t),null)),g.bindTexture(m,null),this._context=t,this._textureFilterAnisotropic=t._textureFilterAnisotropic,this._textureTarget=m,this._texture=b,this._pixelFormat=a,this._pixelDatatype=s,this._size=r,this._hasMipmap=!1,this._sizeInBytes=u,this._preMultiplyAlpha=h,this._flipY=f,this._sampler=void 0;const x=c(n);this._positiveX=new zu(t,b,m,g.TEXTURE_CUBE_MAP_POSITIVE_X,l,a,s,r,h,f,x),this._negativeX=new zu(t,b,m,g.TEXTURE_CUBE_MAP_NEGATIVE_X,l,a,s,r,h,f,x),this._positiveY=new zu(t,b,m,g.TEXTURE_CUBE_MAP_POSITIVE_Y,l,a,s,r,h,f,x),this._negativeY=new zu(t,b,m,g.TEXTURE_CUBE_MAP_NEGATIVE_Y,l,a,s,r,h,f,x),this._positiveZ=new zu(t,b,m,g.TEXTURE_CUBE_MAP_POSITIVE_Z,l,a,s,r,h,f,x),this._negativeZ=new zu(t,b,m,g.TEXTURE_CUBE_MAP_NEGATIVE_Z,l,a,s,r,h,f,x),this.sampler=c(e.sampler)?e.sampler:new un}Object.defineProperties(Sl.prototype,{positiveX:{get:function(){return this._positiveX}},negativeX:{get:function(){return this._negativeX}},positiveY:{get:function(){return this._positiveY}},negativeY:{get:function(){return this._negativeY}},positiveZ:{get:function(){return this._positiveZ}},negativeZ:{get:function(){return this._negativeZ}},sampler:{get:function(){return this._sampler},set:function(e){let t=e.minificationFilter,n=e.magnificationFilter;const i=t===en.NEAREST_MIPMAP_NEAREST||t===en.NEAREST_MIPMAP_LINEAR||t===en.LINEAR_MIPMAP_NEAREST||t===en.LINEAR_MIPMAP_LINEAR,o=this._context,r=this._pixelDatatype;(r===Me.FLOAT&&!o.textureFloatLinear||r===Me.HALF_FLOAT&&!o.textureHalfFloatLinear)&&(t=i?en.NEAREST_MIPMAP_NEAREST:en.NEAREST,n=Yo.NEAREST);const s=o._gl,a=this._textureTarget;s.activeTexture(s.TEXTURE0),s.bindTexture(a,this._texture),s.texParameteri(a,s.TEXTURE_MIN_FILTER,t),s.texParameteri(a,s.TEXTURE_MAG_FILTER,n),s.texParameteri(a,s.TEXTURE_WRAP_S,e.wrapS),s.texParameteri(a,s.TEXTURE_WRAP_T,e.wrapT),c(this._textureFilterAnisotropic)&&s.texParameteri(a,this._textureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,e.maximumAnisotropy),s.bindTexture(a,null),this._sampler=e}},pixelFormat:{get:function(){return this._pixelFormat}},pixelDatatype:{get:function(){return this._pixelDatatype}},width:{get:function(){return this._size}},height:{get:function(){return this._size}},sizeInBytes:{get:function(){return this._hasMipmap?Math.floor(this._sizeInBytes*4/3):this._sizeInBytes}},preMultiplyAlpha:{get:function(){return this._preMultiplyAlpha}},flipY:{get:function(){return this._flipY}},_target:{get:function(){return this._textureTarget}}});Sl.prototype.generateMipmap=function(e){if(e=y(e,v_.DONT_CARE),this._size>1&&!R.isPowerOfTwo(this._size))throw new E("width and height must be a power of two to call generateMipmap().");if(!v_.validate(e))throw new E("hint is invalid.");this._hasMipmap=!0;const t=this._context._gl,n=this._textureTarget;t.hint(t.GENERATE_MIPMAP_HINT,e),t.activeTexture(t.TEXTURE0),t.bindTexture(n,this._texture),t.generateMipmap(n),t.bindTexture(n,null)};Sl.prototype.isDestroyed=function(){return!1};Sl.prototype.destroy=function(){return this._context._gl.deleteTexture(this._texture),this._positiveX=ve(this._positiveX),this._negativeX=ve(this._negativeX),this._positiveY=ve(this._positiveY),this._negativeY=ve(this._negativeY),this._positiveZ=ve(this._positiveZ),this._negativeZ=ve(this._negativeZ),ve(this)};function Lp(e){this.context=e,this.framebuffer=void 0,this.blendingEnabled=void 0,this.scissorTest=void 0,this.viewport=void 0}const yX=`/**
|
|
* A built-in GLSL floating-point constant for converting radians to degrees.
|
|
*
|
|
* @alias czm_degreesPerRadian
|
|
* @glslConstant
|
|
*
|
|
* @see CesiumMath.DEGREES_PER_RADIAN
|
|
*
|
|
* @example
|
|
* // GLSL declaration
|
|
* const float czm_degreesPerRadian = ...;
|
|
*
|
|
* // Example
|
|
* float deg = czm_degreesPerRadian * rad;
|
|
*/
|
|
const float czm_degreesPerRadian = 57.29577951308232;
|
|
`,bX=`/**
|
|
* A built-in GLSL vec2 constant for defining the depth range.
|
|
* This is a workaround to a bug where IE11 does not implement gl_DepthRange.
|
|
*
|
|
* @alias czm_depthRange
|
|
* @glslConstant
|
|
*
|
|
* @example
|
|
* // GLSL declaration
|
|
* float depthRangeNear = czm_depthRange.near;
|
|
* float depthRangeFar = czm_depthRange.far;
|
|
*
|
|
*/
|
|
const czm_depthRangeStruct czm_depthRange = czm_depthRangeStruct(0.0, 1.0);
|
|
`,TX=`/**
|
|
* 0.1
|
|
*
|
|
* @name czm_epsilon1
|
|
* @glslConstant
|
|
*/
|
|
const float czm_epsilon1 = 0.1;
|
|
`,AX=`/**
|
|
* 0.01
|
|
*
|
|
* @name czm_epsilon2
|
|
* @glslConstant
|
|
*/
|
|
const float czm_epsilon2 = 0.01;
|
|
`,xX=`/**
|
|
* 0.001
|
|
*
|
|
* @name czm_epsilon3
|
|
* @glslConstant
|
|
*/
|
|
const float czm_epsilon3 = 0.001;
|
|
`,CX=`/**
|
|
* 0.0001
|
|
*
|
|
* @name czm_epsilon4
|
|
* @glslConstant
|
|
*/
|
|
const float czm_epsilon4 = 0.0001;
|
|
`,EX=`/**
|
|
* 0.00001
|
|
*
|
|
* @name czm_epsilon5
|
|
* @glslConstant
|
|
*/
|
|
const float czm_epsilon5 = 0.00001;
|
|
`,wX=`/**
|
|
* 0.000001
|
|
*
|
|
* @name czm_epsilon6
|
|
* @glslConstant
|
|
*/
|
|
const float czm_epsilon6 = 0.000001;
|
|
`,SX=`/**
|
|
* 0.0000001
|
|
*
|
|
* @name czm_epsilon7
|
|
* @glslConstant
|
|
*/
|
|
const float czm_epsilon7 = 0.0000001;
|
|
`,vX=`/**
|
|
* DOC_TBA
|
|
*
|
|
* @name czm_infinity
|
|
* @glslConstant
|
|
*/
|
|
const float czm_infinity = 5906376272000.0; // Distance from the Sun to Pluto in meters. TODO: What is best given lowp, mediump, and highp?
|
|
`,IX=`/**
|
|
* A built-in GLSL floating-point constant for <code>1/pi</code>.
|
|
*
|
|
* @alias czm_oneOverPi
|
|
* @glslConstant
|
|
*
|
|
* @see CesiumMath.ONE_OVER_PI
|
|
*
|
|
* @example
|
|
* // GLSL declaration
|
|
* const float czm_oneOverPi = ...;
|
|
*
|
|
* // Example
|
|
* float pi = 1.0 / czm_oneOverPi;
|
|
*/
|
|
const float czm_oneOverPi = 0.3183098861837907;
|
|
`,DX=`/**
|
|
* A built-in GLSL floating-point constant for <code>1/2pi</code>.
|
|
*
|
|
* @alias czm_oneOverTwoPi
|
|
* @glslConstant
|
|
*
|
|
* @see CesiumMath.ONE_OVER_TWO_PI
|
|
*
|
|
* @example
|
|
* // GLSL declaration
|
|
* const float czm_oneOverTwoPi = ...;
|
|
*
|
|
* // Example
|
|
* float pi = 2.0 * czm_oneOverTwoPi;
|
|
*/
|
|
const float czm_oneOverTwoPi = 0.15915494309189535;
|
|
`,PX=`/**
|
|
* The automatic GLSL constant for {@link Pass#CESIUM_3D_TILE}
|
|
*
|
|
* @name czm_passCesium3DTile
|
|
* @glslConstant
|
|
*
|
|
* @see czm_pass
|
|
*/
|
|
const float czm_passCesium3DTile = 4.0;
|
|
`,OX=`/**
|
|
* The automatic GLSL constant for {@link Pass#CESIUM_3D_TILE_CLASSIFICATION}
|
|
*
|
|
* @name czm_passCesium3DTileClassification
|
|
* @glslConstant
|
|
*
|
|
* @see czm_pass
|
|
*/
|
|
const float czm_passCesium3DTileClassification = 5.0;
|
|
`,LX=`/**
|
|
* The automatic GLSL constant for {@link Pass#CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW}
|
|
*
|
|
* @name czm_passCesium3DTileClassificationIgnoreShow
|
|
* @glslConstant
|
|
*
|
|
* @see czm_pass
|
|
*/
|
|
const float czm_passCesium3DTileClassificationIgnoreShow = 6.0;
|
|
`,RX=`/**
|
|
* The automatic GLSL constant for {@link Pass#CLASSIFICATION}
|
|
*
|
|
* @name czm_passClassification
|
|
* @glslConstant
|
|
*
|
|
* @see czm_pass
|
|
*/
|
|
const float czm_passClassification = 7.0;
|
|
`,NX=`/**
|
|
* The automatic GLSL constant for {@link Pass#COMPUTE}
|
|
*
|
|
* @name czm_passCompute
|
|
* @glslConstant
|
|
*
|
|
* @see czm_pass
|
|
*/
|
|
const float czm_passCompute = 1.0;
|
|
`,MX=`/**
|
|
* The automatic GLSL constant for {@link Pass#ENVIRONMENT}
|
|
*
|
|
* @name czm_passEnvironment
|
|
* @glslConstant
|
|
*
|
|
* @see czm_pass
|
|
*/
|
|
const float czm_passEnvironment = 0.0;
|
|
`,FX=`/**
|
|
* The automatic GLSL constant for {@link Pass#GLOBE}
|
|
*
|
|
* @name czm_passGlobe
|
|
* @glslConstant
|
|
*
|
|
* @see czm_pass
|
|
*/
|
|
const float czm_passGlobe = 2.0;
|
|
`,BX=`/**
|
|
* The automatic GLSL constant for {@link Pass#OPAQUE}
|
|
*
|
|
* @name czm_passOpaque
|
|
* @glslConstant
|
|
*
|
|
* @see czm_pass
|
|
*/
|
|
const float czm_passOpaque = 7.0;
|
|
`,zX=`/**
|
|
* The automatic GLSL constant for {@link Pass#OVERLAY}
|
|
*
|
|
* @name czm_passOverlay
|
|
* @glslConstant
|
|
*
|
|
* @see czm_pass
|
|
*/
|
|
const float czm_passOverlay = 10.0;
|
|
`,UX=`/**
|
|
* The automatic GLSL constant for {@link Pass#TERRAIN_CLASSIFICATION}
|
|
*
|
|
* @name czm_passTerrainClassification
|
|
* @glslConstant
|
|
*
|
|
* @see czm_pass
|
|
*/
|
|
const float czm_passTerrainClassification = 3.0;
|
|
`,kX=`/**
|
|
* The automatic GLSL constant for {@link Pass#TRANSLUCENT}
|
|
*
|
|
* @name czm_passTranslucent
|
|
* @glslConstant
|
|
*
|
|
* @see czm_pass
|
|
*/
|
|
const float czm_passTranslucent = 8.0;
|
|
`,VX=`/**
|
|
* The automatic GLSL constant for {@link Pass#VOXELS}
|
|
*
|
|
* @name czm_passVoxels
|
|
* @glslConstant
|
|
*
|
|
* @see czm_pass
|
|
*/
|
|
const float czm_passVoxels = 9.0;
|
|
`,HX=`/**
|
|
* A built-in GLSL floating-point constant for <code>Math.PI</code>.
|
|
*
|
|
* @alias czm_pi
|
|
* @glslConstant
|
|
*
|
|
* @see CesiumMath.PI
|
|
*
|
|
* @example
|
|
* // GLSL declaration
|
|
* const float czm_pi = ...;
|
|
*
|
|
* // Example
|
|
* float twoPi = 2.0 * czm_pi;
|
|
*/
|
|
const float czm_pi = 3.141592653589793;
|
|
`,GX=`/**
|
|
* A built-in GLSL floating-point constant for <code>pi/4</code>.
|
|
*
|
|
* @alias czm_piOverFour
|
|
* @glslConstant
|
|
*
|
|
* @see CesiumMath.PI_OVER_FOUR
|
|
*
|
|
* @example
|
|
* // GLSL declaration
|
|
* const float czm_piOverFour = ...;
|
|
*
|
|
* // Example
|
|
* float pi = 4.0 * czm_piOverFour;
|
|
*/
|
|
const float czm_piOverFour = 0.7853981633974483;
|
|
`,jX=`/**
|
|
* A built-in GLSL floating-point constant for <code>pi/6</code>.
|
|
*
|
|
* @alias czm_piOverSix
|
|
* @glslConstant
|
|
*
|
|
* @see CesiumMath.PI_OVER_SIX
|
|
*
|
|
* @example
|
|
* // GLSL declaration
|
|
* const float czm_piOverSix = ...;
|
|
*
|
|
* // Example
|
|
* float pi = 6.0 * czm_piOverSix;
|
|
*/
|
|
const float czm_piOverSix = 0.5235987755982988;
|
|
`,WX=`/**
|
|
* A built-in GLSL floating-point constant for <code>pi/3</code>.
|
|
*
|
|
* @alias czm_piOverThree
|
|
* @glslConstant
|
|
*
|
|
* @see CesiumMath.PI_OVER_THREE
|
|
*
|
|
* @example
|
|
* // GLSL declaration
|
|
* const float czm_piOverThree = ...;
|
|
*
|
|
* // Example
|
|
* float pi = 3.0 * czm_piOverThree;
|
|
*/
|
|
const float czm_piOverThree = 1.0471975511965976;
|
|
`,qX=`/**
|
|
* A built-in GLSL floating-point constant for <code>pi/2</code>.
|
|
*
|
|
* @alias czm_piOverTwo
|
|
* @glslConstant
|
|
*
|
|
* @see CesiumMath.PI_OVER_TWO
|
|
*
|
|
* @example
|
|
* // GLSL declaration
|
|
* const float czm_piOverTwo = ...;
|
|
*
|
|
* // Example
|
|
* float pi = 2.0 * czm_piOverTwo;
|
|
*/
|
|
const float czm_piOverTwo = 1.5707963267948966;
|
|
`,YX=`/**
|
|
* A built-in GLSL floating-point constant for converting degrees to radians.
|
|
*
|
|
* @alias czm_radiansPerDegree
|
|
* @glslConstant
|
|
*
|
|
* @see CesiumMath.RADIANS_PER_DEGREE
|
|
*
|
|
* @example
|
|
* // GLSL declaration
|
|
* const float czm_radiansPerDegree = ...;
|
|
*
|
|
* // Example
|
|
* float rad = czm_radiansPerDegree * deg;
|
|
*/
|
|
const float czm_radiansPerDegree = 0.017453292519943295;
|
|
`,$X=`/**
|
|
* The constant identifier for the 2D {@link SceneMode}
|
|
*
|
|
* @name czm_sceneMode2D
|
|
* @glslConstant
|
|
* @see czm_sceneMode
|
|
* @see czm_sceneModeColumbusView
|
|
* @see czm_sceneMode3D
|
|
* @see czm_sceneModeMorphing
|
|
*/
|
|
const float czm_sceneMode2D = 2.0;
|
|
`,XX=`/**
|
|
* The constant identifier for the 3D {@link SceneMode}
|
|
*
|
|
* @name czm_sceneMode3D
|
|
* @glslConstant
|
|
* @see czm_sceneMode
|
|
* @see czm_sceneMode2D
|
|
* @see czm_sceneModeColumbusView
|
|
* @see czm_sceneModeMorphing
|
|
*/
|
|
const float czm_sceneMode3D = 3.0;
|
|
`,QX=`/**
|
|
* The constant identifier for the Columbus View {@link SceneMode}
|
|
*
|
|
* @name czm_sceneModeColumbusView
|
|
* @glslConstant
|
|
* @see czm_sceneMode
|
|
* @see czm_sceneMode2D
|
|
* @see czm_sceneMode3D
|
|
* @see czm_sceneModeMorphing
|
|
*/
|
|
const float czm_sceneModeColumbusView = 1.0;
|
|
`,KX=`/**
|
|
* The constant identifier for the Morphing {@link SceneMode}
|
|
*
|
|
* @name czm_sceneModeMorphing
|
|
* @glslConstant
|
|
* @see czm_sceneMode
|
|
* @see czm_sceneMode2D
|
|
* @see czm_sceneModeColumbusView
|
|
* @see czm_sceneMode3D
|
|
*/
|
|
const float czm_sceneModeMorphing = 0.0;
|
|
`,ZX=`/**
|
|
* A built-in GLSL floating-point constant for one solar radius.
|
|
*
|
|
* @alias czm_solarRadius
|
|
* @glslConstant
|
|
*
|
|
* @see CesiumMath.SOLAR_RADIUS
|
|
*
|
|
* @example
|
|
* // GLSL declaration
|
|
* const float czm_solarRadius = ...;
|
|
*/
|
|
const float czm_solarRadius = 695500000.0;
|
|
`,JX=`/**
|
|
* A built-in GLSL floating-point constant for <code>3pi/2</code>.
|
|
*
|
|
* @alias czm_threePiOver2
|
|
* @glslConstant
|
|
*
|
|
* @see CesiumMath.THREE_PI_OVER_TWO
|
|
*
|
|
* @example
|
|
* // GLSL declaration
|
|
* const float czm_threePiOver2 = ...;
|
|
*
|
|
* // Example
|
|
* float pi = (2.0 / 3.0) * czm_threePiOver2;
|
|
*/
|
|
const float czm_threePiOver2 = 4.71238898038469;
|
|
`,eQ=`/**
|
|
* A built-in GLSL floating-point constant for <code>2pi</code>.
|
|
*
|
|
* @alias czm_twoPi
|
|
* @glslConstant
|
|
*
|
|
* @see CesiumMath.TWO_PI
|
|
*
|
|
* @example
|
|
* // GLSL declaration
|
|
* const float czm_twoPi = ...;
|
|
*
|
|
* // Example
|
|
* float pi = czm_twoPi / 2.0;
|
|
*/
|
|
const float czm_twoPi = 6.283185307179586;
|
|
`,tQ=`/**
|
|
* The maximum latitude, in radians, both North and South, supported by a Web Mercator
|
|
* (EPSG:3857) projection. Technically, the Mercator projection is defined
|
|
* for any latitude up to (but not including) 90 degrees, but it makes sense
|
|
* to cut it off sooner because it grows exponentially with increasing latitude.
|
|
* The logic behind this particular cutoff value, which is the one used by
|
|
* Google Maps, Bing Maps, and Esri, is that it makes the projection
|
|
* square. That is, the rectangle is equal in the X and Y directions.
|
|
*
|
|
* The constant value is computed as follows:
|
|
* czm_pi * 0.5 - (2.0 * atan(exp(-czm_pi)))
|
|
*
|
|
* @name czm_webMercatorMaxLatitude
|
|
* @glslConstant
|
|
*/
|
|
const float czm_webMercatorMaxLatitude = 1.4844222297453324;
|
|
`,nQ=`/**
|
|
* @name czm_depthRangeStruct
|
|
* @glslStruct
|
|
*/
|
|
struct czm_depthRangeStruct
|
|
{
|
|
float near;
|
|
float far;
|
|
};
|
|
`,iQ=`/**
|
|
* Holds material information that can be used for lighting. Returned by all czm_getMaterial functions.
|
|
*
|
|
* @name czm_material
|
|
* @glslStruct
|
|
*
|
|
* @property {vec3} diffuse Incoming light that scatters evenly in all directions.
|
|
* @property {float} specular Intensity of incoming light reflecting in a single direction.
|
|
* @property {float} shininess The sharpness of the specular reflection. Higher values create a smaller, more focused specular highlight.
|
|
* @property {vec3} normal Surface's normal in eye coordinates. It is used for effects such as normal mapping. The default is the surface's unmodified normal.
|
|
* @property {vec3} emission Light emitted by the material equally in all directions. The default is vec3(0.0), which emits no light.
|
|
* @property {float} alpha Alpha of this material. 0.0 is completely transparent; 1.0 is completely opaque.
|
|
*/
|
|
struct czm_material
|
|
{
|
|
vec3 diffuse;
|
|
float specular;
|
|
float shininess;
|
|
vec3 normal;
|
|
vec3 emission;
|
|
float alpha;
|
|
};
|
|
`,oQ=`/**
|
|
* Used as input to every material's czm_getMaterial function.
|
|
*
|
|
* @name czm_materialInput
|
|
* @glslStruct
|
|
*
|
|
* @property {float} s 1D texture coordinates.
|
|
* @property {vec2} st 2D texture coordinates.
|
|
* @property {vec3} str 3D texture coordinates.
|
|
* @property {vec3} normalEC Unperturbed surface normal in eye coordinates.
|
|
* @property {mat3} tangentToEyeMatrix Matrix for converting a tangent space normal to eye space.
|
|
* @property {vec3} positionToEyeEC Vector from the fragment to the eye in eye coordinates. The magnitude is the distance in meters from the fragment to the eye.
|
|
* @property {float} height The height of the terrain in meters above or below the WGS84 ellipsoid. Only available for globe materials.
|
|
* @property {float} slope The slope of the terrain in radians. 0 is flat; pi/2 is vertical. Only available for globe materials.
|
|
* @property {float} aspect The aspect of the terrain in radians. 0 is East, pi/2 is North, pi is West, 3pi/2 is South. Only available for globe materials.
|
|
*/
|
|
struct czm_materialInput
|
|
{
|
|
float s;
|
|
vec2 st;
|
|
vec3 str;
|
|
vec3 normalEC;
|
|
mat3 tangentToEyeMatrix;
|
|
vec3 positionToEyeEC;
|
|
float height;
|
|
float slope;
|
|
float aspect;
|
|
};
|
|
`,rQ=`/**
|
|
* Struct for representing a material for a {@link Model}. The model
|
|
* rendering pipeline will pass this struct between material, custom shaders,
|
|
* and lighting stages. This is not to be confused with {@link czm_material}
|
|
* which is used by the older Fabric materials system, although they are similar.
|
|
* <p>
|
|
* All color values (diffuse, specular, emissive) are in linear color space.
|
|
* </p>
|
|
*
|
|
* @name czm_modelMaterial
|
|
* @glslStruct
|
|
*
|
|
* @property {vec3} diffuse Incoming light that scatters evenly in all directions.
|
|
* @property {float} alpha Alpha of this material. 0.0 is completely transparent; 1.0 is completely opaque.
|
|
* @property {vec3} specular Color of reflected light at normal incidence in PBR materials. This is sometimes referred to as f0 in the literature.
|
|
* @property {float} roughness A number from 0.0 to 1.0 representing how rough the surface is. Values near 0.0 produce glossy surfaces, while values near 1.0 produce rough surfaces.
|
|
* @property {vec3} normalEC Surface's normal in eye coordinates. It is used for effects such as normal mapping. The default is the surface's unmodified normal.
|
|
* @property {float} occlusion Ambient occlusion recieved at this point on the material. 1.0 means fully lit, 0.0 means fully occluded.
|
|
* @property {vec3} emissive Light emitted by the material equally in all directions. The default is vec3(0.0), which emits no light.
|
|
*/
|
|
struct czm_modelMaterial {
|
|
vec3 diffuse;
|
|
float alpha;
|
|
vec3 specular;
|
|
float roughness;
|
|
vec3 normalEC;
|
|
float occlusion;
|
|
vec3 emissive;
|
|
};
|
|
`,sQ=`/**
|
|
* Struct for representing the output of a custom vertex shader.
|
|
*
|
|
* @name czm_modelVertexOutput
|
|
* @glslStruct
|
|
*
|
|
* @see {@link CustomShader}
|
|
* @see {@link Model}
|
|
*
|
|
* @property {vec3} positionMC The position of the vertex in model coordinates
|
|
* @property {float} pointSize A custom value for gl_PointSize. This is only used for point primitives.
|
|
*/
|
|
struct czm_modelVertexOutput {
|
|
vec3 positionMC;
|
|
float pointSize;
|
|
};
|
|
`,aQ=`/**
|
|
* Parameters for {@link czm_pbrLighting}
|
|
*
|
|
* @name czm_material
|
|
* @glslStruct
|
|
*
|
|
* @property {vec3} diffuseColor the diffuse color of the material for the lambert term of the rendering equation
|
|
* @property {float} roughness a value from 0.0 to 1.0 that indicates how rough the surface of the material is.
|
|
* @property {vec3} f0 The reflectance of the material at normal incidence
|
|
*/
|
|
struct czm_pbrParameters
|
|
{
|
|
vec3 diffuseColor;
|
|
float roughness;
|
|
vec3 f0;
|
|
};
|
|
`,cQ=`/**
|
|
* DOC_TBA
|
|
*
|
|
* @name czm_ray
|
|
* @glslStruct
|
|
*/
|
|
struct czm_ray
|
|
{
|
|
vec3 origin;
|
|
vec3 direction;
|
|
};
|
|
`,lQ=`/**
|
|
* DOC_TBA
|
|
*
|
|
* @name czm_raySegment
|
|
* @glslStruct
|
|
*/
|
|
struct czm_raySegment
|
|
{
|
|
float start;
|
|
float stop;
|
|
};
|
|
|
|
/**
|
|
* DOC_TBA
|
|
*
|
|
* @name czm_emptyRaySegment
|
|
* @glslConstant
|
|
*/
|
|
const czm_raySegment czm_emptyRaySegment = czm_raySegment(-czm_infinity, -czm_infinity);
|
|
|
|
/**
|
|
* DOC_TBA
|
|
*
|
|
* @name czm_fullRaySegment
|
|
* @glslConstant
|
|
*/
|
|
const czm_raySegment czm_fullRaySegment = czm_raySegment(0.0, czm_infinity);
|
|
`,uQ=`struct czm_shadowParameters
|
|
{
|
|
#ifdef USE_CUBE_MAP_SHADOW
|
|
vec3 texCoords;
|
|
#else
|
|
vec2 texCoords;
|
|
#endif
|
|
|
|
float depthBias;
|
|
float depth;
|
|
float nDotL;
|
|
vec2 texelStepSize;
|
|
float normalShadingSmooth;
|
|
float darkness;
|
|
};
|
|
`,dQ=`/**
|
|
* Converts an HSB color (hue, saturation, brightness) to RGB
|
|
* HSB <-> RGB conversion with minimal branching: {@link http://lolengine.net/blog/2013/07/27/rgb-to-hsv-in-glsl}
|
|
*
|
|
* @name czm_HSBToRGB
|
|
* @glslFunction
|
|
*
|
|
* @param {vec3} hsb The color in HSB.
|
|
*
|
|
* @returns {vec3} The color in RGB.
|
|
*
|
|
* @example
|
|
* vec3 hsb = czm_RGBToHSB(rgb);
|
|
* hsb.z *= 0.1;
|
|
* rgb = czm_HSBToRGB(hsb);
|
|
*/
|
|
|
|
const vec4 K_HSB2RGB = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
|
|
|
|
vec3 czm_HSBToRGB(vec3 hsb)
|
|
{
|
|
vec3 p = abs(fract(hsb.xxx + K_HSB2RGB.xyz) * 6.0 - K_HSB2RGB.www);
|
|
return hsb.z * mix(K_HSB2RGB.xxx, clamp(p - K_HSB2RGB.xxx, 0.0, 1.0), hsb.y);
|
|
}
|
|
`,hQ=`/**
|
|
* Converts an HSL color (hue, saturation, lightness) to RGB
|
|
* HSL <-> RGB conversion: {@link http://www.chilliant.com/rgb2hsv.html}
|
|
*
|
|
* @name czm_HSLToRGB
|
|
* @glslFunction
|
|
*
|
|
* @param {vec3} rgb The color in HSL.
|
|
*
|
|
* @returns {vec3} The color in RGB.
|
|
*
|
|
* @example
|
|
* vec3 hsl = czm_RGBToHSL(rgb);
|
|
* hsl.z *= 0.1;
|
|
* rgb = czm_HSLToRGB(hsl);
|
|
*/
|
|
|
|
vec3 hueToRGB(float hue)
|
|
{
|
|
float r = abs(hue * 6.0 - 3.0) - 1.0;
|
|
float g = 2.0 - abs(hue * 6.0 - 2.0);
|
|
float b = 2.0 - abs(hue * 6.0 - 4.0);
|
|
return clamp(vec3(r, g, b), 0.0, 1.0);
|
|
}
|
|
|
|
vec3 czm_HSLToRGB(vec3 hsl)
|
|
{
|
|
vec3 rgb = hueToRGB(hsl.x);
|
|
float c = (1.0 - abs(2.0 * hsl.z - 1.0)) * hsl.y;
|
|
return (rgb - 0.5) * c + hsl.z;
|
|
}
|
|
`,fQ=`/**
|
|
* Converts an RGB color to HSB (hue, saturation, brightness)
|
|
* HSB <-> RGB conversion with minimal branching: {@link http://lolengine.net/blog/2013/07/27/rgb-to-hsv-in-glsl}
|
|
*
|
|
* @name czm_RGBToHSB
|
|
* @glslFunction
|
|
*
|
|
* @param {vec3} rgb The color in RGB.
|
|
*
|
|
* @returns {vec3} The color in HSB.
|
|
*
|
|
* @example
|
|
* vec3 hsb = czm_RGBToHSB(rgb);
|
|
* hsb.z *= 0.1;
|
|
* rgb = czm_HSBToRGB(hsb);
|
|
*/
|
|
|
|
const vec4 K_RGB2HSB = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
|
|
|
|
vec3 czm_RGBToHSB(vec3 rgb)
|
|
{
|
|
vec4 p = mix(vec4(rgb.bg, K_RGB2HSB.wz), vec4(rgb.gb, K_RGB2HSB.xy), step(rgb.b, rgb.g));
|
|
vec4 q = mix(vec4(p.xyw, rgb.r), vec4(rgb.r, p.yzx), step(p.x, rgb.r));
|
|
|
|
float d = q.x - min(q.w, q.y);
|
|
return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + czm_epsilon7)), d / (q.x + czm_epsilon7), q.x);
|
|
}
|
|
`,pQ=`/**
|
|
* Converts an RGB color to HSL (hue, saturation, lightness)
|
|
* HSL <-> RGB conversion: {@link http://www.chilliant.com/rgb2hsv.html}
|
|
*
|
|
* @name czm_RGBToHSL
|
|
* @glslFunction
|
|
*
|
|
* @param {vec3} rgb The color in RGB.
|
|
*
|
|
* @returns {vec3} The color in HSL.
|
|
*
|
|
* @example
|
|
* vec3 hsl = czm_RGBToHSL(rgb);
|
|
* hsl.z *= 0.1;
|
|
* rgb = czm_HSLToRGB(hsl);
|
|
*/
|
|
|
|
vec3 RGBtoHCV(vec3 rgb)
|
|
{
|
|
// Based on work by Sam Hocevar and Emil Persson
|
|
vec4 p = (rgb.g < rgb.b) ? vec4(rgb.bg, -1.0, 2.0 / 3.0) : vec4(rgb.gb, 0.0, -1.0 / 3.0);
|
|
vec4 q = (rgb.r < p.x) ? vec4(p.xyw, rgb.r) : vec4(rgb.r, p.yzx);
|
|
float c = q.x - min(q.w, q.y);
|
|
float h = abs((q.w - q.y) / (6.0 * c + czm_epsilon7) + q.z);
|
|
return vec3(h, c, q.x);
|
|
}
|
|
|
|
vec3 czm_RGBToHSL(vec3 rgb)
|
|
{
|
|
vec3 hcv = RGBtoHCV(rgb);
|
|
float l = hcv.z - hcv.y * 0.5;
|
|
float s = hcv.y / (1.0 - abs(l * 2.0 - 1.0) + czm_epsilon7);
|
|
return vec3(hcv.x, s, l);
|
|
}
|
|
`,mQ=`/**
|
|
* Converts an RGB color to CIE Yxy.
|
|
* <p>The conversion is described in
|
|
* {@link http://content.gpwiki.org/index.php/D3DBook:High-Dynamic_Range_Rendering#Luminance_Transform|Luminance Transform}
|
|
* </p>
|
|
*
|
|
* @name czm_RGBToXYZ
|
|
* @glslFunction
|
|
*
|
|
* @param {vec3} rgb The color in RGB.
|
|
*
|
|
* @returns {vec3} The color in CIE Yxy.
|
|
*
|
|
* @example
|
|
* vec3 xyz = czm_RGBToXYZ(rgb);
|
|
* xyz.x = max(xyz.x - luminanceThreshold, 0.0);
|
|
* rgb = czm_XYZToRGB(xyz);
|
|
*/
|
|
vec3 czm_RGBToXYZ(vec3 rgb)
|
|
{
|
|
const mat3 RGB2XYZ = mat3(0.4124, 0.2126, 0.0193,
|
|
0.3576, 0.7152, 0.1192,
|
|
0.1805, 0.0722, 0.9505);
|
|
vec3 xyz = RGB2XYZ * rgb;
|
|
vec3 Yxy;
|
|
Yxy.r = xyz.g;
|
|
float temp = dot(vec3(1.0), xyz);
|
|
Yxy.gb = xyz.rg / temp;
|
|
return Yxy;
|
|
}
|
|
`,_Q=`/**
|
|
* Converts a CIE Yxy color to RGB.
|
|
* <p>The conversion is described in
|
|
* {@link http://content.gpwiki.org/index.php/D3DBook:High-Dynamic_Range_Rendering#Luminance_Transform|Luminance Transform}
|
|
* </p>
|
|
*
|
|
* @name czm_XYZToRGB
|
|
* @glslFunction
|
|
*
|
|
* @param {vec3} Yxy The color in CIE Yxy.
|
|
*
|
|
* @returns {vec3} The color in RGB.
|
|
*
|
|
* @example
|
|
* vec3 xyz = czm_RGBToXYZ(rgb);
|
|
* xyz.x = max(xyz.x - luminanceThreshold, 0.0);
|
|
* rgb = czm_XYZToRGB(xyz);
|
|
*/
|
|
vec3 czm_XYZToRGB(vec3 Yxy)
|
|
{
|
|
const mat3 XYZ2RGB = mat3( 3.2405, -0.9693, 0.0556,
|
|
-1.5371, 1.8760, -0.2040,
|
|
-0.4985, 0.0416, 1.0572);
|
|
vec3 xyz;
|
|
xyz.r = Yxy.r * Yxy.g / Yxy.b;
|
|
xyz.g = Yxy.r;
|
|
xyz.b = Yxy.r * (1.0 - Yxy.g - Yxy.b) / Yxy.b;
|
|
|
|
return XYZ2RGB * xyz;
|
|
}
|
|
`,gQ=`// See:
|
|
// https://knarkowicz.wordpress.com/2016/01/06/aces-filmic-tone-mapping-curve/
|
|
|
|
vec3 czm_acesTonemapping(vec3 color) {
|
|
float g = 0.985;
|
|
float a = 0.065;
|
|
float b = 0.0001;
|
|
float c = 0.433;
|
|
float d = 0.238;
|
|
|
|
color = (color * (color + a) - b) / (color * (g * color + c) + d);
|
|
|
|
color = clamp(color, 0.0, 1.0);
|
|
|
|
return color;
|
|
}
|
|
`,yQ=`/**
|
|
* @private
|
|
*/
|
|
float czm_alphaWeight(float a)
|
|
{
|
|
float z = (gl_FragCoord.z - czm_viewportTransformation[3][2]) / czm_viewportTransformation[2][2];
|
|
|
|
// See Weighted Blended Order-Independent Transparency for examples of different weighting functions:
|
|
// http://jcgt.org/published/0002/02/09/
|
|
return pow(a + 0.01, 4.0) + max(1e-2, min(3.0 * 1e3, 0.003 / (1e-5 + pow(abs(z) / 200.0, 4.0))));
|
|
}
|
|
`,bQ=`/**
|
|
* Procedural anti-aliasing by blurring two colors that meet at a sharp edge.
|
|
*
|
|
* @name czm_antialias
|
|
* @glslFunction
|
|
*
|
|
* @param {vec4} color1 The color on one side of the edge.
|
|
* @param {vec4} color2 The color on the other side of the edge.
|
|
* @param {vec4} currentcolor The current color, either <code>color1</code> or <code>color2</code>.
|
|
* @param {float} dist The distance to the edge in texture coordinates.
|
|
* @param {float} [fuzzFactor=0.1] Controls the blurriness between the two colors.
|
|
* @returns {vec4} The anti-aliased color.
|
|
*
|
|
* @example
|
|
* // GLSL declarations
|
|
* vec4 czm_antialias(vec4 color1, vec4 color2, vec4 currentColor, float dist, float fuzzFactor);
|
|
* vec4 czm_antialias(vec4 color1, vec4 color2, vec4 currentColor, float dist);
|
|
*
|
|
* // get the color for a material that has a sharp edge at the line y = 0.5 in texture space
|
|
* float dist = abs(textureCoordinates.t - 0.5);
|
|
* vec4 currentColor = mix(bottomColor, topColor, step(0.5, textureCoordinates.t));
|
|
* vec4 color = czm_antialias(bottomColor, topColor, currentColor, dist, 0.1);
|
|
*/
|
|
vec4 czm_antialias(vec4 color1, vec4 color2, vec4 currentColor, float dist, float fuzzFactor)
|
|
{
|
|
float val1 = clamp(dist / fuzzFactor, 0.0, 1.0);
|
|
float val2 = clamp((dist - 0.5) / fuzzFactor, 0.0, 1.0);
|
|
val1 = val1 * (1.0 - val2);
|
|
val1 = val1 * val1 * (3.0 - (2.0 * val1));
|
|
val1 = pow(val1, 0.5); //makes the transition nicer
|
|
|
|
vec4 midColor = (color1 + color2) * 0.5;
|
|
return mix(midColor, currentColor, val1);
|
|
}
|
|
|
|
vec4 czm_antialias(vec4 color1, vec4 color2, vec4 currentColor, float dist)
|
|
{
|
|
return czm_antialias(color1, color2, currentColor, dist, 0.1);
|
|
}
|
|
`,TQ=`/**
|
|
* Apply a HSB color shift to an RGB color.
|
|
*
|
|
* @param {vec3} rgb The color in RGB space.
|
|
* @param {vec3} hsbShift The amount to shift each component. The xyz components correspond to hue, saturation, and brightness. Shifting the hue by +/- 1.0 corresponds to shifting the hue by a full cycle. Saturation and brightness are clamped between 0 and 1 after the adjustment
|
|
* @param {bool} ignoreBlackPixels If true, black pixels will be unchanged. This is necessary in some shaders such as atmosphere-related effects.
|
|
*
|
|
* @return {vec3} The RGB color after shifting in HSB space and clamping saturation and brightness to a valid range.
|
|
*/
|
|
vec3 czm_applyHSBShift(vec3 rgb, vec3 hsbShift, bool ignoreBlackPixels) {
|
|
// Convert rgb color to hsb
|
|
vec3 hsb = czm_RGBToHSB(rgb);
|
|
|
|
// Perform hsb shift
|
|
// Hue cycles around so no clamp is needed.
|
|
hsb.x += hsbShift.x; // hue
|
|
hsb.y = clamp(hsb.y + hsbShift.y, 0.0, 1.0); // saturation
|
|
|
|
// brightness
|
|
//
|
|
// Some shaders such as atmosphere-related effects need to leave black
|
|
// pixels unchanged
|
|
if (ignoreBlackPixels) {
|
|
hsb.z = hsb.z > czm_epsilon7 ? hsb.z + hsbShift.z : 0.0;
|
|
} else {
|
|
hsb.z = hsb.z + hsbShift.z;
|
|
}
|
|
hsb.z = clamp(hsb.z, 0.0, 1.0);
|
|
|
|
// Convert shifted hsb back to rgb
|
|
return czm_HSBToRGB(hsb);
|
|
}
|
|
`,AQ=`/**
|
|
* Approximately computes spherical coordinates given a normal.
|
|
* Uses approximate inverse trigonometry for speed and consistency,
|
|
* since inverse trigonometry can differ from vendor-to-vendor and when compared with the CPU.
|
|
*
|
|
* @name czm_approximateSphericalCoordinates
|
|
* @glslFunction
|
|
*
|
|
* @param {vec3} normal arbitrary-length normal.
|
|
*
|
|
* @returns {vec2} Approximate latitude and longitude spherical coordinates.
|
|
*/
|
|
vec2 czm_approximateSphericalCoordinates(vec3 normal) {
|
|
// Project into plane with vertical for latitude
|
|
float latitudeApproximation = czm_fastApproximateAtan(sqrt(normal.x * normal.x + normal.y * normal.y), normal.z);
|
|
float longitudeApproximation = czm_fastApproximateAtan(normal.x, normal.y);
|
|
return vec2(latitudeApproximation, longitudeApproximation);
|
|
}
|
|
`,xQ=`/**
|
|
* Compute a rational approximation to tanh(x)
|
|
*
|
|
* @param {float} x A real number input
|
|
* @returns {float} An approximation for tanh(x)
|
|
*/
|
|
float czm_approximateTanh(float x) {
|
|
float x2 = x * x;
|
|
return max(-1.0, min(1.0, x * (27.0 + x2) / (27.0 + 9.0 * x2)));
|
|
}
|
|
`,CQ=`/**
|
|
* Determines if the fragment is back facing
|
|
*
|
|
* @name czm_backFacing
|
|
* @glslFunction
|
|
*
|
|
* @returns {bool} <code>true</code> if the fragment is back facing; otherwise, <code>false</code>.
|
|
*/
|
|
bool czm_backFacing()
|
|
{
|
|
// !gl_FrontFacing doesn't work as expected on Mac/Intel so use the more verbose form instead. See https://github.com/CesiumGS/cesium/pull/8494.
|
|
return gl_FrontFacing == false;
|
|
}
|
|
`,EQ=`/**
|
|
* Branchless ternary operator to be used when it's inexpensive to explicitly
|
|
* evaluate both possibilities for a float expression.
|
|
*
|
|
* @name czm_branchFreeTernary
|
|
* @glslFunction
|
|
*
|
|
* @param {bool} comparison A comparison statement
|
|
* @param {float} a Value to return if the comparison is true.
|
|
* @param {float} b Value to return if the comparison is false.
|
|
*
|
|
* @returns {float} equivalent of comparison ? a : b
|
|
*/
|
|
float czm_branchFreeTernary(bool comparison, float a, float b) {
|
|
float useA = float(comparison);
|
|
return a * useA + b * (1.0 - useA);
|
|
}
|
|
|
|
/**
|
|
* Branchless ternary operator to be used when it's inexpensive to explicitly
|
|
* evaluate both possibilities for a vec2 expression.
|
|
*
|
|
* @name czm_branchFreeTernary
|
|
* @glslFunction
|
|
*
|
|
* @param {bool} comparison A comparison statement
|
|
* @param {vec2} a Value to return if the comparison is true.
|
|
* @param {vec2} b Value to return if the comparison is false.
|
|
*
|
|
* @returns {vec2} equivalent of comparison ? a : b
|
|
*/
|
|
vec2 czm_branchFreeTernary(bool comparison, vec2 a, vec2 b) {
|
|
float useA = float(comparison);
|
|
return a * useA + b * (1.0 - useA);
|
|
}
|
|
|
|
/**
|
|
* Branchless ternary operator to be used when it's inexpensive to explicitly
|
|
* evaluate both possibilities for a vec3 expression.
|
|
*
|
|
* @name czm_branchFreeTernary
|
|
* @glslFunction
|
|
*
|
|
* @param {bool} comparison A comparison statement
|
|
* @param {vec3} a Value to return if the comparison is true.
|
|
* @param {vec3} b Value to return if the comparison is false.
|
|
*
|
|
* @returns {vec3} equivalent of comparison ? a : b
|
|
*/
|
|
vec3 czm_branchFreeTernary(bool comparison, vec3 a, vec3 b) {
|
|
float useA = float(comparison);
|
|
return a * useA + b * (1.0 - useA);
|
|
}
|
|
|
|
/**
|
|
* Branchless ternary operator to be used when it's inexpensive to explicitly
|
|
* evaluate both possibilities for a vec4 expression.
|
|
*
|
|
* @name czm_branchFreeTernary
|
|
* @glslFunction
|
|
*
|
|
* @param {bool} comparison A comparison statement
|
|
* @param {vec3} a Value to return if the comparison is true.
|
|
* @param {vec3} b Value to return if the comparison is false.
|
|
*
|
|
* @returns {vec3} equivalent of comparison ? a : b
|
|
*/
|
|
vec4 czm_branchFreeTernary(bool comparison, vec4 a, vec4 b) {
|
|
float useA = float(comparison);
|
|
return a * useA + b * (1.0 - useA);
|
|
}
|
|
`,wQ=`
|
|
vec4 czm_cascadeColor(vec4 weights)
|
|
{
|
|
return vec4(1.0, 0.0, 0.0, 1.0) * weights.x +
|
|
vec4(0.0, 1.0, 0.0, 1.0) * weights.y +
|
|
vec4(0.0, 0.0, 1.0, 1.0) * weights.z +
|
|
vec4(1.0, 0.0, 1.0, 1.0) * weights.w;
|
|
}
|
|
`,SQ=`
|
|
uniform vec4 shadowMap_cascadeDistances;
|
|
|
|
float czm_cascadeDistance(vec4 weights)
|
|
{
|
|
return dot(shadowMap_cascadeDistances, weights);
|
|
}
|
|
`,vQ=`
|
|
uniform mat4 shadowMap_cascadeMatrices[4];
|
|
|
|
mat4 czm_cascadeMatrix(vec4 weights)
|
|
{
|
|
return shadowMap_cascadeMatrices[0] * weights.x +
|
|
shadowMap_cascadeMatrices[1] * weights.y +
|
|
shadowMap_cascadeMatrices[2] * weights.z +
|
|
shadowMap_cascadeMatrices[3] * weights.w;
|
|
}
|
|
`,IQ=`
|
|
uniform vec4 shadowMap_cascadeSplits[2];
|
|
|
|
vec4 czm_cascadeWeights(float depthEye)
|
|
{
|
|
// One component is set to 1.0 and all others set to 0.0.
|
|
vec4 near = step(shadowMap_cascadeSplits[0], vec4(depthEye));
|
|
vec4 far = step(depthEye, shadowMap_cascadeSplits[1]);
|
|
return near * far;
|
|
}
|
|
`,DQ=`float getSignedDistance(vec2 uv, highp sampler2D clippingDistance) {
|
|
float signedDistance = texture(clippingDistance, uv).r;
|
|
return (signedDistance - 0.5) * 2.0;
|
|
}
|
|
|
|
void czm_clipPolygons(highp sampler2D clippingDistance, int extentsLength, vec2 clippingPosition, int regionIndex) {
|
|
// Position is completely outside of polygons bounds
|
|
vec2 rectUv = clippingPosition;
|
|
if (regionIndex < 0 || rectUv.x <= 0.0 || rectUv.y <= 0.0 || rectUv.x >= 1.0 || rectUv.y >= 1.0) {
|
|
#ifdef CLIPPING_INVERSE
|
|
discard;
|
|
#endif
|
|
return;
|
|
}
|
|
|
|
vec2 clippingDistanceTextureDimensions = vec2(textureSize(clippingDistance, 0));
|
|
vec2 sampleOffset = max(1.0 / clippingDistanceTextureDimensions, vec2(0.005));
|
|
float dimension = float(extentsLength);
|
|
if (extentsLength > 2) {
|
|
dimension = ceil(log2(float(extentsLength)));
|
|
}
|
|
|
|
vec2 textureOffset = vec2(mod(float(regionIndex), dimension), floor(float(regionIndex) / dimension)) / dimension;
|
|
vec2 uv = textureOffset + rectUv / dimension;
|
|
|
|
float signedDistance = getSignedDistance(uv, clippingDistance);
|
|
|
|
#ifdef CLIPPING_INVERSE
|
|
if (signedDistance > 0.0) {
|
|
discard;
|
|
}
|
|
#else
|
|
if (signedDistance < 0.0) {
|
|
discard;
|
|
}
|
|
#endif
|
|
}
|
|
`,PQ=`/**
|
|
* DOC_TBA
|
|
*
|
|
* @name czm_columbusViewMorph
|
|
* @glslFunction
|
|
*/
|
|
vec4 czm_columbusViewMorph(vec4 position2D, vec4 position3D, float time)
|
|
{
|
|
// Just linear for now.
|
|
vec3 p = mix(position2D.xyz, position3D.xyz, time);
|
|
return vec4(p, 1.0);
|
|
}
|
|
`,OQ=`/**
|
|
* Compute the atmosphere color, applying Rayleigh and Mie scattering. This
|
|
* builtin uses automatic uniforms so the atmophere settings are synced with the
|
|
* state of the Scene, even in other contexts like Model.
|
|
*
|
|
* @name czm_computeAtmosphereColor
|
|
* @glslFunction
|
|
*
|
|
* @param {vec3} positionWC Position of the fragment in world coords (low precision)
|
|
* @param {vec3} lightDirection Light direction from the sun or other light source.
|
|
* @param {vec3} rayleighColor The Rayleigh scattering color computed by a scattering function
|
|
* @param {vec3} mieColor The Mie scattering color computed by a scattering function
|
|
* @param {float} opacity The opacity computed by a scattering function.
|
|
*/
|
|
vec4 czm_computeAtmosphereColor(
|
|
vec3 positionWC,
|
|
vec3 lightDirection,
|
|
vec3 rayleighColor,
|
|
vec3 mieColor,
|
|
float opacity
|
|
) {
|
|
// Setup the primary ray: from the camera position to the vertex position.
|
|
vec3 cameraToPositionWC = positionWC - czm_viewerPositionWC;
|
|
vec3 cameraToPositionWCDirection = normalize(cameraToPositionWC);
|
|
|
|
float cosAngle = dot(cameraToPositionWCDirection, lightDirection);
|
|
float cosAngleSq = cosAngle * cosAngle;
|
|
|
|
float G = czm_atmosphereMieAnisotropy;
|
|
float GSq = G * G;
|
|
|
|
// The Rayleigh phase function.
|
|
float rayleighPhase = 3.0 / (50.2654824574) * (1.0 + cosAngleSq);
|
|
// The Mie phase function.
|
|
float miePhase = 3.0 / (25.1327412287) * ((1.0 - GSq) * (cosAngleSq + 1.0)) / (pow(1.0 + GSq - 2.0 * cosAngle * G, 1.5) * (2.0 + GSq));
|
|
|
|
// The final color is generated by combining the effects of the Rayleigh and Mie scattering.
|
|
vec3 rayleigh = rayleighPhase * rayleighColor;
|
|
vec3 mie = miePhase * mieColor;
|
|
|
|
vec3 color = (rayleigh + mie) * czm_atmosphereLightIntensity;
|
|
|
|
return vec4(color, opacity);
|
|
}
|
|
`,LQ=`/**
|
|
* Compute atmosphere scattering for the ground atmosphere and fog. This method
|
|
* uses automatic uniforms so it is always synced with the scene settings.
|
|
*
|
|
* @name czm_computeGroundAtmosphereScattering
|
|
* @glslfunction
|
|
*
|
|
* @param {vec3} positionWC The position of the fragment in world coordinates.
|
|
* @param {vec3} lightDirection The direction of the light to calculate the scattering from.
|
|
* @param {vec3} rayleighColor The variable the Rayleigh scattering will be written to.
|
|
* @param {vec3} mieColor The variable the Mie scattering will be written to.
|
|
* @param {float} opacity The variable the transmittance will be written to.
|
|
*/
|
|
void czm_computeGroundAtmosphereScattering(vec3 positionWC, vec3 lightDirection, out vec3 rayleighColor, out vec3 mieColor, out float opacity) {
|
|
vec3 cameraToPositionWC = positionWC - czm_viewerPositionWC;
|
|
vec3 cameraToPositionWCDirection = normalize(cameraToPositionWC);
|
|
czm_ray primaryRay = czm_ray(czm_viewerPositionWC, cameraToPositionWCDirection);
|
|
|
|
float atmosphereInnerRadius = length(positionWC);
|
|
|
|
czm_computeScattering(
|
|
primaryRay,
|
|
length(cameraToPositionWC),
|
|
lightDirection,
|
|
atmosphereInnerRadius,
|
|
rayleighColor,
|
|
mieColor,
|
|
opacity
|
|
);
|
|
}
|
|
`,RQ=`/**
|
|
* Returns a position in model coordinates relative to eye taking into
|
|
* account the current scene mode: 3D, 2D, or Columbus view.
|
|
* <p>
|
|
* This uses standard position attributes, <code>position3DHigh</code>,
|
|
* <code>position3DLow</code>, <code>position2DHigh</code>, and <code>position2DLow</code>,
|
|
* and should be used when writing a vertex shader for an {@link Appearance}.
|
|
* </p>
|
|
*
|
|
* @name czm_computePosition
|
|
* @glslFunction
|
|
*
|
|
* @returns {vec4} The position relative to eye.
|
|
*
|
|
* @example
|
|
* vec4 p = czm_computePosition();
|
|
* v_positionEC = (czm_modelViewRelativeToEye * p).xyz;
|
|
* gl_Position = czm_modelViewProjectionRelativeToEye * p;
|
|
*
|
|
* @see czm_translateRelativeToEye
|
|
*/
|
|
vec4 czm_computePosition();
|
|
`,NQ=`/**
|
|
* This function computes the colors contributed by Rayliegh and Mie scattering on a given ray, as well as
|
|
* the transmittance value for the ray. This function uses automatic uniforms
|
|
* so the atmosphere settings are always synced with the current scene.
|
|
*
|
|
* @name czm_computeScattering
|
|
* @glslfunction
|
|
*
|
|
* @param {czm_ray} primaryRay The ray from the camera to the position.
|
|
* @param {float} primaryRayLength The length of the primary ray.
|
|
* @param {vec3} lightDirection The direction of the light to calculate the scattering from.
|
|
* @param {vec3} rayleighColor The variable the Rayleigh scattering will be written to.
|
|
* @param {vec3} mieColor The variable the Mie scattering will be written to.
|
|
* @param {float} opacity The variable the transmittance will be written to.
|
|
*/
|
|
void czm_computeScattering(
|
|
czm_ray primaryRay,
|
|
float primaryRayLength,
|
|
vec3 lightDirection,
|
|
float atmosphereInnerRadius,
|
|
out vec3 rayleighColor,
|
|
out vec3 mieColor,
|
|
out float opacity
|
|
) {
|
|
const float ATMOSPHERE_THICKNESS = 111e3; // The thickness of the atmosphere in meters.
|
|
const int PRIMARY_STEPS_MAX = 16; // Maximum number of times the ray from the camera to the world position (primary ray) is sampled.
|
|
const int LIGHT_STEPS_MAX = 4; // Maximum number of times the light is sampled from the light source's intersection with the atmosphere to a sample position on the primary ray.
|
|
|
|
// Initialize the default scattering amounts to 0.
|
|
rayleighColor = vec3(0.0);
|
|
mieColor = vec3(0.0);
|
|
opacity = 0.0;
|
|
|
|
float atmosphereOuterRadius = atmosphereInnerRadius + ATMOSPHERE_THICKNESS;
|
|
|
|
vec3 origin = vec3(0.0);
|
|
|
|
// Calculate intersection from the camera to the outer ring of the atmosphere.
|
|
czm_raySegment primaryRayAtmosphereIntersect = czm_raySphereIntersectionInterval(primaryRay, origin, atmosphereOuterRadius);
|
|
|
|
// Return empty colors if no intersection with the atmosphere geometry.
|
|
if (primaryRayAtmosphereIntersect == czm_emptyRaySegment) {
|
|
rayleighColor = vec3(1.0, 0.0, 1.0);
|
|
return;
|
|
}
|
|
|
|
// To deal with smaller values of PRIMARY_STEPS (e.g. 4)
|
|
// we implement a split strategy: sky or horizon.
|
|
// For performance reasons, instead of a if/else branch
|
|
// a soft choice is implemented through a weight 0.0 <= w_stop_gt_lprl <= 1.0
|
|
float x = 1e-7 * primaryRayAtmosphereIntersect.stop / length(primaryRayLength);
|
|
// Value close to 0.0: close to the horizon
|
|
// Value close to 1.0: above in the sky
|
|
float w_stop_gt_lprl = 0.5 * (1.0 + czm_approximateTanh(x));
|
|
|
|
// The ray should start from the first intersection with the outer atmopshere, or from the camera position, if it is inside the atmosphere.
|
|
float start_0 = primaryRayAtmosphereIntersect.start;
|
|
primaryRayAtmosphereIntersect.start = max(primaryRayAtmosphereIntersect.start, 0.0);
|
|
// The ray should end at the exit from the atmosphere or at the distance to the vertex, whichever is smaller.
|
|
primaryRayAtmosphereIntersect.stop = min(primaryRayAtmosphereIntersect.stop, length(primaryRayLength));
|
|
|
|
// For the number of ray steps, distinguish inside or outside atmosphere (outer space)
|
|
// (1) from outer space we have to use more ray steps to get a realistic rendering
|
|
// (2) within atmosphere we need fewer steps for faster rendering
|
|
float x_o_a = start_0 - ATMOSPHERE_THICKNESS; // ATMOSPHERE_THICKNESS used as an ad-hoc constant, no precise meaning here, only the order of magnitude matters
|
|
float w_inside_atmosphere = 1.0 - 0.5 * (1.0 + czm_approximateTanh(x_o_a));
|
|
int PRIMARY_STEPS = PRIMARY_STEPS_MAX - int(w_inside_atmosphere * 12.0); // Number of times the ray from the camera to the world position (primary ray) is sampled.
|
|
int LIGHT_STEPS = LIGHT_STEPS_MAX - int(w_inside_atmosphere * 2.0); // Number of times the light is sampled from the light source's intersection with the atmosphere to a sample position on the primary ray.
|
|
|
|
// Setup for sampling positions along the ray - starting from the intersection with the outer ring of the atmosphere.
|
|
float rayPositionLength = primaryRayAtmosphereIntersect.start;
|
|
// (1) Outside the atmosphere: constant rayStepLength
|
|
// (2) Inside atmosphere: variable rayStepLength to compensate the rough rendering of the smaller number of ray steps
|
|
float totalRayLength = primaryRayAtmosphereIntersect.stop - rayPositionLength;
|
|
float rayStepLengthIncrease = w_inside_atmosphere * ((1.0 - w_stop_gt_lprl) * totalRayLength / (float(PRIMARY_STEPS * (PRIMARY_STEPS + 1)) / 2.0));
|
|
float rayStepLength = max(1.0 - w_inside_atmosphere, w_stop_gt_lprl) * totalRayLength / max(7.0 * w_inside_atmosphere, float(PRIMARY_STEPS));
|
|
|
|
vec3 rayleighAccumulation = vec3(0.0);
|
|
vec3 mieAccumulation = vec3(0.0);
|
|
vec2 opticalDepth = vec2(0.0);
|
|
vec2 heightScale = vec2(czm_atmosphereRayleighScaleHeight, czm_atmosphereMieScaleHeight);
|
|
|
|
// Sample positions on the primary ray.
|
|
for (int i = 0; i < PRIMARY_STEPS_MAX; ++i) {
|
|
|
|
// The loop should be: for (int i = 0; i < PRIMARY_STEPS; ++i) {...} but WebGL1 cannot
|
|
// loop with non-constant condition, so it has to break early instead
|
|
if (i >= PRIMARY_STEPS) {
|
|
break;
|
|
}
|
|
|
|
// Calculate sample position along viewpoint ray.
|
|
vec3 samplePosition = primaryRay.origin + primaryRay.direction * (rayPositionLength + rayStepLength);
|
|
|
|
// Calculate height of sample position above ellipsoid.
|
|
float sampleHeight = length(samplePosition) - atmosphereInnerRadius;
|
|
|
|
// Calculate and accumulate density of particles at the sample position.
|
|
vec2 sampleDensity = exp(-sampleHeight / heightScale) * rayStepLength;
|
|
opticalDepth += sampleDensity;
|
|
|
|
// Generate ray from the sample position segment to the light source, up to the outer ring of the atmosphere.
|
|
czm_ray lightRay = czm_ray(samplePosition, lightDirection);
|
|
czm_raySegment lightRayAtmosphereIntersect = czm_raySphereIntersectionInterval(lightRay, origin, atmosphereOuterRadius);
|
|
|
|
float lightStepLength = lightRayAtmosphereIntersect.stop / float(LIGHT_STEPS);
|
|
float lightPositionLength = 0.0;
|
|
|
|
vec2 lightOpticalDepth = vec2(0.0);
|
|
|
|
// Sample positions along the light ray, to accumulate incidence of light on the latest sample segment.
|
|
for (int j = 0; j < LIGHT_STEPS_MAX; ++j) {
|
|
|
|
// The loop should be: for (int j = 0; i < LIGHT_STEPS; ++j) {...} but WebGL1 cannot
|
|
// loop with non-constant condition, so it has to break early instead
|
|
if (j >= LIGHT_STEPS) {
|
|
break;
|
|
}
|
|
|
|
// Calculate sample position along light ray.
|
|
vec3 lightPosition = samplePosition + lightDirection * (lightPositionLength + lightStepLength * 0.5);
|
|
|
|
// Calculate height of the light sample position above ellipsoid.
|
|
float lightHeight = length(lightPosition) - atmosphereInnerRadius;
|
|
|
|
// Calculate density of photons at the light sample position.
|
|
lightOpticalDepth += exp(-lightHeight / heightScale) * lightStepLength;
|
|
|
|
// Increment distance on light ray.
|
|
lightPositionLength += lightStepLength;
|
|
}
|
|
|
|
// Compute attenuation via the primary ray and the light ray.
|
|
vec3 attenuation = exp(-((czm_atmosphereMieCoefficient * (opticalDepth.y + lightOpticalDepth.y)) + (czm_atmosphereRayleighCoefficient * (opticalDepth.x + lightOpticalDepth.x))));
|
|
|
|
// Accumulate the scattering.
|
|
rayleighAccumulation += sampleDensity.x * attenuation;
|
|
mieAccumulation += sampleDensity.y * attenuation;
|
|
|
|
// Increment distance on primary ray.
|
|
rayPositionLength += (rayStepLength += rayStepLengthIncrease);
|
|
}
|
|
|
|
// Compute the scattering amount.
|
|
rayleighColor = czm_atmosphereRayleighCoefficient * rayleighAccumulation;
|
|
mieColor = czm_atmosphereMieCoefficient * mieAccumulation;
|
|
|
|
// Compute the transmittance i.e. how much light is passing through the atmosphere.
|
|
opacity = length(exp(-((czm_atmosphereMieCoefficient * opticalDepth.y) + (czm_atmosphereRayleighCoefficient * opticalDepth.x))));
|
|
}
|
|
`,MQ=`/**
|
|
* @private
|
|
*/
|
|
vec2 cordic(float angle)
|
|
{
|
|
// Scale the vector by the appropriate factor for the 24 iterations to follow.
|
|
vec2 vector = vec2(6.0725293500888267e-1, 0.0);
|
|
// Iteration 1
|
|
float sense = (angle < 0.0) ? -1.0 : 1.0;
|
|
// float factor = sense * 1.0; // 2^-0
|
|
mat2 rotation = mat2(1.0, sense, -sense, 1.0);
|
|
vector = rotation * vector;
|
|
angle -= sense * 7.8539816339744828e-1; // atan(2^-0)
|
|
// Iteration 2
|
|
sense = (angle < 0.0) ? -1.0 : 1.0;
|
|
float factor = sense * 5.0e-1; // 2^-1
|
|
rotation[0][1] = factor;
|
|
rotation[1][0] = -factor;
|
|
vector = rotation * vector;
|
|
angle -= sense * 4.6364760900080609e-1; // atan(2^-1)
|
|
// Iteration 3
|
|
sense = (angle < 0.0) ? -1.0 : 1.0;
|
|
factor = sense * 2.5e-1; // 2^-2
|
|
rotation[0][1] = factor;
|
|
rotation[1][0] = -factor;
|
|
vector = rotation * vector;
|
|
angle -= sense * 2.4497866312686414e-1; // atan(2^-2)
|
|
// Iteration 4
|
|
sense = (angle < 0.0) ? -1.0 : 1.0;
|
|
factor = sense * 1.25e-1; // 2^-3
|
|
rotation[0][1] = factor;
|
|
rotation[1][0] = -factor;
|
|
vector = rotation * vector;
|
|
angle -= sense * 1.2435499454676144e-1; // atan(2^-3)
|
|
// Iteration 5
|
|
sense = (angle < 0.0) ? -1.0 : 1.0;
|
|
factor = sense * 6.25e-2; // 2^-4
|
|
rotation[0][1] = factor;
|
|
rotation[1][0] = -factor;
|
|
vector = rotation * vector;
|
|
angle -= sense * 6.2418809995957350e-2; // atan(2^-4)
|
|
// Iteration 6
|
|
sense = (angle < 0.0) ? -1.0 : 1.0;
|
|
factor = sense * 3.125e-2; // 2^-5
|
|
rotation[0][1] = factor;
|
|
rotation[1][0] = -factor;
|
|
vector = rotation * vector;
|
|
angle -= sense * 3.1239833430268277e-2; // atan(2^-5)
|
|
// Iteration 7
|
|
sense = (angle < 0.0) ? -1.0 : 1.0;
|
|
factor = sense * 1.5625e-2; // 2^-6
|
|
rotation[0][1] = factor;
|
|
rotation[1][0] = -factor;
|
|
vector = rotation * vector;
|
|
angle -= sense * 1.5623728620476831e-2; // atan(2^-6)
|
|
// Iteration 8
|
|
sense = (angle < 0.0) ? -1.0 : 1.0;
|
|
factor = sense * 7.8125e-3; // 2^-7
|
|
rotation[0][1] = factor;
|
|
rotation[1][0] = -factor;
|
|
vector = rotation * vector;
|
|
angle -= sense * 7.8123410601011111e-3; // atan(2^-7)
|
|
// Iteration 9
|
|
sense = (angle < 0.0) ? -1.0 : 1.0;
|
|
factor = sense * 3.90625e-3; // 2^-8
|
|
rotation[0][1] = factor;
|
|
rotation[1][0] = -factor;
|
|
vector = rotation * vector;
|
|
angle -= sense * 3.9062301319669718e-3; // atan(2^-8)
|
|
// Iteration 10
|
|
sense = (angle < 0.0) ? -1.0 : 1.0;
|
|
factor = sense * 1.953125e-3; // 2^-9
|
|
rotation[0][1] = factor;
|
|
rotation[1][0] = -factor;
|
|
vector = rotation * vector;
|
|
angle -= sense * 1.9531225164788188e-3; // atan(2^-9)
|
|
// Iteration 11
|
|
sense = (angle < 0.0) ? -1.0 : 1.0;
|
|
factor = sense * 9.765625e-4; // 2^-10
|
|
rotation[0][1] = factor;
|
|
rotation[1][0] = -factor;
|
|
vector = rotation * vector;
|
|
angle -= sense * 9.7656218955931946e-4; // atan(2^-10)
|
|
// Iteration 12
|
|
sense = (angle < 0.0) ? -1.0 : 1.0;
|
|
factor = sense * 4.8828125e-4; // 2^-11
|
|
rotation[0][1] = factor;
|
|
rotation[1][0] = -factor;
|
|
vector = rotation * vector;
|
|
angle -= sense * 4.8828121119489829e-4; // atan(2^-11)
|
|
// Iteration 13
|
|
sense = (angle < 0.0) ? -1.0 : 1.0;
|
|
factor = sense * 2.44140625e-4; // 2^-12
|
|
rotation[0][1] = factor;
|
|
rotation[1][0] = -factor;
|
|
vector = rotation * vector;
|
|
angle -= sense * 2.4414062014936177e-4; // atan(2^-12)
|
|
// Iteration 14
|
|
sense = (angle < 0.0) ? -1.0 : 1.0;
|
|
factor = sense * 1.220703125e-4; // 2^-13
|
|
rotation[0][1] = factor;
|
|
rotation[1][0] = -factor;
|
|
vector = rotation * vector;
|
|
angle -= sense * 1.2207031189367021e-4; // atan(2^-13)
|
|
// Iteration 15
|
|
sense = (angle < 0.0) ? -1.0 : 1.0;
|
|
factor = sense * 6.103515625e-5; // 2^-14
|
|
rotation[0][1] = factor;
|
|
rotation[1][0] = -factor;
|
|
vector = rotation * vector;
|
|
angle -= sense * 6.1035156174208773e-5; // atan(2^-14)
|
|
// Iteration 16
|
|
sense = (angle < 0.0) ? -1.0 : 1.0;
|
|
factor = sense * 3.0517578125e-5; // 2^-15
|
|
rotation[0][1] = factor;
|
|
rotation[1][0] = -factor;
|
|
vector = rotation * vector;
|
|
angle -= sense * 3.0517578115526096e-5; // atan(2^-15)
|
|
// Iteration 17
|
|
sense = (angle < 0.0) ? -1.0 : 1.0;
|
|
factor = sense * 1.52587890625e-5; // 2^-16
|
|
rotation[0][1] = factor;
|
|
rotation[1][0] = -factor;
|
|
vector = rotation * vector;
|
|
angle -= sense * 1.5258789061315762e-5; // atan(2^-16)
|
|
// Iteration 18
|
|
sense = (angle < 0.0) ? -1.0 : 1.0;
|
|
factor = sense * 7.62939453125e-6; // 2^-17
|
|
rotation[0][1] = factor;
|
|
rotation[1][0] = -factor;
|
|
vector = rotation * vector;
|
|
angle -= sense * 7.6293945311019700e-6; // atan(2^-17)
|
|
// Iteration 19
|
|
sense = (angle < 0.0) ? -1.0 : 1.0;
|
|
factor = sense * 3.814697265625e-6; // 2^-18
|
|
rotation[0][1] = factor;
|
|
rotation[1][0] = -factor;
|
|
vector = rotation * vector;
|
|
angle -= sense * 3.8146972656064961e-6; // atan(2^-18)
|
|
// Iteration 20
|
|
sense = (angle < 0.0) ? -1.0 : 1.0;
|
|
factor = sense * 1.9073486328125e-6; // 2^-19
|
|
rotation[0][1] = factor;
|
|
rotation[1][0] = -factor;
|
|
vector = rotation * vector;
|
|
angle -= sense * 1.9073486328101870e-6; // atan(2^-19)
|
|
// Iteration 21
|
|
sense = (angle < 0.0) ? -1.0 : 1.0;
|
|
factor = sense * 9.5367431640625e-7; // 2^-20
|
|
rotation[0][1] = factor;
|
|
rotation[1][0] = -factor;
|
|
vector = rotation * vector;
|
|
angle -= sense * 9.5367431640596084e-7; // atan(2^-20)
|
|
// Iteration 22
|
|
sense = (angle < 0.0) ? -1.0 : 1.0;
|
|
factor = sense * 4.76837158203125e-7; // 2^-21
|
|
rotation[0][1] = factor;
|
|
rotation[1][0] = -factor;
|
|
vector = rotation * vector;
|
|
angle -= sense * 4.7683715820308884e-7; // atan(2^-21)
|
|
// Iteration 23
|
|
sense = (angle < 0.0) ? -1.0 : 1.0;
|
|
factor = sense * 2.384185791015625e-7; // 2^-22
|
|
rotation[0][1] = factor;
|
|
rotation[1][0] = -factor;
|
|
vector = rotation * vector;
|
|
angle -= sense * 2.3841857910155797e-7; // atan(2^-22)
|
|
// Iteration 24
|
|
sense = (angle < 0.0) ? -1.0 : 1.0;
|
|
factor = sense * 1.1920928955078125e-7; // 2^-23
|
|
rotation[0][1] = factor;
|
|
rotation[1][0] = -factor;
|
|
vector = rotation * vector;
|
|
// angle -= sense * 1.1920928955078068e-7; // atan(2^-23)
|
|
|
|
return vector;
|
|
}
|
|
|
|
/**
|
|
* Computes the cosine and sine of the provided angle using the CORDIC algorithm.
|
|
*
|
|
* @name czm_cosineAndSine
|
|
* @glslFunction
|
|
*
|
|
* @param {float} angle The angle in radians.
|
|
*
|
|
* @returns {vec2} The resulting cosine of the angle (as the x coordinate) and sine of the angle (as the y coordinate).
|
|
*
|
|
* @example
|
|
* vec2 v = czm_cosineAndSine(czm_piOverSix);
|
|
* float cosine = v.x;
|
|
* float sine = v.y;
|
|
*/
|
|
vec2 czm_cosineAndSine(float angle)
|
|
{
|
|
if (angle < -czm_piOverTwo || angle > czm_piOverTwo)
|
|
{
|
|
if (angle < 0.0)
|
|
{
|
|
return -cordic(angle + czm_pi);
|
|
}
|
|
else
|
|
{
|
|
return -cordic(angle - czm_pi);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
return cordic(angle);
|
|
}
|
|
}
|
|
`,FQ=`/**
|
|
* Decompresses texture coordinates that were packed into a single float.
|
|
*
|
|
* @name czm_decompressTextureCoordinates
|
|
* @glslFunction
|
|
*
|
|
* @param {float} encoded The compressed texture coordinates.
|
|
* @returns {vec2} The decompressed texture coordinates.
|
|
*/
|
|
vec2 czm_decompressTextureCoordinates(float encoded)
|
|
{
|
|
float temp = encoded / 4096.0;
|
|
float xZeroTo4095 = floor(temp);
|
|
float stx = xZeroTo4095 / 4095.0;
|
|
float sty = (encoded - xZeroTo4095 * 4096.0) / 4095.0;
|
|
return vec2(stx, sty);
|
|
}
|
|
`,BQ=`/**
|
|
* Get default parameters for physically based rendering. These defaults
|
|
* describe a rough dielectric (non-metal) surface (e.g. rough plastic).
|
|
*
|
|
* @return {czm_pbrParameters} Default parameters for {@link czm_pbrLighting}
|
|
*/
|
|
czm_pbrParameters czm_defaultPbrMaterial()
|
|
{
|
|
czm_pbrParameters results;
|
|
results.diffuseColor = vec3(1.0);
|
|
results.roughness = 1.0;
|
|
|
|
const vec3 REFLECTANCE_DIELECTRIC = vec3(0.04);
|
|
results.f0 = REFLECTANCE_DIELECTRIC;
|
|
return results;
|
|
}
|
|
`,zQ=`// emulated noperspective
|
|
#if (__VERSION__ == 300 || defined(GL_EXT_frag_depth)) && !defined(LOG_DEPTH)
|
|
out float v_WindowZ;
|
|
#endif
|
|
|
|
/**
|
|
* Emulates GL_DEPTH_CLAMP, which is not available in WebGL 1 or 2.
|
|
* GL_DEPTH_CLAMP clamps geometry that is outside the near and far planes,
|
|
* capping the shadow volume. More information here:
|
|
* https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_depth_clamp.txt.
|
|
*
|
|
* When GL_EXT_frag_depth is available we emulate GL_DEPTH_CLAMP by ensuring
|
|
* no geometry gets clipped by setting the clip space z value to 0.0 and then
|
|
* sending the unaltered screen space z value (using emulated noperspective
|
|
* interpolation) to the frag shader where it is clamped to [0,1] and then
|
|
* written with gl_FragDepth (see czm_writeDepthClamp). This technique is based on:
|
|
* https://stackoverflow.com/questions/5960757/how-to-emulate-gl-depth-clamp-nv.
|
|
*
|
|
* When GL_EXT_frag_depth is not available, which is the case on some mobile
|
|
* devices, we must attempt to fix this only in the vertex shader.
|
|
* The approach is to clamp the z value to the far plane, which closes the
|
|
* shadow volume but also distorts the geometry, so there can still be artifacts
|
|
* on frustum seams.
|
|
*
|
|
* @name czm_depthClamp
|
|
* @glslFunction
|
|
*
|
|
* @param {vec4} coords The vertex in clip coordinates.
|
|
* @returns {vec4} The modified vertex.
|
|
*
|
|
* @example
|
|
* gl_Position = czm_depthClamp(czm_modelViewProjection * vec4(position, 1.0));
|
|
*
|
|
* @see czm_writeDepthClamp
|
|
*/
|
|
vec4 czm_depthClamp(vec4 coords)
|
|
{
|
|
#ifndef LOG_DEPTH
|
|
#if __VERSION__ == 300 || defined(GL_EXT_frag_depth)
|
|
v_WindowZ = (0.5 * (coords.z / coords.w) + 0.5) * coords.w;
|
|
coords.z = 0.0;
|
|
#else
|
|
coords.z = min(coords.z, coords.w);
|
|
#endif
|
|
#endif
|
|
return coords;
|
|
}
|
|
`,UQ=`/**
|
|
* Computes a 3x3 rotation matrix that transforms vectors from an ellipsoid's east-north-up coordinate system
|
|
* to eye coordinates. In east-north-up coordinates, x points east, y points north, and z points along the
|
|
* surface normal. East-north-up can be used as an ellipsoid's tangent space for operations such as bump mapping.
|
|
* <br /><br />
|
|
* The ellipsoid is assumed to be centered at the model coordinate's origin.
|
|
*
|
|
* @name czm_eastNorthUpToEyeCoordinates
|
|
* @glslFunction
|
|
*
|
|
* @param {vec3} positionMC The position on the ellipsoid in model coordinates.
|
|
* @param {vec3} normalEC The normalized ellipsoid surface normal, at <code>positionMC</code>, in eye coordinates.
|
|
*
|
|
* @returns {mat3} A 3x3 rotation matrix that transforms vectors from the east-north-up coordinate system to eye coordinates.
|
|
*
|
|
* @example
|
|
* // Transform a vector defined in the east-north-up coordinate
|
|
* // system, (0, 0, 1) which is the surface normal, to eye
|
|
* // coordinates.
|
|
* mat3 m = czm_eastNorthUpToEyeCoordinates(positionMC, normalEC);
|
|
* vec3 normalEC = m * vec3(0.0, 0.0, 1.0);
|
|
*/
|
|
mat3 czm_eastNorthUpToEyeCoordinates(vec3 positionMC, vec3 normalEC)
|
|
{
|
|
vec3 tangentMC = normalize(vec3(-positionMC.y, positionMC.x, 0.0)); // normalized surface tangent in model coordinates
|
|
vec3 tangentEC = normalize(czm_normal3D * tangentMC); // normalized surface tangent in eye coordinates
|
|
vec3 bitangentEC = normalize(cross(normalEC, tangentEC)); // normalized surface bitangent in eye coordinates
|
|
|
|
return mat3(
|
|
tangentEC.x, tangentEC.y, tangentEC.z,
|
|
bitangentEC.x, bitangentEC.y, bitangentEC.z,
|
|
normalEC.x, normalEC.y, normalEC.z);
|
|
}
|
|
`,kQ=`/**
|
|
* DOC_TBA
|
|
*
|
|
* @name czm_ellipsoidContainsPoint
|
|
* @glslFunction
|
|
*
|
|
*/
|
|
bool czm_ellipsoidContainsPoint(vec3 ellipsoid_inverseRadii, vec3 point)
|
|
{
|
|
vec3 scaled = ellipsoid_inverseRadii * (czm_inverseModelView * vec4(point, 1.0)).xyz;
|
|
return (dot(scaled, scaled) <= 1.0);
|
|
}
|
|
`,VQ=`/**
|
|
* DOC_TBA
|
|
*
|
|
* @name czm_ellipsoidWgs84TextureCoordinates
|
|
* @glslFunction
|
|
*/
|
|
vec2 czm_ellipsoidWgs84TextureCoordinates(vec3 normal)
|
|
{
|
|
return vec2(atan(normal.y, normal.x) * czm_oneOverTwoPi + 0.5, asin(normal.z) * czm_oneOverPi + 0.5);
|
|
}
|
|
`,HQ=`/**
|
|
* Compares <code>left</code> and <code>right</code> componentwise. Returns <code>true</code>
|
|
* if they are within <code>epsilon</code> and <code>false</code> otherwise. The inputs
|
|
* <code>left</code> and <code>right</code> can be <code>float</code>s, <code>vec2</code>s,
|
|
* <code>vec3</code>s, or <code>vec4</code>s.
|
|
*
|
|
* @name czm_equalsEpsilon
|
|
* @glslFunction
|
|
*
|
|
* @param {} left The first vector.
|
|
* @param {} right The second vector.
|
|
* @param {float} epsilon The epsilon to use for equality testing.
|
|
* @returns {bool} <code>true</code> if the components are within <code>epsilon</code> and <code>false</code> otherwise.
|
|
*
|
|
* @example
|
|
* // GLSL declarations
|
|
* bool czm_equalsEpsilon(float left, float right, float epsilon);
|
|
* bool czm_equalsEpsilon(vec2 left, vec2 right, float epsilon);
|
|
* bool czm_equalsEpsilon(vec3 left, vec3 right, float epsilon);
|
|
* bool czm_equalsEpsilon(vec4 left, vec4 right, float epsilon);
|
|
*/
|
|
bool czm_equalsEpsilon(vec4 left, vec4 right, float epsilon) {
|
|
return all(lessThanEqual(abs(left - right), vec4(epsilon)));
|
|
}
|
|
|
|
bool czm_equalsEpsilon(vec3 left, vec3 right, float epsilon) {
|
|
return all(lessThanEqual(abs(left - right), vec3(epsilon)));
|
|
}
|
|
|
|
bool czm_equalsEpsilon(vec2 left, vec2 right, float epsilon) {
|
|
return all(lessThanEqual(abs(left - right), vec2(epsilon)));
|
|
}
|
|
|
|
bool czm_equalsEpsilon(float left, float right, float epsilon) {
|
|
return (abs(left - right) <= epsilon);
|
|
}
|
|
`,GQ=`/**
|
|
* DOC_TBA
|
|
*
|
|
* @name czm_eyeOffset
|
|
* @glslFunction
|
|
*
|
|
* @param {vec4} positionEC DOC_TBA.
|
|
* @param {vec3} eyeOffset DOC_TBA.
|
|
*
|
|
* @returns {vec4} DOC_TBA.
|
|
*/
|
|
vec4 czm_eyeOffset(vec4 positionEC, vec3 eyeOffset)
|
|
{
|
|
// This equation is approximate in x and y.
|
|
vec4 p = positionEC;
|
|
vec4 zEyeOffset = normalize(p) * eyeOffset.z;
|
|
p.xy += eyeOffset.xy + zEyeOffset.xy;
|
|
p.z += zEyeOffset.z;
|
|
return p;
|
|
}
|
|
`,jQ=`/**
|
|
* Transforms a position from eye to window coordinates. The transformation
|
|
* from eye to clip coordinates is done using {@link czm_projection}.
|
|
* The transform from normalized device coordinates to window coordinates is
|
|
* done using {@link czm_viewportTransformation}, which assumes a depth range
|
|
* of <code>near = 0</code> and <code>far = 1</code>.
|
|
* <br /><br />
|
|
* This transform is useful when there is a need to manipulate window coordinates
|
|
* in a vertex shader as done by {@link BillboardCollection}.
|
|
*
|
|
* @name czm_eyeToWindowCoordinates
|
|
* @glslFunction
|
|
*
|
|
* @param {vec4} position The position in eye coordinates to transform.
|
|
*
|
|
* @returns {vec4} The transformed position in window coordinates.
|
|
*
|
|
* @see czm_modelToWindowCoordinates
|
|
* @see czm_projection
|
|
* @see czm_viewportTransformation
|
|
* @see BillboardCollection
|
|
*
|
|
* @example
|
|
* vec4 positionWC = czm_eyeToWindowCoordinates(positionEC);
|
|
*/
|
|
vec4 czm_eyeToWindowCoordinates(vec4 positionEC)
|
|
{
|
|
vec4 q = czm_projection * positionEC; // clip coordinates
|
|
q.xyz /= q.w; // normalized device coordinates
|
|
q.xyz = (czm_viewportTransformation * vec4(q.xyz, 1.0)).xyz; // window coordinates
|
|
return q;
|
|
}
|
|
`,WQ=`/**
|
|
* Approxiamtes atan over the range [0, 1]. Safe to flip output for negative input.
|
|
*
|
|
* Based on Michal Drobot's approximation from ShaderFastLibs, which in turn is based on
|
|
* "Efficient approximations for the arctangent function," Rajan, S. Sichun Wang Inkol, R. Joyal, A., May 2006.
|
|
* Adapted from ShaderFastLibs under MIT License.
|
|
*
|
|
* Chosen for the following characteristics over range [0, 1]:
|
|
* - basically no error at 0 and 1, important for getting around range limit (naive atan2 via atan requires infinite range atan)
|
|
* - no visible artifacts from first-derivative discontinuities, unlike latitude via range-reduced sqrt asin approximations (at equator)
|
|
*
|
|
* The original code is x * (-0.1784 * abs(x) - 0.0663 * x * x + 1.0301);
|
|
* Removed the abs() in here because it isn't needed, the input range is guaranteed as [0, 1] by how we're approximating atan2.
|
|
*
|
|
* @name czm_fastApproximateAtan
|
|
* @glslFunction
|
|
*
|
|
* @param {float} x Value between 0 and 1 inclusive.
|
|
*
|
|
* @returns {float} Approximation of atan(x)
|
|
*/
|
|
float czm_fastApproximateAtan(float x) {
|
|
return x * (-0.1784 * x - 0.0663 * x * x + 1.0301);
|
|
}
|
|
|
|
/**
|
|
* Approximation of atan2.
|
|
*
|
|
* Range reduction math based on nvidia's cg reference implementation for atan2: http://developer.download.nvidia.com/cg/atan2.html
|
|
* However, we replaced their atan curve with Michael Drobot's (see above).
|
|
*
|
|
* @name czm_fastApproximateAtan
|
|
* @glslFunction
|
|
*
|
|
* @param {float} x Value between -1 and 1 inclusive.
|
|
* @param {float} y Value between -1 and 1 inclusive.
|
|
*
|
|
* @returns {float} Approximation of atan2(x, y)
|
|
*/
|
|
float czm_fastApproximateAtan(float x, float y) {
|
|
// atan approximations are usually only reliable over [-1, 1], or, in our case, [0, 1] due to modifications.
|
|
// So range-reduce using abs and by flipping whether x or y is on top.
|
|
float t = abs(x); // t used as swap and atan result.
|
|
float opposite = abs(y);
|
|
float adjacent = max(t, opposite);
|
|
opposite = min(t, opposite);
|
|
|
|
t = czm_fastApproximateAtan(opposite / adjacent);
|
|
|
|
// Undo range reduction
|
|
t = czm_branchFreeTernary(abs(y) > abs(x), czm_piOverTwo - t, t);
|
|
t = czm_branchFreeTernary(x < 0.0, czm_pi - t, t);
|
|
t = czm_branchFreeTernary(y < 0.0, -t, t);
|
|
return t;
|
|
}
|
|
`,qQ=`/**
|
|
* Gets the color with fog at a distance from the camera.
|
|
*
|
|
* @name czm_fog
|
|
* @glslFunction
|
|
*
|
|
* @param {float} distanceToCamera The distance to the camera in meters.
|
|
* @param {vec3} color The original color.
|
|
* @param {vec3} fogColor The color of the fog.
|
|
*
|
|
* @returns {vec3} The color adjusted for fog at the distance from the camera.
|
|
*/
|
|
vec3 czm_fog(float distanceToCamera, vec3 color, vec3 fogColor)
|
|
{
|
|
float scalar = distanceToCamera * czm_fogDensity;
|
|
float fog = 1.0 - exp(-(scalar * scalar));
|
|
return mix(color, fogColor, fog);
|
|
}
|
|
|
|
/**
|
|
* Gets the color with fog at a distance from the camera.
|
|
*
|
|
* @name czm_fog
|
|
* @glslFunction
|
|
*
|
|
* @param {float} distanceToCamera The distance to the camera in meters.
|
|
* @param {vec3} color The original color.
|
|
* @param {vec3} fogColor The color of the fog.
|
|
* @param {float} fogModifierConstant A constant to modify the appearance of fog.
|
|
*
|
|
* @returns {vec3} The color adjusted for fog at the distance from the camera.
|
|
*/
|
|
vec3 czm_fog(float distanceToCamera, vec3 color, vec3 fogColor, float fogModifierConstant)
|
|
{
|
|
float scalar = distanceToCamera * czm_fogDensity;
|
|
float fog = 1.0 - exp(-((fogModifierConstant * scalar + fogModifierConstant) * (scalar * (1.0 + fogModifierConstant))));
|
|
return mix(color, fogColor, fog);
|
|
}
|
|
`,YQ=`/**
|
|
* Converts a color from RGB space to linear space.
|
|
*
|
|
* @name czm_gammaCorrect
|
|
* @glslFunction
|
|
*
|
|
* @param {vec3} color The color in RGB space.
|
|
* @returns {vec3} The color in linear space.
|
|
*/
|
|
vec3 czm_gammaCorrect(vec3 color) {
|
|
#ifdef HDR
|
|
color = pow(color, vec3(czm_gamma));
|
|
#endif
|
|
return color;
|
|
}
|
|
|
|
vec4 czm_gammaCorrect(vec4 color) {
|
|
#ifdef HDR
|
|
color.rgb = pow(color.rgb, vec3(czm_gamma));
|
|
#endif
|
|
return color;
|
|
}
|
|
`,$Q=`/**
|
|
* DOC_TBA
|
|
*
|
|
* @name czm_geodeticSurfaceNormal
|
|
* @glslFunction
|
|
*
|
|
* @param {vec3} positionOnEllipsoid DOC_TBA
|
|
* @param {vec3} ellipsoidCenter DOC_TBA
|
|
* @param {vec3} oneOverEllipsoidRadiiSquared DOC_TBA
|
|
*
|
|
* @returns {vec3} DOC_TBA.
|
|
*/
|
|
vec3 czm_geodeticSurfaceNormal(vec3 positionOnEllipsoid, vec3 ellipsoidCenter, vec3 oneOverEllipsoidRadiiSquared)
|
|
{
|
|
return normalize((positionOnEllipsoid - ellipsoidCenter) * oneOverEllipsoidRadiiSquared);
|
|
}
|
|
`,XQ=`/**
|
|
* An czm_material with default values. Every material's czm_getMaterial
|
|
* should use this default material as a base for the material it returns.
|
|
* The default normal value is given by materialInput.normalEC.
|
|
*
|
|
* @name czm_getDefaultMaterial
|
|
* @glslFunction
|
|
*
|
|
* @param {czm_materialInput} input The input used to construct the default material.
|
|
*
|
|
* @returns {czm_material} The default material.
|
|
*
|
|
* @see czm_materialInput
|
|
* @see czm_material
|
|
* @see czm_getMaterial
|
|
*/
|
|
czm_material czm_getDefaultMaterial(czm_materialInput materialInput)
|
|
{
|
|
czm_material material;
|
|
material.diffuse = vec3(0.0);
|
|
material.specular = 0.0;
|
|
material.shininess = 1.0;
|
|
material.normal = materialInput.normalEC;
|
|
material.emission = vec3(0.0);
|
|
material.alpha = 1.0;
|
|
return material;
|
|
}
|
|
`,QQ=`/**
|
|
* Select which direction vector to use for dynamic atmosphere lighting based on an enum value
|
|
*
|
|
* @name czm_getDynamicAtmosphereLightDirection
|
|
* @glslfunction
|
|
* @see DynamicAtmosphereLightingType.js
|
|
*
|
|
* @param {vec3} positionWC the position of the vertex/fragment in world coordinates. This is normalized and returned when dynamic lighting is turned off.
|
|
* @param {float} lightEnum The enum value for selecting between light sources.
|
|
* @return {vec3} The normalized light direction vector. Depending on the enum value, it is either positionWC, czm_lightDirectionWC or czm_sunDirectionWC
|
|
*/
|
|
vec3 czm_getDynamicAtmosphereLightDirection(vec3 positionWC, float lightEnum) {
|
|
const float NONE = 0.0;
|
|
const float SCENE_LIGHT = 1.0;
|
|
const float SUNLIGHT = 2.0;
|
|
|
|
vec3 lightDirection =
|
|
positionWC * float(lightEnum == NONE) +
|
|
czm_lightDirectionWC * float(lightEnum == SCENE_LIGHT) +
|
|
czm_sunDirectionWC * float(lightEnum == SUNLIGHT);
|
|
return normalize(lightDirection);
|
|
}
|
|
`,KQ=`/**
|
|
* Calculates the intensity of diffusely reflected light.
|
|
*
|
|
* @name czm_getLambertDiffuse
|
|
* @glslFunction
|
|
*
|
|
* @param {vec3} lightDirectionEC Unit vector pointing to the light source in eye coordinates.
|
|
* @param {vec3} normalEC The surface normal in eye coordinates.
|
|
*
|
|
* @returns {float} The intensity of the diffuse reflection.
|
|
*
|
|
* @see czm_phong
|
|
*
|
|
* @example
|
|
* float diffuseIntensity = czm_getLambertDiffuse(lightDirectionEC, normalEC);
|
|
* float specularIntensity = czm_getSpecular(lightDirectionEC, toEyeEC, normalEC, 200);
|
|
* vec3 color = (diffuseColor * diffuseIntensity) + (specularColor * specularIntensity);
|
|
*/
|
|
float czm_getLambertDiffuse(vec3 lightDirectionEC, vec3 normalEC)
|
|
{
|
|
return max(dot(lightDirectionEC, normalEC), 0.0);
|
|
}
|
|
`,ZQ=`/**
|
|
* Calculates the specular intensity of reflected light.
|
|
*
|
|
* @name czm_getSpecular
|
|
* @glslFunction
|
|
*
|
|
* @param {vec3} lightDirectionEC Unit vector pointing to the light source in eye coordinates.
|
|
* @param {vec3} toEyeEC Unit vector pointing to the eye position in eye coordinates.
|
|
* @param {vec3} normalEC The surface normal in eye coordinates.
|
|
* @param {float} shininess The sharpness of the specular reflection. Higher values create a smaller, more focused specular highlight.
|
|
*
|
|
* @returns {float} The intensity of the specular highlight.
|
|
*
|
|
* @see czm_phong
|
|
*
|
|
* @example
|
|
* float diffuseIntensity = czm_getLambertDiffuse(lightDirectionEC, normalEC);
|
|
* float specularIntensity = czm_getSpecular(lightDirectionEC, toEyeEC, normalEC, 200);
|
|
* vec3 color = (diffuseColor * diffuseIntensity) + (specularColor * specularIntensity);
|
|
*/
|
|
float czm_getSpecular(vec3 lightDirectionEC, vec3 toEyeEC, vec3 normalEC, float shininess)
|
|
{
|
|
vec3 toReflectedLight = reflect(-lightDirectionEC, normalEC);
|
|
float specular = max(dot(toReflectedLight, toEyeEC), 0.0);
|
|
|
|
// pow has undefined behavior if both parameters <= 0.
|
|
// Prevent this by making sure shininess is at least czm_epsilon2.
|
|
return pow(specular, max(shininess, czm_epsilon2));
|
|
}
|
|
`,JQ=`/**
|
|
* @private
|
|
*/
|
|
vec4 czm_getWaterNoise(sampler2D normalMap, vec2 uv, float time, float angleInRadians)
|
|
{
|
|
float cosAngle = cos(angleInRadians);
|
|
float sinAngle = sin(angleInRadians);
|
|
|
|
// time dependent sampling directions
|
|
vec2 s0 = vec2(1.0/17.0, 0.0);
|
|
vec2 s1 = vec2(-1.0/29.0, 0.0);
|
|
vec2 s2 = vec2(1.0/101.0, 1.0/59.0);
|
|
vec2 s3 = vec2(-1.0/109.0, -1.0/57.0);
|
|
|
|
// rotate sampling direction by specified angle
|
|
s0 = vec2((cosAngle * s0.x) - (sinAngle * s0.y), (sinAngle * s0.x) + (cosAngle * s0.y));
|
|
s1 = vec2((cosAngle * s1.x) - (sinAngle * s1.y), (sinAngle * s1.x) + (cosAngle * s1.y));
|
|
s2 = vec2((cosAngle * s2.x) - (sinAngle * s2.y), (sinAngle * s2.x) + (cosAngle * s2.y));
|
|
s3 = vec2((cosAngle * s3.x) - (sinAngle * s3.y), (sinAngle * s3.x) + (cosAngle * s3.y));
|
|
|
|
vec2 uv0 = (uv/103.0) + (time * s0);
|
|
vec2 uv1 = uv/107.0 + (time * s1) + vec2(0.23);
|
|
vec2 uv2 = uv/vec2(897.0, 983.0) + (time * s2) + vec2(0.51);
|
|
vec2 uv3 = uv/vec2(991.0, 877.0) + (time * s3) + vec2(0.71);
|
|
|
|
uv0 = fract(uv0);
|
|
uv1 = fract(uv1);
|
|
uv2 = fract(uv2);
|
|
uv3 = fract(uv3);
|
|
vec4 noise = (texture(normalMap, uv0)) +
|
|
(texture(normalMap, uv1)) +
|
|
(texture(normalMap, uv2)) +
|
|
(texture(normalMap, uv3));
|
|
|
|
// average and scale to between -1 and 1
|
|
return ((noise / 4.0) - 0.5) * 2.0;
|
|
}
|
|
`,eK=`/**
|
|
* Adjusts the hue of a color.
|
|
*
|
|
* @name czm_hue
|
|
* @glslFunction
|
|
*
|
|
* @param {vec3} rgb The color.
|
|
* @param {float} adjustment The amount to adjust the hue of the color in radians.
|
|
*
|
|
* @returns {float} The color with the hue adjusted.
|
|
*
|
|
* @example
|
|
* vec3 adjustHue = czm_hue(color, czm_pi); // The same as czm_hue(color, -czm_pi)
|
|
*/
|
|
vec3 czm_hue(vec3 rgb, float adjustment)
|
|
{
|
|
const mat3 toYIQ = mat3(0.299, 0.587, 0.114,
|
|
0.595716, -0.274453, -0.321263,
|
|
0.211456, -0.522591, 0.311135);
|
|
const mat3 toRGB = mat3(1.0, 0.9563, 0.6210,
|
|
1.0, -0.2721, -0.6474,
|
|
1.0, -1.107, 1.7046);
|
|
|
|
vec3 yiq = toYIQ * rgb;
|
|
float hue = atan(yiq.z, yiq.y) + adjustment;
|
|
float chroma = sqrt(yiq.z * yiq.z + yiq.y * yiq.y);
|
|
|
|
vec3 color = vec3(yiq.x, chroma * cos(hue), chroma * sin(hue));
|
|
return toRGB * color;
|
|
}
|
|
`,tK=`/**
|
|
* Converts a color in linear space to RGB space.
|
|
*
|
|
* @name czm_inverseGamma
|
|
* @glslFunction
|
|
*
|
|
* @param {vec3} color The color in linear space.
|
|
* @returns {vec3} The color in RGB space.
|
|
*/
|
|
vec3 czm_inverseGamma(vec3 color) {
|
|
return pow(color, vec3(1.0 / czm_gamma));
|
|
}
|
|
`,nK=`/**
|
|
* Determines if a time interval is empty.
|
|
*
|
|
* @name czm_isEmpty
|
|
* @glslFunction
|
|
*
|
|
* @param {czm_raySegment} interval The interval to test.
|
|
*
|
|
* @returns {bool} <code>true</code> if the time interval is empty; otherwise, <code>false</code>.
|
|
*
|
|
* @example
|
|
* bool b0 = czm_isEmpty(czm_emptyRaySegment); // true
|
|
* bool b1 = czm_isEmpty(czm_raySegment(0.0, 1.0)); // false
|
|
* bool b2 = czm_isEmpty(czm_raySegment(1.0, 1.0)); // false, contains 1.0.
|
|
*/
|
|
bool czm_isEmpty(czm_raySegment interval)
|
|
{
|
|
return (interval.stop < 0.0);
|
|
}
|
|
`,iK=`/**
|
|
* Determines if a time interval is empty.
|
|
*
|
|
* @name czm_isFull
|
|
* @glslFunction
|
|
*
|
|
* @param {czm_raySegment} interval The interval to test.
|
|
*
|
|
* @returns {bool} <code>true</code> if the time interval is empty; otherwise, <code>false</code>.
|
|
*
|
|
* @example
|
|
* bool b0 = czm_isEmpty(czm_emptyRaySegment); // true
|
|
* bool b1 = czm_isEmpty(czm_raySegment(0.0, 1.0)); // false
|
|
* bool b2 = czm_isEmpty(czm_raySegment(1.0, 1.0)); // false, contains 1.0.
|
|
*/
|
|
bool czm_isFull(czm_raySegment interval)
|
|
{
|
|
return (interval.start == 0.0 && interval.stop == czm_infinity);
|
|
}
|
|
`,oK=`/**
|
|
* Computes the fraction of a Web Wercator rectangle at which a given geodetic latitude is located.
|
|
*
|
|
* @name czm_latitudeToWebMercatorFraction
|
|
* @glslFunction
|
|
*
|
|
* @param {float} latitude The geodetic latitude, in radians.
|
|
* @param {float} southMercatorY The Web Mercator coordinate of the southern boundary of the rectangle.
|
|
* @param {float} oneOverMercatorHeight The total height of the rectangle in Web Mercator coordinates.
|
|
*
|
|
* @returns {float} The fraction of the rectangle at which the latitude occurs. If the latitude is the southern
|
|
* boundary of the rectangle, the return value will be zero. If it is the northern boundary, the return
|
|
* value will be 1.0. Latitudes in between are mapped according to the Web Mercator projection.
|
|
*/
|
|
float czm_latitudeToWebMercatorFraction(float latitude, float southMercatorY, float oneOverMercatorHeight)
|
|
{
|
|
float sinLatitude = sin(latitude);
|
|
float mercatorY = 0.5 * log((1.0 + sinLatitude) / (1.0 - sinLatitude));
|
|
|
|
return (mercatorY - southMercatorY) * oneOverMercatorHeight;
|
|
}
|
|
`,rK=`/**
|
|
* Computes distance from an point in 2D to a line in 2D.
|
|
*
|
|
* @name czm_lineDistance
|
|
* @glslFunction
|
|
*
|
|
* param {vec2} point1 A point along the line.
|
|
* param {vec2} point2 A point along the line.
|
|
* param {vec2} point A point that may or may not be on the line.
|
|
* returns {float} The distance from the point to the line.
|
|
*/
|
|
float czm_lineDistance(vec2 point1, vec2 point2, vec2 point) {
|
|
return abs((point2.y - point1.y) * point.x - (point2.x - point1.x) * point.y + point2.x * point1.y - point2.y * point1.x) / distance(point2, point1);
|
|
}
|
|
`,sK=`/**
|
|
* Converts a linear RGB color to an sRGB color.
|
|
*
|
|
* @param {vec3|vec4} linearIn The color in linear color space.
|
|
* @returns {vec3|vec4} The color in sRGB color space. The vector type matches the input.
|
|
*/
|
|
vec3 czm_linearToSrgb(vec3 linearIn)
|
|
{
|
|
return pow(linearIn, vec3(1.0/2.2));
|
|
}
|
|
|
|
vec4 czm_linearToSrgb(vec4 linearIn)
|
|
{
|
|
vec3 srgbOut = pow(linearIn.rgb, vec3(1.0/2.2));
|
|
return vec4(srgbOut, linearIn.a);
|
|
}
|
|
`,aK=`/**
|
|
* Computes the luminance of a color.
|
|
*
|
|
* @name czm_luminance
|
|
* @glslFunction
|
|
*
|
|
* @param {vec3} rgb The color.
|
|
*
|
|
* @returns {float} The luminance.
|
|
*
|
|
* @example
|
|
* float light = czm_luminance(vec3(0.0)); // 0.0
|
|
* float dark = czm_luminance(vec3(1.0)); // ~1.0
|
|
*/
|
|
float czm_luminance(vec3 rgb)
|
|
{
|
|
// Algorithm from Chapter 10 of Graphics Shaders.
|
|
const vec3 W = vec3(0.2125, 0.7154, 0.0721);
|
|
return dot(rgb, W);
|
|
}
|
|
`,cK=`/**
|
|
* Computes the size of a pixel in meters at a distance from the eye.
|
|
* <p>
|
|
* Use this version when passing in a custom pixel ratio. For example, passing in 1.0 will return meters per native device pixel.
|
|
* </p>
|
|
* @name czm_metersPerPixel
|
|
* @glslFunction
|
|
*
|
|
* @param {vec3} positionEC The position to get the meters per pixel in eye coordinates.
|
|
* @param {float} pixelRatio The scaling factor from pixel space to coordinate space
|
|
*
|
|
* @returns {float} The meters per pixel at positionEC.
|
|
*/
|
|
float czm_metersPerPixel(vec4 positionEC, float pixelRatio)
|
|
{
|
|
float width = czm_viewport.z;
|
|
float height = czm_viewport.w;
|
|
float pixelWidth;
|
|
float pixelHeight;
|
|
|
|
float top = czm_frustumPlanes.x;
|
|
float bottom = czm_frustumPlanes.y;
|
|
float left = czm_frustumPlanes.z;
|
|
float right = czm_frustumPlanes.w;
|
|
|
|
if (czm_sceneMode == czm_sceneMode2D || czm_orthographicIn3D == 1.0)
|
|
{
|
|
float frustumWidth = right - left;
|
|
float frustumHeight = top - bottom;
|
|
pixelWidth = frustumWidth / width;
|
|
pixelHeight = frustumHeight / height;
|
|
}
|
|
else
|
|
{
|
|
float distanceToPixel = -positionEC.z;
|
|
float inverseNear = 1.0 / czm_currentFrustum.x;
|
|
float tanTheta = top * inverseNear;
|
|
pixelHeight = 2.0 * distanceToPixel * tanTheta / height;
|
|
tanTheta = right * inverseNear;
|
|
pixelWidth = 2.0 * distanceToPixel * tanTheta / width;
|
|
}
|
|
|
|
return max(pixelWidth, pixelHeight) * pixelRatio;
|
|
}
|
|
|
|
/**
|
|
* Computes the size of a pixel in meters at a distance from the eye.
|
|
* <p>
|
|
* Use this version when scaling by pixel ratio.
|
|
* </p>
|
|
* @name czm_metersPerPixel
|
|
* @glslFunction
|
|
*
|
|
* @param {vec3} positionEC The position to get the meters per pixel in eye coordinates.
|
|
*
|
|
* @returns {float} The meters per pixel at positionEC.
|
|
*/
|
|
float czm_metersPerPixel(vec4 positionEC)
|
|
{
|
|
return czm_metersPerPixel(positionEC, czm_pixelRatio);
|
|
}
|
|
`,lK=`/**
|
|
* Transforms a position from model to window coordinates. The transformation
|
|
* from model to clip coordinates is done using {@link czm_modelViewProjection}.
|
|
* The transform from normalized device coordinates to window coordinates is
|
|
* done using {@link czm_viewportTransformation}, which assumes a depth range
|
|
* of <code>near = 0</code> and <code>far = 1</code>.
|
|
* <br /><br />
|
|
* This transform is useful when there is a need to manipulate window coordinates
|
|
* in a vertex shader as done by {@link BillboardCollection}.
|
|
* <br /><br />
|
|
* This function should not be confused with {@link czm_viewportOrthographic},
|
|
* which is an orthographic projection matrix that transforms from window
|
|
* coordinates to clip coordinates.
|
|
*
|
|
* @name czm_modelToWindowCoordinates
|
|
* @glslFunction
|
|
*
|
|
* @param {vec4} position The position in model coordinates to transform.
|
|
*
|
|
* @returns {vec4} The transformed position in window coordinates.
|
|
*
|
|
* @see czm_eyeToWindowCoordinates
|
|
* @see czm_modelViewProjection
|
|
* @see czm_viewportTransformation
|
|
* @see czm_viewportOrthographic
|
|
* @see BillboardCollection
|
|
*
|
|
* @example
|
|
* vec4 positionWC = czm_modelToWindowCoordinates(positionMC);
|
|
*/
|
|
vec4 czm_modelToWindowCoordinates(vec4 position)
|
|
{
|
|
vec4 q = czm_modelViewProjection * position; // clip coordinates
|
|
q.xyz /= q.w; // normalized device coordinates
|
|
q.xyz = (czm_viewportTransformation * vec4(q.xyz, 1.0)).xyz; // window coordinates
|
|
return q;
|
|
}
|
|
`,uK=`/**
|
|
* DOC_TBA
|
|
*
|
|
* @name czm_multiplyWithColorBalance
|
|
* @glslFunction
|
|
*/
|
|
vec3 czm_multiplyWithColorBalance(vec3 left, vec3 right)
|
|
{
|
|
// Algorithm from Chapter 10 of Graphics Shaders.
|
|
const vec3 W = vec3(0.2125, 0.7154, 0.0721);
|
|
|
|
vec3 target = left * right;
|
|
float leftLuminance = dot(left, W);
|
|
float rightLuminance = dot(right, W);
|
|
float targetLuminance = dot(target, W);
|
|
|
|
return ((leftLuminance + rightLuminance) / (2.0 * targetLuminance)) * target;
|
|
}
|
|
`,dK=`/**
|
|
* Computes a value that scales with distance. The scaling is clamped at the near and
|
|
* far distances, and does not extrapolate. This function works with the
|
|
* {@link NearFarScalar} JavaScript class.
|
|
*
|
|
* @name czm_nearFarScalar
|
|
* @glslFunction
|
|
*
|
|
* @param {vec4} nearFarScalar A vector with 4 components: Near distance (x), Near value (y), Far distance (z), Far value (w).
|
|
* @param {float} cameraDistSq The square of the current distance from the camera.
|
|
*
|
|
* @returns {float} The value at this distance.
|
|
*/
|
|
float czm_nearFarScalar(vec4 nearFarScalar, float cameraDistSq)
|
|
{
|
|
float valueAtMin = nearFarScalar.y;
|
|
float valueAtMax = nearFarScalar.w;
|
|
float nearDistanceSq = nearFarScalar.x * nearFarScalar.x;
|
|
float farDistanceSq = nearFarScalar.z * nearFarScalar.z;
|
|
|
|
float t = (cameraDistSq - nearDistanceSq) / (farDistanceSq - nearDistanceSq);
|
|
|
|
t = pow(clamp(t, 0.0, 1.0), 0.2);
|
|
|
|
return mix(valueAtMin, valueAtMax, t);
|
|
}
|
|
`,hK=` /**
|
|
* Decodes a unit-length vector in 'oct' encoding to a normalized 3-component Cartesian vector.
|
|
* The 'oct' encoding is described in "A Survey of Efficient Representations of Independent Unit Vectors",
|
|
* Cigolle et al 2014: http://jcgt.org/published/0003/02/01/
|
|
*
|
|
* @name czm_octDecode
|
|
* @param {vec2} encoded The oct-encoded, unit-length vector
|
|
* @param {float} range The maximum value of the SNORM range. The encoded vector is stored in log2(rangeMax+1) bits.
|
|
* @returns {vec3} The decoded and normalized vector
|
|
*/
|
|
vec3 czm_octDecode(vec2 encoded, float range)
|
|
{
|
|
if (encoded.x == 0.0 && encoded.y == 0.0) {
|
|
return vec3(0.0, 0.0, 0.0);
|
|
}
|
|
|
|
encoded = encoded / range * 2.0 - 1.0;
|
|
vec3 v = vec3(encoded.x, encoded.y, 1.0 - abs(encoded.x) - abs(encoded.y));
|
|
if (v.z < 0.0)
|
|
{
|
|
v.xy = (1.0 - abs(v.yx)) * czm_signNotZero(v.xy);
|
|
}
|
|
|
|
return normalize(v);
|
|
}
|
|
|
|
/**
|
|
* Decodes a unit-length vector in 'oct' encoding to a normalized 3-component Cartesian vector.
|
|
* The 'oct' encoding is described in "A Survey of Efficient Representations of Independent Unit Vectors",
|
|
* Cigolle et al 2014: http://jcgt.org/published/0003/02/01/
|
|
*
|
|
* @name czm_octDecode
|
|
* @param {vec2} encoded The oct-encoded, unit-length vector
|
|
* @returns {vec3} The decoded and normalized vector
|
|
*/
|
|
vec3 czm_octDecode(vec2 encoded)
|
|
{
|
|
return czm_octDecode(encoded, 255.0);
|
|
}
|
|
|
|
/**
|
|
* Decodes a unit-length vector in 'oct' encoding packed into a floating-point number to a normalized 3-component Cartesian vector.
|
|
* The 'oct' encoding is described in "A Survey of Efficient Representations of Independent Unit Vectors",
|
|
* Cigolle et al 2014: http://jcgt.org/published/0003/02/01/
|
|
*
|
|
* @name czm_octDecode
|
|
* @param {float} encoded The oct-encoded, unit-length vector
|
|
* @returns {vec3} The decoded and normalized vector
|
|
*/
|
|
vec3 czm_octDecode(float encoded)
|
|
{
|
|
float temp = encoded / 256.0;
|
|
float x = floor(temp);
|
|
float y = (temp - x) * 256.0;
|
|
return czm_octDecode(vec2(x, y));
|
|
}
|
|
|
|
/**
|
|
* Decodes three unit-length vectors in 'oct' encoding packed into two floating-point numbers to normalized 3-component Cartesian vectors.
|
|
* The 'oct' encoding is described in "A Survey of Efficient Representations of Independent Unit Vectors",
|
|
* Cigolle et al 2014: http://jcgt.org/published/0003/02/01/
|
|
*
|
|
* @name czm_octDecode
|
|
* @param {vec2} encoded The packed oct-encoded, unit-length vectors.
|
|
* @param {vec3} vector1 One decoded and normalized vector.
|
|
* @param {vec3} vector2 One decoded and normalized vector.
|
|
* @param {vec3} vector3 One decoded and normalized vector.
|
|
*/
|
|
void czm_octDecode(vec2 encoded, out vec3 vector1, out vec3 vector2, out vec3 vector3)
|
|
{
|
|
float temp = encoded.x / 65536.0;
|
|
float x = floor(temp);
|
|
float encodedFloat1 = (temp - x) * 65536.0;
|
|
|
|
temp = encoded.y / 65536.0;
|
|
float y = floor(temp);
|
|
float encodedFloat2 = (temp - y) * 65536.0;
|
|
|
|
vector1 = czm_octDecode(encodedFloat1);
|
|
vector2 = czm_octDecode(encodedFloat2);
|
|
vector3 = czm_octDecode(vec2(x, y));
|
|
}
|
|
|
|
`,fK=`/**
|
|
* Packs a depth value into a vec3 that can be represented by unsigned bytes.
|
|
*
|
|
* @name czm_packDepth
|
|
* @glslFunction
|
|
*
|
|
* @param {float} depth The floating-point depth.
|
|
* @returns {vec3} The packed depth.
|
|
*/
|
|
vec4 czm_packDepth(float depth)
|
|
{
|
|
// See Aras Pranckevi\u010Dius' post Encoding Floats to RGBA
|
|
// http://aras-p.info/blog/2009/07/30/encoding-floats-to-rgba-the-final/
|
|
vec4 enc = vec4(1.0, 255.0, 65025.0, 16581375.0) * depth;
|
|
enc = fract(enc);
|
|
enc -= enc.yzww * vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 0.0);
|
|
return enc;
|
|
}
|
|
`,pK=`vec3 lambertianDiffuse(vec3 diffuseColor)
|
|
{
|
|
return diffuseColor / czm_pi;
|
|
}
|
|
|
|
vec3 fresnelSchlick2(vec3 f0, vec3 f90, float VdotH)
|
|
{
|
|
return f0 + (f90 - f0) * pow(clamp(1.0 - VdotH, 0.0, 1.0), 5.0);
|
|
}
|
|
|
|
float smithVisibilityG1(float NdotV, float roughness)
|
|
{
|
|
// this is the k value for direct lighting.
|
|
// for image based lighting it will be roughness^2 / 2
|
|
float k = (roughness + 1.0) * (roughness + 1.0) / 8.0;
|
|
return NdotV / (NdotV * (1.0 - k) + k);
|
|
}
|
|
|
|
float smithVisibilityGGX(float roughness, float NdotL, float NdotV)
|
|
{
|
|
return (
|
|
smithVisibilityG1(NdotL, roughness) *
|
|
smithVisibilityG1(NdotV, roughness)
|
|
);
|
|
}
|
|
|
|
float GGX(float roughness, float NdotH)
|
|
{
|
|
float roughnessSquared = roughness * roughness;
|
|
float f = (NdotH * roughnessSquared - NdotH) * NdotH + 1.0;
|
|
return roughnessSquared / (czm_pi * f * f);
|
|
}
|
|
|
|
/**
|
|
* Compute the diffuse and specular contributions using physically based
|
|
* rendering. This function only handles direct lighting.
|
|
* <p>
|
|
* This function only handles the lighting calculations. Metallic/roughness
|
|
* and specular/glossy must be handled separately. See {@czm_pbrMetallicRoughnessMaterial}, {@czm_pbrSpecularGlossinessMaterial} and {@czm_defaultPbrMaterial}
|
|
* </p>
|
|
*
|
|
* @name czm_pbrlighting
|
|
* @glslFunction
|
|
*
|
|
* @param {vec3} positionEC The position of the fragment in eye coordinates
|
|
* @param {vec3} normalEC The surface normal in eye coordinates
|
|
* @param {vec3} lightDirectionEC Unit vector pointing to the light source in eye coordinates.
|
|
* @param {vec3} lightColorHdr radiance of the light source. This is a HDR value.
|
|
* @param {czm_pbrParameters} The computed PBR parameters.
|
|
* @return {vec3} The computed HDR color
|
|
*
|
|
* @example
|
|
* czm_pbrParameters pbrParameters = czm_pbrMetallicRoughnessMaterial(
|
|
* baseColor,
|
|
* metallic,
|
|
* roughness
|
|
* );
|
|
* vec3 color = czm_pbrlighting(
|
|
* positionEC,
|
|
* normalEC,
|
|
* lightDirectionEC,
|
|
* lightColorHdr,
|
|
* pbrParameters);
|
|
*/
|
|
vec3 czm_pbrLighting(
|
|
vec3 positionEC,
|
|
vec3 normalEC,
|
|
vec3 lightDirectionEC,
|
|
vec3 lightColorHdr,
|
|
czm_pbrParameters pbrParameters
|
|
)
|
|
{
|
|
vec3 v = -normalize(positionEC);
|
|
vec3 l = normalize(lightDirectionEC);
|
|
vec3 h = normalize(v + l);
|
|
vec3 n = normalEC;
|
|
float NdotL = clamp(dot(n, l), 0.001, 1.0);
|
|
float NdotV = abs(dot(n, v)) + 0.001;
|
|
float NdotH = clamp(dot(n, h), 0.0, 1.0);
|
|
float LdotH = clamp(dot(l, h), 0.0, 1.0);
|
|
float VdotH = clamp(dot(v, h), 0.0, 1.0);
|
|
|
|
vec3 f0 = pbrParameters.f0;
|
|
float reflectance = max(max(f0.r, f0.g), f0.b);
|
|
vec3 f90 = vec3(clamp(reflectance * 25.0, 0.0, 1.0));
|
|
vec3 F = fresnelSchlick2(f0, f90, VdotH);
|
|
|
|
float alpha = pbrParameters.roughness;
|
|
float G = smithVisibilityGGX(alpha, NdotL, NdotV);
|
|
float D = GGX(alpha, NdotH);
|
|
vec3 specularContribution = F * G * D / (4.0 * NdotL * NdotV);
|
|
|
|
vec3 diffuseColor = pbrParameters.diffuseColor;
|
|
// F here represents the specular contribution
|
|
vec3 diffuseContribution = (1.0 - F) * lambertianDiffuse(diffuseColor);
|
|
|
|
// Lo = (diffuse + specular) * Li * NdotL
|
|
return (diffuseContribution + specularContribution) * NdotL * lightColorHdr;
|
|
}
|
|
`,mK=`/**
|
|
* Compute parameters for physically based rendering using the
|
|
* metallic/roughness workflow. All inputs are linear; sRGB texture values must
|
|
* be decoded beforehand
|
|
*
|
|
* @name czm_pbrMetallicRoughnessMaterial
|
|
* @glslFunction
|
|
*
|
|
* @param {vec3} baseColor For dielectrics, this is the base color. For metals, this is the f0 value (reflectance at normal incidence)
|
|
* @param {float} metallic 0.0 indicates dielectric. 1.0 indicates metal. Values in between are allowed (e.g. to model rust or dirt);
|
|
* @param {float} roughness A value between 0.0 and 1.0
|
|
* @return {czm_pbrParameters} parameters to pass into {@link czm_pbrLighting}
|
|
*/
|
|
czm_pbrParameters czm_pbrMetallicRoughnessMaterial(
|
|
vec3 baseColor,
|
|
float metallic,
|
|
float roughness
|
|
)
|
|
{
|
|
czm_pbrParameters results;
|
|
|
|
// roughness is authored as perceptual roughness
|
|
// square it to get material roughness
|
|
roughness = clamp(roughness, 0.0, 1.0);
|
|
results.roughness = roughness * roughness;
|
|
|
|
// dielectrics use f0 = 0.04, metals use albedo as f0
|
|
metallic = clamp(metallic, 0.0, 1.0);
|
|
const vec3 REFLECTANCE_DIELECTRIC = vec3(0.04);
|
|
vec3 f0 = mix(REFLECTANCE_DIELECTRIC, baseColor, metallic);
|
|
results.f0 = f0;
|
|
|
|
// diffuse only applies to dielectrics.
|
|
results.diffuseColor = baseColor * (1.0 - f0) * (1.0 - metallic);
|
|
|
|
return results;
|
|
}
|
|
`,_K=`/**
|
|
* Compute parameters for physically based rendering using the
|
|
* specular/glossy workflow. All inputs are linear; sRGB texture values must
|
|
* be decoded beforehand
|
|
*
|
|
* @name czm_pbrSpecularGlossinessMaterial
|
|
* @glslFunction
|
|
*
|
|
* @param {vec3} diffuse The diffuse color for dielectrics (non-metals)
|
|
* @param {vec3} specular The reflectance at normal incidence (f0)
|
|
* @param {float} glossiness A number from 0.0 to 1.0 indicating how smooth the surface is.
|
|
* @return {czm_pbrParameters} parameters to pass into {@link czm_pbrLighting}
|
|
*/
|
|
czm_pbrParameters czm_pbrSpecularGlossinessMaterial(
|
|
vec3 diffuse,
|
|
vec3 specular,
|
|
float glossiness
|
|
)
|
|
{
|
|
czm_pbrParameters results;
|
|
|
|
// glossiness is the opposite of roughness, but easier for artists to use.
|
|
float roughness = 1.0 - glossiness;
|
|
results.roughness = roughness * roughness;
|
|
|
|
results.diffuseColor = diffuse * (1.0 - max(max(specular.r, specular.g), specular.b));
|
|
results.f0 = specular;
|
|
|
|
return results;
|
|
}
|
|
`,gK=`float czm_private_getLambertDiffuseOfMaterial(vec3 lightDirectionEC, czm_material material)
|
|
{
|
|
return czm_getLambertDiffuse(lightDirectionEC, material.normal);
|
|
}
|
|
|
|
float czm_private_getSpecularOfMaterial(vec3 lightDirectionEC, vec3 toEyeEC, czm_material material)
|
|
{
|
|
return czm_getSpecular(lightDirectionEC, toEyeEC, material.normal, material.shininess);
|
|
}
|
|
|
|
/**
|
|
* Computes a color using the Phong lighting model.
|
|
*
|
|
* @name czm_phong
|
|
* @glslFunction
|
|
*
|
|
* @param {vec3} toEye A normalized vector from the fragment to the eye in eye coordinates.
|
|
* @param {czm_material} material The fragment's material.
|
|
*
|
|
* @returns {vec4} The computed color.
|
|
*
|
|
* @example
|
|
* vec3 positionToEyeEC = // ...
|
|
* czm_material material = // ...
|
|
* vec3 lightDirectionEC = // ...
|
|
* out_FragColor = czm_phong(normalize(positionToEyeEC), material, lightDirectionEC);
|
|
*
|
|
* @see czm_getMaterial
|
|
*/
|
|
vec4 czm_phong(vec3 toEye, czm_material material, vec3 lightDirectionEC)
|
|
{
|
|
// Diffuse from directional light sources at eye (for top-down)
|
|
float diffuse = czm_private_getLambertDiffuseOfMaterial(vec3(0.0, 0.0, 1.0), material);
|
|
if (czm_sceneMode == czm_sceneMode3D) {
|
|
// (and horizon views in 3D)
|
|
diffuse += czm_private_getLambertDiffuseOfMaterial(vec3(0.0, 1.0, 0.0), material);
|
|
}
|
|
|
|
float specular = czm_private_getSpecularOfMaterial(lightDirectionEC, toEye, material);
|
|
|
|
// Temporary workaround for adding ambient.
|
|
vec3 materialDiffuse = material.diffuse * 0.5;
|
|
|
|
vec3 ambient = materialDiffuse;
|
|
vec3 color = ambient + material.emission;
|
|
color += materialDiffuse * diffuse * czm_lightColor;
|
|
color += material.specular * specular * czm_lightColor;
|
|
|
|
return vec4(color, material.alpha);
|
|
}
|
|
|
|
vec4 czm_private_phong(vec3 toEye, czm_material material, vec3 lightDirectionEC)
|
|
{
|
|
float diffuse = czm_private_getLambertDiffuseOfMaterial(lightDirectionEC, material);
|
|
float specular = czm_private_getSpecularOfMaterial(lightDirectionEC, toEye, material);
|
|
|
|
vec3 ambient = vec3(0.0);
|
|
vec3 color = ambient + material.emission;
|
|
color += material.diffuse * diffuse * czm_lightColor;
|
|
color += material.specular * specular * czm_lightColor;
|
|
|
|
return vec4(color, material.alpha);
|
|
}
|
|
`,yK=`/**
|
|
* Computes distance from a point to a plane.
|
|
*
|
|
* @name czm_planeDistance
|
|
* @glslFunction
|
|
*
|
|
* param {vec4} plane A Plane in Hessian Normal Form. See Plane.js
|
|
* param {vec3} point A point in the same space as the plane.
|
|
* returns {float} The distance from the point to the plane.
|
|
*/
|
|
float czm_planeDistance(vec4 plane, vec3 point) {
|
|
return (dot(plane.xyz, point) + plane.w);
|
|
}
|
|
|
|
/**
|
|
* Computes distance from a point to a plane.
|
|
*
|
|
* @name czm_planeDistance
|
|
* @glslFunction
|
|
*
|
|
* param {vec3} planeNormal Normal for a plane in Hessian Normal Form. See Plane.js
|
|
* param {float} planeDistance Distance for a plane in Hessian Normal form. See Plane.js
|
|
* param {vec3} point A point in the same space as the plane.
|
|
* returns {float} The distance from the point to the plane.
|
|
*/
|
|
float czm_planeDistance(vec3 planeNormal, float planeDistance, vec3 point) {
|
|
return (dot(planeNormal, point) + planeDistance);
|
|
}
|
|
`,bK=`/**
|
|
* Computes the point along a ray at the given time. <code>time</code> can be positive, negative, or zero.
|
|
*
|
|
* @name czm_pointAlongRay
|
|
* @glslFunction
|
|
*
|
|
* @param {czm_ray} ray The ray to compute the point along.
|
|
* @param {float} time The time along the ray.
|
|
*
|
|
* @returns {vec3} The point along the ray at the given time.
|
|
*
|
|
* @example
|
|
* czm_ray ray = czm_ray(vec3(0.0), vec3(1.0, 0.0, 0.0)); // origin, direction
|
|
* vec3 v = czm_pointAlongRay(ray, 2.0); // (2.0, 0.0, 0.0)
|
|
*/
|
|
vec3 czm_pointAlongRay(czm_ray ray, float time)
|
|
{
|
|
return ray.origin + (time * ray.direction);
|
|
}
|
|
`,TK=`/**
|
|
* DOC_TBA
|
|
*
|
|
* @name czm_rayEllipsoidIntersectionInterval
|
|
* @glslFunction
|
|
*/
|
|
czm_raySegment czm_rayEllipsoidIntersectionInterval(czm_ray ray, vec3 ellipsoid_center, vec3 ellipsoid_inverseRadii)
|
|
{
|
|
// ray and ellipsoid center in eye coordinates. radii in model coordinates.
|
|
vec3 q = ellipsoid_inverseRadii * (czm_inverseModelView * vec4(ray.origin, 1.0)).xyz;
|
|
vec3 w = ellipsoid_inverseRadii * (czm_inverseModelView * vec4(ray.direction, 0.0)).xyz;
|
|
|
|
q = q - ellipsoid_inverseRadii * (czm_inverseModelView * vec4(ellipsoid_center, 1.0)).xyz;
|
|
|
|
float q2 = dot(q, q);
|
|
float qw = dot(q, w);
|
|
|
|
if (q2 > 1.0) // Outside ellipsoid.
|
|
{
|
|
if (qw >= 0.0) // Looking outward or tangent (0 intersections).
|
|
{
|
|
return czm_emptyRaySegment;
|
|
}
|
|
else // qw < 0.0.
|
|
{
|
|
float qw2 = qw * qw;
|
|
float difference = q2 - 1.0; // Positively valued.
|
|
float w2 = dot(w, w);
|
|
float product = w2 * difference;
|
|
|
|
if (qw2 < product) // Imaginary roots (0 intersections).
|
|
{
|
|
return czm_emptyRaySegment;
|
|
}
|
|
else if (qw2 > product) // Distinct roots (2 intersections).
|
|
{
|
|
float discriminant = qw * qw - product;
|
|
float temp = -qw + sqrt(discriminant); // Avoid cancellation.
|
|
float root0 = temp / w2;
|
|
float root1 = difference / temp;
|
|
if (root0 < root1)
|
|
{
|
|
czm_raySegment i = czm_raySegment(root0, root1);
|
|
return i;
|
|
}
|
|
else
|
|
{
|
|
czm_raySegment i = czm_raySegment(root1, root0);
|
|
return i;
|
|
}
|
|
}
|
|
else // qw2 == product. Repeated roots (2 intersections).
|
|
{
|
|
float root = sqrt(difference / w2);
|
|
czm_raySegment i = czm_raySegment(root, root);
|
|
return i;
|
|
}
|
|
}
|
|
}
|
|
else if (q2 < 1.0) // Inside ellipsoid (2 intersections).
|
|
{
|
|
float difference = q2 - 1.0; // Negatively valued.
|
|
float w2 = dot(w, w);
|
|
float product = w2 * difference; // Negatively valued.
|
|
float discriminant = qw * qw - product;
|
|
float temp = -qw + sqrt(discriminant); // Positively valued.
|
|
czm_raySegment i = czm_raySegment(0.0, temp / w2);
|
|
return i;
|
|
}
|
|
else // q2 == 1.0. On ellipsoid.
|
|
{
|
|
if (qw < 0.0) // Looking inward.
|
|
{
|
|
float w2 = dot(w, w);
|
|
czm_raySegment i = czm_raySegment(0.0, -qw / w2);
|
|
return i;
|
|
}
|
|
else // qw >= 0.0. Looking outward or tangent.
|
|
{
|
|
return czm_emptyRaySegment;
|
|
}
|
|
}
|
|
}
|
|
`,AK=`/**
|
|
* Compute the intersection interval of a ray with a sphere.
|
|
*
|
|
* @name czm_raySphereIntersectionInterval
|
|
* @glslFunction
|
|
*
|
|
* @param {czm_ray} ray The ray.
|
|
* @param {vec3} center The center of the sphere.
|
|
* @param {float} radius The radius of the sphere.
|
|
* @return {czm_raySegment} The intersection interval of the ray with the sphere.
|
|
*/
|
|
czm_raySegment czm_raySphereIntersectionInterval(czm_ray ray, vec3 center, float radius)
|
|
{
|
|
vec3 o = ray.origin;
|
|
vec3 d = ray.direction;
|
|
|
|
vec3 oc = o - center;
|
|
|
|
float a = dot(d, d);
|
|
float b = 2.0 * dot(d, oc);
|
|
float c = dot(oc, oc) - (radius * radius);
|
|
|
|
float det = (b * b) - (4.0 * a * c);
|
|
|
|
if (det < 0.0) {
|
|
return czm_emptyRaySegment;
|
|
}
|
|
|
|
float sqrtDet = sqrt(det);
|
|
|
|
float t0 = (-b - sqrtDet) / (2.0 * a);
|
|
float t1 = (-b + sqrtDet) / (2.0 * a);
|
|
|
|
czm_raySegment result = czm_raySegment(t0, t1);
|
|
return result;
|
|
}
|
|
`,xK=`float czm_readDepth(sampler2D depthTexture, vec2 texCoords)
|
|
{
|
|
return czm_reverseLogDepth(texture(depthTexture, texCoords).r);
|
|
}
|
|
`,CK=`/**
|
|
* Reads a value previously transformed with {@link czm_writeNonPerspective}
|
|
* by dividing it by \`w\`, the value used in the perspective divide.
|
|
* This function is intended to be called in a fragment shader to access a
|
|
* \`varying\` that should not be subject to perspective interpolation.
|
|
* For example, screen-space texture coordinates. The value should have been
|
|
* previously written in the vertex shader with a call to
|
|
* {@link czm_writeNonPerspective}.
|
|
*
|
|
* @name czm_readNonPerspective
|
|
* @glslFunction
|
|
*
|
|
* @param {float|vec2|vec3|vec4} value The non-perspective value to be read.
|
|
* @param {float} oneOverW One over the perspective divide value, \`w\`. Usually this is simply \`gl_FragCoord.w\`.
|
|
* @returns {float|vec2|vec3|vec4} The usable value.
|
|
*/
|
|
float czm_readNonPerspective(float value, float oneOverW) {
|
|
return value * oneOverW;
|
|
}
|
|
|
|
vec2 czm_readNonPerspective(vec2 value, float oneOverW) {
|
|
return value * oneOverW;
|
|
}
|
|
|
|
vec3 czm_readNonPerspective(vec3 value, float oneOverW) {
|
|
return value * oneOverW;
|
|
}
|
|
|
|
vec4 czm_readNonPerspective(vec4 value, float oneOverW) {
|
|
return value * oneOverW;
|
|
}
|
|
`,EK=`float czm_reverseLogDepth(float logZ)
|
|
{
|
|
#ifdef LOG_DEPTH
|
|
float near = czm_currentFrustum.x;
|
|
float far = czm_currentFrustum.y;
|
|
float log2Depth = logZ * czm_log2FarDepthFromNearPlusOne;
|
|
float depthFromNear = pow(2.0, log2Depth) - 1.0;
|
|
return far * (1.0 - near / (depthFromNear + near)) / (far - near);
|
|
#endif
|
|
return logZ;
|
|
}
|
|
`,wK=`/**
|
|
* Round a floating point value. This function exists because round() doesn't
|
|
* exist in GLSL 1.00.
|
|
*
|
|
* @param {float|vec2|vec3|vec4} value The value to round
|
|
* @param {float|vec2|vec3|vec3} The rounded value. The type matches the input.
|
|
*/
|
|
float czm_round(float value) {
|
|
return floor(value + 0.5);
|
|
}
|
|
|
|
vec2 czm_round(vec2 value) {
|
|
return floor(value + 0.5);
|
|
}
|
|
|
|
vec3 czm_round(vec3 value) {
|
|
return floor(value + 0.5);
|
|
}
|
|
|
|
vec4 czm_round(vec4 value) {
|
|
return floor(value + 0.5);
|
|
}
|
|
`,SK=`/**
|
|
* Samples the 4 neighboring pixels and return the weighted average.
|
|
*
|
|
* @private
|
|
*/
|
|
vec3 czm_sampleOctahedralProjectionWithFiltering(sampler2D projectedMap, vec2 textureSize, vec3 direction, float lod)
|
|
{
|
|
direction /= dot(vec3(1.0), abs(direction));
|
|
vec2 rev = abs(direction.zx) - vec2(1.0);
|
|
vec2 neg = vec2(direction.x < 0.0 ? rev.x : -rev.x,
|
|
direction.z < 0.0 ? rev.y : -rev.y);
|
|
vec2 uv = direction.y < 0.0 ? neg : direction.xz;
|
|
vec2 coord = 0.5 * uv + vec2(0.5);
|
|
vec2 pixel = 1.0 / textureSize;
|
|
|
|
if (lod > 0.0)
|
|
{
|
|
// Each subseqeuent mip level is half the size
|
|
float scale = 1.0 / pow(2.0, lod);
|
|
float offset = ((textureSize.y + 1.0) / textureSize.x);
|
|
|
|
coord.x *= offset;
|
|
coord *= scale;
|
|
|
|
coord.x += offset + pixel.x;
|
|
coord.y += (1.0 - (1.0 / pow(2.0, lod - 1.0))) + pixel.y * (lod - 1.0) * 2.0;
|
|
}
|
|
else
|
|
{
|
|
coord.x *= (textureSize.y / textureSize.x);
|
|
}
|
|
|
|
// Do bilinear filtering
|
|
#ifndef OES_texture_float_linear
|
|
vec3 color1 = texture(projectedMap, coord + vec2(0.0, pixel.y)).rgb;
|
|
vec3 color2 = texture(projectedMap, coord + vec2(pixel.x, 0.0)).rgb;
|
|
vec3 color3 = texture(projectedMap, coord + pixel).rgb;
|
|
vec3 color4 = texture(projectedMap, coord).rgb;
|
|
|
|
vec2 texturePosition = coord * textureSize;
|
|
|
|
float fu = fract(texturePosition.x);
|
|
float fv = fract(texturePosition.y);
|
|
|
|
vec3 average1 = mix(color4, color2, fu);
|
|
vec3 average2 = mix(color1, color3, fu);
|
|
|
|
vec3 color = mix(average1, average2, fv);
|
|
#else
|
|
vec3 color = texture(projectedMap, coord).rgb;
|
|
#endif
|
|
|
|
return color;
|
|
}
|
|
|
|
|
|
/**
|
|
* Samples from a cube map that has been projected using an octahedral projection from the given direction.
|
|
*
|
|
* @name czm_sampleOctahedralProjection
|
|
* @glslFunction
|
|
*
|
|
* @param {sampler2D} projectedMap The texture with the octahedral projected cube map.
|
|
* @param {vec2} textureSize The width and height dimensions in pixels of the projected map.
|
|
* @param {vec3} direction The normalized direction used to sample the cube map.
|
|
* @param {float} lod The level of detail to sample.
|
|
* @param {float} maxLod The maximum level of detail.
|
|
* @returns {vec3} The color of the cube map at the direction.
|
|
*/
|
|
vec3 czm_sampleOctahedralProjection(sampler2D projectedMap, vec2 textureSize, vec3 direction, float lod, float maxLod) {
|
|
float currentLod = floor(lod + 0.5);
|
|
float nextLod = min(currentLod + 1.0, maxLod);
|
|
|
|
vec3 colorCurrentLod = czm_sampleOctahedralProjectionWithFiltering(projectedMap, textureSize, direction, currentLod);
|
|
vec3 colorNextLod = czm_sampleOctahedralProjectionWithFiltering(projectedMap, textureSize, direction, nextLod);
|
|
|
|
return mix(colorNextLod, colorCurrentLod, nextLod - lod);
|
|
}
|
|
`,vK=`/**
|
|
* Adjusts the saturation of a color.
|
|
*
|
|
* @name czm_saturation
|
|
* @glslFunction
|
|
*
|
|
* @param {vec3} rgb The color.
|
|
* @param {float} adjustment The amount to adjust the saturation of the color.
|
|
*
|
|
* @returns {float} The color with the saturation adjusted.
|
|
*
|
|
* @example
|
|
* vec3 greyScale = czm_saturation(color, 0.0);
|
|
* vec3 doubleSaturation = czm_saturation(color, 2.0);
|
|
*/
|
|
vec3 czm_saturation(vec3 rgb, float adjustment)
|
|
{
|
|
// Algorithm from Chapter 16 of OpenGL Shading Language
|
|
const vec3 W = vec3(0.2125, 0.7154, 0.0721);
|
|
vec3 intensity = vec3(dot(rgb, W));
|
|
return mix(intensity, rgb, adjustment);
|
|
}
|
|
`,IK=`
|
|
float czm_sampleShadowMap(highp samplerCube shadowMap, vec3 d)
|
|
{
|
|
return czm_unpackDepth(czm_textureCube(shadowMap, d));
|
|
}
|
|
|
|
float czm_sampleShadowMap(highp sampler2D shadowMap, vec2 uv)
|
|
{
|
|
#ifdef USE_SHADOW_DEPTH_TEXTURE
|
|
return texture(shadowMap, uv).r;
|
|
#else
|
|
return czm_unpackDepth(texture(shadowMap, uv));
|
|
#endif
|
|
}
|
|
|
|
float czm_shadowDepthCompare(samplerCube shadowMap, vec3 uv, float depth)
|
|
{
|
|
return step(depth, czm_sampleShadowMap(shadowMap, uv));
|
|
}
|
|
|
|
float czm_shadowDepthCompare(sampler2D shadowMap, vec2 uv, float depth)
|
|
{
|
|
return step(depth, czm_sampleShadowMap(shadowMap, uv));
|
|
}
|
|
`,DK=`
|
|
float czm_private_shadowVisibility(float visibility, float nDotL, float normalShadingSmooth, float darkness)
|
|
{
|
|
#ifdef USE_NORMAL_SHADING
|
|
#ifdef USE_NORMAL_SHADING_SMOOTH
|
|
float strength = clamp(nDotL / normalShadingSmooth, 0.0, 1.0);
|
|
#else
|
|
float strength = step(0.0, nDotL);
|
|
#endif
|
|
visibility *= strength;
|
|
#endif
|
|
|
|
visibility = max(visibility, darkness);
|
|
return visibility;
|
|
}
|
|
|
|
#ifdef USE_CUBE_MAP_SHADOW
|
|
float czm_shadowVisibility(samplerCube shadowMap, czm_shadowParameters shadowParameters)
|
|
{
|
|
float depthBias = shadowParameters.depthBias;
|
|
float depth = shadowParameters.depth;
|
|
float nDotL = shadowParameters.nDotL;
|
|
float normalShadingSmooth = shadowParameters.normalShadingSmooth;
|
|
float darkness = shadowParameters.darkness;
|
|
vec3 uvw = shadowParameters.texCoords;
|
|
|
|
depth -= depthBias;
|
|
float visibility = czm_shadowDepthCompare(shadowMap, uvw, depth);
|
|
return czm_private_shadowVisibility(visibility, nDotL, normalShadingSmooth, darkness);
|
|
}
|
|
#else
|
|
float czm_shadowVisibility(sampler2D shadowMap, czm_shadowParameters shadowParameters)
|
|
{
|
|
float depthBias = shadowParameters.depthBias;
|
|
float depth = shadowParameters.depth;
|
|
float nDotL = shadowParameters.nDotL;
|
|
float normalShadingSmooth = shadowParameters.normalShadingSmooth;
|
|
float darkness = shadowParameters.darkness;
|
|
vec2 uv = shadowParameters.texCoords;
|
|
|
|
depth -= depthBias;
|
|
#ifdef USE_SOFT_SHADOWS
|
|
vec2 texelStepSize = shadowParameters.texelStepSize;
|
|
float radius = 1.0;
|
|
float dx0 = -texelStepSize.x * radius;
|
|
float dy0 = -texelStepSize.y * radius;
|
|
float dx1 = texelStepSize.x * radius;
|
|
float dy1 = texelStepSize.y * radius;
|
|
float visibility = (
|
|
czm_shadowDepthCompare(shadowMap, uv, depth) +
|
|
czm_shadowDepthCompare(shadowMap, uv + vec2(dx0, dy0), depth) +
|
|
czm_shadowDepthCompare(shadowMap, uv + vec2(0.0, dy0), depth) +
|
|
czm_shadowDepthCompare(shadowMap, uv + vec2(dx1, dy0), depth) +
|
|
czm_shadowDepthCompare(shadowMap, uv + vec2(dx0, 0.0), depth) +
|
|
czm_shadowDepthCompare(shadowMap, uv + vec2(dx1, 0.0), depth) +
|
|
czm_shadowDepthCompare(shadowMap, uv + vec2(dx0, dy1), depth) +
|
|
czm_shadowDepthCompare(shadowMap, uv + vec2(0.0, dy1), depth) +
|
|
czm_shadowDepthCompare(shadowMap, uv + vec2(dx1, dy1), depth)
|
|
) * (1.0 / 9.0);
|
|
#else
|
|
float visibility = czm_shadowDepthCompare(shadowMap, uv, depth);
|
|
#endif
|
|
|
|
return czm_private_shadowVisibility(visibility, nDotL, normalShadingSmooth, darkness);
|
|
}
|
|
#endif
|
|
`,PK=`/**
|
|
* Returns 1.0 if the given value is positive or zero, and -1.0 if it is negative. This is similar to the GLSL
|
|
* built-in function <code>sign</code> except that returns 1.0 instead of 0.0 when the input value is 0.0.
|
|
*
|
|
* @name czm_signNotZero
|
|
* @glslFunction
|
|
*
|
|
* @param {} value The value for which to determine the sign.
|
|
* @returns {} 1.0 if the value is positive or zero, -1.0 if the value is negative.
|
|
*/
|
|
float czm_signNotZero(float value)
|
|
{
|
|
return value >= 0.0 ? 1.0 : -1.0;
|
|
}
|
|
|
|
vec2 czm_signNotZero(vec2 value)
|
|
{
|
|
return vec2(czm_signNotZero(value.x), czm_signNotZero(value.y));
|
|
}
|
|
|
|
vec3 czm_signNotZero(vec3 value)
|
|
{
|
|
return vec3(czm_signNotZero(value.x), czm_signNotZero(value.y), czm_signNotZero(value.z));
|
|
}
|
|
|
|
vec4 czm_signNotZero(vec4 value)
|
|
{
|
|
return vec4(czm_signNotZero(value.x), czm_signNotZero(value.y), czm_signNotZero(value.z), czm_signNotZero(value.w));
|
|
}
|
|
`,OK=`/**
|
|
* Computes a color from the third order spherical harmonic coefficients and a normalized direction vector.
|
|
* <p>
|
|
* The order of the coefficients is [L00, L1_1, L10, L11, L2_2, L2_1, L20, L21, L22].
|
|
* </p>
|
|
*
|
|
* @name czm_sphericalHarmonics
|
|
* @glslFunction
|
|
*
|
|
* @param {vec3} normal The normalized direction.
|
|
* @param {vec3[9]} coefficients The third order spherical harmonic coefficients.
|
|
* @returns {vec3} The color at the direction.
|
|
*
|
|
* @see https://graphics.stanford.edu/papers/envmap/envmap.pdf
|
|
*/
|
|
vec3 czm_sphericalHarmonics(vec3 normal, vec3 coefficients[9])
|
|
{
|
|
vec3 L00 = coefficients[0];
|
|
vec3 L1_1 = coefficients[1];
|
|
vec3 L10 = coefficients[2];
|
|
vec3 L11 = coefficients[3];
|
|
vec3 L2_2 = coefficients[4];
|
|
vec3 L2_1 = coefficients[5];
|
|
vec3 L20 = coefficients[6];
|
|
vec3 L21 = coefficients[7];
|
|
vec3 L22 = coefficients[8];
|
|
|
|
float x = normal.x;
|
|
float y = normal.y;
|
|
float z = normal.z;
|
|
|
|
return
|
|
L00
|
|
+ L1_1 * y
|
|
+ L10 * z
|
|
+ L11 * x
|
|
+ L2_2 * (y * x)
|
|
+ L2_1 * (y * z)
|
|
+ L20 * (3.0 * z * z - 1.0)
|
|
+ L21 * (z * x)
|
|
+ L22 * (x * x - y * y);
|
|
}
|
|
`,LK=`/**
|
|
* Converts an sRGB color to a linear RGB color.
|
|
*
|
|
* @param {vec3|vec4} srgbIn The color in sRGB space
|
|
* @returns {vec3|vec4} The color in linear color space. The vector type matches the input.
|
|
*/
|
|
vec3 czm_srgbToLinear(vec3 srgbIn)
|
|
{
|
|
return pow(srgbIn, vec3(2.2));
|
|
}
|
|
|
|
vec4 czm_srgbToLinear(vec4 srgbIn)
|
|
{
|
|
vec3 linearOut = pow(srgbIn.rgb, vec3(2.2));
|
|
return vec4(linearOut, srgbIn.a);
|
|
}
|
|
`,RK=`/**
|
|
* Creates a matrix that transforms vectors from tangent space to eye space.
|
|
*
|
|
* @name czm_tangentToEyeSpaceMatrix
|
|
* @glslFunction
|
|
*
|
|
* @param {vec3} normalEC The normal vector in eye coordinates.
|
|
* @param {vec3} tangentEC The tangent vector in eye coordinates.
|
|
* @param {vec3} bitangentEC The bitangent vector in eye coordinates.
|
|
*
|
|
* @returns {mat3} The matrix that transforms from tangent space to eye space.
|
|
*
|
|
* @example
|
|
* mat3 tangentToEye = czm_tangentToEyeSpaceMatrix(normalEC, tangentEC, bitangentEC);
|
|
* vec3 normal = tangentToEye * texture(normalMap, st).xyz;
|
|
*/
|
|
mat3 czm_tangentToEyeSpaceMatrix(vec3 normalEC, vec3 tangentEC, vec3 bitangentEC)
|
|
{
|
|
vec3 normal = normalize(normalEC);
|
|
vec3 tangent = normalize(tangentEC);
|
|
vec3 bitangent = normalize(bitangentEC);
|
|
return mat3(tangent.x , tangent.y , tangent.z,
|
|
bitangent.x, bitangent.y, bitangent.z,
|
|
normal.x , normal.y , normal.z);
|
|
}
|
|
`,NK=`/**
|
|
* A wrapper around the texture (WebGL2) / textureCube (WebGL1)
|
|
* function to allow for WebGL 1 support.
|
|
*
|
|
* @name czm_textureCube
|
|
* @glslFunction
|
|
*
|
|
* @param {samplerCube} sampler The sampler.
|
|
* @param {vec3} p The coordinates to sample the texture at.
|
|
*/
|
|
vec4 czm_textureCube(samplerCube sampler, vec3 p) {
|
|
#if __VERSION__ == 300
|
|
return texture(sampler, p);
|
|
#else
|
|
return textureCube(sampler, p);
|
|
#endif
|
|
}`,MK=`/**
|
|
* Transforms a plane.
|
|
*
|
|
* @name czm_transformPlane
|
|
* @glslFunction
|
|
*
|
|
* @param {vec4} plane The plane in Hessian Normal Form.
|
|
* @param {mat4} transform The inverse-transpose of a transformation matrix.
|
|
*/
|
|
vec4 czm_transformPlane(vec4 plane, mat4 transform) {
|
|
vec4 transformedPlane = transform * plane;
|
|
// Convert the transformed plane to Hessian Normal Form
|
|
float normalMagnitude = length(transformedPlane.xyz);
|
|
return transformedPlane / normalMagnitude;
|
|
}
|
|
`,FK=`/**
|
|
* Translates a position (or any <code>vec3</code>) that was encoded with {@link EncodedCartesian3},
|
|
* and then provided to the shader as separate <code>high</code> and <code>low</code> bits to
|
|
* be relative to the eye. As shown in the example, the position can then be transformed in eye
|
|
* or clip coordinates using {@link czm_modelViewRelativeToEye} or {@link czm_modelViewProjectionRelativeToEye},
|
|
* respectively.
|
|
* <p>
|
|
* This technique, called GPU RTE, eliminates jittering artifacts when using large coordinates as
|
|
* described in {@link http://help.agi.com/AGIComponents/html/BlogPrecisionsPrecisions.htm|Precisions, Precisions}.
|
|
* </p>
|
|
*
|
|
* @name czm_translateRelativeToEye
|
|
* @glslFunction
|
|
*
|
|
* @param {vec3} high The position's high bits.
|
|
* @param {vec3} low The position's low bits.
|
|
* @returns {vec3} The position translated to be relative to the camera's position.
|
|
*
|
|
* @example
|
|
* in vec3 positionHigh;
|
|
* in vec3 positionLow;
|
|
*
|
|
* void main()
|
|
* {
|
|
* vec4 p = czm_translateRelativeToEye(positionHigh, positionLow);
|
|
* gl_Position = czm_modelViewProjectionRelativeToEye * p;
|
|
* }
|
|
*
|
|
* @see czm_modelViewRelativeToEye
|
|
* @see czm_modelViewProjectionRelativeToEye
|
|
* @see czm_computePosition
|
|
* @see EncodedCartesian3
|
|
*/
|
|
vec4 czm_translateRelativeToEye(vec3 high, vec3 low)
|
|
{
|
|
vec3 highDifference = high - czm_encodedCameraPositionMCHigh;
|
|
// This check handles the case when NaN values have gotten into \`highDifference\`.
|
|
// Such a thing could happen on devices running iOS.
|
|
if (length(highDifference) == 0.0) {
|
|
highDifference = vec3(0);
|
|
}
|
|
vec3 lowDifference = low - czm_encodedCameraPositionMCLow;
|
|
|
|
return vec4(highDifference + lowDifference, 1.0);
|
|
}
|
|
`,BK=`/**
|
|
* @private
|
|
*/
|
|
vec4 czm_translucentPhong(vec3 toEye, czm_material material, vec3 lightDirectionEC)
|
|
{
|
|
// Diffuse from directional light sources at eye (for top-down and horizon views)
|
|
float diffuse = czm_getLambertDiffuse(vec3(0.0, 0.0, 1.0), material.normal);
|
|
|
|
if (czm_sceneMode == czm_sceneMode3D) {
|
|
// (and horizon views in 3D)
|
|
diffuse += czm_getLambertDiffuse(vec3(0.0, 1.0, 0.0), material.normal);
|
|
}
|
|
|
|
diffuse = clamp(diffuse, 0.0, 1.0);
|
|
|
|
float specular = czm_getSpecular(lightDirectionEC, toEye, material.normal, material.shininess);
|
|
|
|
// Temporary workaround for adding ambient.
|
|
vec3 materialDiffuse = material.diffuse * 0.5;
|
|
|
|
vec3 ambient = materialDiffuse;
|
|
vec3 color = ambient + material.emission;
|
|
color += materialDiffuse * diffuse * czm_lightColor;
|
|
color += material.specular * specular * czm_lightColor;
|
|
|
|
return vec4(color, material.alpha);
|
|
}
|
|
`,zK=`/**
|
|
* Returns the transpose of the matrix. The input <code>matrix</code> can be
|
|
* a <code>mat2</code>, <code>mat3</code>, or <code>mat4</code>.
|
|
*
|
|
* @name czm_transpose
|
|
* @glslFunction
|
|
*
|
|
* @param {} matrix The matrix to transpose.
|
|
*
|
|
* @returns {} The transposed matrix.
|
|
*
|
|
* @example
|
|
* // GLSL declarations
|
|
* mat2 czm_transpose(mat2 matrix);
|
|
* mat3 czm_transpose(mat3 matrix);
|
|
* mat4 czm_transpose(mat4 matrix);
|
|
*
|
|
* // Transpose a 3x3 rotation matrix to find its inverse.
|
|
* mat3 eastNorthUpToEye = czm_eastNorthUpToEyeCoordinates(
|
|
* positionMC, normalEC);
|
|
* mat3 eyeToEastNorthUp = czm_transpose(eastNorthUpToEye);
|
|
*/
|
|
mat2 czm_transpose(mat2 matrix)
|
|
{
|
|
return mat2(
|
|
matrix[0][0], matrix[1][0],
|
|
matrix[0][1], matrix[1][1]);
|
|
}
|
|
|
|
mat3 czm_transpose(mat3 matrix)
|
|
{
|
|
return mat3(
|
|
matrix[0][0], matrix[1][0], matrix[2][0],
|
|
matrix[0][1], matrix[1][1], matrix[2][1],
|
|
matrix[0][2], matrix[1][2], matrix[2][2]);
|
|
}
|
|
|
|
mat4 czm_transpose(mat4 matrix)
|
|
{
|
|
return mat4(
|
|
matrix[0][0], matrix[1][0], matrix[2][0], matrix[3][0],
|
|
matrix[0][1], matrix[1][1], matrix[2][1], matrix[3][1],
|
|
matrix[0][2], matrix[1][2], matrix[2][2], matrix[3][2],
|
|
matrix[0][3], matrix[1][3], matrix[2][3], matrix[3][3]);
|
|
}
|
|
`,UK=`vec2 getLookupUv(vec2 dimensions, int i) {
|
|
int pixY = i / int(dimensions.x);
|
|
int pixX = i - (pixY * int(dimensions.x));
|
|
float pixelWidth = 1.0 / dimensions.x;
|
|
float pixelHeight = 1.0 / dimensions.y;
|
|
float u = (float(pixX) + 0.5) * pixelWidth; // sample from center of pixel
|
|
float v = (float(pixY) + 0.5) * pixelHeight;
|
|
return vec2(u, v);
|
|
}
|
|
|
|
vec4 czm_unpackClippingExtents(highp sampler2D extentsTexture, int index) {
|
|
vec2 textureDimensions = vec2(textureSize(extentsTexture, 0));
|
|
return texture(extentsTexture, getLookupUv(textureDimensions, index));
|
|
}`,kK=`/**
|
|
* Unpacks a vec4 depth value to a float in [0, 1) range.
|
|
*
|
|
* @name czm_unpackDepth
|
|
* @glslFunction
|
|
*
|
|
* @param {vec4} packedDepth The packed depth.
|
|
*
|
|
* @returns {float} The floating-point depth in [0, 1) range.
|
|
*/
|
|
float czm_unpackDepth(vec4 packedDepth)
|
|
{
|
|
// See Aras Pranckevi\u010Dius' post Encoding Floats to RGBA
|
|
// http://aras-p.info/blog/2009/07/30/encoding-floats-to-rgba-the-final/
|
|
return dot(packedDepth, vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0));
|
|
}
|
|
`,VK=`/**
|
|
* Unpack an IEEE 754 single-precision float that is packed as a little-endian unsigned normalized vec4.
|
|
*
|
|
* @name czm_unpackFloat
|
|
* @glslFunction
|
|
*
|
|
* @param {vec4} packedFloat The packed float.
|
|
*
|
|
* @returns {float} The floating-point depth in arbitrary range.
|
|
*/
|
|
float czm_unpackFloat(vec4 packedFloat)
|
|
{
|
|
// Convert to [0.0, 255.0] and round to integer
|
|
packedFloat = floor(packedFloat * 255.0 + 0.5);
|
|
float sign = 1.0 - step(128.0, packedFloat[3]) * 2.0;
|
|
float exponent = 2.0 * mod(packedFloat[3], 128.0) + step(128.0, packedFloat[2]) - 127.0;
|
|
if (exponent == -127.0)
|
|
{
|
|
return 0.0;
|
|
}
|
|
float mantissa = mod(packedFloat[2], 128.0) * 65536.0 + packedFloat[1] * 256.0 + packedFloat[0] + float(0x800000);
|
|
float result = sign * exp2(exponent - 23.0) * mantissa;
|
|
return result;
|
|
}
|
|
`,HK=`/**
|
|
* Unpack unsigned integers of 1-4 bytes. in WebGL 1, there is no uint type,
|
|
* so the return value is an int.
|
|
* <p>
|
|
* There are also precision limitations in WebGL 1. highp int is still limited
|
|
* to 24 bits. Above the value of 2^24 = 16777216, precision loss may occur.
|
|
* </p>
|
|
*
|
|
* @param {float|vec2|vec3|vec4} packed The packed value. For vectors, the components are listed in little-endian order.
|
|
*
|
|
* @return {int} The unpacked value.
|
|
*/
|
|
int czm_unpackUint(float packedValue) {
|
|
float rounded = czm_round(packedValue * 255.0);
|
|
return int(rounded);
|
|
}
|
|
|
|
int czm_unpackUint(vec2 packedValue) {
|
|
vec2 rounded = czm_round(packedValue * 255.0);
|
|
return int(dot(rounded, vec2(1.0, 256.0)));
|
|
}
|
|
|
|
int czm_unpackUint(vec3 packedValue) {
|
|
vec3 rounded = czm_round(packedValue * 255.0);
|
|
return int(dot(rounded, vec3(1.0, 256.0, 65536.0)));
|
|
}
|
|
|
|
int czm_unpackUint(vec4 packedValue) {
|
|
vec4 rounded = czm_round(packedValue * 255.0);
|
|
return int(dot(rounded, vec4(1.0, 256.0, 65536.0, 16777216.0)));
|
|
}
|
|
`,GK=`/**
|
|
* Transform metadata values following the EXT_structural_metadata spec
|
|
* by multiplying by scale and adding the offset. Operations are always
|
|
* performed component-wise, even for matrices.
|
|
*
|
|
* @param {float|vec2|vec3|vec4|mat2|mat3|mat4} offset The offset to add
|
|
* @param {float|vec2|vec3|vec4|mat2|mat3|mat4} scale The scale factor to multiply
|
|
* @param {float|vec2|vec3|vec4|mat2|mat3|mat4} value The original value.
|
|
*
|
|
* @return {float|vec2|vec3|vec4|mat2|mat3|mat4} The transformed value of the same scalar/vector/matrix type as the input.
|
|
*/
|
|
float czm_valueTransform(float offset, float scale, float value) {
|
|
return scale * value + offset;
|
|
}
|
|
|
|
vec2 czm_valueTransform(vec2 offset, vec2 scale, vec2 value) {
|
|
return scale * value + offset;
|
|
}
|
|
|
|
vec3 czm_valueTransform(vec3 offset, vec3 scale, vec3 value) {
|
|
return scale * value + offset;
|
|
}
|
|
|
|
vec4 czm_valueTransform(vec4 offset, vec4 scale, vec4 value) {
|
|
return scale * value + offset;
|
|
}
|
|
|
|
mat2 czm_valueTransform(mat2 offset, mat2 scale, mat2 value) {
|
|
return matrixCompMult(scale, value) + offset;
|
|
}
|
|
|
|
mat3 czm_valueTransform(mat3 offset, mat3 scale, mat3 value) {
|
|
return matrixCompMult(scale, value) + offset;
|
|
}
|
|
|
|
mat4 czm_valueTransform(mat4 offset, mat4 scale, mat4 value) {
|
|
return matrixCompMult(scale, value) + offset;
|
|
}
|
|
`,jK=`#ifdef LOG_DEPTH
|
|
// 1.0 at the near plane, increasing linearly from there.
|
|
out float v_depthFromNearPlusOne;
|
|
#ifdef SHADOW_MAP
|
|
out vec3 v_logPositionEC;
|
|
#endif
|
|
#endif
|
|
|
|
vec4 czm_updatePositionDepth(vec4 coords) {
|
|
#if defined(LOG_DEPTH)
|
|
|
|
#ifdef SHADOW_MAP
|
|
vec3 logPositionEC = (czm_inverseProjection * coords).xyz;
|
|
v_logPositionEC = logPositionEC;
|
|
#endif
|
|
|
|
// With the very high far/near ratios used with the logarithmic depth
|
|
// buffer, floating point rounding errors can cause linear depth values
|
|
// to end up on the wrong side of the far plane, even for vertices that
|
|
// are really nowhere near it. Since we always write a correct logarithmic
|
|
// depth value in the fragment shader anyway, we just need to make sure
|
|
// such errors don't cause the primitive to be clipped entirely before
|
|
// we even get to the fragment shader.
|
|
coords.z = clamp(coords.z / coords.w, -1.0, 1.0) * coords.w;
|
|
#endif
|
|
|
|
return coords;
|
|
}
|
|
|
|
/**
|
|
* Writes the logarithmic depth to gl_Position using the already computed gl_Position.
|
|
*
|
|
* @name czm_vertexLogDepth
|
|
* @glslFunction
|
|
*/
|
|
void czm_vertexLogDepth()
|
|
{
|
|
#ifdef LOG_DEPTH
|
|
v_depthFromNearPlusOne = (gl_Position.w - czm_currentFrustum.x) + 1.0;
|
|
gl_Position = czm_updatePositionDepth(gl_Position);
|
|
#endif
|
|
}
|
|
|
|
/**
|
|
* Writes the logarithmic depth to gl_Position using the provided clip coordinates.
|
|
* <p>
|
|
* An example use case for this function would be moving the vertex in window coordinates
|
|
* before converting back to clip coordinates. Use the original vertex clip coordinates.
|
|
* </p>
|
|
* @name czm_vertexLogDepth
|
|
* @glslFunction
|
|
*
|
|
* @param {vec4} clipCoords The vertex in clip coordinates.
|
|
*
|
|
* @example
|
|
* czm_vertexLogDepth(czm_projection * vec4(positionEyeCoordinates, 1.0));
|
|
*/
|
|
void czm_vertexLogDepth(vec4 clipCoords)
|
|
{
|
|
#ifdef LOG_DEPTH
|
|
v_depthFromNearPlusOne = (clipCoords.w - czm_currentFrustum.x) + 1.0;
|
|
czm_updatePositionDepth(clipCoords);
|
|
#endif
|
|
}
|
|
`,WK=`vec4 czm_screenToEyeCoordinates(vec4 screenCoordinate)
|
|
{
|
|
// Reconstruct NDC coordinates
|
|
float x = 2.0 * screenCoordinate.x - 1.0;
|
|
float y = 2.0 * screenCoordinate.y - 1.0;
|
|
float z = (screenCoordinate.z - czm_viewportTransformation[3][2]) / czm_viewportTransformation[2][2];
|
|
vec4 q = vec4(x, y, z, 1.0);
|
|
|
|
// Reverse the perspective division to obtain clip coordinates.
|
|
q /= screenCoordinate.w;
|
|
|
|
// Reverse the projection transformation to obtain eye coordinates.
|
|
if (!(czm_inverseProjection == mat4(0.0))) // IE and Edge sometimes do something weird with != between mat4s
|
|
{
|
|
q = czm_inverseProjection * q;
|
|
}
|
|
else
|
|
{
|
|
float top = czm_frustumPlanes.x;
|
|
float bottom = czm_frustumPlanes.y;
|
|
float left = czm_frustumPlanes.z;
|
|
float right = czm_frustumPlanes.w;
|
|
|
|
float near = czm_currentFrustum.x;
|
|
float far = czm_currentFrustum.y;
|
|
|
|
q.x = (q.x * (right - left) + left + right) * 0.5;
|
|
q.y = (q.y * (top - bottom) + bottom + top) * 0.5;
|
|
q.z = (q.z * (near - far) - near - far) * 0.5;
|
|
q.w = 1.0;
|
|
}
|
|
|
|
return q;
|
|
}
|
|
|
|
/**
|
|
* Transforms a position from window to eye coordinates.
|
|
* The transform from window to normalized device coordinates is done using components
|
|
* of (@link czm_viewport} and {@link czm_viewportTransformation} instead of calculating
|
|
* the inverse of <code>czm_viewportTransformation</code>. The transformation from
|
|
* normalized device coordinates to clip coordinates is done using <code>fragmentCoordinate.w</code>,
|
|
* which is expected to be the scalar used in the perspective divide. The transformation
|
|
* from clip to eye coordinates is done using {@link czm_inverseProjection}.
|
|
*
|
|
* @name czm_windowToEyeCoordinates
|
|
* @glslFunction
|
|
*
|
|
* @param {vec4} fragmentCoordinate The position in window coordinates to transform.
|
|
*
|
|
* @returns {vec4} The transformed position in eye coordinates.
|
|
*
|
|
* @see czm_modelToWindowCoordinates
|
|
* @see czm_eyeToWindowCoordinates
|
|
* @see czm_inverseProjection
|
|
* @see czm_viewport
|
|
* @see czm_viewportTransformation
|
|
*
|
|
* @example
|
|
* vec4 positionEC = czm_windowToEyeCoordinates(gl_FragCoord);
|
|
*/
|
|
vec4 czm_windowToEyeCoordinates(vec4 fragmentCoordinate)
|
|
{
|
|
vec2 screenCoordXY = (fragmentCoordinate.xy - czm_viewport.xy) / czm_viewport.zw;
|
|
return czm_screenToEyeCoordinates(vec4(screenCoordXY, fragmentCoordinate.zw));
|
|
}
|
|
|
|
vec4 czm_screenToEyeCoordinates(vec2 screenCoordinateXY, float depthOrLogDepth)
|
|
{
|
|
// See reverseLogDepth.glsl. This is separate to re-use the pow.
|
|
#if defined(LOG_DEPTH) || defined(LOG_DEPTH_READ_ONLY)
|
|
float near = czm_currentFrustum.x;
|
|
float far = czm_currentFrustum.y;
|
|
float log2Depth = depthOrLogDepth * czm_log2FarDepthFromNearPlusOne;
|
|
float depthFromNear = pow(2.0, log2Depth) - 1.0;
|
|
float depthFromCamera = depthFromNear + near;
|
|
vec4 screenCoord = vec4(screenCoordinateXY, far * (1.0 - near / depthFromCamera) / (far - near), 1.0);
|
|
vec4 eyeCoordinate = czm_screenToEyeCoordinates(screenCoord);
|
|
eyeCoordinate.w = 1.0 / depthFromCamera; // Better precision
|
|
return eyeCoordinate;
|
|
#else
|
|
vec4 screenCoord = vec4(screenCoordinateXY, depthOrLogDepth, 1.0);
|
|
vec4 eyeCoordinate = czm_screenToEyeCoordinates(screenCoord);
|
|
#endif
|
|
return eyeCoordinate;
|
|
}
|
|
|
|
/**
|
|
* Transforms a position given as window x/y and a depth or a log depth from window to eye coordinates.
|
|
* This function produces more accurate results for window positions with log depth than
|
|
* conventionally unpacking the log depth using czm_reverseLogDepth and using the standard version
|
|
* of czm_windowToEyeCoordinates.
|
|
*
|
|
* @name czm_windowToEyeCoordinates
|
|
* @glslFunction
|
|
*
|
|
* @param {vec2} fragmentCoordinateXY The XY position in window coordinates to transform.
|
|
* @param {float} depthOrLogDepth A depth or log depth for the fragment.
|
|
*
|
|
* @see czm_modelToWindowCoordinates
|
|
* @see czm_eyeToWindowCoordinates
|
|
* @see czm_inverseProjection
|
|
* @see czm_viewport
|
|
* @see czm_viewportTransformation
|
|
*
|
|
* @returns {vec4} The transformed position in eye coordinates.
|
|
*/
|
|
vec4 czm_windowToEyeCoordinates(vec2 fragmentCoordinateXY, float depthOrLogDepth)
|
|
{
|
|
vec2 screenCoordXY = (fragmentCoordinateXY.xy - czm_viewport.xy) / czm_viewport.zw;
|
|
return czm_screenToEyeCoordinates(screenCoordXY, depthOrLogDepth);
|
|
}
|
|
`,qK=`// emulated noperspective
|
|
#if !defined(LOG_DEPTH)
|
|
in float v_WindowZ;
|
|
#endif
|
|
|
|
/**
|
|
* Emulates GL_DEPTH_CLAMP. Clamps a fragment to the near and far plane
|
|
* by writing the fragment's depth. See czm_depthClamp for more details.
|
|
*
|
|
* @name czm_writeDepthClamp
|
|
* @glslFunction
|
|
*
|
|
* @example
|
|
* out_FragColor = color;
|
|
* czm_writeDepthClamp();
|
|
*
|
|
* @see czm_depthClamp
|
|
*/
|
|
void czm_writeDepthClamp()
|
|
{
|
|
#if (!defined(LOG_DEPTH) && (__VERSION__ == 300 || defined(GL_EXT_frag_depth)))
|
|
gl_FragDepth = clamp(v_WindowZ * gl_FragCoord.w, 0.0, 1.0);
|
|
#endif
|
|
}
|
|
`,YK=`#ifdef LOG_DEPTH
|
|
in float v_depthFromNearPlusOne;
|
|
|
|
#ifdef POLYGON_OFFSET
|
|
uniform vec2 u_polygonOffset;
|
|
#endif
|
|
|
|
#endif
|
|
|
|
/**
|
|
* Writes the fragment depth to the logarithmic depth buffer.
|
|
* <p>
|
|
* Use this when the vertex shader does not call {@link czm_vertexlogDepth}, for example, when
|
|
* ray-casting geometry using a full screen quad.
|
|
* </p>
|
|
* @name czm_writeLogDepth
|
|
* @glslFunction
|
|
*
|
|
* @param {float} depth The depth coordinate, where 1.0 is on the near plane and
|
|
* depth increases in eye-space units from there
|
|
*
|
|
* @example
|
|
* czm_writeLogDepth((czm_projection * v_positionEyeCoordinates).w + 1.0);
|
|
*/
|
|
void czm_writeLogDepth(float depth)
|
|
{
|
|
#if (defined(LOG_DEPTH) && (__VERSION__ == 300 || defined(GL_EXT_frag_depth)))
|
|
// Discard the vertex if it's not between the near and far planes.
|
|
// We allow a bit of epsilon on the near plane comparison because a 1.0
|
|
// from the vertex shader (indicating the vertex should be _on_ the near
|
|
// plane) will not necessarily come here as exactly 1.0.
|
|
if (depth <= 0.9999999 || depth > czm_farDepthFromNearPlusOne) {
|
|
discard;
|
|
}
|
|
|
|
#ifdef POLYGON_OFFSET
|
|
// Polygon offset: m * factor + r * units
|
|
float factor = u_polygonOffset[0];
|
|
float units = u_polygonOffset[1];
|
|
|
|
#if (__VERSION__ == 300 || defined(GL_OES_standard_derivatives))
|
|
// This factor doesn't work in IE 10
|
|
if (factor != 0.0) {
|
|
// m = sqrt(dZdX^2 + dZdY^2);
|
|
float x = dFdx(depth);
|
|
float y = dFdy(depth);
|
|
float m = sqrt(x * x + y * y);
|
|
|
|
// Apply the factor before computing the log depth.
|
|
depth += m * factor;
|
|
}
|
|
#endif
|
|
|
|
#endif
|
|
|
|
gl_FragDepth = log2(depth) * czm_oneOverLog2FarDepthFromNearPlusOne;
|
|
|
|
#ifdef POLYGON_OFFSET
|
|
// Apply the units after the log depth.
|
|
gl_FragDepth += czm_epsilon7 * units;
|
|
#endif
|
|
|
|
#endif
|
|
}
|
|
|
|
/**
|
|
* Writes the fragment depth to the logarithmic depth buffer.
|
|
* <p>
|
|
* Use this when the vertex shader calls {@link czm_vertexlogDepth}.
|
|
* </p>
|
|
*
|
|
* @name czm_writeLogDepth
|
|
* @glslFunction
|
|
*/
|
|
void czm_writeLogDepth() {
|
|
#ifdef LOG_DEPTH
|
|
czm_writeLogDepth(v_depthFromNearPlusOne);
|
|
#endif
|
|
}
|
|
`,$K=`/**
|
|
* Transforms a value for non-perspective interpolation by multiplying
|
|
* it by w, the value used in the perspective divide. This function is
|
|
* intended to be called in a vertex shader to compute the value of a
|
|
* \`varying\` that should not be subject to perspective interpolation.
|
|
* For example, screen-space texture coordinates. The fragment shader
|
|
* must call {@link czm_readNonPerspective} to retrieve the final
|
|
* non-perspective value.
|
|
*
|
|
* @name czm_writeNonPerspective
|
|
* @glslFunction
|
|
*
|
|
* @param {float|vec2|vec3|vec4} value The value to be interpolated without accounting for perspective.
|
|
* @param {float} w The perspective divide value. Usually this is the computed \`gl_Position.w\`.
|
|
* @returns {float|vec2|vec3|vec4} The transformed value, intended to be stored in a \`varying\` and read in the
|
|
* fragment shader with {@link czm_readNonPerspective}.
|
|
*/
|
|
float czm_writeNonPerspective(float value, float w) {
|
|
return value * w;
|
|
}
|
|
|
|
vec2 czm_writeNonPerspective(vec2 value, float w) {
|
|
return value * w;
|
|
}
|
|
|
|
vec3 czm_writeNonPerspective(vec3 value, float w) {
|
|
return value * w;
|
|
}
|
|
|
|
vec4 czm_writeNonPerspective(vec4 value, float w) {
|
|
return value * w;
|
|
}
|
|
`,ZE={czm_degreesPerRadian:yX,czm_depthRange:bX,czm_epsilon1:TX,czm_epsilon2:AX,czm_epsilon3:xX,czm_epsilon4:CX,czm_epsilon5:EX,czm_epsilon6:wX,czm_epsilon7:SX,czm_infinity:vX,czm_oneOverPi:IX,czm_oneOverTwoPi:DX,czm_passCesium3DTile:PX,czm_passCesium3DTileClassification:OX,czm_passCesium3DTileClassificationIgnoreShow:LX,czm_passClassification:RX,czm_passCompute:NX,czm_passEnvironment:MX,czm_passGlobe:FX,czm_passOpaque:BX,czm_passOverlay:zX,czm_passTerrainClassification:UX,czm_passTranslucent:kX,czm_passVoxels:VX,czm_pi:HX,czm_piOverFour:GX,czm_piOverSix:jX,czm_piOverThree:WX,czm_piOverTwo:qX,czm_radiansPerDegree:YX,czm_sceneMode2D:$X,czm_sceneMode3D:XX,czm_sceneModeColumbusView:QX,czm_sceneModeMorphing:KX,czm_solarRadius:ZX,czm_threePiOver2:JX,czm_twoPi:eQ,czm_webMercatorMaxLatitude:tQ,czm_depthRangeStruct:nQ,czm_material:iQ,czm_materialInput:oQ,czm_modelMaterial:rQ,czm_modelVertexOutput:sQ,czm_pbrParameters:aQ,czm_ray:cQ,czm_raySegment:lQ,czm_shadowParameters:uQ,czm_HSBToRGB:dQ,czm_HSLToRGB:hQ,czm_RGBToHSB:fQ,czm_RGBToHSL:pQ,czm_RGBToXYZ:mQ,czm_XYZToRGB:_Q,czm_acesTonemapping:gQ,czm_alphaWeight:yQ,czm_antialias:bQ,czm_applyHSBShift:TQ,czm_approximateSphericalCoordinates:AQ,czm_approximateTanh:xQ,czm_backFacing:CQ,czm_branchFreeTernary:EQ,czm_cascadeColor:wQ,czm_cascadeDistance:SQ,czm_cascadeMatrix:vQ,czm_cascadeWeights:IQ,czm_clipPolygons:DQ,czm_columbusViewMorph:PQ,czm_computeAtmosphereColor:OQ,czm_computeGroundAtmosphereScattering:LQ,czm_computePosition:RQ,czm_computeScattering:NQ,czm_cosineAndSine:MQ,czm_decompressTextureCoordinates:FQ,czm_defaultPbrMaterial:BQ,czm_depthClamp:zQ,czm_eastNorthUpToEyeCoordinates:UQ,czm_ellipsoidContainsPoint:kQ,czm_ellipsoidWgs84TextureCoordinates:VQ,czm_equalsEpsilon:HQ,czm_eyeOffset:GQ,czm_eyeToWindowCoordinates:jQ,czm_fastApproximateAtan:WQ,czm_fog:qQ,czm_gammaCorrect:YQ,czm_geodeticSurfaceNormal:$Q,czm_getDefaultMaterial:XQ,czm_getDynamicAtmosphereLightDirection:QQ,czm_getLambertDiffuse:KQ,czm_getSpecular:ZQ,czm_getWaterNoise:JQ,czm_hue:eK,czm_inverseGamma:tK,czm_isEmpty:nK,czm_isFull:iK,czm_latitudeToWebMercatorFraction:oK,czm_lineDistance:rK,czm_linearToSrgb:sK,czm_luminance:aK,czm_metersPerPixel:cK,czm_modelToWindowCoordinates:lK,czm_multiplyWithColorBalance:uK,czm_nearFarScalar:dK,czm_octDecode:hK,czm_packDepth:fK,czm_pbrLighting:pK,czm_pbrMetallicRoughnessMaterial:mK,czm_pbrSpecularGlossinessMaterial:_K,czm_phong:gK,czm_planeDistance:yK,czm_pointAlongRay:bK,czm_rayEllipsoidIntersectionInterval:TK,czm_raySphereIntersectionInterval:AK,czm_readDepth:xK,czm_readNonPerspective:CK,czm_reverseLogDepth:EK,czm_round:wK,czm_sampleOctahedralProjection:SK,czm_saturation:vK,czm_shadowDepthCompare:IK,czm_shadowVisibility:DK,czm_signNotZero:PK,czm_sphericalHarmonics:OK,czm_srgbToLinear:LK,czm_tangentToEyeSpaceMatrix:RK,czm_textureCube:NK,czm_transformPlane:MK,czm_translateRelativeToEye:FK,czm_translucentPhong:BK,czm_transpose:zK,czm_unpackClippingExtents:UK,czm_unpackDepth:kK,czm_unpackFloat:VK,czm_unpackUint:HK,czm_valueTransform:GK,czm_vertexLogDepth:jK,czm_windowToEyeCoordinates:WK,czm_writeDepthClamp:qK,czm_writeLogDepth:YK,czm_writeNonPerspective:$K};function XK(e,t){let n=e;return n=n.replaceAll("version 300 es",""),n=n.replaceAll(/(texture\()/g,"texture2D("),t?(n=n.replaceAll(/\n\s*(in)\s+(vec\d|mat\d|float)/g,`
|
|
varying $2`),/out_FragData_(\d+)/.test(n)&&(n=`#extension GL_EXT_draw_buffers : enable
|
|
${n}`,n=n.replaceAll(/layout\s+\(location\s*=\s*\d+\)\s*out\s+vec4\s+out_FragData_\d+;/g,""),n=n.replaceAll(/out_FragData_(\d+)/g,"gl_FragData[$1]")),n=n.replaceAll(/layout\s+\(location\s*=\s*0\)\s*out\s+vec4\s+out_FragColor;/g,""),n=n.replaceAll(/out_FragColor/g,"gl_FragColor"),n=n.replaceAll(/out_FragColor\[(\d+)\]/g,"gl_FragColor[$1]"),/gl_FragDepth/.test(n)&&(n=`#extension GL_EXT_frag_depth : enable
|
|
${n}`,n=n.replaceAll(/gl_FragDepth/g,"gl_FragDepthEXT")),n=`#ifdef GL_OES_standard_derivatives
|
|
#extension GL_OES_standard_derivatives : enable
|
|
#endif
|
|
${n}`):(n=n.replaceAll(/(in)\s+(vec\d|mat\d|float)/g,"attribute $2"),n=n.replaceAll(/(out)\s+(vec\d|mat\d|float)\s+([\w]+);/g,"varying $2 $3;")),n=`#version 100
|
|
${n}`,n}function Tk(e){return e=e.replace(/\/\/.*/g,""),e.replace(/\/\*\*[\s\S]*?\*\//gm,function(t){const n=t.match(/\n/gm).length;let i="";for(let o=0;o<n;++o)i+=`
|
|
`;return i})}function Ak(e,t,n){let i;for(let o=0;o<n.length;++o)n[o].name===e&&(i=n[o]);return c(i)||(t=Tk(t),i={name:e,glslSource:t,dependsOn:[],requiredBy:[],evaluated:!1},n.push(i)),i}function xk(e,t){if(e.evaluated)return;e.evaluated=!0;let n=e.glslSource.match(/\bczm_[a-zA-Z0-9_]*/g);c(n)&&n!==null&&(n=n.filter(function(i,o){return n.indexOf(i)===o}),n.forEach(function(i){if(i!==e.name&&Oe._czmBuiltinsAndUniforms.hasOwnProperty(i)){const o=Ak(i,Oe._czmBuiltinsAndUniforms[i],t);e.dependsOn.push(o),o.requiredBy.push(e),xk(o,t)}}))}function QK(e){const t=[],n=[];for(;e.length>0;){const o=e.pop();n.push(o),o.requiredBy.length===0&&t.push(o)}for(;t.length>0;){const o=t.shift();e.push(o);for(let r=0;r<o.dependsOn.length;++r){const s=o.dependsOn[r],a=s.requiredBy.indexOf(o);s.requiredBy.splice(a,1),s.requiredBy.length===0&&t.push(s)}}const i=[];for(let o=0;o<n.length;++o)n[o].requiredBy.length!==0&&i.push(n[o]);if(i.length!==0){let o=`A circular dependency was found in the following built-in functions/structs/constants:
|
|
`;for(let r=0;r<i.length;++r)o=`${o+i[r].name}
|
|
`;throw new E(o)}}function KK(e){const t=[],n=Ak("main",e,t);xk(n,t),QK(t);let i="";for(let o=t.length-1;o>=0;--o)i=`${i+t[o].glslSource}
|
|
`;return i.replace(n.glslSource,"")}function Ck(e,t,n){let i,o,r="";const s=e.sources;if(c(s))for(i=0,o=s.length;i<o;++i)r+=`
|
|
#line 0
|
|
${s[i]}`;r=Tk(r);let a;r=r.replace(/#version\s+(.*?)\n/gm,function(b,T){if(c(a)&&a!==T)throw new E(`inconsistent versions found: ${a} and ${T}`);return a=T,`
|
|
`});const l=[];r=r.replace(/#extension.*\n/gm,function(b){return l.push(b),`
|
|
`}),r=r.replace(/precision\s(lowp|mediump|highp)\s(float|int);/,"");const u=e.pickColorQualifier;c(u)&&(r=Oe.createPickFragmentShaderSource(r,u));let h="";const f=l.length;for(i=0;i<f;i++)h+=l[i];t&&(h+=`#ifdef GL_FRAGMENT_PRECISION_HIGH
|
|
precision highp float;
|
|
precision highp int;
|
|
#else
|
|
precision mediump float;
|
|
precision mediump int;
|
|
#define highp mediump
|
|
#endif
|
|
|
|
`);const _=e.defines;if(c(_))for(i=0,o=_.length;i<o;++i){const b=_[i];b.length!==0&&(h+=`#define ${b}
|
|
`)}n.textureFloatLinear&&(h+=`#define OES_texture_float_linear
|
|
|
|
`),n.floatingPointTexture&&(h+=`#define OES_texture_float
|
|
|
|
`);let g="";e.includeBuiltIns&&(g=KK(r)),h+=`
|
|
#line 0
|
|
`;const m=g+r;return n.webgl2&&t&&!/layout\s*\(location\s*=\s*0\)\s*out\s+vec4\s+out_FragColor;/g.test(m)&&!/czm_out_FragColor/g.test(m)&&/out_FragColor/g.test(m)&&(h+=`layout(location = 0) out vec4 out_FragColor;
|
|
|
|
`),h+=g,h+=r,n.webgl2?h=`#version 300 es
|
|
${h}`:h=XK(h,t),h}function Oe(e){e=y(e,y.EMPTY_OBJECT);const t=e.pickColorQualifier;if(c(t)&&t!=="uniform"&&t!=="in")throw new E("options.pickColorQualifier must be 'uniform' or 'in'.");this.defines=c(e.defines)?e.defines.slice(0):[],this.sources=c(e.sources)?e.sources.slice(0):[],this.pickColorQualifier=t,this.includeBuiltIns=y(e.includeBuiltIns,!0)}Oe.prototype.clone=function(){return new Oe({sources:this.sources,defines:this.defines,pickColorQualifier:this.pickColorQualifier,includeBuiltIns:this.includeBuiltIns})};Oe.replaceMain=function(e,t){return t=`void ${t}()`,e.replace(/void\s+main\s*\(\s*(?:void)?\s*\)/g,t)};Oe.prototype.getCacheKey=function(){const t=this.defines.slice().sort().join(","),n=this.pickColorQualifier,i=this.includeBuiltIns,o=this.sources.join(`
|
|
`);return`${t}:${n}:${i}:${o}`};Oe.prototype.createCombinedVertexShader=function(e){return Ck(this,!1,e)};Oe.prototype.createCombinedFragmentShader=function(e){return Ck(this,!0,e)};Oe._czmBuiltinsAndUniforms={};for(const e in ZE)ZE.hasOwnProperty(e)&&(Oe._czmBuiltinsAndUniforms[e]=ZE[e]);for(const e in DA)if(DA.hasOwnProperty(e)){const t=DA[e];typeof t.getDeclaration=="function"&&(Oe._czmBuiltinsAndUniforms[e]=t.getDeclaration(e))}Oe.createPickVertexShaderSource=function(e){return`${Oe.replaceMain(e,"czm_old_main")}
|
|
in vec4 pickColor;
|
|
out vec4 czm_pickColor;
|
|
void main()
|
|
{
|
|
czm_old_main();
|
|
czm_pickColor = pickColor;
|
|
}`};Oe.createPickFragmentShaderSource=function(e,t){const n=Oe.replaceMain(e,"czm_old_main"),i=`${t} vec4 czm_pickColor;
|
|
void main()
|
|
{
|
|
czm_old_main();
|
|
if (out_FragColor.a == 0.0) {
|
|
discard;
|
|
}
|
|
out_FragColor = czm_pickColor;
|
|
}`;return`${n}
|
|
${i}`};function ZK(e,t){const n=e.defines,i=n.length;for(let o=0;o<i;++o)if(n[o]===t)return!0;return!1}function Ek(e,t){const n=e.sources,i=n.length;for(let o=0;o<i;++o)if(n[o].indexOf(t)!==-1)return!0;return!1}function wk(e,t){const n=t.length;for(let i=0;i<n;++i){const o=t[i];if(Ek(e,o))return o}}const JK=["v_normalEC","v_normal"];Oe.findNormalVarying=function(e){return Ek(e,"#ifdef HAS_NORMALS")?ZK(e,"HAS_NORMALS")?"v_normalEC":void 0:wk(e,JK)};const eZ=["v_positionEC"];Oe.findPositionVarying=function(e){return wk(e,eZ)};function vl(e){this._context=e,this._shaders={},this._numberOfShaders=0,this._shadersToRelease={}}Object.defineProperties(vl.prototype,{numberOfShaders:{get:function(){return this._numberOfShaders}}});vl.prototype.replaceShaderProgram=function(e){return c(e.shaderProgram)&&e.shaderProgram.destroy(),this.getShaderProgram(e)};function tZ(e){const t=Object.keys(e).sort();return JSON.stringify(e,t)}vl.prototype.getShaderProgram=function(e){let t=e.vertexShaderSource,n=e.fragmentShaderSource;const i=e.attributeLocations;typeof t=="string"&&(t=new Oe({sources:[t]})),typeof n=="string"&&(n=new Oe({sources:[n]}));const o=t.getCacheKey(),r=n.getCacheKey(),s=c(i)?tZ(i):"",a=`${o}:${r}:${s}`;let l;if(c(this._shaders[a]))l=this._shaders[a],delete this._shadersToRelease[a];else{const u=this._context,h=t.createCombinedVertexShader(u),f=n.createCombinedFragmentShader(u),_=new Jt({gl:u._gl,logShaderCompilation:u.logShaderCompilation,debugShaders:u.debugShaders,vertexShaderSource:t,vertexShaderText:h,fragmentShaderSource:n,fragmentShaderText:f,attributeLocations:i});l={cache:this,shaderProgram:_,keyword:a,derivedKeywords:[],count:0},_._cachedShader=l,this._shaders[a]=l,++this._numberOfShaders}return++l.count,l.shaderProgram};vl.prototype.replaceDerivedShaderProgram=function(e,t,n){const i=e._cachedShader,o=t+i.keyword,r=this._shaders[o];if(c(r)){PP(this,r);const s=i.derivedKeywords.indexOf(t);s>-1&&i.derivedKeywords.splice(s,1)}return this.createDerivedShaderProgram(e,t,n)};vl.prototype.getDerivedShaderProgram=function(e,t){const n=e._cachedShader,i=t+n.keyword,o=this._shaders[i];if(!!c(o))return o.shaderProgram};vl.prototype.createDerivedShaderProgram=function(e,t,n){const i=e._cachedShader,o=t+i.keyword;let r=n.vertexShaderSource,s=n.fragmentShaderSource;const a=n.attributeLocations;typeof r=="string"&&(r=new Oe({sources:[r]})),typeof s=="string"&&(s=new Oe({sources:[s]}));const l=this._context,u=r.createCombinedVertexShader(l),h=s.createCombinedFragmentShader(l),f=new Jt({gl:l._gl,logShaderCompilation:l.logShaderCompilation,debugShaders:l.debugShaders,vertexShaderSource:r,vertexShaderText:u,fragmentShaderSource:s,fragmentShaderText:h,attributeLocations:a}),_={cache:this,shaderProgram:f,keyword:o,derivedKeywords:[],count:0};return i.derivedKeywords.push(t),f._cachedShader=_,this._shaders[o]=_,f};function PP(e,t){const n=t.derivedKeywords,i=n.length;for(let o=0;o<i;++o){const r=n[o]+t.keyword,s=e._shaders[r];PP(e,s)}delete e._shaders[t.keyword],t.shaderProgram.finalDestroy()}vl.prototype.destroyReleasedShaderPrograms=function(){const e=this._shadersToRelease;for(const t in e)if(e.hasOwnProperty(t)){const n=e[t];PP(this,n),--this._numberOfShaders}this._shadersToRelease={}};vl.prototype.releaseShaderProgram=function(e){if(c(e)){const t=e._cachedShader;t&&--t.count===0&&(this._shadersToRelease[t.keyword]=t)}};vl.prototype.isDestroyed=function(){return!1};vl.prototype.destroy=function(){const e=this._shaders;for(const t in e)e.hasOwnProperty(t)&&e[t].shaderProgram.finalDestroy();return ve(this)};function xt(e){e=y(e,y.EMPTY_OBJECT),A.defined("options.context",e.context);const t=e.context;let n=e.width,i=e.height;const o=e.source;c(o)&&(c(n)||(n=y(o.videoWidth,o.width)),c(i)||(i=y(o.videoHeight,o.height)));const r=y(e.pixelFormat,Ve.RGBA),s=y(e.pixelDatatype,Me.UNSIGNED_BYTE),a=Ve.toInternalFormat(r,s,t),l=Ve.isCompressedFormat(a);if(!c(n)||!c(i))throw new E("options requires a source field to create an initialized texture or width and height fields to create a blank texture.");if(A.typeOf.number.greaterThan("width",n,0),n>pt.maximumTextureSize)throw new E(`Width must be less than or equal to the maximum texture size (${pt.maximumTextureSize}). Check maximumTextureSize.`);if(A.typeOf.number.greaterThan("height",i,0),i>pt.maximumTextureSize)throw new E(`Height must be less than or equal to the maximum texture size (${pt.maximumTextureSize}). Check maximumTextureSize.`);if(!Ve.validate(r))throw new E("Invalid options.pixelFormat.");if(!l&&!Me.validate(s))throw new E("Invalid options.pixelDatatype.");if(r===Ve.DEPTH_COMPONENT&&s!==Me.UNSIGNED_SHORT&&s!==Me.UNSIGNED_INT)throw new E("When options.pixelFormat is DEPTH_COMPONENT, options.pixelDatatype must be UNSIGNED_SHORT or UNSIGNED_INT.");if(r===Ve.DEPTH_STENCIL&&s!==Me.UNSIGNED_INT_24_8)throw new E("When options.pixelFormat is DEPTH_STENCIL, options.pixelDatatype must be UNSIGNED_INT_24_8.");if(s===Me.FLOAT&&!t.floatingPointTexture)throw new E("When options.pixelDatatype is FLOAT, this WebGL implementation must support the OES_texture_float extension. Check context.floatingPointTexture.");if(s===Me.HALF_FLOAT&&!t.halfFloatingPointTexture)throw new E("When options.pixelDatatype is HALF_FLOAT, this WebGL implementation must support the OES_texture_half_float extension. Check context.halfFloatingPointTexture.");if(Ve.isDepthFormat(r)){if(c(o))throw new E("When options.pixelFormat is DEPTH_COMPONENT or DEPTH_STENCIL, source cannot be provided.");if(!t.depthTexture)throw new E("When options.pixelFormat is DEPTH_COMPONENT or DEPTH_STENCIL, this WebGL implementation must support WEBGL_depth_texture. Check context.depthTexture.")}if(l){if(!c(o)||!c(o.arrayBufferView))throw new E("When options.pixelFormat is compressed, options.source.arrayBufferView must be defined.");if(Ve.isDXTFormat(a)&&!t.s3tc)throw new E("When options.pixelFormat is S3TC compressed, this WebGL implementation must support the WEBGL_compressed_texture_s3tc extension. Check context.s3tc.");if(Ve.isPVRTCFormat(a)&&!t.pvrtc)throw new E("When options.pixelFormat is PVRTC compressed, this WebGL implementation must support the WEBGL_compressed_texture_pvrtc extension. Check context.pvrtc.");if(Ve.isASTCFormat(a)&&!t.astc)throw new E("When options.pixelFormat is ASTC compressed, this WebGL implementation must support the WEBGL_compressed_texture_astc extension. Check context.astc.");if(Ve.isETC2Format(a)&&!t.etc)throw new E("When options.pixelFormat is ETC2 compressed, this WebGL implementation must support the WEBGL_compressed_texture_etc extension. Check context.etc.");if(Ve.isETC1Format(a)&&!t.etc1)throw new E("When options.pixelFormat is ETC1 compressed, this WebGL implementation must support the WEBGL_compressed_texture_etc1 extension. Check context.etc1.");if(Ve.isBC7Format(a)&&!t.bc7)throw new E("When options.pixelFormat is BC7 compressed, this WebGL implementation must support the EXT_texture_compression_bptc extension. Check context.bc7.");if(Ve.compressedTextureSizeInBytes(a,n,i)!==o.arrayBufferView.byteLength)throw new E("The byte length of the array buffer is invalid for the compressed texture with the given width and height.")}const u=e.preMultiplyAlpha||r===Ve.RGB||r===Ve.LUMINANCE,h=y(e.flipY,!0),f=y(e.skipColorSpaceConversion,!1);let _=!0;const g=t._gl,m=g.TEXTURE_2D,b=g.createTexture();g.activeTexture(g.TEXTURE0),g.bindTexture(m,b);let T=4;if(c(o)&&c(o.arrayBufferView)&&!l&&(T=Ve.alignmentInBytes(r,s,n)),g.pixelStorei(g.UNPACK_ALIGNMENT,T),f?g.pixelStorei(g.UNPACK_COLORSPACE_CONVERSION_WEBGL,g.NONE):g.pixelStorei(g.UNPACK_COLORSPACE_CONVERSION_WEBGL,g.BROWSER_DEFAULT_WEBGL),c(o))if(c(o.arrayBufferView)){g.pixelStorei(g.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),g.pixelStorei(g.UNPACK_FLIP_Y_WEBGL,!1);let C=o.arrayBufferView,w,v,P;if(l){if(g.compressedTexImage2D(m,0,a,n,i,0,C),c(o.mipLevels))for(v=n,P=i,w=0;w<o.mipLevels.length;++w)v=Math.floor(v/2)|0,v<1&&(v=1),P=Math.floor(P/2)|0,P<1&&(P=1),g.compressedTexImage2D(m,w+1,a,v,P,0,o.mipLevels[w])}else if(h&&(C=Ve.flipY(C,r,s,n,i)),g.texImage2D(m,0,a,n,i,0,r,Me.toWebGLConstant(s,t),C),c(o.mipLevels))for(v=n,P=i,w=0;w<o.mipLevels.length;++w)v=Math.floor(v/2)|0,v<1&&(v=1),P=Math.floor(P/2)|0,P<1&&(P=1),g.texImage2D(m,w+1,a,v,P,0,r,Me.toWebGLConstant(s,t),o.mipLevels[w])}else c(o.framebuffer)?(g.pixelStorei(g.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),g.pixelStorei(g.UNPACK_FLIP_Y_WEBGL,!1),o.framebuffer!==t.defaultFramebuffer&&o.framebuffer._bind(),g.copyTexImage2D(m,0,a,o.xOffset,o.yOffset,n,i,0),o.framebuffer!==t.defaultFramebuffer&&o.framebuffer._unBind()):(g.pixelStorei(g.UNPACK_PREMULTIPLY_ALPHA_WEBGL,u),g.pixelStorei(g.UNPACK_FLIP_Y_WEBGL,h),g.texImage2D(m,0,a,r,Me.toWebGLConstant(s,t),o));else g.texImage2D(m,0,a,n,i,0,r,Me.toWebGLConstant(s,t),null),_=!1;g.bindTexture(m,null);let x;l?x=Ve.compressedTextureSizeInBytes(r,n,i):x=Ve.textureSizeInBytes(r,s,n,i),this._id=Wr(),this._context=t,this._textureFilterAnisotropic=t._textureFilterAnisotropic,this._textureTarget=m,this._texture=b,this._internalFormat=a,this._pixelFormat=r,this._pixelDatatype=s,this._width=n,this._height=i,this._dimensions=new H(n,i),this._hasMipmap=!1,this._sizeInBytes=x,this._preMultiplyAlpha=u,this._flipY=h,this._initialized=_,this._sampler=void 0,this.sampler=c(e.sampler)?e.sampler:new un}xt.create=function(e){return new xt(e)};xt.fromFramebuffer=function(e){e=y(e,y.EMPTY_OBJECT),A.defined("options.context",e.context);const t=e.context,n=t._gl,i=y(e.pixelFormat,Ve.RGB),o=y(e.framebufferXOffset,0),r=y(e.framebufferYOffset,0),s=y(e.width,n.drawingBufferWidth),a=y(e.height,n.drawingBufferHeight),l=e.framebuffer;if(!Ve.validate(i))throw new E("Invalid pixelFormat.");if(Ve.isDepthFormat(i)||Ve.isCompressedFormat(i))throw new E("pixelFormat cannot be DEPTH_COMPONENT, DEPTH_STENCIL or a compressed format.");if(A.defined("options.context",e.context),A.typeOf.number.greaterThanOrEquals("framebufferXOffset",o,0),A.typeOf.number.greaterThanOrEquals("framebufferYOffset",r,0),o+s>n.drawingBufferWidth)throw new E("framebufferXOffset + width must be less than or equal to drawingBufferWidth");if(r+a>n.drawingBufferHeight)throw new E("framebufferYOffset + height must be less than or equal to drawingBufferHeight.");return new xt({context:t,width:s,height:a,pixelFormat:i,source:{framebuffer:c(l)?l:t.defaultFramebuffer,xOffset:o,yOffset:r,width:s,height:a}})};Object.defineProperties(xt.prototype,{id:{get:function(){return this._id}},sampler:{get:function(){return this._sampler},set:function(e){let t=e.minificationFilter,n=e.magnificationFilter;const i=this._context,o=this._pixelFormat,r=this._pixelDatatype,s=t===en.NEAREST_MIPMAP_NEAREST||t===en.NEAREST_MIPMAP_LINEAR||t===en.LINEAR_MIPMAP_NEAREST||t===en.LINEAR_MIPMAP_LINEAR;(r===Me.FLOAT&&!i.textureFloatLinear||r===Me.HALF_FLOAT&&!i.textureHalfFloatLinear)&&(t=s?en.NEAREST_MIPMAP_NEAREST:en.NEAREST,n=Yo.NEAREST),i.webgl2&&Ve.isDepthFormat(o)&&(t=en.NEAREST,n=Yo.NEAREST);const a=i._gl,l=this._textureTarget;a.activeTexture(a.TEXTURE0),a.bindTexture(l,this._texture),a.texParameteri(l,a.TEXTURE_MIN_FILTER,t),a.texParameteri(l,a.TEXTURE_MAG_FILTER,n),a.texParameteri(l,a.TEXTURE_WRAP_S,e.wrapS),a.texParameteri(l,a.TEXTURE_WRAP_T,e.wrapT),c(this._textureFilterAnisotropic)&&a.texParameteri(l,this._textureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,e.maximumAnisotropy),a.bindTexture(l,null),this._sampler=e}},pixelFormat:{get:function(){return this._pixelFormat}},pixelDatatype:{get:function(){return this._pixelDatatype}},dimensions:{get:function(){return this._dimensions}},preMultiplyAlpha:{get:function(){return this._preMultiplyAlpha}},flipY:{get:function(){return this._flipY}},width:{get:function(){return this._width}},height:{get:function(){return this._height}},sizeInBytes:{get:function(){return this._hasMipmap?Math.floor(this._sizeInBytes*4/3):this._sizeInBytes}},_target:{get:function(){return this._textureTarget}}});xt.prototype.copyFrom=function(e){A.defined("options",e);const t=y(e.xOffset,0),n=y(e.yOffset,0);if(A.defined("options.source",e.source),Ve.isDepthFormat(this._pixelFormat))throw new E("Cannot call copyFrom when the texture pixel format is DEPTH_COMPONENT or DEPTH_STENCIL.");if(Ve.isCompressedFormat(this._pixelFormat))throw new E("Cannot call copyFrom with a compressed texture pixel format.");A.typeOf.number.greaterThanOrEquals("xOffset",t,0),A.typeOf.number.greaterThanOrEquals("yOffset",n,0),A.typeOf.number.lessThanOrEquals("xOffset + options.source.width",t+e.source.width,this._width),A.typeOf.number.lessThanOrEquals("yOffset + options.source.height",n+e.source.height,this._height);const i=e.source,o=this._context,r=o._gl,s=this._textureTarget;r.activeTexture(r.TEXTURE0),r.bindTexture(s,this._texture);const a=i.width,l=i.height;let u=i.arrayBufferView;const h=this._width,f=this._height,_=this._internalFormat,g=this._pixelFormat,m=this._pixelDatatype,b=this._preMultiplyAlpha,T=this._flipY,x=y(e.skipColorSpaceConversion,!1);let C=4;c(u)&&(C=Ve.alignmentInBytes(g,m,a)),r.pixelStorei(r.UNPACK_ALIGNMENT,C),x?r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,r.NONE):r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,r.BROWSER_DEFAULT_WEBGL);let w=!1;if(!this._initialized){if(t===0&&n===0&&a===h&&l===f)c(u)?(r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1),T&&(u=Ve.flipY(u,g,m,h,f)),r.texImage2D(s,0,_,h,f,0,g,Me.toWebGLConstant(m,o),u)):(r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,b),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,T),r.texImage2D(s,0,_,g,Me.toWebGLConstant(m,o),i)),w=!0;else{r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1);const v=Ve.createTypedArray(g,m,h,f);r.texImage2D(s,0,_,h,f,0,g,Me.toWebGLConstant(m,o),v)}this._initialized=!0}w||(c(u)?(r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1),T&&(u=Ve.flipY(u,g,m,a,l)),r.texSubImage2D(s,0,t,n,a,l,g,Me.toWebGLConstant(m,o),u)):(r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,b),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,T),r.texSubImage2D(s,0,t,n,g,Me.toWebGLConstant(m,o),i))),r.bindTexture(s,null)};xt.prototype.copyFromFramebuffer=function(e,t,n,i,o,r){if(e=y(e,0),t=y(t,0),n=y(n,0),i=y(i,0),o=y(o,this._width),r=y(r,this._height),Ve.isDepthFormat(this._pixelFormat))throw new E("Cannot call copyFromFramebuffer when the texture pixel format is DEPTH_COMPONENT or DEPTH_STENCIL.");if(this._pixelDatatype===Me.FLOAT)throw new E("Cannot call copyFromFramebuffer when the texture pixel data type is FLOAT.");if(this._pixelDatatype===Me.HALF_FLOAT)throw new E("Cannot call copyFromFramebuffer when the texture pixel data type is HALF_FLOAT.");if(Ve.isCompressedFormat(this._pixelFormat))throw new E("Cannot call copyFrom with a compressed texture pixel format.");A.typeOf.number.greaterThanOrEquals("xOffset",e,0),A.typeOf.number.greaterThanOrEquals("yOffset",t,0),A.typeOf.number.greaterThanOrEquals("framebufferXOffset",n,0),A.typeOf.number.greaterThanOrEquals("framebufferYOffset",i,0),A.typeOf.number.lessThanOrEquals("xOffset + width",e+o,this._width),A.typeOf.number.lessThanOrEquals("yOffset + height",t+r,this._height);const s=this._context._gl,a=this._textureTarget;s.activeTexture(s.TEXTURE0),s.bindTexture(a,this._texture),s.copyTexSubImage2D(a,0,e,t,n,i,o,r),s.bindTexture(a,null),this._initialized=!0};xt.prototype.generateMipmap=function(e){if(e=y(e,v_.DONT_CARE),Ve.isDepthFormat(this._pixelFormat))throw new E("Cannot call generateMipmap when the texture pixel format is DEPTH_COMPONENT or DEPTH_STENCIL.");if(Ve.isCompressedFormat(this._pixelFormat))throw new E("Cannot call generateMipmap with a compressed pixel format.");if(!this._context.webgl2){if(this._width>1&&!R.isPowerOfTwo(this._width))throw new E("width must be a power of two to call generateMipmap() in a WebGL1 context.");if(this._height>1&&!R.isPowerOfTwo(this._height))throw new E("height must be a power of two to call generateMipmap() in a WebGL1 context.")}if(!v_.validate(e))throw new E("hint is invalid.");this._hasMipmap=!0;const t=this._context._gl,n=this._textureTarget;t.hint(t.GENERATE_MIPMAP_HINT,e),t.activeTexture(t.TEXTURE0),t.bindTexture(n,this._texture),t.generateMipmap(n),t.bindTexture(n,null)};xt.prototype.isDestroyed=function(){return!1};xt.prototype.destroy=function(){return this._context._gl.deleteTexture(this._texture),ve(this)};function Rp(){this._textures={},this._numberOfTextures=0,this._texturesToRelease={}}Object.defineProperties(Rp.prototype,{numberOfTextures:{get:function(){return this._numberOfTextures}}});Rp.prototype.getTexture=function(e){const t=this._textures[e];if(!!c(t))return delete this._texturesToRelease[e],++t.count,t.texture};Rp.prototype.addTexture=function(e,t){const n={texture:t,count:1};t.finalDestroy=t.destroy;const i=this;t.destroy=function(){--n.count===0&&(i._texturesToRelease[e]=n)},this._textures[e]=n,++this._numberOfTextures};Rp.prototype.destroyReleasedTextures=function(){const e=this._texturesToRelease;for(const t in e)if(e.hasOwnProperty(t)){const n=e[t];delete this._textures[t],n.texture.finalDestroy(),--this._numberOfTextures}this._texturesToRelease={}};Rp.prototype.isDestroyed=function(){return!1};Rp.prototype.destroy=function(){const e=this._textures;for(const t in e)e.hasOwnProperty(t)&&e[t].texture.finalDestroy();return ve(this)};function rn(){this.high=d.clone(d.ZERO),this.low=d.clone(d.ZERO)}rn.encode=function(e,t){A.typeOf.number("value",e),c(t)||(t={high:0,low:0});let n;return e>=0?(n=Math.floor(e/65536)*65536,t.high=n,t.low=e-n):(n=Math.floor(-e/65536)*65536,t.high=-n,t.low=e+n),t};const Du={high:0,low:0};rn.fromCartesian=function(e,t){A.typeOf.object("cartesian",e),c(t)||(t=new rn);const n=t.high,i=t.low;return rn.encode(e.x,Du),n.x=Du.high,i.x=Du.low,rn.encode(e.y,Du),n.y=Du.high,i.y=Du.low,rn.encode(e.z,Du),n.z=Du.high,i.z=Du.low,t};const JE=new rn;rn.writeElements=function(e,t,n){A.defined("cartesianArray",t),A.typeOf.number("index",n),A.typeOf.number.greaterThanOrEquals("index",n,0),rn.fromCartesian(e,JE);const i=JE.high,o=JE.low;t[n]=i.x,t[n+1]=i.y,t[n+2]=i.z,t[n+3]=o.x,t[n+4]=o.y,t[n+5]=o.z};function _t(e,t){if(A.typeOf.object("normal",e),!R.equalsEpsilon(d.magnitude(e),1,R.EPSILON6))throw new E("normal must be normalized.");A.typeOf.number("distance",t),this.normal=d.clone(e),this.distance=t}_t.fromPointNormal=function(e,t,n){if(A.typeOf.object("point",e),A.typeOf.object("normal",t),!R.equalsEpsilon(d.magnitude(t),1,R.EPSILON6))throw new E("normal must be normalized.");const i=-d.dot(t,e);return c(n)?(d.clone(t,n.normal),n.distance=i,n):new _t(t,i)};const nZ=new d;_t.fromCartesian4=function(e,t){A.typeOf.object("coefficients",e);const n=d.fromCartesian4(e,nZ),i=e.w;if(!R.equalsEpsilon(d.magnitude(n),1,R.EPSILON6))throw new E("normal must be normalized.");return c(t)?(d.clone(n,t.normal),t.distance=i,t):new _t(n,i)};_t.getPointDistance=function(e,t){return A.typeOf.object("plane",e),A.typeOf.object("point",t),d.dot(e.normal,t)+e.distance};const iZ=new d;_t.projectPointOntoPlane=function(e,t,n){A.typeOf.object("plane",e),A.typeOf.object("point",t),c(n)||(n=new d);const i=_t.getPointDistance(e,t),o=d.multiplyByScalar(e.normal,i,iZ);return d.subtract(t,o,n)};const oZ=new L,rZ=new te,sZ=new d;_t.transform=function(e,t,n){A.typeOf.object("plane",e),A.typeOf.object("transform",t);const i=e.normal,o=e.distance,r=L.inverseTranspose(t,oZ);let s=te.fromElements(i.x,i.y,i.z,o,rZ);s=L.multiplyByVector(r,s,s);const a=d.fromCartesian4(s,sZ);return s=te.divideByScalar(s,d.magnitude(a),s),_t.fromCartesian4(s,n)};_t.clone=function(e,t){return A.typeOf.object("plane",e),c(t)?(d.clone(e.normal,t.normal),t.distance=e.distance,t):new _t(e.normal,e.distance)};_t.equals=function(e,t){return A.typeOf.object("left",e),A.typeOf.object("right",t),e.distance===t.distance&&d.equals(e.normal,t.normal)};_t.ORIGIN_XY_PLANE=Object.freeze(new _t(d.UNIT_Z,0));_t.ORIGIN_YZ_PLANE=Object.freeze(new _t(d.UNIT_X,0));_t.ORIGIN_ZX_PLANE=Object.freeze(new _t(d.UNIT_Y,0));function _o(e){this.planes=y(e,[])}const Qy=[new d,new d,new d];d.clone(d.UNIT_X,Qy[0]);d.clone(d.UNIT_Y,Qy[1]);d.clone(d.UNIT_Z,Qy[2]);const Ud=new d,aZ=new d,Sk=new _t(new d(1,0,0),0);_o.fromBoundingSphere=function(e,t){if(!c(e))throw new E("boundingSphere is required.");c(t)||(t=new _o);const n=Qy.length,i=t.planes;i.length=2*n;const o=e.center,r=e.radius;let s=0;for(let a=0;a<n;++a){const l=Qy[a];let u=i[s],h=i[s+1];c(u)||(u=i[s]=new te),c(h)||(h=i[s+1]=new te),d.multiplyByScalar(l,-r,Ud),d.add(o,Ud,Ud),u.x=l.x,u.y=l.y,u.z=l.z,u.w=-d.dot(l,Ud),d.multiplyByScalar(l,r,Ud),d.add(o,Ud,Ud),h.x=-l.x,h.y=-l.y,h.z=-l.z,h.w=-d.dot(d.negate(l,aZ),Ud),s+=2}return t};_o.prototype.computeVisibility=function(e){if(!c(e))throw new E("boundingVolume is required.");const t=this.planes;let n=!1;for(let i=0,o=t.length;i<o;++i){const r=e.intersectPlane(_t.fromCartesian4(t[i],Sk));if(r===Bt.OUTSIDE)return Bt.OUTSIDE;r===Bt.INTERSECTING&&(n=!0)}return n?Bt.INTERSECTING:Bt.INSIDE};_o.prototype.computeVisibilityWithPlaneMask=function(e,t){if(!c(e))throw new E("boundingVolume is required.");if(!c(t))throw new E("parentPlaneMask is required.");if(t===_o.MASK_OUTSIDE||t===_o.MASK_INSIDE)return t;let n=_o.MASK_INSIDE;const i=this.planes;for(let o=0,r=i.length;o<r;++o){const s=o<31?1<<o:0;if(o<31&&(t&s)===0)continue;const a=e.intersectPlane(_t.fromCartesian4(i[o],Sk));if(a===Bt.OUTSIDE)return _o.MASK_OUTSIDE;a===Bt.INTERSECTING&&(n|=s)}return n};_o.MASK_OUTSIDE=4294967295;_o.MASK_INSIDE=0;_o.MASK_INDETERMINATE=2147483647;function Ki(e){e=y(e,y.EMPTY_OBJECT),this.left=e.left,this._left=void 0,this.right=e.right,this._right=void 0,this.top=e.top,this._top=void 0,this.bottom=e.bottom,this._bottom=void 0,this.near=y(e.near,1),this._near=this.near,this.far=y(e.far,5e8),this._far=this.far,this._cullingVolume=new _o,this._orthographicMatrix=new L}function vk(e){if(!c(e.right)||!c(e.left)||!c(e.top)||!c(e.bottom)||!c(e.near)||!c(e.far))throw new E("right, left, top, bottom, near, or far parameters are not set.");if(e.top!==e._top||e.bottom!==e._bottom||e.left!==e._left||e.right!==e._right||e.near!==e._near||e.far!==e._far){if(e.left>e.right)throw new E("right must be greater than left.");if(e.bottom>e.top)throw new E("top must be greater than bottom.");if(e.near<=0||e.near>e.far)throw new E("near must be greater than zero and less than far.");e._left=e.left,e._right=e.right,e._top=e.top,e._bottom=e.bottom,e._near=e.near,e._far=e.far,e._orthographicMatrix=L.computeOrthographicOffCenter(e.left,e.right,e.bottom,e.top,e.near,e.far,e._orthographicMatrix)}}Object.defineProperties(Ki.prototype,{projectionMatrix:{get:function(){return vk(this),this._orthographicMatrix}}});const cZ=new d,lZ=new d,uZ=new d,ew=new d;Ki.prototype.computeCullingVolume=function(e,t,n){if(!c(e))throw new E("position is required.");if(!c(t))throw new E("direction is required.");if(!c(n))throw new E("up is required.");const i=this._cullingVolume.planes,o=this.top,r=this.bottom,s=this.right,a=this.left,l=this.near,u=this.far,h=d.cross(t,n,cZ);d.normalize(h,h);const f=lZ;d.multiplyByScalar(t,l,f),d.add(e,f,f);const _=uZ;d.multiplyByScalar(h,a,_),d.add(f,_,_);let g=i[0];return c(g)||(g=i[0]=new te),g.x=h.x,g.y=h.y,g.z=h.z,g.w=-d.dot(h,_),d.multiplyByScalar(h,s,_),d.add(f,_,_),g=i[1],c(g)||(g=i[1]=new te),g.x=-h.x,g.y=-h.y,g.z=-h.z,g.w=-d.dot(d.negate(h,ew),_),d.multiplyByScalar(n,r,_),d.add(f,_,_),g=i[2],c(g)||(g=i[2]=new te),g.x=n.x,g.y=n.y,g.z=n.z,g.w=-d.dot(n,_),d.multiplyByScalar(n,o,_),d.add(f,_,_),g=i[3],c(g)||(g=i[3]=new te),g.x=-n.x,g.y=-n.y,g.z=-n.z,g.w=-d.dot(d.negate(n,ew),_),g=i[4],c(g)||(g=i[4]=new te),g.x=t.x,g.y=t.y,g.z=t.z,g.w=-d.dot(t,f),d.multiplyByScalar(t,u,_),d.add(e,_,_),g=i[5],c(g)||(g=i[5]=new te),g.x=-t.x,g.y=-t.y,g.z=-t.z,g.w=-d.dot(d.negate(t,ew),_),this._cullingVolume};Ki.prototype.getPixelDimensions=function(e,t,n,i,o){if(vk(this),!c(e)||!c(t))throw new E("Both drawingBufferWidth and drawingBufferHeight are required.");if(e<=0)throw new E("drawingBufferWidth must be greater than zero.");if(t<=0)throw new E("drawingBufferHeight must be greater than zero.");if(!c(n))throw new E("distance is required.");if(!c(i))throw new E("pixelRatio is required.");if(i<=0)throw new E("pixelRatio must be greater than zero.");if(!c(o))throw new E("A result object is required.");const r=this.right-this.left,s=this.top-this.bottom,a=i*r/e,l=i*s/t;return o.x=a,o.y=l,o};Ki.prototype.clone=function(e){return c(e)||(e=new Ki),e.left=this.left,e.right=this.right,e.top=this.top,e.bottom=this.bottom,e.near=this.near,e.far=this.far,e._left=void 0,e._right=void 0,e._top=void 0,e._bottom=void 0,e._near=void 0,e._far=void 0,e};Ki.prototype.equals=function(e){return c(e)&&e instanceof Ki&&this.right===e.right&&this.left===e.left&&this.top===e.top&&this.bottom===e.bottom&&this.near===e.near&&this.far===e.far};Ki.prototype.equalsEpsilon=function(e,t,n){return e===this||c(e)&&e instanceof Ki&&R.equalsEpsilon(this.right,e.right,t,n)&&R.equalsEpsilon(this.left,e.left,t,n)&&R.equalsEpsilon(this.top,e.top,t,n)&&R.equalsEpsilon(this.bottom,e.bottom,t,n)&&R.equalsEpsilon(this.near,e.near,t,n)&&R.equalsEpsilon(this.far,e.far,t,n)};function It(e){e=y(e,y.EMPTY_OBJECT),this._offCenterFrustum=new Ki,this.width=e.width,this._width=void 0,this.aspectRatio=e.aspectRatio,this._aspectRatio=void 0,this.near=y(e.near,1),this._near=this.near,this.far=y(e.far,5e8),this._far=this.far}It.packedLength=4;It.pack=function(e,t,n){return A.typeOf.object("value",e),A.defined("array",t),n=y(n,0),t[n++]=e.width,t[n++]=e.aspectRatio,t[n++]=e.near,t[n]=e.far,t};It.unpack=function(e,t,n){return A.defined("array",e),t=y(t,0),c(n)||(n=new It),n.width=e[t++],n.aspectRatio=e[t++],n.near=e[t++],n.far=e[t],n};function Ih(e){if(!c(e.width)||!c(e.aspectRatio)||!c(e.near)||!c(e.far))throw new E("width, aspectRatio, near, or far parameters are not set.");const t=e._offCenterFrustum;if(e.width!==e._width||e.aspectRatio!==e._aspectRatio||e.near!==e._near||e.far!==e._far){if(e.aspectRatio<0)throw new E("aspectRatio must be positive.");if(e.near<0||e.near>e.far)throw new E("near must be greater than zero and less than far.");e._aspectRatio=e.aspectRatio,e._width=e.width,e._near=e.near,e._far=e.far;const n=1/e.aspectRatio;t.right=e.width*.5,t.left=-t.right,t.top=n*t.right,t.bottom=-t.top,t.near=e.near,t.far=e.far}}Object.defineProperties(It.prototype,{projectionMatrix:{get:function(){return Ih(this),this._offCenterFrustum.projectionMatrix}},offCenterFrustum:{get:function(){return Ih(this),this._offCenterFrustum}}});It.prototype.computeCullingVolume=function(e,t,n){return Ih(this),this._offCenterFrustum.computeCullingVolume(e,t,n)};It.prototype.getPixelDimensions=function(e,t,n,i,o){return Ih(this),this._offCenterFrustum.getPixelDimensions(e,t,n,i,o)};It.prototype.clone=function(e){return c(e)||(e=new It),e.aspectRatio=this.aspectRatio,e.width=this.width,e.near=this.near,e.far=this.far,e._aspectRatio=void 0,e._width=void 0,e._near=void 0,e._far=void 0,this._offCenterFrustum.clone(e._offCenterFrustum),e};It.prototype.equals=function(e){return!c(e)||!(e instanceof It)?!1:(Ih(this),Ih(e),this.width===e.width&&this.aspectRatio===e.aspectRatio&&this._offCenterFrustum.equals(e._offCenterFrustum))};It.prototype.equalsEpsilon=function(e,t,n){return!c(e)||!(e instanceof It)?!1:(Ih(this),Ih(e),R.equalsEpsilon(this.width,e.width,t,n)&&R.equalsEpsilon(this.aspectRatio,e.aspectRatio,t,n)&&this._offCenterFrustum.equalsEpsilon(e._offCenterFrustum,t,n))};const OP={};function dZ(e){const t=6.239996+.0172019696544*e;return .001657*Math.sin(t+.01671*Math.sin(t))}const hZ=32.184,fZ=2451545;function Ik(e,t){t=ie.addSeconds(e,hZ,t);const n=ie.totalDays(t)-fZ;return t=ie.addSeconds(t,dZ(n),t),t}const wx=new ie(2451545,0,fn.TAI),pZ=1e3,rc=R.RADIANS_PER_DEGREE,ma=R.RADIANS_PER_ARCSECOND,qr=14959787e4,KL=new $;function Dk(e,t,n,i,o,r,s){if(n<0&&(n=-n,o+=R.PI),n<0||n>R.PI)throw new E("The inclination is out of range. Inclination must be greater than or equal to zero and less than or equal to Pi radians.");const a=e*(1-t),l=i-o,u=o,h=_Z(r-i,t);if(mZ(t,0)==="Hyperbolic"&&Math.abs(R.negativePiToPi(h))>=Math.acos(-1/t))throw new E("The true anomaly of the hyperbolic orbit lies outside of the bounds of the hyperbola.");TZ(l,n,u,KL);const _=a*(1+t),g=Math.cos(h),m=Math.sin(h),b=1+t*g;if(b<=R.Epsilon10)throw new E("elements cannot be converted to cartesian");const T=_/b;return c(s)?(s.x=T*g,s.y=T*m,s.z=0):s=new d(T*g,T*m,0),$.multiplyByVector(KL,s,s)}function mZ(e,t){if(e<0)throw new E("eccentricity cannot be negative.");return e<=t?"Circular":e<1-t?"Elliptical":e<=1+t?"Parabolic":"Hyperbolic"}function _Z(e,t){if(t<0||t>=1)throw new E("eccentricity out of range.");const n=yZ(e,t);return bZ(n,t)}const ZL=50,gZ=R.EPSILON8;function yZ(e,t){if(t<0||t>=1)throw new E("eccentricity out of range.");const n=Math.floor(e/R.TWO_PI);e-=n*R.TWO_PI;let i=e+t*Math.sin(e)/(1-Math.sin(e+t)+Math.sin(e)),o=Number.MAX_VALUE,r;for(r=0;r<ZL&&Math.abs(o-i)>gZ;++r){o=i;const s=o-t*Math.sin(o)-e,a=1-t*Math.cos(o);i=o-s/a}if(r>=ZL)throw new E("Kepler equation did not converge");return o=i+n*R.TWO_PI,o}function bZ(e,t){if(t<0||t>=1)throw new E("eccentricity out of range.");const n=Math.floor(e/R.TWO_PI);e-=n*R.TWO_PI;const i=Math.cos(e)-t,o=Math.sin(e)*Math.sqrt(1-t*t);let r=Math.atan2(o,i);return r=R.zeroToTwoPi(r),e<0&&(r-=R.TWO_PI),r+=n*R.TWO_PI,r}function TZ(e,t,n,i){if(t<0||t>R.PI)throw new E("inclination out of range");const o=Math.cos(e),r=Math.sin(e),s=Math.cos(t),a=Math.sin(t),l=Math.cos(n),u=Math.sin(n);return c(i)?(i[0]=l*o-u*r*s,i[1]=u*o+l*r*s,i[2]=r*a,i[3]=-l*r-u*o*s,i[4]=-u*r+l*o*s,i[5]=o*a,i[6]=u*a,i[7]=-l*a,i[8]=s):i=new $(l*o-u*r*s,-l*r-u*o*s,u*a,u*o+l*r*s,-u*r+l*o*s,-l*a,r*a,o*a,s),i}const AZ=1.0000010178*qr,xZ=100.46645683*rc,CZ=129597742283429e-5*ma,JL=16002,eR=21863,tR=32004,nR=10931,iR=14529,oR=16368,rR=15318,sR=32794,EZ=64*1e-7*qr,wZ=-152*1e-7*qr,SZ=62*1e-7*qr,vZ=-8*1e-7*qr,IZ=32*1e-7*qr,DZ=-41*1e-7*qr,PZ=19*1e-7*qr,OZ=-11*1e-7*qr,LZ=-150*1e-7*qr,RZ=-46*1e-7*qr,NZ=68*1e-7*qr,MZ=54*1e-7*qr,FZ=14*1e-7*qr,BZ=24*1e-7*qr,zZ=-28*1e-7*qr,UZ=22*1e-7*qr,aR=10,cR=16002,lR=21863,uR=10931,dR=1473,hR=32004,fR=4387,pR=73,kZ=-325*1e-7,VZ=-322*1e-7,HZ=-79*1e-7,GZ=232*1e-7,jZ=-52*1e-7,WZ=97*1e-7,qZ=55*1e-7,YZ=-41*1e-7,$Z=-105*1e-7,XZ=-137*1e-7,QZ=258*1e-7,KZ=35*1e-7,ZZ=-116*1e-7,JZ=-88*1e-7,eJ=-112*1e-7,tJ=-80*1e-7,n_=new ie(0,0,fn.TAI);function nJ(e,t){Ik(e,n_);const i=(n_.dayNumber-wx.dayNumber+(n_.secondsOfDay-wx.secondsOfDay)/qn.SECONDS_PER_DAY)/(qn.DAYS_PER_JULIAN_CENTURY*10),o=.3595362*i,r=AZ+EZ*Math.cos(JL*o)+LZ*Math.sin(JL*o)+wZ*Math.cos(eR*o)+RZ*Math.sin(eR*o)+SZ*Math.cos(tR*o)+NZ*Math.sin(tR*o)+vZ*Math.cos(nR*o)+MZ*Math.sin(nR*o)+IZ*Math.cos(iR*o)+FZ*Math.sin(iR*o)+DZ*Math.cos(oR*o)+BZ*Math.sin(oR*o)+PZ*Math.cos(rR*o)+zZ*Math.sin(rR*o)+OZ*Math.cos(sR*o)+UZ*Math.sin(sR*o),s=xZ+CZ*i+kZ*Math.cos(aR*o)+$Z*Math.sin(aR*o)+VZ*Math.cos(cR*o)+XZ*Math.sin(cR*o)+HZ*Math.cos(lR*o)+QZ*Math.sin(lR*o)+GZ*Math.cos(uR*o)+KZ*Math.sin(uR*o)+jZ*Math.cos(dR*o)+ZZ*Math.sin(dR*o)+WZ*Math.cos(hR*o)+JZ*Math.sin(hR*o)+qZ*Math.cos(fR*o)+eJ*Math.sin(fR*o)+YZ*Math.cos(pR*o)+tJ*Math.sin(pR*o),a=.0167086342-.0004203654*i,l=102.93734808*rc+11612.3529*ma*i,u=469.97289*ma*i,h=174.87317577*rc-8679.27034*ma*i;return Dk(r,a,u,l,h,s,t)}function Pk(e,t){Ik(e,n_);const i=(n_.dayNumber-wx.dayNumber+(n_.secondsOfDay-wx.secondsOfDay)/qn.SECONDS_PER_DAY)/qn.DAYS_PER_JULIAN_CENTURY,o=i*i,r=o*i,s=r*i;let a=383397.7725+.004*i,l=.055545526-16e-9*i;const u=5.15668983*rc;let h=-8e-5*i+.02966*o-42e-6*r-13e-8*s;const f=83.35324312*rc;let _=146434202669e-4*i-38.2702*o-.045047*r+21301e-8*s;const g=125.04455501*rc;let m=-69679193631e-4*i+6.3602*o+.007625*r-3586e-8*s;const b=218.31664563*rc;let T=17325593434847e-4*i-6.391*o+.006588*r-3169e-8*s;const x=297.85019547*rc+ma*(1602961601209e-3*i-6.3706*o+.006593*r-3169e-8*s),C=93.27209062*rc+ma*(17395272628478e-4*i-12.7512*o-.001037*r+417e-8*s),w=134.96340251*rc+ma*(17179159232178e-4*i+31.8792*o+.051635*r-2447e-7*s),v=357.52910918*rc+ma*(1295965810481e-4*i-.5532*o+136e-6*r-1149e-8*s),P=310.17137918*rc-ma*(6967051436e-3*i+6.2068*o+.007618*r-3219e-8*s),N=2*x,k=4*x,M=6*x,U=2*w,B=3*w,S=4*w,D=2*C;a+=3400.4*Math.cos(N)-635.6*Math.cos(N-w)-235.6*Math.cos(w)+218.1*Math.cos(N-v)+181*Math.cos(N+w),l+=.014216*Math.cos(N-w)+.008551*Math.cos(N-U)-.001383*Math.cos(w)+.001356*Math.cos(N+w)-.001147*Math.cos(k-B)-914e-6*Math.cos(k-U)+869e-6*Math.cos(N-v-w)-627e-6*Math.cos(N)-394e-6*Math.cos(k-S)+282e-6*Math.cos(N-v-U)-279e-6*Math.cos(x-w)-236e-6*Math.cos(U)+231e-6*Math.cos(k)+229e-6*Math.cos(M-S)-201e-6*Math.cos(U-D),h+=486.26*Math.cos(N-D)-40.13*Math.cos(N)+37.51*Math.cos(D)+25.73*Math.cos(U-D)+19.97*Math.cos(N-v-D),_+=-55609*Math.sin(N-w)-34711*Math.sin(N-U)-9792*Math.sin(w)+9385*Math.sin(k-B)+7505*Math.sin(k-U)+5318*Math.sin(N+w)+3484*Math.sin(k-S)-3417*Math.sin(N-v-w)-2530*Math.sin(M-S)-2376*Math.sin(N)-2075*Math.sin(N-B)-1883*Math.sin(U)-1736*Math.sin(M-5*w)+1626*Math.sin(v)-1370*Math.sin(M-B),m+=-5392*Math.sin(N-D)-540*Math.sin(v)-441*Math.sin(N)+423*Math.sin(D)-288*Math.sin(U-D),T+=-3332.9*Math.sin(N)+1197.4*Math.sin(N-w)-662.5*Math.sin(v)+396.3*Math.sin(w)-218*Math.sin(N-v);const p=2*P,I=3*P;h+=46.997*Math.cos(P)*i-.614*Math.cos(N-D+P)*i+.614*Math.cos(N-D-P)*i-.0297*Math.cos(p)*o-.0335*Math.cos(P)*o+.0012*Math.cos(N-D+p)*o-16e-5*Math.cos(P)*r+4e-5*Math.cos(I)*r+4e-5*Math.cos(p)*r;const O=2.116*Math.sin(P)*i-.111*Math.sin(N-D-P)*i-.0015*Math.sin(P)*o;_+=O,T+=O,m+=-520.77*Math.sin(P)*i+13.66*Math.sin(N-D+P)*i+1.12*Math.sin(N-P)*i-1.06*Math.sin(D-P)*i+.66*Math.sin(p)*o+.371*Math.sin(P)*o-.035*Math.sin(N-D+p)*o-.015*Math.sin(N-D+P)*o+.0014*Math.sin(P)*r-.0011*Math.sin(I)*r-9e-4*Math.sin(p)*r,a*=pZ;const F=u+h*ma,V=f+_*ma,G=b+T*ma,j=g+m*ma;return Dk(a,l,F,V,j,G,t)}const mR=.012300034,iJ=mR/(mR+1)*-1;function oJ(e,t){return t=Pk(e,t),d.multiplyByScalar(t,iJ,t)}const Ok=new $(1.0000000000000002,5619723173785822e-31,4690511510146299e-34,-5154129427414611e-31,.9174820620691819,-.39777715593191376,-223970096136568e-30,.39777715593191376,.9174820620691819);let gg=new d;OP.computeSunPositionInEarthInertialFrame=function(e,t){return c(e)||(e=ie.now()),c(t)||(t=new d),gg=nJ(e,gg),t=d.negate(gg,t),oJ(e,gg),d.subtract(t,gg,t),$.multiplyByVector(Ok,t,t),t};OP.computeMoonPositionInEarthInertialFrame=function(e,t){return c(e)||(e=ie.now()),t=Pk(e,t),$.multiplyByVector(Ok,t,t),t};const CI=OP,BA={MORPHING:0,COLUMBUS_VIEW:1,SCENE2D:2,SCENE3D:3};BA.getMorphTime=function(e){return e===BA.SCENE3D?1:e===BA.MORPHING?void 0:0};const oe=Object.freeze(BA);function bC(e){e=y(e,y.EMPTY_OBJECT),this.color=z.clone(y(e.color,z.WHITE)),this.intensity=y(e.intensity,2)}function V_(){this.globeDepthTexture=void 0,this.gamma=void 0,this._viewport=new Re,this._viewportCartesian4=new te,this._viewportDirty=!1,this._viewportOrthographicMatrix=L.clone(L.IDENTITY),this._viewportTransformation=L.clone(L.IDENTITY),this._model=L.clone(L.IDENTITY),this._view=L.clone(L.IDENTITY),this._inverseView=L.clone(L.IDENTITY),this._projection=L.clone(L.IDENTITY),this._infiniteProjection=L.clone(L.IDENTITY),this._entireFrustum=new H,this._currentFrustum=new H,this._frustumPlanes=new te,this._farDepthFromNearPlusOne=void 0,this._log2FarDepthFromNearPlusOne=void 0,this._oneOverLog2FarDepthFromNearPlusOne=void 0,this._frameState=void 0,this._temeToPseudoFixed=$.clone(L.IDENTITY),this._view3DDirty=!0,this._view3D=new L,this._inverseView3DDirty=!0,this._inverseView3D=new L,this._inverseModelDirty=!0,this._inverseModel=new L,this._inverseTransposeModelDirty=!0,this._inverseTransposeModel=new $,this._viewRotation=new $,this._inverseViewRotation=new $,this._viewRotation3D=new $,this._inverseViewRotation3D=new $,this._inverseProjectionDirty=!0,this._inverseProjection=new L,this._modelViewDirty=!0,this._modelView=new L,this._modelView3DDirty=!0,this._modelView3D=new L,this._modelViewRelativeToEyeDirty=!0,this._modelViewRelativeToEye=new L,this._inverseModelViewDirty=!0,this._inverseModelView=new L,this._inverseModelView3DDirty=!0,this._inverseModelView3D=new L,this._viewProjectionDirty=!0,this._viewProjection=new L,this._inverseViewProjectionDirty=!0,this._inverseViewProjection=new L,this._modelViewProjectionDirty=!0,this._modelViewProjection=new L,this._inverseModelViewProjectionDirty=!0,this._inverseModelViewProjection=new L,this._modelViewProjectionRelativeToEyeDirty=!0,this._modelViewProjectionRelativeToEye=new L,this._modelViewInfiniteProjectionDirty=!0,this._modelViewInfiniteProjection=new L,this._normalDirty=!0,this._normal=new $,this._normal3DDirty=!0,this._normal3D=new $,this._inverseNormalDirty=!0,this._inverseNormal=new $,this._inverseNormal3DDirty=!0,this._inverseNormal3D=new $,this._encodedCameraPositionMCDirty=!0,this._encodedCameraPositionMC=new rn,this._cameraPosition=new d,this._sunPositionWC=new d,this._sunPositionColumbusView=new d,this._sunDirectionWC=new d,this._sunDirectionEC=new d,this._moonDirectionEC=new d,this._lightDirectionWC=new d,this._lightDirectionEC=new d,this._lightColor=new d,this._lightColorHdr=new d,this._pass=void 0,this._mode=void 0,this._mapProjection=void 0,this._ellipsoid=void 0,this._cameraDirection=new d,this._cameraRight=new d,this._cameraUp=new d,this._frustum2DWidth=0,this._eyeHeight=0,this._eyeHeight2D=new H,this._eyeEllipsoidNormalEC=new d,this._eyeEllipsoidCurvature=new H,this._modelToEnu=new L,this._enuToModel=new L,this._pixelRatio=1,this._orthographicIn3D=!1,this._backgroundColor=new z,this._brdfLut=void 0,this._environmentMap=void 0,this._sphericalHarmonicCoefficients=void 0,this._specularEnvironmentMaps=void 0,this._specularEnvironmentMapsDimensions=new H,this._specularEnvironmentMapsMaximumLOD=void 0,this._fogDensity=void 0,this._fogMinimumBrightness=void 0,this._atmosphereHsbShift=void 0,this._atmosphereLightIntensity=void 0,this._atmosphereRayleighCoefficient=new d,this._atmosphereRayleighScaleHeight=new d,this._atmosphereMieCoefficient=new d,this._atmosphereMieScaleHeight=void 0,this._atmosphereMieAnisotropy=void 0,this._atmosphereDynamicLighting=void 0,this._invertClassificationColor=void 0,this._splitPosition=0,this._pixelSizePerMeter=void 0,this._geometricToleranceOverMeter=void 0,this._minimumDisableDepthTestDistance=void 0}Object.defineProperties(V_.prototype,{frameState:{get:function(){return this._frameState}},viewport:{get:function(){return this._viewport},set:function(e){if(!Re.equals(e,this._viewport)){Re.clone(e,this._viewport);const t=this._viewport,n=this._viewportCartesian4;n.x=t.x,n.y=t.y,n.z=t.width,n.w=t.height,this._viewportDirty=!0}}},viewportCartesian4:{get:function(){return this._viewportCartesian4}},viewportOrthographic:{get:function(){return gR(this),this._viewportOrthographicMatrix}},viewportTransformation:{get:function(){return gR(this),this._viewportTransformation}},model:{get:function(){return this._model},set:function(e){L.clone(e,this._model),this._modelView3DDirty=!0,this._inverseModelView3DDirty=!0,this._inverseModelDirty=!0,this._inverseTransposeModelDirty=!0,this._modelViewDirty=!0,this._inverseModelViewDirty=!0,this._modelViewRelativeToEyeDirty=!0,this._inverseModelViewDirty=!0,this._modelViewProjectionDirty=!0,this._inverseModelViewProjectionDirty=!0,this._modelViewProjectionRelativeToEyeDirty=!0,this._modelViewInfiniteProjectionDirty=!0,this._normalDirty=!0,this._inverseNormalDirty=!0,this._normal3DDirty=!0,this._inverseNormal3DDirty=!0,this._encodedCameraPositionMCDirty=!0}},inverseModel:{get:function(){return this._inverseModelDirty&&(this._inverseModelDirty=!1,L.inverse(this._model,this._inverseModel)),this._inverseModel}},inverseTransposeModel:{get:function(){const e=this._inverseTransposeModel;return this._inverseTransposeModelDirty&&(this._inverseTransposeModelDirty=!1,L.getMatrix3(this.inverseModel,e),$.transpose(e,e)),e}},view:{get:function(){return this._view}},view3D:{get:function(){return tw(this),this._view3D}},viewRotation:{get:function(){return tw(this),this._viewRotation}},viewRotation3D:{get:function(){return tw(this),this._viewRotation3D}},inverseView:{get:function(){return this._inverseView}},inverseView3D:{get:function(){return TR(this),this._inverseView3D}},inverseViewRotation:{get:function(){return this._inverseViewRotation}},inverseViewRotation3D:{get:function(){return TR(this),this._inverseViewRotation3D}},projection:{get:function(){return this._projection}},inverseProjection:{get:function(){return mJ(this),this._inverseProjection}},infiniteProjection:{get:function(){return this._infiniteProjection}},modelView:{get:function(){return _J(this),this._modelView}},modelView3D:{get:function(){return gJ(this),this._modelView3D}},modelViewRelativeToEye:{get:function(){return CJ(this),this._modelViewRelativeToEye}},inverseModelView:{get:function(){return yJ(this),this._inverseModelView}},inverseModelView3D:{get:function(){return bJ(this),this._inverseModelView3D}},viewProjection:{get:function(){return TJ(this),this._viewProjection}},inverseViewProjection:{get:function(){return AJ(this),this._inverseViewProjection}},modelViewProjection:{get:function(){return xJ(this),this._modelViewProjection}},inverseModelViewProjection:{get:function(){return EJ(this),this._inverseModelViewProjection}},modelViewProjectionRelativeToEye:{get:function(){return wJ(this),this._modelViewProjectionRelativeToEye}},modelViewInfiniteProjection:{get:function(){return SJ(this),this._modelViewInfiniteProjection}},normal:{get:function(){return vJ(this),this._normal}},normal3D:{get:function(){return IJ(this),this._normal3D}},inverseNormal:{get:function(){return DJ(this),this._inverseNormal}},inverseNormal3D:{get:function(){return PJ(this),this._inverseNormal3D}},entireFrustum:{get:function(){return this._entireFrustum}},currentFrustum:{get:function(){return this._currentFrustum}},frustumPlanes:{get:function(){return this._frustumPlanes}},farDepthFromNearPlusOne:{get:function(){return this._farDepthFromNearPlusOne}},log2FarDepthFromNearPlusOne:{get:function(){return this._log2FarDepthFromNearPlusOne}},oneOverLog2FarDepthFromNearPlusOne:{get:function(){return this._oneOverLog2FarDepthFromNearPlusOne}},eyeHeight:{get:function(){return this._eyeHeight}},eyeHeight2D:{get:function(){return this._eyeHeight2D}},eyeEllipsoidNormalEC:{get:function(){return this._eyeEllipsoidNormalEC}},eyeEllipsoidCurvature:{get:function(){return this._eyeEllipsoidCurvature}},modelToEnu:{get:function(){return this._modelToEnu}},enuToModel:{get:function(){return this._enuToModel}},sunPositionWC:{get:function(){return this._sunPositionWC}},sunPositionColumbusView:{get:function(){return this._sunPositionColumbusView}},sunDirectionWC:{get:function(){return this._sunDirectionWC}},sunDirectionEC:{get:function(){return this._sunDirectionEC}},moonDirectionEC:{get:function(){return this._moonDirectionEC}},lightDirectionWC:{get:function(){return this._lightDirectionWC}},lightDirectionEC:{get:function(){return this._lightDirectionEC}},lightColor:{get:function(){return this._lightColor}},lightColorHdr:{get:function(){return this._lightColorHdr}},encodedCameraPositionMCHigh:{get:function(){return bR(this),this._encodedCameraPositionMC.high}},encodedCameraPositionMCLow:{get:function(){return bR(this),this._encodedCameraPositionMC.low}},temeToPseudoFixedMatrix:{get:function(){return this._temeToPseudoFixed}},pixelRatio:{get:function(){return this._pixelRatio}},fogDensity:{get:function(){return this._fogDensity}},fogMinimumBrightness:{get:function(){return this._fogMinimumBrightness}},atmosphereHsbShift:{get:function(){return this._atmosphereHsbShift}},atmosphereLightIntensity:{get:function(){return this._atmosphereLightIntensity}},atmosphereRayleighCoefficient:{get:function(){return this._atmosphereRayleighCoefficient}},atmosphereRayleighScaleHeight:{get:function(){return this._atmosphereRayleighScaleHeight}},atmosphereMieCoefficient:{get:function(){return this._atmosphereMieCoefficient}},atmosphereMieScaleHeight:{get:function(){return this._atmosphereMieScaleHeight}},atmosphereMieAnisotropy:{get:function(){return this._atmosphereMieAnisotropy}},atmosphereDynamicLighting:{get:function(){return this._atmosphereDynamicLighting}},geometricToleranceOverMeter:{get:function(){return this._geometricToleranceOverMeter}},pass:{get:function(){return this._pass}},backgroundColor:{get:function(){return this._backgroundColor}},brdfLut:{get:function(){return this._brdfLut}},environmentMap:{get:function(){return this._environmentMap}},sphericalHarmonicCoefficients:{get:function(){return this._sphericalHarmonicCoefficients}},specularEnvironmentMaps:{get:function(){return this._specularEnvironmentMaps}},specularEnvironmentMapsDimensions:{get:function(){return this._specularEnvironmentMapsDimensions}},specularEnvironmentMapsMaximumLOD:{get:function(){return this._specularEnvironmentMapsMaximumLOD}},splitPosition:{get:function(){return this._splitPosition}},minimumDisableDepthTestDistance:{get:function(){return this._minimumDisableDepthTestDistance}},invertClassificationColor:{get:function(){return this._invertClassificationColor}},orthographicIn3D:{get:function(){return this._orthographicIn3D}},ellipsoid:{get:function(){return y(this._ellipsoid,ae.WGS84)}}});function rJ(e,t){L.clone(t,e._view),L.getMatrix3(t,e._viewRotation),e._view3DDirty=!0,e._inverseView3DDirty=!0,e._modelViewDirty=!0,e._modelView3DDirty=!0,e._modelViewRelativeToEyeDirty=!0,e._inverseModelViewDirty=!0,e._inverseModelView3DDirty=!0,e._viewProjectionDirty=!0,e._inverseViewProjectionDirty=!0,e._modelViewProjectionDirty=!0,e._modelViewProjectionRelativeToEyeDirty=!0,e._modelViewInfiniteProjectionDirty=!0,e._normalDirty=!0,e._inverseNormalDirty=!0,e._normal3DDirty=!0,e._inverseNormal3DDirty=!0}function sJ(e,t){L.clone(t,e._inverseView),L.getMatrix3(t,e._inverseViewRotation)}function aJ(e,t){L.clone(t,e._projection),e._inverseProjectionDirty=!0,e._viewProjectionDirty=!0,e._inverseViewProjectionDirty=!0,e._modelViewProjectionDirty=!0,e._modelViewProjectionRelativeToEyeDirty=!0}function cJ(e,t){L.clone(t,e._infiniteProjection),e._modelViewInfiniteProjectionDirty=!0}const _R=new d,lJ=new L;function uJ(e,t){d.clone(t.positionWC,e._cameraPosition),d.clone(t.directionWC,e._cameraDirection),d.clone(t.rightWC,e._cameraRight),d.clone(t.upWC,e._cameraUp);const n=e._ellipsoid;let i;const o=t.positionCartographic;if(c(o)?(e._eyeHeight=o.height,e._eyeEllipsoidNormalEC=n.geodeticSurfaceNormalCartographic(o,e._eyeEllipsoidNormalEC),i=d.fromRadians(o.longitude,o.latitude,0,n,_R)):(e._eyeHeight=-n.maximumRadius,d.magnitude(t.positionWC)>0&&(e._eyeEllipsoidNormalEC=d.normalize(t.positionWC,e._eyeEllipsoidNormalEC)),i=n.scaleToGeodeticSurface(t.positionWC,_R)),e._encodedCameraPositionMCDirty=!0,!c(i))return;e._eyeEllipsoidNormalEC=$.multiplyByVector(e._viewRotation,e._eyeEllipsoidNormalEC,e._eyeEllipsoidNormalEC);const r=zt.eastNorthUpToFixedFrame(i,n,lJ);e._enuToModel=L.multiplyTransformation(e.inverseModel,r,e._enuToModel),e._modelToEnu=L.inverseTransformation(e._enuToModel,e._modelToEnu),R.equalsEpsilon(n._radii.x,n._radii.y,R.EPSILON15)&&(e._eyeEllipsoidCurvature=n.getLocalCurvature(i,e._eyeEllipsoidCurvature))}let yg=new $;const dJ=new he;function hJ(e,t){c(zt.computeIcrfToFixedMatrix(t.time,yg))||(yg=zt.computeTemeToPseudoFixedMatrix(t.time,yg));let n=CI.computeSunPositionInEarthInertialFrame(t.time,e._sunPositionWC);$.multiplyByVector(yg,n,n),d.normalize(n,e._sunDirectionWC),n=$.multiplyByVector(e.viewRotation3D,n,e._sunDirectionEC),d.normalize(n,n),n=CI.computeMoonPositionInEarthInertialFrame(t.time,e._moonDirectionEC),$.multiplyByVector(yg,n,n),$.multiplyByVector(e.viewRotation3D,n,n),d.normalize(n,n);const i=t.mapProjection,r=i.ellipsoid.cartesianToCartographic(e._sunPositionWC,dJ);i.project(r,e._sunPositionColumbusView)}V_.prototype.updateCamera=function(e){rJ(this,e.viewMatrix),sJ(this,e.inverseViewMatrix),uJ(this,e),this._entireFrustum.x=e.frustum.near,this._entireFrustum.y=e.frustum.far,this.updateFrustum(e.frustum),this._orthographicIn3D=this._mode!==oe.SCENE2D&&e.frustum instanceof It};V_.prototype.updateFrustum=function(e){aJ(this,e.projectionMatrix),c(e.infiniteProjectionMatrix)&&cJ(this,e.infiniteProjectionMatrix),this._currentFrustum.x=e.near,this._currentFrustum.y=e.far,this._farDepthFromNearPlusOne=e.far-e.near+1,this._log2FarDepthFromNearPlusOne=R.log2(this._farDepthFromNearPlusOne),this._oneOverLog2FarDepthFromNearPlusOne=1/this._log2FarDepthFromNearPlusOne;const t=e.offCenterFrustum;c(t)&&(e=t),this._frustumPlanes.x=e.top,this._frustumPlanes.y=e.bottom,this._frustumPlanes.z=e.left,this._frustumPlanes.w=e.right};V_.prototype.updatePass=function(e){this._pass=e};const fJ=[],pJ=new bC;V_.prototype.update=function(e){this._mode=e.mode,this._mapProjection=e.mapProjection,this._ellipsoid=e.mapProjection.ellipsoid,this._pixelRatio=e.pixelRatio;const t=e.camera;this.updateCamera(t),e.mode===oe.SCENE2D?(this._frustum2DWidth=t.frustum.right-t.frustum.left,this._eyeHeight2D.x=this._frustum2DWidth*.5,this._eyeHeight2D.y=this._eyeHeight2D.x*this._eyeHeight2D.x):(this._frustum2DWidth=0,this._eyeHeight2D.x=0,this._eyeHeight2D.y=0),hJ(this,e);const n=y(e.light,pJ);n instanceof bC?(this._lightDirectionWC=d.clone(this._sunDirectionWC,this._lightDirectionWC),this._lightDirectionEC=d.clone(this._sunDirectionEC,this._lightDirectionEC)):(this._lightDirectionWC=d.normalize(d.negate(n.direction,this._lightDirectionWC),this._lightDirectionWC),this._lightDirectionEC=$.multiplyByVector(this.viewRotation3D,this._lightDirectionWC,this._lightDirectionEC));const i=n.color;let o=d.fromElements(i.red,i.green,i.blue,this._lightColorHdr);o=d.multiplyByScalar(o,n.intensity,o);const r=d.maximumComponent(o);r>1?d.divideByScalar(o,r,this._lightColor):d.clone(o,this._lightColor);const s=e.brdfLutGenerator,a=c(s)?s.colorTexture:void 0;this._brdfLut=a,this._environmentMap=y(e.environmentMap,e.context.defaultCubeMap),this._sphericalHarmonicCoefficients=y(e.sphericalHarmonicCoefficients,fJ),this._specularEnvironmentMaps=e.specularEnvironmentMaps,this._specularEnvironmentMapsMaximumLOD=e.specularEnvironmentMapsMaximumLOD,c(this._specularEnvironmentMaps)&&H.clone(this._specularEnvironmentMaps.dimensions,this._specularEnvironmentMapsDimensions),this._fogDensity=e.fog.density,this._fogMinimumBrightness=e.fog.minimumBrightness;const l=e.atmosphere;c(l)&&(this._atmosphereHsbShift=d.fromElements(l.hueShift,l.saturationShift,l.brightnessShift,this._atmosphereHsbShift),this._atmosphereLightIntensity=l.lightIntensity,this._atmosphereRayleighCoefficient=d.clone(l.rayleighCoefficient,this._atmosphereRayleighCoefficient),this._atmosphereRayleighScaleHeight=l.rayleighScaleHeight,this._atmosphereMieCoefficient=d.clone(l.mieCoefficient,this._atmosphereMieCoefficient),this._atmosphereMieScaleHeight=l.mieScaleHeight,this._atmosphereMieAnisotropy=l.mieAnisotropy,this._atmosphereDynamicLighting=l.dynamicLighting),this._invertClassificationColor=e.invertClassificationColor,this._frameState=e,this._temeToPseudoFixed=zt.computeTemeToPseudoFixedMatrix(e.time,this._temeToPseudoFixed),this._splitPosition=e.splitPosition*e.context.drawingBufferWidth;const u=t.frustum.fov,h=this._viewport;let f;c(u)?h.height>h.width?f=Math.tan(.5*u)*2/h.height:f=Math.tan(.5*u)*2/h.width:f=1/Math.max(h.width,h.height),this._geometricToleranceOverMeter=f*e.maximumScreenSpaceError,z.clone(e.backgroundColor,this._backgroundColor),this._minimumDisableDepthTestDistance=e.minimumDisableDepthTestDistance,this._minimumDisableDepthTestDistance*=this._minimumDisableDepthTestDistance,this._minimumDisableDepthTestDistance===Number.POSITIVE_INFINITY&&(this._minimumDisableDepthTestDistance=-1)};function gR(e){if(e._viewportDirty){const t=e._viewport;L.computeOrthographicOffCenter(t.x,t.x+t.width,t.y,t.y+t.height,0,1,e._viewportOrthographicMatrix),L.computeViewportTransformation(t,0,1,e._viewportTransformation),e._viewportDirty=!1}}function mJ(e){e._inverseProjectionDirty&&(e._inverseProjectionDirty=!1,e._mode!==oe.SCENE2D&&e._mode!==oe.MORPHING&&!e._orthographicIn3D?L.inverse(e._projection,e._inverseProjection):L.clone(L.ZERO,e._inverseProjection))}function _J(e){e._modelViewDirty&&(e._modelViewDirty=!1,L.multiplyTransformation(e._view,e._model,e._modelView))}function gJ(e){e._modelView3DDirty&&(e._modelView3DDirty=!1,L.multiplyTransformation(e.view3D,e._model,e._modelView3D))}function yJ(e){e._inverseModelViewDirty&&(e._inverseModelViewDirty=!1,L.inverse(e.modelView,e._inverseModelView))}function bJ(e){e._inverseModelView3DDirty&&(e._inverseModelView3DDirty=!1,L.inverse(e.modelView3D,e._inverseModelView3D))}function TJ(e){e._viewProjectionDirty&&(e._viewProjectionDirty=!1,L.multiply(e._projection,e._view,e._viewProjection))}function AJ(e){e._inverseViewProjectionDirty&&(e._inverseViewProjectionDirty=!1,L.inverse(e.viewProjection,e._inverseViewProjection))}function xJ(e){e._modelViewProjectionDirty&&(e._modelViewProjectionDirty=!1,L.multiply(e._projection,e.modelView,e._modelViewProjection))}function CJ(e){if(e._modelViewRelativeToEyeDirty){e._modelViewRelativeToEyeDirty=!1;const t=e.modelView,n=e._modelViewRelativeToEye;n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],n[9]=t[9],n[10]=t[10],n[11]=t[11],n[12]=0,n[13]=0,n[14]=0,n[15]=t[15]}}function EJ(e){e._inverseModelViewProjectionDirty&&(e._inverseModelViewProjectionDirty=!1,L.inverse(e.modelViewProjection,e._inverseModelViewProjection))}function wJ(e){e._modelViewProjectionRelativeToEyeDirty&&(e._modelViewProjectionRelativeToEyeDirty=!1,L.multiply(e._projection,e.modelViewRelativeToEye,e._modelViewProjectionRelativeToEye))}function SJ(e){e._modelViewInfiniteProjectionDirty&&(e._modelViewInfiniteProjectionDirty=!1,L.multiply(e._infiniteProjection,e.modelView,e._modelViewInfiniteProjection))}function vJ(e){if(e._normalDirty){e._normalDirty=!1;const t=e._normal;L.getMatrix3(e.inverseModelView,t),$.transpose(t,t)}}function IJ(e){if(e._normal3DDirty){e._normal3DDirty=!1;const t=e._normal3D;L.getMatrix3(e.inverseModelView3D,t),$.transpose(t,t)}}function DJ(e){if(e._inverseNormalDirty){e._inverseNormalDirty=!1;const t=e._inverseNormal;L.getMatrix3(e.modelView,t),$.transpose(t,t)}}function PJ(e){if(e._inverseNormal3DDirty){e._inverseNormal3DDirty=!1;const t=e._inverseNormal3D;L.getMatrix3(e.modelView3D,t),$.transpose(t,t)}}const yR=new d;function bR(e){e._encodedCameraPositionMCDirty&&(e._encodedCameraPositionMCDirty=!1,L.multiplyByPoint(e.inverseModel,e._cameraPosition,yR),rn.fromCartesian(yR,e._encodedCameraPositionMC))}const OJ=new d,LJ=new d,RJ=new d,NJ=new d,MJ=new he,FJ=new d,BJ=new L;function zJ(e,t,n,i,o,r,s,a){const l=OJ;l.x=e.y,l.y=e.z,l.z=e.x;const u=LJ;u.x=n.y,u.y=n.z,u.z=n.x;const h=RJ;h.x=i.y,h.y=i.z,h.z=i.x;const f=NJ;f.x=t.y,f.y=t.z,f.z=t.x,r===oe.SCENE2D&&(l.z=o*.5);const _=s.unproject(l,MJ);_.longitude=R.clamp(_.longitude,-Math.PI,Math.PI),_.latitude=R.clamp(_.latitude,-R.PI_OVER_TWO,R.PI_OVER_TWO);const g=s.ellipsoid,m=g.cartographicToCartesian(_,FJ),b=zt.eastNorthUpToFixedFrame(m,g,BJ);return L.multiplyByPointAsVector(b,u,u),L.multiplyByPointAsVector(b,h,h),L.multiplyByPointAsVector(b,f,f),c(a)||(a=new L),a[0]=u.x,a[1]=h.x,a[2]=-f.x,a[3]=0,a[4]=u.y,a[5]=h.y,a[6]=-f.y,a[7]=0,a[8]=u.z,a[9]=h.z,a[10]=-f.z,a[11]=0,a[12]=-d.dot(u,m),a[13]=-d.dot(h,m),a[14]=d.dot(f,m),a[15]=1,a}function tw(e){e._view3DDirty&&(e._mode===oe.SCENE3D?L.clone(e._view,e._view3D):zJ(e._cameraPosition,e._cameraDirection,e._cameraRight,e._cameraUp,e._frustum2DWidth,e._mode,e._mapProjection,e._view3D),L.getMatrix3(e._view3D,e._viewRotation3D),e._view3DDirty=!1)}function TR(e){e._inverseView3DDirty&&(L.inverseTransformation(e.view3D,e._inverseView3D),L.getMatrix3(e._inverseView3D,e._inverseViewRotation3D),e._inverseView3DDirty=!1)}function UJ(e,t,n,i){const o=c(t.vertexBuffer),r=c(t.value),s=t.value?t.value.length:t.componentsPerAttribute;if(!o&&!r)throw new E("attribute must have a vertexBuffer or a value.");if(o&&r)throw new E("attribute cannot have both a vertexBuffer and a value. It must have either a vertexBuffer property defining per-vertex data or a value property defining data for all vertices.");if(s!==1&&s!==2&&s!==3&&s!==4)throw r?new E("attribute.value.length must be in the range [1, 4]."):new E("attribute.componentsPerAttribute must be in the range [1, 4].");if(c(t.componentDatatype)&&!Z.validate(t.componentDatatype))throw new E("attribute must have a valid componentDatatype or not specify it.");if(c(t.strideInBytes)&&t.strideInBytes>255)throw new E("attribute must have a strideInBytes less than or equal to 255 or not specify it.");if(c(t.instanceDivisor)&&t.instanceDivisor>0&&!i.instancedArrays)throw new E("instanced arrays is not supported");if(c(t.instanceDivisor)&&t.instanceDivisor<0)throw new E("attribute must have an instanceDivisor greater than or equal to zero");if(c(t.instanceDivisor)&&r)throw new E("attribute cannot have have an instanceDivisor if it is not backed by a buffer");if(c(t.instanceDivisor)&&t.instanceDivisor>0&&t.index===0)throw new E("attribute zero cannot have an instanceDivisor greater than 0");const a={index:y(t.index,n),enabled:y(t.enabled,!0),vertexBuffer:t.vertexBuffer,value:r?t.value.slice(0):void 0,componentsPerAttribute:s,componentDatatype:y(t.componentDatatype,Z.FLOAT),normalize:y(t.normalize,!1),offsetInBytes:y(t.offsetInBytes,0),strideInBytes:y(t.strideInBytes,0),instanceDivisor:y(t.instanceDivisor,0)};if(o)a.vertexAttrib=function(l){const u=this.index;l.bindBuffer(l.ARRAY_BUFFER,this.vertexBuffer._getBuffer()),l.vertexAttribPointer(u,this.componentsPerAttribute,this.componentDatatype,this.normalize,this.strideInBytes,this.offsetInBytes),l.enableVertexAttribArray(u),this.instanceDivisor>0&&(i.glVertexAttribDivisor(u,this.instanceDivisor),i._vertexAttribDivisors[u]=this.instanceDivisor,i._previousDrawInstanced=!0)},a.disableVertexAttribArray=function(l){l.disableVertexAttribArray(this.index),this.instanceDivisor>0&&i.glVertexAttribDivisor(n,0)};else{switch(a.componentsPerAttribute){case 1:a.vertexAttrib=function(l){l.vertexAttrib1fv(this.index,this.value)};break;case 2:a.vertexAttrib=function(l){l.vertexAttrib2fv(this.index,this.value)};break;case 3:a.vertexAttrib=function(l){l.vertexAttrib3fv(this.index,this.value)};break;case 4:a.vertexAttrib=function(l){l.vertexAttrib4fv(this.index,this.value)};break}a.disableVertexAttribArray=function(l){}}e.push(a)}function Lk(e,t,n){for(let i=0;i<t.length;++i){const o=t[i];o.enabled&&o.vertexAttrib(e)}c(n)&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n._getBuffer())}function Ci(e){e=y(e,y.EMPTY_OBJECT),A.defined("options.context",e.context),A.defined("options.attributes",e.attributes);const t=e.context,n=t._gl,i=e.attributes,o=e.indexBuffer;let r;const s=[];let a=1,l=!1,u=!1,h=i.length;for(r=0;r<h;++r)UJ(s,i[r],r,t);for(h=s.length,r=0;r<h;++r){const g=s[r];if(c(g.vertexBuffer)&&g.instanceDivisor===0){const m=g.strideInBytes||g.componentsPerAttribute*Z.getSizeInBytes(g.componentDatatype);a=g.vertexBuffer.sizeInBytes/m;break}}for(r=0;r<h;++r)s[r].instanceDivisor>0&&(l=!0),c(s[r].value)&&(u=!0);const f={};for(r=0;r<h;++r){const g=s[r].index;if(f[g])throw new E(`Index ${g} is used by more than one attribute.`);f[g]=!0}let _;t.vertexArrayObject&&(_=t.glCreateVertexArray(),t.glBindVertexArray(_),Lk(n,s,o),t.glBindVertexArray(null)),this._numberOfVertices=a,this._hasInstancedAttributes=l,this._hasConstantAttributes=u,this._context=t,this._gl=n,this._vao=_,this._attributes=s,this._indexBuffer=o}function AR(e){return e.values.length/e.componentsPerAttribute}function kJ(e){return Z.getSizeInBytes(e.componentDatatype)*e.componentsPerAttribute}function VJ(e){let t,n,i;const o=[];for(n in e)e.hasOwnProperty(n)&&c(e[n])&&c(e[n].values)&&(o.push(n),e[n].componentDatatype===Z.DOUBLE&&(e[n].componentDatatype=Z.FLOAT,e[n].values=Z.createTypedArray(Z.FLOAT,e[n].values)));let r;const s=o.length;if(s>0)for(r=AR(e[o[0]]),t=1;t<s;++t){const u=AR(e[o[t]]);if(u!==r)throw new Te(`Each attribute list must have the same number of vertices. Attribute ${o[t]} has a different number of vertices (${u.toString()}) than attribute ${o[0]} (${r.toString()}).`)}o.sort(function(u,h){return Z.getSizeInBytes(e[h].componentDatatype)-Z.getSizeInBytes(e[u].componentDatatype)});let a=0;const l={};for(t=0;t<s;++t)n=o[t],i=e[n],l[n]=a,a+=kJ(i);if(a>0){const u=Z.getSizeInBytes(e[o[0]].componentDatatype),h=a%u;h!==0&&(a+=u-h);const f=r*a,_=new ArrayBuffer(f),g={};for(t=0;t<s;++t){n=o[t];const m=Z.getSizeInBytes(e[n].componentDatatype);g[n]={pointer:Z.createTypedArray(e[n].componentDatatype,_),index:l[n]/m,strideInComponentType:a/m}}for(t=0;t<r;++t)for(let m=0;m<s;++m){n=o[m],i=e[n];const b=i.values,T=g[n],x=T.pointer,C=i.componentsPerAttribute;for(let w=0;w<C;++w)x[T.index+w]=b[t*C+w];T.index+=T.strideInComponentType}return{buffer:_,offsetsInBytes:l,vertexSizeInBytes:a}}}Ci.fromGeometry=function(e){e=y(e,y.EMPTY_OBJECT),A.defined("options.context",e.context);const t=e.context,n=y(e.geometry,y.EMPTY_OBJECT),i=y(e.bufferUsage,ke.DYNAMIC_DRAW),o=y(e.attributeLocations,y.EMPTY_OBJECT),r=y(e.interleave,!1),s=e.vertexArrayAttributes;let a,l,u;const h=c(s)?s:[],f=n.attributes;if(r){const m=VJ(f);if(c(m)){u=ct.createVertexBuffer({context:t,typedArray:m.buffer,usage:i});const b=m.offsetsInBytes,T=m.vertexSizeInBytes;for(a in f)f.hasOwnProperty(a)&&c(f[a])&&(l=f[a],c(l.values)?h.push({index:o[a],vertexBuffer:u,componentDatatype:l.componentDatatype,componentsPerAttribute:l.componentsPerAttribute,normalize:l.normalize,offsetInBytes:b[a],strideInBytes:T}):h.push({index:o[a],value:l.value,componentDatatype:l.componentDatatype,normalize:l.normalize}))}}else for(a in f)if(f.hasOwnProperty(a)&&c(f[a])){l=f[a];let m=l.componentDatatype;m===Z.DOUBLE&&(m=Z.FLOAT),u=void 0,c(l.values)&&(u=ct.createVertexBuffer({context:t,typedArray:Z.createTypedArray(m,l.values),usage:i})),h.push({index:o[a],vertexBuffer:u,value:l.value,componentDatatype:m,componentsPerAttribute:l.componentsPerAttribute,normalize:l.normalize})}let _;const g=n.indices;return c(g)&&(Tt.computeNumberOfVertices(n)>=R.SIXTY_FOUR_KILOBYTES&&t.elementIndexUint?_=ct.createIndexBuffer({context:t,typedArray:new Uint32Array(g),usage:i,indexDatatype:je.UNSIGNED_INT}):_=ct.createIndexBuffer({context:t,typedArray:new Uint16Array(g),usage:i,indexDatatype:je.UNSIGNED_SHORT})),new Ci({context:t,attributes:h,indexBuffer:_})};Object.defineProperties(Ci.prototype,{numberOfAttributes:{get:function(){return this._attributes.length}},numberOfVertices:{get:function(){return this._numberOfVertices}},indexBuffer:{get:function(){return this._indexBuffer}}});Ci.prototype.getAttribute=function(e){return A.defined("index",e),this._attributes[e]};function HJ(e){const t=e._context,n=e._hasInstancedAttributes;if(!n&&!t._previousDrawInstanced)return;t._previousDrawInstanced=n;const i=t._vertexAttribDivisors,o=e._attributes,r=pt.maximumVertexAttributes;let s;if(n){const a=o.length;for(s=0;s<a;++s){const l=o[s];if(l.enabled){const u=l.instanceDivisor,h=l.index;u!==i[h]&&(t.glVertexAttribDivisor(h,u),i[h]=u)}}}else for(s=0;s<r;++s)i[s]>0&&(t.glVertexAttribDivisor(s,0),i[s]=0)}function GJ(e,t){const n=e._attributes,i=n.length;for(let o=0;o<i;++o){const r=n[o];r.enabled&&c(r.value)&&r.vertexAttrib(t)}}Ci.prototype._bind=function(){c(this._vao)?(this._context.glBindVertexArray(this._vao),this._context.instancedArrays&&HJ(this),this._hasConstantAttributes&&GJ(this,this._gl)):Lk(this._gl,this._attributes,this._indexBuffer)};Ci.prototype._unBind=function(){if(c(this._vao))this._context.glBindVertexArray(null);else{const e=this._attributes,t=this._gl;for(let n=0;n<e.length;++n){const i=e[n];i.enabled&&i.disableVertexAttribArray(t)}this._indexBuffer&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,null)}};Ci.prototype.isDestroyed=function(){return!1};Ci.prototype.destroy=function(){const e=this._attributes;for(let n=0;n<e.length;++n){const i=e[n].vertexBuffer;c(i)&&!i.isDestroyed()&&i.vertexArrayDestroyable&&i.destroy()}const t=this._indexBuffer;return c(t)&&!t.isDestroyed()&&t.vertexArrayDestroyable&&t.destroy(),c(this._vao)&&this._context.glDeleteVertexArray(this._vao),ve(this)};function Va(e,t){A.defined("canvas",e);const{getWebGLStub:n,requestWebgl1:i,webgl:o={},allowTextureFilterAnisotropic:r=!0}=y(t,{});o.alpha=y(o.alpha,!1),o.stencil=y(o.stencil,!0),o.powerPreference=y(o.powerPreference,"high-performance");const s=c(n)?n(e,o):jJ(e,o,i),l=typeof WebGL2RenderingContext<"u"&&s instanceof WebGL2RenderingContext;this._canvas=e,this._originalGLContext=s,this._gl=s,this._webgl2=l,this._id=Wr(),this.validateFramebuffer=!1,this.validateShaderProgram=!1,this.logShaderCompilation=!1,this._throwOnWebGLError=!1,this._shaderCache=new vl(this),this._textureCache=new Rp;const u=s;this._stencilBits=u.getParameter(u.STENCIL_BITS),pt._maximumCombinedTextureImageUnits=u.getParameter(u.MAX_COMBINED_TEXTURE_IMAGE_UNITS),pt._maximumCubeMapSize=u.getParameter(u.MAX_CUBE_MAP_TEXTURE_SIZE),pt._maximumFragmentUniformVectors=u.getParameter(u.MAX_FRAGMENT_UNIFORM_VECTORS),pt._maximumTextureImageUnits=u.getParameter(u.MAX_TEXTURE_IMAGE_UNITS),pt._maximumRenderbufferSize=u.getParameter(u.MAX_RENDERBUFFER_SIZE),pt._maximumTextureSize=u.getParameter(u.MAX_TEXTURE_SIZE),pt._maximumVaryingVectors=u.getParameter(u.MAX_VARYING_VECTORS),pt._maximumVertexAttributes=u.getParameter(u.MAX_VERTEX_ATTRIBS),pt._maximumVertexTextureImageUnits=u.getParameter(u.MAX_VERTEX_TEXTURE_IMAGE_UNITS),pt._maximumVertexUniformVectors=u.getParameter(u.MAX_VERTEX_UNIFORM_VECTORS),pt._maximumSamples=this._webgl2?u.getParameter(u.MAX_SAMPLES):0;const h=u.getParameter(u.ALIASED_LINE_WIDTH_RANGE);pt._minimumAliasedLineWidth=h[0],pt._maximumAliasedLineWidth=h[1];const f=u.getParameter(u.ALIASED_POINT_SIZE_RANGE);pt._minimumAliasedPointSize=f[0],pt._maximumAliasedPointSize=f[1];const _=u.getParameter(u.MAX_VIEWPORT_DIMS);pt._maximumViewportWidth=_[0],pt._maximumViewportHeight=_[1];const g=u.getShaderPrecisionFormat(u.FRAGMENT_SHADER,u.HIGH_FLOAT);pt._highpFloatSupported=g.precision!==0;const m=u.getShaderPrecisionFormat(u.FRAGMENT_SHADER,u.HIGH_INT);pt._highpIntSupported=m.rangeMax!==0,this._antialias=u.getContextAttributes().antialias,this._standardDerivatives=!!to(u,["OES_standard_derivatives"]),this._blendMinmax=!!to(u,["EXT_blend_minmax"]),this._elementIndexUint=!!to(u,["OES_element_index_uint"]),this._depthTexture=!!to(u,["WEBGL_depth_texture","WEBKIT_WEBGL_depth_texture"]),this._fragDepth=!!to(u,["EXT_frag_depth"]),this._debugShaders=to(u,["WEBGL_debug_shaders"]),this._textureFloat=!!to(u,["OES_texture_float"]),this._textureHalfFloat=!!to(u,["OES_texture_half_float"]),this._textureFloatLinear=!!to(u,["OES_texture_float_linear"]),this._textureHalfFloatLinear=!!to(u,["OES_texture_half_float_linear"]),this._colorBufferFloat=!!to(u,["EXT_color_buffer_float","WEBGL_color_buffer_float"]),this._floatBlend=!!to(u,["EXT_float_blend"]),this._colorBufferHalfFloat=!!to(u,["EXT_color_buffer_half_float"]),this._s3tc=!!to(u,["WEBGL_compressed_texture_s3tc","MOZ_WEBGL_compressed_texture_s3tc","WEBKIT_WEBGL_compressed_texture_s3tc"]),this._pvrtc=!!to(u,["WEBGL_compressed_texture_pvrtc","WEBKIT_WEBGL_compressed_texture_pvrtc"]),this._astc=!!to(u,["WEBGL_compressed_texture_astc"]),this._etc=!!to(u,["WEBG_compressed_texture_etc"]),this._etc1=!!to(u,["WEBGL_compressed_texture_etc1"]),this._bc7=!!to(u,["EXT_texture_compression_bptc"]),Op.setKTX2SupportedFormats(this._s3tc,this._pvrtc,this._astc,this._etc,this._etc1,this._bc7);const b=r?to(u,["EXT_texture_filter_anisotropic","WEBKIT_EXT_texture_filter_anisotropic"]):void 0;this._textureFilterAnisotropic=b,pt._maximumTextureFilterAnisotropy=c(b)?u.getParameter(b.MAX_TEXTURE_MAX_ANISOTROPY_EXT):1;let T,x,C,w,v,P,N,k,M,U;if(l){const p=this;T=function(){return p._gl.createVertexArray()},x=function(I){p._gl.bindVertexArray(I)},C=function(I){p._gl.deleteVertexArray(I)},w=function(I,O,F,V,G){u.drawElementsInstanced(I,O,F,V,G)},v=function(I,O,F,V){u.drawArraysInstanced(I,O,F,V)},P=function(I,O){u.vertexAttribDivisor(I,O)},N=function(I){u.drawBuffers(I)}}else k=to(u,["OES_vertex_array_object"]),c(k)&&(T=function(){return k.createVertexArrayOES()},x=function(p){k.bindVertexArrayOES(p)},C=function(p){k.deleteVertexArrayOES(p)}),M=to(u,["ANGLE_instanced_arrays"]),c(M)&&(w=function(p,I,O,F,V){M.drawElementsInstancedANGLE(p,I,O,F,V)},v=function(p,I,O,F){M.drawArraysInstancedANGLE(p,I,O,F)},P=function(p,I){M.vertexAttribDivisorANGLE(p,I)}),U=to(u,["WEBGL_draw_buffers"]),c(U)&&(N=function(p){U.drawBuffersWEBGL(p)});this.glCreateVertexArray=T,this.glBindVertexArray=x,this.glDeleteVertexArray=C,this.glDrawElementsInstanced=w,this.glDrawArraysInstanced=v,this.glVertexAttribDivisor=P,this.glDrawBuffers=N,this._vertexArrayObject=!!k,this._instancedArrays=!!M,this._drawBuffers=!!U,pt._maximumDrawBuffers=this.drawBuffers?u.getParameter(J.MAX_DRAW_BUFFERS):1,pt._maximumColorAttachments=this.drawBuffers?u.getParameter(J.MAX_COLOR_ATTACHMENTS):1,this._clearColor=new z(0,0,0,0),this._clearDepth=1,this._clearStencil=0;const B=new V_,S=new Lp(this),D=Ue.fromCache();this._defaultPassState=S,this._defaultRenderState=D,this._defaultTexture=void 0,this._defaultEmissiveTexture=void 0,this._defaultNormalTexture=void 0,this._defaultCubeMap=void 0,this._us=B,this._currentRenderState=D,this._currentPassState=S,this._currentFramebuffer=void 0,this._maxFrameTextureUnitIndex=0,this._vertexAttribDivisors=[],this._previousDrawInstanced=!1;for(let p=0;p<pt._maximumVertexAttributes;p++)this._vertexAttribDivisors.push(0);this._pickObjects={},this._nextPickColor=new Uint32Array(1),this.options={getWebGLStub:n,requestWebgl1:i,webgl:o,allowTextureFilterAnisotropic:r},this.cache={},Ue.apply(u,D,S)}function jJ(e,t,n){if(typeof WebGLRenderingContext>"u")throw new Te("The browser does not support WebGL. Visit http://get.webgl.org.");!n&&!(typeof WebGL2RenderingContext<"u")&&(n=!0);const o=n?"webgl":"webgl2",r=e.getContext(o,t);if(!c(r))throw new Te("The browser supports WebGL, but initialization failed.");return r}function WJ(e,t){let n="WebGL Error: ";switch(t){case e.INVALID_ENUM:n+="INVALID_ENUM";break;case e.INVALID_VALUE:n+="INVALID_VALUE";break;case e.INVALID_OPERATION:n+="INVALID_OPERATION";break;case e.OUT_OF_MEMORY:n+="OUT_OF_MEMORY";break;case e.CONTEXT_LOST_WEBGL:n+="CONTEXT_LOST_WEBGL lost";break;default:n+=`Unknown (${t})`}return n}function qJ(e,t,n,i){let o=`${WJ(e,i)}: ${t.name}(`;for(let r=0;r<n.length;++r)r!==0&&(o+=", "),o+=n[r];return o+=");",o}function YJ(e,t,n){const i=e.getError();if(i!==e.NO_ERROR)throw new Te(qJ(e,t,n,i))}function $J(e,t,n){return{get:function(){const i=e[t];return n(e,`get: ${t}`,i),e[t]},set:function(i){e[t]=i,n(e,`set: ${t}`,i)}}}function XJ(e,t){if(!c(t))return e;function n(o){return function(){const r=o.apply(e,arguments);return t(e,o,arguments),r}}const i={};for(const o in e){const r=e[o];r instanceof Function?i[o]=n(r):Object.defineProperty(i,o,$J(e,o,t))}return i}function to(e,t){const n=t.length;for(let i=0;i<n;++i){const o=e.getExtension(t[i]);if(o)return o}}const QJ={};Object.defineProperties(Va.prototype,{id:{get:function(){return this._id}},webgl2:{get:function(){return this._webgl2}},canvas:{get:function(){return this._canvas}},shaderCache:{get:function(){return this._shaderCache}},textureCache:{get:function(){return this._textureCache}},uniformState:{get:function(){return this._us}},stencilBits:{get:function(){return this._stencilBits}},stencilBuffer:{get:function(){return this._stencilBits>=8}},antialias:{get:function(){return this._antialias}},msaa:{get:function(){return this._webgl2}},standardDerivatives:{get:function(){return this._standardDerivatives||this._webgl2}},floatBlend:{get:function(){return this._floatBlend}},blendMinmax:{get:function(){return this._blendMinmax||this._webgl2}},elementIndexUint:{get:function(){return this._elementIndexUint||this._webgl2}},depthTexture:{get:function(){return this._depthTexture||this._webgl2}},floatingPointTexture:{get:function(){return this._webgl2||this._textureFloat}},halfFloatingPointTexture:{get:function(){return this._webgl2||this._textureHalfFloat}},textureFloatLinear:{get:function(){return this._textureFloatLinear}},textureHalfFloatLinear:{get:function(){return this._webgl2&&this._textureFloatLinear||!this._webgl2&&this._textureHalfFloatLinear}},textureFilterAnisotropic:{get:function(){return!!this._textureFilterAnisotropic}},s3tc:{get:function(){return this._s3tc}},pvrtc:{get:function(){return this._pvrtc}},astc:{get:function(){return this._astc}},etc:{get:function(){return this._etc}},etc1:{get:function(){return this._etc1}},bc7:{get:function(){return this._bc7}},supportsBasis:{get:function(){return this._s3tc||this._pvrtc||this._astc||this._etc||this._etc1||this._bc7}},vertexArrayObject:{get:function(){return this._vertexArrayObject||this._webgl2}},fragmentDepth:{get:function(){return this._fragDepth||this._webgl2}},instancedArrays:{get:function(){return this._instancedArrays||this._webgl2}},colorBufferFloat:{get:function(){return this._colorBufferFloat}},colorBufferHalfFloat:{get:function(){return this._webgl2&&this._colorBufferFloat||!this._webgl2&&this._colorBufferHalfFloat}},drawBuffers:{get:function(){return this._drawBuffers||this._webgl2}},debugShaders:{get:function(){return this._debugShaders}},throwOnWebGLError:{get:function(){return this._throwOnWebGLError},set:function(e){this._throwOnWebGLError=e,this._gl=XJ(this._originalGLContext,e?YJ:void 0)}},defaultTexture:{get:function(){return this._defaultTexture===void 0&&(this._defaultTexture=new xt({context:this,source:{width:1,height:1,arrayBufferView:new Uint8Array([255,255,255,255])},flipY:!1})),this._defaultTexture}},defaultEmissiveTexture:{get:function(){return this._defaultEmissiveTexture===void 0&&(this._defaultEmissiveTexture=new xt({context:this,pixelFormat:Ve.RGB,source:{width:1,height:1,arrayBufferView:new Uint8Array([0,0,0])},flipY:!1})),this._defaultEmissiveTexture}},defaultNormalTexture:{get:function(){return this._defaultNormalTexture===void 0&&(this._defaultNormalTexture=new xt({context:this,pixelFormat:Ve.RGB,source:{width:1,height:1,arrayBufferView:new Uint8Array([128,128,255])},flipY:!1})),this._defaultNormalTexture}},defaultCubeMap:{get:function(){if(this._defaultCubeMap===void 0){const e={width:1,height:1,arrayBufferView:new Uint8Array([255,255,255,255])};this._defaultCubeMap=new Sl({context:this,source:{positiveX:e,negativeX:e,positiveY:e,negativeY:e,positiveZ:e,negativeZ:e},flipY:!1})}return this._defaultCubeMap}},drawingBufferHeight:{get:function(){return this._gl.drawingBufferHeight}},drawingBufferWidth:{get:function(){return this._gl.drawingBufferWidth}},defaultFramebuffer:{get:function(){return QJ}}});function KJ(e){if(e.validateFramebuffer){const t=e._gl,n=t.checkFramebufferStatus(t.FRAMEBUFFER);if(n!==t.FRAMEBUFFER_COMPLETE){let i;switch(n){case t.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:i="Framebuffer is not complete. Incomplete attachment: at least one attachment point with a renderbuffer or texture attached has its attached object no longer in existence or has an attached image with a width or height of zero, or the color attachment point has a non-color-renderable image attached, or the depth attachment point has a non-depth-renderable image attached, or the stencil attachment point has a non-stencil-renderable image attached. Color-renderable formats include GL_RGBA4, GL_RGB5_A1, and GL_RGB565. GL_DEPTH_COMPONENT16 is the only depth-renderable format. GL_STENCIL_INDEX8 is the only stencil-renderable format.";break;case t.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:i="Framebuffer is not complete. Incomplete dimensions: not all attached images have the same width and height.";break;case t.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:i="Framebuffer is not complete. Missing attachment: no images are attached to the framebuffer.";break;case t.FRAMEBUFFER_UNSUPPORTED:i="Framebuffer is not complete. Unsupported: the combination of internal formats of the attached images violates an implementation-dependent set of restrictions.";break}throw new E(i)}}}function Rk(e,t,n,i){const o=e._currentRenderState,r=e._currentPassState;e._currentRenderState=t,e._currentPassState=n,Ue.partialApply(e._gl,o,t,r,n,i)}let LP;typeof WebGLRenderingContext<"u"&&(LP=[J.BACK]);function RP(e,t){if(t!==e._currentFramebuffer){e._currentFramebuffer=t;let n=LP;if(c(t))t._bind(),KJ(e),n=t._getActiveColorAttachments();else{const i=e._gl;i.bindFramebuffer(i.FRAMEBUFFER,null)}e.drawBuffers&&e.glDrawBuffers(n)}}const ZJ=new bi;Va.prototype.clear=function(e,t){e=y(e,ZJ),t=y(t,this._defaultPassState);const n=this._gl;let i=0;const o=e.color,r=e.depth,s=e.stencil;c(o)&&(z.equals(this._clearColor,o)||(z.clone(o,this._clearColor),n.clearColor(o.red,o.green,o.blue,o.alpha)),i|=n.COLOR_BUFFER_BIT),c(r)&&(r!==this._clearDepth&&(this._clearDepth=r,n.clearDepth(r)),i|=n.DEPTH_BUFFER_BIT),c(s)&&(s!==this._clearStencil&&(this._clearStencil=s,n.clearStencil(s)),i|=n.STENCIL_BUFFER_BIT);const a=y(e.renderState,this._defaultRenderState);Rk(this,a,t,!0);const l=y(e.framebuffer,t.framebuffer);RP(this,l),n.clear(i)};function JJ(e,t,n,i,o){if(c(t)&&o.depthTest&&o.depthTest.enabled&&!t.hasDepthAttachment)throw new E("The depth test can not be enabled (drawCommand.renderState.depthTest.enabled) because the framebuffer (drawCommand.framebuffer) does not have a depth or depth-stencil renderbuffer.");RP(e,t),Rk(e,o,n,!1),i._bind(),e._maxFrameTextureUnitIndex=Math.max(e._maxFrameTextureUnitIndex,i.maximumTextureUnitIndex)}function eee(e,t,n,i){const o=t._primitiveType,r=t._vertexArray;let s=t._offset,a=t._count;const l=t.instanceCount;if(!ze.validate(o))throw new E("drawCommand.primitiveType is required and must be valid.");if(A.defined("drawCommand.vertexArray",r),A.typeOf.number.greaterThanOrEquals("drawCommand.offset",s,0),c(a)&&A.typeOf.number.greaterThanOrEquals("drawCommand.count",a,0),A.typeOf.number.greaterThanOrEquals("drawCommand.instanceCount",l,0),l>0&&!e.instancedArrays)throw new E("Instanced arrays extension is not supported");e._us.model=y(t._modelMatrix,L.IDENTITY),n._setUniforms(i,e._us,e.validateShaderProgram),r._bind();const u=r.indexBuffer;c(u)?(s=s*u.bytesPerIndex,c(a)?a=Math.min(a,u.numberOfIndices):a=u.numberOfIndices,l===0?e._gl.drawElements(o,a,u.indexDatatype,s):e.glDrawElementsInstanced(o,a,u.indexDatatype,s,l)):(c(a)?a=Math.min(a,r.numberOfVertices):a=r.numberOfVertices,l===0?e._gl.drawArrays(o,s,a):e.glDrawArraysInstanced(o,s,a,l)),r._unBind()}Va.prototype.draw=function(e,t,n,i){A.defined("drawCommand",e),A.defined("drawCommand.shaderProgram",e._shaderProgram),t=y(t,this._defaultPassState);const o=y(e._framebuffer,t.framebuffer),r=y(e._renderState,this._defaultRenderState);n=y(n,e._shaderProgram),i=y(i,e._uniformMap),JJ(this,o,t,n,r),eee(this,e,n,i)};Va.prototype.endFrame=function(){const e=this._gl;e.useProgram(null),this._currentFramebuffer=void 0,e.bindFramebuffer(e.FRAMEBUFFER,null);const t=LP;this.drawBuffers&&this.glDrawBuffers(t);const n=this._maxFrameTextureUnitIndex;this._maxFrameTextureUnitIndex=0;for(let i=0;i<n;++i)e.activeTexture(e.TEXTURE0+i),e.bindTexture(e.TEXTURE_2D,null),e.bindTexture(e.TEXTURE_CUBE_MAP,null)};Va.prototype.readPixels=function(e){const t=this._gl;e=y(e,y.EMPTY_OBJECT);const n=Math.max(y(e.x,0),0),i=Math.max(y(e.y,0),0),o=y(e.width,t.drawingBufferWidth),r=y(e.height,t.drawingBufferHeight),s=e.framebuffer;A.typeOf.number.greaterThan("readState.width",o,0),A.typeOf.number.greaterThan("readState.height",r,0);let a=Me.UNSIGNED_BYTE;c(s)&&s.numberOfColorAttachments>0&&(a=s.getColorTexture(0).pixelDatatype);const l=Ve.createTypedArray(Ve.RGBA,a,o,r);return RP(this,s),t.readPixels(n,i,o,r,Ve.RGBA,Me.toWebGLConstant(a,this),l),l};const Nk={position:0,textureCoordinates:1};Va.prototype.getViewportQuadVertexArray=function(){let e=this.cache.viewportQuad_vertexArray;if(!c(e)){const t=new Tt({attributes:{position:new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:2,values:[-1,-1,1,-1,1,1,-1,1]}),textureCoordinates:new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:2,values:[0,0,1,0,1,1,0,1]})},indices:new Uint16Array([0,1,2,0,2,3]),primitiveType:ze.TRIANGLES});e=Ci.fromGeometry({context:this,geometry:t,attributeLocations:Nk,bufferUsage:ke.STATIC_DRAW,interleave:!0}),this.cache.viewportQuad_vertexArray=e}return e};Va.prototype.createViewportQuadCommand=function(e,t){return t=y(t,y.EMPTY_OBJECT),new Ze({vertexArray:this.getViewportQuadVertexArray(),primitiveType:ze.TRIANGLES,renderState:t.renderState,shaderProgram:Jt.fromCache({context:this,vertexShaderSource:RU,fragmentShaderSource:e,attributeLocations:Nk}),uniformMap:t.uniformMap,owner:t.owner,framebuffer:t.framebuffer,pass:t.pass})};Va.prototype.getObjectByPickColor=function(e){return A.defined("pickColor",e),this._pickObjects[e.toRgba()]};function NP(e,t,n){this._pickObjects=e,this.key=t,this.color=n}Object.defineProperties(NP.prototype,{object:{get:function(){return this._pickObjects[this.key]},set:function(e){this._pickObjects[this.key]=e}}});NP.prototype.destroy=function(){delete this._pickObjects[this.key]};Va.prototype.createPickId=function(e){A.defined("object",e),++this._nextPickColor[0];const t=this._nextPickColor[0];if(t===0)throw new Te("Out of unique Pick IDs.");return this._pickObjects[t]=e,new NP(this._pickObjects,t,z.fromRgba(t))};Va.prototype.isDestroyed=function(){return!1};Va.prototype.destroy=function(){const e=this.cache;for(const t in e)if(e.hasOwnProperty(t)){const n=e[t];c(n.destroy)&&n.destroy()}return this._shaderCache=this._shaderCache.destroy(),this._textureCache=this._textureCache.destroy(),this._defaultTexture=this._defaultTexture&&this._defaultTexture.destroy(),this._defaultEmissiveTexture=this._defaultEmissiveTexture&&this._defaultEmissiveTexture.destroy(),this._defaultNormalTexture=this._defaultNormalTexture&&this._defaultNormalTexture.destroy(),this._defaultCubeMap=this._defaultCubeMap&&this._defaultCubeMap.destroy(),ve(this)};Va._deprecationWarning=Xh;function H_(e){e=y(e,y.EMPTY_OBJECT);const t=e.context,n=e.width,i=e.height;A.defined("options.context",t),A.defined("options.width",n),A.defined("options.height",i),this._width=n,this._height=i;const o=e.colorRenderbuffers,r=e.colorTextures;if(c(o)!==c(r))throw new E("Both color renderbuffer and texture attachments must be provided.");const s=e.depthStencilRenderbuffer,a=e.depthStencilTexture;if(c(s)!==c(a))throw new E("Both depth-stencil renderbuffer and texture attachments must be provided.");this._renderFramebuffer=new ur({context:t,colorRenderbuffers:o,depthStencilRenderbuffer:s,destroyAttachments:e.destroyAttachments}),this._colorFramebuffer=new ur({context:t,colorTextures:r,depthStencilTexture:a,destroyAttachments:e.destroyAttachments})}H_.prototype.getRenderFramebuffer=function(){return this._renderFramebuffer};H_.prototype.getColorFramebuffer=function(){return this._colorFramebuffer};H_.prototype.blitFramebuffers=function(e,t){this._renderFramebuffer.bindRead(),this._colorFramebuffer.bindDraw();const n=e._gl;let i=0;this._colorFramebuffer._colorTextures.length>0&&(i|=n.COLOR_BUFFER_BIT),c(this._colorFramebuffer.depthStencilTexture)&&(i|=n.DEPTH_BUFFER_BIT|(t?n.STENCIL_BUFFER_BIT:0)),n.blitFramebuffer(0,0,this._width,this._height,0,0,this._width,this._height,i,n.NEAREST),n.bindFramebuffer(n.READ_FRAMEBUFFER,null),n.bindFramebuffer(n.DRAW_FRAMEBUFFER,null)};H_.prototype.isDestroyed=function(){return!1};H_.prototype.destroy=function(){return this._renderFramebuffer.destroy(),this._colorFramebuffer.destroy(),ve(this)};const Zs={RGBA4:J.RGBA4,RGBA8:J.RGBA8,RGBA16F:J.RGBA16F,RGBA32F:J.RGBA32F,RGB5_A1:J.RGB5_A1,RGB565:J.RGB565,DEPTH_COMPONENT16:J.DEPTH_COMPONENT16,STENCIL_INDEX8:J.STENCIL_INDEX8,DEPTH_STENCIL:J.DEPTH_STENCIL,DEPTH24_STENCIL8:J.DEPTH24_STENCIL8,validate:function(e){return e===Zs.RGBA4||e===Zs.RGBA8||e===Zs.RGBA16F||e===Zs.RGBA32F||e===Zs.RGB5_A1||e===Zs.RGB565||e===Zs.DEPTH_COMPONENT16||e===Zs.STENCIL_INDEX8||e===Zs.DEPTH_STENCIL||e===Zs.DEPTH24_STENCIL8},getColorFormat:function(e){return e===J.FLOAT?Zs.RGBA32F:e===J.HALF_FLOAT_OES?Zs.RGBA16F:Zs.RGBA8}},qu=Object.freeze(Zs);function cl(e){e=y(e,y.EMPTY_OBJECT),A.defined("options.context",e.context);const n=e.context._gl,i=pt.maximumRenderbufferSize,o=y(e.format,qu.RGBA4),r=c(e.width)?e.width:n.drawingBufferWidth,s=c(e.height)?e.height:n.drawingBufferHeight,a=y(e.numSamples,1);if(!qu.validate(o))throw new E("Invalid format.");if(A.typeOf.number.greaterThan("width",r,0),r>i)throw new E(`Width must be less than or equal to the maximum renderbuffer size (${i}). Check maximumRenderbufferSize.`);if(A.typeOf.number.greaterThan("height",s,0),s>i)throw new E(`Height must be less than or equal to the maximum renderbuffer size (${i}). Check maximumRenderbufferSize.`);this._gl=n,this._format=o,this._width=r,this._height=s,this._renderbuffer=this._gl.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,this._renderbuffer),a>1?n.renderbufferStorageMultisample(n.RENDERBUFFER,a,o,r,s):n.renderbufferStorage(n.RENDERBUFFER,o,r,s),n.bindRenderbuffer(n.RENDERBUFFER,null)}Object.defineProperties(cl.prototype,{format:{get:function(){return this._format}},width:{get:function(){return this._width}},height:{get:function(){return this._height}}});cl.prototype._getRenderbuffer=function(){return this._renderbuffer};cl.prototype.isDestroyed=function(){return!1};cl.prototype.destroy=function(){return this._gl.deleteRenderbuffer(this._renderbuffer),ve(this)};function on(e){if(e=y(e,y.EMPTY_OBJECT),this._numSamples=y(e.numSamples,1),this._colorAttachmentsLength=y(e.colorAttachmentsLength,1),this._color=y(e.color,!0),this._depth=y(e.depth,!1),this._depthStencil=y(e.depthStencil,!1),this._supportsDepthTexture=y(e.supportsDepthTexture,!1),!this._color&&!this._depth&&!this._depthStencil)throw new E("Must enable at least one type of framebuffer attachment.");if(this._depth&&this._depthStencil)throw new E("Cannot have both a depth and depth-stencil attachment.");this._createColorAttachments=y(e.createColorAttachments,!0),this._createDepthAttachments=y(e.createDepthAttachments,!0),this._pixelDatatype=e.pixelDatatype,this._pixelFormat=e.pixelFormat,this._width=void 0,this._height=void 0,this._framebuffer=void 0,this._multisampleFramebuffer=void 0,this._colorTextures=void 0,this._color&&(this._colorTextures=new Array(this._colorAttachmentsLength),this._colorRenderbuffers=new Array(this._colorAttachmentsLength)),this._colorRenderbuffer=void 0,this._depthStencilRenderbuffer=void 0,this._depthStencilTexture=void 0,this._depthRenderbuffer=void 0,this._depthTexture=void 0,this._attachmentsDirty=!1}Object.defineProperties(on.prototype,{framebuffer:{get:function(){return this._numSamples>1?this._multisampleFramebuffer.getRenderFramebuffer():this._framebuffer}},numSamples:{get:function(){return this._numSamples}},status:{get:function(){return this.framebuffer.status}}});on.prototype.isDirty=function(e,t,n,i,o){n=y(n,1);const r=this._width!==e||this._height!==t,s=this._numSamples!==n,a=c(i)&&this._pixelDatatype!==i||c(o)&&this._pixelFormat!==o,l=c(n===1?this._framebuffer:this._multisampleFramebuffer);return this._attachmentsDirty||r||s||a||!l||this._color&&!c(this._colorTextures[0])};on.prototype.update=function(e,t,n,i,o,r){if(!c(t)||!c(n))throw new E("width and height must be defined.");if(i=e.msaa?y(i,1):1,o=y(o,this._color?y(this._pixelDatatype,Me.UNSIGNED_BYTE):void 0),r=y(r,this._color?y(this._pixelFormat,Ve.RGBA):void 0),this.isDirty(t,n,i,o,r)){if(this.destroy(),this._width=t,this._height=n,this._numSamples=i,this._pixelDatatype=o,this._pixelFormat=r,this._attachmentsDirty=!1,this._color&&this._createColorAttachments){for(let s=0;s<this._colorAttachmentsLength;++s)if(this._colorTextures[s]=new xt({context:e,width:t,height:n,pixelFormat:r,pixelDatatype:o,sampler:un.NEAREST}),this._numSamples>1){const a=qu.getColorFormat(o);this._colorRenderbuffers[s]=new cl({context:e,width:t,height:n,format:a,numSamples:this._numSamples})}}this._depthStencil&&this._createDepthAttachments&&(this._supportsDepthTexture&&e.depthTexture?(this._depthStencilTexture=new xt({context:e,width:t,height:n,pixelFormat:Ve.DEPTH_STENCIL,pixelDatatype:Me.UNSIGNED_INT_24_8,sampler:un.NEAREST}),this._numSamples>1&&(this._depthStencilRenderbuffer=new cl({context:e,width:t,height:n,format:qu.DEPTH24_STENCIL8,numSamples:this._numSamples}))):this._depthStencilRenderbuffer=new cl({context:e,width:t,height:n,format:qu.DEPTH_STENCIL})),this._depth&&this._createDepthAttachments&&(this._supportsDepthTexture&&e.depthTexture?this._depthTexture=new xt({context:e,width:t,height:n,pixelFormat:Ve.DEPTH_COMPONENT,pixelDatatype:Me.UNSIGNED_INT,sampler:un.NEAREST}):this._depthRenderbuffer=new cl({context:e,width:t,height:n,format:qu.DEPTH_COMPONENT16})),this._numSamples>1?this._multisampleFramebuffer=new H_({context:e,width:this._width,height:this._height,colorTextures:this._colorTextures,colorRenderbuffers:this._colorRenderbuffers,depthStencilTexture:this._depthStencilTexture,depthStencilRenderbuffer:this._depthStencilRenderbuffer,destroyAttachments:!1}):this._framebuffer=new ur({context:e,colorTextures:this._colorTextures,depthTexture:this._depthTexture,depthRenderbuffer:this._depthRenderbuffer,depthStencilTexture:this._depthStencilTexture,depthStencilRenderbuffer:this._depthStencilRenderbuffer,destroyAttachments:!1})}};on.prototype.getColorTexture=function(e){if(e=y(e,0),e>=this._colorAttachmentsLength)throw new E("index must be smaller than total number of color attachments.");return this._colorTextures[e]};on.prototype.setColorTexture=function(e,t){if(t=y(t,0),this._createColorAttachments)throw new E("createColorAttachments must be false if setColorTexture is called.");if(t>=this._colorAttachmentsLength)throw new E("index must be smaller than total number of color attachments.");this._attachmentsDirty=e!==this._colorTextures[t],this._colorTextures[t]=e};on.prototype.getColorRenderbuffer=function(e){if(e=y(e,0),e>=this._colorAttachmentsLength)throw new E("index must be smaller than total number of color attachments.");return this._colorRenderbuffers[e]};on.prototype.setColorRenderbuffer=function(e,t){if(t=y(t,0),this._createColorAttachments)throw new E("createColorAttachments must be false if setColorRenderbuffer is called.");if(t>=this._colorAttachmentsLength)throw new E("index must be smaller than total number of color attachments.");this._attachmentsDirty=e!==this._colorRenderbuffers[t],this._colorRenderbuffers[t]=e};on.prototype.getDepthRenderbuffer=function(){return this._depthRenderbuffer};on.prototype.setDepthRenderbuffer=function(e){if(this._createDepthAttachments)throw new E("createDepthAttachments must be false if setDepthRenderbuffer is called.");this._attachmentsDirty=e!==this._depthRenderbuffer,this._depthRenderbuffer=e};on.prototype.getDepthTexture=function(){return this._depthTexture};on.prototype.setDepthTexture=function(e){if(this._createDepthAttachments)throw new E("createDepthAttachments must be false if setDepthTexture is called.");this._attachmentsDirty=e!==this._depthTexture,this._depthTexture=e};on.prototype.getDepthStencilRenderbuffer=function(){return this._depthStencilRenderbuffer};on.prototype.setDepthStencilRenderbuffer=function(e){if(this._createDepthAttachments)throw new E("createDepthAttachments must be false if setDepthStencilRenderbuffer is called.");this._attachmentsDirty=e!==this._depthStencilRenderbuffer,this._depthStencilRenderbuffer=e};on.prototype.getDepthStencilTexture=function(){return this._depthStencilTexture};on.prototype.setDepthStencilTexture=function(e){if(this._createDepthAttachments)throw new E("createDepthAttachments must be false if setDepthStencilTexture is called.");this._attachmentsDirty=e!==this._depthStencilTexture,this._depthStencilTexture=e};on.prototype.prepareTextures=function(e,t){this._numSamples>1&&this._multisampleFramebuffer.blitFramebuffers(e,t)};on.prototype.clear=function(e,t,n){const i=t.framebuffer;t.framebuffer=this.framebuffer,t.execute(e,n),t.framebuffer=i};on.prototype.destroyFramebuffer=function(){this._framebuffer=this._framebuffer&&this._framebuffer.destroy(),this._multisampleFramebuffer=this._multisampleFramebuffer&&this._multisampleFramebuffer.destroy()};on.prototype.destroy=function(){if(this._color){let e;const t=this._colorTextures.length;for(e=0;e<t;++e){const n=this._colorTextures[e];this._createColorAttachments&&c(n)&&!n.isDestroyed()&&(this._colorTextures[e].destroy(),this._colorTextures[e]=void 0),c(n)&&n.isDestroyed()&&(this._colorTextures[e]=void 0);const i=this._colorRenderbuffers[e];this._createColorAttachments&&c(i)&&!i.isDestroyed()&&(this._colorRenderbuffers[e].destroy(),this._colorRenderbuffers[e]=void 0),c(i)&&i.isDestroyed()&&(this._colorRenderbuffers[e]=void 0)}}this._depthStencil&&(this._createDepthAttachments&&(this._depthStencilTexture=this._depthStencilTexture&&this._depthStencilTexture.destroy(),this._depthStencilRenderbuffer=this._depthStencilRenderbuffer&&this._depthStencilRenderbuffer.destroy()),c(this._depthStencilTexture)&&this._depthStencilTexture.isDestroyed()&&(this._depthStencilTexture=void 0),c(this._depthStencilRenderbuffer)&&this._depthStencilRenderbuffer.isDestroyed()&&(this._depthStencilRenderbuffer=void 0)),this._depth&&(this._createDepthAttachments&&(this._depthTexture=this._depthTexture&&this._depthTexture.destroy(),this._depthRenderbuffer=this._depthRenderbuffer&&this._depthRenderbuffer.destroy()),c(this._depthTexture)&&this._depthTexture.isDestroyed()&&(this._depthTexture=void 0),c(this._depthRenderbuffer)&&this._depthRenderbuffer.isDestroyed()&&(this._depthRenderbuffer=void 0)),this.destroyFramebuffer()};const Qf={VERTEX:0,FRAGMENT:1,BOTH:2};Qf.includesVertexShader=function(e){return A.typeOf.number("destination",e),e===Qf.VERTEX||e===Qf.BOTH};Qf.includesFragmentShader=function(e){return A.typeOf.number("destination",e),e===Qf.FRAGMENT||e===Qf.BOTH};const ge=Object.freeze(Qf);function MP(e){this.name=e,this.fields=[]}MP.prototype.addField=function(e,t){const n=` ${e} ${t};`;this.fields.push(n)};MP.prototype.generateGlslLines=function(){let e=this.fields;return e.length===0&&(e=[" float _empty;"]),[].concat(`struct ${this.name}`,"{",e,"};")};function FP(e){this.signature=e,this.body=[]}FP.prototype.addLines=function(e){if(typeof e!="string"&&!Array.isArray(e))throw new E(`Expected lines to be a string or an array of strings, actual value was ${e}`);const t=this.body;if(Array.isArray(e)){const n=e.length;for(let i=0;i<n;i++)t.push(` ${e[i]}`)}else t.push(` ${e}`)};FP.prototype.generateGlslLines=function(){return[].concat(this.signature,"{",this.body,"}")};function Es(){this._positionAttributeLine=void 0,this._nextAttributeLocation=1,this._attributeLocations={},this._attributeLines=[],this._structs={},this._functions={},this._vertexShaderParts={defineLines:[],uniformLines:[],shaderLines:[],varyingLines:[],structIds:[],functionIds:[]},this._fragmentShaderParts={defineLines:[],uniformLines:[],shaderLines:[],varyingLines:[],structIds:[],functionIds:[]}}Object.defineProperties(Es.prototype,{attributeLocations:{get:function(){return this._attributeLocations}}});Es.prototype.addDefine=function(e,t,n){A.typeOf.string("identifier",e),n=y(n,ge.BOTH);let i=e;c(t)&&(i+=` ${t.toString()}`),ge.includesVertexShader(n)&&this._vertexShaderParts.defineLines.push(i),ge.includesFragmentShader(n)&&this._fragmentShaderParts.defineLines.push(i)};Es.prototype.addStruct=function(e,t,n){A.typeOf.string("structId",e),A.typeOf.string("structName",t),A.typeOf.number("destination",n),this._structs[e]=new MP(t),ge.includesVertexShader(n)&&this._vertexShaderParts.structIds.push(e),ge.includesFragmentShader(n)&&this._fragmentShaderParts.structIds.push(e)};Es.prototype.addStructField=function(e,t,n){A.typeOf.string("structId",e),A.typeOf.string("type",t),A.typeOf.string("identifier",n),this._structs[e].addField(t,n)};Es.prototype.addFunction=function(e,t,n){A.typeOf.string("functionName",e),A.typeOf.string("signature",t),A.typeOf.number("destination",n),this._functions[e]=new FP(t),ge.includesVertexShader(n)&&this._vertexShaderParts.functionIds.push(e),ge.includesFragmentShader(n)&&this._fragmentShaderParts.functionIds.push(e)};Es.prototype.addFunctionLines=function(e,t){if(A.typeOf.string("functionName",e),typeof t!="string"&&!Array.isArray(t))throw new E(`Expected lines to be a string or an array of strings, actual value was ${t}`);this._functions[e].addLines(t)};Es.prototype.addUniform=function(e,t,n){A.typeOf.string("type",e),A.typeOf.string("identifier",t),n=y(n,ge.BOTH);const i=`uniform ${e} ${t};`;ge.includesVertexShader(n)&&this._vertexShaderParts.uniformLines.push(i),ge.includesFragmentShader(n)&&this._fragmentShaderParts.uniformLines.push(i)};Es.prototype.setPositionAttribute=function(e,t){if(A.typeOf.string("type",e),A.typeOf.string("identifier",t),c(this._positionAttributeLine))throw new E("setPositionAttribute() must be called exactly once for the attribute used for gl_Position. For other attributes, use addAttribute()");return this._positionAttributeLine=`in ${e} ${t};`,this._attributeLocations[t]=0,0};Es.prototype.addAttribute=function(e,t){A.typeOf.string("type",e),A.typeOf.string("identifier",t);const n=`in ${e} ${t};`;this._attributeLines.push(n);const i=this._nextAttributeLocation;return this._attributeLocations[t]=i,this._nextAttributeLocation+=nee(e),i};Es.prototype.addVarying=function(e,t,n){A.typeOf.string("type",e),A.typeOf.string("identifier",t),n=c(n)?`${n} `:"";const i=`${e} ${t};`;this._vertexShaderParts.varyingLines.push(`${n}out ${i}`),this._fragmentShaderParts.varyingLines.push(`${n}in ${i}`)};Es.prototype.addVertexLines=function(e){if(typeof e!="string"&&!Array.isArray(e))throw new E(`Expected lines to be a string or an array of strings, actual value was ${e}`);const t=this._vertexShaderParts.shaderLines;Array.isArray(e)?t.push.apply(t,e):t.push(e)};Es.prototype.addFragmentLines=function(e){if(typeof e!="string"&&!Array.isArray(e))throw new E(`Expected lines to be a string or an array of strings, actual value was ${e}`);const t=this._fragmentShaderParts.shaderLines;Array.isArray(e)?t.push.apply(t,e):t.push(e)};Es.prototype.buildShaderProgram=function(e){A.typeOf.object("context",e);const t=c(this._positionAttributeLine)?[this._positionAttributeLine]:[],n=tee(this),i=iee(this),o=t.concat(this._attributeLines,this._vertexShaderParts.uniformLines,this._vertexShaderParts.varyingLines,n.vertexLines,i.vertexLines,this._vertexShaderParts.shaderLines).join(`
|
|
`),r=new Oe({defines:this._vertexShaderParts.defineLines,sources:[o]}),s=this._fragmentShaderParts.uniformLines.concat(this._fragmentShaderParts.varyingLines,n.fragmentLines,i.fragmentLines,this._fragmentShaderParts.shaderLines).join(`
|
|
`),a=new Oe({defines:this._fragmentShaderParts.defineLines,sources:[s]});return Jt.fromCache({context:e,vertexShaderSource:r,fragmentShaderSource:a,attributeLocations:this._attributeLocations})};Es.prototype.clone=function(){return Je(this,!0)};function tee(e){const t=[],n=[];let i,o=e._vertexShaderParts.structIds,r,s,a;for(i=0;i<o.length;i++)r=o[i],s=e._structs[r],a=s.generateGlslLines(),t.push.apply(t,a);for(o=e._fragmentShaderParts.structIds,i=0;i<o.length;i++)r=o[i],s=e._structs[r],a=s.generateGlslLines(),n.push.apply(n,a);return{vertexLines:t,fragmentLines:n}}function nee(e){switch(e){case"mat2":return 2;case"mat3":return 3;case"mat4":return 4;default:return 1}}function iee(e){const t=[],n=[];let i,o=e._vertexShaderParts.functionIds,r,s,a;for(i=0;i<o.length;i++)r=o[i],s=e._functions[r],a=s.generateGlslLines(),t.push.apply(t,a);for(o=e._fragmentShaderParts.functionIds,i=0;i<o.length;i++)r=o[i],s=e._functions[r],a=s.generateGlslLines(),n.push.apply(n,a);return{vertexLines:t,fragmentLines:n}}function qo(e,t,n,i){if(A.defined("context",e),!t||t.length===0)throw new E("At least one attribute is required.");const o=qo._verifyAttributes(t);n=y(n,0);const r=[],s={};let a,l;const u=o.length;for(let f=0;f<u;++f){const _=o[f];if(_.vertexBuffer){r.push(_);continue}l=_.usage,a=s[l],c(a)||(a=s[l]=[]),a.push(_)}function h(f,_){return Z.getSizeInBytes(_.componentDatatype)-Z.getSizeInBytes(f.componentDatatype)}this._allBuffers=[];for(l in s)if(s.hasOwnProperty(l)){a=s[l],a.sort(h);const f=qo._vertexSizeInBytes(a),_=a[0].usage,g={vertexSizeInBytes:f,vertexBuffer:void 0,usage:_,needsCommit:!1,arrayBuffer:void 0,arrayViews:qo._createArrayViews(a,f)};this._allBuffers.push(g)}this._size=0,this._instanced=y(i,!1),this._precreated=r,this._context=e,this.writers=void 0,this.va=void 0,this.resize(n)}qo._verifyAttributes=function(e){const t=[];for(let i=0;i<e.length;++i){const o=e[i],r={index:y(o.index,i),enabled:y(o.enabled,!0),componentsPerAttribute:o.componentsPerAttribute,componentDatatype:y(o.componentDatatype,Z.FLOAT),normalize:y(o.normalize,!1),vertexBuffer:o.vertexBuffer,usage:y(o.usage,ke.STATIC_DRAW)};if(t.push(r),r.componentsPerAttribute!==1&&r.componentsPerAttribute!==2&&r.componentsPerAttribute!==3&&r.componentsPerAttribute!==4)throw new E("attribute.componentsPerAttribute must be in the range [1, 4].");const s=r.componentDatatype;if(!Z.validate(s))throw new E("Attribute must have a valid componentDatatype or not specify it.");if(!ke.validate(r.usage))throw new E("Attribute must have a valid usage or not specify it.")}const n=new Array(t.length);for(let i=0;i<t.length;++i){const r=t[i].index;if(n[r])throw new E(`Index ${r} is used by more than one attribute.`);n[r]=!0}return t};qo._vertexSizeInBytes=function(e){let t=0;const n=e.length;for(let s=0;s<n;++s){const a=e[s];t+=a.componentsPerAttribute*Z.getSizeInBytes(a.componentDatatype)}const i=n>0?Z.getSizeInBytes(e[0].componentDatatype):0,o=i>0?t%i:0,r=o===0?0:i-o;return t+=r,t};qo._createArrayViews=function(e,t){const n=[];let i=0;const o=e.length;for(let r=0;r<o;++r){const s=e[r],a=s.componentDatatype;n.push({index:s.index,enabled:s.enabled,componentsPerAttribute:s.componentsPerAttribute,componentDatatype:a,normalize:s.normalize,offsetInBytes:i,vertexSizeInComponentType:t/Z.getSizeInBytes(a),view:void 0}),i+=s.componentsPerAttribute*Z.getSizeInBytes(a)}return n};qo.prototype.resize=function(e){this._size=e;const t=this._allBuffers;this.writers=[];for(let n=0,i=t.length;n<i;++n){const o=t[n];qo._resize(o,this._size),qo._appendWriters(this.writers,o)}BP(this)};qo._resize=function(e,t){if(e.vertexSizeInBytes>0){const n=new ArrayBuffer(t*e.vertexSizeInBytes);if(c(e.arrayBuffer)){const r=new Uint8Array(n),s=new Uint8Array(e.arrayBuffer),a=s.length;for(let l=0;l<a;++l)r[l]=s[l]}const i=e.arrayViews,o=i.length;for(let r=0;r<o;++r){const s=i[r];s.view=Z.createArrayBufferView(s.componentDatatype,n,s.offsetInBytes)}e.arrayBuffer=n}};const oee=[function(e,t,n){return function(i,o){t[i*n]=o,e.needsCommit=!0}},function(e,t,n){return function(i,o,r){const s=i*n;t[s]=o,t[s+1]=r,e.needsCommit=!0}},function(e,t,n){return function(i,o,r,s){const a=i*n;t[a]=o,t[a+1]=r,t[a+2]=s,e.needsCommit=!0}},function(e,t,n){return function(i,o,r,s,a){const l=i*n;t[l]=o,t[l+1]=r,t[l+2]=s,t[l+3]=a,e.needsCommit=!0}}];qo._appendWriters=function(e,t){const n=t.arrayViews,i=n.length;for(let o=0;o<i;++o){const r=n[o];e[r.index]=oee[r.componentsPerAttribute-1](t,r.view,r.vertexSizeInComponentType)}};qo.prototype.commit=function(e){let t=!1;const n=this._allBuffers;let i,o,r;for(o=0,r=n.length;o<r;++o)i=n[o],t=ree(this,i)||t;if(t||!c(this.va)){BP(this);const s=this.va=[],a=R.SIXTY_FOUR_KILOBYTES-4,l=c(e)&&!this._instanced?Math.ceil(this._size/a):1;for(let u=0;u<l;++u){let h=[];for(o=0,r=n.length;o<r;++o){i=n[o];const f=u*(i.vertexSizeInBytes*a);qo._appendAttributes(h,i,f,this._instanced)}h=h.concat(this._precreated),s.push({va:new Ci({context:this._context,attributes:h,indexBuffer:e}),indicesCount:1.5*(u!==l-1?a:this._size%a)})}}};function ree(e,t){if(t.needsCommit&&t.vertexSizeInBytes>0){t.needsCommit=!1;const n=t.vertexBuffer,i=e._size*t.vertexSizeInBytes,o=c(n);if(!o||n.sizeInBytes<i)return o&&n.destroy(),t.vertexBuffer=ct.createVertexBuffer({context:e._context,typedArray:t.arrayBuffer,usage:t.usage}),t.vertexBuffer.vertexArrayDestroyable=!1,!0;t.vertexBuffer.copyFromArrayView(t.arrayBuffer)}return!1}qo._appendAttributes=function(e,t,n,i){const o=t.arrayViews,r=o.length;for(let s=0;s<r;++s){const a=o[s];e.push({index:a.index,enabled:a.enabled,componentsPerAttribute:a.componentsPerAttribute,componentDatatype:a.componentDatatype,normalize:a.normalize,vertexBuffer:t.vertexBuffer,offsetInBytes:n+a.offsetInBytes,strideInBytes:t.vertexSizeInBytes,instanceDivisor:i?1:0})}};qo.prototype.subCommit=function(e,t){if(e<0||e>=this._size)throw new E("offsetInVertices must be greater than or equal to zero and less than the vertex array size.");if(e+t>this._size)throw new E("offsetInVertices + lengthInVertices cannot exceed the vertex array size.");const n=this._allBuffers;for(let i=0,o=n.length;i<o;++i)see(n[i],e,t)};function see(e,t,n){if(e.needsCommit&&e.vertexSizeInBytes>0){const i=e.vertexSizeInBytes*t,o=e.vertexSizeInBytes*n;e.vertexBuffer.copyFromArrayView(new Uint8Array(e.arrayBuffer,i,o),i)}}qo.prototype.endSubCommits=function(){const e=this._allBuffers;for(let t=0,n=e.length;t<n;++t)e[t].needsCommit=!1};function BP(e){const t=e.va;if(!c(t))return;const n=t.length;for(let i=0;i<n;++i)t[i].va.destroy();e.va=void 0}qo.prototype.isDestroyed=function(){return!1};qo.prototype.destroy=function(){const e=this._allBuffers;for(let t=0,n=e.length;t<n;++t){const i=e[t];i.vertexBuffer=i.vertexBuffer&&i.vertexBuffer.destroy()}return BP(this),ve(this)};function aee(e,t,n){if(A.defined("context",e),!c(t)||!c(t.positiveX)||!c(t.negativeX)||!c(t.positiveY)||!c(t.negativeY)||!c(t.positiveZ)||!c(t.negativeZ))throw new E("urls is required and must have positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ properties.");const i={flipY:!0,skipColorSpaceConversion:n,preferImageBitmap:!0},o=[Ae.createIfNeeded(t.positiveX).fetchImage(i),Ae.createIfNeeded(t.negativeX).fetchImage(i),Ae.createIfNeeded(t.positiveY).fetchImage(i),Ae.createIfNeeded(t.negativeY).fetchImage(i),Ae.createIfNeeded(t.positiveZ).fetchImage(i),Ae.createIfNeeded(t.negativeZ).fetchImage(i)];return Promise.all(o).then(function(r){return new Sl({context:e,source:{positiveX:r[0],negativeX:r[1],positiveY:r[2],negativeY:r[3],positiveZ:r[4],negativeZ:r[5]}})})}function ao(e){this._value=void 0,this._hasClone=!1,this._hasEquals=!1,this._definitionChanged=new Le,this.setValue(e)}Object.defineProperties(ao.prototype,{isConstant:{value:!0},definitionChanged:{get:function(){return this._definitionChanged}}});ao.prototype.getValue=function(e,t){return this._hasClone?this._value.clone(t):this._value};ao.prototype.setValue=function(e){const t=this._value;if(t!==e){const n=c(e),i=n&&typeof e.clone=="function",o=n&&typeof e.equals=="function";(!o||!e.equals(t))&&(this._hasClone=i,this._hasEquals=o,this._value=i?e.clone(this._value):e,this._definitionChanged.raiseEvent(this))}};ao.prototype.equals=function(e){return this===e||e instanceof ao&&(!this._hasEquals&&this._value===e._value||this._hasEquals&&this._value.equals(e._value))};ao.prototype.valueOf=function(){return this._value};ao.prototype.toString=function(){return String(this._value)};function cee(e,t,n,i,o){return{configurable:i,get:function(){return this[t]},set:function(r){const s=this[t],a=this[n];c(a)&&(a(),this[n]=void 0),r!==void 0&&(!c(r)||!c(r.getValue))&&c(o)&&(r=o(r)),s!==r&&(this[t]=r,this._definitionChanged.raiseEvent(this,e,r,s)),c(r)&&c(r.definitionChanged)&&(this[n]=r.definitionChanged.addEventListener(function(){this._definitionChanged.raiseEvent(this,e,r,r)},this))}}}function lee(e){return new ao(e)}function ue(e,t,n){return cee(e,`_${e.toString()}`,`_${e.toString()}Subscription`,y(t,!1),y(n,lee))}function Ky(e){this._definitionChanged=new Le,this._show=void 0,this._showSubscription=void 0,this._image=void 0,this._imageSubscription=void 0,this._scale=void 0,this._scaleSubscription=void 0,this._pixelOffset=void 0,this._pixelOffsetSubscription=void 0,this._eyeOffset=void 0,this._eyeOffsetSubscription=void 0,this._horizontalOrigin=void 0,this._horizontalOriginSubscription=void 0,this._verticalOrigin=void 0,this._verticalOriginSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._color=void 0,this._colorSubscription=void 0,this._rotation=void 0,this._rotationSubscription=void 0,this._alignedAxis=void 0,this._alignedAxisSubscription=void 0,this._sizeInMeters=void 0,this._sizeInMetersSubscription=void 0,this._width=void 0,this._widthSubscription=void 0,this._height=void 0,this._heightSubscription=void 0,this._scaleByDistance=void 0,this._scaleByDistanceSubscription=void 0,this._translucencyByDistance=void 0,this._translucencyByDistanceSubscription=void 0,this._pixelOffsetScaleByDistance=void 0,this._pixelOffsetScaleByDistanceSubscription=void 0,this._imageSubRegion=void 0,this._imageSubRegionSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this._disableDepthTestDistance=void 0,this._disableDepthTestDistanceSubscription=void 0,this.merge(y(e,y.EMPTY_OBJECT))}Object.defineProperties(Ky.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ue("show"),image:ue("image"),scale:ue("scale"),pixelOffset:ue("pixelOffset"),eyeOffset:ue("eyeOffset"),horizontalOrigin:ue("horizontalOrigin"),verticalOrigin:ue("verticalOrigin"),heightReference:ue("heightReference"),color:ue("color"),rotation:ue("rotation"),alignedAxis:ue("alignedAxis"),sizeInMeters:ue("sizeInMeters"),width:ue("width"),height:ue("height"),scaleByDistance:ue("scaleByDistance"),translucencyByDistance:ue("translucencyByDistance"),pixelOffsetScaleByDistance:ue("pixelOffsetScaleByDistance"),imageSubRegion:ue("imageSubRegion"),distanceDisplayCondition:ue("distanceDisplayCondition"),disableDepthTestDistance:ue("disableDepthTestDistance")});Ky.prototype.clone=function(e){return c(e)?(e.show=this._show,e.image=this._image,e.scale=this._scale,e.pixelOffset=this._pixelOffset,e.eyeOffset=this._eyeOffset,e.horizontalOrigin=this._horizontalOrigin,e.verticalOrigin=this._verticalOrigin,e.heightReference=this._heightReference,e.color=this._color,e.rotation=this._rotation,e.alignedAxis=this._alignedAxis,e.sizeInMeters=this._sizeInMeters,e.width=this._width,e.height=this._height,e.scaleByDistance=this._scaleByDistance,e.translucencyByDistance=this._translucencyByDistance,e.pixelOffsetScaleByDistance=this._pixelOffsetScaleByDistance,e.imageSubRegion=this._imageSubRegion,e.distanceDisplayCondition=this._distanceDisplayCondition,e.disableDepthTestDistance=this._disableDepthTestDistance,e):new Ky(this)};Ky.prototype.merge=function(e){if(!c(e))throw new E("source is required.");this.show=y(this._show,e.show),this.image=y(this._image,e.image),this.scale=y(this._scale,e.scale),this.pixelOffset=y(this._pixelOffset,e.pixelOffset),this.eyeOffset=y(this._eyeOffset,e.eyeOffset),this.horizontalOrigin=y(this._horizontalOrigin,e.horizontalOrigin),this.verticalOrigin=y(this._verticalOrigin,e.verticalOrigin),this.heightReference=y(this._heightReference,e.heightReference),this.color=y(this._color,e.color),this.rotation=y(this._rotation,e.rotation),this.alignedAxis=y(this._alignedAxis,e.alignedAxis),this.sizeInMeters=y(this._sizeInMeters,e.sizeInMeters),this.width=y(this._width,e.width),this.height=y(this._height,e.height),this.scaleByDistance=y(this._scaleByDistance,e.scaleByDistance),this.translucencyByDistance=y(this._translucencyByDistance,e.translucencyByDistance),this.pixelOffsetScaleByDistance=y(this._pixelOffsetScaleByDistance,e.pixelOffsetScaleByDistance),this.imageSubRegion=y(this._imageSubRegion,e.imageSubRegion),this.distanceDisplayCondition=y(this._distanceDisplayCondition,e.distanceDisplayCondition),this.disableDepthTestDistance=y(this._disableDepthTestDistance,e.disableDepthTestDistance)};function mt(){this._array=[],this._hash={}}Object.defineProperties(mt.prototype,{length:{get:function(){return this._array.length}},values:{get:function(){return this._array}}});mt.prototype.contains=function(e){if(typeof e!="string"&&typeof e!="number")throw new E("key is required to be a string or number.");return c(this._hash[e])};mt.prototype.set=function(e,t){if(typeof e!="string"&&typeof e!="number")throw new E("key is required to be a string or number.");const n=this._hash[e];t!==n&&(this.remove(e),this._hash[e]=t,this._array.push(t))};mt.prototype.get=function(e){if(typeof e!="string"&&typeof e!="number")throw new E("key is required to be a string or number.");return this._hash[e]};mt.prototype.remove=function(e){if(c(e)&&typeof e!="string"&&typeof e!="number")throw new E("key is required to be a string or number.");const t=this._hash[e],n=c(t);if(n){const i=this._array;i.splice(i.indexOf(t),1),delete this._hash[e]}return n};mt.prototype.removeAll=function(){const e=this._array;e.length>0&&(this._hash={},e.length=0)};function Pt(e,t){e=y(e,0),this._near=e,t=y(t,Number.MAX_VALUE),this._far=t}Object.defineProperties(Pt.prototype,{near:{get:function(){return this._near},set:function(e){this._near=e}},far:{get:function(){return this._far},set:function(e){this._far=e}}});Pt.packedLength=2;Pt.pack=function(e,t,n){if(!c(e))throw new E("value is required");if(!c(t))throw new E("array is required");return n=y(n,0),t[n++]=e.near,t[n]=e.far,t};Pt.unpack=function(e,t,n){if(!c(e))throw new E("array is required");return t=y(t,0),c(n)||(n=new Pt),n.near=e[t++],n.far=e[t],n};Pt.equals=function(e,t){return e===t||c(e)&&c(t)&&e.near===t.near&&e.far===t.far};Pt.clone=function(e,t){if(!!c(e))return c(t)||(t=new Pt),t.near=e.near,t.far=e.far,t};Pt.prototype.clone=function(e){return Pt.clone(this,e)};Pt.prototype.equals=function(e){return Pt.equals(this,e)};function vt(e,t,n,i){this.near=y(e,0),this.nearValue=y(t,0),this.far=y(n,1),this.farValue=y(i,0)}vt.clone=function(e,t){if(!!c(e))return c(t)?(t.near=e.near,t.nearValue=e.nearValue,t.far=e.far,t.farValue=e.farValue,t):new vt(e.near,e.nearValue,e.far,e.farValue)};vt.packedLength=4;vt.pack=function(e,t,n){if(!c(e))throw new E("value is required");if(!c(t))throw new E("array is required");return n=y(n,0),t[n++]=e.near,t[n++]=e.nearValue,t[n++]=e.far,t[n]=e.farValue,t};vt.unpack=function(e,t,n){if(!c(e))throw new E("array is required");return t=y(t,0),c(n)||(n=new vt),n.near=e[t++],n.nearValue=e[t++],n.far=e[t++],n.farValue=e[t],n};vt.equals=function(e,t){return e===t||c(e)&&c(t)&&e.near===t.near&&e.nearValue===t.nearValue&&e.far===t.far&&e.farValue===t.farValue};vt.prototype.clone=function(e){return vt.clone(this,e)};vt.prototype.equals=function(e){return vt.equals(this,e)};const Kf={NONE:0,CLAMP_TO_GROUND:1,RELATIVE_TO_GROUND:2,CLAMP_TO_TERRAIN:3,RELATIVE_TO_TERRAIN:4,CLAMP_TO_3D_TILE:5,RELATIVE_TO_3D_TILE:6},gt=Object.freeze(Kf);function Np(e){return e===Kf.CLAMP_TO_GROUND||e===Kf.CLAMP_TO_3D_TILE||e===Kf.CLAMP_TO_TERRAIN}function zP(e){return e===Kf.RELATIVE_TO_GROUND||e===Kf.RELATIVE_TO_3D_TILE||e===Kf.RELATIVE_TO_TERRAIN}const uee={CENTER:0,LEFT:1,RIGHT:-1},Fs=Object.freeze(uee),dee={CENTER:0,BOTTOM:1,BASELINE:2,TOP:-1},si=Object.freeze(dee),hee={DONE:0,PENDING:1,FAILED:2},rt=Object.freeze(hee);function K(){E.throwInstantiationError()}Object.defineProperties(K.prototype,{isConstant:{get:E.throwInstantiationError},definitionChanged:{get:E.throwInstantiationError}});K.prototype.getValue=E.throwInstantiationError;K.prototype.equals=E.throwInstantiationError;K.equals=function(e,t){return e===t||c(e)&&e.equals(t)};K.arrayEquals=function(e,t){if(e===t)return!0;if(!c(e)||!c(t)||e.length!==t.length)return!1;const n=e.length;for(let i=0;i<n;i++)if(!K.equals(e[i],t[i]))return!1;return!0};K.isConstant=function(e){return!c(e)||e.isConstant};K.getValueOrUndefined=function(e,t,n){return c(e)?e.getValue(t,n):void 0};K.getValueOrDefault=function(e,t,n,i){return c(e)?y(e.getValue(t,i),n):n};K.getValueOrClonedDefault=function(e,t,n,i){let o;return c(e)&&(o=e.getValue(t,i)),c(o)||(o=n.clone(o)),o};const fee=z.WHITE,pee=d.ZERO,mee=gt.NONE,_ee=H.ZERO,gee=1,yee=0,bee=d.ZERO,Tee=Fs.CENTER,Aee=si.CENTER,xee=!1,Cee=new d,Eee=new z,wee=new d,See=new H,vee=new vt,Iee=new vt,Dee=new vt,Pee=new Re,Oee=new Pt;function xR(e){this.entity=e,this.billboard=void 0,this.textureValue=void 0}function Dh(e,t){if(!c(e))throw new E("entityCluster is required.");if(!c(t))throw new E("entityCollection is required.");t.collectionChanged.addEventListener(Dh.prototype._onCollectionChanged,this),this._cluster=e,this._entityCollection=t,this._items=new mt,this._onCollectionChanged(t,t.values,[],[])}Dh.prototype.update=function(e){if(!c(e))throw new E("time is required.");const t=this._items.values,n=this._cluster;for(let i=0,o=t.length;i<o;i++){const r=t[i],s=r.entity,a=s._billboard;let l,u=r.billboard,h=s.isShowing&&s.isAvailable(e)&&K.getValueOrDefault(a._show,e,!0),f;if(h&&(f=K.getValueOrUndefined(s._position,e,Cee),l=K.getValueOrUndefined(a._image,e),h=c(f)&&c(l)),!h){EI(r,s,n);continue}K.isConstant(s._position)||(n._clusterDirty=!0),c(u)||(u=n.getBillboard(s),u.id=s,u.image=void 0,r.billboard=u),u.show=h,(!c(u.image)||r.textureValue!==l)&&(u.image=l,r.textureValue=l),u.position=f,u.color=K.getValueOrDefault(a._color,e,fee,Eee),u.eyeOffset=K.getValueOrDefault(a._eyeOffset,e,pee,wee),u.heightReference=K.getValueOrDefault(a._heightReference,e,mee),u.pixelOffset=K.getValueOrDefault(a._pixelOffset,e,_ee,See),u.scale=K.getValueOrDefault(a._scale,e,gee),u.rotation=K.getValueOrDefault(a._rotation,e,yee),u.alignedAxis=K.getValueOrDefault(a._alignedAxis,e,bee),u.horizontalOrigin=K.getValueOrDefault(a._horizontalOrigin,e,Tee),u.verticalOrigin=K.getValueOrDefault(a._verticalOrigin,e,Aee),u.width=K.getValueOrUndefined(a._width,e),u.height=K.getValueOrUndefined(a._height,e),u.scaleByDistance=K.getValueOrUndefined(a._scaleByDistance,e,vee),u.translucencyByDistance=K.getValueOrUndefined(a._translucencyByDistance,e,Iee),u.pixelOffsetScaleByDistance=K.getValueOrUndefined(a._pixelOffsetScaleByDistance,e,Dee),u.sizeInMeters=K.getValueOrDefault(a._sizeInMeters,e,xee),u.distanceDisplayCondition=K.getValueOrUndefined(a._distanceDisplayCondition,e,Oee),u.disableDepthTestDistance=K.getValueOrUndefined(a._disableDepthTestDistance,e);const _=K.getValueOrUndefined(a._imageSubRegion,e,Pee);c(_)&&u.setImageSubRegion(u._imageId,_)}return!0};Dh.prototype.getBoundingSphere=function(e,t){if(!c(e))throw new E("entity is required.");if(!c(t))throw new E("result is required.");const n=this._items.get(e.id);if(!c(n)||!c(n.billboard))return rt.FAILED;const i=n.billboard;if(i.heightReference===gt.NONE)t.center=d.clone(i.position,t.center);else{if(!c(i._clampedPosition))return rt.PENDING;t.center=d.clone(i._clampedPosition,t.center)}return t.radius=0,rt.DONE};Dh.prototype.isDestroyed=function(){return!1};Dh.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(Dh.prototype._onCollectionChanged,this);const e=this._entityCollection.values;for(let t=0;t<e.length;t++)this._cluster.removeBillboard(e[t]);return ve(this)};Dh.prototype._onCollectionChanged=function(e,t,n,i){let o,r;const s=this._items,a=this._cluster;for(o=t.length-1;o>-1;o--)r=t[o],c(r._billboard)&&c(r._position)&&s.set(r.id,new xR(r));for(o=i.length-1;o>-1;o--)r=i[o],c(r._billboard)&&c(r._position)?s.contains(r.id)||s.set(r.id,new xR(r)):(EI(s.get(r.id),r,a),s.remove(r.id));for(o=n.length-1;o>-1;o--)r=n[o],EI(s.get(r.id),r,a),s.remove(r.id)};function EI(e,t,n){c(e)&&(e.billboard=void 0,n.removeBillboard(t))}function Yu(e,t){this.start=y(e,0),this.stop=y(t,0)}function se(e,t){this.center=d.clone(y(e,d.ZERO)),this.radius=y(t,0)}const UP=new d,kP=new d,VP=new d,HP=new d,GP=new d,jP=new d,WP=new d,xr=new d,qP=new d,YP=new d,$P=new d,XP=new d,Lee=4/3*R.PI;se.fromPoints=function(e,t){if(c(t)||(t=new se),!c(e)||e.length===0)return t.center=d.clone(d.ZERO,t.center),t.radius=0,t;const n=d.clone(e[0],WP),i=d.clone(n,UP),o=d.clone(n,kP),r=d.clone(n,VP),s=d.clone(n,HP),a=d.clone(n,GP),l=d.clone(n,jP),u=e.length;let h;for(h=1;h<u;h++){d.clone(e[h],n);const M=n.x,U=n.y,B=n.z;M<i.x&&d.clone(n,i),M>s.x&&d.clone(n,s),U<o.y&&d.clone(n,o),U>a.y&&d.clone(n,a),B<r.z&&d.clone(n,r),B>l.z&&d.clone(n,l)}const f=d.magnitudeSquared(d.subtract(s,i,xr)),_=d.magnitudeSquared(d.subtract(a,o,xr)),g=d.magnitudeSquared(d.subtract(l,r,xr));let m=i,b=s,T=f;_>T&&(T=_,m=o,b=a),g>T&&(T=g,m=r,b=l);const x=qP;x.x=(m.x+b.x)*.5,x.y=(m.y+b.y)*.5,x.z=(m.z+b.z)*.5;let C=d.magnitudeSquared(d.subtract(b,x,xr)),w=Math.sqrt(C);const v=YP;v.x=i.x,v.y=o.y,v.z=r.z;const P=$P;P.x=s.x,P.y=a.y,P.z=l.z;const N=d.midpoint(v,P,XP);let k=0;for(h=0;h<u;h++){d.clone(e[h],n);const M=d.magnitude(d.subtract(n,N,xr));M>k&&(k=M);const U=d.magnitudeSquared(d.subtract(n,x,xr));if(U>C){const B=Math.sqrt(U);w=(w+B)*.5,C=w*w;const S=B-w;x.x=(w*x.x+S*n.x)/B,x.y=(w*x.y+S*n.y)/B,x.z=(w*x.z+S*n.z)/B}}return w<k?(d.clone(x,t.center),t.radius=w):(d.clone(N,t.center),t.radius=k),t};const Ree=new co,Nee=new d,Mee=new d,nw=new he,iw=new he;se.fromRectangle2D=function(e,t,n){return se.fromRectangleWithHeights2D(e,t,0,0,n)};se.fromRectangleWithHeights2D=function(e,t,n,i,o){if(c(o)||(o=new se),!c(e))return o.center=d.clone(d.ZERO,o.center),o.radius=0,o;t=y(t,Ree),ce.southwest(e,nw),nw.height=n,ce.northeast(e,iw),iw.height=i;const r=t.project(nw,Nee),s=t.project(iw,Mee),a=s.x-r.x,l=s.y-r.y,u=s.z-r.z;o.radius=Math.sqrt(a*a+l*l+u*u)*.5;const h=o.center;return h.x=r.x+a*.5,h.y=r.y+l*.5,h.z=r.z+u*.5,o};const Fee=[];se.fromRectangle3D=function(e,t,n,i){if(t=y(t,ae.WGS84),n=y(n,0),c(i)||(i=new se),!c(e))return i.center=d.clone(d.ZERO,i.center),i.radius=0,i;const o=ce.subsample(e,t,n,Fee);return se.fromPoints(o,i)};se.fromVertices=function(e,t,n,i){if(c(i)||(i=new se),!c(e)||e.length===0)return i.center=d.clone(d.ZERO,i.center),i.radius=0,i;t=y(t,d.ZERO),n=y(n,3),A.typeOf.number.greaterThanOrEquals("stride",n,3);const o=WP;o.x=e[0]+t.x,o.y=e[1]+t.y,o.z=e[2]+t.z;const r=d.clone(o,UP),s=d.clone(o,kP),a=d.clone(o,VP),l=d.clone(o,HP),u=d.clone(o,GP),h=d.clone(o,jP),f=e.length;let _;for(_=0;_<f;_+=n){const B=e[_]+t.x,S=e[_+1]+t.y,D=e[_+2]+t.z;o.x=B,o.y=S,o.z=D,B<r.x&&d.clone(o,r),B>l.x&&d.clone(o,l),S<s.y&&d.clone(o,s),S>u.y&&d.clone(o,u),D<a.z&&d.clone(o,a),D>h.z&&d.clone(o,h)}const g=d.magnitudeSquared(d.subtract(l,r,xr)),m=d.magnitudeSquared(d.subtract(u,s,xr)),b=d.magnitudeSquared(d.subtract(h,a,xr));let T=r,x=l,C=g;m>C&&(C=m,T=s,x=u),b>C&&(C=b,T=a,x=h);const w=qP;w.x=(T.x+x.x)*.5,w.y=(T.y+x.y)*.5,w.z=(T.z+x.z)*.5;let v=d.magnitudeSquared(d.subtract(x,w,xr)),P=Math.sqrt(v);const N=YP;N.x=r.x,N.y=s.y,N.z=a.z;const k=$P;k.x=l.x,k.y=u.y,k.z=h.z;const M=d.midpoint(N,k,XP);let U=0;for(_=0;_<f;_+=n){o.x=e[_]+t.x,o.y=e[_+1]+t.y,o.z=e[_+2]+t.z;const B=d.magnitude(d.subtract(o,M,xr));B>U&&(U=B);const S=d.magnitudeSquared(d.subtract(o,w,xr));if(S>v){const D=Math.sqrt(S);P=(P+D)*.5,v=P*P;const p=D-P;w.x=(P*w.x+p*o.x)/D,w.y=(P*w.y+p*o.y)/D,w.z=(P*w.z+p*o.z)/D}}return P<U?(d.clone(w,i.center),i.radius=P):(d.clone(M,i.center),i.radius=U),i};se.fromEncodedCartesianVertices=function(e,t,n){if(c(n)||(n=new se),!c(e)||!c(t)||e.length!==t.length||e.length===0)return n.center=d.clone(d.ZERO,n.center),n.radius=0,n;const i=WP;i.x=e[0]+t[0],i.y=e[1]+t[1],i.z=e[2]+t[2];const o=d.clone(i,UP),r=d.clone(i,kP),s=d.clone(i,VP),a=d.clone(i,HP),l=d.clone(i,GP),u=d.clone(i,jP),h=e.length;let f;for(f=0;f<h;f+=3){const U=e[f]+t[f],B=e[f+1]+t[f+1],S=e[f+2]+t[f+2];i.x=U,i.y=B,i.z=S,U<o.x&&d.clone(i,o),U>a.x&&d.clone(i,a),B<r.y&&d.clone(i,r),B>l.y&&d.clone(i,l),S<s.z&&d.clone(i,s),S>u.z&&d.clone(i,u)}const _=d.magnitudeSquared(d.subtract(a,o,xr)),g=d.magnitudeSquared(d.subtract(l,r,xr)),m=d.magnitudeSquared(d.subtract(u,s,xr));let b=o,T=a,x=_;g>x&&(x=g,b=r,T=l),m>x&&(x=m,b=s,T=u);const C=qP;C.x=(b.x+T.x)*.5,C.y=(b.y+T.y)*.5,C.z=(b.z+T.z)*.5;let w=d.magnitudeSquared(d.subtract(T,C,xr)),v=Math.sqrt(w);const P=YP;P.x=o.x,P.y=r.y,P.z=s.z;const N=$P;N.x=a.x,N.y=l.y,N.z=u.z;const k=d.midpoint(P,N,XP);let M=0;for(f=0;f<h;f+=3){i.x=e[f]+t[f],i.y=e[f+1]+t[f+1],i.z=e[f+2]+t[f+2];const U=d.magnitude(d.subtract(i,k,xr));U>M&&(M=U);const B=d.magnitudeSquared(d.subtract(i,C,xr));if(B>w){const S=Math.sqrt(B);v=(v+S)*.5,w=v*v;const D=S-v;C.x=(v*C.x+D*i.x)/S,C.y=(v*C.y+D*i.y)/S,C.z=(v*C.z+D*i.z)/S}}return v<M?(d.clone(C,n.center),n.radius=v):(d.clone(k,n.center),n.radius=M),n};se.fromCornerPoints=function(e,t,n){A.typeOf.object("corner",e),A.typeOf.object("oppositeCorner",t),c(n)||(n=new se);const i=d.midpoint(e,t,n.center);return n.radius=d.distance(i,t),n};se.fromEllipsoid=function(e,t){return A.typeOf.object("ellipsoid",e),c(t)||(t=new se),d.clone(d.ZERO,t.center),t.radius=e.maximumRadius,t};const Bee=new d;se.fromBoundingSpheres=function(e,t){if(c(t)||(t=new se),!c(e)||e.length===0)return t.center=d.clone(d.ZERO,t.center),t.radius=0,t;const n=e.length;if(n===1)return se.clone(e[0],t);if(n===2)return se.union(e[0],e[1],t);const i=[];let o;for(o=0;o<n;o++)i.push(e[o].center);t=se.fromPoints(i,t);const r=t.center;let s=t.radius;for(o=0;o<n;o++){const a=e[o];s=Math.max(s,d.distance(r,a.center,Bee)+a.radius)}return t.radius=s,t};const zee=new d,Uee=new d,kee=new d;se.fromOrientedBoundingBox=function(e,t){A.defined("orientedBoundingBox",e),c(t)||(t=new se);const n=e.halfAxes,i=$.getColumn(n,0,zee),o=$.getColumn(n,1,Uee),r=$.getColumn(n,2,kee);return d.add(i,o,i),d.add(i,r,i),t.center=d.clone(e.center,t.center),t.radius=d.magnitude(i),t};const Vee=new d,Hee=new d;se.fromTransformation=function(e,t){A.typeOf.object("transformation",e),c(t)||(t=new se);const n=L.getTranslation(e,Vee),i=L.getScale(e,Hee),o=.5*d.magnitude(i);return t.center=d.clone(n,t.center),t.radius=o,t};se.clone=function(e,t){if(!!c(e))return c(t)?(t.center=d.clone(e.center,t.center),t.radius=e.radius,t):new se(e.center,e.radius)};se.packedLength=4;se.pack=function(e,t,n){A.typeOf.object("value",e),A.defined("array",t),n=y(n,0);const i=e.center;return t[n++]=i.x,t[n++]=i.y,t[n++]=i.z,t[n]=e.radius,t};se.unpack=function(e,t,n){A.defined("array",e),t=y(t,0),c(n)||(n=new se);const i=n.center;return i.x=e[t++],i.y=e[t++],i.z=e[t++],n.radius=e[t],n};const Gee=new d,jee=new d;se.union=function(e,t,n){A.typeOf.object("left",e),A.typeOf.object("right",t),c(n)||(n=new se);const i=e.center,o=e.radius,r=t.center,s=t.radius,a=d.subtract(r,i,Gee),l=d.magnitude(a);if(o>=l+s)return e.clone(n),n;if(s>=l+o)return t.clone(n),n;const u=(o+l+s)*.5,h=d.multiplyByScalar(a,(-o+u)/l,jee);return d.add(h,i,h),d.clone(h,n.center),n.radius=u,n};const Wee=new d;se.expand=function(e,t,n){A.typeOf.object("sphere",e),A.typeOf.object("point",t),n=se.clone(e,n);const i=d.magnitude(d.subtract(t,n.center,Wee));return i>n.radius&&(n.radius=i),n};se.intersectPlane=function(e,t){A.typeOf.object("sphere",e),A.typeOf.object("plane",t);const n=e.center,i=e.radius,o=t.normal,r=d.dot(o,n)+t.distance;return r<-i?Bt.OUTSIDE:r<i?Bt.INTERSECTING:Bt.INSIDE};se.transform=function(e,t,n){return A.typeOf.object("sphere",e),A.typeOf.object("transform",t),c(n)||(n=new se),n.center=L.multiplyByPoint(t,e.center,n.center),n.radius=L.getMaximumScale(t)*e.radius,n};const qee=new d;se.distanceSquaredTo=function(e,t){A.typeOf.object("sphere",e),A.typeOf.object("cartesian",t);const n=d.subtract(e.center,t,qee),i=d.magnitude(n)-e.radius;return i<=0?0:i*i};se.transformWithoutScale=function(e,t,n){return A.typeOf.object("sphere",e),A.typeOf.object("transform",t),c(n)||(n=new se),n.center=L.multiplyByPoint(t,e.center,n.center),n.radius=e.radius,n};const Yee=new d;se.computePlaneDistances=function(e,t,n,i){A.typeOf.object("sphere",e),A.typeOf.object("position",t),A.typeOf.object("direction",n),c(i)||(i=new Yu);const o=d.subtract(e.center,t,Yee),r=d.dot(n,o);return i.start=r-e.radius,i.stop=r+e.radius,i};const CR=new d,$ee=new d,Xee=new d,Qee=new d,Kee=new d,Zee=new he,Mk=new Array(8);for(let e=0;e<8;++e)Mk[e]=new d;const Jee=new co;se.projectTo2D=function(e,t,n){A.typeOf.object("sphere",e),t=y(t,Jee);const i=t.ellipsoid;let o=e.center;const r=e.radius;let s;d.equals(o,d.ZERO)?s=d.clone(d.UNIT_X,CR):s=i.geodeticSurfaceNormal(o,CR);const a=d.cross(d.UNIT_Z,s,$ee);d.normalize(a,a);const l=d.cross(s,a,Xee);d.normalize(l,l),d.multiplyByScalar(s,r,s),d.multiplyByScalar(l,r,l),d.multiplyByScalar(a,r,a);const u=d.negate(l,Kee),h=d.negate(a,Qee),f=Mk;let _=f[0];d.add(s,l,_),d.add(_,a,_),_=f[1],d.add(s,l,_),d.add(_,h,_),_=f[2],d.add(s,u,_),d.add(_,h,_),_=f[3],d.add(s,u,_),d.add(_,a,_),d.negate(s,s),_=f[4],d.add(s,l,_),d.add(_,a,_),_=f[5],d.add(s,l,_),d.add(_,h,_),_=f[6],d.add(s,u,_),d.add(_,h,_),_=f[7],d.add(s,u,_),d.add(_,a,_);const g=f.length;for(let x=0;x<g;++x){const C=f[x];d.add(o,C,C);const w=i.cartesianToCartographic(C,Zee);t.project(w,C)}n=se.fromPoints(f,n),o=n.center;const m=o.x,b=o.y,T=o.z;return o.x=T,o.y=m,o.z=b,n};se.isOccluded=function(e,t){return A.typeOf.object("sphere",e),A.typeOf.object("occluder",t),!t.isBoundingSphereVisible(e)};se.equals=function(e,t){return e===t||c(e)&&c(t)&&d.equals(e.center,t.center)&&e.radius===t.radius};se.prototype.intersectPlane=function(e){return se.intersectPlane(this,e)};se.prototype.distanceSquaredTo=function(e){return se.distanceSquaredTo(this,e)};se.prototype.computePlaneDistances=function(e,t,n){return se.computePlaneDistances(this,e,t,n)};se.prototype.isOccluded=function(e){return se.isOccluded(this,e)};se.prototype.equals=function(e){return se.equals(this,e)};se.prototype.clone=function(e){return se.clone(this,e)};se.prototype.volume=function(){const e=this.radius;return Lee*e*e*e};function oi(e){e=y(e,y.EMPTY_OBJECT),this.position=e.position,this.normal=e.normal,this.st=e.st,this.bitangent=e.bitangent,this.tangent=e.tangent,this.color=e.color}const ete={NONE:0,TOP:1,ALL:2},Kt=Object.freeze(ete);function Ee(e){e=y(e,y.EMPTY_OBJECT),this.position=y(e.position,!1),this.normal=y(e.normal,!1),this.st=y(e.st,!1),this.bitangent=y(e.bitangent,!1),this.tangent=y(e.tangent,!1),this.color=y(e.color,!1)}Ee.POSITION_ONLY=Object.freeze(new Ee({position:!0}));Ee.POSITION_AND_NORMAL=Object.freeze(new Ee({position:!0,normal:!0}));Ee.POSITION_NORMAL_AND_ST=Object.freeze(new Ee({position:!0,normal:!0,st:!0}));Ee.POSITION_AND_ST=Object.freeze(new Ee({position:!0,st:!0}));Ee.POSITION_AND_COLOR=Object.freeze(new Ee({position:!0,color:!0}));Ee.ALL=Object.freeze(new Ee({position:!0,normal:!0,st:!0,tangent:!0,bitangent:!0}));Ee.DEFAULT=Ee.POSITION_NORMAL_AND_ST;Ee.packedLength=6;Ee.pack=function(e,t,n){if(!c(e))throw new E("value is required");if(!c(t))throw new E("array is required");return n=y(n,0),t[n++]=e.position?1:0,t[n++]=e.normal?1:0,t[n++]=e.st?1:0,t[n++]=e.tangent?1:0,t[n++]=e.bitangent?1:0,t[n]=e.color?1:0,t};Ee.unpack=function(e,t,n){if(!c(e))throw new E("array is required");return t=y(t,0),c(n)||(n=new Ee),n.position=e[t++]===1,n.normal=e[t++]===1,n.st=e[t++]===1,n.tangent=e[t++]===1,n.bitangent=e[t++]===1,n.color=e[t]===1,n};Ee.clone=function(e,t){if(!!c(e))return c(t)||(t=new Ee),t.position=e.position,t.normal=e.normal,t.st=e.st,t.tangent=e.tangent,t.bitangent=e.bitangent,t.color=e.color,t};const tte=new d;function rr(e){e=y(e,y.EMPTY_OBJECT);const t=e.minimum,n=e.maximum;if(A.typeOf.object("min",t),A.typeOf.object("max",n),c(e.offsetAttribute)&&e.offsetAttribute===Kt.TOP)throw new E("GeometryOffsetAttribute.TOP is not a supported options.offsetAttribute for this geometry.");const i=y(e.vertexFormat,Ee.DEFAULT);this._minimum=d.clone(t),this._maximum=d.clone(n),this._vertexFormat=i,this._offsetAttribute=e.offsetAttribute,this._workerName="createBoxGeometry"}rr.fromDimensions=function(e){e=y(e,y.EMPTY_OBJECT);const t=e.dimensions;A.typeOf.object("dimensions",t),A.typeOf.number.greaterThanOrEquals("dimensions.x",t.x,0),A.typeOf.number.greaterThanOrEquals("dimensions.y",t.y,0),A.typeOf.number.greaterThanOrEquals("dimensions.z",t.z,0);const n=d.multiplyByScalar(t,.5,new d);return new rr({minimum:d.negate(n,new d),maximum:n,vertexFormat:e.vertexFormat,offsetAttribute:e.offsetAttribute})};rr.fromAxisAlignedBoundingBox=function(e){return A.typeOf.object("boundingBox",e),new rr({minimum:e.minimum,maximum:e.maximum})};rr.packedLength=2*d.packedLength+Ee.packedLength+1;rr.pack=function(e,t,n){return A.typeOf.object("value",e),A.defined("array",t),n=y(n,0),d.pack(e._minimum,t,n),d.pack(e._maximum,t,n+d.packedLength),Ee.pack(e._vertexFormat,t,n+2*d.packedLength),t[n+2*d.packedLength+Ee.packedLength]=y(e._offsetAttribute,-1),t};const Fk=new d,Bk=new d,zk=new Ee,ER={minimum:Fk,maximum:Bk,vertexFormat:zk,offsetAttribute:void 0};rr.unpack=function(e,t,n){A.defined("array",e),t=y(t,0);const i=d.unpack(e,t,Fk),o=d.unpack(e,t+d.packedLength,Bk),r=Ee.unpack(e,t+2*d.packedLength,zk),s=e[t+2*d.packedLength+Ee.packedLength];return c(n)?(n._minimum=d.clone(i,n._minimum),n._maximum=d.clone(o,n._maximum),n._vertexFormat=Ee.clone(r,n._vertexFormat),n._offsetAttribute=s===-1?void 0:s,n):(ER.offsetAttribute=s===-1?void 0:s,new rr(ER))};rr.createGeometry=function(e){const t=e._minimum,n=e._maximum,i=e._vertexFormat;if(d.equals(t,n))return;const o=new oi;let r,s;if(i.position&&(i.st||i.normal||i.tangent||i.bitangent)){if(i.position&&(s=new Float64Array(6*4*3),s[0]=t.x,s[1]=t.y,s[2]=n.z,s[3]=n.x,s[4]=t.y,s[5]=n.z,s[6]=n.x,s[7]=n.y,s[8]=n.z,s[9]=t.x,s[10]=n.y,s[11]=n.z,s[12]=t.x,s[13]=t.y,s[14]=t.z,s[15]=n.x,s[16]=t.y,s[17]=t.z,s[18]=n.x,s[19]=n.y,s[20]=t.z,s[21]=t.x,s[22]=n.y,s[23]=t.z,s[24]=n.x,s[25]=t.y,s[26]=t.z,s[27]=n.x,s[28]=n.y,s[29]=t.z,s[30]=n.x,s[31]=n.y,s[32]=n.z,s[33]=n.x,s[34]=t.y,s[35]=n.z,s[36]=t.x,s[37]=t.y,s[38]=t.z,s[39]=t.x,s[40]=n.y,s[41]=t.z,s[42]=t.x,s[43]=n.y,s[44]=n.z,s[45]=t.x,s[46]=t.y,s[47]=n.z,s[48]=t.x,s[49]=n.y,s[50]=t.z,s[51]=n.x,s[52]=n.y,s[53]=t.z,s[54]=n.x,s[55]=n.y,s[56]=n.z,s[57]=t.x,s[58]=n.y,s[59]=n.z,s[60]=t.x,s[61]=t.y,s[62]=t.z,s[63]=n.x,s[64]=t.y,s[65]=t.z,s[66]=n.x,s[67]=t.y,s[68]=n.z,s[69]=t.x,s[70]=t.y,s[71]=n.z,o.position=new Ie({componentDatatype:Z.DOUBLE,componentsPerAttribute:3,values:s})),i.normal){const u=new Float32Array(72);u[0]=0,u[1]=0,u[2]=1,u[3]=0,u[4]=0,u[5]=1,u[6]=0,u[7]=0,u[8]=1,u[9]=0,u[10]=0,u[11]=1,u[12]=0,u[13]=0,u[14]=-1,u[15]=0,u[16]=0,u[17]=-1,u[18]=0,u[19]=0,u[20]=-1,u[21]=0,u[22]=0,u[23]=-1,u[24]=1,u[25]=0,u[26]=0,u[27]=1,u[28]=0,u[29]=0,u[30]=1,u[31]=0,u[32]=0,u[33]=1,u[34]=0,u[35]=0,u[36]=-1,u[37]=0,u[38]=0,u[39]=-1,u[40]=0,u[41]=0,u[42]=-1,u[43]=0,u[44]=0,u[45]=-1,u[46]=0,u[47]=0,u[48]=0,u[49]=1,u[50]=0,u[51]=0,u[52]=1,u[53]=0,u[54]=0,u[55]=1,u[56]=0,u[57]=0,u[58]=1,u[59]=0,u[60]=0,u[61]=-1,u[62]=0,u[63]=0,u[64]=-1,u[65]=0,u[66]=0,u[67]=-1,u[68]=0,u[69]=0,u[70]=-1,u[71]=0,o.normal=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:3,values:u})}if(i.st){const u=new Float32Array(48);u[0]=0,u[1]=0,u[2]=1,u[3]=0,u[4]=1,u[5]=1,u[6]=0,u[7]=1,u[8]=1,u[9]=0,u[10]=0,u[11]=0,u[12]=0,u[13]=1,u[14]=1,u[15]=1,u[16]=0,u[17]=0,u[18]=1,u[19]=0,u[20]=1,u[21]=1,u[22]=0,u[23]=1,u[24]=1,u[25]=0,u[26]=0,u[27]=0,u[28]=0,u[29]=1,u[30]=1,u[31]=1,u[32]=1,u[33]=0,u[34]=0,u[35]=0,u[36]=0,u[37]=1,u[38]=1,u[39]=1,u[40]=0,u[41]=0,u[42]=1,u[43]=0,u[44]=1,u[45]=1,u[46]=0,u[47]=1,o.st=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:2,values:u})}if(i.tangent){const u=new Float32Array(72);u[0]=1,u[1]=0,u[2]=0,u[3]=1,u[4]=0,u[5]=0,u[6]=1,u[7]=0,u[8]=0,u[9]=1,u[10]=0,u[11]=0,u[12]=-1,u[13]=0,u[14]=0,u[15]=-1,u[16]=0,u[17]=0,u[18]=-1,u[19]=0,u[20]=0,u[21]=-1,u[22]=0,u[23]=0,u[24]=0,u[25]=1,u[26]=0,u[27]=0,u[28]=1,u[29]=0,u[30]=0,u[31]=1,u[32]=0,u[33]=0,u[34]=1,u[35]=0,u[36]=0,u[37]=-1,u[38]=0,u[39]=0,u[40]=-1,u[41]=0,u[42]=0,u[43]=-1,u[44]=0,u[45]=0,u[46]=-1,u[47]=0,u[48]=-1,u[49]=0,u[50]=0,u[51]=-1,u[52]=0,u[53]=0,u[54]=-1,u[55]=0,u[56]=0,u[57]=-1,u[58]=0,u[59]=0,u[60]=1,u[61]=0,u[62]=0,u[63]=1,u[64]=0,u[65]=0,u[66]=1,u[67]=0,u[68]=0,u[69]=1,u[70]=0,u[71]=0,o.tangent=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:3,values:u})}if(i.bitangent){const u=new Float32Array(72);u[0]=0,u[1]=1,u[2]=0,u[3]=0,u[4]=1,u[5]=0,u[6]=0,u[7]=1,u[8]=0,u[9]=0,u[10]=1,u[11]=0,u[12]=0,u[13]=1,u[14]=0,u[15]=0,u[16]=1,u[17]=0,u[18]=0,u[19]=1,u[20]=0,u[21]=0,u[22]=1,u[23]=0,u[24]=0,u[25]=0,u[26]=1,u[27]=0,u[28]=0,u[29]=1,u[30]=0,u[31]=0,u[32]=1,u[33]=0,u[34]=0,u[35]=1,u[36]=0,u[37]=0,u[38]=1,u[39]=0,u[40]=0,u[41]=1,u[42]=0,u[43]=0,u[44]=1,u[45]=0,u[46]=0,u[47]=1,u[48]=0,u[49]=0,u[50]=1,u[51]=0,u[52]=0,u[53]=1,u[54]=0,u[55]=0,u[56]=1,u[57]=0,u[58]=0,u[59]=1,u[60]=0,u[61]=0,u[62]=1,u[63]=0,u[64]=0,u[65]=1,u[66]=0,u[67]=0,u[68]=1,u[69]=0,u[70]=0,u[71]=1,o.bitangent=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:3,values:u})}r=new Uint16Array(6*2*3),r[0]=0,r[1]=1,r[2]=2,r[3]=0,r[4]=2,r[5]=3,r[6]=4+2,r[7]=4+1,r[8]=4+0,r[9]=4+3,r[10]=4+2,r[11]=4+0,r[12]=8+0,r[13]=8+1,r[14]=8+2,r[15]=8+0,r[16]=8+2,r[17]=8+3,r[18]=12+2,r[19]=12+1,r[20]=12+0,r[21]=12+3,r[22]=12+2,r[23]=12+0,r[24]=16+2,r[25]=16+1,r[26]=16+0,r[27]=16+3,r[28]=16+2,r[29]=16+0,r[30]=20+0,r[31]=20+1,r[32]=20+2,r[33]=20+0,r[34]=20+2,r[35]=20+3}else s=new Float64Array(8*3),s[0]=t.x,s[1]=t.y,s[2]=t.z,s[3]=n.x,s[4]=t.y,s[5]=t.z,s[6]=n.x,s[7]=n.y,s[8]=t.z,s[9]=t.x,s[10]=n.y,s[11]=t.z,s[12]=t.x,s[13]=t.y,s[14]=n.z,s[15]=n.x,s[16]=t.y,s[17]=n.z,s[18]=n.x,s[19]=n.y,s[20]=n.z,s[21]=t.x,s[22]=n.y,s[23]=n.z,o.position=new Ie({componentDatatype:Z.DOUBLE,componentsPerAttribute:3,values:s}),r=new Uint16Array(6*2*3),r[0]=4,r[1]=5,r[2]=6,r[3]=4,r[4]=6,r[5]=7,r[6]=1,r[7]=0,r[8]=3,r[9]=1,r[10]=3,r[11]=2,r[12]=1,r[13]=6,r[14]=5,r[15]=1,r[16]=2,r[17]=6,r[18]=2,r[19]=3,r[20]=7,r[21]=2,r[22]=7,r[23]=6,r[24]=3,r[25]=0,r[26]=4,r[27]=3,r[28]=4,r[29]=7,r[30]=0,r[31]=1,r[32]=5,r[33]=0,r[34]=5,r[35]=4;const a=d.subtract(n,t,tte),l=d.magnitude(a)*.5;if(c(e._offsetAttribute)){const u=s.length,h=e._offsetAttribute===Kt.NONE?0:1,f=new Uint8Array(u/3).fill(h);o.applyOffset=new Ie({componentDatatype:Z.UNSIGNED_BYTE,componentsPerAttribute:1,values:f})}return new Tt({attributes:o,indices:r,primitiveType:ze.TRIANGLES,boundingSphere:new se(d.ZERO,l),offsetAttribute:e._offsetAttribute})};let ow;rr.getUnitBox=function(){return c(ow)||(ow=rr.createGeometry(rr.fromDimensions({dimensions:new d(1,1,1),vertexFormat:Ee.POSITION_ONLY}))),ow};const nte=new d;function Na(e){e=y(e,y.EMPTY_OBJECT);const t=e.minimum,n=e.maximum;if(A.typeOf.object("min",t),A.typeOf.object("max",n),c(e.offsetAttribute)&&e.offsetAttribute===Kt.TOP)throw new E("GeometryOffsetAttribute.TOP is not a supported options.offsetAttribute for this geometry.");this._min=d.clone(t),this._max=d.clone(n),this._offsetAttribute=e.offsetAttribute,this._workerName="createBoxOutlineGeometry"}Na.fromDimensions=function(e){e=y(e,y.EMPTY_OBJECT);const t=e.dimensions;A.typeOf.object("dimensions",t),A.typeOf.number.greaterThanOrEquals("dimensions.x",t.x,0),A.typeOf.number.greaterThanOrEquals("dimensions.y",t.y,0),A.typeOf.number.greaterThanOrEquals("dimensions.z",t.z,0);const n=d.multiplyByScalar(t,.5,new d);return new Na({minimum:d.negate(n,new d),maximum:n,offsetAttribute:e.offsetAttribute})};Na.fromAxisAlignedBoundingBox=function(e){return A.typeOf.object("boundindBox",e),new Na({minimum:e.minimum,maximum:e.maximum})};Na.packedLength=2*d.packedLength+1;Na.pack=function(e,t,n){return A.typeOf.object("value",e),A.defined("array",t),n=y(n,0),d.pack(e._min,t,n),d.pack(e._max,t,n+d.packedLength),t[n+d.packedLength*2]=y(e._offsetAttribute,-1),t};const Uk=new d,kk=new d,wR={minimum:Uk,maximum:kk,offsetAttribute:void 0};Na.unpack=function(e,t,n){A.defined("array",e),t=y(t,0);const i=d.unpack(e,t,Uk),o=d.unpack(e,t+d.packedLength,kk),r=e[t+d.packedLength*2];return c(n)?(n._min=d.clone(i,n._min),n._max=d.clone(o,n._max),n._offsetAttribute=r===-1?void 0:r,n):(wR.offsetAttribute=r===-1?void 0:r,new Na(wR))};Na.createGeometry=function(e){const t=e._min,n=e._max;if(d.equals(t,n))return;const i=new oi,o=new Uint16Array(12*2),r=new Float64Array(8*3);r[0]=t.x,r[1]=t.y,r[2]=t.z,r[3]=n.x,r[4]=t.y,r[5]=t.z,r[6]=n.x,r[7]=n.y,r[8]=t.z,r[9]=t.x,r[10]=n.y,r[11]=t.z,r[12]=t.x,r[13]=t.y,r[14]=n.z,r[15]=n.x,r[16]=t.y,r[17]=n.z,r[18]=n.x,r[19]=n.y,r[20]=n.z,r[21]=t.x,r[22]=n.y,r[23]=n.z,i.position=new Ie({componentDatatype:Z.DOUBLE,componentsPerAttribute:3,values:r}),o[0]=4,o[1]=5,o[2]=5,o[3]=6,o[4]=6,o[5]=7,o[6]=7,o[7]=4,o[8]=0,o[9]=1,o[10]=1,o[11]=2,o[12]=2,o[13]=3,o[14]=3,o[15]=0,o[16]=0,o[17]=4,o[18]=1,o[19]=5,o[20]=2,o[21]=6,o[22]=3,o[23]=7;const s=d.subtract(n,t,nte),a=d.magnitude(s)*.5;if(c(e._offsetAttribute)){const l=r.length,u=e._offsetAttribute===Kt.NONE?0:1,h=new Uint8Array(l/3).fill(u);i.applyOffset=new Ie({componentDatatype:Z.UNSIGNED_BYTE,componentsPerAttribute:1,values:h})}return new Tt({attributes:i,indices:o,primitiveType:ze.LINES,boundingSphere:new se(d.ZERO,a),offsetAttribute:e._offsetAttribute})};function $t(e,t,n,i){e=y(e,1),t=y(t,1),n=y(n,1),i=y(i,1),this.value=new Uint8Array([z.floatToByte(e),z.floatToByte(t),z.floatToByte(n),z.floatToByte(i)])}Object.defineProperties($t.prototype,{componentDatatype:{get:function(){return Z.UNSIGNED_BYTE}},componentsPerAttribute:{get:function(){return 4}},normalize:{get:function(){return!0}}});$t.fromColor=function(e){if(!c(e))throw new E("color is required.");return new $t(e.red,e.green,e.blue,e.alpha)};$t.toValue=function(e,t){if(!c(e))throw new E("color is required.");return c(t)?e.toBytes(t):new Uint8Array(e.toBytes())};$t.equals=function(e,t){return e===t||c(e)&&c(t)&&e.value[0]===t.value[0]&&e.value[1]===t.value[1]&&e.value[2]===t.value[2]&&e.value[3]===t.value[3]};function Vn(e,t){if(e=y(e,0),t=y(t,Number.MAX_VALUE),t<=e)throw new E("far distance must be greater than near distance.");this.value=new Float32Array([e,t])}Object.defineProperties(Vn.prototype,{componentDatatype:{get:function(){return Z.FLOAT}},componentsPerAttribute:{get:function(){return 2}},normalize:{get:function(){return!1}}});Vn.fromDistanceDisplayCondition=function(e){if(!c(e))throw new E("distanceDisplayCondition is required.");if(e.far<=e.near)throw new E("distanceDisplayCondition.far distance must be greater than distanceDisplayCondition.near distance.");return new Vn(e.near,e.far)};Vn.toValue=function(e,t){if(!c(e))throw new E("distanceDisplayCondition is required.");return c(t)?(t[0]=e.near,t[1]=e.far,t):new Float32Array([e.near,e.far])};function Gt(e){if(e=y(e,y.EMPTY_OBJECT),!c(e.geometry))throw new E("options.geometry is required.");this.geometry=e.geometry,this.modelMatrix=L.clone(y(e.modelMatrix,L.IDENTITY)),this.id=e.id,this.pickPrimitive=e.pickPrimitive,this.attributes=y(e.attributes,{}),this.westHemisphereGeometry=void 0,this.eastHemisphereGeometry=void 0}function Ht(e){e=y(e,y.EMPTY_OBJECT),this.start=c(e.start)?ie.clone(e.start):new ie,this.stop=c(e.stop)?ie.clone(e.stop):new ie,this.data=e.data,this.isStartIncluded=y(e.isStartIncluded,!0),this.isStopIncluded=y(e.isStopIncluded,!0)}Object.defineProperties(Ht.prototype,{isEmpty:{get:function(){const e=ie.compare(this.stop,this.start);return e<0||e===0&&(!this.isStartIncluded||!this.isStopIncluded)}}});const am={start:void 0,stop:void 0,isStartIncluded:void 0,isStopIncluded:void 0,data:void 0};Ht.fromIso8601=function(e,t){A.typeOf.object("options",e),A.typeOf.string("options.iso8601",e.iso8601);const n=e.iso8601.split("/");if(n.length!==2)throw new E("options.iso8601 is an invalid ISO 8601 interval.");const i=ie.fromIso8601(n[0]),o=ie.fromIso8601(n[1]),r=y(e.isStartIncluded,!0),s=y(e.isStopIncluded,!0),a=e.data;return c(t)?(t.start=i,t.stop=o,t.isStartIncluded=r,t.isStopIncluded=s,t.data=a,t):(am.start=i,am.stop=o,am.isStartIncluded=r,am.isStopIncluded=s,am.data=a,new Ht(am))};Ht.toIso8601=function(e,t){return A.typeOf.object("timeInterval",e),`${ie.toIso8601(e.start,t)}/${ie.toIso8601(e.stop,t)}`};Ht.clone=function(e,t){if(!!c(e))return c(t)?(t.start=e.start,t.stop=e.stop,t.isStartIncluded=e.isStartIncluded,t.isStopIncluded=e.isStopIncluded,t.data=e.data,t):new Ht(e)};Ht.equals=function(e,t,n){return e===t||c(e)&&c(t)&&(e.isEmpty&&t.isEmpty||e.isStartIncluded===t.isStartIncluded&&e.isStopIncluded===t.isStopIncluded&&ie.equals(e.start,t.start)&&ie.equals(e.stop,t.stop)&&(e.data===t.data||c(n)&&n(e.data,t.data)))};Ht.equalsEpsilon=function(e,t,n,i){return n=y(n,0),e===t||c(e)&&c(t)&&(e.isEmpty&&t.isEmpty||e.isStartIncluded===t.isStartIncluded&&e.isStopIncluded===t.isStopIncluded&&ie.equalsEpsilon(e.start,t.start,n)&&ie.equalsEpsilon(e.stop,t.stop,n)&&(e.data===t.data||c(i)&&i(e.data,t.data)))};Ht.intersect=function(e,t,n,i){if(A.typeOf.object("left",e),!c(t))return Ht.clone(Ht.EMPTY,n);const o=e.start,r=e.stop,s=t.start,a=t.stop,l=ie.greaterThanOrEquals(s,o)&&ie.greaterThanOrEquals(r,s),u=!l&&ie.lessThanOrEquals(s,o)&&ie.lessThanOrEquals(o,a);if(!l&&!u)return Ht.clone(Ht.EMPTY,n);const h=e.isStartIncluded,f=e.isStopIncluded,_=t.isStartIncluded,g=t.isStopIncluded,m=ie.lessThan(r,a);return c(n)||(n=new Ht),n.start=l?s:o,n.isStartIncluded=h&&_||!ie.equals(s,o)&&(l&&_||u&&h),n.stop=m?r:a,n.isStopIncluded=m?f:f&&g||!ie.equals(a,r)&&g,n.data=c(i)?i(e.data,t.data):e.data,n};Ht.contains=function(e,t){if(A.typeOf.object("timeInterval",e),A.typeOf.object("julianDate",t),e.isEmpty)return!1;const n=ie.compare(e.start,t);if(n===0)return e.isStartIncluded;const i=ie.compare(t,e.stop);return i===0?e.isStopIncluded:n<0&&i<0};Ht.prototype.clone=function(e){return Ht.clone(this,e)};Ht.prototype.equals=function(e,t){return Ht.equals(this,e,t)};Ht.prototype.equalsEpsilon=function(e,t,n){return Ht.equalsEpsilon(this,e,t,n)};Ht.prototype.toString=function(){return Ht.toIso8601(this)};Ht.EMPTY=Object.freeze(new Ht({start:new ie,stop:new ie,isStartIncluded:!1,isStopIncluded:!1}));const Vk=Object.freeze(ie.fromIso8601("0000-01-01T00:00:00Z")),Hk=Object.freeze(ie.fromIso8601("9999-12-31T24:00:00Z")),ite=Object.freeze(new Ht({start:Vk,stop:Hk})),ote={MINIMUM_VALUE:Vk,MAXIMUM_VALUE:Hk,MAXIMUM_INTERVAL:ite},Ke=ote;function Zi(e,t,n){e=y(e,0),t=y(t,0),n=y(n,0),this.value=new Float32Array([e,t,n])}Object.defineProperties(Zi.prototype,{componentDatatype:{get:function(){return Z.FLOAT}},componentsPerAttribute:{get:function(){return 3}},normalize:{get:function(){return!1}}});Zi.fromCartesian3=function(e){return A.defined("offset",e),new Zi(e.x,e.y,e.z)};Zi.toValue=function(e,t){return A.defined("offset",e),c(t)||(t=new Float32Array([e.x,e.y,e.z])),t[0]=e.x,t[1]=e.y,t[2]=e.z,t};function mn(e){e=y(e,!0),this.value=mn.toValue(e)}Object.defineProperties(mn.prototype,{componentDatatype:{get:function(){return Z.UNSIGNED_BYTE}},componentsPerAttribute:{get:function(){return 1}},normalize:{get:function(){return!1}}});mn.toValue=function(e,t){if(!c(e))throw new E("show is required.");return c(t)?(t[0]=e,t):new Uint8Array([e])};const rte=`in vec3 v_positionEC;
|
|
in vec3 v_normalEC;
|
|
in vec3 v_tangentEC;
|
|
in vec3 v_bitangentEC;
|
|
in vec2 v_st;
|
|
|
|
void main()
|
|
{
|
|
vec3 positionToEyeEC = -v_positionEC;
|
|
mat3 tangentToEyeMatrix = czm_tangentToEyeSpaceMatrix(v_normalEC, v_tangentEC, v_bitangentEC);
|
|
|
|
vec3 normalEC = normalize(v_normalEC);
|
|
#ifdef FACE_FORWARD
|
|
normalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);
|
|
#endif
|
|
|
|
czm_materialInput materialInput;
|
|
materialInput.normalEC = normalEC;
|
|
materialInput.tangentToEyeMatrix = tangentToEyeMatrix;
|
|
materialInput.positionToEyeEC = positionToEyeEC;
|
|
materialInput.st = v_st;
|
|
czm_material material = czm_getMaterial(materialInput);
|
|
|
|
#ifdef FLAT
|
|
out_FragColor = vec4(material.diffuse + material.emission, material.alpha);
|
|
#else
|
|
out_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);
|
|
#endif
|
|
}
|
|
`,ste=`in vec3 position3DHigh;
|
|
in vec3 position3DLow;
|
|
in vec3 normal;
|
|
in vec3 tangent;
|
|
in vec3 bitangent;
|
|
in vec2 st;
|
|
in float batchId;
|
|
|
|
out vec3 v_positionEC;
|
|
out vec3 v_normalEC;
|
|
out vec3 v_tangentEC;
|
|
out vec3 v_bitangentEC;
|
|
out vec2 v_st;
|
|
|
|
void main()
|
|
{
|
|
vec4 p = czm_computePosition();
|
|
|
|
v_positionEC = (czm_modelViewRelativeToEye * p).xyz; // position in eye coordinates
|
|
v_normalEC = czm_normal * normal; // normal in eye coordinates
|
|
v_tangentEC = czm_normal * tangent; // tangent in eye coordinates
|
|
v_bitangentEC = czm_normal * bitangent; // bitangent in eye coordinates
|
|
v_st = st;
|
|
|
|
gl_Position = czm_modelViewProjectionRelativeToEye * p;
|
|
}
|
|
`,ate=`in vec3 v_positionEC;
|
|
in vec3 v_normalEC;
|
|
|
|
void main()
|
|
{
|
|
vec3 positionToEyeEC = -v_positionEC;
|
|
|
|
vec3 normalEC = normalize(v_normalEC);
|
|
#ifdef FACE_FORWARD
|
|
normalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);
|
|
#endif
|
|
|
|
czm_materialInput materialInput;
|
|
materialInput.normalEC = normalEC;
|
|
materialInput.positionToEyeEC = positionToEyeEC;
|
|
czm_material material = czm_getMaterial(materialInput);
|
|
|
|
#ifdef FLAT
|
|
out_FragColor = vec4(material.diffuse + material.emission, material.alpha);
|
|
#else
|
|
out_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);
|
|
#endif
|
|
}
|
|
`,cte=`in vec3 position3DHigh;
|
|
in vec3 position3DLow;
|
|
in vec3 normal;
|
|
in float batchId;
|
|
|
|
out vec3 v_positionEC;
|
|
out vec3 v_normalEC;
|
|
|
|
void main()
|
|
{
|
|
vec4 p = czm_computePosition();
|
|
|
|
v_positionEC = (czm_modelViewRelativeToEye * p).xyz; // position in eye coordinates
|
|
v_normalEC = czm_normal * normal; // normal in eye coordinates
|
|
|
|
gl_Position = czm_modelViewProjectionRelativeToEye * p;
|
|
}
|
|
`,lte=`in vec3 v_positionEC;
|
|
in vec3 v_normalEC;
|
|
in vec2 v_st;
|
|
|
|
void main()
|
|
{
|
|
vec3 positionToEyeEC = -v_positionEC;
|
|
|
|
vec3 normalEC = normalize(v_normalEC);
|
|
#ifdef FACE_FORWARD
|
|
normalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);
|
|
#endif
|
|
|
|
czm_materialInput materialInput;
|
|
materialInput.normalEC = normalEC;
|
|
materialInput.positionToEyeEC = positionToEyeEC;
|
|
materialInput.st = v_st;
|
|
czm_material material = czm_getMaterial(materialInput);
|
|
|
|
#ifdef FLAT
|
|
out_FragColor = vec4(material.diffuse + material.emission, material.alpha);
|
|
#else
|
|
out_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);
|
|
#endif
|
|
}
|
|
`,ute=`in vec3 position3DHigh;
|
|
in vec3 position3DLow;
|
|
in vec3 normal;
|
|
in vec2 st;
|
|
in float batchId;
|
|
|
|
out vec3 v_positionEC;
|
|
out vec3 v_normalEC;
|
|
out vec2 v_st;
|
|
|
|
void main()
|
|
{
|
|
vec4 p = czm_computePosition();
|
|
|
|
v_positionEC = (czm_modelViewRelativeToEye * p).xyz; // position in eye coordinates
|
|
v_normalEC = czm_normal * normal; // normal in eye coordinates
|
|
v_st = st;
|
|
|
|
gl_Position = czm_modelViewProjectionRelativeToEye * p;
|
|
}
|
|
`,dte={ADD:J.FUNC_ADD,SUBTRACT:J.FUNC_SUBTRACT,REVERSE_SUBTRACT:J.FUNC_REVERSE_SUBTRACT,MIN:J.MIN,MAX:J.MAX},cc=Object.freeze(dte),hte={ZERO:J.ZERO,ONE:J.ONE,SOURCE_COLOR:J.SRC_COLOR,ONE_MINUS_SOURCE_COLOR:J.ONE_MINUS_SRC_COLOR,DESTINATION_COLOR:J.DST_COLOR,ONE_MINUS_DESTINATION_COLOR:J.ONE_MINUS_DST_COLOR,SOURCE_ALPHA:J.SRC_ALPHA,ONE_MINUS_SOURCE_ALPHA:J.ONE_MINUS_SRC_ALPHA,DESTINATION_ALPHA:J.DST_ALPHA,ONE_MINUS_DESTINATION_ALPHA:J.ONE_MINUS_DST_ALPHA,CONSTANT_COLOR:J.CONSTANT_COLOR,ONE_MINUS_CONSTANT_COLOR:J.ONE_MINUS_CONSTANT_COLOR,CONSTANT_ALPHA:J.CONSTANT_ALPHA,ONE_MINUS_CONSTANT_ALPHA:J.ONE_MINUS_CONSTANT_ALPHA,SOURCE_ALPHA_SATURATE:J.SRC_ALPHA_SATURATE},Yi=Object.freeze(hte),fte={DISABLED:Object.freeze({enabled:!1}),ALPHA_BLEND:Object.freeze({enabled:!0,equationRgb:cc.ADD,equationAlpha:cc.ADD,functionSourceRgb:Yi.SOURCE_ALPHA,functionSourceAlpha:Yi.ONE,functionDestinationRgb:Yi.ONE_MINUS_SOURCE_ALPHA,functionDestinationAlpha:Yi.ONE_MINUS_SOURCE_ALPHA}),PRE_MULTIPLIED_ALPHA_BLEND:Object.freeze({enabled:!0,equationRgb:cc.ADD,equationAlpha:cc.ADD,functionSourceRgb:Yi.ONE,functionSourceAlpha:Yi.ONE,functionDestinationRgb:Yi.ONE_MINUS_SOURCE_ALPHA,functionDestinationAlpha:Yi.ONE_MINUS_SOURCE_ALPHA}),ADDITIVE_BLEND:Object.freeze({enabled:!0,equationRgb:cc.ADD,equationAlpha:cc.ADD,functionSourceRgb:Yi.SOURCE_ALPHA,functionSourceAlpha:Yi.ONE,functionDestinationRgb:Yi.ONE,functionDestinationAlpha:Yi.ONE})},Zn=Object.freeze(fte),pte={FRONT:J.FRONT,BACK:J.BACK,FRONT_AND_BACK:J.FRONT_AND_BACK},Qi=Object.freeze(pte);function Lo(e){e=y(e,y.EMPTY_OBJECT),this.material=e.material,this.translucent=y(e.translucent,!0),this._vertexShaderSource=e.vertexShaderSource,this._fragmentShaderSource=e.fragmentShaderSource,this._renderState=e.renderState,this._closed=y(e.closed,!1)}Object.defineProperties(Lo.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},renderState:{get:function(){return this._renderState}},closed:{get:function(){return this._closed}}});Lo.prototype.getFragmentShaderSource=function(){const e=[];return this.flat&&e.push("#define FLAT"),this.faceForward&&e.push("#define FACE_FORWARD"),c(this.material)&&e.push(this.material.shaderSource),e.push(this.fragmentShaderSource),e.join(`
|
|
`)};Lo.prototype.isTranslucent=function(){return c(this.material)&&this.material.isTranslucent()||!c(this.material)&&this.translucent};Lo.prototype.getRenderState=function(){const e=this.isTranslucent(),t=Je(this.renderState,!1);return e?(t.depthMask=!1,t.blending=Zn.ALPHA_BLEND):t.depthMask=!0,t};Lo.getDefaultRenderState=function(e,t,n){let i={depthTest:{enabled:!0}};return e&&(i.depthMask=!1,i.blending=Zn.ALPHA_BLEND),t&&(i.cull={enabled:!0,face:Qi.BACK}),c(n)&&(i=jt(n,i,!0)),i};const mte=`uniform sampler2D image;
|
|
|
|
czm_material czm_getMaterial(czm_materialInput materialInput)
|
|
{
|
|
czm_material material = czm_getDefaultMaterial(materialInput);
|
|
vec4 rampColor = texture(image, vec2(materialInput.aspect / (2.0 * czm_pi), 0.5));
|
|
rampColor = czm_gammaCorrect(rampColor);
|
|
material.diffuse = rampColor.rgb;
|
|
material.alpha = rampColor.a;
|
|
return material;
|
|
}
|
|
`,_te=`uniform sampler2D image;
|
|
uniform float strength;
|
|
uniform vec2 repeat;
|
|
|
|
czm_material czm_getMaterial(czm_materialInput materialInput)
|
|
{
|
|
czm_material material = czm_getDefaultMaterial(materialInput);
|
|
|
|
vec2 st = materialInput.st;
|
|
|
|
vec2 centerPixel = fract(repeat * st);
|
|
float centerBump = texture(image, centerPixel).channel;
|
|
|
|
float imageWidth = float(imageDimensions.x);
|
|
vec2 rightPixel = fract(repeat * (st + vec2(1.0 / imageWidth, 0.0)));
|
|
float rightBump = texture(image, rightPixel).channel;
|
|
|
|
float imageHeight = float(imageDimensions.y);
|
|
vec2 leftPixel = fract(repeat * (st + vec2(0.0, 1.0 / imageHeight)));
|
|
float topBump = texture(image, leftPixel).channel;
|
|
|
|
vec3 normalTangentSpace = normalize(vec3(centerBump - rightBump, centerBump - topBump, clamp(1.0 - strength, 0.1, 1.0)));
|
|
vec3 normalEC = materialInput.tangentToEyeMatrix * normalTangentSpace;
|
|
|
|
material.normal = normalEC;
|
|
material.diffuse = vec3(0.01);
|
|
|
|
return material;
|
|
}
|
|
`,gte=`uniform vec4 lightColor;
|
|
uniform vec4 darkColor;
|
|
uniform vec2 repeat;
|
|
|
|
czm_material czm_getMaterial(czm_materialInput materialInput)
|
|
{
|
|
czm_material material = czm_getDefaultMaterial(materialInput);
|
|
|
|
vec2 st = materialInput.st;
|
|
|
|
// From Stefan Gustavson's Procedural Textures in GLSL in OpenGL Insights
|
|
float b = mod(floor(repeat.s * st.s) + floor(repeat.t * st.t), 2.0); // 0.0 or 1.0
|
|
|
|
// Find the distance from the closest separator (region between two colors)
|
|
float scaledWidth = fract(repeat.s * st.s);
|
|
scaledWidth = abs(scaledWidth - floor(scaledWidth + 0.5));
|
|
float scaledHeight = fract(repeat.t * st.t);
|
|
scaledHeight = abs(scaledHeight - floor(scaledHeight + 0.5));
|
|
float value = min(scaledWidth, scaledHeight);
|
|
|
|
vec4 currentColor = mix(lightColor, darkColor, b);
|
|
vec4 color = czm_antialias(lightColor, darkColor, currentColor, value, 0.03);
|
|
|
|
color = czm_gammaCorrect(color);
|
|
material.diffuse = color.rgb;
|
|
material.alpha = color.a;
|
|
|
|
return material;
|
|
}
|
|
`,yte=`uniform vec4 lightColor;
|
|
uniform vec4 darkColor;
|
|
uniform vec2 repeat;
|
|
|
|
czm_material czm_getMaterial(czm_materialInput materialInput)
|
|
{
|
|
czm_material material = czm_getDefaultMaterial(materialInput);
|
|
|
|
// From Stefan Gustavson's Procedural Textures in GLSL in OpenGL Insights
|
|
float b = smoothstep(0.3, 0.32, length(fract(repeat * materialInput.st) - 0.5)); // 0.0 or 1.0
|
|
|
|
vec4 color = mix(lightColor, darkColor, b);
|
|
color = czm_gammaCorrect(color);
|
|
material.diffuse = color.rgb;
|
|
material.alpha = color.a;
|
|
|
|
return material;
|
|
}
|
|
`,bte=`uniform sampler2D heights;
|
|
uniform sampler2D colors;
|
|
|
|
// This material expects heights to be sorted from lowest to highest.
|
|
|
|
float getHeight(int idx, float invTexSize)
|
|
{
|
|
vec2 uv = vec2((float(idx) + 0.5) * invTexSize, 0.5);
|
|
#ifdef OES_texture_float
|
|
return texture(heights, uv).x;
|
|
#else
|
|
return czm_unpackFloat(texture(heights, uv));
|
|
#endif
|
|
}
|
|
|
|
czm_material czm_getMaterial(czm_materialInput materialInput)
|
|
{
|
|
czm_material material = czm_getDefaultMaterial(materialInput);
|
|
|
|
float height = materialInput.height;
|
|
float invTexSize = 1.0 / float(heightsDimensions.x);
|
|
|
|
float minHeight = getHeight(0, invTexSize);
|
|
float maxHeight = getHeight(heightsDimensions.x - 1, invTexSize);
|
|
|
|
// early-out when outside the height range
|
|
if (height < minHeight || height > maxHeight) {
|
|
material.diffuse = vec3(0.0);
|
|
material.alpha = 0.0;
|
|
return material;
|
|
}
|
|
|
|
// Binary search to find heights above and below.
|
|
int idxBelow = 0;
|
|
int idxAbove = heightsDimensions.x;
|
|
float heightBelow = minHeight;
|
|
float heightAbove = maxHeight;
|
|
|
|
// while loop not allowed, so use for loop with max iterations.
|
|
// maxIterations of 16 supports a texture size up to 65536 (2^16).
|
|
const int maxIterations = 16;
|
|
for (int i = 0; i < maxIterations; i++) {
|
|
if (idxBelow >= idxAbove - 1) {
|
|
break;
|
|
}
|
|
|
|
int idxMid = (idxBelow + idxAbove) / 2;
|
|
float heightTex = getHeight(idxMid, invTexSize);
|
|
|
|
if (height > heightTex) {
|
|
idxBelow = idxMid;
|
|
heightBelow = heightTex;
|
|
} else {
|
|
idxAbove = idxMid;
|
|
heightAbove = heightTex;
|
|
}
|
|
}
|
|
|
|
float lerper = heightBelow == heightAbove ? 1.0 : (height - heightBelow) / (heightAbove - heightBelow);
|
|
vec2 colorUv = vec2(invTexSize * (float(idxBelow) + 0.5 + lerper), 0.5);
|
|
vec4 color = texture(colors, colorUv);
|
|
|
|
// undo preumultiplied alpha
|
|
if (color.a > 0.0)
|
|
{
|
|
color.rgb /= color.a;
|
|
}
|
|
|
|
color.rgb = czm_gammaCorrect(color.rgb);
|
|
|
|
material.diffuse = color.rgb;
|
|
material.alpha = color.a;
|
|
return material;
|
|
}
|
|
`,Tte=`uniform vec4 color;
|
|
uniform float spacing;
|
|
uniform float width;
|
|
|
|
czm_material czm_getMaterial(czm_materialInput materialInput)
|
|
{
|
|
czm_material material = czm_getDefaultMaterial(materialInput);
|
|
|
|
float distanceToContour = mod(materialInput.height, spacing);
|
|
|
|
#if (__VERSION__ == 300 || defined(GL_OES_standard_derivatives))
|
|
float dxc = abs(dFdx(materialInput.height));
|
|
float dyc = abs(dFdy(materialInput.height));
|
|
float dF = max(dxc, dyc) * czm_pixelRatio * width;
|
|
float alpha = (distanceToContour < dF) ? 1.0 : 0.0;
|
|
#else
|
|
// If no derivatives available (IE 10?), use pixel ratio
|
|
float alpha = (distanceToContour < (czm_pixelRatio * width)) ? 1.0 : 0.0;
|
|
#endif
|
|
|
|
vec4 outColor = czm_gammaCorrect(vec4(color.rgb, alpha * color.a));
|
|
material.diffuse = outColor.rgb;
|
|
material.alpha = outColor.a;
|
|
|
|
return material;
|
|
}
|
|
`,Ate=`uniform sampler2D image;
|
|
uniform float minimumHeight;
|
|
uniform float maximumHeight;
|
|
|
|
czm_material czm_getMaterial(czm_materialInput materialInput)
|
|
{
|
|
czm_material material = czm_getDefaultMaterial(materialInput);
|
|
float scaledHeight = clamp((materialInput.height - minimumHeight) / (maximumHeight - minimumHeight), 0.0, 1.0);
|
|
vec4 rampColor = texture(image, vec2(scaledHeight, 0.5));
|
|
rampColor = czm_gammaCorrect(rampColor);
|
|
material.diffuse = rampColor.rgb;
|
|
material.alpha = rampColor.a;
|
|
return material;
|
|
}
|
|
`,xte=`uniform vec4 fadeInColor;
|
|
uniform vec4 fadeOutColor;
|
|
uniform float maximumDistance;
|
|
uniform bool repeat;
|
|
uniform vec2 fadeDirection;
|
|
uniform vec2 time;
|
|
|
|
float getTime(float t, float coord)
|
|
{
|
|
float scalar = 1.0 / maximumDistance;
|
|
float q = distance(t, coord) * scalar;
|
|
if (repeat)
|
|
{
|
|
float r = distance(t, coord + 1.0) * scalar;
|
|
float s = distance(t, coord - 1.0) * scalar;
|
|
q = min(min(r, s), q);
|
|
}
|
|
return clamp(q, 0.0, 1.0);
|
|
}
|
|
|
|
czm_material czm_getMaterial(czm_materialInput materialInput)
|
|
{
|
|
czm_material material = czm_getDefaultMaterial(materialInput);
|
|
|
|
vec2 st = materialInput.st;
|
|
float s = getTime(time.x, st.s) * fadeDirection.s;
|
|
float t = getTime(time.y, st.t) * fadeDirection.t;
|
|
|
|
float u = length(vec2(s, t));
|
|
vec4 color = mix(fadeInColor, fadeOutColor, u);
|
|
|
|
color = czm_gammaCorrect(color);
|
|
material.emission = color.rgb;
|
|
material.alpha = color.a;
|
|
|
|
return material;
|
|
}
|
|
`,Cte=`uniform vec4 color;
|
|
uniform float cellAlpha;
|
|
uniform vec2 lineCount;
|
|
uniform vec2 lineThickness;
|
|
uniform vec2 lineOffset;
|
|
|
|
czm_material czm_getMaterial(czm_materialInput materialInput)
|
|
{
|
|
czm_material material = czm_getDefaultMaterial(materialInput);
|
|
|
|
vec2 st = materialInput.st;
|
|
|
|
float scaledWidth = fract(lineCount.s * st.s - lineOffset.s);
|
|
scaledWidth = abs(scaledWidth - floor(scaledWidth + 0.5));
|
|
float scaledHeight = fract(lineCount.t * st.t - lineOffset.t);
|
|
scaledHeight = abs(scaledHeight - floor(scaledHeight + 0.5));
|
|
|
|
float value;
|
|
|
|
// Fuzz Factor - Controls blurriness of lines
|
|
#if (__VERSION__ == 300 || defined(GL_OES_standard_derivatives))
|
|
const float fuzz = 1.2;
|
|
vec2 thickness = (lineThickness * czm_pixelRatio) - 1.0;
|
|
|
|
// From "3D Engine Design for Virtual Globes" by Cozzi and Ring, Listing 4.13.
|
|
vec2 dx = abs(dFdx(st));
|
|
vec2 dy = abs(dFdy(st));
|
|
vec2 dF = vec2(max(dx.s, dy.s), max(dx.t, dy.t)) * lineCount;
|
|
value = min(
|
|
smoothstep(dF.s * thickness.s, dF.s * (fuzz + thickness.s), scaledWidth),
|
|
smoothstep(dF.t * thickness.t, dF.t * (fuzz + thickness.t), scaledHeight));
|
|
#else
|
|
// If no derivatives available (IE 10?), revert to view-dependent fuzz
|
|
const float fuzz = 0.05;
|
|
|
|
vec2 range = 0.5 - (lineThickness * 0.05);
|
|
value = min(
|
|
1.0 - smoothstep(range.s, range.s + fuzz, scaledWidth),
|
|
1.0 - smoothstep(range.t, range.t + fuzz, scaledHeight));
|
|
#endif
|
|
|
|
// Edges taken from RimLightingMaterial.glsl
|
|
// See http://www.fundza.com/rman_shaders/surface/fake_rim/fake_rim1.html
|
|
float dRim = 1.0 - abs(dot(materialInput.normalEC, normalize(materialInput.positionToEyeEC)));
|
|
float sRim = smoothstep(0.8, 1.0, dRim);
|
|
value *= (1.0 - sRim);
|
|
|
|
vec4 halfColor;
|
|
halfColor.rgb = color.rgb * 0.5;
|
|
halfColor.a = color.a * (1.0 - ((1.0 - cellAlpha) * value));
|
|
halfColor = czm_gammaCorrect(halfColor);
|
|
material.diffuse = halfColor.rgb;
|
|
material.emission = halfColor.rgb;
|
|
material.alpha = halfColor.a;
|
|
|
|
return material;
|
|
}
|
|
`,Ete=`uniform sampler2D image;
|
|
uniform float strength;
|
|
uniform vec2 repeat;
|
|
|
|
czm_material czm_getMaterial(czm_materialInput materialInput)
|
|
{
|
|
czm_material material = czm_getDefaultMaterial(materialInput);
|
|
|
|
vec4 textureValue = texture(image, fract(repeat * materialInput.st));
|
|
vec3 normalTangentSpace = textureValue.channels;
|
|
normalTangentSpace.xy = normalTangentSpace.xy * 2.0 - 1.0;
|
|
normalTangentSpace.z = clamp(1.0 - strength, 0.1, 1.0);
|
|
normalTangentSpace = normalize(normalTangentSpace);
|
|
vec3 normalEC = materialInput.tangentToEyeMatrix * normalTangentSpace;
|
|
|
|
material.normal = normalEC;
|
|
|
|
return material;
|
|
}
|
|
`,wte=`uniform vec4 color;
|
|
|
|
float getPointOnLine(vec2 p0, vec2 p1, float x)
|
|
{
|
|
float slope = (p0.y - p1.y) / (p0.x - p1.x);
|
|
return slope * (x - p0.x) + p0.y;
|
|
}
|
|
|
|
czm_material czm_getMaterial(czm_materialInput materialInput)
|
|
{
|
|
czm_material material = czm_getDefaultMaterial(materialInput);
|
|
|
|
vec2 st = materialInput.st;
|
|
|
|
#if (__VERSION__ == 300 || defined(GL_OES_standard_derivatives))
|
|
float base = 1.0 - abs(fwidth(st.s)) * 10.0 * czm_pixelRatio;
|
|
#else
|
|
// If no derivatives available (IE 10?), 2.5% of the line will be the arrow head
|
|
float base = 0.975;
|
|
#endif
|
|
|
|
vec2 center = vec2(1.0, 0.5);
|
|
float ptOnUpperLine = getPointOnLine(vec2(base, 1.0), center, st.s);
|
|
float ptOnLowerLine = getPointOnLine(vec2(base, 0.0), center, st.s);
|
|
|
|
float halfWidth = 0.15;
|
|
float s = step(0.5 - halfWidth, st.t);
|
|
s *= 1.0 - step(0.5 + halfWidth, st.t);
|
|
s *= 1.0 - step(base, st.s);
|
|
|
|
float t = step(base, materialInput.st.s);
|
|
t *= 1.0 - step(ptOnUpperLine, st.t);
|
|
t *= step(ptOnLowerLine, st.t);
|
|
|
|
// Find the distance from the closest separator (region between two colors)
|
|
float dist;
|
|
if (st.s < base)
|
|
{
|
|
float d1 = abs(st.t - (0.5 - halfWidth));
|
|
float d2 = abs(st.t - (0.5 + halfWidth));
|
|
dist = min(d1, d2);
|
|
}
|
|
else
|
|
{
|
|
float d1 = czm_infinity;
|
|
if (st.t < 0.5 - halfWidth && st.t > 0.5 + halfWidth)
|
|
{
|
|
d1 = abs(st.s - base);
|
|
}
|
|
float d2 = abs(st.t - ptOnUpperLine);
|
|
float d3 = abs(st.t - ptOnLowerLine);
|
|
dist = min(min(d1, d2), d3);
|
|
}
|
|
|
|
vec4 outsideColor = vec4(0.0);
|
|
vec4 currentColor = mix(outsideColor, color, clamp(s + t, 0.0, 1.0));
|
|
vec4 outColor = czm_antialias(outsideColor, color, currentColor, dist);
|
|
|
|
outColor = czm_gammaCorrect(outColor);
|
|
material.diffuse = outColor.rgb;
|
|
material.alpha = outColor.a;
|
|
return material;
|
|
}
|
|
`,Ste=`uniform vec4 color;
|
|
uniform vec4 gapColor;
|
|
uniform float dashLength;
|
|
uniform float dashPattern;
|
|
in float v_polylineAngle;
|
|
|
|
const float maskLength = 16.0;
|
|
|
|
mat2 rotate(float rad) {
|
|
float c = cos(rad);
|
|
float s = sin(rad);
|
|
return mat2(
|
|
c, s,
|
|
-s, c
|
|
);
|
|
}
|
|
|
|
czm_material czm_getMaterial(czm_materialInput materialInput)
|
|
{
|
|
czm_material material = czm_getDefaultMaterial(materialInput);
|
|
|
|
vec2 pos = rotate(v_polylineAngle) * gl_FragCoord.xy;
|
|
|
|
// Get the relative position within the dash from 0 to 1
|
|
float dashPosition = fract(pos.x / (dashLength * czm_pixelRatio));
|
|
// Figure out the mask index.
|
|
float maskIndex = floor(dashPosition * maskLength);
|
|
// Test the bit mask.
|
|
float maskTest = floor(dashPattern / pow(2.0, maskIndex));
|
|
vec4 fragColor = (mod(maskTest, 2.0) < 1.0) ? gapColor : color;
|
|
if (fragColor.a < 0.005) { // matches 0/255 and 1/255
|
|
discard;
|
|
}
|
|
|
|
fragColor = czm_gammaCorrect(fragColor);
|
|
material.emission = fragColor.rgb;
|
|
material.alpha = fragColor.a;
|
|
return material;
|
|
}
|
|
`,vte=`uniform vec4 color;
|
|
uniform float glowPower;
|
|
uniform float taperPower;
|
|
|
|
czm_material czm_getMaterial(czm_materialInput materialInput)
|
|
{
|
|
czm_material material = czm_getDefaultMaterial(materialInput);
|
|
|
|
vec2 st = materialInput.st;
|
|
float glow = glowPower / abs(st.t - 0.5) - (glowPower / 0.5);
|
|
|
|
if (taperPower <= 0.99999) {
|
|
glow *= min(1.0, taperPower / (0.5 - st.s * 0.5) - (taperPower / 0.5));
|
|
}
|
|
|
|
vec4 fragColor;
|
|
fragColor.rgb = max(vec3(glow - 1.0 + color.rgb), color.rgb);
|
|
fragColor.a = clamp(0.0, 1.0, glow) * color.a;
|
|
fragColor = czm_gammaCorrect(fragColor);
|
|
|
|
material.emission = fragColor.rgb;
|
|
material.alpha = fragColor.a;
|
|
|
|
return material;
|
|
}
|
|
`,Ite=`uniform vec4 color;
|
|
uniform vec4 outlineColor;
|
|
uniform float outlineWidth;
|
|
|
|
in float v_width;
|
|
|
|
czm_material czm_getMaterial(czm_materialInput materialInput)
|
|
{
|
|
czm_material material = czm_getDefaultMaterial(materialInput);
|
|
|
|
vec2 st = materialInput.st;
|
|
float halfInteriorWidth = 0.5 * (v_width - outlineWidth) / v_width;
|
|
float b = step(0.5 - halfInteriorWidth, st.t);
|
|
b *= 1.0 - step(0.5 + halfInteriorWidth, st.t);
|
|
|
|
// Find the distance from the closest separator (region between two colors)
|
|
float d1 = abs(st.t - (0.5 - halfInteriorWidth));
|
|
float d2 = abs(st.t - (0.5 + halfInteriorWidth));
|
|
float dist = min(d1, d2);
|
|
|
|
vec4 currentColor = mix(outlineColor, color, b);
|
|
vec4 outColor = czm_antialias(outlineColor, color, currentColor, dist);
|
|
outColor = czm_gammaCorrect(outColor);
|
|
|
|
material.diffuse = outColor.rgb;
|
|
material.alpha = outColor.a;
|
|
|
|
return material;
|
|
}
|
|
`,Dte=`uniform vec4 color;
|
|
uniform vec4 rimColor;
|
|
uniform float width;
|
|
|
|
czm_material czm_getMaterial(czm_materialInput materialInput)
|
|
{
|
|
czm_material material = czm_getDefaultMaterial(materialInput);
|
|
|
|
// See http://www.fundza.com/rman_shaders/surface/fake_rim/fake_rim1.html
|
|
float d = 1.0 - dot(materialInput.normalEC, normalize(materialInput.positionToEyeEC));
|
|
float s = smoothstep(1.0 - width, 1.0, d);
|
|
|
|
vec4 outColor = czm_gammaCorrect(color);
|
|
vec4 outRimColor = czm_gammaCorrect(rimColor);
|
|
|
|
material.diffuse = outColor.rgb;
|
|
material.emission = outRimColor.rgb * s;
|
|
material.alpha = mix(outColor.a, outRimColor.a, s);
|
|
|
|
return material;
|
|
}
|
|
`,Pte=`uniform sampler2D image;
|
|
|
|
czm_material czm_getMaterial(czm_materialInput materialInput)
|
|
{
|
|
czm_material material = czm_getDefaultMaterial(materialInput);
|
|
vec4 rampColor = texture(image, vec2(materialInput.slope / (czm_pi / 2.0), 0.5));
|
|
rampColor = czm_gammaCorrect(rampColor);
|
|
material.diffuse = rampColor.rgb;
|
|
material.alpha = rampColor.a;
|
|
return material;
|
|
}
|
|
`,Ote=`uniform vec4 evenColor;
|
|
uniform vec4 oddColor;
|
|
uniform float offset;
|
|
uniform float repeat;
|
|
uniform bool horizontal;
|
|
|
|
czm_material czm_getMaterial(czm_materialInput materialInput)
|
|
{
|
|
czm_material material = czm_getDefaultMaterial(materialInput);
|
|
|
|
// Based on the Stripes Fragment Shader in the Orange Book (11.1.2)
|
|
float coord = mix(materialInput.st.s, materialInput.st.t, float(horizontal));
|
|
float value = fract((coord - offset) * (repeat * 0.5));
|
|
float dist = min(value, min(abs(value - 0.5), 1.0 - value));
|
|
|
|
vec4 currentColor = mix(evenColor, oddColor, step(0.5, value));
|
|
vec4 color = czm_antialias(evenColor, oddColor, currentColor, dist);
|
|
color = czm_gammaCorrect(color);
|
|
|
|
material.diffuse = color.rgb;
|
|
material.alpha = color.a;
|
|
|
|
return material;
|
|
}
|
|
`,Lte=`// Thanks for the contribution Jonas
|
|
// http://29a.ch/2012/7/19/webgl-terrain-rendering-water-fog
|
|
|
|
uniform sampler2D specularMap;
|
|
uniform sampler2D normalMap;
|
|
uniform vec4 baseWaterColor;
|
|
uniform vec4 blendColor;
|
|
uniform float frequency;
|
|
uniform float animationSpeed;
|
|
uniform float amplitude;
|
|
uniform float specularIntensity;
|
|
uniform float fadeFactor;
|
|
|
|
czm_material czm_getMaterial(czm_materialInput materialInput)
|
|
{
|
|
czm_material material = czm_getDefaultMaterial(materialInput);
|
|
|
|
float time = czm_frameNumber * animationSpeed;
|
|
|
|
// fade is a function of the distance from the fragment and the frequency of the waves
|
|
float fade = max(1.0, (length(materialInput.positionToEyeEC) / 10000000000.0) * frequency * fadeFactor);
|
|
|
|
float specularMapValue = texture(specularMap, materialInput.st).r;
|
|
|
|
// note: not using directional motion at this time, just set the angle to 0.0;
|
|
vec4 noise = czm_getWaterNoise(normalMap, materialInput.st * frequency, time, 0.0);
|
|
vec3 normalTangentSpace = noise.xyz * vec3(1.0, 1.0, (1.0 / amplitude));
|
|
|
|
// fade out the normal perturbation as we move further from the water surface
|
|
normalTangentSpace.xy /= fade;
|
|
|
|
// attempt to fade out the normal perturbation as we approach non water areas (low specular map value)
|
|
normalTangentSpace = mix(vec3(0.0, 0.0, 50.0), normalTangentSpace, specularMapValue);
|
|
|
|
normalTangentSpace = normalize(normalTangentSpace);
|
|
|
|
// get ratios for alignment of the new normal vector with a vector perpendicular to the tangent plane
|
|
float tsPerturbationRatio = clamp(dot(normalTangentSpace, vec3(0.0, 0.0, 1.0)), 0.0, 1.0);
|
|
|
|
// fade out water effect as specular map value decreases
|
|
material.alpha = mix(blendColor.a, baseWaterColor.a, specularMapValue) * specularMapValue;
|
|
|
|
// base color is a blend of the water and non-water color based on the value from the specular map
|
|
// may need a uniform blend factor to better control this
|
|
material.diffuse = mix(blendColor.rgb, baseWaterColor.rgb, specularMapValue);
|
|
|
|
// diffuse highlights are based on how perturbed the normal is
|
|
material.diffuse += (0.1 * tsPerturbationRatio);
|
|
|
|
material.diffuse = material.diffuse;
|
|
|
|
material.normal = normalize(materialInput.tangentToEyeMatrix * normalTangentSpace);
|
|
|
|
material.specular = specularIntensity;
|
|
material.shininess = 10.0;
|
|
|
|
return material;
|
|
}
|
|
`;function Se(e){this.type=void 0,this.shaderSource=void 0,this.materials=void 0,this.uniforms=void 0,this._uniforms=void 0,this.translucent=void 0,this._minificationFilter=y(e.minificationFilter,en.LINEAR),this._magnificationFilter=y(e.magnificationFilter,Yo.LINEAR),this._strict=void 0,this._template=void 0,this._count=void 0,this._texturePaths={},this._loadedImages=[],this._loadedCubeMaps=[],this._textures={},this._updateFunctions=[],this._defaultTexture=void 0,Rte(e,this),Object.defineProperties(this,{type:{value:this.type,writable:!1}}),c(Se._uniformList[this.type])||(Se._uniformList[this.type]=Object.keys(this._uniforms))}Se._uniformList={};Se.fromType=function(e,t){if(!c(Se._materialCache.getMaterial(e)))throw new E(`material with type '${e}' does not exist.`);const n=new Se({fabric:{type:e}});if(c(t))for(const i in t)t.hasOwnProperty(i)&&(n.uniforms[i]=t[i]);return n};Se.prototype.isTranslucent=function(){if(c(this.translucent))return typeof this.translucent=="function"?this.translucent():this.translucent;let e=!0;const t=this._translucentFunctions,n=t.length;for(let i=0;i<n;++i){const o=t[i];if(typeof o=="function"?e=e&&o():e=e&&o,!e)break}return e};Se.prototype.update=function(e){this._defaultTexture=e.defaultTexture;let t,n;const i=this._loadedImages;let o=i.length;for(t=0;t<o;++t){const l=i[t];n=l.id;let u=l.image,h;Array.isArray(u)&&(h=u.slice(1,u.length).map(function(b){return b.bufferView}),u=u[0]);const f=new un({minificationFilter:this._minificationFilter,magnificationFilter:this._magnificationFilter});let _;c(u.internalFormat)?_=new xt({context:e,pixelFormat:u.internalFormat,width:u.width,height:u.height,source:{arrayBufferView:u.bufferView,mipLevels:h},sampler:f}):_=new xt({context:e,source:u,sampler:f});const g=this._textures[n];c(g)&&g!==this._defaultTexture&&g.destroy(),this._textures[n]=_;const m=`${n}Dimensions`;if(this.uniforms.hasOwnProperty(m)){const b=this.uniforms[m];b.x=_._width,b.y=_._height}}i.length=0;const r=this._loadedCubeMaps;for(o=r.length,t=0;t<o;++t){const l=r[t];n=l.id;const u=l.images,h=new Sl({context:e,source:{positiveX:u[0],negativeX:u[1],positiveY:u[2],negativeY:u[3],positiveZ:u[4],negativeZ:u[5]},sampler:new un({minificationFilter:this._minificationFilter,magnificationFilter:this._magnificationFilter})});this._textures[n]=h}r.length=0;const s=this._updateFunctions;for(o=s.length,t=0;t<o;++t)s[t](this,e);const a=this.materials;for(const l in a)a.hasOwnProperty(l)&&a[l].update(e)};Se.prototype.isDestroyed=function(){return!1};Se.prototype.destroy=function(){const e=this._textures;for(const n in e)if(e.hasOwnProperty(n)){const i=e[n];i!==this._defaultTexture&&i.destroy()}const t=this.materials;for(const n in t)t.hasOwnProperty(n)&&t[n].destroy();return ve(this)};function Rte(e,t){e=y(e,y.EMPTY_OBJECT),t._strict=y(e.strict,!1),t._count=y(e.count,0),t._template=Je(y(e.fabric,y.EMPTY_OBJECT)),t._template.uniforms=Je(y(t._template.uniforms,y.EMPTY_OBJECT)),t._template.materials=Je(y(t._template.materials,y.EMPTY_OBJECT)),t.type=c(t._template.type)?t._template.type:Wr(),t.shaderSource="",t.materials={},t.uniforms={},t._uniforms={},t._translucentFunctions=[];let n;const i=Se._materialCache.getMaterial(t.type);if(c(i)){const r=Je(i.fabric,!0);t._template=jt(t._template,r,!0),n=i.translucent}Bte(t),c(i)||Se._materialCache.addMaterial(t.type,t),Ute(t),Gte(t),Wte(t);const o=t._translucentFunctions.length===0?!0:void 0;if(n=y(n,o),n=y(e.translucent,n),c(n))if(typeof n=="function"){const r=function(){return n(t)};t._translucentFunctions.push(r)}else t._translucentFunctions.push(n)}function rw(e,t,n,i){if(c(e)){for(const o in e)if(e.hasOwnProperty(o)){const r=t.indexOf(o)!==-1;(i&&!r||!i&&r)&&n(o,t)}}}function SR(e,t){let n=`fabric: property name '${e}' is not valid. It should be `;for(let i=0;i<t.length;i++){const o=`'${t[i]}'`;n+=i===t.length-1?`or ${o}.`:`${o}, `}throw new E(n)}function Nte(e,t){const n=`fabric: uniforms and materials cannot share the same property '${e}'`;throw new E(n)}const Mte=["type","materials","uniforms","components","source"],Fte=["diffuse","specular","shininess","normal","emission","alpha"];function Bte(e){const t=e._template,n=t.uniforms,i=t.materials,o=t.components;if(c(o)&&c(t.source))throw new E("fabric: cannot have source and components in the same template.");rw(t,Mte,SR,!0),rw(o,Fte,SR,!0);const r=[];for(const s in i)i.hasOwnProperty(s)&&r.push(s);rw(n,r,Nte,!1)}function zte(e,t){const n=t._template.materials;for(const i in n)if(n.hasOwnProperty(i)&&e.indexOf(i)>-1)return!0;return!1}function Ute(e){const t=e._template.components,n=e._template.source;if(c(n))e.shaderSource+=`${n}
|
|
`;else{if(e.shaderSource+=`czm_material czm_getMaterial(czm_materialInput materialInput)
|
|
{
|
|
`,e.shaderSource+=`czm_material material = czm_getDefaultMaterial(materialInput);
|
|
`,c(t)){const i=Object.keys(e._template.materials).length>0;for(const o in t)if(t.hasOwnProperty(o))if(o==="diffuse"||o==="emission"){const s=i&&zte(t[o],e)?t[o]:`czm_gammaCorrect(${t[o]})`;e.shaderSource+=`material.${o} = ${s};
|
|
`}else o==="alpha"?e.shaderSource+=`material.alpha = ${t.alpha};
|
|
`:e.shaderSource+=`material.${o} = ${t[o]};
|
|
`}e.shaderSource+=`return material;
|
|
}
|
|
`}}const vR={mat2:Xe,mat3:$,mat4:L},kte=/\.ktx2$/i;function Vte(e){let t;return function(n,i){const o=n.uniforms,r=o[e],s=t!==r,a=!c(r)||r===Se.DefaultImageId;t=r;let l=n._textures[e],u,h;if(r instanceof HTMLVideoElement){if(r.readyState>=2){if(s&&c(l)&&(l!==i.defaultTexture&&l.destroy(),l=void 0),!c(l)||l===i.defaultTexture){const _=new un({minificationFilter:n._minificationFilter,magnificationFilter:n._magnificationFilter});l=new xt({context:i,source:r,sampler:_}),n._textures[e]=l;return}l.copyFrom({source:r})}else c(l)||(n._textures[e]=i.defaultTexture);return}if(r instanceof xt&&r!==l){n._texturePaths[e]=void 0;const _=n._textures[e];c(_)&&_!==n._defaultTexture&&_.destroy(),n._textures[e]=r,u=`${e}Dimensions`,o.hasOwnProperty(u)&&(h=o[u],h.x=r._width,h.y=r._height);return}if(s&&c(l)&&a&&(l!==n._defaultTexture&&l.destroy(),l=void 0),c(l)||(n._texturePaths[e]=void 0,l=n._textures[e]=n._defaultTexture,u=`${e}Dimensions`,o.hasOwnProperty(u)&&(h=o[u],h.x=l._width,h.y=l._height)),a)return;const f=r instanceof Ae;if(!c(n._texturePaths[e])||f&&r.url!==n._texturePaths[e].url||!f&&r!==n._texturePaths[e]){if(typeof r=="string"||f){const _=f?r:Ae.createIfNeeded(r);let g;kte.test(_.url)?g=Op(_.url):g=_.fetchImage(),Promise.resolve(g).then(function(m){n._loadedImages.push({id:e,image:m})}).catch(function(){c(l)&&l!==n._defaultTexture&&l.destroy(),n._textures[e]=n._defaultTexture})}else(r instanceof HTMLCanvasElement||r instanceof HTMLImageElement)&&n._loadedImages.push({id:e,image:r});n._texturePaths[e]=r}}}function Hte(e){return function(t,n){const i=t.uniforms[e];if(i instanceof Sl){const r=t._textures[e];r!==t._defaultTexture&&r.destroy(),t._texturePaths[e]=void 0,t._textures[e]=i;return}if(c(t._textures[e])||(t._texturePaths[e]=void 0,t._textures[e]=n.defaultCubeMap),i===Se.DefaultCubeMapId)return;const o=i.positiveX+i.negativeX+i.positiveY+i.negativeY+i.positiveZ+i.negativeZ;if(o!==t._texturePaths[e]){const r=[Ae.createIfNeeded(i.positiveX).fetchImage(),Ae.createIfNeeded(i.negativeX).fetchImage(),Ae.createIfNeeded(i.positiveY).fetchImage(),Ae.createIfNeeded(i.negativeY).fetchImage(),Ae.createIfNeeded(i.positiveZ).fetchImage(),Ae.createIfNeeded(i.negativeZ).fetchImage()];Promise.all(r).then(function(s){t._loadedCubeMaps.push({id:e,images:s})}),t._texturePaths[e]=o}}}function Gte(e){const t=e._template.uniforms;for(const n in t)t.hasOwnProperty(n)&&Gk(e,n)}function Gk(e,t){const n=e._strict,i=e._template.uniforms,o=i[t],r=jte(o);if(!c(r))throw new E(`fabric: uniform '${t}' has invalid type.`);let s;if(r==="channels"){if(s=Zy(e,t,o,!1),s===0&&n)throw new E(`strict: shader source does not use channels '${t}'.`)}else{if(r==="sampler2D"){const u=`${t}Dimensions`;qte(e,u)>0&&(i[u]={type:"ivec3",x:1,y:1},Gk(e,u))}if(!new RegExp(`uniform\\s+${r}\\s+${t}\\s*;`).test(e.shaderSource)){const u=`uniform ${r} ${t};`;e.shaderSource=u+e.shaderSource}const l=`${t}_${e._count++}`;if(s=Zy(e,t,l),s===1&&n)throw new E(`strict: shader source does not use uniform '${t}'.`);if(e.uniforms[t]=o,r==="sampler2D")e._uniforms[l]=function(){return e._textures[t]},e._updateFunctions.push(Vte(t));else if(r==="samplerCube")e._uniforms[l]=function(){return e._textures[t]},e._updateFunctions.push(Hte(t));else if(r.indexOf("mat")!==-1){const u=new vR[r];e._uniforms[l]=function(){return vR[r].fromColumnMajorArray(e.uniforms[t],u)}}else e._uniforms[l]=function(){return e.uniforms[t]}}}function jte(e){let t=e.type;if(!c(t)){const n=typeof e;if(n==="number")t="float";else if(n==="boolean")t="bool";else if(n==="string"||e instanceof Ae||e instanceof HTMLCanvasElement||e instanceof HTMLImageElement)/^([rgba]){1,4}$/i.test(e)?t="channels":e===Se.DefaultCubeMapId?t="samplerCube":t="sampler2D";else if(n==="object")if(Array.isArray(e))(e.length===4||e.length===9||e.length===16)&&(t=`mat${Math.sqrt(e.length)}`);else{let i=0;for(const o in e)e.hasOwnProperty(o)&&(i+=1);i>=2&&i<=4?t=`vec${i}`:i===6&&(t="samplerCube")}}return t}function Wte(e){const t=e._strict,n=e._template.materials;for(const i in n)if(n.hasOwnProperty(i)){const o=new Se({strict:t,fabric:n[i],count:e._count});e._count=o._count,e._uniforms=jt(e._uniforms,o._uniforms,!0),e.materials[i]=o,e._translucentFunctions=e._translucentFunctions.concat(o._translucentFunctions);const r="czm_getMaterial",s=`${r}_${e._count++}`;Zy(o,r,s),e.shaderSource=o.shaderSource+e.shaderSource;const a=`${s}(materialInput)`;if(Zy(e,i,a)===0&&t)throw new E(`strict: shader source does not use material '${i}'.`)}}function Zy(e,t,n,i){i=y(i,!0);let o=0;const r="([\\w])?",s=`([\\w${i?".":""}])?`,a=new RegExp(s+t+r,"g");return e.shaderSource=e.shaderSource.replace(a,function(l,u,h){return u||h?l:(o+=1,n)}),o}function qte(e,t,n){return Zy(e,t,t,n)}Se._materialCache={_materials:{},addMaterial:function(e,t){this._materials[e]=t},getMaterial:function(e){return this._materials[e]}};Se.DefaultImageId="czm_defaultImage";Se.DefaultCubeMapId="czm_defaultCubeMap";Se.ColorType="Color";Se._materialCache.addMaterial(Se.ColorType,{fabric:{type:Se.ColorType,uniforms:{color:new z(1,0,0,.5)},components:{diffuse:"color.rgb",alpha:"color.a"}},translucent:function(e){return e.uniforms.color.alpha<1}});Se.ImageType="Image";Se._materialCache.addMaterial(Se.ImageType,{fabric:{type:Se.ImageType,uniforms:{image:Se.DefaultImageId,repeat:new H(1,1),color:new z(1,1,1,1)},components:{diffuse:"texture(image, fract(repeat * materialInput.st)).rgb * color.rgb",alpha:"texture(image, fract(repeat * materialInput.st)).a * color.a"}},translucent:function(e){return e.uniforms.color.alpha<1}});Se.DiffuseMapType="DiffuseMap";Se._materialCache.addMaterial(Se.DiffuseMapType,{fabric:{type:Se.DiffuseMapType,uniforms:{image:Se.DefaultImageId,channels:"rgb",repeat:new H(1,1)},components:{diffuse:"texture(image, fract(repeat * materialInput.st)).channels"}},translucent:!1});Se.AlphaMapType="AlphaMap";Se._materialCache.addMaterial(Se.AlphaMapType,{fabric:{type:Se.AlphaMapType,uniforms:{image:Se.DefaultImageId,channel:"a",repeat:new H(1,1)},components:{alpha:"texture(image, fract(repeat * materialInput.st)).channel"}},translucent:!0});Se.SpecularMapType="SpecularMap";Se._materialCache.addMaterial(Se.SpecularMapType,{fabric:{type:Se.SpecularMapType,uniforms:{image:Se.DefaultImageId,channel:"r",repeat:new H(1,1)},components:{specular:"texture(image, fract(repeat * materialInput.st)).channel"}},translucent:!1});Se.EmissionMapType="EmissionMap";Se._materialCache.addMaterial(Se.EmissionMapType,{fabric:{type:Se.EmissionMapType,uniforms:{image:Se.DefaultImageId,channels:"rgb",repeat:new H(1,1)},components:{emission:"texture(image, fract(repeat * materialInput.st)).channels"}},translucent:!1});Se.BumpMapType="BumpMap";Se._materialCache.addMaterial(Se.BumpMapType,{fabric:{type:Se.BumpMapType,uniforms:{image:Se.DefaultImageId,channel:"r",strength:.8,repeat:new H(1,1)},source:_te},translucent:!1});Se.NormalMapType="NormalMap";Se._materialCache.addMaterial(Se.NormalMapType,{fabric:{type:Se.NormalMapType,uniforms:{image:Se.DefaultImageId,channels:"rgb",strength:.8,repeat:new H(1,1)},source:Ete},translucent:!1});Se.GridType="Grid";Se._materialCache.addMaterial(Se.GridType,{fabric:{type:Se.GridType,uniforms:{color:new z(0,1,0,1),cellAlpha:.1,lineCount:new H(8,8),lineThickness:new H(1,1),lineOffset:new H(0,0)},source:Cte},translucent:function(e){const t=e.uniforms;return t.color.alpha<1||t.cellAlpha<1}});Se.StripeType="Stripe";Se._materialCache.addMaterial(Se.StripeType,{fabric:{type:Se.StripeType,uniforms:{horizontal:!0,evenColor:new z(1,1,1,.5),oddColor:new z(0,0,1,.5),offset:0,repeat:5},source:Ote},translucent:function(e){const t=e.uniforms;return t.evenColor.alpha<1||t.oddColor.alpha<1}});Se.CheckerboardType="Checkerboard";Se._materialCache.addMaterial(Se.CheckerboardType,{fabric:{type:Se.CheckerboardType,uniforms:{lightColor:new z(1,1,1,.5),darkColor:new z(0,0,0,.5),repeat:new H(5,5)},source:gte},translucent:function(e){const t=e.uniforms;return t.lightColor.alpha<1||t.darkColor.alpha<1}});Se.DotType="Dot";Se._materialCache.addMaterial(Se.DotType,{fabric:{type:Se.DotType,uniforms:{lightColor:new z(1,1,0,.75),darkColor:new z(0,1,1,.75),repeat:new H(5,5)},source:yte},translucent:function(e){const t=e.uniforms;return t.lightColor.alpha<1||t.darkColor.alpha<1}});Se.WaterType="Water";Se._materialCache.addMaterial(Se.WaterType,{fabric:{type:Se.WaterType,uniforms:{baseWaterColor:new z(.2,.3,.6,1),blendColor:new z(0,1,.699,1),specularMap:Se.DefaultImageId,normalMap:Se.DefaultImageId,frequency:10,animationSpeed:.01,amplitude:1,specularIntensity:.5,fadeFactor:1},source:Lte},translucent:function(e){const t=e.uniforms;return t.baseWaterColor.alpha<1||t.blendColor.alpha<1}});Se.RimLightingType="RimLighting";Se._materialCache.addMaterial(Se.RimLightingType,{fabric:{type:Se.RimLightingType,uniforms:{color:new z(1,0,0,.7),rimColor:new z(1,1,1,.4),width:.3},source:Dte},translucent:function(e){const t=e.uniforms;return t.color.alpha<1||t.rimColor.alpha<1}});Se.FadeType="Fade";Se._materialCache.addMaterial(Se.FadeType,{fabric:{type:Se.FadeType,uniforms:{fadeInColor:new z(1,0,0,1),fadeOutColor:new z(0,0,0,0),maximumDistance:.5,repeat:!0,fadeDirection:{x:!0,y:!0},time:new H(.5,.5)},source:xte},translucent:function(e){const t=e.uniforms;return t.fadeInColor.alpha<1||t.fadeOutColor.alpha<1}});Se.PolylineArrowType="PolylineArrow";Se._materialCache.addMaterial(Se.PolylineArrowType,{fabric:{type:Se.PolylineArrowType,uniforms:{color:new z(1,1,1,1)},source:wte},translucent:!0});Se.PolylineDashType="PolylineDash";Se._materialCache.addMaterial(Se.PolylineDashType,{fabric:{type:Se.PolylineDashType,uniforms:{color:new z(1,0,1,1),gapColor:new z(0,0,0,0),dashLength:16,dashPattern:255},source:Ste},translucent:!0});Se.PolylineGlowType="PolylineGlow";Se._materialCache.addMaterial(Se.PolylineGlowType,{fabric:{type:Se.PolylineGlowType,uniforms:{color:new z(0,.5,1,1),glowPower:.25,taperPower:1},source:vte},translucent:!0});Se.PolylineOutlineType="PolylineOutline";Se._materialCache.addMaterial(Se.PolylineOutlineType,{fabric:{type:Se.PolylineOutlineType,uniforms:{color:new z(1,1,1,1),outlineColor:new z(1,0,0,1),outlineWidth:1},source:Ite},translucent:function(e){const t=e.uniforms;return t.color.alpha<1||t.outlineColor.alpha<1}});Se.ElevationContourType="ElevationContour";Se._materialCache.addMaterial(Se.ElevationContourType,{fabric:{type:Se.ElevationContourType,uniforms:{spacing:100,color:new z(1,0,0,1),width:1},source:Tte},translucent:!1});Se.ElevationRampType="ElevationRamp";Se._materialCache.addMaterial(Se.ElevationRampType,{fabric:{type:Se.ElevationRampType,uniforms:{image:Se.DefaultImageId,minimumHeight:0,maximumHeight:1e4},source:Ate},translucent:!1});Se.SlopeRampMaterialType="SlopeRamp";Se._materialCache.addMaterial(Se.SlopeRampMaterialType,{fabric:{type:Se.SlopeRampMaterialType,uniforms:{image:Se.DefaultImageId},source:Pte},translucent:!1});Se.AspectRampMaterialType="AspectRamp";Se._materialCache.addMaterial(Se.AspectRampMaterialType,{fabric:{type:Se.AspectRampMaterialType,uniforms:{image:Se.DefaultImageId},source:mte},translucent:!1});Se.ElevationBandType="ElevationBand";Se._materialCache.addMaterial(Se.ElevationBandType,{fabric:{type:Se.ElevationBandType,uniforms:{heights:Se.DefaultImageId,colors:Se.DefaultImageId},source:bte},translucent:!0});function oo(e){e=y(e,y.EMPTY_OBJECT);const t=y(e.translucent,!0),n=y(e.closed,!1),i=y(e.materialSupport,oo.MaterialSupport.TEXTURED);this.material=c(e.material)?e.material:Se.fromType(Se.ColorType),this.translucent=t,this._vertexShaderSource=y(e.vertexShaderSource,i.vertexShaderSource),this._fragmentShaderSource=y(e.fragmentShaderSource,i.fragmentShaderSource),this._renderState=Lo.getDefaultRenderState(t,n,e.renderState),this._closed=n,this._materialSupport=i,this._vertexFormat=i.vertexFormat,this._flat=y(e.flat,!1),this._faceForward=y(e.faceForward,!n)}Object.defineProperties(oo.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},renderState:{get:function(){return this._renderState}},closed:{get:function(){return this._closed}},materialSupport:{get:function(){return this._materialSupport}},vertexFormat:{get:function(){return this._vertexFormat}},flat:{get:function(){return this._flat}},faceForward:{get:function(){return this._faceForward}}});oo.prototype.getFragmentShaderSource=Lo.prototype.getFragmentShaderSource;oo.prototype.isTranslucent=Lo.prototype.isTranslucent;oo.prototype.getRenderState=Lo.prototype.getRenderState;oo.MaterialSupport={BASIC:Object.freeze({vertexFormat:Ee.POSITION_AND_NORMAL,vertexShaderSource:cte,fragmentShaderSource:ate}),TEXTURED:Object.freeze({vertexFormat:Ee.POSITION_NORMAL_AND_ST,vertexShaderSource:ute,fragmentShaderSource:lte}),ALL:Object.freeze({vertexFormat:Ee.ALL,vertexShaderSource:ste,fragmentShaderSource:rte})};const Yte=`in vec3 v_positionEC;
|
|
in vec3 v_normalEC;
|
|
in vec4 v_color;
|
|
|
|
void main()
|
|
{
|
|
vec3 positionToEyeEC = -v_positionEC;
|
|
|
|
vec3 normalEC = normalize(v_normalEC);
|
|
#ifdef FACE_FORWARD
|
|
normalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);
|
|
#endif
|
|
|
|
vec4 color = czm_gammaCorrect(v_color);
|
|
|
|
czm_materialInput materialInput;
|
|
materialInput.normalEC = normalEC;
|
|
materialInput.positionToEyeEC = positionToEyeEC;
|
|
czm_material material = czm_getDefaultMaterial(materialInput);
|
|
material.diffuse = color.rgb;
|
|
material.alpha = color.a;
|
|
|
|
out_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);
|
|
}
|
|
`,$te=`in vec3 position3DHigh;
|
|
in vec3 position3DLow;
|
|
in vec3 normal;
|
|
in vec4 color;
|
|
in float batchId;
|
|
|
|
out vec3 v_positionEC;
|
|
out vec3 v_normalEC;
|
|
out vec4 v_color;
|
|
|
|
void main()
|
|
{
|
|
vec4 p = czm_computePosition();
|
|
|
|
v_positionEC = (czm_modelViewRelativeToEye * p).xyz; // position in eye coordinates
|
|
v_normalEC = czm_normal * normal; // normal in eye coordinates
|
|
v_color = color;
|
|
|
|
gl_Position = czm_modelViewProjectionRelativeToEye * p;
|
|
}
|
|
`,jk=`in vec4 v_color;
|
|
|
|
void main()
|
|
{
|
|
out_FragColor = czm_gammaCorrect(v_color);
|
|
}
|
|
`,Xte=`in vec3 position3DHigh;
|
|
in vec3 position3DLow;
|
|
in vec4 color;
|
|
in float batchId;
|
|
|
|
out vec4 v_color;
|
|
|
|
void main()
|
|
{
|
|
vec4 p = czm_computePosition();
|
|
|
|
v_color = color;
|
|
|
|
gl_Position = czm_modelViewProjectionRelativeToEye * p;
|
|
}
|
|
`;function tn(e){e=y(e,y.EMPTY_OBJECT);const t=y(e.translucent,!0),n=y(e.closed,!1),i=y(e.flat,!1),o=i?Xte:$te,r=i?jk:Yte,s=i?tn.FLAT_VERTEX_FORMAT:tn.VERTEX_FORMAT;this.material=void 0,this.translucent=t,this._vertexShaderSource=y(e.vertexShaderSource,o),this._fragmentShaderSource=y(e.fragmentShaderSource,r),this._renderState=Lo.getDefaultRenderState(t,n,e.renderState),this._closed=n,this._vertexFormat=s,this._flat=i,this._faceForward=y(e.faceForward,!n)}Object.defineProperties(tn.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},renderState:{get:function(){return this._renderState}},closed:{get:function(){return this._closed}},vertexFormat:{get:function(){return this._vertexFormat}},flat:{get:function(){return this._flat}},faceForward:{get:function(){return this._faceForward}}});tn.VERTEX_FORMAT=Ee.POSITION_AND_NORMAL;tn.FLAT_VERTEX_FORMAT=Ee.POSITION_ONLY;tn.prototype.getFragmentShaderSource=Lo.prototype.getFragmentShaderSource;tn.prototype.isTranslucent=Lo.prototype.isTranslucent;tn.prototype.getRenderState=Lo.prototype.getRenderState;function kt(e){this._definitionChanged=new Le,this._color=void 0,this._colorSubscription=void 0,this.color=e}Object.defineProperties(kt.prototype,{isConstant:{get:function(){return K.isConstant(this._color)}},definitionChanged:{get:function(){return this._definitionChanged}},color:ue("color")});kt.prototype.getType=function(e){return"Color"};kt.prototype.getValue=function(e,t){return c(t)||(t={}),t.color=K.getValueOrClonedDefault(this._color,e,z.WHITE,t.color),t};kt.prototype.equals=function(e){return this===e||e instanceof kt&&K.equals(this._color,e._color)};function Yr(e){e=y(e,y.EMPTY_OBJECT),this._ellipsoid=y(e.ellipsoid,ae.WGS84),this._rectangle=y(e.rectangle,ce.MAX_VALUE),this._projection=new co(this._ellipsoid),this._numberOfLevelZeroTilesX=y(e.numberOfLevelZeroTilesX,2),this._numberOfLevelZeroTilesY=y(e.numberOfLevelZeroTilesY,1)}Object.defineProperties(Yr.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},rectangle:{get:function(){return this._rectangle}},projection:{get:function(){return this._projection}}});Yr.prototype.getNumberOfXTilesAtLevel=function(e){return this._numberOfLevelZeroTilesX<<e};Yr.prototype.getNumberOfYTilesAtLevel=function(e){return this._numberOfLevelZeroTilesY<<e};Yr.prototype.rectangleToNativeRectangle=function(e,t){A.defined("rectangle",e);const n=R.toDegrees(e.west),i=R.toDegrees(e.south),o=R.toDegrees(e.east),r=R.toDegrees(e.north);return c(t)?(t.west=n,t.south=i,t.east=o,t.north=r,t):new ce(n,i,o,r)};Yr.prototype.tileXYToNativeRectangle=function(e,t,n,i){const o=this.tileXYToRectangle(e,t,n,i);return o.west=R.toDegrees(o.west),o.south=R.toDegrees(o.south),o.east=R.toDegrees(o.east),o.north=R.toDegrees(o.north),o};Yr.prototype.tileXYToRectangle=function(e,t,n,i){const o=this._rectangle,r=this.getNumberOfXTilesAtLevel(n),s=this.getNumberOfYTilesAtLevel(n),a=o.width/r,l=e*a+o.west,u=(e+1)*a+o.west,h=o.height/s,f=o.north-t*h,_=o.north-(t+1)*h;return c(i)||(i=new ce(l,_,u,f)),i.west=l,i.south=_,i.east=u,i.north=f,i};Yr.prototype.positionToTileXY=function(e,t,n){const i=this._rectangle;if(!ce.contains(i,e))return;const o=this.getNumberOfXTilesAtLevel(t),r=this.getNumberOfYTilesAtLevel(t),s=i.width/o,a=i.height/r;let l=e.longitude;i.east<i.west&&(l+=R.TWO_PI);let u=(l-i.west)/s|0;u>=o&&(u=o-1);let h=(i.north-e.latitude)/a|0;return h>=r&&(h=r-1),c(n)?(n.x=u,n.y=h,n):new H(u,h)};const IR=new d,DR=new d,PR=new he,sw=new d,Qte=new d,OR=new se,Kte=new Yr,bg=[new he,new he,new he,new he],Tg=new H,Xi={};Xi.initialize=function(){let e=Xi._initPromise;return c(e)||(e=Ae.fetchJson(Zt("Assets/approximateTerrainHeights.json")).then(function(t){Xi._terrainHeights=t}),Xi._initPromise=e),e};Xi.getMinimumMaximumHeights=function(e,t){if(A.defined("rectangle",e),!c(Xi._terrainHeights))throw new E("You must call ApproximateTerrainHeights.initialize and wait for the promise to resolve before using this function");t=y(t,ae.WGS84);const n=Wk(e);let i=Xi._defaultMinTerrainHeight,o=Xi._defaultMaxTerrainHeight;if(c(n)){const r=`${n.level}-${n.x}-${n.y}`,s=Xi._terrainHeights[r];c(s)&&(i=s[0],o=s[1]),t.cartographicToCartesian(ce.northeast(e,PR),IR),t.cartographicToCartesian(ce.southwest(e,PR),DR),d.midpoint(DR,IR,sw);const a=t.scaleToGeodeticSurface(sw,Qte);if(c(a)){const l=d.distance(sw,a);i=Math.min(i,-l)}else i=Xi._defaultMinTerrainHeight}return i=Math.max(Xi._defaultMinTerrainHeight,i),{minimumTerrainHeight:i,maximumTerrainHeight:o}};Xi.getBoundingSphere=function(e,t){if(A.defined("rectangle",e),!c(Xi._terrainHeights))throw new E("You must call ApproximateTerrainHeights.initialize and wait for the promise to resolve before using this function");t=y(t,ae.WGS84);const n=Wk(e);let i=Xi._defaultMaxTerrainHeight;if(c(n)){const r=`${n.level}-${n.x}-${n.y}`,s=Xi._terrainHeights[r];c(s)&&(i=s[1])}const o=se.fromRectangle3D(e,t,0);return se.fromRectangle3D(e,t,i,OR),se.union(o,OR,o)};function Wk(e){he.fromRadians(e.east,e.north,0,bg[0]),he.fromRadians(e.west,e.north,0,bg[1]),he.fromRadians(e.east,e.south,0,bg[2]),he.fromRadians(e.west,e.south,0,bg[3]);let t=0,n=0,i=0,o=0;const r=Xi._terrainHeightsMaxLevel;let s;for(s=0;s<=r;++s){let a=!1;for(let l=0;l<4;++l){const u=bg[l];if(Kte.positionToTileXY(u,s,Tg),l===0)i=Tg.x,o=Tg.y;else if(i!==Tg.x||o!==Tg.y){a=!0;break}}if(a)break;t=i,n=o}if(s!==0)return{x:t,y:n,level:s>r?r:s-1}}Xi._terrainHeightsMaxLevel=6;Xi._defaultMaxTerrainHeight=9e3;Xi._defaultMinTerrainHeight=-1e5;Xi._terrainHeights=void 0;Xi._initPromise=void 0;Object.defineProperties(Xi,{initialized:{get:function(){return c(Xi._terrainHeights)}}});const Ti=Xi;function Gr(e,t,n){this.minimum=d.clone(y(e,d.ZERO)),this.maximum=d.clone(y(t,d.ZERO)),c(n)?n=d.clone(n):n=d.midpoint(this.minimum,this.maximum,new d),this.center=n}Gr.fromCorners=function(e,t,n){return A.defined("minimum",e),A.defined("maximum",t),c(n)||(n=new Gr),n.minimum=d.clone(e,n.minimum),n.maximum=d.clone(t,n.maximum),n.center=d.midpoint(e,t,n.center),n};Gr.fromPoints=function(e,t){if(c(t)||(t=new Gr),!c(e)||e.length===0)return t.minimum=d.clone(d.ZERO,t.minimum),t.maximum=d.clone(d.ZERO,t.maximum),t.center=d.clone(d.ZERO,t.center),t;let n=e[0].x,i=e[0].y,o=e[0].z,r=e[0].x,s=e[0].y,a=e[0].z;const l=e.length;for(let f=1;f<l;f++){const _=e[f],g=_.x,m=_.y,b=_.z;n=Math.min(g,n),r=Math.max(g,r),i=Math.min(m,i),s=Math.max(m,s),o=Math.min(b,o),a=Math.max(b,a)}const u=t.minimum;u.x=n,u.y=i,u.z=o;const h=t.maximum;return h.x=r,h.y=s,h.z=a,t.center=d.midpoint(u,h,t.center),t};Gr.clone=function(e,t){if(!!c(e))return c(t)?(t.minimum=d.clone(e.minimum,t.minimum),t.maximum=d.clone(e.maximum,t.maximum),t.center=d.clone(e.center,t.center),t):new Gr(e.minimum,e.maximum,e.center)};Gr.equals=function(e,t){return e===t||c(e)&&c(t)&&d.equals(e.center,t.center)&&d.equals(e.minimum,t.minimum)&&d.equals(e.maximum,t.maximum)};let Vb=new d;Gr.intersectPlane=function(e,t){A.defined("box",e),A.defined("plane",t),Vb=d.subtract(e.maximum,e.minimum,Vb);const n=d.multiplyByScalar(Vb,.5,Vb),i=t.normal,o=n.x*Math.abs(i.x)+n.y*Math.abs(i.y)+n.z*Math.abs(i.z),r=d.dot(e.center,i)+t.distance;return r-o>0?Bt.INSIDE:r+o<0?Bt.OUTSIDE:Bt.INTERSECTING};Gr.prototype.clone=function(e){return Gr.clone(this,e)};Gr.prototype.intersectPlane=function(e){return Gr.intersectPlane(this,e)};Gr.prototype.equals=function(e){return Gr.equals(this,e)};const QP={};QP.computeDiscriminant=function(e,t,n){if(typeof e!="number")throw new E("a is a required number.");if(typeof t!="number")throw new E("b is a required number.");if(typeof n!="number")throw new E("c is a required number.");return t*t-4*e*n};function LR(e,t,n){const i=e+t;return R.sign(e)!==R.sign(t)&&Math.abs(i/Math.max(Math.abs(e),Math.abs(t)))<n?0:i}QP.computeRealRoots=function(e,t,n){if(typeof e!="number")throw new E("a is a required number.");if(typeof t!="number")throw new E("b is a required number.");if(typeof n!="number")throw new E("c is a required number.");let i;if(e===0)return t===0?[]:[-n/t];if(t===0){if(n===0)return[0,0];const l=Math.abs(n),u=Math.abs(e);if(l<u&&l/u<R.EPSILON14)return[0,0];if(l>u&&u/l<R.EPSILON14)return[];if(i=-n/e,i<0)return[];const h=Math.sqrt(i);return[-h,h]}else if(n===0)return i=-t/e,i<0?[i,0]:[0,i];const o=t*t,r=4*e*n,s=LR(o,-r,R.EPSILON14);if(s<0)return[];const a=-.5*LR(t,R.sign(t)*Math.sqrt(s),R.EPSILON14);return t>0?[a/e,n/a]:[n/a,a/e]};const Ku=QP,KP={};KP.computeDiscriminant=function(e,t,n,i){if(typeof e!="number")throw new E("a is a required number.");if(typeof t!="number")throw new E("b is a required number.");if(typeof n!="number")throw new E("c is a required number.");if(typeof i!="number")throw new E("d is a required number.");const o=e*e,r=t*t,s=n*n,a=i*i;return 18*e*t*n*i+r*s-27*o*a-4*(e*s*n+r*t*i)};function aw(e,t,n,i){const o=e,r=t/3,s=n/3,a=i,l=o*s,u=r*a,h=r*r,f=s*s,_=o*s-h,g=o*a-r*s,m=r*a-f,b=4*_*m-g*g;let T,x;if(b<0){let X,q,ee;h*u>=l*f?(X=o,q=_,ee=-2*r*_+o*g):(X=a,q=m,ee=-a*g+2*s*m);const ne=-(ee<0?-1:1)*Math.abs(X)*Math.sqrt(-b);x=-ee+ne;const Q=x/2,le=Q<0?-Math.pow(-Q,1/3):Math.pow(Q,1/3),pe=x===ne?-le:-q/le;return T=q<=0?le+pe:-ee/(le*le+pe*pe+q),h*u>=l*f?[(T-r)/o]:[-a/(T+s)]}const C=_,w=-2*r*_+o*g,v=m,P=-a*g+2*s*m,N=Math.sqrt(b),k=Math.sqrt(3)/2;let M=Math.abs(Math.atan2(o*N,-w)/3);T=2*Math.sqrt(-C);let U=Math.cos(M);x=T*U;let B=T*(-U/2-k*Math.sin(M));const S=x+B>2*r?x-r:B-r,D=o,p=S/D;M=Math.abs(Math.atan2(a*N,-P)/3),T=2*Math.sqrt(-v),U=Math.cos(M),x=T*U,B=T*(-U/2-k*Math.sin(M));const I=-a,O=x+B<2*s?x+s:B+s,F=I/O,V=D*O,G=-S*O-D*I,j=S*I,W=(s*G-r*j)/(-r*G+s*V);return p<=W?p<=F?W<=F?[p,W,F]:[p,F,W]:[F,p,W]:p<=F?[W,p,F]:W<=F?[W,F,p]:[F,W,p]}KP.computeRealRoots=function(e,t,n,i){if(typeof e!="number")throw new E("a is a required number.");if(typeof t!="number")throw new E("b is a required number.");if(typeof n!="number")throw new E("c is a required number.");if(typeof i!="number")throw new E("d is a required number.");let o,r;if(e===0)return Ku.computeRealRoots(t,n,i);if(t===0){if(n===0){if(i===0)return[0,0,0];r=-i/e;const s=r<0?-Math.pow(-r,1/3):Math.pow(r,1/3);return[s,s,s]}else if(i===0)return o=Ku.computeRealRoots(e,0,n),o.Length===0?[0]:[o[0],0,o[1]];return aw(e,0,n,i)}else{if(n===0)return i===0?(r=-t/e,r<0?[r,0,0]:[0,0,r]):aw(e,t,0,i);if(i===0)return o=Ku.computeRealRoots(e,t,n),o.length===0?[0]:o[1]<=0?[o[0],o[1],0]:o[0]>=0?[0,o[0],o[1]]:[o[0],0,o[1]]}return aw(e,t,n,i)};const ZP=KP,JP={};JP.computeDiscriminant=function(e,t,n,i,o){if(typeof e!="number")throw new E("a is a required number.");if(typeof t!="number")throw new E("b is a required number.");if(typeof n!="number")throw new E("c is a required number.");if(typeof i!="number")throw new E("d is a required number.");if(typeof o!="number")throw new E("e is a required number.");const r=e*e,s=r*e,a=t*t,l=a*t,u=n*n,h=u*n,f=i*i,_=f*i,g=o*o,m=g*o;return a*u*f-4*l*_-4*e*h*f+18*e*t*n*_-27*r*f*f+256*s*m+o*(18*l*n*i-4*a*h+16*e*u*u-80*e*t*u*i-6*e*a*f+144*r*n*f)+g*(144*e*a*n-27*a*a-128*r*u-192*r*t*i)};function Yc(e,t,n,i){const o=e*e,r=t-3*o/8,s=n-t*e/2+o*e/8,a=i-n*e/4+t*o/16-3*o*o/256,l=ZP.computeRealRoots(1,2*r,r*r-4*a,-s*s);if(l.length>0){const u=-e/4,h=l[l.length-1];if(Math.abs(h)<R.EPSILON14){const f=Ku.computeRealRoots(1,r,a);if(f.length===2){const _=f[0],g=f[1];let m;if(_>=0&&g>=0){const b=Math.sqrt(_),T=Math.sqrt(g);return[u-T,u-b,u+b,u+T]}else{if(_>=0&&g<0)return m=Math.sqrt(_),[u-m,u+m];if(_<0&&g>=0)return m=Math.sqrt(g),[u-m,u+m]}}return[]}else if(h>0){const f=Math.sqrt(h),_=(r+h-s/f)/2,g=(r+h+s/f)/2,m=Ku.computeRealRoots(1,f,_),b=Ku.computeRealRoots(1,-f,g);return m.length!==0?(m[0]+=u,m[1]+=u,b.length!==0?(b[0]+=u,b[1]+=u,m[1]<=b[0]?[m[0],m[1],b[0],b[1]]:b[1]<=m[0]?[b[0],b[1],m[0],m[1]]:m[0]>=b[0]&&m[1]<=b[1]?[b[0],m[0],m[1],b[1]]:b[0]>=m[0]&&b[1]<=m[1]?[m[0],b[0],b[1],m[1]]:m[0]>b[0]&&m[0]<b[1]?[b[0],m[0],b[1],m[1]]:[m[0],b[0],m[1],b[1]]):m):b.length!==0?(b[0]+=u,b[1]+=u,b):[]}}return[]}function Ag(e,t,n,i){const o=n*n,r=t*t,s=e*e,a=-2*t,l=n*e+r-4*i,u=s*i-n*t*e+o,h=ZP.computeRealRoots(1,a,l,u);if(h.length>0){const f=h[0],_=t-f,g=_*_,m=e/2,b=_/2,T=g-4*i,x=g+4*Math.abs(i),C=s-4*f,w=s+4*Math.abs(f);let v,P;if(f<0||T*w<C*x){const D=Math.sqrt(C);v=D/2,P=D===0?0:(e*b-n)/D}else{const D=Math.sqrt(T);v=D===0?0:(e*b-n)/D,P=D/2}let N,k;m===0&&v===0?(N=0,k=0):R.sign(m)===R.sign(v)?(N=m+v,k=f/N):(k=m-v,N=f/k);let M,U;b===0&&P===0?(M=0,U=0):R.sign(b)===R.sign(P)?(M=b+P,U=i/M):(U=b-P,M=i/U);const B=Ku.computeRealRoots(1,N,M),S=Ku.computeRealRoots(1,k,U);if(B.length!==0)return S.length!==0?B[1]<=S[0]?[B[0],B[1],S[0],S[1]]:S[1]<=B[0]?[S[0],S[1],B[0],B[1]]:B[0]>=S[0]&&B[1]<=S[1]?[S[0],B[0],B[1],S[1]]:S[0]>=B[0]&&S[1]<=B[1]?[B[0],S[0],S[1],B[1]]:B[0]>S[0]&&B[0]<S[1]?[S[0],B[0],S[1],B[1]]:[B[0],S[0],B[1],S[1]]:B;if(S.length!==0)return S}return[]}JP.computeRealRoots=function(e,t,n,i,o){if(typeof e!="number")throw new E("a is a required number.");if(typeof t!="number")throw new E("b is a required number.");if(typeof n!="number")throw new E("c is a required number.");if(typeof i!="number")throw new E("d is a required number.");if(typeof o!="number")throw new E("e is a required number.");if(Math.abs(e)<R.EPSILON15)return ZP.computeRealRoots(t,n,i,o);const r=t/e,s=n/e,a=i/e,l=o/e;let u=r<0?1:0;switch(u+=s<0?u+1:u,u+=a<0?u+1:u,u+=l<0?u+1:u,u){case 0:return Yc(r,s,a,l);case 1:return Ag(r,s,a,l);case 2:return Ag(r,s,a,l);case 3:return Yc(r,s,a,l);case 4:return Yc(r,s,a,l);case 5:return Ag(r,s,a,l);case 6:return Yc(r,s,a,l);case 7:return Yc(r,s,a,l);case 8:return Ag(r,s,a,l);case 9:return Yc(r,s,a,l);case 10:return Yc(r,s,a,l);case 11:return Ag(r,s,a,l);case 12:return Yc(r,s,a,l);case 13:return Yc(r,s,a,l);case 14:return Yc(r,s,a,l);case 15:return Yc(r,s,a,l);default:return}};const Zte=JP;function nn(e,t){t=d.clone(y(t,d.ZERO)),d.equals(t,d.ZERO)||d.normalize(t,t),this.origin=d.clone(y(e,d.ZERO)),this.direction=t}nn.clone=function(e,t){if(!!c(e))return c(t)?(t.origin=d.clone(e.origin),t.direction=d.clone(e.direction),t):new nn(e.origin,e.direction)};nn.getPoint=function(e,t,n){return A.typeOf.object("ray",e),A.typeOf.number("t",t),c(n)||(n=new d),n=d.multiplyByScalar(e.direction,t,n),d.add(e.origin,n,n)};const _i={};_i.rayPlane=function(e,t,n){if(!c(e))throw new E("ray is required.");if(!c(t))throw new E("plane is required.");c(n)||(n=new d);const i=e.origin,o=e.direction,r=t.normal,s=d.dot(r,o);if(Math.abs(s)<R.EPSILON15)return;const a=(-t.distance-d.dot(r,i))/s;if(!(a<0))return n=d.multiplyByScalar(o,a,n),d.add(i,n,n)};const Jte=new d,ene=new d,qk=new d,RR=new d,NR=new d;_i.rayTriangleParametric=function(e,t,n,i,o){if(!c(e))throw new E("ray is required.");if(!c(t))throw new E("p0 is required.");if(!c(n))throw new E("p1 is required.");if(!c(i))throw new E("p2 is required.");o=y(o,!1);const r=e.origin,s=e.direction,a=d.subtract(n,t,Jte),l=d.subtract(i,t,ene),u=d.cross(s,l,qk),h=d.dot(a,u);let f,_,g,m,b;if(o){if(h<R.EPSILON6||(f=d.subtract(r,t,RR),g=d.dot(f,u),g<0||g>h)||(_=d.cross(f,a,NR),m=d.dot(s,_),m<0||g+m>h))return;b=d.dot(l,_)/h}else{if(Math.abs(h)<R.EPSILON6)return;const T=1/h;if(f=d.subtract(r,t,RR),g=d.dot(f,u)*T,g<0||g>1||(_=d.cross(f,a,NR),m=d.dot(s,_)*T,m<0||g+m>1))return;b=d.dot(l,_)*T}return b};_i.rayTriangle=function(e,t,n,i,o,r){const s=_i.rayTriangleParametric(e,t,n,i,o);if(!(!c(s)||s<0))return c(r)||(r=new d),d.multiplyByScalar(e.direction,s,r),d.add(e.origin,r,r)};const tne=new nn;_i.lineSegmentTriangle=function(e,t,n,i,o,r,s){if(!c(e))throw new E("v0 is required.");if(!c(t))throw new E("v1 is required.");if(!c(n))throw new E("p0 is required.");if(!c(i))throw new E("p1 is required.");if(!c(o))throw new E("p2 is required.");const a=tne;d.clone(e,a.origin),d.subtract(t,e,a.direction),d.normalize(a.direction,a.direction);const l=_i.rayTriangleParametric(a,n,i,o,r);if(!(!c(l)||l<0||l>d.distance(e,t)))return c(s)||(s=new d),d.multiplyByScalar(a.direction,l,s),d.add(a.origin,s,s)};function nne(e,t,n,i){const o=t*t-4*e*n;if(o<0)return;if(o>0){const s=1/(2*e),a=Math.sqrt(o),l=(-t+a)*s,u=(-t-a)*s;return l<u?(i.root0=l,i.root1=u):(i.root0=u,i.root1=l),i}const r=-t/(2*e);if(r!==0)return i.root0=i.root1=r,i}const ine={root0:0,root1:0};function Yk(e,t,n){c(n)||(n=new Yu);const i=e.origin,o=e.direction,r=t.center,s=t.radius*t.radius,a=d.subtract(i,r,qk),l=d.dot(o,o),u=2*d.dot(o,a),h=d.magnitudeSquared(a)-s,f=nne(l,u,h,ine);if(!!c(f))return n.start=f.root0,n.stop=f.root1,n}_i.raySphere=function(e,t,n){if(!c(e))throw new E("ray is required.");if(!c(t))throw new E("sphere is required.");if(n=Yk(e,t,n),!(!c(n)||n.stop<0))return n.start=Math.max(n.start,0),n};const one=new nn;_i.lineSegmentSphere=function(e,t,n,i){if(!c(e))throw new E("p0 is required.");if(!c(t))throw new E("p1 is required.");if(!c(n))throw new E("sphere is required.");const o=one;d.clone(e,o.origin);const r=d.subtract(t,e,o.direction),s=d.magnitude(r);if(d.normalize(r,r),i=Yk(o,n,i),!(!c(i)||i.stop<0||i.start>s))return i.start=Math.max(i.start,0),i.stop=Math.min(i.stop,s),i};const rne=new d,sne=new d;_i.rayEllipsoid=function(e,t){if(!c(e))throw new E("ray is required.");if(!c(t))throw new E("ellipsoid is required.");const n=t.oneOverRadii,i=d.multiplyComponents(n,e.origin,rne),o=d.multiplyComponents(n,e.direction,sne),r=d.magnitudeSquared(i),s=d.dot(i,o);let a,l,u,h,f;if(r>1){if(s>=0)return;const _=s*s;if(a=r-1,l=d.magnitudeSquared(o),u=l*a,_<u)return;if(_>u){h=s*s-u,f=-s+Math.sqrt(h);const m=f/l,b=a/f;return m<b?new Yu(m,b):{start:b,stop:m}}const g=Math.sqrt(a/l);return new Yu(g,g)}else if(r<1)return a=r-1,l=d.magnitudeSquared(o),u=l*a,h=s*s-u,f=-s+Math.sqrt(h),new Yu(0,f/l);if(s<0)return l=d.magnitudeSquared(o),new Yu(0,-s/l)};function uf(e,t,n){const i=e+t;return R.sign(e)!==R.sign(t)&&Math.abs(i/Math.max(Math.abs(e),Math.abs(t)))<n?0:i}_i.quadraticVectorExpression=function(e,t,n,i,o){const r=i*i,s=o*o,a=(e[$.COLUMN1ROW1]-e[$.COLUMN2ROW2])*s,l=o*(i*uf(e[$.COLUMN1ROW0],e[$.COLUMN0ROW1],R.EPSILON15)+t.y),u=e[$.COLUMN0ROW0]*r+e[$.COLUMN2ROW2]*s+i*t.x+n,h=s*uf(e[$.COLUMN2ROW1],e[$.COLUMN1ROW2],R.EPSILON15),f=o*(i*uf(e[$.COLUMN2ROW0],e[$.COLUMN0ROW2])+t.z);let _;const g=[];if(f===0&&h===0){if(_=Ku.computeRealRoots(a,l,u),_.length===0)return g;const M=_[0],U=Math.sqrt(Math.max(1-M*M,0));if(g.push(new d(i,o*M,o*-U)),g.push(new d(i,o*M,o*U)),_.length===2){const B=_[1],S=Math.sqrt(Math.max(1-B*B,0));g.push(new d(i,o*B,o*-S)),g.push(new d(i,o*B,o*S))}return g}const m=f*f,b=h*h,T=a*a,x=f*h,C=T+b,w=2*(l*a+x),v=2*u*a+l*l-b+m,P=2*(u*l-x),N=u*u-m;if(C===0&&w===0&&v===0&&P===0)return g;_=Zte.computeRealRoots(C,w,v,P,N);const k=_.length;if(k===0)return g;for(let M=0;M<k;++M){const U=_[M],B=U*U,S=Math.max(1-B,0),D=Math.sqrt(S);let p;R.sign(a)===R.sign(u)?p=uf(a*B+u,l*U,R.EPSILON12):R.sign(u)===R.sign(l*U)?p=uf(a*B,l*U+u,R.EPSILON12):p=uf(a*B+l*U,u,R.EPSILON12);const I=uf(h*U,f,R.EPSILON15),O=p*I;O<0?g.push(new d(i,o*U,o*D)):O>0?g.push(new d(i,o*U,o*-D)):D!==0?(g.push(new d(i,o*U,o*-D)),g.push(new d(i,o*U,o*D)),++M):g.push(new d(i,o*U,o*D))}return g};const cw=new d,MR=new d,FR=new d,Hb=new d,ane=new d,cne=new $,lne=new $,une=new $,dne=new $,hne=new $,BR=new $,zR=new $,UR=new d,fne=new d,pne=new he;_i.grazingAltitudeLocation=function(e,t){if(!c(e))throw new E("ray is required.");if(!c(t))throw new E("ellipsoid is required.");const n=e.origin,i=e.direction;if(!d.equals(n,d.ZERO)){const N=t.geodeticSurfaceNormal(n,cw);if(d.dot(i,N)>=0)return n}const o=c(this.rayEllipsoid(e,t)),r=t.transformPositionToScaledSpace(i,cw),s=d.normalize(r,r),a=d.mostOrthogonalAxis(r,Hb),l=d.normalize(d.cross(a,s,MR),MR),u=d.normalize(d.cross(s,l,FR),FR),h=cne;h[0]=s.x,h[1]=s.y,h[2]=s.z,h[3]=l.x,h[4]=l.y,h[5]=l.z,h[6]=u.x,h[7]=u.y,h[8]=u.z;const f=$.transpose(h,lne),_=$.fromScale(t.radii,une),g=$.fromScale(t.oneOverRadii,dne),m=hne;m[0]=0,m[1]=-i.z,m[2]=i.y,m[3]=i.z,m[4]=0,m[5]=-i.x,m[6]=-i.y,m[7]=i.x,m[8]=0;const b=$.multiply($.multiply(f,g,BR),m,BR),T=$.multiply($.multiply(b,_,zR),h,zR),x=$.multiplyByVector(b,n,ane),C=_i.quadraticVectorExpression(T,d.negate(x,cw),0,0,1);let w,v;const P=C.length;if(P>0){let N=d.clone(d.ZERO,fne),k=Number.NEGATIVE_INFINITY;for(let U=0;U<P;++U){w=$.multiplyByVector(_,$.multiplyByVector(h,C[U],UR),UR);const B=d.normalize(d.subtract(w,n,Hb),Hb),S=d.dot(B,i);S>k&&(k=S,N=d.clone(w,N))}const M=t.cartesianToCartographic(N,pne);return k=R.clamp(k,0,1),v=d.magnitude(d.subtract(N,n,Hb))*Math.sqrt(1-k*k),v=o?-v:v,M.height=v,t.cartographicToCartesian(M,new d)}};const mne=new d;_i.lineSegmentPlane=function(e,t,n,i){if(!c(e))throw new E("endPoint0 is required.");if(!c(t))throw new E("endPoint1 is required.");if(!c(n))throw new E("plane is required.");c(i)||(i=new d);const o=d.subtract(t,e,mne),r=n.normal,s=d.dot(r,o);if(Math.abs(s)<R.EPSILON6)return;const a=d.dot(r,e),l=-(n.distance+a)/s;if(!(l<0||l>1))return d.multiplyByScalar(o,l,i),d.add(e,i,i),i};_i.trianglePlaneIntersection=function(e,t,n,i){if(!c(e)||!c(t)||!c(n)||!c(i))throw new E("p0, p1, p2, and plane are required.");const o=i.normal,r=i.distance,s=d.dot(o,e)+r<0,a=d.dot(o,t)+r<0,l=d.dot(o,n)+r<0;let u=0;u+=s?1:0,u+=a?1:0,u+=l?1:0;let h,f;if((u===1||u===2)&&(h=new d,f=new d),u===1){if(s)return _i.lineSegmentPlane(e,t,i,h),_i.lineSegmentPlane(e,n,i,f),{positions:[e,t,n,h,f],indices:[0,3,4,1,2,4,1,4,3]};if(a)return _i.lineSegmentPlane(t,n,i,h),_i.lineSegmentPlane(t,e,i,f),{positions:[e,t,n,h,f],indices:[1,3,4,2,0,4,2,4,3]};if(l)return _i.lineSegmentPlane(n,e,i,h),_i.lineSegmentPlane(n,t,i,f),{positions:[e,t,n,h,f],indices:[2,3,4,0,1,4,0,4,3]}}else if(u===2)if(s)if(a){if(!l)return _i.lineSegmentPlane(e,n,i,h),_i.lineSegmentPlane(t,n,i,f),{positions:[e,t,n,h,f],indices:[0,1,4,0,4,3,2,3,4]}}else return _i.lineSegmentPlane(n,t,i,h),_i.lineSegmentPlane(e,t,i,f),{positions:[e,t,n,h,f],indices:[2,0,4,2,4,3,1,3,4]};else return _i.lineSegmentPlane(t,e,i,h),_i.lineSegmentPlane(n,e,i,f),{positions:[e,t,n,h,f],indices:[1,2,4,1,4,3,0,3,4]}};const Ei=_i,lw=new te;function Co(e,t){if(A.defined("origin",e),t=y(t,ae.WGS84),e=t.scaleToGeodeticSurface(e),!c(e))throw new E("origin must not be at the center of the ellipsoid.");const n=zt.eastNorthUpToFixedFrame(e,t);this._ellipsoid=t,this._origin=e,this._xAxis=d.fromCartesian4(L.getColumn(n,0,lw)),this._yAxis=d.fromCartesian4(L.getColumn(n,1,lw));const i=d.fromCartesian4(L.getColumn(n,2,lw));this._plane=_t.fromPointNormal(e,i)}Object.defineProperties(Co.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},origin:{get:function(){return this._origin}},plane:{get:function(){return this._plane}},xAxis:{get:function(){return this._xAxis}},yAxis:{get:function(){return this._yAxis}},zAxis:{get:function(){return this._plane.normal}}});const _ne=new Gr;Co.fromPoints=function(e,t){A.defined("cartesians",e);const n=Gr.fromPoints(e,_ne);return new Co(n.center,t)};const $k=new nn,Sx=new d;Co.prototype.projectPointOntoPlane=function(e,t){A.defined("cartesian",e);const n=$k;n.origin=e,d.normalize(e,n.direction);let i=Ei.rayPlane(n,this._plane,Sx);if(c(i)||(d.negate(n.direction,n.direction),i=Ei.rayPlane(n,this._plane,Sx)),c(i)){const o=d.subtract(i,this._origin,i),r=d.dot(this._xAxis,o),s=d.dot(this._yAxis,o);return c(t)?(t.x=r,t.y=s,t):new H(r,s)}};Co.prototype.projectPointsOntoPlane=function(e,t){A.defined("cartesians",e),c(t)||(t=[]);let n=0;const i=e.length;for(let o=0;o<i;o++){const r=this.projectPointOntoPlane(e[o],t[n]);c(r)&&(t[n]=r,n++)}return t.length=n,t};Co.prototype.projectPointToNearestOnPlane=function(e,t){A.defined("cartesian",e),c(t)||(t=new H);const n=$k;n.origin=e,d.clone(this._plane.normal,n.direction);let i=Ei.rayPlane(n,this._plane,Sx);c(i)||(d.negate(n.direction,n.direction),i=Ei.rayPlane(n,this._plane,Sx));const o=d.subtract(i,this._origin,i),r=d.dot(this._xAxis,o),s=d.dot(this._yAxis,o);return t.x=r,t.y=s,t};Co.prototype.projectPointsToNearestOnPlane=function(e,t){A.defined("cartesians",e),c(t)||(t=[]);const n=e.length;t.length=n;for(let i=0;i<n;i++)t[i]=this.projectPointToNearestOnPlane(e[i],t[i]);return t};const gne=new d;Co.prototype.projectPointOntoEllipsoid=function(e,t){A.defined("cartesian",e),c(t)||(t=new d);const n=this._ellipsoid,i=this._origin,o=this._xAxis,r=this._yAxis,s=gne;return d.multiplyByScalar(o,e.x,s),t=d.add(i,s,t),d.multiplyByScalar(r,e.y,s),d.add(t,s,t),n.scaleToGeocentricSurface(t,t),t};Co.prototype.projectPointsOntoEllipsoid=function(e,t){A.defined("cartesians",e);const n=e.length;c(t)?t.length=n:t=new Array(n);for(let i=0;i<n;++i)t[i]=this.projectPointOntoEllipsoid(e[i],t[i]);return t};function Ct(e,t){this.center=d.clone(y(e,d.ZERO)),this.halfAxes=$.clone(y(t,$.ZERO))}Ct.packedLength=d.packedLength+$.packedLength;Ct.pack=function(e,t,n){return A.typeOf.object("value",e),A.defined("array",t),n=y(n,0),d.pack(e.center,t,n),$.pack(e.halfAxes,t,n+d.packedLength),t};Ct.unpack=function(e,t,n){return A.defined("array",e),t=y(t,0),c(n)||(n=new Ct),d.unpack(e,t,n.center),$.unpack(e,t+d.packedLength,n.halfAxes),n};const yne=new d,bne=new d,Tne=new d,Ane=new d,xne=new d,Cne=new d,Ene=new $,wne={unitary:new $,diagonal:new $};Ct.fromPoints=function(e,t){if(c(t)||(t=new Ct),!c(e)||e.length===0)return t.halfAxes=$.ZERO,t.center=d.ZERO,t;let n;const i=e.length,o=d.clone(e[0],yne);for(n=1;n<i;n++)d.add(o,e[n],o);const r=1/i;d.multiplyByScalar(o,r,o);let s=0,a=0,l=0,u=0,h=0,f=0,_;for(n=0;n<i;n++)_=d.subtract(e[n],o,bne),s+=_.x*_.x,a+=_.x*_.y,l+=_.x*_.z,u+=_.y*_.y,h+=_.y*_.z,f+=_.z*_.z;s*=r,a*=r,l*=r,u*=r,h*=r,f*=r;const g=Ene;g[0]=s,g[1]=a,g[2]=l,g[3]=a,g[4]=u,g[5]=h,g[6]=l,g[7]=h,g[8]=f;const m=$.computeEigenDecomposition(g,wne),b=$.clone(m.unitary,t.halfAxes);let T=$.getColumn(b,0,Ane),x=$.getColumn(b,1,xne),C=$.getColumn(b,2,Cne),w=-Number.MAX_VALUE,v=-Number.MAX_VALUE,P=-Number.MAX_VALUE,N=Number.MAX_VALUE,k=Number.MAX_VALUE,M=Number.MAX_VALUE;for(n=0;n<i;n++)_=e[n],w=Math.max(d.dot(T,_),w),v=Math.max(d.dot(x,_),v),P=Math.max(d.dot(C,_),P),N=Math.min(d.dot(T,_),N),k=Math.min(d.dot(x,_),k),M=Math.min(d.dot(C,_),M);T=d.multiplyByScalar(T,.5*(N+w),T),x=d.multiplyByScalar(x,.5*(k+v),x),C=d.multiplyByScalar(C,.5*(M+P),C);const U=d.add(T,x,t.center);d.add(U,C,U);const B=Tne;return B.x=w-N,B.y=v-k,B.z=P-M,d.multiplyByScalar(B,.5,B),$.multiplyByScale(t.halfAxes,B,t.halfAxes),t};const Xk=new d,Sne=new d;function kR(e,t,n,i,o,r,s,a,l,u,h){if(!c(o)||!c(r)||!c(s)||!c(a)||!c(l)||!c(u))throw new E("all extents (minimum/maximum X/Y/Z) are required.");c(h)||(h=new Ct);const f=h.halfAxes;$.setColumn(f,0,t,f),$.setColumn(f,1,n,f),$.setColumn(f,2,i,f);let _=Xk;_.x=(o+r)/2,_.y=(s+a)/2,_.z=(l+u)/2;const g=Sne;g.x=(r-o)/2,g.y=(a-s)/2,g.z=(u-l)/2;const m=h.center;return _=$.multiplyByVector(f,_,_),d.add(e,_,m),$.multiplyByScale(f,g,f),h}const VR=new he,vne=new d,Ine=new he,Dne=new he,Pne=new he,One=new he,Lne=new he,Rne=new d,HR=new d,Nne=new d,GR=new d,Mne=new d,Fne=new H,Bne=new H,zne=new H,Une=new H,kne=new H,Vne=new d,Hne=new d,Gne=new d,jne=new d,Wne=new H,qne=new d,Yne=new d,$ne=new d,Xne=new _t(d.UNIT_X,0);Ct.fromRectangle=function(e,t,n,i,o){if(!c(e))throw new E("rectangle is required");if(e.width<0||e.width>R.TWO_PI)throw new E("Rectangle width must be between 0 and 2 * pi");if(e.height<0||e.height>R.PI)throw new E("Rectangle height must be between 0 and pi");if(c(i)&&!R.equalsEpsilon(i.radii.x,i.radii.y,R.EPSILON15))throw new E("Ellipsoid must be an ellipsoid of revolution (radii.x == radii.y)");t=y(t,0),n=y(n,0),i=y(i,ae.WGS84);let r,s,a,l,u,h,f;if(e.width<=R.PI){const k=ce.center(e,VR),M=i.cartographicToCartesian(k,vne),U=new Co(M,i);f=U.plane;const B=k.longitude,S=e.south<0&&e.north>0?0:k.latitude,D=he.fromRadians(B,e.north,n,Ine),p=he.fromRadians(e.west,e.north,n,Dne),I=he.fromRadians(e.west,S,n,Pne),O=he.fromRadians(e.west,e.south,n,One),F=he.fromRadians(B,e.south,n,Lne),V=i.cartographicToCartesian(D,Rne);let G=i.cartographicToCartesian(p,HR);const j=i.cartographicToCartesian(I,Nne);let W=i.cartographicToCartesian(O,GR);const X=i.cartographicToCartesian(F,Mne),q=U.projectPointToNearestOnPlane(V,Fne),ee=U.projectPointToNearestOnPlane(G,Bne),Y=U.projectPointToNearestOnPlane(j,zne),ne=U.projectPointToNearestOnPlane(W,Une),Q=U.projectPointToNearestOnPlane(X,kne);return r=Math.min(ee.x,Y.x,ne.x),s=-r,l=Math.max(ee.y,q.y),a=Math.min(ne.y,Q.y),p.height=O.height=t,G=i.cartographicToCartesian(p,HR),W=i.cartographicToCartesian(O,GR),u=Math.min(_t.getPointDistance(f,G),_t.getPointDistance(f,W)),h=n,kR(U.origin,U.xAxis,U.yAxis,U.zAxis,r,s,a,l,u,h,o)}const _=e.south>0,g=e.north<0,m=_?e.south:g?e.north:0,b=ce.center(e,VR).longitude,T=d.fromRadians(b,m,n,i,Vne);T.z=0;const C=Math.abs(T.x)<R.EPSILON10&&Math.abs(T.y)<R.EPSILON10?d.UNIT_X:d.normalize(T,Hne),w=d.UNIT_Z,v=d.cross(C,w,Gne);f=_t.fromPointNormal(T,C,Xne);const P=d.fromRadians(b+R.PI_OVER_TWO,m,n,i,jne);s=d.dot(_t.projectPointOntoPlane(f,P,Wne),v),r=-s,l=d.fromRadians(0,e.north,g?t:n,i,qne).z,a=d.fromRadians(0,e.south,_?t:n,i,Yne).z;const N=d.fromRadians(e.east,m,n,i,$ne);return u=_t.getPointDistance(f,N),h=0,kR(T,v,w,C,r,s,a,l,u,h,o)};Ct.fromTransformation=function(e,t){return A.typeOf.object("transformation",e),c(t)||(t=new Ct),t.center=L.getTranslation(e,t.center),t.halfAxes=L.getMatrix3(e,t.halfAxes),t.halfAxes=$.multiplyByScalar(t.halfAxes,.5,t.halfAxes),t};Ct.clone=function(e,t){if(!!c(e))return c(t)?(d.clone(e.center,t.center),$.clone(e.halfAxes,t.halfAxes),t):new Ct(e.center,e.halfAxes)};Ct.intersectPlane=function(e,t){if(!c(e))throw new E("box is required.");if(!c(t))throw new E("plane is required.");const n=e.center,i=t.normal,o=e.halfAxes,r=i.x,s=i.y,a=i.z,l=Math.abs(r*o[$.COLUMN0ROW0]+s*o[$.COLUMN0ROW1]+a*o[$.COLUMN0ROW2])+Math.abs(r*o[$.COLUMN1ROW0]+s*o[$.COLUMN1ROW1]+a*o[$.COLUMN1ROW2])+Math.abs(r*o[$.COLUMN2ROW0]+s*o[$.COLUMN2ROW1]+a*o[$.COLUMN2ROW2]),u=d.dot(i,n)+t.distance;return u<=-l?Bt.OUTSIDE:u>=l?Bt.INSIDE:Bt.INTERSECTING};const Qk=new d,Kk=new d,Zk=new d,Qne=new d,jR=new d,Kne=new d;Ct.distanceSquaredTo=function(e,t){if(!c(e))throw new E("box is required.");if(!c(t))throw new E("cartesian is required.");const n=d.subtract(t,e.center,Xk),i=e.halfAxes;let o=$.getColumn(i,0,Qk),r=$.getColumn(i,1,Kk),s=$.getColumn(i,2,Zk);const a=d.magnitude(o),l=d.magnitude(r),u=d.magnitude(s);let h=!0,f=!0,_=!0;a>0?d.divideByScalar(o,a,o):h=!1,l>0?d.divideByScalar(r,l,r):f=!1,u>0?d.divideByScalar(s,u,s):_=!1;const g=!h+!f+!_;let m,b,T;if(g===1){let v=o;m=r,b=s,f?_||(v=s,b=o):(v=r,m=o),T=d.cross(m,b,jR),v===o?o=T:v===r?r=T:v===s&&(s=T)}else if(g===2){m=o,f?m=r:_&&(m=s);let v=d.UNIT_Y;v.equalsEpsilon(m,R.EPSILON3)&&(v=d.UNIT_X),b=d.cross(m,v,Qne),d.normalize(b,b),T=d.cross(m,b,jR),d.normalize(T,T),m===o?(r=b,s=T):m===r?(s=b,o=T):m===s&&(o=b,r=T)}else g===3&&(o=d.UNIT_X,r=d.UNIT_Y,s=d.UNIT_Z);const x=Kne;x.x=d.dot(n,o),x.y=d.dot(n,r),x.z=d.dot(n,s);let C=0,w;return x.x<-a?(w=x.x+a,C+=w*w):x.x>a&&(w=x.x-a,C+=w*w),x.y<-l?(w=x.y+l,C+=w*w):x.y>l&&(w=x.y-l,C+=w*w),x.z<-u?(w=x.z+u,C+=w*w):x.z>u&&(w=x.z-u,C+=w*w),C};const Zne=new d,Jne=new d;Ct.computePlaneDistances=function(e,t,n,i){if(!c(e))throw new E("box is required.");if(!c(t))throw new E("position is required.");if(!c(n))throw new E("direction is required.");c(i)||(i=new Yu);let o=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY;const s=e.center,a=e.halfAxes,l=$.getColumn(a,0,Qk),u=$.getColumn(a,1,Kk),h=$.getColumn(a,2,Zk),f=d.add(l,u,Zne);d.add(f,h,f),d.add(f,s,f);const _=d.subtract(f,t,Jne);let g=d.dot(n,_);return o=Math.min(g,o),r=Math.max(g,r),d.add(s,l,f),d.add(f,u,f),d.subtract(f,h,f),d.subtract(f,t,_),g=d.dot(n,_),o=Math.min(g,o),r=Math.max(g,r),d.add(s,l,f),d.subtract(f,u,f),d.add(f,h,f),d.subtract(f,t,_),g=d.dot(n,_),o=Math.min(g,o),r=Math.max(g,r),d.add(s,l,f),d.subtract(f,u,f),d.subtract(f,h,f),d.subtract(f,t,_),g=d.dot(n,_),o=Math.min(g,o),r=Math.max(g,r),d.subtract(s,l,f),d.add(f,u,f),d.add(f,h,f),d.subtract(f,t,_),g=d.dot(n,_),o=Math.min(g,o),r=Math.max(g,r),d.subtract(s,l,f),d.add(f,u,f),d.subtract(f,h,f),d.subtract(f,t,_),g=d.dot(n,_),o=Math.min(g,o),r=Math.max(g,r),d.subtract(s,l,f),d.subtract(f,u,f),d.add(f,h,f),d.subtract(f,t,_),g=d.dot(n,_),o=Math.min(g,o),r=Math.max(g,r),d.subtract(s,l,f),d.subtract(f,u,f),d.subtract(f,h,f),d.subtract(f,t,_),g=d.dot(n,_),o=Math.min(g,o),r=Math.max(g,r),i.start=o,i.stop=r,i};const eie=new d,tie=new d,nie=new d;Ct.computeCorners=function(e,t){A.typeOf.object("box",e),c(t)||(t=[new d,new d,new d,new d,new d,new d,new d,new d]);const n=e.center,i=e.halfAxes,o=$.getColumn(i,0,eie),r=$.getColumn(i,1,tie),s=$.getColumn(i,2,nie);return d.clone(n,t[0]),d.subtract(t[0],o,t[0]),d.subtract(t[0],r,t[0]),d.subtract(t[0],s,t[0]),d.clone(n,t[1]),d.subtract(t[1],o,t[1]),d.subtract(t[1],r,t[1]),d.add(t[1],s,t[1]),d.clone(n,t[2]),d.subtract(t[2],o,t[2]),d.add(t[2],r,t[2]),d.subtract(t[2],s,t[2]),d.clone(n,t[3]),d.subtract(t[3],o,t[3]),d.add(t[3],r,t[3]),d.add(t[3],s,t[3]),d.clone(n,t[4]),d.add(t[4],o,t[4]),d.subtract(t[4],r,t[4]),d.subtract(t[4],s,t[4]),d.clone(n,t[5]),d.add(t[5],o,t[5]),d.subtract(t[5],r,t[5]),d.add(t[5],s,t[5]),d.clone(n,t[6]),d.add(t[6],o,t[6]),d.add(t[6],r,t[6]),d.subtract(t[6],s,t[6]),d.clone(n,t[7]),d.add(t[7],o,t[7]),d.add(t[7],r,t[7]),d.add(t[7],s,t[7]),t};const iie=new $;Ct.computeTransformation=function(e,t){A.typeOf.object("box",e),c(t)||(t=new L);const n=e.center,i=$.multiplyByUniformScale(e.halfAxes,2,iie);return L.fromRotationTranslation(i,n,t)};const oie=new se;Ct.isOccluded=function(e,t){if(!c(e))throw new E("box is required.");if(!c(t))throw new E("occluder is required.");const n=se.fromOrientedBoundingBox(e,oie);return!t.isBoundingSphereVisible(n)};Ct.prototype.intersectPlane=function(e){return Ct.intersectPlane(this,e)};Ct.prototype.distanceSquaredTo=function(e){return Ct.distanceSquaredTo(this,e)};Ct.prototype.computePlaneDistances=function(e,t,n){return Ct.computePlaneDistances(this,e,t,n)};Ct.prototype.computeCorners=function(e){return Ct.computeCorners(this,e)};Ct.prototype.computeTransformation=function(e){return Ct.computeTransformation(this,e)};Ct.prototype.isOccluded=function(e){return Ct.isOccluded(this,e)};Ct.equals=function(e,t){return e===t||c(e)&&c(t)&&d.equals(e.center,t.center)&&$.equals(e.halfAxes,t.halfAxes)};Ct.prototype.clone=function(e){return Ct.clone(this,e)};Ct.prototype.equals=function(e){return Ct.equals(this,e)};const vx={};vx.getHeight=function(e,t,n){if(!Number.isFinite(t))throw new E("scale must be a finite number.");if(!Number.isFinite(n))throw new E("relativeHeight must be a finite number.");return(e-n)*t+n};const rie=new he;vx.getPosition=function(e,t,n,i,o){const r=t.cartesianToCartographic(e,rie);if(!c(r))return d.clone(e,o);const s=vx.getHeight(r.height,n,i);return d.fromRadians(r.longitude,r.latitude,s,t,o)};const oa=vx,sie=`in vec3 position3DHigh;
|
|
in vec3 position3DLow;
|
|
in float batchId;
|
|
|
|
#ifdef EXTRUDED_GEOMETRY
|
|
in vec3 extrudeDirection;
|
|
|
|
uniform float u_globeMinimumAltitude;
|
|
#endif // EXTRUDED_GEOMETRY
|
|
|
|
#ifdef PER_INSTANCE_COLOR
|
|
out vec4 v_color;
|
|
#endif // PER_INSTANCE_COLOR
|
|
|
|
#ifdef TEXTURE_COORDINATES
|
|
#ifdef SPHERICAL
|
|
out vec4 v_sphericalExtents;
|
|
#else // SPHERICAL
|
|
out vec2 v_inversePlaneExtents;
|
|
out vec4 v_westPlane;
|
|
out vec4 v_southPlane;
|
|
#endif // SPHERICAL
|
|
out vec3 v_uvMinAndSphericalLongitudeRotation;
|
|
out vec3 v_uMaxAndInverseDistance;
|
|
out vec3 v_vMaxAndInverseDistance;
|
|
#endif // TEXTURE_COORDINATES
|
|
|
|
void main()
|
|
{
|
|
vec4 position = czm_computePosition();
|
|
|
|
#ifdef EXTRUDED_GEOMETRY
|
|
float delta = min(u_globeMinimumAltitude, czm_geometricToleranceOverMeter * length(position.xyz));
|
|
delta *= czm_sceneMode == czm_sceneMode3D ? 1.0 : 0.0;
|
|
|
|
//extrudeDirection is zero for the top layer
|
|
position = position + vec4(extrudeDirection * delta, 0.0);
|
|
#endif
|
|
|
|
#ifdef TEXTURE_COORDINATES
|
|
#ifdef SPHERICAL
|
|
v_sphericalExtents = czm_batchTable_sphericalExtents(batchId);
|
|
v_uvMinAndSphericalLongitudeRotation.z = czm_batchTable_longitudeRotation(batchId);
|
|
#else // SPHERICAL
|
|
#ifdef COLUMBUS_VIEW_2D
|
|
vec4 planes2D_high = czm_batchTable_planes2D_HIGH(batchId);
|
|
vec4 planes2D_low = czm_batchTable_planes2D_LOW(batchId);
|
|
|
|
// If the primitive is split across the IDL (planes2D_high.x > planes2D_high.w):
|
|
// - If this vertex is on the east side of the IDL (position3DLow.y > 0.0, comparison with position3DHigh may produce artifacts)
|
|
// - existing "east" is on the wrong side of the world, far away (planes2D_high/low.w)
|
|
// - so set "east" as beyond the eastmost extent of the projection (idlSplitNewPlaneHiLow)
|
|
vec2 idlSplitNewPlaneHiLow = vec2(EAST_MOST_X_HIGH - (WEST_MOST_X_HIGH - planes2D_high.w), EAST_MOST_X_LOW - (WEST_MOST_X_LOW - planes2D_low.w));
|
|
bool idlSplit = planes2D_high.x > planes2D_high.w && position3DLow.y > 0.0;
|
|
planes2D_high.w = czm_branchFreeTernary(idlSplit, idlSplitNewPlaneHiLow.x, planes2D_high.w);
|
|
planes2D_low.w = czm_branchFreeTernary(idlSplit, idlSplitNewPlaneHiLow.y, planes2D_low.w);
|
|
|
|
// - else, if this vertex is on the west side of the IDL (position3DLow.y < 0.0)
|
|
// - existing "west" is on the wrong side of the world, far away (planes2D_high/low.x)
|
|
// - so set "west" as beyond the westmost extent of the projection (idlSplitNewPlaneHiLow)
|
|
idlSplit = planes2D_high.x > planes2D_high.w && position3DLow.y < 0.0;
|
|
idlSplitNewPlaneHiLow = vec2(WEST_MOST_X_HIGH - (EAST_MOST_X_HIGH - planes2D_high.x), WEST_MOST_X_LOW - (EAST_MOST_X_LOW - planes2D_low.x));
|
|
planes2D_high.x = czm_branchFreeTernary(idlSplit, idlSplitNewPlaneHiLow.x, planes2D_high.x);
|
|
planes2D_low.x = czm_branchFreeTernary(idlSplit, idlSplitNewPlaneHiLow.y, planes2D_low.x);
|
|
|
|
vec3 southWestCorner = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(vec3(0.0, planes2D_high.xy), vec3(0.0, planes2D_low.xy))).xyz;
|
|
vec3 northWestCorner = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(vec3(0.0, planes2D_high.x, planes2D_high.z), vec3(0.0, planes2D_low.x, planes2D_low.z))).xyz;
|
|
vec3 southEastCorner = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(vec3(0.0, planes2D_high.w, planes2D_high.y), vec3(0.0, planes2D_low.w, planes2D_low.y))).xyz;
|
|
#else // COLUMBUS_VIEW_2D
|
|
// 3D case has smaller "plane extents," so planes encoded as a 64 bit position and 2 vec3s for distances/direction
|
|
vec3 southWestCorner = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(czm_batchTable_southWest_HIGH(batchId), czm_batchTable_southWest_LOW(batchId))).xyz;
|
|
vec3 northWestCorner = czm_normal * czm_batchTable_northward(batchId) + southWestCorner;
|
|
vec3 southEastCorner = czm_normal * czm_batchTable_eastward(batchId) + southWestCorner;
|
|
#endif // COLUMBUS_VIEW_2D
|
|
|
|
vec3 eastWard = southEastCorner - southWestCorner;
|
|
float eastExtent = length(eastWard);
|
|
eastWard /= eastExtent;
|
|
|
|
vec3 northWard = northWestCorner - southWestCorner;
|
|
float northExtent = length(northWard);
|
|
northWard /= northExtent;
|
|
|
|
v_westPlane = vec4(eastWard, -dot(eastWard, southWestCorner));
|
|
v_southPlane = vec4(northWard, -dot(northWard, southWestCorner));
|
|
v_inversePlaneExtents = vec2(1.0 / eastExtent, 1.0 / northExtent);
|
|
#endif // SPHERICAL
|
|
vec4 uvMinAndExtents = czm_batchTable_uvMinAndExtents(batchId);
|
|
vec4 uMaxVmax = czm_batchTable_uMaxVmax(batchId);
|
|
|
|
v_uMaxAndInverseDistance = vec3(uMaxVmax.xy, uvMinAndExtents.z);
|
|
v_vMaxAndInverseDistance = vec3(uMaxVmax.zw, uvMinAndExtents.w);
|
|
v_uvMinAndSphericalLongitudeRotation.xy = uvMinAndExtents.xy;
|
|
#endif // TEXTURE_COORDINATES
|
|
|
|
#ifdef PER_INSTANCE_COLOR
|
|
v_color = czm_batchTable_color(batchId);
|
|
#endif
|
|
|
|
gl_Position = czm_depthClamp(czm_modelViewProjectionRelativeToEye * position);
|
|
}
|
|
`,wI=`#ifdef VECTOR_TILE
|
|
uniform vec4 u_highlightColor;
|
|
#endif
|
|
|
|
void main(void)
|
|
{
|
|
#ifdef VECTOR_TILE
|
|
out_FragColor = czm_gammaCorrect(u_highlightColor);
|
|
#else
|
|
out_FragColor = vec4(1.0);
|
|
#endif
|
|
czm_writeDepthClamp();
|
|
}
|
|
`,Jk={TERRAIN:0,CESIUM_3D_TILE:1,BOTH:2};Jk.NUMBER_OF_CLASSIFICATION_TYPES=3;const Ui=Object.freeze(Jk),aie={NEVER:J.NEVER,LESS:J.LESS,EQUAL:J.EQUAL,LESS_OR_EQUAL:J.LEQUAL,GREATER:J.GREATER,NOT_EQUAL:J.NOTEQUAL,GREATER_OR_EQUAL:J.GEQUAL,ALWAYS:J.ALWAYS},lp=Object.freeze(aie);function cie(e,t){if(!c(e))throw new E("array is required.");if(!c(t)||t<1)throw new E("numberOfArrays must be greater than 0.");const n=[],i=e.length;let o=0;for(;o<i;){const r=Math.ceil((i-o)/t--);n.push(e.slice(o,o+r)),o+=r}return n}function uu(e,t,n){if(!c(e))throw new E("context is required");if(!c(t))throw new E("attributes is required");if(!c(n))throw new E("numberOfInstances is required");if(this._attributes=t,this._numberOfInstances=n,t.length===0)return;const i=lie(t),o=e.floatingPointTexture,r=i===Me.FLOAT&&!o,s=uie(t,r),a=die(s,t,r),l=Math.floor(pt.maximumTextureSize/a),u=Math.min(n,l),h=a*u,f=Math.ceil(n/u),_=1/h,g=_*.5,m=1/f,b=m*.5;this._textureDimensions=new H(h,f),this._textureStep=new te(_,g,m,b),this._pixelDatatype=r?Me.UNSIGNED_BYTE:i,this._packFloats=r,this._offsets=s,this._stride=a,this._texture=void 0;const T=4*h*f;this._batchValues=i===Me.FLOAT&&!r?new Float32Array(T):new Uint8Array(T),this._batchValuesDirty=!1}Object.defineProperties(uu.prototype,{attributes:{get:function(){return this._attributes}},numberOfInstances:{get:function(){return this._numberOfInstances}}});function lie(e){let t=!1;const n=e.length;for(let i=0;i<n;++i)if(e[i].componentDatatype!==Z.UNSIGNED_BYTE){t=!0;break}return t?Me.FLOAT:Me.UNSIGNED_BYTE}function eV(e,t){const n=e[t].componentsPerAttribute;return n===2?H:n===3?d:n===4?te:Number}function uie(e,t){const n=new Array(e.length);let i=0;const o=e.length;for(let r=0;r<o;++r){const a=e[r].componentDatatype;n[r]=i,a!==Z.UNSIGNED_BYTE&&t?i+=4:++i}return n}function die(e,t,n){const i=e.length,o=e[i-1];return t[i-1].componentDatatype!==Z.UNSIGNED_BYTE&&n?o+4:o+1}const dy=new te;function hie(e,t,n){let i=te.unpack(e,t,dy);const o=te.unpackFloat(i);i=te.unpack(e,t+4,dy);const r=te.unpackFloat(i);i=te.unpack(e,t+8,dy);const s=te.unpackFloat(i);i=te.unpack(e,t+12,dy);const a=te.unpackFloat(i);return te.fromElements(o,r,s,a,n)}function fie(e,t,n){let i=te.packFloat(e.x,dy);te.pack(i,t,n),i=te.packFloat(e.y,i),te.pack(i,t,n+4),i=te.packFloat(e.z,i),te.pack(i,t,n+8),i=te.packFloat(e.w,i),te.pack(i,t,n+12)}const WR=new te;uu.prototype.getBatchedAttribute=function(e,t,n){if(e<0||e>=this._numberOfInstances)throw new E("instanceIndex is out of range.");if(t<0||t>=this._attributes.length)throw new E("attributeIndex is out of range");const i=this._attributes,o=this._offsets[t],s=4*this._stride*e+4*o;let a;this._packFloats&&i[t].componentDatatype!==Me.UNSIGNED_BYTE?a=hie(this._batchValues,s,WR):a=te.unpack(this._batchValues,s,WR);const l=eV(i,t);return c(l.fromCartesian4)?l.fromCartesian4(a,n):c(l.clone)?l.clone(a,n):a.x};const pie=[void 0,void 0,new H,new d,new te],mie=new te;uu.prototype.setBatchedAttribute=function(e,t,n){if(e<0||e>=this._numberOfInstances)throw new E("instanceIndex is out of range.");if(t<0||t>=this._attributes.length)throw new E("attributeIndex is out of range");if(!c(n))throw new E("value is required.");const i=this._attributes,o=pie[i[t].componentsPerAttribute],r=this.getBatchedAttribute(e,t,o),s=eV(this._attributes,t);if(c(s.equals)?s.equals(r,n):r===n)return;const l=mie;l.x=c(n.x)?n.x:n,l.y=c(n.y)?n.y:0,l.z=c(n.z)?n.z:0,l.w=c(n.w)?n.w:0;const u=this._offsets[t],f=4*this._stride*e+4*u;this._packFloats&&i[t].componentDatatype!==Me.UNSIGNED_BYTE?fie(l,this._batchValues,f):te.pack(l,this._batchValues,f),this._batchValuesDirty=!0};function _ie(e,t){const n=e._textureDimensions;e._texture=new xt({context:t,pixelFormat:Ve.RGBA,pixelDatatype:e._pixelDatatype,width:n.x,height:n.y,sampler:un.NEAREST,flipY:!1})}function gie(e){const t=e._textureDimensions;e._texture.copyFrom({source:{width:t.x,height:t.y,arrayBufferView:e._batchValues}})}uu.prototype.update=function(e){c(this._texture)&&!this._batchValuesDirty||this._attributes.length===0||(this._batchValuesDirty=!1,c(this._texture)||_ie(this,e.context),gie(this))};uu.prototype.getUniformMapCallback=function(){const e=this;return function(t){return e._attributes.length===0?t:jt(t,{batchTexture:function(){return e._texture},batchTextureDimensions:function(){return e._textureDimensions},batchTextureStep:function(){return e._textureStep}})}};function yie(e){const t=e._stride;return e._textureDimensions.y===1?`uniform vec4 batchTextureStep;
|
|
vec2 computeSt(float batchId)
|
|
{
|
|
float stepX = batchTextureStep.x;
|
|
float centerX = batchTextureStep.y;
|
|
float numberOfAttributes = float(${t});
|
|
return vec2(centerX + (batchId * numberOfAttributes * stepX), 0.5);
|
|
}
|
|
`:`uniform vec4 batchTextureStep;
|
|
uniform vec2 batchTextureDimensions;
|
|
vec2 computeSt(float batchId)
|
|
{
|
|
float stepX = batchTextureStep.x;
|
|
float centerX = batchTextureStep.y;
|
|
float stepY = batchTextureStep.z;
|
|
float centerY = batchTextureStep.w;
|
|
float numberOfAttributes = float(${t});
|
|
float xId = mod(batchId * numberOfAttributes, batchTextureDimensions.x);
|
|
float yId = floor(batchId * numberOfAttributes / batchTextureDimensions.x);
|
|
return vec2(centerX + (xId * stepX), centerY + (yId * stepY));
|
|
}
|
|
`}function bie(e){return e===1?"float":`vec${e}`}function Tie(e){return e===1?".x":e===2?".xy":e===3?".xyz":""}function Aie(e,t){const i=e._attributes[t],o=i.componentsPerAttribute,r=i.functionName,s=bie(o),a=Tie(o),l=e._offsets[t];let u=`${s} ${r}(float batchId)
|
|
{
|
|
vec2 st = computeSt(batchId);
|
|
st.x += batchTextureStep.x * float(${l});
|
|
`;return e._packFloats&&i.componentDatatype!==Me.UNSIGNED_BYTE?u+=`vec4 textureValue;
|
|
textureValue.x = czm_unpackFloat(texture(batchTexture, st));
|
|
textureValue.y = czm_unpackFloat(texture(batchTexture, st + vec2(batchTextureStep.x, 0.0)));
|
|
textureValue.z = czm_unpackFloat(texture(batchTexture, st + vec2(batchTextureStep.x * 2.0, 0.0)));
|
|
textureValue.w = czm_unpackFloat(texture(batchTexture, st + vec2(batchTextureStep.x * 3.0, 0.0)));
|
|
`:u+=` vec4 textureValue = texture(batchTexture, st);
|
|
`,u+=` ${s} value = textureValue${a};
|
|
`,e._pixelDatatype===Me.UNSIGNED_BYTE&&i.componentDatatype===Z.UNSIGNED_BYTE&&!i.normalize?u+=`value *= 255.0;
|
|
`:e._pixelDatatype===Me.FLOAT&&i.componentDatatype===Z.UNSIGNED_BYTE&&i.normalize&&(u+=`value /= 255.0;
|
|
`),u+=` return value;
|
|
}
|
|
`,u}uu.prototype.getVertexShaderCallback=function(){const e=this._attributes;if(e.length===0)return function(i){return i};let t=`uniform highp sampler2D batchTexture;
|
|
`;t+=`${yie(this)}
|
|
`;const n=e.length;for(let i=0;i<n;++i)t+=Aie(this,i);return function(i){const o=i.indexOf("void main"),r=i.substring(0,o),s=i.substring(o);return`${r}
|
|
${t}
|
|
${s}`}};uu.prototype.isDestroyed=function(){return!1};uu.prototype.destroy=function(){return this._texture=this._texture&&this._texture.destroy(),ve(this)};const kn={SCALAR:"SCALAR",VEC2:"VEC2",VEC3:"VEC3",VEC4:"VEC4",MAT2:"MAT2",MAT3:"MAT3",MAT4:"MAT4"};kn.getMathType=function(e){switch(e){case kn.SCALAR:return Number;case kn.VEC2:return H;case kn.VEC3:return d;case kn.VEC4:return te;case kn.MAT2:return Xe;case kn.MAT3:return $;case kn.MAT4:return L;default:throw new E("attributeType is not a valid value.")}};kn.getNumberOfComponents=function(e){switch(e){case kn.SCALAR:return 1;case kn.VEC2:return 2;case kn.VEC3:return 3;case kn.VEC4:case kn.MAT2:return 4;case kn.MAT3:return 9;case kn.MAT4:return 16;default:throw new E("attributeType is not a valid value.")}};kn.getAttributeLocationCount=function(e){switch(e){case kn.SCALAR:case kn.VEC2:case kn.VEC3:case kn.VEC4:return 1;case kn.MAT2:return 2;case kn.MAT3:return 3;case kn.MAT4:return 4;default:throw new E("attributeType is not a valid value.")}};kn.getGlslType=function(e){switch(A.typeOf.string("attributeType",e),e){case kn.SCALAR:return"float";case kn.VEC2:return"vec2";case kn.VEC3:return"vec3";case kn.VEC4:return"vec4";case kn.MAT2:return"mat2";case kn.MAT3:return"mat3";case kn.MAT4:return"mat4";default:throw new E("attributeType is not a valid value.")}};const qt=Object.freeze(kn),qR=1/256,YR=256,ii={};ii.octEncodeInRange=function(e,t,n){A.defined("vector",e),A.defined("result",n);const i=d.magnitudeSquared(e);if(Math.abs(i-1)>R.EPSILON6)throw new E("vector must be normalized.");if(n.x=e.x/(Math.abs(e.x)+Math.abs(e.y)+Math.abs(e.z)),n.y=e.y/(Math.abs(e.x)+Math.abs(e.y)+Math.abs(e.z)),e.z<0){const o=n.x,r=n.y;n.x=(1-Math.abs(r))*R.signNotZero(o),n.y=(1-Math.abs(o))*R.signNotZero(r)}return n.x=R.toSNorm(n.x,t),n.y=R.toSNorm(n.y,t),n};ii.octEncode=function(e,t){return ii.octEncodeInRange(e,255,t)};const xg=new H,$R=new Uint8Array(1);function Gb(e){return $R[0]=e,$R[0]}ii.octEncodeToCartesian4=function(e,t){return ii.octEncodeInRange(e,65535,xg),t.x=Gb(xg.x*qR),t.y=Gb(xg.x),t.z=Gb(xg.y*qR),t.w=Gb(xg.y),t};ii.octDecodeInRange=function(e,t,n,i){if(A.defined("result",i),e<0||e>n||t<0||t>n)throw new E(`x and y must be unsigned normalized integers between 0 and ${n}`);if(i.x=R.fromSNorm(e,n),i.y=R.fromSNorm(t,n),i.z=1-(Math.abs(i.x)+Math.abs(i.y)),i.z<0){const o=i.x;i.x=(1-Math.abs(i.y))*R.signNotZero(o),i.y=(1-Math.abs(o))*R.signNotZero(i.y)}return d.normalize(i,i)};ii.octDecode=function(e,t,n){return ii.octDecodeInRange(e,t,255,n)};ii.octDecodeFromCartesian4=function(e,t){A.typeOf.object("encoded",e),A.typeOf.object("result",t);const n=e.x,i=e.y,o=e.z,r=e.w;if(n<0||n>255||i<0||i>255||o<0||o>255||r<0||r>255)throw new E("x, y, z, and w must be unsigned normalized integers between 0 and 255");const s=n*YR+i,a=o*YR+r;return ii.octDecodeInRange(s,a,65535,t)};ii.octPackFloat=function(e){return A.defined("encoded",e),256*e.x+e.y};const SI=new H;ii.octEncodeFloat=function(e){return ii.octEncode(e,SI),ii.octPackFloat(SI)};ii.octDecodeFloat=function(e,t){A.defined("value",e);const n=e/256,i=Math.floor(n),o=(n-i)*256;return ii.octDecode(i,o,t)};ii.octPack=function(e,t,n,i){A.defined("v1",e),A.defined("v2",t),A.defined("v3",n),A.defined("result",i);const o=ii.octEncodeFloat(e),r=ii.octEncodeFloat(t),s=ii.octEncode(n,SI);return i.x=65536*s.x+o,i.y=65536*s.y+r,i};ii.octUnpack=function(e,t,n,i){A.defined("packed",e),A.defined("v1",t),A.defined("v2",n),A.defined("v3",i);let o=e.x/65536;const r=Math.floor(o),s=(o-r)*65536;o=e.y/65536;const a=Math.floor(o),l=(o-a)*65536;ii.octDecodeFloat(s,t),ii.octDecodeFloat(l,n),ii.octDecode(r,a,i)};ii.compressTextureCoordinates=function(e){A.defined("textureCoordinates",e);const t=e.x*4095|0,n=e.y*4095|0;return 4096*t+n};ii.decompressTextureCoordinates=function(e,t){A.defined("compressed",e),A.defined("result",t);const n=e/4096,i=Math.floor(n);return t.x=i/4095,t.y=(e-i*4096)/4095,t};function uw(e){return e>>1^-(e&1)}ii.zigZagDeltaDecode=function(e,t,n){A.defined("uBuffer",e),A.defined("vBuffer",t),A.typeOf.number.equals("uBuffer.length","vBuffer.length",e.length,t.length),c(n)&&A.typeOf.number.equals("uBuffer.length","heightBuffer.length",e.length,n.length);const i=e.length;let o=0,r=0,s=0;for(let a=0;a<i;++a)o+=uw(e[a]),r+=uw(t[a]),e[a]=o,t[a]=r,c(n)&&(s+=uw(n[a]),n[a]=s)};ii.dequantize=function(e,t,n,i){A.defined("typedArray",e),A.defined("componentDatatype",t),A.defined("type",n),A.defined("count",i);const o=qt.getNumberOfComponents(n);let r;switch(t){case Z.BYTE:r=127;break;case Z.UNSIGNED_BYTE:r=255;break;case Z.SHORT:r=32767;break;case Z.UNSIGNED_SHORT:r=65535;break;case Z.INT:r=2147483647;break;case Z.UNSIGNED_INT:r=4294967295;break;default:throw new E(`Cannot dequantize component datatype: ${t}`)}const s=new Float32Array(i*o);for(let a=0;a<i;a++)for(let l=0;l<o;l++){const u=a*o+l;s[u]=Math.max(e[u]/r,-1)}return s};ii.decodeRGB565=function(e,t){A.defined("typedArray",e);const n=e.length*3;c(t)&&A.typeOf.number.equals("result.length","typedArray.length * 3",t.length,n);const i=e.length;c(t)||(t=new Float32Array(i*3));const o=(1<<5)-1,r=(1<<6)-1,s=1/31,a=1/63;for(let l=0;l<i;l++){const u=e[l],h=u>>11,f=u>>5&r,_=u&o,g=3*l;t[g]=h*s,t[g+1]=f*a,t[g+2]=_*s}return t};const En=ii,XR=new d,QR=new d,KR=new d;function xie(e,t,n,i,o){A.defined("point",e),A.defined("p0",t),A.defined("p1",n),A.defined("p2",i),c(o)||(o=new d);let r,s,a,l,u,h,f,_;if(c(t.z)){if(d.equalsEpsilon(e,t,R.EPSILON14))return d.clone(d.UNIT_X,o);if(d.equalsEpsilon(e,n,R.EPSILON14))return d.clone(d.UNIT_Y,o);if(d.equalsEpsilon(e,i,R.EPSILON14))return d.clone(d.UNIT_Z,o);r=d.subtract(n,t,XR),s=d.subtract(i,t,QR),a=d.subtract(e,t,KR),l=d.dot(r,r),u=d.dot(r,s),h=d.dot(r,a),f=d.dot(s,s),_=d.dot(s,a)}else{if(H.equalsEpsilon(e,t,R.EPSILON14))return d.clone(d.UNIT_X,o);if(H.equalsEpsilon(e,n,R.EPSILON14))return d.clone(d.UNIT_Y,o);if(H.equalsEpsilon(e,i,R.EPSILON14))return d.clone(d.UNIT_Z,o);r=H.subtract(n,t,XR),s=H.subtract(i,t,QR),a=H.subtract(e,t,KR),l=H.dot(r,r),u=H.dot(r,s),h=H.dot(r,a),f=H.dot(s,s),_=H.dot(s,a)}o.y=f*h-u*_,o.z=l*_-u*h;const g=l*f-u*u;if(g!==0)return o.y/=g,o.z/=g,o.x=1-o.y-o.z,o}const eO={};eO.calculateACMR=function(e){e=y(e,y.EMPTY_OBJECT);const t=e.indices;let n=e.maximumIndex;const i=y(e.cacheSize,24);if(!c(t))throw new E("indices is required.");const o=t.length;if(o<3||o%3!==0)throw new E("indices length must be a multiple of three.");if(n<=0)throw new E("maximumIndex must be greater than zero.");if(i<3)throw new E("cacheSize must be greater than two.");if(!c(n)){n=0;let a=0,l=t[a];for(;a<o;)l>n&&(n=l),++a,l=t[a]}const r=[];for(let a=0;a<n+1;a++)r[a]=0;let s=i+1;for(let a=0;a<o;++a)s-r[t[a]]>i&&(r[t[a]]=s,++s);return(s-i+1)/(o/3)};eO.tipsify=function(e){e=y(e,y.EMPTY_OBJECT);const t=e.indices,n=e.maximumIndex,i=y(e.cacheSize,24);let o;function r(S,D,p,I){for(;D.length>=1;){const O=D[D.length-1];if(D.splice(D.length-1,1),S[O].numLiveTriangles>0)return O}for(;o<I;){if(S[o].numLiveTriangles>0)return++o,o-1;++o}return-1}function s(S,D,p,I,O,F,V){let G=-1,j,W=-1,X=0;for(;X<p.length;){const q=p[X];I[q].numLiveTriangles&&(j=0,O-I[q].timeStamp+2*I[q].numLiveTriangles<=D&&(j=O-I[q].timeStamp),(j>W||W===-1)&&(W=j,G=q)),++X}return G===-1?r(I,F,S,V):G}if(!c(t))throw new E("indices is required.");const a=t.length;if(a<3||a%3!==0)throw new E("indices length must be a multiple of three.");if(n<=0)throw new E("maximumIndex must be greater than zero.");if(i<3)throw new E("cacheSize must be greater than two.");let l=0,u=0,h=t[u];const f=a;if(c(n))l=n+1;else{for(;u<f;)h>l&&(l=h),++u,h=t[u];if(l===-1)return 0;++l}const _=[];let g;for(g=0;g<l;g++)_[g]={numLiveTriangles:0,timeStamp:0,vertexTriangles:[]};u=0;let m=0;for(;u<f;)_[t[u]].vertexTriangles.push(m),++_[t[u]].numLiveTriangles,_[t[u+1]].vertexTriangles.push(m),++_[t[u+1]].numLiveTriangles,_[t[u+2]].vertexTriangles.push(m),++_[t[u+2]].numLiveTriangles,++m,u+=3;let b=0,T=i+1;o=1;let x=[];const C=[];let w,v,P=0;const N=[],k=a/3,M=[];for(g=0;g<k;g++)M[g]=!1;let U,B;for(;b!==-1;){x=[],v=_[b],B=v.vertexTriangles.length;for(let S=0;S<B;++S)if(m=v.vertexTriangles[S],!M[m]){M[m]=!0,u=m+m+m;for(let D=0;D<3;++D)U=t[u],x.push(U),C.push(U),N[P]=U,++P,w=_[U],--w.numLiveTriangles,T-w.timeStamp>i&&(w.timeStamp=T,++T),++u}b=s(t,i,x,_,T,C,l)}return N};const Cie=eO,Vs={};function Ix(e,t,n,i,o){e[t++]=n,e[t++]=i,e[t++]=i,e[t++]=o,e[t++]=o,e[t]=n}function Eie(e){const t=e.length,n=t/3*6,i=je.createTypedArray(t,n);let o=0;for(let r=0;r<t;r+=3,o+=6)Ix(i,o,e[r],e[r+1],e[r+2]);return i}function wie(e){const t=e.length;if(t>=3){const n=(t-2)*6,i=je.createTypedArray(t,n);Ix(i,0,e[0],e[1],e[2]);let o=6;for(let r=3;r<t;++r,o+=6)Ix(i,o,e[r-1],e[r],e[r-2]);return i}return new Uint16Array}function Sie(e){if(e.length>0){const t=e.length-1,n=(t-1)*6,i=je.createTypedArray(t,n),o=e[0];let r=0;for(let s=1;s<t;++s,r+=6)Ix(i,r,o,e[s],e[s+1]);return i}return new Uint16Array}Vs.toWireframe=function(e){if(!c(e))throw new E("geometry is required.");const t=e.indices;if(c(t)){switch(e.primitiveType){case ze.TRIANGLES:e.indices=Eie(t);break;case ze.TRIANGLE_STRIP:e.indices=wie(t);break;case ze.TRIANGLE_FAN:e.indices=Sie(t);break;default:throw new E("geometry.primitiveType must be TRIANGLES, TRIANGLE_STRIP, or TRIANGLE_FAN.")}e.primitiveType=ze.LINES}return e};Vs.createLineSegmentsForVectors=function(e,t,n){if(t=y(t,"normal"),!c(e))throw new E("geometry is required.");if(!c(e.attributes.position))throw new E("geometry.attributes.position is required.");if(!c(e.attributes[t]))throw new E(`geometry.attributes must have an attribute with the same name as the attributeName parameter, ${t}.`);n=y(n,1e4);const i=e.attributes.position.values,o=e.attributes[t].values,r=i.length,s=new Float64Array(2*r);let a=0;for(let h=0;h<r;h+=3)s[a++]=i[h],s[a++]=i[h+1],s[a++]=i[h+2],s[a++]=i[h]+o[h]*n,s[a++]=i[h+1]+o[h+1]*n,s[a++]=i[h+2]+o[h+2]*n;let l;const u=e.boundingSphere;return c(u)&&(l=new se(u.center,u.radius+n)),new Tt({attributes:{position:new Ie({componentDatatype:Z.DOUBLE,componentsPerAttribute:3,values:s})},primitiveType:ze.LINES,boundingSphere:l})};Vs.createAttributeLocations=function(e){if(!c(e))throw new E("geometry is required.");const t=["position","positionHigh","positionLow","position3DHigh","position3DLow","position2DHigh","position2DLow","pickColor","normal","st","tangent","bitangent","extrudeDirection","compressedAttributes"],n=e.attributes,i={};let o=0,r;const s=t.length;for(r=0;r<s;++r){const a=t[r];c(n[a])&&(i[a]=o++)}for(const a in n)n.hasOwnProperty(a)&&!c(i[a])&&(i[a]=o++);return i};Vs.reorderForPreVertexCache=function(e){if(!c(e))throw new E("geometry is required.");const t=Tt.computeNumberOfVertices(e),n=e.indices;if(c(n)){const i=new Int32Array(t);for(let _=0;_<t;_++)i[_]=-1;const o=n,r=o.length,s=je.createTypedArray(t,r);let a=0,l=0,u=0,h;for(;a<r;)h=i[o[a]],h!==-1?s[l]=h:(h=o[a],i[h]=u,s[l]=u,++u),++a,++l;e.indices=s;const f=e.attributes;for(const _ in f)if(f.hasOwnProperty(_)&&c(f[_])&&c(f[_].values)){const g=f[_],m=g.values;let b=0;const T=g.componentsPerAttribute,x=Z.createTypedArray(g.componentDatatype,u*T);for(;b<t;){const C=i[b];if(C!==-1)for(let w=0;w<T;w++)x[T*C+w]=m[T*b+w];++b}g.values=x}}return e};Vs.reorderForPostVertexCache=function(e,t){if(!c(e))throw new E("geometry is required.");const n=e.indices;if(e.primitiveType===ze.TRIANGLES&&c(n)){const i=n.length;let o=0;for(let r=0;r<i;r++)n[r]>o&&(o=n[r]);e.indices=Cie.tipsify({indices:n,maximumIndex:o,cacheSize:t})}return e};function ZR(e){const t={};for(const n in e)if(e.hasOwnProperty(n)&&c(e[n])&&c(e[n].values)){const i=e[n];t[n]=new Ie({componentDatatype:i.componentDatatype,componentsPerAttribute:i.componentsPerAttribute,normalize:i.normalize,values:[]})}return t}function vie(e,t,n){for(const i in t)if(t.hasOwnProperty(i)&&c(t[i])&&c(t[i].values)){const o=t[i];for(let r=0;r<o.componentsPerAttribute;++r)e[i].values.push(o.values[n*o.componentsPerAttribute+r])}}Vs.fitToUnsignedShortIndices=function(e){if(!c(e))throw new E("geometry is required.");if(c(e.indices)&&e.primitiveType!==ze.TRIANGLES&&e.primitiveType!==ze.LINES&&e.primitiveType!==ze.POINTS)throw new E("geometry.primitiveType must equal to PrimitiveType.TRIANGLES, PrimitiveType.LINES, or PrimitiveType.POINTS.");const t=[],n=Tt.computeNumberOfVertices(e);if(c(e.indices)&&n>=R.SIXTY_FOUR_KILOBYTES){let i=[],o=[],r=0,s=ZR(e.attributes);const a=e.indices,l=a.length;let u;e.primitiveType===ze.TRIANGLES?u=3:e.primitiveType===ze.LINES?u=2:e.primitiveType===ze.POINTS&&(u=1);for(let h=0;h<l;h+=u){for(let f=0;f<u;++f){const _=a[h+f];let g=i[_];c(g)||(g=r++,i[_]=g,vie(s,e.attributes,_)),o.push(g)}r+u>=R.SIXTY_FOUR_KILOBYTES&&(t.push(new Tt({attributes:s,indices:o,primitiveType:e.primitiveType,boundingSphere:e.boundingSphere,boundingSphereCV:e.boundingSphereCV})),i=[],o=[],r=0,s=ZR(e.attributes))}o.length!==0&&t.push(new Tt({attributes:s,indices:o,primitiveType:e.primitiveType,boundingSphere:e.boundingSphere,boundingSphereCV:e.boundingSphereCV}))}else t.push(e);return t};const JR=new d,Iie=new he;Vs.projectTo2D=function(e,t,n,i,o){if(!c(e))throw new E("geometry is required.");if(!c(t))throw new E("attributeName is required.");if(!c(n))throw new E("attributeName3D is required.");if(!c(i))throw new E("attributeName2D is required.");if(!c(e.attributes[t]))throw new E(`geometry must have attribute matching the attributeName argument: ${t}.`);if(e.attributes[t].componentDatatype!==Z.DOUBLE)throw new E("The attribute componentDatatype must be ComponentDatatype.DOUBLE.");const r=e.attributes[t];o=c(o)?o:new co;const s=o.ellipsoid,a=r.values,l=new Float64Array(a.length);let u=0;for(let h=0;h<a.length;h+=3){const f=d.fromArray(a,h,JR),_=s.cartesianToCartographic(f,Iie);if(!c(_))throw new E(`Could not project point (${f.x}, ${f.y}, ${f.z}) to 2D.`);const g=o.project(_,JR);l[u++]=g.x,l[u++]=g.y,l[u++]=g.z}return e.attributes[n]=r,e.attributes[i]=new Ie({componentDatatype:Z.DOUBLE,componentsPerAttribute:3,values:l}),delete e.attributes[t],e};const dw={high:0,low:0};Vs.encodeAttribute=function(e,t,n,i){if(!c(e))throw new E("geometry is required.");if(!c(t))throw new E("attributeName is required.");if(!c(n))throw new E("attributeHighName is required.");if(!c(i))throw new E("attributeLowName is required.");if(!c(e.attributes[t]))throw new E(`geometry must have attribute matching the attributeName argument: ${t}.`);if(e.attributes[t].componentDatatype!==Z.DOUBLE)throw new E("The attribute componentDatatype must be ComponentDatatype.DOUBLE.");const o=e.attributes[t],r=o.values,s=r.length,a=new Float32Array(s),l=new Float32Array(s);for(let h=0;h<s;++h)rn.encode(r[h],dw),a[h]=dw.high,l[h]=dw.low;const u=o.componentsPerAttribute;return e.attributes[n]=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:u,values:a}),e.attributes[i]=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:u,values:l}),delete e.attributes[t],e};let il=new d;function hw(e,t){if(c(t)){const n=t.values,i=n.length;for(let o=0;o<i;o+=3)d.unpack(n,o,il),L.multiplyByPoint(e,il,il),d.pack(il,n,o)}}function fw(e,t){if(c(t)){const n=t.values,i=n.length;for(let o=0;o<i;o+=3)d.unpack(n,o,il),$.multiplyByVector(e,il,il),il=d.normalize(il,il),d.pack(il,n,o)}}const jb=new L,Wb=new $;Vs.transformToWorldCoordinates=function(e){if(!c(e))throw new E("instance is required.");const t=e.modelMatrix;if(L.equals(t,L.IDENTITY))return e;const n=e.geometry.attributes;hw(t,n.position),hw(t,n.prevPosition),hw(t,n.nextPosition),(c(n.normal)||c(n.tangent)||c(n.bitangent))&&(L.inverse(t,jb),L.transpose(jb,jb),L.getMatrix3(jb,Wb),fw(Wb,n.normal),fw(Wb,n.tangent),fw(Wb,n.bitangent));const i=e.geometry.boundingSphere;return c(i)&&(e.geometry.boundingSphere=se.transform(i,t,i)),e.modelMatrix=L.clone(L.IDENTITY),e};function Die(e,t){const n=e.length,i={},o=e[0][t].attributes;let r;for(r in o)if(o.hasOwnProperty(r)&&c(o[r])&&c(o[r].values)){const s=o[r];let a=s.values.length,l=!0;for(let u=1;u<n;++u){const h=e[u][t].attributes[r];if(!c(h)||s.componentDatatype!==h.componentDatatype||s.componentsPerAttribute!==h.componentsPerAttribute||s.normalize!==h.normalize){l=!1;break}a+=h.values.length}l&&(i[r]=new Ie({componentDatatype:s.componentDatatype,componentsPerAttribute:s.componentsPerAttribute,normalize:s.normalize,values:Z.createTypedArray(s.componentDatatype,a)}))}return i}const Pie=new d;function pw(e,t){const n=e.length;let i,o,r,s;const a=e[0].modelMatrix,l=c(e[0][t].indices),u=e[0][t].primitiveType;for(o=1;o<n;++o){if(!L.equals(e[o].modelMatrix,a))throw new E("All instances must have the same modelMatrix.");if(c(e[o][t].indices)!==l)throw new E("All instance geometries must have an indices or not have one.");if(e[o][t].primitiveType!==u)throw new E("All instance geometries must have the same primitiveType.")}const h=Die(e,t);let f,_,g;for(i in h)if(h.hasOwnProperty(i))for(f=h[i].values,s=0,o=0;o<n;++o)for(_=e[o][t].attributes[i].values,g=_.length,r=0;r<g;++r)f[s++]=_[r];let m;if(l){let C=0;for(o=0;o<n;++o)C+=e[o][t].indices.length;const w=Tt.computeNumberOfVertices(new Tt({attributes:h,primitiveType:ze.POINTS})),v=je.createTypedArray(w,C);let P=0,N=0;for(o=0;o<n;++o){const k=e[o][t].indices,M=k.length;for(s=0;s<M;++s)v[P++]=N+k[s];N+=Tt.computeNumberOfVertices(e[o][t])}m=v}let b=new d,T=0,x;for(o=0;o<n;++o){if(x=e[o][t].boundingSphere,!c(x)){b=void 0;break}d.add(x.center,b,b)}if(c(b))for(d.divideByScalar(b,n,b),o=0;o<n;++o){x=e[o][t].boundingSphere;const C=d.magnitude(d.subtract(x.center,b,Pie))+x.radius;C>T&&(T=C)}return new Tt({attributes:h,indices:m,primitiveType:u,boundingSphere:c(b)?new se(b,T):void 0})}Vs.combineInstances=function(e){if(!c(e)||e.length<1)throw new E("instances is required and must have length greater than zero.");const t=[],n=[],i=e.length;for(let r=0;r<i;++r){const s=e[r];c(s.geometry)?t.push(s):c(s.westHemisphereGeometry)&&c(s.eastHemisphereGeometry)&&n.push(s)}const o=[];return t.length>0&&o.push(pw(t,"geometry")),n.length>0&&(o.push(pw(n,"westHemisphereGeometry")),o.push(pw(n,"eastHemisphereGeometry"))),o};const Xa=new d,Cg=new d,cm=new d,lm=new d;Vs.computeNormal=function(e){if(!c(e))throw new E("geometry is required.");if(!c(e.attributes.position)||!c(e.attributes.position.values))throw new E("geometry.attributes.position.values is required.");if(!c(e.indices))throw new E("geometry.indices is required.");if(e.indices.length<2||e.indices.length%3!==0)throw new E("geometry.indices length must be greater than 0 and be a multiple of 3.");if(e.primitiveType!==ze.TRIANGLES)throw new E("geometry.primitiveType must be PrimitiveType.TRIANGLES.");const t=e.indices,n=e.attributes,i=n.position.values,o=n.position.values.length/3,r=t.length,s=new Array(o),a=new Array(r/3),l=new Array(r);let u;for(u=0;u<o;u++)s[u]={indexOffset:0,count:0,currentCount:0};let h=0;for(u=0;u<r;u+=3){const m=t[u],b=t[u+1],T=t[u+2],x=m*3,C=b*3,w=T*3;Cg.x=i[x],Cg.y=i[x+1],Cg.z=i[x+2],cm.x=i[C],cm.y=i[C+1],cm.z=i[C+2],lm.x=i[w],lm.y=i[w+1],lm.z=i[w+2],s[m].count++,s[b].count++,s[T].count++,d.subtract(cm,Cg,cm),d.subtract(lm,Cg,lm),a[h]=d.cross(cm,lm,new d),h++}let f=0;for(u=0;u<o;u++)s[u].indexOffset+=f,f+=s[u].count;h=0;let _;for(u=0;u<r;u+=3){_=s[t[u]];let m=_.indexOffset+_.currentCount;l[m]=h,_.currentCount++,_=s[t[u+1]],m=_.indexOffset+_.currentCount,l[m]=h,_.currentCount++,_=s[t[u+2]],m=_.indexOffset+_.currentCount,l[m]=h,_.currentCount++,h++}const g=new Float32Array(o*3);for(u=0;u<o;u++){const m=u*3;if(_=s[u],d.clone(d.ZERO,Xa),_.count>0){for(h=0;h<_.count;h++)d.add(Xa,a[l[_.indexOffset+h]],Xa);d.equalsEpsilon(d.ZERO,Xa,R.EPSILON10)&&d.clone(a[l[_.indexOffset]],Xa)}d.equalsEpsilon(d.ZERO,Xa,R.EPSILON10)&&(Xa.z=1),d.normalize(Xa,Xa),g[m]=Xa.x,g[m+1]=Xa.y,g[m+2]=Xa.z}return e.attributes.normal=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:3,values:g}),e};const Oie=new d,eN=new d,Lie=new d;Vs.computeTangentAndBitangent=function(e){if(!c(e))throw new E("geometry is required.");const t=e.attributes,n=e.indices;if(!c(t.position)||!c(t.position.values))throw new E("geometry.attributes.position.values is required.");if(!c(t.normal)||!c(t.normal.values))throw new E("geometry.attributes.normal.values is required.");if(!c(t.st)||!c(t.st.values))throw new E("geometry.attributes.st.values is required.");if(!c(n))throw new E("geometry.indices is required.");if(n.length<2||n.length%3!==0)throw new E("geometry.indices length must be greater than 0 and be a multiple of 3.");if(e.primitiveType!==ze.TRIANGLES)throw new E("geometry.primitiveType must be PrimitiveType.TRIANGLES.");const i=e.attributes.position.values,o=e.attributes.normal.values,r=e.attributes.st.values,s=e.attributes.position.values.length/3,a=n.length,l=new Array(s*3);let u;for(u=0;u<l.length;u++)l[u]=0;let h,f,_;for(u=0;u<a;u+=3){const b=n[u],T=n[u+1],x=n[u+2];h=b*3,f=T*3,_=x*3;const C=b*2,w=T*2,v=x*2,P=i[h],N=i[h+1],k=i[h+2],M=r[C],U=r[C+1],B=r[w+1]-U,S=r[v+1]-U,D=1/((r[w]-M)*S-(r[v]-M)*B),p=(S*(i[f]-P)-B*(i[_]-P))*D,I=(S*(i[f+1]-N)-B*(i[_+1]-N))*D,O=(S*(i[f+2]-k)-B*(i[_+2]-k))*D;l[h]+=p,l[h+1]+=I,l[h+2]+=O,l[f]+=p,l[f+1]+=I,l[f+2]+=O,l[_]+=p,l[_+1]+=I,l[_+2]+=O}const g=new Float32Array(s*3),m=new Float32Array(s*3);for(u=0;u<s;u++){h=u*3,f=h+1,_=h+2;const b=d.fromArray(o,h,Oie),T=d.fromArray(l,h,Lie),x=d.dot(b,T);d.multiplyByScalar(b,x,eN),d.normalize(d.subtract(T,eN,T),T),g[h]=T.x,g[f]=T.y,g[_]=T.z,d.normalize(d.cross(b,T,T),T),m[h]=T.x,m[f]=T.y,m[_]=T.z}return e.attributes.tangent=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:3,values:g}),e.attributes.bitangent=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:3,values:m}),e};const Eg=new H,$c=new d,tN=new d,nN=new d;let qb=new H;Vs.compressVertices=function(e){if(!c(e))throw new E("geometry is required.");const t=e.attributes.extrudeDirection;let n,i;if(c(t)){const N=t.values;i=N.length/3;const k=new Float32Array(i*2);let M=0;for(n=0;n<i;++n){if(d.fromArray(N,n*3,$c),d.equals($c,d.ZERO)){M+=2;continue}qb=En.octEncodeInRange($c,65535,qb),k[M++]=qb.x,k[M++]=qb.y}return e.attributes.compressedAttributes=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:2,values:k}),delete e.attributes.extrudeDirection,e}const o=e.attributes.normal,r=e.attributes.st,s=c(o),a=c(r);if(!s&&!a)return e;const l=e.attributes.tangent,u=e.attributes.bitangent,h=c(l),f=c(u);let _,g,m,b;s&&(_=o.values),a&&(g=r.values),h&&(m=l.values),f&&(b=u.values),i=(s?_.length:g.length)/(s?3:2);let C=i,w=a&&s?2:1;w+=h||f?1:0,C*=w;const v=new Float32Array(C);let P=0;for(n=0;n<i;++n){a&&(H.fromArray(g,n*2,Eg),v[P++]=En.compressTextureCoordinates(Eg));const N=n*3;s&&c(m)&&c(b)?(d.fromArray(_,N,$c),d.fromArray(m,N,tN),d.fromArray(b,N,nN),En.octPack($c,tN,nN,Eg),v[P++]=Eg.x,v[P++]=Eg.y):(s&&(d.fromArray(_,N,$c),v[P++]=En.octEncodeFloat($c)),h&&(d.fromArray(m,N,$c),v[P++]=En.octEncodeFloat($c)),f&&(d.fromArray(b,N,$c),v[P++]=En.octEncodeFloat($c)))}return e.attributes.compressedAttributes=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:w,values:v}),s&&delete e.attributes.normal,a&&delete e.attributes.st,f&&delete e.attributes.bitangent,h&&delete e.attributes.tangent,e};function Rie(e){if(c(e.indices))return e;const t=Tt.computeNumberOfVertices(e);if(t<3)throw new E("The number of vertices must be at least three.");if(t%3!==0)throw new E("The number of vertices must be a multiple of three.");const n=je.createTypedArray(t,t);for(let i=0;i<t;++i)n[i]=i;return e.indices=n,e}function Nie(e){const t=Tt.computeNumberOfVertices(e);if(t<3)throw new E("The number of vertices must be at least three.");const n=je.createTypedArray(t,(t-2)*3);n[0]=1,n[1]=0,n[2]=2;let i=3;for(let o=3;o<t;++o)n[i++]=o-1,n[i++]=0,n[i++]=o;return e.indices=n,e.primitiveType=ze.TRIANGLES,e}function Mie(e){const t=Tt.computeNumberOfVertices(e);if(t<3)throw new E("The number of vertices must be at least 3.");const n=je.createTypedArray(t,(t-2)*3);n[0]=0,n[1]=1,n[2]=2,t>3&&(n[3]=0,n[4]=2,n[5]=3);let i=6;for(let o=3;o<t-1;o+=2)n[i++]=o,n[i++]=o-1,n[i++]=o+1,o+2<t&&(n[i++]=o,n[i++]=o+1,n[i++]=o+2);return e.indices=n,e.primitiveType=ze.TRIANGLES,e}function Fie(e){if(c(e.indices))return e;const t=Tt.computeNumberOfVertices(e);if(t<2)throw new E("The number of vertices must be at least two.");if(t%2!==0)throw new E("The number of vertices must be a multiple of 2.");const n=je.createTypedArray(t,t);for(let i=0;i<t;++i)n[i]=i;return e.indices=n,e}function Bie(e){const t=Tt.computeNumberOfVertices(e);if(t<2)throw new E("The number of vertices must be at least two.");const n=je.createTypedArray(t,(t-1)*2);n[0]=0,n[1]=1;let i=2;for(let o=2;o<t;++o)n[i++]=o-1,n[i++]=o;return e.indices=n,e.primitiveType=ze.LINES,e}function zie(e){const t=Tt.computeNumberOfVertices(e);if(t<2)throw new E("The number of vertices must be at least two.");const n=je.createTypedArray(t,t*2);n[0]=0,n[1]=1;let i=2;for(let o=2;o<t;++o)n[i++]=o-1,n[i++]=o;return n[i++]=t-1,n[i]=0,e.indices=n,e.primitiveType=ze.LINES,e}function Uie(e){switch(e.primitiveType){case ze.TRIANGLE_FAN:return Nie(e);case ze.TRIANGLE_STRIP:return Mie(e);case ze.TRIANGLES:return Rie(e);case ze.LINE_STRIP:return Bie(e);case ze.LINE_LOOP:return zie(e);case ze.LINES:return Fie(e)}return e}function ih(e,t){Math.abs(e.y)<R.EPSILON6&&(t?e.y=-R.EPSILON6:e.y=R.EPSILON6)}function kie(e,t,n){if(e.y!==0&&t.y!==0&&n.y!==0){ih(e,e.y<0),ih(t,t.y<0),ih(n,n.y<0);return}const i=Math.abs(e.y),o=Math.abs(t.y),r=Math.abs(n.y);let s;i>o?i>r?s=R.sign(e.y):s=R.sign(n.y):o>r?s=R.sign(t.y):s=R.sign(n.y);const a=s<0;ih(e,a),ih(t,a),ih(n,a)}const iN=new d;function Qa(e,t,n,i){d.add(e,d.multiplyByScalar(d.subtract(t,e,iN),e.y/(e.y-t.y),iN),n),d.clone(n,i),ih(n,!0),ih(i,!1)}const df=new d,hf=new d,ff=new d,pf=new d,mw={positions:new Array(7),indices:new Array(3*3)};function Vie(e,t,n){if(e.x>=0||t.x>=0||n.x>=0)return;kie(e,t,n);const i=e.y<0,o=t.y<0,r=n.y<0;let s=0;s+=i?1:0,s+=o?1:0,s+=r?1:0;const a=mw.indices;s===1?(a[1]=3,a[2]=4,a[5]=6,a[7]=6,a[8]=5,i?(Qa(e,t,df,ff),Qa(e,n,hf,pf),a[0]=0,a[3]=1,a[4]=2,a[6]=1):o?(Qa(t,n,df,ff),Qa(t,e,hf,pf),a[0]=1,a[3]=2,a[4]=0,a[6]=2):r&&(Qa(n,e,df,ff),Qa(n,t,hf,pf),a[0]=2,a[3]=0,a[4]=1,a[6]=0)):s===2&&(a[2]=4,a[4]=4,a[5]=3,a[7]=5,a[8]=6,i?o?r||(Qa(n,e,df,ff),Qa(n,t,hf,pf),a[0]=0,a[1]=1,a[3]=0,a[6]=2):(Qa(t,n,df,ff),Qa(t,e,hf,pf),a[0]=2,a[1]=0,a[3]=2,a[6]=1):(Qa(e,t,df,ff),Qa(e,n,hf,pf),a[0]=1,a[1]=2,a[3]=1,a[6]=0));const l=mw.positions;return l[0]=e,l[1]=t,l[2]=n,l.length=3,(s===1||s===2)&&(l[3]=df,l[4]=hf,l[5]=ff,l[6]=pf,l.length=7),mw}function oN(e,t){const n=e.attributes;if(n.position.values.length===0)return;for(const o in n)if(n.hasOwnProperty(o)&&c(n[o])&&c(n[o].values)){const r=n[o];r.values=Z.createTypedArray(r.componentDatatype,r.values)}const i=Tt.computeNumberOfVertices(e);return e.indices=je.createTypedArray(i,e.indices),t&&(e.boundingSphere=se.fromVertices(n.position.values)),e}function I_(e){const t=e.attributes,n={};for(const i in t)if(t.hasOwnProperty(i)&&c(t[i])&&c(t[i].values)){const o=t[i];n[i]=new Ie({componentDatatype:o.componentDatatype,componentsPerAttribute:o.componentsPerAttribute,normalize:o.normalize,values:[]})}return new Tt({attributes:n,indices:[],primitiveType:e.primitiveType})}function tO(e,t,n){const i=c(e.geometry.boundingSphere);t=oN(t,i),n=oN(n,i),c(n)&&!c(t)?e.geometry=n:!c(n)&&c(t)?e.geometry=t:(e.westHemisphereGeometry=t,e.eastHemisphereGeometry=n,e.geometry=void 0)}function nO(e,t){const n=new e,i=new e,o=new e;return function(r,s,a,l,u,h,f,_){const g=e.fromArray(u,r*t,n),m=e.fromArray(u,s*t,i),b=e.fromArray(u,a*t,o);e.multiplyByScalar(g,l.x,g),e.multiplyByScalar(m,l.y,m),e.multiplyByScalar(b,l.z,b);const T=e.add(g,m,g);e.add(T,b,T),_&&e.normalize(T,T),e.pack(T,h,f*t)}}const Hie=nO(te,4),zA=nO(d,3),tV=nO(H,2),Gie=function(e,t,n,i,o,r,s){const a=o[e]*i.x,l=o[t]*i.y,u=o[n]*i.z;r[s]=a+l+u>R.EPSILON6?1:0},Dy=new d,vI=new d,II=new d,jie=new d;function Yb(e,t,n,i,o,r,s,a,l,u,h,f,_,g,m,b){if(!c(r)&&!c(s)&&!c(a)&&!c(l)&&!c(u)&&g===0)return;const T=d.fromArray(o,e*3,Dy),x=d.fromArray(o,t*3,vI),C=d.fromArray(o,n*3,II),w=xie(i,T,x,C,jie);if(!!c(w)){if(c(r)&&zA(e,t,n,w,r,f.normal.values,b,!0),c(u)){const v=d.fromArray(u,e*3,Dy),P=d.fromArray(u,t*3,vI),N=d.fromArray(u,n*3,II);d.multiplyByScalar(v,w.x,v),d.multiplyByScalar(P,w.y,P),d.multiplyByScalar(N,w.z,N);let k;!d.equals(v,d.ZERO)||!d.equals(P,d.ZERO)||!d.equals(N,d.ZERO)?(k=d.add(v,P,v),d.add(k,N,k),d.normalize(k,k)):(k=Dy,k.x=0,k.y=0,k.z=0),d.pack(k,f.extrudeDirection.values,b*3)}if(c(h)&&Gie(e,t,n,w,h,f.applyOffset.values,b),c(s)&&zA(e,t,n,w,s,f.tangent.values,b,!0),c(a)&&zA(e,t,n,w,a,f.bitangent.values,b,!0),c(l)&&tV(e,t,n,w,l,f.st.values,b),g>0)for(let v=0;v<g;v++){const P=_[v];Wie(e,t,n,w,b,m[P],f[P])}}}function Wie(e,t,n,i,o,r,s){const a=r.componentsPerAttribute,l=r.values,u=s.values;switch(a){case 4:Hie(e,t,n,i,l,u,o,!1);break;case 3:zA(e,t,n,i,l,u,o,!1);break;case 2:tV(e,t,n,i,l,u,o,!1);break;default:u[o]=l[e]*i.x+l[t]*i.y+l[n]*i.z}}function $l(e,t,n,i,o,r){const s=e.position.values.length/3;if(o!==-1){const a=i[o],l=n[a];return l===-1?(n[a]=s,e.position.values.push(r.x,r.y,r.z),t.push(s),s):(t.push(l),l)}return e.position.values.push(r.x,r.y,r.z),t.push(s),s}const qie={position:!0,normal:!0,bitangent:!0,tangent:!0,st:!0,extrudeDirection:!0,applyOffset:!0};function rN(e){const t=e.geometry,n=t.attributes,i=n.position.values,o=c(n.normal)?n.normal.values:void 0,r=c(n.bitangent)?n.bitangent.values:void 0,s=c(n.tangent)?n.tangent.values:void 0,a=c(n.st)?n.st.values:void 0,l=c(n.extrudeDirection)?n.extrudeDirection.values:void 0,u=c(n.applyOffset)?n.applyOffset.values:void 0,h=t.indices,f=[];for(const k in n)n.hasOwnProperty(k)&&!qie[k]&&c(n[k])&&f.push(k);const _=f.length,g=I_(t),m=I_(t);let b,T,x,C,w;const v=[];v.length=i.length/3;const P=[];for(P.length=i.length/3,w=0;w<v.length;++w)v[w]=-1,P[w]=-1;const N=h.length;for(w=0;w<N;w+=3){const k=h[w],M=h[w+1],U=h[w+2];let B=d.fromArray(i,k*3),S=d.fromArray(i,M*3),D=d.fromArray(i,U*3);const p=Vie(B,S,D);if(c(p)&&p.positions.length>3){const I=p.positions,O=p.indices,F=O.length;for(let V=0;V<F;++V){const G=O[V],j=I[G];j.y<0?(b=m.attributes,T=m.indices,x=v):(b=g.attributes,T=g.indices,x=P),C=$l(b,T,x,h,G<3?w+G:-1,j),Yb(k,M,U,j,i,o,s,r,a,l,u,b,f,_,n,C)}}else c(p)&&(B=p.positions[0],S=p.positions[1],D=p.positions[2]),B.y<0?(b=m.attributes,T=m.indices,x=v):(b=g.attributes,T=g.indices,x=P),C=$l(b,T,x,h,w,B),Yb(k,M,U,B,i,o,s,r,a,l,u,b,f,_,n,C),C=$l(b,T,x,h,w+1,S),Yb(k,M,U,S,i,o,s,r,a,l,u,b,f,_,n,C),C=$l(b,T,x,h,w+2,D),Yb(k,M,U,D,i,o,s,r,a,l,u,b,f,_,n,C)}tO(e,m,g)}const nV=_t.fromPointNormal(d.ZERO,d.UNIT_Y),Yie=new d,$ie=new d;function um(e,t,n,i,o,r,s){if(!c(s))return;const a=d.fromArray(i,e*3,Dy);d.equalsEpsilon(a,n,R.EPSILON10)?r.applyOffset.values[o]=s[e]:r.applyOffset.values[o]=s[t]}function sN(e){const t=e.geometry,n=t.attributes,i=n.position.values,o=c(n.applyOffset)?n.applyOffset.values:void 0,r=t.indices,s=I_(t),a=I_(t);let l;const u=r.length,h=[];h.length=i.length/3;const f=[];for(f.length=i.length/3,l=0;l<h.length;++l)h[l]=-1,f[l]=-1;for(l=0;l<u;l+=2){const _=r[l],g=r[l+1],m=d.fromArray(i,_*3,Dy),b=d.fromArray(i,g*3,vI);let T;Math.abs(m.y)<R.EPSILON6&&(m.y<0?m.y=-R.EPSILON6:m.y=R.EPSILON6),Math.abs(b.y)<R.EPSILON6&&(b.y<0?b.y=-R.EPSILON6:b.y=R.EPSILON6);let x=s.attributes,C=s.indices,w=f,v=a.attributes,P=a.indices,N=h;const k=Ei.lineSegmentPlane(m,b,nV,II);if(c(k)){const M=d.multiplyByScalar(d.UNIT_Y,5*R.EPSILON9,Yie);m.y<0&&(d.negate(M,M),x=a.attributes,C=a.indices,w=h,v=s.attributes,P=s.indices,N=f);const U=d.add(k,M,$ie);T=$l(x,C,w,r,l,m),um(_,g,m,i,T,x,o),T=$l(x,C,w,r,-1,U),um(_,g,U,i,T,x,o),d.negate(M,M),d.add(k,M,U),T=$l(v,P,N,r,-1,U),um(_,g,U,i,T,v,o),T=$l(v,P,N,r,l+1,b),um(_,g,b,i,T,v,o)}else{let M,U,B;m.y<0?(M=a.attributes,U=a.indices,B=h):(M=s.attributes,U=s.indices,B=f),T=$l(M,U,B,r,l,m),um(_,g,m,i,T,M,o),T=$l(M,U,B,r,l+1,b),um(_,g,b,i,T,M,o)}}tO(e,a,s)}const aN=new H,Xie=new H,iV=new d,oV=new d,DI=new d,Qie=new d,Kie=new d,Zie=new d,cN=new te;function lN(e){const t=e.attributes,n=t.position.values,i=t.prevPosition.values,o=t.nextPosition.values,r=n.length;for(let s=0;s<r;s+=3){const a=d.unpack(n,s,iV);if(a.x>0)continue;const l=d.unpack(i,s,oV);(a.y<0&&l.y>0||a.y>0&&l.y<0)&&(s-3>0?(i[s]=n[s-3],i[s+1]=n[s-2],i[s+2]=n[s-1]):d.pack(a,i,s));const u=d.unpack(o,s,DI);(a.y<0&&u.y>0||a.y>0&&u.y<0)&&(s+3<r?(o[s]=n[s+3],o[s+1]=n[s+4],o[s+2]=n[s+5]):d.pack(a,o,s))}}const Jie=5*R.EPSILON9,$b=R.EPSILON6;function eoe(e){const t=e.geometry,n=t.attributes,i=n.position.values,o=n.prevPosition.values,r=n.nextPosition.values,s=n.expandAndWidth.values,a=c(n.st)?n.st.values:void 0,l=c(n.color)?n.color.values:void 0,u=I_(t),h=I_(t);let f,_,g,m=!1;const b=i.length/3;for(f=0;f<b;f+=4){const T=f,x=f+2,C=d.fromArray(i,T*3,iV),w=d.fromArray(i,x*3,oV);if(Math.abs(C.y)<$b)for(C.y=$b*(w.y<0?-1:1),i[f*3+1]=C.y,i[(f+1)*3+1]=C.y,_=T*3;_<T*3+4*3;_+=3)o[_]=i[f*3],o[_+1]=i[f*3+1],o[_+2]=i[f*3+2];if(Math.abs(w.y)<$b)for(w.y=$b*(C.y<0?-1:1),i[(f+2)*3+1]=w.y,i[(f+3)*3+1]=w.y,_=T*3;_<T*3+4*3;_+=3)r[_]=i[(f+2)*3],r[_+1]=i[(f+2)*3+1],r[_+2]=i[(f+2)*3+2];let v=u.attributes,P=u.indices,N=h.attributes,k=h.indices;const M=Ei.lineSegmentPlane(C,w,nV,Qie);if(c(M)){m=!0;const U=d.multiplyByScalar(d.UNIT_Y,Jie,Kie);C.y<0&&(d.negate(U,U),v=h.attributes,P=h.indices,N=u.attributes,k=u.indices);const B=d.add(M,U,Zie);v.position.values.push(C.x,C.y,C.z,C.x,C.y,C.z),v.position.values.push(B.x,B.y,B.z),v.position.values.push(B.x,B.y,B.z),v.prevPosition.values.push(o[T*3],o[T*3+1],o[T*3+2]),v.prevPosition.values.push(o[T*3+3],o[T*3+4],o[T*3+5]),v.prevPosition.values.push(C.x,C.y,C.z,C.x,C.y,C.z),v.nextPosition.values.push(B.x,B.y,B.z),v.nextPosition.values.push(B.x,B.y,B.z),v.nextPosition.values.push(B.x,B.y,B.z),v.nextPosition.values.push(B.x,B.y,B.z),d.negate(U,U),d.add(M,U,B),N.position.values.push(B.x,B.y,B.z),N.position.values.push(B.x,B.y,B.z),N.position.values.push(w.x,w.y,w.z,w.x,w.y,w.z),N.prevPosition.values.push(B.x,B.y,B.z),N.prevPosition.values.push(B.x,B.y,B.z),N.prevPosition.values.push(B.x,B.y,B.z),N.prevPosition.values.push(B.x,B.y,B.z),N.nextPosition.values.push(w.x,w.y,w.z,w.x,w.y,w.z),N.nextPosition.values.push(r[x*3],r[x*3+1],r[x*3+2]),N.nextPosition.values.push(r[x*3+3],r[x*3+4],r[x*3+5]);const S=H.fromArray(s,T*2,aN),D=Math.abs(S.y);v.expandAndWidth.values.push(-1,D,1,D),v.expandAndWidth.values.push(-1,-D,1,-D),N.expandAndWidth.values.push(-1,D,1,D),N.expandAndWidth.values.push(-1,-D,1,-D);let p=d.magnitudeSquared(d.subtract(M,C,DI));if(p/=d.magnitudeSquared(d.subtract(w,C,DI)),c(l)){const I=te.fromArray(l,T*4,cN),O=te.fromArray(l,x*4,cN),F=R.lerp(I.x,O.x,p),V=R.lerp(I.y,O.y,p),G=R.lerp(I.z,O.z,p),j=R.lerp(I.w,O.w,p);for(_=T*4;_<T*4+2*4;++_)v.color.values.push(l[_]);for(v.color.values.push(F,V,G,j),v.color.values.push(F,V,G,j),N.color.values.push(F,V,G,j),N.color.values.push(F,V,G,j),_=x*4;_<x*4+2*4;++_)N.color.values.push(l[_])}if(c(a)){const I=H.fromArray(a,T*2,aN),O=H.fromArray(a,(f+3)*2,Xie),F=R.lerp(I.x,O.x,p);for(_=T*2;_<T*2+2*2;++_)v.st.values.push(a[_]);for(v.st.values.push(F,I.y),v.st.values.push(F,O.y),N.st.values.push(F,I.y),N.st.values.push(F,O.y),_=x*2;_<x*2+2*2;++_)N.st.values.push(a[_])}g=v.position.values.length/3-4,P.push(g,g+2,g+1),P.push(g+1,g+2,g+3),g=N.position.values.length/3-4,k.push(g,g+2,g+1),k.push(g+1,g+2,g+3)}else{let U,B;for(C.y<0?(U=h.attributes,B=h.indices):(U=u.attributes,B=u.indices),U.position.values.push(C.x,C.y,C.z),U.position.values.push(C.x,C.y,C.z),U.position.values.push(w.x,w.y,w.z),U.position.values.push(w.x,w.y,w.z),_=f*3;_<f*3+4*3;++_)U.prevPosition.values.push(o[_]),U.nextPosition.values.push(r[_]);for(_=f*2;_<f*2+4*2;++_)U.expandAndWidth.values.push(s[_]),c(a)&&U.st.values.push(a[_]);if(c(l))for(_=f*4;_<f*4+4*4;++_)U.color.values.push(l[_]);g=U.position.values.length/3-4,B.push(g,g+2,g+1),B.push(g+1,g+2,g+3)}}m&&(lN(h),lN(u)),tO(e,h,u)}Vs.splitLongitude=function(e){if(!c(e))throw new E("instance is required.");const t=e.geometry,n=t.boundingSphere;if(c(n)&&(n.center.x-n.radius>0||se.intersectPlane(n,_t.ORIGIN_ZX_PLANE)!==Bt.INTERSECTING))return e;if(t.geometryType!==Wm.NONE)switch(t.geometryType){case Wm.POLYLINES:eoe(e);break;case Wm.TRIANGLES:rN(e);break;case Wm.LINES:sN(e);break}else Uie(t),t.primitiveType===ze.TRIANGLES?rN(e):t.primitiveType===ze.LINES&&sN(e);return e};const ti=Vs;function vn(e){this._ellipsoid=y(e,ae.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis}Object.defineProperties(vn.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}});vn.mercatorAngleToGeodeticLatitude=function(e){return R.PI_OVER_TWO-2*Math.atan(Math.exp(-e))};vn.geodeticLatitudeToMercatorAngle=function(e){e>vn.MaximumLatitude?e=vn.MaximumLatitude:e<-vn.MaximumLatitude&&(e=-vn.MaximumLatitude);const t=Math.sin(e);return .5*Math.log((1+t)/(1-t))};vn.MaximumLatitude=vn.mercatorAngleToGeodeticLatitude(Math.PI);vn.prototype.project=function(e,t){const n=this._semimajorAxis,i=e.longitude*n,o=vn.geodeticLatitudeToMercatorAngle(e.latitude)*n,r=e.height;return c(t)?(t.x=i,t.y=o,t.z=r,t):new d(i,o,r)};vn.prototype.unproject=function(e,t){if(!c(e))throw new E("cartesian is required");const n=this._oneOverSemimajorAxis,i=e.x*n,o=vn.mercatorAngleToGeodeticLatitude(e.y*n),r=e.z;return c(t)?(t.longitude=i,t.latitude=o,t.height=r,t):new he(i,o,r)};function toe(e,t,n){let i=!n;const o=e.length;let r;if(!i&&o>1){const s=e[0].modelMatrix;for(r=1;r<o;++r)if(!L.equals(s,e[r].modelMatrix)){i=!0;break}}if(i)for(r=0;r<o;++r)c(e[r].geometry)&&ti.transformToWorldCoordinates(e[r]);else L.multiplyTransformation(t,e[0].modelMatrix,t)}function _w(e,t){const n=e.attributes,i=n.position,o=i.values.length/i.componentsPerAttribute;n.batchId=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:1,values:new Float32Array(o)});const r=n.batchId.values;for(let s=0;s<o;++s)r[s]=t}function noe(e){const t=e.length;for(let n=0;n<t;++n){const i=e[n];c(i.geometry)?_w(i.geometry,n):c(i.westHemisphereGeometry)&&c(i.eastHemisphereGeometry)&&(_w(i.westHemisphereGeometry,n),_w(i.eastHemisphereGeometry,n))}}function ioe(e){const t=e.instances,n=e.projection,i=e.elementIndexUintSupported,o=e.scene3DOnly,r=e.vertexCacheOptimize,s=e.compressVertices,a=e.modelMatrix;let l,u,h,f=t.length;for(l=0;l<f;++l)if(c(t[l].geometry)){h=t[l].geometry.primitiveType;break}for(l=1;l<f;++l)if(c(t[l].geometry)&&t[l].geometry.primitiveType!==h)throw new E("All instance geometries must have the same primitiveType.");if(toe(t,a,o),!o)for(l=0;l<f;++l)c(t[l].geometry)&&ti.splitLongitude(t[l]);if(noe(t),r)for(l=0;l<f;++l){const g=t[l];c(g.geometry)?(ti.reorderForPostVertexCache(g.geometry),ti.reorderForPreVertexCache(g.geometry)):c(g.westHemisphereGeometry)&&c(g.eastHemisphereGeometry)&&(ti.reorderForPostVertexCache(g.westHemisphereGeometry),ti.reorderForPreVertexCache(g.westHemisphereGeometry),ti.reorderForPostVertexCache(g.eastHemisphereGeometry),ti.reorderForPreVertexCache(g.eastHemisphereGeometry))}let _=ti.combineInstances(t);for(f=_.length,l=0;l<f;++l){u=_[l];const g=u.attributes;if(o)for(const m in g)g.hasOwnProperty(m)&&g[m].componentDatatype===Z.DOUBLE&&ti.encodeAttribute(u,m,`${m}3DHigh`,`${m}3DLow`);else for(const m in g)if(g.hasOwnProperty(m)&&g[m].componentDatatype===Z.DOUBLE){const b=`${m}3D`,T=`${m}2D`;ti.projectTo2D(u,m,b,T,n),c(u.boundingSphere)&&m==="position"&&(u.boundingSphereCV=se.fromVertices(u.attributes.position2D.values)),ti.encodeAttribute(u,b,`${b}High`,`${b}Low`),ti.encodeAttribute(u,T,`${T}High`,`${T}Low`)}s&&ti.compressVertices(u)}if(!i){let g=[];for(f=_.length,l=0;l<f;++l)u=_[l],g=g.concat(ti.fitToUnsignedShortIndices(u));_=g}return _}function gw(e,t,n,i){let o,r,s;const a=i.length-1;if(a>=0){const u=i[a];o=u.offset+u.count,s=u.index,r=n[s].indices.length}else o=0,s=0,r=n[s].indices.length;const l=e.length;for(let u=0;u<l;++u){const f=e[u][t];if(!c(f))continue;const _=f.indices.length;o+_>r&&(o=0,r=n[++s].indices.length),i.push({index:s,offset:o,count:_}),o+=_}}function ooe(e,t){const n=[];return gw(e,"geometry",t,n),gw(e,"westHemisphereGeometry",t,n),gw(e,"eastHemisphereGeometry",t,n),n}const ld={};ld.combineGeometry=function(e){let t,n;const i=e.instances,o=i.length;let r,s,a=!1;o>0&&(t=ioe(e),t.length>0&&(n=ti.createAttributeLocations(t[0]),e.createPickOffsets&&(r=ooe(i,t))),c(i[0].attributes)&&c(i[0].attributes.offset)&&(s=new Array(o),a=!0));const l=new Array(o),u=new Array(o);for(let h=0;h<o;++h){const f=i[h],_=f.geometry;c(_)&&(l[h]=_.boundingSphere,u[h]=_.boundingSphereCV,a&&(s[h]=f.geometry.offsetAttribute));const g=f.eastHemisphereGeometry,m=f.westHemisphereGeometry;c(g)&&c(m)&&(c(g.boundingSphere)&&c(m.boundingSphere)&&(l[h]=se.union(g.boundingSphere,m.boundingSphere)),c(g.boundingSphereCV)&&c(m.boundingSphereCV)&&(u[h]=se.union(g.boundingSphereCV,m.boundingSphereCV)))}return{geometries:t,modelMatrix:e.modelMatrix,attributeLocations:n,pickOffsets:r,offsetInstanceExtend:s,boundingSpheres:l,boundingSpheresCV:u}};function roe(e,t){const n=e.attributes;for(const i in n)if(n.hasOwnProperty(i)){const o=n[i];c(o)&&c(o.values)&&t.push(o.values.buffer)}c(e.indices)&&t.push(e.indices.buffer)}function soe(e,t){const n=e.length;for(let i=0;i<n;++i)roe(e[i],t)}function aoe(e){let t=1;const n=e.length;for(let i=0;i<n;i++){const o=e[i];if(++t,!c(o))continue;const r=o.attributes;t+=7+2*se.packedLength+(c(o.indices)?o.indices.length:0);for(const s in r)if(r.hasOwnProperty(s)&&c(r[s])){const a=r[s];t+=5+a.values.length}}return t}ld.packCreateGeometryResults=function(e,t){const n=new Float64Array(aoe(e)),i=[],o={},r=e.length;let s=0;n[s++]=r;for(let a=0;a<r;a++){const l=e[a],u=c(l);if(n[s++]=u?1:0,!u)continue;n[s++]=l.primitiveType,n[s++]=l.geometryType,n[s++]=y(l.offsetAttribute,-1);const h=c(l.boundingSphere)?1:0;n[s++]=h,h&&se.pack(l.boundingSphere,n,s),s+=se.packedLength;const f=c(l.boundingSphereCV)?1:0;n[s++]=f,f&&se.pack(l.boundingSphereCV,n,s),s+=se.packedLength;const _=l.attributes,g=[];for(const b in _)_.hasOwnProperty(b)&&c(_[b])&&(g.push(b),c(o[b])||(o[b]=i.length,i.push(b)));n[s++]=g.length;for(let b=0;b<g.length;b++){const T=g[b],x=_[T];n[s++]=o[T],n[s++]=x.componentDatatype,n[s++]=x.componentsPerAttribute,n[s++]=x.normalize?1:0,n[s++]=x.values.length,n.set(x.values,s),s+=x.values.length}const m=c(l.indices)?l.indices.length:0;n[s++]=m,m>0&&(n.set(l.indices,s),s+=m)}return t.push(n.buffer),{stringTable:i,packedData:n}};ld.unpackCreateGeometryResults=function(e){const t=e.stringTable,n=e.packedData;let i;const o=new Array(n[0]);let r=0,s=1;for(;s<n.length;){if(!(n[s++]===1)){o[r++]=void 0;continue}const l=n[s++],u=n[s++];let h=n[s++];h===-1&&(h=void 0);let f,_;n[s++]===1&&(f=se.unpack(n,s)),s+=se.packedLength,n[s++]===1&&(_=se.unpack(n,s)),s+=se.packedLength;let b,T,x;const C=new oi,w=n[s++];for(i=0;i<w;i++){const P=t[n[s++]],N=n[s++];x=n[s++];const k=n[s++]!==0;b=n[s++],T=Z.createTypedArray(N,b);for(let M=0;M<b;M++)T[M]=n[s++];C[P]=new Ie({componentDatatype:N,componentsPerAttribute:x,normalize:k,values:T})}let v;if(b=n[s++],b>0){const P=T.length/x;for(v=je.createTypedArray(P,b),i=0;i<b;i++)v[i]=n[s++]}o[r++]=new Tt({primitiveType:l,geometryType:u,boundingSphere:f,boundingSphereCV:_,indices:v,attributes:C,offsetAttribute:h})}return o};function coe(e,t){const n=e.length,i=new Float64Array(1+n*19);let o=0;i[o++]=n;for(let r=0;r<n;r++){const s=e[r];if(L.pack(s.modelMatrix,i,o),o+=L.packedLength,c(s.attributes)&&c(s.attributes.offset)){const a=s.attributes.offset.value;i[o]=a[0],i[o+1]=a[1],i[o+2]=a[2]}o+=3}return t.push(i.buffer),i}function loe(e){const t=e,n=new Array(t[0]);let i=0,o=1;for(;o<t.length;){const r=L.unpack(t,o);let s;o+=L.packedLength,c(t[o])&&(s={offset:new Zi(t[o],t[o+1],t[o+2])}),o+=3,n[i++]={modelMatrix:r,attributes:s}}return n}ld.packCombineGeometryParameters=function(e,t){const n=e.createGeometryResults,i=n.length;for(let o=0;o<i;o++)t.push(n[o].packedData.buffer);return{createGeometryResults:e.createGeometryResults,packedInstances:coe(e.instances,t),ellipsoid:e.ellipsoid,isGeographic:e.projection instanceof co,elementIndexUintSupported:e.elementIndexUintSupported,scene3DOnly:e.scene3DOnly,vertexCacheOptimize:e.vertexCacheOptimize,compressVertices:e.compressVertices,modelMatrix:e.modelMatrix,createPickOffsets:e.createPickOffsets}};ld.unpackCombineGeometryParameters=function(e){const t=loe(e.packedInstances),n=e.createGeometryResults,i=n.length;let o=0;for(let a=0;a<i;a++){const l=ld.unpackCreateGeometryResults(n[a]),u=l.length;for(let h=0;h<u;h++){const f=l[h],_=t[o];_.geometry=f,++o}}const r=ae.clone(e.ellipsoid),s=e.isGeographic?new co(r):new vn(r);return{instances:t,ellipsoid:r,projection:s,elementIndexUintSupported:e.elementIndexUintSupported,scene3DOnly:e.scene3DOnly,vertexCacheOptimize:e.vertexCacheOptimize,compressVertices:e.compressVertices,modelMatrix:L.clone(e.modelMatrix),createPickOffsets:e.createPickOffsets}};function uN(e){const t=e.length,n=1+(se.packedLength+1)*t,i=new Float32Array(n);let o=0;i[o++]=t;for(let r=0;r<t;++r){const s=e[r];c(s)?(i[o++]=1,se.pack(e[r],i,o)):i[o++]=0,o+=se.packedLength}return i}function dN(e){const t=new Array(e[0]);let n=0,i=1;for(;i<e.length;)e[i++]===1&&(t[n]=se.unpack(e,i)),++n,i+=se.packedLength;return t}ld.packCombineGeometryResults=function(e,t){c(e.geometries)&&soe(e.geometries,t);const n=uN(e.boundingSpheres),i=uN(e.boundingSpheresCV);return t.push(n.buffer,i.buffer),{geometries:e.geometries,attributeLocations:e.attributeLocations,modelMatrix:e.modelMatrix,pickOffsets:e.pickOffsets,offsetInstanceExtend:e.offsetInstanceExtend,boundingSpheres:n,boundingSpheresCV:i}};ld.unpackCombineGeometryResults=function(e){return{geometries:e.geometries,attributeLocations:e.attributeLocations,modelMatrix:e.modelMatrix,pickOffsets:e.pickOffsets,offsetInstanceExtend:e.offsetInstanceExtend,boundingSpheres:dN(e.boundingSpheres),boundingSpheresCV:dN(e.boundingSpheresCV)}};const PI=ld,uoe={READY:0,CREATING:1,CREATED:2,COMBINING:3,COMBINED:4,COMPLETE:5,FAILED:6},Uo=Object.freeze(uoe),ba={DISABLED:0,ENABLED:1,CAST_ONLY:2,RECEIVE_ONLY:3};ba.NUMBER_OF_SHADOW_MODES=4;ba.castShadows=function(e){return e===ba.ENABLED||e===ba.CAST_ONLY};ba.receiveShadows=function(e){return e===ba.ENABLED||e===ba.RECEIVE_ONLY};ba.fromCastReceive=function(e,t){return e&&t?ba.ENABLED:e?ba.CAST_ONLY:t?ba.RECEIVE_ONLY:ba.DISABLED};const Vi=Object.freeze(ba);function Mt(e){if(e=y(e,y.EMPTY_OBJECT),this.geometryInstances=e.geometryInstances,this.appearance=e.appearance,this._appearance=void 0,this._material=void 0,this.depthFailAppearance=e.depthFailAppearance,this._depthFailAppearance=void 0,this._depthFailMaterial=void 0,this.modelMatrix=L.clone(y(e.modelMatrix,L.IDENTITY)),this._modelMatrix=new L,this.show=y(e.show,!0),this._vertexCacheOptimize=y(e.vertexCacheOptimize,!1),this._interleave=y(e.interleave,!1),this._releaseGeometryInstances=y(e.releaseGeometryInstances,!0),this._allowPicking=y(e.allowPicking,!0),this._asynchronous=y(e.asynchronous,!0),this._compressVertices=y(e.compressVertices,!0),this.cull=y(e.cull,!0),this.debugShowBoundingVolume=y(e.debugShowBoundingVolume,!1),this.rtcCenter=e.rtcCenter,c(this.rtcCenter)&&(!c(this.geometryInstances)||Array.isArray(this.geometryInstances)&&this.geometryInstances.length!==1))throw new E("Relative-to-center rendering only supports one geometry instance.");this.shadows=y(e.shadows,Vi.DISABLED),this._translucent=void 0,this._state=Uo.READY,this._geometries=[],this._error=void 0,this._numberOfInstances=0,this._boundingSpheres=[],this._boundingSphereWC=[],this._boundingSphereCV=[],this._boundingSphere2D=[],this._boundingSphereMorph=[],this._perInstanceAttributeCache=new Map,this._instanceIds=[],this._lastPerInstanceAttributeIndex=0,this._va=[],this._attributeLocations=void 0,this._primitiveType=void 0,this._frontFaceRS=void 0,this._backFaceRS=void 0,this._sp=void 0,this._depthFailAppearance=void 0,this._spDepthFail=void 0,this._frontFaceDepthFailRS=void 0,this._backFaceDepthFailRS=void 0,this._pickIds=[],this._colorCommands=[],this._pickCommands=[],this._createBoundingVolumeFunction=e._createBoundingVolumeFunction,this._createRenderStatesFunction=e._createRenderStatesFunction,this._createShaderProgramFunction=e._createShaderProgramFunction,this._createCommandsFunction=e._createCommandsFunction,this._updateAndQueueCommandsFunction=e._updateAndQueueCommandsFunction,this._createPickOffsets=e._createPickOffsets,this._pickOffsets=void 0,this._createGeometryResults=void 0,this._ready=!1,this._batchTable=void 0,this._batchTableAttributeIndices=void 0,this._offsetInstanceExtend=void 0,this._batchTableOffsetAttribute2DIndex=void 0,this._batchTableOffsetsUpdated=!1,this._instanceBoundingSpheres=void 0,this._instanceBoundingSpheresCV=void 0,this._tempBoundingSpheres=void 0,this._recomputeBoundingSpheres=!1,this._batchTableBoundingSpheresUpdated=!1,this._batchTableBoundingSphereAttributeIndices=void 0}Object.defineProperties(Mt.prototype,{vertexCacheOptimize:{get:function(){return this._vertexCacheOptimize}},interleave:{get:function(){return this._interleave}},releaseGeometryInstances:{get:function(){return this._releaseGeometryInstances}},allowPicking:{get:function(){return this._allowPicking}},asynchronous:{get:function(){return this._asynchronous}},compressVertices:{get:function(){return this._compressVertices}},ready:{get:function(){return this._ready}}});function doe(e){const t=e.length,n=[],i=e[0].attributes;let o;for(o in i)if(i.hasOwnProperty(o)&&c(i[o])){const r=i[o];let s=!0;for(let a=1;a<t;++a){const l=e[a].attributes[o];if(!c(l)||r.componentDatatype!==l.componentDatatype||r.componentsPerAttribute!==l.componentsPerAttribute||r.normalize!==l.normalize){s=!1;break}}s&&n.push(o)}return n}const hoe=new H,foe=new d,rV=new te;function sV(e){const t=e.length;if(t===1)return e[0];if(t===2)return H.unpack(e,0,hoe);if(t===3)return d.unpack(e,0,foe);if(t===4)return te.unpack(e,0,rV)}function poe(e,t){const n=e.geometryInstances,i=Array.isArray(n)?n:[n],o=i.length;if(o===0)return;const r=doe(i),s=r.length,a=[],l={},u={};let h,_=i[0].attributes,g,m,b;for(g=0;g<s;++g)m=r[g],b=_[m],l[m]=g,a.push({functionName:`czm_batchTable_${m}`,componentDatatype:b.componentDatatype,componentsPerAttribute:b.componentsPerAttribute,normalize:b.normalize});r.indexOf("distanceDisplayCondition")!==-1&&(a.push({functionName:"czm_batchTable_boundingSphereCenter3DHigh",componentDatatype:Z.FLOAT,componentsPerAttribute:3},{functionName:"czm_batchTable_boundingSphereCenter3DLow",componentDatatype:Z.FLOAT,componentsPerAttribute:3},{functionName:"czm_batchTable_boundingSphereCenter2DHigh",componentDatatype:Z.FLOAT,componentsPerAttribute:3},{functionName:"czm_batchTable_boundingSphereCenter2DLow",componentDatatype:Z.FLOAT,componentsPerAttribute:3},{functionName:"czm_batchTable_boundingSphereRadius",componentDatatype:Z.FLOAT,componentsPerAttribute:1}),u.center3DHigh=a.length-5,u.center3DLow=a.length-4,u.center2DHigh=a.length-3,u.center2DLow=a.length-2,u.radius=a.length-1),r.indexOf("offset")!==-1&&(a.push({functionName:"czm_batchTable_offset2D",componentDatatype:Z.FLOAT,componentsPerAttribute:3}),h=a.length-1),a.push({functionName:"czm_batchTable_pickColor",componentDatatype:Z.UNSIGNED_BYTE,componentsPerAttribute:4,normalize:!0});const T=a.length,x=new uu(t,a,o);for(g=0;g<o;++g){const C=i[g];_=C.attributes;for(let k=0;k<s;++k){m=r[k],b=_[m];const M=sV(b.value),U=l[m];x.setBatchedAttribute(g,U,M)}const w={primitive:y(C.pickPrimitive,e)};c(C.id)&&(w.id=C.id);const v=t.createPickId(w);e._pickIds.push(v);const P=v.color,N=rV;N.x=z.floatToByte(P.red),N.y=z.floatToByte(P.green),N.z=z.floatToByte(P.blue),N.w=z.floatToByte(P.alpha),x.setBatchedAttribute(g,T-1,N)}e._batchTable=x,e._batchTableAttributeIndices=l,e._batchTableBoundingSphereAttributeIndices=u,e._batchTableOffsetAttribute2DIndex=h}function moe(e){let t;return Array.isArray(e.values)?t=e.values.slice(0):t=new e.values.constructor(e.values),new Ie({componentDatatype:e.componentDatatype,componentsPerAttribute:e.componentsPerAttribute,normalize:e.normalize,values:t})}function _oe(e){const t=e.attributes,n=new oi;for(const o in t)t.hasOwnProperty(o)&&c(t[o])&&(n[o]=moe(t[o]));let i;if(c(e.indices)){const o=e.indices;Array.isArray(o)?i=o.slice(0):i=new o.constructor(o)}return new Tt({attributes:n,indices:i,primitiveType:e.primitiveType,boundingSphere:se.clone(e.boundingSphere)})}function goe(e,t){return{geometry:t,attributes:e.attributes,modelMatrix:L.clone(e.modelMatrix),pickPrimitive:e.pickPrimitive,id:e.id}}const yoe=/in\s+vec(?:3|4)\s+(.*)3DHigh;/g;Mt._modifyShaderPosition=function(e,t,n){let i,o="",r="",s="";for(;(i=yoe.exec(t))!==null;){const a=i[1],l=`vec4 czm_compute${a[0].toUpperCase()}${a.substr(1)}()`;l!=="vec4 czm_computePosition()"&&(o+=`${l};
|
|
`),c(e.rtcCenter)?(t=t.replace(/in\s+vec(?:3|4)\s+position3DHigh;/g,""),t=t.replace(/in\s+vec(?:3|4)\s+position3DLow;/g,""),o+=`uniform mat4 u_modifiedModelView;
|
|
`,r+=`in vec4 position;
|
|
`,s+=`${l}
|
|
{
|
|
return u_modifiedModelView * position;
|
|
}
|
|
|
|
`,t=t.replace(/czm_modelViewRelativeToEye\s+\*\s+/g,""),t=t.replace(/czm_modelViewProjectionRelativeToEye/g,"czm_projection")):n?s+=`${l}
|
|
{
|
|
return czm_translateRelativeToEye(${a}3DHigh, ${a}3DLow);
|
|
}
|
|
|
|
`:(r+=`in vec3 ${a}2DHigh;
|
|
in vec3 ${a}2DLow;
|
|
`,s+=`${l}
|
|
{
|
|
vec4 p;
|
|
if (czm_morphTime == 1.0)
|
|
{
|
|
p = czm_translateRelativeToEye(${a}3DHigh, ${a}3DLow);
|
|
}
|
|
else if (czm_morphTime == 0.0)
|
|
{
|
|
p = czm_translateRelativeToEye(${a}2DHigh.zxy, ${a}2DLow.zxy);
|
|
}
|
|
else
|
|
{
|
|
p = czm_columbusViewMorph(
|
|
czm_translateRelativeToEye(${a}2DHigh.zxy, ${a}2DLow.zxy),
|
|
czm_translateRelativeToEye(${a}3DHigh, ${a}3DLow),
|
|
czm_morphTime);
|
|
}
|
|
return p;
|
|
}
|
|
|
|
`)}return[o,r,t,s].join(`
|
|
`)};Mt._appendShowToShader=function(e,t){return c(e._batchTableAttributeIndices.show)?`${Oe.replaceMain(t,"czm_non_show_main")}
|
|
void main()
|
|
{
|
|
czm_non_show_main();
|
|
gl_Position *= czm_batchTable_show(batchId);
|
|
}`:t};Mt._updateColorAttribute=function(e,t,n){if(!c(e._batchTableAttributeIndices.color)&&!c(e._batchTableAttributeIndices.depthFailColor)||t.search(/in\s+vec4\s+color;/g)===-1)return t;if(n&&!c(e._batchTableAttributeIndices.depthFailColor))throw new E("A depthFailColor per-instance attribute is required when using a depth fail appearance that uses a color attribute.");let i=t;return i=i.replace(/in\s+vec4\s+color;/g,""),n?i=i.replace(/(\b)color(\b)/g,"$1czm_batchTable_depthFailColor(batchId)$2"):i=i.replace(/(\b)color(\b)/g,"$1czm_batchTable_color(batchId)$2"),i};function hN(e){return`${Oe.replaceMain(e,"czm_non_pick_main")}
|
|
out vec4 v_pickColor;
|
|
void main()
|
|
{
|
|
czm_non_pick_main();
|
|
v_pickColor = czm_batchTable_pickColor(batchId);
|
|
}`}function fN(e){return`in vec4 v_pickColor;
|
|
${e}`}Mt._updatePickColorAttribute=function(e){let t=e.replace(/in\s+vec4\s+pickColor;/g,"");return t=t.replace(/(\b)pickColor(\b)/g,"$1czm_batchTable_pickColor(batchId)$2"),t};Mt._appendOffsetToShader=function(e,t){if(!c(e._batchTableAttributeIndices.offset))return t;let n=`in float batchId;
|
|
`;n+="in float applyOffset;";let i=t.replace(/in\s+float\s+batchId;/g,n),o=`vec4 $1 = czm_computePosition();
|
|
`;return o+=` if (czm_sceneMode == czm_sceneMode3D)
|
|
`,o+=` {
|
|
`,o+=" $1 = $1 + vec4(czm_batchTable_offset(batchId) * applyOffset, 0.0);",o+=` }
|
|
`,o+=` else
|
|
`,o+=` {
|
|
`,o+=" $1 = $1 + vec4(czm_batchTable_offset2D(batchId) * applyOffset, 0.0);",o+=` }
|
|
`,i=i.replace(/vec4\s+([A-Za-z0-9_]+)\s+=\s+czm_computePosition\(\);/g,o),i};Mt._appendDistanceDisplayConditionToShader=function(e,t,n){if(!c(e._batchTableAttributeIndices.distanceDisplayCondition))return t;const i=Oe.replaceMain(t,"czm_non_distanceDisplayCondition_main");let o=`void main()
|
|
{
|
|
czm_non_distanceDisplayCondition_main();
|
|
vec2 distanceDisplayCondition = czm_batchTable_distanceDisplayCondition(batchId);
|
|
vec3 boundingSphereCenter3DHigh = czm_batchTable_boundingSphereCenter3DHigh(batchId);
|
|
vec3 boundingSphereCenter3DLow = czm_batchTable_boundingSphereCenter3DLow(batchId);
|
|
float boundingSphereRadius = czm_batchTable_boundingSphereRadius(batchId);
|
|
`;return n?o+=` vec4 centerRTE = czm_translateRelativeToEye(boundingSphereCenter3DHigh, boundingSphereCenter3DLow);
|
|
`:o+=` vec3 boundingSphereCenter2DHigh = czm_batchTable_boundingSphereCenter2DHigh(batchId);
|
|
vec3 boundingSphereCenter2DLow = czm_batchTable_boundingSphereCenter2DLow(batchId);
|
|
vec4 centerRTE;
|
|
if (czm_morphTime == 1.0)
|
|
{
|
|
centerRTE = czm_translateRelativeToEye(boundingSphereCenter3DHigh, boundingSphereCenter3DLow);
|
|
}
|
|
else if (czm_morphTime == 0.0)
|
|
{
|
|
centerRTE = czm_translateRelativeToEye(boundingSphereCenter2DHigh.zxy, boundingSphereCenter2DLow.zxy);
|
|
}
|
|
else
|
|
{
|
|
centerRTE = czm_columbusViewMorph(
|
|
czm_translateRelativeToEye(boundingSphereCenter2DHigh.zxy, boundingSphereCenter2DLow.zxy),
|
|
czm_translateRelativeToEye(boundingSphereCenter3DHigh, boundingSphereCenter3DLow),
|
|
czm_morphTime);
|
|
}
|
|
`,o+=` float radiusSq = boundingSphereRadius * boundingSphereRadius;
|
|
float distanceSq;
|
|
if (czm_sceneMode == czm_sceneMode2D)
|
|
{
|
|
distanceSq = czm_eyeHeight2D.y - radiusSq;
|
|
}
|
|
else
|
|
{
|
|
distanceSq = dot(centerRTE.xyz, centerRTE.xyz) - radiusSq;
|
|
}
|
|
distanceSq = max(distanceSq, 0.0);
|
|
float nearSq = distanceDisplayCondition.x * distanceDisplayCondition.x;
|
|
float farSq = distanceDisplayCondition.y * distanceDisplayCondition.y;
|
|
float show = (distanceSq >= nearSq && distanceSq <= farSq) ? 1.0 : 0.0;
|
|
gl_Position *= show;
|
|
}`,`${i}
|
|
${o}`};function pN(e,t){if(!e.compressVertices)return t;const n=t.search(/in\s+vec3\s+normal;/g)!==-1,i=t.search(/in\s+vec2\s+st;/g)!==-1;if(!n&&!i)return t;const o=t.search(/in\s+vec3\s+tangent;/g)!==-1,r=t.search(/in\s+vec3\s+bitangent;/g)!==-1;let s=i&&n?2:1;s+=o||r?1:0;const a=s>1?`vec${s}`:"float",l="compressedAttributes",u=`in ${a} ${l};`;let h="",f="";if(i){h+=`vec2 st;
|
|
`;const m=s>1?`${l}.x`:l;f+=` st = czm_decompressTextureCoordinates(${m});
|
|
`}n&&o&&r?(h+=`vec3 normal;
|
|
vec3 tangent;
|
|
vec3 bitangent;
|
|
`,f+=` czm_octDecode(${l}.${i?"yz":"xy"}, normal, tangent, bitangent);
|
|
`):(n&&(h+=`vec3 normal;
|
|
`,f+=` normal = czm_octDecode(${l}${s>1?`.${i?"y":"x"}`:""});
|
|
`),o&&(h+=`vec3 tangent;
|
|
`,f+=` tangent = czm_octDecode(${l}.${i&&n?"z":"y"});
|
|
`),r&&(h+=`vec3 bitangent;
|
|
`,f+=` bitangent = czm_octDecode(${l}.${i&&n?"z":"y"});
|
|
`));let _=t;_=_.replace(/in\s+vec3\s+normal;/g,""),_=_.replace(/in\s+vec2\s+st;/g,""),_=_.replace(/in\s+vec3\s+tangent;/g,""),_=_.replace(/in\s+vec3\s+bitangent;/g,""),_=Oe.replaceMain(_,"czm_non_compressed_main");const g=`void main()
|
|
{
|
|
${f} czm_non_compressed_main();
|
|
}`;return[u,h,_,g].join(`
|
|
`)}function boe(e){let t=Oe.replaceMain(e,"czm_non_depth_clamp_main");return t+=`void main() {
|
|
czm_non_depth_clamp_main();
|
|
gl_Position = czm_depthClamp(gl_Position);}
|
|
`,t}function Toe(e){let t=Oe.replaceMain(e,"czm_non_depth_clamp_main");return t+=`void main() {
|
|
czm_non_depth_clamp_main();
|
|
#if defined(LOG_DEPTH)
|
|
czm_writeLogDepth();
|
|
#else
|
|
czm_writeDepthClamp();
|
|
#endif
|
|
}
|
|
`,t}function mN(e,t){const n=e.vertexAttributes;for(const i in n)if(n.hasOwnProperty(i)&&!c(t[i]))throw new E(`Appearance/Geometry mismatch. The appearance requires vertex shader attribute input '${i}', which was not computed as part of the Geometry. Use the appearance's vertexFormat property when constructing the geometry.`)}function Aoe(e,t){return function(){return e[t]}}const yw=Math.max(Yt.hardwareConcurrency-1,1);let Xb;const xoe=new Kn("combineGeometry");function Coe(e,t){let n,i,o,r;const s=e._instanceIds;if(e._state===Uo.READY){n=Array.isArray(e.geometryInstances)?e.geometryInstances:[e.geometryInstances];const a=e._numberOfInstances=n.length,l=[];let u=[];for(o=0;o<a;++o){if(i=n[o].geometry,s.push(n[o].id),c(i._workerName)&&c(i._workerPath)||!c(i._workerName)&&!c(i._workerPath))throw new E("Must define either _workerName or _workerPath for asynchronous geometry.");u.push({moduleName:i._workerName,modulePath:i._workerPath,geometry:i})}if(!c(Xb))for(Xb=new Array(yw),o=0;o<yw;o++)Xb[o]=new Kn("createGeometry");let h;for(u=cie(u,yw),o=0;o<u.length;o++){let f=0;const _=u[o],g=_.length;for(r=0;r<g;++r)h=_[r],i=h.geometry,c(i.constructor.pack)&&(h.offset=f,f+=y(i.constructor.packedLength,i.packedLength));let m;if(f>0){const b=new Float64Array(f);for(m=[b.buffer],r=0;r<g;++r)h=_[r],i=h.geometry,c(i.constructor.pack)&&(i.constructor.pack(i,b,h.offset),h.geometry=b)}l.push(Xb[o].scheduleTask({subTasks:u[o]},m))}e._state=Uo.CREATING,Promise.all(l).then(function(f){e._createGeometryResults=f,e._state=Uo.CREATED}).catch(function(f){Py(e,t,Uo.FAILED,f)})}else if(e._state===Uo.CREATED){const a=[];n=Array.isArray(e.geometryInstances)?e.geometryInstances:[e.geometryInstances];const l=t.scene3DOnly,u=t.mapProjection,h=xoe.scheduleTask(PI.packCombineGeometryParameters({createGeometryResults:e._createGeometryResults,instances:n,ellipsoid:u.ellipsoid,projection:u,elementIndexUintSupported:t.context.elementIndexUint,scene3DOnly:l,vertexCacheOptimize:e.vertexCacheOptimize,compressVertices:e.compressVertices,modelMatrix:e.modelMatrix,createPickOffsets:e._createPickOffsets},a),a);e._createGeometryResults=void 0,e._state=Uo.COMBINING,Promise.resolve(h).then(function(f){const _=PI.unpackCombineGeometryResults(f);e._geometries=_.geometries,e._attributeLocations=_.attributeLocations,e.modelMatrix=L.clone(_.modelMatrix,e.modelMatrix),e._pickOffsets=_.pickOffsets,e._offsetInstanceExtend=_.offsetInstanceExtend,e._instanceBoundingSpheres=_.boundingSpheres,e._instanceBoundingSpheresCV=_.boundingSpheresCV,c(e._geometries)&&e._geometries.length>0?(e._recomputeBoundingSpheres=!0,e._state=Uo.COMBINED):Py(e,t,Uo.FAILED,void 0)}).catch(function(f){Py(e,t,Uo.FAILED,f)})}}function Eoe(e,t){const n=Array.isArray(e.geometryInstances)?e.geometryInstances:[e.geometryInstances],i=e._numberOfInstances=n.length,o=new Array(i),r=e._instanceIds;let s,a,l=0;for(a=0;a<i;a++){s=n[a];const _=s.geometry;let g;c(_.attributes)&&c(_.primitiveType)?g=_oe(_):g=_.constructor.createGeometry(_),o[l++]=goe(s,g),r.push(s.id)}o.length=l;const u=t.scene3DOnly,h=t.mapProjection,f=PI.combineGeometry({instances:o,ellipsoid:h.ellipsoid,projection:h,elementIndexUintSupported:t.context.elementIndexUint,scene3DOnly:u,vertexCacheOptimize:e.vertexCacheOptimize,compressVertices:e.compressVertices,modelMatrix:e.modelMatrix,createPickOffsets:e._createPickOffsets});e._geometries=f.geometries,e._attributeLocations=f.attributeLocations,e.modelMatrix=L.clone(f.modelMatrix,e.modelMatrix),e._pickOffsets=f.pickOffsets,e._offsetInstanceExtend=f.offsetInstanceExtend,e._instanceBoundingSpheres=f.boundingSpheres,e._instanceBoundingSpheresCV=f.boundingSpheresCV,c(e._geometries)&&e._geometries.length>0?(e._recomputeBoundingSpheres=!0,e._state=Uo.COMBINED):Py(e,t,Uo.FAILED,void 0)}function woe(e,t){const n=e._batchTableAttributeIndices.offset;if(!e._recomputeBoundingSpheres||!c(n)){e._recomputeBoundingSpheres=!1;return}let i;const o=e._offsetInstanceExtend,r=e._instanceBoundingSpheres,s=r.length;let a=e._tempBoundingSpheres;if(!c(a)){for(a=new Array(s),i=0;i<s;i++)a[i]=new se;e._tempBoundingSpheres=a}for(i=0;i<s;++i){let b=a[i];const T=e._batchTable.getBatchedAttribute(i,n,new d);b=r[i].clone(b),uV(b,T,o[i])}const l=[],u=[],h=[];for(i=0;i<s;++i){const b=a[i];b.center.x-b.radius>0||se.intersectPlane(b,_t.ORIGIN_ZX_PLANE)!==Bt.INTERSECTING?l.push(b):(u.push(b),h.push(b))}let f=l[0],_=h[0],g=u[0];for(i=1;i<l.length;i++)f=se.union(f,l[i]);for(i=1;i<h.length;i++)_=se.union(_,h[i]);for(i=1;i<u.length;i++)g=se.union(g,u[i]);const m=[];for(c(f)&&m.push(f),c(_)&&m.push(_),c(g)&&m.push(g),i=0;i<m.length;i++){const b=m[i].clone(e._boundingSpheres[i]);e._boundingSpheres[i]=b,e._boundingSphereCV[i]=se.projectTo2D(b,t.mapProjection,e._boundingSphereCV[i])}Mt._updateBoundingVolumes(e,t,e.modelMatrix,!0),e._recomputeBoundingSpheres=!1}const _N=new rn,aV=new he,cV=new d,lV=new se;function Soe(e,t){if(!c(e._batchTableAttributeIndices.distanceDisplayCondition)||e._batchTableBoundingSpheresUpdated)return;const i=e._batchTableBoundingSphereAttributeIndices,o=i.center3DHigh,r=i.center3DLow,s=i.center2DHigh,a=i.center2DLow,l=i.radius,u=t.mapProjection,h=u.ellipsoid,f=e._batchTable,_=e._instanceBoundingSpheres,g=_.length;for(let m=0;m<g;++m){let b=_[m];if(!c(b))continue;const T=e.modelMatrix;c(T)&&(b=se.transform(b,T,lV));const x=b.center,C=b.radius;let w=rn.fromCartesian(x,_N);if(f.setBatchedAttribute(m,o,w.high),f.setBatchedAttribute(m,r,w.low),!t.scene3DOnly){const v=h.cartesianToCartographic(x,aV),P=u.project(v,cV);w=rn.fromCartesian(P,_N),f.setBatchedAttribute(m,s,w.high),f.setBatchedAttribute(m,a,w.low)}f.setBatchedAttribute(m,l,C)}e._batchTableBoundingSpheresUpdated=!0}const bw=new d,voe=new d;function gN(e,t){if(!c(e._batchTableAttributeIndices.offset)||e._batchTableOffsetsUpdated||t.scene3DOnly)return;const i=e._batchTableOffsetAttribute2DIndex,o=t.mapProjection,r=o.ellipsoid,s=e._batchTable,a=e._instanceBoundingSpheres,l=a.length;for(let u=0;u<l;++u){let h=a[u];if(!c(h))continue;const f=s.getBatchedAttribute(u,e._batchTableAttributeIndices.offset);if(d.equals(f,d.ZERO)){s.setBatchedAttribute(u,i,d.ZERO);continue}const _=e.modelMatrix;c(_)&&(h=se.transform(h,_,lV));let g=h.center;g=r.scaleToGeodeticSurface(g,voe);let m=r.cartesianToCartographic(g,aV);const b=o.project(m,cV),T=d.add(f,g,bw);m=r.cartesianToCartographic(T,m);const x=o.project(m,bw),C=d.subtract(x,b,bw),w=C.x;C.x=C.z,C.z=C.y,C.y=w,s.setBatchedAttribute(u,i,C)}e._batchTableOffsetsUpdated=!0}function Ioe(e,t){const n=e._attributeLocations,i=e._geometries,o=t.scene3DOnly,r=t.context,s=[],a=i.length;for(let l=0;l<a;++l){const u=i[l];if(s.push(Ci.fromGeometry({context:r,geometry:u,attributeLocations:n,bufferUsage:ke.STATIC_DRAW,interleave:e._interleave})),c(e._createBoundingVolumeFunction))e._createBoundingVolumeFunction(t,u);else if(e._boundingSpheres.push(se.clone(u.boundingSphere)),e._boundingSphereWC.push(new se),!o){const h=u.boundingSphereCV.center,f=h.x,_=h.y,g=h.z;h.x=g,h.y=f,h.z=_,e._boundingSphereCV.push(se.clone(u.boundingSphereCV)),e._boundingSphere2D.push(new se),e._boundingSphereMorph.push(new se)}}e._va=s,e._primitiveType=i[0].primitiveType,e.releaseGeometryInstances&&(e.geometryInstances=void 0),e._geometries=void 0,Py(e,t,Uo.COMPLETE,void 0)}function Doe(e,t,n,i){let o=n.getRenderState(),r;i?(r=Je(o,!1),r.cull={enabled:!0,face:Qi.BACK},e._frontFaceRS=Ue.fromCache(r),r.cull.face=Qi.FRONT,e._backFaceRS=Ue.fromCache(r)):(e._frontFaceRS=Ue.fromCache(o),e._backFaceRS=e._frontFaceRS),r=Je(o,!1),c(e._depthFailAppearance)&&(r.depthTest.enabled=!1),c(e._depthFailAppearance)&&(o=e._depthFailAppearance.getRenderState(),r=Je(o,!1),r.depthTest.func=lp.GREATER,i?(r.cull={enabled:!0,face:Qi.BACK},e._frontFaceDepthFailRS=Ue.fromCache(r),r.cull.face=Qi.FRONT,e._backFaceDepthFailRS=Ue.fromCache(r)):(e._frontFaceDepthFailRS=Ue.fromCache(r),e._backFaceDepthFailRS=e._frontFaceRS))}function Poe(e,t,n){const i=t.context,o=e._attributeLocations;let r=e._batchTable.getVertexShaderCallback()(n.vertexShaderSource);r=Mt._appendOffsetToShader(e,r),r=Mt._appendShowToShader(e,r),r=Mt._appendDistanceDisplayConditionToShader(e,r,t.scene3DOnly),r=hN(r),r=Mt._updateColorAttribute(e,r,!1),r=pN(e,r),r=Mt._modifyShaderPosition(e,r,t.scene3DOnly);let s=n.getFragmentShaderSource();s=fN(s),e._sp=Jt.replaceCache({context:i,shaderProgram:e._sp,vertexShaderSource:r,fragmentShaderSource:s,attributeLocations:o}),mN(e._sp,o),c(e._depthFailAppearance)&&(r=e._batchTable.getVertexShaderCallback()(e._depthFailAppearance.vertexShaderSource),r=Mt._appendShowToShader(e,r),r=Mt._appendDistanceDisplayConditionToShader(e,r,t.scene3DOnly),r=hN(r),r=Mt._updateColorAttribute(e,r,!0),r=pN(e,r),r=Mt._modifyShaderPosition(e,r,t.scene3DOnly),r=boe(r),s=e._depthFailAppearance.getFragmentShaderSource(),s=fN(s),s=Toe(s),e._spDepthFail=Jt.replaceCache({context:i,shaderProgram:e._spDepthFail,vertexShaderSource:r,fragmentShaderSource:s,attributeLocations:o}),mN(e._spDepthFail,o))}const wg=new L,yN=new d;function bN(e,t,n,i){const o=c(n)?n._uniforms:void 0,r={},s=t.uniforms;if(c(s)){for(const l in s)if(s.hasOwnProperty(l)){if(c(o)&&c(o[l]))throw new E(`Appearance and material have a uniform with the same name: ${l}`);r[l]=Aoe(s,l)}}let a=jt(r,o);return a=e._batchTable.getUniformMapCallback()(a),c(e.rtcCenter)&&(a.u_modifiedModelView=function(){const l=i.context.uniformState.view;return L.multiply(l,e._modelMatrix,wg),L.multiplyByPoint(wg,e.rtcCenter,yN),L.setTranslation(wg,yN,wg),wg}),a}function Ooe(e,t,n,i,o,r,s,a){const l=bN(e,t,n,a);let u;c(e._depthFailAppearance)&&(u=bN(e,e._depthFailAppearance,e._depthFailAppearance.material,a));const h=i?xe.TRANSLUCENT:xe.OPAQUE;let f=o?2:1;f*=c(e._depthFailAppearance)?2:1,r.length=e._va.length*f;const _=r.length;let g=0;for(let m=0;m<_;++m){let b;o&&(b=r[m],c(b)||(b=r[m]=new Ze({owner:e,primitiveType:e._primitiveType})),b.vertexArray=e._va[g],b.renderState=e._backFaceRS,b.shaderProgram=e._sp,b.uniformMap=l,b.pass=h,++m),b=r[m],c(b)||(b=r[m]=new Ze({owner:e,primitiveType:e._primitiveType})),b.vertexArray=e._va[g],b.renderState=e._frontFaceRS,b.shaderProgram=e._sp,b.uniformMap=l,b.pass=h,c(e._depthFailAppearance)&&(o&&(++m,b=r[m],c(b)||(b=r[m]=new Ze({owner:e,primitiveType:e._primitiveType})),b.vertexArray=e._va[g],b.renderState=e._backFaceDepthFailRS,b.shaderProgram=e._spDepthFail,b.uniformMap=u,b.pass=h),++m,b=r[m],c(b)||(b=r[m]=new Ze({owner:e,primitiveType:e._primitiveType})),b.vertexArray=e._va[g],b.renderState=e._frontFaceDepthFailRS,b.shaderProgram=e._spDepthFail,b.uniformMap=u,b.pass=h),++g}}Mt._updateBoundingVolumes=function(e,t,n,i){let o,r,s;if(i||!L.equals(n,e._modelMatrix))for(L.clone(n,e._modelMatrix),r=e._boundingSpheres.length,o=0;o<r;++o)s=e._boundingSpheres[o],c(s)&&(e._boundingSphereWC[o]=se.transform(s,n,e._boundingSphereWC[o]),t.scene3DOnly||(e._boundingSphere2D[o]=se.clone(e._boundingSphereCV[o],e._boundingSphere2D[o]),e._boundingSphere2D[o].center.x=0,e._boundingSphereMorph[o]=se.union(e._boundingSphereWC[o],e._boundingSphereCV[o])));const a=e.appearance.pixelSize;if(c(a))for(r=e._boundingSpheres.length,o=0;o<r;++o){s=e._boundingSpheres[o];const l=e._boundingSphereWC[o],h=t.camera.getPixelSize(s,t.context.drawingBufferWidth,t.context.drawingBufferHeight)*a;l.radius=s.radius+h}};function Loe(e,t,n,i,o,r,s,a){if(t.mode!==oe.SCENE3D&&!L.equals(o,L.IDENTITY))throw new E("Primitive.modelMatrix is only supported in 3D mode.");Mt._updateBoundingVolumes(e,t,o);let l;t.mode===oe.SCENE3D?l=e._boundingSphereWC:t.mode===oe.COLUMBUS_VIEW?l=e._boundingSphereCV:t.mode===oe.SCENE2D&&c(e._boundingSphere2D)?l=e._boundingSphere2D:c(e._boundingSphereMorph)&&(l=e._boundingSphereMorph);const u=t.commandList,h=t.passes;if(h.render||h.pick){const f=e.allowPicking,_=Vi.castShadows(e.shadows),g=Vi.receiveShadows(e.shadows),m=n.length;let b=a?2:1;b*=c(e._depthFailAppearance)?2:1;for(let T=0;T<m;++T){const x=Math.floor(T/b),C=n[T];C.modelMatrix=o,C.boundingVolume=l[x],C.cull=r,C.debugShowBoundingVolume=s,C.castShadows=_,C.receiveShadows=g,f?C.pickId="v_pickColor":C.pickId=void 0,u.push(C)}}}Mt.prototype.update=function(e){if(!c(this.geometryInstances)&&this._va.length===0||c(this.geometryInstances)&&Array.isArray(this.geometryInstances)&&this.geometryInstances.length===0||!c(this.appearance)||e.mode!==oe.SCENE3D&&e.scene3DOnly||!e.passes.render&&!e.passes.pick)return;if(c(this._error))throw this._error;if(c(this.rtcCenter)&&!e.scene3DOnly)throw new E("RTC rendering is only available for 3D only scenes.");if(this._state===Uo.FAILED)return;const t=e.context;if(c(this._batchTable)||poe(this,t),this._batchTable.attributes.length>0){if(pt.maximumVertexTextureImageUnits===0)throw new Te("Vertex texture fetch support is required to render primitives with per-instance attributes. The maximum number of vertex texture image units must be greater than zero.");this._batchTable.update(e)}if(this._state!==Uo.COMPLETE&&this._state!==Uo.COMBINED&&(this.asynchronous?Coe(this,e):Eoe(this,e)),this._state===Uo.COMBINED&&(Soe(this,e),gN(this,e),Ioe(this,e)),!this.show||this._state!==Uo.COMPLETE)return;this._batchTableOffsetsUpdated||gN(this,e),this._recomputeBoundingSpheres&&woe(this,e);const n=this.appearance,i=n.material;let o=!1,r=!1;this._appearance!==n?(this._appearance=n,this._material=i,o=!0,r=!0):this._material!==i&&(this._material=i,r=!0);const s=this.depthFailAppearance,a=c(s)?s.material:void 0;this._depthFailAppearance!==s?(this._depthFailAppearance=s,this._depthFailMaterial=a,o=!0,r=!0):this._depthFailMaterial!==a&&(this._depthFailMaterial=a,r=!0);const l=this._appearance.isTranslucent();this._translucent!==l&&(this._translucent=l,o=!0),c(this._material)&&this._material.update(t);const u=n.closed&&l;o&&y(this._createRenderStatesFunction,Doe)(this,t,n,u),r&&y(this._createShaderProgramFunction,Poe)(this,e,n),(o||r)&&y(this._createCommandsFunction,Ooe)(this,n,i,l,u,this._colorCommands,this._pickCommands,e),y(this._updateAndQueueCommandsFunction,Loe)(this,e,this._colorCommands,this._pickCommands,this.modelMatrix,this.cull,this.debugShowBoundingVolume,u)};const Roe=new se,Noe=new se;function uV(e,t,n){if(n===Kt.TOP){const i=se.clone(e,Roe),o=se.clone(e,Noe);o.center=d.add(o.center,t,o.center),e=se.union(i,o,e)}else n===Kt.ALL&&(e.center=d.add(e.center,t,e.center));return e}function Moe(e,t,n){return function(){const i=e.getBatchedAttribute(t,n),o=e.attributes[n],r=o.componentsPerAttribute,s=Z.createTypedArray(o.componentDatatype,r);return c(i.constructor.pack)?i.constructor.pack(i,s,0):s[0]=i,s}}function Foe(e,t,n,i,o){return function(r){if(!c(r)||!c(r.length)||r.length<1||r.length>4)throw new E("value must be and array with length between 1 and 4.");const s=sV(r);e.setBatchedAttribute(t,n,s),o==="offset"&&(i._recomputeBoundingSpheres=!0,i._batchTableOffsetsUpdated=!1)}}const Boe=new d;function zoe(e,t,n){t.boundingSphere={get:function(){let i=e._instanceBoundingSpheres[n];if(c(i)){i=i.clone();const o=e.modelMatrix,r=t.offset;c(r)&&uV(i,d.fromArray(r.get(),0,Boe),e._offsetInstanceExtend[n]),c(o)&&(i=se.transform(i,o))}return i}},t.boundingSphereCV={get:function(){return e._instanceBoundingSpheresCV[n]}}}function Uoe(e,t,n){t.pickId={get:function(){return e._pickIds[n]}}}Mt.prototype.getGeometryInstanceAttributes=function(e){if(!c(e))throw new E("id is required");if(!c(this._batchTable))throw new E("must call update before calling getGeometryInstanceAttributes");let t=this._perInstanceAttributeCache.get(e);if(c(t))return t;let n=-1;const i=this._lastPerInstanceAttributeIndex,o=this._instanceIds,r=o.length;for(let u=0;u<r;++u){const h=(i+u)%r;if(e===o[h]){n=h;break}}if(n===-1)return;const s=this._batchTable,a=this._batchTableAttributeIndices;t={};const l={};for(const u in a)if(a.hasOwnProperty(u)){const h=a[u];l[u]={get:Moe(s,n,h),set:Foe(s,n,h,this,u)}}return zoe(this,l,n),Uoe(this,l,n),Object.defineProperties(t,l),this._lastPerInstanceAttributeIndex=n,this._perInstanceAttributeCache.set(e,t),t};Mt.prototype.isDestroyed=function(){return!1};Mt.prototype.destroy=function(){let e,t;this._sp=this._sp&&this._sp.destroy(),this._spDepthFail=this._spDepthFail&&this._spDepthFail.destroy();const n=this._va;for(e=n.length,t=0;t<e;++t)n[t].destroy();this._va=void 0;const i=this._pickIds;for(e=i.length,t=0;t<e;++t)i[t].destroy();return this._pickIds=void 0,this._batchTable=this._batchTable&&this._batchTable.destroy(),this._instanceIds=void 0,this._perInstanceAttributeCache=void 0,this._attributeLocations=void 0,ve(this)};function Py(e,t,n,i){e._error=i,e._state=n,t.afterRender.push(function(){e._ready=e._state===Uo.COMPLETE||e._state===Uo.FAILED})}function ll(e){if(e=y(e,y.EMPTY_OBJECT),!c(e.componentDatatype))throw new E("options.componentDatatype is required.");if(!c(e.componentsPerAttribute))throw new E("options.componentsPerAttribute is required.");if(e.componentsPerAttribute<1||e.componentsPerAttribute>4)throw new E("options.componentsPerAttribute must be between 1 and 4.");if(!c(e.value))throw new E("options.value is required.");this.componentDatatype=e.componentDatatype,this.componentsPerAttribute=e.componentsPerAttribute,this.normalize=y(e.normalize,!1),this.value=e.value}const dV=`#ifdef TEXTURE_COORDINATES
|
|
#ifdef SPHERICAL
|
|
in vec4 v_sphericalExtents;
|
|
#else // SPHERICAL
|
|
in vec2 v_inversePlaneExtents;
|
|
in vec4 v_westPlane;
|
|
in vec4 v_southPlane;
|
|
#endif // SPHERICAL
|
|
in vec3 v_uvMinAndSphericalLongitudeRotation;
|
|
in vec3 v_uMaxAndInverseDistance;
|
|
in vec3 v_vMaxAndInverseDistance;
|
|
#endif // TEXTURE_COORDINATES
|
|
|
|
#ifdef PER_INSTANCE_COLOR
|
|
in vec4 v_color;
|
|
#endif
|
|
|
|
#ifdef NORMAL_EC
|
|
vec3 getEyeCoordinate3FromWindowCoordinate(vec2 fragCoord, float logDepthOrDepth) {
|
|
vec4 eyeCoordinate = czm_windowToEyeCoordinates(fragCoord, logDepthOrDepth);
|
|
return eyeCoordinate.xyz / eyeCoordinate.w;
|
|
}
|
|
|
|
vec3 vectorFromOffset(vec4 eyeCoordinate, vec2 positiveOffset) {
|
|
vec2 glFragCoordXY = gl_FragCoord.xy;
|
|
// Sample depths at both offset and negative offset
|
|
float upOrRightLogDepth = czm_unpackDepth(texture(czm_globeDepthTexture, (glFragCoordXY + positiveOffset) / czm_viewport.zw));
|
|
float downOrLeftLogDepth = czm_unpackDepth(texture(czm_globeDepthTexture, (glFragCoordXY - positiveOffset) / czm_viewport.zw));
|
|
// Explicitly evaluate both paths
|
|
// Necessary for multifrustum and for edges of the screen
|
|
bvec2 upOrRightInBounds = lessThan(glFragCoordXY + positiveOffset, czm_viewport.zw);
|
|
float useUpOrRight = float(upOrRightLogDepth > 0.0 && upOrRightInBounds.x && upOrRightInBounds.y);
|
|
float useDownOrLeft = float(useUpOrRight == 0.0);
|
|
vec3 upOrRightEC = getEyeCoordinate3FromWindowCoordinate(glFragCoordXY + positiveOffset, upOrRightLogDepth);
|
|
vec3 downOrLeftEC = getEyeCoordinate3FromWindowCoordinate(glFragCoordXY - positiveOffset, downOrLeftLogDepth);
|
|
return (upOrRightEC - (eyeCoordinate.xyz / eyeCoordinate.w)) * useUpOrRight + ((eyeCoordinate.xyz / eyeCoordinate.w) - downOrLeftEC) * useDownOrLeft;
|
|
}
|
|
#endif // NORMAL_EC
|
|
|
|
void main(void)
|
|
{
|
|
#ifdef REQUIRES_EC
|
|
float logDepthOrDepth = czm_unpackDepth(texture(czm_globeDepthTexture, gl_FragCoord.xy / czm_viewport.zw));
|
|
vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth);
|
|
#endif
|
|
|
|
#ifdef REQUIRES_WC
|
|
vec4 worldCoordinate4 = czm_inverseView * eyeCoordinate;
|
|
vec3 worldCoordinate = worldCoordinate4.xyz / worldCoordinate4.w;
|
|
#endif
|
|
|
|
#ifdef TEXTURE_COORDINATES
|
|
vec2 uv;
|
|
#ifdef SPHERICAL
|
|
// Treat world coords as a sphere normal for spherical coordinates
|
|
vec2 sphericalLatLong = czm_approximateSphericalCoordinates(worldCoordinate);
|
|
sphericalLatLong.y += v_uvMinAndSphericalLongitudeRotation.z;
|
|
sphericalLatLong.y = czm_branchFreeTernary(sphericalLatLong.y < czm_pi, sphericalLatLong.y, sphericalLatLong.y - czm_twoPi);
|
|
uv.x = (sphericalLatLong.y - v_sphericalExtents.y) * v_sphericalExtents.w;
|
|
uv.y = (sphericalLatLong.x - v_sphericalExtents.x) * v_sphericalExtents.z;
|
|
#else // SPHERICAL
|
|
// Unpack planes and transform to eye space
|
|
uv.x = czm_planeDistance(v_westPlane, eyeCoordinate.xyz / eyeCoordinate.w) * v_inversePlaneExtents.x;
|
|
uv.y = czm_planeDistance(v_southPlane, eyeCoordinate.xyz / eyeCoordinate.w) * v_inversePlaneExtents.y;
|
|
#endif // SPHERICAL
|
|
#endif // TEXTURE_COORDINATES
|
|
|
|
#ifdef PICK
|
|
#ifdef CULL_FRAGMENTS
|
|
// When classifying translucent geometry, logDepthOrDepth == 0.0
|
|
// indicates a region that should not be classified, possibly due to there
|
|
// being opaque pixels there in another buffer.
|
|
// Check for logDepthOrDepth != 0.0 to make sure this should be classified.
|
|
if (0.0 <= uv.x && uv.x <= 1.0 && 0.0 <= uv.y && uv.y <= 1.0 || logDepthOrDepth != 0.0) {
|
|
out_FragColor.a = 1.0; // 0.0 alpha leads to discard from ShaderSource.createPickFragmentShaderSource
|
|
czm_writeDepthClamp();
|
|
}
|
|
#else // CULL_FRAGMENTS
|
|
out_FragColor.a = 1.0;
|
|
#endif // CULL_FRAGMENTS
|
|
#else // PICK
|
|
|
|
#ifdef CULL_FRAGMENTS
|
|
// When classifying translucent geometry, logDepthOrDepth == 0.0
|
|
// indicates a region that should not be classified, possibly due to there
|
|
// being opaque pixels there in another buffer.
|
|
if (uv.x <= 0.0 || 1.0 <= uv.x || uv.y <= 0.0 || 1.0 <= uv.y || logDepthOrDepth == 0.0) {
|
|
discard;
|
|
}
|
|
#endif
|
|
|
|
#ifdef NORMAL_EC
|
|
// Compute normal by sampling adjacent pixels in 2x2 block in screen space
|
|
vec3 downUp = vectorFromOffset(eyeCoordinate, vec2(0.0, 1.0));
|
|
vec3 leftRight = vectorFromOffset(eyeCoordinate, vec2(1.0, 0.0));
|
|
vec3 normalEC = normalize(cross(leftRight, downUp));
|
|
#endif
|
|
|
|
|
|
#ifdef PER_INSTANCE_COLOR
|
|
|
|
vec4 color = czm_gammaCorrect(v_color);
|
|
#ifdef FLAT
|
|
out_FragColor = color;
|
|
#else // FLAT
|
|
czm_materialInput materialInput;
|
|
materialInput.normalEC = normalEC;
|
|
materialInput.positionToEyeEC = -eyeCoordinate.xyz;
|
|
czm_material material = czm_getDefaultMaterial(materialInput);
|
|
material.diffuse = color.rgb;
|
|
material.alpha = color.a;
|
|
|
|
out_FragColor = czm_phong(normalize(-eyeCoordinate.xyz), material, czm_lightDirectionEC);
|
|
#endif // FLAT
|
|
|
|
// Premultiply alpha. Required for classification primitives on translucent globe.
|
|
out_FragColor.rgb *= out_FragColor.a;
|
|
|
|
#else // PER_INSTANCE_COLOR
|
|
|
|
// Material support.
|
|
// USES_ is distinct from REQUIRES_, because some things are dependencies of each other or
|
|
// dependencies for culling but might not actually be used by the material.
|
|
|
|
czm_materialInput materialInput;
|
|
|
|
#ifdef USES_NORMAL_EC
|
|
materialInput.normalEC = normalEC;
|
|
#endif
|
|
|
|
#ifdef USES_POSITION_TO_EYE_EC
|
|
materialInput.positionToEyeEC = -eyeCoordinate.xyz;
|
|
#endif
|
|
|
|
#ifdef USES_TANGENT_TO_EYE
|
|
materialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(worldCoordinate, normalEC);
|
|
#endif
|
|
|
|
#ifdef USES_ST
|
|
// Remap texture coordinates from computed (approximately aligned with cartographic space) to the desired
|
|
// texture coordinate system, which typically forms a tight oriented bounding box around the geometry.
|
|
// Shader is provided a set of reference points for remapping.
|
|
materialInput.st.x = czm_lineDistance(v_uvMinAndSphericalLongitudeRotation.xy, v_uMaxAndInverseDistance.xy, uv) * v_uMaxAndInverseDistance.z;
|
|
materialInput.st.y = czm_lineDistance(v_uvMinAndSphericalLongitudeRotation.xy, v_vMaxAndInverseDistance.xy, uv) * v_vMaxAndInverseDistance.z;
|
|
#endif
|
|
|
|
czm_material material = czm_getMaterial(materialInput);
|
|
|
|
#ifdef FLAT
|
|
out_FragColor = vec4(material.diffuse + material.emission, material.alpha);
|
|
#else // FLAT
|
|
out_FragColor = czm_phong(normalize(-eyeCoordinate.xyz), material, czm_lightDirectionEC);
|
|
#endif // FLAT
|
|
|
|
// Premultiply alpha. Required for classification primitives on translucent globe.
|
|
out_FragColor.rgb *= out_FragColor.a;
|
|
|
|
#endif // PER_INSTANCE_COLOR
|
|
czm_writeDepthClamp();
|
|
#endif // PICK
|
|
}
|
|
`;function Sr(e,t,n){A.typeOf.bool("extentsCulling",e),A.typeOf.bool("planarExtents",t),A.typeOf.object("appearance",n),this._projectionExtentDefines={eastMostYhighDefine:"",eastMostYlowDefine:"",westMostYhighDefine:"",westMostYlowDefine:""};const i=new OI;i.requiresTextureCoordinates=e,i.requiresEC=!n.flat;const o=new OI;if(o.requiresTextureCoordinates=e,n instanceof tn)i.requiresNormalEC=!n.flat;else{const r=`${n.material.shaderSource}
|
|
${n.fragmentShaderSource}`;i.normalEC=r.indexOf("materialInput.normalEC")!==-1||r.indexOf("czm_getDefaultMaterial")!==-1,i.positionToEyeEC=r.indexOf("materialInput.positionToEyeEC")!==-1,i.tangentToEyeMatrix=r.indexOf("materialInput.tangentToEyeMatrix")!==-1,i.st=r.indexOf("materialInput.st")!==-1}this._colorShaderDependencies=i,this._pickShaderDependencies=o,this._appearance=n,this._extentsCulling=e,this._planarExtents=t}Sr.prototype.createFragmentShader=function(e){A.typeOf.bool("columbusView2D",e);const t=this._appearance,n=this._colorShaderDependencies,i=[];!e&&!this._planarExtents&&i.push("SPHERICAL"),n.requiresEC&&i.push("REQUIRES_EC"),n.requiresWC&&i.push("REQUIRES_WC"),n.requiresTextureCoordinates&&i.push("TEXTURE_COORDINATES"),this._extentsCulling&&i.push("CULL_FRAGMENTS"),n.requiresNormalEC&&i.push("NORMAL_EC"),t instanceof tn&&i.push("PER_INSTANCE_COLOR"),n.normalEC&&i.push("USES_NORMAL_EC"),n.positionToEyeEC&&i.push("USES_POSITION_TO_EYE_EC"),n.tangentToEyeMatrix&&i.push("USES_TANGENT_TO_EYE"),n.st&&i.push("USES_ST"),t.flat&&i.push("FLAT");let o="";return t instanceof tn||(o=t.material.shaderSource),new Oe({defines:i,sources:[o,dV]})};Sr.prototype.createPickFragmentShader=function(e){A.typeOf.bool("columbusView2D",e);const t=this._pickShaderDependencies,n=["PICK"];return!e&&!this._planarExtents&&n.push("SPHERICAL"),t.requiresEC&&n.push("REQUIRES_EC"),t.requiresWC&&n.push("REQUIRES_WC"),t.requiresTextureCoordinates&&n.push("TEXTURE_COORDINATES"),this._extentsCulling&&n.push("CULL_FRAGMENTS"),new Oe({defines:n,sources:[dV],pickColorQualifier:"in"})};Sr.prototype.createVertexShader=function(e,t,n,i){return A.defined("defines",e),A.typeOf.string("vertexShaderSource",t),A.typeOf.bool("columbusView2D",n),A.defined("mapProjection",i),hV(this._colorShaderDependencies,this._planarExtents,n,e,t,this._appearance,i,this._projectionExtentDefines)};Sr.prototype.createPickVertexShader=function(e,t,n,i){return A.defined("defines",e),A.typeOf.string("vertexShaderSource",t),A.typeOf.bool("columbusView2D",n),A.defined("mapProjection",i),hV(this._pickShaderDependencies,this._planarExtents,n,e,t,void 0,i,this._projectionExtentDefines)};const TN=new d,AN=new he,xN={high:0,low:0};function hV(e,t,n,i,o,r,s,a){const l=i.slice();if(a.eastMostYhighDefine===""){const u=AN;u.longitude=R.PI,u.latitude=0,u.height=0;const h=s.project(u,TN);let f=rn.encode(h.x,xN);a.eastMostYhighDefine=`EAST_MOST_X_HIGH ${f.high.toFixed(`${f.high}`.length+1)}`,a.eastMostYlowDefine=`EAST_MOST_X_LOW ${f.low.toFixed(`${f.low}`.length+1)}`;const _=AN;_.longitude=-R.PI,_.latitude=0,_.height=0;const g=s.project(_,TN);f=rn.encode(g.x,xN),a.westMostYhighDefine=`WEST_MOST_X_HIGH ${f.high.toFixed(`${f.high}`.length+1)}`,a.westMostYlowDefine=`WEST_MOST_X_LOW ${f.low.toFixed(`${f.low}`.length+1)}`}return n&&(l.push(a.eastMostYhighDefine),l.push(a.eastMostYlowDefine),l.push(a.westMostYhighDefine),l.push(a.westMostYlowDefine)),c(r)&&r instanceof tn&&l.push("PER_INSTANCE_COLOR"),e.requiresTextureCoordinates&&(l.push("TEXTURE_COORDINATES"),t||n||l.push("SPHERICAL"),n&&l.push("COLUMBUS_VIEW_2D")),new Oe({defines:l,sources:[o]})}function OI(){this._requiresEC=!1,this._requiresWC=!1,this._requiresNormalEC=!1,this._requiresTextureCoordinates=!1,this._usesNormalEC=!1,this._usesPositionToEyeEC=!1,this._usesTangentToEyeMat=!1,this._usesSt=!1}Object.defineProperties(OI.prototype,{requiresEC:{get:function(){return this._requiresEC},set:function(e){this._requiresEC=e||this._requiresEC}},requiresWC:{get:function(){return this._requiresWC},set:function(e){this._requiresWC=e||this._requiresWC,this.requiresEC=this._requiresWC}},requiresNormalEC:{get:function(){return this._requiresNormalEC},set:function(e){this._requiresNormalEC=e||this._requiresNormalEC,this.requiresEC=this._requiresNormalEC}},requiresTextureCoordinates:{get:function(){return this._requiresTextureCoordinates},set:function(e){this._requiresTextureCoordinates=e||this._requiresTextureCoordinates,this.requiresWC=this._requiresTextureCoordinates}},normalEC:{set:function(e){this.requiresNormalEC=e,this._usesNormalEC=e},get:function(){return this._usesNormalEC}},tangentToEyeMatrix:{set:function(e){this.requiresWC=e,this.requiresNormalEC=e,this._usesTangentToEyeMat=e},get:function(){return this._usesTangentToEyeMat}},positionToEyeEC:{set:function(e){this.requiresEC=e,this._usesPositionToEyeEC=e},get:function(){return this._usesPositionToEyeEC}},st:{set:function(e){this.requiresTextureCoordinates=e,this._usesSt=e},get:function(){return this._usesSt}}});function CN(e,t,n){return Math.abs((t.y-e.y)*n.x-(t.x-e.x)*n.y+t.x*e.y-t.y*e.x)/H.distance(t,e)}const koe=[new H,new H,new H,new H];function fV(e,t){const n=koe,i=H.unpack(t,0,n[0]),o=H.unpack(t,2,n[1]),r=H.unpack(t,4,n[2]);e.uMaxVmax=new ll({componentDatatype:Z.FLOAT,componentsPerAttribute:4,normalize:!1,value:[o.x,o.y,r.x,r.y]});const s=1/CN(i,o,r),a=1/CN(i,r,o);e.uvMinAndExtents=new ll({componentDatatype:Z.FLOAT,componentsPerAttribute:4,normalize:!1,value:[i.x,i.y,s,a]})}const pV=new he,mV=new d,Voe=new d,Hoe=new d,Qb={high:0,low:0};function _V(e,t,n){const i=pV;i.height=0,i.longitude=e.west,i.latitude=e.south;const o=t.project(i,mV);i.latitude=e.north;const r=t.project(i,Voe);i.longitude=e.east,i.latitude=e.south;const s=t.project(i,Hoe),a=[0,0,0,0],l=[0,0,0,0];let u=rn.encode(o.x,Qb);a[0]=u.high,l[0]=u.low,u=rn.encode(o.y,Qb),a[1]=u.high,l[1]=u.low,u=rn.encode(r.y,Qb),a[2]=u.high,l[2]=u.low,u=rn.encode(s.x,Qb),a[3]=u.high,l[3]=u.low,n.planes2D_HIGH=new ll({componentDatatype:Z.FLOAT,componentsPerAttribute:4,normalize:!1,value:a}),n.planes2D_LOW=new ll({componentDatatype:Z.FLOAT,componentsPerAttribute:4,normalize:!1,value:l})}const Goe=new L,joe=new L,EN=new d,Woe=new he,qoe=[new he,new he,new he,new he,new he,new he,new he,new he];function Yoe(e,t,n,i,o,r){const s=ce.center(e,Woe);s.height=n;const a=he.toCartesian(s,t,EN),l=zt.eastNorthUpToFixedFrame(a,t,Goe),u=L.inverse(l,joe),h=e.west,f=e.east,_=e.north,g=e.south,m=qoe;m[0].latitude=g,m[0].longitude=h,m[1].latitude=_,m[1].longitude=h,m[2].latitude=_,m[2].longitude=f,m[3].latitude=g,m[3].longitude=f;const b=(h+f)*.5,T=(_+g)*.5;m[4].latitude=g,m[4].longitude=b,m[5].latitude=_,m[5].longitude=b,m[6].latitude=T,m[6].longitude=h,m[7].latitude=T,m[7].longitude=f;let x=Number.POSITIVE_INFINITY,C=Number.NEGATIVE_INFINITY,w=Number.POSITIVE_INFINITY,v=Number.NEGATIVE_INFINITY;for(let M=0;M<8;M++){m[M].height=n;const U=he.toCartesian(m[M],t,EN);L.multiplyByPoint(u,U,U),U.z=0,x=Math.min(x,U.x),C=Math.max(C,U.x),w=Math.min(w,U.y),v=Math.max(v,U.y)}const P=i;P.x=x,P.y=w,P.z=0,L.multiplyByPoint(l,P,P);const N=o;N.x=C,N.y=w,N.z=0,L.multiplyByPoint(l,N,N),d.subtract(N,P,o);const k=r;k.x=x,k.y=v,k.z=0,L.multiplyByPoint(l,k,k),d.subtract(k,P,r)}const $oe=new d,Xoe=new d,Qoe=new rn;Sr.getPlanarTextureCoordinateAttributes=function(e,t,n,i,o){A.typeOf.object("boundingRectangle",e),A.defined("textureCoordinateRotationPoints",t),A.typeOf.object("ellipsoid",n),A.typeOf.object("projection",i);const r=mV,s=$oe,a=Xoe;Yoe(e,n,y(o,0),r,s,a);const l={};fV(l,t);const u=rn.fromCartesian(r,Qoe);return l.southWest_HIGH=new ll({componentDatatype:Z.FLOAT,componentsPerAttribute:3,normalize:!1,value:d.pack(u.high,[0,0,0])}),l.southWest_LOW=new ll({componentDatatype:Z.FLOAT,componentsPerAttribute:3,normalize:!1,value:d.pack(u.low,[0,0,0])}),l.eastward=new ll({componentDatatype:Z.FLOAT,componentsPerAttribute:3,normalize:!1,value:d.pack(s,[0,0,0])}),l.northward=new ll({componentDatatype:Z.FLOAT,componentsPerAttribute:3,normalize:!1,value:d.pack(a,[0,0,0])}),_V(e,i,l),l};const Koe=new d;function wN(e,t,n,i){const o=pV;o.latitude=e,o.longitude=t,o.height=0;const r=he.toCartesian(o,n,Koe),s=Math.sqrt(r.x*r.x+r.y*r.y),a=R.fastApproximateAtan2(s,r.z),l=R.fastApproximateAtan2(r.x,r.y);return i.x=a,i.y=l,i}const SN=new H;Sr.getSphericalExtentGeometryInstanceAttributes=function(e,t,n,i){A.typeOf.object("boundingRectangle",e),A.defined("textureCoordinateRotationPoints",t),A.typeOf.object("ellipsoid",n),A.typeOf.object("projection",i);const o=wN(e.south,e.west,n,SN);let r=o.x,s=o.y;const a=wN(e.north,e.east,n,SN);let l=a.x,u=a.y,h=0;s>u&&(h=R.PI-s,s=-R.PI,u+=h),r-=R.EPSILON5,s-=R.EPSILON5,l+=R.EPSILON5,u+=R.EPSILON5;const f=1/(u-s),_=1/(l-r),g={sphericalExtents:new ll({componentDatatype:Z.FLOAT,componentsPerAttribute:4,normalize:!1,value:[r,s,_,f]}),longitudeRotation:new ll({componentDatatype:Z.FLOAT,componentsPerAttribute:1,normalize:!1,value:[h]})};return fV(g,t),_V(e,i,g),g};Sr.hasAttributesForTextureCoordinatePlanes=function(e){return c(e.southWest_HIGH)&&c(e.southWest_LOW)&&c(e.northward)&&c(e.eastward)&&c(e.planes2D_HIGH)&&c(e.planes2D_LOW)&&c(e.uMaxVmax)&&c(e.uvMinAndExtents)};Sr.hasAttributesForSphericalExtents=function(e){return c(e.sphericalExtents)&&c(e.longitudeRotation)&&c(e.planes2D_HIGH)&&c(e.planes2D_LOW)&&c(e.uMaxVmax)&&c(e.uvMinAndExtents)};function Zoe(e){return Math.max(e.width,e.height)>Sr.MAX_WIDTH_FOR_PLANAR_EXTENTS}Sr.shouldUseSphericalCoordinates=function(e){return A.typeOf.object("rectangle",e),Zoe(e)};Sr.MAX_WIDTH_FOR_PLANAR_EXTENTS=R.toRadians(1);const Joe={NEVER:J.NEVER,LESS:J.LESS,EQUAL:J.EQUAL,LESS_OR_EQUAL:J.LEQUAL,GREATER:J.GREATER,NOT_EQUAL:J.NOTEQUAL,GREATER_OR_EQUAL:J.GEQUAL,ALWAYS:J.ALWAYS},Pn=Object.freeze(Joe),ere={ZERO:J.ZERO,KEEP:J.KEEP,REPLACE:J.REPLACE,INCREMENT:J.INCR,DECREMENT:J.DECR,INVERT:J.INVERT,INCREMENT_WRAP:J.INCR_WRAP,DECREMENT_WRAP:J.DECR_WRAP},nt=Object.freeze(ere),UA={CESIUM_3D_TILE_MASK:128,SKIP_LOD_MASK:112,SKIP_LOD_BIT_SHIFT:4,CLASSIFICATION_MASK:15};UA.setCesium3DTileBit=function(){return{enabled:!0,frontFunction:Pn.ALWAYS,frontOperation:{fail:nt.KEEP,zFail:nt.KEEP,zPass:nt.REPLACE},backFunction:Pn.ALWAYS,backOperation:{fail:nt.KEEP,zFail:nt.KEEP,zPass:nt.REPLACE},reference:UA.CESIUM_3D_TILE_MASK,mask:UA.CESIUM_3D_TILE_MASK}};const At=Object.freeze(UA);function Qh(e){e=y(e,y.EMPTY_OBJECT);const t=e.geometryInstances;this.geometryInstances=t,this.show=y(e.show,!0),this.classificationType=y(e.classificationType,Ui.BOTH),this.debugShowBoundingVolume=y(e.debugShowBoundingVolume,!1),this.debugShowShadowVolume=y(e.debugShowShadowVolume,!1),this._debugShowShadowVolume=!1,this._extruded=y(e._extruded,!1),this._uniformMap=e._uniformMap,this._sp=void 0,this._spStencil=void 0,this._spPick=void 0,this._spColor=void 0,this._spPick2D=void 0,this._spColor2D=void 0,this._rsStencilDepthPass=void 0,this._rsStencilDepthPass3DTiles=void 0,this._rsColorPass=void 0,this._rsPickPass=void 0,this._commandsIgnoreShow=[],this._ready=!1,this._primitive=void 0,this._pickPrimitive=e._pickPrimitive,this._hasSphericalExtentsAttribute=!1,this._hasPlanarExtentsAttributes=!1,this._hasPerColorAttribute=!1,this.appearance=e.appearance,this._createBoundingVolumeFunction=e._createBoundingVolumeFunction,this._updateAndQueueCommandsFunction=e._updateAndQueueCommandsFunction,this._usePickOffsets=!1,this._primitiveOptions={geometryInstances:void 0,appearance:void 0,vertexCacheOptimize:y(e.vertexCacheOptimize,!1),interleave:y(e.interleave,!1),releaseGeometryInstances:y(e.releaseGeometryInstances,!0),allowPicking:y(e.allowPicking,!0),asynchronous:y(e.asynchronous,!0),compressVertices:y(e.compressVertices,!0),_createBoundingVolumeFunction:void 0,_createRenderStatesFunction:void 0,_createShaderProgramFunction:void 0,_createCommandsFunction:void 0,_updateAndQueueCommandsFunction:void 0,_createPickOffsets:!0}}Object.defineProperties(Qh.prototype,{vertexCacheOptimize:{get:function(){return this._primitiveOptions.vertexCacheOptimize}},interleave:{get:function(){return this._primitiveOptions.interleave}},releaseGeometryInstances:{get:function(){return this._primitiveOptions.releaseGeometryInstances}},allowPicking:{get:function(){return this._primitiveOptions.allowPicking}},asynchronous:{get:function(){return this._primitiveOptions.asynchronous}},compressVertices:{get:function(){return this._primitiveOptions.compressVertices}},ready:{get:function(){return this._ready}},_needs2DShader:{get:function(){return this._hasPlanarExtentsAttributes||this._hasSphericalExtentsAttribute}}});Qh.isSupported=function(e){return e.context.stencilBuffer};function qm(e,t){const n=t?Pn.EQUAL:Pn.ALWAYS;return{colorMask:{red:!1,green:!1,blue:!1,alpha:!1},stencilTest:{enabled:e,frontFunction:n,frontOperation:{fail:nt.KEEP,zFail:nt.DECREMENT_WRAP,zPass:nt.KEEP},backFunction:n,backOperation:{fail:nt.KEEP,zFail:nt.INCREMENT_WRAP,zPass:nt.KEEP},reference:At.CESIUM_3D_TILE_MASK,mask:At.CESIUM_3D_TILE_MASK},stencilMask:At.CLASSIFICATION_MASK,depthTest:{enabled:!0,func:lp.LESS_OR_EQUAL},depthMask:!1}}function LI(e){return{stencilTest:{enabled:e,frontFunction:Pn.NOT_EQUAL,frontOperation:{fail:nt.ZERO,zFail:nt.ZERO,zPass:nt.ZERO},backFunction:Pn.NOT_EQUAL,backOperation:{fail:nt.ZERO,zFail:nt.ZERO,zPass:nt.ZERO},reference:0,mask:At.CLASSIFICATION_MASK},stencilMask:At.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1,blending:Zn.PRE_MULTIPLIED_ALPHA_BLEND}}const tre={stencilTest:{enabled:!0,frontFunction:Pn.NOT_EQUAL,frontOperation:{fail:nt.ZERO,zFail:nt.ZERO,zPass:nt.ZERO},backFunction:Pn.NOT_EQUAL,backOperation:{fail:nt.ZERO,zFail:nt.ZERO,zPass:nt.ZERO},reference:0,mask:At.CLASSIFICATION_MASK},stencilMask:At.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1};function nre(e,t,n,i){if(c(e._rsStencilDepthPass))return;const o=!e.debugShowShadowVolume;e._rsStencilDepthPass=Ue.fromCache(qm(o,!1)),e._rsStencilDepthPass3DTiles=Ue.fromCache(qm(o,!0)),e._rsColorPass=Ue.fromCache(LI(o)),e._rsPickPass=Ue.fromCache(tre)}function ire(e,t){if(!e.compressVertices)return t;if(t.search(/in\s+vec3\s+extrudeDirection;/g)!==-1){const n="compressedAttributes",i=`in vec2 ${n};`,o=`vec3 extrudeDirection;
|
|
`,r=` extrudeDirection = czm_octDecode(${n}, 65535.0);
|
|
`;let s=t;s=s.replace(/in\s+vec3\s+extrudeDirection;/g,""),s=Oe.replaceMain(s,"czm_non_compressed_main");const a=`void main()
|
|
{
|
|
${r} czm_non_compressed_main();
|
|
}`;return[i,o,s,a].join(`
|
|
`)}}function ore(e,t){const n=t.context,i=e._primitive;let o=sie;o=e._primitive._batchTable.getVertexShaderCallback()(o),o=Mt._appendDistanceDisplayConditionToShader(i,o),o=Mt._modifyShaderPosition(e,o,t.scene3DOnly),o=Mt._updateColorAttribute(i,o);const r=e._hasPlanarExtentsAttributes,s=r||e._hasSphericalExtentsAttribute;e._extruded&&(o=ire(i,o));const a=e._extruded?"EXTRUDED_GEOMETRY":"";let l=new Oe({defines:[a],sources:[o]});const u=new Oe({sources:[wI]}),h=e._primitive._attributeLocations,f=new Sr(s,r,e.appearance);if(e._spStencil=Jt.replaceCache({context:n,shaderProgram:e._spStencil,vertexShaderSource:l,fragmentShaderSource:u,attributeLocations:h}),e._primitive.allowPicking){let m=Oe.createPickVertexShaderSource(o);m=Mt._appendShowToShader(i,m),m=Mt._updatePickColorAttribute(m);const b=f.createPickFragmentShader(!1),T=f.createPickVertexShader([a],m,!1,t.mapProjection);if(e._spPick=Jt.replaceCache({context:n,shaderProgram:e._spPick,vertexShaderSource:T,fragmentShaderSource:b,attributeLocations:h}),s){let x=n.shaderCache.getDerivedShaderProgram(e._spPick,"2dPick");if(!c(x)){const C=f.createPickFragmentShader(!0),w=f.createPickVertexShader([a],m,!0,t.mapProjection);x=n.shaderCache.createDerivedShaderProgram(e._spPick,"2dPick",{vertexShaderSource:w,fragmentShaderSource:C,attributeLocations:h})}e._spPick2D=x}}else e._spPick=Jt.fromCache({context:n,vertexShaderSource:l,fragmentShaderSource:u,attributeLocations:h});o=Mt._appendShowToShader(i,o),l=new Oe({defines:[a],sources:[o]}),e._sp=Jt.replaceCache({context:n,shaderProgram:e._sp,vertexShaderSource:l,fragmentShaderSource:u,attributeLocations:h});const _=f.createFragmentShader(!1),g=f.createVertexShader([a],o,!1,t.mapProjection);if(e._spColor=Jt.replaceCache({context:n,shaderProgram:e._spColor,vertexShaderSource:g,fragmentShaderSource:_,attributeLocations:h}),s){let m=n.shaderCache.getDerivedShaderProgram(e._spColor,"2dColor");if(!c(m)){const b=f.createFragmentShader(!0),T=f.createVertexShader([a],o,!0,t.mapProjection);m=n.shaderCache.createDerivedShaderProgram(e._spColor,"2dColor",{vertexShaderSource:T,fragmentShaderSource:b,attributeLocations:h})}e._spColor2D=m}}function rre(e,t){const n=e._primitive;let i=n._va.length*2;t.length=i;let o,r,s,a=0,l=n._batchTable.getUniformMapCallback()(e._uniformMap);const u=e._needs2DShader;for(o=0;o<i;o+=2){const g=n._va[a++];r=t[o],c(r)||(r=t[o]=new Ze({owner:e,primitiveType:n._primitiveType})),r.vertexArray=g,r.renderState=e._rsStencilDepthPass,r.shaderProgram=e._sp,r.uniformMap=l,r.pass=xe.TERRAIN_CLASSIFICATION,s=Ze.shallowClone(r,r.derivedCommands.tileset),s.renderState=e._rsStencilDepthPass3DTiles,s.pass=xe.CESIUM_3D_TILE_CLASSIFICATION,r.derivedCommands.tileset=s,r=t[o+1],c(r)||(r=t[o+1]=new Ze({owner:e,primitiveType:n._primitiveType})),r.vertexArray=g,r.renderState=e._rsColorPass,r.shaderProgram=e._spColor,r.pass=xe.TERRAIN_CLASSIFICATION;const b=e.appearance.material;if(c(b)&&(l=jt(l,b._uniforms)),r.uniformMap=l,s=Ze.shallowClone(r,r.derivedCommands.tileset),s.pass=xe.CESIUM_3D_TILE_CLASSIFICATION,r.derivedCommands.tileset=s,u){let T=Ze.shallowClone(r,r.derivedCommands.appearance2D);T.shaderProgram=e._spColor2D,r.derivedCommands.appearance2D=T,T=Ze.shallowClone(s,s.derivedCommands.appearance2D),T.shaderProgram=e._spColor2D,s.derivedCommands.appearance2D=T}}const h=e._commandsIgnoreShow,f=e._spStencil;let _=0;i=h.length=i/2;for(let g=0;g<i;++g){const m=h[g]=Ze.shallowClone(t[_],h[g]);m.shaderProgram=f,m.pass=xe.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW,_+=2}}function sre(e,t){const n=e._usePickOffsets,i=e._primitive;let o=i._va.length*2,r,s=0,a;n&&(r=i._pickOffsets,o=r.length*2),t.length=o;let l,u,h,f=0;const _=i._batchTable.getUniformMapCallback()(e._uniformMap),g=e._needs2DShader;for(l=0;l<o;l+=2){let m=i._va[f++];if(n&&(a=r[s++],m=i._va[a.index]),u=t[l],c(u)||(u=t[l]=new Ze({owner:e,primitiveType:i._primitiveType,pickOnly:!0})),u.vertexArray=m,u.renderState=e._rsStencilDepthPass,u.shaderProgram=e._sp,u.uniformMap=_,u.pass=xe.TERRAIN_CLASSIFICATION,n&&(u.offset=a.offset,u.count=a.count),h=Ze.shallowClone(u,u.derivedCommands.tileset),h.renderState=e._rsStencilDepthPass3DTiles,h.pass=xe.CESIUM_3D_TILE_CLASSIFICATION,u.derivedCommands.tileset=h,u=t[l+1],c(u)||(u=t[l+1]=new Ze({owner:e,primitiveType:i._primitiveType,pickOnly:!0})),u.vertexArray=m,u.renderState=e._rsPickPass,u.shaderProgram=e._spPick,u.uniformMap=_,u.pass=xe.TERRAIN_CLASSIFICATION,n&&(u.offset=a.offset,u.count=a.count),h=Ze.shallowClone(u,u.derivedCommands.tileset),h.pass=xe.CESIUM_3D_TILE_CLASSIFICATION,u.derivedCommands.tileset=h,g){let b=Ze.shallowClone(u,u.derivedCommands.pick2D);b.shaderProgram=e._spPick2D,u.derivedCommands.pick2D=b,b=Ze.shallowClone(h,h.derivedCommands.pick2D),b.shaderProgram=e._spPick2D,h.derivedCommands.pick2D=b}}}function are(e,t,n,i,o,r,s){rre(e,r),sre(e,s)}function vN(e,t){return Math.floor(e%t/2)}function Tw(e,t,n,i,o,r){e.modelMatrix=n,e.boundingVolume=o,e.cull=i,e.debugShowBoundingVolume=r,t.commandList.push(e)}function IN(e,t,n,i,o){e.modelMatrix=n,e.boundingVolume=o,e.cull=i,t.commandList.push(e)}function cre(e,t,n,i,o,r,s,a){const l=e._primitive;Mt._updateBoundingVolumes(l,t,o);let u;t.mode===oe.SCENE3D?u=l._boundingSphereWC:t.mode===oe.COLUMBUS_VIEW?u=l._boundingSphereCV:t.mode===oe.SCENE2D&&c(l._boundingSphere2D)?u=l._boundingSphere2D:c(l._boundingSphereMorph)&&(u=l._boundingSphereMorph);const h=e.classificationType,f=h!==Ui.CESIUM_3D_TILE,_=h!==Ui.TERRAIN,g=t.passes;let m,b,T;if(g.render){const x=n.length;for(m=0;m<x;++m)b=u[vN(m,x)],f&&(T=n[m],Tw(T,t,o,r,b,s)),_&&(T=n[m].derivedCommands.tileset,Tw(T,t,o,r,b,s));if(t.invertClassification){const C=e._commandsIgnoreShow,w=C.length;for(m=0;m<w;++m)b=u[m],T=C[m],Tw(T,t,o,r,b,s)}}if(g.pick){const x=i.length,C=l._pickOffsets;for(m=0;m<x;++m){const w=C[vN(m,x)];b=u[w.index],f&&(T=i[m],IN(T,t,o,r,b)),_&&(T=i[m].derivedCommands.tileset,IN(T,t,o,r,b))}}}Qh.prototype.update=function(e){if(!c(this._primitive)&&!c(this.geometryInstances))return;let t=this.appearance;c(t)&&c(t.material)&&t.material.update(e.context);const n=this,i=this._primitiveOptions;if(!c(this._primitive)){const o=Array.isArray(this.geometryInstances)?this.geometryInstances:[this.geometryInstances],r=o.length;let s,a,l,u=!1,h=!0,f,_=!1,g=!1;for(r>0&&(l=o[0].attributes,_=Sr.hasAttributesForSphericalExtents(l),g=Sr.hasAttributesForTextureCoordinatePlanes(l),f=l.color),s=0;s<r;s++){a=o[s];const b=a.attributes.color;if(c(b))u=!0;else if(u)throw new E("All GeometryInstances must have color attributes to use per-instance color.");h=h&&c(b)&&$t.equals(f,b)}if(!h&&!_&&!g)throw new E("All GeometryInstances must have the same color attribute except via GroundPrimitives");if(u&&!c(t)&&(t=new tn({flat:!0}),this.appearance=t),!u&&t instanceof tn)throw new E("PerInstanceColorAppearance requires color GeometryInstanceAttributes on all GeometryInstances");if(c(t.material)&&!_&&!g)throw new E("Materials on ClassificationPrimitives are not supported except via GroundPrimitives");this._usePickOffsets=!_&&!g,this._hasSphericalExtentsAttribute=_,this._hasPlanarExtentsAttributes=g,this._hasPerColorAttribute=u;const m=new Array(r);for(s=0;s<r;++s)a=o[s],m[s]=new Gt({geometry:a.geometry,attributes:a.attributes,modelMatrix:a.modelMatrix,id:a.id,pickPrimitive:y(this._pickPrimitive,n)});i.appearance=t,i.geometryInstances=m,c(this._createBoundingVolumeFunction)&&(i._createBoundingVolumeFunction=function(b,T){n._createBoundingVolumeFunction(b,T)}),i._createRenderStatesFunction=function(b,T,x,C){nre(n)},i._createShaderProgramFunction=function(b,T,x){ore(n,T)},i._createCommandsFunction=function(b,T,x,C,w,v,P){are(n,void 0,void 0,!0,!1,v,P)},c(this._updateAndQueueCommandsFunction)?i._updateAndQueueCommandsFunction=function(b,T,x,C,w,v,P,N){n._updateAndQueueCommandsFunction(b,T,x,C,w,v,P,N)}:i._updateAndQueueCommandsFunction=function(b,T,x,C,w,v,P,N){cre(n,T,x,C,w,v,P)},this._primitive=new Mt(i)}if(this.debugShowShadowVolume&&!this._debugShowShadowVolume&&this._ready?(this._debugShowShadowVolume=!0,this._rsStencilDepthPass=Ue.fromCache(qm(!1,!1)),this._rsStencilDepthPass3DTiles=Ue.fromCache(qm(!1,!0)),this._rsColorPass=Ue.fromCache(LI(!1))):!this.debugShowShadowVolume&&this._debugShowShadowVolume&&(this._debugShowShadowVolume=!1,this._rsStencilDepthPass=Ue.fromCache(qm(!0,!1)),this._rsStencilDepthPass3DTiles=Ue.fromCache(qm(!0,!0)),this._rsColorPass=Ue.fromCache(LI(!0))),this._primitive.appearance!==t){if(!this._hasSphericalExtentsAttribute&&!this._hasPlanarExtentsAttributes&&c(t.material))throw new E("Materials on ClassificationPrimitives are not supported except via GroundPrimitive");if(!this._hasPerColorAttribute&&t instanceof tn)throw new E("PerInstanceColorAppearance requires color GeometryInstanceAttribute");this._primitive.appearance=t}this._primitive.show=this.show,this._primitive.debugShowBoundingVolume=this.debugShowBoundingVolume,this._primitive.update(e),e.afterRender.push(()=>{c(this._primitive)&&this._primitive.ready&&(this._ready=!0,this.releaseGeometryInstances&&(this.geometryInstances=void 0))})};Qh.prototype.getGeometryInstanceAttributes=function(e){if(!c(this._primitive))throw new E("must call update before calling getGeometryInstanceAttributes");return this._primitive.getGeometryInstanceAttributes(e)};Qh.prototype.isDestroyed=function(){return!1};Qh.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),this._sp=this._sp&&this._sp.destroy(),this._spPick=this._spPick&&this._spPick.destroy(),this._spColor=this._spColor&&this._spColor.destroy(),this._spPick2D=void 0,this._spColor2D=void 0,ve(this)};const lre={u_globeMinimumAltitude:function(){return 55e3}};function sr(e){e=y(e,y.EMPTY_OBJECT);let t=e.appearance;const n=e.geometryInstances;if(!c(t)&&c(n)){const o=Array.isArray(n)?n:[n],r=o.length;for(let s=0;s<r;s++){const a=o[s].attributes;if(c(a)&&c(a.color)){t=new tn({flat:!0});break}}}this.appearance=t,this.geometryInstances=e.geometryInstances,this.show=y(e.show,!0),this.classificationType=y(e.classificationType,Ui.BOTH),this.debugShowBoundingVolume=y(e.debugShowBoundingVolume,!1),this.debugShowShadowVolume=y(e.debugShowShadowVolume,!1),this._boundingVolumes=[],this._boundingVolumes2D=[],this._ready=!1,this._primitive=void 0,this._maxHeight=void 0,this._minHeight=void 0,this._maxTerrainHeight=Ti._defaultMaxTerrainHeight,this._minTerrainHeight=Ti._defaultMinTerrainHeight,this._boundingSpheresKeys=[],this._boundingSpheres=[],this._useFragmentCulling=!1,this._zIndex=void 0;const i=this;this._classificationPrimitiveOptions={geometryInstances:void 0,appearance:void 0,vertexCacheOptimize:y(e.vertexCacheOptimize,!1),interleave:y(e.interleave,!1),releaseGeometryInstances:y(e.releaseGeometryInstances,!0),allowPicking:y(e.allowPicking,!0),asynchronous:y(e.asynchronous,!0),compressVertices:y(e.compressVertices,!0),_createBoundingVolumeFunction:void 0,_updateAndQueueCommandsFunction:void 0,_pickPrimitive:i,_extruded:!0,_uniformMap:lre}}Object.defineProperties(sr.prototype,{vertexCacheOptimize:{get:function(){return this._classificationPrimitiveOptions.vertexCacheOptimize}},interleave:{get:function(){return this._classificationPrimitiveOptions.interleave}},releaseGeometryInstances:{get:function(){return this._classificationPrimitiveOptions.releaseGeometryInstances}},allowPicking:{get:function(){return this._classificationPrimitiveOptions.allowPicking}},asynchronous:{get:function(){return this._classificationPrimitiveOptions.asynchronous}},compressVertices:{get:function(){return this._classificationPrimitiveOptions.compressVertices}},ready:{get:function(){return this._ready}}});sr.isSupported=Qh.isSupported;function DN(e){return function(t,n){const i=n.maximumRadius,o=i/Math.cos(t*.5)-i;return e._maxHeight+o}}function PN(e){return function(t,n){return e._minHeight}}const ure=new d,dre=new d,hre=new d,fre=new he,pre=new ce;function kA(e,t){const n=e.mapProjection.ellipsoid;if(!c(t.attributes)||!c(t.attributes.position3DHigh))return c(t.rectangle)?t.rectangle:void 0;const i=t.attributes.position3DHigh.values,o=t.attributes.position3DLow.values,r=i.length;let s=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY,u=Number.NEGATIVE_INFINITY;for(let f=0;f<r;f+=3){const _=d.unpack(i,f,ure),g=d.unpack(o,f,dre),m=d.add(_,g,hre),b=n.cartesianToCartographic(m,fre),T=b.latitude,x=b.longitude;s=Math.min(s,T),a=Math.min(a,x),l=Math.max(l,T),u=Math.max(u,x)}const h=pre;return h.north=l,h.south=s,h.east=u,h.west=a,h}function mre(e,t,n){const i=Ti.getMinimumMaximumHeights(t,n);e._minTerrainHeight=i.minimumTerrainHeight,e._maxTerrainHeight=i.maximumTerrainHeight}function _re(e,t,n){const i=t.mapProjection.ellipsoid,o=kA(t,n),r=Ct.fromRectangle(o,e._minHeight,e._maxHeight,i);if(e._boundingVolumes.push(r),!t.scene3DOnly){const s=t.mapProjection,a=se.fromRectangleWithHeights2D(o,s,e._maxHeight,e._minHeight);d.fromElements(a.center.z,a.center.x,a.center.y,a.center),e._boundingVolumes2D.push(a)}}function Aw(e,t){return Math.floor(e%t/2)}function xw(e,t,n,i,o,r,s){const a=e._primitive;n.mode!==oe.SCENE3D&&t.shaderProgram===a._spColor&&a._needs2DShader&&(t=t.derivedCommands.appearance2D),t.owner=e,t.modelMatrix=i,t.boundingVolume=r,t.cull=o,t.debugShowBoundingVolume=s,n.commandList.push(t)}function ON(e,t,n,i,o,r){const s=e._primitive;n.mode!==oe.SCENE3D&&t.shaderProgram===s._spPick&&s._needs2DShader&&(t=t.derivedCommands.pick2D),t.owner=e,t.modelMatrix=i,t.boundingVolume=r,t.cull=o,n.commandList.push(t)}function gre(e,t,n,i,o,r,s,a){let l;t.mode===oe.SCENE3D?l=e._boundingVolumes:l=e._boundingVolumes2D;const u=e.classificationType,h=u!==Ui.CESIUM_3D_TILE,f=u!==Ui.TERRAIN,_=t.passes,g=e._primitive;let m,b,T;if(_.render){const x=n.length;for(m=0;m<x;++m)b=l[Aw(m,x)],h&&(T=n[m],xw(e,T,t,o,r,b,s)),f&&(T=n[m].derivedCommands.tileset,xw(e,T,t,o,r,b,s));if(t.invertClassification){const C=g._commandsIgnoreShow,w=C.length;for(m=0;m<w;++m)b=l[m],T=C[m],xw(e,T,t,o,r,b,s)}}if(_.pick){const x=i.length;let C;for(e._useFragmentCulling||(C=g._primitive._pickOffsets),m=0;m<x;++m){if(b=l[Aw(m,x)],!e._useFragmentCulling){const w=C[Aw(m,x)];b=l[w.index]}h&&(T=i[m],ON(e,T,t,o,r,b)),f&&(T=i[m].derivedCommands.tileset,ON(e,T,t,o,r,b))}}}sr.initializeTerrainHeights=function(){return Ti.initialize()};sr.prototype.update=function(e){if(!c(this._primitive)&&!c(this.geometryInstances))return;if(!Ti.initialized){if(!this.asynchronous)throw new E("For synchronous GroundPrimitives, you must call GroundPrimitive.initializeTerrainHeights() and wait for the returned promise to resolve.");sr.initializeTerrainHeights();return}const t=this,n=this._classificationPrimitiveOptions;if(!c(this._primitive)){const i=e.mapProjection.ellipsoid;let o,r,s;const a=Array.isArray(this.geometryInstances)?this.geometryInstances:[this.geometryInstances],l=a.length,u=new Array(l);let h,f;for(h=0;h<l;++h){o=a[h],r=o.geometry;const b=kA(e,r);c(f)?c(b)&&ce.union(f,b,f):f=ce.clone(b);const T=o.id;if(c(T)&&c(b)){const x=Ti.getBoundingSphere(b,i);this._boundingSpheresKeys.push(T),this._boundingSpheres.push(x)}if(s=r.constructor,!c(s)||!c(s.createShadowVolume))throw new E("Not all of the geometry instances have GroundPrimitive support.")}mre(this,f,i);const _=e.verticalExaggeration,g=e.verticalExaggerationRelativeHeight;this._minHeight=oa.getHeight(this._minTerrainHeight,_,g),this._maxHeight=oa.getHeight(this._maxTerrainHeight,_,g);const m=sr._supportsMaterials(e.context);if(this._useFragmentCulling=m,m){let b,T=!0;for(h=0;h<l;++h)if(o=a[h],r=o.geometry,f=kA(e,r),Sr.shouldUseSphericalCoordinates(f)){T=!1;break}for(h=0;h<l;++h){o=a[h],r=o.geometry,s=r.constructor;const x=kA(e,r),C=r.textureCoordinateRotationPoints;T?b=Sr.getPlanarTextureCoordinateAttributes(x,C,i,e.mapProjection,this._maxHeight):b=Sr.getSphericalExtentGeometryInstanceAttributes(x,C,i,e.mapProjection);const w=o.attributes;for(const v in w)w.hasOwnProperty(v)&&(b[v]=w[v]);u[h]=new Gt({geometry:s.createShadowVolume(r,PN(this),DN(this)),attributes:b,id:o.id})}}else for(h=0;h<l;++h)o=a[h],r=o.geometry,s=r.constructor,u[h]=new Gt({geometry:s.createShadowVolume(r,PN(this),DN(this)),attributes:o.attributes,id:o.id});n.geometryInstances=u,n.appearance=this.appearance,n._createBoundingVolumeFunction=function(b,T){_re(t,b,T)},n._updateAndQueueCommandsFunction=function(b,T,x,C,w,v,P,N){gre(t,T,x,C,w,v,P)},this._primitive=new Qh(n)}this._primitive.appearance=this.appearance,this._primitive.show=this.show,this._primitive.debugShowShadowVolume=this.debugShowShadowVolume,this._primitive.debugShowBoundingVolume=this.debugShowBoundingVolume,this._primitive.update(e),e.afterRender.push(()=>{!this._ready&&c(this._primitive)&&this._primitive.ready&&(this._ready=!0,this.releaseGeometryInstances&&(this.geometryInstances=void 0))})};sr.prototype.getBoundingSphere=function(e){const t=this._boundingSpheresKeys.indexOf(e);if(t!==-1)return this._boundingSpheres[t]};sr.prototype.getGeometryInstanceAttributes=function(e){if(!c(this._primitive))throw new E("must call update before calling getGeometryInstanceAttributes");return this._primitive.getGeometryInstanceAttributes(e)};sr.prototype.isDestroyed=function(){return!1};sr.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),ve(this)};sr._supportsMaterials=function(e){return e.depthTexture};sr.supportsMaterials=function(e){return A.typeOf.object("scene",e),sr._supportsMaterials(e.frameState.context)};function Go(){E.throwInstantiationError()}Object.defineProperties(Go.prototype,{isConstant:{get:E.throwInstantiationError},definitionChanged:{get:E.throwInstantiationError}});Go.prototype.getType=E.throwInstantiationError;Go.prototype.getValue=E.throwInstantiationError;Go.prototype.equals=E.throwInstantiationError;Go.getValue=function(e,t,n){let i;return c(t)&&(i=t.getType(e),c(i))?((!c(n)||n.type!==i)&&(n=Se.fromType(i)),t.getValue(e,n.uniforms),n):((!c(n)||n.type!==Se.ColorType)&&(n=Se.fromType(Se.ColorType)),z.clone(z.WHITE,n.uniforms.color),n)};function On(e,t,n){A.defined("geometryUpdater",e),A.defined("primitives",t),A.defined("orderedGroundPrimitives",n),this._primitives=t,this._orderedGroundPrimitives=n,this._primitive=void 0,this._outlinePrimitive=void 0,this._geometryUpdater=e,this._options=e._options,this._entity=e._entity,this._material=void 0}On.prototype._isHidden=function(e,t,n){return!e.isShowing||!e.isAvailable(n)||!K.getValueOrDefault(t.show,n,!0)};On.prototype._setOptions=E.throwInstantiationError;On.prototype.update=function(e){A.defined("time",e);const t=this._geometryUpdater,n=t._onTerrain,i=this._primitives,o=this._orderedGroundPrimitives;n?o.remove(this._primitive):(i.removeAndDestroy(this._primitive),i.removeAndDestroy(this._outlinePrimitive),this._outlinePrimitive=void 0),this._primitive=void 0;const r=this._entity,s=r[this._geometryUpdater._geometryPropertyName];if(this._setOptions(r,s,e),this._isHidden(r,s,e))return;const a=this._geometryUpdater.shadowsProperty.getValue(e),l=this._options;if(!c(s.fill)||s.fill.getValue(e)){const u=t.fillMaterialProperty,h=u instanceof kt;let f;const _=t._getIsClosed(l);if(h)f=new tn({closed:_,flat:n&&!t._supportsMaterialsforEntitiesOnTerrain});else{const g=Go.getValue(e,u,this._material);this._material=g,f=new oo({material:g,translucent:g.isTranslucent(),closed:_})}if(n)l.vertexFormat=tn.VERTEX_FORMAT,this._primitive=o.add(new sr({geometryInstances:this._geometryUpdater.createFillGeometryInstance(e),appearance:f,asynchronous:!1,shadows:a,classificationType:this._geometryUpdater.classificationTypeProperty.getValue(e)}),K.getValueOrUndefined(this._geometryUpdater.zIndex,e));else{l.vertexFormat=f.vertexFormat;const g=this._geometryUpdater.createFillGeometryInstance(e);h&&(f.translucent=g.attributes.color.value[3]!==255),this._primitive=i.add(new Mt({geometryInstances:g,appearance:f,asynchronous:!1,shadows:a}))}}if(!n&&c(s.outline)&&s.outline.getValue(e)){const u=this._geometryUpdater.createOutlineGeometryInstance(e),h=K.getValueOrDefault(s.outlineWidth,e,1);this._outlinePrimitive=i.add(new Mt({geometryInstances:u,appearance:new tn({flat:!0,translucent:u.attributes.color.value[3]!==255,renderState:{lineWidth:t._scene.clampLineWidth(h)}}),asynchronous:!1,shadows:a}))}};On.prototype.getBoundingSphere=function(e){if(!c(e))throw new E("result is required.");const t=this._entity,n=this._primitive,i=this._outlinePrimitive;let o;return c(n)&&n.show&&n.ready&&(o=n.getGeometryInstanceAttributes(t),c(o)&&c(o.boundingSphere))||c(i)&&i.show&&i.ready&&(o=i.getGeometryInstanceAttributes(t),c(o)&&c(o.boundingSphere))?(se.clone(o.boundingSphere,e),rt.DONE):c(n)&&!n.ready||c(i)&&!i.ready?rt.PENDING:rt.FAILED};On.prototype.isDestroyed=function(){return!1};On.prototype.destroy=function(){const e=this._primitives,t=this._orderedGroundPrimitives;this._geometryUpdater._onTerrain?t.remove(this._primitive):e.removeAndDestroy(this._primitive),e.removeAndDestroy(this._outlinePrimitive),ve(this)};const yre={NONE:0,GEODESIC:1,RHUMB:2},cn=Object.freeze(yre),LN=R.EPSILON10;function gs(e,t,n,i){if(A.defined("equalsEpsilon",t),!c(e))return;n=y(n,!1);const o=c(i),r=e.length;if(r<2)return e;let s,a=e[0],l,u,h=0,f=-1;for(s=1;s<r;++s)l=e[s],t(a,l,LN)?(c(u)||(u=e.slice(0,s),h=s-1,f=0),o&&i.push(s)):(c(u)&&(u.push(l),h=s,o&&(f=i.length)),a=l);return n&&t(e[0],e[r-1],LN)&&(o&&(c(u)?i.splice(f,0,h):i.push(r-1)),c(u)?u.length-=1:u=e.slice(0,-1)),c(u)?u:e}function bre(e){const t=e._uSquared,n=e._ellipsoid.maximumRadius,i=e._ellipsoid.minimumRadius,o=(n-i)/n,r=Math.cos(e._startHeading),s=Math.sin(e._startHeading),a=(1-o)*Math.tan(e._start.latitude),l=1/Math.sqrt(1+a*a),u=l*a,h=Math.atan2(a,r),f=l*s,_=f*f,g=1-_,m=Math.sqrt(g),b=t/4,T=b*b,x=T*b,C=T*T,w=1+b-3*T/4+5*x/4-175*C/64,v=1-b+15*T/8-35*x/8,P=1-3*b+35*T/4,N=1-5*b,k=w*h-v*Math.sin(2*h)*b/2-P*Math.sin(4*h)*T/16-N*Math.sin(6*h)*x/48-Math.sin(8*h)*5*C/512,M=e._constants;M.a=n,M.b=i,M.f=o,M.cosineHeading=r,M.sineHeading=s,M.tanU=a,M.cosineU=l,M.sineU=u,M.sigma=h,M.sineAlpha=f,M.sineSquaredAlpha=_,M.cosineSquaredAlpha=g,M.cosineAlpha=m,M.u2Over4=b,M.u4Over16=T,M.u6Over64=x,M.u8Over256=C,M.a0=w,M.a1=v,M.a2=P,M.a3=N,M.distanceRatio=k}function Tre(e,t){return e*t*(4+e*(4-3*t))/16}function gV(e,t,n,i,o,r,s){const a=Tre(e,n);return(1-a)*e*t*(i+a*o*(s+a*r*(2*s*s-1)))}function Are(e,t,n,i,o,r,s){const a=(t-n)/t,l=r-i,u=Math.atan((1-a)*Math.tan(o)),h=Math.atan((1-a)*Math.tan(s)),f=Math.cos(u),_=Math.sin(u),g=Math.cos(h),m=Math.sin(h),b=f*g,T=f*m,x=_*m,C=_*g;let w=l,v=R.TWO_PI,P=Math.cos(w),N=Math.sin(w),k,M,U,B,S;do{P=Math.cos(w),N=Math.sin(w);const W=T-C*P;U=Math.sqrt(g*g*N*N+W*W),M=x+b*P,k=Math.atan2(U,M);let X;U===0?(X=0,B=1):(X=b*N/U,B=1-X*X),v=w,S=M-2*x/B,isFinite(S)||(S=0),w=l+gV(a,X,B,k,U,M,S)}while(Math.abs(w-v)>R.EPSILON12);const D=B*(t*t-n*n)/(n*n),p=1+D*(4096+D*(D*(320-175*D)-768))/16384,I=D*(256+D*(D*(74-47*D)-128))/1024,O=S*S,F=I*U*(S+I*(M*(2*O-1)-I*S*(4*U*U-3)*(4*O-3)/6)/4),V=n*p*(k-F),G=Math.atan2(g*N,T-C*P),j=Math.atan2(f*N,T*P-C);e._distance=V,e._startHeading=G,e._endHeading=j,e._uSquared=D}const xre=new d,Cw=new d;function yV(e,t,n,i){const o=d.normalize(i.cartographicToCartesian(t,Cw),xre),r=d.normalize(i.cartographicToCartesian(n,Cw),Cw);A.typeOf.number.greaterThanOrEquals("value",Math.abs(Math.abs(d.angleBetween(o,r))-Math.PI),.0125),Are(e,i.maximumRadius,i.minimumRadius,t.longitude,t.latitude,n.longitude,n.latitude),e._start=he.clone(t,e._start),e._end=he.clone(n,e._end),e._start.height=0,e._end.height=0,bre(e)}function Mp(e,t,n){const i=y(n,ae.WGS84);this._ellipsoid=i,this._start=new he,this._end=new he,this._constants={},this._startHeading=void 0,this._endHeading=void 0,this._distance=void 0,this._uSquared=void 0,c(e)&&c(t)&&yV(this,e,t,i)}Object.defineProperties(Mp.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},surfaceDistance:{get:function(){return A.defined("distance",this._distance),this._distance}},start:{get:function(){return this._start}},end:{get:function(){return this._end}},startHeading:{get:function(){return A.defined("distance",this._distance),this._startHeading}},endHeading:{get:function(){return A.defined("distance",this._distance),this._endHeading}}});Mp.prototype.setEndPoints=function(e,t){A.defined("start",e),A.defined("end",t),yV(this,e,t,this._ellipsoid)};Mp.prototype.interpolateUsingFraction=function(e,t){return this.interpolateUsingSurfaceDistance(this._distance*e,t)};Mp.prototype.interpolateUsingSurfaceDistance=function(e,t){A.defined("distance",this._distance);const n=this._constants,i=n.distanceRatio+e/n.b,o=Math.cos(2*i),r=Math.cos(4*i),s=Math.cos(6*i),a=Math.sin(2*i),l=Math.sin(4*i),u=Math.sin(6*i),h=Math.sin(8*i),f=i*i,_=i*f,g=n.u8Over256,m=n.u2Over4,b=n.u6Over64,T=n.u4Over16;let x=2*_*g*o/3+i*(1-m+7*T/4-15*b/4+579*g/64-(T-15*b/4+187*g/16)*o-(5*b/4-115*g/16)*r-29*g*s/16)+(m/2-T+71*b/32-85*g/16)*a+(5*T/16-5*b/4+383*g/96)*l-f*((b-11*g/2)*a+5*g*l/2)+(29*b/96-29*g/16)*u+539*g*h/1536;const C=Math.asin(Math.sin(x)*n.cosineAlpha),w=Math.atan(n.a/n.b*Math.tan(C));x=x-n.sigma;const v=Math.cos(2*n.sigma+x),P=Math.sin(x),N=Math.cos(x),k=n.cosineU*N,M=n.sineU*P,B=Math.atan2(P*n.sineHeading,k-M*n.cosineHeading)-gV(n.f,n.sineAlpha,n.cosineSquaredAlpha,x,P,N,v);return c(t)?(t.longitude=this._start.longitude+B,t.latitude=w,t.height=0,t):new he(this._start.longitude+B,w,0)};function RI(e,t,n){if(e===0)return t*n;const i=e*e,o=i*i,r=o*i,s=r*i,a=s*i,l=a*i,u=n,h=Math.sin(2*u),f=Math.sin(4*u),_=Math.sin(6*u),g=Math.sin(8*u),m=Math.sin(10*u),b=Math.sin(12*u);return t*((1-i/4-3*o/64-5*r/256-175*s/16384-441*a/65536-4851*l/1048576)*u-(3*i/8+3*o/32+45*r/1024+105*s/4096+2205*a/131072+6237*l/524288)*h+(15*o/256+45*r/1024+525*s/16384+1575*a/65536+155925*l/8388608)*f-(35*r/3072+175*s/12288+3675*a/262144+13475*l/1048576)*_+(315*s/131072+2205*a/524288+43659*l/8388608)*g-(693*a/1310720+6237*l/5242880)*m+1001*l/8388608*b)}function Cre(e,t,n){const i=e/n;if(t===0)return i;const o=i*i,r=o*i,s=r*i,a=t,l=a*a,u=l*l,h=u*l,f=h*l,_=f*l,g=_*l,m=Math.sin(2*i),b=Math.cos(2*i),T=Math.sin(4*i),x=Math.cos(4*i),C=Math.sin(6*i),w=Math.cos(6*i),v=Math.sin(8*i),P=Math.cos(8*i),N=Math.sin(10*i),k=Math.cos(10*i),M=Math.sin(12*i);return i+i*l/4+7*i*u/64+15*i*h/256+579*i*f/16384+1515*i*_/65536+16837*i*g/1048576+(3*i*u/16+45*i*h/256-i*(32*o-561)*f/4096-i*(232*o-1677)*_/16384+i*(399985-90560*o+512*s)*g/5242880)*b+(21*i*h/256+483*i*f/4096-i*(224*o-1969)*_/16384-i*(33152*o-112599)*g/1048576)*x+(151*i*f/4096+4681*i*_/65536+1479*i*g/16384-453*r*g/32768)*w+(1097*i*_/65536+42783*i*g/1048576)*P+8011*i*g/1048576*k+(3*l/8+3*u/16+213*h/2048-3*o*h/64+255*f/4096-33*o*f/512+20861*_/524288-33*o*_/512+s*_/1024+28273*g/1048576-471*o*g/8192+9*s*g/4096)*m+(21*u/256+21*h/256+533*f/8192-21*o*f/512+197*_/4096-315*o*_/4096+584039*g/16777216-12517*o*g/131072+7*s*g/2048)*T+(151*h/6144+151*f/4096+5019*_/131072-453*o*_/16384+26965*g/786432-8607*o*g/131072)*C+(1097*f/131072+1097*_/65536+225797*g/10485760-1097*o*g/65536)*v+(8011*_/2621440+8011*g/1048576)*N+293393*g/251658240*M}function D_(e,t){if(e===0)return Math.log(Math.tan(.5*(R.PI_OVER_TWO+t)));const n=e*Math.sin(t);return Math.log(Math.tan(.5*(R.PI_OVER_TWO+t)))-e/2*Math.log((1+n)/(1-n))}function Ere(e,t,n,i,o){const r=D_(e._ellipticity,n),s=D_(e._ellipticity,o);return Math.atan2(R.negativePiToPi(i-t),s-r)}function wre(e,t,n,i,o,r,s){const a=e._heading,l=r-i;let u=0;if(R.equalsEpsilon(Math.abs(a),R.PI_OVER_TWO,R.EPSILON8))if(t===n)u=t*Math.cos(o)*R.negativePiToPi(l);else{const h=Math.sin(o);u=t*Math.cos(o)*R.negativePiToPi(l)/Math.sqrt(1-e._ellipticitySquared*h*h)}else{const h=RI(e._ellipticity,t,o);u=(RI(e._ellipticity,t,s)-h)/Math.cos(a)}return Math.abs(u)}const Sre=new d,Ew=new d;function bV(e,t,n,i){const o=d.normalize(i.cartographicToCartesian(t,Ew),Sre),r=d.normalize(i.cartographicToCartesian(n,Ew),Ew);A.typeOf.number.greaterThanOrEquals("value",Math.abs(Math.abs(d.angleBetween(o,r))-Math.PI),.0125);const s=i.maximumRadius,a=i.minimumRadius,l=s*s,u=a*a;e._ellipticitySquared=(l-u)/l,e._ellipticity=Math.sqrt(e._ellipticitySquared),e._start=he.clone(t,e._start),e._start.height=0,e._end=he.clone(n,e._end),e._end.height=0,e._heading=Ere(e,t.longitude,t.latitude,n.longitude,n.latitude),e._distance=wre(e,i.maximumRadius,i.minimumRadius,t.longitude,t.latitude,n.longitude,n.latitude)}function TV(e,t,n,i,o,r){if(n===0)return he.clone(e,r);const s=o*o;let a,l,u;if(Math.abs(R.PI_OVER_TWO-Math.abs(t))>R.EPSILON8){const h=RI(o,i,e.latitude),f=n*Math.cos(t),_=h+f;if(l=Cre(_,o,i),Math.abs(t)<R.EPSILON10)a=R.negativePiToPi(e.longitude);else{const g=D_(o,e.latitude),m=D_(o,l);u=Math.tan(t)*(m-g),a=R.negativePiToPi(e.longitude+u)}}else{l=e.latitude;let h;if(o===0)h=i*Math.cos(e.latitude);else{const f=Math.sin(e.latitude);h=i*Math.cos(e.latitude)/Math.sqrt(1-s*f*f)}u=n/h,t>0?a=R.negativePiToPi(e.longitude+u):a=R.negativePiToPi(e.longitude-u)}return c(r)?(r.longitude=a,r.latitude=l,r.height=0,r):new he(a,l,0)}function vr(e,t,n){const i=y(n,ae.WGS84);this._ellipsoid=i,this._start=new he,this._end=new he,this._heading=void 0,this._distance=void 0,this._ellipticity=void 0,this._ellipticitySquared=void 0,c(e)&&c(t)&&bV(this,e,t,i)}Object.defineProperties(vr.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},surfaceDistance:{get:function(){return A.defined("distance",this._distance),this._distance}},start:{get:function(){return this._start}},end:{get:function(){return this._end}},heading:{get:function(){return A.defined("distance",this._distance),this._heading}}});vr.fromStartHeadingDistance=function(e,t,n,i,o){A.defined("start",e),A.defined("heading",t),A.defined("distance",n),A.typeOf.number.greaterThan("distance",n,0);const r=y(i,ae.WGS84),s=r.maximumRadius,a=r.minimumRadius,l=s*s,u=a*a,h=Math.sqrt((l-u)/l);t=R.negativePiToPi(t);const f=TV(e,t,n,r.maximumRadius,h);return!c(o)||c(i)&&!i.equals(o.ellipsoid)?new vr(e,f,r):(o.setEndPoints(e,f),o)};vr.prototype.setEndPoints=function(e,t){A.defined("start",e),A.defined("end",t),bV(this,e,t,this._ellipsoid)};vr.prototype.interpolateUsingFraction=function(e,t){return this.interpolateUsingSurfaceDistance(e*this._distance,t)};vr.prototype.interpolateUsingSurfaceDistance=function(e,t){if(A.typeOf.number("distance",e),!c(this._distance)||this._distance===0)throw new E("EllipsoidRhumbLine must have distinct start and end set.");return TV(this._start,this._heading,e,this._ellipsoid.maximumRadius,this._ellipticity,t)};vr.prototype.findIntersectionWithLongitude=function(e,t){if(A.typeOf.number("intersectionLongitude",e),!c(this._distance)||this._distance===0)throw new E("EllipsoidRhumbLine must have distinct start and end set.");const n=this._ellipticity,i=this._heading,o=Math.abs(i),r=this._start;if(e=R.negativePiToPi(e),R.equalsEpsilon(Math.abs(e),Math.PI,R.EPSILON14)&&(e=R.sign(r.longitude)*Math.PI),c(t)||(t=new he),Math.abs(R.PI_OVER_TWO-o)<=R.EPSILON8)return t.longitude=e,t.latitude=r.latitude,t.height=0,t;if(R.equalsEpsilon(Math.abs(R.PI_OVER_TWO-o),R.PI_OVER_TWO,R.EPSILON8))return R.equalsEpsilon(e,r.longitude,R.EPSILON12)?void 0:(t.longitude=e,t.latitude=R.PI_OVER_TWO*R.sign(R.PI_OVER_TWO-i),t.height=0,t);const s=r.latitude,a=n*Math.sin(s),l=Math.tan(.5*(R.PI_OVER_TWO+s))*Math.exp((e-r.longitude)/Math.tan(i)),u=(1+a)/(1-a);let h=r.latitude,f;do{f=h;const _=n*Math.sin(f),g=(1+_)/(1-_);h=2*Math.atan(l*Math.pow(g/u,n/2))-R.PI_OVER_TWO}while(!R.equalsEpsilon(h,f,R.EPSILON12));return t.longitude=e,t.latitude=h,t.height=0,t};vr.prototype.findIntersectionWithLatitude=function(e,t){if(A.typeOf.number("intersectionLatitude",e),!c(this._distance)||this._distance===0)throw new E("EllipsoidRhumbLine must have distinct start and end set.");const n=this._ellipticity,i=this._heading,o=this._start;if(R.equalsEpsilon(Math.abs(i),R.PI_OVER_TWO,R.EPSILON8))return;const r=D_(n,o.latitude),s=D_(n,e),a=Math.tan(i)*(s-r),l=R.negativePiToPi(o.longitude+a);return c(t)?(t.longitude=l,t.latitude=e,t.height=0,t):new he(l,e,0)};const iO=[co,vn],vre=iO.length,AV=Math.cos(R.toRadians(30)),RN=Math.cos(R.toRadians(150)),xV=0,CV=1e3;function ud(e){e=y(e,y.EMPTY_OBJECT);const t=e.positions;if(!c(t)||t.length<2)throw new E("At least two positions are required.");if(c(e.arcType)&&e.arcType!==cn.GEODESIC&&e.arcType!==cn.RHUMB)throw new E("Valid options for arcType are ArcType.GEODESIC and ArcType.RHUMB.");this.width=y(e.width,1),this._positions=t,this.granularity=y(e.granularity,9999),this.loop=y(e.loop,!1),this.arcType=y(e.arcType,cn.GEODESIC),this._ellipsoid=ae.WGS84,this._projectionIndex=0,this._workerName="createGroundPolylineGeometry",this._scene3DOnly=!1}Object.defineProperties(ud.prototype,{packedLength:{get:function(){return 1+this._positions.length*3+1+1+1+ae.packedLength+1+1}}});ud.setProjectionAndEllipsoid=function(e,t){let n=0;for(let i=0;i<vre;i++)if(t instanceof iO[i]){n=i;break}e._projectionIndex=n,e._ellipsoid=t.ellipsoid};const Ire=new d,NN=new d,MN=new d;function NI(e,t,n,i,o){const r=Os(i,e,0,Ire),s=Os(i,e,n,NN),a=Os(i,t,0,MN),l=dd(s,r,NN),u=dd(a,r,MN);return d.cross(u,l,o),d.normalize(o,o)}const Dre=new he,Pre=new d,Ore=new d,Lre=new d;function ww(e,t,n,i,o,r,s,a,l,u,h){if(o===0)return;let f;r===cn.GEODESIC?f=new Mp(e,t,s):r===cn.RHUMB&&(f=new vr(e,t,s));const _=f.surfaceDistance;if(_<o)return;const g=NI(e,t,i,s,Lre),m=Math.ceil(_/o),b=_/m;let T=b;const x=m-1;let C=a.length;for(let w=0;w<x;w++){const v=f.interpolateUsingSurfaceDistance(T,Dre),P=Os(s,v,n,Pre),N=Os(s,v,i,Ore);d.pack(g,a,C),d.pack(P,l,C),d.pack(N,u,C),h.push(v.latitude),h.push(v.longitude),C+=3,T+=b}}const Sw=new he;function Os(e,t,n,i){return he.clone(t,Sw),Sw.height=n,he.toCartesian(Sw,e,i)}ud.pack=function(e,t,n){A.typeOf.object("value",e),A.defined("array",t);let i=y(n,0);const o=e._positions,r=o.length;t[i++]=r;for(let s=0;s<r;++s){const a=o[s];d.pack(a,t,i),i+=3}return t[i++]=e.granularity,t[i++]=e.loop?1:0,t[i++]=e.arcType,ae.pack(e._ellipsoid,t,i),i+=ae.packedLength,t[i++]=e._projectionIndex,t[i++]=e._scene3DOnly?1:0,t};ud.unpack=function(e,t,n){A.defined("array",e);let i=y(t,0);const o=e[i++],r=new Array(o);for(let _=0;_<o;_++)r[_]=d.unpack(e,i),i+=3;const s=e[i++],a=e[i++]===1,l=e[i++],u=ae.unpack(e,i);i+=ae.packedLength;const h=e[i++],f=e[i++]===1;return c(n)||(n=new ud({positions:r})),n._positions=r,n.granularity=s,n.loop=a,n.arcType=l,n._ellipsoid=u,n._projectionIndex=h,n._scene3DOnly=f,n};function dd(e,t,n){return d.subtract(e,t,n),d.normalize(n,n),n}function FN(e,t,n,i){return i=dd(e,t,i),i=d.cross(i,n,i),i=d.normalize(i,i),i=d.cross(n,i,i),i}const Rre=new d,Nre=new d,Mre=new d,EV=new d,Fre=0,Bre=-1;function vw(e,t,n,i,o){const r=dd(n,t,EV),s=FN(e,t,r,Rre),a=FN(i,t,r,Nre);if(R.equalsEpsilon(d.dot(s,a),Bre,R.EPSILON5))return o=d.cross(r,s,o),o=d.normalize(o,o),o;o=d.add(a,s,o),o=d.normalize(o,o);const l=d.cross(r,o,Mre);return d.dot(a,l)<Fre&&(o=d.negate(o,o)),o}const Dx=_t.fromPointNormal(d.ZERO,d.UNIT_Y),zre=new d,Ure=new d,kre=new d,Vre=new d,Hre=new d,Kb=new d,Zb=new he,BN=new he,zN=new he;ud.createGeometry=function(e){const t=!e._scene3DOnly;let n=e.loop;const i=e._ellipsoid,o=e.granularity,r=e.arcType,s=new iO[e._projectionIndex](i),a=xV,l=CV;let u,h;const f=e._positions,_=f.length;_===2&&(n=!1);let g,m,b,T;const x=new vr(void 0,void 0,i);let C,w,v;const P=[f[0]];for(h=0;h<_-1;h++)g=f[h],m=f[h+1],C=Ei.lineSegmentPlane(g,m,Dx,Kb),c(C)&&!d.equalsEpsilon(C,g,R.EPSILON7)&&!d.equalsEpsilon(C,m,R.EPSILON7)&&(e.arcType===cn.GEODESIC?P.push(d.clone(C)):e.arcType===cn.RHUMB&&(v=i.cartesianToCartographic(C,Zb).longitude,b=i.cartesianToCartographic(g,Zb),T=i.cartesianToCartographic(m,BN),x.setEndPoints(b,T),w=x.findIntersectionWithLongitude(v,zN),C=i.cartographicToCartesian(w,Kb),c(C)&&!d.equalsEpsilon(C,g,R.EPSILON7)&&!d.equalsEpsilon(C,m,R.EPSILON7)&&P.push(d.clone(C)))),P.push(m);n&&(g=f[_-1],m=f[0],C=Ei.lineSegmentPlane(g,m,Dx,Kb),c(C)&&!d.equalsEpsilon(C,g,R.EPSILON7)&&!d.equalsEpsilon(C,m,R.EPSILON7)&&(e.arcType===cn.GEODESIC?P.push(d.clone(C)):e.arcType===cn.RHUMB&&(v=i.cartesianToCartographic(C,Zb).longitude,b=i.cartesianToCartographic(g,Zb),T=i.cartesianToCartographic(m,BN),x.setEndPoints(b,T),w=x.findIntersectionWithLongitude(v,zN),C=i.cartographicToCartesian(w,Kb),c(C)&&!d.equalsEpsilon(C,g,R.EPSILON7)&&!d.equalsEpsilon(C,m,R.EPSILON7)&&P.push(d.clone(C)))));let N=P.length,k=new Array(N);for(h=0;h<N;h++){const q=he.fromCartesian(P[h],i);q.height=0,k[h]=q}if(k=gs(k,he.equalsEpsilon),N=k.length,N<2)return;const M=[],U=[],B=[],S=[];let D=zre,p=Ure,I=kre,O=Vre,F=Hre;const V=k[0],G=k[1],j=k[N-1];for(D=Os(i,j,a,D),O=Os(i,G,a,O),p=Os(i,V,a,p),I=Os(i,V,l,I),n?F=vw(D,p,I,O,F):F=NI(V,G,l,i,F),d.pack(F,U,0),d.pack(p,B,0),d.pack(I,S,0),M.push(V.latitude),M.push(V.longitude),ww(V,G,a,l,o,r,i,U,B,S,M),h=1;h<N-1;++h){D=d.clone(p,D),p=d.clone(O,p);const q=k[h];Os(i,q,l,I),Os(i,k[h+1],a,O),vw(D,p,I,O,F),u=U.length,d.pack(F,U,u),d.pack(p,B,u),d.pack(I,S,u),M.push(q.latitude),M.push(q.longitude),ww(k[h],k[h+1],a,l,o,r,i,U,B,S,M)}const W=k[N-1],X=k[N-2];if(p=Os(i,W,a,p),I=Os(i,W,l,I),n){const q=k[0];D=Os(i,X,a,D),O=Os(i,q,a,O),F=vw(D,p,I,O,F)}else F=NI(X,W,l,i,F);if(u=U.length,d.pack(F,U,u),d.pack(p,B,u),d.pack(I,S,u),M.push(W.latitude),M.push(W.longitude),n){for(ww(W,V,a,l,o,r,i,U,B,S,M),u=U.length,h=0;h<3;++h)U[u+h]=U[h],B[u+h]=B[h],S[u+h]=S[h];M.push(V.latitude),M.push(V.longitude)}return pse(n,s,B,S,U,M,t)};const Gre=new d,jre=new $,Wre=new _e;function UN(e,t,n,i){const o=dd(n,t,Gre),r=d.dot(o,e);if(r>AV||r<RN){const s=dd(i,n,EV),a=r<RN?R.PI_OVER_TWO:-R.PI_OVER_TWO,l=_e.fromAxisAngle(s,a,Wre),u=$.fromQuaternion(l,jre);return $.multiplyByVector(u,e,e),!0}return!1}const kN=new he,qre=new d,VN=new d;function hy(e,t,n,i,o){const r=he.toCartesian(t,e._ellipsoid,qre);let s=d.add(r,n,VN),a=!1;const l=e._ellipsoid;let u=l.cartesianToCartographic(s,kN);Math.abs(t.longitude-u.longitude)>R.PI_OVER_TWO&&(a=!0,s=d.subtract(r,n,VN),u=l.cartesianToCartographic(s,kN)),u.height=0;const h=e.project(u,o);return o=d.subtract(h,i,o),o.z=0,o=d.normalize(o,o),a&&d.negate(o,o),o}const Yre=new d,HN=new d;function GN(e,t,n,i,o,r){const s=d.subtract(t,e,Yre);d.normalize(s,s);const a=n-xV;let l=d.multiplyByScalar(s,a,HN);d.add(e,l,o);const u=i-CV;l=d.multiplyByScalar(s,u,HN),d.add(t,l,r)}const $re=new d;function Jb(e,t){const n=_t.getPointDistance(Dx,e),i=_t.getPointDistance(Dx,t);let o=$re;R.equalsEpsilon(n,0,R.EPSILON2)?(o=dd(t,e,o),d.multiplyByScalar(o,R.EPSILON2,o),d.add(e,o,e)):R.equalsEpsilon(i,0,R.EPSILON2)&&(o=dd(e,t,o),d.multiplyByScalar(o,R.EPSILON2,o),d.add(t,o,t))}function Xre(e,t){const n=Math.abs(e.longitude),i=Math.abs(t.longitude);if(R.equalsEpsilon(n,R.PI,R.EPSILON11)){const o=R.sign(t.longitude);return e.longitude=o*(n-R.EPSILON11),1}else if(R.equalsEpsilon(i,R.PI,R.EPSILON11)){const o=R.sign(e.longitude);return t.longitude=o*(i-R.EPSILON11),2}return 0}const wV=new he,SV=new he,jN=new d,Iw=new d,WN=new d,qN=new d,Qre=new d,YN=new d,Kre=[wV,SV],Zre=new ce,Jre=new d,ese=new d,tse=new d,nse=new d,ise=new d,ose=new d,Dw=new d,Pw=new d,rse=new d,sse=new d,ase=new d,$N=new d,cse=new d,lse=new d,use=new rn,dse=new rn,XN=new d,hse=new d,QN=new d,fse=[new se,new se],vV=[0,2,1,0,3,2,0,7,3,0,4,7,0,5,4,0,1,5,5,7,4,5,6,7,5,2,6,5,1,2,3,6,2,3,7,6],KN=vV.length;function pse(e,t,n,i,o,r,s){let a,l;const u=t._ellipsoid,h=n.length/3-1,f=h*8,_=f*4,g=h*36,m=f>65535?new Uint32Array(g):new Uint16Array(g),b=new Float64Array(f*3),T=new Float32Array(_),x=new Float32Array(_),C=new Float32Array(_),w=new Float32Array(_),v=new Float32Array(_);let P,N,k,M;s&&(P=new Float32Array(_),N=new Float32Array(_),k=new Float32Array(_),M=new Float32Array(f*2));const U=r.length/2;let B=0;const S=wV;S.height=0;const D=SV;D.height=0;let p=jN,I=Iw;if(s)for(l=0,a=1;a<U;a++)S.latitude=r[l],S.longitude=r[l+1],D.latitude=r[l+2],D.longitude=r[l+3],p=t.project(S,p),I=t.project(D,I),B+=d.distance(p,I),l+=2;const O=i.length/3;I=d.unpack(i,0,I);let F=0;for(l=3,a=1;a<O;a++)p=d.clone(I,p),I=d.unpack(i,l,I),F+=d.distance(p,I),l+=3;let V;l=3;let G=0,j=0,W=0,X=0,q=!1,ee=d.unpack(n,0,qN),Y=d.unpack(i,0,Iw),ne=d.unpack(o,0,YN);if(e){const Ce=d.unpack(n,n.length-6,WN);UN(ne,Ce,ee,Y)&&(ne=d.negate(ne,ne))}let Q=0,le=0,pe=0;for(a=0;a<h;a++){const Ce=d.clone(ee,WN),we=d.clone(Y,jN);let Pe=d.clone(ne,Qre);q&&(Pe=d.negate(Pe,Pe)),ee=d.unpack(n,l,qN),Y=d.unpack(i,l,Iw),ne=d.unpack(o,l,YN),q=UN(ne,Ce,ee,Y),S.latitude=r[G],S.longitude=r[G+1],D.latitude=r[G+2],D.longitude=r[G+3];let lt,ft,We,Fe;if(s){const Ln=Xre(S,D);lt=t.project(S,ise),ft=t.project(D,ose);const Zo=dd(ft,lt,XN);Zo.y=Math.abs(Zo.y),We=Dw,Fe=Pw,Ln===0||d.dot(Zo,d.UNIT_Y)>AV?(We=hy(t,S,Pe,lt,Dw),Fe=hy(t,D,ne,ft,Pw)):Ln===1?(Fe=hy(t,D,ne,ft,Pw),We.x=0,We.y=R.sign(S.longitude-Math.abs(D.longitude)),We.z=0):(We=hy(t,S,Pe,lt,Dw),Fe.x=0,Fe.y=R.sign(S.longitude-D.longitude),Fe.z=0)}const Dt=d.distance(we,Y),st=rn.fromCartesian(Ce,use),et=d.subtract(ee,Ce,rse),hn=d.normalize(et,$N);let ot=d.subtract(we,Ce,sse);ot=d.normalize(ot,ot);let at=d.cross(hn,ot,$N);at=d.normalize(at,at);let Xt=d.cross(ot,Pe,cse);Xt=d.normalize(Xt,Xt);let it=d.subtract(Y,ee,ase);it=d.normalize(it,it);let fi=d.cross(ne,it,lse);fi=d.normalize(fi,fi);const Hi=Dt/F,Ss=Q/F;let Qo=0,No,Gi,Ni,wi=0,$r=0;if(s){Qo=d.distance(lt,ft),No=rn.fromCartesian(lt,dse),Gi=d.subtract(ft,lt,XN),Ni=d.normalize(Gi,hse);const Ln=Ni.x;Ni.x=Ni.y,Ni.y=-Ln,wi=Qo/B,$r=le/B}for(V=0;V<8;V++){const Ln=X+V*4,Zo=j+V*2,ho=Ln+3,qs=V<4?1:-1,pi=V===2||V===3||V===6||V===7?1:-1;d.pack(st.high,T,Ln),T[ho]=et.x,d.pack(st.low,x,Ln),x[ho]=et.y,d.pack(Xt,C,Ln),C[ho]=et.z,d.pack(fi,w,Ln),w[ho]=Hi*qs,d.pack(at,v,Ln);let ji=Ss*pi;ji===0&&pi<0&&(ji=9),v[ho]=ji,s&&(P[Ln]=No.high.x,P[Ln+1]=No.high.y,P[Ln+2]=No.low.x,P[Ln+3]=No.low.y,k[Ln]=-We.y,k[Ln+1]=We.x,k[Ln+2]=Fe.y,k[Ln+3]=-Fe.x,N[Ln]=Gi.x,N[Ln+1]=Gi.y,N[Ln+2]=Ni.x,N[Ln+3]=Ni.y,M[Zo]=wi*qs,ji=$r*pi,ji===0&&pi<0&&(ji=9),M[Zo+1]=ji)}const zn=tse,ci=nse,Si=Jre,Ko=ese,ri=ce.fromCartographicArray(Kre,Zre),fr=Ti.getMinimumMaximumHeights(ri,u),ha=fr.minimumTerrainHeight,fa=fr.maximumTerrainHeight;pe+=Math.abs(ha),pe+=Math.abs(fa),GN(Ce,we,ha,fa,zn,Si),GN(ee,Y,ha,fa,ci,Ko);let So=d.multiplyByScalar(at,R.EPSILON5,QN);d.add(zn,So,zn),d.add(ci,So,ci),d.add(Si,So,Si),d.add(Ko,So,Ko),Jb(zn,ci),Jb(Si,Ko),d.pack(zn,b,W),d.pack(ci,b,W+3),d.pack(Ko,b,W+6),d.pack(Si,b,W+9),So=d.multiplyByScalar(at,-2*R.EPSILON5,QN),d.add(zn,So,zn),d.add(ci,So,ci),d.add(Si,So,Si),d.add(Ko,So,Ko),Jb(zn,ci),Jb(Si,Ko),d.pack(zn,b,W+12),d.pack(ci,b,W+15),d.pack(Ko,b,W+18),d.pack(Si,b,W+21),G+=2,l+=3,j+=16,W+=24,X+=32,Q+=Dt,le+=Qo}l=0;let re=0;for(a=0;a<h;a++){for(V=0;V<KN;V++)m[l+V]=vV[V]+re;re+=8,l+=KN}const de=fse;se.fromVertices(n,d.ZERO,3,de[0]),se.fromVertices(i,d.ZERO,3,de[1]);const fe=se.fromBoundingSpheres(de);fe.radius+=pe/(h*2);const ye={position:new Ie({componentDatatype:Z.DOUBLE,componentsPerAttribute:3,normalize:!1,values:b}),startHiAndForwardOffsetX:kd(T),startLoAndForwardOffsetY:kd(x),startNormalAndForwardOffsetZ:kd(C),endNormalAndTextureCoordinateNormalizationX:kd(w),rightNormalAndTextureCoordinateNormalizationY:kd(v)};return s&&(ye.startHiLo2D=kd(P),ye.offsetAndRight2D=kd(N),ye.startEndNormals2D=kd(k),ye.texcoordNormalization2D=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:2,normalize:!1,values:M})),new Tt({attributes:ye,indices:m,boundingSphere:fe})}function kd(e){return new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:4,normalize:!1,values:e})}ud._projectNormal=hy;const mse=`in vec4 v_startPlaneNormalEcAndHalfWidth;
|
|
in vec4 v_endPlaneNormalEcAndBatchId;
|
|
in vec4 v_rightPlaneEC; // Technically can compute distance for this here
|
|
in vec4 v_endEcAndStartEcX;
|
|
in vec4 v_texcoordNormalizationAndStartEcYZ;
|
|
|
|
#ifdef PER_INSTANCE_COLOR
|
|
in vec4 v_color;
|
|
#endif
|
|
|
|
void main(void)
|
|
{
|
|
float logDepthOrDepth = czm_branchFreeTernary(czm_sceneMode == czm_sceneMode2D, gl_FragCoord.z, czm_unpackDepth(texture(czm_globeDepthTexture, gl_FragCoord.xy / czm_viewport.zw)));
|
|
vec3 ecStart = vec3(v_endEcAndStartEcX.w, v_texcoordNormalizationAndStartEcYZ.zw);
|
|
|
|
// Discard for sky
|
|
if (logDepthOrDepth == 0.0) {
|
|
#ifdef DEBUG_SHOW_VOLUME
|
|
out_FragColor = vec4(1.0, 0.0, 0.0, 0.5);
|
|
return;
|
|
#else // DEBUG_SHOW_VOLUME
|
|
discard;
|
|
#endif // DEBUG_SHOW_VOLUME
|
|
}
|
|
|
|
vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth);
|
|
eyeCoordinate /= eyeCoordinate.w;
|
|
|
|
float halfMaxWidth = v_startPlaneNormalEcAndHalfWidth.w * czm_metersPerPixel(eyeCoordinate);
|
|
// Check distance of the eye coordinate against the right-facing plane
|
|
float widthwiseDistance = czm_planeDistance(v_rightPlaneEC, eyeCoordinate.xyz);
|
|
|
|
// Check eye coordinate against the mitering planes
|
|
float distanceFromStart = czm_planeDistance(v_startPlaneNormalEcAndHalfWidth.xyz, -dot(ecStart, v_startPlaneNormalEcAndHalfWidth.xyz), eyeCoordinate.xyz);
|
|
float distanceFromEnd = czm_planeDistance(v_endPlaneNormalEcAndBatchId.xyz, -dot(v_endEcAndStartEcX.xyz, v_endPlaneNormalEcAndBatchId.xyz), eyeCoordinate.xyz);
|
|
|
|
if (abs(widthwiseDistance) > halfMaxWidth || distanceFromStart < 0.0 || distanceFromEnd < 0.0) {
|
|
#ifdef DEBUG_SHOW_VOLUME
|
|
out_FragColor = vec4(1.0, 0.0, 0.0, 0.5);
|
|
return;
|
|
#else // DEBUG_SHOW_VOLUME
|
|
discard;
|
|
#endif // DEBUG_SHOW_VOLUME
|
|
}
|
|
|
|
// Check distance of the eye coordinate against start and end planes with normals in the right plane.
|
|
// For computing unskewed lengthwise texture coordinate.
|
|
// Can also be used for clipping extremely pointy miters, but in practice unnecessary because of miter breaking.
|
|
|
|
// aligned plane: cross the right plane normal with miter plane normal, then cross the result with right again to point it more "forward"
|
|
vec3 alignedPlaneNormal;
|
|
|
|
// start aligned plane
|
|
alignedPlaneNormal = cross(v_rightPlaneEC.xyz, v_startPlaneNormalEcAndHalfWidth.xyz);
|
|
alignedPlaneNormal = normalize(cross(alignedPlaneNormal, v_rightPlaneEC.xyz));
|
|
distanceFromStart = czm_planeDistance(alignedPlaneNormal, -dot(alignedPlaneNormal, ecStart), eyeCoordinate.xyz);
|
|
|
|
// end aligned plane
|
|
alignedPlaneNormal = cross(v_rightPlaneEC.xyz, v_endPlaneNormalEcAndBatchId.xyz);
|
|
alignedPlaneNormal = normalize(cross(alignedPlaneNormal, v_rightPlaneEC.xyz));
|
|
distanceFromEnd = czm_planeDistance(alignedPlaneNormal, -dot(alignedPlaneNormal, v_endEcAndStartEcX.xyz), eyeCoordinate.xyz);
|
|
|
|
#ifdef PER_INSTANCE_COLOR
|
|
out_FragColor = czm_gammaCorrect(v_color);
|
|
#else // PER_INSTANCE_COLOR
|
|
// Clamp - distance to aligned planes may be negative due to mitering,
|
|
// so fragment texture coordinate might be out-of-bounds.
|
|
float s = clamp(distanceFromStart / (distanceFromStart + distanceFromEnd), 0.0, 1.0);
|
|
s = (s * v_texcoordNormalizationAndStartEcYZ.x) + v_texcoordNormalizationAndStartEcYZ.y;
|
|
float t = (widthwiseDistance + halfMaxWidth) / (2.0 * halfMaxWidth);
|
|
|
|
czm_materialInput materialInput;
|
|
|
|
materialInput.s = s;
|
|
materialInput.st = vec2(s, t);
|
|
materialInput.str = vec3(s, t, 0.0);
|
|
|
|
czm_material material = czm_getMaterial(materialInput);
|
|
out_FragColor = vec4(material.diffuse + material.emission, material.alpha);
|
|
#endif // PER_INSTANCE_COLOR
|
|
|
|
// Premultiply alpha. Required for classification primitives on translucent globe.
|
|
out_FragColor.rgb *= out_FragColor.a;
|
|
|
|
czm_writeDepthClamp();
|
|
}
|
|
`,_se=`in vec3 v_forwardDirectionEC;
|
|
in vec3 v_texcoordNormalizationAndHalfWidth;
|
|
in float v_batchId;
|
|
|
|
#ifdef PER_INSTANCE_COLOR
|
|
in vec4 v_color;
|
|
#else
|
|
in vec2 v_alignedPlaneDistances;
|
|
in float v_texcoordT;
|
|
#endif
|
|
|
|
float rayPlaneDistanceUnsafe(vec3 origin, vec3 direction, vec3 planeNormal, float planeDistance) {
|
|
// We don't expect the ray to ever be parallel to the plane
|
|
return (-planeDistance - dot(planeNormal, origin)) / dot(planeNormal, direction);
|
|
}
|
|
|
|
void main(void)
|
|
{
|
|
vec4 eyeCoordinate = gl_FragCoord;
|
|
eyeCoordinate /= eyeCoordinate.w;
|
|
|
|
#ifdef PER_INSTANCE_COLOR
|
|
out_FragColor = czm_gammaCorrect(v_color);
|
|
#else // PER_INSTANCE_COLOR
|
|
// Use distances for planes aligned with segment to prevent skew in dashing
|
|
float distanceFromStart = rayPlaneDistanceUnsafe(eyeCoordinate.xyz, -v_forwardDirectionEC, v_forwardDirectionEC.xyz, v_alignedPlaneDistances.x);
|
|
float distanceFromEnd = rayPlaneDistanceUnsafe(eyeCoordinate.xyz, v_forwardDirectionEC, -v_forwardDirectionEC.xyz, v_alignedPlaneDistances.y);
|
|
|
|
// Clamp - distance to aligned planes may be negative due to mitering
|
|
distanceFromStart = max(0.0, distanceFromStart);
|
|
distanceFromEnd = max(0.0, distanceFromEnd);
|
|
|
|
float s = distanceFromStart / (distanceFromStart + distanceFromEnd);
|
|
s = (s * v_texcoordNormalizationAndHalfWidth.x) + v_texcoordNormalizationAndHalfWidth.y;
|
|
|
|
czm_materialInput materialInput;
|
|
|
|
materialInput.s = s;
|
|
materialInput.st = vec2(s, v_texcoordT);
|
|
materialInput.str = vec3(s, v_texcoordT, 0.0);
|
|
|
|
czm_material material = czm_getMaterial(materialInput);
|
|
out_FragColor = vec4(material.diffuse + material.emission, material.alpha);
|
|
#endif // PER_INSTANCE_COLOR
|
|
}
|
|
`,gse=`in vec3 position3DHigh;
|
|
in vec3 position3DLow;
|
|
|
|
in vec4 startHiAndForwardOffsetX;
|
|
in vec4 startLoAndForwardOffsetY;
|
|
in vec4 startNormalAndForwardOffsetZ;
|
|
in vec4 endNormalAndTextureCoordinateNormalizationX;
|
|
in vec4 rightNormalAndTextureCoordinateNormalizationY;
|
|
in vec4 startHiLo2D;
|
|
in vec4 offsetAndRight2D;
|
|
in vec4 startEndNormals2D;
|
|
in vec2 texcoordNormalization2D;
|
|
|
|
in float batchId;
|
|
|
|
out vec3 v_forwardDirectionEC;
|
|
out vec3 v_texcoordNormalizationAndHalfWidth;
|
|
out float v_batchId;
|
|
|
|
// For materials
|
|
#ifdef WIDTH_VARYING
|
|
out float v_width;
|
|
#endif
|
|
#ifdef ANGLE_VARYING
|
|
out float v_polylineAngle;
|
|
#endif
|
|
|
|
#ifdef PER_INSTANCE_COLOR
|
|
out vec4 v_color;
|
|
#else
|
|
out vec2 v_alignedPlaneDistances;
|
|
out float v_texcoordT;
|
|
#endif
|
|
|
|
// Morphing planes using SLERP or NLERP doesn't seem to work, so instead draw the material directly on the shadow volume.
|
|
// Morph views are from very far away and aren't meant to be used precisely, so this should be sufficient.
|
|
void main()
|
|
{
|
|
v_batchId = batchId;
|
|
|
|
// Start position
|
|
vec4 posRelativeToEye2D = czm_translateRelativeToEye(vec3(0.0, startHiLo2D.xy), vec3(0.0, startHiLo2D.zw));
|
|
vec4 posRelativeToEye3D = czm_translateRelativeToEye(startHiAndForwardOffsetX.xyz, startLoAndForwardOffsetY.xyz);
|
|
vec4 posRelativeToEye = czm_columbusViewMorph(posRelativeToEye2D, posRelativeToEye3D, czm_morphTime);
|
|
vec3 posEc2D = (czm_modelViewRelativeToEye * posRelativeToEye2D).xyz;
|
|
vec3 posEc3D = (czm_modelViewRelativeToEye * posRelativeToEye3D).xyz;
|
|
vec3 startEC = (czm_modelViewRelativeToEye * posRelativeToEye).xyz;
|
|
|
|
// Start plane
|
|
vec4 startPlane2D;
|
|
vec4 startPlane3D;
|
|
startPlane2D.xyz = czm_normal * vec3(0.0, startEndNormals2D.xy);
|
|
startPlane3D.xyz = czm_normal * startNormalAndForwardOffsetZ.xyz;
|
|
startPlane2D.w = -dot(startPlane2D.xyz, posEc2D);
|
|
startPlane3D.w = -dot(startPlane3D.xyz, posEc3D);
|
|
|
|
// Right plane
|
|
vec4 rightPlane2D;
|
|
vec4 rightPlane3D;
|
|
rightPlane2D.xyz = czm_normal * vec3(0.0, offsetAndRight2D.zw);
|
|
rightPlane3D.xyz = czm_normal * rightNormalAndTextureCoordinateNormalizationY.xyz;
|
|
rightPlane2D.w = -dot(rightPlane2D.xyz, posEc2D);
|
|
rightPlane3D.w = -dot(rightPlane3D.xyz, posEc3D);
|
|
|
|
// End position
|
|
posRelativeToEye2D = posRelativeToEye2D + vec4(0.0, offsetAndRight2D.xy, 0.0);
|
|
posRelativeToEye3D = posRelativeToEye3D + vec4(startHiAndForwardOffsetX.w, startLoAndForwardOffsetY.w, startNormalAndForwardOffsetZ.w, 0.0);
|
|
posRelativeToEye = czm_columbusViewMorph(posRelativeToEye2D, posRelativeToEye3D, czm_morphTime);
|
|
posEc2D = (czm_modelViewRelativeToEye * posRelativeToEye2D).xyz;
|
|
posEc3D = (czm_modelViewRelativeToEye * posRelativeToEye3D).xyz;
|
|
vec3 endEC = (czm_modelViewRelativeToEye * posRelativeToEye).xyz;
|
|
vec3 forwardEc3D = czm_normal * normalize(vec3(startHiAndForwardOffsetX.w, startLoAndForwardOffsetY.w, startNormalAndForwardOffsetZ.w));
|
|
vec3 forwardEc2D = czm_normal * normalize(vec3(0.0, offsetAndRight2D.xy));
|
|
|
|
// End plane
|
|
vec4 endPlane2D;
|
|
vec4 endPlane3D;
|
|
endPlane2D.xyz = czm_normal * vec3(0.0, startEndNormals2D.zw);
|
|
endPlane3D.xyz = czm_normal * endNormalAndTextureCoordinateNormalizationX.xyz;
|
|
endPlane2D.w = -dot(endPlane2D.xyz, posEc2D);
|
|
endPlane3D.w = -dot(endPlane3D.xyz, posEc3D);
|
|
|
|
// Forward direction
|
|
v_forwardDirectionEC = normalize(endEC - startEC);
|
|
|
|
vec2 cleanTexcoordNormalization2D;
|
|
cleanTexcoordNormalization2D.x = abs(texcoordNormalization2D.x);
|
|
cleanTexcoordNormalization2D.y = czm_branchFreeTernary(texcoordNormalization2D.y > 1.0, 0.0, abs(texcoordNormalization2D.y));
|
|
vec2 cleanTexcoordNormalization3D;
|
|
cleanTexcoordNormalization3D.x = abs(endNormalAndTextureCoordinateNormalizationX.w);
|
|
cleanTexcoordNormalization3D.y = rightNormalAndTextureCoordinateNormalizationY.w;
|
|
cleanTexcoordNormalization3D.y = czm_branchFreeTernary(cleanTexcoordNormalization3D.y > 1.0, 0.0, abs(cleanTexcoordNormalization3D.y));
|
|
|
|
v_texcoordNormalizationAndHalfWidth.xy = mix(cleanTexcoordNormalization2D, cleanTexcoordNormalization3D, czm_morphTime);
|
|
|
|
#ifdef PER_INSTANCE_COLOR
|
|
v_color = czm_batchTable_color(batchId);
|
|
#else // PER_INSTANCE_COLOR
|
|
// For computing texture coordinates
|
|
|
|
v_alignedPlaneDistances.x = -dot(v_forwardDirectionEC, startEC);
|
|
v_alignedPlaneDistances.y = -dot(-v_forwardDirectionEC, endEC);
|
|
#endif // PER_INSTANCE_COLOR
|
|
|
|
#ifdef WIDTH_VARYING
|
|
float width = czm_batchTable_width(batchId);
|
|
float halfWidth = width * 0.5;
|
|
v_width = width;
|
|
v_texcoordNormalizationAndHalfWidth.z = halfWidth;
|
|
#else
|
|
float halfWidth = 0.5 * czm_batchTable_width(batchId);
|
|
v_texcoordNormalizationAndHalfWidth.z = halfWidth;
|
|
#endif
|
|
|
|
// Compute a normal along which to "push" the position out, extending the miter depending on view distance.
|
|
// Position has already been "pushed" by unit length along miter normal, and miter normals are encoded in the planes.
|
|
// Decode the normal to use at this specific vertex, push the position back, and then push to where it needs to be.
|
|
// Since this is morphing, compute both 3D and 2D positions and then blend.
|
|
|
|
// ****** 3D ******
|
|
// Check distance to the end plane and start plane, pick the plane that is closer
|
|
vec4 positionEc3D = czm_modelViewRelativeToEye * czm_translateRelativeToEye(position3DHigh, position3DLow); // w = 1.0, see czm_computePosition
|
|
float absStartPlaneDistance = abs(czm_planeDistance(startPlane3D, positionEc3D.xyz));
|
|
float absEndPlaneDistance = abs(czm_planeDistance(endPlane3D, positionEc3D.xyz));
|
|
vec3 planeDirection = czm_branchFreeTernary(absStartPlaneDistance < absEndPlaneDistance, startPlane3D.xyz, endPlane3D.xyz);
|
|
vec3 upOrDown = normalize(cross(rightPlane3D.xyz, planeDirection)); // Points "up" for start plane, "down" at end plane.
|
|
vec3 normalEC = normalize(cross(planeDirection, upOrDown)); // In practice, the opposite seems to work too.
|
|
|
|
// Nudge the top vertex upwards to prevent flickering
|
|
vec3 geodeticSurfaceNormal = normalize(cross(normalEC, forwardEc3D));
|
|
geodeticSurfaceNormal *= float(0.0 <= rightNormalAndTextureCoordinateNormalizationY.w && rightNormalAndTextureCoordinateNormalizationY.w <= 1.0);
|
|
geodeticSurfaceNormal *= MAX_TERRAIN_HEIGHT;
|
|
positionEc3D.xyz += geodeticSurfaceNormal;
|
|
|
|
// Determine if this vertex is on the "left" or "right"
|
|
normalEC *= sign(endNormalAndTextureCoordinateNormalizationX.w);
|
|
|
|
// A "perfect" implementation would push along normals according to the angle against forward.
|
|
// In practice, just pushing the normal out by halfWidth is sufficient for morph views.
|
|
positionEc3D.xyz += halfWidth * max(0.0, czm_metersPerPixel(positionEc3D)) * normalEC; // prevent artifacts when czm_metersPerPixel is negative (behind camera)
|
|
|
|
// ****** 2D ******
|
|
// Check distance to the end plane and start plane, pick the plane that is closer
|
|
vec4 positionEc2D = czm_modelViewRelativeToEye * czm_translateRelativeToEye(position2DHigh.zxy, position2DLow.zxy); // w = 1.0, see czm_computePosition
|
|
absStartPlaneDistance = abs(czm_planeDistance(startPlane2D, positionEc2D.xyz));
|
|
absEndPlaneDistance = abs(czm_planeDistance(endPlane2D, positionEc2D.xyz));
|
|
planeDirection = czm_branchFreeTernary(absStartPlaneDistance < absEndPlaneDistance, startPlane2D.xyz, endPlane2D.xyz);
|
|
upOrDown = normalize(cross(rightPlane2D.xyz, planeDirection)); // Points "up" for start plane, "down" at end plane.
|
|
normalEC = normalize(cross(planeDirection, upOrDown)); // In practice, the opposite seems to work too.
|
|
|
|
// Nudge the top vertex upwards to prevent flickering
|
|
geodeticSurfaceNormal = normalize(cross(normalEC, forwardEc2D));
|
|
geodeticSurfaceNormal *= float(0.0 <= texcoordNormalization2D.y && texcoordNormalization2D.y <= 1.0);
|
|
geodeticSurfaceNormal *= MAX_TERRAIN_HEIGHT;
|
|
positionEc2D.xyz += geodeticSurfaceNormal;
|
|
|
|
// Determine if this vertex is on the "left" or "right"
|
|
normalEC *= sign(texcoordNormalization2D.x);
|
|
#ifndef PER_INSTANCE_COLOR
|
|
// Use vertex's sidedness to compute its texture coordinate.
|
|
v_texcoordT = clamp(sign(texcoordNormalization2D.x), 0.0, 1.0);
|
|
#endif
|
|
|
|
// A "perfect" implementation would push along normals according to the angle against forward.
|
|
// In practice, just pushing the normal out by halfWidth is sufficient for morph views.
|
|
positionEc2D.xyz += halfWidth * max(0.0, czm_metersPerPixel(positionEc2D)) * normalEC; // prevent artifacts when czm_metersPerPixel is negative (behind camera)
|
|
|
|
// Blend for actual position
|
|
gl_Position = czm_projection * mix(positionEc2D, positionEc3D, czm_morphTime);
|
|
|
|
#ifdef ANGLE_VARYING
|
|
// Approximate relative screen space direction of the line.
|
|
vec2 approxLineDirection = normalize(vec2(v_forwardDirectionEC.x, -v_forwardDirectionEC.y));
|
|
approxLineDirection.y = czm_branchFreeTernary(approxLineDirection.x == 0.0 && approxLineDirection.y == 0.0, -1.0, approxLineDirection.y);
|
|
v_polylineAngle = czm_fastApproximateAtan(approxLineDirection.x, approxLineDirection.y);
|
|
#endif
|
|
}
|
|
`,yse=`in vec3 position3DHigh;
|
|
in vec3 position3DLow;
|
|
|
|
// In 2D and in 3D, texture coordinate normalization component signs encodes:
|
|
// * X sign - sidedness relative to right plane
|
|
// * Y sign - is negative OR magnitude is greater than 1.0 if vertex is on bottom of volume
|
|
#ifndef COLUMBUS_VIEW_2D
|
|
in vec4 startHiAndForwardOffsetX;
|
|
in vec4 startLoAndForwardOffsetY;
|
|
in vec4 startNormalAndForwardOffsetZ;
|
|
in vec4 endNormalAndTextureCoordinateNormalizationX;
|
|
in vec4 rightNormalAndTextureCoordinateNormalizationY;
|
|
#else
|
|
in vec4 startHiLo2D;
|
|
in vec4 offsetAndRight2D;
|
|
in vec4 startEndNormals2D;
|
|
in vec2 texcoordNormalization2D;
|
|
#endif
|
|
|
|
in float batchId;
|
|
|
|
out vec4 v_startPlaneNormalEcAndHalfWidth;
|
|
out vec4 v_endPlaneNormalEcAndBatchId;
|
|
out vec4 v_rightPlaneEC;
|
|
out vec4 v_endEcAndStartEcX;
|
|
out vec4 v_texcoordNormalizationAndStartEcYZ;
|
|
|
|
// For materials
|
|
#ifdef WIDTH_VARYING
|
|
out float v_width;
|
|
#endif
|
|
#ifdef ANGLE_VARYING
|
|
out float v_polylineAngle;
|
|
#endif
|
|
|
|
#ifdef PER_INSTANCE_COLOR
|
|
out vec4 v_color;
|
|
#endif
|
|
|
|
void main()
|
|
{
|
|
#ifdef COLUMBUS_VIEW_2D
|
|
vec3 ecStart = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(vec3(0.0, startHiLo2D.xy), vec3(0.0, startHiLo2D.zw))).xyz;
|
|
|
|
vec3 forwardDirectionEC = czm_normal * vec3(0.0, offsetAndRight2D.xy);
|
|
vec3 ecEnd = forwardDirectionEC + ecStart;
|
|
forwardDirectionEC = normalize(forwardDirectionEC);
|
|
|
|
// Right plane
|
|
v_rightPlaneEC.xyz = czm_normal * vec3(0.0, offsetAndRight2D.zw);
|
|
v_rightPlaneEC.w = -dot(v_rightPlaneEC.xyz, ecStart);
|
|
|
|
// start plane
|
|
vec4 startPlaneEC;
|
|
startPlaneEC.xyz = czm_normal * vec3(0.0, startEndNormals2D.xy);
|
|
startPlaneEC.w = -dot(startPlaneEC.xyz, ecStart);
|
|
|
|
// end plane
|
|
vec4 endPlaneEC;
|
|
endPlaneEC.xyz = czm_normal * vec3(0.0, startEndNormals2D.zw);
|
|
endPlaneEC.w = -dot(endPlaneEC.xyz, ecEnd);
|
|
|
|
v_texcoordNormalizationAndStartEcYZ.x = abs(texcoordNormalization2D.x);
|
|
v_texcoordNormalizationAndStartEcYZ.y = texcoordNormalization2D.y;
|
|
|
|
#else // COLUMBUS_VIEW_2D
|
|
vec3 ecStart = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(startHiAndForwardOffsetX.xyz, startLoAndForwardOffsetY.xyz)).xyz;
|
|
vec3 offset = czm_normal * vec3(startHiAndForwardOffsetX.w, startLoAndForwardOffsetY.w, startNormalAndForwardOffsetZ.w);
|
|
vec3 ecEnd = ecStart + offset;
|
|
|
|
vec3 forwardDirectionEC = normalize(offset);
|
|
|
|
// start plane
|
|
vec4 startPlaneEC;
|
|
startPlaneEC.xyz = czm_normal * startNormalAndForwardOffsetZ.xyz;
|
|
startPlaneEC.w = -dot(startPlaneEC.xyz, ecStart);
|
|
|
|
// end plane
|
|
vec4 endPlaneEC;
|
|
endPlaneEC.xyz = czm_normal * endNormalAndTextureCoordinateNormalizationX.xyz;
|
|
endPlaneEC.w = -dot(endPlaneEC.xyz, ecEnd);
|
|
|
|
// Right plane
|
|
v_rightPlaneEC.xyz = czm_normal * rightNormalAndTextureCoordinateNormalizationY.xyz;
|
|
v_rightPlaneEC.w = -dot(v_rightPlaneEC.xyz, ecStart);
|
|
|
|
v_texcoordNormalizationAndStartEcYZ.x = abs(endNormalAndTextureCoordinateNormalizationX.w);
|
|
v_texcoordNormalizationAndStartEcYZ.y = rightNormalAndTextureCoordinateNormalizationY.w;
|
|
|
|
#endif // COLUMBUS_VIEW_2D
|
|
|
|
v_endEcAndStartEcX.xyz = ecEnd;
|
|
v_endEcAndStartEcX.w = ecStart.x;
|
|
v_texcoordNormalizationAndStartEcYZ.zw = ecStart.yz;
|
|
|
|
#ifdef PER_INSTANCE_COLOR
|
|
v_color = czm_batchTable_color(batchId);
|
|
#endif // PER_INSTANCE_COLOR
|
|
|
|
// Compute a normal along which to "push" the position out, extending the miter depending on view distance.
|
|
// Position has already been "pushed" by unit length along miter normal, and miter normals are encoded in the planes.
|
|
// Decode the normal to use at this specific vertex, push the position back, and then push to where it needs to be.
|
|
vec4 positionRelativeToEye = czm_computePosition();
|
|
|
|
// Check distance to the end plane and start plane, pick the plane that is closer
|
|
vec4 positionEC = czm_modelViewRelativeToEye * positionRelativeToEye; // w = 1.0, see czm_computePosition
|
|
float absStartPlaneDistance = abs(czm_planeDistance(startPlaneEC, positionEC.xyz));
|
|
float absEndPlaneDistance = abs(czm_planeDistance(endPlaneEC, positionEC.xyz));
|
|
vec3 planeDirection = czm_branchFreeTernary(absStartPlaneDistance < absEndPlaneDistance, startPlaneEC.xyz, endPlaneEC.xyz);
|
|
vec3 upOrDown = normalize(cross(v_rightPlaneEC.xyz, planeDirection)); // Points "up" for start plane, "down" at end plane.
|
|
vec3 normalEC = normalize(cross(planeDirection, upOrDown)); // In practice, the opposite seems to work too.
|
|
|
|
// Extrude bottom vertices downward for far view distances, like for GroundPrimitives
|
|
upOrDown = cross(forwardDirectionEC, normalEC);
|
|
upOrDown = float(czm_sceneMode == czm_sceneMode3D) * upOrDown;
|
|
upOrDown = float(v_texcoordNormalizationAndStartEcYZ.y > 1.0 || v_texcoordNormalizationAndStartEcYZ.y < 0.0) * upOrDown;
|
|
upOrDown = min(GLOBE_MINIMUM_ALTITUDE, czm_geometricToleranceOverMeter * length(positionRelativeToEye.xyz)) * upOrDown;
|
|
positionEC.xyz += upOrDown;
|
|
|
|
v_texcoordNormalizationAndStartEcYZ.y = czm_branchFreeTernary(v_texcoordNormalizationAndStartEcYZ.y > 1.0, 0.0, abs(v_texcoordNormalizationAndStartEcYZ.y));
|
|
|
|
// Determine distance along normalEC to push for a volume of appropriate width.
|
|
// Make volumes about double pixel width for a conservative fit - in practice the
|
|
// extra cost here is minimal compared to the loose volume heights.
|
|
//
|
|
// N = normalEC (guaranteed "right-facing")
|
|
// R = rightEC
|
|
// p = angle between N and R
|
|
// w = distance to push along R if R == N
|
|
// d = distance to push along N
|
|
//
|
|
// N R
|
|
// { p| } * cos(p) = dot(N, R) = w / d
|
|
// d | |w * d = w / dot(N, R)
|
|
// { | }
|
|
// o---------- polyline segment ---->
|
|
//
|
|
float width = czm_batchTable_width(batchId);
|
|
#ifdef WIDTH_VARYING
|
|
v_width = width;
|
|
#endif
|
|
|
|
v_startPlaneNormalEcAndHalfWidth.xyz = startPlaneEC.xyz;
|
|
v_startPlaneNormalEcAndHalfWidth.w = width * 0.5;
|
|
|
|
v_endPlaneNormalEcAndBatchId.xyz = endPlaneEC.xyz;
|
|
v_endPlaneNormalEcAndBatchId.w = batchId;
|
|
|
|
width = width * max(0.0, czm_metersPerPixel(positionEC)); // width = distance to push along R
|
|
width = width / dot(normalEC, v_rightPlaneEC.xyz); // width = distance to push along N
|
|
|
|
// Determine if this vertex is on the "left" or "right"
|
|
#ifdef COLUMBUS_VIEW_2D
|
|
normalEC *= sign(texcoordNormalization2D.x);
|
|
#else
|
|
normalEC *= sign(endNormalAndTextureCoordinateNormalizationX.w);
|
|
#endif
|
|
|
|
positionEC.xyz += width * normalEC;
|
|
gl_Position = czm_depthClamp(czm_projection * positionEC);
|
|
|
|
#ifdef ANGLE_VARYING
|
|
// Approximate relative screen space direction of the line.
|
|
vec2 approxLineDirection = normalize(vec2(forwardDirectionEC.x, -forwardDirectionEC.y));
|
|
approxLineDirection.y = czm_branchFreeTernary(approxLineDirection.x == 0.0 && approxLineDirection.y == 0.0, -1.0, approxLineDirection.y);
|
|
v_polylineAngle = czm_fastApproximateAtan(approxLineDirection.x, approxLineDirection.y);
|
|
#endif
|
|
}
|
|
`,bse=`in vec3 position3DHigh;
|
|
in vec3 position3DLow;
|
|
in vec3 prevPosition3DHigh;
|
|
in vec3 prevPosition3DLow;
|
|
in vec3 nextPosition3DHigh;
|
|
in vec3 nextPosition3DLow;
|
|
in vec2 expandAndWidth;
|
|
in vec4 color;
|
|
in float batchId;
|
|
|
|
out vec4 v_color;
|
|
|
|
void main()
|
|
{
|
|
float expandDir = expandAndWidth.x;
|
|
float width = abs(expandAndWidth.y) + 0.5;
|
|
bool usePrev = expandAndWidth.y < 0.0;
|
|
|
|
vec4 p = czm_computePosition();
|
|
vec4 prev = czm_computePrevPosition();
|
|
vec4 next = czm_computeNextPosition();
|
|
|
|
float angle;
|
|
vec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, angle);
|
|
gl_Position = czm_viewportOrthographic * positionWC;
|
|
|
|
v_color = color;
|
|
}
|
|
`,M0=`void clipLineSegmentToNearPlane(
|
|
vec3 p0,
|
|
vec3 p1,
|
|
out vec4 positionWC,
|
|
out bool clipped,
|
|
out bool culledByNearPlane,
|
|
out vec4 clippedPositionEC)
|
|
{
|
|
culledByNearPlane = false;
|
|
clipped = false;
|
|
|
|
vec3 p0ToP1 = p1 - p0;
|
|
float magnitude = length(p0ToP1);
|
|
vec3 direction = normalize(p0ToP1);
|
|
|
|
// Distance that p0 is behind the near plane. Negative means p0 is
|
|
// in front of the near plane.
|
|
float endPoint0Distance = czm_currentFrustum.x + p0.z;
|
|
|
|
// Camera looks down -Z.
|
|
// When moving a point along +Z: LESS VISIBLE
|
|
// * Points in front of the camera move closer to the camera.
|
|
// * Points behind the camrea move farther away from the camera.
|
|
// When moving a point along -Z: MORE VISIBLE
|
|
// * Points in front of the camera move farther away from the camera.
|
|
// * Points behind the camera move closer to the camera.
|
|
|
|
// Positive denominator: -Z, becoming more visible
|
|
// Negative denominator: +Z, becoming less visible
|
|
// Nearly zero: parallel to near plane
|
|
float denominator = -direction.z;
|
|
|
|
if (endPoint0Distance > 0.0 && abs(denominator) < czm_epsilon7)
|
|
{
|
|
// p0 is behind the near plane and the line to p1 is nearly parallel to
|
|
// the near plane, so cull the segment completely.
|
|
culledByNearPlane = true;
|
|
}
|
|
else if (endPoint0Distance > 0.0)
|
|
{
|
|
// p0 is behind the near plane, and the line to p1 is moving distinctly
|
|
// toward or away from it.
|
|
|
|
// t = (-plane distance - dot(plane normal, ray origin)) / dot(plane normal, ray direction)
|
|
float t = endPoint0Distance / denominator;
|
|
if (t < 0.0 || t > magnitude)
|
|
{
|
|
// Near plane intersection is not between the two points.
|
|
// We already confirmed p0 is behind the naer plane, so now
|
|
// we know the entire segment is behind it.
|
|
culledByNearPlane = true;
|
|
}
|
|
else
|
|
{
|
|
// Segment crosses the near plane, update p0 to lie exactly on it.
|
|
p0 = p0 + t * direction;
|
|
|
|
// Numerical noise might put us a bit on the wrong side of the near plane.
|
|
// Don't let that happen.
|
|
p0.z = min(p0.z, -czm_currentFrustum.x);
|
|
|
|
clipped = true;
|
|
}
|
|
}
|
|
|
|
clippedPositionEC = vec4(p0, 1.0);
|
|
positionWC = czm_eyeToWindowCoordinates(clippedPositionEC);
|
|
}
|
|
|
|
vec4 getPolylineWindowCoordinatesEC(vec4 positionEC, vec4 prevEC, vec4 nextEC, float expandDirection, float width, bool usePrevious, out float angle)
|
|
{
|
|
// expandDirection +1 is to the _left_ when looking from positionEC toward nextEC.
|
|
|
|
#ifdef POLYLINE_DASH
|
|
// Compute the window coordinates of the points.
|
|
vec4 positionWindow = czm_eyeToWindowCoordinates(positionEC);
|
|
vec4 previousWindow = czm_eyeToWindowCoordinates(prevEC);
|
|
vec4 nextWindow = czm_eyeToWindowCoordinates(nextEC);
|
|
|
|
// Determine the relative screen space direction of the line.
|
|
vec2 lineDir;
|
|
if (usePrevious) {
|
|
lineDir = normalize(positionWindow.xy - previousWindow.xy);
|
|
}
|
|
else {
|
|
lineDir = normalize(nextWindow.xy - positionWindow.xy);
|
|
}
|
|
angle = atan(lineDir.x, lineDir.y) - 1.570796327; // precomputed atan(1,0)
|
|
|
|
// Quantize the angle so it doesn't change rapidly between segments.
|
|
angle = floor(angle / czm_piOverFour + 0.5) * czm_piOverFour;
|
|
#endif
|
|
|
|
vec4 clippedPrevWC, clippedPrevEC;
|
|
bool prevSegmentClipped, prevSegmentCulled;
|
|
clipLineSegmentToNearPlane(prevEC.xyz, positionEC.xyz, clippedPrevWC, prevSegmentClipped, prevSegmentCulled, clippedPrevEC);
|
|
|
|
vec4 clippedNextWC, clippedNextEC;
|
|
bool nextSegmentClipped, nextSegmentCulled;
|
|
clipLineSegmentToNearPlane(nextEC.xyz, positionEC.xyz, clippedNextWC, nextSegmentClipped, nextSegmentCulled, clippedNextEC);
|
|
|
|
bool segmentClipped, segmentCulled;
|
|
vec4 clippedPositionWC, clippedPositionEC;
|
|
clipLineSegmentToNearPlane(positionEC.xyz, usePrevious ? prevEC.xyz : nextEC.xyz, clippedPositionWC, segmentClipped, segmentCulled, clippedPositionEC);
|
|
|
|
if (segmentCulled)
|
|
{
|
|
return vec4(0.0, 0.0, 0.0, 1.0);
|
|
}
|
|
|
|
vec2 directionToPrevWC = normalize(clippedPrevWC.xy - clippedPositionWC.xy);
|
|
vec2 directionToNextWC = normalize(clippedNextWC.xy - clippedPositionWC.xy);
|
|
|
|
// If a segment was culled, we can't use the corresponding direction
|
|
// computed above. We should never see both of these be true without
|
|
// \`segmentCulled\` above also being true.
|
|
if (prevSegmentCulled)
|
|
{
|
|
directionToPrevWC = -directionToNextWC;
|
|
}
|
|
else if (nextSegmentCulled)
|
|
{
|
|
directionToNextWC = -directionToPrevWC;
|
|
}
|
|
|
|
vec2 thisSegmentForwardWC, otherSegmentForwardWC;
|
|
if (usePrevious)
|
|
{
|
|
thisSegmentForwardWC = -directionToPrevWC;
|
|
otherSegmentForwardWC = directionToNextWC;
|
|
}
|
|
else
|
|
{
|
|
thisSegmentForwardWC = directionToNextWC;
|
|
otherSegmentForwardWC = -directionToPrevWC;
|
|
}
|
|
|
|
vec2 thisSegmentLeftWC = vec2(-thisSegmentForwardWC.y, thisSegmentForwardWC.x);
|
|
|
|
vec2 leftWC = thisSegmentLeftWC;
|
|
float expandWidth = width * 0.5;
|
|
|
|
// When lines are split at the anti-meridian, the position may be at the
|
|
// same location as the next or previous position, and we need to handle
|
|
// that to avoid producing NaNs.
|
|
if (!czm_equalsEpsilon(prevEC.xyz - positionEC.xyz, vec3(0.0), czm_epsilon1) && !czm_equalsEpsilon(nextEC.xyz - positionEC.xyz, vec3(0.0), czm_epsilon1))
|
|
{
|
|
vec2 otherSegmentLeftWC = vec2(-otherSegmentForwardWC.y, otherSegmentForwardWC.x);
|
|
|
|
vec2 leftSumWC = thisSegmentLeftWC + otherSegmentLeftWC;
|
|
float leftSumLength = length(leftSumWC);
|
|
leftWC = leftSumLength < czm_epsilon6 ? thisSegmentLeftWC : (leftSumWC / leftSumLength);
|
|
|
|
// The sine of the angle between the two vectors is given by the formula
|
|
// |a x b| = |a||b|sin(theta)
|
|
// which is
|
|
// float sinAngle = length(cross(vec3(leftWC, 0.0), vec3(-thisSegmentForwardWC, 0.0)));
|
|
// Because the z components of both vectors are zero, the x and y coordinate will be zero.
|
|
// Therefore, the sine of the angle is just the z component of the cross product.
|
|
vec2 u = -thisSegmentForwardWC;
|
|
vec2 v = leftWC;
|
|
float sinAngle = abs(u.x * v.y - u.y * v.x);
|
|
expandWidth = clamp(expandWidth / sinAngle, 0.0, width * 2.0);
|
|
}
|
|
|
|
vec2 offset = leftWC * expandDirection * expandWidth * czm_pixelRatio;
|
|
return vec4(clippedPositionWC.xy + offset, -clippedPositionWC.z, 1.0) * (czm_projection * clippedPositionEC).w;
|
|
}
|
|
|
|
vec4 getPolylineWindowCoordinates(vec4 position, vec4 previous, vec4 next, float expandDirection, float width, bool usePrevious, out float angle)
|
|
{
|
|
vec4 positionEC = czm_modelViewRelativeToEye * position;
|
|
vec4 prevEC = czm_modelViewRelativeToEye * previous;
|
|
vec4 nextEC = czm_modelViewRelativeToEye * next;
|
|
return getPolylineWindowCoordinatesEC(positionEC, prevEC, nextEC, expandDirection, width, usePrevious, angle);
|
|
}
|
|
`;let MI=`${M0}
|
|
${bse}`;const Tse=jk;Yt.isInternetExplorer()||(MI=`#define CLIP_POLYLINE
|
|
${MI}`);function ds(e){e=y(e,y.EMPTY_OBJECT);const t=y(e.translucent,!0),n=!1,i=ds.VERTEX_FORMAT;this.material=void 0,this.translucent=t,this._vertexShaderSource=y(e.vertexShaderSource,MI),this._fragmentShaderSource=y(e.fragmentShaderSource,Tse),this._renderState=Lo.getDefaultRenderState(t,n,e.renderState),this._closed=n,this._vertexFormat=i}Object.defineProperties(ds.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},renderState:{get:function(){return this._renderState}},closed:{get:function(){return this._closed}},vertexFormat:{get:function(){return this._vertexFormat}}});ds.VERTEX_FORMAT=Ee.POSITION_ONLY;ds.prototype.getFragmentShaderSource=Lo.prototype.getFragmentShaderSource;ds.prototype.isTranslucent=Lo.prototype.isTranslucent;ds.prototype.getRenderState=Lo.prototype.getRenderState;const Ase=`in vec3 position3DHigh;
|
|
in vec3 position3DLow;
|
|
in vec3 prevPosition3DHigh;
|
|
in vec3 prevPosition3DLow;
|
|
in vec3 nextPosition3DHigh;
|
|
in vec3 nextPosition3DLow;
|
|
in vec2 expandAndWidth;
|
|
in vec2 st;
|
|
in float batchId;
|
|
|
|
out float v_width;
|
|
out vec2 v_st;
|
|
out float v_polylineAngle;
|
|
|
|
void main()
|
|
{
|
|
float expandDir = expandAndWidth.x;
|
|
float width = abs(expandAndWidth.y) + 0.5;
|
|
bool usePrev = expandAndWidth.y < 0.0;
|
|
|
|
vec4 p = czm_computePosition();
|
|
vec4 prev = czm_computePrevPosition();
|
|
vec4 next = czm_computeNextPosition();
|
|
|
|
float angle;
|
|
vec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, angle);
|
|
gl_Position = czm_viewportOrthographic * positionWC;
|
|
|
|
v_width = width;
|
|
v_st.s = st.s;
|
|
v_st.t = czm_writeNonPerspective(st.t, gl_Position.w);
|
|
v_polylineAngle = angle;
|
|
}
|
|
`,IV=`#ifdef VECTOR_TILE
|
|
uniform vec4 u_highlightColor;
|
|
#endif
|
|
|
|
in vec2 v_st;
|
|
|
|
void main()
|
|
{
|
|
czm_materialInput materialInput;
|
|
|
|
vec2 st = v_st;
|
|
st.t = czm_readNonPerspective(st.t, gl_FragCoord.w);
|
|
|
|
materialInput.s = st.s;
|
|
materialInput.st = st;
|
|
materialInput.str = vec3(st, 0.0);
|
|
|
|
czm_material material = czm_getMaterial(materialInput);
|
|
out_FragColor = vec4(material.diffuse + material.emission, material.alpha);
|
|
#ifdef VECTOR_TILE
|
|
out_FragColor *= u_highlightColor;
|
|
#endif
|
|
|
|
czm_writeLogDepth();
|
|
}
|
|
`;let FI=`${M0}
|
|
${Ase}`;const xse=IV;Yt.isInternetExplorer()||(FI=`#define CLIP_POLYLINE
|
|
${FI}`);function Ur(e){e=y(e,y.EMPTY_OBJECT);const t=y(e.translucent,!0),n=!1,i=Ur.VERTEX_FORMAT;this.material=c(e.material)?e.material:Se.fromType(Se.ColorType),this.translucent=t,this._vertexShaderSource=y(e.vertexShaderSource,FI),this._fragmentShaderSource=y(e.fragmentShaderSource,xse),this._renderState=Lo.getDefaultRenderState(t,n,e.renderState),this._closed=n,this._vertexFormat=i}Object.defineProperties(Ur.prototype,{vertexShaderSource:{get:function(){let e=this._vertexShaderSource;return this.material.shaderSource.search(/in\s+float\s+v_polylineAngle;/g)!==-1&&(e=`#define POLYLINE_DASH
|
|
${e}`),e}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},renderState:{get:function(){return this._renderState}},closed:{get:function(){return this._closed}},vertexFormat:{get:function(){return this._vertexFormat}}});Ur.VERTEX_FORMAT=Ee.POSITION_AND_ST;Ur.prototype.getFragmentShaderSource=Lo.prototype.getFragmentShaderSource;Ur.prototype.isTranslucent=Lo.prototype.isTranslucent;Ur.prototype.getRenderState=Lo.prototype.getRenderState;function Sc(e){e=y(e,y.EMPTY_OBJECT),this.geometryInstances=e.geometryInstances,this._hasPerInstanceColors=!0;let t=e.appearance;c(t)||(t=new Ur),this.appearance=t,this.show=y(e.show,!0),this.classificationType=y(e.classificationType,Ui.BOTH),this.debugShowBoundingVolume=y(e.debugShowBoundingVolume,!1),this._debugShowShadowVolume=y(e.debugShowShadowVolume,!1),this._primitiveOptions={geometryInstances:void 0,appearance:void 0,vertexCacheOptimize:!1,interleave:y(e.interleave,!1),releaseGeometryInstances:y(e.releaseGeometryInstances,!0),allowPicking:y(e.allowPicking,!0),asynchronous:y(e.asynchronous,!0),compressVertices:!1,_createShaderProgramFunction:void 0,_createCommandsFunction:void 0,_updateAndQueueCommandsFunction:void 0},this._zIndex=void 0,this._ready=!1,this._primitive=void 0,this._sp=void 0,this._sp2D=void 0,this._spMorph=void 0,this._renderState=ZN(!1),this._renderState3DTiles=ZN(!0),this._renderStateMorph=Ue.fromCache({cull:{enabled:!0,face:Qi.FRONT},depthTest:{enabled:!0},blending:Zn.PRE_MULTIPLIED_ALPHA_BLEND,depthMask:!1})}Object.defineProperties(Sc.prototype,{interleave:{get:function(){return this._primitiveOptions.interleave}},releaseGeometryInstances:{get:function(){return this._primitiveOptions.releaseGeometryInstances}},allowPicking:{get:function(){return this._primitiveOptions.allowPicking}},asynchronous:{get:function(){return this._primitiveOptions.asynchronous}},ready:{get:function(){return this._ready}},debugShowShadowVolume:{get:function(){return this._debugShowShadowVolume}}});Sc.initializeTerrainHeights=function(){return Ti.initialize()};function Cse(e,t,n){const i=t.context,o=e._primitive,r=o._attributeLocations;let s=o._batchTable.getVertexShaderCallback()(yse);s=Mt._appendShowToShader(o,s),s=Mt._appendDistanceDisplayConditionToShader(o,s),s=Mt._modifyShaderPosition(e,s,t.scene3DOnly);let a=o._batchTable.getVertexShaderCallback()(gse);a=Mt._appendShowToShader(o,a),a=Mt._appendDistanceDisplayConditionToShader(o,a),a=Mt._modifyShaderPosition(e,a,t.scene3DOnly);let l=o._batchTable.getVertexShaderCallback()(mse);const u=[`GLOBE_MINIMUM_ALTITUDE ${t.mapProjection.ellipsoid.minimumRadius.toFixed(1)}`];let h="",f="";c(n.material)?(f=c(n.material)?n.material.shaderSource:"",f.search(/in\s+float\s+v_polylineAngle;/g)!==-1&&u.push("ANGLE_VARYING"),f.search(/in\s+float\s+v_width;/g)!==-1&&u.push("WIDTH_VARYING")):h="PER_INSTANCE_COLOR",u.push(h);const _=e.debugShowShadowVolume?["DEBUG_SHOW_VOLUME",h]:[h],g=new Oe({defines:u,sources:[s]}),m=new Oe({defines:_,sources:[f,l]});e._sp=Jt.replaceCache({context:i,shaderProgram:o._sp,vertexShaderSource:g,fragmentShaderSource:m,attributeLocations:r});let b=i.shaderCache.getDerivedShaderProgram(e._sp,"2dColor");if(!c(b)){const x=new Oe({defines:u.concat(["COLUMBUS_VIEW_2D"]),sources:[s]});b=i.shaderCache.createDerivedShaderProgram(e._sp,"2dColor",{context:i,shaderProgram:e._sp2D,vertexShaderSource:x,fragmentShaderSource:m,attributeLocations:r})}e._sp2D=b;let T=i.shaderCache.getDerivedShaderProgram(e._sp,"MorphColor");if(!c(T)){const x=new Oe({defines:u.concat([`MAX_TERRAIN_HEIGHT ${Ti._defaultMaxTerrainHeight.toFixed(1)}`]),sources:[a]});l=o._batchTable.getVertexShaderCallback()(_se);const C=new Oe({defines:_,sources:[f,l]});T=i.shaderCache.createDerivedShaderProgram(e._sp,"MorphColor",{context:i,shaderProgram:e._spMorph,vertexShaderSource:x,fragmentShaderSource:C,attributeLocations:r})}e._spMorph=T}function ZN(e){return Ue.fromCache({cull:{enabled:!0},blending:Zn.PRE_MULTIPLIED_ALPHA_BLEND,depthMask:!1,stencilTest:{enabled:e,frontFunction:Pn.EQUAL,frontOperation:{fail:nt.KEEP,zFail:nt.KEEP,zPass:nt.KEEP},backFunction:Pn.EQUAL,backOperation:{fail:nt.KEEP,zFail:nt.KEEP,zPass:nt.KEEP},reference:At.CESIUM_3D_TILE_MASK,mask:At.CESIUM_3D_TILE_MASK}})}function Ese(e,t,n,i,o,r){const s=e._primitive,a=s._va.length;o.length=a,r.length=a;const u=t instanceof ds?{}:n._uniforms,h=s._batchTable.getUniformMapCallback()(u);for(let f=0;f<a;f++){const _=s._va[f];let g=o[f];c(g)||(g=o[f]=new Ze({owner:e,primitiveType:s._primitiveType})),g.vertexArray=_,g.renderState=e._renderState,g.shaderProgram=e._sp,g.uniformMap=h,g.pass=xe.TERRAIN_CLASSIFICATION,g.pickId="czm_batchTable_pickColor(v_endPlaneNormalEcAndBatchId.w)";const m=Ze.shallowClone(g,g.derivedCommands.tileset);m.renderState=e._renderState3DTiles,m.pass=xe.CESIUM_3D_TILE_CLASSIFICATION,g.derivedCommands.tileset=m;const b=Ze.shallowClone(g,g.derivedCommands.color2D);b.shaderProgram=e._sp2D,g.derivedCommands.color2D=b;const T=Ze.shallowClone(m,m.derivedCommands.color2D);T.shaderProgram=e._sp2D,m.derivedCommands.color2D=T;const x=Ze.shallowClone(g,g.derivedCommands.colorMorph);x.renderState=e._renderStateMorph,x.shaderProgram=e._spMorph,x.pickId="czm_batchTable_pickColor(v_batchId)",g.derivedCommands.colorMorph=x}}function JN(e,t,n,i,o,r,s){n.mode===oe.MORPHING?t=t.derivedCommands.colorMorph:n.mode!==oe.SCENE3D&&(t=t.derivedCommands.color2D),t.modelMatrix=i,t.boundingVolume=r,t.cull=o,t.debugShowBoundingVolume=s,n.commandList.push(t)}function wse(e,t,n,i,o,r,s){const a=e._primitive;Mt._updateBoundingVolumes(a,t,o);let l;t.mode===oe.SCENE3D?l=a._boundingSphereWC:t.mode===oe.COLUMBUS_VIEW?l=a._boundingSphereCV:t.mode===oe.SCENE2D&&c(a._boundingSphere2D)?l=a._boundingSphere2D:c(a._boundingSphereMorph)&&(l=a._boundingSphereMorph);const u=t.mode===oe.MORPHING,h=e.classificationType,f=h!==Ui.CESIUM_3D_TILE,_=h!==Ui.TERRAIN&&!u;let g;const m=t.passes;if(m.render||m.pick&&a.allowPicking){const b=n.length;for(let T=0;T<b;++T){const x=l[T];f&&(g=n[T],JN(e,g,t,o,r,x,s)),_&&(g=n[T].derivedCommands.tileset,JN(e,g,t,o,r,x,s))}}}Sc.prototype.update=function(e){if(!c(this._primitive)&&!c(this.geometryInstances))return;if(!Ti.initialized){if(!this.asynchronous)throw new E("For synchronous GroundPolylinePrimitives, you must call GroundPolylinePrimitives.initializeTerrainHeights() and wait for the returned promise to resolve.");Sc.initializeTerrainHeights();return}let t;const n=this,i=this._primitiveOptions;if(!c(this._primitive)){const o=Array.isArray(this.geometryInstances)?this.geometryInstances:[this.geometryInstances],r=o.length,s=new Array(r);let a;for(t=0;t<r;++t)if(a=o[t].attributes,!c(a)||!c(a.color)){this._hasPerInstanceColors=!1;break}for(t=0;t<r;++t){const l=o[t];a={};const u=l.attributes;for(const h in u)u.hasOwnProperty(h)&&(a[h]=u[h]);c(a.width)||(a.width=new ll({componentDatatype:Z.UNSIGNED_BYTE,componentsPerAttribute:1,value:[l.geometry.width]})),l.geometry._scene3DOnly=e.scene3DOnly,ud.setProjectionAndEllipsoid(l.geometry,e.mapProjection),s[t]=new Gt({geometry:l.geometry,attributes:a,id:l.id,pickPrimitive:n})}i.geometryInstances=s,i.appearance=this.appearance,i._createShaderProgramFunction=function(l,u,h){Cse(n,u,h)},i._createCommandsFunction=function(l,u,h,f,_,g,m){Ese(n,u,h,f,g,m)},i._updateAndQueueCommandsFunction=function(l,u,h,f,_,g,m,b){wse(n,u,h,f,_,g,m)},this._primitive=new Mt(i)}if(this.appearance instanceof ds&&!this._hasPerInstanceColors)throw new E("All GeometryInstances must have color attributes to use PolylineColorAppearance with GroundPolylinePrimitive.");this._primitive.appearance=this.appearance,this._primitive.show=this.show,this._primitive.debugShowBoundingVolume=this.debugShowBoundingVolume,this._primitive.update(e),e.afterRender.push(()=>{!this._ready&&c(this._primitive)&&this._primitive.ready&&(this._ready=!0,this.releaseGeometryInstances&&(this.geometryInstances=void 0))})};Sc.prototype.getGeometryInstanceAttributes=function(e){if(!c(this._primitive))throw new E("must call update before calling getGeometryInstanceAttributes");return this._primitive.getGeometryInstanceAttributes(e)};Sc.isSupported=function(e){return e.frameState.context.depthTexture};Sc.prototype.isDestroyed=function(){return!1};Sc.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),this._sp=this._sp&&this._sp.destroy(),this._sp2D=void 0,this._spMorph=void 0,ve(this)};const Sse=new H(1,1),vse=!1,Ise=z.WHITE;function P_(e){e=y(e,y.EMPTY_OBJECT),this._definitionChanged=new Le,this._image=void 0,this._imageSubscription=void 0,this._repeat=void 0,this._repeatSubscription=void 0,this._color=void 0,this._colorSubscription=void 0,this._transparent=void 0,this._transparentSubscription=void 0,this.image=e.image,this.repeat=e.repeat,this.color=e.color,this.transparent=e.transparent}Object.defineProperties(P_.prototype,{isConstant:{get:function(){return K.isConstant(this._image)&&K.isConstant(this._repeat)}},definitionChanged:{get:function(){return this._definitionChanged}},image:ue("image"),repeat:ue("repeat"),color:ue("color"),transparent:ue("transparent")});P_.prototype.getType=function(e){return"Image"};P_.prototype.getValue=function(e,t){return c(t)||(t={}),t.image=K.getValueOrUndefined(this._image,e),t.repeat=K.getValueOrClonedDefault(this._repeat,e,Sse,t.repeat),t.color=K.getValueOrClonedDefault(this._color,e,Ise,t.color),K.getValueOrDefault(this._transparent,e,vse)&&(t.color.alpha=Math.min(.99,t.color.alpha)),t};P_.prototype.equals=function(e){return this===e||e instanceof P_&&K.equals(this._image,e._image)&&K.equals(this._repeat,e._repeat)&&K.equals(this._color,e._color)&&K.equals(this._transparent,e._transparent)};function Dse(e){if(e instanceof z)return new kt(e);if(typeof e=="string"||e instanceof Ae||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement){const t=new P_;return t.image=e,t}throw new E(`Unable to infer material type: ${e}`)}function Ma(e,t){return ue(e,t,Dse)}function Jy(e){this._definitionChanged=new Le,this._show=void 0,this._showSubscription=void 0,this._dimensions=void 0,this._dimensionsSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this.merge(y(e,y.EMPTY_OBJECT))}Object.defineProperties(Jy.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ue("show"),dimensions:ue("dimensions"),heightReference:ue("heightReference"),fill:ue("fill"),material:Ma("material"),outline:ue("outline"),outlineColor:ue("outlineColor"),outlineWidth:ue("outlineWidth"),shadows:ue("shadows"),distanceDisplayCondition:ue("distanceDisplayCondition")});Jy.prototype.clone=function(e){return c(e)?(e.show=this.show,e.dimensions=this.dimensions,e.heightReference=this.heightReference,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e):new Jy(this)};Jy.prototype.merge=function(e){if(!c(e))throw new E("source is required.");this.show=y(this.show,e.show),this.dimensions=y(this.dimensions,e.dimensions),this.heightReference=y(this.heightReference,e.heightReference),this.fill=y(this.fill,e.fill),this.material=y(this.material,e.material),this.outline=y(this.outline,e.outline),this.outlineColor=y(this.outlineColor,e.outlineColor),this.outlineWidth=y(this.outlineWidth,e.outlineWidth),this.shadows=y(this.shadows,e.shadows),this.distanceDisplayCondition=y(this.distanceDisplayCondition,e.distanceDisplayCondition)};const Pse={FIXED:0,INERTIAL:1},Bs=Object.freeze(Pse);function Kh(){E.throwInstantiationError()}Object.defineProperties(Kh.prototype,{isConstant:{get:E.throwInstantiationError},definitionChanged:{get:E.throwInstantiationError},referenceFrame:{get:E.throwInstantiationError}});Kh.prototype.getValue=E.throwInstantiationError;Kh.prototype.getValueInReferenceFrame=E.throwInstantiationError;Kh.prototype.equals=E.throwInstantiationError;const Ow=new $;Kh.convertToReferenceFrame=function(e,t,n,i,o){if(!c(t))return t;if(c(o)||(o=new d),n===i)return d.clone(t,o);let r=zt.computeIcrfToFixedMatrix(e,Ow);if(c(r)||(r=zt.computeTemeToPseudoFixedMatrix(e,Ow)),n===Bs.INERTIAL)return $.multiplyByVector(r,t,o);if(n===Bs.FIXED)return $.multiplyByVector($.transpose(r,Ow),t,o)};function hd(e,t){this._definitionChanged=new Le,this._value=d.clone(e),this._referenceFrame=y(t,Bs.FIXED)}Object.defineProperties(hd.prototype,{isConstant:{get:function(){return!c(this._value)||this._referenceFrame===Bs.FIXED}},definitionChanged:{get:function(){return this._definitionChanged}},referenceFrame:{get:function(){return this._referenceFrame}}});hd.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,Bs.FIXED,t)};hd.prototype.setValue=function(e,t){let n=!1;d.equals(this._value,e)||(n=!0,this._value=d.clone(e)),c(t)&&this._referenceFrame!==t&&(n=!0,this._referenceFrame=t),n&&this._definitionChanged.raiseEvent(this)};hd.prototype.getValueInReferenceFrame=function(e,t,n){if(!c(e))throw new E("time is required.");if(!c(t))throw new E("referenceFrame is required.");return Kh.convertToReferenceFrame(e,this._value,this._referenceFrame,t,n)};hd.prototype.equals=function(e){return this===e||e instanceof hd&&d.equals(this._value,e._value)&&this._referenceFrame===e._referenceFrame};function e0(e){this._definitionChanged=new Le,this._show=void 0,this._showSubscription=void 0,this._positions=void 0,this._positionsSubscription=void 0,this._width=void 0,this._widthSubscription=void 0,this._height=void 0,this._heightSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._extrudedHeight=void 0,this._extrudedHeightSubscription=void 0,this._extrudedHeightReference=void 0,this._extrudedHeightReferenceSubscription=void 0,this._cornerType=void 0,this._cornerTypeSubscription=void 0,this._granularity=void 0,this._granularitySubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this._classificationType=void 0,this._classificationTypeSubscription=void 0,this._zIndex=void 0,this._zIndexSubscription=void 0,this.merge(y(e,y.EMPTY_OBJECT))}Object.defineProperties(e0.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ue("show"),positions:ue("positions"),width:ue("width"),height:ue("height"),heightReference:ue("heightReference"),extrudedHeight:ue("extrudedHeight"),extrudedHeightReference:ue("extrudedHeightReference"),cornerType:ue("cornerType"),granularity:ue("granularity"),fill:ue("fill"),material:Ma("material"),outline:ue("outline"),outlineColor:ue("outlineColor"),outlineWidth:ue("outlineWidth"),shadows:ue("shadows"),distanceDisplayCondition:ue("distanceDisplayCondition"),classificationType:ue("classificationType"),zIndex:ue("zIndex")});e0.prototype.clone=function(e){return c(e)?(e.show=this.show,e.positions=this.positions,e.width=this.width,e.height=this.height,e.heightReference=this.heightReference,e.extrudedHeight=this.extrudedHeight,e.extrudedHeightReference=this.extrudedHeightReference,e.cornerType=this.cornerType,e.granularity=this.granularity,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e.classificationType=this.classificationType,e.zIndex=this.zIndex,e):new e0(this)};e0.prototype.merge=function(e){if(!c(e))throw new E("source is required.");this.show=y(this.show,e.show),this.positions=y(this.positions,e.positions),this.width=y(this.width,e.width),this.height=y(this.height,e.height),this.heightReference=y(this.heightReference,e.heightReference),this.extrudedHeight=y(this.extrudedHeight,e.extrudedHeight),this.extrudedHeightReference=y(this.extrudedHeightReference,e.extrudedHeightReference),this.cornerType=y(this.cornerType,e.cornerType),this.granularity=y(this.granularity,e.granularity),this.fill=y(this.fill,e.fill),this.material=y(this.material,e.material),this.outline=y(this.outline,e.outline),this.outlineColor=y(this.outlineColor,e.outlineColor),this.outlineWidth=y(this.outlineWidth,e.outlineWidth),this.shadows=y(this.shadows,e.shadows),this.distanceDisplayCondition=y(this.distanceDisplayCondition,e.distanceDisplayCondition),this.classificationType=y(this.classificationType,e.classificationType),this.zIndex=y(this.zIndex,e.zIndex)};function Ose(e){return e}function BI(e,t){return ue(e,t,Ose)}function t0(e){this._definitionChanged=new Le,this._show=void 0,this._showSubscription=void 0,this._length=void 0,this._lengthSubscription=void 0,this._topRadius=void 0,this._topRadiusSubscription=void 0,this._bottomRadius=void 0,this._bottomRadiusSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._numberOfVerticalLines=void 0,this._numberOfVerticalLinesSubscription=void 0,this._slices=void 0,this._slicesSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this.merge(y(e,y.EMPTY_OBJECT))}Object.defineProperties(t0.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ue("show"),length:ue("length"),topRadius:ue("topRadius"),bottomRadius:ue("bottomRadius"),heightReference:ue("heightReference"),fill:ue("fill"),material:Ma("material"),outline:ue("outline"),outlineColor:ue("outlineColor"),outlineWidth:ue("outlineWidth"),numberOfVerticalLines:ue("numberOfVerticalLines"),slices:ue("slices"),shadows:ue("shadows"),distanceDisplayCondition:ue("distanceDisplayCondition")});t0.prototype.clone=function(e){return c(e)?(e.show=this.show,e.length=this.length,e.topRadius=this.topRadius,e.bottomRadius=this.bottomRadius,e.heightReference=this.heightReference,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.numberOfVerticalLines=this.numberOfVerticalLines,e.slices=this.slices,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e):new t0(this)};t0.prototype.merge=function(e){if(!c(e))throw new E("source is required.");this.show=y(this.show,e.show),this.length=y(this.length,e.length),this.topRadius=y(this.topRadius,e.topRadius),this.bottomRadius=y(this.bottomRadius,e.bottomRadius),this.heightReference=y(this.heightReference,e.heightReference),this.fill=y(this.fill,e.fill),this.material=y(this.material,e.material),this.outline=y(this.outline,e.outline),this.outlineColor=y(this.outlineColor,e.outlineColor),this.outlineWidth=y(this.outlineWidth,e.outlineWidth),this.numberOfVerticalLines=y(this.numberOfVerticalLines,e.numberOfVerticalLines),this.slices=y(this.slices,e.slices),this.shadows=y(this.shadows,e.shadows),this.distanceDisplayCondition=y(this.distanceDisplayCondition,e.distanceDisplayCondition)};function n0(e){this._definitionChanged=new Le,this._show=void 0,this._showSubscription=void 0,this._semiMajorAxis=void 0,this._semiMajorAxisSubscription=void 0,this._semiMinorAxis=void 0,this._semiMinorAxisSubscription=void 0,this._height=void 0,this._heightSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._extrudedHeight=void 0,this._extrudedHeightSubscription=void 0,this._extrudedHeightReference=void 0,this._extrudedHeightReferenceSubscription=void 0,this._rotation=void 0,this._rotationSubscription=void 0,this._stRotation=void 0,this._stRotationSubscription=void 0,this._granularity=void 0,this._granularitySubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._numberOfVerticalLines=void 0,this._numberOfVerticalLinesSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this._classificationType=void 0,this._classificationTypeSubscription=void 0,this._zIndex=void 0,this._zIndexSubscription=void 0,this.merge(y(e,y.EMPTY_OBJECT))}Object.defineProperties(n0.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ue("show"),semiMajorAxis:ue("semiMajorAxis"),semiMinorAxis:ue("semiMinorAxis"),height:ue("height"),heightReference:ue("heightReference"),extrudedHeight:ue("extrudedHeight"),extrudedHeightReference:ue("extrudedHeightReference"),rotation:ue("rotation"),stRotation:ue("stRotation"),granularity:ue("granularity"),fill:ue("fill"),material:Ma("material"),outline:ue("outline"),outlineColor:ue("outlineColor"),outlineWidth:ue("outlineWidth"),numberOfVerticalLines:ue("numberOfVerticalLines"),shadows:ue("shadows"),distanceDisplayCondition:ue("distanceDisplayCondition"),classificationType:ue("classificationType"),zIndex:ue("zIndex")});n0.prototype.clone=function(e){return c(e)?(e.show=this.show,e.semiMajorAxis=this.semiMajorAxis,e.semiMinorAxis=this.semiMinorAxis,e.height=this.height,e.heightReference=this.heightReference,e.extrudedHeight=this.extrudedHeight,e.extrudedHeightReference=this.extrudedHeightReference,e.rotation=this.rotation,e.stRotation=this.stRotation,e.granularity=this.granularity,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.numberOfVerticalLines=this.numberOfVerticalLines,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e.classificationType=this.classificationType,e.zIndex=this.zIndex,e):new n0(this)};n0.prototype.merge=function(e){if(!c(e))throw new E("source is required.");this.show=y(this.show,e.show),this.semiMajorAxis=y(this.semiMajorAxis,e.semiMajorAxis),this.semiMinorAxis=y(this.semiMinorAxis,e.semiMinorAxis),this.height=y(this.height,e.height),this.heightReference=y(this.heightReference,e.heightReference),this.extrudedHeight=y(this.extrudedHeight,e.extrudedHeight),this.extrudedHeightReference=y(this.extrudedHeightReference,e.extrudedHeightReference),this.rotation=y(this.rotation,e.rotation),this.stRotation=y(this.stRotation,e.stRotation),this.granularity=y(this.granularity,e.granularity),this.fill=y(this.fill,e.fill),this.material=y(this.material,e.material),this.outline=y(this.outline,e.outline),this.outlineColor=y(this.outlineColor,e.outlineColor),this.outlineWidth=y(this.outlineWidth,e.outlineWidth),this.numberOfVerticalLines=y(this.numberOfVerticalLines,e.numberOfVerticalLines),this.shadows=y(this.shadows,e.shadows),this.distanceDisplayCondition=y(this.distanceDisplayCondition,e.distanceDisplayCondition),this.classificationType=y(this.classificationType,e.classificationType),this.zIndex=y(this.zIndex,e.zIndex)};function i0(e){this._definitionChanged=new Le,this._show=void 0,this._showSubscription=void 0,this._radii=void 0,this._radiiSubscription=void 0,this._innerRadii=void 0,this._innerRadiiSubscription=void 0,this._minimumClock=void 0,this._minimumClockSubscription=void 0,this._maximumClock=void 0,this._maximumClockSubscription=void 0,this._minimumCone=void 0,this._minimumConeSubscription=void 0,this._maximumCone=void 0,this._maximumConeSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._stackPartitions=void 0,this._stackPartitionsSubscription=void 0,this._slicePartitions=void 0,this._slicePartitionsSubscription=void 0,this._subdivisions=void 0,this._subdivisionsSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this.merge(y(e,y.EMPTY_OBJECT))}Object.defineProperties(i0.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ue("show"),radii:ue("radii"),innerRadii:ue("innerRadii"),minimumClock:ue("minimumClock"),maximumClock:ue("maximumClock"),minimumCone:ue("minimumCone"),maximumCone:ue("maximumCone"),heightReference:ue("heightReference"),fill:ue("fill"),material:Ma("material"),outline:ue("outline"),outlineColor:ue("outlineColor"),outlineWidth:ue("outlineWidth"),stackPartitions:ue("stackPartitions"),slicePartitions:ue("slicePartitions"),subdivisions:ue("subdivisions"),shadows:ue("shadows"),distanceDisplayCondition:ue("distanceDisplayCondition")});i0.prototype.clone=function(e){return c(e)?(e.show=this.show,e.radii=this.radii,e.innerRadii=this.innerRadii,e.minimumClock=this.minimumClock,e.maximumClock=this.maximumClock,e.minimumCone=this.minimumCone,e.maximumCone=this.maximumCone,e.heightReference=this.heightReference,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.stackPartitions=this.stackPartitions,e.slicePartitions=this.slicePartitions,e.subdivisions=this.subdivisions,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e):new i0(this)};i0.prototype.merge=function(e){if(!c(e))throw new E("source is required.");this.show=y(this.show,e.show),this.radii=y(this.radii,e.radii),this.innerRadii=y(this.innerRadii,e.innerRadii),this.minimumClock=y(this.minimumClock,e.minimumClock),this.maximumClock=y(this.maximumClock,e.maximumClock),this.minimumCone=y(this.minimumCone,e.minimumCone),this.maximumCone=y(this.maximumCone,e.maximumCone),this.heightReference=y(this.heightReference,e.heightReference),this.fill=y(this.fill,e.fill),this.material=y(this.material,e.material),this.outline=y(this.outline,e.outline),this.outlineColor=y(this.outlineColor,e.outlineColor),this.outlineWidth=y(this.outlineWidth,e.outlineWidth),this.stackPartitions=y(this.stackPartitions,e.stackPartitions),this.slicePartitions=y(this.slicePartitions,e.slicePartitions),this.subdivisions=y(this.subdivisions,e.subdivisions),this.shadows=y(this.shadows,e.shadows),this.distanceDisplayCondition=y(this.distanceDisplayCondition,e.distanceDisplayCondition)};function o0(e){this._definitionChanged=new Le,this._show=void 0,this._showSubscription=void 0,this._text=void 0,this._textSubscription=void 0,this._font=void 0,this._fontSubscription=void 0,this._style=void 0,this._styleSubscription=void 0,this._scale=void 0,this._scaleSubscription=void 0,this._showBackground=void 0,this._showBackgroundSubscription=void 0,this._backgroundColor=void 0,this._backgroundColorSubscription=void 0,this._backgroundPadding=void 0,this._backgroundPaddingSubscription=void 0,this._pixelOffset=void 0,this._pixelOffsetSubscription=void 0,this._eyeOffset=void 0,this._eyeOffsetSubscription=void 0,this._horizontalOrigin=void 0,this._horizontalOriginSubscription=void 0,this._verticalOrigin=void 0,this._verticalOriginSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._fillColor=void 0,this._fillColorSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._translucencyByDistance=void 0,this._translucencyByDistanceSubscription=void 0,this._pixelOffsetScaleByDistance=void 0,this._pixelOffsetScaleByDistanceSubscription=void 0,this._scaleByDistance=void 0,this._scaleByDistanceSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this._disableDepthTestDistance=void 0,this._disableDepthTestDistanceSubscription=void 0,this.merge(y(e,y.EMPTY_OBJECT))}Object.defineProperties(o0.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ue("show"),text:ue("text"),font:ue("font"),style:ue("style"),scale:ue("scale"),showBackground:ue("showBackground"),backgroundColor:ue("backgroundColor"),backgroundPadding:ue("backgroundPadding"),pixelOffset:ue("pixelOffset"),eyeOffset:ue("eyeOffset"),horizontalOrigin:ue("horizontalOrigin"),verticalOrigin:ue("verticalOrigin"),heightReference:ue("heightReference"),fillColor:ue("fillColor"),outlineColor:ue("outlineColor"),outlineWidth:ue("outlineWidth"),translucencyByDistance:ue("translucencyByDistance"),pixelOffsetScaleByDistance:ue("pixelOffsetScaleByDistance"),scaleByDistance:ue("scaleByDistance"),distanceDisplayCondition:ue("distanceDisplayCondition"),disableDepthTestDistance:ue("disableDepthTestDistance")});o0.prototype.clone=function(e){return c(e)?(e.show=this.show,e.text=this.text,e.font=this.font,e.style=this.style,e.scale=this.scale,e.showBackground=this.showBackground,e.backgroundColor=this.backgroundColor,e.backgroundPadding=this.backgroundPadding,e.pixelOffset=this.pixelOffset,e.eyeOffset=this.eyeOffset,e.horizontalOrigin=this.horizontalOrigin,e.verticalOrigin=this.verticalOrigin,e.heightReference=this.heightReference,e.fillColor=this.fillColor,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.translucencyByDistance=this.translucencyByDistance,e.pixelOffsetScaleByDistance=this.pixelOffsetScaleByDistance,e.scaleByDistance=this.scaleByDistance,e.distanceDisplayCondition=this.distanceDisplayCondition,e.disableDepthTestDistance=this.disableDepthTestDistance,e):new o0(this)};o0.prototype.merge=function(e){if(!c(e))throw new E("source is required.");this.show=y(this.show,e.show),this.text=y(this.text,e.text),this.font=y(this.font,e.font),this.style=y(this.style,e.style),this.scale=y(this.scale,e.scale),this.showBackground=y(this.showBackground,e.showBackground),this.backgroundColor=y(this.backgroundColor,e.backgroundColor),this.backgroundPadding=y(this.backgroundPadding,e.backgroundPadding),this.pixelOffset=y(this.pixelOffset,e.pixelOffset),this.eyeOffset=y(this.eyeOffset,e.eyeOffset),this.horizontalOrigin=y(this.horizontalOrigin,e.horizontalOrigin),this.verticalOrigin=y(this.verticalOrigin,e.verticalOrigin),this.heightReference=y(this.heightReference,e.heightReference),this.fillColor=y(this.fillColor,e.fillColor),this.outlineColor=y(this.outlineColor,e.outlineColor),this.outlineWidth=y(this.outlineWidth,e.outlineWidth),this.translucencyByDistance=y(this.translucencyByDistance,e.translucencyByDistance),this.pixelOffsetScaleByDistance=y(this.pixelOffsetScaleByDistance,e.pixelOffsetScaleByDistance),this.scaleByDistance=y(this.scaleByDistance,e.scaleByDistance),this.distanceDisplayCondition=y(this.distanceDisplayCondition,e.distanceDisplayCondition),this.disableDepthTestDistance=y(this.disableDepthTestDistance,e.disableDepthTestDistance)};const Lse=new d(1,1,1),Rse=d.ZERO,Nse=_e.IDENTITY;function TC(e,t,n){this.translation=d.clone(y(e,Rse)),this.rotation=_e.clone(y(t,Nse)),this.scale=d.clone(y(n,Lse))}TC.prototype.equals=function(e){return this===e||c(e)&&d.equals(this.translation,e.translation)&&_e.equals(this.rotation,e.rotation)&&d.equals(this.scale,e.scale)};const Lw=new TC;function r0(e){e=y(e,y.EMPTY_OBJECT),this._definitionChanged=new Le,this._translation=void 0,this._translationSubscription=void 0,this._rotation=void 0,this._rotationSubscription=void 0,this._scale=void 0,this._scaleSubscription=void 0,this.translation=e.translation,this.rotation=e.rotation,this.scale=e.scale}Object.defineProperties(r0.prototype,{isConstant:{get:function(){return K.isConstant(this._translation)&&K.isConstant(this._rotation)&&K.isConstant(this._scale)}},definitionChanged:{get:function(){return this._definitionChanged}},translation:ue("translation"),rotation:ue("rotation"),scale:ue("scale")});r0.prototype.getValue=function(e,t){return c(t)||(t=new TC),t.translation=K.getValueOrClonedDefault(this._translation,e,Lw.translation,t.translation),t.rotation=K.getValueOrClonedDefault(this._rotation,e,Lw.rotation,t.rotation),t.scale=K.getValueOrClonedDefault(this._scale,e,Lw.scale,t.scale),t};r0.prototype.equals=function(e){return this===e||e instanceof r0&&K.equals(this._translation,e._translation)&&K.equals(this._rotation,e._rotation)&&K.equals(this._scale,e._scale)};function Fa(e,t){this._propertyNames=[],this._definitionChanged=new Le,c(e)&&this.merge(e,t)}Object.defineProperties(Fa.prototype,{propertyNames:{get:function(){return this._propertyNames}},isConstant:{get:function(){const e=this._propertyNames;for(let t=0,n=e.length;t<n;t++)if(!K.isConstant(this[e[t]]))return!1;return!0}},definitionChanged:{get:function(){return this._definitionChanged}}});Fa.prototype.hasProperty=function(e){return this._propertyNames.indexOf(e)!==-1};function Mse(e){return new ao(e)}Fa.prototype.addProperty=function(e,t,n){const i=this._propertyNames;if(!c(e))throw new E("propertyName is required.");if(i.indexOf(e)!==-1)throw new E(`${e} is already a registered property.`);i.push(e),Object.defineProperty(this,e,ue(e,!0,y(n,Mse))),c(t)&&(this[e]=t),this._definitionChanged.raiseEvent(this)};Fa.prototype.removeProperty=function(e){const n=this._propertyNames.indexOf(e);if(!c(e))throw new E("propertyName is required.");if(n===-1)throw new E(`${e} is not a registered property.`);this._propertyNames.splice(n,1),delete this[e],this._definitionChanged.raiseEvent(this)};Fa.prototype.getValue=function(e,t){if(!c(e))throw new E("time is required.");c(t)||(t={});const n=this._propertyNames;for(let i=0,o=n.length;i<o;i++){const r=n[i];t[r]=K.getValueOrUndefined(this[r],e,t[r])}return t};Fa.prototype.merge=function(e,t){if(!c(e))throw new E("source is required.");const n=this._propertyNames,i=c(e._propertyNames)?e._propertyNames:Object.keys(e);for(let o=0,r=i.length;o<r;o++){const s=i[o],a=this[s],l=e[s];a===void 0&&n.indexOf(s)===-1&&this.addProperty(s,void 0,t),l!==void 0&&(a!==void 0?c(a)&&c(a.merge)&&a.merge(l):c(l)&&c(l.merge)&&c(l.clone)?this[s]=l.clone():this[s]=l)}};function Fse(e,t){const n=e._propertyNames,i=t._propertyNames,o=n.length;if(o!==i.length)return!1;for(let r=0;r<o;++r){const s=n[r];if(i.indexOf(s)===-1||!K.equals(e[s],t[s]))return!1}return!0}Fa.prototype.equals=function(e){return this===e||e instanceof Fa&&Fse(this,e)};function DV(e){return new r0(e)}function Bse(e){return new Fa(e,DV)}function zse(e){return new Fa(e)}function s0(e){this._definitionChanged=new Le,this._show=void 0,this._showSubscription=void 0,this._uri=void 0,this._uriSubscription=void 0,this._scale=void 0,this._scaleSubscription=void 0,this._minimumPixelSize=void 0,this._minimumPixelSizeSubscription=void 0,this._maximumScale=void 0,this._maximumScaleSubscription=void 0,this._incrementallyLoadTextures=void 0,this._incrementallyLoadTexturesSubscription=void 0,this._runAnimations=void 0,this._runAnimationsSubscription=void 0,this._clampAnimations=void 0,this._clampAnimationsSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._silhouetteColor=void 0,this._silhouetteColorSubscription=void 0,this._silhouetteSize=void 0,this._silhouetteSizeSubscription=void 0,this._color=void 0,this._colorSubscription=void 0,this._colorBlendMode=void 0,this._colorBlendModeSubscription=void 0,this._colorBlendAmount=void 0,this._colorBlendAmountSubscription=void 0,this._imageBasedLightingFactor=void 0,this._imageBasedLightingFactorSubscription=void 0,this._lightColor=void 0,this._lightColorSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this._nodeTransformations=void 0,this._nodeTransformationsSubscription=void 0,this._articulations=void 0,this._articulationsSubscription=void 0,this._clippingPlanes=void 0,this._clippingPlanesSubscription=void 0,this._customShader=void 0,this._customShaderSubscription=void 0,this.merge(y(e,y.EMPTY_OBJECT))}Object.defineProperties(s0.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ue("show"),uri:ue("uri"),scale:ue("scale"),minimumPixelSize:ue("minimumPixelSize"),maximumScale:ue("maximumScale"),incrementallyLoadTextures:ue("incrementallyLoadTextures"),runAnimations:ue("runAnimations"),clampAnimations:ue("clampAnimations"),shadows:ue("shadows"),heightReference:ue("heightReference"),silhouetteColor:ue("silhouetteColor"),silhouetteSize:ue("silhouetteSize"),color:ue("color"),colorBlendMode:ue("colorBlendMode"),colorBlendAmount:ue("colorBlendAmount"),imageBasedLightingFactor:ue("imageBasedLightingFactor"),lightColor:ue("lightColor"),distanceDisplayCondition:ue("distanceDisplayCondition"),nodeTransformations:ue("nodeTransformations",void 0,Bse),articulations:ue("articulations",void 0,zse),clippingPlanes:ue("clippingPlanes"),customShader:ue("customShader")});s0.prototype.clone=function(e){return c(e)?(e.show=this.show,e.uri=this.uri,e.scale=this.scale,e.minimumPixelSize=this.minimumPixelSize,e.maximumScale=this.maximumScale,e.incrementallyLoadTextures=this.incrementallyLoadTextures,e.runAnimations=this.runAnimations,e.clampAnimations=this.clampAnimations,e.heightReference=this._heightReference,e.silhouetteColor=this.silhouetteColor,e.silhouetteSize=this.silhouetteSize,e.color=this.color,e.colorBlendMode=this.colorBlendMode,e.colorBlendAmount=this.colorBlendAmount,e.imageBasedLightingFactor=this.imageBasedLightingFactor,e.lightColor=this.lightColor,e.distanceDisplayCondition=this.distanceDisplayCondition,e.nodeTransformations=this.nodeTransformations,e.articulations=this.articulations,e.clippingPlanes=this.clippingPlanes,e.customShader=this.customShader,e):new s0(this)};s0.prototype.merge=function(e){if(!c(e))throw new E("source is required.");this.show=y(this.show,e.show),this.uri=y(this.uri,e.uri),this.scale=y(this.scale,e.scale),this.minimumPixelSize=y(this.minimumPixelSize,e.minimumPixelSize),this.maximumScale=y(this.maximumScale,e.maximumScale),this.incrementallyLoadTextures=y(this.incrementallyLoadTextures,e.incrementallyLoadTextures),this.runAnimations=y(this.runAnimations,e.runAnimations),this.clampAnimations=y(this.clampAnimations,e.clampAnimations),this.shadows=y(this.shadows,e.shadows),this.heightReference=y(this.heightReference,e.heightReference),this.silhouetteColor=y(this.silhouetteColor,e.silhouetteColor),this.silhouetteSize=y(this.silhouetteSize,e.silhouetteSize),this.color=y(this.color,e.color),this.colorBlendMode=y(this.colorBlendMode,e.colorBlendMode),this.colorBlendAmount=y(this.colorBlendAmount,e.colorBlendAmount),this.imageBasedLightingFactor=y(this.imageBasedLightingFactor,e.imageBasedLightingFactor),this.lightColor=y(this.lightColor,e.lightColor),this.distanceDisplayCondition=y(this.distanceDisplayCondition,e.distanceDisplayCondition),this.clippingPlanes=y(this.clippingPlanes,e.clippingPlanes),this.customShader=y(this.customShader,e.customShader);const t=e.nodeTransformations;if(c(t)){const i=this.nodeTransformations;c(i)?i.merge(t):this.nodeTransformations=new Fa(t,DV)}const n=e.articulations;if(c(n)){const i=this.articulations;c(i)?i.merge(n):this.articulations=new Fa(n)}};function a0(e){this._definitionChanged=new Le,this._show=void 0,this._showSubscription=void 0,this._uri=void 0,this._uriSubscription=void 0,this._maximumScreenSpaceError=void 0,this._maximumScreenSpaceErrorSubscription=void 0,this.merge(y(e,y.EMPTY_OBJECT))}Object.defineProperties(a0.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ue("show"),uri:ue("uri"),maximumScreenSpaceError:ue("maximumScreenSpaceError")});a0.prototype.clone=function(e){return c(e)?(e.show=this.show,e.uri=this.uri,e.maximumScreenSpaceError=this.maximumScreenSpaceError,e):new a0(this)};a0.prototype.merge=function(e){if(!c(e))throw new E("source is required.");this.show=y(this.show,e.show),this.uri=y(this.uri,e.uri),this.maximumScreenSpaceError=y(this.maximumScreenSpaceError,e.maximumScreenSpaceError)};function c0(e){this._definitionChanged=new Le,this._show=void 0,this._showSubscription=void 0,this._leadTime=void 0,this._leadTimeSubscription=void 0,this._trailTime=void 0,this._trailTimeSubscription=void 0,this._width=void 0,this._widthSubscription=void 0,this._resolution=void 0,this._resolutionSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this.merge(y(e,y.EMPTY_OBJECT))}Object.defineProperties(c0.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ue("show"),leadTime:ue("leadTime"),trailTime:ue("trailTime"),width:ue("width"),resolution:ue("resolution"),material:Ma("material"),distanceDisplayCondition:ue("distanceDisplayCondition")});c0.prototype.clone=function(e){return c(e)?(e.show=this.show,e.leadTime=this.leadTime,e.trailTime=this.trailTime,e.width=this.width,e.resolution=this.resolution,e.material=this.material,e.distanceDisplayCondition=this.distanceDisplayCondition,e):new c0(this)};c0.prototype.merge=function(e){if(!c(e))throw new E("source is required.");this.show=y(this.show,e.show),this.leadTime=y(this.leadTime,e.leadTime),this.trailTime=y(this.trailTime,e.trailTime),this.width=y(this.width,e.width),this.resolution=y(this.resolution,e.resolution),this.material=y(this.material,e.material),this.distanceDisplayCondition=y(this.distanceDisplayCondition,e.distanceDisplayCondition)};function l0(e){this._definitionChanged=new Le,this._show=void 0,this._showSubscription=void 0,this._plane=void 0,this._planeSubscription=void 0,this._dimensions=void 0,this._dimensionsSubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this.merge(y(e,y.EMPTY_OBJECT))}Object.defineProperties(l0.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ue("show"),plane:ue("plane"),dimensions:ue("dimensions"),fill:ue("fill"),material:Ma("material"),outline:ue("outline"),outlineColor:ue("outlineColor"),outlineWidth:ue("outlineWidth"),shadows:ue("shadows"),distanceDisplayCondition:ue("distanceDisplayCondition")});l0.prototype.clone=function(e){return c(e)?(e.show=this.show,e.plane=this.plane,e.dimensions=this.dimensions,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e):new l0(this)};l0.prototype.merge=function(e){if(!c(e))throw new E("source is required.");this.show=y(this.show,e.show),this.plane=y(this.plane,e.plane),this.dimensions=y(this.dimensions,e.dimensions),this.fill=y(this.fill,e.fill),this.material=y(this.material,e.material),this.outline=y(this.outline,e.outline),this.outlineColor=y(this.outlineColor,e.outlineColor),this.outlineWidth=y(this.outlineWidth,e.outlineWidth),this.shadows=y(this.shadows,e.shadows),this.distanceDisplayCondition=y(this.distanceDisplayCondition,e.distanceDisplayCondition)};function u0(e){this._definitionChanged=new Le,this._show=void 0,this._showSubscription=void 0,this._pixelSize=void 0,this._pixelSizeSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._color=void 0,this._colorSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._scaleByDistance=void 0,this._scaleByDistanceSubscription=void 0,this._translucencyByDistance=void 0,this._translucencyByDistanceSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this._disableDepthTestDistance=void 0,this._disableDepthTestDistanceSubscription=void 0,this.merge(y(e,y.EMPTY_OBJECT))}Object.defineProperties(u0.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ue("show"),pixelSize:ue("pixelSize"),heightReference:ue("heightReference"),color:ue("color"),outlineColor:ue("outlineColor"),outlineWidth:ue("outlineWidth"),scaleByDistance:ue("scaleByDistance"),translucencyByDistance:ue("translucencyByDistance"),distanceDisplayCondition:ue("distanceDisplayCondition"),disableDepthTestDistance:ue("disableDepthTestDistance")});u0.prototype.clone=function(e){return c(e)?(e.show=this.show,e.pixelSize=this.pixelSize,e.heightReference=this.heightReference,e.color=this.color,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.scaleByDistance=this.scaleByDistance,e.translucencyByDistance=this._translucencyByDistance,e.distanceDisplayCondition=this.distanceDisplayCondition,e.disableDepthTestDistance=this.disableDepthTestDistance,e):new u0(this)};u0.prototype.merge=function(e){if(!c(e))throw new E("source is required.");this.show=y(this.show,e.show),this.pixelSize=y(this.pixelSize,e.pixelSize),this.heightReference=y(this.heightReference,e.heightReference),this.color=y(this.color,e.color),this.outlineColor=y(this.outlineColor,e.outlineColor),this.outlineWidth=y(this.outlineWidth,e.outlineWidth),this.scaleByDistance=y(this.scaleByDistance,e.scaleByDistance),this.translucencyByDistance=y(this._translucencyByDistance,e.translucencyByDistance),this.distanceDisplayCondition=y(this.distanceDisplayCondition,e.distanceDisplayCondition),this.disableDepthTestDistance=y(this.disableDepthTestDistance,e.disableDepthTestDistance)};function PV(e,t){this.positions=c(e)?e:[],this.holes=c(t)?t:[]}function Use(e){return Array.isArray(e)&&(e=new PV(e)),new ao(e)}function d0(e){this._definitionChanged=new Le,this._show=void 0,this._showSubscription=void 0,this._hierarchy=void 0,this._hierarchySubscription=void 0,this._height=void 0,this._heightSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._extrudedHeight=void 0,this._extrudedHeightSubscription=void 0,this._extrudedHeightReference=void 0,this._extrudedHeightReferenceSubscription=void 0,this._stRotation=void 0,this._stRotationSubscription=void 0,this._granularity=void 0,this._granularitySubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._perPositionHeight=void 0,this._perPositionHeightSubscription=void 0,this._closeTop=void 0,this._closeTopSubscription=void 0,this._closeBottom=void 0,this._closeBottomSubscription=void 0,this._arcType=void 0,this._arcTypeSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this._classificationType=void 0,this._classificationTypeSubscription=void 0,this._zIndex=void 0,this._zIndexSubscription=void 0,this._textureCoordinates=void 0,this._textureCoordinatesSubscription=void 0,this.merge(y(e,y.EMPTY_OBJECT))}Object.defineProperties(d0.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ue("show"),hierarchy:ue("hierarchy",void 0,Use),height:ue("height"),heightReference:ue("heightReference"),extrudedHeight:ue("extrudedHeight"),extrudedHeightReference:ue("extrudedHeightReference"),stRotation:ue("stRotation"),granularity:ue("granularity"),fill:ue("fill"),material:Ma("material"),outline:ue("outline"),outlineColor:ue("outlineColor"),outlineWidth:ue("outlineWidth"),perPositionHeight:ue("perPositionHeight"),closeTop:ue("closeTop"),closeBottom:ue("closeBottom"),arcType:ue("arcType"),shadows:ue("shadows"),distanceDisplayCondition:ue("distanceDisplayCondition"),classificationType:ue("classificationType"),zIndex:ue("zIndex"),textureCoordinates:ue("textureCoordinates")});d0.prototype.clone=function(e){return c(e)?(e.show=this.show,e.hierarchy=this.hierarchy,e.height=this.height,e.heightReference=this.heightReference,e.extrudedHeight=this.extrudedHeight,e.extrudedHeightReference=this.extrudedHeightReference,e.stRotation=this.stRotation,e.granularity=this.granularity,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.perPositionHeight=this.perPositionHeight,e.closeTop=this.closeTop,e.closeBottom=this.closeBottom,e.arcType=this.arcType,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e.classificationType=this.classificationType,e.zIndex=this.zIndex,e.textureCoordinates=this.textureCoordinates,e):new d0(this)};d0.prototype.merge=function(e){if(!c(e))throw new E("source is required.");this.show=y(this.show,e.show),this.hierarchy=y(this.hierarchy,e.hierarchy),this.height=y(this.height,e.height),this.heightReference=y(this.heightReference,e.heightReference),this.extrudedHeight=y(this.extrudedHeight,e.extrudedHeight),this.extrudedHeightReference=y(this.extrudedHeightReference,e.extrudedHeightReference),this.stRotation=y(this.stRotation,e.stRotation),this.granularity=y(this.granularity,e.granularity),this.fill=y(this.fill,e.fill),this.material=y(this.material,e.material),this.outline=y(this.outline,e.outline),this.outlineColor=y(this.outlineColor,e.outlineColor),this.outlineWidth=y(this.outlineWidth,e.outlineWidth),this.perPositionHeight=y(this.perPositionHeight,e.perPositionHeight),this.closeTop=y(this.closeTop,e.closeTop),this.closeBottom=y(this.closeBottom,e.closeBottom),this.arcType=y(this.arcType,e.arcType),this.shadows=y(this.shadows,e.shadows),this.distanceDisplayCondition=y(this.distanceDisplayCondition,e.distanceDisplayCondition),this.classificationType=y(this.classificationType,e.classificationType),this.zIndex=y(this.zIndex,e.zIndex),this.textureCoordinates=y(this.textureCoordinates,e.textureCoordinates)};function h0(e){this._definitionChanged=new Le,this._show=void 0,this._showSubscription=void 0,this._positions=void 0,this._positionsSubscription=void 0,this._width=void 0,this._widthSubscription=void 0,this._granularity=void 0,this._granularitySubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._depthFailMaterial=void 0,this._depthFailMaterialSubscription=void 0,this._arcType=void 0,this._arcTypeSubscription=void 0,this._clampToGround=void 0,this._clampToGroundSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this._classificationType=void 0,this._classificationTypeSubscription=void 0,this._zIndex=void 0,this._zIndexSubscription=void 0,this.merge(y(e,y.EMPTY_OBJECT))}Object.defineProperties(h0.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ue("show"),positions:ue("positions"),width:ue("width"),granularity:ue("granularity"),material:Ma("material"),depthFailMaterial:Ma("depthFailMaterial"),arcType:ue("arcType"),clampToGround:ue("clampToGround"),shadows:ue("shadows"),distanceDisplayCondition:ue("distanceDisplayCondition"),classificationType:ue("classificationType"),zIndex:ue("zIndex")});h0.prototype.clone=function(e){return c(e)?(e.show=this.show,e.positions=this.positions,e.width=this.width,e.granularity=this.granularity,e.material=this.material,e.depthFailMaterial=this.depthFailMaterial,e.arcType=this.arcType,e.clampToGround=this.clampToGround,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e.classificationType=this.classificationType,e.zIndex=this.zIndex,e):new h0(this)};h0.prototype.merge=function(e){if(!c(e))throw new E("source is required.");this.show=y(this.show,e.show),this.positions=y(this.positions,e.positions),this.width=y(this.width,e.width),this.granularity=y(this.granularity,e.granularity),this.material=y(this.material,e.material),this.depthFailMaterial=y(this.depthFailMaterial,e.depthFailMaterial),this.arcType=y(this.arcType,e.arcType),this.clampToGround=y(this.clampToGround,e.clampToGround),this.shadows=y(this.shadows,e.shadows),this.distanceDisplayCondition=y(this.distanceDisplayCondition,e.distanceDisplayCondition),this.classificationType=y(this.classificationType,e.classificationType),this.zIndex=y(this.zIndex,e.zIndex)};function f0(e){this._definitionChanged=new Le,this._show=void 0,this._showSubscription=void 0,this._positions=void 0,this._positionsSubscription=void 0,this._shape=void 0,this._shapeSubscription=void 0,this._cornerType=void 0,this._cornerTypeSubscription=void 0,this._granularity=void 0,this._granularitySubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubsription=void 0,this.merge(y(e,y.EMPTY_OBJECT))}Object.defineProperties(f0.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ue("show"),positions:ue("positions"),shape:ue("shape"),cornerType:ue("cornerType"),granularity:ue("granularity"),fill:ue("fill"),material:Ma("material"),outline:ue("outline"),outlineColor:ue("outlineColor"),outlineWidth:ue("outlineWidth"),shadows:ue("shadows"),distanceDisplayCondition:ue("distanceDisplayCondition")});f0.prototype.clone=function(e){return c(e)?(e.show=this.show,e.positions=this.positions,e.shape=this.shape,e.cornerType=this.cornerType,e.granularity=this.granularity,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e):new f0(this)};f0.prototype.merge=function(e){if(!c(e))throw new E("source is required.");this.show=y(this.show,e.show),this.positions=y(this.positions,e.positions),this.shape=y(this.shape,e.shape),this.cornerType=y(this.cornerType,e.cornerType),this.granularity=y(this.granularity,e.granularity),this.fill=y(this.fill,e.fill),this.material=y(this.material,e.material),this.outline=y(this.outline,e.outline),this.outlineColor=y(this.outlineColor,e.outlineColor),this.outlineWidth=y(this.outlineWidth,e.outlineWidth),this.shadows=y(this.shadows,e.shadows),this.distanceDisplayCondition=y(this.distanceDisplayCondition,e.distanceDisplayCondition)};function p0(e){this._definitionChanged=new Le,this._show=void 0,this._showSubscription=void 0,this._coordinates=void 0,this._coordinatesSubscription=void 0,this._height=void 0,this._heightSubscription=void 0,this._heightReference=void 0,this._heightReferenceSubscription=void 0,this._extrudedHeight=void 0,this._extrudedHeightSubscription=void 0,this._extrudedHeightReference=void 0,this._extrudedHeightReferenceSubscription=void 0,this._rotation=void 0,this._rotationSubscription=void 0,this._stRotation=void 0,this._stRotationSubscription=void 0,this._granularity=void 0,this._granularitySubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distancedisplayConditionSubscription=void 0,this._classificationType=void 0,this._classificationTypeSubscription=void 0,this._zIndex=void 0,this._zIndexSubscription=void 0,this.merge(y(e,y.EMPTY_OBJECT))}Object.defineProperties(p0.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ue("show"),coordinates:ue("coordinates"),height:ue("height"),heightReference:ue("heightReference"),extrudedHeight:ue("extrudedHeight"),extrudedHeightReference:ue("extrudedHeightReference"),rotation:ue("rotation"),stRotation:ue("stRotation"),granularity:ue("granularity"),fill:ue("fill"),material:Ma("material"),outline:ue("outline"),outlineColor:ue("outlineColor"),outlineWidth:ue("outlineWidth"),shadows:ue("shadows"),distanceDisplayCondition:ue("distanceDisplayCondition"),classificationType:ue("classificationType"),zIndex:ue("zIndex")});p0.prototype.clone=function(e){return c(e)?(e.show=this.show,e.coordinates=this.coordinates,e.height=this.height,e.heightReference=this.heightReference,e.extrudedHeight=this.extrudedHeight,e.extrudedHeightReference=this.extrudedHeightReference,e.rotation=this.rotation,e.stRotation=this.stRotation,e.granularity=this.granularity,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e.classificationType=this.classificationType,e.zIndex=this.zIndex,e):new p0(this)};p0.prototype.merge=function(e){if(!c(e))throw new E("source is required.");this.show=y(this.show,e.show),this.coordinates=y(this.coordinates,e.coordinates),this.height=y(this.height,e.height),this.heightReference=y(this.heightReference,e.heightReference),this.extrudedHeight=y(this.extrudedHeight,e.extrudedHeight),this.extrudedHeightReference=y(this.extrudedHeightReference,e.extrudedHeightReference),this.rotation=y(this.rotation,e.rotation),this.stRotation=y(this.stRotation,e.stRotation),this.granularity=y(this.granularity,e.granularity),this.fill=y(this.fill,e.fill),this.material=y(this.material,e.material),this.outline=y(this.outline,e.outline),this.outlineColor=y(this.outlineColor,e.outlineColor),this.outlineWidth=y(this.outlineWidth,e.outlineWidth),this.shadows=y(this.shadows,e.shadows),this.distanceDisplayCondition=y(this.distanceDisplayCondition,e.distanceDisplayCondition),this.classificationType=y(this.classificationType,e.classificationType),this.zIndex=y(this.zIndex,e.zIndex)};function m0(e){this._definitionChanged=new Le,this._show=void 0,this._showSubscription=void 0,this._positions=void 0,this._positionsSubscription=void 0,this._minimumHeights=void 0,this._minimumHeightsSubscription=void 0,this._maximumHeights=void 0,this._maximumHeightsSubscription=void 0,this._granularity=void 0,this._granularitySubscription=void 0,this._fill=void 0,this._fillSubscription=void 0,this._material=void 0,this._materialSubscription=void 0,this._outline=void 0,this._outlineSubscription=void 0,this._outlineColor=void 0,this._outlineColorSubscription=void 0,this._outlineWidth=void 0,this._outlineWidthSubscription=void 0,this._shadows=void 0,this._shadowsSubscription=void 0,this._distanceDisplayCondition=void 0,this._distanceDisplayConditionSubscription=void 0,this.merge(y(e,y.EMPTY_OBJECT))}Object.defineProperties(m0.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ue("show"),positions:ue("positions"),minimumHeights:ue("minimumHeights"),maximumHeights:ue("maximumHeights"),granularity:ue("granularity"),fill:ue("fill"),material:Ma("material"),outline:ue("outline"),outlineColor:ue("outlineColor"),outlineWidth:ue("outlineWidth"),shadows:ue("shadows"),distanceDisplayCondition:ue("distanceDisplayCondition")});m0.prototype.clone=function(e){return c(e)?(e.show=this.show,e.positions=this.positions,e.minimumHeights=this.minimumHeights,e.maximumHeights=this.maximumHeights,e.granularity=this.granularity,e.fill=this.fill,e.material=this.material,e.outline=this.outline,e.outlineColor=this.outlineColor,e.outlineWidth=this.outlineWidth,e.shadows=this.shadows,e.distanceDisplayCondition=this.distanceDisplayCondition,e):new m0(this)};m0.prototype.merge=function(e){if(!c(e))throw new E("source is required.");this.show=y(this.show,e.show),this.positions=y(this.positions,e.positions),this.minimumHeights=y(this.minimumHeights,e.minimumHeights),this.maximumHeights=y(this.maximumHeights,e.maximumHeights),this.granularity=y(this.granularity,e.granularity),this.fill=y(this.fill,e.fill),this.material=y(this.material,e.material),this.outline=y(this.outline,e.outline),this.outlineColor=y(this.outlineColor,e.outlineColor),this.outlineWidth=y(this.outlineWidth,e.outlineWidth),this.shadows=y(this.shadows,e.shadows),this.distanceDisplayCondition=y(this.distanceDisplayCondition,e.distanceDisplayCondition)};const kse=new he,zI=[];function Vse(e){return new hd(e)}function Hse(e){return ue(e,void 0,Vse)}function er(e,t){return ue(e,void 0,function(n){return n instanceof t?n:new t(n)})}function Eo(e){e=y(e,y.EMPTY_OBJECT);let t=e.id;c(t)||(t=Wr()),this._availability=void 0,this._id=t,this._definitionChanged=new Le,this._name=e.name,this._show=y(e.show,!0),this._parent=void 0,this._propertyNames=["billboard","box","corridor","cylinder","description","ellipse","ellipsoid","label","model","tileset","orientation","path","plane","point","polygon","polyline","polylineVolume","position","properties","rectangle","viewFrom","wall",...zI],this._billboard=void 0,this._billboardSubscription=void 0,this._box=void 0,this._boxSubscription=void 0,this._corridor=void 0,this._corridorSubscription=void 0,this._cylinder=void 0,this._cylinderSubscription=void 0,this._description=void 0,this._descriptionSubscription=void 0,this._ellipse=void 0,this._ellipseSubscription=void 0,this._ellipsoid=void 0,this._ellipsoidSubscription=void 0,this._label=void 0,this._labelSubscription=void 0,this._model=void 0,this._modelSubscription=void 0,this._tileset=void 0,this._tilesetSubscription=void 0,this._orientation=void 0,this._orientationSubscription=void 0,this._path=void 0,this._pathSubscription=void 0,this._plane=void 0,this._planeSubscription=void 0,this._point=void 0,this._pointSubscription=void 0,this._polygon=void 0,this._polygonSubscription=void 0,this._polyline=void 0,this._polylineSubscription=void 0,this._polylineVolume=void 0,this._polylineVolumeSubscription=void 0,this._position=void 0,this._positionSubscription=void 0,this._properties=void 0,this._propertiesSubscription=void 0,this._rectangle=void 0,this._rectangleSubscription=void 0,this._viewFrom=void 0,this._viewFromSubscription=void 0,this._wall=void 0,this._wallSubscription=void 0,this._children=[],this.entityCollection=void 0,this.parent=e.parent,this.merge(e)}function UI(e,t,n){const i=t.length;for(let o=0;o<i;o++){const r=t[o],s=r._show;(!n&&s)!==(n&&s)&&UI(r,r._children,n)}e._definitionChanged.raiseEvent(e,"isShowing",n,!n)}Object.defineProperties(Eo.prototype,{availability:BI("availability"),id:{get:function(){return this._id}},definitionChanged:{get:function(){return this._definitionChanged}},name:BI("name"),show:{get:function(){return this._show},set:function(e){if(!c(e))throw new E("value is required.");if(e===this._show)return;const t=this.isShowing;this._show=e;const n=this.isShowing;t!==n&&UI(this,this._children,n),this._definitionChanged.raiseEvent(this,"show",e,!e)}},isShowing:{get:function(){return this._show&&(!c(this.entityCollection)||this.entityCollection.show)&&(!c(this._parent)||this._parent.isShowing)}},parent:{get:function(){return this._parent},set:function(e){const t=this._parent;if(t===e)return;const n=this.isShowing;if(c(t)){const o=t._children.indexOf(this);t._children.splice(o,1)}this._parent=e,c(e)&&e._children.push(this);const i=this.isShowing;n!==i&&UI(this,this._children,i),this._definitionChanged.raiseEvent(this,"parent",e,t)}},propertyNames:{get:function(){return this._propertyNames}},billboard:er("billboard",Ky),box:er("box",Jy),corridor:er("corridor",e0),cylinder:er("cylinder",t0),description:ue("description"),ellipse:er("ellipse",n0),ellipsoid:er("ellipsoid",i0),label:er("label",o0),model:er("model",s0),tileset:er("tileset",a0),orientation:ue("orientation"),path:er("path",c0),plane:er("plane",l0),point:er("point",u0),polygon:er("polygon",d0),polyline:er("polyline",h0),polylineVolume:er("polylineVolume",f0),properties:er("properties",Fa),position:Hse("position"),rectangle:er("rectangle",p0),viewFrom:ue("viewFrom"),wall:er("wall",m0)});Eo.registerEntityType=function(e,t){Object.defineProperties(Eo.prototype,{[e]:er(e,t)}),zI.includes(e)||zI.push(e)};Eo.prototype.isAvailable=function(e){if(!c(e))throw new E("time is required.");const t=this._availability;return!c(t)||t.contains(e)};Eo.prototype.addProperty=function(e){const t=this._propertyNames;if(!c(e))throw new E("propertyName is required.");if(t.indexOf(e)!==-1)throw new E(`${e} is already a registered property.`);if(e in this)throw new E(`${e} is a reserved property name.`);t.push(e),Object.defineProperty(this,e,BI(e,!0))};Eo.prototype.removeProperty=function(e){const n=this._propertyNames.indexOf(e);if(!c(e))throw new E("propertyName is required.");if(n===-1)throw new E(`${e} is not a registered property.`);this._propertyNames.splice(n,1),delete this[e]};Eo.prototype.merge=function(e){if(!c(e))throw new E("source is required.");this.name=y(this.name,e.name),this.availability=y(this.availability,e.availability);const t=this._propertyNames,n=c(e._propertyNames)?e._propertyNames:Object.keys(e),i=n.length;for(let o=0;o<i;o++){const r=n[o];if(r==="parent"||r==="name"||r==="availability"||r==="children")continue;const s=this[r],a=e[r];!c(s)&&t.indexOf(r)===-1&&this.addProperty(r),c(a)&&(c(s)?c(s.merge)&&s.merge(a):c(a.merge)&&c(a.clone)?this[r]=a.clone():this[r]=a)}};const OV=new $,LV=new d,RV=new _e;Eo.prototype.computeModelMatrix=function(e,t){A.typeOf.object("time",e);const n=K.getValueOrUndefined(this._position,e,LV);if(!c(n))return;const i=K.getValueOrUndefined(this._orientation,e,RV);return c(i)?t=L.fromRotationTranslation($.fromQuaternion(i,OV),n,t):t=zt.eastNorthUpToFixedFrame(n,void 0,t),t};Eo.prototype.computeModelMatrixForHeightReference=function(e,t,n,i,o){A.typeOf.object("time",e);const r=K.getValueOrDefault(t,e,gt.NONE);let s=K.getValueOrUndefined(this._position,e,LV);if(r===gt.NONE||!c(s)||d.equalsEpsilon(s,d.ZERO,R.EPSILON8))return this.computeModelMatrix(e,o);const a=i.cartesianToCartographic(s,kse);Np(r)?a.height=n:a.height+=n,s=i.cartographicToCartesian(a,s);const l=K.getValueOrUndefined(this._orientation,e,RV);return c(l)?o=L.fromRotationTranslation($.fromQuaternion(l,OV),s,o):o=zt.eastNorthUpToFixedFrame(s,void 0,o),o};Eo.supportsMaterialsforEntitiesOnTerrain=function(e){return sr.supportsMaterials(e)};Eo.supportsPolylinesOnTerrain=function(e){return Sc.isSupported(e)};const Gse=new kt(z.WHITE),jse=new ao(!0),Wse=new ao(!0),qse=new ao(!1),Yse=new ao(z.BLACK),$se=new ao(Vi.DISABLED),Xse=new ao(new Pt),Qse=new ao(Ui.BOTH);function dn(e){A.defined("options.entity",e.entity),A.defined("options.scene",e.scene),A.defined("options.geometryOptions",e.geometryOptions),A.defined("options.geometryPropertyName",e.geometryPropertyName),A.defined("options.observedPropertyNames",e.observedPropertyNames);const t=e.entity,n=e.geometryPropertyName;this._entity=t,this._scene=e.scene,this._fillEnabled=!1,this._isClosed=!1,this._onTerrain=!1,this._dynamic=!1,this._outlineEnabled=!1,this._geometryChanged=new Le,this._showProperty=void 0,this._materialProperty=void 0,this._showOutlineProperty=void 0,this._outlineColorProperty=void 0,this._outlineWidth=1,this._shadowsProperty=void 0,this._distanceDisplayConditionProperty=void 0,this._classificationTypeProperty=void 0,this._options=e.geometryOptions,this._geometryPropertyName=n,this._id=`${n}-${t.id}`,this._observedPropertyNames=e.observedPropertyNames,this._supportsMaterialsforEntitiesOnTerrain=Eo.supportsMaterialsforEntitiesOnTerrain(e.scene)}Object.defineProperties(dn.prototype,{id:{get:function(){return this._id}},entity:{get:function(){return this._entity}},fillEnabled:{get:function(){return this._fillEnabled}},hasConstantFill:{get:function(){return!this._fillEnabled||!c(this._entity.availability)&&K.isConstant(this._showProperty)&&K.isConstant(this._fillProperty)}},fillMaterialProperty:{get:function(){return this._materialProperty}},outlineEnabled:{get:function(){return this._outlineEnabled}},hasConstantOutline:{get:function(){return!this._outlineEnabled||!c(this._entity.availability)&&K.isConstant(this._showProperty)&&K.isConstant(this._showOutlineProperty)}},outlineColorProperty:{get:function(){return this._outlineColorProperty}},outlineWidth:{get:function(){return this._outlineWidth}},shadowsProperty:{get:function(){return this._shadowsProperty}},distanceDisplayConditionProperty:{get:function(){return this._distanceDisplayConditionProperty}},classificationTypeProperty:{get:function(){return this._classificationTypeProperty}},isDynamic:{get:function(){return this._dynamic}},isClosed:{get:function(){return this._isClosed}},onTerrain:{get:function(){return this._onTerrain}},geometryChanged:{get:function(){return this._geometryChanged}}});dn.prototype.isOutlineVisible=function(e){const t=this._entity,n=this._outlineEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e);return y(n,!1)};dn.prototype.isFilled=function(e){const t=this._entity,n=this._fillEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e);return y(n,!1)};dn.prototype.createFillGeometryInstance=E.throwInstantiationError;dn.prototype.createOutlineGeometryInstance=E.throwInstantiationError;dn.prototype.isDestroyed=function(){return!1};dn.prototype.destroy=function(){ve(this)};dn.prototype._isHidden=function(e,t){const n=t.show;return c(n)&&n.isConstant&&!n.getValue(Ke.MINIMUM_VALUE)};dn.prototype._isOnTerrain=function(e,t){return!1};dn.prototype._getIsClosed=function(e){return!0};dn.prototype._isDynamic=E.throwInstantiationError;dn.prototype._setStaticOptions=E.throwInstantiationError;dn.prototype._onEntityPropertyChanged=function(e,t,n,i){if(this._observedPropertyNames.indexOf(t)===-1)return;const o=this._entity[this._geometryPropertyName];if(!c(o)){(this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this));return}const r=o.fill,s=c(r)&&r.isConstant?r.getValue(Ke.MINIMUM_VALUE):!0,a=o.outline;let l=c(a);if(l&&a.isConstant&&(l=a.getValue(Ke.MINIMUM_VALUE)),!s&&!l){(this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this));return}const u=o.show;if(this._isHidden(e,o)){(this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this));return}this._materialProperty=y(o.material,Gse),this._fillProperty=y(r,Wse),this._showProperty=y(u,jse),this._showOutlineProperty=y(o.outline,qse),this._outlineColorProperty=l?y(o.outlineColor,Yse):void 0,this._shadowsProperty=y(o.shadows,$se),this._distanceDisplayConditionProperty=y(o.distanceDisplayCondition,Xse),this._classificationTypeProperty=y(o.classificationType,Qse),this._fillEnabled=s;const h=this._isOnTerrain(e,o)&&(this._supportsMaterialsforEntitiesOnTerrain||this._materialProperty instanceof kt);if(l&&h&&($n($n.geometryOutlines),l=!1),this._onTerrain=h,this._outlineEnabled=l,this._isDynamic(e,o))this._dynamic||(this._dynamic=!0,this._geometryChanged.raiseEvent(this));else{this._setStaticOptions(e,o),this._isClosed=this._getIsClosed(this._options);const f=o.outlineWidth;this._outlineWidth=c(f)?f.getValue(Ke.MINIMUM_VALUE):1,this._dynamic=!1,this._geometryChanged.raiseEvent(this)}};dn.prototype.createDynamicUpdater=function(e,t){if(A.defined("primitives",e),A.defined("groundPrimitives",t),!this._dynamic)throw new E("This instance does not represent dynamic geometry.");return new this.constructor.DynamicGeometryUpdater(this,e,t)};function up(e,t){this._callback=void 0,this._isConstant=void 0,this._definitionChanged=new Le,this.setCallback(e,t)}Object.defineProperties(up.prototype,{isConstant:{get:function(){return this._isConstant}},definitionChanged:{get:function(){return this._definitionChanged}}});up.prototype.getValue=function(e,t){return this._callback(e,t)};up.prototype.setCallback=function(e,t){if(!c(e))throw new E("callback is required.");if(!c(t))throw new E("isConstant is required.");const n=this._callback!==e||this._isConstant!==t;this._callback=e,this._isConstant=t,n&&this._definitionChanged.raiseEvent(this)};up.prototype.equals=function(e){return this===e||e instanceof up&&this._callback===e._callback&&this._isConstant===e._isConstant};const NV=new d;function Fp(e,t,n,i){A.defined("scene",e),A.defined("positionProperty",t),this._scene=e,this._heightReference=n,this._extrudedHeightReference=i,this._positionProperty=t,this._position=new d,this._cartographicPosition=new he,this._normal=new d,this._definitionChanged=new Le,this._terrainHeight=0,this._removeCallbackFunc=void 0,this._removeEventListener=void 0,this._removeModeListener=void 0;const o=this;if(c(e.globe)&&(this._removeEventListener=e.terrainProviderChanged.addEventListener(function(){o._updateClamping()}),this._removeModeListener=e.morphComplete.addEventListener(function(){o._updateClamping()})),t.isConstant){const r=t.getValue(Ke.MINIMUM_VALUE,NV);if(!c(r)||d.equals(r,d.ZERO)||!c(e.globe))return;this._position=d.clone(r,this._position),this._updateClamping(),this._normal=e.globe.ellipsoid.geodeticSurfaceNormal(r,this._normal)}}Object.defineProperties(Fp.prototype,{isConstant:{get:function(){return!1}},definitionChanged:{get:function(){return this._definitionChanged}}});Fp.prototype._updateClamping=function(){c(this._removeCallbackFunc)&&this._removeCallbackFunc();const e=this._scene,t=e.globe,n=this._position;if(d.equals(n,d.ZERO)){this._terrainHeight=0;return}const o=t.ellipsoid.cartesianToCartographic(n,this._cartographicPosition),r=e.getHeight(o,this._heightReference);c(r)?this._terrainHeight=r:this._terrainHeight=0;const s=a=>{this._terrainHeight=a.height,this.definitionChanged.raiseEvent()};this._removeCallbackFunc=e.updateHeight(o,s,this._heightReference)};Fp.prototype.getValue=function(e,t){const n=K.getValueOrDefault(this._heightReference,e,gt.NONE),i=K.getValueOrDefault(this._extrudedHeightReference,e,gt.NONE);if(n===gt.NONE&&!zP(i))return this._position=d.clone(d.ZERO,this._position),d.clone(d.ZERO,t);if(this._positionProperty.isConstant)return d.multiplyByScalar(this._normal,this._terrainHeight,t);const o=this._scene,r=this._positionProperty.getValue(e,NV);if(!c(r)||d.equals(r,d.ZERO)||!c(o.globe))return d.clone(d.ZERO,t);if(d.equalsEpsilon(this._position,r,R.EPSILON10))return d.multiplyByScalar(this._normal,this._terrainHeight,t);this._position=d.clone(r,this._position),this._updateClamping();const s=o.globe.ellipsoid.geodeticSurfaceNormal(r,this._normal);return d.multiplyByScalar(s,this._terrainHeight,t)};Fp.prototype.isDestroyed=function(){return!1};Fp.prototype.destroy=function(){return c(this._removeEventListener)&&this._removeEventListener(),c(this._removeModeListener)&&this._removeModeListener(),c(this._removeCallbackFunc)&&this._removeCallbackFunc(),ve(this)};function oO(e,t,n,i){if(dn.prototype._onEntityPropertyChanged.call(this,e,t,n,i),this._observedPropertyNames.indexOf(t)===-1)return;const o=this._entity[this._geometryPropertyName];if(!c(o))return;c(this._terrainOffsetProperty)&&(this._terrainOffsetProperty.destroy(),this._terrainOffsetProperty=void 0);const r=o.heightReference;if(c(r)){const s=new up(this._computeCenter.bind(this),!this._dynamic);this._terrainOffsetProperty=new Fp(this._scene,s,r)}}const MV=d.ZERO,FV=new d,Kse=new d,BV=new z;function Zse(e){this.id=e,this.vertexFormat=void 0,this.dimensions=void 0,this.offsetAttribute=void 0}function Ea(e,t){dn.call(this,{entity:e,scene:t,geometryOptions:new Zse(e),geometryPropertyName:"box",observedPropertyNames:["availability","position","orientation","box"]}),this._onEntityPropertyChanged(e,"box",e.box,void 0)}c(Object.create)&&(Ea.prototype=Object.create(dn.prototype),Ea.prototype.constructor=Ea);Object.defineProperties(Ea.prototype,{terrainOffsetProperty:{get:function(){return this._terrainOffsetProperty}}});Ea.prototype.createFillGeometryInstance=function(e){if(A.defined("time",e),!this._fillEnabled)throw new E("This instance does not represent a filled geometry.");const t=this._entity,n=t.isAvailable(e),i=new mn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),o=this._distanceDisplayConditionProperty.getValue(e),r=Vn.fromDistanceDisplayCondition(o),s={show:i,distanceDisplayCondition:r,color:void 0,offset:void 0};if(this._materialProperty instanceof kt){let a;c(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(a=this._materialProperty.color.getValue(e,BV)),c(a)||(a=z.WHITE),s.color=$t.fromColor(a)}return c(this._options.offsetAttribute)&&(s.offset=Zi.fromCartesian3(K.getValueOrDefault(this._terrainOffsetProperty,e,MV,FV))),new Gt({id:t,geometry:rr.fromDimensions(this._options),modelMatrix:t.computeModelMatrixForHeightReference(e,t.box.heightReference,this._options.dimensions.z*.5,this._scene.mapProjection.ellipsoid),attributes:s})};Ea.prototype.createOutlineGeometryInstance=function(e){if(A.defined("time",e),!this._outlineEnabled)throw new E("This instance does not represent an outlined geometry.");const t=this._entity,n=t.isAvailable(e),i=K.getValueOrDefault(this._outlineColorProperty,e,z.BLACK,BV),o=this._distanceDisplayConditionProperty.getValue(e),r={show:new mn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:$t.fromColor(i),distanceDisplayCondition:Vn.fromDistanceDisplayCondition(o),offset:void 0};return c(this._options.offsetAttribute)&&(r.offset=Zi.fromCartesian3(K.getValueOrDefault(this._terrainOffsetProperty,e,MV,FV))),new Gt({id:t,geometry:Na.fromDimensions(this._options),modelMatrix:t.computeModelMatrixForHeightReference(e,t.box.heightReference,this._options.dimensions.z*.5,this._scene.mapProjection.ellipsoid),attributes:r})};Ea.prototype._computeCenter=function(e,t){return K.getValueOrUndefined(this._entity.position,e,t)};Ea.prototype._isHidden=function(e,t){return!c(t.dimensions)||!c(e.position)||dn.prototype._isHidden.call(this,e,t)};Ea.prototype._isDynamic=function(e,t){return!e.position.isConstant||!K.isConstant(e.orientation)||!t.dimensions.isConstant||!K.isConstant(t.outlineWidth)};Ea.prototype._setStaticOptions=function(e,t){const n=K.getValueOrDefault(t.heightReference,Ke.MINIMUM_VALUE,gt.NONE),i=this._options;i.vertexFormat=this._materialProperty instanceof kt?tn.VERTEX_FORMAT:oo.MaterialSupport.TEXTURED.vertexFormat,i.dimensions=t.dimensions.getValue(Ke.MINIMUM_VALUE,i.dimensions),i.offsetAttribute=n!==gt.NONE?Kt.ALL:void 0};Ea.prototype._onEntityPropertyChanged=oO;Ea.DynamicGeometryUpdater=i_;function i_(e,t,n){On.call(this,e,t,n)}c(Object.create)&&(i_.prototype=Object.create(On.prototype),i_.prototype.constructor=i_);i_.prototype._isHidden=function(e,t,n){const i=K.getValueOrUndefined(e.position,n,Kse),o=this._options.dimensions;return!c(i)||!c(o)||On.prototype._isHidden.call(this,e,t,n)};i_.prototype._setOptions=function(e,t,n){const i=K.getValueOrDefault(t.heightReference,n,gt.NONE),o=this._options;o.dimensions=K.getValueOrUndefined(t.dimensions,n,o.dimensions),o.offsetAttribute=i!==gt.NONE?Kt.ALL:void 0};/*! @license DOMPurify 3.1.4 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.4/LICENSE */const{entries:zV,setPrototypeOf:eM,isFrozen:Jse,getPrototypeOf:eae,getOwnPropertyDescriptor:tae}=Object;let{freeze:zs,seal:vc,create:UV}=Object,{apply:kI,construct:VI}=typeof Reflect<"u"&&Reflect;zs||(zs=function(t){return t});vc||(vc=function(t){return t});kI||(kI=function(t,n,i){return t.apply(n,i)});VI||(VI=function(t,n){return new t(...n)});const eT=Ba(Array.prototype.forEach),tM=Ba(Array.prototype.pop),Sg=Ba(Array.prototype.push),VA=Ba(String.prototype.toLowerCase),Rw=Ba(String.prototype.toString),nM=Ba(String.prototype.match),vg=Ba(String.prototype.replace),nae=Ba(String.prototype.indexOf),iae=Ba(String.prototype.trim),el=Ba(Object.prototype.hasOwnProperty),Is=Ba(RegExp.prototype.test),Ig=oae(TypeError);function iM(e){return typeof e=="number"&&isNaN(e)}function Ba(e){return function(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];return kI(e,t,i)}}function oae(e){return function(){for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return VI(e,n)}}function An(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:VA;eM&&eM(e,null);let i=t.length;for(;i--;){let o=t[i];if(typeof o=="string"){const r=n(o);r!==o&&(Jse(t)||(t[i]=r),o=r)}e[o]=!0}return e}function rae(e){for(let t=0;t<e.length;t++)el(e,t)||(e[t]=null);return e}function Ff(e){const t=UV(null);for(const[n,i]of zV(e))el(e,n)&&(Array.isArray(i)?t[n]=rae(i):i&&typeof i=="object"&&i.constructor===Object?t[n]=Ff(i):t[n]=i);return t}function tT(e,t){for(;e!==null;){const i=tae(e,t);if(i){if(i.get)return Ba(i.get);if(typeof i.value=="function")return Ba(i.value)}e=eae(e)}function n(){return null}return n}const oM=zs(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Nw=zs(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Mw=zs(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),sae=zs(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Fw=zs(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),aae=zs(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),rM=zs(["#text"]),sM=zs(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Bw=zs(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),aM=zs(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),nT=zs(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),cae=vc(/\{\{[\w\W]*|[\w\W]*\}\}/gm),lae=vc(/<%[\w\W]*|[\w\W]*%>/gm),uae=vc(/\${[\w\W]*}/gm),dae=vc(/^data-[\-\w.\u00B7-\uFFFF]/),hae=vc(/^aria-[\-\w]+$/),kV=vc(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),fae=vc(/^(?:\w+script|data):/i),pae=vc(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),VV=vc(/^html$/i),mae=vc(/^[a-z][.\w]*(-[.\w]+)+$/i);var cM=Object.freeze({__proto__:null,MUSTACHE_EXPR:cae,ERB_EXPR:lae,TMPLIT_EXPR:uae,DATA_ATTR:dae,ARIA_ATTR:hae,IS_ALLOWED_URI:kV,IS_SCRIPT_OR_DATA:fae,ATTR_WHITESPACE:pae,DOCTYPE_NAME:VV,CUSTOM_ELEMENT:mae});const mf={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},_ae=function(){return typeof window>"u"?null:window},gae=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let i=null;const o="data-tt-policy-suffix";n&&n.hasAttribute(o)&&(i=n.getAttribute(o));const r="dompurify"+(i?"#"+i:"");try{return t.createPolicy(r,{createHTML(s){return s},createScriptURL(s){return s}})}catch{return console.warn("TrustedTypes policy "+r+" could not be created."),null}};function HV(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:_ae();const t=Et=>HV(Et);if(t.version="3.1.4",t.removed=[],!e||!e.document||e.document.nodeType!==mf.document)return t.isSupported=!1,t;let{document:n}=e;const i=n,o=i.currentScript,{DocumentFragment:r,HTMLTemplateElement:s,Node:a,Element:l,NodeFilter:u,NamedNodeMap:h=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:f,DOMParser:_,trustedTypes:g}=e,m=l.prototype,b=tT(m,"cloneNode"),T=tT(m,"nextSibling"),x=tT(m,"childNodes"),C=tT(m,"parentNode");if(typeof s=="function"){const Et=n.createElement("template");Et.content&&Et.content.ownerDocument&&(n=Et.content.ownerDocument)}let w,v="";const{implementation:P,createNodeIterator:N,createDocumentFragment:k,getElementsByTagName:M}=n,{importNode:U}=i;let B={};t.isSupported=typeof zV=="function"&&typeof C=="function"&&P&&P.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:S,ERB_EXPR:D,TMPLIT_EXPR:p,DATA_ATTR:I,ARIA_ATTR:O,IS_SCRIPT_OR_DATA:F,ATTR_WHITESPACE:V,CUSTOM_ELEMENT:G}=cM;let{IS_ALLOWED_URI:j}=cM,W=null;const X=An({},[...oM,...Nw,...Mw,...Fw,...rM]);let q=null;const ee=An({},[...sM,...Bw,...aM,...nT]);let Y=Object.seal(UV(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ne=null,Q=null,le=!0,pe=!0,re=!1,de=!0,fe=!1,ye=!0,Ce=!1,we=!1,Pe=!1,lt=!1,ft=!1,We=!1,Fe=!0,Dt=!1;const st="user-content-";let et=!0,hn=!1,ot={},at=null;const Xt=An({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let it=null;const fi=An({},["audio","video","img","source","image","track"]);let Hi=null;const Ss=An({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Qo="http://www.w3.org/1998/Math/MathML",No="http://www.w3.org/2000/svg",Gi="http://www.w3.org/1999/xhtml";let Ni=Gi,wi=!1,$r=null;const zn=An({},[Qo,No,Gi],Rw);let ci=null;const Si=["application/xhtml+xml","text/html"],Ko="text/html";let ri=null,fr=null;const ha=255,fa=n.createElement("form"),So=function(be){return be instanceof RegExp||be instanceof Function},Ln=function(){let be=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(fr&&fr===be)){if((!be||typeof be!="object")&&(be={}),be=Ff(be),ci=Si.indexOf(be.PARSER_MEDIA_TYPE)===-1?Ko:be.PARSER_MEDIA_TYPE,ri=ci==="application/xhtml+xml"?Rw:VA,W=el(be,"ALLOWED_TAGS")?An({},be.ALLOWED_TAGS,ri):X,q=el(be,"ALLOWED_ATTR")?An({},be.ALLOWED_ATTR,ri):ee,$r=el(be,"ALLOWED_NAMESPACES")?An({},be.ALLOWED_NAMESPACES,Rw):zn,Hi=el(be,"ADD_URI_SAFE_ATTR")?An(Ff(Ss),be.ADD_URI_SAFE_ATTR,ri):Ss,it=el(be,"ADD_DATA_URI_TAGS")?An(Ff(fi),be.ADD_DATA_URI_TAGS,ri):fi,at=el(be,"FORBID_CONTENTS")?An({},be.FORBID_CONTENTS,ri):Xt,ne=el(be,"FORBID_TAGS")?An({},be.FORBID_TAGS,ri):{},Q=el(be,"FORBID_ATTR")?An({},be.FORBID_ATTR,ri):{},ot=el(be,"USE_PROFILES")?be.USE_PROFILES:!1,le=be.ALLOW_ARIA_ATTR!==!1,pe=be.ALLOW_DATA_ATTR!==!1,re=be.ALLOW_UNKNOWN_PROTOCOLS||!1,de=be.ALLOW_SELF_CLOSE_IN_ATTR!==!1,fe=be.SAFE_FOR_TEMPLATES||!1,ye=be.SAFE_FOR_XML!==!1,Ce=be.WHOLE_DOCUMENT||!1,lt=be.RETURN_DOM||!1,ft=be.RETURN_DOM_FRAGMENT||!1,We=be.RETURN_TRUSTED_TYPE||!1,Pe=be.FORCE_BODY||!1,Fe=be.SANITIZE_DOM!==!1,Dt=be.SANITIZE_NAMED_PROPS||!1,et=be.KEEP_CONTENT!==!1,hn=be.IN_PLACE||!1,j=be.ALLOWED_URI_REGEXP||kV,Ni=be.NAMESPACE||Gi,Y=be.CUSTOM_ELEMENT_HANDLING||{},be.CUSTOM_ELEMENT_HANDLING&&So(be.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Y.tagNameCheck=be.CUSTOM_ELEMENT_HANDLING.tagNameCheck),be.CUSTOM_ELEMENT_HANDLING&&So(be.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Y.attributeNameCheck=be.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),be.CUSTOM_ELEMENT_HANDLING&&typeof be.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Y.allowCustomizedBuiltInElements=be.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),fe&&(pe=!1),ft&&(lt=!0),ot&&(W=An({},rM),q=[],ot.html===!0&&(An(W,oM),An(q,sM)),ot.svg===!0&&(An(W,Nw),An(q,Bw),An(q,nT)),ot.svgFilters===!0&&(An(W,Mw),An(q,Bw),An(q,nT)),ot.mathMl===!0&&(An(W,Fw),An(q,aM),An(q,nT))),be.ADD_TAGS&&(W===X&&(W=Ff(W)),An(W,be.ADD_TAGS,ri)),be.ADD_ATTR&&(q===ee&&(q=Ff(q)),An(q,be.ADD_ATTR,ri)),be.ADD_URI_SAFE_ATTR&&An(Hi,be.ADD_URI_SAFE_ATTR,ri),be.FORBID_CONTENTS&&(at===Xt&&(at=Ff(at)),An(at,be.FORBID_CONTENTS,ri)),et&&(W["#text"]=!0),Ce&&An(W,["html","head","body"]),W.table&&(An(W,["tbody"]),delete ne.tbody),be.TRUSTED_TYPES_POLICY){if(typeof be.TRUSTED_TYPES_POLICY.createHTML!="function")throw Ig('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof be.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Ig('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');w=be.TRUSTED_TYPES_POLICY,v=w.createHTML("")}else w===void 0&&(w=gae(g,o)),w!==null&&typeof v=="string"&&(v=w.createHTML(""));zs&&zs(be),fr=be}},Zo=An({},["mi","mo","mn","ms","mtext"]),ho=An({},["foreignobject","annotation-xml"]),qs=An({},["title","style","font","a","script"]),pi=An({},[...Nw,...Mw,...sae]),ji=An({},[...Fw,...aae]),cf=function(be){let Ge=C(be);(!Ge||!Ge.tagName)&&(Ge={namespaceURI:Ni,tagName:"template"});const wt=VA(be.tagName),ln=VA(Ge.tagName);return $r[be.namespaceURI]?be.namespaceURI===No?Ge.namespaceURI===Gi?wt==="svg":Ge.namespaceURI===Qo?wt==="svg"&&(ln==="annotation-xml"||Zo[ln]):Boolean(pi[wt]):be.namespaceURI===Qo?Ge.namespaceURI===Gi?wt==="math":Ge.namespaceURI===No?wt==="math"&&ho[ln]:Boolean(ji[wt]):be.namespaceURI===Gi?Ge.namespaceURI===No&&!ho[ln]||Ge.namespaceURI===Qo&&!Zo[ln]?!1:!ji[wt]&&(qs[wt]||!pi[wt]):!!(ci==="application/xhtml+xml"&&$r[be.namespaceURI]):!1},vi=function(be){Sg(t.removed,{element:be});try{be.parentNode.removeChild(be)}catch{be.remove()}},pr=function(be,Ge){try{Sg(t.removed,{attribute:Ge.getAttributeNode(be),from:Ge})}catch{Sg(t.removed,{attribute:null,from:Ge})}if(Ge.removeAttribute(be),be==="is"&&!q[be])if(lt||ft)try{vi(Ge)}catch{}else try{Ge.setAttribute(be,"")}catch{}},Rd=function(be){let Ge=null,wt=null;if(Pe)be="<remove></remove>"+be;else{const Rr=nM(be,/^[\r\n\t ]+/);wt=Rr&&Rr[0]}ci==="application/xhtml+xml"&&Ni===Gi&&(be='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+be+"</body></html>");const ln=w?w.createHTML(be):be;if(Ni===Gi)try{Ge=new _().parseFromString(ln,ci)}catch{}if(!Ge||!Ge.documentElement){Ge=P.createDocument(Ni,"template",null);try{Ge.documentElement.innerHTML=wi?v:ln}catch{}}const Qr=Ge.body||Ge.documentElement;return be&&wt&&Qr.insertBefore(n.createTextNode(wt),Qr.childNodes[0]||null),Ni===Gi?M.call(Ge,Ce?"html":"body")[0]:Ce?Ge.documentElement:Qr},Lr=function(be){return N.call(be.ownerDocument||be,be,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},Xr=function(be){return be instanceof f&&(typeof be.__depth<"u"&&typeof be.__depth!="number"||typeof be.__removalCount<"u"&&typeof be.__removalCount!="number"||typeof be.nodeName!="string"||typeof be.textContent!="string"||typeof be.removeChild!="function"||!(be.attributes instanceof h)||typeof be.removeAttribute!="function"||typeof be.setAttribute!="function"||typeof be.namespaceURI!="string"||typeof be.insertBefore!="function"||typeof be.hasChildNodes!="function")},Jp=function(be){return typeof a=="function"&&be instanceof a},Jn=function(be,Ge,wt){!B[be]||eT(B[be],ln=>{ln.call(t,Ge,wt,fr)})},qa=function(be){let Ge=null;if(Jn("beforeSanitizeElements",be,null),Xr(be))return vi(be),!0;const wt=ri(be.nodeName);if(Jn("uponSanitizeElement",be,{tagName:wt,allowedTags:W}),be.hasChildNodes()&&!Jp(be.firstElementChild)&&Is(/<[/\w]/g,be.innerHTML)&&Is(/<[/\w]/g,be.textContent)||be.nodeType===mf.progressingInstruction||ye&&be.nodeType===mf.comment&&Is(/<[/\w]/g,be.data))return vi(be),!0;if(!W[wt]||ne[wt]){if(!ne[wt]&&lf(wt)&&(Y.tagNameCheck instanceof RegExp&&Is(Y.tagNameCheck,wt)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(wt)))return!1;if(et&&!at[wt]){const ln=C(be)||be.parentNode,Qr=x(be)||be.childNodes;if(Qr&&ln){const Rr=Qr.length;for(let Ys=Rr-1;Ys>=0;--Ys){const $s=b(Qr[Ys],!0);$s.__removalCount=(be.__removalCount||0)+1,ln.insertBefore($s,T(be))}}}return vi(be),!0}return be instanceof l&&!cf(be)||(wt==="noscript"||wt==="noembed"||wt==="noframes")&&Is(/<\/no(script|embed|frames)/i,be.innerHTML)?(vi(be),!0):(fe&&be.nodeType===mf.text&&(Ge=be.textContent,eT([S,D,p],ln=>{Ge=vg(Ge,ln," ")}),be.textContent!==Ge&&(Sg(t.removed,{element:be.cloneNode()}),be.textContent=Ge)),Jn("afterSanitizeElements",be,null),!1)},Ya=function(be,Ge,wt){if(Fe&&(Ge==="id"||Ge==="name")&&(wt in n||wt in fa||wt==="__depth"||wt==="__removalCount"))return!1;if(!(pe&&!Q[Ge]&&Is(I,Ge))){if(!(le&&Is(O,Ge))){if(!q[Ge]||Q[Ge]){if(!(lf(be)&&(Y.tagNameCheck instanceof RegExp&&Is(Y.tagNameCheck,be)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(be))&&(Y.attributeNameCheck instanceof RegExp&&Is(Y.attributeNameCheck,Ge)||Y.attributeNameCheck instanceof Function&&Y.attributeNameCheck(Ge))||Ge==="is"&&Y.allowCustomizedBuiltInElements&&(Y.tagNameCheck instanceof RegExp&&Is(Y.tagNameCheck,wt)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(wt))))return!1}else if(!Hi[Ge]){if(!Is(j,vg(wt,V,""))){if(!((Ge==="src"||Ge==="xlink:href"||Ge==="href")&&be!=="script"&&nae(wt,"data:")===0&&it[be])){if(!(re&&!Is(F,vg(wt,V,"")))){if(wt)return!1}}}}}}return!0},lf=function(be){return be!=="annotation-xml"&&nM(be,G)},fo=function(be){Jn("beforeSanitizeAttributes",be,null);const{attributes:Ge}=be;if(!Ge)return;const wt={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:q};let ln=Ge.length;for(;ln--;){const Qr=Ge[ln],{name:Rr,namespaceURI:Ys,value:$s}=Qr,ug=ri(Rr);let vs=Rr==="value"?$s:iae($s);if(wt.attrName=ug,wt.attrValue=vs,wt.keepAttr=!0,wt.forceKeepAttr=void 0,Jn("uponSanitizeAttribute",be,wt),vs=wt.attrValue,wt.forceKeepAttr||(pr(Rr,be),!wt.keepAttr))continue;if(!de&&Is(/\/>/i,vs)){pr(Rr,be);continue}if(ye&&Is(/((--!?|])>)|<\/(style|title)/i,vs)){pr(Rr,be);continue}fe&&eT([S,D,p],pL=>{vs=vg(vs,pL," ")});const fL=ri(be.nodeName);if(!!Ya(fL,ug,vs)){if(Dt&&(ug==="id"||ug==="name")&&(pr(Rr,be),vs=st+vs),w&&typeof g=="object"&&typeof g.getAttributeType=="function"&&!Ys)switch(g.getAttributeType(fL,ug)){case"TrustedHTML":{vs=w.createHTML(vs);break}case"TrustedScriptURL":{vs=w.createScriptURL(vs);break}}try{Ys?be.setAttributeNS(Ys,Rr,vs):be.setAttribute(Rr,vs),Xr(be)?vi(be):tM(t.removed)}catch{}}}Jn("afterSanitizeAttributes",be,null)},Mo=function Et(be){let Ge=null;const wt=Lr(be);for(Jn("beforeSanitizeShadowDOM",be,null);Ge=wt.nextNode();){if(Jn("uponSanitizeShadowNode",Ge,null),qa(Ge))continue;const ln=C(Ge);Ge.nodeType===mf.element&&(ln&&ln.__depth?Ge.__depth=(Ge.__removalCount||0)+ln.__depth+1:Ge.__depth=1),(Ge.__depth>=ha||Ge.__depth<0||iM(Ge.__depth))&&vi(Ge),Ge.content instanceof r&&(Ge.content.__depth=Ge.__depth,Et(Ge.content)),fo(Ge)}Jn("afterSanitizeShadowDOM",be,null)};return t.sanitize=function(Et){let be=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Ge=null,wt=null,ln=null,Qr=null;if(wi=!Et,wi&&(Et="<!-->"),typeof Et!="string"&&!Jp(Et))if(typeof Et.toString=="function"){if(Et=Et.toString(),typeof Et!="string")throw Ig("dirty is not a string, aborting")}else throw Ig("toString is not a function");if(!t.isSupported)return Et;if(we||Ln(be),t.removed=[],typeof Et=="string"&&(hn=!1),hn){if(Et.nodeName){const $s=ri(Et.nodeName);if(!W[$s]||ne[$s])throw Ig("root node is forbidden and cannot be sanitized in-place")}}else if(Et instanceof a)Ge=Rd("<!---->"),wt=Ge.ownerDocument.importNode(Et,!0),wt.nodeType===mf.element&&wt.nodeName==="BODY"||wt.nodeName==="HTML"?Ge=wt:Ge.appendChild(wt);else{if(!lt&&!fe&&!Ce&&Et.indexOf("<")===-1)return w&&We?w.createHTML(Et):Et;if(Ge=Rd(Et),!Ge)return lt?null:We?v:""}Ge&&Pe&&vi(Ge.firstChild);const Rr=Lr(hn?Et:Ge);for(;ln=Rr.nextNode();){if(qa(ln))continue;const $s=C(ln);ln.nodeType===mf.element&&($s&&$s.__depth?ln.__depth=(ln.__removalCount||0)+$s.__depth+1:ln.__depth=1),(ln.__depth>=ha||ln.__depth<0||iM(ln.__depth))&&vi(ln),ln.content instanceof r&&(ln.content.__depth=ln.__depth,Mo(ln.content)),fo(ln)}if(hn)return Et;if(lt){if(ft)for(Qr=k.call(Ge.ownerDocument);Ge.firstChild;)Qr.appendChild(Ge.firstChild);else Qr=Ge;return(q.shadowroot||q.shadowrootmode)&&(Qr=U.call(i,Qr,!0)),Qr}let Ys=Ce?Ge.outerHTML:Ge.innerHTML;return Ce&&W["!doctype"]&&Ge.ownerDocument&&Ge.ownerDocument.doctype&&Ge.ownerDocument.doctype.name&&Is(VV,Ge.ownerDocument.doctype.name)&&(Ys="<!DOCTYPE "+Ge.ownerDocument.doctype.name+`>
|
|
`+Ys),fe&&eT([S,D,p],$s=>{Ys=vg(Ys,$s," ")}),w&&We?w.createHTML(Ys):Ys},t.setConfig=function(){let Et=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ln(Et),we=!0},t.clearConfig=function(){fr=null,we=!1},t.isValidAttribute=function(Et,be,Ge){fr||Ln({});const wt=ri(Et),ln=ri(be);return Ya(wt,ln,Ge)},t.addHook=function(Et,be){typeof be=="function"&&(B[Et]=B[Et]||[],Sg(B[Et],be))},t.removeHook=function(Et){if(B[Et])return tM(B[Et])},t.removeHooks=function(Et){B[Et]&&(B[Et]=[])},t.removeAllHooks=function(){B={}},t}var yae=HV();let bae=0;const zw={};function Wt(e,t){A.typeOf.string("html",e);let n;const i=e;c(zw[i])?n=zw[i]:(n=bae++,zw[i]=n),t=y(t,!1),this._id=n,this._html=e,this._showOnScreen=t,this._element=void 0}Object.defineProperties(Wt.prototype,{html:{get:function(){return this._html}},id:{get:function(){return this._id}},showOnScreen:{get:function(){return this._showOnScreen},set:function(e){this._showOnScreen=e}},element:{get:function(){if(!c(this._element)){const e=yae.sanitize(this._html),t=document.createElement("div");t._creditId=this._id,t.style.display="inline",t.innerHTML=e;const n=t.querySelectorAll("a");for(let i=0;i<n.length;i++)n[i].setAttribute("target","_blank");this._element=t}return this._element}}});Wt.equals=function(e,t){return e===t||c(e)&&c(t)&&e._id===t._id&&e._showOnScreen===t._showOnScreen};Wt.prototype.equals=function(e){return Wt.equals(this,e)};Wt.prototype.isIon=function(){return this.html.indexOf("ion-credit.png")!==-1};Wt.getIonCredit=function(e){const t=c(e.collapsible)&&!e.collapsible;return new Wt(e.html,t)};Wt.clone=function(e){if(c(e))return new Wt(e.html,e.showOnScreen)};const Tae=`in vec2 v_textureCoordinates;
|
|
|
|
uniform float originalSize;
|
|
uniform sampler2D texture0;
|
|
uniform sampler2D texture1;
|
|
uniform sampler2D texture2;
|
|
uniform sampler2D texture3;
|
|
uniform sampler2D texture4;
|
|
uniform sampler2D texture5;
|
|
|
|
const float yMipLevel1 = 1.0 - (1.0 / pow(2.0, 1.0));
|
|
const float yMipLevel2 = 1.0 - (1.0 / pow(2.0, 2.0));
|
|
const float yMipLevel3 = 1.0 - (1.0 / pow(2.0, 3.0));
|
|
const float yMipLevel4 = 1.0 - (1.0 / pow(2.0, 4.0));
|
|
|
|
void main()
|
|
{
|
|
vec2 uv = v_textureCoordinates;
|
|
vec2 textureSize = vec2(originalSize * 1.5 + 2.0, originalSize);
|
|
vec2 pixel = 1.0 / textureSize;
|
|
|
|
float mipLevel = 0.0;
|
|
|
|
if (uv.x - pixel.x > (textureSize.y / textureSize.x))
|
|
{
|
|
mipLevel = 1.0;
|
|
if (uv.y - pixel.y > yMipLevel1)
|
|
{
|
|
mipLevel = 2.0;
|
|
if (uv.y - pixel.y * 3.0 > yMipLevel2)
|
|
{
|
|
mipLevel = 3.0;
|
|
if (uv.y - pixel.y * 5.0 > yMipLevel3)
|
|
{
|
|
mipLevel = 4.0;
|
|
if (uv.y - pixel.y * 7.0 > yMipLevel4)
|
|
{
|
|
mipLevel = 5.0;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if (mipLevel > 0.0)
|
|
{
|
|
float scale = pow(2.0, mipLevel);
|
|
|
|
uv.y -= (pixel.y * (mipLevel - 1.0) * 2.0);
|
|
uv.x *= ((textureSize.x - 2.0) / textureSize.y);
|
|
|
|
uv.x -= 1.0 + pixel.x;
|
|
uv.y -= (1.0 - (1.0 / pow(2.0, mipLevel - 1.0)));
|
|
uv *= scale;
|
|
}
|
|
else
|
|
{
|
|
uv.x *= (textureSize.x / textureSize.y);
|
|
}
|
|
|
|
if(mipLevel == 0.0)
|
|
{
|
|
out_FragColor = texture(texture0, uv);
|
|
}
|
|
else if(mipLevel == 1.0)
|
|
{
|
|
out_FragColor = texture(texture1, uv);
|
|
}
|
|
else if(mipLevel == 2.0)
|
|
{
|
|
out_FragColor = texture(texture2, uv);
|
|
}
|
|
else if(mipLevel == 3.0)
|
|
{
|
|
out_FragColor = texture(texture3, uv);
|
|
}
|
|
else if(mipLevel == 4.0)
|
|
{
|
|
out_FragColor = texture(texture4, uv);
|
|
}
|
|
else if(mipLevel == 5.0)
|
|
{
|
|
out_FragColor = texture(texture5, uv);
|
|
}
|
|
else
|
|
{
|
|
out_FragColor = vec4(0.0);
|
|
}
|
|
}
|
|
`,Aae=`in vec3 v_cubeMapCoordinates;
|
|
uniform samplerCube cubeMap;
|
|
|
|
void main()
|
|
{
|
|
vec4 rgba = czm_textureCube(cubeMap, v_cubeMapCoordinates);
|
|
#ifdef RGBA_NORMALIZED
|
|
out_FragColor = vec4(rgba.rgb, 1.0);
|
|
#else
|
|
float m = rgba.a * 16.0;
|
|
vec3 r = rgba.rgb * m;
|
|
out_FragColor = vec4(r * r, 1.0);
|
|
#endif
|
|
}
|
|
`,xae=`in vec4 position;
|
|
in vec3 cubeMapCoordinates;
|
|
|
|
out vec3 v_cubeMapCoordinates;
|
|
|
|
void main()
|
|
{
|
|
gl_Position = position;
|
|
v_cubeMapCoordinates = cubeMapCoordinates;
|
|
}
|
|
`;function yl(e){this._url=e,this._cubeMapBuffers=void 0,this._cubeMaps=void 0,this._texture=void 0,this._mipTextures=void 0,this._va=void 0,this._sp=void 0,this._maximumMipmapLevel=void 0,this._loading=!1,this._ready=!1,this._errorEvent=new Le}Object.defineProperties(yl.prototype,{url:{get:function(){return this._url}},errorEvent:{get:function(){return this._errorEvent}},texture:{get:function(){return this._texture}},maximumMipmapLevel:{get:function(){return this._maximumMipmapLevel}},ready:{get:function(){return this._ready}}});yl.isSupported=function(e){return e.colorBufferHalfFloat&&e.halfFloatingPointTexture||e.floatingPointTexture&&e.colorBufferFloat};const Cae=new d(1,0,0),Eae=new d(0,0,1),wae=new d(-1,0,0),Sae=new d(0,0,-1),iT=new d(0,1,0),vae=new d(0,-1,0),GV=[iT,wae,Eae,vae,Cae,iT,Sae,iT,iT],jV=GV.length,WV=new Float32Array(jV*3);let lM=0;for(let e=0;e<jV;++e,lM+=3)d.pack(GV[e],WV,lM);const Iae=new Float32Array([-1,1,-1,0,0,1,0,0,1,0,1,1,0,-1,-1,-1,1,-1]),Dae=new Uint16Array([0,1,2,2,3,1,7,6,1,3,6,1,2,5,4,3,4,2,4,8,6,3,4,6]);function Pae(e){const t=ct.createVertexBuffer({context:e,typedArray:Iae,usage:ke.STATIC_DRAW}),n=ct.createVertexBuffer({context:e,typedArray:WV,usage:ke.STATIC_DRAW}),i=ct.createIndexBuffer({context:e,typedArray:Dae,usage:ke.STATIC_DRAW,indexDatatype:je.UNSIGNED_SHORT}),o=[{index:0,vertexBuffer:t,componentsPerAttribute:2,componentDatatype:Z.FLOAT},{index:1,vertexBuffer:n,componentsPerAttribute:3,componentDatatype:Z.FLOAT}];return new Ci({context:e,attributes:o,indexBuffer:i})}function uM(e){return function(){return e}}function HI(e){e._va=e._va&&e._va.destroy(),e._sp=e._sp&&e._sp.destroy();let t,n;const i=e._cubeMaps;if(c(i))for(n=i.length,t=0;t<n;++t)i[t].destroy();const o=e._mipTextures;if(c(o))for(n=o.length,t=0;t<n;++t)o[t].destroy();e._va=void 0,e._sp=void 0,e._cubeMaps=void 0,e._cubeMapBuffers=void 0,e._mipTextures=void 0}yl.prototype.update=function(e){const t=e.context;if(!yl.isSupported(t)||(c(this._texture)&&c(this._va)&&HI(this),c(this._texture)))return;if(!c(this._texture)&&!this._loading){const g=e.context.textureCache.getTexture(this._url);c(g)&&(HI(this),this._texture=g,this._maximumMipmapLevel=this._texture.maximumMipmapLevel,this._ready=!0)}const n=this._cubeMapBuffers;if(!c(n)&&!this._loading){const g=this;Op(this._url).then(function(m){g._cubeMapBuffers=m,g._loading=!1}).catch(function(m){g.isDestroyed()||g._errorEvent.raiseEvent(m)}),this._loading=!0}if(!c(this._cubeMapBuffers))return;const i=[];let o=n[0].positiveX.pixelDatatype;c(o)?i.push("RGBA_NORMALIZED"):o=t.halfFloatingPointTexture?Me.HALF_FLOAT:Me.FLOAT;const r=Ve.RGBA,s=new Oe({defines:i,sources:[Aae]});this._va=Pae(t),this._sp=Jt.fromCache({context:t,vertexShaderSource:xae,fragmentShaderSource:s,attributeLocations:{position:0,cubeMapCoordinates:1}});const a=Math.min(n.length,6);this._maximumMipmapLevel=a-1;const l=this._cubeMaps=new Array(a),u=this._mipTextures=new Array(a),h=n[0].positiveX.width*2,f={originalSize:function(){return h}};for(let g=0;g<a;++g){const m=n[g].positiveY;n[g].positiveY=n[g].negativeY,n[g].negativeY=m;const b=l[g]=new Sl({context:t,source:n[g],pixelDatatype:o}),T=l[g].width*2,x=u[g]=new xt({context:t,width:T,height:T,pixelDatatype:o,pixelFormat:r}),C=new A_({vertexArray:this._va,shaderProgram:this._sp,uniformMap:{cubeMap:uM(b)},outputTexture:x,persists:!0,owner:this});e.commandList.push(C),f[`texture${g}`]=uM(x)}this._texture=new xt({context:t,width:h*1.5+2,height:h,pixelDatatype:o,pixelFormat:r}),this._texture.maximumMipmapLevel=this._maximumMipmapLevel,t.textureCache.addTexture(this._url,this._texture);const _=new A_({fragmentShaderSource:Tae,uniformMap:f,outputTexture:this._texture,persists:!1,owner:this});e.commandList.push(_),this._ready=!0};yl.prototype.isDestroyed=function(){return!1};yl.prototype.destroy=function(){return HI(this),this._texture=this._texture&&this._texture.destroy(),ve(this)};function G_(e){e=y(e,y.EMPTY_OBJECT);const t=c(e.imageBasedLightingFactor)?H.clone(e.imageBasedLightingFactor):new H(1,1);A.typeOf.object("options.imageBasedLightingFactor",t),A.typeOf.number.greaterThanOrEquals("options.imageBasedLightingFactor.x",t.x,0),A.typeOf.number.lessThanOrEquals("options.imageBasedLightingFactor.x",t.x,1),A.typeOf.number.greaterThanOrEquals("options.imageBasedLightingFactor.y",t.y,0),A.typeOf.number.lessThanOrEquals("options.imageBasedLightingFactor.y",t.y,1),this._imageBasedLightingFactor=t;const n=y(e.luminanceAtZenith,.2);A.typeOf.number("options.luminanceAtZenith",n),this._luminanceAtZenith=n;const i=e.sphericalHarmonicCoefficients;if(c(i)&&(!Array.isArray(i)||i.length!==9))throw new E("options.sphericalHarmonicCoefficients must be an array of 9 Cartesian3 values.");this._sphericalHarmonicCoefficients=i,this._specularEnvironmentMaps=e.specularEnvironmentMaps,this._specularEnvironmentMapAtlas=void 0,this._specularEnvironmentMapAtlasDirty=!0,this._specularEnvironmentMapLoaded=!1,this._previousSpecularEnvironmentMapLoaded=!1,this._useDefaultSpecularMaps=!1,this._useDefaultSphericalHarmonics=!1,this._shouldRegenerateShaders=!1,this._previousFrameNumber=void 0,this._previousImageBasedLightingFactor=H.clone(t),this._previousLuminanceAtZenith=n,this._previousSphericalHarmonicCoefficients=i,this._removeErrorListener=void 0}Object.defineProperties(G_.prototype,{imageBasedLightingFactor:{get:function(){return this._imageBasedLightingFactor},set:function(e){A.typeOf.object("imageBasedLightingFactor",e),A.typeOf.number.greaterThanOrEquals("imageBasedLightingFactor.x",e.x,0),A.typeOf.number.lessThanOrEquals("imageBasedLightingFactor.x",e.x,1),A.typeOf.number.greaterThanOrEquals("imageBasedLightingFactor.y",e.y,0),A.typeOf.number.lessThanOrEquals("imageBasedLightingFactor.y",e.y,1),this._previousImageBasedLightingFactor=H.clone(this._imageBasedLightingFactor,this._previousImageBasedLightingFactor),this._imageBasedLightingFactor=H.clone(e,this._imageBasedLightingFactor)}},luminanceAtZenith:{get:function(){return this._luminanceAtZenith},set:function(e){this._previousLuminanceAtZenith=this._luminanceAtZenith,this._luminanceAtZenith=e}},sphericalHarmonicCoefficients:{get:function(){return this._sphericalHarmonicCoefficients},set:function(e){if(c(e)&&(!Array.isArray(e)||e.length!==9))throw new E("sphericalHarmonicCoefficients must be an array of 9 Cartesian3 values.");this._previousSphericalHarmonicCoefficients=this._sphericalHarmonicCoefficients,this._sphericalHarmonicCoefficients=e}},specularEnvironmentMaps:{get:function(){return this._specularEnvironmentMaps},set:function(e){e!==this._specularEnvironmentMaps&&(this._specularEnvironmentMapAtlasDirty=this._specularEnvironmentMapAtlasDirty||e!==this._specularEnvironmentMaps,this._specularEnvironmentMapLoaded=!1),this._specularEnvironmentMaps=e}},enabled:{get:function(){return this._imageBasedLightingFactor.x>0||this._imageBasedLightingFactor.y>0}},shouldRegenerateShaders:{get:function(){return this._shouldRegenerateShaders}},useDefaultSphericalHarmonics:{get:function(){return this._useDefaultSphericalHarmonics}},useSphericalHarmonicCoefficients:{get:function(){return c(this._sphericalHarmonicCoefficients)||this._useDefaultSphericalHarmonics}},specularEnvironmentMapAtlas:{get:function(){return this._specularEnvironmentMapAtlas}},useDefaultSpecularMaps:{get:function(){return this._useDefaultSpecularMaps}},useSpecularEnvironmentMaps:{get:function(){return c(this._specularEnvironmentMapAtlas)&&this._specularEnvironmentMapAtlas.ready||this._useDefaultSpecularMaps}}});function Oae(e,t){if(!!yl.isSupported(t)){if(e._specularEnvironmentMapAtlas=e._specularEnvironmentMapAtlas&&e._specularEnvironmentMapAtlas.destroy(),c(e._specularEnvironmentMaps)){const n=new yl(e._specularEnvironmentMaps);e._specularEnvironmentMapAtlas=n,e._removeErrorListener=n.errorEvent.addEventListener(i=>{console.error(`Error loading specularEnvironmentMaps: ${i}`)})}e._shouldRegenerateShaders=!0}}G_.prototype.update=function(e){if(e.frameNumber===this._previousFrameNumber)return;this._previousFrameNumber=e.frameNumber;const t=e.context;e.brdfLutGenerator.update(e),this._shouldRegenerateShaders=!1;const n=this._imageBasedLightingFactor,i=this._previousImageBasedLightingFactor;H.equals(n,i)||(this._shouldRegenerateShaders=n.x>0&&i.x===0||n.x===0&&i.x>0,this._shouldRegenerateShaders=this._shouldRegenerateShaders||n.y>0&&i.y===0||n.y===0&&i.y>0,this._previousImageBasedLightingFactor=H.clone(this._imageBasedLightingFactor,this._previousImageBasedLightingFactor)),this._luminanceAtZenith!==this._previousLuminanceAtZenith&&(this._shouldRegenerateShaders=this._shouldRegenerateShaders||c(this._luminanceAtZenith)!==c(this._previousLuminanceAtZenith),this._previousLuminanceAtZenith=this._luminanceAtZenith),this._previousSphericalHarmonicCoefficients!==this._sphericalHarmonicCoefficients&&(this._shouldRegenerateShaders=this._shouldRegenerateShaders||c(this._previousSphericalHarmonicCoefficients)!==c(this._sphericalHarmonicCoefficients),this._previousSphericalHarmonicCoefficients=this._sphericalHarmonicCoefficients),this._shouldRegenerateShaders=this._shouldRegenerateShaders||this._previousSpecularEnvironmentMapLoaded!==this._specularEnvironmentMapLoaded,this._previousSpecularEnvironmentMapLoaded=this._specularEnvironmentMapLoaded,this._specularEnvironmentMapAtlasDirty&&(Oae(this,t),this._specularEnvironmentMapAtlasDirty=!1),c(this._specularEnvironmentMapAtlas)&&(this._specularEnvironmentMapAtlas.update(e),this._specularEnvironmentMapAtlas.ready&&(this._specularEnvironmentMapLoaded=!0));const o=!c(this._specularEnvironmentMapAtlas)&&c(e.specularEnvironmentMaps)&&!this._useDefaultSpecularMaps,r=!c(e.specularEnvironmentMaps)&&this._useDefaultSpecularMaps,s=!c(this._sphericalHarmonicCoefficients)&&c(e.sphericalHarmonicCoefficients)&&!this._useDefaultSphericalHarmonics,a=!c(e.sphericalHarmonicCoefficients)&&this._useDefaultSphericalHarmonics;this._shouldRegenerateShaders=this._shouldRegenerateShaders||o||r||s||a,this._useDefaultSpecularMaps=!c(this._specularEnvironmentMapAtlas)&&c(e.specularEnvironmentMaps),this._useDefaultSphericalHarmonics=!c(this._sphericalHarmonicCoefficients)&&c(e.sphericalHarmonicCoefficients)};G_.prototype.isDestroyed=function(){return!1};G_.prototype.destroy=function(){return this._specularEnvironmentMapAtlas=this._specularEnvironmentMapAtlas&&this._specularEnvironmentMapAtlas.destroy(),this._removeErrorListener=this._removeErrorListener&&this._removeErrorListener(),ve(this)};let Uw;const qV="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJkYzAzYzE4NS0yZmJiLTQ5NzUtOWJlYS0zNjdkMzc2ODBmZDgiLCJpZCI6MjU5LCJpYXQiOjE3MTQ1NzE1MDN9.tIhlyfC7MHSWrQmoAqkvQdXMbg3igaC2HIbQp1HKCVM",AC={};AC.defaultAccessToken=qV;AC.defaultServer=new Ae({url:"https://api.cesium.com/"});AC.getDefaultTokenCredit=function(e){if(e===qV){if(!c(Uw)){const t=`<b> This application is using Cesium's default ion access token. Please assign <i>Cesium.Ion.defaultAccessToken</i> with an access token from your ion account before making any Cesium API calls. You can sign up for a free ion account at <a href="https://cesium.com">https://cesium.com</a>.</b>`;Uw=new Wt(t,!0)}return Uw}};const Zf=AC;function ar(e,t){A.defined("endpoint",e),A.defined("endpointResource",t);let n;const i=e.externalType,o=c(i);if(!o)n={url:e.url,retryAttempts:1,retryCallback:Lae};else if(i==="3DTILES"||i==="STK_TERRAIN_SERVER")n={url:e.options.url};else throw new Te("Ion.createResource does not support external imagery assets; use IonImageryProvider instead.");Ae.call(this,n),this._ionEndpoint=e,this._ionEndpointDomain=o?void 0:new Ec(e.url).authority(),this._ionEndpointResource=t,this._ionRoot=void 0,this._pendingPromise=void 0,this._credits=void 0,this._isExternal=o}c(Object.create)&&(ar.prototype=Object.create(Ae.prototype),ar.prototype.constructor=ar);ar.fromAssetId=function(e,t){const n=ar._createEndpointResource(e,t);return n.fetchJson().then(function(i){return new ar(i,n)})};Object.defineProperties(ar.prototype,{credits:{get:function(){return c(this._ionRoot)?this._ionRoot.credits:c(this._credits)?this._credits:(this._credits=ar.getCreditsFromEndpoint(this._ionEndpoint,this._ionEndpointResource),this._credits)}}});ar.getCreditsFromEndpoint=function(e,t){const n=e.attributions.map(Wt.getIonCredit),i=Zf.getDefaultTokenCredit(t.queryParameters.access_token);return c(i)&&n.push(Wt.clone(i)),n};ar.prototype.clone=function(e){const t=y(this._ionRoot,this);return c(e)||(e=new ar(t._ionEndpoint,t._ionEndpointResource)),e=Ae.prototype.clone.call(this,e),e._ionRoot=t,e._isExternal=this._isExternal,e};ar.prototype.fetchImage=function(e){if(!this._isExternal){const t=e;e={preferBlob:!0},c(t)&&(e.flipY=t.flipY,e.preferImageBitmap=t.preferImageBitmap)}return Ae.prototype.fetchImage.call(this,e)};ar.prototype._makeRequest=function(e){return this._isExternal||new Ec(this.url).authority()!==this._ionEndpointDomain?Ae.prototype._makeRequest.call(this,e):(c(e.headers)||(e.headers={}),e.headers.Authorization=`Bearer ${this._ionEndpoint.accessToken}`,e.headers["X-Cesium-Client"]="CesiumJS",typeof CESIUM_VERSION<"u"&&(e.headers["X-Cesium-Client-Version"]=CESIUM_VERSION),Ae.prototype._makeRequest.call(this,e))};ar._createEndpointResource=function(e,t){A.defined("assetId",e),t=y(t,y.EMPTY_OBJECT);let n=y(t.server,Zf.defaultServer);const i=y(t.accessToken,Zf.defaultAccessToken);n=Ae.createIfNeeded(n);const o={url:`v1/assets/${e}/endpoint`};return c(i)&&(o.queryParameters={access_token:i}),n.getDerivedResource(o)};function Lae(e,t){const n=y(e._ionRoot,e),i=n._ionEndpointResource,o=typeof Image<"u";return!c(t)||t.statusCode!==401&&!(o&&t.target instanceof Image)?Promise.resolve(!1):(c(n._pendingPromise)||(n._pendingPromise=i.fetchJson().then(function(r){return n._ionEndpoint=r,r}).finally(function(r){return n._pendingPromise=void 0,r})),n._pendingPromise.then(function(r){return e._ionEndpoint=r,!0}))}function jr(e){e=y(e,0),this._array=new Array(e),this._length=e}Object.defineProperties(jr.prototype,{length:{get:function(){return this._length},set:function(e){A.typeOf.number.greaterThanOrEquals("length",e,0);const t=this._array,n=this._length;if(e<n)for(let i=e;i<n;++i)t[i]=void 0;else e>t.length&&(t.length=e);this._length=e}},values:{get:function(){return this._array}}});jr.prototype.get=function(e){return A.typeOf.number.lessThan("index",e,this._array.length),this._array[e]};jr.prototype.set=function(e,t){A.typeOf.number("index",e),e>=this._length&&(this.length=e+1),this._array[e]=t};jr.prototype.peek=function(){return this._array[this._length-1]};jr.prototype.push=function(e){const t=this.length++;this._array[t]=e};jr.prototype.pop=function(){if(this._length===0)return;const e=this._array[this._length-1];return--this.length,e};jr.prototype.reserve=function(e){A.typeOf.number.greaterThanOrEquals("length",e,0),e>this._array.length&&(this._array.length=e)};jr.prototype.resize=function(e){A.typeOf.number.greaterThanOrEquals("length",e,0),this.length=e};jr.prototype.trim=function(e){e=y(e,this._length),this._array.length=e};const fd={X:0,Y:1,Z:2};fd.Y_UP_TO_Z_UP=L.fromRotationTranslation($.fromArray([1,0,0,0,0,1,0,-1,0]));fd.Z_UP_TO_Y_UP=L.fromRotationTranslation($.fromArray([1,0,0,0,0,-1,0,1,0]));fd.X_UP_TO_Z_UP=L.fromRotationTranslation($.fromArray([0,0,1,0,1,0,-1,0,0]));fd.Z_UP_TO_X_UP=L.fromRotationTranslation($.fromArray([0,0,-1,0,1,0,1,0,0]));fd.X_UP_TO_Y_UP=L.fromRotationTranslation($.fromArray([0,1,0,-1,0,0,0,0,1]));fd.Y_UP_TO_X_UP=L.fromRotationTranslation($.fromArray([0,-1,0,1,0,0,0,0,1]));fd.fromName=function(e){return A.typeOf.string("name",e),fd[e]};const Cr=Object.freeze(fd);function rO(e){e=y(e,y.EMPTY_OBJECT),A.typeOf.object("options.metadata",e.metadata),this._metadata=e.metadata}Object.defineProperties(rO.prototype,{metadata:{get:function(){return this._metadata}}});function Ta(e,t,n){if(!c(e))throw new E("uint8Array is required.");if(t<0)throw new E("byteOffset cannot be negative.");if(n<0)throw new E("byteLength cannot be negative.");if(t+n>e.byteLength)throw new E("sub-region exceeds array bounds.");return t=y(t,0),n=y(n,e.byteLength-t),e=e.subarray(t,t+n),Ta.decode(e)}Ta.decodeWithTextDecoder=function(e){return new TextDecoder("utf-8").decode(e)};Ta.decodeWithFromCharCode=function(e){let t="";const n=Rae(e),i=n.length;for(let o=0;o<i;++o){let r=n[o];r<=65535?t+=String.fromCharCode(r):(r-=65536,t+=String.fromCharCode((r>>10)+55296,(r&1023)+56320))}return t};function Dg(e,t,n){return t<=e&&e<=n}function Rae(e){let t=0,n=0,i=0,o=128,r=191;const s=[],a=e.length;for(let l=0;l<a;++l){const u=e[l];if(i===0){if(Dg(u,0,127)){s.push(u);continue}if(Dg(u,194,223)){i=1,t=u&31;continue}if(Dg(u,224,239)){u===224&&(o=160),u===237&&(r=159),i=2,t=u&15;continue}if(Dg(u,240,244)){u===240&&(o=144),u===244&&(r=143),i=3,t=u&7;continue}throw new Te("String decoding failed.")}if(!Dg(u,o,r)){t=i=n=0,o=128,r=191,--l;continue}o=128,r=191,t=t<<6|u&63,++n,n===i&&(s.push(t),t=i=n=0)}return s}typeof TextDecoder<"u"?Ta.decode=Ta.decodeWithTextDecoder:Ta.decode=Ta.decodeWithFromCharCode;function xC(e,t){return t=y(t,0),Ta(e,t,Math.min(4,e.length))}function Ic(e,t,n,i){this._tileset=e,this._tile=t,this._resource=n,c(i)||(i=[]),this._contents=i,this._metadata=void 0,this._group=void 0,this._ready=!1}Object.defineProperties(Ic.prototype,{featurePropertiesDirty:{get:function(){const e=this._contents,t=e.length;for(let n=0;n<t;++n)if(e[n].featurePropertiesDirty)return!0;return!1},set:function(e){const t=this._contents,n=t.length;for(let i=0;i<n;++i)t[i].featurePropertiesDirty=e}},featuresLength:{get:function(){return 0}},pointsLength:{get:function(){return 0}},trianglesLength:{get:function(){return 0}},geometryByteLength:{get:function(){return 0}},texturesByteLength:{get:function(){return 0}},batchTableByteLength:{get:function(){return 0}},innerContents:{get:function(){return this._contents}},ready:{get:function(){return this._ready}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._resource.getUrlComponent(!0)}},metadata:{get:function(){return this._metadata},set:function(e){this._metadata=e;const t=this._contents,n=t.length;for(let i=0;i<n;++i)t[i].metadata=e}},batchTable:{get:function(){}},group:{get:function(){return this._group},set:function(e){this._group=e;const t=this._contents,n=t.length;for(let i=0;i<n;++i)t[i].group=e}}});const Pg=Uint32Array.BYTES_PER_ELEMENT;Ic.fromTileType=async function(e,t,n,i,o,r){o=y(o,0);const s=new Uint8Array(i),a=new DataView(i);o+=Pg;const l=a.getUint32(o,!0);if(l!==1)throw new Te(`Only Composite Tile version 1 is supported. Version ${l} is not.`);o+=Pg,o+=Pg;const u=a.getUint32(o,!0);o+=Pg;let h=n.queryParameters.compositeIndex;c(h)?h=`${h}_`:h="";const f=[];f.length=u;for(let m=0;m<u;++m){const b=xC(s,o),T=a.getUint32(o+Pg*2,!0),x=r[b],C=`${h}${m}`,w=n.getDerivedResource({queryParameters:{compositeIndex:C}});if(c(x))f[m]=Promise.resolve(x(e,t,w,i,o));else throw new Te(`Unknown tile content type, ${b}, inside Composite tile`);o+=T}const _=await Promise.all(f);return new Ic(e,t,n,_)};Ic.prototype.hasProperty=function(e,t){return!1};Ic.prototype.getFeature=function(e){};Ic.prototype.applyDebugSettings=function(e,t){const n=this._contents,i=n.length;for(let o=0;o<i;++o)n[o].applyDebugSettings(e,t)};Ic.prototype.applyStyle=function(e){const t=this._contents,n=t.length;for(let i=0;i<n;++i)t[i].applyStyle(e)};Ic.prototype.update=function(e,t){const n=this._contents,i=n.length;let o=!0;for(let r=0;r<i;++r)n[r].update(e,t),o=o&&n[r].ready;!this._ready&&o&&(this._ready=!0)};Ic.prototype.pick=function(e,t,n){if(!this._ready)return;let i,o=Number.POSITIVE_INFINITY;const r=this._contents,s=r.length;for(let a=0;a<s;++a){const l=r[a].pick(e,t,n);if(!c(l))continue;const u=d.distance(e.origin,l);u<o&&(i=l,o=u)}if(!!c(i))return n};Ic.prototype.isDestroyed=function(){return!1};Ic.prototype.destroy=function(){const e=this._contents,t=e.length;for(let n=0;n<t;++n)e[n].destroy();return ve(this)};function sa(e,t,n){return JSON.parse(Ta(e,t,n))}function Bi(e){A.typeOf.number("options.featuresLength",e.featuresLength),A.typeOf.object("options.owner",e.owner),this._id=Wr();const t=e.featuresLength;this._showAlphaProperties=void 0,this._batchValues=void 0,this._batchValuesDirty=!1,this._batchTexture=void 0,this._defaultTexture=void 0,this._pickTexture=void 0,this._pickIds=[];let n,i;if(t>0){const o=Math.min(t,pt.maximumTextureSize),r=Math.ceil(t/pt.maximumTextureSize),s=1/o,a=s*.5,l=1/r,u=l*.5;n=new H(o,r),i=new te(s,a,l,u)}this._translucentFeaturesLength=0,this._featuresLength=t,this._textureDimensions=n,this._textureStep=i,this._owner=e.owner,this._statistics=e.statistics,this._colorChangedCallback=e.colorChangedCallback}Object.defineProperties(Bi.prototype,{translucentFeaturesLength:{get:function(){return this._translucentFeaturesLength}},byteLength:{get:function(){let e=0;return c(this._pickTexture)&&(e+=this._pickTexture.sizeInBytes),c(this._batchTexture)&&(e+=this._batchTexture.sizeInBytes),e}},textureDimensions:{get:function(){return this._textureDimensions}},textureStep:{get:function(){return this._textureStep}},batchTexture:{get:function(){return this._batchTexture}},defaultTexture:{get:function(){return this._defaultTexture}},pickTexture:{get:function(){return this._pickTexture}}});Bi.DEFAULT_COLOR_VALUE=z.WHITE;Bi.DEFAULT_SHOW_VALUE=!0;function YV(e){const t=e._textureDimensions;return t.x*t.y*4}function $V(e){if(!c(e._batchValues)){const t=YV(e),n=new Uint8Array(t).fill(255);e._batchValues=n}return e._batchValues}function XV(e){if(!c(e._showAlphaProperties)){const t=2*e._featuresLength,n=new Uint8Array(t).fill(255);e._showAlphaProperties=n}return e._showAlphaProperties}function F0(e,t){if(!c(e)||e<0||e>=t)throw new E(`batchId is required and between zero and featuresLength - 1 (${t}`-+").")}Bi.prototype.setShow=function(e,t){if(F0(e,this._featuresLength),A.typeOf.bool("show",t),t&&!c(this._showAlphaProperties))return;const n=XV(this),i=e*2,o=t?255:0;if(n[i]!==o){n[i]=o;const r=$V(this),s=e*4+3;r[s]=t?n[i+1]:0,this._batchValuesDirty=!0}};Bi.prototype.setAllShow=function(e){A.typeOf.bool("show",e);const t=this._featuresLength;for(let n=0;n<t;++n)this.setShow(n,e)};Bi.prototype.getShow=function(e){if(F0(e,this._featuresLength),!c(this._showAlphaProperties))return!0;const t=e*2;return this._showAlphaProperties[t]===255};const Nae=new Array(4);Bi.prototype.setColor=function(e,t){if(F0(e,this._featuresLength),A.typeOf.object("color",t),z.equals(t,Bi.DEFAULT_COLOR_VALUE)&&!c(this._batchValues))return;const n=t.toBytes(Nae),i=n[3],o=$V(this),r=e*4,s=XV(this),a=e*2;if(o[r]!==n[0]||o[r+1]!==n[1]||o[r+2]!==n[2]||s[a+1]!==i){o[r]=n[0],o[r+1]=n[1],o[r+2]=n[2];const l=s[a+1]!==255,u=s[a]!==0;o[r+3]=u?i:0,s[a+1]=i;const h=i!==255;h&&!l?++this._translucentFeaturesLength:!h&&l&&--this._translucentFeaturesLength,this._batchValuesDirty=!0,c(this._colorChangedCallback)&&this._colorChangedCallback(e,t)}};Bi.prototype.setAllColor=function(e){A.typeOf.object("color",e);const t=this._featuresLength;for(let n=0;n<t;++n)this.setColor(n,e)};Bi.prototype.getColor=function(e,t){if(F0(e,this._featuresLength),A.typeOf.object("result",t),!c(this._batchValues))return z.clone(Bi.DEFAULT_COLOR_VALUE,t);const n=this._batchValues,i=e*4,o=this._showAlphaProperties,r=e*2;return z.fromBytes(n[i],n[i+1],n[i+2],o[r+1],t)};Bi.prototype.getPickColor=function(e){return F0(e,this._featuresLength),this._pickIds[e]};function QV(e,t,n){const i=e._textureDimensions;return new xt({context:t,pixelFormat:Ve.RGBA,pixelDatatype:Me.UNSIGNED_BYTE,source:{width:i.x,height:i.y,arrayBufferView:n},flipY:!1,sampler:un.NEAREST})}function Mae(e,t){const n=e._featuresLength;if(!c(e._pickTexture)&&n>0){const i=e._pickIds,o=YV(e),r=new Uint8Array(o),s=e._owner,a=e._statistics;for(let l=0;l<n;++l){const u=t.createPickId(s.getFeature(l));i.push(u);const h=u.color,f=l*4;r[f]=z.floatToByte(h.red),r[f+1]=z.floatToByte(h.green),r[f+2]=z.floatToByte(h.blue),r[f+3]=z.floatToByte(h.alpha)}e._pickTexture=QV(e,t,r),c(a)&&(a.batchTableByteLength+=e._pickTexture.sizeInBytes)}}function Fae(e){const t=e._textureDimensions;e._batchTexture.copyFrom({source:{width:t.x,height:t.y,arrayBufferView:e._batchValues}})}Bi.prototype.update=function(e,t){const n=t.context;this._defaultTexture=n.defaultTexture;const i=t.passes;(i.pick||i.postProcess)&&Mae(this,n),this._batchValuesDirty&&(this._batchValuesDirty=!1,c(this._batchTexture)||(this._batchTexture=QV(this,n,this._batchValues),c(this._statistics)&&(this._statistics.batchTableByteLength+=this._batchTexture.sizeInBytes)),Fae(this))};Bi.prototype.isDestroyed=function(){return!1};Bi.prototype.destroy=function(){this._batchTexture=this._batchTexture&&this._batchTexture.destroy(),this._pickTexture=this._pickTexture&&this._pickTexture.destroy();const e=this._pickIds,t=e.length;for(let n=0;n<t;++n)e[n].destroy();return ve(this)};const Bae={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},zae={SCALAR:void 0,VEC2:H,VEC3:d,VEC4:te,MAT2:Xe,MAT3:$,MAT4:L};function Jf(e){const t=e.componentType;let n;typeof t=="string"?n=Z.fromName(t):n=t;const i=Bae[e.type],o=zae[e.type];return{componentsPerAttribute:i,classType:o,createArrayBufferView:function(r,s,a){return Z.createArrayBufferView(n,r,s,i*a)}}}function du(e){this._classes=void 0,this._classIds=void 0,this._classIndexes=void 0,this._parentCounts=void 0,this._parentIndexes=void 0,this._parentIds=void 0,this._byteLength=0,A.typeOf.object("options.extension",e.extension),Uae(this,e.extension,e.binaryBody),Gae(this)}Object.defineProperties(du.prototype,{byteLength:{get:function(){return this._byteLength}}});function Uae(e,t,n){let i,o,r;const s=t.instancesLength,a=t.classes;let l=t.classIds,u=t.parentCounts,h=t.parentIds,f=s,_=0;c(l.byteOffset)&&(l.componentType=y(l.componentType,Z.UNSIGNED_SHORT),l.type=qt.SCALAR,r=Jf(l),l=r.createArrayBufferView(n.buffer,n.byteOffset+l.byteOffset,s),_+=l.byteLength);let g;if(c(u)){for(c(u.byteOffset)&&(u.componentType=y(u.componentType,Z.UNSIGNED_SHORT),u.type=qt.SCALAR,r=Jf(u),u=r.createArrayBufferView(n.buffer,n.byteOffset+u.byteOffset,s),_+=u.byteLength),g=new Uint16Array(s),f=0,i=0;i<s;++i)g[i]=f,f+=u[i];_+=g.byteLength}c(h)&&c(h.byteOffset)&&(h.componentType=y(h.componentType,Z.UNSIGNED_SHORT),h.type=qt.SCALAR,r=Jf(h),h=r.createArrayBufferView(n.buffer,n.byteOffset+h.byteOffset,f),_+=h.byteLength);const m=a.length;for(i=0;i<m;++i){const x=a[i].length,C=a[i].instances,w=kae(x,C,n);_+=Vae(w),a[i].instances=jt(w,C)}const b=new Array(m).fill(0),T=new Uint16Array(s);for(i=0;i<s;++i)o=l[i],T[i]=b[o],++b[o];_+=T.byteLength,e._classes=a,e._classIds=l,e._classIndexes=T,e._parentCounts=u,e._parentIndexes=g,e._parentIds=h,e._byteLength=_}function kae(e,t,n){let i;for(const o in t)if(t.hasOwnProperty(o)){const r=t[o],s=r.byteOffset;if(c(s)){const a=r.componentType,l=r.type;if(!c(a))throw new Te("componentType is required.");if(!c(l))throw new Te("type is required.");if(!c(n))throw new Te(`Property ${o} requires a batch table binary.`);const u=Jf(r),h=u.componentsPerAttribute,f=u.classType,_=u.createArrayBufferView(n.buffer,n.byteOffset+s,e);c(i)||(i={}),i[o]={typedArray:_,componentCount:h,type:f}}}return i}function Vae(e){let t=0;for(const n in e)e.hasOwnProperty(n)&&(t+=e[n].typedArray.byteLength);return t}const Hae=[];function Gae(e){const t=Hae;t.length=0;const i=e._classIds.length;for(let o=0;o<i;++o)KV(e,o,t)}function KV(e,t,n){const i=e._parentCounts,o=e._parentIds,r=e._parentIndexes,a=e._classIds.length;if(!c(o))return;if(t>=a)throw new E(`Parent index ${t} exceeds the total number of instances: ${a}`);if(n.indexOf(t)>-1)throw new E("Circular dependency detected in the batch table hierarchy.");n.push(t);const l=c(i)?i[t]:1,u=c(i)?r[t]:t;for(let h=0;h<l;++h){const f=o[u+h];f!==t&&KV(e,f,n)}n.pop(t)}const jae=[],Wae=[];let qae=0;function Yae(e,t,n){const i=e._classIds,o=e._parentCounts,r=e._parentIds,s=e._parentIndexes,a=i.length,l=jae;l.length=Math.max(l.length,a);const u=++qae,h=Wae;for(h.length=0,h.push(t);h.length>0;){if(t=h.pop(),l[t]===u)continue;l[t]=u;const f=n(e,t);if(c(f))return f;const _=o[t],g=s[t];for(let m=0;m<_;++m){const b=r[g+m];b!==t&&h.push(b)}}}function $ae(e,t,n){let i=!0;for(;i;){const o=n(e,t);if(c(o))return o;const r=e._parentIds[t];i=r!==t,t=r}}function B0(e,t,n){const i=e._parentCounts,o=e._parentIds;if(c(o)){if(c(i))return Yae(e,t,n)}else return n(e,t);return $ae(e,t,n)}du.prototype.hasProperty=function(e,t){const n=B0(this,e,function(i,o){const r=i._classIds[o],s=i._classes[r].instances;if(c(s[t]))return!0});return c(n)};du.prototype.propertyExists=function(e){const t=this._classes,n=t.length;for(let i=0;i<n;++i){const o=t[i].instances;if(c(o[e]))return!0}return!1};du.prototype.getPropertyIds=function(e,t){return t=c(t)?t:[],t.length=0,B0(this,e,function(n,i){const o=n._classIds[i],r=n._classes[o].instances;for(const s in r)r.hasOwnProperty(s)&&t.indexOf(s)===-1&&t.push(s)}),t};du.prototype.getProperty=function(e,t){return B0(this,e,function(n,i){const o=n._classIds[i],r=n._classes[o],s=n._classIndexes[i],a=r.instances[t];if(c(a))return c(a.typedArray)?Xae(a,s):Je(a[s],!0)})};function Xae(e,t){const n=e.typedArray,i=e.componentCount;return i===1?n[t]:e.type.unpack(n,t*i)}du.prototype.setProperty=function(e,t,n){const i=B0(this,e,function(o,r){const s=o._classIds[r],a=o._classes[s],l=o._classIndexes[r],u=a.instances[t];if(c(u)){if(r!==e)throw new E(`Inherited property "${t}" is read-only.`);return c(u.typedArray)?Qae(u,l,n):u[l]=Je(n,!0),!0}});return c(i)};function Qae(e,t,n){const i=e.typedArray,o=e.componentCount;o===1?i[t]=n:e.type.pack(n,i,t*o)}du.prototype.isClass=function(e,t){const n=B0(this,e,function(i,o){const r=i._classIds[o];if(i._classes[r].name===t)return!0});return c(n)};du.prototype.getClassName=function(e){const t=this._classIds[e];return this._classes[t].name};const Kae={HIGHLIGHT:0,REPLACE:1,MIX:2},HA=Object.freeze(Kae),kw=Bi.DEFAULT_COLOR_VALUE,Vw=Bi.DEFAULT_SHOW_VALUE;function Hn(e,t,n,i,o){this.featuresLength=t;let r;c(n)&&(r=n.extensions),this._extensions=y(r,{});const s=Zae(n);this._properties=s,this._batchTableHierarchy=Jae(this,n,i);const a=ZV(t,s,i);this._binaryPropertiesByteLength=ece(a),this._batchTableBinaryProperties=a,this._content=e,this._batchTexture=new Bi({featuresLength:t,colorChangedCallback:o,owner:e,statistics:e.tileset.statistics})}Hn._deprecationWarning=Xh;Object.defineProperties(Hn.prototype,{batchTableByteLength:{get:function(){let e=this._binaryPropertiesByteLength;return c(this._batchTableHierarchy)&&(e+=this._batchTableHierarchy.byteLength),e+=this._batchTexture.byteLength,e}}});function Zae(e){const t={};if(!c(e))return t;for(const n in e)e.hasOwnProperty(n)&&n!=="HIERARCHY"&&n!=="extensions"&&n!=="extras"&&(t[n]=Je(e[n],!0));return t}function Jae(e,t,n){if(!c(t))return;let i=e._extensions["3DTILES_batch_table_hierarchy"];const o=t.HIERARCHY;if(c(o)&&(Hn._deprecationWarning("batchTableHierarchyExtension","The batch table HIERARCHY property has been moved to an extension. Use extensions.3DTILES_batch_table_hierarchy instead."),e._extensions["3DTILES_batch_table_hierarchy"]=o,i=o),!!c(i))return new du({extension:i,binaryBody:n})}function ZV(e,t,n){let i;for(const o in t)if(t.hasOwnProperty(o)){const r=t[o],s=r.byteOffset;if(c(s)){const a=r.componentType,l=r.type;if(!c(a))throw new Te("componentType is required.");if(!c(l))throw new Te("type is required.");if(!c(n))throw new Te(`Property ${o} requires a batch table binary.`);const u=Jf(r),h=u.componentsPerAttribute,f=u.classType,_=u.createArrayBufferView(n.buffer,n.byteOffset+s,e);c(i)||(i={}),i[o]={typedArray:_,componentCount:h,type:f}}}return i}function ece(e){if(!c(e))return 0;let t=0;for(const n in e)e.hasOwnProperty(n)&&(t+=e[n].typedArray.byteLength);return t}Hn.getBinaryProperties=function(e,t,n){return ZV(e,t,n)};Hn.prototype.setShow=function(e,t){this._batchTexture.setShow(e,t)};Hn.prototype.setAllShow=function(e){this._batchTexture.setAllShow(e)};Hn.prototype.getShow=function(e){return this._batchTexture.getShow(e)};Hn.prototype.setColor=function(e,t){this._batchTexture.setColor(e,t)};Hn.prototype.setAllColor=function(e){this._batchTexture.setAllColor(e)};Hn.prototype.getColor=function(e,t){return this._batchTexture.getColor(e,t)};Hn.prototype.getPickColor=function(e){return this._batchTexture.getPickColor(e)};const tce=new z;Hn.prototype.applyStyle=function(e){if(!c(e)){this.setAllColor(kw),this.setAllShow(Vw);return}const t=this._content,n=this.featuresLength;for(let i=0;i<n;++i){const o=t.getFeature(i),r=c(e.color)?y(e.color.evaluateColor(o,tce),kw):kw,s=c(e.show)?y(e.show.evaluate(o),Vw):Vw;this.setColor(i,r),this.setShow(i,s)}};function nce(e,t){const n=e.typedArray,i=e.componentCount;return i===1?n[t]:e.type.unpack(n,t*i)}function ice(e,t,n){const i=e.typedArray,o=e.componentCount;o===1?i[t]=n:e.type.pack(n,i,t*o)}function j_(e,t){if(!c(e)||e<0||e>=t)throw new E(`batchId is required and must be between zero and featuresLength - 1 (${t}`-+").")}Hn.prototype.isClass=function(e,t){j_(e,this.featuresLength),A.typeOf.string("className",t);const n=this._batchTableHierarchy;return c(n)?n.isClass(e,t):!1};Hn.prototype.isExactClass=function(e,t){return A.typeOf.string("className",t),this.getExactClassName(e)===t};Hn.prototype.getExactClassName=function(e){j_(e,this.featuresLength);const t=this._batchTableHierarchy;if(!!c(t))return t.getClassName(e)};Hn.prototype.hasProperty=function(e,t){return j_(e,this.featuresLength),A.typeOf.string("name",t),c(this._properties[t])||c(this._batchTableHierarchy)&&this._batchTableHierarchy.hasProperty(e,t)};Hn.prototype.hasPropertyBySemantic=function(){return!1};Hn.prototype.getPropertyIds=function(e,t){j_(e,this.featuresLength),t=c(t)?t:[],t.length=0;const n=Object.keys(this._properties);return t.push.apply(t,n),c(this._batchTableHierarchy)&&t.push.apply(t,this._batchTableHierarchy.getPropertyIds(e,n)),t};Hn.prototype.getPropertyBySemantic=function(e,t){};Hn.prototype.getProperty=function(e,t){if(j_(e,this.featuresLength),A.typeOf.string("name",t),c(this._batchTableBinaryProperties)){const i=this._batchTableBinaryProperties[t];if(c(i))return nce(i,e)}const n=this._properties[t];if(c(n))return Je(n[e],!0);if(c(this._batchTableHierarchy)){const i=this._batchTableHierarchy.getProperty(e,t);if(c(i))return i}};Hn.prototype.setProperty=function(e,t,n){const i=this.featuresLength;if(j_(e,i),A.typeOf.string("name",t),c(this._batchTableBinaryProperties)){const r=this._batchTableBinaryProperties[t];if(c(r)){ice(r,e,n);return}}if(c(this._batchTableHierarchy)&&this._batchTableHierarchy.setProperty(e,t,n))return;let o=this._properties[t];c(o)||(this._properties[t]=new Array(i),o=this._properties[t]),o[e]=Je(n,!0)};function oce(e){return e._batchTexture.textureDimensions.y===1?`uniform vec4 tile_textureStep;
|
|
vec2 computeSt(float batchId)
|
|
{
|
|
float stepX = tile_textureStep.x;
|
|
float centerX = tile_textureStep.y;
|
|
return vec2(centerX + (batchId * stepX), 0.5);
|
|
}
|
|
`:`uniform vec4 tile_textureStep;
|
|
uniform vec2 tile_textureDimensions;
|
|
vec2 computeSt(float batchId)
|
|
{
|
|
float stepX = tile_textureStep.x;
|
|
float centerX = tile_textureStep.y;
|
|
float stepY = tile_textureStep.z;
|
|
float centerY = tile_textureStep.w;
|
|
float xId = mod(batchId, tile_textureDimensions.x);
|
|
float yId = floor(batchId / tile_textureDimensions.x);
|
|
return vec2(centerX + (xId * stepX), centerY + (yId * stepY));
|
|
}
|
|
`}Hn.prototype.getVertexShaderCallback=function(e,t,n){if(this.featuresLength===0)return;const i=this;return function(o){const r=JV(o,n,!1);let s;return pt.maximumVertexTextureImageUnits>0?(s="",e&&(s+=`uniform bool tile_translucentCommand;
|
|
`),s+=`uniform sampler2D tile_batchTexture;
|
|
out vec4 tile_featureColor;
|
|
out vec2 tile_featureSt;
|
|
void main()
|
|
{
|
|
vec2 st = computeSt(${t});
|
|
vec4 featureProperties = texture(tile_batchTexture, st);
|
|
tile_color(featureProperties);
|
|
float show = ceil(featureProperties.a);
|
|
gl_Position *= show;
|
|
`,e&&(s+=` bool isStyleTranslucent = (featureProperties.a != 1.0);
|
|
if (czm_pass == czm_passTranslucent)
|
|
{
|
|
if (!isStyleTranslucent && !tile_translucentCommand)
|
|
{
|
|
gl_Position *= 0.0;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (isStyleTranslucent)
|
|
{
|
|
gl_Position *= 0.0;
|
|
}
|
|
}
|
|
`),s+=` tile_featureColor = featureProperties;
|
|
tile_featureSt = st;
|
|
}`):s=`out vec2 tile_featureSt;
|
|
void main()
|
|
{
|
|
tile_color(vec4(1.0));
|
|
tile_featureSt = computeSt(${t});
|
|
}`,`${r}
|
|
${oce(i)}${s}`}};function dM(e,t){return e=Oe.replaceMain(e,"tile_main"),t?`${e}uniform float tile_colorBlend;
|
|
void tile_color(vec4 tile_featureColor)
|
|
{
|
|
tile_main();
|
|
tile_featureColor = czm_gammaCorrect(tile_featureColor);
|
|
out_FragColor.a *= tile_featureColor.a;
|
|
float highlight = ceil(tile_colorBlend);
|
|
out_FragColor.rgb *= mix(tile_featureColor.rgb, vec3(1.0), highlight);
|
|
}
|
|
`:`${e}void tile_color(vec4 tile_featureColor)
|
|
{
|
|
tile_main();
|
|
}
|
|
`}function rce(e,t){const n=`texture(${t}`;let i=0,o=e.indexOf(n,i),r;for(;o>-1;){let s=0;for(let u=o;u<e.length;++u){const h=e.charAt(u);if(h==="(")++s;else if(h===")"&&(--s,s===0)){r=u+1;break}}const l=`tile_diffuse_final(${e.slice(o,r)}, tile_diffuse)`;e=e.slice(0,o)+l+e.slice(r),i=o+l.length,o=e.indexOf(n,i)}return e}function JV(e,t,n){if(!c(t))return dM(e,n);let i=new RegExp(`(uniform|attribute|in)\\s+(vec[34]|sampler2D)\\s+${t};`);const o=e.match(i);if(!c(o))return dM(e,n);const r=o[0],s=o[2];e=Oe.replaceMain(e,"tile_main"),e=e.replace(r,"");const a=`bool isWhite(vec3 color)
|
|
{
|
|
return all(greaterThan(color, vec3(1.0 - czm_epsilon3)));
|
|
}
|
|
vec4 tile_diffuse_final(vec4 sourceDiffuse, vec4 tileDiffuse)
|
|
{
|
|
vec4 blendDiffuse = mix(sourceDiffuse, tileDiffuse, tile_colorBlend);
|
|
vec4 diffuse = isWhite(tileDiffuse.rgb) ? sourceDiffuse : blendDiffuse;
|
|
return vec4(diffuse.rgb, sourceDiffuse.a);
|
|
}
|
|
`,l=` tile_featureColor = czm_gammaCorrect(tile_featureColor);
|
|
out_FragColor.a *= tile_featureColor.a;
|
|
float highlight = ceil(tile_colorBlend);
|
|
out_FragColor.rgb *= mix(tile_featureColor.rgb, vec3(1.0), highlight);
|
|
`;let u;if(s==="vec3"||s==="vec4"){const h=s==="vec3"?`vec4(${t}, 1.0)`:t,f=s==="vec3"?"tile_diffuse.xyz":"tile_diffuse";i=new RegExp(t,"g"),e=e.replace(i,f),u=` vec4 source = ${h};
|
|
tile_diffuse = tile_diffuse_final(source, tile_featureColor);
|
|
tile_main();
|
|
`}else s==="sampler2D"&&(e=rce(e,t),u=` tile_diffuse = tile_featureColor;
|
|
tile_main();
|
|
`);return e=`uniform float tile_colorBlend;
|
|
vec4 tile_diffuse = vec4(1.0);
|
|
${a}${r}
|
|
${e}
|
|
void tile_color(vec4 tile_featureColor)
|
|
{
|
|
${u}`,n&&(e+=l),e+=`}
|
|
`,e}Hn.prototype.getFragmentShaderCallback=function(e,t,n){if(this.featuresLength!==0)return function(i){return i=JV(i,t,!0),pt.maximumVertexTextureImageUnits>0?(i+=`uniform sampler2D tile_pickTexture;
|
|
in vec2 tile_featureSt;
|
|
in vec4 tile_featureColor;
|
|
void main()
|
|
{
|
|
tile_color(tile_featureColor);
|
|
`,n&&(i+=` out_FragColor.rgb *= out_FragColor.a;
|
|
`),i+="}"):(e&&(i+=`uniform bool tile_translucentCommand;
|
|
`),i+=`uniform sampler2D tile_pickTexture;
|
|
uniform sampler2D tile_batchTexture;
|
|
in vec2 tile_featureSt;
|
|
void main()
|
|
{
|
|
vec4 featureProperties = texture(tile_batchTexture, tile_featureSt);
|
|
if (featureProperties.a == 0.0) {
|
|
discard;
|
|
}
|
|
`,e&&(i+=` bool isStyleTranslucent = (featureProperties.a != 1.0);
|
|
if (czm_pass == czm_passTranslucent)
|
|
{
|
|
if (!isStyleTranslucent && !tile_translucentCommand)
|
|
{
|
|
discard;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (isStyleTranslucent)
|
|
{
|
|
discard;
|
|
}
|
|
}
|
|
`),i+=` tile_color(featureProperties);
|
|
`,n&&(i+=` out_FragColor.rgb *= out_FragColor.a;
|
|
`),i+=`}
|
|
`),i}};Hn.prototype.getClassificationFragmentShaderCallback=function(){if(this.featuresLength!==0)return function(e){return e=Oe.replaceMain(e,"tile_main"),pt.maximumVertexTextureImageUnits>0?e+=`uniform sampler2D tile_pickTexture;
|
|
in vec2 tile_featureSt;
|
|
in vec4 tile_featureColor;
|
|
void main()
|
|
{
|
|
tile_main();
|
|
out_FragColor = tile_featureColor;
|
|
out_FragColor.rgb *= out_FragColor.a;
|
|
}`:e+=`uniform sampler2D tile_batchTexture;
|
|
uniform sampler2D tile_pickTexture;
|
|
in vec2 tile_featureSt;
|
|
void main()
|
|
{
|
|
tile_main();
|
|
vec4 featureProperties = texture(tile_batchTexture, tile_featureSt);
|
|
if (featureProperties.a == 0.0) {
|
|
discard;
|
|
}
|
|
out_FragColor = featureProperties;
|
|
out_FragColor.rgb *= out_FragColor.a;
|
|
}
|
|
`,e}};function sce(e){const t=e._content.tileset,n=t.colorBlendMode,i=t.colorBlendAmount;if(n===HA.HIGHLIGHT)return 0;if(n===HA.REPLACE)return 1;if(n===HA.MIX)return R.clamp(i,R.EPSILON4,1);throw new E(`Invalid color blend mode "${n}".`)}Hn.prototype.getUniformMapCallback=function(){if(this.featuresLength===0)return;const e=this;return function(t){return jt(t,{tile_batchTexture:function(){return y(e._batchTexture.batchTexture,e._batchTexture.defaultTexture)},tile_textureDimensions:function(){return e._batchTexture.textureDimensions},tile_textureStep:function(){return e._batchTexture.textureStep},tile_colorBlend:function(){return sce(e)},tile_pickTexture:function(){return e._batchTexture.pickTexture}})}};Hn.prototype.getPickId=function(){return"texture(tile_pickTexture, tile_featureSt)"};const sh={ALL_OPAQUE:0,ALL_TRANSLUCENT:1,OPAQUE_AND_TRANSLUCENT:2};Hn.prototype.addDerivedCommands=function(e,t){const n=e.commandList,i=n.length,o=this._content._tile,r=o._finalResolution,s=o.tileset,a=s.isSkippingLevelOfDetail&&s.hasMixedContent&&e.context.stencilBuffer,l=ace(this);for(let u=t;u<i;++u){const h=n[u];if(h.pass===xe.COMPUTE)continue;let f=h.derivedCommands.tileset;(!c(f)||h.dirty)&&(f={},h.derivedCommands.tileset=f,f.originalCommand=cce(h),h.dirty=!1);const _=f.originalCommand;l!==sh.ALL_OPAQUE&&h.pass!==xe.TRANSLUCENT&&(c(f.translucent)||(f.translucent=lce(_))),l!==sh.ALL_TRANSLUCENT&&h.pass!==xe.TRANSLUCENT&&(c(f.opaque)||(f.opaque=uce(_)),a&&(r||(c(f.zback)||(f.zback=hce(e.context,_)),s._backfaceCommands.push(f.zback)),(!c(f.stencil)||o._selectionDepth!==pce(f.stencil))&&(h.renderState.depthMask?f.stencil=fce(_,o._selectionDepth):f.stencil=f.opaque)));const g=a?f.stencil:f.opaque,m=f.translucent;h.pass!==xe.TRANSLUCENT?(l===sh.ALL_OPAQUE&&(n[u]=g),l===sh.ALL_TRANSLUCENT&&(n[u]=m),l===sh.OPAQUE_AND_TRANSLUCENT&&(n[u]=g,n.push(m))):n[u]=_}};function ace(e){const t=e._batchTexture.translucentFeaturesLength;return t===0?sh.ALL_OPAQUE:t===e.featuresLength?sh.ALL_TRANSLUCENT:sh.OPAQUE_AND_TRANSLUCENT}function cce(e){const t=Ze.shallowClone(e),n=t.pass===xe.TRANSLUCENT;return t.uniformMap=c(t.uniformMap)?t.uniformMap:{},t.uniformMap.tile_translucentCommand=function(){return n},t}function lce(e){const t=Ze.shallowClone(e);return t.pass=xe.TRANSLUCENT,t.renderState=mce(e.renderState),t}function uce(e){const t=Ze.shallowClone(e);return t.renderState=_ce(e.renderState),t}function dce(e,t){let n=e.shaderCache.getDerivedShaderProgram(t,"zBackfaceLogDepth");if(!c(n)){const i=t.fragmentShaderSource.clone();i.defines=c(i.defines)?i.defines.slice(0):[],i.defines.push("POLYGON_OFFSET"),n=e.shaderCache.createDerivedShaderProgram(t,"zBackfaceLogDepth",{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:i,attributeLocations:t._attributeLocations})}return n}function hce(e,t){const n=Ze.shallowClone(t),i=Je(n.renderState,!0);i.cull.enabled=!0,i.cull.face=Qi.FRONT,i.colorMask={red:!1,green:!1,blue:!1,alpha:!1},i.polygonOffset={enabled:!0,factor:5,units:5},i.stencilTest=At.setCesium3DTileBit(),i.stencilMask=At.CESIUM_3D_TILE_MASK,n.renderState=Ue.fromCache(i),n.castShadows=!1,n.receiveShadows=!1,n.uniformMap=Je(t.uniformMap);const o=new H(5,5);return n.uniformMap.u_polygonOffset=function(){return o},n.shaderProgram=dce(e,t.shaderProgram),n}function fce(e,t){const n=Ze.shallowClone(e),i=Je(n.renderState,!0);return i.stencilTest.enabled=!0,i.stencilTest.mask=At.SKIP_LOD_MASK,i.stencilTest.reference=At.CESIUM_3D_TILE_MASK|t<<At.SKIP_LOD_BIT_SHIFT,i.stencilTest.frontFunction=Pn.GREATER_OR_EQUAL,i.stencilTest.frontOperation.zPass=nt.REPLACE,i.stencilTest.backFunction=Pn.GREATER_OR_EQUAL,i.stencilTest.backOperation.zPass=nt.REPLACE,i.stencilMask=At.CESIUM_3D_TILE_MASK|At.SKIP_LOD_MASK,n.renderState=Ue.fromCache(i),n}function pce(e){return(e.renderState.stencilTest.reference&At.SKIP_LOD_MASK)>>>At.SKIP_LOD_BIT_SHIFT}function mce(e){const t=Je(e,!0);return t.cull.enabled=!1,t.depthTest.enabled=!0,t.depthMask=!1,t.blending=Zn.ALPHA_BLEND,t.stencilTest=At.setCesium3DTileBit(),t.stencilMask=At.CESIUM_3D_TILE_MASK,Ue.fromCache(t)}function _ce(e){const t=Je(e,!0);return t.stencilTest=At.setCesium3DTileBit(),t.stencilMask=At.CESIUM_3D_TILE_MASK,Ue.fromCache(t)}Hn.prototype.update=function(e,t){this._batchTexture.update(e,t)};Hn.prototype.isDestroyed=function(){return!1};Hn.prototype.destroy=function(){return this._batchTexture=this._batchTexture&&this._batchTexture.destroy(),ve(this)};function Px(e){this.offset=e.offset,this.count=e.count,this.color=e.color,this.batchIds=e.batchIds}const hM=`in vec3 position;
|
|
in float a_batchId;
|
|
|
|
uniform mat4 u_modifiedModelViewProjection;
|
|
|
|
void main()
|
|
{
|
|
gl_Position = czm_depthClamp(u_modifiedModelViewProjection * vec4(position, 1.0));
|
|
}
|
|
`;function Ir(e,t){this._content=e,this._batchId=t,this._color=void 0}Object.defineProperties(Ir.prototype,{show:{get:function(){return this._content.batchTable.getShow(this._batchId)},set:function(e){this._content.batchTable.setShow(this._batchId,e)}},color:{get:function(){return c(this._color)||(this._color=new z),this._content.batchTable.getColor(this._batchId,this._color)},set:function(e){this._content.batchTable.setColor(this._batchId,e)}},polylinePositions:{get:function(){if(!!c(this._content.getPolylinePositions))return this._content.getPolylinePositions(this._batchId)}},content:{get:function(){return this._content}},tileset:{get:function(){return this._content.tileset}},primitive:{get:function(){return this._content.tileset}},featureId:{get:function(){return this._batchId}},pickId:{get:function(){return this._content.batchTable.getPickColor(this._batchId)}}});Ir.prototype.hasProperty=function(e){return this._content.batchTable.hasProperty(this._batchId,e)};Ir.prototype.getPropertyIds=function(e){return this._content.batchTable.getPropertyIds(this._batchId,e)};Ir.prototype.getProperty=function(e){return this._content.batchTable.getProperty(this._batchId,e)};Ir.getPropertyInherited=function(e,t,n){const i=e.batchTable;if(c(i)){if(i.hasPropertyBySemantic(t,n))return i.getPropertyBySemantic(t,n);if(i.hasProperty(t,n))return i.getProperty(t,n)}const o=e.metadata;if(c(o)){if(o.hasPropertyBySemantic(n))return o.getPropertyBySemantic(n);if(o.hasProperty(n))return o.getProperty(n)}const r=e.tile,s=r.metadata;if(c(s)){if(s.hasPropertyBySemantic(n))return s.getPropertyBySemantic(n);if(s.hasProperty(n))return s.getProperty(n)}let a;if(c(r.implicitSubtree)&&(a=r.implicitSubtree.metadata),c(a)){if(a.hasPropertyBySemantic(n))return a.getPropertyBySemantic(n);if(a.hasProperty(n))return a.getProperty(n)}const l=c(e.group)?e.group.metadata:void 0;if(c(l)){if(l.hasPropertyBySemantic(n))return l.getPropertyBySemantic(n);if(l.hasProperty(n))return l.getProperty(n)}const u=e.tileset.metadata;if(c(u)){if(u.hasPropertyBySemantic(n))return u.getPropertyBySemantic(n);if(u.hasProperty(n))return u.getProperty(n)}};Ir.prototype.getPropertyInherited=function(e){return Ir.getPropertyInherited(this._content,this._batchId,e)};Ir.prototype.setProperty=function(e,t){this._content.batchTable.setProperty(this._batchId,e,t),this._content.featurePropertiesDirty=!0};Ir.prototype.isExactClass=function(e){return this._content.batchTable.isExactClass(this._batchId,e)};Ir.prototype.isClass=function(e){return this._content.batchTable.isClass(this._batchId,e)};Ir.prototype.getExactClassName=function(){return this._content.batchTable.getExactClassName(this._batchId)};class gce{add(t,n,i){if(typeof arguments[0]!="string")for(let o in arguments[0])this.add(o,arguments[0][o],arguments[1]);else(Array.isArray(t)?t:[t]).forEach(function(o){this[o]=this[o]||[],n&&this[o][i?"unshift":"push"](n)},this)}run(t,n){this[t]=this[t]||[],this[t].forEach(function(i){i.call(n&&n.context?n.context:n,n)})}}class yce{constructor(t){this.jsep=t,this.registered={}}register(...t){t.forEach(n=>{if(typeof n!="object"||!n.name||!n.init)throw new Error("Invalid JSEP plugin format");this.registered[n.name]||(n.init(this.jsep),this.registered[n.name]=n)})}}class De{static get version(){return"1.3.8"}static toString(){return"JavaScript Expression Parser (JSEP) v"+De.version}static addUnaryOp(t){return De.max_unop_len=Math.max(t.length,De.max_unop_len),De.unary_ops[t]=1,De}static addBinaryOp(t,n,i){return De.max_binop_len=Math.max(t.length,De.max_binop_len),De.binary_ops[t]=n,i?De.right_associative.add(t):De.right_associative.delete(t),De}static addIdentifierChar(t){return De.additional_identifier_chars.add(t),De}static addLiteral(t,n){return De.literals[t]=n,De}static removeUnaryOp(t){return delete De.unary_ops[t],t.length===De.max_unop_len&&(De.max_unop_len=De.getMaxKeyLen(De.unary_ops)),De}static removeAllUnaryOps(){return De.unary_ops={},De.max_unop_len=0,De}static removeIdentifierChar(t){return De.additional_identifier_chars.delete(t),De}static removeBinaryOp(t){return delete De.binary_ops[t],t.length===De.max_binop_len&&(De.max_binop_len=De.getMaxKeyLen(De.binary_ops)),De.right_associative.delete(t),De}static removeAllBinaryOps(){return De.binary_ops={},De.max_binop_len=0,De}static removeLiteral(t){return delete De.literals[t],De}static removeAllLiterals(){return De.literals={},De}get char(){return this.expr.charAt(this.index)}get code(){return this.expr.charCodeAt(this.index)}constructor(t){this.expr=t,this.index=0}static parse(t){return new De(t).parse()}static getMaxKeyLen(t){return Math.max(0,...Object.keys(t).map(n=>n.length))}static isDecimalDigit(t){return t>=48&&t<=57}static binaryPrecedence(t){return De.binary_ops[t]||0}static isIdentifierStart(t){return t>=65&&t<=90||t>=97&&t<=122||t>=128&&!De.binary_ops[String.fromCharCode(t)]||De.additional_identifier_chars.has(String.fromCharCode(t))}static isIdentifierPart(t){return De.isIdentifierStart(t)||De.isDecimalDigit(t)}throwError(t){const n=new Error(t+" at character "+this.index);throw n.index=this.index,n.description=t,n}runHook(t,n){if(De.hooks[t]){const i={context:this,node:n};return De.hooks.run(t,i),i.node}return n}searchHook(t){if(De.hooks[t]){const n={context:this};return De.hooks[t].find(function(i){return i.call(n.context,n),n.node}),n.node}}gobbleSpaces(){let t=this.code;for(;t===De.SPACE_CODE||t===De.TAB_CODE||t===De.LF_CODE||t===De.CR_CODE;)t=this.expr.charCodeAt(++this.index);this.runHook("gobble-spaces")}parse(){this.runHook("before-all");const t=this.gobbleExpressions(),n=t.length===1?t[0]:{type:De.COMPOUND,body:t};return this.runHook("after-all",n)}gobbleExpressions(t){let n=[],i,o;for(;this.index<this.expr.length;)if(i=this.code,i===De.SEMCOL_CODE||i===De.COMMA_CODE)this.index++;else if(o=this.gobbleExpression())n.push(o);else if(this.index<this.expr.length){if(i===t)break;this.throwError('Unexpected "'+this.char+'"')}return n}gobbleExpression(){const t=this.searchHook("gobble-expression")||this.gobbleBinaryExpression();return this.gobbleSpaces(),this.runHook("after-expression",t)}gobbleBinaryOp(){this.gobbleSpaces();let t=this.expr.substr(this.index,De.max_binop_len),n=t.length;for(;n>0;){if(De.binary_ops.hasOwnProperty(t)&&(!De.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!De.isIdentifierPart(this.expr.charCodeAt(this.index+t.length))))return this.index+=n,t;t=t.substr(0,--n)}return!1}gobbleBinaryExpression(){let t,n,i,o,r,s,a,l,u;if(s=this.gobbleToken(),!s||(n=this.gobbleBinaryOp(),!n))return s;for(r={value:n,prec:De.binaryPrecedence(n),right_a:De.right_associative.has(n)},a=this.gobbleToken(),a||this.throwError("Expected expression after "+n),o=[s,r,a];n=this.gobbleBinaryOp();){if(i=De.binaryPrecedence(n),i===0){this.index-=n.length;break}r={value:n,prec:i,right_a:De.right_associative.has(n)},u=n;const h=f=>r.right_a&&f.right_a?i>f.prec:i<=f.prec;for(;o.length>2&&h(o[o.length-2]);)a=o.pop(),n=o.pop().value,s=o.pop(),t={type:De.BINARY_EXP,operator:n,left:s,right:a},o.push(t);t=this.gobbleToken(),t||this.throwError("Expected expression after "+u),o.push(r,t)}for(l=o.length-1,t=o[l];l>1;)t={type:De.BINARY_EXP,operator:o[l-1].value,left:o[l-2],right:t},l-=2;return t}gobbleToken(){let t,n,i,o;if(this.gobbleSpaces(),o=this.searchHook("gobble-token"),o)return this.runHook("after-token",o);if(t=this.code,De.isDecimalDigit(t)||t===De.PERIOD_CODE)return this.gobbleNumericLiteral();if(t===De.SQUOTE_CODE||t===De.DQUOTE_CODE)o=this.gobbleStringLiteral();else if(t===De.OBRACK_CODE)o=this.gobbleArray();else{for(n=this.expr.substr(this.index,De.max_unop_len),i=n.length;i>0;){if(De.unary_ops.hasOwnProperty(n)&&(!De.isIdentifierStart(this.code)||this.index+n.length<this.expr.length&&!De.isIdentifierPart(this.expr.charCodeAt(this.index+n.length)))){this.index+=i;const r=this.gobbleToken();return r||this.throwError("missing unaryOp argument"),this.runHook("after-token",{type:De.UNARY_EXP,operator:n,argument:r,prefix:!0})}n=n.substr(0,--i)}De.isIdentifierStart(t)?(o=this.gobbleIdentifier(),De.literals.hasOwnProperty(o.name)?o={type:De.LITERAL,value:De.literals[o.name],raw:o.name}:o.name===De.this_str&&(o={type:De.THIS_EXP})):t===De.OPAREN_CODE&&(o=this.gobbleGroup())}return o?(o=this.gobbleTokenProperty(o),this.runHook("after-token",o)):this.runHook("after-token",!1)}gobbleTokenProperty(t){this.gobbleSpaces();let n=this.code;for(;n===De.PERIOD_CODE||n===De.OBRACK_CODE||n===De.OPAREN_CODE||n===De.QUMARK_CODE;){let i;if(n===De.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==De.PERIOD_CODE)break;i=!0,this.index+=2,this.gobbleSpaces(),n=this.code}this.index++,n===De.OBRACK_CODE?(t={type:De.MEMBER_EXP,computed:!0,object:t,property:this.gobbleExpression()},this.gobbleSpaces(),n=this.code,n!==De.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):n===De.OPAREN_CODE?t={type:De.CALL_EXP,arguments:this.gobbleArguments(De.CPAREN_CODE),callee:t}:(n===De.PERIOD_CODE||i)&&(i&&this.index--,this.gobbleSpaces(),t={type:De.MEMBER_EXP,computed:!1,object:t,property:this.gobbleIdentifier()}),i&&(t.optional=!0),this.gobbleSpaces(),n=this.code}return t}gobbleNumericLiteral(){let t="",n,i;for(;De.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);if(this.code===De.PERIOD_CODE)for(t+=this.expr.charAt(this.index++);De.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);if(n=this.char,n==="e"||n==="E"){for(t+=this.expr.charAt(this.index++),n=this.char,(n==="+"||n==="-")&&(t+=this.expr.charAt(this.index++));De.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);De.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+t+this.char+")")}return i=this.code,De.isIdentifierStart(i)?this.throwError("Variable names cannot start with a number ("+t+this.char+")"):(i===De.PERIOD_CODE||t.length===1&&t.charCodeAt(0)===De.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:De.LITERAL,value:parseFloat(t),raw:t}}gobbleStringLiteral(){let t="";const n=this.index,i=this.expr.charAt(this.index++);let o=!1;for(;this.index<this.expr.length;){let r=this.expr.charAt(this.index++);if(r===i){o=!0;break}else if(r==="\\")switch(r=this.expr.charAt(this.index++),r){case"n":t+=`
|
|
`;break;case"r":t+="\r";break;case"t":t+=" ";break;case"b":t+="\b";break;case"f":t+="\f";break;case"v":t+="\v";break;default:t+=r}else t+=r}return o||this.throwError('Unclosed quote after "'+t+'"'),{type:De.LITERAL,value:t,raw:this.expr.substring(n,this.index)}}gobbleIdentifier(){let t=this.code,n=this.index;for(De.isIdentifierStart(t)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length&&(t=this.code,De.isIdentifierPart(t));)this.index++;return{type:De.IDENTIFIER,name:this.expr.slice(n,this.index)}}gobbleArguments(t){const n=[];let i=!1,o=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let r=this.code;if(r===t){i=!0,this.index++,t===De.CPAREN_CODE&&o&&o>=n.length&&this.throwError("Unexpected token "+String.fromCharCode(t));break}else if(r===De.COMMA_CODE){if(this.index++,o++,o!==n.length){if(t===De.CPAREN_CODE)this.throwError("Unexpected token ,");else if(t===De.CBRACK_CODE)for(let s=n.length;s<o;s++)n.push(null)}}else if(n.length!==o&&o!==0)this.throwError("Expected comma");else{const s=this.gobbleExpression();(!s||s.type===De.COMPOUND)&&this.throwError("Expected comma"),n.push(s)}}return i||this.throwError("Expected "+String.fromCharCode(t)),n}gobbleGroup(){this.index++;let t=this.gobbleExpressions(De.CPAREN_CODE);if(this.code===De.CPAREN_CODE)return this.index++,t.length===1?t[0]:t.length?{type:De.SEQUENCE_EXP,expressions:t}:!1;this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:De.ARRAY_EXP,elements:this.gobbleArguments(De.CBRACK_CODE)}}}const bce=new gce;Object.assign(De,{hooks:bce,plugins:new yce(De),COMPOUND:"Compound",SEQUENCE_EXP:"SequenceExpression",IDENTIFIER:"Identifier",MEMBER_EXP:"MemberExpression",LITERAL:"Literal",THIS_EXP:"ThisExpression",CALL_EXP:"CallExpression",UNARY_EXP:"UnaryExpression",BINARY_EXP:"BinaryExpression",ARRAY_EXP:"ArrayExpression",TAB_CODE:9,LF_CODE:10,CR_CODE:13,SPACE_CODE:32,PERIOD_CODE:46,COMMA_CODE:44,SQUOTE_CODE:39,DQUOTE_CODE:34,OPAREN_CODE:40,CPAREN_CODE:41,OBRACK_CODE:91,CBRACK_CODE:93,QUMARK_CODE:63,SEMCOL_CODE:59,COLON_CODE:58,unary_ops:{"-":1,"!":1,"~":1,"+":1},binary_ops:{"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10},right_associative:new Set,additional_identifier_chars:new Set(["$","_"]),literals:{true:!0,false:!1,null:null},this_str:"this"});De.max_unop_len=De.getMaxKeyLen(De.unary_ops);De.max_binop_len=De.getMaxKeyLen(De.binary_ops);const ep=e=>new De(e).parse(),Tce=Object.getOwnPropertyNames(De);Tce.forEach(e=>{ep[e]===void 0&&e!=="prototype"&&(ep[e]=De[e])});ep.Jsep=De;const Ace="ConditionalExpression";var xce={name:"ternary",init(e){e.hooks.add("after-expression",function(n){if(n.node&&this.code===e.QUMARK_CODE){this.index++;const i=n.node,o=this.gobbleExpression();if(o||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;const r=this.gobbleExpression();if(r||this.throwError("Expected expression"),n.node={type:Ace,test:i,consequent:o,alternate:r},i.operator&&e.binary_ops[i.operator]<=.9){let s=i;for(;s.right.operator&&e.binary_ops[s.right.operator]<=.9;)s=s.right;n.node.test=s.right,s.right=n.node,n.node=i}}else this.throwError("Expected :")}})}};ep.plugins.register(xce);const Cce={VARIABLE:0,UNARY:1,BINARY:2,TERNARY:3,CONDITIONAL:4,MEMBER:5,FUNCTION_CALL:6,ARRAY:7,REGEX:8,VARIABLE_IN_STRING:9,LITERAL_NULL:10,LITERAL_BOOLEAN:11,LITERAL_NUMBER:12,LITERAL_STRING:13,LITERAL_COLOR:14,LITERAL_VECTOR:15,LITERAL_REGEX:16,LITERAL_UNDEFINED:17,BUILTIN_VARIABLE:18},$e=Object.freeze(Cce);function bl(e,t){A.typeOf.string("expression",e),this._expression=e,e=Fce(e,t),e=zce(Bce(e)),ep.addBinaryOp("=~",0),ep.addBinaryOp("!~",0);let n;try{n=ep(e)}catch(i){throw new Te(i)}this._runtimeAst=yn(this,n)}Object.defineProperties(bl.prototype,{expression:{get:function(){return this._expression}}});const Vt={arrayIndex:0,arrayArray:[[]],cartesian2Index:0,cartesian3Index:0,cartesian4Index:0,cartesian2Array:[new H],cartesian3Array:[new d],cartesian4Array:[new te],reset:function(){this.arrayIndex=0,this.cartesian2Index=0,this.cartesian3Index=0,this.cartesian4Index=0},getArray:function(){this.arrayIndex>=this.arrayArray.length&&this.arrayArray.push([]);const e=this.arrayArray[this.arrayIndex++];return e.length=0,e},getCartesian2:function(){return this.cartesian2Index>=this.cartesian2Array.length&&this.cartesian2Array.push(new H),this.cartesian2Array[this.cartesian2Index++]},getCartesian3:function(){return this.cartesian3Index>=this.cartesian3Array.length&&this.cartesian3Array.push(new d),this.cartesian3Array[this.cartesian3Index++]},getCartesian4:function(){return this.cartesian4Index>=this.cartesian4Array.length&&this.cartesian4Array.push(new te),this.cartesian4Array[this.cartesian4Index++]}};bl.prototype.evaluate=function(e,t){Vt.reset();const n=this._runtimeAst.evaluate(e);return t instanceof z&&n instanceof te?z.fromCartesian4(n,t):n instanceof H||n instanceof d||n instanceof te?n.clone(t):n};bl.prototype.evaluateColor=function(e,t){Vt.reset();const n=this._runtimeAst.evaluate(e);return z.fromCartesian4(n,t)};bl.prototype.getShaderFunction=function(e,t,n,i){let o=this.getShaderExpression(t,n);return o=`${i} ${e}
|
|
{
|
|
return ${o};
|
|
}
|
|
`,o};bl.prototype.getShaderExpression=function(e,t){return this._runtimeAst.getShaderExpression(e,t)};bl.prototype.getVariables=function(){let e=[];return this._runtimeAst.getVariables(e),e=e.filter(function(t,n,i){return i.indexOf(t)===n}),e};const Ece=["!","-","+"],fM=["+","-","*","/","%","===","!==",">",">=","<","<=","&&","||","!~","=~"],Ox=/\${(.*?)}/g,wce=/\\/g,Sce="@#%",vce=/@#%/g,CC=new z,EC={abs:Jo(Math.abs),sqrt:Jo(Math.sqrt),cos:Jo(Math.cos),sin:Jo(Math.sin),tan:Jo(Math.tan),acos:Jo(Math.acos),asin:Jo(Math.asin),atan:Jo(Math.atan),radians:Jo(R.toRadians),degrees:Jo(R.toDegrees),sign:Jo(R.sign),floor:Jo(Math.floor),ceil:Jo(Math.ceil),round:Jo(Math.round),exp:Jo(Math.exp),exp2:Jo(Dce),log:Jo(Math.log),log2:Jo(Pce),fract:Jo(Ice),length:Oce,normalize:Lce},wC={atan2:oT(Math.atan2,!1),pow:oT(Math.pow,!1),min:oT(Math.min,!0),max:oT(Math.max,!0),distance:Rce,dot:Nce,cross:Mce},sO={clamp:pM(R.clamp,!0),mix:pM(R.lerp,!0)};function Ice(e){return e-Math.floor(e)}function Dce(e){return Math.pow(2,e)}function Pce(e){return R.log2(e)}function Jo(e){return function(t,n){if(typeof n=="number")return e(n);if(n instanceof H)return H.fromElements(e(n.x),e(n.y),Vt.getCartesian2());if(n instanceof d)return d.fromElements(e(n.x),e(n.y),e(n.z),Vt.getCartesian3());if(n instanceof te)return te.fromElements(e(n.x),e(n.y),e(n.z),e(n.w),Vt.getCartesian4());throw new Te(`Function "${t}" requires a vector or number argument. Argument is ${n}.`)}}function oT(e,t){return function(n,i,o){if(t&&typeof o=="number"){if(typeof i=="number")return e(i,o);if(i instanceof H)return H.fromElements(e(i.x,o),e(i.y,o),Vt.getCartesian2());if(i instanceof d)return d.fromElements(e(i.x,o),e(i.y,o),e(i.z,o),Vt.getCartesian3());if(i instanceof te)return te.fromElements(e(i.x,o),e(i.y,o),e(i.z,o),e(i.w,o),Vt.getCartesian4())}if(typeof i=="number"&&typeof o=="number")return e(i,o);if(i instanceof H&&o instanceof H)return H.fromElements(e(i.x,o.x),e(i.y,o.y),Vt.getCartesian2());if(i instanceof d&&o instanceof d)return d.fromElements(e(i.x,o.x),e(i.y,o.y),e(i.z,o.z),Vt.getCartesian3());if(i instanceof te&&o instanceof te)return te.fromElements(e(i.x,o.x),e(i.y,o.y),e(i.z,o.z),e(i.w,o.w),Vt.getCartesian4());throw new Te(`Function "${n}" requires vector or number arguments of matching types. Arguments are ${i} and ${o}.`)}}function pM(e,t){return function(n,i,o,r){if(t&&typeof r=="number"){if(typeof i=="number"&&typeof o=="number")return e(i,o,r);if(i instanceof H&&o instanceof H)return H.fromElements(e(i.x,o.x,r),e(i.y,o.y,r),Vt.getCartesian2());if(i instanceof d&&o instanceof d)return d.fromElements(e(i.x,o.x,r),e(i.y,o.y,r),e(i.z,o.z,r),Vt.getCartesian3());if(i instanceof te&&o instanceof te)return te.fromElements(e(i.x,o.x,r),e(i.y,o.y,r),e(i.z,o.z,r),e(i.w,o.w,r),Vt.getCartesian4())}if(typeof i=="number"&&typeof o=="number"&&typeof r=="number")return e(i,o,r);if(i instanceof H&&o instanceof H&&r instanceof H)return H.fromElements(e(i.x,o.x,r.x),e(i.y,o.y,r.y),Vt.getCartesian2());if(i instanceof d&&o instanceof d&&r instanceof d)return d.fromElements(e(i.x,o.x,r.x),e(i.y,o.y,r.y),e(i.z,o.z,r.z),Vt.getCartesian3());if(i instanceof te&&o instanceof te&&r instanceof te)return te.fromElements(e(i.x,o.x,r.x),e(i.y,o.y,r.y),e(i.z,o.z,r.z),e(i.w,o.w,r.w),Vt.getCartesian4());throw new Te(`Function "${n}" requires vector or number arguments of matching types. Arguments are ${i}, ${o}, and ${r}.`)}}function Oce(e,t){if(typeof t=="number")return Math.abs(t);if(t instanceof H)return H.magnitude(t);if(t instanceof d)return d.magnitude(t);if(t instanceof te)return te.magnitude(t);throw new Te(`Function "${e}" requires a vector or number argument. Argument is ${t}.`)}function Lce(e,t){if(typeof t=="number")return 1;if(t instanceof H)return H.normalize(t,Vt.getCartesian2());if(t instanceof d)return d.normalize(t,Vt.getCartesian3());if(t instanceof te)return te.normalize(t,Vt.getCartesian4());throw new Te(`Function "${e}" requires a vector or number argument. Argument is ${t}.`)}function Rce(e,t,n){if(typeof t=="number"&&typeof n=="number")return Math.abs(t-n);if(t instanceof H&&n instanceof H)return H.distance(t,n);if(t instanceof d&&n instanceof d)return d.distance(t,n);if(t instanceof te&&n instanceof te)return te.distance(t,n);throw new Te(`Function "${e}" requires vector or number arguments of matching types. Arguments are ${t} and ${n}.`)}function Nce(e,t,n){if(typeof t=="number"&&typeof n=="number")return t*n;if(t instanceof H&&n instanceof H)return H.dot(t,n);if(t instanceof d&&n instanceof d)return d.dot(t,n);if(t instanceof te&&n instanceof te)return te.dot(t,n);throw new Te(`Function "${e}" requires vector or number arguments of matching types. Arguments are ${t} and ${n}.`)}function Mce(e,t,n){if(t instanceof d&&n instanceof d)return d.cross(t,n,Vt.getCartesian3());throw new Te(`Function "${e}" requires vec3 arguments. Arguments are ${t} and ${n}.`)}function qe(e,t,n,i,o){this._type=e,this._value=t,this._left=n,this._right=i,this._test=o,this.evaluate=void 0,$ce(this)}function Fce(e,t){if(!c(t))return e;for(const n in t)if(t.hasOwnProperty(n)){const i=new RegExp(`\\$\\{${n}\\}`,"g"),o=`(${t[n]})`;c(o)&&(e=e.replace(i,o))}return e}function Bce(e){return e.replace(wce,Sce)}function GI(e){return e.replace(vce,"\\")}function zce(e){let t=e,n="",i=t.indexOf("${");for(;i>=0;){const o=t.indexOf("'"),r=t.indexOf('"');let s;if(o>=0&&o<i)s=t.indexOf("'",o+1),n+=t.substr(0,s+1),t=t.substr(s+1),i=t.indexOf("${");else if(r>=0&&r<i)s=t.indexOf('"',r+1),n+=t.substr(0,s+1),t=t.substr(s+1),i=t.indexOf("${");else{n+=t.substr(0,i);const a=t.indexOf("}");if(a<0)throw new Te("Unmatched {.");n+=`czm_${t.substr(i+2,a-(i+2))}`,t=t.substr(a+1),i=t.indexOf("${")}}return n+=t,n}function Uce(e){const t=typeof e.value;if(e.value===null)return new qe($e.LITERAL_NULL,null);if(t==="boolean")return new qe($e.LITERAL_BOOLEAN,e.value);if(t==="number")return new qe($e.LITERAL_NUMBER,e.value);if(t==="string")return e.value.indexOf("${")>=0?new qe($e.VARIABLE_IN_STRING,e.value):new qe($e.LITERAL_STRING,GI(e.value))}function kce(e,t){const n=t.arguments,i=n.length;let o,r,s,a;if(t.callee.type==="MemberExpression"){o=t.callee.property.name;const l=t.callee.object;if(o==="test"||o==="exec"){if(!c(l.callee)||l.callee.name!=="regExp")throw new Te(`${o} is not a function.`);return i===0?o==="test"?new qe($e.LITERAL_BOOLEAN,!1):new qe($e.LITERAL_NULL,null):(s=yn(e,l),a=yn(e,n[0]),new qe($e.FUNCTION_CALL,o,s,a))}else if(o==="toString")return r=yn(e,l),new qe($e.FUNCTION_CALL,o,r);throw new Te(`Unexpected function call "${o}".`)}if(o=t.callee.name,o==="color"){if(i===0)return new qe($e.LITERAL_COLOR,o);if(r=yn(e,n[0]),c(n[1])){const l=yn(e,n[1]);return new qe($e.LITERAL_COLOR,o,[r,l])}return new qe($e.LITERAL_COLOR,o,[r])}else if(o==="rgb"||o==="hsl"){if(i<3)throw new Te(`${o} requires three arguments.`);return r=[yn(e,n[0]),yn(e,n[1]),yn(e,n[2])],new qe($e.LITERAL_COLOR,o,r)}else if(o==="rgba"||o==="hsla"){if(i<4)throw new Te(`${o} requires four arguments.`);return r=[yn(e,n[0]),yn(e,n[1]),yn(e,n[2]),yn(e,n[3])],new qe($e.LITERAL_COLOR,o,r)}else if(o==="vec2"||o==="vec3"||o==="vec4"){r=new Array(i);for(let l=0;l<i;++l)r[l]=yn(e,n[l]);return new qe($e.LITERAL_VECTOR,o,r)}else{if(o==="isNaN"||o==="isFinite")return i===0?o==="isNaN"?new qe($e.LITERAL_BOOLEAN,!0):new qe($e.LITERAL_BOOLEAN,!1):(r=yn(e,n[0]),new qe($e.UNARY,o,r));if(o==="isExactClass"||o==="isClass"){if(i<1||i>1)throw new Te(`${o} requires exactly one argument.`);return r=yn(e,n[0]),new qe($e.UNARY,o,r)}else if(o==="getExactClassName"){if(i>0)throw new Te(`${o} does not take any argument.`);return new qe($e.UNARY,o)}else if(c(EC[o])){if(i!==1)throw new Te(`${o} requires exactly one argument.`);return r=yn(e,n[0]),new qe($e.UNARY,o,r)}else if(c(wC[o])){if(i!==2)throw new Te(`${o} requires exactly two arguments.`);return s=yn(e,n[0]),a=yn(e,n[1]),new qe($e.BINARY,o,s,a)}else if(c(sO[o])){if(i!==3)throw new Te(`${o} requires exactly three arguments.`);s=yn(e,n[0]),a=yn(e,n[1]);const l=yn(e,n[2]);return new qe($e.TERNARY,o,s,a,l)}else{if(o==="Boolean")return i===0?new qe($e.LITERAL_BOOLEAN,!1):(r=yn(e,n[0]),new qe($e.UNARY,o,r));if(o==="Number")return i===0?new qe($e.LITERAL_NUMBER,0):(r=yn(e,n[0]),new qe($e.UNARY,o,r));if(o==="String")return i===0?new qe($e.LITERAL_STRING,""):(r=yn(e,n[0]),new qe($e.UNARY,o,r));if(o==="regExp")return Vce(e,t)}}throw new Te(`Unexpected function call "${o}".`)}function Vce(e,t){const n=t.arguments;if(n.length===0)return new qe($e.LITERAL_REGEX,new RegExp);const i=yn(e,n[0]);let o;if(n.length>1){const r=yn(e,n[1]);if(Hw(i)&&Hw(r)){try{o=new RegExp(GI(String(i._value)),r._value)}catch(s){throw new Te(s)}return new qe($e.LITERAL_REGEX,o)}return new qe($e.REGEX,i,r)}if(Hw(i)){try{o=new RegExp(GI(String(i._value)))}catch(r){throw new Te(r)}return new qe($e.LITERAL_REGEX,o)}return new qe($e.REGEX,i)}function Hce(e){if(qce(e.name)){const t=Yce(e.name);return t.substr(0,8)==="tiles3d_"?new qe($e.BUILTIN_VARIABLE,t):new qe($e.VARIABLE,t)}else{if(e.name==="NaN")return new qe($e.LITERAL_NUMBER,NaN);if(e.name==="Infinity")return new qe($e.LITERAL_NUMBER,1/0);if(e.name==="undefined")return new qe($e.LITERAL_UNDEFINED,void 0)}throw new Te(`${e.name} is not defined.`)}function Gce(e){const t=e.property.name;if(t==="PI")return new qe($e.LITERAL_NUMBER,Math.PI);if(t==="E")return new qe($e.LITERAL_NUMBER,Math.E)}function jce(e){if(e.property.name==="POSITIVE_INFINITY")return new qe($e.LITERAL_NUMBER,Number.POSITIVE_INFINITY)}function Wce(e,t){if(t.object.name==="Math")return Gce(t);if(t.object.name==="Number")return jce(t);let n;const i=yn(e,t.object);return t.computed?(n=yn(e,t.property),new qe($e.MEMBER,"brackets",i,n)):(n=new qe($e.LITERAL_STRING,t.property.name),new qe($e.MEMBER,"dot",i,n))}function Hw(e){return e._type>=$e.LITERAL_NULL}function qce(e){return e.substr(0,4)==="czm_"}function Yce(e){return e.substr(4)}function yn(e,t){let n,i,o,r;if(t.type==="Literal")n=Uce(t);else if(t.type==="CallExpression")n=kce(e,t);else if(t.type==="Identifier")n=Hce(t);else if(t.type==="UnaryExpression"){i=t.operator;const s=yn(e,t.argument);if(Ece.indexOf(i)>-1)n=new qe($e.UNARY,i,s);else throw new Te(`Unexpected operator "${i}".`)}else if(t.type==="BinaryExpression")if(i=t.operator,o=yn(e,t.left),r=yn(e,t.right),fM.indexOf(i)>-1)n=new qe($e.BINARY,i,o,r);else throw new Te(`Unexpected operator "${i}".`);else if(t.type==="LogicalExpression")i=t.operator,o=yn(e,t.left),r=yn(e,t.right),fM.indexOf(i)>-1&&(n=new qe($e.BINARY,i,o,r));else if(t.type==="ConditionalExpression"){const s=yn(e,t.test);o=yn(e,t.consequent),r=yn(e,t.alternate),n=new qe($e.CONDITIONAL,"?",o,r,s)}else if(t.type==="MemberExpression")n=Wce(e,t);else if(t.type==="ArrayExpression"){const s=[];for(let a=0;a<t.elements.length;a++)s[a]=yn(e,t.elements[a]);n=new qe($e.ARRAY,s)}else throw t.type==="Compound"?new Te("Provide exactly one expression."):new Te("Cannot parse expression.");return n}function $ce(e){e._type===$e.CONDITIONAL?e.evaluate=e._evaluateConditional:e._type===$e.FUNCTION_CALL?e._value==="test"?e.evaluate=e._evaluateRegExpTest:e._value==="exec"?e.evaluate=e._evaluateRegExpExec:e._value==="toString"&&(e.evaluate=e._evaluateToString):e._type===$e.UNARY?e._value==="!"?e.evaluate=e._evaluateNot:e._value==="-"?e.evaluate=e._evaluateNegative:e._value==="+"?e.evaluate=e._evaluatePositive:e._value==="isNaN"?e.evaluate=e._evaluateNaN:e._value==="isFinite"?e.evaluate=e._evaluateIsFinite:e._value==="isExactClass"?e.evaluate=e._evaluateIsExactClass:e._value==="isClass"?e.evaluate=e._evaluateIsClass:e._value==="getExactClassName"?e.evaluate=e._evaluateGetExactClassName:e._value==="Boolean"?e.evaluate=e._evaluateBooleanConversion:e._value==="Number"?e.evaluate=e._evaluateNumberConversion:e._value==="String"?e.evaluate=e._evaluateStringConversion:c(EC[e._value])&&(e.evaluate=Qce(e._value)):e._type===$e.BINARY?e._value==="+"?e.evaluate=e._evaluatePlus:e._value==="-"?e.evaluate=e._evaluateMinus:e._value==="*"?e.evaluate=e._evaluateTimes:e._value==="/"?e.evaluate=e._evaluateDivide:e._value==="%"?e.evaluate=e._evaluateMod:e._value==="==="?e.evaluate=e._evaluateEqualsStrict:e._value==="!=="?e.evaluate=e._evaluateNotEqualsStrict:e._value==="<"?e.evaluate=e._evaluateLessThan:e._value==="<="?e.evaluate=e._evaluateLessThanOrEquals:e._value===">"?e.evaluate=e._evaluateGreaterThan:e._value===">="?e.evaluate=e._evaluateGreaterThanOrEquals:e._value==="&&"?e.evaluate=e._evaluateAnd:e._value==="||"?e.evaluate=e._evaluateOr:e._value==="=~"?e.evaluate=e._evaluateRegExpMatch:e._value==="!~"?e.evaluate=e._evaluateRegExpNotMatch:c(wC[e._value])&&(e.evaluate=Kce(e._value)):e._type===$e.TERNARY?e.evaluate=Zce(e._value):e._type===$e.MEMBER?e._value==="brackets"?e.evaluate=e._evaluateMemberBrackets:e.evaluate=e._evaluateMemberDot:e._type===$e.ARRAY?e.evaluate=e._evaluateArray:e._type===$e.VARIABLE?e.evaluate=e._evaluateVariable:e._type===$e.VARIABLE_IN_STRING?e.evaluate=e._evaluateVariableString:e._type===$e.LITERAL_COLOR?e.evaluate=e._evaluateLiteralColor:e._type===$e.LITERAL_VECTOR?e.evaluate=e._evaluateLiteralVector:e._type===$e.LITERAL_STRING?e.evaluate=e._evaluateLiteralString:e._type===$e.REGEX?e.evaluate=e._evaluateRegExp:e._type===$e.BUILTIN_VARIABLE?e._value==="tiles3d_tileset_time"&&(e.evaluate=Xce):e.evaluate=e._evaluateLiteral}function Xce(e){return c(e)?e.content.tileset.timeSinceLoad:0}function Qce(e){const t=EC[e];return function(n){const i=this._left.evaluate(n);return t(e,i)}}function Kce(e){const t=wC[e];return function(n){const i=this._left.evaluate(n),o=this._right.evaluate(n);return t(e,i,o)}}function Zce(e){const t=sO[e];return function(n){const i=this._left.evaluate(n),o=this._right.evaluate(n),r=this._test.evaluate(n);return t(e,i,o,r)}}function SC(e,t){if(c(e))return e.getPropertyInherited(t)}qe.prototype._evaluateLiteral=function(){return this._value};qe.prototype._evaluateLiteralColor=function(e){const t=CC,n=this._left;if(this._value==="color")c(n)?n.length>1?(z.fromCssColorString(n[0].evaluate(e),t),t.alpha=n[1].evaluate(e)):z.fromCssColorString(n[0].evaluate(e),t):z.fromBytes(255,255,255,255,t);else if(this._value==="rgb")z.fromBytes(n[0].evaluate(e),n[1].evaluate(e),n[2].evaluate(e),255,t);else if(this._value==="rgba"){const i=n[3].evaluate(e)*255;z.fromBytes(n[0].evaluate(e),n[1].evaluate(e),n[2].evaluate(e),i,t)}else this._value==="hsl"?z.fromHsl(n[0].evaluate(e),n[1].evaluate(e),n[2].evaluate(e),1,t):this._value==="hsla"&&z.fromHsl(n[0].evaluate(e),n[1].evaluate(e),n[2].evaluate(e),n[3].evaluate(e),t);return te.fromColor(t,Vt.getCartesian4())};qe.prototype._evaluateLiteralVector=function(e){const t=Vt.getArray(),n=this._value,i=this._left,o=i.length;for(let a=0;a<o;++a){const l=i[a].evaluate(e);if(typeof l=="number")t.push(l);else if(l instanceof H)t.push(l.x,l.y);else if(l instanceof d)t.push(l.x,l.y,l.z);else if(l instanceof te)t.push(l.x,l.y,l.z,l.w);else throw new Te(`${n} argument must be a vector or number. Argument is ${l}.`)}const r=t.length,s=parseInt(n.charAt(3));if(r===0)throw new Te(`Invalid ${n} constructor. No valid arguments.`);if(r<s&&r>1)throw new Te(`Invalid ${n} constructor. Not enough arguments.`);if(r>s&&o>1)throw new Te(`Invalid ${n} constructor. Too many arguments.`);if(r===1){const a=t[0];t.push(a,a,a)}if(n==="vec2")return H.fromArray(t,0,Vt.getCartesian2());if(n==="vec3")return d.fromArray(t,0,Vt.getCartesian3());if(n==="vec4")return te.fromArray(t,0,Vt.getCartesian4())};qe.prototype._evaluateLiteralString=function(){return this._value};qe.prototype._evaluateVariableString=function(e){let t=this._value,n=Ox.exec(t);for(;n!==null;){const i=n[0],o=n[1];let r=SC(e,o);c(r)||(r=""),t=t.replace(i,r),n=Ox.exec(t)}return t};qe.prototype._evaluateVariable=function(e){return SC(e,this._value)};function tp(e){return e._value==="feature"}qe.prototype._evaluateMemberDot=function(e){if(tp(this._left))return SC(e,this._right.evaluate(e));const t=this._left.evaluate(e);if(!c(t))return;const n=this._right.evaluate(e);if(t instanceof H||t instanceof d||t instanceof te){if(n==="r")return t.x;if(n==="g")return t.y;if(n==="b")return t.z;if(n==="a")return t.w}return t[n]};qe.prototype._evaluateMemberBrackets=function(e){if(tp(this._left))return SC(e,this._right.evaluate(e));const t=this._left.evaluate(e);if(!c(t))return;const n=this._right.evaluate(e);if(t instanceof H||t instanceof d||t instanceof te){if(n===0||n==="r")return t.x;if(n===1||n==="g")return t.y;if(n===2||n==="b")return t.z;if(n===3||n==="a")return t.w}return t[n]};qe.prototype._evaluateArray=function(e){const t=[];for(let n=0;n<this._value.length;n++)t[n]=this._value[n].evaluate(e);return t};qe.prototype._evaluateNot=function(e){const t=this._left.evaluate(e);if(typeof t!="boolean")throw new Te(`Operator "!" requires a boolean argument. Argument is ${t}.`);return!t};qe.prototype._evaluateNegative=function(e){const t=this._left.evaluate(e);if(t instanceof H)return H.negate(t,Vt.getCartesian2());if(t instanceof d)return d.negate(t,Vt.getCartesian3());if(t instanceof te)return te.negate(t,Vt.getCartesian4());if(typeof t=="number")return-t;throw new Te(`Operator "-" requires a vector or number argument. Argument is ${t}.`)};qe.prototype._evaluatePositive=function(e){const t=this._left.evaluate(e);if(!(t instanceof H||t instanceof d||t instanceof te||typeof t=="number"))throw new Te(`Operator "+" requires a vector or number argument. Argument is ${t}.`);return t};qe.prototype._evaluateLessThan=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(typeof t!="number"||typeof n!="number")throw new Te(`Operator "<" requires number arguments. Arguments are ${t} and ${n}.`);return t<n};qe.prototype._evaluateLessThanOrEquals=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(typeof t!="number"||typeof n!="number")throw new Te(`Operator "<=" requires number arguments. Arguments are ${t} and ${n}.`);return t<=n};qe.prototype._evaluateGreaterThan=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(typeof t!="number"||typeof n!="number")throw new Te(`Operator ">" requires number arguments. Arguments are ${t} and ${n}.`);return t>n};qe.prototype._evaluateGreaterThanOrEquals=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(typeof t!="number"||typeof n!="number")throw new Te(`Operator ">=" requires number arguments. Arguments are ${t} and ${n}.`);return t>=n};qe.prototype._evaluateOr=function(e){const t=this._left.evaluate(e);if(typeof t!="boolean")throw new Te(`Operator "||" requires boolean arguments. First argument is ${t}.`);if(t)return!0;const n=this._right.evaluate(e);if(typeof n!="boolean")throw new Te(`Operator "||" requires boolean arguments. Second argument is ${n}.`);return t||n};qe.prototype._evaluateAnd=function(e){const t=this._left.evaluate(e);if(typeof t!="boolean")throw new Te(`Operator "&&" requires boolean arguments. First argument is ${t}.`);if(!t)return!1;const n=this._right.evaluate(e);if(typeof n!="boolean")throw new Te(`Operator "&&" requires boolean arguments. Second argument is ${n}.`);return t&&n};qe.prototype._evaluatePlus=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(n instanceof H&&t instanceof H)return H.add(t,n,Vt.getCartesian2());if(n instanceof d&&t instanceof d)return d.add(t,n,Vt.getCartesian3());if(n instanceof te&&t instanceof te)return te.add(t,n,Vt.getCartesian4());if(typeof t=="string"||typeof n=="string")return t+n;if(typeof t=="number"&&typeof n=="number")return t+n;throw new Te(`Operator "+" requires vector or number arguments of matching types, or at least one string argument. Arguments are ${t} and ${n}.`)};qe.prototype._evaluateMinus=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(n instanceof H&&t instanceof H)return H.subtract(t,n,Vt.getCartesian2());if(n instanceof d&&t instanceof d)return d.subtract(t,n,Vt.getCartesian3());if(n instanceof te&&t instanceof te)return te.subtract(t,n,Vt.getCartesian4());if(typeof t=="number"&&typeof n=="number")return t-n;throw new Te(`Operator "-" requires vector or number arguments of matching types. Arguments are ${t} and ${n}.`)};qe.prototype._evaluateTimes=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(n instanceof H&&t instanceof H)return H.multiplyComponents(t,n,Vt.getCartesian2());if(n instanceof H&&typeof t=="number")return H.multiplyByScalar(n,t,Vt.getCartesian2());if(t instanceof H&&typeof n=="number")return H.multiplyByScalar(t,n,Vt.getCartesian2());if(n instanceof d&&t instanceof d)return d.multiplyComponents(t,n,Vt.getCartesian3());if(n instanceof d&&typeof t=="number")return d.multiplyByScalar(n,t,Vt.getCartesian3());if(t instanceof d&&typeof n=="number")return d.multiplyByScalar(t,n,Vt.getCartesian3());if(n instanceof te&&t instanceof te)return te.multiplyComponents(t,n,Vt.getCartesian4());if(n instanceof te&&typeof t=="number")return te.multiplyByScalar(n,t,Vt.getCartesian4());if(t instanceof te&&typeof n=="number")return te.multiplyByScalar(t,n,Vt.getCartesian4());if(typeof t=="number"&&typeof n=="number")return t*n;throw new Te(`Operator "*" requires vector or number arguments. If both arguments are vectors they must be matching types. Arguments are ${t} and ${n}.`)};qe.prototype._evaluateDivide=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(n instanceof H&&t instanceof H)return H.divideComponents(t,n,Vt.getCartesian2());if(t instanceof H&&typeof n=="number")return H.divideByScalar(t,n,Vt.getCartesian2());if(n instanceof d&&t instanceof d)return d.divideComponents(t,n,Vt.getCartesian3());if(t instanceof d&&typeof n=="number")return d.divideByScalar(t,n,Vt.getCartesian3());if(n instanceof te&&t instanceof te)return te.divideComponents(t,n,Vt.getCartesian4());if(t instanceof te&&typeof n=="number")return te.divideByScalar(t,n,Vt.getCartesian4());if(typeof t=="number"&&typeof n=="number")return t/n;throw new Te(`Operator "/" requires vector or number arguments of matching types, or a number as the second argument. Arguments are ${t} and ${n}.`)};qe.prototype._evaluateMod=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(n instanceof H&&t instanceof H)return H.fromElements(t.x%n.x,t.y%n.y,Vt.getCartesian2());if(n instanceof d&&t instanceof d)return d.fromElements(t.x%n.x,t.y%n.y,t.z%n.z,Vt.getCartesian3());if(n instanceof te&&t instanceof te)return te.fromElements(t.x%n.x,t.y%n.y,t.z%n.z,t.w%n.w,Vt.getCartesian4());if(typeof t=="number"&&typeof n=="number")return t%n;throw new Te(`Operator "%" requires vector or number arguments of matching types. Arguments are ${t} and ${n}.`)};qe.prototype._evaluateEqualsStrict=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);return n instanceof H&&t instanceof H||n instanceof d&&t instanceof d||n instanceof te&&t instanceof te?t.equals(n):t===n};qe.prototype._evaluateNotEqualsStrict=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);return n instanceof H&&t instanceof H||n instanceof d&&t instanceof d||n instanceof te&&t instanceof te?!t.equals(n):t!==n};qe.prototype._evaluateConditional=function(e){const t=this._test.evaluate(e);if(typeof t!="boolean")throw new Te(`Conditional argument of conditional expression must be a boolean. Argument is ${t}.`);return t?this._left.evaluate(e):this._right.evaluate(e)};qe.prototype._evaluateNaN=function(e){return isNaN(this._left.evaluate(e))};qe.prototype._evaluateIsFinite=function(e){return isFinite(this._left.evaluate(e))};qe.prototype._evaluateIsExactClass=function(e){return c(e)?e.isExactClass(this._left.evaluate(e)):!1};qe.prototype._evaluateIsClass=function(e){return c(e)?e.isClass(this._left.evaluate(e)):!1};qe.prototype._evaluateGetExactClassName=function(e){if(c(e))return e.getExactClassName()};qe.prototype._evaluateBooleanConversion=function(e){return Boolean(this._left.evaluate(e))};qe.prototype._evaluateNumberConversion=function(e){return Number(this._left.evaluate(e))};qe.prototype._evaluateStringConversion=function(e){return String(this._left.evaluate(e))};qe.prototype._evaluateRegExp=function(e){const t=this._value.evaluate(e);let n="";c(this._left)&&(n=this._left.evaluate(e));let i;try{i=new RegExp(t,n)}catch(o){throw new Te(o)}return i};qe.prototype._evaluateRegExpTest=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(!(t instanceof RegExp&&typeof n=="string"))throw new Te(`RegExp.test requires the first argument to be a RegExp and the second argument to be a string. Arguments are ${t} and ${n}.`);return t.test(n)};qe.prototype._evaluateRegExpMatch=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(t instanceof RegExp&&typeof n=="string")return t.test(n);if(n instanceof RegExp&&typeof t=="string")return n.test(t);throw new Te(`Operator "=~" requires one RegExp argument and one string argument. Arguments are ${t} and ${n}.`)};qe.prototype._evaluateRegExpNotMatch=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(t instanceof RegExp&&typeof n=="string")return!t.test(n);if(n instanceof RegExp&&typeof t=="string")return!n.test(t);throw new Te(`Operator "!~" requires one RegExp argument and one string argument. Arguments are ${t} and ${n}.`)};qe.prototype._evaluateRegExpExec=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(!(t instanceof RegExp&&typeof n=="string"))throw new Te(`RegExp.exec requires the first argument to be a RegExp and the second argument to be a string. Arguments are ${t} and ${n}.`);const i=t.exec(n);return c(i)?i[1]:null};qe.prototype._evaluateToString=function(e){const t=this._left.evaluate(e);if(t instanceof RegExp||t instanceof H||t instanceof d||t instanceof te)return String(t);throw new Te(`Unexpected function call "${this._value}".`)};function mM(e){const t=e._left,n=t.length;for(let a=0;a<n;++a)if(t[a]._type!==$e.LITERAL_NUMBER)return;const i=t[0]._value,o=t[1]._value,r=t[2]._value,s=n===4?t[3]._value:1;return z.fromHsl(i,o,r,s,CC)}function _M(e){const t=e._left,n=t.length;for(let o=0;o<n;++o)if(t[o]._type!==$e.LITERAL_NUMBER)return;const i=CC;return i.red=t[0]._value/255,i.green=t[1]._value/255,i.blue=t[2]._value/255,i.alpha=n===4?t[3]._value:1,i}function lh(e){return e%1===0?e.toFixed(1):e.toString()}function Jce(e){const t=lh(e.red),n=lh(e.green),i=lh(e.blue);return`vec3(${t}, ${n}, ${i})`}function rT(e){const t=lh(e.red),n=lh(e.green),i=lh(e.blue),o=lh(e.alpha);return`vec4(${t}, ${n}, ${i}, ${o})`}function gM(e,t,n,i){const o=e.length,r=new Array(o);for(let s=0;s<o;++s)r[s]=e[s].getShaderExpression(t,n,i);return r}function yM(e,t){return c(t[e])?t[e]:bl.NULL_SENTINEL}bl.NULL_SENTINEL="czm_infinity";qe.prototype.getShaderExpression=function(e,t,n){let i,o,r,s;const a=this._type;let l=this._value;c(this._left)&&(Array.isArray(this._left)?o=gM(this._left,e,t,this):o=this._left.getShaderExpression(e,t,this)),c(this._right)&&(r=this._right.getShaderExpression(e,t,this)),c(this._test)&&(s=this._test.getShaderExpression(e,t,this)),Array.isArray(this._value)&&(l=gM(this._value,e,t,this));let u,h,f;switch(a){case $e.VARIABLE:return tp(this)?void 0:yM(l,e);case $e.UNARY:if(l==="Boolean")return`bool(${o})`;if(l==="Number")return`float(${o})`;if(l==="round")return`floor(${o} + 0.5)`;if(c(EC[l]))return`${l}(${o})`;if(l==="isNaN")return`(${o} != ${o})`;if(l==="isFinite")return`(abs(${o}) < czm_infinity)`;if(l==="String"||l==="isExactClass"||l==="isClass"||l==="getExactClassName")throw new Te(`Error generating style shader: "${l}" is not supported.`);return l+o;case $e.BINARY:return l==="%"?`mod(${o}, ${r})`:l==="==="?`(${o} == ${r})`:l==="!=="?`(${o} != ${r})`:l==="atan2"?`atan(${o}, ${r})`:c(wC[l])?`${l}(${o}, ${r})`:`(${o} ${l} ${r})`;case $e.TERNARY:if(c(sO[l]))return`${l}(${o}, ${r}, ${s})`;break;case $e.CONDITIONAL:return`(${s} ? ${o} : ${r})`;case $e.MEMBER:return tp(this._left)?yM(r,e):r==="r"||r==="x"||r==="0.0"?`${o}[0]`:r==="g"||r==="y"||r==="1.0"?`${o}[1]`:r==="b"||r==="z"||r==="2.0"?`${o}[2]`:r==="a"||r==="w"||r==="3.0"?`${o}[3]`:`${o}[int(${r})]`;case $e.FUNCTION_CALL:throw new Te(`Error generating style shader: "${l}" is not supported.`);case $e.ARRAY:if(l.length===4)return`vec4(${l[0]}, ${l[1]}, ${l[2]}, ${l[3]})`;if(l.length===3)return`vec3(${l[0]}, ${l[1]}, ${l[2]})`;if(l.length===2)return`vec2(${l[0]}, ${l[1]})`;throw new Te("Error generating style shader: Invalid array length. Array length should be 2, 3, or 4.");case $e.REGEX:throw new Te("Error generating style shader: Regular expressions are not supported.");case $e.VARIABLE_IN_STRING:throw new Te("Error generating style shader: Converting a variable to a string is not supported.");case $e.LITERAL_NULL:return bl.NULL_SENTINEL;case $e.LITERAL_BOOLEAN:return l?"true":"false";case $e.LITERAL_NUMBER:return lh(l);case $e.LITERAL_STRING:if(c(n)&&n._type===$e.MEMBER&&(l==="r"||l==="g"||l==="b"||l==="a"||l==="x"||l==="y"||l==="z"||l==="w"||tp(n._left)))return l;if(i=z.fromCssColorString(l,CC),c(i))return Jce(i);throw new Te("Error generating style shader: String literals are not supported.");case $e.LITERAL_COLOR:if(u=o,l==="color"){if(c(u)){if(u.length>1){const _=u[0],g=u[1];return g!=="1.0"&&(t.translucent=!0),`vec4(${_}, ${g})`}}else return"vec4(1.0)";return`vec4(${u[0]}, 1.0)`}else{if(l==="rgb")return i=_M(this),c(i)?rT(i):`vec4(${u[0]} / 255.0, ${u[1]} / 255.0, ${u[2]} / 255.0, 1.0)`;if(l==="rgba")return u[3]!=="1.0"&&(t.translucent=!0),i=_M(this),c(i)?rT(i):`vec4(${u[0]} / 255.0, ${u[1]} / 255.0, ${u[2]} / 255.0, ${u[3]})`;if(l==="hsl")return i=mM(this),c(i)?rT(i):`vec4(czm_HSLToRGB(vec3(${u[0]}, ${u[1]}, ${u[2]})), 1.0)`;if(l==="hsla")return i=mM(this),c(i)?(i.alpha!==1&&(t.translucent=!0),rT(i)):(u[3]!=="1.0"&&(t.translucent=!0),`vec4(czm_HSLToRGB(vec3(${u[0]}, ${u[1]}, ${u[2]})), ${u[3]})`)}break;case $e.LITERAL_VECTOR:if(!c(o))throw new E("left should always be defined for type ExpressionNodeType.LITERAL_VECTOR");h=o.length,f=`${l}(`;for(let _=0;_<h;++_)f+=o[_],_<h-1&&(f+=", ");return f+=")",f;case $e.LITERAL_REGEX:throw new Te("Error generating style shader: Regular expressions are not supported.");case $e.LITERAL_UNDEFINED:return bl.NULL_SENTINEL;case $e.BUILTIN_VARIABLE:if(l==="tiles3d_tileset_time")return l}};qe.prototype.getVariables=function(e,t){let n,i,o;const r=this._type,s=this._value;if(c(this._left))if(Array.isArray(this._left))for(n=this._left,i=n.length,o=0;o<i;++o)n[o].getVariables(e,this);else this._left.getVariables(e,this);if(c(this._right)&&this._right.getVariables(e,this),c(this._test)&&this._test.getVariables(e,this),Array.isArray(this._value))for(n=this._value,i=n.length,o=0;o<i;++o)n[o].getVariables(e,this);let a;switch(r){case $e.VARIABLE:tp(this)||e.push(s);break;case $e.VARIABLE_IN_STRING:for(a=Ox.exec(s);a!==null;)e.push(a[1]),a=Ox.exec(s);break;case $e.LITERAL_STRING:c(t)&&t._type===$e.MEMBER&&tp(t._left)&&e.push(s);break}};function hu(e){e=y(e,y.EMPTY_OBJECT),this._batchTable=e.batchTable,this._batchIds=e.batchIds,this._positions=e.positions,this._vertexBatchIds=e.vertexBatchIds,this._indices=e.indices,this._indexCounts=e.indexCounts,this._indexOffsets=e.indexOffsets,this._batchedIndices=e.batchedIndices,this._boundingVolume=e.boundingVolume,this._boundingVolumes=e.boundingVolumes,this._center=y(e.center,d.ZERO),this._va=void 0,this._sp=void 0,this._spStencil=void 0,this._spPick=void 0,this._uniformMap=void 0,this._vaSwap=void 0,this._rsStencilDepthPass=void 0,this._rsStencilDepthPass3DTiles=void 0,this._rsColorPass=void 0,this._rsPickPass=void 0,this._rsWireframe=void 0,this._commands=[],this._commandsIgnoreShow=[],this._pickCommands=[],this._constantColor=z.clone(z.WHITE),this._highlightColor=this._constantColor,this._batchDirty=!0,this._pickCommandsDirty=!0,this._framesSinceLastRebatch=0,this._updatingAllCommands=!1,this._trianglesLength=this._indices.length/3,this._geometryByteLength=this._indices.byteLength+this._positions.byteLength+this._vertexBatchIds.byteLength,this.debugWireframe=!1,this._debugWireframe=this.debugWireframe,this._wireframeDirty=!1,this.forceRebatch=!1,this.classificationType=y(e.classificationType,Ui.BOTH),this._vertexShaderSource=e._vertexShaderSource,this._fragmentShaderSource=e._fragmentShaderSource,this._attributeLocations=e._attributeLocations,this._uniformMap=e._uniformMap,this._pickId=e._pickId,this._modelMatrix=e._modelMatrix,this._boundingSphere=e._boundingSphere,this._batchIdLookUp={};const t=this._batchIds.length;for(let n=0;n<t;++n){const i=this._batchIds[n];this._batchIdLookUp[i]=n}}Object.defineProperties(hu.prototype,{trianglesLength:{get:function(){return this._trianglesLength}},geometryByteLength:{get:function(){return this._geometryByteLength}}});const ele={position:0,a_batchId:1};function tle(e,t){if(c(e._va))return;const n=ct.createVertexBuffer({context:t,typedArray:e._positions,usage:ke.STATIC_DRAW}),i=ct.createVertexBuffer({context:t,typedArray:e._vertexBatchIds,usage:ke.STATIC_DRAW}),o=ct.createIndexBuffer({context:t,typedArray:e._indices,usage:ke.DYNAMIC_DRAW,indexDatatype:e._indices.BYTES_PER_ELEMENT===2?je.UNSIGNED_SHORT:je.UNSIGNED_INT}),r=[{index:0,vertexBuffer:n,componentDatatype:Z.fromTypedArray(e._positions),componentsPerAttribute:3},{index:1,vertexBuffer:i,componentDatatype:Z.fromTypedArray(e._vertexBatchIds),componentsPerAttribute:1}];e._va=new Ci({context:t,attributes:r,indexBuffer:o}),t.webgl2&&(e._vaSwap=new Ci({context:t,attributes:r,indexBuffer:ct.createIndexBuffer({context:t,sizeInBytes:o.sizeInBytes,usage:ke.DYNAMIC_DRAW,indexDatatype:o.indexDatatype})})),e._batchedPositions=void 0,e._transferrableBatchIds=void 0,e._vertexBatchIds=void 0}function nle(e,t){if(c(e._sp))return;const n=e._batchTable,i=y(e._attributeLocations,ele);let o=e._pickId;const r=e._vertexShaderSource;let s=e._fragmentShaderSource;if(c(r)){e._sp=Jt.fromCache({context:t,vertexShaderSource:r,fragmentShaderSource:s,attributeLocations:i}),e._spStencil=e._sp,s=Oe.replaceMain(s,"czm_non_pick_main"),s=`${s}void main()
|
|
{
|
|
czm_non_pick_main();
|
|
out_FragColor = ${o};
|
|
}
|
|
`,e._spPick=Jt.fromCache({context:t,vertexShaderSource:r,fragmentShaderSource:s,attributeLocations:i});return}const a=n.getVertexShaderCallback(!1,"a_batchId",void 0)(hM);let l=n.getFragmentShaderCallback(!1,void 0,!0)(wI);o=n.getPickId();let u=new Oe({sources:[a]}),h=new Oe({defines:["VECTOR_TILE"],sources:[l]});e._sp=Jt.fromCache({context:t,vertexShaderSource:u,fragmentShaderSource:h,attributeLocations:i}),u=new Oe({sources:[hM]}),h=new Oe({defines:["VECTOR_TILE"],sources:[wI]}),e._spStencil=Jt.fromCache({context:t,vertexShaderSource:u,fragmentShaderSource:h,attributeLocations:i}),l=Oe.replaceMain(l,"czm_non_pick_main"),l=`${l}
|
|
void main()
|
|
{
|
|
czm_non_pick_main();
|
|
out_FragColor = ${o};
|
|
}
|
|
`;const f=new Oe({sources:[a]}),_=new Oe({defines:["VECTOR_TILE"],sources:[l]});e._spPick=Jt.fromCache({context:t,vertexShaderSource:f,fragmentShaderSource:_,attributeLocations:i})}function bM(e){const t=e?Pn.EQUAL:Pn.ALWAYS;return{colorMask:{red:!1,green:!1,blue:!1,alpha:!1},stencilTest:{enabled:!0,frontFunction:t,frontOperation:{fail:nt.KEEP,zFail:nt.DECREMENT_WRAP,zPass:nt.KEEP},backFunction:t,backOperation:{fail:nt.KEEP,zFail:nt.INCREMENT_WRAP,zPass:nt.KEEP},reference:At.CESIUM_3D_TILE_MASK,mask:At.CESIUM_3D_TILE_MASK},stencilMask:At.CLASSIFICATION_MASK,depthTest:{enabled:!0,func:lp.LESS_OR_EQUAL},depthMask:!1}}const ile={stencilTest:{enabled:!0,frontFunction:Pn.NOT_EQUAL,frontOperation:{fail:nt.ZERO,zFail:nt.ZERO,zPass:nt.ZERO},backFunction:Pn.NOT_EQUAL,backOperation:{fail:nt.ZERO,zFail:nt.ZERO,zPass:nt.ZERO},reference:0,mask:At.CLASSIFICATION_MASK},stencilMask:At.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1,blending:Zn.PRE_MULTIPLIED_ALPHA_BLEND},ole={stencilTest:{enabled:!0,frontFunction:Pn.NOT_EQUAL,frontOperation:{fail:nt.ZERO,zFail:nt.ZERO,zPass:nt.ZERO},backFunction:Pn.NOT_EQUAL,backOperation:{fail:nt.ZERO,zFail:nt.ZERO,zPass:nt.ZERO},reference:0,mask:At.CLASSIFICATION_MASK},stencilMask:At.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1};function rle(e){c(e._rsStencilDepthPass)||(e._rsStencilDepthPass=Ue.fromCache(bM(!1)),e._rsStencilDepthPass3DTiles=Ue.fromCache(bM(!0)),e._rsColorPass=Ue.fromCache(ile),e._rsPickPass=Ue.fromCache(ole))}const _f=new L,TM=new d;function sle(e,t){if(c(e._uniformMap))return;const n={u_modifiedModelViewProjection:function(){const i=t.uniformState.view,o=t.uniformState.projection;return L.clone(i,_f),L.multiplyByPoint(_f,e._center,TM),L.setTranslation(_f,TM,_f),L.multiply(o,_f,_f),_f},u_highlightColor:function(){return e._highlightColor}};e._uniformMap=e._batchTable.getUniformMapCallback()(n)}function Gw(e,t,n,i,o,r,s){const a=e.constructor.BYTES_PER_ELEMENT,l=r.length;for(let u=0;u<l;++u){const h=r[u],f=s[h],_=i[f],g=o[f],m=new e.constructor(e.buffer,a*_,g);t.set(m,n),i[f]=n,n+=g}return n}function ale(e,t){const n=e._indices,i=e._indexOffsets,o=e._indexCounts,r=e._batchIdLookUp,s=new n.constructor(n.length);let a=t.pop();const l=[a];let u=Gw(n,s,0,i,o,a.batchIds,r);for(a.offset=0,a.count=u;t.length>0;){const h=t.pop();if(z.equals(h.color,a.color))u=Gw(n,s,u,i,o,h.batchIds,r),a.batchIds=a.batchIds.concat(h.batchIds),a.count=u-a.offset;else{const f=u;u=Gw(n,s,u,i,o,h.batchIds,r),h.offset=f,h.count=u-f,l.push(h),a=h}}e._va.indexBuffer.copyFromArrayView(s),e._indices=s,e._batchedIndices=l}function jw(e,t,n,i,o,r,s){const a=e.bytesPerIndex,l=r.length;for(let u=0;u<l;++u){const h=r[u],f=s[h],_=i[f],g=o[f];t.copyFromBuffer(e,_*a,n*a,g*a),i[f]=n,n+=g}return n}function cle(e,t){const n=e._indexOffsets,i=e._indexCounts,o=e._batchIdLookUp;let r=t.pop();const s=[r],a=e._va.indexBuffer,l=e._vaSwap.indexBuffer;let u=jw(a,l,0,n,i,r.batchIds,o);for(r.offset=0,r.count=u;t.length>0;){const f=t.pop();if(z.equals(f.color,r.color))u=jw(a,l,u,n,i,f.batchIds,o),r.batchIds=r.batchIds.concat(f.batchIds),r.count=u-r.offset;else{const _=u;u=jw(a,l,u,n,i,f.batchIds,o),f.offset=_,f.count=u-_,s.push(f),r=f}}const h=e._va;e._va=e._vaSwap,e._vaSwap=h,e._batchedIndices=s}function lle(e,t){return t.color.toRgba()-e.color.toRgba()}function ule(e,t){if(!e._batchDirty)return!1;const n=e._batchedIndices,i=n.length;let o=!1;const r={};for(let s=0;s<i;++s){const l=n[s].color.toRgba();if(c(r[l])){o=!0;break}else r[l]=!0}if(!o)return e._batchDirty=!1,!1;if(o&&!e.forceRebatch&&e._framesSinceLastRebatch<120){++e._framesSinceLastRebatch;return}return n.sort(lle),t.webgl2?cle(e,n):ale(e,n),e._framesSinceLastRebatch=0,e._batchDirty=!1,e._pickCommandsDirty=!0,e._wireframeDirty=!0,!0}function dle(e,t){const n=ule(e,t),i=e._commands,o=e._batchedIndices,r=o.length,s=r*2;if(c(i)&&!n&&i.length===s)return;i.length=s;const a=e._va,l=e._sp,u=y(e._modelMatrix,L.IDENTITY),h=e._uniformMap,f=e._boundingVolume;for(let _=0;_<r;++_){const g=o[_].offset,m=o[_].count;let b=i[_*2];c(b)||(b=i[_*2]=new Ze({owner:e})),b.vertexArray=a,b.modelMatrix=u,b.offset=g,b.count=m,b.renderState=e._rsStencilDepthPass,b.shaderProgram=l,b.uniformMap=h,b.boundingVolume=f,b.cull=!1,b.pass=xe.TERRAIN_CLASSIFICATION;const T=Ze.shallowClone(b,b.derivedCommands.tileset);T.renderState=e._rsStencilDepthPass3DTiles,T.pass=xe.CESIUM_3D_TILE_CLASSIFICATION,b.derivedCommands.tileset=T;let x=i[_*2+1];c(x)||(x=i[_*2+1]=new Ze({owner:e})),x.vertexArray=a,x.modelMatrix=u,x.offset=g,x.count=m,x.renderState=e._rsColorPass,x.shaderProgram=l,x.uniformMap=h,x.boundingVolume=f,x.cull=!1,x.pass=xe.TERRAIN_CLASSIFICATION;const C=Ze.shallowClone(x,x.derivedCommands.tileset);C.pass=xe.CESIUM_3D_TILE_CLASSIFICATION,x.derivedCommands.tileset=C}e._commandsDirty=!0}function hle(e,t){if(e.classificationType===Ui.TERRAIN||!t.invertClassification||c(e._commandsIgnoreShow)&&!e._commandsDirty)return;const n=e._commands,i=e._commandsIgnoreShow,o=e._spStencil,r=n.length,s=i.length=r/2;let a=0;for(let l=0;l<s;++l){const u=i[l]=Ze.shallowClone(n[a],i[l]);u.shaderProgram=o,u.pass=xe.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW,a+=2}e._commandsDirty=!1}function fle(e){if(!e._pickCommandsDirty)return;const t=e._indexOffsets.length,n=e._pickCommands;n.length=t*2;const i=e._va,o=e._spStencil,r=e._spPick,s=y(e._modelMatrix,L.IDENTITY),a=e._uniformMap;for(let l=0;l<t;++l){const u=e._indexOffsets[l],h=e._indexCounts[l],f=c(e._boundingVolumes)?e._boundingVolumes[l]:e.boundingVolume;let _=n[l*2];c(_)||(_=n[l*2]=new Ze({owner:e,pickOnly:!0})),_.vertexArray=i,_.modelMatrix=s,_.offset=u,_.count=h,_.renderState=e._rsStencilDepthPass,_.shaderProgram=o,_.uniformMap=a,_.boundingVolume=f,_.pass=xe.TERRAIN_CLASSIFICATION;const g=Ze.shallowClone(_,_.derivedCommands.tileset);g.renderState=e._rsStencilDepthPass3DTiles,g.pass=xe.CESIUM_3D_TILE_CLASSIFICATION,_.derivedCommands.tileset=g;let m=n[l*2+1];c(m)||(m=n[l*2+1]=new Ze({owner:e,pickOnly:!0})),m.vertexArray=i,m.modelMatrix=s,m.offset=u,m.count=h,m.renderState=e._rsPickPass,m.shaderProgram=r,m.uniformMap=a,m.boundingVolume=f,m.pass=xe.TERRAIN_CLASSIFICATION;const b=Ze.shallowClone(m,m.derivedCommands.tileset);b.pass=xe.CESIUM_3D_TILE_CLASSIFICATION,m.derivedCommands.tileset=b}e._pickCommandsDirty=!1}hu.prototype.createFeatures=function(e,t){const n=this._batchIds,i=n.length;for(let o=0;o<i;++o){const r=n[o];t[r]=new Ir(e,r)}};hu.prototype.applyDebugSettings=function(e,t){this._highlightColor=e?t:this._constantColor};function ple(e,t){e._updatingAllCommands=!0;const n=e._batchIds;let i=n.length,o;for(o=0;o<i;++o){const s=n[o],a=t[s];a.show=!0,a.color=z.WHITE}const r=e._batchedIndices;for(i=r.length,o=0;o<i;++o)r[o].color=z.clone(z.WHITE);e._updatingAllCommands=!1,e._batchDirty=!0}const mle=new z,_le=z.WHITE,gle=!0,yle=/\$/;hu.prototype.applyStyle=function(e,t){if(!c(e)){ple(this,t);return}const n=e.color,i=n instanceof bl&&!yle.test(n.expression);this._updatingAllCommands=i;const o=this._batchIds;let r=o.length,s;for(s=0;s<r;++s){const a=o[s],l=t[a];l.color=c(e.color)?e.color.evaluateColor(l,mle):_le,l.show=c(e.show)?e.show.evaluate(l):gle}if(i){const a=this._batchedIndices;for(r=a.length,s=0;s<r;++s)a[s].color=z.clone(z.WHITE);this._updatingAllCommands=!1,this._batchDirty=!0}};hu.prototype.updateCommands=function(e,t){if(this._updatingAllCommands)return;const n=this._batchIdLookUp,i=n[e];if(!c(i))return;const o=this._indexOffsets,r=this._indexCounts,s=o[i],a=r[i],l=this._batchedIndices,u=l.length;let h;for(h=0;h<u;++h){const b=l[h].offset,T=l[h].count;if(s>=b&&s<b+T)break}l.push(new Px({color:z.clone(t),offset:s,count:a,batchIds:[e]}));const f=[],_=[],g=l[h].batchIds,m=g.length;for(let b=0;b<m;++b){const T=g[b];if(T===e)continue;const x=n[T];o[x]<s?f.push(T):_.push(T)}_.length!==0&&l.push(new Px({color:z.clone(l[h].color),offset:s+a,count:l[h].offset+l[h].count-(s+a),batchIds:_})),f.length!==0?(l[h].count=s-l[h].offset,l[h].batchIds=f):l.splice(h,1),this._batchDirty=!0};function AM(e,t,n,i){const o=e.classificationType,r=o!==Ui.CESIUM_3D_TILE,s=o!==Ui.TERRAIN,a=t.commandList;let l=n.length,u,h;for(h=0;h<l;++h)r&&(u=n[h],u.pass=xe.TERRAIN_CLASSIFICATION,a.push(u)),s&&(u=n[h].derivedCommands.tileset,u.pass=xe.CESIUM_3D_TILE_CLASSIFICATION,a.push(u));if(!(!t.invertClassification||!c(i)))for(l=i.length,h=0;h<l;++h)a.push(i[h])}function ble(e,t){const n=e.commandList,i=t.length;for(let o=0;o<i;o+=2){const r=t[o+1];r.pass=xe.OPAQUE,n.push(r)}}function Tle(e){let t=e.debugWireframe===e._debugWireframe;if(t=t&&!(e.debugWireframe&&e._wireframeDirty),t)return;c(e._rsWireframe)||(e._rsWireframe=Ue.fromCache({}));let n,i;e.debugWireframe?(n=e._rsWireframe,i=ze.LINES):(n=e._rsColorPass,i=ze.TRIANGLES);const o=e._commands,r=o.length;for(let s=0;s<r;s+=2){const a=o[s+1];a.renderState=n,a.primitiveType=i}e._debugWireframe=e.debugWireframe,e._wireframeDirty=!1}hu.prototype.update=function(e){const t=e.context;tle(this,t),nle(this,t),rle(this),sle(this,t);const n=e.passes;n.render&&(dle(this,t),hle(this,e),Tle(this),this._debugWireframe?ble(e,this._commands):AM(this,e,this._commands,this._commandsIgnoreShow)),n.pick&&(fle(this),AM(this,e,this._pickCommands))};hu.prototype.isDestroyed=function(){return!1};hu.prototype.destroy=function(){return this._va=this._va&&this._va.destroy(),this._sp=this._sp&&this._sp.destroy(),this._spPick=this._spPick&&this._spPick.destroy(),this._vaSwap=this._vaSwap&&this._vaSwap.destroy(),ve(this)};function kr(e){this._boxes=e.boxes,this._boxBatchIds=e.boxBatchIds,this._cylinders=e.cylinders,this._cylinderBatchIds=e.cylinderBatchIds,this._ellipsoids=e.ellipsoids,this._ellipsoidBatchIds=e.ellipsoidBatchIds,this._spheres=e.spheres,this._sphereBatchIds=e.sphereBatchIds,this._modelMatrix=e.modelMatrix,this._batchTable=e.batchTable,this._boundingVolume=e.boundingVolume,this._center=e.center,c(this._center)||(c(this._boundingVolume)?this._center=d.clone(this._boundingVolume.center):this._center=d.clone(d.ZERO)),this._boundingVolumes=void 0,this._batchedIndices=void 0,this._indices=void 0,this._indexOffsets=void 0,this._indexCounts=void 0,this._positions=void 0,this._vertexBatchIds=void 0,this._batchIds=void 0,this._batchTableColors=void 0,this._packedBuffer=void 0,this._ready=!1,this._promise=void 0,this._error=void 0,this._verticesPromise=void 0,this._primitive=void 0,this.debugWireframe=!1,this.forceRebatch=!1,this.classificationType=Ui.BOTH}Object.defineProperties(kr.prototype,{trianglesLength:{get:function(){return c(this._primitive)?this._primitive.trianglesLength:0}},geometryByteLength:{get:function(){return c(this._primitive)?this._primitive.geometryByteLength:0}},ready:{get:function(){return this._ready}}});kr.packedBoxLength=L.packedLength+d.packedLength;kr.packedCylinderLength=L.packedLength+2;kr.packedEllipsoidLength=L.packedLength+d.packedLength;kr.packedSphereLength=d.packedLength+1;function Ale(e){const t=new Float64Array(L.packedLength+d.packedLength);let n=0;return d.pack(e._center,t,n),n+=d.packedLength,L.pack(e._modelMatrix,t,n),t}function xle(e,t){let n=0;const i=t[n++],o=t[n++],r=e._boundingVolumes=new Array(o);for(let l=0;l<o;++l)r[l]=se.unpack(t,n),n+=se.packedLength;const s=t[n++],a=e._batchedIndices=new Array(s);for(let l=0;l<s;++l){const u=z.unpack(t,n);n+=z.packedLength;const h=t[n++],f=t[n++],_=t[n++],g=new Array(_);for(let m=0;m<_;++m)g[m]=t[n++];a[l]=new Px({color:u,offset:h,count:f,batchIds:g})}return i}const Cle=new Kn("createVectorTileGeometries",5),Ele=new z;function wle(e){if(!c(e._primitive)&&!c(e._verticesPromise)){let t=e._boxes,n=e._boxBatchIds,i=e._cylinders,o=e._cylinderBatchIds,r=e._ellipsoids,s=e._ellipsoidBatchIds,a=e._spheres,l=e._sphereBatchIds,u=e._batchTableColors,h=e._packedBuffer;if(!c(u)){let m=0;c(e._boxes)&&(t=e._boxes=t.slice(),n=e._boxBatchIds=n.slice(),m+=n.length),c(e._cylinders)&&(i=e._cylinders=i.slice(),o=e._cylinderBatchIds=o.slice(),m+=o.length),c(e._ellipsoids)&&(r=e._ellipsoids=r.slice(),s=e._ellipsoidBatchIds=s.slice(),m+=s.length),c(e._spheres)&&(a=e._sphere=a.slice(),l=e._sphereBatchIds=l.slice(),m+=l.length),u=e._batchTableColors=new Uint32Array(m);const b=e._batchTable;for(let T=0;T<m;++T){const x=b.getColor(T,Ele);u[T]=x.toRgba()}h=e._packedBuffer=Ale(e)}const f=[];c(t)&&f.push(t.buffer,n.buffer),c(i)&&f.push(i.buffer,o.buffer),c(r)&&f.push(r.buffer,s.buffer),c(a)&&f.push(a.buffer,l.buffer),f.push(u.buffer,h.buffer);const _={boxes:c(t)?t.buffer:void 0,boxBatchIds:c(t)?n.buffer:void 0,cylinders:c(i)?i.buffer:void 0,cylinderBatchIds:c(i)?o.buffer:void 0,ellipsoids:c(r)?r.buffer:void 0,ellipsoidBatchIds:c(r)?s.buffer:void 0,spheres:c(a)?a.buffer:void 0,sphereBatchIds:c(a)?l.buffer:void 0,batchTableColors:u.buffer,packedBuffer:h.buffer},g=e._verticesPromise=Cle.scheduleTask(_,f);return c(g)?g.then(function(m){if(e.isDestroyed())return;const b=new Float64Array(m.packedBuffer);xle(e,b)===2?e._indices=new Uint16Array(m.indices):e._indices=new Uint32Array(m.indices),e._indexOffsets=new Uint32Array(m.indexOffsets),e._indexCounts=new Uint32Array(m.indexCounts),e._positions=new Float32Array(m.positions),e._vertexBatchIds=new Uint16Array(m.vertexBatchIds),e._batchIds=new Uint16Array(m.batchIds),Sle(e),e._ready=!0}).catch(m=>{e.isDestroyed()||(e._error=m)}):void 0}}function Sle(e){c(e._primitive)||(e._primitive=new hu({batchTable:e._batchTable,positions:e._positions,batchIds:e._batchIds,vertexBatchIds:e._vertexBatchIds,indices:e._indices,indexOffsets:e._indexOffsets,indexCounts:e._indexCounts,batchedIndices:e._batchedIndices,boundingVolume:e._boundingVolume,boundingVolumes:e._boundingVolumes,center:e._center,pickObject:y(e._pickObject,e)}),e._boxes=void 0,e._boxBatchIds=void 0,e._cylinders=void 0,e._cylinderBatchIds=void 0,e._ellipsoids=void 0,e._ellipsoidBatchIds=void 0,e._spheres=void 0,e._sphereBatchIds=void 0,e._center=void 0,e._modelMatrix=void 0,e._batchTable=void 0,e._boundingVolume=void 0,e._boundingVolumes=void 0,e._batchedIndices=void 0,e._indices=void 0,e._indexOffsets=void 0,e._indexCounts=void 0,e._positions=void 0,e._vertexBatchIds=void 0,e._batchIds=void 0,e._batchTableColors=void 0,e._packedBuffer=void 0,e._verticesPromise=void 0)}kr.prototype.createFeatures=function(e,t){this._primitive.createFeatures(e,t)};kr.prototype.applyDebugSettings=function(e,t){this._primitive.applyDebugSettings(e,t)};kr.prototype.applyStyle=function(e,t){this._primitive.applyStyle(e,t)};kr.prototype.updateCommands=function(e,t){this._primitive.updateCommands(e,t)};kr.prototype.update=function(e){if(!this._ready){if(c(this._promise)||(this._promise=wle(this)),c(this._error)){const t=this._error;throw this._error=void 0,t}return}this._primitive.debugWireframe=this.debugWireframe,this._primitive.forceRebatch=this.forceRebatch,this._primitive.classificationType=this.classificationType,this._primitive.update(e)};kr.prototype.isDestroyed=function(){return!1};kr.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),ve(this)};function fu(e,t,n,i,o){this._tileset=e,this._tile=t,this._resource=n,this._geometries=void 0,this._metadata=void 0,this._batchTable=void 0,this._features=void 0,this.featurePropertiesDirty=!1,this._group=void 0,this._ready=!1,Dle(this,i,o)}Object.defineProperties(fu.prototype,{featuresLength:{get:function(){return c(this._batchTable)?this._batchTable.featuresLength:0}},pointsLength:{get:function(){return 0}},trianglesLength:{get:function(){return c(this._geometries)?this._geometries.trianglesLength:0}},geometryByteLength:{get:function(){return c(this._geometries)?this._geometries.geometryByteLength:0}},texturesByteLength:{get:function(){return 0}},batchTableByteLength:{get:function(){return c(this._batchTable)?this._batchTable.batchTableByteLength:0}},innerContents:{get:function(){}},ready:{get:function(){return this._ready}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._resource.getUrlComponent(!0)}},metadata:{get:function(){return this._metadata},set:function(e){this._metadata=e}},batchTable:{get:function(){return this._batchTable}},group:{get:function(){return this._group},set:function(e){this._group=e}}});function vle(e){return function(t,n){c(e._geometries)&&e._geometries.updateCommands(t,n)}}function Ile(e,t){let n,i,o,r,s;const a=y(e.BOXES_LENGTH,0),l=y(e.CYLINDERS_LENGTH,0),u=y(e.ELLIPSOIDS_LENGTH,0),h=y(e.SPHERES_LENGTH,0);if(a>0&&c(e.BOX_BATCH_IDS)){const m=t.byteOffset+e.BOX_BATCH_IDS.byteOffset;n=new Uint16Array(t.buffer,m,a)}if(l>0&&c(e.CYLINDER_BATCH_IDS)){const m=t.byteOffset+e.CYLINDER_BATCH_IDS.byteOffset;i=new Uint16Array(t.buffer,m,l)}if(u>0&&c(e.ELLIPSOID_BATCH_IDS)){const m=t.byteOffset+e.ELLIPSOID_BATCH_IDS.byteOffset;o=new Uint16Array(t.buffer,m,u)}if(h>0&&c(e.SPHERE_BATCH_IDS)){const m=t.byteOffset+e.SPHERE_BATCH_IDS.byteOffset;r=new Uint16Array(t.buffer,m,h)}const f=c(n)||c(i)||c(o)||c(r),_=a>0&&!c(n)||l>0&&!c(i)||u>0&&!c(o)||h>0&&!c(r);if(f&&_)throw new Te("If one group of batch ids is defined, then all batch ids must be defined");if(!c(n)&&!c(i)&&!c(o)&&!c(r)){let m=0;if(!c(n)&&a>0)for(n=new Uint16Array(a),s=0;s<a;++s)n[s]=m++;if(!c(i)&&l>0)for(i=new Uint16Array(l),s=0;s<l;++s)i[s]=m++;if(!c(o)&&u>0)for(o=new Uint16Array(u),s=0;s<u;++s)o[s]=m++;if(!c(r)&&h>0)for(r=new Uint16Array(h),s=0;s<h;++s)r[s]=m++}return{boxes:n,cylinders:i,ellipsoids:o,spheres:r}}const gf=Uint32Array.BYTES_PER_ELEMENT;function Dle(e,t,n){n=y(n,0);const i=new Uint8Array(t),o=new DataView(t);n+=gf;const r=o.getUint32(n,!0);if(r!==1)throw new Te(`Only Geometry tile version 1 is supported. Version ${r} is not.`);n+=gf;const s=o.getUint32(n,!0);if(n+=gf,s===0){e._ready=!0;return}const a=o.getUint32(n,!0);if(n+=gf,a===0)throw new Te("Feature table must have a byte length greater than zero");const l=o.getUint32(n,!0);n+=gf;const u=o.getUint32(n,!0);n+=gf;const h=o.getUint32(n,!0);n+=gf;const f=sa(i,n,a);n+=a;const _=new Uint8Array(t,n,l);n+=l;let g,m;u>0&&(g=sa(i,n,u),n+=u,h>0&&(m=new Uint8Array(t,n,h),m=new Uint8Array(m)));const b=y(f.BOXES_LENGTH,0),T=y(f.CYLINDERS_LENGTH,0),x=y(f.ELLIPSOIDS_LENGTH,0),C=y(f.SPHERES_LENGTH,0),w=b+T+x+C,v=new Hn(e,w,g,m,vle(e));if(e._batchTable=v,w===0)return;const P=e.tile.computedTransform;let N;c(f.RTC_CENTER)&&(N=d.unpack(f.RTC_CENTER),L.multiplyByPoint(P,N,N));const k=Ile(f,_);if(b>0||T>0||x>0||C>0){let M,U,B,S;if(b>0){const D=_.byteOffset+f.BOXES.byteOffset;M=new Float32Array(_.buffer,D,kr.packedBoxLength*b)}if(T>0){const D=_.byteOffset+f.CYLINDERS.byteOffset;U=new Float32Array(_.buffer,D,kr.packedCylinderLength*T)}if(x>0){const D=_.byteOffset+f.ELLIPSOIDS.byteOffset;B=new Float32Array(_.buffer,D,kr.packedEllipsoidLength*x)}if(C>0){const D=_.byteOffset+f.SPHERES.byteOffset;S=new Float32Array(_.buffer,D,kr.packedSphereLength*C)}return e._geometries=new kr({boxes:M,boxBatchIds:k.boxes,cylinders:U,cylinderBatchIds:k.cylinders,ellipsoids:B,ellipsoidBatchIds:k.ellipsoids,spheres:S,sphereBatchIds:k.spheres,center:N,modelMatrix:P,batchTable:v,boundingVolume:e.tile.boundingVolume.boundingVolume}),e}return Promise.resolve(e)}function e4(e){const t=e.featuresLength;if(!c(e._features)&&t>0){const n=new Array(t);c(e._geometries)&&e._geometries.createFeatures(e,n),e._features=n}}fu.prototype.hasProperty=function(e,t){return this._batchTable.hasProperty(e,t)};fu.prototype.getFeature=function(e){const t=this.featuresLength;if(!c(e)||e<0||e>=t)throw new E(`batchId is required and between zero and featuresLength - 1 (${t-1}).`);return e4(this),this._features[e]};fu.prototype.applyDebugSettings=function(e,t){c(this._geometries)&&this._geometries.applyDebugSettings(e,t)};fu.prototype.applyStyle=function(e){e4(this),c(this._geometries)&&this._geometries.applyStyle(e,this._features)};fu.prototype.update=function(e,t){c(this._geometries)&&(this._geometries.classificationType=this._tileset.classificationType,this._geometries.debugWireframe=this._tileset.debugWireframe,this._geometries.update(t)),c(this._batchTable)&&this._geometries.ready&&(this._batchTable.update(e,t),this._ready=!0)};fu.prototype.pick=function(e,t,n){};fu.prototype.isDestroyed=function(){return!1};fu.prototype.destroy=function(){return this._geometries=this._geometries&&this._geometries.destroy(),this._batchTable=this._batchTable&&this._batchTable.destroy(),ve(this)};const aO={};aO.encode2D=function(e,t,n){const i=Math.pow(2,e);if(A.typeOf.number("level",e),A.typeOf.number("x",t),A.typeOf.number("y",n),e<1)throw new E("Hilbert level cannot be less than 1.");if(t<0||t>=i||n<0||n>=i)throw new E("Invalid coordinates for given level.");const o={x:t,y:n};let r,s,a,l=BigInt(0);for(a=i/2;a>0;a/=2)r=(o.x&a)>0?1:0,s=(o.y&a)>0?1:0,l+=BigInt((3*r^s)*a*a),t4(i,o,r,s);return l};aO.decode2D=function(e,t){if(A.typeOf.number("level",e),A.typeOf.bigint("index",t),e<1)throw new E("Hilbert level cannot be less than 1.");if(t<BigInt(0)||t>=BigInt(Math.pow(4,e)))throw new E("Hilbert index exceeds valid maximum for given level.");const n=Math.pow(2,e),i={x:0,y:0};let o,r,s,a;for(s=1,a=t;s<n;s*=2)o=1&Number(a/BigInt(2)),r=1&Number(a^BigInt(o)),t4(s,i,o,r),i.x+=s*o,i.y+=s*r,a/=BigInt(4);return[i.x,i.y]};function t4(e,t,n,i){if(i!==0)return;n===1&&(t.x=e-1-t.x,t.y=e-1-t.y);const o=t.x;t.x=t.y,t.y=o}const xM=aO,Zh=30,Ple=1<<Zh,Ole=1<<Zh+1>>>0,cO=2*Zh+1,oh=4,n4=[],i4=[],Lle=[[0,1,3,2],[0,2,3,1],[3,2,0,1],[3,1,0,2]],uh=1,Ym=2,sT=[uh,0,0,uh|Ym];function ui(e){if(!Yt.supportsBigInt())throw new Te("S2 required BigInt support");if(!c(e))throw new E("cell ID is required.");if(!ui.isValidId(e))throw new E("cell ID is invalid.");this._cellId=e,this._level=ui.getLevel(e)}ui.fromToken=function(e){if(A.typeOf.string("token",e),!ui.isValidToken(e))throw new E("token is invalid.");return new ui(ui.getIdFromToken(e))};ui.isValidId=function(e){return A.typeOf.bigint("cellId",e),!(e<=0||e>>BigInt(cO)>5||!(e&~e+BigInt(1)&BigInt("0x1555555555555555")))};ui.isValidToken=function(e){return A.typeOf.string("token",e),/^[0-9a-fA-F]{1,16}$/.test(e)?ui.isValidId(ui.getIdFromToken(e)):!1};ui.getIdFromToken=function(e){return A.typeOf.string("token",e),BigInt("0x"+e+"0".repeat(16-e.length))};ui.getTokenFromId=function(e){A.typeOf.bigint("cellId",e);const t=Math.floor(Hle(e)/4),n=e.toString(16).replace(/0*$/,"");return Array(17-t-n.length).join("0")+n};ui.getLevel=function(e){if(A.typeOf.bigint("cellId",e),!ui.isValidId(e))throw new E;let t=0;for(;e!==BigInt(0)&&!(e&BigInt(1));)t++,e=e>>BigInt(1);return Zh-(t>>1)};ui.prototype.getChild=function(e){if(A.typeOf.number("index",e),e<0||e>3)throw new E("child index must be in the range [0-3].");if(this._level===30)throw new E("cannot get child of leaf cell.");const t=s4(this._cellId)>>BigInt(2),n=this._cellId+BigInt(2*e+1-4)*t;return new ui(n)};ui.prototype.getParent=function(){if(this._level===0)throw new E("cannot get parent of root cell.");const e=s4(this._cellId)<<BigInt(2);return new ui(this._cellId&~e+BigInt(1)|e)};ui.prototype.getParentAtLevel=function(e){if(this._level===0||e<0||this._level<e)throw new E("cannot get parent at invalid level.");const t=kle(e);return new ui(this._cellId&-t|t)};ui.prototype.getCenter=function(e){e=y(e,ae.WGS84);let t=Rle(this._cellId,this._level);t=d.normalize(t,t);const n=new he.fromCartesian(t,ae.UNIT_SPHERE);return he.toCartesian(n,e,new d)};ui.prototype.getVertex=function(e,t){if(A.typeOf.number("index",e),e<0||e>3)throw new E("vertex index must be in the range [0-3].");t=y(t,ae.WGS84);let n=Nle(this._cellId,this._level,e);n=d.normalize(n,n);const i=new he.fromCartesian(n,ae.UNIT_SPHERE);return he.toCartesian(i,t,new d)};ui.fromFacePositionLevel=function(e,t,n){if(A.typeOf.bigint("position",t),e<0||e>5)throw new E("Invalid S2 Face (must be within 0-5)");if(n<0||n>Zh)throw new E("Invalid level (must be within 0-30)");if(t<0||t>=Math.pow(4,n))throw new E("Invalid Hilbert position for level");const i=(e<4?"0":"")+(e<2?"0":"")+e.toString(2),o=t.toString(2),r=Array(2*n-o.length+1).join("0"),s=Array(cO-2*n).join("0"),a=BigInt(`0b${i}${r}${o}1${s}`);return new ui(a)};function Rle(e,t){const n=Mle(e,t);return Fle(n[0],n[1],n[2])}function Nle(e,t,n){const i=o4(e),o=Ble([i[1],i[2]],t),r=n>>1&1;return r4(i[0],o[0][r^n&1],o[1][r])}function Mle(e,t){const n=o4(e),i=n[0],o=n[1],r=n[2],s=t===30,a=!s&&(BigInt(o)^e>>BigInt(2))&BigInt(1),l=s?1:a?2:0,u=(o<<1)+l,h=(r<<1)+l;return[i,u,h]}function o4(e){n4.length===0&&Ule();const t=Number(e>>BigInt(cO));let n=t&uh;const i=(1<<oh)-1;let o=0,r=0;for(let s=7;s>=0;s--){const l=(1<<2*(s===7?Zh-7*oh:oh))-1;n+=Number(e>>BigInt(s*2*oh+1)&BigInt(l))<<2,n=i4[n];const u=s*oh;o+=n>>oh+2<<u,r+=(n>>2&i)<<u,n&=uh|Ym}return[t,o,r]}function Fle(e,t,n){const i=CM(t),o=CM(n),r=Lx(i),s=Lx(o);return r4(e,r,s)}function r4(e,t,n){switch(e){case 0:return new d(1,t,n);case 1:return new d(-t,1,n);case 2:return new d(-t,-n,1);case 3:return new d(-1,-n,-t);case 4:return new d(n,-1,-t);default:return new d(n,t,-1)}}function Lx(e){return e>=.5?1/3*(4*e*e-1):1/3*(1-4*(1-e)*(1-e))}function CM(e){return 1/Ole*e}function Ble(e,t){const n=[[],[]],i=zle(t);for(let o=0;o<2;++o){const r=e[o]&-i,s=r+i;n[o][0]=Lx(EM(r)),n[o][1]=Lx(EM(s))}return n}function zle(e){return 1<<Zh-e>>>0}function EM(e){return 1/Ple*e}function dh(e,t,n,i,o,r){if(e===oh){const s=(t<<oh)+n;n4[(s<<2)+i]=(o<<2)+r,i4[(o<<2)+i]=(s<<2)+r}else{e++,t<<=1,n<<=1,o<<=2;const s=Lle[r];dh(e,t+(s[0]>>1),n+(s[0]&1),i,o,r^sT[0]),dh(e,t+(s[1]>>1),n+(s[1]&1),i,o+1,r^sT[1]),dh(e,t+(s[2]>>1),n+(s[2]&1),i,o+2,r^sT[2]),dh(e,t+(s[3]>>1),n+(s[3]&1),i,o+3,r^sT[3])}}function Ule(){dh(0,0,0,0,0,0),dh(0,0,0,uh,0,uh),dh(0,0,0,Ym,0,Ym),dh(0,0,0,uh|Ym,0,uh|Ym)}function s4(e){return e&~e+BigInt(1)}function kle(e){return BigInt(1)<<BigInt(2*(Zh-e))}const Vle=[64,0,1,39,2,15,40,23,3,12,16,59,41,19,24,54,4,64,13,10,17,62,60,28,42,30,20,51,25,44,55,47,5,32,65,38,14,22,11,58,18,53,63,9,61,27,29,50,43,46,31,37,21,57,52,8,26,49,45,36,56,7,48,35,6,34,33,0];function Hle(e){return Vle[(-e&e)%BigInt(67)]}function To(e,t){return c(e)&&c(e.extensions)&&c(e.extensions[t])}function Rx(e){const t=e.lengthBits;let n=e.availableCount;A.typeOf.number("options.lengthBits",t);const i=e.constant,o=e.bitstream;if(c(i))n=t;else{const r=Math.ceil(t/8);if(o.length!==r)throw new Te(`Availability bitstream must be exactly ${r} bytes long to store ${t} bits. Actual bitstream was ${o.length} bytes long.`);const s=y(e.computeAvailableCountEnabled,!1);!c(n)&&s&&(n=Gle(o,t))}this._lengthBits=t,this._availableCount=n,this._constant=i,this._bitstream=o}function Gle(e,t){let n=0;for(let i=0;i<t;i++){const o=i>>3,r=i%8;n+=e[o]>>r&1}return n}Object.defineProperties(Rx.prototype,{lengthBits:{get:function(){return this._lengthBits}},availableCount:{get:function(){return this._availableCount}}});Rx.prototype.getBit=function(e){if(e<0||e>=this._lengthBits)throw new E("Bit index out of bounds.");if(c(this._constant))return this._constant;const t=e>>3,n=e%8;return(this._bitstream[t]>>n&1)===1};function pu(e){e=y(e,y.EMPTY_OBJECT);const t=e.metadataTable,n=e.class,i=e.entityId,o=e.propertyTableJson;A.typeOf.object("options.metadataTable",t),A.typeOf.object("options.class",n),A.typeOf.number("options.entityId",i),A.typeOf.object("options.propertyTableJson",o),this._class=n,this._metadataTable=t,this._entityId=i,this._extensions=o.extensions,this._extras=o.extras}Object.defineProperties(pu.prototype,{class:{get:function(){return this._class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});pu.prototype.hasProperty=function(e){return this._metadataTable.hasProperty(e)};pu.prototype.hasPropertyBySemantic=function(e){return this._metadataTable.hasPropertyBySemantic(e)};pu.prototype.getPropertyIds=function(e){return this._metadataTable.getPropertyIds(e)};pu.prototype.getProperty=function(e){return this._metadataTable.getProperty(this._entityId,e)};pu.prototype.setProperty=function(e,t){return this._metadataTable.setProperty(this._entityId,e,t)};pu.prototype.getPropertyBySemantic=function(e){return this._metadataTable.getPropertyBySemantic(this._entityId,e)};pu.prototype.setPropertyBySemantic=function(e,t){return this._metadataTable.setPropertyBySemantic(this._entityId,e,t)};const GA={QUADTREE:"QUADTREE",OCTREE:"OCTREE"};GA.getBranchingFactor=function(e){switch(e){case GA.OCTREE:return 8;case GA.QUADTREE:return 4;default:throw new E("subdivisionScheme is not a valid value.")}};const jo=Object.freeze(GA);function Rt(){}Object.defineProperties(Rt.prototype,{class:{get:function(){E.throwInstantiationError()}}});Rt.prototype.hasProperty=function(e){E.throwInstantiationError()};Rt.prototype.hasPropertyBySemantic=function(e){E.throwInstantiationError()};Rt.prototype.getPropertyIds=function(e){E.throwInstantiationError()};Rt.prototype.getProperty=function(e){E.throwInstantiationError()};Rt.prototype.setProperty=function(e,t){E.throwInstantiationError()};Rt.prototype.getPropertyBySemantic=function(e){E.throwInstantiationError()};Rt.prototype.setPropertyBySemantic=function(e,t){E.throwInstantiationError()};Rt.hasProperty=function(e,t,n){if(A.typeOf.string("propertyId",e),A.typeOf.object("properties",t),A.typeOf.object("classDefinition",n),c(t[e]))return!0;const i=n.properties;if(!c(i))return!1;const o=i[e];return!!(c(o)&&c(o.default))};Rt.hasPropertyBySemantic=function(e,t,n){A.typeOf.string("semantic",e),A.typeOf.object("properties",t),A.typeOf.object("classDefinition",n);const i=n.propertiesBySemantic;if(!c(i))return!1;const o=i[e];return c(o)};Rt.getPropertyIds=function(e,t,n){A.typeOf.object("properties",e),A.typeOf.object("classDefinition",t),n=c(n)?n:[],n.length=0;for(const o in e)e.hasOwnProperty(o)&&c(e[o])&&n.push(o);const i=t.properties;if(c(i))for(const o in i)i.hasOwnProperty(o)&&!c(e[o])&&c(i[o].default)&&n.push(o);return n};Rt.getProperty=function(e,t,n){if(A.typeOf.string("propertyId",e),A.typeOf.object("properties",t),A.typeOf.object("classDefinition",n),!c(n.properties[e]))throw new E(`Class definition missing property ${e}`);const i=n.properties[e];let o=t[e];Array.isArray(o)&&(o=o.slice());const r=!0;if(o=i.handleNoData(o),!c(o)&&c(i.default))return o=Je(i.default,!0),i.unpackVectorAndMatrixTypes(o,r);if(!!c(o))return o=i.normalize(o),o=i.applyValueTransform(o),i.unpackVectorAndMatrixTypes(o,r)};Rt.setProperty=function(e,t,n,i){if(A.typeOf.string("propertyId",e),A.defined("value",t),A.typeOf.object("properties",n),A.typeOf.object("classDefinition",i),!c(n[e]))return!1;Array.isArray(t)&&(t=t.slice());let o;const r=i.properties;c(r)&&(o=r[e]);const s=!0;return c(o)&&(t=o.packVectorAndMatrixTypes(t,s),t=o.unapplyValueTransform(t),t=o.unnormalize(t)),n[e]=t,!0};Rt.getPropertyBySemantic=function(e,t,n){A.typeOf.string("semantic",e),A.typeOf.object("properties",t),A.typeOf.object("classDefinition",n);const i=n.propertiesBySemantic;if(!c(i))return;const o=i[e];if(c(o))return Rt.getProperty(o.id,t,n)};Rt.setPropertyBySemantic=function(e,t,n,i){A.typeOf.string("semantic",e),A.defined("value",t),A.typeOf.object("properties",n),A.typeOf.object("classDefinition",i);const o=i.propertiesBySemantic;if(!c(o))return!1;const r=i.propertiesBySemantic[e];return c(r)?Rt.setProperty(r.id,t,n,i):!1};function bd(e){e=y(e,y.EMPTY_OBJECT);const t=e.subtreeMetadata,n=e.class;A.typeOf.object("options.subtreeMetadata",t),A.typeOf.object("options.class",n);const i=c(t.properties)?t.properties:{};this._class=n,this._properties=i,this._extras=t.extras,this._extensions=t.extensions}Object.defineProperties(bd.prototype,{class:{get:function(){return this._class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});bd.prototype.hasProperty=function(e){return Rt.hasProperty(e,this._properties,this._class)};bd.prototype.hasPropertyBySemantic=function(e){return Rt.hasPropertyBySemantic(e,this._properties,this._class)};bd.prototype.getPropertyIds=function(e){return Rt.getPropertyIds(this._properties,this._class,e)};bd.prototype.getProperty=function(e){return Rt.getProperty(e,this._properties,this._class)};bd.prototype.setProperty=function(e,t){return Rt.setProperty(e,t,this._properties,this._class)};bd.prototype.getPropertyBySemantic=function(e){return Rt.getPropertyBySemantic(e,this._properties,this._class)};bd.prototype.setPropertyBySemantic=function(e,t){return Rt.setPropertyBySemantic(e,t,this._properties,this._class)};const tt={INT8:"INT8",UINT8:"UINT8",INT16:"INT16",UINT16:"UINT16",INT32:"INT32",UINT32:"UINT32",INT64:"INT64",UINT64:"UINT64",FLOAT32:"FLOAT32",FLOAT64:"FLOAT64"};tt.getMinimum=function(e){switch(A.typeOf.string("type",e),e){case tt.INT8:return-128;case tt.UINT8:return 0;case tt.INT16:return-32768;case tt.UINT16:return 0;case tt.INT32:return-2147483648;case tt.UINT32:return 0;case tt.INT64:return Yt.supportsBigInt()?BigInt("-9223372036854775808"):-Math.pow(2,63);case tt.UINT64:return Yt.supportsBigInt()?BigInt(0):0;case tt.FLOAT32:return-34028234663852886e22;case tt.FLOAT64:return-Number.MAX_VALUE}};tt.getMaximum=function(e){switch(A.typeOf.string("type",e),e){case tt.INT8:return 127;case tt.UINT8:return 255;case tt.INT16:return 32767;case tt.UINT16:return 65535;case tt.INT32:return 2147483647;case tt.UINT32:return 4294967295;case tt.INT64:return Yt.supportsBigInt()?BigInt("9223372036854775807"):Math.pow(2,63)-1;case tt.UINT64:return Yt.supportsBigInt()?BigInt("18446744073709551615"):Math.pow(2,64)-1;case tt.FLOAT32:return 34028234663852886e22;case tt.FLOAT64:return Number.MAX_VALUE}};tt.isIntegerType=function(e){switch(A.typeOf.string("type",e),e){case tt.INT8:case tt.UINT8:case tt.INT16:case tt.UINT16:case tt.INT32:case tt.UINT32:case tt.INT64:case tt.UINT64:return!0;default:return!1}};tt.isUnsignedIntegerType=function(e){switch(A.typeOf.string("type",e),e){case tt.UINT8:case tt.UINT16:case tt.UINT32:case tt.UINT64:return!0;default:return!1}};tt.isVectorCompatible=function(e){switch(A.typeOf.string("type",e),e){case tt.INT8:case tt.UINT8:case tt.INT16:case tt.UINT16:case tt.INT32:case tt.UINT32:case tt.FLOAT32:case tt.FLOAT64:return!0;default:return!1}};tt.normalize=function(e,t){if(typeof e!="number"&&typeof e!="bigint")throw new E("value must be a number or a BigInt");if(!tt.isIntegerType(t))throw new E("type must be an integer type");return Math.max(Number(e)/Number(tt.getMaximum(t)),-1)};tt.unnormalize=function(e,t){if(A.typeOf.number("value",e),!tt.isIntegerType(t))throw new E("type must be an integer type");const n=tt.getMaximum(t),i=tt.isUnsignedIntegerType(t)?0:-n;return e=R.sign(e)*Math.round(Math.abs(e)*Number(n)),(t===tt.INT64||t===tt.UINT64)&&Yt.supportsBigInt()&&(e=BigInt(e)),e>n?n:e<i?i:e};tt.applyValueTransform=function(e,t,n){return n*e+t};tt.unapplyValueTransform=function(e,t,n){return n===0?0:(e-t)/n};tt.getSizeInBytes=function(e){switch(A.typeOf.string("type",e),e){case tt.INT8:case tt.UINT8:return 1;case tt.INT16:case tt.UINT16:return 2;case tt.INT32:case tt.UINT32:return 4;case tt.INT64:case tt.UINT64:return 8;case tt.FLOAT32:return 4;case tt.FLOAT64:return 8}};tt.fromComponentDatatype=function(e){switch(A.typeOf.number("componentDatatype",e),e){case Z.BYTE:return tt.INT8;case Z.UNSIGNED_BYTE:return tt.UINT8;case Z.SHORT:return tt.INT16;case Z.UNSIGNED_SHORT:return tt.UINT16;case Z.INT:return tt.INT32;case Z.UNSIGNED_INT:return tt.UINT32;case Z.FLOAT:return tt.FLOAT32;case Z.DOUBLE:return tt.FLOAT64}};tt.toComponentDatatype=function(e){switch(A.typeOf.string("type",e),e){case tt.INT8:return Z.BYTE;case tt.UINT8:return Z.UNSIGNED_BYTE;case tt.INT16:return Z.SHORT;case tt.UINT16:return Z.UNSIGNED_SHORT;case tt.INT32:return Z.INT;case tt.UINT32:return Z.UNSIGNED_INT;case tt.FLOAT32:return Z.FLOAT;case tt.FLOAT64:return Z.DOUBLE}};const Ot=Object.freeze(tt),gi={SCALAR:"SCALAR",VEC2:"VEC2",VEC3:"VEC3",VEC4:"VEC4",MAT2:"MAT2",MAT3:"MAT3",MAT4:"MAT4",BOOLEAN:"BOOLEAN",STRING:"STRING",ENUM:"ENUM"};gi.isVectorType=function(e){switch(A.typeOf.string("type",e),e){case gi.VEC2:case gi.VEC3:case gi.VEC4:return!0;default:return!1}};gi.isMatrixType=function(e){switch(A.typeOf.string("type",e),e){case gi.MAT2:case gi.MAT3:case gi.MAT4:return!0;default:return!1}};gi.getComponentCount=function(e){switch(A.typeOf.string("type",e),e){case gi.SCALAR:case gi.STRING:case gi.ENUM:case gi.BOOLEAN:return 1;case gi.VEC2:return 2;case gi.VEC3:return 3;case gi.VEC4:return 4;case gi.MAT2:return 4;case gi.MAT3:return 9;case gi.MAT4:return 16;default:throw new E(`Invalid metadata type ${e}`)}};gi.getMathType=function(e){switch(e){case gi.VEC2:return H;case gi.VEC3:return d;case gi.VEC4:return te;case gi.MAT2:return Xe;case gi.MAT3:return $;case gi.MAT4:return L;default:return}};const bt=Object.freeze(gi);function dr(e){e=y(e,y.EMPTY_OBJECT);const t=e.id,n=e.type;A.typeOf.string("options.id",t),A.typeOf.string("options.type",n);const i=e.componentType,o=e.enumType,r=c(i)&&Ot.isIntegerType(i)&&y(e.normalized,!1);this._id=t,this._name=e.name,this._description=e.description,this._semantic=e.semantic,this._isLegacyExtension=e.isLegacyExtension,this._type=n,this._componentType=i,this._enumType=o,this._valueType=c(o)?o.valueType:i,this._isArray=y(e.isArray,!1),this._isVariableLengthArray=y(e.isVariableLengthArray,!1),this._arrayLength=e.arrayLength,this._min=Je(e.min,!0),this._max=Je(e.max,!0),this._normalized=r;let s=Je(e.offset,!0),a=Je(e.scale,!0);const l=c(s)||c(a),u=!0;c(s)||(s=this.expandConstant(0,u)),c(a)||(a=this.expandConstant(1,u)),this._offset=s,this._scale=a,this._hasValueTransform=l,this._noData=Je(e.noData,!0),this._default=Je(e.default,!0),this._required=y(e.required,!0),this._extras=Je(e.extras,!0),this._extensions=Je(e.extensions,!0)}dr.fromJson=function(e){e=y(e,y.EMPTY_OBJECT);const t=e.id,n=e.property;A.typeOf.string("options.id",t),A.typeOf.object("options.property",n),A.typeOf.string("options.property.type",n.type);const i=jle(n),o=Wle(n,e.enums);let r;return c(i)?i?r=c(n.optional)?!n.optional:!0:r=y(n.required,!1):r=!1,new dr({id:t,type:o.type,componentType:o.componentType,enumType:o.enumType,isArray:o.isArray,isVariableLengthArray:o.isVariableLengthArray,arrayLength:o.arrayLength,normalized:n.normalized,min:n.min,max:n.max,offset:n.offset,scale:n.scale,noData:n.noData,default:n.default,required:r,name:n.name,description:n.description,semantic:n.semantic,extras:n.extras,extensions:n.extensions,isLegacyExtension:i})};Object.defineProperties(dr.prototype,{id:{get:function(){return this._id}},name:{get:function(){return this._name}},description:{get:function(){return this._description}},type:{get:function(){return this._type}},enumType:{get:function(){return this._enumType}},componentType:{get:function(){return this._componentType}},valueType:{get:function(){return this._valueType}},isArray:{get:function(){return this._isArray}},isVariableLengthArray:{get:function(){return this._isVariableLengthArray}},arrayLength:{get:function(){return this._arrayLength}},normalized:{get:function(){return this._normalized}},max:{get:function(){return this._max}},min:{get:function(){return this._min}},noData:{get:function(){return this._noData}},default:{get:function(){return this._default}},required:{get:function(){return this._required}},semantic:{get:function(){return this._semantic}},hasValueTransform:{get:function(){return this._hasValueTransform}},offset:{get:function(){return this._offset}},scale:{get:function(){return this._scale}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});function jle(e){if(e.type==="ARRAY")return!0;const t=e.type;if(t===bt.SCALAR||bt.isMatrixType(t)||bt.isVectorType(t))return!1;if(c(Ot[t]))return!0;if(c(e.noData)||c(e.scale)||c(e.offset)||c(e.required)||c(e.count)||c(e.array)||c(e.optional))return!1}function Wle(e,t){const n=e.type,i=e.componentType,o=n==="ARRAY";let r,s,a;o?(r=!0,s=e.componentCount,a=!c(s)):e.array?(r=!0,s=e.count,a=!c(e.count)):(r=!1,s=void 0,a=!1);let l;if(c(e.enumType)&&(l=t[e.enumType]),n===bt.ENUM)return{type:n,componentType:void 0,enumType:l,valueType:l.valueType,isArray:r,isVariableLengthArray:a,arrayLength:s};if(o&&i===bt.ENUM)return{type:i,componentType:void 0,enumType:l,valueType:l.valueType,isArray:r,isVariableLengthArray:a,arrayLength:s};if(n===bt.SCALAR||bt.isMatrixType(n)||bt.isVectorType(n))return{type:n,componentType:i,enumType:void 0,valueType:i,isArray:r,isVariableLengthArray:a,arrayLength:s};if(n===bt.BOOLEAN||n===bt.STRING)return{type:n,componentType:void 0,enumType:void 0,valueType:void 0,isArray:r,isVariableLengthArray:a,arrayLength:s};if(o&&(i===bt.BOOLEAN||i===bt.STRING))return{type:i,componentType:void 0,enumType:void 0,valueType:void 0,isArray:r,isVariableLengthArray:a,arrayLength:s};if(c(i)&&c(Ot[i]))return{type:bt.SCALAR,componentType:i,enumType:void 0,valueType:i,isArray:r,isVariableLengthArray:a,arrayLength:s};if(c(Ot[n]))return{type:bt.SCALAR,componentType:n,enumType:void 0,valueType:n,isArray:r,isVariableLengthArray:a,arrayLength:s};throw new E(`unknown metadata type {type: ${n}, componentType: ${i})`)}dr.prototype.normalize=function(e){return this._normalized?lO(e,this._valueType,Ot.normalize):e};dr.prototype.unnormalize=function(e){return this._normalized?lO(e,this._valueType,Ot.unnormalize):e};dr.prototype.applyValueTransform=function(e){return!this._hasValueTransform||this._isVariableLengthArray?e:dr.valueTransformInPlace(e,this._offset,this._scale,Ot.applyValueTransform)};dr.prototype.unapplyValueTransform=function(e){return!this._hasValueTransform||this._isVariableLengthArray?e:dr.valueTransformInPlace(e,this._offset,this._scale,Ot.unapplyValueTransform)};dr.prototype.expandConstant=function(e,t){t=y(t,!1);const n=this._isArray,i=this._arrayLength,o=bt.getComponentCount(this._type),r=n&&o>1;if(!n&&o===1)return e;if(!n)return new Array(o).fill(e);if(!r)return new Array(i).fill(e);if(!t)return new Array(this._arrayLength*o).fill(e);const s=new Array(o).fill(e);return new Array(this._arrayLength).fill(s)};dr.prototype.handleNoData=function(e){const t=this._noData;if(!c(t))return e;if(!a4(e,t))return e};function a4(e,t){if(!Array.isArray(e))return e===t;if(!Array.isArray(t)||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!a4(e[n],t[n]))return!1;return!0}dr.prototype.unpackVectorAndMatrixTypes=function(e,t){t=y(t,!1);const n=bt.getMathType(this._type),i=this._isArray,o=bt.getComponentCount(this._type),r=i&&o>1;return c(n)?t&&r?e.map(function(s){return n.unpack(s)}):i?n.unpackArray(e):n.unpack(e):e};dr.prototype.packVectorAndMatrixTypes=function(e,t){t=y(t,!1);const n=bt.getMathType(this._type),i=this._isArray,o=bt.getComponentCount(this._type),r=i&&o>1;return c(n)?t&&r?e.map(function(s){return n.pack(s,[])}):i?n.packArray(e,[]):n.pack(e,[]):e};dr.prototype.validate=function(e){if(!(!c(e)&&c(this._default)))return this._required&&!c(e)?"required property must have a value":this._isArray?qle(this,e):c4(this,e)};function qle(e,t){if(!Array.isArray(t))return`value ${t} must be an array`;const n=t.length;if(!e._isVariableLengthArray&&n!==e._arrayLength)return"Array length does not match property.arrayLength";for(let i=0;i<n;i++){const o=c4(e,t[i]);if(c(o))return o}}function c4(e,t){const n=e._type,i=e._componentType,o=e._enumType,r=e._normalized;return bt.isVectorType(n)?Yle(t,n,i):bt.isMatrixType(n)?$le(t,n,i):n===bt.STRING?Xle(t):n===bt.BOOLEAN?Qle(t):n===bt.ENUM?Kle(t,o):Zle(t,i,r)}function Yle(e,t,n){if(!Ot.isVectorCompatible(n))return`componentType ${n} is incompatible with vector type ${t}`;if(t===bt.VEC2&&!(e instanceof H))return`vector value ${e} must be a Cartesian2`;if(t===bt.VEC3&&!(e instanceof d))return`vector value ${e} must be a Cartesian3`;if(t===bt.VEC4&&!(e instanceof te))return`vector value ${e} must be a Cartesian4`}function $le(e,t,n){if(!Ot.isVectorCompatible(n))return`componentType ${n} is incompatible with matrix type ${t}`;if(t===bt.MAT2&&!(e instanceof Xe))return`matrix value ${e} must be a Matrix2`;if(t===bt.MAT3&&!(e instanceof $))return`matrix value ${e} must be a Matrix3`;if(t===bt.MAT4&&!(e instanceof L))return`matrix value ${e} must be a Matrix4`}function Xle(e){if(typeof e!="string")return Nx(e,bt.STRING)}function Qle(e){if(typeof e!="boolean")return Nx(e,bt.BOOLEAN)}function Kle(e,t){const n=typeof e;if(c(t))return n!=="string"||!c(t.valuesByName[e])?`value ${e} is not a valid enum name for ${t.id}`:void 0}function Zle(e,t,n){const i=typeof e;switch(t){case Ot.INT8:case Ot.UINT8:case Ot.INT16:case Ot.UINT16:case Ot.INT32:case Ot.UINT32:case Ot.FLOAT32:case Ot.FLOAT64:return i!=="number"?Nx(e,t):isFinite(e)?SM(e,t,n):vM(e,t);case Ot.INT64:case Ot.UINT64:return i!=="number"&&i!=="bigint"?Nx(e,t):i==="number"&&!isFinite(e)?vM(e,t):SM(e,t,n)}}function Nx(e,t){return`value ${e} does not match type ${t}`}function wM(e,t,n){let i=`value ${e} is out of range for type ${t}`;return n&&(i+=" (normalized)"),i}function SM(e,t,n){if(n){const i=Ot.isUnsignedIntegerType(t)?0:-1,o=1;return e<i||e>o?wM(e,t,n):void 0}if(e<Ot.getMinimum(t)||e>Ot.getMaximum(t))return wM(e,t,n)}function vM(e,t){return`value ${e} of type ${t} must be finite`}function lO(e,t,n){if(!Array.isArray(e))return n(e,t);for(let i=0;i<e.length;i++)e[i]=lO(e[i],t,n);return e}dr.valueTransformInPlace=function(e,t,n,i){if(!Array.isArray(e))return i(e,t,n);for(let o=0;o<e.length;o++)e[o]=dr.valueTransformInPlace(e[o],t[o],n[o],i);return e};function z0(e){e=y(e,y.EMPTY_OBJECT);const t=e.count,n=e.property,i=e.classProperty,o=e.bufferViews;A.typeOf.number.greaterThan("options.count",t,0),A.typeOf.object("options.property",n),A.typeOf.object("options.classProperty",i),A.typeOf.object("options.bufferViews",o);const r=i.type,s=i.isArray,a=i.isVariableLengthArray;let l=i.valueType;const u=i.enumType,h=r===bt.STRING,f=r===bt.BOOLEAN;let _=0,g;if(a){let S=y(n.arrayOffsetType,n.offsetType);S=y(Ot[S],Ot.UINT32);const D=y(n.arrayOffsets,n.arrayOffsetBufferView);g=new Ww(o[D],S,t+1),_+=g.typedArray.byteLength}const m=bt.getComponentCount(r);let b;a?b=g.get(t)-g.get(0):s?b=t*i.arrayLength:b=t;const T=m*b;let x;if(h){let S=y(n.stringOffsetType,n.offsetType);S=y(Ot[S],Ot.UINT32);const D=y(n.stringOffsets,n.stringOffsetBufferView);x=new Ww(o[D],S,T+1),_+=x.typedArray.byteLength}(h||f)&&(l=Ot.UINT8);let C;h?C=x.get(T)-x.get(0):f?C=Math.ceil(T/8):C=T;const w=y(n.values,n.bufferView),v=new Ww(o[w],l,C);_+=v.typedArray.byteLength;let P=n.offset,N=n.scale;const k=i.hasValueTransform||c(P)||c(N);P=y(P,i.offset),N=y(N,i.scale),P=IM(P),N=IM(N);let M,U;const B=this;h?M=function(S){return tue(S,B._values,B._stringOffsets)}:f?(M=function(S){return nue(S,B._values)},U=function(S,D){iue(S,B._values,D)}):c(u)?(M=function(S){const D=B._values.get(S);return u.namesByValue[D]},U=function(S,D){const p=u.valuesByName[D];B._values.set(S,p)}):(M=function(S){return B._values.get(S)},U=function(S,D){B._values.set(S,D)}),this._arrayOffsets=g,this._stringOffsets=x,this._values=v,this._classProperty=i,this._count=t,this._vectorComponentCount=m,this._min=n.min,this._max=n.max,this._offset=P,this._scale=N,this._hasValueTransform=k,this._getValue=M,this._setValue=U,this._unpackedValues=void 0,this._extras=n.extras,this._extensions=n.extensions,this._byteLength=_}Object.defineProperties(z0.prototype,{hasValueTransform:{get:function(){return this._hasValueTransform}},offset:{get:function(){return this._offset}},scale:{get:function(){return this._scale}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}},byteLength:{get:function(){return this._byteLength}}});z0.prototype.get=function(e){l4(this,e);let t=Jle(this,e);return t=this._classProperty.handleNoData(t),c(t)?(t=this._classProperty.normalize(t),t=due(this,t),this._classProperty.unpackVectorAndMatrixTypes(t)):(t=this._classProperty.default,this._classProperty.unpackVectorAndMatrixTypes(t))};z0.prototype.set=function(e,t){const n=this._classProperty;A.defined("value",t),l4(this,e);const i=n.validate(t);if(c(i))throw new E(i);t=n.packVectorAndMatrixTypes(t),t=hue(this,t),t=n.unnormalize(t),eue(this,e,t)};z0.prototype.getTypedArray=function(){if(c(this._values))return this._values.typedArray};function IM(e){if(!Array.isArray(e))return e;const t=[];for(let n=0;n<e.length;n++){const i=e[n];Array.isArray(i)?t.push.apply(t,i):t.push(i)}return t}function l4(e,t){const n=e._count;if(!c(t)||t<0||t>=n){const i=n-1;throw new E(`index is required and between zero and count - 1. Actual value: ${i}`)}}function Jle(e,t){d4(e)&&h4(e);const n=e._classProperty,i=n.isArray,o=n.type,r=bt.getComponentCount(o);if(c(e._unpackedValues)){const s=e._unpackedValues[t];return i?Je(s,!0):s}return!i&&r===1?e._getValue(t):u4(e,n,t)}function u4(e,t,n){let i,o;if(t.isVariableLengthArray){i=e._arrayOffsets.get(n),o=e._arrayOffsets.get(n+1)-i;const s=bt.getComponentCount(t.type);i*=s,o*=s}else{const a=y(t.arrayLength,1)*e._vectorComponentCount;i=n*a,o=a}const r=new Array(o);for(let s=0;s<o;s++)r[s]=e._getValue(i+s);return r}function eue(e,t,n){lue(e,t,n)&&h4(e);const i=e._classProperty,o=i.isArray,r=i.type,s=bt.getComponentCount(r);if(c(e._unpackedValues)){i.isArray&&(n=Je(n,!0)),e._unpackedValues[t]=n;return}if(!o&&s===1){e._setValue(t,n);return}let a,l;if(i.isVariableLengthArray)a=e._arrayOffsets.get(t),l=e._arrayOffsets.get(t+1)-a;else{const h=y(i.arrayLength,1)*e._vectorComponentCount;a=t*h,l=h}for(let u=0;u<l;++u)e._setValue(a+u,n[u])}function tue(e,t,n){const i=n.get(e),o=n.get(e+1)-i;return Ta(t.typedArray,i,o)}function nue(e,t){const n=e>>3,i=e%8;return(t.typedArray[n]>>i&1)===1}function iue(e,t,n){const i=e>>3,o=e%8;n?t.typedArray[i]|=1<<o:t.typedArray[i]&=~(1<<o)}function oue(e,t){const n=t.dataView,i=e*8;let o=0;const r=(n.getUint8(i+7)&128)>0;let s=!0;for(let a=0;a<8;++a){let l=n.getUint8(i+a);r&&(s?l!==0&&(l=~(l-1)&255,s=!1):l=~l&255),o+=l*Math.pow(256,a)}return r&&(o=-o),o}function rue(e,t){const n=t.dataView,i=e*8;let o=BigInt(0);const r=(n.getUint8(i+7)&128)>0;let s=!0;for(let a=0;a<8;++a){let l=n.getUint8(i+a);r&&(s?l!==0&&(l=~(l-1)&255,s=!1):l=~l&255),o+=BigInt(l)*(BigInt(1)<<BigInt(a*8))}return r&&(o=-o),o}function sue(e,t){const n=t.dataView,i=e*8,o=n.getUint32(i,!0),r=n.getUint32(i+4,!0);return o+4294967296*r}function aue(e,t){const n=t.dataView,i=e*8,o=BigInt(n.getUint32(i,!0)),r=BigInt(n.getUint32(i+4,!0));return o+BigInt(4294967296)*r}function cue(e){switch(e){case Ot.INT8:return Z.BYTE;case Ot.UINT8:return Z.UNSIGNED_BYTE;case Ot.INT16:return Z.SHORT;case Ot.UINT16:return Z.UNSIGNED_SHORT;case Ot.INT32:return Z.INT;case Ot.UINT32:return Z.UNSIGNED_INT;case Ot.FLOAT32:return Z.FLOAT;case Ot.FLOAT64:return Z.DOUBLE}}function d4(e){if(c(e._unpackedValues))return!1;const t=e._classProperty,n=t.type,i=t.valueType;return n===bt.STRING||i===Ot.INT64&&!Yt.supportsBigInt64Array()||i===Ot.UINT64&&!Yt.supportsBigUint64Array()}function lue(e,t,n){if(d4(e))return!0;const i=e._arrayOffsets;if(c(i)){const o=i.get(t+1)-i.get(t),r=n.length;if(o!==r)return!0}return!1}function h4(e){e._unpackedValues=uue(e),e._arrayOffsets=void 0,e._stringOffsets=void 0,e._values=void 0}function uue(e){const t=e._count,n=new Array(t),i=e._classProperty,o=i.isArray,r=i.type,s=bt.getComponentCount(r);if(!o&&s===1){for(let a=0;a<t;++a)n[a]=e._getValue(a);return n}for(let a=0;a<t;a++)n[a]=u4(e,i,a);return n}function due(e,t){const i=e._classProperty.isVariableLengthArray;return!e._hasValueTransform||i?t:dr.valueTransformInPlace(t,e._offset,e._scale,Ot.applyValueTransform)}function hue(e,t){const i=e._classProperty.isVariableLengthArray;return!e._hasValueTransform||i?t:dr.valueTransformInPlace(t,e._offset,e._scale,Ot.unapplyValueTransform)}function Ww(e,t,n){const i=this;let o,r,s;if(t===Ot.INT64)Yt.supportsBigInt()?Yt.supportsBigInt64Array()?(o=new BigInt64Array(e.buffer,e.byteOffset,n),s=function(a,l){i.typedArray[a]=BigInt(l)}):(o=new Uint8Array(e.buffer,e.byteOffset,n*8),r=function(a){return rue(a,i)}):($n("INT64 type is not fully supported on this platform. Values greater than 2^53 - 1 or less than -(2^53 - 1) may lose precision when read."),o=new Uint8Array(e.buffer,e.byteOffset,n*8),r=function(a){return oue(a,i)});else if(t===Ot.UINT64)Yt.supportsBigInt()?Yt.supportsBigUint64Array()?(o=new BigUint64Array(e.buffer,e.byteOffset,n),s=function(a,l){i.typedArray[a]=BigInt(l)}):(o=new Uint8Array(e.buffer,e.byteOffset,n*8),r=function(a){return aue(a,i)}):($n("UINT64 type is not fully supported on this platform. Values greater than 2^53 - 1 may lose precision when read."),o=new Uint8Array(e.buffer,e.byteOffset,n*8),r=function(a){return sue(a,i)});else{const a=cue(t);o=Z.createArrayBufferView(a,e.buffer,e.byteOffset,n),s=function(l,u){i.typedArray[l]=u}}c(r)||(r=function(a){return i.typedArray[a]}),this.typedArray=o,this.dataView=new DataView(o.buffer,o.byteOffset),this.get=r,this.set=s,this._componentType=t}function Hs(e){e=y(e,y.EMPTY_OBJECT);const t=e.count,n=e.class;A.typeOf.number.greaterThan("options.count",t,0),A.typeOf.object("options.class",n);let i=0;const o={};if(c(e.properties)){for(const r in e.properties)if(e.properties.hasOwnProperty(r)){const s=new z0({count:t,property:e.properties[r],classProperty:n.properties[r],bufferViews:e.bufferViews});o[r]=s,i+=s.byteLength}}this._count=t,this._class=n,this._properties=o,this._byteLength=i}Object.defineProperties(Hs.prototype,{count:{get:function(){return this._count}},class:{get:function(){return this._class}},byteLength:{get:function(){return this._byteLength}}});Hs.prototype.hasProperty=function(e){return Rt.hasProperty(e,this._properties,this._class)};Hs.prototype.hasPropertyBySemantic=function(e){return Rt.hasPropertyBySemantic(e,this._properties,this._class)};Hs.prototype.getPropertyIds=function(e){return Rt.getPropertyIds(this._properties,this._class,e)};Hs.prototype.getProperty=function(e,t){A.typeOf.string("propertyId",t);const n=this._properties[t];let i;return c(n)?i=n.get(e):i=fue(this._class,t),i};Hs.prototype.setProperty=function(e,t,n){A.typeOf.string("propertyId",t);const i=this._properties[t];return c(i)?(i.set(e,n),!0):!1};Hs.prototype.getPropertyBySemantic=function(e,t){A.typeOf.string("semantic",t);let n;const i=this._class.propertiesBySemantic;if(c(i)&&(n=i[t]),c(n))return this.getProperty(e,n.id)};Hs.prototype.setPropertyBySemantic=function(e,t,n){A.typeOf.string("semantic",t);let i;const o=this._class.propertiesBySemantic;return c(o)&&(i=o[t]),c(i)?this.setProperty(e,i.id,n):!1};Hs.prototype.getPropertyTypedArray=function(e){A.typeOf.string("propertyId",e);const t=this._properties[e];if(c(t))return t.getTypedArray()};Hs.prototype.getPropertyTypedArrayBySemantic=function(e){A.typeOf.string("semantic",e);let t;const n=this._class.propertiesBySemantic;if(c(n)&&(t=n[e]),c(t))return this.getPropertyTypedArray(t.id)};function fue(e,t){const n=e.properties;if(!c(n))return;const i=n[t];if(c(i)&&c(i.default)){let o=i.default;return i.isArray&&(o=Je(o,!0)),o=i.normalize(o),i.unpackVectorAndMatrixTypes(o)}}function wo(){}Object.defineProperties(wo.prototype,{cacheKey:{get:function(){E.throwInstantiationError()}}});wo.prototype.load=function(){E.throwInstantiationError()};wo.prototype.unload=function(){};wo.prototype.process=function(e){return!1};wo.prototype.getError=function(e,t){A.typeOf.string("errorMessage",e),c(t)&&c(t.message)&&(e+=`
|
|
${t.message}`);const n=new Te(e);return c(t)&&(n.stack=`Original stack:
|
|
${t.stack}
|
|
Handler stack:
|
|
${n.stack}`),n};wo.prototype.isDestroyed=function(){return!1};wo.prototype.destroy=function(){return this.unload(),ve(this)};const pue={UNLOADED:0,LOADING:1,LOADED:2,PROCESSING:3,READY:4,FAILED:5},ut=Object.freeze(pue);function hl(e){e=y(e,y.EMPTY_OBJECT);const t=e.typedArray,n=e.resource,i=e.cacheKey;if(c(t)===c(n))throw new E("One of options.typedArray and options.resource must be defined.");this._typedArray=t,this._resource=n,this._cacheKey=i,this._state=ut.UNLOADED,this._promise=void 0}c(Object.create)&&(hl.prototype=Object.create(wo.prototype),hl.prototype.constructor=hl);Object.defineProperties(hl.prototype,{cacheKey:{get:function(){return this._cacheKey}},typedArray:{get:function(){return this._typedArray}}});hl.prototype.load=async function(){return c(this._promise)?this._promise:c(this._typedArray)?(this._promise=Promise.resolve(this),this._promise):(this._promise=mue(this),this._promise)};async function mue(e){const t=e._resource;e._state=ut.LOADING;try{const n=await hl._fetchArrayBuffer(t);return e.isDestroyed()?void 0:(e._typedArray=new Uint8Array(n),e._state=ut.READY,e)}catch(n){if(e.isDestroyed())return;e._state=ut.FAILED;const i=`Failed to load external buffer: ${t.url}`;throw e.getError(i,n)}}hl._fetchArrayBuffer=function(e){return e.fetchArrayBuffer()};hl.prototype.unload=function(){this._typedArray=void 0};(function(){var e="b9H79TebbbeJq9Geueu9Geub9Gbb9Gvuuuuueu9Gduueu9Gluuuueu9Gvuuuuub9Gouuuuuub9Gluuuub9GiuuueuiKLdilevlevlooroowwvwbDDbelve9Weiiviebeoweuec:W;kekr;RiOo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9FW9U9J9V9KW9wWVtW949c919M9MWVbe8F9TW79O9V9Wt9FW9U9J9V9KW9wWVtW949c919M9MWV9c9V919U9KbdE9TW79O9V9Wt9FW9U9J9V9KW9wWVtW949wWV79P9V9UbiY9TW79O9V9Wt9FW9U9J9V9KW69U9KW949c919M9MWVbl8E9TW79O9V9Wt9FW9U9J9V9KW69U9KW949c919M9MWV9c9V919U9Kbv8A9TW79O9V9Wt9FW9U9J9V9KW69U9KW949wWV79P9V9UboE9TW79O9V9Wt9FW9U9J9V9KW69U9KW949tWG91W9U9JWbra9TW79O9V9Wt9FW9U9J9V9KW69U9KW949tWG91W9U9JW9c9V919U9KbwL9TW79O9V9Wt9FW9U9J9V9KWS9P2tWV9p9JtbDK9TW79O9V9Wt9FW9U9J9V9KWS9P2tWV9r919HtbqL9TW79O9V9Wt9FW9U9J9V9KWS9P2tWVT949WbkE9TW79O9V9Wt9F9V9Wt9P9T9P96W9wWVtW94J9H9J9OWbPa9TW79O9V9Wt9F9V9Wt9P9T9P96W9wWVtW94J9H9J9OW9ttV9P9Wbsa9TW79O9V9Wt9F9V9Wt9P9T9P96W9wWVtW94SWt9J9O9sW9T9H9WbzK9TW79O9V9Wt9F79W9Ht9P9H29t9VVt9sW9T9H9WbHl79IV9RbODwebcekdQXq:g9sLdbk;3keYu8Jjjjjbcjo9Rgv8Kjjjjbcbhodnalcefae0mbabcbRb:S:kjjbc:GeV86bbavcjdfcbcjdzNjjjb8AdnaiTmbavcjdfadalz:tjjjb8Akabaefhrabcefhwavalfcbcbcjdal9RalcFe0EzNjjjb8Aavavcjdfalz:tjjjbhDcj;abal9UhodndndndndnalTmbaoc;WFbGgecjdaecjd6Ehqcbhkdninakai9pmiaDcjlfcbcjdzNjjjb8Aaqaiak9Rakaqfai6Egxcsfgecl4cifcd4hmadakal2fhPdndndndndnaec9WGgsTmbcbhzcehHaPhOawhAxekdnaxTmbcbhAcehHaPhCinaDaAfRbbhXaDcjlfheaChoaxhQinaeaoRbbgLaX9RgXcetaX;acr4786bbaoalfhoaecefheaLhXaQcufgQmbkaraw9Ram6miawcbamzNjjjbgeTmiaCcefhCaeamfhwaAcefgAal6hHaAal9hmbxvkkaraw9Ram6mvawcbamzNjjjb8AceheinawgXamfhwalaegoSmldnaraw9Ram6mbaocefheawcbamzNjjjb8AaXmekkaoal6hHxekindnaxTmbaDazfRbbhXaDcjlfheaOhoaxhQinaeaoRbbgLaX9RgXcetaX;acr4786bbaoalfhoaecefheaLhXaQcufgQmbkkaraA9Ram6mearaAcbamzNjjjbgKamfgw9RcK6mdcbhYaDcjlfhAinaDcjlfaYfh8AcwhCczhLcehQindndnaQce9hmbcuhoa8ARbbmecbhodninaogecsSmeaecefhoaAaefcefRbbTmbkkcucbaecs6EhoxekaQcetc;:FFFeGhocuaQtcu7cFeGhXcbheinaoaXaAaefRbb9nfhoaecefgecz9hmbkkaoaLaoaL6geEhLaQaCaeEhCaQcetgQcw6mbkdndndndnaCcufPdiebkaKaYco4fgeaeRbbcdciaCclSEaYci4coGtV86bbaCcw9hmeawa8A8Pbb83bbawcwfa8Acwf8Pbb83bbawczfhwxdkaKaYco4fgeaeRbbceaYci4coGtV86bbkdncwaC9TgEmbinawcb86bbawcefhwxbkkcuaCtcu7h8Acbh3aAh5ina5heaEhQcbhoinaeRbbgLa8AcFeGgXaLaX6EaoaCtVhoaecefheaQcufgQmbkawao86bba5aEfh5awcefhwa3aEfg3cz6mbkcbheindnaAaefRbbgoaX6mbawao86bbawcefhwkaecefgecz9hmbkkdnaYczfgYas9pmbaAczfhAaraw9RcL0mekkaYas6meawTmeaOcefhOazcefgzal6hHawhAazalSmixbkkcbhwaHceGTmexikcbhwaHceGmdkaDaPaxcufal2falz:tjjjb8AaxakfhkawmbkcbhoxokcbhoxvkaiTmekcbhoaraw9Ralcaalca0E6mialc8F9nmexdkcbhoaecufca6mdkawcbcaal9RgezNjjjbaefhwkawaDcjdfalz:tjjjbalfab9Rhokavcjof8Kjjjjbaok9heeuaecaaeca0Eabcj;abae9Uc;WFbGgdcjdadcjd6Egdfcufad9Uae2adcl4cifcd4adV2fcefkmbcbabBd:S:kjjbk;rse3u8Jjjjjbc;ae9Rgl8Kjjjjbcbhvdnaici9UgocHfae0mbabcbyd:C:kjjbgrc;GeV86bbalc;abfcFecjezNjjjb8AalcUfgw9cu83ibalc8WfgD9cu83ibalcyfgq9cu83ibalcafgk9cu83ibalcKfgx9cu83ibalczfgm9cu83ibal9cu83iwal9cu83ibabaefc9WfhPabcefgsaofhednaiTmbcmcsarcb9kgzEhHcbhOcbhAcbhCcbhXcbhQindnaeaP9nmbcbhvxikaQcufhvadaCcdtfgoydbhLaocwfydbhKaoclfydbhYcbh8Adndninalc;abfavcsGcitfgoydlhEdndndnaoydbgoaL9hmbaEaYSmekdnaoaY9hmbaEaK9hmba8Acefh8AxekaoaK9hmeaEaL9hmea8Acdfh8Aka8Ac870mdaXcufhvada8AciGcx2goc:y1jjbfydbaCfcdtfydbhEadaocN1jjbfydbaCfcdtfydbhKadaoc:q1jjbfydbaCfcdtfydbhLcbhodnindnalavcsGcdtfydbaE9hmbaohYxdkcuhYavcufhvaocefgocz9hmbkkaEaOSgvaYce9iaYaH9oVgoGh3dndndndndncbcsavEaYaoEgvcs9hmbarce9imbaEaEaAaEcefaASgvEgAcefSmecmcsavEhvkasava8Acdtc;WeGV86bbavcs9hmeaEaA9Rgvcetavc8F917hvinaeavcFb0crtavcFbGV86bbaecefheavcje6hoavcr4hvaoTmbkaEhAxdkcPhvasa8AcdtcPV86bbaEhAkavTmbavaH9imekalaXcdtfaEBdbaXcefcsGhXkaOa3fhOalc;abfaQcitfgvaKBdlavaEBdbalc;abfaQcefcsGgvcitfgoaEBdlaoaLBdbavcefhoxikavcufhva8Aclfg8Ac;ab9hmbkkdnadceaKaOScetaYaOSEcx2gvc:q1jjbfydbaCfcdtfydbgLTadavcN1jjbfydbaCfcdtfydbg8AceSGadavc:y1jjbfydbaCfcdtfydbgYcdSGaOcb9hGazGg5ce9hmbaw9cu83ibaD9cu83ibaq9cu83ibak9cu83ibax9cu83ibam9cu83ibal9cu83iwal9cu83ibcbhOkcbhEaXcufgvhodnindnalaocsGcdtfydba8A9hmbaEhKxdkcuhKaocufhoaEcefgEcz9hmbkkcbhodnindnalavcsGcdtfydbaY9hmbaohExdkcuhEavcufhvaocefgocz9hmbkkaOaLaOSg8Efh3dndnaKcm0mbaKcefhKxekcbcsa8Aa3SgvEhKa3avfh3kdndnaEcm0mbaEcefhExekcbcsaYa3SgvEhEa3avfh3kc9:cua8EEh8FaEaKcltVhocbhvdndndninavcj1jjbfRbbaocFeGSmeavcefgvcz9hmbxdkka5aLaO9havcm0VVmbasavc;WeV86bbxekasa8F86bbaeao86bbaecefhekdna8EmbaLaA9Rgvcetavc8F917hvinaeavcFb0gocrtavcFbGV86bbavcr4hvaecefheaombkaLhAkdnaKcs9hmba8AaA9Rgvcetavc8F917hvinaeavcFb0gocrtavcFbGV86bbavcr4hvaecefheaombka8AhAkdnaEcs9hmbaYaA9Rgvcetavc8F917hvinaeavcFb0gocrtavcFbGV86bbavcr4hvaecefheaombkaYhAkalaXcdtfaLBdbaXcefcsGhvdndnaKPzbeeeeeeeeeeeeeebekalavcdtfa8ABdbaXcdfcsGhvkdndnaEPzbeeeeeeeeeeeeeebekalavcdtfaYBdbavcefcsGhvkalc;abfaQcitfgoaLBdlaoa8ABdbalc;abfaQcefcsGcitfgoa8ABdlaoaYBdbalc;abfaQcdfcsGcitfgoaYBdlaoaLBdbaQcifhoavhXa3hOkascefhsaocsGhQaCcifgCai6mbkkcbhvaeaP0mbcbhvinaeavfavcj1jjbfRbb86bbavcefgvcz9hmbkaeab9Ravfhvkalc;aef8KjjjjbavkZeeucbhddninadcefgdc8F0meceadtae6mbkkadcrfcFeGcr9Uci2cdfabci9U2cHfkmbcbabBd:C:kjjbk:ydewu8Jjjjjbcz9Rhlcbhvdnaicvfae0mbcbhvabcbRb:C:kjjbc;qeV86bbal9cb83iwabcefhoabaefc98fhrdnaiTmbcbhwcbhDindnaoar6mbcbskadaDcdtfydbgqalcwfawaqav9Rgvavc8F91gv7av9Rc507gwcdtfgkydb9Rgvc8E91c9:Gavcdt7awVhvinaoavcFb0gecrtavcFbGV86bbavcr4hvaocefhoaembkakaqBdbaqhvaDcefgDai9hmbkkcbhvaoar0mbaocbBbbaoab9RclfhvkavkBeeucbhddninadcefgdc8F0meceadtae6mbkkadcwfcFeGcr9Uab2cvfk:dvli99dui99ludnaeTmbcuadcetcuftcu7:Yhvdndncuaicuftcu7:YgoJbbbZMgr:lJbbb9p9DTmbar:Ohwxekcjjjj94hwkcbhicbhDinalclfIdbgrJbbbbJbbjZalIdbgq:lar:lMalcwfIdbgk:lMgr:varJbbbb9BEgrNhxaqarNhralcxfIdbhqdndnakJbbbb9GTmbaxhkxekJbbjZar:l:tgkak:maxJbbbb9GEhkJbbjZax:l:tgxax:marJbbbb9GEhrkdndnaqJbbj:;aqJbbj:;9GEgxJbbjZaxJbbjZ9FEavNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohmxekcjjjj94hmkdndnakJbbj:;akJbbj:;9GEgqJbbjZaqJbbjZ9FEaoNJbbbZJbbb:;akJbbbb9GEMgq:lJbbb9p9DTmbaq:OhPxekcjjjj94hPkdndnarJbbj:;arJbbj:;9GEgqJbbjZaqJbbjZ9FEaoNJbbbZJbbb:;arJbbbb9GEMgr:lJbbb9p9DTmbar:Ohsxekcjjjj94hskdndnadcl9hmbabaifgzas86bbazcifam86bbazcdfaw86bbazcefaP86bbxekabaDfgzas87ebazcofam87ebazclfaw87ebazcdfaP87ebkalczfhlaiclfhiaDcwfhDaecufgembkkk;klld99eud99eudnaeTmbdndncuaicuftcu7:YgvJbbbZMgo:lJbbb9p9DTmbao:Ohixekcjjjj94hikaic;8FiGhrinabcofcicdalclfIdb:lalIdb:l9EgialcwfIdb:lalaicdtfIdb:l9EEgialcxfIdb:lalaicdtfIdb:l9EEgiarV87ebdndnalaicefciGcdtfIdbJ;Zl:1ZNJbbj:;JbbjZalaicdtfIdbJbbbb9DEgoNgwJbbj:;awJbbj:;9GEgDJbbjZaDJbbjZ9FEavNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohqxekcjjjj94hqkabaq87ebdndnaoalaicdfciGcdtfIdbJ;Zl:1ZNNgwJbbj:;awJbbj:;9GEgDJbbjZaDJbbjZ9FEavNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohqxekcjjjj94hqkabcdfaq87ebdndnaoalaicufciGcdtfIdbJ;Zl:1ZNNgoJbbj:;aoJbbj:;9GEgwJbbjZawJbbjZ9FEavNJbbbZJbbb:;aoJbbbb9GEMgo:lJbbb9p9DTmbao:Ohixekcjjjj94hikabclfai87ebabcwfhbalczfhlaecufgembkkk:Hvdxue998Jjjjjbcjd9Rgo8Kjjjjbadcd4hrdndndndnavcd9hmbadcl6mearcearce0EhwaohDinaDc:CuBdbaDclfhDawcufgwmbkaeTmiadcl6mdarcearce0EhqarcdthkalhxcbhminaohDaxhwaqhPinaDaDydbgsawydbgzcL4cFeGc:cufcbazEgzasaz9kEBdbawclfhwaDclfhDaPcufgPmbkaxakfhxamcefgmae9hmbkkaeTmdxekaeTmekavcb9hadcl6gqVhHarcearce0Ehkarcdthrceai9Rhmcbhdindndndnavce9hmbaqmdc:CuhwalhDakhPinawaDydbgscL4cFeGc:cufcbasEgsawas9kEhwaDclfhDaPcufgPmbxdkkc:CuhwaHmbaohDalhPakhsinaDaPydbgzcL4cFeGgxc8Aaxc8A9kEc:cufcbazEBdbaPclfhPaDclfhDascufgsmbkkaqmbcbhDakhsinawhPdnavceSmbaoaDfydbhPkdndnalaDfIdbgOcjjj;8iamaPfgPcLt9R::NJbbbZJbbb:;aOJbbbb9GEMgO:lJbbb9p9DTmbaO:Ohzxekcjjjj94hzkabaDfazcFFFrGaPcKtVBdbaDclfhDascufgsmbkkabarfhbalarfhladcefgdae9hmbkkaocjdf8KjjjjbkFkdCui998Jjjjjbc:Gd9Rgv8Kjjjjbavc:4efcbc;KbzNjjjb8AcbhodnadTmbcbhoaiTmbdnabae9hmbavcuadcdtgoadcFFFFi0Ecbyd:K:kjjbHjjjjbbgeBd:4eavceBd:ydaeabaoz:tjjjb8Akavc:OefcwfcbBdbav9cb83i:Oeavc:Oefaeadaiavc:4efz:njjjbcuaicdtgraicFFFFi0Egwcbyd:K:kjjbHjjjjbbhoavc:4efavyd:ydgDcdtfaoBdbavaDcefgqBd:ydaoavyd:Oegkarz:tjjjbhxavc:4efaqcdtfadci9Ugmcbyd:K:kjjbHjjjjbbgoBdbavaDcdfgrBd:ydaocbamzNjjjbhPavc:4efarcdtfawcbyd:K:kjjbHjjjjbbgsBdbavaDcifgqBd:ydaxhoashrinaralIdbalaoydbgwcwawcw6Ecdtfc;ebfIdbMUdbaoclfhoarclfhraicufgimbkavc:4efaqcdtfcuamcdtadcFFFF970Ecbyd:K:kjjbHjjjjbbgqBdbavaDclfBd:yddnadci6mbamceamce0EhiaehoaqhrinarasaoydbcdtfIdbasaoclfydbcdtfIdbMasaocwfydbcdtfIdbMUdbaocxfhoarclfhraicufgimbkkavc;qbfhzavhoavyd:SehHavyd:WehOcbhwcbhrcbhAcehCinaohXcihQaearci2gLcdtfgocwfydbhdaoydbhDabaAcx2fgiclfaoclfydbgKBdbaiaDBdbaicwfadBdbaParfce86bbazadBdwazaKBdlazaDBdbaqarcdtfcbBdbdnawTmbcihQaXhiinazaQcdtfaiydbgoBdbaQaoaD9haoaK9hGaoad9hGfhQaiclfhiawcufgwmbkkaAcefhAaxaDcdtfgoaoydbcufBdbaxaKcdtfgoaoydbcufBdbaxadcdtfgoaoydbcufBdbcbhwinaOaHaeawaLfcdtfydbcdtgifydbcdtfgKhoakaifgDydbgdhidnadTmbdninaoydbarSmeaoclfhoaicufgiTmdxbkkaoadcdtaKfc98fydbBdbaDaDydbcufBdbkawcefgwci9hmbkdndndnaQTmbcuhrJbbbbhYcbhDavyd:SehKavyd:WehLindndnakazaDcdtfydbcdtgofydbgimbaDcefhDxekaDcs0hwasaofgdIdbh8AadalcbaDcefgDawEcdtfIdbalaxaofydbgwcwawcw6Ecdtfc;ebfIdbMgEUdbaEa8A:thEaicdthiaLaKaofydbcdtfhoinaqaoydbgwcdtfgdaEadIdbMg8AUdba8AaYaYa8A9DgdEhYawaradEhraoclfhoaic98fgimbkkaDaQ9hmbkarcu9hmekaCam9pmeindnaPaCfRbbmbaChrxdkamaCcefgC9hmbxdkkaQczaQcz6EhwazhoaXhzarcu9hmekkavyd:ydhokaocdtavc:4effc98fhrdninaoTmearydbcbyd:G:kjjbH:bjjjbbarc98fhraocufhoxbkkavc:Gdf8Kjjjjbk;UlevucuaicdtgvaicFFFFi0Egocbyd:K:kjjbHjjjjbbhralalyd9GgwcdtfarBdbalawcefBd9GabarBdbaocbyd:K:kjjbHjjjjbbhralalyd9GgocdtfarBdbalaocefBd9GabarBdlcuadcdtadcFFFFi0Ecbyd:K:kjjbHjjjjbbhralalyd9GgocdtfarBdbalaocefBd9GabarBdwabydbcbavzNjjjb8Aadci9UhwdnadTmbabydbhoaehladhrinaoalydbcdtfgvavydbcefBdbalclfhlarcufgrmbkkdnaiTmbabydbhlabydlhrcbhvaihoinaravBdbarclfhralydbavfhvalclfhlaocufgombkkdnadci6mbawceawce0EhDabydlhrabydwhvcbhlinaecwfydbhoaeclfydbhdaraeydbcdtfgwawydbgwcefBdbavawcdtfalBdbaradcdtfgdadydbgdcefBdbavadcdtfalBdbaraocdtfgoaoydbgocefBdbavaocdtfalBdbaecxfheaDalcefgl9hmbkkdnaiTmbabydlheabydbhlinaeaeydbalydb9RBdbalclfhlaeclfheaicufgimbkkkQbabaeadaic:01jjbz:mjjjbkQbabaeadaic:C:jjjbz:mjjjbk9DeeuabcFeaicdtzNjjjbhlcbhbdnadTmbindnalaeydbcdtfgiydbcu9hmbaiabBdbabcefhbkaeclfheadcufgdmbkkabk;:kivuo99lu8Jjjjjbcj;Hb9Rgl8Kjjjjbcbhvalc1;Gbfcbc;KbzNjjjb8AalcuadcdtadcFFFFi0Egocbyd:K:kjjbHjjjjbbgrBd19GalceBd;O9Galcwfcbyd:m:kjjbBdbalcb8Pd:e:kjjb83ibalc;W;Gbfcwfcbyd:y:kjjbBdbalcb8Pd:q:kjjb83i;W9Gaicd4hwdndnadmbJFFuFhDJFFuuhqJFFuuhkJFFuFhxJFFuuhmJFFuFhPxekawcdthsaehzincbhiinalaifgHazaifIdbgDaHIdbgxaxaD9EEUdbalc;W;GbfaifgHaDaHIdbgxaxaD9DEUdbaiclfgicx9hmbkazasfhzavcefgvad9hmbkalIdwhqalId;49GhDalIdlhkalId;09GhxalIdbhmalId;W9GhPkdndnadTmbJbbbbJbbjZaPam:tJbbbb:xgPaxak:tgxaxaP9DEgxaDaq:tgDaDax9DEgD:vaDJbbbb9BEhDawcdthsarhHadhzindndnaDaeIdbam:tNJb;au9eNJbbbZMgx:lJbbb9p9DTmbax:Ohixekcjjjj94hikaicztaicwtcj;GiGVaicsGVc:p;G:dKGcH2c;d;H:WKGcv2c;j:KM;jbGhvdndnaDaeclfIdbak:tNJb;au9eNJbbbZMgx:lJbbb9p9DTmbax:Ohixekcjjjj94hikaicztaicwtcj;GiGVaicsGVc:p;G:dKGcH2c;d;H:WKGcq2cM;j:KMeGavVhvdndnaDaecwfIdbaq:tNJb;au9eNJbbbZMgx:lJbbb9p9DTmbax:Ohixekcjjjj94hikaHavaicztaicwtcj;GiGVaicsGVc:p;G:dKGcH2c;d;H:WKGcC2c:KM;j:KdGVBdbaeasfheaHclfhHazcufgzmbkalcbcj;GbzNjjjbhiarhHadheinaiaHydbgzcFrGcx2fgvavydbcefBdbaiazcq4cFrGcx2fgvavydlcefBdlaiazcC4cFrGcx2fgzazydwcefBdwaHclfhHaecufgembxdkkalcbcj;GbzNjjjb8AkcbhHcbhzcbhecbhvinalaHfgiydbhsaiazBdbaicwfgwydbhOawavBdbaiclfgiydbhwaiaeBdbasazfhzaOavfhvawaefheaHcxfgHcj;Gb9hmbkcbhialaocbyd:K:kjjbHjjjjbbgzBd:m9GdnadTmbabhHinaHaiBdbaHclfhHadaicefgi9hmbkadTmbabhiadhHinalaraiydbgecdtfydbcFrGcx2fgvavydbgvcefBdbazavcdtfaeBdbaiclfhiaHcufgHmbkazhiadhHinalaraiydbgecdtfydbcq4cFrGcx2fgvavydlgvcefBdlabavcdtfaeBdbaiclfhiaHcufgHmbkabhiadhHinalaraiydbgecdtfydbcC4cFrGcx2fgvavydwgvcefBdwazavcdtfaeBdbaiclfhiaHcufgHmbkadTmbcbhiinabazydbcdtfaiBdbazclfhzadaicefgi9hmbkkclhidninaic98Smealc1;Gbfaifydbcbyd:G:kjjbH:bjjjbbaic98fhixbkkalcj;Hbf8Kjjjjbk9teiucbcbyd:O:kjjbgeabcifc98GfgbBd:O:kjjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaeczfheaiczfhiadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabk9teiucbcbyd:O:kjjbgeabcrfc94GfgbBd:O:kjjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik9:eiuZbhedndncbyd:O:kjjbgdaecztgi9nmbcuheadai9RcFFifcz4nbcuSmekadhekcbabae9Rcifc98Gcbyd:O:kjjbfgdBd:O:kjjbdnadZbcztge9nmbadae9RcFFifcz4nb8Akkk:6ddbcjwk:Cdb4:h9w9N94:P:gW:j9O:ye9Pbbbbbbebbbdbbbebbbdbbbbbbbdbbbbbbbebbbbbbb:l29hZ;69:9kZ;N;76Z;rg97Z;z;o9xZ8J;B85Z;:;u9yZ;b;k9HZ:2;Z9DZ9e:l9mZ59A8KZ:r;T3Z:A:zYZ79OHZ;j4::8::Y:D9V8:bbbb9s:49:Z8R:hBZ9M9M;M8:L;z;o8:;8:PG89q;x:J878R:hQ8::M:B;e87bbbbbbjZbbjZbbjZ:E;V;N8::Y:DsZ9i;H;68:xd;R8:;h0838:;W:NoZbbbb:WV9O8:uf888:9i;H;68:9c9G;L89;n;m9m89;D8Ko8:bbbbf:8tZ9m836ZS:2AZL;zPZZ818EZ9e:lxZ;U98F8:819E;68:FFuuFFuuFFuuFFuFFFuFFFuFbc:Cqkzebbbebbbdbbb8WWbb",t=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if(typeof WebAssembly!="object")return{supported:!1};var n,i=WebAssembly.instantiate(o(e),{}).then(function(g){n=g.instance,n.exports.__wasm_call_ctors(),n.exports.meshopt_encodeVertexVersion(0),n.exports.meshopt_encodeIndexVersion(1)});function o(g){for(var m=new Uint8Array(g.length),b=0;b<g.length;++b){var T=g.charCodeAt(b);m[b]=T>96?T-97:T>64?T-39:T+4}for(var x=0,b=0;b<g.length;++b)m[x++]=m[b]<60?t[m[b]]:(m[b]-60)*64+m[++b];return m.buffer.slice(0,x)}function r(g){if(!g)throw new Error("Assertion failed")}function s(g){return new Uint8Array(g.buffer,g.byteOffset,g.byteLength)}function a(g,m,b,T){var x=n.exports.sbrk,C=x(m.length*4),w=x(b*4),v=new Uint8Array(n.exports.memory.buffer),P=s(m);v.set(P,C),T&&T(C,C,m.length,b);var N=g(w,C,m.length,b);v=new Uint8Array(n.exports.memory.buffer);var k=new Uint32Array(b);new Uint8Array(k.buffer).set(v.subarray(w,w+b*4)),P.set(v.subarray(C,C+m.length*4)),x(C-x(0));for(var M=0;M<m.length;++M)m[M]=k[m[M]];return[k,N]}function l(g,m,b,T){var x=n.exports.sbrk,C=x(b*4),w=x(b*T),v=new Uint8Array(n.exports.memory.buffer);v.set(s(m),w),g(C,w,b,T),v=new Uint8Array(n.exports.memory.buffer);var P=new Uint32Array(b);return new Uint8Array(P.buffer).set(v.subarray(C,C+b*4)),x(C-x(0)),P}function u(g,m,b,T,x){var C=n.exports.sbrk,w=C(m),v=C(T*x),P=new Uint8Array(n.exports.memory.buffer);P.set(s(b),v);var N=g(w,m,v,T,x),k=new Uint8Array(N);return k.set(P.subarray(w,w+N)),C(w-C(0)),k}function h(g){for(var m=0,b=0;b<g.length;++b){var T=g[b];m=m<T?T:m}return m}function f(g,m){if(r(m==2||m==4),m==4)return new Uint32Array(g.buffer,g.byteOffset,g.byteLength/4);var b=new Uint16Array(g.buffer,g.byteOffset,g.byteLength/2);return new Uint32Array(b)}function _(g,m,b,T,x,C,w){var v=n.exports.sbrk,P=v(b*T),N=v(b*C),k=new Uint8Array(n.exports.memory.buffer);k.set(s(m),N),g(P,b,T,x,N,w);var M=new Uint8Array(b*T);return M.set(k.subarray(P,P+b*T)),v(P-v(0)),M}return{ready:i,supported:!0,reorderMesh:function(g,m,b){var T=m?b?n.exports.meshopt_optimizeVertexCacheStrip:n.exports.meshopt_optimizeVertexCache:void 0;return a(n.exports.meshopt_optimizeVertexFetchRemap,g,h(g)+1,T)},reorderPoints:function(g,m){return r(g instanceof Float32Array),r(g.length%m==0),r(m>=3),l(n.exports.meshopt_spatialSortRemap,g,g.length/m,m*4)},encodeVertexBuffer:function(g,m,b){r(b>0&&b<=256),r(b%4==0);var T=n.exports.meshopt_encodeVertexBufferBound(m,b);return u(n.exports.meshopt_encodeVertexBuffer,T,g,m,b)},encodeIndexBuffer:function(g,m,b){r(b==2||b==4),r(m%3==0);var T=f(g,b),x=n.exports.meshopt_encodeIndexBufferBound(m,h(T)+1);return u(n.exports.meshopt_encodeIndexBuffer,x,T,m,4)},encodeIndexSequence:function(g,m,b){r(b==2||b==4);var T=f(g,b),x=n.exports.meshopt_encodeIndexSequenceBound(m,h(T)+1);return u(n.exports.meshopt_encodeIndexSequence,x,T,m,4)},encodeGltfBuffer:function(g,m,b,T){var x={ATTRIBUTES:this.encodeVertexBuffer,TRIANGLES:this.encodeIndexBuffer,INDICES:this.encodeIndexSequence};return r(x[T]),x[T](g,m,b)},encodeFilterOct:function(g,m,b,T){return r(b==4||b==8),r(T>=1&&T<=16),_(n.exports.meshopt_encodeFilterOct,g,m,b,T,16)},encodeFilterQuat:function(g,m,b,T){return r(b==8),r(T>=4&&T<=16),_(n.exports.meshopt_encodeFilterQuat,g,m,b,T,16)},encodeFilterExp:function(g,m,b,T,x){r(b>0&&b%4==0),r(T>=1&&T<=24);var C={Separate:0,SharedVector:1,SharedComponent:2};return _(n.exports.meshopt_encodeFilterExp,g,m,b,T,b,x?C[x]:1)}}})();var _ue=function(){var e="b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuikqbeeedddillviebeoweuec:q;iekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbol79IV9Rbrq;d8Yqdbk:yzeHu8Jjjjjbcj;eb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Radz1jjjbhwcj;abad9UhlaicefhodnadTmbalc;WFbGglcjdalcjd6EhDcbhqinaqae9pmeaDaeaq9RaqaDfae6Egkcsfglcl4cifcd4hxdndndndnalc9WGgmTmbcbhPcehsawcjdfhzaohHinaraH9Rax6midnaraHaxfgo9RcK6mbczhlcbhOinalgic9WfgAawcj;cbffhldndndndndnaHaAco4fRbbaOcoG4ciGPlbedibkal9cb83ibalcwf9cb83ibxikalaoRblaoRbbgAco4gCaCciSgCE86bbawcj;cbfaifglcGfaoclfaCfgCRbbaAcl4ciGgXaXciSgXE86bbalcVfaCaXfgCRbbaAcd4ciGgXaXciSgXE86bbalc7faCaXfgCRbbaAciGgAaAciSgAE86bbalctfaCaAfgCRbbaoRbegAco4gXaXciSgXE86bbalc91faCaXfgCRbbaAcl4ciGgXaXciSgXE86bbalc4faCaXfgCRbbaAcd4ciGgXaXciSgXE86bbalc93faCaXfgCRbbaAciGgAaAciSgAE86bbalc94faCaAfgCRbbaoRbdgAco4gXaXciSgXE86bbalc95faCaXfgCRbbaAcl4ciGgXaXciSgXE86bbalc96faCaXfgCRbbaAcd4ciGgXaXciSgXE86bbalc97faCaXfgCRbbaAciGgAaAciSgAE86bbalc98faCaAfgARbbaoRbigoco4gCaCciSgCE86bbalc99faAaCfgARbbaocl4ciGgCaCciSgCE86bbalc9:faAaCfgARbbaocd4ciGgCaCciSgCE86bbalcufaAaCfglRbbaociGgoaociSgoE86bbalaofhoxdkalaoRbwaoRbbgAcl4gCaCcsSgCE86bbawcj;cbfaifglcGfaocwfaCfgCRbbaAcsGgAaAcsSgAE86bbalcVfaCaAfgARbbaoRbegCcl4gXaXcsSgXE86bbalc7faAaXfgARbbaCcsGgCaCcsSgCE86bbalctfaAaCfgARbbaoRbdgCcl4gXaXcsSgXE86bbalc91faAaXfgARbbaCcsGgCaCcsSgCE86bbalc4faAaCfgARbbaoRbigCcl4gXaXcsSgXE86bbalc93faAaXfgARbbaCcsGgCaCcsSgCE86bbalc94faAaCfgARbbaoRblgCcl4gXaXcsSgXE86bbalc95faAaXfgARbbaCcsGgCaCcsSgCE86bbalc96faAaCfgARbbaoRbvgCcl4gXaXcsSgXE86bbalc97faAaXfgARbbaCcsGgCaCcsSgCE86bbalc98faAaCfgARbbaoRbogCcl4gXaXcsSgXE86bbalc99faAaXfgARbbaCcsGgCaCcsSgCE86bbalc9:faAaCfgARbbaoRbrgocl4gCaCcsSgCE86bbalcufaAaCfglRbbaocsGgoaocsSgoE86bbalaofhoxekalao8Pbb83bbalcwfaocwf8Pbb83bbaoczfhokdnaiam9pmbaOcdfhOaiczfhlarao9RcL0mekkaiam6miaoTmidnakTmbawaPfRbbhOawcj;cbfhlazhiakhAinaialRbbgHce4cbaHceG9R7aOfgO86bbaiadfhialcefhlaAcufgAmbkkazcefhzaPcefgPad6hsaohHaPad9hmexvkkcbhoasceGmdxikaoaxad2fhXdnakTmbcbhmcehsawcjdfhCinarao9Rax6miaoTmdaoaxfhoawamfRbbhOawcj;cbfhlaChiakhAinaialRbbgHce4cbaHceG9R7aOfgO86bbaiadfhialcefhlaAcufgAmbkaCcefhCamcefgmad6hsamad9hmbkaXhoxikcbhlcehsinarao9Rax6mdaoTmeaoaxfhoalcefglad6hsadal9hmbkaXhoxdkcbhoasceGTmekc9:hoxikabaqad2fawcjdfakad2z1jjjb8Aawawcjdfakcufad2fadz1jjjb8Aakaqfhqaombkc9:hoxekcbc99arao9Radcaadca0ESEhokavcj;ebf8Kjjjjbaok;xzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecjez:jjjjb8AavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhrcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgDc;Ve0mbavc;abfalaDcu7gPcl4fcsGcitfgsydlhzasydbhHdnaDcsGgDak9pmbavaiaPfcsGcdtfydbaxaDEhsaDThDdndnadcd9hmbabarcetfgPaH87ebaPcdfaz87ebaPclfas87ebxekabarcdtfgPaHBdbaPclfazBdbaPcwfasBdbkaxaDfhxavc;abfalcitfgPasBdbaPazBdlavaicdtfasBdbavc;abfalcefcsGglcitfgPaHBdbaPasBdlaiaDfhialcefhlxdkdndnaDcsSmbamaDfaDc987fcefhmxekaocefhDao8SbbgscFeGhPdndnascu9mmbaDhoxekaocvfhoaPcFbGhPcrhsdninaD8SbbgOcFbGastaPVhPaOcu9kmeaDcefhDascrfgsc8J9hmbxdkkaDcefhokaPce4cbaPceG9R7amfhmkdndnadcd9hmbabarcetfgDaH87ebaDcdfaz87ebaDclfam87ebxekabarcdtfgDaHBdbaDclfazBdbaDcwfamBdbkavc;abfalcitfgDamBdbaDazBdlavaicdtfamBdbavc;abfalcefcsGglcitfgDaHBdbaDamBdlaicefhialcefhlxekdnaDcpe0mbaxcefgOavaiaqaDcsGfRbbgscl49RcsGcdtfydbascz6gPEhDavaias9RcsGcdtfydbaOaPfgzascsGgOEhsaOThOdndnadcd9hmbabarcetfgHax87ebaHcdfaD87ebaHclfas87ebxekabarcdtfgHaxBdbaHclfaDBdbaHcwfasBdbkavaicdtfaxBdbavc;abfalcitfgHaDBdbaHaxBdlavaicefgicsGcdtfaDBdbavc;abfalcefcsGcitfgHasBdbaHaDBdlavaiaPfcsGgicdtfasBdbavc;abfalcdfcsGglcitfgDaxBdbaDasBdlalcefhlaiaOfhiazaOfhxxekaxcbaoRbbgHEgAaDc;:eSgDfhzaHcsGhCaHcl4hXdndnaHcs0mbazcefhOxekazhOavaiaX9RcsGcdtfydbhzkdndnaCmbaOcefhxxekaOhxavaiaH9RcsGcdtfydbhOkdndnaDTmbaocefhDxekaocdfhDao8SbegPcFeGhsdnaPcu9kmbaocofhAascFbGhscrhodninaD8SbbgPcFbGaotasVhsaPcu9kmeaDcefhDaocrfgoc8J9hmbkaAhDxekaDcefhDkasce4cbasceG9R7amfgmhAkdndnaXcsSmbaDhsxekaDcefhsaD8SbbgocFeGhPdnaocu9kmbaDcvfhzaPcFbGhPcrhodninas8SbbgDcFbGaotaPVhPaDcu9kmeascefhsaocrfgoc8J9hmbkazhsxekascefhskaPce4cbaPceG9R7amfgmhzkdndnaCcsSmbashoxekascefhoas8SbbgDcFeGhPdnaDcu9kmbascvfhOaPcFbGhPcrhDdninao8SbbgscFbGaDtaPVhPascu9kmeaocefhoaDcrfgDc8J9hmbkaOhoxekaocefhokaPce4cbaPceG9R7amfgmhOkdndnadcd9hmbabarcetfgDaA87ebaDcdfaz87ebaDclfaO87ebxekabarcdtfgDaABdbaDclfazBdbaDcwfaOBdbkavc;abfalcitfgDazBdbaDaABdlavaicdtfaABdbavc;abfalcefcsGcitfgDaOBdbaDazBdlavaicefgicsGcdtfazBdbavc;abfalcdfcsGcitfgDaABdbaDaOBdlavaiaHcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiarcifgrae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:flevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:Lvoeue99dud99eud99dndnadcl9hmbaeTmeindndnabcdfgd8Sbb:Yab8Sbbgi:Ygl:l:tabcefgv8Sbbgo:Ygr:l:tgwJbb;:9cawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai86bbdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad86bbdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad86bbabclfhbaecufgembxdkkaeTmbindndnabclfgd8Ueb:Yab8Uebgi:Ygl:l:tabcdfgv8Uebgo:Ygr:l:tgwJb;:FSawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai87ebdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad87ebdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad87ebabcwfhbaecufgembkkk;siliui99iue99dnaeTmbcbhiabhlindndnJ;Zl81Zalcof8UebgvciV:Y:vgoal8Ueb:YNgrJb;:FSNJbbbZJbbb:;arJbbbb9GEMgw:lJbbb9p9DTmbaw:OhDxekcjjjj94hDkalclf8Uebhqalcdf8UebhkabaiavcefciGfcetfaD87ebdndnaoak:YNgwJb;:FSNJbbbZJbbb:;awJbbbb9GEMgx:lJbbb9p9DTmbax:Ohkxekcjjjj94hkkabaiavcdfciGfcetfak87ebdndnaoaq:YNgoJb;:FSNJbbbZJbbb:;aoJbbbb9GEMgx:lJbbb9p9DTmbax:Ohqxekcjjjj94hqkabaiavcufciGfcetfaq87ebdndnJbbjZararN:tawawN:taoaoN:tgrJbbbbarJbbbb9GE:rJb;:FSNJbbbZMgr:lJbbb9p9DTmbar:Ohqxekcjjjj94hqkabaiavciGfcetfaq87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2gdTmbinababydbgecwtcw91:Yaece91cjjj98Gcjjj;8if::NUdbabclfhbadcufgdmbkkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaeczfheaiczfhiadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkkkebcjwklz9Kbb",t="b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuikqbbebeedddilve9Weeeviebeoweuec:q;Aekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbwl79IV9RbDq;b9tqlbzik9:evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaec:q:yjjbfai86bbaecitc:q1jjbfab8Piw83ibaecefgecjd9hmbkk;e8JlHud97euo978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Rad;8qbbcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhwcbhDinaDae9pmeawaeaD9RaDawfae6Egqcsfgoc9WGgkci2hxakcethmaocl4cifcd4hPabaDad2fhscbhzdnincbhHalhOcbhAdninaraO9RaP6miavcj;cbfaAak2fhCaOaPfhlcbhidnakc;ab6mbaral9Rc;Gb6mbcbhoinaCaofhidndndndndnaOaoco4fRbbgXciGPlbedibkaipxbbbbbbbbbbbbbbbbpklbxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklbalczfhlkdndndndndnaXcd4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklzxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklzalczfhlkdndndndndnaXcl4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklaxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklaalczfhlkdndndndndnaXco4Plbedibkaipxbbbbbbbbbbbbbbbbpkl8WxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalclfaYpQbfaXc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalcwfaYpQbfaXc:q:yjjbfRbbfhlxekaialpbbbpkl8Walczfhlkaoc;abfhiaocjefak0meaihoaral9Rc;Fb0mbkkdndnaiak9pmbaici4hoinaral9RcK6mdaCaifhXdndndndndnaOaico4fRbbaocoG4ciGPlbedibkaXpxbbbbbbbbbbbbbbbbpklbxikaXalpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaXalpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaXalpbbbpklbalczfhlkaocdfhoaiczfgiak6mbkkalTmbaAcd0hHalhOaAcefgAclSmdxekkcbhlaHceGTmdkdnakTmbavcjdfazfhiavazfpbdbhYcbhXinaiavcj;cbfaXfgopblbgLcep9TaLpxeeeeeeeeeeeeeeeegQp9op9Hp9rgLaoakfpblbg8Acep9Ta8AaQp9op9Hp9rg8ApmbzeHdOiAlCvXoQrLgEaoamfpblbg3cep9Ta3aQp9op9Hp9rg3aoaxfpblbg5cep9Ta5aQp9op9Hp9rg5pmbzeHdOiAlCvXoQrLg8EpmbezHdiOAlvCXorQLgQaQpmbedibedibedibediaYp9UgYp9AdbbaiadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaEa8EpmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwKDYq8AkEx3m5P8Es8FgLa3a5pmwKDYq8AkEx3m5P8Es8Fg8ApmbezHdiOAlvCXorQLgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfhiaXczfgXak6mbkkazclfgzad6mbkasavcjdfaqad2;8qbbavavcjdfaqcufad2fad;8qbbaqaDfhDc9:hoalmexikkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;kbf8Kjjjjbaokwbz:bjjjbk;tzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecje;8kbavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhrcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgDc;Ve0mbavc;abfalaDcu7gPcl4fcsGcitfgsydlhzasydbhHdnaDcsGgDak9pmbavaiaPfcsGcdtfydbaxaDEhsaDThDdndnadcd9hmbabarcetfgPaH87ebaPcdfaz87ebaPclfas87ebxekabarcdtfgPaHBdbaPclfazBdbaPcwfasBdbkaxaDfhxavc;abfalcitfgPasBdbaPazBdlavaicdtfasBdbavc;abfalcefcsGglcitfgPaHBdbaPasBdlaiaDfhialcefhlxdkdndnaDcsSmbamaDfaDc987fcefhmxekaocefhDao8SbbgscFeGhPdndnascu9mmbaDhoxekaocvfhoaPcFbGhPcrhsdninaD8SbbgOcFbGastaPVhPaOcu9kmeaDcefhDascrfgsc8J9hmbxdkkaDcefhokaPce4cbaPceG9R7amfhmkdndnadcd9hmbabarcetfgDaH87ebaDcdfaz87ebaDclfam87ebxekabarcdtfgDaHBdbaDclfazBdbaDcwfamBdbkavc;abfalcitfgDamBdbaDazBdlavaicdtfamBdbavc;abfalcefcsGglcitfgDaHBdbaDamBdlaicefhialcefhlxekdnaDcpe0mbaxcefgOavaiaqaDcsGfRbbgscl49RcsGcdtfydbascz6gPEhDavaias9RcsGcdtfydbaOaPfgzascsGgOEhsaOThOdndnadcd9hmbabarcetfgHax87ebaHcdfaD87ebaHclfas87ebxekabarcdtfgHaxBdbaHclfaDBdbaHcwfasBdbkavaicdtfaxBdbavc;abfalcitfgHaDBdbaHaxBdlavaicefgicsGcdtfaDBdbavc;abfalcefcsGcitfgHasBdbaHaDBdlavaiaPfcsGgicdtfasBdbavc;abfalcdfcsGglcitfgDaxBdbaDasBdlalcefhlaiaOfhiazaOfhxxekaxcbaoRbbgHEgAaDc;:eSgDfhzaHcsGhCaHcl4hXdndnaHcs0mbazcefhOxekazhOavaiaX9RcsGcdtfydbhzkdndnaCmbaOcefhxxekaOhxavaiaH9RcsGcdtfydbhOkdndnaDTmbaocefhDxekaocdfhDao8SbegPcFeGhsdnaPcu9kmbaocofhAascFbGhscrhodninaD8SbbgPcFbGaotasVhsaPcu9kmeaDcefhDaocrfgoc8J9hmbkaAhDxekaDcefhDkasce4cbasceG9R7amfgmhAkdndnaXcsSmbaDhsxekaDcefhsaD8SbbgocFeGhPdnaocu9kmbaDcvfhzaPcFbGhPcrhodninas8SbbgDcFbGaotaPVhPaDcu9kmeascefhsaocrfgoc8J9hmbkazhsxekascefhskaPce4cbaPceG9R7amfgmhzkdndnaCcsSmbashoxekascefhoas8SbbgDcFeGhPdnaDcu9kmbascvfhOaPcFbGhPcrhDdninao8SbbgscFbGaDtaPVhPascu9kmeaocefhoaDcrfgDc8J9hmbkaOhoxekaocefhokaPce4cbaPceG9R7amfgmhOkdndnadcd9hmbabarcetfgDaA87ebaDcdfaz87ebaDclfaO87ebxekabarcdtfgDaABdbaDclfazBdbaDcwfaOBdbkavc;abfalcitfgDazBdbaDaABdlavaicdtfaABdbavc;abfalcefcsGcitfgDaOBdbaDazBdlavaicefgicsGcdtfazBdbavc;abfalcdfcsGcitfgDaABdbaDaOBdlavaiaHcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiarcifgrae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:flevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaic8Etc8F91aicd47avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:wPliuo97eue978Jjjjjbca9Rhiaec98Ghldndnadcl9hmbdnalTmbcbhvabhdinadadpbbbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbadczfhdavclfgval6mbkkalae9pmeaipxbbbbbbbbbbbbbbbbgqpklbaiabalcdtfgdaeciGglcdtgv;8qbbdnalTmbaiaipblbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDaqp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpklbkadaiav;8qbbskdnalTmbcbhvabhdinadczfgxaxpbbbgopxbbbbbbFFbbbbbbFFgkp9oadpbbbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpkbbadaDakp9oawaopmbezHdiOAlvCXorQLp9qpkbbadcafhdavclfgval6mbkkalae9pmbaiaeciGgvcitgdfcbcaad9R;8kbaiabalcitfglad;8qbbdnavTmbaiaipblzgopxbbbbbbFFbbbbbbFFgkp9oaipblbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpklzaiaDakp9oawaopmbezHdiOAlvCXorQLp9qpklbkalaiad;8qbbkk;4wllue97euv978Jjjjjbc8W9Rhidnaec98GglTmbcbhvabhoinaiaopbbbgraoczfgwpbbbgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklbaopxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblbpEb:T:j83ibaocwfarp5eaipblbpEe:T:j83ibawaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblbpEd:T:j83ibaocKfakp5eaipblbpEi:T:j83ibaocafhoavclfgval6mbkkdnalae9pmbaiaeciGgvcitgofcbcaao9R;8kbaiabalcitfgwao;8qbbdnavTmbaiaipblbgraipblzgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklaaipxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblapEb:T:j83ibaiarp5eaipblapEe:T:j83iwaiaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblapEd:T:j83izaiakp5eaipblapEi:T:j83iKkawaiao;8qbbkk:Pddiue978Jjjjjbc;ab9Rhidnadcd4ae2glc98GgvTmbcbheabhdinadadpbbbgocwp:Recwp:Sep;6eaocep:SepxbbjFbbjFbbjFbbjFp9opxbbjZbbjZbbjZbbjZp:Uep;Mepkbbadczfhdaeclfgeav6mbkkdnaval9pmbaialciGgecdtgdVcbc;abad9R;8kbaiabavcdtfgvad;8qbbdnaeTmbaiaipblbgocwp:Recwp:Sep;6eaocep:SepxbbjFbbjFbbjFbbjFp9opxbbjZbbjZbbjZbbjZp:Uep;Mepklbkavaiad;8qbbkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkkebcjwklz9Tbb",n=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),i=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if(typeof WebAssembly!="object")return{supported:!1};var o=WebAssembly.validate(n)?t:e,r,s=WebAssembly.instantiate(a(o),{}).then(function(x){r=x.instance,r.exports.__wasm_call_ctors()});function a(x){for(var C=new Uint8Array(x.length),w=0;w<x.length;++w){var v=x.charCodeAt(w);C[w]=v>96?v-97:v>64?v-39:v+4}for(var P=0,w=0;w<x.length;++w)C[P++]=C[w]<60?i[C[w]]:(C[w]-60)*64+C[++w];return C.buffer.slice(0,P)}function l(x,C,w,v,P,N,k){var M=x.exports.sbrk,U=v+3&-4,B=M(U*P),S=M(N.length),D=new Uint8Array(x.exports.memory.buffer);D.set(N,S);var p=C(B,v,P,S,N.length);if(p==0&&k&&k(B,U,P),w.set(D.subarray(B,B+v*P)),M(B-M(0)),p!=0)throw new Error("Malformed buffer data: "+p)}var u={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},h={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},f=[],_=0;function g(x){var C={object:new Worker(x),pending:0,requests:{}};return C.object.onmessage=function(w){var v=w.data;C.pending-=v.count,C.requests[v.id][v.action](v.value),delete C.requests[v.id]},C}function m(x){for(var C="self.ready = WebAssembly.instantiate(new Uint8Array(["+new Uint8Array(a(o))+"]), {}).then(function(result) { result.instance.exports.__wasm_call_ctors(); return result.instance; });self.onmessage = "+T.name+";"+l.toString()+T.toString(),w=new Blob([C],{type:"text/javascript"}),v=URL.createObjectURL(w),P=f.length;P<x;++P)f[P]=g(v);for(var P=x;P<f.length;++P)f[P].object.postMessage({});f.length=x,URL.revokeObjectURL(v)}function b(x,C,w,v,P){for(var N=f[0],k=1;k<f.length;++k)f[k].pending<N.pending&&(N=f[k]);return new Promise(function(M,U){var B=new Uint8Array(w),S=++_;N.pending+=x,N.requests[S]={resolve:M,reject:U},N.object.postMessage({id:S,count:x,size:C,source:B,mode:v,filter:P},[B.buffer])})}function T(x){var C=x.data;if(!C.id)return self.close();self.ready.then(function(w){try{var v=new Uint8Array(C.count*C.size);l(w,w.exports[C.mode],v,C.count,C.size,C.source,w.exports[C.filter]),self.postMessage({id:C.id,count:C.count,action:"resolve",value:v},[v.buffer])}catch(P){self.postMessage({id:C.id,count:C.count,action:"reject",value:P})}})}return{ready:s,supported:!0,useWorkers:function(x){m(x)},decodeVertexBuffer:function(x,C,w,v,P){l(r,r.exports.meshopt_decodeVertexBuffer,x,C,w,v,r.exports[u[P]])},decodeIndexBuffer:function(x,C,w,v){l(r,r.exports.meshopt_decodeIndexBuffer,x,C,w,v)},decodeIndexSequence:function(x,C,w,v){l(r,r.exports.meshopt_decodeIndexSequence,x,C,w,v)},decodeGltfBuffer:function(x,C,w,v,P,N){l(r,r.exports[h[P]],x,C,w,v,r.exports[u[N]])},decodeGltfBufferAsync:function(x,C,w,v,P){return f.length>0?b(x,C,w,h[v],u[P]):s.then(function(){var N=new Uint8Array(x*C);return l(r,r.exports[h[v]],N,x,C,w,r.exports[u[P]]),N})}}}();(function(){var e="b9H79Tebbbe9Ek9Geueu9Geub9Gbb9GPuuuuuuuuuuu99uueu9Gvuuuuub9Gluuuub9Gquuuuuuu99uueu9Gwuuuuuu99ueu9Giuuue999Gluuuueu9GiuuueuizsdilvoirwDbqqbeqlve9Weiiviebeoweuec:G;jekr:Tewo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bbz9TW79O9V9Wt9F79P9T9W29P9M95bl8E9TW79O9V9Wt9F79P9T9W29P9M959x9Pt9OcttV9P9I91tW7bvQ9TW79O9V9Wt9F79P9T9W29P9M959q9V9P9Ut7boX9TW79O9V9Wt9F79P9T9W29P9M959t9J9H2Wbra9TW79O9V9Wt9F9V9Wt9P9T9P96W9wWVtW94SWt9J9O9sW9T9H9Wbwl79IV9RbDDwebcekdxmq::9Usdbk;i6iKuY99Ou8Jjjjjbc;W;ab9RgP8KjjjjbaPcwfcbc;Kbz:ljjjb8AaPcualcefgscdtascFFFFi0Ecbyd1:jjjbHjjjjbbgzBdwaPceBd9OaPazBdbaPcuadcitadcFFFFe0Ecbyd1:jjjbHjjjjbbgHBdxaPcdBd9OaPaHBdlaPaeadalcbz:cjjjbaPcualcdtgOalcFFFFi0EgAcbyd1:jjjbHjjjjbbgCBdzaPciBd9OaPaAcbyd1:jjjbHjjjjbbgXBdCaPclBd9Oalcd4alfhQcehLinaLgscethLasaQ6mbkcbhKaPcuascdtgLascFFFFi0Ecbyd1:jjjbHjjjjbbgQBdKaPcvBd9OaQcFeaLz:ljjjbhYdnalTmbavcd4h8AascufhEinaiaKa8A2cdtfg3ydlgscH4as7c:F:b:DD2a3ydbgscH4as7c;D;O:B8J27a3ydwgscH4as7c:3F;N8N27hQcbhsdndninaYaQaEGgQcdtfg5ydbgLcuSmeaiaLa8A2cdtfa3cxz:ojjjbTmdascefgsaQfhQasaE9nmbxdkka5aKBdbaKhLkaCaKcdtfaLBdbaKcefgKal9hmbkcbhsaXhLinaLasBdbaLclfhLalascefgs9hmbkcbhsaChLaXhQindnasaLydbgESmbaQaXaEcdtfgEydbBdbaEasBdbkaLclfhLaQclfhQalascefgs9hmbkkcbh8EaYcbyd:m:jjjbH:bjjjbbaPclBd9OaPalcbyd1:jjjbHjjjjbbgEBdKaPcvBd9OaPaAcbyd1:jjjbHjjjjbbgsBd3aPcoBd9OaPaAcbyd1:jjjbHjjjjbbgLBdaaPcrBd9OascFeaOz:ljjjbh8FaLcFeaOz:ljjjbhadnalTmbaHcwfhhindnaza8EgQcefg8Ecdtfydbg3azaQcdtgsfydbgLSmba3aL9RhOaHaLcitfhgaaasfh8Ja8FasfhKcbh8Aindndnaga8Acitfydbg5aQ9hmbaKaQBdba8JaQBdbxekdnaza5cdtg8KfgsclfydbgLasydbgsSmbaHascitg3fydbaQSmeaLas9Rh8Lascu7aLfhYaha3fhLcbhsinaYasSmeascefhsaLydbh3aLcwfhLa3aQ9hmbkasa8L6mekaaa8KfgsaQa5asydbcuSEBdbaKa5aQaKydbcuSEBdbka8Acefg8AaO9hmbkka8Eal9hmbkaChLaXhQaah3a8Fh8AcbhsindndnasaLydbg59hmbdnasaQydbg59hmba8Aydbh5dna3ydbgYcu9hmba5cu9hmbaEasfcb86bbxikaEasfhKdnasaYSmbasa5SmbaKce86bbxikaKcl86bbxdkdnasaXa5cdtgYfydb9hmbdna3ydbgKcuSmbasaKSmba8AydbgOcuSmbasaOSmbaaaYfydbggcuSmbaga5Smba8FaYfydbgYcuSmbaYa5SmbdnaCaKcdtfydbaCaYcdtfydb9hmbaCaOcdtfydbaCagcdtfydb9hmbaEasfcd86bbxlkaEasfcl86bbxikaEasfcl86bbxdkaEasfcl86bbxekaEasfaEa5fRbb86bbkaLclfhLaQclfhQa3clfh3a8Aclfh8Aalascefgs9hmbkaxceGTmbaEhsalhLindnasRbbce9hmbascl86bbkascefhsaLcufgLmbkkcualcx2alc;v:Q;v:Qe0Ecbyd1:jjjbHjjjjbbh8JaPcwfaPyd9Ogscdtfa8JBdbaPascefgOBd9Oa8Jaialavz:djjjbdndnaDmbcbhvxekcbh5aPcwfaOcdtfcuaDal2gLcdtaLcFFFFi0Ecbyd1:jjjbHjjjjbbgvBdbaPascdfgOBd9OalTmbarcd4cdthYaDcdthKavh8AinaohsawhLa8AhQaDh3inaQasIdbaLIdbNUdbasclfhsaLclfhLaQclfhQa3cufg3mbkaoaYfhoa8AaKfh8Aa5cefg5al9hmbkkaPcwfaOcdtfcualc8S2gsalc;D;O;f8U0EgQcbyd1:jjjbHjjjjbbgLBdbaPaOcefg3Bd9OaLcbasz:ljjjbh8EdndndnaDTmbaPcwfa3cdtfaQcbyd1:jjjbHjjjjbbgoBdbaPaOcdfgLBd9Oaocbasz:ljjjb8AaPcwfaLcdtfcuaDal2gscltgLascFFFFb0Ecbyd1:jjjbHjjjjbbgwBdbaPaOcifBd9OawcbaLz:ljjjb8AadmexdkcbhocbhwadTmekcbh8AaehLindna8JaLclfydbg5cx2fgsIdba8JaLydbgYcx2fgQIdbg8M:tg8Na8JaLcwfydbgKcx2fg3IdlaQIdlgy:tg8PNa3Idba8M:tgIasIdlay:tg8RN:tg8Sa8SNa8Ra3IdwaQIdwgR:tg8UNa8PasIdwaR:tg8RN:tg8Pa8PNa8RaINa8Ua8NN:tg8Na8NNMM:rgIJbbbb9ETmba8SaI:vh8Sa8NaI:vh8Na8PaI:vh8Pka8EaCaYcdtfydbc8S2fgsa8PaI:rgIa8PNNg8RasIdbMUdbasa8NaIa8NNg8VNg8UasIdlMUdlasa8SaIa8SNg8WNg8XasIdwMUdwasa8Va8PNg8VasIdxMUdxasa8Wa8PNg8YasIdzMUdzasa8Wa8NNg8WasIdCMUdCasa8PaIa8SaRNa8Pa8MNaya8NNMM:mgyNg8MNg8PasIdKMUdKasa8Na8MNg8NasId3MUd3asa8Sa8MNg8SasIdaMUdaasa8MayNg8MasId8KMUd8KasaIasIdyMUdya8EaCa5cdtfydbc8S2fgsa8RasIdbMUdbasa8UasIdlMUdlasa8XasIdwMUdwasa8VasIdxMUdxasa8YasIdzMUdzasa8WasIdCMUdCasa8PasIdKMUdKasa8NasId3MUd3asa8SasIdaMUdaasa8MasId8KMUd8KasaIasIdyMUdya8EaCaKcdtfydbc8S2fgsa8RasIdbMUdbasa8UasIdlMUdlasa8XasIdwMUdwasa8VasIdxMUdxasa8YasIdzMUdzasa8WasIdCMUdCasa8PasIdKMUdKasa8NasId3MUd3asa8SasIdaMUdaasa8MasId8KMUd8KasaIasIdyMUdyaLcxfhLa8Acifg8Aad6mbkcbh5aehYincbhLinaEaeaLc:G1jjbfydba5fcdtfydbgQfRbbhsdndnaEaYaLfydbg3fRbbg8Ac99fcFeGcpe0mbasceSmbascd9hmekdna8AcufcFeGce0mba8Fa3cdtfydbaQ9hmekdnascufcFeGce0mbaaaQcdtfydba39hmekdna8Acv2asfc:W1jjbfRbbTmbaCaQcdtfydbaCa3cdtfydb0mekJbbacJbbjZasceSEhIa8AceShOa8JaeaLc:K1jjbfydba5fcdtfydbcx2fhsdna8JaQcx2fg8AIdwa8Ja3cx2fgKIdwgy:tg8Pa8PNa8AIdbaKIdbgR:tg8Na8NNa8AIdlaKIdlg8R:tg8Sa8SNMM:rg8MJbbbb9ETmba8Pa8M:vh8Pa8Sa8M:vh8Sa8Na8M:vh8NkJbbacaIaOEh8WdnasIdway:tgIa8PaIa8PNasIdbaR:tg8Xa8NNa8SasIdla8R:tg8VNMMg8UN:tgIaINa8Xa8Na8UN:tg8Pa8PNa8Va8Sa8UN:tg8Na8NNMM:rg8SJbbbb9ETmbaIa8S:vhIa8Na8S:vh8Na8Pa8S:vh8Pka8EaCa3cdtfydbc8S2fgsa8Pa8Wa8MNg8Sa8PNNg8UasIdbMUdbasa8Na8Sa8NNg8WNg8XasIdlMUdlasaIa8SaINg8MNg8VasIdwMUdwasa8Wa8PNg8WasIdxMUdxasa8Ma8PNg8YasIdzMUdzasa8Ma8NNg8ZasIdCMUdCasa8Pa8SaIayNa8PaRNa8Ra8NNMM:mgyNg8MNg8PasIdKMUdKasa8Na8MNg8NasId3MUd3asaIa8MNgIasIdaMUdaasa8MayNg8MasId8KMUd8Kasa8SasIdyMUdya8EaCaQcdtfydbc8S2fgsa8UasIdbMUdbasa8XasIdlMUdlasa8VasIdwMUdwasa8WasIdxMUdxasa8YasIdzMUdzasa8ZasIdCMUdCasa8PasIdKMUdKasa8NasId3MUd3asaIasIdaMUdaasa8MasId8KMUd8Kasa8SasIdyMUdykaLclfgLcx9hmbkaYcxfhYa5cifg5ad6mbkaDTmbcbhYinJbbbbhRa8JaeaYcdtfgsclfydbgKcx2fgLIdwa8JasydbgOcx2fgQIdwg8V:tg8Na8NNaLIdbaQIdbg8Y:tgIaINaLIdlaQIdlg8Z:tg8Sa8SNMMg8Wa8Jascwfydbggcx2fgsIdwa8V:tg8MNa8Na8Na8MNaIasIdba8Y:tgyNa8SasIdla8Z:tg8RNMMg8PN:tJbbbbJbbjZa8Wa8Ma8MNayayNa8Ra8RNMMg8XNa8Pa8PN:tg8U:va8UJbbbb9BEg8UNh80a8Xa8NNa8Ma8PN:ta8UNh81a8Wa8RNa8Sa8PN:ta8UNhBa8Xa8SNa8Ra8PN:ta8UNh83a8WayNaIa8PN:ta8UNhUa8XaINaya8PN:ta8UNh85aIa8RNaya8SN:tg8Pa8PNa8Sa8MNa8Ra8NN:tg8Pa8PNa8NayNa8MaIN:tg8Pa8PNMM:r:rh8PavaOaD2cdtfhLavagaD2cdtfhQavaKaD2cdtfh3a8V:mh86a8Z:mh87a8Y:mh88cbh8AaDh5Jbbbbh8RJbbbbh8UJbbbbh8WJbbbbh8XJbbbbh8VJbbbbh8YJbbbbh8ZJbbbbh89Jbbbbh8:inaPc;Wbfa8Afgscwfa8Pa81a3IdbaLIdbg8M:tg8SNa80aQIdba8M:tgyNMg8NNUdbasclfa8Pa83a8SNaBayNMgINUdbasa8Pa85a8SNaUayNMg8SNUdbascxfa8Pa86a8NNa87aINa8Ma88a8SNMMMg8MNUdba8Pa8NaINNa8XMh8Xa8Pa8Na8SNNa8VMh8Va8PaIa8SNNa8YMh8Ya8Pa8Ma8MNNaRMhRa8Pa8Na8MNNa8RMh8Ra8PaIa8MNNa8UMh8Ua8Pa8Sa8MNNa8WMh8Wa8Pa8Na8NNNa8ZMh8Za8PaIaINNa89Mh89a8Pa8Sa8SNNa8:Mh8:aLclfhLa3clfh3aQclfhQa8Aczfh8Aa5cufg5mbkaoaCaOcdtfydbgLc8S2fgsa8:asIdbMUdbasa89asIdlMUdlasa8ZasIdwMUdwasa8YasIdxMUdxasa8VasIdzMUdzasa8XasIdCMUdCasa8WasIdKMUdKasa8UasId3MUd3asa8RasIdaMUdaasaRasId8KMUd8Kasa8PasIdyMUdyaoaCaKcdtfydbgKc8S2fgsa8:asIdbMUdbasa89asIdlMUdlasa8ZasIdwMUdwasa8YasIdxMUdxasa8VasIdzMUdzasa8XasIdCMUdCasa8WasIdKMUdKasa8UasId3MUd3asa8RasIdaMUdaasaRasId8KMUd8Kasa8PasIdyMUdyaoaCagcdtfydbgOc8S2fgsa8:asIdbMUdbasa89asIdlMUdlasa8ZasIdwMUdwasa8YasIdxMUdxasa8VasIdzMUdzasa8XasIdCMUdCasa8WasIdKMUdKasa8UasId3MUd3asa8RasIdaMUdaasaRasId8KMUd8Kasa8PasIdyMUdyawaLaD2cltfh5cbhLaDh3ina5aLfgsaPc;WbfaLfgQIdbasIdbMUdbasclfg8AaQclfIdba8AIdbMUdbascwfg8AaQcwfIdba8AIdbMUdbascxfgsaQcxfIdbasIdbMUdbaLczfhLa3cufg3mbkawaKaD2cltfh5cbhLaDh3ina5aLfgsaPc;WbfaLfgQIdbasIdbMUdbasclfg8AaQclfIdba8AIdbMUdbascwfg8AaQcwfIdba8AIdbMUdbascxfgsaQcxfIdbasIdbMUdbaLczfhLa3cufg3mbkawaOaD2cltfh5cbhLaDh3ina5aLfgsaPc;WbfaLfgQIdbasIdbMUdbasclfg8AaQclfIdba8AIdbMUdbascwfg8AaQcwfIdba8AIdbMUdbascxfgsaQcxfIdbasIdbMUdbaLczfhLa3cufg3mbkaYcifgYad6mbkkdnabaeSmbabaeadcdtz:kjjjb8AkaPydbhZcbhsdnalTmbaZclfhsaZydbh3aEhLalh8AcbhQincbasydbg5a39RaLRbbcpeGEaQfhQaLcefhLasclfhsa5h3a8Acufg8AmbkaQce4hskcuadas9Rcifgrcx2arc;v:Q;v:Qe0Ecbyd1:jjjbHjjjjbbh8LaPcwfaPyd9Ogscdtfa8LBdbaPascefgLBd9OaPcwfaLcdtfcuarcdtarcFFFFi0Ecbyd1:jjjbHjjjjbbgxBdbaPascdfgLBd9OaPcwfaLcdtfaAcbyd1:jjjbHjjjjbbgHBdbaPascifgLBd9OaPcwfaLcdtfalcbyd1:jjjbHjjjjbbgnBdbaPasclfBd9OJbbbbh8Ydnadaq9nmbdnarci6mbakakNh8VaDclthca8Lcwfh9cJbbbbh8YinaPabadghalaCz:cjjjbabhOcbhzcbhKincbhsindnaCaOasfydbgQcdtgYfydbg8AaCabasc;m1jjbfydbaKfcdtfydbgLcdtfydbg5SmbaEaLfRbbgecv2aEaQfRbbg3fc;G1jjbfRbbg8Ka3cv2aefggc;G1jjbfRbbgiVcFeGTmbdnagc:W1jjbfRbbTmba5a8A0mekdna3ae9hmba3cufcFeGce0mba8FaYfydbaL9hmeka8Lazcx2fg3aLaQaicFeGg8AEBdla3aQaLa8AEBdba3a8Aa8KGcb9hBdwazcefhzkasclfgscx9hmbkdnaKcifgKah9pmbaOcxfhOazcifar9nmekkdnazmbahhdxikcbheinJbbbbJbbjZa8EaCa8Laecx2fg3ydlg8Aa3ydbg5a3ydwgLEgKcdtfydbg8Kc8S2gifgsIdyg8P:va8PJbbbb9BEasIdwa8Ja5a8AaLEgYcx2fgLIdwg8SNasIdzaLIdbg8MNasIdaMg8Pa8PMMa8SNasIdlaLIdlgyNasIdCa8SNasId3Mg8Pa8PMMayNasIdba8MNasIdxayNasIdKMg8Pa8PMMa8MNasId8KMMM:lNh8WJbbbbJbbjZa8EaCa5cdtfydbgdc8S2gQfgsIdyg8P:va8PJbbbb9BEasIdwa8Ja8Acx2fgLIdwgINasIdzaLIdbgRNasIdaMg8Pa8PMMaINasIdlaLIdlg8RNasIdCaINasId3Mg8Pa8PMMa8RNasIdbaRNasIdxa8RNasIdKMg8Pa8PMMaRNasId8KMMM:lNh8Xa3cwfhOa3clfhgdnaDTmbaoaQfgQIdwaINaQIdzaRNaQIdaMg8Pa8PMMaINaQIdla8RNaQIdCaINaQId3Mg8Pa8PMMa8RNaQIdbaRNaQIdxa8RNaQIdKMg8Pa8PMMaRNaQId8KMMMh8Nava8AaD2cdtfhLawadaD2cltfhsaQIdyh8UaDhQinaLIdbg8PJbbb;aNascxfIdbaIascwfIdbNaRasIdbNa8RasclfIdbNMMMNa8Pa8PNa8UNa8NMMh8NaLclfhLasczfhsaQcufgQmbkaoaifgQIdwa8SNaQIdza8MNaQIdaMg8Pa8PMMa8SNaQIdlayNaQIdCa8SNaQId3Mg8Pa8PMMayNaQIdba8MNaQIdxayNaQIdKMg8Pa8PMMa8MNaQId8KMMMhIavaYaD2cdtfhLawa8KaD2cltfhsaQIdyhRaDhQinaLIdbg8PJbbb;aNascxfIdba8SascwfIdbNa8MasIdbNayasclfIdbNMMMNa8Pa8PNaRNaIMMhIaLclfhLasczfhsaQcufgQmbka8WaI:lMh8Wa8Xa8N:lMh8Xkaga8AaYa8Xa8W9FgsEBdba3a5aKasEBdbaOa8Xa8WasEUdbaecefgeaz9hmbkaPc;Wbfcbcj;abz:ljjjb8Aa9chsazhLinaPc;WbfasydbcO4c;8ZGfgQaQydbcefBdbascxfhsaLcufgLmbkcbhscbhLinaPc;WbfasfgQydbh3aQaLBdba3aLfhLasclfgscj;ab9hmbkcbhsa9chLinaPc;WbfaLydbcO4c;8ZGfgQaQydbgQcefBdbaxaQcdtfasBdbaLcxfhLazascefgs9hmbkahaq9RgQci9UhJdnalTmbcbhsaHhLinaLasBdbaLclfhLalascefgs9hmbkkcbh9eancbalz:ljjjbhTaQcO9UhSaJce4h9haPydlh9icbhicbhgdnina8Laxagcdtfydbcx2fgOIdwg8Na8V9EmeaiaJ9pmeJFFuuh8Pdna9haz9pmba8Laxa9hcdtfydbcx2fIdwJbb;aZNh8Pkdna8Na8P9ETmbaiaS0mdkdnaTaCaOydlg6cdtg9kfydbg3fg0RbbaTaCaOydbgKcdtg9mfydbg9nfg9oRbbVmbdnaZa9ncdtfgsclfydbgLasydbgsSmbaLas9Rh5a9iascitfhsa8Ja3cx2fgYcwfhdaYclfhAa8Ja9ncx2fg8Kcwfh9pa8Kclfh9qcbhLcehednindnaHasydbcdtfydbgQa3SmbaHasclfydbcdtfydbg8Aa3SmbaQa8ASmba8Ja8Acx2fg8AIdba8JaQcx2fgQIdbgI:tg8Pa9qIdbaQIdlg8S:tg8MNa8KIdbaI:tgya8AIdla8S:tg8NN:ta8PaAIdba8S:tgRNaYIdbaI:tg8Ra8NN:tNa8Na9pIdbaQIdwg8S:tg8UNa8Ma8AIdwa8S:tgIN:ta8NadIdba8S:tg8SNaRaIN:tNaIayNa8Ua8PN:taIa8RNa8Sa8PN:tNMMJbbbb9FmdkascwfhsaLcefgLa56hea5aL9hmbkkaeceGTmba9hcefh9hxeka8Ea3c8S2gQfgsa8Ea9nc8S2g8AfgLIdbasIdbMUdbasaLIdlasIdlMUdlasaLIdwasIdwMUdwasaLIdxasIdxMUdxasaLIdzasIdzMUdzasaLIdCasIdCMUdCasaLIdKasIdKMUdKasaLId3asId3MUd3asaLIdaasIdaMUdaasaLId8KasId8KMUd8KasaLIdyasIdyMUdydnaDTmbaoaQfgsaoa8AfgLIdbasIdbMUdbasaLIdlasIdlMUdlasaLIdwasIdwMUdwasaLIdxasIdxMUdxasaLIdzasIdzMUdzasaLIdCasIdCMUdCasaLIdKasIdKMUdKasaLId3asId3MUd3asaLIdaasIdaMUdaasaLId8KasId8KMUd8KasaLIdyasIdyMUdyaca9n2heaca32hYawhLaDh8AinaLaYfgsaLaefgQIdbasIdbMUdbasclfg5aQclfIdba5IdbMUdbascwfg5aQcwfIdba5IdbMUdbascxfgsaQcxfIdbasIdbMUdbaLczfhLa8Acufg8AmbkkaOcwfhLdndndndnaEaKfgQRbbc9:fPdebdkaKhsinaHascdtgsfa3BdbaXasfydbgsaK9hmbxikkaXa9kfydbhsaXa9mfydbhKaHa9mfa6Bdbash6kaHaKcdtfa6Bdbka9oce86bba0ce86bbaLIdbg8Pa8Ya8Ya8P9DEh8Ya9ecefh9ececdaQRbbceSEaifhikagcefggaz9hmbkkdna9embahhdxikdnalTmbcbhLa8FhsindnasydbgQcuSmbdnaLaHaQcdtg3fydbgQ9hmba8Fa3fydbhQkasaQBdbkasclfhsalaLcefgL9hmbkcbhLaahsindnasydbgQcuSmbdnaLaHaQcdtg3fydbgQ9hmbaaa3fydbhQkasaQBdbkasclfhsalaLcefgL9hmbkkcbhdabhscbh8AindnaHasydbcdtfydbgLaHasclfydbcdtfydbgQSmbaLaHascwfydbcdtfydbg3SmbaQa3Smbabadcdtfg5aLBdba5clfaQBdba5cwfa3Bdbadcifhdkascxfhsa8Acifg8Aah6mbkadaq9nmdxbkkaPabadalaCz:cjjjbkdnamTmbama8Y:rUdbkaPyd9OgscdtaPcwffc98fhCdninasTmeaCydbcbyd:m:jjjbH:bjjjbbaCc98fhCascufhsxbkkaPc;W;abf8Kjjjjbadk;:ieouabydlhvabydbclfcbaicdtz:ljjjbhoadci9UhrdnadTmbdnalTmbaehwadhDinaoalawydbcdtfydbcdtfgqaqydbcefBdbawclfhwaDcufgDmbxdkkaehwadhDinaoawydbcdtfgqaqydbcefBdbawclfhwaDcufgDmbkkdnaiTmbcbhDaohwinawydbhqawaDBdbawclfhwaqaDfhDaicufgimbkkdnadci6mbarcearce0EhdinaecwfydbhwaeclfydbhDaeydbhidnalTmbalawcdtfydbhwalaDcdtfydbhDalaicdtfydbhikavaoaicdtfgqydbcitfaDBdbavaqydbcitfawBdlaqaqydbcefBdbavaoaDcdtfgqydbcitfawBdbavaqydbcitfaiBdlaqaqydbcefBdbavaoawcdtfgwydbcitfaiBdbavawydbcitfaDBdlawawydbcefBdbaecxfheadcufgdmbkkabydbcbBdbk:Zldouv998Jjjjjbca9Rglczfcwfcbyd11jjbBdbalcb8Pdj1jjb83izalcwfcbydN1jjbBdbalcb8Pd:m1jjb83ibdnadTmbaicd4hvdnabTmbavcdthocbhraehwinabarcx2fgiaearav2cdtfgDIdbUdbaiaDIdlUdlaiaDIdwUdwcbhiinalczfaifgDawaifIdbgqaDIdbgkakaq9EEUdbalaifgDaqaDIdbgkakaq9DEUdbaiclfgicx9hmbkawaofhwarcefgrad9hmbxdkkavcdthrcbhwincbhiinalczfaifgDaeaifIdbgqaDIdbgkakaq9EEUdbalaifgDaqaDIdbgkakaq9DEUdbaiclfgicx9hmbkaearfheawcefgwad9hmbkkdnabTmbadTmbJbbbbJbbjZalIdbalIdzgk:tJbbbb:xgqalIdlalIdCgx:tgmamaq9DEgqalIdwalIdKgm:tgPaPaq9DEgq:vaqJbbbb9BEhqinabaqabIdbak:tNUdbabclfgiaqaiIdbax:tNUdbabcwfgiaqaiIdbam:tNUdbabcxfhbadcufgdmbkkk8KbabaeadaialavcbcbcbcbaoarawaDz:bjjjbk8KbabaeadaialavaoarawaDaqakaxamz:bjjjbk;lOowud99wue99iul998Jjjjjbc;Wb9Rgw8KjjjjbdndnarmbcbhDxekawcwfcbc;Kbz:ljjjb8Aawcuadcx2adc;v:Q;v:Qe0Ecbyd1:jjjbHjjjjbbgqBdwawceBd9Oaqaeadaiz:djjjbawcuadcdtadcFFFFi0Egkcbyd1:jjjbHjjjjbbgxBdxawcdBd9Oadcd4adfhmceheinaegicetheaiam6mbkcbhmawcuaicdtgPaicFFFFi0Ecbyd1:jjjbHjjjjbbgsBdzawciBd9Odndnar:Zgz:rJbbbZMgH:lJbbb9p9DTmbaH:Ohexekcjjjj94hekaicufhOc:bwhAcbhCcbhXadhQinaChLaeaAgKcufaeaK9iEamgDcefaeaD9kEhYdndnadTmbaYcuf:YhHaqhiaxheadhmindndnaiIdbaHNJbbbZMg8A:lJbbb9p9DTmba8A:OhAxekcjjjj94hAkaAcCthAdndnaiclfIdbaHNJbbbZMg8A:lJbbb9p9DTmba8A:OhCxekcjjjj94hCkaCcqtaAVhAdndnaicwfIdbaHNJbbbZMg8A:lJbbb9p9DTmba8A:OhCxekcjjjj94hCkaeaAaCVBdbaicxfhiaeclfheamcufgmmbkascFeaPz:ljjjbhEcbh3cbh5indnaEaxa5cdtfydbgAcm4aA7c:v;t;h;Ev2gics4ai7aOGgmcdtfgCydbgecuSmbaeaASmbcehiinaEamaifaOGgmcdtfgCydbgecuSmeaicefhiaeaA9hmbkkaCaABdba3aecuSfh3a5cefg5ad9hmbxdkkascFeaPz:ljjjb8Acbh3kaDaYa3ar0giEhmaLa3aiEhCdna3arSmbaYaKaiEgAam9Rcd9imbdndnaXcl0mbdnaQ:ZgHaL:Zg8A:taY:Yg8EaD:Y:tg8Fa8EaK:Y:tgaa3:Zghaz:tNNNaHaz:taaNa8Aah:tNa8Aaz:ta8FNahaH:tNM:va8EMJbbbZMgH:lJbbb9p9DTmbaH:Ohexdkcjjjj94hexekamaAfcd9Theka3aQaiEhQaXcefgXcs9hmekkdndnaCmbcihicbhDxekcbhiawakcbyd1:jjjbHjjjjbbg5BdCawclBd9OdndnadTmbamcuf:YhHaqhiaxheadhmindndnaiIdbaHNJbbbZMg8A:lJbbb9p9DTmba8A:OhAxekcjjjj94hAkaAcCthAdndnaiclfIdbaHNJbbbZMg8A:lJbbb9p9DTmba8A:OhCxekcjjjj94hCkaCcqtaAVhAdndnaicwfIdbaHNJbbbZMg8A:lJbbb9p9DTmba8A:OhCxekcjjjj94hCkaeaAaCVBdbaicxfhiaeclfheamcufgmmbkascFeaPz:ljjjbhEcbhDcbh3inaxa3cdtgYfydbgAcm4aA7c:v;t;h;Ev2gics4ai7hecbhidndninaEaeaOGgmcdtfgCydbgecuSmednaxaecdtgCfydbaASmbaicefgiamfheaiaO9nmekka5aCfydbhixekaCa3BdbaDhiaDcefhDka5aYfaiBdba3cefg3ad9hmbkcuaDc32giaDc;j:KM;jb0EhexekascFeaPz:ljjjb8AcbhDcbhekawaecbyd1:jjjbHjjjjbbgeBdKawcvBd9Oaecbaiz:ljjjbhOavcd4hxdnadTmbaxcdth3a5hmalhAaqheadhEinaOamydbc32fgiaeIdbaiIdbMUdbaiaeclfIdbaiIdlMUdlaiaecwfIdbaiIdwMUdwaiaAc;81jjbalEgCIdbaiIdxMUdxaiaCIdlaiIdzMUdzaiaCIdwaiIdCMUdCaiaiIdKJbbjZMUdKamclfhmaAa3fhAaecxfheaEcufgEmbkkdnaDTmbaOcxfhiaDheinaictfgmamIdbJbbbbJbbjZaicxfIdbgH:vaHJbbbb9BEgHNUdbaic94fgmaHamIdbNUdbaic98fgmaHamIdbNUdbaiaHaiIdbNUdbaiclfgmaHamIdbNUdbaicwfgmaHamIdbNUdbaic3fhiaecufgembkkcbhAawcuaDcdtgYaDcFFFFi0Egicbyd1:jjjbHjjjjbbgeBd3awcoBd9Oawaicbyd1:jjjbHjjjjbbgEBdaaecFeaYz:ljjjbh3dnadTmbaoaoNh8Aaxcdthxalheina8Aaec;81jjbalEgmIdwaOa5ydbgCc32fgiIdC:tgHaHNamIdbaiIdx:tgHaHNamIdlaiIdz:tgHaHNMMNaqcwfIdbaiIdw:tgHaHNaqIdbaiIdb:tgHaHNaqclfIdbaiIdl:tgHaHNMMMhHdndna3aCcdtgifgmydbcuSmbaEaifIdbaH9ETmekamaABdbaEaifaHUdbka5clfh5aeaxfheaqcxfhqadaAcefgA9hmbkkaba3aYz:kjjjb8AcrhikaicdthiinaiTmeaic98fgiawcwffydbcbyd:m:jjjbH:bjjjbbxbkkawc;Wbf8KjjjjbaDk:Qdidui99ducbhi8Jjjjjbca9Rglczfcwfcbyd11jjbBdbalcb8Pdj1jjb83izalcwfcbydN1jjbBdbalcb8Pd:m1jjb83ibdndnaembJbbjFhvJbbjFhoJbbjFhrxekadcd4cdthwincbhdinalczfadfgDabadfIdbgoaDIdbgrarao9EEUdbaladfgDaoaDIdbgrarao9DEUdbadclfgdcx9hmbkabawfhbaicefgiae9hmbkalIdwalIdK:thralIdlalIdC:thoalIdbalIdz:thvkavJbbbb:xgvaoaoav9DEgoararao9DEk9DeeuabcFeaicdtz:ljjjbhlcbhbdnadTmbindnalaeydbcdtfgiydbcu9hmbaiabBdbabcefhbkaeclfheadcufgdmbkkabk9teiucbcbyd:q:jjjbgeabcifc98GfgbBd:q:jjjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaeczfheaiczfhiadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabk9teiucbcbyd:q:jjjbgeabcrfc94GfgbBd:q:jjjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik9:eiuZbhedndncbyd:q:jjjbgdaecztgi9nmbcuheadai9RcFFifcz4nbcuSmekadhekcbabae9Rcifc98Gcbyd:q:jjjbfgdBd:q:jjjbdnadZbcztge9nmbadae9RcFFifcz4nb8Akk6eiucbhidnadTmbdninabRbbglaeRbbgv9hmeaecefheabcefhbadcufgdmbxdkkalav9Rhikaikk:Iedbcjwk1eFFuuFFuuFFuuFFuFFFuFFFuFbbbbbbbbebbbdbbbbbbbebbbeeebeebebbeeebebbbbbebebbbbbebbbdbbbbbbbbbbbbbbbeeeeebebbbbbebbbbbeebbbbbbbbbbbbbbbbbbbbbc1Dkxebbbdbbb:G9Kbb",t=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if(typeof WebAssembly!="object")return{supported:!1};var n,i=WebAssembly.instantiate(o(e),{}).then(function(m){n=m.instance,n.exports.__wasm_call_ctors()});function o(m){for(var b=new Uint8Array(m.length),T=0;T<m.length;++T){var x=m.charCodeAt(T);b[T]=x>96?x-97:x>64?x-39:x+4}for(var C=0,T=0;T<m.length;++T)b[C++]=b[T]<60?t[b[T]]:(b[T]-60)*64+b[++T];return b.buffer.slice(0,C)}function r(m){if(!m)throw new Error("Assertion failed")}function s(m){return new Uint8Array(m.buffer,m.byteOffset,m.byteLength)}function a(m,b,T){var x=n.exports.sbrk,C=x(b.length*4),w=x(T*4),v=new Uint8Array(n.exports.memory.buffer),P=s(b);v.set(P,C);var N=m(w,C,b.length,T);v=new Uint8Array(n.exports.memory.buffer);var k=new Uint32Array(T);new Uint8Array(k.buffer).set(v.subarray(w,w+T*4)),P.set(v.subarray(C,C+b.length*4)),x(C-x(0));for(var M=0;M<b.length;++M)b[M]=k[b[M]];return[k,N]}function l(m){for(var b=0,T=0;T<m.length;++T){var x=m[T];b=b<x?x:b}return b}function u(m,b,T,x,C,w,v,P,N){var k=n.exports.sbrk,M=k(4),U=k(T*4),B=k(C*w),S=k(T*4),D=new Uint8Array(n.exports.memory.buffer);D.set(s(x),B),D.set(s(b),S);var p=m(U,S,T,B,C,w,v,P,N,M);D=new Uint8Array(n.exports.memory.buffer);var I=new Uint32Array(p);s(I).set(D.subarray(U,U+p*4));var O=new Float32Array(1);return s(O).set(D.subarray(M,M+4)),k(M-k(0)),[I,O[0]]}function h(m,b,T,x,C,w,v,P,N,k,M,U){var B=n.exports.sbrk,S=B(4),D=B(T*4),p=B(C*w),I=B(C*P),O=B(N.length*4),F=B(T*4),V=new Uint8Array(n.exports.memory.buffer);V.set(s(x),p),V.set(s(v),I),V.set(s(N),O),V.set(s(b),F);var G=m(D,F,T,p,C,w,I,P,O,N.length,k,M,U,S);V=new Uint8Array(n.exports.memory.buffer);var j=new Uint32Array(G);s(j).set(V.subarray(D,D+G*4));var W=new Float32Array(1);return s(W).set(V.subarray(S,S+4)),B(S-B(0)),[j,W[0]]}function f(m,b,T,x){var C=n.exports.sbrk,w=C(T*x),v=new Uint8Array(n.exports.memory.buffer);v.set(s(b),w);var P=m(w,T,x);return C(w-C(0)),P}function _(m,b,T,x,C,w,v,P){var N=n.exports.sbrk,k=N(P*4),M=N(T*x),U=N(T*w),B=new Uint8Array(n.exports.memory.buffer);B.set(s(b),M),C&&B.set(s(C),U);var S=m(k,M,T,x,U,w,v,P);B=new Uint8Array(n.exports.memory.buffer);var D=new Uint32Array(S);return s(D).set(B.subarray(k,k+S*4)),N(k-N(0)),D}var g={LockBorder:1};return{ready:i,supported:!0,useExperimentalFeatures:!1,compactMesh:function(m){r(m instanceof Uint32Array||m instanceof Int32Array||m instanceof Uint16Array||m instanceof Int16Array),r(m.length%3==0);var b=m.BYTES_PER_ELEMENT==4?m:new Uint32Array(m);return a(n.exports.meshopt_optimizeVertexFetchRemap,b,l(m)+1)},simplify:function(m,b,T,x,C,w){r(m instanceof Uint32Array||m instanceof Int32Array||m instanceof Uint16Array||m instanceof Int16Array),r(m.length%3==0),r(b instanceof Float32Array),r(b.length%T==0),r(T>=3),r(x>=0&&x<=m.length),r(x%3==0),r(C>=0&&C<=1);for(var v=0,P=0;P<(w?w.length:0);++P)v|=g[w[P]];var N=m.BYTES_PER_ELEMENT==4?m:new Uint32Array(m),k=u(n.exports.meshopt_simplify,N,m.length,b,b.length/T,T*4,x,C,v);return k[0]=m instanceof Uint32Array?k[0]:new m.constructor(k[0]),k},simplifyWithAttributes:function(m,b,T,x,C,w,v,P,N){r(this.useExperimentalFeatures),r(m instanceof Uint32Array||m instanceof Int32Array||m instanceof Uint16Array||m instanceof Int16Array),r(m.length%3==0),r(b instanceof Float32Array),r(b.length%T==0),r(T>=3),r(x instanceof Float32Array),r(x.length%C==0),r(C>=0),r(v>=0&&v<=m.length),r(v%3==0),r(P>=0&&P<=1),r(Array.isArray(w)),r(C>=w.length),r(w.length<=16);for(var k=0,M=0;M<(N?N.length:0);++M)k|=g[N[M]];var U=m.BYTES_PER_ELEMENT==4?m:new Uint32Array(m),B=h(n.exports.meshopt_simplifyWithAttributes,U,m.length,b,b.length/T,T*4,x,C*4,new Float32Array(w),v,P,k);return B[0]=m instanceof Uint32Array?B[0]:new m.constructor(B[0]),B},getScale:function(m,b){return r(m instanceof Float32Array),r(m.length%b==0),r(b>=3),f(n.exports.meshopt_simplifyScale,m,m.length/b,b*4)},simplifyPoints:function(m,b,T,x,C,w){return r(this.useExperimentalFeatures),r(m instanceof Float32Array),r(m.length%b==0),r(b>=3),r(T>=0&&T<=m.length/b),x?(r(x instanceof Float32Array),r(x.length%C==0),r(C>=3),r(m.length/b==x.length/C),_(n.exports.meshopt_simplifyPoints,m,m.length/b,b*4,x,C*4,w,T)):_(n.exports.meshopt_simplifyPoints,m,m.length/b,b*4,void 0,0,0,T)}}})();function yh(e){e=y(e,y.EMPTY_OBJECT);const t=e.resourceCache,n=e.gltf,i=e.bufferViewId,o=e.gltfResource,r=e.baseResource,s=e.cacheKey;A.typeOf.func("options.resourceCache",t),A.typeOf.object("options.gltf",n),A.typeOf.number("options.bufferViewId",i),A.typeOf.object("options.gltfResource",o),A.typeOf.object("options.baseResource",r);const a=n.bufferViews[i];let l=a.buffer,u=a.byteOffset,h=a.byteLength,f=!1,_,g,m,b;if(To(a,"EXT_meshopt_compression")){const x=a.extensions.EXT_meshopt_compression;l=x.buffer,u=y(x.byteOffset,0),h=x.byteLength,f=!0,_=x.byteStride,g=x.count,m=x.mode,b=y(x.filter,"NONE")}const T=n.buffers[l];this._hasMeshopt=f,this._meshoptByteStride=_,this._meshoptCount=g,this._meshoptMode=m,this._meshoptFilter=b,this._resourceCache=t,this._gltfResource=o,this._baseResource=r,this._buffer=T,this._bufferId=l,this._byteOffset=u,this._byteLength=h,this._cacheKey=s,this._bufferLoader=void 0,this._typedArray=void 0,this._state=ut.UNLOADED,this._promise=void 0}c(Object.create)&&(yh.prototype=Object.create(wo.prototype),yh.prototype.constructor=yh);Object.defineProperties(yh.prototype,{cacheKey:{get:function(){return this._cacheKey}},typedArray:{get:function(){return this._typedArray}}});async function gue(e){try{const t=yue(e);if(e._bufferLoader=t,await t.load(),e.isDestroyed())return;const n=t.typedArray,i=new Uint8Array(n.buffer,n.byteOffset+e._byteOffset,e._byteLength);if(e.unload(),e._typedArray=i,e._hasMeshopt){const o=e._meshoptCount,r=e._meshoptByteStride,s=new Uint8Array(o*r);_ue.decodeGltfBuffer(s,o,r,e._typedArray,e._meshoptMode,e._meshoptFilter),e._typedArray=s}return e._state=ut.READY,e}catch(t){if(e.isDestroyed())return;e.unload(),e._state=ut.FAILED;const n="Failed to load buffer view";throw e.getError(n,t)}}yh.prototype.load=async function(){return c(this._promise)?this._promise:(this._state=ut.LOADING,this._promise=gue(this),this._promise)};function yue(e){const t=e._resourceCache,n=e._buffer;if(c(n.uri)){const o=e._baseResource.getDerivedResource({url:n.uri});return t.getExternalBufferLoader({resource:o})}return t.getEmbeddedBufferLoader({parentResource:e._gltfResource,bufferId:e._bufferId})}yh.prototype.unload=function(){c(this._bufferLoader)&&!this._bufferLoader.isDestroyed()&&this._resourceCache.unload(this._bufferLoader),this._bufferLoader=void 0,this._typedArray=void 0};function Fi(){}Fi._maxDecodingConcurrency=Math.max(Yt.hardwareConcurrency-1,1);Fi._decoderTaskProcessor=void 0;Fi._taskProcessorReady=!1;Fi._error=void 0;Fi._getDecoderTaskProcessor=function(){if(!c(Fi._decoderTaskProcessor)){const e=new Kn("decodeDraco",Fi._maxDecodingConcurrency);e.initWebAssemblyModule({wasmBinaryFile:"ThirdParty/draco_decoder.wasm"}).then(function(t){t?Fi._taskProcessorReady=!0:Fi._error=new Te("Draco decoder could not be initialized.")}).catch(t=>{Fi._error=t}),Fi._decoderTaskProcessor=e}return Fi._decoderTaskProcessor};Fi.decodePointCloud=function(e){const t=Fi._getDecoderTaskProcessor();if(c(Fi._error))throw Fi._error;if(!!Fi._taskProcessorReady)return t.scheduleTask(e,[e.buffer.buffer])};Fi.decodeBufferView=function(e){const t=Fi._getDecoderTaskProcessor();if(c(Fi._error))throw Fi._error;if(!!Fi._taskProcessorReady)return t.scheduleTask(e,[e.array.buffer])};function Zu(e){e=y(e,y.EMPTY_OBJECT);const t=e.resourceCache,n=e.gltf,i=e.draco,o=e.gltfResource,r=e.baseResource,s=e.cacheKey;A.typeOf.func("options.resourceCache",t),A.typeOf.object("options.gltf",n),A.typeOf.object("options.draco",i),A.typeOf.object("options.gltfResource",o),A.typeOf.object("options.baseResource",r),this._resourceCache=t,this._gltfResource=o,this._baseResource=r,this._gltf=n,this._draco=i,this._cacheKey=s,this._bufferViewLoader=void 0,this._bufferViewTypedArray=void 0,this._decodePromise=void 0,this._decodedData=void 0,this._state=ut.UNLOADED,this._promise=void 0,this._dracoError=void 0}c(Object.create)&&(Zu.prototype=Object.create(wo.prototype),Zu.prototype.constructor=Zu);Object.defineProperties(Zu.prototype,{cacheKey:{get:function(){return this._cacheKey}},decodedData:{get:function(){return this._decodedData}}});async function bue(e){const t=e._resourceCache;try{const n=t.getBufferViewLoader({gltf:e._gltf,bufferViewId:e._draco.bufferView,gltfResource:e._gltfResource,baseResource:e._baseResource});return e._bufferViewLoader=n,await n.load(),e.isDestroyed()?void 0:(e._bufferViewTypedArray=n.typedArray,e._state=ut.PROCESSING,e)}catch(n){if(e.isDestroyed())return;f4(e,n)}}Zu.prototype.load=async function(){return c(this._promise)?this._promise:(this._state=ut.LOADING,this._promise=bue(this),this._promise)};function f4(e,t){e.unload(),e._state=ut.FAILED;const n="Failed to load Draco";throw e.getError(n,t)}async function Tue(e,t){try{const n=await t;return e.isDestroyed()?void 0:(e.unload(),e._decodedData={indices:n.indexArray,vertexAttributes:n.attributeData},e._state=ut.READY,e._baseResource)}catch(n){if(e.isDestroyed())return;e._dracoError=n}}Zu.prototype.process=function(e){if(A.typeOf.object("frameState",e),this._state===ut.READY)return!0;if(this._state!==ut.PROCESSING||(c(this._dracoError)&&f4(this,this._dracoError),!c(this._bufferViewTypedArray))||c(this._decodePromise))return!1;const t=this._draco,i=this._gltf.bufferViews,o=t.bufferView,r=i[o],s=t.attributes,a={array:new Uint8Array(this._bufferViewTypedArray),bufferView:r,compressedAttributes:s,dequantizeInShader:!0},l=Fi.decodeBufferView(a);if(!c(l))return!1;this._decodePromise=Tue(this,l)};Zu.prototype.unload=function(){c(this._bufferViewLoader)&&this._resourceCache.unload(this._bufferViewLoader),this._bufferViewLoader=void 0,this._bufferViewTypedArray=void 0,this._decodedData=void 0,this._gltf=void 0};function Aue(e){const t=e.uint8Array,n=e.format,i=e.request,o=y(e.flipY,!1),r=y(e.skipColorSpaceConversion,!1);A.typeOf.object("uint8Array",t),A.typeOf.string("format",n);const s=new Blob([t],{type:n});let a;return Ae.supportsImageBitmapOptions().then(function(l){return l?Promise.resolve(Ae.createImageBitmapFromBlob(s,{flipY:o,premultiplyAlpha:!1,skipColorSpaceConversion:r})):(a=window.URL.createObjectURL(s),new Ae({url:a,request:i}).fetchImage({flipY:o,skipColorSpaceConversion:r}))}).then(function(l){return c(a)&&window.URL.revokeObjectURL(a),l}).catch(function(l){return c(a)&&window.URL.revokeObjectURL(a),Promise.reject(l)})}function Zl(e){e=y(e,y.EMPTY_OBJECT);const t=e.resourceCache,n=e.gltf,i=e.imageId,o=e.gltfResource,r=e.baseResource,s=e.cacheKey;A.typeOf.func("options.resourceCache",t),A.typeOf.object("options.gltf",n),A.typeOf.number("options.imageId",i),A.typeOf.object("options.gltfResource",o),A.typeOf.object("options.baseResource",r);const a=n.images[i],l=a.bufferView,u=a.uri;this._resourceCache=t,this._gltfResource=o,this._baseResource=r,this._gltf=n,this._bufferViewId=l,this._uri=u,this._cacheKey=s,this._bufferViewLoader=void 0,this._image=void 0,this._mipLevels=void 0,this._state=ut.UNLOADED,this._promise=void 0}c(Object.create)&&(Zl.prototype=Object.create(wo.prototype),Zl.prototype.constructor=Zl);Object.defineProperties(Zl.prototype,{cacheKey:{get:function(){return this._cacheKey}},image:{get:function(){return this._image}},mipLevels:{get:function(){return this._mipLevels}}});Zl.prototype.load=function(){return c(this._promise)?this._promise:c(this._bufferViewId)?(this._promise=xue(this),this._promise):(this._promise=Cue(this),this._promise)};function p4(e){let t;return Array.isArray(e)&&(t=e.slice(1,e.length).map(function(n){return n.bufferView}),e=e[0]),{image:e,mipLevels:t}}async function xue(e){e._state=ut.LOADING;const t=e._resourceCache;try{const n=t.getBufferViewLoader({gltf:e._gltf,bufferViewId:e._bufferViewId,gltfResource:e._gltfResource,baseResource:e._baseResource});if(e._bufferViewLoader=n,await n.load(),e.isDestroyed())return;const i=n.typedArray,o=await wue(i);if(e.isDestroyed())return;const r=p4(o);return e.unload(),e._image=r.image,e._mipLevels=r.mipLevels,e._state=ut.READY,e}catch(n){return e.isDestroyed()?void 0:m4(e,n,"Failed to load embedded image")}}async function Cue(e){e._state=ut.LOADING;const t=e._baseResource,n=e._uri,i=t.getDerivedResource({url:n});try{const o=await vue(i);if(e.isDestroyed())return;const r=p4(o);return e.unload(),e._image=r.image,e._mipLevels=r.mipLevels,e._state=ut.READY,e}catch(o){return e.isDestroyed()?void 0:m4(e,o,`Failed to load image: ${n}`)}}function m4(e,t,n){return e.unload(),e._state=ut.FAILED,Promise.reject(e.getError(n,t))}function Eue(e){const t=e.subarray(0,2),n=e.subarray(0,4),i=e.subarray(8,12);if(t[0]===255&&t[1]===216)return"image/jpeg";if(t[0]===137&&t[1]===80)return"image/png";if(t[0]===171&&t[1]===75)return"image/ktx2";if(n[0]===82&&n[1]===73&&n[2]===70&&n[3]===70&&i[0]===87&&i[1]===69&&i[2]===66&&i[3]===80)return"image/webp";throw new Te("Image format is not recognized")}async function wue(e){const t=Eue(e);if(t==="image/ktx2"){const n=new Uint8Array(e);return Op(n)}return Zl._loadImageFromTypedArray({uint8Array:e,format:t,flipY:!1,skipColorSpaceConversion:!0})}const Sue=/(^data:image\/ktx2)|(\.ktx2$)/i;function vue(e){const t=e.getUrlComponent(!1,!0);return Sue.test(t)?Op(e):e.fetchImage({skipColorSpaceConversion:!0,preferImageBitmap:!0})}Zl.prototype.unload=function(){c(this._bufferViewLoader)&&!this._bufferViewLoader.isDestroyed()&&this._resourceCache.unload(this._bufferViewLoader),this._bufferViewLoader=void 0,this._uri=void 0,this._image=void 0,this._mipLevels=void 0,this._gltf=void 0};Zl._loadImageFromTypedArray=Aue;const Iue={TEXTURE:0,PROGRAM:1,BUFFER:2,NUMBER_OF_JOB_TYPES:3},nl=Object.freeze(Iue);function Ju(e){e=y(e,y.EMPTY_OBJECT);const t=e.resourceCache,n=e.gltf,i=e.accessorId,o=e.gltfResource,r=e.baseResource,s=e.draco,a=e.cacheKey,l=y(e.asynchronous,!0),u=y(e.loadBuffer,!1),h=y(e.loadTypedArray,!1);if(A.typeOf.func("options.resourceCache",t),A.typeOf.object("options.gltf",n),A.typeOf.number("options.accessorId",i),A.typeOf.object("options.gltfResource",o),A.typeOf.object("options.baseResource",r),!u&&!h)throw new E("At least one of loadBuffer and loadTypedArray must be true.");const f=n.accessors[i].componentType;this._resourceCache=t,this._gltfResource=o,this._baseResource=r,this._gltf=n,this._accessorId=i,this._indexDatatype=f,this._draco=s,this._cacheKey=a,this._asynchronous=l,this._loadBuffer=u,this._loadTypedArray=h,this._bufferViewLoader=void 0,this._dracoLoader=void 0,this._typedArray=void 0,this._buffer=void 0,this._state=ut.UNLOADED,this._promise=void 0}c(Object.create)&&(Ju.prototype=Object.create(wo.prototype),Ju.prototype.constructor=Ju);Object.defineProperties(Ju.prototype,{cacheKey:{get:function(){return this._cacheKey}},buffer:{get:function(){return this._buffer}},typedArray:{get:function(){return this._typedArray}},indexDatatype:{get:function(){return this._indexDatatype}}});const Due=new dO;Ju.prototype.load=async function(){return c(this._promise)?this._promise:c(this._draco)?(this._promise=Pue(this),this._promise):(this._promise=Oue(this),this._promise)};async function Pue(e){e._state=ut.LOADING;const t=e._resourceCache;try{const n=t.getDracoLoader({gltf:e._gltf,draco:e._draco,gltfResource:e._gltfResource,baseResource:e._baseResource});return e._dracoLoader=n,await n.load(),e.isDestroyed()?void 0:(e._state=ut.LOADED,e)}catch(n){if(e.isDestroyed())return;uO(e,n)}}async function Oue(e){const t=e._gltf,n=e._accessorId,o=t.accessors[n].bufferView;e._state=ut.LOADING;const r=e._resourceCache;try{const s=r.getBufferViewLoader({gltf:t,bufferViewId:o,gltfResource:e._gltfResource,baseResource:e._baseResource});if(e._bufferViewLoader=s,await s.load(),e.isDestroyed())return;const a=s.typedArray;return e._typedArray=Lue(e,a),e._state=ut.PROCESSING,e}catch(s){if(e.isDestroyed())return;uO(e,s)}}function Lue(e,t){const n=e._gltf,i=e._accessorId,o=n.accessors[i],r=o.count,s=o.componentType,a=je.getSizeInBytes(s);let l=t.buffer,u=t.byteOffset+o.byteOffset;if(u%a!==0){const f=r*a,_=new Uint8Array(l,u,f);l=new Uint8Array(_).buffer,u=0,Xh("index-buffer-unaligned",`The index array is not aligned to a ${a}-byte boundary.`)}let h;return s===je.UNSIGNED_BYTE?h=new Uint8Array(l,u,r):s===je.UNSIGNED_SHORT?h=new Uint16Array(l,u,r):s===je.UNSIGNED_INT&&(h=new Uint32Array(l,u,r)),h}function uO(e,t){e.unload(),e._state=ut.FAILED;const n="Failed to load index buffer";throw e.getError(n,t)}function dO(){this.typedArray=void 0,this.indexDatatype=void 0,this.context=void 0,this.buffer=void 0}dO.prototype.set=function(e,t,n){this.typedArray=e,this.indexDatatype=t,this.context=n};dO.prototype.execute=function(){this.buffer=_4(this.typedArray,this.indexDatatype,this.context)};function _4(e,t,n){const i=ct.createIndexBuffer({typedArray:e,context:n,usage:ke.STATIC_DRAW,indexDatatype:t});return i.vertexArrayDestroyable=!1,i}Ju.prototype.process=function(e){if(A.typeOf.object("frameState",e),this._state===ut.READY)return!0;if(this._state!==ut.LOADED&&this._state!==ut.PROCESSING)return!1;let t=this._typedArray,n=this._indexDatatype;if(c(this._dracoLoader))try{this._dracoLoader.process(e)&&(t=this._dracoLoader.decodedData.indices.typedArray,this._typedArray=t,n=Z.fromTypedArray(t),this._indexDatatype=n)}catch(o){uO(this,o)}if(!c(t))return!1;let i;if(this._loadBuffer&&this._asynchronous){const o=Due;if(o.set(t,n,e.context),!e.jobScheduler.execute(o,nl.BUFFER))return!1;i=o.buffer}else this._loadBuffer&&(i=_4(t,n,e.context));return this.unload(),this._buffer=i,this._typedArray=this._loadTypedArray?t:void 0,this._state=ut.READY,this._resourceCache.statistics.addGeometryLoader(this),!0};Ju.prototype.unload=function(){c(this._buffer)&&this._buffer.destroy();const e=this._resourceCache;c(this._bufferViewLoader)&&!this._bufferViewLoader.isDestroyed()&&e.unload(this._bufferViewLoader),c(this._dracoLoader)&&e.unload(this._dracoLoader),this._bufferViewLoader=void 0,this._dracoLoader=void 0,this._typedArray=void 0,this._buffer=void 0,this._gltf=void 0};function ul(e,t,n){if(n=y(n,!1),n){const i=e.indexOf(t);if(i>-1)return i}return e.push(t),e.length-1}function cr(e,t){return c(e.extensionsUsed)&&e.extensionsUsed.indexOf(t)>=0}function me(){}me.objectLegacy=function(e,t){if(c(e)){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)){const i=e[n],o=t(i,n);if(c(o))return o}}};me.object=function(e,t){if(c(e)){const n=e.length;for(let i=0;i<n;i++){const o=e[i],r=t(o,i);if(c(r))return r}}};me.topLevel=function(e,t,n){const i=e[t];return c(i)&&!Array.isArray(i)?me.objectLegacy(i,n):me.object(i,n)};me.accessor=function(e,t){return me.topLevel(e,"accessors",t)};me.accessorWithSemantic=function(e,t,n){const i={};return me.mesh(e,function(o){return me.meshPrimitive(o,function(r){const s=me.meshPrimitiveAttribute(r,function(a,l){if(l.indexOf(t)===0&&!c(i[a])){i[a]=!0;const u=n(a);if(c(u))return u}});return c(s)?s:me.meshPrimitiveTarget(r,function(a){return me.meshPrimitiveTargetAttribute(a,function(l,u){if(u.indexOf(t)===0&&!c(i[l])){i[l]=!0;const h=n(l);if(c(h))return h}})})})})};me.accessorContainingVertexAttributeData=function(e,t){const n={};return me.mesh(e,function(i){return me.meshPrimitive(i,function(o){const r=me.meshPrimitiveAttribute(o,function(s){if(!c(n[s])){n[s]=!0;const a=t(s);if(c(a))return a}});return c(r)?r:me.meshPrimitiveTarget(o,function(s){return me.meshPrimitiveTargetAttribute(s,function(a){if(!c(n[a])){n[a]=!0;const l=t(a);if(c(l))return l}})})})})};me.accessorContainingIndexData=function(e,t){const n={};return me.mesh(e,function(i){return me.meshPrimitive(i,function(o){const r=o.indices;if(c(r)&&!c(n[r])){n[r]=!0;const s=t(r);if(c(s))return s}})})};me.animation=function(e,t){return me.topLevel(e,"animations",t)};me.animationChannel=function(e,t){const n=e.channels;return me.object(n,t)};me.animationSampler=function(e,t){const n=e.samplers;return me.object(n,t)};me.buffer=function(e,t){return me.topLevel(e,"buffers",t)};me.bufferView=function(e,t){return me.topLevel(e,"bufferViews",t)};me.camera=function(e,t){return me.topLevel(e,"cameras",t)};me.image=function(e,t){return me.topLevel(e,"images",t)};me.material=function(e,t){return me.topLevel(e,"materials",t)};me.materialValue=function(e,t){let n=e.values;c(e.extensions)&&c(e.extensions.KHR_techniques_webgl)&&(n=e.extensions.KHR_techniques_webgl.values);for(const i in n)if(Object.prototype.hasOwnProperty.call(n,i)){const o=t(n[i],i);if(c(o))return o}};me.mesh=function(e,t){return me.topLevel(e,"meshes",t)};me.meshPrimitive=function(e,t){const n=e.primitives;if(c(n)){const i=n.length;for(let o=0;o<i;o++){const r=n[o],s=t(r,o);if(c(s))return s}}};me.meshPrimitiveAttribute=function(e,t){const n=e.attributes;for(const i in n)if(Object.prototype.hasOwnProperty.call(n,i)){const o=t(n[i],i);if(c(o))return o}};me.meshPrimitiveTarget=function(e,t){const n=e.targets;if(c(n)){const i=n.length;for(let o=0;o<i;++o){const r=t(n[o],o);if(c(r))return r}}};me.meshPrimitiveTargetAttribute=function(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)){const i=e[n],o=t(i,n);if(c(o))return o}};me.node=function(e,t){return me.topLevel(e,"nodes",t)};me.nodeInTree=function(e,t,n){const i=e.nodes;if(c(i)){const o=t.length;for(let r=0;r<o;r++){const s=t[r],a=i[s];if(c(a)){let l=n(a,s);if(c(l))return l;const u=a.children;if(c(u)&&(l=me.nodeInTree(e,u,n),c(l)))return l}}}};me.nodeInScene=function(e,t,n){const i=t.nodes;if(c(i))return me.nodeInTree(e,i,n)};me.program=function(e,t){return cr(e,"KHR_techniques_webgl")?me.object(e.extensions.KHR_techniques_webgl.programs,t):me.topLevel(e,"programs",t)};me.sampler=function(e,t){return me.topLevel(e,"samplers",t)};me.scene=function(e,t){return me.topLevel(e,"scenes",t)};me.shader=function(e,t){return cr(e,"KHR_techniques_webgl")?me.object(e.extensions.KHR_techniques_webgl.shaders,t):me.topLevel(e,"shaders",t)};me.skin=function(e,t){return me.topLevel(e,"skins",t)};me.skinJoint=function(e,t){const n=e.joints;if(c(n)){const i=n.length;for(let o=0;o<i;o++){const r=n[o],s=t(r);if(c(s))return s}}};me.techniqueAttribute=function(e,t){const n=e.attributes;for(const i in n)if(Object.prototype.hasOwnProperty.call(n,i)){const o=t(n[i],i);if(c(o))return o}};me.techniqueUniform=function(e,t){const n=e.uniforms;for(const i in n)if(Object.prototype.hasOwnProperty.call(n,i)){const o=t(n[i],i);if(c(o))return o}};me.techniqueParameter=function(e,t){const n=e.parameters;for(const i in n)if(Object.prototype.hasOwnProperty.call(n,i)){const o=t(n[i],i);if(c(o))return o}};me.technique=function(e,t){return cr(e,"KHR_techniques_webgl")?me.object(e.extensions.KHR_techniques_webgl.techniques,t):me.topLevel(e,"techniques",t)};me.texture=function(e,t){return me.topLevel(e,"textures",t)};function U0(e){switch(e){case"SCALAR":return 1;case"VEC2":return 2;case"VEC3":return 3;case"VEC4":case"MAT2":return 4;case"MAT3":return 9;case"MAT4":return 16}}function W_(e,t){const n=t.bufferView;if(c(n)){const i=e.bufferViews[n];if(c(i.byteStride)&&i.byteStride>0)return i.byteStride}return Z.getSizeInBytes(t.componentType)*U0(t.type)}function Rue(e){me.accessor(e,function(n){c(n.bufferView)&&(n.byteOffset=y(n.byteOffset,0))}),me.bufferView(e,function(n){c(n.buffer)&&(n.byteOffset=y(n.byteOffset,0))}),me.mesh(e,function(n){me.meshPrimitive(n,function(i){if(i.mode=y(i.mode,J.TRIANGLES),!c(i.material)){c(e.materials)||(e.materials=[]);const o={name:"default"};i.material=ul(e.materials,o)}})}),me.accessorContainingVertexAttributeData(e,function(n){const i=e.accessors[n],o=i.bufferView;if(i.normalized=y(i.normalized,!1),c(o)){const r=e.bufferViews[o];r.byteStride=W_(e,i),r.target=J.ARRAY_BUFFER}}),me.accessorContainingIndexData(e,function(n){const o=e.accessors[n].bufferView;if(c(o)){const r=e.bufferViews[o];r.target=J.ELEMENT_ARRAY_BUFFER}}),me.material(e,function(n){const i=y(n.extensions,y.EMPTY_OBJECT),o=i.KHR_materials_common;if(c(o)){const l=o.technique,u=c(o.values)?o.values:{};o.values=u,u.ambient=c(u.ambient)?u.ambient:[0,0,0,1],u.emission=c(u.emission)?u.emission:[0,0,0,1],u.transparency=y(u.transparency,1),l!=="CONSTANT"&&(u.diffuse=c(u.diffuse)?u.diffuse:[0,0,0,1],l!=="LAMBERT"&&(u.specular=c(u.specular)?u.specular:[0,0,0,1],u.shininess=y(u.shininess,0))),o.transparent=y(o.transparent,!1),o.doubleSided=y(o.doubleSided,!1);return}n.emissiveFactor=y(n.emissiveFactor,[0,0,0]),n.alphaMode=y(n.alphaMode,"OPAQUE"),n.doubleSided=y(n.doubleSided,!1),n.alphaMode==="MASK"&&(n.alphaCutoff=y(n.alphaCutoff,.5));const r=i.KHR_techniques_webgl;c(r)&&me.materialValue(n,function(l){c(l.index)&&yf(l)}),yf(n.emissiveTexture),yf(n.normalTexture),yf(n.occlusionTexture);const s=n.pbrMetallicRoughness;c(s)&&(s.baseColorFactor=y(s.baseColorFactor,[1,1,1,1]),s.metallicFactor=y(s.metallicFactor,1),s.roughnessFactor=y(s.roughnessFactor,1),yf(s.baseColorTexture),yf(s.metallicRoughnessTexture));const a=i.KHR_materials_pbrSpecularGlossiness;c(a)&&(a.diffuseFactor=y(a.diffuseFactor,[1,1,1,1]),a.specularFactor=y(a.specularFactor,[1,1,1]),a.glossinessFactor=y(a.glossinessFactor,1),yf(a.specularGlossinessTexture))}),me.animation(e,function(n){me.animationSampler(n,function(i){i.interpolation=y(i.interpolation,"LINEAR")})});const t=Nue(e);return me.node(e,function(n,i){c(t[i])||c(n.translation)||c(n.rotation)||c(n.scale)?(n.translation=y(n.translation,[0,0,0]),n.rotation=y(n.rotation,[0,0,0,1]),n.scale=y(n.scale,[1,1,1])):n.matrix=y(n.matrix,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}),me.sampler(e,function(n){n.wrapS=y(n.wrapS,J.REPEAT),n.wrapT=y(n.wrapT,J.REPEAT)}),c(e.scenes)&&!c(e.scene)&&(e.scene=0),e}function Nue(e){const t={};return me.animation(e,function(n){me.animationChannel(n,function(i){const o=i.target,r=o.node,s=o.path;(s==="translation"||s==="rotation"||s==="scale")&&(t[r]=!0)})}),t}function yf(e){c(e)&&(e.texCoord=y(e.texCoord,0))}function hO(e){return me.shader(e,function(t){aT(t)}),me.buffer(e,function(t){aT(t)}),me.image(e,function(t){aT(t)}),aT(e),e}function aT(e){e.extras=c(e.extras)?e.extras:{},e.extras._pipeline=c(e.extras._pipeline)?e.extras._pipeline:{}}function Mue(e,t){const n=e.extensionsRequired;if(c(n)){const i=n.indexOf(t);i>=0&&n.splice(i,1),n.length===0&&delete e.extensionsRequired}}function g4(e,t){const n=e.extensionsUsed;if(c(n)){const i=n.indexOf(t);i>=0&&n.splice(i,1),Mue(e,t),n.length===0&&delete e.extensionsUsed}}const Fue=4;function Bue(e){if(xC(e)!=="glTF")throw new Te("File is not valid binary glTF");const n=y4(e,0,5),i=n[1];if(i!==1&&i!==2)throw new Te("Binary glTF version is not 1 or 2");return i===1?zue(e,n):Uue(e,n)}function y4(e,t,n){const i=new DataView(e.buffer),o=new Array(n);for(let r=0;r<n;++r)o[r]=i.getUint32(e.byteOffset+t+r*Fue,!0);return o}function zue(e,t){const n=t[2],i=t[3];if(t[4]!==0)throw new Te("Binary glTF scene format is not JSON");const r=20,s=r+i,a=Ta(e,r,i),l=JSON.parse(a);hO(l);const u=e.subarray(s,n),h=l.buffers;if(c(h)&&Object.keys(h).length>0){const f=y(h.binary_glTF,h.KHR_binary_glTF);c(f)&&(f.extras._pipeline.source=u,delete f.uri)}return g4(l,"KHR_binary_glTF"),l}function Uue(e,t){const n=t[2];let i=12,o,r;for(;i<n;){const s=y4(e,i,2),a=s[0],l=s[1];i+=8;const u=e.subarray(i,i+a);if(i+=a,l===1313821514){const h=Ta(u);o=JSON.parse(h),hO(o)}else l===5130562&&(r=u)}if(c(o)&&c(r)){const s=o.buffers;if(c(s)&&s.length>0){const a=s[0];a.extras._pipeline.source=r}}return o}function kue(e){return me.shader(e,function(t){cT(t)}),me.buffer(e,function(t){cT(t)}),me.image(e,function(t){cT(t)}),cT(e),e}function cT(e){!c(e.extras)||(c(e.extras._pipeline)&&delete e.extras._pipeline,Object.keys(e.extras).length===0&&delete e.extras)}function k0(e,t){let n=e.extensionsUsed;c(n)||(n=[],e.extensionsUsed=n),ul(n,t,!0)}function fO(e){switch(e){case Z.BYTE:return function(t,n,i,o,r){for(let s=0;s<i;++s)r[s]=t.getInt8(n+s*o)};case Z.UNSIGNED_BYTE:return function(t,n,i,o,r){for(let s=0;s<i;++s)r[s]=t.getUint8(n+s*o)};case Z.SHORT:return function(t,n,i,o,r){for(let s=0;s<i;++s)r[s]=t.getInt16(n+s*o,!0)};case Z.UNSIGNED_SHORT:return function(t,n,i,o,r){for(let s=0;s<i;++s)r[s]=t.getUint16(n+s*o,!0)};case Z.INT:return function(t,n,i,o,r){for(let s=0;s<i;++s)r[s]=t.getInt32(n+s*o,!0)};case Z.UNSIGNED_INT:return function(t,n,i,o,r){for(let s=0;s<i;++s)r[s]=t.getUint32(n+s*o,!0)};case Z.FLOAT:return function(t,n,i,o,r){for(let s=0;s<i;++s)r[s]=t.getFloat32(n+s*o,!0)};case Z.DOUBLE:return function(t,n,i,o,r){for(let s=0;s<i;++s)r[s]=t.getFloat64(n+s*o,!0)}}}function pO(e,t){const n=e.bufferViews,i=e.buffers,o=t.bufferView,r=U0(t.type);if(!c(t.bufferView))return{min:new Array(r).fill(0),max:new Array(r).fill(0)};const s=new Array(r).fill(Number.POSITIVE_INFINITY),a=new Array(r).fill(Number.NEGATIVE_INFINITY),l=n[o],u=l.buffer,f=i[u].extras._pipeline.source,_=t.count,g=W_(e,t);let m=t.byteOffset+l.byteOffset+f.byteOffset;const b=t.componentType,T=Z.getSizeInBytes(b),x=new DataView(f.buffer),C=new Array(r),w=fO(b);for(let v=0;v<_;v++){w(x,m,r,T,C);for(let P=0;P<r;P++){const N=C[P];s[P]=Math.min(s[P],N),a[P]=Math.max(a[P],N)}m+=g}return{min:s,max:a}}const Vue=[J.FUNC_ADD,J.FUNC_ADD],Hue=[J.ONE,J.ZERO,J.ONE,J.ZERO];function DM(e,t){const n=e.enable;return c(n)?n.indexOf(t)>-1:!1}const Gue=[J.ZERO,J.ONE,J.SRC_COLOR,J.ONE_MINUS_SRC_COLOR,J.SRC_ALPHA,J.ONE_MINUS_SRC_ALPHA,J.DST_ALPHA,J.ONE_MINUS_DST_ALPHA,J.DST_COLOR,J.ONE_MINUS_DST_COLOR];function jue(e,t){if(!c(e))return t;for(let n=0;n<4;n++)if(Gue.indexOf(e[n])===-1)return t;return e}function Wue(e){const t={},n={},i=e.techniques;return c(i)&&(me.technique(e,function(o,r){const s=o.states;if(c(s)){const a=n[r]={};if(DM(s,J.BLEND)){a.alphaMode="BLEND";const l=s.functions;c(l)&&(c(l.blendEquationSeparate)||c(l.blendFuncSeparate))&&(t[r]={blendEquation:y(l.blendEquationSeparate,Vue),blendFactors:jue(l.blendFuncSeparate,Hue)})}DM(s,J.CULL_FACE)||(a.doubleSided=!0),delete o.states}}),Object.keys(t).length>0&&(c(e.extensions)||(e.extensions={}),k0(e,"KHR_blend")),me.material(e,function(o){if(c(o.technique)){const r=n[o.technique];me.objectLegacy(r,function(a,l){o[l]=a});const s=t[o.technique];c(s)&&(c(o.extensions)||(o.extensions={}),o.extensions.KHR_blend=s)}})),e}function que(e,t){let n=e.extensionsRequired;c(n)||(n=[],e.extensionsRequired=n),ul(n,t,!0),k0(e,t)}function Yue(e){const t=e.techniques,n={},i={},o={};if(c(t)){const r={programs:[],shaders:[],techniques:[]},s=e.glExtensionsUsed;delete e.glExtensionsUsed,me.technique(e,function(a,l){const u={name:a.name,program:void 0,attributes:{},uniforms:{}};let h;if(me.techniqueAttribute(a,function(f,_){h=a.parameters[f],u.attributes[_]={semantic:h.semantic}}),me.techniqueUniform(a,function(f,_){h=a.parameters[f],u.uniforms[_]={count:h.count,node:h.node,type:h.type,semantic:h.semantic,value:h.value},c(n[l])||(n[l]={}),n[l][f]=_}),c(o[a.program]))u.program=o[a.program];else{const f=e.programs[a.program],_={name:f.name,fragmentShader:void 0,vertexShader:void 0,glExtensions:s},g=e.shaders[f.fragmentShader];_.fragmentShader=ul(r.shaders,g,!0);const m=e.shaders[f.vertexShader];_.vertexShader=ul(r.shaders,m,!0),u.program=ul(r.programs,_),o[a.program]=u.program}i[l]=ul(r.techniques,u)}),r.techniques.length>0&&(c(e.extensions)||(e.extensions={}),e.extensions.KHR_techniques_webgl=r,k0(e,"KHR_techniques_webgl"),que(e,"KHR_techniques_webgl"))}return me.material(e,function(r){if(c(r.technique)){const s={technique:i[r.technique]};me.objectLegacy(r.values,function(a,l){c(s.values)||(s.values={});const u=n[r.technique][l];c(u)&&(s.values[u]=a)}),c(r.extensions)||(r.extensions={}),r.extensions.KHR_techniques_webgl=s}delete r.technique,delete r.values}),delete e.techniques,delete e.programs,delete e.shaders,e}function b4(e,t){A.typeOf.object("material",e),A.defined("handler",t);const n=e.pbrMetallicRoughness;if(c(n)){if(c(n.baseColorTexture)){const o=n.baseColorTexture,r=t(o.index,o);if(c(r))return r}if(c(n.metallicRoughnessTexture)){const o=n.metallicRoughnessTexture,r=t(o.index,o);if(c(r))return r}}if(c(e.extensions)){const o=e.extensions.KHR_materials_pbrSpecularGlossiness;if(c(o)){if(c(o.diffuseTexture)){const s=o.diffuseTexture,a=t(s.index,s);if(c(a))return a}if(c(o.specularGlossinessTexture)){const s=o.specularGlossinessTexture,a=t(s.index,s);if(c(a))return a}}const r=e.extensions.KHR_materials_common;if(c(r)&&c(r.values)){const s=r.values.diffuse,a=r.values.ambient,l=r.values.emission,u=r.values.specular;if(c(s)&&c(s.index)){const h=t(s.index,s);if(c(h))return h}if(c(a)&&c(a.index)){const h=t(a.index,a);if(c(h))return h}if(c(l)&&c(l.index)){const h=t(l.index,l);if(c(h))return h}if(c(u)&&c(u.index)){const h=t(u.index,u);if(c(h))return h}}}const i=me.materialValue(e,function(o){if(c(o.index)){const r=t(o.index,o);if(c(r))return r}});if(c(i))return i;if(c(e.emissiveTexture)){const o=e.emissiveTexture,r=t(o.index,o);if(c(r))return r}if(c(e.normalTexture)){const o=e.normalTexture,r=t(o.index,o);if(c(r))return r}if(c(e.occlusionTexture)){const o=e.occlusionTexture,r=t(o.index,o);if(c(r))return r}}const PM=["mesh","node","material","accessor","bufferView","buffer","texture","sampler","image"];function $ue(e,t){return t=y(t,PM),PM.forEach(function(n){t.indexOf(n)>-1&&Que(e,n)}),e}const Xue={accessor:"accessors",buffer:"buffers",bufferView:"bufferViews",image:"images",node:"nodes",material:"materials",mesh:"meshes",sampler:"samplers",texture:"textures"};function Que(e,t){const n=Xue[t],i=e[n];if(c(i)){let o=0;const r=_u[t](e),s=i.length;for(let a=0;a<s;++a)r[a]||(mu[t](e,a-o),o++)}}function mu(){}mu.accessor=function(e,t){e.accessors.splice(t,1),me.mesh(e,function(i){me.meshPrimitive(i,function(o){me.meshPrimitiveAttribute(o,function(a,l){a>t&&o.attributes[l]--}),me.meshPrimitiveTarget(o,function(a){me.meshPrimitiveTargetAttribute(a,function(l,u){l>t&&a[u]--})});const r=o.indices;c(r)&&r>t&&o.indices--;const s=o.extensions;c(s)&&c(s.CESIUM_primitive_outline)&&s.CESIUM_primitive_outline.indices>t&&--s.CESIUM_primitive_outline.indices})}),me.skin(e,function(i){c(i.inverseBindMatrices)&&i.inverseBindMatrices>t&&i.inverseBindMatrices--}),me.animation(e,function(i){me.animationSampler(i,function(o){c(o.input)&&o.input>t&&o.input--,c(o.output)&&o.output>t&&o.output--})})};mu.buffer=function(e,t){e.buffers.splice(t,1),me.bufferView(e,function(i){c(i.buffer)&&i.buffer>t&&i.buffer--,c(i.extensions)&&c(i.extensions.EXT_meshopt_compression)&&i.extensions.EXT_meshopt_compression.buffer--})};mu.bufferView=function(e,t){if(e.bufferViews.splice(t,1),me.accessor(e,function(i){c(i.bufferView)&&i.bufferView>t&&i.bufferView--}),me.shader(e,function(i){c(i.bufferView)&&i.bufferView>t&&i.bufferView--}),me.image(e,function(i){c(i.bufferView)&&i.bufferView>t&&i.bufferView--}),cr(e,"KHR_draco_mesh_compression")&&me.mesh(e,function(i){me.meshPrimitive(i,function(o){c(o.extensions)&&c(o.extensions.KHR_draco_mesh_compression)&&o.extensions.KHR_draco_mesh_compression.bufferView>t&&o.extensions.KHR_draco_mesh_compression.bufferView--})}),cr(e,"EXT_feature_metadata")){const o=e.extensions.EXT_feature_metadata.featureTables;for(const r in o)if(o.hasOwnProperty(r)){const a=o[r].properties;if(c(a)){for(const l in a)if(a.hasOwnProperty(l)){const u=a[l];c(u.bufferView)&&u.bufferView>t&&u.bufferView--,c(u.arrayOffsetBufferView)&&u.arrayOffsetBufferView>t&&u.arrayOffsetBufferView--,c(u.stringOffsetBufferView)&&u.stringOffsetBufferView>t&&u.stringOffsetBufferView--}}}}if(cr(e,"EXT_structural_metadata")){const o=e.extensions.EXT_structural_metadata.propertyTables;if(c(o)){const r=o.length;for(let s=0;s<r;++s){const l=o[s].properties;for(const u in l)if(l.hasOwnProperty(u)){const h=l[u];c(h.values)&&h.values>t&&h.values--,c(h.arrayOffsets)&&h.arrayOffsets>t&&h.arrayOffsets--,c(h.stringOffsets)&&h.stringOffsets>t&&h.stringOffsets--}}}}};mu.image=function(e,t){e.images.splice(t,1),me.texture(e,function(i){c(i.source)&&i.source>t&&--i.source;const o=i.extensions;c(o)&&c(o.EXT_texture_webp)&&o.EXT_texture_webp.source>t?--i.extensions.EXT_texture_webp.source:c(o)&&c(o.KHR_texture_basisu)&&o.KHR_texture_basisu.source>t&&--i.extensions.KHR_texture_basisu.source})};mu.mesh=function(e,t){e.meshes.splice(t,1),me.node(e,function(i){c(i.mesh)&&(i.mesh>t?i.mesh--:i.mesh===t&&delete i.mesh)})};mu.node=function(e,t){e.nodes.splice(t,1),me.skin(e,function(i){c(i.skeleton)&&i.skeleton>t&&i.skeleton--,i.joints=i.joints.map(function(o){return o>t?o-1:o})}),me.animation(e,function(i){me.animationChannel(i,function(o){c(o.target)&&c(o.target.node)&&o.target.node>t&&o.target.node--})}),me.technique(e,function(i){me.techniqueUniform(i,function(o){c(o.node)&&o.node>t&&o.node--})}),me.node(e,function(i){!c(i.children)||(i.children=i.children.filter(function(o){return o!==t}).map(function(o){return o>t?o-1:o}))}),me.scene(e,function(i){i.nodes=i.nodes.filter(function(o){return o!==t}).map(function(o){return o>t?o-1:o})})};mu.material=function(e,t){e.materials.splice(t,1),me.mesh(e,function(i){me.meshPrimitive(i,function(o){c(o.material)&&o.material>t&&o.material--})})};mu.sampler=function(e,t){e.samplers.splice(t,1),me.texture(e,function(i){c(i.sampler)&&i.sampler>t&&--i.sampler})};mu.texture=function(e,t){if(e.textures.splice(t,1),me.material(e,function(i){b4(i,function(o,r){r.index>t&&--r.index})}),cr(e,"EXT_feature_metadata")){me.mesh(e,function(r){me.meshPrimitive(r,function(s){const a=s.extensions;if(c(a)&&c(a.EXT_feature_metadata)){const u=a.EXT_feature_metadata.featureIdTextures;if(c(u)){const h=u.length;for(let f=0;f<h;++f){const g=u[f].featureIds.texture;g.index>t&&--g.index}}}})});const o=e.extensions.EXT_feature_metadata.featureTextures;for(const r in o)if(o.hasOwnProperty(r)){const a=o[r].properties;if(c(a)){for(const l in a)if(a.hasOwnProperty(l)){const h=a[l].texture;h.index>t&&--h.index}}}}if(cr(e,"EXT_mesh_features")&&me.mesh(e,function(i){me.meshPrimitive(i,function(o){const r=o.extensions;if(c(r)&&c(r.EXT_mesh_features)){const a=r.EXT_mesh_features.featureIds;if(c(a)){const l=a.length;for(let u=0;u<l;++u){const h=a[u];c(h.texture)&&h.texture.index>t&&--h.texture.index}}}})}),cr(e,"EXT_structural_metadata")){const o=e.extensions.EXT_structural_metadata.propertyTextures;if(c(o)){const r=o.length;for(let s=0;s<r;++s){const l=o[s].properties;for(const u in l)if(l.hasOwnProperty(u)){const h=l[u];h.index>t&&--h.index}}}}};function _u(){}_u.accessor=function(e){const t={};return me.mesh(e,function(n){me.meshPrimitive(n,function(i){me.meshPrimitiveAttribute(i,function(r){t[r]=!0}),me.meshPrimitiveTarget(i,function(r){me.meshPrimitiveTargetAttribute(r,function(s){t[s]=!0})});const o=i.indices;c(o)&&(t[o]=!0)})}),me.skin(e,function(n){c(n.inverseBindMatrices)&&(t[n.inverseBindMatrices]=!0)}),me.animation(e,function(n){me.animationSampler(n,function(i){c(i.input)&&(t[i.input]=!0),c(i.output)&&(t[i.output]=!0)})}),cr(e,"EXT_mesh_gpu_instancing")&&me.node(e,function(n){c(n.extensions)&&c(n.extensions.EXT_mesh_gpu_instancing)&&Object.keys(n.extensions.EXT_mesh_gpu_instancing.attributes).forEach(function(i){const o=n.extensions.EXT_mesh_gpu_instancing.attributes[i];t[o]=!0})}),cr(e,"CESIUM_primitive_outline")&&me.mesh(e,function(n){me.meshPrimitive(n,function(i){const o=i.extensions;if(c(o)&&c(o.CESIUM_primitive_outline)){const s=o.CESIUM_primitive_outline.indices;c(s)&&(t[s]=!0)}})}),t};_u.buffer=function(e){const t={};return me.bufferView(e,function(n){c(n.buffer)&&(t[n.buffer]=!0),c(n.extensions)&&c(n.extensions.EXT_meshopt_compression)&&(t[n.extensions.EXT_meshopt_compression.buffer]=!0)}),t};_u.bufferView=function(e){const t={};if(me.accessor(e,function(n){c(n.bufferView)&&(t[n.bufferView]=!0)}),me.shader(e,function(n){c(n.bufferView)&&(t[n.bufferView]=!0)}),me.image(e,function(n){c(n.bufferView)&&(t[n.bufferView]=!0)}),cr(e,"KHR_draco_mesh_compression")&&me.mesh(e,function(n){me.meshPrimitive(n,function(i){c(i.extensions)&&c(i.extensions.KHR_draco_mesh_compression)&&(t[i.extensions.KHR_draco_mesh_compression.bufferView]=!0)})}),cr(e,"EXT_feature_metadata")){const i=e.extensions.EXT_feature_metadata.featureTables;for(const o in i)if(i.hasOwnProperty(o)){const s=i[o].properties;if(c(s)){for(const a in s)if(s.hasOwnProperty(a)){const l=s[a];c(l.bufferView)&&(t[l.bufferView]=!0),c(l.arrayOffsetBufferView)&&(t[l.arrayOffsetBufferView]=!0),c(l.stringOffsetBufferView)&&(t[l.stringOffsetBufferView]=!0)}}}}if(cr(e,"EXT_structural_metadata")){const i=e.extensions.EXT_structural_metadata.propertyTables;if(c(i)){const o=i.length;for(let r=0;r<o;++r){const a=i[r].properties;for(const l in a)if(a.hasOwnProperty(l)){const u=a[l];c(u.values)&&(t[u.values]=!0),c(u.arrayOffsets)&&(t[u.arrayOffsets]=!0),c(u.stringOffsets)&&(t[u.stringOffsets]=!0)}}}}return t};_u.image=function(e){const t={};return me.texture(e,function(n){c(n.source)&&(t[n.source]=!0),c(n.extensions)&&c(n.extensions.EXT_texture_webp)?t[n.extensions.EXT_texture_webp.source]=!0:c(n.extensions)&&c(n.extensions.KHR_texture_basisu)&&(t[n.extensions.KHR_texture_basisu.source]=!0)}),t};_u.mesh=function(e){const t={};return me.node(e,function(n){if(c(n.mesh&&c(e.meshes))){const i=e.meshes[n.mesh];c(i)&&c(i.primitives)&&i.primitives.length>0&&(t[n.mesh]=!0)}}),t};function T4(e,t,n){const i=e.nodes[t];return c(i.mesh)||c(i.camera)||c(i.skin)||c(i.weights)||c(i.extras)||c(i.extensions)&&Object.keys(i.extensions).length!==0||c(n[t])?!1:!c(i.children)||i.children.filter(function(o){return!T4(e,o,n)}).length===0}_u.node=function(e){const t={};return me.skin(e,function(n){c(n.skeleton)&&(t[n.skeleton]=!0),me.skinJoint(n,function(i){t[i]=!0})}),me.animation(e,function(n){me.animationChannel(n,function(i){c(i.target)&&c(i.target.node)&&(t[i.target.node]=!0)})}),me.technique(e,function(n){me.techniqueUniform(n,function(i){c(i.node)&&(t[i.node]=!0)})}),me.node(e,function(n,i){T4(e,i,t)||(t[i]=!0)}),t};_u.material=function(e){const t={};return me.mesh(e,function(n){me.meshPrimitive(n,function(i){c(i.material)&&(t[i.material]=!0)})}),t};_u.texture=function(e){const t={};if(me.material(e,function(n){b4(n,function(i){t[i]=!0})}),cr(e,"EXT_feature_metadata")){me.mesh(e,function(o){me.meshPrimitive(o,function(r){const s=r.extensions;if(c(s)&&c(s.EXT_feature_metadata)){const l=s.EXT_feature_metadata.featureIdTextures;if(c(l)){const u=l.length;for(let h=0;h<u;++h){const _=l[h].featureIds.texture;t[_.index]=!0}}}})});const i=e.extensions.EXT_feature_metadata.featureTextures;for(const o in i)if(i.hasOwnProperty(o)){const s=i[o].properties;if(c(s)){for(const a in s)if(s.hasOwnProperty(a)){const u=s[a].texture;t[u.index]=!0}}}}if(cr(e,"EXT_mesh_features")&&me.mesh(e,function(n){me.meshPrimitive(n,function(i){const o=i.extensions;if(c(o)&&c(o.EXT_mesh_features)){const s=o.EXT_mesh_features.featureIds;if(c(s)){const a=s.length;for(let l=0;l<a;++l){const u=s[l];c(u.texture)&&(t[u.texture.index]=!0)}}}})}),cr(e,"EXT_structural_metadata")){const i=e.extensions.EXT_structural_metadata.propertyTextures;if(c(i)){const o=i.length;for(let r=0;r<o;++r){const a=i[r].properties;for(const l in a)if(a.hasOwnProperty(l)){const u=a[l];t[u.index]=!0}}}}return t};_u.sampler=function(e){const t={};return me.texture(e,function(n){c(n.sampler)&&(t[n.sampler]=!0)}),t};function Kue(e,t){const n={byteLength:t.length,extras:{_pipeline:{source:t}}},o={buffer:ul(e.buffers,n),byteOffset:0,byteLength:t.length};return ul(e.bufferViews,o)}function Zue(e,t){const n=W_(e,t),i=Z.getSizeInBytes(t.componentType),o=U0(t.type),r=t.count,s=new Array(o*r);if(!c(t.bufferView))return s.fill(0);const a=e.bufferViews[t.bufferView],l=e.buffers[a.buffer].extras._pipeline.source;let u=t.byteOffset+a.byteOffset+l.byteOffset;const h=new DataView(l.buffer),f=new Array(o),_=fO(t.componentType);for(let g=0;g<r;++g){_(h,u,o,i,f);for(let m=0;m<o;++m)s[g*o+m]=f[m];u+=n}return s}function Jue(e){let t;return me.accessorWithSemantic(e,"JOINTS_0",function(n){const i=e.accessors[n];t=i.componentType,t===J.BYTE?lT(e,i,Z.UNSIGNED_BYTE):t!==J.UNSIGNED_BYTE&&t!==J.UNSIGNED_SHORT&&lT(e,i,Z.UNSIGNED_SHORT)}),me.accessorWithSemantic(e,"WEIGHTS_0",function(n){const i=e.accessors[n];t=i.componentType,t===J.BYTE?lT(e,i,Z.UNSIGNED_BYTE):t===J.SHORT&&lT(e,i,Z.UNSIGNED_SHORT)}),e}function lT(e,t,n){const i=Z.createTypedArray(n,Zue(e,t)),o=new Uint8Array(i.buffer);t.bufferView=Kue(e,o),t.componentType=n,t.byteOffset=0}function jI(e,t){return g4(e,t),t==="CESIUM_RTC"&&ede(e),WI(e,t)}function ede(e){me.technique(e,function(t){me.techniqueUniform(t,function(n){n.semantic==="CESIUM_RTC_MODELVIEW"&&(n.semantic="MODELVIEW")})})}function WI(e,t){if(Array.isArray(e)){const n=e.length;for(let i=0;i<n;++i)WI(e[i],t)}else if(e!==null&&typeof e=="object"&&e.constructor===Object){const n=e.extensions;let i;c(n)&&(i=n[t],c(i)&&(delete n[t],Object.keys(n).length===0&&delete e.extensions));for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&WI(e[o],t);return i}}const uT={.8:sde,"1.0":vde,"2.0":void 0};function tde(e,t){t=y(t,y.EMPTY_OBJECT);const n=t.targetVersion;let i=e.version;e.asset=y(e.asset,{version:"1.0"}),e.asset.version=y(e.asset.version,"1.0"),i=y(i,e.asset.version).toString(),Object.prototype.hasOwnProperty.call(uT,i)||(c(i)&&(i=i.substring(0,3)),Object.prototype.hasOwnProperty.call(uT,i)||(i="1.0"));let o=uT[i];for(;c(o)&&i!==n;)o(e,t),i=e.asset.version,o=uT[i];return t.keepLegacyExtensions||(Pde(e,t),Ode(e)),e}function A4(e){const t=e.materials;for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){const i=t[n],o=i.instanceTechnique;c(o)&&(i.technique=o.technique,i.values=o.values,delete i.instanceTechnique)}}function nde(e){const t=e.meshes;for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){const o=t[n].primitives;if(c(o)){const r=o.length;for(let s=0;s<r;++s){const a=o[s],l=y(a.primitive,J.TRIANGLES);a.mode=y(a.mode,l),delete a.primitive}}}}function ide(e){const t=e.nodes,n=new d,i=new _e;for(const o in t)if(Object.prototype.hasOwnProperty.call(t,o)){const r=t[o];if(c(r.rotation)){const a=r.rotation;d.fromArray(a,0,n),_e.fromAxisAngle(n,a[3],i),r.rotation=[i.x,i.y,i.z,i.w]}const s=r.instanceSkin;c(s)&&(r.skeletons=s.skeletons,r.skin=s.skin,r.meshes=s.meshes,delete r.instanceSkin)}}function ode(e){const t=e.animations,n=e.accessors,i=e.bufferViews,o=e.buffers,r={},s=new d,a=new _e;for(const l in t)if(Object.prototype.hasOwnProperty.call(t,l)){const u=t[l],h=u.channels,f=u.parameters,_=u.samplers;if(c(h)){const g=h.length;for(let m=0;m<g;++m){const b=h[m];if(b.target.path==="rotation"){const T=f[_[b.sampler].output];if(c(r[T]))continue;r[T]=!0;const x=n[T],C=i[x.bufferView],v=o[C.buffer].extras._pipeline.source,P=v.byteOffset+C.byteOffset+x.byteOffset,N=x.componentType,k=x.count,M=U0(x.type),U=x.count*M,B=Z.createArrayBufferView(N,v.buffer,P,U);for(let S=0;S<k;S++){const D=S*M;d.unpack(B,D,s);const p=B[D+3];_e.fromAxisAngle(s,p,a),_e.pack(a,B,D)}}}}}}function rde(e){const t=e.techniques;for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){const i=t[n],o=i.passes;if(c(o)){const r=y(i.pass,"defaultPass");if(Object.prototype.hasOwnProperty.call(o,r)){const s=o[r],a=s.instanceProgram;i.attributes=y(i.attributes,a.attributes),i.program=y(i.program,a.program),i.uniforms=y(i.uniforms,a.uniforms),i.states=y(i.states,s.states)}delete i.passes,delete i.pass}}}function sde(e){c(e.asset)||(e.asset={});const t=e.asset;if(t.version="1.0",typeof t.profile=="string"){const n=t.profile.split(" ");t.profile={api:n[0],version:n[1]}}else t.profile={};if(c(e.version)&&delete e.version,A4(e),nde(e),ide(e),ode(e),rde(e),c(e.allExtensions)&&(e.extensionsUsed=e.allExtensions,delete e.allExtensions),c(e.lights)){const n=y(e.extensions,{});e.extensions=n;const i=y(n.KHR_materials_common,{});n.KHR_materials_common=i,i.lights=e.lights,delete e.lights,k0(e,"KHR_materials_common")}}function ade(e){const t=e.animations;for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){const i=t[n],o=i.parameters;if(c(o)){const r=i.samplers;for(const s in r)if(Object.prototype.hasOwnProperty.call(r,s)){const a=r[s];a.input=o[a.input],a.output=o[a.output]}delete i.parameters}}}function OM(e,t){const n=[];for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const o=e[i];t[i]=n.length,n.push(o),c(o.name)||(o.name=i)}return n}function cde(e){let t;const n={accessors:{},animations:{},buffers:{},bufferViews:{},cameras:{},images:{},materials:{},meshes:{},nodes:{},programs:{},samplers:{},scenes:{},shaders:{},skins:{},textures:{},techniques:{}};let i;const o={},r=e.nodes;for(const s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i=r[s].jointName,c(i)&&(o[i]=s));for(const s in e)if(Object.prototype.hasOwnProperty.call(e,s)&&c(n[s])){const a={},l=e[s];e[s]=OM(l,a),n[s]=a}for(i in o)Object.prototype.hasOwnProperty.call(o,i)&&(o[i]=n.nodes[o[i]]);c(e.scene)&&(e.scene=n.scenes[e.scene]),me.bufferView(e,function(s){c(s.buffer)&&(s.buffer=n.buffers[s.buffer])}),me.accessor(e,function(s){c(s.bufferView)&&(s.bufferView=n.bufferViews[s.bufferView])}),me.shader(e,function(s){const a=s.extensions;if(c(a)){const l=a.KHR_binary_glTF;c(l)&&(s.bufferView=n.bufferViews[l.bufferView],delete a.KHR_binary_glTF),Object.keys(a).length===0&&delete s.extensions}}),me.program(e,function(s){c(s.vertexShader)&&(s.vertexShader=n.shaders[s.vertexShader]),c(s.fragmentShader)&&(s.fragmentShader=n.shaders[s.fragmentShader])}),me.technique(e,function(s){c(s.program)&&(s.program=n.programs[s.program]),me.techniqueParameter(s,function(a){c(a.node)&&(a.node=n.nodes[a.node]);const l=a.value;typeof l=="string"&&(a.value={index:n.textures[l]})})}),me.mesh(e,function(s){me.meshPrimitive(s,function(a){c(a.indices)&&(a.indices=n.accessors[a.indices]),me.meshPrimitiveAttribute(a,function(l,u){a.attributes[u]=n.accessors[l]}),c(a.material)&&(a.material=n.materials[a.material])})}),me.node(e,function(s){let a=s.children;if(c(a)){const l=a.length;for(t=0;t<l;++t)a[t]=n.nodes[a[t]]}if(c(s.meshes)){const l=s.meshes,u=l.length;if(u>0)for(s.mesh=n.meshes[l[0]],t=1;t<u;++t){const h={mesh:n.meshes[l[t]]},f=ul(e.nodes,h);c(a)||(a=[],s.children=a),a.push(f)}delete s.meshes}if(c(s.camera)&&(s.camera=n.cameras[s.camera]),c(s.skin)&&(s.skin=n.skins[s.skin]),c(s.skeletons)){const l=s.skeletons;if(l.length>0&&c(s.skin)){const h=e.skins[s.skin];h.skeleton=n.nodes[l[0]]}delete s.skeletons}c(s.jointName)&&delete s.jointName}),me.skin(e,function(s){c(s.inverseBindMatrices)&&(s.inverseBindMatrices=n.accessors[s.inverseBindMatrices]);const a=s.jointNames;if(c(a)){const l=[],u=a.length;for(t=0;t<u;++t)l[t]=o[a[t]];s.joints=l,delete s.jointNames}}),me.scene(e,function(s){const a=s.nodes;if(c(a)){const l=a.length;for(t=0;t<l;++t)a[t]=n.nodes[a[t]]}}),me.animation(e,function(s){const a={};s.samplers=OM(s.samplers,a),me.animationSampler(s,function(l){l.input=n.accessors[l.input],l.output=n.accessors[l.output]}),me.animationChannel(s,function(l){l.sampler=a[l.sampler];const u=l.target;c(u)&&(u.node=n.nodes[u.id],delete u.id)})}),me.material(e,function(s){c(s.technique)&&(s.technique=n.techniques[s.technique]),me.materialValue(s,function(l,u){typeof l=="string"&&(s.values[u]={index:n.textures[l]})});const a=s.extensions;if(c(a)){const l=a.KHR_materials_common;c(l)&&c(l.values)&&me.materialValue(l,function(u,h){typeof u=="string"&&(l.values[h]={index:n.textures[u]})})}}),me.image(e,function(s){const a=s.extensions;if(c(a)){const l=a.KHR_binary_glTF;c(l)&&(s.bufferView=n.bufferViews[l.bufferView],s.mimeType=l.mimeType,delete a.KHR_binary_glTF),Object.keys(a).length===0&&delete s.extensions}}),me.texture(e,function(s){c(s.sampler)&&(s.sampler=n.samplers[s.sampler]),c(s.source)&&(s.source=n.images[s.source])})}function lde(e){me.animation(e,function(t){me.animationSampler(t,function(n){delete n.name})})}function ude(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const n=e[t];Array.isArray(n)&&n.length===0&&delete e[t]}me.node(e,function(t){c(t.children)&&t.children.length===0&&delete t.children})}function dde(e){const t=e.asset;delete t.profile,delete t.premultipliedAlpha}const hde={CESIUM_RTC:!0,KHR_materials_common:!0,WEB3D_quantized_attributes:!0};function fde(e){const t=e.extensionsUsed;if(e.extensionsRequired=y(e.extensionsRequired,[]),c(t)){const n=t.length;for(let i=0;i<n;++i){const o=t[i];c(hde[o])&&e.extensionsRequired.push(o)}}}function pde(e){me.buffer(e,function(t){delete t.type})}function mde(e){me.texture(e,function(t){delete t.format,delete t.internalFormat,delete t.target,delete t.type})}function _de(e){me.mesh(e,function(t){me.meshPrimitive(t,function(n){me.meshPrimitiveAttribute(n,function(i,o){o==="TEXCOORD"?n.attributes.TEXCOORD_0=i:o==="COLOR"&&(n.attributes.COLOR_0=i)}),delete n.attributes.TEXCOORD,delete n.attributes.COLOR})}),me.technique(e,function(t){me.techniqueParameter(t,function(n){const i=n.semantic;c(i)&&(i==="TEXCOORD"?n.semantic="TEXCOORD_0":i==="COLOR"&&(n.semantic="COLOR_0"))})})}const gde={POSITION:!0,NORMAL:!0,TANGENT:!0},yde={COLOR:"COLOR",JOINT:"JOINTS",JOINTS:"JOINTS",TEXCOORD:"TEXCOORD",WEIGHT:"WEIGHTS",WEIGHTS:"WEIGHTS"};function bde(e){const t={};me.mesh(e,function(n){me.meshPrimitive(n,function(i){me.meshPrimitiveAttribute(i,function(o,r){if(r.charAt(0)!=="_"){const s=r.search(/_[0-9]+/g);let a=r,l="_0";s>=0&&(a=r.substring(0,s),l=r.substring(s));let u;const h=yde[a];c(h)?(u=h+l,t[r]=u):c(gde[a])||(u=`_${r}`,t[r]=u)}});for(const o in t)if(Object.prototype.hasOwnProperty.call(t,o)){const r=t[o],s=i.attributes[o];c(s)&&(delete i.attributes[o],i.attributes[r]=s)}})}),me.technique(e,function(n){me.techniqueParameter(n,function(i){const o=t[i.semantic];c(o)&&(i.semantic=o)})})}function Tde(e){me.camera(e,function(t){const n=t.perspective;if(c(n)){const i=n.aspectRatio;c(i)&&i===0&&delete n.aspectRatio;const o=n.yfov;c(o)&&o===0&&(n.yfov=1)}})}function qI(e,t){return c(t.byteStride)&&t.byteStride!==0?t.byteStride:W_(e,t)}function Ade(e){me.buffer(e,function(t){c(t.byteLength)||(t.byteLength=t.extras._pipeline.source.length)}),me.accessor(e,function(t){const n=t.bufferView;if(c(n)){const i=e.bufferViews[n],o=qI(e,t),r=t.byteOffset+t.count*o;i.byteLength=Math.max(y(i.byteLength,0),r)}})}function xde(e){let t,n,i;const o=e.bufferViews,r={};me.accessorContainingVertexAttributeData(e,function(a){const l=e.accessors[a];c(l.bufferView)&&(r[l.bufferView]=!0)});const s={};me.accessor(e,function(a){c(a.bufferView)&&(s[a.bufferView]=y(s[a.bufferView],[]),s[a.bufferView].push(a))});for(const a in s)if(Object.prototype.hasOwnProperty.call(s,a)){i=o[a];const l=s[a];l.sort(function(_,g){return _.byteOffset-g.byteOffset});let u=0,h=0;const f=l.length;for(t=0;t<f;++t){let _=l[t];const g=qI(e,_),m=_.byteOffset,b=_.count*g;delete _.byteStride;const T=t<f-1,x=T?qI(e,l[t+1]):void 0;if(g!==x){const C=Je(i,!0);r[a]&&(C.byteStride=g),C.byteOffset+=u,C.byteLength=m+b-u;const w=ul(o,C);for(n=h;n<=t;++n)_=l[n],_.bufferView=w,_.byteOffset=_.byteOffset-u;u=T?l[t+1].byteOffset:void 0,h=t+1}}}$ue(e,["accessor","bufferView","buffer"])}function Cde(e){me.accessorWithSemantic(e,"POSITION",function(t){const n=e.accessors[t];if(!c(n.min)||!c(n.max)){const i=pO(e,n);n.min=i.min,n.max=i.max}})}function x4(e){return(!c(e.children)||e.children.length===0)&&(!c(e.meshes)||e.meshes.length===0)&&!c(e.camera)&&!c(e.skin)&&!c(e.skeletons)&&!c(e.jointName)&&(!c(e.translation)||d.fromArray(e.translation).equals(d.ZERO))&&(!c(e.scale)||d.fromArray(e.scale).equals(new d(1,1,1)))&&(!c(e.rotation)||te.fromArray(e.rotation).equals(new te(0,0,0,1)))&&(!c(e.matrix)||L.fromColumnMajorArray(e.matrix).equals(L.IDENTITY))&&!c(e.extensions)&&!c(e.extras)}function C4(e,t){me.scene(e,function(n){const i=n.nodes;if(c(i)){const o=i.length;for(let r=o;r>=0;--r)if(i[r]===t){i.splice(r,1);return}}}),me.node(e,function(n,i){if(c(n.children)){const o=n.children.indexOf(t);o>-1&&(n.children.splice(o,1),x4(n)&&C4(e,i))}}),delete e.nodes[t]}function Ede(e){return me.node(e,function(t,n){x4(t)&&C4(e,n)}),e}function wde(e){me.animation(e,function(t){me.animationSampler(t,function(n){const i=e.accessors[n.input];if(!c(i.min)||!c(i.max)){const o=pO(e,i);i.min=o.min,i.max=o.max}})})}function Sde(e){me.accessor(e,function(t){if(c(t.min)||c(t.max)){const n=pO(e,t);c(t.min)&&(t.min=n.min),c(t.max)&&(t.max=n.max)}})}function vde(e){e.asset=y(e.asset,{}),e.asset.version="2.0",A4(e),ade(e),Ede(e),cde(e),lde(e),dde(e),fde(e),Ade(e),xde(e),Cde(e),wde(e),Sde(e),pde(e),mde(e),_de(e),bde(e),Jue(e),Tde(e),Wue(e),Yue(e),ude(e)}const Ide=["u_tex","u_diffuse","u_emission","u_diffuse_tex"],Dde=["u_diffuse","u_diffuse_mat"];function YI(e){e.pbrMetallicRoughness=c(e.pbrMetallicRoughness)?e.pbrMetallicRoughness:{},e.pbrMetallicRoughness.roughnessFactor=1,e.pbrMetallicRoughness.metallicFactor=0}function mO(e){return c(e.index)}function _O(e){return Array.isArray(e)&&e.length===4}function E4(e){const t=new Array(4);t[3]=e[3];for(let n=0;n<3;n++){const i=e[n];i<=.04045?t[n]=e[n]*.07739938080495357:t[n]=Math.pow((i+.055)*.9478672985781991,2.4)}return t}function Pde(e,t){t=y(t,y.EMPTY_OBJECT);const n=y(t.baseColorTextureNames,Ide),i=y(t.baseColorFactorNames,Dde);me.material(e,function(o){me.materialValue(o,function(r,s){n.indexOf(s)!==-1&&mO(r)?(YI(o),o.pbrMetallicRoughness.baseColorTexture=r):i.indexOf(s)!==-1&&_O(r)&&(YI(o),o.pbrMetallicRoughness.baseColorFactor=E4(r))})}),jI(e,"KHR_techniques_webgl"),jI(e,"KHR_blend")}function qw(e,t){c(t)&&(_O(t)?e.pbrMetallicRoughness.baseColorFactor=E4(t):mO(t)&&(e.pbrMetallicRoughness.baseColorTexture=t))}function LM(e,t){c(t)&&(_O(t)?e.emissiveFactor=t.slice(0,3):mO(t)&&(e.emissiveTexture=t))}function Ode(e){me.material(e,function(t){const n=y(t.extensions,y.EMPTY_OBJECT).KHR_materials_common;if(!c(n))return;const i=y(n.values,{}),o=i.ambient,r=i.diffuse,s=i.emission,a=i.transparency,l=n.doubleSided,u=n.transparent;YI(t),n.technique==="CONSTANT"?(k0(e,"KHR_materials_unlit"),t.extensions=c(t.extensions)?t.extensions:{},t.extensions.KHR_materials_unlit={},qw(t,s),qw(t,o)):(qw(t,r),LM(t,o),LM(t,s)),c(l)&&(t.doubleSided=l),c(a)&&(c(t.pbrMetallicRoughness.baseColorFactor)?t.pbrMetallicRoughness.baseColorFactor[3]*=a:t.pbrMetallicRoughness.baseColorFactor=[1,1,1,a]),c(u)&&(t.alphaMode=u?"BLEND":"OPAQUE")}),jI(e,"KHR_materials_common")}const sn={POSITION:"POSITION",NORMAL:"NORMAL",TANGENT:"TANGENT",TEXCOORD:"TEXCOORD",COLOR:"COLOR",JOINTS:"JOINTS",WEIGHTS:"WEIGHTS",FEATURE_ID:"_FEATURE_ID"};function Lde(e){switch(e){case sn.POSITION:return"positionMC";case sn.NORMAL:return"normalMC";case sn.TANGENT:return"tangentMC";case sn.TEXCOORD:return"texCoord";case sn.COLOR:return"color";case sn.JOINTS:return"joints";case sn.WEIGHTS:return"weights";case sn.FEATURE_ID:return"featureId";default:throw new E("semantic is not a valid value.")}}sn.hasSetIndex=function(e){switch(A.typeOf.string("semantic",e),e){case sn.POSITION:case sn.NORMAL:case sn.TANGENT:return!1;case sn.TEXCOORD:case sn.COLOR:case sn.JOINTS:case sn.WEIGHTS:case sn.FEATURE_ID:return!0;default:throw new E("semantic is not a valid value.")}};sn.fromGltfSemantic=function(e){A.typeOf.string("gltfSemantic",e);let t=e;const i=/^(\w+)_\d+$/.exec(e);switch(i!==null&&(t=i[1]),t){case"POSITION":return sn.POSITION;case"NORMAL":return sn.NORMAL;case"TANGENT":return sn.TANGENT;case"TEXCOORD":return sn.TEXCOORD;case"COLOR":return sn.COLOR;case"JOINTS":return sn.JOINTS;case"WEIGHTS":return sn.WEIGHTS;case"_FEATURE_ID":return sn.FEATURE_ID}};sn.fromPntsSemantic=function(e){switch(A.typeOf.string("pntsSemantic",e),e){case"POSITION":case"POSITION_QUANTIZED":return sn.POSITION;case"RGBA":case"RGB":case"RGB565":return sn.COLOR;case"NORMAL":case"NORMAL_OCT16P":return sn.NORMAL;case"BATCH_ID":return sn.FEATURE_ID;default:throw new E("pntsSemantic is not a valid value.")}};sn.getGlslType=function(e){switch(A.typeOf.string("semantic",e),e){case sn.POSITION:case sn.NORMAL:case sn.TANGENT:return"vec3";case sn.TEXCOORD:return"vec2";case sn.COLOR:return"vec4";case sn.JOINTS:return"ivec4";case sn.WEIGHTS:return"vec4";case sn.FEATURE_ID:return"int";default:throw new E("semantic is not a valid value.")}};sn.getVariableName=function(e,t){A.typeOf.string("semantic",e);let n=Lde(e);return c(t)&&(n+=`_${t}`),n};const ht=Object.freeze(sn);function Lt(){}Lt.getError=function(e,t,n){let i=`Failed to load ${e}: ${t}`;c(n)&&c(n.message)&&(i+=`
|
|
${n.message}`);const o=new Te(i);return c(n)&&(o.stack=`Original stack:
|
|
${n.stack}
|
|
Handler stack:
|
|
${o.stack}`),o};Lt.getNodeTransform=function(e){return c(e.matrix)?e.matrix:L.fromTranslationQuaternionRotationScale(c(e.translation)?e.translation:d.ZERO,c(e.rotation)?e.rotation:_e.IDENTITY,c(e.scale)?e.scale:d.ONE)};Lt.getAttributeBySemantic=function(e,t,n){const i=e.attributes,o=i.length;for(let r=0;r<o;++r){const s=i[r],a=c(n)?s.setIndex===n:!0;if(s.semantic===t&&a)return s}};Lt.getAttributeByName=function(e,t){const n=e.attributes,i=n.length;for(let o=0;o<i;++o){const r=n[o];if(r.name===t)return r}};Lt.getFeatureIdsByLabel=function(e,t){for(let n=0;n<e.length;n++){const i=e[n];if(i.positionalLabel===t||i.label===t)return i}};Lt.hasQuantizedAttributes=function(e){if(!c(e))return!1;for(let t=0;t<e.length;t++){const n=e[t];if(c(n.quantization))return!0}return!1};Lt.getAttributeInfo=function(e){const t=e.semantic,n=e.setIndex;let i,o=!1;c(t)?(i=ht.getVariableName(t,n),o=!0):(i=e.name,i=i.replace(/^_/,""),i=i.toLowerCase());const r=/^color_\d+$/.test(i),s=e.type;let a=qt.getGlslType(s);r&&(a="vec4");const l=c(e.quantization);let u;return l&&(u=r?"vec4":qt.getGlslType(e.quantization.type)),{attribute:e,isQuantized:l,variableName:i,hasSemantic:o,glslType:a,quantizedGlslType:u}};const Rde=new d,Nde=new d;Lt.getPositionMinMax=function(e,t,n){const i=Lt.getAttributeBySemantic(e,"POSITION");let o=i.max,r=i.min;return c(n)&&c(t)&&(r=d.add(r,t,Nde),o=d.add(o,n,Rde)),{min:r,max:o}};Lt.getAxisCorrectionMatrix=function(e,t,n){return n=L.clone(L.IDENTITY,n),e===Cr.Y?n=L.clone(Cr.Y_UP_TO_Z_UP,n):e===Cr.X&&(n=L.clone(Cr.X_UP_TO_Z_UP,n)),t===Cr.Z&&(n=L.multiplyTransformation(n,Cr.Z_UP_TO_X_UP,n)),n};const Mde=new $;Lt.getCullFace=function(e,t){if(!ze.isTriangles(t))return Qi.BACK;const n=L.getMatrix3(e,Mde);return $.determinant(n)<0?Qi.FRONT:Qi.BACK};Lt.sanitizeGlslIdentifier=function(e){let t=e.replaceAll(/[^A-Za-z0-9]+/g,"_");return t=t.replace(/^gl_/,""),/^\d/.test(t)&&(t=`_${t}`),t};Lt.supportedExtensions={AGI_articulations:!0,CESIUM_primitive_outline:!0,CESIUM_RTC:!0,EXT_feature_metadata:!0,EXT_instance_features:!0,EXT_mesh_features:!0,EXT_mesh_gpu_instancing:!0,EXT_meshopt_compression:!0,EXT_structural_metadata:!0,EXT_texture_webp:!0,KHR_blend:!0,KHR_draco_mesh_compression:!0,KHR_techniques_webgl:!0,KHR_materials_common:!0,KHR_materials_pbrSpecularGlossiness:!0,KHR_materials_unlit:!0,KHR_mesh_quantization:!0,KHR_texture_basisu:!0,KHR_texture_transform:!0,WEB3D_quantized_attributes:!0};Lt.checkSupportedExtensions=function(e){const t=e.length;for(let n=0;n<t;n++){const i=e[n];if(!Lt.supportedExtensions[i])throw new Te(`Unsupported glTF Extension: ${i}`)}};function ed(e){e=y(e,y.EMPTY_OBJECT);const t=e.resourceCache,n=e.gltfResource,i=e.baseResource,o=e.typedArray,r=e.gltfJson,s=e.cacheKey;A.typeOf.func("options.resourceCache",t),A.typeOf.object("options.gltfResource",n),A.typeOf.object("options.baseResource",i),this._resourceCache=t,this._gltfResource=n,this._baseResource=i,this._typedArray=o,this._gltfJson=r,this._cacheKey=s,this._gltf=void 0,this._bufferLoaders=[],this._state=ut.UNLOADED,this._promise=void 0}c(Object.create)&&(ed.prototype=Object.create(wo.prototype),ed.prototype.constructor=ed);Object.defineProperties(ed.prototype,{cacheKey:{get:function(){return this._cacheKey}},gltf:{get:function(){return this._gltf}}});ed.prototype.load=async function(){return c(this._promise)?this._promise:(this._state=ut.LOADING,c(this._gltfJson)?(this._promise=w4(this,this._gltfJson),this._promise):c(this._typedArray)?(this._promise=S4(this,this._typedArray),this._promise):(this._promise=Fde(this),this._promise))};async function Fde(e){let t;try{const n=await e._fetchGltf();if(e.isDestroyed())return;t=new Uint8Array(n)}catch(n){if(e.isDestroyed())return;gO(e,n)}return S4(e,t)}function gO(e,t){e.unload(),e._state=ut.FAILED;const n=`Failed to load glTF: ${e._gltfResource.url}`;throw e.getError(n,t)}async function Bde(e,t){if(c(t.asset)&&t.asset.version==="2.0"&&!cr(t,"KHR_techniques_webgl")&&!cr(t,"KHR_materials_common"))return Promise.resolve();const n=[];me.buffer(t,function(i){if(!c(i.extras._pipeline.source)&&c(i.uri)){const o=e._baseResource.getDerivedResource({url:i.uri}),s=e._resourceCache.getExternalBufferLoader({resource:o});e._bufferLoaders.push(s),n.push(s.load().then(function(){s.isDestroyed()||(i.extras._pipeline.source=s.typedArray)}))}}),await Promise.all(n),tde(t)}function zde(e){const t=[];return me.buffer(e,function(n){const i=n.uri;!c(n.extras._pipeline.source)&&c(i)&&CP(i)&&(delete n.uri,t.push(Ae.fetchArrayBuffer(i).then(function(o){n.extras._pipeline.source=new Uint8Array(o)})))}),Promise.all(t)}function Ude(e,t){const n=[];return me.buffer(t,function(i,o){const r=i.extras._pipeline.source;if(c(r)&&!c(i.uri)){const a=e._resourceCache.getEmbeddedBufferLoader({parentResource:e._gltfResource,bufferId:o,typedArray:r});e._bufferLoaders.push(a),n.push(a.load())}}),Promise.all(n)}async function w4(e,t){try{hO(t),await zde(t),await Bde(e,t),Rue(t),await Ude(e,t),kue(t);const n=t.asset.version;if(n!=="1.0"&&n!=="2.0")throw new Te(`Unsupported glTF version: ${n}`);const i=t.extensionsRequired;return c(i)&&Lt.checkSupportedExtensions(i),e._gltf=t,e._state=ut.READY,e}catch(n){if(e.isDestroyed())return;gO(e,n)}}async function S4(e,t){let n;try{xC(t)==="glTF"?n=Bue(t):n=sa(t)}catch(i){if(e.isDestroyed())return;gO(e,i)}return w4(e,n)}ed.prototype.unload=function(){const e=this._bufferLoaders,t=e.length;for(let n=0;n<t;++n)e[n]=!e[n].isDestroyed()&&this._resourceCache.unload(e[n]);this._bufferLoaders.length=0,this._gltf=void 0};ed.prototype._fetchGltf=function(){return this._gltfResource.fetchArrayBuffer()};const kde={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"},Mx=Object.freeze(kde),Ri={};function Vde(){this.octEncoded=!1,this.octEncodedZXY=!1,this.normalizationRange=void 0,this.quantizedVolumeOffset=void 0,this.quantizedVolumeDimensions=void 0,this.quantizedVolumeStepSize=void 0,this.componentDatatype=void 0,this.type=void 0}function Hde(){this.name=void 0,this.semantic=void 0,this.setIndex=void 0,this.componentDatatype=void 0,this.type=void 0,this.normalized=!1,this.count=void 0,this.min=void 0,this.max=void 0,this.constant=void 0,this.quantization=void 0,this.typedArray=void 0,this.buffer=void 0,this.byteOffset=0,this.byteStride=void 0}function Gde(){this.indexDatatype=void 0,this.count=void 0,this.buffer=void 0,this.typedArray=void 0}function jde(){this.featureCount=void 0,this.nullFeatureId=void 0,this.propertyTableId=void 0,this.setIndex=void 0,this.label=void 0,this.positionalLabel=void 0}function Wde(){this.featureCount=void 0,this.nullFeatureId=void 0,this.propertyTableId=void 0,this.offset=0,this.repeat=void 0,this.label=void 0,this.positionalLabel=void 0}function qde(){this.featureCount=void 0,this.nullFeatureId=void 0,this.propertyTableId=void 0,this.textureReader=void 0,this.label=void 0,this.positionalLabel=void 0}function Yde(){this.attributes=[]}function $de(){this.attributes=[],this.morphTargets=[],this.indices=void 0,this.material=void 0,this.primitiveType=void 0,this.featureIds=[],this.propertyTextureIds=[],this.propertyAttributeIds=[],this.outlineCoordinates=void 0}function Xde(){this.attributes=[],this.featureIds=[],this.transformInWorldSpace=!1}function Qde(){this.index=void 0,this.joints=[],this.inverseBindMatrices=[]}function Kde(){this.name=void 0,this.index=void 0,this.children=[],this.primitives=[],this.instances=void 0,this.skin=void 0,this.matrix=void 0,this.translation=void 0,this.rotation=void 0,this.scale=void 0,this.morphWeights=[],this.articulationName=void 0}function Zde(){this.nodes=[]}const Jde={TRANSLATION:"translation",ROTATION:"rotation",SCALE:"scale",WEIGHTS:"weights"};function ehe(){this.input=[],this.interpolation=void 0,this.output=[]}function the(){this.node=void 0,this.path=void 0}function nhe(){this.sampler=void 0,this.target=void 0}function ihe(){this.name=void 0,this.samplers=[],this.channels=[]}function ohe(){this.name=void 0,this.type=void 0,this.minimumValue=void 0,this.maximumValue=void 0,this.initialValue=void 0}function rhe(){this.name=void 0,this.stages=[]}function v4(){this.credits=[]}function she(){this.asset=new v4,this.scene=void 0,this.nodes=[],this.skins=[],this.animations=[],this.articulations=[],this.structuralMetadata=void 0,this.upAxis=void 0,this.forwardAxis=void 0,this.transform=L.clone(L.IDENTITY)}function ahe(){this.texture=void 0,this.index=void 0,this.texCoord=0,this.transform=$.clone($.IDENTITY),this.channels=void 0}function bh(){this.baseColorTexture=void 0,this.metallicRoughnessTexture=void 0,this.baseColorFactor=te.clone(bh.DEFAULT_BASE_COLOR_FACTOR),this.metallicFactor=bh.DEFAULT_METALLIC_FACTOR,this.roughnessFactor=bh.DEFAULT_ROUGHNESS_FACTOR}bh.DEFAULT_BASE_COLOR_FACTOR=te.ONE;bh.DEFAULT_METALLIC_FACTOR=1;bh.DEFAULT_ROUGHNESS_FACTOR=1;function np(){this.diffuseTexture=void 0,this.specularGlossinessTexture=void 0,this.diffuseFactor=te.clone(np.DEFAULT_DIFFUSE_FACTOR),this.specularFactor=d.clone(np.DEFAULT_SPECULAR_FACTOR),this.glossinessFactor=np.DEFAULT_GLOSSINESS_FACTOR}np.DEFAULT_DIFFUSE_FACTOR=te.ONE;np.DEFAULT_SPECULAR_FACTOR=d.ONE;np.DEFAULT_GLOSSINESS_FACTOR=1;function yO(){this.metallicRoughness=new bh,this.specularGlossiness=void 0,this.emissiveTexture=void 0,this.normalTexture=void 0,this.occlusionTexture=void 0,this.emissiveFactor=d.clone(yO.DEFAULT_EMISSIVE_FACTOR),this.alphaMode=Mx.OPAQUE,this.alphaCutoff=.5,this.doubleSided=!1,this.unlit=!1}yO.DEFAULT_EMISSIVE_FACTOR=d.ZERO;Ri.Quantization=Vde;Ri.Attribute=Hde;Ri.Indices=Gde;Ri.FeatureIdAttribute=jde;Ri.FeatureIdTexture=qde;Ri.FeatureIdImplicitRange=Wde;Ri.MorphTarget=Yde;Ri.Primitive=$de;Ri.Instances=Xde;Ri.Skin=Qde;Ri.Node=Kde;Ri.Scene=Zde;Ri.AnimatedPropertyType=Object.freeze(Jde);Ri.AnimationSampler=ehe;Ri.AnimationTarget=the;Ri.AnimationChannel=nhe;Ri.Animation=ihe;Ri.ArticulationStage=ohe;Ri.Articulation=rhe;Ri.Asset=v4;Ri.Components=she;Ri.TextureReader=ahe;Ri.MetallicRoughness=bh;Ri.SpecularGlossiness=np;Ri.Material=yO;const yt=Ri,vC={};vC.getImageIdFromTexture=function(e){e=y(e,y.EMPTY_OBJECT);const t=e.gltf,n=e.textureId,i=e.supportedImageFormats;A.typeOf.object("options.gltf",t),A.typeOf.number("options.textureId",n),A.typeOf.object("options.supportedImageFormats",i);const o=t.textures[n],r=o.extensions;if(c(r)){if(i.webp&&c(r.EXT_texture_webp))return r.EXT_texture_webp.source;if(i.basis&&c(r.KHR_texture_basisu))return r.KHR_texture_basisu.source}return o.source};vC.createSampler=function(e){e=y(e,y.EMPTY_OBJECT);const t=e.gltf,n=e.textureInfo,i=y(e.compressedTextureNoMipmap,!1);A.typeOf.object("options.gltf",t),A.typeOf.object("options.textureInfo",n);let o=Fn.REPEAT,r=Fn.REPEAT,s=en.LINEAR,a=Yo.LINEAR;const l=n.index,h=t.textures[l].sampler;if(c(h)){const f=t.samplers[h];o=y(f.wrapS,o),r=y(f.wrapT,r),s=y(f.minFilter,s),a=y(f.magFilter,a)}return i&&s!==en.LINEAR&&s!==en.NEAREST&&(s===en.NEAREST_MIPMAP_NEAREST||s===en.NEAREST_MIPMAP_LINEAR?s=en.NEAREST:s=en.LINEAR),new un({wrapS:o,wrapT:r,minificationFilter:s,magnificationFilter:a})};const che=new H(1,1);vC.createModelTextureReader=function(e){e=y(e,y.EMPTY_OBJECT);const t=e.textureInfo,n=e.channels,i=e.texture;A.typeOf.object("options.textureInfo",t);let o=y(t.texCoord,0),r;const s=y(t.extensions,y.EMPTY_OBJECT).KHR_texture_transform;if(c(s)){o=y(s.texCoord,o);const l=c(s.offset)?H.unpack(s.offset):H.ZERO;let u=y(s.rotation,0);const h=c(s.scale)?H.unpack(s.scale):che;u=-u,r=new $(Math.cos(u)*h.x,-Math.sin(u)*h.y,l.x,Math.sin(u)*h.x,Math.cos(u)*h.y,l.y,0,0,1)}const a=new yt.TextureReader;return a.index=t.index,a.texture=i,a.texCoord=o,a.transform=r,a.channels=n,a};const dp=vC;function $I(e){const t=document.createElement("canvas");return t.width=R.nextPowerOfTwo(e.width),t.height=R.nextPowerOfTwo(e.height),t.getContext("2d").drawImage(e,0,0,e.width,e.height,0,0,t.width,t.height),t}function td(e){e=y(e,y.EMPTY_OBJECT);const t=e.resourceCache,n=e.gltf,i=e.textureInfo,o=e.gltfResource,r=e.baseResource,s=e.supportedImageFormats,a=e.cacheKey,l=y(e.asynchronous,!0);A.typeOf.func("options.resourceCache",t),A.typeOf.object("options.gltf",n),A.typeOf.object("options.textureInfo",i),A.typeOf.object("options.gltfResource",o),A.typeOf.object("options.baseResource",r),A.typeOf.object("options.supportedImageFormats",s);const u=i.index,h=dp.getImageIdFromTexture({gltf:n,textureId:u,supportedImageFormats:s});this._resourceCache=t,this._gltf=n,this._textureInfo=i,this._imageId=h,this._gltfResource=o,this._baseResource=r,this._cacheKey=a,this._asynchronous=l,this._imageLoader=void 0,this._image=void 0,this._mipLevels=void 0,this._texture=void 0,this._state=ut.UNLOADED,this._promise=void 0}c(Object.create)&&(td.prototype=Object.create(wo.prototype),td.prototype.constructor=td);Object.defineProperties(td.prototype,{cacheKey:{get:function(){return this._cacheKey}},texture:{get:function(){return this._texture}}});const lhe=new bO;async function uhe(e){const t=e._resourceCache;try{const n=t.getImageLoader({gltf:e._gltf,imageId:e._imageId,gltfResource:e._gltfResource,baseResource:e._baseResource});return e._imageLoader=n,await n.load(),e.isDestroyed()?void 0:(e._image=n.image,e._mipLevels=n.mipLevels,e._state=ut.LOADED,e)}catch(n){if(e.isDestroyed())return;e.unload(),e._state=ut.FAILED;const i="Failed to load texture";throw e.getError(i,n)}}td.prototype.load=async function(){return c(this._promise)?this._promise:(this._state=ut.LOADING,this._promise=uhe(this),this._promise)};function bO(){this.gltf=void 0,this.textureInfo=void 0,this.image=void 0,this.context=void 0,this.texture=void 0}bO.prototype.set=function(e,t,n,i,o){this.gltf=e,this.textureInfo=t,this.image=n,this.mipLevels=i,this.context=o};bO.prototype.execute=function(){this.texture=I4(this.gltf,this.textureInfo,this.image,this.mipLevels,this.context)};function I4(e,t,n,i,o){const r=n.internalFormat;let s=!1;Ve.isCompressedFormat(r)&&!c(i)&&(s=!0);const a=dp.createSampler({gltf:e,textureInfo:t,compressedTextureNoMipmap:s}),l=a.minificationFilter,u=a.wrapS,h=a.wrapT,f=l===en.NEAREST_MIPMAP_NEAREST||l===en.NEAREST_MIPMAP_LINEAR||l===en.LINEAR_MIPMAP_NEAREST||l===en.LINEAR_MIPMAP_LINEAR,_=!c(r)&&f,g=_||u===Fn.REPEAT||u===Fn.MIRRORED_REPEAT||h===Fn.REPEAT||h===Fn.MIRRORED_REPEAT,m=!R.isPowerOfTwo(n.width)||!R.isPowerOfTwo(n.height),b=g&&m;let T;return c(r)?(!o.webgl2&&Ve.isCompressedFormat(r)&&m&&g&&console.warn("Compressed texture uses REPEAT or MIRRORED_REPEAT texture wrap mode and dimensions are not powers of two. The texture may be rendered incorrectly."),T=xt.create({context:o,source:{arrayBufferView:n.bufferView,mipLevels:i},width:n.width,height:n.height,pixelFormat:n.internalFormat,sampler:a})):(b&&(n=$I(n)),T=xt.create({context:o,source:n,sampler:a,flipY:!1,skipColorSpaceConversion:!0})),_&&T.generateMipmap(),T}td.prototype.process=function(e){if(A.typeOf.object("frameState",e),this._state===ut.READY)return!0;if(this._state!==ut.LOADED&&this._state!==ut.PROCESSING||c(this._texture)||!c(this._image))return!1;this._state=ut.PROCESSING;let t;if(this._asynchronous){const n=lhe;if(n.set(this._gltf,this._textureInfo,this._image,this._mipLevels,e.context),!e.jobScheduler.execute(n,nl.TEXTURE))return;t=n.texture}else t=I4(this._gltf,this._textureInfo,this._image,this._mipLevels,e.context);return this.unload(),this._texture=t,this._state=ut.READY,this._resourceCache.statistics.addTextureLoader(this),!0};td.prototype.unload=function(){c(this._texture)&&this._texture.destroy(),c(this._imageLoader)&&!this._imageLoader.isDestroyed()&&this._resourceCache.unload(this._imageLoader),this._imageLoader=void 0,this._image=void 0,this._mipLevels=void 0,this._texture=void 0,this._gltf=void 0};function nd(e){e=y(e,y.EMPTY_OBJECT);const t=e.resourceCache,n=e.gltf,i=e.gltfResource,o=e.baseResource,r=e.bufferViewId,s=e.draco,a=e.attributeSemantic,l=e.accessorId,u=e.cacheKey,h=y(e.asynchronous,!0),f=y(e.loadBuffer,!1),_=y(e.loadTypedArray,!1);if(A.typeOf.func("options.resourceCache",t),A.typeOf.object("options.gltf",n),A.typeOf.object("options.gltfResource",i),A.typeOf.object("options.baseResource",o),!f&&!_)throw new E("At least one of loadBuffer and loadTypedArray must be true.");const g=c(r),m=D4(s,a),b=c(a),T=c(l);if(g===m)throw new E("One of options.bufferViewId and options.draco must be defined.");if(m&&!b)throw new E("When options.draco is defined options.attributeSemantic must also be defined.");if(m&&!T)throw new E("When options.draco is defined options.accessorId must also be defined.");m&&(A.typeOf.object("options.draco",s),A.typeOf.string("options.attributeSemantic",a),A.typeOf.number("options.accessorId",l)),this._resourceCache=t,this._gltfResource=i,this._baseResource=o,this._gltf=n,this._bufferViewId=r,this._draco=s,this._attributeSemantic=a,this._accessorId=l,this._cacheKey=u,this._asynchronous=h,this._loadBuffer=f,this._loadTypedArray=_,this._bufferViewLoader=void 0,this._dracoLoader=void 0,this._quantization=void 0,this._typedArray=void 0,this._buffer=void 0,this._state=ut.UNLOADED,this._promise=void 0}c(Object.create)&&(nd.prototype=Object.create(wo.prototype),nd.prototype.constructor=nd);Object.defineProperties(nd.prototype,{cacheKey:{get:function(){return this._cacheKey}},buffer:{get:function(){return this._buffer}},typedArray:{get:function(){return this._typedArray}},quantization:{get:function(){return this._quantization}}});function D4(e,t){return c(e)&&c(e.attributes)&&c(e.attributes[t])}nd.prototype.load=async function(){return c(this._promise)?this._promise:D4(this._draco,this._attributeSemantic)?(this._promise=hhe(this),this._promise):(this._promise=phe(this),this._promise)};function dhe(e,t,n,i){const r=(1<<e.quantizationBits)-1,s=1/r,a=new yt.Quantization;if(a.componentDatatype=t,a.octEncoded=e.octEncoded,a.octEncodedZXY=!0,a.type=i,a.octEncoded)a.type=qt.VEC2,a.normalizationRange=r;else{const l=qt.getMathType(i);if(l===Number){const u=e.range;a.quantizedVolumeOffset=e.minValues[0],a.quantizedVolumeDimensions=u,a.normalizationRange=r,a.quantizedVolumeStepSize=u*s}else{a.quantizedVolumeOffset=l.unpack(e.minValues),a.normalizationRange=l.unpack(new Array(n).fill(r));const u=new Array(n).fill(e.range);a.quantizedVolumeDimensions=l.unpack(u);const h=u.map(function(f){return f*s});a.quantizedVolumeStepSize=l.unpack(h)}}return a}async function hhe(e){e._state=ut.LOADING;const t=e._resourceCache;try{const n=t.getDracoLoader({gltf:e._gltf,draco:e._draco,gltfResource:e._gltfResource,baseResource:e._baseResource});return e._dracoLoader=n,await n.load(),e.isDestroyed()?void 0:(e._state=ut.LOADED,e)}catch{if(e.isDestroyed())return;TO(e)}}function fhe(e){e._state=ut.PROCESSING;const n=e._dracoLoader.decodedData.vertexAttributes,i=e._attributeSemantic,o=n[i],r=e._accessorId,a=e._gltf.accessors[r].type,l=o.array,u=o.data.quantization;c(u)&&(e._quantization=dhe(u,o.data.componentDatatype,o.data.componentsPerAttribute,a)),e._typedArray=new Uint8Array(l.buffer,l.byteOffset,l.byteLength)}async function phe(e){e._state=ut.LOADING;const t=e._resourceCache;try{const n=t.getBufferViewLoader({gltf:e._gltf,bufferViewId:e._bufferViewId,gltfResource:e._gltfResource,baseResource:e._baseResource});return e._bufferViewLoader=n,await n.load(),e.isDestroyed()?void 0:(e._typedArray=n.typedArray,e._state=ut.PROCESSING,e)}catch(n){if(e.isDestroyed())return;TO(e,n)}}function TO(e,t){e.unload(),e._state=ut.FAILED;const n="Failed to load vertex buffer";throw e.getError(n,t)}function AO(){this.typedArray=void 0,this.context=void 0,this.buffer=void 0}AO.prototype.set=function(e,t){this.typedArray=e,this.context=t};AO.prototype.execute=function(){this.buffer=P4(this.typedArray,this.context)};function P4(e,t){const n=ct.createVertexBuffer({typedArray:e,context:t,usage:ke.STATIC_DRAW});return n.vertexArrayDestroyable=!1,n}const mhe=new AO;nd.prototype.process=function(e){if(A.typeOf.object("frameState",e),this._state===ut.READY)return!0;if(this._state!==ut.LOADED&&this._state!==ut.PROCESSING)return!1;if(c(this._dracoLoader)){try{if(!this._dracoLoader.process(e))return!1}catch(i){TO(this,i)}fhe(this)}let t;const n=this._typedArray;if(this._loadBuffer&&this._asynchronous){const i=mhe;if(i.set(n,e.context),!e.jobScheduler.execute(i,nl.BUFFER))return!1;t=i.buffer}else this._loadBuffer&&(t=P4(n,e.context));return this.unload(),this._buffer=t,this._typedArray=this._loadTypedArray?n:void 0,this._state=ut.READY,this._resourceCache.statistics.addGeometryLoader(this),!0};nd.prototype.unload=function(){c(this._buffer)&&this._buffer.destroy();const e=this._resourceCache;c(this._bufferViewLoader)&&!this._bufferViewLoader.isDestroyed()&&e.unload(this._bufferViewLoader),c(this._dracoLoader)&&e.unload(this._dracoLoader),this._bufferViewLoader=void 0,this._dracoLoader=void 0,this._typedArray=void 0,this._buffer=void 0,this._gltf=void 0};function Ph(e){e=y(e,y.EMPTY_OBJECT);const t=e.id;A.typeOf.string("options.id",t);const n=y(e.properties,{}),i={};for(const o in n)if(n.hasOwnProperty(o)){const r=n[o];c(r.semantic)&&(i[r.semantic]=r)}this._id=t,this._name=e.name,this._description=e.description,this._properties=n,this._propertiesBySemantic=i,this._extras=Je(e.extras,!0),this._extensions=Je(e.extensions,!0)}Ph.fromJson=function(e){e=y(e,y.EMPTY_OBJECT);const t=e.id,n=e.class;A.typeOf.string("options.id",t),A.typeOf.object("options.class",n);const i={};for(const o in n.properties)if(n.properties.hasOwnProperty(o)){const r=dr.fromJson({id:o,property:n.properties[o],enums:e.enums});i[o]=r}return new Ph({id:t,name:n.name,description:n.description,properties:i,extras:n.extras,extensions:n.extensions})};Object.defineProperties(Ph.prototype,{properties:{get:function(){return this._properties}},propertiesBySemantic:{get:function(){return this._propertiesBySemantic}},id:{get:function(){return this._id}},name:{get:function(){return this._name}},description:{get:function(){return this._description}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});Ph.BATCH_TABLE_CLASS_NAME="_batchTable";function Fx(e){e=y(e,y.EMPTY_OBJECT);const t=e.value,n=e.name;A.typeOf.number("options.value",t),A.typeOf.string("options.name",n),this._value=t,this._name=n,this._description=e.description,this._extras=Je(e.extras,!0),this._extensions=Je(e.extensions,!0)}Fx.fromJson=function(e){return A.typeOf.object("value",e),new Fx({value:e.value,name:e.name,description:e.description,extras:e.extras,extensions:e.extensions})};Object.defineProperties(Fx.prototype,{value:{get:function(){return this._value}},name:{get:function(){return this._name}},description:{get:function(){return this._description}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});function Bx(e){e=y(e,y.EMPTY_OBJECT);const t=e.id,n=e.values;A.typeOf.string("options.id",t),A.defined("options.values",n);const i={},o={},r=n.length;for(let a=0;a<r;++a){const l=n[a];i[l.value]=l.name,o[l.name]=l.value}const s=y(e.valueType,Ot.UINT16);this._values=n,this._namesByValue=i,this._valuesByName=o,this._valueType=s,this._id=t,this._name=e.name,this._description=e.description,this._extras=Je(e.extras,!0),this._extensions=Je(e.extensions,!0)}Bx.fromJson=function(e){e=y(e,y.EMPTY_OBJECT);const t=e.id,n=e.enum;A.typeOf.string("options.id",t),A.typeOf.object("options.enum",n);const i=n.values.map(function(o){return Fx.fromJson(o)});return new Bx({id:t,values:i,valueType:Ot[n.valueType],name:n.name,description:n.description,extras:n.extras,extensions:n.extensions})};Object.defineProperties(Bx.prototype,{values:{get:function(){return this._values}},namesByValue:{get:function(){return this._namesByValue}},valuesByName:{get:function(){return this._valuesByName}},valueType:{get:function(){return this._valueType}},id:{get:function(){return this._id}},name:{get:function(){return this._name}},description:{get:function(){return this._description}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});function Oh(e){e=y(e,y.EMPTY_OBJECT);const t=y(e.classes,{}),n=y(e.enums,{});this._classes=t,this._enums=n,this._id=e.id,this._name=e.name,this._description=e.description,this._version=e.version,this._extras=Je(e.extras,!0),this._extensions=Je(e.extensions,!0)}Oh.fromJson=function(e){A.typeOf.object("schema",e);const t={};if(c(e.enums))for(const i in e.enums)e.enums.hasOwnProperty(i)&&(t[i]=Bx.fromJson({id:i,enum:e.enums[i]}));const n={};if(c(e.classes))for(const i in e.classes)e.classes.hasOwnProperty(i)&&(n[i]=Ph.fromJson({id:i,class:e.classes[i],enums:t}));return new Oh({id:e.id,name:e.name,description:e.description,version:e.version,classes:n,enums:t,extras:e.extras,extensions:e.extensions})};Object.defineProperties(Oh.prototype,{classes:{get:function(){return this._classes}},enums:{get:function(){return this._enums}},id:{get:function(){return this._id}},name:{get:function(){return this._name}},description:{get:function(){return this._description}},version:{get:function(){return this._version}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});function Th(e){e=y(e,y.EMPTY_OBJECT);const t=e.schema,n=e.resource,i=e.cacheKey;if(c(t)===c(n))throw new E("One of options.schema and options.resource must be defined.");this._schema=c(t)?Oh.fromJson(t):void 0,this._resource=n,this._cacheKey=i,this._state=ut.UNLOADED,this._promise=void 0}c(Object.create)&&(Th.prototype=Object.create(wo.prototype),Th.prototype.constructor=Th);Object.defineProperties(Th.prototype,{cacheKey:{get:function(){return this._cacheKey}},schema:{get:function(){return this._schema}}});Th.prototype.load=async function(){return c(this._promise)?this._promise:c(this._schema)?(this._promise=Promise.resolve(this),this._promise):(this._promise=_he(this),this._promise)};async function _he(e){const t=e._resource;e._state=ut.LOADING;try{const n=await t.fetchJson();return e.isDestroyed()?void 0:(e._schema=Oh.fromJson(n),e._state=ut.READY,e)}catch(n){if(e.isDestroyed())return;e._state=ut.FAILED;const i=`Failed to load schema: ${t.url}`;throw e.getError(i,n)}}Th.prototype.unload=function(){this._schema=void 0};const Il={};function V0(e){return C_(e.url)}function IC(e){let t=e.byteOffset,n=e.byteLength;if(To(e,"EXT_meshopt_compression")){const i=e.extensions.EXT_meshopt_compression;t=y(i.byteOffset,0),n=i.byteLength}return`${t}-${t+n}`}function ghe(e,t){const n=t.byteOffset+e.byteOffset,i=e.componentType,o=e.type,r=e.count;return`${n}-${i}-${o}-${r}`}function O4(e){return V0(e)}function L4(e,t){return`${V0(e)}-buffer-id-${t}`}function H0(e,t,n,i){if(c(e.uri)){const o=i.getDerivedResource({url:e.uri});return O4(o)}return L4(n,t)}function xO(e,t,n,i){const o=t.bufferView,r=e.bufferViews[o],s=r.buffer,a=e.buffers[s],l=H0(a,s,n,i),u=IC(r);return`${l}-range-${u}`}function R4(e,t,n,i){const o=e.images[t],r=o.bufferView,s=o.uri;if(c(s)){const _=i.getDerivedResource({url:s});return V0(_)}const a=e.bufferViews[r],l=a.buffer,u=e.buffers[l],h=H0(u,l,n,i),f=IC(a);return`${h}-range-${f}`}function yhe(e,t){const n=dp.createSampler({gltf:e,textureInfo:t});return`${n.wrapS}-${n.wrapT}-${n.minificationFilter}-${n.magnificationFilter}`}Il.getSchemaCacheKey=function(e){const t=e.schema,n=e.resource;if(c(t)===c(n))throw new E("One of options.schema and options.resource must be defined.");return c(t)?`embedded-schema:${JSON.stringify(t)}`:`external-schema:${V0(n)}`};Il.getExternalBufferCacheKey=function(e){e=y(e,y.EMPTY_OBJECT);const t=e.resource;return A.typeOf.object("options.resource",t),`external-buffer:${O4(t)}`};Il.getEmbeddedBufferCacheKey=function(e){e=y(e,y.EMPTY_OBJECT);const t=e.parentResource,n=e.bufferId;return A.typeOf.object("options.parentResource",t),A.typeOf.number("options.bufferId",n),`embedded-buffer:${L4(t,n)}`};Il.getGltfCacheKey=function(e){e=y(e,y.EMPTY_OBJECT);const t=e.gltfResource;return A.typeOf.object("options.gltfResource",t),`gltf:${V0(t)}`};Il.getBufferViewCacheKey=function(e){e=y(e,y.EMPTY_OBJECT);const t=e.gltf,n=e.bufferViewId,i=e.gltfResource,o=e.baseResource;A.typeOf.object("options.gltf",t),A.typeOf.number("options.bufferViewId",n),A.typeOf.object("options.gltfResource",i),A.typeOf.object("options.baseResource",o);const r=t.bufferViews[n];let s=r.buffer;const a=t.buffers[s];To(r,"EXT_meshopt_compression")&&(s=r.extensions.EXT_meshopt_compression.buffer);const l=H0(a,s,i,o),u=IC(r);return`buffer-view:${l}-range-${u}`};Il.getDracoCacheKey=function(e){e=y(e,y.EMPTY_OBJECT);const t=e.gltf,n=e.draco,i=e.gltfResource,o=e.baseResource;return A.typeOf.object("options.gltf",t),A.typeOf.object("options.draco",n),A.typeOf.object("options.gltfResource",i),A.typeOf.object("options.baseResource",o),`draco:${xO(t,n,i,o)}`};Il.getVertexBufferCacheKey=function(e){e=y(e,y.EMPTY_OBJECT);const t=e.gltf,n=e.gltfResource,i=e.baseResource,o=e.frameState,r=e.bufferViewId,s=e.draco,a=e.attributeSemantic,l=y(e.dequantize,!1),u=y(e.loadBuffer,!1),h=y(e.loadTypedArray,!1);A.typeOf.object("options.gltf",t),A.typeOf.object("options.gltfResource",n),A.typeOf.object("options.baseResource",i),A.typeOf.object("options.frameState",o);const f=c(r),_=bhe(s,a),g=c(a);if(f===_)throw new E("One of options.bufferViewId and options.draco must be defined.");if(_&&!g)throw new E("When options.draco is defined options.attributeSemantic must also be defined.");if(_&&(A.typeOf.object("options.draco",s),A.typeOf.string("options.attributeSemantic",a)),!u&&!h)throw new E("At least one of loadBuffer and loadTypedArray must be true.");let m="";if(l&&(m+="-dequantize"),u&&(m+="-buffer",m+=`-context-${o.context.id}`),h&&(m+="-typed-array"),c(s))return`vertex-buffer:${xO(t,s,n,i)}-draco-${a}${m}`;const b=t.bufferViews[r],T=b.buffer,x=t.buffers[T],C=H0(x,T,n,i),w=IC(b);return`vertex-buffer:${C}-range-${w}${m}`};function bhe(e,t){return c(e)&&c(e.attributes)&&c(e.attributes[t])}Il.getIndexBufferCacheKey=function(e){e=y(e,y.EMPTY_OBJECT);const t=e.gltf,n=e.accessorId,i=e.gltfResource,o=e.baseResource,r=e.frameState,s=e.draco,a=y(e.loadBuffer,!1),l=y(e.loadTypedArray,!1);if(A.typeOf.object("options.gltf",t),A.typeOf.number("options.accessorId",n),A.typeOf.object("options.gltfResource",i),A.typeOf.object("options.baseResource",o),A.typeOf.object("options.frameState",r),!a&&!l)throw new E("At least one of loadBuffer and loadTypedArray must be true.");let u="";if(a&&(u+="-buffer",u+=`-context-${r.context.id}`),l&&(u+="-typed-array"),c(s))return`index-buffer:${xO(t,s,i,o)}-draco${u}`;const h=t.accessors[n],f=h.bufferView,_=t.bufferViews[f],g=_.buffer,m=t.buffers[g],b=H0(m,g,i,o),T=ghe(h,_);return`index-buffer:${b}-accessor-${T}${u}`};Il.getImageCacheKey=function(e){e=y(e,y.EMPTY_OBJECT);const t=e.gltf,n=e.imageId,i=e.gltfResource,o=e.baseResource;return A.typeOf.object("options.gltf",t),A.typeOf.number("options.imageId",n),A.typeOf.object("options.gltfResource",i),A.typeOf.object("options.baseResource",o),`image:${R4(t,n,i,o)}`};Il.getTextureCacheKey=function(e){e=y(e,y.EMPTY_OBJECT);const t=e.gltf,n=e.textureInfo,i=e.gltfResource,o=e.baseResource,r=e.supportedImageFormats,s=e.frameState;A.typeOf.object("options.gltf",t),A.typeOf.object("options.textureInfo",n),A.typeOf.object("options.gltfResource",i),A.typeOf.object("options.baseResource",o),A.typeOf.object("options.supportedImageFormats",r),A.typeOf.object("options.frameState",s);const a=n.index,l=dp.getImageIdFromTexture({gltf:t,textureId:a,supportedImageFormats:r}),u=R4(t,l,i,o),h=yhe(t,n);return`texture:${u}-sampler-${h}-context-${s.context.id}`};const gu=Il;function G0(){this.geometryByteLength=0,this.texturesByteLength=0,this._geometrySizes={},this._textureSizes={}}G0.prototype.clear=function(){this.geometryByteLength=0,this.texturesByteLength=0,this._geometrySizes={},this._textureSizes={}};G0.prototype.addGeometryLoader=function(e){A.typeOf.object("loader",e);const t=e.cacheKey;if(this._geometrySizes.hasOwnProperty(t))return;this._geometrySizes[t]=0;const n=e.buffer,i=e.typedArray;let o=0;c(n)&&(o+=n.sizeInBytes),c(i)&&(o+=i.byteLength),this.geometryByteLength+=o,this._geometrySizes[t]=o};G0.prototype.addTextureLoader=function(e){A.typeOf.object("loader",e);const t=e.cacheKey;if(this._textureSizes.hasOwnProperty(t))return;this._textureSizes[t]=0;const n=e.texture.sizeInBytes;this.texturesByteLength+=e.texture.sizeInBytes,this._textureSizes[t]=n};G0.prototype.removeLoader=function(e){A.typeOf.object("loader",e);const t=e.cacheKey,n=this._geometrySizes[t];delete this._geometrySizes[t],c(n)&&(this.geometryByteLength-=n);const i=this._textureSizes[t];delete this._textureSizes[t],c(i)&&(this.texturesByteLength-=i)};function dt(){}dt.cacheEntries={};dt.statistics=new G0;function The(e){this.referenceCount=1,this.resourceLoader=e,this._statisticsPromise=void 0}dt.get=function(e){A.typeOf.string("cacheKey",e);const t=dt.cacheEntries[e];if(c(t))return++t.referenceCount,t.resourceLoader};dt.add=function(e){A.typeOf.object("resourceLoader",e);const t=e.cacheKey;if(A.typeOf.string("options.resourceLoader.cacheKey",t),c(dt.cacheEntries[t]))throw new E(`Resource with this cacheKey is already in the cache: ${t}`);return dt.cacheEntries[t]=new The(e),e};dt.unload=function(e){A.typeOf.object("resourceLoader",e);const t=e.cacheKey,n=dt.cacheEntries[t];if(!c(n))throw new E(`Resource is not in the cache: ${t}`);--n.referenceCount,n.referenceCount===0&&(dt.statistics.removeLoader(e),e.destroy(),delete dt.cacheEntries[t])};dt.getSchemaLoader=function(e){e=y(e,y.EMPTY_OBJECT);const t=e.schema,n=e.resource;if(c(t)===c(n))throw new E("One of options.schema and options.resource must be defined.");const i=gu.getSchemaCacheKey({schema:t,resource:n});let o=dt.get(i);return c(o)?o:(o=new Th({schema:t,resource:n,cacheKey:i}),dt.add(o))};dt.getEmbeddedBufferLoader=function(e){e=y(e,y.EMPTY_OBJECT);const t=e.parentResource,n=e.bufferId,i=e.typedArray;A.typeOf.object("options.parentResource",t),A.typeOf.number("options.bufferId",n);const o=gu.getEmbeddedBufferCacheKey({parentResource:t,bufferId:n});let r=dt.get(o);return c(r)?r:(A.typeOf.object("options.typedArray",i),r=new hl({typedArray:i,cacheKey:o}),dt.add(r))};dt.getExternalBufferLoader=function(e){e=y(e,y.EMPTY_OBJECT);const t=e.resource;A.typeOf.object("options.resource",t);const n=gu.getExternalBufferCacheKey({resource:t});let i=dt.get(n);return c(i)?i:(i=new hl({resource:t,cacheKey:n}),dt.add(i))};dt.getGltfJsonLoader=function(e){e=y(e,y.EMPTY_OBJECT);const t=e.gltfResource,n=e.baseResource,i=e.typedArray,o=e.gltfJson;A.typeOf.object("options.gltfResource",t),A.typeOf.object("options.baseResource",n);const r=gu.getGltfCacheKey({gltfResource:t});let s=dt.get(r);return c(s)?s:(s=new ed({resourceCache:dt,gltfResource:t,baseResource:n,typedArray:i,gltfJson:o,cacheKey:r}),dt.add(s))};dt.getBufferViewLoader=function(e){e=y(e,y.EMPTY_OBJECT);const t=e.gltf,n=e.bufferViewId,i=e.gltfResource,o=e.baseResource;A.typeOf.object("options.gltf",t),A.typeOf.number("options.bufferViewId",n),A.typeOf.object("options.gltfResource",i),A.typeOf.object("options.baseResource",o);const r=gu.getBufferViewCacheKey({gltf:t,bufferViewId:n,gltfResource:i,baseResource:o});let s=dt.get(r);return c(s)?s:(s=new yh({resourceCache:dt,gltf:t,bufferViewId:n,gltfResource:i,baseResource:o,cacheKey:r}),dt.add(s))};dt.getDracoLoader=function(e){e=y(e,y.EMPTY_OBJECT);const t=e.gltf,n=e.draco,i=e.gltfResource,o=e.baseResource;A.typeOf.object("options.gltf",t),A.typeOf.object("options.draco",n),A.typeOf.object("options.gltfResource",i),A.typeOf.object("options.baseResource",o);const r=gu.getDracoCacheKey({gltf:t,draco:n,gltfResource:i,baseResource:o});let s=dt.get(r);return c(s)?s:(s=new Zu({resourceCache:dt,gltf:t,draco:n,gltfResource:i,baseResource:o,cacheKey:r}),dt.add(s))};dt.getVertexBufferLoader=function(e){e=y(e,y.EMPTY_OBJECT);const t=e.gltf,n=e.gltfResource,i=e.baseResource,o=e.frameState,r=e.bufferViewId,s=e.draco,a=e.attributeSemantic,l=e.accessorId,u=y(e.asynchronous,!0),h=y(e.dequantize,!1),f=y(e.loadBuffer,!1),_=y(e.loadTypedArray,!1);if(A.typeOf.object("options.gltf",t),A.typeOf.object("options.gltfResource",n),A.typeOf.object("options.baseResource",i),A.typeOf.object("options.frameState",o),!f&&!_)throw new E("At least one of loadBuffer and loadTypedArray must be true.");const g=c(r),m=Ahe(s,a),b=c(a),T=c(l);if(g===m)throw new E("One of options.bufferViewId and options.draco must be defined.");if(m&&!b)throw new E("When options.draco is defined options.attributeSemantic must also be defined.");if(m&&!T)throw new E("When options.draco is defined options.haAccessorId must also be defined.");m&&(A.typeOf.object("options.draco",s),A.typeOf.string("options.attributeSemantic",a),A.typeOf.number("options.accessorId",l));const x=gu.getVertexBufferCacheKey({gltf:t,gltfResource:n,baseResource:i,frameState:o,bufferViewId:r,draco:s,attributeSemantic:a,dequantize:h,loadBuffer:f,loadTypedArray:_});let C=dt.get(x);return c(C)?C:(C=new nd({resourceCache:dt,gltf:t,gltfResource:n,baseResource:i,bufferViewId:r,draco:s,attributeSemantic:a,accessorId:l,cacheKey:x,asynchronous:u,dequantize:h,loadBuffer:f,loadTypedArray:_}),dt.add(C))};function Ahe(e,t){return c(e)&&c(e.attributes)&&c(e.attributes[t])}dt.getIndexBufferLoader=function(e){e=y(e,y.EMPTY_OBJECT);const t=e.gltf,n=e.accessorId,i=e.gltfResource,o=e.baseResource,r=e.frameState,s=e.draco,a=y(e.asynchronous,!0),l=y(e.loadBuffer,!1),u=y(e.loadTypedArray,!1);if(A.typeOf.object("options.gltf",t),A.typeOf.number("options.accessorId",n),A.typeOf.object("options.gltfResource",i),A.typeOf.object("options.baseResource",o),A.typeOf.object("options.frameState",r),!l&&!u)throw new E("At least one of loadBuffer and loadTypedArray must be true.");const h=gu.getIndexBufferCacheKey({gltf:t,accessorId:n,gltfResource:i,baseResource:o,frameState:r,draco:s,loadBuffer:l,loadTypedArray:u});let f=dt.get(h);return c(f)?f:(f=new Ju({resourceCache:dt,gltf:t,accessorId:n,gltfResource:i,baseResource:o,draco:s,cacheKey:h,asynchronous:a,loadBuffer:l,loadTypedArray:u}),dt.add(f))};dt.getImageLoader=function(e){e=y(e,y.EMPTY_OBJECT);const t=e.gltf,n=e.imageId,i=e.gltfResource,o=e.baseResource;A.typeOf.object("options.gltf",t),A.typeOf.number("options.imageId",n),A.typeOf.object("options.gltfResource",i),A.typeOf.object("options.baseResource",o);const r=gu.getImageCacheKey({gltf:t,imageId:n,gltfResource:i,baseResource:o});let s=dt.get(r);return c(s)?s:(s=new Zl({resourceCache:dt,gltf:t,imageId:n,gltfResource:i,baseResource:o,cacheKey:r}),dt.add(s))};dt.getTextureLoader=function(e){e=y(e,y.EMPTY_OBJECT);const t=e.gltf,n=e.textureInfo,i=e.gltfResource,o=e.baseResource,r=e.supportedImageFormats,s=e.frameState,a=y(e.asynchronous,!0);A.typeOf.object("options.gltf",t),A.typeOf.object("options.textureInfo",n),A.typeOf.object("options.gltfResource",i),A.typeOf.object("options.baseResource",o),A.typeOf.object("options.supportedImageFormats",r),A.typeOf.object("options.frameState",s);const l=gu.getTextureCacheKey({gltf:t,textureInfo:n,gltfResource:i,baseResource:o,supportedImageFormats:r,frameState:s});let u=dt.get(l);return c(u)?u:(u=new td({resourceCache:dt,gltf:t,textureInfo:n,gltfResource:i,baseResource:o,supportedImageFormats:r,cacheKey:l,asynchronous:a}),dt.add(u))};dt.clearForSpecs=function(){const e=[nd,Ju,Zu,td,Zl,yh,hl,Th,ed];let t;const n=dt.cacheEntries,i=[];for(t in n)n.hasOwnProperty(t)&&i.push(n[t]);i.sort(function(r,s){const a=e.indexOf(r.resourceLoader.constructor),l=e.indexOf(s.resourceLoader.constructor);return a-l});const o=i.length;for(let r=0;r<o;++r){const s=i[r];t=s.resourceLoader.cacheKey,c(n[t])&&(s.resourceLoader.destroy(),delete n[t])}dt.statistics.clear()};function Dr(e,t,n){A.typeOf.object("resource",e),A.typeOf.object("implicitTileset",t),A.typeOf.object("implicitCoordinates",n),this._resource=e,this._subtreeJson=void 0,this._bufferLoader=void 0,this._tileAvailability=void 0,this._contentAvailabilityBitstreams=[],this._childSubtreeAvailability=void 0,this._implicitCoordinates=n,this._subtreeLevels=t.subtreeLevels,this._subdivisionScheme=t.subdivisionScheme,this._branchingFactor=t.branchingFactor,this._metadata=void 0,this._tileMetadataTable=void 0,this._tilePropertyTableJson=void 0,this._contentMetadataTables=[],this._contentPropertyTableJsons=[],this._tileJumpBuffer=void 0,this._contentJumpBuffers=[],this._ready=!1}Object.defineProperties(Dr.prototype,{ready:{get:function(){return this._ready}},metadata:{get:function(){return this._metadata}},tileMetadataTable:{get:function(){return this._tileMetadataTable}},tilePropertyTableJson:{get:function(){return this._tilePropertyTableJson}},contentMetadataTables:{get:function(){return this._contentMetadataTables}},contentPropertyTableJsons:{get:function(){return this._contentPropertyTableJsons}},implicitCoordinates:{get:function(){return this._implicitCoordinates}}});Dr.prototype.tileIsAvailableAtIndex=function(e){return this._tileAvailability.getBit(e)};Dr.prototype.tileIsAvailableAtCoordinates=function(e){const t=this.getTileIndex(e);return this.tileIsAvailableAtIndex(t)};Dr.prototype.contentIsAvailableAtIndex=function(e,t){if(t=y(t,0),t<0||t>=this._contentAvailabilityBitstreams.length)throw new E("contentIndex out of bounds.");return this._contentAvailabilityBitstreams[t].getBit(e)};Dr.prototype.contentIsAvailableAtCoordinates=function(e,t){const n=this.getTileIndex(e);return this.contentIsAvailableAtIndex(n,t)};Dr.prototype.childSubtreeIsAvailableAtIndex=function(e){return this._childSubtreeAvailability.getBit(e)};Dr.prototype.childSubtreeIsAvailableAtCoordinates=function(e){const t=this.getChildSubtreeIndex(e);return this.childSubtreeIsAvailableAtIndex(t)};Dr.prototype.getLevelOffset=function(e){const t=this._branchingFactor;return(Math.pow(t,e)-1)/(t-1)};Dr.prototype.getParentMortonIndex=function(e){let t=2;return this._subdivisionScheme===jo.OCTREE&&(t=3),e>>t};Dr.fromSubtreeJson=async function(e,t,n,i,o){if(A.typeOf.object("resource",e),c(t)===c(n))throw new E("One of json and subtreeView must be defined.");A.typeOf.object("implicitTileset",i),A.typeOf.object("implicitCoordinates",o);const r=new Dr(e,i,o);let s;c(t)?s={json:t,binary:void 0}:s=xhe(n);const a=s.json;r._subtreeJson=a;let l;if(To(a,"3DTILES_metadata"))l=a.extensions["3DTILES_metadata"];else if(c(a.tileMetadata)){const C=a.tileMetadata;l=a.propertyTables[C]}const u=[];if(c(a.contentMetadata)){const C=a.contentMetadata.length;for(let w=0;w<C;w++){const v=a.contentMetadata[w];u.push(a.propertyTables[v])}}let h;const f=i.metadataSchema,_=a.subtreeMetadata;if(c(_)){const C=_.class,w=f.classes[C];h=new bd({subtreeMetadata:_,class:w})}r._metadata=h,r._tilePropertyTableJson=l,r._contentPropertyTableJsons=u;const g={constant:0};a.contentAvailabilityHeaders=[],To(a,"3DTILES_multiple_contents")?a.contentAvailabilityHeaders=a.extensions["3DTILES_multiple_contents"].contentAvailability:Array.isArray(a.contentAvailability)?a.contentAvailabilityHeaders=a.contentAvailability:a.contentAvailabilityHeaders.push(y(a.contentAvailability,g));const m=Che(a.buffers),b=Ehe(a.bufferViews,m);whe(a,b),c(l)&&RM(l,b);for(let C=0;C<u.length;C++){const w=u[C];RM(w,b)}const T=await She(r,m,s.binary),x=Ihe(b,T);return Dhe(r,a,i,x),c(l)&&(Phe(r,i,x),Lhe(r)),Ohe(r,i,x),Rhe(r),r._ready=!0,r};function xhe(e){const n=new DataView(e.buffer,e.byteOffset);let i=8;const o=n.getUint32(i,!0);i+=8;const r=n.getUint32(i,!0);i+=8;const s=sa(e,i,o);i+=o;const a=e.subarray(i,i+r);return{json:s,binary:a}}function Che(e){e=c(e)?e:[];for(let t=0;t<e.length;t++){const n=e[t];n.isExternal=c(n.uri),n.isActive=!1}return e}function Ehe(e,t){e=c(e)?e:[];for(let n=0;n<e.length;n++){const i=e[n],o=t[i.buffer];i.bufferHeader=o,i.isActive=!1}return e}function whe(e,t){let n;const i=e.tileAvailability;c(i.bitstream)?n=t[i.bitstream]:c(i.bufferView)&&(n=t[i.bufferView]),c(n)&&(n.isActive=!0,n.bufferHeader.isActive=!0);const o=e.contentAvailabilityHeaders;for(let s=0;s<o.length;s++)n=void 0,c(o[s].bitstream)?n=t[o[s].bitstream]:c(o[s].bufferView)&&(n=t[o[s].bufferView]),c(n)&&(n.isActive=!0,n.bufferHeader.isActive=!0);n=void 0;const r=e.childSubtreeAvailability;c(r.bitstream)?n=t[r.bitstream]:c(r.bufferView)&&(n=t[r.bufferView]),c(n)&&(n.isActive=!0,n.bufferHeader.isActive=!0)}function RM(e,t){const n=e.properties;let i;for(const o in n)if(n.hasOwnProperty(o)){const r=n[o],s=y(r.values,r.bufferView);i=t[s],i.isActive=!0,i.bufferHeader.isActive=!0;const a=y(r.stringOffsets,r.stringOffsetBufferView);c(a)&&(i=t[a],i.isActive=!0,i.bufferHeader.isActive=!0);const l=y(r.arrayOffsets,r.arrayOffsetBufferView);c(l)&&(i=t[l],i.isActive=!0,i.bufferHeader.isActive=!0)}}function She(e,t,n){const i=[];for(let o=0;o<t.length;o++){const r=t[o];if(!r.isActive)i.push(Promise.resolve(void 0));else if(r.isExternal){const s=vhe(e,r);i.push(s)}else i.push(Promise.resolve(n))}return Promise.all(i).then(function(o){const r={};for(let s=0;s<o.length;s++){const a=o[s];c(a)&&(r[s]=a)}return r})}async function vhe(e,t){const i=e._resource.getDerivedResource({url:t.uri}),o=dt.getExternalBufferLoader({resource:i});e._bufferLoader=o;try{await o.load()}catch(r){if(o.isDestroyed())return;throw r}return o.typedArray}function Ihe(e,t){const n={};for(let i=0;i<e.length;i++){const o=e[i];if(!o.isActive)continue;const r=o.byteOffset,s=r+o.byteLength,l=t[o.buffer].subarray(r,s);n[i]=l}return n}function Dhe(e,t,n,i){const o=n.branchingFactor,r=n.subtreeLevels,s=(Math.pow(o,r)-1)/(o-1),a=Math.pow(o,r),l=To(t,"3DTILES_metadata"),u=c(e._tilePropertyTableJson);let h=l||u;e._tileAvailability=Yw(t.tileAvailability,i,s,h);const f=e._contentPropertyTableJsons.length>0;h=h||f;for(let _=0;_<t.contentAvailabilityHeaders.length;_++){const g=Yw(t.contentAvailabilityHeaders[_],i,s,h);e._contentAvailabilityBitstreams.push(g)}e._childSubtreeAvailability=Yw(t.childSubtreeAvailability,i,a)}function Yw(e,t,n,i){if(c(e.constant))return new Rx({constant:Boolean(e.constant),lengthBits:n,availableCount:e.availableCount});let o;return c(e.bitstream)?o=t[e.bitstream]:c(e.bufferView)&&(o=t[e.bufferView]),new Rx({bitstream:o,lengthBits:n,availableCount:e.availableCount,computeAvailableCountEnabled:i})}function Phe(e,t,n){const i=e._tilePropertyTableJson,o=e._tileAvailability.availableCount,r=t.metadataSchema,s=i.class,a=r.classes[s];e._tileMetadataTable=new Hs({class:a,count:o,properties:i.properties,bufferViews:n})}function Ohe(e,t,n){const i=e._contentPropertyTableJsons,o=e._contentAvailabilityBitstreams,r=t.metadataSchema,s=e._contentMetadataTables;for(let a=0;a<i.length;a++){const l=i[a],h=o[a].availableCount,f=l.class,_=r.classes[f],g=new Hs({class:_,count:h,properties:l.properties,bufferViews:n});s.push(g)}}function N4(e){let t=0;const n=e.lengthBits,i=e.availableCount;let o;i<256?o=new Uint8Array(n):i<65536?o=new Uint16Array(n):o=new Uint32Array(n);for(let r=0;r<e.lengthBits;r++)e.getBit(r)&&(o[r]=t,t++);return o}function Lhe(e){const t=N4(e._tileAvailability);e._tileJumpBuffer=t}function Rhe(e){const t=e._contentJumpBuffers,n=e._contentAvailabilityBitstreams;for(let i=0;i<n.length;i++){const o=n[i],r=N4(o);t.push(r)}}Dr.prototype.getTileIndex=function(e){const t=e.level-this._implicitCoordinates.level;if(t<0||this._subtreeLevels<=t)throw new Te("level is out of bounds for this subtree");return e.getSubtreeCoordinates().getOffsetCoordinates(e).tileIndex};Dr.prototype.getChildSubtreeIndex=function(e){if(e.level-this._implicitCoordinates.level!==this._implicitCoordinates.subtreeLevels)throw new Te("level is out of bounds for this subtree");return e.getParentSubtreeCoordinates().getOffsetCoordinates(e).mortonIndex};function Nhe(e,t){if(!c(e._tileMetadataTable))return;const n=e.getTileIndex(t);if(e._tileAvailability.getBit(n))return e._tileJumpBuffer[n]}function Mhe(e,t,n){const i=e._contentMetadataTables;if(!c(i))return;const o=i[n];if(!c(o))return;const r=e._contentAvailabilityBitstreams[n],s=e.getTileIndex(t);if(r.getBit(s))return e._contentJumpBuffers[n][s]}Dr.prototype.getTileMetadataView=function(e){const t=Nhe(this,e);if(!c(t))return;const n=this._tileMetadataTable;return new pu({class:n.class,metadataTable:n,entityId:t,propertyTableJson:this._tilePropertyTableJson})};Dr.prototype.getContentMetadataView=function(e,t){const n=Mhe(this,e,t);if(!c(n))return;const i=this._contentMetadataTables[t],o=this._contentPropertyTableJsons[t];return new pu({class:i.class,metadataTable:i,entityId:n,contentIndex:t,propertyTableJson:o})};Dr.prototype.isDestroyed=function(){return!1};Dr.prototype.destroy=function(){return c(this._bufferLoader)&&dt.unload(this._bufferLoader),ve(this)};const Fhe={ID:"ID",NAME:"NAME",DESCRIPTION:"DESCRIPTION",TILESET_TILE_COUNT:"TILESET_TILE_COUNT",TILE_BOUNDING_BOX:"TILE_BOUNDING_BOX",TILE_BOUNDING_REGION:"TILE_BOUNDING_REGION",TILE_BOUNDING_SPHERE:"TILE_BOUNDING_SPHERE",TILE_MINIMUM_HEIGHT:"TILE_MINIMUM_HEIGHT",TILE_MAXIMUM_HEIGHT:"TILE_MAXIMUM_HEIGHT",TILE_HORIZON_OCCLUSION_POINT:"TILE_HORIZON_OCCLUSION_POINT",TILE_GEOMETRIC_ERROR:"TILE_GEOMETRIC_ERROR",CONTENT_BOUNDING_BOX:"CONTENT_BOUNDING_BOX",CONTENT_BOUNDING_REGION:"CONTENT_BOUNDING_REGION",CONTENT_BOUNDING_SPHERE:"CONTENT_BOUNDING_SPHERE",CONTENT_MINIMUM_HEIGHT:"CONTENT_MINIMUM_HEIGHT",CONTENT_MAXIMUM_HEIGHT:"CONTENT_MAXIMUM_HEIGHT",CONTENT_HORIZON_OCCLUSION_POINT:"CONTENT_HORIZON_OCCLUSION_POINT"},Bhe=Object.freeze(Fhe),ol={};ol.parseAllBoundingVolumeSemantics=function(e){return A.typeOf.object("tileMetadata",e),{tile:{boundingVolume:ol.parseBoundingVolumeSemantic("TILE",e),minimumHeight:ol._parseMinimumHeight("TILE",e),maximumHeight:ol._parseMaximumHeight("TILE",e)},content:{boundingVolume:ol.parseBoundingVolumeSemantic("CONTENT",e),minimumHeight:ol._parseMinimumHeight("CONTENT",e),maximumHeight:ol._parseMaximumHeight("CONTENT",e)}}};ol.parseBoundingVolumeSemantic=function(e,t){if(A.typeOf.string("prefix",e),e!=="TILE"&&e!=="CONTENT")throw new E("prefix must be either 'TILE' or 'CONTENT'");A.typeOf.object("tileMetadata",t);const n=`${e}_BOUNDING_BOX`,i=t.getPropertyBySemantic(n);if(c(i))return{box:i};const o=`${e}_BOUNDING_REGION`,r=t.getPropertyBySemantic(o);if(c(r))return{region:r};const s=`${e}_BOUNDING_SPHERE`,a=t.getPropertyBySemantic(s);if(c(a))return{sphere:a}};ol._parseMinimumHeight=function(e,t){if(A.typeOf.string("prefix",e),e!=="TILE"&&e!=="CONTENT")throw new E("prefix must be either 'TILE' or 'CONTENT'");A.typeOf.object("tileMetadata",t);const n=`${e}_MINIMUM_HEIGHT`;return t.getPropertyBySemantic(n)};ol._parseMaximumHeight=function(e,t){if(A.typeOf.string("prefix",e),e!=="TILE"&&e!=="CONTENT")throw new E("prefix must be either 'TILE' or 'CONTENT'");A.typeOf.object("tileMetadata",t);const n=`${e}_MAXIMUM_HEIGHT`;return t.getPropertyBySemantic(n)};const M4=ol;function ys(e,t,n){A.defined("tile.implicitTileset",t.implicitTileset),A.defined("tile.implicitCoordinates",t.implicitCoordinates);const i=t.implicitTileset,o=t.implicitCoordinates;this._implicitTileset=i,this._implicitCoordinates=o,this._implicitSubtree=void 0,this._tileset=e,this._tile=t,this._resource=n,this._metadata=void 0,this.featurePropertiesDirty=!1,this._group=void 0;const r=o.getTemplateValues(),s=i.subtreeUriTemplate.getDerivedResource({templateValues:r});this._url=s.getUrlComponent(!0),this._ready=!1}Object.defineProperties(ys.prototype,{featuresLength:{get:function(){return 0}},pointsLength:{get:function(){return 0}},trianglesLength:{get:function(){return 0}},geometryByteLength:{get:function(){return 0}},texturesByteLength:{get:function(){return 0}},batchTableByteLength:{get:function(){return 0}},innerContents:{get:function(){}},ready:{get:function(){return this._ready}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._url}},metadata:{get:function(){},set:function(){throw new E("Implicit3DTileContent cannot have metadata")}},batchTable:{get:function(){}},group:{get:function(){return this._group},set:function(e){this._group=e}}});ys.fromSubtreeJson=async function(e,t,n,i,o,r){if(A.defined("tile.implicitTileset",t.implicitTileset),A.defined("tile.implicitCoordinates",t.implicitCoordinates),c(i)===c(o))throw new E("One of json and arrayBuffer must be defined.");r=y(r,0);let s;c(o)&&(s=new Uint8Array(o,r));const a=t.implicitTileset,l=t.implicitCoordinates,u=await Dr.fromSubtreeJson(n,i,s,a,l),h=new ys(e,t,n);return h._implicitSubtree=u,zhe(h,u),h._ready=!0,h};function zhe(e,t){const n=e._tile,i=e._implicitCoordinates.childIndex,o=khe(e,t,n,i),r=e._tileset.statistics;n.children.push(o.rootTile),r.numberOfTilesTotal++;const s=Uhe(e,t,o.bottomRow);for(let a=0;a<s.length;a++){const l=s[a],u=l.tile,h=Xhe(e,u,l.childIndex);u.children.push(h),r.numberOfTilesTotal++}}function Uhe(e,t,n){const i=[],o=e._implicitTileset.branchingFactor;for(let r=0;r<n.length;r++){const s=n[r];if(!!c(s))for(let a=0;a<o;a++){const l=r*o+a;t.childSubtreeIsAvailableAtIndex(l)&&i.push({tile:s,childIndex:a})}}return i}function khe(e,t,n,i){const s=NM(e,t,n,i,0,!0),a=e._tileset.statistics;let l=[s],u=[];const h=e._implicitTileset;for(let f=1;f<h.subtreeLevels;f++){const _=t.getLevelOffset(f),g=h.branchingFactor*l.length;for(let m=0;m<g;m++){const b=_+m;if(!t.tileIsAvailableAtIndex(b)){u.push(void 0);continue}const T=t.getParentMortonIndex(m),x=l[T],C=m%h.branchingFactor,w=NM(e,t,x,C,b);x.children.push(w),a.numberOfTilesTotal++,u.push(w)}l=u,u=[]}return{rootTile:s,bottomRow:l}}function F4(e,t,n){const i=Bhe.TILE_GEOMETRIC_ERROR;return c(e)&&e.hasPropertyBySemantic(i)?e.getPropertyBySemantic(i):t.geometricError/Math.pow(2,n.level)}function NM(e,t,n,i,o,r){const s=e._implicitTileset;let a;y(r,!1)?a=n.implicitCoordinates:a=n.implicitCoordinates.getChildCoordinates(i);let l,u,h;if(c(t.tilePropertyTableJson)){l=t.getTileMetadataView(a);const N=M4.parseAllBoundingVolumeSemantics(l);u=N.tile,h=N.content}const _=t.contentPropertyTableJsons.length;let g=!1;for(let N=0;N<_;N++)if(t.contentIsAvailableAtCoordinates(a,N)){g=!0;break}const m=Ghe(s,a,i,r,n,u),b=[];for(let N=0;N<s.contentCount;N++){if(!t.contentIsAvailableAtIndex(o,N))continue;const U={uri:s.contentUriTemplates[N].getDerivedResource({templateValues:a.getTemplateValues()}).url},B=jhe(m,h);c(B)&&(U.boundingVolume=B),b.push(jt(U,s.contentHeaders[N]))}const T=F4(l,s,a),x={boundingVolume:m,geometricError:T,refine:s.refine,contents:b},C=!0,w=Je(s.tileHeader,C);delete w.boundingVolume,delete w.transform,delete w.metadata;const v=jt(x,w,C),P=V4(e,s.baseResource,v,n);return P.implicitCoordinates=a,P.implicitSubtree=t,P.metadata=l,P.hasImplicitContentMetadata=g,P}function zx(e,t){return c(e)&&c(t)&&(c(t.minimumHeight)||c(t.maximumHeight))&&(To(e,"3DTILES_bounding_volume_S2")||c(e.region))}function XI(e,t){!c(t)||(To(e,"3DTILES_bounding_volume_S2")?Hhe(e.extensions["3DTILES_bounding_volume_S2"],t.minimumHeight,t.maximumHeight):c(e.region)&&Vhe(e.region,t.minimumHeight,t.maximumHeight))}function Vhe(e,t,n){c(t)&&(e[4]=t),c(n)&&(e[5]=n)}function Hhe(e,t,n){c(t)&&(e.minimumHeight=t),c(n)&&(e.maximumHeight=n)}function Ghe(e,t,n,i,o,r){let s;return!c(r)||!c(r.boundingVolume)||!zx(r.boundingVolume,r)&&zx(e.boundingVolume,r)?s=B4(e,t,n,y(i,!1),o):s=r.boundingVolume,XI(s,r),s}function jhe(e,t){let n;return c(t)&&(n=t.boundingVolume),zx(n,t)?XI(n,t):zx(e,t)&&(n=Je(e,!0),XI(n,t)),n}function B4(e,t,n,i,o){const r=e.boundingVolume;return To(r,"3DTILES_bounding_volume_S2")?z4(i,o,n,t.level,t.x,t.y,t.z):c(r.region)?{region:k4(r.region,t.level,t.x,t.y,t.z)}:{box:U4(r.box,t.level,t.x,t.y,t.z)}}function z4(e,t,n,i,o,r,s){A.typeOf.bool("parentIsPlaceholderTile",e),A.typeOf.object("parentTile",t),A.typeOf.number("childIndex",n),A.typeOf.number("level",i),A.typeOf.number("x",o),A.typeOf.number("y",r),c(s)&&A.typeOf.number("z",s);const a=t._boundingVolume;if(e)return{extensions:{"3DTILES_bounding_volume_S2":{token:ui.getTokenFromId(a.s2Cell._cellId),minimumHeight:a.minimumHeight,maximumHeight:a.maximumHeight}}};const l=Number(t._boundingVolume.s2Cell._cellId>>BigInt(61)),u=l%2===0?xM.encode2D(i,o,r):xM.encode2D(i,r,o),h=ui.fromFacePositionLevel(l,BigInt(u),i);let f,_;if(c(s)){const g=(a.maximumHeight+a.minimumHeight)/2;f=n<4?a.minimumHeight:g,_=n<4?g:a.maximumHeight}else f=a.minimumHeight,_=a.maximumHeight;return{extensions:{"3DTILES_bounding_volume_S2":{token:ui.getTokenFromId(h._cellId),minimumHeight:f,maximumHeight:_}}}}const Whe=new d,qhe=new d,$w=new d,Yhe=new $;function U4(e,t,n,i,o){if(A.typeOf.object("rootBox",e),A.typeOf.number("level",t),A.typeOf.number("x",n),A.typeOf.number("y",i),c(o)&&A.typeOf.number("z",o),t===0)return e;const r=d.unpack(e,0,qhe),s=$.unpack(e,3,Yhe),a=Math.pow(2,-t),l=-1+(2*n+1)*a,u=-1+(2*i+1)*a;let h=0;const f=d.fromElements(a,a,1,Whe);c(o)&&(h=-1+(2*o+1)*a,f.z=a);let _=d.fromElements(l,u,h,$w);_=$.multiplyByVector(s,_,$w),_=d.add(_,r,$w);let g=$.clone(s);g=$.multiplyByScale(g,f,g);const m=new Array(12);return d.pack(_,m),$.pack(g,m,3),m}const $he=new ce;function k4(e,t,n,i,o){if(A.typeOf.object("rootRegion",e),A.typeOf.number("level",t),A.typeOf.number("x",n),A.typeOf.number("y",i),c(o)&&A.typeOf.number("z",o),t===0)return e.slice();const r=ce.unpack(e,0,$he),s=e[4],a=e[5],l=Math.pow(2,-t),u=l*r.width,h=R.negativePiToPi(r.west+n*u),f=R.negativePiToPi(h+u),_=l*r.height,g=R.negativePiToPi(r.south+i*_),m=R.negativePiToPi(g+_);let b=s,T=a;if(c(o)){const x=l*(a-s);b+=o*x,T=b+x}return[h,g,f,m,b,T]}function Xhe(e,t,n){const i=e._implicitTileset,o=t.implicitCoordinates.getChildCoordinates(n),r=B4(i,o,n,!1,t),s=F4(void 0,i,o),a=i.subtreeUriTemplate.getDerivedResource({templateValues:o.getTemplateValues()}).url,l={boundingVolume:r,geometricError:s,refine:i.refine,contents:[{uri:a}]},u=V4(e,i.baseResource,l,t);return u.implicitTileset=i,u.implicitCoordinates=o,u}function V4(e,t,n,i){const o=e._tile.constructor;return new o(e._tileset,t,n,i)}ys.prototype.hasProperty=function(e,t){return!1};ys.prototype.getFeature=function(e){};ys.prototype.applyDebugSettings=function(e,t){};ys.prototype.applyStyle=function(e){};ys.prototype.update=function(e,t){};ys.prototype.pick=function(e,t,n){};ys.prototype.isDestroyed=function(){return!1};ys.prototype.destroy=function(){return this._implicitSubtree=this._implicitSubtree&&this._implicitSubtree.destroy(),ve(this)};ys._deriveBoundingBox=U4;ys._deriveBoundingRegion=k4;ys._deriveBoundingVolumeS2=z4;const Qhe={NONE:0,REPEAT:1,MIRRORED_REPEAT:2},Wf=Object.freeze(Qhe);function Lh(e,t){A.typeOf.object("normal",e),A.typeOf.number("distance",t),this._distance=t,this._normal=new H4(e,this),this.onChangeCallback=void 0,this.index=-1}Object.defineProperties(Lh.prototype,{distance:{get:function(){return this._distance},set:function(e){A.typeOf.number("value",e),c(this.onChangeCallback)&&e!==this._distance&&this.onChangeCallback(this.index),this._distance=e}},normal:{get:function(){return this._normal},set:function(e){A.typeOf.object("value",e),c(this.onChangeCallback)&&!d.equals(this._normal._cartesian3,e)&&this.onChangeCallback(this.index),d.clone(e,this._normal._cartesian3)}}});Lh.fromPlane=function(e,t){return A.typeOf.object("plane",e),c(t)?(t.normal=e.normal,t.distance=e.distance):t=new Lh(e.normal,e.distance),t};Lh.clone=function(e,t){return c(t)?(t.normal=e.normal,t.distance=e.distance,t):new Lh(e.normal,e.distance)};function H4(e,t){this._clippingPlane=t,this._cartesian3=d.clone(e)}Object.defineProperties(H4.prototype,{x:{get:function(){return this._cartesian3.x},set:function(e){A.typeOf.number("value",e),c(this._clippingPlane.onChangeCallback)&&e!==this._cartesian3.x&&this._clippingPlane.onChangeCallback(this._clippingPlane.index),this._cartesian3.x=e}},y:{get:function(){return this._cartesian3.y},set:function(e){A.typeOf.number("value",e),c(this._clippingPlane.onChangeCallback)&&e!==this._cartesian3.y&&this._clippingPlane.onChangeCallback(this._clippingPlane.index),this._cartesian3.y=e}},z:{get:function(){return this._cartesian3.z},set:function(e){A.typeOf.number("value",e),c(this._clippingPlane.onChangeCallback)&&e!==this._cartesian3.z&&this._clippingPlane.onChangeCallback(this._clippingPlane.index),this._cartesian3.z=e}}});function Li(e){e=y(e,y.EMPTY_OBJECT),this._planes=[],this._dirtyIndex=-1,this._multipleDirtyPlanes=!1,this._enabled=y(e.enabled,!0),this.modelMatrix=L.clone(y(e.modelMatrix,L.IDENTITY)),this.edgeColor=z.clone(y(e.edgeColor,z.WHITE)),this.edgeWidth=y(e.edgeWidth,0),this.planeAdded=new Le,this.planeRemoved=new Le,this._owner=void 0;const t=y(e.unionClippingRegions,!1);this._unionClippingRegions=t,this._testIntersection=t?G4:j4,this._uint8View=void 0,this._float32View=void 0,this._clippingPlanesTexture=void 0;const n=e.planes;if(c(n)){const i=n.length;for(let o=0;o<i;++o)this.add(n[o])}}function G4(e){return e===Bt.OUTSIDE}function j4(e){return e===Bt.INSIDE}Object.defineProperties(Li.prototype,{length:{get:function(){return this._planes.length}},unionClippingRegions:{get:function(){return this._unionClippingRegions},set:function(e){this._unionClippingRegions!==e&&(this._unionClippingRegions=e,this._testIntersection=e?G4:j4)}},enabled:{get:function(){return this._enabled},set:function(e){this._enabled!==e&&(this._enabled=e)}},texture:{get:function(){return this._clippingPlanesTexture}},owner:{get:function(){return this._owner}},clippingPlanesState:{get:function(){return this._unionClippingRegions?this._planes.length:-this._planes.length}}});function MM(e,t){e._multipleDirtyPlanes=e._multipleDirtyPlanes||e._dirtyIndex!==-1&&e._dirtyIndex!==t,e._dirtyIndex=t}Li.prototype.add=function(e){const t=this._planes.length,n=this;e.onChangeCallback=function(i){MM(n,i)},e.index=t,MM(this,t),this._planes.push(e),this.planeAdded.raiseEvent(e,t)};Li.prototype.get=function(e){return A.typeOf.number("index",e),this._planes[e]};function W4(e,t){const n=e.length;for(let i=0;i<n;++i)if(_t.equals(e[i],t))return i;return-1}Li.prototype.contains=function(e){return W4(this._planes,e)!==-1};Li.prototype.remove=function(e){const t=this._planes,n=W4(t,e);if(n===-1)return!1;e instanceof Lh&&(e.onChangeCallback=void 0,e.index=-1);const i=t.length-1;for(let o=n;o<i;++o){const r=t[o+1];t[o]=r,r instanceof Lh&&(r.index=o)}return this._multipleDirtyPlanes=!0,t.length=i,this.planeRemoved.raiseEvent(e,n),!0};Li.prototype.removeAll=function(){const e=this._planes,t=e.length;for(let n=0;n<t;++n){const i=e[n];i instanceof Lh&&(i.onChangeCallback=void 0,i.index=-1),this.planeRemoved.raiseEvent(i,n)}this._multipleDirtyPlanes=!0,this._planes=[]};const Khe=new te,Zhe=new te;function FM(e,t,n){const i=e._uint8View,o=e._planes;let r=0;for(let s=t;s<n;++s){const a=o[s],l=En.octEncodeToCartesian4(a.normal,Zhe);i[r]=l.x,i[r+1]=l.y,i[r+2]=l.z,i[r+3]=l.w;const u=te.packFloat(a.distance,Khe);i[r+4]=u.x,i[r+5]=u.y,i[r+6]=u.z,i[r+7]=u.w,r+=8}}function BM(e,t,n){const i=e._float32View,o=e._planes;let r=0;for(let s=t;s<n;++s){const a=o[s],l=a.normal;i[r]=l.x,i[r+1]=l.y,i[r+2]=l.z,i[r+3]=a.distance,r+=4}}function q4(e,t){const n=pt.maximumTextureSize;return t.x=Math.min(e,n),t.y=Math.ceil(e/t.x),t}const Jhe=new H;Li.prototype.update=function(e){let t=this._clippingPlanesTexture;const n=e.context,i=Li.useFloatTexture(n),o=i?this.length:this.length*2;if(c(t)){const s=t.width*t.height;(s<o||o<.25*s)&&(t.destroy(),t=void 0,this._clippingPlanesTexture=void 0)}if(this.length===0)return;if(!c(t)){const s=q4(o,Jhe);s.y*=2,i?(t=new xt({context:n,width:s.x,height:s.y,pixelFormat:Ve.RGBA,pixelDatatype:Me.FLOAT,sampler:un.NEAREST,flipY:!1}),this._float32View=new Float32Array(s.x*s.y*4)):(t=new xt({context:n,width:s.x,height:s.y,pixelFormat:Ve.RGBA,pixelDatatype:Me.UNSIGNED_BYTE,sampler:un.NEAREST,flipY:!1}),this._uint8View=new Uint8Array(s.x*s.y*4)),this._clippingPlanesTexture=t,this._multipleDirtyPlanes=!0}const r=this._dirtyIndex;if(!(!this._multipleDirtyPlanes&&r===-1)){if(this._multipleDirtyPlanes)i?(BM(this,0,this._planes.length),t.copyFrom({source:{width:t.width,height:t.height,arrayBufferView:this._float32View}})):(FM(this,0,this._planes.length),t.copyFrom({source:{width:t.width,height:t.height,arrayBufferView:this._uint8View}}));else{let s=0,a=0;i?(a=Math.floor(r/t.width),s=Math.floor(r-a*t.width),BM(this,r,r+1),t.copyFrom({source:{width:1,height:1,arrayBufferView:this._float32View},xOffset:s,yOffset:a})):(a=Math.floor(r*2/t.width),s=Math.floor(r*2-a*t.width),FM(this,r,r+1),t.copyFrom({source:{width:2,height:1,arrayBufferView:this._uint8View},xOffset:s,yOffset:a}))}this._multipleDirtyPlanes=!1,this._dirtyIndex=-1}};const efe=new L,zM=new _t(d.UNIT_X,0);Li.prototype.computeIntersectionWithBoundingVolume=function(e,t){const n=this._planes,i=n.length;let o=this.modelMatrix;c(t)&&(o=L.multiply(t,o,efe));let r=Bt.INSIDE;!this.unionClippingRegions&&i>0&&(r=Bt.OUTSIDE);for(let s=0;s<i;++s){const a=n[s];_t.transform(a,o,zM);const l=e.intersectPlane(zM);if(l===Bt.INTERSECTING)r=l;else if(this._testIntersection(l))return l}return r};Li.setOwner=function(e,t,n){if(e!==t[n]&&(t[n]=t[n]&&t[n].destroy(),c(e))){if(c(e._owner))throw new E("ClippingPlaneCollection should only be assigned to one object");e._owner=t,t[n]=e}};Li.useFloatTexture=function(e){return e.floatingPointTexture};Li.getTextureResolution=function(e,t,n){const i=e.texture;if(c(i))return n.x=i.width,n.y=i.height,n;const o=Li.useFloatTexture(t)?e.length:e.length*2,r=q4(o,n);return r.y*=2,r};Li.prototype.isDestroyed=function(){return!1};Li.prototype.destroy=function(){return this._clippingPlanesTexture=this._clippingPlanesTexture&&this._clippingPlanesTexture.destroy(),ve(this)};var CO={exports:{}};CO.exports=DC;CO.exports.default=DC;function DC(e,t,n){n=n||2;var i=t&&t.length,o=i?t[0]*n:e.length,r=Y4(e,0,o,n,!0),s=[];if(!r||r.next===r.prev)return s;var a,l,u,h,f,_,g;if(i&&(r=rfe(e,t,r,n)),e.length>80*n){a=u=e[0],l=h=e[1];for(var m=n;m<o;m+=n)f=e[m],_=e[m+1],f<a&&(a=f),_<l&&(l=_),f>u&&(u=f),_>h&&(h=_);g=Math.max(u-a,h-l),g=g!==0?32767/g:0}return _0(r,s,n,a,l,g,0),s}function Y4(e,t,n,i,o){var r,s;if(o===ZI(e,t,n,i)>0)for(r=t;r<n;r+=i)s=UM(r,e[r],e[r+1],s);else for(r=n-i;r>=t;r-=i)s=UM(r,e[r],e[r+1],s);return s&&PC(s,s.next)&&(y0(s),s=s.next),s}function hp(e,t){if(!e)return e;t||(t=e);var n=e,i;do if(i=!1,!n.steiner&&(PC(n,n.next)||ro(n.prev,n,n.next)===0)){if(y0(n),n=t=n.prev,n===n.next)break;i=!0}else n=n.next;while(i||n!==t);return t}function _0(e,t,n,i,o,r,s){if(!!e){!s&&r&&ufe(e,i,o,r);for(var a=e,l,u;e.prev!==e.next;){if(l=e.prev,u=e.next,r?nfe(e,i,o,r):tfe(e)){t.push(l.i/n|0),t.push(e.i/n|0),t.push(u.i/n|0),y0(e),e=u.next,a=u.next;continue}if(e=u,e===a){s?s===1?(e=ife(hp(e),t,n),_0(e,t,n,i,o,r,2)):s===2&&ofe(e,t,n,i,o,r):_0(hp(e),t,n,i,o,r,1);break}}}}function tfe(e){var t=e.prev,n=e,i=e.next;if(ro(t,n,i)>=0)return!1;for(var o=t.x,r=n.x,s=i.x,a=t.y,l=n.y,u=i.y,h=o<r?o<s?o:s:r<s?r:s,f=a<l?a<u?a:u:l<u?l:u,_=o>r?o>s?o:s:r>s?r:s,g=a>l?a>u?a:u:l>u?l:u,m=i.next;m!==t;){if(m.x>=h&&m.x<=_&&m.y>=f&&m.y<=g&&$m(o,a,r,l,s,u,m.x,m.y)&&ro(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function nfe(e,t,n,i){var o=e.prev,r=e,s=e.next;if(ro(o,r,s)>=0)return!1;for(var a=o.x,l=r.x,u=s.x,h=o.y,f=r.y,_=s.y,g=a<l?a<u?a:u:l<u?l:u,m=h<f?h<_?h:_:f<_?f:_,b=a>l?a>u?a:u:l>u?l:u,T=h>f?h>_?h:_:f>_?f:_,x=QI(g,m,t,n,i),C=QI(b,T,t,n,i),w=e.prevZ,v=e.nextZ;w&&w.z>=x&&v&&v.z<=C;){if(w.x>=g&&w.x<=b&&w.y>=m&&w.y<=T&&w!==o&&w!==s&&$m(a,h,l,f,u,_,w.x,w.y)&&ro(w.prev,w,w.next)>=0||(w=w.prevZ,v.x>=g&&v.x<=b&&v.y>=m&&v.y<=T&&v!==o&&v!==s&&$m(a,h,l,f,u,_,v.x,v.y)&&ro(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;w&&w.z>=x;){if(w.x>=g&&w.x<=b&&w.y>=m&&w.y<=T&&w!==o&&w!==s&&$m(a,h,l,f,u,_,w.x,w.y)&&ro(w.prev,w,w.next)>=0)return!1;w=w.prevZ}for(;v&&v.z<=C;){if(v.x>=g&&v.x<=b&&v.y>=m&&v.y<=T&&v!==o&&v!==s&&$m(a,h,l,f,u,_,v.x,v.y)&&ro(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function ife(e,t,n){var i=e;do{var o=i.prev,r=i.next.next;!PC(o,r)&&$4(o,i,i.next,r)&&g0(o,r)&&g0(r,o)&&(t.push(o.i/n|0),t.push(i.i/n|0),t.push(r.i/n|0),y0(i),y0(i.next),i=e=r),i=i.next}while(i!==e);return hp(i)}function ofe(e,t,n,i,o,r){var s=e;do{for(var a=s.next.next;a!==s.prev;){if(s.i!==a.i&&ffe(s,a)){var l=X4(s,a);s=hp(s,s.next),l=hp(l,l.next),_0(s,t,n,i,o,r,0),_0(l,t,n,i,o,r,0);return}a=a.next}s=s.next}while(s!==e)}function rfe(e,t,n,i){var o=[],r,s,a,l,u;for(r=0,s=t.length;r<s;r++)a=t[r]*i,l=r<s-1?t[r+1]*i:e.length,u=Y4(e,a,l,i,!1),u===u.next&&(u.steiner=!0),o.push(hfe(u));for(o.sort(sfe),r=0;r<o.length;r++)n=afe(o[r],n);return n}function sfe(e,t){return e.x-t.x}function afe(e,t){var n=cfe(e,t);if(!n)return t;var i=X4(n,e);return hp(i,i.next),hp(n,n.next)}function cfe(e,t){var n=t,i=e.x,o=e.y,r=-1/0,s;do{if(o<=n.y&&o>=n.next.y&&n.next.y!==n.y){var a=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(a<=i&&a>r&&(r=a,s=n.x<n.next.x?n:n.next,a===i))return s}n=n.next}while(n!==t);if(!s)return null;var l=s,u=s.x,h=s.y,f=1/0,_;n=s;do i>=n.x&&n.x>=u&&i!==n.x&&$m(o<h?i:r,o,u,h,o<h?r:i,o,n.x,n.y)&&(_=Math.abs(o-n.y)/(i-n.x),g0(n,e)&&(_<f||_===f&&(n.x>s.x||n.x===s.x&&lfe(s,n)))&&(s=n,f=_)),n=n.next;while(n!==l);return s}function lfe(e,t){return ro(e.prev,e,t.prev)<0&&ro(t.next,e,e.next)<0}function ufe(e,t,n,i){var o=e;do o.z===0&&(o.z=QI(o.x,o.y,t,n,i)),o.prevZ=o.prev,o.nextZ=o.next,o=o.next;while(o!==e);o.prevZ.nextZ=null,o.prevZ=null,dfe(o)}function dfe(e){var t,n,i,o,r,s,a,l,u=1;do{for(n=e,e=null,r=null,s=0;n;){for(s++,i=n,a=0,t=0;t<u&&(a++,i=i.nextZ,!!i);t++);for(l=u;a>0||l>0&&i;)a!==0&&(l===0||!i||n.z<=i.z)?(o=n,n=n.nextZ,a--):(o=i,i=i.nextZ,l--),r?r.nextZ=o:e=o,o.prevZ=r,r=o;n=i}r.nextZ=null,u*=2}while(s>1);return e}function QI(e,t,n,i,o){return e=(e-n)*o|0,t=(t-i)*o|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function hfe(e){var t=e,n=e;do(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next;while(t!==e);return n}function $m(e,t,n,i,o,r,s,a){return(o-s)*(t-a)>=(e-s)*(r-a)&&(e-s)*(i-a)>=(n-s)*(t-a)&&(n-s)*(r-a)>=(o-s)*(i-a)}function ffe(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!pfe(e,t)&&(g0(e,t)&&g0(t,e)&&mfe(e,t)&&(ro(e.prev,e,t.prev)||ro(e,t.prev,t))||PC(e,t)&&ro(e.prev,e,e.next)>0&&ro(t.prev,t,t.next)>0)}function ro(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function PC(e,t){return e.x===t.x&&e.y===t.y}function $4(e,t,n,i){var o=hT(ro(e,t,n)),r=hT(ro(e,t,i)),s=hT(ro(n,i,e)),a=hT(ro(n,i,t));return!!(o!==r&&s!==a||o===0&&dT(e,n,t)||r===0&&dT(e,i,t)||s===0&&dT(n,e,i)||a===0&&dT(n,t,i))}function dT(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function hT(e){return e>0?1:e<0?-1:0}function pfe(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&$4(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function g0(e,t){return ro(e.prev,e,e.next)<0?ro(e,t,e.next)>=0&&ro(e,e.prev,t)>=0:ro(e,t,e.prev)<0||ro(e,e.next,t)<0}function mfe(e,t){var n=e,i=!1,o=(e.x+t.x)/2,r=(e.y+t.y)/2;do n.y>r!=n.next.y>r&&n.next.y!==n.y&&o<(n.next.x-n.x)*(r-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next;while(n!==e);return i}function X4(e,t){var n=new KI(e.i,e.x,e.y),i=new KI(t.i,t.x,t.y),o=e.next,r=t.prev;return e.next=t,t.prev=e,n.next=o,o.prev=n,i.next=n,n.prev=i,r.next=i,i.prev=r,i}function UM(e,t,n,i){var o=new KI(e,t,n);return i?(o.next=i.next,o.prev=i,i.next.prev=o,i.next=o):(o.prev=o,o.next=o),o}function y0(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function KI(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}DC.deviation=function(e,t,n,i){var o=t&&t.length,r=o?t[0]*n:e.length,s=Math.abs(ZI(e,0,r,n));if(o)for(var a=0,l=t.length;a<l;a++){var u=t[a]*n,h=a<l-1?t[a+1]*n:e.length;s-=Math.abs(ZI(e,u,h,n))}var f=0;for(a=0;a<i.length;a+=3){var _=i[a]*n,g=i[a+1]*n,m=i[a+2]*n;f+=Math.abs((e[_]-e[m])*(e[g+1]-e[_+1])-(e[_]-e[g])*(e[m+1]-e[_+1]))}return s===0&&f===0?0:Math.abs((f-s)/s)};function ZI(e,t,n,i){for(var o=0,r=t,s=n-i;r<n;r+=i)o+=(e[s]-e[r])*(e[r+1]+e[s+1]),s=r;return o}DC.flatten=function(e){for(var t=e[0][0].length,n={vertices:[],holes:[],dimensions:t},i=0,o=0;o<e.length;o++){for(var r=0;r<e[o].length;r++)for(var s=0;s<t;s++)n.vertices.push(e[o][r][s]);o>0&&(i+=e[o-1].length,n.holes.push(i))}return n};const _fe=new d,gfe=new d,Rh={};Rh.computeArea2D=function(e){A.defined("positions",e),A.typeOf.number.greaterThanOrEquals("positions.length",e.length,3);const t=e.length;let n=0;for(let i=t-1,o=0;o<t;i=o++){const r=e[i],s=e[o];n+=r.x*s.y-s.x*r.y}return n*.5};Rh.computeWindingOrder2D=function(e){return Rh.computeArea2D(e)>0?wc.COUNTER_CLOCKWISE:wc.CLOCKWISE};Rh.triangulate=function(e,t){A.defined("positions",e);const n=H.packArray(e);return CO.exports(n,t,2)};const Q4=new d,K4=new d,Z4=new d,kM=new d,VM=new d,HM=new d,Uu=new d,J4=new H,eH=new H,tH=new H,o_=new H;Rh.computeSubdivision=function(e,t,n,i,o){o=y(o,R.RADIANS_PER_DEGREE);const r=c(i);A.typeOf.object("ellipsoid",e),A.defined("positions",t),A.defined("indices",n),A.typeOf.number.greaterThanOrEquals("indices.length",n.length,3),A.typeOf.number.equals("indices.length % 3","0",n.length%3,0),A.typeOf.number.greaterThan("granularity",o,0);const s=n.slice(0);let a;const l=t.length,u=new Array(l*3),h=new Array(l*2);let f=0,_=0;for(a=0;a<l;a++){const w=t[a];if(u[f++]=w.x,u[f++]=w.y,u[f++]=w.z,r){const v=i[a];h[_++]=v.x,h[_++]=v.y}}const g=[],m={},b=e.maximumRadius,T=R.chordLength(o,b),x=T*T;for(;s.length>0;){const w=s.pop(),v=s.pop(),P=s.pop(),N=d.fromArray(u,P*3,Q4),k=d.fromArray(u,v*3,K4),M=d.fromArray(u,w*3,Z4);let U,B,S;r&&(U=H.fromArray(h,P*2,J4),B=H.fromArray(h,v*2,eH),S=H.fromArray(h,w*2,tH));const D=d.multiplyByScalar(d.normalize(N,kM),b,kM),p=d.multiplyByScalar(d.normalize(k,VM),b,VM),I=d.multiplyByScalar(d.normalize(M,HM),b,HM),O=d.magnitudeSquared(d.subtract(D,p,Uu)),F=d.magnitudeSquared(d.subtract(p,I,Uu)),V=d.magnitudeSquared(d.subtract(I,D,Uu)),G=Math.max(O,F,V);let j,W,X;G>x?O===G?(j=`${Math.min(P,v)} ${Math.max(P,v)}`,a=m[j],c(a)||(W=d.add(N,k,Uu),d.multiplyByScalar(W,.5,W),u.push(W.x,W.y,W.z),a=u.length/3-1,m[j]=a,r&&(X=H.add(U,B,o_),H.multiplyByScalar(X,.5,X),h.push(X.x,X.y))),s.push(P,a,w),s.push(a,v,w)):F===G?(j=`${Math.min(v,w)} ${Math.max(v,w)}`,a=m[j],c(a)||(W=d.add(k,M,Uu),d.multiplyByScalar(W,.5,W),u.push(W.x,W.y,W.z),a=u.length/3-1,m[j]=a,r&&(X=H.add(B,S,o_),H.multiplyByScalar(X,.5,X),h.push(X.x,X.y))),s.push(v,a,P),s.push(a,w,P)):V===G&&(j=`${Math.min(w,P)} ${Math.max(w,P)}`,a=m[j],c(a)||(W=d.add(M,N,Uu),d.multiplyByScalar(W,.5,W),u.push(W.x,W.y,W.z),a=u.length/3-1,m[j]=a,r&&(X=H.add(S,U,o_),H.multiplyByScalar(X,.5,X),h.push(X.x,X.y))),s.push(w,a,v),s.push(a,P,v)):(g.push(P),g.push(v),g.push(w))}const C={attributes:{position:new Ie({componentDatatype:Z.DOUBLE,componentsPerAttribute:3,values:u})},indices:g,primitiveType:ze.TRIANGLES};return r&&(C.attributes.st=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:2,values:h})),new Tt(C)};const yfe=new he,bfe=new he,Tfe=new he,Xw=new he;Rh.computeRhumbLineSubdivision=function(e,t,n,i,o){o=y(o,R.RADIANS_PER_DEGREE);const r=c(i);A.typeOf.object("ellipsoid",e),A.defined("positions",t),A.defined("indices",n),A.typeOf.number.greaterThanOrEquals("indices.length",n.length,3),A.typeOf.number.equals("indices.length % 3","0",n.length%3,0),A.typeOf.number.greaterThan("granularity",o,0);const s=n.slice(0);let a;const l=t.length,u=new Array(l*3),h=new Array(l*2);let f=0,_=0;for(a=0;a<l;a++){const P=t[a];if(u[f++]=P.x,u[f++]=P.y,u[f++]=P.z,r){const N=i[a];h[_++]=N.x,h[_++]=N.y}}const g=[],m={},b=e.maximumRadius,T=R.chordLength(o,b),x=new vr(void 0,void 0,e),C=new vr(void 0,void 0,e),w=new vr(void 0,void 0,e);for(;s.length>0;){const P=s.pop(),N=s.pop(),k=s.pop(),M=d.fromArray(u,k*3,Q4),U=d.fromArray(u,N*3,K4),B=d.fromArray(u,P*3,Z4);let S,D,p;r&&(S=H.fromArray(h,k*2,J4),D=H.fromArray(h,N*2,eH),p=H.fromArray(h,P*2,tH));const I=e.cartesianToCartographic(M,yfe),O=e.cartesianToCartographic(U,bfe),F=e.cartesianToCartographic(B,Tfe);x.setEndPoints(I,O);const V=x.surfaceDistance;C.setEndPoints(O,F);const G=C.surfaceDistance;w.setEndPoints(F,I);const j=w.surfaceDistance,W=Math.max(V,G,j);let X,q,ee,Y,ne;W>T?V===W?(X=`${Math.min(k,N)} ${Math.max(k,N)}`,a=m[X],c(a)||(q=x.interpolateUsingFraction(.5,Xw),ee=(I.height+O.height)*.5,Y=d.fromRadians(q.longitude,q.latitude,ee,e,Uu),u.push(Y.x,Y.y,Y.z),a=u.length/3-1,m[X]=a,r&&(ne=H.add(S,D,o_),H.multiplyByScalar(ne,.5,ne),h.push(ne.x,ne.y))),s.push(k,a,P),s.push(a,N,P)):G===W?(X=`${Math.min(N,P)} ${Math.max(N,P)}`,a=m[X],c(a)||(q=C.interpolateUsingFraction(.5,Xw),ee=(O.height+F.height)*.5,Y=d.fromRadians(q.longitude,q.latitude,ee,e,Uu),u.push(Y.x,Y.y,Y.z),a=u.length/3-1,m[X]=a,r&&(ne=H.add(D,p,o_),H.multiplyByScalar(ne,.5,ne),h.push(ne.x,ne.y))),s.push(N,a,k),s.push(a,P,k)):j===W&&(X=`${Math.min(P,k)} ${Math.max(P,k)}`,a=m[X],c(a)||(q=w.interpolateUsingFraction(.5,Xw),ee=(F.height+I.height)*.5,Y=d.fromRadians(q.longitude,q.latitude,ee,e,Uu),u.push(Y.x,Y.y,Y.z),a=u.length/3-1,m[X]=a,r&&(ne=H.add(p,S,o_),H.multiplyByScalar(ne,.5,ne),h.push(ne.x,ne.y))),s.push(P,a,N),s.push(a,k,N)):(g.push(k),g.push(N),g.push(P))}const v={attributes:{position:new Ie({componentDatatype:Z.DOUBLE,componentsPerAttribute:3,values:u})},indices:g,primitiveType:ze.TRIANGLES};return r&&(v.attributes.st=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:2,values:h})),new Tt(v)};Rh.scaleToGeodeticHeight=function(e,t,n,i){n=y(n,ae.WGS84);let o=_fe,r=gfe;if(t=y(t,0),i=y(i,!0),c(e)){const s=e.length;for(let a=0;a<s;a+=3)d.fromArray(e,a,r),i&&(r=n.scaleToGeodeticSurface(r,r)),t!==0&&(o=n.geodeticSurfaceNormal(r,o),d.multiplyByScalar(o,t,o),d.add(r,o,r)),e[a]=r.x,e[a+1]=r.y,e[a+2]=r.z}return e};const ai=Rh;function yu(){this._array=[],this._offset=0,this._length=0}Object.defineProperties(yu.prototype,{length:{get:function(){return this._length}}});yu.prototype.enqueue=function(e){this._array.push(e),this._length++};yu.prototype.dequeue=function(){if(this._length===0)return;const e=this._array;let t=this._offset;const n=e[t];return e[t]=void 0,t++,t>10&&t*2>e.length&&(this._array=e.slice(t),t=0),this._offset=t,this._length--,n};yu.prototype.peek=function(){if(this._length!==0)return this._array[this._offset]};yu.prototype.contains=function(e){return this._array.indexOf(e)!==-1};yu.prototype.clear=function(){this._array.length=this._offset=this._length=0};yu.prototype.sort=function(e){this._offset>0&&(this._array=this._array.slice(this._offset),this._offset=0),this._array.sort(e)};const Ii={};Ii.computeHierarchyPackedLength=function(e,t){let n=0;const i=[e];for(;i.length>0;){const o=i.pop();if(!c(o))continue;n+=2;const r=o.positions,s=o.holes;if(c(r)&&r.length>0&&(n+=r.length*t.packedLength),c(s)){const a=s.length;for(let l=0;l<a;++l)i.push(s[l])}}return n};Ii.packPolygonHierarchy=function(e,t,n,i){const o=[e];for(;o.length>0;){const r=o.pop();if(!c(r))continue;const s=r.positions,a=r.holes;if(t[n++]=c(s)?s.length:0,t[n++]=c(a)?a.length:0,c(s)){const l=s.length;for(let u=0;u<l;++u,n+=i.packedLength)i.pack(s[u],t,n)}if(c(a)){const l=a.length;for(let u=0;u<l;++u)o.push(a[u])}}return n};Ii.unpackPolygonHierarchy=function(e,t,n){const i=e[t++],o=e[t++],r=new Array(i),s=o>0?new Array(o):void 0;for(let a=0;a<i;++a,t+=n.packedLength)r[a]=n.unpack(e,t);for(let a=0;a<o;++a)s[a]=Ii.unpackPolygonHierarchy(e,t,n),t=s[a].startingIndex,delete s[a].startingIndex;return{positions:r,holes:s,startingIndex:t}};const bf=new H;function nH(e,t,n,i){return H.subtract(t,e,bf),H.multiplyByScalar(bf,n/i,bf),H.add(e,bf,bf),[bf.x,bf.y]}const Vd=new d;function Afe(e,t,n,i){return d.subtract(t,e,Vd),d.multiplyByScalar(Vd,n/i,Vd),d.add(e,Vd,Vd),[Vd.x,Vd.y,Vd.z]}Ii.subdivideLineCount=function(e,t,n){const o=d.distance(e,t)/n,r=Math.max(0,Math.ceil(R.log2(o)));return Math.pow(2,r)};const OC=new he,LC=new he,xfe=new he,Cfe=new d,Ux=new vr;Ii.subdivideRhumbLineCount=function(e,t,n,i){const o=e.cartesianToCartographic(t,OC),r=e.cartesianToCartographic(n,LC),a=new vr(o,r,e).surfaceDistance/i,l=Math.max(0,Math.ceil(R.log2(a)));return Math.pow(2,l)};Ii.subdivideTexcoordLine=function(e,t,n,i,o,r){const s=Ii.subdivideLineCount(n,i,o),a=H.distance(e,t),l=a/s,u=r;u.length=s*2;let h=0;for(let f=0;f<s;f++){const _=nH(e,t,f*l,a);u[h++]=_[0],u[h++]=_[1]}return u};Ii.subdivideLine=function(e,t,n,i){const o=Ii.subdivideLineCount(e,t,n),r=d.distance(e,t),s=r/o;c(i)||(i=[]);const a=i;a.length=o*3;let l=0;for(let u=0;u<o;u++){const h=Afe(e,t,u*s,r);a[l++]=h[0],a[l++]=h[1],a[l++]=h[2]}return a};Ii.subdivideTexcoordRhumbLine=function(e,t,n,i,o,r,s){const a=n.cartesianToCartographic(i,OC),l=n.cartesianToCartographic(o,LC);Ux.setEndPoints(a,l);const u=Ux.surfaceDistance/r,h=Math.max(0,Math.ceil(R.log2(u))),f=Math.pow(2,h),_=H.distance(e,t),g=_/f,m=s;m.length=f*2;let b=0;for(let T=0;T<f;T++){const x=nH(e,t,T*g,_);m[b++]=x[0],m[b++]=x[1]}return m};Ii.subdivideRhumbLine=function(e,t,n,i,o){const r=e.cartesianToCartographic(t,OC),s=e.cartesianToCartographic(n,LC),a=new vr(r,s,e),l=a.surfaceDistance/i,u=Math.max(0,Math.ceil(R.log2(l))),h=Math.pow(2,u),f=a.surfaceDistance/h;c(o)||(o=[]);const _=o;_.length=h*3;let g=0;for(let m=0;m<h;m++){const b=a.interpolateUsingSurfaceDistance(m*f,xfe),T=e.cartographicToCartesian(b,Cfe);_[g++]=T.x,_[g++]=T.y,_[g++]=T.z}return _};const Efe=new d,wfe=new d,Sfe=new d,vfe=new d;Ii.scaleToGeodeticHeightExtruded=function(e,t,n,i,o){i=y(i,ae.WGS84);const r=Efe;let s=wfe;const a=Sfe;let l=vfe;if(c(e)&&c(e.attributes)&&c(e.attributes.position)){const u=e.attributes.position.values,h=u.length/2;for(let f=0;f<h;f+=3)d.fromArray(u,f,a),i.geodeticSurfaceNormal(a,r),l=i.scaleToGeodeticSurface(a,l),s=d.multiplyByScalar(r,n,s),s=d.add(l,s,s),u[f+h]=s.x,u[f+1+h]=s.y,u[f+2+h]=s.z,o&&(l=d.clone(a,l)),s=d.multiplyByScalar(r,t,s),s=d.add(l,s,s),u[f]=s.x,u[f+1]=s.y,u[f+2]=s.z}return e};Ii.polygonOutlinesFromHierarchy=function(e,t,n){const i=[],o=new yu;o.enqueue(e);let r,s,a;for(;o.length!==0;){const l=o.dequeue();let u=l.positions;if(t)for(a=u.length,r=0;r<a;r++)n.scaleToGeodeticSurface(u[r],u[r]);if(u=gs(u,d.equalsEpsilon,!0),u.length<3)continue;const h=l.holes?l.holes.length:0;for(r=0;r<h;r++){const f=l.holes[r];let _=f.positions;if(t)for(a=_.length,s=0;s<a;++s)n.scaleToGeodeticSurface(_[s],_[s]);if(_=gs(_,d.equalsEpsilon,!0),_.length<3)continue;i.push(_);let g=0;for(c(f.holes)&&(g=f.holes.length),s=0;s<g;s++)o.enqueue(f.holes[s])}i.push(u)}return i};const Ife=new he;function Dfe(e,t,n){const i=n.cartesianToCartographic(e,OC),o=n.cartesianToCartographic(t,LC);if(Math.sign(i.latitude)===Math.sign(o.latitude))return;Ux.setEndPoints(i,o);const r=Ux.findIntersectionWithLatitude(0,Ife);if(!c(r))return;let s=Math.min(i.longitude,o.longitude),a=Math.max(i.longitude,o.longitude);if(Math.abs(a-s)>R.PI){const l=s;s=a,a=l}if(!(r.longitude<s||r.longitude>a))return n.cartographicToCartesian(r)}function Pfe(e,t,n,i){if(i===cn.RHUMB)return Dfe(e,t,n);const o=Ei.lineSegmentPlane(e,t,_t.ORIGIN_XY_PLANE);if(!!c(o))return n.scaleToGeodeticSurface(o,o)}const Ofe=new he;function Lfe(e,t,n){const i=[];let o,r,s,a,l,u=0;for(;u<e.length;){o=e[u],r=e[(u+1)%e.length],s=R.sign(o.z),a=R.sign(r.z);const h=f=>t.cartesianToCartographic(f,Ofe).longitude;if(s===0)i.push({position:u,type:s,visited:!1,next:a,theta:h(o)});else if(a!==0){if(l=Pfe(o,r,t,n),++u,!c(l))continue;e.splice(u,0,l),i.push({position:u,type:s,visited:!1,next:a,theta:h(l)})}++u}return i}function iH(e,t,n,i,o,r,s){const a=[];let l=r;const u=f=>_=>_.position===f,h=[];do{const f=n[l];a.push(f);const _=i.findIndex(u(l)),g=i[_];if(!c(g)){++l;continue}const{visited:m,type:b,next:T}=g;if(g.visited=!0,b===0){if(T===0){const v=i[_-(s?1:-1)];if((v==null?void 0:v.position)===l+1)v.visited=!0;else{++l;continue}}if(!m&&s&&T>0||r===l&&!s&&T<0){++l;continue}}if(!(s?b>=0:b<=0)){++l;continue}m||h.push(l);const C=_+(s?1:-1),w=i[C];if(!c(w)){++l;continue}l=w.position}while(l<n.length&&l>=0&&l!==r&&a.length<n.length);e.splice(t,o,a);for(const f of h)t=iH(e,++t,n,i,0,f,!s);return t}Ii.splitPolygonsOnEquator=function(e,t,n,i){c(i)||(i=[]),i.splice(0,0,...e),i.length=e.length;let o=0;for(;o<i.length;){const r=i[o],s=r.slice();if(r.length<3){i[o]=s,++o;continue}const a=Lfe(s,t,n);if(s.length===r.length||a.length<=1){i[o]=s,++o;continue}a.sort((u,h)=>u.theta-h.theta);const l=s[0].z>=0;o=iH(i,o,s,a,1,0,l)}return i};Ii.polygonsFromHierarchy=function(e,t,n,i,o,r){const s=[],a=[],l=new yu;l.enqueue(e);let u=c(r);for(;l.length!==0;){const h=l.dequeue();let f=h.positions;const _=h.holes;let g,m;if(i)for(m=f.length,g=0;g<m;g++)o.scaleToGeodeticSurface(f[g],f[g]);if(t||(f=gs(f,d.equalsEpsilon,!0)),f.length<3)continue;let b=n(f);if(!c(b))continue;const T=[];let x=ai.computeWindingOrder2D(b);if(x===wc.CLOCKWISE&&(b.reverse(),f=f.slice().reverse()),u){u=!1;let N=[f];if(N=r(N,N),N.length>1){for(const k of N)l.enqueue(new PV(k,_));continue}}let C=f.slice();const w=c(_)?_.length:0,v=[];let P;for(g=0;g<w;g++){const N=_[g];let k=N.positions;if(i)for(m=k.length,P=0;P<m;++P)o.scaleToGeodeticSurface(k[P],k[P]);if(t||(k=gs(k,d.equalsEpsilon,!0)),k.length<3)continue;const M=n(k);if(!c(M))continue;x=ai.computeWindingOrder2D(M),x===wc.CLOCKWISE&&(M.reverse(),k=k.slice().reverse()),v.push(k),T.push(C.length),C=C.concat(k),b=b.concat(M);let U=0;for(c(N.holes)&&(U=N.holes.length),P=0;P<U;P++)l.enqueue(N.holes[P])}s.push({outerRing:f,holes:v}),a.push({positions:C,positions2D:b,holes:T})}return{hierarchy:s,polygons:a}};const Rfe=new H,Nfe=new d,Mfe=new _e,Ffe=new $;Ii.computeBoundingRectangle=function(e,t,n,i,o){const r=_e.fromAxisAngle(e,i,Mfe),s=$.fromQuaternion(r,Ffe);let a=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY,u=Number.POSITIVE_INFINITY,h=Number.NEGATIVE_INFINITY;const f=n.length;for(let _=0;_<f;++_){const g=d.clone(n[_],Nfe);$.multiplyByVector(s,g,g);const m=t(g,Rfe);c(m)&&(a=Math.min(a,m.x),l=Math.max(l,m.x),u=Math.min(u,m.y),h=Math.max(h,m.y))}return o.x=a,o.y=u,o.width=l-a,o.height=h-u,o};Ii.createGeometryFromPositions=function(e,t,n,i,o,r,s){let a=ai.triangulate(t.positions2D,t.holes);a.length<3&&(a=[0,1,2]);const l=t.positions,u=c(n),h=u?n.positions:void 0;if(o){const f=l.length,_=new Array(f*3);let g=0;for(let T=0;T<f;T++){const x=l[T];_[g++]=x.x,_[g++]=x.y,_[g++]=x.z}const m={attributes:{position:new Ie({componentDatatype:Z.DOUBLE,componentsPerAttribute:3,values:_})},indices:a,primitiveType:ze.TRIANGLES};u&&(m.attributes.st=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:2,values:H.packArray(h)}));const b=new Tt(m);return r.normal?ti.computeNormal(b):b}if(s===cn.GEODESIC)return ai.computeSubdivision(e,l,a,h,i);if(s===cn.RHUMB)return ai.computeRhumbLineSubdivision(e,l,a,h,i)};const GM=[],jM=[],Bfe=new d,zfe=new d;Ii.computeWallGeometry=function(e,t,n,i,o,r){let s,a,l,u,h,f,_,g,m,b=e.length,T=0,x=0;const C=c(t),w=C?t.positions:void 0;if(o)for(a=b*3*2,s=new Array(a*2),C&&(m=b*2*2,g=new Array(m*2)),l=0;l<b;l++)u=e[l],h=e[(l+1)%b],s[T]=s[T+a]=u.x,++T,s[T]=s[T+a]=u.y,++T,s[T]=s[T+a]=u.z,++T,s[T]=s[T+a]=h.x,++T,s[T]=s[T+a]=h.y,++T,s[T]=s[T+a]=h.z,++T,C&&(f=w[l],_=w[(l+1)%b],g[x]=g[x+m]=f.x,++x,g[x]=g[x+m]=f.y,++x,g[x]=g[x+m]=_.x,++x,g[x]=g[x+m]=_.y,++x);else{const M=R.chordLength(i,n.maximumRadius);let U=0;if(r===cn.GEODESIC)for(l=0;l<b;l++)U+=Ii.subdivideLineCount(e[l],e[(l+1)%b],M);else if(r===cn.RHUMB)for(l=0;l<b;l++)U+=Ii.subdivideRhumbLineCount(n,e[l],e[(l+1)%b],M);for(a=(U+b)*3,s=new Array(a*2),C&&(m=(U+b)*2,g=new Array(m*2)),l=0;l<b;l++){u=e[l],h=e[(l+1)%b];let B,S;C&&(f=w[l],_=w[(l+1)%b]),r===cn.GEODESIC?(B=Ii.subdivideLine(u,h,M,jM),C&&(S=Ii.subdivideTexcoordLine(f,_,u,h,M,GM))):r===cn.RHUMB&&(B=Ii.subdivideRhumbLine(n,u,h,M,jM),C&&(S=Ii.subdivideTexcoordRhumbLine(f,_,n,u,h,M,GM)));const D=B.length;for(let p=0;p<D;++p,++T)s[T]=B[p],s[T+a]=B[p];if(s[T]=h.x,s[T+a]=h.x,++T,s[T]=h.y,s[T+a]=h.y,++T,s[T]=h.z,s[T+a]=h.z,++T,C){const p=S.length;for(let I=0;I<p;++I,++x)g[x]=S[I],g[x+m]=S[I];g[x]=_.x,g[x+m]=_.x,++x,g[x]=_.y,g[x+m]=_.y,++x}}}b=s.length;const v=je.createTypedArray(b/3,b-e.length*6);let P=0;for(b/=6,l=0;l<b;l++){const M=l,U=M+1,B=M+b,S=B+1;u=d.fromArray(s,M*3,Bfe),h=d.fromArray(s,U*3,zfe),!d.equalsEpsilon(u,h,R.EPSILON10,R.EPSILON10)&&(v[P++]=M,v[P++]=B,v[P++]=U,v[P++]=U,v[P++]=B,v[P++]=S)}const N={attributes:new oi({position:new Ie({componentDatatype:Z.DOUBLE,componentsPerAttribute:3,values:s})}),indices:v,primitiveType:ze.TRIANGLES};return C&&(N.attributes.st=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:2,values:g})),new Tt(N)};const an=Ii;function Mn(e,t){this.position=e,c(this.position)||(this.position=new H),this.tangentPlane=t,c(this.tangentPlane)||(this.tangentPlane=Mn.NORTH_POLE_TANGENT_PLANE)}Object.defineProperties(Mn.prototype,{ellipsoid:{get:function(){return this.tangentPlane.ellipsoid}},x:{get:function(){return this.position.x}},y:{get:function(){return this.position.y}},conformalLatitude:{get:function(){const e=H.magnitude(this.position),t=2*this.ellipsoid.maximumRadius;return this.tangentPlane.plane.normal.z*(R.PI_OVER_TWO-2*Math.atan2(e,t))}},longitude:{get:function(){let e=R.PI_OVER_TWO+Math.atan2(this.y,this.x);return e>Math.PI&&(e-=R.TWO_PI),e}}});const dm=new he,Ufe=new d;Mn.prototype.getLatitude=function(e){c(e)||(e=ae.WGS84),dm.latitude=this.conformalLatitude,dm.longitude=this.longitude,dm.height=0;const t=this.ellipsoid.cartographicToCartesian(dm,Ufe);return e.cartesianToCartographic(t,dm),dm.latitude};const kfe=new nn,Vfe=new d,Hfe=new d;Mn.fromCartesian=function(e,t){A.defined("cartesian",e);const n=R.signNotZero(e.z);let i=Mn.NORTH_POLE_TANGENT_PLANE,o=Mn.SOUTH_POLE;n<0&&(i=Mn.SOUTH_POLE_TANGENT_PLANE,o=Mn.NORTH_POLE);const r=kfe;r.origin=i.ellipsoid.scaleToGeocentricSurface(e,r.origin),r.direction=d.subtract(r.origin,o,Vfe),d.normalize(r.direction,r.direction);const s=Ei.rayPlane(r,i.plane,Hfe),a=d.subtract(s,o,s),l=d.dot(i.xAxis,a),u=n*d.dot(i.yAxis,a);return c(t)?(t.position=new H(l,u),t.tangentPlane=i,t):new Mn(new H(l,u),i)};Mn.fromCartesianArray=function(e,t){A.defined("cartesians",e);const n=e.length;c(t)?t.length=n:t=new Array(n);for(let i=0;i<n;i++)t[i]=Mn.fromCartesian(e[i],t[i]);return t};Mn.clone=function(e,t){if(!!c(e))return c(t)?(t.position=e.position,t.tangentPlane=e.tangentPlane,t):new Mn(e.position,e.tangentPlane)};Mn.HALF_UNIT_SPHERE=Object.freeze(new ae(.5,.5,.5));Mn.NORTH_POLE=Object.freeze(new d(0,0,.5));Mn.SOUTH_POLE=Object.freeze(new d(0,0,-.5));Mn.NORTH_POLE_TANGENT_PLANE=Object.freeze(new Co(Mn.NORTH_POLE,Mn.HALF_UNIT_SPHERE));Mn.SOUTH_POLE_TANGENT_PLANE=Object.freeze(new Co(Mn.SOUTH_POLE,Mn.HALF_UNIT_SPHERE));const Gfe=new he,WM=new he;function jfe(e,t,n,i){const r=i.cartesianToCartographic(e,Gfe).height,s=i.cartesianToCartographic(t,WM);s.height=r,i.cartographicToCartesian(s,t);const a=i.cartesianToCartographic(n,WM);a.height=r-100,i.cartographicToCartesian(a,n)}const qM=new Re,Wfe=new d,qfe=new d,Yfe=new d,$fe=new d,Xfe=new d,Qfe=new d;let fT=new d,Gl=new d,hm=new d;const Kfe=new H,Zfe=new H,Jfe=new d,YM=new _e,epe=new $,tpe=new $;function Qw(e){const t=e.vertexFormat,n=e.geometry,i=e.shadowVolume,o=n.attributes.position.values,r=c(n.attributes.st)?n.attributes.st.values:void 0;let s=o.length;const a=e.wall,l=e.top||a,u=e.bottom||a;if(t.st||t.normal||t.tangent||t.bitangent||i){const h=e.boundingRectangle,f=e.rotationAxis,_=e.projectTo2d,g=e.ellipsoid,m=e.stRotation,b=e.perPositionHeight,T=Kfe;T.x=h.x,T.y=h.y;const x=t.st?new Float32Array(2*(s/3)):void 0;let C;t.normal&&(b&&l&&!a?C=n.attributes.normal.values:C=new Float32Array(s));const w=t.tangent?new Float32Array(s):void 0,v=t.bitangent?new Float32Array(s):void 0,P=i?new Float32Array(s):void 0;let N=0,k=0,M=qfe,U=Yfe,B=$fe,S=!0,D=epe,p=tpe;if(m!==0){let F=_e.fromAxisAngle(f,m,YM);D=$.fromQuaternion(F,D),F=_e.fromAxisAngle(f,-m,YM),p=$.fromQuaternion(F,p)}else D=$.clone($.IDENTITY,D),p=$.clone($.IDENTITY,p);let I=0,O=0;l&&u&&(I=s/2,O=s/3,s/=2);for(let F=0;F<s;F+=3){const V=d.fromArray(o,F,Jfe);if(t.st&&!c(r)){let G=$.multiplyByVector(D,V,Wfe);G=g.scaleToGeodeticSurface(G,G);const j=_([G],Zfe)[0];H.subtract(j,T,j);const W=R.clamp(j.x/h.width,0,1),X=R.clamp(j.y/h.height,0,1);u&&(x[N+O]=W,x[N+1+O]=X),l&&(x[N]=W,x[N+1]=X),N+=2}if(t.normal||t.tangent||t.bitangent||i){const G=k+1,j=k+2;if(a){if(F+3<s){const W=d.fromArray(o,F+3,Xfe);if(S){const X=d.fromArray(o,F+s,Qfe);b&&jfe(V,W,X,g),d.subtract(W,V,W),d.subtract(X,V,X),M=d.normalize(d.cross(X,W,M),M),S=!1}d.equalsEpsilon(W,V,R.EPSILON10)&&(S=!0)}(t.tangent||t.bitangent)&&(B=g.geodeticSurfaceNormal(V,B),t.tangent&&(U=d.normalize(d.cross(B,M,U),U)))}else M=g.geodeticSurfaceNormal(V,M),(t.tangent||t.bitangent)&&(b&&(fT=d.fromArray(C,k,fT),Gl=d.cross(d.UNIT_Z,fT,Gl),Gl=d.normalize($.multiplyByVector(p,Gl,Gl),Gl),t.bitangent&&(hm=d.normalize(d.cross(fT,Gl,hm),hm))),U=d.cross(d.UNIT_Z,M,U),U=d.normalize($.multiplyByVector(p,U,U),U),t.bitangent&&(B=d.normalize(d.cross(M,U,B),B)));t.normal&&(e.wall?(C[k+I]=M.x,C[G+I]=M.y,C[j+I]=M.z):u&&(C[k+I]=-M.x,C[G+I]=-M.y,C[j+I]=-M.z),(l&&!b||a)&&(C[k]=M.x,C[G]=M.y,C[j]=M.z)),i&&(a&&(M=g.geodeticSurfaceNormal(V,M)),P[k+I]=-M.x,P[G+I]=-M.y,P[j+I]=-M.z),t.tangent&&(e.wall?(w[k+I]=U.x,w[G+I]=U.y,w[j+I]=U.z):u&&(w[k+I]=-U.x,w[G+I]=-U.y,w[j+I]=-U.z),l&&(b?(w[k]=Gl.x,w[G]=Gl.y,w[j]=Gl.z):(w[k]=U.x,w[G]=U.y,w[j]=U.z))),t.bitangent&&(u&&(v[k+I]=B.x,v[G+I]=B.y,v[j+I]=B.z),l&&(b?(v[k]=hm.x,v[G]=hm.y,v[j]=hm.z):(v[k]=B.x,v[G]=B.y,v[j]=B.z))),k+=3}}t.st&&!c(r)&&(n.attributes.st=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:2,values:x})),t.normal&&(n.attributes.normal=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:3,values:C})),t.tangent&&(n.attributes.tangent=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:3,values:w})),t.bitangent&&(n.attributes.bitangent=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:3,values:v})),i&&(n.attributes.extrudeDirection=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:3,values:P}))}if(e.extrude&&c(e.offsetAttribute)){const h=o.length/3;let f=new Uint8Array(h);if(e.offsetAttribute===Kt.TOP)l&&u||a?f=f.fill(1,0,h/2):l&&(f=f.fill(1));else{const _=e.offsetAttribute===Kt.NONE?0:1;f=f.fill(_)}n.attributes.applyOffset=new Ie({componentDatatype:Z.UNSIGNED_BYTE,componentsPerAttribute:1,values:f})}return n}const $M=[];function npe(e,t,n,i,o,r,s,a,l,u){const h={walls:[]};let f;if(s||a){const C=an.createGeometryFromPositions(e,t,n,i,r,l,u),w=C.attributes.position.values,v=C.indices;let P,N;if(s&&a){const k=w.concat(w);P=k.length/3,N=je.createTypedArray(P,v.length*2),N.set(v);const M=v.length,U=P/2;for(f=0;f<M;f+=3){const B=N[f]+U,S=N[f+1]+U,D=N[f+2]+U;N[f+M]=D,N[f+1+M]=S,N[f+2+M]=B}if(C.attributes.position.values=k,r&&l.normal){const B=C.attributes.normal.values;C.attributes.normal.values=new Float32Array(k.length),C.attributes.normal.values.set(B)}if(l.st&&c(n)){const B=C.attributes.st.values;C.attributes.st.values=new Float32Array(P*2),C.attributes.st.values=B.concat(B)}C.indices=N}else if(a){for(P=w.length/3,N=je.createTypedArray(P,v.length),f=0;f<v.length;f+=3)N[f]=v[f+2],N[f+1]=v[f+1],N[f+2]=v[f];C.indices=N}h.topAndBottom=new Gt({geometry:C})}let _=o.outerRing;const g=Co.fromPoints(_,e);let m=g.projectPointsOntoPlane(_,$M),b=ai.computeWindingOrder2D(m);b===wc.CLOCKWISE&&(_=_.slice().reverse());let T=an.computeWallGeometry(_,n,e,i,r,u);h.walls.push(new Gt({geometry:T}));const x=o.holes;for(f=0;f<x.length;f++){let C=x[f];m=g.projectPointsOntoPlane(C,$M),b=ai.computeWindingOrder2D(m),b===wc.COUNTER_CLOCKWISE&&(C=C.slice().reverse()),T=an.computeWallGeometry(C,n,e,i,r,u),h.walls.push(new Gt({geometry:T}))}return h}function Us(e){if(A.typeOf.object("options",e),A.typeOf.object("options.polygonHierarchy",e.polygonHierarchy),c(e.perPositionHeight)&&e.perPositionHeight&&c(e.height))throw new E("Cannot use both options.perPositionHeight and options.height");if(c(e.arcType)&&e.arcType!==cn.GEODESIC&&e.arcType!==cn.RHUMB)throw new E("Invalid arcType. Valid options are ArcType.GEODESIC and ArcType.RHUMB.");const t=e.polygonHierarchy,n=y(e.vertexFormat,Ee.DEFAULT),i=y(e.ellipsoid,ae.WGS84),o=y(e.granularity,R.RADIANS_PER_DEGREE),r=y(e.stRotation,0),s=e.textureCoordinates,a=y(e.perPositionHeight,!1),l=a&&c(e.extrudedHeight);let u=y(e.height,0),h=y(e.extrudedHeight,u);if(!l){const f=Math.max(u,h);h=Math.min(u,h),u=f}this._vertexFormat=Ee.clone(n),this._ellipsoid=ae.clone(i),this._granularity=o,this._stRotation=r,this._height=u,this._extrudedHeight=h,this._closeTop=y(e.closeTop,!0),this._closeBottom=y(e.closeBottom,!0),this._polygonHierarchy=t,this._perPositionHeight=a,this._perPositionHeightExtrude=l,this._shadowVolume=y(e.shadowVolume,!1),this._workerName="createPolygonGeometry",this._offsetAttribute=e.offsetAttribute,this._arcType=y(e.arcType,cn.GEODESIC),this._rectangle=void 0,this._textureCoordinateRotationPoints=void 0,this._textureCoordinates=s,this.packedLength=an.computeHierarchyPackedLength(t,d)+ae.packedLength+Ee.packedLength+(s?an.computeHierarchyPackedLength(s,H):1)+12}Us.fromPositions=function(e){e=y(e,y.EMPTY_OBJECT),A.defined("options.positions",e.positions);const t={polygonHierarchy:{positions:e.positions},height:e.height,extrudedHeight:e.extrudedHeight,vertexFormat:e.vertexFormat,stRotation:e.stRotation,ellipsoid:e.ellipsoid,granularity:e.granularity,perPositionHeight:e.perPositionHeight,closeTop:e.closeTop,closeBottom:e.closeBottom,offsetAttribute:e.offsetAttribute,arcType:e.arcType,textureCoordinates:e.textureCoordinates};return new Us(t)};Us.pack=function(e,t,n){return A.typeOf.object("value",e),A.defined("array",t),n=y(n,0),n=an.packPolygonHierarchy(e._polygonHierarchy,t,n,d),ae.pack(e._ellipsoid,t,n),n+=ae.packedLength,Ee.pack(e._vertexFormat,t,n),n+=Ee.packedLength,t[n++]=e._height,t[n++]=e._extrudedHeight,t[n++]=e._granularity,t[n++]=e._stRotation,t[n++]=e._perPositionHeightExtrude?1:0,t[n++]=e._perPositionHeight?1:0,t[n++]=e._closeTop?1:0,t[n++]=e._closeBottom?1:0,t[n++]=e._shadowVolume?1:0,t[n++]=y(e._offsetAttribute,-1),t[n++]=e._arcType,c(e._textureCoordinates)?n=an.packPolygonHierarchy(e._textureCoordinates,t,n,H):t[n++]=-1,t[n++]=e.packedLength,t};const ipe=ae.clone(ae.UNIT_SPHERE),ope=new Ee,rpe={polygonHierarchy:{}};Us.unpack=function(e,t,n){A.defined("array",e),t=y(t,0);const i=an.unpackPolygonHierarchy(e,t,d);t=i.startingIndex,delete i.startingIndex;const o=ae.unpack(e,t,ipe);t+=ae.packedLength;const r=Ee.unpack(e,t,ope);t+=Ee.packedLength;const s=e[t++],a=e[t++],l=e[t++],u=e[t++],h=e[t++]===1,f=e[t++]===1,_=e[t++]===1,g=e[t++]===1,m=e[t++]===1,b=e[t++],T=e[t++],x=e[t]===-1?void 0:an.unpackPolygonHierarchy(e,t,H);c(x)?(t=x.startingIndex,delete x.startingIndex):t++;const C=e[t++];return c(n)||(n=new Us(rpe)),n._polygonHierarchy=i,n._ellipsoid=ae.clone(o,n._ellipsoid),n._vertexFormat=Ee.clone(r,n._vertexFormat),n._height=s,n._extrudedHeight=a,n._granularity=l,n._stRotation=u,n._perPositionHeightExtrude=h,n._perPositionHeight=f,n._closeTop=_,n._closeBottom=g,n._shadowVolume=m,n._offsetAttribute=b===-1?void 0:b,n._arcType=T,n._textureCoordinates=x,n.packedLength=C,n};const spe=new H,ape=new H,cpe=new Mn;function XM(e,t,n,i,o,r){const s=e.longitude,a=s>=0?s:s+R.TWO_PI;o.westOverIdl=Math.min(o.westOverIdl,a),o.eastOverIdl=Math.max(o.eastOverIdl,a),r.west=Math.min(r.west,s),r.east=Math.max(r.east,s);const l=e.getLatitude(n);let u=l;if(r.south=Math.min(r.south,l),r.north=Math.max(r.north,l),i!==cn.RHUMB){const _=H.subtract(t.position,e.position,spe),g=H.dot(t.position,_)/H.dot(_,_);if(g>0&&g<1){const m=H.add(t.position,H.multiplyByScalar(_,-g,_),ape),b=Mn.clone(t,cpe);b.position=m;const T=b.getLatitude(n);r.south=Math.min(r.south,T),r.north=Math.max(r.north,T),Math.abs(l)>Math.abs(T)&&(u=T)}}const h=t.x*e.y-e.x*t.y;let f=Math.sign(h);f!==0&&(f*=H.angleBetween(t.position,e.position)),u>=0&&(o.northAngle+=f),u<=0&&(o.southAngle+=f)}const QM=new Mn,lpe=new Mn,Ka={northAngle:0,southAngle:0,westOverIdl:0,eastOverIdl:0};Us.computeRectangleFromPositions=function(e,t,n,i){if(A.defined("positions",e),c(i)||(i=new ce),e.length<3)return i;i.west=Number.POSITIVE_INFINITY,i.east=Number.NEGATIVE_INFINITY,i.south=Number.POSITIVE_INFINITY,i.north=Number.NEGATIVE_INFINITY,Ka.northAngle=0,Ka.southAngle=0,Ka.westOverIdl=Number.POSITIVE_INFINITY,Ka.eastOverIdl=Number.NEGATIVE_INFINITY;const o=e.length;let r=Mn.fromCartesian(e[0],lpe);for(let s=1;s<o;s++){const a=Mn.fromCartesian(e[s],QM);XM(a,r,t,n,Ka,i),r=Mn.clone(a,r)}return XM(Mn.fromCartesian(e[0],QM),r,t,n,Ka,i),i.east-i.west>Ka.eastOverIdl-Ka.westOverIdl&&(i.west=Ka.westOverIdl,i.east=Ka.eastOverIdl,i.east>R.PI&&(i.east=i.east-R.TWO_PI),i.west>R.PI&&(i.west=i.west-R.TWO_PI)),R.equalsEpsilon(Math.abs(Ka.northAngle),R.TWO_PI,R.EPSILON10)&&(i.north=R.PI_OVER_TWO,i.east=R.PI,i.west=-R.PI),R.equalsEpsilon(Math.abs(Ka.southAngle),R.TWO_PI,R.EPSILON10)&&(i.south=-R.PI_OVER_TWO,i.east=R.PI,i.west=-R.PI),i};const upe=new Mn;function dpe(e,t,n){return e.height>=R.PI||e.width>=R.PI?Mn.fromCartesian(t[0],upe).tangentPlane:Co.fromPoints(t,n)}const oH=new he;function hpe(e,t,n){return(i,o)=>{if(e.height>=R.PI||e.width>=R.PI){if(e.south<0&&e.north>0){c(o)||(o=[]);for(let s=0;s<i.length;++s){const a=n.cartesianToCartographic(i[s],oH);o[s]=new H(a.longitude/R.PI,a.latitude/R.PI_OVER_TWO)}return o.length=i.length,o}return Mn.fromCartesianArray(i,o)}return Co.fromPoints(t,n).projectPointsOntoPlane(i,o)}}function fpe(e,t,n){if(e.height>=R.PI||e.width>=R.PI)return(o,r)=>{if(e.south<0&&e.north>0){const s=n.cartesianToCartographic(o,oH);return c(r)||(r=new H),r.x=s.longitude/R.PI,r.y=s.latitude/R.PI_OVER_TWO,r}return Mn.fromCartesian(o,r)};const i=Co.fromPoints(t,n);return(o,r)=>i.projectPointsOntoPlane(o,r)}function ppe(e,t,n,i){return(o,r)=>!i&&(e.height>=R.PI_OVER_TWO||e.width>=2*R.PI_OVER_THREE)?an.splitPolygonsOnEquator(o,t,n,r):o}function mpe(e,t,n,i){if(t.height>=R.PI||t.width>=R.PI)return Re.fromRectangle(t,void 0,qM);const o=e,r=Co.fromPoints(o,n);return an.computeBoundingRectangle(r.plane.normal,r.projectPointOntoPlane.bind(r),o,i,qM)}Us.createGeometry=function(e){const t=e._vertexFormat,n=e._ellipsoid,i=e._granularity,o=e._stRotation,r=e._polygonHierarchy,s=e._perPositionHeight,a=e._closeTop,l=e._closeBottom,u=e._arcType,h=e._textureCoordinates,f=c(h),_=r.positions;if(_.length<3)return;const g=e.rectangle,m=an.polygonsFromHierarchy(r,f,hpe(g,_,n),!s,n,ppe(g,n,u,s)),b=m.hierarchy,T=m.polygons,x=function(I){return I},C=f?an.polygonsFromHierarchy(h,!0,x,!1,n).polygons:void 0;if(b.length===0)return;const w=b[0].outerRing,v=mpe(w,g,n,o),P=[],N=e._height,k=e._extrudedHeight,M=e._perPositionHeightExtrude||!R.equalsEpsilon(N,k,0,R.EPSILON2),U={perPositionHeight:s,vertexFormat:t,geometry:void 0,rotationAxis:dpe(g,w,n).plane.normal,projectTo2d:fpe(g,w,n),boundingRectangle:v,ellipsoid:n,stRotation:o,textureCoordinates:void 0,bottom:!1,top:!0,wall:!1,extrude:!1,arcType:u};let B;if(M)for(U.extrude=!0,U.top=a,U.bottom=l,U.shadowVolume=e._shadowVolume,U.offsetAttribute=e._offsetAttribute,B=0;B<T.length;B++){const I=npe(n,T[B],f?C[B]:void 0,i,b[B],s,a,l,t,u);let O;a&&l?(O=I.topAndBottom,U.geometry=an.scaleToGeodeticHeightExtruded(O.geometry,N,k,n,s)):a?(O=I.topAndBottom,O.geometry.attributes.position.values=ai.scaleToGeodeticHeight(O.geometry.attributes.position.values,N,n,!s),U.geometry=O.geometry):l&&(O=I.topAndBottom,O.geometry.attributes.position.values=ai.scaleToGeodeticHeight(O.geometry.attributes.position.values,k,n,!0),U.geometry=O.geometry),(a||l)&&(U.wall=!1,O.geometry=Qw(U),P.push(O));const F=I.walls;U.wall=!0;for(let V=0;V<F.length;V++){const G=F[V];U.geometry=an.scaleToGeodeticHeightExtruded(G.geometry,N,k,n,s),G.geometry=Qw(U),P.push(G)}}else for(B=0;B<T.length;B++){const I=new Gt({geometry:an.createGeometryFromPositions(n,T[B],f?C[B]:void 0,i,s,t,u)});if(I.geometry.attributes.position.values=ai.scaleToGeodeticHeight(I.geometry.attributes.position.values,N,n,!s),U.geometry=I.geometry,I.geometry=Qw(U),c(e._offsetAttribute)){const O=I.geometry.attributes.position.values.length,F=e._offsetAttribute===Kt.NONE?0:1,V=new Uint8Array(O/3).fill(F);I.geometry.attributes.applyOffset=new Ie({componentDatatype:Z.UNSIGNED_BYTE,componentsPerAttribute:1,values:V})}P.push(I)}const S=ti.combineInstances(P)[0];S.attributes.position.values=new Float64Array(S.attributes.position.values),S.indices=je.createTypedArray(S.attributes.position.values.length/3,S.indices);const D=S.attributes,p=se.fromVertices(D.position.values);return t.position||delete D.position,new Tt({attributes:D,indices:S.indices,primitiveType:S.primitiveType,boundingSphere:p,offsetAttribute:e._offsetAttribute})};Us.createShadowVolume=function(e,t,n){const i=e._granularity,o=e._ellipsoid,r=t(i,o),s=n(i,o);return new Us({polygonHierarchy:e._polygonHierarchy,ellipsoid:o,stRotation:e._stRotation,granularity:i,perPositionHeight:!1,extrudedHeight:r,height:s,vertexFormat:Ee.POSITION_ONLY,shadowVolume:!0,arcType:e._arcType})};function _pe(e){const t=-e._stRotation;if(t===0)return[0,0,0,1,1,0];const n=e._ellipsoid,i=e._polygonHierarchy.positions,o=e.rectangle;return Tt._textureCoordinateRotationPoints(i,t,n,o)}Object.defineProperties(Us.prototype,{rectangle:{get:function(){if(!c(this._rectangle)){const e=this._polygonHierarchy.positions;this._rectangle=Us.computeRectangleFromPositions(e,this._ellipsoid,this._arcType)}return this._rectangle}},textureCoordinateRotationPoints:{get:function(){return c(this._textureCoordinateRotationPoints)||(this._textureCoordinateRotationPoints=_pe(this)),this._textureCoordinateRotationPoints}}});function Nh(e){A.typeOf.object("options",e),A.typeOf.object("options.positions",e.positions),A.typeOf.number.greaterThanOrEquals("options.positions.length",e.positions.length,3),this._ellipsoid=y(e.ellipsoid,ae.WGS84),this._positions=[...e.positions]}Object.defineProperties(Nh.prototype,{length:{get:function(){return this._positions.length}},positions:{get:function(){return this._positions}},ellipsoid:{get:function(){return this._ellipsoid}}});Nh.clone=function(e,t){return A.typeOf.object("polygon",e),c(t)?(t._ellipsoid=e.ellipsoid,t._positions.length=0,t._positions.push(...e.positions),t):new Nh({positions:e.positions,ellipsoid:e.ellipsoid})};Nh.equals=function(e,t){return A.typeOf.object("left",e),A.typeOf.object("right",t),e.ellipsoid.equals(t.ellipsoid)&&e.positions===t.positions};Nh.prototype.computeRectangle=function(e){return Us.computeRectangleFromPositions(this.positions,this.ellipsoid,void 0,e)};const gpe=new ce,KM=new d;Nh.prototype.computeSphericalExtents=function(e){c(e)||(e=new ce);const t=this.computeRectangle(gpe);let n=he.toCartesian(ce.southwest(t),this.ellipsoid,KM),i=Math.sqrt(n.x*n.x+n.y*n.y),o=R.fastApproximateAtan2(i,n.z),r=R.fastApproximateAtan2(n.x,n.y);return e.south=o,e.west=r,n=he.toCartesian(ce.northeast(t),this.ellipsoid,KM),i=Math.sqrt(n.x*n.x+n.y*n.y),o=R.fastApproximateAtan2(i,n.z),r=R.fastApproximateAtan2(n.x,n.y),e.north=o,e.east=r,e};const ype=`in vec2 v_textureCoordinates;
|
|
|
|
uniform int u_polygonsLength;
|
|
uniform int u_extentsLength;
|
|
uniform highp sampler2D u_polygonTexture;
|
|
uniform highp sampler2D u_extentsTexture;
|
|
|
|
int getPolygonIndex(float dimension, vec2 coord) {
|
|
vec2 uv = coord.xy * dimension;
|
|
return int(floor(uv.y) * dimension + floor(uv.x));
|
|
}
|
|
|
|
vec2 getLookupUv(ivec2 dimensions, int i) {
|
|
int pixY = i / dimensions.x;
|
|
int pixX = i - (pixY * dimensions.x);
|
|
float pixelWidth = 1.0 / float(dimensions.x);
|
|
float pixelHeight = 1.0 / float(dimensions.y);
|
|
float u = (float(pixX) + 0.5) * pixelWidth; // sample from center of pixel
|
|
float v = (float(pixY) + 0.5) * pixelHeight;
|
|
return vec2(u, v);
|
|
}
|
|
|
|
vec4 getExtents(int i) {
|
|
return texture(u_extentsTexture, getLookupUv(textureSize(u_extentsTexture, 0), i));
|
|
}
|
|
|
|
ivec2 getPositionsLengthAndExtentsIndex(int i) {
|
|
vec2 uv = getLookupUv(textureSize(u_polygonTexture, 0), i);
|
|
vec4 value = texture(u_polygonTexture, uv);
|
|
return ivec2(int(value.x), int(value.y));
|
|
}
|
|
|
|
vec2 getPolygonPosition(int i) {
|
|
vec2 uv = getLookupUv(textureSize(u_polygonTexture, 0), i);
|
|
return texture(u_polygonTexture, uv).xy;
|
|
}
|
|
|
|
vec2 getCoordinates(vec2 textureCoordinates, vec4 extents) {
|
|
float latitude = mix(extents.x, extents.x + 1.0 / extents.z, textureCoordinates.y);
|
|
float longitude = mix(extents.y, extents.y + 1.0 / extents.w, textureCoordinates.x);
|
|
return vec2(latitude, longitude);
|
|
}
|
|
|
|
void main() {
|
|
int lastPolygonIndex = 0;
|
|
out_FragColor = vec4(1.0);
|
|
|
|
// Get the relevant region of the texture
|
|
float dimension = float(u_extentsLength);
|
|
if (u_extentsLength > 2) {
|
|
dimension = ceil(log2(float(u_extentsLength)));
|
|
}
|
|
int regionIndex = getPolygonIndex(dimension, v_textureCoordinates);
|
|
|
|
for (int polygonIndex = 0; polygonIndex < u_polygonsLength; polygonIndex++) {
|
|
ivec2 positionsLengthAndExtents = getPositionsLengthAndExtentsIndex(lastPolygonIndex);
|
|
int positionsLength = positionsLengthAndExtents.x;
|
|
int polygonExtentsIndex = positionsLengthAndExtents.y;
|
|
lastPolygonIndex += 1;
|
|
|
|
// Only compute signed distance for the relevant part of the atlas
|
|
if (polygonExtentsIndex == regionIndex) {
|
|
float clipAmount = czm_infinity;
|
|
vec4 extents = getExtents(polygonExtentsIndex);
|
|
vec2 textureOffset = vec2(mod(float(polygonExtentsIndex), dimension), floor(float(polygonExtentsIndex) / dimension)) / dimension;
|
|
vec2 p = getCoordinates((v_textureCoordinates - textureOffset) * dimension, extents);
|
|
float s = 1.0;
|
|
|
|
// Check each edge for absolute distance
|
|
for (int i = 0, j = positionsLength - 1; i < positionsLength; j = i, i++) {
|
|
vec2 a = getPolygonPosition(lastPolygonIndex + i);
|
|
vec2 b = getPolygonPosition(lastPolygonIndex + j);
|
|
|
|
vec2 ab = b - a;
|
|
vec2 pa = p - a;
|
|
float t = dot(pa, ab) / dot(ab, ab);
|
|
t = clamp(t, 0.0, 1.0);
|
|
|
|
vec2 pq = pa - t * ab;
|
|
float d = length(pq);
|
|
|
|
// Inside / outside computation to determine sign
|
|
bvec3 cond = bvec3(p.y >= a.y,
|
|
p.y < b.y,
|
|
ab.x * pa.y > ab.y * pa.x);
|
|
if (all(cond) || all(not(cond))) s = -s;
|
|
if (abs(d) < abs(clipAmount)) {
|
|
clipAmount = d;
|
|
}
|
|
}
|
|
|
|
// Normalize the range to [0,1]
|
|
vec4 result = (s * vec4(clipAmount * length(extents.zw))) / 2.0 + 0.5;
|
|
// In the case where we've iterated through multiple polygons, take the minimum
|
|
out_FragColor = min(out_FragColor, result);
|
|
}
|
|
|
|
lastPolygonIndex += positionsLength;
|
|
}
|
|
}`;function Di(e){e=y(e,y.EMPTY_OBJECT),this._polygons=[],this._totalPositions=0,this.enabled=y(e.enabled,!0),this.inverse=y(e.inverse,!1),this.polygonAdded=new Le,this.polygonRemoved=new Le,this._owner=void 0,this._float32View=void 0,this._extentsFloat32View=void 0,this._extentsCount=0,this._polygonsTexture=void 0,this._extentsTexture=void 0,this._signedDistanceTexture=void 0,this._signedDistanceComputeCommand=void 0;const t=e.polygons;if(c(t)){const n=t.length;for(let i=0;i<n;++i)this._polygons.push(t[i])}}Object.defineProperties(Di.prototype,{length:{get:function(){return this._polygons.length}},totalPositions:{get:function(){return this._totalPositions}},extentsTexture:{get:function(){return this._extentsTexture}},extentsCount:{get:function(){return this._extentsCount}},pixelsNeededForExtents:{get:function(){return this.length}},pixelsNeededForPolygonPositions:{get:function(){return this.totalPositions+this.length}},clippingTexture:{get:function(){return this._signedDistanceTexture}},owner:{get:function(){return this._owner}},clippingPolygonsState:{get:function(){return this.inverse?-this.extentsCount:this.extentsCount}}});Di.prototype.add=function(e){A.typeOf.object("polygon",e);const t=this._polygons.length;return this._polygons.push(e),this.polygonAdded.raiseEvent(e,t),e};Di.prototype.get=function(e){return A.typeOf.number("index",e),this._polygons[e]};Di.prototype.contains=function(e){return A.typeOf.object("polygon",e),this._polygons.some(t=>Nh.equals(t,e))};Di.prototype.remove=function(e){A.typeOf.object("polygon",e);const t=this._polygons,n=t.findIndex(i=>Nh.equals(i,e));return n===-1?!1:(t.splice(n,1),this.polygonRemoved.raiseEvent(e,n),!0)};const bpe=new ce;function Tpe(e){const t=[],n=[],i=e.length;for(let r=0;r<i;++r){const a=e[r].computeSphericalExtents();let l=Math.max(a.height*2.5,.001),u=Math.max(a.width*2.5,.001),h=ce.clone(a);h.south-=l,h.west-=u,h.north+=l,h.east+=u,h.south=Math.max(h.south,-Math.PI),h.west=Math.max(h.west,-Math.PI),h.north=Math.min(h.north,Math.PI),h.east=Math.min(h.east,Math.PI);const f=[r];for(let _=0;_<t.length;++_){const g=t[_];if(c(g)&&c(ce.simpleIntersection(g,h))&&!ce.equals(g,h)){const m=n[_];f.push(...m),m.reduce((b,T)=>ce.union(e[T].computeSphericalExtents(bpe),b,b),a),t[_]=void 0,n[_]=void 0,l=Math.max(a.height*2.5,.001),u=Math.max(a.width*2.5,.001),h=ce.clone(a,h),h.south-=l,h.west-=u,h.north+=l,h.east+=u,h.south=Math.max(h.south,-Math.PI),h.west=Math.max(h.west,-Math.PI),h.north=Math.min(h.north,Math.PI),h.east=Math.min(h.east,Math.PI),_=-1}}t.push(h),n.push(f)}const o=new Map;return n.filter(c).forEach((r,s)=>r.forEach(a=>o.set(a,s))),{extentsList:t.filter(c),extentsIndexByPolygon:o}}Di.prototype.removeAll=function(){const e=this._polygons,t=e.length;for(let n=0;n<t;++n){const i=e[n];this.polygonRemoved.raiseEvent(i,n)}this._polygons=[]};function Ape(e){const t=e._float32View,n=e._extentsFloat32View,i=e._polygons,{extentsList:o,extentsIndexByPolygon:r}=Tpe(i);let s=0;for(const[l,u]of i.entries()){const h=u.length;t[s++]=h,t[s++]=r.get(l);for(let f=0;f<h;++f){const _=u.positions[f],g=Math.hypot(_.x,_.y),m=R.fastApproximateAtan2(g,_.z),b=R.fastApproximateAtan2(_.x,_.y);t[s++]=m,t[s++]=b}}let a=0;for(const l of o){const u=1/(l.east-l.west),h=1/(l.north-l.south);n[a++]=l.south,n[a++]=l.west,n[a++]=h,n[a++]=u}e._extentsCount=o.length}const Kw=new H;Di.prototype.update=function(e){const t=e.context;if(!Di.isSupported(e))throw new Te("ClippingPolygonCollections are only supported for WebGL 2.");const n=this._polygons.reduce((s,a)=>s+a.length,0);if(n===this.totalPositions||(this._totalPositions=n,this.length===0))return;c(this._signedDistanceComputeCommand)&&(this._signedDistanceComputeCommand.canceled=!0,this._signedDistanceComputeCommand=void 0);let i=this._polygonsTexture,o=this._extentsTexture,r=this._signedDistanceTexture;if(c(i)){const s=i.width*i.height;(s<this.pixelsNeededForPolygonPositions||this.pixelsNeededForPolygonPositions<.25*s)&&(i.destroy(),i=void 0,this._polygonsTexture=void 0)}if(!c(i)){const s=Di.getTextureResolution(i,this.pixelsNeededForPolygonPositions,Kw);i=new xt({context:t,width:s.x,height:s.y,pixelFormat:Ve.RG,pixelDatatype:Me.FLOAT,sampler:un.NEAREST,flipY:!1}),this._float32View=new Float32Array(s.x*s.y*2),this._polygonsTexture=i}if(c(o)){const s=o.width*o.height;(s<this.pixelsNeededForExtents||this.pixelsNeededForExtents<.25*s)&&(o.destroy(),o=void 0,this._extentsTexture=void 0)}if(!c(o)){const s=Di.getTextureResolution(o,this.pixelsNeededForExtents,Kw);o=new xt({context:t,width:s.x,height:s.y,pixelFormat:Ve.RGBA,pixelDatatype:Me.FLOAT,sampler:un.NEAREST,flipY:!1}),this._extentsFloat32View=new Float32Array(s.x*s.y*4),this._extentsTexture=o}if(Ape(this),o.copyFrom({source:{width:o.width,height:o.height,arrayBufferView:this._extentsFloat32View}}),i.copyFrom({source:{width:i.width,height:i.height,arrayBufferView:this._float32View}}),!c(r)){const s=Di.getClippingDistanceTextureResolution(this,Kw);r=new xt({context:t,width:s.x,height:s.y,pixelFormat:t.webgl2?Ve.RED:Ve.LUMINANCE,pixelDatatype:Me.FLOAT,sampler:new un({wrapS:Fn.CLAMP_TO_EDGE,wrapT:Fn.CLAMP_TO_EDGE,minificationFilter:en.LINEAR,magnificationFilter:Yo.LINEAR}),flipY:!1}),this._signedDistanceTexture=r}this._signedDistanceComputeCommand=xpe(this)};Di.prototype.queueCommands=function(e){c(this._signedDistanceComputeCommand)&&e.commandList.push(this._signedDistanceComputeCommand)};function xpe(e){const t=e._polygonsTexture,n=e._extentsTexture;return new A_({fragmentShaderSource:ype,outputTexture:e._signedDistanceTexture,uniformMap:{u_polygonsLength:function(){return e.length},u_extentsLength:function(){return e.extentsCount},u_extentsTexture:function(){return n},u_polygonTexture:function(){return t}},persists:!1,owner:e,postExecute:()=>{e._signedDistanceComputeCommand=void 0}})}const ZM=new ce,Cpe=new ce;Di.prototype.computeIntersectionWithBoundingVolume=function(e,t){var r;const n=this._polygons,i=n.length;let o=Bt.OUTSIDE;this.inverse&&(o=Bt.INSIDE);for(let s=0;s<i;++s){const l=n[s].computeRectangle();let u=e.rectangle;if(!c(u)&&c((r=e.boundingVolume)==null?void 0:r.computeCorners)){const f=e.boundingVolume.computeCorners();u=ce.fromCartesianArray(f,t,ZM)}c(u)||(u=ce.fromBoundingSphere(e.boundingSphere,t,ZM));const h=ce.simpleIntersection(u,l,Cpe);c(h)&&(o=Bt.INTERSECTING)}return o};Di.setOwner=function(e,t,n){if(e!==t[n]&&(t[n]=t[n]&&t[n].destroy(),c(e))){if(c(e._owner))throw new E("ClippingPolygonCollection should only be assigned to one object");e._owner=t,t[n]=e}};Di.isSupported=function(e){return e==null?void 0:e.context.webgl2};Di.getTextureResolution=function(e,t,n){if(c(e))return n.x=e.width,n.y=e.height,n;const i=pt.maximumTextureSize;return n.x=Math.min(t,i),n.y=Math.ceil(t/n.x),n.y*=2,n};Di.getClippingDistanceTextureResolution=function(e,t){const n=e.signedDistanceTexture;return c(n)?(t.x=n.width,t.y=n.height,t):(t.x=Math.min(pt.maximumTextureSize,4096),t.y=Math.min(pt.maximumTextureSize,4096),t)};Di.getClippingExtentsTextureResolution=function(e,t){const n=e.extentsTexture;return c(n)?(t.x=n.width,t.y=n.height,t):Di.getTextureResolution(n,e.pixelsNeededForExtents,t)};Di.prototype.isDestroyed=function(){return!1};Di.prototype.destroy=function(){return c(this._signedDistanceComputeCommand)&&(this._signedDistanceComputeCommand.canceled=!0),this._polygonsTexture=this._polygonsTexture&&this._polygonsTexture.destroy(),this._extentsTexture=this._extentsTexture&&this._extentsTexture.destroy(),this._signedDistanceTexture=this._signedDistanceTexture&&this._signedDistanceTexture.destroy(),ve(this)};const fy={HIGHLIGHT:0,REPLACE:1,MIX:2};fy.getColorBlend=function(e,t){if(e===fy.HIGHLIGHT)return 0;if(e===fy.REPLACE)return 1;if(e===fy.MIX)return R.clamp(t,R.EPSILON4,1)};const RC=Object.freeze(fy),Epe={XTRANSLATE:"xTranslate",YTRANSLATE:"yTranslate",ZTRANSLATE:"zTranslate",XROTATE:"xRotate",YROTATE:"yRotate",ZROTATE:"zRotate",XSCALE:"xScale",YSCALE:"yScale",ZSCALE:"zScale",UNIFORMSCALE:"uniformScale"},Zc=Object.freeze(Epe),wpe={STEP:0,LINEAR:1,CUBICSPLINE:2},r_=Object.freeze(wpe),rH={};function Bp(e){A.typeOf.number.greaterThan("options.count",e.count,0),A.typeOf.object("options.properties",e.properties),this._count=e.count,this._properties=Je(e.properties,!0)}Bp.prototype.hasProperty=function(e){return Rt.hasProperty(e,this._properties,rH)};Bp.prototype.getPropertyIds=function(e){return Rt.getPropertyIds(this._properties,rH,e)};Bp.prototype.getProperty=function(e,t){if(A.typeOf.number("index",e),A.typeOf.string("propertyId",t),e<0||e>=this._count)throw new E(`index must be in the range [0, ${this._count})`);const n=this._properties[t];if(c(n))return Je(n[e],!0)};Bp.prototype.setProperty=function(e,t,n){if(A.typeOf.number("index",e),A.typeOf.string("propertyId",t),e<0||e>=this._count)throw new E(`index must be in the range [0, ${this._count})`);let i=this._properties[t];c(i)||(i=new Array(this._count),this._properties[t]=i),i[e]=Je(n,!0)};function Ro(e){e=y(e,y.EMPTY_OBJECT),A.typeOf.number("options.count",e.count),this._name=e.name,this._id=e.id,this._count=e.count,this._extras=e.extras,this._extensions=e.extensions,this._metadataTable=e.metadataTable,this._jsonMetadataTable=e.jsonMetadataTable,this._batchTableHierarchy=e.batchTableHierarchy}Object.defineProperties(Ro.prototype,{name:{get:function(){return this._name}},id:{get:function(){return this._id}},count:{get:function(){return this._count}},class:{get:function(){if(c(this._metadataTable))return this._metadataTable.class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}},byteLength:{get:function(){let e=0;return c(this._metadataTable)&&(e+=this._metadataTable.byteLength),c(this._batchTableHierarchy)&&(e+=this._batchTableHierarchy.byteLength),e}}});Ro.prototype.hasProperty=function(e,t){return A.typeOf.number("index",e),A.typeOf.string("propertyId",t),!!(c(this._metadataTable)&&this._metadataTable.hasProperty(t)||c(this._batchTableHierarchy)&&this._batchTableHierarchy.hasProperty(e,t)||c(this._jsonMetadataTable)&&this._jsonMetadataTable.hasProperty(t))};Ro.prototype.hasPropertyBySemantic=function(e,t){return A.typeOf.number("index",e),A.typeOf.string("semantic",t),c(this._metadataTable)?this._metadataTable.hasPropertyBySemantic(t):!1};Ro.prototype.propertyExists=function(e){return A.typeOf.string("propertyId",e),!!(c(this._metadataTable)&&this._metadataTable.hasProperty(e)||c(this._batchTableHierarchy)&&this._batchTableHierarchy.propertyExists(e)||c(this._jsonMetadataTable)&&this._jsonMetadataTable.hasProperty(e))};Ro.prototype.propertyExistsBySemantic=function(e){return A.typeOf.string("semantic",e),c(this._metadataTable)?this._metadataTable.hasPropertyBySemantic(e):!1};const Zw=[];Ro.prototype.getPropertyIds=function(e,t){return t=c(t)?t:[],t.length=0,c(this._metadataTable)&&t.push.apply(t,this._metadataTable.getPropertyIds(Zw)),c(this._batchTableHierarchy)&&t.push.apply(t,this._batchTableHierarchy.getPropertyIds(e,Zw)),c(this._jsonMetadataTable)&&t.push.apply(t,this._jsonMetadataTable.getPropertyIds(Zw)),t};Ro.prototype.getProperty=function(e,t){let n;if(c(this._metadataTable)&&(n=this._metadataTable.getProperty(e,t),c(n))||c(this._batchTableHierarchy)&&(n=this._batchTableHierarchy.getProperty(e,t),c(n))||c(this._jsonMetadataTable)&&(n=this._jsonMetadataTable.getProperty(e,t),c(n)))return n};Ro.prototype.setProperty=function(e,t,n){c(this._metadataTable)&&this._metadataTable.setProperty(e,t,n)||c(this._batchTableHierarchy)&&this._batchTableHierarchy.setProperty(e,t,n)||(c(this._jsonMetadataTable)||(this._jsonMetadataTable=new Bp({count:this._count,properties:{}})),this._jsonMetadataTable.setProperty(e,t,n))};Ro.prototype.getPropertyBySemantic=function(e,t){if(c(this._metadataTable))return this._metadataTable.getPropertyBySemantic(e,t)};Ro.prototype.setPropertyBySemantic=function(e,t,n){return c(this._metadataTable)?this._metadataTable.setPropertyBySemantic(e,t,n):!1};Ro.prototype.getPropertyTypedArray=function(e){if(A.typeOf.string("propertyId",e),c(this._metadataTable))return this._metadataTable.getPropertyTypedArray(e)};Ro.prototype.getPropertyTypedArrayBySemantic=function(e){if(A.typeOf.string("semantic",e),c(this._metadataTable))return this._metadataTable.getPropertyTypedArrayBySemantic(e)};function EO(e,t){if(!c(e)||e<0||e>=t)throw new E(`featureId is required and must be between zero and featuresLength - 1 (${t}`-+").")}Ro.prototype.isClass=function(e,t){EO(e,this.count),A.typeOf.string("className",t);const n=this._batchTableHierarchy;return c(n)?n.isClass(e,t):!1};Ro.prototype.isExactClass=function(e,t){return EO(e,this.count),A.typeOf.string("className",t),this.getExactClassName(e)===t};Ro.prototype.getExactClassName=function(e){EO(e,this.count);const t=this._batchTableHierarchy;if(!!c(t))return t.getClassName(e)};function j0(e){e=y(e,y.EMPTY_OBJECT);const t=e.property,n=e.classProperty,i=e.textures;A.typeOf.object("options.property",t),A.typeOf.object("options.classProperty",n),A.typeOf.object("options.textures",i);const o=c(t.channels)?t.channels:[0],r=t,s=dp.createModelTextureReader({textureInfo:r,channels:Ipe(o),texture:i[r.index]});this._min=t.min,this._max=t.max;let a=t.offset,l=t.scale;const u=n.hasValueTransform||c(a)||c(l);a=y(a,n.offset),l=y(l,n.scale),a=n.unpackVectorAndMatrixTypes(a),l=n.unpackVectorAndMatrixTypes(l),this._offset=a,this._scale=l,this._hasValueTransform=u,this._textureReader=s,this._classProperty=n,this._extras=t.extras,this._extensions=t.extensions}Object.defineProperties(j0.prototype,{textureReader:{get:function(){return this._textureReader}},hasValueTransform:{get:function(){return this._hasValueTransform}},offset:{get:function(){return this._offset}},scale:{get:function(){return this._scale}},classProperty:{get:function(){return this._classProperty}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});j0.prototype.isGpuCompatible=function(){const e=this._classProperty,t=e.type,n=e.componentType;return e.isArray?!e.isVariableLengthArray&&e.arrayLength<=4&&t===bt.SCALAR&&n===Ot.UINT8:bt.isVectorType(t)||t===bt.SCALAR?n===Ot.UINT8:!1};const Spe=[void 0,"float","vec2","vec3","vec4"],vpe=[void 0,"int","ivec2","ivec3","ivec4"];j0.prototype.getGlslType=function(){const e=this._classProperty;let t=bt.getComponentCount(e.type);return e.isArray&&(t=e.arrayLength),e.normalized?Spe[t]:vpe[t]};j0.prototype.unpackInShader=function(e){return this._classProperty.normalized?e:`${this.getGlslType()}(255.0 * ${e})`};function Ipe(e){return e.map(function(t){return"rgba".charAt(t)}).join("")}function NC(e){e=y(e,y.EMPTY_OBJECT);const t=e.propertyTexture,n=e.class,i=e.textures;A.typeOf.object("options.propertyTexture",t),A.typeOf.object("options.class",n),A.typeOf.object("options.textures",i);const o=t.extensions,r=t.extras,s={};if(c(t.properties))for(const a in t.properties)t.properties.hasOwnProperty(a)&&(s[a]=new j0({property:t.properties[a],classProperty:n.properties[a],textures:i}));this._name=e.name,this._id=e.id,this._class=n,this._properties=s,this._extras=r,this._extensions=o}Object.defineProperties(NC.prototype,{name:{get:function(){return this._name}},id:{get:function(){return this._id}},class:{get:function(){return this._class}},properties:{get:function(){return this._properties}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});NC.prototype.getProperty=function(e){return A.typeOf.string("propertyId",e),this._properties[e]};function sH(e){e=y(e,y.EMPTY_OBJECT);const t=e.property,n=e.classProperty;A.typeOf.object("options.property",t),A.typeOf.object("options.classProperty",n),this._attribute=t.attribute,this._classProperty=n,this._min=t.min,this._max=t.max;let i=t.offset,o=t.scale;const r=n.hasValueTransform||c(i)||c(o);i=y(i,n.offset),o=y(o,n.scale),i=n.unpackVectorAndMatrixTypes(i),o=n.unpackVectorAndMatrixTypes(o),this._offset=i,this._scale=o,this._hasValueTransform=r,this._extras=t.extras,this._extensions=t.extensions}Object.defineProperties(sH.prototype,{attribute:{get:function(){return this._attribute}},hasValueTransform:{get:function(){return this._hasValueTransform}},offset:{get:function(){return this._offset}},scale:{get:function(){return this._scale}},classProperty:{get:function(){return this._classProperty}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});function MC(e){e=y(e,y.EMPTY_OBJECT);const t=e.propertyAttribute,n=e.class;A.typeOf.object("options.propertyAttribute",t),A.typeOf.object("options.class",n);const i={};if(c(t.properties))for(const o in t.properties)t.properties.hasOwnProperty(o)&&(i[o]=new sH({property:t.properties[o],classProperty:n.properties[o]}));this._name=e.name,this._id=e.id,this._class=n,this._properties=i,this._extras=t.extras,this._extensions=t.extensions}Object.defineProperties(MC.prototype,{name:{get:function(){return this._name}},id:{get:function(){return this._id}},class:{get:function(){return this._class}},properties:{get:function(){return this._properties}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});MC.prototype.getProperty=function(e){return A.typeOf.string("propertyId",e),this._properties[e]};function Dl(e){e=y(e,y.EMPTY_OBJECT),A.typeOf.object("options.schema",e.schema),this._schema=e.schema;const t=e.propertyTables;this._propertyTableCount=c(t)?t.length:0,this._propertyTables=t,this._propertyTextures=e.propertyTextures,this._propertyAttributes=e.propertyAttributes,this._statistics=e.statistics,this._extras=e.extras,this._extensions=e.extensions}Object.defineProperties(Dl.prototype,{schema:{get:function(){return this._schema}},statistics:{get:function(){return this._statistics}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}},propertyTableCount:{get:function(){return this._propertyTableCount}},propertyTables:{get:function(){return this._propertyTables}},propertyTextures:{get:function(){return this._propertyTextures}},propertyAttributes:{get:function(){return this._propertyAttributes}},propertyTablesByteLength:{get:function(){if(!c(this._propertyTables))return 0;let e=0;const t=this._propertyTables.length;for(let n=0;n<t;n++)e+=this._propertyTables[n].byteLength;return e}}});Dl.prototype.getPropertyTable=function(e){return A.typeOf.number("propertyTableId",e),this._propertyTables[e]};Dl.prototype.getPropertyTexture=function(e){return A.typeOf.number("propertyTextureId",e),this._propertyTextures[e]};Dl.prototype.getPropertyAttribute=function(e){return A.typeOf.number("propertyAttributeId",e),this._propertyAttributes[e]};function Dpe(e){e=y(e,y.EMPTY_OBJECT);const t=e.extension,n=e.schema;A.typeOf.object("options.extension",t),A.typeOf.object("options.schema",n);const i=[];if(c(t.propertyTables))for(let s=0;s<t.propertyTables.length;s++){const a=t.propertyTables[s],l=n.classes[a.class],u=new Hs({count:a.count,properties:a.properties,class:l,bufferViews:e.bufferViews});i.push(new Ro({id:s,name:a.name,count:a.count,metadataTable:u,extras:a.extras,extensions:a.extensions}))}const o=[];if(c(t.propertyTextures))for(let s=0;s<t.propertyTextures.length;s++){const a=t.propertyTextures[s];o.push(new NC({id:s,name:a.name,propertyTexture:a,class:n.classes[a.class],textures:e.textures}))}const r=[];if(c(t.propertyAttributes))for(let s=0;s<t.propertyAttributes.length;s++){const a=t.propertyAttributes[s];r.push(new MC({id:s,name:a.name,class:n.classes[a.class],propertyAttribute:a}))}return new Dl({schema:n,propertyTables:i,propertyTextures:o,propertyAttributes:r,statistics:t.statistics,extras:t.extras,extensions:t.extensions})}function Ppe(e){e=y(e,y.EMPTY_OBJECT);const t=e.extension,n=e.schema;A.typeOf.object("options.extension",t),A.typeOf.object("options.schema",n);let i;const o=[];let r;if(c(t.featureTables))for(r=Object.keys(t.featureTables).sort(),i=0;i<r.length;i++){const a=r[i],l=t.featureTables[a],u=n.classes[l.class],h=new Hs({count:l.count,properties:l.properties,class:u,bufferViews:e.bufferViews});o.push(new Ro({id:a,count:l.count,metadataTable:h,extras:l.extras,extensions:l.extensions}))}const s=[];if(c(t.featureTextures))for(r=Object.keys(t.featureTextures).sort(),i=0;i<r.length;i++){const a=r[i],l=t.featureTextures[a];s.push(new NC({id:a,propertyTexture:Ope(l),class:n.classes[l.class],textures:e.textures}))}return new Dl({schema:n,propertyTables:o,propertyTextures:s,statistics:t.statistics,extras:t.extras,extensions:t.extensions})}function Ope(e){const t={class:e.class,properties:{}},n=e.properties;for(const i in n)if(n.hasOwnProperty(i)){const o=n[i],r={channels:Lpe(o.channels),extras:o.extras,extensions:o.extensions};t.properties[i]=jt(o.texture,r,!0)}return t}function Lpe(e){const t=e.length,n=new Array(t);for(let i=0;i<t;i++)n[i]="rgba".indexOf(e[i]);return n}function Ah(e){e=y(e,y.EMPTY_OBJECT);const t=e.gltf,n=e.extension,i=e.extensionLegacy,o=e.gltfResource,r=e.baseResource,s=e.supportedImageFormats,a=e.frameState,l=e.cacheKey,u=y(e.asynchronous,!0);if(A.typeOf.object("options.gltf",t),A.typeOf.object("options.gltfResource",o),A.typeOf.object("options.baseResource",r),A.typeOf.object("options.supportedImageFormats",s),A.typeOf.object("options.frameState",a),!c(e.extension)&&!c(e.extensionLegacy))throw new E("One of options.extension or options.extensionLegacy must be specified");this._gltfResource=o,this._baseResource=r,this._gltf=t,this._extension=n,this._extensionLegacy=i,this._supportedImageFormats=s,this._frameState=a,this._cacheKey=l,this._asynchronous=u,this._bufferViewLoaders=[],this._bufferViewIds=[],this._textureLoaders=[],this._textureIds=[],this._schemaLoader=void 0,this._structuralMetadata=void 0,this._state=ut.UNLOADED,this._promise=void 0}c(Object.create)&&(Ah.prototype=Object.create(wo.prototype),Ah.prototype.constructor=Ah);Object.defineProperties(Ah.prototype,{cacheKey:{get:function(){return this._cacheKey}},structuralMetadata:{get:function(){return this._structuralMetadata}}});async function Rpe(e){try{const t=zpe(e),n=Gpe(e),i=jpe(e);return await Promise.all([t,n,i]),e.isDestroyed()?void 0:(e._gltf=void 0,e._state=ut.LOADED,e)}catch(t){if(e.isDestroyed())return;e.unload(),e._state=ut.FAILED;const n="Failed to load structural metadata";throw e.getError(n,t)}}Ah.prototype.load=function(){return c(this._promise)?this._promise:(this._state=ut.LOADING,this._promise=Rpe(this),this._promise)};function Npe(e,t){for(const n in e)if(e.hasOwnProperty(n)){const i=e[n],o=i.values,r=i.arrayOffsets,s=i.stringOffsets;c(o)&&(t[o]=!0),c(r)&&(t[r]=!0),c(s)&&(t[s]=!0)}}function Mpe(e,t){for(const n in e)if(e.hasOwnProperty(n)){const i=e[n],o=i.bufferView,r=i.arrayOffsetBufferView,s=i.stringOffsetBufferView;c(o)&&(t[o]=!0),c(r)&&(t[r]=!0),c(s)&&(t[s]=!0)}}function Fpe(e){const t=e.propertyTables,n={};if(c(t))for(let i=0;i<t.length;i++){const o=t[i];Npe(o.properties,n)}return n}function Bpe(e){const t=e.featureTables,n={};if(c(t)){for(const i in t)if(t.hasOwnProperty(i)){const r=t[i].properties;c(r)&&Mpe(r,n)}}return n}async function zpe(e){let t;c(e._extension)?t=Fpe(e._extension):t=Bpe(e._extensionLegacy);const n=[];for(const i in t)if(t.hasOwnProperty(i)){const o=dt.getBufferViewLoader({gltf:e._gltf,bufferViewId:parseInt(i),gltfResource:e._gltfResource,baseResource:e._baseResource});e._bufferViewLoaders.push(o),e._bufferViewIds.push(i),n.push(o.load())}return Promise.all(n)}function Upe(e){const t={},n=e.propertyTextures;if(c(n))for(let i=0;i<n.length;i++){const r=n[i].properties;c(r)&&kpe(r,t)}return t}function kpe(e,t){for(const n in e)if(e.hasOwnProperty(n)){const i=e[n];t[i.index]=i}}function Vpe(e){const t={},n=e.featureTextures;if(c(n)){for(const i in n)if(n.hasOwnProperty(i)){const r=n[i].properties;c(r)&&Hpe(r,t)}}return t}function Hpe(e,t){for(const n in e)if(e.hasOwnProperty(n)){const o=e[n].texture;t[o.index]=o}}function Gpe(e){let t;c(e._extension)?t=Upe(e._extension):t=Vpe(e._extensionLegacy);const n=e._gltf,i=e._gltfResource,o=e._baseResource,r=e._supportedImageFormats,s=e._frameState,a=e._asynchronous,l=[];for(const u in t)if(t.hasOwnProperty(u)){const h=dt.getTextureLoader({gltf:n,textureInfo:t[u],gltfResource:i,baseResource:o,supportedImageFormats:r,frameState:s,asynchronous:a});e._textureLoaders.push(h),e._textureIds.push(u),l.push(h.load())}return Promise.all(l)}async function jpe(e){const t=y(e._extension,e._extensionLegacy);let n;if(c(t.schemaUri)){const i=e._baseResource.getDerivedResource({url:t.schemaUri});n=dt.getSchemaLoader({resource:i})}else n=dt.getSchemaLoader({schema:t.schema});if(e._schemaLoader=n,await n.load(),!n.isDestroyed())return n.schema}Ah.prototype.process=function(e){if(A.typeOf.object("frameState",e),this._state===ut.READY)return!0;if(this._state!==ut.LOADED)return!1;const t=this._textureLoaders,n=t.length;let i=!0;for(let a=0;a<n;++a){const u=t[a].process(e);i=i&&u}if(!i)return!1;const o=this._schemaLoader.schema,r={};for(let a=0;a<this._bufferViewIds.length;++a){const l=this._bufferViewIds[a],u=this._bufferViewLoaders[a];if(!u.isDestroyed()){const h=new Uint8Array(u.typedArray);r[l]=h}}const s={};for(let a=0;a<this._textureIds.length;++a){const l=this._textureIds[a],u=t[a];u.isDestroyed()||(s[l]=u.texture)}return c(this._extension)?this._structuralMetadata=Dpe({extension:this._extension,schema:o,bufferViews:r,textures:s}):this._structuralMetadata=Ppe({extension:this._extensionLegacy,schema:o,bufferViews:r,textures:s}),aH(this),this._state=ut.READY,!0};function aH(e){const t=e._bufferViewLoaders,n=t.length;for(let i=0;i<n;++i)dt.unload(t[i]);e._bufferViewLoaders.length=0,e._bufferViewIds.length=0}function Wpe(e){const t=e._textureLoaders,n=t.length;for(let i=0;i<n;++i)dt.unload(t[i]);e._textureLoaders.length=0,e._textureIds.length=0}Ah.prototype.unload=function(){aH(this),Wpe(this),c(this._schemaLoader)&&dt.unload(this._schemaLoader),this._schemaLoader=void 0,this._structuralMetadata=void 0};const Mm={TRANSLATION:"TRANSLATION",ROTATION:"ROTATION",SCALE:"SCALE",FEATURE_ID:"_FEATURE_ID"};Mm.fromGltfSemantic=function(e){A.typeOf.string("gltfSemantic",e);let t=e;const i=/^(\w+)_\d+$/.exec(e);switch(i!==null&&(t=i[1]),t){case"TRANSLATION":return Mm.TRANSLATION;case"ROTATION":return Mm.ROTATION;case"SCALE":return Mm.SCALE;case"_FEATURE_ID":return Mm.FEATURE_ID}};const hs=Object.freeze(Mm),qpe=65534,Ype=255;function W0(e){e=y(e,y.EMPTY_OBJECT);const t=e.triangleIndices,n=e.outlineIndices,i=e.originalVertexCount;A.typeOf.object("options.triangleIndices",t),A.typeOf.object("options.outlineIndices",n),A.typeOf.number("options.originalVertexCount",i),this._triangleIndices=t,this._originalVertexCount=i,this._edges=new cH(n,i),this._outlineCoordinatesTypedArray=void 0,this._extraVertices=[],$pe(this)}Object.defineProperties(W0.prototype,{updatedTriangleIndices:{get:function(){return this._triangleIndices}},outlineCoordinates:{get:function(){return this._outlineCoordinatesTypedArray}}});function $pe(e){let t=e._triangleIndices;const n=e._edges,i=[],o=e._extraVertices,r=e._originalVertexCount,s={};for(let a=0;a<t.length;a+=3){let l=t[a],u=t[a+1],h=t[a+2];const f=n.hasEdge(l,u),_=n.hasEdge(u,h),g=n.hasEdge(h,l);let m=JM(i,l,u,h,f,_,g);for(;c(m);){let b=s[m];if(!c(b)){b=r+o.length;let T=m;for(;T>=r;)T=o[T-r];o.push(T),s[m]=b}b>qpe&&(t instanceof Uint16Array||t instanceof Uint8Array)?t=new Uint32Array(t):b>Ype&&t instanceof Uint8Array&&(t=new Uint16Array(t)),m===l?(l=b,t[a]=b):m===u?(u=b,t[a+1]=b):(h=b,t[a+2]=b),m=JM(i,l,u,h,f,_,g)}}e._triangleIndices=t,e._outlineCoordinatesTypedArray=new Float32Array(i)}function JM(e,t,n,i,o,r,s){const a=s?1:0,l=o?1:0,u=0,h=Jw(e,t,a,l,u);if(h===0)return t;const f=0,_=o?1:0,g=r?1:0,m=Jw(e,n,f,_,g);if(m===0)return n;const b=s?1:0,T=0,x=r?1:0,C=Jw(e,i,b,T,x);if(C===0)return i;const w=h&m&C;let v,P,N;if(w&1<<0)v=0,P=1,N=2;else if(w&1<<1)v=0,N=1,P=2;else if(w&1<<2)P=0,v=1,N=2;else if(w&1<<3)P=0,N=1,v=2;else if(w&1<<4)N=0,v=1,P=2;else if(w&1<<5)N=0,P=1,v=2;else{const B=eS(h),S=eS(m),D=eS(C);return B<S&&B<D?t:S<D?n:i}const k=t*3;e[k+v]=a,e[k+P]=l,e[k+N]=u;const M=n*3;e[M+v]=f,e[M+P]=_,e[M+N]=g;const U=i*3;e[U+v]=b,e[U+P]=T,e[U+N]=x}function Jw(e,t,n,i,o){const r=t*3,s=e[r],a=e[r+1],l=e[r+2];return c(s)?(s===n&&a===i&&l===o)<<0|(s===n&&a===o&&l===i)<<1|(s===i&&a===n&&l===o)<<2|(s===i&&a===o&&l===n)<<3|(s===o&&a===n&&l===i)<<4|(s===o&&a===i&&l===n)<<5:63}function eS(e){return(e&1)+(e>>1&1)+(e>>2&1)+(e>>3&1)+(e>>4&1)+(e>>5&1)}W0.prototype.updateAttribute=function(e){const t=this._extraVertices,n=e.length,i=n/this._originalVertexCount,o=t.length,r=e.constructor,s=new r(e.length+o*i);s.set(e);for(let a=0;a<o;a++){const l=t[a]*i,u=n+a*i;for(let h=0;h<i;h++)s[u+h]=s[l+h]}return s};W0.createTexture=function(e){let t=e.cache.modelOutliningCache;if(c(t)||(t=e.cache.modelOutliningCache={}),c(t.outlineTexture))return t.outlineTexture;const n=Math.min(4096,pt.maximumTextureSize);let i=n;const o=eF(i),r=[];for(;i>1;)i>>=1,r.push(eF(i));const s=new xt({context:e,source:{arrayBufferView:o,mipLevels:r},width:n,height:1,pixelFormat:Ve.LUMINANCE,sampler:new un({wrapS:Fn.CLAMP_TO_EDGE,wrapT:Fn.CLAMP_TO_EDGE,minificationFilter:en.LINEAR_MIPMAP_LINEAR,magnificationFilter:Yo.LINEAR})});return t.outlineTexture=s,s};function eF(e){const t=new Uint8Array(e);return t[e-1]=192,e===8?t[e-1]=96:e===4?t[e-1]=48:e===2?t[e-1]=24:e===1&&(t[e-1]=12),t}function cH(e,t){this._originalVertexCount=t,this._edges=new Set;for(let n=0;n<e.length;n+=2){const i=e[n],o=e[n+1],r=Math.min(i,o),s=Math.max(i,o),a=r*this._originalVertexCount+s;this._edges.add(a)}}cH.prototype.hasEdge=function(e,t){const n=Math.min(e,t),i=Math.max(e,t),o=n*this._originalVertexCount+i;return this._edges.has(o)};function lH(e){A.typeOf.object("attribute",e),this.attribute=e,this.loadBuffer=!1,this.loadTypedArray=!1}function Xpe(e){A.typeOf.object("indices",e),this.indices=e,this.loadBuffer=!1,this.loadTypedArray=!1}function q_(e){A.typeOf.object("primitive",e),this.primitive=e,this.attributePlans=[],this.indicesPlan=void 0,this.needsOutlines=!1,this.outlineIndices=void 0}q_.prototype.postProcess=function(e){this.needsOutlines&&(Qpe(this),Zpe(this,e))};function Qpe(e){const t=e.primitive,n=t.indices,i=t.attributes[0].count,o=new W0({triangleIndices:n.typedArray,outlineIndices:e.outlineIndices,originalVertexCount:i});n.typedArray=o.updatedTriangleIndices,n.indexDatatype=je.fromTypedArray(n.typedArray);const r=Kpe(o.outlineCoordinates),s=new lH(r);s.loadBuffer=!0,s.loadTypedArray=!1,e.attributePlans.push(s),t.outlineCoordinates=s.attribute;const a=e.attributePlans,l=e.attributePlans.length;for(let u=0;u<l;u++){const h=a[u].attribute;h.typedArray=o.updateAttribute(h.typedArray)}}function Kpe(e){const t=new yt.Attribute;return t.name="_OUTLINE_COORDINATES",t.typedArray=e,t.componentDatatype=Z.FLOAT,t.type=qt.VEC3,t.normalized=!1,t.count=e.length/3,t}function Zpe(e,t){Jpe(e.attributePlans,t),c(e.indicesPlan)&&eme(e.indicesPlan,t)}function Jpe(e,t){const n=e.length;for(let i=0;i<n;i++){const o=e[i],r=o.attribute,s=r.typedArray;if(o.loadBuffer){const a=ct.createVertexBuffer({typedArray:s,context:t,usage:ke.STATIC_DRAW});a.vertexArrayDestroyable=!1,r.buffer=a}o.loadTypedArray||(r.typedArray=void 0)}}function eme(e,t){const n=e.indices;if(e.loadBuffer){const i=ct.createIndexBuffer({typedArray:n.typedArray,context:t,usage:ke.STATIC_DRAW,indexDatatype:n.indexDatatype});n.buffer=i,i.vertexArrayDestroyable=!1}e.loadTypedArray||(n.typedArray=void 0)}q_.AttributeLoadPlan=lH;q_.IndicesLoadPlan=Xpe;function tme(e){e=y(e,y.EMPTY_OBJECT),this.webp=y(e.webp,!1),this.basis=y(e.basis,!1)}const nme=yt.Attribute,ime=yt.Indices,uH=yt.FeatureIdAttribute,dH=yt.FeatureIdTexture,hH=yt.FeatureIdImplicitRange,ome=yt.MorphTarget,rme=yt.Primitive,sme=yt.Instances,ame=yt.Skin,cme=yt.Node,lme=yt.AnimatedPropertyType,ume=yt.AnimationSampler,dme=yt.AnimationTarget,hme=yt.AnimationChannel,fme=yt.Animation,pme=yt.ArticulationStage,mme=yt.Articulation,_me=yt.Asset,gme=yt.Scene,yme=yt.Components,bme=yt.MetallicRoughness,Tme=yt.SpecularGlossiness,Ame=yt.Material,li={NOT_LOADED:0,LOADING:1,LOADED:2,PROCESSING:3,POST_PROCESSING:4,PROCESSED:5,READY:6,FAILED:7,UNLOADED:8};function wa(e){e=y(e,y.EMPTY_OBJECT);const t=e.gltfResource;let n=e.baseResource;const i=e.typedArray,o=y(e.releaseGltfJson,!1),r=y(e.asynchronous,!0),s=y(e.incrementallyLoadTextures,!0),a=y(e.upAxis,Cr.Y),l=y(e.forwardAxis,Cr.Z),u=y(e.loadAttributesAsTypedArray,!1),h=y(e.loadAttributesFor2D,!1),f=y(e.enablePick),_=y(e.loadIndicesForWireframe,!1),g=y(e.loadPrimitiveOutline,!0),m=y(e.loadForClassification,!1),b=y(e.renameBatchIdSemantic,!1);A.typeOf.object("options.gltfResource",t),n=c(n)?n:t.clone(),this._gltfJson=e.gltfJson,this._gltfResource=t,this._baseResource=n,this._typedArray=i,this._releaseGltfJson=o,this._asynchronous=r,this._incrementallyLoadTextures=s,this._upAxis=a,this._forwardAxis=l,this._loadAttributesAsTypedArray=u,this._loadAttributesFor2D=h,this._enablePick=f,this._loadIndicesForWireframe=_,this._loadPrimitiveOutline=g,this._loadForClassification=m,this._renameBatchIdSemantic=b,this._sortedPropertyTableIds=void 0,this._sortedFeatureTextureIds=void 0,this._gltfJsonLoader=void 0,this._state=li.NOT_LOADED,this._textureState=li.NOT_LOADED,this._promise=void 0,this._processError=void 0,this._textureErrors=[],this._primitiveLoadPlans=[],this._loaderPromises=[],this._textureLoaders=[],this._texturesPromises=[],this._textureCallbacks=[],this._bufferViewLoaders=[],this._geometryLoaders=[],this._geometryCallbacks=[],this._structuralMetadataLoader=void 0,this._loadResourcesPromise=void 0,this._resourcesLoaded=!1,this._texturesLoaded=!1,this._postProcessBuffers=[],this._components=void 0}c(Object.create)&&(wa.prototype=Object.create(wo.prototype),wa.prototype.constructor=wa);Object.defineProperties(wa.prototype,{cacheKey:{get:function(){}},components:{get:function(){return this._components}},gltfJson:{get:function(){return c(this._gltfJsonLoader)?this._gltfJsonLoader.gltf:this._gltfJson}},incrementallyLoadTextures:{get:function(){return this._incrementallyLoadTextures}},texturesLoaded:{get:function(){return this._texturesLoaded}}});async function xme(e){e._state=li.LOADING,e._textureState=li.LOADING;try{const t=dt.getGltfJsonLoader({gltfResource:e._gltfResource,baseResource:e._baseResource,typedArray:e._typedArray,gltfJson:e._gltfJson});return e._gltfJsonLoader=t,await t.load(),e.isDestroyed()||e.isUnloaded()||t.isDestroyed()?void 0:(e._state=li.LOADED,e._textureState=li.LOADED,e)}catch(t){if(e.isDestroyed())return;e._state=li.FAILED,e._textureState=li.FAILED,jA(e,t)}}async function Cme(e,t){Yt.supportsWebP.initialized||await Yt.supportsWebP.initialize();const n=new tme({webp:Yt.supportsWebP(),basis:t.context.supportsBasis}),i=e.gltfJson,o=T_e(e,i,n,t);return e._state=li.PROCESSING,e._textureState=li.PROCESSING,c(e._gltfJsonLoader)&&e._releaseGltfJson&&(dt.unload(e._gltfJsonLoader),e._gltfJsonLoader=void 0),o}wa.prototype.load=async function(){return c(this._promise)?this._promise:(this._promise=xme(this),this._promise)};function jA(e,t){e.unload();const n="Failed to load glTF";throw e.getError(n,t)}function Eme(e,t){let n,i=!0;const o=e._geometryLoaders,r=o.length;for(n=0;n<r;++n){const a=o[n].process(t);a&&c(e._geometryCallbacks[n])&&(e._geometryCallbacks[n](),e._geometryCallbacks[n]=void 0),i=i&&a}const s=e._structuralMetadataLoader;if(c(s)){const a=s.process(t);a&&(e._components.structuralMetadata=s.structuralMetadata),i=i&&a}i&&(e._state=li.POST_PROCESSING)}function wme(e,t){const n=e._primitiveLoadPlans,i=n.length;for(let o=0;o<i;o++){const r=n[o];r.postProcess(t),r.needsOutlines&&Sme(e,r)}}function Sme(e,t){const n=e._postProcessBuffers,i=t.primitive,o=i.outlineCoordinates;c(o)&&n.push(o.buffer);const r=i.attributes,s=r.length;for(let l=0;l<s;l++){const u=r[l];c(u.buffer)&&n.push(u.buffer)}const a=i.indices;c(a)&&c(a.buffer)&&n.push(a.buffer)}wa.prototype._process=function(e){return this._state===li.READY?!0:(this._state===li.PROCESSING&&Eme(this,e),this._resourcesLoaded&&this._state===li.POST_PROCESSING&&(wme(this,e.context),this._state=li.PROCESSED),this._resourcesLoaded&&this._state===li.PROCESSED?(AH(this),this._typedArray=void 0,this._state=li.READY,!0):!1)};wa.prototype._processTextures=function(e){if(this._textureState===li.READY)return!0;if(this._textureState!==li.PROCESSING)return!1;let t,n=!0;const i=this._textureLoaders,o=i.length;for(t=0;t<o;++t){const r=i[t].process(e);r&&c(this._textureCallbacks[t])&&(this._textureCallbacks[t](),this._textureCallbacks[t]=void 0),n=n&&r}return n?(this._textureState=li.READY,this._texturesLoaded=!0,!0):!1};wa.prototype.process=function(e){if(A.typeOf.object("frameState",e),this._state===li.LOADED&&!c(this._loadResourcesPromise)&&(this._loadResourcesPromise=Cme(this,e).then(()=>{this._resourcesLoaded=!0}).catch(o=>{this._processError=o})),c(this._processError)){this._state=li.FAILED;const o=this._processError;this._processError=void 0,jA(this,o)}const t=this._textureErrors.pop();if(c(t)){const o=this.getError("Failed to load glTF texture",t);throw o.name="TextureError",o}if(this._state===li.FAILED)return!1;let n=!1;try{n=this._process(e)}catch(o){this._state=li.FAILED,jA(this,o)}let i=!1;try{i=this._processTextures(e)}catch(o){this._textureState=li.FAILED,jA(this,o)}return this._incrementallyLoadTextures?n:n&&i};function vme(e,t,n,i,o,r,s,a){const u=t.accessors[n].bufferView;return dt.getVertexBufferLoader({gltf:t,gltfResource:e._gltfResource,baseResource:e._baseResource,frameState:a,bufferViewId:u,draco:o,attributeSemantic:i,accessorId:n,asynchronous:e._asynchronous,loadBuffer:r,loadTypedArray:s})}function Ime(e,t,n,i,o,r,s){return dt.getIndexBufferLoader({gltf:t,accessorId:n,gltfResource:e._gltfResource,baseResource:e._baseResource,frameState:s,draco:i,asynchronous:e._asynchronous,loadBuffer:o,loadTypedArray:r})}function Dme(e,t,n){const i=dt.getBufferViewLoader({gltf:t,bufferViewId:n,gltfResource:e._gltfResource,baseResource:e._baseResource});return e._bufferViewLoaders.push(i),i}function fH(e,t,n){let i=t.byteOffset;const o=W_(e,t),r=t.count,s=U0(t.type),a=t.componentType,l=Z.getSizeInBytes(a),u=l*s,h=r*s;if(o===u)return n=new Uint8Array(n),Z.createArrayBufferView(a,n.buffer,n.byteOffset+i,h);const f=Z.createTypedArray(a,h),_=new DataView(n.buffer),g=new Array(s),m=fO(t.componentType);i=n.byteOffset+i;for(let b=0;b<r;++b){m(_,i,s,l,g);for(let T=0;T<s;++T)f[b*s+T]=g[T];i+=o}return f}function Pme(e,t){const n=e.type;if(n===qt.SCALAR)return t.fill(0);const i=qt.getMathType(n);return t.fill(i.clone(i.ZERO))}function Ome(e,t,n,i){const o=e.type,r=e.count;if(o===qt.SCALAR)for(let s=0;s<r;s++)n[s]=t[s];else if(o===qt.VEC4&&i)for(let s=0;s<r;s++)n[s]=_e.unpack(t,s*4);else{const s=qt.getMathType(o),a=qt.getNumberOfComponents(o);for(let l=0;l<r;l++)n[l]=s.unpack(t,l*a)}return n}async function Lme(e,t,n,i,o,r){if(await t.load(),e.isDestroyed())return;const s=t.typedArray,a=fH(n,i,s);o=y(o,!1),Ome(i,a,r,o)}function kx(e,t,n,i){const o=t.accessors[n],r=o.count,s=new Array(r),a=o.bufferView;if(c(a)){const l=Dme(e,t,a),u=Lme(e,l,t,o,i,s);return e._loaderPromises.push(u),s}return Pme(o,s)}function pc(e,t){if(!!c(t))return e===Number?t[0]:e.unpack(t)}function Rme(e){return e===Number?0:new e}function Nme(e){switch(e){case Z.BYTE:return 127;case Z.UNSIGNED_BYTE:return 255;case Z.SHORT:return 32767;case Z.UNSIGNED_SHORT:return 65535;default:return 1}}const Mme={VEC2:new H(-1,-1),VEC3:new d(-1,-1,-1),VEC4:new te(-1,-1,-1,-1)};function Fme(e,t){const n=Nme(e.componentDatatype),i=Mme[e.type];let o=e.min;c(o)&&(o=t.divideByScalar(o,n,o),o=t.maximumByComponent(o,i,o));let r=e.max;c(r)&&(r=t.divideByScalar(r,n,r),r=t.maximumByComponent(r,i,r)),e.min=o,e.max=r}function Bme(e,t,n){const i=e.decodeMatrix,o=pc(n,e.decodedMin),r=pc(n,e.decodedMax);c(o)&&c(r)&&(t.min=o,t.max=r);const s=new yt.Quantization;s.componentDatatype=t.componentDatatype,s.type=t.type,i.length===4?(s.quantizedVolumeOffset=i[2],s.quantizedVolumeStepSize=i[0]):i.length===9?(s.quantizedVolumeOffset=new H(i[6],i[7]),s.quantizedVolumeStepSize=new H(i[0],i[4])):i.length===16?(s.quantizedVolumeOffset=new d(i[12],i[13],i[14]),s.quantizedVolumeStepSize=new d(i[0],i[5],i[10])):i.length===25&&(s.quantizedVolumeOffset=new te(i[20],i[21],i[22],i[23]),s.quantizedVolumeStepSize=new te(i[0],i[6],i[12],i[18])),t.quantization=s}function zme(e,t,n,i,o){var f;const r=e.accessors[t],s=qt.getMathType(r.type),a=y(r.normalized,!1),l=new nme;l.name=n,l.semantic=i,l.setIndex=o,l.constant=Rme(s),l.componentDatatype=r.componentType,l.normalized=a,l.count=r.count,l.type=r.type,l.min=pc(s,r.min),l.max=pc(s,r.max),l.byteOffset=r.byteOffset,l.byteStride=W_(e,r),To(r,"WEB3D_quantized_attributes")&&Bme(r.extensions.WEB3D_quantized_attributes,l,s);const u=l.semantic===ht.POSITION||l.semantic===ht.NORMAL||l.semantic===ht.TANGENT||l.semantic===ht.TEXCOORD;return((f=e.extensionsRequired)==null?void 0:f.includes("KHR_mesh_quantization"))&&a&&u&&Fme(l,s),l}function pH(e){const n=/^\w+_(\d+)$/.exec(e);if(n!==null)return parseInt(n[1])}const Ume={gltfSemantic:void 0,renamedSemantic:void 0,modelSemantic:void 0};function wO(e,t,n){let i=n;e._renameBatchIdSemantic&&(n==="_BATCHID"||n==="BATCHID")&&(i="_FEATURE_ID_0");const o=t.fromGltfSemantic(i),r=Ume;return r.gltfSemantic=n,r.renamedSemantic=i,r.modelSemantic=o,r}function kme(e){const t=e===ht.POSITION,n=e===ht.FEATURE_ID,i=e===ht.TEXCOORD;return t||n||i}function Vme(e,t,n,i){if(e.byteOffset=0,e.byteStride=void 0,e.quantization=t.quantization,n&&(e.buffer=t.buffer),i){const o=c(t.quantization)?t.quantization.componentDatatype:e.componentDatatype;e.typedArray=Z.createArrayBufferView(o,t.typedArray.buffer)}}function Hme(e,t,n,i,o,r){if(o&&(n.buffer=i.buffer),r){const s=i.typedArray;n.typedArray=fH(e,t,s),o||(n.byteOffset=0,n.byteStride=void 0)}}function mH(e,t,n,i,o,r,s,a){const l=t.accessors[n],u=l.bufferView,h=i.gltfSemantic,f=i.renamedSemantic,_=i.modelSemantic,g=c(_)?pH(f):void 0,b=zme(t,n,h,_,g);if(!c(o)&&!c(u))return b;const T=vme(e,t,n,h,o,r,s,a),x=e._geometryLoaders.length;e._geometryLoaders.push(T);const C=T.load();return e._loaderPromises.push(C),e._geometryCallbacks[x]=()=>{c(o)&&c(o.attributes)&&c(o.attributes[h])?Vme(b,T,r,s):Hme(t,l,b,T,r,s)},b}function _H(e,t,n,i,o,r,s,a){const l=i.modelSemantic,u=l===ht.POSITION,h=l===ht.FEATURE_ID,f=u&&!r&&e._loadAttributesFor2D&&!a.scene3DOnly,_=u&&e._enablePick&&!a.context.webgl2,g=e._loadForClassification&&h,m=e._loadAttributesAsTypedArray,b=!m,T=m||f||_||g,w=mH(e,t,n,i,o,s?!1:b,s?!0:T,a),v=new q_.AttributeLoadPlan(w);return v.loadBuffer=b,v.loadTypedArray=T,v}function Gme(e,t,n,i,o,r){const s=c(i.ROTATION),a=c(i.TRANSLATION)&&c(t.accessors[i.TRANSLATION].min)&&c(t.accessors[i.TRANSLATION].max),l=wO(e,hs,o),u=l.modelSemantic,h=u===hs.TRANSLATION||u===hs.ROTATION||u===hs.SCALE,f=u===hs.TRANSLATION,_=e._loadAttributesAsTypedArray||s&&h||!r.context.instancedArrays,g=e._enablePick&&!r.context.webgl2,m=!_,b=e._loadAttributesFor2D&&!r.scene3DOnly;return mH(e,t,n,l,void 0,m,_||f&&(!a||b||g),r)}function jme(e,t,n,i,o,r,s){const a=t.accessors[n],l=a.bufferView;if(!c(i)&&!c(l))return;const u=new ime;u.count=a.count;const h=e._loadAttributesAsTypedArray,f=(e._loadIndicesForWireframe||e._enablePick)&&!s.context.webgl2,_=e._loadForClassification&&o,m=!h,b=h||f||_,C=Ime(e,t,n,i,r?!1:m,r?!0:b,s),w=e._geometryLoaders.length;e._geometryLoaders.push(C);const v=C.load();e._loaderPromises.push(v),e._geometryCallbacks[w]=()=>{u.indexDatatype=C.indexDatatype,u.buffer=C.buffer,u.typedArray=C.typedArray};const P=new q_.IndicesLoadPlan(u);return P.loadBuffer=m,P.loadTypedArray=b,P}function Fu(e,t,n,i,o,r){const s=dp.getImageIdFromTexture({gltf:t,textureId:n.index,supportedImageFormats:i});if(!c(s))return;const a=dt.getTextureLoader({gltf:t,textureInfo:n,gltfResource:e._gltfResource,baseResource:e._baseResource,supportedImageFormats:i,frameState:o,asynchronous:e._asynchronous}),l=dp.createModelTextureReader({textureInfo:n}),u=e._textureLoaders.length;e._textureLoaders.push(a);const h=a.load().catch(f=>{if(!e.isDestroyed()){if(!e._incrementallyLoadTextures)throw f;e._textureState=li.FAILED,e._textureErrors.push(f)}});return e._texturesPromises.push(h),e._textureCallbacks[u]=()=>{l.texture=a.texture,c(r)&&(l.texture.sampler=r)},l}function Wme(e,t,n,i,o){const r=new Ame,s=y(n.extensions,y.EMPTY_OBJECT),a=s.KHR_materials_pbrSpecularGlossiness,l=n.pbrMetallicRoughness;if(r.unlit=c(s.KHR_materials_unlit),c(a)){const u=new Tme;r.specularGlossiness=u,c(a.diffuseTexture)&&(u.diffuseTexture=Fu(e,t,a.diffuseTexture,i,o)),c(a.specularGlossinessTexture)&&c(a.specularGlossinessTexture)&&(u.specularGlossinessTexture=Fu(e,t,a.specularGlossinessTexture,i,o)),u.diffuseFactor=pc(te,a.diffuseFactor),u.specularFactor=pc(d,a.specularFactor),u.glossinessFactor=a.glossinessFactor,r.pbrSpecularGlossiness=a}else if(c(l)){const u=new bme;c(l.baseColorTexture)&&(u.baseColorTexture=Fu(e,t,l.baseColorTexture,i,o)),c(l.metallicRoughnessTexture)&&(u.metallicRoughnessTexture=Fu(e,t,l.metallicRoughnessTexture,i,o)),u.baseColorFactor=pc(te,l.baseColorFactor),u.metallicFactor=l.metallicFactor,u.roughnessFactor=l.roughnessFactor,r.metallicRoughness=u}return c(n.emissiveTexture)&&(r.emissiveTexture=Fu(e,t,n.emissiveTexture,i,o)),c(n.normalTexture)&&!e._loadForClassification&&(r.normalTexture=Fu(e,t,n.normalTexture,i,o)),c(n.occlusionTexture)&&(r.occlusionTexture=Fu(e,t,n.occlusionTexture,i,o)),r.emissiveFactor=pc(d,n.emissiveFactor),r.alphaMode=n.alphaMode,r.alphaCutoff=n.alphaCutoff,r.doubleSided=n.doubleSided,r}function gH(e,t){const n=new uH;return n.featureCount=e.featureCount,n.nullFeatureId=e.nullFeatureId,n.propertyTableId=e.propertyTable,n.setIndex=e.attribute,n.label=e.label,n.positionalLabel=t,n}function yH(e,t,n,i){const o=new uH,r=e.featureIds;return o.featureCount=n,o.propertyTableId=t,o.setIndex=pH(r.attribute),o.positionalLabel=i,o}function bH(e,t){const n=new hH;return n.propertyTableId=e.propertyTable,n.featureCount=e.featureCount,n.nullFeatureId=e.nullFeatureId,n.label=e.label,n.positionalLabel=t,n.offset=0,n.repeat=1,n}function TH(e,t,n,i){const o=new hH,r=e.featureIds;o.propertyTableId=t,o.featureCount=n,o.offset=y(r.constant,0);const s=y(r.divisor,0);return o.repeat=s===0?void 0:s,o.positionalLabel=i,o}function qme(e,t,n,i,o,r){const s=new dH;s.featureCount=n.featureCount,s.nullFeatureId=n.nullFeatureId,s.propertyTableId=n.propertyTable,s.label=n.label,s.positionalLabel=r;const a=n.texture;s.textureReader=Fu(e,t,a,i,o,un.NEAREST);const u=(c(a.channels)?a.channels:[0]).map(function(h){return"rgba".charAt(h)}).join("");return s.textureReader.channels=u,s}function Yme(e,t,n,i,o,r,s,a){const l=new dH,u=n.featureIds,h=u.texture;return l.featureCount=s,l.propertyTableId=i,l.textureReader=Fu(e,t,h,o,r,un.NEAREST),l.textureReader.channels=u.channels,l.positionalLabel=a,l}function $me(e,t,n,i,o,r){const s=new ome,a=void 0,l=!1;for(const u in n)if(n.hasOwnProperty(u)){const h=n[u],f=wO(e,ht,u),_=_H(e,t,h,f,a,l,i,r);s.attributes.push(_.attribute),o.attributePlans.push(_)}return s}function Xme(e,t,n,i,o,r){const s=new rme,a=new q_(s);e._primitiveLoadPlans.push(a);const l=n.material;c(l)&&(s.material=Wme(e,t,t.materials[l],o,r));const u=y(n.extensions,y.EMPTY_OBJECT);let h=!1;const f=u.CESIUM_primitive_outline;e._loadPrimitiveOutline&&c(f)&&(h=!0,a.needsOutlines=!0,a.outlineIndices=Qme(e,t,f));const _=e._loadForClassification,g=u.KHR_draco_mesh_compression;let m=!1;const b=n.attributes;if(c(b)){for(const k in b)if(b.hasOwnProperty(k)){const M=b[k],U=wO(e,ht,k),B=U.modelSemantic;if(_&&!kme(B))continue;B===ht.FEATURE_ID&&(m=!0);const S=_H(e,t,M,U,g,i,h,r);a.attributePlans.push(S),s.attributes.push(S.attribute)}}const T=n.targets;if(c(T)&&!_){const k=T.length;for(let M=0;M<k;++M)s.morphTargets.push($me(e,t,T[M],h,a,r))}const x=n.indices;if(c(x)){const k=jme(e,t,x,g,m,h,r);c(k)&&(a.indicesPlan=k,s.indices=k.indices)}const C=u.EXT_structural_metadata,w=u.EXT_mesh_features,v=u.EXT_feature_metadata,P=c(v);c(w)?Kme(e,t,s,w,o,r):P&&Zme(e,t,s,v,o,r),c(C)?Jme(s,C):P&&e_e(e,s,v);const N=n.mode;if(_&&N!==ze.TRIANGLES)throw new Te("Only triangle meshes can be used for classification.");return s.primitiveType=N,s}function Qme(e,t,n){const i=n.indices;return kx(e,t,i,!1)}function Kme(e,t,n,i,o,r){let s;c(i)&&c(i.featureIds)?s=i.featureIds:s=[];for(let a=0;a<s.length;a++){const l=s[a],u=`featureId_${a}`;let h;c(l.texture)?h=qme(e,t,l,o,r,u):c(l.attribute)?h=gH(l,u):h=bH(l,u),n.featureIds.push(h)}}function Zme(e,t,n,i,o,r){const s=t.extensions.EXT_feature_metadata.featureTables;let a=0;const l=i.featureIdAttributes;if(c(l)){const h=l.length;for(let f=0;f<h;++f){const _=l[f],g=_.featureTable,m=e._sortedPropertyTableIds.indexOf(g),b=s[g].count,T=`featureId_${a}`;a++;let x;c(_.featureIds.attribute)?x=yH(_,m,b,T):x=TH(_,m,b,T),n.featureIds.push(x)}}const u=i.featureIdTextures;if(c(u)){const h=u.length;for(let f=0;f<h;++f){const _=u[f],g=_.featureTable,m=e._sortedPropertyTableIds.indexOf(g),b=s[g].count,T=`featureId_${a}`;a++;const x=Yme(e,t,_,m,o,r,b,T);n.featureIds.push(x)}}}function Jme(e,t){!c(t)||(c(t.propertyTextures)&&(e.propertyTextureIds=t.propertyTextures),c(t.propertyAttributes)&&(e.propertyAttributeIds=t.propertyAttributes))}function e_e(e,t,n){c(n.featureTextures)&&(t.propertyTextureIds=n.featureTextures.map(function(i){return e._sortedFeatureTextureIds.indexOf(i)}))}function t_e(e,t,n,i){const o=n.EXT_mesh_gpu_instancing,r=new sme,s=o.attributes;if(c(s)){for(const h in s)if(s.hasOwnProperty(h)){const f=s[h];r.attributes.push(Gme(e,t,f,s,h,i))}}const a=y(o.extensions,y.EMPTY_OBJECT),l=n.EXT_instance_features,u=a.EXT_feature_metadata;return c(l)?n_e(r,l):c(u)&&i_e(t,r,u,e._sortedPropertyTableIds),r}function n_e(e,t){const n=t.featureIds;for(let i=0;i<n.length;i++){const o=n[i],r=`instanceFeatureId_${i}`;let s;c(o.attribute)?s=gH(o,r):s=bH(o,r),e.featureIds.push(s)}}function i_e(e,t,n,i){const o=e.extensions.EXT_feature_metadata.featureTables,r=n.featureIdAttributes;if(c(r)){const s=r.length;for(let a=0;a<s;++a){const l=r[a],u=l.featureTable,h=i.indexOf(u),f=o[u].count,_=`instanceFeatureId_${a}`;let g;c(l.featureIds.attribute)?g=yH(l,h,f,_):g=TH(l,h,f,_),t.featureIds.push(g)}}}function o_e(e,t,n,i,o){const r=new cme;r.name=n.name,r.matrix=pc(L,n.matrix),r.translation=pc(d,n.translation),r.rotation=pc(_e,n.rotation),r.scale=pc(d,n.scale);const s=y(n.extensions,y.EMPTY_OBJECT),a=s.EXT_mesh_gpu_instancing,l=s.AGI_articulations;if(c(a)){if(e._loadForClassification)throw new Te("Models with the EXT_mesh_gpu_instancing extension cannot be used for classification.");r.instances=t_e(e,t,s,o)}c(l)&&(r.articulationName=l.articulationName);const u=n.mesh;if(c(u)){const h=t.meshes[u],f=h.primitives,_=f.length;for(let T=0;T<_;++T)r.primitives.push(Xme(e,t,f[T],c(r.instances),i,o));const g=y(n.weights,h.weights),b=r.primitives[0].morphTargets.length;r.morphWeights=c(g)?g.slice():new Array(b).fill(0)}return r}function r_e(e,t,n,i){if(!c(t.nodes))return[];let o,r;const s=t.nodes.length,a=new Array(s);for(o=0;o<s;++o){const l=o_e(e,t,t.nodes[o],n,i);l.index=o,a[o]=l}for(o=0;o<s;++o){const l=t.nodes[o].children;if(c(l)){const u=l.length;for(r=0;r<u;++r)a[o].children.push(a[l[r]])}}return a}function s_e(e,t,n,i){const o=new ame,r=n.joints,s=r.length,a=new Array(s);for(let u=0;u<s;++u)a[u]=i[r[u]];o.joints=a;const l=n.inverseBindMatrices;return c(l)?o.inverseBindMatrices=kx(e,t,l):o.inverseBindMatrices=new Array(s).fill(L.IDENTITY),o}function a_e(e,t,n){const i=t.skins;if(e._loadForClassification||!c(i))return[];const o=t.skins.length,r=new Array(o);for(let a=0;a<o;++a){const l=s_e(e,t,t.skins[a],n);l.index=a,r[a]=l}const s=n.length;for(let a=0;a<s;++a){const l=t.nodes[a].skin;c(l)&&(n[a].skin=r[l])}return r}async function c_e(e,t,n,i,o,r){const s=new Ah({gltf:t,extension:n,extensionLegacy:i,gltfResource:e._gltfResource,baseResource:e._baseResource,supportedImageFormats:o,frameState:r,asynchronous:e._asynchronous});return e._structuralMetadataLoader=s,s.load()}function l_e(e,t,n){const i=new ume,o=n.input;i.input=kx(e,t,o);const r=n.interpolation;i.interpolation=y(r_[r],r_.LINEAR);const s=n.output;return i.output=kx(e,t,s,!0),i}function u_e(e,t){const n=new dme,i=e.node;if(!c(i))return;n.node=t[i];const o=e.path.toUpperCase();return n.path=lme[o],n}function d_e(e,t,n){const i=new hme,o=e.sampler;return i.sampler=t[o],i.target=u_e(e.target,n),i}function h_e(e,t,n,i){let o;const r=new fme;r.name=n.name;const s=n.samplers,a=s.length,l=new Array(a);for(o=0;o<a;o++){const _=l_e(e,t,s[o]);_.index=o,l[o]=_}const u=n.channels,h=u.length,f=new Array(h);for(o=0;o<h;o++)f[o]=d_e(u[o],l,i);return r.samplers=l,r.channels=f,r}function f_e(e,t,n){const i=t.animations;if(e._loadForClassification||!c(i))return[];const o=t.animations.length,r=new Array(o);for(let s=0;s<o;++s){const a=h_e(e,t,t.animations[s],n);a.index=s,r[s]=a}return r}function p_e(e){const t=new pme;t.name=e.name;const n=e.type.toUpperCase();return t.type=Zc[n],t.minimumValue=e.minimumValue,t.maximumValue=e.maximumValue,t.initialValue=e.initialValue,t}function m_e(e){const t=new mme;t.name=e.name;const n=e.stages,i=n.length,o=new Array(i);for(let r=0;r<i;r++){const s=p_e(n[r]);o[r]=s}return t.stages=o,t}function __e(e){const n=y(e.extensions,y.EMPTY_OBJECT).AGI_articulations;if(!c(n))return[];const i=n.articulations;if(!c(i))return[];const o=i.length,r=new Array(o);for(let s=0;s<o;s++){const a=m_e(i[s]);r[s]=a}return r}function g_e(e){let t;return c(e.scenes)&&c(e.scene)&&(t=e.scenes[e.scene].nodes),t=y(t,e.nodes),t=c(t)?t:[],t}function y_e(e,t){const n=new gme,i=g_e(e);return n.nodes=i.map(function(o){return t[o]}),n}const b_e=new d;function T_e(e,t,n,i){const o=y(t.extensions,y.EMPTY_OBJECT),r=o.EXT_structural_metadata,s=o.EXT_feature_metadata,a=o.CESIUM_RTC;if(c(s)){const x=s.featureTables,C=s.featureTextures,w=c(x)?x:[],v=c(C)?C:[];e._sortedPropertyTableIds=Object.keys(w).sort(),e._sortedFeatureTextureIds=Object.keys(v).sort()}const l=r_e(e,t,n,i),u=a_e(e,t,l),h=f_e(e,t,l),f=__e(t),_=y_e(t,l),g=new yme,m=new _me,b=t.asset.copyright;if(c(b)){const x=b.split(";").map(function(C){return new Wt(C.trim())});m.credits=x}if(g.asset=m,g.scene=_,g.nodes=l,g.skins=u,g.animations=h,g.articulations=f,g.upAxis=e._upAxis,g.forwardAxis=e._forwardAxis,c(a)){const x=d.fromArray(a.center,0,b_e);g.transform=L.fromTranslation(x,g.transform)}if(e._components=g,c(r)||c(s)){const x=c_e(e,t,r,s,n,i);e._loaderPromises.push(x)}const T=[];return T.push.apply(T,e._loaderPromises),e._incrementallyLoadTextures||T.push.apply(T,e._texturesPromises),Promise.all(T)}function A_e(e){const t=e._textureLoaders,n=t.length;for(let i=0;i<n;++i)t[i]=!t[i].isDestroyed()&&dt.unload(t[i]);e._textureLoaders.length=0}function AH(e){const t=e._bufferViewLoaders,n=t.length;for(let i=0;i<n;++i)t[i]=!t[i].isDestroyed()&&dt.unload(t[i]);e._bufferViewLoaders.length=0}function x_e(e){const t=e._geometryLoaders,n=t.length;for(let i=0;i<n;++i)t[i]=!t[i].isDestroyed()&&dt.unload(t[i]);e._geometryLoaders.length=0}function C_e(e){const t=e._postProcessBuffers,n=t.length;for(let i=0;i<n;i++){const o=t[i];o.isDestroyed()||o.destroy()}t.length=0}function E_e(e){c(e._structuralMetadataLoader)&&!e._structuralMetadataLoader.isDestroyed()&&(e._structuralMetadataLoader.destroy(),e._structuralMetadataLoader=void 0)}wa.prototype.isUnloaded=function(){return this._state===li.UNLOADED};wa.prototype.unload=function(){c(this._gltfJsonLoader)&&!this._gltfJsonLoader.isDestroyed()&&dt.unload(this._gltfJsonLoader),this._gltfJsonLoader=void 0,A_e(this),AH(this),x_e(this),C_e(this),E_e(this),this._components=void 0,this._typedArray=void 0,this._state=li.UNLOADED};const w_e=`uniform sampler2D u_pointCloud_colorGBuffer;
|
|
uniform sampler2D u_pointCloud_depthGBuffer;
|
|
uniform vec2 u_distanceAndEdlStrength;
|
|
in vec2 v_textureCoordinates;
|
|
|
|
vec2 neighborContribution(float log2Depth, vec2 offset)
|
|
{
|
|
float dist = u_distanceAndEdlStrength.x;
|
|
vec2 texCoordOrig = v_textureCoordinates + offset * dist;
|
|
vec2 texCoord0 = v_textureCoordinates + offset * floor(dist);
|
|
vec2 texCoord1 = v_textureCoordinates + offset * ceil(dist);
|
|
|
|
float depthOrLogDepth0 = czm_unpackDepth(texture(u_pointCloud_depthGBuffer, texCoord0));
|
|
float depthOrLogDepth1 = czm_unpackDepth(texture(u_pointCloud_depthGBuffer, texCoord1));
|
|
|
|
// ignore depth values that are the clear depth
|
|
if (depthOrLogDepth0 == 0.0 || depthOrLogDepth1 == 0.0) {
|
|
return vec2(0.0);
|
|
}
|
|
|
|
// interpolate the two adjacent depth values
|
|
float depthMix = mix(depthOrLogDepth0, depthOrLogDepth1, fract(dist));
|
|
vec4 eyeCoordinate = czm_windowToEyeCoordinates(texCoordOrig, depthMix);
|
|
return vec2(max(0.0, log2Depth - log2(-eyeCoordinate.z / eyeCoordinate.w)), 1.0);
|
|
}
|
|
|
|
void main()
|
|
{
|
|
float depthOrLogDepth = czm_unpackDepth(texture(u_pointCloud_depthGBuffer, v_textureCoordinates));
|
|
|
|
vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, depthOrLogDepth);
|
|
eyeCoordinate /= eyeCoordinate.w;
|
|
|
|
float log2Depth = log2(-eyeCoordinate.z);
|
|
|
|
if (depthOrLogDepth == 0.0) // 0.0 is the clear value for the gbuffer
|
|
{
|
|
discard;
|
|
}
|
|
|
|
vec4 color = texture(u_pointCloud_colorGBuffer, v_textureCoordinates);
|
|
|
|
// sample from neighbors left, right, down, up
|
|
vec2 texelSize = 1.0 / czm_viewport.zw;
|
|
|
|
vec2 responseAndCount = vec2(0.0);
|
|
|
|
responseAndCount += neighborContribution(log2Depth, vec2(-texelSize.x, 0.0));
|
|
responseAndCount += neighborContribution(log2Depth, vec2(+texelSize.x, 0.0));
|
|
responseAndCount += neighborContribution(log2Depth, vec2(0.0, -texelSize.y));
|
|
responseAndCount += neighborContribution(log2Depth, vec2(0.0, +texelSize.y));
|
|
|
|
float response = responseAndCount.x / responseAndCount.y;
|
|
float strength = u_distanceAndEdlStrength.y;
|
|
float shade = exp(-response * 300.0 * strength);
|
|
color.rgb *= shade;
|
|
out_FragColor = vec4(color);
|
|
|
|
// Input and output depth are the same.
|
|
gl_FragDepth = depthOrLogDepth;
|
|
}
|
|
`;function Jh(){this._framebuffer=new on({colorAttachmentsLength:2,depth:!0,supportsDepthTexture:!0}),this._drawCommand=void 0,this._clearCommand=void 0,this._strength=1,this._radius=1}Object.defineProperties(Jh.prototype,{framebuffer:{get:function(){return this._framebuffer.framebuffer}},colorGBuffer:{get:function(){return this._framebuffer.getColorTexture(0)}},depthGBuffer:{get:function(){return this._framebuffer.getColorTexture(1)}}});function S_e(e){e._framebuffer.destroy(),e._drawCommand=void 0,e._clearCommand=void 0}const tS=new H;function v_e(e,t){const n=new Oe({defines:["LOG_DEPTH_WRITE"],sources:[w_e]}),i={u_pointCloud_colorGBuffer:function(){return e.colorGBuffer},u_pointCloud_depthGBuffer:function(){return e.depthGBuffer},u_distanceAndEdlStrength:function(){return tS.x=e._radius,tS.y=e._strength,tS}},o=Ue.fromCache({blending:Zn.ALPHA_BLEND,depthMask:!0,depthTest:{enabled:!0},stencilTest:At.setCesium3DTileBit(),stencilMask:At.CESIUM_3D_TILE_MASK});e._drawCommand=t.createViewportQuadCommand(n,{uniformMap:i,renderState:o,pass:xe.CESIUM_3D_TILE,owner:e}),e._clearCommand=new bi({framebuffer:e.framebuffer,color:new z(0,0,0,0),depth:1,renderState:Ue.fromCache(),pass:xe.CESIUM_3D_TILE,owner:e})}function I_e(e,t){const n=t.drawingBufferWidth,i=t.drawingBufferHeight;e._framebuffer.update(t,n,i),v_e(e,t)}function xH(e){return e.drawBuffers&&e.fragmentDepth}Jh.isSupported=xH;function D_e(e,t){let n=e.shaderCache.getDerivedShaderProgram(t,"EC");if(!c(n)){const i=t._attributeLocations,o=t.fragmentShaderSource.clone();o.sources.splice(0,0,`layout (location = 0) out vec4 out_FragData_0;
|
|
layout (location = 1) out vec4 out_FragData_1;`),o.sources=o.sources.map(function(r){return r=Oe.replaceMain(r,"czm_point_cloud_post_process_main"),r=r.replaceAll(/out_FragColor/g,"out_FragData_0"),r}),o.sources.push(`void main()
|
|
{
|
|
czm_point_cloud_post_process_main();
|
|
#ifdef LOG_DEPTH
|
|
czm_writeLogDepth();
|
|
out_FragData_1 = czm_packDepth(gl_FragDepth);
|
|
#else
|
|
out_FragData_1 = czm_packDepth(gl_FragCoord.z);
|
|
#endif
|
|
}`),n=e.shaderCache.createDerivedShaderProgram(t,"EC",{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:o,attributeLocations:i})}return n}Jh.prototype.update=function(e,t,n,i){if(!xH(e.context))return;this._strength=n.eyeDomeLightingStrength,this._radius=n.eyeDomeLightingRadius*e.pixelRatio,I_e(this,e.context);let o;const r=e.commandList,s=r.length;for(o=t;o<s;++o){const u=r[o];if(u.primitiveType!==ze.POINTS||u.pass===xe.TRANSLUCENT)continue;let h,f,_=u.derivedCommands.pointCloudProcessor;c(_)&&(h=_.command,f=_.originalShaderProgram),(!c(h)||u.dirty||f!==u.shaderProgram||h.framebuffer!==this.framebuffer)&&(h=Ze.shallowClone(u,h),h.framebuffer=this.framebuffer,h.shaderProgram=D_e(e.context,u.shaderProgram),h.castShadows=!1,h.receiveShadows=!1,c(_)||(_={command:h,originalShaderProgram:u.shaderProgram},u.derivedCommands.pointCloudProcessor=_),_.originalShaderProgram=u.shaderProgram),r[o]=h}const a=this._clearCommand,l=this._drawCommand;l.boundingVolume=i,r.push(l),r.push(a)};Jh.prototype.isDestroyed=function(){return!1};Jh.prototype.destroy=function(){return S_e(this),ve(this)};function q0(e){const t=y(e,{});this.attenuation=y(t.attenuation,!1),this.geometricErrorScale=y(t.geometricErrorScale,1),this.maximumAttenuation=t.maximumAttenuation,this.baseResolution=t.baseResolution,this.eyeDomeLighting=y(t.eyeDomeLighting,!0),this.eyeDomeLightingStrength=y(t.eyeDomeLightingStrength,1),this.eyeDomeLightingRadius=y(t.eyeDomeLightingRadius,1),this.backFaceCulling=y(t.backFaceCulling,!1),this.normalShading=y(t.normalShading,!0)}q0.isSupported=function(e){return Jh.isSupported(e.context)};const zr={},P_e=new te(0,0,0,1);let Zr=new te;const O_e=new Re,nS=new H,iS=new H;zr.wgs84ToWindowCoordinates=function(e,t,n){return zr.wgs84WithEyeOffsetToWindowCoordinates(e,t,d.ZERO,n)};const tF=new te,nF=new d;function Og(e,t,n,i){const o=n.viewMatrix,r=L.multiplyByVector(o,te.fromElements(e.x,e.y,e.z,1,tF),tF),s=d.multiplyComponents(t,d.normalize(r,nF),nF);return r.x+=t.x+s.x,r.y+=t.y+s.y,r.z+=s.z,L.multiplyByVector(n.frustum.projectionMatrix,r,i)}const L_e=new he(Math.PI,R.PI_OVER_TWO),R_e=new d,N_e=new d;zr.wgs84WithEyeOffsetToWindowCoordinates=function(e,t,n,i){if(!c(e))throw new E("scene is required.");if(!c(t))throw new E("position is required.");const o=e.frameState,r=zr.computeActualWgs84Position(o,t,P_e);if(!c(r))return;const s=e.canvas,a=O_e;a.x=0,a.y=0,a.width=s.clientWidth,a.height=s.clientHeight;const l=e.camera;let u=!1;if(o.mode===oe.SCENE2D){const h=e.mapProjection,f=L_e,_=h.project(f,R_e),g=d.clone(l.position,N_e),m=l.frustum.clone(),b=L.computeViewportTransformation(a,0,1,new L),T=l.frustum.projectionMatrix,x=l.positionWC.y,C=d.fromElements(R.sign(x)*_.x-x,0,-l.positionWC.x),w=zt.pointToGLWindowCoordinates(T,b,C);if(x===0||w.x<=0||w.x>=s.clientWidth)u=!0;else{if(w.x>s.clientWidth*.5){a.width=w.x,l.frustum.right=_.x-x,Zr=Og(r,n,l,Zr),zr.clipToGLWindowCoordinates(a,Zr,nS),a.x+=w.x,l.position.x=-l.position.x;const v=l.frustum.right;l.frustum.right=-l.frustum.left,l.frustum.left=-v,Zr=Og(r,n,l,Zr),zr.clipToGLWindowCoordinates(a,Zr,iS)}else{a.x+=w.x,a.width-=w.x,l.frustum.left=-_.x-x,Zr=Og(r,n,l,Zr),zr.clipToGLWindowCoordinates(a,Zr,nS),a.x=a.x-a.width,l.position.x=-l.position.x;const v=l.frustum.left;l.frustum.left=-l.frustum.right,l.frustum.right=-v,Zr=Og(r,n,l,Zr),zr.clipToGLWindowCoordinates(a,Zr,iS)}d.clone(g,l.position),l.frustum=m.clone(),i=H.clone(nS,i),(i.x<0||i.x>s.clientWidth)&&(i.x=iS.x)}}if(o.mode!==oe.SCENE2D||u){if(Zr=Og(r,n,l,Zr),Zr.z<0&&!(l.frustum instanceof It)&&!(l.frustum instanceof Ki))return;i=zr.clipToGLWindowCoordinates(a,Zr,i)}return i.y=s.clientHeight-i.y,i};zr.wgs84ToDrawingBufferCoordinates=function(e,t,n){if(n=zr.wgs84ToWindowCoordinates(e,t,n),!!c(n))return zr.transformWindowToDrawingBuffer(e,n,n)};const Pu=new d,M_e=new he;zr.computeActualWgs84Position=function(e,t,n){const i=e.mode;if(i===oe.SCENE3D)return d.clone(t,n);const o=e.mapProjection,r=o.ellipsoid.cartesianToCartographic(t,M_e);if(!c(r))return;if(o.project(r,Pu),i===oe.COLUMBUS_VIEW)return d.fromElements(Pu.z,Pu.x,Pu.y,n);if(i===oe.SCENE2D)return d.fromElements(0,Pu.x,Pu.y,n);const s=e.morphTime;return d.fromElements(R.lerp(Pu.z,t.x,s),R.lerp(Pu.x,t.y,s),R.lerp(Pu.y,t.z,s),n)};const iF=new d,oF=new d,rF=new L;zr.clipToGLWindowCoordinates=function(e,t,n){return d.divideByScalar(t,t.w,iF),L.computeViewportTransformation(e,0,1,rF),L.multiplyByPoint(rF,iF,oF),H.fromCartesian3(oF,n)};zr.transformWindowToDrawingBuffer=function(e,t,n){const i=e.canvas,o=e.drawingBufferWidth/i.clientWidth,r=e.drawingBufferHeight/i.clientHeight;return H.fromElements(t.x*o,t.y*r,n)};const F_e=new te,sF=new te;zr.drawingBufferToWgs84Coordinates=function(e,t,n,i){const r=e.context.uniformState,s=r.currentFrustum,a=s.x,l=s.y;if(e.frameState.useLogDepth){const g=n*r.log2FarDepthFromNearPlusOne,m=Math.pow(2,g)-1;n=l*(1-a/(m+a))/(l-a)}const u=e.view.passState.viewport,h=te.clone(te.UNIT_W,F_e);h.x=(t.x-u.x)/u.width*2-1,h.y=(t.y-u.y)/u.height*2-1,h.z=n*2-1,h.w=1;let f,_=e.camera.frustum;if(c(_.fovy)){f=L.multiplyByVector(r.inverseViewProjection,h,sF);const g=1/f.w;d.multiplyByScalar(f,g,f)}else{const g=_.offCenterFrustum;c(g)&&(_=g),f=sF,f.x=(h.x*(_.right-_.left)+_.left+_.right)*.5,f.y=(h.y*(_.top-_.bottom)+_.bottom+_.top)*.5,f.z=(h.z*(a-l)-a-l)*.5,f.w=1,f=L.multiplyByVector(r.inverseView,f,f)}return d.fromCartesian4(f,i)};const Ao=zr,B_e={LEFT:-1,NONE:0,RIGHT:1},zp=Object.freeze(B_e),Xm={};Xm._deprecationWarning=Xh;const Ou=Uint32Array.BYTES_PER_ELEMENT;Xm.parse=function(e,t){const n=y(t,0);A.defined("arrayBuffer",e),t=n;const i=new Uint8Array(e),o=new DataView(e);t+=Ou;const r=o.getUint32(t,!0);if(r!==1)throw new Te(`Only Batched 3D Model version 1 is supported. Version ${r} is not.`);t+=Ou;const s=o.getUint32(t,!0);t+=Ou;let a=o.getUint32(t,!0);t+=Ou;let l=o.getUint32(t,!0);t+=Ou;let u=o.getUint32(t,!0);t+=Ou;let h=o.getUint32(t,!0);t+=Ou;let f;u>=570425344?(t-=Ou*2,f=a,u=l,h=0,a=0,l=0,Xm._deprecationWarning("b3dm-legacy-header","This b3dm header is using the legacy format [batchLength] [batchTableByteLength]. The new format is [featureTableJsonByteLength] [featureTableBinaryByteLength] [batchTableJsonByteLength] [batchTableBinaryByteLength] from https://github.com/CesiumGS/3d-tiles/tree/main/specification/TileFormats/Batched3DModel.")):h>=570425344&&(t-=Ou,f=u,u=a,h=l,a=0,l=0,Xm._deprecationWarning("b3dm-legacy-header","This b3dm header is using the legacy format [batchTableJsonByteLength] [batchTableBinaryByteLength] [batchLength]. The new format is [featureTableJsonByteLength] [featureTableBinaryByteLength] [batchTableJsonByteLength] [batchTableBinaryByteLength] from https://github.com/CesiumGS/3d-tiles/tree/main/specification/TileFormats/Batched3DModel."));let _;a===0?_={BATCH_LENGTH:y(f,0)}:(_=sa(i,t,a),t+=a);const g=new Uint8Array(e,t,l);t+=l;let m,b;u>0&&(m=sa(i,t,u),t+=u,h>0&&(b=new Uint8Array(e,t,h),b=new Uint8Array(b),t+=h));const T=n+s-t;if(T===0)throw new Te("glTF byte length must be greater than 0.");let x;return t%4===0?x=new Uint8Array(e,t,T):(Xm._deprecationWarning("b3dm-glb-unaligned","The embedded glb is not aligned to a 4-byte boundary."),x=new Uint8Array(i.subarray(t,t+T))),{batchLength:f,featureTableJson:_,featureTableBinary:g,batchTableJson:m,batchTableBinary:b,gltf:x}};const z_e=Xm;function ef(e,t){this.json=e,this.buffer=t,this._cachedTypedArrays={},this.featuresLength=0}function CH(e,t,n,i,o,r){const s=e._cachedTypedArrays;let a=s[t];return c(a)||(a=Z.createArrayBufferView(n,e.buffer.buffer,e.buffer.byteOffset+r,o*i),s[t]=a),a}function U_e(e,t,n,i){const o=e._cachedTypedArrays;let r=o[t];return c(r)||(r=Z.createTypedArray(n,i),o[t]=r),r}ef.prototype.getGlobalProperty=function(e,t,n){const i=this.json[e];if(!!c(i))return c(i.byteOffset)?(t=y(t,Z.UNSIGNED_INT),n=y(n,1),CH(this,e,t,n,1,i.byteOffset)):i};ef.prototype.hasProperty=function(e){return c(this.json[e])};ef.prototype.getPropertyArray=function(e,t,n){const i=this.json[e];if(!!c(i))return c(i.byteOffset)?(c(i.componentType)&&(t=Z.fromName(i.componentType)),CH(this,e,t,n,this.featuresLength,i.byteOffset)):U_e(this,e,t,i)};ef.prototype.getProperty=function(e,t,n,i,o){const r=this.json[e];if(!c(r))return;const s=this.getPropertyArray(e,t,n);if(n===1)return s[i];for(let a=0;a<n;++a)o[a]=s[n*i+a];return o};function Up(e){A.typeOf.number("options.count",e.count),A.typeOf.object("options.batchTable",e.batchTable);const t=e.count,n=e.batchTable,i=e.binaryBody,o=y(e.parseAsPropertyAttributes,!1),r=e.customAttributeOutput;if(o&&!c(r))throw new E("customAttributeOutput is required when parsing batch table as property attributes");const s=k_e(n);let a;c(s.jsonProperties)&&(a=new Bp({count:t,properties:s.jsonProperties}));let l;c(s.hierarchy)&&(l=new du({extension:s.hierarchy,binaryBody:i}));const u=Ph.BATCH_TABLE_CLASS_NAME,h=s.binaryProperties;let f,_,g;if(o){const T=H_e(t,u,h,i,r);g=T.transcodedSchema,_=[new MC({propertyAttribute:T.propertyAttributeJson,class:T.transcodedClass})]}else{const T=V_e(t,u,h,i);g=T.transcodedSchema;const x=T.featureTableJson;f=new Hs({count:x.count,properties:x.properties,class:T.transcodedClass,bufferViews:T.bufferViewsTypedArrays}),_=[]}const m=[];if(c(f)||c(a)||c(l)){const T=new Ro({id:0,name:"Batch Table",count:t,metadataTable:f,jsonMetadataTable:a,batchTableHierarchy:l});m.push(T)}const b={schema:g,propertyTables:m,propertyAttributes:_,extensions:s.extensions,extras:s.extras};return new Dl(b)}function k_e(e){const t=e.HIERARCHY,n=e.extras,i=e.extensions;let o;c(t)?(Up._deprecationWarning("batchTableHierarchyExtension","The batch table HIERARCHY property has been moved to an extension. Use extensions.3DTILES_batch_table_hierarchy instead."),o=t):c(i)&&(o=i["3DTILES_batch_table_hierarchy"]);let r;const s={};for(const a in e){if(!e.hasOwnProperty(a)||a==="HIERARCHY"||a==="extensions"||a==="extras")continue;const l=e[a];Array.isArray(l)?(r=c(r)?r:{},r[a]=l):s[a]=l}return{binaryProperties:s,jsonProperties:r,hierarchy:o,extras:n,extensions:i}}function V_e(e,t,n,i){const o={},r={},s={};let a=0;for(const f in n){if(!n.hasOwnProperty(f))continue;if(!c(i))throw new Te(`Property ${f} requires a batch table binary.`);const _=n[f],g=Jf(_);r[f]={bufferView:a},o[f]=EH(_),s[a]=g.createArrayBufferView(i.buffer,i.byteOffset+_.byteOffset,e),a++}const l={classes:{}};l.classes[t]={properties:o};const u=Oh.fromJson(l);return{featureTableJson:{class:t,count:e,properties:r},bufferViewsTypedArrays:s,transcodedSchema:u,transcodedClass:u.classes[t]}}function H_e(e,t,n,i,o){const r={},s={};let a=0;for(const f in n){if(!n.hasOwnProperty(f))continue;const _=n[f];if(!c(i)&&!c(_.typedArray))throw new Te(`Property ${f} requires a batch table binary.`);let g=Lt.sanitizeGlslIdentifier(f);(g===""||r.hasOwnProperty(g))&&(g=`property_${a}`,a++);const m=EH(_);m.name=f,r[g]=m;let b=g.toUpperCase();b.startsWith("_")||(b=`_${b}`);let T=_.typedArray;c(T)||(T=Jf(_).createArrayBufferView(i.buffer,i.byteOffset+_.byteOffset,e));const x=new yt.Attribute;x.name=b,x.count=e,x.type=_.type;const C=Z.fromTypedArray(T);(C===Z.INT||C===Z.UNSIGNED_INT||C===Z.DOUBLE)&&(Up._oneTimeWarning("Cast pnts property to floats",`Point cloud property "${b}" will be cast to a float array because INT, UNSIGNED_INT, and DOUBLE are not valid WebGL vertex attribute types. Some precision may be lost.`),T=new Float32Array(T)),x.componentDatatype=Z.fromTypedArray(T),x.typedArray=T,o.push(x),s[g]={attribute:b}}const l={classes:{}};l.classes[t]={properties:r};const u=Oh.fromJson(l);return{class:t,propertyAttributeJson:{properties:s},transcodedSchema:u,transcodedClass:u.classes[t]}}function EH(e){const t=G_e(e.componentType);return{type:e.type,componentType:t}}function G_e(e){switch(e){case"BYTE":return"INT8";case"UNSIGNED_BYTE":return"UINT8";case"SHORT":return"INT16";case"UNSIGNED_SHORT":return"UINT16";case"INT":return"INT32";case"UNSIGNED_INT":return"UINT32";case"FLOAT":return"FLOAT32";case"DOUBLE":return"FLOAT64"}}Up._deprecationWarning=Xh;Up._oneTimeWarning=$n;const ip={UNLOADED:0,LOADING:1,PROCESSING:2,READY:3,FAILED:4},j_e=yt.FeatureIdAttribute;function xh(e){e=y(e,y.EMPTY_OBJECT);const t=e.b3dmResource;let n=e.baseResource;const i=e.arrayBuffer,o=y(e.byteOffset,0),r=y(e.releaseGltfJson,!1),s=y(e.asynchronous,!0),a=y(e.incrementallyLoadTextures,!0),l=y(e.upAxis,Cr.Y),u=y(e.forwardAxis,Cr.X),h=y(e.loadAttributesAsTypedArray,!1),f=y(e.loadAttributesFor2D,!1),_=y(e.enablePick,!1),g=y(e.loadIndicesForWireframe,!1),m=y(e.loadPrimitiveOutline,!0),b=y(e.loadForClassification,!1);A.typeOf.object("options.b3dmResource",t),A.typeOf.object("options.arrayBuffer",i),n=c(n)?n:t.clone(),this._b3dmResource=t,this._baseResource=n,this._arrayBuffer=i,this._byteOffset=o,this._releaseGltfJson=r,this._asynchronous=s,this._incrementallyLoadTextures=a,this._upAxis=l,this._forwardAxis=u,this._loadAttributesAsTypedArray=h,this._loadAttributesFor2D=f,this._enablePick=_,this._loadIndicesForWireframe=g,this._loadPrimitiveOutline=m,this._loadForClassification=b,this._state=ip.UNLOADED,this._promise=void 0,this._gltfLoader=void 0,this._batchLength=0,this._propertyTable=void 0,this._batchTable=void 0,this._components=void 0,this._transform=L.IDENTITY}c(Object.create)&&(xh.prototype=Object.create(wo.prototype),xh.prototype.constructor=xh);Object.defineProperties(xh.prototype,{texturesLoaded:{get:function(){var e;return(e=this._gltfLoader)==null?void 0:e.texturesLoaded}},cacheKey:{get:function(){}},components:{get:function(){return this._components}}});xh.prototype.load=function(){if(c(this._promise))return this._promise;const e=z_e.parse(this._arrayBuffer,this._byteOffset);let t=e.batchLength;const n=e.featureTableJson,i=e.featureTableBinary,o=e.batchTableJson,r=e.batchTableBinary,s=new ef(n,i);t=s.getGlobalProperty("BATCH_LENGTH"),this._batchLength=t;const a=s.getGlobalProperty("RTC_CENTER",Z.FLOAT,3);c(a)&&(this._transform=L.fromTranslation(d.fromArray(a))),this._batchTable={json:o,binary:r};const l=new wa({typedArray:e.gltf,upAxis:this._upAxis,forwardAxis:this._forwardAxis,gltfResource:this._b3dmResource,baseResource:this._baseResource,releaseGltfJson:this._releaseGltfJson,incrementallyLoadTextures:this._incrementallyLoadTextures,loadAttributesAsTypedArray:this._loadAttributesAsTypedArray,loadAttributesFor2D:this._loadAttributesFor2D,enablePick:this._enablePick,loadIndicesForWireframe:this._loadIndicesForWireframe,loadPrimitiveOutline:this._loadPrimitiveOutline,loadForClassification:this._loadForClassification,renameBatchIdSemantic:!0});this._gltfLoader=l,this._state=ip.LOADING;const u=this;return this._promise=l.load().then(function(){if(!u.isDestroyed())return u._state=ip.PROCESSING,u}).catch(function(h){if(!u.isDestroyed())return W_e(u,h)}),this._promise};function W_e(e,t){e.unload(),e._state=ip.FAILED;const n="Failed to load b3dm";return t=e.getError(n,t),Promise.reject(t)}xh.prototype.process=function(e){if(A.typeOf.object("frameState",e),this._state===ip.READY)return!0;if(this._state!==ip.PROCESSING||!this._gltfLoader.process(e))return!1;const n=this._gltfLoader.components;return n.transform=L.multiplyTransformation(this._transform,n.transform,n.transform),q_e(this,n),this._components=n,this._arrayBuffer=void 0,this._state=ip.READY,!0};function q_e(e,t){const n=e._batchTable,i=e._batchLength;if(i===0)return;let o;if(c(n.json))o=Up({count:i,batchTable:n.json,binaryBody:n.binary});else{const a=new Ro({name:Ph.BATCH_TABLE_CLASS_NAME,count:i});o=new Dl({schema:{},propertyTables:[a]})}const r=t.scene.nodes,s=r.length;for(let a=0;a<s;a++)wH(r[a]);t.structuralMetadata=o}function wH(e){const t=e.children.length;for(let i=0;i<t;i++)wH(e.children[i]);const n=e.primitives.length;for(let i=0;i<n;i++){const o=e.primitives[i],r=Lt.getAttributeBySemantic(o,ht.FEATURE_ID);if(c(r)){r.setIndex=0;const s=new j_e;s.propertyTableId=0,s.setIndex=0,s.positionalLabel="featureId_0",o.featureIds.push(s)}}}xh.prototype.unload=function(){c(this._gltfLoader)&&!this._gltfLoader.isDestroyed()&&this._gltfLoader.unload(),this._components=void 0,this._arrayBuffer=void 0};function Ch(e){e=y(e,y.EMPTY_OBJECT),A.typeOf.object("options.geoJson",e.geoJson),this._geoJson=e.geoJson,this._components=void 0}c(Object.create)&&(Ch.prototype=Object.create(wo.prototype),Ch.prototype.constructor=Ch);Object.defineProperties(Ch.prototype,{cacheKey:{get:function(){}},components:{get:function(){return this._components}}});Ch.prototype.load=function(){return Promise.resolve(this)};Ch.prototype.process=function(e){return A.typeOf.object("frameState",e),c(this._components)||(this._components=rge(this._geoJson,e),this._geoJson=void 0),!0};function Y_e(){this.lines=void 0,this.points=void 0,this.properties=void 0}function $_e(){this.features=[]}function SO(e){const t=e[0],n=e[1],i=y(e[2],0);return new d(t,n,i)}function vO(e){const t=e.length,n=new Array(t);for(let o=0;o<t;o++)n[o]=SO(e[o]);return[n]}function X_e(e){const t=e.length,n=new Array(t);for(let i=0;i<t;i++)n[i]=vO(e[i])[0];return n}function SH(e){const t=e.length,n=new Array(t);for(let i=0;i<t;i++)n[i]=vO(e[i])[0];return n}function Q_e(e){const t=e.length,n=[];for(let i=0;i<t;i++)Array.prototype.push.apply(n,SH(e[i]));return n}function K_e(e){return[SO(e)]}function Z_e(e){const t=e.length,n=new Array(t);for(let i=0;i<t;i++)n[i]=SO(e[i]);return n}const J_e={LineString:vO,MultiLineString:X_e,MultiPolygon:Q_e,Polygon:SH,MultiPoint:Z_e,Point:K_e},ege={LineString:ze.LINES,MultiLineString:ze.LINES,MultiPolygon:ze.LINES,Polygon:ze.LINES,MultiPoint:ze.POINTS,Point:ze.POINTS};function vH(e,t){if(!c(e.geometry))return;const n=e.geometry.type,i=J_e[n],o=ege[n],r=e.geometry.coordinates;if(!c(i)||!c(r))return;const s=new Y_e;o===ze.LINES?s.lines=i(r):o===ze.POINTS&&(s.points=i(r)),s.properties=e.properties,t.features.push(s)}function tge(e,t){const n=e.features,i=n.length;for(let o=0;o<i;o++)vH(n[o],t)}const nge={FeatureCollection:tge,Feature:vH},Vx=new d;function ige(e,t,n){let i=0,o=0;const r=e.length;for(let U=0;U<r;U++){const B=e[U];if(c(B.lines)){const S=B.lines.length;for(let D=0;D<S;D++){const p=B.lines[D];i+=p.length,o+=(p.length-1)*2}}}const s=new Float32Array(i*3),a=new Float32Array(i),l=je.createTypedArray(i,o),u=je.fromTypedArray(l),h=new d(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),f=new d(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);let _=0,g=0;for(let U=0;U<r;U++){const B=e[U];if(!c(B.lines))continue;const S=B.lines.length;for(let D=0;D<S;D++){const p=B.lines[D],I=p.length;for(let O=0;O<I;O++){const F=p[O],V=d.fromDegrees(F.x,F.y,F.z,ae.WGS84,Vx),G=L.multiplyByPoint(t,V,Vx);d.minimumByComponent(h,G,h),d.maximumByComponent(f,G,f),d.pack(G,s,_*3),a[_]=U,O<I-1&&(l[g*2]=_,l[g*2+1]=_+1,g++),_++}}}const m=ct.createVertexBuffer({typedArray:s,context:n.context,usage:ke.STATIC_DRAW});m.vertexArrayDestroyable=!1;const b=ct.createVertexBuffer({typedArray:a,context:n.context,usage:ke.STATIC_DRAW});b.vertexArrayDestroyable=!1;const T=ct.createIndexBuffer({typedArray:l,context:n.context,usage:ke.STATIC_DRAW,indexDatatype:u});T.vertexArrayDestroyable=!1;const x=new yt.Attribute;x.semantic=ht.POSITION,x.componentDatatype=Z.FLOAT,x.type=qt.VEC3,x.count=i,x.min=h,x.max=f,x.buffer=m;const C=new yt.Attribute;C.semantic=ht.FEATURE_ID,C.setIndex=0,C.componentDatatype=Z.FLOAT,C.type=qt.SCALAR,C.count=i,C.buffer=b;const w=[x,C],v=new yt.Material;v.unlit=!0;const P=new yt.Indices;P.indexDatatype=u,P.count=l.length,P.buffer=T;const N=new yt.FeatureIdAttribute;N.featureCount=r,N.propertyTableId=0,N.setIndex=0,N.positionalLabel="featureId_0";const k=[N],M=new yt.Primitive;return M.attributes=w,M.indices=P,M.featureIds=k,M.primitiveType=ze.LINES,M.material=v,M}function oge(e,t,n){let i=0;const o=e.length;for(let w=0;w<o;w++){const v=e[w];c(v.points)&&(i+=v.points.length)}const r=new Float32Array(i*3),s=new Float32Array(i),a=new d(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),l=new d(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);let u=0;for(let w=0;w<o;w++){const v=e[w];if(!c(v.points))continue;const P=v.points.length;for(let N=0;N<P;N++){const k=v.points[N],M=d.fromDegrees(k.x,k.y,k.z,ae.WGS84,Vx),U=L.multiplyByPoint(t,M,Vx);d.minimumByComponent(a,U,a),d.maximumByComponent(l,U,l),d.pack(U,r,u*3),s[u]=w,u++}}const h=ct.createVertexBuffer({typedArray:r,context:n.context,usage:ke.STATIC_DRAW});h.vertexArrayDestroyable=!1;const f=ct.createVertexBuffer({typedArray:s,context:n.context,usage:ke.STATIC_DRAW});f.vertexArrayDestroyable=!1;const _=new yt.Attribute;_.semantic=ht.POSITION,_.componentDatatype=Z.FLOAT,_.type=qt.VEC3,_.count=i,_.min=a,_.max=l,_.buffer=h;const g=new yt.Attribute;g.semantic=ht.FEATURE_ID,g.setIndex=0,g.componentDatatype=Z.FLOAT,g.type=qt.SCALAR,g.count=i,g.buffer=f;const m=[_,g],b=new yt.Material;b.unlit=!0;const T=new yt.FeatureIdAttribute;T.featureCount=o,T.propertyTableId=0,T.setIndex=0,T.positionalLabel="featureId_0";const x=[T],C=new yt.Primitive;return C.attributes=m,C.featureIds=x,C.primitiveType=ze.POINTS,C.material=b,C}function rge(e,t){const n=new $_e,i=nge[e.type];c(i)&&i(e,n);const o=n.features,r=o.length;if(r===0)throw new Te("GeoJSON must have at least one feature");const s={};for(let U=0;U<r;U++){const B=o[U],S=y(B.properties,y.EMPTY_OBJECT);for(const D in S)S.hasOwnProperty(D)&&(c(s[D])||(s[D]=new Array(r)))}for(let U=0;U<r;U++){const B=o[U];for(const S in s)if(s.hasOwnProperty(S)){const D=y(B.properties[S],"");s[S][U]=D}}const a=new Bp({count:r,properties:s}),u=[new Ro({id:0,count:r,jsonMetadataTable:a})],h=Oh.fromJson({}),f=new Dl({schema:h,propertyTables:u}),_=new d(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),g=new d(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);let m=!1,b=!1;for(let U=0;U<r;U++){const B=o[U];if(c(B.lines)){m=!0;const S=B.lines.length;for(let D=0;D<S;D++){const p=B.lines[D],I=p.length;for(let O=0;O<I;O++)d.minimumByComponent(_,p[O],_),d.maximumByComponent(g,p[O],g)}}if(c(B.points)){b=!0;const S=B.points.length;for(let D=0;D<S;D++){const p=B.points[D];d.minimumByComponent(_,p,_),d.maximumByComponent(g,p,g)}}}const T=d.midpoint(_,g,new d),x=d.fromDegrees(T.x,T.y,T.z,ae.WGS84,new d),C=zt.eastNorthUpToFixedFrame(x,ae.WGS84,new L),w=L.inverseTransformation(C,new L),v=[];m&&v.push(ige(o,w,t)),b&&v.push(oge(o,w,t));const P=new yt.Node;P.index=0,P.primitives=v;const N=[P],k=new yt.Scene;k.nodes=N;const M=new yt.Components;return M.scene=k,M.nodes=N,M.transform=C,M.structuralMetadata=f,M}Ch.prototype.unload=function(){this._components=void 0};const Hx={};Hx._deprecationWarning=Xh;const Hd=Uint32Array.BYTES_PER_ELEMENT;Hx.parse=function(e,t){A.defined("arrayBuffer",e);const n=y(t,0);t=n;const i=new Uint8Array(e),o=new DataView(e);t+=Hd;const r=o.getUint32(t,!0);if(r!==1)throw new Te(`Only Instanced 3D Model version 1 is supported. Version ${r} is not.`);t+=Hd;const s=o.getUint32(t,!0);t+=Hd;const a=o.getUint32(t,!0);if(a===0)throw new Te("featureTableJsonByteLength is zero, the feature table must be defined.");t+=Hd;const l=o.getUint32(t,!0);t+=Hd;const u=o.getUint32(t,!0);t+=Hd;const h=o.getUint32(t,!0);t+=Hd;const f=o.getUint32(t,!0);if(f!==1&&f!==0)throw new Te(`Only glTF format 0 (uri) or 1 (embedded) are supported. Format ${f} is not.`);t+=Hd;const _=sa(i,t,a);t+=a;const g=new Uint8Array(e,t,l);t+=l;let m,b;u>0&&(m=sa(i,t,u),t+=u,h>0&&(b=new Uint8Array(e,t,h),b=new Uint8Array(b),t+=h));const T=n+s-t;if(T===0)throw new Te("glTF byte length must be greater than 0.");let x;return t%4===0?x=new Uint8Array(e,t,T):(Hx._deprecationWarning("i3dm-glb-unaligned","The embedded glb is not aligned to a 4-byte boundary."),x=new Uint8Array(i.subarray(t,t+T))),{gltfFormat:f,featureTableJson:_,featureTableBinary:g,batchTableJson:m,batchTableBinary:b,gltf:x}};const sge=Hx,id={NOT_LOADED:0,LOADING:1,PROCESSING:2,POST_PROCESSING:3,READY:4,FAILED:5,UNLOADED:6},pT=yt.Attribute,age=yt.FeatureIdAttribute,IH=yt.Instances;function od(e){e=y(e,y.EMPTY_OBJECT);const t=e.i3dmResource,n=e.arrayBuffer;let i=e.baseResource;const o=y(e.byteOffset,0),r=y(e.releaseGltfJson,!1),s=y(e.asynchronous,!0),a=y(e.incrementallyLoadTextures,!0),l=y(e.upAxis,Cr.Y),u=y(e.forwardAxis,Cr.X),h=y(e.loadAttributesAsTypedArray,!1),f=y(e.loadIndicesForWireframe,!1),_=y(e.loadPrimitiveOutline,!0),g=y(e.enablePick,!1);A.typeOf.object("options.i3dmResource",t),A.typeOf.object("options.arrayBuffer",n),i=c(i)?i:t.clone(),this._i3dmResource=t,this._baseResource=i,this._arrayBuffer=n,this._byteOffset=o,this._releaseGltfJson=r,this._asynchronous=s,this._incrementallyLoadTextures=a,this._upAxis=l,this._forwardAxis=u,this._loadAttributesAsTypedArray=h,this._loadIndicesForWireframe=f,this._loadPrimitiveOutline=_,this._enablePick=g,this._state=id.NOT_LOADED,this._promise=void 0,this._gltfLoader=void 0,this._buffers=[],this._components=void 0,this._transform=L.IDENTITY,this._batchTable=void 0,this._featureTable=void 0,this._instancesLength=0}c(Object.create)&&(od.prototype=Object.create(wo.prototype),od.prototype.constructor=od);Object.defineProperties(od.prototype,{texturesLoaded:{get:function(){var e;return(e=this._gltfLoader)==null?void 0:e.texturesLoaded}},cacheKey:{get:function(){}},components:{get:function(){return this._components}}});od.prototype.load=function(){if(c(this._promise))return this._promise;const e=sge.parse(this._arrayBuffer,this._byteOffset),t=e.featureTableJson,n=e.featureTableBinary,i=e.batchTableJson,o=e.batchTableBinary,r=e.gltfFormat,s=new ef(t,n);this._featureTable=s;const a=s.getGlobalProperty("INSTANCES_LENGTH");if(s.featuresLength=a,!c(a))throw new Te("Feature table global property: INSTANCES_LENGTH must be defined");this._instancesLength=a;const l=s.getGlobalProperty("RTC_CENTER",Z.FLOAT,3);c(l)&&(this._transform=L.fromTranslation(d.fromArray(l))),this._batchTable={json:i,binary:o};const u={upAxis:this._upAxis,forwardAxis:this._forwardAxis,releaseGltfJson:this._releaseGltfJson,incrementallyLoadTextures:this._incrementallyLoadTextures,loadAttributesAsTypedArray:this._loadAttributesAsTypedArray,enablePick:this._enablePick,loadIndicesForWireframe:this._loadIndicesForWireframe,loadPrimitiveOutline:this._loadPrimitiveOutline};if(r===0){let f=Ta(e.gltf);f=f.replace(/[\s\0]+$/,"");const _=this._baseResource.getDerivedResource({url:f});u.gltfResource=_,u.baseResource=_}else u.gltfResource=this._i3dmResource,u.typedArray=e.gltf;const h=new wa(u);return this._gltfLoader=h,this._state=id.LOADING,this._promise=h.load().then(()=>{if(!this.isDestroyed())return this._state=id.PROCESSING,this}).catch(f=>{if(!this.isDestroyed())throw cge(this,f)}),this._promise};function cge(e,t){e.unload(),e._state=id.FAILED;const n="Failed to load i3dm";return e.getError(n,t)}od.prototype.process=function(e){if(A.typeOf.object("frameState",e),this._state===id.READY)return!0;const t=this._gltfLoader;let n=!1;if(this._state===id.PROCESSING&&(n=t.process(e)),!n)return!1;const i=t.components;return i.transform=L.multiplyTransformation(this._transform,i.transform,i.transform),dge(this,i,e),lge(this,i),this._components=i,this._arrayBuffer=void 0,this._state=id.READY,!0};function lge(e,t){const n=e._batchTable,i=e._instancesLength;if(i===0)return;let o;if(c(n.json))o=Up({count:i,batchTable:n.json,binaryBody:n.binary});else{const r=new Ro({name:Ph.BATCH_TABLE_CLASS_NAME,count:i});o=new Dl({schema:{},propertyTables:[r]})}t.structuralMetadata=o}const mT=new d,JI=new Array(4),uge=new L;function dge(e,t,n){let i;const o=e._featureTable,r=e._instancesLength;if(r===0)return;const s=o.getGlobalProperty("RTC_CENTER",Z.FLOAT,3),a=o.getGlobalProperty("EAST_NORTH_UP"),l=o.hasProperty("NORMAL_UP")||o.hasProperty("NORMAL_UP_OCT32P")||a,u=o.hasProperty("SCALE")||o.hasProperty("SCALE_NON_UNIFORM"),h=fge(o);let f;l&&(f=new Float32Array(4*r));let _;u&&(_=new Float32Array(3*r));const g=new Float32Array(r),m=d.unpackArray(h);let b=new d;const T=new d,x=new d,C=new d,w=new $,v=new _e,P=new Array(4),N=new d,k=new Array(3),M=new L;if(!c(s)||d.equals(d.unpack(s),d.ZERO)){const G=se.fromPoints(m);for(i=0;i<m.length;i++)d.subtract(m[i],G.center,mT),h[3*i+0]=mT.x,h[3*i+1]=mT.y,h[3*i+2]=mT.z;const j=L.fromTranslation(G.center,uge);t.transform=L.multiplyTransformation(j,t.transform,t.transform)}for(i=0;i<r;i++){b=d.clone(m[i]),c(s)&&d.add(b,d.unpack(s),b),l&&(pge(o,a,i,v,b,x,T,C,w,M),_e.pack(v,P,0),f[4*i+0]=P[0],f[4*i+1]=P[1],f[4*i+2]=P[2],f[4*i+3]=P[3]),u&&(mge(o,i,N),d.pack(N,k,0),_[3*i+0]=k[0],_[3*i+1]=k[1],_[3*i+2]=k[2]);let G=o.getProperty("BATCH_ID",Z.UNSIGNED_SHORT,1,i);c(G)||(G=i),g[i]=G}const U=new IH;U.transformInWorldSpace=!0;const B=e._buffers,S=new pT;if(S.name="Instance Translation",S.semantic=hs.TRANSLATION,S.componentDatatype=Z.FLOAT,S.type=qt.VEC3,S.count=r,S.typedArray=h,!l){const G=ct.createVertexBuffer({context:n.context,typedArray:h,usage:ke.STATIC_DRAW});G.vertexArrayDestroyable=!1,B.push(G),S.buffer=G}if(U.attributes.push(S),l){const G=new pT;G.name="Instance Rotation",G.semantic=hs.ROTATION,G.componentDatatype=Z.FLOAT,G.type=qt.VEC4,G.count=r,G.typedArray=f,U.attributes.push(G)}if(u){const G=new pT;if(G.name="Instance Scale",G.semantic=hs.SCALE,G.componentDatatype=Z.FLOAT,G.type=qt.VEC3,G.count=r,l)G.typedArray=_;else{const j=ct.createVertexBuffer({context:n.context,typedArray:_,usage:ke.STATIC_DRAW});j.vertexArrayDestroyable=!1,B.push(j),G.buffer=j}U.attributes.push(G)}const D=new pT;D.name="Instance Feature ID",D.setIndex=0,D.semantic=hs.FEATURE_ID,D.componentDatatype=Z.FLOAT,D.type=qt.SCALAR,D.count=r;const p=ct.createVertexBuffer({context:n.context,typedArray:g,usage:ke.STATIC_DRAW});p.vertexArrayDestroyable=!1,B.push(p),D.buffer=p,U.attributes.push(D);const I=new age;I.propertyTableId=0,I.setIndex=0,I.positionalLabel="instanceFeatureId_0",U.featureIds.push(I);const O=t.nodes,F=O.length;let V=!1;for(i=0;i<F;i++){const G=O[i];G.primitives.length>0&&(G.instances=V?hge(U):U,V=!0)}}function hge(e){const t=new IH;t.transformInWorldSpace=e.transformInWorldSpace;const n=e.attributes,i=n.length;for(let o=0;o<i;o++){const r=Je(n[o],!1);t.attributes.push(r)}return t.featureIds=e.featureIds,t}function fge(e,t){if(e.hasProperty("POSITION"))return e.getPropertyArray("POSITION",Z.FLOAT,3);if(e.hasProperty("POSITION_QUANTIZED")){const n=e.getPropertyArray("POSITION_QUANTIZED",Z.UNSIGNED_SHORT,3),i=e.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",Z.FLOAT,3);if(!c(i))throw new Te("Global property: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");const o=e.getGlobalProperty("QUANTIZED_VOLUME_SCALE",Z.FLOAT,3);if(!c(o))throw new Te("Global property: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");const r=new Float32Array(n.length);for(let s=0;s<n.length/3;s++)for(let a=0;a<3;a++){const l=3*s+a;r[l]=n[l]/65535*o[a]+i[a]}return r}else throw new Te("Either POSITION or POSITION_QUANTIZED must be defined for each instance.")}const aF=new Array(4);function pge(e,t,n,i,o,r,s,a,l,u){const h=e.getProperty("NORMAL_UP",Z.FLOAT,3,n,JI),f=e.getProperty("NORMAL_RIGHT",Z.FLOAT,3,n,aF);let _=!1;if(c(h)){if(!c(f))throw new Te("To define a custom orientation, both NORMAL_UP and NORMAL_RIGHT must be defined.");d.unpack(h,0,r),d.unpack(f,0,s),_=!0}else{const g=e.getProperty("NORMAL_UP_OCT32P",Z.UNSIGNED_SHORT,2,n,JI),m=e.getProperty("NORMAL_RIGHT_OCT32P",Z.UNSIGNED_SHORT,2,n,aF);if(c(g)){if(!c(m))throw new Te("To define a custom orientation with oct-encoded vectors, both NORMAL_UP_OCT32P and NORMAL_RIGHT_OCT32P must be defined.");En.octDecodeInRange(g[0],g[1],65535,r),En.octDecodeInRange(m[0],m[1],65535,s),_=!0}else t?(zt.eastNorthUpToFixedFrame(o,ae.WGS84,u),L.getMatrix3(u,l)):$.clone($.IDENTITY,l)}_&&(d.cross(s,r,a),d.normalize(a,a),$.setColumn(l,0,s,l),$.setColumn(l,1,r,l),$.setColumn(l,2,a,l)),_e.fromRotationMatrix(l,i)}function mge(e,t,n){n=d.fromElements(1,1,1,n);const i=e.getProperty("SCALE",Z.FLOAT,1,t);c(i)&&d.multiplyByScalar(n,i,n);const o=e.getProperty("SCALE_NON_UNIFORM",Z.FLOAT,3,t,JI);c(o)&&(n.x*=o[0],n.y*=o[1],n.z*=o[2])}function _ge(e){const t=e._buffers,n=t.length;for(let i=0;i<n;i++){const o=t[i];o.isDestroyed()||o.destroy()}t.length=0}od.prototype.isUnloaded=function(){return this._state===id.UNLOADED};od.prototype.unload=function(){c(this._gltfLoader)&&!this._gltfLoader.isDestroyed()&&this._gltfLoader.unload(),_ge(this),this._components=void 0,this._arrayBuffer=void 0,this._state=id.UNLOADED};const gge={STOPPED:0,ANIMATING:1},Fm=Object.freeze(gge);function Oi(){this.times=void 0,this.points=void 0,E.throwInstantiationError()}Oi.getPointType=function(e){if(typeof e=="number")return Number;if(e instanceof d)return d;if(e instanceof _e)return _e;throw new E("point must be a Cartesian3, Quaternion, or number.")};Oi.prototype.evaluate=E.throwInstantiationError;Oi.prototype.findTimeInterval=function(e,t){const n=this.times,i=n.length;if(A.typeOf.number("time",e),e<n[0]||e>n[i-1])throw new E("time is out of range.");if(t=y(t,0),e>=n[t]){if(t+1<i&&e<n[t+1])return t;if(t+2<i&&e<n[t+2])return t+1}else if(t-1>=0&&e>=n[t-1])return t-1;let o;if(e>n[t])for(o=t;o<i-1&&!(e>=n[o]&&e<n[o+1]);++o);else for(o=t-1;o>=0&&!(e>=n[o]&&e<n[o+1]);--o);return o===i-1&&(o=i-2),o};Oi.prototype.wrapTime=function(e){A.typeOf.number("time",e);const t=this.times,n=t[t.length-1],i=t[0],o=n-i;let r;return e<i&&(r=Math.floor((i-e)/o)+1,e+=r*o),e>n&&(r=Math.floor((e-n)/o)+1,e-=r*o),e};Oi.prototype.clampTime=function(e){A.typeOf.number("time",e);const t=this.times;return R.clamp(e,t[0],t[t.length-1])};function Y_(e){this._value=e,this._valueType=Oi.getPointType(e)}Object.defineProperties(Y_.prototype,{value:{get:function(){return this._value}}});Y_.prototype.findTimeInterval=function(e){throw new E("findTimeInterval cannot be called on a ConstantSpline.")};Y_.prototype.wrapTime=function(e){return A.typeOf.number("time",e),0};Y_.prototype.clampTime=function(e){return A.typeOf.number("time",e),0};Y_.prototype.evaluate=function(e,t){A.typeOf.number("time",e);const n=this._value,i=this._valueType;return i===Number?n:i.clone(n,t)};function tf(e){e=y(e,y.EMPTY_OBJECT);const t=e.points,n=e.times;if(!c(t)||!c(n))throw new E("points and times are required.");if(t.length<2)throw new E("points.length must be greater than or equal to 2.");if(n.length!==t.length)throw new E("times.length must be equal to points.length.");this._times=n,this._points=t,this._pointType=Oi.getPointType(t[0]),this._lastTimeIndex=0}Object.defineProperties(tf.prototype,{times:{get:function(){return this._times}},points:{get:function(){return this._points}}});tf.prototype.findTimeInterval=Oi.prototype.findTimeInterval;tf.prototype.wrapTime=Oi.prototype.wrapTime;tf.prototype.clampTime=Oi.prototype.clampTime;tf.prototype.evaluate=function(e,t){const n=this.points,i=this.times,o=this._lastTimeIndex=this.findTimeInterval(e,this._lastTimeIndex),r=(e-i[o])/(i[o+1]-i[o]);return this._pointType===Number?(1-r)*n[o]+r*n[o+1]:(c(t)||(t=new d),d.lerp(n[o],n[o+1],r,t))};const DH={};DH.solve=function(e,t,n,i){if(!c(e)||!(e instanceof Array))throw new E("The array lower is required.");if(!c(t)||!(t instanceof Array))throw new E("The array diagonal is required.");if(!c(n)||!(n instanceof Array))throw new E("The array upper is required.");if(!c(i)||!(i instanceof Array))throw new E("The array right is required.");if(t.length!==i.length)throw new E("diagonal and right must have the same lengths.");if(e.length!==n.length)throw new E("lower and upper must have the same lengths.");if(e.length!==t.length-1)throw new E("lower and upper must be one less than the length of diagonal.");const o=new Array(n.length),r=new Array(i.length),s=new Array(i.length);let a;for(a=0;a<r.length;a++)r[a]=new d,s[a]=new d;o[0]=n[0]/t[0],r[0]=d.multiplyByScalar(i[0],1/t[0],r[0]);let l;for(a=1;a<o.length;++a)l=1/(t[a]-o[a-1]*e[a-1]),o[a]=n[a]*l,r[a]=d.subtract(i[a],d.multiplyByScalar(r[a-1],e[a-1],r[a]),r[a]),r[a]=d.multiplyByScalar(r[a],l,r[a]);for(l=1/(t[a]-o[a-1]*e[a-1]),r[a]=d.subtract(i[a],d.multiplyByScalar(r[a-1],e[a-1],r[a]),r[a]),r[a]=d.multiplyByScalar(r[a],l,r[a]),s[s.length-1]=r[r.length-1],a=s.length-2;a>=0;--a)s[a]=d.subtract(r[a],d.multiplyByScalar(s[a+1],o[a],s[a]),s[a]);return s};const PH=DH,OH=[],LH=[],RH=[],NH=[];function yge(e,t,n){const i=OH,o=RH,r=LH,s=NH;i.length=o.length=e.length-1,r.length=s.length=e.length;let a;i[0]=r[0]=1,o[0]=0;let l=s[0];for(c(l)||(l=s[0]=new d),d.clone(t,l),a=1;a<i.length-1;++a)i[a]=o[a]=1,r[a]=4,l=s[a],c(l)||(l=s[a]=new d),d.subtract(e[a+1],e[a-1],l),d.multiplyByScalar(l,3,l);return i[a]=0,o[a]=1,r[a]=4,l=s[a],c(l)||(l=s[a]=new d),d.subtract(e[a+1],e[a-1],l),d.multiplyByScalar(l,3,l),r[a+1]=1,l=s[a+1],c(l)||(l=s[a+1]=new d),d.clone(n,l),PH.solve(i,r,o,s)}function bge(e){const t=OH,n=RH,i=LH,o=NH;t.length=n.length=e.length-1,i.length=o.length=e.length;let r;t[0]=n[0]=1,i[0]=2;let s=o[0];for(c(s)||(s=o[0]=new d),d.subtract(e[1],e[0],s),d.multiplyByScalar(s,3,s),r=1;r<t.length;++r)t[r]=n[r]=1,i[r]=4,s=o[r],c(s)||(s=o[r]=new d),d.subtract(e[r+1],e[r-1],s),d.multiplyByScalar(s,3,s);return i[r]=2,s=o[r],c(s)||(s=o[r]=new d),d.subtract(e[r],e[r-1],s),d.multiplyByScalar(s,3,s),PH.solve(t,i,n,o)}function aa(e){e=y(e,y.EMPTY_OBJECT);const t=e.points,n=e.times,i=e.inTangents,o=e.outTangents;if(!c(t)||!c(n)||!c(i)||!c(o))throw new E("times, points, inTangents, and outTangents are required.");if(t.length<2)throw new E("points.length must be greater than or equal to 2.");if(n.length!==t.length)throw new E("times.length must be equal to points.length.");if(i.length!==o.length||i.length!==t.length-1)throw new E("inTangents and outTangents must have a length equal to points.length - 1.");if(this._times=n,this._points=t,this._pointType=Oi.getPointType(t[0]),this._pointType!==Oi.getPointType(i[0])||this._pointType!==Oi.getPointType(o[0]))throw new E("inTangents and outTangents must be of the same type as points.");this._inTangents=i,this._outTangents=o,this._lastTimeIndex=0}Object.defineProperties(aa.prototype,{times:{get:function(){return this._times}},points:{get:function(){return this._points}},inTangents:{get:function(){return this._inTangents}},outTangents:{get:function(){return this._outTangents}}});aa.createC1=function(e){e=y(e,y.EMPTY_OBJECT);const t=e.times,n=e.points,i=e.tangents;if(!c(n)||!c(t)||!c(i))throw new E("points, times and tangents are required.");if(n.length<2)throw new E("points.length must be greater than or equal to 2.");if(t.length!==n.length||t.length!==i.length)throw new E("times, points and tangents must have the same length.");const o=i.slice(0,i.length-1),r=i.slice(1,i.length);return new aa({times:t,points:n,inTangents:r,outTangents:o})};aa.createNaturalCubic=function(e){e=y(e,y.EMPTY_OBJECT);const t=e.times,n=e.points;if(!c(n)||!c(t))throw new E("points and times are required.");if(n.length<2)throw new E("points.length must be greater than or equal to 2.");if(t.length!==n.length)throw new E("times.length must be equal to points.length.");if(n.length<3)return new tf({points:n,times:t});const i=bge(n),o=i.slice(0,i.length-1),r=i.slice(1,i.length);return new aa({times:t,points:n,inTangents:r,outTangents:o})};aa.createClampedCubic=function(e){e=y(e,y.EMPTY_OBJECT);const t=e.times,n=e.points,i=e.firstTangent,o=e.lastTangent;if(!c(n)||!c(t)||!c(i)||!c(o))throw new E("points, times, firstTangent and lastTangent are required.");if(n.length<2)throw new E("points.length must be greater than or equal to 2.");if(t.length!==n.length)throw new E("times.length must be equal to points.length.");const r=Oi.getPointType(n[0]);if(r!==Oi.getPointType(i)||r!==Oi.getPointType(o))throw new E("firstTangent and lastTangent must be of the same type as points.");if(n.length<3)return new tf({points:n,times:t});const s=yge(n,i,o),a=s.slice(0,s.length-1),l=s.slice(1,s.length);return new aa({times:t,points:n,inTangents:l,outTangents:a})};aa.hermiteCoefficientMatrix=new L(2,-3,0,1,-2,3,0,0,1,-2,1,0,1,-1,0,0);aa.prototype.findTimeInterval=Oi.prototype.findTimeInterval;const Tge=new te,fm=new d;aa.prototype.wrapTime=Oi.prototype.wrapTime;aa.prototype.clampTime=Oi.prototype.clampTime;aa.prototype.evaluate=function(e,t){const n=this.points,i=this.times,o=this.inTangents,r=this.outTangents;this._lastTimeIndex=this.findTimeInterval(e,this._lastTimeIndex);const s=this._lastTimeIndex,a=i[s+1]-i[s],l=(e-i[s])/a,u=Tge;u.z=l,u.y=l*l,u.x=u.y*l,u.w=1;const h=L.multiplyByVector(aa.hermiteCoefficientMatrix,u,u);h.z*=a,h.w*=a;const f=this._pointType;return f===Number?n[s]*h.x+n[s+1]*h.y+r[s]*h.z+o[s]*h.w:(c(t)||(t=new f),t=f.multiplyByScalar(n[s],h.x,t),f.multiplyByScalar(n[s+1],h.y,fm),f.add(t,fm,t),f.multiplyByScalar(r[s],h.z,fm),f.add(t,fm,t),f.multiplyByScalar(o[s],h.w,fm),f.add(t,fm,t))};function $_(e){e=y(e,y.EMPTY_OBJECT);const t=e.points,n=e.times;if(!c(t)||!c(n))throw new E("points and times are required.");if(t.length<2)throw new E("points.length must be greater than or equal to 2.");if(n.length!==t.length)throw new E("times.length must be equal to points.length.");this._times=n,this._points=t,this._pointType=Oi.getPointType(t[0]),this._lastTimeIndex=0}Object.defineProperties($_.prototype,{times:{get:function(){return this._times}},points:{get:function(){return this._points}}});$_.prototype.findTimeInterval=Oi.prototype.findTimeInterval;$_.prototype.wrapTime=Oi.prototype.wrapTime;$_.prototype.clampTime=Oi.prototype.clampTime;$_.prototype.evaluate=function(e,t){const n=this.points;this._lastTimeIndex=this.findTimeInterval(e,this._lastTimeIndex);const i=this._lastTimeIndex,o=this._pointType;return o===Number?n[i]:(c(t)||(t=new o),o.clone(n[i],t))};function Age(e){const t=e.points,n=e.times;return function(i,o){c(o)||(o=new _e);const r=e._lastTimeIndex=e.findTimeInterval(i,e._lastTimeIndex),s=(i-n[r])/(n[r+1]-n[r]),a=t[r],l=t[r+1];return _e.fastSlerp(a,l,s,o)}}function X_(e){e=y(e,y.EMPTY_OBJECT);const t=e.points,n=e.times;if(!c(t)||!c(n))throw new E("points and times are required.");if(t.length<2)throw new E("points.length must be greater than or equal to 2.");if(n.length!==t.length)throw new E("times.length must be equal to points.length.");this._times=n,this._points=t,this._evaluateFunction=Age(this),this._lastTimeIndex=0}Object.defineProperties(X_.prototype,{times:{get:function(){return this._times}},points:{get:function(){return this._points}}});X_.prototype.findTimeInterval=Oi.prototype.findTimeInterval;X_.prototype.wrapTime=Oi.prototype.wrapTime;X_.prototype.clampTime=Oi.prototype.clampTime;X_.prototype.evaluate=function(e,t){return this._evaluateFunction(e,t)};const Qm=yt.AnimatedPropertyType;function IO(e){e=y(e,y.EMPTY_OBJECT);const t=e.channel,n=e.runtimeAnimation,i=e.runtimeNode;A.typeOf.object("options.channel",t),A.typeOf.object("options.runtimeAnimation",n),A.typeOf.object("options.runtimeNode",i),this._channel=t,this._runtimeAnimation=n,this._runtimeNode=i,this._splines=[],this._path=void 0,Sge(this)}Object.defineProperties(IO.prototype,{channel:{get:function(){return this._channel}},runtimeAnimation:{get:function(){return this._runtimeAnimation}},runtimeNode:{get:function(){return this._runtimeNode}},splines:{get:function(){return this._splines}}});function xge(e,t){const n=[],i=[],o=[],r=t.length;for(let s=0;s<r;s+=3)i.push(t[s]),n.push(t[s+1]),o.push(t[s+2]);return i.splice(0,1),o.length=o.length-1,new aa({times:e,points:n,inTangents:i,outTangents:o})}function cF(e,t,n,i){if(e.length===1&&t.length===1)return new Y_(t[0]);switch(n){case r_.STEP:return new $_({times:e,points:t});case r_.CUBICSPLINE:return xge(e,t);case r_.LINEAR:return i===Qm.ROTATION?new X_({times:e,points:t}):new tf({times:e,points:t})}}function Cge(e,t,n,i,o){const r=[];if(i===Qm.WEIGHTS){const a=t.length/o;let l,u;for(l=0;l<o;l++){const h=new Array(a);let f=l;if(n===r_.CUBICSPLINE)for(u=0;u<a;u+=3)h[u]=t[f],h[u+1]=t[f+o],h[u+2]=t[f+2*o],f+=o*3;else for(u=0;u<a;u++)h[u]=t[f],f+=o;r.push(cF(e,h,n,i))}}else r.push(cF(e,t,n,i));return r}const Ege=new d,wge=new _e;function Sge(e){const t=e._channel,n=t.sampler,i=n.input,o=n.output,r=n.interpolation,a=t.target.path,l=e._runtimeNode,u=c(l.morphWeights)?l.morphWeights.length:1,h=Cge(i,o,r,a,u);e._splines=h,e._path=a}IO.prototype.animate=function(e){const t=this._splines,n=this._path,i=this._runtimeAnimation.model,o=this._runtimeNode;if(n===Qm.WEIGHTS){const r=o.morphWeights,s=r.length;for(let a=0;a<s;a++){const l=t[a],u=i.clampAnimations?l.clampTime(e):l.wrapTime(e);r[a]=l.evaluate(u)}}else{if(o.userAnimated)return;{const r=t[0],s=i.clampAnimations?r.clampTime(e):r.wrapTime(e);n===Qm.TRANSLATION||n===Qm.SCALE?o[n]=r.evaluate(s,Ege):n===Qm.ROTATION&&(o[n]=r.evaluate(s,wge))}}};function DO(e,t,n){this._animation=t,this._name=t.name,this._runtimeChannels=void 0,this._startTime=ie.clone(n.startTime),this._delay=y(n.delay,0),this._stopTime=ie.clone(n.stopTime),this.removeOnStop=y(n.removeOnStop,!1),this._multiplier=y(n.multiplier,1),this._reverse=y(n.reverse,!1),this._loop=y(n.loop,Wf.NONE),this._animationTime=n.animationTime,this._prevAnimationDelta=void 0,this.start=new Le,this.update=new Le,this.stop=new Le,this._state=Fm.STOPPED,this._computedStartTime=void 0,this._duration=void 0;const i=this;this._raiseStartEvent=function(){i.start.raiseEvent(e,i)},this._updateEventTime=0,this._raiseUpdateEvent=function(){i.update.raiseEvent(e,i,i._updateEventTime)},this._raiseStopEvent=function(){i.stop.raiseEvent(e,i)},this._model=e,this._localStartTime=void 0,this._localStopTime=void 0,vge(this)}Object.defineProperties(DO.prototype,{animation:{get:function(){return this._animation}},name:{get:function(){return this._name}},runtimeChannels:{get:function(){return this._runtimeChannels}},model:{get:function(){return this._model}},localStartTime:{get:function(){return this._localStartTime}},localStopTime:{get:function(){return this._localStopTime}},startTime:{get:function(){return this._startTime}},delay:{get:function(){return this._delay}},stopTime:{get:function(){return this._stopTime}},multiplier:{get:function(){return this._multiplier}},reverse:{get:function(){return this._reverse}},loop:{get:function(){return this._loop}},animationTime:{get:function(){return this._animationTime}}});function vge(e){let t=Number.MAX_VALUE,n=-Number.MAX_VALUE;const i=e._model.sceneGraph,r=e._animation.channels,s=r.length,a=[];for(let l=0;l<s;l++){const u=r[l],h=u.target;if(!c(h))continue;const f=h.node.index,_=i._runtimeNodes[f],g=new IO({channel:u,runtimeAnimation:e,runtimeNode:_}),m=u.sampler.input;t=Math.min(t,m[0]),n=Math.max(n,m[m.length-1]),a.push(g)}e._runtimeChannels=a,e._localStartTime=t,e._localStopTime=n}DO.prototype.animate=function(e){const t=this._runtimeChannels,n=t.length;for(let i=0;i<n;i++)t[i].animate(e)};function Td(e){this.animationAdded=new Le,this.animationRemoved=new Le,this.animateWhilePaused=!1,this._model=e,this._runtimeAnimations=[],this._previousTime=void 0}Object.defineProperties(Td.prototype,{length:{get:function(){return this._runtimeAnimations.length}},model:{get:function(){return this._model}}});function eD(e,t,n){const i=e._model,o=new DO(i,t,n);return e._runtimeAnimations.push(o),e.animationAdded.raiseEvent(i,o),o}Td.prototype.add=function(e){e=y(e,y.EMPTY_OBJECT);const t=this._model;if(!t.ready)throw new E("Animations are not loaded. Wait for Model.ready to be true.");const n=t.sceneGraph.components.animations;if(!c(e.name)&&!c(e.index))throw new E("Either options.name or options.index must be defined.");if(c(e.multiplier)&&e.multiplier<=0)throw new E("options.multiplier must be greater than zero.");if(c(e.index)&&(e.index>=n.length||e.index<0))throw new E("options.index must be a valid animation index.");let i=e.index;if(c(i))return eD(this,n[i],e);const o=n.length;for(let r=0;r<o;++r)if(n[r].name===e.name){i=r;break}if(!c(i))throw new E("options.name must be a valid animation name.");return eD(this,n[i],e)};Td.prototype.addAll=function(e){e=y(e,y.EMPTY_OBJECT);const t=this._model;if(!t.ready)throw new E("Animations are not loaded. Wait for Model.ready to be true.");if(c(e.multiplier)&&e.multiplier<=0)throw new E("options.multiplier must be greater than zero.");const n=t.sceneGraph.components.animations,i=[],o=n.length;for(let r=0;r<o;++r){const s=eD(this,n[r],e);i.push(s)}return i};Td.prototype.remove=function(e){if(!c(e))return!1;const t=this._runtimeAnimations,n=t.indexOf(e);return n!==-1?(t.splice(n,1),this.animationRemoved.raiseEvent(this._model,e),!0):!1};Td.prototype.removeAll=function(){const e=this._model,t=this._runtimeAnimations,n=t.length;this._runtimeAnimations.length=0;for(let i=0;i<n;++i)this.animationRemoved.raiseEvent(e,t[i])};Td.prototype.contains=function(e){return c(e)?this._runtimeAnimations.indexOf(e)!==-1:!1};Td.prototype.get=function(e){if(!c(e))throw new E("index is required.");if(e>=this._runtimeAnimations.length||e<0)throw new E("index must be valid within the range of the collection");return this._runtimeAnimations[e]};const _T=[];function Ige(e,t,n){return function(){e.animationRemoved.raiseEvent(t,n)}}Td.prototype.update=function(e){const t=this._runtimeAnimations;let n=t.length;if(n===0)return this._previousTime=void 0,!1;if(!this.animateWhilePaused&&ie.equals(e.time,this._previousTime))return!1;this._previousTime=ie.clone(e.time,this._previousTime);let i=!1;const o=e.time,r=this._model;for(let s=0;s<n;++s){const a=t[s];c(a._computedStartTime)||(a._computedStartTime=ie.addSeconds(y(a.startTime,o),a.delay,new ie)),c(a._duration)||(a._duration=a.localStopTime*(1/a.multiplier));const l=a._computedStartTime,u=a._duration,h=a.stopTime,f=ie.lessThanOrEquals(l,o),_=c(h)&&ie.greaterThan(o,h);let g=0;if(u!==0){const T=ie.secondsDifference(_?h:o,l);g=c(a._animationTime)?a._animationTime(u,T):T/u}const m=a.loop===Wf.REPEAT||a.loop===Wf.MIRRORED_REPEAT,b=(f||m&&!c(a.startTime))&&(g<=1||m)&&!_;if(g===a._prevAnimationDelta){const T=a._state===Fm.STOPPED;if(b!==T)continue}if(a._prevAnimationDelta=g,b||a._state===Fm.ANIMATING){if(b&&a._state===Fm.STOPPED&&(a._state=Fm.ANIMATING,a.start.numberOfListeners>0&&e.afterRender.push(a._raiseStartEvent)),a.loop===Wf.REPEAT)g=g-Math.floor(g);else if(a.loop===Wf.MIRRORED_REPEAT){const x=Math.floor(g),C=g-x;g=x%2===1?1-C:C}a.reverse&&(g=1-g);let T=g*u*a.multiplier;T=R.clamp(T,a.localStartTime,a.localStopTime),a.animate(T),a.update.numberOfListeners>0&&(a._updateEventTime=T,e.afterRender.push(a._raiseUpdateEvent)),i=!0,b||(a._state=Fm.STOPPED,a.stop.numberOfListeners>0&&e.afterRender.push(a._raiseStopEvent),a.removeOnStop&&_T.push(a))}}n=_T.length;for(let s=0;s<n;++s){const a=_T[s];t.splice(t.indexOf(a),1),e.afterRender.push(Ige(this,r,a))}return _T.length=0,i};function kp(e){this._model=e.model,this._featureTable=e.featureTable,this._featureId=e.featureId,this._color=void 0}Object.defineProperties(kp.prototype,{show:{get:function(){return this._featureTable.getShow(this._featureId)},set:function(e){this._featureTable.setShow(this._featureId,e)}},color:{get:function(){return c(this._color)||(this._color=new z),this._featureTable.getColor(this._featureId,this._color)},set:function(e){this._featureTable.setColor(this._featureId,e)}},primitive:{get:function(){return this._model}},featureTable:{get:function(){return this._featureTable}},featureId:{get:function(){return this._featureId}}});kp.prototype.hasProperty=function(e){return this._featureTable.hasProperty(this._featureId,e)};kp.prototype.getProperty=function(e){return this._featureTable.getProperty(this._featureId,e)};kp.prototype.getPropertyInherited=function(e){return this._featureTable.hasPropertyBySemantic(this._featureId,e)?this._featureTable.getPropertyBySemantic(this._featureId,e):this._featureTable.getProperty(this._featureId,e)};kp.prototype.getPropertyIds=function(e){return this._featureTable.getPropertyIds(e)};kp.prototype.setProperty=function(e,t){return this._featureTable.setProperty(this._featureId,e,t)};const py={ALL_OPAQUE:0,ALL_TRANSLUCENT:1,OPAQUE_AND_TRANSLUCENT:2};py.getStyleCommandsNeeded=function(e,t){return t===0?py.ALL_OPAQUE:t===e?py.ALL_TRANSLUCENT:py.OPAQUE_AND_TRANSLUCENT};const b0=Object.freeze(py),eh={GLTF:"GLTF",TILE_GLTF:"TILE_GLTF",TILE_B3DM:"B3DM",TILE_I3DM:"I3DM",TILE_PNTS:"PNTS",TILE_GEOJSON:"TILE_GEOJSON"};eh.is3DTiles=function(e){switch(A.typeOf.string("modelType",e),e){case eh.TILE_GLTF:case eh.TILE_B3DM:case eh.TILE_I3DM:case eh.TILE_PNTS:case eh.TILE_GEOJSON:return!0;case eh.GLTF:return!1;default:throw new E("modelType is not a valid value.")}};const bs=Object.freeze(eh);function lo(e){const t=e.model,n=e.propertyTable;A.typeOf.object("propertyTable",n),A.typeOf.object("model",t),this._propertyTable=n,this._model=t,this._features=void 0,this._featuresLength=0,this._batchTexture=void 0,this._styleCommandsNeededDirty=!1,this._styleCommandsNeeded=b0.ALL_OPAQUE,Dge(this)}Object.defineProperties(lo.prototype,{batchTexture:{get:function(){return this._batchTexture}},featuresLength:{get:function(){return this._featuresLength}},batchTextureByteLength:{get:function(){return c(this._batchTexture)?this._batchTexture.byteLength:0}},styleCommandsNeededDirty:{get:function(){return this._styleCommandsNeededDirty}}});function Dge(e){const t=e._model,n=bs.is3DTiles(t.type),i=e._propertyTable.count;if(i===0)return;let o;const r=new Array(i);if(n){const s=t.content;for(o=0;o<i;o++)r[o]=new Ir(s,o)}else for(o=0;o<i;o++)r[o]=new kp({model:t,featureId:o,featureTable:e});e._features=r,e._featuresLength=i,e._batchTexture=new Bi({featuresLength:i,owner:e,statistics:n?t.content.tileset.statistics:void 0})}lo.prototype.update=function(e){this._styleCommandsNeededDirty=!1,this._batchTexture.update(void 0,e);const t=b0.getStyleCommandsNeeded(this._featuresLength,this._batchTexture.translucentFeaturesLength);this._styleCommandsNeeded!==t&&(this._styleCommandsNeededDirty=!0,this._styleCommandsNeeded=t)};lo.prototype.setShow=function(e,t){this._batchTexture.setShow(e,t)};lo.prototype.setAllShow=function(e){this._batchTexture.setAllShow(e)};lo.prototype.getShow=function(e){return this._batchTexture.getShow(e)};lo.prototype.setColor=function(e,t){this._batchTexture.setColor(e,t)};lo.prototype.setAllColor=function(e){this._batchTexture.setAllColor(e)};lo.prototype.getColor=function(e,t){return this._batchTexture.getColor(e,t)};lo.prototype.getPickColor=function(e){return this._batchTexture.getPickColor(e)};lo.prototype.getFeature=function(e){return this._features[e]};lo.prototype.hasProperty=function(e,t){return this._propertyTable.hasProperty(e,t)};lo.prototype.hasPropertyBySemantic=function(e,t){return this._propertyTable.hasPropertyBySemantic(e,t)};lo.prototype.getProperty=function(e,t){return this._propertyTable.getProperty(e,t)};lo.prototype.getPropertyBySemantic=function(e,t){return this._propertyTable.getPropertyBySemantic(e,t)};lo.prototype.getPropertyIds=function(e){return this._propertyTable.getPropertyIds(e)};lo.prototype.setProperty=function(e,t,n){return this._propertyTable.setProperty(e,t,n)};lo.prototype.isClass=function(e,t){return this._propertyTable.isClass(e,t)};lo.prototype.isExactClass=function(e,t){return this._propertyTable.isExactClass(e,t)};lo.prototype.getExactClassName=function(e){return this._propertyTable.getExactClassName(e)};const Pge=new z;lo.prototype.applyStyle=function(e){if(!c(e)){this.setAllColor(Bi.DEFAULT_COLOR_VALUE),this.setAllShow(Bi.DEFAULT_SHOW_VALUE);return}for(let t=0;t<this._featuresLength;t++){const n=this.getFeature(t),i=c(e.color)?y(e.color.evaluateColor(n,Pge),Bi.DEFAULT_COLOR_VALUE):Bi.DEFAULT_COLOR_VALUE,o=c(e.show)?y(e.show.evaluate(n),Bi.DEFAULT_SHOW_VALUE):Bi.DEFAULT_SHOW_VALUE;this.setColor(t,i),this.setShow(t,o)}};lo.prototype.isDestroyed=function(){return!1};lo.prototype.destroy=function(e){this._batchTexture=this._batchTexture&&this._batchTexture.destroy(),ve(this)};const Oge=`
|
|
precision highp float;
|
|
czm_modelMaterial defaultModelMaterial()
|
|
{
|
|
czm_modelMaterial material;
|
|
material.diffuse = vec3(0.0);
|
|
material.specular = vec3(1.0);
|
|
material.roughness = 1.0;
|
|
material.occlusion = 1.0;
|
|
material.normalEC = vec3(0.0, 0.0, 1.0);
|
|
material.emissive = vec3(0.0);
|
|
material.alpha = 1.0;
|
|
return material;
|
|
}
|
|
|
|
vec4 handleAlpha(vec3 color, float alpha)
|
|
{
|
|
#ifdef ALPHA_MODE_MASK
|
|
if (alpha < u_alphaCutoff) {
|
|
discard;
|
|
}
|
|
#endif
|
|
|
|
return vec4(color, alpha);
|
|
}
|
|
|
|
SelectedFeature selectedFeature;
|
|
|
|
void main()
|
|
{
|
|
#ifdef HAS_MODEL_SPLITTER
|
|
modelSplitterStage();
|
|
#endif
|
|
|
|
czm_modelMaterial material = defaultModelMaterial();
|
|
|
|
ProcessedAttributes attributes;
|
|
geometryStage(attributes);
|
|
|
|
FeatureIds featureIds;
|
|
featureIdStage(featureIds, attributes);
|
|
|
|
Metadata metadata;
|
|
MetadataClass metadataClass;
|
|
MetadataStatistics metadataStatistics;
|
|
metadataStage(metadata, metadataClass, metadataStatistics, attributes);
|
|
|
|
#ifdef HAS_SELECTED_FEATURE_ID
|
|
selectedFeatureIdStage(selectedFeature, featureIds);
|
|
#endif
|
|
|
|
#ifndef CUSTOM_SHADER_REPLACE_MATERIAL
|
|
materialStage(material, attributes, selectedFeature);
|
|
#endif
|
|
|
|
#ifdef HAS_CUSTOM_FRAGMENT_SHADER
|
|
customShaderStage(material, attributes, featureIds, metadata, metadataClass, metadataStatistics);
|
|
#endif
|
|
|
|
lightingStage(material, attributes);
|
|
|
|
#ifdef HAS_SELECTED_FEATURE_ID
|
|
cpuStylingStage(material, selectedFeature);
|
|
#endif
|
|
|
|
#ifdef HAS_MODEL_COLOR
|
|
modelColorStage(material);
|
|
#endif
|
|
|
|
#ifdef HAS_PRIMITIVE_OUTLINE
|
|
primitiveOutlineStage(material);
|
|
#endif
|
|
|
|
vec4 color = handleAlpha(material.diffuse, material.alpha);
|
|
|
|
#ifdef HAS_CLIPPING_PLANES
|
|
modelClippingPlanesStage(color);
|
|
#endif
|
|
|
|
#ifdef ENABLE_CLIPPING_POLYGONS
|
|
modelClippingPolygonsStage();
|
|
#endif
|
|
|
|
#if defined(HAS_SILHOUETTE) && defined(HAS_NORMALS)
|
|
silhouetteStage(color);
|
|
#endif
|
|
|
|
#ifdef HAS_ATMOSPHERE
|
|
atmosphereStage(color, attributes);
|
|
#endif
|
|
|
|
out_FragColor = color;
|
|
}
|
|
`,Lge=`precision highp float;
|
|
|
|
czm_modelVertexOutput defaultVertexOutput(vec3 positionMC) {
|
|
czm_modelVertexOutput vsOutput;
|
|
vsOutput.positionMC = positionMC;
|
|
vsOutput.pointSize = 1.0;
|
|
return vsOutput;
|
|
}
|
|
|
|
void main()
|
|
{
|
|
// Initialize the attributes struct with all
|
|
// attributes except quantized ones.
|
|
ProcessedAttributes attributes;
|
|
initializeAttributes(attributes);
|
|
|
|
// Dequantize the quantized ones and add them to the
|
|
// attributes struct.
|
|
#ifdef USE_DEQUANTIZATION
|
|
dequantizationStage(attributes);
|
|
#endif
|
|
|
|
#ifdef HAS_MORPH_TARGETS
|
|
morphTargetsStage(attributes);
|
|
#endif
|
|
|
|
#ifdef HAS_SKINNING
|
|
skinningStage(attributes);
|
|
#endif
|
|
|
|
#ifdef HAS_PRIMITIVE_OUTLINE
|
|
primitiveOutlineStage();
|
|
#endif
|
|
|
|
// Compute the bitangent according to the formula in the glTF spec.
|
|
// Normal and tangents can be affected by morphing and skinning, so
|
|
// the bitangent should not be computed until their values are finalized.
|
|
#ifdef HAS_BITANGENTS
|
|
attributes.bitangentMC = normalize(cross(attributes.normalMC, attributes.tangentMC) * attributes.tangentSignMC);
|
|
#endif
|
|
|
|
FeatureIds featureIds;
|
|
featureIdStage(featureIds, attributes);
|
|
|
|
#ifdef HAS_SELECTED_FEATURE_ID
|
|
SelectedFeature feature;
|
|
selectedFeatureIdStage(feature, featureIds);
|
|
// Handle any show properties that come from the style.
|
|
cpuStylingStage(attributes.positionMC, feature);
|
|
#endif
|
|
|
|
#if defined(USE_2D_POSITIONS) || defined(USE_2D_INSTANCING)
|
|
// The scene mode 2D pipeline stage and instancing stage add a different
|
|
// model view matrix to accurately project the model to 2D. However, the
|
|
// output positions and normals should be transformed by the 3D matrices
|
|
// to keep the data the same for the fragment shader.
|
|
mat4 modelView = czm_modelView3D;
|
|
mat3 normal = czm_normal3D;
|
|
#else
|
|
// These are used for individual model projection because they will
|
|
// automatically change based on the scene mode.
|
|
mat4 modelView = czm_modelView;
|
|
mat3 normal = czm_normal;
|
|
#endif
|
|
|
|
// Update the position for this instance in place
|
|
#ifdef HAS_INSTANCING
|
|
|
|
// The legacy instance stage is used when rendering i3dm models that
|
|
// encode instances transforms in world space, as opposed to glTF models
|
|
// that use EXT_mesh_gpu_instancing, where instance transforms are encoded
|
|
// in object space.
|
|
#ifdef USE_LEGACY_INSTANCING
|
|
mat4 instanceModelView;
|
|
mat3 instanceModelViewInverseTranspose;
|
|
|
|
legacyInstancingStage(attributes, instanceModelView, instanceModelViewInverseTranspose);
|
|
|
|
modelView = instanceModelView;
|
|
normal = instanceModelViewInverseTranspose;
|
|
#else
|
|
instancingStage(attributes);
|
|
#endif
|
|
|
|
#ifdef USE_PICKING
|
|
v_pickColor = a_pickColor;
|
|
#endif
|
|
|
|
#endif
|
|
|
|
Metadata metadata;
|
|
MetadataClass metadataClass;
|
|
MetadataStatistics metadataStatistics;
|
|
metadataStage(metadata, metadataClass, metadataStatistics, attributes);
|
|
|
|
#ifdef HAS_VERTICAL_EXAGGERATION
|
|
verticalExaggerationStage(attributes);
|
|
#endif
|
|
|
|
#ifdef HAS_CUSTOM_VERTEX_SHADER
|
|
czm_modelVertexOutput vsOutput = defaultVertexOutput(attributes.positionMC);
|
|
customShaderStage(vsOutput, attributes, featureIds, metadata, metadataClass, metadataStatistics);
|
|
#endif
|
|
|
|
// Compute the final position in each coordinate system needed.
|
|
// This returns the value that will be assigned to gl_Position.
|
|
vec4 positionClip = geometryStage(attributes, modelView, normal);
|
|
|
|
// This must go after the geometry stage as it needs v_positionWC
|
|
#ifdef HAS_ATMOSPHERE
|
|
atmosphereStage(attributes);
|
|
#endif
|
|
|
|
#ifdef ENABLE_CLIPPING_POLYGONS
|
|
modelClippingPolygonsStage(attributes);
|
|
#endif
|
|
|
|
#ifdef HAS_SILHOUETTE
|
|
silhouetteStage(attributes, positionClip);
|
|
#endif
|
|
|
|
#ifdef HAS_POINT_CLOUD_SHOW_STYLE
|
|
float show = pointCloudShowStylingStage(attributes, metadata);
|
|
#else
|
|
float show = 1.0;
|
|
#endif
|
|
|
|
#ifdef HAS_POINT_CLOUD_BACK_FACE_CULLING
|
|
show *= pointCloudBackFaceCullingStage();
|
|
#endif
|
|
|
|
#ifdef HAS_POINT_CLOUD_COLOR_STYLE
|
|
v_pointCloudColor = pointCloudColorStylingStage(attributes, metadata);
|
|
#endif
|
|
|
|
#ifdef PRIMITIVE_TYPE_POINTS
|
|
#ifdef HAS_CUSTOM_VERTEX_SHADER
|
|
gl_PointSize = vsOutput.pointSize;
|
|
#elif defined(HAS_POINT_CLOUD_POINT_SIZE_STYLE) || defined(HAS_POINT_CLOUD_ATTENUATION)
|
|
gl_PointSize = pointCloudPointSizeStylingStage(attributes, metadata);
|
|
#else
|
|
gl_PointSize = 1.0;
|
|
#endif
|
|
|
|
gl_PointSize *= show;
|
|
#endif
|
|
|
|
gl_Position = show * positionClip;
|
|
}
|
|
`;function PO(e){e=y(e,y.EMPTY_OBJECT);const t=e.command,n=e.primitiveRenderResources;A.typeOf.object("options.command",t),A.typeOf.object("options.primitiveRenderResources",n);const i=n.model;this._command=t,this._model=i,this._runtimePrimitive=n.runtimePrimitive,this._modelMatrix=t.modelMatrix,this._boundingVolume=t.boundingVolume,this._cullFace=t.renderState.cull.face;const o=i.classificationType;this._classificationType=o,this._classifiesTerrain=o!==Ui.CESIUM_3D_TILE,this._classifies3DTiles=o!==Ui.TERRAIN,this._useDebugWireframe=i._enableDebugWireframe&&i.debugWireframe,this._pickId=n.pickId,this._commandListTerrain=[],this._commandList3DTiles=[],this._commandListIgnoreShow=[],this._commandListDebugWireframe=[],this._commandListTerrainPicking=[],this._commandList3DTilesPicking=[],Fge(this)}function Rge(e){return{colorMask:{red:!1,green:!1,blue:!1,alpha:!1},stencilTest:{enabled:!0,frontFunction:e,frontOperation:{fail:nt.KEEP,zFail:nt.DECREMENT_WRAP,zPass:nt.KEEP},backFunction:e,backOperation:{fail:nt.KEEP,zFail:nt.INCREMENT_WRAP,zPass:nt.KEEP},reference:At.CESIUM_3D_TILE_MASK,mask:At.CESIUM_3D_TILE_MASK},stencilMask:At.CLASSIFICATION_MASK,depthTest:{enabled:!0,func:lp.LESS_OR_EQUAL},depthMask:!1}}const Nge={stencilTest:{enabled:!0,frontFunction:Pn.NOT_EQUAL,frontOperation:{fail:nt.ZERO,zFail:nt.ZERO,zPass:nt.ZERO},backFunction:Pn.NOT_EQUAL,backOperation:{fail:nt.ZERO,zFail:nt.ZERO,zPass:nt.ZERO},reference:0,mask:At.CLASSIFICATION_MASK},stencilMask:At.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1,blending:Zn.PRE_MULTIPLIED_ALPHA_BLEND},Mge={stencilTest:{enabled:!0,frontFunction:Pn.NOT_EQUAL,frontOperation:{fail:nt.ZERO,zFail:nt.ZERO,zPass:nt.ZERO},backFunction:Pn.NOT_EQUAL,backOperation:{fail:nt.ZERO,zFail:nt.ZERO,zPass:nt.ZERO},reference:0,mask:At.CLASSIFICATION_MASK},stencilMask:At.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1},MH=[];function Fge(e){const t=e._command,n=MH;if(e._useDebugWireframe){t.pass=xe.OPAQUE,n.length=0,n.push(t),e._commandListDebugWireframe=Oy(e,n,e._commandListDebugWireframe);const r=e._commandListDebugWireframe,s=r.length;for(let a=0;a<s;a++){const l=r[a];l.count*=2,l.offset*=2}return}const o=e.model.allowPicking;if(e._classifiesTerrain){const r=xe.TERRAIN_CLASSIFICATION,s=tD(t,r),a=lF(t,r);n.length=0,n.push(s,a),e._commandListTerrain=Oy(e,n,e._commandListTerrain),o&&(e._commandListTerrainPicking=uF(e,n,e._commandListTerrainPicking))}if(e._classifies3DTiles){const r=xe.CESIUM_3D_TILE_CLASSIFICATION,s=tD(t,r),a=lF(t,r);n.length=0,n.push(s,a),e._commandList3DTiles=Oy(e,n,e._commandList3DTiles),o&&(e._commandList3DTilesPicking=uF(e,n,e._commandList3DTilesPicking))}}function Oy(e,t,n){const i=e._runtimePrimitive,o=i.batchLengths,r=i.batchOffsets,s=o.length,a=t.length;for(let l=0;l<s;l++){const u=o[l],h=r[l];for(let f=0;f<a;f++){const _=t[f],g=Ze.shallowClone(_);g.count=u,g.offset=h,n.push(g)}}return n}function tD(e,t){const n=Ze.shallowClone(e);n.cull=!1,n.pass=t;const i=t===xe.TERRAIN_CLASSIFICATION?Pn.ALWAYS:Pn.EQUAL,o=Rge(i);return n.renderState=Ue.fromCache(o),n}function lF(e,t){const n=Ze.shallowClone(e);return n.cull=!1,n.pass=t,n.renderState=Ue.fromCache(Nge),n}const Bge=[];function uF(e,t,n){const i=Ue.fromCache(Mge),o=t[0],r=t[1],s=Ze.shallowClone(o);s.cull=!0,s.pickOnly=!0;const a=Ze.shallowClone(r);a.cull=!0,a.pickOnly=!0,a.renderState=i,a.pickId=e._pickId;const l=Bge;return l.length=0,l.push(s,a),Oy(e,l,n)}Object.defineProperties(PO.prototype,{command:{get:function(){return this._command}},runtimePrimitive:{get:function(){return this._runtimePrimitive}},batchLengths:{get:function(){return this._runtimePrimitive.batchLengths}},batchOffsets:{get:function(){return this._runtimePrimitive.batchOffsets}},model:{get:function(){return this._model}},classificationType:{get:function(){return this._classificationType}},modelMatrix:{get:function(){return this._modelMatrix},set:function(e){this._modelMatrix=L.clone(e,this._modelMatrix);const t=this._runtimePrimitive.boundingSphere;this._boundingVolume=se.transform(t,this._modelMatrix,this._boundingVolume)}},boundingVolume:{get:function(){return this._boundingVolume}},cullFace:{get:function(){return this._cullFace},set:function(e){this._cullFace=e}}});PO.prototype.pushCommands=function(e,t){const n=e.passes;if(n.render){if(this._useDebugWireframe){t.push.apply(t,this._commandListDebugWireframe);return}if(this._classifiesTerrain&&t.push.apply(t,this._commandListTerrain),this._classifies3DTiles&&t.push.apply(t,this._commandList3DTiles),e.invertClassification&&this._classifies3DTiles){if(this._commandListIgnoreShow.length===0){const o=xe.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW,r=tD(this._command,o),s=MH;s.length=0,s.push(r),this._commandListIgnoreShow=Oy(this,s,this._commandListIgnoreShow)}t.push.apply(t,this._commandListIgnoreShow)}}return n.pick&&(this._classifiesTerrain&&t.push.apply(t,this._commandListTerrainPicking),this._classifies3DTiles&&t.push.apply(t,this._commandList3DTilesPicking)),t};function FC(e){e=y(e,y.EMPTY_OBJECT);const t=e.command,n=e.primitiveRenderResources;A.typeOf.object("options.command",t),A.typeOf.object("options.primitiveRenderResources",n);const i=n.model;this._model=i;const o=n.runtimePrimitive;this._runtimePrimitive=o;const r=t.pass===xe.TRANSLUCENT,a=!o.primitive.material.doubleSided&&!r,l=n.hasSilhouette,u=!r&&!l,h=n.hasSkipLevelOfDetail&&!r,f=l;this._command=t,this._modelMatrix=L.clone(t.modelMatrix),this._boundingVolume=se.clone(t.boundingVolume),this._modelMatrix2D=new L,this._boundingVolume2D=new se,this._modelMatrix2DDirty=!1,this._backFaceCulling=t.renderState.cull.enabled,this._cullFace=t.renderState.cull.face,this._shadows=i.shadows,this._debugShowBoundingVolume=t.debugShowBoundingVolume,this._usesBackFaceCulling=a,this._needsTranslucentCommand=u,this._needsSkipLevelOfDetailCommands=h,this._needsSilhouetteCommands=f,this._originalCommand=void 0,this._translucentCommand=void 0,this._skipLodBackfaceCommand=void 0,this._skipLodStencilCommand=void 0,this._silhouetteModelCommand=void 0,this._silhouetteColorCommand=void 0,this._derivedCommands=[],this._has2DCommands=!1,zge(this)}function ku(e){this.command=e.command,this.updateShadows=e.updateShadows,this.updateBackFaceCulling=e.updateBackFaceCulling,this.updateCullFace=e.updateCullFace,this.updateDebugShowBoundingVolume=e.updateDebugShowBoundingVolume,this.is2D=y(e.is2D,!1),this.derivedCommand2D=void 0}ku.clone=function(e){return new ku({command:e.command,updateShadows:e.updateShadows,updateBackFaceCulling:e.updateBackFaceCulling,updateCullFace:e.updateCullFace,updateDebugShowBoundingVolume:e.updateDebugShowBoundingVolume,is2D:e.is2D,derivedCommand2D:e.derivedCommand2D})};function zge(e){const t=e._command;t.modelMatrix=e._modelMatrix,t.boundingVolume=e._boundingVolume;const n=e._model,i=e._usesBackFaceCulling,o=e._derivedCommands;e._originalCommand=new ku({command:t,updateShadows:!0,updateBackFaceCulling:i,updateCullFace:i,updateDebugShowBoundingVolume:!0,is2D:!1}),o.push(e._originalCommand),e._needsTranslucentCommand&&(e._translucentCommand=new ku({command:Wge(t),updateShadows:!0,updateBackFaceCulling:!1,updateCullFace:!1,updateDebugShowBoundingVolume:!0}),o.push(e._translucentCommand)),e._needsSkipLevelOfDetailCommands&&(e._skipLodBackfaceCommand=new ku({command:Kge(t),updateShadows:!1,updateBackFaceCulling:!1,updateCullFace:i,updateDebugShowBoundingVolume:!1}),e._skipLodStencilCommand=new ku({command:Zge(t),updateShadows:!0,updateBackFaceCulling:i,updateCullFace:i,updateDebugShowBoundingVolume:!0}),o.push(e._skipLodBackfaceCommand),o.push(e._skipLodStencilCommand)),e._needsSilhouetteCommands&&(e._silhouetteModelCommand=new ku({command:qge(t,n),updateShadows:!0,updateBackFaceCulling:i,updateCullFace:i,updateDebugShowBoundingVolume:!0}),e._silhouetteColorCommand=new ku({command:Yge(t,n),updateShadows:!1,updateBackFaceCulling:!1,updateCullFace:!1,updateDebugShowBoundingVolume:!1}),o.push(e._silhouetteModelCommand),o.push(e._silhouetteColorCommand))}Object.defineProperties(FC.prototype,{command:{get:function(){return this._command}},runtimePrimitive:{get:function(){return this._runtimePrimitive}},model:{get:function(){return this._model}},primitiveType:{get:function(){return this._command.primitiveType}},modelMatrix:{get:function(){return this._modelMatrix},set:function(e){this._modelMatrix=L.clone(e,this._modelMatrix),this._modelMatrix2DDirty=!0,this._boundingVolume=se.transform(this.runtimePrimitive.boundingSphere,this._modelMatrix,this._boundingVolume)}},boundingVolume:{get:function(){return this._boundingVolume}},shadows:{get:function(){return this._shadows},set:function(e){this._shadows=e,kge(this)}},backFaceCulling:{get:function(){return this._backFaceCulling},set:function(e){this._backFaceCulling!==e&&(this._backFaceCulling=e,Vge(this))}},cullFace:{get:function(){return this._cullFace},set:function(e){this._cullFace!==e&&(this._cullFace=e,Hge(this))}},debugShowBoundingVolume:{get:function(){return this._debugShowBoundingVolume},set:function(e){this._debugShowBoundingVolume!==e&&(this._debugShowBoundingVolume=e,Gge(this))}}});function Uge(e,t){const n=e._modelMatrix;e._modelMatrix2D=L.clone(n,e._modelMatrix2D),e._modelMatrix2D[13]-=R.sign(n[13])*2*R.PI*t.mapProjection.ellipsoid.maximumRadius,e._boundingVolume2D=se.transform(e.runtimePrimitive.boundingSphere,e._modelMatrix2D,e._boundingVolume2D)}function kge(e){const t=e.shadows,n=Vi.castShadows(t),i=Vi.receiveShadows(t),o=e._derivedCommands;for(let r=0;r<o.length;++r){const s=o[r];if(s.updateShadows){const a=s.command;a.castShadows=n,a.receiveShadows=i}}}function Vge(e){const t=e.backFaceCulling,n=e._derivedCommands;for(let i=0;i<n.length;++i){const o=n[i];if(o.updateBackFaceCulling){const r=o.command,s=Je(r.renderState,!0);s.cull.enabled=t,r.renderState=Ue.fromCache(s)}}}function Hge(e){const t=e.cullFace,n=e._derivedCommands;for(let i=0;i<n.length;++i){const o=n[i];if(o.updateCullFace){const r=o.command,s=Je(r.renderState,!0);s.cull.face=t,r.renderState=Ue.fromCache(s)}}}function Gge(e){const t=e.debugShowBoundingVolume,n=e._derivedCommands;for(let i=0;i<n.length;++i){const o=n[i];if(o.updateDebugShowBoundingVolume){const r=o.command;r.debugShowBoundingVolume=t}}}FC.prototype.pushCommands=function(e,t){const n=FH(this,e);n&&!this._has2DCommands&&(jge(this),this._has2DCommands=!0,this._modelMatrix2DDirty=!0),this._modelMatrix2DDirty&&(Uge(this,e),this._modelMatrix2DDirty=!1);const i=this.model.styleCommandsNeeded;if(!(this._needsTranslucentCommand&&c(i)&&(i!==b0.ALL_OPAQUE&&Bm(t,this._translucentCommand,n),i===b0.ALL_TRANSLUCENT))){if(this._needsSkipLevelOfDetailCommands){const{tileset:o,tile:r}=this._model.content;if(o.hasMixedContent){r._finalResolution||Bm(o._backfaceCommands,this._skipLodBackfaceCommand,n),$ge(this,r,n),Bm(t,this._skipLodStencilCommand,n);return}}if(this._needsSilhouetteCommands){Bm(t,this._silhouetteModelCommand,n);return}return Bm(t,this._originalCommand,n),t}};FC.prototype.pushSilhouetteCommands=function(e,t){const n=FH(this,e);return Bm(t,this._silhouetteColorCommand,n),t};function Bm(e,t,n){e.push(t.command),n&&e.push(t.derivedCommand2D.command)}function FH(e,t){if(t.mode!==oe.SCENE2D||e.model._projectTo2D)return!1;const i=e.model.sceneGraph._boundingSphere2D,o=i.center.y-i.radius,r=i.center.y+i.radius,s=t.mapProjection.ellipsoid.maximumRadius*R.PI;return o<s&&r>s||o<-s&&r>-s}function pm(e,t){if(!c(t))return;const n=ku.clone(t),i=Ze.shallowClone(t.command);return i.modelMatrix=e._modelMatrix2D,i.boundingVolume=e._boundingVolume2D,n.command=i,n.updateShadows=!1,n.is2D=!0,t.derivedCommand2D=n,e._derivedCommands.push(n),n}function jge(e){pm(e,e._originalCommand),pm(e,e._translucentCommand),pm(e,e._skipLodBackfaceCommand),pm(e,e._skipLodStencilCommand),pm(e,e._silhouetteModelCommand),pm(e,e._silhouetteColorCommand)}function Wge(e){const t=Ze.shallowClone(e);t.pass=xe.TRANSLUCENT;const n=Je(e.renderState,!0);return n.cull.enabled=!1,n.depthMask=!1,n.blending=Zn.ALPHA_BLEND,t.renderState=Ue.fromCache(n),t}function qge(e,t){const n=t._silhouetteId%255,i=Ze.shallowClone(e),o=Je(e.renderState,!0);return o.stencilTest={enabled:!0,frontFunction:J.ALWAYS,backFunction:J.ALWAYS,reference:n,mask:-1,frontOperation:{fail:J.KEEP,zFail:J.KEEP,zPass:J.REPLACE},backOperation:{fail:J.KEEP,zFail:J.KEEP,zPass:J.REPLACE}},t.isInvisible()&&(o.colorMask={red:!1,green:!1,blue:!1,alpha:!1}),i.renderState=Ue.fromCache(o),i}function Yge(e,t){const n=t._silhouetteId%255,i=Ze.shallowClone(e),o=Je(e.renderState,!0);o.cull.enabled=!1,(e.pass===xe.TRANSLUCENT||t.silhouetteColor.alpha<1)&&(i.pass=xe.TRANSLUCENT,o.depthMask=!1,o.blending=Zn.ALPHA_BLEND),o.stencilTest={enabled:!0,frontFunction:J.NOTEQUAL,backFunction:J.NOTEQUAL,reference:n,mask:-1,frontOperation:{fail:J.KEEP,zFail:J.KEEP,zPass:J.KEEP},backOperation:{fail:J.KEEP,zFail:J.KEEP,zPass:J.KEEP}};const s=Je(e.uniformMap);return s.model_silhouettePass=function(){return!0},i.renderState=Ue.fromCache(o),i.uniformMap=s,i.castShadows=!1,i.receiveShadows=!1,i}function $ge(e,t,n){const i=e._skipLodStencilCommand,o=i.command,r=t._selectionDepth,s=Xge(o);if(r!==s){const a=Qge(r),l=Je(o.renderState,!0);l.stencilTest.reference=a,o.renderState=Ue.fromCache(l),n&&(i.derivedCommand2D.renderState=l)}}function Xge(e){return(e.renderState.stencilTest.reference&At.SKIP_LOD_MASK)>>>At.SKIP_LOD_BIT_SHIFT}function Qge(e){return At.CESIUM_3D_TILE_MASK|e<<At.SKIP_LOD_BIT_SHIFT}function Kge(e){const t=Ze.shallowClone(e),n=Je(e.renderState,!0);n.cull.enabled=!0,n.cull.face=Qi.FRONT,n.colorMask={red:!1,green:!1,blue:!1,alpha:!1},n.polygonOffset={enabled:!0,factor:5,units:5};const i=Je(t.uniformMap),o=new H(5,5);return i.u_polygonOffset=function(){return o},t.renderState=Ue.fromCache(n),t.uniformMap=i,t.castShadows=!1,t.receiveShadows=!1,t}function Zge(e){const t=Ze.shallowClone(e),n=Je(e.renderState,!0),{stencilTest:i}=n;return i.enabled=!0,i.mask=At.SKIP_LOD_MASK,i.reference=At.CESIUM_3D_TILE_MASK,i.frontFunction=Pn.GREATER_OR_EQUAL,i.frontOperation.zPass=nt.REPLACE,i.backFunction=Pn.GREATER_OR_EQUAL,i.backOperation.zPass=nt.REPLACE,n.stencilMask=At.CESIUM_3D_TILE_MASK|At.SKIP_LOD_MASK,t.renderState=Ue.fromCache(n),t}function Jge(e,t){const n=e.shaderBuilder;n.addVertexLines(Lge),n.addFragmentLines(Oge);const i=eye(e),o=new Ci({context:t.context,indexBuffer:i,attributes:e.attributes}),r=e.model;r._pipelineResources.push(o);const s=n.buildShaderProgram(t.context);r._pipelineResources.push(s);const a=e.alphaOptions.pass,l=r.sceneGraph,u=t.mode===oe.SCENE3D;let h,f;if(!u&&!t.scene3DOnly&&r._projectTo2D)h=L.multiplyTransformation(l._computedModelMatrix,e.runtimeNode.computedTransform,new L),f=e.runtimePrimitive.boundingSphere2D;else{const C=u?l._computedModelMatrix:l._computedModelMatrix2D;h=L.multiplyTransformation(C,e.runtimeNode.computedTransform,new L),f=se.transform(e.boundingSphere,h,e.boundingSphere)}let _=Je(Ue.fromCache(e.renderStateOptions),!0);_.cull.face=Lt.getCullFace(h,e.primitiveType),_=Ue.fromCache(_);const g=c(r.classificationType),m=g?!1:Vi.castShadows(r.shadows),b=g?!1:Vi.receiveShadows(r.shadows),T=g?void 0:e.pickId,x=new Ze({boundingVolume:f,modelMatrix:h,uniformMap:e.uniformMap,renderState:_,vertexArray:o,shaderProgram:s,cull:r.cull,pass:a,count:e.count,owner:r,pickId:T,instanceCount:e.instanceCount,primitiveType:e.primitiveType,debugShowBoundingVolume:r.debugShowBoundingVolume,castShadows:m,receiveShadows:b});return g?new PO({primitiveRenderResources:e,command:x}):new FC({primitiveRenderResources:e,command:x})}function eye(e){const t=e.wireframeIndexBuffer;if(c(t))return t;const n=e.indices;if(!!c(n)){if(!c(n.buffer))throw new E("Indices must be provided as a Buffer");return n.buffer}}const BH={name:"TilesetPipelineStage"};BH.process=function(e,t,n){if(t.hasSkipLevelOfDetail(n)){e.shaderBuilder.addDefine("POLYGON_OFFSET",void 0,ge.FRAGMENT);const r={u_polygonOffset:function(){return H.ZERO}};e.uniformMap=jt(r,e.uniformMap),e.hasSkipLevelOfDetail=!0}const i=e.renderStateOptions;i.stencilTest=At.setCesium3DTileBit(),i.stencilMask=At.CESIUM_3D_TILE_MASK};const tye=BH,nye=`// robust iterative solution without trig functions
|
|
// https://github.com/0xfaded/ellipse_demo/issues/1
|
|
// https://stackoverflow.com/questions/22959698/distance-from-given-point-to-given-ellipse
|
|
//
|
|
// This version uses only a single iteration for best performance. For fog
|
|
// rendering, the difference is negligible.
|
|
vec2 nearestPointOnEllipseFast(vec2 pos, vec2 radii) {
|
|
vec2 p = abs(pos);
|
|
vec2 inverseRadii = 1.0 / radii;
|
|
vec2 evoluteScale = (radii.x * radii.x - radii.y * radii.y) * vec2(1.0, -1.0) * inverseRadii;
|
|
|
|
// We describe the ellipse parametrically: v = radii * vec2(cos(t), sin(t))
|
|
// but store the cos and sin of t in a vec2 for efficiency.
|
|
// Initial guess: t = cos(pi/4)
|
|
vec2 tTrigs = vec2(0.70710678118);
|
|
vec2 v = radii * tTrigs;
|
|
|
|
// Find the evolute of the ellipse (center of curvature) at v.
|
|
vec2 evolute = evoluteScale * tTrigs * tTrigs * tTrigs;
|
|
// Find the (approximate) intersection of p - evolute with the ellipsoid.
|
|
vec2 q = normalize(p - evolute) * length(v - evolute);
|
|
// Update the estimate of t.
|
|
tTrigs = (q + evolute) * inverseRadii;
|
|
tTrigs = normalize(clamp(tTrigs, 0.0, 1.0));
|
|
v = radii * tTrigs;
|
|
|
|
return v * sign(pos);
|
|
}
|
|
|
|
vec3 computeEllipsoidPositionWC(vec3 positionMC) {
|
|
// Get the world-space position and project onto a meridian plane of
|
|
// the ellipsoid
|
|
vec3 positionWC = (czm_model * vec4(positionMC, 1.0)).xyz;
|
|
|
|
vec2 positionEllipse = vec2(length(positionWC.xy), positionWC.z);
|
|
vec2 nearestPoint = nearestPointOnEllipseFast(positionEllipse, czm_ellipsoidRadii.xz);
|
|
|
|
// Reconstruct a 3D point in world space
|
|
return vec3(nearestPoint.x * normalize(positionWC.xy), nearestPoint.y);
|
|
}
|
|
|
|
void applyFog(inout vec4 color, vec4 groundAtmosphereColor, vec3 lightDirection, float distanceToCamera) {
|
|
|
|
vec3 fogColor = groundAtmosphereColor.rgb;
|
|
|
|
// If there is dynamic lighting, apply that to the fog.
|
|
const float NONE = 0.0;
|
|
if (czm_atmosphereDynamicLighting != NONE) {
|
|
float darken = clamp(dot(normalize(czm_viewerPositionWC), lightDirection), czm_fogMinimumBrightness, 1.0);
|
|
fogColor *= darken;
|
|
}
|
|
|
|
// Tonemap if HDR rendering is disabled
|
|
#ifndef HDR
|
|
fogColor.rgb = czm_acesTonemapping(fogColor.rgb);
|
|
fogColor.rgb = czm_inverseGamma(fogColor.rgb);
|
|
#endif
|
|
|
|
// Matches the constant in GlobeFS.glsl. This makes the fog falloff
|
|
// more gradual.
|
|
const float fogModifier = 0.15;
|
|
vec3 withFog = czm_fog(distanceToCamera, color.rgb, fogColor, fogModifier);
|
|
color = vec4(withFog, color.a);
|
|
}
|
|
|
|
void atmosphereStage(inout vec4 color, in ProcessedAttributes attributes) {
|
|
vec3 rayleighColor;
|
|
vec3 mieColor;
|
|
float opacity;
|
|
|
|
vec3 positionWC;
|
|
vec3 lightDirection;
|
|
|
|
// When the camera is in space, compute the position per-fragment for
|
|
// more accurate ground atmosphere. All other cases will use
|
|
//
|
|
// The if condition will be added in https://github.com/CesiumGS/cesium/issues/11717
|
|
if (false) {
|
|
positionWC = computeEllipsoidPositionWC(attributes.positionMC);
|
|
lightDirection = czm_getDynamicAtmosphereLightDirection(positionWC, czm_atmosphereDynamicLighting);
|
|
|
|
// The fog color is derived from the ground atmosphere color
|
|
czm_computeGroundAtmosphereScattering(
|
|
positionWC,
|
|
lightDirection,
|
|
rayleighColor,
|
|
mieColor,
|
|
opacity
|
|
);
|
|
} else {
|
|
positionWC = attributes.positionWC;
|
|
lightDirection = czm_getDynamicAtmosphereLightDirection(positionWC, czm_atmosphereDynamicLighting);
|
|
rayleighColor = v_atmosphereRayleighColor;
|
|
mieColor = v_atmosphereMieColor;
|
|
opacity = v_atmosphereOpacity;
|
|
}
|
|
|
|
//color correct rayleigh and mie colors
|
|
const bool ignoreBlackPixels = true;
|
|
rayleighColor = czm_applyHSBShift(rayleighColor, czm_atmosphereHsbShift, ignoreBlackPixels);
|
|
mieColor = czm_applyHSBShift(mieColor, czm_atmosphereHsbShift, ignoreBlackPixels);
|
|
|
|
vec4 groundAtmosphereColor = czm_computeAtmosphereColor(positionWC, lightDirection, rayleighColor, mieColor, opacity);
|
|
|
|
if (u_isInFog) {
|
|
float distanceToCamera = length(attributes.positionEC);
|
|
applyFog(color, groundAtmosphereColor, lightDirection, distanceToCamera);
|
|
} else {
|
|
// Ground atmosphere
|
|
}
|
|
}
|
|
`,iye=`void atmosphereStage(ProcessedAttributes attributes) {
|
|
vec3 lightDirection = czm_getDynamicAtmosphereLightDirection(v_positionWC, czm_atmosphereDynamicLighting);
|
|
|
|
czm_computeGroundAtmosphereScattering(
|
|
// This assumes the geometry stage came before this.
|
|
v_positionWC,
|
|
lightDirection,
|
|
v_atmosphereRayleighColor,
|
|
v_atmosphereMieColor,
|
|
v_atmosphereOpacity
|
|
);
|
|
}
|
|
`,zH={name:"AtmospherePipelineStage"};zH.process=function(e,t,n){const i=e.shaderBuilder;i.addDefine("HAS_ATMOSPHERE",void 0,ge.BOTH),i.addDefine("COMPUTE_POSITION_WC_ATMOSPHERE",void 0,ge.BOTH),i.addVarying("vec3","v_atmosphereRayleighColor"),i.addVarying("vec3","v_atmosphereMieColor"),i.addVarying("float","v_atmosphereOpacity"),i.addVertexLines([iye]),i.addFragmentLines([nye]),i.addUniform("bool","u_isInFog",ge.FRAGMENT),e.uniformMap.u_isInFog=function(){const o=d.distance(n.camera.positionWC,t.boundingSphere.center);return R.fog(o,n.fog.density)>R.EPSILON3}};const oye=zH,rye=`vec3 proceduralIBL(
|
|
vec3 positionEC,
|
|
vec3 normalEC,
|
|
vec3 lightDirectionEC,
|
|
vec3 lightColorHdr,
|
|
czm_pbrParameters pbrParameters
|
|
) {
|
|
vec3 v = -positionEC;
|
|
vec3 positionWC = vec3(czm_inverseView * vec4(positionEC, 1.0));
|
|
vec3 vWC = -normalize(positionWC);
|
|
vec3 l = normalize(lightDirectionEC);
|
|
vec3 n = normalEC;
|
|
vec3 r = normalize(czm_inverseViewRotation * normalize(reflect(v, n)));
|
|
|
|
float NdotL = clamp(dot(n, l), 0.001, 1.0);
|
|
float NdotV = abs(dot(n, v)) + 0.001;
|
|
|
|
// Figure out if the reflection vector hits the ellipsoid
|
|
float vertexRadius = length(positionWC);
|
|
float horizonDotNadir = 1.0 - min(1.0, czm_ellipsoidRadii.x / vertexRadius);
|
|
float reflectionDotNadir = dot(r, normalize(positionWC));
|
|
// Flipping the X vector is a cheap way to get the inverse of czm_temeToPseudoFixed, since that's a rotation about Z.
|
|
r.x = -r.x;
|
|
r = -normalize(czm_temeToPseudoFixed * r);
|
|
r.x = -r.x;
|
|
|
|
vec3 diffuseColor = pbrParameters.diffuseColor;
|
|
float roughness = pbrParameters.roughness;
|
|
vec3 specularColor = pbrParameters.f0;
|
|
|
|
float inverseRoughness = 1.04 - roughness;
|
|
inverseRoughness *= inverseRoughness;
|
|
vec3 sceneSkyBox = czm_textureCube(czm_environmentMap, r).rgb * inverseRoughness;
|
|
|
|
float atmosphereHeight = 0.05;
|
|
float blendRegionSize = 0.1 * ((1.0 - inverseRoughness) * 8.0 + 1.1 - horizonDotNadir);
|
|
float blendRegionOffset = roughness * -1.0;
|
|
float farAboveHorizon = clamp(horizonDotNadir - blendRegionSize * 0.5 + blendRegionOffset, 1.0e-10 - blendRegionSize, 0.99999);
|
|
float aroundHorizon = clamp(horizonDotNadir + blendRegionSize * 0.5, 1.0e-10 - blendRegionSize, 0.99999);
|
|
float farBelowHorizon = clamp(horizonDotNadir + blendRegionSize * 1.5, 1.0e-10 - blendRegionSize, 0.99999);
|
|
float smoothstepHeight = smoothstep(0.0, atmosphereHeight, horizonDotNadir);
|
|
vec3 belowHorizonColor = mix(vec3(0.1, 0.15, 0.25), vec3(0.4, 0.7, 0.9), smoothstepHeight);
|
|
vec3 nadirColor = belowHorizonColor * 0.5;
|
|
vec3 aboveHorizonColor = mix(vec3(0.9, 1.0, 1.2), belowHorizonColor, roughness * 0.5);
|
|
vec3 blueSkyColor = mix(vec3(0.18, 0.26, 0.48), aboveHorizonColor, reflectionDotNadir * inverseRoughness * 0.5 + 0.75);
|
|
vec3 zenithColor = mix(blueSkyColor, sceneSkyBox, smoothstepHeight);
|
|
vec3 blueSkyDiffuseColor = vec3(0.7, 0.85, 0.9);
|
|
float diffuseIrradianceFromEarth = (1.0 - horizonDotNadir) * (reflectionDotNadir * 0.25 + 0.75) * smoothstepHeight;
|
|
float diffuseIrradianceFromSky = (1.0 - smoothstepHeight) * (1.0 - (reflectionDotNadir * 0.25 + 0.25));
|
|
vec3 diffuseIrradiance = blueSkyDiffuseColor * clamp(diffuseIrradianceFromEarth + diffuseIrradianceFromSky, 0.0, 1.0);
|
|
float notDistantRough = (1.0 - horizonDotNadir * roughness * 0.8);
|
|
vec3 specularIrradiance = mix(zenithColor, aboveHorizonColor, smoothstep(farAboveHorizon, aroundHorizon, reflectionDotNadir) * notDistantRough);
|
|
specularIrradiance = mix(specularIrradiance, belowHorizonColor, smoothstep(aroundHorizon, farBelowHorizon, reflectionDotNadir) * inverseRoughness);
|
|
specularIrradiance = mix(specularIrradiance, nadirColor, smoothstep(farBelowHorizon, 1.0, reflectionDotNadir) * inverseRoughness);
|
|
|
|
// Luminance model from page 40 of http://silviojemma.com/public/papers/lighting/spherical-harmonic-lighting.pdf
|
|
#ifdef USE_SUN_LUMINANCE
|
|
// Angle between sun and zenith
|
|
float LdotZenith = clamp(dot(normalize(czm_inverseViewRotation * l), vWC), 0.001, 1.0);
|
|
float S = acos(LdotZenith);
|
|
// Angle between zenith and current pixel
|
|
float NdotZenith = clamp(dot(normalize(czm_inverseViewRotation * n), vWC), 0.001, 1.0);
|
|
// Angle between sun and current pixel
|
|
float gamma = acos(NdotL);
|
|
float numerator = ((0.91 + 10.0 * exp(-3.0 * gamma) + 0.45 * pow(NdotL, 2.0)) * (1.0 - exp(-0.32 / NdotZenith)));
|
|
float denominator = (0.91 + 10.0 * exp(-3.0 * S) + 0.45 * pow(LdotZenith,2.0)) * (1.0 - exp(-0.32));
|
|
float luminance = model_luminanceAtZenith * (numerator / denominator);
|
|
#endif
|
|
|
|
vec2 brdfLut = texture(czm_brdfLut, vec2(NdotV, roughness)).rg;
|
|
vec3 iblColor = (diffuseIrradiance * diffuseColor * model_iblFactor.x) + (specularIrradiance * czm_srgbToLinear(specularColor * brdfLut.x + brdfLut.y) * model_iblFactor.y);
|
|
float maximumComponent = max(max(lightColorHdr.x, lightColorHdr.y), lightColorHdr.z);
|
|
vec3 lightColor = lightColorHdr / max(maximumComponent, 1.0);
|
|
iblColor *= lightColor;
|
|
|
|
#ifdef USE_SUN_LUMINANCE
|
|
iblColor *= luminance;
|
|
#endif
|
|
|
|
return iblColor;
|
|
}
|
|
|
|
#if defined(DIFFUSE_IBL) || defined(SPECULAR_IBL)
|
|
vec3 textureIBL(
|
|
vec3 positionEC,
|
|
vec3 normalEC,
|
|
vec3 lightDirectionEC,
|
|
czm_pbrParameters pbrParameters
|
|
) {
|
|
vec3 diffuseColor = pbrParameters.diffuseColor;
|
|
float roughness = pbrParameters.roughness;
|
|
vec3 specularColor = pbrParameters.f0;
|
|
|
|
vec3 v = -positionEC;
|
|
vec3 n = normalEC;
|
|
vec3 l = normalize(lightDirectionEC);
|
|
vec3 h = normalize(v + l);
|
|
|
|
float NdotV = abs(dot(n, v)) + 0.001;
|
|
float VdotH = clamp(dot(v, h), 0.0, 1.0);
|
|
|
|
const mat3 yUpToZUp = mat3(
|
|
-1.0, 0.0, 0.0,
|
|
0.0, 0.0, -1.0,
|
|
0.0, 1.0, 0.0
|
|
);
|
|
vec3 cubeDir = normalize(yUpToZUp * model_iblReferenceFrameMatrix * normalize(reflect(-v, n)));
|
|
|
|
#ifdef DIFFUSE_IBL
|
|
#ifdef CUSTOM_SPHERICAL_HARMONICS
|
|
vec3 diffuseIrradiance = czm_sphericalHarmonics(cubeDir, model_sphericalHarmonicCoefficients);
|
|
#else
|
|
vec3 diffuseIrradiance = czm_sphericalHarmonics(cubeDir, czm_sphericalHarmonicCoefficients);
|
|
#endif
|
|
#else
|
|
vec3 diffuseIrradiance = vec3(0.0);
|
|
#endif
|
|
|
|
#ifdef SPECULAR_IBL
|
|
vec3 r0 = specularColor.rgb;
|
|
float reflectance = max(max(r0.r, r0.g), r0.b);
|
|
vec3 r90 = vec3(clamp(reflectance * 25.0, 0.0, 1.0));
|
|
vec3 F = fresnelSchlick2(r0, r90, VdotH);
|
|
|
|
vec2 brdfLut = texture(czm_brdfLut, vec2(NdotV, roughness)).rg;
|
|
#ifdef CUSTOM_SPECULAR_IBL
|
|
vec3 specularIBL = czm_sampleOctahedralProjection(model_specularEnvironmentMaps, model_specularEnvironmentMapsSize, cubeDir, roughness * model_specularEnvironmentMapsMaximumLOD, model_specularEnvironmentMapsMaximumLOD);
|
|
#else
|
|
vec3 specularIBL = czm_sampleOctahedralProjection(czm_specularEnvironmentMaps, czm_specularEnvironmentMapSize, cubeDir, roughness * czm_specularEnvironmentMapsMaximumLOD, czm_specularEnvironmentMapsMaximumLOD);
|
|
#endif
|
|
specularIBL *= F * brdfLut.x + brdfLut.y;
|
|
#else
|
|
vec3 specularIBL = vec3(0.0);
|
|
#endif
|
|
|
|
return diffuseColor * diffuseIrradiance + specularColor * specularIBL;
|
|
}
|
|
#endif
|
|
|
|
vec3 imageBasedLightingStage(
|
|
vec3 positionEC,
|
|
vec3 normalEC,
|
|
vec3 lightDirectionEC,
|
|
vec3 lightColorHdr,
|
|
czm_pbrParameters pbrParameters
|
|
) {
|
|
#if defined(DIFFUSE_IBL) || defined(SPECULAR_IBL)
|
|
// Environment maps were provided, use them for IBL
|
|
return textureIBL(
|
|
positionEC,
|
|
normalEC,
|
|
lightDirectionEC,
|
|
pbrParameters
|
|
);
|
|
#else
|
|
// Use the procedural IBL if there are no environment maps
|
|
return proceduralIBL(
|
|
positionEC,
|
|
normalEC,
|
|
lightDirectionEC,
|
|
lightColorHdr,
|
|
pbrParameters
|
|
);
|
|
#endif
|
|
}`,UH={name:"ImageBasedLightingPipelineStage"};UH.process=function(e,t,n){const i=t.imageBasedLighting,o=e.shaderBuilder;o.addDefine("USE_IBL_LIGHTING",void 0,ge.FRAGMENT),o.addUniform("vec2","model_iblFactor",ge.FRAGMENT),yl.isSupported(n.context)&&((i.useSphericalHarmonics||i.useSpecularEnvironmentMaps||i.enabled)&&o.addUniform("mat3","model_iblReferenceFrameMatrix",ge.FRAGMENT),c(i.sphericalHarmonicCoefficients)?(o.addDefine("DIFFUSE_IBL",void 0,ge.FRAGMENT),o.addDefine("CUSTOM_SPHERICAL_HARMONICS",void 0,ge.FRAGMENT),o.addUniform("vec3","model_sphericalHarmonicCoefficients[9]",ge.FRAGMENT)):i.useDefaultSphericalHarmonics&&o.addDefine("DIFFUSE_IBL",void 0,ge.FRAGMENT),c(i.specularEnvironmentMapAtlas)&&i.specularEnvironmentMapAtlas.ready?(o.addDefine("SPECULAR_IBL",void 0,ge.FRAGMENT),o.addDefine("CUSTOM_SPECULAR_IBL",void 0,ge.FRAGMENT),o.addUniform("sampler2D","model_specularEnvironmentMaps",ge.FRAGMENT),o.addUniform("vec2","model_specularEnvironmentMapsSize",ge.FRAGMENT),o.addUniform("float","model_specularEnvironmentMapsMaximumLOD",ge.FRAGMENT)):t.useDefaultSpecularMaps&&o.addDefine("SPECULAR_IBL",void 0,ge.FRAGMENT)),c(i.luminanceAtZenith)&&(o.addDefine("USE_SUN_LUMINANCE",void 0,ge.FRAGMENT),o.addUniform("float","model_luminanceAtZenith",ge.FRAGMENT)),o.addFragmentLines(rye);const r={model_iblFactor:function(){return i.imageBasedLightingFactor},model_iblReferenceFrameMatrix:function(){return t._iblReferenceFrameMatrix},model_luminanceAtZenith:function(){return i.luminanceAtZenith},model_sphericalHarmonicCoefficients:function(){return i.sphericalHarmonicCoefficients},model_specularEnvironmentMaps:function(){return i.specularEnvironmentMapAtlas.texture},model_specularEnvironmentMapsSize:function(){return i.specularEnvironmentMapAtlas.texture.dimensions},model_specularEnvironmentMapsMaximumLOD:function(){return i.specularEnvironmentMapAtlas.maximumMipmapLevel}};e.uniformMap=jt(r,e.uniformMap)};const sye=UH,aye=R.EPSILON16;function OO(e){e=y(e,y.EMPTY_OBJECT);const t=e.stage,n=e.runtimeArticulation;A.typeOf.object("options.stage",t),A.typeOf.object("options.runtimeArticulation",n),this._stage=t,this._runtimeArticulation=n,this._name=t.name,this._type=t.type,this._minimumValue=t.minimumValue,this._maximumValue=t.maximumValue,this._currentValue=t.initialValue}Object.defineProperties(OO.prototype,{stage:{get:function(){return this._stage}},runtimeArticulation:{get:function(){return this._runtimeArticulation}},name:{get:function(){return this._name}},type:{get:function(){return this._type}},minimumValue:{get:function(){return this._minimumValue}},maximumValue:{get:function(){return this._maximumValue}},currentValue:{get:function(){return this._currentValue},set:function(e){A.typeOf.number("value",e),e=R.clamp(e,this.minimumValue,this.maximumValue),R.equalsEpsilon(this._currentValue,e,aye)||(this._currentValue=e,this.runtimeArticulation._dirty=!0)}}});const cye=new d,oS=new $;OO.prototype.applyStageToMatrix=function(e){A.typeOf.object("result",e);const t=this.type,n=this.currentValue,i=cye;let o;switch(t){case Zc.XROTATE:o=$.fromRotationX(R.toRadians(n),oS),e=L.multiplyByMatrix3(e,o,e);break;case Zc.YROTATE:o=$.fromRotationY(R.toRadians(n),oS),e=L.multiplyByMatrix3(e,o,e);break;case Zc.ZROTATE:o=$.fromRotationZ(R.toRadians(n),oS),e=L.multiplyByMatrix3(e,o,e);break;case Zc.XTRANSLATE:i.x=n,i.y=0,i.z=0,e=L.multiplyByTranslation(e,i,e);break;case Zc.YTRANSLATE:i.x=0,i.y=n,i.z=0,e=L.multiplyByTranslation(e,i,e);break;case Zc.ZTRANSLATE:i.x=0,i.y=0,i.z=n,e=L.multiplyByTranslation(e,i,e);break;case Zc.XSCALE:i.x=n,i.y=1,i.z=1,e=L.multiplyByScale(e,i,e);break;case Zc.YSCALE:i.x=1,i.y=n,i.z=1,e=L.multiplyByScale(e,i,e);break;case Zc.ZSCALE:i.x=1,i.y=1,i.z=n,e=L.multiplyByScale(e,i,e);break;case Zc.UNIFORMSCALE:e=L.multiplyByUniformScale(e,n,e);break}return e};function BC(e){e=y(e,y.EMPTY_OBJECT);const t=e.articulation,n=e.sceneGraph;A.typeOf.object("options.articulation",t),A.typeOf.object("options.sceneGraph",n),this._articulation=t,this._sceneGraph=n,this._name=t.name,this._runtimeStages=[],this._runtimeStagesByName={},this._runtimeNodes=[],this._dirty=!0,lye(this)}Object.defineProperties(BC.prototype,{articulation:{get:function(){return this._articulation}},sceneGraph:{get:function(){return this._sceneGraph}},name:{get:function(){return this._name}},runtimeStages:{get:function(){return this._runtimeStages}},runtimeNodes:{get:function(){return this._runtimeNodes}}});function lye(e){const n=e.articulation.stages,i=n.length,o=e._runtimeStages,r=e._runtimeStagesByName;for(let s=0;s<i;s++){const a=n[s],l=new OO({stage:a,runtimeArticulation:e});o.push(l);const u=a.name;r[u]=l}}BC.prototype.setArticulationStage=function(e,t){const n=this._runtimeStagesByName[e];c(n)&&(n.currentValue=t)};const uye=new L,dye=new L;BC.prototype.apply=function(){if(!this._dirty)return;this._dirty=!1;let e=L.clone(L.IDENTITY,uye),t;const n=this._runtimeStages,i=n.length;for(t=0;t<i;t++)e=n[t].applyStageToMatrix(e);const o=this._runtimeNodes,r=o.length;for(t=0;t<r;t++){const s=o[t],a=L.multiplyTransformation(s.originalTransform,e,dye);s.transform=a}};const hye=`void modelColorStage(inout czm_modelMaterial material)
|
|
{
|
|
material.diffuse = mix(material.diffuse, model_color.rgb, model_colorBlend);
|
|
float highlight = ceil(model_colorBlend);
|
|
material.diffuse *= mix(model_color.rgb, vec3(1.0), highlight);
|
|
material.alpha *= model_color.a;
|
|
}
|
|
`,zm={name:"ModelColorPipelineStage",COLOR_UNIFORM_NAME:"model_color",COLOR_BLEND_UNIFORM_NAME:"model_colorBlend"};zm.process=function(e,t,n){const i=e.shaderBuilder;i.addDefine("HAS_MODEL_COLOR",void 0,ge.FRAGMENT),i.addFragmentLines(hye);const o={},r=t.color;r.alpha===0&&!t.hasSilhouette(n)&&(e.renderStateOptions.colorMask={red:!1,green:!1,blue:!1,alpha:!1}),r.alpha<1&&(e.alphaOptions.pass=xe.TRANSLUCENT),i.addUniform("vec4",zm.COLOR_UNIFORM_NAME,ge.FRAGMENT),o[zm.COLOR_UNIFORM_NAME]=function(){return t.color},i.addUniform("float",zm.COLOR_BLEND_UNIFORM_NAME,ge.FRAGMENT),o[zm.COLOR_BLEND_UNIFORM_NAME]=function(){return RC.getColorBlend(t.colorBlendMode,t.colorBlendAmount)},e.uniformMap=jt(o,e.uniformMap)};const nD=zm,fye=`#ifdef USE_CLIPPING_PLANES_FLOAT_TEXTURE
|
|
vec4 getClippingPlane(
|
|
highp sampler2D packedClippingPlanes,
|
|
int clippingPlaneNumber,
|
|
mat4 transform
|
|
) {
|
|
int pixY = clippingPlaneNumber / CLIPPING_PLANES_TEXTURE_WIDTH;
|
|
int pixX = clippingPlaneNumber - (pixY * CLIPPING_PLANES_TEXTURE_WIDTH);
|
|
float pixelWidth = 1.0 / float(CLIPPING_PLANES_TEXTURE_WIDTH);
|
|
float pixelHeight = 1.0 / float(CLIPPING_PLANES_TEXTURE_HEIGHT);
|
|
float u = (float(pixX) + 0.5) * pixelWidth; // sample from center of pixel
|
|
float v = (float(pixY) + 0.5) * pixelHeight;
|
|
vec4 plane = texture(packedClippingPlanes, vec2(u, v));
|
|
return czm_transformPlane(plane, transform);
|
|
}
|
|
#else
|
|
// Handle uint8 clipping texture instead
|
|
vec4 getClippingPlane(
|
|
highp sampler2D packedClippingPlanes,
|
|
int clippingPlaneNumber,
|
|
mat4 transform
|
|
) {
|
|
int clippingPlaneStartIndex = clippingPlaneNumber * 2; // clipping planes are two pixels each
|
|
int pixY = clippingPlaneStartIndex / CLIPPING_PLANES_TEXTURE_WIDTH;
|
|
int pixX = clippingPlaneStartIndex - (pixY * CLIPPING_PLANES_TEXTURE_WIDTH);
|
|
float pixelWidth = 1.0 / float(CLIPPING_PLANES_TEXTURE_WIDTH);
|
|
float pixelHeight = 1.0 / float(CLIPPING_PLANES_TEXTURE_HEIGHT);
|
|
float u = (float(pixX) + 0.5) * pixelWidth; // sample from center of pixel
|
|
float v = (float(pixY) + 0.5) * pixelHeight;
|
|
vec4 oct32 = texture(packedClippingPlanes, vec2(u, v)) * 255.0;
|
|
vec2 oct = vec2(oct32.x * 256.0 + oct32.y, oct32.z * 256.0 + oct32.w);
|
|
vec4 plane;
|
|
plane.xyz = czm_octDecode(oct, 65535.0);
|
|
plane.w = czm_unpackFloat(texture(packedClippingPlanes, vec2(u + pixelWidth, v)));
|
|
return czm_transformPlane(plane, transform);
|
|
}
|
|
#endif
|
|
|
|
float clip(vec4 fragCoord, sampler2D clippingPlanes, mat4 clippingPlanesMatrix) {
|
|
vec4 position = czm_windowToEyeCoordinates(fragCoord);
|
|
vec3 clipNormal = vec3(0.0);
|
|
vec3 clipPosition = vec3(0.0);
|
|
float pixelWidth = czm_metersPerPixel(position);
|
|
|
|
#ifdef UNION_CLIPPING_REGIONS
|
|
float clipAmount; // For union planes, we want to get the min distance. So we set the initial value to the first plane distance in the loop below.
|
|
#else
|
|
float clipAmount = 0.0;
|
|
bool clipped = true;
|
|
#endif
|
|
|
|
for (int i = 0; i < CLIPPING_PLANES_LENGTH; ++i) {
|
|
vec4 clippingPlane = getClippingPlane(clippingPlanes, i, clippingPlanesMatrix);
|
|
clipNormal = clippingPlane.xyz;
|
|
clipPosition = -clippingPlane.w * clipNormal;
|
|
float amount = dot(clipNormal, (position.xyz - clipPosition)) / pixelWidth;
|
|
|
|
#ifdef UNION_CLIPPING_REGIONS
|
|
clipAmount = czm_branchFreeTernary(i == 0, amount, min(amount, clipAmount));
|
|
if (amount <= 0.0) {
|
|
discard;
|
|
}
|
|
#else
|
|
clipAmount = max(amount, clipAmount);
|
|
clipped = clipped && (amount <= 0.0);
|
|
#endif
|
|
}
|
|
|
|
#ifndef UNION_CLIPPING_REGIONS
|
|
if (clipped) {
|
|
discard;
|
|
}
|
|
#endif
|
|
|
|
return clipAmount;
|
|
}
|
|
|
|
void modelClippingPlanesStage(inout vec4 color)
|
|
{
|
|
float clipDistance = clip(gl_FragCoord, model_clippingPlanes, model_clippingPlanesMatrix);
|
|
vec4 clippingPlanesEdgeColor = vec4(1.0);
|
|
clippingPlanesEdgeColor.rgb = model_clippingPlanesEdgeStyle.rgb;
|
|
float clippingPlanesEdgeWidth = model_clippingPlanesEdgeStyle.a;
|
|
|
|
if (clipDistance > 0.0 && clipDistance < clippingPlanesEdgeWidth) {
|
|
color = clippingPlanesEdgeColor;
|
|
}
|
|
}
|
|
`,kH={name:"ModelClippingPlanesPipelineStage"},pye=new H;kH.process=function(e,t,n){const i=t.clippingPlanes,o=n.context,r=e.shaderBuilder;r.addDefine("HAS_CLIPPING_PLANES",void 0,ge.FRAGMENT),r.addDefine("CLIPPING_PLANES_LENGTH",i.length,ge.FRAGMENT),i.unionClippingRegions&&r.addDefine("UNION_CLIPPING_REGIONS",void 0,ge.FRAGMENT),Li.useFloatTexture(o)&&r.addDefine("USE_CLIPPING_PLANES_FLOAT_TEXTURE",void 0,ge.FRAGMENT);const s=Li.getTextureResolution(i,o,pye);r.addDefine("CLIPPING_PLANES_TEXTURE_WIDTH",s.x,ge.FRAGMENT),r.addDefine("CLIPPING_PLANES_TEXTURE_HEIGHT",s.y,ge.FRAGMENT),r.addUniform("sampler2D","model_clippingPlanes",ge.FRAGMENT),r.addUniform("vec4","model_clippingPlanesEdgeStyle",ge.FRAGMENT),r.addUniform("mat4","model_clippingPlanesMatrix",ge.FRAGMENT),r.addFragmentLines(fye);const a={model_clippingPlanes:function(){return i.texture},model_clippingPlanesEdgeStyle:function(){const l=z.clone(i.edgeColor);return l.alpha=i.edgeWidth,l},model_clippingPlanesMatrix:function(){return t._clippingPlanesMatrix}};e.uniformMap=jt(a,e.uniformMap)};const mye=kH,_ye=`void modelClippingPolygonsStage(ProcessedAttributes attributes)
|
|
{
|
|
vec2 sphericalLatLong = czm_approximateSphericalCoordinates(v_positionWC);
|
|
sphericalLatLong.y = czm_branchFreeTernary(sphericalLatLong.y < czm_pi, sphericalLatLong.y, sphericalLatLong.y - czm_twoPi);
|
|
|
|
vec2 minDistance = vec2(czm_infinity);
|
|
v_regionIndex = -1;
|
|
v_clippingPosition = vec2(czm_infinity);
|
|
|
|
for (int regionIndex = 0; regionIndex < CLIPPING_POLYGON_REGIONS_LENGTH; regionIndex++) {
|
|
vec4 extents = czm_unpackClippingExtents(model_clippingExtents, regionIndex);
|
|
vec2 rectUv = (sphericalLatLong.yx - extents.yx) * extents.wz;
|
|
|
|
vec2 clamped = clamp(rectUv, vec2(0.0), vec2(1.0));
|
|
vec2 distance = abs(rectUv - clamped) * extents.wz;
|
|
|
|
if (minDistance.x > distance.x || minDistance.y > distance.y) {
|
|
minDistance = distance;
|
|
v_clippingPosition = rectUv;
|
|
}
|
|
|
|
float threshold = 0.01;
|
|
if (rectUv.x > threshold && rectUv.y > threshold && rectUv.x < 1.0 - threshold && rectUv.y < 1.0 - threshold) {
|
|
v_regionIndex = regionIndex;
|
|
}
|
|
}
|
|
}
|
|
`,gye=`void modelClippingPolygonsStage()
|
|
{
|
|
vec2 clippingPosition = v_clippingPosition;
|
|
int regionIndex = v_regionIndex;
|
|
czm_clipPolygons(model_clippingDistance, CLIPPING_POLYGON_REGIONS_LENGTH, clippingPosition, regionIndex);
|
|
}
|
|
`,VH={name:"ModelClippingPolygonsPipelineStage"};VH.process=function(e,t,n){const i=t.clippingPolygons,o=e.shaderBuilder;o.addDefine("ENABLE_CLIPPING_POLYGONS",void 0,ge.BOTH),i.inverse&&o.addDefine("CLIPPING_INVERSE",void 0,ge.FRAGMENT),o.addDefine("CLIPPING_POLYGON_REGIONS_LENGTH",i.extentsCount,ge.BOTH),o.addUniform("sampler2D","model_clippingDistance",ge.FRAGMENT),o.addUniform("sampler2D","model_clippingExtents",ge.VERTEX),o.addVarying("vec2","v_clippingPosition"),o.addVarying("int","v_regionIndex","flat"),o.addVertexLines(_ye),o.addFragmentLines(gye);const r={model_clippingDistance:function(){return i.clippingTexture},model_clippingExtents:function(){return i.extentsTexture}};e.uniformMap=jt(r,e.uniformMap)};const yye=VH;function HH(e,t){A.typeOf.object("model",e),A.typeOf.object("runtimeNode",t),this._model=e,this._runtimeNode=t}Object.defineProperties(HH.prototype,{name:{get:function(){return this._runtimeNode._name}},id:{get:function(){return this._runtimeNode._id}},show:{get:function(){return this._runtimeNode.show},set:function(e){this._runtimeNode.show=e}},matrix:{get:function(){return this._runtimeNode.transform},set:function(e){c(e)?(this._runtimeNode.transform=e,this._runtimeNode.userAnimated=!0,this._model._userAnimationDirty=!0):(this._runtimeNode.transform=this.originalMatrix,this._runtimeNode.userAnimated=!1)}},originalMatrix:{get:function(){return this._runtimeNode.originalTransform}}});const bye=`mat4 getInstancingTransform()
|
|
{
|
|
mat4 instancingTransform;
|
|
|
|
#ifdef HAS_INSTANCE_MATRICES
|
|
instancingTransform = mat4(
|
|
a_instancingTransformRow0.x, a_instancingTransformRow1.x, a_instancingTransformRow2.x, 0.0, // Column 1
|
|
a_instancingTransformRow0.y, a_instancingTransformRow1.y, a_instancingTransformRow2.y, 0.0, // Column 2
|
|
a_instancingTransformRow0.z, a_instancingTransformRow1.z, a_instancingTransformRow2.z, 0.0, // Column 3
|
|
a_instancingTransformRow0.w, a_instancingTransformRow1.w, a_instancingTransformRow2.w, 1.0 // Column 4
|
|
);
|
|
#else
|
|
vec3 translation = vec3(0.0, 0.0, 0.0);
|
|
vec3 scale = vec3(1.0, 1.0, 1.0);
|
|
|
|
#ifdef HAS_INSTANCE_TRANSLATION
|
|
translation = a_instanceTranslation;
|
|
#endif
|
|
#ifdef HAS_INSTANCE_SCALE
|
|
scale = a_instanceScale;
|
|
#endif
|
|
|
|
instancingTransform = mat4(
|
|
scale.x, 0.0, 0.0, 0.0,
|
|
0.0, scale.y, 0.0, 0.0,
|
|
0.0, 0.0, scale.z, 0.0,
|
|
translation.x, translation.y, translation.z, 1.0
|
|
);
|
|
#endif
|
|
|
|
return instancingTransform;
|
|
}
|
|
|
|
#ifdef USE_2D_INSTANCING
|
|
mat4 getInstancingTransform2D()
|
|
{
|
|
mat4 instancingTransform2D;
|
|
|
|
#ifdef HAS_INSTANCE_MATRICES
|
|
instancingTransform2D = mat4(
|
|
a_instancingTransform2DRow0.x, a_instancingTransform2DRow1.x, a_instancingTransform2DRow2.x, 0.0, // Column 1
|
|
a_instancingTransform2DRow0.y, a_instancingTransform2DRow1.y, a_instancingTransform2DRow2.y, 0.0, // Column 2
|
|
a_instancingTransform2DRow0.z, a_instancingTransform2DRow1.z, a_instancingTransform2DRow2.z, 0.0, // Column 3
|
|
a_instancingTransform2DRow0.w, a_instancingTransform2DRow1.w, a_instancingTransform2DRow2.w, 1.0 // Column 4
|
|
);
|
|
#else
|
|
vec3 translation2D = vec3(0.0, 0.0, 0.0);
|
|
vec3 scale = vec3(1.0, 1.0, 1.0);
|
|
|
|
#ifdef HAS_INSTANCE_TRANSLATION
|
|
translation2D = a_instanceTranslation2D;
|
|
#endif
|
|
#ifdef HAS_INSTANCE_SCALE
|
|
scale = a_instanceScale;
|
|
#endif
|
|
|
|
instancingTransform2D = mat4(
|
|
scale.x, 0.0, 0.0, 0.0,
|
|
0.0, scale.y, 0.0, 0.0,
|
|
0.0, 0.0, scale.z, 0.0,
|
|
translation2D.x, translation2D.y, translation2D.z, 1.0
|
|
);
|
|
#endif
|
|
|
|
return instancingTransform2D;
|
|
}
|
|
#endif
|
|
`,Tye=`void instancingStage(inout ProcessedAttributes attributes)
|
|
{
|
|
vec3 positionMC = attributes.positionMC;
|
|
|
|
mat4 instancingTransform = getInstancingTransform();
|
|
|
|
attributes.positionMC = (instancingTransform * vec4(positionMC, 1.0)).xyz;
|
|
|
|
#ifdef HAS_NORMALS
|
|
vec3 normalMC = attributes.normalMC;
|
|
attributes.normalMC = (instancingTransform * vec4(normalMC, 0.0)).xyz;
|
|
#endif
|
|
|
|
#ifdef USE_2D_INSTANCING
|
|
mat4 instancingTransform2D = getInstancingTransform2D();
|
|
attributes.position2D = (instancingTransform2D * vec4(positionMC, 1.0)).xyz;
|
|
#endif
|
|
}
|
|
`,Aye=`void legacyInstancingStage(
|
|
inout ProcessedAttributes attributes,
|
|
out mat4 instanceModelView,
|
|
out mat3 instanceModelViewInverseTranspose)
|
|
{
|
|
vec3 positionMC = attributes.positionMC;
|
|
|
|
mat4 instancingTransform = getInstancingTransform();
|
|
|
|
mat4 instanceModel = instancingTransform * u_instance_nodeTransform;
|
|
instanceModelView = u_instance_modifiedModelView;
|
|
instanceModelViewInverseTranspose = mat3(u_instance_modifiedModelView * instanceModel);
|
|
|
|
attributes.positionMC = (instanceModel * vec4(positionMC, 1.0)).xyz;
|
|
|
|
#ifdef USE_2D_INSTANCING
|
|
mat4 instancingTransform2D = getInstancingTransform2D();
|
|
attributes.position2D = (instancingTransform2D * vec4(positionMC, 1.0)).xyz;
|
|
#endif
|
|
}
|
|
`,gT=new L,xye=new L,Cye=new L,GH={name:"InstancingPipelineStage",_getInstanceTransformsAsMatrices:$H,_transformsToTypedArray:iD};GH.process=function(e,t,n){const i=t.instances,o=i.attributes[0].count,r=e.shaderBuilder;r.addDefine("HAS_INSTANCING"),r.addVertexLines(bye);const s=e.model,a=s.sceneGraph,l=e.runtimeNode,u=n.mode!==oe.SCENE3D&&!n.scene3DOnly&&s._projectTo2D,h=s._enablePick&&!n.context.webgl2,f=[];Mye(e,n,i,f,u,h),zye(e,n,i,f);const _={};if(i.transformInWorldSpace?(r.addDefine("USE_LEGACY_INSTANCING",void 0,ge.VERTEX),r.addUniform("mat4","u_instance_modifiedModelView",ge.VERTEX),r.addUniform("mat4","u_instance_nodeTransform",ge.VERTEX),_.u_instance_modifiedModelView=function(){let g=L.multiplyTransformation(s.modelMatrix,a.components.transform,gT);return u?L.multiplyTransformation(n.context.uniformState.view3D,g,gT):(n.mode!==oe.SCENE3D&&(g=zt.basisTo2D(n.mapProjection,g,gT)),L.multiplyTransformation(n.context.uniformState.view,g,gT))},_.u_instance_nodeTransform=function(){return L.multiplyTransformation(a.axisCorrectionMatrix,l.computedTransform,xye)},r.addVertexLines(Aye)):r.addVertexLines(Tye),u){r.addDefine("USE_2D_INSTANCING",void 0,ge.VERTEX),r.addUniform("mat4","u_modelView2D",ge.VERTEX);const g=n.context,m=L.fromTranslation(l.instancingReferencePoint2D,new L);_.u_modelView2D=function(){return L.multiplyTransformation(g.uniformState.view,m,Cye)}}e.uniformMap=jt(_,e.uniformMap),e.instanceCount=o,e.attributes.push.apply(e.attributes,f)};const Ly=new L,Eye=new d;function wye(e,t,n,i,o){let r=L.multiplyTransformation(t,e,Ly);return r=L.multiplyTransformation(r,n,Ly),o=zt.basisTo2D(i.mapProjection,r,o),o}function Sye(e,t,n,i,o){const r=L.fromTranslation(e,Ly);let s=L.multiplyTransformation(t,r,Ly);s=L.multiplyTransformation(s,n,Ly);const a=L.getTranslation(s,Eye);return o=Ao.computeActualWgs84Position(i,a,o),o}function jH(e,t,n){const i=e.model,o=i.sceneGraph;e.runtimeNode.node.instances.transformInWorldSpace?(t=L.multiplyTransformation(i.modelMatrix,o.components.transform,t),n=L.multiplyTransformation(o.axisCorrectionMatrix,e.runtimeNode.computedTransform,n)):(t=L.clone(o.computedModelMatrix,t),t=L.multiplyTransformation(t,e.runtimeNode.computedTransform,t),n=L.clone(L.IDENTITY,n))}const WH=new L,qH=new L,vye=new L,Iye=new d;function Dye(e,t,n,i){const o=WH,r=qH;jH(t,o,r);const a=t.runtimeNode.instancingReferencePoint2D,l=e.length;for(let u=0;u<l;u++){const h=e[u],f=wye(h,o,r,n,vye),_=L.getTranslation(f,Iye),g=d.subtract(_,a,_);i[u]=L.setTranslation(f,g,i[u])}return i}function Pye(e,t,n,i){const o=WH,r=qH;jH(t,o,r);const a=t.runtimeNode.instancingReferencePoint2D,l=e.length;for(let u=0;u<l;u++){const h=e[u],f=Sye(h,o,r,n,h);i[u]=d.subtract(f,a,i[u])}return i}const Oye=new d,Lye=new d;function YH(e,t){const n=e.runtimeNode,i=e.model.sceneGraph.computedModelMatrix,o=L.multiplyByPoint(i,n.instancingTranslationMin,Oye),r=Ao.computeActualWgs84Position(t,o,o),s=L.multiplyByPoint(i,n.instancingTranslationMax,Lye),a=Ao.computeActualWgs84Position(t,s,s);n.instancingReferencePoint2D=d.lerp(r,a,.5,new d)}function iD(e){const n=e.length,i=new Float32Array(n*12);for(let o=0;o<n;o++){const r=e[o],s=12*o;i[s+0]=r[0],i[s+1]=r[4],i[s+2]=r[8],i[s+3]=r[12],i[s+4]=r[1],i[s+5]=r[5],i[s+6]=r[9],i[s+7]=r[13],i[s+8]=r[2],i[s+9]=r[6],i[s+10]=r[10],i[s+11]=r[14]}return i}function Rye(e){const n=e.length,i=new Float32Array(n*3);for(let o=0;o<n;o++){const r=e[o],s=3*o;i[s+0]=r[0],i[s+1]=r[4],i[s+2]=r[8]}return i}new d;new _e;new d;function $H(e,t,n){const i=new Array(t),o=Lt.getAttributeBySemantic(e,hs.TRANSLATION),r=Lt.getAttributeBySemantic(e,hs.ROTATION),s=Lt.getAttributeBySemantic(e,hs.SCALE),a=new d(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),l=new d(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),u=c(o),h=c(r),f=c(s),_=u?o.typedArray:new Float32Array(t*3);let g=h?r.typedArray:new Float32Array(t*4);h&&r.normalized&&(g=En.dequantize(g,r.componentDatatype,r.type,t));let m;f?m=s.typedArray:(m=new Float32Array(t*3),m.fill(1));for(let T=0;T<t;T++){const x=new d(_[T*3],_[T*3+1],_[T*3+2]);d.maximumByComponent(a,x,a),d.minimumByComponent(l,x,l);const C=new _e(g[T*4],g[T*4+1],g[T*4+2],h?g[T*4+3]:1),w=new d(m[T*3],m[T*3+1],m[T*3+2]),v=L.fromTranslationQuaternionRotationScale(x,C,w,new L);i[T]=v}const b=n.runtimeNode;return b.instancingTranslationMin=l,b.instancingTranslationMax=a,u&&(o.typedArray=void 0),h&&(r.typedArray=void 0),f&&(s.typedArray=void 0),i}function Nye(e,t,n){const i=new Array(t),o=e.typedArray,r=new d(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),s=new d(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);for(let l=0;l<t;l++){const u=new d(o[l*3],o[l*3+1],o[l*3+2]);i[l]=u,d.minimumByComponent(r,u,r),d.maximumByComponent(s,u,s)}const a=n.runtimeNode;return a.instancingTranslationMin=r,a.instancingTranslationMax=s,e.typedArray=void 0,i}function oD(e,t){const n=ct.createVertexBuffer({context:t.context,typedArray:e,usage:ke.STATIC_DRAW});return n.vertexArrayDestroyable=!1,n}function Mye(e,t,n,i,o,r){const s=Lt.getAttributeBySemantic(n,hs.ROTATION);c(s)?Fye(e,n,i,t,o,r):Bye(e,n,i,t,o)}function Fye(e,t,n,i,o,r){const s=e.shaderBuilder,a=t.attributes[0].count,l=e.model,u=e.runtimeNode;s.addDefine("HAS_INSTANCE_MATRICES");const h="Transform";let f,_=u.instancingTransformsBuffer;if(!c(_)){f=$H(t,a,e);const T=iD(f);_=oD(T,i),l._modelResources.push(_),r&&(u.transformsTypedArray=T),u.instancingTransformsBuffer=_}if(dF(e,_,n,h),!o)return;const g=Je(i);g.mode=oe.COLUMBUS_VIEW,YH(e,g);let m=u.instancingTransformsBuffer2D;if(!c(m)){const T=Dye(f,e,g,f),x=iD(T);m=oD(x,i),l._modelResources.push(m),u.instancingTransformsBuffer2D=m}dF(e,m,n,"Transform2D")}function Bye(e,t,n,i,o,r){const s=e.shaderBuilder,a=e.runtimeNode,l=Lt.getAttributeBySemantic(t,hs.TRANSLATION),u=Lt.getAttributeBySemantic(t,hs.SCALE);if(c(u)){s.addDefine("HAS_INSTANCE_SCALE");const C="Scale";rS(e,u.buffer,u.byteOffset,u.byteStride,n,C)}if(!c(l))return;let h;const f=l.typedArray;c(f)?h=Nye(l,l.count,e):c(a.instancingTranslationMin)||(a.instancingTranslationMin=l.min,a.instancingTranslationMax=l.max),s.addDefine("HAS_INSTANCE_TRANSLATION");const _="Translation";if(rS(e,l.buffer,l.byteOffset,l.byteStride,n,_),!o&&!r)return;const g=Je(i);g.mode=oe.COLUMBUS_VIEW,YH(e,g);let m=a.instancingTranslationBuffer2D;if(!c(m)){const C=Pye(h,e,g,h),w=Rye(C);r&&(a.transformsTypedArray=w),m=oD(w,i),e.model._modelResources.push(m),a.instancingTranslationBuffer2D=m}if(!o)return;rS(e,m,0,void 0,n,"Translation2D")}function dF(e,t,n,i){const r=Z.getSizeInBytes(Z.FLOAT),s=r*12,a=[{index:e.attributeIndex++,vertexBuffer:t,componentsPerAttribute:4,componentDatatype:Z.FLOAT,normalize:!1,offsetInBytes:0,strideInBytes:s,instanceDivisor:1},{index:e.attributeIndex++,vertexBuffer:t,componentsPerAttribute:4,componentDatatype:Z.FLOAT,normalize:!1,offsetInBytes:r*4,strideInBytes:s,instanceDivisor:1},{index:e.attributeIndex++,vertexBuffer:t,componentsPerAttribute:4,componentDatatype:Z.FLOAT,normalize:!1,offsetInBytes:r*8,strideInBytes:s,instanceDivisor:1}],l=e.shaderBuilder;l.addAttribute("vec4",`a_instancing${i}Row0`),l.addAttribute("vec4",`a_instancing${i}Row1`),l.addAttribute("vec4",`a_instancing${i}Row2`),n.push.apply(n,a)}function rS(e,t,n,i,o,r){o.push({index:e.attributeIndex++,vertexBuffer:t,componentsPerAttribute:3,componentDatatype:Z.FLOAT,normalize:!1,offsetInBytes:n,strideInBytes:i,instanceDivisor:1}),e.shaderBuilder.addAttribute("vec3",`a_instance${r}`)}function zye(e,t,n,i){const o=n.attributes,r=e.shaderBuilder;for(let s=0;s<o.length;s++){const a=o[s];a.semantic===hs.FEATURE_ID&&(a.setIndex>=e.featureIdVertexAttributeSetIndex&&(e.featureIdVertexAttributeSetIndex=a.setIndex+1),i.push({index:e.attributeIndex++,vertexBuffer:a.buffer,componentsPerAttribute:qt.getNumberOfComponents(a.type),componentDatatype:a.componentDatatype,normalize:!1,offsetInBytes:a.byteOffset,strideInBytes:a.byteStride,instanceDivisor:1}),r.addAttribute("float",`a_instanceFeatureId_${a.setIndex}`))}}const Uye=GH,LO={};LO.name="ModelMatrixUpdateStage";LO.update=function(e,t,n){const i=n.mode!==oe.SCENE3D;if(!(i&&t._model._projectTo2D)&&e._transformDirty){const o=i?t._computedModelMatrix2D:t._computedModelMatrix;XH(e,t,o,e.transformToRoot),e._transformDirty=!1}};function XH(e,t,n,i){let o;i=L.multiplyTransformation(i,e.transform,new L),e.updateComputedTransform();const r=e.runtimePrimitives.length;for(o=0;o<r;o++){const l=e.runtimePrimitives[o].drawCommand;l.modelMatrix=L.multiplyTransformation(n,i,l.modelMatrix),l.cullFace=Lt.getCullFace(l.modelMatrix,l.primitiveType)}const s=e.children.length;for(o=0;o<s;o++){const a=t._runtimeNodes[e.children[o]];a._transformToRoot=L.clone(i,a._transformToRoot),XH(a,t,n,i),a._transformDirty=!1}}const kye=LO,QH={name:"NodeStatisticsPipelineStage",_countInstancingAttributes:KH,_countGeneratedBuffers:ZH};QH.process=function(e,t,n){const i=e.model.statistics,o=t.instances,r=e.runtimeNode;KH(i,o),ZH(i,r)};function KH(e,t){if(!c(t))return;const n=t.attributes,i=n.length;for(let o=0;o<i;o++){const r=n[o];c(r.buffer)&&e.addBuffer(r.buffer,!1)}}function ZH(e,t){c(t.instancingTransformsBuffer)&&e.addBuffer(t.instancingTransformsBuffer,!1),c(t.instancingTransformsBuffer2D)&&e.addBuffer(t.instancingTransformsBuffer2D,!1),c(t.instancingTranslationBuffer2D)&&e.addBuffer(t.instancingTranslationBuffer2D,!1)}const Vye=QH;function Q_(e){e=y(e,y.EMPTY_OBJECT);const t=e.node,n=e.transform,i=e.transformToRoot,o=e.sceneGraph,r=e.children;A.typeOf.object("options.node",t),A.typeOf.object("options.transform",n),A.typeOf.object("options.transformToRoot",i),A.typeOf.object("options.sceneGraph",o),A.typeOf.object("options.children",r),this._node=t,this._name=t.name,this._id=t.index,this._sceneGraph=o,this._children=r,this._originalTransform=L.clone(n,this._originalTransform),this._transform=L.clone(n,this._transform),this._transformToRoot=L.clone(i,this._transformToRoot),this._computedTransform=new L,this._transformDirty=!1,this._transformParameters=void 0,this._morphWeights=[],this._runtimeSkin=void 0,this._computedJointMatrices=[],this.show=!0,this.userAnimated=!1,this.pipelineStages=[],this.runtimePrimitives=[],this.updateStages=[],this.instancingTranslationMin=void 0,this.instancingTranslationMax=void 0,this.instancingTransformsBuffer=void 0,this.instancingTransformsBuffer2D=void 0,this.instancingTranslationBuffer2D=void 0,this.instancingReferencePoint2D=void 0,Hye(this)}Object.defineProperties(Q_.prototype,{node:{get:function(){return this._node}},sceneGraph:{get:function(){return this._sceneGraph}},children:{get:function(){return this._children}},transform:{get:function(){return this._transform},set:function(e){this._transformDirty=!0,this._transform=L.clone(e,this._transform)}},transformToRoot:{get:function(){return this._transformToRoot}},computedTransform:{get:function(){return this._computedTransform}},originalTransform:{get:function(){return this._originalTransform}},translation:{get:function(){return c(this._transformParameters)?this._transformParameters.translation:void 0},set:function(e){const t=this._transformParameters;if(!c(t))throw new E("The translation of a node cannot be set if it was defined using a matrix in the model.");const n=t.translation;d.equals(n,e)||(t.translation=d.clone(e,t.translation),sS(this,t))}},rotation:{get:function(){return c(this._transformParameters)?this._transformParameters.rotation:void 0},set:function(e){const t=this._transformParameters;if(!c(t))throw new E("The rotation of a node cannot be set if it was defined using a matrix in the model.");const n=t.rotation;_e.equals(n,e)||(t.rotation=_e.clone(e,t.rotation),sS(this,t))}},scale:{get:function(){return c(this._transformParameters)?this._transformParameters.scale:void 0},set:function(e){const t=this._transformParameters;if(!c(t))throw new E("The scale of a node cannot be set if it was defined using a matrix in the model.");const n=t.scale;d.equals(n,e)||(t.scale=d.clone(e,t.scale),sS(this,t))}},morphWeights:{get:function(){return this._morphWeights},set:function(e){const t=e.length;if(this._morphWeights.length!==t)throw new E("value must have the same length as the original weights array.");for(let n=0;n<t;n++)this._morphWeights[n]=e[n]}},runtimeSkin:{get:function(){return this._runtimeSkin}},computedJointMatrices:{get:function(){return this._computedJointMatrices}}});function Hye(e){const t=e.transform,n=e.transformToRoot,i=e._computedTransform;e._computedTransform=L.multiply(n,t,i);const o=e.node;c(o.matrix)||(e._transformParameters=new TC(o.translation,o.rotation,o.scale)),c(o.morphWeights)&&(e._morphWeights=o.morphWeights.slice());const r=o.articulationName;if(c(r)){const l=e.sceneGraph._runtimeArticulations[r];c(l)&&l.runtimeNodes.push(e)}}function sS(e,t){e._transformDirty=!0,e._transform=L.fromTranslationRotationScale(t,e._transform)}Q_.prototype.getChild=function(e){if(A.typeOf.number("index",e),e<0||e>=this.children.length)throw new E("index must be greater than or equal to 0 and less than the number of children.");return this.sceneGraph._runtimeNodes[this.children[e]]};Q_.prototype.configurePipeline=function(){const e=this.node,t=this.pipelineStages;t.length=0;const n=this.updateStages;n.length=0,c(e.instances)&&t.push(Uye),t.push(Vye),n.push(kye)};Q_.prototype.updateComputedTransform=function(){this._computedTransform=L.multiply(this._transformToRoot,this._transform,this._computedTransform)};Q_.prototype.updateJointMatrices=function(){const e=this._runtimeSkin;if(!c(e))return;e.updateJointMatrices();const t=this._computedJointMatrices,n=e.jointMatrices,i=n.length;for(let o=0;o<i;o++){c(t[o])||(t[o]=new L);const r=L.multiplyTransformation(this.transformToRoot,this.transform,t[o]),s=L.inverseTransformation(r,t[o]);t[o]=L.multiplyTransformation(s,n[o],t[o])}};const JH={name:"AlphaPipelineStage"};JH.process=function(e,t,n){const i=e.alphaOptions,o=e.model;i.pass=y(i.pass,o.opaquePass);const r=e.renderStateOptions;i.pass===xe.TRANSLUCENT&&(r.cull.enabled=!1,r.depthMask=!1,r.blending=Zn.ALPHA_BLEND);const s=e.shaderBuilder,a=e.uniformMap;c(i.alphaCutoff)&&(s.addDefine("ALPHA_MODE_MASK",void 0,ge.FRAGMENT),s.addUniform("float","u_alphaCutoff",ge.FRAGMENT),a.u_alphaCutoff=function(){return i.alphaCutoff})};const Gye=JH,e5={name:"BatchTexturePipelineStage"};e5.process=function(e,t,n){const i=e.shaderBuilder,o={},r=e.model,s=r.featureTables[r.featureTableId],a=s.featuresLength;i.addUniform("int","model_featuresLength"),o.model_featuresLength=function(){return a};const l=s.batchTexture;i.addUniform("sampler2D","model_batchTexture"),o.model_batchTexture=function(){return y(l.batchTexture,l.defaultTexture)},i.addUniform("vec4","model_textureStep"),o.model_textureStep=function(){return l.textureStep},l.textureDimensions.y>1&&(i.addDefine("MULTILINE_BATCH_TEXTURE"),i.addUniform("vec2","model_textureDimensions"),o.model_textureDimensions=function(){return l.textureDimensions}),e.uniformMap=jt(o,e.uniformMap)};const jye=e5,t5={name:"ClassificationPipelineStage"};t5.process=function(e,t,n){e.shaderBuilder.addDefine("HAS_CLASSIFICATION",void 0,ge.BOTH);const o=e.runtimePrimitive;c(o.batchLengths)||Wye(t,o)};function Wye(e,t){const n=Lt.getAttributeBySemantic(e,ht.POSITION);if(!c(n))throw new Te("Primitives must have a position attribute to be used for classification.");let i;const o=e.indices,r=c(o);r&&(i=o.typedArray,o.typedArray=void 0);const s=r?o.count:n.count,a=Lt.getAttributeBySemantic(e,ht.FEATURE_ID,0);if(!c(a)){t.batchLengths=[s],t.batchOffsets=[0];return}const l=a.typedArray;a.typedArray=void 0;const u=[],h=[0],f=r?i[0]:0;let _=l[f],g=0;for(let b=1;b<s;b++){const T=r?i[b]:b,x=l[T];if(x!==_){const C=b-g,w=b;u.push(C),h.push(w),g=w,_=x}}const m=s-g;u.push(m),t.batchLengths=u,t.batchOffsets=h}const qye=t5,Yye=`void filterByPassType(inout vec3 positionMC, vec4 featureColor)
|
|
{
|
|
bool styleTranslucent = (featureColor.a != 1.0);
|
|
// Only render translucent features in the translucent pass (if the style or the original command has translucency).
|
|
if (czm_pass == czm_passTranslucent && !styleTranslucent && !model_commandTranslucent)
|
|
{
|
|
// If the model has a translucent silhouette, it needs to render during the silhouette color command,
|
|
// (i.e. the command where model_silhouettePass = true), even if the model isn't translucent.
|
|
#ifdef HAS_SILHOUETTE
|
|
positionMC *= float(model_silhouettePass);
|
|
#else
|
|
positionMC *= 0.0;
|
|
#endif
|
|
}
|
|
// If the current pass is not the translucent pass and the style is not translucent, don't render the feature.
|
|
else if (czm_pass != czm_passTranslucent && styleTranslucent)
|
|
{
|
|
positionMC *= 0.0;
|
|
}
|
|
}
|
|
|
|
void cpuStylingStage(inout vec3 positionMC, inout SelectedFeature feature)
|
|
{
|
|
float show = ceil(feature.color.a);
|
|
positionMC *= show;
|
|
|
|
#if defined(HAS_SELECTED_FEATURE_ID_ATTRIBUTE) && !defined(HAS_CLASSIFICATION)
|
|
filterByPassType(positionMC, feature.color);
|
|
#endif
|
|
}
|
|
`,$ye=`void filterByPassType(vec4 featureColor)
|
|
{
|
|
bool styleTranslucent = (featureColor.a != 1.0);
|
|
// Only render translucent features in the translucent pass (if the style or the original command has translucency).
|
|
if (czm_pass == czm_passTranslucent && !styleTranslucent && !model_commandTranslucent)
|
|
{
|
|
// If the model has a translucent silhouette, it needs to render during the silhouette color command,
|
|
// (i.e. the command where model_silhouettePass = true), even if the model isn't translucent.
|
|
#ifdef HAS_SILHOUETTE
|
|
if(!model_silhouettePass) {
|
|
discard;
|
|
}
|
|
#else
|
|
discard;
|
|
#endif
|
|
}
|
|
// If the current pass is not the translucent pass and the style is not translucent, don't render the feature.
|
|
else if (czm_pass != czm_passTranslucent && styleTranslucent)
|
|
{
|
|
discard;
|
|
}
|
|
}
|
|
|
|
void cpuStylingStage(inout czm_modelMaterial material, SelectedFeature feature)
|
|
{
|
|
vec4 featureColor = feature.color;
|
|
if (featureColor.a == 0.0)
|
|
{
|
|
discard;
|
|
}
|
|
|
|
// If a feature ID vertex attribute is used, the pass type filter is applied in the vertex shader.
|
|
// So, we only apply in in the fragment shader if the feature ID texture is used.
|
|
#if defined(HAS_SELECTED_FEATURE_ID_TEXTURE) && !defined(HAS_CLASSIFICATION)
|
|
filterByPassType(featureColor);
|
|
#endif
|
|
|
|
featureColor = czm_gammaCorrect(featureColor);
|
|
|
|
// Classification models compute the diffuse differently.
|
|
#ifdef HAS_CLASSIFICATION
|
|
material.diffuse = featureColor.rgb * featureColor.a;
|
|
#else
|
|
float highlight = ceil(model_colorBlend);
|
|
material.diffuse *= mix(featureColor.rgb, vec3(1.0), highlight);
|
|
#endif
|
|
|
|
material.alpha *= featureColor.a;
|
|
}
|
|
`,n5={name:"CPUStylingPipelineStage"};n5.process=function(e,t,n){const i=e.model,o=e.shaderBuilder;o.addVertexLines(Yye),o.addFragmentLines($ye),o.addDefine("USE_CPU_STYLING",void 0,ge.BOTH),c(i.color)||(o.addUniform("float",nD.COLOR_BLEND_UNIFORM_NAME,ge.FRAGMENT),e.uniformMap[nD.COLOR_BLEND_UNIFORM_NAME]=function(){return RC.getColorBlend(i.colorBlendMode,i.colorBlendAmount)}),o.addUniform("bool","model_commandTranslucent",ge.BOTH),e.uniformMap.model_commandTranslucent=function(){return e.alphaOptions.pass===xe.TRANSLUCENT}};const Xye=n5,i5={MODIFY_MATERIAL:"MODIFY_MATERIAL",REPLACE_MATERIAL:"REPLACE_MATERIAL"};i5.getDefineName=function(e){return`CUSTOM_SHADER_${e}`};const RO=Object.freeze(i5),Qye=`void customShaderStage(
|
|
inout czm_modelVertexOutput vsOutput,
|
|
inout ProcessedAttributes attributes,
|
|
FeatureIds featureIds,
|
|
Metadata metadata,
|
|
MetadataClass metadataClass,
|
|
MetadataStatistics metadataStatistics
|
|
) {
|
|
// VertexInput and initializeInputStruct() are dynamically generated in JS,
|
|
// see CustomShaderPipelineStage.js
|
|
VertexInput vsInput;
|
|
initializeInputStruct(vsInput, attributes);
|
|
vsInput.featureIds = featureIds;
|
|
vsInput.metadata = metadata;
|
|
vsInput.metadataClass = metadataClass;
|
|
vsInput.metadataStatistics = metadataStatistics;
|
|
vertexMain(vsInput, vsOutput);
|
|
attributes.positionMC = vsOutput.positionMC;
|
|
}
|
|
`,Kye=`void customShaderStage(
|
|
inout czm_modelMaterial material,
|
|
ProcessedAttributes attributes,
|
|
FeatureIds featureIds,
|
|
Metadata metadata,
|
|
MetadataClass metadataClass,
|
|
MetadataStatistics metadataStatistics
|
|
) {
|
|
// FragmentInput and initializeInputStruct() are dynamically generated in JS,
|
|
// see CustomShaderPipelineStage.js
|
|
FragmentInput fsInput;
|
|
initializeInputStruct(fsInput, attributes);
|
|
fsInput.featureIds = featureIds;
|
|
fsInput.metadata = metadata;
|
|
fsInput.metadataClass = metadataClass;
|
|
fsInput.metadataStatistics = metadataStatistics;
|
|
fragmentMain(fsInput, material);
|
|
}
|
|
`,Zye=`void featureIdStage(out FeatureIds featureIds, ProcessedAttributes attributes) {
|
|
initializeFeatureIds(featureIds, attributes);
|
|
initializeFeatureIdAliases(featureIds);
|
|
}
|
|
`,Jye=`void featureIdStage(out FeatureIds featureIds, ProcessedAttributes attributes)
|
|
{
|
|
initializeFeatureIds(featureIds, attributes);
|
|
initializeFeatureIdAliases(featureIds);
|
|
setFeatureIdVaryings();
|
|
}
|
|
`,Sn={name:"FeatureIdPipelineStage",STRUCT_ID_FEATURE_IDS_VS:"FeatureIdsVS",STRUCT_ID_FEATURE_IDS_FS:"FeatureIdsFS",STRUCT_NAME_FEATURE_IDS:"FeatureIds",FUNCTION_ID_INITIALIZE_FEATURE_IDS_VS:"initializeFeatureIdsVS",FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS:"initializeFeatureIdsFS",FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_VS:"initializeFeatureIdAliasesVS",FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_FS:"initializeFeatureIdAliasesFS",FUNCTION_SIGNATURE_INITIALIZE_FEATURE_IDS:"void initializeFeatureIds(out FeatureIds featureIds, ProcessedAttributes attributes)",FUNCTION_SIGNATURE_INITIALIZE_FEATURE_ID_ALIASES:"void initializeFeatureIdAliases(inout FeatureIds featureIds)",FUNCTION_ID_SET_FEATURE_ID_VARYINGS:"setFeatureIdVaryings",FUNCTION_SIGNATURE_SET_FEATURE_ID_VARYINGS:"void setFeatureIdVaryings()"};Sn.process=function(e,t,n){const i=e.shaderBuilder;e0e(i);const o=e.runtimeNode.node.instances;c(o)&&t0e(e,o,n),n0e(e,t,n),i.addVertexLines(Jye),i.addFragmentLines(Zye)};function e0e(e){e.addStruct(Sn.STRUCT_ID_FEATURE_IDS_VS,Sn.STRUCT_NAME_FEATURE_IDS,ge.VERTEX),e.addStruct(Sn.STRUCT_ID_FEATURE_IDS_FS,Sn.STRUCT_NAME_FEATURE_IDS,ge.FRAGMENT),e.addFunction(Sn.FUNCTION_ID_INITIALIZE_FEATURE_IDS_VS,Sn.FUNCTION_SIGNATURE_INITIALIZE_FEATURE_IDS,ge.VERTEX),e.addFunction(Sn.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS,Sn.FUNCTION_SIGNATURE_INITIALIZE_FEATURE_IDS,ge.FRAGMENT),e.addFunction(Sn.FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_VS,Sn.FUNCTION_SIGNATURE_INITIALIZE_FEATURE_ID_ALIASES,ge.VERTEX),e.addFunction(Sn.FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_FS,Sn.FUNCTION_SIGNATURE_INITIALIZE_FEATURE_ID_ALIASES,ge.FRAGMENT),e.addFunction(Sn.FUNCTION_ID_SET_FEATURE_ID_VARYINGS,Sn.FUNCTION_SIGNATURE_SET_FEATURE_ID_VARYINGS,ge.VERTEX)}function t0e(e,t,n){const i=t.featureIds,o=t.attributes[0].count;for(let r=0;r<i.length;r++){const s=i[r],a=s.positionalLabel;s instanceof yt.FeatureIdAttribute?i0e(e,s,a):o5(e,s,a,o,1,n);const l=s.label;c(l)&&r5(e,a,l,ge.BOTH)}}function n0e(e,t,n){const i=t.featureIds,r=Lt.getAttributeBySemantic(t,ht.POSITION).count;for(let s=0;s<i.length;s++){const a=i[s],l=a.positionalLabel;let u=ge.BOTH;a instanceof yt.FeatureIdAttribute?o0e(e,a,l):a instanceof yt.FeatureIdImplicitRange?o5(e,a,l,r,void 0,n):(r0e(e,a,l,s,n),u=ge.FRAGMENT);const h=a.label;c(h)&&r5(e,l,h,u)}}function i0e(e,t,n){const i=e.shaderBuilder;i.addStructField(Sn.STRUCT_ID_FEATURE_IDS_VS,"int",n),i.addStructField(Sn.STRUCT_ID_FEATURE_IDS_FS,"int",n);const o=t.setIndex,r=n.replace(/_\d+$/,"_"),s=`a_${r}${o}`,a=`v_${r}${o}`,l=`featureIds.${n} = int(czm_round(${s}));`,u=`featureIds.${n} = int(czm_round(${a}));`;i.addFunctionLines(Sn.FUNCTION_ID_INITIALIZE_FEATURE_IDS_VS,[l]),i.addFunctionLines(Sn.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS,[u]),i.addVarying("float",a),i.addFunctionLines(Sn.FUNCTION_ID_SET_FEATURE_ID_VARYINGS,[`${a} = ${s};`])}function o0e(e,t,n){const i=e.shaderBuilder;i.addStructField(Sn.STRUCT_ID_FEATURE_IDS_VS,"int",n),i.addStructField(Sn.STRUCT_ID_FEATURE_IDS_FS,"int",n);const o=t.setIndex,r=n.replace(/_\d+$/,"_"),s=[`featureIds.${n} = int(czm_round(attributes.${r}${o}));`];i.addFunctionLines(Sn.FUNCTION_ID_INITIALIZE_FEATURE_IDS_VS,s),i.addFunctionLines(Sn.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS,s)}function o5(e,t,n,i,o,r){s0e(e,t,i,o,r);const s=e.shaderBuilder,a=`a_implicit_${n}`;s.addAttribute("float",a);const l=`v_implicit_${n}`;s.addVarying("float",l),s.addStructField(Sn.STRUCT_ID_FEATURE_IDS_VS,"int",n),s.addStructField(Sn.STRUCT_ID_FEATURE_IDS_FS,"int",n),s.addFunctionLines(Sn.FUNCTION_ID_SET_FEATURE_ID_VARYINGS,[`${l} = ${a};`]),s.addFunctionLines(Sn.FUNCTION_ID_INITIALIZE_FEATURE_IDS_VS,[`featureIds.${n} = int(czm_round(${a}));`]),s.addFunctionLines(Sn.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS,[`featureIds.${n} = int(czm_round(${l}));`])}function r0e(e,t,n,i,o){const r=`u_featureIdTexture_${i}`,s=e.uniformMap,a=t.textureReader;s[r]=function(){return y(a.texture,o.context.defaultTexture)};const l=a.channels,u=e.shaderBuilder;u.addStructField(Sn.STRUCT_ID_FEATURE_IDS_FS,"int",n),u.addUniform("sampler2D",r,ge.FRAGMENT);const f=`v_texCoord_${a.texCoord}`;let _=f;const g=a.transform;if(c(g)&&!$.equals(g,$.IDENTITY)){const T=`${r}Transform`;u.addUniform("mat3",T,ge.FRAGMENT),s[T]=function(){return g},_=`vec2(${T} * vec3(${f}, 1.0))`}const m=`texture(${r}, ${_}).${l}`,b=`featureIds.${n} = czm_unpackUint(${m});`;u.addFunctionLines(Sn.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS,[b])}function r5(e,t,n,i){const o=e.shaderBuilder,r=ge.includesVertexShader(i);r&&o.addStructField(Sn.STRUCT_ID_FEATURE_IDS_VS,"int",n),o.addStructField(Sn.STRUCT_ID_FEATURE_IDS_FS,"int",n);const s=[`featureIds.${n} = featureIds.${t};`];r&&o.addFunctionLines(Sn.FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_VS,s),o.addFunctionLines(Sn.FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_FS,s)}function s0e(e,t,n,i,o){const r=e.model;let s,a;if(c(t.repeat)){const u=a0e(t,n);s=ct.createVertexBuffer({context:o.context,typedArray:u,usage:ke.STATIC_DRAW}),s.vertexArrayDestroyable=!1,r._pipelineResources.push(s);const h=!1;r.statistics.addBuffer(s,h)}else a=[t.offset];const l={index:e.attributeIndex++,instanceDivisor:i,value:a,vertexBuffer:s,normalize:!1,componentsPerAttribute:1,componentDatatype:Z.FLOAT,strideInBytes:Z.getSizeInBytes(Z.FLOAT),offsetInBytes:0};e.attributes.push(l)}function a0e(e,t){const n=e.offset,i=e.repeat,o=new Float32Array(t);for(let r=0;r<t;r++)o[r]=n+Math.floor(r/i);return o}const NO=Sn,c0e=`void metadataStage(
|
|
out Metadata metadata,
|
|
out MetadataClass metadataClass,
|
|
out MetadataStatistics metadataStatistics,
|
|
ProcessedAttributes attributes
|
|
)
|
|
{
|
|
initializeMetadata(metadata, metadataClass, metadataStatistics, attributes);
|
|
}
|
|
`,l0e=`void metadataStage(
|
|
out Metadata metadata,
|
|
out MetadataClass metadataClass,
|
|
out MetadataStatistics metadataStatistics,
|
|
ProcessedAttributes attributes
|
|
)
|
|
{
|
|
initializeMetadata(metadata, metadataClass, metadataStatistics, attributes);
|
|
setMetadataVaryings();
|
|
}
|
|
`,bn={name:"MetadataPipelineStage",STRUCT_ID_METADATA_VS:"MetadataVS",STRUCT_ID_METADATA_FS:"MetadataFS",STRUCT_NAME_METADATA:"Metadata",STRUCT_ID_METADATA_CLASS_VS:"MetadataClassVS",STRUCT_ID_METADATA_CLASS_FS:"MetadataClassFS",STRUCT_NAME_METADATA_CLASS:"MetadataClass",STRUCT_ID_METADATA_STATISTICS_VS:"MetadataStatisticsVS",STRUCT_ID_METADATA_STATISTICS_FS:"MetadataStatisticsFS",STRUCT_NAME_METADATA_STATISTICS:"MetadataStatistics",FUNCTION_ID_INITIALIZE_METADATA_VS:"initializeMetadataVS",FUNCTION_ID_INITIALIZE_METADATA_FS:"initializeMetadataFS",FUNCTION_SIGNATURE_INITIALIZE_METADATA:"void initializeMetadata(out Metadata metadata, out MetadataClass metadataClass, out MetadataStatistics metadataStatistics, ProcessedAttributes attributes)",FUNCTION_ID_SET_METADATA_VARYINGS:"setMetadataVaryings",FUNCTION_SIGNATURE_SET_METADATA_VARYINGS:"void setMetadataVaryings()",METADATA_CLASS_FIELDS:[{specName:"noData",shaderName:"noData"},{specName:"default",shaderName:"defaultValue"},{specName:"min",shaderName:"minValue"},{specName:"max",shaderName:"maxValue"}],METADATA_STATISTICS_FIELDS:[{specName:"min",shaderName:"minValue"},{specName:"max",shaderName:"maxValue"},{specName:"mean",shaderName:"mean",type:"float"},{specName:"median",shaderName:"median"},{specName:"standardDeviation",shaderName:"standardDeviation",type:"float"},{specName:"variance",shaderName:"variance",type:"float"},{specName:"sum",shaderName:"sum"}]};bn.process=function(e,t,n){var f;const{shaderBuilder:i,model:o}=e,{structuralMetadata:r={},content:s}=o,a=(f=s==null?void 0:s.tileset.metadataExtension)==null?void 0:f.statistics,l=u0e(r.propertyAttributes,t,a),u=h0e(r.propertyTextures,a),h=l.concat(u);p0e(i,h),g0e(i),i.addVertexLines(l0e),i.addFragmentLines(c0e);for(let _=0;_<l.length;_++){const g=l[_];y0e(e,g)}for(let _=0;_<u.length;_++){const g=u[_];T0e(e,g)}};function u0e(e,t,n){return c(e)?e.flatMap(i=>d0e(i,t,n)):[]}function d0e(e,t,n){const{getAttributeByName:i,getAttributeInfo:o,sanitizeGlslIdentifier:r}=Lt,s=e.class.id,a=n==null?void 0:n.classes[s],l=Object.entries(e.properties),u=new Array(l.length);for(let h=0;h<l.length;h++){const[f,_]=l[h],g=i(t,_.attribute),{glslType:m,variableName:b}=o(g);u[h]={metadataVariable:r(f),property:_,type:_.classProperty.type,glslType:m,variableName:b,propertyStatistics:a==null?void 0:a.properties[f],shaderDestination:ge.BOTH}}return u}function h0e(e,t){return c(e)?e.flatMap(n=>f0e(n,t)):[]}function f0e(e,t){const{sanitizeGlslIdentifier:n}=Lt,i=e.class.id,o=t==null?void 0:t.classes[i],r=Object.entries(e.properties).filter(([a,l])=>l.isGpuCompatible()),s=new Array(r.length);for(let a=0;a<r.length;a++){const[l,u]=r[a];s[a]={metadataVariable:n(l),property:u,type:u.classProperty.type,glslType:u.getGlslType(),propertyStatistics:o==null?void 0:o.properties[l],shaderDestination:ge.FRAGMENT}}return s}function p0e(e,t){const n=new Set,i=new Set;for(let a=0;a<t.length;a++){const{type:l,glslType:u,propertyStatistics:h}=t[a];n.add(u),!!c(h)&&l!==bt.ENUM&&i.add(u)}const o=bn.METADATA_CLASS_FIELDS;for(const a of n){const l=`${a}MetadataClass`;s(l,a,o)}const r=bn.METADATA_STATISTICS_FIELDS;for(const a of i){const l=`${a}MetadataStatistics`;s(l,a,r)}function s(a,l,u){e.addStruct(a,a,ge.BOTH);for(let h=0;h<u.length;h++){const{shaderName:f}=u[h],_=u[h].type==="float"?_0e(l):l;e.addStructField(a,_,f)}}}const m0e={int:"float",ivec2:"vec2",ivec3:"vec3",ivec4:"vec4"};function _0e(e){const t=m0e[e];return c(t)?t:e}function g0e(e){e.addStruct(bn.STRUCT_ID_METADATA_VS,bn.STRUCT_NAME_METADATA,ge.VERTEX),e.addStruct(bn.STRUCT_ID_METADATA_FS,bn.STRUCT_NAME_METADATA,ge.FRAGMENT),e.addStruct(bn.STRUCT_ID_METADATA_CLASS_VS,bn.STRUCT_NAME_METADATA_CLASS,ge.VERTEX),e.addStruct(bn.STRUCT_ID_METADATA_CLASS_FS,bn.STRUCT_NAME_METADATA_CLASS,ge.FRAGMENT),e.addStruct(bn.STRUCT_ID_METADATA_STATISTICS_VS,bn.STRUCT_NAME_METADATA_STATISTICS,ge.VERTEX),e.addStruct(bn.STRUCT_ID_METADATA_STATISTICS_FS,bn.STRUCT_NAME_METADATA_STATISTICS,ge.FRAGMENT),e.addFunction(bn.FUNCTION_ID_INITIALIZE_METADATA_VS,bn.FUNCTION_SIGNATURE_INITIALIZE_METADATA,ge.VERTEX),e.addFunction(bn.FUNCTION_ID_INITIALIZE_METADATA_FS,bn.FUNCTION_SIGNATURE_INITIALIZE_METADATA,ge.FRAGMENT),e.addFunction(bn.FUNCTION_ID_SET_METADATA_VARYINGS,bn.FUNCTION_SIGNATURE_SET_METADATA_VARYINGS,ge.VERTEX)}function y0e(e,t){b0e(e,t),s5(e.shaderBuilder,t),a5(e.shaderBuilder,t)}function b0e(e,t){const{shaderBuilder:n}=e,{metadataVariable:i,property:o,glslType:r}=t,s=l5({valueExpression:`attributes.${t.variableName}`,renderResources:e,glslType:r,metadataVariable:i,shaderDestination:ge.BOTH,property:o});n.addStructField(bn.STRUCT_ID_METADATA_VS,r,i),n.addStructField(bn.STRUCT_ID_METADATA_FS,r,i);const a=`metadata.${i} = ${s};`;n.addFunctionLines(bn.FUNCTION_ID_INITIALIZE_METADATA_VS,[a]),n.addFunctionLines(bn.FUNCTION_ID_INITIALIZE_METADATA_FS,[a])}function T0e(e,t){A0e(e,t),s5(e.shaderBuilder,t),a5(e.shaderBuilder,t)}function A0e(e,t){const{shaderBuilder:n,uniformMap:i}=e,{metadataVariable:o,glslType:r,property:s}=t,{texCoord:a,channels:l,index:u,texture:h,transform:f}=s.textureReader,_=`u_propertyTexture_${u}`;i.hasOwnProperty(_)||(n.addUniform("sampler2D",_,ge.FRAGMENT),i[_]=()=>h),n.addStructField(bn.STRUCT_ID_METADATA_FS,r,o);const g=`attributes.texCoord_${a}`;let m=g;if(c(f)&&!$.equals(f,$.IDENTITY)){const w=`${_}Transform`;n.addUniform("mat3",w,ge.FRAGMENT),i[w]=function(){return f},m=`vec2(${w} * vec3(${g}, 1.0))`}const b=`texture(${_}, ${m}).${l}`,T=s.unpackInShader(b),x=l5({valueExpression:T,renderResources:e,glslType:r,metadataVariable:o,shaderDestination:ge.FRAGMENT,property:s}),C=`metadata.${o} = ${x};`;n.addFunctionLines(bn.FUNCTION_ID_INITIALIZE_METADATA_FS,[C])}function s5(e,t){const{classProperty:n}=t.property,{metadataVariable:i,glslType:o,shaderDestination:r}=t,s=c5(bn.METADATA_CLASS_FIELDS,n,`metadataClass.${i}`,o),a=`${o}MetadataClass`;e.addStructField(bn.STRUCT_ID_METADATA_CLASS_FS,a,i),e.addFunctionLines(bn.FUNCTION_ID_INITIALIZE_METADATA_FS,s),ge.includesVertexShader(r)&&(e.addStructField(bn.STRUCT_ID_METADATA_CLASS_VS,a,i),e.addFunctionLines(bn.FUNCTION_ID_INITIALIZE_METADATA_VS,s))}function a5(e,t){const{propertyStatistics:n}=t;if(!c(n))return;const{metadataVariable:i,type:o,glslType:r}=t;if(o===bt.ENUM)return;const s=bn.METADATA_STATISTICS_FIELDS,a=`metadataStatistics.${i}`,l=c5(s,n,a,r),u=`${r}MetadataStatistics`;e.addStructField(bn.STRUCT_ID_METADATA_STATISTICS_FS,u,i),e.addFunctionLines(bn.FUNCTION_ID_INITIALIZE_METADATA_FS,l),ge.includesVertexShader(t.shaderDestination)&&(e.addStructField(bn.STRUCT_ID_METADATA_STATISTICS_VS,u,i),e.addFunctionLines(bn.FUNCTION_ID_INITIALIZE_METADATA_VS,l))}function c5(e,t,n,i){function o(r){const s=t[r.specName];if(c(s))return`${n}.${r.shaderName} = ${i}(${s});`}return c(t)?e.map(o).filter(c):[]}function l5(e){const{valueExpression:t,property:n}=e;if(!n.hasValueTransform)return t;const i=e.metadataVariable,o=`u_${i}_offset`,r=`u_${i}_scale`,{shaderBuilder:s,uniformMap:a}=e.renderResources,{glslType:l,shaderDestination:u}=e;s.addUniform(l,o,u),s.addUniform(l,r,u);const{offset:h,scale:f}=n;return a[o]=()=>h,a[r]=()=>f,`czm_valueTransform(${o}, ${r}, ${t})`}const op=bn,x0e={INHERIT:0,OPAQUE:1,TRANSLUCENT:2},rD=Object.freeze(x0e),Ar={name:"CustomShaderPipelineStage",STRUCT_ID_ATTRIBUTES_VS:"AttributesVS",STRUCT_ID_ATTRIBUTES_FS:"AttributesFS",STRUCT_NAME_ATTRIBUTES:"Attributes",STRUCT_ID_VERTEX_INPUT:"VertexInput",STRUCT_NAME_VERTEX_INPUT:"VertexInput",STRUCT_ID_FRAGMENT_INPUT:"FragmentInput",STRUCT_NAME_FRAGMENT_INPUT:"FragmentInput",FUNCTION_ID_INITIALIZE_INPUT_STRUCT_VS:"initializeInputStructVS",FUNCTION_SIGNATURE_INITIALIZE_INPUT_STRUCT_VS:"void initializeInputStruct(out VertexInput vsInput, ProcessedAttributes attributes)",FUNCTION_ID_INITIALIZE_INPUT_STRUCT_FS:"initializeInputStructFS",FUNCTION_SIGNATURE_INITIALIZE_INPUT_STRUCT_FS:"void initializeInputStruct(out FragmentInput fsInput, ProcessedAttributes attributes)",_oneTimeWarning:$n};Ar.process=function(e,t,n){const{shaderBuilder:i,model:o,alphaOptions:r}=e,{customShader:s}=o,{lightingModel:a,translucencyMode:l}=s;c(a)&&(e.lightingOptions.lightingModel=a),l===rD.TRANSLUCENT?r.pass=xe.TRANSLUCENT:l===rD.OPAQUE&&(r.pass=void 0);const u=P0e(s,t);if(!u.customShaderEnabled)return;if(N0e(i,s,u),u.shouldComputePositionWC&&i.addDefine("COMPUTE_POSITION_WC_CUSTOM_SHADER",void 0,ge.BOTH),c(s.vertexShaderText)&&i.addDefine("HAS_CUSTOM_VERTEX_SHADER",void 0,ge.VERTEX),c(s.fragmentShaderText)){i.addDefine("HAS_CUSTOM_FRAGMENT_SHADER",void 0,ge.FRAGMENT);const _=RO.getDefineName(s.mode);i.addDefine(_,void 0,ge.FRAGMENT)}const h=s.uniforms;for(const _ in h)if(h.hasOwnProperty(_)){const g=h[_];i.addUniform(g.type,_)}const f=s.varyings;for(const _ in f)if(f.hasOwnProperty(_)){const g=f[_];i.addVarying(g,_)}e.uniformMap=jt(e.uniformMap,s.uniformMap)};function C0e(e){const t={};for(let n=0;n<e.length;n++){const i=Lt.getAttributeInfo(e[n]);t[i.variableName]=i}return t}const E0e={position:"vec3",normal:"vec3",tangent:"vec3",bitangent:"vec3",texCoord:"vec2",color:"vec4",joints:"ivec4",weights:"vec4"},w0e={position:"vec3(0.0)",normal:"vec3(0.0, 0.0, 1.0)",tangent:"vec3(1.0, 0.0, 0.0)",bitangent:"vec3(0.0, 1.0, 0.0)",texCoord:"vec2(0.0)",color:"vec4(1.0)",joints:"ivec4(0)",weights:"vec4(0.0)"};function u5(e){let t=e.replace(/_[0-9]+$/,"");t=t.replace(/(MC|EC)$/,"");const n=E0e[t],i=w0e[t];if(!!c(n))return{attributeField:[n,e],value:i}}function S0e(e,t){if(!c(e.vertexShaderText))return{enabled:!1};const n=e.usedVariablesVertex.attributeSet,i=d5(t,n,!1),o=h5(t,n,!1);let r;const s=[],a=[];for(const l in i){if(!i.hasOwnProperty(l))continue;const h=[i[l].glslType,l];s.push(h),r=`vsInput.attributes.${l} = attributes.${l};`,a.push(r)}for(let l=0;l<o.length;l++){const u=o[l],h=u5(u);if(!c(h))return Ar._oneTimeWarning("CustomShaderPipelineStage.incompatiblePrimitiveVS",`Primitive is missing attribute ${u}, disabling custom vertex shader`),{enabled:!1};s.push(h.attributeField),r=`vsInput.attributes.${u} = ${h.value};`,a.push(r)}return{enabled:!0,attributeFields:s,initializationLines:a}}function v0e(e){const t=[],n=[],i=e.usedVariablesFragment.attributeSet;return i.hasOwnProperty("positionWC")&&(t.push(["vec3","positionWC"]),n.push("fsInput.attributes.positionWC = attributes.positionWC;")),i.hasOwnProperty("positionEC")&&(t.push(["vec3","positionEC"]),n.push("fsInput.attributes.positionEC = attributes.positionEC;")),{attributeFields:t,initializationLines:n}}function I0e(e,t){if(!c(e.fragmentShaderText))return{enabled:!1};const n=e.usedVariablesFragment.attributeSet,i=d5(t,n,!0),o=h5(t,n,!0);let r;const s=[],a=[];for(const u in i){if(!i.hasOwnProperty(u))continue;const f=[i[u].glslType,u];s.push(f),r=`fsInput.attributes.${u} = attributes.${u};`,a.push(r)}for(let u=0;u<o.length;u++){const h=o[u],f=u5(h);if(!c(f))return Ar._oneTimeWarning("CustomShaderPipelineStage.incompatiblePrimitiveFS",`Primitive is missing attribute ${h}, disabling custom fragment shader.`),{enabled:!1};s.push(f.attributeField),r=`fsInput.attributes.${h} = ${f.value};`,a.push(r)}const l=v0e(e);return{enabled:!0,attributeFields:s.concat(l.attributeFields),initializationLines:l.initializationLines.concat(a)}}const D0e={positionWC:!0,positionEC:!0};function d5(e,t,n){const i={};for(const o in e){if(!e.hasOwnProperty(o))continue;const r=e[o];let s=o;n&&o==="normalMC"?s="normalEC":n&&o==="tangentMC"&&(s="tangentEC",r.glslType="vec3"),t.hasOwnProperty(s)&&(i[s]=r)}return i}function h5(e,t,n){const i=[];for(const o in t){if(!t.hasOwnProperty(o)||D0e.hasOwnProperty(o))continue;let r=o;n&&o==="normalEC"?r="normalMC":n&&o==="tangentEC"&&(r="tangentMC"),e.hasOwnProperty(r)||i.push(o)}return i}function P0e(e,t){const n=C0e(t.attributes),i=S0e(e,n),o=I0e(e,n),s=e.usedVariablesFragment.attributeSet.hasOwnProperty("positionWC")&&o.enabled;return{vertexLines:i,fragmentLines:o,customShaderEnabled:i.enabled||o.enabled,shouldComputePositionWC:s}}function O0e(e,t){let n=Ar.STRUCT_ID_ATTRIBUTES_VS;e.addStruct(n,Ar.STRUCT_NAME_ATTRIBUTES,ge.VERTEX);const{attributeFields:i,initializationLines:o}=t;for(let s=0;s<i.length;s++){const[a,l]=i[s];e.addStructField(n,a,l)}n=Ar.STRUCT_ID_VERTEX_INPUT,e.addStruct(n,Ar.STRUCT_NAME_VERTEX_INPUT,ge.VERTEX),e.addStructField(n,Ar.STRUCT_NAME_ATTRIBUTES,"attributes"),e.addStructField(n,NO.STRUCT_NAME_FEATURE_IDS,"featureIds"),e.addStructField(n,op.STRUCT_NAME_METADATA,"metadata"),e.addStructField(n,op.STRUCT_NAME_METADATA_CLASS,"metadataClass"),e.addStructField(n,op.STRUCT_NAME_METADATA_STATISTICS,"metadataStatistics");const r=Ar.FUNCTION_ID_INITIALIZE_INPUT_STRUCT_VS;e.addFunction(r,Ar.FUNCTION_SIGNATURE_INITIALIZE_INPUT_STRUCT_VS,ge.VERTEX),e.addFunctionLines(r,o)}function L0e(e,t){let n=Ar.STRUCT_ID_ATTRIBUTES_FS;e.addStruct(n,Ar.STRUCT_NAME_ATTRIBUTES,ge.FRAGMENT);const{attributeFields:i,initializationLines:o}=t;for(let s=0;s<i.length;s++){const[a,l]=i[s];e.addStructField(n,a,l)}n=Ar.STRUCT_ID_FRAGMENT_INPUT,e.addStruct(n,Ar.STRUCT_NAME_FRAGMENT_INPUT,ge.FRAGMENT),e.addStructField(n,Ar.STRUCT_NAME_ATTRIBUTES,"attributes"),e.addStructField(n,NO.STRUCT_NAME_FEATURE_IDS,"featureIds"),e.addStructField(n,op.STRUCT_NAME_METADATA,"metadata"),e.addStructField(n,op.STRUCT_NAME_METADATA_CLASS,"metadataClass"),e.addStructField(n,op.STRUCT_NAME_METADATA_STATISTICS,"metadataStatistics");const r=Ar.FUNCTION_ID_INITIALIZE_INPUT_STRUCT_FS;e.addFunction(r,Ar.FUNCTION_SIGNATURE_INITIALIZE_INPUT_STRUCT_FS,ge.FRAGMENT),e.addFunctionLines(r,o)}const R0e=[];function N0e(e,t,n){const{vertexLines:i,fragmentLines:o}=n,r=R0e;i.enabled&&(O0e(e,i),r.length=0,r.push("#line 0",t.vertexShaderText,Qye),e.addVertexLines(r)),o.enabled&&(L0e(e,o),r.length=0,r.push("#line 0",t.fragmentShaderText,Kye),e.addFragmentLines(r))}const M0e=Ar,Ry={name:"DequantizationPipelineStage",FUNCTION_ID_DEQUANTIZATION_STAGE_VS:"dequantizationStage",FUNCTION_SIGNATURE_DEQUANTIZATION_STAGE_VS:"void dequantizationStage(inout ProcessedAttributes attributes)"};Ry.process=function(e,t,n){const i=e.shaderBuilder,o=e.model,r=c(o.classificationType);i.addDefine("USE_DEQUANTIZATION",void 0,ge.VERTEX),i.addFunction(Ry.FUNCTION_ID_DEQUANTIZATION_STAGE_VS,Ry.FUNCTION_SIGNATURE_DEQUANTIZATION_STAGE_VS,ge.VERTEX);const s=t.attributes;for(let a=0;a<s.length;a++){const l=s[a],u=l.quantization;if(!c(u))continue;const h=l.semantic===ht.POSITION,f=l.semantic===ht.TEXCOORD;if(r&&!h&&!f)continue;const _=Lt.getAttributeInfo(l);B0e(i,_),F0e(e,_)}};function F0e(e,t){const n=e.shaderBuilder,i=e.uniformMap,o=t.variableName,r=t.attribute.quantization;if(r.octEncoded){const s=`model_normalizationRange_${o}`;n.addUniform("float",s,ge.VERTEX),i[s]=function(){return r.normalizationRange}}else{const s=`model_quantizedVolumeOffset_${o}`,a=`model_quantizedVolumeStepSize_${o}`,l=t.glslType;n.addUniform(l,s,ge.VERTEX),n.addUniform(l,a,ge.VERTEX);let u=r.quantizedVolumeOffset,h=r.quantizedVolumeStepSize;/^color_\d+$/.test(o)&&(u=hF(u,0),h=hF(h,1)),i[s]=function(){return u},i[a]=function(){return h}}}function hF(e,t){return e instanceof te?e:new te(e.x,e.y,e.z,t)}function B0e(e,t){const n=t.variableName,i=t.attribute.quantization;let o;i.octEncoded?o=z0e(n,i):o=U0e(n),e.addFunctionLines(Ry.FUNCTION_ID_DEQUANTIZATION_STAGE_VS,[o])}function z0e(e,t){const n=`attributes.${e}`,i=`a_quantized_${e}`,o=`model_normalizationRange_${e}`,r=t.octEncodedZXY?".zxy":".xyz";return`${n} = czm_octDecode(${i}, ${o})${r};`}function U0e(e){const t=`attributes.${e}`,n=`a_quantized_${e}`,i=`model_quantizedVolumeOffset_${e}`,o=`model_quantizedVolumeStepSize_${e}`;return`${t} = ${i} + ${n} * ${o};`}const k0e=Ry,V0e=`void geometryStage(out ProcessedAttributes attributes)
|
|
{
|
|
attributes.positionMC = v_positionMC;
|
|
attributes.positionEC = v_positionEC;
|
|
|
|
#if defined(COMPUTE_POSITION_WC_CUSTOM_SHADER) || defined(COMPUTE_POSITION_WC_STYLE) || defined(COMPUTE_POSITION_WC_ATMOSPHERE)
|
|
attributes.positionWC = v_positionWC;
|
|
#endif
|
|
|
|
#ifdef HAS_NORMALS
|
|
// renormalize after interpolation
|
|
attributes.normalEC = normalize(v_normalEC);
|
|
#endif
|
|
|
|
#ifdef HAS_TANGENTS
|
|
attributes.tangentEC = normalize(v_tangentEC);
|
|
#endif
|
|
|
|
#ifdef HAS_BITANGENTS
|
|
attributes.bitangentEC = normalize(v_bitangentEC);
|
|
#endif
|
|
|
|
// Everything else is dynamically generated in GeometryPipelineStage
|
|
setDynamicVaryings(attributes);
|
|
}
|
|
`,H0e=`vec4 geometryStage(inout ProcessedAttributes attributes, mat4 modelView, mat3 normal)
|
|
{
|
|
vec4 computedPosition;
|
|
|
|
// Compute positions in different coordinate systems
|
|
vec3 positionMC = attributes.positionMC;
|
|
v_positionMC = positionMC;
|
|
v_positionEC = (modelView * vec4(positionMC, 1.0)).xyz;
|
|
|
|
#if defined(USE_2D_POSITIONS) || defined(USE_2D_INSTANCING)
|
|
vec3 position2D = attributes.position2D;
|
|
vec3 positionEC = (u_modelView2D * vec4(position2D, 1.0)).xyz;
|
|
computedPosition = czm_projection * vec4(positionEC, 1.0);
|
|
#else
|
|
computedPosition = czm_projection * vec4(v_positionEC, 1.0);
|
|
#endif
|
|
|
|
// Sometimes the custom shader and/or style needs this
|
|
#if defined(COMPUTE_POSITION_WC_CUSTOM_SHADER) || defined(COMPUTE_POSITION_WC_STYLE) || defined(COMPUTE_POSITION_WC_ATMOSPHERE) || defined(ENABLE_CLIPPING_POLYGONS)
|
|
// Note that this is a 32-bit position which may result in jitter on small
|
|
// scales.
|
|
v_positionWC = (czm_model * vec4(positionMC, 1.0)).xyz;
|
|
#endif
|
|
|
|
#ifdef HAS_NORMALS
|
|
v_normalEC = normalize(normal * attributes.normalMC);
|
|
#endif
|
|
|
|
#ifdef HAS_TANGENTS
|
|
v_tangentEC = normalize(normal * attributes.tangentMC);
|
|
#endif
|
|
|
|
#ifdef HAS_BITANGENTS
|
|
v_bitangentEC = normalize(normal * attributes.bitangentMC);
|
|
#endif
|
|
|
|
// All other varyings need to be dynamically generated in
|
|
// GeometryPipelineStage
|
|
setDynamicVaryings(attributes);
|
|
|
|
return computedPosition;
|
|
}
|
|
`,fF=`vec2 computeSt(float featureId)
|
|
{
|
|
float stepX = model_textureStep.x;
|
|
float centerX = model_textureStep.y;
|
|
|
|
#ifdef MULTILINE_BATCH_TEXTURE
|
|
float stepY = model_textureStep.z;
|
|
float centerY = model_textureStep.w;
|
|
|
|
float xId = mod(featureId, model_textureDimensions.x);
|
|
float yId = floor(featureId / model_textureDimensions.x);
|
|
|
|
return vec2(centerX + (xId * stepX), centerY + (yId * stepY));
|
|
#else
|
|
return vec2(centerX + (featureId * stepX), 0.5);
|
|
#endif
|
|
}
|
|
|
|
void selectedFeatureIdStage(out SelectedFeature feature, FeatureIds featureIds)
|
|
{
|
|
int featureId = featureIds.SELECTED_FEATURE_ID;
|
|
|
|
|
|
if (featureId < model_featuresLength)
|
|
{
|
|
vec2 featureSt = computeSt(float(featureId));
|
|
|
|
feature.id = featureId;
|
|
feature.st = featureSt;
|
|
feature.color = texture(model_batchTexture, featureSt);
|
|
}
|
|
// Floating point comparisons can be unreliable in GLSL, so we
|
|
// increment the feature ID to make sure it's always greater
|
|
// then the model_featuresLength - a condition we check for in the
|
|
// pick ID, to avoid sampling the pick texture if the feature ID is
|
|
// greater than the number of features.
|
|
else
|
|
{
|
|
feature.id = model_featuresLength + 1;
|
|
feature.st = vec2(0.0);
|
|
feature.color = vec4(1.0);
|
|
}
|
|
|
|
#ifdef HAS_NULL_FEATURE_ID
|
|
if (featureId == model_nullFeatureId) {
|
|
feature.id = featureId;
|
|
feature.st = vec2(0.0);
|
|
feature.color = vec4(1.0);
|
|
}
|
|
#endif
|
|
}
|
|
`,Ny={name:"SelectedFeatureIdPipelineStage",STRUCT_ID_SELECTED_FEATURE:"SelectedFeature",STRUCT_NAME_SELECTED_FEATURE:"SelectedFeature",FUNCTION_ID_FEATURE_VARYINGS_VS:"updateFeatureStructVS",FUNCTION_ID_FEATURE_VARYINGS_FS:"updateFeatureStructFS",FUNCTION_SIGNATURE_UPDATE_FEATURE:"void updateFeatureStruct(inout SelectedFeature feature)"};Ny.process=function(e,t,n){const i=e.shaderBuilder;e.hasPropertyTable=!0;const o=e.model,r=e.runtimeNode.node,s=G0e(o,r,t),a=s.shaderDestination;i.addDefine("HAS_SELECTED_FEATURE_ID",void 0,a),i.addDefine("SELECTED_FEATURE_ID",s.variableName,a),i.addDefine(s.featureIdDefine,void 0,a),j0e(i);const l=s.featureIds.nullFeatureId,u=e.uniformMap;c(l)&&(i.addDefine("HAS_NULL_FEATURE_ID",void 0,a),i.addUniform("int","model_nullFeatureId",a),u.model_nullFeatureId=function(){return l}),s.shaderDestination===ge.BOTH&&i.addVertexLines(fF),i.addFragmentLines(fF)};function pF(e){return e instanceof yt.FeatureIdTexture?"HAS_SELECTED_FEATURE_ID_TEXTURE":"HAS_SELECTED_FEATURE_ID_ATTRIBUTE"}function mF(e){return e instanceof yt.FeatureIdTexture?ge.FRAGMENT:ge.BOTH}function G0e(e,t,n){let i,o;return c(t.instances)&&(o=Lt.getFeatureIdsByLabel(t.instances.featureIds,e.instanceFeatureIdLabel),c(o))?(i=y(o.label,o.positionalLabel),{featureIds:o,variableName:i,shaderDestination:mF(o),featureIdDefine:pF(o)}):(o=Lt.getFeatureIdsByLabel(n.featureIds,e.featureIdLabel),i=y(o.label,o.positionalLabel),{featureIds:o,variableName:i,shaderDestination:mF(o),featureIdDefine:pF(o)})}function j0e(e){e.addStructField(Ny.STRUCT_ID_SELECTED_FEATURE,"int","id"),e.addStructField(Ny.STRUCT_ID_SELECTED_FEATURE,"vec2","st"),e.addStructField(Ny.STRUCT_ID_SELECTED_FEATURE,"vec4","color")}const sD=Ny,nr={name:"GeometryPipelineStage",STRUCT_ID_PROCESSED_ATTRIBUTES_VS:"ProcessedAttributesVS",STRUCT_ID_PROCESSED_ATTRIBUTES_FS:"ProcessedAttributesFS",STRUCT_NAME_PROCESSED_ATTRIBUTES:"ProcessedAttributes",FUNCTION_ID_INITIALIZE_ATTRIBUTES:"initializeAttributes",FUNCTION_SIGNATURE_INITIALIZE_ATTRIBUTES:"void initializeAttributes(out ProcessedAttributes attributes)",FUNCTION_ID_SET_DYNAMIC_VARYINGS_VS:"setDynamicVaryingsVS",FUNCTION_ID_SET_DYNAMIC_VARYINGS_FS:"setDynamicVaryingsFS",FUNCTION_SIGNATURE_SET_DYNAMIC_VARYINGS:"void setDynamicVaryings(inout ProcessedAttributes attributes)"};nr.process=function(e,t,n){const i=e.shaderBuilder,o=e.model;i.addStruct(nr.STRUCT_ID_PROCESSED_ATTRIBUTES_VS,"ProcessedAttributes",ge.VERTEX),i.addStruct(nr.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,"ProcessedAttributes",ge.FRAGMENT),i.addStruct(sD.STRUCT_ID_SELECTED_FEATURE,sD.STRUCT_NAME_SELECTED_FEATURE,ge.BOTH),i.addFunction(nr.FUNCTION_ID_INITIALIZE_ATTRIBUTES,nr.FUNCTION_SIGNATURE_INITIALIZE_ATTRIBUTES,ge.VERTEX),i.addVarying("vec3","v_positionWC"),i.addVarying("vec3","v_positionEC"),i.addStructField(nr.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,"vec3","positionWC"),i.addStructField(nr.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,"vec3","positionEC"),i.addFunction(nr.FUNCTION_ID_SET_DYNAMIC_VARYINGS_VS,nr.FUNCTION_SIGNATURE_SET_DYNAMIC_VARYINGS,ge.VERTEX),i.addFunction(nr.FUNCTION_ID_SET_DYNAMIC_VARYINGS_FS,nr.FUNCTION_SIGNATURE_SET_DYNAMIC_VARYINGS,ge.FRAGMENT),o.type===bs.TILE_PNTS&&i.addDefine("HAS_SRGB_COLOR",void 0,ge.FRAGMENT);const s=n.mode!==oe.SCENE3D&&!n.scene3DOnly&&o._projectTo2D,a=c(e.runtimeNode.node.instances),l=s&&!a,u=t.attributes.length;for(let h=0;h<u;h++){const f=t.attributes[h],_=qt.getAttributeLocationCount(f.type);if(!c(f.buffer)&&!c(f.constant))throw new E("Attributes must be provided as a Buffer or constant value");const g=f.semantic===ht.POSITION;let m;_>1?(m=e.attributeIndex,e.attributeIndex+=_):g&&!l?m=0:m=e.attributeIndex++,W0e(e,f,m,_,s,a)}ebe(i,t.attributes),t.primitiveType===ze.POINTS&&i.addDefine("PRIMITIVE_TYPE_POINTS"),i.addVertexLines(H0e),i.addFragmentLines(V0e)};function W0e(e,t,n,i,o,r){const s=e.shaderBuilder,a=Lt.getAttributeInfo(t),l=o&&!r;i>1?$0e(e,t,n,i):Y0e(e,t,n,l),Q0e(s,a,l),X0e(s,a),c(t.semantic)&&q0e(s,t),K0e(s,a,o),Z0e(s,a,l),J0e(s,a)}function q0e(e,t){const n=t.semantic,i=t.setIndex;switch(n){case ht.NORMAL:e.addDefine("HAS_NORMALS");break;case ht.TANGENT:e.addDefine("HAS_TANGENTS");break;case ht.FEATURE_ID:e.addDefine(`HAS${n}_${i}`);break;case ht.TEXCOORD:case ht.COLOR:e.addDefine(`HAS_${n}_${i}`)}}function Y0e(e,t,n,i){const o=t.quantization;let r,s;c(o)?(r=o.type,s=o.componentDatatype):(r=t.type,s=t.componentDatatype);const a=t.semantic,l=t.setIndex;a===ht.FEATURE_ID&&l>=e.featureIdVertexAttributeSetIndex&&(e.featureIdVertexAttributeSetIndex=l+1);const u=a===ht.POSITION,h=u?0:n,f=qt.getNumberOfComponents(r),_={index:h,value:c(t.buffer)?void 0:t.constant,vertexBuffer:t.buffer,count:t.count,componentsPerAttribute:f,componentDatatype:s,offsetInBytes:t.byteOffset,strideInBytes:t.byteStride,normalize:t.normalized};if(e.attributes.push(_),!u||!i)return;const g=e.runtimePrimitive.positionBuffer2D,m={index:n,vertexBuffer:g,count:t.count,componentsPerAttribute:f,componentDatatype:Z.FLOAT,offsetInBytes:0,strideInBytes:void 0,normalize:t.normalized};e.attributes.push(m)}function $0e(e,t,n,i){const o=t.quantization;let r,s;c(o)?(r=o.type,s=o.componentDatatype):(r=t.type,s=t.componentDatatype);const a=t.normalized,u=qt.getNumberOfComponents(r)/i,h=Z.getSizeInBytes(s),f=u*h,_=t.byteStride;for(let g=0;g<i;g++){const m=t.byteOffset+g*f,b={index:n+g,vertexBuffer:t.buffer,componentsPerAttribute:u,componentDatatype:s,offsetInBytes:m,strideInBytes:_,normalize:a};e.attributes.push(b)}}function X0e(e,t){const n=t.variableName;let i=`v_${n}`,o;n==="normalMC"?(i="v_normalEC",o=t.glslType):n==="tangentMC"?(o="vec3",i="v_tangentEC"):o=t.glslType,e.addVarying(o,i)}function Q0e(e,t,n){const i=t.attribute.semantic,o=t.variableName;let r,s;t.isQuantized?(r=`a_quantized_${o}`,s=t.quantizedGlslType):(r=`a_${o}`,s=t.glslType);const a=i===ht.POSITION;a?e.setPositionAttribute(s,r):e.addAttribute(s,r),a&&n&&e.addAttribute("vec3","a_position2D")}function K0e(e,t,n){const i=nr.STRUCT_ID_PROCESSED_ATTRIBUTES_VS,o=nr.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,r=t.variableName;r==="tangentMC"?(e.addStructField(i,"vec3","tangentMC"),e.addStructField(i,"float","tangentSignMC"),e.addStructField(o,"vec3","tangentEC")):r==="normalMC"?(e.addStructField(i,"vec3","normalMC"),e.addStructField(o,"vec3","normalEC")):(e.addStructField(i,t.glslType,r),e.addStructField(o,t.glslType,r)),r==="positionMC"&&n&&e.addStructField(i,"vec3","position2D")}function Z0e(e,t,n){const i=nr.FUNCTION_ID_INITIALIZE_ATTRIBUTES,o=t.variableName;if(o==="positionMC"&&n){const a="attributes.position2D = a_position2D;";e.addFunctionLines(i,[a])}if(t.isQuantized)return;const s=[];o==="tangentMC"?(s.push("attributes.tangentMC = a_tangentMC.xyz;"),s.push("attributes.tangentSignMC = a_tangentMC.w;")):s.push(`attributes.${o} = a_${o};`),e.addFunctionLines(i,s)}function J0e(e,t){const n=t.attribute.semantic,i=t.attribute.setIndex;if(c(n)&&!c(i))return;let o=nr.FUNCTION_ID_SET_DYNAMIC_VARYINGS_VS;const r=t.variableName;let s=`v_${r} = attributes.${r};`;e.addFunctionLines(o,[s]),o=nr.FUNCTION_ID_SET_DYNAMIC_VARYINGS_FS,s=`attributes.${r} = v_${r};`,e.addFunctionLines(o,[s])}function ebe(e,t){let n=!1,i=!1;for(let o=0;o<t.length;o++){const r=t[o];r.semantic===ht.NORMAL?n=!0:r.semantic===ht.TANGENT&&(i=!0)}!n||!i||(e.addDefine("HAS_BITANGENTS"),e.addVarying("vec3","v_bitangentEC"),e.addStructField(nr.STRUCT_ID_PROCESSED_ATTRIBUTES_VS,"vec3","bitangentMC"),e.addStructField(nr.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,"vec3","bitangentEC"))}const tbe=nr,nbe=`#ifdef LIGHTING_PBR
|
|
vec3 computePbrLighting(czm_modelMaterial inputMaterial, ProcessedAttributes attributes)
|
|
{
|
|
czm_pbrParameters pbrParameters;
|
|
pbrParameters.diffuseColor = inputMaterial.diffuse;
|
|
pbrParameters.f0 = inputMaterial.specular;
|
|
pbrParameters.roughness = inputMaterial.roughness;
|
|
|
|
#ifdef USE_CUSTOM_LIGHT_COLOR
|
|
vec3 lightColorHdr = model_lightColorHdr;
|
|
#else
|
|
vec3 lightColorHdr = czm_lightColorHdr;
|
|
#endif
|
|
|
|
vec3 color = inputMaterial.diffuse;
|
|
#ifdef HAS_NORMALS
|
|
color = czm_pbrLighting(
|
|
attributes.positionEC,
|
|
inputMaterial.normalEC,
|
|
czm_lightDirectionEC,
|
|
lightColorHdr,
|
|
pbrParameters
|
|
);
|
|
|
|
#ifdef USE_IBL_LIGHTING
|
|
color += imageBasedLightingStage(
|
|
attributes.positionEC,
|
|
inputMaterial.normalEC,
|
|
czm_lightDirectionEC,
|
|
lightColorHdr,
|
|
pbrParameters
|
|
);
|
|
#endif
|
|
#endif
|
|
|
|
color *= inputMaterial.occlusion;
|
|
color += inputMaterial.emissive;
|
|
|
|
// In HDR mode, the frame buffer is in linear color space. The
|
|
// post-processing stages (see PostProcessStageCollection) will handle
|
|
// tonemapping. However, if HDR is not enabled, we must tonemap else large
|
|
// values may be clamped to 1.0
|
|
#ifndef HDR
|
|
color = czm_acesTonemapping(color);
|
|
#endif
|
|
|
|
return color;
|
|
}
|
|
#endif
|
|
|
|
void lightingStage(inout czm_modelMaterial material, ProcessedAttributes attributes)
|
|
{
|
|
// Even though the lighting will only set the diffuse color,
|
|
// pass all other properties so further stages have access to them.
|
|
vec3 color = vec3(0.0);
|
|
|
|
#ifdef LIGHTING_PBR
|
|
color = computePbrLighting(material, attributes);
|
|
#else // unlit
|
|
color = material.diffuse;
|
|
#endif
|
|
|
|
#ifdef HAS_POINT_CLOUD_COLOR_STYLE
|
|
// The colors resulting from point cloud styles are adjusted differently.
|
|
color = czm_gammaCorrect(color);
|
|
#elif !defined(HDR)
|
|
// If HDR is not enabled, the frame buffer stores sRGB colors rather than
|
|
// linear colors so the linear value must be converted.
|
|
color = czm_linearToSrgb(color);
|
|
#endif
|
|
|
|
material.diffuse = color;
|
|
}
|
|
`,ibe={UNLIT:0,PBR:1},Gx=Object.freeze(ibe),f5={name:"LightingPipelineStage"};f5.process=function(e,t){const n=e.model,i=e.lightingOptions,o=e.shaderBuilder;if(c(n.lightColor)){o.addDefine("USE_CUSTOM_LIGHT_COLOR",void 0,ge.FRAGMENT),o.addUniform("vec3","model_lightColorHdr",ge.FRAGMENT);const s=e.uniformMap;s.model_lightColorHdr=function(){return n.lightColor}}i.lightingModel===Gx.PBR?o.addDefine("LIGHTING_PBR",void 0,ge.FRAGMENT):o.addDefine("LIGHTING_UNLIT",void 0,ge.FRAGMENT),o.addFragmentLines(nbe)};const obe=f5,rbe=`// If the style color is white, it implies the feature has not been styled.
|
|
bool isDefaultStyleColor(vec3 color)
|
|
{
|
|
return all(greaterThan(color, vec3(1.0 - czm_epsilon3)));
|
|
}
|
|
|
|
vec3 blend(vec3 sourceColor, vec3 styleColor, float styleColorBlend)
|
|
{
|
|
vec3 blendColor = mix(sourceColor, styleColor, styleColorBlend);
|
|
vec3 color = isDefaultStyleColor(styleColor.rgb) ? sourceColor : blendColor;
|
|
return color;
|
|
}
|
|
|
|
vec2 computeTextureTransform(vec2 texCoord, mat3 textureTransform)
|
|
{
|
|
return vec2(textureTransform * vec3(texCoord, 1.0));
|
|
}
|
|
|
|
#ifdef HAS_NORMALS
|
|
vec3 computeNormal(ProcessedAttributes attributes)
|
|
{
|
|
// Geometry normal. This is already normalized
|
|
vec3 ng = attributes.normalEC;
|
|
|
|
vec3 normal = ng;
|
|
#if defined(HAS_NORMAL_TEXTURE) && !defined(HAS_WIREFRAME)
|
|
vec2 normalTexCoords = TEXCOORD_NORMAL;
|
|
#ifdef HAS_NORMAL_TEXTURE_TRANSFORM
|
|
normalTexCoords = computeTextureTransform(normalTexCoords, u_normalTextureTransform);
|
|
#endif
|
|
|
|
// If HAS_BITANGENTS is set, then HAS_TANGENTS is also set
|
|
#ifdef HAS_BITANGENTS
|
|
vec3 t = attributes.tangentEC;
|
|
vec3 b = attributes.bitangentEC;
|
|
mat3 tbn = mat3(t, b, ng);
|
|
vec3 n = texture(u_normalTexture, normalTexCoords).rgb;
|
|
normal = normalize(tbn * (2.0 * n - 1.0));
|
|
#elif (__VERSION__ == 300 || defined(GL_OES_standard_derivatives))
|
|
// If derivatives are available (not IE 10), compute tangents
|
|
vec3 positionEC = attributes.positionEC;
|
|
vec3 pos_dx = dFdx(positionEC);
|
|
vec3 pos_dy = dFdy(positionEC);
|
|
vec3 tex_dx = dFdx(vec3(normalTexCoords,0.0));
|
|
vec3 tex_dy = dFdy(vec3(normalTexCoords,0.0));
|
|
vec3 t = (tex_dy.t * pos_dx - tex_dx.t * pos_dy) / (tex_dx.s * tex_dy.t - tex_dy.s * tex_dx.t);
|
|
t = normalize(t - ng * dot(ng, t));
|
|
vec3 b = normalize(cross(ng, t));
|
|
mat3 tbn = mat3(t, b, ng);
|
|
vec3 n = texture(u_normalTexture, normalTexCoords).rgb;
|
|
normal = normalize(tbn * (2.0 * n - 1.0));
|
|
#endif
|
|
#endif
|
|
|
|
#ifdef HAS_DOUBLE_SIDED_MATERIAL
|
|
if (czm_backFacing()) {
|
|
normal = -normal;
|
|
}
|
|
#endif
|
|
|
|
return normal;
|
|
}
|
|
#endif
|
|
|
|
void materialStage(inout czm_modelMaterial material, ProcessedAttributes attributes, SelectedFeature feature)
|
|
{
|
|
#ifdef HAS_NORMALS
|
|
material.normalEC = computeNormal(attributes);
|
|
#endif
|
|
|
|
vec4 baseColorWithAlpha = vec4(1.0);
|
|
// Regardless of whether we use PBR, set a base color
|
|
#ifdef HAS_BASE_COLOR_TEXTURE
|
|
vec2 baseColorTexCoords = TEXCOORD_BASE_COLOR;
|
|
|
|
#ifdef HAS_BASE_COLOR_TEXTURE_TRANSFORM
|
|
baseColorTexCoords = computeTextureTransform(baseColorTexCoords, u_baseColorTextureTransform);
|
|
#endif
|
|
|
|
baseColorWithAlpha = czm_srgbToLinear(texture(u_baseColorTexture, baseColorTexCoords));
|
|
|
|
#ifdef HAS_BASE_COLOR_FACTOR
|
|
baseColorWithAlpha *= u_baseColorFactor;
|
|
#endif
|
|
#elif defined(HAS_BASE_COLOR_FACTOR)
|
|
baseColorWithAlpha = u_baseColorFactor;
|
|
#endif
|
|
|
|
#ifdef HAS_POINT_CLOUD_COLOR_STYLE
|
|
baseColorWithAlpha = v_pointCloudColor;
|
|
#elif defined(HAS_COLOR_0)
|
|
vec4 color = attributes.color_0;
|
|
// .pnts files store colors in the sRGB color space
|
|
#ifdef HAS_SRGB_COLOR
|
|
color = czm_srgbToLinear(color);
|
|
#endif
|
|
baseColorWithAlpha *= color;
|
|
#endif
|
|
|
|
material.diffuse = baseColorWithAlpha.rgb;
|
|
material.alpha = baseColorWithAlpha.a;
|
|
|
|
#ifdef USE_CPU_STYLING
|
|
material.diffuse = blend(material.diffuse, feature.color.rgb, model_colorBlend);
|
|
#endif
|
|
|
|
#ifdef HAS_OCCLUSION_TEXTURE
|
|
vec2 occlusionTexCoords = TEXCOORD_OCCLUSION;
|
|
#ifdef HAS_OCCLUSION_TEXTURE_TRANSFORM
|
|
occlusionTexCoords = computeTextureTransform(occlusionTexCoords, u_occlusionTextureTransform);
|
|
#endif
|
|
material.occlusion = texture(u_occlusionTexture, occlusionTexCoords).r;
|
|
#endif
|
|
|
|
#ifdef HAS_EMISSIVE_TEXTURE
|
|
vec2 emissiveTexCoords = TEXCOORD_EMISSIVE;
|
|
#ifdef HAS_EMISSIVE_TEXTURE_TRANSFORM
|
|
emissiveTexCoords = computeTextureTransform(emissiveTexCoords, u_emissiveTextureTransform);
|
|
#endif
|
|
|
|
vec3 emissive = czm_srgbToLinear(texture(u_emissiveTexture, emissiveTexCoords).rgb);
|
|
#ifdef HAS_EMISSIVE_FACTOR
|
|
emissive *= u_emissiveFactor;
|
|
#endif
|
|
material.emissive = emissive;
|
|
#elif defined(HAS_EMISSIVE_FACTOR)
|
|
material.emissive = u_emissiveFactor;
|
|
#endif
|
|
|
|
#if defined(LIGHTING_PBR) && defined(USE_SPECULAR_GLOSSINESS)
|
|
#ifdef HAS_SPECULAR_GLOSSINESS_TEXTURE
|
|
vec2 specularGlossinessTexCoords = TEXCOORD_SPECULAR_GLOSSINESS;
|
|
#ifdef HAS_SPECULAR_GLOSSINESS_TEXTURE_TRANSFORM
|
|
specularGlossinessTexCoords = computeTextureTransform(specularGlossinessTexCoords, u_specularGlossinessTextureTransform);
|
|
#endif
|
|
|
|
vec4 specularGlossiness = czm_srgbToLinear(texture(u_specularGlossinessTexture, specularGlossinessTexCoords));
|
|
vec3 specular = specularGlossiness.rgb;
|
|
float glossiness = specularGlossiness.a;
|
|
#ifdef HAS_SPECULAR_FACTOR
|
|
specular *= u_specularFactor;
|
|
#endif
|
|
|
|
#ifdef HAS_GLOSSINESS_FACTOR
|
|
glossiness *= u_glossinessFactor;
|
|
#endif
|
|
#else
|
|
#ifdef HAS_SPECULAR_FACTOR
|
|
vec3 specular = clamp(u_specularFactor, vec3(0.0), vec3(1.0));
|
|
#else
|
|
vec3 specular = vec3(1.0);
|
|
#endif
|
|
|
|
#ifdef HAS_GLOSSINESS_FACTOR
|
|
float glossiness = clamp(u_glossinessFactor, 0.0, 1.0);
|
|
#else
|
|
float glossiness = 1.0;
|
|
#endif
|
|
#endif
|
|
|
|
#ifdef HAS_DIFFUSE_TEXTURE
|
|
vec2 diffuseTexCoords = TEXCOORD_DIFFUSE;
|
|
#ifdef HAS_DIFFUSE_TEXTURE_TRANSFORM
|
|
diffuseTexCoords = computeTextureTransform(diffuseTexCoords, u_diffuseTextureTransform);
|
|
#endif
|
|
|
|
vec4 diffuse = czm_srgbToLinear(texture(u_diffuseTexture, diffuseTexCoords));
|
|
#ifdef HAS_DIFFUSE_FACTOR
|
|
diffuse *= u_diffuseFactor;
|
|
#endif
|
|
#elif defined(HAS_DIFFUSE_FACTOR)
|
|
vec4 diffuse = clamp(u_diffuseFactor, vec4(0.0), vec4(1.0));
|
|
#else
|
|
vec4 diffuse = vec4(1.0);
|
|
#endif
|
|
czm_pbrParameters parameters = czm_pbrSpecularGlossinessMaterial(
|
|
diffuse.rgb,
|
|
specular,
|
|
glossiness
|
|
);
|
|
material.diffuse = parameters.diffuseColor;
|
|
// the specular glossiness extension's alpha overrides anything set
|
|
// by the base material.
|
|
material.alpha = diffuse.a;
|
|
material.specular = parameters.f0;
|
|
material.roughness = parameters.roughness;
|
|
#elif defined(LIGHTING_PBR)
|
|
#ifdef HAS_METALLIC_ROUGHNESS_TEXTURE
|
|
vec2 metallicRoughnessTexCoords = TEXCOORD_METALLIC_ROUGHNESS;
|
|
#ifdef HAS_METALLIC_ROUGHNESS_TEXTURE_TRANSFORM
|
|
metallicRoughnessTexCoords = computeTextureTransform(metallicRoughnessTexCoords, u_metallicRoughnessTextureTransform);
|
|
#endif
|
|
|
|
vec3 metallicRoughness = texture(u_metallicRoughnessTexture, metallicRoughnessTexCoords).rgb;
|
|
float metalness = clamp(metallicRoughness.b, 0.0, 1.0);
|
|
float roughness = clamp(metallicRoughness.g, 0.04, 1.0);
|
|
#ifdef HAS_METALLIC_FACTOR
|
|
metalness *= u_metallicFactor;
|
|
#endif
|
|
|
|
#ifdef HAS_ROUGHNESS_FACTOR
|
|
roughness *= u_roughnessFactor;
|
|
#endif
|
|
#else
|
|
#ifdef HAS_METALLIC_FACTOR
|
|
float metalness = clamp(u_metallicFactor, 0.0, 1.0);
|
|
#else
|
|
float metalness = 1.0;
|
|
#endif
|
|
|
|
#ifdef HAS_ROUGHNESS_FACTOR
|
|
float roughness = clamp(u_roughnessFactor, 0.04, 1.0);
|
|
#else
|
|
float roughness = 1.0;
|
|
#endif
|
|
#endif
|
|
czm_pbrParameters parameters = czm_pbrMetallicRoughnessMaterial(
|
|
material.diffuse,
|
|
metalness,
|
|
roughness
|
|
);
|
|
material.diffuse = parameters.diffuseColor;
|
|
material.specular = parameters.f0;
|
|
material.roughness = parameters.roughness;
|
|
#endif
|
|
}
|
|
`,sbe=yt.Material,aS=yt.MetallicRoughness,cS=yt.SpecularGlossiness,p5={name:"MaterialPipelineStage",_processTexture:Eh,_processTextureTransform:m5};p5.process=function(e,t,n){const i=t.material,o=e.model,r=c(o.classificationType),s=r,a=e.uniformMap,l=e.shaderBuilder,u=n.context.defaultTexture,h=n.context.defaultNormalTexture,f=n.context.defaultEmissiveTexture;abe(i,a,l,u,h,f,s),c(i.specularGlossiness)?cbe(i,a,l,u,s):lbe(i,a,l,u,s);const _=Lt.getAttributeBySemantic(t,ht.NORMAL),g=e.lightingOptions;i.unlit||!_||r?g.lightingModel=Gx.UNLIT:g.lightingModel=Gx.PBR;const m=o.backFaceCulling&&!i.doubleSided;e.renderStateOptions.cull.enabled=m;const b=e.alphaOptions;i.alphaMode===Mx.BLEND?b.pass=xe.TRANSLUCENT:i.alphaMode===Mx.MASK&&(b.alphaCutoff=i.alphaCutoff),l.addFragmentLines(rbe),i.doubleSided&&l.addDefine("HAS_DOUBLE_SIDED_MATERIAL",void 0,ge.BOTH)};function m5(e,t,n,i,o){const r=`HAS_${o}_TEXTURE_TRANSFORM`;e.addDefine(r,void 0,ge.FRAGMENT);const s=`${i}Transform`;e.addUniform("mat3",s,ge.FRAGMENT),t[s]=function(){return n.transform}}function Eh(e,t,n,i,o,r){e.addUniform("sampler2D",i,ge.FRAGMENT),t[i]=function(){return y(n.texture,r)};const s=`HAS_${o}_TEXTURE`;e.addDefine(s,void 0,ge.FRAGMENT);const l=`v_texCoord_${n.texCoord}`,u=`TEXCOORD_${o}`;e.addDefine(u,l,ge.FRAGMENT);const h=n.transform;c(h)&&!$.equals(h,$.IDENTITY)&&m5(e,t,n,i,o)}function abe(e,t,n,i,o,r,s){const a=e.emissiveFactor;if(c(a)&&!d.equals(a,sbe.DEFAULT_EMISSIVE_FACTOR)){n.addUniform("vec3","u_emissiveFactor",ge.FRAGMENT),t.u_emissiveFactor=function(){return e.emissiveFactor},n.addDefine("HAS_EMISSIVE_FACTOR",void 0,ge.FRAGMENT);const h=e.emissiveTexture;c(h)&&!s&&Eh(n,t,h,"u_emissiveTexture","EMISSIVE",r)}const l=e.normalTexture;c(l)&&!s&&Eh(n,t,l,"u_normalTexture","NORMAL",o);const u=e.occlusionTexture;c(u)&&!s&&Eh(n,t,u,"u_occlusionTexture","OCCLUSION",i)}function cbe(e,t,n,i,o){const r=e.specularGlossiness;n.addDefine("USE_SPECULAR_GLOSSINESS",void 0,ge.FRAGMENT);const s=r.diffuseTexture;c(s)&&!o&&Eh(n,t,s,"u_diffuseTexture","DIFFUSE",i);const a=r.diffuseFactor;c(a)&&!te.equals(a,cS.DEFAULT_DIFFUSE_FACTOR)&&(n.addUniform("vec4","u_diffuseFactor",ge.FRAGMENT),t.u_diffuseFactor=function(){return r.diffuseFactor},n.addDefine("HAS_DIFFUSE_FACTOR",void 0,ge.FRAGMENT));const l=r.specularGlossinessTexture;c(l)&&!o&&Eh(n,t,l,"u_specularGlossinessTexture","SPECULAR_GLOSSINESS",i);const u=r.specularFactor;c(u)&&!d.equals(u,cS.DEFAULT_SPECULAR_FACTOR)&&(n.addUniform("vec3","u_specularFactor",ge.FRAGMENT),t.u_specularFactor=function(){return r.specularFactor},n.addDefine("HAS_SPECULAR_FACTOR",void 0,ge.FRAGMENT));const h=r.glossinessFactor;c(h)&&h!==cS.DEFAULT_GLOSSINESS_FACTOR&&(n.addUniform("float","u_glossinessFactor",ge.FRAGMENT),t.u_glossinessFactor=function(){return r.glossinessFactor},n.addDefine("HAS_GLOSSINESS_FACTOR",void 0,ge.FRAGMENT))}function lbe(e,t,n,i,o){const r=e.metallicRoughness;n.addDefine("USE_METALLIC_ROUGHNESS",void 0,ge.FRAGMENT);const s=r.baseColorTexture;c(s)&&!o&&Eh(n,t,s,"u_baseColorTexture","BASE_COLOR",i);const a=r.baseColorFactor;c(a)&&!te.equals(a,aS.DEFAULT_BASE_COLOR_FACTOR)&&(n.addUniform("vec4","u_baseColorFactor",ge.FRAGMENT),t.u_baseColorFactor=function(){return r.baseColorFactor},n.addDefine("HAS_BASE_COLOR_FACTOR",void 0,ge.FRAGMENT));const l=r.metallicRoughnessTexture;c(l)&&!o&&Eh(n,t,l,"u_metallicRoughnessTexture","METALLIC_ROUGHNESS",i);const u=r.metallicFactor;c(u)&&u!==aS.DEFAULT_METALLIC_FACTOR&&(n.addUniform("float","u_metallicFactor",ge.FRAGMENT),t.u_metallicFactor=function(){return r.metallicFactor},n.addDefine("HAS_METALLIC_FACTOR",void 0,ge.FRAGMENT));const h=r.roughnessFactor;c(h)&&h!==aS.DEFAULT_ROUGHNESS_FACTOR&&(n.addUniform("float","u_roughnessFactor",ge.FRAGMENT),t.u_roughnessFactor=function(){return r.roughnessFactor},n.addDefine("HAS_ROUGHNESS_FACTOR",void 0,ge.FRAGMENT))}const ube=p5,dbe=`void morphTargetsStage(inout ProcessedAttributes attributes)
|
|
{
|
|
vec3 positionMC = attributes.positionMC;
|
|
attributes.positionMC = getMorphedPosition(positionMC);
|
|
|
|
#ifdef HAS_NORMALS
|
|
vec3 normalMC = attributes.normalMC;
|
|
attributes.normalMC = getMorphedNormal(normalMC);
|
|
#endif
|
|
|
|
#ifdef HAS_TANGENTS
|
|
vec3 tangentMC = attributes.tangentMC;
|
|
attributes.tangentMC = getMorphedTangent(tangentMC);
|
|
#endif
|
|
}`,Fr={name:"MorphTargetsPipelineStage",FUNCTION_ID_GET_MORPHED_POSITION:"getMorphedPosition",FUNCTION_SIGNATURE_GET_MORPHED_POSITION:"vec3 getMorphedPosition(in vec3 position)",FUNCTION_ID_GET_MORPHED_NORMAL:"getMorphedNormal",FUNCTION_SIGNATURE_GET_MORPHED_NORMAL:"vec3 getMorphedNormal(in vec3 normal)",FUNCTION_ID_GET_MORPHED_TANGENT:"getMorphedTangent",FUNCTION_SIGNATURE_GET_MORPHED_TANGENT:"vec3 getMorphedTangent(in vec3 tangent)"};Fr.process=function(e,t){const n=e.shaderBuilder;n.addDefine("HAS_MORPH_TARGETS",void 0,ge.VERTEX),gbe(n);const i=t.morphTargets.length;for(let a=0;a<i;a++){const l=t.morphTargets[a].attributes,u=l.length;for(let h=0;h<u;h++){const f=l[h],_=f.semantic;_!==ht.POSITION&&_!==ht.NORMAL&&_!==ht.TANGENT||(fbe(e,f,e.attributeIndex,a),e.attributeIndex++)}}ybe(n);const r=e.runtimeNode.morphWeights.length;n.addUniform("float",`u_morphWeights[${r}]`,ge.VERTEX),n.addVertexLines(dbe);const s={u_morphWeights:function(){return e.runtimeNode.morphWeights}};e.uniformMap=jt(s,e.uniformMap)};const hbe={attributeString:void 0,functionId:void 0};function fbe(e,t,n,i){const o=e.shaderBuilder;pbe(e,t,n);const r=mbe(t,hbe);_be(o,r,i)}function pbe(e,t,n){const i={index:n,value:c(t.buffer)?void 0:t.constant,vertexBuffer:t.buffer,componentsPerAttribute:qt.getNumberOfComponents(t.type),componentDatatype:t.componentDatatype,offsetInBytes:t.byteOffset,strideInBytes:t.byteStride,normalize:t.normalized};e.attributes.push(i)}function mbe(e,t){switch(e.semantic){case ht.POSITION:t.attributeString="Position",t.functionId=Fr.FUNCTION_ID_GET_MORPHED_POSITION;break;case ht.NORMAL:t.attributeString="Normal",t.functionId=Fr.FUNCTION_ID_GET_MORPHED_NORMAL;break;case ht.TANGENT:t.attributeString="Tangent",t.functionId=Fr.FUNCTION_ID_GET_MORPHED_TANGENT;break}return t}function _be(e,t,n){const i=t.attributeString,o=`a_target${i}_${n}`,r=`morphed${i} += u_morphWeights[${n}] * a_target${i}_${n};`;e.addAttribute("vec3",o),e.addFunctionLines(t.functionId,[r])}function gbe(e){e.addFunction(Fr.FUNCTION_ID_GET_MORPHED_POSITION,Fr.FUNCTION_SIGNATURE_GET_MORPHED_POSITION,ge.VERTEX);const t="vec3 morphedPosition = position;";e.addFunctionLines(Fr.FUNCTION_ID_GET_MORPHED_POSITION,[t]),e.addFunction(Fr.FUNCTION_ID_GET_MORPHED_NORMAL,Fr.FUNCTION_SIGNATURE_GET_MORPHED_NORMAL,ge.VERTEX);const n="vec3 morphedNormal = normal;";e.addFunctionLines(Fr.FUNCTION_ID_GET_MORPHED_NORMAL,[n]),e.addFunction(Fr.FUNCTION_ID_GET_MORPHED_TANGENT,Fr.FUNCTION_SIGNATURE_GET_MORPHED_TANGENT,ge.VERTEX);const i="vec3 morphedTangent = tangent;";e.addFunctionLines(Fr.FUNCTION_ID_GET_MORPHED_TANGENT,[i])}function ybe(e){const t="return morphedPosition;";e.addFunctionLines(Fr.FUNCTION_ID_GET_MORPHED_POSITION,[t]);const n="return morphedNormal;";e.addFunctionLines(Fr.FUNCTION_ID_GET_MORPHED_NORMAL,[n]);const i="return morphedTangent;";e.addFunctionLines(Fr.FUNCTION_ID_GET_MORPHED_TANGENT,[i])}const bbe=Fr,_5={name:"PickingPipelineStage"};_5.process=function(e,t,n){const i=n.context,o=e.runtimeNode,r=e.shaderBuilder,s=e.model,a=o.node.instances;if(e.hasPropertyTable)Tbe(e,t,a);else if(c(a))Abe(e,i);else{const l=g5(e),u=i.createPickId(l);s._pipelineResources.push(u),s._pickIds.push(u),r.addUniform("vec4","czm_pickColor",ge.FRAGMENT);const h=e.uniformMap;h.czm_pickColor=function(){return u.color},e.pickId="czm_pickColor"}};function g5(e,t){const n=e.model;if(c(n.pickObject))return n.pickObject;const i={model:n,node:e.runtimeNode,primitive:e.runtimePrimitive};let o;if(bs.is3DTiles(n.type)){const r=n.content;o={content:r,primitive:r.tileset,detail:i}}else o={primitive:n,detail:i};return o.id=n.id,c(t)&&(o.instanceId=t),o}function Tbe(e,t,n){const i=e.model;let o,r;const s=i.featureIdLabel,a=i.instanceFeatureIdLabel;c(i.featureTableId)?o=i.featureTableId:c(n)?(r=Lt.getFeatureIdsByLabel(n.featureIds,a),o=r.propertyTableId):(r=Lt.getFeatureIdsByLabel(t.featureIds,s),o=r.propertyTableId);const l=i.featureTables[o];e.shaderBuilder.addUniform("sampler2D","model_pickTexture",ge.FRAGMENT);const h=l.batchTexture;e.uniformMap.model_pickTexture=function(){return y(h.pickTexture,h.defaultTexture)},e.pickId="((selectedFeature.id < int(model_featuresLength)) ? texture(model_pickTexture, selectedFeature.st) : vec4(0.0))"}function Abe(e,t){const n=e.instanceCount,i=new Array(n),o=new Uint8Array(n*4),r=e.model,s=r._pipelineResources;for(let f=0;f<n;f++){const _=g5(e,f),g=t.createPickId(_);s.push(g),i[f]=g;const m=g.color;o[f*4+0]=z.floatToByte(m.red),o[f*4+1]=z.floatToByte(m.green),o[f*4+2]=z.floatToByte(m.blue),o[f*4+3]=z.floatToByte(m.alpha)}r._pickIds=i;const a=ct.createVertexBuffer({context:t,typedArray:o,usage:ke.STATIC_DRAW});a.vertexArrayDestroyable=!1;const l=!1;r.statistics.addBuffer(a,l),s.push(a);const u={index:e.attributeIndex++,vertexBuffer:a,componentsPerAttribute:4,componentDatatype:Z.UNSIGNED_BYTE,normalize:!0,offsetInBytes:0,strideInBytes:0,instanceDivisor:1};e.attributes.push(u);const h=e.shaderBuilder;h.addDefine("USE_PICKING",void 0,ge.BOTH),h.addAttribute("vec4","a_pickColor"),h.addVarying("vec4","v_pickColor"),e.pickId="v_pickColor"}const xbe=_5,Cbe={ADD:0,REPLACE:1},Vr=Object.freeze(Cbe),Ebe=`float getPointSizeFromAttenuation(vec3 positionEC) {
|
|
// Variables are packed into a single vector to minimize gl.uniformXXX() calls
|
|
float pointSize = model_pointCloudParameters.x;
|
|
float geometricError = model_pointCloudParameters.y;
|
|
float depthMultiplier = model_pointCloudParameters.z;
|
|
|
|
float depth = -positionEC.z;
|
|
return min((geometricError / depth) * depthMultiplier, pointSize);
|
|
}
|
|
|
|
#ifdef HAS_POINT_CLOUD_SHOW_STYLE
|
|
float pointCloudShowStylingStage(in ProcessedAttributes attributes, in Metadata metadata) {
|
|
float tiles3d_tileset_time = model_pointCloudParameters.w;
|
|
return float(getShowFromStyle(attributes, metadata, tiles3d_tileset_time));
|
|
}
|
|
#endif
|
|
|
|
#ifdef HAS_POINT_CLOUD_COLOR_STYLE
|
|
vec4 pointCloudColorStylingStage(in ProcessedAttributes attributes, in Metadata metadata) {
|
|
float tiles3d_tileset_time = model_pointCloudParameters.w;
|
|
return getColorFromStyle(attributes, metadata, tiles3d_tileset_time);
|
|
}
|
|
#endif
|
|
|
|
#ifdef HAS_POINT_CLOUD_POINT_SIZE_STYLE
|
|
float pointCloudPointSizeStylingStage(in ProcessedAttributes attributes, in Metadata metadata) {
|
|
float tiles3d_tileset_time = model_pointCloudParameters.w;
|
|
return float(getPointSizeFromStyle(attributes, metadata, tiles3d_tileset_time));
|
|
}
|
|
#elif defined(HAS_POINT_CLOUD_ATTENUATION)
|
|
float pointCloudPointSizeStylingStage(in ProcessedAttributes attributes, in Metadata metadata) {
|
|
return getPointSizeFromAttenuation(v_positionEC);
|
|
}
|
|
#endif
|
|
|
|
#ifdef HAS_POINT_CLOUD_BACK_FACE_CULLING
|
|
float pointCloudBackFaceCullingStage() {
|
|
#if defined(HAS_NORMALS) && !defined(HAS_DOUBLE_SIDED_MATERIAL)
|
|
// This needs to be computed in eye coordinates so we can't use attributes.normalMC
|
|
return step(-v_normalEC.z, 0.0);
|
|
#else
|
|
return 1.0;
|
|
#endif
|
|
}
|
|
#endif`,wbe=new te,y5={name:"PointCloudStylingPipelineStage"};y5.process=function(e,t,n){const i=e.shaderBuilder,o=e.model,r=o.style,s=o.structuralMetadata,a=c(s)?s.propertyAttributes:void 0,l=c(o.featureTableId)&&o.featureTables[o.featureTableId].featuresLength>0,u=!c(a)&&l;if(c(r)&&!u){const b=Dbe(a),T=Pbe(r,b);Obe(i,T);const C=Lbe(T).indexOf("normalMC")>=0,w=Lt.getAttributeBySemantic(t,ht.NORMAL);if(C&&!w)throw new Te("Style references the NORMAL semantic but the point cloud does not have normals");i.addDefine("COMPUTE_POSITION_WC_STYLE",void 0,ge.VERTEX),T.styleTranslucent&&(e.alphaOptions.pass=xe.TRANSLUCENT)}const h=o.pointCloudShading;h.attenuation&&i.addDefine("HAS_POINT_CLOUD_ATTENUATION",void 0,ge.VERTEX),h.backFaceCulling&&i.addDefine("HAS_POINT_CLOUD_BACK_FACE_CULLING",void 0,ge.VERTEX);let f,_,g;bs.is3DTiles(o.type)&&(_=!0,f=o.content,g=f.tile.refine===Vr.ADD),i.addUniform("vec4","model_pointCloudParameters",ge.VERTEX),i.addVertexLines(Ebe);const m=e.uniformMap;m.model_pointCloudParameters=function(){const b=wbe;let T=1;_&&(T=g?5:f.tileset.memoryAdjustedScreenSpaceError),b.x=y(h.maximumAttenuation,T),b.x*=n.pixelRatio;const x=Sbe(e,t,h,f);b.y=x*h.geometricErrorScale;const C=n.context,w=n.camera.frustum;let v;return n.mode===oe.SCENE2D||w instanceof It?v=Number.POSITIVE_INFINITY:v=C.drawingBufferHeight/n.camera.frustum.sseDenominator,b.z=v,_&&(b.w=f.tileset.timeSinceLoad),b}};const _F=new d;function Sbe(e,t,n,i){if(c(i)){const h=i.tile.geometricError;if(h>0)return h}if(c(n.baseResolution))return n.baseResolution;const o=Lt.getAttributeBySemantic(t,ht.POSITION),r=o.count,s=e.runtimeNode.transform;let a=d.subtract(o.max,o.min,_F);a=L.multiplyByPointAsVector(s,a,_F);const l=a.x*a.y*a.z;return R.cbrt(l/r)}const vbe={colorStyleFunction:void 0,showStyleFunction:void 0,pointSizeStyleFunction:void 0,styleTranslucent:!1},Ibe={POSITION:"attributes.positionMC",POSITION_ABSOLUTE:"v_positionWC",COLOR:"attributes.color_0",NORMAL:"attributes.normalMC"};function Dbe(e){const t=Je(Ibe);if(!c(e))return t;for(let n=0;n<e.length;n++){const o=e[n].properties;for(const r in o)o.hasOwnProperty(r)&&(t[r]=`metadata.${r}`)}return t}const lS="ProcessedAttributes attributes, Metadata metadata, float tiles3d_tileset_time";function Pbe(e,t){const n=vbe,i={translucent:!1};return n.colorStyleFunction=e.getColorShaderFunction(`getColorFromStyle(${lS})`,t,i),n.showStyleFunction=e.getShowShaderFunction(`getShowFromStyle(${lS})`,t,i),n.pointSizeStyleFunction=e.getPointSizeShaderFunction(`getPointSizeFromStyle(${lS})`,t,i),n.styleTranslucent=c(n.colorStyleFunction)&&i.translucent,n}function Obe(e,t){const n=t.colorStyleFunction;c(n)&&(e.addDefine("HAS_POINT_CLOUD_COLOR_STYLE",void 0,ge.BOTH),e.addVertexLines(n),e.addVarying("vec4","v_pointCloudColor"));const i=t.showStyleFunction;c(i)&&(e.addDefine("HAS_POINT_CLOUD_SHOW_STYLE",void 0,ge.VERTEX),e.addVertexLines(i));const o=t.pointSizeStyleFunction;c(o)&&(e.addDefine("HAS_POINT_CLOUD_POINT_SIZE_STYLE",void 0,ge.VERTEX),e.addVertexLines(o))}function uS(e,t){const n=/attributes\.(\w+)/g;let i=n.exec(e);for(;i!==null;){const o=i[1];t.indexOf(o)===-1&&t.push(o),i=n.exec(e)}}function Lbe(e){const t=e.colorStyleFunction,n=e.showStyleFunction,i=e.pointSizeStyleFunction,o=[];return c(t)&&uS(t,o),c(n)&&uS(n,o),c(i)&&uS(i,o),o}const Rbe=y5,Nbe=`void primitiveOutlineStage() {
|
|
v_outlineCoordinates = a_outlineCoordinates;
|
|
}
|
|
`,Mbe=`void primitiveOutlineStage(inout czm_modelMaterial material) {
|
|
if (!model_showOutline) {
|
|
return;
|
|
}
|
|
|
|
float outlineX =
|
|
texture(model_outlineTexture, vec2(v_outlineCoordinates.x, 0.5)).r;
|
|
float outlineY =
|
|
texture(model_outlineTexture, vec2(v_outlineCoordinates.y, 0.5)).r;
|
|
float outlineZ =
|
|
texture(model_outlineTexture, vec2(v_outlineCoordinates.z, 0.5)).r;
|
|
float outlineness = max(outlineX, max(outlineY, outlineZ));
|
|
|
|
material.diffuse = mix(material.diffuse, model_outlineColor.rgb, model_outlineColor.a * outlineness);
|
|
}
|
|
|
|
`,b5={name:"PrimitiveOutlinePipelineStage"};b5.process=function(e,t,n){const i=e.shaderBuilder,o=e.uniformMap;i.addDefine("HAS_PRIMITIVE_OUTLINE",void 0,ge.BOTH),i.addAttribute("vec3","a_outlineCoordinates"),i.addVarying("vec3","v_outlineCoordinates");const r=t.outlineCoordinates,s={index:e.attributeIndex++,vertexBuffer:r.buffer,componentsPerAttribute:qt.getNumberOfComponents(r.type),componentDatatype:r.componentDatatype,offsetInBytes:r.byteOffset,strideInBytes:r.byteStride,normalize:r.normalized};e.attributes.push(s),i.addUniform("sampler2D","model_outlineTexture",ge.FRAGMENT);const a=W0.createTexture(n.context);o.model_outlineTexture=function(){return a};const l=e.model;i.addUniform("vec4","model_outlineColor",ge.FRAGMENT),o.model_outlineColor=function(){return l.outlineColor},i.addUniform("bool","model_showOutline",ge.FRAGMENT),o.model_showOutline=function(){return l.showOutline},i.addVertexLines(Nbe),i.addFragmentLines(Mbe)};const Fbe=b5,T5={name:"PrimitiveStatisticsPipelineStage",_countGeometry:A5,_count2DPositions:x5,_countMorphTargetAttributes:C5,_countMaterialTextures:E5,_countFeatureIdTextures:w5,_countBinaryMetadata:S5};T5.process=function(e,t,n){const i=e.model,o=i.statistics;A5(o,t),x5(o,e.runtimePrimitive),C5(o,t),E5(o,t.material),w5(o,t.featureIds),S5(o,i)};function A5(e,t){const n=c(t.indices)?t.indices.count:Lt.getAttributeBySemantic(t,"POSITION").count,i=t.primitiveType;i===ze.POINTS?e.pointsLength+=n:ze.isTriangles(i)&&(e.trianglesLength+=Bbe(i,n));const o=t.attributes,r=o.length;for(let l=0;l<r;l++){const u=o[l];if(c(u.buffer)){const h=c(u.typedArray);e.addBuffer(u.buffer,h)}}const s=t.outlineCoordinates;c(s)&&c(s.buffer)&&e.addBuffer(s.buffer,!1);const a=t.indices;if(c(a)&&c(a.buffer)){const l=c(a.typedArray);e.addBuffer(a.buffer,l)}}function Bbe(e,t){switch(e){case ze.TRIANGLES:return t/3;case ze.TRIANGLE_STRIP:case ze.TRIANGLE_FAN:return Math.max(t-2,0);default:return 0}}function x5(e,t){const n=t.positionBuffer2D;c(n)&&e.addBuffer(n,!0)}function C5(e,t){const n=t.morphTargets;if(!c(n))return;const i=!1,o=n.length;for(let r=0;r<o;r++){const s=n[r].attributes,a=s.length;for(let l=0;l<a;l++){const u=s[l];c(u.buffer)&&e.addBuffer(u.buffer,i)}}}function E5(e,t){const n=zbe(t),i=n.length;for(let o=0;o<i;o++){const r=n[o];c(r)&&c(r.texture)&&e.addTexture(r.texture)}}function zbe(e){const t=e.metallicRoughness,n=[e.emissiveTexture,e.normalTexture,e.occlusionTexture,t.baseColorTexture,t.metallicRoughnessTexture],i=e.specularGlossiness;return c(i)&&(n.push(i.diffuseTexture),n.push(i.specularGlossinessTexture)),n}function w5(e,t){const n=t.length;for(let i=0;i<n;i++){const o=t[i];if(o instanceof yt.FeatureIdTexture){const r=o.textureReader;c(r.texture)&&e.addTexture(r.texture)}}}function S5(e,t){const n=t.structuralMetadata;c(n)&&(Ube(e,n),e.propertyTablesByteLength+=n.propertyTablesByteLength);const i=t.featureTables;if(!c(i))return;const o=i.length;for(let r=0;r<o;r++){const s=i[r];e.addBatchTexture(s.batchTexture)}}function Ube(e,t){const n=t.propertyTextures;if(!c(n))return;const i=n.length;for(let o=0;o<i;o++){const s=n[o].properties;for(const a in s)if(s.hasOwnProperty(a)){const u=s[a].textureReader;c(u.texture)&&e.addTexture(u.texture)}}}const kbe=T5,Vbe=new L,Hbe=new L,v5={name:"SceneMode2DPipelineStage"};v5.process=function(e,t,n){const i=Lt.getAttributeBySemantic(t,ht.POSITION),o=e.shaderBuilder,r=e.model,s=r.sceneGraph.computedModelMatrix,a=e.runtimeNode.computedTransform,l=L.multiplyTransformation(s,a,Vbe),u=Wbe(e,l,n),h=e.runtimePrimitive;h.boundingSphere2D=u;const f=e.runtimeNode.node.instances;if(c(f))return;if(c(i.typedArray)){const b=$be(i,l,u,n);h.positionBuffer2D=b,r._modelResources.push(b),i.typedArray=void 0}o.addDefine("USE_2D_POSITIONS",void 0,ge.VERTEX),o.addUniform("mat4","u_modelView2D",ge.VERTEX);const _=L.fromTranslation(u.center,new L),g=n.context,m={u_modelView2D:function(){return L.multiplyTransformation(g.uniformState.view,_,Hbe)}};e.uniformMap=jt(m,e.uniformMap)};const Gbe=new d,jbe=new d;function Wbe(e,t,n){const i=L.multiplyByPoint(t,e.positionMin,Gbe),o=Ao.computeActualWgs84Position(n,i,i),r=L.multiplyByPoint(t,e.positionMax,jbe),s=Ao.computeActualWgs84Position(n,r,r);return se.fromCornerPoints(o,s,new se)}const I5=new d;function qbe(e,t){const n=e.length,i=new Float32Array(n),o=t.quantizedVolumeOffset,r=t.quantizedVolumeStepSize;for(let s=0;s<n;s+=3){const a=d.fromArray(e,s,I5),l=d.multiplyComponents(a,r,a),u=d.add(l,o,l);i[s]=u.x,i[s+1]=u.y,i[s+2]=u.z}return i}function Ybe(e,t,n,i){let o;c(e.quantization)?o=qbe(e.typedArray,e.quantization):o=e.typedArray.slice();const r=e.byteOffset/Float32Array.BYTES_PER_ELEMENT,s=o.length,a=c(e.byteStride)?e.byteStride/Float32Array.BYTES_PER_ELEMENT:3;for(let l=r;l<s;l+=a){const u=d.fromArray(o,l,I5);if(isNaN(u.x)||isNaN(u.y)||isNaN(u.z))continue;const h=L.multiplyByPoint(t,u,u),f=Ao.computeActualWgs84Position(i,h,h),_=d.subtract(f,n,f);o[l]=_.x,o[l+1]=_.y,o[l+2]=_.z}return o}function $be(e,t,n,i){const o=Je(i);o.mode=oe.COLUMBUS_VIEW;const r=n.center,s=Ybe(e,t,r,o),a=ct.createVertexBuffer({context:i.context,typedArray:s,usage:ke.STATIC_DRAW});return a.vertexArrayDestroyable=!1,a}const Xbe=v5,Qbe=`void skinningStage(inout ProcessedAttributes attributes)
|
|
{
|
|
mat4 skinningMatrix = getSkinningMatrix();
|
|
mat3 skinningMatrixMat3 = mat3(skinningMatrix);
|
|
|
|
vec4 positionMC = vec4(attributes.positionMC, 1.0);
|
|
attributes.positionMC = vec3(skinningMatrix * positionMC);
|
|
|
|
#ifdef HAS_NORMALS
|
|
vec3 normalMC = attributes.normalMC;
|
|
attributes.normalMC = skinningMatrixMat3 * normalMC;
|
|
#endif
|
|
|
|
#ifdef HAS_TANGENTS
|
|
vec3 tangentMC = attributes.tangentMC;
|
|
attributes.tangentMC = skinningMatrixMat3 * tangentMC;
|
|
#endif
|
|
}`,kf={name:"SkinningPipelineStage",FUNCTION_ID_GET_SKINNING_MATRIX:"getSkinningMatrix",FUNCTION_SIGNATURE_GET_SKINNING_MATRIX:"mat4 getSkinningMatrix()"};kf.process=function(e,t){const n=e.shaderBuilder;n.addDefine("HAS_SKINNING",void 0,ge.VERTEX),Zbe(n,t);const i=e.runtimeNode,o=i.computedJointMatrices;n.addUniform("mat4",`u_jointMatrices[${o.length}]`,ge.VERTEX),n.addVertexLines(Qbe);const r={u_jointMatrices:function(){return i.computedJointMatrices}};e.uniformMap=jt(r,e.uniformMap)};function Kbe(e){let t=-1;const n=e.attributes,i=n.length;for(let o=0;o<i;o++){const r=n[o];(r.semantic===ht.JOINTS||r.semantic===ht.WEIGHTS)&&(t=Math.max(t,r.setIndex))}return t}function Zbe(e,t){e.addFunction(kf.FUNCTION_ID_GET_SKINNING_MATRIX,kf.FUNCTION_SIGNATURE_GET_SKINNING_MATRIX,ge.VERTEX);const n="mat4 skinnedMatrix = mat4(0);";e.addFunctionLines(kf.FUNCTION_ID_GET_SKINNING_MATRIX,[n]);let i,o;const r=["x","y","z","w"],s=Kbe(t);for(i=0;i<=s;i++)for(o=0;o<=3;o++){const l=r[o],u=`skinnedMatrix += a_weights_${i}.${l} * u_jointMatrices[int(a_joints_${i}.${l})];`;e.addFunctionLines(kf.FUNCTION_ID_GET_SKINNING_MATRIX,[u])}const a="return skinnedMatrix;";e.addFunctionLines(kf.FUNCTION_ID_GET_SKINNING_MATRIX,[a])}const Jbe=kf,eTe=`void verticalExaggerationStage(
|
|
inout ProcessedAttributes attributes
|
|
) {
|
|
// Compute the distance from the camera to the local center of curvature.
|
|
vec4 vertexPositionENU = czm_modelToEnu * vec4(attributes.positionMC, 1.0);
|
|
vec2 vertexAzimuth = normalize(vertexPositionENU.xy);
|
|
// Curvature = 1 / radius of curvature.
|
|
float azimuthalCurvature = dot(vertexAzimuth * vertexAzimuth, czm_eyeEllipsoidCurvature);
|
|
float eyeToCenter = 1.0 / azimuthalCurvature + czm_eyeHeight;
|
|
|
|
// Compute the approximate ellipsoid normal at the vertex position.
|
|
// Uses a circular approximation for the Earth curvature along the geodesic.
|
|
vec3 vertexPositionEC = (czm_modelView * vec4(attributes.positionMC, 1.0)).xyz;
|
|
vec3 centerToVertex = eyeToCenter * czm_eyeEllipsoidNormalEC + vertexPositionEC;
|
|
vec3 vertexNormal = normalize(centerToVertex);
|
|
|
|
// Estimate the (sine of the) angle between the camera direction and the vertex normal
|
|
float verticalDistance = dot(vertexPositionEC, czm_eyeEllipsoidNormalEC);
|
|
float horizontalDistance = length(vertexPositionEC - verticalDistance * czm_eyeEllipsoidNormalEC);
|
|
float sinTheta = horizontalDistance / (eyeToCenter + verticalDistance);
|
|
bool isSmallAngle = clamp(sinTheta, 0.0, 0.05) == sinTheta;
|
|
|
|
// Approximate the change in height above the ellipsoid, from camera to vertex position.
|
|
float exactVersine = 1.0 - dot(czm_eyeEllipsoidNormalEC, vertexNormal);
|
|
float smallAngleVersine = 0.5 * sinTheta * sinTheta;
|
|
float versine = isSmallAngle ? smallAngleVersine : exactVersine;
|
|
float dHeight = dot(vertexPositionEC, vertexNormal) - eyeToCenter * versine;
|
|
float vertexHeight = czm_eyeHeight + dHeight;
|
|
|
|
// Transform the approximate vertex normal to model coordinates.
|
|
vec3 vertexNormalMC = (czm_inverseModelView * vec4(vertexNormal, 0.0)).xyz;
|
|
vertexNormalMC = normalize(vertexNormalMC);
|
|
|
|
// Compute the exaggeration and apply it along the approximate vertex normal.
|
|
float stretch = u_verticalExaggerationAndRelativeHeight.x;
|
|
float shift = u_verticalExaggerationAndRelativeHeight.y;
|
|
float exaggeration = (vertexHeight - shift) * (stretch - 1.0);
|
|
attributes.positionMC += exaggeration * vertexNormalMC;
|
|
}
|
|
`,D5={name:"VerticalExaggerationPipelineStage"},tTe=new H;D5.process=function(e,t,n){const{shaderBuilder:i,uniformMap:o}=e;i.addVertexLines(eTe),i.addDefine("HAS_VERTICAL_EXAGGERATION",void 0,ge.VERTEX),i.addUniform("vec2","u_verticalExaggerationAndRelativeHeight",ge.VERTEX),o.u_verticalExaggerationAndRelativeHeight=function(){return H.fromElements(n.verticalExaggeration,n.verticalExaggerationRelativeHeight,tTe)}};const nTe=D5,MO={};function iTe(e){const t=je.createTypedArray(e,e*2),n=e;let i=0;for(let o=0;o<n;o+=3)t[i++]=o,t[i++]=o+1,t[i++]=o+1,t[i++]=o+2,t[i++]=o+2,t[i++]=o;return t}function oTe(e,t){const n=t.length,i=je.createTypedArray(e,n*2);let o=0;for(let r=0;r<n;r+=3){const s=t[r],a=t[r+1],l=t[r+2];i[o++]=s,i[o++]=a,i[o++]=a,i[o++]=l,i[o++]=l,i[o++]=s}return i}function rTe(e){const t=e-2,n=2+t*4,i=je.createTypedArray(e,n);let o=0;i[o++]=0,i[o++]=1;for(let r=0;r<t;r++)i[o++]=r+1,i[o++]=r+2,i[o++]=r+2,i[o++]=r;return i}function sTe(e,t){const i=t.length-2,o=2+i*4,r=je.createTypedArray(e,o);let s=0;r[s++]=t[0],r[s++]=t[1];for(let a=0;a<i;a++){const l=t[a],u=t[a+1],h=t[a+2];r[s++]=u,r[s++]=h,r[s++]=h,r[s++]=l}return r}function aTe(e){const t=e-2,n=2+t*4,i=je.createTypedArray(e,n);let o=0;i[o++]=0,i[o++]=1;for(let r=0;r<t;r++)i[o++]=r+1,i[o++]=r+2,i[o++]=r+2,i[o++]=0;return i}function cTe(e,t){const i=t.length-2,o=2+i*4,r=je.createTypedArray(e,o);let s=0;const a=t[0];r[s++]=a,r[s++]=t[1];for(let l=0;l<i;l++){const u=t[l+1],h=t[l+2];r[s++]=u,r[s++]=h,r[s++]=h,r[s++]=a}return r}MO.createWireframeIndices=function(e,t,n){const i=c(n);if(e===ze.TRIANGLES)return i?oTe(t,n):iTe(t);if(e===ze.TRIANGLE_STRIP)return i?sTe(t,n):rTe(t);if(e===ze.TRIANGLE_FAN)return i?cTe(t,n):aTe(t)};MO.getWireframeIndicesCount=function(e,t){return e===ze.TRIANGLES?t*2:e===ze.TRIANGLE_STRIP||e===ze.TRIANGLE_FAN?2+(t-2)*4:t};const P5=MO,O5={name:"WireframePipelineStage"};O5.process=function(e,t,n){e.shaderBuilder.addDefine("HAS_WIREFRAME",void 0,ge.FRAGMENT);const o=e.model,r=lTe(t,e.indices,n);o._pipelineResources.push(r),e.wireframeIndexBuffer=r;const s=!1;o.statistics.addBuffer(r,s);const a=e.primitiveType,l=e.count;e.primitiveType=ze.LINES,e.count=P5.getWireframeIndicesCount(a,l)};function lTe(e,t,n){const o=Lt.getAttributeBySemantic(e,ht.POSITION).count,r=n.context.webgl2;let s;if(c(t)){const h=t.buffer,f=t.count;c(h)&&r?(s=h.sizeInBytes===f?new Uint8Array(f):je.createTypedArray(o,f),h.getBufferData(s)):s=t.typedArray}const a=e.primitiveType,l=P5.createWireframeIndices(a,o,s),u=je.fromSizeInBytes(l.BYTES_PER_ELEMENT);return ct.createIndexBuffer({context:n.context,typedArray:l,usage:ke.STATIC_DRAW,indexDatatype:u})}const uTe=O5;function L5(e){e=y(e,y.EMPTY_OBJECT);const t=e.primitive,n=e.node,i=e.model;A.typeOf.object("options.primitive",t),A.typeOf.object("options.node",n),A.typeOf.object("options.model",i),this.primitive=t,this.node=n,this.model=i,this.pipelineStages=[],this.drawCommand=void 0,this.boundingSphere=void 0,this.boundingSphere2D=void 0,this.positionBuffer2D=void 0,this.batchLengths=void 0,this.batchOffsets=void 0,this.updateStages=[]}L5.prototype.configurePipeline=function(e){const t=this.pipelineStages;t.length=0;const n=this.primitive,i=this.node,o=this.model,r=o.customShader,s=o.style,a=e.context.webgl2,u=e.mode!==oe.SCENE3D&&!e.scene3DOnly&&o._projectTo2D,h=e.verticalExaggeration!==1,f=c(n.morphTargets)&&n.morphTargets.length>0,_=c(i.skin),g=c(r),b=!(g&&c(r.fragmentShaderText))||r.mode!==RO.REPLACE_MATERIAL,T=Lt.hasQuantizedAttributes(n.attributes),x=o.debugWireframe&&ze.isTriangles(n.primitiveType)&&(o._enableDebugWireframe||a),C=o.pointCloudShading,w=c(C)&&C.attenuation,v=c(C)&&C.backFaceCulling,P=n.primitiveType===ze.POINTS&&(c(s)||w||v),N=o._enableShowOutline&&c(n.outlineCoordinates),k=dTe(o,i,n),M=c(o.classificationType);u&&t.push(Xbe),t.push(tbe),x&&t.push(uTe),M&&t.push(qye),f&&t.push(bbe),_&&t.push(Jbe),P&&t.push(Rbe),T&&t.push(k0e),b&&t.push(ube),t.push(NO),t.push(op),k.hasPropertyTable&&(t.push(sD),t.push(jye),t.push(Xye)),h&&t.push(nTe),g&&t.push(M0e),t.push(obe),o.allowPicking&&t.push(xbe),N&&t.push(Fbe),t.push(Gye),t.push(kbe)};function dTe(e,t,n){let i;return c(t.instances)&&(i=Lt.getFeatureIdsByLabel(t.instances.featureIds,e.instanceFeatureIdLabel),c(i))?{hasFeatureIds:!0,hasPropertyTable:c(i.propertyTableId)}:(i=Lt.getFeatureIdsByLabel(n.featureIds,e.featureIdLabel),c(i)?{hasFeatureIds:!0,hasPropertyTable:c(i.propertyTableId)}:{hasFeatureIds:!1,hasPropertyTable:!1})}function FO(e){e=y(e,y.EMPTY_OBJECT),A.typeOf.object("options.skin",e.skin),A.typeOf.object("options.sceneGraph",e.sceneGraph),this._sceneGraph=e.sceneGraph;const t=e.skin;this._skin=t,this._inverseBindMatrices=void 0,this._joints=[],this._jointMatrices=[],hTe(this)}Object.defineProperties(FO.prototype,{skin:{get:function(){return this._skin}},sceneGraph:{get:function(){return this._sceneGraph}},inverseBindMatrices:{get:function(){return this._inverseBindMatrices}},joints:{get:function(){return this._joints}},jointMatrices:{get:function(){return this._jointMatrices}}});function hTe(e){const t=e.skin,n=t.inverseBindMatrices;e._inverseBindMatrices=n;const i=t.joints,o=i.length,r=e.sceneGraph._runtimeNodes,s=e.joints,a=e._jointMatrices;for(let l=0;l<o;l++){const u=i[l].index,h=r[u];s.push(h);const f=n[l],_=R5(h,f,new L);a.push(_)}}function R5(e,t,n){const i=L.multiplyTransformation(e.transformToRoot,e.transform,n);return n=L.multiplyTransformation(i,t,n),n}FO.prototype.updateJointMatrices=function(){const e=this._jointMatrices,t=e.length;for(let n=0;n<t;n++){const i=this.joints[n],o=this.inverseBindMatrices[n];e[n]=R5(i,o,e[n])}};function fTe(){this.pass=void 0,this.alphaCutoff=void 0}function pTe(e){A.typeOf.object("model",e),this.shaderBuilder=new Es,this.model=e,this.uniformMap={},this.alphaOptions=new fTe,this.renderStateOptions=Ue.getState(Ue.fromCache({depthTest:{enabled:!0,func:lp.LESS_OR_EQUAL}})),this.hasSilhouette=!1,this.hasSkipLevelOfDetail=!1}const mTe=`void silhouetteStage(inout vec4 color) {
|
|
if(model_silhouettePass) {
|
|
color = czm_gammaCorrect(model_silhouetteColor);
|
|
}
|
|
}`,_Te=`void silhouetteStage(in ProcessedAttributes attributes, inout vec4 positionClip) {
|
|
#ifdef HAS_NORMALS
|
|
if(model_silhouettePass) {
|
|
vec3 normal = normalize(czm_normal3D * attributes.normalMC);
|
|
normal.x *= czm_projection[0][0];
|
|
normal.y *= czm_projection[1][1];
|
|
positionClip.xy += normal.xy * positionClip.w * model_silhouetteSize * czm_pixelRatio / czm_viewport.z;
|
|
}
|
|
#endif
|
|
}
|
|
`,jx={name:"ModelSilhouettePipelineStage"};jx.silhouettesLength=0;jx.process=function(e,t,n){c(t._silhouetteId)||(t._silhouetteId=++jx.silhouettesLength);const i=e.shaderBuilder;i.addDefine("HAS_SILHOUETTE",void 0,ge.BOTH),i.addVertexLines(_Te),i.addFragmentLines(mTe),i.addUniform("vec4","model_silhouetteColor",ge.FRAGMENT),i.addUniform("float","model_silhouetteSize",ge.VERTEX),i.addUniform("bool","model_silhouettePass",ge.BOTH);const o={model_silhouetteColor:function(){return t.silhouetteColor},model_silhouetteSize:function(){return t.silhouetteSize},model_silhouettePass:function(){return!1}};e.uniformMap=jt(o,e.uniformMap),e.hasSilhouette=!0};const gTe=jx,yTe=`void modelSplitterStage()
|
|
{
|
|
// Don't split when rendering the shadow map, because it is rendered from
|
|
// the perspective of a totally different camera.
|
|
#ifndef SHADOW_MAP
|
|
if (model_splitDirection < 0.0 && gl_FragCoord.x > czm_splitPosition) discard;
|
|
if (model_splitDirection > 0.0 && gl_FragCoord.x < czm_splitPosition) discard;
|
|
#endif
|
|
}
|
|
`,WA={name:"ModelSplitterPipelineStage",SPLIT_DIRECTION_UNIFORM_NAME:"model_splitDirection"};WA.process=function(e,t,n){const i=e.shaderBuilder;i.addDefine("HAS_MODEL_SPLITTER",void 0,ge.FRAGMENT),i.addFragmentLines(yTe);const o={};i.addUniform("float",WA.SPLIT_DIRECTION_UNIFORM_NAME,ge.FRAGMENT),o[WA.SPLIT_DIRECTION_UNIFORM_NAME]=function(){return t.splitDirection},e.uniformMap=jt(o,e.uniformMap)};const bTe=WA;function TTe(e,t){A.typeOf.object("modelRenderResources",e),A.typeOf.object("runtimeNode",t),this.model=e.model,this.shaderBuilder=e.shaderBuilder.clone(),this.uniformMap=Je(e.uniformMap),this.alphaOptions=Je(e.alphaOptions),this.renderStateOptions=Je(e.renderStateOptions,!0),this.hasSilhouette=e.hasSilhouette,this.hasSkipLevelOfDetail=e.hasSkipLevelOfDetail,this.runtimeNode=t,this.attributes=[],this.attributeIndex=1,this.featureIdVertexAttributeSetIndex=0,this.instanceCount=0}function ATe(e){e=y(e,y.EMPTY_OBJECT),this.lightingModel=y(e.lightingModel,Gx.UNLIT)}function xTe(e,t){A.typeOf.object("nodeRenderResources",e),A.typeOf.object("runtimePrimitive",t),this.model=e.model,this.runtimeNode=e.runtimeNode,this.attributes=e.attributes.slice(),this.attributeIndex=e.attributeIndex,this.featureIdVertexAttributeSetIndex=e.featureIdVertexAttributeSetIndex,this.uniformMap=Je(e.uniformMap),this.alphaOptions=Je(e.alphaOptions),this.renderStateOptions=Je(e.renderStateOptions,!0),this.hasSilhouette=e.hasSilhouette,this.hasSkipLevelOfDetail=e.hasSkipLevelOfDetail,this.shaderBuilder=e.shaderBuilder.clone(),this.instanceCount=e.instanceCount,this.runtimePrimitive=t;const n=t.primitive;this.count=c(n.indices)?n.indices.count:Lt.getAttributeBySemantic(n,"POSITION").count,this.hasPropertyTable=!1,this.indices=n.indices,this.wireframeIndexBuffer=void 0,this.primitiveType=n.primitiveType;const i=Lt.getPositionMinMax(n,this.runtimeNode.instancingTranslationMin,this.runtimeNode.instancingTranslationMax);this.positionMin=d.clone(i.min,new d),this.positionMax=d.clone(i.max,new d),this.boundingSphere=se.fromCornerPoints(this.positionMin,this.positionMax,new se),this.lightingOptions=new ATe,this.pickId=void 0}function Ha(e){e=y(e,y.EMPTY_OBJECT);const t=e.modelComponents;A.typeOf.object("options.model",e.model),A.typeOf.object("options.modelComponents",t),this._model=e.model,this._components=t,this._pipelineStages=[],this._updateStages=[],this._runtimeNodes=[],this._rootNodes=[],this._skinnedNodes=[],this._runtimeSkins=[],this.modelPipelineStages=[],this._boundingSphere=void 0,this._boundingSphere2D=void 0,this._computedModelMatrix=L.clone(L.IDENTITY),this._computedModelMatrix2D=L.clone(L.IDENTITY),this._axisCorrectionMatrix=Lt.getAxisCorrectionMatrix(t.upAxis,t.forwardAxis,new L),this._runtimeArticulations={},CTe(this)}Object.defineProperties(Ha.prototype,{components:{get:function(){return this._components}},computedModelMatrix:{get:function(){return this._computedModelMatrix}},axisCorrectionMatrix:{get:function(){return this._axisCorrectionMatrix}},boundingSphere:{get:function(){return this._boundingSphere}}});function CTe(e){const t=e._components,n=t.scene,o=e._model.modelMatrix;N5(e,o);const r=t.articulations,s=r.length,a=e._runtimeArticulations;for(let C=0;C<s;C++){const w=r[C],v=new BC({articulation:w,sceneGraph:e}),P=v.name;a[P]=v}const l=t.nodes,u=l.length;e._runtimeNodes=new Array(u);const f=n.nodes.length,_=L.IDENTITY;for(let C=0;C<f;C++){const w=n.nodes[C],v=M5(e,w,_);e._rootNodes.push(v)}const g=t.skins,m=e._runtimeSkins,b=g.length;for(let C=0;C<b;C++){const w=g[C];m.push(new FO({skin:w,sceneGraph:e}))}const T=e._skinnedNodes,x=T.length;for(let C=0;C<x;C++){const w=T[C],v=e._runtimeNodes[w],N=l[w].skin.index;v._runtimeSkin=m[N],v.updateJointMatrices()}e.applyArticulations()}function N5(e,t){const n=e._components,i=e._model;e._computedModelMatrix=L.multiplyTransformation(t,n.transform,e._computedModelMatrix),e._computedModelMatrix=L.multiplyTransformation(e._computedModelMatrix,e._axisCorrectionMatrix,e._computedModelMatrix),e._computedModelMatrix=L.multiplyByUniformScale(e._computedModelMatrix,i.computedScale,e._computedModelMatrix)}const ETe=new d;function wTe(e,t){const n=e._computedModelMatrix,i=L.getTranslation(n,ETe);if(!d.equals(i,d.ZERO))e._computedModelMatrix2D=zt.basisTo2D(t.mapProjection,n,e._computedModelMatrix2D);else{const o=e.boundingSphere.center,r=zt.wgs84To2DModelMatrix(t.mapProjection,o,e._computedModelMatrix2D);e._computedModelMatrix2D=L.multiply(r,n,e._computedModelMatrix2D)}e._boundingSphere2D=se.transform(e._boundingSphere,e._computedModelMatrix2D,e._boundingSphere2D)}function M5(e,t,n){const i=[],o=Lt.getNodeTransform(t),r=t.children.length;for(let h=0;h<r;h++){const f=t.children[h],_=L.multiplyTransformation(n,o,new L),g=M5(e,f,_);i.push(g)}const s=new Q_({node:t,transform:o,transformToRoot:n,children:i,sceneGraph:e}),a=t.primitives.length;for(let h=0;h<a;h++)s.runtimePrimitives.push(new L5({primitive:t.primitives[h],node:t,model:e._model}));const l=t.index;e._runtimeNodes[l]=s,c(t.skin)&&e._skinnedNodes.push(l);const u=t.name;if(c(u)){const h=e._model,f=new HH(h,s);h._nodesByName[u]=f}return l}const STe=new d,vTe=new d,ITe=new d,DTe=new d;Ha.prototype.buildDrawCommands=function(e){const t=this._model,n=new pTe(t);t.statistics.clear(),this.configurePipeline(e);const i=this.modelPipelineStages;let o,r,s;for(o=0;o<i.length;o++)i[o].process(n,t,e);const a=d.fromElements(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,STe),l=d.fromElements(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,vTe);for(o=0;o<this._runtimeNodes.length;o++){const u=this._runtimeNodes[o];if(!c(u))continue;u.configurePipeline();const h=u.pipelineStages,f=new TTe(n,u);for(r=0;r<h.length;r++)h[r].process(f,u.node,e);const _=u.computedTransform;for(r=0;r<u.runtimePrimitives.length;r++){const g=u.runtimePrimitives[r];g.configurePipeline(e);const m=g.pipelineStages,b=new xTe(f,g);for(s=0;s<m.length;s++)m[s].process(b,g.primitive,e);g.boundingSphere=se.clone(b.boundingSphere,new se);const T=L.multiplyByPoint(_,b.positionMin,ITe),x=L.multiplyByPoint(_,b.positionMax,DTe);d.minimumByComponent(a,T,a),d.maximumByComponent(l,x,l);const C=Jge(b,e);g.drawCommand=C}}this._boundingSphere=se.fromCornerPoints(a,l,new se),this._boundingSphere=se.transformWithoutScale(this._boundingSphere,this._axisCorrectionMatrix,this._boundingSphere),this._boundingSphere=se.transform(this._boundingSphere,this._components.transform,this._boundingSphere),t._boundingSphere=se.transform(this._boundingSphere,t.modelMatrix,t._boundingSphere),t._initialRadius=t._boundingSphere.radius,t._boundingSphere.radius*=t._clampedScale};Ha.prototype.configurePipeline=function(e){const t=this.modelPipelineStages;t.length=0;const n=this._model,i=e.fog.enabled&&e.fog.renderable;c(n.color)&&t.push(nD),!c(n.classificationType)&&(n.imageBasedLighting.enabled&&t.push(sye),n.isClippingEnabled()&&t.push(mye),n.isClippingPolygonsEnabled()&&t.push(yye),n.hasSilhouette(e)&&t.push(gTe),c(n.splitDirection)&&n.splitDirection!==zp.NONE&&t.push(bTe),bs.is3DTiles(n.type)&&t.push(tye),i&&t.push(oye))};Ha.prototype.update=function(e,t){let n,i,o;for(n=0;n<this._runtimeNodes.length;n++){const r=this._runtimeNodes[n];if(!c(r))continue;for(i=0;i<r.updateStages.length;i++)r.updateStages[i].update(r,this,e);const s=e.mode!==oe.SCENE3D&&this._model._projectTo2D;for(t&&!s&&this.updateJointMatrices(),i=0;i<r.runtimePrimitives.length;i++){const a=r.runtimePrimitives[i];for(o=0;o<a.updateStages.length;o++)a.updateStages[o].update(a,this)}}};Ha.prototype.updateModelMatrix=function(e,t){N5(this,e),t.mode!==oe.SCENE3D&&wTe(this,t);const n=this._rootNodes;for(let i=0;i<n.length;i++){const o=this._runtimeNodes[n[i]];o._transformDirty=!0}};Ha.prototype.updateJointMatrices=function(){const e=this._skinnedNodes,t=e.length;for(let n=0;n<t;n++){const i=e[n];this._runtimeNodes[i].updateJointMatrices()}};function F5(e,t,n,i,o){if(n&&!t.show)return;const r=t.children.length;for(let l=0;l<r;l++){const u=t.getChild(l);F5(e,u,n,i,o)}const s=t.runtimePrimitives,a=s.length;for(let l=0;l<a;l++){const u=s[l];i(u,o)}}function zC(e,t,n,i){const o=e._rootNodes,r=o.length;for(let s=0;s<r;s++){const a=o[s],l=e._runtimeNodes[a];F5(e,l,t,n,i)}}const PTe={backFaceCulling:void 0};Ha.prototype.updateBackFaceCulling=function(e){const t=PTe;t.backFaceCulling=e,zC(this,!1,OTe,t)};function OTe(e,t){const n=e.drawCommand;n.backFaceCulling=t.backFaceCulling}const LTe={shadowMode:void 0};Ha.prototype.updateShadows=function(e){const t=LTe;t.shadowMode=e,zC(this,!1,RTe,t)};function RTe(e,t){const n=e.drawCommand;n.shadows=t.shadowMode}const NTe={debugShowBoundingVolume:void 0};Ha.prototype.updateShowBoundingVolume=function(e){const t=NTe;t.debugShowBoundingVolume=e,zC(this,!1,MTe,t)};function MTe(e,t){const n=e.drawCommand;n.debugShowBoundingVolume=t.debugShowBoundingVolume}const B5=[],FTe={frameState:void 0,hasSilhouette:void 0};Ha.prototype.pushDrawCommands=function(e){const t=B5;t.length=0;const n=FTe;n.hasSilhouette=this._model.hasSilhouette(e),n.frameState=e,zC(this,!0,BTe,n),e.commandList.push.apply(e.commandList,t)};function BTe(e,t){const n=t.frameState,i=t.hasSilhouette,o=n.passes,r=B5,s=e.drawCommand;s.pushCommands(n,n.commandList),i&&!o.pick&&s.pushSilhouetteCommands(n,r)}Ha.prototype.setArticulationStage=function(e,t){const n=e.split(" ");if(n.length!==2)return;const i=n[0],o=n[1],r=this._runtimeArticulations[i];c(r)&&r.setArticulationStage(o,t)};Ha.prototype.applyArticulations=function(){const e=this._runtimeArticulations;for(const t in e)e.hasOwnProperty(t)&&e[t].apply()};function K_(){this.pointsLength=0,this.trianglesLength=0,this.geometryByteLength=0,this.texturesByteLength=0,this.propertyTablesByteLength=0,this._bufferIdSet={},this._textureIdSet={},this._batchTextureIdMap=new mt}Object.defineProperties(K_.prototype,{batchTexturesByteLength:{get:function(){const e=this._batchTextureIdMap.length,t=this._batchTextureIdMap.values;let n=0;for(let i=0;i<e;i++)n+=t[i].byteLength;return n}}});K_.prototype.clear=function(){this.pointsLength=0,this.trianglesLength=0,this.geometryByteLength=0,this.texturesByteLength=0,this.propertyTablesByteLength=0,this._bufferIdSet={},this._textureIdSet={},this._batchTextureIdMap.removeAll()};K_.prototype.addBuffer=function(e,t){if(A.typeOf.object("buffer",e),A.typeOf.bool("hasCpuCopy",t),!this._bufferIdSet.hasOwnProperty(e._id)){const n=t?2:1;this.geometryByteLength+=e.sizeInBytes*n}this._bufferIdSet[e._id]=!0};K_.prototype.addTexture=function(e){A.typeOf.object("texture",e),this._textureIdSet.hasOwnProperty(e._id)||(this.texturesByteLength+=e.sizeInBytes),this._textureIdSet[e._id]=!0};K_.prototype.addBatchTexture=function(e){A.typeOf.object("batchTexture",e),this._batchTextureIdMap.contains(e._id)||this._batchTextureIdMap.set(e._id,e)};const z5={},Tf=Uint32Array.BYTES_PER_ELEMENT;z5.parse=function(e,t){t=y(t,0),A.defined("arrayBuffer",e);const n=new Uint8Array(e),i=new DataView(e);t+=Tf;const o=i.getUint32(t,!0);if(o!==1)throw new Te(`Only Point Cloud tile version 1 is supported. Version ${o} is not.`);t+=Tf,t+=Tf;const r=i.getUint32(t,!0);if(r===0)throw new Te("Feature table must have a byte length greater than zero");t+=Tf;const s=i.getUint32(t,!0);t+=Tf;const a=i.getUint32(t,!0);t+=Tf;const l=i.getUint32(t,!0);t+=Tf;const u=sa(n,t,r);t+=r;const h=new Uint8Array(e,t,s);t+=s;let f,_;a>0&&(f=sa(n,t,a),t+=a,l>0&&(_=new Uint8Array(e,t,l),t+=l));const g=new ef(u,h),m=g.getGlobalProperty("POINTS_LENGTH");if(g.featuresLength=m,!c(m))throw new Te("Feature table global property: POINTS_LENGTH must be defined");let b=g.getGlobalProperty("RTC_CENTER",Z.FLOAT,3);c(b)&&(b=d.unpack(b));const T=zTe(g,f);if(T.rtcCenter=b,T.pointsLength=m,!T.hasPositions){const x=UTe(g);T.positions=x,T.hasPositions=T.hasPositions||c(x)}if(!T.hasPositions)throw new Te("Either POSITION or POSITION_QUANTIZED must be defined.");if(!T.hasNormals){const x=VTe(g);T.normals=x,T.hasNormals=T.hasNormals||c(x)}if(!T.hasColors){const x=kTe(g);T.colors=x,T.hasColors=T.hasColors||c(x),T.hasConstantColor=c(T.constantColor),T.isTranslucent=c(x)&&x.isTranslucent}if(!T.hasBatchIds){const x=HTe(g);T.batchIds=x,T.hasBatchIds=T.hasBatchIds||c(x)}if(T.hasBatchIds){const x=g.getGlobalProperty("BATCH_LENGTH");if(!c(x))throw new Te("Global property: BATCH_LENGTH must be defined when BATCH_ID is defined.");T.batchLength=x}return c(_)&&(_=new Uint8Array(_),T.batchTableJson=f,T.batchTableBinary=_),T};function zTe(e,t){const n=e.json;let i,o,r;const s=c(n.extensions)?n.extensions["3DTILES_draco_point_compression"]:void 0,a=c(t)&&c(t.extensions)?t.extensions["3DTILES_draco_point_compression"]:void 0;c(a)&&(r=a.properties);let l,u,h,f,_;if(c(s)){o=s.properties;const m=s.byteOffset,b=s.byteLength;if(!c(o)||!c(m)||!c(b))throw new Te("Draco properties, byteOffset, and byteLength must be defined");i=e.buffer.slice(m,m+b),l=c(o.POSITION),u=c(o.RGB)||c(o.RGBA),h=c(o.NORMAL),f=c(o.BATCH_ID),_=c(o.RGBA)}let g;return c(i)&&(g={buffer:i,featureTableProperties:o,batchTableProperties:r,properties:jt(o,r),dequantizeInShader:!0}),{draco:g,hasPositions:l,hasColors:u,isTranslucent:_,hasNormals:h,hasBatchIds:f}}function UTe(e){const t=e.json;let n;if(c(t.POSITION))return n=e.getPropertyArray("POSITION",Z.FLOAT,3),{name:ht.POSITION,semantic:ht.POSITION,typedArray:n,isQuantized:!1,componentDatatype:Z.FLOAT,type:qt.VEC3};if(c(t.POSITION_QUANTIZED)){n=e.getPropertyArray("POSITION_QUANTIZED",Z.UNSIGNED_SHORT,3);const i=e.getGlobalProperty("QUANTIZED_VOLUME_SCALE",Z.FLOAT,3);if(!c(i))throw new Te("Global property: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");const o=(1<<16)-1,r=e.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",Z.FLOAT,3);if(!c(r))throw new Te("Global property: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");return{name:ht.POSITION,semantic:ht.POSITION,typedArray:n,isQuantized:!0,componentDatatype:Z.FLOAT,type:qt.VEC3,quantizedRange:o,quantizedVolumeOffset:d.unpack(r),quantizedVolumeScale:d.unpack(i),quantizedComponentDatatype:Z.UNSIGNED_SHORT,quantizedType:qt.VEC3}}}function kTe(e){const t=e.json;let n;if(c(t.RGBA))return n=e.getPropertyArray("RGBA",Z.UNSIGNED_BYTE,4),{name:ht.COLOR,semantic:ht.COLOR,setIndex:0,typedArray:n,componentDatatype:Z.UNSIGNED_BYTE,type:qt.VEC4,normalized:!0,isRGB565:!1,isTranslucent:!0};if(c(t.RGB))return n=e.getPropertyArray("RGB",Z.UNSIGNED_BYTE,3),{name:"COLOR",semantic:ht.COLOR,setIndex:0,typedArray:n,componentDatatype:Z.UNSIGNED_BYTE,type:qt.VEC3,normalized:!0,isRGB565:!1,isTranslucent:!1};if(c(t.RGB565))return n=e.getPropertyArray("RGB565",Z.UNSIGNED_SHORT,1),{name:"COLOR",semantic:ht.COLOR,setIndex:0,typedArray:n,componentDatatype:Z.FLOAT,type:qt.VEC3,normalized:!1,isRGB565:!0,isTranslucent:!1};if(c(t.CONSTANT_RGBA)){const i=e.getGlobalProperty("CONSTANT_RGBA",Z.UNSIGNED_BYTE,4),o=i[3],r=z.fromBytes(i[0],i[1],i[2],o),s=o<255;return{name:ht.COLOR,semantic:ht.COLOR,setIndex:0,constantColor:r,componentDatatype:Z.FLOAT,type:qt.VEC4,isQuantized:!1,isTranslucent:s}}}function VTe(e){const t=e.json;let n;if(c(t.NORMAL))return n=e.getPropertyArray("NORMAL",Z.FLOAT,3),{name:ht.NORMAL,semantic:ht.NORMAL,typedArray:n,octEncoded:!1,octEncodedZXY:!1,componentDatatype:Z.FLOAT,type:qt.VEC3};if(c(t.NORMAL_OCT16P)){n=e.getPropertyArray("NORMAL_OCT16P",Z.UNSIGNED_BYTE,2);const i=8;return{name:ht.NORMAL,semantic:ht.NORMAL,typedArray:n,octEncoded:!0,octEncodedZXY:!1,quantizedRange:(1<<i)-1,quantizedType:qt.VEC2,quantizedComponentDatatype:Z.UNSIGNED_BYTE,componentDatatype:Z.FLOAT,type:qt.VEC3}}}function HTe(e){const t=e.json;if(c(t.BATCH_ID)){const n=e.getPropertyArray("BATCH_ID",Z.UNSIGNED_SHORT,1);return{name:ht.FEATURE_ID,semantic:ht.FEATURE_ID,setIndex:0,typedArray:n,componentDatatype:Z.fromTypedArray(n),type:qt.SCALAR}}}const U5=z5,GTe=yt.Components,jTe=yt.Scene,WTe=yt.Node,qTe=yt.Primitive,YTe=yt.Attribute,gF=yt.Quantization,$Te=yt.FeatureIdAttribute,XTe=yt.Material,QTe=yt.MetallicRoughness;function wh(e){e=y(e,y.EMPTY_OBJECT);const t=e.arrayBuffer,n=y(e.byteOffset,0);A.typeOf.object("options.arrayBuffer",t),this._arrayBuffer=t,this._byteOffset=n,this._loadAttributesFor2D=y(e.loadAttributesFor2D,!1),this._parsedContent=void 0,this._decodePromise=void 0,this._decodedAttributes=void 0,this._promise=void 0,this._error=void 0,this._state=ut.UNLOADED,this._buffers=[],this._components=void 0,this._transform=L.IDENTITY}c(Object.create)&&(wh.prototype=Object.create(wo.prototype),wh.prototype.constructor=wh);Object.defineProperties(wh.prototype,{cacheKey:{get:function(){}},components:{get:function(){return this._components}},transform:{get:function(){return this._transform}}});wh.prototype.load=function(){if(c(this._promise))return this._promise;this._parsedContent=U5.parse(this._arrayBuffer,this._byteOffset),this._state=ut.PROCESSING,this._promise=Promise.resolve(this)};wh.prototype.process=function(e){if(c(this._error)){const t=this._error;throw this._error=void 0,t}if(this._state===ut.READY)return!0;if(this._state===ut.PROCESSING){if(c(this._decodePromise))return!1;this._decodePromise=KTe(this,e.context)}return!1};function KTe(e,t){const i=e._parsedContent.draco;let o;if(c(i)?o=Fi.decodePointCloud(i,t):o=Promise.resolve(),!!c(o))return e._decodePromise=o,o.then(function(r){if(!e.isDestroyed())return c(r)&&ZTe(e,i,r),lAe(e,t),e._state=ut.READY,e}).catch(function(r){e.unload(),e._state=ut.FAILED;const s="Failed to load Draco pnts";e._error=e.getError(s,r)})}function ZTe(e,t,n){e._state=ut.READY;const i=e._parsedContent;let o;if(c(n.POSITION)){if(o={name:"POSITION",semantic:ht.POSITION,typedArray:n.POSITION.array,componentDatatype:Z.FLOAT,type:qt.VEC3,isQuantized:!1},c(n.POSITION.data.quantization)){const a=n.POSITION.data.quantization,l=a.range,u=d.fromElements(l,l,l),h=d.unpack(a.minValues),f=(1<<a.quantizationBits)-1;o.isQuantized=!0,o.quantizedRange=f,o.quantizedVolumeOffset=h,o.quantizedVolumeScale=u,o.quantizedComponentDatatype=f<=255?Z.UNSIGNED_BYTE:Z.UNSIGNED_SHORT,o.quantizedType=qt.VEC3}i.positions=o}if(c(n.NORMAL)){if(o={name:"NORMAL",semantic:ht.NORMAL,typedArray:n.NORMAL.array,componentDatatype:Z.FLOAT,type:qt.VEC3,isQuantized:!1,octEncoded:!1,octEncodedZXY:!1},c(n.NORMAL.data.quantization)){const a=(1<<n.NORMAL.data.quantization.quantizationBits)-1;o.quantizedRange=a,o.octEncoded=!0,o.octEncodedZXY=!0,o.quantizedComponentDatatype=Z.UNSIGNED_BYTE,o.quantizedType=qt.VEC2}i.normals=o}if(c(n.RGBA)?i.colors={name:"COLOR",semantic:ht.COLOR,setIndex:0,typedArray:n.RGBA.array,componentDatatype:Z.UNSIGNED_BYTE,type:qt.VEC4,normalized:!0,isTranslucent:!0}:c(n.RGB)&&(i.colors={name:"COLOR",semantic:ht.COLOR,setIndex:0,typedArray:n.RGB.array,componentDatatype:Z.UNSIGNED_BYTE,type:qt.VEC3,normalized:!0,isTranslucent:!1}),c(n.BATCH_ID)){const a=n.BATCH_ID.array;i.batchIds={name:"_FEATURE_ID",semantic:ht.FEATURE_ID,setIndex:0,typedArray:a,componentDatatype:Z.fromTypedArray(a),type:qt.SCALAR}}let r=i.batchTableJson;const s=t.batchTableProperties;for(const a in s)if(s.hasOwnProperty(a)){const l=n[a];c(r)||(r={}),i.hasDracoBatchTable=!0;const u=l.data;r[a]={byteOffset:u.byteOffset,type:JTe(u.componentsPerAttribute),componentType:eAe(u.componentDatatype),typedArray:l.array}}i.batchTableJson=r}function JTe(e){switch(e){case 1:return"SCALAR";case 2:return"VEC2";case 3:return"VEC3";case 4:return"VEC4";default:throw new E("componentsPerAttribute must be a number from 1-4")}}function eAe(e){switch(e){case J.BYTE:return"BYTE";case J.UNSIGNED_BYTE:return"UNSIGNED_BYTE";case J.SHORT:return"SHORT";case J.UNSIGNED_SHORT:return"UNSIGNED_SHORT";case J.INT:return"INT";case J.UNSIGNED_INT:return"UNSIGNED_INT";case J.DOUBLE:return"DOUBLE";case J.FLOAT:return"FLOAT";default:throw new E("value is not a valid WebGL constant")}}function Lg(e,t,n){let i=t.typedArray,o;if(t.octEncoded&&(o=new gF,o.octEncoded=t.octEncoded,o.octEncodedZXY=t.octEncodedZXY,o.normalizationRange=t.quantizedRange,o.type=t.quantizedType,o.componentDatatype=t.quantizedComponentDatatype),t.isQuantized){o=new gF;const a=t.quantizedRange;o.normalizationRange=a,o.quantizedVolumeOffset=d.ZERO;const l=t.quantizedVolumeScale;o.quantizedVolumeDimensions=l,o.quantizedVolumeStepSize=d.divideByScalar(l,a,new d),o.componentDatatype=t.quantizedComponentDatatype,o.type=t.quantizedType}const r=new YTe;if(r.name=t.name,r.semantic=t.semantic,r.setIndex=t.setIndex,r.componentDatatype=t.componentDatatype,r.type=t.type,r.normalized=y(t.normalized,!1),r.min=t.min,r.max=t.max,r.quantization=o,t.isRGB565&&(i=En.decodeRGB565(i)),c(t.constantColor)){const a=new Array(4);r.constant=z.pack(t.constantColor,a)}else{const a=ct.createVertexBuffer({typedArray:i,context:n,usage:ke.STATIC_DRAW});a.vertexArrayDestroyable=!1,e._buffers.push(a),r.buffer=a}const s=e._loadAttributesFor2D;return r.semantic===ht.POSITION&&s&&(r.typedArray=i),r}let yF,yT;function tAe(e){if(!c(yT)){yF=new fC(0),yT=new Array(e);for(let t=0;t<e;++t)yT[t]=yF.random()}return yT}const nAe=new d,iAe=new d,oAe=new d;function rAe(e){const t=e.typedArray,n=20,i=t.length/3,o=Math.min(i,n),r=tAe(n),s=Number.MAX_VALUE,a=-Number.MAX_VALUE;let l=d.fromElements(s,s,s,nAe),u=d.fromElements(a,a,a,iAe),h,f,_;if(e.isQuantized)l=d.ZERO,u=e.quantizedVolumeScale;else for(h=0;h<o;++h)f=Math.floor(r[h]*i),_=d.unpack(t,f*3,oAe),d.minimumByComponent(l,_,l),d.maximumByComponent(u,_,u);e.min=d.clone(l),e.max=d.clone(u)}const sAe={name:ht.COLOR,semantic:ht.COLOR,setIndex:0,constantColor:z.DARKGRAY,componentDatatype:Z.FLOAT,type:qt.VEC4,isQuantized:!1,isTranslucent:!1};function aAe(e,t,n){const i=[];let o;const r=t.positions;return c(r)&&(rAe(r),o=Lg(e,r,n),o.count=t.pointsLength,i.push(o)),c(t.normals)&&(o=Lg(e,t.normals,n),i.push(o)),c(t.colors)?(o=Lg(e,t.colors,n),i.push(o)):(o=Lg(e,sAe,n),i.push(o)),c(t.batchIds)&&(o=Lg(e,t.batchIds,n),i.push(o)),i}function cAe(e,t){const n=e.batchLength,i=e.pointsLength,o=e.batchTableBinary,r=!c(e.batchIds);if(c(o)||e.hasDracoBatchTable){const s=y(n,i);return Up({count:s,batchTable:e.batchTableJson,binaryBody:o,parseAsPropertyAttributes:r,customAttributeOutput:t})}return new Dl({schema:{},propertyTables:[]})}function lAe(e,t){const n=e._parsedContent,i=new QTe;i.metallicFactor=0,i.roughnessFactor=.9;const o=new XTe;o.metallicRoughness=i;const r=n.colors;c(r)&&r.isTranslucent&&(o.alphaMode=Mx.BLEND);const s=!c(n.normals);o.unlit=s;const a=new qTe;if(a.attributes=aAe(e,n,t),a.primitiveType=ze.POINTS,a.material=o,c(n.batchIds)){const g=new $Te;g.propertyTableId=0,g.setIndex=0,g.positionalLabel="featureId_0",a.featureIds.push(g)}const l=new WTe;l.index=0,l.primitives=[a];const u=new jTe;u.nodes=[l],u.upAxis=Cr.Z,u.forwardAxis=Cr.X;const h=new GTe;h.scene=u,h.nodes=[l];const f=[];h.structuralMetadata=cAe(n,f),f.length>0&&uAe(e,a,f,t),c(n.rtcCenter)&&(h.transform=L.multiplyByTranslation(h.transform,n.rtcCenter,h.transform));const _=n.positions;c(_)&&_.isQuantized&&(h.transform=L.multiplyByTranslation(h.transform,_.quantizedVolumeOffset,h.transform)),e._components=h,e._parsedContent=void 0,e._arrayBuffer=void 0}function uAe(e,t,n,i){const o=t.attributes,r=n.length;for(let s=0;s<r;s++){const a=n[s],l=ct.createVertexBuffer({typedArray:a.typedArray,context:i,usage:ke.STATIC_DRAW});l.vertexArrayDestroyable=!1,e._buffers.push(l),a.buffer=l,a.typedArray=void 0,o.push(a)}t.propertyAttributeIds=[0]}wh.prototype.unload=function(){const e=this._buffers;for(let t=0;t<e.length;t++)e[t].destroy();e.length=0,this._components=void 0,this._parsedContent=void 0,this._arrayBuffer=void 0};const dAe=new d,hAe=new d,fAe=new d,pAe=new L,mAe=new L,_Ae=new L,gAe=new he,yAe=new se;function bAe(e,t,n,i,o,r,s){if(A.typeOf.object("model",e),A.typeOf.object("ray",t),A.typeOf.object("frameState",n),!e._ready||n.mode===oe.MORPHING)return;let a=Number.MAX_VALUE;const l=e.sceneGraph,u=l._runtimeNodes;for(let h=0;h<u.length;h++){const f=u[h],_=f.node;let g=L.clone(f.computedTransform,pAe),m=L.clone(l.computedModelMatrix,mAe);const b=_.instances;c(b)&&b.transformInWorldSpace&&(m=L.multiplyTransformation(e.modelMatrix,l.components.transform,m),g=L.multiplyTransformation(l.axisCorrectionMatrix,f.computedTransform,g));let T=L.multiplyTransformation(m,g,_Ae);n.mode!==oe.SCENE3D&&(T=zt.basisTo2D(n.mapProjection,T,T));const x=[];if(c(b)){const w=b.attributes[0].count,v=b.attributes[0].componentDatatype,P=12;let N=f.transformsTypedArray;if(!c(N)){const k=f.instancingTransformsBuffer;c(k)&&n.context.webgl2&&(N=Z.createTypedArray(v,w*P),k.getBufferData(N))}if(c(N))for(let k=0;k<w;k++){const M=k*P,U=new L(N[M],N[M+1],N[M+2],N[M+3],N[M+4],N[M+5],N[M+6],N[M+7],N[M+8],N[M+9],N[M+10],N[M+11],0,0,0,1);b.transformInWorldSpace?(L.multiplyTransformation(U,g,U),L.multiplyTransformation(m,U,U)):L.multiplyTransformation(U,T,U),x.push(U)}}x.length===0&&x.push(T);const C=f.runtimePrimitives.length;for(let w=0;w<C;w++){const v=f.runtimePrimitives[w],P=v.primitive;if(c(v.boundingSphere)&&!c(b)){const q=se.transform(v.boundingSphere,T,yAe),ee=Ei.raySphere(t,q);if(!c(ee))continue}const N=Lt.getAttributeBySemantic(P,ht.POSITION),k=N.byteOffset,M=N.byteStride,U=N.count;if(!c(P.indices))continue;let B=P.indices.typedArray;if(!c(B)){const q=P.indices.buffer,ee=P.indices.count,Y=P.indices.indexDatatype;c(q)&&n.context.webgl2&&(Y===je.UNSIGNED_BYTE?B=new Uint8Array(ee):Y===je.UNSIGNED_SHORT?B=new Uint16Array(ee):Y===je.UNSIGNED_INT&&(B=new Uint32Array(ee)),q.getBufferData(B))}let S=N.typedArray,D=N.componentDatatype,p=N.type;const I=N.quantization;c(I)&&(D=N.quantization.componentDatatype,p=N.quantization.type);const O=qt.getNumberOfComponents(p),F=Z.getSizeInBytes(D),V=!c(S)&&c(M)&&M!==O*F;let G=O,j=0;V&&(G=M/F,j=k/F);const W=U*G;if(!c(S)){const q=N.buffer;c(q)&&n.context.webgl2&&(S=Z.createTypedArray(D,W),q.getBufferData(S,V?0:k,0,W)),I&&N.normalized&&(S=En.dequantize(S,D,p,U))}if(!c(B)||!c(S))return;r=y(r,ae.WGS84),i=y(i,1),o=y(o,0);const X=B.length;for(let q=0;q<X;q+=3){const ee=B[q],Y=B[q+1],ne=B[q+2];for(const Q of x){const le=dS(S,ee,j,G,I,Q,i,o,r,dAe),pe=dS(S,Y,j,G,I,Q,i,o,r,hAe),re=dS(S,ne,j,G,I,Q,i,o,r,fAe),de=Ei.rayTriangleParametric(t,le,pe,re,y(e.backFaceCulling,!0));c(de)&&de<a&&de>=0&&(a=de)}}}}if(a!==Number.MAX_VALUE){if(s=nn.getPoint(t,a,s),n.mode!==oe.SCENE3D){d.fromElements(s.y,s.z,s.x,s);const h=n.mapProjection,f=h.ellipsoid,_=h.unproject(s,gAe);f.cartographicToCartesian(_,s)}return s}}function dS(e,t,n,i,o,r,s,a,l,u){const h=n+t*i;if(u.x=e[h],u.y=e[h+1],u.z=e[h+2],c(o))if(o.octEncoded){if(u=En.octDecodeInRange(u,o.normalizationRange,u),o.octEncodedZXY){const f=u.x;u.x=u.z,u.z=u.y,u.y=f}}else u=d.multiplyComponents(u,o.quantizedVolumeStepSize,u),u=d.add(u,o.quantizedVolumeOffset,u);return u=L.multiplyByPoint(r,u,u),s!==1&&oa.getPosition(u,l,s,a,u),u}function In(e){e=y(e,y.EMPTY_OBJECT),A.typeOf.object("options.loader",e.loader),A.typeOf.object("options.resource",e.resource),this._loader=e.loader,this._resource=e.resource,this.type=y(e.type,bs.GLTF),this.modelMatrix=L.clone(y(e.modelMatrix,L.IDENTITY)),this._modelMatrix=L.clone(this.modelMatrix),this._scale=y(e.scale,1),this._minimumPixelSize=y(e.minimumPixelSize,0),this._maximumScale=e.maximumScale,this._clampedScale=c(this._maximumScale)?Math.min(this._scale,this._maximumScale):this._scale,this._computedScale=this._clampedScale,this._updateModelMatrix=!1,this.referenceMatrix=void 0,this._iblReferenceFrameMatrix=$.clone($.IDENTITY),this._resourcesLoaded=!1,this._drawCommandsBuilt=!1,this._ready=!1,this._customShader=e.customShader,this._content=e.content,this._texturesLoaded=!1,this._defaultTexture=void 0,this._activeAnimations=new Td(this),this._clampAnimations=y(e.clampAnimations,!0),this._userAnimationDirty=!1,this._id=e.id,this._idDirty=!1,this._color=z.clone(e.color),this._colorBlendMode=y(e.colorBlendMode,RC.HIGHLIGHT),this._colorBlendAmount=y(e.colorBlendAmount,.5);const t=y(e.silhouetteColor,z.RED);this._silhouetteColor=z.clone(t),this._silhouetteSize=y(e.silhouetteSize,0),this._silhouetteDirty=!1,this._silhouetteId=void 0,this._cull=y(e.cull,!0),this._opaquePass=y(e.opaquePass,xe.OPAQUE),this._allowPicking=y(e.allowPicking,!0),this._show=y(e.show,!0),this._style=void 0,this._styleDirty=!1,this._styleCommandsNeeded=void 0;let n=y(e.featureIdLabel,"featureId_0");typeof n=="number"&&(n=`featureId_${n}`),this._featureIdLabel=n;let i=y(e.instanceFeatureIdLabel,"instanceFeatureId_0");typeof i=="number"&&(i=`instanceFeatureId_${i}`),this._instanceFeatureIdLabel=i,this._featureTables=[],this._featureTableId=void 0,this._featureTableIdDirty=!0,this._pipelineResources=[],this._modelResources=[],this._pickIds=[],this._boundingSphere=new se,this._initialRadius=void 0,this._heightReference=y(e.heightReference,gt.NONE),this._heightDirty=this._heightReference!==gt.NONE,this._removeUpdateHeightCallback=void 0,this._verticalExaggerationOn=!1,this._clampedModelMatrix=void 0;const o=e.scene;c(o)&&c(o.terrainProviderChanged)&&(this._terrainProviderChangedCallback=o.terrainProviderChanged.addEventListener(()=>{this._heightDirty=!0})),this._scene=o,this._distanceDisplayCondition=e.distanceDisplayCondition;const r=new q0(e.pointCloudShading);this._pointCloudShading=r,this._attenuation=r.attenuation,this._pointCloudBackFaceCulling=r.backFaceCulling;const s=e.clippingPlanes;c(s)&&s.owner===void 0?Li.setOwner(s,this,"_clippingPlanes"):this._clippingPlanes=s,this._clippingPlanesState=0,this._clippingPlanesMatrix=L.clone(L.IDENTITY);const a=e.clippingPolygons;c(a)&&a.owner===void 0?Di.setOwner(a,this,"_clippingPolygons"):this._clippingPolygons=a,this._clippingPolygonsState=0,this._lightColor=d.clone(e.lightColor),this._imageBasedLighting=c(e.imageBasedLighting)?e.imageBasedLighting:new G_,this._shouldDestroyImageBasedLighting=!c(e.imageBasedLighting),this._backFaceCulling=y(e.backFaceCulling,!0),this._backFaceCullingDirty=!1,this._shadows=y(e.shadows,Vi.ENABLED),this._shadowsDirty=!1,this._debugShowBoundingVolumeDirty=!1,this._debugShowBoundingVolume=y(e.debugShowBoundingVolume,!1),this._enableDebugWireframe=y(e.enableDebugWireframe,!1),this._enableShowOutline=y(e.enableShowOutline,!0),this._debugWireframe=y(e.debugWireframe,!1),this._debugWireframe===!0&&this._enableDebugWireframe===!1&&this.type===bs.GLTF&&$n("model-debug-wireframe-ignored","enableDebugWireframe must be set to true in Model.fromGltf, otherwise debugWireframe will be ignored.");let l=e.credit;typeof l=="string"&&(l=new Wt(l)),this._credits=[],this._credit=l,this._resourceCredits=[],this._gltfCredits=[],this._showCreditsOnScreen=y(e.showCreditsOnScreen,!1),this._showCreditsOnScreenDirty=!0,this._splitDirection=y(e.splitDirection,zp.NONE),this._enableShowOutline=y(e.enableShowOutline,!0),this.showOutline=y(e.showOutline,!0),this.outlineColor=y(e.outlineColor,z.BLACK),this._classificationType=e.classificationType,this._statistics=new K_,this._sceneMode=void 0,this._projectTo2D=y(e.projectTo2D,!1),this._enablePick=y(e.enablePick,!1),this._fogRenderable=void 0,this._skipLevelOfDetail=!1,this._ignoreCommands=y(e.ignoreCommands,!1),this._errorEvent=new Le,this._readyEvent=new Le,this._texturesReadyEvent=new Le,this._sceneGraph=void 0,this._nodesByName={},this.pickObject=e.pickObject}function hS(e,t){if(e._errorEvent.numberOfListeners>0){e._errorEvent.raiseEvent(t);return}console.log(t)}function TAe(e,t){const n=e._featureTables,i=t.propertyTables,o=i.length;for(let r=0;r<o;r++){const s=i[r],a=new lo({model:e,propertyTable:s});n.push(a)}return n}function AAe(e,t){const n=t._featureIdLabel,i=t._instanceFeatureIdLabel;let o,r,s,a;for(o=0;o<e.nodes.length;o++)if(a=e.nodes[o],c(a.instances)&&(s=Lt.getFeatureIdsByLabel(a.instances.featureIds,i),c(s)&&c(s.propertyTableId)))return s.propertyTableId;for(o=0;o<e.nodes.length;o++)for(a=e.nodes[o],r=0;r<a.primitives.length;r++){const l=a.primitives[r],u=Lt.getFeatureIdsByLabel(l.featureIds,n);if(c(u))return u.propertyTableId}if(t._featureTables.length===1)return 0}function aD(e,t){if(!c(e)&&!c(t))return!1;if(c(e)!==c(t))return!0;const n=e.alpha,i=t.alpha;return Math.floor(n)!==Math.floor(i)||Math.ceil(n)!==Math.ceil(i)}Object.defineProperties(In.prototype,{ready:{get:function(){return this._ready}},errorEvent:{get:function(){return this._errorEvent}},readyEvent:{get:function(){return this._readyEvent}},incrementallyLoadTextures:{get:function(){return y(this._loader.incrementallyLoadTextures,!1)}},texturesReadyEvent:{get:function(){return this._texturesReadyEvent}},loader:{get:function(){return this._loader}},statistics:{get:function(){return this._statistics}},activeAnimations:{get:function(){return this._activeAnimations}},clampAnimations:{get:function(){return this._clampAnimations},set:function(e){this._clampAnimations=e}},cull:{get:function(){return this._cull}},opaquePass:{get:function(){return this._opaquePass}},pointCloudShading:{get:function(){return this._pointCloudShading},set:function(e){A.defined("pointCloudShading",e),e!==this._pointCloudShading&&this.resetDrawCommands(),this._pointCloudShading=e}},customShader:{get:function(){return this._customShader},set:function(e){e!==this._customShader&&this.resetDrawCommands(),this._customShader=e}},sceneGraph:{get:function(){return this._sceneGraph}},content:{get:function(){return this._content}},heightReference:{get:function(){return this._heightReference},set:function(e){e!==this._heightReference&&(this._heightDirty=!0),this._heightReference=e}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){if(c(e)&&e.far<=e.near)throw new E("far must be greater than near");this._distanceDisplayCondition=Pt.clone(e,this._distanceDisplayCondition)}},structuralMetadata:{get:function(){return this._sceneGraph.components.structuralMetadata}},featureTableId:{get:function(){return this._featureTableId},set:function(e){this._featureTableId=e}},featureTables:{get:function(){return this._featureTables},set:function(e){this._featureTables=e}},id:{get:function(){return this._id},set:function(e){e!==this._id&&(this._idDirty=!0),this._id=e}},allowPicking:{get:function(){return this._allowPicking}},style:{get:function(){return this._style},set:function(e){this._style=e,this._styleDirty=!0}},color:{get:function(){return this._color},set:function(e){aD(e,this._color)&&this.resetDrawCommands(),this._color=z.clone(e,this._color)}},colorBlendMode:{get:function(){return this._colorBlendMode},set:function(e){this._colorBlendMode=e}},colorBlendAmount:{get:function(){return this._colorBlendAmount},set:function(e){this._colorBlendAmount=e}},silhouetteColor:{get:function(){return this._silhouetteColor},set:function(e){if(!z.equals(e,this._silhouetteColor)){const t=aD(e,this._silhouetteColor);this._silhouetteDirty=this._silhouetteDirty||t}this._silhouetteColor=z.clone(e,this._silhouetteColor)}},silhouetteSize:{get:function(){return this._silhouetteSize},set:function(e){if(e!==this._silhouetteSize){const t=this._silhouetteSize,n=e>0&&t===0||e===0&&t>0;this._silhouetteDirty=this._silhouetteDirty||n,this._backFaceCullingDirty=this._backFaceCullingDirty||n}this._silhouetteSize=e}},boundingSphere:{get:function(){if(!this._ready)throw new E("The model is not loaded. Use Model.readyEvent or wait for Model.ready to be true.");const e=c(this._clampedModelMatrix)?this._clampedModelMatrix:this.modelMatrix;return V5(this,e),this._boundingSphere}},debugShowBoundingVolume:{get:function(){return this._debugShowBoundingVolume},set:function(e){this._debugShowBoundingVolume!==e&&(this._debugShowBoundingVolumeDirty=!0),this._debugShowBoundingVolume=e}},debugWireframe:{get:function(){return this._debugWireframe},set:function(e){this._debugWireframe!==e&&this.resetDrawCommands(),this._debugWireframe=e,this._debugWireframe===!0&&this._enableDebugWireframe===!1&&this.type===bs.GLTF&&$n("model-debug-wireframe-ignored","enableDebugWireframe must be set to true in Model.fromGltfAsync, otherwise debugWireframe will be ignored.")}},show:{get:function(){return this._show},set:function(e){this._show=e}},featureIdLabel:{get:function(){return this._featureIdLabel},set:function(e){typeof e=="number"&&(e=`featureId_${e}`),A.typeOf.string("value",e),e!==this._featureIdLabel&&(this._featureTableIdDirty=!0),this._featureIdLabel=e}},instanceFeatureIdLabel:{get:function(){return this._instanceFeatureIdLabel},set:function(e){typeof e=="number"&&(e=`instanceFeatureId_${e}`),A.typeOf.string("value",e),e!==this._instanceFeatureIdLabel&&(this._featureTableIdDirty=!0),this._instanceFeatureIdLabel=e}},clippingPlanes:{get:function(){return this._clippingPlanes},set:function(e){e!==this._clippingPlanes&&(Li.setOwner(e,this,"_clippingPlanes"),this.resetDrawCommands())}},clippingPolygons:{get:function(){return this._clippingPolygons},set:function(e){e!==this._clippingPolygons&&(Di.setOwner(e,this,"_clippingPolygons"),this.resetDrawCommands())}},lightColor:{get:function(){return this._lightColor},set:function(e){c(e)!==c(this._lightColor)&&this.resetDrawCommands(),this._lightColor=d.clone(e,this._lightColor)}},imageBasedLighting:{get:function(){return this._imageBasedLighting},set:function(e){A.typeOf.object("imageBasedLighting",this._imageBasedLighting),e!==this._imageBasedLighting&&(this._shouldDestroyImageBasedLighting&&!this._imageBasedLighting.isDestroyed()&&this._imageBasedLighting.destroy(),this._imageBasedLighting=e,this._shouldDestroyImageBasedLighting=!1,this.resetDrawCommands())}},backFaceCulling:{get:function(){return this._backFaceCulling},set:function(e){e!==this._backFaceCulling&&(this._backFaceCullingDirty=!0),this._backFaceCulling=e}},scale:{get:function(){return this._scale},set:function(e){e!==this._scale&&(this._updateModelMatrix=!0),this._scale=e}},computedScale:{get:function(){return this._computedScale}},minimumPixelSize:{get:function(){return this._minimumPixelSize},set:function(e){e!==this._minimumPixelSize&&(this._updateModelMatrix=!0),this._minimumPixelSize=e}},maximumScale:{get:function(){return this._maximumScale},set:function(e){e!==this._maximumScale&&(this._updateModelMatrix=!0),this._maximumScale=e}},shadows:{get:function(){return this._shadows},set:function(e){e!==this._shadows&&(this._shadowsDirty=!0),this._shadows=e}},credit:{get:function(){return this._credit}},showCreditsOnScreen:{get:function(){return this._showCreditsOnScreen},set:function(e){this._showCreditsOnScreen!==e&&(this._showCreditsOnScreenDirty=!0),this._showCreditsOnScreen=e}},splitDirection:{get:function(){return this._splitDirection},set:function(e){this._splitDirection!==e&&this.resetDrawCommands(),this._splitDirection=e}},classificationType:{get:function(){return this._classificationType}},pickIds:{get:function(){return this._pickIds}},styleCommandsNeeded:{get:function(){return this._styleCommandsNeeded}}});In.prototype.getNode=function(e){if(!this._ready)throw new E("The model is not loaded. Use Model.readyEvent or wait for Model.ready to be true.");return A.typeOf.string("name",e),this._nodesByName[e]};In.prototype.setArticulationStage=function(e,t){if(A.typeOf.number("value",t),!this._ready)throw new E("The model is not loaded. Use Model.readyEvent or wait for Model.ready to be true.");this._sceneGraph.setArticulationStage(e,t)};In.prototype.applyArticulations=function(){if(!this._ready)throw new E("The model is not loaded. Use Model.readyEvent or wait for Model.ready to be true.");this._sceneGraph.applyArticulations()};In.prototype.makeStyleDirty=function(){this._styleDirty=!0};In.prototype.resetDrawCommands=function(){this._drawCommandsBuilt=!1};const xAe=new L,CAe=new $,EAe=new L;In.prototype.update=function(e){let t=!1;try{t=wAe(this,e)}catch(n){if(!this._loader.incrementallyLoadTextures&&n.name==="TextureError")hS(this,n);else{const i=Lt.getError("model",this._resource,n);hS(this,i)}}if(SAe(this,e),vAe(this,e),!this._resourcesLoaded&&t){this._resourcesLoaded=!0;const n=this._loader.components;if(!c(n)){if(this._loader.isUnloaded())return;const r=Lt.getError("model",this._resource,new Te("Failed to load model."));hS(r),this._rejectLoad=this._rejectLoad&&this._rejectLoad(r)}const i=n.structuralMetadata;c(i)&&i.propertyTableCount>0&&TAe(this,i);const o=new Ha({model:this,modelComponents:n});this._sceneGraph=o,this._gltfCredits=o.components.asset.credits}if(!(!this._resourcesLoaded||e.mode===oe.MORPHING)){if(IAe(this),DAe(this),PAe(this,e),OAe(this),LAe(this,e),RAe(this,e),NAe(this,e),MAe(this,e),FAe(this,e),BAe(this,e),zAe(this,e),this._defaultTexture=e.context.defaultTexture,UAe(this,e),kAe(this,e),VAe(this),HAe(this,e),WAe(this,e),!this._ready){e.afterRender.push(()=>{this._ready=!0,this._readyEvent.raiseEvent(this)});return}this._loader.incrementallyLoadTextures&&!this._texturesLoaded&&this._loader.texturesLoaded&&(this.resetDrawCommands(),this._texturesLoaded=!0,this._texturesReadyEvent.raiseEvent(this)),jAe(this),qAe(this,e),YAe(this),$Ae(this,e)}};function wAe(e,t){return!e._resourcesLoaded||e._loader.incrementallyLoadTextures&&!e._texturesLoaded?(t.afterRender.push(()=>!0),e._loader.process(t)):!0}function SAe(e,t){c(e._customShader)&&e._customShader.update(t)}function vAe(e,t){e._imageBasedLighting.update(t),e._imageBasedLighting.shouldRegenerateShaders&&e.resetDrawCommands()}function IAe(e){if(!e._featureTableIdDirty)return;e._featureTableIdDirty=!1;const t=e._sceneGraph.components,n=t.structuralMetadata;c(n)&&n.propertyTableCount>0&&(e.featureTableId=AAe(t,e),e._styleDirty=!0,e.resetDrawCommands())}function DAe(e){e._styleDirty&&(e.applyStyle(e._style),e._styleDirty=!1)}function PAe(e,t){const n=e._featureTables,i=n.length;let o=!1;for(let r=0;r<i;r++)n[r].update(t),n[r].styleCommandsNeededDirty&&(o=!0);o&&k5(e)}function k5(e){const t=e.featureTables[e.featureTableId];e._styleCommandsNeeded=b0.getStyleCommandsNeeded(t.featuresLength,t.batchTexture.translucentFeaturesLength)}function OAe(e){const t=e.pointCloudShading;t.attenuation!==e._attenuation&&(e.resetDrawCommands(),e._attenuation=t.attenuation),t.backFaceCulling!==e._pointCloudBackFaceCulling&&(e.resetDrawCommands(),e._pointCloudBackFaceCulling=t.backFaceCulling)}function LAe(e,t){e._silhouetteDirty&&(H5(t)&&e.resetDrawCommands(),e._silhouetteDirty=!1)}function RAe(e,t){const n=e.hasSkipLevelOfDetail(t);n!==e._skipLevelOfDetail&&(e.resetDrawCommands(),e._skipLevelOfDetail=n)}function NAe(e,t){let n=0;e.isClippingEnabled()&&(e._clippingPlanes.owner===e&&e._clippingPlanes.update(t),n=e._clippingPlanes.clippingPlanesState),n!==e._clippingPlanesState&&(e.resetDrawCommands(),e._clippingPlanesState=n)}function MAe(e,t){let n=0;e.isClippingPolygonsEnabled()&&(e._clippingPolygons.owner===e&&(e._clippingPolygons.update(t),e._clippingPolygons.queueCommands(t)),n=e._clippingPolygons.clippingPolygonsState),n!==e._clippingPolygonsState&&(e.resetDrawCommands(),e._clippingPolygonsState=n)}function FAe(e,t){t.mode!==e._sceneMode&&(e._projectTo2D?e.resetDrawCommands():e._updateModelMatrix=!0,e._sceneMode=t.mode)}function BAe(e,t){const n=t.fog.enabled&&t.fog.renderable;n!==e._fogRenderable&&(e.resetDrawCommands(),e._fogRenderable=n)}function zAe(e,t){const n=t.verticalExaggeration!==1;e._verticalExaggerationOn!==n&&(e.resetDrawCommands(),e._verticalExaggerationOn=n)}function UAe(e,t){e._drawCommandsBuilt||(e.destroyPipelineResources(),e._sceneGraph.buildDrawCommands(t),e._drawCommandsBuilt=!0)}function kAe(e,t){if(!L.equals(e.modelMatrix,e._modelMatrix)){if(t.mode!==oe.SCENE3D&&e._projectTo2D)throw new E("Model.modelMatrix cannot be changed in 2D or Columbus View if projectTo2D is true.");e._updateModelMatrix=!0,e._modelMatrix=L.clone(e.modelMatrix,e._modelMatrix)}}const hh=new d,fS=new he;function VAe(e){if(!e._updateModelMatrix&&!e._heightDirty&&e._minimumPixelSize===0)return;c(e._removeUpdateHeightCallback)&&(e._removeUpdateHeightCallback(),e._removeUpdateHeightCallback=void 0);const t=e._scene;if(!c(t)||e.heightReference===gt.NONE){if(e.heightReference!==gt.NONE)throw new E("Height reference is not supported without a scene.");e._clampedModelMatrix=void 0;return}const n=t.globe,i=y(n==null?void 0:n.ellipsoid,ae.WGS84),o=e.modelMatrix;hh.x=o[12],hh.y=o[13],hh.z=o[14];const r=i.cartesianToCartographic(hh);c(e._clampedModelMatrix)||(e._clampedModelMatrix=L.clone(o,new L)),e._removeUpdateHeightCallback=t.updateHeight(r,bF(e,i,r),e.heightReference);const s=t.getHeight(r,e.heightReference);if(c(s)){const a=bF(e,i,r);he.clone(r,fS),fS.height=s,a(fS)}e._heightDirty=!1,e._updateModelMatrix=!0}function HAe(e,t){if(!e._updateModelMatrix&&e._minimumPixelSize===0)return;const n=c(e._clampedModelMatrix)?e._clampedModelMatrix:e.modelMatrix;V5(e,n),GAe(e,n,t)}function V5(e,t){e._clampedScale=c(e._maximumScale)?Math.min(e._scale,e._maximumScale):e._scale,e._boundingSphere.center=d.multiplyByScalar(e._sceneGraph.boundingSphere.center,e._clampedScale,e._boundingSphere.center),e._boundingSphere.radius=e._initialRadius*e._clampedScale,e._boundingSphere=se.transform(e._boundingSphere,t,e._boundingSphere)}function GAe(e,t,n){let i=e.scale;if(e.minimumPixelSize!==0&&!e._projectTo2D){const o=n.context,r=Math.max(o.drawingBufferWidth,o.drawingBufferHeight);L.getTranslation(t,hh),e._sceneMode!==oe.SCENE3D&&Ao.computeActualWgs84Position(n,hh,hh);const s=e._boundingSphere.radius,a=XAe(hh,s,n),l=1/a;Math.min(l*(2*s),r)<e.minimumPixelSize&&(i=e.minimumPixelSize*a/(2*e._initialRadius))}e._computedScale=c(e.maximumScale)?Math.min(e.maximumScale,i):i}function jAe(e){if(!e._idDirty)return;e._idDirty=!1;const t=e._id,n=e._pickIds,i=n.length;for(let o=0;o<i;++o)n[o].object.id=t}function WAe(e,t){const n=c(e._clampedModelMatrix)?e._clampedModelMatrix:e.modelMatrix,i=y(e.referenceMatrix,n),o=t.context,r=e._imageBasedLighting;if(r.useSphericalHarmonicCoefficients||r.useSpecularEnvironmentMaps){let s=CAe,a=xAe;a=L.multiply(o.uniformState.view3D,i,a),s=L.getMatrix3(a,s),s=$.getRotation(s,s),e._iblReferenceFrameMatrix=$.transpose(s,e._iblReferenceFrameMatrix)}if(e.isClippingEnabled()){let s=EAe;s=L.multiply(o.uniformState.view3D,i,s),s=L.multiply(s,e._clippingPlanes.modelMatrix,s),e._clippingPlanesMatrix=L.inverseTranspose(s,e._clippingPlanesMatrix)}}function qAe(e,t){const n=e._sceneGraph;if(e._updateModelMatrix||e._minimumPixelSize!==0){const o=c(e._clampedModelMatrix)?e._clampedModelMatrix:e.modelMatrix;n.updateModelMatrix(o,t),e._updateModelMatrix=!1}e._backFaceCullingDirty&&(n.updateBackFaceCulling(e._backFaceCulling),e._backFaceCullingDirty=!1),e._shadowsDirty&&(n.updateShadows(e._shadows),e._shadowsDirty=!1),e._debugShowBoundingVolumeDirty&&(n.updateShowBoundingVolume(e._debugShowBoundingVolume),e._debugShowBoundingVolumeDirty=!1);let i=!1;c(e.classificationType)||(i=e._userAnimationDirty||e._activeAnimations.update(t)),n.update(t,i),e._userAnimationDirty=!1}function YAe(e){if(!e._showCreditsOnScreenDirty)return;e._showCreditsOnScreenDirty=!1,e._credits.length=0;const t=e._showCreditsOnScreen;if(c(e._credit)){const s=Wt.clone(e._credit);s.showOnScreen=s.showOnScreen||t,e._credits.push(s)}const n=e._resourceCredits,i=n.length;for(let s=0;s<i;s++){const a=Wt.clone(n[s]);a.showOnScreen=a.showOnScreen||t,e._credits.push(a)}const o=e._gltfCredits,r=o.length;for(let s=0;s<r;s++){const a=Wt.clone(o[s]);a.showOnScreen=a.showOnScreen||t,e._credits.push(a)}}function $Ae(e,t){const n=KAe(e,t),i=e.isInvisible(),o=e.hasSilhouette(t),r=e._show&&e._computedScale!==0&&n&&(!i||o),s=t.passes,a=s.render||s.pick&&e.allowPicking;r&&!e._ignoreCommands&&a&&(ZAe(e,t),e._sceneGraph.pushDrawCommands(t))}const pS=new se;function XAe(e,t,n){return pS.center=e,pS.radius=t,n.camera.getPixelSize(pS,n.context.drawingBufferWidth,n.context.drawingBufferHeight)}const bT=new d;function bF(e,t,n){return function(i){zP(e.heightReference)&&(i.height+=n.height),t.cartographicToCartesian(i,bT);const o=e._clampedModelMatrix;L.clone(e.modelMatrix,o),o[12]=bT.x,o[13]=bT.y,o[14]=bT.z,e._heightDirty=!0}}const QAe=new d;function KAe(e,t){const n=e.distanceDisplayCondition;if(!c(n))return!0;const i=n.near*n.near,o=n.far*n.far;let r;if(t.mode===oe.SCENE2D){const a=(t.camera.frustum.right-t.camera.frustum.left)*.5;r=a*a}else{const s=L.getTranslation(e.modelMatrix,QAe);Ao.computeActualWgs84Position(t,s,s),r=d.distanceSquared(s,t.camera.positionWC)}return r>=i&&r<=o}function ZAe(e,t){const n=t.creditDisplay,i=e._credits,o=i.length;for(let r=0;r<o;r++)n.addCreditToNextFrame(i[r])}In.prototype.isTranslucent=function(){const e=this.color;return c(e)&&e.alpha>0&&e.alpha<1};In.prototype.isInvisible=function(){const e=this.color;return c(e)&&e.alpha===0};function H5(e){return e.context.stencilBuffer}In.prototype.hasSilhouette=function(e){return H5(e)&&this._silhouetteSize>0&&this._silhouetteColor.alpha>0&&!c(this._classificationType)};In.prototype.hasSkipLevelOfDetail=function(e){if(!bs.is3DTiles(this.type))return!1;const t=e.context.stencilBuffer,n=this._content.tileset;return t&&n.isSkippingLevelOfDetail};In.prototype.isClippingEnabled=function(){const e=this._clippingPlanes;return c(e)&&e.enabled&&e.length!==0};In.prototype.pick=function(e,t,n,i,o){return bAe(this,e,t,n,i,o)};In.prototype.isClippingPolygonsEnabled=function(){const e=this._clippingPolygons;return c(e)&&e.enabled&&e.length!==0};In.prototype.isDestroyed=function(){return!1};In.prototype.destroy=function(){const e=this._loader;c(e)&&e.destroy();const t=this._featureTables;if(c(t)){const o=t.length;for(let r=0;r<o;r++)t[r].destroy()}this.destroyPipelineResources(),this.destroyModelResources(),c(this._removeUpdateHeightCallback)&&(this._removeUpdateHeightCallback(),this._removeUpdateHeightCallback=void 0),c(this._terrainProviderChangedCallback)&&(this._terrainProviderChangedCallback(),this._terrainProviderChangedCallback=void 0);const n=this._clippingPlanes;c(n)&&!n.isDestroyed()&&n.owner===this&&n.destroy(),this._clippingPlanes=void 0;const i=this._clippingPolygons;c(i)&&!i.isDestroyed()&&i.owner===this&&i.destroy(),this._clippingPolygons=void 0,this._shouldDestroyImageBasedLighting&&!this._imageBasedLighting.isDestroyed()&&this._imageBasedLighting.destroy(),this._imageBasedLighting=void 0,ve(this)};In.prototype.destroyPipelineResources=function(){const e=this._pipelineResources;for(let t=0;t<e.length;t++)e[t].destroy();this._pipelineResources.length=0,this._pickIds.length=0};In.prototype.destroyModelResources=function(){const e=this._modelResources;for(let t=0;t<e.length;t++)e[t].destroy();this._modelResources.length=0};In.fromGltfAsync=async function(e){if(e=y(e,y.EMPTY_OBJECT),!c(e.url)&&!c(e.gltf))throw new E("options.url is required.");const t=y(e.url,e.gltf),n={releaseGltfJson:e.releaseGltfJson,asynchronous:e.asynchronous,incrementallyLoadTextures:e.incrementallyLoadTextures,upAxis:e.upAxis,forwardAxis:e.forwardAxis,loadAttributesFor2D:e.projectTo2D,enablePick:e.enablePick,loadIndicesForWireframe:e.enableDebugWireframe,loadPrimitiveOutline:e.enableShowOutline,loadForClassification:c(e.classificationType)},i=y(e.basePath,""),o=Ae.createIfNeeded(i);c(t.asset)?(n.gltfJson=t,n.baseResource=o,n.gltfResource=o):t instanceof Uint8Array?(n.typedArray=t,n.baseResource=o,n.gltfResource=o):n.gltfResource=Ae.createIfNeeded(t);const r=new wa(n),a=c(e.content)?bs.TILE_GLTF:bs.GLTF,l=n.gltfResource,u=Y0(r,a,e);u.resource=l;try{await r.load()}catch(g){throw r.destroy(),Lt.getError("model",l,g)}const h=e.gltfCallback;c(h)&&(A.typeOf.func("options.gltfCallback",h),h(r.gltfJson));const f=new In(u),_=f._resource.credits;if(c(_)){const g=_.length;for(let m=0;m<g;m++)f._resourceCredits.push(Wt.clone(_[m]))}return f};In.fromB3dm=async function(e){const t={b3dmResource:e.resource,arrayBuffer:e.arrayBuffer,byteOffset:e.byteOffset,releaseGltfJson:e.releaseGltfJson,asynchronous:e.asynchronous,incrementallyLoadTextures:e.incrementallyLoadTextures,upAxis:e.upAxis,forwardAxis:e.forwardAxis,loadAttributesFor2D:e.projectTo2D,enablePick:e.enablePick,loadIndicesForWireframe:e.enableDebugWireframe,loadPrimitiveOutline:e.enableShowOutline,loadForClassification:c(e.classificationType)},n=new xh(t);try{await n.load();const i=Y0(n,bs.TILE_B3DM,e);return new In(i)}catch(i){throw n.destroy(),i}};In.fromPnts=async function(e){const t={arrayBuffer:e.arrayBuffer,byteOffset:e.byteOffset,loadAttributesFor2D:e.projectTo2D},n=new wh(t);try{await n.load();const i=Y0(n,bs.TILE_PNTS,e);return new In(i)}catch(i){throw n.destroy(),i}};In.fromI3dm=async function(e){const t={i3dmResource:e.resource,arrayBuffer:e.arrayBuffer,byteOffset:e.byteOffset,releaseGltfJson:e.releaseGltfJson,asynchronous:e.asynchronous,incrementallyLoadTextures:e.incrementallyLoadTextures,upAxis:e.upAxis,forwardAxis:e.forwardAxis,loadAttributesFor2D:e.projectTo2D,enablePick:e.enablePick,loadIndicesForWireframe:e.enableDebugWireframe,loadPrimitiveOutline:e.enableShowOutline},n=new od(t);try{await n.load();const i=Y0(n,bs.TILE_I3DM,e);return new In(i)}catch(i){throw n.destroy(),i}};In.fromGeoJson=async function(e){const t={geoJson:e.geoJson},n=new Ch(t),i=Y0(n,bs.TILE_GEOJSON,e);return new In(i)};const JAe=new z;In.prototype.applyColorAndShow=function(e){const t=z.clone(this._color,JAe),n=c(e)&&c(e.color),i=c(e)&&c(e.show);this._color=n?e.color.evaluateColor(void 0,this._color):z.clone(z.WHITE,this._color),this._show=i?e.show.evaluate(void 0):!0,aD(t,this._color)&&this.resetDrawCommands()};In.prototype.applyStyle=function(e){const t=this.type===bs.TILE_PNTS,n=c(this.featureTableId)&&this.featureTables[this.featureTableId].featuresLength>0,i=c(this.structuralMetadata)?this.structuralMetadata.propertyAttributes:void 0,o=c(i)&&c(i[0]);if(t&&(!n||o)){this.resetDrawCommands();return}n?(this.featureTables[this.featureTableId].applyStyle(e),k5(this)):(this.applyColorAndShow(e),this._styleCommandsNeeded=void 0)};function Y0(e,t,n){return{loader:e,type:t,resource:n.resource,show:n.show,modelMatrix:n.modelMatrix,scale:n.scale,minimumPixelSize:n.minimumPixelSize,maximumScale:n.maximumScale,id:n.id,allowPicking:n.allowPicking,clampAnimations:n.clampAnimations,shadows:n.shadows,debugShowBoundingVolume:n.debugShowBoundingVolume,enableDebugWireframe:n.enableDebugWireframe,debugWireframe:n.debugWireframe,cull:n.cull,opaquePass:n.opaquePass,customShader:n.customShader,content:n.content,heightReference:n.heightReference,scene:n.scene,distanceDisplayCondition:n.distanceDisplayCondition,color:n.color,colorBlendAmount:n.colorBlendAmount,colorBlendMode:n.colorBlendMode,silhouetteColor:n.silhouetteColor,silhouetteSize:n.silhouetteSize,enableShowOutline:n.enableShowOutline,showOutline:n.showOutline,outlineColor:n.outlineColor,clippingPlanes:n.clippingPlanes,clippingPolygons:n.clippingPolygons,lightColor:n.lightColor,imageBasedLighting:n.imageBasedLighting,backFaceCulling:n.backFaceCulling,credit:n.credit,showCreditsOnScreen:n.showCreditsOnScreen,splitDirection:n.splitDirection,projectTo2D:n.projectTo2D,enablePick:n.enablePick,featureIdLabel:n.featureIdLabel,instanceFeatureIdLabel:n.instanceFeatureIdLabel,pointCloudShading:n.pointCloudShading,classificationType:n.classificationType,pickObject:n.pickObject}}function zi(e,t,n){this._tileset=e,this._tile=t,this._resource=n,this._model=void 0,this._metadata=void 0,this._group=void 0,this._ready=!1}Object.defineProperties(zi.prototype,{featuresLength:{get:function(){const e=this._model,t=e.featureTables,n=e.featureTableId;return c(t)&&c(t[n])?t[n].featuresLength:0}},pointsLength:{get:function(){return this._model.statistics.pointsLength}},trianglesLength:{get:function(){return this._model.statistics.trianglesLength}},geometryByteLength:{get:function(){return this._model.statistics.geometryByteLength}},texturesByteLength:{get:function(){return this._model.statistics.texturesByteLength}},batchTableByteLength:{get:function(){const e=this._model.statistics;return e.propertyTablesByteLength+e.batchTexturesByteLength}},innerContents:{get:function(){}},ready:{get:function(){return this._ready}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._resource.getUrlComponent(!0)}},batchTable:{get:function(){const e=this._model,t=e.featureTables,n=e.featureTableId;if(c(t)&&c(t[n]))return t[n]}},metadata:{get:function(){return this._metadata},set:function(e){this._metadata=e}},group:{get:function(){return this._group},set:function(e){this._group=e}}});zi.prototype.getFeature=function(e){const t=this._model,n=t.featureTableId;if(!c(n))throw new E("No feature ID set is selected. Make sure Cesium3DTileset.featureIdLabel or Cesium3DTileset.instanceFeatureIdLabel is defined");const i=t.featureTables[n];if(!c(i))throw new E("No feature table found for the selected feature ID set");const o=i.featuresLength;if(!c(e)||e<0||e>=o)throw new E(`featureId is required and must be between 0 and featuresLength - 1 (${o-1}).`);return i.getFeature(e)};zi.prototype.hasProperty=function(e,t){const n=this._model,i=n.featureTableId;return c(i)?n.featureTables[i].hasProperty(e,t):!1};zi.prototype.applyDebugSettings=function(e,t){t=e?t:z.WHITE,this.featuresLength===0?this._model.color=t:c(this.batchTable)&&this.batchTable.setAllColor(t)};zi.prototype.applyStyle=function(e){this._model.style=e};zi.prototype.update=function(e,t){const n=this._model,i=this._tile;n.colorBlendAmount=e.colorBlendAmount,n.colorBlendMode=e.colorBlendMode,n.modelMatrix=i.computedTransform,n.customShader=e.customShader,n.featureIdLabel=e.featureIdLabel,n.instanceFeatureIdLabel=e.instanceFeatureIdLabel,n.lightColor=e.lightColor,n.imageBasedLighting=e.imageBasedLighting,n.backFaceCulling=e.backFaceCulling,n.shadows=e.shadows,n.showCreditsOnScreen=e.showCreditsOnScreen,n.splitDirection=e.splitDirection,n.debugWireframe=e.debugWireframe,n.showOutline=e.showOutline,n.outlineColor=e.outlineColor,n.pointCloudShading=e.pointCloudShading;const o=e.clippingPlanes;n.referenceMatrix=e.clippingPlanesOriginMatrix,c(o)&&i.clippingPlanesDirty&&(n._clippingPlanes=o.enabled&&i._isClipped?o:void 0),c(o)&&c(n._clippingPlanes)&&n._clippingPlanes!==o&&(n._clippingPlanes=o,n._clippingPlanesState=0);const r=e.clippingPolygons;c(r)&&i.clippingPolygonsDirty&&(n._clippingPolygons=r.enabled&&i._isClippedByPolygon?r:void 0),c(r)&&c(n._clippingPolygons)&&n._clippingPolygons!==r&&(n._clippingPolygons=r,n._clippingPolygonsState=0),n.update(t),!this._ready&&n.ready&&(n.activeAnimations.addAll({loop:Wf.REPEAT}),this._ready=!0)};zi.prototype.isDestroyed=function(){return!1};zi.prototype.destroy=function(){return this._model=this._model&&this._model.destroy(),ve(this)};zi.fromGltf=async function(e,t,n,i){const o=new zi(e,t,n),s=$0(e,t,o,{gltf:i,basePath:n}),a=e.vectorClassificationOnly?void 0:e.classificationType;s.classificationType=a;const l=await In.fromGltfAsync(s);return o._model=l,o};zi.fromB3dm=async function(e,t,n,i,o){const r=new zi(e,t,n),a=$0(e,t,r,{arrayBuffer:i,byteOffset:o,resource:n}),l=e.vectorClassificationOnly?void 0:e.classificationType;a.classificationType=l;const u=await In.fromB3dm(a);return r._model=u,r};zi.fromI3dm=async function(e,t,n,i,o){const r=new zi(e,t,n),a=$0(e,t,r,{arrayBuffer:i,byteOffset:o,resource:n}),l=await In.fromI3dm(a);return r._model=l,r};zi.fromPnts=async function(e,t,n,i,o){const r=new zi(e,t,n),a=$0(e,t,r,{arrayBuffer:i,byteOffset:o,resource:n}),l=await In.fromPnts(a);return r._model=l,r};zi.fromGeoJson=async function(e,t,n,i){const o=new zi(e,t,n),s=$0(e,t,o,{geoJson:i,resource:n}),a=await In.fromGeoJson(s);return o._model=a,o};zi.prototype.pick=function(e,t,n){if(!c(this._model)||!this._ready)return;const i=t.verticalExaggeration,o=t.verticalExaggerationRelativeHeight;return this._model.pick(e,t,i,o,ae.WGS84,n)};function $0(e,t,n,i){const o={cull:!1,releaseGltfJson:!0,opaquePass:xe.CESIUM_3D_TILE,modelMatrix:t.computedTransform,upAxis:e._modelUpAxis,forwardAxis:e._modelForwardAxis,incrementallyLoadTextures:!1,customShader:e.customShader,content:n,colorBlendMode:e.colorBlendMode,colorBlendAmount:e.colorBlendAmount,lightColor:e.lightColor,imageBasedLighting:e.imageBasedLighting,featureIdLabel:e.featureIdLabel,instanceFeatureIdLabel:e.instanceFeatureIdLabel,pointCloudShading:e.pointCloudShading,clippingPlanes:e.clippingPlanes,backFaceCulling:e.backFaceCulling,shadows:e.shadows,showCreditsOnScreen:e.showCreditsOnScreen,splitDirection:e.splitDirection,enableDebugWireframe:e._enableDebugWireframe,debugWireframe:e.debugWireframe,projectTo2D:e._projectTo2D,enablePick:e._enablePick,enableShowOutline:e._enableShowOutline,showOutline:e.showOutline,outlineColor:e.outlineColor};return jt(i,o)}function Dc(e,t,n){this._tileset=e,this._tile=t,this._resource=n,this.featurePropertiesDirty=!1,this._metadata=void 0,this._group=void 0,this._ready=!1}Object.defineProperties(Dc.prototype,{featuresLength:{get:function(){return 0}},pointsLength:{get:function(){return 0}},trianglesLength:{get:function(){return 0}},geometryByteLength:{get:function(){return 0}},texturesByteLength:{get:function(){return 0}},batchTableByteLength:{get:function(){return 0}},innerContents:{get:function(){}},ready:{get:function(){return this._ready}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._resource.getUrlComponent(!0)}},batchTable:{get:function(){}},metadata:{get:function(){return this._metadata},set:function(e){this._metadata=e}},group:{get:function(){return this._group},set:function(e){this._group=e}}});Dc.fromJson=function(e,t,n,i){const o=new Dc(e,t,n);return o._tileset.loadTileset(o._resource,i,o._tile),o._ready=!0,o};Dc.prototype.hasProperty=function(e,t){return!1};Dc.prototype.getFeature=function(e){};Dc.prototype.applyDebugSettings=function(e,t){};Dc.prototype.applyStyle=function(e){};Dc.prototype.update=function(e,t){};Dc.prototype.pick=function(e,t,n){};Dc.prototype.isDestroyed=function(){return!1};Dc.prototype.destroy=function(){return ve(this)};const exe=`uniform sampler2D u_atlas;
|
|
|
|
#ifdef VECTOR_TILE
|
|
uniform vec4 u_highlightColor;
|
|
#endif
|
|
|
|
in vec2 v_textureCoordinates;
|
|
in vec4 v_pickColor;
|
|
in vec4 v_color;
|
|
|
|
#ifdef SDF
|
|
in vec4 v_outlineColor;
|
|
in float v_outlineWidth;
|
|
#endif
|
|
|
|
#ifdef FRAGMENT_DEPTH_CHECK
|
|
in vec4 v_textureCoordinateBounds; // the min and max x and y values for the texture coordinates
|
|
in vec4 v_originTextureCoordinateAndTranslate; // texture coordinate at the origin, billboard translate (used for label glyphs)
|
|
in vec4 v_compressed; // x: eyeDepth, y: applyTranslate & enableDepthCheck, z: dimensions, w: imageSize
|
|
in mat2 v_rotationMatrix;
|
|
|
|
const float SHIFT_LEFT12 = 4096.0;
|
|
const float SHIFT_LEFT1 = 2.0;
|
|
|
|
const float SHIFT_RIGHT12 = 1.0 / 4096.0;
|
|
const float SHIFT_RIGHT1 = 1.0 / 2.0;
|
|
|
|
float getGlobeDepth(vec2 adjustedST, vec2 depthLookupST, bool applyTranslate, vec2 dimensions, vec2 imageSize)
|
|
{
|
|
vec2 lookupVector = imageSize * (depthLookupST - adjustedST);
|
|
lookupVector = v_rotationMatrix * lookupVector;
|
|
vec2 labelOffset = (dimensions - imageSize) * (depthLookupST - vec2(0.0, v_originTextureCoordinateAndTranslate.y)); // aligns label glyph with bounding rectangle. Will be zero for billboards because dimensions and imageSize will be equal
|
|
|
|
vec2 translation = v_originTextureCoordinateAndTranslate.zw;
|
|
|
|
if (applyTranslate)
|
|
{
|
|
// this is only needed for labels where the horizontal origin is not LEFT
|
|
// it moves the label back to where the "origin" should be since all label glyphs are set to HorizontalOrigin.LEFT
|
|
translation += (dimensions * v_originTextureCoordinateAndTranslate.xy * vec2(1.0, 0.0));
|
|
}
|
|
|
|
vec2 st = ((lookupVector - translation + labelOffset) + gl_FragCoord.xy) / czm_viewport.zw;
|
|
float logDepthOrDepth = czm_unpackDepth(texture(czm_globeDepthTexture, st));
|
|
|
|
if (logDepthOrDepth == 0.0)
|
|
{
|
|
return 0.0; // not on the globe
|
|
}
|
|
|
|
vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth);
|
|
return eyeCoordinate.z / eyeCoordinate.w;
|
|
}
|
|
#endif
|
|
|
|
|
|
#ifdef SDF
|
|
|
|
// Get the distance from the edge of a glyph at a given position sampling an SDF texture.
|
|
float getDistance(vec2 position)
|
|
{
|
|
return texture(u_atlas, position).r;
|
|
}
|
|
|
|
// Samples the sdf texture at the given position and produces a color based on the fill color and the outline.
|
|
vec4 getSDFColor(vec2 position, float outlineWidth, vec4 outlineColor, float smoothing)
|
|
{
|
|
float distance = getDistance(position);
|
|
|
|
if (outlineWidth > 0.0)
|
|
{
|
|
// Don't get the outline edge exceed the SDF_EDGE
|
|
float outlineEdge = clamp(SDF_EDGE - outlineWidth, 0.0, SDF_EDGE);
|
|
float outlineFactor = smoothstep(SDF_EDGE - smoothing, SDF_EDGE + smoothing, distance);
|
|
vec4 sdfColor = mix(outlineColor, v_color, outlineFactor);
|
|
float alpha = smoothstep(outlineEdge - smoothing, outlineEdge + smoothing, distance);
|
|
return vec4(sdfColor.rgb, sdfColor.a * alpha);
|
|
}
|
|
else
|
|
{
|
|
float alpha = smoothstep(SDF_EDGE - smoothing, SDF_EDGE + smoothing, distance);
|
|
return vec4(v_color.rgb, v_color.a * alpha);
|
|
}
|
|
}
|
|
#endif
|
|
|
|
void main()
|
|
{
|
|
vec4 color = texture(u_atlas, v_textureCoordinates);
|
|
|
|
#ifdef SDF
|
|
float outlineWidth = v_outlineWidth;
|
|
vec4 outlineColor = v_outlineColor;
|
|
|
|
// Get the current distance
|
|
float distance = getDistance(v_textureCoordinates);
|
|
|
|
#if (__VERSION__ == 300 || defined(GL_OES_standard_derivatives))
|
|
float smoothing = fwidth(distance);
|
|
// Get an offset that is approximately half the distance to the neighbor pixels
|
|
// 0.354 is approximately half of 1/sqrt(2)
|
|
vec2 sampleOffset = 0.354 * vec2(dFdx(v_textureCoordinates) + dFdy(v_textureCoordinates));
|
|
|
|
// Sample the center point
|
|
vec4 center = getSDFColor(v_textureCoordinates, outlineWidth, outlineColor, smoothing);
|
|
|
|
// Sample the 4 neighbors
|
|
vec4 color1 = getSDFColor(v_textureCoordinates + vec2(sampleOffset.x, sampleOffset.y), outlineWidth, outlineColor, smoothing);
|
|
vec4 color2 = getSDFColor(v_textureCoordinates + vec2(-sampleOffset.x, sampleOffset.y), outlineWidth, outlineColor, smoothing);
|
|
vec4 color3 = getSDFColor(v_textureCoordinates + vec2(-sampleOffset.x, -sampleOffset.y), outlineWidth, outlineColor, smoothing);
|
|
vec4 color4 = getSDFColor(v_textureCoordinates + vec2(sampleOffset.x, -sampleOffset.y), outlineWidth, outlineColor, smoothing);
|
|
|
|
// Equally weight the center sample and the 4 neighboring samples
|
|
color = (center + color1 + color2 + color3 + color4)/5.0;
|
|
#else
|
|
// If no derivatives available (IE 10?), just do a single sample
|
|
float smoothing = 1.0/32.0;
|
|
color = getSDFColor(v_textureCoordinates, outlineWidth, outlineColor, smoothing);
|
|
#endif
|
|
|
|
color = czm_gammaCorrect(color);
|
|
#else
|
|
color = czm_gammaCorrect(color);
|
|
color *= czm_gammaCorrect(v_color);
|
|
#endif
|
|
|
|
// Fully transparent parts of the billboard are not pickable.
|
|
#if !defined(OPAQUE) && !defined(TRANSLUCENT)
|
|
if (color.a < 0.005) // matches 0/255 and 1/255
|
|
{
|
|
discard;
|
|
}
|
|
#else
|
|
// The billboard is rendered twice. The opaque pass discards translucent fragments
|
|
// and the translucent pass discards opaque fragments.
|
|
#ifdef OPAQUE
|
|
if (color.a < 0.995) // matches < 254/255
|
|
{
|
|
discard;
|
|
}
|
|
#else
|
|
if (color.a >= 0.995) // matches 254/255 and 255/255
|
|
{
|
|
discard;
|
|
}
|
|
#endif
|
|
#endif
|
|
|
|
#ifdef VECTOR_TILE
|
|
color *= u_highlightColor;
|
|
#endif
|
|
out_FragColor = color;
|
|
|
|
#ifdef LOG_DEPTH
|
|
czm_writeLogDepth();
|
|
#endif
|
|
|
|
#ifdef FRAGMENT_DEPTH_CHECK
|
|
float temp = v_compressed.y;
|
|
|
|
temp = temp * SHIFT_RIGHT1;
|
|
|
|
float temp2 = (temp - floor(temp)) * SHIFT_LEFT1;
|
|
bool enableDepthTest = temp2 != 0.0;
|
|
bool applyTranslate = floor(temp) != 0.0;
|
|
|
|
if (enableDepthTest) {
|
|
temp = v_compressed.z;
|
|
temp = temp * SHIFT_RIGHT12;
|
|
|
|
vec2 dimensions;
|
|
dimensions.y = (temp - floor(temp)) * SHIFT_LEFT12;
|
|
dimensions.x = floor(temp);
|
|
|
|
temp = v_compressed.w;
|
|
temp = temp * SHIFT_RIGHT12;
|
|
|
|
vec2 imageSize;
|
|
imageSize.y = (temp - floor(temp)) * SHIFT_LEFT12;
|
|
imageSize.x = floor(temp);
|
|
|
|
vec2 adjustedST = v_textureCoordinates - v_textureCoordinateBounds.xy;
|
|
adjustedST = adjustedST / vec2(v_textureCoordinateBounds.z - v_textureCoordinateBounds.x, v_textureCoordinateBounds.w - v_textureCoordinateBounds.y);
|
|
|
|
float epsilonEyeDepth = v_compressed.x + czm_epsilon1;
|
|
float globeDepth1 = getGlobeDepth(adjustedST, v_originTextureCoordinateAndTranslate.xy, applyTranslate, dimensions, imageSize);
|
|
|
|
// negative values go into the screen
|
|
if (globeDepth1 != 0.0 && globeDepth1 > epsilonEyeDepth)
|
|
{
|
|
float globeDepth2 = getGlobeDepth(adjustedST, vec2(0.0, 1.0), applyTranslate, dimensions, imageSize); // top left corner
|
|
if (globeDepth2 != 0.0 && globeDepth2 > epsilonEyeDepth)
|
|
{
|
|
float globeDepth3 = getGlobeDepth(adjustedST, vec2(1.0, 1.0), applyTranslate, dimensions, imageSize); // top right corner
|
|
if (globeDepth3 != 0.0 && globeDepth3 > epsilonEyeDepth)
|
|
{
|
|
discard;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
#endif
|
|
|
|
}
|
|
`,txe=`#ifdef INSTANCED
|
|
in vec2 direction;
|
|
#endif
|
|
in vec4 positionHighAndScale;
|
|
in vec4 positionLowAndRotation;
|
|
in vec4 compressedAttribute0; // pixel offset, translate, horizontal origin, vertical origin, show, direction, texture coordinates (texture offset)
|
|
in vec4 compressedAttribute1; // aligned axis, translucency by distance, image width
|
|
in vec4 compressedAttribute2; // label horizontal origin, image height, color, pick color, size in meters, valid aligned axis, 13 bits free
|
|
in vec4 eyeOffset; // eye offset in meters, 4 bytes free (texture range)
|
|
in vec4 scaleByDistance; // near, nearScale, far, farScale
|
|
in vec4 pixelOffsetScaleByDistance; // near, nearScale, far, farScale
|
|
in vec4 compressedAttribute3; // distance display condition near, far, disableDepthTestDistance, dimensions
|
|
in vec2 sdf; // sdf outline color (rgb) and width (w)
|
|
#if defined(VERTEX_DEPTH_CHECK) || defined(FRAGMENT_DEPTH_CHECK)
|
|
in vec4 textureCoordinateBoundsOrLabelTranslate; // the min and max x and y values for the texture coordinates
|
|
#endif
|
|
#ifdef VECTOR_TILE
|
|
in float a_batchId;
|
|
#endif
|
|
|
|
out vec2 v_textureCoordinates;
|
|
#ifdef FRAGMENT_DEPTH_CHECK
|
|
out vec4 v_textureCoordinateBounds;
|
|
out vec4 v_originTextureCoordinateAndTranslate;
|
|
out vec4 v_compressed; // x: eyeDepth, y: applyTranslate & enableDepthCheck, z: dimensions, w: imageSize
|
|
out mat2 v_rotationMatrix;
|
|
#endif
|
|
|
|
out vec4 v_pickColor;
|
|
out vec4 v_color;
|
|
#ifdef SDF
|
|
out vec4 v_outlineColor;
|
|
out float v_outlineWidth;
|
|
#endif
|
|
|
|
const float UPPER_BOUND = 32768.0;
|
|
|
|
const float SHIFT_LEFT16 = 65536.0;
|
|
const float SHIFT_LEFT12 = 4096.0;
|
|
const float SHIFT_LEFT8 = 256.0;
|
|
const float SHIFT_LEFT7 = 128.0;
|
|
const float SHIFT_LEFT5 = 32.0;
|
|
const float SHIFT_LEFT3 = 8.0;
|
|
const float SHIFT_LEFT2 = 4.0;
|
|
const float SHIFT_LEFT1 = 2.0;
|
|
|
|
const float SHIFT_RIGHT12 = 1.0 / 4096.0;
|
|
const float SHIFT_RIGHT8 = 1.0 / 256.0;
|
|
const float SHIFT_RIGHT7 = 1.0 / 128.0;
|
|
const float SHIFT_RIGHT5 = 1.0 / 32.0;
|
|
const float SHIFT_RIGHT3 = 1.0 / 8.0;
|
|
const float SHIFT_RIGHT2 = 1.0 / 4.0;
|
|
const float SHIFT_RIGHT1 = 1.0 / 2.0;
|
|
|
|
vec4 addScreenSpaceOffset(vec4 positionEC, vec2 imageSize, float scale, vec2 direction, vec2 origin, vec2 translate, vec2 pixelOffset, vec3 alignedAxis, bool validAlignedAxis, float rotation, bool sizeInMeters, out mat2 rotationMatrix, out float mpp)
|
|
{
|
|
// Note the halfSize cannot be computed in JavaScript because it is sent via
|
|
// compressed vertex attributes that coerce it to an integer.
|
|
vec2 halfSize = imageSize * scale * 0.5;
|
|
halfSize *= ((direction * 2.0) - 1.0);
|
|
|
|
vec2 originTranslate = origin * abs(halfSize);
|
|
|
|
#if defined(ROTATION) || defined(ALIGNED_AXIS)
|
|
if (validAlignedAxis || rotation != 0.0)
|
|
{
|
|
float angle = rotation;
|
|
if (validAlignedAxis)
|
|
{
|
|
vec4 projectedAlignedAxis = czm_modelView3D * vec4(alignedAxis, 0.0);
|
|
angle += sign(-projectedAlignedAxis.x) * acos(sign(projectedAlignedAxis.y) * (projectedAlignedAxis.y * projectedAlignedAxis.y) /
|
|
(projectedAlignedAxis.x * projectedAlignedAxis.x + projectedAlignedAxis.y * projectedAlignedAxis.y));
|
|
}
|
|
|
|
float cosTheta = cos(angle);
|
|
float sinTheta = sin(angle);
|
|
rotationMatrix = mat2(cosTheta, sinTheta, -sinTheta, cosTheta);
|
|
halfSize = rotationMatrix * halfSize;
|
|
}
|
|
else
|
|
{
|
|
rotationMatrix = mat2(1.0, 0.0, 0.0, 1.0);
|
|
}
|
|
#endif
|
|
|
|
mpp = czm_metersPerPixel(positionEC);
|
|
positionEC.xy += (originTranslate + halfSize) * czm_branchFreeTernary(sizeInMeters, 1.0, mpp);
|
|
positionEC.xy += (translate + pixelOffset) * mpp;
|
|
|
|
return positionEC;
|
|
}
|
|
|
|
#ifdef VERTEX_DEPTH_CHECK
|
|
float getGlobeDepth(vec4 positionEC)
|
|
{
|
|
vec4 posWC = czm_eyeToWindowCoordinates(positionEC);
|
|
|
|
float globeDepth = czm_unpackDepth(texture(czm_globeDepthTexture, posWC.xy / czm_viewport.zw));
|
|
|
|
if (globeDepth == 0.0)
|
|
{
|
|
return 0.0; // not on the globe
|
|
}
|
|
|
|
vec4 eyeCoordinate = czm_windowToEyeCoordinates(posWC.xy, globeDepth);
|
|
return eyeCoordinate.z / eyeCoordinate.w;
|
|
}
|
|
#endif
|
|
void main()
|
|
{
|
|
// Modifying this shader may also require modifications to Billboard._computeScreenSpacePosition
|
|
|
|
// unpack attributes
|
|
vec3 positionHigh = positionHighAndScale.xyz;
|
|
vec3 positionLow = positionLowAndRotation.xyz;
|
|
float scale = positionHighAndScale.w;
|
|
|
|
#if defined(ROTATION) || defined(ALIGNED_AXIS)
|
|
float rotation = positionLowAndRotation.w;
|
|
#else
|
|
float rotation = 0.0;
|
|
#endif
|
|
|
|
float compressed = compressedAttribute0.x;
|
|
|
|
vec2 pixelOffset;
|
|
pixelOffset.x = floor(compressed * SHIFT_RIGHT7);
|
|
compressed -= pixelOffset.x * SHIFT_LEFT7;
|
|
pixelOffset.x -= UPPER_BOUND;
|
|
|
|
vec2 origin;
|
|
origin.x = floor(compressed * SHIFT_RIGHT5);
|
|
compressed -= origin.x * SHIFT_LEFT5;
|
|
|
|
origin.y = floor(compressed * SHIFT_RIGHT3);
|
|
compressed -= origin.y * SHIFT_LEFT3;
|
|
|
|
#ifdef FRAGMENT_DEPTH_CHECK
|
|
vec2 depthOrigin = origin.xy;
|
|
#endif
|
|
origin -= vec2(1.0);
|
|
|
|
float show = floor(compressed * SHIFT_RIGHT2);
|
|
compressed -= show * SHIFT_LEFT2;
|
|
|
|
#ifdef INSTANCED
|
|
vec2 textureCoordinatesBottomLeft = czm_decompressTextureCoordinates(compressedAttribute0.w);
|
|
vec2 textureCoordinatesRange = czm_decompressTextureCoordinates(eyeOffset.w);
|
|
vec2 textureCoordinates = textureCoordinatesBottomLeft + direction * textureCoordinatesRange;
|
|
#else
|
|
vec2 direction;
|
|
direction.x = floor(compressed * SHIFT_RIGHT1);
|
|
direction.y = compressed - direction.x * SHIFT_LEFT1;
|
|
|
|
vec2 textureCoordinates = czm_decompressTextureCoordinates(compressedAttribute0.w);
|
|
#endif
|
|
|
|
float temp = compressedAttribute0.y * SHIFT_RIGHT8;
|
|
pixelOffset.y = -(floor(temp) - UPPER_BOUND);
|
|
|
|
vec2 translate;
|
|
translate.y = (temp - floor(temp)) * SHIFT_LEFT16;
|
|
|
|
temp = compressedAttribute0.z * SHIFT_RIGHT8;
|
|
translate.x = floor(temp) - UPPER_BOUND;
|
|
|
|
translate.y += (temp - floor(temp)) * SHIFT_LEFT8;
|
|
translate.y -= UPPER_BOUND;
|
|
|
|
temp = compressedAttribute1.x * SHIFT_RIGHT8;
|
|
float temp2 = floor(compressedAttribute2.w * SHIFT_RIGHT2);
|
|
|
|
vec2 imageSize = vec2(floor(temp), temp2);
|
|
|
|
#ifdef FRAGMENT_DEPTH_CHECK
|
|
float labelHorizontalOrigin = floor(compressedAttribute2.w - (temp2 * SHIFT_LEFT2));
|
|
float applyTranslate = 0.0;
|
|
if (labelHorizontalOrigin != 0.0) // is a billboard, so set apply translate to false
|
|
{
|
|
applyTranslate = 1.0;
|
|
labelHorizontalOrigin -= 2.0;
|
|
depthOrigin.x = labelHorizontalOrigin + 1.0;
|
|
}
|
|
|
|
depthOrigin = vec2(1.0) - (depthOrigin * 0.5);
|
|
#endif
|
|
|
|
#ifdef EYE_DISTANCE_TRANSLUCENCY
|
|
vec4 translucencyByDistance;
|
|
translucencyByDistance.x = compressedAttribute1.z;
|
|
translucencyByDistance.z = compressedAttribute1.w;
|
|
|
|
translucencyByDistance.y = ((temp - floor(temp)) * SHIFT_LEFT8) / 255.0;
|
|
|
|
temp = compressedAttribute1.y * SHIFT_RIGHT8;
|
|
translucencyByDistance.w = ((temp - floor(temp)) * SHIFT_LEFT8) / 255.0;
|
|
#endif
|
|
|
|
#if defined(VERTEX_DEPTH_CHECK) || defined(FRAGMENT_DEPTH_CHECK)
|
|
temp = compressedAttribute3.w;
|
|
temp = temp * SHIFT_RIGHT12;
|
|
|
|
vec2 dimensions;
|
|
dimensions.y = (temp - floor(temp)) * SHIFT_LEFT12;
|
|
dimensions.x = floor(temp);
|
|
#endif
|
|
|
|
#ifdef ALIGNED_AXIS
|
|
vec3 alignedAxis = czm_octDecode(floor(compressedAttribute1.y * SHIFT_RIGHT8));
|
|
temp = compressedAttribute2.z * SHIFT_RIGHT5;
|
|
bool validAlignedAxis = (temp - floor(temp)) * SHIFT_LEFT1 > 0.0;
|
|
#else
|
|
vec3 alignedAxis = vec3(0.0);
|
|
bool validAlignedAxis = false;
|
|
#endif
|
|
|
|
vec4 pickColor;
|
|
vec4 color;
|
|
|
|
temp = compressedAttribute2.y;
|
|
temp = temp * SHIFT_RIGHT8;
|
|
pickColor.b = (temp - floor(temp)) * SHIFT_LEFT8;
|
|
temp = floor(temp) * SHIFT_RIGHT8;
|
|
pickColor.g = (temp - floor(temp)) * SHIFT_LEFT8;
|
|
pickColor.r = floor(temp);
|
|
|
|
temp = compressedAttribute2.x;
|
|
temp = temp * SHIFT_RIGHT8;
|
|
color.b = (temp - floor(temp)) * SHIFT_LEFT8;
|
|
temp = floor(temp) * SHIFT_RIGHT8;
|
|
color.g = (temp - floor(temp)) * SHIFT_LEFT8;
|
|
color.r = floor(temp);
|
|
|
|
temp = compressedAttribute2.z * SHIFT_RIGHT8;
|
|
bool sizeInMeters = floor((temp - floor(temp)) * SHIFT_LEFT7) > 0.0;
|
|
temp = floor(temp) * SHIFT_RIGHT8;
|
|
|
|
pickColor.a = (temp - floor(temp)) * SHIFT_LEFT8;
|
|
pickColor /= 255.0;
|
|
|
|
color.a = floor(temp);
|
|
color /= 255.0;
|
|
|
|
///////////////////////////////////////////////////////////////////////////
|
|
|
|
vec4 p = czm_translateRelativeToEye(positionHigh, positionLow);
|
|
vec4 positionEC = czm_modelViewRelativeToEye * p;
|
|
|
|
#if defined(FRAGMENT_DEPTH_CHECK) || defined(VERTEX_DEPTH_CHECK)
|
|
float eyeDepth = positionEC.z;
|
|
#endif
|
|
|
|
positionEC = czm_eyeOffset(positionEC, eyeOffset.xyz);
|
|
positionEC.xyz *= show;
|
|
|
|
///////////////////////////////////////////////////////////////////////////
|
|
|
|
#if defined(EYE_DISTANCE_SCALING) || defined(EYE_DISTANCE_TRANSLUCENCY) || defined(EYE_DISTANCE_PIXEL_OFFSET) || defined(DISTANCE_DISPLAY_CONDITION) || defined(DISABLE_DEPTH_DISTANCE)
|
|
float lengthSq;
|
|
if (czm_sceneMode == czm_sceneMode2D)
|
|
{
|
|
// 2D camera distance is a special case
|
|
// treat all billboards as flattened to the z=0.0 plane
|
|
lengthSq = czm_eyeHeight2D.y;
|
|
}
|
|
else
|
|
{
|
|
lengthSq = dot(positionEC.xyz, positionEC.xyz);
|
|
}
|
|
#endif
|
|
|
|
#ifdef EYE_DISTANCE_SCALING
|
|
float distanceScale = czm_nearFarScalar(scaleByDistance, lengthSq);
|
|
scale *= distanceScale;
|
|
translate *= distanceScale;
|
|
// push vertex behind near plane for clipping
|
|
if (scale == 0.0)
|
|
{
|
|
positionEC.xyz = vec3(0.0);
|
|
}
|
|
#endif
|
|
|
|
float translucency = 1.0;
|
|
#ifdef EYE_DISTANCE_TRANSLUCENCY
|
|
translucency = czm_nearFarScalar(translucencyByDistance, lengthSq);
|
|
// push vertex behind near plane for clipping
|
|
if (translucency == 0.0)
|
|
{
|
|
positionEC.xyz = vec3(0.0);
|
|
}
|
|
#endif
|
|
|
|
#ifdef EYE_DISTANCE_PIXEL_OFFSET
|
|
float pixelOffsetScale = czm_nearFarScalar(pixelOffsetScaleByDistance, lengthSq);
|
|
pixelOffset *= pixelOffsetScale;
|
|
#endif
|
|
|
|
#ifdef DISTANCE_DISPLAY_CONDITION
|
|
float nearSq = compressedAttribute3.x;
|
|
float farSq = compressedAttribute3.y;
|
|
if (lengthSq < nearSq || lengthSq > farSq)
|
|
{
|
|
positionEC.xyz = vec3(0.0);
|
|
}
|
|
#endif
|
|
|
|
mat2 rotationMatrix;
|
|
float mpp;
|
|
|
|
#ifdef DISABLE_DEPTH_DISTANCE
|
|
float disableDepthTestDistance = compressedAttribute3.z;
|
|
#endif
|
|
|
|
#ifdef VERTEX_DEPTH_CHECK
|
|
if (lengthSq < disableDepthTestDistance) {
|
|
float depthsilon = 10.0;
|
|
|
|
vec2 labelTranslate = textureCoordinateBoundsOrLabelTranslate.xy;
|
|
vec4 pEC1 = addScreenSpaceOffset(positionEC, dimensions, scale, vec2(0.0), origin, labelTranslate, pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters, rotationMatrix, mpp);
|
|
float globeDepth1 = getGlobeDepth(pEC1);
|
|
|
|
if (globeDepth1 != 0.0 && pEC1.z + depthsilon < globeDepth1)
|
|
{
|
|
vec4 pEC2 = addScreenSpaceOffset(positionEC, dimensions, scale, vec2(0.0, 1.0), origin, labelTranslate, pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters, rotationMatrix, mpp);
|
|
float globeDepth2 = getGlobeDepth(pEC2);
|
|
|
|
if (globeDepth2 != 0.0 && pEC2.z + depthsilon < globeDepth2)
|
|
{
|
|
vec4 pEC3 = addScreenSpaceOffset(positionEC, dimensions, scale, vec2(1.0), origin, labelTranslate, pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters, rotationMatrix, mpp);
|
|
float globeDepth3 = getGlobeDepth(pEC3);
|
|
if (globeDepth3 != 0.0 && pEC3.z + depthsilon < globeDepth3)
|
|
{
|
|
positionEC.xyz = vec3(0.0);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
#endif
|
|
|
|
positionEC = addScreenSpaceOffset(positionEC, imageSize, scale, direction, origin, translate, pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters, rotationMatrix, mpp);
|
|
gl_Position = czm_projection * positionEC;
|
|
v_textureCoordinates = textureCoordinates;
|
|
|
|
#ifdef LOG_DEPTH
|
|
czm_vertexLogDepth();
|
|
#endif
|
|
|
|
#ifdef DISABLE_DEPTH_DISTANCE
|
|
if (disableDepthTestDistance == 0.0 && czm_minimumDisableDepthTestDistance != 0.0)
|
|
{
|
|
disableDepthTestDistance = czm_minimumDisableDepthTestDistance;
|
|
}
|
|
|
|
if (disableDepthTestDistance != 0.0)
|
|
{
|
|
// Don't try to "multiply both sides" by w. Greater/less-than comparisons won't work for negative values of w.
|
|
float zclip = gl_Position.z / gl_Position.w;
|
|
bool clipped = (zclip < -1.0 || zclip > 1.0);
|
|
if (!clipped && (disableDepthTestDistance < 0.0 || (lengthSq > 0.0 && lengthSq < disableDepthTestDistance)))
|
|
{
|
|
// Position z on the near plane.
|
|
gl_Position.z = -gl_Position.w;
|
|
#ifdef LOG_DEPTH
|
|
v_depthFromNearPlusOne = 1.0;
|
|
#endif
|
|
}
|
|
}
|
|
#endif
|
|
|
|
#ifdef FRAGMENT_DEPTH_CHECK
|
|
if (sizeInMeters) {
|
|
translate /= mpp;
|
|
dimensions /= mpp;
|
|
imageSize /= mpp;
|
|
}
|
|
|
|
#if defined(ROTATION) || defined(ALIGNED_AXIS)
|
|
v_rotationMatrix = rotationMatrix;
|
|
#else
|
|
v_rotationMatrix = mat2(1.0, 0.0, 0.0, 1.0);
|
|
#endif
|
|
|
|
float enableDepthCheck = 0.0;
|
|
if (lengthSq < disableDepthTestDistance)
|
|
{
|
|
enableDepthCheck = 1.0;
|
|
}
|
|
|
|
float dw = floor(clamp(dimensions.x, 0.0, SHIFT_LEFT12));
|
|
float dh = floor(clamp(dimensions.y, 0.0, SHIFT_LEFT12));
|
|
|
|
float iw = floor(clamp(imageSize.x, 0.0, SHIFT_LEFT12));
|
|
float ih = floor(clamp(imageSize.y, 0.0, SHIFT_LEFT12));
|
|
|
|
v_compressed.x = eyeDepth;
|
|
v_compressed.y = applyTranslate * SHIFT_LEFT1 + enableDepthCheck;
|
|
v_compressed.z = dw * SHIFT_LEFT12 + dh;
|
|
v_compressed.w = iw * SHIFT_LEFT12 + ih;
|
|
v_originTextureCoordinateAndTranslate.xy = depthOrigin;
|
|
v_originTextureCoordinateAndTranslate.zw = translate;
|
|
v_textureCoordinateBounds = textureCoordinateBoundsOrLabelTranslate;
|
|
|
|
#endif
|
|
|
|
#ifdef SDF
|
|
vec4 outlineColor;
|
|
float outlineWidth;
|
|
|
|
temp = sdf.x;
|
|
temp = temp * SHIFT_RIGHT8;
|
|
outlineColor.b = (temp - floor(temp)) * SHIFT_LEFT8;
|
|
temp = floor(temp) * SHIFT_RIGHT8;
|
|
outlineColor.g = (temp - floor(temp)) * SHIFT_LEFT8;
|
|
outlineColor.r = floor(temp);
|
|
|
|
temp = sdf.y;
|
|
temp = temp * SHIFT_RIGHT8;
|
|
float temp3 = (temp - floor(temp)) * SHIFT_LEFT8;
|
|
temp = floor(temp) * SHIFT_RIGHT8;
|
|
outlineWidth = (temp - floor(temp)) * SHIFT_LEFT8;
|
|
outlineColor.a = floor(temp);
|
|
outlineColor /= 255.0;
|
|
|
|
v_outlineWidth = outlineWidth / 255.0;
|
|
v_outlineColor = outlineColor;
|
|
v_outlineColor.a *= translucency;
|
|
#endif
|
|
|
|
v_pickColor = pickColor;
|
|
|
|
v_color = color;
|
|
v_color.a *= translucency;
|
|
|
|
}
|
|
`;function St(e,t){if(e=y(e,y.EMPTY_OBJECT),c(e.disableDepthTestDistance)&&e.disableDepthTestDistance<0)throw new E("disableDepthTestDistance must be greater than or equal to 0.0.");let n=e.translucencyByDistance,i=e.pixelOffsetScaleByDistance,o=e.scaleByDistance,r=e.distanceDisplayCondition;if(c(n)){if(n.far<=n.near)throw new E("translucencyByDistance.far must be greater than translucencyByDistance.near.");n=vt.clone(n)}if(c(i)){if(i.far<=i.near)throw new E("pixelOffsetScaleByDistance.far must be greater than pixelOffsetScaleByDistance.near.");i=vt.clone(i)}if(c(o)){if(o.far<=o.near)throw new E("scaleByDistance.far must be greater than scaleByDistance.near.");o=vt.clone(o)}if(c(r)){if(r.far<=r.near)throw new E("distanceDisplayCondition.far must be greater than distanceDisplayCondition.near.");r=Pt.clone(r)}this._show=y(e.show,!0),this._position=d.clone(y(e.position,d.ZERO)),this._actualPosition=d.clone(this._position),this._pixelOffset=H.clone(y(e.pixelOffset,H.ZERO)),this._translate=new H(0,0),this._eyeOffset=d.clone(y(e.eyeOffset,d.ZERO)),this._heightReference=y(e.heightReference,gt.NONE),this._verticalOrigin=y(e.verticalOrigin,si.CENTER),this._horizontalOrigin=y(e.horizontalOrigin,Fs.CENTER),this._scale=y(e.scale,1),this._color=z.clone(y(e.color,z.WHITE)),this._rotation=y(e.rotation,0),this._alignedAxis=d.clone(y(e.alignedAxis,d.ZERO)),this._width=e.width,this._height=e.height,this._scaleByDistance=o,this._translucencyByDistance=n,this._pixelOffsetScaleByDistance=i,this._sizeInMeters=y(e.sizeInMeters,!1),this._distanceDisplayCondition=r,this._disableDepthTestDistance=e.disableDepthTestDistance,this._id=e.id,this._collection=y(e.collection,t),this._pickId=void 0,this._pickPrimitive=y(e._pickPrimitive,this),this._billboardCollection=t,this._dirty=!1,this._index=-1,this._batchIndex=void 0,this._imageIndex=-1,this._imageIndexPromise=void 0,this._imageId=void 0,this._image=void 0,this._imageSubRegion=void 0,this._imageWidth=void 0,this._imageHeight=void 0,this._labelDimensions=void 0,this._labelHorizontalOrigin=void 0,this._labelTranslate=void 0;const s=e.image;let a=e.imageId;c(s)&&(c(a)||(typeof s=="string"?a=s:c(s.src)?a=s.src:a=Wr()),this._imageId=a,this._image=s),c(e.imageSubRegion)&&(this._imageId=a,this._imageSubRegion=e.imageSubRegion),c(this._billboardCollection._textureAtlas)&&this._loadImage(),this._actualClampedPosition=void 0,this._removeCallbackFunc=void 0,this._mode=oe.SCENE3D,this._clusterShow=!0,this._outlineColor=z.clone(y(e.outlineColor,z.BLACK)),this._outlineWidth=y(e.outlineWidth,0),this._updateClamping()}const TF=St.SHOW_INDEX=0,qA=St.POSITION_INDEX=1,G5=St.PIXEL_OFFSET_INDEX=2,nxe=St.EYE_OFFSET_INDEX=3,ixe=St.HORIZONTAL_ORIGIN_INDEX=4,oxe=St.VERTICAL_ORIGIN_INDEX=5,rxe=St.SCALE_INDEX=6,YA=St.IMAGE_INDEX_INDEX=7,AF=St.COLOR_INDEX=8,sxe=St.ROTATION_INDEX=9,axe=St.ALIGNED_AXIS_INDEX=10,cxe=St.SCALE_BY_DISTANCE_INDEX=11,lxe=St.TRANSLUCENCY_BY_DISTANCE_INDEX=12,uxe=St.PIXEL_OFFSET_SCALE_BY_DISTANCE_INDEX=13,dxe=St.DISTANCE_DISPLAY_CONDITION=14,hxe=St.DISABLE_DEPTH_DISTANCE=15;St.TEXTURE_COORDINATE_BOUNDS=16;const xF=St.SDF_INDEX=17;St.NUMBER_OF_PROPERTIES=18;function mi(e,t){const n=e._billboardCollection;c(n)&&(n._updateBillboard(e,t),e._dirty=!0)}Object.defineProperties(St.prototype,{show:{get:function(){return this._show},set:function(e){A.typeOf.bool("value",e),this._show!==e&&(this._show=e,mi(this,TF))}},position:{get:function(){return this._position},set:function(e){A.typeOf.object("value",e);const t=this._position;d.equals(t,e)||(d.clone(e,t),d.clone(e,this._actualPosition),this._updateClamping(),mi(this,qA))}},heightReference:{get:function(){return this._heightReference},set:function(e){A.typeOf.number("value",e);const t=this._heightReference;e!==t&&(this._heightReference=e,this._updateClamping(),mi(this,qA))}},pixelOffset:{get:function(){return this._pixelOffset},set:function(e){A.typeOf.object("value",e);const t=this._pixelOffset;H.equals(t,e)||(H.clone(e,t),mi(this,G5))}},scaleByDistance:{get:function(){return this._scaleByDistance},set:function(e){if(c(e)&&(A.typeOf.object("value",e),e.far<=e.near))throw new E("far distance must be greater than near distance.");const t=this._scaleByDistance;vt.equals(t,e)||(this._scaleByDistance=vt.clone(e,t),mi(this,cxe))}},translucencyByDistance:{get:function(){return this._translucencyByDistance},set:function(e){if(c(e)&&(A.typeOf.object("value",e),e.far<=e.near))throw new E("far distance must be greater than near distance.");const t=this._translucencyByDistance;vt.equals(t,e)||(this._translucencyByDistance=vt.clone(e,t),mi(this,lxe))}},pixelOffsetScaleByDistance:{get:function(){return this._pixelOffsetScaleByDistance},set:function(e){if(c(e)&&(A.typeOf.object("value",e),e.far<=e.near))throw new E("far distance must be greater than near distance.");const t=this._pixelOffsetScaleByDistance;vt.equals(t,e)||(this._pixelOffsetScaleByDistance=vt.clone(e,t),mi(this,uxe))}},eyeOffset:{get:function(){return this._eyeOffset},set:function(e){A.typeOf.object("value",e);const t=this._eyeOffset;d.equals(t,e)||(d.clone(e,t),mi(this,nxe))}},horizontalOrigin:{get:function(){return this._horizontalOrigin},set:function(e){A.typeOf.number("value",e),this._horizontalOrigin!==e&&(this._horizontalOrigin=e,mi(this,ixe))}},verticalOrigin:{get:function(){return this._verticalOrigin},set:function(e){A.typeOf.number("value",e),this._verticalOrigin!==e&&(this._verticalOrigin=e,mi(this,oxe))}},scale:{get:function(){return this._scale},set:function(e){A.typeOf.number("value",e),this._scale!==e&&(this._scale=e,mi(this,rxe))}},color:{get:function(){return this._color},set:function(e){A.typeOf.object("value",e);const t=this._color;z.equals(t,e)||(z.clone(e,t),mi(this,AF))}},rotation:{get:function(){return this._rotation},set:function(e){A.typeOf.number("value",e),this._rotation!==e&&(this._rotation=e,mi(this,sxe))}},alignedAxis:{get:function(){return this._alignedAxis},set:function(e){A.typeOf.object("value",e);const t=this._alignedAxis;d.equals(t,e)||(d.clone(e,t),mi(this,axe))}},width:{get:function(){return y(this._width,this._imageWidth)},set:function(e){c(e)&&A.typeOf.number("value",e),this._width!==e&&(this._width=e,mi(this,YA))}},height:{get:function(){return y(this._height,this._imageHeight)},set:function(e){c(e)&&A.typeOf.number("value",e),this._height!==e&&(this._height=e,mi(this,YA))}},sizeInMeters:{get:function(){return this._sizeInMeters},set:function(e){A.typeOf.bool("value",e),this._sizeInMeters!==e&&(this._sizeInMeters=e,mi(this,AF))}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){if(!Pt.equals(e,this._distanceDisplayCondition)){if(c(e)&&(A.typeOf.object("value",e),e.far<=e.near))throw new E("far distance must be greater than near distance.");this._distanceDisplayCondition=Pt.clone(e,this._distanceDisplayCondition),mi(this,dxe)}}},disableDepthTestDistance:{get:function(){return this._disableDepthTestDistance},set:function(e){if(c(e)&&(A.typeOf.number("value",e),e<0))throw new E("disableDepthTestDistance must be greater than or equal to 0.0.");this._disableDepthTestDistance!==e&&(this._disableDepthTestDistance=e,mi(this,hxe))}},id:{get:function(){return this._id},set:function(e){this._id=e,c(this._pickId)&&(this._pickId.object.id=e)}},pickPrimitive:{get:function(){return this._pickPrimitive},set:function(e){this._pickPrimitive=e,c(this._pickId)&&(this._pickId.object.primitive=e)}},pickId:{get:function(){return this._pickId}},image:{get:function(){return this._imageId},set:function(e){c(e)?typeof e=="string"?this.setImage(e,e):e instanceof Ae?this.setImage(e.url,e):c(e.src)?this.setImage(e.src,e):this.setImage(Wr(),e):(this._imageIndex=-1,this._imageSubRegion=void 0,this._imageId=void 0,this._image=void 0,this._imageIndexPromise=void 0,mi(this,YA))}},ready:{get:function(){return this._imageIndex!==-1}},_clampedPosition:{get:function(){return this._actualClampedPosition},set:function(e){this._actualClampedPosition=d.clone(e,this._actualClampedPosition),mi(this,qA)}},clusterShow:{get:function(){return this._clusterShow},set:function(e){this._clusterShow!==e&&(this._clusterShow=e,mi(this,TF))}},outlineColor:{get:function(){return this._outlineColor},set:function(e){if(!c(e))throw new E("value is required.");const t=this._outlineColor;z.equals(t,e)||(z.clone(e,t),mi(this,xF))}},outlineWidth:{get:function(){return this._outlineWidth},set:function(e){this._outlineWidth!==e&&(this._outlineWidth=e,mi(this,xF))}}});St.prototype.getPickId=function(e){return c(this._pickId)||(this._pickId=e.createPickId({primitive:this._pickPrimitive,collection:this._collection,id:this._id})),this._pickId};St.prototype._updateClamping=function(){St._updateClamping(this._billboardCollection,this)};const $A=new he;St._updateClamping=function(e,t){const n=e._scene;if(!c(n)){if(t._heightReference!==gt.NONE)throw new E("Height reference is not supported without a scene.");return}const i=n.globe,o=y(i==null?void 0:i.ellipsoid,ae.WGS84),r=n.frameState.mode,s=r!==t._mode;if(t._mode=r,(t._heightReference===gt.NONE||s)&&c(t._removeCallbackFunc)&&(t._removeCallbackFunc(),t._removeCallbackFunc=void 0,t._clampedPosition=void 0),t._heightReference===gt.NONE||!c(t._position))return;c(t._removeCallbackFunc)&&t._removeCallbackFunc();const a=o.cartesianToCartographic(t._position);if(!c(a)){t._actualClampedPosition=void 0;return}function l(h){const f=o.cartographicToCartesian(h,t._clampedPosition);zP(t._heightReference)&&(t._mode===oe.SCENE3D?(h.height+=a.height,o.cartographicToCartesian(h,f)):f.x+=a.height),t._clampedPosition=f}t._removeCallbackFunc=n.updateHeight(a,l,t._heightReference),he.clone(a,$A);const u=n.getHeight(a,t._heightReference);c(u)&&($A.height=u),l($A)};St.prototype._loadImage=function(){const e=this._billboardCollection._textureAtlas,t=this._imageId,n=this._image,i=this._imageSubRegion;let o;const r=this;function s(l){if(r._imageId!==t||r._image!==n||!Re.equals(r._imageSubRegion,i))return;const u=e.textureCoordinates[l];r._imageWidth=e.texture.width*u.width,r._imageHeight=e.texture.height*u.height,r._imageIndex=l,r._ready=!0,r._image=void 0,r._imageIndexPromise=void 0,mi(r,YA);const h=r._billboardCollection._scene;!c(h)||h.frameState.afterRender.push(()=>!0)}if(c(n)&&(o=e.addImage(t,n)),c(i)&&(o=e.addSubRegion(t,i)),this._imageIndexPromise=o,!c(o))return;const a=e.getImageIndex(t);if(c(a)&&!c(i)){s(a);return}o.then(s).catch(function(l){console.error(`Error loading image for billboard: ${l}`),r._imageIndexPromise=void 0})};St.prototype.setImage=function(e,t){if(!c(e))throw new E("id is required.");if(!c(t))throw new E("image is required.");this._imageId!==e&&(this._imageIndex=-1,this._imageSubRegion=void 0,this._imageId=e,this._image=t,c(this._billboardCollection._textureAtlas)&&this._loadImage())};St.prototype.setImageSubRegion=function(e,t){if(!c(e))throw new E("id is required.");if(!c(t))throw new E("subRegion is required.");this._imageId===e&&Re.equals(this._imageSubRegion,t)||(this._imageIndex=-1,this._imageId=e,this._imageSubRegion=Re.clone(t),c(this._billboardCollection._textureAtlas)&&this._loadImage())};St.prototype._setTranslate=function(e){if(!c(e))throw new E("value is required.");const t=this._translate;H.equals(t,e)||(H.clone(e,t),mi(this,G5))};St.prototype._getActualPosition=function(){return c(this._clampedPosition)?this._clampedPosition:this._actualPosition};St.prototype._setActualPosition=function(e){c(this._clampedPosition)||d.clone(e,this._actualPosition),mi(this,qA)};const CF=new te;St._computeActualPosition=function(e,t,n,i){return c(e._clampedPosition)?(n.mode!==e._mode&&e._updateClamping(),e._clampedPosition):n.mode===oe.SCENE3D?t:(L.multiplyByPoint(i,t,CF),Ao.computeActualWgs84Position(n,CF))};const j5=new d;St._computeScreenSpacePosition=function(e,t,n,i,o,r){const s=L.multiplyByPoint(e,t,j5),a=Ao.wgs84WithEyeOffsetToWindowCoordinates(o,s,n,r);if(!!c(a))return H.add(a,i,a),a};const TT=new H(0,0);St.prototype.computeScreenSpacePosition=function(e,t){const n=this._billboardCollection;if(c(t)||(t=new H),!c(n))throw new E("Billboard must be in a collection. Was it removed?");if(!c(e))throw new E("scene is required.");H.clone(this._pixelOffset,TT),H.add(TT,this._translate,TT);let i=n.modelMatrix,o=this._position;if(c(this._clampedPosition)&&(o=this._clampedPosition,e.mode!==oe.SCENE3D)){const s=e.mapProjection,a=s.ellipsoid,l=s.unproject(o,$A);o=a.cartographicToCartesian(l,j5),i=L.IDENTITY}return St._computeScreenSpacePosition(i,o,this._eyeOffset,TT,e,t)};St.getScreenSpaceBoundingBox=function(e,t,n){let i=e.width,o=e.height;const r=e.scale;i*=r,o*=r;let s=t.x;e.horizontalOrigin===Fs.RIGHT?s-=i:e.horizontalOrigin===Fs.CENTER&&(s-=i*.5);let a=t.y;return e.verticalOrigin===si.BOTTOM||e.verticalOrigin===si.BASELINE?a-=o:e.verticalOrigin===si.CENTER&&(a-=o*.5),c(n)||(n=new Re),n.x=s,n.y=a,n.width=i,n.height=o,n};St.prototype.equals=function(e){return this===e||c(e)&&this._id===e._id&&d.equals(this._position,e._position)&&this._imageId===e._imageId&&this._show===e._show&&this._scale===e._scale&&this._verticalOrigin===e._verticalOrigin&&this._horizontalOrigin===e._horizontalOrigin&&this._heightReference===e._heightReference&&Re.equals(this._imageSubRegion,e._imageSubRegion)&&z.equals(this._color,e._color)&&H.equals(this._pixelOffset,e._pixelOffset)&&H.equals(this._translate,e._translate)&&d.equals(this._eyeOffset,e._eyeOffset)&&vt.equals(this._scaleByDistance,e._scaleByDistance)&&vt.equals(this._translucencyByDistance,e._translucencyByDistance)&&vt.equals(this._pixelOffsetScaleByDistance,e._pixelOffsetScaleByDistance)&&Pt.equals(this._distanceDisplayCondition,e._distanceDisplayCondition)&&this._disableDepthTestDistance===e._disableDepthTestDistance};St.prototype._destroy=function(){c(this._customData)&&(this._billboardCollection._scene.globe._surface.removeTileCustomData(this._customData),this._customData=void 0),c(this._removeCallbackFunc)&&(this._removeCallbackFunc(),this._removeCallbackFunc=void 0),this.image=void 0,this._pickId=this._pickId&&this._pickId.destroy(),this._billboardCollection=void 0};const fxe={OPAQUE:0,TRANSLUCENT:1,OPAQUE_AND_TRANSLUCENT:2},io=Object.freeze(fxe),pxe={FONT_SIZE:48,PADDING:10,RADIUS:8,CUTOFF:.25},Aa=Object.freeze(pxe);function Hu(e,t,n,i,o){this.bottomLeft=y(e,H.ZERO),this.topRight=y(t,H.ZERO),this.childNode1=n,this.childNode2=i,this.imageIndex=o}const mxe=new H(16,16);function ou(e){e=y(e,y.EMPTY_OBJECT);const t=y(e.borderWidthInPixels,1),n=y(e.initialSize,mxe);if(!c(e.context))throw new E("context is required.");if(t<0)throw new E("borderWidthInPixels must be greater than or equal to zero.");if(n.x<1||n.y<1)throw new E("initialSize must be greater than zero.");this._context=e.context,this._pixelFormat=y(e.pixelFormat,Ve.RGBA),this._borderWidthInPixels=t,this._textureCoordinates=[],this._guid=Wr(),this._idHash={},this._indexHash={},this._initialSize=n,this._root=void 0}Object.defineProperties(ou.prototype,{borderWidthInPixels:{get:function(){return this._borderWidthInPixels}},textureCoordinates:{get:function(){return this._textureCoordinates}},texture:{get:function(){return c(this._texture)||(this._texture=new xt({context:this._context,width:this._initialSize.x,height:this._initialSize.y,pixelFormat:this._pixelFormat})),this._texture}},numberOfImages:{get:function(){return this._textureCoordinates.length}},guid:{get:function(){return this._guid}}});function _xe(e,t){const n=e._context,i=e.numberOfImages,o=2,r=e._borderWidthInPixels;if(i>0){const s=e._texture.width,a=e._texture.height,l=o*(s+t.width+r),u=o*(a+t.height+r),h=s/l,f=a/u,_=new Hu(new H(s+r,r),new H(l,a)),g=new Hu(new H,new H(l,a),e._root,_),m=new Hu(new H(r,a+r),new H(l,u)),b=new Hu(new H,new H(l,u),g,m);for(let C=0;C<e._textureCoordinates.length;C++){const w=e._textureCoordinates[C];c(w)&&(w.x*=h,w.y*=f,w.width*=h,w.height*=f)}const T=new xt({context:e._context,width:l,height:u,pixelFormat:e._pixelFormat}),x=new ur({context:n,colorTextures:[e._texture],destroyAttachments:!1});x._bind(),T.copyFromFramebuffer(0,0,0,0,l,u),x._unBind(),x.destroy(),e._texture=e._texture&&e._texture.destroy(),e._texture=T,e._root=b}else{let s=o*(t.width+2*r),a=o*(t.height+2*r);s<e._initialSize.x&&(s=e._initialSize.x),a<e._initialSize.y&&(a=e._initialSize.y),e._texture=e._texture&&e._texture.destroy(),e._texture=new xt({context:e._context,width:s,height:a,pixelFormat:e._pixelFormat}),e._root=new Hu(new H(r,r),new H(s,a))}}function XA(e,t,n){if(!!c(t)){if(!c(t.childNode1)&&!c(t.childNode2)){if(c(t.imageIndex))return;const i=t.topRight.x-t.bottomLeft.x,o=t.topRight.y-t.bottomLeft.y,r=i-n.width,s=o-n.height;if(r<0||s<0)return;if(r===0&&s===0)return t;if(r>s){t.childNode1=new Hu(new H(t.bottomLeft.x,t.bottomLeft.y),new H(t.bottomLeft.x+n.width,t.topRight.y));const a=t.bottomLeft.x+n.width+e._borderWidthInPixels;a<t.topRight.x&&(t.childNode2=new Hu(new H(a,t.bottomLeft.y),new H(t.topRight.x,t.topRight.y)))}else{t.childNode1=new Hu(new H(t.bottomLeft.x,t.bottomLeft.y),new H(t.topRight.x,t.bottomLeft.y+n.height));const a=t.bottomLeft.y+n.height+e._borderWidthInPixels;a<t.topRight.y&&(t.childNode2=new Hu(new H(t.bottomLeft.x,a),new H(t.topRight.x,t.topRight.y)))}return XA(e,t.childNode1,n)}return XA(e,t.childNode1,n)||XA(e,t.childNode2,n)}}function W5(e,t,n){const i=XA(e,e._root,t);if(c(i)){i.imageIndex=n;const o=e._texture.width,r=e._texture.height,s=i.topRight.x-i.bottomLeft.x,a=i.topRight.y-i.bottomLeft.y,l=i.bottomLeft.x/o,u=i.bottomLeft.y/r,h=s/o,f=a/r;e._textureCoordinates[n]=new Re(l,u,h,f),e._texture.copyFrom({source:t,xOffset:i.bottomLeft.x,yOffset:i.bottomLeft.y})}else _xe(e,t),W5(e,t,n);e._guid=Wr()}function q5(e,t){if(!c(e)||e.isDestroyed())return-1;const n=e.numberOfImages;return W5(e,t,n),n}ou.prototype.getImageIndex=function(e){if(!c(e))throw new E("id is required.");return this._indexHash[e]};ou.prototype.addImageSync=function(e,t){if(!c(e))throw new E("id is required.");if(!c(t))throw new E("image is required.");let n=this._indexHash[e];return c(n)||(n=q5(this,t),this._idHash[e]=Promise.resolve(n),this._indexHash[e]=n),n};ou.prototype.addImage=function(e,t){if(!c(e))throw new E("id is required.");if(!c(t))throw new E("image is required.");let n=this._idHash[e];if(c(n))return n;if(typeof t=="function"){if(t=t(e),!c(t))throw new E("image is required.")}else(typeof t=="string"||t instanceof Ae)&&(t=Ae.createIfNeeded(t).fetchImage());const i=this;return n=Promise.resolve(t).then(function(o){const r=q5(i,o);return i._indexHash[e]=r,r}),this._idHash[e]=n,n};ou.prototype.addSubRegion=function(e,t){if(!c(e))throw new E("id is required.");if(!c(t))throw new E("subRegion is required.");const n=this._idHash[e];if(!c(n))throw new Te(`image with id "${e}" not found in the atlas.`);const i=this;return Promise.resolve(n).then(function(o){if(o===-1)return-1;const r=i._texture.width,s=i._texture.height,a=i._textureCoordinates[o],l=a.x+t.x/r,u=a.y+t.y/s,h=t.width/r,f=t.height/s,_=i._textureCoordinates.push(new Re(l,u,h,f))-1;return i._indexHash[e]=_,i._guid=Wr(),_})};ou.prototype.isDestroyed=function(){return!1};ou.prototype.destroy=function(){return this._texture=this._texture&&this._texture.destroy(),ve(this)};const gxe=St.SHOW_INDEX,My=St.POSITION_INDEX,Y5=St.PIXEL_OFFSET_INDEX,$5=St.EYE_OFFSET_INDEX,yxe=St.HORIZONTAL_ORIGIN_INDEX,bxe=St.VERTICAL_ORIGIN_INDEX,Txe=St.SCALE_INDEX,Rg=St.IMAGE_INDEX_INDEX,X5=St.COLOR_INDEX,Axe=St.ROTATION_INDEX,xxe=St.ALIGNED_AXIS_INDEX,Q5=St.SCALE_BY_DISTANCE_INDEX,K5=St.TRANSLUCENCY_BY_DISTANCE_INDEX,Z5=St.PIXEL_OFFSET_SCALE_BY_DISTANCE_INDEX,J5=St.DISTANCE_DISPLAY_CONDITION,Cxe=St.DISABLE_DEPTH_DISTANCE,Exe=St.TEXTURE_COORDINATE_BOUNDS,e8=St.SDF_INDEX,BO=St.NUMBER_OF_PROPERTIES;let ni;const wxe={positionHighAndScale:0,positionLowAndRotation:1,compressedAttribute0:2,compressedAttribute1:3,compressedAttribute2:4,eyeOffset:5,scaleByDistance:6,pixelOffsetScaleByDistance:7,compressedAttribute3:8,textureCoordinateBoundsOrLabelTranslate:9,a_batchId:10,sdf:11},Sxe={direction:0,positionHighAndScale:1,positionLowAndRotation:2,compressedAttribute0:3,compressedAttribute1:4,compressedAttribute2:5,eyeOffset:6,scaleByDistance:7,pixelOffsetScaleByDistance:8,compressedAttribute3:9,textureCoordinateBoundsOrLabelTranslate:10,a_batchId:11,sdf:12};function Ts(e){e=y(e,y.EMPTY_OBJECT),this._scene=e.scene,this._batchTable=e.batchTable,this._textureAtlas=void 0,this._textureAtlasGUID=void 0,this._destroyTextureAtlas=!0,this._sp=void 0,this._spTranslucent=void 0,this._rsOpaque=void 0,this._rsTranslucent=void 0,this._vaf=void 0,this._billboards=[],this._billboardsToUpdate=[],this._billboardsToUpdateIndex=0,this._billboardsRemoved=!1,this._createVertexArray=!1,this._shaderRotation=!1,this._compiledShaderRotation=!1,this._shaderAlignedAxis=!1,this._compiledShaderAlignedAxis=!1,this._shaderScaleByDistance=!1,this._compiledShaderScaleByDistance=!1,this._shaderTranslucencyByDistance=!1,this._compiledShaderTranslucencyByDistance=!1,this._shaderPixelOffsetScaleByDistance=!1,this._compiledShaderPixelOffsetScaleByDistance=!1,this._shaderDistanceDisplayCondition=!1,this._compiledShaderDistanceDisplayCondition=!1,this._shaderDisableDepthDistance=!1,this._compiledShaderDisableDepthDistance=!1,this._shaderClampToGround=!1,this._compiledShaderClampToGround=!1,this._propertiesChanged=new Uint32Array(BO),this._maxSize=0,this._maxEyeOffset=0,this._maxScale=1,this._maxPixelOffset=0,this._allHorizontalCenter=!0,this._allVerticalCenter=!0,this._allSizedInMeters=!0,this._baseVolume=new se,this._baseVolumeWC=new se,this._baseVolume2D=new se,this._boundingVolume=new se,this._boundingVolumeDirty=!1,this._colorCommands=[],this.show=y(e.show,!0),this.modelMatrix=L.clone(y(e.modelMatrix,L.IDENTITY)),this._modelMatrix=L.clone(L.IDENTITY),this.debugShowBoundingVolume=y(e.debugShowBoundingVolume,!1),this.debugShowTextureAtlas=y(e.debugShowTextureAtlas,!1),this.blendOption=y(e.blendOption,io.OPAQUE_AND_TRANSLUCENT),this._blendOption=void 0,this._mode=oe.SCENE3D,this._buffersUsage=[ke.STATIC_DRAW,ke.STATIC_DRAW,ke.STATIC_DRAW,ke.STATIC_DRAW,ke.STATIC_DRAW,ke.STATIC_DRAW,ke.STATIC_DRAW,ke.STATIC_DRAW,ke.STATIC_DRAW,ke.STATIC_DRAW,ke.STATIC_DRAW,ke.STATIC_DRAW,ke.STATIC_DRAW,ke.STATIC_DRAW,ke.STATIC_DRAW,ke.STATIC_DRAW],this._highlightColor=z.clone(z.WHITE);const t=this;this._uniforms={u_atlas:function(){return t._textureAtlas.texture},u_highlightColor:function(){return t._highlightColor}};const n=this._scene;c(n)&&c(n.terrainProviderChanged)&&(this._removeCallbackFunc=n.terrainProviderChanged.addEventListener(function(){const i=this._billboards,o=i.length;for(let r=0;r<o;++r)c(i[r])&&i[r]._updateClamping()},this))}Object.defineProperties(Ts.prototype,{length:{get:function(){return zO(this),this._billboards.length}},textureAtlas:{get:function(){return this._textureAtlas},set:function(e){this._textureAtlas!==e&&(this._textureAtlas=this._destroyTextureAtlas&&this._textureAtlas&&this._textureAtlas.destroy(),this._textureAtlas=e,this._createVertexArray=!0)}},destroyTextureAtlas:{get:function(){return this._destroyTextureAtlas},set:function(e){this._destroyTextureAtlas=e}}});function t8(e){const t=e.length;for(let n=0;n<t;++n)e[n]&&e[n]._destroy()}Ts.prototype.add=function(e){const t=new St(e,this);return t._index=this._billboards.length,this._billboards.push(t),this._createVertexArray=!0,t};Ts.prototype.remove=function(e){return this.contains(e)?(this._billboards[e._index]=void 0,this._billboardsRemoved=!0,this._createVertexArray=!0,e._destroy(),!0):!1};Ts.prototype.removeAll=function(){t8(this._billboards),this._billboards=[],this._billboardsToUpdate=[],this._billboardsToUpdateIndex=0,this._billboardsRemoved=!1,this._createVertexArray=!0};function zO(e){if(e._billboardsRemoved){e._billboardsRemoved=!1;const t=[],n=e._billboards,i=n.length;for(let o=0,r=0;o<i;++o){const s=n[o];c(s)&&(s._index=r++,t.push(s))}e._billboards=t}}Ts.prototype._updateBillboard=function(e,t){e._dirty||(this._billboardsToUpdate[this._billboardsToUpdateIndex++]=e),++this._propertiesChanged[t]};Ts.prototype.contains=function(e){return c(e)&&e._billboardCollection===this};Ts.prototype.get=function(e){return A.typeOf.number("index",e),zO(this),this._billboards[e]};let mS;function vxe(e){let n=e.cache.billboardCollection_indexBufferBatched;if(c(n))return n;const i=16384*6-6,o=new Uint16Array(i);for(let r=0,s=0;r<i;r+=6,s+=4)o[r]=s,o[r+1]=s+1,o[r+2]=s+2,o[r+3]=s+0,o[r+4]=s+2,o[r+5]=s+3;return n=ct.createIndexBuffer({context:e,typedArray:o,usage:ke.STATIC_DRAW,indexDatatype:je.UNSIGNED_SHORT}),n.vertexArrayDestroyable=!1,e.cache.billboardCollection_indexBufferBatched=n,n}function Ixe(e){let t=e.cache.billboardCollection_indexBufferInstanced;return c(t)||(t=ct.createIndexBuffer({context:e,typedArray:new Uint16Array([0,1,2,0,2,3]),usage:ke.STATIC_DRAW,indexDatatype:je.UNSIGNED_SHORT}),t.vertexArrayDestroyable=!1,e.cache.billboardCollection_indexBufferInstanced=t),t}function Dxe(e){let t=e.cache.billboardCollection_vertexBufferInstanced;return c(t)||(t=ct.createVertexBuffer({context:e,typedArray:new Float32Array([0,0,1,0,1,1,0,1]),usage:ke.STATIC_DRAW}),t.vertexArrayDestroyable=!1,e.cache.billboardCollection_vertexBufferInstanced=t),t}Ts.prototype.computeNewBuffersUsage=function(){const e=this._buffersUsage;let t=!1;const n=this._propertiesChanged;for(let i=0;i<BO;++i){const o=n[i]===0?ke.STATIC_DRAW:ke.STREAM_DRAW;t=t||e[i]!==o,e[i]=o}return t};function Pxe(e,t,n,i,o,r){const s=[{index:ni.positionHighAndScale,componentsPerAttribute:4,componentDatatype:Z.FLOAT,usage:n[My]},{index:ni.positionLowAndRotation,componentsPerAttribute:4,componentDatatype:Z.FLOAT,usage:n[My]},{index:ni.compressedAttribute0,componentsPerAttribute:4,componentDatatype:Z.FLOAT,usage:n[Y5]},{index:ni.compressedAttribute1,componentsPerAttribute:4,componentDatatype:Z.FLOAT,usage:n[K5]},{index:ni.compressedAttribute2,componentsPerAttribute:4,componentDatatype:Z.FLOAT,usage:n[X5]},{index:ni.eyeOffset,componentsPerAttribute:4,componentDatatype:Z.FLOAT,usage:n[$5]},{index:ni.scaleByDistance,componentsPerAttribute:4,componentDatatype:Z.FLOAT,usage:n[Q5]},{index:ni.pixelOffsetScaleByDistance,componentsPerAttribute:4,componentDatatype:Z.FLOAT,usage:n[Z5]},{index:ni.compressedAttribute3,componentsPerAttribute:4,componentDatatype:Z.FLOAT,usage:n[J5]},{index:ni.textureCoordinateBoundsOrLabelTranslate,componentsPerAttribute:4,componentDatatype:Z.FLOAT,usage:n[Exe]}];i&&s.push({index:ni.direction,componentsPerAttribute:2,componentDatatype:Z.FLOAT,vertexBuffer:Dxe(e)}),c(o)&&s.push({index:ni.a_batchId,componentsPerAttribute:1,componentDatatype:Z.FLOAT,bufferUsage:ke.STATIC_DRAW}),r&&s.push({index:ni.sdf,componentsPerAttribute:2,componentDatatype:Z.FLOAT,usage:n[e8]});const a=i?t:4*t;return new qo(e,s,a,i)}const _S=new rn;function n8(e,t,n,i,o){let r;const s=i[ni.positionHighAndScale],a=i[ni.positionLowAndRotation],l=o._getActualPosition();e._mode===oe.SCENE3D&&(se.expand(e._baseVolume,l,e._baseVolume),e._boundingVolumeDirty=!0),rn.fromCartesian(l,_S);const u=o.scale,h=o.rotation;h!==0&&(e._shaderRotation=!0),e._maxScale=Math.max(e._maxScale,u);const f=_S.high,_=_S.low;e._instanced?(r=o._index,s(r,f.x,f.y,f.z,u),a(r,_.x,_.y,_.z,h)):(r=o._index*4,s(r+0,f.x,f.y,f.z,u),s(r+1,f.x,f.y,f.z,u),s(r+2,f.x,f.y,f.z,u),s(r+3,f.x,f.y,f.z,u),a(r+0,_.x,_.y,_.z,h),a(r+1,_.x,_.y,_.z,h),a(r+2,_.x,_.y,_.z,h),a(r+3,_.x,_.y,_.z,h))}const sc=new H,Za=32768,s_=65536,gS=4096,Jl=256,Oxe=128,Lxe=32,Rxe=8,i8=4,Nxe=1/256,o8=0,r8=2,s8=3,a8=1;function c8(e,t,n,i,o){let r;const s=i[ni.compressedAttribute0],a=o.pixelOffset,l=a.x,u=a.y,h=o._translate,f=h.x,_=h.y;e._maxPixelOffset=Math.max(e._maxPixelOffset,Math.abs(l+f),Math.abs(-u+_));const g=o.horizontalOrigin;let m=o._verticalOrigin,b=o.show&&o.clusterShow;o.color.alpha===0&&(b=!1),m===si.BASELINE&&(m=si.BOTTOM),e._allHorizontalCenter=e._allHorizontalCenter&&g===Fs.CENTER,e._allVerticalCenter=e._allVerticalCenter&&m===si.CENTER;let T=0,x=0,C=0,w=0;const v=o._imageIndex;if(v!==-1){const V=n[v];if(!c(V))throw new E(`Invalid billboard image index: ${v}`);T=V.x,x=V.y,C=V.width,w=V.height}const P=T+C,N=x+w;let k=Math.floor(R.clamp(l,-Za,Za)+Za)*Oxe;k+=(g+1)*Lxe,k+=(m+1)*Rxe,k+=(b?1:0)*i8;let M=Math.floor(R.clamp(u,-Za,Za)+Za)*Jl,U=Math.floor(R.clamp(f,-Za,Za)+Za)*Jl;const B=(R.clamp(_,-Za,Za)+Za)*Nxe,S=Math.floor(B),D=Math.floor((B-S)*Jl);M+=S,U+=D,sc.x=T,sc.y=x;const p=En.compressTextureCoordinates(sc);sc.x=P;const I=En.compressTextureCoordinates(sc);sc.y=N;const O=En.compressTextureCoordinates(sc);sc.x=T;const F=En.compressTextureCoordinates(sc);e._instanced?(r=o._index,s(r,k,M,U,p)):(r=o._index*4,s(r+0,k+o8,M,U,p),s(r+1,k+r8,M,U,I),s(r+2,k+s8,M,U,O),s(r+3,k+a8,M,U,F))}function l8(e,t,n,i,o){let r;const s=i[ni.compressedAttribute1],a=o.alignedAxis;d.equals(a,d.ZERO)||(e._shaderAlignedAxis=!0);let l=0,u=1,h=1,f=1;const _=o.translucencyByDistance;c(_)&&(l=_.near,u=_.nearValue,h=_.far,f=_.farValue,(u!==1||f!==1)&&(e._shaderTranslucencyByDistance=!0));let g=0;const m=o._imageIndex;if(m!==-1){const w=n[m];if(!c(w))throw new E(`Invalid billboard image index: ${m}`);g=w.width}const b=e._textureAtlas.texture.width,T=Math.round(y(o.width,b*g));e._maxSize=Math.max(e._maxSize,T);let x=R.clamp(T,0,s_),C=0;Math.abs(d.magnitudeSquared(a)-1)<R.EPSILON6&&(C=En.octEncodeFloat(a)),u=R.clamp(u,0,1),u=u===1?255:u*255|0,x=x*Jl+u,f=R.clamp(f,0,1),f=f===1?255:f*255|0,C=C*Jl+f,e._instanced?(r=o._index,s(r,x,C,l,h)):(r=o._index*4,s(r+0,x,C,l,h),s(r+1,x,C,l,h),s(r+2,x,C,l,h),s(r+3,x,C,l,h))}function cD(e,t,n,i,o){let r;const s=i[ni.compressedAttribute2],a=o.color,l=c(e._batchTable)?z.WHITE:o.getPickId(t.context).color,u=o.sizeInMeters?1:0,h=Math.abs(d.magnitudeSquared(o.alignedAxis)-1)<R.EPSILON6?1:0;e._allSizedInMeters=e._allSizedInMeters&&u===1;let f=0;const _=o._imageIndex;if(_!==-1){const k=n[_];if(!c(k))throw new E(`Invalid billboard image index: ${_}`);f=k.height}const g=e._textureAtlas.texture.dimensions,m=Math.round(y(o.height,g.y*f));e._maxSize=Math.max(e._maxSize,m);let b=y(o._labelHorizontalOrigin,-2);b+=2;const T=m*i8+b;let x=z.floatToByte(a.red),C=z.floatToByte(a.green),w=z.floatToByte(a.blue);const v=x*s_+C*Jl+w;x=z.floatToByte(l.red),C=z.floatToByte(l.green),w=z.floatToByte(l.blue);const P=x*s_+C*Jl+w;let N=z.floatToByte(a.alpha)*s_+z.floatToByte(l.alpha)*Jl;N+=u*2+h,e._instanced?(r=o._index,s(r,v,P,N,T)):(r=o._index*4,s(r+0,v,P,N,T),s(r+1,v,P,N,T),s(r+2,v,P,N,T),s(r+3,v,P,N,T))}function lD(e,t,n,i,o){let r;const s=i[ni.eyeOffset],a=o.eyeOffset;let l=a.z;if(o._heightReference!==gt.NONE&&(l*=1.005),e._maxEyeOffset=Math.max(e._maxEyeOffset,Math.abs(a.x),Math.abs(a.y),Math.abs(l)),e._instanced){let u=0,h=0;const f=o._imageIndex;if(f!==-1){const g=n[f];if(!c(g))throw new E(`Invalid billboard image index: ${f}`);u=g.width,h=g.height}sc.x=u,sc.y=h;const _=En.compressTextureCoordinates(sc);r=o._index,s(r,a.x,a.y,l,_)}else r=o._index*4,s(r+0,a.x,a.y,l,0),s(r+1,a.x,a.y,l,0),s(r+2,a.x,a.y,l,0),s(r+3,a.x,a.y,l,0)}function u8(e,t,n,i,o){let r;const s=i[ni.scaleByDistance];let a=0,l=1,u=1,h=1;const f=o.scaleByDistance;c(f)&&(a=f.near,l=f.nearValue,u=f.far,h=f.farValue,(l!==1||h!==1)&&(e._shaderScaleByDistance=!0)),e._instanced?(r=o._index,s(r,a,l,u,h)):(r=o._index*4,s(r+0,a,l,u,h),s(r+1,a,l,u,h),s(r+2,a,l,u,h),s(r+3,a,l,u,h))}function d8(e,t,n,i,o){let r;const s=i[ni.pixelOffsetScaleByDistance];let a=0,l=1,u=1,h=1;const f=o.pixelOffsetScaleByDistance;c(f)&&(a=f.near,l=f.nearValue,u=f.far,h=f.farValue,(l!==1||h!==1)&&(e._shaderPixelOffsetScaleByDistance=!0)),e._instanced?(r=o._index,s(r,a,l,u,h)):(r=o._index*4,s(r+0,a,l,u,h),s(r+1,a,l,u,h),s(r+2,a,l,u,h),s(r+3,a,l,u,h))}function h8(e,t,n,i,o){let r;const s=i[ni.compressedAttribute3];let a=0,l=Number.MAX_VALUE;const u=o.distanceDisplayCondition;c(u)&&(a=u.near,l=u.far,a*=a,l*=l,e._shaderDistanceDisplayCondition=!0);let h=o.disableDepthTestDistance;const f=Np(o.heightReference)&&t.context.depthTexture;c(h)||(h=f?5e3:0),h*=h,(f||h>0)&&(e._shaderDisableDepthDistance=!0,h===Number.POSITIVE_INFINITY&&(h=-1));let _,g;if(c(o._labelDimensions))g=o._labelDimensions.x,_=o._labelDimensions.y;else{let x=0,C=0;const w=o._imageIndex;if(w!==-1){const P=n[w];if(!c(P))throw new E(`Invalid billboard image index: ${w}`);x=P.height,C=P.width}_=Math.round(y(o.height,e._textureAtlas.texture.dimensions.y*x));const v=e._textureAtlas.texture.width;g=Math.round(y(o.width,v*C))}const m=Math.floor(R.clamp(g,0,gS)),b=Math.floor(R.clamp(_,0,gS)),T=m*gS+b;e._instanced?(r=o._index,s(r,a,l,h,T)):(r=o._index*4,s(r+0,a,l,h,T),s(r+1,a,l,h,T),s(r+2,a,l,h,T),s(r+3,a,l,h,T))}function f8(e,t,n,i,o){if(Np(o.heightReference)){const m=e._scene,b=t.context,T=t.globeTranslucencyState.translucent,x=c(m.globe)&&m.globe.depthTestAgainstTerrain;e._shaderClampToGround=b.depthTexture&&!T&&x}let r;const s=i[ni.textureCoordinateBoundsOrLabelTranslate];if(pt.maximumVertexTextureImageUnits>0){let m=0,b=0;c(o._labelTranslate)&&(m=o._labelTranslate.x,b=o._labelTranslate.y),e._instanced?(r=o._index,s(r,m,b,0,0)):(r=o._index*4,s(r+0,m,b,0,0),s(r+1,m,b,0,0),s(r+2,m,b,0,0),s(r+3,m,b,0,0));return}let a=0,l=0,u=0,h=0;const f=o._imageIndex;if(f!==-1){const m=n[f];if(!c(m))throw new E(`Invalid billboard image index: ${f}`);a=m.x,l=m.y,u=m.width,h=m.height}const _=a+u,g=l+h;e._instanced?(r=o._index,s(r,a,l,_,g)):(r=o._index*4,s(r+0,a,l,_,g),s(r+1,a,l,_,g),s(r+2,a,l,_,g),s(r+3,a,l,_,g))}function Mxe(e,t,n,i,o){if(!c(e._batchTable))return;const r=i[ni.a_batchId],s=o._batchIndex;let a;e._instanced?(a=o._index,r(a,s)):(a=o._index*4,r(a+0,s),r(a+1,s),r(a+2,s),r(a+3,s))}function p8(e,t,n,i,o){if(!e._sdf)return;let r;const s=i[ni.sdf],a=o.outlineColor,l=o.outlineWidth,u=z.floatToByte(a.red),h=z.floatToByte(a.green),f=z.floatToByte(a.blue),_=u*s_+h*Jl+f,g=l/Aa.RADIUS,m=z.floatToByte(a.alpha)*s_+z.floatToByte(g)*Jl;e._instanced?(r=o._index,s(r,_,m)):(r=o._index*4,s(r+0,_+o8,m),s(r+1,_+r8,m),s(r+2,_+s8,m),s(r+3,_+a8,m))}function Fxe(e,t,n,i,o){n8(e,t,n,i,o),c8(e,t,n,i,o),l8(e,t,n,i,o),cD(e,t,n,i,o),lD(e,t,n,i,o),u8(e,t,n,i,o),d8(e,t,n,i,o),h8(e,t,n,i,o),f8(e,t,n,i,o),Mxe(e,t,n,i,o),p8(e,t,n,i,o)}function yS(e,t,n,i,o,r){let s;i.mode===oe.SCENE3D?(s=e._baseVolume,e._boundingVolumeDirty=!0):s=e._baseVolume2D;const a=[];for(let l=0;l<n;++l){const u=t[l],h=u.position,f=St._computeActualPosition(u,h,i,o);c(f)&&(u._setActualPosition(f),r?a.push(f):se.expand(s,f,s))}r&&se.fromPoints(a,s)}function Bxe(e,t){const n=t.mode,i=e._billboards,o=e._billboardsToUpdate,r=e._modelMatrix;e._createVertexArray||e._mode!==n||n!==oe.SCENE3D&&!L.equals(r,e.modelMatrix)?(e._mode=n,L.clone(e.modelMatrix,r),e._createVertexArray=!0,(n===oe.SCENE3D||n===oe.SCENE2D||n===oe.COLUMBUS_VIEW)&&yS(e,i,i.length,t,r,!0)):n===oe.MORPHING?yS(e,i,i.length,t,r,!0):(n===oe.SCENE2D||n===oe.COLUMBUS_VIEW)&&yS(e,o,e._billboardsToUpdateIndex,t,r,!1)}function zxe(e,t,n){let i=1;(!e._allSizedInMeters||e._maxPixelOffset!==0)&&(i=t.camera.getPixelSize(n,t.context.drawingBufferWidth,t.context.drawingBufferHeight));let o=i*e._maxScale*e._maxSize*2;e._allHorizontalCenter&&e._allVerticalCenter&&(o*=.5);const r=i*e._maxPixelOffset+e._maxEyeOffset;n.radius+=o+r}function Uxe(e,t){const n=`uniform sampler2D billboard_texture;
|
|
in vec2 v_textureCoordinates;
|
|
void main()
|
|
{
|
|
out_FragColor = texture(billboard_texture, v_textureCoordinates);
|
|
}
|
|
`,i=t.createViewportQuadCommand(n,{uniformMap:{billboard_texture:function(){return e._textureAtlas.texture}}});return i.pass=xe.OVERLAY,i}const kxe=[];Ts.prototype.update=function(e){if(zO(this),!this.show)return;let t=this._billboards,n=t.length;const i=e.context;this._instanced=i.instancedArrays,ni=this._instanced?Sxe:wxe,mS=this._instanced?Ixe:vxe;let o=this._textureAtlas;if(!c(o)){o=this._textureAtlas=new ou({context:i});for(let M=0;M<n;++M)t[M]._loadImage()}const r=o.textureCoordinates;if(r.length===0)return;Bxe(this,e),t=this._billboards,n=t.length;const s=this._billboardsToUpdate,a=this._billboardsToUpdateIndex,l=this._propertiesChanged,u=o.guid,h=this._createVertexArray||this._textureAtlasGUID!==u;this._textureAtlasGUID=u;let f;const _=e.passes,g=_.pick;if(h||!g&&this.computeNewBuffersUsage()){this._createVertexArray=!1;for(let M=0;M<BO;++M)l[M]=0;if(this._vaf=this._vaf&&this._vaf.destroy(),n>0){this._vaf=Pxe(i,n,this._buffersUsage,this._instanced,this._batchTable,this._sdf),f=this._vaf.writers;for(let M=0;M<n;++M){const U=this._billboards[M];U._dirty=!1,Fxe(this,e,r,f,U)}this._vaf.commit(mS(i))}this._billboardsToUpdateIndex=0}else if(a>0){const M=kxe;M.length=0,(l[My]||l[Axe]||l[Txe])&&M.push(n8),(l[Rg]||l[Y5]||l[yxe]||l[bxe]||l[gxe])&&(M.push(c8),this._instanced&&M.push(lD)),(l[Rg]||l[xxe]||l[K5])&&(M.push(l8),M.push(cD)),(l[Rg]||l[X5])&&M.push(cD),l[$5]&&M.push(lD),l[Q5]&&M.push(u8),l[Z5]&&M.push(d8),(l[J5]||l[Cxe]||l[Rg]||l[My])&&M.push(h8),(l[Rg]||l[My])&&M.push(f8),l[e8]&&M.push(p8);const U=M.length;if(f=this._vaf.writers,a/n>.1){for(let B=0;B<a;++B){const S=s[B];S._dirty=!1;for(let D=0;D<U;++D)M[D](this,e,r,f,S)}this._vaf.commit(mS(i))}else{for(let B=0;B<a;++B){const S=s[B];S._dirty=!1;for(let D=0;D<U;++D)M[D](this,e,r,f,S);this._instanced?this._vaf.subCommit(S._index,1):this._vaf.subCommit(S._index*4,4)}this._vaf.endSubCommits()}this._billboardsToUpdateIndex=0}if(a>n*1.5&&(s.length=n),!c(this._vaf)||!c(this._vaf.va))return;this._boundingVolumeDirty&&(this._boundingVolumeDirty=!1,se.transform(this._baseVolume,this.modelMatrix,this._baseVolumeWC));let m,b=L.IDENTITY;e.mode===oe.SCENE3D?(b=this.modelMatrix,m=se.clone(this._baseVolumeWC,this._boundingVolume)):m=se.clone(this._baseVolume2D,this._boundingVolume),zxe(this,e,m);const T=this._blendOption!==this.blendOption;if(this._blendOption=this.blendOption,T){this._blendOption===io.OPAQUE||this._blendOption===io.OPAQUE_AND_TRANSLUCENT?this._rsOpaque=Ue.fromCache({depthTest:{enabled:!0,func:J.LESS},depthMask:!0}):this._rsOpaque=void 0;const M=this._blendOption===io.TRANSLUCENT;this._blendOption===io.TRANSLUCENT||this._blendOption===io.OPAQUE_AND_TRANSLUCENT?this._rsTranslucent=Ue.fromCache({depthTest:{enabled:!0,func:M?J.LEQUAL:J.LESS},depthMask:M,blending:Zn.ALPHA_BLEND}):this._rsTranslucent=void 0}this._shaderDisableDepthDistance=this._shaderDisableDepthDistance||e.minimumDisableDepthTestDistance!==0;let x,C,w,v,P;const N=pt.maximumVertexTextureImageUnits>0;if(T||this._shaderRotation!==this._compiledShaderRotation||this._shaderAlignedAxis!==this._compiledShaderAlignedAxis||this._shaderScaleByDistance!==this._compiledShaderScaleByDistance||this._shaderTranslucencyByDistance!==this._compiledShaderTranslucencyByDistance||this._shaderPixelOffsetScaleByDistance!==this._compiledShaderPixelOffsetScaleByDistance||this._shaderDistanceDisplayCondition!==this._compiledShaderDistanceDisplayCondition||this._shaderDisableDepthDistance!==this._compiledShaderDisableDepthDistance||this._shaderClampToGround!==this._compiledShaderClampToGround||this._sdf!==this._compiledSDF){x=txe,C=exe,P=[],c(this._batchTable)&&(P.push("VECTOR_TILE"),x=this._batchTable.getVertexShaderCallback(!1,"a_batchId",void 0)(x),C=this._batchTable.getFragmentShaderCallback(!1,void 0)(C)),w=new Oe({defines:P,sources:[x]}),this._instanced&&w.defines.push("INSTANCED"),this._shaderRotation&&w.defines.push("ROTATION"),this._shaderAlignedAxis&&w.defines.push("ALIGNED_AXIS"),this._shaderScaleByDistance&&w.defines.push("EYE_DISTANCE_SCALING"),this._shaderTranslucencyByDistance&&w.defines.push("EYE_DISTANCE_TRANSLUCENCY"),this._shaderPixelOffsetScaleByDistance&&w.defines.push("EYE_DISTANCE_PIXEL_OFFSET"),this._shaderDistanceDisplayCondition&&w.defines.push("DISTANCE_DISPLAY_CONDITION"),this._shaderDisableDepthDistance&&w.defines.push("DISABLE_DEPTH_DISTANCE"),this._shaderClampToGround&&(N?w.defines.push("VERTEX_DEPTH_CHECK"):w.defines.push("FRAGMENT_DEPTH_CHECK"));const M=1-Aa.CUTOFF;this._sdf&&w.defines.push("SDF");const U=c(this._batchTable)?"VECTOR_TILE":"";this._blendOption===io.OPAQUE_AND_TRANSLUCENT&&(v=new Oe({defines:["OPAQUE",U],sources:[C]}),this._shaderClampToGround&&(N?v.defines.push("VERTEX_DEPTH_CHECK"):v.defines.push("FRAGMENT_DEPTH_CHECK")),this._sdf&&(v.defines.push("SDF"),v.defines.push(`SDF_EDGE ${M}`)),this._sp=Jt.replaceCache({context:i,shaderProgram:this._sp,vertexShaderSource:w,fragmentShaderSource:v,attributeLocations:ni}),v=new Oe({defines:["TRANSLUCENT",U],sources:[C]}),this._shaderClampToGround&&(N?v.defines.push("VERTEX_DEPTH_CHECK"):v.defines.push("FRAGMENT_DEPTH_CHECK")),this._sdf&&(v.defines.push("SDF"),v.defines.push(`SDF_EDGE ${M}`)),this._spTranslucent=Jt.replaceCache({context:i,shaderProgram:this._spTranslucent,vertexShaderSource:w,fragmentShaderSource:v,attributeLocations:ni})),this._blendOption===io.OPAQUE&&(v=new Oe({defines:[U],sources:[C]}),this._shaderClampToGround&&(N?v.defines.push("VERTEX_DEPTH_CHECK"):v.defines.push("FRAGMENT_DEPTH_CHECK")),this._sdf&&(v.defines.push("SDF"),v.defines.push(`SDF_EDGE ${M}`)),this._sp=Jt.replaceCache({context:i,shaderProgram:this._sp,vertexShaderSource:w,fragmentShaderSource:v,attributeLocations:ni})),this._blendOption===io.TRANSLUCENT&&(v=new Oe({defines:[U],sources:[C]}),this._shaderClampToGround&&(N?v.defines.push("VERTEX_DEPTH_CHECK"):v.defines.push("FRAGMENT_DEPTH_CHECK")),this._sdf&&(v.defines.push("SDF"),v.defines.push(`SDF_EDGE ${M}`)),this._spTranslucent=Jt.replaceCache({context:i,shaderProgram:this._spTranslucent,vertexShaderSource:w,fragmentShaderSource:v,attributeLocations:ni})),this._compiledShaderRotation=this._shaderRotation,this._compiledShaderAlignedAxis=this._shaderAlignedAxis,this._compiledShaderScaleByDistance=this._shaderScaleByDistance,this._compiledShaderTranslucencyByDistance=this._shaderTranslucencyByDistance,this._compiledShaderPixelOffsetScaleByDistance=this._shaderPixelOffsetScaleByDistance,this._compiledShaderDistanceDisplayCondition=this._shaderDistanceDisplayCondition,this._compiledShaderDisableDepthDistance=this._shaderDisableDepthDistance,this._compiledShaderClampToGround=this._shaderClampToGround,this._compiledSDF=this._sdf}const k=e.commandList;if(_.render||_.pick){const M=this._colorCommands,U=this._blendOption===io.OPAQUE,B=this._blendOption===io.OPAQUE_AND_TRANSLUCENT,S=this._vaf.va,D=S.length;let p=this._uniforms,I;c(this._batchTable)?(p=this._batchTable.getUniformMapCallback()(p),I=this._batchTable.getPickId()):I="v_pickColor",M.length=D;const O=B?D*2:D;for(let F=0;F<O;++F){let V=M[F];c(V)||(V=M[F]=new Ze);const G=U||B&&F%2===0;V.pass=G||!B?xe.OPAQUE:xe.TRANSLUCENT,V.owner=this;const j=B?Math.floor(F/2):F;V.boundingVolume=m,V.modelMatrix=b,V.count=S[j].indicesCount,V.shaderProgram=G?this._sp:this._spTranslucent,V.uniformMap=p,V.vertexArray=S[j].va,V.renderState=G?this._rsOpaque:this._rsTranslucent,V.debugShowBoundingVolume=this.debugShowBoundingVolume,V.pickId=I,this._instanced&&(V.count=6,V.instanceCount=n),k.push(V)}this.debugShowTextureAtlas&&(c(this.debugCommand)||(this.debugCommand=Uxe(this,e.context)),k.push(this.debugCommand))}};Ts.prototype.isDestroyed=function(){return!1};Ts.prototype.destroy=function(){return c(this._removeCallbackFunc)&&(this._removeCallbackFunc(),this._removeCallbackFunc=void 0),this._textureAtlas=this._destroyTextureAtlas&&this._textureAtlas&&this._textureAtlas.destroy(),this._sp=this._sp&&this._sp.destroy(),this._spTranslucent=this._spTranslucent&&this._spTranslucent.destroy(),this._vaf=this._vaf&&this._vaf.destroy(),t8(this._billboards),ve(this)};function m8(e,t,n,i,o){return function(){const r=document.createElement("canvas"),s=o+2*i;r.height=r.width=s;const a=r.getContext("2d");return a.clearRect(0,0,s,s),i!==0&&(a.beginPath(),a.arc(s/2,s/2,s/2,0,2*Math.PI,!0),a.closePath(),a.fillStyle=n,a.fill(),e<1&&(a.save(),a.globalCompositeOperation="destination-out",a.beginPath(),a.arc(s/2,s/2,o/2,0,2*Math.PI,!0),a.closePath(),a.fillStyle="black",a.fill(),a.restore())),a.beginPath(),a.arc(s/2,s/2,o/2,0,2*Math.PI,!0),a.closePath(),a.fillStyle=t,a.fill(),r}}function yo(e,t,n,i,o){this._content=e,this._billboard=n,this._label=i,this._polyline=o,this._batchId=t,this._billboardImage=void 0,this._billboardColor=void 0,this._billboardOutlineColor=void 0,this._billboardOutlineWidth=void 0,this._billboardSize=void 0,this._pointSize=void 0,this._color=void 0,this._pointSize=void 0,this._pointOutlineColor=void 0,this._pointOutlineWidth=void 0,this._heightOffset=void 0,this._pickIds=new Array(3),Um(this)}const Vxe=new he;Object.defineProperties(yo.prototype,{show:{get:function(){return this._label.show},set:function(e){this._label.show=e,this._billboard.show=e,this._polyline.show=e}},color:{get:function(){return this._color},set:function(e){this._color=z.clone(e,this._color),Um(this)}},pointSize:{get:function(){return this._pointSize},set:function(e){this._pointSize=e,Um(this)}},pointOutlineColor:{get:function(){return this._pointOutlineColor},set:function(e){this._pointOutlineColor=z.clone(e,this._pointOutlineColor),Um(this)}},pointOutlineWidth:{get:function(){return this._pointOutlineWidth},set:function(e){this._pointOutlineWidth=e,Um(this)}},labelColor:{get:function(){return this._label.fillColor},set:function(e){this._label.fillColor=e,this._polyline.show=this._label.show&&e.alpha>0}},labelOutlineColor:{get:function(){return this._label.outlineColor},set:function(e){this._label.outlineColor=e}},labelOutlineWidth:{get:function(){return this._label.outlineWidth},set:function(e){this._label.outlineWidth=e}},font:{get:function(){return this._label.font},set:function(e){this._label.font=e}},labelStyle:{get:function(){return this._label.style},set:function(e){this._label.style=e}},labelText:{get:function(){return this._label.text},set:function(e){c(e)||(e=""),this._label.text=e}},backgroundColor:{get:function(){return this._label.backgroundColor},set:function(e){this._label.backgroundColor=e}},backgroundPadding:{get:function(){return this._label.backgroundPadding},set:function(e){this._label.backgroundPadding=e}},backgroundEnabled:{get:function(){return this._label.showBackground},set:function(e){this._label.showBackground=e}},scaleByDistance:{get:function(){return this._label.scaleByDistance},set:function(e){this._label.scaleByDistance=e,this._billboard.scaleByDistance=e}},translucencyByDistance:{get:function(){return this._label.translucencyByDistance},set:function(e){this._label.translucencyByDistance=e,this._billboard.translucencyByDistance=e}},distanceDisplayCondition:{get:function(){return this._label.distanceDisplayCondition},set:function(e){this._label.distanceDisplayCondition=e,this._polyline.distanceDisplayCondition=e,this._billboard.distanceDisplayCondition=e}},heightOffset:{get:function(){return this._heightOffset},set:function(e){const t=y(this._heightOffset,0),n=this._content.tileset.ellipsoid,i=n.cartesianToCartographic(this._billboard.position,Vxe);i.height=i.height-t+e;const o=n.cartographicToCartesian(i);this._billboard.position=o,this._label.position=this._billboard.position,this._polyline.positions=[this._polyline.positions[0],o],this._heightOffset=e}},anchorLineEnabled:{get:function(){return this._polyline.show},set:function(e){this._polyline.show=e}},anchorLineColor:{get:function(){return this._polyline.material.uniforms.color},set:function(e){this._polyline.material.uniforms.color=z.clone(e,this._polyline.material.uniforms.color)}},image:{get:function(){return this._billboardImage},set:function(e){const t=this._billboardImage!==e;this._billboardImage=e,t&&Um(this)}},disableDepthTestDistance:{get:function(){return this._label.disableDepthTestDistance},set:function(e){this._label.disableDepthTestDistance=e,this._billboard.disableDepthTestDistance=e}},horizontalOrigin:{get:function(){return this._billboard.horizontalOrigin},set:function(e){this._billboard.horizontalOrigin=e}},verticalOrigin:{get:function(){return this._billboard.verticalOrigin},set:function(e){this._billboard.verticalOrigin=e}},labelHorizontalOrigin:{get:function(){return this._label.horizontalOrigin},set:function(e){this._label.horizontalOrigin=e}},labelVerticalOrigin:{get:function(){return this._label.verticalOrigin},set:function(e){this._label.verticalOrigin=e}},content:{get:function(){return this._content}},tileset:{get:function(){return this._content.tileset}},primitive:{get:function(){return this._content.tileset}},pickIds:{get:function(){const e=this._pickIds;return e[0]=this._billboard.pickId,e[1]=this._label.pickId,e[2]=this._polyline.pickId,e}}});yo.defaultColor=z.WHITE;yo.defaultPointOutlineColor=z.BLACK;yo.defaultPointOutlineWidth=0;yo.defaultPointSize=8;function Um(e){const t=e._billboard;if(c(e._billboardImage)&&e._billboardImage!==t.image){t.image=e._billboardImage;return}if(c(e._billboardImage))return;const n=y(e._color,yo.defaultColor),i=y(e._pointOutlineColor,yo.defaultPointOutlineColor),o=y(e._pointOutlineWidth,yo.defaultPointOutlineWidth),r=y(e._pointSize,yo.defaultPointSize),s=e._billboardColor,a=e._billboardOutlineColor,l=e._billboardOutlineWidth,u=e._billboardSize;if(z.equals(n,s)&&z.equals(i,a)&&o===l&&r===u)return;e._billboardColor=z.clone(n,e._billboardColor),e._billboardOutlineColor=z.clone(i,e._billboardOutlineColor),e._billboardOutlineWidth=o,e._billboardSize=r;const h=n.alpha,f=n.toCssColorString(),_=i.toCssColorString(),g=JSON.stringify([f,r,_,o]);t.setImage(g,m8(h,f,_,o,r))}yo.prototype.hasProperty=function(e){return this._content.batchTable.hasProperty(this._batchId,e)};yo.prototype.getPropertyIds=function(e){return this._content.batchTable.getPropertyIds(this._batchId,e)};yo.prototype.getProperty=function(e){return this._content.batchTable.getProperty(this._batchId,e)};yo.prototype.getPropertyInherited=function(e){return Ir.getPropertyInherited(this._content,this._batchId,e)};yo.prototype.setProperty=function(e,t){this._content.batchTable.setProperty(this._batchId,e,t),this._content.featurePropertiesDirty=!0};yo.prototype.isExactClass=function(e){return this._content.batchTable.isExactClass(this._batchId,e)};yo.prototype.isClass=function(e){return this._content.batchTable.isClass(this._batchId,e)};yo.prototype.getExactClassName=function(){return this._content.batchTable.getExactClassName(this._batchId)};function Hxe(e,t,n,i,o){const r=e.measureText(t);if(!!/\S/.test(t)){const a=document.defaultView.getComputedStyle(e.canvas).getPropertyValue("font-size").replace("px",""),l=document.createElement("canvas"),u=100,h=r.width+u|0,f=3*a,_=f/2;l.width=h,l.height=f;const g=l.getContext("2d");g.font=n,g.fillStyle="white",g.fillRect(0,0,l.width+1,l.height+1),i&&(g.strokeStyle="black",g.lineWidth=e.lineWidth,g.strokeText(t,u/2,_)),o&&(g.fillStyle="black",g.fillText(t,u/2,_));const m=g.getImageData(0,0,h,f).data,b=m.length,T=h*4;let x,C,w,v;for(x=0;x<b;++x)if(m[x]!==255){w=x/T|0;break}for(x=b-1;x>=0;--x)if(m[x]!==255){v=x/T|0;break}let P=-1;for(x=0;x<h&&P===-1;++x)for(C=0;C<f;++C){const N=x*4+C*T;if(m[N]!==255||m[N+1]!==255||m[N+2]!==255||m[N+3]!==255){P=x;break}}return{width:r.width,height:v-w,ascent:_-w,descent:v-_,minx:P-u/2}}return{width:r.width,height:0,ascent:0,descent:0,minx:0}}let Af;function Gxe(e,t){if(!c(e))throw new E("text is required.");if(e==="")return;t=y(t,y.EMPTY_OBJECT);const n=y(t.font,"10px sans-serif"),i=y(t.stroke,!1),o=y(t.fill,!0),r=y(t.strokeWidth,1),s=y(t.backgroundColor,z.TRANSPARENT),a=y(t.padding,0),l=a*2,u=document.createElement("canvas");u.width=1,u.height=1,u.style.font=n;const h=u.getContext("2d",{willReadFrequently:!0});c(Af)||(c(h.imageSmoothingEnabled)?Af="imageSmoothingEnabled":c(h.mozImageSmoothingEnabled)?Af="mozImageSmoothingEnabled":c(h.webkitImageSmoothingEnabled)?Af="webkitImageSmoothingEnabled":c(h.msImageSmoothingEnabled)&&(Af="msImageSmoothingEnabled")),h.font=n,h.lineJoin="round",h.lineWidth=r,h[Af]=!1,u.style.visibility="hidden",document.body.appendChild(u);const f=Hxe(h,e,n,i,o);u.dimensions=f,document.body.removeChild(u),u.style.visibility="";const _=-f.minx,g=Math.ceil(f.width)+_+l,m=f.height+l,b=m-f.ascent+a,T=m-b+l;if(u.width=g,u.height=m,h.font=n,h.lineJoin="round",h.lineWidth=r,h[Af]=!1,s!==z.TRANSPARENT&&(h.fillStyle=s.toCssColorString(),h.fillRect(0,0,u.width,u.height)),i){const x=y(t.strokeColor,z.BLACK);h.strokeStyle=x.toCssColorString(),h.strokeText(e,_+a,T)}if(o){const x=y(t.fillColor,z.WHITE);h.fillStyle=x.toCssColorString(),h.fillText(e,_+a,T)}return u}var jxe=Wxe,Fy=1e20;function Wxe(e,t){t||(t={});var n=t.cutoff==null?.25:t.cutoff,i=t.radius==null?8:t.radius,o=t.channel||0,r,s,a,l,u,h,f,_,g,m,b;if(ArrayBuffer.isView(e)||Array.isArray(e)){if(!t.width||!t.height)throw Error("For raw data width and height should be provided by options");r=t.width,s=t.height,l=e,t.stride?h=t.stride:h=Math.floor(e.length/r/s)}else window.HTMLCanvasElement&&e instanceof window.HTMLCanvasElement?(_=e,f=_.getContext("2d"),r=_.width,s=_.height,g=f.getImageData(0,0,r,s),l=g.data,h=4):window.CanvasRenderingContext2D&&e instanceof window.CanvasRenderingContext2D?(_=e.canvas,f=e,r=_.width,s=_.height,g=f.getImageData(0,0,r,s),l=g.data,h=4):window.ImageData&&e instanceof window.ImageData&&(g=e,r=e.width,s=e.height,l=g.data,h=4);if(a=Math.max(r,s),window.Uint8ClampedArray&&l instanceof window.Uint8ClampedArray||window.Uint8Array&&l instanceof window.Uint8Array)for(u=l,l=Array(r*s),m=0,b=Math.floor(u.length/h);m<b;m++)l[m]=u[m*h+o]/255;else if(h!==1)throw Error("Raw data can have only 1 value per pixel");var T=Array(r*s),x=Array(r*s),C=Array(a),w=Array(a),v=Array(a+1),P=Array(a);for(m=0,b=r*s;m<b;m++){var N=l[m];T[m]=N===1?0:N===0?Fy:Math.pow(Math.max(0,.5-N),2),x[m]=N===1?Fy:N===0?0:Math.pow(Math.max(0,N-.5),2)}EF(T,r,s,C,w,P,v),EF(x,r,s,C,w,P,v);var k=window.Float32Array?new Float32Array(r*s):new Array(r*s);for(m=0,b=r*s;m<b;m++)k[m]=Math.min(Math.max(1-((T[m]-x[m])/i+n),0),1);return k}function EF(e,t,n,i,o,r,s){for(var a=0;a<t;a++){for(var l=0;l<n;l++)i[l]=e[l*t+a];for(wF(i,o,r,s,n),l=0;l<n;l++)e[l*t+a]=o[l]}for(l=0;l<n;l++){for(a=0;a<t;a++)i[a]=e[l*t+a];for(wF(i,o,r,s,t),a=0;a<t;a++)e[l*t+a]=Math.sqrt(o[a])}}function wF(e,t,n,i,o){n[0]=0,i[0]=-Fy,i[1]=+Fy;for(var r=1,s=0;r<o;r++){for(var a=(e[r]+r*r-(e[n[s]]+n[s]*n[s]))/(2*r-2*n[s]);a<=i[s];)s--,a=(e[r]+r*r-(e[n[s]]+n[s]*n[s]))/(2*r-2*n[s]);s++,n[s]=r,i[s]=a,i[s+1]=+Fy}for(r=0,s=0;r<o;r++){for(;i[s+1]<r;)s++;t[r]=(r-n[s])*(r-n[s])+e[n[s]]}}const qxe={FILL:0,OUTLINE:1,FILL_AND_OUTLINE:2},dl=Object.freeze(qxe),SF={};let vF=0;const Yxe=256,$xe=new z(.165,.165,.165,.8),Xxe=new H(7,5),vo=Object.freeze({LTR:0,RTL:1,WEAK:2,BRACKETS:3});function xf(e){!e._rebindAllGlyphs&&!e._repositionAllGlyphs&&e._labelCollection._labelsToUpdate.push(e),e._rebindAllGlyphs=!0}function Ng(e){!e._rebindAllGlyphs&&!e._repositionAllGlyphs&&e._labelCollection._labelsToUpdate.push(e),e._repositionAllGlyphs=!0}function Mg(e,t){return document.defaultView.getComputedStyle(e,null).getPropertyValue(t)}function _8(e){let t=SF[e._font];if(!c(t)){const n=document.createElement("div");n.style.position="absolute",n.style.opacity=0,n.style.font=e._font,document.body.appendChild(n);let i=parseFloat(Mg(n,"line-height"));isNaN(i)&&(i=void 0),t={family:Mg(n,"font-family"),size:Mg(n,"font-size").replace("px",""),style:Mg(n,"font-style"),weight:Mg(n,"font-weight"),lineHeight:i},document.body.removeChild(n),vF<Yxe&&(SF[e._font]=t,vF++)}e._fontFamily=t.family,e._fontSize=t.size,e._fontStyle=t.style,e._fontWeight=t.weight,e._lineHeight=t.lineHeight}function Tl(e,t){if(e=y(e,y.EMPTY_OBJECT),c(e.disableDepthTestDistance)&&e.disableDepthTestDistance<0)throw new E("disableDepthTestDistance must be greater than 0.0.");let n=e.translucencyByDistance,i=e.pixelOffsetScaleByDistance,o=e.scaleByDistance,r=e.distanceDisplayCondition;if(c(n)){if(n.far<=n.near)throw new E("translucencyByDistance.far must be greater than translucencyByDistance.near.");n=vt.clone(n)}if(c(i)){if(i.far<=i.near)throw new E("pixelOffsetScaleByDistance.far must be greater than pixelOffsetScaleByDistance.near.");i=vt.clone(i)}if(c(o)){if(o.far<=o.near)throw new E("scaleByDistance.far must be greater than scaleByDistance.near.");o=vt.clone(o)}if(c(r)){if(r.far<=r.near)throw new E("distanceDisplayCondition.far must be greater than distanceDisplayCondition.near.");r=Pt.clone(r)}this._renderedText=void 0,this._text=void 0,this._show=y(e.show,!0),this._font=y(e.font,"30px sans-serif"),this._fillColor=z.clone(y(e.fillColor,z.WHITE)),this._outlineColor=z.clone(y(e.outlineColor,z.BLACK)),this._outlineWidth=y(e.outlineWidth,1),this._showBackground=y(e.showBackground,!1),this._backgroundColor=z.clone(y(e.backgroundColor,$xe)),this._backgroundPadding=H.clone(y(e.backgroundPadding,Xxe)),this._style=y(e.style,dl.FILL),this._verticalOrigin=y(e.verticalOrigin,si.BASELINE),this._horizontalOrigin=y(e.horizontalOrigin,Fs.LEFT),this._pixelOffset=H.clone(y(e.pixelOffset,H.ZERO)),this._eyeOffset=d.clone(y(e.eyeOffset,d.ZERO)),this._position=d.clone(y(e.position,d.ZERO)),this._scale=y(e.scale,1),this._id=e.id,this._translucencyByDistance=n,this._pixelOffsetScaleByDistance=i,this._scaleByDistance=o,this._heightReference=y(e.heightReference,gt.NONE),this._distanceDisplayCondition=r,this._disableDepthTestDistance=e.disableDepthTestDistance,this._labelCollection=t,this._glyphs=[],this._backgroundBillboard=void 0,this._batchIndex=void 0,this._rebindAllGlyphs=!0,this._repositionAllGlyphs=!0,this._actualClampedPosition=void 0,this._removeCallbackFunc=void 0,this._mode=void 0,this._clusterShow=!0,this.text=y(e.text,""),this._relativeSize=1,_8(this),this._updateClamping()}Object.defineProperties(Tl.prototype,{show:{get:function(){return this._show},set:function(e){if(!c(e))throw new E("value is required.");if(this._show!==e){this._show=e;const t=this._glyphs;for(let i=0,o=t.length;i<o;i++){const r=t[i].billboard;c(r)&&(r.show=e)}const n=this._backgroundBillboard;c(n)&&(n.show=e)}}},position:{get:function(){return this._position},set:function(e){if(!c(e))throw new E("value is required.");const t=this._position;if(!d.equals(t,e)){d.clone(e,t);const n=this._glyphs;for(let o=0,r=n.length;o<r;o++){const s=n[o].billboard;c(s)&&(s.position=e)}const i=this._backgroundBillboard;c(i)&&(i.position=e),this._updateClamping()}}},heightReference:{get:function(){return this._heightReference},set:function(e){if(!c(e))throw new E("value is required.");if(e!==this._heightReference){this._heightReference=e;const t=this._glyphs;for(let i=0,o=t.length;i<o;i++){const r=t[i].billboard;c(r)&&(r.heightReference=e)}const n=this._backgroundBillboard;c(n)&&(n.heightReference=e),Ng(this),this._updateClamping()}}},text:{get:function(){return this._text},set:function(e){if(!c(e))throw new E("value is required.");if(this._text!==e){this._text=e;const t=e.replace(/\u00ad/g,"");this._renderedText=Tl.enableRightToLeftDetection?tCe(t):t,xf(this)}}},font:{get:function(){return this._font},set:function(e){if(!c(e))throw new E("value is required.");this._font!==e&&(this._font=e,xf(this),_8(this))}},fillColor:{get:function(){return this._fillColor},set:function(e){if(!c(e))throw new E("value is required.");const t=this._fillColor;z.equals(t,e)||(z.clone(e,t),xf(this))}},outlineColor:{get:function(){return this._outlineColor},set:function(e){if(!c(e))throw new E("value is required.");const t=this._outlineColor;z.equals(t,e)||(z.clone(e,t),xf(this))}},outlineWidth:{get:function(){return this._outlineWidth},set:function(e){if(!c(e))throw new E("value is required.");this._outlineWidth!==e&&(this._outlineWidth=e,xf(this))}},showBackground:{get:function(){return this._showBackground},set:function(e){if(!c(e))throw new E("value is required.");this._showBackground!==e&&(this._showBackground=e,xf(this))}},backgroundColor:{get:function(){return this._backgroundColor},set:function(e){if(!c(e))throw new E("value is required.");const t=this._backgroundColor;if(!z.equals(t,e)){z.clone(e,t);const n=this._backgroundBillboard;c(n)&&(n.color=t)}}},backgroundPadding:{get:function(){return this._backgroundPadding},set:function(e){if(!c(e))throw new E("value is required.");const t=this._backgroundPadding;H.equals(t,e)||(H.clone(e,t),Ng(this))}},style:{get:function(){return this._style},set:function(e){if(!c(e))throw new E("value is required.");this._style!==e&&(this._style=e,xf(this))}},pixelOffset:{get:function(){return this._pixelOffset},set:function(e){if(!c(e))throw new E("value is required.");const t=this._pixelOffset;if(!H.equals(t,e)){H.clone(e,t);const n=this._glyphs;for(let o=0,r=n.length;o<r;o++){const s=n[o];c(s.billboard)&&(s.billboard.pixelOffset=e)}const i=this._backgroundBillboard;c(i)&&(i.pixelOffset=e)}}},translucencyByDistance:{get:function(){return this._translucencyByDistance},set:function(e){if(c(e)&&e.far<=e.near)throw new E("far distance must be greater than near distance.");const t=this._translucencyByDistance;if(!vt.equals(t,e)){this._translucencyByDistance=vt.clone(e,t);const n=this._glyphs;for(let o=0,r=n.length;o<r;o++){const s=n[o];c(s.billboard)&&(s.billboard.translucencyByDistance=e)}const i=this._backgroundBillboard;c(i)&&(i.translucencyByDistance=e)}}},pixelOffsetScaleByDistance:{get:function(){return this._pixelOffsetScaleByDistance},set:function(e){if(c(e)&&e.far<=e.near)throw new E("far distance must be greater than near distance.");const t=this._pixelOffsetScaleByDistance;if(!vt.equals(t,e)){this._pixelOffsetScaleByDistance=vt.clone(e,t);const n=this._glyphs;for(let o=0,r=n.length;o<r;o++){const s=n[o];c(s.billboard)&&(s.billboard.pixelOffsetScaleByDistance=e)}const i=this._backgroundBillboard;c(i)&&(i.pixelOffsetScaleByDistance=e)}}},scaleByDistance:{get:function(){return this._scaleByDistance},set:function(e){if(c(e)&&e.far<=e.near)throw new E("far distance must be greater than near distance.");const t=this._scaleByDistance;if(!vt.equals(t,e)){this._scaleByDistance=vt.clone(e,t);const n=this._glyphs;for(let o=0,r=n.length;o<r;o++){const s=n[o];c(s.billboard)&&(s.billboard.scaleByDistance=e)}const i=this._backgroundBillboard;c(i)&&(i.scaleByDistance=e)}}},eyeOffset:{get:function(){return this._eyeOffset},set:function(e){if(!c(e))throw new E("value is required.");const t=this._eyeOffset;if(!d.equals(t,e)){d.clone(e,t);const n=this._glyphs;for(let o=0,r=n.length;o<r;o++){const s=n[o];c(s.billboard)&&(s.billboard.eyeOffset=e)}const i=this._backgroundBillboard;c(i)&&(i.eyeOffset=e)}}},horizontalOrigin:{get:function(){return this._horizontalOrigin},set:function(e){if(!c(e))throw new E("value is required.");this._horizontalOrigin!==e&&(this._horizontalOrigin=e,Ng(this))}},verticalOrigin:{get:function(){return this._verticalOrigin},set:function(e){if(!c(e))throw new E("value is required.");if(this._verticalOrigin!==e){this._verticalOrigin=e;const t=this._glyphs;for(let i=0,o=t.length;i<o;i++){const r=t[i];c(r.billboard)&&(r.billboard.verticalOrigin=e)}const n=this._backgroundBillboard;c(n)&&(n.verticalOrigin=e),Ng(this)}}},scale:{get:function(){return this._scale},set:function(e){if(!c(e))throw new E("value is required.");if(this._scale!==e){this._scale=e;const t=this._glyphs;for(let i=0,o=t.length;i<o;i++){const r=t[i];c(r.billboard)&&(r.billboard.scale=e*this._relativeSize)}const n=this._backgroundBillboard;c(n)&&(n.scale=e*this._relativeSize),Ng(this)}}},totalScale:{get:function(){return this._scale*this._relativeSize}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){if(c(e)&&e.far<=e.near)throw new E("far must be greater than near");if(!Pt.equals(e,this._distanceDisplayCondition)){this._distanceDisplayCondition=Pt.clone(e,this._distanceDisplayCondition);const t=this._glyphs;for(let i=0,o=t.length;i<o;i++){const r=t[i];c(r.billboard)&&(r.billboard.distanceDisplayCondition=e)}const n=this._backgroundBillboard;c(n)&&(n.distanceDisplayCondition=e)}}},disableDepthTestDistance:{get:function(){return this._disableDepthTestDistance},set:function(e){if(this._disableDepthTestDistance!==e){if(c(e)&&e<0)throw new E("disableDepthTestDistance must be greater than 0.0.");this._disableDepthTestDistance=e;const t=this._glyphs;for(let i=0,o=t.length;i<o;i++){const r=t[i];c(r.billboard)&&(r.billboard.disableDepthTestDistance=e)}const n=this._backgroundBillboard;c(n)&&(n.disableDepthTestDistance=e)}}},id:{get:function(){return this._id},set:function(e){if(this._id!==e){this._id=e;const t=this._glyphs;for(let i=0,o=t.length;i<o;i++){const r=t[i];c(r.billboard)&&(r.billboard.id=e)}const n=this._backgroundBillboard;c(n)&&(n.id=e)}}},pickId:{get:function(){if(!(this._glyphs.length===0||!c(this._glyphs[0].billboard)))return this._glyphs[0].billboard.pickId}},_clampedPosition:{get:function(){return this._actualClampedPosition},set:function(e){this._actualClampedPosition=d.clone(e,this._actualClampedPosition);const t=this._glyphs;for(let i=0,o=t.length;i<o;i++){const r=t[i];c(r.billboard)&&(r.billboard._clampedPosition=e)}const n=this._backgroundBillboard;c(n)&&(n._clampedPosition=e)}},clusterShow:{get:function(){return this._clusterShow},set:function(e){if(this._clusterShow!==e){this._clusterShow=e;const t=this._glyphs;for(let i=0,o=t.length;i<o;i++){const r=t[i];c(r.billboard)&&(r.billboard.clusterShow=e)}const n=this._backgroundBillboard;c(n)&&(n.clusterShow=e)}}}});Tl.prototype._updateClamping=function(){St._updateClamping(this._labelCollection,this)};Tl.prototype.computeScreenSpacePosition=function(e,t){if(!c(e))throw new E("scene is required.");c(t)||(t=new H);const i=this._labelCollection.modelMatrix,o=c(this._actualClampedPosition)?this._actualClampedPosition:this._position;return St._computeScreenSpacePosition(i,o,this._eyeOffset,this._pixelOffset,e,t)};Tl.getScreenSpaceBoundingBox=function(e,t,n){let i=0,o=0,r=0,s=0;const a=e.totalScale,l=e._backgroundBillboard;if(c(l))i=t.x+l._translate.x,o=t.y-l._translate.y,r=l.width*a,s=l.height*a,e.verticalOrigin===si.BOTTOM||e.verticalOrigin===si.BASELINE?o-=s:e.verticalOrigin===si.CENTER&&(o-=s*.5);else{i=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY;let u=0,h=0;const f=e._glyphs,_=f.length;for(let g=0;g<_;++g){const m=f[g],b=m.billboard;if(!c(b))continue;const T=t.x+b._translate.x;let x=t.y-b._translate.y;const C=m.dimensions.width*a,w=m.dimensions.height*a;e.verticalOrigin===si.BOTTOM||e.verticalOrigin===si.BASELINE?x-=w:e.verticalOrigin===si.CENTER&&(x-=w*.5),e._verticalOrigin===si.TOP?x+=Aa.PADDING*a:(e._verticalOrigin===si.BOTTOM||e._verticalOrigin===si.BASELINE)&&(x-=Aa.PADDING*a),i=Math.min(i,T),o=Math.min(o,x),u=Math.max(u,T+C),h=Math.max(h,x+w)}r=u-i,s=h-o}return c(n)||(n=new Re),n.x=i,n.y=o,n.width=r,n.height=s,n};Tl.prototype.equals=function(e){return this===e||c(e)&&this._show===e._show&&this._scale===e._scale&&this._outlineWidth===e._outlineWidth&&this._showBackground===e._showBackground&&this._style===e._style&&this._verticalOrigin===e._verticalOrigin&&this._horizontalOrigin===e._horizontalOrigin&&this._heightReference===e._heightReference&&this._renderedText===e._renderedText&&this._font===e._font&&d.equals(this._position,e._position)&&z.equals(this._fillColor,e._fillColor)&&z.equals(this._outlineColor,e._outlineColor)&&z.equals(this._backgroundColor,e._backgroundColor)&&H.equals(this._backgroundPadding,e._backgroundPadding)&&H.equals(this._pixelOffset,e._pixelOffset)&&d.equals(this._eyeOffset,e._eyeOffset)&&vt.equals(this._translucencyByDistance,e._translucencyByDistance)&&vt.equals(this._pixelOffsetScaleByDistance,e._pixelOffsetScaleByDistance)&&vt.equals(this._scaleByDistance,e._scaleByDistance)&&Pt.equals(this._distanceDisplayCondition,e._distanceDisplayCondition)&&this._disableDepthTestDistance===e._disableDepthTestDistance&&this._id===e._id};Tl.prototype.isDestroyed=function(){return!1};Tl.enableRightToLeftDetection=!1;function Qxe(e,t){const n=/[a-zA-Z0-9]/,i=/[()[\]{}<>]/,o=[];let r="",s=vo.LTR,a="";const l=e.length;for(let u=0;u<l;++u){const h=e.charAt(u);t.test(h)?a=vo.RTL:n.test(h)?a=vo.LTR:i.test(h)?a=vo.BRACKETS:a=vo.WEAK,u===0&&(s=a),s===a&&a!==vo.BRACKETS?r+=h:(r!==""&&o.push({Type:s,Word:r}),s=a,r=h)}return o.push({Type:a,Word:r}),o}function Kxe(e){return e.split("").reverse().join("")}function Fg(e,t,n){return e.slice(0,t)+n+e.slice(t)}function Zxe(e){switch(e){case"(":return")";case")":return"(";case"[":return"]";case"]":return"[";case"{":return"}";case"}":return"{";case"<":return">";case">":return"<"}}const Jxe="\u05D0-\u05EA",eCe="\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF",IF=new RegExp(`[${Jxe}${eCe}]`);function tCe(e){const t=e.split(`
|
|
`);let n="";for(let i=0;i<t.length;i++){const o=t[i],r=IF.test(o.charAt(0)),s=Qxe(o,IF);let a=0,l="";for(let u=0;u<s.length;++u){const h=s[u],f=h.Type===vo.BRACKETS?Zxe(h.Word):Kxe(h.Word);r?h.Type===vo.RTL?(l=f+l,a=0):h.Type===vo.LTR?(l=Fg(l,a,h.Word),a+=h.Word.length):(h.Type===vo.WEAK||h.Type===vo.BRACKETS)&&(h.Type===vo.WEAK&&s[u-1].Type===vo.BRACKETS?l=f+l:s[u-1].Type===vo.RTL?(l=f+l,a=0):s.length>u+1?s[u+1].Type===vo.RTL?(l=f+l,a=0):(l=Fg(l,a,h.Word),a+=h.Word.length):l=Fg(l,0,f)):h.Type===vo.RTL?l=Fg(l,a,f):h.Type===vo.LTR?(l+=h.Word,a=l.length):(h.Type===vo.WEAK||h.Type===vo.BRACKETS)&&(u>0&&s[u-1].Type===vo.RTL?s.length>u+1?s[u+1].Type===vo.RTL?l=Fg(l,a,f):(l+=h.Word,a=l.length):l+=h.Word:(l+=h.Word,a=l.length))}n+=l,i<t.length-1&&(n+=`
|
|
`)}return n}var g8={exports:{}};(function(e){function t(){var n=0,i=1,o=2,r=3,s=4,a=5,l=6,u=7,h=8,f=9,_=10,g=11,m=12,b=13,T=14,x=15,C=16,w=17,v=0,P=1,N=2,k=3,M=4;function U(p,I){return 55296<=p.charCodeAt(I)&&p.charCodeAt(I)<=56319&&56320<=p.charCodeAt(I+1)&&p.charCodeAt(I+1)<=57343}function B(p,I){I===void 0&&(I=0);var O=p.charCodeAt(I);if(55296<=O&&O<=56319&&I<p.length-1){var F=O,V=p.charCodeAt(I+1);return 56320<=V&&V<=57343?(F-55296)*1024+(V-56320)+65536:F}if(56320<=O&&O<=57343&&I>=1){var F=p.charCodeAt(I-1),V=O;return 55296<=F&&F<=56319?(F-55296)*1024+(V-56320)+65536:V}return O}function S(p,I,O){var F=[p].concat(I).concat([O]),V=F[F.length-2],G=O,j=F.lastIndexOf(T);if(j>1&&F.slice(1,j).every(function(q){return q==r})&&[r,b,w].indexOf(p)==-1)return N;var W=F.lastIndexOf(s);if(W>0&&F.slice(1,W).every(function(q){return q==s})&&[m,s].indexOf(V)==-1)return F.filter(function(q){return q==s}).length%2==1?k:M;if(V==n&&G==i)return v;if(V==o||V==n||V==i)return G==T&&I.every(function(q){return q==r})?N:P;if(G==o||G==n||G==i)return P;if(V==l&&(G==l||G==u||G==f||G==_))return v;if((V==f||V==u)&&(G==u||G==h))return v;if((V==_||V==h)&&G==h)return v;if(G==r||G==x)return v;if(G==a)return v;if(V==m)return v;var X=F.indexOf(r)!=-1?F.lastIndexOf(r)-1:F.length-2;return[b,w].indexOf(F[X])!=-1&&F.slice(X+1,-1).every(function(q){return q==r})&&G==T||V==x&&[C,w].indexOf(G)!=-1?v:I.indexOf(s)!=-1?N:V==s&&G==s?v:P}this.nextBreak=function(p,I){if(I===void 0&&(I=0),I<0)return 0;if(I>=p.length-1)return p.length;for(var O=D(B(p,I)),F=[],V=I+1;V<p.length;V++)if(!U(p,V-1)){var G=D(B(p,V));if(S(O,F,G))return V;F.push(G)}return p.length},this.splitGraphemes=function(p){for(var I=[],O=0,F;(F=this.nextBreak(p,O))<p.length;)I.push(p.slice(O,F)),O=F;return O<p.length&&I.push(p.slice(O)),I},this.iterateGraphemes=function(p){var I=0,O={next:function(){var F,V;return(V=this.nextBreak(p,I))<p.length?(F=p.slice(I,V),I=V,{value:F,done:!1}):I<p.length?(F=p.slice(I),I=p.length,{value:F,done:!1}):{value:void 0,done:!0}}.bind(this)};return typeof Symbol<"u"&&Symbol.iterator&&(O[Symbol.iterator]=function(){return O}),O},this.countGraphemes=function(p){for(var I=0,O=0,F;(F=this.nextBreak(p,O))<p.length;)O=F,I++;return O<p.length&&I++,I};function D(p){return 1536<=p&&p<=1541||p==1757||p==1807||p==2274||p==3406||p==69821||70082<=p&&p<=70083||p==72250||72326<=p&&p<=72329||p==73030?m:p==13?n:p==10?i:0<=p&&p<=9||11<=p&&p<=12||14<=p&&p<=31||127<=p&&p<=159||p==173||p==1564||p==6158||p==8203||8206<=p&&p<=8207||p==8232||p==8233||8234<=p&&p<=8238||8288<=p&&p<=8292||p==8293||8294<=p&&p<=8303||55296<=p&&p<=57343||p==65279||65520<=p&&p<=65528||65529<=p&&p<=65531||113824<=p&&p<=113827||119155<=p&&p<=119162||p==917504||p==917505||917506<=p&&p<=917535||917632<=p&&p<=917759||918e3<=p&&p<=921599?o:768<=p&&p<=879||1155<=p&&p<=1159||1160<=p&&p<=1161||1425<=p&&p<=1469||p==1471||1473<=p&&p<=1474||1476<=p&&p<=1477||p==1479||1552<=p&&p<=1562||1611<=p&&p<=1631||p==1648||1750<=p&&p<=1756||1759<=p&&p<=1764||1767<=p&&p<=1768||1770<=p&&p<=1773||p==1809||1840<=p&&p<=1866||1958<=p&&p<=1968||2027<=p&&p<=2035||2070<=p&&p<=2073||2075<=p&&p<=2083||2085<=p&&p<=2087||2089<=p&&p<=2093||2137<=p&&p<=2139||2260<=p&&p<=2273||2275<=p&&p<=2306||p==2362||p==2364||2369<=p&&p<=2376||p==2381||2385<=p&&p<=2391||2402<=p&&p<=2403||p==2433||p==2492||p==2494||2497<=p&&p<=2500||p==2509||p==2519||2530<=p&&p<=2531||2561<=p&&p<=2562||p==2620||2625<=p&&p<=2626||2631<=p&&p<=2632||2635<=p&&p<=2637||p==2641||2672<=p&&p<=2673||p==2677||2689<=p&&p<=2690||p==2748||2753<=p&&p<=2757||2759<=p&&p<=2760||p==2765||2786<=p&&p<=2787||2810<=p&&p<=2815||p==2817||p==2876||p==2878||p==2879||2881<=p&&p<=2884||p==2893||p==2902||p==2903||2914<=p&&p<=2915||p==2946||p==3006||p==3008||p==3021||p==3031||p==3072||3134<=p&&p<=3136||3142<=p&&p<=3144||3146<=p&&p<=3149||3157<=p&&p<=3158||3170<=p&&p<=3171||p==3201||p==3260||p==3263||p==3266||p==3270||3276<=p&&p<=3277||3285<=p&&p<=3286||3298<=p&&p<=3299||3328<=p&&p<=3329||3387<=p&&p<=3388||p==3390||3393<=p&&p<=3396||p==3405||p==3415||3426<=p&&p<=3427||p==3530||p==3535||3538<=p&&p<=3540||p==3542||p==3551||p==3633||3636<=p&&p<=3642||3655<=p&&p<=3662||p==3761||3764<=p&&p<=3769||3771<=p&&p<=3772||3784<=p&&p<=3789||3864<=p&&p<=3865||p==3893||p==3895||p==3897||3953<=p&&p<=3966||3968<=p&&p<=3972||3974<=p&&p<=3975||3981<=p&&p<=3991||3993<=p&&p<=4028||p==4038||4141<=p&&p<=4144||4146<=p&&p<=4151||4153<=p&&p<=4154||4157<=p&&p<=4158||4184<=p&&p<=4185||4190<=p&&p<=4192||4209<=p&&p<=4212||p==4226||4229<=p&&p<=4230||p==4237||p==4253||4957<=p&&p<=4959||5906<=p&&p<=5908||5938<=p&&p<=5940||5970<=p&&p<=5971||6002<=p&&p<=6003||6068<=p&&p<=6069||6071<=p&&p<=6077||p==6086||6089<=p&&p<=6099||p==6109||6155<=p&&p<=6157||6277<=p&&p<=6278||p==6313||6432<=p&&p<=6434||6439<=p&&p<=6440||p==6450||6457<=p&&p<=6459||6679<=p&&p<=6680||p==6683||p==6742||6744<=p&&p<=6750||p==6752||p==6754||6757<=p&&p<=6764||6771<=p&&p<=6780||p==6783||6832<=p&&p<=6845||p==6846||6912<=p&&p<=6915||p==6964||6966<=p&&p<=6970||p==6972||p==6978||7019<=p&&p<=7027||7040<=p&&p<=7041||7074<=p&&p<=7077||7080<=p&&p<=7081||7083<=p&&p<=7085||p==7142||7144<=p&&p<=7145||p==7149||7151<=p&&p<=7153||7212<=p&&p<=7219||7222<=p&&p<=7223||7376<=p&&p<=7378||7380<=p&&p<=7392||7394<=p&&p<=7400||p==7405||p==7412||7416<=p&&p<=7417||7616<=p&&p<=7673||7675<=p&&p<=7679||p==8204||8400<=p&&p<=8412||8413<=p&&p<=8416||p==8417||8418<=p&&p<=8420||8421<=p&&p<=8432||11503<=p&&p<=11505||p==11647||11744<=p&&p<=11775||12330<=p&&p<=12333||12334<=p&&p<=12335||12441<=p&&p<=12442||p==42607||42608<=p&&p<=42610||42612<=p&&p<=42621||42654<=p&&p<=42655||42736<=p&&p<=42737||p==43010||p==43014||p==43019||43045<=p&&p<=43046||43204<=p&&p<=43205||43232<=p&&p<=43249||43302<=p&&p<=43309||43335<=p&&p<=43345||43392<=p&&p<=43394||p==43443||43446<=p&&p<=43449||p==43452||p==43493||43561<=p&&p<=43566||43569<=p&&p<=43570||43573<=p&&p<=43574||p==43587||p==43596||p==43644||p==43696||43698<=p&&p<=43700||43703<=p&&p<=43704||43710<=p&&p<=43711||p==43713||43756<=p&&p<=43757||p==43766||p==44005||p==44008||p==44013||p==64286||65024<=p&&p<=65039||65056<=p&&p<=65071||65438<=p&&p<=65439||p==66045||p==66272||66422<=p&&p<=66426||68097<=p&&p<=68099||68101<=p&&p<=68102||68108<=p&&p<=68111||68152<=p&&p<=68154||p==68159||68325<=p&&p<=68326||p==69633||69688<=p&&p<=69702||69759<=p&&p<=69761||69811<=p&&p<=69814||69817<=p&&p<=69818||69888<=p&&p<=69890||69927<=p&&p<=69931||69933<=p&&p<=69940||p==70003||70016<=p&&p<=70017||70070<=p&&p<=70078||70090<=p&&p<=70092||70191<=p&&p<=70193||p==70196||70198<=p&&p<=70199||p==70206||p==70367||70371<=p&&p<=70378||70400<=p&&p<=70401||p==70460||p==70462||p==70464||p==70487||70502<=p&&p<=70508||70512<=p&&p<=70516||70712<=p&&p<=70719||70722<=p&&p<=70724||p==70726||p==70832||70835<=p&&p<=70840||p==70842||p==70845||70847<=p&&p<=70848||70850<=p&&p<=70851||p==71087||71090<=p&&p<=71093||71100<=p&&p<=71101||71103<=p&&p<=71104||71132<=p&&p<=71133||71219<=p&&p<=71226||p==71229||71231<=p&&p<=71232||p==71339||p==71341||71344<=p&&p<=71349||p==71351||71453<=p&&p<=71455||71458<=p&&p<=71461||71463<=p&&p<=71467||72193<=p&&p<=72198||72201<=p&&p<=72202||72243<=p&&p<=72248||72251<=p&&p<=72254||p==72263||72273<=p&&p<=72278||72281<=p&&p<=72283||72330<=p&&p<=72342||72344<=p&&p<=72345||72752<=p&&p<=72758||72760<=p&&p<=72765||p==72767||72850<=p&&p<=72871||72874<=p&&p<=72880||72882<=p&&p<=72883||72885<=p&&p<=72886||73009<=p&&p<=73014||p==73018||73020<=p&&p<=73021||73023<=p&&p<=73029||p==73031||92912<=p&&p<=92916||92976<=p&&p<=92982||94095<=p&&p<=94098||113821<=p&&p<=113822||p==119141||119143<=p&&p<=119145||119150<=p&&p<=119154||119163<=p&&p<=119170||119173<=p&&p<=119179||119210<=p&&p<=119213||119362<=p&&p<=119364||121344<=p&&p<=121398||121403<=p&&p<=121452||p==121461||p==121476||121499<=p&&p<=121503||121505<=p&&p<=121519||122880<=p&&p<=122886||122888<=p&&p<=122904||122907<=p&&p<=122913||122915<=p&&p<=122916||122918<=p&&p<=122922||125136<=p&&p<=125142||125252<=p&&p<=125258||917536<=p&&p<=917631||917760<=p&&p<=917999?r:127462<=p&&p<=127487?s:p==2307||p==2363||2366<=p&&p<=2368||2377<=p&&p<=2380||2382<=p&&p<=2383||2434<=p&&p<=2435||2495<=p&&p<=2496||2503<=p&&p<=2504||2507<=p&&p<=2508||p==2563||2622<=p&&p<=2624||p==2691||2750<=p&&p<=2752||p==2761||2763<=p&&p<=2764||2818<=p&&p<=2819||p==2880||2887<=p&&p<=2888||2891<=p&&p<=2892||p==3007||3009<=p&&p<=3010||3014<=p&&p<=3016||3018<=p&&p<=3020||3073<=p&&p<=3075||3137<=p&&p<=3140||3202<=p&&p<=3203||p==3262||3264<=p&&p<=3265||3267<=p&&p<=3268||3271<=p&&p<=3272||3274<=p&&p<=3275||3330<=p&&p<=3331||3391<=p&&p<=3392||3398<=p&&p<=3400||3402<=p&&p<=3404||3458<=p&&p<=3459||3536<=p&&p<=3537||3544<=p&&p<=3550||3570<=p&&p<=3571||p==3635||p==3763||3902<=p&&p<=3903||p==3967||p==4145||4155<=p&&p<=4156||4182<=p&&p<=4183||p==4228||p==6070||6078<=p&&p<=6085||6087<=p&&p<=6088||6435<=p&&p<=6438||6441<=p&&p<=6443||6448<=p&&p<=6449||6451<=p&&p<=6456||6681<=p&&p<=6682||p==6741||p==6743||6765<=p&&p<=6770||p==6916||p==6965||p==6971||6973<=p&&p<=6977||6979<=p&&p<=6980||p==7042||p==7073||7078<=p&&p<=7079||p==7082||p==7143||7146<=p&&p<=7148||p==7150||7154<=p&&p<=7155||7204<=p&&p<=7211||7220<=p&&p<=7221||p==7393||7410<=p&&p<=7411||p==7415||43043<=p&&p<=43044||p==43047||43136<=p&&p<=43137||43188<=p&&p<=43203||43346<=p&&p<=43347||p==43395||43444<=p&&p<=43445||43450<=p&&p<=43451||43453<=p&&p<=43456||43567<=p&&p<=43568||43571<=p&&p<=43572||p==43597||p==43755||43758<=p&&p<=43759||p==43765||44003<=p&&p<=44004||44006<=p&&p<=44007||44009<=p&&p<=44010||p==44012||p==69632||p==69634||p==69762||69808<=p&&p<=69810||69815<=p&&p<=69816||p==69932||p==70018||70067<=p&&p<=70069||70079<=p&&p<=70080||70188<=p&&p<=70190||70194<=p&&p<=70195||p==70197||70368<=p&&p<=70370||70402<=p&&p<=70403||p==70463||70465<=p&&p<=70468||70471<=p&&p<=70472||70475<=p&&p<=70477||70498<=p&&p<=70499||70709<=p&&p<=70711||70720<=p&&p<=70721||p==70725||70833<=p&&p<=70834||p==70841||70843<=p&&p<=70844||p==70846||p==70849||71088<=p&&p<=71089||71096<=p&&p<=71099||p==71102||71216<=p&&p<=71218||71227<=p&&p<=71228||p==71230||p==71340||71342<=p&&p<=71343||p==71350||71456<=p&&p<=71457||p==71462||72199<=p&&p<=72200||p==72249||72279<=p&&p<=72280||p==72343||p==72751||p==72766||p==72873||p==72881||p==72884||94033<=p&&p<=94078||p==119142||p==119149?a:4352<=p&&p<=4447||43360<=p&&p<=43388?l:4448<=p&&p<=4519||55216<=p&&p<=55238?u:4520<=p&&p<=4607||55243<=p&&p<=55291?h:p==44032||p==44060||p==44088||p==44116||p==44144||p==44172||p==44200||p==44228||p==44256||p==44284||p==44312||p==44340||p==44368||p==44396||p==44424||p==44452||p==44480||p==44508||p==44536||p==44564||p==44592||p==44620||p==44648||p==44676||p==44704||p==44732||p==44760||p==44788||p==44816||p==44844||p==44872||p==44900||p==44928||p==44956||p==44984||p==45012||p==45040||p==45068||p==45096||p==45124||p==45152||p==45180||p==45208||p==45236||p==45264||p==45292||p==45320||p==45348||p==45376||p==45404||p==45432||p==45460||p==45488||p==45516||p==45544||p==45572||p==45600||p==45628||p==45656||p==45684||p==45712||p==45740||p==45768||p==45796||p==45824||p==45852||p==45880||p==45908||p==45936||p==45964||p==45992||p==46020||p==46048||p==46076||p==46104||p==46132||p==46160||p==46188||p==46216||p==46244||p==46272||p==46300||p==46328||p==46356||p==46384||p==46412||p==46440||p==46468||p==46496||p==46524||p==46552||p==46580||p==46608||p==46636||p==46664||p==46692||p==46720||p==46748||p==46776||p==46804||p==46832||p==46860||p==46888||p==46916||p==46944||p==46972||p==47e3||p==47028||p==47056||p==47084||p==47112||p==47140||p==47168||p==47196||p==47224||p==47252||p==47280||p==47308||p==47336||p==47364||p==47392||p==47420||p==47448||p==47476||p==47504||p==47532||p==47560||p==47588||p==47616||p==47644||p==47672||p==47700||p==47728||p==47756||p==47784||p==47812||p==47840||p==47868||p==47896||p==47924||p==47952||p==47980||p==48008||p==48036||p==48064||p==48092||p==48120||p==48148||p==48176||p==48204||p==48232||p==48260||p==48288||p==48316||p==48344||p==48372||p==48400||p==48428||p==48456||p==48484||p==48512||p==48540||p==48568||p==48596||p==48624||p==48652||p==48680||p==48708||p==48736||p==48764||p==48792||p==48820||p==48848||p==48876||p==48904||p==48932||p==48960||p==48988||p==49016||p==49044||p==49072||p==49100||p==49128||p==49156||p==49184||p==49212||p==49240||p==49268||p==49296||p==49324||p==49352||p==49380||p==49408||p==49436||p==49464||p==49492||p==49520||p==49548||p==49576||p==49604||p==49632||p==49660||p==49688||p==49716||p==49744||p==49772||p==49800||p==49828||p==49856||p==49884||p==49912||p==49940||p==49968||p==49996||p==50024||p==50052||p==50080||p==50108||p==50136||p==50164||p==50192||p==50220||p==50248||p==50276||p==50304||p==50332||p==50360||p==50388||p==50416||p==50444||p==50472||p==50500||p==50528||p==50556||p==50584||p==50612||p==50640||p==50668||p==50696||p==50724||p==50752||p==50780||p==50808||p==50836||p==50864||p==50892||p==50920||p==50948||p==50976||p==51004||p==51032||p==51060||p==51088||p==51116||p==51144||p==51172||p==51200||p==51228||p==51256||p==51284||p==51312||p==51340||p==51368||p==51396||p==51424||p==51452||p==51480||p==51508||p==51536||p==51564||p==51592||p==51620||p==51648||p==51676||p==51704||p==51732||p==51760||p==51788||p==51816||p==51844||p==51872||p==51900||p==51928||p==51956||p==51984||p==52012||p==52040||p==52068||p==52096||p==52124||p==52152||p==52180||p==52208||p==52236||p==52264||p==52292||p==52320||p==52348||p==52376||p==52404||p==52432||p==52460||p==52488||p==52516||p==52544||p==52572||p==52600||p==52628||p==52656||p==52684||p==52712||p==52740||p==52768||p==52796||p==52824||p==52852||p==52880||p==52908||p==52936||p==52964||p==52992||p==53020||p==53048||p==53076||p==53104||p==53132||p==53160||p==53188||p==53216||p==53244||p==53272||p==53300||p==53328||p==53356||p==53384||p==53412||p==53440||p==53468||p==53496||p==53524||p==53552||p==53580||p==53608||p==53636||p==53664||p==53692||p==53720||p==53748||p==53776||p==53804||p==53832||p==53860||p==53888||p==53916||p==53944||p==53972||p==54e3||p==54028||p==54056||p==54084||p==54112||p==54140||p==54168||p==54196||p==54224||p==54252||p==54280||p==54308||p==54336||p==54364||p==54392||p==54420||p==54448||p==54476||p==54504||p==54532||p==54560||p==54588||p==54616||p==54644||p==54672||p==54700||p==54728||p==54756||p==54784||p==54812||p==54840||p==54868||p==54896||p==54924||p==54952||p==54980||p==55008||p==55036||p==55064||p==55092||p==55120||p==55148||p==55176?f:44033<=p&&p<=44059||44061<=p&&p<=44087||44089<=p&&p<=44115||44117<=p&&p<=44143||44145<=p&&p<=44171||44173<=p&&p<=44199||44201<=p&&p<=44227||44229<=p&&p<=44255||44257<=p&&p<=44283||44285<=p&&p<=44311||44313<=p&&p<=44339||44341<=p&&p<=44367||44369<=p&&p<=44395||44397<=p&&p<=44423||44425<=p&&p<=44451||44453<=p&&p<=44479||44481<=p&&p<=44507||44509<=p&&p<=44535||44537<=p&&p<=44563||44565<=p&&p<=44591||44593<=p&&p<=44619||44621<=p&&p<=44647||44649<=p&&p<=44675||44677<=p&&p<=44703||44705<=p&&p<=44731||44733<=p&&p<=44759||44761<=p&&p<=44787||44789<=p&&p<=44815||44817<=p&&p<=44843||44845<=p&&p<=44871||44873<=p&&p<=44899||44901<=p&&p<=44927||44929<=p&&p<=44955||44957<=p&&p<=44983||44985<=p&&p<=45011||45013<=p&&p<=45039||45041<=p&&p<=45067||45069<=p&&p<=45095||45097<=p&&p<=45123||45125<=p&&p<=45151||45153<=p&&p<=45179||45181<=p&&p<=45207||45209<=p&&p<=45235||45237<=p&&p<=45263||45265<=p&&p<=45291||45293<=p&&p<=45319||45321<=p&&p<=45347||45349<=p&&p<=45375||45377<=p&&p<=45403||45405<=p&&p<=45431||45433<=p&&p<=45459||45461<=p&&p<=45487||45489<=p&&p<=45515||45517<=p&&p<=45543||45545<=p&&p<=45571||45573<=p&&p<=45599||45601<=p&&p<=45627||45629<=p&&p<=45655||45657<=p&&p<=45683||45685<=p&&p<=45711||45713<=p&&p<=45739||45741<=p&&p<=45767||45769<=p&&p<=45795||45797<=p&&p<=45823||45825<=p&&p<=45851||45853<=p&&p<=45879||45881<=p&&p<=45907||45909<=p&&p<=45935||45937<=p&&p<=45963||45965<=p&&p<=45991||45993<=p&&p<=46019||46021<=p&&p<=46047||46049<=p&&p<=46075||46077<=p&&p<=46103||46105<=p&&p<=46131||46133<=p&&p<=46159||46161<=p&&p<=46187||46189<=p&&p<=46215||46217<=p&&p<=46243||46245<=p&&p<=46271||46273<=p&&p<=46299||46301<=p&&p<=46327||46329<=p&&p<=46355||46357<=p&&p<=46383||46385<=p&&p<=46411||46413<=p&&p<=46439||46441<=p&&p<=46467||46469<=p&&p<=46495||46497<=p&&p<=46523||46525<=p&&p<=46551||46553<=p&&p<=46579||46581<=p&&p<=46607||46609<=p&&p<=46635||46637<=p&&p<=46663||46665<=p&&p<=46691||46693<=p&&p<=46719||46721<=p&&p<=46747||46749<=p&&p<=46775||46777<=p&&p<=46803||46805<=p&&p<=46831||46833<=p&&p<=46859||46861<=p&&p<=46887||46889<=p&&p<=46915||46917<=p&&p<=46943||46945<=p&&p<=46971||46973<=p&&p<=46999||47001<=p&&p<=47027||47029<=p&&p<=47055||47057<=p&&p<=47083||47085<=p&&p<=47111||47113<=p&&p<=47139||47141<=p&&p<=47167||47169<=p&&p<=47195||47197<=p&&p<=47223||47225<=p&&p<=47251||47253<=p&&p<=47279||47281<=p&&p<=47307||47309<=p&&p<=47335||47337<=p&&p<=47363||47365<=p&&p<=47391||47393<=p&&p<=47419||47421<=p&&p<=47447||47449<=p&&p<=47475||47477<=p&&p<=47503||47505<=p&&p<=47531||47533<=p&&p<=47559||47561<=p&&p<=47587||47589<=p&&p<=47615||47617<=p&&p<=47643||47645<=p&&p<=47671||47673<=p&&p<=47699||47701<=p&&p<=47727||47729<=p&&p<=47755||47757<=p&&p<=47783||47785<=p&&p<=47811||47813<=p&&p<=47839||47841<=p&&p<=47867||47869<=p&&p<=47895||47897<=p&&p<=47923||47925<=p&&p<=47951||47953<=p&&p<=47979||47981<=p&&p<=48007||48009<=p&&p<=48035||48037<=p&&p<=48063||48065<=p&&p<=48091||48093<=p&&p<=48119||48121<=p&&p<=48147||48149<=p&&p<=48175||48177<=p&&p<=48203||48205<=p&&p<=48231||48233<=p&&p<=48259||48261<=p&&p<=48287||48289<=p&&p<=48315||48317<=p&&p<=48343||48345<=p&&p<=48371||48373<=p&&p<=48399||48401<=p&&p<=48427||48429<=p&&p<=48455||48457<=p&&p<=48483||48485<=p&&p<=48511||48513<=p&&p<=48539||48541<=p&&p<=48567||48569<=p&&p<=48595||48597<=p&&p<=48623||48625<=p&&p<=48651||48653<=p&&p<=48679||48681<=p&&p<=48707||48709<=p&&p<=48735||48737<=p&&p<=48763||48765<=p&&p<=48791||48793<=p&&p<=48819||48821<=p&&p<=48847||48849<=p&&p<=48875||48877<=p&&p<=48903||48905<=p&&p<=48931||48933<=p&&p<=48959||48961<=p&&p<=48987||48989<=p&&p<=49015||49017<=p&&p<=49043||49045<=p&&p<=49071||49073<=p&&p<=49099||49101<=p&&p<=49127||49129<=p&&p<=49155||49157<=p&&p<=49183||49185<=p&&p<=49211||49213<=p&&p<=49239||49241<=p&&p<=49267||49269<=p&&p<=49295||49297<=p&&p<=49323||49325<=p&&p<=49351||49353<=p&&p<=49379||49381<=p&&p<=49407||49409<=p&&p<=49435||49437<=p&&p<=49463||49465<=p&&p<=49491||49493<=p&&p<=49519||49521<=p&&p<=49547||49549<=p&&p<=49575||49577<=p&&p<=49603||49605<=p&&p<=49631||49633<=p&&p<=49659||49661<=p&&p<=49687||49689<=p&&p<=49715||49717<=p&&p<=49743||49745<=p&&p<=49771||49773<=p&&p<=49799||49801<=p&&p<=49827||49829<=p&&p<=49855||49857<=p&&p<=49883||49885<=p&&p<=49911||49913<=p&&p<=49939||49941<=p&&p<=49967||49969<=p&&p<=49995||49997<=p&&p<=50023||50025<=p&&p<=50051||50053<=p&&p<=50079||50081<=p&&p<=50107||50109<=p&&p<=50135||50137<=p&&p<=50163||50165<=p&&p<=50191||50193<=p&&p<=50219||50221<=p&&p<=50247||50249<=p&&p<=50275||50277<=p&&p<=50303||50305<=p&&p<=50331||50333<=p&&p<=50359||50361<=p&&p<=50387||50389<=p&&p<=50415||50417<=p&&p<=50443||50445<=p&&p<=50471||50473<=p&&p<=50499||50501<=p&&p<=50527||50529<=p&&p<=50555||50557<=p&&p<=50583||50585<=p&&p<=50611||50613<=p&&p<=50639||50641<=p&&p<=50667||50669<=p&&p<=50695||50697<=p&&p<=50723||50725<=p&&p<=50751||50753<=p&&p<=50779||50781<=p&&p<=50807||50809<=p&&p<=50835||50837<=p&&p<=50863||50865<=p&&p<=50891||50893<=p&&p<=50919||50921<=p&&p<=50947||50949<=p&&p<=50975||50977<=p&&p<=51003||51005<=p&&p<=51031||51033<=p&&p<=51059||51061<=p&&p<=51087||51089<=p&&p<=51115||51117<=p&&p<=51143||51145<=p&&p<=51171||51173<=p&&p<=51199||51201<=p&&p<=51227||51229<=p&&p<=51255||51257<=p&&p<=51283||51285<=p&&p<=51311||51313<=p&&p<=51339||51341<=p&&p<=51367||51369<=p&&p<=51395||51397<=p&&p<=51423||51425<=p&&p<=51451||51453<=p&&p<=51479||51481<=p&&p<=51507||51509<=p&&p<=51535||51537<=p&&p<=51563||51565<=p&&p<=51591||51593<=p&&p<=51619||51621<=p&&p<=51647||51649<=p&&p<=51675||51677<=p&&p<=51703||51705<=p&&p<=51731||51733<=p&&p<=51759||51761<=p&&p<=51787||51789<=p&&p<=51815||51817<=p&&p<=51843||51845<=p&&p<=51871||51873<=p&&p<=51899||51901<=p&&p<=51927||51929<=p&&p<=51955||51957<=p&&p<=51983||51985<=p&&p<=52011||52013<=p&&p<=52039||52041<=p&&p<=52067||52069<=p&&p<=52095||52097<=p&&p<=52123||52125<=p&&p<=52151||52153<=p&&p<=52179||52181<=p&&p<=52207||52209<=p&&p<=52235||52237<=p&&p<=52263||52265<=p&&p<=52291||52293<=p&&p<=52319||52321<=p&&p<=52347||52349<=p&&p<=52375||52377<=p&&p<=52403||52405<=p&&p<=52431||52433<=p&&p<=52459||52461<=p&&p<=52487||52489<=p&&p<=52515||52517<=p&&p<=52543||52545<=p&&p<=52571||52573<=p&&p<=52599||52601<=p&&p<=52627||52629<=p&&p<=52655||52657<=p&&p<=52683||52685<=p&&p<=52711||52713<=p&&p<=52739||52741<=p&&p<=52767||52769<=p&&p<=52795||52797<=p&&p<=52823||52825<=p&&p<=52851||52853<=p&&p<=52879||52881<=p&&p<=52907||52909<=p&&p<=52935||52937<=p&&p<=52963||52965<=p&&p<=52991||52993<=p&&p<=53019||53021<=p&&p<=53047||53049<=p&&p<=53075||53077<=p&&p<=53103||53105<=p&&p<=53131||53133<=p&&p<=53159||53161<=p&&p<=53187||53189<=p&&p<=53215||53217<=p&&p<=53243||53245<=p&&p<=53271||53273<=p&&p<=53299||53301<=p&&p<=53327||53329<=p&&p<=53355||53357<=p&&p<=53383||53385<=p&&p<=53411||53413<=p&&p<=53439||53441<=p&&p<=53467||53469<=p&&p<=53495||53497<=p&&p<=53523||53525<=p&&p<=53551||53553<=p&&p<=53579||53581<=p&&p<=53607||53609<=p&&p<=53635||53637<=p&&p<=53663||53665<=p&&p<=53691||53693<=p&&p<=53719||53721<=p&&p<=53747||53749<=p&&p<=53775||53777<=p&&p<=53803||53805<=p&&p<=53831||53833<=p&&p<=53859||53861<=p&&p<=53887||53889<=p&&p<=53915||53917<=p&&p<=53943||53945<=p&&p<=53971||53973<=p&&p<=53999||54001<=p&&p<=54027||54029<=p&&p<=54055||54057<=p&&p<=54083||54085<=p&&p<=54111||54113<=p&&p<=54139||54141<=p&&p<=54167||54169<=p&&p<=54195||54197<=p&&p<=54223||54225<=p&&p<=54251||54253<=p&&p<=54279||54281<=p&&p<=54307||54309<=p&&p<=54335||54337<=p&&p<=54363||54365<=p&&p<=54391||54393<=p&&p<=54419||54421<=p&&p<=54447||54449<=p&&p<=54475||54477<=p&&p<=54503||54505<=p&&p<=54531||54533<=p&&p<=54559||54561<=p&&p<=54587||54589<=p&&p<=54615||54617<=p&&p<=54643||54645<=p&&p<=54671||54673<=p&&p<=54699||54701<=p&&p<=54727||54729<=p&&p<=54755||54757<=p&&p<=54783||54785<=p&&p<=54811||54813<=p&&p<=54839||54841<=p&&p<=54867||54869<=p&&p<=54895||54897<=p&&p<=54923||54925<=p&&p<=54951||54953<=p&&p<=54979||54981<=p&&p<=55007||55009<=p&&p<=55035||55037<=p&&p<=55063||55065<=p&&p<=55091||55093<=p&&p<=55119||55121<=p&&p<=55147||55149<=p&&p<=55175||55177<=p&&p<=55203?_:p==9757||p==9977||9994<=p&&p<=9997||p==127877||127938<=p&&p<=127940||p==127943||127946<=p&&p<=127948||128066<=p&&p<=128067||128070<=p&&p<=128080||p==128110||128112<=p&&p<=128120||p==128124||128129<=p&&p<=128131||128133<=p&&p<=128135||p==128170||128372<=p&&p<=128373||p==128378||p==128400||128405<=p&&p<=128406||128581<=p&&p<=128583||128587<=p&&p<=128591||p==128675||128692<=p&&p<=128694||p==128704||p==128716||129304<=p&&p<=129308||129310<=p&&p<=129311||p==129318||129328<=p&&p<=129337||129341<=p&&p<=129342||129489<=p&&p<=129501?b:127995<=p&&p<=127999?T:p==8205?x:p==9792||p==9794||9877<=p&&p<=9878||p==9992||p==10084||p==127752||p==127806||p==127859||p==127891||p==127908||p==127912||p==127979||p==127981||p==128139||128187<=p&&p<=128188||p==128295||p==128300||p==128488||p==128640||p==128658?C:128102<=p&&p<=128105?w:g}return this}e.exports&&(e.exports=t)})(g8);const nCe=g8.exports;function iCe(){this.textureInfo=void 0,this.dimensions=void 0,this.billboard=void 0}function oCe(e,t,n){this.labelCollection=e,this.index=t,this.dimensions=n}const rCe=1.2,y8="ID_WHITE_PIXEL",uD=new H(4,4),sCe=new Re(1,1,1,1);function aCe(e){const t=document.createElement("canvas");t.width=uD.x,t.height=uD.y;const n=t.getContext("2d");return n.fillStyle="#fff",n.fillRect(0,0,t.width,t.height),e.addImage(y8,t)}const Ja={};function cCe(e,t,n,i,o,r,s){return Ja.font=t,Ja.fillColor=n,Ja.strokeColor=i,Ja.strokeWidth=o,Ja.padding=Aa.PADDING,s===si.CENTER?Ja.textBaseline="middle":s===si.TOP?Ja.textBaseline="top":Ja.textBaseline="bottom",Ja.fill=r===dl.FILL||r===dl.FILL_AND_OUTLINE,Ja.stroke=r===dl.OUTLINE||r===dl.FILL_AND_OUTLINE,Ja.backgroundColor=z.BLACK,Gxe(e,Ja)}function dD(e,t){t.textureInfo=void 0,t.dimensions=void 0;const n=t.billboard;c(n)&&(n.show=!1,n.image=void 0,c(n._removeCallbackFunc)&&(n._removeCallbackFunc(),n._removeCallbackFunc=void 0),e._spareBillboards.push(n),t.billboard=void 0)}function lCe(e,t,n,i){i.index=e.addImageSync(t,n)}const uCe=new nCe;function dCe(e,t){const n=t._renderedText,i=uCe.splitGraphemes(n),o=i.length,r=t._glyphs,s=r.length;let a,l,u;if(t._relativeSize=t._fontSize/Aa.FONT_SIZE,o<s)for(l=o;l<s;++l)dD(e,r[l]);r.length=o;const h=t.show&&t._showBackground&&n.split(`
|
|
`).join("").length>0;let f=t._backgroundBillboard;const _=e._backgroundBillboardCollection;h?(c(f)||(f=_.add({collection:e,image:y8,imageSubRegion:sCe}),t._backgroundBillboard=f),f.color=t._backgroundColor,f.show=t._show,f.position=t._position,f.eyeOffset=t._eyeOffset,f.pixelOffset=t._pixelOffset,f.horizontalOrigin=Fs.LEFT,f.verticalOrigin=t._verticalOrigin,f.heightReference=t._heightReference,f.scale=t.totalScale,f.pickPrimitive=t,f.id=t._id,f.translucencyByDistance=t._translucencyByDistance,f.pixelOffsetScaleByDistance=t._pixelOffsetScaleByDistance,f.scaleByDistance=t._scaleByDistance,f.distanceDisplayCondition=t._distanceDisplayCondition,f.disableDepthTestDistance=t._disableDepthTestDistance,f.clusterShow=t.clusterShow):c(f)&&(_.remove(f),t._backgroundBillboard=f=void 0);const g=e._glyphTextureCache;for(u=0;u<o;++u){const m=i[u],b=t._verticalOrigin,T=JSON.stringify([m,t._fontFamily,t._fontStyle,t._fontWeight,+b]);let x=g[T];if(!c(x)){const C=`${t._fontStyle} ${t._fontWeight} ${Aa.FONT_SIZE}px ${t._fontFamily}`,w=cCe(m,C,z.WHITE,z.WHITE,0,dl.FILL,b);if(x=new oCe(e,-1,w.dimensions),g[T]=x,w.width>0&&w.height>0){const v=jxe(w,{cutoff:Aa.CUTOFF,radius:Aa.RADIUS}),P=w.getContext("2d"),N=w.width,k=w.height,M=P.getImageData(0,0,N,k);for(let U=0;U<N;U++)for(let B=0;B<k;B++){const S=B*N+U,D=v[S]*255,p=S*4;M.data[p+0]=D,M.data[p+1]=D,M.data[p+2]=D,M.data[p+3]=D}P.putImageData(M,0,0),m!==" "&&lCe(e._textureAtlas,T,w,x)}}if(a=r[u],c(a)?x.index===-1?dD(e,a):c(a.textureInfo)&&(a.textureInfo=void 0):(a=new iCe,r[u]=a),a.textureInfo=x,a.dimensions=x.dimensions,x.index!==-1){let C=a.billboard;const w=e._spareBillboards;c(C)||(w.length>0?C=w.pop():(C=e._billboardCollection.add({collection:e}),C._labelDimensions=new H,C._labelTranslate=new H),a.billboard=C),C.show=t._show,C.position=t._position,C.eyeOffset=t._eyeOffset,C.pixelOffset=t._pixelOffset,C.horizontalOrigin=Fs.LEFT,C.verticalOrigin=t._verticalOrigin,C.heightReference=t._heightReference,C.scale=t.totalScale,C.pickPrimitive=t,C.id=t._id,C.image=T,C.translucencyByDistance=t._translucencyByDistance,C.pixelOffsetScaleByDistance=t._pixelOffsetScaleByDistance,C.scaleByDistance=t._scaleByDistance,C.distanceDisplayCondition=t._distanceDisplayCondition,C.disableDepthTestDistance=t._disableDepthTestDistance,C._batchIndex=t._batchIndex,C.outlineColor=t.outlineColor,t.style===dl.FILL_AND_OUTLINE?(C.color=t._fillColor,C.outlineWidth=t.outlineWidth):t.style===dl.FILL?(C.color=t._fillColor,C.outlineWidth=0):t.style===dl.OUTLINE&&(C.color=z.TRANSPARENT,C.outlineWidth=t.outlineWidth)}}t._repositionAllGlyphs=!0}function DF(e,t,n){return t===Fs.CENTER?-e/2:t===Fs.RIGHT?-(e+n.x):n.x}const Mi=new H,hCe=new H;function fCe(e){const t=e._glyphs,n=e._renderedText;let i,o,r=0,s=0;const a=[];let l=Number.NEGATIVE_INFINITY,u=0,h=1,f;const _=t.length,g=e._backgroundBillboard,m=H.clone(c(g)?e._backgroundPadding:H.ZERO,hCe);for(m.x/=e._relativeSize,m.y/=e._relativeSize,f=0;f<_;++f)n.charAt(f)===`
|
|
`?(a.push(r),++h,r=0):(i=t[f],o=i.dimensions,u=Math.max(u,o.height-o.descent),l=Math.max(l,o.descent),r+=o.width-o.minx,f<_-1&&(r+=t[f+1].dimensions.minx),s=Math.max(s,r));a.push(r);const b=u+l,T=e.totalScale,x=e._horizontalOrigin,C=e._verticalOrigin;let w=0,v=a[w],P=DF(v,x,m);const N=(c(e._lineHeight)?e._lineHeight:rCe*e._fontSize)/e._relativeSize,k=N*(h-1);let M=s,U=b+k;c(g)&&(M+=m.x*2,U+=m.y*2,g._labelHorizontalOrigin=x),Mi.x=P*T,Mi.y=0;let B=!0,S=0;for(f=0;f<_;++f)if(n.charAt(f)===`
|
|
`)++w,S+=N,v=a[w],P=DF(v,x,m),Mi.x=P*T,B=!0;else if(i=t[f],o=i.dimensions,C===si.TOP?(Mi.y=o.height-u-m.y,Mi.y+=Aa.PADDING):C===si.CENTER?Mi.y=(k+o.height-u)/2:C===si.BASELINE?(Mi.y=k,Mi.y-=Aa.PADDING):(Mi.y=k+l+m.y,Mi.y-=Aa.PADDING),Mi.y=(Mi.y-o.descent-S)*T,B&&(Mi.x-=Aa.PADDING*T,B=!1),c(i.billboard)&&(i.billboard._setTranslate(Mi),i.billboard._labelDimensions.x=M,i.billboard._labelDimensions.y=U,i.billboard._labelHorizontalOrigin=x),f<_-1){const D=t[f+1];Mi.x+=(o.width-o.minx+D.dimensions.minx)*T}if(c(g)&&n.split(`
|
|
`).join("").length>0&&(x===Fs.CENTER?P=-s/2-m.x:x===Fs.RIGHT?P=-(s+m.x*2):P=0,Mi.x=P*T,C===si.TOP?Mi.y=b-u-l:C===si.CENTER?Mi.y=(b-u)/2-l:C===si.BASELINE?Mi.y=-m.y-l:Mi.y=0,Mi.y=Mi.y*T,g.width=M,g.height=U,g._setTranslate(Mi),g._labelTranslate=H.clone(Mi,g._labelTranslate)),Np(e.heightReference))for(f=0;f<_;++f){i=t[f];const D=i.billboard;c(D)&&(D._labelTranslate=H.clone(Mi,D._labelTranslate))}}function b8(e,t){const n=t._glyphs;for(let i=0,o=n.length;i<o;++i)dD(e,n[i]);c(t._backgroundBillboard)&&(e._backgroundBillboardCollection.remove(t._backgroundBillboard),t._backgroundBillboard=void 0),t._labelCollection=void 0,c(t._removeCallbackFunc)&&t._removeCallbackFunc(),ve(t)}function Ga(e){e=y(e,y.EMPTY_OBJECT),this._scene=e.scene,this._batchTable=e.batchTable,this._textureAtlas=void 0,this._backgroundTextureAtlas=void 0,this._backgroundBillboardCollection=new Ts({scene:this._scene}),this._backgroundBillboardCollection.destroyTextureAtlas=!1,this._billboardCollection=new Ts({scene:this._scene,batchTable:this._batchTable}),this._billboardCollection.destroyTextureAtlas=!1,this._billboardCollection._sdf=!0,this._spareBillboards=[],this._glyphTextureCache={},this._labels=[],this._labelsToUpdate=[],this._totalGlyphCount=0,this._highlightColor=z.clone(z.WHITE),this.show=y(e.show,!0),this.modelMatrix=L.clone(y(e.modelMatrix,L.IDENTITY)),this.debugShowBoundingVolume=y(e.debugShowBoundingVolume,!1),this.blendOption=y(e.blendOption,io.OPAQUE_AND_TRANSLUCENT)}Object.defineProperties(Ga.prototype,{length:{get:function(){return this._labels.length}}});Ga.prototype.add=function(e){const t=new Tl(e,this);return this._labels.push(t),this._labelsToUpdate.push(t),t};Ga.prototype.remove=function(e){if(c(e)&&e._labelCollection===this){const t=this._labels.indexOf(e);if(t!==-1)return this._labels.splice(t,1),b8(this,e),!0}return!1};Ga.prototype.removeAll=function(){const e=this._labels;for(let t=0,n=e.length;t<n;++t)b8(this,e[t]);e.length=0};Ga.prototype.contains=function(e){return c(e)&&e._labelCollection===this};Ga.prototype.get=function(e){if(!c(e))throw new E("index is required.");return this._labels[e]};Ga.prototype.update=function(e){if(!this.show)return;const t=this._billboardCollection,n=this._backgroundBillboardCollection;t.modelMatrix=this.modelMatrix,t.debugShowBoundingVolume=this.debugShowBoundingVolume,n.modelMatrix=this.modelMatrix,n.debugShowBoundingVolume=this.debugShowBoundingVolume;const i=e.context;c(this._textureAtlas)||(this._textureAtlas=new ou({context:i}),t.textureAtlas=this._textureAtlas),c(this._backgroundTextureAtlas)||(this._backgroundTextureAtlas=new ou({context:i,initialSize:uD}),n.textureAtlas=this._backgroundTextureAtlas,aCe(this._backgroundTextureAtlas));const o=this._labelsToUpdate.length;for(let s=0;s<o;++s){const a=this._labelsToUpdate[s];if(a.isDestroyed())continue;const l=a._glyphs.length;a._rebindAllGlyphs&&(dCe(this,a),a._rebindAllGlyphs=!1),a._repositionAllGlyphs&&(fCe(a),a._repositionAllGlyphs=!1);const u=a._glyphs.length-l;this._totalGlyphCount+=u}const r=n.length>0?io.TRANSLUCENT:this.blendOption;t.blendOption=r,n.blendOption=r,t._highlightColor=this._highlightColor,n._highlightColor=this._highlightColor,this._labelsToUpdate.length=0,n.update(e),t.update(e)};Ga.prototype.isDestroyed=function(){return!1};Ga.prototype.destroy=function(){return this.removeAll(),this._billboardCollection=this._billboardCollection.destroy(),this._textureAtlas=this._textureAtlas&&this._textureAtlas.destroy(),this._backgroundBillboardCollection=this._backgroundBillboardCollection.destroy(),this._backgroundTextureAtlas=this._backgroundTextureAtlas&&this._backgroundTextureAtlas.destroy(),ve(this)};const pCe=`in vec3 position3DHigh;
|
|
in vec3 position3DLow;
|
|
in vec3 position2DHigh;
|
|
in vec3 position2DLow;
|
|
in vec3 prevPosition3DHigh;
|
|
in vec3 prevPosition3DLow;
|
|
in vec3 prevPosition2DHigh;
|
|
in vec3 prevPosition2DLow;
|
|
in vec3 nextPosition3DHigh;
|
|
in vec3 nextPosition3DLow;
|
|
in vec3 nextPosition2DHigh;
|
|
in vec3 nextPosition2DLow;
|
|
in vec4 texCoordExpandAndBatchIndex;
|
|
|
|
out vec2 v_st;
|
|
out float v_width;
|
|
out vec4 v_pickColor;
|
|
out float v_polylineAngle;
|
|
|
|
void main()
|
|
{
|
|
float texCoord = texCoordExpandAndBatchIndex.x;
|
|
float expandDir = texCoordExpandAndBatchIndex.y;
|
|
bool usePrev = texCoordExpandAndBatchIndex.z < 0.0;
|
|
float batchTableIndex = texCoordExpandAndBatchIndex.w;
|
|
|
|
vec2 widthAndShow = batchTable_getWidthAndShow(batchTableIndex);
|
|
float width = widthAndShow.x + 0.5;
|
|
float show = widthAndShow.y;
|
|
|
|
if (width < 1.0)
|
|
{
|
|
show = 0.0;
|
|
}
|
|
|
|
vec4 pickColor = batchTable_getPickColor(batchTableIndex);
|
|
|
|
vec4 p, prev, next;
|
|
if (czm_morphTime == 1.0)
|
|
{
|
|
p = czm_translateRelativeToEye(position3DHigh.xyz, position3DLow.xyz);
|
|
prev = czm_translateRelativeToEye(prevPosition3DHigh.xyz, prevPosition3DLow.xyz);
|
|
next = czm_translateRelativeToEye(nextPosition3DHigh.xyz, nextPosition3DLow.xyz);
|
|
}
|
|
else if (czm_morphTime == 0.0)
|
|
{
|
|
p = czm_translateRelativeToEye(position2DHigh.zxy, position2DLow.zxy);
|
|
prev = czm_translateRelativeToEye(prevPosition2DHigh.zxy, prevPosition2DLow.zxy);
|
|
next = czm_translateRelativeToEye(nextPosition2DHigh.zxy, nextPosition2DLow.zxy);
|
|
}
|
|
else
|
|
{
|
|
p = czm_columbusViewMorph(
|
|
czm_translateRelativeToEye(position2DHigh.zxy, position2DLow.zxy),
|
|
czm_translateRelativeToEye(position3DHigh.xyz, position3DLow.xyz),
|
|
czm_morphTime);
|
|
prev = czm_columbusViewMorph(
|
|
czm_translateRelativeToEye(prevPosition2DHigh.zxy, prevPosition2DLow.zxy),
|
|
czm_translateRelativeToEye(prevPosition3DHigh.xyz, prevPosition3DLow.xyz),
|
|
czm_morphTime);
|
|
next = czm_columbusViewMorph(
|
|
czm_translateRelativeToEye(nextPosition2DHigh.zxy, nextPosition2DLow.zxy),
|
|
czm_translateRelativeToEye(nextPosition3DHigh.xyz, nextPosition3DLow.xyz),
|
|
czm_morphTime);
|
|
}
|
|
|
|
#ifdef DISTANCE_DISPLAY_CONDITION
|
|
vec3 centerHigh = batchTable_getCenterHigh(batchTableIndex);
|
|
vec4 centerLowAndRadius = batchTable_getCenterLowAndRadius(batchTableIndex);
|
|
vec3 centerLow = centerLowAndRadius.xyz;
|
|
float radius = centerLowAndRadius.w;
|
|
vec2 distanceDisplayCondition = batchTable_getDistanceDisplayCondition(batchTableIndex);
|
|
|
|
float lengthSq;
|
|
if (czm_sceneMode == czm_sceneMode2D)
|
|
{
|
|
lengthSq = czm_eyeHeight2D.y;
|
|
}
|
|
else
|
|
{
|
|
vec4 center = czm_translateRelativeToEye(centerHigh.xyz, centerLow.xyz);
|
|
lengthSq = max(0.0, dot(center.xyz, center.xyz) - radius * radius);
|
|
}
|
|
|
|
float nearSq = distanceDisplayCondition.x * distanceDisplayCondition.x;
|
|
float farSq = distanceDisplayCondition.y * distanceDisplayCondition.y;
|
|
if (lengthSq < nearSq || lengthSq > farSq)
|
|
{
|
|
show = 0.0;
|
|
}
|
|
#endif
|
|
|
|
float polylineAngle;
|
|
vec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, polylineAngle);
|
|
gl_Position = czm_viewportOrthographic * positionWC * show;
|
|
|
|
v_st.s = texCoord;
|
|
v_st.t = czm_writeNonPerspective(clamp(expandDir, 0.0, 1.0), gl_Position.w);
|
|
|
|
v_width = width;
|
|
v_pickColor = pickColor;
|
|
v_polylineAngle = polylineAngle;
|
|
}
|
|
`,ks={};ks.numberOfPoints=function(e,t,n){const i=d.distance(e,t);return Math.ceil(i/n)};ks.numberOfPointsRhumbLine=function(e,t,n){const i=Math.pow(e.longitude-t.longitude,2)+Math.pow(e.latitude-t.latitude,2);return Math.max(1,Math.ceil(Math.sqrt(i/(n*n))))};const mCe=new he;ks.extractHeights=function(e,t){const n=e.length,i=new Array(n);for(let o=0;o<n;o++){const r=e[o];i[o]=t.cartesianToCartographic(r,mCe).height}return i};const _Ce=new L,gCe=new d,PF=new d,yCe=new _t(d.UNIT_X,0),OF=new d,bCe=new _t(d.UNIT_X,0),TCe=new d,ACe=new d,UO=[];function T8(e,t,n){const i=UO;i.length=e;let o;if(t===n){for(o=0;o<e;o++)i[o]=t;return i}const s=(n-t)/e;for(o=0;o<e;o++){const a=t+o*s;i[o]=a}return i}const UC=new he,Wx=new he,Mh=new d,kO=new d,xCe=new d,bS=new Mp;let Bg=new vr;function CCe(e,t,n,i,o,r,s,a){const l=i.scaleToGeodeticSurface(e,kO),u=i.scaleToGeodeticSurface(t,xCe),h=ks.numberOfPoints(e,t,n),f=i.cartesianToCartographic(l,UC),_=i.cartesianToCartographic(u,Wx),g=T8(h,o,r);bS.setEndPoints(f,_);const m=bS.surfaceDistance/h;let b=a;f.height=o;let T=i.cartographicToCartesian(f,Mh);d.pack(T,s,b),b+=3;for(let x=1;x<h;x++){const C=bS.interpolateUsingSurfaceDistance(x*m,Wx);C.height=g[x],T=i.cartographicToCartesian(C,Mh),d.pack(T,s,b),b+=3}return b}function ECe(e,t,n,i,o,r,s,a){const l=i.cartesianToCartographic(e,UC),u=i.cartesianToCartographic(t,Wx),h=ks.numberOfPointsRhumbLine(l,u,n);l.height=0,u.height=0;const f=T8(h,o,r);Bg.ellipsoid.equals(i)||(Bg=new vr(void 0,void 0,i)),Bg.setEndPoints(l,u);const _=Bg.surfaceDistance/h;let g=a;l.height=o;let m=i.cartographicToCartesian(l,Mh);d.pack(m,s,g),g+=3;for(let b=1;b<h;b++){const T=Bg.interpolateUsingSurfaceDistance(b*_,Wx);T.height=f[b],m=i.cartographicToCartesian(T,Mh),d.pack(m,s,g),g+=3}return g}ks.wrapLongitude=function(e,t){const n=[],i=[];if(c(e)&&e.length>0){t=y(t,L.IDENTITY);const o=L.inverseTransformation(t,_Ce),r=L.multiplyByPoint(o,d.ZERO,gCe),s=d.normalize(L.multiplyByPointAsVector(o,d.UNIT_Y,PF),PF),a=_t.fromPointNormal(r,s,yCe),l=d.normalize(L.multiplyByPointAsVector(o,d.UNIT_X,OF),OF),u=_t.fromPointNormal(r,l,bCe);let h=1;n.push(d.clone(e[0]));let f=n[0];const _=e.length;for(let g=1;g<_;++g){const m=e[g];if(_t.getPointDistance(u,f)<0||_t.getPointDistance(u,m)<0){const b=Ei.lineSegmentPlane(f,m,a,TCe);if(c(b)){const T=d.multiplyByScalar(s,5e-9,ACe);_t.getPointDistance(a,f)<0&&d.negate(T,T),n.push(d.add(b,T,new d)),i.push(h+1),d.negate(T,T),n.push(d.add(b,T,new d)),h=1}}n.push(d.clone(e[g])),h++,f=m}i.push(h)}return{positions:n,lengths:i}};ks.generateArc=function(e){c(e)||(e={});const t=e.positions;if(!c(t))throw new E("options.positions is required.");const n=t.length,i=y(e.ellipsoid,ae.WGS84);let o=y(e.height,0);const r=Array.isArray(o);if(n<1)return[];if(n===1){const b=i.scaleToGeodeticSurface(t[0],kO);if(o=r?o[0]:o,o!==0){const T=i.geodeticSurfaceNormal(b,Mh);d.multiplyByScalar(T,o,T),d.add(b,T,b)}return[b.x,b.y,b.z]}let s=e.minDistance;if(!c(s)){const b=y(e.granularity,R.RADIANS_PER_DEGREE);s=R.chordLength(b,i.maximumRadius)}let a=0,l;for(l=0;l<n-1;l++)a+=ks.numberOfPoints(t[l],t[l+1],s);const u=(a+1)*3,h=new Array(u);let f=0;for(l=0;l<n-1;l++){const b=t[l],T=t[l+1],x=r?o[l]:o,C=r?o[l+1]:o;f=CCe(b,T,s,i,x,C,h,f)}UO.length=0;const _=t[n-1],g=i.cartesianToCartographic(_,UC);g.height=r?o[n-1]:o;const m=i.cartographicToCartesian(g,Mh);return d.pack(m,h,u-3),h};const LF=new he,wCe=new he;ks.generateRhumbArc=function(e){c(e)||(e={});const t=e.positions;if(!c(t))throw new E("options.positions is required.");const n=t.length,i=y(e.ellipsoid,ae.WGS84);let o=y(e.height,0);const r=Array.isArray(o);if(n<1)return[];if(n===1){const x=i.scaleToGeodeticSurface(t[0],kO);if(o=r?o[0]:o,o!==0){const C=i.geodeticSurfaceNormal(x,Mh);d.multiplyByScalar(C,o,C),d.add(x,C,x)}return[x.x,x.y,x.z]}const s=y(e.granularity,R.RADIANS_PER_DEGREE);let a=0,l,u=i.cartesianToCartographic(t[0],LF),h;for(l=0;l<n-1;l++)h=i.cartesianToCartographic(t[l+1],wCe),a+=ks.numberOfPointsRhumbLine(u,h,s),u=he.clone(h,LF);const f=(a+1)*3,_=new Array(f);let g=0;for(l=0;l<n-1;l++){const x=t[l],C=t[l+1],w=r?o[l]:o,v=r?o[l+1]:o;g=ECe(x,C,s,i,w,v,_,g)}UO.length=0;const m=t[n-1],b=i.cartesianToCartographic(m,UC);b.height=r?o[n-1]:o;const T=i.cartographicToCartesian(b,Mh);return d.pack(T,_,f-3),_};ks.generateCartesianArc=function(e){const t=ks.generateArc(e),n=t.length/3,i=new Array(n);for(let o=0;o<n;o++)i[o]=d.unpack(t,o*3);return i};ks.generateCartesianRhumbArc=function(e){const t=ks.generateRhumbArc(e),n=t.length/3,i=new Array(n);for(let o=0;o<n;o++)i[o]=d.unpack(t,o*3);return i};const Io=ks;function $o(e,t){e=y(e,y.EMPTY_OBJECT),this._show=y(e.show,!0),this._width=y(e.width,1),this._loop=y(e.loop,!1),this._distanceDisplayCondition=e.distanceDisplayCondition,this._material=e.material,c(this._material)||(this._material=Se.fromType(Se.ColorType,{color:new z(1,1,1,1)}));let n=e.positions;c(n)||(n=[]),this._positions=n,this._actualPositions=gs(n,d.equalsEpsilon),this._loop&&this._actualPositions.length>2&&(this._actualPositions===this._positions&&(this._actualPositions=n.slice()),this._actualPositions.push(d.clone(this._actualPositions[0]))),this._length=this._actualPositions.length,this._id=e.id;let i;c(t)&&(i=L.clone(t.modelMatrix)),this._modelMatrix=i,this._segments=Io.wrapLongitude(this._actualPositions,i),this._actualLength=void 0,this._propertiesChanged=new Uint32Array(x8),this._polylineCollection=t,this._dirty=!1,this._pickId=void 0,this._boundingVolume=se.fromPoints(this._actualPositions),this._boundingVolumeWC=se.transform(this._boundingVolume,this._modelMatrix),this._boundingVolume2D=new se}const A8=$o.POSITION_INDEX=0,SCe=$o.SHOW_INDEX=1,vCe=$o.WIDTH_INDEX=2,ICe=$o.MATERIAL_INDEX=3,By=$o.POSITION_SIZE_INDEX=4,DCe=$o.DISTANCE_DISPLAY_CONDITION=5,x8=$o.NUMBER_OF_PROPERTIES=6;function Bu(e,t){++e._propertiesChanged[t];const n=e._polylineCollection;c(n)&&(n._updatePolyline(e,t),e._dirty=!0)}Object.defineProperties($o.prototype,{show:{get:function(){return this._show},set:function(e){if(!c(e))throw new E("value is required.");e!==this._show&&(this._show=e,Bu(this,SCe))}},positions:{get:function(){return this._positions},set:function(e){if(!c(e))throw new E("value is required.");let t=gs(e,d.equalsEpsilon);this._loop&&t.length>2&&(t===e&&(t=e.slice()),t.push(d.clone(t[0]))),(this._actualPositions.length!==t.length||this._actualPositions.length!==this._length)&&Bu(this,By),this._positions=e,this._actualPositions=t,this._length=t.length,this._boundingVolume=se.fromPoints(this._actualPositions,this._boundingVolume),this._boundingVolumeWC=se.transform(this._boundingVolume,this._modelMatrix,this._boundingVolumeWC),Bu(this,A8),this.update()}},material:{get:function(){return this._material},set:function(e){if(!c(e))throw new E("material is required.");this._material!==e&&(this._material=e,Bu(this,ICe))}},width:{get:function(){return this._width},set:function(e){if(!c(e))throw new E("value is required.");const t=this._width;e!==t&&(this._width=e,Bu(this,vCe))}},loop:{get:function(){return this._loop},set:function(e){if(!c(e))throw new E("value is required.");if(e!==this._loop){let t=this._actualPositions;e?t.length>2&&!d.equals(t[0],t[t.length-1])&&(t.length===this._positions.length&&(this._actualPositions=t=this._positions.slice()),t.push(d.clone(t[0]))):t.length>2&&d.equals(t[0],t[t.length-1])&&(t.length-1===this._positions.length?this._actualPositions=this._positions:t.pop()),this._loop=e,Bu(this,By)}}},id:{get:function(){return this._id},set:function(e){this._id=e,c(this._pickId)&&(this._pickId.object.id=e)}},pickId:{get:function(){return this._pickId}},isDestroyed:{get:function(){return!c(this._polylineCollection)}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){if(c(e)&&e.far<=e.near)throw new E("far distance must be greater than near distance.");Pt.equals(e,this._distanceDisplayCondition)||(this._distanceDisplayCondition=Pt.clone(e,this._distanceDisplayCondition),Bu(this,DCe))}}});$o.prototype.update=function(){let e=L.IDENTITY;c(this._polylineCollection)&&(e=this._polylineCollection.modelMatrix);const t=this._segments.positions.length,n=this._segments.lengths,i=this._propertiesChanged[A8]>0||this._propertiesChanged[By]>0;if((!L.equals(e,this._modelMatrix)||i)&&(this._segments=Io.wrapLongitude(this._actualPositions,e),this._boundingVolumeWC=se.transform(this._boundingVolume,e,this._boundingVolumeWC)),this._modelMatrix=L.clone(e,this._modelMatrix),this._segments.positions.length!==t)Bu(this,By);else{const o=n.length;for(let r=0;r<o;++r)if(n[r]!==this._segments.lengths[r]){Bu(this,By);break}}};$o.prototype.getPickId=function(e){return c(this._pickId)||(this._pickId=e.createPickId({primitive:this,collection:this._polylineCollection,id:this._id})),this._pickId};$o.prototype._clean=function(){this._dirty=!1;const e=this._propertiesChanged;for(let t=0;t<x8-1;++t)e[t]=0};$o.prototype._destroy=function(){this._pickId=this._pickId&&this._pickId.destroy(),this._material=this._material&&this._material.destroy(),this._polylineCollection=void 0};const PCe=$o.SHOW_INDEX,OCe=$o.WIDTH_INDEX,hD=$o.POSITION_INDEX,LCe=$o.MATERIAL_INDEX,RF=$o.POSITION_SIZE_INDEX,RCe=$o.DISTANCE_DISPLAY_CONDITION,C8=$o.NUMBER_OF_PROPERTIES,Js={texCoordExpandAndBatchIndex:0,position3DHigh:1,position3DLow:2,position2DHigh:3,position2DLow:4,prevPosition3DHigh:5,prevPosition3DLow:6,prevPosition2DHigh:7,prevPosition2DLow:8,nextPosition3DHigh:9,nextPosition3DLow:10,nextPosition2DHigh:11,nextPosition2DLow:12};function la(e){e=y(e,y.EMPTY_OBJECT),this.show=y(e.show,!0),this.modelMatrix=L.clone(y(e.modelMatrix,L.IDENTITY)),this._modelMatrix=L.clone(L.IDENTITY),this.debugShowBoundingVolume=y(e.debugShowBoundingVolume,!1),this._opaqueRS=void 0,this._translucentRS=void 0,this._colorCommands=[],this._polylinesUpdated=!1,this._polylinesRemoved=!1,this._createVertexArray=!1,this._propertiesChanged=new Uint32Array(C8),this._polylines=[],this._polylineBuckets={},this._positionBufferUsage={bufferUsage:ke.STATIC_DRAW,frameCount:0},this._mode=void 0,this._polylinesToUpdate=[],this._vertexArrays=[],this._positionBuffer=void 0,this._texCoordExpandAndBatchIndexBuffer=void 0,this._batchTable=void 0,this._createBatchTable=!1,this._useHighlightColor=!1,this._highlightColor=z.clone(z.WHITE);const t=this;this._uniformMap={u_highlightColor:function(){return t._highlightColor}}}Object.defineProperties(la.prototype,{length:{get:function(){return VO(this),this._polylines.length}}});la.prototype.add=function(e){const t=new $o(e,this);return t._index=this._polylines.length,this._polylines.push(t),this._createVertexArray=!0,this._createBatchTable=!0,t};la.prototype.remove=function(e){if(this.contains(e)){if(this._polylinesRemoved=!0,this._createVertexArray=!0,this._createBatchTable=!0,c(e._bucket)){const t=e._bucket;t.shaderProgram=t.shaderProgram&&t.shaderProgram.destroy()}return e._destroy(),!0}return!1};la.prototype.removeAll=function(){HO(this),I8(this),this._polylineBuckets={},this._polylinesRemoved=!1,this._polylines.length=0,this._polylinesToUpdate.length=0,this._createVertexArray=!0};la.prototype.contains=function(e){return c(e)&&e._polylineCollection===this};la.prototype.get=function(e){if(!c(e))throw new E("index is required.");return VO(this),this._polylines[e]};function NCe(e,t){c(e._batchTable)&&e._batchTable.destroy();const n=[{functionName:"batchTable_getWidthAndShow",componentDatatype:Z.UNSIGNED_BYTE,componentsPerAttribute:2},{functionName:"batchTable_getPickColor",componentDatatype:Z.UNSIGNED_BYTE,componentsPerAttribute:4,normalize:!0},{functionName:"batchTable_getCenterHigh",componentDatatype:Z.FLOAT,componentsPerAttribute:3},{functionName:"batchTable_getCenterLowAndRadius",componentDatatype:Z.FLOAT,componentsPerAttribute:4},{functionName:"batchTable_getDistanceDisplayCondition",componentDatatype:Z.FLOAT,componentsPerAttribute:2}];e._batchTable=new uu(t,n,e._polylines.length)}const E8=new rn,w8=new te,S8=new H;la.prototype.update=function(e){if(VO(this),this._polylines.length===0||!this.show)return;kCe(this,e);const t=e.context,n=e.mapProjection;let i,o=this._propertiesChanged;if(this._createBatchTable){if(pt.maximumVertexTextureImageUnits===0)throw new Te("Vertex texture fetch support is required to render polylines. The maximum number of vertex texture image units must be greater than zero.");NCe(this,t),this._createBatchTable=!1}if(this._createVertexArray||FCe(this))FF(this,t,n);else if(this._polylinesUpdated){const l=this._polylinesToUpdate;if(this._mode!==oe.SCENE3D){const u=l.length;for(let h=0;h<u;++h)i=l[h],i.update()}if(o[RF]||o[LCe])FF(this,t,n);else{const u=l.length,h=this._polylineBuckets;for(let f=0;f<u;++f){i=l[f],o=i._propertiesChanged;const _=i._bucket;let g=0;for(const m in h)if(h.hasOwnProperty(m)){if(h[m]===_){o[hD]&&_.writeUpdate(g,i,this._positionBuffer,n);break}g+=h[m].lengthOfPositions}if((o[PCe]||o[OCe])&&this._batchTable.setBatchedAttribute(i._index,0,new H(i._width,i._show)),this._batchTable.attributes.length>2){if(o[hD]||o[RF]){const m=e.mode===oe.SCENE2D?i._boundingVolume2D:i._boundingVolumeWC,b=rn.fromCartesian(m.center,E8),T=te.fromElements(b.low.x,b.low.y,b.low.z,m.radius,w8);this._batchTable.setBatchedAttribute(i._index,2,b.high),this._batchTable.setBatchedAttribute(i._index,3,T)}if(o[RCe]){const m=S8;m.x=0,m.y=Number.MAX_VALUE;const b=i.distanceDisplayCondition;c(b)&&(m.x=b.near,m.y=b.far),this._batchTable.setBatchedAttribute(i._index,4,m)}}i._clean()}}l.length=0,this._polylinesUpdated=!1}o=this._propertiesChanged;for(let l=0;l<C8;++l)o[l]=0;let r=L.IDENTITY;e.mode===oe.SCENE3D&&(r=this.modelMatrix);const s=e.passes,a=e.morphTime!==0;if((!c(this._opaqueRS)||this._opaqueRS.depthTest.enabled!==a)&&(this._opaqueRS=Ue.fromCache({depthMask:a,depthTest:{enabled:a}})),(!c(this._translucentRS)||this._translucentRS.depthTest.enabled!==a)&&(this._translucentRS=Ue.fromCache({blending:Zn.ALPHA_BLEND,depthMask:!a,depthTest:{enabled:a}})),this._batchTable.update(e),s.render||s.pick){const l=this._colorCommands;MCe(this,e,l,r)}};const zg=new se,NF=new se;function MCe(e,t,n,i){const o=t.context,r=t.commandList,s=n.length;let a=0,l=!0;const u=e._vertexArrays,h=e.debugShowBoundingVolume,_=e._batchTable.getUniformMapCallback(),g=u.length;for(let m=0;m<g;++m){const b=u[m],T=b.buckets,x=T.length;for(let C=0;C<x;++C){const w=T[C];let v=w.offset;const P=w.bucket.shaderProgram,N=w.bucket.polylines,k=N.length;let M,U,B=0,S,D;for(let p=0;p<k;++p){const I=N[p],O=zCe(I._material);if(O!==M){if(c(M)&&B>0){const j=U.isTranslucent();a>=s?(S=new Ze({owner:e}),n.push(S)):S=n[a],++a,D=jt(_(U._uniforms),e._uniformMap),S.boundingVolume=se.clone(zg,S.boundingVolume),S.modelMatrix=i,S.shaderProgram=P,S.vertexArray=b.va,S.renderState=j?e._translucentRS:e._opaqueRS,S.pass=j?xe.TRANSLUCENT:xe.OPAQUE,S.debugShowBoundingVolume=h,S.pickId="v_pickColor",S.uniformMap=D,S.count=B,S.offset=v,v+=B,B=0,l=!0,r.push(S)}U=I._material,U.update(o),M=O}const F=I._locatorBuckets,V=F.length;for(let j=0;j<V;++j){const W=F[j];W.locator===w&&(B+=W.count)}let G;t.mode===oe.SCENE3D?G=I._boundingVolumeWC:t.mode===oe.COLUMBUS_VIEW?G=I._boundingVolume2D:t.mode===oe.SCENE2D?c(I._boundingVolume2D)&&(G=se.clone(I._boundingVolume2D,NF),G.center.x=0):c(I._boundingVolumeWC)&&c(I._boundingVolume2D)&&(G=se.union(I._boundingVolumeWC,I._boundingVolume2D,NF)),l?(l=!1,se.clone(G,zg)):se.union(G,zg,zg)}c(M)&&B>0&&(a>=s?(S=new Ze({owner:e}),n.push(S)):S=n[a],++a,D=jt(_(U._uniforms),e._uniformMap),S.boundingVolume=se.clone(zg,S.boundingVolume),S.modelMatrix=i,S.shaderProgram=P,S.vertexArray=b.va,S.renderState=U.isTranslucent()?e._translucentRS:e._opaqueRS,S.pass=U.isTranslucent()?xe.TRANSLUCENT:xe.OPAQUE,S.debugShowBoundingVolume=h,S.pickId="v_pickColor",S.uniformMap=D,S.count=B,S.offset=v,l=!0,r.push(S)),M=void 0}}n.length=a}la.prototype.isDestroyed=function(){return!1};la.prototype.destroy=function(){return v8(this),HO(this),I8(this),this._batchTable=this._batchTable&&this._batchTable.destroy(),ve(this)};function FCe(e){let t=!1;const n=e._propertiesChanged,i=e._positionBufferUsage;return n[hD]?(i.bufferUsage!==ke.STREAM_DRAW&&(t=!0,i.bufferUsage=ke.STREAM_DRAW),i.frameCount=100):i.bufferUsage!==ke.STATIC_DRAW&&(i.frameCount===0?(t=!0,i.bufferUsage=ke.STATIC_DRAW):i.frameCount--),t}const MF=[0,0,0];function FF(e,t,n){e._createVertexArray=!1,HO(e),v8(e),UCe(e);const i=[[]];let o=i[0];const r=e._batchTable,s=e._useHighlightColor,a=[0];let l=0;const u=[[]];let h=0;const f=e._polylineBuckets;let _,g;for(_ in f)f.hasOwnProperty(_)&&(g=f[_],g.updateShader(t,r,s),h+=g.lengthOfPositions);if(h>0){const m=e._mode,b=new Float32Array(6*h*3),T=new Float32Array(h*4);let x,C=0,w=0,v=0;for(_ in f)if(f.hasOwnProperty(_)){g=f[_],g.write(b,T,C,w,v,r,t,n),m===oe.MORPHING&&(c(x)||(x=new Float32Array(6*h*3)),g.writeForMorph(x,C));const D=g.lengthOfPositions;C+=6*D*3,w+=D*4,v+=D*4,l=g.updateIndices(i,a,u,l)}const P=e._positionBufferUsage.bufferUsage,N=ke.STATIC_DRAW;e._positionBuffer=ct.createVertexBuffer({context:t,typedArray:b,usage:P});let k;c(x)&&(k=ct.createVertexBuffer({context:t,typedArray:x,usage:P})),e._texCoordExpandAndBatchIndexBuffer=ct.createVertexBuffer({context:t,typedArray:T,usage:N});const M=3*Float32Array.BYTES_PER_ELEMENT,U=4*Float32Array.BYTES_PER_ELEMENT;let B=0;const S=i.length;for(let D=0;D<S;++D)if(o=i[D],o.length>0){const p=new Uint16Array(o),I=ct.createIndexBuffer({context:t,typedArray:p,usage:ke.STATIC_DRAW,indexDatatype:je.UNSIGNED_SHORT});B+=a[D];const O=6*(D*(M*R.SIXTY_FOUR_KILOBYTES)-B*M),F=M+O,V=M+F,G=M+V,j=M+G,W=M+j,X=D*(U*R.SIXTY_FOUR_KILOBYTES)-B*U,q=[{index:Js.position3DHigh,componentsPerAttribute:3,componentDatatype:Z.FLOAT,offsetInBytes:O,strideInBytes:6*M},{index:Js.position3DLow,componentsPerAttribute:3,componentDatatype:Z.FLOAT,offsetInBytes:F,strideInBytes:6*M},{index:Js.position2DHigh,componentsPerAttribute:3,componentDatatype:Z.FLOAT,offsetInBytes:O,strideInBytes:6*M},{index:Js.position2DLow,componentsPerAttribute:3,componentDatatype:Z.FLOAT,offsetInBytes:F,strideInBytes:6*M},{index:Js.prevPosition3DHigh,componentsPerAttribute:3,componentDatatype:Z.FLOAT,offsetInBytes:V,strideInBytes:6*M},{index:Js.prevPosition3DLow,componentsPerAttribute:3,componentDatatype:Z.FLOAT,offsetInBytes:G,strideInBytes:6*M},{index:Js.prevPosition2DHigh,componentsPerAttribute:3,componentDatatype:Z.FLOAT,offsetInBytes:V,strideInBytes:6*M},{index:Js.prevPosition2DLow,componentsPerAttribute:3,componentDatatype:Z.FLOAT,offsetInBytes:G,strideInBytes:6*M},{index:Js.nextPosition3DHigh,componentsPerAttribute:3,componentDatatype:Z.FLOAT,offsetInBytes:j,strideInBytes:6*M},{index:Js.nextPosition3DLow,componentsPerAttribute:3,componentDatatype:Z.FLOAT,offsetInBytes:W,strideInBytes:6*M},{index:Js.nextPosition2DHigh,componentsPerAttribute:3,componentDatatype:Z.FLOAT,offsetInBytes:j,strideInBytes:6*M},{index:Js.nextPosition2DLow,componentsPerAttribute:3,componentDatatype:Z.FLOAT,offsetInBytes:W,strideInBytes:6*M},{index:Js.texCoordExpandAndBatchIndex,componentsPerAttribute:4,componentDatatype:Z.FLOAT,vertexBuffer:e._texCoordExpandAndBatchIndexBuffer,offsetInBytes:X}];let ee,Y,ne,Q;m===oe.SCENE3D?(Y=e._positionBuffer,ee="vertexBuffer",ne=MF,Q="value"):m===oe.SCENE2D||m===oe.COLUMBUS_VIEW?(Y=MF,ee="value",ne=e._positionBuffer,Q="vertexBuffer"):(Y=k,ee="vertexBuffer",ne=e._positionBuffer,Q="vertexBuffer"),q[0][ee]=Y,q[1][ee]=Y,q[2][Q]=ne,q[3][Q]=ne,q[4][ee]=Y,q[5][ee]=Y,q[6][Q]=ne,q[7][Q]=ne,q[8][ee]=Y,q[9][ee]=Y,q[10][Q]=ne,q[11][Q]=ne;const le=new Ci({context:t,attributes:q,indexBuffer:I});e._vertexArrays.push({va:le,buckets:u[D]})}}}function BCe(e,t){return t instanceof xt?t.id:t}const AT=[];function zCe(e){const t=Se._uniformList[e.type],n=t.length;AT.length=2*n;let i=0;for(let o=0;o<n;++o){const r=t[o];AT[i]=r,AT[i+1]=e._uniforms[r](),i+=2}return`${e.type}:${JSON.stringify(AT,BCe)}`}function UCe(e){const t=e._mode,n=e._modelMatrix,i=e._polylineBuckets={},o=e._polylines,r=o.length;for(let s=0;s<r;++s){const a=o[s];if(a._actualPositions.length>1){a.update();const l=a.material;let u=i[l.type];c(u)||(u=i[l.type]=new bu(l,t,n)),u.addPolyline(a)}}}function kCe(e,t){const n=t.mode;(e._mode!==n||!L.equals(e._modelMatrix,e.modelMatrix))&&(e._mode=n,e._modelMatrix=L.clone(e.modelMatrix),e._createVertexArray=!0)}function VO(e){if(e._polylinesRemoved){e._polylinesRemoved=!1;const t=[],n=[];let i=0,o;const r=e._polylines.length;for(let s=0;s<r;++s)o=e._polylines[s],o.isDestroyed||(o._index=i++,n.push(o),t.push(o));e._polylines=t,e._polylinesToUpdate=n}}function HO(e){const t=e._polylines,n=t.length;for(let i=0;i<n;++i)if(!t[i].isDestroyed){const o=t[i]._bucket;c(o)&&(o.shaderProgram=o.shaderProgram&&o.shaderProgram.destroy())}}function v8(e){const t=e._vertexArrays.length;for(let n=0;n<t;++n)e._vertexArrays[n].va.destroy();e._vertexArrays.length=0}la.prototype._updatePolyline=function(e,t){this._polylinesUpdated=!0,e._dirty||this._polylinesToUpdate.push(e),++this._propertiesChanged[t]};function I8(e){const t=e._polylines,n=t.length;for(let i=0;i<n;++i)t[i].isDestroyed||t[i]._destroy()}function TS(e,t,n){this.count=e,this.offset=t,this.bucket=n}function bu(e,t,n){this.polylines=[],this.lengthOfPositions=0,this.material=e,this.shaderProgram=void 0,this.mode=t,this.modelMatrix=n}bu.prototype.addPolyline=function(e){this.polylines.push(e),e._actualLength=this.getPolylinePositionsLength(e),this.lengthOfPositions+=e._actualLength,e._bucket=this};bu.prototype.updateShader=function(e,t,n){if(c(this.shaderProgram))return;const i=["DISTANCE_DISPLAY_CONDITION"];n&&i.push("VECTOR_TILE"),this.material.shaderSource.search(/in\s+float\s+v_polylineAngle;/g)!==-1&&i.push("POLYLINE_DASH"),Yt.isInternetExplorer()||i.push("CLIP_POLYLINE");const o=new Oe({defines:i,sources:[`in vec4 v_pickColor;
|
|
`,this.material.shaderSource,IV]}),r=t.getVertexShaderCallback()(pCe),s=new Oe({defines:i,sources:[M0,r]});this.shaderProgram=Jt.fromCache({context:e,vertexShaderSource:s,fragmentShaderSource:o,attributeLocations:Js})};function D8(e){return d.dot(d.UNIT_X,e._boundingVolume.center)<0||e._boundingVolume.intersectPlane(_t.ORIGIN_ZX_PLANE)===Bt.INTERSECTING}bu.prototype.getPolylinePositionsLength=function(e){let t;if(this.mode===oe.SCENE3D||!D8(e))return t=e._actualPositions.length,t*4-4;let n=0;const i=e._segments.lengths;t=i.length;for(let o=0;o<t;++o)n+=i[o]*4-4;return n};const Bo=new d,lc=new d,uc=new d,qx=new d,VCe=new te,HCe=new H;bu.prototype.write=function(e,t,n,i,o,r,s,a){const l=this.mode,u=a.ellipsoid.maximumRadius*R.PI,h=this.polylines,f=h.length;for(let _=0;_<f;++_){const g=h[_],m=g.width,b=g.show&&m>0,T=g._index,x=this.getSegments(g,a),C=x.positions,w=x.lengths,v=C.length,P=g.getPickId(s).color;let N=0,k=0,M;for(let V=0;V<v;++V){V===0?g._loop?M=C[v-2]:(M=qx,d.subtract(C[0],C[1],M),d.add(C[0],M,M)):M=C[V-1],d.clone(M,lc),d.clone(C[V],Bo),V===v-1?g._loop?M=C[1]:(M=qx,d.subtract(C[v-1],C[v-2],M),d.add(C[v-1],M,M)):M=C[V+1],d.clone(M,uc);const G=w[N];V===k+G&&(k+=G,++N);const j=V-k===0,W=V===k+w[N]-1;l===oe.SCENE2D&&(lc.z=0,Bo.z=0,uc.z=0),(l===oe.SCENE2D||l===oe.MORPHING)&&(j||W)&&u-Math.abs(Bo.x)<1&&((Bo.x<0&&lc.x>0||Bo.x>0&&lc.x<0)&&d.clone(Bo,lc),(Bo.x<0&&uc.x>0||Bo.x>0&&uc.x<0)&&d.clone(Bo,uc));const X=j?2:0,q=W?2:4;for(let ee=X;ee<q;++ee){rn.writeElements(Bo,e,n),rn.writeElements(lc,e,n+6),rn.writeElements(uc,e,n+12);const Y=ee-2<0?-1:1;t[o]=V/(v-1),t[o+1]=2*(ee%2)-1,t[o+2]=Y,t[o+3]=T,n+=6*3,o+=4}}const U=VCe;U.x=z.floatToByte(P.red),U.y=z.floatToByte(P.green),U.z=z.floatToByte(P.blue),U.w=z.floatToByte(P.alpha);const B=HCe;B.x=m,B.y=b?1:0;const S=l===oe.SCENE2D?g._boundingVolume2D:g._boundingVolumeWC,D=rn.fromCartesian(S.center,E8),p=D.high,I=te.fromElements(D.low.x,D.low.y,D.low.z,S.radius,w8),O=S8;O.x=0,O.y=Number.MAX_VALUE;const F=g.distanceDisplayCondition;c(F)&&(O.x=F.near,O.y=F.far),r.setBatchedAttribute(T,0,B),r.setBatchedAttribute(T,1,U),r.attributes.length>2&&(r.setBatchedAttribute(T,2,p),r.setBatchedAttribute(T,3,I),r.setBatchedAttribute(T,4,O))}};const GCe=new d,jCe=new d,WCe=new d,BF=new d;bu.prototype.writeForMorph=function(e,t){const n=this.modelMatrix,i=this.polylines,o=i.length;for(let r=0;r<o;++r){const s=i[r],a=s._segments.positions,l=s._segments.lengths,u=a.length;let h=0,f=0;for(let _=0;_<u;++_){let g;_===0?s._loop?g=a[u-2]:(g=BF,d.subtract(a[0],a[1],g),d.add(a[0],g,g)):g=a[_-1],g=L.multiplyByPoint(n,g,jCe);const m=L.multiplyByPoint(n,a[_],GCe);let b;_===u-1?s._loop?b=a[1]:(b=BF,d.subtract(a[u-1],a[u-2],b),d.add(a[u-1],b,b)):b=a[_+1],b=L.multiplyByPoint(n,b,WCe);const T=l[h];_===f+T&&(f+=T,++h);const x=_-f===0,C=_===f+l[h]-1,w=x?2:0,v=C?2:4;for(let P=w;P<v;++P)rn.writeElements(m,e,t),rn.writeElements(g,e,t+6),rn.writeElements(b,e,t+12),t+=6*3}}};const qCe=new Array(1);bu.prototype.updateIndices=function(e,t,n,i){let o=n.length-1,r=new TS(0,i,this);n[o].push(r);let s=0,a=e[e.length-1],l=0;a.length>0&&(l=a[a.length-1]+1);const u=this.polylines,h=u.length;for(let f=0;f<h;++f){const _=u[f];_._locatorBuckets=[];let g;if(this.mode===oe.SCENE3D){g=qCe;const b=_._actualPositions.length;if(b>0)g[0]=b;else continue}else g=_._segments.lengths;const m=g.length;if(m>0){let b=0;for(let T=0;T<m;++T){const x=g[T]-1;for(let C=0;C<x;++C)l+4>R.SIXTY_FOUR_KILOBYTES&&(_._locatorBuckets.push({locator:r,count:b}),b=0,t.push(4),a=[],e.push(a),l=0,r.count=s,s=0,i=0,r=new TS(0,0,this),n[++o]=[r]),a.push(l,l+2,l+1),a.push(l+1,l+2,l+3),b+=6,s+=6,i+=6,l+=4}_._locatorBuckets.push({locator:r,count:b}),l+4>R.SIXTY_FOUR_KILOBYTES&&(t.push(0),a=[],e.push(a),l=0,r.count=s,i=0,s=0,r=new TS(0,0,this),n[++o]=[r])}_._clean()}return r.count=s,i};bu.prototype.getPolylineStartIndex=function(e){const t=this.polylines;let n=0;const i=t.length;for(let o=0;o<i;++o){const r=t[o];if(r===e)break;n+=r._actualLength}return n};const mm={positions:void 0,lengths:void 0},zF=new Array(1),YCe=new d,$Ce=new he;bu.prototype.getSegments=function(e,t){let n=e._actualPositions;if(this.mode===oe.SCENE3D)return zF[0]=n.length,mm.positions=n,mm.lengths=zF,mm;D8(e)&&(n=e._segments.positions);const i=t.ellipsoid,o=[],r=this.modelMatrix,s=n.length;let a,l=YCe;for(let u=0;u<s;++u)a=n[u],l=L.multiplyByPoint(r,a,l),o.push(t.project(i.cartesianToCartographic(l,$Ce)));if(o.length>0){e._boundingVolume2D=se.fromPoints(o,e._boundingVolume2D);const u=e._boundingVolume2D.center;e._boundingVolume2D.center=new d(u.z,u.x,u.y)}return mm.positions=o,mm.lengths=e._segments.lengths,mm};let UF;bu.prototype.writeUpdate=function(e,t,n,i){const o=this.mode,r=i.ellipsoid.maximumRadius*R.PI;let s=t._actualLength;if(s){e+=this.getPolylineStartIndex(t);let a=UF;const l=6*s*3;!c(a)||a.length<l?a=UF=new Float32Array(l):a.length>l&&(a=new Float32Array(a.buffer,0,l));const u=this.getSegments(t,i),h=u.positions,f=u.lengths;let _=0,g=0,m=0,b;s=h.length;for(let T=0;T<s;++T){T===0?t._loop?b=h[s-2]:(b=qx,d.subtract(h[0],h[1],b),d.add(h[0],b,b)):b=h[T-1],d.clone(b,lc),d.clone(h[T],Bo),T===s-1?t._loop?b=h[1]:(b=qx,d.subtract(h[s-1],h[s-2],b),d.add(h[s-1],b,b)):b=h[T+1],d.clone(b,uc);const x=f[g];T===m+x&&(m+=x,++g);const C=T-m===0,w=T===m+f[g]-1;o===oe.SCENE2D&&(lc.z=0,Bo.z=0,uc.z=0),(o===oe.SCENE2D||o===oe.MORPHING)&&(C||w)&&r-Math.abs(Bo.x)<1&&((Bo.x<0&&lc.x>0||Bo.x>0&&lc.x<0)&&d.clone(Bo,lc),(Bo.x<0&&uc.x>0||Bo.x>0&&uc.x<0)&&d.clone(Bo,uc));const v=C?2:0,P=w?2:4;for(let N=v;N<P;++N)rn.writeElements(Bo,a,_),rn.writeElements(lc,a,_+6),rn.writeElements(uc,a,_+12),_+=6*3}n.copyFromArrayView(a,6*3*Float32Array.BYTES_PER_ELEMENT*e)}};function nf(e){this._positions=e.positions,this._batchTable=e.batchTable,this._batchIds=e.batchIds,this._rectangle=e.rectangle,this._minHeight=e.minimumHeight,this._maxHeight=e.maximumHeight,this._billboardCollection=new Ts({batchTable:e.batchTable}),this._labelCollection=new Ga({batchTable:e.batchTable}),this._polylineCollection=new la,this._polylineCollection._useHighlightColor=!0,this._packedBuffer=void 0,this._ready=!1,this._promise=void 0,this._error=void 0}Object.defineProperties(nf.prototype,{ready:{get:function(){return this._ready}},pointsLength:{get:function(){return this._billboardCollection.length}},texturesByteLength:{get:function(){const e=this._billboardCollection.textureAtlas.texture.sizeInBytes,t=this._labelCollection._textureAtlas.texture.sizeInBytes;return e+t}}});function XCe(e,t){const n=e._rectangle,i=e._minHeight,o=e._maxHeight,r=2+ce.packedLength+ae.packedLength,s=new Float64Array(r);let a=0;return s[a++]=i,s[a++]=o,ce.pack(n,s,a),a+=ce.packedLength,ae.pack(t,s,a),s}const QCe=new Kn("createVectorTilePoints",5),KCe=new d;function ZCe(e,t){let n=e._positions,i=e._packedBuffer;c(i)||(n=e._positions=n.slice(),e._batchIds=e._batchIds.slice(),i=e._packedBuffer=XCe(e,t));const o=[n.buffer,i.buffer],r={positions:n.buffer,packedBuffer:i.buffer},s=QCe.scheduleTask(r,o);if(!!c(s))return s.then(a=>{if(e.isDestroyed())return;e._positions=new Float64Array(a.positions);const l=e._billboardCollection,u=e._labelCollection,h=e._polylineCollection;n=e._positions;const f=e._batchIds,_=n.length/3;for(let g=0;g<_;++g){const m=f[g],b=d.unpack(n,g*3,KCe),T=l.add();T.position=b,T._batchIndex=m;const x=u.add();x.text=" ",x.position=b,x._batchIndex=m;const C=h.add();C.positions=[d.clone(b),d.clone(b)]}e._positions=void 0,e._packedBuffer=void 0,e._ready=!0}).catch(a=>{e.isDestroyed()||(e._error=a)})}nf.prototype.createFeatures=function(e,t){const n=this._billboardCollection,i=this._labelCollection,o=this._polylineCollection,r=this._batchIds,s=r.length;for(let a=0;a<s;++a){const l=r[a],u=n.get(a),h=i.get(a),f=o.get(a);t[l]=new yo(e,l,u,h,f)}};nf.prototype.applyDebugSettings=function(e,t){e?(z.clone(t,this._billboardCollection._highlightColor),z.clone(t,this._labelCollection._highlightColor),z.clone(t,this._polylineCollection._highlightColor)):(z.clone(z.WHITE,this._billboardCollection._highlightColor),z.clone(z.WHITE,this._labelCollection._highlightColor),z.clone(z.WHITE,this._polylineCollection._highlightColor))};function JCe(e,t){const n=e._batchIds,i=n.length;for(let o=0;o<i;++o){const r=n[o],s=t[r];s.show=!0,s.pointSize=yo.defaultPointSize,s.color=yo.defaultColor,s.pointOutlineColor=yo.defaultPointOutlineColor,s.pointOutlineWidth=yo.defaultPointOutlineWidth,s.labelColor=z.WHITE,s.labelOutlineColor=z.WHITE,s.labelOutlineWidth=1,s.font="30px sans-serif",s.labelStyle=dl.FILL,s.labelText=void 0,s.backgroundColor=new z(.165,.165,.165,.8),s.backgroundPadding=new H(7,5),s.backgroundEnabled=!1,s.scaleByDistance=void 0,s.translucencyByDistance=void 0,s.distanceDisplayCondition=void 0,s.heightOffset=0,s.anchorLineEnabled=!1,s.anchorLineColor=z.WHITE,s.image=void 0,s.disableDepthTestDistance=0,s.horizontalOrigin=Fs.CENTER,s.verticalOrigin=si.CENTER,s.labelHorizontalOrigin=Fs.RIGHT,s.labelVerticalOrigin=si.BASELINE}}const eEe=new z,tEe=new z,nEe=new z,iEe=new z,oEe=new z,rEe=new z,Ug=new vt,kg=new vt,AS=new Pt;nf.prototype.applyStyle=function(e,t){if(!c(e)){JCe(this,t);return}const n=this._batchIds,i=n.length;for(let o=0;o<i;++o){const r=n[o],s=t[r];if(c(e.show)&&(s.show=e.show.evaluate(s)),c(e.pointSize)&&(s.pointSize=e.pointSize.evaluate(s)),c(e.color)&&(s.color=e.color.evaluateColor(s,eEe)),c(e.pointOutlineColor)&&(s.pointOutlineColor=e.pointOutlineColor.evaluateColor(s,tEe)),c(e.pointOutlineWidth)&&(s.pointOutlineWidth=e.pointOutlineWidth.evaluate(s)),c(e.labelColor)&&(s.labelColor=e.labelColor.evaluateColor(s,nEe)),c(e.labelOutlineColor)&&(s.labelOutlineColor=e.labelOutlineColor.evaluateColor(s,iEe)),c(e.labelOutlineWidth)&&(s.labelOutlineWidth=e.labelOutlineWidth.evaluate(s)),c(e.font)&&(s.font=e.font.evaluate(s)),c(e.labelStyle)&&(s.labelStyle=e.labelStyle.evaluate(s)),c(e.labelText)?s.labelText=e.labelText.evaluate(s):s.labelText=void 0,c(e.backgroundColor)&&(s.backgroundColor=e.backgroundColor.evaluateColor(s,oEe)),c(e.backgroundPadding)&&(s.backgroundPadding=e.backgroundPadding.evaluate(s)),c(e.backgroundEnabled)&&(s.backgroundEnabled=e.backgroundEnabled.evaluate(s)),c(e.scaleByDistance)){const a=e.scaleByDistance.evaluate(s);c(a)?(Ug.near=a.x,Ug.nearValue=a.y,Ug.far=a.z,Ug.farValue=a.w,s.scaleByDistance=Ug):s.scaleByDistance=void 0}else s.scaleByDistance=void 0;if(c(e.translucencyByDistance)){const a=e.translucencyByDistance.evaluate(s);c(a)?(kg.near=a.x,kg.nearValue=a.y,kg.far=a.z,kg.farValue=a.w,s.translucencyByDistance=kg):s.translucencyByDistance=void 0}else s.translucencyByDistance=void 0;if(c(e.distanceDisplayCondition)){const a=e.distanceDisplayCondition.evaluate(s);c(a)?(AS.near=a.x,AS.far=a.y,s.distanceDisplayCondition=AS):s.distanceDisplayCondition=void 0}else s.distanceDisplayCondition=void 0;c(e.heightOffset)&&(s.heightOffset=e.heightOffset.evaluate(s)),c(e.anchorLineEnabled)&&(s.anchorLineEnabled=e.anchorLineEnabled.evaluate(s)),c(e.anchorLineColor)&&(s.anchorLineColor=e.anchorLineColor.evaluateColor(s,rEe)),c(e.image)?s.image=e.image.evaluate(s):s.image=void 0,c(e.disableDepthTestDistance)&&(s.disableDepthTestDistance=e.disableDepthTestDistance.evaluate(s)),c(e.horizontalOrigin)&&(s.horizontalOrigin=e.horizontalOrigin.evaluate(s)),c(e.verticalOrigin)&&(s.verticalOrigin=e.verticalOrigin.evaluate(s)),c(e.labelHorizontalOrigin)&&(s.labelHorizontalOrigin=e.labelHorizontalOrigin.evaluate(s)),c(e.labelVerticalOrigin)&&(s.labelVerticalOrigin=e.labelVerticalOrigin.evaluate(s))}};nf.prototype.update=function(e){if(!this._ready){if(c(this._promise)||(this._promise=ZCe(this,e.mapProjection.ellipsoid)),c(this._error)){const t=this._error;throw this._error=void 0,t}return}this._polylineCollection.update(e),this._billboardCollection.update(e),this._labelCollection.update(e)};nf.prototype.isDestroyed=function(){return!1};nf.prototype.destroy=function(){return this._billboardCollection=this._billboardCollection&&this._billboardCollection.destroy(),this._labelCollection=this._labelCollection&&this._labelCollection.destroy(),this._polylineCollection=this._polylineCollection&&this._polylineCollection.destroy(),ve(this)};function Ad(e){this._batchTable=e.batchTable,this._batchIds=e.batchIds,this._positions=e.positions,this._counts=e.counts,this._indices=e.indices,this._indexCounts=e.indexCounts,this._indexOffsets=void 0,this._batchTableColors=void 0,this._packedBuffer=void 0,this._batchedPositions=void 0,this._transferrableBatchIds=void 0,this._vertexBatchIds=void 0,this._ellipsoid=y(e.ellipsoid,ae.WGS84),this._minimumHeight=e.minimumHeight,this._maximumHeight=e.maximumHeight,this._polygonMinimumHeights=e.polygonMinimumHeights,this._polygonMaximumHeights=e.polygonMaximumHeights,this._center=y(e.center,d.ZERO),this._rectangle=e.rectangle,this._center=void 0,this._boundingVolume=e.boundingVolume,this._boundingVolumes=void 0,this._batchedIndices=void 0,this._ready=!1,this._promise=void 0,this._error=void 0,this._primitive=void 0,this.debugWireframe=!1,this.forceRebatch=!1,this.classificationType=Ui.BOTH}Object.defineProperties(Ad.prototype,{trianglesLength:{get:function(){return c(this._primitive)?this._primitive.trianglesLength:0}},geometryByteLength:{get:function(){return c(this._primitive)?this._primitive.geometryByteLength:0}},ready:{get:function(){return this._ready}}});function sEe(e){const t=new Float64Array(3+d.packedLength+ae.packedLength+ce.packedLength);let n=0;return t[n++]=e._indices.BYTES_PER_ELEMENT,t[n++]=e._minimumHeight,t[n++]=e._maximumHeight,d.pack(e._center,t,n),n+=d.packedLength,ae.pack(e._ellipsoid,t,n),n+=ae.packedLength,ce.pack(e._rectangle,t,n),t}function aEe(e,t){let n=1;const i=t[n++],o=e._boundingVolumes=new Array(i);for(let a=0;a<i;++a)o[a]=Ct.unpack(t,n),n+=Ct.packedLength;const r=t[n++],s=e._batchedIndices=new Array(r);for(let a=0;a<r;++a){const l=z.unpack(t,n);n+=z.packedLength;const u=t[n++],h=t[n++],f=t[n++],_=new Array(f);for(let g=0;g<f;++g)_[g]=t[n++];s[a]=new Px({color:l,offset:u,count:h,batchIds:_})}}const cEe=new Kn("createVectorTilePolygons",5),lEe=new z;function uEe(e){if(c(e._primitive))return;let t=e._positions,n=e._counts,i=e._indexCounts,o=e._indices,r=e._transferrableBatchIds,s=e._batchTableColors,a=e._packedBuffer;if(!c(s)){t=e._positions=e._positions.slice(),n=e._counts=e._counts.slice(),i=e._indexCounts=e._indexCounts.slice(),o=e._indices=e._indices.slice(),e._center=e._ellipsoid.cartographicToCartesian(ce.center(e._rectangle)),r=e._transferrableBatchIds=new Uint32Array(e._batchIds),s=e._batchTableColors=new Uint32Array(r.length);const g=e._batchTable,m=s.length;for(let b=0;b<m;++b){const T=g.getColor(b,lEe);s[b]=T.toRgba()}a=e._packedBuffer=sEe(e)}const l=[t.buffer,n.buffer,i.buffer,o.buffer,r.buffer,s.buffer,a.buffer],u={packedBuffer:a.buffer,positions:t.buffer,counts:n.buffer,indexCounts:i.buffer,indices:o.buffer,batchIds:r.buffer,batchTableColors:s.buffer};let h=e._polygonMinimumHeights,f=e._polygonMaximumHeights;c(h)&&c(f)&&(h=h.slice(),f=f.slice(),l.push(h.buffer,f.buffer),u.minimumHeights=h,u.maximumHeights=f);const _=cEe.scheduleTask(u,l);if(!!c(_))return _.then(g=>{if(e.isDestroyed())return;e._positions=void 0,e._counts=void 0,e._polygonMinimumHeights=void 0,e._polygonMaximumHeights=void 0;const m=new Float64Array(g.packedBuffer),b=m[0];aEe(e,m),e._indices=je.getSizeInBytes(b)===2?new Uint16Array(g.indices):new Uint32Array(g.indices),e._indexOffsets=new Uint32Array(g.indexOffsets),e._indexCounts=new Uint32Array(g.indexCounts),e._batchedPositions=new Float32Array(g.positions),e._vertexBatchIds=new Uint16Array(g.batchIds),dEe(e),e._ready=!0}).catch(g=>{e.isDestroyed()||(e._error=g)})}function dEe(e){c(e._primitive)||(e._primitive=new hu({batchTable:e._batchTable,positions:e._batchedPositions,batchIds:e._batchIds,vertexBatchIds:e._vertexBatchIds,indices:e._indices,indexOffsets:e._indexOffsets,indexCounts:e._indexCounts,batchedIndices:e._batchedIndices,boundingVolume:e._boundingVolume,boundingVolumes:e._boundingVolumes,center:e._center}),e._batchTable=void 0,e._batchIds=void 0,e._positions=void 0,e._counts=void 0,e._indices=void 0,e._indexCounts=void 0,e._indexOffsets=void 0,e._batchTableColors=void 0,e._packedBuffer=void 0,e._batchedPositions=void 0,e._transferrableBatchIds=void 0,e._vertexBatchIds=void 0,e._ellipsoid=void 0,e._minimumHeight=void 0,e._maximumHeight=void 0,e._polygonMinimumHeights=void 0,e._polygonMaximumHeights=void 0,e._center=void 0,e._rectangle=void 0,e._boundingVolume=void 0,e._boundingVolumes=void 0,e._batchedIndices=void 0)}Ad.prototype.createFeatures=function(e,t){this._primitive.createFeatures(e,t)};Ad.prototype.applyDebugSettings=function(e,t){this._primitive.applyDebugSettings(e,t)};Ad.prototype.applyStyle=function(e,t){this._primitive.applyStyle(e,t)};Ad.prototype.updateCommands=function(e,t){this._primitive.updateCommands(e,t)};Ad.prototype.update=function(e){if(!this._ready){if(c(this._promise)||(this._promise=uEe(this)),c(this._error)){const t=this._error;throw this._error=void 0,t}return}this._primitive.debugWireframe=this.debugWireframe,this._primitive.forceRebatch=this.forceRebatch,this._primitive.classificationType=this.classificationType,this._primitive.update(e)};Ad.prototype.isDestroyed=function(){return!1};Ad.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),ve(this)};const hEe=`in vec4 currentPosition;
|
|
in vec4 previousPosition;
|
|
in vec4 nextPosition;
|
|
in vec2 expandAndWidth;
|
|
in float a_batchId;
|
|
|
|
uniform mat4 u_modifiedModelView;
|
|
|
|
void main()
|
|
{
|
|
float expandDir = expandAndWidth.x;
|
|
float width = abs(expandAndWidth.y) + 0.5;
|
|
bool usePrev = expandAndWidth.y < 0.0;
|
|
|
|
vec4 p = u_modifiedModelView * currentPosition;
|
|
vec4 prev = u_modifiedModelView * previousPosition;
|
|
vec4 next = u_modifiedModelView * nextPosition;
|
|
|
|
float angle;
|
|
vec4 positionWC = getPolylineWindowCoordinatesEC(p, prev, next, expandDir, width, usePrev, angle);
|
|
gl_Position = czm_viewportOrthographic * positionWC;
|
|
}
|
|
`;function Pc(e){this._positions=e.positions,this._widths=e.widths,this._counts=e.counts,this._batchIds=e.batchIds,this._ellipsoid=y(e.ellipsoid,ae.WGS84),this._minimumHeight=e.minimumHeight,this._maximumHeight=e.maximumHeight,this._center=e.center,this._rectangle=e.rectangle,this._boundingVolume=e.boundingVolume,this._batchTable=e.batchTable,this._va=void 0,this._sp=void 0,this._rs=void 0,this._uniformMap=void 0,this._command=void 0,this._transferrableBatchIds=void 0,this._packedBuffer=void 0,this._keepDecodedPositions=e.keepDecodedPositions,this._decodedPositions=void 0,this._decodedPositionOffsets=void 0,this._currentPositions=void 0,this._previousPositions=void 0,this._nextPositions=void 0,this._expandAndWidth=void 0,this._vertexBatchIds=void 0,this._indices=void 0,this._constantColor=z.clone(z.WHITE),this._highlightColor=this._constantColor,this._trianglesLength=0,this._geometryByteLength=0,this._ready=!1,this._promise=void 0,this._error=void 0}Object.defineProperties(Pc.prototype,{trianglesLength:{get:function(){return this._trianglesLength}},geometryByteLength:{get:function(){return this._geometryByteLength}},ready:{get:function(){return this._ready}}});function fEe(e){const t=e._rectangle,n=e._minimumHeight,i=e._maximumHeight,o=e._ellipsoid,r=e._center,s=2+ce.packedLength+ae.packedLength+d.packedLength,a=new Float64Array(s);let l=0;return a[l++]=n,a[l++]=i,ce.pack(t,a,l),l+=ce.packedLength,ae.pack(o,a,l),l+=ae.packedLength,d.pack(r,a,l),a}const pEe=new Kn("createVectorTilePolylines",5),km={previousPosition:0,currentPosition:1,nextPosition:2,expandAndWidth:3,a_batchId:4};function mEe(e,t){if(c(e._va))return;let n=e._positions,i=e._widths,o=e._counts,r=e._transferrableBatchIds,s=e._packedBuffer;c(s)||(n=e._positions=n.slice(),i=e._widths=i.slice(),o=e._counts=o.slice(),r=e._transferrableBatchIds=e._batchIds.slice(),s=e._packedBuffer=fEe(e));const a=[n.buffer,i.buffer,o.buffer,r.buffer,s.buffer],l={positions:n.buffer,widths:i.buffer,counts:o.buffer,batchIds:r.buffer,packedBuffer:s.buffer,keepDecodedPositions:e._keepDecodedPositions},u=pEe.scheduleTask(l,a);if(!!c(u))return u.then(function(h){if(e.isDestroyed())return;e._keepDecodedPositions&&(e._decodedPositions=new Float64Array(h.decodedPositions),e._decodedPositionOffsets=new Uint32Array(h.decodedPositionOffsets)),e._currentPositions=new Float32Array(h.currentPositions),e._previousPositions=new Float32Array(h.previousPositions),e._nextPositions=new Float32Array(h.nextPositions),e._expandAndWidth=new Float32Array(h.expandAndWidth),e._vertexBatchIds=new Uint16Array(h.batchIds);const f=h.indexDatatype;e._indices=f===je.UNSIGNED_SHORT?new Uint16Array(h.indices):new Uint32Array(h.indices),_Ee(e,t),e._ready=!0}).catch(h=>{e.isDestroyed()||(e._error=h)})}function _Ee(e,t){if(!c(e._va)){const n=e._currentPositions,i=e._previousPositions,o=e._nextPositions,r=e._expandAndWidth,s=e._vertexBatchIds,a=e._indices;let l=i.byteLength+n.byteLength+o.byteLength;l+=r.byteLength+s.byteLength+a.byteLength,e._trianglesLength=a.length/3,e._geometryByteLength=l;const u=ct.createVertexBuffer({context:t,typedArray:i,usage:ke.STATIC_DRAW}),h=ct.createVertexBuffer({context:t,typedArray:n,usage:ke.STATIC_DRAW}),f=ct.createVertexBuffer({context:t,typedArray:o,usage:ke.STATIC_DRAW}),_=ct.createVertexBuffer({context:t,typedArray:r,usage:ke.STATIC_DRAW}),g=ct.createVertexBuffer({context:t,typedArray:s,usage:ke.STATIC_DRAW}),m=ct.createIndexBuffer({context:t,typedArray:a,usage:ke.STATIC_DRAW,indexDatatype:a.BYTES_PER_ELEMENT===2?je.UNSIGNED_SHORT:je.UNSIGNED_INT}),b=[{index:km.previousPosition,vertexBuffer:u,componentDatatype:Z.FLOAT,componentsPerAttribute:3},{index:km.currentPosition,vertexBuffer:h,componentDatatype:Z.FLOAT,componentsPerAttribute:3},{index:km.nextPosition,vertexBuffer:f,componentDatatype:Z.FLOAT,componentsPerAttribute:3},{index:km.expandAndWidth,vertexBuffer:_,componentDatatype:Z.FLOAT,componentsPerAttribute:2},{index:km.a_batchId,vertexBuffer:g,componentDatatype:Z.UNSIGNED_SHORT,componentsPerAttribute:1}];e._va=new Ci({context:t,attributes:b,indexBuffer:m}),e._positions=void 0,e._widths=void 0,e._counts=void 0,e._ellipsoid=void 0,e._minimumHeight=void 0,e._maximumHeight=void 0,e._rectangle=void 0,e._transferrableBatchIds=void 0,e._packedBuffer=void 0,e._currentPositions=void 0,e._previousPositions=void 0,e._nextPositions=void 0,e._expandAndWidth=void 0,e._vertexBatchIds=void 0,e._indices=void 0}}const Vg=new L,kF=new d;function gEe(e,t){c(e._uniformMap)||(e._uniformMap={u_modifiedModelView:function(){const n=t.uniformState.view;return L.clone(n,Vg),L.multiplyByPoint(Vg,e._center,kF),L.setTranslation(Vg,kF,Vg),Vg},u_highlightColor:function(){return e._highlightColor}})}function yEe(e){if(c(e._rs))return;const t={enabled:!0,factor:-5,units:-5};e._rs=Ue.fromCache({blending:Zn.ALPHA_BLEND,depthMask:!1,depthTest:{enabled:!0},polygonOffset:t})}const bEe=`uniform vec4 u_highlightColor;
|
|
void main()
|
|
{
|
|
out_FragColor = u_highlightColor;
|
|
}
|
|
`;function TEe(e,t){if(c(e._sp))return;const n=e._batchTable,i=n.getVertexShaderCallback(!1,"a_batchId",void 0)(hEe),o=n.getFragmentShaderCallback(!1,void 0,!1)(bEe),r=new Oe({defines:["VECTOR_TILE",Yt.isInternetExplorer()?"":"CLIP_POLYLINE"],sources:[M0,i]}),s=new Oe({defines:["VECTOR_TILE"],sources:[o]});e._sp=Jt.fromCache({context:t,vertexShaderSource:r,fragmentShaderSource:s,attributeLocations:km})}function AEe(e,t){if(!c(e._command)){const n=e._batchTable.getUniformMapCallback()(e._uniformMap);e._command=new Ze({owner:e,vertexArray:e._va,renderState:e._rs,shaderProgram:e._sp,uniformMap:n,boundingVolume:e._boundingVolume,pass:xe.TRANSLUCENT,pickId:e._batchTable.getPickId()})}t.commandList.push(e._command)}Pc.getPolylinePositions=function(e,t){const n=e._batchIds,i=e._decodedPositions,o=e._decodedPositionOffsets;if(!c(n)||!c(i))return;let r,s;const a=n.length;let l=0,u=0;for(r=0;r<a;++r)n[r]===t&&(l+=o[r+1]-o[r]);if(l===0)return;const h=new Float64Array(l*3);for(r=0;r<a;++r)if(n[r]===t){const f=o[r],_=o[r+1]-f;for(s=0;s<_;++s){const g=(f+s)*3;h[u++]=i[g],h[u++]=i[g+1],h[u++]=i[g+2]}}return h};Pc.prototype.getPositions=function(e){return Pc.getPolylinePositions(this,e)};Pc.prototype.createFeatures=function(e,t){const n=this._batchIds,i=n.length;for(let o=0;o<i;++o){const r=n[o];t[r]=new Ir(e,r)}};Pc.prototype.applyDebugSettings=function(e,t){this._highlightColor=e?t:this._constantColor};function xEe(e,t){const n=e._batchIds,i=n.length;for(let o=0;o<i;++o){const r=n[o],s=t[r];s.show=!0,s.color=z.WHITE}}const CEe=new z,EEe=z.WHITE,wEe=!0;Pc.prototype.applyStyle=function(e,t){if(!c(e)){xEe(this,t);return}const n=this._batchIds,i=n.length;for(let o=0;o<i;++o){const r=n[o],s=t[r];s.color=c(e.color)?e.color.evaluateColor(s,CEe):EEe,s.show=c(e.show)?e.show.evaluate(s):wEe}};Pc.prototype.update=function(e){const t=e.context;if(!this._ready){if(c(this._promise)||(this._promise=mEe(this,t)),c(this._error)){const i=this._error;throw this._error=void 0,i}return}gEe(this,t),TEe(this,t),yEe(this);const n=e.passes;(n.render||n.pick)&&AEe(this,e)};Pc.prototype.isDestroyed=function(){return!1};Pc.prototype.destroy=function(){return this._va=this._va&&this._va.destroy(),this._sp=this._sp&&this._sp.destroy(),ve(this)};const SEe=`in vec3 startEllipsoidNormal;
|
|
in vec3 endEllipsoidNormal;
|
|
in vec4 startPositionAndHeight;
|
|
in vec4 endPositionAndHeight;
|
|
in vec4 startFaceNormalAndVertexCorner;
|
|
in vec4 endFaceNormalAndHalfWidth;
|
|
in float a_batchId;
|
|
|
|
uniform mat4 u_modifiedModelView;
|
|
uniform vec2 u_minimumMaximumVectorHeights;
|
|
|
|
out vec4 v_startPlaneEC;
|
|
out vec4 v_endPlaneEC;
|
|
out vec4 v_rightPlaneEC;
|
|
out float v_halfWidth;
|
|
out vec3 v_volumeUpEC;
|
|
|
|
void main()
|
|
{
|
|
// vertex corner IDs
|
|
// 3-----------7
|
|
// /| left /|
|
|
// / | 1 / |
|
|
// 2-----------6 5 end
|
|
// | / | /
|
|
// start |/ right |/
|
|
// 0-----------4
|
|
//
|
|
float isEnd = floor(startFaceNormalAndVertexCorner.w * 0.251); // 0 for front, 1 for end
|
|
float isTop = floor(startFaceNormalAndVertexCorner.w * mix(0.51, 0.19, isEnd)); // 0 for bottom, 1 for top
|
|
|
|
vec3 forward = endPositionAndHeight.xyz - startPositionAndHeight.xyz;
|
|
vec3 right = normalize(cross(forward, startEllipsoidNormal));
|
|
|
|
vec4 position = vec4(startPositionAndHeight.xyz, 1.0);
|
|
position.xyz += forward * isEnd;
|
|
|
|
v_volumeUpEC = czm_normal * normalize(cross(right, forward));
|
|
|
|
// Push for volume height
|
|
float offset;
|
|
vec3 ellipsoidNormal = mix(startEllipsoidNormal, endEllipsoidNormal, isEnd);
|
|
|
|
// offset height to create volume
|
|
offset = mix(startPositionAndHeight.w, endPositionAndHeight.w, isEnd);
|
|
offset = mix(u_minimumMaximumVectorHeights.y, u_minimumMaximumVectorHeights.x, isTop) - offset;
|
|
position.xyz += offset * ellipsoidNormal;
|
|
|
|
// move from RTC to EC
|
|
position = u_modifiedModelView * position;
|
|
right = czm_normal * right;
|
|
|
|
// Push for width in a direction that is in the start or end plane and in a plane with right
|
|
// N = normalEC ("right-facing" direction for push)
|
|
// R = right
|
|
// p = angle between N and R
|
|
// w = distance to push along R if R == N
|
|
// d = distance to push along N
|
|
//
|
|
// N R
|
|
// { p| } * cos(p) = dot(N, R) = w / d
|
|
// d | |w * d = w / dot(N, R)
|
|
// { | }
|
|
// o---------- polyline segment ---->
|
|
//
|
|
vec3 scratchNormal = mix(-startFaceNormalAndVertexCorner.xyz, endFaceNormalAndHalfWidth.xyz, isEnd);
|
|
scratchNormal = cross(scratchNormal, mix(startEllipsoidNormal, endEllipsoidNormal, isEnd));
|
|
vec3 miterPushNormal = czm_normal * normalize(scratchNormal);
|
|
|
|
offset = 2.0 * endFaceNormalAndHalfWidth.w * max(0.0, czm_metersPerPixel(position)); // offset = widthEC
|
|
offset = offset / dot(miterPushNormal, right);
|
|
position.xyz += miterPushNormal * (offset * sign(0.5 - mod(startFaceNormalAndVertexCorner.w, 2.0)));
|
|
|
|
gl_Position = czm_depthClamp(czm_projection * position);
|
|
|
|
position = u_modifiedModelView * vec4(startPositionAndHeight.xyz, 1.0);
|
|
vec3 startNormalEC = czm_normal * startFaceNormalAndVertexCorner.xyz;
|
|
v_startPlaneEC = vec4(startNormalEC, -dot(startNormalEC, position.xyz));
|
|
v_rightPlaneEC = vec4(right, -dot(right, position.xyz));
|
|
|
|
position = u_modifiedModelView * vec4(endPositionAndHeight.xyz, 1.0);
|
|
vec3 endNormalEC = czm_normal * endFaceNormalAndHalfWidth.xyz;
|
|
v_endPlaneEC = vec4(endNormalEC, -dot(endNormalEC, position.xyz));
|
|
v_halfWidth = endFaceNormalAndHalfWidth.w;
|
|
}
|
|
`,vEe=`in vec4 v_startPlaneEC;
|
|
in vec4 v_endPlaneEC;
|
|
in vec4 v_rightPlaneEC;
|
|
in float v_halfWidth;
|
|
in vec3 v_volumeUpEC;
|
|
|
|
uniform vec4 u_highlightColor;
|
|
void main()
|
|
{
|
|
float logDepthOrDepth = czm_branchFreeTernary(czm_sceneMode == czm_sceneMode2D, gl_FragCoord.z, czm_unpackDepth(texture(czm_globeDepthTexture, gl_FragCoord.xy / czm_viewport.zw)));
|
|
|
|
// Discard for sky
|
|
if (logDepthOrDepth == 0.0) {
|
|
#ifdef DEBUG_SHOW_VOLUME
|
|
out_FragColor = vec4(0.0, 0.0, 1.0, 0.5);
|
|
return;
|
|
#else // DEBUG_SHOW_VOLUME
|
|
discard;
|
|
#endif // DEBUG_SHOW_VOLUME
|
|
}
|
|
|
|
vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth);
|
|
eyeCoordinate /= eyeCoordinate.w;
|
|
|
|
float halfMaxWidth = v_halfWidth * czm_metersPerPixel(eyeCoordinate);
|
|
|
|
// Expand halfMaxWidth if direction to camera is almost perpendicular with the volume's up direction
|
|
halfMaxWidth += halfMaxWidth * (1.0 - dot(-normalize(eyeCoordinate.xyz), v_volumeUpEC));
|
|
|
|
// Check distance of the eye coordinate against the right-facing plane
|
|
float widthwiseDistance = czm_planeDistance(v_rightPlaneEC, eyeCoordinate.xyz);
|
|
|
|
// Check eye coordinate against the mitering planes
|
|
float distanceFromStart = czm_planeDistance(v_startPlaneEC, eyeCoordinate.xyz);
|
|
float distanceFromEnd = czm_planeDistance(v_endPlaneEC, eyeCoordinate.xyz);
|
|
|
|
if (abs(widthwiseDistance) > halfMaxWidth || distanceFromStart < 0.0 || distanceFromEnd < 0.0) {
|
|
#ifdef DEBUG_SHOW_VOLUME
|
|
out_FragColor = vec4(logDepthOrDepth, 0.0, 0.0, 0.5);
|
|
return;
|
|
#else // DEBUG_SHOW_VOLUME
|
|
discard;
|
|
#endif // DEBUG_SHOW_VOLUME
|
|
}
|
|
out_FragColor = u_highlightColor;
|
|
|
|
czm_writeDepthClamp();
|
|
}
|
|
`;function xd(e){this._positions=e.positions,this._widths=e.widths,this._counts=e.counts,this._batchIds=e.batchIds,this._ellipsoid=y(e.ellipsoid,ae.WGS84),this._minimumHeight=e.minimumHeight,this._maximumHeight=e.maximumHeight,this._center=e.center,this._rectangle=e.rectangle,this._batchTable=e.batchTable,this._va=void 0,this._sp=void 0,this._rs=void 0,this._uniformMap=void 0,this._command=void 0,this._transferrableBatchIds=void 0,this._packedBuffer=void 0,this._minimumMaximumVectorHeights=new H(Ti._defaultMinTerrainHeight,Ti._defaultMaxTerrainHeight),this._boundingVolume=Ct.fromRectangle(e.rectangle,Ti._defaultMinTerrainHeight,Ti._defaultMaxTerrainHeight,this._ellipsoid),this._classificationType=e.classificationType,this._keepDecodedPositions=e.keepDecodedPositions,this._decodedPositions=void 0,this._decodedPositionOffsets=void 0,this._startEllipsoidNormals=void 0,this._endEllipsoidNormals=void 0,this._startPositionAndHeights=void 0,this._startFaceNormalAndVertexCornerIds=void 0,this._endPositionAndHeights=void 0,this._endFaceNormalAndHalfWidths=void 0,this._vertexBatchIds=void 0,this._indices=void 0,this._constantColor=z.clone(z.WHITE),this._highlightColor=this._constantColor,this._trianglesLength=0,this._geometryByteLength=0,this._ready=!1,this._promise=void 0,this._error=void 0}Object.defineProperties(xd.prototype,{trianglesLength:{get:function(){return this._trianglesLength}},geometryByteLength:{get:function(){return this._geometryByteLength}},ready:{get:function(){return this._ready}}});function IEe(e,t,n){const i=Ti.getMinimumMaximumHeights(t,n),o=i.minimumTerrainHeight,r=i.maximumTerrainHeight,s=e._minimumMaximumVectorHeights;s.x=o,s.y=r;const a=e._boundingVolume,l=e._rectangle;Ct.fromRectangle(l,o,r,n,a)}function DEe(e){const t=e._rectangle,n=e._minimumHeight,i=e._maximumHeight,o=e._ellipsoid,r=e._center,s=2+ce.packedLength+ae.packedLength+d.packedLength,a=new Float64Array(s);let l=0;return a[l++]=n,a[l++]=i,ce.pack(t,a,l),l+=ce.packedLength,ae.pack(o,a,l),l+=ae.packedLength,d.pack(r,a,l),a}const PEe=new Kn("createVectorTileClampedPolylines"),th={startEllipsoidNormal:0,endEllipsoidNormal:1,startPositionAndHeight:2,endPositionAndHeight:3,startFaceNormalAndVertexCorner:4,endFaceNormalAndHalfWidth:5,a_batchId:6};function OEe(e,t){if(c(e._va))return;let n=e._positions,i=e._widths,o=e._counts,r=e._transferrableBatchIds,s=e._packedBuffer;c(s)||(n=e._positions=n.slice(),i=e._widths=i.slice(),o=e._counts=o.slice(),r=e._transferrableBatchIds=e._batchIds.slice(),s=e._packedBuffer=DEe(e));const a=[n.buffer,i.buffer,o.buffer,r.buffer,s.buffer],l={positions:n.buffer,widths:i.buffer,counts:o.buffer,batchIds:r.buffer,packedBuffer:s.buffer,keepDecodedPositions:e._keepDecodedPositions},u=PEe.scheduleTask(l,a);if(!!c(u))return u.then(function(h){if(e.isDestroyed())return;e._keepDecodedPositions&&(e._decodedPositions=new Float64Array(h.decodedPositions),e._decodedPositionOffsets=new Uint32Array(h.decodedPositionOffsets)),e._startEllipsoidNormals=new Float32Array(h.startEllipsoidNormals),e._endEllipsoidNormals=new Float32Array(h.endEllipsoidNormals),e._startPositionAndHeights=new Float32Array(h.startPositionAndHeights),e._startFaceNormalAndVertexCornerIds=new Float32Array(h.startFaceNormalAndVertexCornerIds),e._endPositionAndHeights=new Float32Array(h.endPositionAndHeights),e._endFaceNormalAndHalfWidths=new Float32Array(h.endFaceNormalAndHalfWidths),e._vertexBatchIds=new Uint16Array(h.vertexBatchIds);const f=h.indexDatatype;e._indices=f===je.UNSIGNED_SHORT?new Uint16Array(h.indices):new Uint32Array(h.indices),LEe(e,t),e._ready=!0}).catch(h=>{e.isDestroyed()||(e._error=h)})}function LEe(e,t){if(!c(e._va)){const n=e._startEllipsoidNormals,i=e._endEllipsoidNormals,o=e._startPositionAndHeights,r=e._endPositionAndHeights,s=e._startFaceNormalAndVertexCornerIds,a=e._endFaceNormalAndHalfWidths,l=e._vertexBatchIds,u=e._indices;let h=n.byteLength+i.byteLength;h+=o.byteLength+r.byteLength,h+=s.byteLength+a.byteLength,h+=l.byteLength+u.byteLength,e._trianglesLength=u.length/3,e._geometryByteLength=h;const f=ct.createVertexBuffer({context:t,typedArray:n,usage:ke.STATIC_DRAW}),_=ct.createVertexBuffer({context:t,typedArray:i,usage:ke.STATIC_DRAW}),g=ct.createVertexBuffer({context:t,typedArray:o,usage:ke.STATIC_DRAW}),m=ct.createVertexBuffer({context:t,typedArray:r,usage:ke.STATIC_DRAW}),b=ct.createVertexBuffer({context:t,typedArray:s,usage:ke.STATIC_DRAW}),T=ct.createVertexBuffer({context:t,typedArray:a,usage:ke.STATIC_DRAW}),x=ct.createVertexBuffer({context:t,typedArray:l,usage:ke.STATIC_DRAW}),C=ct.createIndexBuffer({context:t,typedArray:u,usage:ke.STATIC_DRAW,indexDatatype:u.BYTES_PER_ELEMENT===2?je.UNSIGNED_SHORT:je.UNSIGNED_INT}),w=[{index:th.startEllipsoidNormal,vertexBuffer:f,componentDatatype:Z.FLOAT,componentsPerAttribute:3},{index:th.endEllipsoidNormal,vertexBuffer:_,componentDatatype:Z.FLOAT,componentsPerAttribute:3},{index:th.startPositionAndHeight,vertexBuffer:g,componentDatatype:Z.FLOAT,componentsPerAttribute:4},{index:th.endPositionAndHeight,vertexBuffer:m,componentDatatype:Z.FLOAT,componentsPerAttribute:4},{index:th.startFaceNormalAndVertexCorner,vertexBuffer:b,componentDatatype:Z.FLOAT,componentsPerAttribute:4},{index:th.endFaceNormalAndHalfWidth,vertexBuffer:T,componentDatatype:Z.FLOAT,componentsPerAttribute:4},{index:th.a_batchId,vertexBuffer:x,componentDatatype:Z.UNSIGNED_SHORT,componentsPerAttribute:1}];e._va=new Ci({context:t,attributes:w,indexBuffer:C}),e._positions=void 0,e._widths=void 0,e._counts=void 0,e._ellipsoid=void 0,e._minimumHeight=void 0,e._maximumHeight=void 0,e._rectangle=void 0,e._transferrableBatchIds=void 0,e._packedBuffer=void 0,e._startEllipsoidNormals=void 0,e._endEllipsoidNormals=void 0,e._startPositionAndHeights=void 0,e._startFaceNormalAndVertexCornerIds=void 0,e._endPositionAndHeights=void 0,e._endFaceNormalAndHalfWidths=void 0,e._vertexBatchIds=void 0,e._indices=void 0}}const Hg=new L,VF=new d;function REe(e,t){c(e._uniformMap)||(e._uniformMap={u_modifiedModelView:function(){const n=t.uniformState.view;return L.clone(n,Hg),L.multiplyByPoint(Hg,e._center,VF),L.setTranslation(Hg,VF,Hg),Hg},u_highlightColor:function(){return e._highlightColor},u_minimumMaximumVectorHeights:function(){return e._minimumMaximumVectorHeights}})}function HF(e){return Ue.fromCache({cull:{enabled:!0,face:Qi.FRONT},blending:Zn.PRE_MULTIPLIED_ALPHA_BLEND,depthMask:!1,stencilTest:{enabled:e,frontFunction:Pn.EQUAL,frontOperation:{fail:nt.KEEP,zFail:nt.KEEP,zPass:nt.KEEP},backFunction:Pn.EQUAL,backOperation:{fail:nt.KEEP,zFail:nt.KEEP,zPass:nt.KEEP},reference:At.CESIUM_3D_TILE_MASK,mask:At.CESIUM_3D_TILE_MASK}})}function NEe(e){c(e._rs)||(e._rs=HF(!1),e._rs3DTiles=HF(!0))}function MEe(e,t){if(c(e._sp))return;const n=e._batchTable,i=n.getVertexShaderCallback(!1,"a_batchId",void 0)(SEe),o=n.getFragmentShaderCallback(!1,void 0,!0)(vEe),r=new Oe({defines:["VECTOR_TILE",Yt.isInternetExplorer()?"":"CLIP_POLYLINE"],sources:[M0,i]}),s=new Oe({defines:["VECTOR_TILE"],sources:[o]});e._sp=Jt.fromCache({context:t,vertexShaderSource:r,fragmentShaderSource:s,attributeLocations:th})}function FEe(e,t){let n=e._command;if(!c(e._command)){const o=e._batchTable.getUniformMapCallback()(e._uniformMap);n=e._command=new Ze({owner:e,vertexArray:e._va,renderState:e._rs,shaderProgram:e._sp,uniformMap:o,boundingVolume:e._boundingVolume,pass:xe.TERRAIN_CLASSIFICATION,pickId:e._batchTable.getPickId()});const r=Ze.shallowClone(n,n.derivedCommands.tileset);r.renderState=e._rs3DTiles,r.pass=xe.CESIUM_3D_TILE_CLASSIFICATION,n.derivedCommands.tileset=r}const i=e._classificationType;(i===Ui.TERRAIN||i===Ui.BOTH)&&t.commandList.push(n),(i===Ui.CESIUM_3D_TILE||i===Ui.BOTH)&&t.commandList.push(n.derivedCommands.tileset)}xd.prototype.getPositions=function(e){return Pc.getPolylinePositions(this,e)};xd.prototype.createFeatures=function(e,t){const n=this._batchIds,i=n.length;for(let o=0;o<i;++o){const r=n[o];t[r]=new Ir(e,r)}};xd.prototype.applyDebugSettings=function(e,t){this._highlightColor=e?t:this._constantColor};function BEe(e,t){const n=e._batchIds,i=n.length;for(let o=0;o<i;++o){const r=n[o],s=t[r];s.show=!0,s.color=z.WHITE}}const zEe=new z,UEe=z.WHITE,kEe=!0;xd.prototype.applyStyle=function(e,t){if(!c(e)){BEe(this,t);return}const n=this._batchIds,i=n.length;for(let o=0;o<i;++o){const r=n[o],s=t[r];s.color=c(e.color)?e.color.evaluateColor(s,zEe):UEe,s.show=c(e.show)?e.show.evaluate(s):kEe}};function VEe(e){return Ti.initialize().then(function(){IEe(e,e._rectangle,e._ellipsoid)}).catch(t=>{e.isDestroyed()||(e._error=t)})}xd.prototype.update=function(e){const t=e.context;if(!this._ready){if(c(this._promise)||(this._promise=VEe(this).then(OEe(this,t))),c(this._error)){const i=this._error;throw this._error=void 0,i}return}REe(this,t),MEe(this,t),NEe(this);const n=e.passes;(n.render||n.pick)&&FEe(this,e)};xd.prototype.isDestroyed=function(){return!1};xd.prototype.destroy=function(){return this._va=this._va&&this._va.destroy(),this._sp=this._sp&&this._sp.destroy(),ve(this)};const xS=32767,HEe=new he,GEe=new d;function jEe(e,t,n,i,o){const r=e.length/3,s=e.subarray(0,r),a=e.subarray(r,2*r),l=e.subarray(2*r,3*r);En.zigZagDeltaDecode(s,a,l);const u=new Float64Array(e.length);for(let h=0;h<r;++h){const f=s[h],_=a[h],g=l[h],m=R.lerp(t.west,t.east,f/xS),b=R.lerp(t.south,t.north,_/xS),T=R.lerp(n,i,g/xS),x=he.fromRadians(m,b,T,HEe),C=o.cartographicToCartesian(x,GEe);d.pack(C,u,h*3)}return u}function Pl(e,t,n,i,o){this._tileset=e,this._tile=t,this._resource=n,this._polygons=void 0,this._polylines=void 0,this._points=void 0,this._metadata=void 0,this._batchTable=void 0,this._features=void 0,this.featurePropertiesDirty=!1,this._group=void 0,this._ready=!1,XEe(this,i,o)}Object.defineProperties(Pl.prototype,{featuresLength:{get:function(){return c(this._batchTable)?this._batchTable.featuresLength:0}},pointsLength:{get:function(){return c(this._points)?this._points.pointsLength:0}},trianglesLength:{get:function(){let e=0;return c(this._polygons)&&(e+=this._polygons.trianglesLength),c(this._polylines)&&(e+=this._polylines.trianglesLength),e}},geometryByteLength:{get:function(){let e=0;return c(this._polygons)&&(e+=this._polygons.geometryByteLength),c(this._polylines)&&(e+=this._polylines.geometryByteLength),e}},texturesByteLength:{get:function(){return c(this._points)?this._points.texturesByteLength:0}},batchTableByteLength:{get:function(){return c(this._batchTable)?this._batchTable.batchTableByteLength:0}},innerContents:{get:function(){}},ready:{get:function(){return this._ready}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){return this._resource.getUrlComponent(!0)}},metadata:{get:function(){return this._metadata},set:function(e){this._metadata=e}},batchTable:{get:function(){return this._batchTable}},group:{get:function(){return this._group},set:function(e){this._group=e}}});function WEe(e){return function(t,n){c(e._polygons)&&e._polygons.updateCommands(t,n)}}function qEe(e,t){let n,i,o,r;const s=y(e.POLYGONS_LENGTH,0),a=y(e.POLYLINES_LENGTH,0),l=y(e.POINTS_LENGTH,0);if(s>0&&c(e.POLYGON_BATCH_IDS)){const _=t.byteOffset+e.POLYGON_BATCH_IDS.byteOffset;n=new Uint16Array(t.buffer,_,s)}if(a>0&&c(e.POLYLINE_BATCH_IDS)){const _=t.byteOffset+e.POLYLINE_BATCH_IDS.byteOffset;i=new Uint16Array(t.buffer,_,a)}if(l>0&&c(e.POINT_BATCH_IDS)){const _=t.byteOffset+e.POINT_BATCH_IDS.byteOffset;o=new Uint16Array(t.buffer,_,l)}const u=c(n)||c(i)||c(o),h=s>0&&!c(n)||a>0&&!c(i)||l>0&&!c(o);if(u&&h)throw new Te("If one group of batch ids is defined, then all batch ids must be defined");if(!c(n)&&!c(i)&&!c(o)){let _=0;if(!c(n)&&s>0)for(n=new Uint16Array(s),r=0;r<s;++r)n[r]=_++;if(!c(i)&&a>0)for(i=new Uint16Array(a),r=0;r<a;++r)i[r]=_++;if(!c(o)&&l>0)for(o=new Uint16Array(l),r=0;r<l;++r)o[r]=_++}return{polygons:n,polylines:i,points:o}}const Xc=Uint32Array.BYTES_PER_ELEMENT;function YEe(e){return new Pc(e)}function $Ee(e){return new xd(e)}function XEe(e,t,n){n=y(n,0);const i=new Uint8Array(t),o=new DataView(t);n+=Xc;const r=o.getUint32(n,!0);if(r!==1)throw new Te(`Only Vector tile version 1 is supported. Version ${r} is not.`);n+=Xc;const s=o.getUint32(n,!0);if(n+=Xc,s===0){e._ready=!0;return}const a=o.getUint32(n,!0);if(n+=Xc,a===0)throw new Te("Feature table must have a byte length greater than zero");const l=o.getUint32(n,!0);n+=Xc;const u=o.getUint32(n,!0);n+=Xc;const h=o.getUint32(n,!0);n+=Xc;const f=o.getUint32(n,!0);n+=Xc;const _=o.getUint32(n,!0);n+=Xc;const g=o.getUint32(n,!0);n+=Xc;const m=o.getUint32(n,!0);n+=Xc;const b=sa(i,n,a);n+=a;const T=new Uint8Array(t,n,l);n+=l;let x,C;u>0&&(x=sa(i,n,u),n+=u,h>0&&(C=new Uint8Array(t,n,h),C=new Uint8Array(C),n+=h));const w=y(b.POLYGONS_LENGTH,0),v=y(b.POLYLINES_LENGTH,0),P=y(b.POINTS_LENGTH,0),N=w+v+P,k=new Hn(e,N,x,C,WEe(e));if(e._batchTable=k,N===0)return;const M=new ef(b,T),U=M.getGlobalProperty("REGION");if(!c(U))throw new Te("Feature table global property: REGION must be defined");const B=ce.unpack(U),S=U[4],D=U[5],p=e._tile.computedTransform;let I=M.getGlobalProperty("RTC_CENTER",Z.FLOAT,3);c(I)?(I=d.unpack(I),L.multiplyByPoint(p,I,I)):(I=ce.center(B),I.height=R.lerp(S,D,.5),I=ae.WGS84.cartographicToCartesian(I));const O=qEe(b,T);if(n+=(4-n%4)%4,w>0){M.featuresLength=w;const F=y(M.getPropertyArray("POLYGON_COUNTS",Z.UNSIGNED_INT,1),M.getPropertyArray("POLYGON_COUNT",Z.UNSIGNED_INT,1));if(!c(F))throw new Te("Feature table property: POLYGON_COUNTS must be defined when POLYGONS_LENGTH is greater than 0");const V=y(M.getPropertyArray("POLYGON_INDEX_COUNTS",Z.UNSIGNED_INT,1),M.getPropertyArray("POLYGON_INDEX_COUNT",Z.UNSIGNED_INT,1));if(!c(V))throw new Te("Feature table property: POLYGON_INDEX_COUNTS must be defined when POLYGONS_LENGTH is greater than 0");const G=F.reduce(function(Y,ne){return Y+ne*2},0),j=V.reduce(function(Y,ne){return Y+ne},0),W=new Uint32Array(t,n,j);n+=f;const X=new Uint16Array(t,n,G);n+=_;let q,ee;c(b.POLYGON_MINIMUM_HEIGHTS)&&c(b.POLYGON_MAXIMUM_HEIGHTS)&&(q=M.getPropertyArray("POLYGON_MINIMUM_HEIGHTS",Z.FLOAT,1),ee=M.getPropertyArray("POLYGON_MAXIMUM_HEIGHTS",Z.FLOAT,1)),e._polygons=new Ad({positions:X,counts:F,indexCounts:V,indices:W,minimumHeight:S,maximumHeight:D,polygonMinimumHeights:q,polygonMaximumHeights:ee,center:I,rectangle:B,boundingVolume:e.tile.boundingVolume.boundingVolume,batchTable:k,batchIds:O.polygons,modelMatrix:p})}if(v>0){M.featuresLength=v;const F=y(M.getPropertyArray("POLYLINE_COUNTS",Z.UNSIGNED_INT,1),M.getPropertyArray("POLYLINE_COUNT",Z.UNSIGNED_INT,1));if(!c(F))throw new Te("Feature table property: POLYLINE_COUNTS must be defined when POLYLINES_LENGTH is greater than 0");let V=M.getPropertyArray("POLYLINE_WIDTHS",Z.UNSIGNED_SHORT,1);if(!c(V)){V=new Uint16Array(v);for(let ee=0;ee<v;++ee)V[ee]=2}const G=F.reduce(function(ee,Y){return ee+Y*3},0),j=new Uint16Array(t,n,G);n+=g;const W=e._tileset,X=W.examineVectorLinesFunction;if(c(X)){const ee=jEe(new Uint16Array(j),B,S,D,ae.WGS84);QEe(ee,F,O.polylines,k,e.url,X)}let q=YEe;c(W.classificationType)&&(q=$Ee),e._polylines=q({positions:j,widths:V,counts:F,batchIds:O.polylines,minimumHeight:S,maximumHeight:D,center:I,rectangle:B,boundingVolume:e.tile.boundingVolume.boundingVolume,batchTable:k,classificationType:W.classificationType,keepDecodedPositions:W.vectorKeepDecodedPositions})}if(P>0){const F=new Uint16Array(t,n,P*3);n+=m,e._points=new nf({positions:F,batchIds:O.points,minimumHeight:S,maximumHeight:D,rectangle:B,batchTable:k})}}function GO(e){const t=e.featuresLength;if(!c(e._features)&&t>0){const n=new Array(t);c(e._polygons)&&e._polygons.createFeatures(e,n),c(e._polylines)&&e._polylines.createFeatures(e,n),c(e._points)&&e._points.createFeatures(e,n),e._features=n}}Pl.prototype.hasProperty=function(e,t){return this._batchTable.hasProperty(e,t)};Pl.prototype.getFeature=function(e){const t=this.featuresLength;if(!c(e)||e<0||e>=t)throw new E(`batchId is required and between zero and featuresLength - 1 (${t-1}).`);return c(this._features)||GO(this),this._features[e]};Pl.prototype.applyDebugSettings=function(e,t){c(this._polygons)&&this._polygons.applyDebugSettings(e,t),c(this._polylines)&&this._polylines.applyDebugSettings(e,t),c(this._points)&&this._points.applyDebugSettings(e,t)};Pl.prototype.applyStyle=function(e){c(this._features)||GO(this),c(this._polygons)&&this._polygons.applyStyle(e,this._features),c(this._polylines)&&this._polylines.applyStyle(e,this._features),c(this._points)&&this._points.applyStyle(e,this._features)};Pl.prototype.update=function(e,t){let n=!0;c(this._polygons)&&(this._polygons.classificationType=this._tileset.classificationType,this._polygons.debugWireframe=this._tileset.debugWireframe,this._polygons.update(t),n=n&&this._polygons.ready),c(this._polylines)&&(this._polylines.update(t),n=n&&this._polylines.ready),c(this._points)&&(this._points.update(t),n=n&&this._points.ready),c(this._batchTable)&&n&&(c(this._features)||GO(this),this._batchTable.update(e,t),this._ready=!0)};Pl.prototype.pick=function(e,t,n){};Pl.prototype.getPolylinePositions=function(e){const t=this._polylines;if(!!c(t))return t.getPositions(e)};Pl.prototype.isDestroyed=function(){return!1};Pl.prototype.destroy=function(){return this._polygons=this._polygons&&this._polygons.destroy(),this._polylines=this._polylines&&this._polylines.destroy(),this._points=this._points&&this._points.destroy(),this._batchTable=this._batchTable&&this._batchTable.destroy(),ve(this)};function QEe(e,t,n,i,o,r){const s=t.length;let a=0;for(let l=0;l<s;l++){const u=t[l]*3,h=e.slice(a,a+u);a+=u,r(h,n[l],o,i)}}const P8={b3dm:function(e,t,n,i,o){return zi.fromB3dm(e,t,n,i,o)},pnts:function(e,t,n,i,o){return zi.fromPnts(e,t,n,i,o)},i3dm:function(e,t,n,i,o){return zi.fromI3dm(e,t,n,i,o)},cmpt:function(e,t,n,i,o){return Ic.fromTileType(e,t,n,i,o,P8)},externalTileset:function(e,t,n,i){return Dc.fromJson(e,t,n,i)},geom:function(e,t,n,i,o){return new fu(e,t,n,i,o)},vctr:function(e,t,n,i,o){return new Pl(e,t,n,i,o)},subt:function(e,t,n,i,o){return ys.fromSubtreeJson(e,t,n,void 0,i,o)},subtreeJson:function(e,t,n,i){return ys.fromSubtreeJson(e,t,n,i)},glb:function(e,t,n,i,o){if(i.byteLength<12)throw new Te("Invalid glb content");const a=new DataView(i,o).getUint32(8,!0),l=new Uint8Array(i,o,a);return zi.fromGltf(e,t,n,l)},gltf:function(e,t,n,i){return zi.fromGltf(e,t,n,i)},geoJson:function(e,t,n,i){return zi.fromGeoJson(e,t,n,i)}},O8=P8,KEe={UNLOADED:0,LOADING:1,PROCESSING:2,READY:3,EXPIRED:4,FAILED:5},bo=Object.freeze(KEe),Jc={BATCHED_3D_MODEL:"b3dm",INSTANCED_3D_MODEL:"i3dm",COMPOSITE:"cmpt",POINT_CLOUD:"pnts",VECTOR:"vctr",GEOMETRY:"geom",GLTF:"gltf",GLTF_BINARY:"glb",IMPLICIT_SUBTREE:"subt",IMPLICIT_SUBTREE_JSON:"subtreeJson",EXTERNAL_TILESET:"externalTileset",MULTIPLE_CONTENT:"multipleContent",GEOJSON:"geoJson",VOXEL_BINARY:"voxl",VOXEL_JSON:"voxelJson"};Jc.isBinaryFormat=function(e){switch(e){case Jc.BATCHED_3D_MODEL:case Jc.INSTANCED_3D_MODEL:case Jc.COMPOSITE:case Jc.POINT_CLOUD:case Jc.VECTOR:case Jc.GEOMETRY:case Jc.IMPLICIT_SUBTREE:case Jc.VOXEL_BINARY:case Jc.GLTF_BINARY:return!0;default:return!1}};const na=Object.freeze(Jc),ZEe={NOT_COMPUTED:-1,USE_OPTIMIZATION:1,SKIP_OPTIMIZATION:0},Km=Object.freeze(ZEe),hr={RENDER:0,PICK:1,SHADOW:2,PRELOAD:3,PRELOAD_FLIGHT:4,REQUEST_RENDER_MODE_DEFER_CHECK:5,MOST_DETAILED_PRELOAD:6,MOST_DETAILED_PICK:7,NUMBER_OF_PASSES:8},Cd=new Array(hr.NUMBER_OF_PASSES);Cd[hr.RENDER]=Object.freeze({pass:hr.RENDER,isRender:!0,requestTiles:!0,ignoreCommands:!1});Cd[hr.PICK]=Object.freeze({pass:hr.PICK,isRender:!1,requestTiles:!1,ignoreCommands:!1});Cd[hr.SHADOW]=Object.freeze({pass:hr.SHADOW,isRender:!1,requestTiles:!0,ignoreCommands:!1});Cd[hr.PRELOAD]=Object.freeze({pass:hr.PRELOAD,isRender:!1,requestTiles:!0,ignoreCommands:!0});Cd[hr.PRELOAD_FLIGHT]=Object.freeze({pass:hr.PRELOAD_FLIGHT,isRender:!1,requestTiles:!0,ignoreCommands:!0});Cd[hr.REQUEST_RENDER_MODE_DEFER_CHECK]=Object.freeze({pass:hr.REQUEST_RENDER_MODE_DEFER_CHECK,isRender:!1,requestTiles:!0,ignoreCommands:!0});Cd[hr.MOST_DETAILED_PRELOAD]=Object.freeze({pass:hr.MOST_DETAILED_PRELOAD,isRender:!1,requestTiles:!0,ignoreCommands:!0});Cd[hr.MOST_DETAILED_PICK]=Object.freeze({pass:hr.MOST_DETAILED_PICK,isRender:!1,requestTiles:!1,ignoreCommands:!1});hr.getPassOptions=function(e){return Cd[e]};const wr=Object.freeze(hr);function Al(e,t){this._tileset=e,this._tile=t,this.featurePropertiesDirty=!1}Object.defineProperties(Al.prototype,{featuresLength:{get:function(){return 0}},pointsLength:{get:function(){return 0}},trianglesLength:{get:function(){return 0}},geometryByteLength:{get:function(){return 0}},texturesByteLength:{get:function(){return 0}},batchTableByteLength:{get:function(){return 0}},innerContents:{get:function(){}},ready:{get:function(){return!0}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){}},metadata:{get:function(){},set:function(e){throw new E("Empty3DTileContent cannot have content metadata")}},batchTable:{get:function(){}},group:{get:function(){},set:function(e){throw new E("Empty3DTileContent cannot have group metadata")}}});Al.prototype.hasProperty=function(e,t){return!1};Al.prototype.getFeature=function(e){};Al.prototype.applyDebugSettings=function(e,t){};Al.prototype.applyStyle=function(e){};Al.prototype.update=function(e,t){};Al.prototype.pick=function(e,t,n){};Al.prototype.isDestroyed=function(){return!1};Al.prototype.destroy=function(){return ve(this)};function Ed(e){e=y(e,y.EMPTY_OBJECT);const t=e.content,n=e.class;A.typeOf.object("options.content",t),A.typeOf.object("options.class",n),this._class=n,this._properties=t.properties,this._extensions=t.extensions,this._extras=t.extras}Object.defineProperties(Ed.prototype,{class:{get:function(){return this._class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});Ed.prototype.hasProperty=function(e){return Rt.hasProperty(e,this._properties,this._class)};Ed.prototype.hasPropertyBySemantic=function(e){return Rt.hasPropertyBySemantic(e,this._properties,this._class)};Ed.prototype.getPropertyIds=function(e){return Rt.getPropertyIds(this._properties,this._class,e)};Ed.prototype.getProperty=function(e){return Rt.getProperty(e,this._properties,this._class)};Ed.prototype.setProperty=function(e,t){return Rt.setProperty(e,t,this._properties,this._class)};Ed.prototype.getPropertyBySemantic=function(e){return Rt.getPropertyBySemantic(e,this._properties,this._class)};Ed.prototype.setPropertyBySemantic=function(e,t){return Rt.setPropertyBySemantic(e,t,this._properties,this._class)};function kC(e,t){const n=To(t,"3DTILES_metadata")?t.extensions["3DTILES_metadata"]:t.metadata;if(!c(n))return;if(!c(e.schema)){kC._oneTimeWarning("findContentMetadata-missing-root-schema","Could not find a metadata schema for content metadata. For tilesets that contain external tilesets, make sure the schema is added to the root tileset.json.");return}const i=y(e.schema.classes,y.EMPTY_OBJECT);if(c(n.class)){const o=i[n.class];return new Ed({content:n,class:o})}}kC._oneTimeWarning=$n;function L8(e,t){const n=e.metadataExtension;if(!c(n))return;const i=n.groups,o=To(t,"3DTILES_metadata")?t.extensions["3DTILES_metadata"].group:t.group;if(typeof o=="number")return i[o];const r=n.groupIds.findIndex(function(s){return s===o});return r>=0?i[r]:void 0}function wd(e){e=y(e,y.EMPTY_OBJECT);const t=e.tile,n=e.class;A.typeOf.object("options.tile",t),A.typeOf.object("options.class",n),this._class=n,this._properties=t.properties,this._extensions=t.extensions,this._extras=t.extras}Object.defineProperties(wd.prototype,{class:{get:function(){return this._class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});wd.prototype.hasProperty=function(e){return Rt.hasProperty(e,this._properties,this._class)};wd.prototype.hasPropertyBySemantic=function(e){return Rt.hasPropertyBySemantic(e,this._properties,this._class)};wd.prototype.getPropertyIds=function(e){return Rt.getPropertyIds(this._properties,this._class,e)};wd.prototype.getProperty=function(e){return Rt.getProperty(e,this._properties,this._class)};wd.prototype.setProperty=function(e,t){return Rt.setProperty(e,t,this._properties,this._class)};wd.prototype.getPropertyBySemantic=function(e){return Rt.getPropertyBySemantic(e,this._properties,this._class)};wd.prototype.setPropertyBySemantic=function(e,t){return Rt.setPropertyBySemantic(e,t,this._properties,this._class)};function jO(e,t){const n=To(t,"3DTILES_metadata")?t.extensions["3DTILES_metadata"]:t.metadata;if(!c(n))return;if(!c(e.schema)){jO._oneTimeWarning("findTileMetadata-missing-root-schema","Could not find a metadata schema for tile metadata. For tilesets that contain external tilesets, make sure the schema is added to the root tileset.json.");return}const i=y(e.schema.classes,y.EMPTY_OBJECT);if(c(n.class)){const o=i[n.class];return new wd({tile:n,class:o})}}jO._oneTimeWarning=$n;function R8(e){const t=new Uint8Array(e);let n=xC(t);if(n==="glTF"&&(n="glb"),na.isBinaryFormat(n))return{contentType:n,binaryPayload:t};const i=JEe(t);if(c(i.root))return{contentType:na.EXTERNAL_TILESET,jsonPayload:i};if(c(i.asset))return{contentType:na.GLTF,jsonPayload:i};if(c(i.tileAvailability))return{contentType:na.IMPLICIT_SUBTREE_JSON,jsonPayload:i};if(c(i.type))return{contentType:na.GEOJSON,jsonPayload:i};if(c(i.voxelTable))return{contentType:na.VOXEL_JSON,jsonPayload:i};throw new Te("Invalid tile content.")}function JEe(e){let t;try{t=sa(e)}catch{throw new Te("Invalid tile content.")}return t}function kc(e,t,n,i){this._tileset=e,this._tile=t,this._tilesetResource=n,this._contents=[],this._contentsCreated=!1;const o=c(i.contents)?i.contents:i.content;this._innerContentHeaders=o,this._requestsInFlight=0,this._cancelCount=0;const r=this._innerContentHeaders.length;this._arrayFetchPromises=new Array(r),this._requests=new Array(r),this._ready=!1,this._innerContentResources=new Array(r),this._serverKeys=new Array(r);for(let s=0;s<r;s++){const a=n.getDerivedResource({url:o[s].uri}),l=Nn.getServerKey(a.getUrlComponent());this._innerContentResources[s]=a,this._serverKeys[s]=l}}Object.defineProperties(kc.prototype,{featurePropertiesDirty:{get:function(){const e=this._contents,t=e.length;for(let n=0;n<t;++n)if(e[n].featurePropertiesDirty)return!0;return!1},set:function(e){const t=this._contents,n=t.length;for(let i=0;i<n;++i)t[i].featurePropertiesDirty=e}},featuresLength:{get:function(){return 0}},pointsLength:{get:function(){return 0}},trianglesLength:{get:function(){return 0}},geometryByteLength:{get:function(){return 0}},texturesByteLength:{get:function(){return 0}},batchTableByteLength:{get:function(){return 0}},innerContents:{get:function(){return this._contents}},ready:{get:function(){return this._contentsCreated?this._ready:!1}},tileset:{get:function(){return this._tileset}},tile:{get:function(){return this._tile}},url:{get:function(){}},metadata:{get:function(){},set:function(){throw new E("Multiple3DTileContent cannot have metadata")}},batchTable:{get:function(){}},group:{get:function(){},set:function(){throw new E("Multiple3DTileContent cannot have group metadata")}},innerContentUrls:{get:function(){return this._innerContentHeaders.map(function(e){return e.uri})}}});function fD(e,t){e._requestsInFlight+=t,e.tileset.statistics.numberOfPendingRequests+=t}function GF(e,t){e._cancelCount++,e._tile._contentState=t;const n=e.tileset.statistics;n.numberOfPendingRequests-=e._requestsInFlight,n.numberOfAttemptedRequests+=e._requestsInFlight,e._requestsInFlight=0;const i=e._innerContentHeaders.length;e._arrayFetchPromises=new Array(i)}kc.prototype.requestInnerContents=function(){if(!ewe(this._serverKeys)){this.tileset.statistics.numberOfAttemptedRequests+=this._serverKeys.length;return}const e=this._innerContentHeaders;fD(this,e.length);const t=this._cancelCount;for(let n=0;n<e.length;n++)this._arrayFetchPromises[n]=twe(this,n,t,this._tile._contentState);return nwe(this)};function ewe(e){const t={};for(let n=0;n<e.length;n++){const i=e[n];c(t[i])?t[i]++:t[i]=1}for(const n in t)if(t.hasOwnProperty(n)&&!Nn.serverHasOpenSlots(n,t[n]))return!1;return Nn.heapHasOpenSlots(e.length)}function twe(e,t,n,i){const o=e._innerContentResources[t].clone(),r=e.tile,s=function(){return r._priority},a=e._serverKeys[t],l=new iu({throttle:!0,throttleByServer:!0,type:Ip.TILES3D,priorityFunction:s,serverKey:a});o.request=l,e._requests[t]=l;const u=o.fetchArrayBuffer();if(!!c(u))return u.then(function(h){if(!(n<e._cancelCount)){if(o.request.cancelled||o.request.state===di.CANCELLED){GF(e,i);return}return fD(e,-1),h}}).catch(function(h){if(!(n<e._cancelCount)){if(o.request.cancelled||o.request.state===di.CANCELLED){GF(e,i);return}fD(e,-1),N8(e,t,h)}})}async function nwe(e){const t=e._cancelCount,n=await Promise.all(e._arrayFetchPromises);if(t<e._cancelCount)return;const i=n.map((r,s)=>iwe(e,r,s)),o=await Promise.all(i);return e._contentsCreated=!0,e._contents=o.filter(c),o}async function iwe(e,t,n){if(!!c(t))try{const i=R8(t);if(i.contentType===na.EXTERNAL_TILESET)throw new Te("External tilesets are disallowed inside multiple contents");e._disableSkipLevelOfDetail=e._disableSkipLevelOfDetail||i.contentType===na.GEOMETRY||i.contentType===na.VECTOR;const o=e._tileset,r=e._innerContentResources[n],s=e._tile;let a;const l=O8[i.contentType];c(i.binaryPayload)?a=await Promise.resolve(l(o,s,r,i.binaryPayload.buffer,0)):a=await Promise.resolve(l(o,s,r,i.jsonPayload));const u=e._innerContentHeaders[n];if(s.hasImplicitContentMetadata){const f=s.implicitSubtree,_=s.implicitCoordinates;a.metadata=f.getContentMetadataView(_,n)}else s.hasImplicitContent||(a.metadata=kC(o,u));const h=L8(o,u);return c(h)&&(a.group=new rO({metadata:h})),a}catch(i){N8(e,n,i)}}function N8(e,t,n){const i=e._tileset,o=e._innerContentResources[t].url,r=c(n.message)?n.message:n.toString();i.tileFailed.numberOfListeners>0?i.tileFailed.raiseEvent({url:o,message:r}):(console.log(`A content failed to load: ${o}`),console.log(`Error: ${r}`))}kc.prototype.cancelRequests=function(){for(let e=0;e<this._requests.length;e++){const t=this._requests[e];c(t)&&t.cancel()}};kc.prototype.hasProperty=function(e,t){return!1};kc.prototype.getFeature=function(e){};kc.prototype.applyDebugSettings=function(e,t){const n=this._contents,i=n.length;for(let o=0;o<i;++o)n[o].applyDebugSettings(e,t)};kc.prototype.applyStyle=function(e){const t=this._contents,n=t.length;for(let i=0;i<n;++i)t[i].applyStyle(e)};kc.prototype.update=function(e,t){const n=this._contents,i=n.length;let o=!0;for(let r=0;r<i;++r)n[r].update(e,t),o=o&&n[r].ready;!this._ready&&o&&(this._ready=!0)};kc.prototype.pick=function(e,t,n){if(!this._ready)return;let i,o=Number.POSITIVE_INFINITY;const r=this._contents,s=r.length;for(let a=0;a<s;++a){const l=r[a].pick(e,t,n);if(!c(l))continue;const u=d.distance(e.origin,l);u<o&&(i=l,o=u)}if(!!c(i))return n};kc.prototype.isDestroyed=function(){return!1};kc.prototype.destroy=function(){const e=this._contents,t=e.length;for(let n=0;n<t;++n)e[n].destroy();return ve(this)};const jF=Math.cos,WF=Math.sin,owe=Math.sqrt,WO={};WO.computePosition=function(e,t,n,i,o,r,s){const a=t.radiiSquared,l=e.nwCorner,u=e.boundingRectangle;let h=l.latitude-e.granYCos*i+o*e.granXSin;const f=jF(h),_=WF(h),g=a.z*_;let m=l.longitude+i*e.granYSin+o*e.granXCos;const b=f*jF(m),T=f*WF(m),x=a.x*b,C=a.y*T,w=owe(x*b+C*T+g*_);if(r.x=x/w,r.y=C/w,r.z=g/w,n){const v=e.stNwCorner;c(v)?(h=v.latitude-e.stGranYCos*i+o*e.stGranXSin,m=v.longitude+i*e.stGranYSin+o*e.stGranXCos,s.x=(m-e.stWest)*e.lonScalar,s.y=(h-e.stSouth)*e.latScalar):(s.x=(m-u.west)*e.lonScalar,s.y=(h-u.south)*e.latScalar)}};const rwe=new Xe;let ec=new d;const swe=new he;let Yx=new d;const pD=new co;function qF(e,t,n,i,o,r,s){const a=Math.cos(t),l=i*a,u=n*a,h=Math.sin(t),f=i*h,_=n*h;ec=pD.project(e,ec),ec=d.subtract(ec,Yx,ec);const g=Xe.fromRotation(t,rwe);ec=Xe.multiplyByVector(g,ec,ec),ec=d.add(ec,Yx,ec),e=pD.unproject(ec,e),r-=1,s-=1;const m=e.latitude,b=m+r*_,T=m-l*s,x=m-l*s+r*_,C=Math.max(m,b,T,x),w=Math.min(m,b,T,x),v=e.longitude,P=v+r*u,N=v+s*f,k=v+s*f+r*u,M=Math.max(v,P,N,k),U=Math.min(v,P,N,k);return{north:C,south:w,east:M,west:U,granYCos:l,granYSin:f,granXCos:u,granXSin:_,nwCorner:e}}WO.computeOptions=function(e,t,n,i,o,r,s){let a=e.east,l=e.west,u=e.north,h=e.south,f=!1,_=!1;u===R.PI_OVER_TWO&&(f=!0),h===-R.PI_OVER_TWO&&(_=!0);let g;const m=u-h;l>a?g=R.TWO_PI-l+a:g=a-l;const b=Math.ceil(g/t)+1,T=Math.ceil(m/t)+1,x=g/(b-1),C=m/(T-1),w=ce.northwest(e,r),v=ce.center(e,swe);(n!==0||i!==0)&&(v.longitude<w.longitude&&(v.longitude+=R.TWO_PI),Yx=pD.project(v,Yx));const P=C,N=x,k=0,M=0,U=ce.clone(e,o),B={granYCos:P,granYSin:k,granXCos:N,granXSin:M,nwCorner:w,boundingRectangle:U,width:b,height:T,northCap:f,southCap:_};if(n!==0){const S=qF(w,n,x,C,v,b,T);if(u=S.north,h=S.south,a=S.east,l=S.west,u<-R.PI_OVER_TWO||u>R.PI_OVER_TWO||h<-R.PI_OVER_TWO||h>R.PI_OVER_TWO)throw new E("Rotated rectangle is invalid. It crosses over either the north or south pole.");B.granYCos=S.granYCos,B.granYSin=S.granYSin,B.granXCos=S.granXCos,B.granXSin=S.granXSin,U.north=u,U.south=h,U.east=a,U.west=l}if(i!==0){n=n-i;const S=ce.northwest(U,s),D=qF(S,n,x,C,v,b,T);B.stGranYCos=D.granYCos,B.stGranXCos=D.granXCos,B.stGranYSin=D.granYSin,B.stGranXSin=D.granXSin,B.stNwCorner=S,B.stWest=D.west,B.stSouth=D.south}return B};const Ns=WO,awe=new se,cwe=new se,lwe=new d,uwe=new ce;function M8(e,t){const n=e._ellipsoid,i=t.height,o=t.width,r=t.northCap,s=t.southCap;let a=i,l=2,u=0,h=4;r&&(l-=1,a-=1,u+=1,h-=2),s&&(l-=1,a-=1,u+=1,h-=2),u+=l*o+2*a-h;const f=new Float64Array(u*3);let _=0,g=0,m;const b=lwe;if(r)Ns.computePosition(t,n,!1,g,0,b),f[_++]=b.x,f[_++]=b.y,f[_++]=b.z;else for(m=0;m<o;m++)Ns.computePosition(t,n,!1,g,m,b),f[_++]=b.x,f[_++]=b.y,f[_++]=b.z;for(m=o-1,g=1;g<i;g++)Ns.computePosition(t,n,!1,g,m,b),f[_++]=b.x,f[_++]=b.y,f[_++]=b.z;if(g=i-1,!s)for(m=o-2;m>=0;m--)Ns.computePosition(t,n,!1,g,m,b),f[_++]=b.x,f[_++]=b.y,f[_++]=b.z;for(m=0,g=i-2;g>0;g--)Ns.computePosition(t,n,!1,g,m,b),f[_++]=b.x,f[_++]=b.y,f[_++]=b.z;const T=f.length/3*2,x=je.createTypedArray(f.length/3,T);let C=0;for(let v=0;v<f.length/3-1;v++)x[C++]=v,x[C++]=v+1;x[C++]=f.length/3-1,x[C++]=0;const w=new Tt({attributes:new oi,primitiveType:ze.LINES});return w.attributes.position=new Ie({componentDatatype:Z.DOUBLE,componentsPerAttribute:3,values:f}),w.indices=x,w}function dwe(e,t){const n=e._surfaceHeight,i=e._extrudedHeight,o=e._ellipsoid,r=M8(e,t),s=t.height,a=t.width,l=ai.scaleToGeodeticHeight(r.attributes.position.values,n,o,!1);let u=l.length;const h=new Float64Array(u*2);h.set(l);const f=ai.scaleToGeodeticHeight(r.attributes.position.values,i,o);h.set(f,u),r.attributes.position.values=h;const _=t.northCap,g=t.southCap;let m=4;_&&(m-=1),g&&(m-=1);const b=(h.length/3+m)*2,T=je.createTypedArray(h.length/3,b);u=h.length/6;let x=0;for(let w=0;w<u-1;w++)T[x++]=w,T[x++]=w+1,T[x++]=w+u,T[x++]=w+u+1;T[x++]=u-1,T[x++]=0,T[x++]=u+u-1,T[x++]=u,T[x++]=0,T[x++]=u;let C;if(_)C=s-1;else{const w=a-1;T[x++]=w,T[x++]=w+u,C=a+s-2}if(T[x++]=C,T[x++]=C+u,!g){const w=a+C-1;T[x++]=w,T[x]=w+u}return r.indices=T,r}function fp(e){e=y(e,y.EMPTY_OBJECT);const t=e.rectangle,n=y(e.granularity,R.RADIANS_PER_DEGREE),i=y(e.ellipsoid,ae.WGS84),o=y(e.rotation,0);if(!c(t))throw new E("rectangle is required.");if(ce.validate(t),t.north<t.south)throw new E("options.rectangle.north must be greater than options.rectangle.south");const r=y(e.height,0),s=y(e.extrudedHeight,r);this._rectangle=ce.clone(t),this._granularity=n,this._ellipsoid=i,this._surfaceHeight=Math.max(r,s),this._rotation=o,this._extrudedHeight=Math.min(r,s),this._offsetAttribute=e.offsetAttribute,this._workerName="createRectangleOutlineGeometry"}fp.packedLength=ce.packedLength+ae.packedLength+5;fp.pack=function(e,t,n){if(!c(e))throw new E("value is required");if(!c(t))throw new E("array is required");return n=y(n,0),ce.pack(e._rectangle,t,n),n+=ce.packedLength,ae.pack(e._ellipsoid,t,n),n+=ae.packedLength,t[n++]=e._granularity,t[n++]=e._surfaceHeight,t[n++]=e._rotation,t[n++]=e._extrudedHeight,t[n]=y(e._offsetAttribute,-1),t};const F8=new ce,B8=ae.clone(ae.UNIT_SPHERE),_m={rectangle:F8,ellipsoid:B8,granularity:void 0,height:void 0,rotation:void 0,extrudedHeight:void 0,offsetAttribute:void 0};fp.unpack=function(e,t,n){if(!c(e))throw new E("array is required");t=y(t,0);const i=ce.unpack(e,t,F8);t+=ce.packedLength;const o=ae.unpack(e,t,B8);t+=ae.packedLength;const r=e[t++],s=e[t++],a=e[t++],l=e[t++],u=e[t];return c(n)?(n._rectangle=ce.clone(i,n._rectangle),n._ellipsoid=ae.clone(o,n._ellipsoid),n._surfaceHeight=s,n._rotation=a,n._extrudedHeight=l,n._offsetAttribute=u===-1?void 0:u,n):(_m.granularity=r,_m.height=s,_m.rotation=a,_m.extrudedHeight=l,_m.offsetAttribute=u===-1?void 0:u,new fp(_m))};const hwe=new he;fp.createGeometry=function(e){const t=e._rectangle,n=e._ellipsoid,i=Ns.computeOptions(t,e._granularity,e._rotation,0,uwe,hwe);let o,r;if(R.equalsEpsilon(t.north,t.south,R.EPSILON10)||R.equalsEpsilon(t.east,t.west,R.EPSILON10))return;const s=e._surfaceHeight,a=e._extrudedHeight,l=!R.equalsEpsilon(s,a,0,R.EPSILON2);let u;if(l){if(o=dwe(e,i),c(e._offsetAttribute)){const _=o.attributes.position.values.length/3;let g=new Uint8Array(_);e._offsetAttribute===Kt.TOP?g=g.fill(1,0,_/2):(u=e._offsetAttribute===Kt.NONE?0:1,g=g.fill(u)),o.attributes.applyOffset=new Ie({componentDatatype:Z.UNSIGNED_BYTE,componentsPerAttribute:1,values:g})}const h=se.fromRectangle3D(t,n,s,cwe),f=se.fromRectangle3D(t,n,a,awe);r=se.union(h,f)}else{if(o=M8(e,i),o.attributes.position.values=ai.scaleToGeodeticHeight(o.attributes.position.values,s,n,!1),c(e._offsetAttribute)){const h=o.attributes.position.values.length;u=e._offsetAttribute===Kt.NONE?0:1;const f=new Uint8Array(h/3).fill(u);o.attributes.applyOffset=new Ie({componentDatatype:Z.UNSIGNED_BYTE,componentsPerAttribute:1,values:f})}r=se.fromRectangle3D(t,n,s)}return new Tt({attributes:o.attributes,indices:o.indices,primitiveType:ze.LINES,boundingSphere:r,offsetAttribute:e._offsetAttribute})};function ru(e){A.typeOf.object("options",e),A.typeOf.object("options.rectangle",e.rectangle),this.rectangle=ce.clone(e.rectangle),this.minimumHeight=y(e.minimumHeight,0),this.maximumHeight=y(e.maximumHeight,0),this.southwestCornerCartesian=new d,this.northeastCornerCartesian=new d,this.westNormal=new d,this.southNormal=new d,this.eastNormal=new d,this.northNormal=new d;const t=y(e.ellipsoid,ae.WGS84);gwe(this,e.rectangle,t),this._orientedBoundingBox=void 0,this._boundingSphere=void 0,y(e.computeBoundingVolumes,!0)&&this.computeBoundingVolumes(t)}Object.defineProperties(ru.prototype,{boundingVolume:{get:function(){return this._orientedBoundingBox}},boundingSphere:{get:function(){return this._boundingSphere}}});ru.prototype.computeBoundingVolumes=function(e){this._orientedBoundingBox=Ct.fromRectangle(this.rectangle,this.minimumHeight,this.maximumHeight,e),this._boundingSphere=se.fromOrientedBoundingBox(this._orientedBoundingBox)};const YF=new d,xT=new d,$F=new d,fwe=new d,pwe=new d,mwe=new d,_we=new d,tc=new he,XF=new _t(d.UNIT_X,0),gm=new nn;function gwe(e,t,n){n.cartographicToCartesian(ce.southwest(t),e.southwestCornerCartesian),n.cartographicToCartesian(ce.northeast(t),e.northeastCornerCartesian),tc.longitude=t.west,tc.latitude=(t.south+t.north)*.5,tc.height=0;const i=n.cartographicToCartesian(tc,mwe),o=d.cross(i,d.UNIT_Z,fwe);d.normalize(o,e.westNormal),tc.longitude=t.east;const r=n.cartographicToCartesian(tc,_we),s=d.cross(d.UNIT_Z,r,YF);d.normalize(s,e.eastNormal);let a=d.subtract(i,r,YF);d.magnitude(a)===0&&(a=d.clone(o,a));const l=d.normalize(a,pwe),u=t.south;let h;if(u>0){tc.longitude=(t.west+t.east)*.5,tc.latitude=u;const b=n.cartographicToCartesian(tc,gm.origin);d.clone(l,gm.direction);const T=_t.fromPointNormal(e.southwestCornerCartesian,e.westNormal,XF);Ei.rayPlane(gm,T,e.southwestCornerCartesian),h=n.geodeticSurfaceNormal(b,xT)}else h=n.geodeticSurfaceNormalCartographic(ce.southeast(t),xT);const f=d.cross(h,a,$F);d.normalize(f,e.southNormal);const _=t.north;let g;if(_<0){tc.longitude=(t.west+t.east)*.5,tc.latitude=_;const b=n.cartographicToCartesian(tc,gm.origin);d.negate(l,gm.direction);const T=_t.fromPointNormal(e.northeastCornerCartesian,e.eastNormal,XF);Ei.rayPlane(gm,T,e.northeastCornerCartesian),g=n.geodeticSurfaceNormal(b,xT)}else g=n.geodeticSurfaceNormalCartographic(ce.northwest(t),xT);const m=d.cross(a,g,$F);d.normalize(m,e.northNormal)}const ywe=new d,bwe=new d,Twe=new d(0,-1,0),Awe=new d(0,0,-1),QF=new d;function xwe(e,t){const n=t.camera,i=n.positionWC,o=n.positionCartographic;let r=0;if(!ce.contains(e.rectangle,o)){let u=e.southwestCornerCartesian,h=e.northeastCornerCartesian,f=e.westNormal,_=e.southNormal,g=e.eastNormal,m=e.northNormal;t.mode!==oe.SCENE3D&&(u=t.mapProjection.project(ce.southwest(e.rectangle),ywe),u.z=u.y,u.y=u.x,u.x=0,h=t.mapProjection.project(ce.northeast(e.rectangle),bwe),h.z=h.y,h.y=h.x,h.x=0,f=Twe,g=d.UNIT_Y,_=Awe,m=d.UNIT_Z);const b=d.subtract(i,u,QF),T=d.dot(b,f),x=d.dot(b,_),C=d.subtract(i,h,QF),w=d.dot(C,g),v=d.dot(C,m);T>0?r+=T*T:w>0&&(r+=w*w),x>0?r+=x*x:v>0&&(r+=v*v)}let s,a,l;if(t.mode===oe.SCENE3D?(s=o.height,a=e.minimumHeight,l=e.maximumHeight):(s=i.x,a=0,l=0),s>l){const u=s-l;r+=u*u}else if(s<a){const u=a-s;r+=u*u}return Math.sqrt(r)}ru.prototype.distanceToCamera=function(e){A.defined("frameState",e);const t=xwe(this,e);if(e.mode===oe.SCENE3D&&c(this._orientedBoundingBox)){const n=Math.sqrt(this._orientedBoundingBox.distanceSquaredTo(e.camera.positionWC));return Math.max(t,n)}return t};ru.prototype.intersectPlane=function(e){return A.defined("plane",e),this._orientedBoundingBox.intersectPlane(e)};ru.prototype.createDebugVolume=function(e){A.defined("color",e);const t=new L.clone(L.IDENTITY),n=new fp({rectangle:this.rectangle,height:this.minimumHeight,extrudedHeight:this.maximumHeight}),i=new Gt({geometry:n,id:"outline",modelMatrix:t,attributes:{color:$t.fromColor(e)}});return new Mt({geometryInstances:i,appearance:new tn({translucent:!1,flat:!0}),asynchronous:!1})};const X0={},Cwe=new d,z8=new d,U8=new d,k8=new d,V8=new Ct;X0.validOutline=function(e){A.defined("positions",e);const n=Ct.fromPoints(e,V8).halfAxes,i=$.getColumn(n,0,z8),o=$.getColumn(n,1,U8),r=$.getColumn(n,2,k8),s=d.magnitude(i),a=d.magnitude(o),l=d.magnitude(r);return!(s===0&&(a===0||l===0)||a===0&&l===0)};X0.computeProjectTo2DArguments=function(e,t,n,i){A.defined("positions",e),A.defined("centerResult",t),A.defined("planeAxis1Result",n),A.defined("planeAxis2Result",i);const o=Ct.fromPoints(e,V8),r=o.halfAxes,s=$.getColumn(r,0,z8),a=$.getColumn(r,1,U8),l=$.getColumn(r,2,k8),u=d.magnitude(s),h=d.magnitude(a),f=d.magnitude(l),_=Math.min(u,h,f);if(u===0&&(h===0||f===0)||h===0&&f===0)return!1;let g,m;return(_===h||_===f)&&(g=s),_===u?g=a:_===f&&(m=a),(_===u||_===h)&&(m=l),d.normalize(g,n),d.normalize(m,i),d.clone(o.center,t),!0};function H8(e,t,n,i,o){const r=d.subtract(e,t,Cwe),s=d.dot(n,r),a=d.dot(i,r);return H.fromElements(s,a,o)}X0.createProjectPointsTo2DFunction=function(e,t,n){return function(i){const o=new Array(i.length);for(let r=0;r<i.length;r++)o[r]=H8(i[r],e,t,n);return o}};X0.createProjectPointTo2DFunction=function(e,t,n){return function(i,o){return H8(i,e,t,n,o)}};const QA=X0;function Ewe(e){const t=e.length,n=new Float64Array(t*3),i=je.createTypedArray(t,t*2);let o=0,r=0;for(let a=0;a<t;a++){const l=e[a];n[o++]=l.x,n[o++]=l.y,n[o++]=l.z,i[r++]=a,i[r++]=(a+1)%t}const s=new oi({position:new Ie({componentDatatype:Z.DOUBLE,componentsPerAttribute:3,values:n})});return new Tt({attributes:s,indices:i,primitiveType:ze.LINES})}function ga(e){e=y(e,y.EMPTY_OBJECT);const t=e.polygonHierarchy;A.defined("options.polygonHierarchy",t),this._polygonHierarchy=t,this._workerName="createCoplanarPolygonOutlineGeometry",this.packedLength=an.computeHierarchyPackedLength(t,d)+1}ga.fromPositions=function(e){e=y(e,y.EMPTY_OBJECT),A.defined("options.positions",e.positions);const t={polygonHierarchy:{positions:e.positions}};return new ga(t)};ga.pack=function(e,t,n){return A.typeOf.object("value",e),A.defined("array",t),n=y(n,0),n=an.packPolygonHierarchy(e._polygonHierarchy,t,n,d),t[n]=e.packedLength,t};const wwe={polygonHierarchy:{}};ga.unpack=function(e,t,n){A.defined("array",e),t=y(t,0);const i=an.unpackPolygonHierarchy(e,t,d);t=i.startingIndex,delete i.startingIndex;const o=e[t];return c(n)||(n=new ga(wwe)),n._polygonHierarchy=i,n.packedLength=o,n};ga.createGeometry=function(e){const t=e._polygonHierarchy;let n=t.positions;if(n=gs(n,d.equalsEpsilon,!0),n.length<3||!QA.validOutline(n))return;const o=an.polygonOutlinesFromHierarchy(t,!1);if(o.length===0)return;const r=[];for(let l=0;l<o.length;l++){const u=new Gt({geometry:Ewe(o[l])});r.push(u)}const s=ti.combineInstances(r)[0],a=se.fromPoints(t.positions);return new Tt({attributes:s.attributes,indices:s.indices,primitiveType:s.primitiveType,boundingSphere:a})};let CT=new he;function Q0(e){A.typeOf.object("options",e),A.typeOf.string("options.token",e.token);const t=ui.fromToken(e.token),n=y(e.minimumHeight,0),i=y(e.maximumHeight,0),o=y(e.ellipsoid,ae.WGS84);this.s2Cell=t,this.minimumHeight=n,this.maximumHeight=i,this.ellipsoid=o;const r=Nwe(t,n,i,o);this._boundingPlanes=r;const s=zwe(r);this._vertices=s,this._edgeNormals=new Array(6),this._edgeNormals[0]=PS(r[0],s.slice(0,4));let a;for(a=0;a<4;a++)this._edgeNormals[0][a]=d.negate(this._edgeNormals[0][a],this._edgeNormals[0][a]);for(this._edgeNormals[1]=PS(r[1],s.slice(4,8)),a=0;a<4;a++)this._edgeNormals[2+a]=PS(r[2+a],[s[a%4],s[(a+1)%4],s[4+(a+1)%4],s[4+a]]);for(this._planeVertices=[this._vertices.slice(0,4),this._vertices.slice(4,8)],a=0;a<4;a++)this._planeVertices.push([this._vertices[a%4],this._vertices[(a+1)%4],this._vertices[4+(a+1)%4],this._vertices[4+a]]);const l=t.getCenter();CT=o.cartesianToCartographic(l,CT),CT.height=(i+n)/2,this.center=o.cartographicToCartesian(CT,l),this._boundingSphere=se.fromPoints(s)}const Swe=new d,vwe=new he,Iwe=new d,Dwe=new he,Pwe=new d,Owe=new d,Lwe=new d,Rwe=new d;function Nwe(e,t,n,i){const o=new Array(6),r=e.getCenter(),s=i.geodeticSurfaceNormal(r,Swe),a=i.cartesianToCartographic(r,vwe);a.height=n;const l=i.cartographicToCartesian(a,Iwe),u=_t.fromPointNormal(l,s);o[0]=u;let h=0,f;const _=[];let g,m;for(f=0;f<4;f++){g=e.getVertex(f),_[f]=g,m=i.cartesianToCartographic(g,Dwe),m.height=t;const T=_t.getPointDistance(u,i.cartographicToCartesian(m,Pwe));T<h&&(h=T)}const b=_t.clone(u);for(b.normal=d.negate(b.normal,b.normal),b.distance=b.distance*-1+h,o[1]=b,f=0;f<4;f++){g=_[f];const T=_[(f+1)%4],x=i.geodeticSurfaceNormal(g,Owe),C=d.subtract(T,g,Rwe);let w=d.cross(C,x,Lwe);w=d.normalize(w,w),o[2+f]=_t.fromPointNormal(g,w)}return o}let Cf=new d,Ef=new d,wf=new d,CS=new d,ES=new d,wS=new d;const Mwe=new d,Fwe=new d,Bwe=new d;let SS=new d,vS=new d,IS=new d,Gd=new d;const jl=new $;function KF(e,t,n){Cf=e.normal,Ef=t.normal,wf=n.normal,CS=d.multiplyByScalar(e.normal,-e.distance,CS),ES=d.multiplyByScalar(t.normal,-t.distance,ES),wS=d.multiplyByScalar(n.normal,-n.distance,wS),SS=d.multiplyByScalar(d.cross(Ef,wf,Mwe),d.dot(CS,Cf),SS),vS=d.multiplyByScalar(d.cross(wf,Cf,Fwe),d.dot(ES,Ef),vS),IS=d.multiplyByScalar(d.cross(Cf,Ef,Bwe),d.dot(wS,wf),IS),jl[0]=Cf.x,jl[1]=Ef.x,jl[2]=wf.x,jl[3]=Cf.y,jl[4]=Ef.y,jl[5]=wf.y,jl[6]=Cf.z,jl[7]=Ef.z,jl[8]=wf.z;const i=$.determinant(jl);return Gd=d.add(SS,vS,Gd),Gd=d.add(Gd,IS,Gd),new d(Gd.x/i,Gd.y/i,Gd.z/i)}function zwe(e){const t=new Array(8);for(let n=0;n<4;n++)t[n]=KF(e[0],e[2+(n+3)%4],e[2+n%4]),t[n+4]=KF(e[1],e[2+(n+3)%4],e[2+n%4]);return t}let DS=new d,ym=new d;function PS(e,t){const n=[];for(let i=0;i<4;i++)DS=d.subtract(t[(i+1)%4],t[i],DS),ym=d.cross(e.normal,DS,ym),ym=d.normalize(ym,ym),n[i]=d.clone(ym);return n}Object.defineProperties(Q0.prototype,{boundingVolume:{get:function(){return this}},boundingSphere:{get:function(){return this._boundingSphere}}});const OS=new d;Q0.prototype.distanceToCamera=function(e){A.defined("frameState",e);const t=e.camera.positionWC,n=[],i=[];let o;_t.getPointDistance(this._boundingPlanes[0],t)>0?(n.push(0),i.push(this._planeVertices[0]),o=this._edgeNormals[0]):_t.getPointDistance(this._boundingPlanes[1],t)>0&&(n.push(1),i.push(this._planeVertices[1]),o=this._edgeNormals[1]);let r,s;for(r=0;r<4;r++)s=2+r,_t.getPointDistance(this._boundingPlanes[s],t)>0&&(n.push(s),i.push(this._planeVertices[s]),o=this._edgeNormals[s]);if(n.length===0)return 0;let a,l;if(n.length===1)return l=this._boundingPlanes[n[0]],a=LS(_t.projectPointOntoPlane(l,t,OS),i[0],l,o),d.distance(a,t);if(n.length===2){if(n[0]===0){const _=[this._vertices[4*n[0]+(n[1]-2)],this._vertices[4*n[0]+(n[1]-2+1)%4]];return a=G8(t,_[0],_[1]),d.distance(a,t)}let h=Number.MAX_VALUE,f;for(r=0;r<2;r++)l=this._boundingPlanes[n[r]],a=LS(_t.projectPointOntoPlane(l,t,OS),i[r],l,this._edgeNormals[n[r]]),f=d.distanceSquared(a,t),f<h&&(h=f);return Math.sqrt(h)}else if(n.length>3)return a=LS(_t.projectPointOntoPlane(this._boundingPlanes[1],t,OS),this._planeVertices[1],this._boundingPlanes[1],this._edgeNormals[1]),d.distance(a,t);const u=n[1]===2&&n[2]===5?0:1;return n[0]===0?d.distance(t,this._vertices[(n[1]-2+u)%4]):d.distance(t,this._vertices[4+(n[1]-2+u)%4])};const Uwe=new d,kwe=new d;function G8(e,t,n){const i=d.subtract(n,t,Uwe),o=d.subtract(e,t,kwe);let r=d.dot(i,o);if(r<=0)return t;const s=d.dot(i,i);return r>=s?n:(r=r/s,new d((1-r)*t.x+r*n.x,(1-r)*t.y+r*n.y,(1-r)*t.z+r*n.z))}const Vwe=new _t(d.UNIT_X,0);function LS(e,t,n,i){let o=Number.MAX_VALUE,r,s,a;for(let l=0;l<t.length;l++){const u=_t.fromPointNormal(t[l],i[l],Vwe);_t.getPointDistance(u,e)<0||(a=G8(e,t[l],t[(l+1)%4]),r=d.distance(e,a),r<o&&(o=r,s=a))}return c(s)?s:e}Q0.prototype.intersectPlane=function(e){A.defined("plane",e);let t=0,n=0;for(let i=0;i<this._vertices.length;i++)d.dot(e.normal,this._vertices[i])+e.distance<0?n++:t++;return t===this._vertices.length?Bt.INSIDE:n===this._vertices.length?Bt.OUTSIDE:Bt.INTERSECTING};Q0.prototype.createDebugVolume=function(e){A.defined("color",e);const t=new L.clone(L.IDENTITY),n=new ga({polygonHierarchy:{positions:this._planeVertices[0]}}),i=ga.createGeometry(n),o=new Gt({geometry:i,id:"outline",modelMatrix:t,attributes:{color:$t.fromColor(e)}}),r=new ga({polygonHierarchy:{positions:this._planeVertices[1]}}),s=ga.createGeometry(r),a=new Gt({geometry:s,id:"outline",modelMatrix:t,attributes:{color:$t.fromColor(e)}}),l=[];for(let u=0;u<4;u++){const h=new ga({polygonHierarchy:{positions:this._planeVertices[2+u]}}),f=ga.createGeometry(h);l[u]=new Gt({geometry:f,id:"outline",modelMatrix:t,attributes:{color:$t.fromColor(e)}})}return new Mt({geometryInstances:[l[0],l[1],l[2],l[3],a,o],appearance:new tn({translucent:!1,flat:!0}),asynchronous:!1})};const Hwe=new d(1,1,1),ET=Math.cos,wT=Math.sin;function za(e){e=y(e,y.EMPTY_OBJECT);const t=y(e.radii,Hwe),n=y(e.innerRadii,t),i=y(e.minimumClock,0),o=y(e.maximumClock,R.TWO_PI),r=y(e.minimumCone,0),s=y(e.maximumCone,R.PI),a=Math.round(y(e.stackPartitions,10)),l=Math.round(y(e.slicePartitions,8)),u=Math.round(y(e.subdivisions,128));if(a<1)throw new E("options.stackPartitions cannot be less than 1");if(l<0)throw new E("options.slicePartitions cannot be less than 0");if(u<0)throw new E("options.subdivisions must be greater than or equal to zero.");if(c(e.offsetAttribute)&&e.offsetAttribute===Kt.TOP)throw new E("GeometryOffsetAttribute.TOP is not a supported options.offsetAttribute for this geometry.");this._radii=d.clone(t),this._innerRadii=d.clone(n),this._minimumClock=i,this._maximumClock=o,this._minimumCone=r,this._maximumCone=s,this._stackPartitions=a,this._slicePartitions=l,this._subdivisions=u,this._offsetAttribute=e.offsetAttribute,this._workerName="createEllipsoidOutlineGeometry"}za.packedLength=2*d.packedLength+8;za.pack=function(e,t,n){if(!c(e))throw new E("value is required");if(!c(t))throw new E("array is required");return n=y(n,0),d.pack(e._radii,t,n),n+=d.packedLength,d.pack(e._innerRadii,t,n),n+=d.packedLength,t[n++]=e._minimumClock,t[n++]=e._maximumClock,t[n++]=e._minimumCone,t[n++]=e._maximumCone,t[n++]=e._stackPartitions,t[n++]=e._slicePartitions,t[n++]=e._subdivisions,t[n]=y(e._offsetAttribute,-1),t};const j8=new d,W8=new d,Lu={radii:j8,innerRadii:W8,minimumClock:void 0,maximumClock:void 0,minimumCone:void 0,maximumCone:void 0,stackPartitions:void 0,slicePartitions:void 0,subdivisions:void 0,offsetAttribute:void 0};za.unpack=function(e,t,n){if(!c(e))throw new E("array is required");t=y(t,0);const i=d.unpack(e,t,j8);t+=d.packedLength;const o=d.unpack(e,t,W8);t+=d.packedLength;const r=e[t++],s=e[t++],a=e[t++],l=e[t++],u=e[t++],h=e[t++],f=e[t++],_=e[t];return c(n)?(n._radii=d.clone(i,n._radii),n._innerRadii=d.clone(o,n._innerRadii),n._minimumClock=r,n._maximumClock=s,n._minimumCone=a,n._maximumCone=l,n._stackPartitions=u,n._slicePartitions=h,n._subdivisions=f,n._offsetAttribute=_===-1?void 0:_,n):(Lu.minimumClock=r,Lu.maximumClock=s,Lu.minimumCone=a,Lu.maximumCone=l,Lu.stackPartitions=u,Lu.slicePartitions=h,Lu.subdivisions=f,Lu.offsetAttribute=_===-1?void 0:_,new za(Lu))};za.createGeometry=function(e){const t=e._radii;if(t.x<=0||t.y<=0||t.z<=0)return;const n=e._innerRadii;if(n.x<=0||n.y<=0||n.z<=0)return;const i=e._minimumClock,o=e._maximumClock,r=e._minimumCone,s=e._maximumCone,a=e._subdivisions,l=ae.fromCartesian3(t);let u=e._slicePartitions+1,h=e._stackPartitions+1;u=Math.round(u*Math.abs(o-i)/R.TWO_PI),h=Math.round(h*Math.abs(s-r)/R.PI),u<2&&(u=2),h<2&&(h=2);let f=0,_=1;const g=n.x!==t.x||n.y!==t.y||n.z!==t.z;let m=!1,b=!1;g&&(_=2,r>0&&(m=!0,f+=u),s<Math.PI&&(b=!0,f+=u));const T=a*_*(h+u),x=new Float64Array(T*3),C=2*(T+f-(u+h)*_),w=je.createTypedArray(T,C);let v,P,N,k,M=0;const U=new Array(h),B=new Array(h);for(v=0;v<h;v++)k=r+v*(s-r)/(h-1),U[v]=wT(k),B[v]=ET(k);const S=new Array(a),D=new Array(a);for(v=0;v<a;v++)N=i+v*(o-i)/(a-1),S[v]=wT(N),D[v]=ET(N);for(v=0;v<h;v++)for(P=0;P<a;P++)x[M++]=t.x*U[v]*D[P],x[M++]=t.y*U[v]*S[P],x[M++]=t.z*B[v];if(g)for(v=0;v<h;v++)for(P=0;P<a;P++)x[M++]=n.x*U[v]*D[P],x[M++]=n.y*U[v]*S[P],x[M++]=n.z*B[v];for(U.length=a,B.length=a,v=0;v<a;v++)k=r+v*(s-r)/(a-1),U[v]=wT(k),B[v]=ET(k);for(S.length=u,D.length=u,v=0;v<u;v++)N=i+v*(o-i)/(u-1),S[v]=wT(N),D[v]=ET(N);for(v=0;v<a;v++)for(P=0;P<u;P++)x[M++]=t.x*U[v]*D[P],x[M++]=t.y*U[v]*S[P],x[M++]=t.z*B[v];if(g)for(v=0;v<a;v++)for(P=0;P<u;P++)x[M++]=n.x*U[v]*D[P],x[M++]=n.y*U[v]*S[P],x[M++]=n.z*B[v];for(M=0,v=0;v<h*_;v++){const O=v*a;for(P=0;P<a-1;P++)w[M++]=O+P,w[M++]=O+P+1}let p=h*a*_;for(v=0;v<u;v++)for(P=0;P<a-1;P++)w[M++]=p+v+P*u,w[M++]=p+v+(P+1)*u;if(g)for(p=h*a*_+u*a,v=0;v<u;v++)for(P=0;P<a-1;P++)w[M++]=p+v+P*u,w[M++]=p+v+(P+1)*u;if(g){let O=h*a*_,F=O+a*u;if(m)for(v=0;v<u;v++)w[M++]=O+v,w[M++]=F+v;if(b)for(O+=a*u-u,F+=a*u-u,v=0;v<u;v++)w[M++]=O+v,w[M++]=F+v}const I=new oi({position:new Ie({componentDatatype:Z.DOUBLE,componentsPerAttribute:3,values:x})});if(c(e._offsetAttribute)){const O=x.length,F=e._offsetAttribute===Kt.NONE?0:1,V=new Uint8Array(O/3).fill(F);I.applyOffset=new Ie({componentDatatype:Z.UNSIGNED_BYTE,componentsPerAttribute:1,values:V})}return new Tt({attributes:I,indices:w,primitiveType:ze.LINES,boundingSphere:se.fromEllipsoid(l),offsetAttribute:e._offsetAttribute})};function Fh(e){const t=y(e.radius,1),i={radii:new d(t,t,t),stackPartitions:e.stackPartitions,slicePartitions:e.slicePartitions,subdivisions:e.subdivisions};this._ellipsoidGeometry=new za(i),this._workerName="createSphereOutlineGeometry"}Fh.packedLength=za.packedLength;Fh.pack=function(e,t,n){return A.typeOf.object("value",e),za.pack(e._ellipsoidGeometry,t,n)};const Gwe=new za,Sf={radius:void 0,radii:new d,stackPartitions:void 0,slicePartitions:void 0,subdivisions:void 0};Fh.unpack=function(e,t,n){const i=za.unpack(e,t,Gwe);return Sf.stackPartitions=i._stackPartitions,Sf.slicePartitions=i._slicePartitions,Sf.subdivisions=i._subdivisions,c(n)?(d.clone(i._radii,Sf.radii),n._ellipsoidGeometry=new za(Sf),n):(Sf.radius=i._radii.x,new Fh(Sf))};Fh.createGeometry=function(e){return za.createGeometry(e._ellipsoidGeometry)};function Sd(e,t){t===0&&(t=R.EPSILON7),this._boundingSphere=new se(e,t)}Object.defineProperties(Sd.prototype,{center:{get:function(){return this._boundingSphere.center}},radius:{get:function(){return this._boundingSphere.radius}},boundingVolume:{get:function(){return this._boundingSphere}},boundingSphere:{get:function(){return this._boundingSphere}}});Sd.prototype.distanceToCamera=function(e){A.defined("frameState",e);const t=this._boundingSphere;return Math.max(0,d.distance(t.center,e.camera.positionWC)-t.radius)};Sd.prototype.intersectPlane=function(e){return A.defined("plane",e),se.intersectPlane(this._boundingSphere,e)};Sd.prototype.update=function(e,t){d.clone(e,this._boundingSphere.center),this._boundingSphere.radius=t};Sd.prototype.createDebugVolume=function(e){A.defined("color",e);const t=new Fh({radius:this.radius}),n=L.fromTranslation(this.center,new L.clone(L.IDENTITY)),i=new Gt({geometry:t,id:"outline",modelMatrix:n,attributes:{color:$t.fromColor(e)}});return new Mt({geometryInstances:i,appearance:new tn({translucent:!1,flat:!0}),asynchronous:!1})};const jwe=new d,Wwe=new d,qwe=new d,Ywe=new d;function Bf(e,t,n){n=d.cross(e,t,n);const i=d.magnitude(n);return d.multiplyByScalar(n,R.EPSILON7/i,n)}function RS(e,t){const n=d.normalize(e,Ywe),i=d.equalsEpsilon(n,d.UNIT_X,R.EPSILON6)?d.UNIT_Y:d.UNIT_X;return Bf(e,i,t)}function q8(e){let t=$.getColumn(e,0,jwe),n=$.getColumn(e,1,Wwe),i=$.getColumn(e,2,qwe);const o=d.equals(t,d.ZERO),r=d.equals(n,d.ZERO),s=d.equals(i,d.ZERO);return!o&&!r&&!s?e:o&&r&&s?(e[0]=R.EPSILON7,e[4]=R.EPSILON7,e[8]=R.EPSILON7,e):(o&&!r&&!s?t=Bf(n,i,t):!o&&r&&!s?n=Bf(t,i,n):!o&&!r&&s?i=Bf(n,t,i):o?r?s||(t=RS(i,t),n=Bf(i,t,n)):(t=RS(n,t),i=Bf(n,t,i)):(n=RS(t,n),i=Bf(n,t,i)),$.setColumn(e,0,t,e),$.setColumn(e,1,n,e),$.setColumn(e,2,i,e),e)}function Oc(e,t){t=q8(t),this._orientedBoundingBox=new Ct(e,t),this._boundingSphere=se.fromOrientedBoundingBox(this._orientedBoundingBox)}Object.defineProperties(Oc.prototype,{boundingVolume:{get:function(){return this._orientedBoundingBox}},boundingSphere:{get:function(){return this._boundingSphere}}});Oc.prototype.distanceToCamera=function(e){return A.defined("frameState",e),Math.sqrt(this._orientedBoundingBox.distanceSquaredTo(e.camera.positionWC))};Oc.prototype.intersectPlane=function(e){return A.defined("plane",e),this._orientedBoundingBox.intersectPlane(e)};Oc.prototype.update=function(e,t){d.clone(e,this._orientedBoundingBox.center),t=q8(t),$.clone(t,this._orientedBoundingBox.halfAxes),se.fromOrientedBoundingBox(this._orientedBoundingBox,this._boundingSphere)};Oc.prototype.createDebugVolume=function(e){A.defined("color",e);const t=new Na({minimum:new d(-1,-1,-1),maximum:new d(1,1,1)}),n=L.fromRotationTranslation(this.boundingVolume.halfAxes,this.boundingVolume.center),i=new Gt({geometry:t,id:"outline",modelMatrix:n,attributes:{color:$t.fromColor(e)}});return new Mt({geometryInstances:i,appearance:new tn({translucent:!1,flat:!0}),asynchronous:!1})};function Ai(e,t,n,i){this._tileset=e,this._header=n;const o=c(n.contents),r=o&&n.contents.length>1||To(n,"3DTILES_multiple_contents"),s=o&&!r?n.contents[0]:n.content;this._contentHeader=s,this.transform=c(n.transform)?L.unpack(n.transform):L.clone(L.IDENTITY);const a=c(i)?i.computedTransform:e.modelMatrix,l=L.multiply(a,this.transform,new L),u=c(i)?i._initialTransform:L.IDENTITY;this._initialTransform=L.multiply(u,this.transform,new L),this.computedTransform=l,this.metadata=jO(e,n),this._verticalExaggeration=1,this._verticalExaggerationRelativeHeight=0,this._boundingVolume=this.createBoundingVolume(n.boundingVolume,l),this._boundingVolume2D=void 0;let h;c(s)&&c(s.boundingVolume)&&(h=this.createBoundingVolume(s.boundingVolume,l)),this._contentBoundingVolume=h,this._contentBoundingVolume2D=void 0;let f;c(n.viewerRequestVolume)&&(f=this.createBoundingVolume(n.viewerRequestVolume,l)),this._viewerRequestVolume=f,this.geometricError=n.geometricError,this._geometricError=n.geometricError,c(this._geometricError)||(this._geometricError=c(i)?i._geometricError:e._geometricError,Ai._deprecationWarning("geometricErrorUndefined","Required property geometricError is undefined for this tile. Using parent's geometric error instead.")),this.updateGeometricErrorScale();let _;c(n.refine)?((n.refine==="replace"||n.refine==="add")&&Ai._deprecationWarning("lowercase-refine",`This tile uses a lowercase refine "${n.refine}". Instead use "${n.refine.toUpperCase()}".`),_=n.refine.toUpperCase()==="REPLACE"?Vr.REPLACE:Vr.ADD):c(i)?_=i.refine:_=Vr.REPLACE,this.refine=_,this.children=[],this.parent=i;let g,m=!1,b,T,x;if(t=Ae.createIfNeeded(t),r)b=bo.UNLOADED,T=t.clone();else if(c(s)){let P=s.uri;c(s.url)&&(Ai._deprecationWarning("contentUrl",'This tileset JSON uses the "content.url" property which has been deprecated. Use "content.uri" instead.'),P=s.url),P===""?(Ai._deprecationWarning("contentUriEmpty","content.uri property is an empty string, which creates a circular dependency, making this tileset invalid. Omit the content property instead"),g=new Al(e,this),m=!0,b=bo.READY):(b=bo.UNLOADED,T=t.getDerivedResource({url:P}),x=Nn.getServerKey(T.getUrlComponent()))}else g=new Al(e,this),m=!0,b=bo.READY;this._content=g,this._contentResource=T,this._contentState=b,this._expiredContent=void 0,this._serverKey=x,this.hasEmptyContent=m,this.hasTilesetContent=!1,this.hasImplicitContent=!1,this.hasImplicitContentMetadata=!1,this.hasMultipleContents=r,this.cacheNode=void 0;const C=n.expire;let w,v;c(C)&&(w=C.duration,c(C.date)&&(v=ie.fromIso8601(C.date))),this.expireDuration=w,this.expireDate=v,this.lastStyleTime=0,this._optimChildrenWithinParent=Km.NOT_COMPUTED,this.clippingPlanesDirty=!1,this.clippingPolygonsDirty=!1,this.priorityDeferred=!1,this.implicitTileset=void 0,this.implicitCoordinates=void 0,this.implicitSubtree=void 0,this._distanceToCamera=0,this._centerZDepth=0,this._screenSpaceError=0,this._screenSpaceErrorProgressiveResolution=0,this._visibilityPlaneMask=0,this._visible=!1,this._inRequestVolume=!1,this._finalResolution=!0,this._depth=0,this._stackLength=0,this._selectionDepth=0,this._updatedVisibilityFrame=0,this._touchedFrame=0,this._visitedFrame=0,this._selectedFrame=0,this._wasSelectedLastFrame=!1,this._requestedFrame=0,this._ancestorWithContent=void 0,this._ancestorWithContentAvailable=void 0,this._refines=!1,this._shouldSelect=!1,this._isClipped=!0,this._isClippedByPolygon=!1,this._clippingPlanesState=0,this._clippingPolygonsState=0,this._debugBoundingVolume=void 0,this._debugContentBoundingVolume=void 0,this._debugViewerRequestVolume=void 0,this._debugColor=z.fromRandom({alpha:1}),this._debugColorizeTiles=!1,this._priority=0,this._priorityHolder=this,this._priorityProgressiveResolution=!1,this._priorityProgressiveResolutionScreenSpaceErrorLeaf=!1,this._priorityReverseScreenSpaceError=0,this._foveatedFactor=0,this._wasMinPriorityChild=!1,this._loadTimestamp=new ie,this._commandsLength=0,this._color=void 0,this._colorDirty=!1,this._request=void 0}Ai._deprecationWarning=Xh;Object.defineProperties(Ai.prototype,{tileset:{get:function(){return this._tileset}},content:{get:function(){return this._content}},boundingVolume:{get:function(){return this._boundingVolume}},contentBoundingVolume:{get:function(){return y(this._contentBoundingVolume,this._boundingVolume)}},boundingSphere:{get:function(){return this._boundingVolume.boundingSphere}},isVisible:{get:function(){return this._visible&&this._inRequestVolume}},extras:{get:function(){return this._header.extras}},color:{get:function(){return c(this._color)||(this._color=new z),z.clone(this._color)},set:function(e){this._color=z.clone(e,this._color),this._colorDirty=!0}},hasRenderableContent:{get:function(){return!this.hasEmptyContent&&!this.hasTilesetContent&&!this.hasImplicitContent}},contentAvailable:{get:function(){return this.contentReady&&this.hasRenderableContent||c(this._expiredContent)&&!this.contentFailed}},contentReady:{get:function(){return this._contentState===bo.READY}},contentUnloaded:{get:function(){return this._contentState===bo.UNLOADED}},hasUnloadedRenderableContent:{get:function(){return this.hasRenderableContent&&this.contentUnloaded}},contentExpired:{get:function(){return this._contentState===bo.EXPIRED}},contentFailed:{get:function(){return this._contentState===bo.FAILED}},commandsLength:{get:function(){return this._commandsLength}}});const jd=new d;function $we(e,t){const{tileset:n,boundingSphere:i}=e,{radius:o,center:r}=i,{camera:s}=t,a=d.multiplyByScalar(s.directionWC,e._centerZDepth,jd),l=d.add(s.positionWC,a,jd),u=d.subtract(l,r,jd);if(d.magnitude(u)>o){const v=d.normalize(u,jd),P=d.multiplyByScalar(v,o,jd),N=d.add(r,P,jd),k=d.subtract(N,s.positionWC,jd),M=d.normalize(k,jd);e._foveatedFactor=1-Math.abs(d.dot(s.directionWC,M))}else e._foveatedFactor=0;const _=e.refine===Vr.REPLACE,g=n.isSkippingLevelOfDetail;if(_&&!g||!n.foveatedScreenSpaceError||n.foveatedConeSize===1||e._priorityProgressiveResolution&&_&&g||n._pass===wr.PRELOAD_FLIGHT||n._pass===wr.PRELOAD)return!1;const m=1-Math.cos(s.frustum.fov*.5),b=n.foveatedConeSize*m;if(e._foveatedFactor<=b)return!1;const T=m-b,x=R.clamp((e._foveatedFactor-b)/T,0,1),C=n.foveatedInterpolationCallback(n.foveatedMinimumScreenSpaceErrorRelaxation,n.memoryAdjustedScreenSpaceError,x),w=e._screenSpaceError===0&&c(e.parent)?e.parent._screenSpaceError*.5:e._screenSpaceError;return n.memoryAdjustedScreenSpaceError-C<=w}const Y8=new ie;Ai.prototype.getScreenSpaceError=function(e,t,n){const i=this._tileset,o=y(n,1),r=c(this.parent)?this.parent.geometricError:i._scaledGeometricError,s=t?r:this.geometricError;if(s===0)return 0;const{camera:a,context:l}=e;let u=a.frustum;const h=l.drawingBufferWidth,f=l.drawingBufferHeight*o;let _;if(e.mode===oe.SCENE2D||u instanceof It){const g=u.offCenterFrustum;c(g)&&(u=g);const m=Math.max(u.top-u.bottom,u.right-u.left)/Math.max(h,f);_=s/m}else{const g=Math.max(this._distanceToCamera,R.EPSILON7),m=u.sseDenominator;if(_=s*f/(g*m),i.dynamicScreenSpaceError){const b=i._dynamicScreenSpaceErrorComputedDensity,T=i.dynamicScreenSpaceErrorFactor,x=R.fog(g,b)*T;_-=x}}return _/=e.pixelRatio,_};function Xwe(e,t){if(e.progressiveResolutionHeightFraction<=0||e.progressiveResolutionHeightFraction>.5)return!1;const n=e.memoryAdjustedScreenSpaceError;let i=t._screenSpaceErrorProgressiveResolution>n;t._priorityProgressiveResolutionScreenSpaceErrorLeaf=!1;const o=t.parent,r=t._screenSpaceErrorProgressiveResolution<=n,s=c(o)&&o._screenSpaceErrorProgressiveResolution>n;return r&&s&&(t._priorityProgressiveResolutionScreenSpaceErrorLeaf=!0,i=!0),i}function Qwe(e,t){const n=t.parent,o=c(n)&&(!e.isSkippingLevelOfDetail||t._screenSpaceError===0||n.hasTilesetContent||n.hasImplicitContent)?n._screenSpaceError:t._screenSpaceError;return e.root._screenSpaceError-o}Ai.prototype.updateVisibility=function(e){const{parent:t,tileset:n}=this;if(this._updatedVisibilityFrame===n._updatedVisibilityFrame)return;const i=c(t)?t.computedTransform:n.modelMatrix,o=c(t)?t._visibilityPlaneMask:_o.MASK_INDETERMINATE;this.updateTransform(i,e),this._distanceToCamera=this.distanceToTile(e),this._centerZDepth=this.distanceToTileCenter(e),this._screenSpaceError=this.getScreenSpaceError(e,!1),this._screenSpaceErrorProgressiveResolution=this.getScreenSpaceError(e,!1,n.progressiveResolutionHeightFraction),this._visibilityPlaneMask=this.visibility(e,o),this._visible=this._visibilityPlaneMask!==_o.MASK_OUTSIDE,this._inRequestVolume=this.insideViewerRequestVolume(e),this._priorityReverseScreenSpaceError=Qwe(n,this),this._priorityProgressiveResolution=Xwe(n,this),this.priorityDeferred=$we(this,e),this._updatedVisibilityFrame=n._updatedVisibilityFrame};Ai.prototype.updateExpiration=function(){if(c(this.expireDate)&&this.contentReady&&!this.hasEmptyContent&&!this.hasMultipleContents){const e=ie.now(Y8);ie.lessThan(this.expireDate,e)&&(this._contentState=bo.EXPIRED,this._expiredContent=this._content)}};function Kwe(e){if(!c(e.expireDuration))return;const t=ie.now(Y8);ie.addSeconds(t,e.expireDuration,t),c(e.expireDate)?ie.lessThan(e.expireDate,t)&&ie.clone(t,e.expireDate):e.expireDate=ie.clone(t)}function Zwe(e){return function(){return e._priority}}Ai.prototype.requestContent=function(){if(!this.hasEmptyContent)return this.hasMultipleContents?Jwe(this):tSe(this)};function Jwe(e){let t=e._content;const n=e._tileset;if(!c(t)){const o=To(e._header,"3DTILES_multiple_contents")?e._header.extensions["3DTILES_multiple_contents"]:e._header;t=new kc(n,e,e._contentResource.clone(),o),e._content=t}const i=t.requestInnerContents();if(!!c(i))return e._contentState=bo.LOADING,i.then(o=>{if(!e.isDestroyed()&&!!c(o))return e._contentState=bo.PROCESSING,t}).catch(o=>{if(!e.isDestroyed())throw e._contentState=bo.FAILED,o})}async function eSe(e,t,n,i,o){const r=e._contentState;e._contentState=bo.LOADING,++t.statistics.numberOfPendingRequests;let s;try{s=await o}catch(a){if(--t.statistics.numberOfPendingRequests,e.isDestroyed())return;if(n.cancelled||n.state===di.CANCELLED){e._contentState=r,++t.statistics.numberOfAttemptedRequests;return}throw e._contentState=bo.FAILED,a}if(e.isDestroyed()){--t.statistics.numberOfPendingRequests;return}if(n.cancelled||n.state===di.CANCELLED){e._contentState=r,--t.statistics.numberOfPendingRequests,++t.statistics.numberOfAttemptedRequests;return}try{const a=await nSe(e,s);return--t.statistics.numberOfPendingRequests,e.isDestroyed()?void 0:(i&&(e.expireDate=void 0),e._content=a,e._contentState=bo.PROCESSING,a)}catch(a){if(--t.statistics.numberOfPendingRequests,e.isDestroyed())return;throw e._contentState=bo.FAILED,a}}function tSe(e){const t=e._contentResource.clone(),n=e.contentExpired;n&&t.setQueryParameters({expired:e.expireDate.toString()});const i=new iu({throttle:!0,throttleByServer:!0,type:Ip.TILES3D,priorityFunction:Zwe(e),serverKey:e._serverKey});e._request=i,t.request=i;const o=e._tileset,r=t.fetchArrayBuffer();if(!c(r)){++o.statistics.numberOfAttemptedRequests;return}return eSe(e,o,i,n,r)}async function nSe(e,t){const n=R8(t),i=e._tileset;i._disableSkipLevelOfDetail=i._disableSkipLevelOfDetail||n.contentType===na.GEOMETRY||n.contentType===na.VECTOR,(n.contentType===na.IMPLICIT_SUBTREE||n.contentType===na.IMPLICIT_SUBTREE_JSON)&&(e.hasImplicitContent=!0),n.contentType===na.EXTERNAL_TILESET&&(e.hasTilesetContent=!0);let o;const r=O8[n.contentType];if(e.isDestroyed())return;c(n.binaryPayload)?o=await Promise.resolve(r(i,e,e._contentResource,n.binaryPayload.buffer,0)):o=await Promise.resolve(r(i,e,e._contentResource,n.jsonPayload));const s=e._contentHeader;if(e.hasImplicitContentMetadata){const l=e.implicitSubtree,u=e.implicitCoordinates;o.metadata=l.getContentMetadataView(u,0)}else e.hasImplicitContent||(o.metadata=kC(i,s));const a=L8(i,s);return c(a)&&(o.group=new rO({metadata:a})),o}Ai.prototype.cancelRequests=function(){this.hasMultipleContents?this._content.cancelRequests():this._request.cancel()};Ai.prototype.unloadContent=function(){!this.hasRenderableContent||(this._content=this._content&&this._content.destroy(),this._contentState=bo.UNLOADED,this.lastStyleTime=0,this.clippingPlanesDirty=this._clippingPlanesState===0,this._clippingPlanesState=0,this.clippingPolygonsDirty=this._clippingPolygonsState===0,this._clippingPolygonsState=0,this._debugColorizeTiles=!1,this._debugBoundingVolume=this._debugBoundingVolume&&this._debugBoundingVolume.destroy(),this._debugContentBoundingVolume=this._debugContentBoundingVolume&&this._debugContentBoundingVolume.destroy(),this._debugViewerRequestVolume=this._debugViewerRequestVolume&&this._debugViewerRequestVolume.destroy())};const $8=new se;function qO(e,t){if(t.mode!==oe.SCENE3D&&!c(e._boundingVolume2D)){const n=e._boundingVolume.boundingSphere,i=se.projectTo2D(n,t.mapProjection,$8);e._boundingVolume2D=new Sd(i.center,i.radius)}return t.mode!==oe.SCENE3D?e._boundingVolume2D:e._boundingVolume}function iSe(e,t){if(t.mode!==oe.SCENE3D&&!c(e._contentBoundingVolume2D)){const n=e._contentBoundingVolume.boundingSphere,i=se.projectTo2D(n,t.mapProjection,$8);e._contentBoundingVolume2D=new Sd(i.center,i.radius)}return t.mode!==oe.SCENE3D?e._contentBoundingVolume2D:e._contentBoundingVolume}Ai.prototype.visibility=function(e,t){const n=e.cullingVolume,i=qO(this,e),o=this._tileset,r=o.clippingPlanes;if(c(r)&&r.enabled){const a=r.computeIntersectionWithBoundingVolume(i,o.clippingPlanesOriginMatrix);if(this._isClipped=a!==Bt.INSIDE,a===Bt.OUTSIDE)return _o.MASK_OUTSIDE}const s=o.clippingPolygons;if(c(s)&&s.enabled){const a=s.computeIntersectionWithBoundingVolume(i);this._isClippedByPolygon=a!==Bt.OUTSIDE}return n.computeVisibilityWithPlaneMask(i,t)};Ai.prototype.contentVisibility=function(e){if(!c(this._contentBoundingVolume)||this._visibilityPlaneMask===_o.MASK_INSIDE)return Bt.INSIDE;const t=e.cullingVolume,n=iSe(this,e),i=this._tileset,o=i.clippingPlanes;if(c(o)&&o.enabled){const s=o.computeIntersectionWithBoundingVolume(n,i.clippingPlanesOriginMatrix);if(this._isClipped=s!==Bt.INSIDE,s===Bt.OUTSIDE)return Bt.OUTSIDE}const r=i.clippingPolygons;if(c(r)&&r.enabled){const s=r.computeIntersectionWithBoundingVolume(n);if(this._isClippedByPolygon=s!==Bt.OUTSIDE,s===Bt.INSIDE)return Bt.OUTSIDE}return t.computeVisibility(n)};Ai.prototype.distanceToTile=function(e){return qO(this,e).distanceToCamera(e)};const oSe=new d;Ai.prototype.distanceToTileCenter=function(e){const n=qO(this,e).boundingVolume,i=d.subtract(n.center,e.camera.positionWC,oSe);return d.dot(e.camera.directionWC,i)};Ai.prototype.insideViewerRequestVolume=function(e){const t=this._viewerRequestVolume;return!c(t)||t.distanceToCamera(e)===0};const X8=new $,Q8=new d,rSe=new $,YO=new d,K8=new ce,Z8=new Ct,mD=new L;function sSe(e,t,n){let i=d.fromElements(e[0],e[1],e[2],YO),o=$.fromArray(e,3,rSe);i=L.multiplyByPoint(t,i,i);const r=L.getMatrix3(t,X8);return o=$.multiply(r,o,o),c(n)?(n.update(i,o),n):new Oc(i,o)}function aSe(e,t,n,i){const o=ce.unpack(e,0,K8),r=e[4],s=e[5],a=Ct.fromRectangle(o,r,s,ae.WGS84,Z8);let l=a.center,u=a.halfAxes;t=L.multiplyTransformation(t,L.inverseTransformation(n,mD),mD),l=L.multiplyByPoint(t,l,l);const h=L.getMatrix3(t,X8);return u=$.multiply(h,u,u),c(i)&&i instanceof Oc?(i.update(l,u),i):new Oc(l,u)}function cSe(e,t,n,i){if(!L.equalsEpsilon(t,n,R.EPSILON8))return aSe(e,t,n,i);const o=ce.unpack(e,0,K8);return c(i)?(i.rectangle=ce.clone(o,i.rectangle),i.minimumHeight=e[4],i.maximumHeight=e[5],i.computeBoundingVolumes(ae.WGS84),i):new ru({rectangle:o,minimumHeight:e[4],maximumHeight:e[5]})}function lSe(e,t,n){let i=d.fromElements(e[0],e[1],e[2],YO),o=e[3];i=L.multiplyByPoint(t,i,i);const r=L.getScale(t,Q8),s=d.maximumComponent(r);return o*=s,c(n)?(n.update(i,o),n):new Sd(i,o)}Ai.prototype.createBoundingVolume=function(e,t,n){const i=this.metadata;let o;if(c(i)&&(o=M4.parseBoundingVolumeSemantic("TILE",i)),c(o)&&(e=o),!c(e))throw new Te("boundingVolume must be defined");if(To(e,"3DTILES_bounding_volume_S2"))return new Q0(e.extensions["3DTILES_bounding_volume_S2"]);const{box:r,region:s,sphere:a}=e;if(c(r)){const l=sSe(r,t,n);return this._verticalExaggeration!==1&&ZF(l,this._verticalExaggeration,this._verticalExaggerationRelativeHeight),l}if(c(s)){const l=cSe(s,t,this._initialTransform,n);return this._verticalExaggeration===1||(l instanceof Oc?ZF(l,this._verticalExaggeration,this._verticalExaggerationRelativeHeight):(l.minimumHeight=oa.getHeight(l.minimumHeight,this._verticalExaggeration,this._verticalExaggerationRelativeHeight),l.maximumHeight=oa.getHeight(l.maximumHeight,this._verticalExaggeration,this._verticalExaggerationRelativeHeight),l.computeBoundingVolumes(ae.WGS84))),l}if(c(a)){const l=lSe(a,t,n);if(this._verticalExaggeration!==1){const u=oa.getPosition(l.center,ae.WGS84,this._verticalExaggeration,this._verticalExaggerationRelativeHeight,YO),h=l.radius*this._verticalExaggeration;l.update(u,h)}return l}throw new Te("boundingVolume must contain a sphere, region, or box")};const uSe=d.unpackArray(new Array(8*3).fill(0));function ZF(e,t,n){const i=e.boundingVolume.computeCorners(uSe).map(r=>oa.getPosition(r,ae.WGS84,t,n,r)),o=Ct.fromPoints(i,Z8);e.update(o.center,o.halfAxes)}Ai.prototype.updateTransform=function(e,t){e=y(e,L.IDENTITY);const n=L.multiplyTransformation(e,this.transform,mD),i=!L.equals(n,this.computedTransform),o=c(t)&&(this._verticalExaggeration!==t.verticalExaggeration||this._verticalExaggerationRelativeHeight!==t.verticalExaggerationRelativeHeight);if(!i&&!o)return;i&&L.clone(n,this.computedTransform),o&&(this._verticalExaggeration=t.verticalExaggeration,this._verticalExaggerationRelativeHeight=t.verticalExaggerationRelativeHeight);const r=this._header,s=this._contentHeader;this._boundingVolume=this.createBoundingVolume(r.boundingVolume,this.computedTransform,this._boundingVolume),c(this._contentBoundingVolume)&&(this._contentBoundingVolume=this.createBoundingVolume(s.boundingVolume,this.computedTransform,this._contentBoundingVolume)),c(this._viewerRequestVolume)&&(this._viewerRequestVolume=this.createBoundingVolume(r.viewerRequestVolume,this.computedTransform,this._viewerRequestVolume)),this.updateGeometricErrorScale(),this._debugBoundingVolume=this._debugBoundingVolume&&this._debugBoundingVolume.destroy(),this._debugContentBoundingVolume=this._debugContentBoundingVolume&&this._debugContentBoundingVolume.destroy(),this._debugViewerRequestVolume=this._debugViewerRequestVolume&&this._debugViewerRequestVolume.destroy()};Ai.prototype.updateGeometricErrorScale=function(){const e=L.getScale(this.computedTransform,Q8),t=d.maximumComponent(e);if(this.geometricError=this._geometricError*t,!c(this.parent)){const n=this._tileset;n._scaledGeometricError=n._geometricError*t}};function dSe(e,t,n,i){if(!i.isRender)return;const o=c(e._contentHeader)&&c(e._contentHeader.boundingVolume),r=t.debugShowBoundingVolume||t.debugShowContentBoundingVolume&&!o;if(r){let l;e._finalResolution?e.hasRenderableContent?l=z.WHITE:l=z.DARKGRAY:l=z.YELLOW,c(e._debugBoundingVolume)||(e._debugBoundingVolume=e._boundingVolume.createDebugVolume(l)),e._debugBoundingVolume.update(n);const u=e._debugBoundingVolume.getGeometryInstanceAttributes("outline");u.color=$t.toValue(l,u.color)}else!r&&c(e._debugBoundingVolume)&&(e._debugBoundingVolume=e._debugBoundingVolume.destroy());t.debugShowContentBoundingVolume&&o?(c(e._debugContentBoundingVolume)||(e._debugContentBoundingVolume=e._contentBoundingVolume.createDebugVolume(z.BLUE)),e._debugContentBoundingVolume.update(n)):!t.debugShowContentBoundingVolume&&c(e._debugContentBoundingVolume)&&(e._debugContentBoundingVolume=e._debugContentBoundingVolume.destroy()),t.debugShowViewerRequestVolume&&c(e._viewerRequestVolume)?(c(e._debugViewerRequestVolume)||(e._debugViewerRequestVolume=e._viewerRequestVolume.createDebugVolume(z.YELLOW)),e._debugViewerRequestVolume.update(n)):!t.debugShowViewerRequestVolume&&c(e._debugViewerRequestVolume)&&(e._debugViewerRequestVolume=e._debugViewerRequestVolume.destroy());const s=t.debugColorizeTiles&&!e._debugColorizeTiles||c(t._heatmap.tilePropertyName),a=!t.debugColorizeTiles&&e._debugColorizeTiles;s?(t._heatmap.colorize(e,n),e._debugColorizeTiles=!0,e.color=e._debugColor):a&&(e._debugColorizeTiles=!1,e.color=z.WHITE),e._colorDirty&&(e._colorDirty=!1,e._content.applyDebugSettings(!0,e._color)),a&&t.makeStyleDirty()}function hSe(e,t,n){const i=e._expiredContent;if(!e.hasMultipleContents&&c(i)){if(!e.contentReady){try{i.update(t,n)}catch{}return}e._expiredContent.destroy(),e._expiredContent=void 0}if(!!c(e.content))try{e.content.update(t,n)}catch(o){throw e._contentState=bo.FAILED,o}}function fSe(e,t){const n=t.clippingPlanes;let i=0;c(n)&&e._isClipped&&n.enabled&&(i=n.clippingPlanesState),i!==e._clippingPlanesState&&(e._clippingPlanesState=i,e.clippingPlanesDirty=!0)}function pSe(e,t){const n=t.clippingPolygons;let i=0;c(n)&&e._isClippedByPolygon&&n.enabled&&(i=n.clippingPolygonsState),i!==e._clippingPolygonsState&&(e._clippingPolygonsState=i,e.clippingPolygonsDirty=!0)}Ai.prototype.update=function(e,t,n){const{commandList:i}=t,o=i.length;fSe(this,e),pSe(this,e),dSe(this,e,t,n),hSe(this,e,t);const r=i.length;this._commandsLength=r-o;for(let s=o;s<r;++s){const a=i[s],l=a.pass===xe.TRANSLUCENT;a.depthForTranslucentClassification=l}this.clippingPlanesDirty=!1,this.clippingPolygonsDirty=!1};const JF=[];Ai.prototype.process=function(e,t){!this.contentExpired&&!this.contentReady&&this._content.ready&&(Kwe(this),this._selectedFrame=0,this.lastStyleTime=0,ie.now(this._loadTimestamp),this._contentState=bo.READY,!this.hasTilesetContent&&!this.hasImplicitContent&&(e._statistics.incrementLoadCounts(this.content),++e._statistics.numberOfTilesWithContentReady,++e._statistics.numberOfLoadedTilesTotal,e._cache.add(this)));const n=t.commandList;t.commandList=JF;try{this._content.update(e,t)}catch(i){throw this._contentState=bo.FAILED,i}JF.length=0,t.commandList=n};function e2(e,t,n){const i=e*Math.pow(10,t);return parseInt(i)*Math.pow(10,n)}function ST(e,t,n){return Math.max(R.normalize(e,t,n)-R.EPSILON7,0)}Ai.prototype.updatePriority=function(){const e=this.tileset,t=e.preferLeaves,n=e._minimumPriority,i=e._maximumPriority,o=4,r=1,s=0,a=o,l=s+a,u=o,h=l+u,f=r,_=Math.pow(10,h),g=h+f,m=r,b=Math.pow(10,g),T=g+m,x=Math.pow(10,T);let C=ST(this._depth,n.depth,i.depth);C=t?1-C:C;const v=!e.isSkippingLevelOfDetail&&this.refine===Vr.REPLACE?ST(this._priorityHolder._distanceToCamera,n.distance,i.distance):ST(this._priorityReverseScreenSpaceError,n.reverseScreenSpaceError,i.reverseScreenSpaceError),P=e2(v,a,s),N=this._priorityProgressiveResolution?0:_,k=ST(this._priorityHolder._foveatedFactor,n.foveatedFactor,i.foveatedFactor),M=e2(k,u,l),U=this.priorityDeferred?b:0,B=e._pass===wr.PRELOAD_FLIGHT?0:x;this._priority=C+P+N+M+U+B};Ai.prototype.isDestroyed=function(){return!1};Ai.prototype.destroy=function(){return this._content=this._content&&this._content.destroy(),this._expiredContent=this._expiredContent&&!this._expiredContent.isDestroyed()&&this._expiredContent.destroy(),this._debugBoundingVolume=this._debugBoundingVolume&&this._debugBoundingVolume.destroy(),this._debugContentBoundingVolume=this._debugContentBoundingVolume&&this._debugContentBoundingVolume.destroy(),this._debugViewerRequestVolume=this._debugViewerRequestVolume&&this._debugViewerRequestVolume.destroy(),ve(this)};function su(e){e=y(e,y.EMPTY_OBJECT);const t=e.id,n=e.group,i=e.class;A.typeOf.object("options.group",n),A.typeOf.object("options.class",i);const o=c(n.properties)?n.properties:{};this._class=i,this._properties=o,this._id=t,this._extras=n.extras,this._extensions=n.extensions}Object.defineProperties(su.prototype,{class:{get:function(){return this._class}},id:{get:function(){return this._id}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});su.prototype.hasProperty=function(e){return Rt.hasProperty(e,this._properties,this._class)};su.prototype.hasPropertyBySemantic=function(e){return Rt.hasPropertyBySemantic(e,this._properties,this._class)};su.prototype.getPropertyIds=function(e){return Rt.getPropertyIds(this._properties,this._class,e)};su.prototype.getProperty=function(e){return Rt.getProperty(e,this._properties,this._class)};su.prototype.setProperty=function(e,t){return Rt.setProperty(e,t,this._properties,this._class)};su.prototype.getPropertyBySemantic=function(e){return Rt.getPropertyBySemantic(e,this._properties,this._class)};su.prototype.setPropertyBySemantic=function(e,t){return Rt.setPropertyBySemantic(e,t,this._properties,this._class)};function vd(e){e=y(e,y.EMPTY_OBJECT);const t=e.tileset,n=e.class;A.typeOf.object("options.tileset",t),A.typeOf.object("options.class",n);const i=c(t.properties)?t.properties:{};this._class=n,this._properties=i,this._extras=t.extras,this._extensions=t.extensions}Object.defineProperties(vd.prototype,{class:{get:function(){return this._class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});vd.prototype.hasProperty=function(e){return Rt.hasProperty(e,this._properties,this._class)};vd.prototype.hasPropertyBySemantic=function(e){return Rt.hasPropertyBySemantic(e,this._properties,this._class)};vd.prototype.getPropertyIds=function(e){return Rt.getPropertyIds(this._properties,this._class,e)};vd.prototype.getProperty=function(e){return Rt.getProperty(e,this._properties,this._class)};vd.prototype.setProperty=function(e,t){return Rt.setProperty(e,t,this._properties,this._class)};vd.prototype.getPropertyBySemantic=function(e){return Rt.getPropertyBySemantic(e,this._properties,this._class)};vd.prototype.setPropertyBySemantic=function(e,t){return Rt.setPropertyBySemantic(e,t,this._properties,this._class)};function J8(e){e=y(e,y.EMPTY_OBJECT);const t=e.metadataJson,n=e.schema;A.typeOf.object("options.metadataJson",t),A.typeOf.object("options.schema",n);const i=y(t.metadata,t.tileset);let o;c(i)&&(o=new vd({tileset:i,class:n.classes[i.class]}));let r=[];const s=[],a=t.groups;if(Array.isArray(a)){const l=a.length;for(let u=0;u<l;u++){const h=a[u];s.push(new su({group:h,class:n.classes[h.class]}))}}else if(c(a)){r=Object.keys(a).sort();const l=r.length;for(let u=0;u<l;u++){const h=r[u];if(a.hasOwnProperty(h)){const f=a[h];s.push(new su({id:h,group:a[h],class:n.classes[f.class]}))}}}this._schema=n,this._groups=s,this._groupIds=r,this._tileset=o,this._statistics=t.statistics,this._extras=t.extras,this._extensions=t.extensions}Object.defineProperties(J8.prototype,{schema:{get:function(){return this._schema}},groups:{get:function(){return this._groups}},groupIds:{get:function(){return this._groupIds}},tileset:{get:function(){return this._tileset}},statistics:{get:function(){return this._statistics}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});const eG={},mSe=new d;eG.checkChildrenWithinParent=function(e){A.typeOf.object("tile",e);const t=e.children,n=t.length,i=e.boundingVolume;if(i instanceof Oc||i instanceof ru){const o=i._orientedBoundingBox;e._optimChildrenWithinParent=Km.USE_OPTIMIZATION;for(let r=0;r<n;++r){const a=t[r].boundingVolume;if(!(a instanceof Oc||a instanceof ru)){e._optimChildrenWithinParent=Km.SKIP_OPTIMIZATION;break}const l=a._orientedBoundingBox,u=d.subtract(l.center,o.center,mSe),h=d.magnitude(u);d.divideByScalar(u,h,u);const f=Math.abs(o.halfAxes[0]*u.x)+Math.abs(o.halfAxes[1]*u.y)+Math.abs(o.halfAxes[2]*u.z)+Math.abs(o.halfAxes[3]*u.x)+Math.abs(o.halfAxes[4]*u.y)+Math.abs(o.halfAxes[5]*u.z)+Math.abs(o.halfAxes[6]*u.x)+Math.abs(o.halfAxes[7]*u.y)+Math.abs(o.halfAxes[8]*u.z),_=Math.abs(l.halfAxes[0]*u.x)+Math.abs(l.halfAxes[1]*u.y)+Math.abs(l.halfAxes[2]*u.z)+Math.abs(l.halfAxes[3]*u.x)+Math.abs(l.halfAxes[4]*u.y)+Math.abs(l.halfAxes[5]*u.z)+Math.abs(l.halfAxes[6]*u.x)+Math.abs(l.halfAxes[7]*u.y)+Math.abs(l.halfAxes[8]*u.z);if(f<=_+h){e._optimChildrenWithinParent=Km.SKIP_OPTIMIZATION;break}}}return e._optimChildrenWithinParent===Km.USE_OPTIMIZATION};const _Se=eG;function K0(){this.head=void 0,this.tail=void 0,this._length=0}Object.defineProperties(K0.prototype,{length:{get:function(){return this._length}}});function gSe(e,t,n){this.item=e,this.previous=t,this.next=n}K0.prototype.add=function(e){const t=new gSe(e,this.tail,void 0);return c(this.tail)?(this.tail.next=t,this.tail=t):(this.head=t,this.tail=t),++this._length,t};function tG(e,t){c(t.previous)&&c(t.next)?(t.previous.next=t.next,t.next.previous=t.previous):c(t.previous)?(t.previous.next=void 0,e.tail=t.previous):c(t.next)?(t.next.previous=void 0,e.head=t.next):(e.head=void 0,e.tail=void 0),t.next=void 0,t.previous=void 0}K0.prototype.remove=function(e){!c(e)||(tG(this,e),--this._length)};K0.prototype.splice=function(e,t){if(e===t)return;tG(this,t);const n=e.next;e.next=t,this.tail===e?this.tail=t:n.previous=t,t.next=n,t.previous=e};function Vp(){this._list=new K0,this._sentinel=this._list.add(),this._trimTiles=!1}Vp.prototype.reset=function(){this._list.splice(this._list.tail,this._sentinel)};Vp.prototype.touch=function(e){const t=e.cacheNode;c(t)&&this._list.splice(this._sentinel,t)};Vp.prototype.add=function(e){c(e.cacheNode)||(e.cacheNode=this._list.add(e))};Vp.prototype.unloadTile=function(e,t,n){const i=t.cacheNode;!c(i)||(this._list.remove(i),t.cacheNode=void 0,n(e,t))};Vp.prototype.unloadTiles=function(e,t){const n=this._trimTiles;this._trimTiles=!1;const i=this._list,o=this._sentinel;let r=i.head;for(;r!==o&&(e.totalMemoryUsageInBytes>e.cacheBytes||n);){const s=r.item;r=r.next,this.unloadTile(e,s,t)}};Vp.prototype.trim=function(){this._trimTiles=!0};function VC(e){this.tilePropertyName=e,this._minimum=Number.MAX_VALUE,this._maximum=-Number.MAX_VALUE,this._previousMinimum=Number.MAX_VALUE,this._previousMaximum=-Number.MAX_VALUE,this._referenceMinimum={},this._referenceMaximum={}}function _D(e,t){let n;return t==="_loadTimestamp"?n=ie.toDate(e).getTime():n=e,n}VC.prototype.setReferenceMinimumMaximum=function(e,t,n){this._referenceMinimum[n]=_D(e,n),this._referenceMaximum[n]=_D(t,n)};function ySe(e,t){const n=e.tilePropertyName;if(c(n)){const i=_D(t[n],n);return c(i)?(e._maximum=Math.max(i,e._maximum),e._minimum=Math.min(i,e._minimum),i):(e.tilePropertyName=void 0,i)}}const NS=[new z(.1,.1,.1,1),new z(.153,.278,.878,1),new z(.827,.231,.49,1),new z(.827,.188,.22,1),new z(1,.592,.259,1),new z(1,.843,0,1)];VC.prototype.colorize=function(e,t){const n=this.tilePropertyName;if(!c(n)||!e.contentAvailable||e._selectedFrame!==t.frameNumber)return;const i=ySe(this,e),o=this._previousMinimum,r=this._previousMaximum;if(o===Number.MAX_VALUE||r===-Number.MAX_VALUE)return;const s=r-o+R.EPSILON7,l=R.clamp(i-o,0,s)/s,u=NS.length-1,h=l*u,f=Math.floor(h),_=Math.ceil(h),g=h-f,m=NS[f],b=NS[_],T=z.clone(z.WHITE);T.red=R.lerp(m.red,b.red,g),T.green=R.lerp(m.green,b.green,g),T.blue=R.lerp(m.blue,b.blue,g),e._debugColor=T};VC.prototype.resetMinimumMaximum=function(){const e=this.tilePropertyName;if(c(e)){const t=this._referenceMinimum[e],n=this._referenceMaximum[e],i=c(t)&&c(n);this._previousMinimum=i?t:this._minimum,this._previousMaximum=i?n:this._maximum,this._minimum=Number.MAX_VALUE,this._maximum=-Number.MAX_VALUE}};function eu(){this.selected=0,this.visited=0,this.numberOfCommands=0,this.numberOfAttemptedRequests=0,this.numberOfPendingRequests=0,this.numberOfTilesProcessing=0,this.numberOfTilesWithContentReady=0,this.numberOfTilesTotal=0,this.numberOfLoadedTilesTotal=0,this.numberOfFeaturesSelected=0,this.numberOfFeaturesLoaded=0,this.numberOfPointsSelected=0,this.numberOfPointsLoaded=0,this.numberOfTrianglesSelected=0,this.numberOfTilesStyled=0,this.numberOfFeaturesStyled=0,this.numberOfTilesCulledWithChildrenUnion=0,this.geometryByteLength=0,this.texturesByteLength=0,this.batchTableByteLength=0}eu.prototype.clear=function(){this.selected=0,this.visited=0,this.numberOfCommands=0,this.numberOfAttemptedRequests=0,this.numberOfFeaturesSelected=0,this.numberOfPointsSelected=0,this.numberOfTrianglesSelected=0,this.numberOfTilesStyled=0,this.numberOfFeaturesStyled=0,this.numberOfTilesCulledWithChildrenUnion=0};function HC(e,t,n,i){const o=t.innerContents,r=t.pointsLength,s=t.trianglesLength,a=t.featuresLength,l=t.geometryByteLength,u=t.texturesByteLength,h=t.batchTableByteLength;if(i?(e.numberOfFeaturesLoaded+=n?-a:a,e.numberOfPointsLoaded+=n?-r:r,e.geometryByteLength+=n?-l:l,e.texturesByteLength+=n?-u:u,e.batchTableByteLength+=n?-h:h):(e.numberOfFeaturesSelected+=n?-a:a,e.numberOfPointsSelected+=n?-r:r,e.numberOfTrianglesSelected+=n?-s:s),c(o)){const f=o.length;for(let _=0;_<f;++_)HC(e,o[_],n,i)}}eu.prototype.incrementSelectionCounts=function(e){HC(this,e,!1,!1)};eu.prototype.incrementLoadCounts=function(e){HC(this,e,!1,!0)};eu.prototype.decrementLoadCounts=function(e){HC(this,e,!0,!0)};eu.clone=function(e,t){t.selected=e.selected,t.visited=e.visited,t.numberOfCommands=e.numberOfCommands,t.selected=e.selected,t.numberOfAttemptedRequests=e.numberOfAttemptedRequests,t.numberOfPendingRequests=e.numberOfPendingRequests,t.numberOfTilesProcessing=e.numberOfTilesProcessing,t.numberOfTilesWithContentReady=e.numberOfTilesWithContentReady,t.numberOfTilesTotal=e.numberOfTilesTotal,t.numberOfFeaturesSelected=e.numberOfFeaturesSelected,t.numberOfFeaturesLoaded=e.numberOfFeaturesLoaded,t.numberOfPointsSelected=e.numberOfPointsSelected,t.numberOfPointsLoaded=e.numberOfPointsLoaded,t.numberOfTrianglesSelected=e.numberOfTrianglesSelected,t.numberOfTilesStyled=e.numberOfTilesStyled,t.numberOfFeaturesStyled=e.numberOfFeaturesStyled,t.numberOfTilesCulledWithChildrenUnion=e.numberOfTilesCulledWithChildrenUnion,t.geometryByteLength=e.geometryByteLength,t.texturesByteLength=e.texturesByteLength,t.batchTableByteLength=e.batchTableByteLength};function Z0(){this._style=void 0,this._styleDirty=!1,this._lastStyleTime=0}Object.defineProperties(Z0.prototype,{style:{get:function(){return this._style},set:function(e){e!==this._style&&(this._style=e,this._styleDirty=!0)}}});Z0.prototype.makeDirty=function(){this._styleDirty=!0};Z0.prototype.resetDirty=function(){this._styleDirty=!1};Z0.prototype.applyStyle=function(e){if(!c(e.root)||c(this._style)&&!this._style._ready)return;const t=this._styleDirty;t&&++this._lastStyleTime;const n=this._lastStyleTime,i=e._statistics,o=t?e._selectedTiles:e._selectedTilesToStyle,r=o.length;for(let s=0;s<r;++s){const a=o[s];if(a.lastStyleTime!==n){const l=a.content;a.lastStyleTime=n,l.applyStyle(this._style),i.numberOfFeaturesStyled+=l.featuresLength,++i.numberOfTilesStyled}}};function bSe(e,t,n){const i=To(t,"3DTILES_implicit_tiling")?t.extensions["3DTILES_implicit_tiling"]:t.implicitTiling;A.typeOf.object("implicitTiling",i),this.baseResource=e,this.geometricError=t.geometricError,this.metadataSchema=n;const o=t.boundingVolume;if(!c(o.box)&&!c(o.region)&&!To(o,"3DTILES_bounding_volume_S2")&&!To(o,"3DTILES_bounding_volume_cylinder"))throw new Te("Only box, region, 3DTILES_bounding_volume_S2, and 3DTILES_bounding_volume_cylinder are supported for implicit tiling");this.boundingVolume=o,this.refine=t.refine,this.subtreeUriTemplate=new Ae({url:i.subtrees.uri}),this.contentUriTemplates=[],this.contentHeaders=[];const r=TSe(t);for(let s=0;s<r.length;s++){const a=r[s];this.contentHeaders.push(Je(a,!0));const l=new Ae({url:a.uri});this.contentUriTemplates.push(l)}this.contentCount=this.contentHeaders.length,this.tileHeader=ASe(t),this.subdivisionScheme=jo[i.subdivisionScheme],this.branchingFactor=jo.getBranchingFactor(this.subdivisionScheme),this.subtreeLevels=i.subtreeLevels,c(i.availableLevels)?this.availableLevels=i.availableLevels:this.availableLevels=i.maximumLevel+1}function TSe(e){if(To(e,"3DTILES_multiple_contents")){const t=e.extensions["3DTILES_multiple_contents"];return c(t.contents)?t.contents:t.content}return c(e.contents)?e.contents:c(e.content)?[e.content]:[]}function ASe(e){const t=Je(e,!0);return c(t.extensions)&&(delete t.extensions["3DTILES_implicit_tiling"],delete t.extensions["3DTILES_multiple_contents"],Object.keys(t.extensions).length===0&&delete t.extensions),delete t.implicitTiling,delete t.contents,delete t.content,t}const J0={};function t2(e){return e=(e^e<<8)&16711935,e=(e^e<<4)&252645135,e=(e^e<<2)&858993459,e=(e^e<<1)&1431655765,e}function MS(e){return e=(e^e<<16)&50331903,e=(e^e<<8)&50393103,e=(e^e<<4)&51130563,e=(e^e<<2)&153391689,e}function n2(e){return e&=1431655765,e=(e^e>>1)&858993459,e=(e^e>>2)&252645135,e=(e^e>>4)&16711935,e=(e^e>>8)&65535,e}function FS(e){return e&=153391689,e=(e^e>>2)&51130563,e=(e^e>>4)&50393103,e=(e^e>>8)&4278190335,e=(e^e>>16)&1023,e}J0.encode2D=function(e,t){if(A.typeOf.number("x",e),A.typeOf.number("y",t),e<0||e>65535||t<0||t>65535)throw new E("inputs must be 16-bit unsigned integers");return(t2(e)|t2(t)<<1)>>>0};J0.decode2D=function(e,t){if(A.typeOf.number("mortonIndex",e),e<0||e>4294967295)throw new E("input must be a 32-bit unsigned integer");return c(t)||(t=new Array(2)),t[0]=n2(e),t[1]=n2(e>>1),t};J0.encode3D=function(e,t,n){if(A.typeOf.number("x",e),A.typeOf.number("y",t),A.typeOf.number("z",n),e<0||e>1023||t<0||t>1023||n<0||n>1023)throw new E("inputs must be 10-bit unsigned integers");return MS(e)|MS(t)<<1|MS(n)<<2};J0.decode3D=function(e,t){if(A.typeOf.number("mortonIndex",e),e<0||e>1073741823)throw new E("input must be a 30-bit unsigned integer");return c(t)||(t=new Array(3)),t[0]=FS(e),t[1]=FS(e>>1),t[2]=FS(e>>2),t};const $x=J0;function xi(e){if(A.typeOf.string("options.subdivisionScheme",e.subdivisionScheme),A.typeOf.number("options.subtreeLevels",e.subtreeLevels),A.typeOf.number("options.level",e.level),A.typeOf.number("options.x",e.x),A.typeOf.number("options.y",e.y),e.subdivisionScheme===jo.OCTREE&&A.typeOf.number("options.z",e.z),e.level<0)throw new E("level must be non-negative");if(e.x<0)throw new E("x must be non-negative");if(e.y<0)throw new E("y must be non-negative");if(e.subdivisionScheme===jo.OCTREE&&e.z<0)throw new E("z must be non-negative");const t=1<<e.level;if(e.x>=t)throw new E("x is out of range");if(e.y>=t)throw new E("y is out of range");if(e.subdivisionScheme===jo.OCTREE&&e.z>=t)throw new E("z is out of range");this.subdivisionScheme=e.subdivisionScheme,this.subtreeLevels=e.subtreeLevels,this.level=e.level,this.x=e.x,this.y=e.y,this.z=void 0,e.subdivisionScheme===jo.OCTREE&&(this.z=e.z)}Object.defineProperties(xi.prototype,{childIndex:{get:function(){let e=0;return e|=this.x&1,e|=(this.y&1)<<1,this.subdivisionScheme===jo.OCTREE&&(e|=(this.z&1)<<2),e}},mortonIndex:{get:function(){return this.subdivisionScheme===jo.OCTREE?$x.encode3D(this.x,this.y,this.z):$x.encode2D(this.x,this.y)}},tileIndex:{get:function(){const e=this.subdivisionScheme===jo.OCTREE?((1<<3*this.level)-1)/7:((1<<2*this.level)-1)/3,t=this.mortonIndex;return e+t}}});function $O(e,t){if(e.subdivisionScheme!==t.subdivisionScheme)throw new E("coordinates must have same subdivisionScheme");if(e.subtreeLevels!==t.subtreeLevels)throw new E("coordinates must have same subtreeLevels")}xi.prototype.getDescendantCoordinates=function(e){A.typeOf.object("offsetCoordinates",e),$O(this,e);const t=this.level+e.level,n=(this.x<<e.level)+e.x,i=(this.y<<e.level)+e.y;if(this.subdivisionScheme===jo.OCTREE){const o=(this.z<<e.level)+e.z;return new xi({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:t,x:n,y:i,z:o})}return new xi({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:t,x:n,y:i})};xi.prototype.getAncestorCoordinates=function(e){if(A.typeOf.number("offsetLevels",e),e<0)throw new E("offsetLevels must be non-negative");if(e>this.level)throw new E("ancestor cannot be above the tileset root");const t=1<<e,n=this.level-e,i=Math.floor(this.x/t),o=Math.floor(this.y/t);if(this.subdivisionScheme===jo.OCTREE){const r=Math.floor(this.z/t);return new xi({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:n,x:i,y:o,z:r})}return new xi({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:n,x:i,y:o})};xi.prototype.getOffsetCoordinates=function(e){if(A.typeOf.object("descendantCoordinates",e),!this.isEqual(e)&&!this.isAncestor(e))throw new E("this is not an ancestor of descendant");$O(this,e);const t=e.level-this.level,n=1<<t,i=e.x%n,o=e.y%n;if(this.subdivisionScheme===jo.OCTREE){const r=e.z%n;return new xi({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:t,x:i,y:o,z:r})}return new xi({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:t,x:i,y:o})};xi.prototype.getChildCoordinates=function(e){A.typeOf.number("childIndex",e);const t=jo.getBranchingFactor(this.subdivisionScheme);if(e<0||t<=e)throw new E(`childIndex must be at least 0 and less than ${t}`);const n=this.level+1,i=2*this.x+e%2,o=2*this.y+Math.floor(e/2)%2;if(this.subdivisionScheme===jo.OCTREE){const r=2*this.z+Math.floor(e/4)%2;return new xi({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:n,x:i,y:o,z:r})}return new xi({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:n,x:i,y:o})};xi.prototype.getSubtreeCoordinates=function(){return this.getAncestorCoordinates(this.level%this.subtreeLevels)};xi.prototype.getParentSubtreeCoordinates=function(){return this.getAncestorCoordinates(this.level%this.subtreeLevels+this.subtreeLevels)};xi.prototype.isAncestor=function(e){A.typeOf.object("descendantCoordinates",e),$O(this,e);const t=e.level-this.level;if(t<=0)return!1;const n=e.x>>t,i=e.y>>t,o=this.x===n,r=this.y===i;if(this.subdivisionScheme===jo.OCTREE){const s=e.z>>t,a=this.z===s;return o&&r&&a}return o&&r};xi.prototype.isEqual=function(e){return A.typeOf.object("otherCoordinates",e),this.subdivisionScheme===e.subdivisionScheme&&this.subtreeLevels===e.subtreeLevels&&this.level===e.level&&this.x===e.x&&this.y===e.y&&(this.subdivisionScheme===jo.OCTREE?this.z===e.z:!0)};xi.prototype.isImplicitTilesetRoot=function(){return this.level===0};xi.prototype.isSubtreeRoot=function(){return this.level%this.subtreeLevels===0};xi.prototype.isBottomOfSubtree=function(){return this.level%this.subtreeLevels===this.subtreeLevels-1};xi.prototype.getTemplateValues=function(){const e={level:this.level,x:this.x,y:this.y};return this.subdivisionScheme===jo.OCTREE&&(e.z=this.z),e};const i2=[0,0,0];xi.fromMortonIndex=function(e,t,n,i){let o;return e===jo.OCTREE?(o=$x.decode3D(i,i2),new xi({subdivisionScheme:e,subtreeLevels:t,level:n,x:o[0],y:o[1],z:o[2]})):(o=$x.decode2D(i,i2),new xi({subdivisionScheme:e,subtreeLevels:t,level:n,x:o[0],y:o[1]}))};xi.fromTileIndex=function(e,t,n){let i,o,r;return e===jo.OCTREE?(i=Math.floor(R.log2(7*n+1)/3),o=((1<<3*i)-1)/7,r=n-o):(i=Math.floor(R.log2(3*n+1)/2),o=((1<<2*i)-1)/3,r=n-o),xi.fromMortonIndex(e,t,i,r)};function Po(){}Po.selectTiles=function(e,t){E.throwInstantiationError()};Po.sortChildrenByDistanceToCamera=function(e,t){return t._distanceToCamera===0&&e._distanceToCamera===0?t._centerZDepth-e._centerZDepth:t._distanceToCamera-e._distanceToCamera};Po.canTraverse=function(e){return e.children.length===0?!1:e.hasTilesetContent||e.hasImplicitContent?!e.contentExpired:e._screenSpaceError>e.tileset.memoryAdjustedScreenSpaceError};Po.selectTile=function(e,t){if(e.contentVisibility(t)===Bt.OUTSIDE)return;e._wasSelectedLastFrame=!0;const{content:n,tileset:i}=e;n.featurePropertiesDirty?(n.featurePropertiesDirty=!1,e.lastStyleTime=0,i._selectedTilesToStyle.push(e)):e._selectedFrame<t.frameNumber-1&&(i._selectedTilesToStyle.push(e),e._wasSelectedLastFrame=!1),e._selectedFrame=t.frameNumber,i._selectedTiles.push(e)};Po.visitTile=function(e,t){++e.tileset._statistics.visited,e._visitedFrame=t.frameNumber};Po.touchTile=function(e,t){e._touchedFrame!==t.frameNumber&&(e.tileset._cache.touch(e),e._touchedFrame=t.frameNumber)};Po.loadTile=function(e,t){const{tileset:n}=e;if(e._requestedFrame===t.frameNumber||!e.hasUnloadedRenderableContent&&!e.contentExpired||!xSe(e,t))return;const i=t.camera.timeSinceMoved<n.foveatedTimeDelay;e.priorityDeferred&&i||(e._requestedFrame=t.frameNumber,n._requestedTiles.push(e))};function xSe(e,t){const{tileset:n}=e;if(!n._cullRequestsWhileMoving)return!0;const{positionWCDeltaMagnitude:i,positionWCDeltaMagnitudeLastFrame:o}=t.camera,r=i!==0?i:o,s=Math.max(e.boundingSphere.radius*2,1);return n.cullRequestsWhileMovingMultiplier*r/s<1}Po.updateTile=function(e,t){nG(e,t),e.updateExpiration(),e._wasMinPriorityChild=!1,e._priorityHolder=e,wSe(e),e._shouldSelect=!1,e._finalResolution=!0};function nG(e,t){if(e.updateVisibility(t),!e.isVisible)return;const n=e.children.length>0;if((e.hasTilesetContent||e.hasImplicitContent)&&n){const r=e.children[0];nG(r,t),e._visible=r._visible;return}if(CSe(e,t)){e._visible=!1;return}const i=e.refine===Vr.REPLACE,o=e._optimChildrenWithinParent===Km.USE_OPTIMIZATION;if(i&&o&&n&&!ESe(e,t)){++e.tileset._statistics.numberOfTilesCulledWithChildrenUnion,e._visible=!1;return}}function CSe(e,t){const{parent:n,tileset:i}=e;return!c(n)||n.hasTilesetContent||n.hasImplicitContent||n.refine!==Vr.ADD?!1:e.getScreenSpaceError(t,!0)<=i.memoryAdjustedScreenSpaceError}function ESe(e,t){let n=!1;const i=e.children;for(let o=0;o<i.length;++o){const r=i[o];r.updateVisibility(t),n=n||r.isVisible}return n}function wSe(e){const t=e.tileset._minimumPriority,n=e.tileset._maximumPriority,i=e._priorityHolder;n.distance=Math.max(i._distanceToCamera,n.distance),t.distance=Math.min(i._distanceToCamera,t.distance),n.depth=Math.max(e._depth,n.depth),t.depth=Math.min(e._depth,t.depth),n.foveatedFactor=Math.max(i._foveatedFactor,n.foveatedFactor),t.foveatedFactor=Math.min(i._foveatedFactor,t.foveatedFactor),n.reverseScreenSpaceError=Math.max(e._priorityReverseScreenSpaceError,n.reverseScreenSpaceError),t.reverseScreenSpaceError=Math.min(e._priorityReverseScreenSpaceError,t.reverseScreenSpaceError)}function iG(){}const Gg={stack:new jr,stackMaximumLength:0};iG.selectTiles=function(e,t){e._selectedTiles.length=0,e._requestedTiles.length=0,e.hasMixedContent=!1;let n=!0;const i=e.root;if(i.updateVisibility(t),!i.isVisible)return n;const{touchTile:o,visitTile:r}=Po,s=Gg.stack;for(s.push(i);s.length>0;){Gg.stackMaximumLength=Math.max(Gg.stackMaximumLength,s.length);const a=s.pop(),l=a.refine===Vr.ADD,u=a.refine===Vr.REPLACE,h=SSe(a);h&&vSe(a,s,t),(l||u&&!h)&&(ISe(e,a),o(a,t),DSe(a,t),a.hasRenderableContent&&!a.contentAvailable&&(n=!1)),r(a,t)}return Gg.stack.trim(Gg.stackMaximumLength),n};function SSe(e){return e.children.length===0?!1:e.hasTilesetContent||e.hasImplicitContent?!e.contentExpired:(e.hasEmptyContent,!0)}function vSe(e,t,n){const{children:i}=e;for(let o=0;o<i.length;++o){const r=i[o];r.updateVisibility(n),r.isVisible&&t.push(r)}}function ISe(e,t){(t.hasUnloadedRenderableContent||t.contentExpired)&&(t._priority=0,e._requestedTiles.push(t))}function DSe(e,t){e.contentAvailable&&e.contentVisibility(t)!==Bt.OUTSIDE&&e.tileset._selectedTiles.push(e)}function oG(){}const zy={stack:new jr,stackMaximumLength:0},Uy={stack:new jr,stackMaximumLength:0};oG.selectTiles=function(e,t){if(e._requestedTiles.length=0,e.debugFreezeFrame)return;e._selectedTiles.length=0,e._selectedTilesToStyle.length=0,e._emptyTiles.length=0,e.hasMixedContent=!1;const n=e.root;if(Po.updateTile(n,t),!n.isVisible||n.getScreenSpaceError(t,!0)<=e.memoryAdjustedScreenSpaceError)return;OSe(n,t),zy.stack.trim(zy.stackMaximumLength),Uy.stack.trim(Uy.stackMaximumLength);const i=e._requestedTiles;for(let o=0;o<i.length;++o)i[o].updatePriority()};function BS(e,t){e.contentAvailable&&Po.selectTile(e,t)}function PSe(e,t,n){const i=e.refine===Vr.REPLACE,{tileset:o,children:r}=e,{updateTile:s,loadTile:a,touchTile:l}=Po;for(let m=0;m<r.length;++m)s(r[m],n);r.sort(Po.sortChildrenByDistanceToCamera);const u=i&&e.hasRenderableContent;let h=!0,f=!1,_=-1,g=Number.MAX_VALUE;for(let m=0;m<r.length;++m){const b=r[m];if(b.isVisible?(t.push(b),b._foveatedFactor<g&&(_=m,g=b._foveatedFactor),f=!0):(u||o.loadSiblings)&&(b._foveatedFactor<g&&(_=m,g=b._foveatedFactor),a(b,n),l(b,n)),u){let T;b._inRequestVolume?b.hasRenderableContent?T=b.contentAvailable:T=LSe(b,n):T=!1,h=h&&T}}if(f||(h=!1),_!==-1&&i){const m=r[_];m._wasMinPriorityChild=!0;const b=(e._wasMinPriorityChild||e===o.root)&&g<=e._priorityHolder._foveatedFactor?e._priorityHolder:e;b._foveatedFactor=Math.min(m._foveatedFactor,b._foveatedFactor),b._distanceToCamera=Math.min(m._distanceToCamera,b._distanceToCamera);for(let T=0;T<r.length;++T)r[T]._priorityHolder=b}return h}function OSe(e,t){const{tileset:n}=e,{canTraverse:i,loadTile:o,visitTile:r,touchTile:s}=Po,a=zy.stack;for(a.push(e);a.length>0;){zy.stackMaximumLength=Math.max(zy.stackMaximumLength,a.length);const l=a.pop(),u=l.parent,h=!c(u)||u._refines;l._refines=i(l)?PSe(l,a,t)&&h:!1;const f=!l._refines&&h;l.hasRenderableContent?l.refine===Vr.ADD?(BS(l,t),o(l,t)):l.refine===Vr.REPLACE&&(o(l,t),f&&BS(l,t)):(n._emptyTiles.push(l),o(l,t),f&&BS(l,t)),r(l,t),s(l,t)}}function LSe(e,t){const{canTraverse:n,updateTile:i,loadTile:o,touchTile:r}=Po;let s=!0;const a=Uy.stack;for(a.push(e);a.length>0;){Uy.stackMaximumLength=Math.max(Uy.stackMaximumLength,a.length);const l=a.pop(),u=l.children,h=u.length,f=!l.hasRenderableContent&&n(l);if(!f&&!l.contentAvailable&&(s=!1),i(l,t),l.isVisible||(o(l,t),r(l,t)),f)for(let _=0;_<h;++_){const g=u[_];a.push(g)}}return e.hasEmptyContent||s}function rG(){}const ky={stack:new jr,stackMaximumLength:0},Vy={stack:new jr,stackMaximumLength:0},Gu={stack:new jr,stackMaximumLength:0,ancestorStack:new jr,ancestorStackMaximumLength:0},RSe=2;rG.selectTiles=function(e,t){if(e._requestedTiles.length=0,e.debugFreezeFrame)return;e._selectedTiles.length=0,e._selectedTilesToStyle.length=0,e._emptyTiles.length=0,e.hasMixedContent=!1;const n=e.root;if(Po.updateTile(n,t),!n.isVisible||n.getScreenSpaceError(t,!0)<=e.memoryAdjustedScreenSpaceError)return;USe(n,t),kSe(n,t),ky.stack.trim(ky.stackMaximumLength),Vy.stack.trim(Vy.stackMaximumLength),Gu.stack.trim(Gu.stackMaximumLength),Gu.ancestorStack.trim(Gu.ancestorStackMaximumLength);const i=e._requestedTiles;for(let o=0;o<i.length;++o)i[o].updatePriority()};function NSe(e,t){const{updateTile:n,touchTile:i,selectTile:o}=Po,r=Vy.stack;for(r.push(e);r.length>0;){Vy.stackMaximumLength=Math.max(Vy.stackMaximumLength,r.length);const a=r.pop().children;for(let l=0;l<a.length;++l){const u=a[l];u.isVisible&&(u.contentAvailable?(n(u,t),i(u,t),o(u,t)):u._depth-e._depth<RSe&&r.push(u))}}}function vT(e,t){const n=e.contentAvailable?e:e._ancestorWithContentAvailable;c(n)?n._shouldSelect=!0:NSe(e,t)}function MSe(e,t){e._ancestorWithContent=void 0,e._ancestorWithContentAvailable=void 0;const{parent:n}=e;if(!c(n))return;const i=!n.hasUnloadedRenderableContent||n._requestedFrame===t.frameNumber;e._ancestorWithContent=i?n:n._ancestorWithContent,e._ancestorWithContentAvailable=n.contentAvailable?n:n._ancestorWithContentAvailable}function FSe(e,t){const n=t._ancestorWithContent;return!e.immediatelyLoadDesiredLevelOfDetail&&(t._priorityProgressiveResolutionScreenSpaceErrorLeaf||c(n)&&t._screenSpaceError<n._screenSpaceError/e.skipScreenSpaceErrorFactor&&t._depth>n._depth+e.skipLevels)}function BSe(e,t,n){const{tileset:i,children:o}=e,{updateTile:r,loadTile:s,touchTile:a}=Po;for(let u=0;u<o.length;++u)r(o[u],n);o.sort(Po.sortChildrenByDistanceToCamera);let l=!1;for(let u=0;u<o.length;++u){const h=o[u];h.isVisible?(t.push(h),l=!0):i.loadSiblings&&(s(h,n),a(h,n))}return l}function zSe(e,t){const{tileset:n}=e;return n.immediatelyLoadDesiredLevelOfDetail?!1:c(e._ancestorWithContent)?e._screenSpaceError===0?e.parent._screenSpaceError>t:e._screenSpaceError>t:!0}function USe(e,t){const{tileset:n}=e,i=n.immediatelyLoadDesiredLevelOfDetail?Number.MAX_VALUE:Math.max(n.baseScreenSpaceError,n.memoryAdjustedScreenSpaceError),{canTraverse:o,loadTile:r,visitTile:s,touchTile:a}=Po,l=ky.stack;for(l.push(e);l.length>0;){ky.stackMaximumLength=Math.max(ky.stackMaximumLength,l.length);const u=l.pop();MSe(u,t);const h=u.parent,f=!c(h)||h._refines;u._refines=o(u)?BSe(u,l,t)&&f:!1;const _=!u._refines&&f;u.hasRenderableContent?u.refine===Vr.ADD?(vT(u,t),r(u,t)):u.refine===Vr.REPLACE&&(zSe(u,i)?(r(u,t),_&&vT(u,t)):_?(vT(u,t),r(u,t)):FSe(n,u)&&r(u,t)):(n._emptyTiles.push(u),r(u,t),_&&vT(u,t)),s(u,t),a(u,t)}}function kSe(e,t){const{selectTile:n,canTraverse:i}=Po,{stack:o,ancestorStack:r}=Gu;let s;for(o.push(e);o.length>0||r.length>0;){if(Gu.stackMaximumLength=Math.max(Gu.stackMaximumLength,o.length),Gu.ancestorStackMaximumLength=Math.max(Gu.ancestorStackMaximumLength,r.length),r.length>0){const u=r.peek();if(u._stackLength===o.length){r.pop(),u!==s&&(u._finalResolution=!1),n(u,t);continue}}const a=o.pop();if(!c(a))continue;const l=i(a);if(a._shouldSelect)if(a.refine===Vr.ADD)n(a,t);else{if(a._selectionDepth=r.length,a._selectionDepth>0&&(a.tileset.hasMixedContent=!0),s=a,!l){n(a,t);continue}r.push(a),a._stackLength=o.length}if(l){const u=a.children;for(let h=0;h<u.length;++h){const f=u[h];f.isVisible&&o.push(f)}}}}function hi(e){e=y(e,y.EMPTY_OBJECT),this._url=void 0,this._basePath=void 0,this._root=void 0,this._resource=void 0,this._asset=void 0,this._properties=void 0,this._geometricError=void 0,this._scaledGeometricError=void 0,this._extensionsUsed=void 0,this._extensions=void 0,this._modelUpAxis=void 0,this._modelForwardAxis=void 0,this._cache=new Vp,this._processingQueue=[],this._selectedTiles=[],this._emptyTiles=[],this._requestedTiles=[],this._selectedTilesToStyle=[],this._loadTimestamp=void 0,this._timeSinceLoad=0,this._updatedVisibilityFrame=0,this._updatedModelMatrixFrame=0,this._modelMatrixChanged=!1,this._previousModelMatrix=void 0,this._extras=void 0,this._credits=void 0,this._showCreditsOnScreen=y(e.showCreditsOnScreen,!1),this._cullWithChildrenBounds=y(e.cullWithChildrenBounds,!0),this._allTilesAdditive=!0,this._hasMixedContent=!1,this._stencilClearCommand=void 0,this._backfaceCommands=new jr,this._maximumScreenSpaceError=y(e.maximumScreenSpaceError,16),this._memoryAdjustedScreenSpaceError=this._maximumScreenSpaceError,this._cacheBytes=y(e.cacheBytes,512*1024*1024),A.typeOf.number.greaterThanOrEquals("cacheBytes",this._cacheBytes,0);const t=y(e.maximumCacheOverflowBytes,512*1024*1024);A.typeOf.number.greaterThanOrEquals("maximumCacheOverflowBytes",t,0),this._maximumCacheOverflowBytes=t,this._styleEngine=new Z0,this._styleApplied=!1,this._modelMatrix=c(e.modelMatrix)?L.clone(e.modelMatrix):L.clone(L.IDENTITY),this._addHeightCallbacks=[],this._statistics=new eu,this._statisticsLast=new eu,this._statisticsPerPass=new Array(wr.NUMBER_OF_PASSES);for(let o=0;o<wr.NUMBER_OF_PASSES;++o)this._statisticsPerPass[o]=new eu;this._requestedTilesInFlight=[],this._maximumPriority={foveatedFactor:-Number.MAX_VALUE,depth:-Number.MAX_VALUE,distance:-Number.MAX_VALUE,reverseScreenSpaceError:-Number.MAX_VALUE},this._minimumPriority={foveatedFactor:Number.MAX_VALUE,depth:Number.MAX_VALUE,distance:Number.MAX_VALUE,reverseScreenSpaceError:Number.MAX_VALUE},this._heatmap=new VC(e.debugHeatmapTilePropertyName),this.cullRequestsWhileMoving=y(e.cullRequestsWhileMoving,!0),this._cullRequestsWhileMoving=!1,this.cullRequestsWhileMovingMultiplier=y(e.cullRequestsWhileMovingMultiplier,60),this.progressiveResolutionHeightFraction=R.clamp(y(e.progressiveResolutionHeightFraction,.3),0,.5),this.preferLeaves=y(e.preferLeaves,!1),this._tilesLoaded=!1,this._initialTilesLoaded=!1,this._tileDebugLabels=void 0,this._classificationType=e.classificationType,this._ellipsoid=y(e.ellipsoid,ae.WGS84),this._initialClippingPlanesOriginMatrix=L.IDENTITY,this._clippingPlanesOriginMatrix=void 0,this._clippingPlanesOriginMatrixDirty=!0,this._vectorClassificationOnly=y(e.vectorClassificationOnly,!1),this._vectorKeepDecodedPositions=y(e.vectorKeepDecodedPositions,!1),this.preloadWhenHidden=y(e.preloadWhenHidden,!1),this.preloadFlightDestinations=y(e.preloadFlightDestinations,!0),this._pass=void 0,this.dynamicScreenSpaceError=y(e.dynamicScreenSpaceError,!0),this.foveatedScreenSpaceError=y(e.foveatedScreenSpaceError,!0),this._foveatedConeSize=y(e.foveatedConeSize,.1),this._foveatedMinimumScreenSpaceErrorRelaxation=y(e.foveatedMinimumScreenSpaceErrorRelaxation,0),this.foveatedInterpolationCallback=y(e.foveatedInterpolationCallback,R.lerp),this.foveatedTimeDelay=y(e.foveatedTimeDelay,.2),this.dynamicScreenSpaceErrorDensity=y(e.dynamicScreenSpaceErrorDensity,2e-4),this.dynamicScreenSpaceErrorFactor=y(e.dynamicScreenSpaceErrorFactor,24),this.dynamicScreenSpaceErrorHeightFalloff=y(e.dynamicScreenSpaceErrorHeightFalloff,.25),this._dynamicScreenSpaceErrorComputedDensity=0,this.shadows=y(e.shadows,Vi.ENABLED),this.show=y(e.show,!0),this.colorBlendMode=HA.HIGHLIGHT,this.colorBlendAmount=.5,this._pointCloudShading=new q0(e.pointCloudShading),this._pointCloudEyeDomeLighting=new Jh,this.loadProgress=new Le,this.allTilesLoaded=new Le,this.initialTilesLoaded=new Le,this.tileLoad=new Le,this.tileUnload=new Le,this.tileFailed=new Le,this.tileVisible=new Le,this.skipLevelOfDetail=y(e.skipLevelOfDetail,!1),this._disableSkipLevelOfDetail=!1,this.baseScreenSpaceError=y(e.baseScreenSpaceError,1024),this.skipScreenSpaceErrorFactor=y(e.skipScreenSpaceErrorFactor,16),this.skipLevels=y(e.skipLevels,1),this.immediatelyLoadDesiredLevelOfDetail=y(e.immediatelyLoadDesiredLevelOfDetail,!1),this.loadSiblings=y(e.loadSiblings,!1),this._clippingPlanes=void 0,c(e.clippingPlanes)&&Li.setOwner(e.clippingPlanes,this,"_clippingPlanes"),this._clippingPolygons=void 0,c(e.clippingPolygons)&&Di.setOwner(e.clippingPolygons,this,"_clippingPolygons"),c(e.imageBasedLighting)?(this._imageBasedLighting=e.imageBasedLighting,this._shouldDestroyImageBasedLighting=!1):(this._imageBasedLighting=new G_,this._shouldDestroyImageBasedLighting=!0),this.lightColor=e.lightColor,this.backFaceCulling=y(e.backFaceCulling,!0),this._enableShowOutline=y(e.enableShowOutline,!0),this.showOutline=y(e.showOutline,!0),this.outlineColor=y(e.outlineColor,z.BLACK),this.splitDirection=y(e.splitDirection,zp.NONE),this.enableCollision=y(e.enableCollision,!1),this._projectTo2D=y(e.projectTo2D,!1),this._enablePick=y(e.enablePick,!1),this.debugFreezeFrame=y(e.debugFreezeFrame,!1),this.debugColorizeTiles=y(e.debugColorizeTiles,!1),this._enableDebugWireframe=y(e.enableDebugWireframe,!1),this.debugWireframe=y(e.debugWireframe,!1),this.debugWireframe===!0&&this._enableDebugWireframe===!1&&$n("tileset-debug-wireframe-ignored","enableDebugWireframe must be set to true in the Cesium3DTileset constructor, otherwise debugWireframe will be ignored."),this.debugShowBoundingVolume=y(e.debugShowBoundingVolume,!1),this.debugShowContentBoundingVolume=y(e.debugShowContentBoundingVolume,!1),this.debugShowViewerRequestVolume=y(e.debugShowViewerRequestVolume,!1),this._tileDebugLabels=void 0,this.debugPickedTileLabelOnly=!1,this.debugPickedTile=void 0,this.debugPickPosition=void 0,this.debugShowGeometricError=y(e.debugShowGeometricError,!1),this.debugShowRenderingStatistics=y(e.debugShowRenderingStatistics,!1),this.debugShowMemoryUsage=y(e.debugShowMemoryUsage,!1),this.debugShowUrl=y(e.debugShowUrl,!1),this.examineVectorLinesFunction=void 0,this._metadataExtension=void 0,this._customShader=e.customShader;let n=y(e.featureIdLabel,"featureId_0");typeof n=="number"&&(n=`featureId_${n}`),this._featureIdLabel=n;let i=y(e.instanceFeatureIdLabel,"instanceFeatureId_0");typeof i=="number"&&(i=`instanceFeatureId_${i}`),this._instanceFeatureIdLabel=i}Object.defineProperties(hi.prototype,{isCesium3DTileset:{get:function(){return!0}},asset:{get:function(){return this._asset}},extensions:{get:function(){return this._extensions}},clippingPlanes:{get:function(){return this._clippingPlanes},set:function(e){Li.setOwner(e,this,"_clippingPlanes")}},clippingPolygons:{get:function(){return this._clippingPolygons},set:function(e){Di.setOwner(e,this,"_clippingPolygons")}},properties:{get:function(){return this._properties}},tilesLoaded:{get:function(){return this._tilesLoaded}},resource:{get:function(){return this._resource}},basePath:{get:function(){return Xh("Cesium3DTileset.basePath","Cesium3DTileset.basePath has been deprecated. All tiles are relative to the url of the tileset JSON file that contains them. Use the url property instead."),this._basePath}},style:{get:function(){return this._styleEngine.style},set:function(e){this._styleEngine.style=e}},customShader:{get:function(){return this._customShader},set:function(e){this._customShader=e}},hasMixedContent:{get:function(){return this._hasMixedContent},set:function(e){A.typeOf.bool("value",e),this._hasMixedContent=e}},isSkippingLevelOfDetail:{get:function(){return this.skipLevelOfDetail&&!c(this._classificationType)&&!this._disableSkipLevelOfDetail&&!this._allTilesAdditive}},metadataExtension:{get:function(){return this._metadataExtension}},metadata:{get:function(){if(c(this._metadataExtension))return this._metadataExtension.tileset}},schema:{get:function(){if(c(this._metadataExtension))return this._metadataExtension.schema}},maximumScreenSpaceError:{get:function(){return this._maximumScreenSpaceError},set:function(e){A.typeOf.number.greaterThanOrEquals("maximumScreenSpaceError",e,0),this._maximumScreenSpaceError=e,this._memoryAdjustedScreenSpaceError=e}},cacheBytes:{get:function(){return this._cacheBytes},set:function(e){A.typeOf.number.greaterThanOrEquals("value",e,0),this._cacheBytes=e}},maximumCacheOverflowBytes:{get:function(){return this._maximumCacheOverflowBytes},set:function(e){A.typeOf.number.greaterThanOrEquals("value",e,0),this._maximumCacheOverflowBytes=e}},memoryAdjustedScreenSpaceError:{get:function(){return this._memoryAdjustedScreenSpaceError}},pointCloudShading:{get:function(){return this._pointCloudShading},set:function(e){A.defined("pointCloudShading",e),this._pointCloudShading=e}},root:{get:function(){return this._root}},boundingSphere:{get:function(){return this._root.updateTransform(this._modelMatrix),this._root.boundingSphere}},modelMatrix:{get:function(){return this._modelMatrix},set:function(e){this._modelMatrix=L.clone(e,this._modelMatrix)}},timeSinceLoad:{get:function(){return this._timeSinceLoad}},totalMemoryUsageInBytes:{get:function(){const e=this._statistics;return e.texturesByteLength+e.geometryByteLength+e.batchTableByteLength}},clippingPlanesOriginMatrix:{get:function(){return c(this._clippingPlanesOriginMatrix)?(this._clippingPlanesOriginMatrixDirty&&(L.multiply(this.root.computedTransform,this._initialClippingPlanesOriginMatrix,this._clippingPlanesOriginMatrix),this._clippingPlanesOriginMatrixDirty=!1),this._clippingPlanesOriginMatrix):L.IDENTITY}},styleEngine:{get:function(){return this._styleEngine}},statistics:{get:function(){return this._statistics}},classificationType:{get:function(){return this._classificationType}},ellipsoid:{get:function(){return this._ellipsoid}},foveatedConeSize:{get:function(){return this._foveatedConeSize},set:function(e){A.typeOf.number.greaterThanOrEquals("foveatedConeSize",e,0),A.typeOf.number.lessThanOrEquals("foveatedConeSize",e,1),this._foveatedConeSize=e}},foveatedMinimumScreenSpaceErrorRelaxation:{get:function(){return this._foveatedMinimumScreenSpaceErrorRelaxation},set:function(e){A.typeOf.number.greaterThanOrEquals("foveatedMinimumScreenSpaceErrorRelaxation",e,0),A.typeOf.number.lessThanOrEquals("foveatedMinimumScreenSpaceErrorRelaxation",e,this.maximumScreenSpaceError),this._foveatedMinimumScreenSpaceErrorRelaxation=e}},extras:{get:function(){return this._extras}},imageBasedLighting:{get:function(){return this._imageBasedLighting},set:function(e){A.typeOf.object("imageBasedLighting",this._imageBasedLighting),e!==this._imageBasedLighting&&(this._shouldDestroyImageBasedLighting&&!this._imageBasedLighting.isDestroyed()&&this._imageBasedLighting.destroy(),this._imageBasedLighting=e,this._shouldDestroyImageBasedLighting=!1)}},vectorClassificationOnly:{get:function(){return this._vectorClassificationOnly}},vectorKeepDecodedPositions:{get:function(){return this._vectorKeepDecodedPositions}},showCreditsOnScreen:{get:function(){return this._showCreditsOnScreen},set:function(e){this._showCreditsOnScreen=e,uG(this)}},featureIdLabel:{get:function(){return this._featureIdLabel},set:function(e){typeof e=="number"&&(e=`featureId_${e}`),A.typeOf.string("value",e),this._featureIdLabel=e}},instanceFeatureIdLabel:{get:function(){return this._instanceFeatureIdLabel},set:function(e){typeof e=="number"&&(e=`instanceFeatureId_${e}`),A.typeOf.string("value",e),this._instanceFeatureIdLabel=e}}});hi.fromIonAssetId=async function(e,t){A.defined("assetId",e);const n=await ar.fromAssetId(e);return hi.fromUrl(n,t)};hi.fromUrl=async function(e,t){A.defined("url",e),t=y(t,y.EMPTY_OBJECT);const n=Ae.createIfNeeded(e);let i;n.extension==="json"?i=n.getBaseUri(!0):n.isDataUri&&(i="");const o=await hi.loadJson(n),r=await VSe(n,o),s=new hi(t);s._resource=n,s._url=n.url,s._basePath=i,s._metadataExtension=r,s._geometricError=o.geometricError,s._scaledGeometricError=o.geometricError;const a=o.asset;s._asset=a,s._extras=o.extras,uG(s);const l=c(o.asset.gltfUpAxis)?Cr.fromName(o.asset.gltfUpAxis):Cr.Y,u=y(t.modelUpAxis,l),h=y(t.modelForwardAxis,Cr.X);s._properties=o.properties,s._extensionsUsed=o.extensionsUsed,s._extensions=o.extensions,s._modelUpAxis=u,s._modelForwardAxis=h,s._root=s.loadTileset(n,o);const _=s._root.createBoundingVolume(o.root.boundingVolume,L.IDENTITY).boundingSphere.center,g=s._ellipsoid.cartesianToCartographic(_);return c(g)&&g.height>Ti._defaultMinTerrainHeight&&(s._initialClippingPlanesOriginMatrix=zt.eastNorthUpToFixedFrame(_)),s._clippingPlanesOriginMatrix=L.clone(s._initialClippingPlanesOriginMatrix),s};hi.loadJson=function(e){return Ae.createIfNeeded(e).fetchJson()};hi.prototype.makeStyleDirty=function(){this._styleEngine.makeDirty()};hi.prototype.loadTileset=function(e,t,n){const i=t.asset;if(!c(i))throw new Te("Tileset must have an asset property.");if(i.version!=="0.0"&&i.version!=="1.0"&&i.version!=="1.1")throw new Te("The tileset must be 3D Tiles version 0.0, 1.0, or 1.1");c(t.extensionsRequired)&&hi.checkSupportedExtensions(t.extensionsRequired);const o=this._statistics,r=i.tilesetVersion;c(r)&&(this._basePath+=`?v=${r}`,e=e.clone(),e.setQueryParameters({v:r}));const s=o2(this,e,t.root,n);c(n)&&(n.children.push(s),s._depth=n._depth+1);const a=[];for(a.push(s);a.length>0;){const l=a.pop();++o.numberOfTilesTotal,this._allTilesAdditive=this._allTilesAdditive&&l.refine===Vr.ADD;const u=l._header.children;if(c(u))for(let h=0;h<u.length;++h){const f=u[h],_=o2(this,e,f,l);l.children.push(_),_._depth=l._depth+1,a.push(_)}this._cullWithChildrenBounds&&_Se.checkChildrenWithinParent(l)}return s};function o2(e,t,n,i){if(!(c(n.implicitTiling)||To(n,"3DTILES_implicit_tiling")))return new Ai(e,t,n,i);const r=e.schema,s=new bSe(t,n,r),a=new xi({subdivisionScheme:s.subdivisionScheme,subtreeLevels:s.subtreeLevels,level:0,x:0,y:0,z:0}),l=s.subtreeUriTemplate.getDerivedResource({templateValues:a.getTemplateValues()}).url,h=Je(n,!0);h.contents=[{uri:l}],delete h.content,delete h.extensions;const f=new Ai(e,t,h,i);return f.implicitTileset=s,f.implicitCoordinates=a,f}async function VSe(e,t){const n=To(t,"3DTILES_metadata")?t.extensions["3DTILES_metadata"]:t;let i;if(c(n.schemaUri))e=e.getDerivedResource({url:n.schemaUri}),i=dt.getSchemaLoader({resource:e});else if(c(n.schema))i=dt.getSchemaLoader({schema:n.schema});else return;await i.load();const o=new J8({schema:i.schema,metadataJson:n});return dt.unload(i),o}const r2=new d,HSe=new he,GSe=new L,jSe=new d,WSe=new d,qSe=new d,YSe=new d;function $Se(e,t){let n,i,o,r,s;const a=t.camera,l=e._root,u=l.contentBoundingVolume;if(u instanceof ru)n=d.normalize(a.positionWC,r2),i=a.directionWC,o=a.positionCartographic.height,r=u.minimumHeight,s=u.maximumHeight;else{const b=L.inverseTransformation(l.computedTransform,GSe),T=t.mapProjection.ellipsoid,x=u.boundingVolume,C=L.multiplyByPoint(b,x.center,jSe);if(d.magnitude(C)>T.minimumRadius){const w=he.fromCartesian(C,T,HSe);n=d.normalize(a.positionWC,r2),i=a.directionWC,o=a.positionCartographic.height,r=0,s=w.height*2}else{const w=L.multiplyByPoint(b,a.positionWC,WSe);if(n=d.UNIT_Z,i=L.multiplyByPointAsVector(b,a.directionWC,qSe),i=d.normalize(i,i),o=w.z,u instanceof Oc){const v=$.getColumn(x.halfAxes,2,YSe),P=d.magnitude(v);r=C.z-P,s=C.z+P}else if(u instanceof Sd){const v=x.radius;r=C.z-v,s=C.z+v}}}const h=e.dynamicScreenSpaceErrorHeightFalloff,f=r+(s-r)*h,_=s,g=R.clamp((o-f)/(_-f),0,1);let m=1-Math.abs(d.dot(i,n));m=m*(1-g),e._dynamicScreenSpaceErrorComputedDensity=e.dynamicScreenSpaceErrorDensity*m}function XSe(e,t){if(t.hasEmptyContent)return;const{statistics:n}=e,i=t.contentExpired,o=t.requestContent();!c(o)||(o.then(r=>{!c(r)||t.isDestroyed()||e.isDestroyed()||(e._processingQueue.push(t),++n.numberOfTilesProcessing)}).catch(r=>{aG(r,e,t)}),i&&(t.hasTilesetContent||t.hasImplicitContent?lve(e,t):(n.decrementLoadCounts(t.content),--n.numberOfTilesWithContentReady)),e._requestedTilesInFlight.push(t))}function sG(e,t){return e._priority-t._priority}hi.prototype.postPassesUpdate=function(e){!c(this._root)||(QSe(this,e),dve(this,e),this._cache.unloadTiles(this,lG),this._styleApplied&&this._styleEngine.resetDirty(),this._styleApplied=!1)};hi.prototype.prePassesUpdate=function(e){if(!c(this._root))return;ive(this,e);const t=this._clippingPlanes;this._clippingPlanesOriginMatrixDirty=!0,c(t)&&t.enabled&&t.update(e);const n=this._clippingPolygons;c(n)&&n.enabled&&n.update(e),c(this._loadTimestamp)||(this._loadTimestamp=ie.clone(e.time)),this._timeSinceLoad=Math.max(ie.secondsDifference(e.time,this._loadTimestamp)*1e3,0),this.dynamicScreenSpaceError&&$Se(this,e),e.newFrame&&this._cache.reset()};function QSe(e,t){const n=e._requestedTilesInFlight;let i=0;for(let o=0;o<n.length;++o){const r=n[o],s=t.frameNumber-r._touchedFrame>=1;if(r._contentState!==bo.LOADING){++i;continue}else if(s){r.cancelRequests(),++i;continue}i>0&&(n[o-i]=r)}n.length-=i}function KSe(e){const t=e._requestedTiles;t.sort(sG);for(let n=0;n<t.length;++n)XSe(e,t[n])}function aG(e,t,n){if(t.isDestroyed())return;let i;n.isDestroyed()||(i=n._contentResource.url);const o=c(e.message)?e.message:e.toString();t.tileFailed.numberOfListeners>0?t.tileFailed.raiseEvent({url:i,message:o}):(console.log(`A 3D tile failed to load: ${i}`),console.log(`Error: ${o}`))}function ZSe(e){const t=e._processingQueue;let n=0;for(let i=0;i<t.length;++i){const o=t[i];if(o.isDestroyed()||o._contentState!==bo.PROCESSING){++n;continue}n>0&&(t[i-n]=o)}t.length-=n}const JSe=new he,eve=new he,tve=new d;function nve(e,t,n){if(!e.enableCollision||!e.show)return;const i=e._addHeightCallbacks,o=t.boundingSphere;for(const r of i){if(r.invoked||t._wasSelectedLastFrame)continue;const s=r.ellipsoid,a=he.clone(r.positionCartographic,JSe),l=he.fromCartesian(o.center,s,eve);c(l)&&(a.height=l.height);const u=he.toCartesian(a,s,tve);d.distance(u,o.center)<=o.radius&&n.afterRender.push(()=>{c(r.callback)&&r.callback(a),r.invoked=!1})}}function ive(e,t){ZSe(e);const n=e._processingQueue,{cacheBytes:i,maximumCacheOverflowBytes:o,statistics:r}=e,s=i+o;let a=!1;for(let l=0;l<n.length;++l){if(e.totalMemoryUsageInBytes>s){a=!0;break}const u=n[l];try{u.process(e,t),u.contentReady&&(--r.numberOfTilesProcessing,e.tileLoad.raiseEvent(u))}catch(h){--r.numberOfTilesProcessing,aG(h,e,u)}}e.totalMemoryUsageInBytes<i?rve(e):a&&n.length>0&&ove(e)}function ove(e){$n("increase-screenSpaceError",`The tiles needed to meet maximumScreenSpaceError would use more memory than allocated for this tileset.
|
|
The tileset will be rendered with a larger screen space error (see memoryAdjustedScreenSpaceError).
|
|
Consider using larger values for cacheBytes and maximumCacheOverflowBytes.`),e._memoryAdjustedScreenSpaceError*=1.02;const t=e._processingQueue;for(let n=0;n<t.length;++n)t[n].updatePriority();t.sort(sG)}function rve(e){e._memoryAdjustedScreenSpaceError=Math.max(e.memoryAdjustedScreenSpaceError/1.02,e.maximumScreenSpaceError)}const IT=new d,sve={maximumFractionDigits:3};function s2(e){const t=e/1048576;return t<1?t.toLocaleString(void 0,sve):Math.round(t).toLocaleString()}function zS(e){const{halfAxes:t,radius:n,center:i}=e.boundingVolume.boundingVolume;let o=d.clone(i,IT);if(c(t))o.x+=.75*(t[0]+t[3]+t[6]),o.y+=.75*(t[1]+t[4]+t[7]),o.z+=.75*(t[2]+t[5]+t[8]);else if(c(n)){let r=d.normalize(i,IT);r=d.multiplyByScalar(r,.75*n,IT),o=d.add(r,i,IT)}return o}function US(e,t,n){let i="",o=0;if(t.debugShowGeometricError&&(i+=`
|
|
Geometric error: ${e.geometricError}`,o++),t.debugShowRenderingStatistics&&(i+=`
|
|
Commands: ${e.commandsLength}`,o++,e.content.pointsLength>0&&(i+=`
|
|
Points: ${e.content.pointsLength}`,o++),e.content.trianglesLength>0&&(i+=`
|
|
Triangles: ${e.content.trianglesLength}`,o++),i+=`
|
|
Features: ${e.content.featuresLength}`,o++),t.debugShowMemoryUsage&&(i+=`
|
|
Texture Memory: ${s2(e.content.texturesByteLength)}`,i+=`
|
|
Geometry Memory: ${s2(e.content.geometryByteLength)}`,o+=2),t.debugShowUrl)if(e.hasMultipleContents){i+=`
|
|
Urls:`;const s=e.content.innerContentUrls;for(let a=0;a<s.length;a++)i+=`
|
|
- ${s[a]}`;o+=s.length}else i+=`
|
|
Url: ${e._contentHeader.uri}`,o++;const r={text:i.substring(1),position:n,font:`${19-o}px sans-serif`,showBackground:!0,disableDepthTestDistance:Number.POSITIVE_INFINITY};return t._tileDebugLabels.add(r)}function ave(e,t){const n=e._selectedTiles,i=n.length,o=e._emptyTiles,r=o.length;if(e._tileDebugLabels.removeAll(),e.debugPickedTileLabelOnly){if(c(e.debugPickedTile)){const s=c(e.debugPickPosition)?e.debugPickPosition:zS(e.debugPickedTile),a=US(e.debugPickedTile,e,s);a.pixelOffset=new H(15,-15)}}else{for(let s=0;s<i;++s){const a=n[s];US(a,e,zS(a))}for(let s=0;s<r;++s){const a=o[s];(a.hasTilesetContent||a.hasImplicitContent)&&US(a,e,zS(a))}}e._tileDebugLabels.update(t)}function cve(e,t,n){e._styleEngine.applyStyle(e),e._styleApplied=!0;const{commandList:i,context:o}=t,r=i.length,s=e._selectedTiles,a=e.isSkippingLevelOfDetail&&e._hasMixedContent&&o.stencilBuffer&&s.length>0;e._backfaceCommands.length=0,a&&(c(e._stencilClearCommand)||(e._stencilClearCommand=new bi({stencil:0,pass:xe.CESIUM_3D_TILE,renderState:Ue.fromCache({stencilMask:At.SKIP_LOD_MASK})})),i.push(e._stencilClearCommand));const{statistics:l,tileVisible:u}=e,h=n.isRender,f=i.length;for(let m=0;m<s.length;++m){const b=s[m];h&&u.raiseEvent(b),nve(e,b,t),b.update(e,t,n),l.incrementSelectionCounts(b.content),++l.selected}const _=e._emptyTiles;for(let m=0;m<_.length;++m)_[m].update(e,t,n);let g=i.length-f;if(e._backfaceCommands.trim(),a){const m=e._backfaceCommands.values,b=m.length;i.length+=b;for(let T=g-1;T>=0;--T)i[f+b+T]=i[f+T];for(let T=0;T<b;++T)i[f+T]=m[T]}g=i.length-r,l.numberOfCommands=g,h&&(e.pointCloudShading.attenuation&&e.pointCloudShading.eyeDomeLighting&&g>0&&e._pointCloudEyeDomeLighting.update(t,r,e.pointCloudShading,e.boundingSphere),e.debugShowGeometricError||e.debugShowRenderingStatistics||e.debugShowMemoryUsage||e.debugShowUrl?(c(e._tileDebugLabels)||(e._tileDebugLabels=new Ga),ave(e,t)):e._tileDebugLabels=e._tileDebugLabels&&e._tileDebugLabels.destroy())}const cG=[];function lve(e,t){const n=t,i=cG;for(i.push(t);i.length>0;){t=i.pop();const o=t.children;for(let r=0;r<o.length;++r)i.push(o[r]);t!==n&&(uve(e,t),--e._statistics.numberOfTilesTotal)}n.children=[]}function lG(e,t){e.tileUnload.raiseEvent(t),e._statistics.decrementLoadCounts(t.content),--e._statistics.numberOfTilesWithContentReady,t.unloadContent()}function uve(e,t){e._cache.unloadTile(e,t,lG),t.destroy()}hi.prototype.trimLoadedTiles=function(){this._cache.trim()};function dve(e,t){const n=e._statistics,i=e._statisticsLast,o=n.numberOfPendingRequests,r=n.numberOfTilesProcessing,s=i.numberOfPendingRequests,a=i.numberOfTilesProcessing;eu.clone(n,i);const l=o!==s||r!==a;l&&t.afterRender.push(function(){return e.loadProgress.raiseEvent(o,r),!0}),e._tilesLoaded=n.numberOfPendingRequests===0&&n.numberOfTilesProcessing===0&&n.numberOfAttemptedRequests===0,l&&e._tilesLoaded&&(t.afterRender.push(function(){return e.allTilesLoaded.raiseEvent(),!0}),e._initialTilesLoaded||(e._initialTilesLoaded=!0,t.afterRender.push(function(){return e.initialTilesLoaded.raiseEvent(),!0})))}function hve(e){e._heatmap.resetMinimumMaximum(),e._minimumPriority.depth=Number.MAX_VALUE,e._maximumPriority.depth=-Number.MAX_VALUE,e._minimumPriority.foveatedFactor=Number.MAX_VALUE,e._maximumPriority.foveatedFactor=-Number.MAX_VALUE,e._minimumPriority.distance=Number.MAX_VALUE,e._maximumPriority.distance=-Number.MAX_VALUE,e._minimumPriority.reverseScreenSpaceError=Number.MAX_VALUE,e._maximumPriority.reverseScreenSpaceError=-Number.MAX_VALUE}function fve(e,t){t.frameNumber===e._updatedModelMatrixFrame&&c(e._previousModelMatrix)||(e._updatedModelMatrixFrame=t.frameNumber,e._modelMatrixChanged=!L.equals(e.modelMatrix,e._previousModelMatrix),e._modelMatrixChanged&&(e._previousModelMatrix=L.clone(e.modelMatrix,e._previousModelMatrix)))}function pve(e,t,n,i){if(t.mode===oe.MORPHING||!c(e._root))return!1;const o=e._statistics;o.clear(),++e._updatedVisibilityFrame,hve(e),fve(e,t),e._cullRequestsWhileMoving=e.cullRequestsWhileMoving&&!e._modelMatrixChanged;const r=e.getTraversal(i).selectTiles(e,t);if(i.requestTiles&&KSe(e),cve(e,t,i),eu.clone(o,n),i.isRender){const s=e._credits;if(c(s)&&o.selected!==0)for(let a=0;a<s.length;++a){const l=s[a];t.creditDisplay.addCreditToNextFrame(l)}}return r}function uG(e){let t=e._credits;c(t)||(t=[]),t.length=0,c(e.resource.credits)&&e.resource.credits.forEach(i=>{t.push(Wt.clone(i))});const n=e.asset.extras;if(c(n)&&c(n.cesium)&&c(n.cesium.credits)){const i=n.cesium.credits;for(let o=0;o<i.length;++o){const r=i[o];t.push(new Wt(r.html))}}t.forEach(i=>i.showOnScreen=i.showOnScreen||e._showCreditsOnScreen),e._credits=t}hi.prototype.getTraversal=function(e){const{pass:t}=e;return t===wr.MOST_DETAILED_PRELOAD||t===wr.MOST_DETAILED_PICK?iG:this.isSkippingLevelOfDetail?rG:oG};hi.prototype.update=function(e){this.updateForPass(e,e.tilesetPassState)};hi.prototype.updateForPass=function(e,t){A.typeOf.object("frameState",e),A.typeOf.object("tilesetPassState",t);const n=t.pass;if(n===wr.PRELOAD&&(!this.preloadWhenHidden||this.show)||n===wr.PRELOAD_FLIGHT&&(!this.preloadFlightDestinations||!this.show&&!this.preloadWhenHidden)||n===wr.REQUEST_RENDER_MODE_DEFER_CHECK&&(!this._cullRequestsWhileMoving&&this.foveatedTimeDelay<=0||!this.show))return;const i=e.commandList,o=e.camera,r=e.cullingVolume;t.ready=!1;const s=wr.getPassOptions(n),a=s.ignoreCommands,l=y(t.commandList,i),u=l.length;e.commandList=l,e.camera=y(t.camera,o),e.cullingVolume=y(t.cullingVolume,r);const h=this._clippingPolygons;c(h)&&h.enabled&&h.queueCommands(e);const f=this._statisticsPerPass[n];(this.show||a)&&(this._pass=n,t.ready=pve(this,e,f,s)),a&&(l.length=u),e.commandList=i,e.camera=o,e.cullingVolume=r};hi.prototype.hasExtension=function(e){return c(this._extensionsUsed)?this._extensionsUsed.indexOf(e)>-1:!1};hi.prototype.isDestroyed=function(){return!1};hi.prototype.destroy=function(){if(this._tileDebugLabels=this._tileDebugLabels&&this._tileDebugLabels.destroy(),this._clippingPlanes=this._clippingPlanes&&this._clippingPlanes.destroy(),this._clippingPolygons=this._clippingPolygons&&this._clippingPolygons.destroy(),c(this._root)){const e=cG;for(e.push(this._root);e.length>0;){const t=e.pop();t.destroy();const n=t.children;for(let i=0;i<n.length;++i)e.push(n[i])}}return this._root=void 0,this._shouldDestroyImageBasedLighting&&!this._imageBasedLighting.isDestroyed()&&this._imageBasedLighting.destroy(),this._imageBasedLighting=void 0,ve(this)};hi.supportedExtensions={"3DTILES_metadata":!0,"3DTILES_implicit_tiling":!0,"3DTILES_content_gltf":!0,"3DTILES_multiple_contents":!0,"3DTILES_bounding_volume_S2":!0,"3DTILES_batch_table_hierarchy":!0,"3DTILES_draco_point_compression":!0,MAXAR_content_geojson:!0};hi.checkSupportedExtensions=function(e){for(let t=0;t<e.length;t++)if(!hi.supportedExtensions[e[t]])throw new Te(`Unsupported 3D Tiles Extension: ${e[t]}`)};const mve=new nn,_ve=new d,gve=new he;hi.prototype.getHeight=function(e,t){var s,a;A.typeOf.object("cartographic",e),A.typeOf.object("scene",t);let n=(s=t.globe)==null?void 0:s.ellipsoid;c(n)||(n=ae.WGS84);const i=mve,o=n.cartographicToCartesian(e,i.direction);d.normalize(i.direction,i.direction),i.direction=d.normalize(o,i.direction),i.direction=d.negate(o,i.direction),i.origin=d.multiplyByScalar(i.direction,-2*n.maximumRadius,i.origin);const r=this.pick(i,t.frameState,_ve);if(!!c(r))return(a=n.cartesianToCartographic(r,gve))==null?void 0:a.height};hi.prototype.updateHeight=function(e,t,n){n=y(n,ae.WGS84);const i={positionCartographic:e,ellipsoid:n,callback:t,invoked:!1},o=()=>{const r=this._addHeightCallbacks,s=r.length;for(let a=0;a<s;++a)if(r[a]===i){r.splice(a,1);break}i.callback&&(i.callback=void 0)};return this._addHeightCallbacks.push(i),o};const yve=new Yu,bve=new d;hi.prototype.pick=function(e,t,n){if(!t.context.webgl2&&!this._enablePick)return;const i=this._selectedTiles,o=i.length,r=[];for(let l=0;l<o;++l){const u=i[l],h=Ei.raySphere(e,u.contentBoundingVolume.boundingSphere,yve);!c(h)||!c(u.content)||r.push(u)}const s=r.length;r.sort((l,u)=>{const h=se.distanceSquaredTo(l.contentBoundingVolume.boundingSphere,e.origin),f=se.distanceSquaredTo(u.contentBoundingVolume.boundingSphere,e.origin);return h-f});let a;for(let l=0;l<s;++l){const h=r[l].content.pick(e,t,bve);if(c(h))return a=d.clone(h,n),a}};const Tve=new L;function Bh(e,t){if(!c(e))throw new E("scene is required.");if(!c(t))throw new E("entityCollection is required.");t.collectionChanged.addEventListener(Bh.prototype._onCollectionChanged,this),this._scene=e,this._primitives=e.primitives,this._entityCollection=t,this._tilesetHash={},this._entitiesToVisualize=new mt,this._onCollectionChanged(t,t.values,[],[])}Bh.prototype.update=function(e){if(!c(e))throw new E("time is required.");const t=this._entitiesToVisualize.values,n=this._tilesetHash,i=this._primitives;for(let o=0,r=t.length;o<r;o++){const s=t[o],a=s._tileset;let l;const u=n[s.id],h=s.isShowing&&s.isAvailable(e)&&K.getValueOrDefault(a._show,e,!0);let f;h&&(f=s.computeModelMatrix(e,Tve),l=Ae.createIfNeeded(K.getValueOrUndefined(a._uri,e)));const _=c(u)?u.tilesetPrimitive:void 0;if(!h){c(_)&&(_.show=!1);continue}(!c(u)||l.url!==u.url)&&(c(_)&&i.removeAndDestroy(_),delete n[s.id],Ave(l,n,s,i)),c(_)&&(_.show=!0,c(f)&&(_.modelMatrix=f),_.maximumScreenSpaceError=K.getValueOrDefault(a.maximumScreenSpaceError,e,_.maximumScreenSpaceError))}return!0};Bh.prototype.isDestroyed=function(){return!1};Bh.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(Bh.prototype._onCollectionChanged,this);const e=this._entitiesToVisualize.values,t=this._tilesetHash,n=this._primitives;for(let i=e.length-1;i>-1;i--)gD(this,e[i],t,n);return ve(this)};Bh.prototype.getBoundingSphere=function(e,t){if(!c(e))throw new E("entity is required.");if(!c(t))throw new E("result is required.");const n=this._tilesetHash[e.id];if(!c(n)||n.loadFail)return rt.FAILED;const i=n.tilesetPrimitive;return c(i)?i.show?(se.clone(i.boundingSphere,t),rt.DONE):rt.FAILED:rt.PENDING};Bh.prototype._onCollectionChanged=function(e,t,n,i){let o,r;const s=this._entitiesToVisualize,a=this._tilesetHash,l=this._primitives;for(o=t.length-1;o>-1;o--)r=t[o],c(r._tileset)&&s.set(r.id,r);for(o=i.length-1;o>-1;o--)r=i[o],c(r._tileset)?s.set(r.id,r):(gD(this,r,a,l),s.remove(r.id));for(o=n.length-1;o>-1;o--)r=n[o],gD(this,r,a,l),s.remove(r.id)};function gD(e,t,n,i){const o=n[t.id];c(o)&&(c(o.tilesetPrimitive)&&i.removeAndDestroy(o.tilesetPrimitive),delete n[t.id])}async function Ave(e,t,n,i){t[n.id]={url:e.url,loadFail:!1};try{const o=await hi.fromUrl(e);if(o.id=n,i.add(o),!c(t[n.id]))return;t[n.id].tilesetPrimitive=o}catch(o){console.error(o),t[n.id].loadFail=!0}}const a2={id:void 0};function eb(e){if(e._firing){e._refire=!0;return}if(e._suspendCount===0){const t=e._addedEntities,n=e._removedEntities,i=e._changedEntities;if(i.length!==0||t.length!==0||n.length!==0){e._firing=!0;do{e._refire=!1;const o=t.values.slice(0),r=n.values.slice(0),s=i.values.slice(0);t.removeAll(),n.removeAll(),i.removeAll(),e._collectionChanged.raiseEvent(e,o,r,s)}while(e._refire);e._firing=!1}}}function As(e){this._owner=e,this._entities=new mt,this._addedEntities=new mt,this._removedEntities=new mt,this._changedEntities=new mt,this._suspendCount=0,this._collectionChanged=new Le,this._id=Wr(),this._show=!0,this._firing=!1,this._refire=!1}As.prototype.suspendEvents=function(){this._suspendCount++};As.prototype.resumeEvents=function(){if(this._suspendCount===0)throw new E("resumeEvents can not be called before suspendEvents.");this._suspendCount--,eb(this)};Object.defineProperties(As.prototype,{collectionChanged:{get:function(){return this._collectionChanged}},id:{get:function(){return this._id}},values:{get:function(){return this._entities.values}},show:{get:function(){return this._show},set:function(e){if(!c(e))throw new E("value is required.");if(e===this._show)return;this.suspendEvents();let t;const n=[],i=this._entities.values,o=i.length;for(t=0;t<o;t++)n.push(i[t].isShowing);for(this._show=e,t=0;t<o;t++){const r=n[t],s=i[t];r!==s.isShowing&&s.definitionChanged.raiseEvent(s,"isShowing",s.isShowing,r)}this.resumeEvents()}},owner:{get:function(){return this._owner}}});As.prototype.computeAvailability=function(){let e=Ke.MAXIMUM_VALUE,t=Ke.MINIMUM_VALUE;const n=this._entities.values;for(let i=0,o=n.length;i<o;i++){const s=n[i].availability;if(c(s)){const a=s.start,l=s.stop;ie.lessThan(a,e)&&!a.equals(Ke.MINIMUM_VALUE)&&(e=a),ie.greaterThan(l,t)&&!l.equals(Ke.MAXIMUM_VALUE)&&(t=l)}}return Ke.MAXIMUM_VALUE.equals(e)&&(e=Ke.MINIMUM_VALUE),Ke.MINIMUM_VALUE.equals(t)&&(t=Ke.MAXIMUM_VALUE),new Ht({start:e,stop:t})};As.prototype.add=function(e){if(!c(e))throw new E("entity is required.");e instanceof Eo||(e=new Eo(e));const t=e.id,n=this._entities;if(n.contains(t))throw new E(`An entity with id ${t} already exists in this collection.`);return e.entityCollection=this,n.set(t,e),this._removedEntities.remove(t)||this._addedEntities.set(t,e),e.definitionChanged.addEventListener(As.prototype._onEntityDefinitionChanged,this),eb(this),e};As.prototype.remove=function(e){return c(e)?this.removeById(e.id):!1};As.prototype.contains=function(e){if(!c(e))throw new E("entity is required");return this._entities.get(e.id)===e};As.prototype.removeById=function(e){if(!c(e))return!1;const n=this._entities.get(e);return this._entities.remove(e)?(this._addedEntities.remove(e)||(this._removedEntities.set(e,n),this._changedEntities.remove(e)),this._entities.remove(e),n.definitionChanged.removeEventListener(As.prototype._onEntityDefinitionChanged,this),eb(this),!0):!1};As.prototype.removeAll=function(){const e=this._entities,t=e.length,n=e.values,i=this._addedEntities,o=this._removedEntities;for(let r=0;r<t;r++){const s=n[r],a=s.id,l=i.get(a);c(l)||(s.definitionChanged.removeEventListener(As.prototype._onEntityDefinitionChanged,this),o.set(a,s))}e.removeAll(),i.removeAll(),this._changedEntities.removeAll(),eb(this)};As.prototype.getById=function(e){if(!c(e))throw new E("id is required.");return this._entities.get(e)};As.prototype.getOrCreateEntity=function(e){if(!c(e))throw new E("id is required.");let t=this._entities.get(e);return c(t)||(a2.id=e,t=new Eo(a2),this.add(t)),t};As.prototype._onEntityDefinitionChanged=function(e){const t=e.id;this._addedEntities.contains(t)||this._changedEntities.set(t,e),eb(this)};function Tu(){this._removalFunctions=[]}Tu.prototype.add=function(e,t,n){if(!c(e))throw new E("event is required");const i=e.addEventListener(t,n);this._removalFunctions.push(i);const o=this;return function(){i();const r=o._removalFunctions;r.splice(r.indexOf(i),1)}};Tu.prototype.removeAll=function(){const e=this._removalFunctions;for(let t=0,n=e.length;t<n;++t)e[t]();e.length=0};function XO(e,t){return ie.compare(e.start,t.start)}function Ji(e){if(this._intervals=[],this._changedEvent=new Le,c(e)){const t=e.length;for(let n=0;n<t;n++)this.addInterval(e[n])}}Object.defineProperties(Ji.prototype,{changedEvent:{get:function(){return this._changedEvent}},start:{get:function(){const e=this._intervals;return e.length===0?void 0:e[0].start}},isStartIncluded:{get:function(){const e=this._intervals;return e.length===0?!1:e[0].isStartIncluded}},stop:{get:function(){const e=this._intervals,t=e.length;return t===0?void 0:e[t-1].stop}},isStopIncluded:{get:function(){const e=this._intervals,t=e.length;return t===0?!1:e[t-1].isStopIncluded}},length:{get:function(){return this._intervals.length}},isEmpty:{get:function(){return this._intervals.length===0}}});Ji.prototype.equals=function(e,t){if(this===e)return!0;if(!(e instanceof Ji))return!1;const n=this._intervals,i=e._intervals,o=n.length;if(o!==i.length)return!1;for(let r=0;r<o;r++)if(!Ht.equals(n[r],i[r],t))return!1;return!0};Ji.prototype.get=function(e){if(!c(e))throw new E("index is required.");return this._intervals[e]};Ji.prototype.removeAll=function(){this._intervals.length>0&&(this._intervals.length=0,this._changedEvent.raiseEvent(this))};Ji.prototype.findIntervalContainingDate=function(e){const t=this.indexOf(e);return t>=0?this._intervals[t]:void 0};Ji.prototype.findDataForIntervalContainingDate=function(e){const t=this.indexOf(e);return t>=0?this._intervals[t].data:void 0};Ji.prototype.contains=function(e){return this.indexOf(e)>=0};const kS=new Ht;Ji.prototype.indexOf=function(e){if(!c(e))throw new E("date is required");const t=this._intervals;kS.start=e,kS.stop=e;let n=Hr(t,kS,XO);return n>=0?t[n].isStartIncluded?n:n>0&&t[n-1].stop.equals(e)&&t[n-1].isStopIncluded?n-1:~n:(n=~n,n>0&&n-1<t.length&&Ht.contains(t[n-1],e)?n-1:~n)};Ji.prototype.findInterval=function(e){e=y(e,y.EMPTY_OBJECT);const t=e.start,n=e.stop,i=e.isStartIncluded,o=e.isStopIncluded,r=this._intervals;for(let s=0,a=r.length;s<a;s++){const l=r[s];if((!c(t)||l.start.equals(t))&&(!c(n)||l.stop.equals(n))&&(!c(i)||l.isStartIncluded===i)&&(!c(o)||l.isStopIncluded===o))return r[s]}};Ji.prototype.addInterval=function(e,t){if(!c(e))throw new E("interval is required");if(e.isEmpty)return;const n=this._intervals;if(n.length===0||ie.greaterThan(e.start,n[n.length-1].stop)){n.push(e),this._changedEvent.raiseEvent(this);return}let i=Hr(n,e,XO);i<0?i=~i:i>0&&e.isStartIncluded&&n[i-1].isStartIncluded&&n[i-1].start.equals(e.start)?--i:i<n.length&&!e.isStartIncluded&&n[i].isStartIncluded&&n[i].start.equals(e.start)&&++i;let o;for(i>0&&(o=ie.compare(n[i-1].stop,e.start),(o>0||o===0&&(n[i-1].isStopIncluded||e.isStartIncluded))&&((c(t)?t(n[i-1].data,e.data):n[i-1].data===e.data)?(ie.greaterThan(e.stop,n[i-1].stop)?e=new Ht({start:n[i-1].start,stop:e.stop,isStartIncluded:n[i-1].isStartIncluded,isStopIncluded:e.isStopIncluded,data:e.data}):e=new Ht({start:n[i-1].start,stop:n[i-1].stop,isStartIncluded:n[i-1].isStartIncluded,isStopIncluded:n[i-1].isStopIncluded||e.stop.equals(n[i-1].stop)&&e.isStopIncluded,data:e.data}),n.splice(i-1,1),--i):(o=ie.compare(n[i-1].stop,e.stop),(o>0||o===0&&n[i-1].isStopIncluded&&!e.isStopIncluded)&&n.splice(i,0,new Ht({start:e.stop,stop:n[i-1].stop,isStartIncluded:!e.isStopIncluded,isStopIncluded:n[i-1].isStopIncluded,data:n[i-1].data})),n[i-1]=new Ht({start:n[i-1].start,stop:e.start,isStartIncluded:n[i-1].isStartIncluded,isStopIncluded:!e.isStartIncluded,data:n[i-1].data}))));i<n.length&&(o=ie.compare(e.stop,n[i].start),o>0||o===0&&(e.isStopIncluded||n[i].isStartIncluded));)if(c(t)?t(n[i].data,e.data):n[i].data===e.data)e=new Ht({start:e.start,stop:ie.greaterThan(n[i].stop,e.stop)?n[i].stop:e.stop,isStartIncluded:e.isStartIncluded,isStopIncluded:ie.greaterThan(n[i].stop,e.stop)?n[i].isStopIncluded:e.isStopIncluded,data:e.data}),n.splice(i,1);else if(n[i]=new Ht({start:e.stop,stop:n[i].stop,isStartIncluded:!e.isStopIncluded,isStopIncluded:n[i].isStopIncluded,data:n[i].data}),n[i].isEmpty)n.splice(i,1);else break;n.splice(i,0,e),this._changedEvent.raiseEvent(this)};Ji.prototype.removeInterval=function(e){if(!c(e))throw new E("interval is required");if(e.isEmpty)return!1;const t=this._intervals;let n=Hr(t,e,XO);n<0&&(n=~n);let i=!1;for(n>0&&(ie.greaterThan(t[n-1].stop,e.start)||t[n-1].stop.equals(e.start)&&t[n-1].isStopIncluded&&e.isStartIncluded)&&(i=!0,(ie.greaterThan(t[n-1].stop,e.stop)||t[n-1].isStopIncluded&&!e.isStopIncluded&&t[n-1].stop.equals(e.stop))&&t.splice(n,0,new Ht({start:e.stop,stop:t[n-1].stop,isStartIncluded:!e.isStopIncluded,isStopIncluded:t[n-1].isStopIncluded,data:t[n-1].data})),t[n-1]=new Ht({start:t[n-1].start,stop:e.start,isStartIncluded:t[n-1].isStartIncluded,isStopIncluded:!e.isStartIncluded,data:t[n-1].data})),n<t.length&&!e.isStartIncluded&&t[n].isStartIncluded&&e.start.equals(t[n].start)&&(i=!0,t.splice(n,0,new Ht({start:t[n].start,stop:t[n].start,isStartIncluded:!0,isStopIncluded:!0,data:t[n].data})),++n);n<t.length&&ie.greaterThan(e.stop,t[n].stop);)i=!0,t.splice(n,1);return n<t.length&&e.stop.equals(t[n].stop)&&(i=!0,!e.isStopIncluded&&t[n].isStopIncluded?n+1<t.length&&t[n+1].start.equals(e.stop)&&t[n].data===t[n+1].data?(t.splice(n,1),t[n]=new Ht({start:t[n].start,stop:t[n].stop,isStartIncluded:!0,isStopIncluded:t[n].isStopIncluded,data:t[n].data})):t[n]=new Ht({start:e.stop,stop:e.stop,isStartIncluded:!0,isStopIncluded:!0,data:t[n].data}):t.splice(n,1)),n<t.length&&(ie.greaterThan(e.stop,t[n].start)||e.stop.equals(t[n].start)&&e.isStopIncluded&&t[n].isStartIncluded)&&(i=!0,t[n]=new Ht({start:e.stop,stop:t[n].stop,isStartIncluded:!e.isStopIncluded,isStopIncluded:t[n].isStopIncluded,data:t[n].data})),i&&this._changedEvent.raiseEvent(this),i};Ji.prototype.intersect=function(e,t,n){if(!c(e))throw new E("other is required.");const i=new Ji;let o=0,r=0;const s=this._intervals,a=e._intervals;for(;o<s.length&&r<a.length;){const l=s[o],u=a[r];if(ie.lessThan(l.stop,u.start))++o;else if(ie.lessThan(u.stop,l.start))++r;else{if(c(n)||c(t)&&t(l.data,u.data)||!c(t)&&u.data===l.data){const h=Ht.intersect(l,u,new Ht,n);h.isEmpty||i.addInterval(h,t)}ie.lessThan(l.stop,u.stop)||l.stop.equals(u.stop)&&!l.isStopIncluded&&u.isStopIncluded?++o:++r}}return i};Ji.fromJulianDateArray=function(e,t){if(!c(e))throw new E("options is required.");if(!c(e.julianDates))throw new E("options.iso8601Array is required.");c(t)||(t=new Ji);const n=e.julianDates,i=n.length,o=e.dataCallback,r=y(e.isStartIncluded,!0),s=y(e.isStopIncluded,!0),a=y(e.leadingInterval,!1),l=y(e.trailingInterval,!1);let u,h=0;a&&(++h,u=new Ht({start:Ke.MINIMUM_VALUE,stop:n[0],isStartIncluded:!0,isStopIncluded:!r}),u.data=c(o)?o(u,t.length):t.length,t.addInterval(u));for(let f=0;f<i-1;++f){let _=n[f];const g=n[f+1];u=new Ht({start:_,stop:g,isStartIncluded:t.length===h?r:!0,isStopIncluded:f===i-2?s:!1}),u.data=c(o)?o(u,t.length):t.length,t.addInterval(u),_=g}return l&&(u=new Ht({start:n[i-1],stop:Ke.MAXIMUM_VALUE,isStartIncluded:!s,isStopIncluded:!0}),u.data=c(o)?o(u,t.length):t.length,t.addInterval(u)),t};const Jr=new L0,jg=[0,31,28,31,30,31,30,31,31,30,31,30,31];function yD(e,t,n){c(n)||(n=new ie),ie.toGregorianDate(e,Jr);let i=Jr.millisecond+t.millisecond,o=Jr.second+t.second,r=Jr.minute+t.minute,s=Jr.hour+t.hour,a=Jr.day+t.day,l=Jr.month+t.month,u=Jr.year+t.year;for(i>=1e3&&(o+=Math.floor(i/1e3),i=i%1e3),o>=60&&(r+=Math.floor(o/60),o=o%60),r>=60&&(s+=Math.floor(r/60),r=r%60),s>=24&&(a+=Math.floor(s/24),s=s%24),jg[2]=$y(u)?29:28;a>jg[l]||l>=13;)a>jg[l]&&(a-=jg[l],++l),l>=13&&(--l,u+=Math.floor(l/12),l=l%12,++l),jg[2]=$y(u)?29:28;return Jr.millisecond=i,Jr.second=o,Jr.minute=r,Jr.hour=s,Jr.day=a,Jr.month=l,Jr.year=u,ie.fromGregorianDate(Jr,n)}const xve=new ie,Cve=/P(?:([\d.,]+)Y)?(?:([\d.,]+)M)?(?:([\d.,]+)W)?(?:([\d.,]+)D)?(?:T(?:([\d.,]+)H)?(?:([\d.,]+)M)?(?:([\d.,]+)S)?)?/;function dG(e,t){if(!c(e)||e.length===0)return!1;if(t.year=0,t.month=0,t.day=0,t.hour=0,t.minute=0,t.second=0,t.millisecond=0,e[0]==="P"){const n=e.match(Cve);if(!c(n))return!1;if(c(n[1])&&(t.year=Number(n[1].replace(",","."))),c(n[2])&&(t.month=Number(n[2].replace(",","."))),c(n[3])&&(t.day=Number(n[3].replace(",","."))*7),c(n[4])&&(t.day+=Number(n[4].replace(",","."))),c(n[5])&&(t.hour=Number(n[5].replace(",","."))),c(n[6])&&(t.minute=Number(n[6].replace(",","."))),c(n[7])){const i=Number(n[7].replace(",","."));t.second=Math.floor(i),t.millisecond=i%1*1e3}}else e[e.length-1]!=="Z"&&(e+="Z"),ie.toGregorianDate(ie.fromIso8601(e,xve),t);return t.year||t.month||t.day||t.hour||t.minute||t.second||t.millisecond}const Hy=new L0;Ji.fromIso8601=function(e,t){if(!c(e))throw new E("options is required.");if(!c(e.iso8601))throw new E("options.iso8601 is required.");const n=e.iso8601.split("/"),i=ie.fromIso8601(n[0]),o=ie.fromIso8601(n[1]),r=[];if(!dG(n[2],Hy))r.push(i,o);else{let s=ie.clone(i);for(r.push(s);ie.compare(s,o)<0;)s=yD(s,Hy),ie.compare(o,s)<=0&&ie.clone(o,s),r.push(s)}return Ji.fromJulianDateArray({julianDates:r,isStartIncluded:e.isStartIncluded,isStopIncluded:e.isStopIncluded,leadingInterval:e.leadingInterval,trailingInterval:e.trailingInterval,dataCallback:e.dataCallback},t)};Ji.fromIso8601DateArray=function(e,t){if(!c(e))throw new E("options is required.");if(!c(e.iso8601Dates))throw new E("options.iso8601Dates is required.");return Ji.fromJulianDateArray({julianDates:e.iso8601Dates.map(function(n){return ie.fromIso8601(n)}),isStartIncluded:e.isStartIncluded,isStopIncluded:e.isStopIncluded,leadingInterval:e.leadingInterval,trailingInterval:e.trailingInterval,dataCallback:e.dataCallback},t)};Ji.fromIso8601DurationArray=function(e,t){if(!c(e))throw new E("options is required.");if(!c(e.epoch))throw new E("options.epoch is required.");if(!c(e.iso8601Durations))throw new E("options.iso8601Durations is required.");const n=e.epoch,i=e.iso8601Durations,o=y(e.relativeToPrevious,!1),r=[];let s,a;const l=i.length;for(let u=0;u<l;++u)(dG(i[u],Hy)||u===0)&&(o&&c(a)?s=yD(a,Hy):s=yD(n,Hy),r.push(s),a=s);return Ji.fromJulianDateArray({julianDates:r,isStartIncluded:e.isStartIncluded,isStopIncluded:e.isStopIncluded,leadingInterval:e.leadingInterval,trailingInterval:e.trailingInterval,dataCallback:e.dataCallback},t)};function Eve(e,t,n,i){function o(){n.raiseEvent(e)}const r=[];t.removeAll();const s=i.length;for(let a=0;a<s;a++){const l=i.get(a);c(l.data)&&r.indexOf(l.data)===-1&&t.add(l.data.definitionChanged,o)}}function pp(){this._eventHelper=new Tu,this._definitionChanged=new Le,this._intervals=new Ji,this._intervals.changedEvent.addEventListener(pp.prototype._intervalsChanged,this)}Object.defineProperties(pp.prototype,{isConstant:{get:function(){return this._intervals.isEmpty}},definitionChanged:{get:function(){return this._definitionChanged}},intervals:{get:function(){return this._intervals}}});pp.prototype.getValue=function(e,t){if(!c(e))throw new E("time is required");const n=this._intervals.findDataForIntervalContainingDate(e);if(c(n))return n.getValue(e,t)};pp.prototype.equals=function(e){return this===e||e instanceof pp&&this._intervals.equals(e._intervals,K.equals)};pp.prototype._intervalsChanged=function(){Eve(this,this._eventHelper,this._definitionChanged,this._intervals),this._definitionChanged.raiseEvent(this)};function zh(e){this._referenceFrame=y(e,Bs.FIXED),this._definitionChanged=new Le,this._composite=new pp,this._composite.definitionChanged.addEventListener(zh.prototype._raiseDefinitionChanged,this)}Object.defineProperties(zh.prototype,{isConstant:{get:function(){return this._composite.isConstant}},definitionChanged:{get:function(){return this._definitionChanged}},intervals:{get:function(){return this._composite.intervals}},referenceFrame:{get:function(){return this._referenceFrame},set:function(e){this._referenceFrame=e}}});zh.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,Bs.FIXED,t)};zh.prototype.getValueInReferenceFrame=function(e,t,n){if(!c(e))throw new E("time is required.");if(!c(t))throw new E("referenceFrame is required.");const i=this._composite._intervals.findDataForIntervalContainingDate(e);if(c(i))return i.getValueInReferenceFrame(e,t,n)};zh.prototype.equals=function(e){return this===e||e instanceof zh&&this._referenceFrame===e._referenceFrame&&this._composite.equals(e._composite,K.equals)};zh.prototype._raiseDefinitionChanged=function(){this._definitionChanged.raiseEvent(this)};const wve={ROUNDED:0,MITERED:1,BEVELED:2},go=Object.freeze(wve),mr=[new d,new d],Sve=new d,vve=new d,Ive=new d,Dve=new d,Pve=new d,Ove=new d,Lve=new d,Rve=new d,Nve=new d,Vm=new d,DT=new d,T0={};let VS=new he;function Mve(e,t){const n=new Array(e.length);for(let i=0;i<e.length;i++){const o=e[i];VS=t.cartesianToCartographic(o,VS),n[i]=VS.height,e[i]=t.scaleToGeodeticSurface(o,o)}return n}function HS(e,t,n,i){const o=e[0],r=e[1],s=d.angleBetween(o,r),a=Math.ceil(s/i),l=new Array(a);let u;if(t===n){for(u=0;u<a;u++)l[u]=t;return l.push(n),l}const f=(n-t)/a;for(u=1;u<a;u++){const _=t+u*f;l[u]=_}return l[0]=t,l.push(n),l}const Xx=new d,Qx=new d;function Fve(e,t,n,i){const o=new Co(n,i),r=o.projectPointOntoPlane(d.add(n,e,Xx),Xx),s=o.projectPointOntoPlane(d.add(n,t,Qx),Qx),a=H.angleBetween(r,s);return s.x*r.y-s.y*r.x>=0?-a:a}const Bve=new d(-1,0,0);let vf=new L;const zve=new L;let GS=new $;const Uve=$.IDENTITY.clone(),kve=new d,Vve=new te,c2=new d;function ju(e,t,n,i,o,r,s,a){let l=kve,u=Vve;vf=zt.eastNorthUpToFixedFrame(e,o,vf),l=L.multiplyByPointAsVector(vf,Bve,l),l=d.normalize(l,l);const h=Fve(l,t,e,o);GS=$.fromRotationZ(h,GS),c2.z=r,vf=L.multiplyTransformation(vf,L.fromRotationTranslation(GS,c2,zve),vf);const f=Uve;f[0]=s;for(let _=0;_<a;_++)for(let g=0;g<n.length;g+=3)u=d.fromArray(n,g,u),u=$.multiplyByVector(f,u,u),u=L.multiplyByPoint(vf,u,u),i.push(u.x,u.y,u.z);return i}const Hve=new d;function jS(e,t,n,i,o,r,s){for(let a=0;a<e.length;a+=3){const l=d.fromArray(e,a,Hve);i=ju(l,t,n,i,o,r[a/3],s,1)}return i}function Gve(e,t){const n=e.length,i=new Array(n*6);let o=0;const r=t.x+t.width/2,s=t.y+t.height/2;let a=e[0];i[o++]=a.x-r,i[o++]=0,i[o++]=a.y-s;for(let l=1;l<n;l++){a=e[l];const u=a.x-r,h=a.y-s;i[o++]=u,i[o++]=0,i[o++]=h,i[o++]=u,i[o++]=0,i[o++]=h}return a=e[0],i[o++]=a.x-r,i[o++]=0,i[o++]=a.y-s,i}function l2(e,t){const n=e.length,i=new Array(n*3);let o=0;const r=t.x+t.width/2,s=t.y+t.height/2;for(let a=0;a<n;a++)i[o++]=e[a].x-r,i[o++]=0,i[o++]=e[a].y-s;return i}const u2=new _e,d2=new d,h2=new $;function f2(e,t,n,i,o,r,s,a,l,u){const h=d.angleBetween(d.subtract(t,e,Vm),d.subtract(n,e,DT)),f=i===go.BEVELED?0:Math.ceil(h/R.toRadians(5));let _;o?_=$.fromQuaternion(_e.fromAxisAngle(d.negate(e,Vm),h/(f+1),u2),h2):_=$.fromQuaternion(_e.fromAxisAngle(e,h/(f+1),u2),h2);let g,m;if(t=d.clone(t,d2),f>0){const b=u?2:1;for(let T=0;T<f;T++)t=$.multiplyByVector(_,t,t),g=d.subtract(t,e,Vm),g=d.normalize(g,g),o||(g=d.negate(g,g)),m=r.scaleToGeodeticSurface(t,DT),s=ju(m,g,a,s,r,l,1,b)}else g=d.subtract(t,e,Vm),g=d.normalize(g,g),o||(g=d.negate(g,g)),m=r.scaleToGeodeticSurface(t,DT),s=ju(m,g,a,s,r,l,1,1),n=d.clone(n,d2),g=d.subtract(n,e,Vm),g=d.normalize(g,g),o||(g=d.negate(g,g)),m=r.scaleToGeodeticSurface(n,DT),s=ju(m,g,a,s,r,l,1,1);return s}T0.removeDuplicatesFromShape=function(e){const t=e.length,n=[];for(let i=t-1,o=0;o<t;i=o++){const r=e[i],s=e[o];H.equals(r,s)||n.push(s)}return n};T0.angleIsGreaterThanPi=function(e,t,n,i){const o=new Co(n,i),r=o.projectPointOntoPlane(d.add(n,e,Xx),Xx),s=o.projectPointOntoPlane(d.add(n,t,Qx),Qx);return s.x*r.y-s.y*r.x>=0};const jve=new d,Wve=new d;T0.computePositions=function(e,t,n,i,o){const r=i._ellipsoid,s=Mve(e,r),a=i._granularity,l=i._cornerType,u=o?Gve(t,n):l2(t,n),h=o?l2(t,n):void 0,f=n.height/2,_=n.width/2;let g=e.length,m=[],b=o?[]:void 0,T=Sve,x=vve,C=Ive,w=Dve,v=Pve,P=Ove,N=Lve,k=Rve,M=Nve,U=e[0],B=e[1];w=r.geodeticSurfaceNormal(U,w),T=d.subtract(B,U,T),T=d.normalize(T,T),k=d.cross(w,T,k),k=d.normalize(k,k);let S=s[0],D=s[1];o&&(b=ju(U,k,h,b,r,S+f,1,1)),M=d.clone(U,M),U=B,x=d.negate(T,x);let p,I;for(let V=1;V<g-1;V++){const G=o?2:1;if(B=e[V+1],U.equals(B)){$n("Positions are too close and are considered equivalent with rounding error.");continue}T=d.subtract(B,U,T),T=d.normalize(T,T),C=d.add(T,x,C),C=d.normalize(C,C),w=r.geodeticSurfaceNormal(U,w);const j=d.multiplyByScalar(w,d.dot(T,w),jve);d.subtract(T,j,j),d.normalize(j,j);const W=d.multiplyByScalar(w,d.dot(x,w),Wve);if(d.subtract(x,W,W),d.normalize(W,W),!R.equalsEpsilon(Math.abs(d.dot(j,W)),1,R.EPSILON7)){C=d.cross(C,w,C),C=d.cross(w,C,C),C=d.normalize(C,C);const q=1/Math.max(.25,d.magnitude(d.cross(C,x,Vm))),ee=T0.angleIsGreaterThanPi(T,x,U,r);ee?(v=d.add(U,d.multiplyByScalar(C,q*_,C),v),P=d.add(v,d.multiplyByScalar(k,_,P),P),mr[0]=d.clone(M,mr[0]),mr[1]=d.clone(P,mr[1]),p=HS(mr,S+f,D+f,a),I=Io.generateArc({positions:mr,granularity:a,ellipsoid:r}),m=jS(I,k,u,m,r,p,1),k=d.cross(w,T,k),k=d.normalize(k,k),N=d.add(v,d.multiplyByScalar(k,_,N),N),l===go.ROUNDED||l===go.BEVELED?f2(v,P,N,l,ee,r,m,u,D+f,o):(C=d.negate(C,C),m=ju(U,C,u,m,r,D+f,q,G)),M=d.clone(N,M)):(v=d.add(U,d.multiplyByScalar(C,q*_,C),v),P=d.add(v,d.multiplyByScalar(k,-_,P),P),mr[0]=d.clone(M,mr[0]),mr[1]=d.clone(P,mr[1]),p=HS(mr,S+f,D+f,a),I=Io.generateArc({positions:mr,granularity:a,ellipsoid:r}),m=jS(I,k,u,m,r,p,1),k=d.cross(w,T,k),k=d.normalize(k,k),N=d.add(v,d.multiplyByScalar(k,-_,N),N),l===go.ROUNDED||l===go.BEVELED?f2(v,P,N,l,ee,r,m,u,D+f,o):m=ju(U,C,u,m,r,D+f,q,G),M=d.clone(N,M)),x=d.negate(T,x)}else m=ju(M,k,u,m,r,S+f,1,1),M=U;S=D,D=s[V+1],U=B}mr[0]=d.clone(M,mr[0]),mr[1]=d.clone(U,mr[1]),p=HS(mr,S+f,D+f,a),I=Io.generateArc({positions:mr,granularity:a,ellipsoid:r}),m=jS(I,k,u,m,r,p,1),o&&(b=ju(U,k,h,b,r,D+f,1,1)),g=m.length;const O=o?g+b.length:g,F=new Float64Array(O);return F.set(m),o&&F.set(b,g),F};const A0=T0,QO={},a_=new d,hG=new d,qve=new d,p2=new d,Ds=[new d,new d],fG=new d,pG=new d,mG=new d,Yve=new d,$ve=new d,Xve=new d,Qve=new d,Kve=new d,Zve=new d,Jve=new d,m2=new _e,_2=new $;function Kx(e,t,n,i,o){const r=d.angleBetween(d.subtract(t,e,a_),d.subtract(n,e,hG)),s=i===go.BEVELED?1:Math.ceil(r/R.toRadians(5))+1,a=s*3,l=new Array(a);l[a-3]=n.x,l[a-2]=n.y,l[a-1]=n.z;let u;o?u=$.fromQuaternion(_e.fromAxisAngle(d.negate(e,a_),r/s,m2),_2):u=$.fromQuaternion(_e.fromAxisAngle(e,r/s,m2),_2);let h=0;t=d.clone(t,a_);for(let f=0;f<s;f++)t=$.multiplyByVector(u,t,t),l[h++]=t.x,l[h++]=t.y,l[h++]=t.z;return l}function eIe(e){let t=fG,n=pG,i=mG,o=e[1];n=d.fromArray(e[1],o.length-3,n),i=d.fromArray(e[0],0,i),t=d.midpoint(n,i,t);const r=Kx(t,n,i,go.ROUNDED,!1),s=e.length-1,a=e[s-1];o=e[s],n=d.fromArray(a,a.length-3,n),i=d.fromArray(o,0,i),t=d.midpoint(n,i,t);const l=Kx(t,n,i,go.ROUNDED,!1);return[r,l]}function g2(e,t,n,i){let o=a_;return i||(t=d.negate(t,t)),o=d.add(e,t,o),[o.x,o.y,o.z,n.x,n.y,n.z]}function WS(e,t,n,i){const o=new Array(e.length),r=new Array(e.length),s=d.multiplyByScalar(t,n,a_),a=d.negate(s,hG);let l=0,u=e.length-1;for(let h=0;h<e.length;h+=3){const f=d.fromArray(e,h,qve),_=d.add(f,a,p2);o[l++]=_.x,o[l++]=_.y,o[l++]=_.z;const g=d.add(f,s,p2);r[u--]=g.z,r[u--]=g.y,r[u--]=g.x}return i.push(o,r),i}QO.addAttribute=function(e,t,n,i){const o=t.x,r=t.y,s=t.z;c(n)&&(e[n]=o,e[n+1]=r,e[n+2]=s),c(i)&&(e[i]=s,e[i-1]=r,e[i-2]=o)};const tIe=new d,nIe=new d;QO.computePositions=function(e){const t=e.granularity,n=e.positions,i=e.ellipsoid,o=e.width/2,r=e.cornerType,s=e.saveAttributes;let a=fG,l=pG,u=mG,h=Yve,f=$ve,_=Xve,g=Qve,m=Kve,b=Zve,T=Jve,x=[];const C=s?[]:void 0,w=s?[]:void 0;let v=n[0],P=n[1];l=d.normalize(d.subtract(P,v,l),l),a=i.geodeticSurfaceNormal(v,a),h=d.normalize(d.cross(a,l,h),h),s&&(C.push(h.x,h.y,h.z),w.push(a.x,a.y,a.z)),g=d.clone(v,g),v=P,u=d.negate(l,u);let N;const k=[];let M;const U=n.length;for(M=1;M<U-1;M++){a=i.geodeticSurfaceNormal(v,a),P=n[M+1],l=d.normalize(d.subtract(P,v,l),l),f=d.normalize(d.add(l,u,f),f);const S=d.multiplyByScalar(a,d.dot(l,a),tIe);d.subtract(l,S,S),d.normalize(S,S);const D=d.multiplyByScalar(a,d.dot(u,a),nIe);if(d.subtract(u,D,D),d.normalize(D,D),!R.equalsEpsilon(Math.abs(d.dot(S,D)),1,R.EPSILON7)){f=d.cross(f,a,f),f=d.cross(a,f,f),f=d.normalize(f,f);const I=o/Math.max(.25,d.magnitude(d.cross(f,u,a_))),O=A0.angleIsGreaterThanPi(l,u,v,i);f=d.multiplyByScalar(f,I,f),O?(m=d.add(v,f,m),T=d.add(m,d.multiplyByScalar(h,o,T),T),b=d.add(m,d.multiplyByScalar(h,o*2,b),b),Ds[0]=d.clone(g,Ds[0]),Ds[1]=d.clone(T,Ds[1]),N=Io.generateArc({positions:Ds,granularity:t,ellipsoid:i}),x=WS(N,h,o,x),s&&(C.push(h.x,h.y,h.z),w.push(a.x,a.y,a.z)),_=d.clone(b,_),h=d.normalize(d.cross(a,l,h),h),b=d.add(m,d.multiplyByScalar(h,o*2,b),b),g=d.add(m,d.multiplyByScalar(h,o,g),g),r===go.ROUNDED||r===go.BEVELED?k.push({leftPositions:Kx(m,_,b,r,O)}):k.push({leftPositions:g2(v,d.negate(f,f),b,O)})):(b=d.add(v,f,b),T=d.add(b,d.negate(d.multiplyByScalar(h,o,T),T),T),m=d.add(b,d.negate(d.multiplyByScalar(h,o*2,m),m),m),Ds[0]=d.clone(g,Ds[0]),Ds[1]=d.clone(T,Ds[1]),N=Io.generateArc({positions:Ds,granularity:t,ellipsoid:i}),x=WS(N,h,o,x),s&&(C.push(h.x,h.y,h.z),w.push(a.x,a.y,a.z)),_=d.clone(m,_),h=d.normalize(d.cross(a,l,h),h),m=d.add(b,d.negate(d.multiplyByScalar(h,o*2,m),m),m),g=d.add(b,d.negate(d.multiplyByScalar(h,o,g),g),g),r===go.ROUNDED||r===go.BEVELED?k.push({rightPositions:Kx(b,_,m,r,O)}):k.push({rightPositions:g2(v,f,m,O)})),u=d.negate(l,u)}v=P}a=i.geodeticSurfaceNormal(v,a),Ds[0]=d.clone(g,Ds[0]),Ds[1]=d.clone(v,Ds[1]),N=Io.generateArc({positions:Ds,granularity:t,ellipsoid:i}),x=WS(N,h,o,x),s&&(C.push(h.x,h.y,h.z),w.push(a.x,a.y,a.z));let B;return r===go.ROUNDED&&(B=eIe(x)),{positions:x,corners:k,lefts:C,normals:w,endPositions:B}};const Qn=QO,_G=new d,gG=new d,KA=new d,ZA=new d,iIe=new d,yG=new d,rh=new d,bm=new d;function bG(e,t){for(let n=0;n<e.length;n++)e[n]=t.scaleToGeodeticSurface(e[n],e[n]);return e}function Qc(e,t,n,i,o,r){const s=e.normals,a=e.tangents,l=e.bitangents,u=d.normalize(d.cross(n,t,rh),rh);r.normal&&Qn.addAttribute(s,t,i,o),r.tangent&&Qn.addAttribute(a,u,i,o),r.bitangent&&Qn.addAttribute(l,n,i,o)}function TG(e,t,n){const i=e.positions,o=e.corners,r=e.endPositions,s=e.lefts,a=e.normals,l=new oi;let u,h=0,f=0,_,g=0,m;for(_=0;_<i.length;_+=2)m=i[_].length-3,h+=m,g+=m*2,f+=i[_+1].length-3;for(h+=3,f+=3,_=0;_<o.length;_++){u=o[_];const Q=o[_].leftPositions;c(Q)?(m=Q.length,h+=m,g+=m):(m=o[_].rightPositions.length,f+=m,g+=m)}const b=c(r);let T;b&&(T=r[0].length-3,h+=T,f+=T,T/=3,g+=T*6);const x=h+f,C=new Float64Array(x),w=t.normal?new Float32Array(x):void 0,v=t.tangent?new Float32Array(x):void 0,P=t.bitangent?new Float32Array(x):void 0,N={normals:w,tangents:v,bitangents:P};let k=0,M=x-1,U,B,S,D,p=_G,I=gG,O,F;const V=T/2,G=je.createTypedArray(x/3,g);let j=0;if(b){F=KA,O=ZA;const Q=r[0];for(p=d.fromArray(a,0,p),I=d.fromArray(s,0,I),_=0;_<V;_++)F=d.fromArray(Q,(V-1-_)*3,F),O=d.fromArray(Q,(V+_)*3,O),Qn.addAttribute(C,O,k),Qn.addAttribute(C,F,void 0,M),Qc(N,p,I,k,M,t),B=k/3,D=B+1,U=(M-2)/3,S=U-1,G[j++]=U,G[j++]=B,G[j++]=S,G[j++]=S,G[j++]=B,G[j++]=D,k+=3,M-=3}let W=0,X=0,q=i[W++],ee=i[W++];C.set(q,k),C.set(ee,M-ee.length+1),I=d.fromArray(s,X,I);let Y,ne;for(m=ee.length-3,_=0;_<m;_+=3)Y=n.geodeticSurfaceNormal(d.fromArray(q,_,rh),rh),ne=n.geodeticSurfaceNormal(d.fromArray(ee,m-_,bm),bm),p=d.normalize(d.add(Y,ne,p),p),Qc(N,p,I,k,M,t),B=k/3,D=B+1,U=(M-2)/3,S=U-1,G[j++]=U,G[j++]=B,G[j++]=S,G[j++]=S,G[j++]=B,G[j++]=D,k+=3,M-=3;for(Y=n.geodeticSurfaceNormal(d.fromArray(q,m,rh),rh),ne=n.geodeticSurfaceNormal(d.fromArray(ee,m,bm),bm),p=d.normalize(d.add(Y,ne,p),p),X+=3,_=0;_<o.length;_++){let Q;u=o[_];const le=u.leftPositions,pe=u.rightPositions;let re,de,fe=yG,ye=KA,Ce=ZA;if(p=d.fromArray(a,X,p),c(le)){for(Qc(N,p,I,void 0,M,t),M-=3,re=D,de=S,Q=0;Q<le.length/3;Q++)fe=d.fromArray(le,Q*3,fe),G[j++]=re,G[j++]=de-Q-1,G[j++]=de-Q,Qn.addAttribute(C,fe,void 0,M),ye=d.fromArray(C,(de-Q-1)*3,ye),Ce=d.fromArray(C,re*3,Ce),I=d.normalize(d.subtract(ye,Ce,I),I),Qc(N,p,I,void 0,M,t),M-=3;fe=d.fromArray(C,re*3,fe),ye=d.subtract(d.fromArray(C,de*3,ye),fe,ye),Ce=d.subtract(d.fromArray(C,(de-Q)*3,Ce),fe,Ce),I=d.normalize(d.add(ye,Ce,I),I),Qc(N,p,I,k,void 0,t),k+=3}else{for(Qc(N,p,I,k,void 0,t),k+=3,re=S,de=D,Q=0;Q<pe.length/3;Q++)fe=d.fromArray(pe,Q*3,fe),G[j++]=re,G[j++]=de+Q,G[j++]=de+Q+1,Qn.addAttribute(C,fe,k),ye=d.fromArray(C,re*3,ye),Ce=d.fromArray(C,(de+Q)*3,Ce),I=d.normalize(d.subtract(ye,Ce,I),I),Qc(N,p,I,k,void 0,t),k+=3;fe=d.fromArray(C,re*3,fe),ye=d.subtract(d.fromArray(C,(de+Q)*3,ye),fe,ye),Ce=d.subtract(d.fromArray(C,de*3,Ce),fe,Ce),I=d.normalize(d.negate(d.add(Ce,ye,I),I),I),Qc(N,p,I,void 0,M,t),M-=3}for(q=i[W++],ee=i[W++],q.splice(0,3),ee.splice(ee.length-3,3),C.set(q,k),C.set(ee,M-ee.length+1),m=ee.length-3,X+=3,I=d.fromArray(s,X,I),Q=0;Q<ee.length;Q+=3)Y=n.geodeticSurfaceNormal(d.fromArray(q,Q,rh),rh),ne=n.geodeticSurfaceNormal(d.fromArray(ee,m-Q,bm),bm),p=d.normalize(d.add(Y,ne,p),p),Qc(N,p,I,k,M,t),D=k/3,B=D-1,S=(M-2)/3,U=S+1,G[j++]=U,G[j++]=B,G[j++]=S,G[j++]=S,G[j++]=B,G[j++]=D,k+=3,M-=3;k-=3,M+=3}if(p=d.fromArray(a,a.length-3,p),Qc(N,p,I,k,M,t),b){k+=3,M-=3,F=KA,O=ZA;const Q=r[1];for(_=0;_<V;_++)F=d.fromArray(Q,(T-_-1)*3,F),O=d.fromArray(Q,_*3,O),Qn.addAttribute(C,F,void 0,M),Qn.addAttribute(C,O,k),Qc(N,p,I,k,M,t),D=k/3,B=D-1,S=(M-2)/3,U=S+1,G[j++]=U,G[j++]=B,G[j++]=S,G[j++]=S,G[j++]=B,G[j++]=D,k+=3,M-=3}if(l.position=new Ie({componentDatatype:Z.DOUBLE,componentsPerAttribute:3,values:C}),t.st){const Q=new Float32Array(x/3*2);let le,pe,re=0;if(b){h/=3,f/=3;const de=Math.PI/(T+1);pe=1/(h-T+1),le=1/(f-T+1);let fe;const ye=T/2;for(_=ye+1;_<T+1;_++)fe=R.PI_OVER_TWO+de*_,Q[re++]=le*(1+Math.cos(fe)),Q[re++]=.5*(1+Math.sin(fe));for(_=1;_<f-T+1;_++)Q[re++]=_*le,Q[re++]=0;for(_=T;_>ye;_--)fe=R.PI_OVER_TWO-_*de,Q[re++]=1-le*(1+Math.cos(fe)),Q[re++]=.5*(1+Math.sin(fe));for(_=ye;_>0;_--)fe=R.PI_OVER_TWO-de*_,Q[re++]=1-pe*(1+Math.cos(fe)),Q[re++]=.5*(1+Math.sin(fe));for(_=h-T;_>0;_--)Q[re++]=_*pe,Q[re++]=1;for(_=1;_<ye+1;_++)fe=R.PI_OVER_TWO+de*_,Q[re++]=pe*(1+Math.cos(fe)),Q[re++]=.5*(1+Math.sin(fe))}else{for(h/=3,f/=3,pe=1/(h-1),le=1/(f-1),_=0;_<f;_++)Q[re++]=_*le,Q[re++]=0;for(_=h;_>0;_--)Q[re++]=(_-1)*pe,Q[re++]=1}l.st=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:2,values:Q})}return t.normal&&(l.normal=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:3,values:N.normals})),t.tangent&&(l.tangent=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:3,values:N.tangents})),t.bitangent&&(l.bitangent=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:3,values:N.bitangents})),{attributes:l,indices:G}}function oIe(e,t){if(!t.normal&&!t.tangent&&!t.bitangent&&!t.st)return e;const n=e.position.values;let i,o;(t.normal||t.bitangent)&&(i=e.normal.values,o=e.bitangent.values);const r=e.position.values.length/18,s=r*3,a=r*2,l=s*2;let u;if(t.normal||t.bitangent||t.tangent){const h=t.normal?new Float32Array(s*6):void 0,f=t.tangent?new Float32Array(s*6):void 0,_=t.bitangent?new Float32Array(s*6):void 0;let g=_G,m=gG,b=KA,T=ZA,x=iIe,C=yG,w=l;for(u=0;u<s;u+=3){const v=w+l;g=d.fromArray(n,u,g),m=d.fromArray(n,u+s,m),b=d.fromArray(n,(u+3)%s,b),m=d.subtract(m,g,m),b=d.subtract(b,g,b),T=d.normalize(d.cross(m,b,T),T),t.normal&&(Qn.addAttribute(h,T,v),Qn.addAttribute(h,T,v+3),Qn.addAttribute(h,T,w),Qn.addAttribute(h,T,w+3)),(t.tangent||t.bitangent)&&(C=d.fromArray(i,u,C),t.bitangent&&(Qn.addAttribute(_,C,v),Qn.addAttribute(_,C,v+3),Qn.addAttribute(_,C,w),Qn.addAttribute(_,C,w+3)),t.tangent&&(x=d.normalize(d.cross(C,T,x),x),Qn.addAttribute(f,x,v),Qn.addAttribute(f,x,v+3),Qn.addAttribute(f,x,w),Qn.addAttribute(f,x,w+3))),w+=6}if(t.normal){for(h.set(i),u=0;u<s;u+=3)h[u+s]=-i[u],h[u+s+1]=-i[u+1],h[u+s+2]=-i[u+2];e.normal.values=h}else e.normal=void 0;if(t.bitangent?(_.set(o),_.set(o,s),e.bitangent.values=_):e.bitangent=void 0,t.tangent){const v=e.tangent.values;f.set(v),f.set(v,s),e.tangent.values=f}}if(t.st){const h=e.st.values,f=new Float32Array(a*6);f.set(h),f.set(h,a);let _=a*2;for(let g=0;g<2;g++){for(f[_++]=h[0],f[_++]=h[1],u=2;u<a;u+=2){const m=h[u],b=h[u+1];f[_++]=m,f[_++]=b,f[_++]=m,f[_++]=b}f[_++]=h[0],f[_++]=h[1]}e.st.values=f}return e}function qS(e,t,n){n[t++]=e[0],n[t++]=e[1],n[t++]=e[2];for(let i=3;i<e.length;i+=3){const o=e[i],r=e[i+1],s=e[i+2];n[t++]=o,n[t++]=r,n[t++]=s,n[t++]=o,n[t++]=r,n[t++]=s}return n[t++]=e[0],n[t++]=e[1],n[t++]=e[2],n}function rIe(e,t){const n=new Ee({position:t.position,normal:t.normal||t.bitangent||e.shadowVolume,tangent:t.tangent,bitangent:t.normal||t.bitangent,st:t.st}),i=e.ellipsoid,o=Qn.computePositions(e),r=TG(o,n,i),s=e.height,a=e.extrudedHeight;let l=r.attributes;const u=r.indices;let h=l.position.values,f=h.length;const _=new Float64Array(f*6);let g=new Float64Array(f);g.set(h);let m=new Float64Array(f*4);h=ai.scaleToGeodeticHeight(h,s,i),m=qS(h,0,m),g=ai.scaleToGeodeticHeight(g,a,i),m=qS(g,f*2,m),_.set(h),_.set(g,f),_.set(m,f*2),l.position.values=_,l=oIe(l,t);let b;const T=f/3;if(e.shadowVolume){const U=l.normal.values;f=U.length;let B=new Float32Array(f*6);for(b=0;b<f;b++)U[b]=-U[b];B.set(U,f),B=qS(U,f*4,B),l.extrudeDirection=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:3,values:B}),t.normal||(l.normal=void 0)}if(c(e.offsetAttribute)){let U=new Uint8Array(T*6);if(e.offsetAttribute===Kt.TOP)U=U.fill(1,0,T).fill(1,T*2,T*4);else{const B=e.offsetAttribute===Kt.NONE?0:1;U=U.fill(B)}l.applyOffset=new Ie({componentDatatype:Z.UNSIGNED_BYTE,componentsPerAttribute:1,values:U})}const x=u.length,C=T+T,w=je.createTypedArray(_.length/3,x*2+C*3);w.set(u);let v=x;for(b=0;b<x;b+=3){const U=u[b],B=u[b+1],S=u[b+2];w[v++]=S+T,w[v++]=B+T,w[v++]=U+T}let P,N,k,M;for(b=0;b<C;b+=2)P=b+C,N=P+C,k=P+1,M=N+1,w[v++]=P,w[v++]=N,w[v++]=k,w[v++]=k,w[v++]=N,w[v++]=M;return{attributes:l,indices:w}}const y2=new d,Wg=new d,dc=new he;function b2(e,t,n,i,o,r){const s=d.subtract(t,e,y2);d.normalize(s,s);const a=n.geodeticSurfaceNormal(e,Wg),l=d.cross(s,a,y2);d.multiplyByScalar(l,i,l);let u=o.latitude,h=o.longitude,f=r.latitude,_=r.longitude;d.add(e,l,Wg),n.cartesianToCartographic(Wg,dc);let g=dc.latitude,m=dc.longitude;u=Math.min(u,g),h=Math.min(h,m),f=Math.max(f,g),_=Math.max(_,m),d.subtract(e,l,Wg),n.cartesianToCartographic(Wg,dc),g=dc.latitude,m=dc.longitude,u=Math.min(u,g),h=Math.min(h,m),f=Math.max(f,g),_=Math.max(_,m),o.latitude=u,o.longitude=h,r.latitude=f,r.longitude=_}const nc=new d,qg=new d,Qs=new he,Ks=new he;function AG(e,t,n,i,o){e=bG(e,t);const r=gs(e,d.equalsEpsilon),s=r.length;if(s<2||n<=0)return new ce;const a=n*.5;Qs.latitude=Number.POSITIVE_INFINITY,Qs.longitude=Number.POSITIVE_INFINITY,Ks.latitude=Number.NEGATIVE_INFINITY,Ks.longitude=Number.NEGATIVE_INFINITY;let l,u;if(i===go.ROUNDED){const _=r[0];d.subtract(_,r[1],nc),d.normalize(nc,nc),d.multiplyByScalar(nc,a,nc),d.add(_,nc,qg),t.cartesianToCartographic(qg,dc),l=dc.latitude,u=dc.longitude,Qs.latitude=Math.min(Qs.latitude,l),Qs.longitude=Math.min(Qs.longitude,u),Ks.latitude=Math.max(Ks.latitude,l),Ks.longitude=Math.max(Ks.longitude,u)}for(let _=0;_<s-1;++_)b2(r[_],r[_+1],t,a,Qs,Ks);const h=r[s-1];d.subtract(h,r[s-2],nc),d.normalize(nc,nc),d.multiplyByScalar(nc,a,nc),d.add(h,nc,qg),b2(h,qg,t,a,Qs,Ks),i===go.ROUNDED&&(t.cartesianToCartographic(qg,dc),l=dc.latitude,u=dc.longitude,Qs.latitude=Math.min(Qs.latitude,l),Qs.longitude=Math.min(Qs.longitude,u),Ks.latitude=Math.max(Ks.latitude,l),Ks.longitude=Math.max(Ks.longitude,u));const f=c(o)?o:new ce;return f.north=Ks.latitude,f.south=Qs.latitude,f.east=Ks.longitude,f.west=Qs.longitude,f}function xl(e){e=y(e,y.EMPTY_OBJECT);const t=e.positions,n=e.width;A.defined("options.positions",t),A.defined("options.width",n);const i=y(e.height,0),o=y(e.extrudedHeight,i);this._positions=t,this._ellipsoid=ae.clone(y(e.ellipsoid,ae.WGS84)),this._vertexFormat=Ee.clone(y(e.vertexFormat,Ee.DEFAULT)),this._width=n,this._height=Math.max(i,o),this._extrudedHeight=Math.min(i,o),this._cornerType=y(e.cornerType,go.ROUNDED),this._granularity=y(e.granularity,R.RADIANS_PER_DEGREE),this._shadowVolume=y(e.shadowVolume,!1),this._workerName="createCorridorGeometry",this._offsetAttribute=e.offsetAttribute,this._rectangle=void 0,this.packedLength=1+t.length*d.packedLength+ae.packedLength+Ee.packedLength+7}xl.pack=function(e,t,n){A.defined("value",e),A.defined("array",t),n=y(n,0);const i=e._positions,o=i.length;t[n++]=o;for(let r=0;r<o;++r,n+=d.packedLength)d.pack(i[r],t,n);return ae.pack(e._ellipsoid,t,n),n+=ae.packedLength,Ee.pack(e._vertexFormat,t,n),n+=Ee.packedLength,t[n++]=e._width,t[n++]=e._height,t[n++]=e._extrudedHeight,t[n++]=e._cornerType,t[n++]=e._granularity,t[n++]=e._shadowVolume?1:0,t[n]=y(e._offsetAttribute,-1),t};const xG=ae.clone(ae.UNIT_SPHERE),CG=new Ee,Ru={positions:void 0,ellipsoid:xG,vertexFormat:CG,width:void 0,height:void 0,extrudedHeight:void 0,cornerType:void 0,granularity:void 0,shadowVolume:void 0,offsetAttribute:void 0};xl.unpack=function(e,t,n){A.defined("array",e),t=y(t,0);const i=e[t++],o=new Array(i);for(let m=0;m<i;++m,t+=d.packedLength)o[m]=d.unpack(e,t);const r=ae.unpack(e,t,xG);t+=ae.packedLength;const s=Ee.unpack(e,t,CG);t+=Ee.packedLength;const a=e[t++],l=e[t++],u=e[t++],h=e[t++],f=e[t++],_=e[t++]===1,g=e[t];return c(n)?(n._positions=o,n._ellipsoid=ae.clone(r,n._ellipsoid),n._vertexFormat=Ee.clone(s,n._vertexFormat),n._width=a,n._height=l,n._extrudedHeight=u,n._cornerType=h,n._granularity=f,n._shadowVolume=_,n._offsetAttribute=g===-1?void 0:g,n):(Ru.positions=o,Ru.width=a,Ru.height=l,Ru.extrudedHeight=u,Ru.cornerType=h,Ru.granularity=f,Ru.shadowVolume=_,Ru.offsetAttribute=g===-1?void 0:g,new xl(Ru))};xl.computeRectangle=function(e,t){e=y(e,y.EMPTY_OBJECT);const n=e.positions,i=e.width;A.defined("options.positions",n),A.defined("options.width",i);const o=y(e.ellipsoid,ae.WGS84),r=y(e.cornerType,go.ROUNDED);return AG(n,o,i,r,t)};xl.createGeometry=function(e){let t=e._positions;const n=e._width,i=e._ellipsoid;t=bG(t,i);const o=gs(t,d.equalsEpsilon);if(o.length<2||n<=0)return;const r=e._height,s=e._extrudedHeight,a=!R.equalsEpsilon(r,s,0,R.EPSILON2),l=e._vertexFormat,u={ellipsoid:i,positions:o,width:n,cornerType:e._cornerType,granularity:e._granularity,saveAttributes:!0};let h;if(a)u.height=r,u.extrudedHeight=s,u.shadowVolume=e._shadowVolume,u.offsetAttribute=e._offsetAttribute,h=rIe(u,l);else{const g=Qn.computePositions(u);if(h=TG(g,l,i),h.attributes.position.values=ai.scaleToGeodeticHeight(h.attributes.position.values,r,i),c(e._offsetAttribute)){const m=e._offsetAttribute===Kt.NONE?0:1,b=h.attributes.position.values.length,T=new Uint8Array(b/3).fill(m);h.attributes.applyOffset=new Ie({componentDatatype:Z.UNSIGNED_BYTE,componentsPerAttribute:1,values:T})}}const f=h.attributes,_=se.fromVertices(f.position.values,void 0,3);return l.position||(h.attributes.position.values=void 0),new Tt({attributes:f,indices:h.indices,primitiveType:ze.TRIANGLES,boundingSphere:_,offsetAttribute:e._offsetAttribute})};xl.createShadowVolume=function(e,t,n){const i=e._granularity,o=e._ellipsoid,r=t(i,o),s=n(i,o);return new xl({positions:e._positions,width:e._width,cornerType:e._cornerType,ellipsoid:o,granularity:i,extrudedHeight:r,height:s,vertexFormat:Ee.POSITION_ONLY,shadowVolume:!0})};Object.defineProperties(xl.prototype,{rectangle:{get:function(){return c(this._rectangle)||(this._rectangle=AG(this._positions,this._ellipsoid,this._width,this._cornerType)),this._rectangle}},textureCoordinateRotationPoints:{get:function(){return[0,0,0,1,1,0]}}});const T2=new d,A2=new d,sIe=new d;function aIe(e,t){for(let n=0;n<e.length;n++)e[n]=t.scaleToGeodeticSurface(e[n],e[n]);return e}function EG(e,t){const n=[],i=e.positions,o=e.corners,r=e.endPositions,s=new oi;let a,l=0,u=0,h,f=0,_;for(h=0;h<i.length;h+=2)_=i[h].length-3,l+=_,f+=_/3*4,u+=i[h+1].length-3;for(l+=3,u+=3,h=0;h<o.length;h++){a=o[h];const O=o[h].leftPositions;c(O)?(_=O.length,l+=_,f+=_/3*2):(_=o[h].rightPositions.length,u+=_,f+=_/3*2)}const g=c(r);let m;g&&(m=r[0].length-3,l+=m,u+=m,m/=3,f+=m*4);const b=l+u,T=new Float64Array(b);let x=0,C=b-1,w,v,P,N,k,M;const U=m/2,B=je.createTypedArray(b/3,f+4);let S=0;if(B[S++]=x/3,B[S++]=(C-2)/3,g){n.push(x/3),M=T2,k=A2;const O=r[0];for(h=0;h<U;h++)M=d.fromArray(O,(U-1-h)*3,M),k=d.fromArray(O,(U+h)*3,k),Qn.addAttribute(T,k,x),Qn.addAttribute(T,M,void 0,C),v=x/3,N=v+1,w=(C-2)/3,P=w-1,B[S++]=w,B[S++]=P,B[S++]=v,B[S++]=N,x+=3,C-=3}let D=0,p=i[D++],I=i[D++];for(T.set(p,x),T.set(I,C-I.length+1),_=I.length-3,n.push(x/3,(C-2)/3),h=0;h<_;h+=3)v=x/3,N=v+1,w=(C-2)/3,P=w-1,B[S++]=w,B[S++]=P,B[S++]=v,B[S++]=N,x+=3,C-=3;for(h=0;h<o.length;h++){let O;a=o[h];const F=a.leftPositions,V=a.rightPositions;let G,j=sIe;if(c(F)){for(C-=3,G=P,n.push(N),O=0;O<F.length/3;O++)j=d.fromArray(F,O*3,j),B[S++]=G-O-1,B[S++]=G-O,Qn.addAttribute(T,j,void 0,C),C-=3;n.push(G-Math.floor(F.length/6)),t===go.BEVELED&&n.push((C-2)/3+1),x+=3}else{for(x+=3,G=N,n.push(P),O=0;O<V.length/3;O++)j=d.fromArray(V,O*3,j),B[S++]=G+O,B[S++]=G+O+1,Qn.addAttribute(T,j,x),x+=3;n.push(G+Math.floor(V.length/6)),t===go.BEVELED&&n.push(x/3-1),C-=3}for(p=i[D++],I=i[D++],p.splice(0,3),I.splice(I.length-3,3),T.set(p,x),T.set(I,C-I.length+1),_=I.length-3,O=0;O<I.length;O+=3)N=x/3,v=N-1,P=(C-2)/3,w=P+1,B[S++]=w,B[S++]=P,B[S++]=v,B[S++]=N,x+=3,C-=3;x-=3,C+=3,n.push(x/3,(C-2)/3)}if(g){x+=3,C-=3,M=T2,k=A2;const O=r[1];for(h=0;h<U;h++)M=d.fromArray(O,(m-h-1)*3,M),k=d.fromArray(O,h*3,k),Qn.addAttribute(T,M,void 0,C),Qn.addAttribute(T,k,x),N=x/3,v=N-1,P=(C-2)/3,w=P+1,B[S++]=w,B[S++]=P,B[S++]=v,B[S++]=N,x+=3,C-=3;n.push(x/3)}else n.push(x/3,(C-2)/3);return B[S++]=x/3,B[S++]=(C-2)/3,s.position=new Ie({componentDatatype:Z.DOUBLE,componentsPerAttribute:3,values:T}),{attributes:s,indices:B,wallIndices:n}}function cIe(e){const t=e.ellipsoid,n=Qn.computePositions(e),i=EG(n,e.cornerType),o=i.wallIndices,r=e.height,s=e.extrudedHeight,a=i.attributes,l=i.indices;let u=a.position.values,h=u.length,f=new Float64Array(h);f.set(u);const _=new Float64Array(h*2);if(u=ai.scaleToGeodeticHeight(u,r,t),f=ai.scaleToGeodeticHeight(f,s,t),_.set(u),_.set(f,h),a.position.values=_,h/=3,c(e.offsetAttribute)){let w=new Uint8Array(h*2);if(e.offsetAttribute===Kt.TOP)w=w.fill(1,0,h);else{const v=e.offsetAttribute===Kt.NONE?0:1;w=w.fill(v)}a.applyOffset=new Ie({componentDatatype:Z.UNSIGNED_BYTE,componentsPerAttribute:1,values:w})}let g;const m=l.length,b=je.createTypedArray(_.length/3,(m+o.length)*2);b.set(l);let T=m;for(g=0;g<m;g+=2){const w=l[g],v=l[g+1];b[T++]=w+h,b[T++]=v+h}let x,C;for(g=0;g<o.length;g++)x=o[g],C=x+h,b[T++]=x,b[T++]=C;return{attributes:a,indices:b}}function x0(e){e=y(e,y.EMPTY_OBJECT);const t=e.positions,n=e.width;A.typeOf.object("options.positions",t),A.typeOf.number("options.width",n);const i=y(e.height,0),o=y(e.extrudedHeight,i);this._positions=t,this._ellipsoid=ae.clone(y(e.ellipsoid,ae.WGS84)),this._width=n,this._height=Math.max(i,o),this._extrudedHeight=Math.min(i,o),this._cornerType=y(e.cornerType,go.ROUNDED),this._granularity=y(e.granularity,R.RADIANS_PER_DEGREE),this._offsetAttribute=e.offsetAttribute,this._workerName="createCorridorOutlineGeometry",this.packedLength=1+t.length*d.packedLength+ae.packedLength+6}x0.pack=function(e,t,n){A.typeOf.object("value",e),A.typeOf.object("array",t),n=y(n,0);const i=e._positions,o=i.length;t[n++]=o;for(let r=0;r<o;++r,n+=d.packedLength)d.pack(i[r],t,n);return ae.pack(e._ellipsoid,t,n),n+=ae.packedLength,t[n++]=e._width,t[n++]=e._height,t[n++]=e._extrudedHeight,t[n++]=e._cornerType,t[n++]=e._granularity,t[n]=y(e._offsetAttribute,-1),t};const wG=ae.clone(ae.UNIT_SPHERE),Wd={positions:void 0,ellipsoid:wG,width:void 0,height:void 0,extrudedHeight:void 0,cornerType:void 0,granularity:void 0,offsetAttribute:void 0};x0.unpack=function(e,t,n){A.typeOf.object("array",e),t=y(t,0);const i=e[t++],o=new Array(i);for(let _=0;_<i;++_,t+=d.packedLength)o[_]=d.unpack(e,t);const r=ae.unpack(e,t,wG);t+=ae.packedLength;const s=e[t++],a=e[t++],l=e[t++],u=e[t++],h=e[t++],f=e[t];return c(n)?(n._positions=o,n._ellipsoid=ae.clone(r,n._ellipsoid),n._width=s,n._height=a,n._extrudedHeight=l,n._cornerType=u,n._granularity=h,n._offsetAttribute=f===-1?void 0:f,n):(Wd.positions=o,Wd.width=s,Wd.height=a,Wd.extrudedHeight=l,Wd.cornerType=u,Wd.granularity=h,Wd.offsetAttribute=f===-1?void 0:f,new x0(Wd))};x0.createGeometry=function(e){let t=e._positions;const n=e._width,i=e._ellipsoid;t=aIe(t,i);const o=gs(t,d.equalsEpsilon);if(o.length<2||n<=0)return;const r=e._height,s=e._extrudedHeight,a=!R.equalsEpsilon(r,s,0,R.EPSILON2),l={ellipsoid:i,positions:o,width:n,cornerType:e._cornerType,granularity:e._granularity,saveAttributes:!1};let u;if(a)l.height=r,l.extrudedHeight=s,l.offsetAttribute=e._offsetAttribute,u=cIe(l);else{const _=Qn.computePositions(l);if(u=EG(_,l.cornerType),u.attributes.position.values=ai.scaleToGeodeticHeight(u.attributes.position.values,r,i),c(e._offsetAttribute)){const g=u.attributes.position.values.length,m=e._offsetAttribute===Kt.NONE?0:1,b=new Uint8Array(g/3).fill(m);u.attributes.applyOffset=new Ie({componentDatatype:Z.UNSIGNED_BYTE,componentsPerAttribute:1,values:b})}}const h=u.attributes,f=se.fromVertices(h.position.values,void 0,3);return new Tt({attributes:h,indices:u.indices,primitiveType:ze.LINES,boundingSphere:f,offsetAttribute:e._offsetAttribute})};const lIe=new ao(0);function Ut(e){dn.call(this,e),this._zIndex=0,this._terrainOffsetProperty=void 0}c(Object.create)&&(Ut.prototype=Object.create(dn.prototype),Ut.prototype.constructor=Ut);Object.defineProperties(Ut.prototype,{zIndex:{get:function(){return this._zIndex}},terrainOffsetProperty:{get:function(){return this._terrainOffsetProperty}}});Ut.prototype._isOnTerrain=function(e,t){return this._fillEnabled&&!c(t.height)&&!c(t.extrudedHeight)&&sr.isSupported(this._scene)};Ut.prototype._getIsClosed=function(e){const t=e.height,n=e.extrudedHeight;return t===0||c(n)&&n!==t};Ut.prototype._computeCenter=E.throwInstantiationError;Ut.prototype._onEntityPropertyChanged=function(e,t,n,i){if(dn.prototype._onEntityPropertyChanged.call(this,e,t,n,i),this._observedPropertyNames.indexOf(t)===-1)return;const o=this._entity[this._geometryPropertyName];if(!c(o))return;c(o.zIndex)&&(c(o.height)||c(o.extrudedHeight))&&$n($n.geometryZIndex),this._zIndex=y(o.zIndex,lIe),c(this._terrainOffsetProperty)&&(this._terrainOffsetProperty.destroy(),this._terrainOffsetProperty=void 0);const r=o.heightReference,s=o.extrudedHeightReference;if(c(r)||c(s)){const a=new up(this._computeCenter.bind(this),!this._dynamic);this._terrainOffsetProperty=new Fp(this._scene,a,r,s)}};Ut.prototype.destroy=function(){c(this._terrainOffsetProperty)&&(this._terrainOffsetProperty.destroy(),this._terrainOffsetProperty=void 0),dn.prototype.destroy.call(this)};Ut.getGeometryHeight=function(e,t){if(A.defined("heightReference",t),!c(e)){t!==gt.NONE&&$n($n.geometryHeightReference);return}return Np(t)?0:e};Ut.getGeometryExtrudedHeight=function(e,t){if(A.defined("extrudedHeightReference",t),!c(e)){t!==gt.NONE&&$n($n.geometryExtrudedHeightReference);return}return Np(t)?Ut.CLAMP_TO_GROUND:e};Ut.CLAMP_TO_GROUND="clamp";Ut.computeGeometryOffsetAttribute=function(e,t,n,i){(!c(e)||!c(t))&&(t=gt.NONE),(!c(n)||!c(i))&&(i=gt.NONE);let o=0;if(t!==gt.NONE&&o++,i===gt.RELATIVE_TO_GROUND&&o++,o===2)return Kt.ALL;if(o===1)return Kt.TOP};const SG=new z,vG=d.ZERO,IG=new d,DG=new ce;function uIe(e){this.id=e,this.vertexFormat=void 0,this.positions=void 0,this.width=void 0,this.cornerType=void 0,this.height=void 0,this.extrudedHeight=void 0,this.granularity=void 0,this.offsetAttribute=void 0}function fl(e,t){Ut.call(this,{entity:e,scene:t,geometryOptions:new uIe(e),geometryPropertyName:"corridor",observedPropertyNames:["availability","corridor"]}),this._onEntityPropertyChanged(e,"corridor",e.corridor,void 0)}c(Object.create)&&(fl.prototype=Object.create(Ut.prototype),fl.prototype.constructor=fl);fl.prototype.createFillGeometryInstance=function(e){if(A.defined("time",e),!this._fillEnabled)throw new E("This instance does not represent a filled geometry.");const t=this._entity,n=t.isAvailable(e),i={show:new mn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),distanceDisplayCondition:Vn.fromDistanceDisplayCondition(this._distanceDisplayConditionProperty.getValue(e)),offset:void 0,color:void 0};if(this._materialProperty instanceof kt){let o;c(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(o=this._materialProperty.color.getValue(e,SG)),c(o)||(o=z.WHITE),i.color=$t.fromColor(o)}return c(this._options.offsetAttribute)&&(i.offset=Zi.fromCartesian3(K.getValueOrDefault(this._terrainOffsetProperty,e,vG,IG))),new Gt({id:t,geometry:new xl(this._options),attributes:i})};fl.prototype.createOutlineGeometryInstance=function(e){if(A.defined("time",e),!this._outlineEnabled)throw new E("This instance does not represent an outlined geometry.");const t=this._entity,n=t.isAvailable(e),i=K.getValueOrDefault(this._outlineColorProperty,e,z.BLACK,SG),o={show:new mn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:$t.fromColor(i),distanceDisplayCondition:Vn.fromDistanceDisplayCondition(this._distanceDisplayConditionProperty.getValue(e)),offset:void 0};return c(this._options.offsetAttribute)&&(o.offset=Zi.fromCartesian3(K.getValueOrDefault(this._terrainOffsetProperty,e,vG,IG))),new Gt({id:t,geometry:new x0(this._options),attributes:o})};fl.prototype._computeCenter=function(e,t){const n=K.getValueOrUndefined(this._entity.corridor.positions,e);if(!(!c(n)||n.length===0))return d.clone(n[Math.floor(n.length/2)],t)};fl.prototype._isHidden=function(e,t){return!c(t.positions)||!c(t.width)||dn.prototype._isHidden.call(this,e,t)};fl.prototype._isDynamic=function(e,t){return!t.positions.isConstant||!K.isConstant(t.height)||!K.isConstant(t.extrudedHeight)||!K.isConstant(t.granularity)||!K.isConstant(t.width)||!K.isConstant(t.outlineWidth)||!K.isConstant(t.cornerType)||!K.isConstant(t.zIndex)||this._onTerrain&&!K.isConstant(this._materialProperty)&&!(this._materialProperty instanceof kt)};fl.prototype._setStaticOptions=function(e,t){let n=K.getValueOrUndefined(t.height,Ke.MINIMUM_VALUE);const i=K.getValueOrDefault(t.heightReference,Ke.MINIMUM_VALUE,gt.NONE);let o=K.getValueOrUndefined(t.extrudedHeight,Ke.MINIMUM_VALUE);const r=K.getValueOrDefault(t.extrudedHeightReference,Ke.MINIMUM_VALUE,gt.NONE);c(o)&&!c(n)&&(n=0);const s=this._options;s.vertexFormat=this._materialProperty instanceof kt?tn.VERTEX_FORMAT:oo.MaterialSupport.TEXTURED.vertexFormat,s.positions=t.positions.getValue(Ke.MINIMUM_VALUE,s.positions),s.width=t.width.getValue(Ke.MINIMUM_VALUE),s.granularity=K.getValueOrUndefined(t.granularity,Ke.MINIMUM_VALUE),s.cornerType=K.getValueOrUndefined(t.cornerType,Ke.MINIMUM_VALUE),s.offsetAttribute=Ut.computeGeometryOffsetAttribute(n,i,o,r),s.height=Ut.getGeometryHeight(n,i),o=Ut.getGeometryExtrudedHeight(o,r),o===Ut.CLAMP_TO_GROUND&&(o=Ti.getMinimumMaximumHeights(xl.computeRectangle(s,DG)).minimumTerrainHeight),s.extrudedHeight=o};fl.DynamicGeometryUpdater=c_;function c_(e,t,n){On.call(this,e,t,n)}c(Object.create)&&(c_.prototype=Object.create(On.prototype),c_.prototype.constructor=c_);c_.prototype._isHidden=function(e,t,n){const i=this._options;return!c(i.positions)||!c(i.width)||On.prototype._isHidden.call(this,e,t,n)};c_.prototype._setOptions=function(e,t,n){const i=this._options;let o=K.getValueOrUndefined(t.height,n);const r=K.getValueOrDefault(t.heightReference,n,gt.NONE);let s=K.getValueOrUndefined(t.extrudedHeight,n);const a=K.getValueOrDefault(t.extrudedHeightReference,n,gt.NONE);c(s)&&!c(o)&&(o=0),i.positions=K.getValueOrUndefined(t.positions,n),i.width=K.getValueOrUndefined(t.width,n),i.granularity=K.getValueOrUndefined(t.granularity,n),i.cornerType=K.getValueOrUndefined(t.cornerType,n),i.offsetAttribute=Ut.computeGeometryOffsetAttribute(o,r,s,a),i.height=Ut.getGeometryHeight(o,r),s=Ut.getGeometryExtrudedHeight(s,a),s===Ut.CLAMP_TO_GROUND&&(s=Ti.getMinimumMaximumHeights(xl.computeRectangle(i,DG)).minimumTerrainHeight),i.extrudedHeight=s};function GC(){E.throwInstantiationError()}Object.defineProperties(GC.prototype,{name:{get:E.throwInstantiationError},clock:{get:E.throwInstantiationError},entities:{get:E.throwInstantiationError},isLoading:{get:E.throwInstantiationError},changedEvent:{get:E.throwInstantiationError},errorEvent:{get:E.throwInstantiationError},loadingEvent:{get:E.throwInstantiationError},show:{get:E.throwInstantiationError},clustering:{get:E.throwInstantiationError}});GC.prototype.update=function(e){E.throwInstantiationError()};GC.setLoading=function(e,t){e._isLoading!==t&&(t?e._entityCollection.suspendEvents():e._entityCollection.resumeEvents(),e._isLoading=t,e._loading.raiseEvent(e,t))};function Vc(e,t){A.typeOf.object("ellipsoid",e),this._ellipsoid=e,this._cameraPosition=new d,this._cameraPositionInScaledSpace=new d,this._distanceToLimbInScaledSpaceSquared=0,c(t)&&(this.cameraPosition=t)}Object.defineProperties(Vc.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},cameraPosition:{get:function(){return this._cameraPosition},set:function(e){const n=this._ellipsoid.transformPositionToScaledSpace(e,this._cameraPositionInScaledSpace),i=d.magnitudeSquared(n)-1;d.clone(e,this._cameraPosition),this._cameraPositionInScaledSpace=n,this._distanceToLimbInScaledSpaceSquared=i}}});const PG=new d;Vc.prototype.isPointVisible=function(e){const n=this._ellipsoid.transformPositionToScaledSpace(e,PG);return KO(n,this._cameraPositionInScaledSpace,this._distanceToLimbInScaledSpaceSquared)};Vc.prototype.isScaledSpacePointVisible=function(e){return KO(e,this._cameraPositionInScaledSpace,this._distanceToLimbInScaledSpaceSquared)};const dIe=new d;Vc.prototype.isScaledSpacePointVisiblePossiblyUnderEllipsoid=function(e,t){const n=this._ellipsoid;let i,o;return c(t)&&t<0&&n.minimumRadius>-t?(o=dIe,o.x=this._cameraPosition.x/(n.radii.x+t),o.y=this._cameraPosition.y/(n.radii.y+t),o.z=this._cameraPosition.z/(n.radii.z+t),i=o.x*o.x+o.y*o.y+o.z*o.z-1):(o=this._cameraPositionInScaledSpace,i=this._distanceToLimbInScaledSpaceSquared),KO(e,o,i)};Vc.prototype.computeHorizonCullingPoint=function(e,t,n){return RG(this._ellipsoid,e,t,n)};const OG=ae.clone(ae.UNIT_SPHERE);Vc.prototype.computeHorizonCullingPointPossiblyUnderEllipsoid=function(e,t,n,i){const o=LG(this._ellipsoid,n,OG);return RG(o,e,t,i)};Vc.prototype.computeHorizonCullingPointFromVertices=function(e,t,n,i,o){return NG(this._ellipsoid,e,t,n,i,o)};Vc.prototype.computeHorizonCullingPointFromVerticesPossiblyUnderEllipsoid=function(e,t,n,i,o,r){const s=LG(this._ellipsoid,o,OG);return NG(s,e,t,n,i,r)};const hIe=[];Vc.prototype.computeHorizonCullingPointFromRectangle=function(e,t,n){A.typeOf.object("rectangle",e);const i=ce.subsample(e,t,0,hIe),o=se.fromPoints(i);if(!(d.magnitude(o.center)<.1*t.minimumRadius))return this.computeHorizonCullingPoint(o.center,i,n)};const fIe=new d;function LG(e,t,n){if(c(t)&&t<0&&e.minimumRadius>-t){const i=d.fromElements(e.radii.x+t,e.radii.y+t,e.radii.z+t,fIe);e=ae.fromCartesian3(i,n)}return e}function RG(e,t,n,i){A.typeOf.object("directionToPoint",t),A.defined("positions",n),c(i)||(i=new d);const o=BG(e,t);let r=0;for(let s=0,a=n.length;s<a;++s){const l=n[s],u=MG(e,l,o);if(u<0)return;r=Math.max(r,u)}return FG(o,r,i)}const PT=new d;function NG(e,t,n,i,o,r){A.typeOf.object("directionToPoint",t),A.defined("vertices",n),A.typeOf.number("stride",i),c(r)||(r=new d),i=y(i,3),o=y(o,d.ZERO);const s=BG(e,t);let a=0;for(let l=0,u=n.length;l<u;l+=i){PT.x=n[l]+o.x,PT.y=n[l+1]+o.y,PT.z=n[l+2]+o.z;const h=MG(e,PT,s);if(h<0)return;a=Math.max(a,h)}return FG(s,a,r)}function KO(e,t,n){const i=t,o=n,r=d.subtract(e,i,PG),s=-d.dot(r,i);return!(o<0?s>0:s>o&&s*s/d.magnitudeSquared(r)>o)}const pIe=new d,mIe=new d;function MG(e,t,n){const i=e.transformPositionToScaledSpace(t,pIe);let o=d.magnitudeSquared(i),r=Math.sqrt(o);const s=d.divideByScalar(i,r,mIe);o=Math.max(1,o),r=Math.max(1,r);const a=d.dot(s,n),l=d.magnitude(d.cross(s,n,s)),u=1/r,h=Math.sqrt(o-1)*u;return 1/(a*u-l*h)}function FG(e,t,n){if(!(t<=0||t===1/0||t!==t))return d.multiplyByScalar(e,t,n)}const YS=new d;function BG(e,t){return d.equals(t,d.ZERO)?t:(e.transformPositionToScaledSpace(t,YS),d.normalize(YS,YS))}function Dn(e,t){if(e=y(e,y.EMPTY_OBJECT),c(e.disableDepthTestDistance)&&e.disableDepthTestDistance<0)throw new E("disableDepthTestDistance must be greater than or equal to 0.0.");let n=e.translucencyByDistance,i=e.scaleByDistance,o=e.distanceDisplayCondition;if(c(n)){if(n.far<=n.near)throw new E("translucencyByDistance.far must be greater than translucencyByDistance.near.");n=vt.clone(n)}if(c(i)){if(i.far<=i.near)throw new E("scaleByDistance.far must be greater than scaleByDistance.near.");i=vt.clone(i)}if(c(o)){if(o.far<=o.near)throw new E("distanceDisplayCondition.far must be greater than distanceDisplayCondition.near.");o=Pt.clone(o)}this._show=y(e.show,!0),this._position=d.clone(y(e.position,d.ZERO)),this._actualPosition=d.clone(this._position),this._color=z.clone(y(e.color,z.WHITE)),this._outlineColor=z.clone(y(e.outlineColor,z.TRANSPARENT)),this._outlineWidth=y(e.outlineWidth,0),this._pixelSize=y(e.pixelSize,10),this._scaleByDistance=i,this._translucencyByDistance=n,this._distanceDisplayCondition=o,this._disableDepthTestDistance=y(e.disableDepthTestDistance,0),this._id=e.id,this._collection=y(e.collection,t),this._clusterShow=!0,this._pickId=void 0,this._pointPrimitiveCollection=t,this._dirty=!1,this._index=-1}const x2=Dn.SHOW_INDEX=0,zG=Dn.POSITION_INDEX=1,_Ie=Dn.COLOR_INDEX=2,gIe=Dn.OUTLINE_COLOR_INDEX=3,yIe=Dn.OUTLINE_WIDTH_INDEX=4,bIe=Dn.PIXEL_SIZE_INDEX=5,TIe=Dn.SCALE_BY_DISTANCE_INDEX=6,AIe=Dn.TRANSLUCENCY_BY_DISTANCE_INDEX=7,xIe=Dn.DISTANCE_DISPLAY_CONDITION_INDEX=8,CIe=Dn.DISABLE_DEPTH_DISTANCE_INDEX=9;Dn.NUMBER_OF_PROPERTIES=10;function oc(e,t){const n=e._pointPrimitiveCollection;c(n)&&(n._updatePointPrimitive(e,t),e._dirty=!0)}Object.defineProperties(Dn.prototype,{show:{get:function(){return this._show},set:function(e){if(!c(e))throw new E("value is required.");this._show!==e&&(this._show=e,oc(this,x2))}},position:{get:function(){return this._position},set:function(e){if(!c(e))throw new E("value is required.");const t=this._position;d.equals(t,e)||(d.clone(e,t),d.clone(e,this._actualPosition),oc(this,zG))}},scaleByDistance:{get:function(){return this._scaleByDistance},set:function(e){if(c(e)&&e.far<=e.near)throw new E("far distance must be greater than near distance.");const t=this._scaleByDistance;vt.equals(t,e)||(this._scaleByDistance=vt.clone(e,t),oc(this,TIe))}},translucencyByDistance:{get:function(){return this._translucencyByDistance},set:function(e){if(c(e)&&e.far<=e.near)throw new E("far distance must be greater than near distance.");const t=this._translucencyByDistance;vt.equals(t,e)||(this._translucencyByDistance=vt.clone(e,t),oc(this,AIe))}},pixelSize:{get:function(){return this._pixelSize},set:function(e){if(!c(e))throw new E("value is required.");this._pixelSize!==e&&(this._pixelSize=e,oc(this,bIe))}},color:{get:function(){return this._color},set:function(e){if(!c(e))throw new E("value is required.");const t=this._color;z.equals(t,e)||(z.clone(e,t),oc(this,_Ie))}},outlineColor:{get:function(){return this._outlineColor},set:function(e){if(!c(e))throw new E("value is required.");const t=this._outlineColor;z.equals(t,e)||(z.clone(e,t),oc(this,gIe))}},outlineWidth:{get:function(){return this._outlineWidth},set:function(e){if(!c(e))throw new E("value is required.");this._outlineWidth!==e&&(this._outlineWidth=e,oc(this,yIe))}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){if(c(e)&&e.far<=e.near)throw new E("far must be greater than near");Pt.equals(this._distanceDisplayCondition,e)||(this._distanceDisplayCondition=Pt.clone(e,this._distanceDisplayCondition),oc(this,xIe))}},disableDepthTestDistance:{get:function(){return this._disableDepthTestDistance},set:function(e){if(this._disableDepthTestDistance!==e){if(!c(e)||e<0)throw new E("disableDepthTestDistance must be greater than or equal to 0.0.");this._disableDepthTestDistance=e,oc(this,CIe)}}},id:{get:function(){return this._id},set:function(e){this._id=e,c(this._pickId)&&(this._pickId.object.id=e)}},pickId:{get:function(){return this._pickId}},clusterShow:{get:function(){return this._clusterShow},set:function(e){this._clusterShow!==e&&(this._clusterShow=e,oc(this,x2))}}});Dn.prototype.getPickId=function(e){return c(this._pickId)||(this._pickId=e.createPickId({primitive:this,collection:this._collection,id:this._id})),this._pickId};Dn.prototype._getActualPosition=function(){return this._actualPosition};Dn.prototype._setActualPosition=function(e){d.clone(e,this._actualPosition),oc(this,zG)};const C2=new te;Dn._computeActualPosition=function(e,t,n){return t.mode===oe.SCENE3D?e:(L.multiplyByPoint(n,e,C2),Ao.computeActualWgs84Position(t,C2))};const E2=new te;Dn._computeScreenSpacePosition=function(e,t,n,i){const o=L.multiplyByVector(e,te.fromElements(t.x,t.y,t.z,1,E2),E2);return Ao.wgs84ToWindowCoordinates(n,o,i)};Dn.prototype.computeScreenSpacePosition=function(e,t){const n=this._pointPrimitiveCollection;if(c(t)||(t=new H),!c(n))throw new E("PointPrimitive must be in a collection.");if(!c(e))throw new E("scene is required.");const i=n.modelMatrix,o=Dn._computeScreenSpacePosition(i,this._actualPosition,e,t);if(!!c(o))return o.y=e.canvas.clientHeight-o.y,o};Dn.getScreenSpaceBoundingBox=function(e,t,n){const i=e.pixelSize,o=i*.5,r=t.x-o,s=t.y-o,a=i,l=i;return c(n)||(n=new Re),n.x=r,n.y=s,n.width=a,n.height=l,n};Dn.prototype.equals=function(e){return this===e||c(e)&&this._id===e._id&&d.equals(this._position,e._position)&&z.equals(this._color,e._color)&&this._pixelSize===e._pixelSize&&this._outlineWidth===e._outlineWidth&&this._show===e._show&&z.equals(this._outlineColor,e._outlineColor)&&vt.equals(this._scaleByDistance,e._scaleByDistance)&&vt.equals(this._translucencyByDistance,e._translucencyByDistance)&&Pt.equals(this._distanceDisplayCondition,e._distanceDisplayCondition)&&this._disableDepthTestDistance===e._disableDepthTestDistance};Dn.prototype._destroy=function(){this._pickId=this._pickId&&this._pickId.destroy(),this._pointPrimitiveCollection=void 0};const OT=`in vec4 v_color;
|
|
in vec4 v_outlineColor;
|
|
in float v_innerPercent;
|
|
in float v_pixelDistance;
|
|
in vec4 v_pickColor;
|
|
|
|
void main()
|
|
{
|
|
// The distance in UV space from this fragment to the center of the point, at most 0.5.
|
|
float distanceToCenter = length(gl_PointCoord - vec2(0.5));
|
|
// The max distance stops one pixel shy of the edge to leave space for anti-aliasing.
|
|
float maxDistance = max(0.0, 0.5 - v_pixelDistance);
|
|
float wholeAlpha = 1.0 - smoothstep(maxDistance, 0.5, distanceToCenter);
|
|
float innerAlpha = 1.0 - smoothstep(maxDistance * v_innerPercent, 0.5 * v_innerPercent, distanceToCenter);
|
|
|
|
vec4 color = mix(v_outlineColor, v_color, innerAlpha);
|
|
color.a *= wholeAlpha;
|
|
|
|
// Fully transparent parts of the billboard are not pickable.
|
|
#if !defined(OPAQUE) && !defined(TRANSLUCENT)
|
|
if (color.a < 0.005) // matches 0/255 and 1/255
|
|
{
|
|
discard;
|
|
}
|
|
#else
|
|
// The billboard is rendered twice. The opaque pass discards translucent fragments
|
|
// and the translucent pass discards opaque fragments.
|
|
#ifdef OPAQUE
|
|
if (color.a < 0.995) // matches < 254/255
|
|
{
|
|
discard;
|
|
}
|
|
#else
|
|
if (color.a >= 0.995) // matches 254/255 and 255/255
|
|
{
|
|
discard;
|
|
}
|
|
#endif
|
|
#endif
|
|
|
|
out_FragColor = czm_gammaCorrect(color);
|
|
czm_writeLogDepth();
|
|
}
|
|
`,EIe=`uniform float u_maxTotalPointSize;
|
|
|
|
in vec4 positionHighAndSize;
|
|
in vec4 positionLowAndOutline;
|
|
in vec4 compressedAttribute0; // color, outlineColor, pick color
|
|
in vec4 compressedAttribute1; // show, translucency by distance, some free space
|
|
in vec4 scaleByDistance; // near, nearScale, far, farScale
|
|
in vec3 distanceDisplayConditionAndDisableDepth; // near, far, disableDepthTestDistance
|
|
|
|
out vec4 v_color;
|
|
out vec4 v_outlineColor;
|
|
out float v_innerPercent;
|
|
out float v_pixelDistance;
|
|
out vec4 v_pickColor;
|
|
|
|
const float SHIFT_LEFT8 = 256.0;
|
|
const float SHIFT_RIGHT8 = 1.0 / 256.0;
|
|
|
|
void main()
|
|
{
|
|
// Modifying this shader may also require modifications to PointPrimitive._computeScreenSpacePosition
|
|
|
|
// unpack attributes
|
|
vec3 positionHigh = positionHighAndSize.xyz;
|
|
vec3 positionLow = positionLowAndOutline.xyz;
|
|
float outlineWidthBothSides = 2.0 * positionLowAndOutline.w;
|
|
float totalSize = positionHighAndSize.w + outlineWidthBothSides;
|
|
float outlinePercent = outlineWidthBothSides / totalSize;
|
|
// Scale in response to browser-zoom.
|
|
totalSize *= czm_pixelRatio;
|
|
|
|
float temp = compressedAttribute1.x * SHIFT_RIGHT8;
|
|
float show = floor(temp);
|
|
|
|
#ifdef EYE_DISTANCE_TRANSLUCENCY
|
|
vec4 translucencyByDistance;
|
|
translucencyByDistance.x = compressedAttribute1.z;
|
|
translucencyByDistance.z = compressedAttribute1.w;
|
|
|
|
translucencyByDistance.y = ((temp - floor(temp)) * SHIFT_LEFT8) / 255.0;
|
|
|
|
temp = compressedAttribute1.y * SHIFT_RIGHT8;
|
|
translucencyByDistance.w = ((temp - floor(temp)) * SHIFT_LEFT8) / 255.0;
|
|
#endif
|
|
|
|
///////////////////////////////////////////////////////////////////////////
|
|
|
|
vec4 color;
|
|
vec4 outlineColor;
|
|
vec4 pickColor;
|
|
|
|
// compressedAttribute0.z => pickColor.rgb
|
|
|
|
temp = compressedAttribute0.z * SHIFT_RIGHT8;
|
|
pickColor.b = (temp - floor(temp)) * SHIFT_LEFT8;
|
|
temp = floor(temp) * SHIFT_RIGHT8;
|
|
pickColor.g = (temp - floor(temp)) * SHIFT_LEFT8;
|
|
pickColor.r = floor(temp);
|
|
|
|
// compressedAttribute0.x => color.rgb
|
|
|
|
temp = compressedAttribute0.x * SHIFT_RIGHT8;
|
|
color.b = (temp - floor(temp)) * SHIFT_LEFT8;
|
|
temp = floor(temp) * SHIFT_RIGHT8;
|
|
color.g = (temp - floor(temp)) * SHIFT_LEFT8;
|
|
color.r = floor(temp);
|
|
|
|
// compressedAttribute0.y => outlineColor.rgb
|
|
|
|
temp = compressedAttribute0.y * SHIFT_RIGHT8;
|
|
outlineColor.b = (temp - floor(temp)) * SHIFT_LEFT8;
|
|
temp = floor(temp) * SHIFT_RIGHT8;
|
|
outlineColor.g = (temp - floor(temp)) * SHIFT_LEFT8;
|
|
outlineColor.r = floor(temp);
|
|
|
|
// compressedAttribute0.w => color.a, outlineColor.a, pickColor.a
|
|
|
|
temp = compressedAttribute0.w * SHIFT_RIGHT8;
|
|
pickColor.a = (temp - floor(temp)) * SHIFT_LEFT8;
|
|
pickColor = pickColor / 255.0;
|
|
|
|
temp = floor(temp) * SHIFT_RIGHT8;
|
|
outlineColor.a = (temp - floor(temp)) * SHIFT_LEFT8;
|
|
outlineColor /= 255.0;
|
|
color.a = floor(temp);
|
|
color /= 255.0;
|
|
|
|
///////////////////////////////////////////////////////////////////////////
|
|
|
|
vec4 p = czm_translateRelativeToEye(positionHigh, positionLow);
|
|
vec4 positionEC = czm_modelViewRelativeToEye * p;
|
|
|
|
///////////////////////////////////////////////////////////////////////////
|
|
|
|
#if defined(EYE_DISTANCE_SCALING) || defined(EYE_DISTANCE_TRANSLUCENCY) || defined(DISTANCE_DISPLAY_CONDITION) || defined(DISABLE_DEPTH_DISTANCE)
|
|
float lengthSq;
|
|
if (czm_sceneMode == czm_sceneMode2D)
|
|
{
|
|
// 2D camera distance is a special case
|
|
// treat all billboards as flattened to the z=0.0 plane
|
|
lengthSq = czm_eyeHeight2D.y;
|
|
}
|
|
else
|
|
{
|
|
lengthSq = dot(positionEC.xyz, positionEC.xyz);
|
|
}
|
|
#endif
|
|
|
|
#ifdef EYE_DISTANCE_SCALING
|
|
totalSize *= czm_nearFarScalar(scaleByDistance, lengthSq);
|
|
#endif
|
|
if (totalSize > 0.0) {
|
|
// Add padding for anti-aliasing on both sides.
|
|
totalSize += 3.0;
|
|
}
|
|
|
|
// Clamp to max point size.
|
|
totalSize = min(totalSize, u_maxTotalPointSize);
|
|
// If size is too small, push vertex behind near plane for clipping.
|
|
// Note that context.minimumAliasedPointSize "will be at most 1.0".
|
|
if (totalSize < 1.0)
|
|
{
|
|
positionEC.xyz = vec3(0.0);
|
|
totalSize = 1.0;
|
|
}
|
|
|
|
float translucency = 1.0;
|
|
#ifdef EYE_DISTANCE_TRANSLUCENCY
|
|
translucency = czm_nearFarScalar(translucencyByDistance, lengthSq);
|
|
// push vertex behind near plane for clipping
|
|
if (translucency < 0.004)
|
|
{
|
|
positionEC.xyz = vec3(0.0);
|
|
}
|
|
#endif
|
|
|
|
#ifdef DISTANCE_DISPLAY_CONDITION
|
|
float nearSq = distanceDisplayConditionAndDisableDepth.x;
|
|
float farSq = distanceDisplayConditionAndDisableDepth.y;
|
|
if (lengthSq < nearSq || lengthSq > farSq) {
|
|
// push vertex behind camera to force it to be clipped
|
|
positionEC.xyz = vec3(0.0, 0.0, 1.0);
|
|
}
|
|
#endif
|
|
|
|
gl_Position = czm_projection * positionEC;
|
|
czm_vertexLogDepth();
|
|
|
|
#ifdef DISABLE_DEPTH_DISTANCE
|
|
float disableDepthTestDistance = distanceDisplayConditionAndDisableDepth.z;
|
|
if (disableDepthTestDistance == 0.0 && czm_minimumDisableDepthTestDistance != 0.0)
|
|
{
|
|
disableDepthTestDistance = czm_minimumDisableDepthTestDistance;
|
|
}
|
|
|
|
if (disableDepthTestDistance != 0.0)
|
|
{
|
|
// Don't try to "multiply both sides" by w. Greater/less-than comparisons won't work for negative values of w.
|
|
float zclip = gl_Position.z / gl_Position.w;
|
|
bool clipped = (zclip < -1.0 || zclip > 1.0);
|
|
if (!clipped && (disableDepthTestDistance < 0.0 || (lengthSq > 0.0 && lengthSq < disableDepthTestDistance)))
|
|
{
|
|
// Position z on the near plane.
|
|
gl_Position.z = -gl_Position.w;
|
|
#ifdef LOG_DEPTH
|
|
czm_vertexLogDepth(vec4(czm_currentFrustum.x));
|
|
#endif
|
|
}
|
|
}
|
|
#endif
|
|
|
|
v_color = color;
|
|
v_color.a *= translucency * show;
|
|
v_outlineColor = outlineColor;
|
|
v_outlineColor.a *= translucency * show;
|
|
|
|
v_innerPercent = 1.0 - outlinePercent;
|
|
v_pixelDistance = 2.0 / totalSize;
|
|
gl_PointSize = totalSize * show;
|
|
gl_Position *= show;
|
|
|
|
v_pickColor = pickColor;
|
|
}
|
|
`,wIe=Dn.SHOW_INDEX,bD=Dn.POSITION_INDEX,UG=Dn.COLOR_INDEX,SIe=Dn.OUTLINE_COLOR_INDEX,vIe=Dn.OUTLINE_WIDTH_INDEX,IIe=Dn.PIXEL_SIZE_INDEX,kG=Dn.SCALE_BY_DISTANCE_INDEX,VG=Dn.TRANSLUCENCY_BY_DISTANCE_INDEX,HG=Dn.DISTANCE_DISPLAY_CONDITION_INDEX,DIe=Dn.DISABLE_DEPTH_DISTANCE_INDEX,ZO=Dn.NUMBER_OF_PROPERTIES,cs={positionHighAndSize:0,positionLowAndOutline:1,compressedAttribute0:2,compressedAttribute1:3,scaleByDistance:4,distanceDisplayConditionAndDisableDepth:5};function ja(e){e=y(e,y.EMPTY_OBJECT),this._sp=void 0,this._spTranslucent=void 0,this._rsOpaque=void 0,this._rsTranslucent=void 0,this._vaf=void 0,this._pointPrimitives=[],this._pointPrimitivesToUpdate=[],this._pointPrimitivesToUpdateIndex=0,this._pointPrimitivesRemoved=!1,this._createVertexArray=!1,this._shaderScaleByDistance=!1,this._compiledShaderScaleByDistance=!1,this._shaderTranslucencyByDistance=!1,this._compiledShaderTranslucencyByDistance=!1,this._shaderDistanceDisplayCondition=!1,this._compiledShaderDistanceDisplayCondition=!1,this._shaderDisableDepthDistance=!1,this._compiledShaderDisableDepthDistance=!1,this._propertiesChanged=new Uint32Array(ZO),this._maxPixelSize=1,this._baseVolume=new se,this._baseVolumeWC=new se,this._baseVolume2D=new se,this._boundingVolume=new se,this._boundingVolumeDirty=!1,this._colorCommands=[],this.show=y(e.show,!0),this.modelMatrix=L.clone(y(e.modelMatrix,L.IDENTITY)),this._modelMatrix=L.clone(L.IDENTITY),this.debugShowBoundingVolume=y(e.debugShowBoundingVolume,!1),this.blendOption=y(e.blendOption,io.OPAQUE_AND_TRANSLUCENT),this._blendOption=void 0,this._mode=oe.SCENE3D,this._maxTotalPointSize=1,this._buffersUsage=[ke.STATIC_DRAW,ke.STATIC_DRAW,ke.STATIC_DRAW,ke.STATIC_DRAW,ke.STATIC_DRAW,ke.STATIC_DRAW,ke.STATIC_DRAW,ke.STATIC_DRAW,ke.STATIC_DRAW];const t=this;this._uniforms={u_maxTotalPointSize:function(){return t._maxTotalPointSize}}}Object.defineProperties(ja.prototype,{length:{get:function(){return JO(this),this._pointPrimitives.length}}});function GG(e){const t=e.length;for(let n=0;n<t;++n)e[n]&&e[n]._destroy()}ja.prototype.add=function(e){const t=new Dn(e,this);return t._index=this._pointPrimitives.length,this._pointPrimitives.push(t),this._createVertexArray=!0,t};ja.prototype.remove=function(e){return this.contains(e)?(this._pointPrimitives[e._index]=null,this._pointPrimitivesRemoved=!0,this._createVertexArray=!0,e._destroy(),!0):!1};ja.prototype.removeAll=function(){GG(this._pointPrimitives),this._pointPrimitives=[],this._pointPrimitivesToUpdate=[],this._pointPrimitivesToUpdateIndex=0,this._pointPrimitivesRemoved=!1,this._createVertexArray=!0};function JO(e){if(e._pointPrimitivesRemoved){e._pointPrimitivesRemoved=!1;const t=[],n=e._pointPrimitives,i=n.length;for(let o=0,r=0;o<i;++o){const s=n[o];s&&(s._index=r++,t.push(s))}e._pointPrimitives=t}}ja.prototype._updatePointPrimitive=function(e,t){e._dirty||(this._pointPrimitivesToUpdate[this._pointPrimitivesToUpdateIndex++]=e),++this._propertiesChanged[t]};ja.prototype.contains=function(e){return c(e)&&e._pointPrimitiveCollection===this};ja.prototype.get=function(e){if(!c(e))throw new E("index is required.");return JO(this),this._pointPrimitives[e]};ja.prototype.computeNewBuffersUsage=function(){const e=this._buffersUsage;let t=!1;const n=this._propertiesChanged;for(let i=0;i<ZO;++i){const o=n[i]===0?ke.STATIC_DRAW:ke.STREAM_DRAW;t=t||e[i]!==o,e[i]=o}return t};function PIe(e,t,n){return new qo(e,[{index:cs.positionHighAndSize,componentsPerAttribute:4,componentDatatype:Z.FLOAT,usage:n[bD]},{index:cs.positionLowAndShow,componentsPerAttribute:4,componentDatatype:Z.FLOAT,usage:n[bD]},{index:cs.compressedAttribute0,componentsPerAttribute:4,componentDatatype:Z.FLOAT,usage:n[UG]},{index:cs.compressedAttribute1,componentsPerAttribute:4,componentDatatype:Z.FLOAT,usage:n[VG]},{index:cs.scaleByDistance,componentsPerAttribute:4,componentDatatype:Z.FLOAT,usage:n[kG]},{index:cs.distanceDisplayConditionAndDisableDepth,componentsPerAttribute:3,componentDatatype:Z.FLOAT,usage:n[HG]}],t)}const $S=new rn;function jG(e,t,n,i){const o=i._index,r=i._getActualPosition();e._mode===oe.SCENE3D&&(se.expand(e._baseVolume,r,e._baseVolume),e._boundingVolumeDirty=!0),rn.fromCartesian(r,$S);const s=i.pixelSize,a=i.outlineWidth;e._maxPixelSize=Math.max(e._maxPixelSize,s+a);const l=n[cs.positionHighAndSize],u=$S.high;l(o,u.x,u.y,u.z,s);const h=n[cs.positionLowAndOutline],f=$S.low;h(o,f.x,f.y,f.z,a)}const LT=65536,my=256;function WG(e,t,n,i){const o=i._index,r=i.color,s=i.getPickId(t).color,a=i.outlineColor;let l=z.floatToByte(r.red),u=z.floatToByte(r.green),h=z.floatToByte(r.blue);const f=l*LT+u*my+h;l=z.floatToByte(a.red),u=z.floatToByte(a.green),h=z.floatToByte(a.blue);const _=l*LT+u*my+h;l=z.floatToByte(s.red),u=z.floatToByte(s.green),h=z.floatToByte(s.blue);const g=l*LT+u*my+h,m=z.floatToByte(r.alpha)*LT+z.floatToByte(a.alpha)*my+z.floatToByte(s.alpha),b=n[cs.compressedAttribute0];b(o,f,_,g,m)}function qG(e,t,n,i){const o=i._index;let r=0,s=1,a=1,l=1;const u=i.translucencyByDistance;c(u)&&(r=u.near,s=u.nearValue,a=u.far,l=u.farValue,(s!==1||l!==1)&&(e._shaderTranslucencyByDistance=!0));let h=i.show&&i.clusterShow;i.color.alpha===0&&i.outlineColor.alpha===0&&(h=!1),s=R.clamp(s,0,1),s=s===1?255:s*255|0;const f=(h?1:0)*my+s;l=R.clamp(l,0,1),l=l===1?255:l*255|0;const _=l,g=n[cs.compressedAttribute1];g(o,f,_,r,a)}function YG(e,t,n,i){const o=i._index,r=n[cs.scaleByDistance];let s=0,a=1,l=1,u=1;const h=i.scaleByDistance;c(h)&&(s=h.near,a=h.nearValue,l=h.far,u=h.farValue,(a!==1||u!==1)&&(e._shaderScaleByDistance=!0)),r(o,s,a,l,u)}function $G(e,t,n,i){const o=i._index,r=n[cs.distanceDisplayConditionAndDisableDepth];let s=0,a=Number.MAX_VALUE;const l=i.distanceDisplayCondition;c(l)&&(s=l.near,a=l.far,s*=s,a*=a,e._shaderDistanceDisplayCondition=!0);let u=i.disableDepthTestDistance;u*=u,u>0&&(e._shaderDisableDepthDistance=!0,u===Number.POSITIVE_INFINITY&&(u=-1)),r(o,s,a,u)}function OIe(e,t,n,i){jG(e,t,n,i),WG(e,t,n,i),qG(e,t,n,i),YG(e,t,n,i),$G(e,t,n,i)}function XS(e,t,n,i,o,r){let s;i.mode===oe.SCENE3D?(s=e._baseVolume,e._boundingVolumeDirty=!0):s=e._baseVolume2D;const a=[];for(let l=0;l<n;++l){const u=t[l],h=u.position,f=Dn._computeActualPosition(h,i,o);c(f)&&(u._setActualPosition(f),r?a.push(f):se.expand(s,f,s))}r&&se.fromPoints(a,s)}function LIe(e,t){const n=t.mode,i=e._pointPrimitives,o=e._pointPrimitivesToUpdate,r=e._modelMatrix;e._createVertexArray||e._mode!==n||n!==oe.SCENE3D&&!L.equals(r,e.modelMatrix)?(e._mode=n,L.clone(e.modelMatrix,r),e._createVertexArray=!0,(n===oe.SCENE3D||n===oe.SCENE2D||n===oe.COLUMBUS_VIEW)&&XS(e,i,i.length,t,r,!0)):n===oe.MORPHING?XS(e,i,i.length,t,r,!0):(n===oe.SCENE2D||n===oe.COLUMBUS_VIEW)&&XS(e,o,e._pointPrimitivesToUpdateIndex,t,r,!1)}function RIe(e,t,n){const o=t.camera.getPixelSize(n,t.context.drawingBufferWidth,t.context.drawingBufferHeight)*e._maxPixelSize;n.radius+=o}const NIe=[];ja.prototype.update=function(e){if(JO(this),!this.show)return;this._maxTotalPointSize=pt.maximumAliasedPointSize,LIe(this,e);const n=this._pointPrimitives.length,i=this._pointPrimitivesToUpdate,o=this._pointPrimitivesToUpdateIndex,r=this._propertiesChanged,s=this._createVertexArray;let a;const l=e.context,u=e.passes,h=u.pick;if(s||!h&&this.computeNewBuffersUsage()){this._createVertexArray=!1;for(let P=0;P<ZO;++P)r[P]=0;if(this._vaf=this._vaf&&this._vaf.destroy(),n>0){this._vaf=PIe(l,n,this._buffersUsage),a=this._vaf.writers;for(let P=0;P<n;++P){const N=this._pointPrimitives[P];N._dirty=!1,OIe(this,l,a,N)}this._vaf.commit()}this._pointPrimitivesToUpdateIndex=0}else if(o>0){const P=NIe;P.length=0,(r[bD]||r[vIe]||r[IIe])&&P.push(jG),(r[UG]||r[SIe])&&P.push(WG),(r[wIe]||r[VG])&&P.push(qG),r[kG]&&P.push(YG),(r[HG]||r[DIe])&&P.push($G);const N=P.length;if(a=this._vaf.writers,o/n>.1){for(let k=0;k<o;++k){const M=i[k];M._dirty=!1;for(let U=0;U<N;++U)P[U](this,l,a,M)}this._vaf.commit()}else{for(let k=0;k<o;++k){const M=i[k];M._dirty=!1;for(let U=0;U<N;++U)P[U](this,l,a,M);this._vaf.subCommit(M._index,1)}this._vaf.endSubCommits()}this._pointPrimitivesToUpdateIndex=0}if(o>n*1.5&&(i.length=n),!c(this._vaf)||!c(this._vaf.va))return;this._boundingVolumeDirty&&(this._boundingVolumeDirty=!1,se.transform(this._baseVolume,this.modelMatrix,this._baseVolumeWC));let f,_=L.IDENTITY;e.mode===oe.SCENE3D?(_=this.modelMatrix,f=se.clone(this._baseVolumeWC,this._boundingVolume)):f=se.clone(this._baseVolume2D,this._boundingVolume),RIe(this,e,f);const g=this._blendOption!==this.blendOption;this._blendOption=this.blendOption,g&&(this._blendOption===io.OPAQUE||this._blendOption===io.OPAQUE_AND_TRANSLUCENT?this._rsOpaque=Ue.fromCache({depthTest:{enabled:!0,func:J.LEQUAL},depthMask:!0}):this._rsOpaque=void 0,this._blendOption===io.TRANSLUCENT||this._blendOption===io.OPAQUE_AND_TRANSLUCENT?this._rsTranslucent=Ue.fromCache({depthTest:{enabled:!0,func:J.LEQUAL},depthMask:!1,blending:Zn.ALPHA_BLEND}):this._rsTranslucent=void 0),this._shaderDisableDepthDistance=this._shaderDisableDepthDistance||e.minimumDisableDepthTestDistance!==0;let m,b;(g||this._shaderScaleByDistance&&!this._compiledShaderScaleByDistance||this._shaderTranslucencyByDistance&&!this._compiledShaderTranslucencyByDistance||this._shaderDistanceDisplayCondition&&!this._compiledShaderDistanceDisplayCondition||this._shaderDisableDepthDistance!==this._compiledShaderDisableDepthDistance)&&(m=new Oe({sources:[EIe]}),this._shaderScaleByDistance&&m.defines.push("EYE_DISTANCE_SCALING"),this._shaderTranslucencyByDistance&&m.defines.push("EYE_DISTANCE_TRANSLUCENCY"),this._shaderDistanceDisplayCondition&&m.defines.push("DISTANCE_DISPLAY_CONDITION"),this._shaderDisableDepthDistance&&m.defines.push("DISABLE_DEPTH_DISTANCE"),this._blendOption===io.OPAQUE_AND_TRANSLUCENT&&(b=new Oe({defines:["OPAQUE"],sources:[OT]}),this._sp=Jt.replaceCache({context:l,shaderProgram:this._sp,vertexShaderSource:m,fragmentShaderSource:b,attributeLocations:cs}),b=new Oe({defines:["TRANSLUCENT"],sources:[OT]}),this._spTranslucent=Jt.replaceCache({context:l,shaderProgram:this._spTranslucent,vertexShaderSource:m,fragmentShaderSource:b,attributeLocations:cs})),this._blendOption===io.OPAQUE&&(b=new Oe({sources:[OT]}),this._sp=Jt.replaceCache({context:l,shaderProgram:this._sp,vertexShaderSource:m,fragmentShaderSource:b,attributeLocations:cs})),this._blendOption===io.TRANSLUCENT&&(b=new Oe({sources:[OT]}),this._spTranslucent=Jt.replaceCache({context:l,shaderProgram:this._spTranslucent,vertexShaderSource:m,fragmentShaderSource:b,attributeLocations:cs})),this._compiledShaderScaleByDistance=this._shaderScaleByDistance,this._compiledShaderTranslucencyByDistance=this._shaderTranslucencyByDistance,this._compiledShaderDistanceDisplayCondition=this._shaderDistanceDisplayCondition,this._compiledShaderDisableDepthDistance=this._shaderDisableDepthDistance);let T,x,C,w;const v=e.commandList;if(u.render||h){const P=this._colorCommands,N=this._blendOption===io.OPAQUE,k=this._blendOption===io.OPAQUE_AND_TRANSLUCENT;T=this._vaf.va,x=T.length,P.length=x;const M=k?x*2:x;for(w=0;w<M;++w){const U=N||k&&w%2===0;C=P[w],c(C)||(C=P[w]=new Ze),C.primitiveType=ze.POINTS,C.pass=U||!k?xe.OPAQUE:xe.TRANSLUCENT,C.owner=this;const B=k?Math.floor(w/2):w;C.boundingVolume=f,C.modelMatrix=_,C.shaderProgram=U?this._sp:this._spTranslucent,C.uniformMap=this._uniforms,C.vertexArray=T[B].va,C.renderState=U?this._rsOpaque:this._rsTranslucent,C.debugShowBoundingVolume=this.debugShowBoundingVolume,C.pickId="v_pickColor",v.push(C)}}};ja.prototype.isDestroyed=function(){return!1};ja.prototype.destroy=function(){return this._sp=this._sp&&this._sp.destroy(),this._spTranslucent=this._spTranslucent&&this._spTranslucent.destroy(),this._spPick=this._spPick&&this._spPick.destroy(),this._vaf=this._vaf&&this._vaf.destroy(),GG(this._pointPrimitives),ve(this)};const w2=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],QS=1,Yg=8;class e1{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[n,i]=new Uint8Array(t,0,2);if(n!==219)throw new Error("Data does not appear to be in a KDBush format.");const o=i>>4;if(o!==QS)throw new Error(`Got v${o} data when expected v${QS}.`);const r=w2[i&15];if(!r)throw new Error("Unrecognized array type.");const[s]=new Uint16Array(t,2,1),[a]=new Uint32Array(t,4,1);return new e1(a,s,r,t)}constructor(t,n=64,i=Float64Array,o){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+n,2),65535),this.ArrayType=i,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const r=w2.indexOf(this.ArrayType),s=t*2*this.ArrayType.BYTES_PER_ELEMENT,a=t*this.IndexArrayType.BYTES_PER_ELEMENT,l=(8-a%8)%8;if(r<0)throw new Error(`Unexpected typed array class: ${i}.`);o&&o instanceof ArrayBuffer?(this.data=o,this.ids=new this.IndexArrayType(this.data,Yg,t),this.coords=new this.ArrayType(this.data,Yg+a+l,t*2),this._pos=t*2,this._finished=!0):(this.data=new ArrayBuffer(Yg+s+a+l),this.ids=new this.IndexArrayType(this.data,Yg,t),this.coords=new this.ArrayType(this.data,Yg+a+l,t*2),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,(QS<<4)+r]),new Uint16Array(this.data,2,1)[0]=n,new Uint32Array(this.data,4,1)[0]=t)}add(t,n){const i=this._pos>>1;return this.ids[i]=i,this.coords[this._pos++]=t,this.coords[this._pos++]=n,i}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return TD(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,n,i,o){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:r,coords:s,nodeSize:a}=this,l=[0,r.length-1,0],u=[];for(;l.length;){const h=l.pop()||0,f=l.pop()||0,_=l.pop()||0;if(f-_<=a){for(let T=_;T<=f;T++){const x=s[2*T],C=s[2*T+1];x>=t&&x<=i&&C>=n&&C<=o&&u.push(r[T])}continue}const g=_+f>>1,m=s[2*g],b=s[2*g+1];m>=t&&m<=i&&b>=n&&b<=o&&u.push(r[g]),(h===0?t<=m:n<=b)&&(l.push(_),l.push(g-1),l.push(1-h)),(h===0?i>=m:o>=b)&&(l.push(g+1),l.push(f),l.push(1-h))}return u}within(t,n,i){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:o,coords:r,nodeSize:s}=this,a=[0,o.length-1,0],l=[],u=i*i;for(;a.length;){const h=a.pop()||0,f=a.pop()||0,_=a.pop()||0;if(f-_<=s){for(let T=_;T<=f;T++)S2(r[2*T],r[2*T+1],t,n)<=u&&l.push(o[T]);continue}const g=_+f>>1,m=r[2*g],b=r[2*g+1];S2(m,b,t,n)<=u&&l.push(o[g]),(h===0?t-i<=m:n-i<=b)&&(a.push(_),a.push(g-1),a.push(1-h)),(h===0?t+i>=m:n+i>=b)&&(a.push(g+1),a.push(f),a.push(1-h))}return l}}function TD(e,t,n,i,o,r){if(o-i<=n)return;const s=i+o>>1;XG(e,t,s,i,o,r),TD(e,t,n,i,s-1,1-r),TD(e,t,n,s+1,o,1-r)}function XG(e,t,n,i,o,r){for(;o>i;){if(o-i>600){const u=o-i+1,h=n-i+1,f=Math.log(u),_=.5*Math.exp(2*f/3),g=.5*Math.sqrt(f*_*(u-_)/u)*(h-u/2<0?-1:1),m=Math.max(i,Math.floor(n-h*_/u+g)),b=Math.min(o,Math.floor(n+(u-h)*_/u+g));XG(e,t,n,m,b,r)}const s=t[2*n+r];let a=i,l=o;for($g(e,t,i,n),t[2*o+r]>s&&$g(e,t,i,o);a<l;){for($g(e,t,a,l),a++,l--;t[2*a+r]<s;)a++;for(;t[2*l+r]>s;)l--}t[2*i+r]===s?$g(e,t,i,l):(l++,$g(e,t,l,o)),l<=n&&(i=l+1),n<=l&&(o=l-1)}}function $g(e,t,n,i){KS(e,n,i),KS(t,2*n,2*i),KS(t,2*n+1,2*i+1)}function KS(e,t,n){const i=e[t];e[t]=e[n],e[n]=i}function S2(e,t,n,i){const o=e-n,r=t-i;return o*o+r*r}function Ol(e){e=y(e,y.EMPTY_OBJECT),this._enabled=y(e.enabled,!1),this._pixelRange=y(e.pixelRange,80),this._minimumClusterSize=y(e.minimumClusterSize,2),this._clusterBillboards=y(e.clusterBillboards,!0),this._clusterLabels=y(e.clusterLabels,!0),this._clusterPoints=y(e.clusterPoints,!0),this._labelCollection=void 0,this._billboardCollection=void 0,this._pointCollection=void 0,this._clusterBillboardCollection=void 0,this._clusterLabelCollection=void 0,this._clusterPointCollection=void 0,this._collectionIndicesByEntity={},this._unusedLabelIndices=[],this._unusedBillboardIndices=[],this._unusedPointIndices=[],this._previousClusters=[],this._previousHeight=void 0,this._enabledDirty=!1,this._clusterDirty=!1,this._cluster=void 0,this._removeEventListener=void 0,this._clusterEvent=new Le,this.show=y(e.show,!0)}function v2(e,t){e.x-=t,e.y-=t,e.width+=t*2,e.height+=t*2}const MIe=new Re;function I2(e,t,n,i,o){if(c(e._labelCollection)&&i._clusterLabels?o=Tl.getScreenSpaceBoundingBox(e,t,o):c(e._billboardCollection)&&i._clusterBillboards?o=St.getScreenSpaceBoundingBox(e,t,o):c(e._pointPrimitiveCollection)&&i._clusterPoints&&(o=Dn.getScreenSpaceBoundingBox(e,t,o)),v2(o,n),i._clusterLabels&&!c(e._labelCollection)&&c(e.id)&&QG(i,e.id.id)&&c(e.id._label)){const r=i._collectionIndicesByEntity[e.id.id].labelIndex,s=i._labelCollection.get(r),a=Tl.getScreenSpaceBoundingBox(s,t,MIe);v2(a,n),o=Re.union(o,a,o)}return o}function FIe(e,t){if(e.clusterShow=!0,!c(e._labelCollection)&&c(e.id)&&QG(t,e.id.id)&&c(e.id._label)){const n=t._collectionIndicesByEntity[e.id.id].labelIndex,i=t._labelCollection.get(n);i.clusterShow=!0}}function D2(e,t,n,i){const o={billboard:i._clusterBillboardCollection.add(),label:i._clusterLabelCollection.add(),point:i._clusterPointCollection.add()};o.billboard.show=!1,o.point.show=!1,o.label.show=!0,o.label.text=t.toLocaleString(),o.label.id=n,o.billboard.position=o.label.position=o.point.position=e,i._clusterEvent.raiseEvent(n,o)}function QG(e,t){return c(e)&&c(e._collectionIndicesByEntity[t])&&c(e._collectionIndicesByEntity[t].labelIndex)}function ZS(e,t,n,i,o){if(!c(e))return;const r=e.length;for(let s=0;s<r;++s){const a=e.get(s);if(a.clusterShow=!1,!a.show||o._scene.mode===oe.SCENE3D&&!i.isPointVisible(a.position))continue;const l=o._clusterLabels&&c(a._labelCollection),u=o._clusterBillboards&&c(a.id._billboard),h=o._clusterPoints&&c(a.id._point);if(l&&(h||u))continue;const f=a.computeScreenSpacePosition(n);!c(f)||t.push({index:s,collection:e,clustered:!1,coord:f})}}const BIe=new Re,zIe=new Re,UIe=new Re;function kIe(e){return function(t){if(c(t)&&t<.05||!e.enabled)return;const n=e._scene,i=e._labelCollection,o=e._billboardCollection,r=e._pointCollection;if(!c(i)&&!c(o)&&!c(r)||!e._clusterBillboards&&!e._clusterLabels&&!e._clusterPoints)return;let s=e._clusterLabelCollection,a=e._clusterBillboardCollection,l=e._clusterPointCollection;c(s)?s.removeAll():s=e._clusterLabelCollection=new Ga({scene:n}),c(a)?a.removeAll():a=e._clusterBillboardCollection=new Ts({scene:n}),c(l)?l.removeAll():l=e._clusterPointCollection=new ja;const u=e._pixelRange,h=e._minimumClusterSize,f=e._previousClusters,_=[],g=e._previousHeight,m=n.camera.positionCartographic.height,b=n.mapProjection.ellipsoid,T=n.camera.positionWC,x=new Vc(b,T),C=[];e._clusterLabels&&ZS(i,C,n,x,e),e._clusterBillboards&&ZS(o,C,n,x,e),e._clusterPoints&&ZS(r,C,n,x,e);let w,v,P,N,k,M,U,B,S,D,p,I;if(C.length>0){const O=new e1(C.length,64,Uint32Array);for(let F=0;F<C.length;++F)O.add(C[F].coord.x,C[F].coord.y);if(O.finish(),m<g)for(P=f.length,w=0;w<P;++w){const F=f[w];if(!x.isPointVisible(F.position))continue;const V=St._computeScreenSpacePosition(L.IDENTITY,F.position,d.ZERO,H.ZERO,n);if(!c(V))continue;const G=1-m/g;let j=F.width=F.width*G,W=F.height=F.height*G;j=Math.max(j,F.minimumWidth),W=Math.max(W,F.minimumHeight);const X=V.x-j*.5,q=V.y-W*.5,ee=V.x+j,Y=V.y+W;for(k=O.range(X,q,ee,Y),M=k.length,D=0,S=[],v=0;v<M;++v)U=k[v],B=C[U],B.clustered||(++D,p=B.collection,I=B.index,S.push(p.get(I).id));if(D>=h)for(D2(F.position,D,S,e),_.push(F),v=0;v<M;++v)C[k[v]].clustered=!0}for(P=C.length,w=0;w<P;++w){const F=C[w];if(F.clustered)continue;F.clustered=!0,p=F.collection,I=F.index;const V=p.get(I);N=I2(V,F.coord,u,e,BIe);const G=Re.clone(N,zIe);k=O.range(N.x,N.y,N.x+N.width,N.y+N.height),M=k.length;const j=d.clone(V.position);for(D=1,S=[V.id],v=0;v<M;++v)if(U=k[v],B=C[U],!B.clustered){const W=B.collection.get(B.index),X=I2(W,B.coord,u,e,UIe);d.add(W.position,j,j),Re.union(G,X,G),++D,S.push(W.id)}if(D>=h){const W=d.multiplyByScalar(j,1/D,j);for(D2(W,D,S,e),_.push({position:W,width:G.width,height:G.height,minimumWidth:N.width,minimumHeight:N.height}),v=0;v<M;++v)C[k[v]].clustered=!0}else FIe(V,e)}}s.length===0&&(s.destroy(),e._clusterLabelCollection=void 0),a.length===0&&(a.destroy(),e._clusterBillboardCollection=void 0),l.length===0&&(l.destroy(),e._clusterPointCollection=void 0),e._previousClusters=_,e._previousHeight=m}}Ol.prototype._initialize=function(e){this._scene=e;const t=kIe(this);this._cluster=t,this._removeEventListener=e.camera.changed.addEventListener(t)};Object.defineProperties(Ol.prototype,{enabled:{get:function(){return this._enabled},set:function(e){this._enabledDirty=e!==this._enabled,this._enabled=e}},pixelRange:{get:function(){return this._pixelRange},set:function(e){this._clusterDirty=this._clusterDirty||e!==this._pixelRange,this._pixelRange=e}},minimumClusterSize:{get:function(){return this._minimumClusterSize},set:function(e){this._clusterDirty=this._clusterDirty||e!==this._minimumClusterSize,this._minimumClusterSize=e}},clusterEvent:{get:function(){return this._clusterEvent}},clusterBillboards:{get:function(){return this._clusterBillboards},set:function(e){this._clusterDirty=this._clusterDirty||e!==this._clusterBillboards,this._clusterBillboards=e}},clusterLabels:{get:function(){return this._clusterLabels},set:function(e){this._clusterDirty=this._clusterDirty||e!==this._clusterLabels,this._clusterLabels=e}},clusterPoints:{get:function(){return this._clusterPoints},set:function(e){this._clusterDirty=this._clusterDirty||e!==this._clusterPoints,this._clusterPoints=e}}});function t1(e,t,n,i){return function(o){let r=this[e];c(this._collectionIndicesByEntity)||(this._collectionIndicesByEntity={});let s=this._collectionIndicesByEntity[o.id];if(c(s)||(s=this._collectionIndicesByEntity[o.id]={billboardIndex:void 0,labelIndex:void 0,pointIndex:void 0}),c(r)&&c(s[i]))return r.get(s[i]);c(r)||(r=this[e]=new t({scene:this._scene}));let a,l;const u=this[n];u.length>0?(a=u.shift(),l=r.get(a)):(l=r.add(),a=r.length-1),s[i]=a;const h=this;return Promise.resolve().then(function(){h._clusterDirty=!0}),l}}function n1(e,t){const n=e._collectionIndicesByEntity[t];!c(n.billboardIndex)&&!c(n.labelIndex)&&!c(n.pointIndex)&&delete e._collectionIndicesByEntity[t]}Ol.prototype.getLabel=t1("_labelCollection",Ga,"_unusedLabelIndices","labelIndex");Ol.prototype.removeLabel=function(e){const t=this._collectionIndicesByEntity&&this._collectionIndicesByEntity[e.id];if(!c(this._labelCollection)||!c(t)||!c(t.labelIndex))return;const n=t.labelIndex;t.labelIndex=void 0,n1(this,e.id);const i=this._labelCollection.get(n);i.show=!1,i.text="",i.id=void 0,this._unusedLabelIndices.push(n),this._clusterDirty=!0};Ol.prototype.getBillboard=t1("_billboardCollection",Ts,"_unusedBillboardIndices","billboardIndex");Ol.prototype.removeBillboard=function(e){const t=this._collectionIndicesByEntity&&this._collectionIndicesByEntity[e.id];if(!c(this._billboardCollection)||!c(t)||!c(t.billboardIndex))return;const n=t.billboardIndex;t.billboardIndex=void 0,n1(this,e.id);const i=this._billboardCollection.get(n);i.id=void 0,i.show=!1,i.image=void 0,this._unusedBillboardIndices.push(n),this._clusterDirty=!0};Ol.prototype.getPoint=t1("_pointCollection",ja,"_unusedPointIndices","pointIndex");Ol.prototype.removePoint=function(e){const t=this._collectionIndicesByEntity&&this._collectionIndicesByEntity[e.id];if(!c(this._pointCollection)||!c(t)||!c(t.pointIndex))return;const n=t.pointIndex;t.pointIndex=void 0,n1(this,e.id);const i=this._pointCollection.get(n);i.show=!1,i.id=void 0,this._unusedPointIndices.push(n),this._clusterDirty=!0};function JS(e){if(!c(e))return;const t=e.length;for(let n=0;n<t;++n)e.get(n).clusterShow=!0}function VIe(e){e.enabled||(c(e._clusterLabelCollection)&&e._clusterLabelCollection.destroy(),c(e._clusterBillboardCollection)&&e._clusterBillboardCollection.destroy(),c(e._clusterPointCollection)&&e._clusterPointCollection.destroy(),e._clusterLabelCollection=void 0,e._clusterBillboardCollection=void 0,e._clusterPointCollection=void 0,JS(e._labelCollection),JS(e._billboardCollection),JS(e._pointCollection))}Ol.prototype.update=function(e){if(!this.show)return;let t;c(this._labelCollection)&&this._labelCollection.length>0&&this._labelCollection.get(0)._glyphs.length===0&&(t=e.commandList,e.commandList=[],this._labelCollection.update(e),e.commandList=t),c(this._billboardCollection)&&this._billboardCollection.length>0&&!c(this._billboardCollection.get(0).width)&&(t=e.commandList,e.commandList=[],this._billboardCollection.update(e),e.commandList=t),this._enabledDirty&&(this._enabledDirty=!1,VIe(this),this._clusterDirty=!0),this._clusterDirty&&(this._clusterDirty=!1,this._cluster()),c(this._clusterLabelCollection)&&this._clusterLabelCollection.update(e),c(this._clusterBillboardCollection)&&this._clusterBillboardCollection.update(e),c(this._clusterPointCollection)&&this._clusterPointCollection.update(e),c(this._labelCollection)&&this._labelCollection.update(e),c(this._billboardCollection)&&this._billboardCollection.update(e),c(this._pointCollection)&&this._pointCollection.update(e)};Ol.prototype.destroy=function(){this._labelCollection=this._labelCollection&&this._labelCollection.destroy(),this._billboardCollection=this._billboardCollection&&this._billboardCollection.destroy(),this._pointCollection=this._pointCollection&&this._pointCollection.destroy(),this._clusterLabelCollection=this._clusterLabelCollection&&this._clusterLabelCollection.destroy(),this._clusterBillboardCollection=this._clusterBillboardCollection&&this._clusterBillboardCollection.destroy(),this._clusterPointCollection=this._clusterPointCollection&&this._clusterPointCollection.destroy(),c(this._removeEventListener)&&(this._removeEventListener(),this._removeEventListener=void 0),this._labelCollection=void 0,this._billboardCollection=void 0,this._pointCollection=void 0,this._clusterBillboardCollection=void 0,this._clusterLabelCollection=void 0,this._clusterPointCollection=void 0,this._collectionIndicesByEntity=void 0,this._unusedLabelIndices=[],this._unusedBillboardIndices=[],this._unusedPointIndices=[],this._previousClusters=[],this._previousHeight=void 0,this._enabledDirty=!1,this._pixelRangeDirty=!1,this._minimumClusterSizeDirty=!1};function i1(e){this._name=e,this._clock=void 0,this._changed=new Le,this._error=new Le,this._isLoading=!1,this._loading=new Le,this._entityCollection=new As(this),this._entityCluster=new Ol}Object.defineProperties(i1.prototype,{name:{get:function(){return this._name},set:function(e){this._name!==e&&(this._name=e,this._changed.raiseEvent(this))}},clock:{get:function(){return this._clock},set:function(e){this._clock!==e&&(this._clock=e,this._changed.raiseEvent(this))}},entities:{get:function(){return this._entityCollection}},isLoading:{get:function(){return this._isLoading},set:function(e){GC.setLoading(this,e)}},changedEvent:{get:function(){return this._changed}},errorEvent:{get:function(){return this._error}},loadingEvent:{get:function(){return this._loading}},show:{get:function(){return this._entityCollection.show},set:function(e){this._entityCollection.show=e}},clustering:{get:function(){return this._entityCluster},set:function(e){if(!c(e))throw new E("value must be defined.");this._entityCluster=e}}});i1.prototype.update=function(e){return!0};const KG={};KG.computePositions=function(e,t,n,i,o){const r=e*.5,s=-r,a=i+i,l=o?2*a:a,u=new Float64Array(l*3);let h,f=0,_=0;const g=o?a*3:0,m=o?(a+i)*3:i*3;for(h=0;h<i;h++){const b=h/i*R.TWO_PI,T=Math.cos(b),x=Math.sin(b),C=T*n,w=x*n,v=T*t,P=x*t;u[_+g]=C,u[_+g+1]=w,u[_+g+2]=s,u[_+m]=v,u[_+m+1]=P,u[_+m+2]=r,_+=3,o&&(u[f++]=C,u[f++]=w,u[f++]=s,u[f++]=v,u[f++]=P,u[f++]=r)}return u};const ZG=KG,ev=new H,HIe=new d,GIe=new d,jIe=new d,WIe=new d;function rd(e){e=y(e,y.EMPTY_OBJECT);const t=e.length,n=e.topRadius,i=e.bottomRadius,o=y(e.vertexFormat,Ee.DEFAULT),r=y(e.slices,128);if(!c(t))throw new E("options.length must be defined.");if(!c(n))throw new E("options.topRadius must be defined.");if(!c(i))throw new E("options.bottomRadius must be defined.");if(r<3)throw new E("options.slices must be greater than or equal to 3.");if(c(e.offsetAttribute)&&e.offsetAttribute===Kt.TOP)throw new E("GeometryOffsetAttribute.TOP is not a supported options.offsetAttribute for this geometry.");this._length=t,this._topRadius=n,this._bottomRadius=i,this._vertexFormat=Ee.clone(o),this._slices=r,this._offsetAttribute=e.offsetAttribute,this._workerName="createCylinderGeometry"}rd.packedLength=Ee.packedLength+5;rd.pack=function(e,t,n){if(!c(e))throw new E("value is required");if(!c(t))throw new E("array is required");return n=y(n,0),Ee.pack(e._vertexFormat,t,n),n+=Ee.packedLength,t[n++]=e._length,t[n++]=e._topRadius,t[n++]=e._bottomRadius,t[n++]=e._slices,t[n]=y(e._offsetAttribute,-1),t};const JG=new Ee,Tm={vertexFormat:JG,length:void 0,topRadius:void 0,bottomRadius:void 0,slices:void 0,offsetAttribute:void 0};rd.unpack=function(e,t,n){if(!c(e))throw new E("array is required");t=y(t,0);const i=Ee.unpack(e,t,JG);t+=Ee.packedLength;const o=e[t++],r=e[t++],s=e[t++],a=e[t++],l=e[t];return c(n)?(n._vertexFormat=Ee.clone(i,n._vertexFormat),n._length=o,n._topRadius=r,n._bottomRadius=s,n._slices=a,n._offsetAttribute=l===-1?void 0:l,n):(Tm.length=o,Tm.topRadius=r,Tm.bottomRadius=s,Tm.slices=a,Tm.offsetAttribute=l===-1?void 0:l,new rd(Tm))};rd.createGeometry=function(e){let t=e._length;const n=e._topRadius,i=e._bottomRadius,o=e._vertexFormat,r=e._slices;if(t<=0||n<0||i<0||n===0&&i===0)return;const s=r+r,a=r+s,l=s+s,u=ZG.computePositions(t,n,i,r,!0),h=o.st?new Float32Array(l*2):void 0,f=o.normal?new Float32Array(l*3):void 0,_=o.tangent?new Float32Array(l*3):void 0,g=o.bitangent?new Float32Array(l*3):void 0;let m;const b=o.normal||o.tangent||o.bitangent;if(b){const k=o.tangent||o.bitangent;let M=0,U=0,B=0;const S=Math.atan2(i-n,t),D=HIe;D.z=Math.sin(S);const p=Math.cos(S);let I=jIe,O=GIe;for(m=0;m<r;m++){const F=m/r*R.TWO_PI,V=p*Math.cos(F),G=p*Math.sin(F);b&&(D.x=V,D.y=G,k&&(I=d.normalize(d.cross(d.UNIT_Z,D,I),I)),o.normal&&(f[M++]=D.x,f[M++]=D.y,f[M++]=D.z,f[M++]=D.x,f[M++]=D.y,f[M++]=D.z),o.tangent&&(_[U++]=I.x,_[U++]=I.y,_[U++]=I.z,_[U++]=I.x,_[U++]=I.y,_[U++]=I.z),o.bitangent&&(O=d.normalize(d.cross(D,I,O),O),g[B++]=O.x,g[B++]=O.y,g[B++]=O.z,g[B++]=O.x,g[B++]=O.y,g[B++]=O.z))}for(m=0;m<r;m++)o.normal&&(f[M++]=0,f[M++]=0,f[M++]=-1),o.tangent&&(_[U++]=1,_[U++]=0,_[U++]=0),o.bitangent&&(g[B++]=0,g[B++]=-1,g[B++]=0);for(m=0;m<r;m++)o.normal&&(f[M++]=0,f[M++]=0,f[M++]=1),o.tangent&&(_[U++]=1,_[U++]=0,_[U++]=0),o.bitangent&&(g[B++]=0,g[B++]=1,g[B++]=0)}const T=12*r-12,x=je.createTypedArray(l,T);let C=0,w=0;for(m=0;m<r-1;m++)x[C++]=w,x[C++]=w+2,x[C++]=w+3,x[C++]=w,x[C++]=w+3,x[C++]=w+1,w+=2;for(x[C++]=s-2,x[C++]=0,x[C++]=1,x[C++]=s-2,x[C++]=1,x[C++]=s-1,m=1;m<r-1;m++)x[C++]=s+m+1,x[C++]=s+m,x[C++]=s;for(m=1;m<r-1;m++)x[C++]=a,x[C++]=a+m,x[C++]=a+m+1;let v=0;if(o.st){const k=Math.max(n,i);for(m=0;m<l;m++){const M=d.fromArray(u,m*3,WIe);h[v++]=(M.x+k)/(2*k),h[v++]=(M.y+k)/(2*k)}}const P=new oi;o.position&&(P.position=new Ie({componentDatatype:Z.DOUBLE,componentsPerAttribute:3,values:u})),o.normal&&(P.normal=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:3,values:f})),o.tangent&&(P.tangent=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:3,values:_})),o.bitangent&&(P.bitangent=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:3,values:g})),o.st&&(P.st=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:2,values:h})),ev.x=t*.5,ev.y=Math.max(i,n);const N=new se(d.ZERO,H.magnitude(ev));if(c(e._offsetAttribute)){t=u.length;const k=e._offsetAttribute===Kt.NONE?0:1,M=new Uint8Array(t/3).fill(k);P.applyOffset=new Ie({componentDatatype:Z.UNSIGNED_BYTE,componentsPerAttribute:1,values:M})}return new Tt({attributes:P,indices:x,primitiveType:ze.TRIANGLES,boundingSphere:N,offsetAttribute:e._offsetAttribute})};let tv;rd.getUnitCylinder=function(){return c(tv)||(tv=rd.createGeometry(new rd({topRadius:1,bottomRadius:1,length:1,vertexFormat:Ee.POSITION_ONLY}))),tv};const nv=new H;function O_(e){e=y(e,y.EMPTY_OBJECT);const t=e.length,n=e.topRadius,i=e.bottomRadius,o=y(e.slices,128),r=Math.max(y(e.numberOfVerticalLines,16),0);if(A.typeOf.number("options.positions",t),A.typeOf.number("options.topRadius",n),A.typeOf.number("options.bottomRadius",i),A.typeOf.number.greaterThanOrEquals("options.slices",o,3),c(e.offsetAttribute)&&e.offsetAttribute===Kt.TOP)throw new E("GeometryOffsetAttribute.TOP is not a supported options.offsetAttribute for this geometry.");this._length=t,this._topRadius=n,this._bottomRadius=i,this._slices=o,this._numberOfVerticalLines=r,this._offsetAttribute=e.offsetAttribute,this._workerName="createCylinderOutlineGeometry"}O_.packedLength=6;O_.pack=function(e,t,n){return A.typeOf.object("value",e),A.defined("array",t),n=y(n,0),t[n++]=e._length,t[n++]=e._topRadius,t[n++]=e._bottomRadius,t[n++]=e._slices,t[n++]=e._numberOfVerticalLines,t[n]=y(e._offsetAttribute,-1),t};const If={length:void 0,topRadius:void 0,bottomRadius:void 0,slices:void 0,numberOfVerticalLines:void 0,offsetAttribute:void 0};O_.unpack=function(e,t,n){A.defined("array",e),t=y(t,0);const i=e[t++],o=e[t++],r=e[t++],s=e[t++],a=e[t++],l=e[t];return c(n)?(n._length=i,n._topRadius=o,n._bottomRadius=r,n._slices=s,n._numberOfVerticalLines=a,n._offsetAttribute=l===-1?void 0:l,n):(If.length=i,If.topRadius=o,If.bottomRadius=r,If.slices=s,If.numberOfVerticalLines=a,If.offsetAttribute=l===-1?void 0:l,new O_(If))};O_.createGeometry=function(e){let t=e._length;const n=e._topRadius,i=e._bottomRadius,o=e._slices,r=e._numberOfVerticalLines;if(t<=0||n<0||i<0||n===0&&i===0)return;const s=o*2,a=ZG.computePositions(t,n,i,o,!1);let l=o*2,u;if(r>0){const b=Math.min(r,o);u=Math.round(o/b),l+=b}const h=je.createTypedArray(s,l*2);let f=0,_;for(_=0;_<o-1;_++)h[f++]=_,h[f++]=_+1,h[f++]=_+o,h[f++]=_+1+o;if(h[f++]=o-1,h[f++]=0,h[f++]=o+o-1,h[f++]=o,r>0)for(_=0;_<o;_+=u)h[f++]=_,h[f++]=_+o;const g=new oi;g.position=new Ie({componentDatatype:Z.DOUBLE,componentsPerAttribute:3,values:a}),nv.x=t*.5,nv.y=Math.max(i,n);const m=new se(d.ZERO,H.magnitude(nv));if(c(e._offsetAttribute)){t=a.length;const b=e._offsetAttribute===Kt.NONE?0:1,T=new Uint8Array(t/3).fill(b);g.applyOffset=new Ie({componentDatatype:Z.UNSIGNED_BYTE,componentsPerAttribute:1,values:T})}return new Tt({attributes:g,indices:h,primitiveType:ze.LINES,boundingSphere:m,offsetAttribute:e._offsetAttribute})};const ej=d.ZERO,tj=new d,qIe=new d,nj=new z;function YIe(e){this.id=e,this.vertexFormat=void 0,this.length=void 0,this.topRadius=void 0,this.bottomRadius=void 0,this.slices=void 0,this.numberOfVerticalLines=void 0,this.offsetAttribute=void 0}function Sa(e,t){dn.call(this,{entity:e,scene:t,geometryOptions:new YIe(e),geometryPropertyName:"cylinder",observedPropertyNames:["availability","position","orientation","cylinder"]}),this._onEntityPropertyChanged(e,"cylinder",e.cylinder,void 0)}c(Object.create)&&(Sa.prototype=Object.create(dn.prototype),Sa.prototype.constructor=Sa);Object.defineProperties(Sa.prototype,{terrainOffsetProperty:{get:function(){return this._terrainOffsetProperty}}});Sa.prototype.createFillGeometryInstance=function(e){if(A.defined("time",e),!this._fillEnabled)throw new E("This instance does not represent a filled geometry.");const t=this._entity,n=t.isAvailable(e),i=new mn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),o=this._distanceDisplayConditionProperty.getValue(e),r=Vn.fromDistanceDisplayCondition(o),s={show:i,distanceDisplayCondition:r,color:void 0,offset:void 0};if(this._materialProperty instanceof kt){let a;c(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(a=this._materialProperty.color.getValue(e,nj)),c(a)||(a=z.WHITE),s.color=$t.fromColor(a)}return c(this._options.offsetAttribute)&&(s.offset=Zi.fromCartesian3(K.getValueOrDefault(this._terrainOffsetProperty,e,ej,tj))),new Gt({id:t,geometry:new rd(this._options),modelMatrix:t.computeModelMatrixForHeightReference(e,t.cylinder.heightReference,this._options.length*.5,this._scene.mapProjection.ellipsoid),attributes:s})};Sa.prototype.createOutlineGeometryInstance=function(e){if(A.defined("time",e),!this._outlineEnabled)throw new E("This instance does not represent an outlined geometry.");const t=this._entity,n=t.isAvailable(e),i=K.getValueOrDefault(this._outlineColorProperty,e,z.BLACK,nj),o=this._distanceDisplayConditionProperty.getValue(e),r={show:new mn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:$t.fromColor(i),distanceDisplayCondition:Vn.fromDistanceDisplayCondition(o),offset:void 0};return c(this._options.offsetAttribute)&&(r.offset=Zi.fromCartesian3(K.getValueOrDefault(this._terrainOffsetProperty,e,ej,tj))),new Gt({id:t,geometry:new O_(this._options),modelMatrix:t.computeModelMatrixForHeightReference(e,t.cylinder.heightReference,this._options.length*.5,this._scene.mapProjection.ellipsoid),attributes:r})};Sa.prototype._computeCenter=function(e,t){return K.getValueOrUndefined(this._entity.position,e,t)};Sa.prototype._isHidden=function(e,t){return!c(e.position)||!c(t.length)||!c(t.topRadius)||!c(t.bottomRadius)||dn.prototype._isHidden.call(this,e,t)};Sa.prototype._isDynamic=function(e,t){return!e.position.isConstant||!K.isConstant(e.orientation)||!t.length.isConstant||!t.topRadius.isConstant||!t.bottomRadius.isConstant||!K.isConstant(t.slices)||!K.isConstant(t.outlineWidth)||!K.isConstant(t.numberOfVerticalLines)};Sa.prototype._setStaticOptions=function(e,t){const n=K.getValueOrDefault(t.heightReference,Ke.MINIMUM_VALUE,gt.NONE),i=this._options;i.vertexFormat=this._materialProperty instanceof kt?tn.VERTEX_FORMAT:oo.MaterialSupport.TEXTURED.vertexFormat,i.length=t.length.getValue(Ke.MINIMUM_VALUE),i.topRadius=t.topRadius.getValue(Ke.MINIMUM_VALUE),i.bottomRadius=t.bottomRadius.getValue(Ke.MINIMUM_VALUE),i.slices=K.getValueOrUndefined(t.slices,Ke.MINIMUM_VALUE),i.numberOfVerticalLines=K.getValueOrUndefined(t.numberOfVerticalLines,Ke.MINIMUM_VALUE),i.offsetAttribute=n!==gt.NONE?Kt.ALL:void 0};Sa.prototype._onEntityPropertyChanged=oO;Sa.DynamicGeometryUpdater=l_;function l_(e,t,n){On.call(this,e,t,n)}c(Object.create)&&(l_.prototype=Object.create(On.prototype),l_.prototype.constructor=l_);l_.prototype._isHidden=function(e,t,n){const i=this._options,o=K.getValueOrUndefined(e.position,n,qIe);return!c(o)||!c(i.length)||!c(i.topRadius)||!c(i.bottomRadius)||On.prototype._isHidden.call(this,e,t,n)};l_.prototype._setOptions=function(e,t,n){const i=K.getValueOrDefault(t.heightReference,n,gt.NONE),o=this._options;o.length=K.getValueOrUndefined(t.length,n),o.topRadius=K.getValueOrUndefined(t.topRadius,n),o.bottomRadius=K.getValueOrUndefined(t.bottomRadius,n),o.slices=K.getValueOrUndefined(t.slices,n),o.numberOfVerticalLines=K.getValueOrUndefined(t.numberOfVerticalLines,n),o.offsetAttribute=i!==gt.NONE?Kt.ALL:void 0};const $Ie={UNBOUNDED:0,CLAMPED:1,LOOP_STOP:2},rp=Object.freeze($Ie),XIe={TICK_DEPENDENT:0,SYSTEM_CLOCK_MULTIPLIER:1,SYSTEM_CLOCK:2},as=Object.freeze(XIe),QIe={NONE:0,HOLD:1,EXTRAPOLATE:2},Zm=Object.freeze(QIe),o1={type:"Linear"};o1.getRequiredDataPoints=function(e){return 2};o1.interpolateOrderZero=function(e,t,n,i,o){if(t.length!==2)throw new E("The xTable provided to the linear interpolator must have exactly two elements.");if(i<=0)throw new E("There must be at least 1 dependent variable for each independent variable.");c(o)||(o=new Array(i));let r,s,a;const l=t[0],u=t[1];if(l===u)throw new E("Divide by zero error: xTable[0] and xTable[1] are equal");for(r=0;r<i;r++)s=n[r],a=n[r+i],o[r]=((a-s)*e+u*s-l*a)/(u-l);return o};const KIe=o1;let AD;typeof performance<"u"&&typeof performance.now=="function"&&isFinite(performance.now())?AD=function(){return performance.now()}:AD=function(){return Date.now()};const xo=AD;function tb(e){e=y(e,y.EMPTY_OBJECT);let t=e.currentTime,n=e.startTime,i=e.stopTime;if(c(t)?t=ie.clone(t):c(n)?t=ie.clone(n):c(i)?t=ie.addDays(i,-1,new ie):t=ie.now(),c(n)?n=ie.clone(n):n=ie.clone(t),c(i)?i=ie.clone(i):i=ie.addDays(n,1,new ie),ie.greaterThan(n,i))throw new E("startTime must come before stopTime.");this.startTime=n,this.stopTime=i,this.clockRange=y(e.clockRange,rp.UNBOUNDED),this.canAnimate=y(e.canAnimate,!0),this.onTick=new Le,this.onStop=new Le,this._currentTime=void 0,this._multiplier=void 0,this._clockStep=void 0,this._shouldAnimate=void 0,this._lastSystemTime=xo(),this.currentTime=t,this.multiplier=y(e.multiplier,1),this.shouldAnimate=y(e.shouldAnimate,!1),this.clockStep=y(e.clockStep,as.SYSTEM_CLOCK_MULTIPLIER)}Object.defineProperties(tb.prototype,{currentTime:{get:function(){return this._currentTime},set:function(e){ie.equals(this._currentTime,e)||(this._clockStep===as.SYSTEM_CLOCK&&(this._clockStep=as.SYSTEM_CLOCK_MULTIPLIER),this._currentTime=e)}},multiplier:{get:function(){return this._multiplier},set:function(e){this._multiplier!==e&&(this._clockStep===as.SYSTEM_CLOCK&&(this._clockStep=as.SYSTEM_CLOCK_MULTIPLIER),this._multiplier=e)}},clockStep:{get:function(){return this._clockStep},set:function(e){e===as.SYSTEM_CLOCK&&(this._multiplier=1,this._shouldAnimate=!0,this._currentTime=ie.now()),this._clockStep=e}},shouldAnimate:{get:function(){return this._shouldAnimate},set:function(e){this._shouldAnimate!==e&&(this._clockStep===as.SYSTEM_CLOCK&&(this._clockStep=as.SYSTEM_CLOCK_MULTIPLIER),this._shouldAnimate=e)}}});tb.prototype.tick=function(){const e=xo();let t=ie.clone(this._currentTime);if(this.canAnimate&&this._shouldAnimate){const n=this._clockStep;if(n===as.SYSTEM_CLOCK)t=ie.now(t);else{const i=this._multiplier;if(n===as.TICK_DEPENDENT)t=ie.addSeconds(t,i,t);else{const a=e-this._lastSystemTime;t=ie.addSeconds(t,i*(a/1e3),t)}const o=this.clockRange,r=this.startTime,s=this.stopTime;if(o===rp.CLAMPED)ie.lessThan(t,r)?t=ie.clone(r,t):ie.greaterThan(t,s)&&(t=ie.clone(s,t),this.onStop.raiseEvent(this));else if(o===rp.LOOP_STOP)for(ie.lessThan(t,r)&&(t=ie.clone(r,t));ie.greaterThan(t,s);)t=ie.addSeconds(r,ie.secondsDifference(t,s),t),this.onStop.raiseEvent(this)}}return this._currentTime=t,this._lastSystemTime=e,this.onTick.raiseEvent(this),t};function sp(e){let t=e._targetProperty;if(!c(t)){let n=e._targetEntity;if(!c(n)){if(n=e._targetCollection.getById(e._targetId),!c(n)){e._targetEntity=e._targetProperty=void 0;return}n.definitionChanged.addEventListener(Ua.prototype._onTargetEntityDefinitionChanged,e),e._targetEntity=n}const i=e._targetPropertyNames;t=e._targetEntity;for(let o=0,r=i.length;o<r&&c(t);++o)t=t[i[o]];e._targetProperty=t}return t}function Ua(e,t,n){if(!c(e))throw new E("targetCollection is required.");if(!c(t)||t==="")throw new E("targetId is required.");if(!c(n)||n.length===0)throw new E("targetPropertyNames is required.");for(let i=0;i<n.length;i++){const o=n[i];if(!c(o)||o==="")throw new E("reference contains invalid properties.")}this._targetCollection=e,this._targetId=t,this._targetPropertyNames=n,this._targetProperty=void 0,this._targetEntity=void 0,this._definitionChanged=new Le,e.collectionChanged.addEventListener(Ua.prototype._onCollectionChanged,this)}Object.defineProperties(Ua.prototype,{isConstant:{get:function(){return K.isConstant(sp(this))}},definitionChanged:{get:function(){return this._definitionChanged}},referenceFrame:{get:function(){const e=sp(this);return c(e)?e.referenceFrame:void 0}},targetId:{get:function(){return this._targetId}},targetCollection:{get:function(){return this._targetCollection}},targetPropertyNames:{get:function(){return this._targetPropertyNames}},resolvedProperty:{get:function(){return sp(this)}}});Ua.fromString=function(e,t){if(!c(e))throw new E("targetCollection is required.");if(!c(t))throw new E("referenceString is required.");let n;const i=[];let o=!0,r=!1,s="";for(let a=0;a<t.length;++a){const l=t.charAt(a);r?(s+=l,r=!1):l==="\\"?r=!0:o&&l==="#"?(n=s,o=!1,s=""):!o&&l==="."?(i.push(s),s=""):s+=l}return i.push(s),new Ua(e,n,i)};Ua.prototype.getValue=function(e,t){const n=sp(this);return c(n)?n.getValue(e,t):void 0};Ua.prototype.getValueInReferenceFrame=function(e,t,n){const i=sp(this);return c(i)?i.getValueInReferenceFrame(e,t,n):void 0};Ua.prototype.getType=function(e){const t=sp(this);return c(t)?t.getType(e):void 0};Ua.prototype.equals=function(e){if(this===e)return!0;const t=this._targetPropertyNames,n=e._targetPropertyNames;if(this._targetCollection!==e._targetCollection||this._targetId!==e._targetId||t.length!==n.length)return!1;const i=this._targetPropertyNames.length;for(let o=0;o<i;o++)if(t[o]!==n[o])return!1;return!0};Ua.prototype._onTargetEntityDefinitionChanged=function(e,t,n,i){c(this._targetProperty)&&this._targetPropertyNames[0]===t&&(this._targetProperty=void 0,this._definitionChanged.raiseEvent(this))};Ua.prototype._onCollectionChanged=function(e,t,n){let i=this._targetEntity;c(i)&&n.indexOf(i)!==-1?(i.definitionChanged.removeEventListener(Ua.prototype._onTargetEntityDefinitionChanged,this),this._targetEntity=this._targetProperty=void 0):c(i)||(i=sp(this),c(i)&&this._definitionChanged.raiseEvent(this))};const P2={packedLength:1,pack:function(e,t,n){n=y(n,0),t[n]=e},unpack:function(e,t,n){return t=y(t,0),e[t]}};function O2(e,t,n){let i;const o=e.length,r=n.length,s=o+r;if(e.length=s,o!==t){let a=o-1;for(i=s-1;i>=t;i--)e[i]=e[a--]}for(i=0;i<r;i++)e[t++]=n[i]}function L2(e,t){return e instanceof ie?e:typeof e=="string"?ie.fromIso8601(e):ie.addSeconds(t,e,new ie)}const iv=[],ov=[];function jC(e,t,n,i,o){let r=0,s,a,l,u,h,f;for(;r<i.length;){h=L2(i[r],e),l=Hr(t,h,ie.compare);let _=0,g=0;if(l<0){for(l=~l,u=l*o,a=void 0,f=t[l];r<i.length&&(h=L2(i[r],e),!(c(a)&&ie.compare(a,h)>=0||c(f)&&ie.compare(h,f)>=0));){for(iv[_++]=h,r=r+1,s=0;s<o;s++)ov[g++]=i[r],r=r+1;a=h}_>0&&(ov.length=g,O2(n,u,ov),iv.length=_,O2(t,l,iv))}else{for(s=0;s<o;s++)r++,n[l*o+s]=i[r];r++}}}function Ll(e,t){A.defined("type",e);let n=e;n===Number&&(n=P2);let i=n.packedLength,o=y(n.packedInterpolationLength,i),r=0,s;if(c(t)){const a=t.length;s=new Array(a);for(let l=0;l<a;l++){let u=t[l];u===Number&&(u=P2);const h=u.packedLength;i+=h,o+=y(u.packedInterpolationLength,h),s[l]=u}r=a}this._type=e,this._innerType=n,this._interpolationDegree=1,this._interpolationAlgorithm=KIe,this._numberOfPoints=0,this._times=[],this._values=[],this._xTable=[],this._yTable=[],this._packedLength=i,this._packedInterpolationLength=o,this._updateTableLength=!0,this._interpolationResult=new Array(o),this._definitionChanged=new Le,this._derivativeTypes=t,this._innerDerivativeTypes=s,this._inputOrder=r,this._forwardExtrapolationType=Zm.NONE,this._forwardExtrapolationDuration=0,this._backwardExtrapolationType=Zm.NONE,this._backwardExtrapolationDuration=0}Object.defineProperties(Ll.prototype,{isConstant:{get:function(){return this._values.length===0}},definitionChanged:{get:function(){return this._definitionChanged}},type:{get:function(){return this._type}},derivativeTypes:{get:function(){return this._derivativeTypes}},interpolationDegree:{get:function(){return this._interpolationDegree}},interpolationAlgorithm:{get:function(){return this._interpolationAlgorithm}},forwardExtrapolationType:{get:function(){return this._forwardExtrapolationType},set:function(e){this._forwardExtrapolationType!==e&&(this._forwardExtrapolationType=e,this._definitionChanged.raiseEvent(this))}},forwardExtrapolationDuration:{get:function(){return this._forwardExtrapolationDuration},set:function(e){this._forwardExtrapolationDuration!==e&&(this._forwardExtrapolationDuration=e,this._definitionChanged.raiseEvent(this))}},backwardExtrapolationType:{get:function(){return this._backwardExtrapolationType},set:function(e){this._backwardExtrapolationType!==e&&(this._backwardExtrapolationType=e,this._definitionChanged.raiseEvent(this))}},backwardExtrapolationDuration:{get:function(){return this._backwardExtrapolationDuration},set:function(e){this._backwardExtrapolationDuration!==e&&(this._backwardExtrapolationDuration=e,this._definitionChanged.raiseEvent(this))}}});Ll.prototype.getValue=function(e,t){A.defined("time",e);const n=this._times,i=n.length;if(i===0)return;let o;const r=this._innerType,s=this._values;let a=Hr(n,e,ie.compare);if(a<0){if(a=~a,a===0){const v=n[a];if(o=this._backwardExtrapolationDuration,this._backwardExtrapolationType===Zm.NONE||o!==0&&ie.secondsDifference(v,e)>o)return;if(this._backwardExtrapolationType===Zm.HOLD)return r.unpack(s,0,t)}if(a>=i){a=i-1;const v=n[a];if(o=this._forwardExtrapolationDuration,this._forwardExtrapolationType===Zm.NONE||o!==0&&ie.secondsDifference(e,v)>o)return;if(this._forwardExtrapolationType===Zm.HOLD)return a=i-1,r.unpack(s,a*r.packedLength,t)}const l=this._xTable,u=this._yTable,h=this._interpolationAlgorithm,f=this._packedInterpolationLength,_=this._inputOrder;if(this._updateTableLength){this._updateTableLength=!1;const v=Math.min(h.getRequiredDataPoints(this._interpolationDegree,_),i);v!==this._numberOfPoints&&(this._numberOfPoints=v,l.length=v,u.length=v*f)}const g=this._numberOfPoints-1;if(g<1)return;let m=0,b=i-1;if(b-m+1>=g+1){let v=a-(g/2|0)-1;v<m&&(v=m);let P=v+g;P>b&&(P=b,v=P-g,v<m&&(v=m)),m=v,b=P}const x=b-m+1;for(let v=0;v<x;++v)l[v]=ie.secondsDifference(n[m+v],n[b]);if(c(r.convertPackedArrayForInterpolation))r.convertPackedArrayForInterpolation(s,m,b,u);else{let v=0;const P=this._packedLength;let N=m*P;const k=(b+1)*P;for(;N<k;)u[v]=s[N],N++,v++}const C=ie.secondsDifference(e,n[b]);let w;if(_===0||!c(h.interpolate))w=h.interpolateOrderZero(C,l,u,f,this._interpolationResult);else{const v=Math.floor(f/(_+1));w=h.interpolate(C,l,u,v,_,_,this._interpolationResult)}return c(r.unpackInterpolationResult)?r.unpackInterpolationResult(w,s,m,b,t):r.unpack(w,0,t)}return r.unpack(s,a*this._packedLength,t)};Ll.prototype.setInterpolationOptions=function(e){if(!c(e))return;let t=!1;const n=e.interpolationAlgorithm,i=e.interpolationDegree;c(n)&&this._interpolationAlgorithm!==n&&(this._interpolationAlgorithm=n,t=!0),c(i)&&this._interpolationDegree!==i&&(this._interpolationDegree=i,t=!0),t&&(this._updateTableLength=!0,this._definitionChanged.raiseEvent(this))};Ll.prototype.addSample=function(e,t,n){const i=this._innerDerivativeTypes,o=c(i);A.defined("time",e),A.defined("value",t),o&&A.defined("derivatives",n);const r=this._innerType,s=[];if(s.push(e),r.pack(t,s,s.length),o){const a=i.length;for(let l=0;l<a;l++)i[l].pack(n[l],s,s.length)}jC(void 0,this._times,this._values,s,this._packedLength),this._updateTableLength=!0,this._definitionChanged.raiseEvent(this)};Ll.prototype.addSamples=function(e,t,n){const i=this._innerDerivativeTypes,o=c(i);if(A.defined("times",e),A.defined("values",t),e.length!==t.length)throw new E("times and values must be the same length.");if(o&&(!c(n)||n.length!==e.length))throw new E("times and derivativeValues must be the same length.");const r=this._innerType,s=e.length,a=[];for(let l=0;l<s;l++)if(a.push(e[l]),r.pack(t[l],a,a.length),o){const u=n[l],h=i.length;for(let f=0;f<h;f++)i[f].pack(u[f],a,a.length)}jC(void 0,this._times,this._values,a,this._packedLength),this._updateTableLength=!0,this._definitionChanged.raiseEvent(this)};Ll.prototype.addSamplesPackedArray=function(e,t){A.defined("packedSamples",e),jC(t,this._times,this._values,e,this._packedLength),this._updateTableLength=!0,this._definitionChanged.raiseEvent(this)};Ll.prototype.removeSample=function(e){A.defined("time",e);const t=Hr(this._times,e,ie.compare);return t<0?!1:(ij(this,t,1),!0)};function ij(e,t,n){const i=e._packedLength;e._times.splice(t,n),e._values.splice(t*i,n*i),e._updateTableLength=!0,e._definitionChanged.raiseEvent(e)}Ll.prototype.removeSamples=function(e){A.defined("timeInterval",e);const t=this._times;let n=Hr(t,e.start,ie.compare);n<0?n=~n:e.isStartIncluded||++n;let i=Hr(t,e.stop,ie.compare);i<0?i=~i:e.isStopIncluded&&++i,ij(this,n,i-n)};Ll.prototype.equals=function(e){if(this===e)return!0;if(!c(e)||this._type!==e._type||this._interpolationDegree!==e._interpolationDegree||this._interpolationAlgorithm!==e._interpolationAlgorithm)return!1;const t=this._derivativeTypes,n=c(t),i=e._derivativeTypes,o=c(i);if(n!==o)return!1;let r,s;if(n){if(s=t.length,s!==i.length)return!1;for(r=0;r<s;r++)if(t[r]!==i[r])return!1}const a=this._times,l=e._times;if(s=a.length,s!==l.length)return!1;for(r=0;r<s;r++)if(!ie.equals(a[r],l[r]))return!1;const u=this._values,h=e._values;for(s=u.length,r=0;r<s;r++)if(u[r]!==h[r])return!1;return!0};Ll._mergeNewSamples=jC;function Lc(e,t){t=y(t,0);let n;if(t>0){n=new Array(t);for(let i=0;i<t;i++)n[i]=d}this._numberOfDerivatives=t,this._property=new Ll(d,n),this._definitionChanged=new Le,this._referenceFrame=y(e,Bs.FIXED),this._property._definitionChanged.addEventListener(function(){this._definitionChanged.raiseEvent(this)},this)}Object.defineProperties(Lc.prototype,{isConstant:{get:function(){return this._property.isConstant}},definitionChanged:{get:function(){return this._definitionChanged}},referenceFrame:{get:function(){return this._referenceFrame}},interpolationDegree:{get:function(){return this._property.interpolationDegree}},interpolationAlgorithm:{get:function(){return this._property.interpolationAlgorithm}},numberOfDerivatives:{get:function(){return this._numberOfDerivatives}},forwardExtrapolationType:{get:function(){return this._property.forwardExtrapolationType},set:function(e){this._property.forwardExtrapolationType=e}},forwardExtrapolationDuration:{get:function(){return this._property.forwardExtrapolationDuration},set:function(e){this._property.forwardExtrapolationDuration=e}},backwardExtrapolationType:{get:function(){return this._property.backwardExtrapolationType},set:function(e){this._property.backwardExtrapolationType=e}},backwardExtrapolationDuration:{get:function(){return this._property.backwardExtrapolationDuration},set:function(e){this._property.backwardExtrapolationDuration=e}}});Lc.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,Bs.FIXED,t)};Lc.prototype.getValueInReferenceFrame=function(e,t,n){if(A.defined("time",e),A.defined("referenceFrame",t),n=this._property.getValue(e,n),c(n))return Kh.convertToReferenceFrame(e,n,this._referenceFrame,t,n)};Lc.prototype.setInterpolationOptions=function(e){this._property.setInterpolationOptions(e)};Lc.prototype.addSample=function(e,t,n){const i=this._numberOfDerivatives;if(i>0&&(!c(n)||n.length!==i))throw new E("derivatives length must be equal to the number of derivatives.");this._property.addSample(e,t,n)};Lc.prototype.addSamples=function(e,t,n){this._property.addSamples(e,t,n)};Lc.prototype.addSamplesPackedArray=function(e,t){this._property.addSamplesPackedArray(e,t)};Lc.prototype.removeSample=function(e){return this._property.removeSample(e)};Lc.prototype.removeSamples=function(e){this._property.removeSamples(e)};Lc.prototype.equals=function(e){return this===e||e instanceof Lc&&K.equals(this._property,e._property)&&this._referenceFrame===e._referenceFrame};function Uh(e){this._definitionChanged=new Le,this._intervals=new Ji,this._intervals.changedEvent.addEventListener(Uh.prototype._intervalsChanged,this),this._referenceFrame=y(e,Bs.FIXED)}Object.defineProperties(Uh.prototype,{isConstant:{get:function(){return this._intervals.isEmpty}},definitionChanged:{get:function(){return this._definitionChanged}},intervals:{get:function(){return this._intervals}},referenceFrame:{get:function(){return this._referenceFrame}}});Uh.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,Bs.FIXED,t)};Uh.prototype.getValueInReferenceFrame=function(e,t,n){if(!c(e))throw new E("time is required.");if(!c(t))throw new E("referenceFrame is required.");const i=this._intervals.findDataForIntervalContainingDate(e);if(c(i))return Kh.convertToReferenceFrame(e,i,this._referenceFrame,t,n)};Uh.prototype.equals=function(e){return this===e||e instanceof Uh&&this._intervals.equals(e._intervals,K.equals)&&this._referenceFrame===e._referenceFrame};Uh.prototype._intervalsChanged=function(){this._definitionChanged.raiseEvent(this)};function Gs(){this._dataSources=[],this._dataSourceAdded=new Le,this._dataSourceRemoved=new Le,this._dataSourceMoved=new Le}Object.defineProperties(Gs.prototype,{length:{get:function(){return this._dataSources.length}},dataSourceAdded:{get:function(){return this._dataSourceAdded}},dataSourceRemoved:{get:function(){return this._dataSourceRemoved}},dataSourceMoved:{get:function(){return this._dataSourceMoved}}});Gs.prototype.add=function(e){if(!c(e))throw new E("dataSource is required.");const t=this,n=this._dataSources;return Promise.resolve(e).then(function(i){return n===t._dataSources&&(t._dataSources.push(i),t._dataSourceAdded.raiseEvent(t,i)),i})};Gs.prototype.remove=function(e,t){t=y(t,!1);const n=this._dataSources.indexOf(e);return n!==-1?(this._dataSources.splice(n,1),this._dataSourceRemoved.raiseEvent(this,e),t&&typeof e.destroy=="function"&&e.destroy(),!0):!1};Gs.prototype.removeAll=function(e){e=y(e,!1);const t=this._dataSources;for(let n=0,i=t.length;n<i;++n){const o=t[n];this._dataSourceRemoved.raiseEvent(this,o),e&&typeof o.destroy=="function"&&o.destroy()}this._dataSources=[]};Gs.prototype.contains=function(e){return this.indexOf(e)!==-1};Gs.prototype.indexOf=function(e){return this._dataSources.indexOf(e)};Gs.prototype.get=function(e){if(!c(e))throw new E("index is required.");return this._dataSources[e]};Gs.prototype.getByName=function(e){if(!c(e))throw new E("name is required.");return this._dataSources.filter(function(t){return t.name===e})};function WC(e,t){if(!c(t))throw new E("dataSource is required.");const n=e.indexOf(t);if(n===-1)throw new E("dataSource is not in this collection.");return n}function oj(e,t,n){const i=e._dataSources,o=i.length-1;if(t=R.clamp(t,0,o),n=R.clamp(n,0,o),t===n)return;const r=i[t];i[t]=i[n],i[n]=r,e.dataSourceMoved.raiseEvent(r,n,t)}Gs.prototype.raise=function(e){const t=WC(this._dataSources,e);oj(this,t,t+1)};Gs.prototype.lower=function(e){const t=WC(this._dataSources,e);oj(this,t,t-1)};Gs.prototype.raiseToTop=function(e){const t=WC(this._dataSources,e);t!==this._dataSources.length-1&&(this._dataSources.splice(t,1),this._dataSources.push(e),this.dataSourceMoved.raiseEvent(e,this._dataSources.length-1,t))};Gs.prototype.lowerToBottom=function(e){const t=WC(this._dataSources,e);t!==0&&(this._dataSources.splice(t,1),this._dataSources.splice(0,0,e),this.dataSourceMoved.raiseEvent(e,0,t))};Gs.prototype.isDestroyed=function(){return!1};Gs.prototype.destroy=function(){return this.removeAll(!0),ve(this)};function eo(e){e=y(e,y.EMPTY_OBJECT),this._primitives=[],this._guid=Wr(),this._primitiveAdded=new Le,this._primitiveRemoved=new Le,this._zIndex=void 0,this.show=y(e.show,!0),this.destroyPrimitives=y(e.destroyPrimitives,!0)}Object.defineProperties(eo.prototype,{length:{get:function(){return this._primitives.length}},primitiveAdded:{get:function(){return this._primitiveAdded}},primitiveRemoved:{get:function(){return this._primitiveRemoved}}});eo.prototype.add=function(e,t){const n=c(t);if(!c(e))throw new E("primitive is required.");if(n){if(t<0)throw new E("index must be greater than or equal to zero.");if(t>this._primitives.length)throw new E("index must be less than or equal to the number of primitives.")}const i=e._external=e._external||{},o=i._composites=i._composites||{};return o[this._guid]={collection:this},n?this._primitives.splice(t,0,e):this._primitives.push(e),this._primitiveAdded.raiseEvent(e),e};eo.prototype.remove=function(e){if(this.contains(e)){const t=this._primitives.indexOf(e);if(t!==-1)return this._primitives.splice(t,1),delete e._external._composites[this._guid],this.destroyPrimitives&&e.destroy(),this._primitiveRemoved.raiseEvent(e),!0}return!1};eo.prototype.removeAndDestroy=function(e){const t=this.remove(e);return t&&!this.destroyPrimitives&&e.destroy(),t};eo.prototype.removeAll=function(){const e=this._primitives,t=e.length;for(let n=0;n<t;++n)delete e[n]._external._composites[this._guid],this.destroyPrimitives&&e[n].destroy(),this._primitiveRemoved.raiseEvent(e[n]);this._primitives=[]};eo.prototype.contains=function(e){return!!(c(e)&&e._external&&e._external._composites&&e._external._composites[this._guid])};function qC(e,t){if(!e.contains(t))throw new E("primitive is not in this collection.");return e._primitives.indexOf(t)}eo.prototype.raise=function(e){if(c(e)){const t=qC(this,e),n=this._primitives;if(t!==n.length-1){const i=n[t];n[t]=n[t+1],n[t+1]=i}}};eo.prototype.raiseToTop=function(e){if(c(e)){const t=qC(this,e),n=this._primitives;t!==n.length-1&&(n.splice(t,1),n.push(e))}};eo.prototype.lower=function(e){if(c(e)){const t=qC(this,e),n=this._primitives;if(t!==0){const i=n[t];n[t]=n[t-1],n[t-1]=i}}};eo.prototype.lowerToBottom=function(e){if(c(e)){const t=qC(this,e),n=this._primitives;t!==0&&(n.splice(t,1),n.unshift(e))}};eo.prototype.get=function(e){if(!c(e))throw new E("index is required.");return this._primitives[e]};eo.prototype.update=function(e){if(!this.show)return;const t=this._primitives;for(let n=0;n<t.length;++n)t[n].update(e)};eo.prototype.prePassesUpdate=function(e){const t=this._primitives;for(let n=0;n<t.length;++n){const i=t[n];c(i.prePassesUpdate)&&i.prePassesUpdate(e)}};eo.prototype.updateForPass=function(e,t){const n=this._primitives;for(let i=0;i<n.length;++i){const o=n[i];c(o.updateForPass)&&o.updateForPass(e,t)}};eo.prototype.postPassesUpdate=function(e){const t=this._primitives;for(let n=0;n<t.length;++n){const i=t[n];c(i.postPassesUpdate)&&i.postPassesUpdate(e)}};eo.prototype.isDestroyed=function(){return!1};eo.prototype.destroy=function(){return this.removeAll(),ve(this)};function Au(){this._length=0,this._collections={},this._collectionsArray=[],this.show=!0}Object.defineProperties(Au.prototype,{length:{get:function(){return this._length}}});Au.prototype.add=function(e,t){A.defined("primitive",e),c(t)&&A.typeOf.number("zIndex",t),t=y(t,0);let n=this._collections[t];if(!c(n)){n=new eo({destroyPrimitives:!1}),n._zIndex=t,this._collections[t]=n;const i=this._collectionsArray;let o=0;for(;o<i.length&&i[o]._zIndex<t;)o++;i.splice(o,0,n)}return n.add(e),this._length++,e._zIndex=t,e};Au.prototype.set=function(e,t){return A.defined("primitive",e),A.typeOf.number("zIndex",t),t===e._zIndex||(this.remove(e,!0),this.add(e,t)),e};Au.prototype.remove=function(e,t){if(this.contains(e)){const n=e._zIndex,i=this._collections[n];let o;return t?o=i.remove(e):o=i.removeAndDestroy(e),o&&this._length--,i.length===0&&(this._collectionsArray.splice(this._collectionsArray.indexOf(i),1),this._collections[n]=void 0,i.destroy()),o}return!1};Au.prototype.removeAll=function(){const e=this._collectionsArray;for(let t=0;t<e.length;t++){const n=e[t];n.destroyPrimitives=!0,n.destroy()}this._collections={},this._collectionsArray=[],this._length=0};Au.prototype.contains=function(e){if(!c(e))return!1;const t=this._collections[e._zIndex];return c(t)&&t.contains(e)};Au.prototype.update=function(e){if(!this.show)return;const t=this._collectionsArray;for(let n=0;n<t.length;n++)t[n].update(e)};Au.prototype.isDestroyed=function(){return!1};Au.prototype.destroy=function(){return this.removeAll(),ve(this)};function Hp(e,t){this._primitives=e,this._orderedGroundPrimitives=t,this._dynamicUpdaters=new mt}Hp.prototype.add=function(e,t){this._dynamicUpdaters.set(t.id,t.createDynamicUpdater(this._primitives,this._orderedGroundPrimitives))};Hp.prototype.remove=function(e){const t=e.id,n=this._dynamicUpdaters.get(t);c(n)&&(this._dynamicUpdaters.remove(t),n.destroy())};Hp.prototype.update=function(e){const t=this._dynamicUpdaters.values;for(let n=0,i=t.length;n<i;n++)t[n].update(e);return!0};Hp.prototype.removeAllPrimitives=function(){const e=this._dynamicUpdaters.values;for(let t=0,n=e.length;t<n;t++)e[t].destroy();this._dynamicUpdaters.removeAll()};Hp.prototype.getBoundingSphere=function(e,t){return e=this._dynamicUpdaters.get(e.id),c(e)&&c(e.getBoundingSphere)?e.getBoundingSphere(t):rt.FAILED};const r1={},RT=new d,R2=new d,N2=new _e,M2=new $;function Am(e,t,n,i,o,r,s,a,l,u){const h=e+t;d.multiplyByScalar(i,Math.cos(h),RT),d.multiplyByScalar(n,Math.sin(h),R2),d.add(RT,R2,RT);let f=Math.cos(e);f=f*f;let _=Math.sin(e);_=_*_;const m=r/Math.sqrt(s*f+o*_)/a;return _e.fromAxisAngle(RT,m,N2),$.fromQuaternion(N2,M2),$.multiplyByVector(M2,l,u),d.normalize(u,u),d.multiplyByScalar(u,a,u),u}const rj=new d,sj=new d,xD=new d,ZIe=new d;r1.raisePositionsToHeight=function(e,t,n){const i=t.ellipsoid,o=t.height,r=t.extrudedHeight,s=n?e.length/3*2:e.length/3,a=new Float64Array(s*3),l=e.length,u=n?l:0;for(let h=0;h<l;h+=3){const f=h+1,_=h+2,g=d.fromArray(e,h,rj);i.scaleToGeodeticSurface(g,g);const m=d.clone(g,sj),b=i.geodeticSurfaceNormal(g,ZIe),T=d.multiplyByScalar(b,o,xD);d.add(g,T,g),n&&(d.multiplyByScalar(b,r,T),d.add(m,T,m),a[h+u]=m.x,a[f+u]=m.y,a[_+u]=m.z),a[h]=g.x,a[f]=g.y,a[_]=g.z}return a};const JIe=new d,eDe=new d,tDe=new d;r1.computeEllipsePositions=function(e,t,n){const i=e.semiMinorAxis,o=e.semiMajorAxis,r=e.rotation,s=e.center,a=e.granularity*8,l=i*i,u=o*o,h=o*i,f=d.magnitude(s),_=d.normalize(s,JIe);let g=d.cross(d.UNIT_Z,s,eDe);g=d.normalize(g,g);const m=d.cross(_,g,tDe);let b=1+Math.ceil(R.PI_OVER_TWO/a);const T=R.PI_OVER_TWO/(b-1);let x=R.PI_OVER_TWO-b*T;x<0&&(b-=Math.ceil(Math.abs(x)/T));const C=2*(b*(b+2)),w=t?new Array(C*3):void 0;let v=0,P=rj,N=sj;const k=b*4*3;let M=k-1,U=0;const B=n?new Array(k):void 0;let S,D,p,I,O;for(x=R.PI_OVER_TWO,P=Am(x,r,m,g,l,h,u,f,_,P),t&&(w[v++]=P.x,w[v++]=P.y,w[v++]=P.z),n&&(B[M--]=P.z,B[M--]=P.y,B[M--]=P.x),x=R.PI_OVER_TWO-T,S=1;S<b+1;++S){if(P=Am(x,r,m,g,l,h,u,f,_,P),N=Am(Math.PI-x,r,m,g,l,h,u,f,_,N),t){for(w[v++]=P.x,w[v++]=P.y,w[v++]=P.z,p=2*S+2,D=1;D<p-1;++D)I=D/(p-1),O=d.lerp(P,N,I,xD),w[v++]=O.x,w[v++]=O.y,w[v++]=O.z;w[v++]=N.x,w[v++]=N.y,w[v++]=N.z}n&&(B[M--]=P.z,B[M--]=P.y,B[M--]=P.x,B[U++]=N.x,B[U++]=N.y,B[U++]=N.z),x=R.PI_OVER_TWO-(S+1)*T}for(S=b;S>1;--S){if(x=R.PI_OVER_TWO-(S-1)*T,P=Am(-x,r,m,g,l,h,u,f,_,P),N=Am(x+Math.PI,r,m,g,l,h,u,f,_,N),t){for(w[v++]=P.x,w[v++]=P.y,w[v++]=P.z,p=2*(S-1)+2,D=1;D<p-1;++D)I=D/(p-1),O=d.lerp(P,N,I,xD),w[v++]=O.x,w[v++]=O.y,w[v++]=O.z;w[v++]=N.x,w[v++]=N.y,w[v++]=N.z}n&&(B[M--]=P.z,B[M--]=P.y,B[M--]=P.x,B[U++]=N.x,B[U++]=N.y,B[U++]=N.z)}x=R.PI_OVER_TWO,P=Am(-x,r,m,g,l,h,u,f,_,P);const F={};return t&&(w[v++]=P.x,w[v++]=P.y,w[v++]=P.z,F.positions=w,F.numPts=b),n&&(B[M--]=P.z,B[M--]=P.y,B[M--]=P.x,F.outerPositions=B),F};const pd=r1,L_=new d,CD=new d,ED=new d,F2=new d,zo=new H,aj=new $,nDe=new $,wD=new _e,cj=new d,lj=new d,uj=new d,Zx=new he,dj=new d,hj=new H,fj=new H;function pj(e,t,n){const i=t.vertexFormat,o=t.center,r=t.semiMajorAxis,s=t.semiMinorAxis,a=t.ellipsoid,l=t.stRotation,u=n?e.length/3*2:e.length/3,h=t.shadowVolume,f=i.st?new Float32Array(u*2):void 0,_=i.normal?new Float32Array(u*3):void 0,g=i.tangent?new Float32Array(u*3):void 0,m=i.bitangent?new Float32Array(u*3):void 0,b=h?new Float32Array(u*3):void 0;let T=0,x=cj,C=lj,w=uj;const v=new co(a),P=v.project(a.cartesianToCartographic(o,Zx),dj),N=a.scaleToGeodeticSurface(o,L_);a.geodeticSurfaceNormal(N,N);let k=aj,M=nDe;if(l!==0){let O=_e.fromAxisAngle(N,l,wD);k=$.fromQuaternion(O,k),O=_e.fromAxisAngle(N,-l,wD),M=$.fromQuaternion(O,M)}else k=$.clone($.IDENTITY,k),M=$.clone($.IDENTITY,M);const U=H.fromElements(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,hj),B=H.fromElements(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,fj);let S=e.length;const D=n?S:0,p=D/3*2;for(let O=0;O<S;O+=3){const F=O+1,V=O+2,G=d.fromArray(e,O,L_);if(i.st){const j=$.multiplyByVector(k,G,CD),W=v.project(a.cartesianToCartographic(j,Zx),ED);d.subtract(W,P,W),zo.x=(W.x+r)/(2*r),zo.y=(W.y+s)/(2*s),U.x=Math.min(zo.x,U.x),U.y=Math.min(zo.y,U.y),B.x=Math.max(zo.x,B.x),B.y=Math.max(zo.y,B.y),n&&(f[T+p]=zo.x,f[T+1+p]=zo.y),f[T++]=zo.x,f[T++]=zo.y}(i.normal||i.tangent||i.bitangent||h)&&(x=a.geodeticSurfaceNormal(G,x),h&&(b[O+D]=-x.x,b[F+D]=-x.y,b[V+D]=-x.z),(i.normal||i.tangent||i.bitangent)&&((i.tangent||i.bitangent)&&(C=d.normalize(d.cross(d.UNIT_Z,x,C),C),$.multiplyByVector(M,C,C)),i.normal&&(_[O]=x.x,_[F]=x.y,_[V]=x.z,n&&(_[O+D]=-x.x,_[F+D]=-x.y,_[V+D]=-x.z)),i.tangent&&(g[O]=C.x,g[F]=C.y,g[V]=C.z,n&&(g[O+D]=-C.x,g[F+D]=-C.y,g[V+D]=-C.z)),i.bitangent&&(w=d.normalize(d.cross(x,C,w),w),m[O]=w.x,m[F]=w.y,m[V]=w.z,n&&(m[O+D]=w.x,m[F+D]=w.y,m[V+D]=w.z))))}if(i.st){S=f.length;for(let O=0;O<S;O+=2)f[O]=(f[O]-U.x)/(B.x-U.x),f[O+1]=(f[O+1]-U.y)/(B.y-U.y)}const I=new oi;if(i.position){const O=pd.raisePositionsToHeight(e,t,n);I.position=new Ie({componentDatatype:Z.DOUBLE,componentsPerAttribute:3,values:O})}if(i.st&&(I.st=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:2,values:f})),i.normal&&(I.normal=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:3,values:_})),i.tangent&&(I.tangent=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:3,values:g})),i.bitangent&&(I.bitangent=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:3,values:m})),h&&(I.extrudeDirection=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:3,values:b})),n&&c(t.offsetAttribute)){let O=new Uint8Array(u);if(t.offsetAttribute===Kt.TOP)O=O.fill(1,0,u/2);else{const F=t.offsetAttribute===Kt.NONE?0:1;O=O.fill(F)}I.applyOffset=new Ie({componentDatatype:Z.UNSIGNED_BYTE,componentsPerAttribute:1,values:O})}return I}function mj(e){const t=new Array(12*(e*(e+1))-6);let n=0,i,o,r,s,a;for(i=0,r=1,s=0;s<3;s++)t[n++]=r++,t[n++]=i,t[n++]=r;for(s=2;s<e+1;++s){for(r=s*(s+1)-1,i=(s-1)*s-1,t[n++]=r++,t[n++]=i,t[n++]=r,o=2*s,a=0;a<o-1;++a)t[n++]=r,t[n++]=i++,t[n++]=i,t[n++]=r++,t[n++]=i,t[n++]=r;t[n++]=r++,t[n++]=i,t[n++]=r}for(o=e*2,++r,++i,s=0;s<o-1;++s)t[n++]=r,t[n++]=i++,t[n++]=i,t[n++]=r++,t[n++]=i,t[n++]=r;for(t[n++]=r,t[n++]=i++,t[n++]=i,t[n++]=r++,t[n++]=i++,t[n++]=i,++i,s=e-1;s>1;--s){for(t[n++]=i++,t[n++]=i,t[n++]=r,o=2*s,a=0;a<o-1;++a)t[n++]=r,t[n++]=i++,t[n++]=i,t[n++]=r++,t[n++]=i,t[n++]=r;t[n++]=i++,t[n++]=i++,t[n++]=r++}for(s=0;s<3;s++)t[n++]=i++,t[n++]=i,t[n++]=r;return t}let Df=new d;function iDe(e){const t=e.center;Df=d.multiplyByScalar(e.ellipsoid.geodeticSurfaceNormal(t,Df),e.height,Df),Df=d.add(t,Df,Df);const n=new se(Df,e.semiMajorAxis),i=pd.computeEllipsePositions(e,!0,!1),o=i.positions,r=i.numPts,s=pj(o,e,!1);let a=mj(r);return a=je.createTypedArray(o.length/3,a),{boundingSphere:n,attributes:s,indices:a}}function oDe(e,t){const n=t.vertexFormat,i=t.center,o=t.semiMajorAxis,r=t.semiMinorAxis,s=t.ellipsoid,a=t.height,l=t.extrudedHeight,u=t.stRotation,h=e.length/3*2,f=new Float64Array(h*3),_=n.st?new Float32Array(h*2):void 0,g=n.normal?new Float32Array(h*3):void 0,m=n.tangent?new Float32Array(h*3):void 0,b=n.bitangent?new Float32Array(h*3):void 0,T=t.shadowVolume,x=T?new Float32Array(h*3):void 0;let C=0,w=cj,v=lj,P=uj;const N=new co(s),k=N.project(s.cartesianToCartographic(i,Zx),dj),M=s.scaleToGeodeticSurface(i,L_);s.geodeticSurfaceNormal(M,M);const U=_e.fromAxisAngle(M,u,wD),B=$.fromQuaternion(U,aj),S=H.fromElements(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,hj),D=H.fromElements(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,fj);let p=e.length;const I=p/3*2;for(let F=0;F<p;F+=3){const V=F+1,G=F+2;let j=d.fromArray(e,F,L_),W;if(n.st){const q=$.multiplyByVector(B,j,CD),ee=N.project(s.cartesianToCartographic(q,Zx),ED);d.subtract(ee,k,ee),zo.x=(ee.x+o)/(2*o),zo.y=(ee.y+r)/(2*r),S.x=Math.min(zo.x,S.x),S.y=Math.min(zo.y,S.y),D.x=Math.max(zo.x,D.x),D.y=Math.max(zo.y,D.y),_[C+I]=zo.x,_[C+1+I]=zo.y,_[C++]=zo.x,_[C++]=zo.y}j=s.scaleToGeodeticSurface(j,j),W=d.clone(j,CD),w=s.geodeticSurfaceNormal(j,w),T&&(x[F+p]=-w.x,x[V+p]=-w.y,x[G+p]=-w.z);let X=d.multiplyByScalar(w,a,F2);if(j=d.add(j,X,j),X=d.multiplyByScalar(w,l,X),W=d.add(W,X,W),n.position&&(f[F+p]=W.x,f[V+p]=W.y,f[G+p]=W.z,f[F]=j.x,f[V]=j.y,f[G]=j.z),n.normal||n.tangent||n.bitangent){P=d.clone(w,P);const q=d.fromArray(e,(F+3)%p,F2);d.subtract(q,j,q);const ee=d.subtract(W,j,ED);w=d.normalize(d.cross(ee,q,w),w),n.normal&&(g[F]=w.x,g[V]=w.y,g[G]=w.z,g[F+p]=w.x,g[V+p]=w.y,g[G+p]=w.z),n.tangent&&(v=d.normalize(d.cross(P,w,v),v),m[F]=v.x,m[V]=v.y,m[G]=v.z,m[F+p]=v.x,m[F+1+p]=v.y,m[F+2+p]=v.z),n.bitangent&&(b[F]=P.x,b[V]=P.y,b[G]=P.z,b[F+p]=P.x,b[V+p]=P.y,b[G+p]=P.z)}}if(n.st){p=_.length;for(let F=0;F<p;F+=2)_[F]=(_[F]-S.x)/(D.x-S.x),_[F+1]=(_[F+1]-S.y)/(D.y-S.y)}const O=new oi;if(n.position&&(O.position=new Ie({componentDatatype:Z.DOUBLE,componentsPerAttribute:3,values:f})),n.st&&(O.st=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:2,values:_})),n.normal&&(O.normal=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:3,values:g})),n.tangent&&(O.tangent=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:3,values:m})),n.bitangent&&(O.bitangent=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:3,values:b})),T&&(O.extrudeDirection=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:3,values:x})),c(t.offsetAttribute)){let F=new Uint8Array(h);if(t.offsetAttribute===Kt.TOP)F=F.fill(1,0,h/2);else{const V=t.offsetAttribute===Kt.NONE?0:1;F=F.fill(V)}O.applyOffset=new Ie({componentDatatype:Z.UNSIGNED_BYTE,componentsPerAttribute:1,values:F})}return O}function rDe(e){const t=e.length/3,n=je.createTypedArray(t,t*6);let i=0;for(let o=0;o<t;o++){const r=o,s=o+t,a=(r+1)%t,l=a+t;n[i++]=r,n[i++]=s,n[i++]=a,n[i++]=a,n[i++]=s,n[i++]=l}return n}const NT=new se,MT=new se;function sDe(e){const t=e.center,n=e.ellipsoid,i=e.semiMajorAxis;let o=d.multiplyByScalar(n.geodeticSurfaceNormal(t,L_),e.height,L_);NT.center=d.add(t,o,NT.center),NT.radius=i,o=d.multiplyByScalar(n.geodeticSurfaceNormal(t,o),e.extrudedHeight,o),MT.center=d.add(t,o,MT.center),MT.radius=i;const r=pd.computeEllipsePositions(e,!0,!0),s=r.positions,a=r.numPts,l=r.outerPositions,u=se.union(NT,MT),h=pj(s,e,!0);let f=mj(a);const _=f.length;f.length=_*2;const g=s.length/3;for(let v=0;v<_;v+=3)f[v+_]=f[v+2]+g,f[v+1+_]=f[v+1]+g,f[v+2+_]=f[v]+g;const m=je.createTypedArray(g*2/3,f),b=new Tt({attributes:h,indices:m,primitiveType:ze.TRIANGLES}),T=oDe(l,e);f=rDe(l);const x=je.createTypedArray(l.length*2/3,f),C=new Tt({attributes:T,indices:x,primitiveType:ze.TRIANGLES}),w=ti.combineInstances([new Gt({geometry:b}),new Gt({geometry:C})]);return{boundingSphere:u,attributes:w[0].attributes,indices:w[0].indices}}function _j(e,t,n,i,o,r,s){const l=pd.computeEllipsePositions({center:e,semiMajorAxis:t,semiMinorAxis:n,rotation:i,granularity:o},!1,!0).outerPositions,u=l.length/3,h=new Array(u);for(let _=0;_<u;++_)h[_]=d.fromArray(l,_*3);const f=ce.fromCartesianArray(h,r,s);return f.width>R.PI&&(f.north=f.north>0?R.PI_OVER_TWO-R.EPSILON7:f.north,f.south=f.south<0?R.EPSILON7-R.PI_OVER_TWO:f.south,f.east=R.PI,f.west=-R.PI),f}function Rc(e){e=y(e,y.EMPTY_OBJECT);const t=e.center,n=y(e.ellipsoid,ae.WGS84),i=e.semiMajorAxis,o=e.semiMinorAxis,r=y(e.granularity,R.RADIANS_PER_DEGREE),s=y(e.vertexFormat,Ee.DEFAULT);if(A.defined("options.center",t),A.typeOf.number("options.semiMajorAxis",i),A.typeOf.number("options.semiMinorAxis",o),i<o)throw new E("semiMajorAxis must be greater than or equal to the semiMinorAxis.");if(r<=0)throw new E("granularity must be greater than zero.");const a=y(e.height,0),l=y(e.extrudedHeight,a);this._center=d.clone(t),this._semiMajorAxis=i,this._semiMinorAxis=o,this._ellipsoid=ae.clone(n),this._rotation=y(e.rotation,0),this._stRotation=y(e.stRotation,0),this._height=Math.max(l,a),this._granularity=r,this._vertexFormat=Ee.clone(s),this._extrudedHeight=Math.min(l,a),this._shadowVolume=y(e.shadowVolume,!1),this._workerName="createEllipseGeometry",this._offsetAttribute=e.offsetAttribute,this._rectangle=void 0,this._textureCoordinateRotationPoints=void 0}Rc.packedLength=d.packedLength+ae.packedLength+Ee.packedLength+9;Rc.pack=function(e,t,n){return A.defined("value",e),A.defined("array",t),n=y(n,0),d.pack(e._center,t,n),n+=d.packedLength,ae.pack(e._ellipsoid,t,n),n+=ae.packedLength,Ee.pack(e._vertexFormat,t,n),n+=Ee.packedLength,t[n++]=e._semiMajorAxis,t[n++]=e._semiMinorAxis,t[n++]=e._rotation,t[n++]=e._stRotation,t[n++]=e._height,t[n++]=e._granularity,t[n++]=e._extrudedHeight,t[n++]=e._shadowVolume?1:0,t[n]=y(e._offsetAttribute,-1),t};const gj=new d,yj=new ae,bj=new Ee,Wl={center:gj,ellipsoid:yj,vertexFormat:bj,semiMajorAxis:void 0,semiMinorAxis:void 0,rotation:void 0,stRotation:void 0,height:void 0,granularity:void 0,extrudedHeight:void 0,shadowVolume:void 0,offsetAttribute:void 0};Rc.unpack=function(e,t,n){A.defined("array",e),t=y(t,0);const i=d.unpack(e,t,gj);t+=d.packedLength;const o=ae.unpack(e,t,yj);t+=ae.packedLength;const r=Ee.unpack(e,t,bj);t+=Ee.packedLength;const s=e[t++],a=e[t++],l=e[t++],u=e[t++],h=e[t++],f=e[t++],_=e[t++],g=e[t++]===1,m=e[t];return c(n)?(n._center=d.clone(i,n._center),n._ellipsoid=ae.clone(o,n._ellipsoid),n._vertexFormat=Ee.clone(r,n._vertexFormat),n._semiMajorAxis=s,n._semiMinorAxis=a,n._rotation=l,n._stRotation=u,n._height=h,n._granularity=f,n._extrudedHeight=_,n._shadowVolume=g,n._offsetAttribute=m===-1?void 0:m,n):(Wl.height=h,Wl.extrudedHeight=_,Wl.granularity=f,Wl.stRotation=u,Wl.rotation=l,Wl.semiMajorAxis=s,Wl.semiMinorAxis=a,Wl.shadowVolume=g,Wl.offsetAttribute=m===-1?void 0:m,new Rc(Wl))};Rc.computeRectangle=function(e,t){e=y(e,y.EMPTY_OBJECT);const n=e.center,i=y(e.ellipsoid,ae.WGS84),o=e.semiMajorAxis,r=e.semiMinorAxis,s=y(e.granularity,R.RADIANS_PER_DEGREE),a=y(e.rotation,0);if(A.defined("options.center",n),A.typeOf.number("options.semiMajorAxis",o),A.typeOf.number("options.semiMinorAxis",r),o<r)throw new E("semiMajorAxis must be greater than or equal to the semiMinorAxis.");if(s<=0)throw new E("granularity must be greater than zero.");return _j(n,o,r,a,s,i,t)};Rc.createGeometry=function(e){if(e._semiMajorAxis<=0||e._semiMinorAxis<=0)return;const t=e._height,n=e._extrudedHeight,i=!R.equalsEpsilon(t,n,0,R.EPSILON2);e._center=e._ellipsoid.scaleToGeodeticSurface(e._center,e._center);const o={center:e._center,semiMajorAxis:e._semiMajorAxis,semiMinorAxis:e._semiMinorAxis,ellipsoid:e._ellipsoid,rotation:e._rotation,height:t,granularity:e._granularity,vertexFormat:e._vertexFormat,stRotation:e._stRotation};let r;if(i)o.extrudedHeight=n,o.shadowVolume=e._shadowVolume,o.offsetAttribute=e._offsetAttribute,r=sDe(o);else if(r=iDe(o),c(e._offsetAttribute)){const s=r.attributes.position.values.length,a=e._offsetAttribute===Kt.NONE?0:1,l=new Uint8Array(s/3).fill(a);r.attributes.applyOffset=new Ie({componentDatatype:Z.UNSIGNED_BYTE,componentsPerAttribute:1,values:l})}return new Tt({attributes:r.attributes,indices:r.indices,primitiveType:ze.TRIANGLES,boundingSphere:r.boundingSphere,offsetAttribute:e._offsetAttribute})};Rc.createShadowVolume=function(e,t,n){const i=e._granularity,o=e._ellipsoid,r=t(i,o),s=n(i,o);return new Rc({center:e._center,semiMajorAxis:e._semiMajorAxis,semiMinorAxis:e._semiMinorAxis,ellipsoid:o,rotation:e._rotation,stRotation:e._stRotation,granularity:i,extrudedHeight:r,height:s,vertexFormat:Ee.POSITION_ONLY,shadowVolume:!0})};function aDe(e){const t=-e._stRotation;if(t===0)return[0,0,0,1,1,0];const i=pd.computeEllipsePositions({center:e._center,semiMajorAxis:e._semiMajorAxis,semiMinorAxis:e._semiMinorAxis,rotation:e._rotation,granularity:e._granularity},!1,!0).outerPositions,o=i.length/3,r=new Array(o);for(let l=0;l<o;++l)r[l]=d.fromArray(i,l*3);const s=e._ellipsoid,a=e.rectangle;return Tt._textureCoordinateRotationPoints(r,t,s,a)}Object.defineProperties(Rc.prototype,{rectangle:{get:function(){return c(this._rectangle)||(this._rectangle=_j(this._center,this._semiMajorAxis,this._semiMinorAxis,this._rotation,this._granularity,this._ellipsoid)),this._rectangle}},textureCoordinateRotationPoints:{get:function(){return c(this._textureCoordinateRotationPoints)||(this._textureCoordinateRotationPoints=aDe(this)),this._textureCoordinateRotationPoints}}});const B2=new d;let Pf=new d;function cDe(e){const t=e.center;Pf=d.multiplyByScalar(e.ellipsoid.geodeticSurfaceNormal(t,Pf),e.height,Pf),Pf=d.add(t,Pf,Pf);const n=new se(Pf,e.semiMajorAxis),i=pd.computeEllipsePositions(e,!1,!0).outerPositions,o=new oi({position:new Ie({componentDatatype:Z.DOUBLE,componentsPerAttribute:3,values:pd.raisePositionsToHeight(i,e,!1)})}),r=i.length/3,s=je.createTypedArray(r,r*2);let a=0;for(let l=0;l<r;++l)s[a++]=l,s[a++]=(l+1)%r;return{boundingSphere:n,attributes:o,indices:s}}const FT=new se,BT=new se;function lDe(e){const t=e.center,n=e.ellipsoid,i=e.semiMajorAxis;let o=d.multiplyByScalar(n.geodeticSurfaceNormal(t,B2),e.height,B2);FT.center=d.add(t,o,FT.center),FT.radius=i,o=d.multiplyByScalar(n.geodeticSurfaceNormal(t,o),e.extrudedHeight,o),BT.center=d.add(t,o,BT.center),BT.radius=i;let r=pd.computeEllipsePositions(e,!1,!0).outerPositions;const s=new oi({position:new Ie({componentDatatype:Z.DOUBLE,componentsPerAttribute:3,values:pd.raisePositionsToHeight(r,e,!0)})});r=s.position.values;const a=se.union(FT,BT);let l=r.length/3;if(c(e.offsetAttribute)){let m=new Uint8Array(l);if(e.offsetAttribute===Kt.TOP)m=m.fill(1,0,l/2);else{const b=e.offsetAttribute===Kt.NONE?0:1;m=m.fill(b)}s.applyOffset=new Ie({componentDatatype:Z.UNSIGNED_BYTE,componentsPerAttribute:1,values:m})}let u=y(e.numberOfVerticalLines,16);u=R.clamp(u,0,l/2);const h=je.createTypedArray(l,l*2+u*2);l/=2;let f=0,_;for(_=0;_<l;++_)h[f++]=_,h[f++]=(_+1)%l,h[f++]=_+l,h[f++]=(_+1)%l+l;let g;if(u>0){const m=Math.min(u,l);g=Math.round(l/m);const b=Math.min(g*u,l);for(_=0;_<b;_+=g)h[f++]=_,h[f++]=_+l}return{boundingSphere:a,attributes:s,indices:h}}function R_(e){e=y(e,y.EMPTY_OBJECT);const t=e.center,n=y(e.ellipsoid,ae.WGS84),i=e.semiMajorAxis,o=e.semiMinorAxis,r=y(e.granularity,R.RADIANS_PER_DEGREE);if(!c(t))throw new E("center is required.");if(!c(i))throw new E("semiMajorAxis is required.");if(!c(o))throw new E("semiMinorAxis is required.");if(i<o)throw new E("semiMajorAxis must be greater than or equal to the semiMinorAxis.");if(r<=0)throw new E("granularity must be greater than zero.");const s=y(e.height,0),a=y(e.extrudedHeight,s);this._center=d.clone(t),this._semiMajorAxis=i,this._semiMinorAxis=o,this._ellipsoid=ae.clone(n),this._rotation=y(e.rotation,0),this._height=Math.max(a,s),this._granularity=r,this._extrudedHeight=Math.min(a,s),this._numberOfVerticalLines=Math.max(y(e.numberOfVerticalLines,16),0),this._offsetAttribute=e.offsetAttribute,this._workerName="createEllipseOutlineGeometry"}R_.packedLength=d.packedLength+ae.packedLength+8;R_.pack=function(e,t,n){if(!c(e))throw new E("value is required");if(!c(t))throw new E("array is required");return n=y(n,0),d.pack(e._center,t,n),n+=d.packedLength,ae.pack(e._ellipsoid,t,n),n+=ae.packedLength,t[n++]=e._semiMajorAxis,t[n++]=e._semiMinorAxis,t[n++]=e._rotation,t[n++]=e._height,t[n++]=e._granularity,t[n++]=e._extrudedHeight,t[n++]=e._numberOfVerticalLines,t[n]=y(e._offsetAttribute,-1),t};const Tj=new d,Aj=new ae,Nu={center:Tj,ellipsoid:Aj,semiMajorAxis:void 0,semiMinorAxis:void 0,rotation:void 0,height:void 0,granularity:void 0,extrudedHeight:void 0,numberOfVerticalLines:void 0,offsetAttribute:void 0};R_.unpack=function(e,t,n){if(!c(e))throw new E("array is required");t=y(t,0);const i=d.unpack(e,t,Tj);t+=d.packedLength;const o=ae.unpack(e,t,Aj);t+=ae.packedLength;const r=e[t++],s=e[t++],a=e[t++],l=e[t++],u=e[t++],h=e[t++],f=e[t++],_=e[t];return c(n)?(n._center=d.clone(i,n._center),n._ellipsoid=ae.clone(o,n._ellipsoid),n._semiMajorAxis=r,n._semiMinorAxis=s,n._rotation=a,n._height=l,n._granularity=u,n._extrudedHeight=h,n._numberOfVerticalLines=f,n._offsetAttribute=_===-1?void 0:_,n):(Nu.height=l,Nu.extrudedHeight=h,Nu.granularity=u,Nu.rotation=a,Nu.semiMajorAxis=r,Nu.semiMinorAxis=s,Nu.numberOfVerticalLines=f,Nu.offsetAttribute=_===-1?void 0:_,new R_(Nu))};R_.createGeometry=function(e){if(e._semiMajorAxis<=0||e._semiMinorAxis<=0)return;const t=e._height,n=e._extrudedHeight,i=!R.equalsEpsilon(t,n,0,R.EPSILON2);e._center=e._ellipsoid.scaleToGeodeticSurface(e._center,e._center);const o={center:e._center,semiMajorAxis:e._semiMajorAxis,semiMinorAxis:e._semiMinorAxis,ellipsoid:e._ellipsoid,rotation:e._rotation,height:t,granularity:e._granularity,numberOfVerticalLines:e._numberOfVerticalLines};let r;if(i)o.extrudedHeight=n,o.offsetAttribute=e._offsetAttribute,r=lDe(o);else if(r=cDe(o),c(e._offsetAttribute)){const s=r.attributes.position.values.length,a=e._offsetAttribute===Kt.NONE?0:1,l=new Uint8Array(s/3).fill(a);r.attributes.applyOffset=new Ie({componentDatatype:Z.UNSIGNED_BYTE,componentsPerAttribute:1,values:l})}return new Tt({attributes:r.attributes,indices:r.indices,primitiveType:ze.LINES,boundingSphere:r.boundingSphere,offsetAttribute:e._offsetAttribute})};const xj=new z,Cj=d.ZERO,Ej=new d,wj=new ce;function uDe(e){this.id=e,this.vertexFormat=void 0,this.center=void 0,this.semiMajorAxis=void 0,this.semiMinorAxis=void 0,this.rotation=void 0,this.height=void 0,this.extrudedHeight=void 0,this.granularity=void 0,this.stRotation=void 0,this.numberOfVerticalLines=void 0,this.offsetAttribute=void 0}function pl(e,t){Ut.call(this,{entity:e,scene:t,geometryOptions:new uDe(e),geometryPropertyName:"ellipse",observedPropertyNames:["availability","position","ellipse"]}),this._onEntityPropertyChanged(e,"ellipse",e.ellipse,void 0)}c(Object.create)&&(pl.prototype=Object.create(Ut.prototype),pl.prototype.constructor=pl);pl.prototype.createFillGeometryInstance=function(e){if(A.defined("time",e),!this._fillEnabled)throw new E("This instance does not represent a filled geometry.");const t=this._entity,n=t.isAvailable(e),i={show:new mn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),distanceDisplayCondition:Vn.fromDistanceDisplayCondition(this._distanceDisplayConditionProperty.getValue(e)),offset:void 0,color:void 0};if(this._materialProperty instanceof kt){let o;c(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(o=this._materialProperty.color.getValue(e,xj)),c(o)||(o=z.WHITE),i.color=$t.fromColor(o)}return c(this._options.offsetAttribute)&&(i.offset=Zi.fromCartesian3(K.getValueOrDefault(this._terrainOffsetProperty,e,Cj,Ej))),new Gt({id:t,geometry:new Rc(this._options),attributes:i})};pl.prototype.createOutlineGeometryInstance=function(e){if(A.defined("time",e),!this._outlineEnabled)throw new E("This instance does not represent an outlined geometry.");const t=this._entity,n=t.isAvailable(e),i=K.getValueOrDefault(this._outlineColorProperty,e,z.BLACK,xj),o=this._distanceDisplayConditionProperty.getValue(e),r={show:new mn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:$t.fromColor(i),distanceDisplayCondition:Vn.fromDistanceDisplayCondition(o),offset:void 0};return c(this._options.offsetAttribute)&&(r.offset=Zi.fromCartesian3(K.getValueOrDefault(this._terrainOffsetProperty,e,Cj,Ej))),new Gt({id:t,geometry:new R_(this._options),attributes:r})};pl.prototype._computeCenter=function(e,t){return K.getValueOrUndefined(this._entity.position,e,t)};pl.prototype._isHidden=function(e,t){const n=e.position;return!c(n)||!c(t.semiMajorAxis)||!c(t.semiMinorAxis)||dn.prototype._isHidden.call(this,e,t)};pl.prototype._isDynamic=function(e,t){return!e.position.isConstant||!t.semiMajorAxis.isConstant||!t.semiMinorAxis.isConstant||!K.isConstant(t.rotation)||!K.isConstant(t.height)||!K.isConstant(t.extrudedHeight)||!K.isConstant(t.granularity)||!K.isConstant(t.stRotation)||!K.isConstant(t.outlineWidth)||!K.isConstant(t.numberOfVerticalLines)||!K.isConstant(t.zIndex)||this._onTerrain&&!K.isConstant(this._materialProperty)&&!(this._materialProperty instanceof kt)};pl.prototype._setStaticOptions=function(e,t){let n=K.getValueOrUndefined(t.height,Ke.MINIMUM_VALUE);const i=K.getValueOrDefault(t.heightReference,Ke.MINIMUM_VALUE,gt.NONE);let o=K.getValueOrUndefined(t.extrudedHeight,Ke.MINIMUM_VALUE);const r=K.getValueOrDefault(t.extrudedHeightReference,Ke.MINIMUM_VALUE,gt.NONE);c(o)&&!c(n)&&(n=0);const s=this._options;s.vertexFormat=this._materialProperty instanceof kt?tn.VERTEX_FORMAT:oo.MaterialSupport.TEXTURED.vertexFormat,s.center=e.position.getValue(Ke.MINIMUM_VALUE,s.center),s.semiMajorAxis=t.semiMajorAxis.getValue(Ke.MINIMUM_VALUE,s.semiMajorAxis),s.semiMinorAxis=t.semiMinorAxis.getValue(Ke.MINIMUM_VALUE,s.semiMinorAxis),s.rotation=K.getValueOrUndefined(t.rotation,Ke.MINIMUM_VALUE),s.granularity=K.getValueOrUndefined(t.granularity,Ke.MINIMUM_VALUE),s.stRotation=K.getValueOrUndefined(t.stRotation,Ke.MINIMUM_VALUE),s.numberOfVerticalLines=K.getValueOrUndefined(t.numberOfVerticalLines,Ke.MINIMUM_VALUE),s.offsetAttribute=Ut.computeGeometryOffsetAttribute(n,i,o,r),s.height=Ut.getGeometryHeight(n,i),o=Ut.getGeometryExtrudedHeight(o,r),o===Ut.CLAMP_TO_GROUND&&(o=Ti.getMinimumMaximumHeights(Rc.computeRectangle(s,wj)).minimumTerrainHeight),s.extrudedHeight=o};pl.DynamicGeometryUpdater=u_;function u_(e,t,n){On.call(this,e,t,n)}c(Object.create)&&(u_.prototype=Object.create(On.prototype),u_.prototype.constructor=u_);u_.prototype._isHidden=function(e,t,n){const i=this._options;return!c(i.center)||!c(i.semiMajorAxis)||!c(i.semiMinorAxis)||On.prototype._isHidden.call(this,e,t,n)};u_.prototype._setOptions=function(e,t,n){const i=this._options;let o=K.getValueOrUndefined(t.height,n);const r=K.getValueOrDefault(t.heightReference,n,gt.NONE);let s=K.getValueOrUndefined(t.extrudedHeight,n);const a=K.getValueOrDefault(t.extrudedHeightReference,n,gt.NONE);c(s)&&!c(o)&&(o=0),i.center=K.getValueOrUndefined(e.position,n,i.center),i.semiMajorAxis=K.getValueOrUndefined(t.semiMajorAxis,n),i.semiMinorAxis=K.getValueOrUndefined(t.semiMinorAxis,n),i.rotation=K.getValueOrUndefined(t.rotation,n),i.granularity=K.getValueOrUndefined(t.granularity,n),i.stRotation=K.getValueOrUndefined(t.stRotation,n),i.numberOfVerticalLines=K.getValueOrUndefined(t.numberOfVerticalLines,n),i.offsetAttribute=Ut.computeGeometryOffsetAttribute(o,r,s,a),i.height=Ut.getGeometryHeight(o,r),s=Ut.getGeometryExtrudedHeight(s,a),s===Ut.CLAMP_TO_GROUND&&(s=Ti.getMinimumMaximumHeights(Rc.computeRectangle(i,wj)).minimumTerrainHeight),i.extrudedHeight=s};const dDe=new d,hDe=new d,fDe=new d,pDe=new d,mDe=new d,_De=new d(1,1,1),z2=Math.cos,U2=Math.sin;function va(e){e=y(e,y.EMPTY_OBJECT);const t=y(e.radii,_De),n=y(e.innerRadii,t),i=y(e.minimumClock,0),o=y(e.maximumClock,R.TWO_PI),r=y(e.minimumCone,0),s=y(e.maximumCone,R.PI),a=Math.round(y(e.stackPartitions,64)),l=Math.round(y(e.slicePartitions,64)),u=y(e.vertexFormat,Ee.DEFAULT);if(l<3)throw new E("options.slicePartitions cannot be less than three.");if(a<3)throw new E("options.stackPartitions cannot be less than three.");this._radii=d.clone(t),this._innerRadii=d.clone(n),this._minimumClock=i,this._maximumClock=o,this._minimumCone=r,this._maximumCone=s,this._stackPartitions=a,this._slicePartitions=l,this._vertexFormat=Ee.clone(u),this._offsetAttribute=e.offsetAttribute,this._workerName="createEllipsoidGeometry"}va.packedLength=2*d.packedLength+Ee.packedLength+7;va.pack=function(e,t,n){if(!c(e))throw new E("value is required");if(!c(t))throw new E("array is required");return n=y(n,0),d.pack(e._radii,t,n),n+=d.packedLength,d.pack(e._innerRadii,t,n),n+=d.packedLength,Ee.pack(e._vertexFormat,t,n),n+=Ee.packedLength,t[n++]=e._minimumClock,t[n++]=e._maximumClock,t[n++]=e._minimumCone,t[n++]=e._maximumCone,t[n++]=e._stackPartitions,t[n++]=e._slicePartitions,t[n]=y(e._offsetAttribute,-1),t};const Sj=new d,vj=new d,Ij=new Ee,qd={radii:Sj,innerRadii:vj,vertexFormat:Ij,minimumClock:void 0,maximumClock:void 0,minimumCone:void 0,maximumCone:void 0,stackPartitions:void 0,slicePartitions:void 0,offsetAttribute:void 0};va.unpack=function(e,t,n){if(!c(e))throw new E("array is required");t=y(t,0);const i=d.unpack(e,t,Sj);t+=d.packedLength;const o=d.unpack(e,t,vj);t+=d.packedLength;const r=Ee.unpack(e,t,Ij);t+=Ee.packedLength;const s=e[t++],a=e[t++],l=e[t++],u=e[t++],h=e[t++],f=e[t++],_=e[t];return c(n)?(n._radii=d.clone(i,n._radii),n._innerRadii=d.clone(o,n._innerRadii),n._vertexFormat=Ee.clone(r,n._vertexFormat),n._minimumClock=s,n._maximumClock=a,n._minimumCone=l,n._maximumCone=u,n._stackPartitions=h,n._slicePartitions=f,n._offsetAttribute=_===-1?void 0:_,n):(qd.minimumClock=s,qd.maximumClock=a,qd.minimumCone=l,qd.maximumCone=u,qd.stackPartitions=h,qd.slicePartitions=f,qd.offsetAttribute=_===-1?void 0:_,new va(qd))};va.createGeometry=function(e){const t=e._radii;if(t.x<=0||t.y<=0||t.z<=0)return;const n=e._innerRadii;if(n.x<=0||n.y<=0||n.z<=0)return;const i=e._minimumClock,o=e._maximumClock,r=e._minimumCone,s=e._maximumCone,a=e._vertexFormat;let l=e._slicePartitions+1,u=e._stackPartitions+1;l=Math.round(l*Math.abs(o-i)/R.TWO_PI),u=Math.round(u*Math.abs(s-r)/R.PI),l<2&&(l=2),u<2&&(u=2);let h,f,_=0;const g=[r],m=[i];for(h=0;h<u;h++)g.push(r+h*(s-r)/(u-1));for(g.push(s),f=0;f<l;f++)m.push(i+f*(o-i)/(l-1));m.push(o);const b=g.length,T=m.length;let x=0,C=1;const w=n.x!==t.x||n.y!==t.y||n.z!==t.z;let v=!1,P=!1,N=!1;w&&(C=2,r>0&&(v=!0,x+=l-1),s<Math.PI&&(P=!0,x+=l-1),(o-i)%R.TWO_PI?(N=!0,x+=(u-1)*2+1):x+=1);const k=T*b*C,M=new Float64Array(k*3),U=new Array(k).fill(!1),B=new Array(k).fill(!1),S=l*u*C,D=6*(S+x+1-(l+u)*C),p=je.createTypedArray(S,D),I=a.normal?new Float32Array(k*3):void 0,O=a.tangent?new Float32Array(k*3):void 0,F=a.bitangent?new Float32Array(k*3):void 0,V=a.st?new Float32Array(k*2):void 0,G=new Array(b),j=new Array(b);for(h=0;h<b;h++)G[h]=U2(g[h]),j[h]=z2(g[h]);const W=new Array(T),X=new Array(T);for(f=0;f<T;f++)X[f]=z2(m[f]),W[f]=U2(m[f]);for(h=0;h<b;h++)for(f=0;f<T;f++)M[_++]=t.x*G[h]*X[f],M[_++]=t.y*G[h]*W[f],M[_++]=t.z*j[h];let q=k/2;if(w)for(h=0;h<b;h++)for(f=0;f<T;f++)M[_++]=n.x*G[h]*X[f],M[_++]=n.y*G[h]*W[f],M[_++]=n.z*j[h],U[q]=!0,h>0&&h!==b-1&&f!==0&&f!==T-1&&(B[q]=!0),q++;_=0;let ee,Y;for(h=1;h<b-2;h++)for(ee=h*T,Y=(h+1)*T,f=1;f<T-2;f++)p[_++]=Y+f,p[_++]=Y+f+1,p[_++]=ee+f+1,p[_++]=Y+f,p[_++]=ee+f+1,p[_++]=ee+f;if(w){const lt=b*T;for(h=1;h<b-2;h++)for(ee=lt+h*T,Y=lt+(h+1)*T,f=1;f<T-2;f++)p[_++]=Y+f,p[_++]=ee+f,p[_++]=ee+f+1,p[_++]=Y+f,p[_++]=ee+f+1,p[_++]=Y+f+1}let ne,Q;if(w){if(v)for(Q=b*T,h=1;h<T-2;h++)p[_++]=h,p[_++]=h+1,p[_++]=Q+h+1,p[_++]=h,p[_++]=Q+h+1,p[_++]=Q+h;if(P)for(ne=b*T-T,Q=b*T*C-T,h=1;h<T-2;h++)p[_++]=ne+h+1,p[_++]=ne+h,p[_++]=Q+h,p[_++]=ne+h+1,p[_++]=Q+h,p[_++]=Q+h+1}if(N){for(h=1;h<b-2;h++)Q=T*b+T*h,ne=T*h,p[_++]=Q,p[_++]=ne+T,p[_++]=ne,p[_++]=Q,p[_++]=Q+T,p[_++]=ne+T;for(h=1;h<b-2;h++)Q=T*b+T*(h+1)-1,ne=T*(h+1)-1,p[_++]=ne+T,p[_++]=Q,p[_++]=ne,p[_++]=ne+T,p[_++]=Q+T,p[_++]=Q}const le=new oi;a.position&&(le.position=new Ie({componentDatatype:Z.DOUBLE,componentsPerAttribute:3,values:M}));let pe=0,re=0,de=0,fe=0;const ye=k/2;let Ce;const we=ae.fromCartesian3(t),Pe=ae.fromCartesian3(n);if(a.st||a.normal||a.tangent||a.bitangent){for(h=0;h<k;h++){Ce=U[h]?Pe:we;const lt=d.fromArray(M,h*3,dDe),ft=Ce.geodeticSurfaceNormal(lt,hDe);if(B[h]&&d.negate(ft,ft),a.st){const We=H.negate(ft,mDe);V[pe++]=Math.atan2(We.y,We.x)/R.TWO_PI+.5,V[pe++]=Math.asin(ft.z)/Math.PI+.5}if(a.normal&&(I[re++]=ft.x,I[re++]=ft.y,I[re++]=ft.z),a.tangent||a.bitangent){const We=fDe;let Fe=0,Dt;if(U[h]&&(Fe=ye),!v&&h>=Fe&&h<Fe+T*2?Dt=d.UNIT_X:Dt=d.UNIT_Z,d.cross(Dt,ft,We),d.normalize(We,We),a.tangent&&(O[de++]=We.x,O[de++]=We.y,O[de++]=We.z),a.bitangent){const st=d.cross(ft,We,pDe);d.normalize(st,st),F[fe++]=st.x,F[fe++]=st.y,F[fe++]=st.z}}}a.st&&(le.st=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:2,values:V})),a.normal&&(le.normal=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:3,values:I})),a.tangent&&(le.tangent=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:3,values:O})),a.bitangent&&(le.bitangent=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:3,values:F}))}if(c(e._offsetAttribute)){const lt=M.length,ft=e._offsetAttribute===Kt.NONE?0:1,We=new Uint8Array(lt/3).fill(ft);le.applyOffset=new Ie({componentDatatype:Z.UNSIGNED_BYTE,componentsPerAttribute:1,values:We})}return new Tt({attributes:le,indices:p,primitiveType:ze.TRIANGLES,boundingSphere:se.fromEllipsoid(we),offsetAttribute:e._offsetAttribute})};let rv;va.getUnitEllipsoid=function(){return c(rv)||(rv=va.createGeometry(new va({radii:new d(1,1,1),vertexFormat:Ee.POSITION_ONLY}))),rv};const gDe=new kt(z.WHITE),s1=d.ZERO,a1=new d,yDe=new d,bDe=new d,c1=new z,TDe=new d(1,1,1);function ADe(e){this.id=e,this.vertexFormat=void 0,this.radii=void 0,this.innerRadii=void 0,this.minimumClock=void 0,this.maximumClock=void 0,this.minimumCone=void 0,this.maximumCone=void 0,this.stackPartitions=void 0,this.slicePartitions=void 0,this.subdivisions=void 0,this.offsetAttribute=void 0}function Ia(e,t){dn.call(this,{entity:e,scene:t,geometryOptions:new ADe(e),geometryPropertyName:"ellipsoid",observedPropertyNames:["availability","position","orientation","ellipsoid"]}),this._onEntityPropertyChanged(e,"ellipsoid",e.ellipsoid,void 0)}c(Object.create)&&(Ia.prototype=Object.create(dn.prototype),Ia.prototype.constructor=Ia);Object.defineProperties(Ia.prototype,{terrainOffsetProperty:{get:function(){return this._terrainOffsetProperty}}});Ia.prototype.createFillGeometryInstance=function(e,t,n){A.defined("time",e);const i=this._entity,o=i.isAvailable(e);let r;const s=new mn(o&&i.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),a=this._distanceDisplayConditionProperty.getValue(e),l=Vn.fromDistanceDisplayCondition(a),u={show:s,distanceDisplayCondition:l,color:void 0,offset:void 0};if(this._materialProperty instanceof kt){let h;c(this._materialProperty.color)&&(this._materialProperty.color.isConstant||o)&&(h=this._materialProperty.color.getValue(e,c1)),c(h)||(h=z.WHITE),r=$t.fromColor(h),u.color=r}return c(this._options.offsetAttribute)&&(u.offset=Zi.fromCartesian3(K.getValueOrDefault(this._terrainOffsetProperty,e,s1,a1))),new Gt({id:i,geometry:new va(this._options),modelMatrix:t?void 0:i.computeModelMatrixForHeightReference(e,i.ellipsoid.heightReference,this._options.radii.z*.5,this._scene.mapProjection.ellipsoid,n),attributes:u})};Ia.prototype.createOutlineGeometryInstance=function(e,t,n){A.defined("time",e);const i=this._entity,o=i.isAvailable(e),r=K.getValueOrDefault(this._outlineColorProperty,e,z.BLACK,c1),s=this._distanceDisplayConditionProperty.getValue(e),a={show:new mn(o&&i.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:$t.fromColor(r),distanceDisplayCondition:Vn.fromDistanceDisplayCondition(s),offset:void 0};return c(this._options.offsetAttribute)&&(a.offset=Zi.fromCartesian3(K.getValueOrDefault(this._terrainOffsetProperty,e,s1,a1))),new Gt({id:i,geometry:new za(this._options),modelMatrix:t?void 0:i.computeModelMatrixForHeightReference(e,i.ellipsoid.heightReference,this._options.radii.z*.5,this._scene.mapProjection.ellipsoid,n),attributes:a})};Ia.prototype._computeCenter=function(e,t){return K.getValueOrUndefined(this._entity.position,e,t)};Ia.prototype._isHidden=function(e,t){return!c(e.position)||!c(t.radii)||dn.prototype._isHidden.call(this,e,t)};Ia.prototype._isDynamic=function(e,t){return!e.position.isConstant||!K.isConstant(e.orientation)||!t.radii.isConstant||!K.isConstant(t.innerRadii)||!K.isConstant(t.stackPartitions)||!K.isConstant(t.slicePartitions)||!K.isConstant(t.outlineWidth)||!K.isConstant(t.minimumClock)||!K.isConstant(t.maximumClock)||!K.isConstant(t.minimumCone)||!K.isConstant(t.maximumCone)||!K.isConstant(t.subdivisions)};Ia.prototype._setStaticOptions=function(e,t){const n=K.getValueOrDefault(t.heightReference,Ke.MINIMUM_VALUE,gt.NONE),i=this._options;i.vertexFormat=this._materialProperty instanceof kt?tn.VERTEX_FORMAT:oo.MaterialSupport.TEXTURED.vertexFormat,i.radii=t.radii.getValue(Ke.MINIMUM_VALUE,i.radii),i.innerRadii=K.getValueOrUndefined(t.innerRadii,i.radii),i.minimumClock=K.getValueOrUndefined(t.minimumClock,Ke.MINIMUM_VALUE),i.maximumClock=K.getValueOrUndefined(t.maximumClock,Ke.MINIMUM_VALUE),i.minimumCone=K.getValueOrUndefined(t.minimumCone,Ke.MINIMUM_VALUE),i.maximumCone=K.getValueOrUndefined(t.maximumCone,Ke.MINIMUM_VALUE),i.stackPartitions=K.getValueOrUndefined(t.stackPartitions,Ke.MINIMUM_VALUE),i.slicePartitions=K.getValueOrUndefined(t.slicePartitions,Ke.MINIMUM_VALUE),i.subdivisions=K.getValueOrUndefined(t.subdivisions,Ke.MINIMUM_VALUE),i.offsetAttribute=n!==gt.NONE?Kt.ALL:void 0};Ia.prototype._onEntityPropertyChanged=oO;Ia.DynamicGeometryUpdater=Gy;function Gy(e,t,n){On.call(this,e,t,n),this._scene=e._scene,this._modelMatrix=new L,this._attributes=void 0,this._outlineAttributes=void 0,this._lastSceneMode=void 0,this._lastShow=void 0,this._lastOutlineShow=void 0,this._lastOutlineWidth=void 0,this._lastOutlineColor=void 0,this._lastOffset=new d,this._material={}}c(Object.create)&&(Gy.prototype=Object.create(On.prototype),Gy.prototype.constructor=Gy);Gy.prototype.update=function(e){A.defined("time",e);const t=this._entity,n=t.ellipsoid;if(!t.isShowing||!t.isAvailable(e)||!K.getValueOrDefault(n.show,e,!0)){c(this._primitive)&&(this._primitive.show=!1),c(this._outlinePrimitive)&&(this._outlinePrimitive.show=!1);return}const i=K.getValueOrUndefined(n.radii,e,yDe);let o=c(i)?t.computeModelMatrixForHeightReference(e,n.heightReference,i.z*.5,this._scene.mapProjection.ellipsoid,this._modelMatrix):void 0;if(!c(o)||!c(i)){c(this._primitive)&&(this._primitive.show=!1),c(this._outlinePrimitive)&&(this._outlinePrimitive.show=!1);return}const r=K.getValueOrDefault(n.fill,e,!0),s=K.getValueOrDefault(n.outline,e,!1),a=K.getValueOrClonedDefault(n.outlineColor,e,z.BLACK,c1),l=Go.getValue(e,y(n.material,gDe),this._material),u=K.getValueOrUndefined(n.innerRadii,e,bDe),h=K.getValueOrUndefined(n.minimumClock,e),f=K.getValueOrUndefined(n.maximumClock,e),_=K.getValueOrUndefined(n.minimumCone,e),g=K.getValueOrUndefined(n.maximumCone,e),m=K.getValueOrUndefined(n.stackPartitions,e),b=K.getValueOrUndefined(n.slicePartitions,e),T=K.getValueOrUndefined(n.subdivisions,e),x=K.getValueOrDefault(n.outlineWidth,e,1),C=K.getValueOrDefault(n.heightReference,e,gt.NONE),w=C!==gt.NONE?Kt.ALL:void 0,v=this._scene.mode,P=v===oe.SCENE3D&&C===gt.NONE,N=this._options,k=this._geometryUpdater.shadowsProperty.getValue(e),U=this._geometryUpdater.distanceDisplayConditionProperty.getValue(e),B=K.getValueOrDefault(this._geometryUpdater.terrainOffsetProperty,e,s1,a1);if(!P||this._lastSceneMode!==v||!c(this._primitive)||N.stackPartitions!==m||N.slicePartitions!==b||c(u)&&!d.equals(N.innerRadii!==u)||N.minimumClock!==h||N.maximumClock!==f||N.minimumCone!==_||N.maximumCone!==g||N.subdivisions!==T||this._lastOutlineWidth!==x||N.offsetAttribute!==w){const D=this._primitives;D.removeAndDestroy(this._primitive),D.removeAndDestroy(this._outlinePrimitive),this._primitive=void 0,this._outlinePrimitive=void 0,this._lastSceneMode=v,this._lastOutlineWidth=x,N.stackPartitions=m,N.slicePartitions=b,N.subdivisions=T,N.offsetAttribute=w,N.radii=d.clone(P?TDe:i,N.radii),c(u)?P?N.innerRadii=d.fromElements(u.x/i.x,u.y/i.y,u.z/i.z,N.innerRadii):N.innerRadii=d.clone(u,N.innerRadii):N.innerRadii=void 0,N.minimumClock=h,N.maximumClock=f,N.minimumCone=_,N.maximumCone=g;const p=new oo({material:l,translucent:l.isTranslucent(),closed:!0});N.vertexFormat=p.vertexFormat;const I=this._geometryUpdater.createFillGeometryInstance(e,P,this._modelMatrix);this._primitive=D.add(new Mt({geometryInstances:I,appearance:p,asynchronous:!1,shadows:k}));const O=this._geometryUpdater.createOutlineGeometryInstance(e,P,this._modelMatrix);this._outlinePrimitive=D.add(new Mt({geometryInstances:O,appearance:new tn({flat:!0,translucent:O.attributes.color.value[3]!==255,renderState:{lineWidth:this._geometryUpdater._scene.clampLineWidth(x)}}),asynchronous:!1,shadows:k})),this._lastShow=r,this._lastOutlineShow=s,this._lastOutlineColor=z.clone(a,this._lastOutlineColor),this._lastDistanceDisplayCondition=U,this._lastOffset=d.clone(B,this._lastOffset)}else if(this._primitive.ready){const D=this._primitive,p=this._outlinePrimitive;D.show=!0,p.show=!0,D.appearance.material=l;let I=this._attributes;c(I)||(I=D.getGeometryInstanceAttributes(t),this._attributes=I),r!==this._lastShow&&(I.show=mn.toValue(r,I.show),this._lastShow=r);let O=this._outlineAttributes;c(O)||(O=p.getGeometryInstanceAttributes(t),this._outlineAttributes=O),s!==this._lastOutlineShow&&(O.show=mn.toValue(s,O.show),this._lastOutlineShow=s),z.equals(a,this._lastOutlineColor)||(O.color=$t.toValue(a,O.color),z.clone(a,this._lastOutlineColor)),Pt.equals(U,this._lastDistanceDisplayCondition)||(I.distanceDisplayCondition=Vn.toValue(U,I.distanceDisplayCondition),O.distanceDisplayCondition=Vn.toValue(U,O.distanceDisplayCondition),Pt.clone(U,this._lastDistanceDisplayCondition)),d.equals(B,this._lastOffset)||(I.offset=Zi.toValue(B,I.offset),O.offset=Zi.toValue(B,I.offset),d.clone(B,this._lastOffset))}P&&(i.x=Math.max(i.x,.001),i.y=Math.max(i.y,.001),i.z=Math.max(i.z,.001),o=L.multiplyByScale(o,i,o),this._primitive.modelMatrix=o,this._outlinePrimitive.modelMatrix=o)};function N_(e){e=y(e,y.EMPTY_OBJECT);const t=y(e.vertexFormat,Ee.DEFAULT);this._vertexFormat=t,this._workerName="createPlaneGeometry"}N_.packedLength=Ee.packedLength;N_.pack=function(e,t,n){return A.typeOf.object("value",e),A.defined("array",t),n=y(n,0),Ee.pack(e._vertexFormat,t,n),t};const Dj=new Ee,xDe={vertexFormat:Dj};N_.unpack=function(e,t,n){A.defined("array",e),t=y(t,0);const i=Ee.unpack(e,t,Dj);return c(n)?(n._vertexFormat=Ee.clone(i,n._vertexFormat),n):new N_(xDe)};const zT=new d(-.5,-.5,0),UT=new d(.5,.5,0);N_.createGeometry=function(e){const t=e._vertexFormat,n=new oi;let i,o;if(t.position){if(o=new Float64Array(4*3),o[0]=zT.x,o[1]=zT.y,o[2]=0,o[3]=UT.x,o[4]=zT.y,o[5]=0,o[6]=UT.x,o[7]=UT.y,o[8]=0,o[9]=zT.x,o[10]=UT.y,o[11]=0,n.position=new Ie({componentDatatype:Z.DOUBLE,componentsPerAttribute:3,values:o}),t.normal){const r=new Float32Array(12);r[0]=0,r[1]=0,r[2]=1,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=1,r[9]=0,r[10]=0,r[11]=1,n.normal=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:3,values:r})}if(t.st){const r=new Float32Array(8);r[0]=0,r[1]=0,r[2]=1,r[3]=0,r[4]=1,r[5]=1,r[6]=0,r[7]=1,n.st=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:2,values:r})}if(t.tangent){const r=new Float32Array(12);r[0]=1,r[1]=0,r[2]=0,r[3]=1,r[4]=0,r[5]=0,r[6]=1,r[7]=0,r[8]=0,r[9]=1,r[10]=0,r[11]=0,n.tangent=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:3,values:r})}if(t.bitangent){const r=new Float32Array(12);r[0]=0,r[1]=1,r[2]=0,r[3]=0,r[4]=1,r[5]=0,r[6]=0,r[7]=1,r[8]=0,r[9]=0,r[10]=1,r[11]=0,n.bitangent=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:3,values:r})}i=new Uint16Array(2*3),i[0]=0,i[1]=1,i[2]=2,i[3]=0,i[4]=2,i[5]=3}return new Tt({attributes:n,indices:i,primitiveType:ze.TRIANGLES,boundingSphere:new se(d.ZERO,Math.sqrt(2))})};function M_(){this._workerName="createPlaneOutlineGeometry"}M_.packedLength=0;M_.pack=function(e,t){return A.defined("value",e),A.defined("array",t),t};M_.unpack=function(e,t,n){return A.defined("array",e),c(n)?n:new M_};const Yd=new d(-.5,-.5,0),kT=new d(.5,.5,0);M_.createGeometry=function(){const e=new oi,t=new Uint16Array(4*2),n=new Float64Array(4*3);return n[0]=Yd.x,n[1]=Yd.y,n[2]=Yd.z,n[3]=kT.x,n[4]=Yd.y,n[5]=Yd.z,n[6]=kT.x,n[7]=kT.y,n[8]=Yd.z,n[9]=Yd.x,n[10]=kT.y,n[11]=Yd.z,e.position=new Ie({componentDatatype:Z.DOUBLE,componentsPerAttribute:3,values:n}),t[0]=0,t[1]=1,t[2]=1,t[3]=2,t[4]=2,t[5]=3,t[6]=3,t[7]=0,new Tt({attributes:e,indices:t,primitiveType:ze.LINES,boundingSphere:new se(d.ZERO,Math.sqrt(2))})};const CDe=new d,Pj=new z;function EDe(e){this.id=e,this.vertexFormat=void 0,this.plane=void 0,this.dimensions=void 0}function yc(e,t){dn.call(this,{entity:e,scene:t,geometryOptions:new EDe(e),geometryPropertyName:"plane",observedPropertyNames:["availability","position","orientation","plane"]}),this._onEntityPropertyChanged(e,"plane",e.plane,void 0)}c(Object.create)&&(yc.prototype=Object.create(dn.prototype),yc.prototype.constructor=yc);yc.prototype.createFillGeometryInstance=function(e){if(A.defined("time",e),!this._fillEnabled)throw new E("This instance does not represent a filled geometry.");const t=this._entity,n=t.isAvailable(e);let i,o;const r=new mn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),s=this._distanceDisplayConditionProperty.getValue(e),a=Vn.fromDistanceDisplayCondition(s);if(this._materialProperty instanceof kt){let g;c(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(g=this._materialProperty.color.getValue(e,Pj)),c(g)||(g=z.WHITE),o=$t.fromColor(g),i={show:r,distanceDisplayCondition:a,color:o}}else i={show:r,distanceDisplayCondition:a};const l=t.plane,u=this._options;let h=t.computeModelMatrix(e);const f=K.getValueOrDefault(l.plane,e,u.plane),_=K.getValueOrUndefined(l.dimensions,e,u.dimensions);return u.plane=f,u.dimensions=_,h=l1(f,_,h,h),new Gt({id:t,geometry:new N_(this._options),modelMatrix:h,attributes:i})};yc.prototype.createOutlineGeometryInstance=function(e){if(A.defined("time",e),!this._outlineEnabled)throw new E("This instance does not represent an outlined geometry.");const t=this._entity,n=t.isAvailable(e),i=K.getValueOrDefault(this._outlineColorProperty,e,z.BLACK,Pj),o=this._distanceDisplayConditionProperty.getValue(e),r=t.plane,s=this._options;let a=t.computeModelMatrix(e);const l=K.getValueOrDefault(r.plane,e,s.plane),u=K.getValueOrUndefined(r.dimensions,e,s.dimensions);return s.plane=l,s.dimensions=u,a=l1(l,u,a,a),new Gt({id:t,geometry:new M_,modelMatrix:a,attributes:{show:new mn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:$t.fromColor(i),distanceDisplayCondition:Vn.fromDistanceDisplayCondition(o)}})};yc.prototype._isHidden=function(e,t){return!c(t.plane)||!c(t.dimensions)||!c(e.position)||dn.prototype._isHidden.call(this,e,t)};yc.prototype._getIsClosed=function(e){return!1};yc.prototype._isDynamic=function(e,t){return!e.position.isConstant||!K.isConstant(e.orientation)||!t.plane.isConstant||!t.dimensions.isConstant||!K.isConstant(t.outlineWidth)};yc.prototype._setStaticOptions=function(e,t){const n=this._materialProperty instanceof kt,i=this._options;i.vertexFormat=n?tn.VERTEX_FORMAT:oo.MaterialSupport.TEXTURED.vertexFormat,i.plane=t.plane.getValue(Ke.MINIMUM_VALUE,i.plane),i.dimensions=t.dimensions.getValue(Ke.MINIMUM_VALUE,i.dimensions)};yc.DynamicGeometryUpdater=d_;function d_(e,t,n){On.call(this,e,t,n)}c(Object.create)&&(d_.prototype=Object.create(On.prototype),d_.prototype.constructor=d_);d_.prototype._isHidden=function(e,t,n){const i=this._options,o=K.getValueOrUndefined(e.position,n,CDe);return!c(o)||!c(i.plane)||!c(i.dimensions)||On.prototype._isHidden.call(this,e,t,n)};d_.prototype._setOptions=function(e,t,n){const i=this._options;i.plane=K.getValueOrDefault(t.plane,n,i.plane),i.dimensions=K.getValueOrUndefined(t.dimensions,n,i.dimensions)};const wDe=new d,SDe=new d,vDe=new d,IDe=new d,DDe=new $,PDe=new $,ODe=new L;function l1(e,t,n,i){const o=e.normal,r=e.distance,s=d.multiplyByScalar(o,-r,vDe);let a=d.clone(d.UNIT_Z,SDe);R.equalsEpsilon(Math.abs(d.dot(a,o)),1,R.EPSILON8)&&(a=d.clone(d.UNIT_Y,a));const l=d.cross(a,o,wDe);a=d.cross(o,l,a),d.normalize(l,l),d.normalize(a,a);const u=DDe;$.setColumn(u,0,l,u),$.setColumn(u,1,a,u),$.setColumn(u,2,o,u);const h=d.fromElements(t.x,t.y,1,IDe),f=$.multiplyByScale(u,h,PDe),_=L.fromRotationTranslation(f,s,ODe);return L.multiplyTransformation(n,_,i)}yc.createPrimitiveMatrix=l1;const LDe=new d,RDe=new Re,NDe=new H,MDe=new H,FDe=new d,BDe=new d,zDe=new d,Xg=new d,UDe=new d,kDe=new d,k2=new _e,VDe=new $,HDe=new $,GDe=new d;function jDe(e,t,n,i,o,r,s,a,l){const u=e.positions;let h=ai.triangulate(e.positions2D,e.holes);h.length<3&&(h=[0,1,2]);const f=je.createTypedArray(u.length,h.length);f.set(h);let _=VDe;if(i!==0){let S=_e.fromAxisAngle(s,i,k2);if(_=$.fromQuaternion(S,_),t.tangent||t.bitangent){S=_e.fromAxisAngle(s,-i,k2);const D=$.fromQuaternion(S,HDe);a=d.normalize($.multiplyByVector(D,a,a),a),t.bitangent&&(l=d.normalize(d.cross(s,a,l),l))}}else _=$.clone($.IDENTITY,_);const g=MDe;t.st&&(g.x=n.x,g.y=n.y);const m=u.length,b=m*3,T=new Float64Array(b),x=t.normal?new Float32Array(b):void 0,C=t.tangent?new Float32Array(b):void 0,w=t.bitangent?new Float32Array(b):void 0,v=t.st?new Float32Array(m*2):void 0;let P=0,N=0,k=0,M=0,U=0;for(let S=0;S<m;S++){const D=u[S];if(T[P++]=D.x,T[P++]=D.y,T[P++]=D.z,t.st)if(c(o)&&o.positions.length===m)v[U++]=o.positions[S].x,v[U++]=o.positions[S].y;else{const p=$.multiplyByVector(_,D,LDe),I=r(p,NDe);H.subtract(I,g,I);const O=R.clamp(I.x/n.width,0,1),F=R.clamp(I.y/n.height,0,1);v[U++]=O,v[U++]=F}t.normal&&(x[N++]=s.x,x[N++]=s.y,x[N++]=s.z),t.tangent&&(C[M++]=a.x,C[M++]=a.y,C[M++]=a.z),t.bitangent&&(w[k++]=l.x,w[k++]=l.y,w[k++]=l.z)}const B=new oi;return t.position&&(B.position=new Ie({componentDatatype:Z.DOUBLE,componentsPerAttribute:3,values:T})),t.normal&&(B.normal=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:3,values:x})),t.tangent&&(B.tangent=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:3,values:C})),t.bitangent&&(B.bitangent=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:3,values:w})),t.st&&(B.st=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:2,values:v})),new Tt({attributes:B,indices:f,primitiveType:ze.TRIANGLES})}function mp(e){e=y(e,y.EMPTY_OBJECT);const t=e.polygonHierarchy,n=e.textureCoordinates;A.defined("options.polygonHierarchy",t);const i=y(e.vertexFormat,Ee.DEFAULT);this._vertexFormat=Ee.clone(i),this._polygonHierarchy=t,this._stRotation=y(e.stRotation,0),this._ellipsoid=ae.clone(y(e.ellipsoid,ae.WGS84)),this._workerName="createCoplanarPolygonGeometry",this._textureCoordinates=n,this.packedLength=an.computeHierarchyPackedLength(t,d)+Ee.packedLength+ae.packedLength+(c(n)?an.computeHierarchyPackedLength(n,H):1)+2}mp.fromPositions=function(e){e=y(e,y.EMPTY_OBJECT),A.defined("options.positions",e.positions);const t={polygonHierarchy:{positions:e.positions},vertexFormat:e.vertexFormat,stRotation:e.stRotation,ellipsoid:e.ellipsoid,textureCoordinates:e.textureCoordinates};return new mp(t)};mp.pack=function(e,t,n){return A.typeOf.object("value",e),A.defined("array",t),n=y(n,0),n=an.packPolygonHierarchy(e._polygonHierarchy,t,n,d),ae.pack(e._ellipsoid,t,n),n+=ae.packedLength,Ee.pack(e._vertexFormat,t,n),n+=Ee.packedLength,t[n++]=e._stRotation,c(e._textureCoordinates)?n=an.packPolygonHierarchy(e._textureCoordinates,t,n,H):t[n++]=-1,t[n++]=e.packedLength,t};const WDe=ae.clone(ae.UNIT_SPHERE),qDe=new Ee,YDe={polygonHierarchy:{}};mp.unpack=function(e,t,n){A.defined("array",e),t=y(t,0);const i=an.unpackPolygonHierarchy(e,t,d);t=i.startingIndex,delete i.startingIndex;const o=ae.unpack(e,t,WDe);t+=ae.packedLength;const r=Ee.unpack(e,t,qDe);t+=Ee.packedLength;const s=e[t++],a=e[t]===-1?void 0:an.unpackPolygonHierarchy(e,t,H);c(a)?(t=a.startingIndex,delete a.startingIndex):t++;const l=e[t++];return c(n)||(n=new mp(YDe)),n._polygonHierarchy=i,n._ellipsoid=ae.clone(o,n._ellipsoid),n._vertexFormat=Ee.clone(r,n._vertexFormat),n._stRotation=s,n._textureCoordinates=a,n.packedLength=l,n};mp.createGeometry=function(e){const t=e._vertexFormat,n=e._polygonHierarchy,i=e._stRotation,o=e._textureCoordinates,r=c(o);let s=n.positions;if(s=gs(s,d.equalsEpsilon,!0),s.length<3)return;let a=FDe,l=BDe,u=zDe,h=UDe;const f=kDe;if(!QA.computeProjectTo2DArguments(s,Xg,h,f))return;if(a=d.cross(h,f,a),a=d.normalize(a,a),!d.equalsEpsilon(Xg,d.ZERO,R.EPSILON6)){const U=e._ellipsoid.geodeticSurfaceNormal(Xg,GDe);d.dot(a,U)<0&&(a=d.negate(a,a),h=d.negate(h,h))}const g=QA.createProjectPointsTo2DFunction(Xg,h,f),m=QA.createProjectPointTo2DFunction(Xg,h,f);t.tangent&&(l=d.clone(h,l)),t.bitangent&&(u=d.clone(f,u));const b=an.polygonsFromHierarchy(n,r,g,!1),T=b.hierarchy,x=b.polygons,C=function(U){return U},w=r?an.polygonsFromHierarchy(o,!0,C,!1).polygons:void 0;if(T.length===0)return;s=T[0].outerRing;const v=se.fromPoints(s),P=an.computeBoundingRectangle(a,m,s,i,RDe),N=[];for(let U=0;U<x.length;U++){const B=new Gt({geometry:jDe(x[U],t,P,i,r?w[U]:void 0,m,a,l,u)});N.push(B)}const k=ti.combineInstances(N)[0];k.attributes.position.values=new Float64Array(k.attributes.position.values),k.indices=je.createTypedArray(k.attributes.position.values.length/3,k.indices);const M=k.attributes;return t.position||delete M.position,new Tt({attributes:M,indices:k.indices,primitiveType:k.primitiveType,boundingSphere:v})};const Oj=[],Jx=[];function $De(e,t,n,i,o){const s=Co.fromPoints(t,e).projectPointsOntoPlane(t,Oj);ai.computeWindingOrder2D(s)===wc.CLOCKWISE&&(s.reverse(),t=t.slice().reverse());let l,u,h=t.length,f=0;if(i)for(l=new Float64Array(h*2*3),u=0;u<h;u++){const m=t[u],b=t[(u+1)%h];l[f++]=m.x,l[f++]=m.y,l[f++]=m.z,l[f++]=b.x,l[f++]=b.y,l[f++]=b.z}else{let m=0;if(o===cn.GEODESIC)for(u=0;u<h;u++)m+=an.subdivideLineCount(t[u],t[(u+1)%h],n);else if(o===cn.RHUMB)for(u=0;u<h;u++)m+=an.subdivideRhumbLineCount(e,t[u],t[(u+1)%h],n);for(l=new Float64Array(m*3),u=0;u<h;u++){let b;o===cn.GEODESIC?b=an.subdivideLine(t[u],t[(u+1)%h],n,Jx):o===cn.RHUMB&&(b=an.subdivideRhumbLine(e,t[u],t[(u+1)%h],n,Jx));const T=b.length;for(let x=0;x<T;++x)l[f++]=b[x]}}h=l.length/3;const _=h*2,g=je.createTypedArray(h,_);for(f=0,u=0;u<h-1;u++)g[f++]=u,g[f++]=u+1;return g[f++]=h-1,g[f++]=0,new Gt({geometry:new Tt({attributes:new oi({position:new Ie({componentDatatype:Z.DOUBLE,componentsPerAttribute:3,values:l})}),indices:g,primitiveType:ze.LINES})})}function XDe(e,t,n,i,o){const s=Co.fromPoints(t,e).projectPointsOntoPlane(t,Oj);ai.computeWindingOrder2D(s)===wc.CLOCKWISE&&(s.reverse(),t=t.slice().reverse());let l,u,h=t.length;const f=new Array(h);let _=0;if(i)for(l=new Float64Array(h*2*3*2),u=0;u<h;++u){f[u]=_/3;const T=t[u],x=t[(u+1)%h];l[_++]=T.x,l[_++]=T.y,l[_++]=T.z,l[_++]=x.x,l[_++]=x.y,l[_++]=x.z}else{let T=0;if(o===cn.GEODESIC)for(u=0;u<h;u++)T+=an.subdivideLineCount(t[u],t[(u+1)%h],n);else if(o===cn.RHUMB)for(u=0;u<h;u++)T+=an.subdivideRhumbLineCount(e,t[u],t[(u+1)%h],n);for(l=new Float64Array(T*3*2),u=0;u<h;++u){f[u]=_/3;let x;o===cn.GEODESIC?x=an.subdivideLine(t[u],t[(u+1)%h],n,Jx):o===cn.RHUMB&&(x=an.subdivideRhumbLine(e,t[u],t[(u+1)%h],n,Jx));const C=x.length;for(let w=0;w<C;++w)l[_++]=x[w]}}h=l.length/(3*2);const g=f.length,m=(h*2+g)*2,b=je.createTypedArray(h+g,m);for(_=0,u=0;u<h;++u)b[_++]=u,b[_++]=(u+1)%h,b[_++]=u+h,b[_++]=(u+1)%h+h;for(u=0;u<g;u++){const T=f[u];b[_++]=T,b[_++]=T+h}return new Gt({geometry:new Tt({attributes:new oi({position:new Ie({componentDatatype:Z.DOUBLE,componentsPerAttribute:3,values:l})}),indices:b,primitiveType:ze.LINES})})}function _p(e){if(A.typeOf.object("options",e),A.typeOf.object("options.polygonHierarchy",e.polygonHierarchy),e.perPositionHeight&&c(e.height))throw new E("Cannot use both options.perPositionHeight and options.height");if(c(e.arcType)&&e.arcType!==cn.GEODESIC&&e.arcType!==cn.RHUMB)throw new E("Invalid arcType. Valid options are ArcType.GEODESIC and ArcType.RHUMB.");const t=e.polygonHierarchy,n=y(e.ellipsoid,ae.WGS84),i=y(e.granularity,R.RADIANS_PER_DEGREE),o=y(e.perPositionHeight,!1),r=o&&c(e.extrudedHeight),s=y(e.arcType,cn.GEODESIC);let a=y(e.height,0),l=y(e.extrudedHeight,a);if(!r){const u=Math.max(a,l);l=Math.min(a,l),a=u}this._ellipsoid=ae.clone(n),this._granularity=i,this._height=a,this._extrudedHeight=l,this._arcType=s,this._polygonHierarchy=t,this._perPositionHeight=o,this._perPositionHeightExtrude=r,this._offsetAttribute=e.offsetAttribute,this._workerName="createPolygonOutlineGeometry",this.packedLength=an.computeHierarchyPackedLength(t,d)+ae.packedLength+8}_p.pack=function(e,t,n){return A.typeOf.object("value",e),A.defined("array",t),n=y(n,0),n=an.packPolygonHierarchy(e._polygonHierarchy,t,n,d),ae.pack(e._ellipsoid,t,n),n+=ae.packedLength,t[n++]=e._height,t[n++]=e._extrudedHeight,t[n++]=e._granularity,t[n++]=e._perPositionHeightExtrude?1:0,t[n++]=e._perPositionHeight?1:0,t[n++]=e._arcType,t[n++]=y(e._offsetAttribute,-1),t[n]=e.packedLength,t};const QDe=ae.clone(ae.UNIT_SPHERE),KDe={polygonHierarchy:{}};_p.unpack=function(e,t,n){A.defined("array",e),t=y(t,0);const i=an.unpackPolygonHierarchy(e,t,d);t=i.startingIndex,delete i.startingIndex;const o=ae.unpack(e,t,QDe);t+=ae.packedLength;const r=e[t++],s=e[t++],a=e[t++],l=e[t++]===1,u=e[t++]===1,h=e[t++],f=e[t++],_=e[t];return c(n)||(n=new _p(KDe)),n._polygonHierarchy=i,n._ellipsoid=ae.clone(o,n._ellipsoid),n._height=r,n._extrudedHeight=s,n._granularity=a,n._perPositionHeight=u,n._perPositionHeightExtrude=l,n._arcType=h,n._offsetAttribute=f===-1?void 0:f,n.packedLength=_,n};_p.fromPositions=function(e){e=y(e,y.EMPTY_OBJECT),A.defined("options.positions",e.positions);const t={polygonHierarchy:{positions:e.positions},height:e.height,extrudedHeight:e.extrudedHeight,ellipsoid:e.ellipsoid,granularity:e.granularity,perPositionHeight:e.perPositionHeight,arcType:e.arcType,offsetAttribute:e.offsetAttribute};return new _p(t)};_p.createGeometry=function(e){const t=e._ellipsoid,n=e._granularity,i=e._polygonHierarchy,o=e._perPositionHeight,r=e._arcType,s=an.polygonOutlinesFromHierarchy(i,!o,t);if(s.length===0)return;let a;const l=[],u=R.chordLength(n,t.maximumRadius),h=e._height,f=e._extrudedHeight,_=e._perPositionHeightExtrude||!R.equalsEpsilon(h,f,0,R.EPSILON2);let g,m;if(_)for(m=0;m<s.length;m++){if(a=XDe(t,s[m],u,o,r),a.geometry=an.scaleToGeodeticHeightExtruded(a.geometry,h,f,t,o),c(e._offsetAttribute)){const x=a.geometry.attributes.position.values.length/3;let C=new Uint8Array(x);e._offsetAttribute===Kt.TOP?C=C.fill(1,0,x/2):(g=e._offsetAttribute===Kt.NONE?0:1,C=C.fill(g)),a.geometry.attributes.applyOffset=new Ie({componentDatatype:Z.UNSIGNED_BYTE,componentsPerAttribute:1,values:C})}l.push(a)}else for(m=0;m<s.length;m++){if(a=$De(t,s[m],u,o,r),a.geometry.attributes.position.values=ai.scaleToGeodeticHeight(a.geometry.attributes.position.values,h,t,!o),c(e._offsetAttribute)){const x=a.geometry.attributes.position.values.length;g=e._offsetAttribute===Kt.NONE?0:1;const C=new Uint8Array(x/3).fill(g);a.geometry.attributes.applyOffset=new Ie({componentDatatype:Z.UNSIGNED_BYTE,componentsPerAttribute:1,values:C})}l.push(a)}const b=ti.combineInstances(l)[0],T=se.fromVertices(b.attributes.position.values);return new Tt({attributes:b.attributes,indices:b.indices,primitiveType:b.primitiveType,boundingSphere:T,offsetAttribute:e._offsetAttribute})};const Lj="Entity polygons cannot have both height and perPositionHeight. height will be ignored",Rj="heightReference is not supported for entity polygons with perPositionHeight. heightReference will be ignored",Nj=new z,Mj=d.ZERO,Fj=new d,Bj=new ce,ZDe=[],JDe=new H;function ePe(e){this.id=e,this.vertexFormat=void 0,this.polygonHierarchy=void 0,this.perPositionHeight=void 0,this.closeTop=void 0,this.closeBottom=void 0,this.height=void 0,this.extrudedHeight=void 0,this.granularity=void 0,this.stRotation=void 0,this.offsetAttribute=void 0,this.arcType=void 0,this.textureCoordinates=void 0}function Da(e,t){Ut.call(this,{entity:e,scene:t,geometryOptions:new ePe(e),geometryPropertyName:"polygon",observedPropertyNames:["availability","polygon"]}),this._onEntityPropertyChanged(e,"polygon",e.polygon,void 0)}c(Object.create)&&(Da.prototype=Object.create(Ut.prototype),Da.prototype.constructor=Da);Da.prototype.createFillGeometryInstance=function(e){if(A.defined("time",e),!this._fillEnabled)throw new E("This instance does not represent a filled geometry.");const t=this._entity,n=t.isAvailable(e),i=this._options,o={show:new mn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),distanceDisplayCondition:Vn.fromDistanceDisplayCondition(this._distanceDisplayConditionProperty.getValue(e)),offset:void 0,color:void 0};if(this._materialProperty instanceof kt){let s;c(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(s=this._materialProperty.color.getValue(e,Nj)),c(s)||(s=z.WHITE),o.color=$t.fromColor(s)}c(i.offsetAttribute)&&(o.offset=Zi.fromCartesian3(K.getValueOrDefault(this._terrainOffsetProperty,e,Mj,Fj)));let r;return i.perPositionHeight&&!c(i.extrudedHeight)?r=new mp(i):r=new Us(i),new Gt({id:t,geometry:r,attributes:o})};Da.prototype.createOutlineGeometryInstance=function(e){if(A.defined("time",e),!this._outlineEnabled)throw new E("This instance does not represent an outlined geometry.");const t=this._entity,n=t.isAvailable(e),i=this._options,o=K.getValueOrDefault(this._outlineColorProperty,e,z.BLACK,Nj),r=this._distanceDisplayConditionProperty.getValue(e),s={show:new mn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:$t.fromColor(o),distanceDisplayCondition:Vn.fromDistanceDisplayCondition(r),offset:void 0};c(i.offsetAttribute)&&(s.offset=Zi.fromCartesian3(K.getValueOrDefault(this._terrainOffsetProperty,e,Mj,Fj)));let a;return i.perPositionHeight&&!c(i.extrudedHeight)?a=new ga(i):a=new _p(i),new Gt({id:t,geometry:a,attributes:s})};Da.prototype._computeCenter=function(e,t){const n=K.getValueOrUndefined(this._entity.polygon.hierarchy,e);if(!c(n))return;const i=n.positions;if(i.length===0)return;const o=this._scene.mapProjection.ellipsoid,r=Co.fromPoints(i,o),s=r.projectPointsOntoPlane(i,ZDe),a=s.length;let l=0,u=a-1,h=new H;for(let _=0;_<a;u=_++){const g=s[_],m=s[u],b=g.x*m.y-m.x*g.y;let T=H.add(g,m,JDe);T=H.multiplyByScalar(T,b,T),h=H.add(h,T,h),l+=b}const f=1/(l*3);return h=H.multiplyByScalar(h,f,h),r.projectPointOntoEllipsoid(h,t)};Da.prototype._isHidden=function(e,t){return!c(t.hierarchy)||dn.prototype._isHidden.call(this,e,t)};Da.prototype._isOnTerrain=function(e,t){const n=Ut.prototype._isOnTerrain.call(this,e,t),i=t.perPositionHeight,o=c(i)&&(i.isConstant?i.getValue(Ke.MINIMUM_VALUE):!0);return n&&!o};Da.prototype._isDynamic=function(e,t){return!t.hierarchy.isConstant||!K.isConstant(t.height)||!K.isConstant(t.extrudedHeight)||!K.isConstant(t.granularity)||!K.isConstant(t.stRotation)||!K.isConstant(t.textureCoordinates)||!K.isConstant(t.outlineWidth)||!K.isConstant(t.perPositionHeight)||!K.isConstant(t.closeTop)||!K.isConstant(t.closeBottom)||!K.isConstant(t.zIndex)||!K.isConstant(t.arcType)||this._onTerrain&&!K.isConstant(this._materialProperty)&&!(this._materialProperty instanceof kt)};Da.prototype._setStaticOptions=function(e,t){const n=this._materialProperty instanceof kt,i=this._options;i.vertexFormat=n?tn.VERTEX_FORMAT:oo.MaterialSupport.TEXTURED.vertexFormat;const o=t.hierarchy.getValue(Ke.MINIMUM_VALUE);let r=K.getValueOrUndefined(t.height,Ke.MINIMUM_VALUE);const s=K.getValueOrDefault(t.heightReference,Ke.MINIMUM_VALUE,gt.NONE);let a=K.getValueOrUndefined(t.extrudedHeight,Ke.MINIMUM_VALUE);const l=K.getValueOrDefault(t.extrudedHeightReference,Ke.MINIMUM_VALUE,gt.NONE),u=K.getValueOrDefault(t.perPositionHeight,Ke.MINIMUM_VALUE,!1);r=Ut.getGeometryHeight(r,s);let h;if(u?(c(r)&&(r=void 0,$n(Lj)),s!==gt.NONE&&u&&(r=void 0,$n(Rj))):(c(a)&&!c(r)&&(r=0),h=Ut.computeGeometryOffsetAttribute(r,s,a,l)),i.polygonHierarchy=o,i.granularity=K.getValueOrUndefined(t.granularity,Ke.MINIMUM_VALUE),i.stRotation=K.getValueOrUndefined(t.stRotation,Ke.MINIMUM_VALUE),i.perPositionHeight=u,i.closeTop=K.getValueOrDefault(t.closeTop,Ke.MINIMUM_VALUE,!0),i.closeBottom=K.getValueOrDefault(t.closeBottom,Ke.MINIMUM_VALUE,!0),i.offsetAttribute=h,i.height=r,i.arcType=K.getValueOrDefault(t.arcType,Ke.MINIMUM_VALUE,cn.GEODESIC),i.textureCoordinates=K.getValueOrUndefined(t.textureCoordinates,Ke.MINIMUM_VALUE),a=Ut.getGeometryExtrudedHeight(a,l),a===Ut.CLAMP_TO_GROUND){const f=Us.computeRectangleFromPositions(i.polygonHierarchy.positions,i.ellipsoid,i.arcType,Bj);a=Ti.getMinimumMaximumHeights(f).minimumTerrainHeight}i.extrudedHeight=a};Da.prototype._getIsClosed=function(e){const t=e.height,n=e.extrudedHeight,i=c(n)&&n!==t;return!e.perPositionHeight&&(!i&&t===0||i&&e.closeTop&&e.closeBottom)};Da.DynamicGeometryUpdater=h_;function h_(e,t,n){On.call(this,e,t,n)}c(Object.create)&&(h_.prototype=Object.create(On.prototype),h_.prototype.constructor=h_);h_.prototype._isHidden=function(e,t,n){return!c(this._options.polygonHierarchy)||On.prototype._isHidden.call(this,e,t,n)};h_.prototype._setOptions=function(e,t,n){const i=this._options;i.polygonHierarchy=K.getValueOrUndefined(t.hierarchy,n);let o=K.getValueOrUndefined(t.height,n);const r=K.getValueOrDefault(t.heightReference,n,gt.NONE),s=K.getValueOrDefault(t.extrudedHeightReference,n,gt.NONE);let a=K.getValueOrUndefined(t.extrudedHeight,n);const l=K.getValueOrUndefined(t.perPositionHeight,n);o=Ut.getGeometryHeight(o,s);let u;if(l?(c(o)&&(o=void 0,$n(Lj)),r!==gt.NONE&&l&&(o=void 0,$n(Rj))):(c(a)&&!c(o)&&(o=0),u=Ut.computeGeometryOffsetAttribute(o,r,a,s)),i.granularity=K.getValueOrUndefined(t.granularity,n),i.stRotation=K.getValueOrUndefined(t.stRotation,n),i.textureCoordinates=K.getValueOrUndefined(t.textureCoordinates,n),i.perPositionHeight=K.getValueOrUndefined(t.perPositionHeight,n),i.closeTop=K.getValueOrDefault(t.closeTop,n,!0),i.closeBottom=K.getValueOrDefault(t.closeBottom,n,!0),i.offsetAttribute=u,i.height=o,i.arcType=K.getValueOrDefault(t.arcType,n,cn.GEODESIC),a=Ut.getGeometryExtrudedHeight(a,s),a===Ut.CLAMP_TO_GROUND){const h=Us.computeRectangleFromPositions(i.polygonHierarchy.positions,i.ellipsoid,i.arcType,Bj);a=Ti.getMinimumMaximumHeights(h).minimumTerrainHeight}i.extrudedHeight=a};function tPe(e,t,n,i){const o=new oi;i.position&&(o.position=new Ie({componentDatatype:Z.DOUBLE,componentsPerAttribute:3,values:e}));const r=t.length,s=e.length/3,a=(s-r*2)/(r*2),l=ai.triangulate(t),u=(a-1)*r*6+l.length*2,h=je.createTypedArray(s,u);let f,_,g,m,b,T;const x=r*2;let C=0;for(f=0;f<a-1;f++){for(_=0;_<r-1;_++)g=_*2+f*r*2,T=g+x,m=g+1,b=m+x,h[C++]=m,h[C++]=g,h[C++]=b,h[C++]=b,h[C++]=g,h[C++]=T;g=r*2-2+f*r*2,m=g+1,b=m+x,T=g+x,h[C++]=m,h[C++]=g,h[C++]=b,h[C++]=b,h[C++]=g,h[C++]=T}if(i.st||i.tangent||i.bitangent){const P=new Float32Array(s*2),N=1/(a-1),k=1/n.height,M=n.height/2;let U,B,S=0;for(f=0;f<a;f++){for(U=f*N,B=k*(t[0].y+M),P[S++]=U,P[S++]=B,_=1;_<r;_++)B=k*(t[_].y+M),P[S++]=U,P[S++]=B,P[S++]=U,P[S++]=B;B=k*(t[0].y+M),P[S++]=U,P[S++]=B}for(_=0;_<r;_++)U=0,B=k*(t[_].y+M),P[S++]=U,P[S++]=B;for(_=0;_<r;_++)U=(a-1)*N,B=k*(t[_].y+M),P[S++]=U,P[S++]=B;o.st=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:2,values:new Float32Array(P)})}const w=s-r*2;for(f=0;f<l.length;f+=3){const P=l[f]+w,N=l[f+1]+w,k=l[f+2]+w;h[C++]=P,h[C++]=N,h[C++]=k,h[C++]=k+r,h[C++]=N+r,h[C++]=P+r}let v=new Tt({attributes:o,indices:h,boundingSphere:se.fromVertices(e),primitiveType:ze.TRIANGLES});if(i.normal&&(v=ti.computeNormal(v)),i.tangent||i.bitangent){try{v=ti.computeTangentAndBitangent(v)}catch{$n("polyline-volume-tangent-bitangent","Unable to compute tangents and bitangents for polyline volume geometry")}i.tangent||(v.attributes.tangent=void 0),i.bitangent||(v.attributes.bitangent=void 0),i.st||(v.attributes.st=void 0)}return v}function C0(e){e=y(e,y.EMPTY_OBJECT);const t=e.polylinePositions,n=e.shapePositions;if(!c(t))throw new E("options.polylinePositions is required.");if(!c(n))throw new E("options.shapePositions is required.");this._positions=t,this._shape=n,this._ellipsoid=ae.clone(y(e.ellipsoid,ae.WGS84)),this._cornerType=y(e.cornerType,go.ROUNDED),this._vertexFormat=Ee.clone(y(e.vertexFormat,Ee.DEFAULT)),this._granularity=y(e.granularity,R.RADIANS_PER_DEGREE),this._workerName="createPolylineVolumeGeometry";let i=1+t.length*d.packedLength;i+=1+n.length*H.packedLength,this.packedLength=i+ae.packedLength+Ee.packedLength+2}C0.pack=function(e,t,n){if(!c(e))throw new E("value is required");if(!c(t))throw new E("array is required");n=y(n,0);let i;const o=e._positions;let r=o.length;for(t[n++]=r,i=0;i<r;++i,n+=d.packedLength)d.pack(o[i],t,n);const s=e._shape;for(r=s.length,t[n++]=r,i=0;i<r;++i,n+=H.packedLength)H.pack(s[i],t,n);return ae.pack(e._ellipsoid,t,n),n+=ae.packedLength,Ee.pack(e._vertexFormat,t,n),n+=Ee.packedLength,t[n++]=e._cornerType,t[n]=e._granularity,t};const zj=ae.clone(ae.UNIT_SPHERE),Uj=new Ee,Qg={polylinePositions:void 0,shapePositions:void 0,ellipsoid:zj,vertexFormat:Uj,cornerType:void 0,granularity:void 0};C0.unpack=function(e,t,n){if(!c(e))throw new E("array is required");t=y(t,0);let i,o=e[t++];const r=new Array(o);for(i=0;i<o;++i,t+=d.packedLength)r[i]=d.unpack(e,t);o=e[t++];const s=new Array(o);for(i=0;i<o;++i,t+=H.packedLength)s[i]=H.unpack(e,t);const a=ae.unpack(e,t,zj);t+=ae.packedLength;const l=Ee.unpack(e,t,Uj);t+=Ee.packedLength;const u=e[t++],h=e[t];return c(n)?(n._positions=r,n._shape=s,n._ellipsoid=ae.clone(a,n._ellipsoid),n._vertexFormat=Ee.clone(l,n._vertexFormat),n._cornerType=u,n._granularity=h,n):(Qg.polylinePositions=r,Qg.shapePositions=s,Qg.cornerType=u,Qg.granularity=h,new C0(Qg))};const nPe=new Re;C0.createGeometry=function(e){const t=e._positions,n=gs(t,d.equalsEpsilon);let i=e._shape;if(i=A0.removeDuplicatesFromShape(i),n.length<2||i.length<3)return;ai.computeWindingOrder2D(i)===wc.CLOCKWISE&&i.reverse();const o=Re.fromPoints(i,nPe),r=A0.computePositions(n,i,o,e,!0);return tPe(r,i,o,e._vertexFormat)};function iPe(e,t){const n=new oi;n.position=new Ie({componentDatatype:Z.DOUBLE,componentsPerAttribute:3,values:e});const i=t.length,o=n.position.values.length/3,s=e.length/3/i,a=je.createTypedArray(o,2*i*(s+1));let l,u,h=0;l=0;let f=l*i;for(u=0;u<i-1;u++)a[h++]=u+f,a[h++]=u+f+1;for(a[h++]=i-1+f,a[h++]=f,l=s-1,f=l*i,u=0;u<i-1;u++)a[h++]=u+f,a[h++]=u+f+1;for(a[h++]=i-1+f,a[h++]=f,l=0;l<s-1;l++){const g=i*l,m=g+i;for(u=0;u<i;u++)a[h++]=u+g,a[h++]=u+m}return new Tt({attributes:n,indices:je.createTypedArray(o,a),boundingSphere:se.fromVertices(e),primitiveType:ze.LINES})}function E0(e){e=y(e,y.EMPTY_OBJECT);const t=e.polylinePositions,n=e.shapePositions;if(!c(t))throw new E("options.polylinePositions is required.");if(!c(n))throw new E("options.shapePositions is required.");this._positions=t,this._shape=n,this._ellipsoid=ae.clone(y(e.ellipsoid,ae.WGS84)),this._cornerType=y(e.cornerType,go.ROUNDED),this._granularity=y(e.granularity,R.RADIANS_PER_DEGREE),this._workerName="createPolylineVolumeOutlineGeometry";let i=1+t.length*d.packedLength;i+=1+n.length*H.packedLength,this.packedLength=i+ae.packedLength+2}E0.pack=function(e,t,n){if(!c(e))throw new E("value is required");if(!c(t))throw new E("array is required");n=y(n,0);let i;const o=e._positions;let r=o.length;for(t[n++]=r,i=0;i<r;++i,n+=d.packedLength)d.pack(o[i],t,n);const s=e._shape;for(r=s.length,t[n++]=r,i=0;i<r;++i,n+=H.packedLength)H.pack(s[i],t,n);return ae.pack(e._ellipsoid,t,n),n+=ae.packedLength,t[n++]=e._cornerType,t[n]=e._granularity,t};const kj=ae.clone(ae.UNIT_SPHERE),Kg={polylinePositions:void 0,shapePositions:void 0,ellipsoid:kj,height:void 0,cornerType:void 0,granularity:void 0};E0.unpack=function(e,t,n){if(!c(e))throw new E("array is required");t=y(t,0);let i,o=e[t++];const r=new Array(o);for(i=0;i<o;++i,t+=d.packedLength)r[i]=d.unpack(e,t);o=e[t++];const s=new Array(o);for(i=0;i<o;++i,t+=H.packedLength)s[i]=H.unpack(e,t);const a=ae.unpack(e,t,kj);t+=ae.packedLength;const l=e[t++],u=e[t];return c(n)?(n._positions=r,n._shape=s,n._ellipsoid=ae.clone(a,n._ellipsoid),n._cornerType=l,n._granularity=u,n):(Kg.polylinePositions=r,Kg.shapePositions=s,Kg.cornerType=l,Kg.granularity=u,new E0(Kg))};const oPe=new Re;E0.createGeometry=function(e){const t=e._positions,n=gs(t,d.equalsEpsilon);let i=e._shape;if(i=A0.removeDuplicatesFromShape(i),n.length<2||i.length<3)return;ai.computeWindingOrder2D(i)===wc.CLOCKWISE&&i.reverse();const o=Re.fromPoints(i,oPe),r=A0.computePositions(n,i,o,e,!1);return iPe(r,i)};const Vj=new z;function rPe(e){this.id=e,this.vertexFormat=void 0,this.polylinePositions=void 0,this.shapePositions=void 0,this.cornerType=void 0,this.granularity=void 0}function tu(e,t){dn.call(this,{entity:e,scene:t,geometryOptions:new rPe(e),geometryPropertyName:"polylineVolume",observedPropertyNames:["availability","polylineVolume"]}),this._onEntityPropertyChanged(e,"polylineVolume",e.polylineVolume,void 0)}c(Object.create)&&(tu.prototype=Object.create(dn.prototype),tu.prototype.constructor=tu);tu.prototype.createFillGeometryInstance=function(e){if(A.defined("time",e),!this._fillEnabled)throw new E("This instance does not represent a filled geometry.");const t=this._entity,n=t.isAvailable(e);let i,o;const r=new mn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),s=this._distanceDisplayConditionProperty.getValue(e),a=Vn.fromDistanceDisplayCondition(s);if(this._materialProperty instanceof kt){let l;c(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(l=this._materialProperty.color.getValue(e,Vj)),c(l)||(l=z.WHITE),o=$t.fromColor(l),i={show:r,distanceDisplayCondition:a,color:o}}else i={show:r,distanceDisplayCondition:a};return new Gt({id:t,geometry:new C0(this._options),attributes:i})};tu.prototype.createOutlineGeometryInstance=function(e){if(A.defined("time",e),!this._outlineEnabled)throw new E("This instance does not represent an outlined geometry.");const t=this._entity,n=t.isAvailable(e),i=K.getValueOrDefault(this._outlineColorProperty,e,z.BLACK,Vj),o=this._distanceDisplayConditionProperty.getValue(e);return new Gt({id:t,geometry:new E0(this._options),attributes:{show:new mn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:$t.fromColor(i),distanceDisplayCondition:Vn.fromDistanceDisplayCondition(o)}})};tu.prototype._isHidden=function(e,t){return!c(t.positions)||!c(t.shape)||dn.prototype._isHidden.call(this,e,t)};tu.prototype._isDynamic=function(e,t){return!t.positions.isConstant||!t.shape.isConstant||!K.isConstant(t.granularity)||!K.isConstant(t.outlineWidth)||!K.isConstant(t.cornerType)};tu.prototype._setStaticOptions=function(e,t){const n=t.granularity,i=t.cornerType,o=this._options,r=this._materialProperty instanceof kt;o.vertexFormat=r?tn.VERTEX_FORMAT:oo.MaterialSupport.TEXTURED.vertexFormat,o.polylinePositions=t.positions.getValue(Ke.MINIMUM_VALUE,o.polylinePositions),o.shapePositions=t.shape.getValue(Ke.MINIMUM_VALUE,o.shape),o.granularity=c(n)?n.getValue(Ke.MINIMUM_VALUE):void 0,o.cornerType=c(i)?i.getValue(Ke.MINIMUM_VALUE):void 0};tu.DynamicGeometryUpdater=f_;function f_(e,t,n){On.call(this,e,t,n)}c(Object.create)&&(f_.prototype=Object.create(On.prototype),f_.prototype.constructor=f_);f_.prototype._isHidden=function(e,t,n){const i=this._options;return!c(i.polylinePositions)||!c(i.shapePositions)||On.prototype._isHidden.call(this,e,t,n)};f_.prototype._setOptions=function(e,t,n){const i=this._options;i.polylinePositions=K.getValueOrUndefined(t.positions,n,i.polylinePositions),i.shapePositions=K.getValueOrUndefined(t.shape,n),i.granularity=K.getValueOrUndefined(t.granularity,n),i.cornerType=K.getValueOrUndefined(t.cornerType,n)};const u1=new d,Hj=new d,Gj=new d,jj=new d,Wj=new ce,sPe=new H,aPe=new se,cPe=new se;function qj(e,t){const n=new Tt({attributes:new oi,primitiveType:ze.TRIANGLES});return n.attributes.position=new Ie({componentDatatype:Z.DOUBLE,componentsPerAttribute:3,values:t.positions}),e.normal&&(n.attributes.normal=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:3,values:t.normals})),e.tangent&&(n.attributes.tangent=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:3,values:t.tangents})),e.bitangent&&(n.attributes.bitangent=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:3,values:t.bitangents})),n}function lPe(e,t,n,i){const o=e.length,r=t.normal?new Float32Array(o):void 0,s=t.tangent?new Float32Array(o):void 0,a=t.bitangent?new Float32Array(o):void 0;let l=0;const u=jj,h=Gj;let f=Hj;if(t.normal||t.tangent||t.bitangent)for(let _=0;_<o;_+=3){const g=d.fromArray(e,_,u1),m=l+1,b=l+2;f=n.geodeticSurfaceNormal(g,f),(t.tangent||t.bitangent)&&(d.cross(d.UNIT_Z,f,h),$.multiplyByVector(i,h,h),d.normalize(h,h),t.bitangent&&d.normalize(d.cross(f,h,u),u)),t.normal&&(r[l]=f.x,r[m]=f.y,r[b]=f.z),t.tangent&&(s[l]=h.x,s[m]=h.y,s[b]=h.z),t.bitangent&&(a[l]=u.x,a[m]=u.y,a[b]=u.z),l+=3}return qj(t,{positions:e,normals:r,tangents:s,bitangents:a})}const d1=new d,Yj=new d;function uPe(e,t,n){const i=e.length,o=t.normal?new Float32Array(i):void 0,r=t.tangent?new Float32Array(i):void 0,s=t.bitangent?new Float32Array(i):void 0;let a=0,l=0,u=0,h=!0,f=jj,_=Gj,g=Hj;if(t.normal||t.tangent||t.bitangent)for(let m=0;m<i;m+=6){const b=d.fromArray(e,m,u1),T=d.fromArray(e,(m+6)%i,d1);if(h){const x=d.fromArray(e,(m+3)%i,Yj);d.subtract(T,b,T),d.subtract(x,b,x),g=d.normalize(d.cross(x,T,g),g),h=!1}d.equalsEpsilon(T,b,R.EPSILON10)&&(h=!0),(t.tangent||t.bitangent)&&(f=n.geodeticSurfaceNormal(b,f),t.tangent&&(_=d.normalize(d.cross(f,g,_),_))),t.normal&&(o[a++]=g.x,o[a++]=g.y,o[a++]=g.z,o[a++]=g.x,o[a++]=g.y,o[a++]=g.z),t.tangent&&(r[l++]=_.x,r[l++]=_.y,r[l++]=_.z,r[l++]=_.x,r[l++]=_.y,r[l++]=_.z),t.bitangent&&(s[u++]=f.x,s[u++]=f.y,s[u++]=f.z,s[u++]=f.x,s[u++]=f.y,s[u++]=f.z)}return qj(t,{positions:e,normals:o,tangents:r,bitangents:s})}function $j(e,t){const n=e._vertexFormat,i=e._ellipsoid,o=t.height,r=t.width,s=t.northCap,a=t.southCap;let l=0,u=o,h=o,f=0;s&&(l=1,h-=1,f+=1),a&&(u-=1,h-=1,f+=1),f+=r*h;const _=n.position?new Float64Array(f*3):void 0,g=n.st?new Float32Array(f*2):void 0;let m=0,b=0;const T=u1,x=sPe;let C=Number.MAX_VALUE,w=Number.MAX_VALUE,v=-Number.MAX_VALUE,P=-Number.MAX_VALUE;for(let D=l;D<u;++D)for(let p=0;p<r;++p)Ns.computePosition(t,i,n.st,D,p,T,x),_[m++]=T.x,_[m++]=T.y,_[m++]=T.z,n.st&&(g[b++]=x.x,g[b++]=x.y,C=Math.min(C,x.x),w=Math.min(w,x.y),v=Math.max(v,x.x),P=Math.max(P,x.y));if(s&&(Ns.computePosition(t,i,n.st,0,0,T,x),_[m++]=T.x,_[m++]=T.y,_[m++]=T.z,n.st&&(g[b++]=x.x,g[b++]=x.y,C=x.x,w=x.y,v=x.x,P=x.y)),a&&(Ns.computePosition(t,i,n.st,o-1,0,T,x),_[m++]=T.x,_[m++]=T.y,_[m]=T.z,n.st&&(g[b++]=x.x,g[b]=x.y,C=Math.min(C,x.x),w=Math.min(w,x.y),v=Math.max(v,x.x),P=Math.max(P,x.y))),n.st&&(C<0||w<0||v>1||P>1))for(let D=0;D<g.length;D+=2)g[D]=(g[D]-C)/(v-C),g[D+1]=(g[D+1]-w)/(P-w);const N=lPe(_,n,i,t.tangentRotationMatrix);let k=6*(r-1)*(h-1);s&&(k+=3*(r-1)),a&&(k+=3*(r-1));const M=je.createTypedArray(f,k);let U=0,B=0,S;for(S=0;S<h-1;++S){for(let D=0;D<r-1;++D){const p=U,I=p+r,O=I+1,F=p+1;M[B++]=p,M[B++]=I,M[B++]=F,M[B++]=F,M[B++]=I,M[B++]=O,++U}++U}if(s||a){let D=f-1;const p=f-1;s&&a&&(D=f-2);let I,O;if(U=0,s)for(S=0;S<r-1;S++)I=U,O=I+1,M[B++]=D,M[B++]=I,M[B++]=O,++U;if(a)for(U=(h-1)*r,S=0;S<r-1;S++)I=U,O=I+1,M[B++]=I,M[B++]=p,M[B++]=O,++U}return N.indices=M,n.st&&(N.attributes.st=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:2,values:g})),N}function xm(e,t,n,i,o){return e[t++]=i[n],e[t++]=i[n+1],e[t++]=i[n+2],e[t++]=o[n],e[t++]=o[n+1],e[t]=o[n+2],e}function Cm(e,t,n,i){return e[t++]=i[n],e[t++]=i[n+1],e[t++]=i[n],e[t]=i[n+1],e}const h1=new Ee;function dPe(e,t){const n=e._shadowVolume,i=e._offsetAttribute,o=e._vertexFormat,r=e._extrudedHeight,s=e._surfaceHeight,a=e._ellipsoid,l=t.height,u=t.width;let h;if(n){const Fe=Ee.clone(o,h1);Fe.normal=!0,e._vertexFormat=Fe}const f=$j(e,t);n&&(e._vertexFormat=o);let _=ai.scaleToGeodeticHeight(f.attributes.position.values,s,a,!1);_=new Float64Array(_);let g=_.length;const m=g*2,b=new Float64Array(m);b.set(_);const T=ai.scaleToGeodeticHeight(f.attributes.position.values,r,a);b.set(T,g),f.attributes.position.values=b;const x=o.normal?new Float32Array(m):void 0,C=o.tangent?new Float32Array(m):void 0,w=o.bitangent?new Float32Array(m):void 0,v=o.st?new Float32Array(m/3*2):void 0;let P,N;if(o.normal){for(N=f.attributes.normal.values,x.set(N),h=0;h<g;h++)N[h]=-N[h];x.set(N,g),f.attributes.normal.values=x}if(n){N=f.attributes.normal.values,o.normal||(f.attributes.normal=void 0);const Fe=new Float32Array(m);for(h=0;h<g;h++)N[h]=-N[h];Fe.set(N,g),f.attributes.extrudeDirection=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:3,values:Fe})}let k;const M=c(i);if(M){const Fe=g/3*2;let Dt=new Uint8Array(Fe);i===Kt.TOP?Dt=Dt.fill(1,0,Fe/2):(k=i===Kt.NONE?0:1,Dt=Dt.fill(k)),f.attributes.applyOffset=new Ie({componentDatatype:Z.UNSIGNED_BYTE,componentsPerAttribute:1,values:Dt})}if(o.tangent){const Fe=f.attributes.tangent.values;for(C.set(Fe),h=0;h<g;h++)Fe[h]=-Fe[h];C.set(Fe,g),f.attributes.tangent.values=C}if(o.bitangent){const Fe=f.attributes.bitangent.values;w.set(Fe),w.set(Fe,g),f.attributes.bitangent.values=w}o.st&&(P=f.attributes.st.values,v.set(P),v.set(P,g/3*2),f.attributes.st.values=v);const U=f.indices,B=U.length,S=g/3,D=je.createTypedArray(m/3,B*2);for(D.set(U),h=0;h<B;h+=3)D[h+B]=U[h+2]+S,D[h+1+B]=U[h+1]+S,D[h+2+B]=U[h]+S;f.indices=D;const p=t.northCap,I=t.southCap;let O=l,F=2,V=0,G=4,j=4;p&&(F-=1,O-=1,V+=1,G-=2,j-=1),I&&(F-=1,O-=1,V+=1,G-=2,j-=1),V+=F*u+2*O-G;const W=(V+j)*2;let X=new Float64Array(W*3);const q=n?new Float32Array(W*3):void 0;let ee=M?new Uint8Array(W):void 0,Y=o.st?new Float32Array(W*2):void 0;const ne=i===Kt.TOP;M&&!ne&&(k=i===Kt.ALL?1:0,ee=ee.fill(k));let Q=0,le=0,pe=0,re=0;const de=u*O;let fe;for(h=0;h<de;h+=u)fe=h*3,X=xm(X,Q,fe,_,T),Q+=6,o.st&&(Y=Cm(Y,le,h*2,P),le+=4),n&&(pe+=3,q[pe++]=N[fe],q[pe++]=N[fe+1],q[pe++]=N[fe+2]),ne&&(ee[re++]=1,re+=1);if(I){const Fe=p?de+1:de;for(fe=Fe*3,h=0;h<2;h++)X=xm(X,Q,fe,_,T),Q+=6,o.st&&(Y=Cm(Y,le,Fe*2,P),le+=4),n&&(pe+=3,q[pe++]=N[fe],q[pe++]=N[fe+1],q[pe++]=N[fe+2]),ne&&(ee[re++]=1,re+=1)}else for(h=de-u;h<de;h++)fe=h*3,X=xm(X,Q,fe,_,T),Q+=6,o.st&&(Y=Cm(Y,le,h*2,P),le+=4),n&&(pe+=3,q[pe++]=N[fe],q[pe++]=N[fe+1],q[pe++]=N[fe+2]),ne&&(ee[re++]=1,re+=1);for(h=de-1;h>0;h-=u)fe=h*3,X=xm(X,Q,fe,_,T),Q+=6,o.st&&(Y=Cm(Y,le,h*2,P),le+=4),n&&(pe+=3,q[pe++]=N[fe],q[pe++]=N[fe+1],q[pe++]=N[fe+2]),ne&&(ee[re++]=1,re+=1);if(p){const Fe=de;for(fe=Fe*3,h=0;h<2;h++)X=xm(X,Q,fe,_,T),Q+=6,o.st&&(Y=Cm(Y,le,Fe*2,P),le+=4),n&&(pe+=3,q[pe++]=N[fe],q[pe++]=N[fe+1],q[pe++]=N[fe+2]),ne&&(ee[re++]=1,re+=1)}else for(h=u-1;h>=0;h--)fe=h*3,X=xm(X,Q,fe,_,T),Q+=6,o.st&&(Y=Cm(Y,le,h*2,P),le+=4),n&&(pe+=3,q[pe++]=N[fe],q[pe++]=N[fe+1],q[pe++]=N[fe+2]),ne&&(ee[re++]=1,re+=1);let ye=uPe(X,o,a);o.st&&(ye.attributes.st=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:2,values:Y})),n&&(ye.attributes.extrudeDirection=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:3,values:q})),M&&(ye.attributes.applyOffset=new Ie({componentDatatype:Z.UNSIGNED_BYTE,componentsPerAttribute:1,values:ee}));const Ce=je.createTypedArray(W,V*6);let we,Pe,lt,ft;g=X.length/3;let We=0;for(h=0;h<g-1;h+=2){we=h,ft=(we+2)%g;const Fe=d.fromArray(X,we*3,d1),Dt=d.fromArray(X,ft*3,Yj);d.equalsEpsilon(Fe,Dt,R.EPSILON10)||(Pe=(we+1)%g,lt=(Pe+2)%g,Ce[We++]=we,Ce[We++]=Pe,Ce[We++]=ft,Ce[We++]=ft,Ce[We++]=Pe,Ce[We++]=lt)}return ye.indices=Ce,ye=ti.combineInstances([new Gt({geometry:f}),new Gt({geometry:ye})]),ye[0]}const hPe=[new d,new d,new d,new d],Xj=new he,fPe=new he;function f1(e,t,n,i,o){if(n===0)return ce.clone(e,o);const r=Ns.computeOptions(e,t,n,0,Wj,Xj),s=r.height,a=r.width,l=hPe;return Ns.computePosition(r,i,!1,0,0,l[0]),Ns.computePosition(r,i,!1,0,a-1,l[1]),Ns.computePosition(r,i,!1,s-1,0,l[2]),Ns.computePosition(r,i,!1,s-1,a-1,l[3]),ce.fromCartesianArray(l,i,o)}function Nc(e){e=y(e,y.EMPTY_OBJECT);const t=e.rectangle;if(A.typeOf.object("rectangle",t),ce.validate(t),t.north<t.south)throw new E("options.rectangle.north must be greater than or equal to options.rectangle.south");const n=y(e.height,0),i=y(e.extrudedHeight,n);this._rectangle=ce.clone(t),this._granularity=y(e.granularity,R.RADIANS_PER_DEGREE),this._ellipsoid=ae.clone(y(e.ellipsoid,ae.WGS84)),this._surfaceHeight=Math.max(n,i),this._rotation=y(e.rotation,0),this._stRotation=y(e.stRotation,0),this._vertexFormat=Ee.clone(y(e.vertexFormat,Ee.DEFAULT)),this._extrudedHeight=Math.min(n,i),this._shadowVolume=y(e.shadowVolume,!1),this._workerName="createRectangleGeometry",this._offsetAttribute=e.offsetAttribute,this._rotatedRectangle=void 0,this._textureCoordinateRotationPoints=void 0}Nc.packedLength=ce.packedLength+ae.packedLength+Ee.packedLength+7;Nc.pack=function(e,t,n){return A.typeOf.object("value",e),A.defined("array",t),n=y(n,0),ce.pack(e._rectangle,t,n),n+=ce.packedLength,ae.pack(e._ellipsoid,t,n),n+=ae.packedLength,Ee.pack(e._vertexFormat,t,n),n+=Ee.packedLength,t[n++]=e._granularity,t[n++]=e._surfaceHeight,t[n++]=e._rotation,t[n++]=e._stRotation,t[n++]=e._extrudedHeight,t[n++]=e._shadowVolume?1:0,t[n]=y(e._offsetAttribute,-1),t};const Qj=new ce,Kj=ae.clone(ae.UNIT_SPHERE),$d={rectangle:Qj,ellipsoid:Kj,vertexFormat:h1,granularity:void 0,height:void 0,rotation:void 0,stRotation:void 0,extrudedHeight:void 0,shadowVolume:void 0,offsetAttribute:void 0};Nc.unpack=function(e,t,n){A.defined("array",e),t=y(t,0);const i=ce.unpack(e,t,Qj);t+=ce.packedLength;const o=ae.unpack(e,t,Kj);t+=ae.packedLength;const r=Ee.unpack(e,t,h1);t+=Ee.packedLength;const s=e[t++],a=e[t++],l=e[t++],u=e[t++],h=e[t++],f=e[t++]===1,_=e[t];return c(n)?(n._rectangle=ce.clone(i,n._rectangle),n._ellipsoid=ae.clone(o,n._ellipsoid),n._vertexFormat=Ee.clone(r,n._vertexFormat),n._granularity=s,n._surfaceHeight=a,n._rotation=l,n._stRotation=u,n._extrudedHeight=h,n._shadowVolume=f,n._offsetAttribute=_===-1?void 0:_,n):($d.granularity=s,$d.height=a,$d.rotation=l,$d.stRotation=u,$d.extrudedHeight=h,$d.shadowVolume=f,$d.offsetAttribute=_===-1?void 0:_,new Nc($d))};Nc.computeRectangle=function(e,t){e=y(e,y.EMPTY_OBJECT);const n=e.rectangle;if(A.typeOf.object("rectangle",n),ce.validate(n),n.north<n.south)throw new E("options.rectangle.north must be greater than or equal to options.rectangle.south");const i=y(e.granularity,R.RADIANS_PER_DEGREE),o=y(e.ellipsoid,ae.WGS84),r=y(e.rotation,0);return f1(n,i,r,o,t)};const pPe=new $,V2=new _e,mPe=new he;Nc.createGeometry=function(e){if(R.equalsEpsilon(e._rectangle.north,e._rectangle.south,R.EPSILON10)||R.equalsEpsilon(e._rectangle.east,e._rectangle.west,R.EPSILON10))return;let t=e._rectangle;const n=e._ellipsoid,i=e._rotation,o=e._stRotation,r=e._vertexFormat,s=Ns.computeOptions(t,e._granularity,i,o,Wj,Xj,fPe),a=pPe;if(o!==0||i!==0){const g=ce.center(t,mPe),m=n.geodeticSurfaceNormalCartographic(g,d1);_e.fromAxisAngle(m,-o,V2),$.fromQuaternion(V2,a)}else $.clone($.IDENTITY,a);const l=e._surfaceHeight,u=e._extrudedHeight,h=!R.equalsEpsilon(l,u,0,R.EPSILON2);s.lonScalar=1/e._rectangle.width,s.latScalar=1/e._rectangle.height,s.tangentRotationMatrix=a;let f,_;if(t=e._rectangle,h){f=dPe(e,s);const g=se.fromRectangle3D(t,n,l,cPe),m=se.fromRectangle3D(t,n,u,aPe);_=se.union(g,m)}else{if(f=$j(e,s),f.attributes.position.values=ai.scaleToGeodeticHeight(f.attributes.position.values,l,n,!1),c(e._offsetAttribute)){const g=f.attributes.position.values.length,m=e._offsetAttribute===Kt.NONE?0:1,b=new Uint8Array(g/3).fill(m);f.attributes.applyOffset=new Ie({componentDatatype:Z.UNSIGNED_BYTE,componentsPerAttribute:1,values:b})}_=se.fromRectangle3D(t,n,l)}return r.position||delete f.attributes.position,new Tt({attributes:f.attributes,indices:f.indices,primitiveType:f.primitiveType,boundingSphere:_,offsetAttribute:e._offsetAttribute})};Nc.createShadowVolume=function(e,t,n){const i=e._granularity,o=e._ellipsoid,r=t(i,o),s=n(i,o);return new Nc({rectangle:e._rectangle,rotation:e._rotation,ellipsoid:o,stRotation:e._stRotation,granularity:i,extrudedHeight:s,height:r,vertexFormat:Ee.POSITION_ONLY,shadowVolume:!0})};const H2=new ce,_Pe=[new H,new H,new H],gPe=new Xe,yPe=new he;function bPe(e){if(e._stRotation===0)return[0,0,0,1,1,0];const t=ce.clone(e._rectangle,H2),n=e._granularity,i=e._ellipsoid,o=e._rotation-e._stRotation,r=f1(t,n,o,i,H2),s=_Pe;s[0].x=r.west,s[0].y=r.south,s[1].x=r.west,s[1].y=r.north,s[2].x=r.east,s[2].y=r.south;const a=e.rectangle,l=Xe.fromRotation(e._stRotation,gPe),u=ce.center(a,yPe);for(let m=0;m<3;++m){const b=s[m];b.x-=u.longitude,b.y-=u.latitude,Xe.multiplyByVector(l,b,b),b.x+=u.longitude,b.y+=u.latitude,b.x=(b.x-a.west)/a.width,b.y=(b.y-a.south)/a.height}const h=s[0],f=s[1],_=s[2],g=new Array(6);return H.pack(h,g),H.pack(f,g,2),H.pack(_,g,4),g}Object.defineProperties(Nc.prototype,{rectangle:{get:function(){return c(this._rotatedRectangle)||(this._rotatedRectangle=f1(this._rectangle,this._granularity,this._rotation,this._ellipsoid)),this._rotatedRectangle}},textureCoordinateRotationPoints:{get:function(){return c(this._textureCoordinateRotationPoints)||(this._textureCoordinateRotationPoints=bPe(this)),this._textureCoordinateRotationPoints}}});const Zj=new z,Jj=d.ZERO,e9=new d,t9=new ce,TPe=new ce,APe=new he;function xPe(e){this.id=e,this.vertexFormat=void 0,this.rectangle=void 0,this.height=void 0,this.extrudedHeight=void 0,this.granularity=void 0,this.stRotation=void 0,this.rotation=void 0,this.offsetAttribute=void 0}function ml(e,t){Ut.call(this,{entity:e,scene:t,geometryOptions:new xPe(e),geometryPropertyName:"rectangle",observedPropertyNames:["availability","rectangle"]}),this._onEntityPropertyChanged(e,"rectangle",e.rectangle,void 0)}c(Object.create)&&(ml.prototype=Object.create(Ut.prototype),ml.prototype.constructor=ml);ml.prototype.createFillGeometryInstance=function(e){if(A.defined("time",e),!this._fillEnabled)throw new E("This instance does not represent a filled geometry.");const t=this._entity,n=t.isAvailable(e),i={show:new mn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),distanceDisplayCondition:Vn.fromDistanceDisplayCondition(this._distanceDisplayConditionProperty.getValue(e)),offset:void 0,color:void 0};if(this._materialProperty instanceof kt){let o;c(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(o=this._materialProperty.color.getValue(e,Zj)),c(o)||(o=z.WHITE),i.color=$t.fromColor(o)}return c(this._options.offsetAttribute)&&(i.offset=Zi.fromCartesian3(K.getValueOrDefault(this._terrainOffsetProperty,e,Jj,e9))),new Gt({id:t,geometry:new Nc(this._options),attributes:i})};ml.prototype.createOutlineGeometryInstance=function(e){if(A.defined("time",e),!this._outlineEnabled)throw new E("This instance does not represent an outlined geometry.");const t=this._entity,n=t.isAvailable(e),i=K.getValueOrDefault(this._outlineColorProperty,e,z.BLACK,Zj),o=this._distanceDisplayConditionProperty.getValue(e),r={show:new mn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:$t.fromColor(i),distanceDisplayCondition:Vn.fromDistanceDisplayCondition(o),offset:void 0};return c(this._options.offsetAttribute)&&(r.offset=Zi.fromCartesian3(K.getValueOrDefault(this._terrainOffsetProperty,e,Jj,e9))),new Gt({id:t,geometry:new fp(this._options),attributes:r})};ml.prototype._computeCenter=function(e,t){const n=K.getValueOrUndefined(this._entity.rectangle.coordinates,e,TPe);if(!c(n))return;const i=ce.center(n,APe);return he.toCartesian(i,ae.WGS84,t)};ml.prototype._isHidden=function(e,t){return!c(t.coordinates)||dn.prototype._isHidden.call(this,e,t)};ml.prototype._isDynamic=function(e,t){return!t.coordinates.isConstant||!K.isConstant(t.height)||!K.isConstant(t.extrudedHeight)||!K.isConstant(t.granularity)||!K.isConstant(t.stRotation)||!K.isConstant(t.rotation)||!K.isConstant(t.outlineWidth)||!K.isConstant(t.zIndex)||this._onTerrain&&!K.isConstant(this._materialProperty)&&!(this._materialProperty instanceof kt)};ml.prototype._setStaticOptions=function(e,t){const n=this._materialProperty instanceof kt;let i=K.getValueOrUndefined(t.height,Ke.MINIMUM_VALUE);const o=K.getValueOrDefault(t.heightReference,Ke.MINIMUM_VALUE,gt.NONE);let r=K.getValueOrUndefined(t.extrudedHeight,Ke.MINIMUM_VALUE);const s=K.getValueOrDefault(t.extrudedHeightReference,Ke.MINIMUM_VALUE,gt.NONE);c(r)&&!c(i)&&(i=0);const a=this._options;a.vertexFormat=n?tn.VERTEX_FORMAT:oo.MaterialSupport.TEXTURED.vertexFormat,a.rectangle=t.coordinates.getValue(Ke.MINIMUM_VALUE,a.rectangle),a.granularity=K.getValueOrUndefined(t.granularity,Ke.MINIMUM_VALUE),a.stRotation=K.getValueOrUndefined(t.stRotation,Ke.MINIMUM_VALUE),a.rotation=K.getValueOrUndefined(t.rotation,Ke.MINIMUM_VALUE),a.offsetAttribute=Ut.computeGeometryOffsetAttribute(i,o,r,s),a.height=Ut.getGeometryHeight(i,o),r=Ut.getGeometryExtrudedHeight(r,s),r===Ut.CLAMP_TO_GROUND&&(r=Ti.getMinimumMaximumHeights(Nc.computeRectangle(a,t9)).minimumTerrainHeight),a.extrudedHeight=r};ml.DynamicGeometryUpdater=p_;function p_(e,t,n){On.call(this,e,t,n)}c(Object.create)&&(p_.prototype=Object.create(On.prototype),p_.prototype.constructor=p_);p_.prototype._isHidden=function(e,t,n){return!c(this._options.rectangle)||On.prototype._isHidden.call(this,e,t,n)};p_.prototype._setOptions=function(e,t,n){const i=this._options;let o=K.getValueOrUndefined(t.height,n);const r=K.getValueOrDefault(t.heightReference,n,gt.NONE);let s=K.getValueOrUndefined(t.extrudedHeight,n);const a=K.getValueOrDefault(t.extrudedHeightReference,n,gt.NONE);c(s)&&!c(o)&&(o=0),i.rectangle=K.getValueOrUndefined(t.coordinates,n,i.rectangle),i.granularity=K.getValueOrUndefined(t.granularity,n),i.stRotation=K.getValueOrUndefined(t.stRotation,n),i.rotation=K.getValueOrUndefined(t.rotation,n),i.offsetAttribute=Ut.computeGeometryOffsetAttribute(o,r,s,a),i.height=Ut.getGeometryHeight(o,r),s=Ut.getGeometryExtrudedHeight(s,a),s===Ut.CLAMP_TO_GROUND&&(s=Ti.getMinimumMaximumHeights(Nc.computeRectangle(i,t9)).minimumTerrainHeight),i.extrudedHeight=s};const n9={};function CPe(e,t){return R.equalsEpsilon(e.latitude,t.latitude,R.EPSILON10)&&R.equalsEpsilon(e.longitude,t.longitude,R.EPSILON10)}const EPe=new he,wPe=new he;function SPe(e,t,n,i){t=gs(t,d.equalsEpsilon);const o=t.length;if(o<2)return;const r=c(i),s=c(n),a=new Array(o),l=new Array(o),u=new Array(o),h=t[0];a[0]=h;const f=e.cartesianToCartographic(h,EPe);s&&(f.height=n[0]),l[0]=f.height,r?u[0]=i[0]:u[0]=0;const _=l[0],g=u[0];let m=_===g,b=1;for(let T=1;T<o;++T){const x=t[T],C=e.cartesianToCartographic(x,wPe);s&&(C.height=n[T]),m=m&&C.height===0,CPe(f,C)?f.height<C.height&&(l[b-1]=C.height):(a[b]=x,l[b]=C.height,r?u[b]=i[T]:u[b]=0,m=m&&l[b]===u[b],he.clone(C,f),++b)}if(!(m||b<2))return a.length=b,l.length=b,u.length=b,{positions:a,topHeights:l,bottomHeights:u}}const vPe=new Array(2),IPe=new Array(2),DPe={positions:void 0,height:void 0,granularity:void 0,ellipsoid:void 0};n9.computePositions=function(e,t,n,i,o,r){const s=SPe(e,t,n,i);if(!c(s))return;t=s.positions,n=s.topHeights,i=s.bottomHeights;const a=t.length,l=a-2;let u,h;const f=R.chordLength(o,e.maximumRadius),_=DPe;if(_.minDistance=f,_.ellipsoid=e,r){let g=0,m;for(m=0;m<a-1;m++)g+=Io.numberOfPoints(t[m],t[m+1],f)+1;u=new Float64Array(g*3),h=new Float64Array(g*3);const b=vPe,T=IPe;_.positions=b,_.height=T;let x=0;for(m=0;m<a-1;m++){b[0]=t[m],b[1]=t[m+1],T[0]=n[m],T[1]=n[m+1];const C=Io.generateArc(_);u.set(C,x),T[0]=i[m],T[1]=i[m+1],h.set(Io.generateArc(_),x),x+=C.length}}else _.positions=t,_.height=n,u=new Float64Array(Io.generateArc(_)),_.height=i,h=new Float64Array(Io.generateArc(_));return{bottomPositions:h,topPositions:u,numCorners:l}};const i9=n9,sv=new d,VT=new d,PPe=new d,G2=new d,OPe=new d,LPe=new d,RPe=new d;function gp(e){e=y(e,y.EMPTY_OBJECT);const t=e.positions,n=e.maximumHeights,i=e.minimumHeights;if(!c(t))throw new E("options.positions is required.");if(c(n)&&n.length!==t.length)throw new E("options.positions and options.maximumHeights must have the same length.");if(c(i)&&i.length!==t.length)throw new E("options.positions and options.minimumHeights must have the same length.");const o=y(e.vertexFormat,Ee.DEFAULT),r=y(e.granularity,R.RADIANS_PER_DEGREE),s=y(e.ellipsoid,ae.WGS84);this._positions=t,this._minimumHeights=i,this._maximumHeights=n,this._vertexFormat=Ee.clone(o),this._granularity=r,this._ellipsoid=ae.clone(s),this._workerName="createWallGeometry";let a=1+t.length*d.packedLength+2;c(i)&&(a+=i.length),c(n)&&(a+=n.length),this.packedLength=a+ae.packedLength+Ee.packedLength+1}gp.pack=function(e,t,n){if(!c(e))throw new E("value is required");if(!c(t))throw new E("array is required");n=y(n,0);let i;const o=e._positions;let r=o.length;for(t[n++]=r,i=0;i<r;++i,n+=d.packedLength)d.pack(o[i],t,n);const s=e._minimumHeights;if(r=c(s)?s.length:0,t[n++]=r,c(s))for(i=0;i<r;++i)t[n++]=s[i];const a=e._maximumHeights;if(r=c(a)?a.length:0,t[n++]=r,c(a))for(i=0;i<r;++i)t[n++]=a[i];return ae.pack(e._ellipsoid,t,n),n+=ae.packedLength,Ee.pack(e._vertexFormat,t,n),n+=Ee.packedLength,t[n]=e._granularity,t};const o9=ae.clone(ae.UNIT_SPHERE),r9=new Ee,Zg={positions:void 0,minimumHeights:void 0,maximumHeights:void 0,ellipsoid:o9,vertexFormat:r9,granularity:void 0};gp.unpack=function(e,t,n){if(!c(e))throw new E("array is required");t=y(t,0);let i,o=e[t++];const r=new Array(o);for(i=0;i<o;++i,t+=d.packedLength)r[i]=d.unpack(e,t);o=e[t++];let s;if(o>0)for(s=new Array(o),i=0;i<o;++i)s[i]=e[t++];o=e[t++];let a;if(o>0)for(a=new Array(o),i=0;i<o;++i)a[i]=e[t++];const l=ae.unpack(e,t,o9);t+=ae.packedLength;const u=Ee.unpack(e,t,r9);t+=Ee.packedLength;const h=e[t];return c(n)?(n._positions=r,n._minimumHeights=s,n._maximumHeights=a,n._ellipsoid=ae.clone(l,n._ellipsoid),n._vertexFormat=Ee.clone(u,n._vertexFormat),n._granularity=h,n):(Zg.positions=r,Zg.minimumHeights=s,Zg.maximumHeights=a,Zg.granularity=h,new gp(Zg))};gp.fromConstantHeights=function(e){e=y(e,y.EMPTY_OBJECT);const t=e.positions;if(!c(t))throw new E("options.positions is required.");let n,i;const o=e.minimumHeight,r=e.maximumHeight,s=c(o),a=c(r);if(s||a){const u=t.length;n=s?new Array(u):void 0,i=a?new Array(u):void 0;for(let h=0;h<u;++h)s&&(n[h]=o),a&&(i[h]=r)}const l={positions:t,maximumHeights:i,minimumHeights:n,ellipsoid:e.ellipsoid,vertexFormat:e.vertexFormat};return new gp(l)};gp.createGeometry=function(e){const t=e._positions,n=e._minimumHeights,i=e._maximumHeights,o=e._vertexFormat,r=e._granularity,s=e._ellipsoid,a=i9.computePositions(s,t,i,n,r,!0);if(!c(a))return;const l=a.bottomPositions,u=a.topPositions,h=a.numCorners;let f=u.length,_=f*2;const g=o.position?new Float64Array(_):void 0,m=o.normal?new Float32Array(_):void 0,b=o.tangent?new Float32Array(_):void 0,T=o.bitangent?new Float32Array(_):void 0,x=o.st?new Float32Array(_/3*2):void 0;let C=0,w=0,v=0,P=0,N=0,k=RPe,M=LPe,U=OPe,B=!0;f/=3;let S,D=0;const p=1/(f-h-1);for(S=0;S<f;++S){const G=S*3,j=d.fromArray(u,G,sv),W=d.fromArray(l,G,VT);if(o.position&&(g[C++]=W.x,g[C++]=W.y,g[C++]=W.z,g[C++]=j.x,g[C++]=j.y,g[C++]=j.z),o.st&&(x[N++]=D,x[N++]=0,x[N++]=D,x[N++]=1),o.normal||o.tangent||o.bitangent){let X=d.clone(d.ZERO,G2);const q=d.subtract(j,s.geodeticSurfaceNormal(j,VT),VT);if(S+1<f&&(X=d.fromArray(u,G+3,G2)),B){const ee=d.subtract(X,j,PPe),Y=d.subtract(q,j,sv);k=d.normalize(d.cross(Y,ee,k),k),B=!1}d.equalsEpsilon(j,X,R.EPSILON10)?B=!0:(D+=p,o.tangent&&(M=d.normalize(d.subtract(X,j,M),M)),o.bitangent&&(U=d.normalize(d.cross(k,M,U),U))),o.normal&&(m[w++]=k.x,m[w++]=k.y,m[w++]=k.z,m[w++]=k.x,m[w++]=k.y,m[w++]=k.z),o.tangent&&(b[P++]=M.x,b[P++]=M.y,b[P++]=M.z,b[P++]=M.x,b[P++]=M.y,b[P++]=M.z),o.bitangent&&(T[v++]=U.x,T[v++]=U.y,T[v++]=U.z,T[v++]=U.x,T[v++]=U.y,T[v++]=U.z)}}const I=new oi;o.position&&(I.position=new Ie({componentDatatype:Z.DOUBLE,componentsPerAttribute:3,values:g})),o.normal&&(I.normal=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:3,values:m})),o.tangent&&(I.tangent=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:3,values:b})),o.bitangent&&(I.bitangent=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:3,values:T})),o.st&&(I.st=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:2,values:x}));const O=_/3;_-=6*(h+1);const F=je.createTypedArray(O,_);let V=0;for(S=0;S<O-2;S+=2){const G=S,j=S+2,W=d.fromArray(g,G*3,sv),X=d.fromArray(g,j*3,VT);if(d.equalsEpsilon(W,X,R.EPSILON10))continue;const q=S+1,ee=S+3;F[V++]=q,F[V++]=G,F[V++]=ee,F[V++]=ee,F[V++]=G,F[V++]=j}return new Tt({attributes:I,indices:F,primitiveType:ze.TRIANGLES,boundingSphere:new se.fromVertices(g)})};const j2=new d,W2=new d;function yp(e){e=y(e,y.EMPTY_OBJECT);const t=e.positions,n=e.maximumHeights,i=e.minimumHeights;if(!c(t))throw new E("options.positions is required.");if(c(n)&&n.length!==t.length)throw new E("options.positions and options.maximumHeights must have the same length.");if(c(i)&&i.length!==t.length)throw new E("options.positions and options.minimumHeights must have the same length.");const o=y(e.granularity,R.RADIANS_PER_DEGREE),r=y(e.ellipsoid,ae.WGS84);this._positions=t,this._minimumHeights=i,this._maximumHeights=n,this._granularity=o,this._ellipsoid=ae.clone(r),this._workerName="createWallOutlineGeometry";let s=1+t.length*d.packedLength+2;c(i)&&(s+=i.length),c(n)&&(s+=n.length),this.packedLength=s+ae.packedLength+1}yp.pack=function(e,t,n){if(!c(e))throw new E("value is required");if(!c(t))throw new E("array is required");n=y(n,0);let i;const o=e._positions;let r=o.length;for(t[n++]=r,i=0;i<r;++i,n+=d.packedLength)d.pack(o[i],t,n);const s=e._minimumHeights;if(r=c(s)?s.length:0,t[n++]=r,c(s))for(i=0;i<r;++i)t[n++]=s[i];const a=e._maximumHeights;if(r=c(a)?a.length:0,t[n++]=r,c(a))for(i=0;i<r;++i)t[n++]=a[i];return ae.pack(e._ellipsoid,t,n),n+=ae.packedLength,t[n]=e._granularity,t};const s9=ae.clone(ae.UNIT_SPHERE),Jg={positions:void 0,minimumHeights:void 0,maximumHeights:void 0,ellipsoid:s9,granularity:void 0};yp.unpack=function(e,t,n){if(!c(e))throw new E("array is required");t=y(t,0);let i,o=e[t++];const r=new Array(o);for(i=0;i<o;++i,t+=d.packedLength)r[i]=d.unpack(e,t);o=e[t++];let s;if(o>0)for(s=new Array(o),i=0;i<o;++i)s[i]=e[t++];o=e[t++];let a;if(o>0)for(a=new Array(o),i=0;i<o;++i)a[i]=e[t++];const l=ae.unpack(e,t,s9);t+=ae.packedLength;const u=e[t];return c(n)?(n._positions=r,n._minimumHeights=s,n._maximumHeights=a,n._ellipsoid=ae.clone(l,n._ellipsoid),n._granularity=u,n):(Jg.positions=r,Jg.minimumHeights=s,Jg.maximumHeights=a,Jg.granularity=u,new yp(Jg))};yp.fromConstantHeights=function(e){e=y(e,y.EMPTY_OBJECT);const t=e.positions;if(!c(t))throw new E("options.positions is required.");let n,i;const o=e.minimumHeight,r=e.maximumHeight,s=c(o),a=c(r);if(s||a){const u=t.length;n=s?new Array(u):void 0,i=a?new Array(u):void 0;for(let h=0;h<u;++h)s&&(n[h]=o),a&&(i[h]=r)}const l={positions:t,maximumHeights:i,minimumHeights:n,ellipsoid:e.ellipsoid};return new yp(l)};yp.createGeometry=function(e){const t=e._positions,n=e._minimumHeights,i=e._maximumHeights,o=e._granularity,r=e._ellipsoid,s=i9.computePositions(r,t,i,n,o,!1);if(!c(s))return;const a=s.bottomPositions,l=s.topPositions;let u=l.length,h=u*2;const f=new Float64Array(h);let _=0;u/=3;let g;for(g=0;g<u;++g){const C=g*3,w=d.fromArray(l,C,j2),v=d.fromArray(a,C,W2);f[_++]=v.x,f[_++]=v.y,f[_++]=v.z,f[_++]=w.x,f[_++]=w.y,f[_++]=w.z}const m=new oi({position:new Ie({componentDatatype:Z.DOUBLE,componentsPerAttribute:3,values:f})}),b=h/3;h=2*b-4+b;const T=je.createTypedArray(b,h);let x=0;for(g=0;g<b-2;g+=2){const C=g,w=g+2,v=d.fromArray(f,C*3,j2),P=d.fromArray(f,w*3,W2);if(d.equalsEpsilon(v,P,R.EPSILON10))continue;const N=g+1,k=g+3;T[x++]=N,T[x++]=C,T[x++]=N,T[x++]=k,T[x++]=C,T[x++]=w}return T[x++]=b-2,T[x++]=b-1,new Tt({attributes:m,indices:T,primitiveType:ze.LINES,boundingSphere:new se.fromVertices(f)})};const a9=new z;function NPe(e){this.id=e,this.vertexFormat=void 0,this.positions=void 0,this.minimumHeights=void 0,this.maximumHeights=void 0,this.granularity=void 0}function _l(e,t){dn.call(this,{entity:e,scene:t,geometryOptions:new NPe(e),geometryPropertyName:"wall",observedPropertyNames:["availability","wall"]}),this._onEntityPropertyChanged(e,"wall",e.wall,void 0)}c(Object.create)&&(_l.prototype=Object.create(dn.prototype),_l.prototype.constructor=_l);_l.prototype.createFillGeometryInstance=function(e){if(A.defined("time",e),!this._fillEnabled)throw new E("This instance does not represent a filled geometry.");const t=this._entity,n=t.isAvailable(e);let i,o;const r=new mn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),s=this._distanceDisplayConditionProperty.getValue(e),a=Vn.fromDistanceDisplayCondition(s);if(this._materialProperty instanceof kt){let l;c(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(l=this._materialProperty.color.getValue(e,a9)),c(l)||(l=z.WHITE),o=$t.fromColor(l),i={show:r,distanceDisplayCondition:a,color:o}}else i={show:r,distanceDisplayCondition:a};return new Gt({id:t,geometry:new gp(this._options),attributes:i})};_l.prototype.createOutlineGeometryInstance=function(e){if(A.defined("time",e),!this._outlineEnabled)throw new E("This instance does not represent an outlined geometry.");const t=this._entity,n=t.isAvailable(e),i=K.getValueOrDefault(this._outlineColorProperty,e,z.BLACK,a9),o=this._distanceDisplayConditionProperty.getValue(e);return new Gt({id:t,geometry:new yp(this._options),attributes:{show:new mn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:$t.fromColor(i),distanceDisplayCondition:Vn.fromDistanceDisplayCondition(o)}})};_l.prototype._isHidden=function(e,t){return!c(t.positions)||dn.prototype._isHidden.call(this,e,t)};_l.prototype._getIsClosed=function(e){return!1};_l.prototype._isDynamic=function(e,t){return!t.positions.isConstant||!K.isConstant(t.minimumHeights)||!K.isConstant(t.maximumHeights)||!K.isConstant(t.outlineWidth)||!K.isConstant(t.granularity)};_l.prototype._setStaticOptions=function(e,t){const n=t.minimumHeights,i=t.maximumHeights,o=t.granularity,r=this._materialProperty instanceof kt,s=this._options;s.vertexFormat=r?tn.VERTEX_FORMAT:oo.MaterialSupport.TEXTURED.vertexFormat,s.positions=t.positions.getValue(Ke.MINIMUM_VALUE,s.positions),s.minimumHeights=c(n)?n.getValue(Ke.MINIMUM_VALUE,s.minimumHeights):void 0,s.maximumHeights=c(i)?i.getValue(Ke.MINIMUM_VALUE,s.maximumHeights):void 0,s.granularity=c(o)?o.getValue(Ke.MINIMUM_VALUE):void 0};_l.DynamicGeometryUpdater=m_;function m_(e,t,n){On.call(this,e,t,n)}c(Object.create)&&(m_.prototype=Object.create(On.prototype),m_.prototype.constructor=m_);m_.prototype._isHidden=function(e,t,n){return!c(this._options.positions)||On.prototype._isHidden.call(this,e,t,n)};m_.prototype._setOptions=function(e,t,n){const i=this._options;i.positions=K.getValueOrUndefined(t.positions,n,i.positions),i.minimumHeights=K.getValueOrUndefined(t.minimumHeights,n,i.minimumHeights),i.maximumHeights=K.getValueOrUndefined(t.maximumHeights,n,i.maximumHeights),i.granularity=K.getValueOrUndefined(t.granularity,n)};const ap=[Ea,Sa,fl,pl,Ia,yc,Da,tu,ml,_l];function Id(e,t){this.entity=e,this.scene=t;const n=new Array(ap.length),i=new Le,o=new Tu;for(let r=0;r<n.length;r++){const s=new ap[r](e,t);o.add(s.geometryChanged,a=>{i.raiseEvent(a)}),n[r]=s}this.updaters=n,this.geometryChanged=i,this.eventHelper=o,this._removeEntitySubscription=e.definitionChanged.addEventListener(Id.prototype._onEntityPropertyChanged,this)}Id.prototype._onEntityPropertyChanged=function(e,t,n,i){const o=this.updaters;for(let r=0;r<o.length;r++)o[r]._onEntityPropertyChanged(e,t,n,i)};Id.prototype.forEach=function(e){const t=this.updaters;for(let n=0;n<t.length;n++)e(t[n])};Id.prototype.destroy=function(){this.eventHelper.removeAll();const e=this.updaters;for(let t=0;t<e.length;t++)e[t].destroy();this._removeEntitySubscription(),ve(this)};Id.registerUpdater=function(e){ap.includes(e)||ap.push(e)};Id.unregisterUpdater=function(e){if(ap.includes(e)){const t=ap.indexOf(e);ap.splice(t,1)}};const q2=new z,MPe=new Pt,FPe=new Pt,BPe=d.ZERO,zPe=new d;function Rl(e,t,n,i,o,r,s){this.translucent=t,this.appearanceType=n,this.depthFailAppearanceType=i,this.depthFailMaterialProperty=o,this.depthFailMaterial=void 0,this.closed=r,this.shadows=s,this.primitives=e,this.createPrimitive=!1,this.waitingOnCreate=!1,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new mt,this.updaters=new mt,this.updatersWithAttributes=new mt,this.attributes=new mt,this.subscriptions=new mt,this.showsUpdated=new mt,this.itemsToRemove=[],this.invalidated=!1;let a;c(o)&&(a=o.definitionChanged.addEventListener(Rl.prototype.onMaterialChanged,this)),this.removeMaterialSubscription=a}Rl.prototype.onMaterialChanged=function(){this.invalidated=!0};Rl.prototype.isMaterial=function(e){const t=this.depthFailMaterialProperty,n=e.depthFailMaterialProperty;return n===t?!0:c(t)?t.equals(n):!1};Rl.prototype.add=function(e,t){const n=e.id;if(this.createPrimitive=!0,this.geometry.set(n,t),this.updaters.set(n,e),!e.hasConstantFill||!e.fillMaterialProperty.isConstant||!K.isConstant(e.distanceDisplayConditionProperty)||!K.isConstant(e.terrainOffsetProperty))this.updatersWithAttributes.set(n,e);else{const i=this;this.subscriptions.set(n,e.entity.definitionChanged.addEventListener(function(o,r,s,a){r==="isShowing"&&i.showsUpdated.set(e.id,e)}))}};Rl.prototype.remove=function(e){const t=e.id;if(this.createPrimitive=this.geometry.remove(t)||this.createPrimitive,this.updaters.remove(t)){this.updatersWithAttributes.remove(t);const n=this.subscriptions.get(t);return c(n)&&(n(),this.subscriptions.remove(t),this.showsUpdated.remove(t)),!0}return!1};Rl.prototype.update=function(e){let t=!0,n=0,i=this.primitive;const o=this.primitives;let r;if(this.createPrimitive){const s=this.geometry.values;if(s.length>0){c(i)&&(c(this.oldPrimitive)?o.remove(i):this.oldPrimitive=i);let l;c(this.depthFailAppearanceType)&&(c(this.depthFailMaterialProperty)&&(this.depthFailMaterial=Go.getValue(e,this.depthFailMaterialProperty,this.depthFailMaterial)),l=new this.depthFailAppearanceType({material:this.depthFailMaterial,translucent:this.translucent,closed:this.closed})),i=new Mt({show:!1,asynchronous:!0,geometryInstances:s.slice(),appearance:new this.appearanceType({translucent:this.translucent,closed:this.closed}),depthFailAppearance:l,shadows:this.shadows}),o.add(i),t=!1}else{c(i)&&(o.remove(i),i=void 0);const l=this.oldPrimitive;c(l)&&(o.remove(l),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=i,this.createPrimitive=!1,this.waitingOnCreate=!0}else if(c(i)&&i.ready){i.show=!0,c(this.oldPrimitive)&&(o.remove(this.oldPrimitive),this.oldPrimitive=void 0),c(this.depthFailAppearanceType)&&!(this.depthFailMaterialProperty instanceof kt)&&(this.depthFailMaterial=Go.getValue(e,this.depthFailMaterialProperty,this.depthFailMaterial),this.primitive.depthFailAppearance.material=this.depthFailMaterial);const s=this.updatersWithAttributes.values,a=s.length,l=this.waitingOnCreate;for(r=0;r<a;r++){const u=s[r],h=this.geometry.get(u.id);let f=this.attributes.get(h.id.id);if(c(f)||(f=i.getGeometryInstanceAttributes(h.id),this.attributes.set(h.id.id,f)),!u.fillMaterialProperty.isConstant||l){const T=u.fillMaterialProperty.color,x=K.getValueOrDefault(T,e,z.WHITE,q2);z.equals(f._lastColor,x)||(f._lastColor=z.clone(x,f._lastColor),f.color=$t.toValue(x,f.color),(this.translucent&&f.color[3]===255||!this.translucent&&f.color[3]!==255)&&(this.itemsToRemove[n++]=u))}if(c(this.depthFailAppearanceType)&&u.depthFailMaterialProperty instanceof kt&&(!u.depthFailMaterialProperty.isConstant||l)){const T=u.depthFailMaterialProperty.color,x=K.getValueOrDefault(T,e,z.WHITE,q2);z.equals(f._lastDepthFailColor,x)||(f._lastDepthFailColor=z.clone(x,f._lastDepthFailColor),f.depthFailColor=$t.toValue(x,f.depthFailColor))}const _=u.entity.isShowing&&(u.hasConstantFill||u.isFilled(e)),g=f.show[0]===1;_!==g&&(f.show=mn.toValue(_,f.show));const m=u.distanceDisplayConditionProperty;if(!K.isConstant(m)){const T=K.getValueOrDefault(m,e,FPe,MPe);Pt.equals(T,f._lastDistanceDisplayCondition)||(f._lastDistanceDisplayCondition=Pt.clone(T,f._lastDistanceDisplayCondition),f.distanceDisplayCondition=Vn.toValue(T,f.distanceDisplayCondition))}const b=u.terrainOffsetProperty;if(!K.isConstant(b)){const T=K.getValueOrDefault(b,e,BPe,zPe);d.equals(T,f._lastOffset)||(f._lastOffset=d.clone(T,f._lastOffset),f.offset=Zi.toValue(T,f.offset))}}this.updateShows(i),this.waitingOnCreate=!1}else c(i)&&!i.ready&&(t=!1);return this.itemsToRemove.length=n,t};Rl.prototype.updateShows=function(e){const t=this.showsUpdated.values,n=t.length;for(let i=0;i<n;i++){const o=t[i],r=this.geometry.get(o.id);let s=this.attributes.get(r.id.id);c(s)||(s=e.getGeometryInstanceAttributes(r.id),this.attributes.set(r.id.id,s));const a=o.entity.isShowing,l=s.show[0]===1;a!==l&&(s.show=mn.toValue(a,s.show),r.attributes.show.value[0]=s.show[0])}this.showsUpdated.removeAll()};Rl.prototype.contains=function(e){return this.updaters.contains(e.id)};Rl.prototype.getBoundingSphere=function(e,t){const n=this.primitive;if(!n.ready)return rt.PENDING;const i=n.getGeometryInstanceAttributes(e.entity);return!c(i)||!c(i.boundingSphere)||c(i.show)&&i.show[0]===0?rt.FAILED:(i.boundingSphere.clone(t),rt.DONE)};Rl.prototype.destroy=function(){const e=this.primitive,t=this.primitives;c(e)&&t.remove(e);const n=this.oldPrimitive;c(n)&&t.remove(n),c(this.removeMaterialSubscription)&&this.removeMaterialSubscription()};function mc(e,t,n,i,o){this._solidItems=[],this._translucentItems=[],this._primitives=e,this._appearanceType=t,this._depthFailAppearanceType=n,this._closed=i,this._shadows=o}mc.prototype.add=function(e,t){let n,i;const o=t.createFillGeometryInstance(e);o.attributes.color.value[3]===255?(n=this._solidItems,i=!1):(n=this._translucentItems,i=!0);const r=n.length;for(let a=0;a<r;a++){const l=n[a];if(l.isMaterial(t)){l.add(t,o);return}}const s=new Rl(this._primitives,i,this._appearanceType,this._depthFailAppearanceType,t.depthFailMaterialProperty,this._closed,this._shadows);s.add(t,o),n.push(s)};function Y2(e,t){const n=e.length;for(let i=n-1;i>=0;i--){const o=e[i];if(o.remove(t))return o.updaters.length===0&&(e.splice(i,1),o.destroy()),!0}return!1}mc.prototype.remove=function(e){Y2(this._solidItems,e)||Y2(this._translucentItems,e)};function $2(e,t,n){let i=!1;const o=t.length;for(let r=0;r<o;++r){const s=t[r],a=s.itemsToRemove,l=a.length;if(l>0)for(r=0;r<l;r++){const u=a[r];s.remove(u),e.add(n,u),i=!0}}return i}function HT(e,t,n,i){let o=t.length,r;for(r=o-1;r>=0;r--){const s=t[r];if(s.invalidated){t.splice(r,1);const a=s.updaters.values,l=a.length;for(let u=0;u<l;u++)e.add(n,a[u]);s.destroy()}}for(o=t.length,r=0;r<o;++r)i=t[r].update(n)&&i;return i}mc.prototype.update=function(e){let t=HT(this,this._solidItems,e,!0);t=HT(this,this._translucentItems,e,t)&&t;const n=$2(this,this._solidItems,e),i=$2(this,this._translucentItems,e);return(n||i)&&(t=HT(this,this._solidItems,e,t)&&t,t=HT(this,this._translucentItems,e,t)&&t),t};function X2(e,t,n){const i=e.length;for(let o=0;o<i;o++){const r=e[o];if(r.contains(t))return r.getBoundingSphere(t,n)}return rt.FAILED}mc.prototype.getBoundingSphere=function(e,t){const n=X2(this._solidItems,e,t);return n===rt.FAILED?X2(this._translucentItems,e,t):n};function Q2(e){const t=e.length;for(let n=0;n<t;n++)e[n].destroy();e.length=0}mc.prototype.removeAllPrimitives=function(){Q2(this._solidItems),Q2(this._translucentItems)};const UPe=new Pt,kPe=new Pt,VPe=d.ZERO,HPe=new d;function Nl(e,t,n,i,o,r,s){this.primitives=e,this.appearanceType=t,this.materialProperty=n,this.depthFailAppearanceType=i,this.depthFailMaterialProperty=o,this.closed=r,this.shadows=s,this.updaters=new mt,this.createPrimitive=!0,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new mt,this.material=void 0,this.depthFailMaterial=void 0,this.updatersWithAttributes=new mt,this.attributes=new mt,this.invalidated=!1,this.removeMaterialSubscription=n.definitionChanged.addEventListener(Nl.prototype.onMaterialChanged,this),this.subscriptions=new mt,this.showsUpdated=new mt}Nl.prototype.onMaterialChanged=function(){this.invalidated=!0};Nl.prototype.isMaterial=function(e){const t=this.materialProperty,n=e.fillMaterialProperty,i=this.depthFailMaterialProperty,o=e.depthFailMaterialProperty;if(n===t&&o===i)return!0;let r=c(t)&&t.equals(n);return r=(!c(i)&&!c(o)||c(i)&&i.equals(o))&&r,r};Nl.prototype.add=function(e,t){const n=t.id;if(this.updaters.set(n,t),this.geometry.set(n,t.createFillGeometryInstance(e)),!t.hasConstantFill||!t.fillMaterialProperty.isConstant||!K.isConstant(t.distanceDisplayConditionProperty)||!K.isConstant(t.terrainOffsetProperty))this.updatersWithAttributes.set(n,t);else{const i=this;this.subscriptions.set(n,t.entity.definitionChanged.addEventListener(function(o,r,s,a){r==="isShowing"&&i.showsUpdated.set(t.id,t)}))}this.createPrimitive=!0};Nl.prototype.remove=function(e){const t=e.id;if(this.createPrimitive=this.geometry.remove(t)||this.createPrimitive,this.updaters.remove(t)){this.updatersWithAttributes.remove(t);const n=this.subscriptions.get(t);return c(n)&&(n(),this.subscriptions.remove(t),this.showsUpdated.remove(t)),!0}return!1};const GPe=new z;Nl.prototype.update=function(e){let t=!0,n=this.primitive;const i=this.primitives,o=this.geometry.values;let r;if(this.createPrimitive){if(o.length>0){c(n)&&(c(this.oldPrimitive)?i.remove(n):this.oldPrimitive=n),this.material=Go.getValue(e,this.materialProperty,this.material);let a;c(this.depthFailMaterialProperty)&&(this.depthFailMaterial=Go.getValue(e,this.depthFailMaterialProperty,this.depthFailMaterial),a=new this.depthFailAppearanceType({material:this.depthFailMaterial,translucent:this.depthFailMaterial.isTranslucent(),closed:this.closed})),n=new Mt({show:!1,asynchronous:!0,geometryInstances:o.slice(),appearance:new this.appearanceType({material:this.material,translucent:this.material.isTranslucent(),closed:this.closed}),depthFailAppearance:a,shadows:this.shadows}),i.add(n),t=!1}else{c(n)&&(i.remove(n),n=void 0);const a=this.oldPrimitive;c(a)&&(i.remove(a),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=n,this.createPrimitive=!1}else if(c(n)&&n.ready){n.show=!0,c(this.oldPrimitive)&&(i.remove(this.oldPrimitive),this.oldPrimitive=void 0),this.material=Go.getValue(e,this.materialProperty,this.material),this.primitive.appearance.material=this.material,c(this.depthFailAppearanceType)&&!(this.depthFailMaterialProperty instanceof kt)&&(this.depthFailMaterial=Go.getValue(e,this.depthFailMaterialProperty,this.depthFailMaterial),this.primitive.depthFailAppearance.material=this.depthFailMaterial);const s=this.updatersWithAttributes.values,a=s.length;for(r=0;r<a;r++){const l=s[r],u=l.entity,h=this.geometry.get(l.id);let f=this.attributes.get(h.id.id);if(c(f)||(f=n.getGeometryInstanceAttributes(h.id),this.attributes.set(h.id.id,f)),c(this.depthFailAppearanceType)&&this.depthFailMaterialProperty instanceof kt&&!l.depthFailMaterialProperty.isConstant){const T=l.depthFailMaterialProperty.color,x=K.getValueOrDefault(T,e,z.WHITE,GPe);z.equals(f._lastDepthFailColor,x)||(f._lastDepthFailColor=z.clone(x,f._lastDepthFailColor),f.depthFailColor=$t.toValue(x,f.depthFailColor))}const _=u.isShowing&&(l.hasConstantFill||l.isFilled(e)),g=f.show[0]===1;_!==g&&(f.show=mn.toValue(_,f.show));const m=l.distanceDisplayConditionProperty;if(!K.isConstant(m)){const T=K.getValueOrDefault(m,e,kPe,UPe);Pt.equals(T,f._lastDistanceDisplayCondition)||(f._lastDistanceDisplayCondition=Pt.clone(T,f._lastDistanceDisplayCondition),f.distanceDisplayCondition=Vn.toValue(T,f.distanceDisplayCondition))}const b=l.terrainOffsetProperty;if(!K.isConstant(b)){const T=K.getValueOrDefault(b,e,VPe,HPe);d.equals(T,f._lastOffset)||(f._lastOffset=d.clone(T,f._lastOffset),f.offset=Zi.toValue(T,f.offset))}}this.updateShows(n)}else c(n)&&!n.ready&&(t=!1);return t};Nl.prototype.updateShows=function(e){const t=this.showsUpdated.values,n=t.length;for(let i=0;i<n;i++){const o=t[i],r=o.entity,s=this.geometry.get(o.id);let a=this.attributes.get(s.id.id);c(a)||(a=e.getGeometryInstanceAttributes(s.id),this.attributes.set(s.id.id,a));const l=r.isShowing,u=a.show[0]===1;l!==u&&(a.show=mn.toValue(l,a.show),s.attributes.show.value[0]=a.show[0])}this.showsUpdated.removeAll()};Nl.prototype.contains=function(e){return this.updaters.contains(e.id)};Nl.prototype.getBoundingSphere=function(e,t){const n=this.primitive;if(!n.ready)return rt.PENDING;const i=n.getGeometryInstanceAttributes(e.entity);return!c(i)||!c(i.boundingSphere)||c(i.show)&&i.show[0]===0?rt.FAILED:(i.boundingSphere.clone(t),rt.DONE)};Nl.prototype.destroy=function(){const e=this.primitive,t=this.primitives;c(e)&&t.remove(e);const n=this.oldPrimitive;c(n)&&t.remove(n),this.removeMaterialSubscription()};function _c(e,t,n,i,o){this._items=[],this._primitives=e,this._appearanceType=t,this._depthFailAppearanceType=n,this._closed=i,this._shadows=o}_c.prototype.add=function(e,t){const n=this._items,i=n.length;for(let r=0;r<i;r++){const s=n[r];if(s.isMaterial(t)){s.add(e,t);return}}const o=new Nl(this._primitives,this._appearanceType,t.fillMaterialProperty,this._depthFailAppearanceType,t.depthFailMaterialProperty,this._closed,this._shadows);o.add(e,t),n.push(o)};_c.prototype.remove=function(e){const t=this._items,n=t.length;for(let i=n-1;i>=0;i--){const o=t[i];if(o.remove(e)){o.updaters.length===0&&(t.splice(i,1),o.destroy());break}}};_c.prototype.update=function(e){let t;const n=this._items,i=n.length;for(t=i-1;t>=0;t--){const r=n[t];if(r.invalidated){n.splice(t,1);const s=r.updaters.values,a=s.length;for(let l=0;l<a;l++)this.add(e,s[l]);r.destroy()}}let o=!0;for(t=0;t<n.length;t++)o=n[t].update(e)&&o;return o};_c.prototype.getBoundingSphere=function(e,t){const n=this._items,i=n.length;for(let o=0;o<i;o++){const r=n[o];if(r.contains(e))return r.getBoundingSphere(e,t)}return rt.FAILED};_c.prototype.removeAllPrimitives=function(){const e=this._items,t=e.length;for(let n=0;n<t;n++)e[n].destroy();this._items.length=0};function nb(){this._tree=new qq}function bp(){this.minX=0,this.minY=0,this.maxX=0,this.maxY=0,this.id=""}bp.fromRectangleAndId=function(e,t,n){return n.minX=t.west,n.minY=t.south,n.maxX=t.east,n.maxY=t.north,n.id=e,n};nb.prototype.insert=function(e,t){A.typeOf.string("id",e),A.typeOf.object("rectangle",t);const n=bp.fromRectangleAndId(e,t,new bp);this._tree.insert(n)};function jPe(e,t){return e.id===t.id}const WPe=new bp;nb.prototype.remove=function(e,t){A.typeOf.string("id",e),A.typeOf.object("rectangle",t);const n=bp.fromRectangleAndId(e,t,WPe);this._tree.remove(n,jPe)};const qPe=new bp;nb.prototype.collides=function(e){A.typeOf.object("rectangle",e);const t=bp.fromRectangleAndId("",e,qPe);return this._tree.collides(t)};const YPe=new z,$Pe=new Pt,XPe=new Pt;function Dd(e,t,n,i){this.primitives=e,this.zIndex=i,this.classificationType=t,this.color=n,this.createPrimitive=!1,this.waitingOnCreate=!1,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new mt,this.updaters=new mt,this.updatersWithAttributes=new mt,this.attributes=new mt,this.subscriptions=new mt,this.showsUpdated=new mt,this.itemsToRemove=[],this.isDirty=!1,this.rectangleCollisionCheck=new nb}Dd.prototype.overlapping=function(e){return this.rectangleCollisionCheck.collides(e)};Dd.prototype.add=function(e,t){const n=e.id;if(this.createPrimitive=!0,this.geometry.set(n,t),this.updaters.set(n,e),this.rectangleCollisionCheck.insert(n,t.geometry.rectangle),!e.hasConstantFill||!e.fillMaterialProperty.isConstant||!K.isConstant(e.distanceDisplayConditionProperty))this.updatersWithAttributes.set(n,e);else{const i=this;this.subscriptions.set(n,e.entity.definitionChanged.addEventListener(function(o,r,s,a){r==="isShowing"&&i.showsUpdated.set(e.id,e)}))}};Dd.prototype.remove=function(e){const t=e.id,n=this.geometry.get(t);if(this.createPrimitive=this.geometry.remove(t)||this.createPrimitive,this.updaters.remove(t)){this.rectangleCollisionCheck.remove(t,n.geometry.rectangle),this.updatersWithAttributes.remove(t);const i=this.subscriptions.get(t);return c(i)&&(i(),this.subscriptions.remove(t),this.showsUpdated.remove(t)),!0}return!1};Dd.prototype.update=function(e){let t=!0;const n=0;let i=this.primitive;const o=this.primitives;let r;if(this.createPrimitive){const s=this.geometry.values;if(s.length>0)c(i)&&(c(this.oldPrimitive)?o.remove(i):this.oldPrimitive=i),i=new sr({show:!1,asynchronous:!0,geometryInstances:s.slice(),classificationType:this.classificationType}),o.add(i,this.zIndex),t=!1;else{c(i)&&(o.remove(i),i=void 0);const l=this.oldPrimitive;c(l)&&(o.remove(l),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=i,this.createPrimitive=!1,this.waitingOnCreate=!0}else if(c(i)&&i.ready){i.show=!0,c(this.oldPrimitive)&&(o.remove(this.oldPrimitive),this.oldPrimitive=void 0);const s=this.updatersWithAttributes.values,a=s.length,l=this.waitingOnCreate;for(r=0;r<a;r++){const u=s[r],h=this.geometry.get(u.id);let f=this.attributes.get(h.id.id);if(c(f)||(f=i.getGeometryInstanceAttributes(h.id),this.attributes.set(h.id.id,f)),!u.fillMaterialProperty.isConstant||l){const b=u.fillMaterialProperty.color,T=K.getValueOrDefault(b,e,z.WHITE,YPe);z.equals(f._lastColor,T)||(f._lastColor=z.clone(T,f._lastColor),f.color=$t.toValue(T,f.color))}const _=u.entity.isShowing&&(u.hasConstantFill||u.isFilled(e)),g=f.show[0]===1;_!==g&&(f.show=mn.toValue(_,f.show));const m=u.distanceDisplayConditionProperty;if(!K.isConstant(m)){const b=K.getValueOrDefault(m,e,XPe,$Pe);Pt.equals(b,f._lastDistanceDisplayCondition)||(f._lastDistanceDisplayCondition=Pt.clone(b,f._lastDistanceDisplayCondition),f.distanceDisplayCondition=Vn.toValue(b,f.distanceDisplayCondition))}}this.updateShows(i),this.waitingOnCreate=!1}else c(i)&&!i.ready&&(t=!1);return this.itemsToRemove.length=n,t};Dd.prototype.updateShows=function(e){const t=this.showsUpdated.values,n=t.length;for(let i=0;i<n;i++){const o=t[i],r=this.geometry.get(o.id);let s=this.attributes.get(r.id.id);c(s)||(s=e.getGeometryInstanceAttributes(r.id),this.attributes.set(r.id.id,s));const a=o.entity.isShowing,l=s.show[0]===1;a!==l&&(s.show=mn.toValue(a,s.show),r.attributes.show.value[0]=s.show[0])}this.showsUpdated.removeAll()};Dd.prototype.contains=function(e){return this.updaters.contains(e.id)};Dd.prototype.getBoundingSphere=function(e,t){const n=this.primitive;if(!n.ready)return rt.PENDING;const i=n.getBoundingSphere(e.entity);return c(i)?(i.clone(t),rt.DONE):rt.FAILED};Dd.prototype.removeAllPrimitives=function(){const e=this.primitives,t=this.primitive;c(t)&&(e.remove(t),this.primitive=void 0,this.geometry.removeAll(),this.updaters.removeAll());const n=this.oldPrimitive;c(n)&&(e.remove(n),this.oldPrimitive=void 0)};function Tp(e,t){this._batches=[],this._primitives=e,this._classificationType=t}Tp.prototype.add=function(e,t){const n=t.createFillGeometryInstance(e),i=this._batches,o=K.getValueOrDefault(t.zIndex,0);let r;const s=i.length;for(let a=0;a<s;++a){const l=i[a];if(l.zIndex===o&&!l.overlapping(n.geometry.rectangle)){r=l;break}}return c(r)||(r=new Dd(this._primitives,this._classificationType,n.attributes.color.value,o),i.push(r)),r.add(t,n),r};Tp.prototype.remove=function(e){const t=this._batches,n=t.length;for(let i=0;i<n;++i)if(t[i].remove(e))return};Tp.prototype.update=function(e){let t,n,i=!0;const o=this._batches,r=o.length;for(t=0;t<r;++t)i=o[t].update(e)&&i;for(t=0;t<r;++t){const s=o[t],a=s.itemsToRemove,l=a.length;for(let u=0;u<l;u++){n=a[u],s.remove(n);const h=this.add(e,n);s.isDirty=!0,h.isDirty=!0}}for(t=r-1;t>=0;--t){const s=o[t];s.isDirty&&(i=o[t].update(e)&&i,s.isDirty=!1),s.geometry.length===0&&o.splice(t,1)}return i};Tp.prototype.getBoundingSphere=function(e,t){const n=this._batches,i=n.length;for(let o=0;o<i;++o){const r=n[o];if(r.contains(e))return r.getBoundingSphere(e,t)}return rt.FAILED};Tp.prototype.removeAllPrimitives=function(){const e=this._batches,t=e.length;for(let n=0;n<t;++n)e[n].removeAllPrimitives()};const QPe=new Pt,KPe=new Pt;function Hc(e,t,n,i,o,r){this.primitives=e,this.classificationType=t,this.appearanceType=n,this.materialProperty=i,this.updaters=new mt,this.createPrimitive=!0,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new mt,this.material=void 0,this.updatersWithAttributes=new mt,this.attributes=new mt,this.invalidated=!1,this.removeMaterialSubscription=i.definitionChanged.addEventListener(Hc.prototype.onMaterialChanged,this),this.subscriptions=new mt,this.showsUpdated=new mt,this.usingSphericalTextureCoordinates=o,this.zIndex=r,this.rectangleCollisionCheck=new nb}Hc.prototype.onMaterialChanged=function(){this.invalidated=!0};Hc.prototype.overlapping=function(e){return this.rectangleCollisionCheck.collides(e)};Hc.prototype.isMaterial=function(e){const t=this.materialProperty,n=e.fillMaterialProperty;return n===t||n instanceof kt&&t instanceof kt?!0:c(t)&&t.equals(n)};Hc.prototype.add=function(e,t,n){const i=t.id;if(this.updaters.set(i,t),this.geometry.set(i,n),this.rectangleCollisionCheck.insert(i,n.geometry.rectangle),!t.hasConstantFill||!t.fillMaterialProperty.isConstant||!K.isConstant(t.distanceDisplayConditionProperty))this.updatersWithAttributes.set(i,t);else{const o=this;this.subscriptions.set(i,t.entity.definitionChanged.addEventListener(function(r,s,a,l){s==="isShowing"&&o.showsUpdated.set(t.id,t)}))}this.createPrimitive=!0};Hc.prototype.remove=function(e){const t=e.id,n=this.geometry.get(t);if(this.createPrimitive=this.geometry.remove(t)||this.createPrimitive,this.updaters.remove(t)){this.rectangleCollisionCheck.remove(t,n.geometry.rectangle),this.updatersWithAttributes.remove(t);const i=this.subscriptions.get(t);return c(i)&&(i(),this.subscriptions.remove(t)),!0}return!1};Hc.prototype.update=function(e){let t=!0,n=this.primitive;const i=this.primitives,o=this.geometry.values;let r;if(this.createPrimitive){if(o.length>0)c(n)&&(c(this.oldPrimitive)?i.remove(n):this.oldPrimitive=n),this.material=Go.getValue(e,this.materialProperty,this.material),n=new sr({show:!1,asynchronous:!0,geometryInstances:o.slice(),appearance:new this.appearanceType({material:this.material}),classificationType:this.classificationType}),i.add(n,this.zIndex),t=!1;else{c(n)&&(i.remove(n),n=void 0);const a=this.oldPrimitive;c(a)&&(i.remove(a),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=n,this.createPrimitive=!1}else if(c(n)&&n.ready){n.show=!0,c(this.oldPrimitive)&&(i.remove(this.oldPrimitive),this.oldPrimitive=void 0),this.material=Go.getValue(e,this.materialProperty,this.material),this.primitive.appearance.material=this.material;const s=this.updatersWithAttributes.values,a=s.length;for(r=0;r<a;r++){const l=s[r],u=l.entity,h=this.geometry.get(l.id);let f=this.attributes.get(h.id.id);c(f)||(f=n.getGeometryInstanceAttributes(h.id),this.attributes.set(h.id.id,f));const _=u.isShowing&&(l.hasConstantFill||l.isFilled(e)),g=f.show[0]===1;_!==g&&(f.show=mn.toValue(_,f.show));const m=l.distanceDisplayConditionProperty;if(!K.isConstant(m)){const b=K.getValueOrDefault(m,e,KPe,QPe);Pt.equals(b,f._lastDistanceDisplayCondition)||(f._lastDistanceDisplayCondition=Pt.clone(b,f._lastDistanceDisplayCondition),f.distanceDisplayCondition=Vn.toValue(b,f.distanceDisplayCondition))}}this.updateShows(n)}else c(n)&&!n.ready&&(t=!1);return t};Hc.prototype.updateShows=function(e){const t=this.showsUpdated.values,n=t.length;for(let i=0;i<n;i++){const o=t[i],r=o.entity,s=this.geometry.get(o.id);let a=this.attributes.get(s.id.id);c(a)||(a=e.getGeometryInstanceAttributes(s.id),this.attributes.set(s.id.id,a));const l=r.isShowing,u=a.show[0]===1;l!==u&&(a.show=mn.toValue(l,a.show),s.attributes.show.value[0]=a.show[0])}this.showsUpdated.removeAll()};Hc.prototype.contains=function(e){return this.updaters.contains(e.id)};Hc.prototype.getBoundingSphere=function(e,t){const n=this.primitive;if(!n.ready)return rt.PENDING;const i=n.getGeometryInstanceAttributes(e.entity);return!c(i)||!c(i.boundingSphere)||c(i.show)&&i.show[0]===0?rt.FAILED:(i.boundingSphere.clone(t),rt.DONE)};Hc.prototype.destroy=function(){const e=this.primitive,t=this.primitives;c(e)&&t.remove(e);const n=this.oldPrimitive;c(n)&&t.remove(n),this.removeMaterialSubscription()};function Z_(e,t,n){this._items=[],this._primitives=e,this._classificationType=t,this._appearanceType=n}Z_.prototype.add=function(e,t){const n=this._items,i=n.length,o=t.createFillGeometryInstance(e),r=Sr.shouldUseSphericalCoordinates(o.geometry.rectangle),s=K.getValueOrDefault(t.zIndex,0);for(let l=0;l<i;++l){const u=n[l];if(u.isMaterial(t)&&u.usingSphericalTextureCoordinates===r&&u.zIndex===s&&!u.overlapping(o.geometry.rectangle)){u.add(e,t,o);return}}const a=new Hc(this._primitives,this._classificationType,this._appearanceType,t.fillMaterialProperty,r,s);a.add(e,t,o),n.push(a)};Z_.prototype.remove=function(e){const t=this._items,n=t.length;for(let i=n-1;i>=0;i--){const o=t[i];if(o.remove(e)){o.updaters.length===0&&(t.splice(i,1),o.destroy());break}}};Z_.prototype.update=function(e){let t;const n=this._items,i=n.length;for(t=i-1;t>=0;t--){const r=n[t];if(r.invalidated){n.splice(t,1);const s=r.updaters.values,a=s.length;for(let l=0;l<a;l++)this.add(e,s[l]);r.destroy()}}let o=!0;for(t=0;t<n.length;t++)o=n[t].update(e)&&o;return o};Z_.prototype.getBoundingSphere=function(e,t){const n=this._items,i=n.length;for(let o=0;o<i;o++){const r=n[o];if(r.contains(e))return r.getBoundingSphere(e,t)}return rt.FAILED};Z_.prototype.removeAllPrimitives=function(){const e=this._items,t=e.length;for(let n=0;n<t;n++)e[n].destroy();this._items.length=0};const ZPe=new z,JPe=new Pt,eOe=new Pt,tOe=d.ZERO,nOe=new d;function md(e,t,n,i){this.translucent=t,this.width=n,this.shadows=i,this.primitives=e,this.createPrimitive=!1,this.waitingOnCreate=!1,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new mt,this.updaters=new mt,this.updatersWithAttributes=new mt,this.attributes=new mt,this.itemsToRemove=[],this.subscriptions=new mt,this.showsUpdated=new mt}md.prototype.add=function(e,t){const n=e.id;if(this.createPrimitive=!0,this.geometry.set(n,t),this.updaters.set(n,e),!e.hasConstantOutline||!e.outlineColorProperty.isConstant||!K.isConstant(e.distanceDisplayConditionProperty)||!K.isConstant(e.terrainOffsetProperty))this.updatersWithAttributes.set(n,e);else{const i=this;this.subscriptions.set(n,e.entity.definitionChanged.addEventListener(function(o,r,s,a){r==="isShowing"&&i.showsUpdated.set(e.id,e)}))}};md.prototype.remove=function(e){const t=e.id;if(this.createPrimitive=this.geometry.remove(t)||this.createPrimitive,this.updaters.remove(t)){this.updatersWithAttributes.remove(t);const n=this.subscriptions.get(t);return c(n)&&(n(),this.subscriptions.remove(t),this.showsUpdated.remove(t)),!0}return!1};md.prototype.update=function(e){let t=!0,n=0,i=this.primitive;const o=this.primitives;let r;if(this.createPrimitive){const s=this.geometry.values;if(s.length>0)c(i)&&(c(this.oldPrimitive)?o.remove(i):this.oldPrimitive=i),i=new Mt({show:!1,asynchronous:!0,geometryInstances:s.slice(),appearance:new tn({flat:!0,translucent:this.translucent,renderState:{lineWidth:this.width}}),shadows:this.shadows}),o.add(i),t=!1;else{c(i)&&(o.remove(i),i=void 0);const l=this.oldPrimitive;c(l)&&(o.remove(l),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=i,this.createPrimitive=!1,this.waitingOnCreate=!0}else if(c(i)&&i.ready){i.show=!0,c(this.oldPrimitive)&&(o.remove(this.oldPrimitive),this.oldPrimitive=void 0);const s=this.updatersWithAttributes.values,a=s.length,l=this.waitingOnCreate;for(r=0;r<a;r++){const u=s[r],h=this.geometry.get(u.id);let f=this.attributes.get(h.id.id);if(c(f)||(f=i.getGeometryInstanceAttributes(h.id),this.attributes.set(h.id.id,f)),!u.outlineColorProperty.isConstant||l){const T=u.outlineColorProperty,x=K.getValueOrDefault(T,e,z.WHITE,ZPe);z.equals(f._lastColor,x)||(f._lastColor=z.clone(x,f._lastColor),f.color=$t.toValue(x,f.color),(this.translucent&&f.color[3]===255||!this.translucent&&f.color[3]!==255)&&(this.itemsToRemove[n++]=u))}const _=u.entity.isShowing&&(u.hasConstantOutline||u.isOutlineVisible(e)),g=f.show[0]===1;_!==g&&(f.show=mn.toValue(_,f.show));const m=u.distanceDisplayConditionProperty;if(!K.isConstant(m)){const T=K.getValueOrDefault(m,e,eOe,JPe);Pt.equals(T,f._lastDistanceDisplayCondition)||(f._lastDistanceDisplayCondition=Pt.clone(T,f._lastDistanceDisplayCondition),f.distanceDisplayCondition=Vn.toValue(T,f.distanceDisplayCondition))}const b=u.terrainOffsetProperty;if(!K.isConstant(b)){const T=K.getValueOrDefault(b,e,tOe,nOe);d.equals(T,f._lastOffset)||(f._lastOffset=d.clone(T,f._lastOffset),f.offset=Zi.toValue(T,f.offset))}}this.updateShows(i),this.waitingOnCreate=!1}else c(i)&&!i.ready&&(t=!1);return this.itemsToRemove.length=n,t};md.prototype.updateShows=function(e){const t=this.showsUpdated.values,n=t.length;for(let i=0;i<n;i++){const o=t[i],r=this.geometry.get(o.id);let s=this.attributes.get(r.id.id);c(s)||(s=e.getGeometryInstanceAttributes(r.id),this.attributes.set(r.id.id,s));const a=o.entity.isShowing,l=s.show[0]===1;a!==l&&(s.show=mn.toValue(a,s.show),r.attributes.show.value[0]=s.show[0])}this.showsUpdated.removeAll()};md.prototype.contains=function(e){return this.updaters.contains(e.id)};md.prototype.getBoundingSphere=function(e,t){const n=this.primitive;if(!n.ready)return rt.PENDING;const i=n.getGeometryInstanceAttributes(e.entity);return!c(i)||!c(i.boundingSphere)||c(i.show)&&i.show[0]===0?rt.FAILED:(i.boundingSphere.clone(t),rt.DONE)};md.prototype.removeAllPrimitives=function(){const e=this.primitives,t=this.primitive;c(t)&&(e.remove(t),this.primitive=void 0,this.geometry.removeAll(),this.updaters.removeAll());const n=this.oldPrimitive;c(n)&&(e.remove(n),this.oldPrimitive=void 0)};function Ap(e,t,n){this._primitives=e,this._scene=t,this._shadows=n,this._solidBatches=new mt,this._translucentBatches=new mt}Ap.prototype.add=function(e,t){const n=t.createOutlineGeometryInstance(e),i=this._scene.clampLineWidth(t.outlineWidth);let o,r;n.attributes.color.value[3]===255?(o=this._solidBatches,r=o.get(i),c(r)||(r=new md(this._primitives,!1,i,this._shadows),o.set(i,r)),r.add(t,n)):(o=this._translucentBatches,r=o.get(i),c(r)||(r=new md(this._primitives,!0,i,this._shadows),o.set(i,r)),r.add(t,n))};Ap.prototype.remove=function(e){let t;const n=this._solidBatches.values,i=n.length;for(t=0;t<i;t++)if(n[t].remove(e))return;const o=this._translucentBatches.values,r=o.length;for(t=0;t<r;t++)if(o[t].remove(e))return};Ap.prototype.update=function(e){let t,n,i,o;const r=this._solidBatches.values,s=r.length,a=this._translucentBatches.values,l=a.length;let u,h=!0,f=!1;do{for(f=!1,n=0;n<s;n++){o=r[n],h=o.update(e),u=o.itemsToRemove;const _=u.length;if(_>0)for(f=!0,t=0;t<_;t++)i=u[t],o.remove(i),this.add(e,i)}for(n=0;n<l;n++){o=a[n],h=o.update(e),u=o.itemsToRemove;const _=u.length;if(_>0)for(f=!0,t=0;t<_;t++)i=u[t],o.remove(i),this.add(e,i)}}while(f);return h};Ap.prototype.getBoundingSphere=function(e,t){let n;const i=this._solidBatches.values,o=i.length;for(n=0;n<o;n++){const a=i[n];if(a.contains(e))return a.getBoundingSphere(e,t)}const r=this._translucentBatches.values,s=r.length;for(n=0;n<s;n++){const a=r[n];if(a.contains(e))return a.getBoundingSphere(e,t)}return rt.FAILED};Ap.prototype.removeAllPrimitives=function(){let e;const t=this._solidBatches.values,n=t.length;for(e=0;e<n;e++)t[e].removeAllPrimitives();const i=this._translucentBatches.values,o=i.length;for(e=0;e<o;e++)i[e].removeAllPrimitives()};const iOe=[];function ca(e,t,n,i){A.defined("scene",e),A.defined("entityCollection",t),n=y(n,e.primitives),i=y(i,e.groundPrimitives),this._scene=e,this._primitives=n,this._groundPrimitives=i,this._entityCollection=void 0,this._addedObjects=new mt,this._removedObjects=new mt,this._changedObjects=new mt;const o=Vi.NUMBER_OF_SHADOW_MODES;this._outlineBatches=new Array(o*2),this._closedColorBatches=new Array(o*2),this._closedMaterialBatches=new Array(o*2),this._openColorBatches=new Array(o*2),this._openMaterialBatches=new Array(o*2);const r=Eo.supportsMaterialsforEntitiesOnTerrain(e);this._supportsMaterialsforEntitiesOnTerrain=r;let s;for(s=0;s<o;++s)this._outlineBatches[s]=new Ap(n,e,s),this._outlineBatches[o+s]=new Ap(n,e,s),this._closedColorBatches[s]=new mc(n,tn,void 0,!0,s),this._closedColorBatches[o+s]=new mc(n,tn,void 0,!0,s),this._closedMaterialBatches[s]=new _c(n,oo,void 0,!0,s),this._closedMaterialBatches[o+s]=new _c(n,oo,void 0,!0,s),this._openColorBatches[s]=new mc(n,tn,void 0,!1,s),this._openColorBatches[o+s]=new mc(n,tn,void 0,!1,s),this._openMaterialBatches[s]=new _c(n,oo,void 0,!1,s),this._openMaterialBatches[o+s]=new _c(n,oo,void 0,!1,s);const a=Ui.NUMBER_OF_CLASSIFICATION_TYPES,l=new Array(a),u=[];if(r)for(s=0;s<a;++s)u.push(new Z_(i,s,oo)),l[s]=new Tp(i,s);else for(s=0;s<a;++s)l[s]=new Tp(i,s);this._groundColorBatches=l,this._groundMaterialBatches=u,this._dynamicBatch=new Hp(n,i),this._batches=this._outlineBatches.concat(this._closedColorBatches,this._closedMaterialBatches,this._openColorBatches,this._openMaterialBatches,this._groundColorBatches,this._groundMaterialBatches,this._dynamicBatch),this._subscriptions=new mt,this._updaterSets=new mt,this._entityCollection=t,t.collectionChanged.addEventListener(ca.prototype._onCollectionChanged,this),this._onCollectionChanged(t,t.values,iOe)}ca.registerUpdater=function(e){Id.registerUpdater(e)};ca.unregisterUpdater=function(e){Id.unregisterUpdater(e)};ca.prototype.update=function(e){A.defined("time",e);const t=this._addedObjects,n=t.values,i=this._removedObjects,o=i.values,r=this._changedObjects,s=r.values;let a,l,u,h;const f=this;for(a=s.length-1;a>-1;a--)l=s[a],u=l.id,h=this._updaterSets.get(u),h.entity===l?h.forEach(function(b){f._removeUpdater(b),f._insertUpdaterIntoBatch(e,b)}):(o.push(l),n.push(l));for(a=o.length-1;a>-1;a--)l=o[a],u=l.id,h=this._updaterSets.get(u),h.forEach(this._removeUpdater.bind(this)),h.destroy(),this._updaterSets.remove(u),this._subscriptions.get(u)(),this._subscriptions.remove(u);for(a=n.length-1;a>-1;a--)l=n[a],u=l.id,h=new Id(l,this._scene),this._updaterSets.set(u,h),h.forEach(function(b){f._insertUpdaterIntoBatch(e,b)}),this._subscriptions.set(u,h.geometryChanged.addEventListener(ca._onGeometryChanged,this));t.removeAll(),i.removeAll(),r.removeAll();let _=!0;const g=this._batches,m=g.length;for(a=0;a<m;a++)_=g[a].update(e)&&_;return _};const oOe=[],rOe=new se;ca.prototype.getBoundingSphere=function(e,t){A.defined("entity",e),A.defined("result",t);const n=oOe,i=rOe;let o=0,r=rt.DONE;const s=this._batches,a=s.length,l=e.id,u=this._updaterSets.get(l).updaters;for(let h=0;h<u.length;h++){const f=u[h];for(let _=0;_<a;_++){if(r=s[_].getBoundingSphere(f,i),r===rt.PENDING)return rt.PENDING;r===rt.DONE&&(n[o]=se.clone(i,n[o]),o++)}}return o===0?rt.FAILED:(n.length=o,se.fromBoundingSpheres(n,t),rt.DONE)};ca.prototype.isDestroyed=function(){return!1};ca.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(ca.prototype._onCollectionChanged,this),this._addedObjects.removeAll(),this._removedObjects.removeAll();let e;const t=this._batches;let n=t.length;for(e=0;e<n;e++)t[e].removeAllPrimitives();const i=this._subscriptions.values;for(n=i.length,e=0;e<n;e++)i[e]();this._subscriptions.removeAll();const o=this._updaterSets.values;for(n=o.length,e=0;e<n;e++)o[e].destroy();return this._updaterSets.removeAll(),ve(this)};ca.prototype._removeUpdater=function(e){const t=this._batches,n=t.length;for(let i=0;i<n;i++)t[i].remove(e)};ca.prototype._insertUpdaterIntoBatch=function(e,t){if(t.isDynamic){this._dynamicBatch.add(e,t);return}let n;(t.outlineEnabled||t.fillEnabled)&&(n=t.shadowsProperty.getValue(e));const i=Vi.NUMBER_OF_SHADOW_MODES;if(t.outlineEnabled&&(c(t.terrainOffsetProperty)?this._outlineBatches[i+n].add(e,t):this._outlineBatches[n].add(e,t)),t.fillEnabled)if(t.onTerrain){const o=t.classificationTypeProperty.getValue(e);t.fillMaterialProperty instanceof kt?this._groundColorBatches[o].add(e,t):this._groundMaterialBatches[o].add(e,t)}else t.isClosed?t.fillMaterialProperty instanceof kt?c(t.terrainOffsetProperty)?this._closedColorBatches[i+n].add(e,t):this._closedColorBatches[n].add(e,t):c(t.terrainOffsetProperty)?this._closedMaterialBatches[i+n].add(e,t):this._closedMaterialBatches[n].add(e,t):t.fillMaterialProperty instanceof kt?c(t.terrainOffsetProperty)?this._openColorBatches[i+n].add(e,t):this._openColorBatches[n].add(e,t):c(t.terrainOffsetProperty)?this._openMaterialBatches[i+n].add(e,t):this._openMaterialBatches[n].add(e,t)};ca._onGeometryChanged=function(e){const t=this._removedObjects,n=this._changedObjects,i=e.entity,o=i.id;!c(t.get(o))&&!c(n.get(o))&&n.set(o,i)};ca.prototype._onCollectionChanged=function(e,t,n){const i=this._addedObjects,o=this._removedObjects,r=this._changedObjects;let s,a,l;for(s=n.length-1;s>-1;s--)l=n[s],a=l.id,i.remove(a)||(o.set(a,l),r.remove(a));for(s=t.length-1;s>-1;s--)l=t[s],a=l.id,o.remove(a)?r.set(a,l):i.set(a,l)};const sOe=1,aOe="30px sans-serif",cOe=dl.FILL,lOe=z.WHITE,uOe=z.BLACK,dOe=1,hOe=!1,fOe=new z(.165,.165,.165,.8),pOe=new H(7,5),mOe=H.ZERO,_Oe=d.ZERO,gOe=gt.NONE,yOe=Fs.CENTER,bOe=si.CENTER,TOe=new d,AOe=new z,xOe=new z,COe=new z,EOe=new H,wOe=new d,SOe=new H,vOe=new vt,IOe=new vt,DOe=new vt,POe=new Pt;function K2(e){this.entity=e,this.label=void 0,this.index=void 0}function kh(e,t){if(!c(e))throw new E("entityCluster is required.");if(!c(t))throw new E("entityCollection is required.");t.collectionChanged.addEventListener(kh.prototype._onCollectionChanged,this),this._cluster=e,this._entityCollection=t,this._items=new mt,this._onCollectionChanged(t,t.values,[],[])}kh.prototype.update=function(e){if(!c(e))throw new E("time is required.");const t=this._items.values,n=this._cluster;for(let i=0,o=t.length;i<o;i++){const r=t[i],s=r.entity,a=s._label;let l,u=r.label,h=s.isShowing&&s.isAvailable(e)&&K.getValueOrDefault(a._show,e,!0),f;if(h&&(f=K.getValueOrUndefined(s._position,e,TOe),l=K.getValueOrUndefined(a._text,e),h=c(f)&&c(l)),!h){SD(r,s,n);continue}K.isConstant(s._position)||(n._clusterDirty=!0);let _=!1;const g=K.getValueOrDefault(a._heightReference,e,gOe);c(u)||(u=n.getLabel(s),u.id=s,r.label=u,_=d.equals(u.position,f)&&u.heightReference===g),u.show=!0,u.position=f,u.text=l,u.scale=K.getValueOrDefault(a._scale,e,sOe),u.font=K.getValueOrDefault(a._font,e,aOe),u.style=K.getValueOrDefault(a._style,e,cOe),u.fillColor=K.getValueOrDefault(a._fillColor,e,lOe,AOe),u.outlineColor=K.getValueOrDefault(a._outlineColor,e,uOe,xOe),u.outlineWidth=K.getValueOrDefault(a._outlineWidth,e,dOe),u.showBackground=K.getValueOrDefault(a._showBackground,e,hOe),u.backgroundColor=K.getValueOrDefault(a._backgroundColor,e,fOe,COe),u.backgroundPadding=K.getValueOrDefault(a._backgroundPadding,e,pOe,EOe),u.pixelOffset=K.getValueOrDefault(a._pixelOffset,e,mOe,SOe),u.eyeOffset=K.getValueOrDefault(a._eyeOffset,e,_Oe,wOe),u.heightReference=g,u.horizontalOrigin=K.getValueOrDefault(a._horizontalOrigin,e,yOe),u.verticalOrigin=K.getValueOrDefault(a._verticalOrigin,e,bOe),u.translucencyByDistance=K.getValueOrUndefined(a._translucencyByDistance,e,vOe),u.pixelOffsetScaleByDistance=K.getValueOrUndefined(a._pixelOffsetScaleByDistance,e,IOe),u.scaleByDistance=K.getValueOrUndefined(a._scaleByDistance,e,DOe),u.distanceDisplayCondition=K.getValueOrUndefined(a._distanceDisplayCondition,e,POe),u.disableDepthTestDistance=K.getValueOrUndefined(a._disableDepthTestDistance,e),_&&u._updateClamping()}return!0};kh.prototype.getBoundingSphere=function(e,t){if(!c(e))throw new E("entity is required.");if(!c(t))throw new E("result is required.");const n=this._items.get(e.id);if(!c(n)||!c(n.label))return rt.FAILED;const i=n.label;return t.center=d.clone(y(i._clampedPosition,i.position),t.center),t.radius=0,rt.DONE};kh.prototype.isDestroyed=function(){return!1};kh.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(kh.prototype._onCollectionChanged,this);const e=this._entityCollection.values;for(let t=0;t<e.length;t++)this._cluster.removeLabel(e[t]);return ve(this)};kh.prototype._onCollectionChanged=function(e,t,n,i){let o,r;const s=this._items,a=this._cluster;for(o=t.length-1;o>-1;o--)r=t[o],c(r._label)&&c(r._position)&&s.set(r.id,new K2(r));for(o=i.length-1;o>-1;o--)r=i[o],c(r._label)&&c(r._position)?s.contains(r.id)||s.set(r.id,new K2(r)):(SD(s.get(r.id),r,a),s.remove(r.id));for(o=n.length-1;o>-1;o--)r=n[o],SD(s.get(r.id),r,a),s.remove(r.id)};function SD(e,t,n){c(e)&&(e.label=void 0,n.removeLabel(t))}const OOe=1,LOe=0,ROe=!0,NOe=!0,MOe=Vi.ENABLED,FOe=gt.NONE,BOe=z.RED,zOe=0,UOe=z.WHITE,kOe=RC.HIGHLIGHT,VOe=.5,HOe=new H(1,1),GOe=new L,jOe=new L,Z2=new z,J2=new Array(4),WOe=new d;function Vh(e,t){A.typeOf.object("scene",e),A.typeOf.object("entityCollection",t),t.collectionChanged.addEventListener(Vh.prototype._onCollectionChanged,this),this._scene=e,this._primitives=e.primitives,this._entityCollection=t,this._modelHash={},this._entitiesToVisualize=new mt,this._onCollectionChanged(t,t.values,[],[])}async function qOe(e,t,n,i){const o=e._primitives,r=e._modelHash;try{const s=await In.fromGltfAsync({url:n,incrementallyLoadTextures:i,scene:e._scene});if(e.isDestroyed()||!c(r[t.id]))return;s.id=t,o.add(s),r[t.id].modelPrimitive=s,s.errorEvent.addEventListener(a=>{!c(r[t.id])||(console.log(a),a.name!=="TextureError"&&s.incrementallyLoadTextures&&(r[t.id].loadFailed=!0))})}catch(s){if(e.isDestroyed()||!c(r[t.id]))return;console.log(s),r[t.id].loadFailed=!0}}Vh.prototype.update=function(e){if(!c(e))throw new E("time is required.");const t=this._entitiesToVisualize.values,n=this._modelHash,i=this._primitives;for(let o=0,r=t.length;o<r;o++){const s=t[o],a=s._model;let l,u=n[s.id],h=s.isShowing&&s.isAvailable(e)&&K.getValueOrDefault(a._show,e,!0),f;if(h&&(f=s.computeModelMatrix(e,GOe),l=Ae.createIfNeeded(K.getValueOrUndefined(a._uri,e)),h=c(f)&&c(l)),!h){c(u)&&u.modelPrimitive&&(u.modelPrimitive.show=!1);continue}if(!c(u)||l.url!==u.url){c(u==null?void 0:u.modelPrimitive)&&(i.removeAndDestroy(u.modelPrimitive),delete n[s.id]),u={modelPrimitive:void 0,url:l.url,animationsRunning:!1,nodeTransformationsScratch:{},articulationsScratch:{},loadFailed:!1,modelUpdated:!1},n[s.id]=u;const m=K.getValueOrDefault(a._incrementallyLoadTextures,e,ROe);qOe(this,s,l,m)}const _=u.modelPrimitive;if(!c(_))continue;_.show=!0,_.scale=K.getValueOrDefault(a._scale,e,OOe),_.minimumPixelSize=K.getValueOrDefault(a._minimumPixelSize,e,LOe),_.maximumScale=K.getValueOrUndefined(a._maximumScale,e),_.modelMatrix=L.clone(f,_.modelMatrix),_.shadows=K.getValueOrDefault(a._shadows,e,MOe),_.heightReference=K.getValueOrDefault(a._heightReference,e,FOe),_.distanceDisplayCondition=K.getValueOrUndefined(a._distanceDisplayCondition,e),_.silhouetteColor=K.getValueOrDefault(a._silhouetteColor,e,BOe,Z2),_.silhouetteSize=K.getValueOrDefault(a._silhouetteSize,e,zOe),_.color=K.getValueOrDefault(a._color,e,UOe,Z2),_.colorBlendMode=K.getValueOrDefault(a._colorBlendMode,e,kOe),_.colorBlendAmount=K.getValueOrDefault(a._colorBlendAmount,e,VOe),_.clippingPlanes=K.getValueOrUndefined(a._clippingPlanes,e),_.clampAnimations=K.getValueOrDefault(a._clampAnimations,e,NOe),_.imageBasedLighting.imageBasedLightingFactor=K.getValueOrDefault(a._imageBasedLightingFactor,e,HOe);let g=K.getValueOrUndefined(a._lightColor,e);if(c(g)&&(z.pack(g,J2,0),g=d.unpack(J2,0,WOe)),_.lightColor=g,_.customShader=K.getValueOrUndefined(a._customShader,e),n[s.id].modelUpdated=!0,_.ready){const m=K.getValueOrDefault(a._runAnimations,e,!0);u.animationsRunning!==m&&(m?_.activeAnimations.addAll({loop:Wf.REPEAT}):_.activeAnimations.removeAll(),u.animationsRunning=m);const b=K.getValueOrUndefined(a._nodeTransformations,e,u.nodeTransformationsScratch);if(c(b)){const C=Object.keys(b);for(let w=0,v=C.length;w<v;++w){const P=C[w],N=b[P];if(!c(N))continue;const k=_.getNode(P);if(!c(k))continue;const M=L.fromTranslationRotationScale(N,jOe);k.matrix=L.multiply(k.originalMatrix,M,M)}}let T=!1;const x=K.getValueOrUndefined(a._articulations,e,u.articulationsScratch);if(c(x)){const C=Object.keys(x);for(let w=0,v=C.length;w<v;++w){const P=C[w],N=x[P];!c(N)||(T=!0,_.setArticulationStage(P,N))}}T&&_.applyArticulations()}}return!0};Vh.prototype.isDestroyed=function(){return!1};Vh.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(Vh.prototype._onCollectionChanged,this);const e=this._entitiesToVisualize.values,t=this._modelHash,n=this._primitives;for(let i=e.length-1;i>-1;i--)vD(this,e[i],t,n);return ve(this)};const GT=new d,YOe=new he;Vh.prototype.getBoundingSphere=function(e,t){if(!c(e))throw new E("entity is required.");if(!c(t))throw new E("result is required.");const n=this._modelHash[e.id];if(!c(n)||n.loadFailed)return rt.FAILED;const i=n.modelPrimitive;if(!c(i)||!i.show||!i.ready||!n.modelUpdated)return rt.PENDING;const o=this._scene,r=o.globe,s=y(r==null?void 0:r.ellipsoid,ae.WGS84);if(i.heightReference!==gt.NONE){const l=i.modelMatrix;GT.x=l[12],GT.y=l[13],GT.z=l[14];const u=s.cartesianToCartographic(GT,YOe),h=o.getHeight(u,i.heightReference);return c(h)&&(Np(i.heightReference)?u.height=h:u.height+=h),se.clone(i.boundingSphere,t),t.center=s.cartographicToCartesian(u),rt.DONE}return se.clone(i.boundingSphere,t),rt.DONE};Vh.prototype._onCollectionChanged=function(e,t,n,i){let o,r;const s=this._entitiesToVisualize,a=this._modelHash,l=this._primitives;for(o=t.length-1;o>-1;o--)r=t[o],c(r._model)&&c(r._position)&&s.set(r.id,r);for(o=i.length-1;o>-1;o--)r=i[o],c(r._model)&&c(r._position)?($Oe(r,a),s.set(r.id,r)):(vD(this,r,a,l),s.remove(r.id));for(o=n.length-1;o>-1;o--)r=n[o],vD(this,r,a,l),s.remove(r.id)};function vD(e,t,n,i){const o=n[t.id];c(o)&&(i.removeAndDestroy(o.modelPrimitive),delete n[t.id])}function $Oe(e,t){const n=t[e.id];c(n)&&(n.nodeTransformationsScratch={},n.articulationsScratch={})}function Hh(e){this._definitionChanged=new Le,this._value=void 0,this._removeSubscription=void 0,this.setValue(e)}Object.defineProperties(Hh.prototype,{isConstant:{get:function(){return K.isConstant(this._value)}},definitionChanged:{get:function(){return this._definitionChanged}},referenceFrame:{get:function(){return c(this._value)?this._value.referenceFrame:Bs.FIXED}}});Hh.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,Bs.FIXED,t)};Hh.prototype.setValue=function(e){this._value!==e&&(this._value=e,c(this._removeSubscription)&&(this._removeSubscription(),this._removeSubscription=void 0),c(e)&&(this._removeSubscription=e.definitionChanged.addEventListener(this._raiseDefinitionChanged,this)),this._definitionChanged.raiseEvent(this))};Hh.prototype.getValueInReferenceFrame=function(e,t,n){if(!c(e))throw new E("time is required.");if(!c(t))throw new E("referenceFrame is required.");if(!!c(this._value))return n=this._value.getValueInReferenceFrame(e,t,n),c(n)?ae.WGS84.scaleToGeodeticSurface(n,n):void 0};Hh.prototype.equals=function(e){return this===e||e instanceof Hh&&this._value===e._value};Hh.prototype._raiseDefinitionChanged=function(){this._definitionChanged.raiseEvent(this)};const XOe=60,QOe=1,c9=new Ht,av=new Ht,cv=new Ht;function eB(e){this.entity=e,this.polyline=void 0,this.index=void 0,this.updater=void 0}function KOe(e,t,n,i,o,r,s,a,l){let u=a,h;h=e.getValueInReferenceFrame(t,r,l[u]),c(h)&&(l[u++]=h);let f=!c(o)||ie.lessThanOrEquals(o,t)||ie.greaterThanOrEquals(o,n),_=0;const g=i.length;let m=i[_];const b=n;let T=!1,x,C,w;for(;_<g;){if(!f&&ie.greaterThanOrEquals(m,o)&&(h=e.getValueInReferenceFrame(o,r,l[u]),c(h)&&(l[u++]=h),f=!0),ie.greaterThan(m,t)&&ie.lessThan(m,b)&&!m.equals(o)&&(h=e.getValueInReferenceFrame(m,r,l[u]),c(h)&&(l[u++]=h)),_<g-1){if(s>0&&!T){const v=i[_+1],P=ie.secondsDifference(v,m);T=P>s,T&&(x=Math.ceil(P/s),C=0,w=P/Math.max(x,2),x=Math.max(x-1,1))}if(T&&C<x){m=ie.addSeconds(m,w,new ie),C++;continue}}T=!1,_++,m=i[_]}return h=e.getValueInReferenceFrame(n,r,l[u]),c(h)&&(l[u++]=h),u}function ZOe(e,t,n,i,o,r,s,a){let l,u=0,h=s,f=t;const _=Math.max(r,60);let g=!c(i)||ie.lessThanOrEquals(i,t)||ie.greaterThanOrEquals(i,n);for(;ie.lessThan(f,n);)!g&&ie.greaterThanOrEquals(f,i)&&(g=!0,l=e.getValueInReferenceFrame(i,o,a[h]),c(l)&&(a[h]=l,h++)),l=e.getValueInReferenceFrame(f,o,a[h]),c(l)&&(a[h]=l,h++),u++,f=ie.addSeconds(t,_*u,new ie);return l=e.getValueInReferenceFrame(n,o,a[h]),c(l)&&(a[h]=l,h++),h}function JOe(e,t,n,i,o,r,s,a){cv.start=t,cv.stop=n;let l=s;const u=e.intervals;for(let h=0;h<u.length;h++){const f=u.get(h);if(!Ht.intersect(f,cv,c9).isEmpty){let _=f.start;f.isStartIncluded||(f.isStopIncluded?_=f.stop:_=ie.addSeconds(f.start,ie.secondsDifference(f.stop,f.start)/2,new ie));const g=e.getValueInReferenceFrame(_,o,a[l]);c(g)&&(a[l]=g,l++)}}return l}function e1e(e,t,n,i,o,r,s,a){const l=e.getValueInReferenceFrame(t,o,a[s]);return c(l)&&(a[s++]=l),s}function t1e(e,t,n,i,o,r,s,a){av.start=t,av.stop=n;let l=s;const u=e.intervals;for(let h=0;h<u.length;h++){const f=u.get(h);if(!Ht.intersect(f,av,c9).isEmpty){const _=f.start,g=f.stop;let m=t;ie.greaterThan(_,m)&&(m=_);let b=n;ie.lessThan(g,b)&&(b=g),l=l9(f.data,m,b,i,o,r,l,a)}}return l}function l9(e,t,n,i,o,r,s,a){for(;e instanceof Ua;)e=e.resolvedProperty;if(e instanceof Lc){const l=e._property._times;s=KOe(e,t,n,l,i,o,r,s,a)}else e instanceof zh?s=t1e(e,t,n,i,o,r,s,a):e instanceof Uh?s=JOe(e,t,n,i,o,r,s,a):e instanceof hd||e instanceof Hh&&K.isConstant(e)?s=e1e(e,t,n,i,o,r,s,a):s=ZOe(e,t,n,i,o,r,s,a);return s}function u9(e,t,n,i,o,r,s){c(s)||(s=[]);const a=l9(e,t,n,i,o,r,0,s);return s.length=a,s}const tB=new $;function ib(e,t){this._unusedIndexes=[],this._polylineCollection=new la,this._scene=e,this._referenceFrame=t,e.primitives.add(this._polylineCollection)}ib.prototype.update=function(e){if(this._referenceFrame===Bs.INERTIAL){let t=zt.computeIcrfToFixedMatrix(e,tB);c(t)||(t=zt.computeTemeToPseudoFixedMatrix(e,tB)),L.fromRotationTranslation(t,d.ZERO,this._polylineCollection.modelMatrix)}};ib.prototype.updateObject=function(e,t){const n=t.entity,i=n._path,o=n._position;let r,s;const a=i._show;let l=t.polyline,u=n.isShowing&&n.isAvailable(e)&&(!c(a)||a.getValue(e));if(u){const f=K.getValueOrUndefined(i._leadTime,e),_=K.getValueOrUndefined(i._trailTime,e),g=n._availability,m=c(g),b=c(f),T=c(_);if(u=m||b&&T,u){if(T&&(r=ie.addSeconds(e,-_,new ie)),b&&(s=ie.addSeconds(e,f,new ie)),m){const x=g.start,C=g.stop;(!T||ie.greaterThan(x,r))&&(r=x),(!b||ie.lessThan(C,s))&&(s=C)}u=ie.lessThan(r,s)}}if(!u){c(l)&&(this._unusedIndexes.push(t.index),t.polyline=void 0,l.show=!1,t.index=void 0);return}if(!c(l)){const f=this._unusedIndexes;if(f.length>0){const g=f.pop();l=this._polylineCollection.get(g),t.index=g}else t.index=this._polylineCollection.length,l=this._polylineCollection.add();l.id=n,t.polyline=l}const h=K.getValueOrDefault(i._resolution,e,XOe);l.show=!0,l.positions=u9(o,r,s,e,this._referenceFrame,h,l.positions.slice()),l.material=Go.getValue(e,i._material,l.material),l.width=K.getValueOrDefault(i._width,e,QOe),l.distanceDisplayCondition=K.getValueOrUndefined(i._distanceDisplayCondition,e,l.distanceDisplayCondition)};ib.prototype.removeObject=function(e){const t=e.polyline;c(t)&&(this._unusedIndexes.push(e.index),e.polyline=void 0,t.show=!1,t.id=void 0,e.index=void 0)};ib.prototype.destroy=function(){return this._scene.primitives.remove(this._polylineCollection),ve(this)};function Gh(e,t){if(!c(e))throw new E("scene is required.");if(!c(t))throw new E("entityCollection is required.");t.collectionChanged.addEventListener(Gh.prototype._onCollectionChanged,this),this._scene=e,this._updaters={},this._entityCollection=t,this._items=new mt,this._onCollectionChanged(t,t.values,[],[])}Gh.prototype.update=function(e){if(!c(e))throw new E("time is required.");const t=this._updaters;for(const i in t)t.hasOwnProperty(i)&&t[i].update(e);const n=this._items.values;if(n.length===0&&c(this._updaters)&&Object.keys(this._updaters).length>0){for(const i in t)t.hasOwnProperty(i)&&t[i].destroy();this._updaters={}}for(let i=0,o=n.length;i<o;i++){const r=n[i],a=r.entity._position,l=r.updater;let u=Bs.FIXED;this._scene.mode===oe.SCENE3D&&(u=a.referenceFrame);let h=this._updaters[u];if(l===h&&c(h)){h.updateObject(e,r);continue}c(l)&&l.removeObject(r),c(h)||(h=new ib(this._scene,u),h.update(e),this._updaters[u]=h),r.updater=h,c(h)&&h.updateObject(e,r)}return!0};Gh.prototype.isDestroyed=function(){return!1};Gh.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(Gh.prototype._onCollectionChanged,this);const e=this._updaters;for(const t in e)e.hasOwnProperty(t)&&e[t].destroy();return ve(this)};Gh.prototype._onCollectionChanged=function(e,t,n,i){let o,r,s;const a=this._items;for(o=t.length-1;o>-1;o--)r=t[o],c(r._path)&&c(r._position)&&a.set(r.id,new eB(r));for(o=i.length-1;o>-1;o--)r=i[o],c(r._path)&&c(r._position)?a.contains(r.id)||a.set(r.id,new eB(r)):(s=a.get(r.id),c(s)&&(c(s.updater)&&s.updater.removeObject(s),a.remove(r.id)));for(o=n.length-1;o>-1;o--)r=n[o],s=a.get(r.id),c(s)&&(c(s.updater)&&s.updater.removeObject(s),a.remove(r.id))};Gh._subSample=u9;const nB=z.WHITE,iB=z.BLACK,oB=0,rB=1,sB=0,aB=new z,n1e=new d,cB=new z,lB=new vt,uB=new vt,dB=new Pt;function hB(e){this.entity=e,this.pointPrimitive=void 0,this.billboard=void 0,this.color=void 0,this.outlineColor=void 0,this.pixelSize=void 0,this.outlineWidth=void 0}function jh(e,t){if(!c(e))throw new E("entityCluster is required.");if(!c(t))throw new E("entityCollection is required.");t.collectionChanged.addEventListener(jh.prototype._onCollectionChanged,this),this._cluster=e,this._entityCollection=t,this._items=new mt,this._onCollectionChanged(t,t.values,[],[])}jh.prototype.update=function(e){if(!c(e))throw new E("time is required.");const t=this._items.values,n=this._cluster;for(let i=0,o=t.length;i<o;i++){const r=t[i],s=r.entity,a=s._point;let l=r.pointPrimitive,u=r.billboard;const h=K.getValueOrDefault(a._heightReference,e,gt.NONE);let f=s.isShowing&&s.isAvailable(e)&&K.getValueOrDefault(a._show,e,!0),_;if(f&&(_=K.getValueOrUndefined(s._position,e,n1e),f=c(_)),!f){jy(r,s,n);continue}K.isConstant(s._position)||(n._clusterDirty=!0);let g=!1,m=!1;if(h!==gt.NONE&&!c(u)?(c(l)&&(jy(r,s,n),l=void 0),u=n.getBillboard(s),u.id=s,u.image=void 0,r.billboard=u,g=!0,m=d.equals(u.position,_)&&u.heightReference===h):h===gt.NONE&&!c(l)&&(c(u)&&(jy(r,s,n),u=void 0),l=n.getPoint(s),l.id=s,r.pointPrimitive=l),c(l))l.show=!0,l.position=_,l.scaleByDistance=K.getValueOrUndefined(a._scaleByDistance,e,lB),l.translucencyByDistance=K.getValueOrUndefined(a._translucencyByDistance,e,uB),l.color=K.getValueOrDefault(a._color,e,nB,aB),l.outlineColor=K.getValueOrDefault(a._outlineColor,e,iB,cB),l.outlineWidth=K.getValueOrDefault(a._outlineWidth,e,oB),l.pixelSize=K.getValueOrDefault(a._pixelSize,e,rB),l.distanceDisplayCondition=K.getValueOrUndefined(a._distanceDisplayCondition,e,dB),l.disableDepthTestDistance=K.getValueOrDefault(a._disableDepthTestDistance,e,sB);else if(c(u)){u.show=!0,u.position=_,u.scaleByDistance=K.getValueOrUndefined(a._scaleByDistance,e,lB),u.translucencyByDistance=K.getValueOrUndefined(a._translucencyByDistance,e,uB),u.distanceDisplayCondition=K.getValueOrUndefined(a._distanceDisplayCondition,e,dB),u.disableDepthTestDistance=K.getValueOrDefault(a._disableDepthTestDistance,e,sB),u.heightReference=h;const b=K.getValueOrDefault(a._color,e,nB,aB),T=K.getValueOrDefault(a._outlineColor,e,iB,cB),x=Math.round(K.getValueOrDefault(a._outlineWidth,e,oB));let C=Math.max(1,Math.round(K.getValueOrDefault(a._pixelSize,e,rB)));if(x>0?(u.scale=1,g=g||x!==r.outlineWidth||C!==r.pixelSize||!z.equals(b,r.color)||!z.equals(T,r.outlineColor)):(u.scale=C/50,C=50,g=g||x!==r.outlineWidth||!z.equals(b,r.color)||!z.equals(T,r.outlineColor)),g){r.color=z.clone(b,r.color),r.outlineColor=z.clone(T,r.outlineColor),r.pixelSize=C,r.outlineWidth=x;const w=b.alpha,v=b.toCssColorString(),P=T.toCssColorString(),N=JSON.stringify([v,C,P,x]);u.setImage(N,m8(w,v,P,x,C))}m&&u._updateClamping()}}return!0};jh.prototype.getBoundingSphere=function(e,t){if(!c(e))throw new E("entity is required.");if(!c(t))throw new E("result is required.");const n=this._items.get(e.id);if(!c(n)||!(c(n.pointPrimitive)||c(n.billboard)))return rt.FAILED;if(c(n.pointPrimitive))t.center=d.clone(n.pointPrimitive.position,t.center);else{const i=n.billboard;if(!c(i._clampedPosition))return rt.PENDING;t.center=d.clone(i._clampedPosition,t.center)}return t.radius=0,rt.DONE};jh.prototype.isDestroyed=function(){return!1};jh.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(jh.prototype._onCollectionChanged,this);const e=this._entityCollection.values;for(let t=0;t<e.length;t++)this._cluster.removePoint(e[t]);return ve(this)};jh.prototype._onCollectionChanged=function(e,t,n,i){let o,r;const s=this._items,a=this._cluster;for(o=t.length-1;o>-1;o--)r=t[o],c(r._point)&&c(r._position)&&s.set(r.id,new hB(r));for(o=i.length-1;o>-1;o--)r=i[o],c(r._point)&&c(r._position)?s.contains(r.id)||s.set(r.id,new hB(r)):(jy(s.get(r.id),r,a),s.remove(r.id));for(o=n.length-1;o>-1;o--)r=n[o],jy(s.get(r.id),r,a),s.remove(r.id)};function jy(e,t,n){if(c(e)){const i=e.pointPrimitive;if(c(i)){e.pointPrimitive=void 0,n.removePoint(t);return}const o=e.billboard;c(o)&&(e.billboard=void 0,n.removeBillboard(t))}}const d9=[];function i1e(e,t,n,i,o){const r=d9;r.length=o;let s;const a=n.red,l=n.green,u=n.blue,h=n.alpha,f=i.red,_=i.green,g=i.blue,m=i.alpha;if(z.equals(n,i)){for(s=0;s<o;s++)r[s]=z.clone(n);return r}const b=(f-a)/o,T=(_-l)/o,x=(g-u)/o,C=(m-h)/o;for(s=0;s<o;s++)r[s]=new z(a+s*b,l+s*T,u+s*x,h+s*C);return r}function w0(e){e=y(e,y.EMPTY_OBJECT);const t=e.positions,n=e.colors,i=y(e.width,1),o=y(e.colorsPerVertex,!1);if(!c(t)||t.length<2)throw new E("At least two positions are required.");if(typeof i!="number")throw new E("width must be a number");if(c(n)&&(o&&n.length<t.length||!o&&n.length<t.length-1))throw new E("colors has an invalid length.");this._positions=t,this._colors=n,this._width=i,this._colorsPerVertex=o,this._vertexFormat=Ee.clone(y(e.vertexFormat,Ee.DEFAULT)),this._arcType=y(e.arcType,cn.GEODESIC),this._granularity=y(e.granularity,R.RADIANS_PER_DEGREE),this._ellipsoid=ae.clone(y(e.ellipsoid,ae.WGS84)),this._workerName="createPolylineGeometry";let r=1+t.length*d.packedLength;r+=c(n)?1+n.length*z.packedLength:1,this.packedLength=r+ae.packedLength+Ee.packedLength+4}w0.pack=function(e,t,n){if(!c(e))throw new E("value is required");if(!c(t))throw new E("array is required");n=y(n,0);let i;const o=e._positions;let r=o.length;for(t[n++]=r,i=0;i<r;++i,n+=d.packedLength)d.pack(o[i],t,n);const s=e._colors;for(r=c(s)?s.length:0,t[n++]=r,i=0;i<r;++i,n+=z.packedLength)z.pack(s[i],t,n);return ae.pack(e._ellipsoid,t,n),n+=ae.packedLength,Ee.pack(e._vertexFormat,t,n),n+=Ee.packedLength,t[n++]=e._width,t[n++]=e._colorsPerVertex?1:0,t[n++]=e._arcType,t[n]=e._granularity,t};const h9=ae.clone(ae.UNIT_SPHERE),f9=new Ee,Of={positions:void 0,colors:void 0,ellipsoid:h9,vertexFormat:f9,width:void 0,colorsPerVertex:void 0,arcType:void 0,granularity:void 0};w0.unpack=function(e,t,n){if(!c(e))throw new E("array is required");t=y(t,0);let i,o=e[t++];const r=new Array(o);for(i=0;i<o;++i,t+=d.packedLength)r[i]=d.unpack(e,t);o=e[t++];const s=o>0?new Array(o):void 0;for(i=0;i<o;++i,t+=z.packedLength)s[i]=z.unpack(e,t);const a=ae.unpack(e,t,h9);t+=ae.packedLength;const l=Ee.unpack(e,t,f9);t+=Ee.packedLength;const u=e[t++],h=e[t++]===1,f=e[t++],_=e[t];return c(n)?(n._positions=r,n._colors=s,n._ellipsoid=ae.clone(a,n._ellipsoid),n._vertexFormat=Ee.clone(l,n._vertexFormat),n._width=u,n._colorsPerVertex=h,n._arcType=f,n._granularity=_,n):(Of.positions=r,Of.colors=s,Of.width=u,Of.colorsPerVertex=h,Of.arcType=f,Of.granularity=_,new w0(Of))};const fB=new d,pB=new d,mB=new d,_B=new d;w0.createGeometry=function(e){const t=e._width,n=e._vertexFormat;let i=e._colors;const o=e._colorsPerVertex,r=e._arcType,s=e._granularity,a=e._ellipsoid;let l,u,h;const f=[];let _=gs(e._positions,d.equalsEpsilon,!1,f);if(c(i)&&f.length>0){let O=0,F=f[0];i=i.filter(function(V,G){let j=!1;return o?j=G===F||G===0&&F===1:j=G+1===F,j?(O++,F=f[O],!1):!0})}let g=_.length;if(g<2||t<=0)return;if(r===cn.GEODESIC||r===cn.RHUMB){let O,F;r===cn.GEODESIC?(O=R.chordLength(s,a.maximumRadius),F=Io.numberOfPoints):(O=s,F=Io.numberOfPointsRhumbLine);const V=Io.extractHeights(_,a);if(c(i)){let G=1;for(l=0;l<g-1;++l)G+=F(_[l],_[l+1],O);const j=new Array(G);let W=0;for(l=0;l<g-1;++l){const X=_[l],q=_[l+1],ee=i[l],Y=F(X,q,O);if(o&&l<G){const ne=i[l+1],Q=i1e(X,q,ee,ne,Y),le=Q.length;for(u=0;u<le;++u)j[W++]=Q[u]}else for(u=0;u<Y;++u)j[W++]=z.clone(ee)}j[W]=z.clone(i[i.length-1]),i=j,d9.length=0}r===cn.GEODESIC?_=Io.generateCartesianArc({positions:_,minDistance:O,ellipsoid:a,height:V}):_=Io.generateCartesianRhumbArc({positions:_,granularity:O,ellipsoid:a,height:V})}g=_.length;const m=g*4-4,b=new Float64Array(m*3),T=new Float64Array(m*3),x=new Float64Array(m*3),C=new Float32Array(m*2),w=n.st?new Float32Array(m*2):void 0,v=c(i)?new Uint8Array(m*4):void 0;let P=0,N=0,k=0,M=0,U;for(u=0;u<g;++u){u===0?(U=fB,d.subtract(_[0],_[1],U),d.add(_[0],U,U)):U=_[u-1],d.clone(U,mB),d.clone(_[u],pB),u===g-1?(U=fB,d.subtract(_[g-1],_[g-2],U),d.add(_[g-1],U,U)):U=_[u+1],d.clone(U,_B);let O,F;c(v)&&(u!==0&&!o?O=i[u-1]:O=i[u],u!==g-1&&(F=i[u]));const V=u===0?2:0,G=u===g-1?2:4;for(h=V;h<G;++h){d.pack(pB,b,P),d.pack(mB,T,P),d.pack(_B,x,P),P+=3;const j=h-2<0?-1:1;if(C[N++]=2*(h%2)-1,C[N++]=j*t,n.st&&(w[k++]=u/(g-1),w[k++]=Math.max(C[N-2],0)),c(v)){const W=h<2?O:F;v[M++]=z.floatToByte(W.red),v[M++]=z.floatToByte(W.green),v[M++]=z.floatToByte(W.blue),v[M++]=z.floatToByte(W.alpha)}}}const B=new oi;B.position=new Ie({componentDatatype:Z.DOUBLE,componentsPerAttribute:3,values:b}),B.prevPosition=new Ie({componentDatatype:Z.DOUBLE,componentsPerAttribute:3,values:T}),B.nextPosition=new Ie({componentDatatype:Z.DOUBLE,componentsPerAttribute:3,values:x}),B.expandAndWidth=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:2,values:C}),n.st&&(B.st=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:2,values:w})),c(v)&&(B.color=new Ie({componentDatatype:Z.UNSIGNED_BYTE,componentsPerAttribute:4,values:v,normalize:!0}));const S=je.createTypedArray(m,g*6-6);let D=0,p=0;const I=g-1;for(u=0;u<I;++u)S[p++]=D,S[p++]=D+2,S[p++]=D+1,S[p++]=D+1,S[p++]=D+2,S[p++]=D+3,D+=4;return new Tt({attributes:B,indices:S,primitiveType:ze.TRIANGLES,boundingSphere:se.fromPoints(_),geometryType:Wm.POLYLINES})};const o1e=new ao(0),eC={},gB=new z,r1e=new kt(z.WHITE),s1e=new ao(!0),a1e=new ao(Vi.DISABLED),c1e=new ao(new Pt),l1e=new ao(Ui.BOTH);function u1e(){this.vertexFormat=void 0,this.positions=void 0,this.width=void 0,this.arcType=void 0,this.granularity=void 0}function d1e(){this.positions=void 0,this.width=void 0,this.arcType=void 0,this.granularity=void 0}function Ml(e,t){if(!c(e))throw new E("entity is required");if(!c(t))throw new E("scene is required");this._entity=e,this._scene=t,this._entitySubscription=e.definitionChanged.addEventListener(Ml.prototype._onEntityPropertyChanged,this),this._fillEnabled=!1,this._dynamic=!1,this._geometryChanged=new Le,this._showProperty=void 0,this._materialProperty=void 0,this._shadowsProperty=void 0,this._distanceDisplayConditionProperty=void 0,this._classificationTypeProperty=void 0,this._depthFailMaterialProperty=void 0,this._geometryOptions=new u1e,this._groundGeometryOptions=new d1e,this._id=`polyline-${e.id}`,this._clampToGround=!1,this._supportsPolylinesOnTerrain=Eo.supportsPolylinesOnTerrain(t),this._zIndex=0,this._onEntityPropertyChanged(e,"polyline",e.polyline,void 0)}Object.defineProperties(Ml.prototype,{id:{get:function(){return this._id}},entity:{get:function(){return this._entity}},fillEnabled:{get:function(){return this._fillEnabled}},hasConstantFill:{get:function(){return!this._fillEnabled||!c(this._entity.availability)&&K.isConstant(this._showProperty)}},fillMaterialProperty:{get:function(){return this._materialProperty}},depthFailMaterialProperty:{get:function(){return this._depthFailMaterialProperty}},outlineEnabled:{value:!1},hasConstantOutline:{value:!0},outlineColorProperty:{value:void 0},shadowsProperty:{get:function(){return this._shadowsProperty}},distanceDisplayConditionProperty:{get:function(){return this._distanceDisplayConditionProperty}},classificationTypeProperty:{get:function(){return this._classificationTypeProperty}},isDynamic:{get:function(){return this._dynamic}},isClosed:{value:!1},geometryChanged:{get:function(){return this._geometryChanged}},arcType:{get:function(){return this._arcType}},clampToGround:{get:function(){return this._clampToGround&&this._supportsPolylinesOnTerrain}},zIndex:{get:function(){return this._zIndex}}});Ml.prototype.isOutlineVisible=function(e){return!1};Ml.prototype.isFilled=function(e){const t=this._entity,n=this._fillEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e);return y(n,!1)};Ml.prototype.createFillGeometryInstance=function(e){if(!c(e))throw new E("time is required.");if(!this._fillEnabled)throw new E("This instance does not represent a filled geometry.");const t=this._entity,n=t.isAvailable(e),i=new mn(n&&t.isShowing&&this._showProperty.getValue(e)),o=this._distanceDisplayConditionProperty.getValue(e),r=Vn.fromDistanceDisplayCondition(o),s={show:i,distanceDisplayCondition:r};let a;return this._materialProperty instanceof kt&&(c(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(a=this._materialProperty.color.getValue(e,gB)),c(a)||(a=z.WHITE),s.color=$t.fromColor(a)),this.clampToGround?new Gt({id:t,geometry:new ud(this._groundGeometryOptions),attributes:s}):(c(this._depthFailMaterialProperty)&&this._depthFailMaterialProperty instanceof kt&&(c(this._depthFailMaterialProperty.color)&&(this._depthFailMaterialProperty.color.isConstant||n)&&(a=this._depthFailMaterialProperty.color.getValue(e,gB)),c(a)||(a=z.WHITE),s.depthFailColor=$t.fromColor(a)),new Gt({id:t,geometry:new w0(this._geometryOptions),attributes:s}))};Ml.prototype.createOutlineGeometryInstance=function(e){throw new E("This instance does not represent an outlined geometry.")};Ml.prototype.isDestroyed=function(){return!1};Ml.prototype.destroy=function(){this._entitySubscription(),ve(this)};Ml.prototype._onEntityPropertyChanged=function(e,t,n,i){if(!(t==="availability"||t==="polyline"))return;const o=this._entity.polyline;if(!c(o)){this._fillEnabled&&(this._fillEnabled=!1,this._geometryChanged.raiseEvent(this));return}const r=o.positions,s=o.show;if(c(s)&&s.isConstant&&!s.getValue(Ke.MINIMUM_VALUE)||!c(r)){this._fillEnabled&&(this._fillEnabled=!1,this._geometryChanged.raiseEvent(this));return}const a=o.zIndex,l=y(o.material,r1e),u=l instanceof kt;this._materialProperty=l,this._depthFailMaterialProperty=o.depthFailMaterial,this._showProperty=y(s,s1e),this._shadowsProperty=y(o.shadows,a1e),this._distanceDisplayConditionProperty=y(o.distanceDisplayCondition,c1e),this._classificationTypeProperty=y(o.classificationType,l1e),this._fillEnabled=!0,this._zIndex=y(a,o1e);const h=o.width,f=o.arcType,_=o.clampToGround,g=o.granularity;if(!r.isConstant||!K.isConstant(h)||!K.isConstant(f)||!K.isConstant(g)||!K.isConstant(_)||!K.isConstant(a))this._dynamic||(this._dynamic=!0,this._geometryChanged.raiseEvent(this));else{const m=this._geometryOptions,b=r.getValue(Ke.MINIMUM_VALUE,m.positions);if(!c(b)||b.length<2){this._fillEnabled&&(this._fillEnabled=!1,this._geometryChanged.raiseEvent(this));return}let T;u&&(!c(this._depthFailMaterialProperty)||this._depthFailMaterialProperty instanceof kt)?T=ds.VERTEX_FORMAT:T=Ur.VERTEX_FORMAT,m.vertexFormat=T,m.positions=b,m.width=c(h)?h.getValue(Ke.MINIMUM_VALUE):void 0,m.arcType=c(f)?f.getValue(Ke.MINIMUM_VALUE):void 0,m.granularity=c(g)?g.getValue(Ke.MINIMUM_VALUE):void 0;const x=this._groundGeometryOptions;x.positions=b,x.width=m.width,x.arcType=m.arcType,x.granularity=m.granularity,this._clampToGround=c(_)?_.getValue(Ke.MINIMUM_VALUE):!1,!this._clampToGround&&c(a)&&$n("Entity polylines must have clampToGround: true when using zIndex. zIndex will be ignored."),this._dynamic=!1,this._geometryChanged.raiseEvent(this)}};Ml.prototype.createDynamicUpdater=function(e,t){if(A.defined("primitives",e),A.defined("groundPrimitives",t),!this._dynamic)throw new E("This instance does not represent dynamic geometry.");return new ob(e,t,this)};const Em={positions:void 0,granularity:void 0,height:void 0,ellipsoid:void 0};function ob(e,t,n){this._line=void 0,this._primitives=e,this._groundPrimitives=t,this._groundPolylinePrimitive=void 0,this._material=void 0,this._geometryUpdater=n,this._positions=[]}function p9(e){if(c(e._line))return e._line;const t=e._primitives,n=e._geometryUpdater._scene.id+t._guid;let i=eC[n];!c(i)||i.isDestroyed()?(i=new la,eC[n]=i,t.add(i)):t.contains(i)||t.add(i);const o=i.add();return o.id=e._geometryUpdater._entity,e._line=o,o}ob.prototype.update=function(e){const t=this._geometryUpdater,n=t._entity,i=n.polyline,o=i.positions;let r=K.getValueOrUndefined(o,e,this._positions);t._clampToGround=K.getValueOrDefault(i._clampToGround,e,!1),t._groundGeometryOptions.positions=r,t._groundGeometryOptions.width=K.getValueOrDefault(i._width,e,1),t._groundGeometryOptions.arcType=K.getValueOrDefault(i._arcType,e,cn.GEODESIC),t._groundGeometryOptions.granularity=K.getValueOrDefault(i._granularity,e,9999);const s=this._groundPrimitives;if(c(this._groundPolylinePrimitive)&&(s.remove(this._groundPolylinePrimitive),this._groundPolylinePrimitive=void 0),t.clampToGround){if(!n.isShowing||!n.isAvailable(e)||!K.getValueOrDefault(i._show,e,!0)||!c(r)||r.length<2)return;const h=t.fillMaterialProperty;let f;if(h instanceof kt)f=new ds;else{const _=Go.getValue(e,h,this._material);f=new Ur({material:_,translucent:_.isTranslucent()}),this._material=_}this._groundPolylinePrimitive=s.add(new Sc({geometryInstances:t.createFillGeometryInstance(e),appearance:f,classificationType:t.classificationTypeProperty.getValue(e),asynchronous:!1}),K.getValueOrUndefined(t.zIndex,e)),c(this._line)&&(this._line.show=!1);return}const a=p9(this);if(!n.isShowing||!n.isAvailable(e)||!K.getValueOrDefault(i._show,e,!0)){a.show=!1;return}if(!c(r)||r.length<2){a.show=!1;return}let l=cn.GEODESIC;l=K.getValueOrDefault(i._arcType,e,l);const u=t._scene.globe;l!==cn.NONE&&c(u)&&(Em.ellipsoid=u.ellipsoid,Em.positions=r,Em.granularity=K.getValueOrUndefined(i._granularity,e),Em.height=Io.extractHeights(r,u.ellipsoid),l===cn.GEODESIC?r=Io.generateCartesianArc(Em):r=Io.generateCartesianRhumbArc(Em)),a.show=!0,a.positions=r.slice(),a.material=Go.getValue(e,t.fillMaterialProperty,a.material),a.width=K.getValueOrDefault(i._width,e,1),a.distanceDisplayCondition=K.getValueOrUndefined(i._distanceDisplayCondition,e,a.distanceDisplayCondition)};ob.prototype.getBoundingSphere=function(e){if(A.defined("result",e),this._geometryUpdater.clampToGround){const t=this._groundPolylinePrimitive;if(c(t)&&t.show&&t.ready){const n=t.getGeometryInstanceAttributes(this._geometryUpdater._entity);if(c(n)&&c(n.boundingSphere))return se.clone(n.boundingSphere,e),rt.DONE}return c(t)&&!t.ready?rt.PENDING:rt.DONE}else{const t=p9(this);if(t.show&&t.positions.length>0)return se.fromPoints(t.positions,e),rt.DONE}return rt.FAILED};ob.prototype.isDestroyed=function(){return!1};ob.prototype.destroy=function(){const t=this._geometryUpdater._scene.id+this._primitives._guid,n=eC[t];c(n)&&(n.remove(this._line),n.length===0&&(this._primitives.removeAndDestroy(n),delete eC[t])),c(this._groundPolylinePrimitive)&&this._groundPrimitives.remove(this._groundPolylinePrimitive),ve(this)};const h1e=new z,f1e=new Pt,p1e=new Pt;function Fl(e,t,n,i,o){let r;n instanceof kt?r=ds:r=Ur,this.orderedGroundPrimitives=e,this.classificationType=t,this.appearanceType=r,this.materialProperty=n,this.updaters=new mt,this.createPrimitive=!0,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new mt,this.material=void 0,this.updatersWithAttributes=new mt,this.attributes=new mt,this.invalidated=!1,this.removeMaterialSubscription=n.definitionChanged.addEventListener(Fl.prototype.onMaterialChanged,this),this.subscriptions=new mt,this.showsUpdated=new mt,this.zIndex=i,this._asynchronous=o}Fl.prototype.onMaterialChanged=function(){this.invalidated=!0};Fl.prototype.isMaterial=function(e){const t=this.materialProperty,n=e.fillMaterialProperty;return n===t||n instanceof kt&&t instanceof kt?!0:c(t)&&t.equals(n)};Fl.prototype.add=function(e,t,n){const i=t.id;if(this.updaters.set(i,t),this.geometry.set(i,n),!t.hasConstantFill||!t.fillMaterialProperty.isConstant||!K.isConstant(t.distanceDisplayConditionProperty))this.updatersWithAttributes.set(i,t);else{const o=this;this.subscriptions.set(i,t.entity.definitionChanged.addEventListener(function(r,s,a,l){s==="isShowing"&&o.showsUpdated.set(t.id,t)}))}this.createPrimitive=!0};Fl.prototype.remove=function(e){const t=e.id;if(this.createPrimitive=this.geometry.remove(t)||this.createPrimitive,this.updaters.remove(t)){this.updatersWithAttributes.remove(t);const n=this.subscriptions.get(t);return c(n)&&(n(),this.subscriptions.remove(t)),!0}return!1};Fl.prototype.update=function(e){let t=!0,n=this.primitive;const i=this.orderedGroundPrimitives,o=this.geometry.values;let r;if(this.createPrimitive){if(o.length>0)c(n)&&(c(this.oldPrimitive)?i.remove(n):this.oldPrimitive=n),n=new Sc({show:!1,asynchronous:this._asynchronous,geometryInstances:o.slice(),appearance:new this.appearanceType,classificationType:this.classificationType}),this.appearanceType===Ur&&(this.material=Go.getValue(e,this.materialProperty,this.material),n.appearance.material=this.material),i.add(n,this.zIndex),t=!1;else{c(n)&&(i.remove(n),n=void 0);const a=this.oldPrimitive;c(a)&&(i.remove(a),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=n,this.createPrimitive=!1}else if(c(n)&&n.ready){n.show=!0,c(this.oldPrimitive)&&(i.remove(this.oldPrimitive),this.oldPrimitive=void 0),this.appearanceType===Ur&&(this.material=Go.getValue(e,this.materialProperty,this.material),this.primitive.appearance.material=this.material);const s=this.updatersWithAttributes.values,a=s.length;for(r=0;r<a;r++){const l=s[r],u=l.entity,h=this.geometry.get(l.id);let f=this.attributes.get(h.id.id);if(c(f)||(f=n.getGeometryInstanceAttributes(h.id),this.attributes.set(h.id.id,f)),!l.fillMaterialProperty.isConstant){const b=l.fillMaterialProperty.color,T=K.getValueOrDefault(b,e,z.WHITE,h1e);z.equals(f._lastColor,T)||(f._lastColor=z.clone(T,f._lastColor),f.color=$t.toValue(T,f.color))}const _=u.isShowing&&(l.hasConstantFill||l.isFilled(e)),g=f.show[0]===1;_!==g&&(f.show=mn.toValue(_,f.show));const m=l.distanceDisplayConditionProperty;if(!K.isConstant(m)){const b=K.getValueOrDefault(m,e,p1e,f1e);Pt.equals(b,f._lastDistanceDisplayCondition)||(f._lastDistanceDisplayCondition=Pt.clone(b,f._lastDistanceDisplayCondition),f.distanceDisplayCondition=Vn.toValue(b,f.distanceDisplayCondition))}}this.updateShows(n)}else c(n)&&!n.ready&&(t=!1);return t};Fl.prototype.updateShows=function(e){const t=this.showsUpdated.values,n=t.length;for(let i=0;i<n;i++){const o=t[i],r=o.entity,s=this.geometry.get(o.id);let a=this.attributes.get(s.id.id);c(a)||(a=e.getGeometryInstanceAttributes(s.id),this.attributes.set(s.id.id,a));const l=r.isShowing,u=a.show[0]===1;l!==u&&(a.show=mn.toValue(l,a.show),s.attributes.show.value[0]=a.show[0])}this.showsUpdated.removeAll()};Fl.prototype.contains=function(e){return this.updaters.contains(e.id)};Fl.prototype.getBoundingSphere=function(e,t){const n=this.primitive;if(!n.ready)return rt.PENDING;const i=n.getGeometryInstanceAttributes(e.entity);return!c(i)||!c(i.boundingSphere)||c(i.show)&&i.show[0]===0?rt.FAILED:(i.boundingSphere.clone(t),rt.DONE)};Fl.prototype.destroy=function(){const e=this.primitive,t=this.orderedGroundPrimitives;c(e)&&t.remove(e);const n=this.oldPrimitive;c(n)&&t.remove(n),this.removeMaterialSubscription()};function J_(e,t,n){this._items=[],this._orderedGroundPrimitives=e,this._classificationType=t,this._asynchronous=y(n,!0)}J_.prototype.add=function(e,t){const n=this._items,i=n.length,o=t.createFillGeometryInstance(e),r=K.getValueOrDefault(t.zIndex,0);for(let a=0;a<i;++a){const l=n[a];if(l.isMaterial(t)&&l.zIndex===r){l.add(e,t,o);return}}const s=new Fl(this._orderedGroundPrimitives,this._classificationType,t.fillMaterialProperty,r,this._asynchronous);s.add(e,t,o),n.push(s)};J_.prototype.remove=function(e){const t=this._items,n=t.length;for(let i=n-1;i>=0;i--){const o=t[i];if(o.remove(e)){o.updaters.length===0&&(t.splice(i,1),o.destroy());break}}};J_.prototype.update=function(e){let t;const n=this._items,i=n.length;for(t=i-1;t>=0;t--){const r=n[t];if(r.invalidated){n.splice(t,1);const s=r.updaters.values,a=s.length;for(let l=0;l<a;l++)this.add(e,s[l]);r.destroy()}}let o=!0;for(t=0;t<n.length;t++)o=n[t].update(e)&&o;return o};J_.prototype.getBoundingSphere=function(e,t){const n=this._items,i=n.length;for(let o=0;o<i;o++){const r=n[o];if(r.contains(e))return r.getBoundingSphere(e,t)}return rt.FAILED};J_.prototype.removeAllPrimitives=function(){const e=this._items,t=e.length;for(let n=0;n<t;n++)e[n].destroy();this._items.length=0};const m1e=[];function yB(e,t){const n=e._batches,i=n.length;for(let o=0;o<i;o++)n[o].remove(t)}function bB(e,t,n){if(n.isDynamic){e._dynamicBatch.add(t,n);return}if(n.clampToGround&&n.fillEnabled){const s=n.classificationTypeProperty.getValue(t);e._groundBatches[s].add(t,n);return}let i;n.fillEnabled&&(i=n.shadowsProperty.getValue(t));let o=0;c(n.depthFailMaterialProperty)&&(o=n.depthFailMaterialProperty instanceof kt?1:2);let r;c(i)&&(r=i+o*Vi.NUMBER_OF_SHADOW_MODES),n.fillEnabled&&(n.fillMaterialProperty instanceof kt?e._colorBatches[r].add(t,n):e._materialBatches[r].add(t,n))}function au(e,t,n,i){A.defined("scene",e),A.defined("entityCollection",t),i=y(i,e.groundPrimitives),n=y(n,e.primitives),this._scene=e,this._primitives=n,this._entityCollection=void 0,this._addedObjects=new mt,this._removedObjects=new mt,this._changedObjects=new mt;let o;const r=Vi.NUMBER_OF_SHADOW_MODES;for(this._colorBatches=new Array(r*3),this._materialBatches=new Array(r*3),o=0;o<r;++o)this._colorBatches[o]=new mc(n,ds,void 0,!1,o),this._materialBatches[o]=new _c(n,Ur,void 0,!1,o),this._colorBatches[o+r]=new mc(n,ds,ds,!1,o),this._materialBatches[o+r]=new _c(n,Ur,ds,!1,o),this._colorBatches[o+r*2]=new mc(n,ds,Ur,!1,o),this._materialBatches[o+r*2]=new _c(n,Ur,Ur,!1,o);this._dynamicBatch=new Hp(n,i);const s=Ui.NUMBER_OF_CLASSIFICATION_TYPES;for(this._groundBatches=new Array(s),o=0;o<s;++o)this._groundBatches[o]=new J_(i,o);this._batches=this._colorBatches.concat(this._materialBatches,this._dynamicBatch,this._groundBatches),this._subscriptions=new mt,this._updaters=new mt,this._entityCollection=t,t.collectionChanged.addEventListener(au.prototype._onCollectionChanged,this),this._onCollectionChanged(t,t.values,m1e)}au.prototype.update=function(e){A.defined("time",e);const t=this._addedObjects,n=t.values,i=this._removedObjects,o=i.values,r=this._changedObjects,s=r.values;let a,l,u,h;for(a=s.length-1;a>-1;a--)l=s[a],u=l.id,h=this._updaters.get(u),h.entity===l?(yB(this,h),bB(this,e,h)):(o.push(l),n.push(l));for(a=o.length-1;a>-1;a--)l=o[a],u=l.id,h=this._updaters.get(u),yB(this,h),h.destroy(),this._updaters.remove(u),this._subscriptions.get(u)(),this._subscriptions.remove(u);for(a=n.length-1;a>-1;a--)l=n[a],u=l.id,h=new Ml(l,this._scene),this._updaters.set(u,h),bB(this,e,h),this._subscriptions.set(u,h.geometryChanged.addEventListener(au._onGeometryChanged,this));t.removeAll(),i.removeAll(),r.removeAll();let f=!0;const _=this._batches,g=_.length;for(a=0;a<g;a++)f=_[a].update(e)&&f;return f};const _1e=[],g1e=new se;au.prototype.getBoundingSphere=function(e,t){A.defined("entity",e),A.defined("result",t);const n=_1e,i=g1e;let o=0,r=rt.DONE;const s=this._batches,a=s.length,l=this._updaters.get(e.id);for(let u=0;u<a;u++){if(r=s[u].getBoundingSphere(l,i),r===rt.PENDING)return rt.PENDING;r===rt.DONE&&(n[o]=se.clone(i,n[o]),o++)}return o===0?rt.FAILED:(n.length=o,se.fromBoundingSpheres(n,t),rt.DONE)};au.prototype.isDestroyed=function(){return!1};au.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(au.prototype._onCollectionChanged,this),this._addedObjects.removeAll(),this._removedObjects.removeAll();let e;const t=this._batches;let n=t.length;for(e=0;e<n;e++)t[e].removeAllPrimitives();const i=this._subscriptions.values;for(n=i.length,e=0;e<n;e++)i[e]();return this._subscriptions.removeAll(),ve(this)};au._onGeometryChanged=function(e){const t=this._removedObjects,n=this._changedObjects,i=e.entity,o=i.id;!c(t.get(o))&&!c(n.get(o))&&n.set(o,i)};au.prototype._onCollectionChanged=function(e,t,n){const i=this._addedObjects,o=this._removedObjects,r=this._changedObjects;let s,a,l;for(s=n.length-1;s>-1;s--)l=n[s],a=l.id,i.remove(a)||(o.set(a,l),r.remove(a));for(s=t.length-1;s>-1;s--)l=t[s],a=l.id,o.remove(a)?r.set(a,l):i.set(a,l)};function ua(e){A.typeOf.object("options",e),A.typeOf.object("options.scene",e.scene),A.typeOf.object("options.dataSourceCollection",e.dataSourceCollection),sr.initializeTerrainHeights(),Sc.initializeTerrainHeights();const t=e.scene,n=e.dataSourceCollection;this._eventHelper=new Tu,this._eventHelper.add(n.dataSourceAdded,this._onDataSourceAdded,this),this._eventHelper.add(n.dataSourceRemoved,this._onDataSourceRemoved,this),this._eventHelper.add(n.dataSourceMoved,this._onDataSourceMoved,this),this._eventHelper.add(t.postRender,this._postRender,this),this._dataSourceCollection=n,this._scene=t,this._visualizersCallback=y(e.visualizersCallback,ua.defaultVisualizersCallback);let i=!1;const o=new eo,r=new eo;n.length>0&&(t.primitives.add(o),t.groundPrimitives.add(r),i=!0),this._primitives=o,this._groundPrimitives=r;for(let u=0,h=n.length;u<h;u++)this._onDataSourceAdded(n,n.get(u));const s=new i1;this._onDataSourceAdded(void 0,s),this._defaultDataSource=s;let a,l;if(!i){const u=this,h=function(){t.primitives.add(o),t.groundPrimitives.add(r),a(),l(),u._removeDefaultDataSourceListener=void 0,u._removeDataSourceCollectionListener=void 0};a=s.entities.collectionChanged.addEventListener(h),l=n.dataSourceAdded.addEventListener(h)}this._removeDefaultDataSourceListener=a,this._removeDataSourceCollectionListener=l,this._ready=!1}const __=[];ua.registerVisualizer=function(e){__.includes(e)||__.push(e)};ua.unregisterVisualizer=function(e){if(__.includes(e)){const t=__.indexOf(e);__.splice(t,1)}};ua.defaultVisualizersCallback=function(e,t,n){const i=n.entities;return[new Dh(t,i),new ca(e,i,n._primitives,n._groundPrimitives),new kh(t,i),new Vh(e,i),new Bh(e,i),new jh(t,i),new Gh(e,i),new au(e,i,n._primitives,n._groundPrimitives),...__.map(o=>new o(e,i))]};Object.defineProperties(ua.prototype,{scene:{get:function(){return this._scene}},dataSources:{get:function(){return this._dataSourceCollection}},defaultDataSource:{get:function(){return this._defaultDataSource}},ready:{get:function(){return this._ready}}});ua.prototype.isDestroyed=function(){return!1};ua.prototype.destroy=function(){this._eventHelper.removeAll();const e=this._dataSourceCollection;for(let t=0,n=e.length;t<n;++t)this._onDataSourceRemoved(this._dataSourceCollection,e.get(t));return this._onDataSourceRemoved(void 0,this._defaultDataSource),c(this._removeDefaultDataSourceListener)?(this._removeDefaultDataSourceListener(),this._removeDataSourceCollectionListener()):(this._scene.primitives.remove(this._primitives),this._scene.groundPrimitives.remove(this._groundPrimitives)),ve(this)};ua.prototype.update=function(e){if(A.defined("time",e),!Ti.initialized)return this._ready=!1,!1;let t=!0,n,i,o,r;const s=this._dataSourceCollection,a=s.length;for(n=0;n<a;n++){const l=s.get(n);for(c(l.update)&&(t=l.update(e)&&t),o=l._visualizers,r=o.length,i=0;i<r;i++)t=o[i].update(e)&&t}for(o=this._defaultDataSource._visualizers,r=o.length,i=0;i<r;i++)t=o[i].update(e)&&t;return!this._ready&&t&&this._scene.requestRender(),this._ready=t,t};ua.prototype._postRender=function(){const e=this._scene.frameState,t=this._dataSourceCollection,n=t.length;for(let i=0;i<n;i++){const o=t.get(i),r=o.credit;c(r)&&e.creditDisplay.addCreditToNextFrame(r);const s=o._resourceCredits;if(c(s)){const a=s.length;for(let l=0;l<a;l++)e.creditDisplay.addCreditToNextFrame(s[l])}}};const y1e=[],b1e=new se;ua.prototype.getBoundingSphere=function(e,t,n){if(A.defined("entity",e),A.typeOf.bool("allowPartial",t),A.defined("result",n),!this._ready)return rt.PENDING;let i,o,r=this._defaultDataSource;if(!r.entities.contains(e)){r=void 0;const _=this._dataSourceCollection;for(o=_.length,i=0;i<o;i++){const g=_.get(i);if(g.entities.contains(e)){r=g;break}}}if(!c(r))return rt.FAILED;const s=y1e,a=b1e;let l=0,u=rt.DONE;const h=r._visualizers,f=h.length;for(i=0;i<f;i++){const _=h[i];if(c(_.getBoundingSphere)){if(u=h[i].getBoundingSphere(e,a),!t&&u===rt.PENDING)return rt.PENDING;u===rt.DONE&&(s[l]=se.clone(a,s[l]),l++)}}return l===0?rt.FAILED:(s.length=l,se.fromBoundingSpheres(s,n),rt.DONE)};ua.prototype._onDataSourceAdded=function(e,t){const n=this._scene,i=this._primitives,o=this._groundPrimitives,r=i.add(new eo),s=o.add(new Au);t._primitives=r,t._groundPrimitives=s;const a=t.clustering;a._initialize(n),r.add(a),t._visualizers=this._visualizersCallback(n,a,t)};ua.prototype._onDataSourceRemoved=function(e,t){const n=this._primitives,i=this._groundPrimitives,o=t._primitives,r=t._groundPrimitives,s=t.clustering;o.remove(s);const a=t._visualizers,l=a.length;for(let u=0;u<l;u++)a[u].destroy();n.remove(o),i.remove(r),t._visualizers=void 0};ua.prototype._onDataSourceMoved=function(e,t,n){const i=this._primitives,o=this._groundPrimitives,r=e._primitives,s=e._groundPrimitives;t===n+1?(i.raise(r),o.raise(s)):t===n-1?(i.lower(r),o.lower(s)):t===0?(i.lowerToBottom(r),o.lowerToBottom(s),i.raise(r),o.raise(s)):(i.raiseToTop(r),o.raiseToTop(s))};function F_(e,t,n){this.heading=y(e,0),this.pitch=y(t,0),this.range=y(n,0)}F_.clone=function(e,t){if(!!c(e))return c(t)||(t=new F_),t.heading=e.heading,t.pitch=e.pitch,t.range=e.range,t};const TB=new $,AB=new $,xB=new $,T1e=new L,jT=new d,CB=new d,lv=new d,uv=new d,EB=new d,wB=new d,wm=new ie,A1e=1.25;function x1e(e,t,n,i,o,r,s){const a=e.scene.mode;let l=o.getValue(r,e._lastCartesian);if(c(l)){let u=!1,h=!1,f,_,g;if(a===oe.SCENE3D){ie.addSeconds(r,.001,wm);let C=o.getValue(wm,jT);if(c(C)||(ie.addSeconds(r,-.001,wm),C=o.getValue(wm,jT),h=!0),c(C)){let w=zt.computeFixedToIcrfMatrix(r,TB),v=zt.computeFixedToIcrfMatrix(wm,AB),P;!c(w)||!c(v)?(P=zt.computeTemeToPseudoFixedMatrix(r,xB),w=$.transpose(P,TB),v=zt.computeTemeToPseudoFixedMatrix(wm,AB),$.transpose(v,v)):P=$.transpose(w,xB);const N=$.multiplyByVector(w,l,EB),k=$.multiplyByVector(v,C,wB);d.subtract(N,k,uv);const M=d.magnitude(uv)*1e3,U=R.GRAVITATIONALPARAMETER,B=-U/(M*M-2*U/d.magnitude(N));B<0||B>A1e*s.maximumRadius?(f=CB,d.normalize(l,f),d.negate(f,f),g=d.clone(d.UNIT_Z,lv),_=d.cross(g,f,jT),d.magnitude(_)>R.EPSILON7&&(d.normalize(f,f),d.normalize(_,_),g=d.cross(f,_,lv),d.normalize(g,g),u=!0)):d.equalsEpsilon(l,C,R.EPSILON7)||(g=CB,d.normalize(N,g),d.normalize(k,k),_=d.cross(g,k,lv),h&&(_=d.multiplyByScalar(_,-1,_)),d.equalsEpsilon(_,d.ZERO,R.EPSILON7)||(f=d.cross(_,g,jT),$.multiplyByVector(P,f,f),$.multiplyByVector(P,_,_),$.multiplyByVector(P,g,g),d.normalize(f,f),d.normalize(_,_),d.normalize(g,g),u=!0))}}c(e.boundingSphere)&&(l=e.boundingSphere.center);let m,b,T;i&&(m=d.clone(t.position,uv),b=d.clone(t.direction,EB),T=d.clone(t.up,wB));const x=T1e;u?(x[0]=f.x,x[1]=f.y,x[2]=f.z,x[3]=0,x[4]=_.x,x[5]=_.y,x[6]=_.z,x[7]=0,x[8]=g.x,x[9]=g.y,x[10]=g.z,x[11]=0,x[12]=l.x,x[13]=l.y,x[14]=l.z,x[15]=0):zt.eastNorthUpToFixedFrame(l,s,x),t._setTransform(x),i&&(d.clone(m,t.position),d.clone(b,t.direction),d.clone(T,t.up),d.cross(b,T,t.right))}if(n){const u=a===oe.SCENE2D||d.equals(e._offset3D,d.ZERO)?void 0:e._offset3D;t.lookAtTransform(t.transform,u)}}function S0(e,t,n){A.defined("entity",e),A.defined("scene",t),this.entity=e,this.scene=t,this.ellipsoid=y(n,ae.WGS84),this.boundingSphere=void 0,this._lastEntity=void 0,this._mode=void 0,this._lastCartesian=new d,this._defaultOffset3D=void 0,this._offset3D=new d}Object.defineProperties(S0,{defaultOffset3D:{get:function(){return this._defaultOffset3D},set:function(e){this._defaultOffset3D=d.clone(e,new d)}}});S0.defaultOffset3D=new d(-14e3,3500,3500);const WT=new F_,C1e=new d;S0.prototype.update=function(e,t){A.defined("time",e);const n=this.scene,i=this.ellipsoid,o=n.mode;if(o===oe.MORPHING)return;const r=this.entity,s=r.position;if(!c(s))return;const a=r!==this._lastEntity,l=o!==this._mode,u=n.camera;let h=a||l,f=!0;if(a){const _=r.viewFrom,g=c(_);if(!g&&c(t)){WT.pitch=-R.PI_OVER_FOUR,WT.range=0;const m=s.getValue(e,C1e);if(c(m)){const b=2-1/Math.max(1,d.magnitude(m)/i.maximumRadius);WT.pitch*=b}u.viewBoundingSphere(t,WT),this.boundingSphere=t,h=!1,f=!1}else(!g||!c(_.getValue(e,this._offset3D)))&&d.clone(S0._defaultOffset3D,this._offset3D)}else!l&&this._mode!==oe.SCENE2D&&d.clone(u.position,this._offset3D);this._lastEntity=r,this._mode=o,x1e(this,u,h,f,s,e,i)};function Do(e){if(typeof e=="string"){const t=document.getElementById(e);if(t===null)throw new E(`Element with id "${e}" does not exist in the document.`);e=t}return e}var wn=Object.freeze({Linear:Object.freeze({None:function(e){return e},In:function(e){return e},Out:function(e){return e},InOut:function(e){return e}}),Quadratic:Object.freeze({In:function(e){return e*e},Out:function(e){return e*(2-e)},InOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)}}),Cubic:Object.freeze({In:function(e){return e*e*e},Out:function(e){return--e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}}),Quartic:Object.freeze({In:function(e){return e*e*e*e},Out:function(e){return 1- --e*e*e*e},InOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}}),Quintic:Object.freeze({In:function(e){return e*e*e*e*e},Out:function(e){return--e*e*e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}}),Sinusoidal:Object.freeze({In:function(e){return 1-Math.sin((1-e)*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return .5*(1-Math.sin(Math.PI*(.5-e)))}}),Exponential:Object.freeze({In:function(e){return e===0?0:Math.pow(1024,e-1)},Out:function(e){return e===1?1:1-Math.pow(2,-10*e)},InOut:function(e){return e===0?0:e===1?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(-Math.pow(2,-10*(e-1))+2)}}),Circular:Object.freeze({In:function(e){return 1-Math.sqrt(1-e*e)},Out:function(e){return Math.sqrt(1- --e*e)},InOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}}),Elastic:Object.freeze({In:function(e){return e===0?0:e===1?1:-Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI)},Out:function(e){return e===0?0:e===1?1:Math.pow(2,-10*e)*Math.sin((e-.1)*5*Math.PI)+1},InOut:function(e){return e===0?0:e===1?1:(e*=2,e<1?-.5*Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI):.5*Math.pow(2,-10*(e-1))*Math.sin((e-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(e){var t=1.70158;return e===1?1:e*e*((t+1)*e-t)},Out:function(e){var t=1.70158;return e===0?0:--e*e*((t+1)*e+t)+1},InOut:function(e){var t=2.5949095;return(e*=2)<1?.5*(e*e*((t+1)*e-t)):.5*((e-=2)*e*((t+1)*e+t)+2)}}),Bounce:Object.freeze({In:function(e){return 1-wn.Bounce.Out(1-e)},Out:function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},InOut:function(e){return e<.5?wn.Bounce.In(e*2)*.5:wn.Bounce.Out(e*2-1)*.5+.5}}),generatePow:function(e){return e===void 0&&(e=4),e=e<Number.EPSILON?Number.EPSILON:e,e=e>1e4?1e4:e,{In:function(t){return Math.pow(t,e)},Out:function(t){return 1-Math.pow(1-t,e)},InOut:function(t){return t<.5?Math.pow(t*2,e)/2:(1-Math.pow(2-t*2,e))/2+.5}}}}),_y=function(){return performance.now()},E1e=function(){function e(){this._tweens={},this._tweensAddedDuringUpdate={}}return e.prototype.getAll=function(){var t=this;return Object.keys(this._tweens).map(function(n){return t._tweens[n]})},e.prototype.removeAll=function(){this._tweens={}},e.prototype.add=function(t){this._tweens[t.getId()]=t,this._tweensAddedDuringUpdate[t.getId()]=t},e.prototype.remove=function(t){delete this._tweens[t.getId()],delete this._tweensAddedDuringUpdate[t.getId()]},e.prototype.update=function(t,n){t===void 0&&(t=_y()),n===void 0&&(n=!1);var i=Object.keys(this._tweens);if(i.length===0)return!1;for(;i.length>0;){this._tweensAddedDuringUpdate={};for(var o=0;o<i.length;o++){var r=this._tweens[i[o]],s=!n;r&&r.update(t,s)===!1&&!n&&delete this._tweens[i[o]]}i=Object.keys(this._tweensAddedDuringUpdate)}return!0},e}(),Jm={Linear:function(e,t){var n=e.length-1,i=n*t,o=Math.floor(i),r=Jm.Utils.Linear;return t<0?r(e[0],e[1],i):t>1?r(e[n],e[n-1],n-i):r(e[o],e[o+1>n?n:o+1],i-o)},Bezier:function(e,t){for(var n=0,i=e.length-1,o=Math.pow,r=Jm.Utils.Bernstein,s=0;s<=i;s++)n+=o(1-t,i-s)*o(t,s)*e[s]*r(i,s);return n},CatmullRom:function(e,t){var n=e.length-1,i=n*t,o=Math.floor(i),r=Jm.Utils.CatmullRom;return e[0]===e[n]?(t<0&&(o=Math.floor(i=n*(1+t))),r(e[(o-1+n)%n],e[o],e[(o+1)%n],e[(o+2)%n],i-o)):t<0?e[0]-(r(e[0],e[0],e[1],e[1],-i)-e[0]):t>1?e[n]-(r(e[n],e[n],e[n-1],e[n-1],i-n)-e[n]):r(e[o?o-1:0],e[o],e[n<o+1?n:o+1],e[n<o+2?n:o+2],i-o)},Utils:{Linear:function(e,t,n){return(t-e)*n+e},Bernstein:function(e,t){var n=Jm.Utils.Factorial;return n(e)/n(t)/n(e-t)},Factorial:function(){var e=[1];return function(t){var n=1;if(e[t])return e[t];for(var i=t;i>1;i--)n*=i;return e[t]=n,n}}(),CatmullRom:function(e,t,n,i,o){var r=(n-e)*.5,s=(i-t)*.5,a=o*o,l=o*a;return(2*t-2*n+r+s)*l+(-3*t+3*n-2*r-s)*a+r*o+t}}},m9=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),ID=new E1e,w1e=function(){function e(t,n){n===void 0&&(n=ID),this._object=t,this._group=n,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=wn.Linear.None,this._interpolationFunction=Jm.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=m9.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1}return e.prototype.getId=function(){return this._id},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isPaused=function(){return this._isPaused},e.prototype.getDuration=function(){return this._duration},e.prototype.to=function(t,n){if(n===void 0&&(n=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=t,this._propertiesAreSetUp=!1,this._duration=n<0?0:n,this},e.prototype.duration=function(t){return t===void 0&&(t=1e3),this._duration=t<0?0:t,this},e.prototype.dynamic=function(t){return t===void 0&&(t=!1),this._isDynamic=t,this},e.prototype.start=function(t,n){if(t===void 0&&(t=_y()),n===void 0&&(n=!1),this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var i in this._valuesStartRepeat)this._swapEndStartRepeatValues(i),this._valuesStart[i]=this._valuesStartRepeat[i]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=t,this._startTime+=this._delayTime,!this._propertiesAreSetUp||n){if(this._propertiesAreSetUp=!0,!this._isDynamic){var o={};for(var r in this._valuesEnd)o[r]=this._valuesEnd[r];this._valuesEnd=o}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,n)}return this},e.prototype.startFromCurrentValues=function(t){return this.start(t,!0)},e.prototype._setupProperties=function(t,n,i,o,r){for(var s in i){var a=t[s],l=Array.isArray(a),u=l?"array":typeof a,h=!l&&Array.isArray(i[s]);if(!(u==="undefined"||u==="function")){if(h){var f=i[s];if(f.length===0)continue;for(var _=[a],g=0,m=f.length;g<m;g+=1){var b=this._handleRelativeValue(a,f[g]);if(isNaN(b)){h=!1,console.warn("Found invalid interpolation list. Skipping.");break}_.push(b)}h&&(i[s]=_)}if((u==="object"||l)&&a&&!h){n[s]=l?[]:{};var T=a;for(var x in T)n[s][x]=T[x];o[s]=l?[]:{};var f=i[s];if(!this._isDynamic){var C={};for(var x in f)C[x]=f[x];i[s]=f=C}this._setupProperties(T,n[s],f,o[s],r)}else(typeof n[s]>"u"||r)&&(n[s]=a),l||(n[s]*=1),h?o[s]=i[s].slice().reverse():o[s]=n[s]||0}}},e.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},e.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},e.prototype.pause=function(t){return t===void 0&&(t=_y()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=t,this._group&&this._group.remove(this),this)},e.prototype.resume=function(t){return t===void 0&&(t=_y()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=t-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this)},e.prototype.stopChainedTweens=function(){for(var t=0,n=this._chainedTweens.length;t<n;t++)this._chainedTweens[t].stop();return this},e.prototype.group=function(t){return t===void 0&&(t=ID),this._group=t,this},e.prototype.delay=function(t){return t===void 0&&(t=0),this._delayTime=t,this},e.prototype.repeat=function(t){return t===void 0&&(t=0),this._initialRepeat=t,this._repeat=t,this},e.prototype.repeatDelay=function(t){return this._repeatDelayTime=t,this},e.prototype.yoyo=function(t){return t===void 0&&(t=!1),this._yoyo=t,this},e.prototype.easing=function(t){return t===void 0&&(t=wn.Linear.None),this._easingFunction=t,this},e.prototype.interpolation=function(t){return t===void 0&&(t=Jm.Linear),this._interpolationFunction=t,this},e.prototype.chain=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return this._chainedTweens=t,this},e.prototype.onStart=function(t){return this._onStartCallback=t,this},e.prototype.onEveryStart=function(t){return this._onEveryStartCallback=t,this},e.prototype.onUpdate=function(t){return this._onUpdateCallback=t,this},e.prototype.onRepeat=function(t){return this._onRepeatCallback=t,this},e.prototype.onComplete=function(t){return this._onCompleteCallback=t,this},e.prototype.onStop=function(t){return this._onStopCallback=t,this},e.prototype.update=function(t,n){var i;if(t===void 0&&(t=_y()),n===void 0&&(n=!0),this._isPaused)return!0;var o=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(t>o)return!1;n&&this.start(t,!0)}if(this._goToEnd=!1,t<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 r=t-this._startTime,s=this._duration+((i=this._repeatDelayTime)!==null&&i!==void 0?i:this._delayTime),a=this._duration+this._repeat*s,l=this._calculateElapsedPortion(r,s,a),u=this._easingFunction(l),h=this._calculateCompletionStatus(r,s);if(h==="repeat"&&this._processRepetition(r,s),this._updateProperties(this._object,this._valuesStart,this._valuesEnd,u),h==="about-to-repeat"&&this._processRepetition(r,s),this._onUpdateCallback&&this._onUpdateCallback(this._object,l),h==="repeat"||h==="about-to-repeat")this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1;else if(h==="completed"){this._isPlaying=!1,this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var f=0,_=this._chainedTweens.length;f<_;f++)this._chainedTweens[f].start(this._startTime+this._duration,!1)}return h!=="completed"},e.prototype._calculateElapsedPortion=function(t,n,i){if(this._duration===0||t>i)return 1;var o=t%n,r=Math.min(o/this._duration,1);return r===0&&t!==0&&t%this._duration===0?1:r},e.prototype._calculateCompletionStatus=function(t,n){return this._duration!==0&&t<this._duration?"playing":this._repeat<=0?"completed":t===this._duration?"about-to-repeat":"repeat"},e.prototype._processRepetition=function(t,n){var i=Math.min(Math.trunc((t-this._duration)/n)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=i);for(var o in this._valuesStartRepeat){var r=this._valuesEnd[o];!this._yoyo&&typeof r=="string"&&(this._valuesStartRepeat[o]=this._valuesStartRepeat[o]+parseFloat(r)),this._yoyo&&this._swapEndStartRepeatValues(o),this._valuesStart[o]=this._valuesStartRepeat[o]}this._yoyo&&(this._reversed=!this._reversed),this._startTime+=n*i},e.prototype._updateProperties=function(t,n,i,o){for(var r in i)if(n[r]!==void 0){var s=n[r]||0,a=i[r],l=Array.isArray(t[r]),u=Array.isArray(a),h=!l&&u;h?t[r]=this._interpolationFunction(a,o):typeof a=="object"&&a?this._updateProperties(t[r],s,a,o):(a=this._handleRelativeValue(s,a),typeof a=="number"&&(t[r]=s+(a-s)*o))}},e.prototype._handleRelativeValue=function(t,n){return typeof n!="string"?n:n.charAt(0)==="+"||n.charAt(0)==="-"?t+parseFloat(n):parseFloat(n)},e.prototype._swapEndStartRepeatValues=function(t){var n=this._valuesStartRepeat[t],i=this._valuesEnd[t];typeof i=="string"?this._valuesStartRepeat[t]=this._valuesStartRepeat[t]+parseFloat(i):this._valuesStartRepeat[t]=this._valuesEnd[t],this._valuesEnd[t]=n},e}();m9.nextId;var cu=ID;cu.getAll.bind(cu);cu.removeAll.bind(cu);cu.add.bind(cu);cu.remove.bind(cu);cu.update.bind(cu);const S1e={LINEAR_NONE:wn.Linear.None,QUADRATIC_IN:wn.Quadratic.In,QUADRATIC_OUT:wn.Quadratic.Out,QUADRATIC_IN_OUT:wn.Quadratic.InOut,CUBIC_IN:wn.Cubic.In,CUBIC_OUT:wn.Cubic.Out,CUBIC_IN_OUT:wn.Cubic.InOut,QUARTIC_IN:wn.Quartic.In,QUARTIC_OUT:wn.Quartic.Out,QUARTIC_IN_OUT:wn.Quartic.InOut,QUINTIC_IN:wn.Quintic.In,QUINTIC_OUT:wn.Quintic.Out,QUINTIC_IN_OUT:wn.Quintic.InOut,SINUSOIDAL_IN:wn.Sinusoidal.In,SINUSOIDAL_OUT:wn.Sinusoidal.Out,SINUSOIDAL_IN_OUT:wn.Sinusoidal.InOut,EXPONENTIAL_IN:wn.Exponential.In,EXPONENTIAL_OUT:wn.Exponential.Out,EXPONENTIAL_IN_OUT:wn.Exponential.InOut,CIRCULAR_IN:wn.Circular.In,CIRCULAR_OUT:wn.Circular.Out,CIRCULAR_IN_OUT:wn.Circular.InOut,ELASTIC_IN:wn.Elastic.In,ELASTIC_OUT:wn.Elastic.Out,ELASTIC_IN_OUT:wn.Elastic.InOut,BACK_IN:wn.Back.In,BACK_OUT:wn.Back.Out,BACK_IN_OUT:wn.Back.InOut,BOUNCE_IN:wn.Bounce.In,BOUNCE_OUT:wn.Bounce.Out,BOUNCE_IN_OUT:wn.Bounce.InOut},ka=Object.freeze(S1e),SB=`#ifdef MRT
|
|
layout (location = 0) out vec4 out_FragData_0;
|
|
layout (location = 1) out vec4 out_FragData_1;
|
|
#else
|
|
layout (location = 0) out vec4 out_FragColor;
|
|
#endif
|
|
|
|
uniform vec4 u_bgColor;
|
|
uniform sampler2D u_depthTexture;
|
|
|
|
in vec2 v_textureCoordinates;
|
|
|
|
void main()
|
|
{
|
|
if (texture(u_depthTexture, v_textureCoordinates).r < 1.0)
|
|
{
|
|
#ifdef MRT
|
|
out_FragData_0 = u_bgColor;
|
|
out_FragData_1 = vec4(u_bgColor.a);
|
|
#else
|
|
out_FragColor = u_bgColor;
|
|
#endif
|
|
return;
|
|
}
|
|
|
|
discard;
|
|
}
|
|
`,tC=`uniform vec3 u_radiiAndDynamicAtmosphereColor;
|
|
|
|
uniform float u_atmosphereLightIntensity;
|
|
uniform float u_atmosphereRayleighScaleHeight;
|
|
uniform float u_atmosphereMieScaleHeight;
|
|
uniform float u_atmosphereMieAnisotropy;
|
|
uniform vec3 u_atmosphereRayleighCoefficient;
|
|
uniform vec3 u_atmosphereMieCoefficient;
|
|
|
|
const float ATMOSPHERE_THICKNESS = 111e3; // The thickness of the atmosphere in meters.
|
|
const int PRIMARY_STEPS_MAX = 16; // Maximum number of times the ray from the camera to the world position (primary ray) is sampled.
|
|
const int LIGHT_STEPS_MAX = 4; // Maximum number of times the light is sampled from the light source's intersection with the atmosphere to a sample position on the primary ray.
|
|
|
|
/**
|
|
* This function computes the colors contributed by Rayliegh and Mie scattering on a given ray, as well as
|
|
* the transmittance value for the ray.
|
|
*
|
|
* @param {czm_ray} primaryRay The ray from the camera to the position.
|
|
* @param {float} primaryRayLength The length of the primary ray.
|
|
* @param {vec3} lightDirection The direction of the light to calculate the scattering from.
|
|
* @param {vec3} rayleighColor The variable the Rayleigh scattering will be written to.
|
|
* @param {vec3} mieColor The variable the Mie scattering will be written to.
|
|
* @param {float} opacity The variable the transmittance will be written to.
|
|
* @glslFunction
|
|
*/
|
|
void computeScattering(
|
|
czm_ray primaryRay,
|
|
float primaryRayLength,
|
|
vec3 lightDirection,
|
|
float atmosphereInnerRadius,
|
|
out vec3 rayleighColor,
|
|
out vec3 mieColor,
|
|
out float opacity
|
|
) {
|
|
|
|
// Initialize the default scattering amounts to 0.
|
|
rayleighColor = vec3(0.0);
|
|
mieColor = vec3(0.0);
|
|
opacity = 0.0;
|
|
|
|
float atmosphereOuterRadius = atmosphereInnerRadius + ATMOSPHERE_THICKNESS;
|
|
|
|
vec3 origin = vec3(0.0);
|
|
|
|
// Calculate intersection from the camera to the outer ring of the atmosphere.
|
|
czm_raySegment primaryRayAtmosphereIntersect = czm_raySphereIntersectionInterval(primaryRay, origin, atmosphereOuterRadius);
|
|
|
|
// Return empty colors if no intersection with the atmosphere geometry.
|
|
if (primaryRayAtmosphereIntersect == czm_emptyRaySegment) {
|
|
return;
|
|
}
|
|
|
|
// To deal with smaller values of PRIMARY_STEPS (e.g. 4)
|
|
// we implement a split strategy: sky or horizon.
|
|
// For performance reasons, instead of a if/else branch
|
|
// a soft choice is implemented through a weight 0.0 <= w_stop_gt_lprl <= 1.0
|
|
float x = 1e-7 * primaryRayAtmosphereIntersect.stop / length(primaryRayLength);
|
|
// Value close to 0.0: close to the horizon
|
|
// Value close to 1.0: above in the sky
|
|
float w_stop_gt_lprl = 0.5 * (1.0 + czm_approximateTanh(x));
|
|
|
|
// The ray should start from the first intersection with the outer atmopshere, or from the camera position, if it is inside the atmosphere.
|
|
float start_0 = primaryRayAtmosphereIntersect.start;
|
|
primaryRayAtmosphereIntersect.start = max(primaryRayAtmosphereIntersect.start, 0.0);
|
|
// The ray should end at the exit from the atmosphere or at the distance to the vertex, whichever is smaller.
|
|
primaryRayAtmosphereIntersect.stop = min(primaryRayAtmosphereIntersect.stop, length(primaryRayLength));
|
|
|
|
// For the number of ray steps, distinguish inside or outside atmosphere (outer space)
|
|
// (1) from outer space we have to use more ray steps to get a realistic rendering
|
|
// (2) within atmosphere we need fewer steps for faster rendering
|
|
float x_o_a = start_0 - ATMOSPHERE_THICKNESS; // ATMOSPHERE_THICKNESS used as an ad-hoc constant, no precise meaning here, only the order of magnitude matters
|
|
float w_inside_atmosphere = 1.0 - 0.5 * (1.0 + czm_approximateTanh(x_o_a));
|
|
int PRIMARY_STEPS = PRIMARY_STEPS_MAX - int(w_inside_atmosphere * 12.0); // Number of times the ray from the camera to the world position (primary ray) is sampled.
|
|
int LIGHT_STEPS = LIGHT_STEPS_MAX - int(w_inside_atmosphere * 2.0); // Number of times the light is sampled from the light source's intersection with the atmosphere to a sample position on the primary ray.
|
|
|
|
// Setup for sampling positions along the ray - starting from the intersection with the outer ring of the atmosphere.
|
|
float rayPositionLength = primaryRayAtmosphereIntersect.start;
|
|
// (1) Outside the atmosphere: constant rayStepLength
|
|
// (2) Inside atmosphere: variable rayStepLength to compensate the rough rendering of the smaller number of ray steps
|
|
float totalRayLength = primaryRayAtmosphereIntersect.stop - rayPositionLength;
|
|
float rayStepLengthIncrease = w_inside_atmosphere * ((1.0 - w_stop_gt_lprl) * totalRayLength / (float(PRIMARY_STEPS * (PRIMARY_STEPS + 1)) / 2.0));
|
|
float rayStepLength = max(1.0 - w_inside_atmosphere, w_stop_gt_lprl) * totalRayLength / max(7.0 * w_inside_atmosphere, float(PRIMARY_STEPS));
|
|
|
|
vec3 rayleighAccumulation = vec3(0.0);
|
|
vec3 mieAccumulation = vec3(0.0);
|
|
vec2 opticalDepth = vec2(0.0);
|
|
vec2 heightScale = vec2(u_atmosphereRayleighScaleHeight, u_atmosphereMieScaleHeight);
|
|
|
|
// Sample positions on the primary ray.
|
|
for (int i = 0; i < PRIMARY_STEPS_MAX; ++i) {
|
|
|
|
// The loop should be: for (int i = 0; i < PRIMARY_STEPS; ++i) {...} but WebGL1 cannot
|
|
// loop with non-constant condition, so it has to break early instead
|
|
if (i >= PRIMARY_STEPS) {
|
|
break;
|
|
}
|
|
|
|
// Calculate sample position along viewpoint ray.
|
|
vec3 samplePosition = primaryRay.origin + primaryRay.direction * (rayPositionLength + rayStepLength);
|
|
|
|
// Calculate height of sample position above ellipsoid.
|
|
float sampleHeight = length(samplePosition) - atmosphereInnerRadius;
|
|
|
|
// Calculate and accumulate density of particles at the sample position.
|
|
vec2 sampleDensity = exp(-sampleHeight / heightScale) * rayStepLength;
|
|
opticalDepth += sampleDensity;
|
|
|
|
// Generate ray from the sample position segment to the light source, up to the outer ring of the atmosphere.
|
|
czm_ray lightRay = czm_ray(samplePosition, lightDirection);
|
|
czm_raySegment lightRayAtmosphereIntersect = czm_raySphereIntersectionInterval(lightRay, origin, atmosphereOuterRadius);
|
|
|
|
float lightStepLength = lightRayAtmosphereIntersect.stop / float(LIGHT_STEPS);
|
|
float lightPositionLength = 0.0;
|
|
|
|
vec2 lightOpticalDepth = vec2(0.0);
|
|
|
|
// Sample positions along the light ray, to accumulate incidence of light on the latest sample segment.
|
|
for (int j = 0; j < LIGHT_STEPS_MAX; ++j) {
|
|
|
|
// The loop should be: for (int j = 0; i < LIGHT_STEPS; ++j) {...} but WebGL1 cannot
|
|
// loop with non-constant condition, so it has to break early instead
|
|
if (j >= LIGHT_STEPS) {
|
|
break;
|
|
}
|
|
|
|
// Calculate sample position along light ray.
|
|
vec3 lightPosition = samplePosition + lightDirection * (lightPositionLength + lightStepLength * 0.5);
|
|
|
|
// Calculate height of the light sample position above ellipsoid.
|
|
float lightHeight = length(lightPosition) - atmosphereInnerRadius;
|
|
|
|
// Calculate density of photons at the light sample position.
|
|
lightOpticalDepth += exp(-lightHeight / heightScale) * lightStepLength;
|
|
|
|
// Increment distance on light ray.
|
|
lightPositionLength += lightStepLength;
|
|
}
|
|
|
|
// Compute attenuation via the primary ray and the light ray.
|
|
vec3 attenuation = exp(-((u_atmosphereMieCoefficient * (opticalDepth.y + lightOpticalDepth.y)) + (u_atmosphereRayleighCoefficient * (opticalDepth.x + lightOpticalDepth.x))));
|
|
|
|
// Accumulate the scattering.
|
|
rayleighAccumulation += sampleDensity.x * attenuation;
|
|
mieAccumulation += sampleDensity.y * attenuation;
|
|
|
|
// Increment distance on primary ray.
|
|
rayPositionLength += (rayStepLength += rayStepLengthIncrease);
|
|
}
|
|
|
|
// Compute the scattering amount.
|
|
rayleighColor = u_atmosphereRayleighCoefficient * rayleighAccumulation;
|
|
mieColor = u_atmosphereMieCoefficient * mieAccumulation;
|
|
|
|
// Compute the transmittance i.e. how much light is passing through the atmosphere.
|
|
opacity = length(exp(-((u_atmosphereMieCoefficient * opticalDepth.y) + (u_atmosphereRayleighCoefficient * opticalDepth.x))));
|
|
}
|
|
|
|
vec4 computeAtmosphereColor(
|
|
vec3 positionWC,
|
|
vec3 lightDirection,
|
|
vec3 rayleighColor,
|
|
vec3 mieColor,
|
|
float opacity
|
|
) {
|
|
// Setup the primary ray: from the camera position to the vertex position.
|
|
vec3 cameraToPositionWC = positionWC - czm_viewerPositionWC;
|
|
vec3 cameraToPositionWCDirection = normalize(cameraToPositionWC);
|
|
|
|
float cosAngle = dot(cameraToPositionWCDirection, lightDirection);
|
|
float cosAngleSq = cosAngle * cosAngle;
|
|
|
|
float G = u_atmosphereMieAnisotropy;
|
|
float GSq = G * G;
|
|
|
|
// The Rayleigh phase function.
|
|
float rayleighPhase = 3.0 / (50.2654824574) * (1.0 + cosAngleSq);
|
|
// The Mie phase function.
|
|
float miePhase = 3.0 / (25.1327412287) * ((1.0 - GSq) * (cosAngleSq + 1.0)) / (pow(1.0 + GSq - 2.0 * cosAngle * G, 1.5) * (2.0 + GSq));
|
|
|
|
// The final color is generated by combining the effects of the Rayleigh and Mie scattering.
|
|
vec3 rayleigh = rayleighPhase * rayleighColor;
|
|
vec3 mie = miePhase * mieColor;
|
|
|
|
vec3 color = (rayleigh + mie) * u_atmosphereLightIntensity;
|
|
|
|
return vec4(color, opacity);
|
|
}
|
|
`,v1e=`in vec2 v_textureCoordinates;
|
|
const float M_PI = 3.141592653589793;
|
|
|
|
float vdcRadicalInverse(int i)
|
|
{
|
|
float r;
|
|
float base = 2.0;
|
|
float value = 0.0;
|
|
float invBase = 1.0 / base;
|
|
float invBi = invBase;
|
|
for (int x = 0; x < 100; x++)
|
|
{
|
|
if (i <= 0)
|
|
{
|
|
break;
|
|
}
|
|
r = mod(float(i), base);
|
|
value += r * invBi;
|
|
invBi *= invBase;
|
|
i = int(float(i) * invBase);
|
|
}
|
|
return value;
|
|
}
|
|
|
|
vec2 hammersley2D(int i, int N)
|
|
{
|
|
return vec2(float(i) / float(N), vdcRadicalInverse(i));
|
|
}
|
|
|
|
vec3 importanceSampleGGX(vec2 xi, float roughness, vec3 N)
|
|
{
|
|
float a = roughness * roughness;
|
|
float phi = 2.0 * M_PI * xi.x;
|
|
float cosTheta = sqrt((1.0 - xi.y) / (1.0 + (a * a - 1.0) * xi.y));
|
|
float sinTheta = sqrt(1.0 - cosTheta * cosTheta);
|
|
vec3 H = vec3(sinTheta * cos(phi), sinTheta * sin(phi), cosTheta);
|
|
vec3 upVector = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
|
|
vec3 tangentX = normalize(cross(upVector, N));
|
|
vec3 tangentY = cross(N, tangentX);
|
|
return tangentX * H.x + tangentY * H.y + N * H.z;
|
|
}
|
|
|
|
float G1_Smith(float NdotV, float k)
|
|
{
|
|
return NdotV / (NdotV * (1.0 - k) + k);
|
|
}
|
|
|
|
float G_Smith(float roughness, float NdotV, float NdotL)
|
|
{
|
|
float k = roughness * roughness / 2.0;
|
|
return G1_Smith(NdotV, k) * G1_Smith(NdotL, k);
|
|
}
|
|
|
|
vec2 integrateBrdf(float roughness, float NdotV)
|
|
{
|
|
vec3 V = vec3(sqrt(1.0 - NdotV * NdotV), 0.0, NdotV);
|
|
float A = 0.0;
|
|
float B = 0.0;
|
|
const int NumSamples = 1024;
|
|
for (int i = 0; i < NumSamples; i++)
|
|
{
|
|
vec2 xi = hammersley2D(i, NumSamples);
|
|
vec3 H = importanceSampleGGX(xi, roughness, vec3(0.0, 0.0, 1.0));
|
|
vec3 L = 2.0 * dot(V, H) * H - V;
|
|
float NdotL = clamp(L.z, 0.0, 1.0);
|
|
float NdotH = clamp(H.z, 0.0, 1.0);
|
|
float VdotH = clamp(dot(V, H), 0.0, 1.0);
|
|
if (NdotL > 0.0)
|
|
{
|
|
float G = G_Smith(roughness, NdotV, NdotL);
|
|
float G_Vis = G * VdotH / (NdotH * NdotV);
|
|
float Fc = pow(1.0 - VdotH, 5.0);
|
|
A += (1.0 - Fc) * G_Vis;
|
|
B += Fc * G_Vis;
|
|
}
|
|
}
|
|
return vec2(A, B) / float(NumSamples);
|
|
}
|
|
|
|
void main()
|
|
{
|
|
out_FragColor = vec4(integrateBrdf(v_textureCoordinates.y, v_textureCoordinates.x), 0.0, 1.0);
|
|
}
|
|
`,I1e=`uniform sampler2D u_opaqueDepthTexture;
|
|
uniform sampler2D u_translucentDepthTexture;
|
|
|
|
in vec2 v_textureCoordinates;
|
|
|
|
void main()
|
|
{
|
|
float opaqueDepth = texture(u_opaqueDepthTexture, v_textureCoordinates).r;
|
|
float translucentDepth = texture(u_translucentDepthTexture, v_textureCoordinates).r;
|
|
translucentDepth = czm_branchFreeTernary(translucentDepth > opaqueDepth, 1.0, translucentDepth);
|
|
out_FragColor = czm_packDepth(translucentDepth);
|
|
}
|
|
`,D1e=`/**
|
|
* Compositing for Weighted Blended Order-Independent Transparency. See:
|
|
* - http://jcgt.org/published/0002/02/09/
|
|
* - http://casual-effects.blogspot.com/2014/03/weighted-blended-order-independent.html
|
|
*/
|
|
|
|
uniform sampler2D u_opaque;
|
|
uniform sampler2D u_accumulation;
|
|
uniform sampler2D u_revealage;
|
|
|
|
in vec2 v_textureCoordinates;
|
|
|
|
void main()
|
|
{
|
|
vec4 opaque = texture(u_opaque, v_textureCoordinates);
|
|
vec4 accum = texture(u_accumulation, v_textureCoordinates);
|
|
float r = texture(u_revealage, v_textureCoordinates).r;
|
|
|
|
#ifdef MRT
|
|
vec4 transparent = vec4(accum.rgb / clamp(r, 1e-4, 5e4), accum.a);
|
|
#else
|
|
vec4 transparent = vec4(accum.rgb / clamp(accum.a, 1e-4, 5e4), r);
|
|
#endif
|
|
|
|
out_FragColor = (1.0 - transparent.a) * transparent + transparent.a * opaque;
|
|
|
|
if (opaque != czm_backgroundColor)
|
|
{
|
|
out_FragColor.a = 1.0;
|
|
}
|
|
}
|
|
`,P1e=`in vec4 positionEC;
|
|
|
|
void main()
|
|
{
|
|
vec3 position;
|
|
vec3 direction;
|
|
if (czm_orthographicIn3D == 1.0)
|
|
{
|
|
vec2 uv = (gl_FragCoord.xy - czm_viewport.xy) / czm_viewport.zw;
|
|
vec2 minPlane = vec2(czm_frustumPlanes.z, czm_frustumPlanes.y); // left, bottom
|
|
vec2 maxPlane = vec2(czm_frustumPlanes.w, czm_frustumPlanes.x); // right, top
|
|
position = vec3(mix(minPlane, maxPlane, uv), 0.0);
|
|
direction = vec3(0.0, 0.0, -1.0);
|
|
}
|
|
else
|
|
{
|
|
position = vec3(0.0);
|
|
direction = normalize(positionEC.xyz);
|
|
}
|
|
|
|
czm_ray ray = czm_ray(position, direction);
|
|
|
|
vec3 ellipsoid_center = czm_view[3].xyz;
|
|
|
|
czm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoid_center, czm_ellipsoidInverseRadii);
|
|
if (!czm_isEmpty(intersection))
|
|
{
|
|
out_FragColor = vec4(1.0, 1.0, 0.0, 1.0);
|
|
}
|
|
else
|
|
{
|
|
discard;
|
|
}
|
|
|
|
czm_writeLogDepth();
|
|
}
|
|
`,O1e=`in vec4 position;
|
|
|
|
out vec4 positionEC;
|
|
|
|
void main()
|
|
{
|
|
positionEC = czm_modelView * position;
|
|
gl_Position = czm_projection * positionEC;
|
|
|
|
czm_vertexLogDepth();
|
|
}
|
|
`,vB=`uniform vec3 u_radii;
|
|
uniform vec3 u_oneOverEllipsoidRadiiSquared;
|
|
|
|
in vec3 v_positionEC;
|
|
|
|
vec4 computeEllipsoidColor(czm_ray ray, float intersection, float side)
|
|
{
|
|
vec3 positionEC = czm_pointAlongRay(ray, intersection);
|
|
vec3 positionMC = (czm_inverseModelView * vec4(positionEC, 1.0)).xyz;
|
|
vec3 geodeticNormal = normalize(czm_geodeticSurfaceNormal(positionMC, vec3(0.0), u_oneOverEllipsoidRadiiSquared));
|
|
vec3 sphericalNormal = normalize(positionMC / u_radii);
|
|
vec3 normalMC = geodeticNormal * side; // normalized surface normal (always facing the viewer) in model coordinates
|
|
vec3 normalEC = normalize(czm_normal * normalMC); // normalized surface normal in eye coordinates
|
|
|
|
vec2 st = czm_ellipsoidWgs84TextureCoordinates(sphericalNormal);
|
|
vec3 positionToEyeEC = -positionEC;
|
|
|
|
czm_materialInput materialInput;
|
|
materialInput.s = st.s;
|
|
materialInput.st = st;
|
|
materialInput.str = (positionMC + u_radii) / u_radii;
|
|
materialInput.normalEC = normalEC;
|
|
materialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(positionMC, normalEC);
|
|
materialInput.positionToEyeEC = positionToEyeEC;
|
|
czm_material material = czm_getMaterial(materialInput);
|
|
|
|
#ifdef ONLY_SUN_LIGHTING
|
|
return czm_private_phong(normalize(positionToEyeEC), material, czm_sunDirectionEC);
|
|
#else
|
|
return czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);
|
|
#endif
|
|
}
|
|
|
|
void main()
|
|
{
|
|
// PERFORMANCE_TODO: When dynamic branching is available, compute ratio of maximum and minimum radii
|
|
// in the vertex shader. Only when it is larger than some constant, march along the ray.
|
|
// Otherwise perform one intersection test which will be the common case.
|
|
|
|
// Test if the ray intersects a sphere with the ellipsoid's maximum radius.
|
|
// For very oblate ellipsoids, using the ellipsoid's radii for an intersection test
|
|
// may cause false negatives. This will discard fragments before marching the ray forward.
|
|
float maxRadius = max(u_radii.x, max(u_radii.y, u_radii.z)) * 1.5;
|
|
vec3 direction = normalize(v_positionEC);
|
|
vec3 ellipsoidCenter = czm_modelView[3].xyz;
|
|
|
|
float t1 = -1.0;
|
|
float t2 = -1.0;
|
|
|
|
float b = -2.0 * dot(direction, ellipsoidCenter);
|
|
float c = dot(ellipsoidCenter, ellipsoidCenter) - maxRadius * maxRadius;
|
|
|
|
float discriminant = b * b - 4.0 * c;
|
|
if (discriminant >= 0.0) {
|
|
t1 = (-b - sqrt(discriminant)) * 0.5;
|
|
t2 = (-b + sqrt(discriminant)) * 0.5;
|
|
}
|
|
|
|
if (t1 < 0.0 && t2 < 0.0) {
|
|
discard;
|
|
}
|
|
|
|
float t = min(t1, t2);
|
|
if (t < 0.0) {
|
|
t = 0.0;
|
|
}
|
|
|
|
// March ray forward to intersection with larger sphere and find
|
|
czm_ray ray = czm_ray(t * direction, direction);
|
|
|
|
vec3 ellipsoid_inverseRadii = vec3(1.0 / u_radii.x, 1.0 / u_radii.y, 1.0 / u_radii.z);
|
|
|
|
czm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoidCenter, ellipsoid_inverseRadii);
|
|
|
|
if (czm_isEmpty(intersection))
|
|
{
|
|
discard;
|
|
}
|
|
|
|
// If the viewer is outside, compute outsideFaceColor, with normals facing outward.
|
|
vec4 outsideFaceColor = (intersection.start != 0.0) ? computeEllipsoidColor(ray, intersection.start, 1.0) : vec4(0.0);
|
|
|
|
// If the viewer either is inside or can see inside, compute insideFaceColor, with normals facing inward.
|
|
vec4 insideFaceColor = (outsideFaceColor.a < 1.0) ? computeEllipsoidColor(ray, intersection.stop, -1.0) : vec4(0.0);
|
|
|
|
out_FragColor = mix(insideFaceColor, outsideFaceColor, outsideFaceColor.a);
|
|
out_FragColor.a = 1.0 - (1.0 - insideFaceColor.a) * (1.0 - outsideFaceColor.a);
|
|
|
|
#if (defined(WRITE_DEPTH) && (__VERSION__ == 300 || defined(GL_EXT_frag_depth)))
|
|
t = (intersection.start != 0.0) ? intersection.start : intersection.stop;
|
|
vec3 positionEC = czm_pointAlongRay(ray, t);
|
|
vec4 positionCC = czm_projection * vec4(positionEC, 1.0);
|
|
#ifdef LOG_DEPTH
|
|
czm_writeLogDepth(1.0 + positionCC.w);
|
|
#else
|
|
float z = positionCC.z / positionCC.w;
|
|
|
|
float n = czm_depthRange.near;
|
|
float f = czm_depthRange.far;
|
|
|
|
gl_FragDepth = (z * (f - n) + f + n) * 0.5;
|
|
#endif
|
|
#endif
|
|
}
|
|
`,IB=`in vec3 position;
|
|
|
|
uniform vec3 u_radii;
|
|
|
|
out vec3 v_positionEC;
|
|
|
|
void main()
|
|
{
|
|
// In the vertex data, the cube goes from (-1.0, -1.0, -1.0) to (1.0, 1.0, 1.0) in model coordinates.
|
|
// Scale to consider the radii. We could also do this once on the CPU when using the BoxGeometry,
|
|
// but doing it here allows us to change the radii without rewriting the vertex data, and
|
|
// allows all ellipsoids to reuse the same vertex data.
|
|
vec4 p = vec4(u_radii * position, 1.0);
|
|
|
|
v_positionEC = (czm_modelView * p).xyz; // position in eye coordinates
|
|
gl_Position = czm_modelViewProjection * p; // position in clip coordinates
|
|
|
|
// With multi-frustum, when the ellipsoid primitive is positioned on the intersection of two frustums
|
|
// and close to terrain, the terrain (writes depth) in the closest frustum can overwrite part of the
|
|
// ellipsoid (does not write depth) that was rendered in the farther frustum.
|
|
//
|
|
// Here, we clamp the depth in the vertex shader to avoid being overwritten; however, this creates
|
|
// artifacts since some fragments can be alpha blended twice. This is solved by only rendering
|
|
// the ellipsoid in the closest frustum to the viewer.
|
|
gl_Position.z = clamp(gl_Position.z, czm_depthRange.near, czm_depthRange.far);
|
|
|
|
czm_vertexLogDepth();
|
|
}
|
|
`;/**
|
|
* @license
|
|
* Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.
|
|
*
|
|
* Redistribution and use in source and binary forms, with or without
|
|
* modification, are permitted provided that the following conditions
|
|
* are met:
|
|
* * Redistributions of source code must retain the above copyright
|
|
* notice, this list of conditions and the following disclaimer.
|
|
* * Redistributions in binary form must reproduce the above copyright
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
* documentation and/or other materials provided with the distribution.
|
|
* * Neither the name of NVIDIA CORPORATION nor the names of its
|
|
* contributors may be used to endorse or promote products derived
|
|
* from this software without specific prior written permission.
|
|
*
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
|
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
|
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
*/const L1e=`/**
|
|
* @license
|
|
* Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.
|
|
*
|
|
* Redistribution and use in source and binary forms, with or without
|
|
* modification, are permitted provided that the following conditions
|
|
* are met:
|
|
* * Redistributions of source code must retain the above copyright
|
|
* notice, this list of conditions and the following disclaimer.
|
|
* * Redistributions in binary form must reproduce the above copyright
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
* documentation and/or other materials provided with the distribution.
|
|
* * Neither the name of NVIDIA CORPORATION nor the names of its
|
|
* contributors may be used to endorse or promote products derived
|
|
* from this software without specific prior written permission.
|
|
*
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS \`\`AS IS'' AND ANY
|
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
|
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
*/
|
|
|
|
// NVIDIA GameWorks Graphics Samples GitHub link: https://github.com/NVIDIAGameWorks/GraphicsSamples
|
|
// Original FXAA 3.11 shader link: https://github.com/NVIDIAGameWorks/GraphicsSamples/blob/master/samples/es3-kepler/FXAA/FXAA3_11.h
|
|
|
|
// Steps used to integrate into Cesium:
|
|
// * The following defines are set:
|
|
// #define FXAA_PC 1
|
|
// #define FXAA_WEBGL_1 1
|
|
// #define FXAA_GREEN_AS_LUMA 1
|
|
// #define FXAA_EARLY_EXIT 1
|
|
// #define FXAA_GLSL_120 1
|
|
// * All other preprocessor directives besides the FXAA_QUALITY__P* directives were removed.
|
|
// * Double underscores are invalid for preprocessor directives so replace them with a single underscore. Replace
|
|
// /FXAA_QUALITY__P(.*)/g with /FXAA_QUALITY__P$1/.
|
|
// * There are no implicit conversions from ivec* to vec* so replace:
|
|
// #define FxaaInt2 ivec2
|
|
// with
|
|
// #define FxaaInt2 vec2
|
|
// * The texture2DLod function is only available in vertex shaders so replace:
|
|
// #define FxaaTexTop(t, p) texture2DLod(t, p, 0.0)
|
|
// #define FxaaTexOff(t, p, o, r) texture2DLod(t, p + (o * r), 0.0)
|
|
// with
|
|
// #define FxaaTexTop(t, p) texture(t, p)
|
|
// #define FxaaTexOff(t, p, o, r) texture(t, p + (o * r))
|
|
// * FXAA_QUALITY_PRESET is prepended in the javascript code. We may want to expose that setting in the future.
|
|
// * The following parameters to FxaaPixelShader are unused and can be removed:
|
|
// fxaaConsolePosPos
|
|
// fxaaConsoleRcpFrameOpt
|
|
// fxaaConsoleRcpFrameOpt2
|
|
// fxaaConsole360RcpFrameOpt2
|
|
// fxaaConsoleEdgeSharpness
|
|
// fxaaConsoleEdgeThreshold
|
|
// fxaaConsoleEdgeThresholdMi
|
|
// fxaaConsole360ConstDir
|
|
|
|
//
|
|
// Choose the quality preset.
|
|
// This needs to be compiled into the shader as it effects code.
|
|
// Best option to include multiple presets is to
|
|
// in each shader define the preset, then include this file.
|
|
//
|
|
// OPTIONS
|
|
// -----------------------------------------------------------------------
|
|
// 10 to 15 - default medium dither (10=fastest, 15=highest quality)
|
|
// 20 to 29 - less dither, more expensive (20=fastest, 29=highest quality)
|
|
// 39 - no dither, very expensive
|
|
//
|
|
// NOTES
|
|
// -----------------------------------------------------------------------
|
|
// 12 = slightly faster then FXAA 3.9 and higher edge quality (default)
|
|
// 13 = about same speed as FXAA 3.9 and better than 12
|
|
// 23 = closest to FXAA 3.9 visually and performance wise
|
|
// _ = the lowest digit is directly related to performance
|
|
// _ = the highest digit is directly related to style
|
|
//
|
|
//#define FXAA_QUALITY_PRESET 12
|
|
|
|
|
|
#if (FXAA_QUALITY_PRESET == 10)
|
|
#define FXAA_QUALITY_PS 3
|
|
#define FXAA_QUALITY_P0 1.5
|
|
#define FXAA_QUALITY_P1 3.0
|
|
#define FXAA_QUALITY_P2 12.0
|
|
#endif
|
|
#if (FXAA_QUALITY_PRESET == 11)
|
|
#define FXAA_QUALITY_PS 4
|
|
#define FXAA_QUALITY_P0 1.0
|
|
#define FXAA_QUALITY_P1 1.5
|
|
#define FXAA_QUALITY_P2 3.0
|
|
#define FXAA_QUALITY_P3 12.0
|
|
#endif
|
|
#if (FXAA_QUALITY_PRESET == 12)
|
|
#define FXAA_QUALITY_PS 5
|
|
#define FXAA_QUALITY_P0 1.0
|
|
#define FXAA_QUALITY_P1 1.5
|
|
#define FXAA_QUALITY_P2 2.0
|
|
#define FXAA_QUALITY_P3 4.0
|
|
#define FXAA_QUALITY_P4 12.0
|
|
#endif
|
|
#if (FXAA_QUALITY_PRESET == 13)
|
|
#define FXAA_QUALITY_PS 6
|
|
#define FXAA_QUALITY_P0 1.0
|
|
#define FXAA_QUALITY_P1 1.5
|
|
#define FXAA_QUALITY_P2 2.0
|
|
#define FXAA_QUALITY_P3 2.0
|
|
#define FXAA_QUALITY_P4 4.0
|
|
#define FXAA_QUALITY_P5 12.0
|
|
#endif
|
|
#if (FXAA_QUALITY_PRESET == 14)
|
|
#define FXAA_QUALITY_PS 7
|
|
#define FXAA_QUALITY_P0 1.0
|
|
#define FXAA_QUALITY_P1 1.5
|
|
#define FXAA_QUALITY_P2 2.0
|
|
#define FXAA_QUALITY_P3 2.0
|
|
#define FXAA_QUALITY_P4 2.0
|
|
#define FXAA_QUALITY_P5 4.0
|
|
#define FXAA_QUALITY_P6 12.0
|
|
#endif
|
|
#if (FXAA_QUALITY_PRESET == 15)
|
|
#define FXAA_QUALITY_PS 8
|
|
#define FXAA_QUALITY_P0 1.0
|
|
#define FXAA_QUALITY_P1 1.5
|
|
#define FXAA_QUALITY_P2 2.0
|
|
#define FXAA_QUALITY_P3 2.0
|
|
#define FXAA_QUALITY_P4 2.0
|
|
#define FXAA_QUALITY_P5 2.0
|
|
#define FXAA_QUALITY_P6 4.0
|
|
#define FXAA_QUALITY_P7 12.0
|
|
#endif
|
|
#if (FXAA_QUALITY_PRESET == 20)
|
|
#define FXAA_QUALITY_PS 3
|
|
#define FXAA_QUALITY_P0 1.5
|
|
#define FXAA_QUALITY_P1 2.0
|
|
#define FXAA_QUALITY_P2 8.0
|
|
#endif
|
|
#if (FXAA_QUALITY_PRESET == 21)
|
|
#define FXAA_QUALITY_PS 4
|
|
#define FXAA_QUALITY_P0 1.0
|
|
#define FXAA_QUALITY_P1 1.5
|
|
#define FXAA_QUALITY_P2 2.0
|
|
#define FXAA_QUALITY_P3 8.0
|
|
#endif
|
|
#if (FXAA_QUALITY_PRESET == 22)
|
|
#define FXAA_QUALITY_PS 5
|
|
#define FXAA_QUALITY_P0 1.0
|
|
#define FXAA_QUALITY_P1 1.5
|
|
#define FXAA_QUALITY_P2 2.0
|
|
#define FXAA_QUALITY_P3 2.0
|
|
#define FXAA_QUALITY_P4 8.0
|
|
#endif
|
|
#if (FXAA_QUALITY_PRESET == 23)
|
|
#define FXAA_QUALITY_PS 6
|
|
#define FXAA_QUALITY_P0 1.0
|
|
#define FXAA_QUALITY_P1 1.5
|
|
#define FXAA_QUALITY_P2 2.0
|
|
#define FXAA_QUALITY_P3 2.0
|
|
#define FXAA_QUALITY_P4 2.0
|
|
#define FXAA_QUALITY_P5 8.0
|
|
#endif
|
|
#if (FXAA_QUALITY_PRESET == 24)
|
|
#define FXAA_QUALITY_PS 7
|
|
#define FXAA_QUALITY_P0 1.0
|
|
#define FXAA_QUALITY_P1 1.5
|
|
#define FXAA_QUALITY_P2 2.0
|
|
#define FXAA_QUALITY_P3 2.0
|
|
#define FXAA_QUALITY_P4 2.0
|
|
#define FXAA_QUALITY_P5 3.0
|
|
#define FXAA_QUALITY_P6 8.0
|
|
#endif
|
|
#if (FXAA_QUALITY_PRESET == 25)
|
|
#define FXAA_QUALITY_PS 8
|
|
#define FXAA_QUALITY_P0 1.0
|
|
#define FXAA_QUALITY_P1 1.5
|
|
#define FXAA_QUALITY_P2 2.0
|
|
#define FXAA_QUALITY_P3 2.0
|
|
#define FXAA_QUALITY_P4 2.0
|
|
#define FXAA_QUALITY_P5 2.0
|
|
#define FXAA_QUALITY_P6 4.0
|
|
#define FXAA_QUALITY_P7 8.0
|
|
#endif
|
|
#if (FXAA_QUALITY_PRESET == 26)
|
|
#define FXAA_QUALITY_PS 9
|
|
#define FXAA_QUALITY_P0 1.0
|
|
#define FXAA_QUALITY_P1 1.5
|
|
#define FXAA_QUALITY_P2 2.0
|
|
#define FXAA_QUALITY_P3 2.0
|
|
#define FXAA_QUALITY_P4 2.0
|
|
#define FXAA_QUALITY_P5 2.0
|
|
#define FXAA_QUALITY_P6 2.0
|
|
#define FXAA_QUALITY_P7 4.0
|
|
#define FXAA_QUALITY_P8 8.0
|
|
#endif
|
|
#if (FXAA_QUALITY_PRESET == 27)
|
|
#define FXAA_QUALITY_PS 10
|
|
#define FXAA_QUALITY_P0 1.0
|
|
#define FXAA_QUALITY_P1 1.5
|
|
#define FXAA_QUALITY_P2 2.0
|
|
#define FXAA_QUALITY_P3 2.0
|
|
#define FXAA_QUALITY_P4 2.0
|
|
#define FXAA_QUALITY_P5 2.0
|
|
#define FXAA_QUALITY_P6 2.0
|
|
#define FXAA_QUALITY_P7 2.0
|
|
#define FXAA_QUALITY_P8 4.0
|
|
#define FXAA_QUALITY_P9 8.0
|
|
#endif
|
|
#if (FXAA_QUALITY_PRESET == 28)
|
|
#define FXAA_QUALITY_PS 11
|
|
#define FXAA_QUALITY_P0 1.0
|
|
#define FXAA_QUALITY_P1 1.5
|
|
#define FXAA_QUALITY_P2 2.0
|
|
#define FXAA_QUALITY_P3 2.0
|
|
#define FXAA_QUALITY_P4 2.0
|
|
#define FXAA_QUALITY_P5 2.0
|
|
#define FXAA_QUALITY_P6 2.0
|
|
#define FXAA_QUALITY_P7 2.0
|
|
#define FXAA_QUALITY_P8 2.0
|
|
#define FXAA_QUALITY_P9 4.0
|
|
#define FXAA_QUALITY_P10 8.0
|
|
#endif
|
|
#if (FXAA_QUALITY_PRESET == 29)
|
|
#define FXAA_QUALITY_PS 12
|
|
#define FXAA_QUALITY_P0 1.0
|
|
#define FXAA_QUALITY_P1 1.5
|
|
#define FXAA_QUALITY_P2 2.0
|
|
#define FXAA_QUALITY_P3 2.0
|
|
#define FXAA_QUALITY_P4 2.0
|
|
#define FXAA_QUALITY_P5 2.0
|
|
#define FXAA_QUALITY_P6 2.0
|
|
#define FXAA_QUALITY_P7 2.0
|
|
#define FXAA_QUALITY_P8 2.0
|
|
#define FXAA_QUALITY_P9 2.0
|
|
#define FXAA_QUALITY_P10 4.0
|
|
#define FXAA_QUALITY_P11 8.0
|
|
#endif
|
|
#if (FXAA_QUALITY_PRESET == 39)
|
|
#define FXAA_QUALITY_PS 12
|
|
#define FXAA_QUALITY_P0 1.0
|
|
#define FXAA_QUALITY_P1 1.0
|
|
#define FXAA_QUALITY_P2 1.0
|
|
#define FXAA_QUALITY_P3 1.0
|
|
#define FXAA_QUALITY_P4 1.0
|
|
#define FXAA_QUALITY_P5 1.5
|
|
#define FXAA_QUALITY_P6 2.0
|
|
#define FXAA_QUALITY_P7 2.0
|
|
#define FXAA_QUALITY_P8 2.0
|
|
#define FXAA_QUALITY_P9 2.0
|
|
#define FXAA_QUALITY_P10 4.0
|
|
#define FXAA_QUALITY_P11 8.0
|
|
#endif
|
|
|
|
#define FxaaBool bool
|
|
#define FxaaFloat float
|
|
#define FxaaFloat2 vec2
|
|
#define FxaaFloat3 vec3
|
|
#define FxaaFloat4 vec4
|
|
#define FxaaHalf float
|
|
#define FxaaHalf2 vec2
|
|
#define FxaaHalf3 vec3
|
|
#define FxaaHalf4 vec4
|
|
#define FxaaInt2 vec2
|
|
#define FxaaTex sampler2D
|
|
|
|
#define FxaaSat(x) clamp(x, 0.0, 1.0)
|
|
#define FxaaTexTop(t, p) texture(t, p)
|
|
#define FxaaTexOff(t, p, o, r) texture(t, p + (o * r))
|
|
|
|
FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.y; }
|
|
|
|
FxaaFloat4 FxaaPixelShader(
|
|
//
|
|
// Use noperspective interpolation here (turn off perspective interpolation).
|
|
// {xy} = center of pixel
|
|
FxaaFloat2 pos,
|
|
//
|
|
// Input color texture.
|
|
// {rgb_} = color in linear or perceptual color space
|
|
// if (FXAA_GREEN_AS_LUMA == 0)
|
|
// {___a} = luma in perceptual color space (not linear)
|
|
FxaaTex tex,
|
|
//
|
|
// Only used on FXAA Quality.
|
|
// This must be from a constant/uniform.
|
|
// {x_} = 1.0/screenWidthInPixels
|
|
// {_y} = 1.0/screenHeightInPixels
|
|
FxaaFloat2 fxaaQualityRcpFrame,
|
|
//
|
|
// Only used on FXAA Quality.
|
|
// This used to be the FXAA_QUALITY_SUBPIX define.
|
|
// It is here now to allow easier tuning.
|
|
// Choose the amount of sub-pixel aliasing removal.
|
|
// This can effect sharpness.
|
|
// 1.00 - upper limit (softer)
|
|
// 0.75 - default amount of filtering
|
|
// 0.50 - lower limit (sharper, less sub-pixel aliasing removal)
|
|
// 0.25 - almost off
|
|
// 0.00 - completely off
|
|
FxaaFloat fxaaQualitySubpix,
|
|
//
|
|
// Only used on FXAA Quality.
|
|
// This used to be the FXAA_QUALITY_EDGE_THRESHOLD define.
|
|
// It is here now to allow easier tuning.
|
|
// The minimum amount of local contrast required to apply algorithm.
|
|
// 0.333 - too little (faster)
|
|
// 0.250 - low quality
|
|
// 0.166 - default
|
|
// 0.125 - high quality
|
|
// 0.063 - overkill (slower)
|
|
FxaaFloat fxaaQualityEdgeThreshold,
|
|
//
|
|
// Only used on FXAA Quality.
|
|
// This used to be the FXAA_QUALITY_EDGE_THRESHOLD_MIN define.
|
|
// It is here now to allow easier tuning.
|
|
// Trims the algorithm from processing darks.
|
|
// 0.0833 - upper limit (default, the start of visible unfiltered edges)
|
|
// 0.0625 - high quality (faster)
|
|
// 0.0312 - visible limit (slower)
|
|
// Special notes when using FXAA_GREEN_AS_LUMA,
|
|
// Likely want to set this to zero.
|
|
// As colors that are mostly not-green
|
|
// will appear very dark in the green channel!
|
|
// Tune by looking at mostly non-green content,
|
|
// then start at zero and increase until aliasing is a problem.
|
|
FxaaFloat fxaaQualityEdgeThresholdMin
|
|
) {
|
|
/*--------------------------------------------------------------------------*/
|
|
FxaaFloat2 posM;
|
|
posM.x = pos.x;
|
|
posM.y = pos.y;
|
|
FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);
|
|
#define lumaM rgbyM.y
|
|
FxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0, 1), fxaaQualityRcpFrame.xy));
|
|
FxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 0), fxaaQualityRcpFrame.xy));
|
|
FxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0,-1), fxaaQualityRcpFrame.xy));
|
|
FxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 0), fxaaQualityRcpFrame.xy));
|
|
/*--------------------------------------------------------------------------*/
|
|
FxaaFloat maxSM = max(lumaS, lumaM);
|
|
FxaaFloat minSM = min(lumaS, lumaM);
|
|
FxaaFloat maxESM = max(lumaE, maxSM);
|
|
FxaaFloat minESM = min(lumaE, minSM);
|
|
FxaaFloat maxWN = max(lumaN, lumaW);
|
|
FxaaFloat minWN = min(lumaN, lumaW);
|
|
FxaaFloat rangeMax = max(maxWN, maxESM);
|
|
FxaaFloat rangeMin = min(minWN, minESM);
|
|
FxaaFloat rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold;
|
|
FxaaFloat range = rangeMax - rangeMin;
|
|
FxaaFloat rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled);
|
|
FxaaBool earlyExit = range < rangeMaxClamped;
|
|
/*--------------------------------------------------------------------------*/
|
|
if(earlyExit)
|
|
return rgbyM;
|
|
/*--------------------------------------------------------------------------*/
|
|
FxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1,-1), fxaaQualityRcpFrame.xy));
|
|
FxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 1), fxaaQualityRcpFrame.xy));
|
|
FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1,-1), fxaaQualityRcpFrame.xy));
|
|
FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));
|
|
/*--------------------------------------------------------------------------*/
|
|
FxaaFloat lumaNS = lumaN + lumaS;
|
|
FxaaFloat lumaWE = lumaW + lumaE;
|
|
FxaaFloat subpixRcpRange = 1.0/range;
|
|
FxaaFloat subpixNSWE = lumaNS + lumaWE;
|
|
FxaaFloat edgeHorz1 = (-2.0 * lumaM) + lumaNS;
|
|
FxaaFloat edgeVert1 = (-2.0 * lumaM) + lumaWE;
|
|
/*--------------------------------------------------------------------------*/
|
|
FxaaFloat lumaNESE = lumaNE + lumaSE;
|
|
FxaaFloat lumaNWNE = lumaNW + lumaNE;
|
|
FxaaFloat edgeHorz2 = (-2.0 * lumaE) + lumaNESE;
|
|
FxaaFloat edgeVert2 = (-2.0 * lumaN) + lumaNWNE;
|
|
/*--------------------------------------------------------------------------*/
|
|
FxaaFloat lumaNWSW = lumaNW + lumaSW;
|
|
FxaaFloat lumaSWSE = lumaSW + lumaSE;
|
|
FxaaFloat edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2);
|
|
FxaaFloat edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2);
|
|
FxaaFloat edgeHorz3 = (-2.0 * lumaW) + lumaNWSW;
|
|
FxaaFloat edgeVert3 = (-2.0 * lumaS) + lumaSWSE;
|
|
FxaaFloat edgeHorz = abs(edgeHorz3) + edgeHorz4;
|
|
FxaaFloat edgeVert = abs(edgeVert3) + edgeVert4;
|
|
/*--------------------------------------------------------------------------*/
|
|
FxaaFloat subpixNWSWNESE = lumaNWSW + lumaNESE;
|
|
FxaaFloat lengthSign = fxaaQualityRcpFrame.x;
|
|
FxaaBool horzSpan = edgeHorz >= edgeVert;
|
|
FxaaFloat subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;
|
|
/*--------------------------------------------------------------------------*/
|
|
if(!horzSpan) lumaN = lumaW;
|
|
if(!horzSpan) lumaS = lumaE;
|
|
if(horzSpan) lengthSign = fxaaQualityRcpFrame.y;
|
|
FxaaFloat subpixB = (subpixA * (1.0/12.0)) - lumaM;
|
|
/*--------------------------------------------------------------------------*/
|
|
FxaaFloat gradientN = lumaN - lumaM;
|
|
FxaaFloat gradientS = lumaS - lumaM;
|
|
FxaaFloat lumaNN = lumaN + lumaM;
|
|
FxaaFloat lumaSS = lumaS + lumaM;
|
|
FxaaBool pairN = abs(gradientN) >= abs(gradientS);
|
|
FxaaFloat gradient = max(abs(gradientN), abs(gradientS));
|
|
if(pairN) lengthSign = -lengthSign;
|
|
FxaaFloat subpixC = FxaaSat(abs(subpixB) * subpixRcpRange);
|
|
/*--------------------------------------------------------------------------*/
|
|
FxaaFloat2 posB;
|
|
posB.x = posM.x;
|
|
posB.y = posM.y;
|
|
FxaaFloat2 offNP;
|
|
offNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;
|
|
offNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;
|
|
if(!horzSpan) posB.x += lengthSign * 0.5;
|
|
if( horzSpan) posB.y += lengthSign * 0.5;
|
|
/*--------------------------------------------------------------------------*/
|
|
FxaaFloat2 posN;
|
|
posN.x = posB.x - offNP.x * FXAA_QUALITY_P0;
|
|
posN.y = posB.y - offNP.y * FXAA_QUALITY_P0;
|
|
FxaaFloat2 posP;
|
|
posP.x = posB.x + offNP.x * FXAA_QUALITY_P0;
|
|
posP.y = posB.y + offNP.y * FXAA_QUALITY_P0;
|
|
FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0;
|
|
FxaaFloat lumaEndN = FxaaLuma(FxaaTexTop(tex, posN));
|
|
FxaaFloat subpixE = subpixC * subpixC;
|
|
FxaaFloat lumaEndP = FxaaLuma(FxaaTexTop(tex, posP));
|
|
/*--------------------------------------------------------------------------*/
|
|
if(!pairN) lumaNN = lumaSS;
|
|
FxaaFloat gradientScaled = gradient * 1.0/4.0;
|
|
FxaaFloat lumaMM = lumaM - lumaNN * 0.5;
|
|
FxaaFloat subpixF = subpixD * subpixE;
|
|
FxaaBool lumaMLTZero = lumaMM < 0.0;
|
|
/*--------------------------------------------------------------------------*/
|
|
lumaEndN -= lumaNN * 0.5;
|
|
lumaEndP -= lumaNN * 0.5;
|
|
FxaaBool doneN = abs(lumaEndN) >= gradientScaled;
|
|
FxaaBool doneP = abs(lumaEndP) >= gradientScaled;
|
|
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P1;
|
|
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P1;
|
|
FxaaBool doneNP = (!doneN) || (!doneP);
|
|
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P1;
|
|
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P1;
|
|
/*--------------------------------------------------------------------------*/
|
|
if(doneNP) {
|
|
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
|
|
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
|
|
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
|
|
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
|
|
doneN = abs(lumaEndN) >= gradientScaled;
|
|
doneP = abs(lumaEndP) >= gradientScaled;
|
|
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P2;
|
|
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P2;
|
|
doneNP = (!doneN) || (!doneP);
|
|
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P2;
|
|
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P2;
|
|
/*--------------------------------------------------------------------------*/
|
|
#if (FXAA_QUALITY_PS > 3)
|
|
if(doneNP) {
|
|
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
|
|
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
|
|
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
|
|
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
|
|
doneN = abs(lumaEndN) >= gradientScaled;
|
|
doneP = abs(lumaEndP) >= gradientScaled;
|
|
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P3;
|
|
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P3;
|
|
doneNP = (!doneN) || (!doneP);
|
|
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P3;
|
|
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P3;
|
|
/*--------------------------------------------------------------------------*/
|
|
#if (FXAA_QUALITY_PS > 4)
|
|
if(doneNP) {
|
|
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
|
|
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
|
|
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
|
|
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
|
|
doneN = abs(lumaEndN) >= gradientScaled;
|
|
doneP = abs(lumaEndP) >= gradientScaled;
|
|
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P4;
|
|
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P4;
|
|
doneNP = (!doneN) || (!doneP);
|
|
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P4;
|
|
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P4;
|
|
/*--------------------------------------------------------------------------*/
|
|
#if (FXAA_QUALITY_PS > 5)
|
|
if(doneNP) {
|
|
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
|
|
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
|
|
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
|
|
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
|
|
doneN = abs(lumaEndN) >= gradientScaled;
|
|
doneP = abs(lumaEndP) >= gradientScaled;
|
|
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P5;
|
|
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P5;
|
|
doneNP = (!doneN) || (!doneP);
|
|
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P5;
|
|
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P5;
|
|
/*--------------------------------------------------------------------------*/
|
|
#if (FXAA_QUALITY_PS > 6)
|
|
if(doneNP) {
|
|
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
|
|
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
|
|
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
|
|
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
|
|
doneN = abs(lumaEndN) >= gradientScaled;
|
|
doneP = abs(lumaEndP) >= gradientScaled;
|
|
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P6;
|
|
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P6;
|
|
doneNP = (!doneN) || (!doneP);
|
|
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P6;
|
|
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P6;
|
|
/*--------------------------------------------------------------------------*/
|
|
#if (FXAA_QUALITY_PS > 7)
|
|
if(doneNP) {
|
|
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
|
|
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
|
|
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
|
|
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
|
|
doneN = abs(lumaEndN) >= gradientScaled;
|
|
doneP = abs(lumaEndP) >= gradientScaled;
|
|
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P7;
|
|
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P7;
|
|
doneNP = (!doneN) || (!doneP);
|
|
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P7;
|
|
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P7;
|
|
/*--------------------------------------------------------------------------*/
|
|
#if (FXAA_QUALITY_PS > 8)
|
|
if(doneNP) {
|
|
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
|
|
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
|
|
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
|
|
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
|
|
doneN = abs(lumaEndN) >= gradientScaled;
|
|
doneP = abs(lumaEndP) >= gradientScaled;
|
|
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P8;
|
|
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P8;
|
|
doneNP = (!doneN) || (!doneP);
|
|
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P8;
|
|
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P8;
|
|
/*--------------------------------------------------------------------------*/
|
|
#if (FXAA_QUALITY_PS > 9)
|
|
if(doneNP) {
|
|
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
|
|
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
|
|
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
|
|
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
|
|
doneN = abs(lumaEndN) >= gradientScaled;
|
|
doneP = abs(lumaEndP) >= gradientScaled;
|
|
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P9;
|
|
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P9;
|
|
doneNP = (!doneN) || (!doneP);
|
|
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P9;
|
|
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P9;
|
|
/*--------------------------------------------------------------------------*/
|
|
#if (FXAA_QUALITY_PS > 10)
|
|
if(doneNP) {
|
|
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
|
|
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
|
|
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
|
|
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
|
|
doneN = abs(lumaEndN) >= gradientScaled;
|
|
doneP = abs(lumaEndP) >= gradientScaled;
|
|
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P10;
|
|
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P10;
|
|
doneNP = (!doneN) || (!doneP);
|
|
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P10;
|
|
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P10;
|
|
/*--------------------------------------------------------------------------*/
|
|
#if (FXAA_QUALITY_PS > 11)
|
|
if(doneNP) {
|
|
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
|
|
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
|
|
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
|
|
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
|
|
doneN = abs(lumaEndN) >= gradientScaled;
|
|
doneP = abs(lumaEndP) >= gradientScaled;
|
|
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P11;
|
|
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P11;
|
|
doneNP = (!doneN) || (!doneP);
|
|
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P11;
|
|
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P11;
|
|
/*--------------------------------------------------------------------------*/
|
|
#if (FXAA_QUALITY_PS > 12)
|
|
if(doneNP) {
|
|
if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
|
|
if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
|
|
if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
|
|
if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
|
|
doneN = abs(lumaEndN) >= gradientScaled;
|
|
doneP = abs(lumaEndP) >= gradientScaled;
|
|
if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P12;
|
|
if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P12;
|
|
doneNP = (!doneN) || (!doneP);
|
|
if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P12;
|
|
if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P12;
|
|
/*--------------------------------------------------------------------------*/
|
|
}
|
|
#endif
|
|
/*--------------------------------------------------------------------------*/
|
|
}
|
|
#endif
|
|
/*--------------------------------------------------------------------------*/
|
|
}
|
|
#endif
|
|
/*--------------------------------------------------------------------------*/
|
|
}
|
|
#endif
|
|
/*--------------------------------------------------------------------------*/
|
|
}
|
|
#endif
|
|
/*--------------------------------------------------------------------------*/
|
|
}
|
|
#endif
|
|
/*--------------------------------------------------------------------------*/
|
|
}
|
|
#endif
|
|
/*--------------------------------------------------------------------------*/
|
|
}
|
|
#endif
|
|
/*--------------------------------------------------------------------------*/
|
|
}
|
|
#endif
|
|
/*--------------------------------------------------------------------------*/
|
|
}
|
|
#endif
|
|
/*--------------------------------------------------------------------------*/
|
|
}
|
|
/*--------------------------------------------------------------------------*/
|
|
FxaaFloat dstN = posM.x - posN.x;
|
|
FxaaFloat dstP = posP.x - posM.x;
|
|
if(!horzSpan) dstN = posM.y - posN.y;
|
|
if(!horzSpan) dstP = posP.y - posM.y;
|
|
/*--------------------------------------------------------------------------*/
|
|
FxaaBool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;
|
|
FxaaFloat spanLength = (dstP + dstN);
|
|
FxaaBool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;
|
|
FxaaFloat spanLengthRcp = 1.0/spanLength;
|
|
/*--------------------------------------------------------------------------*/
|
|
FxaaBool directionN = dstN < dstP;
|
|
FxaaFloat dst = min(dstN, dstP);
|
|
FxaaBool goodSpan = directionN ? goodSpanN : goodSpanP;
|
|
FxaaFloat subpixG = subpixF * subpixF;
|
|
FxaaFloat pixelOffset = (dst * (-spanLengthRcp)) + 0.5;
|
|
FxaaFloat subpixH = subpixG * fxaaQualitySubpix;
|
|
/*--------------------------------------------------------------------------*/
|
|
FxaaFloat pixelOffsetGood = goodSpan ? pixelOffset : 0.0;
|
|
FxaaFloat pixelOffsetSubpix = max(pixelOffsetGood, subpixH);
|
|
if(!horzSpan) posM.x += pixelOffsetSubpix * lengthSign;
|
|
if( horzSpan) posM.y += pixelOffsetSubpix * lengthSign;
|
|
return FxaaFloat4(FxaaTexTop(tex, posM).xyz, lumaM);
|
|
}
|
|
`,R1e=`uniform vec4 u_initialColor;
|
|
|
|
#if TEXTURE_UNITS > 0
|
|
uniform sampler2D u_dayTextures[TEXTURE_UNITS];
|
|
uniform vec4 u_dayTextureTranslationAndScale[TEXTURE_UNITS];
|
|
uniform bool u_dayTextureUseWebMercatorT[TEXTURE_UNITS];
|
|
|
|
#ifdef APPLY_ALPHA
|
|
uniform float u_dayTextureAlpha[TEXTURE_UNITS];
|
|
#endif
|
|
|
|
#ifdef APPLY_DAY_NIGHT_ALPHA
|
|
uniform float u_dayTextureNightAlpha[TEXTURE_UNITS];
|
|
uniform float u_dayTextureDayAlpha[TEXTURE_UNITS];
|
|
#endif
|
|
|
|
#ifdef APPLY_SPLIT
|
|
uniform float u_dayTextureSplit[TEXTURE_UNITS];
|
|
#endif
|
|
|
|
#ifdef APPLY_BRIGHTNESS
|
|
uniform float u_dayTextureBrightness[TEXTURE_UNITS];
|
|
#endif
|
|
|
|
#ifdef APPLY_CONTRAST
|
|
uniform float u_dayTextureContrast[TEXTURE_UNITS];
|
|
#endif
|
|
|
|
#ifdef APPLY_HUE
|
|
uniform float u_dayTextureHue[TEXTURE_UNITS];
|
|
#endif
|
|
|
|
#ifdef APPLY_SATURATION
|
|
uniform float u_dayTextureSaturation[TEXTURE_UNITS];
|
|
#endif
|
|
|
|
#ifdef APPLY_GAMMA
|
|
uniform float u_dayTextureOneOverGamma[TEXTURE_UNITS];
|
|
#endif
|
|
|
|
#ifdef APPLY_IMAGERY_CUTOUT
|
|
uniform vec4 u_dayTextureCutoutRectangles[TEXTURE_UNITS];
|
|
#endif
|
|
|
|
#ifdef APPLY_COLOR_TO_ALPHA
|
|
uniform vec4 u_colorsToAlpha[TEXTURE_UNITS];
|
|
#endif
|
|
|
|
uniform vec4 u_dayTextureTexCoordsRectangle[TEXTURE_UNITS];
|
|
#endif
|
|
|
|
#ifdef SHOW_REFLECTIVE_OCEAN
|
|
uniform sampler2D u_waterMask;
|
|
uniform vec4 u_waterMaskTranslationAndScale;
|
|
uniform float u_zoomedOutOceanSpecularIntensity;
|
|
#endif
|
|
|
|
#ifdef SHOW_OCEAN_WAVES
|
|
uniform sampler2D u_oceanNormalMap;
|
|
#endif
|
|
|
|
#if defined(ENABLE_DAYNIGHT_SHADING) || defined(GROUND_ATMOSPHERE)
|
|
uniform vec2 u_lightingFadeDistance;
|
|
#endif
|
|
|
|
#ifdef TILE_LIMIT_RECTANGLE
|
|
uniform vec4 u_cartographicLimitRectangle;
|
|
#endif
|
|
|
|
#ifdef GROUND_ATMOSPHERE
|
|
uniform vec2 u_nightFadeDistance;
|
|
#endif
|
|
|
|
#ifdef ENABLE_CLIPPING_PLANES
|
|
uniform highp sampler2D u_clippingPlanes;
|
|
uniform mat4 u_clippingPlanesMatrix;
|
|
uniform vec4 u_clippingPlanesEdgeStyle;
|
|
#endif
|
|
|
|
#ifdef ENABLE_CLIPPING_POLYGONS
|
|
uniform highp sampler2D u_clippingDistance;
|
|
in vec2 v_clippingPosition;
|
|
flat in int v_regionIndex;
|
|
#endif
|
|
|
|
#if defined(GROUND_ATMOSPHERE) || defined(FOG) && defined(DYNAMIC_ATMOSPHERE_LIGHTING) && (defined(ENABLE_VERTEX_LIGHTING) || defined(ENABLE_DAYNIGHT_SHADING))
|
|
uniform float u_minimumBrightness;
|
|
#endif
|
|
|
|
#ifdef COLOR_CORRECT
|
|
uniform vec3 u_hsbShift; // Hue, saturation, brightness
|
|
#endif
|
|
|
|
#ifdef HIGHLIGHT_FILL_TILE
|
|
uniform vec4 u_fillHighlightColor;
|
|
#endif
|
|
|
|
#ifdef TRANSLUCENT
|
|
uniform vec4 u_frontFaceAlphaByDistance;
|
|
uniform vec4 u_backFaceAlphaByDistance;
|
|
uniform vec4 u_translucencyRectangle;
|
|
#endif
|
|
|
|
#ifdef UNDERGROUND_COLOR
|
|
uniform vec4 u_undergroundColor;
|
|
uniform vec4 u_undergroundColorAlphaByDistance;
|
|
#endif
|
|
|
|
#ifdef ENABLE_VERTEX_LIGHTING
|
|
uniform float u_lambertDiffuseMultiplier;
|
|
uniform float u_vertexShadowDarkness;
|
|
#endif
|
|
|
|
in vec3 v_positionMC;
|
|
in vec3 v_positionEC;
|
|
in vec3 v_textureCoordinates;
|
|
in vec3 v_normalMC;
|
|
in vec3 v_normalEC;
|
|
|
|
#ifdef APPLY_MATERIAL
|
|
in float v_height;
|
|
in float v_slope;
|
|
in float v_aspect;
|
|
#endif
|
|
|
|
#if defined(FOG) || defined(GROUND_ATMOSPHERE) || defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT)
|
|
in float v_distance;
|
|
#endif
|
|
|
|
#if defined(GROUND_ATMOSPHERE) || defined(FOG)
|
|
in vec3 v_atmosphereRayleighColor;
|
|
in vec3 v_atmosphereMieColor;
|
|
in float v_atmosphereOpacity;
|
|
#endif
|
|
|
|
#if defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT)
|
|
float interpolateByDistance(vec4 nearFarScalar, float distance)
|
|
{
|
|
float startDistance = nearFarScalar.x;
|
|
float startValue = nearFarScalar.y;
|
|
float endDistance = nearFarScalar.z;
|
|
float endValue = nearFarScalar.w;
|
|
float t = clamp((distance - startDistance) / (endDistance - startDistance), 0.0, 1.0);
|
|
return mix(startValue, endValue, t);
|
|
}
|
|
#endif
|
|
|
|
#if defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT) || defined(APPLY_MATERIAL)
|
|
vec4 alphaBlend(vec4 sourceColor, vec4 destinationColor)
|
|
{
|
|
return sourceColor * vec4(sourceColor.aaa, 1.0) + destinationColor * (1.0 - sourceColor.a);
|
|
}
|
|
#endif
|
|
|
|
#ifdef TRANSLUCENT
|
|
bool inTranslucencyRectangle()
|
|
{
|
|
return
|
|
v_textureCoordinates.x > u_translucencyRectangle.x &&
|
|
v_textureCoordinates.x < u_translucencyRectangle.z &&
|
|
v_textureCoordinates.y > u_translucencyRectangle.y &&
|
|
v_textureCoordinates.y < u_translucencyRectangle.w;
|
|
}
|
|
#endif
|
|
|
|
vec4 sampleAndBlend(
|
|
vec4 previousColor,
|
|
sampler2D textureToSample,
|
|
vec2 tileTextureCoordinates,
|
|
vec4 textureCoordinateRectangle,
|
|
vec4 textureCoordinateTranslationAndScale,
|
|
float textureAlpha,
|
|
float textureNightAlpha,
|
|
float textureDayAlpha,
|
|
float textureBrightness,
|
|
float textureContrast,
|
|
float textureHue,
|
|
float textureSaturation,
|
|
float textureOneOverGamma,
|
|
float split,
|
|
vec4 colorToAlpha,
|
|
float nightBlend)
|
|
{
|
|
// This crazy step stuff sets the alpha to 0.0 if this following condition is true:
|
|
// tileTextureCoordinates.s < textureCoordinateRectangle.s ||
|
|
// tileTextureCoordinates.s > textureCoordinateRectangle.p ||
|
|
// tileTextureCoordinates.t < textureCoordinateRectangle.t ||
|
|
// tileTextureCoordinates.t > textureCoordinateRectangle.q
|
|
// In other words, the alpha is zero if the fragment is outside the rectangle
|
|
// covered by this texture. Would an actual 'if' yield better performance?
|
|
vec2 alphaMultiplier = step(textureCoordinateRectangle.st, tileTextureCoordinates);
|
|
textureAlpha = textureAlpha * alphaMultiplier.x * alphaMultiplier.y;
|
|
|
|
alphaMultiplier = step(vec2(0.0), textureCoordinateRectangle.pq - tileTextureCoordinates);
|
|
textureAlpha = textureAlpha * alphaMultiplier.x * alphaMultiplier.y;
|
|
|
|
#if defined(APPLY_DAY_NIGHT_ALPHA) && defined(ENABLE_DAYNIGHT_SHADING)
|
|
textureAlpha *= mix(textureDayAlpha, textureNightAlpha, nightBlend);
|
|
#endif
|
|
|
|
vec2 translation = textureCoordinateTranslationAndScale.xy;
|
|
vec2 scale = textureCoordinateTranslationAndScale.zw;
|
|
vec2 textureCoordinates = tileTextureCoordinates * scale + translation;
|
|
vec4 value = texture(textureToSample, textureCoordinates);
|
|
vec3 color = value.rgb;
|
|
float alpha = value.a;
|
|
|
|
#ifdef APPLY_COLOR_TO_ALPHA
|
|
vec3 colorDiff = abs(color.rgb - colorToAlpha.rgb);
|
|
colorDiff.r = max(max(colorDiff.r, colorDiff.g), colorDiff.b);
|
|
alpha = czm_branchFreeTernary(colorDiff.r < colorToAlpha.a, 0.0, alpha);
|
|
#endif
|
|
|
|
#if !defined(APPLY_GAMMA)
|
|
vec4 tempColor = czm_gammaCorrect(vec4(color, alpha));
|
|
color = tempColor.rgb;
|
|
alpha = tempColor.a;
|
|
#else
|
|
color = pow(color, vec3(textureOneOverGamma));
|
|
#endif
|
|
|
|
#ifdef APPLY_SPLIT
|
|
float splitPosition = czm_splitPosition;
|
|
// Split to the left
|
|
if (split < 0.0 && gl_FragCoord.x > splitPosition) {
|
|
alpha = 0.0;
|
|
}
|
|
// Split to the right
|
|
else if (split > 0.0 && gl_FragCoord.x < splitPosition) {
|
|
alpha = 0.0;
|
|
}
|
|
#endif
|
|
|
|
#ifdef APPLY_BRIGHTNESS
|
|
color = mix(vec3(0.0), color, textureBrightness);
|
|
#endif
|
|
|
|
#ifdef APPLY_CONTRAST
|
|
color = mix(vec3(0.5), color, textureContrast);
|
|
#endif
|
|
|
|
#ifdef APPLY_HUE
|
|
color = czm_hue(color, textureHue);
|
|
#endif
|
|
|
|
#ifdef APPLY_SATURATION
|
|
color = czm_saturation(color, textureSaturation);
|
|
#endif
|
|
|
|
float sourceAlpha = alpha * textureAlpha;
|
|
float outAlpha = mix(previousColor.a, 1.0, sourceAlpha);
|
|
outAlpha += sign(outAlpha) - 1.0;
|
|
|
|
vec3 outColor = mix(previousColor.rgb * previousColor.a, color, sourceAlpha) / outAlpha;
|
|
|
|
// When rendering imagery for a tile in multiple passes,
|
|
// some GPU/WebGL implementation combinations will not blend fragments in
|
|
// additional passes correctly if their computation includes an unmasked
|
|
// divide-by-zero operation,
|
|
// even if it's not in the output or if the output has alpha zero.
|
|
//
|
|
// For example, without sanitization for outAlpha,
|
|
// this renders without artifacts:
|
|
// if (outAlpha == 0.0) { outColor = vec3(0.0); }
|
|
//
|
|
// but using czm_branchFreeTernary will cause portions of the tile that are
|
|
// alpha-zero in the additional pass to render as black instead of blending
|
|
// with the previous pass:
|
|
// outColor = czm_branchFreeTernary(outAlpha == 0.0, vec3(0.0), outColor);
|
|
//
|
|
// So instead, sanitize against divide-by-zero,
|
|
// store this state on the sign of outAlpha, and correct on return.
|
|
|
|
return vec4(outColor, max(outAlpha, 0.0));
|
|
}
|
|
|
|
vec4 computeDayColor(vec4 initialColor, vec3 textureCoordinates, float nightBlend);
|
|
vec4 computeWaterColor(vec3 positionEyeCoordinates, vec2 textureCoordinates, mat3 enuToEye, vec4 imageryColor, float specularMapValue, float fade);
|
|
|
|
const float fExposure = 2.0;
|
|
|
|
vec3 computeEllipsoidPosition()
|
|
{
|
|
float mpp = czm_metersPerPixel(vec4(0.0, 0.0, -czm_currentFrustum.x, 1.0), 1.0);
|
|
vec2 xy = gl_FragCoord.xy / czm_viewport.zw * 2.0 - vec2(1.0);
|
|
xy *= czm_viewport.zw * mpp * 0.5;
|
|
|
|
vec3 direction = normalize(vec3(xy, -czm_currentFrustum.x));
|
|
czm_ray ray = czm_ray(vec3(0.0), direction);
|
|
|
|
vec3 ellipsoid_center = czm_view[3].xyz;
|
|
|
|
czm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoid_center, czm_ellipsoidInverseRadii);
|
|
|
|
vec3 ellipsoidPosition = czm_pointAlongRay(ray, intersection.start);
|
|
return (czm_inverseView * vec4(ellipsoidPosition, 1.0)).xyz;
|
|
}
|
|
|
|
void main()
|
|
{
|
|
#ifdef TILE_LIMIT_RECTANGLE
|
|
if (v_textureCoordinates.x < u_cartographicLimitRectangle.x || u_cartographicLimitRectangle.z < v_textureCoordinates.x ||
|
|
v_textureCoordinates.y < u_cartographicLimitRectangle.y || u_cartographicLimitRectangle.w < v_textureCoordinates.y)
|
|
{
|
|
discard;
|
|
}
|
|
#endif
|
|
|
|
#ifdef ENABLE_CLIPPING_PLANES
|
|
float clipDistance = clip(gl_FragCoord, u_clippingPlanes, u_clippingPlanesMatrix);
|
|
#endif
|
|
|
|
#if defined(SHOW_REFLECTIVE_OCEAN) || defined(ENABLE_DAYNIGHT_SHADING) || defined(HDR)
|
|
vec3 normalMC = czm_geodeticSurfaceNormal(v_positionMC, vec3(0.0), vec3(1.0)); // normalized surface normal in model coordinates
|
|
vec3 normalEC = czm_normal3D * normalMC; // normalized surface normal in eye coordinates
|
|
#endif
|
|
|
|
#if defined(APPLY_DAY_NIGHT_ALPHA) && defined(ENABLE_DAYNIGHT_SHADING)
|
|
float nightBlend = 1.0 - clamp(czm_getLambertDiffuse(czm_lightDirectionEC, normalEC) * 5.0, 0.0, 1.0);
|
|
#else
|
|
float nightBlend = 0.0;
|
|
#endif
|
|
|
|
// The clamp below works around an apparent bug in Chrome Canary v23.0.1241.0
|
|
// where the fragment shader sees textures coordinates < 0.0 and > 1.0 for the
|
|
// fragments on the edges of tiles even though the vertex shader is outputting
|
|
// coordinates strictly in the 0-1 range.
|
|
vec4 color = computeDayColor(u_initialColor, clamp(v_textureCoordinates, 0.0, 1.0), nightBlend);
|
|
|
|
#ifdef SHOW_TILE_BOUNDARIES
|
|
if (v_textureCoordinates.x < (1.0/256.0) || v_textureCoordinates.x > (255.0/256.0) ||
|
|
v_textureCoordinates.y < (1.0/256.0) || v_textureCoordinates.y > (255.0/256.0))
|
|
{
|
|
color = vec4(1.0, 0.0, 0.0, 1.0);
|
|
}
|
|
#endif
|
|
|
|
#if defined(ENABLE_DAYNIGHT_SHADING) || defined(GROUND_ATMOSPHERE)
|
|
float cameraDist;
|
|
if (czm_sceneMode == czm_sceneMode2D)
|
|
{
|
|
cameraDist = max(czm_frustumPlanes.x - czm_frustumPlanes.y, czm_frustumPlanes.w - czm_frustumPlanes.z) * 0.5;
|
|
}
|
|
else if (czm_sceneMode == czm_sceneModeColumbusView)
|
|
{
|
|
cameraDist = -czm_view[3].z;
|
|
}
|
|
else
|
|
{
|
|
cameraDist = length(czm_view[3]);
|
|
}
|
|
float fadeOutDist = u_lightingFadeDistance.x;
|
|
float fadeInDist = u_lightingFadeDistance.y;
|
|
if (czm_sceneMode != czm_sceneMode3D) {
|
|
vec3 radii = czm_ellipsoidRadii;
|
|
float maxRadii = max(radii.x, max(radii.y, radii.z));
|
|
fadeOutDist -= maxRadii;
|
|
fadeInDist -= maxRadii;
|
|
}
|
|
float fade = clamp((cameraDist - fadeOutDist) / (fadeInDist - fadeOutDist), 0.0, 1.0);
|
|
#else
|
|
float fade = 0.0;
|
|
#endif
|
|
|
|
#ifdef SHOW_REFLECTIVE_OCEAN
|
|
vec2 waterMaskTranslation = u_waterMaskTranslationAndScale.xy;
|
|
vec2 waterMaskScale = u_waterMaskTranslationAndScale.zw;
|
|
vec2 waterMaskTextureCoordinates = v_textureCoordinates.xy * waterMaskScale + waterMaskTranslation;
|
|
waterMaskTextureCoordinates.y = 1.0 - waterMaskTextureCoordinates.y;
|
|
|
|
float mask = texture(u_waterMask, waterMaskTextureCoordinates).r;
|
|
|
|
if (mask > 0.0)
|
|
{
|
|
mat3 enuToEye = czm_eastNorthUpToEyeCoordinates(v_positionMC, normalEC);
|
|
|
|
vec2 ellipsoidTextureCoordinates = czm_ellipsoidWgs84TextureCoordinates(normalMC);
|
|
vec2 ellipsoidFlippedTextureCoordinates = czm_ellipsoidWgs84TextureCoordinates(normalMC.zyx);
|
|
|
|
vec2 textureCoordinates = mix(ellipsoidTextureCoordinates, ellipsoidFlippedTextureCoordinates, czm_morphTime * smoothstep(0.9, 0.95, normalMC.z));
|
|
|
|
color = computeWaterColor(v_positionEC, textureCoordinates, enuToEye, color, mask, fade);
|
|
}
|
|
#endif
|
|
|
|
#ifdef APPLY_MATERIAL
|
|
czm_materialInput materialInput;
|
|
materialInput.st = v_textureCoordinates.st;
|
|
materialInput.normalEC = normalize(v_normalEC);
|
|
materialInput.positionToEyeEC = -v_positionEC;
|
|
materialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(v_positionMC, normalize(v_normalEC));
|
|
materialInput.slope = v_slope;
|
|
materialInput.height = v_height;
|
|
materialInput.aspect = v_aspect;
|
|
czm_material material = czm_getMaterial(materialInput);
|
|
vec4 materialColor = vec4(material.diffuse, material.alpha);
|
|
color = alphaBlend(materialColor, color);
|
|
#endif
|
|
|
|
#ifdef ENABLE_VERTEX_LIGHTING
|
|
float diffuseIntensity = clamp(czm_getLambertDiffuse(czm_lightDirectionEC, normalize(v_normalEC)) * u_lambertDiffuseMultiplier + u_vertexShadowDarkness, 0.0, 1.0);
|
|
vec4 finalColor = vec4(color.rgb * czm_lightColor * diffuseIntensity, color.a);
|
|
#elif defined(ENABLE_DAYNIGHT_SHADING)
|
|
float diffuseIntensity = clamp(czm_getLambertDiffuse(czm_lightDirectionEC, normalEC) * 5.0 + 0.3, 0.0, 1.0);
|
|
diffuseIntensity = mix(1.0, diffuseIntensity, fade);
|
|
vec4 finalColor = vec4(color.rgb * czm_lightColor * diffuseIntensity, color.a);
|
|
#else
|
|
vec4 finalColor = color;
|
|
#endif
|
|
|
|
#ifdef ENABLE_CLIPPING_PLANES
|
|
vec4 clippingPlanesEdgeColor = vec4(1.0);
|
|
clippingPlanesEdgeColor.rgb = u_clippingPlanesEdgeStyle.rgb;
|
|
float clippingPlanesEdgeWidth = u_clippingPlanesEdgeStyle.a;
|
|
|
|
if (clipDistance < clippingPlanesEdgeWidth)
|
|
{
|
|
finalColor = clippingPlanesEdgeColor;
|
|
}
|
|
#endif
|
|
|
|
#ifdef ENABLE_CLIPPING_POLYGONS
|
|
vec2 clippingPosition = v_clippingPosition;
|
|
int regionIndex = v_regionIndex;
|
|
clipPolygons(u_clippingDistance, CLIPPING_POLYGON_REGIONS_LENGTH, clippingPosition, regionIndex);
|
|
#endif
|
|
|
|
#ifdef HIGHLIGHT_FILL_TILE
|
|
finalColor = vec4(mix(finalColor.rgb, u_fillHighlightColor.rgb, u_fillHighlightColor.a), finalColor.a);
|
|
#endif
|
|
|
|
#if defined(DYNAMIC_ATMOSPHERE_LIGHTING_FROM_SUN)
|
|
vec3 atmosphereLightDirection = czm_sunDirectionWC;
|
|
#else
|
|
vec3 atmosphereLightDirection = czm_lightDirectionWC;
|
|
#endif
|
|
|
|
#if defined(GROUND_ATMOSPHERE) || defined(FOG)
|
|
if (!czm_backFacing())
|
|
{
|
|
bool dynamicLighting = false;
|
|
#if defined(DYNAMIC_ATMOSPHERE_LIGHTING) && (defined(ENABLE_DAYNIGHT_SHADING) || defined(ENABLE_VERTEX_LIGHTING))
|
|
dynamicLighting = true;
|
|
#endif
|
|
|
|
vec3 rayleighColor;
|
|
vec3 mieColor;
|
|
float opacity;
|
|
|
|
vec3 positionWC;
|
|
vec3 lightDirection;
|
|
|
|
// When the camera is far away (camera distance > nightFadeOutDistance), the scattering is computed in the fragment shader.
|
|
// Otherwise, the scattering is computed in the vertex shader.
|
|
#ifdef PER_FRAGMENT_GROUND_ATMOSPHERE
|
|
positionWC = computeEllipsoidPosition();
|
|
lightDirection = czm_branchFreeTernary(dynamicLighting, atmosphereLightDirection, normalize(positionWC));
|
|
computeAtmosphereScattering(
|
|
positionWC,
|
|
lightDirection,
|
|
rayleighColor,
|
|
mieColor,
|
|
opacity
|
|
);
|
|
#else
|
|
positionWC = v_positionMC;
|
|
lightDirection = czm_branchFreeTernary(dynamicLighting, atmosphereLightDirection, normalize(positionWC));
|
|
rayleighColor = v_atmosphereRayleighColor;
|
|
mieColor = v_atmosphereMieColor;
|
|
opacity = v_atmosphereOpacity;
|
|
#endif
|
|
|
|
#ifdef COLOR_CORRECT
|
|
const bool ignoreBlackPixels = true;
|
|
rayleighColor = czm_applyHSBShift(rayleighColor, u_hsbShift, ignoreBlackPixels);
|
|
mieColor = czm_applyHSBShift(mieColor, u_hsbShift, ignoreBlackPixels);
|
|
#endif
|
|
|
|
vec4 groundAtmosphereColor = computeAtmosphereColor(positionWC, lightDirection, rayleighColor, mieColor, opacity);
|
|
|
|
// Fog is applied to tiles selected for fog, close to the Earth.
|
|
#ifdef FOG
|
|
vec3 fogColor = groundAtmosphereColor.rgb;
|
|
|
|
// If there is lighting, apply that to the fog.
|
|
#if defined(DYNAMIC_ATMOSPHERE_LIGHTING) && (defined(ENABLE_VERTEX_LIGHTING) || defined(ENABLE_DAYNIGHT_SHADING))
|
|
float darken = clamp(dot(normalize(czm_viewerPositionWC), atmosphereLightDirection), u_minimumBrightness, 1.0);
|
|
fogColor *= darken;
|
|
#endif
|
|
|
|
#ifndef HDR
|
|
fogColor.rgb = czm_acesTonemapping(fogColor.rgb);
|
|
fogColor.rgb = czm_inverseGamma(fogColor.rgb);
|
|
#endif
|
|
|
|
const float modifier = 0.15;
|
|
finalColor = vec4(czm_fog(v_distance, finalColor.rgb, fogColor.rgb, modifier), finalColor.a);
|
|
|
|
#else
|
|
// Apply ground atmosphere. This happens when the camera is far away from the earth.
|
|
|
|
// The transmittance is based on optical depth i.e. the length of segment of the ray inside the atmosphere.
|
|
// This value is larger near the "circumference", as it is further away from the camera. We use it to
|
|
// brighten up that area of the ground atmosphere.
|
|
const float transmittanceModifier = 0.5;
|
|
float transmittance = transmittanceModifier + clamp(1.0 - groundAtmosphereColor.a, 0.0, 1.0);
|
|
|
|
vec3 finalAtmosphereColor = finalColor.rgb + groundAtmosphereColor.rgb * transmittance;
|
|
|
|
#if defined(DYNAMIC_ATMOSPHERE_LIGHTING) && (defined(ENABLE_VERTEX_LIGHTING) || defined(ENABLE_DAYNIGHT_SHADING))
|
|
float fadeInDist = u_nightFadeDistance.x;
|
|
float fadeOutDist = u_nightFadeDistance.y;
|
|
|
|
float sunlitAtmosphereIntensity = clamp((cameraDist - fadeOutDist) / (fadeInDist - fadeOutDist), 0.05, 1.0);
|
|
float darken = clamp(dot(normalize(positionWC), atmosphereLightDirection), 0.0, 1.0);
|
|
vec3 darkenendGroundAtmosphereColor = mix(groundAtmosphereColor.rgb, finalAtmosphereColor.rgb, darken);
|
|
|
|
finalAtmosphereColor = mix(darkenendGroundAtmosphereColor, finalAtmosphereColor, sunlitAtmosphereIntensity);
|
|
#endif
|
|
|
|
#ifndef HDR
|
|
finalAtmosphereColor.rgb = vec3(1.0) - exp(-fExposure * finalAtmosphereColor.rgb);
|
|
#else
|
|
finalAtmosphereColor.rgb = czm_saturation(finalAtmosphereColor.rgb, 1.6);
|
|
#endif
|
|
|
|
finalColor.rgb = mix(finalColor.rgb, finalAtmosphereColor.rgb, fade);
|
|
#endif
|
|
}
|
|
#endif
|
|
|
|
#ifdef UNDERGROUND_COLOR
|
|
if (czm_backFacing())
|
|
{
|
|
float distanceFromEllipsoid = max(czm_eyeHeight, 0.0);
|
|
float distance = max(v_distance - distanceFromEllipsoid, 0.0);
|
|
float blendAmount = interpolateByDistance(u_undergroundColorAlphaByDistance, distance);
|
|
vec4 undergroundColor = vec4(u_undergroundColor.rgb, u_undergroundColor.a * blendAmount);
|
|
finalColor = alphaBlend(undergroundColor, finalColor);
|
|
}
|
|
#endif
|
|
|
|
#ifdef TRANSLUCENT
|
|
if (inTranslucencyRectangle())
|
|
{
|
|
vec4 alphaByDistance = gl_FrontFacing ? u_frontFaceAlphaByDistance : u_backFaceAlphaByDistance;
|
|
finalColor.a *= interpolateByDistance(alphaByDistance, v_distance);
|
|
}
|
|
#endif
|
|
|
|
out_FragColor = finalColor;
|
|
}
|
|
|
|
|
|
#ifdef SHOW_REFLECTIVE_OCEAN
|
|
|
|
float waveFade(float edge0, float edge1, float x)
|
|
{
|
|
float y = clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);
|
|
return pow(1.0 - y, 5.0);
|
|
}
|
|
|
|
float linearFade(float edge0, float edge1, float x)
|
|
{
|
|
return clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);
|
|
}
|
|
|
|
// Based on water rendering by Jonas Wagner:
|
|
// http://29a.ch/2012/7/19/webgl-terrain-rendering-water-fog
|
|
|
|
// low altitude wave settings
|
|
const float oceanFrequencyLowAltitude = 825000.0;
|
|
const float oceanAnimationSpeedLowAltitude = 0.004;
|
|
const float oceanOneOverAmplitudeLowAltitude = 1.0 / 2.0;
|
|
const float oceanSpecularIntensity = 0.5;
|
|
|
|
// high altitude wave settings
|
|
const float oceanFrequencyHighAltitude = 125000.0;
|
|
const float oceanAnimationSpeedHighAltitude = 0.008;
|
|
const float oceanOneOverAmplitudeHighAltitude = 1.0 / 2.0;
|
|
|
|
vec4 computeWaterColor(vec3 positionEyeCoordinates, vec2 textureCoordinates, mat3 enuToEye, vec4 imageryColor, float maskValue, float fade)
|
|
{
|
|
vec3 positionToEyeEC = -positionEyeCoordinates;
|
|
float positionToEyeECLength = length(positionToEyeEC);
|
|
|
|
// The double normalize below works around a bug in Firefox on Android devices.
|
|
vec3 normalizedPositionToEyeEC = normalize(normalize(positionToEyeEC));
|
|
|
|
// Fade out the waves as the camera moves far from the surface.
|
|
float waveIntensity = waveFade(70000.0, 1000000.0, positionToEyeECLength);
|
|
|
|
#ifdef SHOW_OCEAN_WAVES
|
|
// high altitude waves
|
|
float time = czm_frameNumber * oceanAnimationSpeedHighAltitude;
|
|
vec4 noise = czm_getWaterNoise(u_oceanNormalMap, textureCoordinates * oceanFrequencyHighAltitude, time, 0.0);
|
|
vec3 normalTangentSpaceHighAltitude = vec3(noise.xy, noise.z * oceanOneOverAmplitudeHighAltitude);
|
|
|
|
// low altitude waves
|
|
time = czm_frameNumber * oceanAnimationSpeedLowAltitude;
|
|
noise = czm_getWaterNoise(u_oceanNormalMap, textureCoordinates * oceanFrequencyLowAltitude, time, 0.0);
|
|
vec3 normalTangentSpaceLowAltitude = vec3(noise.xy, noise.z * oceanOneOverAmplitudeLowAltitude);
|
|
|
|
// blend the 2 wave layers based on distance to surface
|
|
float highAltitudeFade = linearFade(0.0, 60000.0, positionToEyeECLength);
|
|
float lowAltitudeFade = 1.0 - linearFade(20000.0, 60000.0, positionToEyeECLength);
|
|
vec3 normalTangentSpace =
|
|
(highAltitudeFade * normalTangentSpaceHighAltitude) +
|
|
(lowAltitudeFade * normalTangentSpaceLowAltitude);
|
|
normalTangentSpace = normalize(normalTangentSpace);
|
|
|
|
// fade out the normal perturbation as we move farther from the water surface
|
|
normalTangentSpace.xy *= waveIntensity;
|
|
normalTangentSpace = normalize(normalTangentSpace);
|
|
#else
|
|
vec3 normalTangentSpace = vec3(0.0, 0.0, 1.0);
|
|
#endif
|
|
|
|
vec3 normalEC = enuToEye * normalTangentSpace;
|
|
|
|
const vec3 waveHighlightColor = vec3(0.3, 0.45, 0.6);
|
|
|
|
// Use diffuse light to highlight the waves
|
|
float diffuseIntensity = czm_getLambertDiffuse(czm_lightDirectionEC, normalEC) * maskValue;
|
|
vec3 diffuseHighlight = waveHighlightColor * diffuseIntensity * (1.0 - fade);
|
|
|
|
#ifdef SHOW_OCEAN_WAVES
|
|
// Where diffuse light is low or non-existent, use wave highlights based solely on
|
|
// the wave bumpiness and no particular light direction.
|
|
float tsPerturbationRatio = normalTangentSpace.z;
|
|
vec3 nonDiffuseHighlight = mix(waveHighlightColor * 5.0 * (1.0 - tsPerturbationRatio), vec3(0.0), diffuseIntensity);
|
|
#else
|
|
vec3 nonDiffuseHighlight = vec3(0.0);
|
|
#endif
|
|
|
|
// Add specular highlights in 3D, and in all modes when zoomed in.
|
|
float specularIntensity = czm_getSpecular(czm_lightDirectionEC, normalizedPositionToEyeEC, normalEC, 10.0);
|
|
float surfaceReflectance = mix(0.0, mix(u_zoomedOutOceanSpecularIntensity, oceanSpecularIntensity, waveIntensity), maskValue);
|
|
float specular = specularIntensity * surfaceReflectance;
|
|
|
|
#ifdef HDR
|
|
specular *= 1.4;
|
|
|
|
float e = 0.2;
|
|
float d = 3.3;
|
|
float c = 1.7;
|
|
|
|
vec3 color = imageryColor.rgb + (c * (vec3(e) + imageryColor.rgb * d) * (diffuseHighlight + nonDiffuseHighlight + specular));
|
|
#else
|
|
vec3 color = imageryColor.rgb + diffuseHighlight + nonDiffuseHighlight + specular;
|
|
#endif
|
|
|
|
return vec4(color, imageryColor.a);
|
|
}
|
|
|
|
#endif // #ifdef SHOW_REFLECTIVE_OCEAN
|
|
`,N1e=`#ifdef QUANTIZATION_BITS12
|
|
in vec4 compressed0;
|
|
in float compressed1;
|
|
#else
|
|
in vec4 position3DAndHeight;
|
|
in vec4 textureCoordAndEncodedNormals;
|
|
#endif
|
|
|
|
#ifdef GEODETIC_SURFACE_NORMALS
|
|
in vec3 geodeticSurfaceNormal;
|
|
#endif
|
|
|
|
#ifdef EXAGGERATION
|
|
uniform vec2 u_verticalExaggerationAndRelativeHeight;
|
|
#endif
|
|
|
|
uniform vec3 u_center3D;
|
|
uniform mat4 u_modifiedModelView;
|
|
uniform mat4 u_modifiedModelViewProjection;
|
|
uniform vec4 u_tileRectangle;
|
|
|
|
// Uniforms for 2D Mercator projection
|
|
uniform vec2 u_southAndNorthLatitude;
|
|
uniform vec2 u_southMercatorYAndOneOverHeight;
|
|
|
|
out vec3 v_positionMC;
|
|
out vec3 v_positionEC;
|
|
|
|
out vec3 v_textureCoordinates;
|
|
out vec3 v_normalMC;
|
|
out vec3 v_normalEC;
|
|
|
|
#ifdef APPLY_MATERIAL
|
|
out float v_slope;
|
|
out float v_aspect;
|
|
out float v_height;
|
|
#endif
|
|
|
|
#if defined(FOG) || defined(GROUND_ATMOSPHERE) || defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT)
|
|
out float v_distance;
|
|
#endif
|
|
|
|
#if defined(FOG) || defined(GROUND_ATMOSPHERE)
|
|
out vec3 v_atmosphereRayleighColor;
|
|
out vec3 v_atmosphereMieColor;
|
|
out float v_atmosphereOpacity;
|
|
#endif
|
|
|
|
#ifdef ENABLE_CLIPPING_POLYGONS
|
|
uniform highp sampler2D u_clippingExtents;
|
|
out vec2 v_clippingPosition;
|
|
flat out int v_regionIndex;
|
|
#endif
|
|
|
|
// These functions are generated at runtime.
|
|
vec4 getPosition(vec3 position, float height, vec2 textureCoordinates);
|
|
float get2DYPositionFraction(vec2 textureCoordinates);
|
|
|
|
vec4 getPosition3DMode(vec3 position, float height, vec2 textureCoordinates)
|
|
{
|
|
return u_modifiedModelViewProjection * vec4(position, 1.0);
|
|
}
|
|
|
|
float get2DMercatorYPositionFraction(vec2 textureCoordinates)
|
|
{
|
|
// The width of a tile at level 11, in radians and assuming a single root tile, is
|
|
// 2.0 * czm_pi / pow(2.0, 11.0)
|
|
// We want to just linearly interpolate the 2D position from the texture coordinates
|
|
// when we're at this level or higher. The constant below is the expression
|
|
// above evaluated and then rounded up at the 4th significant digit.
|
|
const float maxTileWidth = 0.003068;
|
|
float positionFraction = textureCoordinates.y;
|
|
float southLatitude = u_southAndNorthLatitude.x;
|
|
float northLatitude = u_southAndNorthLatitude.y;
|
|
if (northLatitude - southLatitude > maxTileWidth)
|
|
{
|
|
float southMercatorY = u_southMercatorYAndOneOverHeight.x;
|
|
float oneOverMercatorHeight = u_southMercatorYAndOneOverHeight.y;
|
|
|
|
float currentLatitude = mix(southLatitude, northLatitude, textureCoordinates.y);
|
|
currentLatitude = clamp(currentLatitude, -czm_webMercatorMaxLatitude, czm_webMercatorMaxLatitude);
|
|
positionFraction = czm_latitudeToWebMercatorFraction(currentLatitude, southMercatorY, oneOverMercatorHeight);
|
|
}
|
|
return positionFraction;
|
|
}
|
|
|
|
float get2DGeographicYPositionFraction(vec2 textureCoordinates)
|
|
{
|
|
return textureCoordinates.y;
|
|
}
|
|
|
|
vec4 getPositionPlanarEarth(vec3 position, float height, vec2 textureCoordinates)
|
|
{
|
|
float yPositionFraction = get2DYPositionFraction(textureCoordinates);
|
|
vec4 rtcPosition2D = vec4(height, mix(u_tileRectangle.st, u_tileRectangle.pq, vec2(textureCoordinates.x, yPositionFraction)), 1.0);
|
|
return u_modifiedModelViewProjection * rtcPosition2D;
|
|
}
|
|
|
|
vec4 getPosition2DMode(vec3 position, float height, vec2 textureCoordinates)
|
|
{
|
|
return getPositionPlanarEarth(position, 0.0, textureCoordinates);
|
|
}
|
|
|
|
vec4 getPositionColumbusViewMode(vec3 position, float height, vec2 textureCoordinates)
|
|
{
|
|
return getPositionPlanarEarth(position, height, textureCoordinates);
|
|
}
|
|
|
|
vec4 getPositionMorphingMode(vec3 position, float height, vec2 textureCoordinates)
|
|
{
|
|
// We do not do RTC while morphing, so there is potential for jitter.
|
|
// This is unlikely to be noticeable, though.
|
|
vec3 position3DWC = position + u_center3D;
|
|
float yPositionFraction = get2DYPositionFraction(textureCoordinates);
|
|
vec4 position2DWC = vec4(height, mix(u_tileRectangle.st, u_tileRectangle.pq, vec2(textureCoordinates.x, yPositionFraction)), 1.0);
|
|
vec4 morphPosition = czm_columbusViewMorph(position2DWC, vec4(position3DWC, 1.0), czm_morphTime);
|
|
return czm_modelViewProjection * morphPosition;
|
|
}
|
|
|
|
#ifdef QUANTIZATION_BITS12
|
|
uniform vec2 u_minMaxHeight;
|
|
uniform mat4 u_scaleAndBias;
|
|
#endif
|
|
|
|
void main()
|
|
{
|
|
#ifdef QUANTIZATION_BITS12
|
|
vec2 xy = czm_decompressTextureCoordinates(compressed0.x);
|
|
vec2 zh = czm_decompressTextureCoordinates(compressed0.y);
|
|
vec3 position = vec3(xy, zh.x);
|
|
float height = zh.y;
|
|
vec2 textureCoordinates = czm_decompressTextureCoordinates(compressed0.z);
|
|
|
|
height = height * (u_minMaxHeight.y - u_minMaxHeight.x) + u_minMaxHeight.x;
|
|
position = (u_scaleAndBias * vec4(position, 1.0)).xyz;
|
|
|
|
#if (defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL)) && defined(INCLUDE_WEB_MERCATOR_Y) || defined(APPLY_MATERIAL)
|
|
float webMercatorT = czm_decompressTextureCoordinates(compressed0.w).x;
|
|
float encodedNormal = compressed1;
|
|
#elif defined(INCLUDE_WEB_MERCATOR_Y)
|
|
float webMercatorT = czm_decompressTextureCoordinates(compressed0.w).x;
|
|
float encodedNormal = 0.0;
|
|
#elif defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL)
|
|
float webMercatorT = textureCoordinates.y;
|
|
float encodedNormal = compressed0.w;
|
|
#else
|
|
float webMercatorT = textureCoordinates.y;
|
|
float encodedNormal = 0.0;
|
|
#endif
|
|
|
|
#else
|
|
// A single float per element
|
|
vec3 position = position3DAndHeight.xyz;
|
|
float height = position3DAndHeight.w;
|
|
vec2 textureCoordinates = textureCoordAndEncodedNormals.xy;
|
|
|
|
#if (defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL) || defined(APPLY_MATERIAL)) && defined(INCLUDE_WEB_MERCATOR_Y)
|
|
float webMercatorT = textureCoordAndEncodedNormals.z;
|
|
float encodedNormal = textureCoordAndEncodedNormals.w;
|
|
#elif defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL) || defined(APPLY_MATERIAL)
|
|
float webMercatorT = textureCoordinates.y;
|
|
float encodedNormal = textureCoordAndEncodedNormals.z;
|
|
#elif defined(INCLUDE_WEB_MERCATOR_Y)
|
|
float webMercatorT = textureCoordAndEncodedNormals.z;
|
|
float encodedNormal = 0.0;
|
|
#else
|
|
float webMercatorT = textureCoordinates.y;
|
|
float encodedNormal = 0.0;
|
|
#endif
|
|
|
|
#endif
|
|
|
|
vec3 position3DWC = position + u_center3D;
|
|
|
|
#ifdef GEODETIC_SURFACE_NORMALS
|
|
vec3 ellipsoidNormal = geodeticSurfaceNormal;
|
|
#else
|
|
vec3 ellipsoidNormal = normalize(position3DWC);
|
|
#endif
|
|
|
|
#if defined(EXAGGERATION) && defined(GEODETIC_SURFACE_NORMALS)
|
|
float exaggeration = u_verticalExaggerationAndRelativeHeight.x;
|
|
float relativeHeight = u_verticalExaggerationAndRelativeHeight.y;
|
|
float newHeight = (height - relativeHeight) * exaggeration + relativeHeight;
|
|
|
|
// stop from going through center of earth
|
|
float minRadius = min(min(czm_ellipsoidRadii.x, czm_ellipsoidRadii.y), czm_ellipsoidRadii.z);
|
|
newHeight = max(newHeight, -minRadius);
|
|
|
|
vec3 offset = ellipsoidNormal * (newHeight - height);
|
|
position += offset;
|
|
position3DWC += offset;
|
|
height = newHeight;
|
|
#endif
|
|
|
|
gl_Position = getPosition(position, height, textureCoordinates);
|
|
|
|
v_positionEC = (u_modifiedModelView * vec4(position, 1.0)).xyz;
|
|
v_positionMC = position3DWC; // position in model coordinates
|
|
|
|
v_textureCoordinates = vec3(textureCoordinates, webMercatorT);
|
|
|
|
#if defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL) || defined(APPLY_MATERIAL)
|
|
vec3 normalMC = czm_octDecode(encodedNormal);
|
|
|
|
#if defined(EXAGGERATION) && defined(GEODETIC_SURFACE_NORMALS)
|
|
vec3 projection = dot(normalMC, ellipsoidNormal) * ellipsoidNormal;
|
|
vec3 rejection = normalMC - projection;
|
|
normalMC = normalize(projection + rejection * exaggeration);
|
|
#endif
|
|
|
|
v_normalMC = normalMC;
|
|
v_normalEC = czm_normal3D * v_normalMC;
|
|
#endif
|
|
|
|
#ifdef ENABLE_CLIPPING_POLYGONS
|
|
vec2 sphericalLatLong = czm_approximateSphericalCoordinates(position3DWC);
|
|
sphericalLatLong.y = czm_branchFreeTernary(sphericalLatLong.y < czm_pi, sphericalLatLong.y, sphericalLatLong.y - czm_twoPi);
|
|
|
|
vec2 minDistance = vec2(czm_infinity);
|
|
v_clippingPosition = vec2(czm_infinity);
|
|
v_regionIndex = -1;
|
|
|
|
for (int regionIndex = 0; regionIndex < CLIPPING_POLYGON_REGIONS_LENGTH; regionIndex++) {
|
|
vec4 extents = unpackClippingExtents(u_clippingExtents, regionIndex);
|
|
vec2 rectUv = (sphericalLatLong.yx - extents.yx) * extents.wz;
|
|
|
|
vec2 clamped = clamp(rectUv, vec2(0.0), vec2(1.0));
|
|
vec2 distance = abs(rectUv - clamped) * extents.wz;
|
|
|
|
float threshold = 0.01;
|
|
if (minDistance.x > distance.x || minDistance.y > distance.y) {
|
|
minDistance = distance;
|
|
v_clippingPosition = rectUv;
|
|
if (rectUv.x > threshold && rectUv.y > threshold && rectUv.x < 1.0 - threshold && rectUv.y < 1.0 - threshold) {
|
|
v_regionIndex = regionIndex;
|
|
}
|
|
}
|
|
}
|
|
#endif
|
|
|
|
#if defined(FOG) || (defined(GROUND_ATMOSPHERE) && !defined(PER_FRAGMENT_GROUND_ATMOSPHERE))
|
|
|
|
bool dynamicLighting = false;
|
|
|
|
#if defined(DYNAMIC_ATMOSPHERE_LIGHTING) && (defined(ENABLE_DAYNIGHT_SHADING) || defined(ENABLE_VERTEX_LIGHTING))
|
|
dynamicLighting = true;
|
|
#endif
|
|
|
|
#if defined(DYNAMIC_ATMOSPHERE_LIGHTING_FROM_SUN)
|
|
vec3 atmosphereLightDirection = czm_sunDirectionWC;
|
|
#else
|
|
vec3 atmosphereLightDirection = czm_lightDirectionWC;
|
|
#endif
|
|
|
|
vec3 lightDirection = czm_branchFreeTernary(dynamicLighting, atmosphereLightDirection, normalize(position3DWC));
|
|
|
|
computeAtmosphereScattering(
|
|
position3DWC,
|
|
lightDirection,
|
|
v_atmosphereRayleighColor,
|
|
v_atmosphereMieColor,
|
|
v_atmosphereOpacity
|
|
);
|
|
#endif
|
|
|
|
#if defined(FOG) || defined(GROUND_ATMOSPHERE) || defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT)
|
|
v_distance = length((czm_modelView3D * vec4(position3DWC, 1.0)).xyz);
|
|
#endif
|
|
|
|
#ifdef APPLY_MATERIAL
|
|
float northPoleZ = czm_ellipsoidRadii.z;
|
|
vec3 northPolePositionMC = vec3(0.0, 0.0, northPoleZ);
|
|
vec3 vectorEastMC = normalize(cross(northPolePositionMC - v_positionMC, ellipsoidNormal));
|
|
float dotProd = abs(dot(ellipsoidNormal, v_normalMC));
|
|
v_slope = acos(dotProd);
|
|
vec3 normalRejected = ellipsoidNormal * dotProd;
|
|
vec3 normalProjected = v_normalMC - normalRejected;
|
|
vec3 aspectVector = normalize(normalProjected);
|
|
v_aspect = acos(dot(aspectVector, vectorEastMC));
|
|
float determ = dot(cross(vectorEastMC, aspectVector), ellipsoidNormal);
|
|
v_aspect = czm_branchFreeTernary(determ < 0.0, 2.0 * czm_pi - v_aspect, v_aspect);
|
|
v_height = height;
|
|
#endif
|
|
}
|
|
`,DB=`void computeAtmosphereScattering(vec3 positionWC, vec3 lightDirection, out vec3 rayleighColor, out vec3 mieColor, out float opacity) {
|
|
|
|
vec3 cameraToPositionWC = positionWC - czm_viewerPositionWC;
|
|
vec3 cameraToPositionWCDirection = normalize(cameraToPositionWC);
|
|
czm_ray primaryRay = czm_ray(czm_viewerPositionWC, cameraToPositionWCDirection);
|
|
|
|
float atmosphereInnerRadius = length(positionWC);
|
|
|
|
computeScattering(
|
|
primaryRay,
|
|
length(cameraToPositionWC),
|
|
lightDirection,
|
|
atmosphereInnerRadius,
|
|
rayleighColor,
|
|
mieColor,
|
|
opacity
|
|
);
|
|
}
|
|
`,M1e=`uniform sampler2D u_texture;
|
|
|
|
in vec2 v_textureCoordinates;
|
|
|
|
void main()
|
|
{
|
|
out_FragColor = texture(u_texture, v_textureCoordinates);
|
|
}
|
|
`,F1e=`in vec4 position;
|
|
in float webMercatorT;
|
|
|
|
uniform vec2 u_textureDimensions;
|
|
|
|
out vec2 v_textureCoordinates;
|
|
|
|
void main()
|
|
{
|
|
v_textureCoordinates = vec2(position.x, webMercatorT);
|
|
gl_Position = czm_viewportOrthographic * (position * vec4(u_textureDimensions, 1.0, 1.0));
|
|
}
|
|
`,PB=`float interpolateByDistance(vec4 nearFarScalar, float distance)
|
|
{
|
|
float startDistance = nearFarScalar.x;
|
|
float startValue = nearFarScalar.y;
|
|
float endDistance = nearFarScalar.z;
|
|
float endValue = nearFarScalar.w;
|
|
float t = clamp((distance - startDistance) / (endDistance - startDistance), 0.0, 1.0);
|
|
return mix(startValue, endValue, t);
|
|
}
|
|
|
|
void computeAtmosphereScattering(vec3 positionWC, vec3 lightDirection, out vec3 rayleighColor, out vec3 mieColor, out float opacity, out float underTranslucentGlobe)
|
|
{
|
|
float ellipsoidRadiiDifference = czm_ellipsoidRadii.x - czm_ellipsoidRadii.z;
|
|
|
|
// Adjustment to the atmosphere radius applied based on the camera height.
|
|
float distanceAdjustMin = czm_ellipsoidRadii.x / 4.0;
|
|
float distanceAdjustMax = czm_ellipsoidRadii.x;
|
|
float distanceAdjustModifier = ellipsoidRadiiDifference / 2.0;
|
|
float distanceAdjust = distanceAdjustModifier * clamp((czm_eyeHeight - distanceAdjustMin) / (distanceAdjustMax - distanceAdjustMin), 0.0, 1.0);
|
|
|
|
// Since atmosphere scattering assumes the atmosphere is a spherical shell, we compute an inner radius of the atmosphere best fit
|
|
// for the position on the ellipsoid.
|
|
float radiusAdjust = (ellipsoidRadiiDifference / 4.0) + distanceAdjust;
|
|
float atmosphereInnerRadius = (length(czm_viewerPositionWC) - czm_eyeHeight) - radiusAdjust;
|
|
|
|
// Setup the primary ray: from the camera position to the vertex position.
|
|
vec3 cameraToPositionWC = positionWC - czm_viewerPositionWC;
|
|
vec3 cameraToPositionWCDirection = normalize(cameraToPositionWC);
|
|
czm_ray primaryRay = czm_ray(czm_viewerPositionWC, cameraToPositionWCDirection);
|
|
|
|
underTranslucentGlobe = 0.0;
|
|
|
|
// Brighten the sky atmosphere under the Earth's atmosphere when translucency is enabled.
|
|
#if defined(GLOBE_TRANSLUCENT)
|
|
|
|
// Check for intersection with the inner radius of the atmopshere.
|
|
czm_raySegment primaryRayEarthIntersect = czm_raySphereIntersectionInterval(primaryRay, vec3(0.0), atmosphereInnerRadius + radiusAdjust);
|
|
if (primaryRayEarthIntersect.start > 0.0 && primaryRayEarthIntersect.stop > 0.0) {
|
|
|
|
// Compute position on globe.
|
|
vec3 direction = normalize(positionWC);
|
|
czm_ray ellipsoidRay = czm_ray(positionWC, -direction);
|
|
czm_raySegment ellipsoidIntersection = czm_rayEllipsoidIntersectionInterval(ellipsoidRay, vec3(0.0), czm_ellipsoidInverseRadii);
|
|
vec3 onEarth = positionWC - (direction * ellipsoidIntersection.start);
|
|
|
|
// Control the color using the camera angle.
|
|
float angle = dot(normalize(czm_viewerPositionWC), normalize(onEarth));
|
|
|
|
// Control the opacity using the distance from Earth.
|
|
opacity = interpolateByDistance(vec4(0.0, 1.0, czm_ellipsoidRadii.x, 0.0), length(czm_viewerPositionWC - onEarth));
|
|
vec3 horizonColor = vec3(0.1, 0.2, 0.3);
|
|
vec3 nearColor = vec3(0.0);
|
|
|
|
rayleighColor = mix(nearColor, horizonColor, exp(-angle) * opacity);
|
|
|
|
// Set the traslucent flag to avoid alpha adjustment in computeFinalColor funciton.
|
|
underTranslucentGlobe = 1.0;
|
|
return;
|
|
}
|
|
#endif
|
|
|
|
computeScattering(
|
|
primaryRay,
|
|
length(cameraToPositionWC),
|
|
lightDirection,
|
|
atmosphereInnerRadius,
|
|
rayleighColor,
|
|
mieColor,
|
|
opacity
|
|
);
|
|
|
|
// Alter the opacity based on how close the viewer is to the ground.
|
|
// (0.0 = At edge of atmosphere, 1.0 = On ground)
|
|
float cameraHeight = czm_eyeHeight + atmosphereInnerRadius;
|
|
float atmosphereOuterRadius = atmosphereInnerRadius + ATMOSPHERE_THICKNESS;
|
|
opacity = clamp((atmosphereOuterRadius - cameraHeight) / (atmosphereOuterRadius - atmosphereInnerRadius), 0.0, 1.0);
|
|
|
|
// Alter alpha based on time of day (0.0 = night , 1.0 = day)
|
|
float nightAlpha = (u_radiiAndDynamicAtmosphereColor.z != 0.0) ? clamp(dot(normalize(positionWC), lightDirection), 0.0, 1.0) : 1.0;
|
|
opacity *= pow(nightAlpha, 0.5);
|
|
}
|
|
`,B1e=`in vec3 v_outerPositionWC;
|
|
|
|
uniform vec3 u_hsbShift;
|
|
|
|
#ifndef PER_FRAGMENT_ATMOSPHERE
|
|
in vec3 v_mieColor;
|
|
in vec3 v_rayleighColor;
|
|
in float v_opacity;
|
|
in float v_translucent;
|
|
#endif
|
|
|
|
void main (void)
|
|
{
|
|
float lightEnum = u_radiiAndDynamicAtmosphereColor.z;
|
|
vec3 lightDirection = czm_getDynamicAtmosphereLightDirection(v_outerPositionWC, lightEnum);
|
|
|
|
vec3 mieColor;
|
|
vec3 rayleighColor;
|
|
float opacity;
|
|
float translucent;
|
|
|
|
#ifdef PER_FRAGMENT_ATMOSPHERE
|
|
computeAtmosphereScattering(
|
|
v_outerPositionWC,
|
|
lightDirection,
|
|
rayleighColor,
|
|
mieColor,
|
|
opacity,
|
|
translucent
|
|
);
|
|
#else
|
|
mieColor = v_mieColor;
|
|
rayleighColor = v_rayleighColor;
|
|
opacity = v_opacity;
|
|
translucent = v_translucent;
|
|
#endif
|
|
|
|
vec4 color = computeAtmosphereColor(v_outerPositionWC, lightDirection, rayleighColor, mieColor, opacity);
|
|
|
|
#ifndef HDR
|
|
color.rgb = czm_acesTonemapping(color.rgb);
|
|
color.rgb = czm_inverseGamma(color.rgb);
|
|
#endif
|
|
|
|
#ifdef COLOR_CORRECT
|
|
const bool ignoreBlackPixels = true;
|
|
color.rgb = czm_applyHSBShift(color.rgb, u_hsbShift, ignoreBlackPixels);
|
|
#endif
|
|
|
|
// For the parts of the sky atmosphere that are not behind a translucent globe,
|
|
// we mix in the default opacity so that the sky atmosphere still appears at distance.
|
|
// This is needed because the opacity in the sky atmosphere is initially adjusted based
|
|
// on the camera height.
|
|
if (translucent == 0.0) {
|
|
color.a = mix(color.b, 1.0, color.a) * smoothstep(0.0, 1.0, czm_morphTime);
|
|
}
|
|
|
|
out_FragColor = color;
|
|
}
|
|
`,z1e=`in vec4 position;
|
|
|
|
out vec3 v_outerPositionWC;
|
|
|
|
#ifndef PER_FRAGMENT_ATMOSPHERE
|
|
out vec3 v_mieColor;
|
|
out vec3 v_rayleighColor;
|
|
out float v_opacity;
|
|
out float v_translucent;
|
|
#endif
|
|
|
|
void main(void)
|
|
{
|
|
vec4 positionWC = czm_model * position;
|
|
float lightEnum = u_radiiAndDynamicAtmosphereColor.z;
|
|
vec3 lightDirection = czm_getDynamicAtmosphereLightDirection(positionWC.xyz, lightEnum);
|
|
|
|
#ifndef PER_FRAGMENT_ATMOSPHERE
|
|
computeAtmosphereScattering(
|
|
positionWC.xyz,
|
|
lightDirection,
|
|
v_rayleighColor,
|
|
v_mieColor,
|
|
v_opacity,
|
|
v_translucent
|
|
);
|
|
#endif
|
|
|
|
v_outerPositionWC = positionWC.xyz;
|
|
gl_Position = czm_modelViewProjection * position;
|
|
}
|
|
`,U1e=`uniform samplerCube u_cubeMap;
|
|
|
|
in vec3 v_texCoord;
|
|
|
|
void main()
|
|
{
|
|
vec4 color = czm_textureCube(u_cubeMap, normalize(v_texCoord));
|
|
out_FragColor = vec4(czm_gammaCorrect(color).rgb, czm_morphTime);
|
|
}
|
|
`,k1e=`in vec3 position;
|
|
|
|
out vec3 v_texCoord;
|
|
|
|
void main()
|
|
{
|
|
vec3 p = czm_viewRotation * (czm_temeToPseudoFixed * (czm_entireFrustum.y * position));
|
|
gl_Position = czm_projection * vec4(p, 1.0);
|
|
v_texCoord = position.xyz;
|
|
}
|
|
`,V1e=`uniform sampler2D u_texture;
|
|
|
|
in vec2 v_textureCoordinates;
|
|
|
|
void main()
|
|
{
|
|
vec4 color = texture(u_texture, v_textureCoordinates);
|
|
out_FragColor = czm_gammaCorrect(color);
|
|
}
|
|
`,H1e=`uniform float u_radiusTS;
|
|
|
|
in vec2 v_textureCoordinates;
|
|
|
|
vec2 rotate(vec2 p, vec2 direction)
|
|
{
|
|
return vec2(p.x * direction.x - p.y * direction.y, p.x * direction.y + p.y * direction.x);
|
|
}
|
|
|
|
vec4 addBurst(vec2 position, vec2 direction, float lengthScalar)
|
|
{
|
|
vec2 rotatedPosition = rotate(position, direction) * vec2(25.0, 0.75);
|
|
float radius = length(rotatedPosition) * lengthScalar;
|
|
float burst = 1.0 - smoothstep(0.0, 0.55, radius);
|
|
return vec4(burst);
|
|
}
|
|
|
|
void main()
|
|
{
|
|
float lengthScalar = 2.0 / sqrt(2.0);
|
|
vec2 position = v_textureCoordinates - vec2(0.5);
|
|
float radius = length(position) * lengthScalar;
|
|
float surface = step(radius, u_radiusTS);
|
|
vec4 color = vec4(vec2(1.0), surface + 0.2, surface);
|
|
|
|
float glow = 1.0 - smoothstep(0.0, 0.55, radius);
|
|
color.ba += mix(vec2(0.0), vec2(1.0), glow) * 0.75;
|
|
|
|
vec4 burst = vec4(0.0);
|
|
|
|
// The following loop has been manually unrolled for speed, to
|
|
// avoid sin() and cos().
|
|
//
|
|
//for (float i = 0.4; i < 3.2; i += 1.047) {
|
|
// vec2 direction = vec2(sin(i), cos(i));
|
|
// burst += 0.4 * addBurst(position, direction, lengthScalar);
|
|
//
|
|
// direction = vec2(sin(i - 0.08), cos(i - 0.08));
|
|
// burst += 0.3 * addBurst(position, direction, lengthScalar);
|
|
//}
|
|
|
|
burst += 0.4 * addBurst(position, vec2(0.38942, 0.92106), lengthScalar); // angle == 0.4
|
|
burst += 0.4 * addBurst(position, vec2(0.99235, 0.12348), lengthScalar); // angle == 0.4 + 1.047
|
|
burst += 0.4 * addBurst(position, vec2(0.60327, -0.79754), lengthScalar); // angle == 0.4 + 1.047 * 2.0
|
|
|
|
burst += 0.3 * addBurst(position, vec2(0.31457, 0.94924), lengthScalar); // angle == 0.4 - 0.08
|
|
burst += 0.3 * addBurst(position, vec2(0.97931, 0.20239), lengthScalar); // angle == 0.4 + 1.047 - 0.08
|
|
burst += 0.3 * addBurst(position, vec2(0.66507, -0.74678), lengthScalar); // angle == 0.4 + 1.047 * 2.0 - 0.08
|
|
|
|
// End of manual loop unrolling.
|
|
|
|
color += clamp(burst, vec4(0.0), vec4(1.0)) * 0.15;
|
|
|
|
out_FragColor = clamp(color, vec4(0.0), vec4(1.0));
|
|
}
|
|
`,G1e=`in vec2 direction;
|
|
|
|
uniform float u_size;
|
|
|
|
out vec2 v_textureCoordinates;
|
|
|
|
void main()
|
|
{
|
|
vec4 position;
|
|
if (czm_morphTime == 1.0)
|
|
{
|
|
position = vec4(czm_sunPositionWC, 1.0);
|
|
}
|
|
else
|
|
{
|
|
position = vec4(czm_sunPositionColumbusView.zxy, 1.0);
|
|
}
|
|
|
|
vec4 positionEC = czm_view * position;
|
|
vec4 positionWC = czm_eyeToWindowCoordinates(positionEC);
|
|
|
|
vec2 halfSize = vec2(u_size * 0.5);
|
|
halfSize *= ((direction * 2.0) - 1.0);
|
|
|
|
gl_Position = czm_viewportOrthographic * vec4(positionWC.xy + halfSize, -positionWC.z, 1.0);
|
|
|
|
v_textureCoordinates = direction;
|
|
}
|
|
`;function DD(e){let t;const n=e.name,i=e.message;c(n)&&c(i)?t=`${n}: ${i}`:t=e.toString();const o=e.stack;return c(o)&&(t+=`
|
|
${o}`),t}const j1e={NONE:0,LERC:1},PD=Object.freeze(j1e),W1e={NONE:0,BITS12:1},Pa=Object.freeze(W1e),Vf=new d,q1e=new d,ac=new H,qT=new L,Y1e=new L,$1e=Math.pow(2,12);function Oo(e,t,n,i,o,r,s,a,l,u){let h=Pa.NONE,f,_;if(c(t)&&c(n)&&c(i)&&c(o)){const g=t.minimum,m=t.maximum,b=d.subtract(m,g,q1e),T=i-n;Math.max(d.maximumComponent(b),T)<$1e-1?h=Pa.BITS12:h=Pa.NONE,f=L.inverseTransformation(o,new L);const C=d.negate(g,Vf);L.multiply(L.fromTranslation(C,qT),f,f);const w=Vf;w.x=1/b.x,w.y=1/b.y,w.z=1/b.z,L.multiply(L.fromScale(w,qT),f,f),_=L.clone(o),L.setTranslation(_,d.ZERO,_),o=L.clone(o,new L);const v=L.fromTranslation(g,qT),P=L.fromScale(b,Y1e),N=L.multiply(v,P,qT);L.multiply(o,N,o),L.multiply(_,N,_)}this.quantization=h,this.minimumHeight=n,this.maximumHeight=i,this.center=d.clone(e),this.toScaledENU=f,this.fromScaledENU=o,this.matrix=_,this.hasVertexNormals=r,this.hasWebMercatorT=y(s,!1),this.hasGeodeticSurfaceNormals=y(a,!1),this.exaggeration=y(l,1),this.exaggerationRelativeHeight=y(u,0),this.stride=0,this._offsetGeodeticSurfaceNormal=0,this._offsetVertexNormal=0,this._calculateStrideAndOffsets()}Oo.prototype.encode=function(e,t,n,i,o,r,s,a){const l=i.x,u=i.y;if(this.quantization===Pa.BITS12){n=L.multiplyByPoint(this.toScaledENU,n,Vf),n.x=R.clamp(n.x,0,1),n.y=R.clamp(n.y,0,1),n.z=R.clamp(n.z,0,1);const h=this.maximumHeight-this.minimumHeight,f=R.clamp((o-this.minimumHeight)/h,0,1);H.fromElements(n.x,n.y,ac);const _=En.compressTextureCoordinates(ac);H.fromElements(n.z,f,ac);const g=En.compressTextureCoordinates(ac);H.fromElements(l,u,ac);const m=En.compressTextureCoordinates(ac);if(e[t++]=_,e[t++]=g,e[t++]=m,this.hasWebMercatorT){H.fromElements(s,0,ac);const b=En.compressTextureCoordinates(ac);e[t++]=b}}else d.subtract(n,this.center,Vf),e[t++]=Vf.x,e[t++]=Vf.y,e[t++]=Vf.z,e[t++]=o,e[t++]=l,e[t++]=u,this.hasWebMercatorT&&(e[t++]=s);return this.hasVertexNormals&&(e[t++]=En.octPackFloat(r)),this.hasGeodeticSurfaceNormals&&(e[t++]=a.x,e[t++]=a.y,e[t++]=a.z),t};const X1e=new d,_9=new d;Oo.prototype.addGeodeticSurfaceNormals=function(e,t,n){if(this.hasGeodeticSurfaceNormals)return;const i=this.stride,o=e.length/i;this.hasGeodeticSurfaceNormals=!0,this._calculateStrideAndOffsets();const r=this.stride;for(let s=0;s<o;s++){for(let h=0;h<i;h++){const f=s*i+h,_=s*r+h;t[_]=e[f]}const a=this.decodePosition(t,s,X1e),l=n.geodeticSurfaceNormal(a,_9),u=s*r+this._offsetGeodeticSurfaceNormal;t[u]=l.x,t[u+1]=l.y,t[u+2]=l.z}};Oo.prototype.removeGeodeticSurfaceNormals=function(e,t){if(!this.hasGeodeticSurfaceNormals)return;const n=this.stride,i=e.length/n;this.hasGeodeticSurfaceNormals=!1,this._calculateStrideAndOffsets();const o=this.stride;for(let r=0;r<i;r++)for(let s=0;s<o;s++){const a=r*n+s,l=r*o+s;t[l]=e[a]}};Oo.prototype.decodePosition=function(e,t,n){if(c(n)||(n=new d),t*=this.stride,this.quantization===Pa.BITS12){const i=En.decompressTextureCoordinates(e[t],ac);n.x=i.x,n.y=i.y;const o=En.decompressTextureCoordinates(e[t+1],ac);return n.z=o.x,L.multiplyByPoint(this.fromScaledENU,n,n)}return n.x=e[t],n.y=e[t+1],n.z=e[t+2],d.add(n,this.center,n)};Oo.prototype.getExaggeratedPosition=function(e,t,n){n=this.decodePosition(e,t,n);const i=this.exaggeration,o=this.exaggerationRelativeHeight;if(i!==1&&this.hasGeodeticSurfaceNormals){const s=this.decodeGeodeticSurfaceNormal(e,t,_9),a=this.decodeHeight(e,t),l=oa.getHeight(a,i,o)-a;n.x+=s.x*l,n.y+=s.y*l,n.z+=s.z*l}return n};Oo.prototype.decodeTextureCoordinates=function(e,t,n){return c(n)||(n=new H),t*=this.stride,this.quantization===Pa.BITS12?En.decompressTextureCoordinates(e[t+2],n):H.fromElements(e[t+4],e[t+5],n)};Oo.prototype.decodeHeight=function(e,t){return t*=this.stride,this.quantization===Pa.BITS12?En.decompressTextureCoordinates(e[t+1],ac).y*(this.maximumHeight-this.minimumHeight)+this.minimumHeight:e[t+3]};Oo.prototype.decodeWebMercatorT=function(e,t){return t*=this.stride,this.quantization===Pa.BITS12?En.decompressTextureCoordinates(e[t+3],ac).x:e[t+6]};Oo.prototype.getOctEncodedNormal=function(e,t,n){t=t*this.stride+this._offsetVertexNormal;const i=e[t]/256,o=Math.floor(i),r=(i-o)*256;return H.fromElements(o,r,n)};Oo.prototype.decodeGeodeticSurfaceNormal=function(e,t,n){return t=t*this.stride+this._offsetGeodeticSurfaceNormal,n.x=e[t],n.y=e[t+1],n.z=e[t+2],n};Oo.prototype._calculateStrideAndOffsets=function(){let e=0;switch(this.quantization){case Pa.BITS12:e+=3;break;default:e+=6}this.hasWebMercatorT&&(e+=1),this.hasVertexNormals&&(this._offsetVertexNormal=e,e+=1),this.hasGeodeticSurfaceNormals&&(this._offsetGeodeticSurfaceNormal=e,e+=3),this.stride=e};const JA={position3DAndHeight:0,textureCoordAndEncodedNormals:1,geodeticSurfaceNormal:2},ex={compressed0:0,compressed1:1,geodeticSurfaceNormal:2};Oo.prototype.getAttributes=function(e){const t=Z.FLOAT,n=Z.getSizeInBytes(t),i=this.stride*n;let o=0;const r=[];function s(a,l){r.push({index:a,vertexBuffer:e,componentDatatype:t,componentsPerAttribute:l,offsetInBytes:o,strideInBytes:i}),o+=l*n}if(this.quantization===Pa.NONE){s(JA.position3DAndHeight,4);let a=2;a+=this.hasWebMercatorT?1:0,a+=this.hasVertexNormals?1:0,s(JA.textureCoordAndEncodedNormals,a),this.hasGeodeticSurfaceNormals&&s(JA.geodeticSurfaceNormal,3)}else{const a=this.hasWebMercatorT||this.hasVertexNormals,l=this.hasWebMercatorT&&this.hasVertexNormals;s(ex.compressed0,a?4:3),l&&s(ex.compressed1,1),this.hasGeodeticSurfaceNormals&&s(ex.geodeticSurfaceNormal,3)}return r};Oo.prototype.getAttributeLocations=function(){return this.quantization===Pa.NONE?JA:ex};Oo.clone=function(e,t){if(!!c(e))return c(t)||(t=new Oo),t.quantization=e.quantization,t.minimumHeight=e.minimumHeight,t.maximumHeight=e.maximumHeight,t.center=d.clone(e.center),t.toScaledENU=L.clone(e.toScaledENU),t.fromScaledENU=L.clone(e.fromScaledENU),t.matrix=L.clone(e.matrix),t.hasVertexNormals=e.hasVertexNormals,t.hasWebMercatorT=e.hasWebMercatorT,t.hasGeodeticSurfaceNormals=e.hasGeodeticSurfaceNormals,t.exaggeration=e.exaggeration,t.exaggerationRelativeHeight=e.exaggerationRelativeHeight,t._calculateStrideAndOffsets(),t};const ql={};ql.DEFAULT_STRUCTURE=Object.freeze({heightScale:1,heightOffset:0,elementsPerHeight:1,stride:1,elementMultiplier:256,isBigEndian:!1});const dv=new d,Q1e=new L,K1e=new d,Z1e=new d;ql.computeVertices=function(e){if(!c(e)||!c(e.heightmap))throw new E("options.heightmap is required.");if(!c(e.width)||!c(e.height))throw new E("options.width and options.height are required.");if(!c(e.nativeRectangle))throw new E("options.nativeRectangle is required.");if(!c(e.skirtHeight))throw new E("options.skirtHeight is required.");const t=Math.cos,n=Math.sin,i=Math.sqrt,o=Math.atan,r=Math.exp,s=R.PI_OVER_TWO,a=R.toRadians,l=e.heightmap,u=e.width,h=e.height,f=e.skirtHeight,_=f>0,g=y(e.isGeographic,!0),m=y(e.ellipsoid,ae.WGS84),b=1/m.maximumRadius,T=ce.clone(e.nativeRectangle),x=ce.clone(e.rectangle);let C,w,v,P;c(x)?(C=x.west,w=x.south,v=x.east,P=x.north):g?(C=a(T.west),w=a(T.south),v=a(T.east),P=a(T.north)):(C=T.west*b,w=s-2*o(r(-T.south*b)),v=T.east*b,P=s-2*o(r(-T.north*b)));let N=e.relativeToCenter;const k=c(N);N=k?N:d.ZERO;const M=y(e.includeWebMercatorT,!1),U=y(e.exaggeration,1),B=y(e.exaggerationRelativeHeight,0),D=U!==1,p=y(e.structure,ql.DEFAULT_STRUCTURE),I=y(p.heightScale,ql.DEFAULT_STRUCTURE.heightScale),O=y(p.heightOffset,ql.DEFAULT_STRUCTURE.heightOffset),F=y(p.elementsPerHeight,ql.DEFAULT_STRUCTURE.elementsPerHeight),V=y(p.stride,ql.DEFAULT_STRUCTURE.stride),G=y(p.elementMultiplier,ql.DEFAULT_STRUCTURE.elementMultiplier),j=y(p.isBigEndian,ql.DEFAULT_STRUCTURE.isBigEndian);let W=ce.computeWidth(T),X=ce.computeHeight(T);const q=W/(u-1),ee=X/(h-1);g||(W*=b,X*=b);const Y=m.radiiSquared,ne=Y.x,Q=Y.y,le=Y.z;let pe=65536,re=-65536;const de=zt.eastNorthUpToFixedFrame(N,m),fe=L.inverseTransformation(de,Q1e);let ye,Ce;M&&(ye=vn.geodeticLatitudeToMercatorAngle(w),Ce=1/(vn.geodeticLatitudeToMercatorAngle(P)-ye));const we=K1e;we.x=Number.POSITIVE_INFINITY,we.y=Number.POSITIVE_INFINITY,we.z=Number.POSITIVE_INFINITY;const Pe=Z1e;Pe.x=Number.NEGATIVE_INFINITY,Pe.y=Number.NEGATIVE_INFINITY,Pe.z=Number.NEGATIVE_INFINITY;let lt=Number.POSITIVE_INFINITY;const ft=u*h,We=f>0?u*2+h*2:0,Fe=ft+We,Dt=new Array(Fe),st=new Array(Fe),et=new Array(Fe),hn=M?new Array(Fe):[],ot=D?new Array(Fe):[];let at=0,Xt=h,it=0,fi=u;_&&(--at,++Xt,--it,++fi);const Hi=1e-5;for(let zn=at;zn<Xt;++zn){let ci=zn;ci<0&&(ci=0),ci>=h&&(ci=h-1);let Si=T.north-ee*ci;g?Si=a(Si):Si=s-2*o(r(-Si*b));let Ko=(Si-w)/(P-w);Ko=R.clamp(Ko,0,1);const ri=zn===at,fr=zn===Xt-1;f>0&&(ri?Si+=Hi*X:fr&&(Si-=Hi*X));const ha=t(Si),fa=n(Si),So=le*fa;let Ln;M&&(Ln=(vn.geodeticLatitudeToMercatorAngle(Si)-ye)*Ce);for(let Zo=it;Zo<fi;++Zo){let ho=Zo;ho<0&&(ho=0),ho>=u&&(ho=u-1);const qs=ci*(u*V)+ho*V;let pi;if(F===1)pi=l[qs];else{pi=0;let Mo;if(j)for(Mo=0;Mo<F;++Mo)pi=pi*G+l[qs+Mo];else for(Mo=F-1;Mo>=0;--Mo)pi=pi*G+l[qs+Mo]}pi=pi*I+O,re=Math.max(re,pi),pe=Math.min(pe,pi);let ji=T.west+q*ho;g?ji=a(ji):ji=ji*b;let cf=(ji-C)/(v-C);cf=R.clamp(cf,0,1);let vi=ci*u+ho;if(f>0){const Mo=Zo===it,Et=Zo===fi-1,be=ri||fr||Mo||Et;if((ri||fr)&&(Mo||Et))continue;be&&(pi-=f,Mo?(vi=ft+(h-ci-1),ji-=Hi*W):fr?vi=ft+h+(u-ho-1):Et?(vi=ft+h+u+ci,ji+=Hi*W):ri&&(vi=ft+h+u+h+ho))}const pr=ha*t(ji),Rd=ha*n(ji),Lr=ne*pr,Xr=Q*Rd,Jn=1/i(Lr*pr+Xr*Rd+So*fa),qa=Lr*Jn,Ya=Xr*Jn,lf=So*Jn,fo=new d;fo.x=qa+pr*pi,fo.y=Ya+Rd*pi,fo.z=lf+fa*pi,L.multiplyByPoint(fe,fo,dv),d.minimumByComponent(dv,we,we),d.maximumByComponent(dv,Pe,Pe),lt=Math.min(lt,pi),Dt[vi]=fo,et[vi]=new H(cf,Ko),st[vi]=pi,M&&(hn[vi]=Ln),D&&(ot[vi]=m.geodeticSurfaceNormal(fo))}}const Ss=se.fromPoints(Dt);let Qo;c(x)&&(Qo=Ct.fromRectangle(x,pe,re,m));let No;k&&(No=new Vc(m).computeHorizonCullingPointPossiblyUnderEllipsoid(N,Dt,pe));const Gi=new Gr(we,Pe,N),Ni=new Oo(N,Gi,lt,re,de,!1,M,D,U,B),wi=new Float32Array(Fe*Ni.stride);let $r=0;for(let zn=0;zn<Fe;++zn)$r=Ni.encode(wi,$r,Dt[zn],et[zn],st[zn],void 0,hn[zn],ot[zn]);return{vertices:wi,maximumHeight:re,minimumHeight:pe,encoding:Ni,boundingSphere3D:Ss,orientedBoundingBox:Qo,occludeePointInScaledSpace:No}};const g9=ql;function xu(){E.throwInstantiationError()}Object.defineProperties(xu.prototype,{credits:{get:E.throwInstantiationError},waterMask:{get:E.throwInstantiationError}});xu.prototype.interpolateHeight=E.throwInstantiationError;xu.prototype.isChildAvailable=E.throwInstantiationError;xu.prototype.createMesh=E.throwInstantiationError;xu.prototype.upsample=E.throwInstantiationError;xu.prototype.wasCreatedByUpsampling=E.throwInstantiationError;xu.maximumAsynchronousTasks=5;function YC(e,t,n,i,o,r,s,a,l,u,h,f,_,g,m,b){this.center=e,this.vertices=t,this.stride=y(u,6),this.indices=n,this.indexCountWithoutSkirts=i,this.vertexCountWithoutSkirts=o,this.minimumHeight=r,this.maximumHeight=s,this.boundingSphere3D=a,this.occludeePointInScaledSpace=l,this.orientedBoundingBox=h,this.encoding=f,this.westIndicesSouthToNorth=_,this.southIndicesEastToWest=g,this.eastIndicesNorthToSouth=m,this.northIndicesWestToEast=b}function so(){E.throwInstantiationError()}Object.defineProperties(so.prototype,{errorEvent:{get:E.throwInstantiationError},credit:{get:E.throwInstantiationError},tilingScheme:{get:E.throwInstantiationError},hasWaterMask:{get:E.throwInstantiationError},hasVertexNormals:{get:E.throwInstantiationError},availability:{get:E.throwInstantiationError}});const OB=[];so.getRegularGridIndices=function(e,t){if(e*t>=R.FOUR_GIGABYTES)throw new E("The total number of vertices (width * height) must be less than 4,294,967,296.");let n=OB[e];c(n)||(OB[e]=n=[]);let i=n[t];return c(i)||(e*t<R.SIXTY_FOUR_KILOBYTES?i=n[t]=new Uint16Array((e-1)*(t-1)*6):i=n[t]=new Uint32Array((e-1)*(t-1)*6),b9(e,t,i,0)),i};const LB=[];so.getRegularGridIndicesAndEdgeIndices=function(e,t){if(e*t>=R.FOUR_GIGABYTES)throw new E("The total number of vertices (width * height) must be less than 4,294,967,296.");let n=LB[e];c(n)||(LB[e]=n=[]);let i=n[t];if(!c(i)){const o=so.getRegularGridIndices(e,t),r=y9(e,t),s=r.westIndicesSouthToNorth,a=r.southIndicesEastToWest,l=r.eastIndicesNorthToSouth,u=r.northIndicesWestToEast;i=n[t]={indices:o,westIndicesSouthToNorth:s,southIndicesEastToWest:a,eastIndicesNorthToSouth:l,northIndicesWestToEast:u}}return i};const RB=[];so.getRegularGridAndSkirtIndicesAndEdgeIndices=function(e,t){if(e*t>=R.FOUR_GIGABYTES)throw new E("The total number of vertices (width * height) must be less than 4,294,967,296.");let n=RB[e];c(n)||(RB[e]=n=[]);let i=n[t];if(!c(i)){const o=e*t,r=(e-1)*(t-1)*6,s=e*2+t*2,a=Math.max(0,s-4)*6,l=o+s,u=r+a,h=y9(e,t),f=h.westIndicesSouthToNorth,_=h.southIndicesEastToWest,g=h.eastIndicesNorthToSouth,m=h.northIndicesWestToEast,b=je.createTypedArray(l,u);b9(e,t,b,0),so.addSkirtIndices(f,_,g,m,o,b,r),i=n[t]={indices:b,westIndicesSouthToNorth:f,southIndicesEastToWest:_,eastIndicesNorthToSouth:g,northIndicesWestToEast:m,indexCountWithoutSkirts:r}}return i};so.addSkirtIndices=function(e,t,n,i,o,r,s){let a=o;s=YT(e,a,r,s),a+=e.length,s=YT(t,a,r,s),a+=t.length,s=YT(n,a,r,s),a+=n.length,YT(i,a,r,s)};function y9(e,t){const n=new Array(t),i=new Array(e),o=new Array(t),r=new Array(e);let s;for(s=0;s<e;++s)r[s]=s,i[s]=e*t-1-s;for(s=0;s<t;++s)o[s]=(s+1)*e-1,n[s]=(t-s-1)*e;return{westIndicesSouthToNorth:n,southIndicesEastToWest:i,eastIndicesNorthToSouth:o,northIndicesWestToEast:r}}function b9(e,t,n,i){let o=0;for(let r=0;r<t-1;++r){for(let s=0;s<e-1;++s){const a=o,l=a+e,u=l+1,h=a+1;n[i++]=a,n[i++]=l,n[i++]=h,n[i++]=h,n[i++]=l,n[i++]=u,++o}++o}}function YT(e,t,n,i){let o=e[0];const r=e.length;for(let s=1;s<r;++s){const a=e[s];n[i++]=o,n[i++]=a,n[i++]=t,n[i++]=t,n[i++]=a,n[i++]=t+1,o=a,++t}return i}so.heightmapTerrainQuality=.25;so.getEstimatedLevelZeroGeometricErrorForAHeightmap=function(e,t,n){return e.maximumRadius*2*Math.PI*so.heightmapTerrainQuality/(t*n)};so.prototype.requestTileGeometry=E.throwInstantiationError;so.prototype.getLevelMaximumGeometricError=E.throwInstantiationError;so.prototype.getTileDataAvailable=E.throwInstantiationError;so.prototype.loadTileDataAvailability=E.throwInstantiationError;function Cl(e){if(!c(e)||!c(e.buffer))throw new E("options.buffer is required.");if(!c(e.width))throw new E("options.width is required.");if(!c(e.height))throw new E("options.height is required.");this._buffer=e.buffer,this._width=e.width,this._height=e.height,this._childTileMask=y(e.childTileMask,15),this._encoding=y(e.encoding,PD.NONE);const t=g9.DEFAULT_STRUCTURE;let n=e.structure;c(n)?n!==t&&(n.heightScale=y(n.heightScale,t.heightScale),n.heightOffset=y(n.heightOffset,t.heightOffset),n.elementsPerHeight=y(n.elementsPerHeight,t.elementsPerHeight),n.stride=y(n.stride,t.stride),n.elementMultiplier=y(n.elementMultiplier,t.elementMultiplier),n.isBigEndian=y(n.isBigEndian,t.isBigEndian)):n=t,this._structure=n,this._createdByUpsampling=y(e.createdByUpsampling,!1),this._waterMask=e.waterMask,this._skirtHeight=void 0,this._bufferType=this._encoding===PD.LERC?Float32Array:this._buffer.constructor,this._mesh=void 0}Object.defineProperties(Cl.prototype,{credits:{get:function(){}},waterMask:{get:function(){return this._waterMask}},childTileMask:{get:function(){return this._childTileMask}}});const T9="createVerticesFromHeightmap",J1e=new Kn(T9),eLe=new Kn(T9,xu.maximumAsynchronousTasks);Cl.prototype.createMesh=function(e){e=y(e,y.EMPTY_OBJECT),A.typeOf.object("options.tilingScheme",e.tilingScheme),A.typeOf.number("options.x",e.x),A.typeOf.number("options.y",e.y),A.typeOf.number("options.level",e.level);const t=e.tilingScheme,n=e.x,i=e.y,o=e.level,r=y(e.exaggeration,1),s=y(e.exaggerationRelativeHeight,0),a=y(e.throttle,!0),l=t.ellipsoid,u=t.tileXYToNativeRectangle(n,i,o),h=t.tileXYToRectangle(n,i,o),f=l.cartographicToCartesian(ce.center(h)),_=this._structure,m=so.getEstimatedLevelZeroGeometricErrorForAHeightmap(l,this._width,t.getNumberOfXTilesAtLevel(0))/(1<<o);this._skirtHeight=Math.min(m*4,1e3);const T=(a?eLe:J1e).scheduleTask({heightmap:this._buffer,structure:_,includeWebMercatorT:!0,width:this._width,height:this._height,nativeRectangle:u,rectangle:h,relativeToCenter:f,ellipsoid:l,skirtHeight:this._skirtHeight,isGeographic:t.projection instanceof co,exaggeration:r,exaggerationRelativeHeight:s,encoding:this._encoding});if(!c(T))return;const x=this;return Promise.resolve(T).then(function(C){let w;x._skirtHeight>0?w=so.getRegularGridAndSkirtIndicesAndEdgeIndices(C.gridWidth,C.gridHeight):w=so.getRegularGridIndicesAndEdgeIndices(C.gridWidth,C.gridHeight);const v=C.gridWidth*C.gridHeight;return x._mesh=new YC(f,new Float32Array(C.vertices),w.indices,w.indexCountWithoutSkirts,v,C.minimumHeight,C.maximumHeight,se.clone(C.boundingSphere3D),d.clone(C.occludeePointInScaledSpace),C.numberOfAttributes,Ct.clone(C.orientedBoundingBox),Oo.clone(C.encoding),w.westIndicesSouthToNorth,w.southIndicesEastToWest,w.eastIndicesNorthToSouth,w.northIndicesWestToEast),x._buffer=void 0,x._mesh})};Cl.prototype._createMeshSync=function(e){A.typeOf.object("options.tilingScheme",e.tilingScheme),A.typeOf.number("options.x",e.x),A.typeOf.number("options.y",e.y),A.typeOf.number("options.level",e.level);const t=e.tilingScheme,n=e.x,i=e.y,o=e.level,r=y(e.exaggeration,1),s=y(e.exaggerationRelativeHeight,0),a=t.ellipsoid,l=t.tileXYToNativeRectangle(n,i,o),u=t.tileXYToRectangle(n,i,o),h=a.cartographicToCartesian(ce.center(u)),f=this._structure,g=so.getEstimatedLevelZeroGeometricErrorForAHeightmap(a,this._width,t.getNumberOfXTilesAtLevel(0))/(1<<o);this._skirtHeight=Math.min(g*4,1e3);const m=g9.computeVertices({heightmap:this._buffer,structure:f,includeWebMercatorT:!0,width:this._width,height:this._height,nativeRectangle:l,rectangle:u,relativeToCenter:h,ellipsoid:a,skirtHeight:this._skirtHeight,isGeographic:t.projection instanceof co,exaggeration:r,exaggerationRelativeHeight:s});this._buffer=void 0;let b;this._skirtHeight>0?b=so.getRegularGridAndSkirtIndicesAndEdgeIndices(this._width,this._height):b=so.getRegularGridIndicesAndEdgeIndices(this._width,this._height);const T=m.gridWidth*m.gridHeight;return this._mesh=new YC(h,m.vertices,b.indices,b.indexCountWithoutSkirts,T,m.minimumHeight,m.maximumHeight,m.boundingSphere3D,m.occludeePointInScaledSpace,m.encoding.stride,m.orientedBoundingBox,m.encoding,b.westIndicesSouthToNorth,b.southIndicesEastToWest,b.eastIndicesNorthToSouth,b.northIndicesWestToEast),this._mesh};Cl.prototype.interpolateHeight=function(e,t,n){const i=this._width,o=this._height,r=this._structure,s=r.stride,a=r.elementsPerHeight,l=r.elementMultiplier,u=r.isBigEndian,h=r.heightOffset,f=r.heightScale,_=c(this._mesh),g=this._encoding===PD.LERC;if(!_&&g)return;let b;if(_){const T=this._mesh.vertices,x=this._mesh.encoding;b=A9(T,x,h,f,e,i,o,t,n)}else b=tLe(this._buffer,a,l,s,u,e,i,o,t,n),b=b*f+h;return b};Cl.prototype.upsample=function(e,t,n,i,o,r,s){if(!c(e))throw new E("tilingScheme is required.");if(!c(t))throw new E("thisX is required.");if(!c(n))throw new E("thisY is required.");if(!c(i))throw new E("thisLevel is required.");if(!c(o))throw new E("descendantX is required.");if(!c(r))throw new E("descendantY is required.");if(!c(s))throw new E("descendantLevel is required.");if(s-i>1)throw new E("Upsampling through more than one level at a time is not currently supported.");const l=this._mesh;if(!c(l))return;const u=this._width,h=this._height,f=this._structure,_=f.stride,g=new this._bufferType(u*h*_),m=l.vertices,b=l.encoding,T=e.tileXYToRectangle(t,n,i),x=e.tileXYToRectangle(o,r,s),C=f.heightOffset,w=f.heightScale,v=f.elementsPerHeight,P=f.elementMultiplier,N=f.isBigEndian,k=Math.pow(P,v-1);for(let M=0;M<h;++M){const U=R.lerp(x.north,x.south,M/(h-1));for(let B=0;B<u;++B){const S=R.lerp(x.west,x.east,B/(u-1));let D=A9(m,b,C,w,T,u,h,S,U);D=D<f.lowestEncodedHeight?f.lowestEncodedHeight:D,D=D>f.highestEncodedHeight?f.highestEncodedHeight:D,nLe(g,v,P,k,_,N,M*u+B,D)}}return Promise.resolve(new Cl({buffer:g,width:u,height:h,childTileMask:0,structure:this._structure,createdByUpsampling:!0}))};Cl.prototype.isChildAvailable=function(e,t,n,i){if(!c(e))throw new E("thisX is required.");if(!c(t))throw new E("thisY is required.");if(!c(n))throw new E("childX is required.");if(!c(i))throw new E("childY is required.");let o=2;return n!==e*2&&++o,i!==t*2&&(o-=2),(this._childTileMask&1<<o)!==0};Cl.prototype.wasCreatedByUpsampling=function(){return this._createdByUpsampling};function tLe(e,t,n,i,o,r,s,a,l,u){const h=(l-r.west)*(s-1)/(r.east-r.west),f=(u-r.south)*(a-1)/(r.north-r.south);let _=h|0,g=_+1;g>=s&&(g=s-1,_=s-2);let m=f|0,b=m+1;b>=a&&(b=a-1,m=a-2);const T=h-_,x=f-m;m=a-1-m,b=a-1-b;const C=$T(e,t,n,i,o,m*s+_),w=$T(e,t,n,i,o,m*s+g),v=$T(e,t,n,i,o,b*s+_),P=$T(e,t,n,i,o,b*s+g);return x9(T,x,C,w,v,P)}function A9(e,t,n,i,o,r,s,a,l){const u=(a-o.west)*(r-1)/(o.east-o.west),h=(l-o.south)*(s-1)/(o.north-o.south);let f=u|0,_=f+1;_>=r&&(_=r-1,f=r-2);let g=h|0,m=g+1;m>=s&&(m=s-1,g=s-2);const b=u-f,T=h-g;g=s-1-g,m=s-1-m;const x=(t.decodeHeight(e,g*r+f)-n)/i,C=(t.decodeHeight(e,g*r+_)-n)/i,w=(t.decodeHeight(e,m*r+f)-n)/i,v=(t.decodeHeight(e,m*r+_)-n)/i;return x9(b,T,x,C,w,v)}function x9(e,t,n,i,o,r){return t<e?n+e*(i-n)+t*(r-i):n+e*(r-o)+t*(o-n)}function $T(e,t,n,i,o,r){r*=i;let s=0,a;if(o)for(a=0;a<t;++a)s=s*n+e[r+a];else for(a=t-1;a>=0;--a)s=s*n+e[r+a];return s}function nLe(e,t,n,i,o,r,s,a){s*=o;let l;if(r)for(l=0;l<t-1;++l)e[s+l]=a/i|0,a-=e[s+l]*i,i/=n;else for(l=t-1;l>0;--l)e[s+l]=a/i|0,a-=e[s+l]*i,i/=n;e[s+l]=a}function _d(e){e=y(e,y.EMPTY_OBJECT),this._tilingScheme=e.tilingScheme,c(this._tilingScheme)||(this._tilingScheme=new Yr({ellipsoid:y(e.ellipsoid,ae.WGS84)})),this._levelZeroMaximumGeometricError=so.getEstimatedLevelZeroGeometricErrorForAHeightmap(this._tilingScheme.ellipsoid,64,this._tilingScheme.getNumberOfXTilesAtLevel(0)),this._errorEvent=new Le}Object.defineProperties(_d.prototype,{errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){}},tilingScheme:{get:function(){return this._tilingScheme}},hasWaterMask:{get:function(){return!1}},hasVertexNormals:{get:function(){return!1}},availability:{get:function(){}}});_d.prototype.requestTileGeometry=function(e,t,n,i){return Promise.resolve(new Cl({buffer:new Uint8Array(16*16),width:16,height:16}))};_d.prototype.getLevelMaximumGeometricError=function(e){return this._levelZeroMaximumGeometricError/(1<<e)};_d.prototype.getTileDataAvailable=function(e,t,n){};_d.prototype.loadTileDataAvailability=function(e,t,n){};const iLe=new H;function p1(e,t){A.typeOf.object("clippingPlaneCollection",e),A.typeOf.object("context",t);const n=e.unionClippingRegions,i=e.length,o=Li.useFloatTexture(t),r=Li.getTextureResolution(e,t,iLe),s=r.x,a=r.y;let l=o?sLe(s,a):aLe(s,a);return l+=`
|
|
`,l+=n?oLe(i):rLe(i),l}function oLe(e){return`float clip(vec4 fragCoord, sampler2D clippingPlanes, mat4 clippingPlanesMatrix)
|
|
{
|
|
vec4 position = czm_windowToEyeCoordinates(fragCoord);
|
|
vec3 clipNormal = vec3(0.0);
|
|
vec3 clipPosition = vec3(0.0);
|
|
float clipAmount;
|
|
float pixelWidth = czm_metersPerPixel(position);
|
|
bool breakAndDiscard = false;
|
|
for (int i = 0; i < ${e}; ++i)
|
|
{
|
|
vec4 clippingPlane = getClippingPlane(clippingPlanes, i, clippingPlanesMatrix);
|
|
clipNormal = clippingPlane.xyz;
|
|
clipPosition = -clippingPlane.w * clipNormal;
|
|
float amount = dot(clipNormal, (position.xyz - clipPosition)) / pixelWidth;
|
|
clipAmount = czm_branchFreeTernary(i == 0, amount, min(amount, clipAmount));
|
|
if (amount <= 0.0)
|
|
{
|
|
breakAndDiscard = true;
|
|
break;
|
|
}
|
|
}
|
|
if (breakAndDiscard) {
|
|
discard;
|
|
}
|
|
return clipAmount;
|
|
}
|
|
`}function rLe(e){return`float clip(vec4 fragCoord, sampler2D clippingPlanes, mat4 clippingPlanesMatrix)
|
|
{
|
|
bool clipped = true;
|
|
vec4 position = czm_windowToEyeCoordinates(fragCoord);
|
|
vec3 clipNormal = vec3(0.0);
|
|
vec3 clipPosition = vec3(0.0);
|
|
float clipAmount = 0.0;
|
|
float pixelWidth = czm_metersPerPixel(position);
|
|
for (int i = 0; i < ${e}; ++i)
|
|
{
|
|
vec4 clippingPlane = getClippingPlane(clippingPlanes, i, clippingPlanesMatrix);
|
|
clipNormal = clippingPlane.xyz;
|
|
clipPosition = -clippingPlane.w * clipNormal;
|
|
float amount = dot(clipNormal, (position.xyz - clipPosition)) / pixelWidth;
|
|
clipAmount = max(amount, clipAmount);
|
|
clipped = clipped && (amount <= 0.0);
|
|
}
|
|
if (clipped)
|
|
{
|
|
discard;
|
|
}
|
|
return clipAmount;
|
|
}
|
|
`}function sLe(e,t){const n=1/e,i=1/t;let o=`${n}`;o.indexOf(".")===-1&&(o+=".0");let r=`${i}`;return r.indexOf(".")===-1&&(r+=".0"),`vec4 getClippingPlane(highp sampler2D packedClippingPlanes, int clippingPlaneNumber, mat4 transform)
|
|
{
|
|
int pixY = clippingPlaneNumber / ${e};
|
|
int pixX = clippingPlaneNumber - (pixY * ${e});
|
|
float u = (float(pixX) + 0.5) * ${o};
|
|
float v = (float(pixY) + 0.5) * ${r};
|
|
vec4 plane = texture(packedClippingPlanes, vec2(u, v));
|
|
return czm_transformPlane(plane, transform);
|
|
}
|
|
`}function aLe(e,t){const n=1/e,i=1/t;let o=`${n}`;o.indexOf(".")===-1&&(o+=".0");let r=`${i}`;return r.indexOf(".")===-1&&(r+=".0"),`vec4 getClippingPlane(highp sampler2D packedClippingPlanes, int clippingPlaneNumber, mat4 transform)
|
|
{
|
|
int clippingPlaneStartIndex = clippingPlaneNumber * 2;
|
|
int pixY = clippingPlaneStartIndex / ${e};
|
|
int pixX = clippingPlaneStartIndex - (pixY * ${e});
|
|
float u = (float(pixX) + 0.5) * ${o};
|
|
float v = (float(pixY) + 0.5) * ${r};
|
|
vec4 oct32 = texture(packedClippingPlanes, vec2(u, v)) * 255.0;
|
|
vec2 oct = vec2(oct32.x * 256.0 + oct32.y, oct32.z * 256.0 + oct32.w);
|
|
vec4 plane;
|
|
plane.xyz = czm_octDecode(oct, 65535.0);
|
|
plane.w = czm_unpackFloat(texture(packedClippingPlanes, vec2(u + ${o}, v)));
|
|
return czm_transformPlane(plane, transform);
|
|
}
|
|
`}function cLe(e,t,n,i,o,r){this.numberOfDayTextures=e,this.flags=t,this.material=n,this.shaderProgram=i,this.clippingShaderState=o,this.clippingPolygonShaderState=r}function m1(){this.baseVertexShaderSource=void 0,this.baseFragmentShaderSource=void 0,this._shadersByTexturesFlags=[],this.material=void 0}function lLe(e){const t="vec4 getPosition(vec3 position, float height, vec2 textureCoordinates) { return getPosition3DMode(position, height, textureCoordinates); }",n="vec4 getPosition(vec3 position, float height, vec2 textureCoordinates) { return getPositionColumbusViewMode(position, height, textureCoordinates); }",i="vec4 getPosition(vec3 position, float height, vec2 textureCoordinates) { return getPositionMorphingMode(position, height, textureCoordinates); }";let o;switch(e){case oe.SCENE3D:o=t;break;case oe.SCENE2D:case oe.COLUMBUS_VIEW:o=n;break;case oe.MORPHING:o=i;break}return o}function uLe(e){return e.webgl2?`void clipPolygons(highp sampler2D clippingDistance, int regionsLength, vec2 clippingPosition, int regionIndex) {
|
|
czm_clipPolygons(clippingDistance, regionsLength, clippingPosition, regionIndex);
|
|
}`:`void clipPolygons(highp sampler2D clippingDistance, int regionsLength, vec2 clippingPosition, int regionIndex) {
|
|
}`}function dLe(e){return e.webgl2?`vec4 unpackClippingExtents(highp sampler2D extentsTexture, int index) {
|
|
return czm_unpackClippingExtents(extentsTexture, index);
|
|
}`:`vec4 unpackClippingExtents(highp sampler2D extentsTexture, int index) {
|
|
return vec4();
|
|
}`}function hLe(e){return e?"float get2DYPositionFraction(vec2 textureCoordinates) { return get2DMercatorYPositionFraction(textureCoordinates); }":"float get2DYPositionFraction(vec2 textureCoordinates) { return get2DGeographicYPositionFraction(textureCoordinates); }"}m1.prototype.getShaderProgram=function(e){const t=e.frameState,n=e.surfaceTile,i=e.numberOfDayTextures,o=e.applyBrightness,r=e.applyContrast,s=e.applyHue,a=e.applySaturation,l=e.applyGamma,u=e.applyAlpha,h=e.applyDayNightAlpha,f=e.applySplit,_=e.showReflectiveOcean,g=e.showOceanWaves,m=e.enableLighting,b=e.dynamicAtmosphereLighting,T=e.dynamicAtmosphereLightingFromSun,x=e.showGroundAtmosphere,C=e.perFragmentGroundAtmosphere,w=e.hasVertexNormals,v=e.useWebMercatorProjection,P=e.enableFog,N=e.enableClippingPlanes,k=e.clippingPlanes,M=e.enableClippingPolygons,U=e.clippingPolygons,B=e.clippedByBoundaries,S=e.hasImageryLayerCutout,D=e.colorCorrect,p=e.highlightFillTile,I=e.colorToAlpha,O=e.hasGeodeticSurfaceNormals,F=e.hasExaggeration,V=e.showUndergroundColor,G=e.translucent;let j=0,W="";const q=n.renderedMesh.encoding;q.quantization===Pa.BITS12&&(j=1,W="QUANTIZATION_BITS12");let Y=0,ne="";B&&(Y=1,ne="TILE_LIMIT_RECTANGLE");let Q=0,le="";S&&(Q=1,le="APPLY_IMAGERY_CUTOUT");const pe=t.mode,re=pe|o<<2|r<<3|s<<4|a<<5|l<<6|u<<7|_<<8|g<<9|m<<10|b<<11|T<<12|x<<13|C<<14|w<<15|v<<16|P<<17|j<<18|f<<19|N<<20|M<<21|Y<<22|Q<<23|D<<24|p<<25|I<<26|O<<27|F<<28|V<<29|G<<30|h<<31;let de=0;c(k)&&k.length>0&&(de=N?k.clippingPlanesState:0);let fe=0;c(U)&&U.length>0&&(fe=M?U.clippingPolygonsState:0);let ye=n.surfaceShader;if(c(ye)&&ye.numberOfDayTextures===i&&ye.flags===re&&ye.material===this.material&&ye.clippingShaderState===de&&ye.clippingPolygonShaderState===fe)return ye.shaderProgram;let Ce=this._shadersByTexturesFlags[i];if(c(Ce)||(Ce=this._shadersByTexturesFlags[i]=[]),ye=Ce[re],!c(ye)||ye.material!==this.material||ye.clippingShaderState!==de||ye.clippingPolygonShaderState!==fe){const we=this.baseVertexShaderSource.clone(),Pe=this.baseFragmentShaderSource.clone();de!==0&&Pe.sources.unshift(p1(k,t.context)),fe!==0&&(Pe.sources.unshift(uLe(t.context)),we.sources.unshift(dLe(t.context))),we.defines.push(W),Pe.defines.push(`TEXTURE_UNITS ${i}`,ne,le),o&&Pe.defines.push("APPLY_BRIGHTNESS"),r&&Pe.defines.push("APPLY_CONTRAST"),s&&Pe.defines.push("APPLY_HUE"),a&&Pe.defines.push("APPLY_SATURATION"),l&&Pe.defines.push("APPLY_GAMMA"),u&&Pe.defines.push("APPLY_ALPHA"),h&&Pe.defines.push("APPLY_DAY_NIGHT_ALPHA"),_&&(Pe.defines.push("SHOW_REFLECTIVE_OCEAN"),we.defines.push("SHOW_REFLECTIVE_OCEAN")),g&&Pe.defines.push("SHOW_OCEAN_WAVES"),I&&Pe.defines.push("APPLY_COLOR_TO_ALPHA"),V&&(we.defines.push("UNDERGROUND_COLOR"),Pe.defines.push("UNDERGROUND_COLOR")),G&&(we.defines.push("TRANSLUCENT"),Pe.defines.push("TRANSLUCENT")),m&&(w?(we.defines.push("ENABLE_VERTEX_LIGHTING"),Pe.defines.push("ENABLE_VERTEX_LIGHTING")):(we.defines.push("ENABLE_DAYNIGHT_SHADING"),Pe.defines.push("ENABLE_DAYNIGHT_SHADING"))),b&&(we.defines.push("DYNAMIC_ATMOSPHERE_LIGHTING"),Pe.defines.push("DYNAMIC_ATMOSPHERE_LIGHTING"),T&&(we.defines.push("DYNAMIC_ATMOSPHERE_LIGHTING_FROM_SUN"),Pe.defines.push("DYNAMIC_ATMOSPHERE_LIGHTING_FROM_SUN"))),x&&(we.defines.push("GROUND_ATMOSPHERE"),Pe.defines.push("GROUND_ATMOSPHERE"),C&&(we.defines.push("PER_FRAGMENT_GROUND_ATMOSPHERE"),Pe.defines.push("PER_FRAGMENT_GROUND_ATMOSPHERE"))),we.defines.push("INCLUDE_WEB_MERCATOR_Y"),Pe.defines.push("INCLUDE_WEB_MERCATOR_Y"),P&&(we.defines.push("FOG"),Pe.defines.push("FOG")),f&&Pe.defines.push("APPLY_SPLIT"),N&&Pe.defines.push("ENABLE_CLIPPING_PLANES"),M&&(Pe.defines.push("ENABLE_CLIPPING_POLYGONS"),we.defines.push("ENABLE_CLIPPING_POLYGONS"),U.inverse&&Pe.defines.push("CLIPPING_INVERSE"),Pe.defines.push(`CLIPPING_POLYGON_REGIONS_LENGTH ${U.extentsCount}`),we.defines.push(`CLIPPING_POLYGON_REGIONS_LENGTH ${U.extentsCount}`)),D&&Pe.defines.push("COLOR_CORRECT"),p&&Pe.defines.push("HIGHLIGHT_FILL_TILE"),O&&we.defines.push("GEODETIC_SURFACE_NORMALS"),F&&we.defines.push("EXAGGERATION");let lt=` vec4 computeDayColor(vec4 initialColor, vec3 textureCoordinates, float nightBlend)
|
|
{
|
|
vec4 color = initialColor;
|
|
`;S&&(lt+=` vec4 cutoutAndColorResult;
|
|
bool texelUnclipped;
|
|
`);for(let We=0;We<i;++We)S?lt+=` cutoutAndColorResult = u_dayTextureCutoutRectangles[${We}];
|
|
texelUnclipped = v_textureCoordinates.x < cutoutAndColorResult.x || cutoutAndColorResult.z < v_textureCoordinates.x || v_textureCoordinates.y < cutoutAndColorResult.y || cutoutAndColorResult.w < v_textureCoordinates.y;
|
|
cutoutAndColorResult = sampleAndBlend(
|
|
`:lt+=` color = sampleAndBlend(
|
|
`,lt+=` color,
|
|
u_dayTextures[${We}],
|
|
u_dayTextureUseWebMercatorT[${We}] ? textureCoordinates.xz : textureCoordinates.xy,
|
|
u_dayTextureTexCoordsRectangle[${We}],
|
|
u_dayTextureTranslationAndScale[${We}],
|
|
${u?`u_dayTextureAlpha[${We}]`:"1.0"},
|
|
${h?`u_dayTextureNightAlpha[${We}]`:"1.0"},
|
|
${h?`u_dayTextureDayAlpha[${We}]`:"1.0"},
|
|
${o?`u_dayTextureBrightness[${We}]`:"0.0"},
|
|
${r?`u_dayTextureContrast[${We}]`:"0.0"},
|
|
${s?`u_dayTextureHue[${We}]`:"0.0"},
|
|
${a?`u_dayTextureSaturation[${We}]`:"0.0"},
|
|
${l?`u_dayTextureOneOverGamma[${We}]`:"0.0"},
|
|
${f?`u_dayTextureSplit[${We}]`:"0.0"},
|
|
${I?`u_colorsToAlpha[${We}]`:"vec4(0.0)"},
|
|
nightBlend );
|
|
`,S&&(lt+=` color = czm_branchFreeTernary(texelUnclipped, cutoutAndColorResult, color);
|
|
`);lt+=` return color;
|
|
}`,Pe.sources.push(lt),we.sources.push(lLe(pe)),we.sources.push(hLe(v));const ft=Jt.fromCache({context:t.context,vertexShaderSource:we,fragmentShaderSource:Pe,attributeLocations:q.getAttributeLocations()});ye=Ce[re]=new cLe(i,re,this.material,ft,de,fe)}return n.surfaceShader=ye,ye.shaderProgram};m1.prototype.destroy=function(){let e,t;const n=this._shadersByTexturesFlags;for(const i in n)if(n.hasOwnProperty(i)){const o=n[i];if(!c(o))continue;for(e in o)o.hasOwnProperty(e)&&(t=o[e],c(t)&&t.shaderProgram.destroy())}return ve(this)};const fLe={NONE:-1,PARTIAL:0,FULL:1},ir=Object.freeze(fLe);function Er(e,t,n,i,o,r,s){this.provider=e,this.message=t,this.x=n,this.y=i,this.level=o,this.timesRetried=y(r,0),this.retry=!1,this.error=s}Er.reportError=function(e,t,n,i,o,r,s,a){let l=e;return c(e)?(l.provider=t,l.message=i,l.x=o,l.y=r,l.level=s,l.retry=!1,l.error=a,++l.timesRetried):l=new Er(t,i,o,r,s,0,a),c(n)&&n.numberOfListeners>0?n.raiseEvent(l):c(t)&&console.log(`An error occurred in "${t.constructor.name}": ${DD(i)}`),l};Er.reportSuccess=function(e){c(e)&&(e.timesRetried=-1)};const pLe={UNLOADED:0,TRANSITIONING:1,RECEIVED:2,TEXTURE_LOADED:3,READY:4,FAILED:5,INVALID:6,PLACEHOLDER:7},Rn=Object.freeze(pLe),mLe={START:0,LOADING:1,DONE:2,FAILED:3},Mc=Object.freeze(mLe),_Le={FAILED:0,UNLOADED:1,RECEIVING:2,RECEIVED:3,TRANSFORMING:4,TRANSFORMED:5,READY:6},yi=Object.freeze(_Le);function Yn(){this.imagery=[],this.waterMaskTexture=void 0,this.waterMaskTranslationAndScale=new te(0,0,1,1),this.terrainData=void 0,this.vertexArray=void 0,this.tileBoundingRegion=void 0,this.occludeePointInScaledSpace=new d,this.boundingVolumeSourceTile=void 0,this.boundingVolumeIsFromMesh=!1,this.terrainState=yi.UNLOADED,this.mesh=void 0,this.fill=void 0,this.pickBoundingSphere=new se,this.surfaceShader=void 0,this.isClipped=!0,this.clippedByBoundaries=!1}Object.defineProperties(Yn.prototype,{eligibleForUnloading:{get:function(){const e=this.terrainState;let n=!(e===yi.RECEIVING||e===yi.TRANSFORMING);const i=this.imagery;for(let o=0,r=i.length;n&&o<r;++o){const s=i[o];n=!c(s.loadingImagery)||s.loadingImagery.state!==Rn.TRANSITIONING}return n}},renderedMesh:{get:function(){if(c(this.vertexArray))return this.mesh;if(c(this.fill))return this.fill.mesh}}});const gLe=new he;function hv(e,t,n,i,o,r){let s=e.getExaggeratedPosition(i,o,r);if(c(t)&&t!==oe.SCENE3D){const l=n.ellipsoid.cartesianToCartographic(s,gLe);s=n.project(l,r),s=d.fromElements(s.z,s.x,s.y,r)}return s}const yLe=new d,bLe=new d,TLe=new d;Yn.prototype.pick=function(e,t,n,i,o){const r=this.renderedMesh;if(!c(r))return;const s=r.vertices,a=r.indices,l=r.encoding,u=a.length;let h=Number.MAX_VALUE;for(let f=0;f<u;f+=3){const _=a[f],g=a[f+1],m=a[f+2],b=hv(l,t,n,s,_,yLe),T=hv(l,t,n,s,g,bLe),x=hv(l,t,n,s,m,TLe),C=Ei.rayTriangleParametric(e,b,T,x,i);c(C)&&C<h&&C>=0&&(h=C)}return h!==Number.MAX_VALUE?nn.getPoint(e,h,o):void 0};Yn.prototype.freeResources=function(){c(this.waterMaskTexture)&&(--this.waterMaskTexture.referenceCount,this.waterMaskTexture.referenceCount===0&&this.waterMaskTexture.destroy(),this.waterMaskTexture=void 0),this.terrainData=void 0,this.terrainState=yi.UNLOADED,this.mesh=void 0,this.fill=this.fill&&this.fill.destroy();const e=this.imagery;for(let t=0,n=e.length;t<n;++t)e[t].freeResources();this.imagery.length=0,this.freeVertexArray()};Yn.prototype.freeVertexArray=function(){Yn._freeVertexArray(this.vertexArray),this.vertexArray=void 0,Yn._freeVertexArray(this.wireframeVertexArray),this.wireframeVertexArray=void 0};Yn.initialize=function(e,t,n){let i=e.data;c(i)||(i=e.data=new Yn),e.state===Mc.START&&(ALe(e,t,n),e.state=Mc.LOADING)};Yn.processStateMachine=function(e,t,n,i,o,r,s){Yn.initialize(e,n,i);const a=e.data;if(e.state===Mc.LOADING&&xLe(e,t,n,i,o,r),s)return;const l=e.renderable;e.renderable=c(a.vertexArray);const u=a.terrainState===yi.READY;e.upsampledFromParent=c(a.terrainData)&&a.terrainData.wasCreatedByUpsampling();const h=a.processImagery(e,n,t);if(u&&h){const f=e._loadedCallbacks,_={};for(const g in f)f.hasOwnProperty(g)&&(f[g](e)||(_[g]=f[g]));e._loadedCallbacks=_,e.state=Mc.DONE}l&&(e.renderable=!0)};Yn.prototype.processImagery=function(e,t,n,i){const o=e.data;let r=e.upsampledFromParent,s=!1,a=!0;const l=o.imagery;let u,h;for(u=0,h=l.length;u<h;++u){const f=l[u];if(!c(f.loadingImagery)){r=!1;continue}if(f.loadingImagery.state===Rn.PLACEHOLDER){const g=f.loadingImagery.imageryLayer;if(g.ready){f.freeResources(),l.splice(u,1),g._createTileImagerySkeletons(e,t,u),--u,h=l.length;continue}else r=!1}const _=f.processStateMachine(e,n,i);a=a&&_,s=s||_||c(f.readyImagery),r=r&&c(f.loadingImagery)&&(f.loadingImagery.state===Rn.FAILED||f.loadingImagery.state===Rn.INVALID)}return e.upsampledFromParent=r,e.renderable=e.renderable&&(s||a),a};function C9(e,t,n,i){const o=e.renderedMesh,r=o.vertices,s=o.encoding,a=r.length/s.stride;let l=Oo.clone(s);l.hasGeodeticSurfaceNormals=t,l=Oo.clone(l);const u=l.stride,h=new Float32Array(a*u);t?s.addGeodeticSurfaceNormals(r,h,n):s.removeGeodeticSurfaceNormals(r,h),o.vertices=h,o.stride=u,o!==e.mesh?(Yn._freeVertexArray(e.fill.vertexArray),e.fill.vertexArray=Yn._createVertexArrayForMesh(i.context,o)):(Yn._freeVertexArray(e.vertexArray),e.vertexArray=Yn._createVertexArrayForMesh(i.context,o)),Yn._freeVertexArray(e.wireframeVertexArray),e.wireframeVertexArray=void 0}Yn.prototype.addGeodeticSurfaceNormals=function(e,t){C9(this,!0,e,t)};Yn.prototype.removeGeodeticSurfaceNormals=function(e){C9(this,!1,void 0,e)};Yn.prototype.updateExaggeration=function(e,t,n){const i=this,o=i.renderedMesh;if(o===void 0)return;const r=t.verticalExaggeration,s=t.verticalExaggerationRelativeHeight,a=r!==1,l=o.encoding,u=l.exaggeration!==r,h=l.exaggerationRelativeHeight!==s;if(u||h){if(u)if(a&&!l.hasGeodeticSurfaceNormals){const f=e.tilingScheme.ellipsoid;i.addGeodeticSurfaceNormals(f,t)}else!a&&l.hasGeodeticSurfaceNormals&&i.removeGeodeticSurfaceNormals(t);if(l.exaggeration=r,l.exaggerationRelativeHeight=s,n!==void 0){n._tileToUpdateHeights.push(e);const f=e.customData,_=f.length;for(let g=0;g<_;g++){const m=f[g];m.level=-1}}}};function ALe(e,t,n){let i=t.getTileDataAvailable(e.x,e.y,e.level);if(!c(i)&&c(e.parent)){const o=e.parent,r=o.data;c(r)&&c(r.terrainData)&&(i=r.terrainData.isChildAvailable(o.x,o.y,e.x,e.y))}i===!1&&(e.data.terrainState=yi.FAILED);for(let o=0,r=n.length;o<r;++o){const s=n.get(o);s.show&&s._createTileImagerySkeletons(e,t)}}function xLe(e,t,n,i,o,r){const s=e.data,a=e.parent;if(s.terrainState===yi.FAILED&&a!==void 0&&(a.data!==void 0&&a.data.terrainData!==void 0&&a.data.terrainData.canUpsample!==!1||Yn.processStateMachine(a,t,n,i,o,r,!0)),s.terrainState===yi.FAILED&&CLe(s,e,t,n,e.x,e.y,e.level),s.terrainState===yi.UNLOADED&&ELe(s,n,e.x,e.y,e.level),s.terrainState===yi.RECEIVED&&SLe(s,t,n,e.x,e.y,e.level),s.terrainState===yi.TRANSFORMED&&(vLe(s,t.context,n,e.x,e.y,e.level,r),s.updateExaggeration(e,t,o)),s.terrainState>=yi.RECEIVED&&s.waterMaskTexture===void 0&&n.hasWaterMask)if(s.terrainData.waterMask!==void 0)DLe(t.context,s);else{const u=s._findAncestorTileWithTerrainData(e);c(u)&&c(u.data.waterMaskTexture)&&(s.waterMaskTexture=u.data.waterMaskTexture,++s.waterMaskTexture.referenceCount,s._computeWaterMaskTranslationAndScale(e,u,s.waterMaskTranslationAndScale))}}function CLe(e,t,n,i,o,r,s){const a=t.parent;if(!a){t.state=Mc.FAILED;return}const l=a.data.terrainData,u=a.x,h=a.y,f=a.level;if(!c(l))return;const _=l.upsample(i.tilingScheme,u,h,f,o,r,s);!c(_)||(e.terrainState=yi.RECEIVING,Promise.resolve(_).then(function(g){!c(g)||(e.terrainData=g,e.terrainState=yi.RECEIVED)}).catch(function(){e.terrainState=yi.FAILED}))}function ELe(e,t,n,i,o){function r(l){if(!c(l)){e.terrainState=yi.UNLOADED,e.request=void 0;return}e.terrainData=l,e.terrainState=yi.RECEIVED,e.request=void 0}function s(l){if(e.request.state===di.CANCELLED){e.terrainData=void 0,e.terrainState=yi.UNLOADED,e.request=void 0;return}e.terrainState=yi.FAILED,e.request=void 0;const u=`Failed to obtain terrain tile X: ${n} Y: ${i} Level: ${o}. Error message: "${l}"`;t._requestError=Er.reportError(t._requestError,t,t.errorEvent,u,n,i,o),t._requestError.retry&&a()}function a(){const l=new iu({throttle:!1,throttleByServer:!0,type:Ip.TERRAIN});e.request=l;const u=t.requestTileGeometry(n,i,o,l);c(u)?(e.terrainState=yi.RECEIVING,Promise.resolve(u).then(function(h){r(h)}).catch(function(h){s(h)})):(e.terrainState=yi.UNLOADED,e.request=void 0)}a()}const wLe={tilingScheme:void 0,x:0,y:0,level:0,exaggeration:1,exaggerationRelativeHeight:0,throttle:!0};function SLe(e,t,n,i,o,r){const s=n.tilingScheme,a=wLe;a.tilingScheme=s,a.x=i,a.y=o,a.level=r,a.exaggeration=t.verticalExaggeration,a.exaggerationRelativeHeight=t.verticalExaggerationRelativeHeight,a.throttle=!0;const u=e.terrainData.createMesh(a);!c(u)||(e.terrainState=yi.TRANSFORMING,Promise.resolve(u).then(function(h){e.mesh=h,e.terrainState=yi.TRANSFORMED}).catch(function(){e.terrainState=yi.FAILED}))}Yn._createVertexArrayForMesh=function(e,t){const n=t.vertices,i=ct.createVertexBuffer({context:e,typedArray:n,usage:ke.STATIC_DRAW}),o=t.encoding.getAttributes(i),r=t.indices.indexBuffers||{};let s=r[e.id];if(!c(s)||s.isDestroyed()){const a=t.indices;s=ct.createIndexBuffer({context:e,typedArray:a,usage:ke.STATIC_DRAW,indexDatatype:je.fromSizeInBytes(a.BYTES_PER_ELEMENT)}),s.vertexArrayDestroyable=!1,s.referenceCount=1,r[e.id]=s,t.indices.indexBuffers=r}else++s.referenceCount;return new Ci({context:e,attributes:o,indexBuffer:s})};Yn._freeVertexArray=function(e){if(c(e)){const t=e.indexBuffer;e.isDestroyed()||e.destroy(),c(t)&&!t.isDestroyed()&&c(t.referenceCount)&&(--t.referenceCount,t.referenceCount===0&&t.destroy())}};function vLe(e,t,n,i,o,r,s){e.vertexArray=Yn._createVertexArrayForMesh(t,e.mesh),e.terrainState=yi.READY,e.fill=e.fill&&e.fill.destroy(s)}function ILe(e){let t=e.cache.tile_waterMaskData;if(!c(t)){const n=xt.create({context:e,pixelFormat:Ve.LUMINANCE,pixelDatatype:Me.UNSIGNED_BYTE,source:{arrayBufferView:new Uint8Array([255]),width:1,height:1}});n.referenceCount=1;const i=new un({wrapS:Fn.CLAMP_TO_EDGE,wrapT:Fn.CLAMP_TO_EDGE,minificationFilter:en.LINEAR,magnificationFilter:Yo.LINEAR});t={allWaterTexture:n,sampler:i,destroy:function(){this.allWaterTexture.destroy()}},e.cache.tile_waterMaskData=t}return t}function DLe(e,t){const n=t.terrainData.waterMask,i=ILe(e);let o;const r=n.length;if(r===1)if(n[0]!==0)o=i.allWaterTexture;else return;else{const s=Math.sqrt(r);o=xt.create({context:e,pixelFormat:Ve.LUMINANCE,pixelDatatype:Me.UNSIGNED_BYTE,source:{width:s,height:s,arrayBufferView:n},sampler:i.sampler,flipY:!1}),o.referenceCount=0}++o.referenceCount,t.waterMaskTexture=o,te.fromElements(0,0,1,1,t.waterMaskTranslationAndScale)}Yn.prototype._findAncestorTileWithTerrainData=function(e){let t=e.parent;for(;c(t)&&(!c(t.data)||!c(t.data.terrainData)||t.data.terrainData.wasCreatedByUpsampling());)t=t.parent;return t};Yn.prototype._computeWaterMaskTranslationAndScale=function(e,t,n){const i=t.rectangle,o=e.rectangle,r=o.width,s=o.height,a=r/i.width,l=s/i.height;return n.x=a*(o.west-i.west)/r,n.y=l*(o.south-i.south)/s,n.z=a,n.w=l,n};function ws(e){if(e=y(e,y.EMPTY_OBJECT),this._ellipsoid=y(e.ellipsoid,ae.WGS84),this._numberOfLevelZeroTilesX=y(e.numberOfLevelZeroTilesX,1),this._numberOfLevelZeroTilesY=y(e.numberOfLevelZeroTilesY,1),this._projection=new vn(this._ellipsoid),c(e.rectangleSouthwestInMeters)&&c(e.rectangleNortheastInMeters))this._rectangleSouthwestInMeters=e.rectangleSouthwestInMeters,this._rectangleNortheastInMeters=e.rectangleNortheastInMeters;else{const i=this._ellipsoid.maximumRadius*Math.PI;this._rectangleSouthwestInMeters=new H(-i,-i),this._rectangleNortheastInMeters=new H(i,i)}const t=this._projection.unproject(this._rectangleSouthwestInMeters),n=this._projection.unproject(this._rectangleNortheastInMeters);this._rectangle=new ce(t.longitude,t.latitude,n.longitude,n.latitude)}Object.defineProperties(ws.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},rectangle:{get:function(){return this._rectangle}},projection:{get:function(){return this._projection}}});ws.prototype.getNumberOfXTilesAtLevel=function(e){return this._numberOfLevelZeroTilesX<<e};ws.prototype.getNumberOfYTilesAtLevel=function(e){return this._numberOfLevelZeroTilesY<<e};ws.prototype.rectangleToNativeRectangle=function(e,t){const n=this._projection,i=n.project(ce.southwest(e)),o=n.project(ce.northeast(e));return c(t)?(t.west=i.x,t.south=i.y,t.east=o.x,t.north=o.y,t):new ce(i.x,i.y,o.x,o.y)};ws.prototype.tileXYToNativeRectangle=function(e,t,n,i){const o=this.getNumberOfXTilesAtLevel(n),r=this.getNumberOfYTilesAtLevel(n),s=(this._rectangleNortheastInMeters.x-this._rectangleSouthwestInMeters.x)/o,a=this._rectangleSouthwestInMeters.x+e*s,l=this._rectangleSouthwestInMeters.x+(e+1)*s,u=(this._rectangleNortheastInMeters.y-this._rectangleSouthwestInMeters.y)/r,h=this._rectangleNortheastInMeters.y-t*u,f=this._rectangleNortheastInMeters.y-(t+1)*u;return c(i)?(i.west=a,i.south=f,i.east=l,i.north=h,i):new ce(a,f,l,h)};ws.prototype.tileXYToRectangle=function(e,t,n,i){const o=this.tileXYToNativeRectangle(e,t,n,i),r=this._projection,s=r.unproject(new H(o.west,o.south)),a=r.unproject(new H(o.east,o.north));return o.west=s.longitude,o.south=s.latitude,o.east=a.longitude,o.north=a.latitude,o};ws.prototype.positionToTileXY=function(e,t,n){const i=this._rectangle;if(!ce.contains(i,e))return;const o=this.getNumberOfXTilesAtLevel(t),r=this.getNumberOfYTilesAtLevel(t),a=(this._rectangleNortheastInMeters.x-this._rectangleSouthwestInMeters.x)/o,u=(this._rectangleNortheastInMeters.y-this._rectangleSouthwestInMeters.y)/r,f=this._projection.project(e),_=f.x-this._rectangleSouthwestInMeters.x,g=this._rectangleNortheastInMeters.y-f.y;let m=_/a|0;m>=o&&(m=o-1);let b=g/u|0;return b>=r&&(b=r-1),c(n)?(n.x=m,n.y=b,n):new H(m,b)};let fv;const E9="AAPK809db8a668914f14bf886dcf16d4dc82Hm5SsO4xOJY2n4-V_ypQyxlGKJRQugNnPIslyTLkk5-HHQl9BRpgdNXaKNGe7oxx",eg={};eg.defaultAccessToken=E9;eg.defaultWorldImageryServer=new Ae({url:"https://ibasemaps-api.arcgis.com/arcgis/rest/services/World_Imagery/MapServer"});eg.defaultWorldHillshadeServer=new Ae({url:"https://ibasemaps-api.arcgis.com/arcgis/rest/services/Elevation/World_Hillshade/MapServer"});eg.defaultWorldOceanServer=new Ae({url:"https://ibasemaps-api.arcgis.com/arcgis/rest/services/Ocean/World_Ocean_Base/MapServer"});eg.getDefaultTokenCredit=function(e){if(e===E9){if(!c(fv)){const t='<b> This application is using a default ArcGIS access token. Please assign <i>Cesium.ArcGisMapService.defaultAccessToken</i> with an API key from your ArcGIS Developer account before using the ArcGIS tile services. You can sign up for a free ArcGIS Developer account at <a href="https://developers.arcgis.com/">https://developers.arcgis.com/</a>.</b>';fv=new Wt(t,!0)}return fv}};const Mu=eg;function _1(e){if(e=y(e,y.EMPTY_OBJECT),!c(e.missingImageUrl))throw new E("options.missingImageUrl is required.");if(!c(e.pixelsToCheck))throw new E("options.pixelsToCheck is required.");this._pixelsToCheck=e.pixelsToCheck,this._missingImagePixels=void 0,this._missingImageByteLength=void 0,this._isReady=!1;const t=Ae.createIfNeeded(e.missingImageUrl),n=this;function i(r){c(r.blob)&&(n._missingImageByteLength=r.blob.size);let s=Ax(r);if(e.disableCheckIfAllPixelsAreTransparent){let a=!0;const l=r.width,u=e.pixelsToCheck;for(let h=0,f=u.length;a&&h<f;++h){const _=u[h],g=_.x*4+_.y*l;s[g+3]>0&&(a=!1)}a&&(s=void 0)}n._missingImagePixels=s,n._isReady=!0}function o(){n._missingImagePixels=void 0,n._isReady=!0}t.fetchImage({preferBlob:!0,preferImageBitmap:!0,flipY:!0}).then(i).catch(o)}_1.prototype.isReady=function(){return this._isReady};_1.prototype.shouldDiscardImage=function(e){if(!this._isReady)throw new E("shouldDiscardImage must not be called before the discard policy is ready.");const t=this._pixelsToCheck,n=this._missingImagePixels;if(!c(n)||c(e.blob)&&e.blob.size!==this._missingImageByteLength)return!1;const i=Ax(e),o=e.width;for(let r=0,s=t.length;r<s;++r){const a=t[r],l=a.x*4+a.y*o;for(let u=0;u<4;++u){const h=l+u;if(i[h]!==n[h])return!1}}return!0};function of(){this.name=void 0,this.description=void 0,this.position=void 0,this.data=void 0,this.imageryLayer=void 0}of.prototype.configureNameFromProperties=function(e){let t=10,n;for(const i in e)if(e.hasOwnProperty(i)&&e[i]){const o=i.toLowerCase();t>1&&o==="name"?(t=1,n=i):t>2&&o==="title"?(t=2,n=i):t>3&&/name/i.test(i)?(t=3,n=i):t>4&&/title/i.test(i)&&(t=4,n=i)}c(n)&&(this.name=e[n])};of.prototype.configureDescriptionFromProperties=function(e){function t(n){let i='<table class="cesium-infoBox-defaultTable">';for(const o in n)if(n.hasOwnProperty(o)){const r=n[o];c(r)&&(typeof r=="object"?i+=`<tr><td>${o}</td><td>${t(r)}</td></tr>`:i+=`<tr><td>${o}</td><td>${r}</td></tr>`)}return i+="</table>",i}this.description=t(e)};function Bl(){E.throwInstantiationError()}Object.defineProperties(Bl.prototype,{rectangle:{get:E.throwInstantiationError},tileWidth:{get:E.throwInstantiationError},tileHeight:{get:E.throwInstantiationError},maximumLevel:{get:E.throwInstantiationError},minimumLevel:{get:E.throwInstantiationError},tilingScheme:{get:E.throwInstantiationError},tileDiscardPolicy:{get:E.throwInstantiationError},errorEvent:{get:E.throwInstantiationError},credit:{get:E.throwInstantiationError},proxy:{get:E.throwInstantiationError},hasAlphaChannel:{get:E.throwInstantiationError}});Bl.prototype.getTileCredits=function(e,t,n){E.throwInstantiationError()};Bl.prototype.requestImage=function(e,t,n,i){E.throwInstantiationError()};Bl.prototype.pickFeatures=function(e,t,n,i,o){E.throwInstantiationError()};const PLe=/\.ktx2$/i;Bl.loadImage=function(e,t){A.defined("url",t);const n=Ae.createIfNeeded(t);return PLe.test(n.url)?Op(n):c(e)&&c(e.tileDiscardPolicy)?n.fetchImage({preferBlob:!0,preferImageBitmap:!0,flipY:!0}):n.fetchImage({preferImageBitmap:!0,flipY:!0})};const OLe={SATELLITE:1,OCEANS:2,HILLSHADE:3},g_=Object.freeze(OLe);function w9(e){this.useTiles=y(e.usePreCachedTilesIfAvailable,!0);const t=e.ellipsoid;this.tilingScheme=y(e.tilingScheme,new Yr({ellipsoid:t})),this.rectangle=y(e.rectangle,this.tilingScheme.rectangle),this.ellipsoid=t;let n=e.credit;typeof n=="string"&&(n=new Wt(n)),this.credit=n,this.tileCredits=void 0,this.tileDiscardPolicy=e.tileDiscardPolicy,this.tileWidth=y(e.tileWidth,256),this.tileHeight=y(e.tileHeight,256),this.maximumLevel=e.maximumLevel}w9.prototype.build=function(e){e._useTiles=this.useTiles,e._tilingScheme=this.tilingScheme,e._rectangle=this.rectangle,e._credit=this.credit,e._tileCredits=this.tileCredits,e._tileDiscardPolicy=this.tileDiscardPolicy,e._tileWidth=this.tileWidth,e._tileHeight=this.tileHeight,e._maximumLevel=this.maximumLevel,this.useTiles&&!c(this.tileDiscardPolicy)&&(e._tileDiscardPolicy=new _1({missingImageUrl:S9(e,0,0,this.maximumLevel).url,pixelsToCheck:[new H(0,0),new H(200,20),new H(20,200),new H(80,110),new H(160,130)],disableCheckIfAllPixelsAreTransparent:!0}))};function LLe(e,t){const n=e.tileInfo;if(!c(n))t.useTiles=!1;else{if(t.tileWidth=n.rows,t.tileHeight=n.cols,n.spatialReference.wkid===102100||n.spatialReference.wkid===102113)t.tilingScheme=new ws({ellipsoid:t.ellipsoid});else if(e.tileInfo.spatialReference.wkid===4326)t.tilingScheme=new Yr({ellipsoid:t.ellipsoid});else{const i=`Tile spatial reference WKID ${e.tileInfo.spatialReference.wkid} is not supported.`;throw new Te(i)}if(t.maximumLevel=e.tileInfo.lods.length-1,c(e.fullExtent)){if(c(e.fullExtent.spatialReference)&&c(e.fullExtent.spatialReference.wkid))if(e.fullExtent.spatialReference.wkid===102100||e.fullExtent.spatialReference.wkid===102113){const i=new vn,o=e.fullExtent,r=i.unproject(new d(Math.max(o.xmin,-t.tilingScheme.ellipsoid.maximumRadius*Math.PI),Math.max(o.ymin,-t.tilingScheme.ellipsoid.maximumRadius*Math.PI),0)),s=i.unproject(new d(Math.min(o.xmax,t.tilingScheme.ellipsoid.maximumRadius*Math.PI),Math.min(o.ymax,t.tilingScheme.ellipsoid.maximumRadius*Math.PI),0));t.rectangle=new ce(r.longitude,r.latitude,s.longitude,s.latitude)}else if(e.fullExtent.spatialReference.wkid===4326)t.rectangle=ce.fromDegrees(e.fullExtent.xmin,e.fullExtent.ymin,e.fullExtent.xmax,e.fullExtent.ymax);else{const i=`fullExtent.spatialReference WKID ${e.fullExtent.spatialReference.wkid} is not supported.`;throw new Te(i)}}else t.rectangle=t.tilingScheme.rectangle;t.useTiles=!0}c(e.copyrightText)&&e.copyrightText.length>0&&(c(t.credit)?t.tileCredits=[new Wt(e.copyrightText)]:t.credit=new Wt(e.copyrightText))}function RLe(e,t){let n=`An error occurred while accessing ${e.url}`;throw c(t)&&c(t.message)&&(n+=`: ${t.message}`),new Te(n)}async function NLe(e,t){const n=e.getDerivedResource({queryParameters:{f:"json"}});try{const i=await n.fetchJson();LLe(i,t)}catch(i){RLe(e,i)}}function Oa(e){e=y(e,y.EMPTY_OBJECT),this._defaultAlpha=void 0,this._defaultNightAlpha=void 0,this._defaultDayAlpha=void 0,this._defaultBrightness=void 0,this._defaultContrast=void 0,this._defaultHue=void 0,this._defaultSaturation=void 0,this._defaultGamma=void 0,this._defaultMinificationFilter=void 0,this._defaultMagnificationFilter=void 0,this._tileDiscardPolicy=e.tileDiscardPolicy,this._tileWidth=y(e.tileWidth,256),this._tileHeight=y(e.tileHeight,256),this._maximumLevel=e.maximumLevel,this._tilingScheme=y(e.tilingScheme,new Yr({ellipsoid:e.ellipsoid})),this._useTiles=y(e.usePreCachedTilesIfAvailable,!0),this._rectangle=y(e.rectangle,this._tilingScheme.rectangle),this._layers=e.layers,this._credit=e.credit,this._tileCredits=void 0;let t=e.credit;typeof t=="string"&&(t=new Wt(t)),this.enablePickFeatures=y(e.enablePickFeatures,!0),this._errorEvent=new Le}Oa.fromBasemapType=async function(e,t){A.defined("style",e),t=y(t,y.EMPTY_OBJECT);let n,i,o;switch(e){case g_.SATELLITE:{n=y(t.token,Mu.defaultAccessToken),i=Ae.createIfNeeded(Mu.defaultWorldImageryServer),i.appendForwardSlash();const r=Mu.getDefaultTokenCredit(n);c(r)&&(o=Wt.clone(r))}break;case g_.OCEANS:{n=y(t.token,Mu.defaultAccessToken),i=Ae.createIfNeeded(Mu.defaultWorldOceanServer),i.appendForwardSlash();const r=Mu.getDefaultTokenCredit(n);c(r)&&(o=Wt.clone(r))}break;case g_.HILLSHADE:{n=y(t.token,Mu.defaultAccessToken),i=Ae.createIfNeeded(Mu.defaultWorldHillshadeServer),i.appendForwardSlash();const r=Mu.getDefaultTokenCredit(n);c(r)&&(o=Wt.clone(r))}break;default:throw new E(`Unsupported basemap type: ${e}`)}return Oa.fromUrl(i,{...t,token:n,credit:o,usePreCachedTilesIfAvailable:!0})};function S9(e,t,n,i,o){let r;if(e._useTiles)r=e._resource.getDerivedResource({url:`tile/${i}/${n}/${t}`,request:o});else{const s=e._tilingScheme.tileXYToNativeRectangle(t,n,i),l={bbox:`${s.west},${s.south},${s.east},${s.north}`,size:`${e._tileWidth},${e._tileHeight}`,format:"png32",transparent:!0,f:"image"};e._tilingScheme.projection instanceof co?(l.bboxSR=4326,l.imageSR=4326):(l.bboxSR=3857,l.imageSR=3857),e.layers&&(l.layers=`show:${e.layers}`),r=e._resource.getDerivedResource({url:"export",request:o,queryParameters:l})}return r}Object.defineProperties(Oa.prototype,{url:{get:function(){return this._resource._url}},token:{get:function(){return this._resource.queryParameters.token}},proxy:{get:function(){return this._resource.proxy}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){return this._maximumLevel}},minimumLevel:{get:function(){return 0}},tilingScheme:{get:function(){return this._tilingScheme}},rectangle:{get:function(){return this._rectangle}},tileDiscardPolicy:{get:function(){return this._tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){return this._credit}},usingPrecachedTiles:{get:function(){return this._useTiles}},hasAlphaChannel:{get:function(){return!0}},layers:{get:function(){return this._layers}}});Oa.fromUrl=async function(e,t){A.defined("url",e),t=y(t,y.EMPTY_OBJECT);const n=Ae.createIfNeeded(e);n.appendForwardSlash(),c(t.token)&&n.setQueryParameters({token:t.token});const i=new Oa(t);i._resource=n;const o=new w9(t);return y(t.usePreCachedTilesIfAvailable,!0)&&await NLe(n,o),o.build(i),i};Oa.prototype.getTileCredits=function(e,t,n){return this._tileCredits};Oa.prototype.requestImage=function(e,t,n,i){return Bl.loadImage(this,S9(this,e,t,n,i))};Oa.prototype.pickFeatures=function(e,t,n,i,o){if(!this.enablePickFeatures)return;const r=this._tilingScheme.tileXYToNativeRectangle(e,t,n);let s,a,l;if(this._tilingScheme.projection instanceof co)s=R.toDegrees(i),a=R.toDegrees(o),l="4326";else{const _=this._tilingScheme.projection.project(new he(i,o,0));s=_.x,a=_.y,l="3857"}let u="visible";c(this._layers)&&(u+=`:${this._layers}`);const h={f:"json",tolerance:2,geometryType:"esriGeometryPoint",geometry:`${s},${a}`,mapExtent:`${r.west},${r.south},${r.east},${r.north}`,imageDisplay:`${this._tileWidth},${this._tileHeight},96`,sr:l,layers:u};return this._resource.getDerivedResource({url:"identify",queryParameters:h}).fetchJson().then(function(_){const g=[],m=_.results;if(!c(m))return g;for(let b=0;b<m.length;++b){const T=m[b],x=new of;if(x.data=T,x.name=T.value,x.properties=T.attributes,x.configureDescriptionFromProperties(T.attributes),T.geometryType==="esriGeometryPoint"&&T.geometry){const C=T.geometry.spatialReference&&T.geometry.spatialReference.wkid?T.geometry.spatialReference.wkid:4326;if(C===4326||C===4283)x.position=he.fromDegrees(T.geometry.x,T.geometry.y,T.geometry.z);else if(C===102100||C===900913||C===3857){const w=new vn;x.position=w.unproject(new d(T.geometry.x,T.geometry.y,T.geometry.z))}}g.push(x)}return g})};Oa._metadataCache={};const MLe={AERIAL:"Aerial",AERIAL_WITH_LABELS:"AerialWithLabels",AERIAL_WITH_LABELS_ON_DEMAND:"AerialWithLabelsOnDemand",ROAD:"Road",ROAD_ON_DEMAND:"RoadOnDemand",CANVAS_DARK:"CanvasDark",CANVAS_LIGHT:"CanvasLight",CANVAS_GRAY:"CanvasGray",ORDNANCE_SURVEY:"OrdnanceSurvey",COLLINS_BART:"CollinsBart"},v9=Object.freeze(MLe);function B_(e){}B_.prototype.isReady=function(){return!0};B_.prototype.shouldDiscardImage=function(e){return B_.EMPTY_IMAGE===e};let XT;Object.defineProperties(B_,{EMPTY_IMAGE:{get:function(){return c(XT)||(XT=new Image,XT.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII="),XT}}});function I9(e){this.tileWidth=void 0,this.tileHeight=void 0,this.maximumLevel=void 0,this.imageUrlSubdomains=void 0,this.imageUrlTemplate=void 0,this.attributionList=void 0}I9.prototype.build=function(e){e._tileWidth=this.tileWidth,e._tileHeight=this.tileHeight,e._maximumLevel=this.maximumLevel,e._imageUrlSubdomains=this.imageUrlSubdomains,e._imageUrlTemplate=this.imageUrlTemplate;let t=e._attributionList=this.attributionList;t||(t=[]),e._attributionList=t;for(let n=0,i=t.length;n<i;++n){const o=t[n];if(o.credit instanceof Wt)break;o.credit=new Wt(o.attribution);const r=o.coverageAreas;for(let s=0,a=o.coverageAreas.length;s<a;++s){const l=r[s],u=l.bbox;l.bbox=new ce(R.toRadians(u[1]),R.toRadians(u[0]),R.toRadians(u[3]),R.toRadians(u[2]))}}};function FLe(e,t){if(e.resourceSets.length!==1)throw new Te("metadata does not specify one resource in resourceSets");const n=e.resourceSets[0].resources[0];t.tileWidth=n.imageWidth,t.tileHeight=n.imageHeight,t.maximumLevel=n.zoomMax-1,t.imageUrlSubdomains=n.imageUrlSubdomains,t.imageUrlTemplate=n.imageUrl,t.attributionList=n.imageryProviders}function BLe(e,t,n){let i=`An error occurred while accessing ${e.url}`;throw c(t)&&c(t.message)&&(i+=`: ${t.message}`),Er.reportError(void 0,n,c(n)?n._errorEvent:void 0,i,void 0,void 0,void 0,t),new Te(i)}async function zLe(e,t,n){const i=e.url;let o=Ho._metadataCache[i];c(o)||(o=e.fetchJsonp("jsonp"),Ho._metadataCache[i]=o);try{const r=await o;return FLe(r,t)}catch(r){BLe(e,r,n)}}function Ho(e){e=y(e,y.EMPTY_OBJECT),this._defaultAlpha=void 0,this._defaultNightAlpha=void 0,this._defaultDayAlpha=void 0,this._defaultBrightness=void 0,this._defaultContrast=void 0,this._defaultHue=void 0,this._defaultSaturation=void 0,this._defaultGamma=1,this._defaultMinificationFilter=void 0,this._defaultMagnificationFilter=void 0,this._mapStyle=y(e.mapStyle,v9.AERIAL),this._mapLayer=e.mapLayer,this._culture=y(e.culture,""),this._key=e.key,this._tileDiscardPolicy=e.tileDiscardPolicy,c(this._tileDiscardPolicy)||(this._tileDiscardPolicy=new B_),this._proxy=e.proxy,this._credit=new Wt(`<a href="https://www.microsoft.com/en-us/maps/product/enduserterms"><img src="${Ho.logoUrl}" title="Bing Imagery"/></a>`),this._tilingScheme=new ws({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:2,ellipsoid:e.ellipsoid}),this._tileWidth=void 0,this._tileHeight=void 0,this._maximumLevel=void 0,this._imageUrlTemplate=void 0,this._imageUrlSubdomains=void 0,this._attributionList=void 0,this._errorEvent=new Le}Object.defineProperties(Ho.prototype,{url:{get:function(){return this._resource.url}},proxy:{get:function(){return this._resource.proxy}},key:{get:function(){return this._key}},mapStyle:{get:function(){return this._mapStyle}},mapLayer:{get:function(){return this._mapLayer}},culture:{get:function(){return this._culture}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){return this._maximumLevel}},minimumLevel:{get:function(){return 0}},tilingScheme:{get:function(){return this._tilingScheme}},rectangle:{get:function(){return this._tilingScheme.rectangle}},tileDiscardPolicy:{get:function(){return this._tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return c(this.mapLayer)}}});Ho.fromUrl=async function(e,t){t=y(t,y.EMPTY_OBJECT),A.defined("url",e),A.defined("options.key",t.key);let n=t.tileProtocol;c(n)?n.length>0&&n[n.length-1]===":"&&(n=n.substr(0,n.length-1)):n=document.location.protocol==="http:"?"http":"https";const i=y(t.mapStyle,v9.AERIAL),o=Ae.createIfNeeded(e);o.appendForwardSlash();const r={incl:"ImageryProviders",key:t.key,uriScheme:n};c(t.mapLayer)&&(r.mapLayer=t.mapLayer),c(t.culture)&&(r.culture=t.culture);const s=o.getDerivedResource({url:`REST/v1/Imagery/Metadata/${i}`,queryParameters:r}),a=new Ho(t);a._resource=o;const l=new I9;return await zLe(s,l),l.build(a),a};const ULe=new ce;Ho.prototype.getTileCredits=function(e,t,n){const i=this._tilingScheme.tileXYToRectangle(e,t,n,ULe);return HLe(this._attributionList,n,i)};Ho.prototype.requestImage=function(e,t,n,i){const o=Bl.loadImage(this,kLe(this,e,t,n,i));if(c(o))return o.catch(function(r){return c(r.blob)&&r.blob.size===0?B_.EMPTY_IMAGE:Promise.reject(r)})};Ho.prototype.pickFeatures=function(e,t,n,i,o){};Ho.tileXYToQuadKey=function(e,t,n){let i="";for(let o=n;o>=0;--o){const r=1<<o;let s=0;(e&r)!==0&&(s|=1),(t&r)!==0&&(s|=2),i+=s}return i};Ho.quadKeyToTileXY=function(e){let t=0,n=0;const i=e.length-1;for(let o=i;o>=0;--o){const r=1<<o,s=+e[i-o];(s&1)!==0&&(t|=r),(s&2)!==0&&(n|=r)}return{x:t,y:n,level:i}};Ho._logoUrl=void 0;Object.defineProperties(Ho,{logoUrl:{get:function(){return c(Ho._logoUrl)||(Ho._logoUrl=Zt("Assets/Images/bing_maps_credit.png")),Ho._logoUrl},set:function(e){A.defined("value",e),Ho._logoUrl=e}}});function kLe(e,t,n,i,o){const r=e._imageUrlTemplate,s=e._imageUrlSubdomains,a=(t+n+i)%s.length;return e._resource.getDerivedResource({url:r,request:o,templateValues:{quadkey:Ho.tileXYToQuadKey(t,n,i),subdomain:s[a],culture:e._culture},queryParameters:{n:"z"}})}const VLe=new ce;function HLe(e,t,n){++t;const i=[];for(let o=0,r=e.length;o<r;++o){const s=e[o],a=s.coverageAreas;let l=!1;for(let u=0,h=s.coverageAreas.length;!l&&u<h;++u){const f=a[u];if(t>=f.zoomMin&&t<=f.zoomMax){const _=ce.intersection(n,f.bbox,VLe);c(_)&&(l=!0)}}l&&i.push(s.credit)}return i}Ho._metadataCache={};const D9=/{[^}]+}/g,P9={x:qLe,y:$Le,z:KLe,s:ZLe,reverseX:YLe,reverseY:XLe,reverseZ:QLe,westDegrees:JLe,southDegrees:eRe,eastDegrees:tRe,northDegrees:nRe,westProjected:iRe,southProjected:oRe,eastProjected:rRe,northProjected:sRe,width:aRe,height:cRe},GLe=jt(P9,{i:lRe,j:uRe,reverseI:dRe,reverseJ:hRe,longitudeDegrees:pRe,latitudeDegrees:mRe,longitudeProjected:_Re,latitudeProjected:gRe,format:bRe});function zl(e){e=y(e,y.EMPTY_OBJECT),this._errorEvent=new Le,A.defined("options.url",e.url);const t=Ae.createIfNeeded(e.url),n=Ae.createIfNeeded(e.pickFeaturesUrl);this._resource=t,this._urlSchemeZeroPadding=e.urlSchemeZeroPadding,this._getFeatureInfoFormats=e.getFeatureInfoFormats,this._pickFeaturesResource=n;let i=e.subdomains;Array.isArray(i)?i=i.slice():c(i)&&i.length>0?i=i.split(""):i=["a","b","c"],this._subdomains=i,this._tileWidth=y(e.tileWidth,256),this._tileHeight=y(e.tileHeight,256),this._minimumLevel=y(e.minimumLevel,0),this._maximumLevel=e.maximumLevel,this._tilingScheme=y(e.tilingScheme,new ws({ellipsoid:e.ellipsoid})),this._rectangle=y(e.rectangle,this._tilingScheme.rectangle),this._rectangle=ce.intersection(this._rectangle,this._tilingScheme.rectangle),this._tileDiscardPolicy=e.tileDiscardPolicy;let o=e.credit;typeof o=="string"&&(o=new Wt(o)),this._credit=o,this._hasAlphaChannel=y(e.hasAlphaChannel,!0);const r=e.customTags,s=jt(P9,r),a=jt(GLe,r);this._tags=s,this._pickFeaturesTags=a,this._defaultAlpha=void 0,this._defaultNightAlpha=void 0,this._defaultDayAlpha=void 0,this._defaultBrightness=void 0,this._defaultContrast=void 0,this._defaultHue=void 0,this._defaultSaturation=void 0,this._defaultGamma=void 0,this._defaultMinificationFilter=void 0,this._defaultMagnificationFilter=void 0,this.enablePickFeatures=y(e.enablePickFeatures,!0)}Object.defineProperties(zl.prototype,{url:{get:function(){return this._resource.url}},urlSchemeZeroPadding:{get:function(){return this._urlSchemeZeroPadding}},pickFeaturesUrl:{get:function(){return this._pickFeaturesResource.url}},proxy:{get:function(){return this._resource.proxy}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){return this._maximumLevel}},minimumLevel:{get:function(){return this._minimumLevel}},tilingScheme:{get:function(){return this._tilingScheme}},rectangle:{get:function(){return this._rectangle}},tileDiscardPolicy:{get:function(){return this._tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return this._hasAlphaChannel}}});zl.prototype.getTileCredits=function(e,t,n){};zl.prototype.requestImage=function(e,t,n,i){return Bl.loadImage(this,jLe(this,e,t,n,i))};zl.prototype.pickFeatures=function(e,t,n,i,o){if(!this.enablePickFeatures||!c(this._pickFeaturesResource)||this._getFeatureInfoFormats.length===0)return;let r=0;const s=this;function a(u,h){return u.callback(h)}function l(){if(r>=s._getFeatureInfoFormats.length)return Promise.resolve([]);const u=s._getFeatureInfoFormats[r],h=WLe(s,e,t,n,i,o,u.format);return++r,u.type==="json"?h.fetchJson().then(u.callback).catch(l):u.type==="xml"?h.fetchXML().then(u.callback).catch(l):u.type==="text"||u.type==="html"?h.fetchText().then(u.callback).catch(l):h.fetch({responseType:u.format}).then(a.bind(void 0,u)).catch(l)}return l()};let nC=!1;const _a=new ce;let iC=!1;const rb=new ce;function jLe(e,t,n,i,o){nC=!1,iC=!1;const r=e._resource,s=r.getUrlComponent(!0),a=e._tags,l={},u=s.match(D9);return c(u)&&u.forEach(function(h){const f=h.substring(1,h.length-1);c(a[f])&&(l[f]=a[f](e,t,n,i))}),r.getDerivedResource({request:o,templateValues:l})}let OD=!1;const z_=new H;let LD=!1;function WLe(e,t,n,i,o,r,s){nC=!1,iC=!1,OD=!1,LD=!1;const a=e._pickFeaturesResource,l=a.getUrlComponent(!0),u=e._pickFeaturesTags,h={},f=l.match(D9);return c(f)&&f.forEach(function(_){const g=_.substring(1,_.length-1);c(u[g])&&(h[g]=u[g](e,t,n,i,o,r,s))}),a.getDerivedResource({templateValues:h})}function tg(e,t,n){if(e&&e.urlSchemeZeroPadding&&e.urlSchemeZeroPadding.hasOwnProperty(t)){const i=e.urlSchemeZeroPadding[t];if(typeof i=="string"){const o=i.length;o>1&&(n=n.length>=o?n:new Array(o-n.toString().length+1).join("0")+n)}}return n}function qLe(e,t,n,i){return tg(e,"{x}",t)}function YLe(e,t,n,i){const o=e.tilingScheme.getNumberOfXTilesAtLevel(i)-t-1;return tg(e,"{reverseX}",o)}function $Le(e,t,n,i){return tg(e,"{y}",n)}function XLe(e,t,n,i){const o=e.tilingScheme.getNumberOfYTilesAtLevel(i)-n-1;return tg(e,"{reverseY}",o)}function QLe(e,t,n,i){const o=e.maximumLevel,r=c(o)&&i<o?o-i-1:i;return tg(e,"{reverseZ}",r)}function KLe(e,t,n,i){return tg(e,"{z}",i)}function ZLe(e,t,n,i){const o=(t+n+i)%e._subdomains.length;return e._subdomains[o]}function $C(e,t,n,i){nC||(e.tilingScheme.tileXYToRectangle(t,n,i,_a),_a.west=R.toDegrees(_a.west),_a.south=R.toDegrees(_a.south),_a.east=R.toDegrees(_a.east),_a.north=R.toDegrees(_a.north),nC=!0)}function JLe(e,t,n,i){return $C(e,t,n,i),_a.west}function eRe(e,t,n,i){return $C(e,t,n,i),_a.south}function tRe(e,t,n,i){return $C(e,t,n,i),_a.east}function nRe(e,t,n,i){return $C(e,t,n,i),_a.north}function XC(e,t,n,i){iC||(e.tilingScheme.tileXYToNativeRectangle(t,n,i,rb),iC=!0)}function iRe(e,t,n,i){return XC(e,t,n,i),rb.west}function oRe(e,t,n,i){return XC(e,t,n,i),rb.south}function rRe(e,t,n,i){return XC(e,t,n,i),rb.east}function sRe(e,t,n,i){return XC(e,t,n,i),rb.north}function aRe(e,t,n,i){return e.tileWidth}function cRe(e,t,n,i){return e.tileHeight}function lRe(e,t,n,i,o,r,s){return QC(e,t,n,i,o,r),z_.x}function uRe(e,t,n,i,o,r,s){return QC(e,t,n,i,o,r),z_.y}function dRe(e,t,n,i,o,r,s){return QC(e,t,n,i,o,r),e.tileWidth-z_.x-1}function hRe(e,t,n,i,o,r,s){return QC(e,t,n,i,o,r),e.tileHeight-z_.y-1}const fRe=new ce,y_=new d;function QC(e,t,n,i,o,r,s){if(OD)return;g1(e,t,n,i,o,r);const a=y_,l=e.tilingScheme.tileXYToNativeRectangle(t,n,i,fRe);z_.x=e.tileWidth*(a.x-l.west)/l.width|0,z_.y=e.tileHeight*(l.north-a.y)/l.height|0,OD=!0}function pRe(e,t,n,i,o,r,s){return R.toDegrees(o)}function mRe(e,t,n,i,o,r,s){return R.toDegrees(r)}function _Re(e,t,n,i,o,r,s){return g1(e,t,n,i,o,r),y_.x}function gRe(e,t,n,i,o,r,s){return g1(e,t,n,i,o,r),y_.y}const yRe=new he;function g1(e,t,n,i,o,r,s){if(!LD){if(e.tilingScheme.projection instanceof co)y_.x=R.toDegrees(o),y_.y=R.toDegrees(r);else{const a=yRe;a.longitude=o,a.latitude=r,e.tilingScheme.projection.project(a,y_)}LD=!0}}function bRe(e,t,n,i,o,r,s){return s}function ra(e){zl.call(this,e)}ra._requestMetadata=async function(e,t,n,i){try{const o=await n.fetchXML();return ra._metadataSuccess(o,e,t,n,i)}catch(o){if(o instanceof E_)return ra._metadataFailure(e,t);throw o}};ra.fromUrl=async function(e,t){A.defined("url",e);const n=Ae.createIfNeeded(e);n.appendForwardSlash();const i=n,o=n.getDerivedResource({url:"tilemapresource.xml"});t=y(t,y.EMPTY_OBJECT);const r=await ra._requestMetadata(t,i,o);return new ra(r)};c(Object.create)&&(ra.prototype=Object.create(zl.prototype),ra.prototype.constructor=ra);function O9(e,t){return e.west<t.rectangle.west&&(e.west=t.rectangle.west),e.east>t.rectangle.east&&(e.east=t.rectangle.east),e.south<t.rectangle.south&&(e.south=t.rectangle.south),e.north>t.rectangle.north&&(e.north=t.rectangle.north),e}function L9(e,t,n){const i=e.positionToTileXY(ce.southwest(t),n),o=e.positionToTileXY(ce.northeast(t),n);return(Math.abs(o.x-i.x)+1)*(Math.abs(o.y-i.y)+1)>4?0:n}ra._metadataSuccess=function(e,t,n,i,o){const r=/tileformat/i,s=/tileset/i,a=/tilesets/i,l=/boundingbox/i;let u,h,f;const _=[],g=e.childNodes[0].childNodes;for(let M=0;M<g.length;M++)if(r.test(g.item(M).nodeName))u=g.item(M);else if(a.test(g.item(M).nodeName)){f=g.item(M);const U=g.item(M).childNodes;for(let B=0;B<U.length;B++)s.test(U.item(B).nodeName)&&_.push(U.item(B))}else l.test(g.item(M).nodeName)&&(h=g.item(M));let m;if(!c(f)||!c(h))throw m=`Unable to find expected tilesets or bbox attributes in ${i.url}.`,c(o)&&Er.reportError(void 0,o,o.errorEvent,m),new Te(m);const b=y(t.fileExtension,u.getAttribute("extension")),T=y(t.tileWidth,parseInt(u.getAttribute("width"),10)),x=y(t.tileHeight,parseInt(u.getAttribute("height"),10));let C=y(t.minimumLevel,parseInt(_[0].getAttribute("order"),10));const w=y(t.maximumLevel,parseInt(_[_.length-1].getAttribute("order"),10)),v=f.getAttribute("profile");let P=t.tilingScheme;if(!c(P))if(v==="geodetic"||v==="global-geodetic")P=new Yr({ellipsoid:t.ellipsoid});else if(v==="mercator"||v==="global-mercator")P=new ws({ellipsoid:t.ellipsoid});else throw m=`${i.url} specifies an unsupported profile attribute, ${v}.`,c(o)&&Er.reportError(void 0,o,o.errorEvent,m),new Te(m);let N=ce.clone(t.rectangle);if(!c(N)){let M,U,B,S;y(t.flipXY,!1)?(B=new H(parseFloat(h.getAttribute("miny")),parseFloat(h.getAttribute("minx"))),S=new H(parseFloat(h.getAttribute("maxy")),parseFloat(h.getAttribute("maxx")))):(B=new H(parseFloat(h.getAttribute("minx")),parseFloat(h.getAttribute("miny"))),S=new H(parseFloat(h.getAttribute("maxx")),parseFloat(h.getAttribute("maxy"))));const p=v==="geodetic"||v==="mercator";if(P.projection instanceof co||p)M=he.fromDegrees(B.x,B.y),U=he.fromDegrees(S.x,S.y);else{const I=P.projection;M=I.unproject(B),U=I.unproject(S)}N=new ce(M.longitude,M.latitude,U.longitude,U.latitude)}return N=O9(N,P),C=L9(P,N,C),{url:n.getDerivedResource({url:`{z}/{x}/{reverseY}.${b}`}),tilingScheme:P,rectangle:N,tileWidth:T,tileHeight:x,minimumLevel:C,maximumLevel:w,tileDiscardPolicy:t.tileDiscardPolicy,credit:t.credit}};ra._metadataFailure=function(e,t){const n=y(e.fileExtension,"png"),i=y(e.tileWidth,256),o=y(e.tileHeight,256),r=e.maximumLevel,s=c(e.tilingScheme)?e.tilingScheme:new ws({ellipsoid:e.ellipsoid});let a=y(e.rectangle,s.rectangle);a=O9(a,s);const l=L9(s,a,e.minimumLevel);return{url:t.getDerivedResource({url:`{z}/{x}/{reverseY}.${n}`}),tilingScheme:s,rectangle:a,tileWidth:i,tileHeight:o,minimumLevel:l,maximumLevel:r,tileDiscardPolicy:e.tileDiscardPolicy,credit:e.credit}};function R9(e){this.channel=e.channel,this.ellipsoid=e.ellipsoid,this.tilingScheme=void 0,this.version=void 0}R9.prototype.build=function(e){e._channel=this.channel,e._version=this.version,e._tilingScheme=this.tilingScheme};function TRe(e,t){let n;try{n=JSON.parse(e)}catch{n=JSON.parse(e.replace(/([\[\{,])[\n\r ]*([A-Za-z0-9]+)[\n\r ]*:/g,'$1"$2":'))}let i;for(let o=0;o<n.layers.length;o++)if(n.layers[o].id===t.channel){i=n.layers[o];break}if(!c(i)){const o=`Could not find layer with channel (id) of ${t.channel}.`;throw new Te(o)}if(!c(i.version)){const o=`Could not find a version in channel (id) ${t.channel}.`;throw new Te(o)}if(t.version=i.version,c(n.projection)&&n.projection==="flat")t.tilingScheme=new Yr({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:2,rectangle:new ce(-Math.PI,-Math.PI,Math.PI,Math.PI),ellipsoid:t.ellipsoid});else if(!c(n.projection)||n.projection==="mercator")t.tilingScheme=new ws({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:2,ellipsoid:t.ellipsoid});else{const o=`Unsupported projection ${n.projection}.`;throw new Te(o)}return!0}function ARe(e,t,n){let i=`An error occurred while accessing ${t.url}.`;throw c(e)&&c(e.message)&&(i+=`: ${e.message}`),Er.reportError(void 0,n,c(n)?n._errorEvent:void 0,i),new Te(i)}async function xRe(e,t,n){try{const i=await e.fetchText();TRe(i,t)}catch(i){ARe(i,e,n)}}function ia(e){e=y(e,{}),this._defaultAlpha=void 0,this._defaultNightAlpha=void 0,this._defaultDayAlpha=void 0,this._defaultBrightness=void 0,this._defaultContrast=void 0,this._defaultHue=void 0,this._defaultSaturation=void 0,this._defaultGamma=1.9,this._defaultMinificationFilter=void 0,this._defaultMagnificationFilter=void 0,this._tileDiscardPolicy=e.tileDiscardPolicy,this._channel=e.channel,this._requestType="ImageryMaps",this._credit=new Wt(`<a href="http://www.google.com/enterprise/mapsearth/products/earthenterprise.html"><img src="${ia.logoUrl}" title="Google Imagery"/></a>`),this._tilingScheme=void 0,this._version=void 0,this._tileWidth=256,this._tileHeight=256,this._maximumLevel=e.maximumLevel,this._errorEvent=new Le}Object.defineProperties(ia.prototype,{url:{get:function(){return this._url}},path:{get:function(){return this._path}},proxy:{get:function(){return this._resource.proxy}},channel:{get:function(){return this._channel}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){return this._maximumLevel}},minimumLevel:{get:function(){return 0}},tilingScheme:{get:function(){return this._tilingScheme}},version:{get:function(){return this._version}},requestType:{get:function(){return this._requestType}},rectangle:{get:function(){return this._tilingScheme.rectangle}},tileDiscardPolicy:{get:function(){return this._tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return!0}}});ia.fromUrl=async function(e,t,n){A.defined("url",e),A.defined("channel",t),n=y(n,{});const i=y(n.path,"/default_map"),o=Ae.createIfNeeded(e).getDerivedResource({url:i[0]==="/"?i.substring(1):i});o.appendForwardSlash();const r=o.getDerivedResource({url:"query",queryParameters:{request:"Json",vars:"geeServerDefs",is2d:"t"}}),s=new R9(n);s.channel=t,await xRe(r,s);const a=new ia(n);return s.build(a),a._resource=o,a._url=e,a._path=i,a};ia.prototype.getTileCredits=function(e,t,n){};ia.prototype.requestImage=function(e,t,n,i){const o=this._resource.getDerivedResource({url:"query",request:i,queryParameters:{request:this._requestType,channel:this._channel,version:this._version,x:e,y:t,z:n+1}});return Bl.loadImage(this,o)};ia.prototype.pickFeatures=function(e,t,n,i,o){};ia._logoUrl=void 0;Object.defineProperties(ia,{logoUrl:{get:function(){return c(ia._logoUrl)||(ia._logoUrl=Zt("Assets/Images/google_earth_credit.png")),ia._logoUrl},set:function(e){A.defined("value",e),ia._logoUrl=e}}});const CRe=/\/$/,N9=new Wt('© <a href="https://www.mapbox.com/about/maps/">Mapbox</a> © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> <strong><a href="https://www.mapbox.com/map-feedback/">Improve this map</a></strong>');function ng(e){e=y(e,y.EMPTY_OBJECT);const t=e.mapId;if(!c(t))throw new E("options.mapId is required.");const n=e.accessToken;if(!c(n))throw new E("options.accessToken is required.");this._defaultAlpha=void 0,this._defaultNightAlpha=void 0,this._defaultDayAlpha=void 0,this._defaultBrightness=void 0,this._defaultContrast=void 0,this._defaultHue=void 0,this._defaultSaturation=void 0,this._defaultGamma=void 0,this._defaultMinificationFilter=void 0,this._defaultMagnificationFilter=void 0;const i=Ae.createIfNeeded(y(e.url,"https://{s}.tiles.mapbox.com/v4/"));this._mapId=t,this._accessToken=n;let o=y(e.format,"png");/\./.test(o)||(o=`.${o}`),this._format=o;let r=i.getUrlComponent();CRe.test(r)||(r+="/"),r+=`${t}/{z}/{x}/{y}${this._format}`,i.url=r,i.setQueryParameters({access_token:n});let s;c(e.credit)?(s=e.credit,typeof s=="string"&&(s=new Wt(s))):s=N9,this._resource=i,this._imageryProvider=new zl({url:i,credit:s,ellipsoid:e.ellipsoid,minimumLevel:e.minimumLevel,maximumLevel:e.maximumLevel,rectangle:e.rectangle})}Object.defineProperties(ng.prototype,{url:{get:function(){return this._imageryProvider.url}},rectangle:{get:function(){return this._imageryProvider.rectangle}},tileWidth:{get:function(){return this._imageryProvider.tileWidth}},tileHeight:{get:function(){return this._imageryProvider.tileHeight}},maximumLevel:{get:function(){return this._imageryProvider.maximumLevel}},minimumLevel:{get:function(){return this._imageryProvider.minimumLevel}},tilingScheme:{get:function(){return this._imageryProvider.tilingScheme}},tileDiscardPolicy:{get:function(){return this._imageryProvider.tileDiscardPolicy}},errorEvent:{get:function(){return this._imageryProvider.errorEvent}},credit:{get:function(){return this._imageryProvider.credit}},proxy:{get:function(){return this._imageryProvider.proxy}},hasAlphaChannel:{get:function(){return this._imageryProvider.hasAlphaChannel}}});ng.prototype.getTileCredits=function(e,t,n){};ng.prototype.requestImage=function(e,t,n,i){return this._imageryProvider.requestImage(e,t,n,i)};ng.prototype.pickFeatures=function(e,t,n,i,o){return this._imageryProvider.pickFeatures(e,t,n,i,o)};ng._defaultCredit=N9;function xp(e){e=y(e,y.EMPTY_OBJECT),this._defaultAlpha=void 0,this._defaultNightAlpha=void 0,this._defaultDayAlpha=void 0,this._defaultBrightness=void 0,this._defaultContrast=void 0,this._defaultHue=void 0,this._defaultSaturation=void 0,this._defaultGamma=void 0,this._defaultMinificationFilter=void 0,this._defaultMagnificationFilter=void 0;const t=y(e.rectangle,ce.MAX_VALUE),n=new Yr({rectangle:t,numberOfLevelZeroTilesX:1,numberOfLevelZeroTilesY:1,ellipsoid:e.ellipsoid});this._tilingScheme=n,this._image=void 0,this._texture=void 0,this._hasError=!1,this._errorEvent=new Le;let i=e.credit;typeof i=="string"&&(i=new Wt(i)),this._credit=i,A.defined("options.url",e.url);const o=Ae.createIfNeeded(e.url);this._resource=o,A.typeOf.number("options.tileWidth",e.tileWidth),A.typeOf.number("options.tileHeight",e.tileHeight),this._tileWidth=e.tileWidth,this._tileHeight=e.tileHeight}Object.defineProperties(xp.prototype,{url:{get:function(){return this._resource.url}},proxy:{get:function(){return this._resource.proxy}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){return 0}},minimumLevel:{get:function(){return 0}},tilingScheme:{get:function(){return this._tilingScheme}},rectangle:{get:function(){return this._tilingScheme.rectangle}},tileDiscardPolicy:{get:function(){}},errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return!0}}});function ERe(e,t,n,i){let o=`Failed to load image ${e.url}`;c(t)&&c(t.message)&&(o+=`: ${t.message}`);const r=Er.reportError(i,n,c(n)?n._errorEvent:void 0,o,0,0,0,t);if(r.retry)return y1(e,n,r);throw c(n)&&(n._hasError=!0),new Te(o)}async function y1(e,t,n){try{return await Bl.loadImage(null,e)}catch(i){return ERe(e,i,t,n)}}xp.fromUrl=async function(e,t){A.defined("url",e);const n=Ae.createIfNeeded(e),i=await y1(n);t=y(t,y.EMPTY_OBJECT);const o=new xp({...t,url:e,tileWidth:i.width,tileHeight:i.height});return o._image=i,o};xp.prototype.getTileCredits=function(e,t,n){};xp.prototype.requestImage=async function(e,t,n,i){if(!this._hasError&&!c(this._image)){const o=await y1(this._resource,this);return this._image=o,Er.reportSuccess(this._errorEvent),o}return this._image};xp.prototype.pickFeatures=function(e,t,n,i,o){};function pv(e,t,n){if(!c(e))throw new E("type is required.");if(this.type=e,!c(t))if(e==="json")t="application/json";else if(e==="xml")t="text/xml";else if(e==="html")t="text/html";else if(e==="text")t="text/plain";else throw new E('format is required when type is not "json", "xml", "html", or "text".');if(this.format=t,!c(n))if(e==="json")n=wRe;else if(e==="xml")n=DRe;else if(e==="html")n=NB;else if(e==="text")n=NB;else throw new E('callback is required when type is not "json", "xml", "html", or "text".');this.callback=n}function wRe(e){const t=[],n=e.features;for(let i=0;i<n.length;++i){const o=n[i],r=new of;if(r.data=o,r.properties=o.properties,r.configureNameFromProperties(o.properties),r.configureDescriptionFromProperties(o.properties),c(o.geometry)&&o.geometry.type==="Point"){const s=o.geometry.coordinates[0],a=o.geometry.coordinates[1];r.position=he.fromDegrees(s,a)}t.push(r)}return t}const RD="http://www.mapinfo.com/mxp",SRe="http://www.esri.com/wms",vRe="http://www.opengis.net/wfs",IRe="http://www.opengis.net/gml";function DRe(e){const t=e.documentElement;if(t.localName==="MultiFeatureCollection"&&t.namespaceURI===RD)return PRe(e);if(t.localName==="FeatureInfoResponse"&&t.namespaceURI===SRe)return ORe(e);if(t.localName==="FeatureCollection"&&t.namespaceURI===vRe)return LRe(e);if(t.localName==="ServiceExceptionReport")throw new Te(new XMLSerializer().serializeToString(t));return t.localName==="msGMLOutput"?RRe(e):NRe(e)}function PRe(e){const t=[],i=e.documentElement.getElementsByTagNameNS(RD,"Feature");for(let o=0;o<i.length;++o){const r=i[o],s={},a=r.getElementsByTagNameNS(RD,"Val");for(let u=0;u<a.length;++u){const h=a[u];if(h.hasAttribute("ref")){const f=h.getAttribute("ref"),_=h.textContent.trim();s[f]=_}}const l=new of;l.data=r,l.properties=s,l.configureNameFromProperties(s),l.configureDescriptionFromProperties(s),t.push(l)}return t}function ORe(e){const t=e.documentElement,n=[];let i;const o=t.getElementsByTagNameNS("*","FIELDS");if(o.length>0)for(let r=0;r<o.length;++r){const s=o[r];i={};const a=s.attributes;for(let l=0;l<a.length;++l){const u=a[l];i[u.name]=u.value}n.push(oC(s,i))}else{const r=t.getElementsByTagNameNS("*","FeatureInfo");for(let s=0;s<r.length;++s){const a=r[s];i={};const l=a.childNodes;for(let u=0;u<l.length;++u){const h=l[u];h.nodeType===Node.ELEMENT_NODE&&(i[h.localName]=h.textContent)}n.push(oC(a,i))}}return n}function LRe(e){const t=[],i=e.documentElement.getElementsByTagNameNS(IRe,"featureMember");for(let o=0;o<i.length;++o){const r=i[o],s={};b1(r,s),t.push(oC(r,s))}return t}function RRe(e){const t=[];let n;const i=e.documentElement.childNodes;for(let r=0;r<i.length;r++)if(i[r].nodeType===Node.ELEMENT_NODE){n=i[r];break}if(!c(n))throw new Te("Unable to find first child of the feature info xml document");const o=n.childNodes;for(let r=0;r<o.length;++r){const s=o[r];if(s.nodeType===Node.ELEMENT_NODE){const a={};b1(s,a),t.push(oC(s,a))}}return t}function b1(e,t){let n=!0;for(let i=0;i<e.childNodes.length;++i){const o=e.childNodes[i];o.nodeType===Node.ELEMENT_NODE&&(n=!1),!(o.localName==="Point"||o.localName==="LineString"||o.localName==="Polygon"||o.localName==="boundedBy")&&o.hasChildNodes()&&b1(o,t)&&(t[o.localName]=o.textContent)}return n}function oC(e,t){const n=new of;return n.data=e,n.properties=t,n.configureNameFromProperties(t),n.configureDescriptionFromProperties(t),n}function NRe(e){const t=new XMLSerializer().serializeToString(e),n=document.createElement("div"),i=document.createElement("pre");i.textContent=t,n.appendChild(i);const o=new of;return o.data=e,o.description=n.innerHTML,[o]}const MRe=/<body>\s*<\/body>/im,FRe=/<ServiceExceptionReport([\s\S]*)<\/ServiceExceptionReport>/im,BRe=/<title>([\s\S]*)<\/title>/im;function NB(e){if(MRe.test(e)||FRe.test(e))return;let t;const n=BRe.exec(e);n&&n.length>1&&(t=n[1]);const i=new of;return i.name=t,i.description=e,i.data=e,[i]}function ig(e){e=y(e,y.EMPTY_OBJECT),A.typeOf.object("options.clock",e.clock),A.typeOf.object("options.times",e.times),A.typeOf.func("options.requestImageFunction",e.requestImageFunction),A.typeOf.func("options.reloadFunction",e.reloadFunction),this._tileCache={},this._tilesRequestedForInterval=[];const t=this._clock=e.clock;this._times=e.times,this._requestImageFunction=e.requestImageFunction,this._reloadFunction=e.reloadFunction,this._currentIntervalIndex=-1,t.onTick.addEventListener(this._clockOnTick,this),this._clockOnTick(t)}Object.defineProperties(ig.prototype,{clock:{get:function(){return this._clock},set:function(e){if(!c(e))throw new E("value is required.");this._clock!==e&&(this._clock=e,this._clockOnTick(e),this._reloadFunction())}},times:{get:function(){return this._times},set:function(e){if(!c(e))throw new E("value is required.");this._times!==e&&(this._times=e,this._clockOnTick(this._clock),this._reloadFunction())}},currentInterval:{get:function(){return this._times.get(this._currentIntervalIndex)}}});ig.prototype.getFromCache=function(e,t,n,i){const o=M9(e,t,n);let r;const s=this._tileCache[this._currentIntervalIndex];if(c(s)&&c(s[o])){const a=s[o];r=a.promise.catch(function(l){throw i.state=a.request.state,l}),delete s[o]}return r};ig.prototype.checkApproachingInterval=function(e,t,n,i){const o=M9(e,t,n),r=this._tilesRequestedForInterval,s=F9(this),a={key:o,priorityFunction:i.priorityFunction};(!c(s)||!B9(this,a,s))&&r.push(a),r.length>=512&&r.splice(0,256)};ig.prototype._clockOnTick=function(e){const t=e.currentTime,i=this._times.indexOf(t),o=this._currentIntervalIndex;if(i!==o){const s=this._tileCache[o];for(const a in s)s.hasOwnProperty(a)&&s[a].request.cancel();delete this._tileCache[o],this._tilesRequestedForInterval=[],this._currentIntervalIndex=i,this._reloadFunction();return}const r=F9(this);if(c(r)){const s=this._tilesRequestedForInterval;let a=!0;for(;a&&s.length!==0;){const l=s.pop();a=B9(this,l,r),a||s.push(l)}}};function M9(e,t,n){return`${e}-${t}-${n}`}function zRe(e){const t=e.split("-");if(t.length===3)return{x:Number(t[0]),y:Number(t[1]),level:Number(t[2])}}function F9(e){const t=e._times;if(!c(t))return;const n=e._clock,i=n.currentTime,o=n.canAnimate&&n.shouldAnimate,r=n.multiplier;if(!o&&r!==0)return;let s,a=t.indexOf(i);if(a<0)return;const l=t.get(a);return r>0?(s=ie.secondsDifference(l.stop,i),++a):(s=ie.secondsDifference(l.start,i),--a),s/=r,a>=0&&s<=5?t.get(a):void 0}function B9(e,t,n){const i=e._times.indexOf(n.start),o=e._tileCache;let r=o[i];c(r)||(r=o[i]={});const s=t.key;if(c(r[s]))return!0;const a=zRe(s),l=new iu({throttle:!1,throttleByServer:!0,type:Ip.IMAGERY,priorityFunction:t.priorityFunction}),u=e._requestImageFunction(a.x,a.y,a.level,l,n);return c(u)?(r[s]={promise:u,request:l},!0):!1}const URe=[3034,3035,3042,3043,3044],kRe=[4471,4559];function gl(e){if(e=y(e,y.EMPTY_OBJECT),!c(e.url))throw new E("options.url is required.");if(!c(e.layers))throw new E("options.layers is required.");if(c(e.times)&&!c(e.clock))throw new E("options.times was specified, so options.clock is required.");this._defaultAlpha=void 0,this._defaultNightAlpha=void 0,this._defaultDayAlpha=void 0,this._defaultBrightness=void 0,this._defaultContrast=void 0,this._defaultHue=void 0,this._defaultSaturation=void 0,this._defaultGamma=void 0,this._defaultMinificationFilter=void 0,this._defaultMagnificationFilter=void 0,this._getFeatureInfoUrl=y(e.getFeatureInfoUrl,e.url);const t=Ae.createIfNeeded(e.url),n=Ae.createIfNeeded(this._getFeatureInfoUrl);t.setQueryParameters(gl.DefaultParameters,!0),n.setQueryParameters(gl.GetFeatureInfoDefaultParameters,!0),c(e.parameters)&&t.setQueryParameters(MB(e.parameters)),c(e.getFeatureInfoParameters)&&n.setQueryParameters(MB(e.getFeatureInfoParameters));const i=this;this._reload=void 0,c(e.times)&&(this._timeDynamicImagery=new ig({clock:e.clock,times:e.times,requestImageFunction:function(s,a,l,u,h){return z9(i,s,a,l,u,h)},reloadFunction:function(){c(i._reload)&&i._reload()}}));const o={};if(o.layers=e.layers,o.bbox="{westProjected},{southProjected},{eastProjected},{northProjected}",o.width="{width}",o.height="{height}",parseFloat(t.queryParameters.version)>=1.3){o.crs=y(e.crs,e.tilingScheme&&e.tilingScheme.projection instanceof vn?"EPSG:3857":"CRS:84");const s=o.crs.split(":");if(s[0]==="EPSG"&&s.length===2){const a=Number(s[1]);(a>=4e3&&a<5e3&&!kRe.includes(a)||URe.includes(a))&&(o.bbox="{southProjected},{westProjected},{northProjected},{eastProjected}")}}else o.srs=y(e.srs,e.tilingScheme&&e.tilingScheme.projection instanceof vn?"EPSG:3857":"EPSG:4326");t.setQueryParameters(o,!0),n.setQueryParameters(o,!0);const r={query_layers:e.layers,info_format:"{format}"};parseFloat(n.queryParameters.version)>=1.3?(r.i="{i}",r.j="{j}"):(r.x="{i}",r.y="{j}"),n.setQueryParameters(r,!0),this._resource=t,this._pickFeaturesResource=n,this._layers=e.layers,this._tileProvider=new zl({url:t,pickFeaturesUrl:n,tilingScheme:y(e.tilingScheme,new Yr({ellipsoid:e.ellipsoid})),rectangle:e.rectangle,tileWidth:e.tileWidth,tileHeight:e.tileHeight,minimumLevel:e.minimumLevel,maximumLevel:e.maximumLevel,subdomains:e.subdomains,tileDiscardPolicy:e.tileDiscardPolicy,credit:e.credit,getFeatureInfoFormats:y(e.getFeatureInfoFormats,gl.DefaultGetFeatureInfoFormats),enablePickFeatures:e.enablePickFeatures})}function z9(e,t,n,i,o,r){const s=c(r)?r.data:void 0,a=e._tileProvider;return c(s)&&a._resource.setQueryParameters(s),a.requestImage(t,n,i,o)}function VRe(e,t,n,i,o,r,s){const a=c(s)?s.data:void 0,l=e._tileProvider;return c(a)&&l._pickFeaturesResource.setQueryParameters(a),l.pickFeatures(t,n,i,o,r)}Object.defineProperties(gl.prototype,{url:{get:function(){return this._resource._url}},proxy:{get:function(){return this._resource.proxy}},layers:{get:function(){return this._layers}},tileWidth:{get:function(){return this._tileProvider.tileWidth}},tileHeight:{get:function(){return this._tileProvider.tileHeight}},maximumLevel:{get:function(){return this._tileProvider.maximumLevel}},minimumLevel:{get:function(){return this._tileProvider.minimumLevel}},tilingScheme:{get:function(){return this._tileProvider.tilingScheme}},rectangle:{get:function(){return this._tileProvider.rectangle}},tileDiscardPolicy:{get:function(){return this._tileProvider.tileDiscardPolicy}},errorEvent:{get:function(){return this._tileProvider.errorEvent}},credit:{get:function(){return this._tileProvider.credit}},hasAlphaChannel:{get:function(){return this._tileProvider.hasAlphaChannel}},enablePickFeatures:{get:function(){return this._tileProvider.enablePickFeatures},set:function(e){this._tileProvider.enablePickFeatures=e}},clock:{get:function(){return this._timeDynamicImagery.clock},set:function(e){this._timeDynamicImagery.clock=e}},times:{get:function(){return this._timeDynamicImagery.times},set:function(e){this._timeDynamicImagery.times=e}},getFeatureInfoUrl:{get:function(){return this._getFeatureInfoUrl}}});gl.prototype.getTileCredits=function(e,t,n){return this._tileProvider.getTileCredits(e,t,n)};gl.prototype.requestImage=function(e,t,n,i){let o;const r=this._timeDynamicImagery;let s;return c(r)&&(s=r.currentInterval,o=r.getFromCache(e,t,n,i)),c(o)||(o=z9(this,e,t,n,i,s)),c(o)&&c(r)&&r.checkApproachingInterval(e,t,n,i),o};gl.prototype.pickFeatures=function(e,t,n,i,o){const r=this._timeDynamicImagery,s=c(r)?r.currentInterval:void 0;return VRe(this,e,t,n,i,o,s)};gl.DefaultParameters=Object.freeze({service:"WMS",version:"1.1.1",request:"GetMap",styles:"",format:"image/jpeg"});gl.GetFeatureInfoDefaultParameters=Object.freeze({service:"WMS",version:"1.1.1",request:"GetFeatureInfo"});gl.DefaultGetFeatureInfoFormats=Object.freeze([Object.freeze(new pv("json","application/json")),Object.freeze(new pv("xml","text/xml")),Object.freeze(new pv("text","text/html"))]);function MB(e){const t={};for(const n in e)e.hasOwnProperty(n)&&(t[n.toLowerCase()]=e[n]);return t}const HRe=Object.freeze({service:"WMTS",version:"1.0.0",request:"GetTile"});function og(e){if(e=y(e,y.EMPTY_OBJECT),!c(e.url))throw new E("options.url is required.");if(!c(e.layer))throw new E("options.layer is required.");if(!c(e.style))throw new E("options.style is required.");if(!c(e.tileMatrixSetID))throw new E("options.tileMatrixSetID is required.");if(c(e.times)&&!c(e.clock))throw new E("options.times was specified, so options.clock is required.");this._defaultAlpha=void 0,this._defaultNightAlpha=void 0,this._defaultDayAlpha=void 0,this._defaultBrightness=void 0,this._defaultContrast=void 0,this._defaultHue=void 0,this._defaultSaturation=void 0,this._defaultGamma=void 0,this._defaultMinificationFilter=void 0,this._defaultMagnificationFilter=void 0;const t=Ae.createIfNeeded(e.url),n=e.style,i=e.tileMatrixSetID,o=t.url,r=o.match(/{/g);if(!c(r)||r.length===1&&/{s}/.test(o))t.setQueryParameters(HRe),this._useKvp=!0;else{const f={style:n,Style:n,TileMatrixSet:i};t.setTemplateValues(f),this._useKvp=!1}this._resource=t,this._layer=e.layer,this._style=n,this._tileMatrixSetID=i,this._tileMatrixLabels=e.tileMatrixLabels,this._format=y(e.format,"image/jpeg"),this._tileDiscardPolicy=e.tileDiscardPolicy,this._tilingScheme=c(e.tilingScheme)?e.tilingScheme:new ws({ellipsoid:e.ellipsoid}),this._tileWidth=y(e.tileWidth,256),this._tileHeight=y(e.tileHeight,256),this._minimumLevel=y(e.minimumLevel,0),this._maximumLevel=e.maximumLevel,this._rectangle=y(e.rectangle,this._tilingScheme.rectangle),this._dimensions=e.dimensions;const s=this;this._reload=void 0,c(e.times)&&(this._timeDynamicImagery=new ig({clock:e.clock,times:e.times,requestImageFunction:function(f,_,g,m,b){return U9(s,f,_,g,m,b)},reloadFunction:function(){c(s._reload)&&s._reload()}}));const a=this._tilingScheme.positionToTileXY(ce.southwest(this._rectangle),this._minimumLevel),l=this._tilingScheme.positionToTileXY(ce.northeast(this._rectangle),this._minimumLevel),u=(Math.abs(l.x-a.x)+1)*(Math.abs(l.y-a.y)+1);if(u>4)throw new E(`The imagery provider's rectangle and minimumLevel indicate that there are ${u} tiles at the minimum level. Imagery providers with more than four tiles at the minimum level are not supported.`);this._errorEvent=new Le;const h=e.credit;this._credit=typeof h=="string"?new Wt(h):h,this._subdomains=e.subdomains,Array.isArray(this._subdomains)?this._subdomains=this._subdomains.slice():c(this._subdomains)&&this._subdomains.length>0?this._subdomains=this._subdomains.split(""):this._subdomains=["a","b","c"]}function U9(e,t,n,i,o,r){const s=e._tileMatrixLabels,a=c(s)?s[i]:i.toString(),l=e._subdomains,u=e._dimensions,h=c(r)?r.data:void 0;let f,_;if(!e._useKvp)_={TileMatrix:a,TileRow:n.toString(),TileCol:t.toString(),s:l[(t+n+i)%l.length]},f=e._resource.getDerivedResource({request:o}),f.setTemplateValues(_),c(u)&&f.setTemplateValues(u),c(h)&&f.setTemplateValues(h);else{let g={};g.tilematrix=a,g.layer=e._layer,g.style=e._style,g.tilerow=n,g.tilecol=t,g.tilematrixset=e._tileMatrixSetID,g.format=e._format,c(u)&&(g=jt(g,u)),c(h)&&(g=jt(g,h)),_={s:l[(t+n+i)%l.length]},f=e._resource.getDerivedResource({queryParameters:g,request:o}),f.setTemplateValues(_)}return Bl.loadImage(e,f)}Object.defineProperties(og.prototype,{url:{get:function(){return this._resource.url}},proxy:{get:function(){return this._resource.proxy}},tileWidth:{get:function(){return this._tileWidth}},tileHeight:{get:function(){return this._tileHeight}},maximumLevel:{get:function(){return this._maximumLevel}},minimumLevel:{get:function(){return this._minimumLevel}},tilingScheme:{get:function(){return this._tilingScheme}},rectangle:{get:function(){return this._rectangle}},tileDiscardPolicy:{get:function(){return this._tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},format:{get:function(){return this._format}},credit:{get:function(){return this._credit}},hasAlphaChannel:{get:function(){return!0}},clock:{get:function(){return this._timeDynamicImagery.clock},set:function(e){this._timeDynamicImagery.clock=e}},times:{get:function(){return this._timeDynamicImagery.times},set:function(e){this._timeDynamicImagery.times=e}},dimensions:{get:function(){return this._dimensions},set:function(e){this._dimensions!==e&&(this._dimensions=e,c(this._reload)&&this._reload())}}});og.prototype.getTileCredits=function(e,t,n){};og.prototype.requestImage=function(e,t,n,i){let o;const r=this._timeDynamicImagery;let s;return c(r)&&(s=r.currentInterval,o=r.getFromCache(e,t,n,i)),c(o)||(o=U9(this,e,t,n,i,s)),c(o)&&c(r)&&r.checkApproachingInterval(e,t,n,i),o};og.prototype.pickFeatures=function(e,t,n,i,o){};const GRe={ARCGIS_MAPSERVER:Oa.fromUrl,BING:async(e,t)=>Ho.fromUrl(e,t),GOOGLE_EARTH:async(e,t)=>{const n=t.channel;return delete t.channel,ia.fromUrl(e,n,t)},MAPBOX:(e,t)=>new ng({url:e,...t}),SINGLE_TILE:xp.fromUrl,TMS:ra.fromUrl,URL_TEMPLATE:(e,t)=>new zl({url:e,...t}),WMS:(e,t)=>new gl({url:e,...t}),WMTS:(e,t)=>new og({url:e,...t})};function xa(e){this._defaultAlpha=void 0,this._defaultNightAlpha=void 0,this._defaultDayAlpha=void 0,this._defaultBrightness=void 0,this._defaultContrast=void 0,this._defaultHue=void 0,this._defaultSaturation=void 0,this._defaultGamma=void 0,this._defaultMinificationFilter=void 0,this._defaultMagnificationFilter=void 0,this._tileCredits=void 0,this._errorEvent=new Le}Object.defineProperties(xa.prototype,{rectangle:{get:function(){return this._imageryProvider.rectangle}},tileWidth:{get:function(){return this._imageryProvider.tileWidth}},tileHeight:{get:function(){return this._imageryProvider.tileHeight}},maximumLevel:{get:function(){return this._imageryProvider.maximumLevel}},minimumLevel:{get:function(){return this._imageryProvider.minimumLevel}},tilingScheme:{get:function(){return this._imageryProvider.tilingScheme}},tileDiscardPolicy:{get:function(){return this._imageryProvider.tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){return this._imageryProvider.credit}},hasAlphaChannel:{get:function(){return this._imageryProvider.hasAlphaChannel}},proxy:{get:function(){}}});xa.fromAssetId=async function(e,t){A.typeOf.number("assetId",e),t=y(t,y.EMPTY_OBJECT);const n=ar._createEndpointResource(e,t),i=e.toString()+t.accessToken+t.server;let o=xa._endpointCache[i];c(o)||(o=n.fetchJson(),xa._endpointCache[i]=o);const r=await o;if(r.type!=="IMAGERY")throw new Te(`Cesium ion asset ${e} is not an imagery asset.`);let s;const a=r.externalType;if(!c(a))s=await ra.fromUrl(new ar(r,n));else{const u=GRe[a];if(!c(u))throw new Te(`Unrecognized Cesium ion imagery type: ${a}`);const h={...r.options},f=h.url;delete h.url,s=await u(f,h)}const l=new xa;return s.errorEvent.addEventListener(function(u){u.provider=l,l._errorEvent.raiseEvent(u)}),l._tileCredits=ar.getCreditsFromEndpoint(r,n),l._imageryProvider=s,l};xa.prototype.getTileCredits=function(e,t,n){const i=this._imageryProvider.getTileCredits(e,t,n);return c(i)?this._tileCredits.concat(i):this._tileCredits};xa.prototype.requestImage=function(e,t,n,i){return this._imageryProvider.requestImage(e,t,n,i)};xa.prototype.pickFeatures=function(e,t,n,i,o){return this._imageryProvider.pickFeatures(e,t,n,i,o)};xa._endpointCache={};const jRe={AERIAL:2,AERIAL_WITH_LABELS:3,ROAD:4},tx=Object.freeze(jRe);function nx(e){e=y(e,y.EMPTY_OBJECT);const t=y(e.style,tx.AERIAL);return xa.fromAssetId(t)}function Cp(e,t,n,i,o){if(this.imageryLayer=e,this.x=t,this.y=n,this.level=i,this.request=void 0,i!==0){const r=t/2|0,s=n/2|0,a=i-1;this.parent=e.getImageryFromCache(r,s,a)}this.state=Rn.UNLOADED,this.imageUrl=void 0,this.image=void 0,this.texture=void 0,this.textureWebMercator=void 0,this.credits=void 0,this.referenceCount=0,!c(o)&&e.ready&&(o=e.imageryProvider.tilingScheme.tileXYToRectangle(t,n,i)),this.rectangle=o}Cp.createPlaceholder=function(e){const t=new Cp(e,0,0,0);return t.addReference(),t.state=Rn.PLACEHOLDER,t};Cp.prototype.addReference=function(){++this.referenceCount};Cp.prototype.releaseReference=function(){return--this.referenceCount,this.referenceCount===0?(this.imageryLayer.removeImageryFromCache(this),c(this.parent)&&this.parent.releaseReference(),c(this.image)&&c(this.image.destroy)&&this.image.destroy(),c(this.texture)&&this.texture.destroy(),c(this.textureWebMercator)&&this.texture!==this.textureWebMercator&&this.textureWebMercator.destroy(),ve(this),0):this.referenceCount};Cp.prototype.processStateMachine=function(e,t,n){this.state===Rn.UNLOADED&&!n&&(this.state=Rn.TRANSITIONING,this.imageryLayer._requestImagery(this)),this.state===Rn.RECEIVED&&(this.state=Rn.TRANSITIONING,this.imageryLayer._createTexture(e.context,this));const i=this.state===Rn.READY&&t&&!this.texture;(this.state===Rn.TEXTURE_LOADED||i)&&(this.state=Rn.TRANSITIONING,this.imageryLayer._reprojectTexture(e,this,t))};function KC(e,t,n){this.readyImagery=void 0,this.loadingImagery=e,this.textureCoordinateRectangle=t,this.textureTranslationAndScale=void 0,this.useWebMercatorT=n}KC.prototype.freeResources=function(){c(this.readyImagery)&&this.readyImagery.releaseReference(),c(this.loadingImagery)&&this.loadingImagery.releaseReference()};KC.prototype.processStateMachine=function(e,t,n){const i=this.loadingImagery,o=i.imageryLayer;if(i.processStateMachine(t,!this.useWebMercatorT,n),i.state===Rn.READY)return c(this.readyImagery)&&this.readyImagery.releaseReference(),this.readyImagery=this.loadingImagery,this.loadingImagery=void 0,this.textureTranslationAndScale=o._calculateTextureTranslationAndScale(e,this),!0;let r=i.parent,s;for(;c(r)&&(r.state!==Rn.READY||!this.useWebMercatorT&&!c(r.texture));)r.state!==Rn.FAILED&&r.state!==Rn.INVALID&&(s=s||r),r=r.parent;return this.readyImagery!==r&&(c(this.readyImagery)&&this.readyImagery.releaseReference(),this.readyImagery=r,c(r)&&(r.addReference(),this.textureTranslationAndScale=o._calculateTextureTranslationAndScale(e,this))),i.state===Rn.FAILED||i.state===Rn.INVALID?c(s)?(s.processStateMachine(t,!this.useWebMercatorT,n),!1):!0:!1};function Qt(e,t){this._imageryProvider=e,this._readyEvent=new Le,this._errorEvent=new Le,t=y(t,y.EMPTY_OBJECT),e=y(e,y.EMPTY_OBJECT),this.alpha=y(t.alpha,y(e._defaultAlpha,1)),this.nightAlpha=y(t.nightAlpha,y(e._defaultNightAlpha,1)),this.dayAlpha=y(t.dayAlpha,y(e._defaultDayAlpha,1)),this.brightness=y(t.brightness,y(e._defaultBrightness,Qt.DEFAULT_BRIGHTNESS)),this.contrast=y(t.contrast,y(e._defaultContrast,Qt.DEFAULT_CONTRAST)),this.hue=y(t.hue,y(e._defaultHue,Qt.DEFAULT_HUE)),this.saturation=y(t.saturation,y(e._defaultSaturation,Qt.DEFAULT_SATURATION)),this.gamma=y(t.gamma,y(e._defaultGamma,Qt.DEFAULT_GAMMA)),this.splitDirection=y(t.splitDirection,Qt.DEFAULT_SPLIT),this.minificationFilter=y(t.minificationFilter,y(e._defaultMinificationFilter,Qt.DEFAULT_MINIFICATION_FILTER)),this.magnificationFilter=y(t.magnificationFilter,y(e._defaultMagnificationFilter,Qt.DEFAULT_MAGNIFICATION_FILTER)),this.show=y(t.show,!0),this._minimumTerrainLevel=t.minimumTerrainLevel,this._maximumTerrainLevel=t.maximumTerrainLevel,this._rectangle=y(t.rectangle,ce.MAX_VALUE),this._maximumAnisotropy=t.maximumAnisotropy,this._imageryCache={},this._skeletonPlaceholder=new KC(Cp.createPlaceholder(this)),this._show=!0,this._layerIndex=-1,this._isBaseLayer=!1,this._requestImageError=void 0,this._reprojectComputeCommands=[],this.cutoutRectangle=t.cutoutRectangle,this.colorToAlpha=t.colorToAlpha,this.colorToAlphaThreshold=y(t.colorToAlphaThreshold,Qt.DEFAULT_APPLY_COLOR_TO_ALPHA_THRESHOLD)}Object.defineProperties(Qt.prototype,{imageryProvider:{get:function(){return this._imageryProvider}},ready:{get:function(){return c(this._imageryProvider)}},errorEvent:{get:function(){return this._errorEvent}},readyEvent:{get:function(){return this._readyEvent}},rectangle:{get:function(){return this._rectangle}}});Qt.DEFAULT_BRIGHTNESS=1;Qt.DEFAULT_CONTRAST=1;Qt.DEFAULT_HUE=0;Qt.DEFAULT_SATURATION=1;Qt.DEFAULT_GAMMA=1;Qt.DEFAULT_SPLIT=zp.NONE;Qt.DEFAULT_MINIFICATION_FILTER=en.LINEAR;Qt.DEFAULT_MAGNIFICATION_FILTER=Yo.LINEAR;Qt.DEFAULT_APPLY_COLOR_TO_ALPHA_THRESHOLD=.004;Qt.fromProviderAsync=function(e,t){A.typeOf.object("imageryProviderPromise",e);const n=new Qt(void 0,t);return XRe(n,Promise.resolve(e)),n};Qt.fromWorldImagery=function(e){return e=y(e,y.EMPTY_OBJECT),Qt.fromProviderAsync(nx({style:e.style}),e)};Qt.prototype.isBaseLayer=function(){return this._isBaseLayer};Qt.prototype.isDestroyed=function(){return!1};Qt.prototype.destroy=function(){return ve(this)};const k9=new ce,FB=new ce,mv=new ce,V9=new ce;Qt.prototype.getImageryRectangle=function(){const e=this._imageryProvider,t=this._rectangle;return ce.intersection(e.rectangle,t)};Qt.prototype._createTileImagerySkeletons=function(e,t,n){const i=e.data;if(!c(t)||c(this._minimumTerrainLevel)&&e.level<this._minimumTerrainLevel||c(this._maximumTerrainLevel)&&e.level>this._maximumTerrainLevel)return!1;c(n)||(n=i.imagery.length);const o=this._imageryProvider;if(!this.ready)return this._skeletonPlaceholder.loadingImagery.addReference(),i.imagery.splice(n,0,this._skeletonPlaceholder),!0;const r=o.tilingScheme.projection instanceof vn&&e.rectangle.north<vn.MaximumLatitude&&e.rectangle.south>-vn.MaximumLatitude,s=ce.intersection(o.rectangle,this._rectangle,k9);let a=ce.intersection(e.rectangle,s,FB);if(!c(a)){if(!this.isBaseLayer())return!1;const p=s,I=e.rectangle;a=FB,I.south>=p.north?a.north=a.south=p.north:I.north<=p.south?a.north=a.south=p.south:(a.south=Math.max(I.south,p.south),a.north=Math.min(I.north,p.north)),I.west>=p.east?a.west=a.east=p.east:I.east<=p.west?a.west=a.east=p.west:(a.west=Math.max(I.west,p.west),a.east=Math.min(I.east,p.east))}let l=0;a.south>0?l=a.south:a.north<0&&(l=a.north);const h=1*t.getLevelMaximumGeometricError(e.level);let f=YRe(this,h,l);f=Math.max(0,f);const _=o.maximumLevel;if(f>_&&(f=_),c(o.minimumLevel)){const p=o.minimumLevel;f<p&&(f=p)}const g=o.tilingScheme,m=g.positionToTileXY(ce.northwest(a),f),b=g.positionToTileXY(ce.southeast(a),f);let T=e.rectangle.width/512,x=e.rectangle.height/512;const C=g.tileXYToRectangle(m.x,m.y,f);Math.abs(C.south-e.rectangle.north)<x&&m.y<b.y&&++m.y,Math.abs(C.east-e.rectangle.west)<T&&m.x<b.x&&++m.x;const w=g.tileXYToRectangle(b.x,b.y,f);Math.abs(w.north-e.rectangle.south)<x&&b.y>m.y&&--b.y,Math.abs(w.west-e.rectangle.east)<T&&b.x>m.x&&--b.x;const v=ce.clone(e.rectangle,V9);let P=g.tileXYToRectangle(m.x,m.y,f),N=ce.intersection(P,s,mv),k;r?(g.rectangleToNativeRectangle(v,v),g.rectangleToNativeRectangle(P,P),g.rectangleToNativeRectangle(N,N),g.rectangleToNativeRectangle(s,s),k=g.tileXYToNativeRectangle.bind(g),T=v.width/512,x=v.height/512):k=g.tileXYToRectangle.bind(g);let M,U=0,B=1,S;!this.isBaseLayer()&&Math.abs(N.west-v.west)>=T&&(U=Math.min(1,(N.west-v.west)/v.width)),!this.isBaseLayer()&&Math.abs(N.north-v.north)>=x&&(B=Math.max(0,(N.north-v.south)/v.height));const D=B;for(let p=m.x;p<=b.x;p++)if(M=U,P=k(p,m.y,f),N=ce.simpleIntersection(P,s,mv),!!c(N)){U=Math.min(1,(N.east-v.west)/v.width),p===b.x&&(this.isBaseLayer()||Math.abs(N.east-v.east)<T)&&(U=1),B=D;for(let I=m.y;I<=b.y;I++){if(S=B,P=k(p,I,f),N=ce.simpleIntersection(P,s,mv),!c(N))continue;B=Math.max(0,(N.south-v.south)/v.height),I===b.y&&(this.isBaseLayer()||Math.abs(N.south-v.south)<x)&&(B=0);const O=new te(M,B,U,S),F=this.getImageryFromCache(p,I,f);i.imagery.splice(n,0,new KC(F,O,r)),++n}}return!0};Qt.prototype._calculateTextureTranslationAndScale=function(e,t){let n=t.readyImagery.rectangle,i=e.rectangle;if(t.useWebMercatorT){const l=t.readyImagery.imageryLayer.imageryProvider.tilingScheme;n=l.rectangleToNativeRectangle(n,k9),i=l.rectangleToNativeRectangle(i,V9)}const o=i.width,r=i.height,s=o/n.width,a=r/n.height;return new te(s*(i.west-n.west)/o,a*(i.south-n.south)/r,s,a)};Qt.prototype._requestImagery=function(e){const t=this._imageryProvider,n=this;function i(s){if(!c(s))return o();e.image=s,e.state=Rn.RECEIVED,e.request=void 0,Er.reportSuccess(n._requestImageError)}function o(s){if(e.request.state===di.CANCELLED){e.state=Rn.UNLOADED,e.request=void 0;return}e.state=Rn.FAILED,e.request=void 0;const a=`Failed to obtain image tile X: ${e.x} Y: ${e.y} Level: ${e.level}.`;n._requestImageError=Er.reportError(n._requestImageError,t,t.errorEvent,a,e.x,e.y,e.level,s),n._requestImageError.retry&&r()}function r(){const s=new iu({throttle:!1,throttleByServer:!0,type:Ip.IMAGERY});e.request=s,e.state=Rn.TRANSITIONING;const a=t.requestImage(e.x,e.y,e.level,s);if(!c(a)){e.state=Rn.UNLOADED,e.request=void 0;return}c(t.getTileCredits)&&(e.credits=t.getTileCredits(e.x,e.y,e.level)),a.then(function(l){i(l)}).catch(function(l){o(l)})}r()};Qt.prototype._createTextureWebGL=function(e,t){const n=new un({minificationFilter:this.minificationFilter,magnificationFilter:this.magnificationFilter}),i=t.image;return c(i.internalFormat)?new xt({context:e,pixelFormat:i.internalFormat,width:i.width,height:i.height,source:{arrayBufferView:i.bufferView},sampler:n}):new xt({context:e,source:i,pixelFormat:this._imageryProvider.hasAlphaChannel?Ve.RGBA:Ve.RGB,sampler:n})};Qt.prototype._createTexture=function(e,t){const n=this._imageryProvider,i=t.image;if(c(n.tileDiscardPolicy)){const r=n.tileDiscardPolicy;if(c(r)){if(!r.isReady()){t.state=Rn.RECEIVED;return}if(r.shouldDiscardImage(i)){t.state=Rn.INVALID;return}}}if(this.minificationFilter!==en.NEAREST&&this.minificationFilter!==en.LINEAR)throw new E("ImageryLayer minification filter must be NEAREST or LINEAR");const o=this._createTextureWebGL(e,t);n.tilingScheme.projection instanceof vn?t.textureWebMercator=o:t.texture=o,t.image=void 0,t.state=Rn.TEXTURE_LOADED};function BB(e,t,n){return`${e}:${t}:${n}`}Qt.prototype._finalizeReprojectTexture=function(e,t){let n=this.minificationFilter;const i=this.magnificationFilter;if(n===en.LINEAR&&i===Yo.LINEAR&&!Ve.isCompressedFormat(t.pixelFormat)&&R.isPowerOfTwo(t.width)&&R.isPowerOfTwo(t.height)){n=en.LINEAR_MIPMAP_LINEAR;const r=pt.maximumTextureFilterAnisotropy,s=Math.min(r,y(this._maximumAnisotropy,r)),a=BB(n,i,s);let l=e.cache.imageryLayerMipmapSamplers;c(l)||(l={},e.cache.imageryLayerMipmapSamplers=l);let u=l[a];c(u)||(u=l[a]=new un({wrapS:Fn.CLAMP_TO_EDGE,wrapT:Fn.CLAMP_TO_EDGE,minificationFilter:n,magnificationFilter:i,maximumAnisotropy:s})),t.generateMipmap(v_.NICEST),t.sampler=u}else{const r=BB(n,i,0);let s=e.cache.imageryLayerNonMipmapSamplers;c(s)||(s={},e.cache.imageryLayerNonMipmapSamplers=s);let a=s[r];c(a)||(a=s[r]=new un({wrapS:Fn.CLAMP_TO_EDGE,wrapT:Fn.CLAMP_TO_EDGE,minificationFilter:n,magnificationFilter:i})),t.sampler=a}};Qt.prototype._reprojectTexture=function(e,t,n){const i=t.textureWebMercator||t.texture,o=t.rectangle,r=e.context;if(n=y(n,!0),n&&!(this._imageryProvider.tilingScheme.projection instanceof co)&&o.width/i.width>1e-5){const s=this;t.addReference();const a=new A_({persists:!0,owner:this,preExecute:function(l){qRe(l,r,i,t.rectangle)},postExecute:function(l){t.texture=l,s._finalizeReprojectTexture(r,l),t.state=Rn.READY,t.releaseReference()},canceled:function(){t.state=Rn.TEXTURE_LOADED,t.releaseReference()}});this._reprojectComputeCommands.push(a)}else n&&(t.texture=i),this._finalizeReprojectTexture(r,i),t.state=Rn.READY};Qt.prototype.queueReprojectionCommands=function(e){const t=this._reprojectComputeCommands,n=t.length;for(let i=0;i<n;++i)e.commandList.push(t[i]);t.length=0};Qt.prototype.cancelReprojections=function(){this._reprojectComputeCommands.forEach(function(e){c(e.canceled)&&e.canceled()}),this._reprojectComputeCommands.length=0};Qt.prototype.getImageryFromCache=function(e,t,n,i){const o=H9(e,t,n);let r=this._imageryCache[o];return c(r)||(r=new Cp(this,e,t,n,i),this._imageryCache[o]=r),r.addReference(),r};Qt.prototype.removeImageryFromCache=function(e){const t=H9(e.x,e.y,e.level);delete this._imageryCache[t]};function H9(e,t,n){return JSON.stringify([e,t,n])}const QT={u_textureDimensions:function(){return this.textureDimensions},u_texture:function(){return this.texture},textureDimensions:new H,texture:void 0},WRe=Yt.supportsTypedArrays()?new Float32Array(2*64):void 0;function qRe(e,t,n,i){let o=t.cache.imageryLayer_reproject;if(!c(o)){o=t.cache.imageryLayer_reproject={vertexArray:void 0,shaderProgram:void 0,sampler:void 0,destroy:function(){c(this.framebuffer)&&this.framebuffer.destroy(),c(this.vertexArray)&&this.vertexArray.destroy(),c(this.shaderProgram)&&this.shaderProgram.destroy()}};const T=new Float32Array(2*64*2);let x=0;for(let N=0;N<64;++N){const k=N/63;T[x++]=0,T[x++]=k,T[x++]=1,T[x++]=k}const C={position:0,webMercatorT:1},w=so.getRegularGridIndices(2,64),v=ct.createIndexBuffer({context:t,typedArray:w,usage:ke.STATIC_DRAW,indexDatatype:je.UNSIGNED_SHORT});o.vertexArray=new Ci({context:t,attributes:[{index:C.position,vertexBuffer:ct.createVertexBuffer({context:t,typedArray:T,usage:ke.STATIC_DRAW}),componentsPerAttribute:2},{index:C.webMercatorT,vertexBuffer:ct.createVertexBuffer({context:t,sizeInBytes:64*2*4,usage:ke.STREAM_DRAW}),componentsPerAttribute:1}],indexBuffer:v});const P=new Oe({sources:[F1e]});o.shaderProgram=Jt.fromCache({context:t,vertexShaderSource:P,fragmentShaderSource:M1e,attributeLocations:C}),o.sampler=new un({wrapS:Fn.CLAMP_TO_EDGE,wrapT:Fn.CLAMP_TO_EDGE,minificationFilter:en.LINEAR,magnificationFilter:Yo.LINEAR})}n.sampler=o.sampler;const r=n.width,s=n.height;QT.textureDimensions.x=r,QT.textureDimensions.y=s,QT.texture=n;let a=Math.sin(i.south);const l=.5*Math.log((1+a)/(1-a));a=Math.sin(i.north);const h=1/(.5*Math.log((1+a)/(1-a))-l),f=new xt({context:t,width:r,height:s,pixelFormat:n.pixelFormat,pixelDatatype:n.pixelDatatype,preMultiplyAlpha:n.preMultiplyAlpha});R.isPowerOfTwo(r)&&R.isPowerOfTwo(s)&&f.generateMipmap(v_.NICEST);const _=i.south,g=i.north,m=WRe;let b=0;for(let T=0;T<64;++T){const x=T/63,C=R.lerp(_,g,x);a=Math.sin(C);const v=(.5*Math.log((1+a)/(1-a))-l)*h;m[b++]=v,m[b++]=v}o.vertexArray.getAttribute(1).vertexBuffer.copyFromArrayView(m),e.shaderProgram=o.shaderProgram,e.outputTexture=f,e.uniformMap=QT,e.vertexArray=o.vertexArray}function YRe(e,t,n){const i=e._imageryProvider,o=i.tilingScheme,r=o.ellipsoid,s=e._imageryProvider.tilingScheme.projection instanceof co?1:Math.cos(n),a=o.rectangle,u=r.maximumRadius*a.width*s/(i.tileWidth*o.getNumberOfXTilesAtLevel(0))/t,h=Math.log(u)/Math.log(2);return Math.round(h)|0}function $Re(e,t){e.numberOfListeners>0?e.raiseEvent(t):console.error(t)}async function XRe(e,t){let n;try{if(n=await Promise.resolve(t),e.isDestroyed())return;e._imageryProvider=n,e._readyEvent.raiseEvent(n)}catch(i){$Re(e._errorEvent,i)}}const QRe={WEST:0,NORTH:1,EAST:2,SOUTH:3,NORTHWEST:4,NORTHEAST:5,SOUTHWEST:6,SOUTHEAST:7},Ft=QRe,G9={NONE:0,CULLED:1,RENDERED:2,REFINED:3,RENDERED_AND_KICKED:6,REFINED_AND_KICKED:7,CULLED_BUT_NEEDED:9,wasKicked:function(e){return e>=G9.RENDERED_AND_KICKED},originalResult:function(e){return e&3},kick:function(e){return e|4}},Tn=G9;function Gp(e){this.tile=e,this.frameLastUpdated=void 0,this.westMeshes=[],this.westTiles=[],this.southMeshes=[],this.southTiles=[],this.eastMeshes=[],this.eastTiles=[],this.northMeshes=[],this.northTiles=[],this.southwestMesh=void 0,this.southwestTile=void 0,this.southeastMesh=void 0,this.southeastTile=void 0,this.northwestMesh=void 0,this.northwestTile=void 0,this.northeastMesh=void 0,this.northeastTile=void 0,this.changedThisFrame=!0,this.visitedFrame=void 0,this.enqueuedFrame=void 0,this.mesh=void 0,this.vertexArray=void 0,this.waterMaskTexture=void 0,this.waterMaskTranslationAndScale=new te}Gp.prototype.update=function(e,t,n){this.changedThisFrame&&(j9(e,t,this.tile,n),this.changedThisFrame=!1)};Gp.prototype.destroy=function(e){this._destroyVertexArray(e),c(this.waterMaskTexture)&&(--this.waterMaskTexture.referenceCount,this.waterMaskTexture.referenceCount===0&&this.waterMaskTexture.destroy(),this.waterMaskTexture=void 0)};Gp.prototype._destroyVertexArray=function(e){c(this.vertexArray)&&(c(e)?e.push(this.vertexArray):Yn._freeVertexArray(this.vertexArray),this.vertexArray=void 0)};const KRe=new yu;Gp.updateFillTiles=function(e,t,n,i){const o=e._quadtree,r=o._levelZeroTiles,s=o._lastSelectionFrameNumber,a=KRe;a.clear();for(let u=0;u<t.length;++u){const h=t[u];c(h.data.vertexArray)&&a.enqueue(t[u])}let l=a.dequeue();for(;l!==void 0;){const u=l.findTileToWest(r),h=l.findTileToSouth(r),f=l.findTileToEast(r),_=l.findTileToNorth(r);Fo(e,n,l,u,s,Ft.EAST,!1,a,i),Fo(e,n,l,h,s,Ft.NORTH,!1,a,i),Fo(e,n,l,f,s,Ft.WEST,!1,a,i),Fo(e,n,l,_,s,Ft.SOUTH,!1,a,i);const g=u.findTileToNorth(r),m=u.findTileToSouth(r),b=f.findTileToNorth(r),T=f.findTileToSouth(r);Fo(e,n,l,g,s,Ft.SOUTHEAST,!1,a,i),Fo(e,n,l,b,s,Ft.SOUTHWEST,!1,a,i),Fo(e,n,l,m,s,Ft.NORTHEAST,!1,a,i),Fo(e,n,l,T,s,Ft.NORTHWEST,!1,a,i),l=a.dequeue()}};function Fo(e,t,n,i,o,r,s,a,l){if(i===void 0)return;let u=i;for(;u&&(u._lastSelectionResultFrame!==o||Tn.wasKicked(u._lastSelectionResult)||Tn.originalResult(u._lastSelectionResult)===Tn.CULLED);){if(s)return;const h=u.parent;if(r>=Ft.NORTHWEST&&h!==void 0)switch(r){case Ft.NORTHWEST:u=u===h.northwestChild?h:void 0;break;case Ft.NORTHEAST:u=u===h.northeastChild?h:void 0;break;case Ft.SOUTHWEST:u=u===h.southwestChild?h:void 0;break;case Ft.SOUTHEAST:u=u===h.southeastChild?h:void 0;break}else u=h}if(u!==void 0){if(u._lastSelectionResult===Tn.RENDERED){if(c(u.data.vertexArray))return;ZRe(e,t,n,u,r,o,a,l);return}if(Tn.originalResult(i._lastSelectionResult)!==Tn.CULLED)switch(r){case Ft.WEST:Fo(e,t,n,i.northwestChild,o,r,!0,a,l),Fo(e,t,n,i.southwestChild,o,r,!0,a,l);break;case Ft.EAST:Fo(e,t,n,i.southeastChild,o,r,!0,a,l),Fo(e,t,n,i.northeastChild,o,r,!0,a,l);break;case Ft.SOUTH:Fo(e,t,n,i.southwestChild,o,r,!0,a,l),Fo(e,t,n,i.southeastChild,o,r,!0,a,l);break;case Ft.NORTH:Fo(e,t,n,i.northeastChild,o,r,!0,a,l),Fo(e,t,n,i.northwestChild,o,r,!0,a,l);break;case Ft.NORTHWEST:Fo(e,t,n,i.northwestChild,o,r,!0,a,l);break;case Ft.NORTHEAST:Fo(e,t,n,i.northeastChild,o,r,!0,a,l);break;case Ft.SOUTHWEST:Fo(e,t,n,i.southwestChild,o,r,!0,a,l);break;case Ft.SOUTHEAST:Fo(e,t,n,i.southeastChild,o,r,!0,a,l);break;default:throw new E("Invalid edge")}}}function ZRe(e,t,n,i,o,r,s,a){const l=i.data;if(l.fill===void 0)l.fill=new Gp(i);else if(l.fill.visitedFrame===r)return;l.fill.enqueuedFrame!==r&&(l.fill.enqueuedFrame=r,l.fill.changedThisFrame=!1,s.enqueue(i)),JRe(e,t,n,i,o,a)}function JRe(e,t,n,i,o,r){const s=i.data.fill;let a;const l=n.data.fill;c(l)?(l.visitedFrame=t.frameNumber,l.changedThisFrame&&(j9(e,t,n,r),l.changedThisFrame=!1),a=n.data.fill.mesh):a=n.data.mesh;let u,h;switch(o){case Ft.WEST:u=s.westMeshes,h=s.westTiles;break;case Ft.SOUTH:u=s.southMeshes,h=s.southTiles;break;case Ft.EAST:u=s.eastMeshes,h=s.eastTiles;break;case Ft.NORTH:u=s.northMeshes,h=s.northTiles;break;case Ft.NORTHWEST:s.changedThisFrame=s.changedThisFrame||s.northwestMesh!==a,s.northwestMesh=a,s.northwestTile=n;return;case Ft.NORTHEAST:s.changedThisFrame=s.changedThisFrame||s.northeastMesh!==a,s.northeastMesh=a,s.northeastTile=n;return;case Ft.SOUTHWEST:s.changedThisFrame=s.changedThisFrame||s.southwestMesh!==a,s.southwestMesh=a,s.southwestTile=n;return;case Ft.SOUTHEAST:s.changedThisFrame=s.changedThisFrame||s.southeastMesh!==a,s.southeastMesh=a,s.southeastTile=n;return}if(n.level<=i.level){s.changedThisFrame=s.changedThisFrame||u[0]!==a||u.length!==1,u[0]=a,h[0]=n,u.length=1,h.length=1;return}let f,_,g,m;const b=n.rectangle;let T;const x=i.rectangle;switch(o){case Ft.WEST:for(T=(x.north-x.south)*R.EPSILON5,f=0;f<h.length&&(g=h[f],m=g.rectangle,!R.greaterThan(b.north,m.south,T));++f);for(_=f;_<h.length&&(g=h[_],m=g.rectangle,!R.greaterThanOrEquals(b.south,m.north,T));++_);break;case Ft.SOUTH:for(T=(x.east-x.west)*R.EPSILON5,f=0;f<h.length&&(g=h[f],m=g.rectangle,!R.lessThan(b.west,m.east,T));++f);for(_=f;_<h.length&&(g=h[_],m=g.rectangle,!R.lessThanOrEquals(b.east,m.west,T));++_);break;case Ft.EAST:for(T=(x.north-x.south)*R.EPSILON5,f=0;f<h.length&&(g=h[f],m=g.rectangle,!R.lessThan(b.south,m.north,T));++f);for(_=f;_<h.length&&(g=h[_],m=g.rectangle,!R.lessThanOrEquals(b.north,m.south,T));++_);break;case Ft.NORTH:for(T=(x.east-x.west)*R.EPSILON5,f=0;f<h.length&&(g=h[f],m=g.rectangle,!R.greaterThan(b.east,m.west,T));++f);for(_=f;_<h.length&&(g=h[_],m=g.rectangle,!R.greaterThanOrEquals(b.west,m.east,T));++_);break}_-f===1?(s.changedThisFrame=s.changedThisFrame||u[f]!==a,u[f]=a,h[f]=n):(s.changedThisFrame=!0,u.splice(f,_-f,a),h.splice(f,_-f,n))}const qf=new he,eNe=new he,b_=new d,T1=new d,ND=new H,MD=new H,ya=new H;function ZC(){this.height=0,this.encodedNormal=new H}function KT(e,t,n,i,o,r,s,a,l){if(c(o))return o;let u;if(c(r)&&c(s))u=(r.height+s.height)*.5;else if(c(r))u=r.height;else if(c(s))u=s.height;else if(c(a))u=a.height;else{const f=e.tile.data.tileBoundingRegion;let _=0,g=0;c(f)&&(_=f.minimumHeight,g=f.maximumHeight),u=(_+g)*.5}return W9(e,t,n,i,u,l),l}const tNe={minimumHeight:0,maximumHeight:0},nNe=new d,zB=new ZC,UB=new ZC,kB=new ZC,VB=new ZC,iNe=typeof Uint8Array<"u"?new Uint8Array(9*9):void 0,oNe={tilingScheme:void 0,x:0,y:0,level:0,exaggeration:1,exaggerationRelativeHeight:0};function j9(e,t,n,i){Yn.initialize(n,e.terrainProvider,e._imageryLayers);const o=n.data,r=o.fill,s=n.rectangle,a=t.verticalExaggeration,l=t.verticalExaggerationRelativeHeight,u=a!==1,h=n.tilingScheme.ellipsoid;let f=JT(r,h,0,1,r.northwestTile,r.northwestMesh,r.northTiles,r.northMeshes,r.westTiles,r.westMeshes,kB),_=JT(r,h,0,0,r.southwestTile,r.southwestMesh,r.westTiles,r.westMeshes,r.southTiles,r.southMeshes,zB),g=JT(r,h,1,0,r.southeastTile,r.southeastMesh,r.southTiles,r.southMeshes,r.eastTiles,r.eastMeshes,UB),m=JT(r,h,1,1,r.northeastTile,r.northeastMesh,r.eastTiles,r.eastMeshes,r.northTiles,r.northMeshes,VB);f=KT(r,h,0,1,f,_,m,g,kB),_=KT(r,h,0,0,_,f,g,m,zB),g=KT(r,h,1,1,g,_,m,f,UB),m=KT(r,h,1,1,m,g,f,_,VB);const b=_.height,T=g.height,x=f.height,C=m.height;let w=Math.min(b,T,x,C),v=Math.max(b,T,x,C);const P=(w+v)*.5;let N,k;const M=e.getLevelMaximumGeometricError(n.level),U=h.maximumRadius-M;let B=Math.acos(U/h.maximumRadius)*4;if(B*=1.5,s.width>B&&v-w<=M){const p=new Cl({width:9,height:9,buffer:iNe,structure:{heightOffset:v}}),I=oNe;I.tilingScheme=n.tilingScheme,I.x=n.x,I.y=n.y,I.level=n.level,I.exaggeration=a,I.exaggerationRelativeHeight=l,r.mesh=p._createMeshSync(I)}else{const p=u,I=ce.center(s,eNe);I.height=P;const O=h.cartographicToCartesian(I,nNe),F=new Oo(O,void 0,void 0,void 0,void 0,!0,!0,p,a,l);let V=5,G;for(G=r.westMeshes,N=0,k=G.length;N<k;++N)V+=G[N].eastIndicesNorthToSouth.length;for(G=r.southMeshes,N=0,k=G.length;N<k;++N)V+=G[N].northIndicesWestToEast.length;for(G=r.eastMeshes,N=0,k=G.length;N<k;++N)V+=G[N].westIndicesSouthToNorth.length;for(G=r.northMeshes,N=0,k=G.length;N<k;++N)V+=G[N].southIndicesEastToWest.length;const j=tNe;j.minimumHeight=w,j.maximumHeight=v;const W=F.stride;let X=new Float32Array(V*W),q=0;const ee=q;q=ZT(h,s,F,X,q,0,1,f.height,f.encodedNormal,1,j),q=tA(r,h,F,X,q,r.westTiles,r.westMeshes,Ft.EAST,j);const Y=q;q=ZT(h,s,F,X,q,0,0,_.height,_.encodedNormal,0,j),q=tA(r,h,F,X,q,r.southTiles,r.southMeshes,Ft.NORTH,j);const ne=q;q=ZT(h,s,F,X,q,1,0,g.height,g.encodedNormal,0,j),q=tA(r,h,F,X,q,r.eastTiles,r.eastMeshes,Ft.WEST,j);const Q=q;q=ZT(h,s,F,X,q,1,1,m.height,m.encodedNormal,1,j),q=tA(r,h,F,X,q,r.northTiles,r.northMeshes,Ft.SOUTH,j),w=j.minimumHeight,v=j.maximumHeight;const le=Ct.fromRectangle(s,w,v,n.tilingScheme.ellipsoid),pe=vn.geodeticLatitudeToMercatorAngle(s.south),re=1/(vn.geodeticLatitudeToMercatorAngle(s.north)-pe),de=(vn.geodeticLatitudeToMercatorAngle(I.latitude)-pe)*re,fe=h.geodeticSurfaceNormalCartographic(qf,T1),ye=En.octEncode(fe,ND),Ce=q;F.encode(X,q*W,le.center,H.fromElements(.5,.5,ya),P,ye,de,fe),++q;const we=q,Pe=we<256?1:2,lt=(we-1)*3,ft=lt*Pe,We=(X.length-we*W)*Float32Array.BYTES_PER_ELEMENT;let Fe;if(We>=ft){const at=we*W*Float32Array.BYTES_PER_ELEMENT;Fe=we<256?new Uint8Array(X.buffer,at,lt):new Uint16Array(X.buffer,at,lt)}else Fe=we<256?new Uint8Array(lt):new Uint16Array(lt);X=new Float32Array(X.buffer,0,we*W);let Dt=0;for(N=0;N<we-2;++N)Fe[Dt++]=Ce,Fe[Dt++]=N,Fe[Dt++]=N+1;Fe[Dt++]=Ce,Fe[Dt++]=N,Fe[Dt++]=0;const st=[];for(N=Y;N>=ee;--N)st.push(N);const et=[];for(N=ne;N>=Y;--N)et.push(N);const hn=[];for(N=Q;N>=ne;--N)hn.push(N);const ot=[];for(ot.push(0),N=Ce-1;N>=Q;--N)ot.push(N);r.mesh=new YC(F.center,X,Fe,lt,we,w,v,se.fromOrientedBoundingBox(le),dNe(e,le.center,s,w,v),F.stride,le,F,st,et,hn,ot)}const S=t.context;r._destroyVertexArray(i),r.vertexArray=Yn._createVertexArrayForMesh(S,r.mesh),o.processImagery(n,e.terrainProvider,t,!0);const D=r.waterMaskTexture;if(r.waterMaskTexture=void 0,e.terrainProvider.hasWaterMask){const p=o._findAncestorTileWithTerrainData(n);c(p)&&c(p.data.waterMaskTexture)&&(r.waterMaskTexture=p.data.waterMaskTexture,++r.waterMaskTexture.referenceCount,o._computeWaterMaskTranslationAndScale(n,p,r.waterMaskTranslationAndScale))}c(D)&&(--D.referenceCount,D.referenceCount===0&&D.destroy())}function ZT(e,t,n,i,o,r,s,a,l,u,h){const f=qf;f.longitude=R.lerp(t.west,t.east,r),f.latitude=R.lerp(t.south,t.north,s),f.height=a;const _=e.cartographicToCartesian(f,b_);let g;n.hasGeodeticSurfaceNormals&&(g=e.geodeticSurfaceNormal(_,T1));const m=MD;return m.x=r,m.y=s,n.encode(i,o*n.stride,_,m,a,l,u,g),h.minimumHeight=Math.min(h.minimumHeight,a),h.maximumHeight=Math.max(h.maximumHeight,a),o+1}const rC=new ce;function v0(e,t,n,i){let o=e.rectangle;const r=t.rectangle;t.x===0&&n.x===1&&e.x===e.tilingScheme.getNumberOfXTilesAtLevel(e.level)-1?(o=ce.clone(e.rectangle,rC),o.west-=R.TWO_PI,o.east-=R.TWO_PI):e.x===0&&n.x===0&&t.x===t.tilingScheme.getNumberOfXTilesAtLevel(t.level)-1&&(o=ce.clone(e.rectangle,rC),o.west+=R.TWO_PI,o.east+=R.TWO_PI);const s=o.east-o.west,a=(r.west-o.west)/s,l=(r.east-o.west)/s,u=o.north-o.south,h=(r.south-o.south)/u,f=(r.north-o.south)/u;let _=(n.x-a)/(l-a),g=(n.y-h)/(f-h);return Math.abs(_)<Math.EPSILON5?_=0:Math.abs(_-1)<Math.EPSILON5&&(_=1),Math.abs(g)<Math.EPSILON5?g=0:Math.abs(g-1)<Math.EPSILON5&&(g=1),i.x=_,i.y=g,i}const rNe=new H;function FD(e,t,n,i,o){const r=e.encoding,s=e.vertices;if(o.height=r.decodeHeight(s,t),r.hasVertexNormals)r.getOctEncodedNormal(s,t,o.encodedNormal);else{const a=o.encodedNormal;a.x=0,a.y=0}}const sNe=new H,aNe=new d;function cNe(e,t,n,i,o,r,s,a,l,u){const h=i.encoding,f=i.vertices,_=v0(t,n,h.decodeTextureCoordinates(f,o,ya),ya),g=v0(t,n,h.decodeTextureCoordinates(f,r,MD),MD);let m;l?m=(s-_.x)/(g.x-_.x):m=(a-_.y)/(g.y-_.y);const b=h.decodeHeight(f,o),T=h.decodeHeight(f,r),x=n.rectangle;qf.longitude=R.lerp(x.west,x.east,s),qf.latitude=R.lerp(x.south,x.north,a),u.height=qf.height=R.lerp(b,T,m);let C;if(h.hasVertexNormals){const w=h.getOctEncodedNormal(f,o,rNe),v=h.getOctEncodedNormal(f,r,sNe),P=En.octDecode(w.x,w.y,b_),N=En.octDecode(v.x,v.y,aNe);C=d.lerp(P,N,m,b_),d.normalize(C,C),En.octEncode(C,u.encodedNormal)}else C=e.geodeticSurfaceNormalCartographic(qf,b_),En.octEncode(C,u.encodedNormal)}function W9(e,t,n,i,o,r){r.height=o;const s=t.geodeticSurfaceNormalCartographic(qf,b_);En.octEncode(s,r.encodedNormal)}function JT(e,t,n,i,o,r,s,a,l,u,h){if(GB(e,t,a,s,!1,n,i,h)||GB(e,t,u,l,!0,n,i,h))return h;let _;if(A1(o,r))return n===0?i===0?_=r.eastIndicesNorthToSouth[0]:_=r.southIndicesEastToWest[0]:i===0?_=r.northIndicesWestToEast[0]:_=r.westIndicesSouthToNorth[0],FD(r,_,n,i,h),h;let g;if(n===0?i===0?g=eA(e.westMeshes,e.westTiles,Ft.EAST,e.southMeshes,e.southTiles,Ft.NORTH):g=eA(e.northMeshes,e.northTiles,Ft.SOUTH,e.westMeshes,e.westTiles,Ft.EAST):i===0?g=eA(e.southMeshes,e.southTiles,Ft.NORTH,e.eastMeshes,e.eastTiles,Ft.WEST):g=eA(e.eastMeshes,e.eastTiles,Ft.WEST,e.northMeshes,e.northTiles,Ft.SOUTH),c(g))return W9(e,t,n,i,g,h),h}function eA(e,t,n,i,o,r,s,a){const l=HB(e,t,!1,n),u=HB(i,o,!0,r);return c(l)&&c(u)?(l+u)*.5:c(l)?l:u}function tA(e,t,n,i,o,r,s,a,l){for(let u=0;u<r.length;++u)o=lNe(e,t,n,i,o,r[u],s[u],a,l);return o}function lNe(e,t,n,i,o,r,s,a,l){let u=r.rectangle;a===Ft.EAST&&e.tile.x===0?(u=ce.clone(r.rectangle,rC),u.west-=R.TWO_PI,u.east-=R.TWO_PI):a===Ft.WEST&&r.x===0&&(u=ce.clone(r.rectangle,rC),u.west+=R.TWO_PI,u.east+=R.TWO_PI);const h=e.tile.rectangle;let f,_;o>0&&(n.decodeTextureCoordinates(i,o-1,ya),f=ya.x,_=ya.y);let g,m;switch(a){case Ft.WEST:g=s.westIndicesSouthToNorth,m=!1;break;case Ft.NORTH:g=s.northIndicesWestToEast,m=!0;break;case Ft.EAST:g=s.eastIndicesNorthToSouth,m=!1;break;case Ft.SOUTH:g=s.southIndicesEastToWest,m=!0;break}const b=r,T=e.tile,x=s.encoding,C=s.vertices,w=n.stride;let v,P;x.hasWebMercatorT&&(v=vn.geodeticLatitudeToMercatorAngle(h.south),P=1/(vn.geodeticLatitudeToMercatorAngle(h.north)-v));for(let N=0;N<g.length;++N){const k=g[N],M=x.decodeTextureCoordinates(C,k,ya);v0(b,T,M,M);const U=M.x,B=M.y,S=m?U:B;if(S<0||S>1||Math.abs(U-f)<R.EPSILON5&&Math.abs(B-_)<R.EPSILON5)continue;const D=Math.abs(U)<R.EPSILON5||Math.abs(U-1)<R.EPSILON5,p=Math.abs(B)<R.EPSILON5||Math.abs(B-1)<R.EPSILON5;if(D&&p)continue;const I=x.decodePosition(C,k,b_),O=x.decodeHeight(C,k);let F;x.hasVertexNormals?F=x.getOctEncodedNormal(C,k,ND):(F=ND,F.x=0,F.y=0);let V=B;if(x.hasWebMercatorT){const j=R.lerp(h.south,h.north,B);V=(vn.geodeticLatitudeToMercatorAngle(j)-v)*P}let G;n.hasGeodeticSurfaceNormals&&(G=t.geodeticSurfaceNormal(I,T1)),n.encode(i,o*w,I,M,O,F,V,G),l.minimumHeight=Math.min(l.minimumHeight,O),l.maximumHeight=Math.max(l.maximumHeight,O),++o}return o}function HB(e,t,n,i,o,r){let s,a,l;n?(s=0,a=e.length,l=1):(s=e.length-1,a=-1,l=-1);for(let u=s;u!==a;u+=l){const h=e[u],f=t[u];if(!A1(f,h))continue;let _;switch(i){case Ft.WEST:_=h.westIndicesSouthToNorth;break;case Ft.SOUTH:_=h.southIndicesEastToWest;break;case Ft.EAST:_=h.eastIndicesNorthToSouth;break;case Ft.NORTH:_=h.northIndicesWestToEast;break}const g=_[n?0:_.length-1];if(c(g))return h.encoding.decodeHeight(h.vertices,g)}}function A1(e,t){return c(t)&&(!c(e.data.fill)||!e.data.fill.changedThisFrame)}function GB(e,t,n,i,o,r,s,a){let l,u,h,f,_;const g=i[o?0:n.length-1],m=n[o?0:n.length-1];if(A1(g,m)&&(r===0?s===0?(l=o?m.northIndicesWestToEast:m.eastIndicesNorthToSouth,u=o,h=o):(l=o?m.eastIndicesNorthToSouth:m.southIndicesEastToWest,u=!o,h=!1):s===0?(l=o?m.westIndicesSouthToNorth:m.northIndicesWestToEast,u=!o,h=!0):(l=o?m.southIndicesEastToWest:m.westIndicesSouthToNorth,u=o,h=!o),l.length>0)){f=o?0:l.length-1,_=l[f],m.encoding.decodeTextureCoordinates(m.vertices,_,ya);const b=v0(g,e.tile,ya,ya);if(b.x===r&&b.y===s)return FD(m,_,r,s,a),!0;if(f=Hr(l,u?r:s,function(T,x){m.encoding.decodeTextureCoordinates(m.vertices,T,ya);const C=v0(g,e.tile,ya,ya);return h?u?C.x-r:C.y-s:u?r-C.x:s-C.y}),f<0){if(f=~f,f>0&&f<l.length)return cNe(t,g,e.tile,m,l[f-1],l[f],r,s,u,a),!0}else return FD(m,l[f],r,s,a),!0}return!1}const uNe=[new d,new d,new d,new d];function dNe(e,t,n,i,o,r){const s=e.quadtree._occluders.ellipsoid,a=s.ellipsoid,l=uNe;return d.fromRadians(n.west,n.south,o,a,l[0]),d.fromRadians(n.east,n.south,o,a,l[1]),d.fromRadians(n.west,n.north,o,a,l[2]),d.fromRadians(n.east,n.north,o,a,l[3]),s.computeHorizonCullingPointPossiblyUnderEllipsoid(t,l,i,r)}function Pi(e){if(!c(e))throw new E("options is required.");if(c(e.terrainProvider))if(c(e.imageryLayers)){if(!c(e.surfaceShaderSet))throw new E("options.surfaceShaderSet is required.")}else throw new E("options.imageryLayers is required.");else throw new E("options.terrainProvider is required.");this.lightingFadeOutDistance=65e5,this.lightingFadeInDistance=9e6,this.hasWaterMask=!1,this.oceanNormalMap=void 0,this.zoomedOutOceanSpecularIntensity=.5,this.enableLighting=!1,this.dynamicAtmosphereLighting=!1,this.dynamicAtmosphereLightingFromSun=!1,this.showGroundAtmosphere=!1,this.shadows=Vi.RECEIVE_ONLY,this.vertexShadowDarkness=.3,this.fillHighlightColor=void 0,this.hueShift=0,this.saturationShift=0,this.brightnessShift=0,this.showSkirts=!0,this.backFaceCulling=!0,this.undergroundColor=void 0,this.undergroundColorAlphaByDistance=void 0,this.lambertDiffuseMultiplier=0,this.materialUniformMap=void 0,this._materialUniformMap=void 0,this._quadtree=void 0,this._terrainProvider=e.terrainProvider,this._imageryLayers=e.imageryLayers,this._surfaceShaderSet=e.surfaceShaderSet,this._renderState=void 0,this._blendRenderState=void 0,this._disableCullingRenderState=void 0,this._disableCullingBlendRenderState=void 0,this._errorEvent=new Le,this._removeLayerAddedListener=this._imageryLayers.layerAdded.addEventListener(Pi.prototype._onLayerAdded,this),this._removeLayerRemovedListener=this._imageryLayers.layerRemoved.addEventListener(Pi.prototype._onLayerRemoved,this),this._removeLayerMovedListener=this._imageryLayers.layerMoved.addEventListener(Pi.prototype._onLayerMoved,this),this._removeLayerShownListener=this._imageryLayers.layerShownOrHidden.addEventListener(Pi.prototype._onLayerShownOrHidden,this),this._imageryLayersUpdatedEvent=new Le,this._layerOrderChanged=!1,this._tilesToRenderByTextureCount=[],this._drawCommands=[],this._uniformMaps=[],this._usedDrawCommands=0,this._vertexArraysToDestroy=[],this._debug={wireframe:!1,boundingSphereTile:void 0},this._baseColor=void 0,this._firstPassInitialColor=void 0,this.baseColor=new z(0,0,.5,1),this._clippingPlanes=void 0,this._clippingPolygons=void 0,this.cartographicLimitRectangle=ce.clone(ce.MAX_VALUE),this._hasLoadedTilesThisFrame=!1,this._hasFillTilesThisFrame=!1,this._oldVerticalExaggeration=void 0,this._oldVerticalExaggerationRelativeHeight=void 0}Object.defineProperties(Pi.prototype,{baseColor:{get:function(){return this._baseColor},set:function(e){if(!c(e))throw new E("value is required.");this._baseColor=e,this._firstPassInitialColor=te.fromColor(e,this._firstPassInitialColor)}},quadtree:{get:function(){return this._quadtree},set:function(e){if(!c(e))throw new E("value is required.");this._quadtree=e}},tilingScheme:{get:function(){if(!!c(this._terrainProvider))return this._terrainProvider.tilingScheme}},errorEvent:{get:function(){return this._errorEvent}},imageryLayersUpdatedEvent:{get:function(){return this._imageryLayersUpdatedEvent}},terrainProvider:{get:function(){return this._terrainProvider},set:function(e){this._terrainProvider!==e&&(this._terrainProvider=e,c(this._quadtree)&&this._quadtree.invalidateAllTiles())}},clippingPlanes:{get:function(){return this._clippingPlanes},set:function(e){Li.setOwner(e,this,"_clippingPlanes")}},clippingPolygons:{get:function(){return this._clippingPolygons},set:function(e){Di.setOwner(e,this,"_clippingPolygons")}}});function hNe(e,t){let n=e.loadingImagery;c(n)||(n=e.readyImagery);let i=t.loadingImagery;return c(i)||(i=t.readyImagery),n.imageryLayer._layerIndex-i.imageryLayer._layerIndex}Pi.prototype.update=function(e){this._imageryLayers._update()};function fNe(e,t){const n=t.creditDisplay,i=e._terrainProvider;c(i)&&c(i.credit)&&n.addCreditToNextFrame(i.credit);const o=e._imageryLayers;for(let r=0,s=o.length;r<s;++r){const a=o.get(r);a.ready&&a.show&&c(a.imageryProvider.credit)&&n.addCreditToNextFrame(a.imageryProvider.credit)}}Pi.prototype.initialize=function(e){this._imageryLayers.queueReprojectionCommands(e),this._layerOrderChanged&&(this._layerOrderChanged=!1,this._quadtree.forEachLoadedTile(function(i){i.data.imagery.sort(hNe)})),fNe(this,e);const t=this._vertexArraysToDestroy,n=t.length;for(let i=0;i<n;++i)Yn._freeVertexArray(t[i]);t.length=0};Pi.prototype.beginUpdate=function(e){const t=this._tilesToRenderByTextureCount;for(let o=0,r=t.length;o<r;++o){const s=t[o];c(s)&&(s.length=0)}const n=this._clippingPlanes;c(n)&&n.enabled&&n.update(e);const i=this._clippingPolygons;c(i)&&i.enabled&&(i.update(e),i.queueCommands(e)),this._usedDrawCommands=0,this._hasLoadedTilesThisFrame=!1,this._hasFillTilesThisFrame=!1};Pi.prototype.endUpdate=function(e){if(!c(this._renderState)){this._renderState=Ue.fromCache({cull:{enabled:!0},depthTest:{enabled:!0,func:lp.LESS}}),this._blendRenderState=Ue.fromCache({cull:{enabled:!0},depthTest:{enabled:!0,func:lp.LESS_OR_EQUAL},blending:Zn.ALPHA_BLEND});let s=Je(this._renderState,!0);s.cull.enabled=!1,this._disableCullingRenderState=Ue.fromCache(s),s=Je(this._blendRenderState,!0),s.cull.enabled=!1,this._disableCullingBlendRenderState=Ue.fromCache(s)}this._hasFillTilesThisFrame&&this._hasLoadedTilesThisFrame&&Gp.updateFillTiles(this,this._quadtree._tilesToRender,e,this._vertexArraysToDestroy);const t=this.quadtree,n=e.verticalExaggeration,i=e.verticalExaggerationRelativeHeight,o=this._oldVerticalExaggeration!==n||this._oldVerticalExaggerationRelativeHeight!==i;this._oldVerticalExaggeration=n,this._oldVerticalExaggerationRelativeHeight=i,o&&t.forEachLoadedTile(function(s){s.data.updateExaggeration(s,e,t)});const r=this._tilesToRenderByTextureCount;for(let s=0,a=r.length;s<a;++s){const l=r[s];if(!!c(l))for(let u=0,h=l.length;u<h;++u){const f=l[u],_=f.data.tileBoundingRegion;BNe(this,f,e),e.minimumTerrainHeight=Math.min(e.minimumTerrainHeight,_.minimumHeight)}}};function q9(e,t){const n=t.globeTranslucencyState;if(n.translucent){const i=e.renderState.blending.enabled;n.pushDerivedCommands(e,i,t)}else t.commandList.push(e)}Pi.prototype.updateForPick=function(e){const t=this._drawCommands;for(let n=0,i=this._usedDrawCommands;n<i;++n)q9(t[n],e)};Pi.prototype.cancelReprojections=function(){this._imageryLayers.cancelReprojections()};Pi.prototype.getLevelMaximumGeometricError=function(e){return c(this._terrainProvider)?this._terrainProvider.getLevelMaximumGeometricError(e):0};Pi.prototype.loadTile=function(e,t){let n=t.data,i=!0,o;c(n)&&(i=n.boundingVolumeSourceTile!==t||t._lastSelectionResult===Tn.CULLED_BUT_NEEDED,o=n.terrainState),Yn.processStateMachine(t,e,this.terrainProvider,this._imageryLayers,this.quadtree,this._vertexArraysToDestroy,i),n=t.data,i&&o!==t.data.terrainState&&this.computeTileVisibility(t,e,this.quadtree.occluders)!==ir.NONE&&n.boundingVolumeSourceTile===t&&(i=!1,Yn.processStateMachine(t,e,this.terrainProvider,this._imageryLayers,this.quadtree,this._vertexArraysToDestroy,i))};const pNe=new se,Y9=new ce,mNe=new ce,_Ne=new he;function ix(e,t){if(t.west<t.east)return t;const n=ce.clone(t,mNe);return ce.center(e,_Ne).longitude>0?n.east=R.PI:n.west=-R.PI,n}function $9(e,t){if(t.cameraUnderground||t.globeTranslucencyState.translucent)return!0;if(e.backFaceCulling)return!1;const n=e._clippingPlanes;if(c(n)&&n.enabled)return!0;const i=e._clippingPolygons;return!!(c(i)&&i.enabled||!ce.equals(e.cartographicLimitRectangle,ce.MAX_VALUE))}Pi.prototype.computeTileVisibility=function(e,t,n){const i=this.computeDistanceToTile(e,t);e._distance=i;const o=$9(this,t);if(t.fog.enabled&&!o&&R.fog(i,t.fog.density)>=1)return ir.NONE;const r=e.data,s=r.tileBoundingRegion;if(r.boundingVolumeSourceTile===void 0)return ir.PARTIAL;const a=t.cullingVolume;let l=s.boundingVolume;c(l)||(l=s.boundingSphere),r.clippedByBoundaries=!1;const u=ix(e.rectangle,this.cartographicLimitRectangle),h=ce.simpleIntersection(u,e.rectangle,Y9);if(!c(h))return ir.NONE;if(ce.equals(h,e.rectangle)||(r.clippedByBoundaries=!0),t.mode!==oe.SCENE3D&&(l=pNe,se.fromRectangleWithHeights2D(e.rectangle,t.mapProjection,s.minimumHeight,s.maximumHeight,l),d.fromElements(l.center.z,l.center.x,l.center.y,l.center),t.mode===oe.MORPHING&&c(r.renderedMesh)&&(l=se.union(s.boundingSphere,l,l))),!c(l))return ir.PARTIAL;const f=this._clippingPlanes;if(c(f)&&f.enabled){const T=f.computeIntersectionWithBoundingVolume(l);if(e.isClipped=T!==Bt.INSIDE,T===Bt.OUTSIDE)return ir.NONE}const _=this._clippingPolygons;if(c(_)&&_.enabled){const T=_.computeIntersectionWithBoundingVolume(s);e.isClipped=T!==Bt.OUTSIDE}let g;const m=a.computeVisibility(l);if(m===Bt.OUTSIDE?g=ir.NONE:m===Bt.INTERSECTING?g=ir.PARTIAL:m===Bt.INSIDE&&(g=ir.FULL),g===ir.NONE)return g;const b=t.mode===oe.SCENE3D&&t.camera.frustum instanceof It;if(t.mode===oe.SCENE3D&&!b&&c(n)&&!o){const T=r.occludeePointInScaledSpace;return!c(T)||n.ellipsoid.isScaledSpacePointVisiblePossiblyUnderEllipsoid(T,s.minimumHeight)?g:ir.NONE}return g};Pi.prototype.canRefine=function(e){return c(e.data.terrainData)?!0:this.terrainProvider.getTileDataAvailable(e.x*2,e.y*2,e.level+1)!==void 0};const gNe=[],yNe=[];Pi.prototype.canRenderWithoutLosingDetail=function(e,t){const n=e.data,i=gNe;i.length=this._imageryLayers.length;let o=!1,r=!1,s;c(n)&&(o=n.terrainState===yi.READY,r=!0,s=n.imagery);let a,l;for(a=0,l=i.length;a<l;++a)i[a]=r;if(c(s))for(a=0,l=s.length;a<l;++a){const f=s[a],_=f.loadingImagery,g=!c(_)||_.state===Rn.FAILED||_.state===Rn.INVALID,m=(f.loadingImagery||f.readyImagery).imageryLayer._layerIndex;i[m]=g&&i[m]}const u=this.quadtree._lastSelectionFrameNumber,h=yNe;for(h.length=0,h.push(e.southwestChild,e.southeastChild,e.northwestChild,e.northeastChild);h.length>0;){const f=h.pop(),_=f._lastSelectionResultFrame===u?f._lastSelectionResult:Tn.NONE;if(_===Tn.RENDERED){const g=f.data;if(!c(g))continue;if(!o&&f.data.terrainState===yi.READY)return!1;const m=f.data.imagery;for(a=0,l=m.length;a<l;++a){const b=m[a],T=b.loadingImagery,x=!c(T)||T.state===Rn.FAILED||T.state===Rn.INVALID,C=(b.loadingImagery||b.readyImagery).imageryLayer._layerIndex;if(x&&!i[C])return!1}}else _===Tn.REFINED&&h.push(f.southwestChild,f.southeastChild,f.northwestChild,f.northeastChild)}return!0};const bNe=new d;Pi.prototype.computeTileLoadPriority=function(e,t){const n=e.data;if(n===void 0)return 0;const i=n.tileBoundingRegion.boundingVolume;if(i===void 0)return 0;const o=t.camera.positionWC,r=t.camera.directionWC,s=d.subtract(i.center,o,bNe),a=d.magnitude(s);return a<R.EPSILON5?0:(d.divideByScalar(s,a,s),(1-d.dot(s,r))*e._distance)};const jB=new L,nA=new L,TNe=new te,ANe=new te,xNe=new te,CNe=new d,WB=new d,ENe=new d,wNe=new d;Pi.prototype.showTileThisFrame=function(e,t){let n=0;const i=e.data.imagery;for(let a=0,l=i.length;a<l;++a){const u=i[a];c(u.readyImagery)&&u.readyImagery.imageryLayer.alpha!==0&&++n}let o=this._tilesToRenderByTextureCount[n];c(o)||(o=[],this._tilesToRenderByTextureCount[n]=o),o.push(e);const r=e.data;c(r.vertexArray)?this._hasLoadedTilesThisFrame=!0:this._hasFillTilesThisFrame=!0;const s=this._debug;++s.tilesRendered,s.texturesRendered+=n};const SNe=[new d,new d,new d,new d];function qB(e,t,n,i,o,r){const s=e.quadtree._occluders.ellipsoid,a=s.ellipsoid,l=SNe;return d.fromRadians(n.west,n.south,o,a,l[0]),d.fromRadians(n.east,n.south,o,a,l[1]),d.fromRadians(n.west,n.north,o,a,l[2]),d.fromRadians(n.east,n.north,o,a,l[3]),s.computeHorizonCullingPointPossiblyUnderEllipsoid(t,l,i,r)}Pi.prototype.computeDistanceToTile=function(e,t){vNe(e,this,t);const n=e.data;if(n.boundingVolumeSourceTile===void 0)return 9999999999;const o=n.tileBoundingRegion,r=o.minimumHeight,s=o.maximumHeight;if(n.boundingVolumeSourceTile!==e){const l=t.camera.positionCartographic.height,u=Math.abs(l-r),h=Math.abs(l-s);u>h?(o.minimumHeight=r,o.maximumHeight=r):(o.minimumHeight=s,o.maximumHeight=s)}const a=o.distanceToCamera(t);return o.minimumHeight=r,o.maximumHeight=s,a};function vNe(e,t,n){let i=e.data;i===void 0&&(i=e.data=new Yn);const o=e.tilingScheme.ellipsoid;i.tileBoundingRegion===void 0&&(i.tileBoundingRegion=new ru({computeBoundingVolumes:!1,rectangle:e.rectangle,ellipsoid:o,minimumHeight:0,maximumHeight:0}));const r=i.tileBoundingRegion,s=r.minimumHeight,a=r.maximumHeight;let l=!1,u=e;const h=i.mesh,f=i.terrainData;if(h!==void 0&&h.minimumHeight!==void 0&&h.maximumHeight!==void 0)r.minimumHeight=h.minimumHeight,r.maximumHeight=h.maximumHeight,l=!0;else if(f!==void 0&&f._minimumHeight!==void 0&&f._maximumHeight!==void 0)r.minimumHeight=f._minimumHeight,r.maximumHeight=f._maximumHeight;else{r.minimumHeight=Number.NaN,r.maximumHeight=Number.NaN;let _=e.parent;for(;_!==void 0;){const g=_.data;if(g!==void 0){const m=g.mesh,b=g.terrainData;if(m!==void 0&&m.minimumHeight!==void 0&&m.maximumHeight!==void 0){r.minimumHeight=m.minimumHeight,r.maximumHeight=m.maximumHeight;break}else if(b!==void 0&&b._minimumHeight!==void 0&&b._maximumHeight!==void 0){r.minimumHeight=b._minimumHeight,r.maximumHeight=b._maximumHeight;break}}_=_.parent}u=_}if(u!==void 0){const _=n.verticalExaggeration,g=n.verticalExaggerationRelativeHeight;if(_!==1&&(l=!1,r.minimumHeight=oa.getHeight(r.minimumHeight,_,g),r.maximumHeight=oa.getHeight(r.maximumHeight,_,g)),l)i.boundingVolumeIsFromMesh||(r._orientedBoundingBox=Ct.clone(h.orientedBoundingBox,r._orientedBoundingBox),r._boundingSphere=se.clone(h.boundingSphere3D,r._boundingSphere),i.occludeePointInScaledSpace=d.clone(h.occludeePointInScaledSpace,i.occludeePointInScaledSpace),c(i.occludeePointInScaledSpace)||(i.occludeePointInScaledSpace=qB(t,r._orientedBoundingBox.center,e.rectangle,r.minimumHeight,r.maximumHeight,i.occludeePointInScaledSpace)));else{const b=r._orientedBoundingBox===void 0||r._boundingSphere===void 0;(r.minimumHeight!==s||r.maximumHeight!==a||b)&&(r.computeBoundingVolumes(o),i.occludeePointInScaledSpace=qB(t,r._orientedBoundingBox.center,e.rectangle,r.minimumHeight,r.maximumHeight,i.occludeePointInScaledSpace))}i.boundingVolumeSourceTile=u,i.boundingVolumeIsFromMesh=l}else i.boundingVolumeSourceTile=void 0,i.boundingVolumeIsFromMesh=!1}Pi.prototype.isDestroyed=function(){return!1};Pi.prototype.destroy=function(){return this._tileProvider=this._tileProvider&&this._tileProvider.destroy(),this._clippingPlanes=this._clippingPlanes&&this._clippingPlanes.destroy(),this._clippingPolygons=this._clippingPolygons&&this._clippingPolygons.destroy(),this._removeLayerAddedListener=this._removeLayerAddedListener&&this._removeLayerAddedListener(),this._removeLayerRemovedListener=this._removeLayerRemovedListener&&this._removeLayerRemovedListener(),this._removeLayerMovedListener=this._removeLayerMovedListener&&this._removeLayerMovedListener(),this._removeLayerShownListener=this._removeLayerShownListener&&this._removeLayerShownListener(),ve(this)};function INe(e,t,n){return function(i){let o,r,s=-1;const a=i.data.imagery,l=a.length;let u;for(u=0;u<l;++u)if(o=a[u],r=y(o.readyImagery,o.loadingImagery),r.imageryLayer===t){s=u;break}if(s!==-1){const h=s+e;if(o=a[h],r=c(o)?y(o.readyImagery,o.loadingImagery):void 0,!c(r)||r.imageryLayer!==t)return!t._createTileImagerySkeletons(i,n,h);for(u=s;u<h;++u)a[u].freeResources();a.splice(s,e)}return!0}}Pi.prototype._onLayerAdded=function(e,t){if(!this.isDestroyed()&&e.show){const n=this._terrainProvider,i=this,o=this._imageryLayersUpdatedEvent,r=function(){e._imageryCache={},i._quadtree.forEachLoadedTile(function(s){if(c(s._loadedCallbacks[e._layerIndex]))return;let a;const l=s.data.imagery,u=l.length;let h=-1,f=0;for(a=0;a<u;++a){const g=l[a];if(y(g.readyImagery,g.loadingImagery).imageryLayer===e)h===-1&&(h=a),++f;else if(h!==-1)break}if(h===-1)return;const _=h+f;e._createTileImagerySkeletons(s,n,_)&&(s._loadedCallbacks[e._layerIndex]=INe(f,e,n),s.state=Mc.LOADING)})};if(e.ready){const s=e.imageryProvider;s._reload=r}this._quadtree.forEachLoadedTile(function(s){e._createTileImagerySkeletons(s,n)&&(s.state=Mc.LOADING,s.level!==0&&(s._lastSelectionResultFrame!==i.quadtree._lastSelectionFrameNumber||s._lastSelectionResult!==Tn.RENDERED)&&(s.renderable=!1))}),this._layerOrderChanged=!0,o.raiseEvent()}};Pi.prototype._onLayerRemoved=function(e,t){this._quadtree.forEachLoadedTile(function(n){const i=n.data.imagery;let o=-1,r=0;for(let s=0,a=i.length;s<a;++s){const l=i[s];let u=l.loadingImagery;if(c(u)||(u=l.readyImagery),u.imageryLayer===e)o===-1&&(o=s),l.freeResources(),++r;else if(o!==-1)break}o!==-1&&i.splice(o,r)}),c(e.imageryProvider)&&(e.imageryProvider._reload=void 0),this._imageryLayersUpdatedEvent.raiseEvent()};Pi.prototype._onLayerMoved=function(e,t,n){this._layerOrderChanged=!0,this._imageryLayersUpdatedEvent.raiseEvent()};Pi.prototype._onLayerShownOrHidden=function(e,t,n){n?this._onLayerAdded(e,t):this._onLayerRemoved(e,t)};const DNe=new L,PNe=new L;function YB(e,t){const n={u_initialColor:function(){return this.properties.initialColor},u_fillHighlightColor:function(){return this.properties.fillHighlightColor},u_zoomedOutOceanSpecularIntensity:function(){return this.properties.zoomedOutOceanSpecularIntensity},u_oceanNormalMap:function(){return this.properties.oceanNormalMap},u_atmosphereLightIntensity:function(){return this.properties.atmosphereLightIntensity},u_atmosphereRayleighCoefficient:function(){return this.properties.atmosphereRayleighCoefficient},u_atmosphereMieCoefficient:function(){return this.properties.atmosphereMieCoefficient},u_atmosphereRayleighScaleHeight:function(){return this.properties.atmosphereRayleighScaleHeight},u_atmosphereMieScaleHeight:function(){return this.properties.atmosphereMieScaleHeight},u_atmosphereMieAnisotropy:function(){return this.properties.atmosphereMieAnisotropy},u_lightingFadeDistance:function(){return this.properties.lightingFadeDistance},u_nightFadeDistance:function(){return this.properties.nightFadeDistance},u_center3D:function(){return this.properties.center3D},u_verticalExaggerationAndRelativeHeight:function(){return this.properties.verticalExaggerationAndRelativeHeight},u_tileRectangle:function(){return this.properties.tileRectangle},u_modifiedModelView:function(){const i=e.context.uniformState.view,o=L.multiplyByPoint(i,this.properties.rtc,WB);return L.setTranslation(i,o,jB),jB},u_modifiedModelViewProjection:function(){const i=e.context.uniformState.view,o=e.context.uniformState.projection,r=L.multiplyByPoint(i,this.properties.rtc,WB);return L.setTranslation(i,r,nA),L.multiply(o,nA,nA),nA},u_dayTextures:function(){return this.properties.dayTextures},u_dayTextureTranslationAndScale:function(){return this.properties.dayTextureTranslationAndScale},u_dayTextureTexCoordsRectangle:function(){return this.properties.dayTextureTexCoordsRectangle},u_dayTextureUseWebMercatorT:function(){return this.properties.dayTextureUseWebMercatorT},u_dayTextureAlpha:function(){return this.properties.dayTextureAlpha},u_dayTextureNightAlpha:function(){return this.properties.dayTextureNightAlpha},u_dayTextureDayAlpha:function(){return this.properties.dayTextureDayAlpha},u_dayTextureBrightness:function(){return this.properties.dayTextureBrightness},u_dayTextureContrast:function(){return this.properties.dayTextureContrast},u_dayTextureHue:function(){return this.properties.dayTextureHue},u_dayTextureSaturation:function(){return this.properties.dayTextureSaturation},u_dayTextureOneOverGamma:function(){return this.properties.dayTextureOneOverGamma},u_dayIntensity:function(){return this.properties.dayIntensity},u_southAndNorthLatitude:function(){return this.properties.southAndNorthLatitude},u_southMercatorYAndOneOverHeight:function(){return this.properties.southMercatorYAndOneOverHeight},u_waterMask:function(){return this.properties.waterMask},u_waterMaskTranslationAndScale:function(){return this.properties.waterMaskTranslationAndScale},u_minMaxHeight:function(){return this.properties.minMaxHeight},u_scaleAndBias:function(){return this.properties.scaleAndBias},u_dayTextureSplit:function(){return this.properties.dayTextureSplit},u_dayTextureCutoutRectangles:function(){return this.properties.dayTextureCutoutRectangles},u_clippingPlanes:function(){const i=t._clippingPlanes;return c(i)&&c(i.texture)?i.texture:e.context.defaultTexture},u_cartographicLimitRectangle:function(){return this.properties.localizedCartographicLimitRectangle},u_clippingPlanesMatrix:function(){const i=t._clippingPlanes,o=c(i)?L.multiply(e.context.uniformState.view,i.modelMatrix,DNe):L.IDENTITY;return L.inverseTranspose(o,PNe)},u_clippingPlanesEdgeStyle:function(){const i=this.properties.clippingPlanesEdgeColor;return i.alpha=this.properties.clippingPlanesEdgeWidth,i},u_clippingDistance:function(){const i=t._clippingPolygons.clippingTexture;return c(i)?i:e.context.defaultTexture},u_clippingExtents:function(){const i=t._clippingPolygons.extentsTexture;return c(i)?i:e.context.defaultTexture},u_minimumBrightness:function(){return e.fog.minimumBrightness},u_hsbShift:function(){return this.properties.hsbShift},u_colorsToAlpha:function(){return this.properties.colorsToAlpha},u_frontFaceAlphaByDistance:function(){return this.properties.frontFaceAlphaByDistance},u_backFaceAlphaByDistance:function(){return this.properties.backFaceAlphaByDistance},u_translucencyRectangle:function(){return this.properties.localizedTranslucencyRectangle},u_undergroundColor:function(){return this.properties.undergroundColor},u_undergroundColorAlphaByDistance:function(){return this.properties.undergroundColorAlphaByDistance},u_lambertDiffuseMultiplier:function(){return this.properties.lambertDiffuseMultiplier},u_vertexShadowDarkness:function(){return this.properties.vertexShadowDarkness},properties:{initialColor:new te(0,0,.5,1),fillHighlightColor:new z(0,0,0,0),zoomedOutOceanSpecularIntensity:.5,oceanNormalMap:void 0,lightingFadeDistance:new H(65e5,9e6),nightFadeDistance:new H(1e7,4e7),atmosphereLightIntensity:10,atmosphereRayleighCoefficient:new d(55e-7,13e-6,284e-7),atmosphereMieCoefficient:new d(21e-6,21e-6,21e-6),atmosphereRayleighScaleHeight:1e4,atmosphereMieScaleHeight:3200,atmosphereMieAnisotropy:.9,hsbShift:new d,center3D:void 0,rtc:new d,modifiedModelView:new L,tileRectangle:new te,verticalExaggerationAndRelativeHeight:new H(1,0),dayTextures:[],dayTextureTranslationAndScale:[],dayTextureTexCoordsRectangle:[],dayTextureUseWebMercatorT:[],dayTextureAlpha:[],dayTextureNightAlpha:[],dayTextureDayAlpha:[],dayTextureBrightness:[],dayTextureContrast:[],dayTextureHue:[],dayTextureSaturation:[],dayTextureOneOverGamma:[],dayTextureSplit:[],dayTextureCutoutRectangles:[],dayIntensity:0,colorsToAlpha:[],southAndNorthLatitude:new H,southMercatorYAndOneOverHeight:new H,waterMask:void 0,waterMaskTranslationAndScale:new te,minMaxHeight:new H,scaleAndBias:new L,clippingPlanesEdgeColor:z.clone(z.WHITE),clippingPlanesEdgeWidth:0,localizedCartographicLimitRectangle:new te,frontFaceAlphaByDistance:new te,backFaceAlphaByDistance:new te,localizedTranslucencyRectangle:new te,undergroundColor:z.clone(z.TRANSPARENT),undergroundColorAlphaByDistance:new te,lambertDiffuseMultiplier:0,vertexShadowDarkness:0}};return c(t.materialUniformMap)?jt(n,t.materialUniformMap):n}function ONe(e,t,n){const i=n.data;let o,r;if(c(i.vertexArray)?(o=i.mesh,r=i.vertexArray):c(i.fill)&&c(i.fill.vertexArray)&&(o=i.fill.mesh,r=i.fill.vertexArray),!(!c(o)||!c(r))){if(c(i.wireframeVertexArray)){if(i.wireframeVertexArray.mesh===o)return;i.wireframeVertexArray.destroy(),i.wireframeVertexArray=void 0}i.wireframeVertexArray=LNe(e,r,o),i.wireframeVertexArray.mesh=o}}function LNe(e,t,n){const o={indices:n.indices,primitiveType:ze.TRIANGLES};ti.toWireframe(o);const r=o.indices,s=ct.createIndexBuffer({context:e,typedArray:r,usage:ke.STATIC_DRAW,indexDatatype:je.fromSizeInBytes(r.BYTES_PER_ELEMENT)});return new Ci({context:e,attributes:t._attributes,indexBuffer:s})}let X9,Q9,ox;(function(){const e=new Gt({geometry:Na.fromDimensions({dimensions:new d(2,2,2)})}),t=new Gt({geometry:new Fh({radius:1})});let n=new L,i,o;function r(s){return new Mt({geometryInstances:s,appearance:new tn({translucent:!1,flat:!0}),asynchronous:!1})}X9=function(s,a){return s===i||(ox(),i=s,n=L.fromRotationTranslation(s.halfAxes,s.center,n),e.modelMatrix=n,e.attributes.color=$t.fromColor(a),o=r(e)),o},Q9=function(s,a){return s===i||(ox(),i=s,n=L.fromTranslation(s.center,n),n=L.multiplyByUniformScale(n,s.radius,n),t.modelMatrix=n,t.attributes.color=$t.fromColor(a),o=r(t)),o},ox=function(){c(o)&&(o.destroy(),o=void 0,i=void 0)}})();const RNe=new te(0,0,0,0),NNe={frameState:void 0,surfaceTile:void 0,numberOfDayTextures:void 0,applyBrightness:void 0,applyContrast:void 0,applyHue:void 0,applySaturation:void 0,applyGamma:void 0,applyAlpha:void 0,applyDayNightAlpha:void 0,applySplit:void 0,showReflectiveOcean:void 0,showOceanWaves:void 0,enableLighting:void 0,dynamicAtmosphereLighting:void 0,dynamicAtmosphereLightingFromSun:void 0,showGroundAtmosphere:void 0,perFragmentGroundAtmosphere:void 0,hasVertexNormals:void 0,useWebMercatorProjection:void 0,enableFog:void 0,enableClippingPlanes:void 0,clippingPlanes:void 0,enableClippingPolygons:void 0,clippingPolygons:void 0,clippedByBoundaries:void 0,hasImageryLayerCutout:void 0,colorCorrect:void 0,colorToAlpha:void 0,hasGeodeticSurfaceNormals:void 0,hasExaggeration:void 0},MNe=z.TRANSPARENT,FNe=new vt;function BNe(e,t,n){const i=t.data;c(i.vertexArray)||(i.fill===void 0&&(i.fill=new Gp(t)),i.fill.update(e,n));const o=n.creditDisplay,r=i.terrainData;if(c(r)&&c(r.credits)){const ot=r.credits;for(let at=0,Xt=ot.length;at<Xt;++at)o.addCreditToNextFrame(ot[at])}let s=pt.maximumTextureImageUnits,a=i.waterMaskTexture,l=i.waterMaskTranslationAndScale;!c(a)&&c(i.fill)&&(a=i.fill.waterMaskTexture,l=i.fill.waterMaskTranslationAndScale);const u=n.cameraUnderground,h=n.globeTranslucencyState,f=h.translucent,_=h.frontFaceAlphaByDistance,g=h.backFaceAlphaByDistance,m=h.rectangle,b=y(e.undergroundColor,MNe),T=y(e.undergroundColorAlphaByDistance,FNe),x=$9(e,n)&&n.mode===oe.SCENE3D&&b.alpha>0&&(T.nearValue>0||T.farValue>0),C=e.lambertDiffuseMultiplier,w=e.vertexShadowDarkness,v=e.hasWaterMask&&c(a),P=e.oceanNormalMap,N=v&&c(P),k=e.terrainProvider,M=c(k)&&e.terrainProvider.hasVertexNormals,U=n.fog.enabled&&n.fog.renderable&&!u,B=e.showGroundAtmosphere&&n.mode===oe.SCENE3D,S=Vi.castShadows(e.shadows)&&!f,D=Vi.receiveShadows(e.shadows)&&!f,p=e.hueShift,I=e.saturationShift,O=e.brightnessShift;let F=!(R.equalsEpsilon(p,0,R.EPSILON7)&&R.equalsEpsilon(I,0,R.EPSILON7)&&R.equalsEpsilon(O,0,R.EPSILON7)),V=!1;if(B){const ot=d.magnitude(n.camera.positionWC),at=e.nightFadeOutDistance;V=ot>at}v&&--s,N&&--s,c(n.shadowState)&&n.shadowState.shadowsEnabled&&--s,c(e.clippingPlanes)&&e.clippingPlanes.enabled&&--s,c(e.clippingPolygons)&&e.clippingPolygons.enabled&&(--s,--s),s-=h.numberOfTextureUniforms;const G=i.renderedMesh;let j=G.center;const W=G.encoding,X=i.tileBoundingRegion,q=n.verticalExaggeration,ee=n.verticalExaggerationRelativeHeight,Y=q!==1,ne=W.hasGeodeticSurfaceNormals,Q=TNe;let le=0,pe=0,re=0,de=0,fe=!1;if(n.mode!==oe.SCENE3D){const ot=n.mapProjection,at=ot.project(ce.southwest(t.rectangle),ENe),Xt=ot.project(ce.northeast(t.rectangle),wNe);if(Q.x=at.x,Q.y=at.y,Q.z=Xt.x,Q.w=Xt.y,n.mode!==oe.MORPHING&&(j=CNe,j.x=0,j.y=(Q.z+Q.x)*.5,j.z=(Q.w+Q.y)*.5,Q.x-=j.y,Q.y-=j.z,Q.z-=j.y,Q.w-=j.z),n.mode===oe.SCENE2D&&W.quantization===Pa.BITS12){const it=1/(Math.pow(2,12)-1)*.5,fi=(Q.z-Q.x)*it,Hi=(Q.w-Q.y)*it;Q.x-=fi,Q.y-=Hi,Q.z+=fi,Q.w+=Hi}ot instanceof vn&&(le=t.rectangle.south,pe=t.rectangle.north,re=vn.geodeticLatitudeToMercatorAngle(le),de=1/(vn.geodeticLatitudeToMercatorAngle(pe)-re),fe=!0)}const ye=NNe;ye.frameState=n,ye.surfaceTile=i,ye.showReflectiveOcean=v,ye.showOceanWaves=N,ye.enableLighting=e.enableLighting,ye.dynamicAtmosphereLighting=e.dynamicAtmosphereLighting,ye.dynamicAtmosphereLightingFromSun=e.dynamicAtmosphereLightingFromSun,ye.showGroundAtmosphere=B,ye.atmosphereLightIntensity=e.atmosphereLightIntensity,ye.atmosphereRayleighCoefficient=e.atmosphereRayleighCoefficient,ye.atmosphereMieCoefficient=e.atmosphereMieCoefficient,ye.atmosphereRayleighScaleHeight=e.atmosphereRayleighScaleHeight,ye.atmosphereMieScaleHeight=e.atmosphereMieScaleHeight,ye.atmosphereMieAnisotropy=e.atmosphereMieAnisotropy,ye.perFragmentGroundAtmosphere=V,ye.hasVertexNormals=M,ye.useWebMercatorProjection=fe,ye.clippedByBoundaries=i.clippedByBoundaries,ye.hasGeodeticSurfaceNormals=ne,ye.hasExaggeration=Y;const Ce=i.imagery;let we=0;const Pe=Ce.length,lt=e.showSkirts&&!u&&!f,ft=e.backFaceCulling&&!u&&!f,We=ft?e._renderState:e._disableCullingRenderState,Fe=ft?e._blendRenderState:e._disableCullingBlendRenderState;let Dt=We,st=e._firstPassInitialColor;const et=n.context;if(c(e._debug.boundingSphereTile)||ox(),e._materialUniformMap!==e.materialUniformMap){e._materialUniformMap=e.materialUniformMap;const ot=e._drawCommands.length;for(let at=0;at<ot;++at)e._uniformMaps[at]=YB(n,e)}do{let ot=0,at,Xt;if(e._drawCommands.length<=e._usedDrawCommands?(at=new Ze,at.owner=t,at.cull=!1,at.boundingVolume=new se,at.orientedBoundingBox=void 0,Xt=YB(n,e),e._drawCommands.push(at),e._uniformMaps.push(Xt)):(at=e._drawCommands[e._usedDrawCommands],Xt=e._uniformMaps[e._usedDrawCommands]),at.owner=t,++e._usedDrawCommands,t===e._debug.boundingSphereTile){const Lr=X.boundingVolume,Xr=X.boundingSphere;c(Lr)?X9(Lr,z.RED).update(n):c(Xr)&&Q9(Xr,z.RED).update(n)}const it=Xt.properties;te.clone(st,it.initialColor),it.oceanNormalMap=P,it.lightingFadeDistance.x=e.lightingFadeOutDistance,it.lightingFadeDistance.y=e.lightingFadeInDistance,it.nightFadeDistance.x=e.nightFadeOutDistance,it.nightFadeDistance.y=e.nightFadeInDistance,it.atmosphereLightIntensity=e.atmosphereLightIntensity,it.atmosphereRayleighCoefficient=e.atmosphereRayleighCoefficient,it.atmosphereMieCoefficient=e.atmosphereMieCoefficient,it.atmosphereRayleighScaleHeight=e.atmosphereRayleighScaleHeight,it.atmosphereMieScaleHeight=e.atmosphereMieScaleHeight,it.atmosphereMieAnisotropy=e.atmosphereMieAnisotropy,it.zoomedOutOceanSpecularIntensity=e.zoomedOutOceanSpecularIntensity;const fi=u?g:_,Hi=u?_:g;c(fi)&&(te.fromElements(fi.near,fi.nearValue,fi.far,fi.farValue,it.frontFaceAlphaByDistance),te.fromElements(Hi.near,Hi.nearValue,Hi.far,Hi.farValue,it.backFaceAlphaByDistance)),te.fromElements(T.near,T.nearValue,T.far,T.farValue,it.undergroundColorAlphaByDistance),z.clone(b,it.undergroundColor),it.lambertDiffuseMultiplier=C,it.vertexShadowDarkness=w;const Ss=!c(i.vertexArray)&&c(e.fillHighlightColor)&&e.fillHighlightColor.alpha>0;Ss&&z.clone(e.fillHighlightColor,it.fillHighlightColor),it.verticalExaggerationAndRelativeHeight.x=q,it.verticalExaggerationAndRelativeHeight.y=ee,it.center3D=G.center,d.clone(j,it.rtc),te.clone(Q,it.tileRectangle),it.southAndNorthLatitude.x=le,it.southAndNorthLatitude.y=pe,it.southMercatorYAndOneOverHeight.x=re,it.southMercatorYAndOneOverHeight.y=de;const Qo=ANe,No=ix(t.rectangle,e.cartographicLimitRectangle),Gi=xNe,Ni=ix(t.rectangle,m);d.fromElements(p,I,O,it.hsbShift);const wi=t.rectangle,$r=1/wi.width,zn=1/wi.height;Qo.x=(No.west-wi.west)*$r,Qo.y=(No.south-wi.south)*zn,Qo.z=(No.east-wi.west)*$r,Qo.w=(No.north-wi.south)*zn,te.clone(Qo,it.localizedCartographicLimitRectangle),Gi.x=(Ni.west-wi.west)*$r,Gi.y=(Ni.south-wi.south)*zn,Gi.z=(Ni.east-wi.west)*$r,Gi.w=(Ni.north-wi.south)*zn,te.clone(Gi,it.localizedTranslucencyRectangle);const ci=U&&R.fog(t._distance,n.fog.density)>R.EPSILON3;F=F&&(ci||B);let Si=!1,Ko=!1,ri=!1,fr=!1,ha=!1,fa=!1,So=!1,Ln=!1,Zo=!1,ho=!1;for(;ot<s&&we<Pe;){const Lr=Ce[we],Xr=Lr.readyImagery;if(++we,!c(Xr)||Xr.imageryLayer.alpha===0)continue;const Jp=Lr.useWebMercatorT?Xr.textureWebMercator:Xr.texture;if(!c(Jp))throw new E("readyImagery is not actually ready!");const Jn=Xr.imageryLayer;c(Lr.textureTranslationAndScale)||(Lr.textureTranslationAndScale=Jn._calculateTextureTranslationAndScale(t,Lr)),it.dayTextures[ot]=Jp,it.dayTextureTranslationAndScale[ot]=Lr.textureTranslationAndScale,it.dayTextureTexCoordsRectangle[ot]=Lr.textureCoordinateRectangle,it.dayTextureUseWebMercatorT[ot]=Lr.useWebMercatorT,it.dayTextureAlpha[ot]=Jn.alpha,fa=fa||it.dayTextureAlpha[ot]!==1,it.dayTextureNightAlpha[ot]=Jn.nightAlpha,So=So||it.dayTextureNightAlpha[ot]!==1,it.dayTextureDayAlpha[ot]=Jn.dayAlpha,So=So||it.dayTextureDayAlpha[ot]!==1,it.dayTextureBrightness[ot]=Jn.brightness,Si=Si||it.dayTextureBrightness[ot]!==Qt.DEFAULT_BRIGHTNESS,it.dayTextureContrast[ot]=Jn.contrast,Ko=Ko||it.dayTextureContrast[ot]!==Qt.DEFAULT_CONTRAST,it.dayTextureHue[ot]=Jn.hue,ri=ri||it.dayTextureHue[ot]!==Qt.DEFAULT_HUE,it.dayTextureSaturation[ot]=Jn.saturation,fr=fr||it.dayTextureSaturation[ot]!==Qt.DEFAULT_SATURATION,it.dayTextureOneOverGamma[ot]=1/Jn.gamma,ha=ha||it.dayTextureOneOverGamma[ot]!==1/Qt.DEFAULT_GAMMA,it.dayTextureSplit[ot]=Jn.splitDirection,Ln=Ln||it.dayTextureSplit[ot]!==0;let qa=it.dayTextureCutoutRectangles[ot];if(c(qa)||(qa=it.dayTextureCutoutRectangles[ot]=new te),te.clone(te.ZERO,qa),c(Jn.cutoutRectangle)){const fo=ix(wi,Jn.cutoutRectangle),Mo=ce.simpleIntersection(fo,wi,Y9);Zo=c(Mo)||Zo,qa.x=(fo.west-wi.west)*$r,qa.y=(fo.south-wi.south)*zn,qa.z=(fo.east-wi.west)*$r,qa.w=(fo.north-wi.south)*zn}let Ya=it.colorsToAlpha[ot];c(Ya)||(Ya=it.colorsToAlpha[ot]=new te);const lf=c(Jn.colorToAlpha)&&Jn.colorToAlphaThreshold>0;if(ho=ho||lf,lf){const fo=Jn.colorToAlpha;Ya.x=fo.red,Ya.y=fo.green,Ya.z=fo.blue,Ya.w=Jn.colorToAlphaThreshold}else Ya.w=-1;if(c(Xr.credits)){const fo=Xr.credits;for(let Mo=0,Et=fo.length;Mo<Et;++Mo)o.addCreditToNextFrame(fo[Mo])}++ot}it.dayTextures.length=ot,it.waterMask=a,te.clone(l,it.waterMaskTranslationAndScale),it.minMaxHeight.x=W.minimumHeight,it.minMaxHeight.y=W.maximumHeight,L.clone(W.matrix,it.scaleAndBias);const qs=e._clippingPlanes,pi=c(qs)&&qs.enabled&&t.isClipped;pi&&(it.clippingPlanesEdgeColor=z.clone(qs.edgeColor,it.clippingPlanesEdgeColor),it.clippingPlanesEdgeWidth=qs.edgeWidth);const ji=e._clippingPolygons,cf=c(ji)&&ji.enabled&&t.isClipped;ye.numberOfDayTextures=ot,ye.applyBrightness=Si,ye.applyContrast=Ko,ye.applyHue=ri,ye.applySaturation=fr,ye.applyGamma=ha,ye.applyAlpha=fa,ye.applyDayNightAlpha=So,ye.applySplit=Ln,ye.enableFog=ci,ye.enableClippingPlanes=pi,ye.clippingPlanes=qs,ye.enableClippingPolygons=cf,ye.clippingPolygons=ji,ye.hasImageryLayerCutout=Zo,ye.colorCorrect=F,ye.highlightFillTile=Ss,ye.colorToAlpha=ho,ye.showUndergroundColor=x,ye.translucent=f;let vi=i.renderedMesh.indices.length;lt||(vi=i.renderedMesh.indexCountWithoutSkirts),at.shaderProgram=e._surfaceShaderSet.getShaderProgram(ye),at.castShadows=S,at.receiveShadows=D,at.renderState=Dt,at.primitiveType=ze.TRIANGLES,at.vertexArray=i.vertexArray||i.fill.vertexArray,at.count=vi,at.uniformMap=Xt,at.pass=xe.GLOBE,e._debug.wireframe&&(ONe(et,e,t),c(i.wireframeVertexArray)&&(at.vertexArray=i.wireframeVertexArray,at.primitiveType=ze.LINES,at.count=vi*2));let pr=at.boundingVolume;const Rd=at.orientedBoundingBox;n.mode!==oe.SCENE3D?(se.fromRectangleWithHeights2D(t.rectangle,n.mapProjection,X.minimumHeight,X.maximumHeight,pr),d.fromElements(pr.center.z,pr.center.x,pr.center.y,pr.center),n.mode===oe.MORPHING&&(pr=se.union(X.boundingSphere,pr,pr))):(at.boundingVolume=se.clone(X.boundingSphere,pr),at.orientedBoundingBox=Ct.clone(X.boundingVolume,Rd)),at.dirty=!0,f&&h.updateDerivedCommands(at,n),q9(at,n),Dt=Fe,st=RNe}while(we<Pe)}function K9(){this._enabled=!1,this._frontFaceAlpha=1,this._frontFaceAlphaByDistance=void 0,this._backFaceAlpha=1,this._backFaceAlphaByDistance=void 0,this._rectangle=ce.clone(ce.MAX_VALUE)}Object.defineProperties(K9.prototype,{enabled:{get:function(){return this._enabled},set:function(e){A.typeOf.bool("enabled",e),this._enabled=e}},frontFaceAlpha:{get:function(){return this._frontFaceAlpha},set:function(e){A.typeOf.number.greaterThanOrEquals("frontFaceAlpha",e,0),A.typeOf.number.lessThanOrEquals("frontFaceAlpha",e,1),this._frontFaceAlpha=e}},frontFaceAlphaByDistance:{get:function(){return this._frontFaceAlphaByDistance},set:function(e){if(c(e)&&e.far<e.near)throw new E("far distance must be greater than near distance.");this._frontFaceAlphaByDistance=vt.clone(e,this._frontFaceAlphaByDistance)}},backFaceAlpha:{get:function(){return this._backFaceAlpha},set:function(e){A.typeOf.number.greaterThanOrEquals("backFaceAlpha",e,0),A.typeOf.number.lessThanOrEquals("backFaceAlpha",e,1),this._backFaceAlpha=e}},backFaceAlphaByDistance:{get:function(){return this._backFaceAlphaByDistance},set:function(e){if(c(e)&&e.far<e.near)throw new E("far distance must be greater than near distance.");this._backFaceAlphaByDistance=vt.clone(e,this._backFaceAlphaByDistance)}},rectangle:{get:function(){return this._rectangle},set:function(e){c(e)||(e=ce.clone(ce.MAX_VALUE)),ce.clone(e,this._rectangle)}}});function Xo(){this._layers=[],this.layerAdded=new Le,this.layerRemoved=new Le,this.layerMoved=new Le,this.layerShownOrHidden=new Le}Object.defineProperties(Xo.prototype,{length:{get:function(){return this._layers.length}}});Xo.prototype.add=function(e,t){const n=c(t);if(!c(e))throw new E("layer is required.");if(n){if(t<0)throw new E("index must be greater than or equal to zero.");if(t>this._layers.length)throw new E("index must be less than or equal to the number of layers.")}n?this._layers.splice(t,0,e):(t=this._layers.length,this._layers.push(e)),this._update(),this.layerAdded.raiseEvent(e,t);const i=e.readyEvent.addEventListener(()=>{this.layerShownOrHidden.raiseEvent(e,e._layerIndex,e.show),i()})};Xo.prototype.addImageryProvider=function(e,t){if(!c(e))throw new E("imageryProvider is required.");const n=new Qt(e);return this.add(n,t),n};Xo.prototype.remove=function(e,t){t=y(t,!0);const n=this._layers.indexOf(e);return n!==-1?(this._layers.splice(n,1),this._update(),this.layerRemoved.raiseEvent(e,n),t&&e.destroy(),!0):!1};Xo.prototype.removeAll=function(e){e=y(e,!0);const t=this._layers;for(let n=0,i=t.length;n<i;n++){const o=t[n];this.layerRemoved.raiseEvent(o,n),e&&o.destroy()}this._layers=[]};Xo.prototype.contains=function(e){return this.indexOf(e)!==-1};Xo.prototype.indexOf=function(e){return this._layers.indexOf(e)};Xo.prototype.get=function(e){if(!c(e))throw new E("index is required.");return this._layers[e]};function JC(e,t){if(!c(t))throw new E("layer is required.");const n=e.indexOf(t);if(n===-1)throw new E("layer is not in this collection.");return n}function Z9(e,t,n){const i=e._layers;if(t=R.clamp(t,0,i.length-1),n=R.clamp(n,0,i.length-1),t===n)return;const o=i[t];i[t]=i[n],i[n]=o,e._update(),e.layerMoved.raiseEvent(o,n,t)}Xo.prototype.raise=function(e){const t=JC(this._layers,e);Z9(this,t,t+1)};Xo.prototype.lower=function(e){const t=JC(this._layers,e);Z9(this,t,t-1)};Xo.prototype.raiseToTop=function(e){const t=JC(this._layers,e);t!==this._layers.length-1&&(this._layers.splice(t,1),this._layers.push(e),this._update(),this.layerMoved.raiseEvent(e,this._layers.length-1,t))};Xo.prototype.lowerToBottom=function(e){const t=JC(this._layers,e);t!==0&&(this._layers.splice(t,1),this._layers.splice(0,0,e),this._update(),this.layerMoved.raiseEvent(e,0,t))};const zNe=new ce;function J9(e,t,n,i){const o=e.globe._surface._tilesToRender;let r;for(let a=0;!c(r)&&a<o.length;++a){const l=o[a];ce.contains(l.rectangle,t)&&(r=l)}if(!c(r))return;const s=r.data.imagery;for(let a=s.length-1;a>=0;--a){const l=s[a],u=l.readyImagery;if(!c(u)||!u.imageryLayer.ready)continue;const h=u.imageryLayer.imageryProvider;if(n&&!c(h.pickFeatures)||!ce.contains(u.rectangle,t))continue;const f=zNe,_=1/1024;f.west=R.lerp(r.rectangle.west,r.rectangle.east,l.textureCoordinateRectangle.x-_),f.east=R.lerp(r.rectangle.west,r.rectangle.east,l.textureCoordinateRectangle.z+_),f.south=R.lerp(r.rectangle.south,r.rectangle.north,l.textureCoordinateRectangle.y-_),f.north=R.lerp(r.rectangle.south,r.rectangle.north,l.textureCoordinateRectangle.w+_),ce.contains(f,t)&&i(u)}}Xo.prototype.pickImageryLayers=function(e,t){const n=t.globe.pick(e,t);if(!c(n))return;const i=t.globe.ellipsoid.cartesianToCartographic(n),o=[];if(J9(t,i,!1,function(r){o.push(r.imageryLayer)}),o.length!==0)return o};Xo.prototype.pickImageryLayerFeatures=function(e,t){const n=t.globe.pick(e,t);if(!c(n))return;const i=t.globe.ellipsoid.cartesianToCartographic(n),o=[],r=[];if(J9(t,i,!0,function(s){if(!s.imageryLayer.ready)return;const l=s.imageryLayer.imageryProvider.pickFeatures(s.x,s.y,s.level,i.longitude,i.latitude);c(l)&&(o.push(l),r.push(s.imageryLayer))}),o.length!==0)return Promise.all(o).then(function(s){const a=[];for(let l=0;l<s.length;++l){const u=s[l],h=r[l];if(c(u)&&u.length>0)for(let f=0;f<u.length;++f){const _=u[f];_.imageryLayer=h,c(_.position)||(_.position=i),a.push(_)}}return a})};Xo.prototype.queueReprojectionCommands=function(e){const t=this._layers;for(let n=0,i=t.length;n<i;++n)t[n].queueReprojectionCommands(e)};Xo.prototype.cancelReprojections=function(){const e=this._layers;for(let t=0,n=e.length;t<n;++t)e[t].cancelReprojections()};Xo.prototype.isDestroyed=function(){return!1};Xo.prototype.destroy=function(){return this.removeAll(!0),ve(this)};Xo.prototype._update=function(){let e=!0;const t=this._layers;let n,i,o,r;for(o=0,r=t.length;o<r;++o)i=t[o],i._layerIndex=o,i.show?(i._isBaseLayer=e,e=!1):i._isBaseLayer=!1,i.show!==i._show&&(c(i._show)&&(c(n)||(n=[]),n.push(i)),i._show=i.show);if(c(n))for(o=0,r=n.length;o<r;++o)i=n[o],this.layerShownOrHidden.raiseEvent(i,i._layerIndex,i.show)};function eW(e){this._ellipsoid=new Vc(e.ellipsoid,d.ZERO)}Object.defineProperties(eW.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}});function Ms(e){if(!c(e))throw new E("options is required.");if(c(e.x))if(c(e.y)){if(e.x<0||e.y<0)throw new E("options.x and options.y must be greater than or equal to zero.")}else throw new E("options.y is required.");else throw new E("options.x is required.");if(!c(e.level))throw new E("options.level is required and must be greater than or equal to zero.");if(!c(e.tilingScheme))throw new E("options.tilingScheme is required.");this._tilingScheme=e.tilingScheme,this._x=e.x,this._y=e.y,this._level=e.level,this._parent=e.parent,this._rectangle=this._tilingScheme.tileXYToRectangle(this._x,this._y,this._level),this._southwestChild=void 0,this._southeastChild=void 0,this._northwestChild=void 0,this._northeastChild=void 0,this.replacementPrevious=void 0,this.replacementNext=void 0,this._distance=0,this._loadPriority=0,this._customData=[],this._frameUpdated=void 0,this._lastSelectionResult=Tn.NONE,this._lastSelectionResultFrame=void 0,this._loadedCallbacks={},this.state=Mc.START,this.renderable=!1,this.upsampledFromParent=!1,this.data=void 0}Ms.createLevelZeroTiles=function(e){if(!c(e))throw new E("tilingScheme is required.");const t=e.getNumberOfXTilesAtLevel(0),n=e.getNumberOfYTilesAtLevel(0),i=new Array(t*n);let o=0;for(let r=0;r<n;++r)for(let s=0;s<t;++s)i[o++]=new Ms({tilingScheme:e,x:s,y:r,level:0});return i};Ms.prototype._updateCustomData=function(e,t,n){let i=this.customData,o,r,s;if(c(t)&&c(n)){for(i=i.filter(function(a){return n.indexOf(a)===-1}),this._customData=i,s=this._rectangle,o=0;o<t.length;++o)r=t[o],ce.contains(s,r.positionCartographic)&&i.push(r);this._frameUpdated=e}else{const a=this._parent;if(c(a)&&this._frameUpdated!==a._frameUpdated){i.length=0,s=this._rectangle;const l=a.customData;for(o=0;o<l.length;++o)r=l[o],ce.contains(s,r.positionCartographic)&&i.push(r);this._frameUpdated=a._frameUpdated}}};Object.defineProperties(Ms.prototype,{tilingScheme:{get:function(){return this._tilingScheme}},x:{get:function(){return this._x}},y:{get:function(){return this._y}},level:{get:function(){return this._level}},parent:{get:function(){return this._parent}},rectangle:{get:function(){return this._rectangle}},children:{get:function(){return[this.northwestChild,this.northeastChild,this.southwestChild,this.southeastChild]}},southwestChild:{get:function(){return c(this._southwestChild)||(this._southwestChild=new Ms({tilingScheme:this.tilingScheme,x:this.x*2,y:this.y*2+1,level:this.level+1,parent:this})),this._southwestChild}},southeastChild:{get:function(){return c(this._southeastChild)||(this._southeastChild=new Ms({tilingScheme:this.tilingScheme,x:this.x*2+1,y:this.y*2+1,level:this.level+1,parent:this})),this._southeastChild}},northwestChild:{get:function(){return c(this._northwestChild)||(this._northwestChild=new Ms({tilingScheme:this.tilingScheme,x:this.x*2,y:this.y*2,level:this.level+1,parent:this})),this._northwestChild}},northeastChild:{get:function(){return c(this._northeastChild)||(this._northeastChild=new Ms({tilingScheme:this.tilingScheme,x:this.x*2+1,y:this.y*2,level:this.level+1,parent:this})),this._northeastChild}},customData:{get:function(){return this._customData}},needsLoading:{get:function(){return this.state<Mc.DONE}},eligibleForUnloading:{get:function(){let e=!0;return c(this.data)&&(e=this.data.eligibleForUnloading,c(e)||(e=!0)),e}}});Ms.prototype.findLevelZeroTile=function(e,t,n){const i=this.tilingScheme.getNumberOfXTilesAtLevel(0);if(t<0?t+=i:t>=i&&(t-=i),!(n<0||n>=this.tilingScheme.getNumberOfYTilesAtLevel(0)))return e.filter(function(o){return o.x===t&&o.y===n})[0]};Ms.prototype.findTileToWest=function(e){const t=this.parent;if(t===void 0)return this.findLevelZeroTile(e,this.x-1,this.y);if(t.southeastChild===this)return t.southwestChild;if(t.northeastChild===this)return t.northwestChild;const n=t.findTileToWest(e);if(n!==void 0)return t.southwestChild===this?n.southeastChild:n.northeastChild};Ms.prototype.findTileToEast=function(e){const t=this.parent;if(t===void 0)return this.findLevelZeroTile(e,this.x+1,this.y);if(t.southwestChild===this)return t.southeastChild;if(t.northwestChild===this)return t.northeastChild;const n=t.findTileToEast(e);if(n!==void 0)return t.southeastChild===this?n.southwestChild:n.northwestChild};Ms.prototype.findTileToSouth=function(e){const t=this.parent;if(t===void 0)return this.findLevelZeroTile(e,this.x,this.y+1);if(t.northwestChild===this)return t.southwestChild;if(t.northeastChild===this)return t.southeastChild;const n=t.findTileToSouth(e);if(n!==void 0)return t.southwestChild===this?n.northwestChild:n.northeastChild};Ms.prototype.findTileToNorth=function(e){const t=this.parent;if(t===void 0)return this.findLevelZeroTile(e,this.x,this.y-1);if(t.southwestChild===this)return t.northwestChild;if(t.southeastChild===this)return t.northeastChild;const n=t.findTileToNorth(e);if(n!==void 0)return t.northwestChild===this?n.southwestChild:n.southeastChild};Ms.prototype.freeResources=function(){this.state=Mc.START,this.renderable=!1,this.upsampledFromParent=!1,c(this.data)&&c(this.data.freeResources)&&this.data.freeResources(),iA(this._southwestChild),this._southwestChild=void 0,iA(this._southeastChild),this._southeastChild=void 0,iA(this._northwestChild),this._northwestChild=void 0,iA(this._northeastChild),this._northeastChild=void 0};function iA(e){c(e)&&e.freeResources()}function eE(){this.head=void 0,this.tail=void 0,this.count=0,this._lastBeforeStartOfFrame=void 0}eE.prototype.markStartOfRenderFrame=function(){this._lastBeforeStartOfFrame=this.head};eE.prototype.trimTiles=function(e){let t=this.tail,n=!0;for(;n&&c(this._lastBeforeStartOfFrame)&&this.count>e&&c(t);){n=t!==this._lastBeforeStartOfFrame;const i=t.replacementPrevious;t.eligibleForUnloading&&(t.freeResources(),tW(this,t)),t=i}};function tW(e,t){const n=t.replacementPrevious,i=t.replacementNext;t===e._lastBeforeStartOfFrame&&(e._lastBeforeStartOfFrame=i),t===e.head?e.head=i:n.replacementNext=i,t===e.tail?e.tail=n:i.replacementPrevious=n,t.replacementPrevious=void 0,t.replacementNext=void 0,--e.count}eE.prototype.markTileRendered=function(e){const t=this.head;if(t===e){e===this._lastBeforeStartOfFrame&&(this._lastBeforeStartOfFrame=e.replacementNext);return}if(++this.count,!c(t)){e.replacementPrevious=void 0,e.replacementNext=void 0,this.head=e,this.tail=e;return}(c(e.replacementPrevious)||c(e.replacementNext))&&tW(this,e),e.replacementPrevious=void 0,e.replacementNext=t,t.replacementPrevious=e,this.head=e};function Gc(e){if(!c(e)||!c(e.tileProvider))throw new E("options.tileProvider is required.");if(c(e.tileProvider.quadtree))throw new E("A QuadtreeTileProvider can only be used with a single QuadtreePrimitive");this._tileProvider=e.tileProvider,this._tileProvider.quadtree=this,this._debug={enableDebugOutput:!1,maxDepth:0,maxDepthVisited:0,tilesVisited:0,tilesCulled:0,tilesRendered:0,tilesWaitingForChildren:0,lastMaxDepth:-1,lastMaxDepthVisited:-1,lastTilesVisited:-1,lastTilesCulled:-1,lastTilesRendered:-1,lastTilesWaitingForChildren:-1,suspendLodUpdate:!1};const n=this._tileProvider.tilingScheme.ellipsoid;this._tilesToRender=[],this._tileLoadQueueHigh=[],this._tileLoadQueueMedium=[],this._tileLoadQueueLow=[],this._tileReplacementQueue=new eE,this._levelZeroTiles=void 0,this._loadQueueTimeSlice=5,this._tilesInvalidated=!1,this._addHeightCallbacks=[],this._removeHeightCallbacks=[],this._tileToUpdateHeights=[],this._lastTileIndex=0,this._updateHeightsTimeSlice=2,this._cameraPositionCartographic=void 0,this._cameraReferenceFrameOriginCartographic=void 0,this.maximumScreenSpaceError=y(e.maximumScreenSpaceError,2),this.tileCacheSize=y(e.tileCacheSize,100),this.loadingDescendantLimit=20,this.preloadAncestors=!0,this.preloadSiblings=!1,this._occluders=new eW({ellipsoid:n}),this._tileLoadProgressEvent=new Le,this._lastTileLoadQueueLength=0,this._lastSelectionFrameNumber=void 0}Object.defineProperties(Gc.prototype,{tileProvider:{get:function(){return this._tileProvider}},tileLoadProgressEvent:{get:function(){return this._tileLoadProgressEvent}},occluders:{get:function(){return this._occluders}}});Gc.prototype.invalidateAllTiles=function(){this._tilesInvalidated=!0};function UNe(e){const t=e._tileReplacementQueue;t.head=void 0,t.tail=void 0,t.count=0,nW(e);const n=e._levelZeroTiles;if(c(n))for(let i=0;i<n.length;++i){const r=n[i].customData,s=r.length;for(let a=0;a<s;++a){const l=r[a];l.level=0,e._addHeightCallbacks.push(l)}n[i].freeResources()}e._levelZeroTiles=void 0,e._tileProvider.cancelReprojections()}Gc.prototype.forEachLoadedTile=function(e){let t=this._tileReplacementQueue.head;for(;c(t);)t.state!==Mc.START&&e(t),t=t.replacementNext};Gc.prototype.forEachRenderedTile=function(e){const t=this._tilesToRender;for(let n=0,i=t.length;n<i;++n)e(t[n])};Gc.prototype.updateHeight=function(e,t){const n=this,i={positionOnEllipsoidSurface:void 0,positionCartographic:e,level:-1,callback:t};return i.removeFunc=function(){const o=n._addHeightCallbacks,r=o.length;for(let s=0;s<r;++s)if(o[s]===i){o.splice(s,1);break}n._removeHeightCallbacks.push(i),i.callback&&(i.callback=void 0)},n._addHeightCallbacks.push(i),i.removeFunc};Gc.prototype.update=function(e){c(this._tileProvider.update)&&this._tileProvider.update(e)};function nW(e){const t=e._debug;t.maxDepth=0,t.maxDepthVisited=0,t.tilesVisited=0,t.tilesCulled=0,t.tilesRendered=0,t.tilesWaitingForChildren=0,e._tileLoadQueueHigh.length=0,e._tileLoadQueueMedium.length=0,e._tileLoadQueueLow.length=0}Gc.prototype.beginFrame=function(e){!e.passes.render||(this._tilesInvalidated&&(UNe(this),this._tilesInvalidated=!1),this._tileProvider.initialize(e),nW(this),!this._debug.suspendLodUpdate&&this._tileReplacementQueue.markStartOfRenderFrame())};Gc.prototype.render=function(e){const t=e.passes,n=this._tileProvider;t.render&&(n.beginUpdate(e),GNe(this,e),JNe(this,e),n.endUpdate(e)),t.pick&&this._tilesToRender.length>0&&n.updateForPick(e)};function kNe(e,t){const n=e._tileLoadQueueHigh.length+e._tileLoadQueueMedium.length+e._tileLoadQueueLow.length;if(n!==e._lastTileLoadQueueLength||e._tilesInvalidated){const o=Le.prototype.raiseEvent.bind(e._tileLoadProgressEvent,n);t.afterRender.push(()=>(o(),!0)),e._lastTileLoadQueueLength=n}const i=e._debug;i.enableDebugOutput&&!i.suspendLodUpdate&&(i.maxDepth=e._tilesToRender.reduce(function(o,r){return Math.max(o,r.level)},-1),i.tilesRendered=e._tilesToRender.length,(i.tilesVisited!==i.lastTilesVisited||i.tilesRendered!==i.lastTilesRendered||i.tilesCulled!==i.lastTilesCulled||i.maxDepth!==i.lastMaxDepth||i.tilesWaitingForChildren!==i.lastTilesWaitingForChildren||i.maxDepthVisited!==i.lastMaxDepthVisited)&&(console.log(`Visited ${i.tilesVisited}, Rendered: ${i.tilesRendered}, Culled: ${i.tilesCulled}, Max Depth Rendered: ${i.maxDepth}, Max Depth Visited: ${i.maxDepthVisited}, Waiting for children: ${i.tilesWaitingForChildren}`),i.lastTilesVisited=i.tilesVisited,i.lastTilesRendered=i.tilesRendered,i.lastTilesCulled=i.tilesCulled,i.lastMaxDepth=i.maxDepth,i.lastTilesWaitingForChildren=i.tilesWaitingForChildren,i.lastMaxDepthVisited=i.maxDepthVisited))}Gc.prototype.endFrame=function(e){!e.passes.render||e.mode===oe.MORPHING||(XNe(this,e),ZNe(this,e),kNe(this,e))};Gc.prototype.isDestroyed=function(){return!1};Gc.prototype.destroy=function(){this._tileProvider=this._tileProvider&&this._tileProvider.destroy()};let gy;const $B=new he;function VNe(e,t){let n=ce.center(e.rectangle,$B);const i=n.longitude-gy.longitude,o=n.latitude-gy.latitude;n=ce.center(t.rectangle,$B);const r=n.longitude-gy.longitude,s=n.latitude-gy.latitude;return i*i+o*o-(r*r+s*s)}const HNe=new d;let ey=[];function GNe(e,t){const n=e._debug;if(n.suspendLodUpdate)return;const i=e._tilesToRender;i.length=0;let o;const r=e._tileProvider;if(!c(e._levelZeroTiles)){const b=r.tilingScheme;if(c(b)){const T=r.tilingScheme;e._levelZeroTiles=Ms.createLevelZeroTiles(T);const x=e._levelZeroTiles.length;if(ey.length<x)for(ey=new Array(x),o=0;o<x;++o)ey[o]===void 0&&(ey[o]=new yy)}else return}e._occluders.ellipsoid.cameraPosition=t.camera.positionWC;let s;const a=e._levelZeroTiles,l=a.length>1?e._occluders:void 0;gy=t.camera.positionCartographic,a.sort(VNe);const u=e._addHeightCallbacks,h=e._removeHeightCallbacks,f=t.frameNumber;let _;if(u.length>0||h.length>0){for(o=0,_=a.length;o<_;++o)s=a[o],s._updateCustomData(f,u,h);u.length=0,h.length=0}const g=t.camera;e._cameraPositionCartographic=g.positionCartographic;const m=L.getTranslation(g.transform,HNe);for(e._cameraReferenceFrameOriginCartographic=e.tileProvider.tilingScheme.ellipsoid.cartesianToCartographic(m,e._cameraReferenceFrameOriginCartographic),o=0,_=a.length;o<_;++o)s=a[o],e._tileReplacementQueue.markTileRendered(s),s.renderable?Nr(e,s,r,t,l,!1,ey[o]):(Vu(e,e._tileLoadQueueHigh,s,t),++n.tilesWaitingForChildren);e._lastSelectionFrameNumber=f}function Vu(e,t,n,i){!n.needsLoading||(e.tileProvider.computeTileLoadPriority!==void 0&&(n._loadPriority=e.tileProvider.computeTileLoadPriority(n,i)),t.push(n))}function yy(){this.allAreRenderable=!0,this.anyWereRenderedLastFrame=!1,this.notYetRenderableCount=0}function iW(){this.southwest=new yy,this.southeast=new yy,this.northwest=new yy,this.northeast=new yy}iW.prototype.combine=function(e){const t=this.southwest,n=this.southeast,i=this.northwest,o=this.northeast;e.allAreRenderable=t.allAreRenderable&&n.allAreRenderable&&i.allAreRenderable&&o.allAreRenderable,e.anyWereRenderedLastFrame=t.anyWereRenderedLastFrame||n.anyWereRenderedLastFrame||i.anyWereRenderedLastFrame||o.anyWereRenderedLastFrame,e.notYetRenderableCount=t.notYetRenderableCount+n.notYetRenderableCount+i.notYetRenderableCount+o.notYetRenderableCount};const BD=new Array(31);for(let e=0;e<BD.length;++e)BD[e]=new iW;function jNe(e,t,n,i,o){const r=e._debug;++r.tilesVisited,e._tileReplacementQueue.markTileRendered(n),n._updateCustomData(t.frameNumber),n.level>r.maxDepthVisited&&(r.maxDepthVisited=n.level);const s=YNe(e,t,n)<e.maximumScreenSpaceError,a=n.southwestChild,l=n.southeastChild,u=n.northwestChild,h=n.northeastChild,f=e._lastSelectionFrameNumber,_=n._lastSelectionResultFrame===f?n._lastSelectionResult:Tn.NONE,g=e.tileProvider;if(s||i){const m=Tn.originalResult(_)===Tn.RENDERED,b=Tn.originalResult(_)===Tn.CULLED||_===Tn.NONE,T=n.state===Mc.DONE;let x=m||b||T;if(x||c(g.canRenderWithoutLosingDetail)&&(x=g.canRenderWithoutLosingDetail(n)),x){s&&Vu(e,e._tileLoadQueueMedium,n,t),oA(e,n),o.allAreRenderable=n.renderable,o.anyWereRenderedLastFrame=_===Tn.RENDERED,o.notYetRenderableCount=n.renderable?0:1,n._lastSelectionResultFrame=t.frameNumber,n._lastSelectionResult=Tn.RENDERED,o.anyWereRenderedLastFrame||e._tileToUpdateHeights.push(n);return}i=!0,s&&Vu(e,e._tileLoadQueueHigh,n,t)}if(g.canRefine(n)){if(a.upsampledFromParent&&l.upsampledFromParent&&u.upsampledFromParent&&h.upsampledFromParent){oA(e,n),Vu(e,e._tileLoadQueueMedium,n,t),e._tileReplacementQueue.markTileRendered(a),e._tileReplacementQueue.markTileRendered(l),e._tileReplacementQueue.markTileRendered(u),e._tileReplacementQueue.markTileRendered(h),o.allAreRenderable=n.renderable,o.anyWereRenderedLastFrame=_===Tn.RENDERED,o.notYetRenderableCount=n.renderable?0:1,n._lastSelectionResultFrame=t.frameNumber,n._lastSelectionResult=Tn.RENDERED,o.anyWereRenderedLastFrame||e._tileToUpdateHeights.push(n);return}n._lastSelectionResultFrame=t.frameNumber,n._lastSelectionResult=Tn.REFINED;const b=e._tilesToRender.length,T=e._tileLoadQueueLow.length,x=e._tileLoadQueueMedium.length,C=e._tileLoadQueueHigh.length,w=e._tileToUpdateHeights.length;if(WNe(e,a,l,u,h,t,i,o),b!==e._tilesToRender.length){const v=o.allAreRenderable,P=o.anyWereRenderedLastFrame,N=o.notYetRenderableCount;let k=!1;if(!v&&!P){const M=e._tilesToRender;for(let B=b;B<M.length;++B){let S=M[B];for(;S!==void 0&&S._lastSelectionResult!==Tn.KICKED&&S!==n;)S._lastSelectionResult=Tn.kick(S._lastSelectionResult),S=S.parent}e._tilesToRender.length=b,e._tileToUpdateHeights.length=w,oA(e,n),n._lastSelectionResult=Tn.RENDERED;const U=_===Tn.RENDERED;!U&&N>e.loadingDescendantLimit&&(e._tileLoadQueueLow.length=T,e._tileLoadQueueMedium.length=x,e._tileLoadQueueHigh.length=C,Vu(e,e._tileLoadQueueMedium,n,t),o.notYetRenderableCount=n.renderable?0:1,k=!0),o.allAreRenderable=n.renderable,o.anyWereRenderedLastFrame=U,U||e._tileToUpdateHeights.push(n),++r.tilesWaitingForChildren}e.preloadAncestors&&!k&&Vu(e,e._tileLoadQueueLow,n,t)}return}n._lastSelectionResultFrame=t.frameNumber,n._lastSelectionResult=Tn.RENDERED,oA(e,n),Vu(e,e._tileLoadQueueHigh,n,t),o.allAreRenderable=n.renderable,o.anyWereRenderedLastFrame=_===Tn.RENDERED,o.notYetRenderableCount=n.renderable?0:1}function WNe(e,t,n,i,o,r,s,a){const l=r.camera.positionCartographic,u=e._tileProvider,h=e._occluders,f=BD[t.level],_=f.southwest,g=f.southeast,m=f.northwest,b=f.northeast;l.longitude<t.rectangle.east?l.latitude<t.rectangle.north?(Nr(e,t,u,r,h,s,_),Nr(e,n,u,r,h,s,g),Nr(e,i,u,r,h,s,m),Nr(e,o,u,r,h,s,b)):(Nr(e,i,u,r,h,s,m),Nr(e,t,u,r,h,s,_),Nr(e,o,u,r,h,s,b),Nr(e,n,u,r,h,s,g)):l.latitude<t.rectangle.north?(Nr(e,n,u,r,h,s,g),Nr(e,t,u,r,h,s,_),Nr(e,o,u,r,h,s,b),Nr(e,i,u,r,h,s,m)):(Nr(e,o,u,r,h,s,b),Nr(e,i,u,r,h,s,m),Nr(e,n,u,r,h,s,g),Nr(e,t,u,r,h,s,_)),f.combine(a)}function qNe(e,t){const n=t.rectangle;return c(e._cameraPositionCartographic)&&ce.contains(n,e._cameraPositionCartographic)||c(e._cameraReferenceFrameOriginCartographic)&&ce.contains(n,e._cameraReferenceFrameOriginCartographic)}function Nr(e,t,n,i,o,r,s){if(n.computeTileVisibility(t,i,o)!==ir.NONE)return jNe(e,i,t,r,s);if(++e._debug.tilesCulled,e._tileReplacementQueue.markTileRendered(t),s.allAreRenderable=!0,s.anyWereRenderedLastFrame=!1,s.notYetRenderableCount=0,qNe(e,t)){(!c(t.data)||!c(t.data.vertexArray))&&Vu(e,e._tileLoadQueueMedium,t,i);const a=e._lastSelectionFrameNumber,l=t._lastSelectionResultFrame===a?t._lastSelectionResult:Tn.NONE;l!==Tn.CULLED_BUT_NEEDED&&l!==Tn.RENDERED&&e._tileToUpdateHeights.push(t),t._lastSelectionResult=Tn.CULLED_BUT_NEEDED}else(e.preloadSiblings||t.level===0)&&Vu(e,e._tileLoadQueueLow,t,i),t._lastSelectionResult=Tn.CULLED;t._lastSelectionResultFrame=i.frameNumber}function YNe(e,t,n){if(t.mode===oe.SCENE2D||t.camera.frustum instanceof It||t.camera.frustum instanceof Ki)return $Ne(e,t,n);const i=e._tileProvider.getLevelMaximumGeometricError(n.level),o=n._distance,r=t.context.drawingBufferHeight,s=t.camera.frustum.sseDenominator;let a=i*r/(o*s);return t.fog.enabled&&(a-=R.fog(o,t.fog.density)*t.fog.sse),a/=t.pixelRatio,a}function $Ne(e,t,n){let o=t.camera.frustum;const r=o.offCenterFrustum;c(r)&&(o=r);const s=t.context,a=s.drawingBufferWidth,l=s.drawingBufferHeight,u=e._tileProvider.getLevelMaximumGeometricError(n.level),h=Math.max(o.top-o.bottom,o.right-o.left)/Math.max(a,l);let f=u/h;return t.fog.enabled&&t.mode!==oe.SCENE2D&&(f-=R.fog(n._distance,t.fog.density)*t.fog.sse),f/=t.pixelRatio,f}function oA(e,t){e._tilesToRender.push(t)}function XNe(e,t){const n=e._tileLoadQueueHigh,i=e._tileLoadQueueMedium,o=e._tileLoadQueueLow;if(n.length===0&&i.length===0&&o.length===0)return;e._tileReplacementQueue.trimTiles(e.tileCacheSize);const r=xo()+e._loadQueueTimeSlice,s=e._tileProvider;let a=_v(e,t,s,r,n,!1);a=_v(e,t,s,r,i,a),_v(e,t,s,r,o,a)}function QNe(e,t){return e._loadPriority-t._loadPriority}function _v(e,t,n,i,o,r){n.computeTileLoadPriority!==void 0&&o.sort(QNe);for(let s=0,a=o.length;s<a&&(xo()<i||!r);++s){const l=o[s];e._tileReplacementQueue.markTileRendered(l),n.loadTile(t,l),r=!0}return r}const Sm=new nn,gv=new he,Xd=new d,KNe=[];function ZNe(e,t){if(!c(e.tileProvider.tilingScheme))return;const n=KNe;n.length=0;const i=e._tileToUpdateHeights,o=xo(),r=e._updateHeightsTimeSlice,s=o+r,a=t.mode,l=t.mapProjection,u=e.tileProvider.tilingScheme.ellipsoid;let h;for(;i.length>0;){const f=i[0];if(!c(f.data)||!c(f.data.mesh)){const b=f._lastSelectionResultFrame===e._lastSelectionFrameNumber?f._lastSelectionResult:Tn.NONE;(b===Tn.RENDERED||b===Tn.CULLED_BUT_NEEDED)&&n.push(f),i.shift(),e._lastTileIndex=0;continue}const _=f.customData,g=_.length;let m=!1;for(h=e._lastTileIndex;h<g;++h){const b=_[h],T=f.data.terrainData,x=c(T)&&T.wasCreatedByUpsampling();if(f.level>b.level&&!x){if(c(b.positionOnEllipsoidSurface)||(b.positionOnEllipsoidSurface=d.fromRadians(b.positionCartographic.longitude,b.positionCartographic.latitude,0,u)),a===oe.SCENE3D){const w=u.geodeticSurfaceNormal(b.positionOnEllipsoidSurface,Sm.direction),v=u.getSurfaceNormalIntersectionWithZAxis(b.positionOnEllipsoidSurface,11500,Sm.origin);if(!c(v)){let P=0;c(f.data.tileBoundingRegion)&&(P=f.data.tileBoundingRegion.minimumHeight);const N=Math.min(P,-11500),k=d.multiplyByScalar(w,Math.abs(N)+1,Xd);d.subtract(b.positionOnEllipsoidSurface,k,Sm.origin)}}else he.clone(b.positionCartographic,gv),gv.height=-11500,l.project(gv,Xd),d.fromElements(Xd.z,Xd.x,Xd.y,Xd),d.clone(Xd,Sm.origin),d.clone(d.UNIT_X,Sm.direction);const C=f.data.pick(Sm,a,l,!1,Xd);c(C)&&(c(b.callback)&&b.callback(C),b.level=f.level)}if(xo()>=s){m=!0;break}}if(m){e._lastTileIndex=h;break}else e._lastTileIndex=0,i.shift()}for(h=0;h<n.length;h++)i.push(n[h])}function JNe(e,t){const n=e._tileProvider,i=e._tilesToRender;for(let o=0,r=i.length;o<r;++o){const s=i[o];n.showTileThisFrame(s,t)}}function Ul(e){e=y(e,ae.WGS84);const t=new _d({ellipsoid:e}),n=new Xo;this._ellipsoid=e,this._imageryLayerCollection=n,this._surfaceShaderSet=new m1,this._material=void 0,this._surface=new Gc({tileProvider:new Pi({terrainProvider:t,imageryLayers:n,surfaceShaderSet:this._surfaceShaderSet})}),this._terrainProvider=t,this._terrainProviderChanged=new Le,this._undergroundColor=z.clone(z.BLACK),this._undergroundColorAlphaByDistance=new vt(e.maximumRadius/1e3,0,e.maximumRadius/5,1),this._translucency=new K9,zD(this),this.show=!0,this._oceanNormalMapResourceDirty=!0,this._oceanNormalMapResource=new Ae({url:Zt("Assets/Textures/waterNormalsSmall.jpg")}),this.maximumScreenSpaceError=2,this.tileCacheSize=100,this.loadingDescendantLimit=20,this.preloadAncestors=!0,this.preloadSiblings=!1,this.fillHighlightColor=void 0,this.enableLighting=!1,this.lambertDiffuseMultiplier=.9,this.dynamicAtmosphereLighting=!0,this.dynamicAtmosphereLightingFromSun=!1,this.showGroundAtmosphere=!0,this.atmosphereLightIntensity=10,this.atmosphereRayleighCoefficient=new d(55e-7,13e-6,284e-7),this.atmosphereMieCoefficient=new d(21e-6,21e-6,21e-6),this.atmosphereRayleighScaleHeight=1e4,this.atmosphereMieScaleHeight=3200,this.atmosphereMieAnisotropy=.9,this.lightingFadeOutDistance=1e7,this.lightingFadeInDistance=2e7,this.nightFadeOutDistance=1e7,this.nightFadeInDistance=5e7,this.showWaterEffect=!0,this.depthTestAgainstTerrain=!1,this.shadows=Vi.RECEIVE_ONLY,this.atmosphereHueShift=0,this.atmosphereSaturationShift=0,this.atmosphereBrightnessShift=0,this.showSkirts=!0,this.backFaceCulling=!0,this._oceanNormalMap=void 0,this._zoomedOutOceanSpecularIntensity=void 0,this.vertexShadowDarkness=.3}Object.defineProperties(Ul.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},imageryLayers:{get:function(){return this._imageryLayerCollection}},imageryLayersUpdatedEvent:{get:function(){return this._surface.tileProvider.imageryLayersUpdatedEvent}},tilesLoaded:{get:function(){return c(this._surface)?this._surface._tileLoadQueueHigh.length===0&&this._surface._tileLoadQueueMedium.length===0&&this._surface._tileLoadQueueLow.length===0:!0}},baseColor:{get:function(){return this._surface.tileProvider.baseColor},set:function(e){this._surface.tileProvider.baseColor=e}},clippingPlanes:{get:function(){return this._surface.tileProvider.clippingPlanes},set:function(e){this._surface.tileProvider.clippingPlanes=e}},clippingPolygons:{get:function(){return this._surface.tileProvider.clippingPolygons},set:function(e){this._surface.tileProvider.clippingPolygons=e}},cartographicLimitRectangle:{get:function(){return this._surface.tileProvider.cartographicLimitRectangle},set:function(e){c(e)||(e=ce.clone(ce.MAX_VALUE)),this._surface.tileProvider.cartographicLimitRectangle=e}},oceanNormalMapUrl:{get:function(){return this._oceanNormalMapResource.url},set:function(e){this._oceanNormalMapResource.url=e,this._oceanNormalMapResourceDirty=!0}},terrainProvider:{get:function(){return this._terrainProvider},set:function(e){e!==this._terrainProvider&&(this._terrainProvider=e,this._terrainProviderChanged.raiseEvent(e),c(this._material)&&zD(this))}},terrainProviderChanged:{get:function(){return this._terrainProviderChanged}},tileLoadProgressEvent:{get:function(){return this._surface.tileLoadProgressEvent}},material:{get:function(){return this._material},set:function(e){this._material!==e&&(this._material=e,zD(this))}},undergroundColor:{get:function(){return this._undergroundColor},set:function(e){this._undergroundColor=z.clone(e,this._undergroundColor)}},undergroundColorAlphaByDistance:{get:function(){return this._undergroundColorAlphaByDistance},set:function(e){if(c(e)&&e.far<e.near)throw new E("far distance must be greater than near distance.");this._undergroundColorAlphaByDistance=vt.clone(e,this._undergroundColorAlphaByDistance)}},translucency:{get:function(){return this._translucency}}});function zD(e){const t=[],n=c(e._material)&&(c(e._material.shaderSource.match(/slope/))||c(e._material.shaderSource.match("normalEC"))),i=[tC,DB];c(e._material)&&(!n||e._terrainProvider.requestVertexNormals)?(i.push(e._material.shaderSource),t.push("APPLY_MATERIAL"),e._surface._tileProvider.materialUniformMap=e._material._uniforms):e._surface._tileProvider.materialUniformMap=void 0,i.push(R1e),e._surfaceShaderSet.baseVertexShaderSource=new Oe({sources:[tC,DB,N1e],defines:t}),e._surfaceShaderSet.baseFragmentShaderSource=new Oe({sources:i,defines:t}),e._surfaceShaderSet.material=e._material}function eMe(e){return function(t,n){const i=se.distanceSquaredTo(t.pickBoundingSphere,e),o=se.distanceSquaredTo(n.pickBoundingSphere,e);return i-o}}const tMe=[],nMe={start:0,stop:0};Ul.prototype.pickWorldCoordinates=function(e,t,n,i){if(!c(e))throw new E("ray is required");if(!c(t))throw new E("scene is required");n=y(n,!0);const o=t.mode,r=t.mapProjection,s=tMe;s.length=0;const a=this._surface._tilesToRender;let l=a.length,u,h;for(h=0;h<l;++h){u=a[h];const _=u.data;if(!c(_))continue;let g=_.pickBoundingSphere;if(o!==oe.SCENE3D)_.pickBoundingSphere=g=se.fromRectangleWithHeights2D(u.rectangle,r,_.tileBoundingRegion.minimumHeight,_.tileBoundingRegion.maximumHeight,g),d.fromElements(g.center.z,g.center.x,g.center.y,g.center);else if(c(_.renderedMesh))se.clone(_.tileBoundingRegion.boundingSphere,g);else continue;const m=Ei.raySphere(e,g,nMe);c(m)&&s.push(_)}s.sort(eMe(e.origin));let f;for(l=s.length,h=0;h<l&&(f=s[h].pick(e,t.mode,t.mapProjection,n,i),!c(f));++h);return f};const iMe=new he;Ul.prototype.pick=function(e,t,n){if(n=this.pickWorldCoordinates(e,t,!0,n),c(n)&&t.mode!==oe.SCENE3D){n=d.fromElements(n.y,n.z,n.x,n);const i=t.mapProjection.unproject(n,iMe);n=t.globe.ellipsoid.cartographicToCartesian(i,n)}return n};const oMe=new d,XB=new d,rMe=new he,sMe=new nn;function yv(e,t){return c(e)&&ce.contains(e.rectangle,t)?e:void 0}Ul.prototype.getHeight=function(e){if(!c(e))throw new E("cartographic is required");const t=this._surface._levelZeroTiles;if(!c(t))return;let n,i;const o=t.length;for(i=0;i<o&&(n=t[i],!ce.contains(n.rectangle,e));++i);if(i>=o)return;let r=n;for(;c(n);)n=yv(n._southwestChild,e)||yv(n._southeastChild,e)||yv(n._northwestChild,e)||n._northeastChild,c(n)&&c(n.data)&&c(n.data.renderedMesh)&&(r=n);if(n=r,!c(n)||!c(n.data)||!c(n.data.renderedMesh))return;const s=this._surface._tileProvider.tilingScheme.projection,a=this._surface._tileProvider.tilingScheme.ellipsoid,l=d.fromRadians(e.longitude,e.latitude,0,a,oMe),u=sMe,h=a.geodeticSurfaceNormal(l,u.direction),f=a.getSurfaceNormalIntersectionWithZAxis(l,11500,u.origin);if(!c(f)){let g;c(n.data.tileBoundingRegion)&&(g=n.data.tileBoundingRegion.minimumHeight);const m=Math.min(y(g,0),-11500),b=d.multiplyByScalar(h,Math.abs(m)+1,XB);d.subtract(l,b,u.origin)}const _=n.data.pick(u,void 0,s,!1,XB);if(!!c(_))return a.cartesianToCartographic(_,rMe).height};Ul.prototype.update=function(e){!this.show||e.passes.render&&this._surface.update(e)};Ul.prototype.beginFrame=function(e){const t=this._surface,n=t.tileProvider,i=this.terrainProvider,o=this.showWaterEffect&&c(i)&&i.hasWaterMask&&i.hasWaterMask;if(o&&this._oceanNormalMapResourceDirty){this._oceanNormalMapResourceDirty=!1;const a=this._oceanNormalMapResource,l=a.url;if(c(l)){const u=this;a.fetchImage().then(function(h){l===u._oceanNormalMapResource.url&&(u._oceanNormalMap=u._oceanNormalMap&&u._oceanNormalMap.destroy(),u._oceanNormalMap=new xt({context:e.context,source:h}))})}else this._oceanNormalMap=this._oceanNormalMap&&this._oceanNormalMap.destroy()}const r=e.passes,s=e.mode;r.render&&(this.showGroundAtmosphere?this._zoomedOutOceanSpecularIntensity=.4:this._zoomedOutOceanSpecularIntensity=.5,t.maximumScreenSpaceError=this.maximumScreenSpaceError,t.tileCacheSize=this.tileCacheSize,t.loadingDescendantLimit=this.loadingDescendantLimit,t.preloadAncestors=this.preloadAncestors,t.preloadSiblings=this.preloadSiblings,n.terrainProvider=this.terrainProvider,n.lightingFadeOutDistance=this.lightingFadeOutDistance,n.lightingFadeInDistance=this.lightingFadeInDistance,n.nightFadeOutDistance=this.nightFadeOutDistance,n.nightFadeInDistance=this.nightFadeInDistance,n.zoomedOutOceanSpecularIntensity=s===oe.SCENE3D?this._zoomedOutOceanSpecularIntensity:0,n.hasWaterMask=o,n.oceanNormalMap=this._oceanNormalMap,n.enableLighting=this.enableLighting,n.dynamicAtmosphereLighting=this.dynamicAtmosphereLighting,n.dynamicAtmosphereLightingFromSun=this.dynamicAtmosphereLightingFromSun,n.showGroundAtmosphere=this.showGroundAtmosphere,n.atmosphereLightIntensity=this.atmosphereLightIntensity,n.atmosphereRayleighCoefficient=this.atmosphereRayleighCoefficient,n.atmosphereMieCoefficient=this.atmosphereMieCoefficient,n.atmosphereRayleighScaleHeight=this.atmosphereRayleighScaleHeight,n.atmosphereMieScaleHeight=this.atmosphereMieScaleHeight,n.atmosphereMieAnisotropy=this.atmosphereMieAnisotropy,n.shadows=this.shadows,n.hueShift=this.atmosphereHueShift,n.saturationShift=this.atmosphereSaturationShift,n.brightnessShift=this.atmosphereBrightnessShift,n.fillHighlightColor=this.fillHighlightColor,n.showSkirts=this.showSkirts,n.backFaceCulling=this.backFaceCulling,n.vertexShadowDarkness=this.vertexShadowDarkness,n.undergroundColor=this._undergroundColor,n.undergroundColorAlphaByDistance=this._undergroundColorAlphaByDistance,n.lambertDiffuseMultiplier=this.lambertDiffuseMultiplier,t.beginFrame(e))};Ul.prototype.render=function(e){!this.show||(c(this._material)&&this._material.update(e.context),this._surface.render(e))};Ul.prototype.endFrame=function(e){!this.show||e.passes.render&&this._surface.endFrame(e)};Ul.prototype.isDestroyed=function(){return!1};Ul.prototype.destroy=function(){return this._surfaceShaderSet=this._surfaceShaderSet&&this._surfaceShaderSet.destroy(),this._surface=this._surface&&this._surface.destroy(),this._oceanNormalMap=this._oceanNormalMap&&this._oceanNormalMap.destroy(),ve(this)};function aMe(e,t,n,i){this.rightAscension=e,this.declination=t,this.rotation=n,this.rotationRate=i}const oW={},cMe=32.184,lMe=2451545,QB=-.0529921,KB=-.1059842,ZB=13.0120009,JB=13.3407154,e3=.9856003,t3=26.4057084,n3=13.064993,i3=.3287146,o3=1.7484877,r3=-.1589763,s3=.0036096,a3=.1643573,c3=12.9590088;let bv=new ie;oW.ComputeMoon=function(e,t){c(e)||(e=ie.now()),bv=ie.addSeconds(e,cMe,bv);const n=ie.totalDays(bv)-lMe,i=n/qn.DAYS_PER_JULIAN_CENTURY,o=(125.045+QB*n)*R.RADIANS_PER_DEGREE,r=(250.089+KB*n)*R.RADIANS_PER_DEGREE,s=(260.008+ZB*n)*R.RADIANS_PER_DEGREE,a=(176.625+JB*n)*R.RADIANS_PER_DEGREE,l=(357.529+e3*n)*R.RADIANS_PER_DEGREE,u=(311.589+t3*n)*R.RADIANS_PER_DEGREE,h=(134.963+n3*n)*R.RADIANS_PER_DEGREE,f=(276.617+i3*n)*R.RADIANS_PER_DEGREE,_=(34.226+o3*n)*R.RADIANS_PER_DEGREE,g=(15.134+r3*n)*R.RADIANS_PER_DEGREE,m=(119.743+s3*n)*R.RADIANS_PER_DEGREE,b=(239.961+a3*n)*R.RADIANS_PER_DEGREE,T=(25.053+c3*n)*R.RADIANS_PER_DEGREE,x=Math.sin(o),C=Math.sin(r),w=Math.sin(s),v=Math.sin(a),P=Math.sin(l),N=Math.sin(u),k=Math.sin(h),M=Math.sin(f),U=Math.sin(_),B=Math.sin(g),S=Math.sin(m),D=Math.sin(b),p=Math.sin(T),I=Math.cos(o),O=Math.cos(r),F=Math.cos(s),V=Math.cos(a),G=Math.cos(l),j=Math.cos(u),W=Math.cos(h),X=Math.cos(f),q=Math.cos(_),ee=Math.cos(g),Y=Math.cos(m),ne=Math.cos(b),Q=Math.cos(T),le=(269.9949+.0031*i-3.8787*x-.1204*C+.07*w-.0172*v+.0072*N-.0052*B+.0043*p)*R.RADIANS_PER_DEGREE,pe=(66.5392+.013*i+1.5419*I+.0239*O-.0278*F+.0068*V-.0029*j+9e-4*W+8e-4*ee-9e-4*Q)*R.RADIANS_PER_DEGREE,re=(38.3213+13.17635815*n-14e-13*n*n+3.561*x+.1208*C-.0642*w+.0158*v+.0252*P-.0066*N-.0047*k-.0046*M+.0028*U+.0052*B+.004*S+.0019*D-.0044*p)*R.RADIANS_PER_DEGREE,de=(13.17635815-14e-13*(2*n)+3.561*I*QB+.1208*O*KB-.0642*F*ZB+.0158*V*JB+.0252*G*e3-.0066*j*t3-.0047*W*n3-.0046*X*i3+.0028*q*o3+.0052*ee*r3+.004*Y*s3+.0019*ne*a3-.0044*Q*c3)/86400*R.RADIANS_PER_DEGREE;return c(t)||(t=new aMe),t.rightAscension=le,t.declination=pe,t.rotation=re,t.rotationRate=de,t};const uMe=oW;function rW(e){(!c(e)||typeof e!="function")&&(e=uMe.ComputeMoon),this._computeFunction=e}const dMe=new d,hMe=new d,fMe=new d;function pMe(e,t,n){const i=dMe;i.x=Math.cos(e+R.PI_OVER_TWO),i.y=Math.sin(e+R.PI_OVER_TWO),i.z=0;const o=Math.cos(t),r=fMe;r.x=o*Math.cos(e),r.y=o*Math.sin(e),r.z=Math.sin(t);const s=d.cross(r,i,hMe);return c(n)||(n=new $),n[0]=i.x,n[1]=s.x,n[2]=r.x,n[3]=i.y,n[4]=s.y,n[5]=r.y,n[6]=i.z,n[7]=s.z,n[8]=r.z,n}const mMe=new $,_Me=new _e;rW.prototype.evaluate=function(e,t){c(e)||(e=ie.now());const n=this._computeFunction(e),i=pMe(n.rightAscension,n.declination,t),o=R.zeroToTwoPi(n.rotation),r=_e.fromAxisAngle(d.UNIT_Z,o,_Me),s=$.fromQuaternion(_e.conjugate(r,r),mMe);return $.multiply(s,i,i)};const UD={position:0};function tE(e){e=y(e,y.EMPTY_OBJECT),this.center=d.clone(y(e.center,d.ZERO)),this._center=new d,this.radii=d.clone(e.radii),this._radii=new d,this._oneOverEllipsoidRadiiSquared=new d,this._boundingSphere=new se,this.modelMatrix=L.clone(y(e.modelMatrix,L.IDENTITY)),this._modelMatrix=new L,this._computedModelMatrix=new L,this.show=y(e.show,!0),this.material=y(e.material,Se.fromType(Se.ColorType)),this._material=void 0,this._translucent=void 0,this.id=e.id,this._id=void 0,this.debugShowBoundingVolume=y(e.debugShowBoundingVolume,!1),this.onlySunLighting=y(e.onlySunLighting,!1),this._onlySunLighting=!1,this._depthTestEnabled=y(e.depthTestEnabled,!0),this._useLogDepth=!1,this._sp=void 0,this._rs=void 0,this._va=void 0,this._pickSP=void 0,this._pickId=void 0,this._colorCommand=new Ze({owner:y(e._owner,this)}),this._pickCommand=new Ze({owner:y(e._owner,this),pickOnly:!0});const t=this;this._uniforms={u_radii:function(){return t.radii},u_oneOverEllipsoidRadiiSquared:function(){return t._oneOverEllipsoidRadiiSquared}},this._pickUniforms={czm_pickColor:function(){return t._pickId.color}}}function gMe(e){let t=e.cache.ellipsoidPrimitive_vertexArray;if(c(t))return t;const n=rr.createGeometry(rr.fromDimensions({dimensions:new d(2,2,2),vertexFormat:Ee.POSITION_ONLY}));return t=Ci.fromGeometry({context:e,geometry:n,attributeLocations:UD,bufferUsage:ke.STATIC_DRAW,interleave:!0}),e.cache.ellipsoidPrimitive_vertexArray=t,t}tE.prototype.update=function(e){if(!this.show||e.mode!==oe.SCENE3D||!c(this.center)||!c(this.radii))return;if(!c(this.material))throw new E("this.material must be defined.");const t=e.context,n=this.material.isTranslucent(),i=this._translucent!==n;(!c(this._rs)||i)&&(this._translucent=n,this._rs=Ue.fromCache({cull:{enabled:!0,face:Qi.FRONT},depthTest:{enabled:this._depthTestEnabled},depthMask:!n&&t.fragmentDepth,blending:n?Zn.ALPHA_BLEND:void 0})),c(this._va)||(this._va=gMe(t));let o=!1;const r=this.radii;if(!d.equals(this._radii,r)){d.clone(r,this._radii);const b=this._oneOverEllipsoidRadiiSquared;b.x=1/(r.x*r.x),b.y=1/(r.y*r.y),b.z=1/(r.z*r.z),o=!0}(!L.equals(this.modelMatrix,this._modelMatrix)||!d.equals(this.center,this._center))&&(L.clone(this.modelMatrix,this._modelMatrix),d.clone(this.center,this._center),L.multiplyByTranslation(this.modelMatrix,this.center,this._computedModelMatrix),o=!0),o&&(d.clone(d.ZERO,this._boundingSphere.center),this._boundingSphere.radius=d.maximumComponent(r),se.transform(this._boundingSphere,this._computedModelMatrix,this._boundingSphere));const s=this._material!==this.material;this._material=this.material,this._material.update(t);const a=this.onlySunLighting!==this._onlySunLighting;this._onlySunLighting=this.onlySunLighting;const l=e.useLogDepth,u=this._useLogDepth!==l;this._useLogDepth=l;const h=this._colorCommand;let f,_;(s||a||i||u)&&(f=new Oe({sources:[IB]}),_=new Oe({sources:[this.material.shaderSource,vB]}),this.onlySunLighting&&_.defines.push("ONLY_SUN_LIGHTING"),!n&&t.fragmentDepth&&_.defines.push("WRITE_DEPTH"),this._useLogDepth&&(f.defines.push("LOG_DEPTH"),_.defines.push("LOG_DEPTH")),this._sp=Jt.replaceCache({context:t,shaderProgram:this._sp,vertexShaderSource:f,fragmentShaderSource:_,attributeLocations:UD}),h.vertexArray=this._va,h.renderState=this._rs,h.shaderProgram=this._sp,h.uniformMap=jt(this._uniforms,this.material._uniforms),h.executeInClosestFrustum=n);const g=e.commandList,m=e.passes;if(m.render&&(h.boundingVolume=this._boundingSphere,h.debugShowBoundingVolume=this.debugShowBoundingVolume,h.modelMatrix=this._computedModelMatrix,h.pass=n?xe.TRANSLUCENT:xe.OPAQUE,g.push(h)),m.pick){const b=this._pickCommand;(!c(this._pickId)||this._id!==this.id)&&(this._id=this.id,this._pickId=this._pickId&&this._pickId.destroy(),this._pickId=t.createPickId({primitive:this,id:this.id})),(s||a||!c(this._pickSP)||u)&&(f=new Oe({sources:[IB]}),_=new Oe({sources:[this.material.shaderSource,vB],pickColorQualifier:"uniform"}),this.onlySunLighting&&_.defines.push("ONLY_SUN_LIGHTING"),!n&&t.fragmentDepth&&_.defines.push("WRITE_DEPTH"),this._useLogDepth&&(f.defines.push("LOG_DEPTH"),_.defines.push("LOG_DEPTH")),this._pickSP=Jt.replaceCache({context:t,shaderProgram:this._pickSP,vertexShaderSource:f,fragmentShaderSource:_,attributeLocations:UD}),b.vertexArray=this._va,b.renderState=this._rs,b.shaderProgram=this._pickSP,b.uniformMap=jt(jt(this._uniforms,this._pickUniforms),this.material._uniforms),b.executeInClosestFrustum=n),b.boundingVolume=this._boundingSphere,b.modelMatrix=this._computedModelMatrix,b.pass=n?xe.TRANSLUCENT:xe.OPAQUE,g.push(b)}};tE.prototype.isDestroyed=function(){return!1};tE.prototype.destroy=function(){return this._sp=this._sp&&this._sp.destroy(),this._pickSP=this._pickSP&&this._pickSP.destroy(),this._pickId=this._pickId&&this._pickId.destroy(),ve(this)};function sb(e){e=y(e,y.EMPTY_OBJECT);let t=e.textureUrl;c(t)||(t=Zt("Assets/Textures/moonSmall.jpg")),this.show=y(e.show,!0),this.textureUrl=t,this._ellipsoid=y(e.ellipsoid,ae.MOON),this.onlySunLighting=y(e.onlySunLighting,!0),this._ellipsoidPrimitive=new tE({radii:this.ellipsoid.radii,material:Se.fromType(Se.ImageType),depthTestEnabled:!1,_owner:this}),this._ellipsoidPrimitive.material.translucent=!1,this._axes=new rW}Object.defineProperties(sb.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}});const rA=new $,yMe=new $,bMe=new d,sA=[];sb.prototype.update=function(e){if(!this.show)return;const t=this._ellipsoidPrimitive;t.material.uniforms.image=this.textureUrl,t.onlySunLighting=this.onlySunLighting;const n=e.time;c(zt.computeIcrfToFixedMatrix(n,rA))||zt.computeTemeToPseudoFixedMatrix(n,rA);const i=this._axes.evaluate(n,yMe);$.transpose(i,i),$.multiply(rA,i,i);const o=CI.computeMoonPositionInEarthInertialFrame(n,bMe);$.multiplyByVector(rA,o,o),L.fromRotationTranslation(i,o,t.modelMatrix);const r=e.commandList;return e.commandList=sA,sA.length=0,t.update(e),e.commandList=r,sA.length===1?sA[0]:void 0};sb.prototype.isDestroyed=function(){return!1};sb.prototype.destroy=function(){return this._ellipsoidPrimitive=this._ellipsoidPrimitive&&this._ellipsoidPrimitive.destroy(),ve(this)};const kD=[],VD=[];function TMe(e,t,n,i,o,r){const s=o-i+1,a=r-o,l=kD,u=VD;let h,f;for(h=0;h<s;++h)l[h]=e[i+h];for(f=0;f<a;++f)u[f]=e[o+f+1];h=0,f=0;for(let _=i;_<=r;++_){const g=l[h],m=u[f];h<s&&(f>=a||t(g,m,n)<=0)?(e[_]=g,++h):f<a&&(e[_]=m,++f)}}function HD(e,t,n,i,o){if(i>=o)return;const r=Math.floor((i+o)*.5);HD(e,t,n,i,r),HD(e,t,n,r+1,o),TMe(e,t,n,i,r,o)}function x1(e,t,n){if(!c(e))throw new E("array is required.");if(!c(t))throw new E("comparator is required.");const i=e.length,o=Math.ceil(i*.5);kD.length=o,VD.length=o,HD(e,t,n,0,i-1),kD.length=0,VD.length=0}function ms(e,t){if(!c(e))throw new E("occluderBoundingSphere is required.");if(!c(t))throw new E("camera position is required.");this._occluderPosition=d.clone(e.center),this._occluderRadius=e.radius,this._horizonDistance=0,this._horizonPlaneNormal=void 0,this._horizonPlanePosition=void 0,this._cameraPosition=void 0,this.cameraPosition=t}const aA=new d;Object.defineProperties(ms.prototype,{position:{get:function(){return this._occluderPosition}},radius:{get:function(){return this._occluderRadius}},cameraPosition:{set:function(e){if(!c(e))throw new E("cameraPosition is required.");e=d.clone(e,this._cameraPosition);const t=d.subtract(this._occluderPosition,e,aA);let n=d.magnitudeSquared(t);const i=this._occluderRadius*this._occluderRadius;let o,r,s;if(n>i){o=Math.sqrt(n-i),n=1/Math.sqrt(n),r=d.multiplyByScalar(t,n,aA);const a=o*o*n;s=d.add(e,d.multiplyByScalar(r,a,aA),aA)}else o=Number.MAX_VALUE;this._horizonDistance=o,this._horizonPlaneNormal=r,this._horizonPlanePosition=s,this._cameraPosition=e}}});ms.fromBoundingSphere=function(e,t,n){if(!c(e))throw new E("occluderBoundingSphere is required.");if(!c(t))throw new E("camera position is required.");return c(n)?(d.clone(e.center,n._occluderPosition),n._occluderRadius=e.radius,n.cameraPosition=t,n):new ms(e,t)};const sW=new d;ms.prototype.isPointVisible=function(e){if(this._horizonDistance!==Number.MAX_VALUE){let t=d.subtract(e,this._occluderPosition,sW),n=this._occluderRadius;if(n=d.magnitudeSquared(t)-n*n,n>0)return n=Math.sqrt(n)+this._horizonDistance,t=d.subtract(e,this._cameraPosition,t),n*n>d.magnitudeSquared(t)}return!1};const AMe=new d;ms.prototype.isBoundingSphereVisible=function(e){const t=d.clone(e.center,AMe),n=e.radius;if(this._horizonDistance!==Number.MAX_VALUE){let i=d.subtract(t,this._occluderPosition,sW),o=this._occluderRadius-n;if(o=d.magnitudeSquared(i)-o*o,n<this._occluderRadius)return o>0?(o=Math.sqrt(o)+this._horizonDistance,i=d.subtract(t,this._cameraPosition,i),o*o+n*n>d.magnitudeSquared(i)):!1;if(o>0){i=d.subtract(t,this._cameraPosition,i);const r=d.magnitudeSquared(i),s=this._occluderRadius*this._occluderRadius,a=n*n;return(this._horizonDistance*this._horizonDistance+s)*a>r*s?!0:(o=Math.sqrt(o)+this._horizonDistance,o*o+a>r)}return!0}return!1};const xMe=new d;ms.prototype.computeVisibility=function(e){if(!c(e))throw new E("occludeeBS is required.");const t=d.clone(e.center),n=e.radius;if(n>this._occluderRadius)return ir.FULL;if(this._horizonDistance!==Number.MAX_VALUE){let i=d.subtract(t,this._occluderPosition,xMe),o=this._occluderRadius-n;const r=d.magnitudeSquared(i);if(o=r-o*o,o>0){o=Math.sqrt(o)+this._horizonDistance,i=d.subtract(t,this._cameraPosition,i);const s=d.magnitudeSquared(i);return o*o+n*n<s?ir.NONE:(o=this._occluderRadius+n,o=r-o*o,o>0?(o=Math.sqrt(o)+this._horizonDistance,s<o*o+n*n?ir.FULL:ir.PARTIAL):(i=d.subtract(t,this._horizonPlanePosition,i),d.dot(i,this._horizonPlaneNormal)>-n?ir.PARTIAL:ir.FULL))}}return ir.NONE};const cA=new d;ms.computeOccludeePoint=function(e,t,n){if(!c(e))throw new E("occluderBoundingSphere is required.");if(!c(n))throw new E("positions is required.");if(n.length===0)throw new E("positions must contain at least one element");const i=d.clone(t),o=d.clone(e.center),r=e.radius,s=n.length;if(d.equals(o,t))throw new E("occludeePosition must be different than occluderBoundingSphere.center");const a=d.normalize(d.subtract(i,o,cA),cA),l=-d.dot(a,o),u=ms._anyRotationVector(o,a,l);let h=ms._horizonToPlaneNormalDotProduct(e,a,l,u,n[0]);if(!h)return;let f;for(let g=1;g<s;++g){if(f=ms._horizonToPlaneNormalDotProduct(e,a,l,u,n[g]),!f)return;f<h&&(h=f)}if(h<.0017453283658983088)return;const _=r/h;return d.add(o,d.multiplyByScalar(a,_,cA),cA)};const CMe=[];ms.computeOccludeePointFromRectangle=function(e,t){if(!c(e))throw new E("rectangle is required.");t=y(t,ae.WGS84);const n=ce.subsample(e,t,0,CMe),i=se.fromPoints(n),o=d.ZERO;if(!d.equals(o,i.center))return ms.computeOccludeePoint(new se(o,t.minimumRadius),i.center,n)};const EMe=new d;ms._anyRotationVector=function(e,t,n){const i=d.abs(t,EMe);let o=i.x>i.y?0:1;(o===0&&i.z>i.x||o===1&&i.z>i.y)&&(o=2);const r=new d;let s;o===0?(i.x=e.x,i.y=e.y+1,i.z=e.z+1,s=d.UNIT_X):o===1?(i.x=e.x+1,i.y=e.y,i.z=e.z+1,s=d.UNIT_Y):(i.x=e.x+1,i.y=e.y+1,i.z=e.z,s=d.UNIT_Z);const a=(d.dot(t,i)+n)/-d.dot(t,s);return d.normalize(d.subtract(d.add(i,d.multiplyByScalar(s,a,r),i),e,i),i)};const wMe=new d;ms._rotationVector=function(e,t,n,i,o){let r=d.subtract(i,e,wMe);if(r=d.normalize(r,r),d.dot(t,r)<.9999999847691291){const s=d.cross(t,r,r);if(d.magnitude(s)>R.EPSILON13)return d.normalize(s,new d)}return o};const Tv=new d,SMe=new d,lA=new d,l3=new d;ms._horizonToPlaneNormalDotProduct=function(e,t,n,i,o){const r=d.clone(o,Tv),s=d.clone(e.center,SMe),a=e.radius;let l=d.subtract(s,r,lA);const u=d.magnitudeSquared(l),h=a*a;if(u<h)return!1;const f=u-h,_=Math.sqrt(f),m=1/Math.sqrt(u),T=_*m*_;l=d.normalize(l,l);const x=d.add(r,d.multiplyByScalar(l,T,l3),l3),C=Math.sqrt(f-T*T);let w=this._rotationVector(s,t,n,r,i),v=d.fromElements(w.x*w.x*l.x+(w.x*w.y-w.z)*l.y+(w.x*w.z+w.y)*l.z,(w.x*w.y+w.z)*l.x+w.y*w.y*l.y+(w.y*w.z-w.x)*l.z,(w.x*w.z-w.y)*l.x+(w.y*w.z+w.x)*l.y+w.z*w.z*l.z,Tv);v=d.normalize(v,v);const P=d.multiplyByScalar(v,C,Tv);w=d.normalize(d.subtract(d.add(x,P,lA),s,lA),lA);const N=d.dot(t,w);w=d.normalize(d.subtract(d.subtract(x,P,w),s,w),w);const k=d.dot(t,w);return N<k?N:k};function xs(e){e=y(e,y.EMPTY_OBJECT),this.left=e.left,this._left=void 0,this.right=e.right,this._right=void 0,this.top=e.top,this._top=void 0,this.bottom=e.bottom,this._bottom=void 0,this.near=y(e.near,1),this._near=this.near,this.far=y(e.far,5e8),this._far=this.far,this._cullingVolume=new _o,this._perspectiveMatrix=new L,this._infinitePerspective=new L}function GD(e){if(!c(e.right)||!c(e.left)||!c(e.top)||!c(e.bottom)||!c(e.near)||!c(e.far))throw new E("right, left, top, bottom, near, or far parameters are not set.");const t=e.top,n=e.bottom,i=e.right,o=e.left,r=e.near,s=e.far;if(t!==e._top||n!==e._bottom||o!==e._left||i!==e._right||r!==e._near||s!==e._far){if(e.near<=0||e.near>e.far)throw new E("near must be greater than zero and less than far.");e._left=o,e._right=i,e._top=t,e._bottom=n,e._near=r,e._far=s,e._perspectiveMatrix=L.computePerspectiveOffCenter(o,i,n,t,r,s,e._perspectiveMatrix),e._infinitePerspective=L.computeInfinitePerspectiveOffCenter(o,i,n,t,r,e._infinitePerspective)}}Object.defineProperties(xs.prototype,{projectionMatrix:{get:function(){return GD(this),this._perspectiveMatrix}},infiniteProjectionMatrix:{get:function(){return GD(this),this._infinitePerspective}}});const vMe=new d,IMe=new d,DMe=new d,PMe=new d;xs.prototype.computeCullingVolume=function(e,t,n){if(!c(e))throw new E("position is required.");if(!c(t))throw new E("direction is required.");if(!c(n))throw new E("up is required.");const i=this._cullingVolume.planes,o=this.top,r=this.bottom,s=this.right,a=this.left,l=this.near,u=this.far,h=d.cross(t,n,vMe),f=IMe;d.multiplyByScalar(t,l,f),d.add(e,f,f);const _=DMe;d.multiplyByScalar(t,u,_),d.add(e,_,_);const g=PMe;d.multiplyByScalar(h,a,g),d.add(f,g,g),d.subtract(g,e,g),d.normalize(g,g),d.cross(g,n,g),d.normalize(g,g);let m=i[0];return c(m)||(m=i[0]=new te),m.x=g.x,m.y=g.y,m.z=g.z,m.w=-d.dot(g,e),d.multiplyByScalar(h,s,g),d.add(f,g,g),d.subtract(g,e,g),d.cross(n,g,g),d.normalize(g,g),m=i[1],c(m)||(m=i[1]=new te),m.x=g.x,m.y=g.y,m.z=g.z,m.w=-d.dot(g,e),d.multiplyByScalar(n,r,g),d.add(f,g,g),d.subtract(g,e,g),d.cross(h,g,g),d.normalize(g,g),m=i[2],c(m)||(m=i[2]=new te),m.x=g.x,m.y=g.y,m.z=g.z,m.w=-d.dot(g,e),d.multiplyByScalar(n,o,g),d.add(f,g,g),d.subtract(g,e,g),d.cross(g,h,g),d.normalize(g,g),m=i[3],c(m)||(m=i[3]=new te),m.x=g.x,m.y=g.y,m.z=g.z,m.w=-d.dot(g,e),m=i[4],c(m)||(m=i[4]=new te),m.x=t.x,m.y=t.y,m.z=t.z,m.w=-d.dot(t,f),d.negate(t,g),m=i[5],c(m)||(m=i[5]=new te),m.x=g.x,m.y=g.y,m.z=g.z,m.w=-d.dot(g,_),this._cullingVolume};xs.prototype.getPixelDimensions=function(e,t,n,i,o){if(GD(this),!c(e)||!c(t))throw new E("Both drawingBufferWidth and drawingBufferHeight are required.");if(e<=0)throw new E("drawingBufferWidth must be greater than zero.");if(t<=0)throw new E("drawingBufferHeight must be greater than zero.");if(!c(n))throw new E("distance is required.");if(!c(i))throw new E("pixelRatio is required");if(i<=0)throw new E("pixelRatio must be greater than zero.");if(!c(o))throw new E("A result object is required.");const r=1/this.near;let s=this.top*r;const a=2*i*n*s/t;s=this.right*r;const l=2*i*n*s/e;return o.x=l,o.y=a,o};xs.prototype.clone=function(e){return c(e)||(e=new xs),e.right=this.right,e.left=this.left,e.top=this.top,e.bottom=this.bottom,e.near=this.near,e.far=this.far,e._left=void 0,e._right=void 0,e._top=void 0,e._bottom=void 0,e._near=void 0,e._far=void 0,e};xs.prototype.equals=function(e){return c(e)&&e instanceof xs&&this.right===e.right&&this.left===e.left&&this.top===e.top&&this.bottom===e.bottom&&this.near===e.near&&this.far===e.far};xs.prototype.equalsEpsilon=function(e,t,n){return e===this||c(e)&&e instanceof xs&&R.equalsEpsilon(this.right,e.right,t,n)&&R.equalsEpsilon(this.left,e.left,t,n)&&R.equalsEpsilon(this.top,e.top,t,n)&&R.equalsEpsilon(this.bottom,e.bottom,t,n)&&R.equalsEpsilon(this.near,e.near,t,n)&&R.equalsEpsilon(this.far,e.far,t,n)};function _n(e){e=y(e,y.EMPTY_OBJECT),this._offCenterFrustum=new xs,this.fov=e.fov,this._fov=void 0,this._fovy=void 0,this._sseDenominator=void 0,this.aspectRatio=e.aspectRatio,this._aspectRatio=void 0,this.near=y(e.near,1),this._near=this.near,this.far=y(e.far,5e8),this._far=this.far,this.xOffset=y(e.xOffset,0),this._xOffset=this.xOffset,this.yOffset=y(e.yOffset,0),this._yOffset=this.yOffset}_n.packedLength=6;_n.pack=function(e,t,n){return A.typeOf.object("value",e),A.defined("array",t),n=y(n,0),t[n++]=e.fov,t[n++]=e.aspectRatio,t[n++]=e.near,t[n++]=e.far,t[n++]=e.xOffset,t[n]=e.yOffset,t};_n.unpack=function(e,t,n){return A.defined("array",e),t=y(t,0),c(n)||(n=new _n),n.fov=e[t++],n.aspectRatio=e[t++],n.near=e[t++],n.far=e[t++],n.xOffset=e[t++],n.yOffset=e[t],n};function sl(e){if(!c(e.fov)||!c(e.aspectRatio)||!c(e.near)||!c(e.far))throw new E("fov, aspectRatio, near, or far parameters are not set.");const t=e._offCenterFrustum;if(e.fov!==e._fov||e.aspectRatio!==e._aspectRatio||e.near!==e._near||e.far!==e._far||e.xOffset!==e._xOffset||e.yOffset!==e._yOffset){if(e.fov<0||e.fov>=Math.PI)throw new E("fov must be in the range [0, PI).");if(e.aspectRatio<0)throw new E("aspectRatio must be positive.");if(e.near<0||e.near>e.far)throw new E("near must be greater than zero and less than far.");e._aspectRatio=e.aspectRatio,e._fov=e.fov,e._fovy=e.aspectRatio<=1?e.fov:Math.atan(Math.tan(e.fov*.5)/e.aspectRatio)*2,e._near=e.near,e._far=e.far,e._sseDenominator=2*Math.tan(.5*e._fovy),e._xOffset=e.xOffset,e._yOffset=e.yOffset,t.top=e.near*Math.tan(.5*e._fovy),t.bottom=-t.top,t.right=e.aspectRatio*t.top,t.left=-t.right,t.near=e.near,t.far=e.far,t.right+=e.xOffset,t.left+=e.xOffset,t.top+=e.yOffset,t.bottom+=e.yOffset}}Object.defineProperties(_n.prototype,{projectionMatrix:{get:function(){return sl(this),this._offCenterFrustum.projectionMatrix}},infiniteProjectionMatrix:{get:function(){return sl(this),this._offCenterFrustum.infiniteProjectionMatrix}},fovy:{get:function(){return sl(this),this._fovy}},sseDenominator:{get:function(){return sl(this),this._sseDenominator}},offCenterFrustum:{get:function(){return sl(this),this._offCenterFrustum}}});_n.prototype.computeCullingVolume=function(e,t,n){return sl(this),this._offCenterFrustum.computeCullingVolume(e,t,n)};_n.prototype.getPixelDimensions=function(e,t,n,i,o){return sl(this),this._offCenterFrustum.getPixelDimensions(e,t,n,i,o)};_n.prototype.clone=function(e){return c(e)||(e=new _n),e.aspectRatio=this.aspectRatio,e.fov=this.fov,e.near=this.near,e.far=this.far,e._aspectRatio=void 0,e._fov=void 0,e._near=void 0,e._far=void 0,this._offCenterFrustum.clone(e._offCenterFrustum),e};_n.prototype.equals=function(e){return!c(e)||!(e instanceof _n)?!1:(sl(this),sl(e),this.fov===e.fov&&this.aspectRatio===e.aspectRatio&&this._offCenterFrustum.equals(e._offCenterFrustum))};_n.prototype.equalsEpsilon=function(e,t,n){return!c(e)||!(e instanceof _n)?!1:(sl(this),sl(e),R.equalsEpsilon(this.fov,e.fov,t,n)&&R.equalsEpsilon(this.aspectRatio,e.aspectRatio,t,n)&&this._offCenterFrustum.equalsEpsilon(e._offCenterFrustum,t,n))};const by={NONE:0,SCENE_LIGHT:1,SUNLIGHT:2};by.fromGlobeFlags=function(e){return e.enableLighting&&e.dynamicAtmosphereLighting?e.dynamicAtmosphereLightingFromSun?by.SUNLIGHT:by.SCENE_LIGHT:by.NONE};const aW=Object.freeze(by);function OMe(){this.lightIntensity=10,this.rayleighCoefficient=new d(55e-7,13e-6,284e-7),this.mieCoefficient=new d(21e-6,21e-6,21e-6),this.rayleighScaleHeight=1e4,this.mieScaleHeight=3200,this.mieAnisotropy=.9,this.hueShift=0,this.saturationShift=0,this.brightnessShift=0,this.dynamicLighting=aW.NONE}function ab(){this._colorTexture=void 0,this._drawCommand=void 0}Object.defineProperties(ab.prototype,{colorTexture:{get:function(){return this._colorTexture}}});function LMe(e,t,n){const i=t.createViewportQuadCommand(v1e,{framebuffer:n,renderState:Ue.fromCache({viewport:new Re(0,0,256,256)})});e._drawCommand=i}ab.prototype.update=function(e){if(!c(this._colorTexture)){const t=e.context,n=new xt({context:t,width:256,height:256,pixelFormat:Ve.RGBA,pixelDatatype:Me.UNSIGNED_BYTE,sampler:un.NEAREST});this._colorTexture=n;const i=new ur({context:t,colorTextures:[n],destroyAttachments:!1});LMe(this,t,i),this._drawCommand.execute(t),i.destroy(),this._drawCommand.shaderProgram=this._drawCommand.shaderProgram&&this._drawCommand.shaderProgram.destroy()}};ab.prototype.isDestroyed=function(){return!1};ab.prototype.destroy=function(){return this._colorTexture=this._colorTexture&&this._colorTexture.destroy(),ve(this)};const cW={};function RMe(e,t,n){let i,o,r;if(e instanceof _n){const s=Math.tan(.5*e.fovy);return i=e.near,o=e.near*s,r=e.aspectRatio*o,Math.max(t*i/r,n*i/o)}else if(e instanceof xs)return i=e.near,o=e.top,r=e.right,Math.max(t*i/r,n*i/o);return Math.max(t,n)}const NMe=new d,u3=new d;function lW(e,t,n,i){if(c(i)&&n(.5)>i){const o=n(0),r=n(1),s=n(.5),a=s-o,l=s-r;return function(u){const h=n(u);if(u<=.5){const _=(h-o)/a;return R.lerp(e,-R.PI_OVER_TWO,_)}const f=(h-r)/l;return R.lerp(-R.PI_OVER_TWO,t,1-f)}}return function(o){return R.lerp(e,t,o)}}function C1(e,t,n,i,o){let r=o;const s=Math.max(n,i);if(!c(r)){const a=e.position,l=t,u=e.up,h=e.right,f=e.frustum,_=d.subtract(a,l,NMe),g=d.magnitude(d.multiplyByScalar(u,d.dot(_,u),u3)),m=d.magnitude(d.multiplyByScalar(h,d.dot(_,h),u3));r=Math.min(RMe(f,g,m)*.2,1e9)}if(s<r){const u=-Math.pow((r-n)*1e6,.125),h=Math.pow((r-i)*1e6,1/8);return function(f){const _=f*(h-u)+u;return-Math.pow(_,8)/1e6+r}}return function(a){return R.lerp(n,i,a)}}function I0(e,t){return R.equalsEpsilon(e,R.TWO_PI,R.EPSILON11)&&(e=0),t>e+Math.PI?e+=R.TWO_PI:t<e-Math.PI&&(e-=R.TWO_PI),e}const uW=new d;function MMe(e,t,n,i,o,r,s,a){const l=e.camera,u=d.clone(l.position,uW),h=l.pitch,f=I0(l.heading,i),_=I0(l.roll,r),g=C1(l,n,u.z,n.z,s),m=lW(h,o,g,a);function b(T){const x=T.time/t;l.setView({orientation:{heading:R.lerp(f,i,x),pitch:m(x),roll:R.lerp(_,r,x)}}),H.lerp(u,n,x,l.position),l.position.z=g(x)}return b}function FMe(e,t){e.longitude<t.longitude?e.longitude+=R.TWO_PI:t.longitude+=R.TWO_PI}function BMe(e,t){const n=e.longitude-t.longitude;n<-R.PI?e.longitude+=R.TWO_PI:n>R.PI&&(t.longitude+=R.TWO_PI)}const zMe=new he,UMe=new he;function kMe(e,t,n,i,o,r,s,a,l,u){const h=e.camera,_=e.mapProjection.ellipsoid,g=he.clone(h.positionCartographic,zMe),m=h.pitch,b=I0(h.heading,i),T=I0(h.roll,r),x=_.cartesianToCartographic(n,UMe);g.longitude=R.zeroToTwoPi(g.longitude),x.longitude=R.zeroToTwoPi(x.longitude);let C=!1;if(c(a)){const N=R.zeroToTwoPi(a),k=Math.min(g.longitude,x.longitude),M=Math.max(g.longitude,x.longitude),U=N>=k&&N<=M;if(c(l)){const B=Math.abs(g.longitude-x.longitude),S=R.TWO_PI-B;(U?B:S)<(U?S:B)*l&&!U&&(C=!0)}else U||(C=!0)}C?FMe(g,x):BMe(g,x);const w=C1(h,n,g.height,x.height,s),v=lW(m,o,w,u);function P(){const N=g.longitude,k=x.longitude,M=g.latitude,U=x.latitude;return function(S){const D=S.time/t,p=d.fromRadians(R.lerp(N,k,D),R.lerp(M,U,D),w(D),_);h.setView({destination:p,orientation:{heading:R.lerp(b,i,D),pitch:v(D),roll:R.lerp(T,r,D)}})}}return P()}function VMe(e,t,n,i,o,r,s){const a=e.camera,l=d.clone(a.position,uW),u=I0(a.heading,i),h=a.frustum.right-a.frustum.left,f=C1(a,n,h,n.z,s);function _(g){const m=g.time/t;a.setView({orientation:{heading:R.lerp(u,i,m)}}),H.lerp(l,n,m,a.position);const b=f(m),T=a.frustum,x=T.top/T.right,C=(b-(T.right-T.left))*.5;T.right+=C,T.left-=C,T.top=x*T.right,T.bottom=-T.top}return _}const d3=new he,HMe=new d;function Av(e,t){return{startObject:{},stopObject:{},duration:0,complete:e,cancel:t}}function h3(e,t){function n(){typeof t=="function"&&t(),e.enableInputs=!0}return n}cW.createTween=function(e,t){t=y(t,y.EMPTY_OBJECT);let n=t.destination;if(!c(e))throw new E("scene is required.");if(!c(n))throw new E("destination is required.");const i=e.mode;if(i===oe.MORPHING)return Av();const o=y(t.convert,!0),r=e.mapProjection,s=r.ellipsoid,a=t.maximumHeight,l=t.flyOverLongitude,u=t.flyOverLongitudeWeight,h=t.pitchAdjustHeight;let f=t.easingFunction;o&&i!==oe.SCENE3D&&(s.cartesianToCartographic(n,d3),n=r.project(d3,HMe));const _=e.camera,g=t.endTransform;c(g)&&_._setTransform(g);let m=t.duration;c(m)||(m=Math.ceil(d.distance(_.position,n)/1e6)+2,m=Math.min(m,3));const b=y(t.heading,0),T=y(t.pitch,-R.PI_OVER_TWO),x=y(t.roll,0),C=e.screenSpaceCameraController;C.enableInputs=!1;const w=h3(C,t.complete),v=h3(C,t.cancel),P=_.frustum;let N=e.mode===oe.SCENE2D;if(N=N&&H.equalsEpsilon(_.position,n,R.EPSILON6),N=N&&R.equalsEpsilon(Math.max(P.right-P.left,P.top-P.bottom),n.z,R.EPSILON6),N=N||e.mode!==oe.SCENE2D&&d.equalsEpsilon(n,_.position,R.EPSILON10),N=N&&R.equalsEpsilon(R.negativePiToPi(b),R.negativePiToPi(_.heading),R.EPSILON10)&&R.equalsEpsilon(R.negativePiToPi(T),R.negativePiToPi(_.pitch),R.EPSILON10)&&R.equalsEpsilon(R.negativePiToPi(x),R.negativePiToPi(_.roll),R.EPSILON10),N)return Av(w,v);const k=new Array(4);if(k[oe.SCENE2D]=VMe,k[oe.SCENE3D]=kMe,k[oe.COLUMBUS_VIEW]=MMe,m<=0)return Av(function(){k[i](e,1,n,b,T,x,a,l,u,h)({time:1}),typeof w=="function"&&w()},v);const M=k[i](e,m,n,b,T,x,a,l,u,h);if(!c(f)){const U=_.positionCartographic.height,B=i===oe.SCENE3D?s.cartesianToCartographic(n).height:n.z;U>B&&U>11500?f=ka.CUBIC_OUT:f=ka.QUINTIC_IN_OUT}return{duration:m,easingFunction:f,startObject:{time:0},stopObject:{time:m},update:M,complete:w,cancel:v}};const GMe=cW,jMe={ROTATE:0,INFINITE_SCROLL:1},Wh=Object.freeze(jMe);function Ye(e){if(!c(e))throw new E("scene is required.");this._scene=e,this._transform=L.clone(L.IDENTITY),this._invTransform=L.clone(L.IDENTITY),this._actualTransform=L.clone(L.IDENTITY),this._actualInvTransform=L.clone(L.IDENTITY),this._transformChanged=!1,this.position=new d,this._position=new d,this._positionWC=new d,this._positionCartographic=new he,this._oldPositionWC=void 0,this.positionWCDeltaMagnitude=0,this.positionWCDeltaMagnitudeLastFrame=0,this.timeSinceMoved=0,this._lastMovedTimestamp=0,this.direction=new d,this._direction=new d,this._directionWC=new d,this.up=new d,this._up=new d,this._upWC=new d,this.right=new d,this._right=new d,this._rightWC=new d,this.frustum=new _n,this.frustum.aspectRatio=e.drawingBufferWidth/e.drawingBufferHeight,this.frustum.fov=R.toRadians(60),this.defaultMoveAmount=1e5,this.defaultLookAmount=Math.PI/60,this.defaultRotateAmount=Math.PI/3600,this.defaultZoomAmount=1e5,this.constrainedAxis=void 0,this.maximumZoomFactor=1.5,this._moveStart=new Le,this._moveEnd=new Le,this._changed=new Le,this._changedPosition=void 0,this._changedDirection=void 0,this._changedFrustum=void 0,this._changedHeading=void 0,this._changedRoll=void 0,this.percentageChanged=.5,this._viewMatrix=new L,this._invViewMatrix=new L,dW(this),this._mode=oe.SCENE3D,this._modeChanged=!0;const t=e.mapProjection;this._projection=t,this._maxCoord=t.project(new he(Math.PI,R.PI_OVER_TWO)),this._max2Dfrustum=void 0,CW(this,Ye.DEFAULT_VIEW_RECTANGLE,this.position,!0);let n=d.magnitude(this.position);n+=n*Ye.DEFAULT_VIEW_FACTOR,d.normalize(this.position,this.position),d.multiplyByScalar(this.position,n,this.position)}Ye.TRANSFORM_2D=new L(0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,1);Ye.TRANSFORM_2D_INVERSE=L.inverseTransformation(Ye.TRANSFORM_2D,new L);Ye.DEFAULT_VIEW_RECTANGLE=ce.fromDegrees(-95,-20,-70,90);Ye.DEFAULT_VIEW_FACTOR=.5;Ye.DEFAULT_OFFSET=new F_(0,-R.PI_OVER_FOUR,0);function dW(e){L.computeView(e._position,e._direction,e._up,e._right,e._viewMatrix),L.multiply(e._viewMatrix,e._actualInvTransform,e._viewMatrix),L.inverseTransformation(e._viewMatrix,e._invViewMatrix)}function WMe(e){if(!c(e._oldPositionWC))e._oldPositionWC=d.clone(e.positionWC,e._oldPositionWC);else{e.positionWCDeltaMagnitudeLastFrame=e.positionWCDeltaMagnitude;const t=d.subtract(e.positionWC,e._oldPositionWC,e._oldPositionWC);e.positionWCDeltaMagnitude=d.magnitude(t),e._oldPositionWC=d.clone(e.positionWC,e._oldPositionWC),e.positionWCDeltaMagnitude>0?(e.timeSinceMoved=0,e._lastMovedTimestamp=xo()):e.timeSinceMoved=Math.max(xo()-e._lastMovedTimestamp,0)/1e3}}Ye.prototype.canPreloadFlight=function(){return c(this._currentFlight)&&this._mode!==oe.SCENE2D};Ye.prototype._updateCameraChanged=function(){const e=this;if(WMe(e),e._changed.numberOfListeners===0)return;const t=e.percentageChanged,n=e.heading;c(e._changedHeading)||(e._changedHeading=n);let i=Math.abs(e._changedHeading-n)%R.TWO_PI;i=i>R.PI?R.TWO_PI-i:i;const o=i/Math.PI;o>t&&(e._changedHeading=n);const r=e.roll;c(e._changedRoll)||(e._changedRoll=r);let s=Math.abs(e._changedRoll-r)%R.TWO_PI;s=s>R.PI?R.TWO_PI-s:s;const a=s/Math.PI;if(a>t&&(e._changedRoll=r),(a>t||o>t)&&e._changed.raiseEvent(Math.max(a,o)),e._mode===oe.SCENE2D){if(!c(e._changedFrustum)){e._changedPosition=d.clone(e.position,e._changedPosition),e._changedFrustum=e.frustum.clone();return}const _=e.position,g=e._changedPosition,m=e.frustum,b=e._changedFrustum,T=_.x+m.left,x=_.x+m.right,C=g.x+b.left,w=g.x+b.right,v=_.y+m.bottom,P=_.y+m.top,N=g.y+b.bottom,k=g.y+b.top,M=Math.max(T,C),U=Math.min(x,w),B=Math.max(v,N),S=Math.min(P,k);let D;if(M>=U||B>=P)D=1;else{let p=b;T<C&&x>w&&v<N&&P>k&&(p=m),D=1-(U-M)*(S-B)/((p.right-p.left)*(p.top-p.bottom))}D>t&&(e._changed.raiseEvent(D),e._changedPosition=d.clone(e.position,e._changedPosition),e._changedFrustum=e.frustum.clone(e._changedFrustum));return}if(!c(e._changedDirection)){e._changedPosition=d.clone(e.positionWC,e._changedPosition),e._changedDirection=d.clone(e.directionWC,e._changedDirection);return}const l=R.acosClamped(d.dot(e.directionWC,e._changedDirection));let u;c(e.frustum.fovy)?u=l/(e.frustum.fovy*.5):u=l;const f=d.distance(e.positionWC,e._changedPosition)/e.positionCartographic.height;(u>t||f>t)&&(e._changed.raiseEvent(Math.max(u,f)),e._changedPosition=d.clone(e.positionWC,e._changedPosition),e._changedDirection=d.clone(e.directionWC,e._changedDirection))};function qMe(e){zt.basisTo2D(e._projection,e._transform,e._actualTransform)}const YMe=new he,$Me=new d,uA=new d,XMe=new te,QMe=new te,KMe=new te,ZMe=new te,JMe=new te;function eFe(e){const t=e._projection,n=t.ellipsoid,i=L.getColumn(e._transform,3,XMe),o=n.cartesianToCartographic(i,YMe),r=t.project(o,$Me),s=QMe;s.x=r.z,s.y=r.x,s.z=r.y,s.w=1;const a=te.clone(te.UNIT_X,JMe),l=te.add(L.getColumn(e._transform,0,uA),i,uA);n.cartesianToCartographic(l,o),t.project(o,r);const u=KMe;u.x=r.z,u.y=r.x,u.z=r.y,u.w=0,d.subtract(u,s,u),u.x=0;const h=ZMe;if(d.magnitudeSquared(u)>R.EPSILON10)d.cross(a,u,h);else{const f=te.add(L.getColumn(e._transform,1,uA),i,uA);n.cartesianToCartographic(f,o),t.project(o,r),h.x=r.z,h.y=r.x,h.z=r.y,h.w=0,d.subtract(h,s,h),h.x=0,d.magnitudeSquared(h)<R.EPSILON10&&(te.clone(te.UNIT_Y,u),te.clone(te.UNIT_Z,h))}d.cross(h,a,u),d.normalize(u,u),d.cross(a,u,h),d.normalize(h,h),L.setColumn(e._actualTransform,0,u,e._actualTransform),L.setColumn(e._actualTransform,1,h,e._actualTransform),L.setColumn(e._actualTransform,2,a,e._actualTransform),L.setColumn(e._actualTransform,3,s,e._actualTransform)}const xv=new d;function ss(e){const t=e._mode;let n=!1,i=0;t===oe.SCENE2D&&(i=e.frustum.right-e.frustum.left,n=i!==e._positionCartographic.height);let o=e._position;const r=!d.equals(o,e.position)||n;r&&(o=d.clone(e.position,e._position));let s=e._direction;const a=!d.equals(s,e.direction);a&&(d.normalize(e.direction,e.direction),s=d.clone(e.direction,e._direction));let l=e._up;const u=!d.equals(l,e.up);u&&(d.normalize(e.up,e.up),l=d.clone(e.up,e._up));let h=e._right;const f=!d.equals(h,e.right);f&&(d.normalize(e.right,e.right),h=d.clone(e.right,e._right));const _=e._transformChanged||e._modeChanged;e._transformChanged=!1,_&&(L.inverseTransformation(e._transform,e._invTransform),e._mode===oe.COLUMBUS_VIEW||e._mode===oe.SCENE2D?L.equals(L.IDENTITY,e._transform)?L.clone(Ye.TRANSFORM_2D,e._actualTransform):e._mode===oe.COLUMBUS_VIEW?qMe(e):eFe(e):L.clone(e._transform,e._actualTransform),L.inverseTransformation(e._actualTransform,e._actualInvTransform),e._modeChanged=!1);const g=e._actualTransform;if(r||_)if(e._positionWC=L.multiplyByPoint(g,o,e._positionWC),t===oe.SCENE3D||t===oe.MORPHING)e._positionCartographic=e._projection.ellipsoid.cartesianToCartographic(e._positionWC,e._positionCartographic);else{const m=xv;m.x=e._positionWC.y,m.y=e._positionWC.z,m.z=e._positionWC.x,t===oe.SCENE2D&&(m.z=i),e._projection.unproject(m,e._positionCartographic)}if(a||u||f){const m=d.dot(s,d.cross(l,h,xv));if(Math.abs(1-m)>R.EPSILON2){const b=1/d.magnitudeSquared(l),T=d.dot(l,s)*b,x=d.multiplyByScalar(s,T,xv);l=d.normalize(d.subtract(l,x,e._up),e._up),d.clone(l,e.up),h=d.cross(s,l,e._right),d.clone(h,e.right)}}(a||_)&&(e._directionWC=L.multiplyByPointAsVector(g,s,e._directionWC),d.normalize(e._directionWC,e._directionWC)),(u||_)&&(e._upWC=L.multiplyByPointAsVector(g,l,e._upWC),d.normalize(e._upWC,e._upWC)),(f||_)&&(e._rightWC=L.multiplyByPointAsVector(g,h,e._rightWC),d.normalize(e._rightWC,e._rightWC)),(r||a||u||f||_)&&dW(e)}function hW(e,t){let n;return R.equalsEpsilon(Math.abs(e.z),1,R.EPSILON3)?n=Math.atan2(t.y,t.x)-R.PI_OVER_TWO:n=Math.atan2(e.y,e.x)-R.PI_OVER_TWO,R.TWO_PI-R.zeroToTwoPi(n)}function fW(e){return R.PI_OVER_TWO-R.acosClamped(e.z)}function pW(e,t,n){let i=0;return R.equalsEpsilon(Math.abs(e.z),1,R.EPSILON3)||(i=Math.atan2(-n.z,t.z),i=R.zeroToTwoPi(i+R.TWO_PI)),i}const rx=new L,sx=new L;Object.defineProperties(Ye.prototype,{transform:{get:function(){return this._transform}},inverseTransform:{get:function(){return ss(this),this._invTransform}},viewMatrix:{get:function(){return ss(this),this._viewMatrix}},inverseViewMatrix:{get:function(){return ss(this),this._invViewMatrix}},positionCartographic:{get:function(){return ss(this),this._positionCartographic}},positionWC:{get:function(){return ss(this),this._positionWC}},directionWC:{get:function(){return ss(this),this._directionWC}},upWC:{get:function(){return ss(this),this._upWC}},rightWC:{get:function(){return ss(this),this._rightWC}},heading:{get:function(){if(this._mode!==oe.MORPHING){const e=this._projection.ellipsoid,t=L.clone(this._transform,rx),n=zt.eastNorthUpToFixedFrame(this.positionWC,e,sx);this._setTransform(n);const i=hW(this.direction,this.up);return this._setTransform(t),i}}},pitch:{get:function(){if(this._mode!==oe.MORPHING){const e=this._projection.ellipsoid,t=L.clone(this._transform,rx),n=zt.eastNorthUpToFixedFrame(this.positionWC,e,sx);this._setTransform(n);const i=fW(this.direction);return this._setTransform(t),i}}},roll:{get:function(){if(this._mode!==oe.MORPHING){const e=this._projection.ellipsoid,t=L.clone(this._transform,rx),n=zt.eastNorthUpToFixedFrame(this.positionWC,e,sx);this._setTransform(n);const i=pW(this.direction,this.up,this.right);return this._setTransform(t),i}}},moveStart:{get:function(){return this._moveStart}},moveEnd:{get:function(){return this._moveEnd}},changed:{get:function(){return this._changed}}});Ye.prototype.update=function(e){if(!c(e))throw new E("mode is required.");if(e===oe.SCENE2D&&!(this.frustum instanceof Ki))throw new E("An OrthographicOffCenterFrustum is required in 2D.");if((e===oe.SCENE3D||e===oe.COLUMBUS_VIEW)&&!(this.frustum instanceof _n)&&!(this.frustum instanceof It))throw new E("A PerspectiveFrustum or OrthographicFrustum is required in 3D and Columbus view");let t=!1;if(e!==this._mode&&(this._mode=e,this._modeChanged=e!==oe.MORPHING,t=this._mode===oe.SCENE2D),t){const n=this._max2Dfrustum=this.frustum.clone();if(!(n instanceof Ki))throw new E("The camera frustum is expected to be orthographic for 2D camera control.");const i=2,o=n.top/n.right;n.right=this._maxCoord.x*i,n.left=-n.right,n.top=o*n.right,n.bottom=-n.top}this._mode===oe.SCENE2D&&yW(this,this.position)};const tFe=new d,nFe=new d,iFe=new d;Ye.prototype._setTransform=function(e){const t=d.clone(this.positionWC,tFe),n=d.clone(this.upWC,nFe),i=d.clone(this.directionWC,iFe);L.clone(e,this._transform),this._transformChanged=!0,ss(this);const o=this._actualInvTransform;L.multiplyByPoint(o,t,this.position),L.multiplyByPointAsVector(o,i,this.direction),L.multiplyByPointAsVector(o,n,this.up),d.cross(this.direction,this.up,this.right),ss(this)};const oFe=new H,rFe=new nn,sFe=new d,aFe=new d;function mW(e){if(!L.equals(L.IDENTITY,e.transform))return d.magnitude(e.position);const t=e._scene,n=t.globe,i=oFe;i.x=t.drawingBufferWidth/2,i.y=t.drawingBufferHeight/2;let o;if(c(n)){const a=e.getPickRay(i,rFe);o=n.pickWorldCoordinates(a,t,!0,sFe)}let r;t.pickPositionSupported&&(r=t.pickPositionWorldCoordinates(i,aFe));let s;if(c(o)||c(r)){const a=c(r)?d.distance(r,e.positionWC):Number.POSITIVE_INFINITY,l=c(o)?d.distance(o,e.positionWC):Number.POSITIVE_INFINITY;s=Math.min(a,l)}else s=Math.max(e.positionCartographic.height,0);return s}Ye.prototype._adjustOrthographicFrustum=function(e){this.frustum instanceof It&&(!e&&this._positionCartographic.height<15e4||(this.frustum.width=mW(this)))};const sC=new d,E1=new L,cFe=new L,w1=new _e,S1=new $,_W=new he;function lFe(e,t,n){if(isNaN(t.x)||isNaN(t.y)||isNaN(t.z))throw new E("position has a NaN component");const i=L.clone(e.transform,E1),o=zt.eastNorthUpToFixedFrame(t,e._projection.ellipsoid,cFe);e._setTransform(o),d.clone(d.ZERO,e.position),n.heading=n.heading-R.PI_OVER_TWO;const r=_e.fromHeadingPitchRoll(n,w1),s=$.fromQuaternion(r,S1);$.getColumn(s,0,e.direction),$.getColumn(s,2,e.up),d.cross(e.direction,e.up,e.right),e._setTransform(i),e._adjustOrthographicFrustum(!0)}function uFe(e,t,n,i){const o=L.clone(e.transform,E1);if(e._setTransform(L.IDENTITY),!d.equals(t,e.positionWC)){if(i){const a=e._projection,l=a.ellipsoid.cartesianToCartographic(t,_W);t=a.project(l,sC)}d.clone(t,e.position)}n.heading=n.heading-R.PI_OVER_TWO;const r=_e.fromHeadingPitchRoll(n,w1),s=$.fromQuaternion(r,S1);$.getColumn(s,0,e.direction),$.getColumn(s,2,e.up),d.cross(e.direction,e.up,e.right),e._setTransform(o),e._adjustOrthographicFrustum(!0)}function dFe(e,t,n,i){const o=L.clone(e.transform,E1);if(e._setTransform(L.IDENTITY),!d.equals(t,e.positionWC)){if(i){const l=e._projection,u=l.ellipsoid.cartesianToCartographic(t,_W);t=l.project(u,sC)}H.clone(t,e.position);const r=-t.z*.5,s=-r,a=e.frustum;if(s>r){const l=a.top/a.right;a.right=s,a.left=r,a.top=a.right*l,a.bottom=-a.top}}if(e._scene.mapMode2D===Wh.ROTATE){n.heading=n.heading-R.PI_OVER_TWO,n.pitch=-R.PI_OVER_TWO,n.roll=0;const r=_e.fromHeadingPitchRoll(n,w1),s=$.fromQuaternion(r,S1);$.getColumn(s,2,e.up),d.cross(e.direction,e.up,e.right)}e._setTransform(o)}const hFe=new d,fFe=new d,pFe=new d;function gW(e,t,n,i){const o=d.clone(n.direction,hFe),r=d.clone(n.up,fFe);if(e._scene.mode===oe.SCENE3D){const a=e._projection.ellipsoid,l=zt.eastNorthUpToFixedFrame(t,a,rx),u=L.inverseTransformation(l,sx);L.multiplyByPointAsVector(u,o,o),L.multiplyByPointAsVector(u,r,r)}const s=d.cross(o,r,pFe);return i.heading=hW(o,r),i.pitch=fW(o),i.roll=pW(o,r,s),i}const jD={destination:void 0,orientation:{direction:void 0,up:void 0,heading:void 0,pitch:void 0,roll:void 0},convert:void 0,endTransform:void 0},vm=new lr;Ye.prototype.setView=function(e){e=y(e,y.EMPTY_OBJECT);let t=y(e.orientation,y.EMPTY_OBJECT);const n=this._mode;if(n===oe.MORPHING)return;c(e.endTransform)&&this._setTransform(e.endTransform);let i=y(e.convert,!0),o=y(e.destination,d.clone(this.positionWC,sC));if(c(o)&&c(o.west)){if(o=this.getRectangleCameraCoordinates(o,sC),isNaN(o.x)||isNaN(o.y))throw new E("destination has a NaN component");i=!1}c(t.direction)&&(t=gW(this,o,t,jD.orientation)),vm.heading=y(t.heading,0),vm.pitch=y(t.pitch,-R.PI_OVER_TWO),vm.roll=y(t.roll,0),n===oe.SCENE3D?lFe(this,o,vm):n===oe.SCENE2D?dFe(this,o,vm,i):uFe(this,o,vm,i)};const mFe=new d;Ye.prototype.flyHome=function(e){const t=this._mode;if(t===oe.MORPHING&&this._scene.completeMorph(),t===oe.SCENE2D)this.flyTo({destination:Ye.DEFAULT_VIEW_RECTANGLE,duration:e,endTransform:L.IDENTITY});else if(t===oe.SCENE3D){const n=this.getRectangleCameraCoordinates(Ye.DEFAULT_VIEW_RECTANGLE);let i=d.magnitude(n);i+=i*Ye.DEFAULT_VIEW_FACTOR,d.normalize(n,n),d.multiplyByScalar(n,i,n),this.flyTo({destination:n,duration:e,endTransform:L.IDENTITY})}else if(t===oe.COLUMBUS_VIEW){const n=this._projection.ellipsoid.maximumRadius;let i=new d(0,-1,1);i=d.multiplyByScalar(d.normalize(i,i),5*n,i),this.flyTo({destination:i,duration:e,orientation:{heading:0,pitch:-Math.acos(d.normalize(i,mFe).z),roll:0},endTransform:L.IDENTITY,convert:!1})}};Ye.prototype.worldToCameraCoordinates=function(e,t){if(!c(e))throw new E("cartesian is required.");return c(t)||(t=new te),ss(this),L.multiplyByVector(this._actualInvTransform,e,t)};Ye.prototype.worldToCameraCoordinatesPoint=function(e,t){if(!c(e))throw new E("cartesian is required.");return c(t)||(t=new d),ss(this),L.multiplyByPoint(this._actualInvTransform,e,t)};Ye.prototype.worldToCameraCoordinatesVector=function(e,t){if(!c(e))throw new E("cartesian is required.");return c(t)||(t=new d),ss(this),L.multiplyByPointAsVector(this._actualInvTransform,e,t)};Ye.prototype.cameraToWorldCoordinates=function(e,t){if(!c(e))throw new E("cartesian is required.");return c(t)||(t=new te),ss(this),L.multiplyByVector(this._actualTransform,e,t)};Ye.prototype.cameraToWorldCoordinatesPoint=function(e,t){if(!c(e))throw new E("cartesian is required.");return c(t)||(t=new d),ss(this),L.multiplyByPoint(this._actualTransform,e,t)};Ye.prototype.cameraToWorldCoordinatesVector=function(e,t){if(!c(e))throw new E("cartesian is required.");return c(t)||(t=new d),ss(this),L.multiplyByPointAsVector(this._actualTransform,e,t)};function yW(e,t){const n=e._scene.mapMode2D===Wh.ROTATE,i=e._maxCoord.x,o=e._maxCoord.y;let r,s;n?(s=i,r=-s):(s=t.x-i*2,r=t.x+i*2),t.x>i&&(t.x=s),t.x<-i&&(t.x=r),t.y>o&&(t.y=o),t.y<-o&&(t.y=-o)}const f3=new d;Ye.prototype.move=function(e,t){if(!c(e))throw new E("direction is required.");const n=this.position;d.multiplyByScalar(e,t,f3),d.add(n,f3,n),this._mode===oe.SCENE2D&&yW(this,n),this._adjustOrthographicFrustum(!0)};Ye.prototype.moveForward=function(e){e=y(e,this.defaultMoveAmount),this._mode===oe.SCENE2D?nE(this,e):this.move(this.direction,e)};Ye.prototype.moveBackward=function(e){e=y(e,this.defaultMoveAmount),this._mode===oe.SCENE2D?nE(this,-e):this.move(this.direction,-e)};Ye.prototype.moveUp=function(e){e=y(e,this.defaultMoveAmount),this.move(this.up,e)};Ye.prototype.moveDown=function(e){e=y(e,this.defaultMoveAmount),this.move(this.up,-e)};Ye.prototype.moveRight=function(e){e=y(e,this.defaultMoveAmount),this.move(this.right,e)};Ye.prototype.moveLeft=function(e){e=y(e,this.defaultMoveAmount),this.move(this.right,-e)};Ye.prototype.lookLeft=function(e){e=y(e,this.defaultLookAmount),this._mode!==oe.SCENE2D&&this.look(this.up,-e)};Ye.prototype.lookRight=function(e){e=y(e,this.defaultLookAmount),this._mode!==oe.SCENE2D&&this.look(this.up,e)};Ye.prototype.lookUp=function(e){e=y(e,this.defaultLookAmount),this._mode!==oe.SCENE2D&&this.look(this.right,-e)};Ye.prototype.lookDown=function(e){e=y(e,this.defaultLookAmount),this._mode!==oe.SCENE2D&&this.look(this.right,e)};const _Fe=new _e,gFe=new $;Ye.prototype.look=function(e,t){if(!c(e))throw new E("axis is required.");const n=y(t,this.defaultLookAmount),i=_e.fromAxisAngle(e,-n,_Fe),o=$.fromQuaternion(i,gFe),r=this.direction,s=this.up,a=this.right;$.multiplyByVector(o,r,r),$.multiplyByVector(o,s,s),$.multiplyByVector(o,a,a)};Ye.prototype.twistLeft=function(e){e=y(e,this.defaultLookAmount),this.look(this.direction,e)};Ye.prototype.twistRight=function(e){e=y(e,this.defaultLookAmount),this.look(this.direction,-e)};const yFe=new _e,bFe=new $;Ye.prototype.rotate=function(e,t){if(!c(e))throw new E("axis is required.");const n=y(t,this.defaultRotateAmount),i=_e.fromAxisAngle(e,-n,yFe),o=$.fromQuaternion(i,bFe);$.multiplyByVector(o,this.position,this.position),$.multiplyByVector(o,this.direction,this.direction),$.multiplyByVector(o,this.up,this.up),d.cross(this.direction,this.up,this.right),d.cross(this.right,this.direction,this.up),this._adjustOrthographicFrustum(!1)};Ye.prototype.rotateDown=function(e){e=y(e,this.defaultRotateAmount),bW(this,e)};Ye.prototype.rotateUp=function(e){e=y(e,this.defaultRotateAmount),bW(this,-e)};const TFe=new d,AFe=new d,xFe=new d,p3=new d;function bW(e,t){const n=e.position;if(c(e.constrainedAxis)&&!d.equalsEpsilon(e.position,d.ZERO,R.EPSILON2)){const i=d.normalize(n,TFe),o=d.equalsEpsilon(i,e.constrainedAxis,R.EPSILON2),r=d.equalsEpsilon(i,d.negate(e.constrainedAxis,p3),R.EPSILON2);if(!o&&!r){const s=d.normalize(e.constrainedAxis,AFe);let a=d.dot(i,s),l=R.acosClamped(a);t>0&&t>l&&(t=l-R.EPSILON4),a=d.dot(i,d.negate(s,p3)),l=R.acosClamped(a),t<0&&-t>l&&(t=-l+R.EPSILON4);const u=d.cross(s,i,xFe);e.rotate(u,t)}else(o&&t<0||r&&t>0)&&e.rotate(e.right,t)}else e.rotate(e.right,t)}Ye.prototype.rotateRight=function(e){e=y(e,this.defaultRotateAmount),TW(this,-e)};Ye.prototype.rotateLeft=function(e){e=y(e,this.defaultRotateAmount),TW(this,e)};function TW(e,t){c(e.constrainedAxis)?e.rotate(e.constrainedAxis,t):e.rotate(e.up,t)}function nE(e,t){const n=e.frustum;if(!(n instanceof Ki)||!c(n.left)||!c(n.right)||!c(n.bottom)||!c(n.top))throw new E("The camera frustum is expected to be orthographic for 2D camera control.");let i;if(t=t*.5,Math.abs(n.top)+Math.abs(n.bottom)>Math.abs(n.left)+Math.abs(n.right)){let o=n.top-t,r=n.bottom+t,s=e._maxCoord.y;e._scene.mapMode2D===Wh.ROTATE&&(s*=e.maximumZoomFactor),r>s&&(r=s,o=-s),o<=r&&(o=1,r=-1),i=n.right/n.top,n.top=o,n.bottom=r,n.right=n.top*i,n.left=-n.right}else{let o=n.right-t,r=n.left+t,s=e._maxCoord.x;e._scene.mapMode2D===Wh.ROTATE&&(s*=e.maximumZoomFactor),o>s&&(o=s,r=-s),o<=r&&(o=1,r=-1),i=n.top/n.right,n.right=o,n.left=r,n.top=n.right*i,n.bottom=-n.top}}function AW(e,t){e.move(e.direction,t)}Ye.prototype.zoomIn=function(e){e=y(e,this.defaultZoomAmount),this._mode===oe.SCENE2D?nE(this,e):AW(this,e)};Ye.prototype.zoomOut=function(e){e=y(e,this.defaultZoomAmount),this._mode===oe.SCENE2D?nE(this,-e):AW(this,-e)};Ye.prototype.getMagnitude=function(){if(this._mode===oe.SCENE3D)return d.magnitude(this.position);if(this._mode===oe.COLUMBUS_VIEW)return Math.abs(this.position.z);if(this._mode===oe.SCENE2D)return Math.max(this.frustum.right-this.frustum.left,this.frustum.top-this.frustum.bottom)};const CFe=new L;Ye.prototype.lookAt=function(e,t){if(!c(e))throw new E("target is required");if(!c(t))throw new E("offset is required");if(this._mode===oe.MORPHING)throw new E("lookAt is not supported while morphing.");const n=zt.eastNorthUpToFixedFrame(e,ae.WGS84,CFe);this.lookAtTransform(n,t)};const EFe=new d,wFe=new _e,SFe=new _e,vFe=new $;function xW(e,t,n){t=R.clamp(t,-R.PI_OVER_TWO,R.PI_OVER_TWO),e=R.zeroToTwoPi(e)-R.PI_OVER_TWO;const i=_e.fromAxisAngle(d.UNIT_Y,-t,wFe),o=_e.fromAxisAngle(d.UNIT_Z,-e,SFe),r=_e.multiply(o,i,o),s=$.fromQuaternion(r,vFe),a=d.clone(d.UNIT_X,EFe);return $.multiplyByVector(s,a,a),d.negate(a,a),d.multiplyByScalar(a,n,a),a}Ye.prototype.lookAtTransform=function(e,t){if(!c(e))throw new E("transform is required");if(this._mode===oe.MORPHING)throw new E("lookAtTransform is not supported while morphing.");if(this._setTransform(e),!c(t))return;let n;if(c(t.heading)?n=xW(t.heading,t.pitch,t.range):n=t,this._mode===oe.SCENE2D){H.clone(H.ZERO,this.position),d.negate(n,this.up),this.up.z=0,d.magnitudeSquared(this.up)<R.EPSILON10&&d.clone(d.UNIT_Y,this.up),d.normalize(this.up,this.up),this._setTransform(L.IDENTITY),d.negate(d.UNIT_Z,this.direction),d.cross(this.direction,this.up,this.right),d.normalize(this.right,this.right);const i=this.frustum,o=i.top/i.right;i.right=d.magnitude(n)*.5,i.left=-i.right,i.top=o*i.right,i.bottom=-i.top,this._setTransform(e);return}d.clone(n,this.position),d.negate(this.position,this.direction),d.normalize(this.direction,this.direction),d.cross(this.direction,d.UNIT_Z,this.right),d.magnitudeSquared(this.right)<R.EPSILON10&&d.clone(d.UNIT_X,this.right),d.normalize(this.right,this.right),d.cross(this.right,this.direction,this.up),d.normalize(this.up,this.up),this._adjustOrthographicFrustum(!0)};const ty=new he,IFe=new he,DFe=new d,PFe=new d,OFe=new d,LFe=new d,RFe=new d,NFe=new d,MFe=new d,Cv=new d,FFe={direction:new d,right:new d,up:new d};let m3;function es(e,t,n,i){return Math.abs(d.dot(t,n))/i-d.dot(e,n)}function CW(e,t,n,i){const o=e._projection.ellipsoid,r=i?e:FFe,s=t.north,a=t.south;let l=t.east;const u=t.west;u>l&&(l+=R.TWO_PI);const h=(u+l)*.5;let f;if(a<-R.PI_OVER_TWO+R.RADIANS_PER_DEGREE&&s>R.PI_OVER_TWO-R.RADIANS_PER_DEGREE)f=0;else{const U=ty;U.longitude=h,U.latitude=s,U.height=0;const B=IFe;B.longitude=h,B.latitude=a,B.height=0;let S=m3;(!c(S)||S.ellipsoid!==o)&&(m3=S=new Mp(void 0,void 0,o)),S.setEndPoints(U,B),f=S.interpolateUsingFraction(.5,ty).latitude}const _=ty;_.longitude=h,_.latitude=f,_.height=0;const g=o.cartographicToCartesian(_,MFe),m=ty;m.longitude=l,m.latitude=s;const b=o.cartographicToCartesian(m,DFe);m.longitude=u;const T=o.cartographicToCartesian(m,OFe);m.longitude=h;const x=o.cartographicToCartesian(m,RFe);m.latitude=a;const C=o.cartographicToCartesian(m,NFe);m.longitude=l;const w=o.cartographicToCartesian(m,LFe);m.longitude=u;const v=o.cartographicToCartesian(m,PFe);d.subtract(T,g,T),d.subtract(w,g,w),d.subtract(b,g,b),d.subtract(v,g,v),d.subtract(x,g,x),d.subtract(C,g,C);const P=o.geodeticSurfaceNormal(g,r.direction);d.negate(P,P);const N=d.cross(P,d.UNIT_Z,r.right);d.normalize(N,N);const k=d.cross(N,P,r.up);let M;if(e.frustum instanceof It){const U=Math.max(d.distance(b,T),d.distance(w,v)),B=Math.max(d.distance(b,w),d.distance(T,v));let S,D;const p=e.frustum._offCenterFrustum,I=p.right/p.top,O=B*I;U>O?(S=U,D=S/I):(D=B,S=O),M=Math.max(S,D)}else{const U=Math.tan(e.frustum.fovy*.5),B=e.frustum.aspectRatio*U;if(M=Math.max(es(P,k,T,U),es(P,k,w,U),es(P,k,b,U),es(P,k,v,U),es(P,k,x,U),es(P,k,C,U),es(P,N,T,B),es(P,N,w,B),es(P,N,b,B),es(P,N,v,B),es(P,N,x,B),es(P,N,C,B)),a<0&&s>0){const S=ty;S.longitude=u,S.latitude=0,S.height=0;let D=o.cartographicToCartesian(S,Cv);d.subtract(D,g,D),M=Math.max(M,es(P,k,D,U),es(P,N,D,B)),S.longitude=l,D=o.cartographicToCartesian(S,Cv),d.subtract(D,g,D),M=Math.max(M,es(P,k,D,U),es(P,N,D,B))}}return d.add(g,d.multiplyByScalar(P,-M,Cv),n)}const BFe=new he,zFe=new d,UFe=new d;function kFe(e,t,n){const i=e._projection;t.west>t.east&&(t=ce.MAX_VALUE);const o=e._actualTransform,r=e._actualInvTransform,s=BFe;s.longitude=t.east,s.latitude=t.north;const a=i.project(s,zFe);L.multiplyByPoint(o,a,a),L.multiplyByPoint(r,a,a),s.longitude=t.west,s.latitude=t.south;const l=i.project(s,UFe);if(L.multiplyByPoint(o,l,l),L.multiplyByPoint(r,l,l),n.x=(a.x-l.x)*.5+l.x,n.y=(a.y-l.y)*.5+l.y,c(e.frustum.fovy)){const u=Math.tan(e.frustum.fovy*.5),h=e.frustum.aspectRatio*u;n.z=Math.max((a.x-l.x)/h,(a.y-l.y)/u)*.5}else{const u=a.x-l.x,h=a.y-l.y;n.z=Math.max(u,h)}return n}const VFe=new he,HFe=new d,GFe=new d;function jFe(e,t,n){const i=e._projection;let o=t.east;t.west>t.east&&(e._scene.mapMode2D===Wh.INFINITE_SCROLL?o+=R.TWO_PI:(t=ce.MAX_VALUE,o=t.east));let r=VFe;r.longitude=o,r.latitude=t.north;const s=i.project(r,HFe);r.longitude=t.west,r.latitude=t.south;const a=i.project(r,GFe),l=Math.abs(s.x-a.x)*.5;let u=Math.abs(s.y-a.y)*.5,h,f;const _=e.frustum.right/e.frustum.top,g=u*_;return l>g?(h=l,f=h/_):(f=u,h=g),u=Math.max(2*h,2*f),n.x=(s.x-a.x)*.5+a.x,n.y=(s.y-a.y)*.5+a.y,r=i.unproject(n,r),r.height=u,n=i.project(r,n),n}Ye.prototype.getRectangleCameraCoordinates=function(e,t){if(!c(e))throw new E("rectangle is required");const n=this._mode;if(c(t)||(t=new d),n===oe.SCENE3D)return CW(this,e,t);if(n===oe.COLUMBUS_VIEW)return kFe(this,e,t);if(n===oe.SCENE2D)return jFe(this,e,t)};const WFe=new nn;function qFe(e,t,n,i){n=y(n,ae.WGS84);const o=e.getPickRay(t,WFe),r=Ei.rayEllipsoid(o,n);if(!r)return;const s=r.start>0?r.start:r.stop;return nn.getPoint(o,s,i)}const YFe=new nn;function $Fe(e,t,n,i){let r=e.getPickRay(t,YFe).origin;r=d.fromElements(r.y,r.z,0,r);const s=n.unproject(r);if(!(s.latitude<-R.PI_OVER_TWO||s.latitude>R.PI_OVER_TWO))return n.ellipsoid.cartographicToCartesian(s,i)}const XFe=new nn;function QFe(e,t,n,i){const o=e.getPickRay(t,XFe),r=-o.origin.x/o.direction.x;nn.getPoint(o,r,i);const s=n.unproject(new d(i.y,i.z,0));if(!(s.latitude<-R.PI_OVER_TWO||s.latitude>R.PI_OVER_TWO||s.longitude<-Math.PI||s.longitude>Math.PI))return n.ellipsoid.cartographicToCartesian(s,i)}Ye.prototype.pickEllipsoid=function(e,t,n){if(!c(e))throw new E("windowPosition is required.");const i=this._scene.canvas;if(!(i.clientWidth===0||i.clientHeight===0)){if(c(n)||(n=new d),t=y(t,ae.WGS84),this._mode===oe.SCENE3D)n=qFe(this,e,t,n);else if(this._mode===oe.SCENE2D)n=$Fe(this,e,this._projection,n);else if(this._mode===oe.COLUMBUS_VIEW)n=QFe(this,e,this._projection,n);else return;return n}};const KFe=new d,ZFe=new d,JFe=new d;function e2e(e,t,n){const i=e._scene.canvas,o=i.clientWidth,r=i.clientHeight,s=Math.tan(e.frustum.fovy*.5),a=e.frustum.aspectRatio*s,l=e.frustum.near,u=2/o*t.x-1,h=2/r*(r-t.y)-1,f=e.positionWC;d.clone(f,n.origin);const _=d.multiplyByScalar(e.directionWC,l,KFe);d.add(f,_,_);const g=d.multiplyByScalar(e.rightWC,u*l*a,ZFe),m=d.multiplyByScalar(e.upWC,h*l*s,JFe),b=d.add(_,g,n.direction);return d.add(b,m,b),d.subtract(b,f,b),d.normalize(b,b),n}const dA=new d;function t2e(e,t,n){const i=e._scene.canvas,o=i.clientWidth,r=i.clientHeight;let s=e.frustum;const a=s.offCenterFrustum;c(a)&&(s=a);let l=2/o*t.x-1;l*=(s.right-s.left)*.5;let u=2/r*(r-t.y)-1;u*=(s.top-s.bottom)*.5;const h=n.origin;return d.clone(e.position,h),d.multiplyByScalar(e.right,l,dA),d.add(dA,h,h),d.multiplyByScalar(e.up,u,dA),d.add(dA,h,h),d.clone(e.directionWC,n.direction),(e._mode===oe.COLUMBUS_VIEW||e._mode===oe.SCENE2D)&&d.fromElements(n.origin.z,n.origin.x,n.origin.y,n.origin),n}Ye.prototype.getPickRay=function(e,t){if(!c(e))throw new E("windowPosition is required.");c(t)||(t=new nn);const n=this._scene.canvas;if(n.clientWidth<=0||n.clientHeight<=0)return;const i=this.frustum;return c(i.aspectRatio)&&c(i.fov)&&c(i.near)?e2e(this,e,t):t2e(this,e,t)};const n2e=new d,i2e=new d;Ye.prototype.distanceToBoundingSphere=function(e){if(!c(e))throw new E("boundingSphere is required.");const t=d.subtract(this.positionWC,e.center,n2e),n=d.multiplyByScalar(this.directionWC,d.dot(t,this.directionWC),i2e);return Math.max(0,d.magnitude(n)-e.radius)};const o2e=new H;Ye.prototype.getPixelSize=function(e,t,n){if(!c(e))throw new E("boundingSphere is required.");if(!c(t))throw new E("drawingBufferWidth is required.");if(!c(n))throw new E("drawingBufferHeight is required.");const i=this.distanceToBoundingSphere(e),o=this.frustum.getPixelDimensions(t,n,i,this._scene.pixelRatio,o2e);return Math.max(o.x,o.y)};function r2e(e,t,n,i,o,r){const s=d.clone(t);n.y>i?s.y-=n.y-i:n.y<-i&&(s.y+=-i-n.y),n.z>o?s.z-=n.z-o:n.z<-o&&(s.z+=-o-n.z);function a(l){const u=d.lerp(t,s,l.time,new d);e.worldToCameraCoordinatesPoint(u,e.position)}return{easingFunction:ka.EXPONENTIAL_OUT,startObject:{time:0},stopObject:{time:1},duration:r,update:a}}const s2e=new d,_3=new d,a2e=new d,c2e=new d;function l2e(e,t){let n=e.position;const i=e.direction,o=e.worldToCameraCoordinatesVector(d.UNIT_X,s2e),r=-d.dot(o,n)/d.dot(o,i),s=d.add(n,d.multiplyByScalar(i,r,_3),_3);e.cameraToWorldCoordinatesPoint(s,s),n=e.cameraToWorldCoordinatesPoint(e.position,a2e);const a=Math.tan(e.frustum.fovy*.5),l=e.frustum.aspectRatio*a,u=d.magnitude(d.subtract(n,s,c2e)),h=l*u,f=a*u,_=e._maxCoord.x,g=e._maxCoord.y,m=Math.max(h-_,_),b=Math.max(f-g,g);if(n.z<-m||n.z>m||n.y<-b||n.y>b){const T=s.y<-m||s.y>m,x=s.z<-b||s.z>b;if(T||x)return r2e(e,n,s,m,b,t)}}Ye.prototype.createCorrectPositionTween=function(e){if(!c(e))throw new E("duration is required.");if(this._mode===oe.COLUMBUS_VIEW)return l2e(this,e)};const u2e=new d,tr={destination:void 0,heading:void 0,pitch:void 0,roll:void 0,duration:void 0,complete:void 0,cancel:void 0,endTransform:void 0,maximumHeight:void 0,easingFunction:void 0};Ye.prototype.cancelFlight=function(){c(this._currentFlight)&&(this._currentFlight.cancelTween(),this._currentFlight=void 0)};Ye.prototype.completeFlight=function(){if(c(this._currentFlight)){this._currentFlight.cancelTween();const e={destination:void 0,orientation:{heading:void 0,pitch:void 0,roll:void 0}};e.destination=tr.destination,e.orientation.heading=tr.heading,e.orientation.pitch=tr.pitch,e.orientation.roll=tr.roll,this.setView(e),c(this._currentFlight.complete)&&this._currentFlight.complete(),this._currentFlight=void 0}};Ye.prototype.flyTo=function(e){e=y(e,y.EMPTY_OBJECT);let t=e.destination;if(!c(t))throw new E("destination is required.");if(this._mode===oe.MORPHING)return;this.cancelFlight();const i=t instanceof ce;i&&(t=this.getRectangleCameraCoordinates(t,u2e));let o=y(e.orientation,y.EMPTY_OBJECT);if(c(o.direction)&&(o=gW(this,t,o,jD.orientation)),c(e.duration)&&e.duration<=0){const h=jD;h.destination=e.destination,h.orientation.heading=o.heading,h.orientation.pitch=o.pitch,h.orientation.roll=o.roll,h.convert=e.convert,h.endTransform=e.endTransform,this.setView(h),typeof e.complete=="function"&&e.complete();return}const r=this;let s;tr.destination=t,tr.heading=o.heading,tr.pitch=o.pitch,tr.roll=o.roll,tr.duration=e.duration,tr.complete=function(){s===r._currentFlight&&(r._currentFlight=void 0),c(e.complete)&&e.complete()},tr.cancel=e.cancel,tr.endTransform=e.endTransform,tr.convert=i?!1:e.convert,tr.maximumHeight=e.maximumHeight,tr.pitchAdjustHeight=e.pitchAdjustHeight,tr.flyOverLongitude=e.flyOverLongitude,tr.flyOverLongitudeWeight=e.flyOverLongitudeWeight,tr.easingFunction=e.easingFunction;const a=this._scene,l=GMe.createTween(a,tr);if(l.duration===0){typeof l.complete=="function"&&l.complete();return}s=a.tweens.add(l),this._currentFlight=s;let u=this._scene.preloadFlightCamera;this._mode!==oe.SCENE2D&&(c(u)||(u=Ye.clone(this)),u.setView({destination:t,orientation:o}),this._scene.preloadFlightCullingVolume=u.frustum.computeCullingVolume(u.positionWC,u.directionWC,u.upWC))};function d2e(e,t){const n=e.frustum,i=Math.tan(n.fovy*.5),o=n.aspectRatio*i;return Math.max(t/o,t/i)}function h2e(e,t){let n=e.frustum;const i=n.offCenterFrustum;c(i)&&(n=i);let o,r;const s=n.right/n.top,a=t*s;return t>a?(o=t,r=o/s):(r=t,o=a),Math.max(o,r)*1.5}const f2e=100;function EW(e,t,n){n=F_.clone(c(n)?n:Ye.DEFAULT_OFFSET);const i=e._scene.screenSpaceCameraController.minimumZoomDistance,o=e._scene.screenSpaceCameraController.maximumZoomDistance,r=n.range;if(!c(r)||r===0){const s=t.radius;s===0?n.range=f2e:e.frustum instanceof It||e._mode===oe.SCENE2D?n.range=h2e(e,s):n.range=d2e(e,s),n.range=R.clamp(n.range,i,o)}return n}Ye.prototype.viewBoundingSphere=function(e,t){if(!c(e))throw new E("boundingSphere is required.");if(this._mode===oe.MORPHING)throw new E("viewBoundingSphere is not supported while morphing.");t=EW(this,e,t),this.lookAt(e.center,t)};const p2e=new L,m2e=new d,_2e=new d,g2e=new d,y2e=new d,b2e=new te,T2e=new _e,A2e=new $;Ye.prototype.flyToBoundingSphere=function(e,t){if(!c(e))throw new E("boundingSphere is required.");t=y(t,y.EMPTY_OBJECT);const n=this._mode===oe.SCENE2D||this._mode===oe.COLUMBUS_VIEW;this._setTransform(L.IDENTITY);const i=EW(this,e,t.offset);let o;n?o=d.multiplyByScalar(d.UNIT_Z,i.range,m2e):o=xW(i.heading,i.pitch,i.range);const r=zt.eastNorthUpToFixedFrame(e.center,ae.WGS84,p2e);L.multiplyByPoint(r,o,o);let s,a;if(!n){if(s=d.subtract(e.center,o,_2e),d.normalize(s,s),a=L.multiplyByPointAsVector(r,d.UNIT_Z,g2e),1-Math.abs(d.dot(s,a))<R.EPSILON6){const u=_e.fromAxisAngle(s,i.heading,T2e),h=$.fromQuaternion(u,A2e);d.fromCartesian4(L.getColumn(r,1,b2e),a),$.multiplyByVector(h,a,a)}const l=d.cross(s,a,y2e);d.cross(l,s,a),d.normalize(a,a)}this.flyTo({destination:o,orientation:{direction:s,up:a},duration:t.duration,complete:t.complete,cancel:t.cancel,endTransform:t.endTransform,maximumHeight:t.maximumHeight,easingFunction:t.easingFunction,flyOverLongitude:t.flyOverLongitude,flyOverLongitudeWeight:t.flyOverLongitudeWeight,pitchAdjustHeight:t.pitchAdjustHeight})};const g3=new d,y3=new d,Ev=new d,b3=new d,ny=[new d,new d,new d,new d];function x2e(e,t){const n=t.radii,i=e.positionWC,o=d.multiplyComponents(t.oneOverRadii,i,g3),r=d.magnitude(o),s=d.normalize(o,y3);let a,l;d.equalsEpsilon(s,d.UNIT_Z,R.EPSILON10)?(a=new d(0,1,0),l=new d(0,0,1)):(a=d.normalize(d.cross(d.UNIT_Z,s,Ev),Ev),l=d.normalize(d.cross(s,a,b3),b3));const u=Math.sqrt(d.magnitudeSquared(o)-1),h=d.multiplyByScalar(s,1/r,g3),f=u/r,_=d.multiplyByScalar(a,f,y3),g=d.multiplyByScalar(l,f,Ev),m=d.add(h,g,ny[0]);d.subtract(m,_,m),d.multiplyComponents(n,m,m);const b=d.subtract(h,g,ny[1]);d.subtract(b,_,b),d.multiplyComponents(n,b,b);const T=d.subtract(h,g,ny[2]);d.add(T,_,T),d.multiplyComponents(n,T,T);const x=d.add(h,g,ny[3]);return d.add(x,_,x),d.multiplyComponents(n,x,x),ny}const wv=new H,C2e=new d,fh=[new he,new he,new he,new he];function hA(e,t,n,i,o,r){wv.x=e,wv.y=t;const s=i.pickEllipsoid(wv,o,C2e);return c(s)?(fh[n]=o.cartesianToCartographic(s,fh[n]),1):(fh[n]=o.cartesianToCartographic(r[n],fh[n]),0)}Ye.prototype.computeViewRectangle=function(e,t){e=y(e,ae.WGS84);const n=this.frustum.computeCullingVolume(this.positionWC,this.directionWC,this.upWC),i=new se(d.ZERO,e.maximumRadius);if(n.computeVisibility(i)===Bt.OUTSIDE)return;const r=this._scene.canvas,s=r.clientWidth,a=r.clientHeight;let l=0;const u=x2e(this,e);if(l+=hA(0,0,0,this,e,u),l+=hA(0,a,1,this,e,u),l+=hA(s,a,2,this,e,u),l+=hA(s,0,3,this,e,u),l<2)return ce.MAX_VALUE;t=ce.fromCartographicArray(fh,t);let h=0,f=fh[3].longitude;for(let _=0;_<4;++_){const g=fh[_].longitude,m=Math.abs(g-f);m>R.PI?h+=R.TWO_PI-m:h+=m,f=g}return R.equalsEpsilon(Math.abs(h),R.TWO_PI,R.EPSILON9)&&(t.west=-R.PI,t.east=R.PI,fh[0].latitude>=0?t.north=R.PI_OVER_TWO:t.south=-R.PI_OVER_TWO),t};Ye.prototype.switchToPerspectiveFrustum=function(){if(this._mode===oe.SCENE2D||this.frustum instanceof _n)return;const e=this._scene;this.frustum=new _n,this.frustum.aspectRatio=e.drawingBufferWidth/e.drawingBufferHeight,this.frustum.fov=R.toRadians(60)};Ye.prototype.switchToOrthographicFrustum=function(){if(this._mode===oe.SCENE2D||this.frustum instanceof It)return;const e=mW(this),t=this._scene;this.frustum=new It,this.frustum.aspectRatio=t.drawingBufferWidth/t.drawingBufferHeight,this.frustum.width=e};Ye.clone=function(e,t){return c(t)||(t=new Ye(e._scene)),d.clone(e.position,t.position),d.clone(e.direction,t.direction),d.clone(e.up,t.up),d.clone(e.right,t.right),L.clone(e._transform,t.transform),t._transformChanged=!0,t.frustum=e.frustum.clone(),t};function jp(e){A.typeOf.object("options",e),A.typeOf.number("options.pass",e.pass),this.pass=e.pass,this.commandList=e.commandList,this.camera=e.camera,this.cullingVolume=e.cullingVolume,this.ready=!1}const T3=576,E2e=100,iy="#ffffff",Sv="#48b";function wW(e,t){this.credit=e,this.count=y(t,1)}function w2e(e,t){const n=e.length;for(let i=0;i<n;i++){const o=e[i];if(Wt.equals(o,t))return!0}return!1}function S2e(e){const t=e._previousCesiumCredit,n=e._currentCesiumCredit;Wt.equals(n,t)||(c(t)&&e._cesiumCreditContainer.removeChild(t.element),c(n)&&e._cesiumCreditContainer.appendChild(n.element),e._previousCesiumCredit=n)}const SW="cesium-credit-delimiter";function A3(e){const t=document.createElement("span");return t.textContent=e,t.className=SW,t}function x3(e,t){if(c(t)){const n=document.createElement(t);n._creditId=e._creditId,n.appendChild(e),e=n}return e}function C3(e,t,n,i){const o=e.childNodes;let r=-1;t.sort(function(s,a){return a.count-s.count});for(let s=0;s<t.length;++s){const a=t[s].credit;if(c(a)){if(r=s,c(n)&&(r*=2,s>0)){const u=r-1;if(o.length<=u)e.appendChild(A3(n));else{const h=o[u];h.className!==SW&&e.replaceChild(A3(n),h)}}const l=a.element;if(o.length<=r)e.appendChild(x3(l,i));else{const u=o[r];u._creditId!==a._id&&e.replaceChild(x3(l,i),u)}}}for(++r;r<o.length;)e.removeChild(o[r])}function v2e(e){const t=e._lightboxCredits,n=e.viewport.clientWidth,i=e.viewport.clientHeight;n!==e._lastViewportWidth&&(n<T3?(t.className="cesium-credit-lightbox cesium-credit-lightbox-mobile",t.style.marginTop="0"):(t.className="cesium-credit-lightbox cesium-credit-lightbox-expanded",t.style.marginTop=`${Math.floor((i-t.clientHeight)*.5)}px`),e._lastViewportWidth=n),n>=T3&&i!==e._lastViewportHeight&&(t.style.marginTop=`${Math.floor((i-t.clientHeight)*.5)}px`,e._lastViewportHeight=i)}function ts(e,t){let n=`${e} {`;for(const i in t)t.hasOwnProperty(i)&&(n+=`${i}: ${t[i]}; `);return n+=` }
|
|
`,n}function I2e(e){let t="";t+=ts(".cesium-credit-lightbox-overlay",{display:"none","z-index":"1",position:"absolute",top:"0",left:"0",width:"100%",height:"100%","background-color":"rgba(80, 80, 80, 0.8)"}),t+=ts(".cesium-credit-lightbox",{"background-color":"#303336",color:iy,position:"relative","min-height":`${E2e}px`,margin:"auto"}),t+=ts(".cesium-credit-lightbox > ul > li a, .cesium-credit-lightbox > ul > li a:visited",{color:iy}),t+=ts(".cesium-credit-lightbox > ul > li a:hover",{color:Sv}),t+=ts(".cesium-credit-lightbox.cesium-credit-lightbox-expanded",{border:"1px solid #444","border-radius":"5px","max-width":"370px"}),t+=ts(".cesium-credit-lightbox.cesium-credit-lightbox-mobile",{height:"100%",width:"100%"}),t+=ts(".cesium-credit-lightbox-title",{padding:"20px 20px 0 20px"}),t+=ts(".cesium-credit-lightbox-close",{"font-size":"18pt",cursor:"pointer",position:"absolute",top:"0",right:"6px",color:iy}),t+=ts(".cesium-credit-lightbox-close:hover",{color:Sv}),t+=ts(".cesium-credit-lightbox > ul",{margin:"0",padding:"12px 20px 12px 40px","font-size":"13px"}),t+=ts(".cesium-credit-lightbox > ul > li",{"padding-bottom":"6px"}),t+=ts(".cesium-credit-lightbox > ul > li *",{padding:"0",margin:"0"}),t+=ts(".cesium-credit-expand-link",{"padding-left":"5px",cursor:"pointer","text-decoration":"underline",color:iy}),t+=ts(".cesium-credit-expand-link:hover",{color:Sv}),t+=ts(".cesium-credit-text",{color:iy}),t+=ts(".cesium-credit-textContainer *, .cesium-credit-logoContainer *",{display:"inline"});function n(r){if(r.shadowRoot)return r.shadowRoot;if(r.getRootNode){const s=r.getRootNode();if(s instanceof ShadowRoot)return s}}const i=y(n(e),document.head),o=document.createElement("style");o.innerHTML=t,i.appendChild(o)}function ki(e,t,n){A.defined("container",e);const i=this;n=y(n,document.body);const o=document.createElement("div");o.className="cesium-credit-lightbox-overlay",n.appendChild(o);const r=document.createElement("div");r.className="cesium-credit-lightbox",o.appendChild(r);function s(m){r.contains(m.target)||i.hideLightbox()}o.addEventListener("click",s,!1);const a=document.createElement("div");a.className="cesium-credit-lightbox-title",a.textContent="Data provided by:",r.appendChild(a);const l=document.createElement("a");l.onclick=this.hideLightbox.bind(this),l.innerHTML="×",l.className="cesium-credit-lightbox-close",r.appendChild(l);const u=document.createElement("ul");r.appendChild(u);const h=document.createElement("div");h.className="cesium-credit-logoContainer",h.style.display="inline",e.appendChild(h);const f=document.createElement("div");f.className="cesium-credit-textContainer",f.style.display="inline",e.appendChild(f);const _=document.createElement("a");_.className="cesium-credit-expand-link",_.onclick=this.showLightbox.bind(this),_.textContent="Data attribution",e.appendChild(_),I2e(e);const g=Wt.clone(ki.cesiumCredit);this._delimiter=y(t," \u2022 "),this._screenContainer=f,this._cesiumCreditContainer=h,this._lastViewportHeight=void 0,this._lastViewportWidth=void 0,this._lightboxCredits=r,this._creditList=u,this._lightbox=o,this._hideLightbox=s,this._expandLink=_,this._expanded=!1,this._staticCredits=[],this._cesiumCredit=g,this._previousCesiumCredit=void 0,this._currentCesiumCredit=g,this._creditDisplayElementPool=[],this._creditDisplayElementIndex=0,this._currentFrameCredits={screenCredits:new mt,lightboxCredits:new mt},this._defaultCredit=void 0,this.viewport=n,this.container=e}function vW(e,t,n,i){i=y(i,1);let o=t.get(n.id);if(c(o))o.count<Number.MAX_VALUE&&(o.count+=i);else{const r=e._creditDisplayElementPool,s=e._creditDisplayElementPoolIndex;s<r.length?(o=r[s],o.credit=n,o.count=i):(o=new wW(n,i),r.push(o)),++e._creditDisplayElementPoolIndex,t.set(n.id,o)}}ki.prototype.addCreditToNextFrame=function(e){if(A.defined("credit",e),e.isIon()){c(this._defaultCredit)||(this._defaultCredit=Wt.clone(IW())),this._currentCesiumCredit=this._defaultCredit;return}let t;e.showOnScreen?t=this._currentFrameCredits.screenCredits:t=this._currentFrameCredits.lightboxCredits,vW(this,t,e)};ki.prototype.addStaticCredit=function(e){A.defined("credit",e);const t=this._staticCredits;w2e(t,e)||t.push(e)};ki.prototype.removeStaticCredit=function(e){A.defined("credit",e);const t=this._staticCredits,n=t.indexOf(e);n!==-1&&t.splice(n,1)};ki.prototype.showLightbox=function(){this._lightbox.style.display="block",this._expanded=!0};ki.prototype.hideLightbox=function(){this._lightbox.style.display="none",this._expanded=!1};ki.prototype.update=function(){this._expanded&&v2e(this)};ki.prototype.beginFrame=function(){const e=this._currentFrameCredits;this._creditDisplayElementPoolIndex=0;const t=e.screenCredits,n=e.lightboxCredits;t.removeAll(),n.removeAll();const i=this._staticCredits;for(let o=0;o<i.length;++o){const r=i[o],s=r.showOnScreen?t:n;r.isIon()&&Wt.equals(ki.cesiumCredit,this._cesiumCredit)||vW(this,s,r,Number.MAX_VALUE)}Wt.equals(ki.cesiumCredit,this._cesiumCredit)||(this._cesiumCredit=Wt.clone(ki.cesiumCredit)),this._currentCesiumCredit=this._cesiumCredit};ki.prototype.endFrame=function(){const e=this._currentFrameCredits.screenCredits.values;C3(this._screenContainer,e,this._delimiter,void 0);const t=this._currentFrameCredits.lightboxCredits.values;this._expandLink.style.display=t.length>0?"inline":"none",C3(this._creditList,t,void 0,"li"),S2e(this)};ki.prototype.destroy=function(){return this._lightbox.removeEventListener("click",this._hideLightbox,!1),this.container.removeChild(this._cesiumCreditContainer),this.container.removeChild(this._screenContainer),this.container.removeChild(this._expandLink),this.viewport.removeChild(this._lightbox),ve(this)};ki.prototype.isDestroyed=function(){return!1};ki._cesiumCredit=void 0;ki._cesiumCreditInitialized=!1;let fA;function IW(){if(!c(fA)){let e=Zt("Assets/Images/ion-credit.png");e.indexOf("http://")!==0&&e.indexOf("https://")!==0&&e.indexOf("data:")!==0&&(e=new Ec(e).path()),fA=new Wt(`<a href="https://cesium.com/" target="_blank"><img src="${e}" title="Cesium ion"/></a>`,!0)}return ki._cesiumCreditInitialized||(ki._cesiumCredit=fA,ki._cesiumCreditInitialized=!0),fA}Object.defineProperties(ki,{cesiumCredit:{get:function(){return IW(),ki._cesiumCredit},set:function(e){ki._cesiumCredit=e,ki._cesiumCreditInitialized=!0}}});ki.CreditDisplayElement=wW;const iE=0,D2e=1;function qh(e){A.typeOf.object("options",e),A.typeOf.object("options.frustum",e.frustum),A.typeOf.object("options.origin",e.origin),A.typeOf.object("options.orientation",e.orientation);const t=e.frustum,n=e.orientation,i=e.origin,o=y(e.vertexFormat,Ee.DEFAULT),r=y(e._drawNearPlane,!0);let s,a;t instanceof _n?(s=iE,a=_n.packedLength):t instanceof It&&(s=D2e,a=It.packedLength),this._frustumType=s,this._frustum=t.clone(),this._origin=d.clone(i),this._orientation=_e.clone(n),this._drawNearPlane=r,this._vertexFormat=o,this._workerName="createFrustumGeometry",this.packedLength=2+a+d.packedLength+_e.packedLength+Ee.packedLength}qh.pack=function(e,t,n){A.typeOf.object("value",e),A.defined("array",t),n=y(n,0);const i=e._frustumType,o=e._frustum;return t[n++]=i,i===iE?(_n.pack(o,t,n),n+=_n.packedLength):(It.pack(o,t,n),n+=It.packedLength),d.pack(e._origin,t,n),n+=d.packedLength,_e.pack(e._orientation,t,n),n+=_e.packedLength,Ee.pack(e._vertexFormat,t,n),n+=Ee.packedLength,t[n]=e._drawNearPlane?1:0,t};const P2e=new _n,O2e=new It,L2e=new _e,R2e=new d,N2e=new Ee;qh.unpack=function(e,t,n){A.defined("array",e),t=y(t,0);const i=e[t++];let o;i===iE?(o=_n.unpack(e,t,P2e),t+=_n.packedLength):(o=It.unpack(e,t,O2e),t+=It.packedLength);const r=d.unpack(e,t,R2e);t+=d.packedLength;const s=_e.unpack(e,t,L2e);t+=_e.packedLength;const a=Ee.unpack(e,t,N2e);t+=Ee.packedLength;const l=e[t]===1;if(!c(n))return new qh({frustum:o,origin:r,orientation:s,vertexFormat:a,_drawNearPlane:l});const u=i===n._frustumType?n._frustum:void 0;return n._frustum=o.clone(u),n._frustumType=i,n._origin=d.clone(r,n._origin),n._orientation=_e.clone(s,n._orientation),n._vertexFormat=Ee.clone(a,n._vertexFormat),n._drawNearPlane=l,n};function Im(e,t,n,i,o,r,s,a){const l=e/3*2;for(let u=0;u<4;++u)c(t)&&(t[e]=r.x,t[e+1]=r.y,t[e+2]=r.z),c(n)&&(n[e]=s.x,n[e+1]=s.y,n[e+2]=s.z),c(i)&&(i[e]=a.x,i[e+1]=a.y,i[e+2]=a.z),e+=3;o[l]=0,o[l+1]=0,o[l+2]=1,o[l+3]=0,o[l+4]=1,o[l+5]=1,o[l+6]=0,o[l+7]=1}const M2e=new $,F2e=new L,vv=new L,DW=new d,PW=new d,OW=new d,B2e=new d,z2e=new d,U2e=new d,Qd=new Array(3),cb=new Array(4);cb[0]=new te(-1,-1,1,1);cb[1]=new te(1,-1,1,1);cb[2]=new te(1,1,1,1);cb[3]=new te(-1,1,1,1);const LW=new Array(4);for(let e=0;e<4;++e)LW[e]=new te;qh._computeNearFarPlanes=function(e,t,n,i,o,r,s,a){const l=$.fromQuaternion(t,M2e);let u=y(r,DW),h=y(s,PW),f=y(a,OW);u=$.getColumn(l,0,u),h=$.getColumn(l,1,h),f=$.getColumn(l,2,f),d.normalize(u,u),d.normalize(h,h),d.normalize(f,f),d.negate(u,u);const _=L.computeView(e,f,h,u,F2e);let g,m;const b=i.projectionMatrix;if(n===iE){const T=L.multiply(b,_,vv);m=L.inverse(T,vv)}else g=L.inverseTransformation(_,vv);c(m)?(Qd[0]=i.near,Qd[1]=i.far):(Qd[0]=0,Qd[1]=i.near,Qd[2]=i.far);for(let T=0;T<2;++T)for(let x=0;x<4;++x){let C=te.clone(cb[x],LW[x]);if(c(m)){C=L.multiplyByVector(m,C,C);const w=1/C.w;d.multiplyByScalar(C,w,C),d.subtract(C,e,C),d.normalize(C,C);const v=d.dot(f,C);d.multiplyByScalar(C,Qd[T]/v,C),d.add(C,e,C)}else{const w=i.offCenterFrustum;c(w)&&(i=w);const v=Qd[T],P=Qd[T+1];C.x=(C.x*(i.right-i.left)+i.left+i.right)*.5,C.y=(C.y*(i.top-i.bottom)+i.bottom+i.top)*.5,C.z=(C.z*(v-P)-v-P)*.5,C.w=1,L.multiplyByVector(g,C,C)}o[12*T+x*3]=C.x,o[12*T+x*3+1]=C.y,o[12*T+x*3+2]=C.z}};qh.createGeometry=function(e){const t=e._frustumType,n=e._frustum,i=e._origin,o=e._orientation,r=e._drawNearPlane,s=e._vertexFormat,a=r?6:5;let l=new Float64Array(3*4*6);qh._computeNearFarPlanes(i,o,t,n,l);let u=3*4*2;l[u]=l[3*4],l[u+1]=l[3*4+1],l[u+2]=l[3*4+2],l[u+3]=l[0],l[u+4]=l[1],l[u+5]=l[2],l[u+6]=l[3*3],l[u+7]=l[3*3+1],l[u+8]=l[3*3+2],l[u+9]=l[3*7],l[u+10]=l[3*7+1],l[u+11]=l[3*7+2],u+=3*4,l[u]=l[3*5],l[u+1]=l[3*5+1],l[u+2]=l[3*5+2],l[u+3]=l[3],l[u+4]=l[3+1],l[u+5]=l[3+2],l[u+6]=l[0],l[u+7]=l[1],l[u+8]=l[2],l[u+9]=l[3*4],l[u+10]=l[3*4+1],l[u+11]=l[3*4+2],u+=3*4,l[u]=l[3],l[u+1]=l[3+1],l[u+2]=l[3+2],l[u+3]=l[3*5],l[u+4]=l[3*5+1],l[u+5]=l[3*5+2],l[u+6]=l[3*6],l[u+7]=l[3*6+1],l[u+8]=l[3*6+2],l[u+9]=l[3*2],l[u+10]=l[3*2+1],l[u+11]=l[3*2+2],u+=3*4,l[u]=l[3*2],l[u+1]=l[3*2+1],l[u+2]=l[3*2+2],l[u+3]=l[3*6],l[u+4]=l[3*6+1],l[u+5]=l[3*6+2],l[u+6]=l[3*7],l[u+7]=l[3*7+1],l[u+8]=l[3*7+2],l[u+9]=l[3*3],l[u+10]=l[3*3+1],l[u+11]=l[3*3+2],r||(l=l.subarray(3*4));const h=new oi({position:new Ie({componentDatatype:Z.DOUBLE,componentsPerAttribute:3,values:l})});if(c(s.normal)||c(s.tangent)||c(s.bitangent)||c(s.st)){const _=c(s.normal)?new Float32Array(12*a):void 0,g=c(s.tangent)?new Float32Array(3*4*a):void 0,m=c(s.bitangent)?new Float32Array(3*4*a):void 0,b=c(s.st)?new Float32Array(2*4*a):void 0,T=DW,x=PW,C=OW,w=d.negate(T,B2e),v=d.negate(x,z2e),P=d.negate(C,U2e);u=0,r&&(Im(u,_,g,m,b,P,T,x),u+=3*4),Im(u,_,g,m,b,C,w,x),u+=3*4,Im(u,_,g,m,b,w,P,x),u+=3*4,Im(u,_,g,m,b,v,P,w),u+=3*4,Im(u,_,g,m,b,T,C,x),u+=3*4,Im(u,_,g,m,b,x,C,w),c(_)&&(h.normal=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:3,values:_})),c(g)&&(h.tangent=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:3,values:g})),c(m)&&(h.bitangent=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:3,values:m})),c(b)&&(h.st=new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:2,values:b}))}const f=new Uint16Array(6*a);for(let _=0;_<a;++_){const g=_*6,m=_*4;f[g]=m,f[g+1]=m+1,f[g+2]=m+2,f[g+3]=m,f[g+4]=m+2,f[g+5]=m+3}return new Tt({attributes:h,indices:f,primitiveType:ze.TRIANGLES,boundingSphere:se.fromVertices(l)})};const v1=0,k2e=1;function D0(e){A.typeOf.object("options",e),A.typeOf.object("options.frustum",e.frustum),A.typeOf.object("options.origin",e.origin),A.typeOf.object("options.orientation",e.orientation);const t=e.frustum,n=e.orientation,i=e.origin,o=y(e._drawNearPlane,!0);let r,s;t instanceof _n?(r=v1,s=_n.packedLength):t instanceof It&&(r=k2e,s=It.packedLength),this._frustumType=r,this._frustum=t.clone(),this._origin=d.clone(i),this._orientation=_e.clone(n),this._drawNearPlane=o,this._workerName="createFrustumOutlineGeometry",this.packedLength=2+s+d.packedLength+_e.packedLength}D0.pack=function(e,t,n){A.typeOf.object("value",e),A.defined("array",t),n=y(n,0);const i=e._frustumType,o=e._frustum;return t[n++]=i,i===v1?(_n.pack(o,t,n),n+=_n.packedLength):(It.pack(o,t,n),n+=It.packedLength),d.pack(e._origin,t,n),n+=d.packedLength,_e.pack(e._orientation,t,n),n+=_e.packedLength,t[n]=e._drawNearPlane?1:0,t};const V2e=new _n,H2e=new It,G2e=new _e,j2e=new d;D0.unpack=function(e,t,n){A.defined("array",e),t=y(t,0);const i=e[t++];let o;i===v1?(o=_n.unpack(e,t,V2e),t+=_n.packedLength):(o=It.unpack(e,t,H2e),t+=It.packedLength);const r=d.unpack(e,t,j2e);t+=d.packedLength;const s=_e.unpack(e,t,G2e);t+=_e.packedLength;const a=e[t]===1;if(!c(n))return new D0({frustum:o,origin:r,orientation:s,_drawNearPlane:a});const l=i===n._frustumType?n._frustum:void 0;return n._frustum=o.clone(l),n._frustumType=i,n._origin=d.clone(r,n._origin),n._orientation=_e.clone(s,n._orientation),n._drawNearPlane=a,n};D0.createGeometry=function(e){const t=e._frustumType,n=e._frustum,i=e._origin,o=e._orientation,r=e._drawNearPlane,s=new Float64Array(3*4*2);qh._computeNearFarPlanes(i,o,t,n,s);const a=new oi({position:new Ie({componentDatatype:Z.DOUBLE,componentsPerAttribute:3,values:s})});let l,u;const h=r?2:1,f=new Uint16Array(8*(h+1));let _=r?0:1;for(;_<2;++_)l=r?_*8:0,u=_*4,f[l]=u,f[l+1]=u+1,f[l+2]=u+1,f[l+3]=u+2,f[l+4]=u+2,f[l+5]=u+3,f[l+6]=u+3,f[l+7]=u;for(_=0;_<2;++_)l=(h+_)*8,u=_*4,f[l]=u,f[l+1]=u+4,f[l+2]=u+1,f[l+3]=u+5,f[l+4]=u+2,f[l+5]=u+6,f[l+6]=u+3,f[l+7]=u+7;return new Tt({attributes:a,indices:f,primitiveType:ze.LINES,boundingSphere:se.fromVertices(s)})};function ph(e){if(e=y(e,y.EMPTY_OBJECT),!c(e.camera))throw new E("options.camera is required.");this._camera=e.camera,this._frustumSplits=e.frustumSplits,this._color=y(e.color,z.CYAN),this._updateOnChange=y(e.updateOnChange,!0),this.show=y(e.show,!0),this.id=e.id,this._id=void 0,this._outlinePrimitives=[],this._planesPrimitives=[]}const W2e=new d,q2e=new $,Y2e=new _e,$2e=new _n,X2e=new xs,Q2e=new It,K2e=new Ki,Z2e=new z,J2e=[1,1e5];ph.prototype.update=function(e){if(!this.show)return;const t=this._planesPrimitives,n=this._outlinePrimitives;let i,o;if(this._updateOnChange){for(o=t.length,i=0;i<o;++i)n[i]=n[i]&&n[i].destroy(),t[i]=t[i]&&t[i].destroy();t.length=0,n.length=0}if(t.length===0){const r=this._camera,s=r.frustum;let a;s instanceof _n?a=$2e:s instanceof xs?a=X2e:s instanceof It?a=Q2e:a=K2e,a=s.clone(a);let l,u=this._frustumSplits;!c(u)||u.length<=1?(u=J2e,u[0]=this._camera.frustum.near,u[1]=this._camera.frustum.far,l=1):l=u.length-1;const h=r.positionWC,f=r.directionWC,_=r.upWC;let g=r.rightWC;g=d.negate(g,W2e);const m=q2e;$.setColumn(m,0,g,m),$.setColumn(m,1,_,m),$.setColumn(m,2,f,m);const b=_e.fromRotationMatrix(m,Y2e);for(t.length=n.length=l,i=0;i<l;++i)a.near=u[i],a.far=u[i+1],t[i]=new Mt({geometryInstances:new Gt({geometry:new qh({origin:h,orientation:b,frustum:a,_drawNearPlane:i===0}),attributes:{color:$t.fromColor(z.fromAlpha(this._color,.1,Z2e))},id:this.id,pickPrimitive:this}),appearance:new tn({translucent:!0,flat:!0}),asynchronous:!1}),n[i]=new Mt({geometryInstances:new Gt({geometry:new D0({origin:h,orientation:b,frustum:a,_drawNearPlane:i===0}),attributes:{color:$t.fromColor(this._color)},id:this.id,pickPrimitive:this}),appearance:new tn({translucent:!1,flat:!0}),asynchronous:!1})}for(o=t.length,i=0;i<o;++i)n[i].update(e),t[i].update(e)};ph.prototype.isDestroyed=function(){return!1};ph.prototype.destroy=function(){const e=this._planesPrimitives.length;for(let t=0;t<e;++t)this._outlinePrimitives[t]=this._outlinePrimitives[t]&&this._outlinePrimitives[t].destroy(),this._planesPrimitives[t]=this._planesPrimitives[t]&&this._planesPrimitives[t].destroy();return ve(this)};function lb(e){this._rs=void 0,this._sp=void 0,this._va=void 0,this._command=void 0,this._mode=void 0,this._useLogDepth=!1,this._ellipsoidOffset=y(e,0)}const oy=Yt.supportsTypedArrays()?new Float32Array(12):[],E3=new d,w3=new d,Iv=new d,S3=new d,pA=new d;function eBe(e,t){const n=e.radii,i=t.camera;let o,r,s;if(i.frustum instanceof It)o=d.ZERO,r=i.rightWC,s=i.upWC;else{const f=i.positionWC,_=d.multiplyComponents(e.oneOverRadii,f,E3),g=d.normalize(_,w3),m=d.normalize(d.cross(d.UNIT_Z,_,Iv),Iv),b=d.normalize(d.cross(g,m,S3),S3),T=d.magnitude(_),x=Math.sqrt(T*T-1);o=d.multiplyByScalar(g,1/T,E3);const C=x/T;r=d.multiplyByScalar(m,C,w3),s=d.multiplyByScalar(b,C,Iv)}const a=d.add(o,s,pA);d.subtract(a,r,a),d.multiplyComponents(n,a,a),d.pack(a,oy,0);const l=d.subtract(o,s,pA);d.subtract(l,r,l),d.multiplyComponents(n,l,l),d.pack(l,oy,3);const u=d.add(o,s,pA);d.add(u,r,u),d.multiplyComponents(n,u,u),d.pack(u,oy,6);const h=d.subtract(o,s,pA);return d.add(h,r,h),d.multiplyComponents(n,h,h),d.pack(h,oy,9),oy}lb.prototype.update=function(e){if(this._mode=e.mode,e.mode!==oe.SCENE3D)return;const t=e.context,n=e.mapProjection.ellipsoid.radii,i=new ae(n.x+this._ellipsoidOffset,n.y+this._ellipsoidOffset,n.z+this._ellipsoidOffset),o=e.useLogDepth;if(c(this._command)||(this._rs=Ue.fromCache({cull:{enabled:!0},depthTest:{enabled:!0},colorMask:{red:!1,green:!1,blue:!1,alpha:!1}}),this._command=new Ze({renderState:this._rs,boundingVolume:new se(d.ZERO,i.maximumRadius),pass:xe.OPAQUE,owner:this})),!c(this._sp)||this._useLogDepth!==o){this._useLogDepth=o;const s=new Oe({sources:[O1e]}),a=new Oe({sources:[P1e]});o&&(a.defines.push("LOG_DEPTH"),s.defines.push("LOG_DEPTH")),this._sp=Jt.replaceCache({shaderProgram:this._sp,context:t,vertexShaderSource:s,fragmentShaderSource:a,attributeLocations:{position:0}}),this._command.shaderProgram=this._sp}const r=eBe(i,e);if(c(this._va))this._va.getAttribute(0).vertexBuffer.copyFromArrayView(r);else{const s=new Tt({attributes:{position:new Ie({componentDatatype:Z.FLOAT,componentsPerAttribute:3,values:r})},indices:[0,1,2,2,1,3],primitiveType:ze.TRIANGLES});this._va=Ci.fromGeometry({context:t,geometry:s,attributeLocations:{position:0},bufferUsage:ke.DYNAMIC_DRAW}),this._command.vertexArray=this._va}};lb.prototype.execute=function(e,t){this._mode===oe.SCENE3D&&this._command.execute(e,t)};lb.prototype.isDestroyed=function(){return!1};lb.prototype.destroy=function(){this._sp=this._sp&&this._sp.destroy(),this._va=this._va&&this._va.destroy()};function sd(){}const tBe=/\bgl_FragDepth\b/,nBe=/\bdiscard\b/;function iBe(e,t){let n=e.shaderCache.getDerivedShaderProgram(t,"depthOnly");if(!c(n)){const i=t._attributeLocations;let o=t.fragmentShaderSource,r,s=!1;const a=o.sources;let l=a.length;for(r=0;r<l;++r)if(tBe.test(a[r])||nBe.test(a[r])){s=!0;break}let u=!1;const h=o.defines;for(l=h.length,r=0;r<l;++r)if(h[r]==="LOG_DEPTH"){u=!0;break}let f;!s&&!u?(f=`void main()
|
|
{
|
|
out_FragColor = vec4(1.0);
|
|
}
|
|
`,o=new Oe({sources:[f]})):!s&&u&&(f=`void main()
|
|
{
|
|
out_FragColor = vec4(1.0);
|
|
czm_writeLogDepth();
|
|
}
|
|
`,o=new Oe({defines:["LOG_DEPTH"],sources:[f]})),n=e.shaderCache.createDerivedShaderProgram(t,"depthOnly",{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:o,attributeLocations:i})}return n}function oBe(e,t){const n=e._depthOnlyRenderStateCache;let i=n[t.id];if(!c(i)){const o=Ue.getState(t);o.depthMask=!0,o.colorMask={red:!1,green:!1,blue:!1,alpha:!1},i=Ue.fromCache(o),n[t.id]=i}return i}sd.createDepthOnlyDerivedCommand=function(e,t,n,i){c(i)||(i={});let o,r;return c(i.depthOnlyCommand)&&(o=i.depthOnlyCommand.shaderProgram,r=i.depthOnlyCommand.renderState),i.depthOnlyCommand=Ze.shallowClone(t,i.depthOnlyCommand),!c(o)||i.shaderProgramId!==t.shaderProgram.id?(i.depthOnlyCommand.shaderProgram=iBe(n,t.shaderProgram),i.depthOnlyCommand.renderState=oBe(e,t.renderState),i.shaderProgramId=t.shaderProgram.id):(i.depthOnlyCommand.shaderProgram=o,i.depthOnlyCommand.renderState=r),i};const rBe=/\s+czm_writeLogDepth\(/,sBe=/\s+czm_vertexLogDepth\(/;function aBe(e,t){if(t.fragmentShaderSource.defines.indexOf("LOG_DEPTH_READ_ONLY")>=0)return t;let i=e.shaderCache.getDerivedShaderProgram(t,"logDepth");if(!c(i)){const o=t._attributeLocations,r=t.vertexShaderSource.clone(),s=t.fragmentShaderSource.clone();r.defines=c(r.defines)?r.defines.slice(0):[],r.defines.push("LOG_DEPTH"),s.defines=c(s.defines)?s.defines.slice(0):[],s.defines.push("LOG_DEPTH");let a,l,u=!1,h=r.sources,f=h.length;for(a=0;a<f;++a)if(sBe.test(h[a])){u=!0;break}if(!u){for(a=0;a<f;++a)h[a]=Oe.replaceMain(h[a],"czm_log_depth_main");l=`
|
|
|
|
void main()
|
|
{
|
|
czm_log_depth_main();
|
|
czm_vertexLogDepth();
|
|
}
|
|
`,h.push(l)}for(h=s.sources,f=h.length,u=!1,a=0;a<f;++a)rBe.test(h[a])&&(u=!0);s.defines.indexOf("LOG_DEPTH_WRITE")!==-1&&(u=!0);let _="";if(!u){for(a=0;a<f;a++)h[a]=Oe.replaceMain(h[a],"czm_log_depth_main");_+=`
|
|
void main()
|
|
{
|
|
czm_log_depth_main();
|
|
czm_writeLogDepth();
|
|
}
|
|
`}h.push(_),i=e.shaderCache.createDerivedShaderProgram(t,"logDepth",{vertexShaderSource:r,fragmentShaderSource:s,attributeLocations:o})}return i}sd.createLogDepthCommand=function(e,t,n){c(n)||(n={});let i;return c(n.command)&&(i=n.command.shaderProgram),n.command=Ze.shallowClone(e,n.command),!c(i)||n.shaderProgramId!==e.shaderProgram.id?(n.command.shaderProgram=aBe(t,e.shaderProgram),n.shaderProgramId=e.shaderProgram.id):n.command.shaderProgram=i,n};function cBe(e,t,n){let i=e.shaderCache.getDerivedShaderProgram(t,"pick");if(!c(i)){const o=t._attributeLocations;let r=t.fragmentShaderSource;const s=r.sources,a=s.length,u=s.some(_=>_.includes("out_FragData"))?"out_FragData_0":"out_FragColor",h=`void main ()
|
|
{
|
|
czm_non_pick_main();
|
|
if (${u}.a == 0.0) {
|
|
discard;
|
|
}
|
|
${u} = ${n};
|
|
} `,f=new Array(a+1);for(let _=0;_<a;++_)f[_]=Oe.replaceMain(s[_],"czm_non_pick_main");f[a]=h,r=new Oe({sources:f,defines:r.defines}),i=e.shaderCache.createDerivedShaderProgram(t,"pick",{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:r,attributeLocations:o})}return i}function lBe(e,t){const n=e.picking.pickRenderStateCache;let i=n[t.id];if(!c(i)){const o=Ue.getState(t);o.blending.enabled=!1,o.depthMask=!0,i=Ue.fromCache(o),n[t.id]=i}return i}sd.createPickDerivedCommand=function(e,t,n,i){c(i)||(i={});let o,r;return c(i.pickCommand)&&(o=i.pickCommand.shaderProgram,r=i.pickCommand.renderState),i.pickCommand=Ze.shallowClone(t,i.pickCommand),!c(o)||i.shaderProgramId!==t.shaderProgram.id?(i.pickCommand.shaderProgram=cBe(n,t.shaderProgram,t.pickId),i.pickCommand.renderState=lBe(e,t.renderState),i.shaderProgramId=t.shaderProgram.id):(i.pickCommand.shaderProgram=o,i.pickCommand.renderState=r),i};function uBe(e,t){let n=e.shaderCache.getDerivedShaderProgram(t,"HDR");if(!c(n)){const i=t._attributeLocations,o=t.vertexShaderSource.clone(),r=t.fragmentShaderSource.clone();o.defines=c(o.defines)?o.defines.slice(0):[],o.defines.push("HDR"),r.defines=c(r.defines)?r.defines.slice(0):[],r.defines.push("HDR"),n=e.shaderCache.createDerivedShaderProgram(t,"HDR",{vertexShaderSource:o,fragmentShaderSource:r,attributeLocations:i})}return n}sd.createHdrCommand=function(e,t,n){c(n)||(n={});let i;return c(n.command)&&(i=n.command.shaderProgram),n.command=Ze.shallowClone(e,n.command),!c(i)||n.shaderProgramId!==e.shaderProgram.id?(n.command.shaderProgram=uBe(t,e.shaderProgram),n.shaderProgramId=e.shaderProgram.id):n.command.shaderProgram=i,n};function oE(e){if(!c(e))throw new E("scene is required.");this._scene=e,this._lastAlpha=void 0,this._lastBeta=void 0,this._lastGamma=void 0,this._alpha=void 0,this._beta=void 0,this._gamma=void 0;const t=this;function n(i){const o=i.alpha;if(!c(o)){t._alpha=void 0,t._beta=void 0,t._gamma=void 0;return}t._alpha=R.toRadians(o),t._beta=R.toRadians(i.beta),t._gamma=R.toRadians(i.gamma)}window.addEventListener("deviceorientation",n,!1),this._removeListener=function(){window.removeEventListener("deviceorientation",n,!1)}}const dBe=new _e,v3=new _e,hBe=new $;function fBe(e,t,n,i){const o=e.direction,r=e.right,s=e.up,a=_e.fromAxisAngle(o,n,v3),l=_e.fromAxisAngle(r,i,dBe),u=_e.multiply(l,a,l),h=_e.fromAxisAngle(s,t,v3);_e.multiply(h,u,u);const f=$.fromQuaternion(u,hBe);$.multiplyByVector(f,r,r),$.multiplyByVector(f,s,s),$.multiplyByVector(f,o,o)}oE.prototype.update=function(){if(!c(this._alpha))return;c(this._lastAlpha)||(this._lastAlpha=this._alpha,this._lastBeta=this._beta,this._lastGamma=this._gamma);const e=this._lastAlpha-this._alpha,t=this._lastBeta-this._beta,n=this._lastGamma-this._gamma;fBe(this._scene.camera,-e,t,n),this._lastAlpha=this._alpha,this._lastBeta=this._beta,this._lastGamma=this._gamma};oE.prototype.isDestroyed=function(){return!1};oE.prototype.destroy=function(){return this._removeListener(),ve(this)};function RW(){this.enabled=!0,this.renderable=!0,this.density=2e-4,this.screenSpaceErrorFactor=2,this.minimumBrightness=.03}const ax=[359.393,800.749,1275.6501,2151.1192,3141.7763,4777.5198,6281.2493,12364.307,15900.765,49889.0549,78026.8259,99260.7344,120036.3873,151011.0158,156091.1953,203849.3112,274866.9803,319916.3149,493552.0528,628733.5874],nu=[2e-5,2e-4,1e-4,7e-5,5e-5,4e-5,3e-5,19e-6,1e-5,85e-7,62e-7,58e-7,53e-7,52e-7,51e-7,42e-7,4e-6,34e-7,26e-7,22e-7];for(let e=0;e<nu.length;++e)nu[e]*=1e6;const NW=nu[1],WD=nu[nu.length-1];for(let e=0;e<nu.length;++e)nu[e]=(nu[e]-WD)/(NW-WD);let _r=0;function pBe(e){const t=ax,n=t.length;if(e<t[0])return _r=0,_r;if(e>t[n-1])return _r=n-2,_r;if(e>=t[_r]){if(_r+1<n&&e<t[_r+1])return _r;if(_r+2<n&&e<t[_r+2])return++_r,_r}else if(_r-1>=0&&e>=t[_r-1])return--_r,_r;let i;for(i=0;i<n-2&&!(e>=t[i]&&e<t[i+1]);++i);return _r=i,_r}const mBe=new d;RW.prototype.update=function(e){if(!(e.fog.enabled=this.enabled))return;e.fog.renderable=this.renderable;const n=e.camera,i=n.positionCartographic;if(!c(i)||i.height>8e5||e.mode!==oe.SCENE3D){e.fog.enabled=!1,e.fog.density=0;return}const o=i.height,r=pBe(o),s=R.clamp((o-ax[r])/(ax[r+1]-ax[r]),0,1);let a=R.lerp(nu[r],nu[r+1],s);const l=this.density*1e6,u=l/NW*WD;a=a*(l-u)*1e-6;const h=d.normalize(n.positionWC,mBe),f=Math.abs(d.dot(n.directionWC,h));a*=1-f,e.fog.density=a,e.fog.sse=this.screenSpaceErrorFactor,e.fog.minimumBrightness=this.minimumBrightness};function _Be(e,t,n){this.context=e,this.commandList=[],this.shadowMaps=[],this.brdfLutGenerator=void 0,this.environmentMap=void 0,this.sphericalHarmonicCoefficients=void 0,this.specularEnvironmentMaps=void 0,this.specularEnvironmentMapsMaximumLOD=void 0,this.mode=oe.SCENE3D,this.morphTime=oe.getMorphTime(oe.SCENE3D),this.frameNumber=0,this.newFrame=!1,this.time=void 0,this.jobScheduler=n,this.mapProjection=void 0,this.camera=void 0,this.cameraUnderground=!1,this.globeTranslucencyState=void 0,this.cullingVolume=void 0,this.occluder=void 0,this.maximumScreenSpaceError=void 0,this.pixelRatio=1,this.passes={render:!1,pick:!1,pickVoxel:!1,depth:!1,postProcess:!1,offscreen:!1},this.creditDisplay=t,this.afterRender=[],this.scene3DOnly=!1,this.fog={enabled:!1,renderable:!1,density:void 0,sse:void 0,minimumBrightness:void 0},this.atmosphere=void 0,this.verticalExaggeration=1,this.verticalExaggerationRelativeHeight=0,this.shadowState={shadowsEnabled:!0,shadowMaps:[],lightShadowMaps:[],nearPlane:1,farPlane:5e3,closestObjectSize:1e3,lastDirtyTime:0,outOfView:!0},this.splitPosition=0,this.frustumSplits=[],this.backgroundColor=void 0,this.light=void 0,this.minimumDisableDepthTestDistance=void 0,this.invertClassification=!1,this.invertClassificationColor=void 0,this.useLogDepth=!1,this.tilesetPassState=void 0,this.minimumTerrainHeight=0}const br={OPAQUE_FRONT_FACE:0,OPAQUE_BACK_FACE:1,DEPTH_ONLY_FRONT_FACE:2,DEPTH_ONLY_BACK_FACE:3,DEPTH_ONLY_FRONT_AND_BACK_FACE:4,TRANSLUCENT_FRONT_FACE:5,TRANSLUCENT_BACK_FACE:6,TRANSLUCENT_FRONT_FACE_MANUAL_DEPTH_TEST:7,TRANSLUCENT_BACK_FACE_MANUAL_DEPTH_TEST:8,PICK_FRONT_FACE:9,PICK_BACK_FACE:10,DERIVED_COMMANDS_MAXIMUM_LENGTH:11},Yf=br.DERIVED_COMMANDS_MAXIMUM_LENGTH,MW=["opaqueFrontFaceCommand","opaqueBackFaceCommand","depthOnlyFrontFaceCommand","depthOnlyBackFaceCommand","depthOnlyFrontAndBackFaceCommand","translucentFrontFaceCommand","translucentBackFaceCommand","translucentFrontFaceManualDepthTestCommand","translucentBackFaceManualDepthTestCommand","pickFrontFaceCommand","pickBackFaceCommand"];function Wp(){this._frontFaceAlphaByDistance=new vt(0,1,0,1),this._backFaceAlphaByDistance=new vt(0,1,0,1),this._frontFaceTranslucent=!1,this._backFaceTranslucent=!1,this._requiresManualDepthTest=!1,this._sunVisibleThroughGlobe=!1,this._environmentVisible=!1,this._useDepthPlane=!1,this._numberOfTextureUniforms=0,this._globeTranslucencyFramebuffer=void 0,this._rectangle=ce.clone(ce.MAX_VALUE),this._derivedCommandKey=0,this._derivedCommandsDirty=!1,this._derivedCommandPacks=void 0,this._derivedCommandTypes=new Array(Yf),this._derivedBlendCommandTypes=new Array(Yf),this._derivedPickCommandTypes=new Array(Yf),this._derivedCommandTypesToUpdate=new Array(Yf),this._derivedCommandsLength=0,this._derivedBlendCommandsLength=0,this._derivedPickCommandsLength=0,this._derivedCommandsToUpdateLength=0}Object.defineProperties(Wp.prototype,{frontFaceAlphaByDistance:{get:function(){return this._frontFaceAlphaByDistance}},backFaceAlphaByDistance:{get:function(){return this._backFaceAlphaByDistance}},translucent:{get:function(){return this._frontFaceTranslucent}},sunVisibleThroughGlobe:{get:function(){return this._sunVisibleThroughGlobe}},environmentVisible:{get:function(){return this._environmentVisible}},useDepthPlane:{get:function(){return this._useDepthPlane}},numberOfTextureUniforms:{get:function(){return this._numberOfTextureUniforms}},rectangle:{get:function(){return this._rectangle}}});Wp.prototype.update=function(e){const t=e.globe;if(!c(t)||!t.show){this._frontFaceTranslucent=!1,this._backFaceTranslucent=!1,this._sunVisibleThroughGlobe=!0,this._environmentVisible=!0,this._useDepthPlane=!1;return}this._frontFaceAlphaByDistance=I3(t.translucency.enabled,t.translucency.frontFaceAlpha,t.translucency.frontFaceAlphaByDistance,this._frontFaceAlphaByDistance),this._backFaceAlphaByDistance=I3(t.translucency.enabled,t.translucency.backFaceAlpha,t.translucency.backFaceAlphaByDistance,this._backFaceAlphaByDistance),this._frontFaceTranslucent=D3(t.translucency.enabled,this._frontFaceAlphaByDistance,t),this._backFaceTranslucent=D3(t.translucency.enabled,this._backFaceAlphaByDistance,t),this._requiresManualDepthTest=TBe(this,e,t),this._sunVisibleThroughGlobe=gBe(this,e),this._environmentVisible=yBe(this,e),this._useDepthPlane=bBe(this,e),this._numberOfTextureUniforms=ABe(this),this._rectangle=ce.clone(t.translucency.rectangle,this._rectangle),xBe(this,e)};function I3(e,t,n,i){return e?c(n)?(vt.clone(n,i),i.nearValue*=t,i.farValue*=t,i):(i.nearValue=t,i.farValue=t,i):(i.nearValue=1,i.farValue=1,i)}function D3(e,t,n){return e&&(n.baseColor.alpha<1||t.nearValue<1||t.farValue<1)}function gBe(e,t){const n=e._frontFaceTranslucent,i=e._backFaceTranslucent;return n&&(t.cameraUnderground||i)}function yBe(e,t){return!t.cameraUnderground||e._frontFaceTranslucent}function bBe(e,t){return!t.cameraUnderground&&!e._frontFaceTranslucent}function TBe(e,t,n){return e._frontFaceTranslucent&&!e._backFaceTranslucent&&!n.depthTestAgainstTerrain&&t.mode!==oe.SCENE2D&&t.context.depthTexture}function ABe(e){let t=0;return e._frontFaceTranslucent&&++t,e._requiresManualDepthTest&&++t,t}function xBe(e,t){e._derivedCommandsLength=Dv(e,t,!1,!1,e._derivedCommandTypes),e._derivedBlendCommandsLength=Dv(e,t,!0,!1,e._derivedBlendCommandTypes),e._derivedPickCommandsLength=Dv(e,t,!1,!0,e._derivedPickCommandTypes);let n,i=0;for(n=0;n<e._derivedCommandsLength;++n)i|=1<<e._derivedCommandTypes[n];for(n=0;n<e._derivedBlendCommandsLength;++n)i|=1<<e._derivedBlendCommandTypes[n];for(n=0;n<e._derivedPickCommandsLength;++n)i|=1<<e._derivedPickCommandTypes[n];let o=0;for(n=0;n<Yf;++n)(i&1<<n)>0&&(e._derivedCommandTypesToUpdate[o++]=n);e._derivedCommandsToUpdateLength=o;const r=i!==e._derivedCommandKey;e._derivedCommandKey=i,e._derivedCommandsDirty=r,!c(e._derivedCommandPacks)&&e._frontFaceTranslucent&&(e._derivedCommandPacks=BBe())}function Dv(e,t,n,i,o){let r=0;const s=e._frontFaceTranslucent,a=e._backFaceTranslucent;if(!s)return r;const l=t.cameraUnderground,u=e._requiresManualDepthTest,h=i?br.PICK_FRONT_FACE:u?br.TRANSLUCENT_FRONT_FACE_MANUAL_DEPTH_TEST:br.TRANSLUCENT_FRONT_FACE,f=i?br.PICK_BACK_FACE:u?br.TRANSLUCENT_BACK_FACE_MANUAL_DEPTH_TEST:br.TRANSLUCENT_BACK_FACE;return t.mode===oe.SCENE2D?(o[r++]=br.DEPTH_ONLY_FRONT_FACE,o[r++]=h,r):(a?(n||(o[r++]=br.DEPTH_ONLY_FRONT_AND_BACK_FACE),l?(o[r++]=h,o[r++]=f):(o[r++]=f,o[r++]=h)):l?(n||(o[r++]=br.DEPTH_ONLY_BACK_FACE),o[r++]=br.OPAQUE_FRONT_FACE,o[r++]=f):(n||(o[r++]=br.DEPTH_ONLY_FRONT_FACE),o[r++]=br.OPAQUE_BACK_FACE,o[r++]=h),r)}function hc(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}function P3(e,t){return e.indexOf(t)>-1}function CBe(e,t){hc(e.defines,"TRANSLUCENT"),hc(t.defines,"TRANSLUCENT")}function EBe(e,t){hc(e.defines,"GROUND_ATMOSPHERE"),hc(t.defines,"GROUND_ATMOSPHERE"),hc(e.defines,"FOG"),hc(t.defines,"FOG"),hc(e.defines,"TRANSLUCENT"),hc(t.defines,"TRANSLUCENT")}function Pv(e,t){if(P3(t.defines,"TILE_LIMIT_RECTANGLE")||P3(t.defines,"ENABLE_CLIPPING_PLANES"))return;const n=`void main()
|
|
{
|
|
out_FragColor = vec4(1.0);
|
|
}
|
|
`;t.sources=[n]}function I1(e,t){const n=t.sources,i=n.length;for(let r=0;r<i;++r)n[r]=Oe.replaceMain(n[r],"czm_globe_translucency_main");const o=`
|
|
|
|
uniform sampler2D u_classificationTexture;
|
|
void main()
|
|
{
|
|
vec2 st = gl_FragCoord.xy / czm_viewport.zw;
|
|
#ifdef MANUAL_DEPTH_TEST
|
|
float logDepthOrDepth = czm_unpackDepth(texture(czm_globeDepthTexture, st));
|
|
if (logDepthOrDepth != 0.0)
|
|
{
|
|
vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth);
|
|
float depthEC = eyeCoordinate.z / eyeCoordinate.w;
|
|
if (v_positionEC.z < depthEC)
|
|
{
|
|
discard;
|
|
}
|
|
}
|
|
#endif
|
|
czm_globe_translucency_main();
|
|
vec4 classificationColor = texture(u_classificationTexture, st);
|
|
if (classificationColor.a > 0.0)
|
|
{
|
|
// Reverse premultiplication process to get the correct composited result of the classification primitives
|
|
classificationColor.rgb /= classificationColor.a;
|
|
}
|
|
out_FragColor = classificationColor * vec4(classificationColor.aaa, 1.0) + out_FragColor * (1.0 - classificationColor.a);
|
|
}
|
|
`;n.push(o)}function FW(e,t){I1(e,t),hc(e.defines,"GROUND_ATMOSPHERE"),hc(t.defines,"GROUND_ATMOSPHERE"),hc(e.defines,"FOG"),hc(t.defines,"FOG")}function wBe(e,t){I1(e,t),e.defines.push("GENERATE_POSITION"),t.defines.push("MANUAL_DEPTH_TEST")}function SBe(e,t){FW(e,t),e.defines.push("GENERATE_POSITION"),t.defines.push("MANUAL_DEPTH_TEST")}function O3(e,t){const n=`uniform sampler2D u_classificationTexture;
|
|
void main()
|
|
{
|
|
vec2 st = gl_FragCoord.xy / czm_viewport.zw;
|
|
vec4 pickColor = texture(u_classificationTexture, st);
|
|
if (pickColor == vec4(0.0))
|
|
{
|
|
discard;
|
|
}
|
|
out_FragColor = pickColor;
|
|
}
|
|
`;t.sources=[n]}function vBe(e,t,n,i,o,r){if(!c(o))return t;if(!i&&c(n))return n;let s=e.shaderCache.getDerivedShaderProgram(t,r);if(!c(s)){const a=t._attributeLocations,l=t.vertexShaderSource.clone(),u=t.fragmentShaderSource.clone();l.defines=c(l.defines)?l.defines.slice(0):[],u.defines=c(u.defines)?u.defines.slice(0):[],o(l,u),s=e.shaderCache.createDerivedShaderProgram(t,r,{vertexShaderSource:l,fragmentShaderSource:u,attributeLocations:a})}return s}function IBe(e){e.cull.face=Qi.BACK,e.cull.enabled=!0}function DBe(e){e.cull.face=Qi.FRONT,e.cull.enabled=!0}function PBe(e){e.cull.face=Qi.BACK,e.cull.enabled=!0,e.colorMask={red:!1,green:!1,blue:!1,alpha:!1}}function OBe(e){e.cull.face=Qi.FRONT,e.cull.enabled=!0,e.colorMask={red:!1,green:!1,blue:!1,alpha:!1}}function LBe(e){e.cull.enabled=!1,e.colorMask={red:!1,green:!1,blue:!1,alpha:!1}}function L3(e){e.cull.face=Qi.BACK,e.cull.enabled=!0,e.depthMask=!1,e.blending=Zn.ALPHA_BLEND}function R3(e){e.cull.face=Qi.FRONT,e.cull.enabled=!0,e.depthMask=!1,e.blending=Zn.ALPHA_BLEND}function RBe(e){e.cull.face=Qi.BACK,e.cull.enabled=!0,e.blending.enabled=!1}function NBe(e){e.cull.face=Qi.FRONT,e.cull.enabled=!0,e.blending.enabled=!1}function MBe(e,t,n,i,o){if(!c(i))return e;if(!n&&c(t))return t;let r=o[e.id];if(!c(r)){const s=Ue.getState(e);i(s),r=Ue.fromCache(s),o[e.id]=r}return r}function Dm(e){return{u_classificationTexture:function(){return e._globeTranslucencyFramebuffer.classificationTexture}}}function FBe(e,t,n,i,o){return c(o)?!i&&c(n)?n:jt(t,o(e),!1):t}function Kc(e){this.pass=e.pass,this.pickOnly=e.pickOnly,this.getShaderProgramFunction=e.getShaderProgramFunction,this.getRenderStateFunction=e.getRenderStateFunction,this.getUniformMapFunction=e.getUniformMapFunction,this.renderStateCache={}}function BBe(){return[new Kc({pass:xe.GLOBE,pickOnly:!1,getShaderProgramFunction:CBe,getRenderStateFunction:IBe,getUniformMapFunction:void 0}),new Kc({pass:xe.GLOBE,pickOnly:!1,getShaderProgramFunction:EBe,getRenderStateFunction:DBe,getUniformMapFunction:void 0}),new Kc({pass:xe.GLOBE,pickOnly:!1,getShaderProgramFunction:Pv,getRenderStateFunction:PBe,getUniformMapFunction:void 0}),new Kc({pass:xe.GLOBE,pickOnly:!1,getShaderProgramFunction:Pv,getRenderStateFunction:OBe,getUniformMapFunction:void 0}),new Kc({pass:xe.GLOBE,pickOnly:!1,getShaderProgramFunction:Pv,getRenderStateFunction:LBe,getUniformMapFunction:void 0}),new Kc({pass:xe.TRANSLUCENT,pickOnly:!1,getShaderProgramFunction:I1,getRenderStateFunction:L3,getUniformMapFunction:Dm}),new Kc({pass:xe.TRANSLUCENT,pickOnly:!1,getShaderProgramFunction:FW,getRenderStateFunction:R3,getUniformMapFunction:Dm}),new Kc({pass:xe.TRANSLUCENT,pickOnly:!1,getShaderProgramFunction:wBe,getRenderStateFunction:L3,getUniformMapFunction:Dm}),new Kc({pass:xe.TRANSLUCENT,pickOnly:!1,getShaderProgramFunction:SBe,getRenderStateFunction:R3,getUniformMapFunction:Dm}),new Kc({pass:xe.TRANSLUCENT,pickOnly:!0,getShaderProgramFunction:O3,getRenderStateFunction:RBe,getUniformMapFunction:Dm}),new Kc({pass:xe.TRANSLUCENT,pickOnly:!0,getShaderProgramFunction:O3,getRenderStateFunction:NBe,getUniformMapFunction:Dm})]}const N3=new Array(Yf),M3=new Array(Yf);Wp.prototype.updateDerivedCommands=function(e,t){const n=this._derivedCommandTypesToUpdate,i=this._derivedCommandsToUpdateLength;if(i!==0){for(let o=0;o<i;++o)M3[o]=this._derivedCommandPacks[n[o]],N3[o]=MW[n[o]];zBe(this,e,i,n,N3,M3,t)}};function zBe(e,t,n,i,o,r,s){let a=t.derivedCommands.globeTranslucency;const l=e._derivedCommandsDirty;if(t.dirty||!c(a)||l){t.dirty=!1,c(a)||(a={},t.derivedCommands.globeTranslucency=a);const u=s.frameNumber,h=y(a.uniformMapDirtyFrame,0),f=y(a.shaderProgramDirtyFrame,0),_=y(a.renderStateDirtyFrame,0),g=a.uniformMap!==t.uniformMap,m=a.shaderProgramId!==t.shaderProgram.id,b=a.renderStateId!==t.renderState.id;g&&(a.uniformMapDirtyFrame=u),m&&(a.shaderProgramDirtyFrame=u),b&&(a.renderStateDirtyFrame=u),a.uniformMap=t.uniformMap,a.shaderProgramId=t.shaderProgram.id,a.renderStateId=t.renderState.id;for(let T=0;T<n;++T){const x=r[T],C=i[T],w=o[T];let v=a[w],P,N,k;c(v)?(P=v.uniformMap,N=v.shaderProgram,k=v.renderState):(P=void 0,N=void 0,k=void 0),v=Ze.shallowClone(t,v),a[w]=v;const M=y(v.derivedCommands.uniformMapDirtyFrame,0),U=y(v.derivedCommands.shaderProgramDirtyFrame,0),B=y(v.derivedCommands.renderStateDirtyFrame,0),S=g||M<h,D=m||U<f,p=b||B<_;S&&(v.derivedCommands.uniformMapDirtyFrame=u),D&&(v.derivedCommands.shaderProgramDirtyFrame=u),p&&(v.derivedCommands.renderStateDirtyFrame=u),v.derivedCommands.type=C,v.pass=x.pass,v.pickOnly=x.pickOnly,v.uniformMap=FBe(e,t.uniformMap,P,S,x.getUniformMapFunction),v.shaderProgram=vBe(s.context,t.shaderProgram,N,D,x.getShaderProgramFunction,w),v.renderState=MBe(t.renderState,k,p,x.getRenderStateFunction,x.renderStateCache)}}}Wp.prototype.pushDerivedCommands=function(e,t,n){const i=n.passes.pick||n.passes.pickVoxel;if(i&&t)return;let o=this._derivedCommandTypes,r=this._derivedCommandsLength;if(i?(o=this._derivedPickCommandTypes,r=this._derivedPickCommandsLength):t&&(o=this._derivedBlendCommandTypes,r=this._derivedBlendCommandsLength),r===0){n.commandList.push(e);return}const s=e.derivedCommands.globeTranslucency;for(let a=0;a<r;++a){const l=MW[o[a]];n.commandList.push(s[l])}};function BW(e,t,n,i,o,r,s){for(let a=0;a<t;++a){const l=e[a],u=l.derivedCommands.type;(!c(s)||s.indexOf(u)>-1)&&n(l,i,o,r)}}function F3(e,t,n,i,o,r){for(let s=0;s<t;++s)n(e[s],i,o,r)}const UBe=[br.OPAQUE_FRONT_FACE,br.OPAQUE_BACK_FACE],kBe=[br.DEPTH_ONLY_FRONT_FACE,br.DEPTH_ONLY_BACK_FACE,br.DEPTH_ONLY_FRONT_AND_BACK_FACE];Wp.prototype.executeGlobeCommands=function(e,t,n,i,o){const r=i.context,s=e.commands[xe.GLOBE],a=e.indices[xe.GLOBE];a!==0&&(this._globeTranslucencyFramebuffer=n,n.clearClassification(r,o),BW(s,a,t,i,r,o,UBe))};Wp.prototype.executeGlobeClassificationCommands=function(e,t,n,i,o){const r=i.context,s=e.commands[xe.GLOBE],a=e.indices[xe.GLOBE],l=e.commands[xe.TERRAIN_CLASSIFICATION],u=e.indices[xe.TERRAIN_CLASSIFICATION];if(a===0||u===0)return;const h=this._frontFaceTranslucent,f=this._backFaceTranslucent;if((!h||!f)&&F3(l,u,t,i,r,o),!h&&!f)return;this._globeTranslucencyFramebuffer=n;const _=r.uniformState.globeDepthTexture,g=o.framebuffer;if(o.framebuffer=n.classificationFramebuffer,BW(s,a,t,i,r,o,kBe),r.depthTexture){const m=n.packDepth(r,o);r.uniformState.globeDepthTexture=m}F3(l,u,t,i,r,o),r.uniformState.globeDepthTexture=_,o.framebuffer=g};const Ep=`uniform sampler2D colorTexture;
|
|
|
|
in vec2 v_textureCoordinates;
|
|
|
|
void main()
|
|
{
|
|
out_FragColor = texture(colorTexture, v_textureCoordinates);
|
|
}
|
|
`;function kl(){this._numSamples=1,this.previousFramebuffer=void 0,this._previousFramebuffer=void 0,this._depthStencilTexture=void 0,this._depthStencilRenderbuffer=void 0,this._fbo=new on({depthStencil:!0,createDepthAttachments:!1}),this._fboClassified=new on({depthStencil:!0,createDepthAttachments:!1}),this._rsUnclassified=void 0,this._rsClassified=void 0,this._unclassifiedCommand=void 0,this._classifiedCommand=void 0,this._translucentCommand=void 0,this._clearColorCommand=new bi({color:new z(0,0,0,0),owner:this}),this._clearCommand=new bi({color:new z(0,0,0,0),depth:1,stencil:0});const e=this;this._uniformMap={colorTexture:function(){return e._fbo.getColorTexture()},depthTexture:function(){return e._depthStencilTexture},classifiedTexture:function(){return e._fboClassified.getColorTexture()}}}Object.defineProperties(kl.prototype,{unclassifiedCommand:{get:function(){return this._unclassifiedCommand}}});kl.isTranslucencySupported=function(e){return e.depthTexture&&e.fragmentDepth};const VBe={depthMask:!1,stencilTest:{enabled:!0,frontFunction:Pn.EQUAL,frontOperation:{fail:nt.KEEP,zFail:nt.KEEP,zPass:nt.KEEP},backFunction:Pn.NEVER,reference:0,mask:At.CLASSIFICATION_MASK},blending:Zn.ALPHA_BLEND},HBe={depthMask:!1,stencilTest:{enabled:!0,frontFunction:Pn.NOT_EQUAL,frontOperation:{fail:nt.KEEP,zFail:nt.KEEP,zPass:nt.KEEP},backFunction:Pn.NEVER,reference:0,mask:At.CLASSIFICATION_MASK},blending:Zn.ALPHA_BLEND},GBe={depthMask:!0,depthTest:{enabled:!0},stencilTest:At.setCesium3DTileBit(),stencilMask:At.CESIUM_3D_TILE_MASK,blending:Zn.ALPHA_BLEND},jBe=`uniform sampler2D colorTexture;
|
|
uniform sampler2D depthTexture;
|
|
uniform sampler2D classifiedTexture;
|
|
in vec2 v_textureCoordinates;
|
|
void main()
|
|
{
|
|
vec4 color = texture(colorTexture, v_textureCoordinates);
|
|
if (color.a == 0.0)
|
|
{
|
|
discard;
|
|
}
|
|
bool isClassified = all(equal(texture(classifiedTexture, v_textureCoordinates), vec4(0.0)));
|
|
#ifdef UNCLASSIFIED
|
|
vec4 highlightColor = czm_invertClassificationColor;
|
|
if (isClassified)
|
|
{
|
|
discard;
|
|
}
|
|
#else
|
|
vec4 highlightColor = vec4(1.0);
|
|
if (!isClassified)
|
|
{
|
|
discard;
|
|
}
|
|
#endif
|
|
out_FragColor = color * highlightColor;
|
|
gl_FragDepth = texture(depthTexture, v_textureCoordinates).r;
|
|
}
|
|
`,WBe=`uniform sampler2D colorTexture;
|
|
in vec2 v_textureCoordinates;
|
|
void main()
|
|
{
|
|
vec4 color = texture(colorTexture, v_textureCoordinates);
|
|
if (color.a == 0.0)
|
|
{
|
|
discard;
|
|
}
|
|
#ifdef UNCLASSIFIED
|
|
out_FragColor = color * czm_invertClassificationColor;
|
|
#else
|
|
out_FragColor = color;
|
|
#endif
|
|
}
|
|
`;kl.prototype.update=function(e,t,n){const i=this._fbo.getColorTexture(),o=this.previousFramebuffer!==this._previousFramebuffer;this._previousFramebuffer=this.previousFramebuffer;const r=this._numSamples!==t,s=e.drawingBufferWidth,a=e.drawingBufferHeight,l=!c(i)||i.width!==s||i.height!==a;if((l||o||r)&&(this._numSamples=t,this._depthStencilTexture=this._depthStencilTexture&&this._depthStencilTexture.destroy(),this._depthStencilRenderbuffer=this._depthStencilRenderbuffer&&this._depthStencilRenderbuffer.destroy(),c(this._previousFramebuffer)||(this._depthStencilTexture=new xt({context:e,width:s,height:a,pixelFormat:Ve.DEPTH_STENCIL,pixelDatatype:Me.UNSIGNED_INT_24_8}),t>1&&(this._depthStencilRenderbuffer=new cl({context:e,width:s,height:a,format:qu.DEPTH24_STENCIL8,numSamples:t})))),!c(this._fbo.framebuffer)||l||o||r){this._fbo.destroy(),this._fboClassified.destroy();let u,h;c(this._previousFramebuffer)?(u=n.getDepthStencilTexture(),h=n.getDepthStencilRenderbuffer()):(u=this._depthStencilTexture,h=this._depthStencilRenderbuffer),this._fbo.setDepthStencilTexture(u),c(h)&&this._fbo.setDepthStencilRenderbuffer(h),this._fbo.update(e,s,a,t),c(this._previousFramebuffer)||(this._fboClassified.setDepthStencilTexture(u),this._fboClassified.update(e,s,a))}if(c(this._rsUnclassified)||(this._rsUnclassified=Ue.fromCache(VBe),this._rsClassified=Ue.fromCache(HBe),this._rsDefault=Ue.fromCache(GBe)),!c(this._unclassifiedCommand)||o||r){c(this._unclassifiedCommand)&&(this._unclassifiedCommand.shaderProgram=this._unclassifiedCommand.shaderProgram&&this._unclassifiedCommand.shaderProgram.destroy(),this._classifiedCommand.shaderProgram=this._classifiedCommand.shaderProgram&&this._classifiedCommand.shaderProgram.destroy());const u=c(this._previousFramebuffer)?WBe:jBe,h=new Oe({defines:["UNCLASSIFIED"],sources:[u]}),f=new Oe({sources:[u]});this._unclassifiedCommand=e.createViewportQuadCommand(h,{renderState:c(this._previousFramebuffer)?this._rsUnclassified:this._rsDefault,uniformMap:this._uniformMap,owner:this}),this._classifiedCommand=e.createViewportQuadCommand(f,{renderState:c(this._previousFramebuffer)?this._rsClassified:this._rsDefault,uniformMap:this._uniformMap,owner:this}),c(this._translucentCommand)&&(this._translucentCommand.shaderProgram=this._translucentCommand.shaderProgram&&this._translucentCommand.shaderProgram.destroy()),c(this._previousFramebuffer)||(this._translucentCommand=e.createViewportQuadCommand(Ep,{renderState:this._rsUnclassified,uniformMap:this._uniformMap,owner:this}))}};kl.prototype.prepareTextures=function(e,t){this._fbo._numSamples>1&&this._fbo.prepareTextures(e,t)};kl.prototype.clear=function(e,t){c(this._previousFramebuffer)?this._fbo.clear(e,this._clearColorCommand,t):(this._fbo.clear(e,this._clearCommand,t),this._fboClassified.clear(e,this._clearCommand,t))};kl.prototype.executeClassified=function(e,t){if(!c(this._previousFramebuffer)){const n=t.framebuffer;this.prepareTextures(e,!0),t.framebuffer=this._fboClassified.framebuffer,this._translucentCommand.execute(e,t),t.framebuffer=n}this._classifiedCommand.execute(e,t)};kl.prototype.executeUnclassified=function(e,t){this._unclassifiedCommand.execute(e,t)};kl.prototype.isDestroyed=function(){return!1};kl.prototype.destroy=function(){return this._fbo.destroy(),this._fboClassified.destroy(),this._depthStencilTexture=this._depthStencilTexture&&this._depthStencilTexture.destroy(),this._depthStencilRenderbuffer=this._depthStencilRenderbuffer&&this._depthStencilRenderbuffer.destroy(),c(this._unclassifiedCommand)&&(this._unclassifiedCommand.shaderProgram=this._unclassifiedCommand.shaderProgram&&this._unclassifiedCommand.shaderProgram.destroy(),this._classifiedCommand.shaderProgram=this._classifiedCommand.shaderProgram&&this._classifiedCommand.shaderProgram.destroy()),ve(this)};function cx(e){this._total=e,this.usedThisFrame=0,this.stolenFromMeThisFrame=0,this.starvedThisFrame=!1,this.starvedLastFrame=!1}Object.defineProperties(cx.prototype,{total:{get:function(){return this._total}}});function Sh(e){if(c(e)&&e.length!==nl.NUMBER_OF_JOB_TYPES)throw new E("A budget must be specified for each job type; budgets.length should equal JobType.NUMBER_OF_JOB_TYPES.");const t=new Array(nl.NUMBER_OF_JOB_TYPES);t[nl.TEXTURE]=new cx(c(e)?e[nl.TEXTURE]:10),t[nl.PROGRAM]=new cx(c(e)?e[nl.PROGRAM]:10),t[nl.BUFFER]=new cx(c(e)?e[nl.BUFFER]:30);const n=t.length;let i,o=0;for(i=0;i<n;++i)o+=t[i].total;const r=new Array(n);for(i=0;i<n;++i)r[i]=!1;this._totalBudget=o,this._totalUsedThisFrame=0,this._budgets=t,this._executedThisFrame=r}Sh.getTimestamp=xo;Object.defineProperties(Sh.prototype,{totalBudget:{get:function(){return this._totalBudget}}});Sh.prototype.disableThisFrame=function(){this._totalUsedThisFrame=this._totalBudget};Sh.prototype.resetBudgets=function(){const e=this._budgets,t=e.length;for(let n=0;n<t;++n){const i=e[n];i.starvedLastFrame=i.starvedThisFrame,i.starvedThisFrame=!1,i.usedThisFrame=0,i.stolenFromMeThisFrame=0}this._totalUsedThisFrame=0};Sh.prototype.execute=function(e,t){const n=this._budgets,i=n[t],o=this._executedThisFrame[t];if(this._totalUsedThisFrame>=this._totalBudget&&o)return i.starvedThisFrame=!0,!1;let r;if(i.usedThisFrame+i.stolenFromMeThisFrame>=i.total){const l=n.length;let u;for(u=0;u<l&&(r=n[u],!(r.usedThisFrame+r.stolenFromMeThisFrame<r.total&&!r.starvedLastFrame));++u);if(u===l&&o)return!1;o&&(i.starvedThisFrame=!0)}const s=Sh.getTimestamp();e.execute();const a=Sh.getTimestamp()-s;return this._totalUsedThisFrame+=a,r?r.stolenFromMeThisFrame+=a:i.usedThisFrame+=a,this._executedThisFrame[t]=!0,!0};function rE(e){e=y(e,y.EMPTY_OBJECT);const t=Do(e.container);if(!c(t))throw new E("container is required");this._container=t;const n=document.createElement("div");n.className="cesium-performanceDisplay";const i=document.createElement("div");i.className="cesium-performanceDisplay-fps",this._fpsText=document.createTextNode(""),i.appendChild(this._fpsText);const o=document.createElement("div");o.className="cesium-performanceDisplay-ms",this._msText=document.createTextNode(""),o.appendChild(this._msText),n.appendChild(o),n.appendChild(i),this._container.appendChild(n),this._lastFpsSampleTime=xo(),this._lastMsSampleTime=xo(),this._fpsFrameCount=0,this._msFrameCount=0,this._throttled=!1;const r=document.createElement("div");r.className="cesium-performanceDisplay-throttled",this._throttledText=document.createTextNode(""),r.appendChild(this._throttledText),n.appendChild(r)}Object.defineProperties(rE.prototype,{throttled:{get:function(){return this._throttled},set:function(e){this._throttled!==e&&(e?this._throttledText.nodeValue="(throttled)":this._throttledText.nodeValue="",this._throttled=e)}}});rE.prototype.update=function(e){const t=xo(),n=y(e,!0);this._fpsFrameCount++;const i=t-this._lastFpsSampleTime;if(i>1e3){let r="N/A";n&&(r=this._fpsFrameCount*1e3/i|0),this._fpsText.nodeValue=`${r} FPS`,this._lastFpsSampleTime=t,this._fpsFrameCount=0}this._msFrameCount++;const o=t-this._lastMsSampleTime;if(o>200){let r="N/A";n&&(r=(o/this._msFrameCount).toFixed(2)),this._msText.nodeValue=`${r} MS`,this._lastMsSampleTime=t,this._msFrameCount=0}};rE.prototype.destroy=function(){return ve(this)};function qp(){this._framebuffer=new on,this._textureToCopy=void 0,this._copyDepthCommand=void 0}Object.defineProperties(qp.prototype,{framebuffer:{get:function(){return this._framebuffer.framebuffer}}});function qBe(e,t,n){const i=n.width,o=n.height;e._framebuffer.update(t,i,o)}function YBe(e,t,n){if(!c(e._copyDepthCommand)){const i=`uniform highp sampler2D u_texture;
|
|
in vec2 v_textureCoordinates;
|
|
void main()
|
|
{
|
|
out_FragColor = czm_packDepth(texture(u_texture, v_textureCoordinates).r);
|
|
}
|
|
`;e._copyDepthCommand=t.createViewportQuadCommand(i,{renderState:Ue.fromCache(),uniformMap:{u_texture:function(){return e._textureToCopy}},owner:e})}e._textureToCopy=n,e._copyDepthCommand.framebuffer=e.framebuffer}qp.prototype.update=function(e,t){qBe(this,e,t),YBe(this,e,t)};const $Be=new te,XBe=new te(1,1/255,1/65025,1/16581375);qp.prototype.getDepth=function(e,t,n){if(!c(this.framebuffer))return;const i=e.readPixels({x:t,y:n,width:1,height:1,framebuffer:this.framebuffer}),o=te.unpack(i,0,$Be);return te.divideByScalar(o,255,o),te.dot(o,XBe)};qp.prototype.executeCopyDepth=function(e,t){this._copyDepthCommand.execute(e,t)};qp.prototype.isDestroyed=function(){return!1};qp.prototype.destroy=function(){return this._framebuffer.destroy(),c(this._copyDepthCommand)&&(this._copyDepthCommand.shaderProgram=c(this._copyDepthCommand.shaderProgram)&&this._copyDepthCommand.shaderProgram.destroy()),ve(this)};function QBe(e,t){this.near=y(e,0),this.far=y(t,0);const n=xe.NUMBER_OF_PASSES,i=new Array(n),o=new Array(n);for(let r=0;r<n;++r)i[r]=[],o[r]=0;this.commands=i,this.indices=o}const qD=`uniform highp sampler2D u_depthTexture;
|
|
|
|
in vec2 v_textureCoordinates;
|
|
|
|
void main()
|
|
{
|
|
out_FragColor = czm_packDepth(texture(u_depthTexture, v_textureCoordinates).r);
|
|
}
|
|
`;function Cu(){this._picking=!1,this._numSamples=1,this._tempCopyDepthTexture=void 0,this._pickColorFramebuffer=new on({depthStencil:!0,supportsDepthTexture:!0}),this._outputFramebuffer=new on({depthStencil:!0,supportsDepthTexture:!0}),this._copyDepthFramebuffer=new on,this._tempCopyDepthFramebuffer=new on,this._updateDepthFramebuffer=new on({createColorAttachments:!1,createDepthAttachments:!1,depthStencil:!0}),this._clearGlobeColorCommand=void 0,this._copyColorCommand=void 0,this._copyDepthCommand=void 0,this._tempCopyDepthCommand=void 0,this._updateDepthCommand=void 0,this._viewport=new Re,this._rs=void 0,this._rsBlend=void 0,this._rsUpdate=void 0,this._useScissorTest=!1,this._scissorRectangle=void 0,this._useHdr=void 0,this._clearGlobeDepth=void 0}Object.defineProperties(Cu.prototype,{colorFramebufferManager:{get:function(){return this._picking?this._pickColorFramebuffer:this._outputFramebuffer}},framebuffer:{get:function(){return this.colorFramebufferManager.framebuffer}},depthStencilTexture:{get:function(){return this.colorFramebufferManager.getDepthStencilTexture()}},picking:{get:function(){return this._picking},set:function(e){this._picking=e}}});function KBe(e){e._pickColorFramebuffer.destroy(),e._outputFramebuffer.destroy(),e._copyDepthFramebuffer.destroy(),e._tempCopyDepthFramebuffer.destroy(),e._updateDepthFramebuffer.destroy()}function zW(e,t,n,i,o){e._viewport.width=n,e._viewport.height=i;const r=!Re.equals(e._viewport,o.viewport);let s=r!==e._useScissorTest;e._useScissorTest=r,Re.equals(e._scissorRectangle,o.viewport)||(e._scissorRectangle=Re.clone(o.viewport,e._scissorRectangle),s=!0),(!c(e._rs)||!Re.equals(e._viewport,e._rs.viewport)||s)&&(e._rs=Ue.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle}}),e._rsBlend=Ue.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle},blending:Zn.ALPHA_BLEND}),e._rsUpdate=Ue.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle},stencilTest:{enabled:!0,frontFunction:Pn.EQUAL,frontOperation:{fail:nt.KEEP,zFail:nt.KEEP,zPass:nt.KEEP},backFunction:Pn.NEVER,reference:At.CESIUM_3D_TILE_MASK,mask:At.CESIUM_3D_TILE_MASK}})),c(e._copyDepthCommand)||(e._copyDepthCommand=t.createViewportQuadCommand(qD,{uniformMap:{u_depthTexture:function(){return e.colorFramebufferManager.getDepthStencilTexture()}},owner:e})),e._copyDepthCommand.framebuffer=e._copyDepthFramebuffer.framebuffer,e._copyDepthCommand.renderState=e._rs,c(e._copyColorCommand)||(e._copyColorCommand=t.createViewportQuadCommand(Ep,{uniformMap:{colorTexture:function(){return e.colorFramebufferManager.getColorTexture()}},owner:e})),e._copyColorCommand.renderState=e._rs,c(e._tempCopyDepthCommand)||(e._tempCopyDepthCommand=t.createViewportQuadCommand(qD,{uniformMap:{u_depthTexture:function(){return e._tempCopyDepthTexture}},owner:e})),e._tempCopyDepthCommand.framebuffer=e._tempCopyDepthFramebuffer.framebuffer,e._tempCopyDepthCommand.renderState=e._rs,c(e._updateDepthCommand)||(e._updateDepthCommand=t.createViewportQuadCommand(Ep,{uniformMap:{colorTexture:function(){return e._tempCopyDepthFramebuffer.getColorTexture()}},owner:e})),e._updateDepthCommand.framebuffer=e._updateDepthFramebuffer.framebuffer,e._updateDepthCommand.renderState=e._rsUpdate,c(e._clearGlobeColorCommand)||(e._clearGlobeColorCommand=new bi({color:new z(0,0,0,0),stencil:0,owner:e})),e._clearGlobeColorCommand.framebuffer=e.framebuffer}Cu.prototype.update=function(e,t,n,i,o,r){const s=n.width,a=n.height,l=o?e.halfFloatingPointTexture?Me.HALF_FLOAT:Me.FLOAT:Me.UNSIGNED_BYTE;this._numSamples=i,this.picking?this._pickColorFramebuffer.update(e,s,a):this._outputFramebuffer.update(e,s,a,i,l),this._copyDepthFramebuffer.update(e,s,a),zW(this,e,s,a,t),e.uniformState.globeDepthTexture=void 0,this._useHdr=o,this._clearGlobeDepth=r};Cu.prototype.prepareColorTextures=function(e,t){!this.picking&&this._numSamples>1&&this._outputFramebuffer.prepareTextures(e,t)};Cu.prototype.executeCopyDepth=function(e,t){c(this._copyDepthCommand)&&(this.prepareColorTextures(e),this._copyDepthCommand.execute(e,t),e.uniformState.globeDepthTexture=this._copyDepthFramebuffer.getColorTexture())};Cu.prototype.executeUpdateDepth=function(e,t,n,i){const o=c(i)?i:t.framebuffer.depthStencilTexture;if(n||o!==this.colorFramebufferManager.getDepthStencilTexture()){if(c(this._updateDepthCommand)){if(!c(this._updateDepthFramebuffer.framebuffer)||this._updateDepthFramebuffer.getDepthStencilTexture()!==o||this._updateDepthFramebuffer.getColorTexture()!==this._copyDepthFramebuffer.getColorTexture()){const r=this._copyDepthFramebuffer.getColorTexture().width,s=this._copyDepthFramebuffer.getColorTexture().height;this._tempCopyDepthFramebuffer.destroy(),this._tempCopyDepthFramebuffer.update(e,r,s);const a=this._copyDepthFramebuffer.getColorTexture();this._updateDepthFramebuffer.setColorTexture(a,0),this._updateDepthFramebuffer.setDepthStencilTexture(o),this._updateDepthFramebuffer.update(e,r,s),zW(this,e,r,s,t)}this._tempCopyDepthTexture=o,this._tempCopyDepthCommand.execute(e,t),this._updateDepthCommand.execute(e,t)}return}c(this._copyDepthCommand)&&this._copyDepthCommand.execute(e,t)};Cu.prototype.executeCopyColor=function(e,t){c(this._copyColorCommand)&&this._copyColorCommand.execute(e,t)};Cu.prototype.clear=function(e,t,n){const i=this._clearGlobeColorCommand;c(i)&&(z.clone(n,i.color),this.colorFramebufferManager.clear(e,i,t))};Cu.prototype.isDestroyed=function(){return!1};Cu.prototype.destroy=function(){return KBe(this),c(this._copyColorCommand)&&(this._copyColorCommand.shaderProgram=this._copyColorCommand.shaderProgram.destroy()),c(this._copyDepthCommand)&&(this._copyDepthCommand.shaderProgram=this._copyDepthCommand.shaderProgram.destroy()),c(this._tempCopyDepthCommand)&&(this._tempCopyDepthCommand.shaderProgram=this._tempCopyDepthCommand.shaderProgram.destroy()),c(this._updateDepthCommand)&&(this._updateDepthCommand.shaderProgram=this._updateDepthCommand.shaderProgram.destroy()),ve(this)};function Yp(){this._framebuffer=new on({depthStencil:!0,supportsDepthTexture:!0}),this._packedDepthFramebuffer=new on,this._renderState=void 0,this._packedDepthCommand=void 0,this._clearCommand=void 0,this._viewport=new Re,this._useScissorTest=!1,this._scissorRectangle=void 0,this._useHdr=void 0}Object.defineProperties(Yp.prototype,{classificationTexture:{get:function(){return this._framebuffer.getColorTexture()}},classificationFramebuffer:{get:function(){return this._framebuffer.framebuffer}},packedDepthFramebuffer:{get:function(){return this._packedDepthFramebuffer.framebuffer}},depthStencilTexture:{get:function(){return this._framebuffer.getDepthStencilTexture()}},depthStencilRenderbuffer:{get:function(){return this._framebuffer.getDepthStencilRenderbuffer()}},packedDepthTexture:{get:function(){return this._packedDepthFramebuffer.getColorTexture()}}});function ZBe(e){e._framebuffer.destroy(),e._packedDepthFramebuffer.destroy()}function JBe(e,t,n,i,o){const r=o?t.halfFloatingPointTexture?Me.HALF_FLOAT:Me.FLOAT:Me.UNSIGNED_BYTE;e._framebuffer.update(t,n,i,1,r),e._packedDepthFramebuffer.update(t,n,i)}function e3e(e,t,n,i,o){e._viewport.width=n,e._viewport.height=i;const r=!Re.equals(e._viewport,o.viewport);let s=r!==e._useScissorTest;e._useScissorTest=r,Re.equals(e._scissorRectangle,o.viewport)||(e._scissorRectangle=Re.clone(o.viewport,e._scissorRectangle),s=!0),(!c(e._renderState)||!Re.equals(e._viewport,e._renderState.viewport)||s)&&(e._renderState=Ue.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle}})),c(e._packedDepthCommand)||(e._packedDepthCommand=t.createViewportQuadCommand(qD,{uniformMap:{u_depthTexture:function(){return e.depthStencilTexture}},owner:e})),c(e._clearCommand)||(e._clearCommand=new bi({color:new z(0,0,0,0),depth:1,stencil:0,owner:e})),e._packedDepthCommand.framebuffer=e._packedDepthFramebuffer.framebuffer,e._packedDepthCommand.renderState=e._renderState,e._clearCommand.framebuffer=e.classificationFramebuffer,e._clearCommand.renderState=e._renderState}Yp.prototype.updateAndClear=function(e,t,n,i){const o=t.width,r=t.height;JBe(this,n,o,r,e),e3e(this,n,o,r,i),this._useHdr=e};Yp.prototype.clearClassification=function(e,t){this._clearCommand.execute(e,t)};Yp.prototype.packDepth=function(e,t){return this._packedDepthCommand.execute(e,t),this.packedDepthTexture};Yp.prototype.isDestroyed=function(){return!1};Yp.prototype.destroy=function(){return ZBe(this),ve(this)};function Pd(e){this._numSamples=1,this._translucentMultipassSupport=!1,this._translucentMRTSupport=!1;const t=e.colorBufferFloat&&e.depthTexture&&e.floatBlend;this._translucentMRTSupport=e.drawBuffers&&t,this._translucentMultipassSupport=!this._translucentMRTSupport&&t,this._opaqueFBO=void 0,this._opaqueTexture=void 0,this._depthStencilTexture=void 0,this._accumulationTexture=void 0,this._translucentFBO=new on({colorAttachmentsLength:this._translucentMRTSupport?2:1,createColorAttachments:!1,createDepthAttachments:!1,depth:!0}),this._alphaFBO=new on({createColorAttachments:!1,createDepthAttachments:!1,depth:!0}),this._adjustTranslucentFBO=new on({colorAttachmentsLength:this._translucentMRTSupport?2:1,createColorAttachments:!1}),this._adjustAlphaFBO=new on({createColorAttachments:!1}),this._opaqueClearCommand=new bi({color:new z(0,0,0,0),owner:this}),this._translucentMRTClearCommand=new bi({color:new z(0,0,0,1),owner:this}),this._translucentMultipassClearCommand=new bi({color:new z(0,0,0,0),owner:this}),this._alphaClearCommand=new bi({color:new z(1,1,1,1),owner:this}),this._translucentRenderStateCache={},this._alphaRenderStateCache={},this._compositeCommand=void 0,this._adjustTranslucentCommand=void 0,this._adjustAlphaCommand=void 0,this._viewport=new Re,this._rs=void 0,this._useScissorTest=!1,this._scissorRectangle=void 0,this._useHDR=!1}function UW(e){e._accumulationTexture=e._accumulationTexture&&!e._accumulationTexture.isDestroyed()&&e._accumulationTexture.destroy(),e._revealageTexture=e._revealageTexture&&!e._revealageTexture.isDestroyed()&&e._revealageTexture.destroy()}function YD(e){e._translucentFBO.destroy(),e._alphaFBO.destroy(),e._adjustTranslucentFBO.destroy(),e._adjustAlphaFBO.destroy()}function kW(e){UW(e),YD(e)}function t3e(e,t,n,i){UW(e),e._accumulationTexture=new xt({context:t,width:n,height:i,pixelFormat:Ve.RGBA,pixelDatatype:Me.FLOAT});const o=new Float32Array(n*i*4);e._revealageTexture=new xt({context:t,pixelFormat:Ve.RGBA,pixelDatatype:Me.FLOAT,source:{arrayBufferView:o,width:n,height:i},flipY:!1})}function n3e(e,t){YD(e);const n=J.FRAMEBUFFER_COMPLETE;let i=!0;const{width:o,height:r}=e._accumulationTexture;if(e._translucentMRTSupport&&(e._translucentFBO.setColorTexture(e._accumulationTexture,0),e._translucentFBO.setColorTexture(e._revealageTexture,1),e._translucentFBO.setDepthStencilTexture(e._depthStencilTexture),e._translucentFBO.update(t,o,r),e._adjustTranslucentFBO.setColorTexture(e._accumulationTexture,0),e._adjustTranslucentFBO.setColorTexture(e._revealageTexture,1),e._adjustTranslucentFBO.update(t,o,r),(e._translucentFBO.status!==n||e._adjustTranslucentFBO.status!==n)&&(YD(e),e._translucentMRTSupport=!1)),!e._translucentMRTSupport){e._translucentFBO.setColorTexture(e._accumulationTexture),e._translucentFBO.setDepthStencilTexture(e._depthStencilTexture),e._translucentFBO.update(t,o,r),e._alphaFBO.setColorTexture(e._revealageTexture),e._alphaFBO.setDepthStencilTexture(e._depthStencilTexture),e._alphaFBO.update(t,o,r),e._adjustTranslucentFBO.setColorTexture(e._accumulationTexture),e._adjustTranslucentFBO.update(t,o,r),e._adjustAlphaFBO.setColorTexture(e._revealageTexture),e._adjustAlphaFBO.update(t,o,r);const s=e._translucentFBO.status===n,a=e._alphaFBO.status===n,l=e._adjustTranslucentFBO.status===n,u=e._adjustAlphaFBO.status===n;(!s||!a||!l||!u)&&(kW(e),e._translucentMultipassSupport=!1,i=!1)}return i}Pd.prototype.update=function(e,t,n,i,o){if(!this.isSupported())return;this._opaqueFBO=n,this._opaqueTexture=n.getColorTexture(0),this._depthStencilTexture=n.getDepthStencilTexture();const{width:r,height:s}=this._opaqueTexture,a=this._accumulationTexture,l=!c(a)||a.width!==r||a.height!==s||i!==this._useHDR,u=this._numSamples!==o;if((l||u)&&(this._numSamples=o,t3e(this,e,r,s)),(!c(this._translucentFBO.framebuffer)||l||u)&&!n3e(this,e))return;this._useHDR=i;const h=this;let f,_;c(this._compositeCommand)||(f=new Oe({sources:[D1e]}),this._translucentMRTSupport&&f.defines.push("MRT"),_={u_opaque:function(){return h._opaqueTexture},u_accumulation:function(){return h._accumulationTexture},u_revealage:function(){return h._revealageTexture}},this._compositeCommand=e.createViewportQuadCommand(f,{uniformMap:_,owner:this})),c(this._adjustTranslucentCommand)||(this._translucentMRTSupport?(f=new Oe({defines:["MRT"],sources:[SB]}),_={u_bgColor:function(){return h._translucentMRTClearCommand.color},u_depthTexture:function(){return h._depthStencilTexture}},this._adjustTranslucentCommand=e.createViewportQuadCommand(f,{uniformMap:_,owner:this})):this._translucentMultipassSupport&&(f=new Oe({sources:[SB]}),_={u_bgColor:function(){return h._translucentMultipassClearCommand.color},u_depthTexture:function(){return h._depthStencilTexture}},this._adjustTranslucentCommand=e.createViewportQuadCommand(f,{uniformMap:_,owner:this}),_={u_bgColor:function(){return h._alphaClearCommand.color},u_depthTexture:function(){return h._depthStencilTexture}},this._adjustAlphaCommand=e.createViewportQuadCommand(f,{uniformMap:_,owner:this}))),this._viewport.width=r,this._viewport.height=s;const g=!Re.equals(this._viewport,t.viewport);let m=g!==this._useScissorTest;this._useScissorTest=g,Re.equals(this._scissorRectangle,t.viewport)||(this._scissorRectangle=Re.clone(t.viewport,this._scissorRectangle),m=!0),(!c(this._rs)||!Re.equals(this._viewport,this._rs.viewport)||m)&&(this._rs=Ue.fromCache({viewport:this._viewport,scissorTest:{enabled:this._useScissorTest,rectangle:this._scissorRectangle}})),c(this._compositeCommand)&&(this._compositeCommand.renderState=this._rs),this._adjustTranslucentCommand&&(this._adjustTranslucentCommand.renderState=this._rs),c(this._adjustAlphaCommand)&&(this._adjustAlphaCommand.renderState=this._rs)};const i3e={enabled:!0,color:new z(0,0,0,0),equationRgb:cc.ADD,equationAlpha:cc.ADD,functionSourceRgb:Yi.ONE,functionDestinationRgb:Yi.ONE,functionSourceAlpha:Yi.ZERO,functionDestinationAlpha:Yi.ONE_MINUS_SOURCE_ALPHA},o3e={enabled:!0,color:new z(0,0,0,0),equationRgb:cc.ADD,equationAlpha:cc.ADD,functionSourceRgb:Yi.ONE,functionDestinationRgb:Yi.ONE,functionSourceAlpha:Yi.ONE,functionDestinationAlpha:Yi.ONE},r3e={enabled:!0,color:new z(0,0,0,0),equationRgb:cc.ADD,equationAlpha:cc.ADD,functionSourceRgb:Yi.ZERO,functionDestinationRgb:Yi.ONE_MINUS_SOURCE_ALPHA,functionSourceAlpha:Yi.ZERO,functionDestinationAlpha:Yi.ONE_MINUS_SOURCE_ALPHA};function D1(e,t,n,i){let o=n[i.id];if(!c(o)){const r=Ue.getState(i);r.depthMask=!1,r.blending=t,o=Ue.fromCache(r),n[i.id]=o}return o}function s3e(e,t,n){return D1(t,i3e,e._translucentRenderStateCache,n)}function a3e(e,t,n){return D1(t,o3e,e._translucentRenderStateCache,n)}function c3e(e,t,n){return D1(t,r3e,e._alphaRenderStateCache,n)}const l3e=` vec3 Ci = czm_out_FragColor.rgb * czm_out_FragColor.a;
|
|
float ai = czm_out_FragColor.a;
|
|
float wzi = czm_alphaWeight(ai);
|
|
out_FragData_0 = vec4(Ci * wzi, ai);
|
|
out_FragData_1 = vec4(ai * wzi);
|
|
`,u3e=` vec3 Ci = czm_out_FragColor.rgb * czm_out_FragColor.a;
|
|
float ai = czm_out_FragColor.a;
|
|
float wzi = czm_alphaWeight(ai);
|
|
out_FragColor = vec4(Ci, ai) * wzi;
|
|
`,d3e=` float ai = czm_out_FragColor.a;
|
|
out_FragColor = vec4(ai);
|
|
`;function P1(e,t,n,i){const{shaderCache:o}=e,r=o.getDerivedShaderProgram(t,n);if(c(r))return r;const s=t._attributeLocations,a=t.fragmentShaderSource.clone();a.sources=a.sources.map(function(h){return Oe.replaceMain(h,"czm_translucent_main").replace(/out_FragColor/g,"czm_out_FragColor").replace(/layout\s*\(location\s*=\s*0\)\s*out\s+vec4\s+out_FragColor;/g,"").replace(/\bdiscard\b/g,"czm_discard = true").replace(/czm_phong/g,"czm_translucentPhong")}),a.sources.splice(0,0,`vec4 czm_out_FragColor;
|
|
bool czm_discard = false;
|
|
`);const l=[...i.matchAll(/out_FragData_(\d+)/g)];let u="";for(let h=0;h<l.length;h++){const f=l[h];u=`layout (location = ${f[1]}) out vec4 ${f[0]};
|
|
${u}`}return a.sources.push(u),a.sources.push(`void main()
|
|
{
|
|
czm_translucent_main();
|
|
if (czm_discard)
|
|
{
|
|
discard;
|
|
}
|
|
${i}}
|
|
`),o.createDerivedShaderProgram(t,n,{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:a,attributeLocations:s})}function h3e(e,t){return P1(e,t,"translucentMRT",l3e)}function f3e(e,t){return P1(e,t,"translucentMultipass",u3e)}function p3e(e,t){return P1(e,t,"alphaMultipass",d3e)}Pd.prototype.createDerivedCommands=function(e,t,n){if(c(n)||(n={}),this._translucentMRTSupport){let a,l;return c(n.translucentCommand)&&(a=n.translucentCommand.shaderProgram,l=n.translucentCommand.renderState),n.translucentCommand=Ze.shallowClone(e,n.translucentCommand),!c(a)||n.shaderProgramId!==e.shaderProgram.id?(n.translucentCommand.shaderProgram=h3e(t,e.shaderProgram),n.translucentCommand.renderState=s3e(this,t,e.renderState),n.shaderProgramId=e.shaderProgram.id):(n.translucentCommand.shaderProgram=a,n.translucentCommand.renderState=l),n}let i,o,r,s;return c(n.translucentCommand)&&(i=n.translucentCommand.shaderProgram,o=n.translucentCommand.renderState,r=n.alphaCommand.shaderProgram,s=n.alphaCommand.renderState),n.translucentCommand=Ze.shallowClone(e,n.translucentCommand),n.alphaCommand=Ze.shallowClone(e,n.alphaCommand),!c(i)||n.shaderProgramId!==e.shaderProgram.id?(n.translucentCommand.shaderProgram=f3e(t,e.shaderProgram),n.translucentCommand.renderState=a3e(this,t,e.renderState),n.alphaCommand.shaderProgram=p3e(t,e.shaderProgram),n.alphaCommand.renderState=c3e(this,t,e.renderState),n.shaderProgramId=e.shaderProgram.id):(n.translucentCommand.shaderProgram=i,n.translucentCommand.renderState=o,n.alphaCommand.shaderProgram=r,n.alphaCommand.renderState=s),n};function m3e(e,t,n,i,o,r){let s,a,l;const{context:u,frameState:h}=t,{useLogDepth:f,shadowState:_}=h,g=t._hdr,m=i.framebuffer,b=_.lightShadowsEnabled;i.framebuffer=e._adjustTranslucentFBO.framebuffer,e._adjustTranslucentCommand.execute(u,i),i.framebuffer=e._adjustAlphaFBO.framebuffer,e._adjustAlphaCommand.execute(u,i);const T=e._opaqueFBO.framebuffer;for(i.framebuffer=e._translucentFBO.framebuffer,l=0;l<o.length;++l)s=o[l],s=f?s.derivedCommands.logDepth.command:s,s=g?s.derivedCommands.hdr.command:s,a=b&&s.receiveShadows?s.derivedCommands.oit.shadows.translucentCommand:s.derivedCommands.oit.translucentCommand,n(a,t,u,i,T);for(c(r)&&(s=r.unclassifiedCommand,a=b&&s.receiveShadows?s.derivedCommands.oit.shadows.translucentCommand:s.derivedCommands.oit.translucentCommand,n(a,t,u,i,T)),i.framebuffer=e._alphaFBO.framebuffer,l=0;l<o.length;++l)s=o[l],s=f?s.derivedCommands.logDepth.command:s,s=g?s.derivedCommands.hdr.command:s,a=b&&s.receiveShadows?s.derivedCommands.oit.shadows.alphaCommand:s.derivedCommands.oit.alphaCommand,n(a,t,u,i,T);c(r)&&(s=r.unclassifiedCommand,a=b&&s.receiveShadows?s.derivedCommands.oit.shadows.alphaCommand:s.derivedCommands.oit.alphaCommand,n(a,t,u,i,T)),i.framebuffer=m}function _3e(e,t,n,i,o,r){const{context:s,frameState:a}=t,{useLogDepth:l,shadowState:u}=a,h=t._hdr,f=i.framebuffer,_=u.lightShadowsEnabled;i.framebuffer=e._adjustTranslucentFBO.framebuffer,e._adjustTranslucentCommand.execute(s,i);const g=e._opaqueFBO.framebuffer;i.framebuffer=e._translucentFBO.framebuffer;let m,b;for(let T=0;T<o.length;++T)m=o[T],m=l?m.derivedCommands.logDepth.command:m,m=h?m.derivedCommands.hdr.command:m,b=_&&m.receiveShadows?m.derivedCommands.oit.shadows.translucentCommand:m.derivedCommands.oit.translucentCommand,n(b,t,s,i,g);c(r)&&(m=r.unclassifiedCommand,b=_&&m.receiveShadows?m.derivedCommands.oit.shadows.translucentCommand:m.derivedCommands.oit.translucentCommand,n(b,t,s,i,g)),i.framebuffer=f}Pd.prototype.executeCommands=function(e,t,n,i,o){if(this._translucentMRTSupport){_3e(this,e,t,n,i,o);return}m3e(this,e,t,n,i,o)};Pd.prototype.execute=function(e,t){this._compositeCommand.execute(e,t)};Pd.prototype.clear=function(e,t,n){const i=t.framebuffer;t.framebuffer=this._opaqueFBO.framebuffer,z.clone(n,this._opaqueClearCommand.color),this._opaqueClearCommand.execute(e,t),t.framebuffer=this._translucentFBO.framebuffer,(this._translucentMRTSupport?this._translucentMRTClearCommand:this._translucentMultipassClearCommand).execute(e,t),this._translucentMultipassSupport&&(t.framebuffer=this._alphaFBO.framebuffer,this._alphaClearCommand.execute(e,t)),t.framebuffer=i};Pd.prototype.isSupported=function(){return this._translucentMRTSupport||this._translucentMultipassSupport};Pd.prototype.isDestroyed=function(){return!1};Pd.prototype.destroy=function(){return kW(this),c(this._compositeCommand)&&(this._compositeCommand.shaderProgram=this._compositeCommand.shaderProgram&&this._compositeCommand.shaderProgram.destroy()),c(this._adjustTranslucentCommand)&&(this._adjustTranslucentCommand.shaderProgram=this._adjustTranslucentCommand.shaderProgram&&this._adjustTranslucentCommand.shaderProgram.destroy()),c(this._adjustAlphaCommand)&&(this._adjustAlphaCommand.shaderProgram=this._adjustAlphaCommand.shaderProgram&&this._adjustAlphaCommand.shaderProgram.destroy()),ve(this)};function ub(){this._framebuffer=new on({color:!1,depthStencil:!0,supportsDepthTexture:!0}),this._passState=void 0}Object.defineProperties(ub.prototype,{framebuffer:{get:function(){return this._framebuffer.framebuffer}}});function g3e(e){e._framebuffer.destroy()}function y3e(e,t){const n=t.drawingBufferWidth,i=t.drawingBufferHeight;e._framebuffer.update(t,n,i);const o=new Lp(t);o.blendingEnabled=!1,o.scissorTest={enabled:!0,rectangle:new Re},o.viewport=new Re,e._passState=o}ub.prototype.update=function(e,t,n){const i=n.width,o=n.height;this._framebuffer.isDirty(i,o)&&y3e(this,e);const r=this.framebuffer,s=this._passState;return s.framebuffer=r,s.viewport.width=i,s.viewport.height=o,s.scissorTest.rectangle.x=t.x,s.scissorTest.rectangle.y=o-t.y,s.scissorTest.rectangle.width=1,s.scissorTest.rectangle.height=1,s};ub.prototype.isDestroyed=function(){return!1};ub.prototype.destroy=function(){return g3e(this),ve(this)};function rg(e){const t=new Lp(e);t.blendingEnabled=!1,t.scissorTest={enabled:!0,rectangle:new Re},t.viewport=new Re,this._context=e,this._fb=new on({depthStencil:!0}),this._passState=t,this._width=0,this._height=0}rg.prototype.begin=function(e,t){const n=this._context,{width:i,height:o}=t;return Re.clone(e,this._passState.scissorTest.rectangle),this._width=i,this._height=o,this._fb.update(n,i,o),this._passState.framebuffer=this._fb.framebuffer,this._passState.viewport.width=i,this._passState.viewport.height=o,this._passState};const ry=new z;rg.prototype.end=function(e){const t=y(e.width,1),n=y(e.height,1),i=this._context,o=i.readPixels({x:e.x,y:e.y,width:t,height:n,framebuffer:this._fb.framebuffer}),r=Math.max(t,n),s=r*r,a=Math.floor(t*.5),l=Math.floor(n*.5);let u=0,h=0,f=0,_=-1;for(let g=0;g<s;++g){if(-a<=u&&u<=a&&-l<=h&&h<=l){const m=4*((l-h)*t+u+a);ry.red=z.byteToFloat(o[m]),ry.green=z.byteToFloat(o[m+1]),ry.blue=z.byteToFloat(o[m+2]),ry.alpha=z.byteToFloat(o[m+3]);const b=i.getObjectByPickColor(ry);if(c(b))return b}if(u===h||u<0&&-u===h||u>0&&u===1-h){const m=f;f=-_,_=m}u+=f,h+=_}};rg.prototype.readVoxelInfo=function(e){const t=y(e.width,1),n=y(e.height,1),o=this._context.readPixels({x:e.x,y:e.y,width:t,height:n,framebuffer:this._fb.framebuffer}),r=Math.floor(t*.5),a=4*(Math.floor(n*.5)*t+r);return o.slice(a,a+4)};rg.prototype.isDestroyed=function(){return!1};rg.prototype.destroy=function(){return this._fb.destroy(),ve(this)};function Eu(){this._numSamples=1,this._colorFramebuffer=new on({depthStencil:!0,supportsDepthTexture:!0}),this._idFramebuffer=new on({depthStencil:!0,supportsDepthTexture:!0}),this._idClearColor=new z(0,0,0,0),this._clearCommand=new bi({color:new z(0,0,0,0),depth:1,owner:this})}function b3e(e){e._colorFramebuffer.destroy(),e._idFramebuffer.destroy()}Object.defineProperties(Eu.prototype,{framebuffer:{get:function(){return this._colorFramebuffer.framebuffer}},idFramebuffer:{get:function(){return this._idFramebuffer.framebuffer}},depthStencilTexture:{get:function(){return this._colorFramebuffer.getDepthStencilTexture()}}});Eu.prototype.update=function(e,t,n,i){const o=t.width,r=t.height,s=n?e.halfFloatingPointTexture?Me.HALF_FLOAT:Me.FLOAT:Me.UNSIGNED_BYTE;this._numSamples=i,this._colorFramebuffer.update(e,o,r,i,s),this._idFramebuffer.update(e,o,r)};Eu.prototype.clear=function(e,t,n){z.clone(n,this._clearCommand.color),z.clone(this._idClearColor,this._clearCommand.color),this._colorFramebuffer.clear(e,this._clearCommand,t),this._idFramebuffer.clear(e,this._clearCommand,t)};Eu.prototype.getFramebuffer=function(){return this._colorFramebuffer.framebuffer};Eu.prototype.getIdFramebuffer=function(){return this._idFramebuffer.framebuffer};Eu.prototype.prepareColorTextures=function(e){this._numSamples>1&&this._colorFramebuffer.prepareTextures(e)};Eu.prototype.isDestroyed=function(){return!1};Eu.prototype.destroy=function(){return b3e(this),ve(this)};function bc(){}bc.getShadowCastShaderKeyword=function(e,t,n,i){return`castShadow ${e} ${t} ${n} ${i}`};bc.createShadowCastVertexShader=function(e,t,n){const i=e.defines.slice(0),o=e.sources.slice(0);i.push("SHADOW_MAP"),n&&i.push("GENERATE_POSITION");const r=Oe.findPositionVarying(e),s=c(r);if(t&&!s){const a=o.length;for(let u=0;u<a;++u)o[u]=Oe.replaceMain(o[u],"czm_shadow_cast_main");const l=`out vec3 v_positionEC;
|
|
void main()
|
|
{
|
|
czm_shadow_cast_main();
|
|
v_positionEC = (czm_inverseProjection * gl_Position).xyz;
|
|
}`;o.push(l)}return new Oe({defines:i,sources:o})};bc.createShadowCastFragmentShader=function(e,t,n,i){const o=e.defines.slice(0),r=e.sources.slice(0);o.push("SHADOW_MAP");let s=Oe.findPositionVarying(e);const a=c(s);a||(s="v_positionEC");const l=r.length;for(let h=0;h<l;++h)r[h]=Oe.replaceMain(r[h],"czm_shadow_cast_main");let u="";return t&&(a||(u+=`in vec3 v_positionEC;
|
|
`),u+=`uniform vec4 shadowMap_lightPositionEC;
|
|
`),i?u+=`void main()
|
|
{
|
|
`:u+=`void main()
|
|
{
|
|
czm_shadow_cast_main();
|
|
if (out_FragColor.a == 0.0)
|
|
{
|
|
discard;
|
|
}
|
|
`,t?u+=` float distance = length(${s});
|
|
if (distance >= shadowMap_lightPositionEC.w)
|
|
{
|
|
discard;
|
|
}
|
|
distance /= shadowMap_lightPositionEC.w; // radius
|
|
out_FragColor = czm_packDepth(distance);
|
|
`:n?u+=` out_FragColor = vec4(1.0);
|
|
`:u+=` out_FragColor = czm_packDepth(gl_FragCoord.z);
|
|
`,u+=`}
|
|
`,r.push(u),new Oe({defines:o,sources:r})};bc.getShadowReceiveShaderKeyword=function(e,t,n,i){const o=e._usesDepthTexture,r=e._polygonOffsetSupported,s=e._isPointLight,a=e._isSpotLight,l=e._numberOfCascades>1,u=e.debugCascadeColors,h=e.softShadows;return`receiveShadow ${o}${r}${s}${a}${l}${u}${h}${t}${n}${i}`};bc.createShadowReceiveVertexShader=function(e,t,n){const i=e.defines.slice(0),o=e.sources.slice(0);return i.push("SHADOW_MAP"),t&&(n?i.push("GENERATE_POSITION_AND_NORMAL"):i.push("GENERATE_POSITION")),new Oe({defines:i,sources:o})};bc.createShadowReceiveFragmentShader=function(e,t,n,i,o){const r=Oe.findNormalVarying(e),s=!i&&c(r)||i&&o,a=Oe.findPositionVarying(e),l=c(a),u=t._usesDepthTexture,h=t._polygonOffsetSupported,f=t._isPointLight,_=t._isSpotLight,g=t._numberOfCascades>1,m=t.debugCascadeColors,b=t.softShadows,T=f?t._pointBias:i?t._terrainBias:t._primitiveBias,x=e.defines.slice(0),C=e.sources.slice(0),w=C.length;for(let N=0;N<w;++N)C[N]=Oe.replaceMain(C[N],"czm_shadow_receive_main");f?x.push("USE_CUBE_MAP_SHADOW"):u&&x.push("USE_SHADOW_DEPTH_TEXTURE"),b&&!f&&x.push("USE_SOFT_SHADOWS"),g&&n&&i&&(s?x.push("ENABLE_VERTEX_LIGHTING"):x.push("ENABLE_DAYNIGHT_SHADING")),n&&T.normalShading&&s&&(x.push("USE_NORMAL_SHADING"),T.normalShadingSmooth>0&&x.push("USE_NORMAL_SHADING_SMOOTH"));let v="";f?v+=`uniform samplerCube shadowMap_textureCube;
|
|
`:v+=`uniform sampler2D shadowMap_texture;
|
|
`;let P;return l?P=` return vec4(${a}, 1.0);
|
|
`:P=`#ifndef LOG_DEPTH
|
|
return czm_windowToEyeCoordinates(gl_FragCoord);
|
|
#else
|
|
return vec4(v_logPositionEC, 1.0);
|
|
#endif
|
|
`,v+=`uniform mat4 shadowMap_matrix;
|
|
uniform vec3 shadowMap_lightDirectionEC;
|
|
uniform vec4 shadowMap_lightPositionEC;
|
|
uniform vec4 shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness;
|
|
uniform vec4 shadowMap_texelSizeDepthBiasAndNormalShadingSmooth;
|
|
#ifdef LOG_DEPTH
|
|
in vec3 v_logPositionEC;
|
|
#endif
|
|
vec4 getPositionEC()
|
|
{
|
|
${P}}
|
|
vec3 getNormalEC()
|
|
{
|
|
${s?` return normalize(${r});
|
|
`:` return vec3(1.0);
|
|
`}}
|
|
void applyNormalOffset(inout vec4 positionEC, vec3 normalEC, float nDotL)
|
|
{
|
|
${T.normalOffset&&s?` float normalOffset = shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness.x;
|
|
float normalOffsetScale = 1.0 - nDotL;
|
|
vec3 offset = normalOffset * normalOffsetScale * normalEC;
|
|
positionEC.xyz += offset;
|
|
`:""}}
|
|
`,v+=`void main()
|
|
{
|
|
czm_shadow_receive_main();
|
|
vec4 positionEC = getPositionEC();
|
|
vec3 normalEC = getNormalEC();
|
|
float depth = -positionEC.z;
|
|
`,v+=` czm_shadowParameters shadowParameters;
|
|
shadowParameters.texelStepSize = shadowMap_texelSizeDepthBiasAndNormalShadingSmooth.xy;
|
|
shadowParameters.depthBias = shadowMap_texelSizeDepthBiasAndNormalShadingSmooth.z;
|
|
shadowParameters.normalShadingSmooth = shadowMap_texelSizeDepthBiasAndNormalShadingSmooth.w;
|
|
shadowParameters.darkness = shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness.w;
|
|
`,i?v+=` shadowParameters.depthBias *= max(depth * 0.01, 1.0);
|
|
`:h||(v+=` shadowParameters.depthBias *= mix(1.0, 100.0, depth * 0.0015);
|
|
`),f?v+=` vec3 directionEC = positionEC.xyz - shadowMap_lightPositionEC.xyz;
|
|
float distance = length(directionEC);
|
|
directionEC = normalize(directionEC);
|
|
float radius = shadowMap_lightPositionEC.w;
|
|
// Stop early if the fragment is beyond the point light radius
|
|
if (distance > radius)
|
|
{
|
|
return;
|
|
}
|
|
vec3 directionWC = czm_inverseViewRotation * directionEC;
|
|
shadowParameters.depth = distance / radius;
|
|
shadowParameters.nDotL = clamp(dot(normalEC, -directionEC), 0.0, 1.0);
|
|
shadowParameters.texCoords = directionWC;
|
|
float visibility = czm_shadowVisibility(shadowMap_textureCube, shadowParameters);
|
|
`:_?v+=` vec3 directionEC = normalize(positionEC.xyz - shadowMap_lightPositionEC.xyz);
|
|
float nDotL = clamp(dot(normalEC, -directionEC), 0.0, 1.0);
|
|
applyNormalOffset(positionEC, normalEC, nDotL);
|
|
vec4 shadowPosition = shadowMap_matrix * positionEC;
|
|
// Spot light uses a perspective projection, so perform the perspective divide
|
|
shadowPosition /= shadowPosition.w;
|
|
// Stop early if the fragment is not in the shadow bounds
|
|
if (any(lessThan(shadowPosition.xyz, vec3(0.0))) || any(greaterThan(shadowPosition.xyz, vec3(1.0))))
|
|
{
|
|
return;
|
|
}
|
|
shadowParameters.texCoords = shadowPosition.xy;
|
|
shadowParameters.depth = shadowPosition.z;
|
|
shadowParameters.nDotL = nDotL;
|
|
float visibility = czm_shadowVisibility(shadowMap_texture, shadowParameters);
|
|
`:g?v+=` float maxDepth = shadowMap_cascadeSplits[1].w;
|
|
// Stop early if the eye depth exceeds the last cascade
|
|
if (depth > maxDepth)
|
|
{
|
|
return;
|
|
}
|
|
// Get the cascade based on the eye-space depth
|
|
vec4 weights = czm_cascadeWeights(depth);
|
|
// Apply normal offset
|
|
float nDotL = clamp(dot(normalEC, shadowMap_lightDirectionEC), 0.0, 1.0);
|
|
applyNormalOffset(positionEC, normalEC, nDotL);
|
|
// Transform position into the cascade
|
|
vec4 shadowPosition = czm_cascadeMatrix(weights) * positionEC;
|
|
// Get visibility
|
|
shadowParameters.texCoords = shadowPosition.xy;
|
|
shadowParameters.depth = shadowPosition.z;
|
|
shadowParameters.nDotL = nDotL;
|
|
float visibility = czm_shadowVisibility(shadowMap_texture, shadowParameters);
|
|
// Fade out shadows that are far away
|
|
float shadowMapMaximumDistance = shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness.z;
|
|
float fade = max((depth - shadowMapMaximumDistance * 0.8) / (shadowMapMaximumDistance * 0.2), 0.0);
|
|
visibility = mix(visibility, 1.0, fade);
|
|
${m?` // Draw cascade colors for debugging
|
|
out_FragColor *= czm_cascadeColor(weights);
|
|
`:""}`:v+=` float nDotL = clamp(dot(normalEC, shadowMap_lightDirectionEC), 0.0, 1.0);
|
|
applyNormalOffset(positionEC, normalEC, nDotL);
|
|
vec4 shadowPosition = shadowMap_matrix * positionEC;
|
|
// Stop early if the fragment is not in the shadow bounds
|
|
if (any(lessThan(shadowPosition.xyz, vec3(0.0))) || any(greaterThan(shadowPosition.xyz, vec3(1.0))))
|
|
{
|
|
return;
|
|
}
|
|
shadowParameters.texCoords = shadowPosition.xy;
|
|
shadowParameters.depth = shadowPosition.z;
|
|
shadowParameters.nDotL = nDotL;
|
|
float visibility = czm_shadowVisibility(shadowMap_texture, shadowParameters);
|
|
`,v+=` out_FragColor.rgb *= visibility;
|
|
}
|
|
`,C.push(v),new Oe({defines:x,sources:C})};function Wa(e){e=y(e,y.EMPTY_OBJECT);const t=e.context;if(!c(t))throw new E("context is required.");if(!c(e.lightCamera))throw new E("lightCamera is required.");if(c(e.numberOfCascades)&&e.numberOfCascades!==1&&e.numberOfCascades!==4)throw new E("Only one or four cascades are supported.");this._enabled=y(e.enabled,!0),this._softShadows=y(e.softShadows,!1),this._normalOffset=y(e.normalOffset,!0),this.dirty=!0,this.fromLightSource=y(e.fromLightSource,!0),this.darkness=y(e.darkness,.3),this._darkness=this.darkness,this.fadingEnabled=y(e.fadingEnabled,!0),this.maximumDistance=y(e.maximumDistance,5e3),this._outOfView=!1,this._outOfViewPrevious=!1,this._needsUpdate=!0;let n=!0;(Yt.isInternetExplorer()||Yt.isEdge()||(Yt.isChrome()||Yt.isFirefox())&&Yt.isWindows()&&!t.depthTexture)&&(n=!1),this._polygonOffsetSupported=n,this._terrainBias={polygonOffset:n,polygonOffsetFactor:1.1,polygonOffsetUnits:4,normalOffset:this._normalOffset,normalOffsetScale:.5,normalShading:!0,normalShadingSmooth:.3,depthBias:1e-4},this._primitiveBias={polygonOffset:n,polygonOffsetFactor:1.1,polygonOffsetUnits:4,normalOffset:this._normalOffset,normalOffsetScale:.1,normalShading:!0,normalShadingSmooth:.05,depthBias:2e-5},this._pointBias={polygonOffset:!1,polygonOffsetFactor:1.1,polygonOffsetUnits:4,normalOffset:this._normalOffset,normalOffsetScale:0,normalShading:!0,normalShadingSmooth:.1,depthBias:5e-4},this._depthAttachment=void 0,this._colorAttachment=void 0,this._shadowMapMatrix=new L,this._shadowMapTexture=void 0,this._lightDirectionEC=new d,this._lightPositionEC=new te,this._distance=0,this._lightCamera=e.lightCamera,this._shadowMapCamera=new sE,this._shadowMapCullingVolume=void 0,this._sceneCamera=void 0,this._boundingSphere=new se,this._isPointLight=y(e.isPointLight,!1),this._pointLightRadius=y(e.pointLightRadius,100),this._cascadesEnabled=this._isPointLight?!1:y(e.cascadesEnabled,!0),this._numberOfCascades=this._cascadesEnabled?y(e.numberOfCascades,4):0,this._fitNearFar=!0,this._maximumCascadeDistances=[25,150,700,Number.MAX_VALUE],this._textureSize=new H,this._isSpotLight=!1,this._cascadesEnabled?this._shadowMapCamera.frustum=new Ki:c(this._lightCamera.frustum.fov)&&(this._isSpotLight=!0),this._cascadeSplits=[new te,new te],this._cascadeMatrices=[new L,new L,new L,new L],this._cascadeDistances=new te;let i;this._isPointLight?i=6:this._cascadesEnabled?i=this._numberOfCascades:i=1,this._passes=new Array(i);for(let o=0;o<i;++o)this._passes[o]=new T3e(t);this.debugShow=!1,this.debugFreezeFrame=!1,this._debugFreezeFrame=!1,this._debugCascadeColors=!1,this._debugLightFrustum=void 0,this._debugCameraFrustum=void 0,this._debugCascadeFrustums=new Array(this._numberOfCascades),this._debugShadowViewCommand=void 0,this._usesDepthTexture=t.depthTexture,this._isPointLight&&(this._usesDepthTexture=!1),this._primitiveRenderState=void 0,this._terrainRenderState=void 0,this._pointRenderState=void 0,O1(this),this._clearCommand=new bi({depth:1,color:new z}),this._clearPassState=new Lp(t),this._size=y(e.size,2048),this.size=this._size}Wa.MAXIMUM_DISTANCE=2e4;function T3e(e){this.camera=new sE,this.passState=new Lp(e),this.framebuffer=void 0,this.textureOffsets=void 0,this.commandList=[],this.cullingVolume=void 0}function Ov(e,t){return Ue.fromCache({cull:{enabled:!0,face:Qi.BACK},depthTest:{enabled:!0},colorMask:{red:e,green:e,blue:e,alpha:e},depthMask:!0,polygonOffset:{enabled:t.polygonOffset,factor:t.polygonOffsetFactor,units:t.polygonOffsetUnits}})}function O1(e){const t=!e._usesDepthTexture;e._primitiveRenderState=Ov(t,e._primitiveBias),e._terrainRenderState=Ov(t,e._terrainBias),e._pointRenderState=Ov(t,e._pointBias)}Wa.prototype.debugCreateRenderStates=function(){O1(this)};Object.defineProperties(Wa.prototype,{enabled:{get:function(){return this._enabled},set:function(e){this.dirty=this._enabled!==e,this._enabled=e}},normalOffset:{get:function(){return this._normalOffset},set:function(e){this.dirty=this._normalOffset!==e,this._normalOffset=e,this._terrainBias.normalOffset=e,this._primitiveBias.normalOffset=e,this._pointBias.normalOffset=e}},softShadows:{get:function(){return this._softShadows},set:function(e){this.dirty=this._softShadows!==e,this._softShadows=e}},size:{get:function(){return this._size},set:function(e){S3e(this,e)}},outOfView:{get:function(){return this._outOfView}},shadowMapCullingVolume:{get:function(){return this._shadowMapCullingVolume}},passes:{get:function(){return this._passes}},isPointLight:{get:function(){return this._isPointLight}},debugCascadeColors:{get:function(){return this._debugCascadeColors},set:function(e){this.dirty=this._debugCascadeColors!==e,this._debugCascadeColors=e}}});function L1(e){const t=e._passes.length;for(let n=0;n<t;++n){const i=e._passes[n],o=i.framebuffer;c(o)&&!o.isDestroyed()&&o.destroy(),i.framebuffer=void 0}e._depthAttachment=e._depthAttachment&&e._depthAttachment.destroy(),e._colorAttachment=e._colorAttachment&&e._colorAttachment.destroy()}function A3e(e,t){const n=new cl({context:t,width:e._textureSize.x,height:e._textureSize.y,format:qu.DEPTH_COMPONENT16}),i=new xt({context:t,width:e._textureSize.x,height:e._textureSize.y,pixelFormat:Ve.RGBA,pixelDatatype:Me.UNSIGNED_BYTE,sampler:un.NEAREST}),o=new ur({context:t,depthRenderbuffer:n,colorTextures:[i],destroyAttachments:!1}),r=e._passes.length;for(let s=0;s<r;++s){const a=e._passes[s];a.framebuffer=o,a.passState.framebuffer=o}e._shadowMapTexture=i,e._depthAttachment=n,e._colorAttachment=i}function x3e(e,t){const n=new xt({context:t,width:e._textureSize.x,height:e._textureSize.y,pixelFormat:Ve.DEPTH_STENCIL,pixelDatatype:Me.UNSIGNED_INT_24_8,sampler:un.NEAREST}),i=new ur({context:t,depthStencilTexture:n,destroyAttachments:!1}),o=e._passes.length;for(let r=0;r<o;++r){const s=e._passes[r];s.framebuffer=i,s.passState.framebuffer=i}e._shadowMapTexture=n,e._depthAttachment=n}function C3e(e,t){const n=new cl({context:t,width:e._textureSize.x,height:e._textureSize.y,format:qu.DEPTH_COMPONENT16}),i=new Sl({context:t,width:e._textureSize.x,height:e._textureSize.y,pixelFormat:Ve.RGBA,pixelDatatype:Me.UNSIGNED_BYTE,sampler:un.NEAREST}),o=[i.negativeX,i.negativeY,i.negativeZ,i.positiveX,i.positiveY,i.positiveZ];for(let r=0;r<6;++r){const s=new ur({context:t,depthRenderbuffer:n,colorTextures:[o[r]],destroyAttachments:!1}),a=e._passes[r];a.framebuffer=s,a.passState.framebuffer=s}e._shadowMapTexture=i,e._depthAttachment=n,e._colorAttachment=i}function VW(e,t){e._isPointLight?C3e(e,t):e._usesDepthTexture?x3e(e,t):A3e(e,t)}function E3e(e,t){e._usesDepthTexture&&e._passes[0].framebuffer.status!==J.FRAMEBUFFER_COMPLETE&&(e._usesDepthTexture=!1,O1(e),L1(e),VW(e,t))}function w3e(e,t){(!c(e._passes[0].framebuffer)||e._shadowMapTexture.width!==e._textureSize.x)&&(L1(e),VW(e,t),E3e(e,t),HW(e,t))}function HW(e,t,n){n=y(n,0),(e._isPointLight||n===0)&&(e._clearCommand.framebuffer=e._passes[n].framebuffer,e._clearCommand.execute(t,e._clearPassState))}function S3e(e,t){e._size=t;const n=e._passes,i=n.length,o=e._textureSize;if(e._isPointLight){t=pt.maximumCubeMapSize>=t?t:pt.maximumCubeMapSize,o.x=t,o.y=t;const r=new Re(0,0,t,t);n[0].passState.viewport=r,n[1].passState.viewport=r,n[2].passState.viewport=r,n[3].passState.viewport=r,n[4].passState.viewport=r,n[5].passState.viewport=r}else i===1?(t=pt.maximumTextureSize>=t?t:pt.maximumTextureSize,o.x=t,o.y=t,n[0].passState.viewport=new Re(0,0,t,t)):i===4&&(t=pt.maximumTextureSize>=t*2?t:pt.maximumTextureSize/2,o.x=t*2,o.y=t*2,n[0].passState.viewport=new Re(0,0,t,t),n[1].passState.viewport=new Re(t,0,t,t),n[2].passState.viewport=new Re(0,t,t,t),n[3].passState.viewport=new Re(t,t,t,t));e._clearPassState.viewport=new Re(0,0,o.x,o.y);for(let r=0;r<i;++r){const s=n[r],a=s.passState.viewport,l=a.x/o.x,u=a.y/o.y,h=a.width/o.x,f=a.height/o.y;s.textureOffsets=new L(h,0,0,l,0,f,0,u,0,0,1,0,0,0,0,1)}}const v3e=new Re;function I3e(e,t){let n;e._isPointLight?n=`uniform samplerCube shadowMap_textureCube;
|
|
in vec2 v_textureCoordinates;
|
|
void main()
|
|
{
|
|
vec2 uv = v_textureCoordinates;
|
|
vec3 dir;
|
|
|
|
if (uv.y < 0.5)
|
|
{
|
|
if (uv.x < 0.333)
|
|
{
|
|
dir.x = -1.0;
|
|
dir.y = uv.x * 6.0 - 1.0;
|
|
dir.z = uv.y * 4.0 - 1.0;
|
|
}
|
|
else if (uv.x < 0.666)
|
|
{
|
|
dir.y = -1.0;
|
|
dir.x = uv.x * 6.0 - 3.0;
|
|
dir.z = uv.y * 4.0 - 1.0;
|
|
}
|
|
else
|
|
{
|
|
dir.z = -1.0;
|
|
dir.x = uv.x * 6.0 - 5.0;
|
|
dir.y = uv.y * 4.0 - 1.0;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (uv.x < 0.333)
|
|
{
|
|
dir.x = 1.0;
|
|
dir.y = uv.x * 6.0 - 1.0;
|
|
dir.z = uv.y * 4.0 - 3.0;
|
|
}
|
|
else if (uv.x < 0.666)
|
|
{
|
|
dir.y = 1.0;
|
|
dir.x = uv.x * 6.0 - 3.0;
|
|
dir.z = uv.y * 4.0 - 3.0;
|
|
}
|
|
else
|
|
{
|
|
dir.z = 1.0;
|
|
dir.x = uv.x * 6.0 - 5.0;
|
|
dir.y = uv.y * 4.0 - 3.0;
|
|
}
|
|
}
|
|
|
|
float shadow = czm_unpackDepth(czm_textureCube(shadowMap_textureCube, dir));
|
|
out_FragColor = vec4(vec3(shadow), 1.0);
|
|
}
|
|
`:n=`uniform sampler2D shadowMap_texture;
|
|
in vec2 v_textureCoordinates;
|
|
void main()
|
|
{
|
|
${e._usesDepthTexture?` float shadow = texture(shadowMap_texture, v_textureCoordinates).r;
|
|
`:` float shadow = czm_unpackDepth(texture(shadowMap_texture, v_textureCoordinates));
|
|
`} out_FragColor = vec4(vec3(shadow), 1.0);
|
|
}
|
|
`;const i=t.createViewportQuadCommand(n,{uniformMap:{shadowMap_texture:function(){return e._shadowMapTexture},shadowMap_textureCube:function(){return e._shadowMapTexture}}});return i.pass=xe.OVERLAY,i}function D3e(e,t){const n=t.context,i=t.context.drawingBufferWidth,o=t.context.drawingBufferHeight,r=Math.min(i,o)*.3,s=v3e;s.x=i-r,s.y=0,s.width=r,s.height=r;let a=e._debugShadowViewCommand;c(a)||(a=I3e(e,n),e._debugShadowViewCommand=a),(!c(a.renderState)||!Re.equals(a.renderState.viewport,s))&&(a.renderState=Ue.fromCache({viewport:Re.clone(s)})),t.commandList.push(e._debugShadowViewCommand)}const wu=new Array(8);wu[0]=new te(-1,-1,-1,1);wu[1]=new te(1,-1,-1,1);wu[2]=new te(1,1,-1,1);wu[3]=new te(-1,1,-1,1);wu[4]=new te(-1,-1,1,1);wu[5]=new te(1,-1,1,1);wu[6]=new te(1,1,1,1);wu[7]=new te(-1,1,1,1);const mh=new L,R1=new Array(8);for(let e=0;e<8;++e)R1[e]=new te;function P3e(e,t){const n=new Gt({geometry:new Na({minimum:new d(-.5,-.5,-.5),maximum:new d(.5,.5,.5)}),attributes:{color:$t.fromColor(t)}}),i=new Gt({geometry:new Fh({radius:.5}),attributes:{color:$t.fromColor(t)}});return new Mt({geometryInstances:[n,i],appearance:new tn({translucent:!1,flat:!0}),asynchronous:!1,modelMatrix:e})}const O3e=[z.RED,z.GREEN,z.BLUE,z.MAGENTA],L3e=new d;function R3e(e,t){D3e(e,t);const n=e.debugFreezeFrame&&!e._debugFreezeFrame;if(e._debugFreezeFrame=e.debugFreezeFrame,e.debugFreezeFrame&&(n&&(e._debugCameraFrustum=e._debugCameraFrustum&&e._debugCameraFrustum.destroy(),e._debugCameraFrustum=new ph({camera:e._sceneCamera,color:z.CYAN,updateOnChange:!1})),e._debugCameraFrustum.update(t)),e._cascadesEnabled){if(e.debugFreezeFrame){n&&(e._debugLightFrustum=e._debugLightFrustum&&e._debugLightFrustum.destroy(),e._debugLightFrustum=new ph({camera:e._shadowMapCamera,color:z.YELLOW,updateOnChange:!1})),e._debugLightFrustum.update(t);for(let i=0;i<e._numberOfCascades;++i)n&&(e._debugCascadeFrustums[i]=e._debugCascadeFrustums[i]&&e._debugCascadeFrustums[i].destroy(),e._debugCascadeFrustums[i]=new ph({camera:e._passes[i].camera,color:O3e[i],updateOnChange:!1})),e._debugCascadeFrustums[i].update(t)}}else if(e._isPointLight){if(!c(e._debugLightFrustum)||e._needsUpdate){const i=e._shadowMapCamera.positionWC,o=_e.IDENTITY,r=e._pointLightRadius*2,s=d.fromElements(r,r,r,L3e),a=L.fromTranslationQuaternionRotationScale(i,o,s,mh);e._debugLightFrustum=e._debugLightFrustum&&e._debugLightFrustum.destroy(),e._debugLightFrustum=P3e(a,z.YELLOW)}e._debugLightFrustum.update(t)}else(!c(e._debugLightFrustum)||e._needsUpdate)&&(e._debugLightFrustum=new ph({camera:e._shadowMapCamera,color:z.YELLOW,updateOnChange:!1})),e._debugLightFrustum.update(t)}function sE(){this.viewMatrix=new L,this.inverseViewMatrix=new L,this.frustum=void 0,this.positionCartographic=new he,this.positionWC=new d,this.directionWC=d.clone(d.UNIT_Z),this.upWC=d.clone(d.UNIT_Y),this.rightWC=d.clone(d.UNIT_X),this.viewProjectionMatrix=new L}sE.prototype.clone=function(e){L.clone(e.viewMatrix,this.viewMatrix),L.clone(e.inverseViewMatrix,this.inverseViewMatrix),this.frustum=e.frustum.clone(this.frustum),he.clone(e.positionCartographic,this.positionCartographic),d.clone(e.positionWC,this.positionWC),d.clone(e.directionWC,this.directionWC),d.clone(e.upWC,this.upWC),d.clone(e.rightWC,this.rightWC)};const N3e=new L(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1);sE.prototype.getViewProjection=function(){const e=this.viewMatrix,t=this.frustum.projectionMatrix;return L.multiply(t,e,this.viewProjectionMatrix),L.multiply(N3e,this.viewProjectionMatrix,this.viewProjectionMatrix),this.viewProjectionMatrix};const M3e=new Array(5),F3e=new _n,B3e=new Array(4),GW=new d,jW=new d;function z3e(e,t){const n=e._shadowMapCamera,i=e._sceneCamera,o=i.frustum.near,r=i.frustum.far,s=e._numberOfCascades;let a;const l=r-o,u=r/o;let h=.9,f=!1;t.shadowState.closestObjectSize<200&&(f=!0,h=.9);const _=B3e,g=M3e;for(g[0]=o,g[s]=r,a=0;a<s;++a){const B=(a+1)/s,S=o*Math.pow(u,B),D=o+l*B,p=R.lerp(D,S,h);g[a+1]=p,_[a]=p-g[a]}if(f){for(a=0;a<s;++a)_[a]=Math.min(_[a],e._maximumCascadeDistances[a]);let B=g[0];for(a=0;a<s-1;++a)B+=_[a],g[a+1]=B}te.unpack(g,0,e._cascadeSplits[0]),te.unpack(g,1,e._cascadeSplits[1]),te.unpack(_,0,e._cascadeDistances);const m=n.frustum,b=m.left,T=m.right,x=m.bottom,C=m.top,w=m.near,v=m.far,P=n.positionWC,N=n.directionWC,k=n.upWC,M=i.frustum.clone(F3e),U=n.getViewProjection();for(a=0;a<s;++a){M.near=g[a],M.far=g[a+1];const B=L.multiply(M.projectionMatrix,i.viewMatrix,mh),S=L.inverse(B,mh),D=L.multiply(U,S,mh),p=d.fromElements(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,GW),I=d.fromElements(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,jW);for(let j=0;j<8;++j){const W=te.clone(wu[j],R1[j]);L.multiplyByVector(D,W,W),d.divideByScalar(W,W.w,W),d.minimumByComponent(W,p,p),d.maximumByComponent(W,I,I)}p.x=Math.max(p.x,0),p.y=Math.max(p.y,0),p.z=0,I.x=Math.min(I.x,1),I.y=Math.min(I.y,1),I.z=Math.min(I.z,1);const O=e._passes[a],F=O.camera;F.clone(n);const V=F.frustum;V.left=b+p.x*(T-b),V.right=b+I.x*(T-b),V.bottom=x+p.y*(C-x),V.top=x+I.y*(C-x),V.near=w+p.z*(v-w),V.far=w+I.z*(v-w),O.cullingVolume=F.frustum.computeCullingVolume(P,N,k);const G=e._cascadeMatrices[a];L.multiply(F.getViewProjection(),i.inverseViewMatrix,G),L.multiply(O.textureOffsets,G,G)}}const U3e=new L,k3e=new d,V3e=new d,B3=new d;function H3e(e,t){const n=e._shadowMapCamera,i=e._sceneCamera,o=L.multiply(i.frustum.projectionMatrix,i.viewMatrix,mh),r=L.inverse(o,mh),s=n.directionWC;let a=i.directionWC;d.equalsEpsilon(s,a,R.EPSILON10)&&(a=i.upWC);const l=d.cross(s,a,k3e);a=d.cross(l,s,V3e),d.normalize(a,a),d.normalize(l,l);const u=d.fromElements(0,0,0,B3);let h=L.computeView(u,s,a,l,U3e);const f=L.multiply(h,r,mh),_=d.fromElements(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,GW),g=d.fromElements(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,jW);for(let v=0;v<8;++v){const P=te.clone(wu[v],R1[v]);L.multiplyByVector(f,P,P),d.divideByScalar(P,P.w,P),d.minimumByComponent(P,_,_),d.maximumByComponent(P,g,g)}g.z+=1e3,_.z-=10;const m=B3;m.x=-(.5*(_.x+g.x)),m.y=-(.5*(_.y+g.y)),m.z=-g.z;const b=L.fromTranslation(m,mh);h=L.multiply(b,h,h);const T=.5*(g.x-_.x),x=.5*(g.y-_.y),C=g.z-_.z,w=n.frustum;w.left=-T,w.right=T,w.bottom=-x,w.top=x,w.near=.01,w.far=C,L.clone(h,n.viewMatrix),L.inverse(h,n.inverseViewMatrix),L.getTranslation(n.inverseViewMatrix,n.positionWC),t.mapProjection.ellipsoid.cartesianToCartographic(n.positionWC,n.positionCartographic),d.clone(s,n.directionWC),d.clone(a,n.upWC),d.clone(l,n.rightWC)}const G3e=[new d(-1,0,0),new d(0,-1,0),new d(0,0,-1),new d(1,0,0),new d(0,1,0),new d(0,0,1)],j3e=[new d(0,-1,0),new d(0,0,-1),new d(0,-1,0),new d(0,-1,0),new d(0,0,1),new d(0,-1,0)],W3e=[new d(0,0,1),new d(1,0,0),new d(-1,0,0),new d(0,0,-1),new d(1,0,0),new d(1,0,0)];function q3e(e,t){const n=new _n;n.fov=R.PI_OVER_TWO,n.near=1,n.far=e._pointLightRadius,n.aspectRatio=1;for(let i=0;i<6;++i){const o=e._passes[i].camera;o.positionWC=e._shadowMapCamera.positionWC,o.positionCartographic=t.mapProjection.ellipsoid.cartesianToCartographic(o.positionWC,o.positionCartographic),o.directionWC=G3e[i],o.upWC=j3e[i],o.rightWC=W3e[i],L.computeView(o.positionWC,o.directionWC,o.upWC,o.rightWC,o.viewMatrix),L.inverse(o.viewMatrix,o.inverseViewMatrix),o.frustum=n}}const Y3e=new d,$3e=new d,WW=new se,z3=WW.center;function X3e(e,t){const n=e._sceneCamera,i=e._shadowMapCamera,o=WW;if(e._cascadesEnabled){if(n.frustum.near>=e.maximumDistance){e._outOfView=!0,e._needsUpdate=!1;return}const r=t.mapProjection.ellipsoid.geodeticSurfaceNormal(n.positionWC,Y3e),s=d.negate(i.directionWC,$3e),a=d.dot(r,s);if(e.fadingEnabled){const l=R.clamp(a/.1,0,1);e._darkness=R.lerp(1,e.darkness,l)}else e._darkness=e.darkness;if(a<0){e._outOfView=!0,e._needsUpdate=!1;return}e._needsUpdate=!0,e._outOfView=!1}else if(e._isPointLight)o.center=i.positionWC,o.radius=e._pointLightRadius,e._outOfView=t.cullingVolume.computeVisibility(o)===Bt.OUTSIDE,e._needsUpdate=!e._outOfView&&!e._boundingSphere.equals(o),se.clone(o,e._boundingSphere);else{const r=i.frustum.far/2,s=d.add(i.positionWC,d.multiplyByScalar(i.directionWC,r,z3),z3);o.center=s,o.radius=r,e._outOfView=t.cullingVolume.computeVisibility(o)===Bt.OUTSIDE,e._needsUpdate=!e._outOfView&&!e._boundingSphere.equals(o),se.clone(o,e._boundingSphere)}}function Q3e(e,t){const n=t.camera,i=e._lightCamera,o=e._sceneCamera,r=e._shadowMapCamera;e._cascadesEnabled?d.clone(i.directionWC,r.directionWC):e._isPointLight?d.clone(i.positionWC,r.positionWC):r.clone(i);const s=e._lightDirectionEC;L.multiplyByPointAsVector(n.viewMatrix,r.directionWC,s),d.normalize(s,s),d.negate(s,s),L.multiplyByPoint(n.viewMatrix,r.positionWC,e._lightPositionEC),e._lightPositionEC.w=e._pointLightRadius;let a,l;e._fitNearFar?(a=Math.min(t.shadowState.nearPlane,e.maximumDistance),l=Math.min(t.shadowState.farPlane,e.maximumDistance),l=Math.max(l,a+1)):(a=n.frustum.near,l=e.maximumDistance),e._sceneCamera=Ye.clone(n,o),n.frustum.clone(e._sceneCamera.frustum),e._sceneCamera.frustum.near=a,e._sceneCamera.frustum.far=l,e._distance=l-a,X3e(e,t),!e._outOfViewPrevious&&e._outOfView&&(e._needsUpdate=!0),e._outOfViewPrevious=e._outOfView}Wa.prototype.update=function(e){if(Q3e(this,e),this._needsUpdate)if(w3e(this,e.context),this._isPointLight&&q3e(this,e),this._cascadesEnabled&&(H3e(this,e),this._numberOfCascades>1&&z3e(this,e)),this._isPointLight)this._shadowMapCullingVolume=_o.fromBoundingSphere(this._boundingSphere);else{const t=this._shadowMapCamera,n=t.positionWC,i=t.directionWC,o=t.upWC;this._shadowMapCullingVolume=t.frustum.computeCullingVolume(n,i,o),this._passes.length===1&&this._passes[0].camera.clone(t)}if(this._passes.length===1){const t=this._sceneCamera.inverseViewMatrix;L.multiply(this._shadowMapCamera.getViewProjection(),t,this._shadowMapMatrix)}this.debugShow&&R3e(this,e)};Wa.prototype.updatePass=function(e,t){HW(this,e,t)};const K3e=new H;function qW(e,t,n){const i=e._isPointLight?e._pointBias:n?e._terrainBias:e._primitiveBias,o={shadowMap_texture:function(){return e._shadowMapTexture},shadowMap_textureCube:function(){return e._shadowMapTexture},shadowMap_matrix:function(){return e._shadowMapMatrix},shadowMap_cascadeSplits:function(){return e._cascadeSplits},shadowMap_cascadeMatrices:function(){return e._cascadeMatrices},shadowMap_lightDirectionEC:function(){return e._lightDirectionEC},shadowMap_lightPositionEC:function(){return e._lightPositionEC},shadowMap_cascadeDistances:function(){return e._cascadeDistances},shadowMap_texelSizeDepthBiasAndNormalShadingSmooth:function(){const r=K3e;return r.x=1/e._textureSize.x,r.y=1/e._textureSize.y,te.fromElements(r.x,r.y,i.depthBias,i.normalShadingSmooth,this.combinedUniforms1)},shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness:function(){return te.fromElements(i.normalOffsetScale,e._distance,e.maximumDistance,e._darkness,this.combinedUniforms2)},combinedUniforms1:new te,combinedUniforms2:new te};return jt(t,o,!1)}function Z3e(e,t,n,i,o,r){let s,a,l;if(c(r)&&(s=r.shaderProgram,a=r.renderState,l=r.uniformMap),r=Ze.shallowClone(n,r),r.castShadows=!0,r.receiveShadows=!1,!c(s)||o!==n.shaderProgram.id||t){const u=n.shaderProgram,h=n.pass===xe.GLOBE,f=n.pass!==xe.TRANSLUCENT,_=e._isPointLight,g=e._usesDepthTexture,m=bc.getShadowCastShaderKeyword(_,h,g,f);if(s=i.shaderCache.getDerivedShaderProgram(u,m),!c(s)){const T=u.vertexShaderSource,x=u.fragmentShaderSource,C=bc.createShadowCastVertexShader(T,_,h),w=bc.createShadowCastFragmentShader(x,_,g,f);s=i.shaderCache.createDerivedShaderProgram(u,m,{vertexShaderSource:C,fragmentShaderSource:w,attributeLocations:u._attributeLocations})}a=e._primitiveRenderState,_?a=e._pointRenderState:h&&(a=e._terrainRenderState),n.renderState.cull.enabled||(a=Je(a,!1),a.cull=Je(a.cull,!1),a.cull.enabled=!1,a=Ue.fromCache(a)),l=qW(e,n.uniformMap,h)}return r.shaderProgram=s,r.renderState=a,r.uniformMap=l,r}Wa.createReceiveDerivedCommand=function(e,t,n,i,o){c(o)||(o={});const r=e.length>0,s=t.shaderProgram,a=s.vertexShaderSource,l=s.fragmentShaderSource,u=t.pass===xe.GLOBE;let h=!1;if(u&&(h=t.owner.data.renderedMesh.encoding.hasVertexNormals),t.receiveShadows&&r){let f,_;c(o.receiveCommand)&&(f=o.receiveCommand.shaderProgram,_=o.receiveCommand.uniformMap),o.receiveCommand=Ze.shallowClone(t,o.receiveCommand),o.castShadows=!1,o.receiveShadows=!0;const g=o.receiveShaderCastShadows!==t.castShadows,m=o.receiveShaderProgramId!==t.shaderProgram.id;if(!c(f)||m||n||g){const b=bc.getShadowReceiveShaderKeyword(e[0],t.castShadows,u,h);if(f=i.shaderCache.getDerivedShaderProgram(s,b),!c(f)){const T=bc.createShadowReceiveVertexShader(a,u,h),x=bc.createShadowReceiveFragmentShader(l,e[0],t.castShadows,u,h);f=i.shaderCache.createDerivedShaderProgram(s,b,{vertexShaderSource:T,fragmentShaderSource:x,attributeLocations:s._attributeLocations})}_=qW(e[0],t.uniformMap,u)}o.receiveCommand.shaderProgram=f,o.receiveCommand.uniformMap=_,o.receiveShaderProgramId=t.shaderProgram.id,o.receiveShaderCastShadows=t.castShadows}return o};Wa.createCastDerivedCommand=function(e,t,n,i,o){if(c(o)||(o={}),t.castShadows){let r=o.castCommands;c(r)||(r=o.castCommands=[]);const s=o.castShaderProgramId,a=e.length;r.length=a;for(let l=0;l<a;++l)r[l]=Z3e(e[l],n,t,i,s,r[l]);o.castShaderProgramId=t.shaderProgram.id}return o};Wa.prototype.isDestroyed=function(){return!1};Wa.prototype.destroy=function(){L1(this),this._debugLightFrustum=this._debugLightFrustum&&this._debugLightFrustum.destroy(),this._debugCameraFrustum=this._debugCameraFrustum&&this._debugCameraFrustum.destroy(),this._debugShadowViewCommand=this._debugShadowViewCommand&&this._debugShadowViewCommand.shaderProgram&&this._debugShadowViewCommand.shaderProgram.destroy();for(let e=0;e<this._numberOfCascades;++e)this._debugCascadeFrustums[e]=this._debugCascadeFrustums[e]&&this._debugCascadeFrustums[e].destroy();return ve(this)};const Lv=`uniform sampler2D colorTexture;
|
|
|
|
#ifdef DEBUG_SHOW_DEPTH
|
|
uniform sampler2D u_packedTranslucentDepth;
|
|
#endif
|
|
|
|
in vec2 v_textureCoordinates;
|
|
|
|
void main()
|
|
{
|
|
#ifdef DEBUG_SHOW_DEPTH
|
|
if (v_textureCoordinates.x < 0.5)
|
|
{
|
|
out_FragColor.rgb = vec3(czm_unpackDepth(texture(u_packedTranslucentDepth, v_textureCoordinates)));
|
|
out_FragColor.a = 1.0;
|
|
}
|
|
#else
|
|
vec4 color = texture(colorTexture, v_textureCoordinates);
|
|
|
|
#ifdef PICK
|
|
if (color == vec4(0.0))
|
|
{
|
|
discard;
|
|
}
|
|
#else
|
|
// Reverse premultiplication process to get the correct composited result of the classification primitives
|
|
color.rgb /= color.a;
|
|
#endif
|
|
out_FragColor = color;
|
|
#endif
|
|
}
|
|
`;function rf(e){this._drawClassificationFBO=new on({createDepthAttachments:!1}),this._accumulationFBO=new on({createDepthAttachments:!1}),this._packFBO=new on,this._opaqueDepthStencilTexture=void 0,this._textureToComposite=void 0,this._translucentDepthStencilTexture=void 0,this._packDepthCommand=void 0,this._accumulateCommand=void 0,this._compositeCommand=void 0,this._copyCommand=void 0,this._clearColorCommand=new bi({color:new z(0,0,0,0),owner:this}),this._clearDepthStencilCommand=new bi({depth:1,stencil:0,owner:this}),this._supported=e.depthTexture,this._viewport=new Re,this._rsDepth=void 0,this._rsAccumulate=void 0,this._rsComp=void 0,this._useScissorTest=void 0,this._scissorRectangle=void 0,this._hasTranslucentDepth=!1,this._frustumsDrawn=0}Object.defineProperties(rf.prototype,{hasTranslucentDepth:{get:function(){return this._hasTranslucentDepth}}});function YW(e){e._textureToComposite=void 0,e._translucentDepthStencilTexture=e._translucentDepthStencilTexture&&!e._translucentDepthStencilTexture.isDestroyed()&&e._translucentDepthStencilTexture.destroy()}function $W(e){e._drawClassificationFBO.destroy(),e._accumulationFBO.destroy(),e._packFBO.destroy()}function J3e(e,t,n,i){YW(e),e._translucentDepthStencilTexture=new xt({context:t,width:n,height:i,pixelFormat:Ve.DEPTH_STENCIL,pixelDatatype:Me.UNSIGNED_INT_24_8,sampler:un.NEAREST})}function eze(e,t,n,i){$W(e),e._drawClassificationFBO.setDepthStencilTexture(e._translucentDepthStencilTexture),e._drawClassificationFBO.update(t,n,i),e._accumulationFBO.setDepthStencilTexture(e._translucentDepthStencilTexture),e._accumulationFBO.update(t,n,i),e._packFBO.update(t,n,i)}function tze(e,t,n,i){if(!e.isSupported())return;e._opaqueDepthStencilTexture=i;const o=e._opaqueDepthStencilTexture.width,r=e._opaqueDepthStencilTexture.height;e._drawClassificationFBO.isDirty(o,r)&&(J3e(e,t,o,r),eze(e,t,o,r));let s,a;if(c(e._packDepthCommand)||(s=new Oe({sources:[I1e]}),a={u_opaqueDepthTexture:function(){return e._opaqueDepthStencilTexture},u_translucentDepthTexture:function(){return e._translucentDepthStencilTexture}},e._packDepthCommand=t.createViewportQuadCommand(s,{uniformMap:a,owner:e})),!c(e._compositeCommand)){s=new Oe({sources:[Lv]}),a={colorTexture:function(){return e._textureToComposite}},e._compositeCommand=t.createViewportQuadCommand(s,{uniformMap:a,owner:e});const h=e._compositeCommand,f=h.shaderProgram,_=t.shaderCache.createDerivedShaderProgram(f,"pick",{vertexShaderSource:f.vertexShaderSource,fragmentShaderSource:new Oe({sources:s.sources,defines:["PICK"]}),attributeLocations:f._attributeLocations}),g=Ze.shallowClone(h);g.shaderProgram=_,h.derivedCommands.pick=g}c(e._copyCommand)||(s=new Oe({sources:[Lv]}),a={colorTexture:function(){return e._drawClassificationFBO.getColorTexture()}},e._copyCommand=t.createViewportQuadCommand(s,{uniformMap:a,owner:e})),c(e._accumulateCommand)||(s=new Oe({sources:[Lv]}),a={colorTexture:function(){return e._drawClassificationFBO.getColorTexture()}},e._accumulateCommand=t.createViewportQuadCommand(s,{uniformMap:a,owner:e})),e._viewport.width=o,e._viewport.height=r;const l=!Re.equals(e._viewport,n.viewport);let u=l!==e._useScissorTest;e._useScissorTest=l,Re.equals(e._scissorRectangle,n.viewport)||(e._scissorRectangle=Re.clone(n.viewport,e._scissorRectangle),u=!0),(!c(e._rsDepth)||!Re.equals(e._viewport,e._rsDepth.viewport)||u)&&(e._rsDepth=Ue.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle}})),c(e._packDepthCommand)&&(e._packDepthCommand.renderState=e._rsDepth),(!c(e._rsAccumulate)||!Re.equals(e._viewport,e._rsAccumulate.viewport)||u)&&(e._rsAccumulate=Ue.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle},stencilTest:{enabled:!0,frontFunction:Pn.EQUAL,reference:At.CESIUM_3D_TILE_MASK}})),c(e._accumulateCommand)&&(e._accumulateCommand.renderState=e._rsAccumulate),(!c(e._rsComp)||!Re.equals(e._viewport,e._rsComp.viewport)||u)&&(e._rsComp=Ue.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle},blending:Zn.ALPHA_BLEND})),c(e._compositeCommand)&&(e._compositeCommand.renderState=e._rsComp,e._compositeCommand.derivedCommands.pick.renderState=e._rsComp)}rf.prototype.executeTranslucentCommands=function(e,t,n,i,o){const r=i.length;let s,a;const l=e.frameState.useLogDepth,u=e.context,h=n.framebuffer;for(a=0;a<r;++a)if(s=i[a],s=l?s.derivedCommands.logDepth.command:s,s.depthForTranslucentClassification){this._hasTranslucentDepth=!0;break}if(!!this._hasTranslucentDepth){for(tze(this,u,n,o),n.framebuffer=this._drawClassificationFBO.framebuffer,this._clearDepthStencilCommand.execute(u,n),a=0;a<r;++a){if(s=i[a],s=l?s.derivedCommands.logDepth.command:s,!s.depthForTranslucentClassification)continue;const f=s.derivedCommands.depth.depthOnlyCommand;t(f,e,u,n)}this._frustumsDrawn+=this._hasTranslucentDepth?1:0,this._hasTranslucentDepth&&(n.framebuffer=this._packFBO.framebuffer,this._packDepthCommand.execute(u,n)),n.framebuffer=h}};rf.prototype.executeClassificationCommands=function(e,t,n,i){if(!this._hasTranslucentDepth)return;const o=e.context,r=o.uniformState,s=n.framebuffer;this._frustumsDrawn===2&&(n.framebuffer=this._accumulationFBO.framebuffer,this._copyCommand.execute(o,n)),n.framebuffer=this._drawClassificationFBO.framebuffer,this._frustumsDrawn>1&&this._clearColorCommand.execute(o,n),r.updatePass(xe.CESIUM_3D_TILE_CLASSIFICATION);const a=r.globeDepthTexture;r.globeDepthTexture=this._packFBO.getColorTexture();const l=i.commands[xe.CESIUM_3D_TILE_CLASSIFICATION],u=i.indices[xe.CESIUM_3D_TILE_CLASSIFICATION];for(let h=0;h<u;++h)t(l[h],e,o,n);r.globeDepthTexture=a,n.framebuffer=s,this._frustumsDrawn!==1&&(n.framebuffer=this._accumulationFBO.framebuffer,this._accumulateCommand.execute(o,n),n.framebuffer=s)};rf.prototype.execute=function(e,t){if(!this._hasTranslucentDepth)return;this._frustumsDrawn===1?this._textureToComposite=this._drawClassificationFBO.getColorTexture():this._textureToComposite=this._accumulationFBO.getColorTexture(),(e.frameState.passes.pick?this._compositeCommand.derivedCommands.pick:this._compositeCommand).execute(e.context,t),nze(this,e,t)};function nze(e,t,n){if(!e._hasTranslucentDepth)return;const i=n.framebuffer;n.framebuffer=e._drawClassificationFBO.framebuffer,e._clearColorCommand.execute(t._context,n),n.framebuffer=i,e._frustumsDrawn>1&&(n.framebuffer=e._accumulationFBO.framebuffer,e._clearColorCommand.execute(t._context,n)),e._hasTranslucentDepth=!1,e._frustumsDrawn=0}rf.prototype.isSupported=function(){return this._supported};rf.prototype.isDestroyed=function(){return!1};rf.prototype.destroy=function(){return YW(this),$W(this),c(this._compositeCommand)&&(this._compositeCommand.shaderProgram=this._compositeCommand.shaderProgram&&this._compositeCommand.shaderProgram.destroy()),c(this._packDepthCommand)&&(this._packDepthCommand.shaderProgram=this._packDepthCommand.shaderProgram&&this._packDepthCommand.shaderProgram.destroy()),ve(this)};function ize(){this.command=void 0,this.near=void 0,this.far=void 0}function db(e,t,n){const i=e.context;let o;i.depthTexture&&(o=new Cu);let r;e._useOIT&&i.depthTexture&&(r=new Pd(i));const s=new Lp(i);s.viewport=Re.clone(n),this.camera=t,this._cameraClone=Ye.clone(t),this._cameraStartFired=!1,this._cameraMovedTime=void 0,this.viewport=n,this.passState=s,this.pickFramebuffer=new rg(i),this.pickDepthFramebuffer=new ub,this.sceneFramebuffer=new Eu,this.globeDepth=o,this.globeTranslucencyFramebuffer=new Yp,this.oit=r,this.translucentTileClassification=new rf(i),this.pickDepths=[],this.frustumCommandsList=[],this.debugFrustumStatistics=void 0,this._commandExtents=[]}const U3=new d,k3=new d;function oze(e,t){const n=Math.max(Math.abs(e.x),Math.abs(t.x)),i=Math.max(Math.abs(e.y),Math.abs(t.y)),o=Math.max(Math.abs(e.z),Math.abs(t.z));return Math.max(Math.max(n,i),o)}function rze(e,t,n){const i=1/Math.max(1,oze(e.position,t.position));return d.multiplyByScalar(e.position,i,U3),d.multiplyByScalar(t.position,i,k3),d.equalsEpsilon(U3,k3,n)&&d.equalsEpsilon(e.direction,t.direction,n)&&d.equalsEpsilon(e.up,t.up,n)&&d.equalsEpsilon(e.right,t.right,n)&&L.equalsEpsilon(e.transform,t.transform,n)&&e.frustum.equalsEpsilon(t.frustum,n)}db.prototype.checkForCameraUpdates=function(e){const t=this.camera,n=this._cameraClone;return rze(t,n,R.EPSILON15)?(this._cameraStartFired&&xo()-this._cameraMovedTime>e.cameraEventWaitTime&&(t.moveEnd.raiseEvent(),this._cameraStartFired=!1),!1):(this._cameraStartFired||(t.moveStart.raiseEvent(),this._cameraStartFired=!0),this._cameraMovedTime=xo(),Ye.clone(t,n),!0)};function sze(e,t,n,i){const o=t.frameState,r=o.camera,s=o.useLogDepth?t.logarithmicDepthFarToNearRatio:t.farToNearRatio,a=t.mode===oe.SCENE2D,l=t.nearToFarDistance2D;i*=1+R.EPSILON2,n=Math.min(Math.max(n,r.frustum.near),r.frustum.far),i=Math.max(Math.min(i,r.frustum.far),n);let u;a?(i=Math.min(i,r.position.z+t.nearToFarDistance2D),n=Math.min(n,i),u=Math.ceil(Math.max(1,i-n)/t.nearToFarDistance2D)):u=Math.ceil(Math.log(i/n)/Math.log(s));const h=e.frustumCommandsList;h.length=u;for(let f=0;f<u;++f){let _,g;a?(_=Math.min(i-l,n+f*l),g=Math.min(i,_+l)):(_=Math.max(n,Math.pow(s,f)*n),g=Math.min(i,s*_));let m=h[f];c(m)?(m.near=_,m.far=g):m=h[f]=new QBe(_,g)}}function aze(e,t,n,i,o){t.debugShowFrustums&&(n.debugOverlappingFrustums=0);const r=e.frustumCommandsList,s=r.length;for(let a=0;a<s;++a){const l=r[a],u=l.near,h=l.far;if(i>h)continue;if(o<u)break;const f=n.pass,_=l.indices[f]++;if(l.commands[f][_]=n,t.debugShowFrustums&&(n.debugOverlappingFrustums|=1<<a),n.executeInClosestFrustum)break}if(t.debugShowFrustums){const a=e.debugFrustumStatistics.commandsInFrustums;a[n.debugOverlappingFrustums]=c(a[n.debugOverlappingFrustums])?a[n.debugOverlappingFrustums]+1:1,++e.debugFrustumStatistics.totalCommands}t.updateDerivedCommands(n)}const V3=new _o,cze=new Yu;db.prototype.createPotentiallyVisibleSet=function(e){const t=e.frameState,n=t.camera,i=n.directionWC,o=n.positionWC,r=e._computeCommandList,s=e._overlayCommandList,a=t.commandList;e.debugShowFrustums&&(this.debugFrustumStatistics={totalCommands:0,commandsInFrustums:{}});const l=this.frustumCommandsList,u=l.length,h=xe.NUMBER_OF_PASSES;for(let D=0;D<u;++D)for(let p=0;p<h;++p)l[D].indices[p]=0;r.length=0,s.length=0;const f=this._commandExtents,_=f.length;let g=0,m=+Number.MAX_VALUE,b=-Number.MAX_VALUE;const T=t.shadowState.shadowsEnabled;let x=+Number.MAX_VALUE,C=-Number.MAX_VALUE,w=Number.MAX_VALUE;const v=t.mode===oe.SCENE3D?t.occluder:void 0;let P=t.cullingVolume;const N=V3.planes;for(let D=0;D<5;++D)N[D]=P.planes[D];P=V3;const k=a.length;for(let D=0;D<k;++D){const p=a[D],I=p.pass;if(I===xe.COMPUTE)r.push(p);else if(I===xe.OVERLAY)s.push(p);else{let O,F;const V=p.boundingVolume;if(c(V)){if(!e.isVisible(p,P,v))continue;const j=V.computePlaneDistances(o,i,cze);if(O=j.start,F=j.stop,m=Math.min(m,O),b=Math.max(b,F),T&&p.receiveShadows&&O<Wa.MAXIMUM_DISTANCE&&!(I===xe.GLOBE&&O<-100&&F>100)){const W=F-O;I!==xe.GLOBE&&O<100&&(w=Math.min(w,W)),x=Math.min(x,O),C=Math.max(C,F)}}else p instanceof bi?(O=n.frustum.near,F=n.frustum.far):(O=n.frustum.near,F=n.frustum.far,m=Math.min(m,O),b=Math.max(b,F));let G=f[g];c(G)||(G=f[g]=new ize),G.command=p,G.near=O,G.far=F,g++}}T&&(x=Math.min(Math.max(x,n.frustum.near),n.frustum.far),C=Math.max(Math.min(C,n.frustum.far),x)),T&&(t.shadowState.nearPlane=x,t.shadowState.farPlane=C,t.shadowState.closestObjectSize=w),sze(this,e,m,b);let M,U;for(M=0;M<g;M++)U=f[M],aze(this,e,U.command,U.near,U.far);if(g<_)for(M=g;M<_&&(U=f[M],!!c(U.command));M++)U.command=void 0;const B=l.length,S=t.frustumSplits;S.length=B+1;for(let D=0;D<B;++D)S[D]=l[D].near,D===B-1&&(S[D+1]=l[D].far)};db.prototype.destroy=function(){this.pickFramebuffer=this.pickFramebuffer&&this.pickFramebuffer.destroy(),this.pickDepthFramebuffer=this.pickDepthFramebuffer&&this.pickDepthFramebuffer.destroy(),this.sceneFramebuffer=this.sceneFramebuffer&&this.sceneFramebuffer.destroy(),this.globeDepth=this.globeDepth&&this.globeDepth.destroy(),this.oit=this.oit&&this.oit.destroy(),this.translucentTileClassification=this.translucentTileClassification&&this.translucentTileClassification.destroy(),this.globeTranslucencyFramebuffer=this.globeTranslucencyFramebuffer&&this.globeTranslucencyFramebuffer.destroy();let e;const t=this.pickDepths,n=t.length;for(e=0;e<n;++e)t[e].destroy()};const XW=.1,lze=new jp({pass:wr.MOST_DETAILED_PRELOAD}),uze=new jp({pass:wr.MOST_DETAILED_PICK}),aE=new jp({pass:wr.PICK});function Or(e){this._mostDetailedRayPicks=[],this.pickRenderStateCache={},this._pickPositionCache={},this._pickPositionCacheDirty=!1;const t=new Re(0,0,1,1),n=new Ye(e);n.frustum=new It({width:XW,aspectRatio:1,near:.1}),this._pickOffscreenView=new db(e,n,t)}Or.prototype.update=function(){this._pickPositionCacheDirty=!0};Or.prototype.getPickDepth=function(e,t){const n=e.view.pickDepths;let i=n[t];return c(i)||(i=new qp,n[t]=i),i};const dze=new Ki,hze=new d,mA=new d,fze=new H,pze=new L;function mze(e,t,n,i,o){const r=e.camera;let s=r.frustum;const a=s.offCenterFrustum;c(a)&&(s=a);let l=2*(t.x-o.x)/o.width-1;l*=(s.right-s.left)*.5;let u=2*(o.height-t.y-o.y)/o.height-1;u*=(s.top-s.bottom)*.5;const h=L.clone(r.transform,pze);r._setTransform(L.IDENTITY);const f=d.clone(r.position,hze);d.multiplyByScalar(r.right,l,mA),d.add(mA,f,f),d.multiplyByScalar(r.up,u,mA),d.add(mA,f,f),r._setTransform(h),e.mode===oe.SCENE2D&&d.fromElements(f.z,f.x,f.y,f);const _=s.getPixelDimensions(o.width,o.height,1,1,fze),g=dze;return g.right=_.x*.5,g.left=-g.right,g.top=_.y*.5,g.bottom=-g.top,g.near=s.near,g.far=s.far,g.computeCullingVolume(f,r.directionWC,r.upWC)}const _ze=new xs,gze=new H;function yze(e,t,n,i,o){const r=e.camera,s=r.frustum,a=s.near,l=Math.tan(s.fovy*.5),u=s.aspectRatio*l,h=2*(t.x-o.x)/o.width-1,f=2*(o.height-t.y-o.y)/o.height-1,_=h*a*u,g=f*a*l,m=s.getPixelDimensions(o.width,o.height,1,1,gze),b=m.x*n*.5,T=m.y*i*.5,x=_ze;return x.top=g+T,x.bottom=g-T,x.right=_+b,x.left=_-b,x.near=a,x.far=s.far,x.computeCullingVolume(r.positionWC,r.directionWC,r.upWC)}function N1(e,t,n,i,o){const r=e.camera.frustum;return r instanceof It||r instanceof Ki?mze(e,t,n,i,o):yze(e,t,n,i,o)}let al=3,$u=3,ls=new Re(0,0,al,$u);const M1=new H,cE=new z(0,0,0,0);Or.prototype.pick=function(e,t,n,i){A.defined("windowPosition",t),al=y(n,3),$u=y(i,al);const{context:o,frameState:r,defaultView:s}=e,{viewport:a,pickFramebuffer:l}=s;e.view=s,a.x=0,a.y=0,a.width=o.drawingBufferWidth,a.height=o.drawingBufferHeight;let u=s.passState;u.viewport=Re.clone(a,u.viewport);const h=Ao.transformWindowToDrawingBuffer(e,t,M1);e.jobScheduler.disableThisFrame(),e.updateFrameState(),r.cullingVolume=N1(e,h,al,$u,a),r.invertClassification=!1,r.passes.pick=!0,r.tilesetPassState=aE,o.uniformState.update(r),e.updateEnvironment(),ls.x=h.x-(al-1)*.5,ls.y=e.drawingBufferHeight-h.y-($u-1)*.5,ls.width=al,ls.height=$u,u=l.begin(ls,a),e.updateAndExecuteCommands(u,cE),e.resolveFramebuffers(u);const f=l.end(ls);return o.endFrame(),f};Or.prototype.pickVoxelCoordinate=function(e,t,n,i){A.defined("windowPosition",t),al=y(n,3),$u=y(i,al);const{context:o,frameState:r,defaultView:s}=e,{viewport:a,pickFramebuffer:l}=s;e.view=s,a.x=0,a.y=0,a.width=o.drawingBufferWidth,a.height=o.drawingBufferHeight;let u=s.passState;u.viewport=Re.clone(a,u.viewport);const h=Ao.transformWindowToDrawingBuffer(e,t,M1);e.jobScheduler.disableThisFrame(),e.updateFrameState(),r.cullingVolume=N1(e,h,al,$u,a),r.invertClassification=!1,r.passes.pickVoxel=!0,r.tilesetPassState=aE,o.uniformState.update(r),e.updateEnvironment(),ls.x=h.x-(al-1)*.5,ls.y=e.drawingBufferHeight-h.y-($u-1)*.5,ls.width=al,ls.height=$u,u=l.begin(ls,a),e.updateAndExecuteCommands(u,cE),e.resolveFramebuffers(u);const f=l.readVoxelInfo(ls);return o.endFrame(),f};function bze(e,t){const{defaultView:n,context:i,frameState:o,environmentState:r}=e,{viewport:s,pickDepthFramebuffer:a}=n;e.view=n,s.x=0,s.y=0,s.width=i.drawingBufferWidth,s.height=i.drawingBufferHeight;let l=n.passState;l.viewport=Re.clone(s,l.viewport),e.clearPasses(o.passes),o.passes.pick=!0,o.passes.depth=!0,o.cullingVolume=N1(e,t,1,1,s),o.tilesetPassState=aE,e.updateEnvironment(),r.renderTranslucentDepthForPick=!0,l=a.update(i,t,s),e.updateAndExecuteCommands(l,cE),e.resolveFramebuffers(l),i.endFrame()}const Tze=new _n,Aze=new xs,xze=new It,Cze=new Ki;Or.prototype.pickPositionWorldCoordinates=function(e,t,n){if(!e.useDepthPicking)return;if(A.defined("windowPosition",t),!e.context.depthTexture)throw new E("Picking from the depth buffer is not supported. Check pickPositionSupported.");const i=t.toString();if(this._pickPositionCacheDirty)this._pickPositionCache={},this._pickPositionCacheDirty=!1;else if(this._pickPositionCache.hasOwnProperty(i))return d.clone(this._pickPositionCache[i],n);const{context:o,frameState:r,camera:s,defaultView:a}=e,{uniformState:l}=o;e.view=a;const u=Ao.transformWindowToDrawingBuffer(e,t,M1);e.pickTranslucentDepth?bze(e,u):(e.updateFrameState(),l.update(r),e.updateEnvironment()),u.y=e.drawingBufferHeight-u.y;let h;c(s.frustum.fov)?h=s.frustum.clone(Tze):c(s.frustum.infiniteProjectionMatrix)?h=s.frustum.clone(Aze):c(s.frustum.width)?h=s.frustum.clone(xze):h=s.frustum.clone(Cze);const f=a.frustumCommandsList,_=f.length;for(let g=0;g<_;++g){const b=this.getPickDepth(e,g).getDepth(o,u.x,u.y);if(!!c(b)&&b>0&&b<1){const T=f[g];let x;return e.mode===oe.SCENE2D?(x=s.position.z,s.position.z=x-T.near+1,h.far=Math.max(1,T.far-T.near),h.near=1,l.update(r),l.updateFrustum(h)):(h.near=T.near*(g!==0?e.opaqueFrustumNearOffset:1),h.far=T.far,l.updateFrustum(h)),n=Ao.drawingBufferToWgs84Coordinates(e,u,b,n),e.mode===oe.SCENE2D&&(s.position.z=x,l.update(r)),this._pickPositionCache[i]=d.clone(n),n}}this._pickPositionCache[i]=void 0};const Eze=new he;Or.prototype.pickPosition=function(e,t,n){if(n=this.pickPositionWorldCoordinates(e,t,n),c(n)&&e.mode!==oe.SCENE3D){d.fromElements(n.y,n.z,n.x,n);const i=e.mapProjection,o=i.ellipsoid,r=i.unproject(n,Eze);o.cartographicToCartesian(r,n)}return n};function QW(e,t){let n,i;const o=[],r=[],s=[],a=[];c(e)||(e=Number.MAX_VALUE);let l=t();for(;c(l);){const u=l.object,h=l.position,f=l.exclude;if(c(h)&&!c(u)){o.push(l);break}if(!c(u)||!c(u.primitive)||!f&&(o.push(l),0>=--e))break;const _=u.primitive;let g=!1;typeof _.getGeometryInstanceAttributes=="function"&&c(u.id)&&(i=_.getGeometryInstanceAttributes(u.id),c(i)&&c(i.show)&&(g=!0,i.show=mn.toValue(!1,i.show),s.push(i))),u instanceof Ir&&(g=!0,u.show=!1,a.push(u)),g||(_.show=!1,r.push(_)),l=t()}for(n=0;n<r.length;++n)r[n].show=!0;for(n=0;n<s.length;++n)i=s[n],i.show=mn.toValue(!0,i.show);for(n=0;n<a.length;++n)a[n].show=!0;return o}Or.prototype.drillPick=function(e,t,n,i,o){const r=this;return QW(n,function(){const l=r.pick(e,t,i,o);if(c(l))return{object:l,position:void 0,exclude:!1}}).map(function(l){return l.object})};const H3=new d,wze=new d;function Sze(e,t,n){this.ray=e,this.width=t,this.tilesets=n,this.ready=!1;const i=this;this.promise=new Promise(o=>{i._completePick=()=>{o()}})}function KW(e,t,n,i){const o=t.direction,r=d.mostOrthogonalAxis(o,H3),s=d.cross(o,r,H3),a=d.cross(o,s,wze);return i.position=t.origin,i.direction=o,i.up=a,i.right=s,i.frustum.width=y(n,XW),i.frustum.computeCullingVolume(i.positionWC,i.directionWC,i.upWC)}function vze(e,t,n){const i=t.frameState,{ray:o,width:r,tilesets:s}=n,a=e._pickOffscreenView.camera,l=KW(e,o,r,a),u=lze;u.camera=a,u.cullingVolume=l;let h=!0;const f=s.length;for(let _=0;_<f;++_){const g=s[_];g.show&&t.primitives.contains(g)&&(g.updateForPass(i,u),h=h&&u.ready)}return h&&n._completePick(),h}Or.prototype.updateMostDetailedRayPicks=function(e){const t=this._mostDetailedRayPicks;for(let n=0;n<t.length;++n)vze(this,e,t[n])&&t.splice(n--,1)};function ZW(e,t,n){for(let i=0;i<e.length;++i){const o=e.get(i);o.show&&(c(o.isCesium3DTileset)?(!c(t)||t.indexOf(o)===-1)&&n.push(o):o instanceof eo&&ZW(o,t,n))}}function lE(e,t,n,i,o,r){const s=[];if(ZW(t.primitives,i,s),s.length===0)return Promise.resolve(r());const a=new Sze(n,o,s);return e._mostDetailedRayPicks.push(a),a.promise.then(function(){return r()})}function Ize(e,t){return!c(e)||!c(t)||t.length===0?!1:t.indexOf(e)>-1||t.indexOf(e.primitive)>-1||t.indexOf(e.id)>-1}function Dze(e,t,n,i,o,r,s){const{context:a,frameState:l}=t,u=a.uniformState,h=e._pickOffscreenView;t.view=h,KW(e,n,o,h.camera),ls=Re.clone(h.viewport,ls);const f=h.pickFramebuffer.begin(ls,h.viewport);t.jobScheduler.disableThisFrame(),t.updateFrameState(),l.invertClassification=!1,l.passes.pick=!0,l.passes.offscreen=!0,s?l.tilesetPassState=uze:l.tilesetPassState=aE,u.update(l),t.updateEnvironment(),t.updateAndExecuteCommands(f,cE),t.resolveFramebuffers(f);let _;const g=h.pickFramebuffer.end(ls);if(t.context.depthTexture){const m=h.frustumCommandsList.length;for(let b=0;b<m;++b){const x=e.getPickDepth(t,b).getDepth(a,0,0);if(!!c(x)&&x>0&&x<1){const C=h.frustumCommandsList[b],w=C.near*(b!==0?t.opaqueFrustumNearOffset:1),v=C.far,P=w+x*(v-w);_=nn.getPoint(n,P);break}}}if(t.view=t.defaultView,a.endFrame(),c(g)||c(_))return{object:g,position:_,exclude:!c(_)&&r||Ize(g,i)}}function JW(e,t,n,i,o,r,s,a){return QW(i,function(){return Dze(e,t,n,o,r,s,a)})}function sg(e,t,n,i,o,r,s){const a=JW(e,t,n,1,i,o,r,s);if(a.length>0)return a[0]}function e6(e,t,n,i,o,r,s,a){return JW(e,t,n,i,o,r,s,a)}function uE(e,t){return new Promise((n,i)=>{t.then(function(o){const r=e.postRender.addEventListener(function(){r(),n(o)});e.requestRender()}).catch(function(o){i(o)})})}Or.prototype.pickFromRay=function(e,t,n,i){if(A.defined("ray",t),e.mode!==oe.SCENE3D)throw new E("Ray intersections are only supported in 3D mode.");return sg(this,e,t,n,i,!1,!1)};Or.prototype.drillPickFromRay=function(e,t,n,i,o){if(A.defined("ray",t),e.mode!==oe.SCENE3D)throw new E("Ray intersections are only supported in 3D mode.");return e6(this,e,t,n,i,o,!1,!1)};Or.prototype.pickFromRayMostDetailed=function(e,t,n,i){if(A.defined("ray",t),e.mode!==oe.SCENE3D)throw new E("Ray intersections are only supported in 3D mode.");const o=this;return t=nn.clone(t),n=c(n)?n.slice():n,uE(e,lE(o,e,t,n,i,function(){return sg(o,e,t,n,i,!1,!0)}))};Or.prototype.drillPickFromRayMostDetailed=function(e,t,n,i,o){if(A.defined("ray",t),e.mode!==oe.SCENE3D)throw new E("Ray intersections are only supported in 3D mode.");const r=this;return t=nn.clone(t),i=c(i)?i.slice():i,uE(e,lE(r,e,t,i,o,function(){return e6(r,e,t,n,i,o,!1,!0)}))};const Pze=new d,Oze=new d,Lze=new nn,t6=new he;function F1(e,t){const n=e.globe,i=c(n)?n.ellipsoid:e.mapProjection.ellipsoid,o=Ti._defaultMaxTerrainHeight,r=i.geodeticSurfaceNormalCartographic(t,Oze),s=he.toCartesian(t,i,Pze),a=Lze;a.origin=s,a.direction=r;const l=new nn;return nn.getPoint(a,o,l.origin),d.negate(r,l.direction),l}function n6(e,t){const n=e.globe,i=c(n)?n.ellipsoid:e.mapProjection.ellipsoid,o=he.fromCartesian(t,i,t6);return F1(e,o)}function i6(e,t){const n=e.globe,i=c(n)?n.ellipsoid:e.mapProjection.ellipsoid;return he.fromCartesian(t,i,t6).height}function Rze(e,t,n,i,o){const r=F1(t,n);return lE(e,t,r,i,o,function(){const s=sg(e,t,r,i,o,!0,!0);if(c(s))return i6(t,s.position)})}function Nze(e,t,n,i,o,r){const s=n6(t,n);return lE(e,t,s,i,o,function(){const a=sg(e,t,s,i,o,!0,!0);if(c(a))return d.clone(a.position,r)})}Or.prototype.sampleHeight=function(e,t,n,i){if(A.defined("position",t),e.mode!==oe.SCENE3D)throw new E("sampleHeight is only supported in 3D mode.");if(!e.sampleHeightSupported)throw new E("sampleHeight requires depth texture support. Check sampleHeightSupported.");const o=F1(e,t),r=sg(this,e,o,n,i,!0,!1);if(c(r))return i6(e,r.position)};Or.prototype.clampToHeight=function(e,t,n,i,o){if(A.defined("cartesian",t),e.mode!==oe.SCENE3D)throw new E("clampToHeight is only supported in 3D mode.");if(!e.clampToHeightSupported)throw new E("clampToHeight requires depth texture support. Check clampToHeightSupported.");const r=n6(e,t),s=sg(this,e,r,n,i,!0,!1);if(c(s))return d.clone(s.position,o)};Or.prototype.sampleHeightMostDetailed=function(e,t,n,i){if(A.defined("positions",t),e.mode!==oe.SCENE3D)throw new E("sampleHeightMostDetailed is only supported in 3D mode.");if(!e.sampleHeightSupported)throw new E("sampleHeightMostDetailed requires depth texture support. Check sampleHeightSupported.");n=c(n)?n.slice():n;const o=t.length,r=new Array(o);for(let s=0;s<o;++s)r[s]=Rze(this,e,t[s],n,i);return uE(e,Promise.all(r).then(function(s){const a=s.length;for(let l=0;l<a;++l)t[l].height=s[l];return t}))};Or.prototype.clampToHeightMostDetailed=function(e,t,n,i){if(A.defined("cartesians",t),e.mode!==oe.SCENE3D)throw new E("clampToHeightMostDetailed is only supported in 3D mode.");if(!e.clampToHeightSupported)throw new E("clampToHeightMostDetailed requires depth texture support. Check clampToHeightSupported.");n=c(n)?n.slice():n;const o=t.length,r=new Array(o);for(let s=0;s<o;++s)r[s]=Nze(this,e,t[s],n,i,t[s]);return uE(e,Promise.all(r).then(function(s){const a=s.length;for(let l=0;l<a;++l)t[l]=s[l];return t}))};Or.prototype.destroy=function(){this._pickOffscreenView=this._pickOffscreenView&&this._pickOffscreenView.destroy()};const Mze=`uniform sampler2D colorTexture;
|
|
|
|
in vec2 v_textureCoordinates;
|
|
|
|
#ifdef AUTO_EXPOSURE
|
|
uniform sampler2D autoExposure;
|
|
#endif
|
|
|
|
void main()
|
|
{
|
|
vec4 fragmentColor = texture(colorTexture, v_textureCoordinates);
|
|
vec3 color = fragmentColor.rgb;
|
|
|
|
#ifdef AUTO_EXPOSURE
|
|
color /= texture(autoExposure, vec2(0.5)).r;
|
|
#endif
|
|
color = czm_acesTonemapping(color);
|
|
color = czm_inverseGamma(color);
|
|
|
|
out_FragColor = vec4(color, fragmentColor.a);
|
|
}
|
|
`,Fze=`uniform sampler2D randomTexture;
|
|
uniform sampler2D depthTexture;
|
|
uniform float intensity;
|
|
uniform float bias;
|
|
uniform float lengthCap;
|
|
uniform float stepSize;
|
|
uniform float frustumLength;
|
|
|
|
in vec2 v_textureCoordinates;
|
|
|
|
vec4 clipToEye(vec2 uv, float depth)
|
|
{
|
|
vec2 xy = vec2((uv.x * 2.0 - 1.0), ((1.0 - uv.y) * 2.0 - 1.0));
|
|
vec4 posEC = czm_inverseProjection * vec4(xy, depth, 1.0);
|
|
posEC = posEC / posEC.w;
|
|
return posEC;
|
|
}
|
|
|
|
//Reconstruct Normal Without Edge Removation
|
|
vec3 getNormalXEdge(vec3 posInCamera, float depthU, float depthD, float depthL, float depthR, vec2 pixelSize)
|
|
{
|
|
vec4 posInCameraUp = clipToEye(v_textureCoordinates - vec2(0.0, pixelSize.y), depthU);
|
|
vec4 posInCameraDown = clipToEye(v_textureCoordinates + vec2(0.0, pixelSize.y), depthD);
|
|
vec4 posInCameraLeft = clipToEye(v_textureCoordinates - vec2(pixelSize.x, 0.0), depthL);
|
|
vec4 posInCameraRight = clipToEye(v_textureCoordinates + vec2(pixelSize.x, 0.0), depthR);
|
|
|
|
vec3 up = posInCamera.xyz - posInCameraUp.xyz;
|
|
vec3 down = posInCameraDown.xyz - posInCamera.xyz;
|
|
vec3 left = posInCamera.xyz - posInCameraLeft.xyz;
|
|
vec3 right = posInCameraRight.xyz - posInCamera.xyz;
|
|
|
|
vec3 DX = length(left) < length(right) ? left : right;
|
|
vec3 DY = length(up) < length(down) ? up : down;
|
|
|
|
return normalize(cross(DY, DX));
|
|
}
|
|
|
|
void main(void)
|
|
{
|
|
float depth = czm_readDepth(depthTexture, v_textureCoordinates);
|
|
vec4 posInCamera = clipToEye(v_textureCoordinates, depth);
|
|
|
|
if (posInCamera.z > frustumLength)
|
|
{
|
|
out_FragColor = vec4(1.0);
|
|
return;
|
|
}
|
|
|
|
vec2 pixelSize = czm_pixelRatio / czm_viewport.zw;
|
|
float depthU = czm_readDepth(depthTexture, v_textureCoordinates - vec2(0.0, pixelSize.y));
|
|
float depthD = czm_readDepth(depthTexture, v_textureCoordinates + vec2(0.0, pixelSize.y));
|
|
float depthL = czm_readDepth(depthTexture, v_textureCoordinates - vec2(pixelSize.x, 0.0));
|
|
float depthR = czm_readDepth(depthTexture, v_textureCoordinates + vec2(pixelSize.x, 0.0));
|
|
vec3 normalInCamera = getNormalXEdge(posInCamera.xyz, depthU, depthD, depthL, depthR, pixelSize);
|
|
|
|
float ao = 0.0;
|
|
vec2 sampleDirection = vec2(1.0, 0.0);
|
|
float gapAngle = 90.0 * czm_radiansPerDegree;
|
|
|
|
// RandomNoise
|
|
float randomVal = texture(randomTexture, v_textureCoordinates / pixelSize / 255.0).x;
|
|
|
|
//Loop for each direction
|
|
for (int i = 0; i < 4; i++)
|
|
{
|
|
float newGapAngle = gapAngle * (float(i) + randomVal);
|
|
float cosVal = cos(newGapAngle);
|
|
float sinVal = sin(newGapAngle);
|
|
|
|
//Rotate Sampling Direction
|
|
vec2 rotatedSampleDirection = vec2(cosVal * sampleDirection.x - sinVal * sampleDirection.y, sinVal * sampleDirection.x + cosVal * sampleDirection.y);
|
|
float localAO = 0.0;
|
|
float localStepSize = stepSize;
|
|
|
|
//Loop for each step
|
|
for (int j = 0; j < 6; j++)
|
|
{
|
|
vec2 newCoords = v_textureCoordinates + rotatedSampleDirection * localStepSize * pixelSize;
|
|
|
|
//Exception Handling
|
|
if(newCoords.x > 1.0 || newCoords.y > 1.0 || newCoords.x < 0.0 || newCoords.y < 0.0)
|
|
{
|
|
break;
|
|
}
|
|
|
|
float stepDepthInfo = czm_readDepth(depthTexture, newCoords);
|
|
vec4 stepPosInCamera = clipToEye(newCoords, stepDepthInfo);
|
|
vec3 diffVec = stepPosInCamera.xyz - posInCamera.xyz;
|
|
float len = length(diffVec);
|
|
|
|
if (len > lengthCap)
|
|
{
|
|
break;
|
|
}
|
|
|
|
float dotVal = clamp(dot(normalInCamera, normalize(diffVec)), 0.0, 1.0 );
|
|
float weight = len / lengthCap;
|
|
weight = 1.0 - weight * weight;
|
|
|
|
if (dotVal < bias)
|
|
{
|
|
dotVal = 0.0;
|
|
}
|
|
|
|
localAO = max(localAO, dotVal * weight);
|
|
localStepSize += stepSize;
|
|
}
|
|
ao += localAO;
|
|
}
|
|
|
|
ao /= 4.0;
|
|
ao = 1.0 - clamp(ao, 0.0, 1.0);
|
|
ao = pow(ao, intensity);
|
|
out_FragColor = vec4(vec3(ao), 1.0);
|
|
}
|
|
`,Bze=`uniform sampler2D colorTexture;
|
|
uniform sampler2D ambientOcclusionTexture;
|
|
uniform bool ambientOcclusionOnly;
|
|
in vec2 v_textureCoordinates;
|
|
|
|
void main(void)
|
|
{
|
|
vec4 color = texture(colorTexture, v_textureCoordinates);
|
|
vec4 ao = texture(ambientOcclusionTexture, v_textureCoordinates);
|
|
out_FragColor = ambientOcclusionOnly ? ao : ao * color;
|
|
}
|
|
`,zze=`uniform sampler2D colorTexture;
|
|
uniform float gradations;
|
|
|
|
in vec2 v_textureCoordinates;
|
|
|
|
void main(void)
|
|
{
|
|
vec3 rgb = texture(colorTexture, v_textureCoordinates).rgb;
|
|
#ifdef CZM_SELECTED_FEATURE
|
|
if (czm_selected()) {
|
|
out_FragColor = vec4(rgb, 1.0);
|
|
return;
|
|
}
|
|
#endif
|
|
float luminance = czm_luminance(rgb);
|
|
float darkness = luminance * gradations;
|
|
darkness = (darkness - fract(darkness)) / gradations;
|
|
out_FragColor = vec4(vec3(darkness), 1.0);
|
|
}
|
|
`,Uze=`uniform sampler2D colorTexture;
|
|
uniform sampler2D bloomTexture;
|
|
uniform bool glowOnly;
|
|
|
|
in vec2 v_textureCoordinates;
|
|
|
|
void main(void)
|
|
{
|
|
vec4 color = texture(colorTexture, v_textureCoordinates);
|
|
|
|
#ifdef CZM_SELECTED_FEATURE
|
|
if (czm_selected()) {
|
|
out_FragColor = color;
|
|
return;
|
|
}
|
|
#endif
|
|
|
|
vec4 bloom = texture(bloomTexture, v_textureCoordinates);
|
|
out_FragColor = glowOnly ? bloom : bloom + color;
|
|
}
|
|
`,kze=`uniform sampler2D colorTexture;
|
|
uniform float brightness;
|
|
|
|
in vec2 v_textureCoordinates;
|
|
|
|
void main(void)
|
|
{
|
|
vec3 rgb = texture(colorTexture, v_textureCoordinates).rgb;
|
|
vec3 target = vec3(0.0);
|
|
out_FragColor = vec4(mix(target, rgb, brightness), 1.0);
|
|
}
|
|
`,Vze=`uniform sampler2D colorTexture;
|
|
uniform float contrast;
|
|
uniform float brightness;
|
|
|
|
in vec2 v_textureCoordinates;
|
|
|
|
void main(void)
|
|
{
|
|
vec3 sceneColor = texture(colorTexture, v_textureCoordinates).xyz;
|
|
sceneColor = czm_RGBToHSB(sceneColor);
|
|
sceneColor.z += brightness;
|
|
sceneColor = czm_HSBToRGB(sceneColor);
|
|
|
|
float factor = (259.0 * (contrast + 255.0)) / (255.0 * (259.0 - contrast));
|
|
sceneColor = factor * (sceneColor - vec3(0.5)) + vec3(0.5);
|
|
out_FragColor = vec4(sceneColor, 1.0);
|
|
}
|
|
`,Hze=`uniform sampler2D colorTexture;
|
|
uniform sampler2D blurTexture;
|
|
uniform sampler2D depthTexture;
|
|
uniform float focalDistance;
|
|
|
|
in vec2 v_textureCoordinates;
|
|
|
|
vec4 toEye(vec2 uv, float depth)
|
|
{
|
|
vec2 xy = vec2((uv.x * 2.0 - 1.0), ((1.0 - uv.y) * 2.0 - 1.0));
|
|
vec4 posInCamera = czm_inverseProjection * vec4(xy, depth, 1.0);
|
|
posInCamera = posInCamera / posInCamera.w;
|
|
return posInCamera;
|
|
}
|
|
|
|
float computeDepthBlur(float depth)
|
|
{
|
|
float f;
|
|
if (depth < focalDistance)
|
|
{
|
|
f = (focalDistance - depth) / (focalDistance - czm_currentFrustum.x);
|
|
}
|
|
else
|
|
{
|
|
f = (depth - focalDistance) / (czm_currentFrustum.y - focalDistance);
|
|
f = pow(f, 0.1);
|
|
}
|
|
f *= f;
|
|
f = clamp(f, 0.0, 1.0);
|
|
return pow(f, 0.5);
|
|
}
|
|
|
|
void main(void)
|
|
{
|
|
float depth = czm_readDepth(depthTexture, v_textureCoordinates);
|
|
vec4 posInCamera = toEye(v_textureCoordinates, depth);
|
|
float d = computeDepthBlur(-posInCamera.z);
|
|
out_FragColor = mix(texture(colorTexture, v_textureCoordinates), texture(blurTexture, v_textureCoordinates), d);
|
|
}
|
|
`,Gze=`uniform sampler2D depthTexture;
|
|
|
|
in vec2 v_textureCoordinates;
|
|
|
|
void main(void)
|
|
{
|
|
float depth = czm_readDepth(depthTexture, v_textureCoordinates);
|
|
out_FragColor = vec4(vec3(depth), 1.0);
|
|
}
|
|
`,jze=`uniform sampler2D depthTexture;
|
|
uniform float length;
|
|
uniform vec4 color;
|
|
|
|
in vec2 v_textureCoordinates;
|
|
|
|
void main(void)
|
|
{
|
|
float directions[3];
|
|
directions[0] = -1.0;
|
|
directions[1] = 0.0;
|
|
directions[2] = 1.0;
|
|
|
|
float scalars[3];
|
|
scalars[0] = 3.0;
|
|
scalars[1] = 10.0;
|
|
scalars[2] = 3.0;
|
|
|
|
float padx = czm_pixelRatio / czm_viewport.z;
|
|
float pady = czm_pixelRatio / czm_viewport.w;
|
|
|
|
#ifdef CZM_SELECTED_FEATURE
|
|
bool selected = false;
|
|
for (int i = 0; i < 3; ++i)
|
|
{
|
|
float dir = directions[i];
|
|
selected = selected || czm_selected(vec2(-padx, dir * pady));
|
|
selected = selected || czm_selected(vec2(padx, dir * pady));
|
|
selected = selected || czm_selected(vec2(dir * padx, -pady));
|
|
selected = selected || czm_selected(vec2(dir * padx, pady));
|
|
if (selected)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
if (!selected)
|
|
{
|
|
out_FragColor = vec4(color.rgb, 0.0);
|
|
return;
|
|
}
|
|
#endif
|
|
|
|
float horizEdge = 0.0;
|
|
float vertEdge = 0.0;
|
|
|
|
for (int i = 0; i < 3; ++i)
|
|
{
|
|
float dir = directions[i];
|
|
float scale = scalars[i];
|
|
|
|
horizEdge -= texture(depthTexture, v_textureCoordinates + vec2(-padx, dir * pady)).x * scale;
|
|
horizEdge += texture(depthTexture, v_textureCoordinates + vec2(padx, dir * pady)).x * scale;
|
|
|
|
vertEdge -= texture(depthTexture, v_textureCoordinates + vec2(dir * padx, -pady)).x * scale;
|
|
vertEdge += texture(depthTexture, v_textureCoordinates + vec2(dir * padx, pady)).x * scale;
|
|
}
|
|
|
|
float len = sqrt(horizEdge * horizEdge + vertEdge * vertEdge);
|
|
out_FragColor = vec4(color.rgb, len > length ? color.a : 0.0);
|
|
}
|
|
`,Wze=`uniform sampler2D colorTexture;
|
|
|
|
in vec2 v_textureCoordinates;
|
|
|
|
#ifdef AUTO_EXPOSURE
|
|
uniform sampler2D autoExposure;
|
|
#endif
|
|
|
|
// See slides 142 and 143:
|
|
// http://www.gdcvault.com/play/1012459/Uncharted_2__HDR_Lighting
|
|
|
|
void main()
|
|
{
|
|
vec4 fragmentColor = texture(colorTexture, v_textureCoordinates);
|
|
vec3 color = fragmentColor.rgb;
|
|
|
|
#ifdef AUTO_EXPOSURE
|
|
float exposure = texture(autoExposure, vec2(0.5)).r;
|
|
color /= exposure;
|
|
#endif
|
|
|
|
const float A = 0.22; // shoulder strength
|
|
const float B = 0.30; // linear strength
|
|
const float C = 0.10; // linear angle
|
|
const float D = 0.20; // toe strength
|
|
const float E = 0.01; // toe numerator
|
|
const float F = 0.30; // toe denominator
|
|
|
|
const float white = 11.2; // linear white point value
|
|
|
|
vec3 c = ((color * (A * color + C * B) + D * E) / (color * ( A * color + B) + D * F)) - E / F;
|
|
float w = ((white * (A * white + C * B) + D * E) / (white * ( A * white + B) + D * F)) - E / F;
|
|
|
|
c = czm_inverseGamma(c / w);
|
|
out_FragColor = vec4(c, fragmentColor.a);
|
|
}
|
|
`,qze=`in vec2 v_textureCoordinates;
|
|
|
|
uniform sampler2D colorTexture;
|
|
|
|
const float fxaaQualitySubpix = 0.5;
|
|
const float fxaaQualityEdgeThreshold = 0.125;
|
|
const float fxaaQualityEdgeThresholdMin = 0.0833;
|
|
|
|
void main()
|
|
{
|
|
vec2 fxaaQualityRcpFrame = vec2(1.0) / czm_viewport.zw;
|
|
vec4 color = FxaaPixelShader(
|
|
v_textureCoordinates,
|
|
colorTexture,
|
|
fxaaQualityRcpFrame,
|
|
fxaaQualitySubpix,
|
|
fxaaQualityEdgeThreshold,
|
|
fxaaQualityEdgeThresholdMin);
|
|
float alpha = texture(colorTexture, v_textureCoordinates).a;
|
|
out_FragColor = vec4(color.rgb, alpha);
|
|
}
|
|
`,$D=`#define SAMPLES 8
|
|
|
|
uniform float delta;
|
|
uniform float sigma;
|
|
uniform float direction; // 0.0 for x direction, 1.0 for y direction
|
|
|
|
uniform sampler2D colorTexture;
|
|
|
|
#ifdef USE_STEP_SIZE
|
|
uniform float stepSize;
|
|
#else
|
|
uniform vec2 step;
|
|
#endif
|
|
|
|
in vec2 v_textureCoordinates;
|
|
|
|
// Incremental Computation of the Gaussian:
|
|
// https://developer.nvidia.com/gpugems/GPUGems3/gpugems3_ch40.html
|
|
|
|
void main()
|
|
{
|
|
vec2 st = v_textureCoordinates;
|
|
vec2 dir = vec2(1.0 - direction, direction);
|
|
|
|
#ifdef USE_STEP_SIZE
|
|
vec2 step = vec2(stepSize * (czm_pixelRatio / czm_viewport.zw));
|
|
#else
|
|
vec2 step = step;
|
|
#endif
|
|
|
|
vec3 g;
|
|
g.x = 1.0 / (sqrt(czm_twoPi) * sigma);
|
|
g.y = exp((-0.5 * delta * delta) / (sigma * sigma));
|
|
g.z = g.y * g.y;
|
|
|
|
vec4 result = texture(colorTexture, st) * g.x;
|
|
for (int i = 1; i < SAMPLES; ++i)
|
|
{
|
|
g.xy *= g.yz;
|
|
|
|
vec2 offset = float(i) * dir * step;
|
|
result += texture(colorTexture, st - offset) * g.x;
|
|
result += texture(colorTexture, st + offset) * g.x;
|
|
}
|
|
|
|
out_FragColor = result;
|
|
}
|
|
`,Yze=`uniform sampler2D colorTexture;
|
|
uniform sampler2D dirtTexture;
|
|
uniform sampler2D starTexture;
|
|
uniform vec2 dirtTextureDimensions;
|
|
uniform float distortion;
|
|
uniform float ghostDispersal;
|
|
uniform float haloWidth;
|
|
uniform float dirtAmount;
|
|
uniform float earthRadius;
|
|
uniform float intensity;
|
|
|
|
in vec2 v_textureCoordinates;
|
|
|
|
// whether it is in space or not
|
|
// 6500000.0 is empirical value
|
|
#define DISTANCE_TO_SPACE 6500000.0
|
|
|
|
// return ndc from world coordinate biased earthRadius
|
|
vec4 getNDCFromWC(vec3 WC, float earthRadius)
|
|
{
|
|
vec4 positionEC = czm_view * vec4(WC, 1.0);
|
|
positionEC = vec4(positionEC.x + earthRadius, positionEC.y, positionEC.z, 1.0);
|
|
vec4 positionWC = czm_eyeToWindowCoordinates(positionEC);
|
|
return czm_viewportOrthographic * vec4(positionWC.xy, -positionWC.z, 1.0);
|
|
}
|
|
|
|
// Check if current pixel is included Earth
|
|
// if then mask it gradually
|
|
float isInEarth(vec2 texcoord, vec2 sceneSize)
|
|
{
|
|
vec2 NDC = texcoord * 2.0 - 1.0;
|
|
vec4 earthPosSC = getNDCFromWC(vec3(0.0), 0.0);
|
|
vec4 earthPosSCEdge = getNDCFromWC(vec3(0.0), earthRadius * 1.5);
|
|
NDC.xy -= earthPosSC.xy;
|
|
|
|
float X = abs(NDC.x) * sceneSize.x;
|
|
float Y = abs(NDC.y) * sceneSize.y;
|
|
|
|
return clamp(0.0, 1.0, max(sqrt(X * X + Y * Y) / max(abs(earthPosSCEdge.x * sceneSize.x), 1.0) - 0.8 , 0.0));
|
|
}
|
|
|
|
// For Chromatic effect
|
|
vec4 textureDistorted(sampler2D tex, vec2 texcoord, vec2 direction, vec3 distortion, bool isSpace)
|
|
{
|
|
vec2 sceneSize = czm_viewport.zw;
|
|
vec3 color;
|
|
if(isSpace)
|
|
{
|
|
color.r = isInEarth(texcoord + direction * distortion.r, sceneSize) * texture(tex, texcoord + direction * distortion.r).r;
|
|
color.g = isInEarth(texcoord + direction * distortion.g, sceneSize) * texture(tex, texcoord + direction * distortion.g).g;
|
|
color.b = isInEarth(texcoord + direction * distortion.b, sceneSize) * texture(tex, texcoord + direction * distortion.b).b;
|
|
}
|
|
else
|
|
{
|
|
color.r = texture(tex, texcoord + direction * distortion.r).r;
|
|
color.g = texture(tex, texcoord + direction * distortion.g).g;
|
|
color.b = texture(tex, texcoord + direction * distortion.b).b;
|
|
}
|
|
return vec4(clamp(color, 0.0, 1.0), 0.0);
|
|
}
|
|
|
|
void main(void)
|
|
{
|
|
vec4 originalColor = texture(colorTexture, v_textureCoordinates);
|
|
vec3 rgb = originalColor.rgb;
|
|
bool isSpace = length(czm_viewerPositionWC.xyz) > DISTANCE_TO_SPACE;
|
|
|
|
// Sun position
|
|
vec4 sunPos = czm_morphTime == 1.0 ? vec4(czm_sunPositionWC, 1.0) : vec4(czm_sunPositionColumbusView.zxy, 1.0);
|
|
vec4 sunPositionEC = czm_view * sunPos;
|
|
vec4 sunPositionWC = czm_eyeToWindowCoordinates(sunPositionEC);
|
|
sunPos = czm_viewportOrthographic * vec4(sunPositionWC.xy, -sunPositionWC.z, 1.0);
|
|
|
|
// If sun is not in the screen space, use original color.
|
|
if(!isSpace || !((sunPos.x >= -1.1 && sunPos.x <= 1.1) && (sunPos.y >= -1.1 && sunPos.y <= 1.1)))
|
|
{
|
|
// Lens flare is disabled when not in space until #5932 is fixed.
|
|
// https://github.com/CesiumGS/cesium/issues/5932
|
|
out_FragColor = originalColor;
|
|
return;
|
|
}
|
|
|
|
vec2 texcoord = vec2(1.0) - v_textureCoordinates;
|
|
vec2 pixelSize = czm_pixelRatio / czm_viewport.zw;
|
|
vec2 invPixelSize = 1.0 / pixelSize;
|
|
vec3 distortionVec = pixelSize.x * vec3(-distortion, 0.0, distortion);
|
|
|
|
// ghost vector to image centre:
|
|
vec2 ghostVec = (vec2(0.5) - texcoord) * ghostDispersal;
|
|
vec3 direction = normalize(vec3(ghostVec, 0.0));
|
|
|
|
// sample ghosts:
|
|
vec4 result = vec4(0.0);
|
|
vec4 ghost = vec4(0.0);
|
|
for (int i = 0; i < 4; ++i)
|
|
{
|
|
vec2 offset = fract(texcoord + ghostVec * float(i));
|
|
// Only bright spots from the centre of the source image
|
|
ghost += textureDistorted(colorTexture, offset, direction.xy, distortionVec, isSpace);
|
|
}
|
|
result += ghost;
|
|
|
|
// sample halo
|
|
vec2 haloVec = normalize(ghostVec) * haloWidth;
|
|
float weightForHalo = length(vec2(0.5) - fract(texcoord + haloVec)) / length(vec2(0.5));
|
|
weightForHalo = pow(1.0 - weightForHalo, 5.0);
|
|
|
|
result += textureDistorted(colorTexture, texcoord + haloVec, direction.xy, distortionVec, isSpace) * weightForHalo * 1.5;
|
|
|
|
// dirt on lens
|
|
vec2 dirtTexCoords = (v_textureCoordinates * invPixelSize) / dirtTextureDimensions;
|
|
if (dirtTexCoords.x > 1.0)
|
|
{
|
|
dirtTexCoords.x = mod(floor(dirtTexCoords.x), 2.0) == 1.0 ? 1.0 - fract(dirtTexCoords.x) : fract(dirtTexCoords.x);
|
|
}
|
|
if (dirtTexCoords.y > 1.0)
|
|
{
|
|
dirtTexCoords.y = mod(floor(dirtTexCoords.y), 2.0) == 1.0 ? 1.0 - fract(dirtTexCoords.y) : fract(dirtTexCoords.y);
|
|
}
|
|
result += dirtAmount * texture(dirtTexture, dirtTexCoords);
|
|
|
|
// Rotating starburst texture's coordinate
|
|
// dot(czm_view[0].xyz, vec3(0.0, 0.0, 1.0)) + dot(czm_view[1].xyz, vec3(0.0, 1.0, 0.0))
|
|
float camrot = czm_view[0].z + czm_view[1].y;
|
|
float cosValue = cos(camrot);
|
|
float sinValue = sin(camrot);
|
|
mat3 rotation = mat3(
|
|
cosValue, -sinValue, 0.0,
|
|
sinValue, cosValue, 0.0,
|
|
0.0, 0.0, 1.0
|
|
);
|
|
|
|
vec3 st1 = vec3(v_textureCoordinates * 2.0 - vec2(1.0), 1.0);
|
|
vec3 st2 = vec3((rotation * st1).xy, 1.0);
|
|
vec3 st3 = st2 * 0.5 + vec3(0.5);
|
|
vec2 lensStarTexcoord = st3.xy;
|
|
float weightForLensFlare = length(vec3(sunPos.xy, 0.0));
|
|
float oneMinusWeightForLensFlare = max(1.0 - weightForLensFlare, 0.0);
|
|
|
|
if (!isSpace)
|
|
{
|
|
result *= oneMinusWeightForLensFlare * intensity * 0.2;
|
|
}
|
|
else
|
|
{
|
|
result *= oneMinusWeightForLensFlare * intensity;
|
|
result *= texture(starTexture, lensStarTexcoord) * pow(weightForLensFlare, 1.0) * max((1.0 - length(vec3(st1.xy, 0.0))), 0.0) * 2.0;
|
|
}
|
|
|
|
result += texture(colorTexture, v_textureCoordinates);
|
|
|
|
out_FragColor = result;
|
|
}
|
|
`,$ze=`uniform sampler2D colorTexture;
|
|
uniform vec3 white;
|
|
|
|
in vec2 v_textureCoordinates;
|
|
|
|
#ifdef AUTO_EXPOSURE
|
|
uniform sampler2D autoExposure;
|
|
#endif
|
|
|
|
// See equation 4:
|
|
// http://www.cs.utah.edu/~reinhard/cdrom/tonemap.pdf
|
|
|
|
void main()
|
|
{
|
|
vec4 fragmentColor = texture(colorTexture, v_textureCoordinates);
|
|
vec3 color = fragmentColor.rgb;
|
|
#ifdef AUTO_EXPOSURE
|
|
float exposure = texture(autoExposure, vec2(0.5)).r;
|
|
color /= exposure;
|
|
#endif
|
|
color = (color * (1.0 + color / white)) / (1.0 + color);
|
|
color = czm_inverseGamma(color);
|
|
out_FragColor = vec4(color, fragmentColor.a);
|
|
}
|
|
`,Xze=`uniform sampler2D colorTexture;
|
|
|
|
in vec2 v_textureCoordinates;
|
|
|
|
float rand(vec2 co)
|
|
{
|
|
return fract(sin(dot(co.xy ,vec2(12.9898, 78.233))) * 43758.5453);
|
|
}
|
|
|
|
void main(void)
|
|
{
|
|
float noiseValue = rand(v_textureCoordinates + sin(czm_frameNumber)) * 0.1;
|
|
vec3 rgb = texture(colorTexture, v_textureCoordinates).rgb;
|
|
vec3 green = vec3(0.0, 1.0, 0.0);
|
|
out_FragColor = vec4((noiseValue + rgb) * green, 1.0);
|
|
}
|
|
`,Qze=`uniform sampler2D colorTexture;
|
|
|
|
in vec2 v_textureCoordinates;
|
|
|
|
#ifdef AUTO_EXPOSURE
|
|
uniform sampler2D autoExposure;
|
|
#endif
|
|
|
|
// See equation 3:
|
|
// http://www.cs.utah.edu/~reinhard/cdrom/tonemap.pdf
|
|
|
|
void main()
|
|
{
|
|
vec4 fragmentColor = texture(colorTexture, v_textureCoordinates);
|
|
vec3 color = fragmentColor.rgb;
|
|
#ifdef AUTO_EXPOSURE
|
|
float exposure = texture(autoExposure, vec2(0.5)).r;
|
|
color /= exposure;
|
|
#endif
|
|
color = color / (1.0 + color);
|
|
color = czm_inverseGamma(color);
|
|
out_FragColor = vec4(color, fragmentColor.a);
|
|
}
|
|
`,Kze=`uniform sampler2D colorTexture;
|
|
uniform sampler2D silhouetteTexture;
|
|
|
|
in vec2 v_textureCoordinates;
|
|
|
|
void main(void)
|
|
{
|
|
vec4 silhouetteColor = texture(silhouetteTexture, v_textureCoordinates);
|
|
vec4 color = texture(colorTexture, v_textureCoordinates);
|
|
out_FragColor = mix(color, silhouetteColor, silhouetteColor.a);
|
|
}
|
|
`;function $p(){this._uniformMap=void 0,this._command=void 0,this._colorTexture=void 0,this._depthTexture=void 0,this._ready=!1,this._name="czm_autoexposure",this._logDepthChanged=void 0,this._useLogDepth=void 0,this._framebuffers=void 0,this._previousLuminance=new on,this._commands=void 0,this._clearCommand=void 0,this._minMaxLuminance=new H,this.enabled=!0,this._enabled=!0,this.minimumLuminance=.1,this.maximumLuminance=10}Object.defineProperties($p.prototype,{ready:{get:function(){return this._ready}},name:{get:function(){return this._name}},outputTexture:{get:function(){const e=this._framebuffers;if(!!c(e))return e[e.length-1].getColorTexture(0)}}});function o6(e){const t=e._framebuffers;if(!c(t))return;const n=t.length;for(let i=0;i<n;++i)t[i].destroy();e._framebuffers=void 0,e._previousLuminance.destroy(),e._previousLuminance=void 0}function Zze(e,t){o6(e);let n=e._width,i=e._height;const o=t.halfFloatingPointTexture?Me.HALF_FLOAT:Me.FLOAT,r=Math.ceil(Math.log(Math.max(n,i))/Math.log(3)),s=new Array(r);for(let l=0;l<r;++l)n=Math.max(Math.ceil(n/3),1),i=Math.max(Math.ceil(i/3),1),s[l]=new on,s[l].update(t,n,i,1,o);const a=s[r-1].getColorTexture(0);e._previousLuminance.update(t,a.width,a.height,1,o),e._framebuffers=s}function r6(e){const t=e._commands;if(!c(t))return;const n=t.length;for(let i=0;i<n;++i)t[i].shaderProgram.destroy();e._commands=void 0}function Jze(e,t){let n;if(t===0)n={colorTexture:function(){return e._colorTexture},colorTextureDimensions:function(){return e._colorTexture.dimensions}};else{const i=e._framebuffers[t-1].getColorTexture(0);n={colorTexture:function(){return i},colorTextureDimensions:function(){return i.dimensions}}}return n.minMaxLuminance=function(){return e._minMaxLuminance},n.previousLuminance=function(){return e._previousLuminance.getColorTexture(0)},n}function eUe(e,t){let n=`uniform sampler2D colorTexture;
|
|
in vec2 v_textureCoordinates;
|
|
float sampleTexture(vec2 offset) {
|
|
`;return e===0?n+=` vec4 color = texture(colorTexture, v_textureCoordinates + offset);
|
|
return czm_luminance(color.rgb);
|
|
`:n+=` return texture(colorTexture, v_textureCoordinates + offset).r;
|
|
`,n+=`}
|
|
|
|
`,n+=`uniform vec2 colorTextureDimensions;
|
|
uniform vec2 minMaxLuminance;
|
|
uniform sampler2D previousLuminance;
|
|
void main() {
|
|
float color = 0.0;
|
|
float xStep = 1.0 / colorTextureDimensions.x;
|
|
float yStep = 1.0 / colorTextureDimensions.y;
|
|
int count = 0;
|
|
for (int i = 0; i < 3; ++i) {
|
|
for (int j = 0; j < 3; ++j) {
|
|
vec2 offset;
|
|
offset.x = -xStep + float(i) * xStep;
|
|
offset.y = -yStep + float(j) * yStep;
|
|
if (offset.x < 0.0 || offset.x > 1.0 || offset.y < 0.0 || offset.y > 1.0) {
|
|
continue;
|
|
}
|
|
color += sampleTexture(offset);
|
|
++count;
|
|
}
|
|
}
|
|
if (count > 0) {
|
|
color /= float(count);
|
|
}
|
|
`,e===t-1&&(n+=` float previous = texture(previousLuminance, vec2(0.5)).r;
|
|
color = clamp(color, minMaxLuminance.x, minMaxLuminance.y);
|
|
color = previous + (color - previous) / (60.0 * 1.5);
|
|
color = clamp(color, minMaxLuminance.x, minMaxLuminance.y);
|
|
`),n+=` out_FragColor = vec4(color);
|
|
}
|
|
`,n}function tUe(e,t){r6(e);const n=e._framebuffers,i=n.length,o=new Array(i);for(let r=0;r<i;++r)o[r]=t.createViewportQuadCommand(eUe(r,i),{framebuffer:n[r].framebuffer,uniformMap:Jze(e,r)});e._commands=o}$p.prototype.clear=function(e){const t=this._framebuffers;if(!c(t))return;let n=this._clearCommand;c(n)||(n=this._clearCommand=new bi({color:new z(0,0,0,0),framebuffer:void 0}));const i=t.length;for(let o=0;o<i;++o)t[o].clear(e,n)};$p.prototype.update=function(e){const t=e.drawingBufferWidth,n=e.drawingBufferHeight;(t!==this._width||n!==this._height)&&(this._width=t,this._height=n,Zze(this,e),tUe(this,e),this._ready||(this._ready=!0)),this._minMaxLuminance.x=this.minimumLuminance,this._minMaxLuminance.y=this.maximumLuminance;const i=this._framebuffers,o=i[i.length-1];i[i.length-1]=this._previousLuminance,this._commands[this._commands.length-1].framebuffer=this._previousLuminance.framebuffer,this._previousLuminance=o};$p.prototype.execute=function(e,t){this._colorTexture=t;const n=this._commands;if(!c(n))return;const i=n.length;for(let o=0;o<i;++o)n[o].execute(e)};$p.prototype.isDestroyed=function(){return!1};$p.prototype.destroy=function(){return o6(this),r6(this),ve(this)};const nUe={NEAREST:0,LINEAR:1},wp=nUe;function Wn(e){e=y(e,y.EMPTY_OBJECT);const t=e.fragmentShader,n=y(e.textureScale,1),i=y(e.pixelFormat,Ve.RGBA);if(A.typeOf.string("options.fragmentShader",t),A.typeOf.number.greaterThan("options.textureScale",n,0),A.typeOf.number.lessThanOrEquals("options.textureScale",n,1),!Ve.isColorFormat(i))throw new E("options.pixelFormat must be a color format.");this._fragmentShader=t,this._uniforms=e.uniforms,this._textureScale=n,this._forcePowerOfTwo=y(e.forcePowerOfTwo,!1),this._sampleMode=y(e.sampleMode,wp.NEAREST),this._pixelFormat=i,this._pixelDatatype=y(e.pixelDatatype,Me.UNSIGNED_BYTE),this._clearColor=y(e.clearColor,z.BLACK),this._uniformMap=void 0,this._command=void 0,this._colorTexture=void 0,this._depthTexture=void 0,this._idTexture=void 0,this._actualUniforms={},this._dirtyUniforms=[],this._texturesToRelease=[],this._texturesToCreate=[],this._texturePromise=void 0;const o=new Lp;o.scissorTest={enabled:!0,rectangle:c(e.scissorRectangle)?Re.clone(e.scissorRectangle):new Re},this._passState=o,this._ready=!1;let r=e.name;c(r)||(r=Wr()),this._name=r,this._logDepthChanged=void 0,this._useLogDepth=void 0,this._selectedIdTexture=void 0,this._selected=void 0,this._selectedShadow=void 0,this._parentSelected=void 0,this._parentSelectedShadow=void 0,this._combinedSelected=void 0,this._combinedSelectedShadow=void 0,this._selectedLength=0,this._parentSelectedLength=0,this._selectedDirty=!0,this._textureCache=void 0,this._index=void 0,this.enabled=!0,this._enabled=!0}Object.defineProperties(Wn.prototype,{ready:{get:function(){return this._ready}},name:{get:function(){return this._name}},fragmentShader:{get:function(){return this._fragmentShader}},uniforms:{get:function(){return this._uniforms}},textureScale:{get:function(){return this._textureScale}},forcePowerOfTwo:{get:function(){return this._forcePowerOfTwo}},sampleMode:{get:function(){return this._sampleMode}},pixelFormat:{get:function(){return this._pixelFormat}},pixelDatatype:{get:function(){return this._pixelDatatype}},clearColor:{get:function(){return this._clearColor}},scissorRectangle:{get:function(){return this._passState.scissorTest.rectangle}},outputTexture:{get:function(){if(c(this._textureCache)){const e=this._textureCache.getFramebuffer(this._name);if(c(e))return e.getColorTexture(0)}}},selected:{get:function(){return this._selected},set:function(e){this._selected=e}},parentSelected:{get:function(){return this._parentSelected},set:function(e){this._parentSelected=e}}});const iUe=/uniform\s+sampler2D\s+depthTexture/g;Wn.prototype._isSupported=function(e){return!iUe.test(this._fragmentShader)||e.depthTexture};function oUe(e,t,n){const i=t[n];return(typeof i=="string"||i instanceof HTMLCanvasElement||i instanceof HTMLImageElement||i instanceof HTMLVideoElement||i instanceof ImageData)&&e._dirtyUniforms.push(n),{get:function(){return t[n]},set:function(o){const r=t[n];t[n]=o;const s=e._actualUniforms,a=s[n];c(a)&&a!==r&&a instanceof xt&&!c(e._textureCache.getStageByName(n))&&(e._texturesToRelease.push(a),delete s[n],delete s[`${n}Dimensions`]),r instanceof xt&&e._texturesToRelease.push(r),typeof o=="string"||o instanceof HTMLCanvasElement||o instanceof HTMLImageElement||o instanceof HTMLVideoElement||o instanceof ImageData?e._dirtyUniforms.push(n):s[n]=o}}}function rUe(e,t){return function(){const n=e._actualUniforms[t];return typeof n=="function"?n():n}}function sUe(e,t){return function(){const n=e[t]();if(c(n))return n.dimensions}}function aUe(e){if(c(e._uniformMap))return;const t={},n={},i=e._uniforms,o=e._actualUniforms;for(const r in i)if(i.hasOwnProperty(r)){typeof i[r]!="function"?(t[r]=rUe(e,r),n[r]=oUe(e,i,r)):(t[r]=i[r],n[r]=i[r]),o[r]=i[r];const s=t[r]();(typeof s=="string"||s instanceof xt||s instanceof HTMLImageElement||s instanceof HTMLCanvasElement||s instanceof HTMLVideoElement)&&(t[`${r}Dimensions`]=sUe(t,r))}e._uniforms={},Object.defineProperties(e._uniforms,n),e._uniformMap=jt(t,{colorTexture:function(){return e._colorTexture},colorTextureDimensions:function(){return e._colorTexture.dimensions},depthTexture:function(){return e._depthTexture},depthTextureDimensions:function(){return e._depthTexture.dimensions},czm_idTexture:function(){return e._idTexture},czm_selectedIdTexture:function(){return e._selectedIdTexture},czm_selectedIdTextureStep:function(){return 1/e._selectedIdTexture.width}})}function cUe(e,t){if(c(e._command)&&!e._logDepthChanged&&!e._selectedDirty)return;let n=e._fragmentShader;if(c(e._selectedIdTexture)){const o=e._selectedIdTexture.width;n=n.replace(/in\s+vec2\s+v_textureCoordinates;/g,""),n=`#define CZM_SELECTED_FEATURE
|
|
uniform sampler2D czm_idTexture;
|
|
uniform sampler2D czm_selectedIdTexture;
|
|
uniform float czm_selectedIdTextureStep;
|
|
in vec2 v_textureCoordinates;
|
|
bool czm_selected(vec2 offset)
|
|
{
|
|
bool selected = false;
|
|
vec4 id = texture(czm_idTexture, v_textureCoordinates + offset);
|
|
for (int i = 0; i < ${o}; ++i)
|
|
{
|
|
vec4 selectedId = texture(czm_selectedIdTexture, vec2((float(i) + 0.5) * czm_selectedIdTextureStep, 0.5));
|
|
if (all(equal(id, selectedId)))
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
bool czm_selected()
|
|
{
|
|
return czm_selected(vec2(0.0));
|
|
}
|
|
|
|
${n}`}const i=new Oe({defines:[e._useLogDepth?"LOG_DEPTH":""],sources:[n]});e._command=t.createViewportQuadCommand(i,{uniformMap:e._uniformMap,owner:e})}function lUe(e){const t=e._sampleMode;let n,i;t===wp.LINEAR?(n=en.LINEAR,i=Yo.LINEAR):(n=en.NEAREST,i=Yo.NEAREST);const o=e._sampler;(!c(o)||o.minificationFilter!==n||o.magnificationFilter!==i)&&(e._sampler=new un({wrapS:Fn.CLAMP_TO_EDGE,wrapT:Fn.CLAMP_TO_EDGE,minificationFilter:n,magnificationFilter:i}))}function uUe(e,t){return function(n){e._texturesToCreate.push({name:t,source:n})}}function dUe(e,t){return function(){return e._textureCache.getOutputTexture(t)}}function hUe(e,t){let n,i,o;const r=e._texturesToRelease;let s=r.length;for(n=0;n<s;++n)i=r[n],i=i&&i.destroy();r.length=0;const a=e._texturesToCreate;for(s=a.length,n=0;n<s;++n){const f=a[n];o=f.name;const _=f.source;e._actualUniforms[o]=new xt({context:t,source:_})}a.length=0;const l=e._dirtyUniforms;if(l.length===0&&!c(e._texturePromise)){e._ready=!0;return}if(l.length===0||c(e._texturePromise))return;s=l.length;const u=e._uniforms,h=[];for(n=0;n<s;++n){o=l[n];const f=u[o],_=e._textureCache.getStageByName(f);if(c(_))e._actualUniforms[o]=dUe(e,f);else if(typeof f=="string"){const g=new Ae({url:f});h.push(g.fetchImage().then(uUe(e,o)))}else e._texturesToCreate.push({name:o,source:f})}l.length=0,h.length>0?(e._ready=!1,e._texturePromise=Promise.all(h).then(function(){e._ready=!0,e._texturePromise=void 0})):e._ready=!0}function s6(e){c(e._command)&&(e._command.shaderProgram=e._command.shaderProgram&&e._command.shaderProgram.destroy(),e._command=void 0),e._selectedIdTexture=e._selectedIdTexture&&e._selectedIdTexture.destroy();const t=e._textureCache;if(!c(t))return;const n=e._uniforms,i=e._actualUniforms;for(const o in i)i.hasOwnProperty(o)&&i[o]instanceof xt&&(c(t.getStageByName(n[o]))||i[o].destroy(),e._dirtyUniforms.push(o))}function fUe(e){let t=c(e._selected)?e._selected.length:0;const n=c(e._parentSelected)?e._parentSelected:0;let i=e._selected!==e._selectedShadow||t!==e._selectedLength;if(i=i||e._parentSelected!==e._parentSelectedShadow||n!==e._parentSelectedLength,c(e._selected)&&c(e._parentSelected)?e._combinedSelected=e._selected.concat(e._parentSelected):c(e._parentSelected)?e._combinedSelected=e._parentSelected:e._combinedSelected=e._selected,!i&&c(e._combinedSelected)){if(!c(e._combinedSelectedShadow))return!0;t=e._combinedSelected.length;for(let o=0;o<t;++o)if(e._combinedSelected[o]!==e._combinedSelectedShadow[o])return!0}return i}function pUe(e,t){if(!e._selectedDirty)return;e._selectedIdTexture=e._selectedIdTexture&&e._selectedIdTexture.destroy(),e._selectedIdTexture=void 0;const n=e._combinedSelected;if(!c(n))return;let i,o,r=0;const s=n.length;for(i=0;i<s;++i)o=n[i],c(o.pickIds)?r+=o.pickIds.length:c(o.pickId)&&++r;if(s===0||r===0){const h=new Uint8Array(4);h[0]=255,h[1]=255,h[2]=255,h[3]=255,e._selectedIdTexture=new xt({context:t,pixelFormat:Ve.RGBA,pixelDatatype:Me.UNSIGNED_BYTE,source:{arrayBufferView:h,width:1,height:1},sampler:un.NEAREST});return}let a,l=0;const u=new Uint8Array(r*4);for(i=0;i<s;++i)if(o=n[i],c(o.pickIds)){const h=o.pickIds,f=h.length;for(let _=0;_<f;++_)a=h[_].color,u[l]=z.floatToByte(a.red),u[l+1]=z.floatToByte(a.green),u[l+2]=z.floatToByte(a.blue),u[l+3]=z.floatToByte(a.alpha),l+=4}else c(o.pickId)&&(a=o.pickId.color,u[l]=z.floatToByte(a.red),u[l+1]=z.floatToByte(a.green),u[l+2]=z.floatToByte(a.blue),u[l+3]=z.floatToByte(a.alpha),l+=4);e._selectedIdTexture=new xt({context:t,pixelFormat:Ve.RGBA,pixelDatatype:Me.UNSIGNED_BYTE,source:{arrayBufferView:u,width:r,height:1},sampler:un.NEAREST})}Wn.prototype.update=function(e,t){if(this.enabled!==this._enabled&&!this.enabled&&s6(this),this._enabled=this.enabled,!this._enabled||(this._logDepthChanged=t!==this._useLogDepth,this._useLogDepth=t,this._selectedDirty=fUe(this),this._selectedShadow=this._selected,this._parentSelectedShadow=this._parentSelected,this._combinedSelectedShadow=this._combinedSelected,this._selectedLength=c(this._selected)?this._selected.length:0,this._parentSelectedLength=c(this._parentSelected)?this._parentSelected.length:0,pUe(this,e),aUe(this),hUe(this,e),cUe(this,e),lUe(this),this._selectedDirty=!1,!this._ready))return;const n=this._textureCache.getFramebuffer(this._name);if(this._command.framebuffer=n,!c(n))return;const i=n.getColorTexture(0);let o;(i.width!==e.drawingBufferWidth||i.height!==e.drawingBufferHeight)&&(o=this._renderState,(!c(o)||i.width!==o.viewport.width||i.height!==o.viewport.height)&&(this._renderState=Ue.fromCache({viewport:new Re(0,0,i.width,i.height)}))),this._command.renderState=o};Wn.prototype.execute=function(e,t,n,i){if(!c(this._command)||!c(this._command.framebuffer)||!this._ready||!this._enabled)return;this._colorTexture=t,this._depthTexture=n,this._idTexture=i,un.equals(this._colorTexture.sampler,this._sampler)||(this._colorTexture.sampler=this._sampler);const o=this.scissorRectangle.width>0&&this.scissorRectangle.height>0?this._passState:void 0;c(o)&&(o.context=e),this._command.execute(e,o)};Wn.prototype.isDestroyed=function(){return!1};Wn.prototype.destroy=function(){return s6(this),ve(this)};function Cs(e){e=y(e,y.EMPTY_OBJECT),A.defined("options.stages",e.stages),A.typeOf.number.greaterThan("options.stages.length",e.stages.length,0),this._stages=e.stages,this._inputPreviousStageTexture=y(e.inputPreviousStageTexture,!0);let t=e.name;c(t)||(t=Wr()),this._name=t,this._uniforms=e.uniforms,this._textureCache=void 0,this._index=void 0,this._selected=void 0,this._selectedShadow=void 0,this._parentSelected=void 0,this._parentSelectedShadow=void 0,this._combinedSelected=void 0,this._combinedSelectedShadow=void 0,this._selectedLength=0,this._parentSelectedLength=0,this._selectedDirty=!0}Object.defineProperties(Cs.prototype,{ready:{get:function(){const e=this._stages,t=e.length;for(let n=0;n<t;++n)if(!e[n].ready)return!1;return!0}},name:{get:function(){return this._name}},enabled:{get:function(){return this._stages[0].enabled},set:function(e){const t=this._stages,n=t.length;for(let i=0;i<n;++i)t[i].enabled=e}},uniforms:{get:function(){return this._uniforms}},inputPreviousStageTexture:{get:function(){return this._inputPreviousStageTexture}},length:{get:function(){return this._stages.length}},selected:{get:function(){return this._selected},set:function(e){this._selected=e}},parentSelected:{get:function(){return this._parentSelected},set:function(e){this._parentSelected=e}}});Cs.prototype._isSupported=function(e){const t=this._stages,n=t.length;for(let i=0;i<n;++i)if(!t[i]._isSupported(e))return!1;return!0};Cs.prototype.get=function(e){return A.typeOf.number.greaterThanOrEquals("index",e,0),A.typeOf.number.lessThan("index",e,this.length),this._stages[e]};function mUe(e){let t=c(e._selected)?e._selected.length:0;const n=c(e._parentSelected)?e._parentSelected:0;let i=e._selected!==e._selectedShadow||t!==e._selectedLength;if(i=i||e._parentSelected!==e._parentSelectedShadow||n!==e._parentSelectedLength,c(e._selected)&&c(e._parentSelected)?e._combinedSelected=e._selected.concat(e._parentSelected):c(e._parentSelected)?e._combinedSelected=e._parentSelected:e._combinedSelected=e._selected,!i&&c(e._combinedSelected)){if(!c(e._combinedSelectedShadow))return!0;t=e._combinedSelected.length;for(let o=0;o<t;++o)if(e._combinedSelected[o]!==e._combinedSelectedShadow[o])return!0}return i}Cs.prototype.update=function(e,t){this._selectedDirty=mUe(this),this._selectedShadow=this._selected,this._parentSelectedShadow=this._parentSelected,this._combinedSelectedShadow=this._combinedSelected,this._selectedLength=c(this._selected)?this._selected.length:0,this._parentSelectedLength=c(this._parentSelected)?this._parentSelected.length:0;const n=this._stages,i=n.length;for(let o=0;o<i;++o){const r=n[o];this._selectedDirty&&(r.parentSelected=this._combinedSelected),r.update(e,t)}};Cs.prototype.isDestroyed=function(){return!1};Cs.prototype.destroy=function(){const e=this._stages,t=e.length;for(let n=0;n<t;++n)e[n].destroy();return ve(this)};const uo={};function dE(e){const o=`#define USE_STEP_SIZE
|
|
${$D}`,r=new Wn({name:`${e}_x_direction`,fragmentShader:o,uniforms:{delta:1,sigma:2,stepSize:1,direction:0},sampleMode:wp.LINEAR}),s=new Wn({name:`${e}_y_direction`,fragmentShader:o,uniforms:{delta:1,sigma:2,stepSize:1,direction:1},sampleMode:wp.LINEAR}),a={};return Object.defineProperties(a,{delta:{get:function(){return r.uniforms.delta},set:function(l){const u=r.uniforms,h=s.uniforms;u.delta=h.delta=l}},sigma:{get:function(){return r.uniforms.sigma},set:function(l){const u=r.uniforms,h=s.uniforms;u.sigma=h.sigma=l}},stepSize:{get:function(){return r.uniforms.stepSize},set:function(l){const u=r.uniforms,h=s.uniforms;u.stepSize=h.stepSize=l}}}),new Cs({name:e,stages:[r,s],uniforms:a})}uo.createBlurStage=function(){return dE("czm_blur")};uo.createDepthOfFieldStage=function(){const e=dE("czm_depth_of_field_blur"),t=new Wn({name:"czm_depth_of_field_composite",fragmentShader:Hze,uniforms:{focalDistance:5,blurTexture:e.name}}),n={};return Object.defineProperties(n,{focalDistance:{get:function(){return t.uniforms.focalDistance},set:function(i){t.uniforms.focalDistance=i}},delta:{get:function(){return e.uniforms.delta},set:function(i){e.uniforms.delta=i}},sigma:{get:function(){return e.uniforms.sigma},set:function(i){e.uniforms.sigma=i}},stepSize:{get:function(){return e.uniforms.stepSize},set:function(i){e.uniforms.stepSize=i}}}),new Cs({name:"czm_depth_of_field",stages:[e,t],inputPreviousStageTexture:!1,uniforms:n})};uo.isDepthOfFieldSupported=function(e){return e.context.depthTexture};uo.createEdgeDetectionStage=function(){const e=Wr();return new Wn({name:`czm_edge_detection_${e}`,fragmentShader:jze,uniforms:{length:.25,color:z.clone(z.BLACK)}})};uo.isEdgeDetectionSupported=function(e){return e.context.depthTexture};function _Ue(e){if(!c(e))return uo.createEdgeDetectionStage();const t=new Cs({name:"czm_edge_detection_multiple",stages:e,inputPreviousStageTexture:!1}),n={};let i="",o="";for(let a=0;a<e.length;++a)i+=`uniform sampler2D edgeTexture${a};
|
|
`,o+=` vec4 edge${a} = texture(edgeTexture${a}, v_textureCoordinates);
|
|
if (edge${a}.a > 0.0)
|
|
{
|
|
color = edge${a};
|
|
break;
|
|
}
|
|
`,n[`edgeTexture${a}`]=e[a].name;const r=`${i}in vec2 v_textureCoordinates;
|
|
void main() {
|
|
vec4 color = vec4(0.0);
|
|
for (int i = 0; i < ${e.length}; i++)
|
|
{
|
|
${o} }
|
|
out_FragColor = color;
|
|
}
|
|
`,s=new Wn({name:"czm_edge_detection_combine",fragmentShader:r,uniforms:n});return new Cs({name:"czm_edge_detection_composite",stages:[t,s]})}uo.createSilhouetteStage=function(e){const t=_Ue(e),n=new Wn({name:"czm_silhouette_color_edges",fragmentShader:Kze,uniforms:{silhouetteTexture:t.name}});return new Cs({name:"czm_silhouette",stages:[t,n],inputPreviousStageTexture:!1,uniforms:t.uniforms})};uo.isSilhouetteSupported=function(e){return e.context.depthTexture};uo.createBloomStage=function(){const e=new Wn({name:"czm_bloom_contrast_bias",fragmentShader:Vze,uniforms:{contrast:128,brightness:-.3}}),t=dE("czm_bloom_blur"),n=new Cs({name:"czm_bloom_contrast_bias_blur",stages:[e,t]}),i=new Wn({name:"czm_bloom_generate_composite",fragmentShader:Uze,uniforms:{glowOnly:!1,bloomTexture:n.name}}),o={};return Object.defineProperties(o,{glowOnly:{get:function(){return i.uniforms.glowOnly},set:function(r){i.uniforms.glowOnly=r}},contrast:{get:function(){return e.uniforms.contrast},set:function(r){e.uniforms.contrast=r}},brightness:{get:function(){return e.uniforms.brightness},set:function(r){e.uniforms.brightness=r}},delta:{get:function(){return t.uniforms.delta},set:function(r){t.uniforms.delta=r}},sigma:{get:function(){return t.uniforms.sigma},set:function(r){t.uniforms.sigma=r}},stepSize:{get:function(){return t.uniforms.stepSize},set:function(r){t.uniforms.stepSize=r}}}),new Cs({name:"czm_bloom",stages:[n,i],inputPreviousStageTexture:!1,uniforms:o})};uo.createAmbientOcclusionStage=function(){const e=new Wn({name:"czm_ambient_occlusion_generate",fragmentShader:Fze,uniforms:{intensity:3,bias:.1,lengthCap:.26,stepSize:1.95,frustumLength:1e3,randomTexture:void 0}}),t=dE("czm_ambient_occlusion_blur");t.uniforms.stepSize=.86;const n=new Cs({name:"czm_ambient_occlusion_generate_blur",stages:[e,t]}),i=new Wn({name:"czm_ambient_occlusion_composite",fragmentShader:Bze,uniforms:{ambientOcclusionOnly:!1,ambientOcclusionTexture:n.name}}),o={};return Object.defineProperties(o,{intensity:{get:function(){return e.uniforms.intensity},set:function(r){e.uniforms.intensity=r}},bias:{get:function(){return e.uniforms.bias},set:function(r){e.uniforms.bias=r}},lengthCap:{get:function(){return e.uniforms.lengthCap},set:function(r){e.uniforms.lengthCap=r}},stepSize:{get:function(){return e.uniforms.stepSize},set:function(r){e.uniforms.stepSize=r}},frustumLength:{get:function(){return e.uniforms.frustumLength},set:function(r){e.uniforms.frustumLength=r}},randomTexture:{get:function(){return e.uniforms.randomTexture},set:function(r){e.uniforms.randomTexture=r}},delta:{get:function(){return t.uniforms.delta},set:function(r){t.uniforms.delta=r}},sigma:{get:function(){return t.uniforms.sigma},set:function(r){t.uniforms.sigma=r}},blurStepSize:{get:function(){return t.uniforms.stepSize},set:function(r){t.uniforms.stepSize=r}},ambientOcclusionOnly:{get:function(){return i.uniforms.ambientOcclusionOnly},set:function(r){i.uniforms.ambientOcclusionOnly=r}}}),new Cs({name:"czm_ambient_occlusion",stages:[n,i],inputPreviousStageTexture:!1,uniforms:o})};uo.isAmbientOcclusionSupported=function(e){return e.context.depthTexture};const gUe=`#define FXAA_QUALITY_PRESET 39
|
|
${L1e}
|
|
${qze}`;uo.createFXAAStage=function(){return new Wn({name:"czm_FXAA",fragmentShader:gUe,sampleMode:wp.LINEAR})};uo.createAcesTonemappingStage=function(e){let t=e?`#define AUTO_EXPOSURE
|
|
`:"";return t+=Mze,new Wn({name:"czm_aces",fragmentShader:t,uniforms:{autoExposure:void 0}})};uo.createFilmicTonemappingStage=function(e){let t=e?`#define AUTO_EXPOSURE
|
|
`:"";return t+=Wze,new Wn({name:"czm_filmic",fragmentShader:t,uniforms:{autoExposure:void 0}})};uo.createReinhardTonemappingStage=function(e){let t=e?`#define AUTO_EXPOSURE
|
|
`:"";return t+=Qze,new Wn({name:"czm_reinhard",fragmentShader:t,uniforms:{autoExposure:void 0}})};uo.createModifiedReinhardTonemappingStage=function(e){let t=e?`#define AUTO_EXPOSURE
|
|
`:"";return t+=$ze,new Wn({name:"czm_modified_reinhard",fragmentShader:t,uniforms:{white:z.WHITE,autoExposure:void 0}})};uo.createAutoExposureStage=function(){return new $p};uo.createBlackAndWhiteStage=function(){return new Wn({name:"czm_black_and_white",fragmentShader:zze,uniforms:{gradations:5}})};uo.createBrightnessStage=function(){return new Wn({name:"czm_brightness",fragmentShader:kze,uniforms:{brightness:.5}})};uo.createNightVisionStage=function(){return new Wn({name:"czm_night_vision",fragmentShader:Xze})};uo.createDepthViewStage=function(){return new Wn({name:"czm_depth_view",fragmentShader:Gze})};uo.createLensFlareStage=function(){return new Wn({name:"czm_lens_flare",fragmentShader:Yze,uniforms:{dirtTexture:Zt("Assets/Textures/LensFlare/DirtMask.jpg"),starTexture:Zt("Assets/Textures/LensFlare/StarBurst.jpg"),intensity:2,distortion:10,ghostDispersal:.4,haloWidth:.4,dirtAmount:.4,earthRadius:ae.WGS84.maximumRadius}})};const _h=uo;function Su(e){this._collection=e,this._framebuffers=[],this._stageNameToFramebuffer={},this._width=void 0,this._height=void 0,this._updateDependencies=!1}function Wy(e){for(;c(e.length);)e=e.get(e.length-1);return e.name}function XD(e,t,n,i,o){if(!i.enabled||!i._isSupported(t))return o;const r=n[i.name]={};if(c(o)){const a=e.getStageByName(o);r[Wy(a)]=!0}const s=i.uniforms;if(c(s)){const a=Object.getOwnPropertyNames(s),l=a.length;for(let u=0;u<l;++u){const h=s[a[u]];if(typeof h=="string"){const f=e.getStageByName(h);c(f)&&(r[Wy(f)]=!0)}}}return i.name}function Ty(e,t,n,i,o){if(c(i.enabled)&&!i.enabled||c(i._isSupported)&&!i._isSupported(t))return o;const r=o,s=!c(i.inputPreviousStageTexture)||i.inputPreviousStageTexture;let a=o;const l=i.length;for(let f=0;f<l;++f){const _=i.get(f);c(_.length)?a=Ty(e,t,n,_,o):a=XD(e,t,n,_,o),s&&(o=a)}let u,h;if(s)for(u=1;u<l;++u)h=Wy(i.get(u)),c(n[h])||(n[h]={}),n[h][r]=!0;else for(u=1;u<l;++u){h=Wy(i.get(u));const f=n[h];for(let _=0;_<u;++_)f[Wy(i.get(_))]=!0}return a}function yUe(e,t){const n={};if(c(e.ambientOcclusion)){const i=e.ambientOcclusion,o=e.bloom,r=e._tonemapping,s=e.fxaa;let a=Ty(e,t,n,i,void 0);a=Ty(e,t,n,o,a),a=XD(e,t,n,r,a),a=Ty(e,t,n,e,a),XD(e,t,n,s,a)}else Ty(e,t,n,e,void 0);return n}function bUe(e,t,n){const o=e._collection.getStageByName(t),r=o._textureScale,s=o._forcePowerOfTwo,a=o._pixelFormat,l=o._pixelDatatype,u=o._clearColor;let h,f;const _=e._framebuffers,g=_.length;for(h=0;h<g;++h){if(f=_[h],r!==f.textureScale||s!==f.forcePowerOfTwo||a!==f.pixelFormat||l!==f.pixelDatatype||!z.equals(u,f.clearColor))continue;const m=f.stages,b=m.length;let T=!1;for(let x=0;x<b;++x)if(n[m[x]]){T=!0;break}if(!T)break}return c(f)&&h<g?(f.stages.push(t),f):(f={textureScale:r,forcePowerOfTwo:s,pixelFormat:a,pixelDatatype:l,clearColor:u,stages:[t],buffer:new on({pixelFormat:a,pixelDatatype:l}),clear:void 0},_.push(f),f)}function TUe(e,t){const n=yUe(e._collection,t);for(const i in n)n.hasOwnProperty(i)&&(e._stageNameToFramebuffer[i]=bUe(e,i,n[i]))}function QD(e){const t=e._framebuffers,n=t.length;for(let i=0;i<n;++i)t[i].buffer.destroy()}function AUe(e,t){const n=e._width,i=e._height,o=e._framebuffers,r=o.length;for(let s=0;s<r;++s){const a=o[s],l=a.textureScale;let u=Math.ceil(n*l),h=Math.ceil(i*l),f=Math.min(u,h);a.forcePowerOfTwo&&(R.isPowerOfTwo(f)||(f=R.nextPowerOfTwo(f)),u=f,h=f),a.buffer.update(t,u,h),a.clear=new bi({color:a.clearColor,framebuffer:a.buffer.framebuffer})}}Su.prototype.updateDependencies=function(){this._updateDependencies=!0};Su.prototype.update=function(e){const t=this._collection,n=this._updateDependencies,i=c(t.ambientOcclusion)&&t.ambientOcclusion.enabled&&t.ambientOcclusion._isSupported(e),o=c(t.bloom)&&t.bloom.enabled&&t.bloom._isSupported(e),r=c(t._tonemapping)&&t._tonemapping.enabled&&t._tonemapping._isSupported(e),s=c(t.fxaa)&&t.fxaa.enabled&&t.fxaa._isSupported(e),a=!c(t._activeStages)||t._activeStages.length>0||i||o||r||s;if((n||!a&&this._framebuffers.length>0)&&(QD(this),this._framebuffers.length=0,this._stageNameToFramebuffer={},this._width=void 0,this._height=void 0),!n&&!a)return;this._framebuffers.length===0&&TUe(this,e);const l=e.drawingBufferWidth,u=e.drawingBufferHeight,h=this._width!==l||this._height!==u;!n&&!h||(this._width=l,this._height=u,this._updateDependencies=!1,QD(this),AUe(this,e))};Su.prototype.clear=function(e){const t=this._framebuffers;for(let n=0;n<t.length;++n)t[n].clear.execute(e)};Su.prototype.getStageByName=function(e){return this._collection.getStageByName(e)};Su.prototype.getOutputTexture=function(e){return this._collection.getOutputTexture(e)};Su.prototype.getFramebuffer=function(e){const t=this._stageNameToFramebuffer[e];if(!!c(t))return t.buffer.framebuffer};Su.prototype.isDestroyed=function(){return!1};Su.prototype.destroy=function(){return QD(this),ve(this)};const Ay={REINHARD:0,MODIFIED_REINHARD:1,FILMIC:2,ACES:3,validate:function(e){return e===Ay.REINHARD||e===Ay.MODIFIED_REINHARD||e===Ay.FILMIC||e===Ay.ACES}},xy=Object.freeze(Ay),B1=[];function js(){const e=_h.createFXAAStage(),t=_h.createAmbientOcclusionStage(),n=_h.createBloomStage();this._autoExposureEnabled=!1,this._autoExposure=_h.createAutoExposureStage(),this._tonemapping=void 0,this._tonemapper=void 0,this.tonemapper=xy.ACES;const i=this._tonemapping;e.enabled=!1,t.enabled=!1,n.enabled=!1,i.enabled=!1;const o=new Su(this),r={},s=B1;for(s.push(e,t,n,i);s.length>0;){const l=s.pop();r[l.name]=l,l._textureCache=o;const u=l.length;if(c(u))for(let h=0;h<u;++h)s.push(l.get(h))}this._stages=[],this._activeStages=[],this._previousActiveStages=[],this._randomTexture=void 0;const a=this;t.uniforms.randomTexture=function(){return a._randomTexture},this._ao=t,this._bloom=n,this._fxaa=e,this._aoEnabled=void 0,this._bloomEnabled=void 0,this._tonemappingEnabled=void 0,this._fxaaEnabled=void 0,this._activeStagesChanged=!1,this._stagesRemoved=!1,this._textureCacheDirty=!1,this._stageNames=r,this._textureCache=o}Object.defineProperties(js.prototype,{ready:{get:function(){let e=!1;const t=this._stages,n=t.length;for(let a=n-1;a>=0;--a){const l=t[a];e=e||l.ready&&l.enabled}const i=this._fxaa,o=this._ao,r=this._bloom,s=this._tonemapping;return e=e||i.ready&&i.enabled,e=e||o.ready&&o.enabled,e=e||r.ready&&r.enabled,e=e||s.ready&&s.enabled,e}},fxaa:{get:function(){return this._fxaa}},ambientOcclusion:{get:function(){return this._ao}},bloom:{get:function(){return this._bloom}},length:{get:function(){return z1(this),this._stages.length}},outputTexture:{get:function(){const e=this._fxaa;if(e.enabled&&e.ready)return this.getOutputTexture(e.name);const t=this._stages,n=t.length;for(let s=n-1;s>=0;--s){const a=t[s];if(c(a)&&a.ready&&a.enabled)return this.getOutputTexture(a.name)}const i=this._tonemapping;if(i.enabled&&i.ready)return this.getOutputTexture(i.name);const o=this._bloom;if(o.enabled&&o.ready)return this.getOutputTexture(o.name);const r=this._ao;if(r.enabled&&r.ready)return this.getOutputTexture(r.name)}},hasSelected:{get:function(){const e=this._stages.slice();for(;e.length>0;){const t=e.pop();if(!c(t))continue;if(c(t.selected))return!0;const n=t.length;if(c(n))for(let i=0;i<n;++i)e.push(t.get(i))}return!1}},tonemapper:{get:function(){return this._tonemapper},set:function(e){if(this._tonemapper===e)return;if(!xy.validate(e))throw new E("tonemapper was set to an invalid value.");c(this._tonemapping)&&(delete this._stageNames[this._tonemapping.name],this._tonemapping.destroy());const t=this._autoExposureEnabled;let n;switch(e){case xy.REINHARD:n=_h.createReinhardTonemappingStage(t);break;case xy.MODIFIED_REINHARD:n=_h.createModifiedReinhardTonemappingStage(t);break;case xy.FILMIC:n=_h.createFilmicTonemappingStage(t);break;default:n=_h.createAcesTonemappingStage(t);break}if(t){const i=this._autoExposure;n.uniforms.autoExposure=function(){return i.outputTexture}}this._tonemapper=e,this._tonemapping=n,c(this._stageNames)&&(this._stageNames[n.name]=n,n._textureCache=this._textureCache),this._textureCacheDirty=!0}}});function z1(e){if(!e._stagesRemoved)return;e._stagesRemoved=!1;const t=[],n=e._stages,i=n.length;for(let o=0,r=0;o<i;++o){const s=n[o];s&&(s._index=r++,t.push(s))}e._stages=t}js.prototype.add=function(e){A.typeOf.object("stage",e);const t=this._stageNames,n=B1;for(n.push(e);n.length>0;){const o=n.pop();if(c(t[o.name]))throw new E(`${o.name} has already been added to the collection or does not have a unique name.`);t[o.name]=o,o._textureCache=this._textureCache;const r=o.length;if(c(r))for(let s=0;s<r;++s)n.push(o.get(s))}const i=this._stages;return e._index=i.length,i.push(e),this._textureCacheDirty=!0,e};js.prototype.remove=function(e){if(!this.contains(e))return!1;const t=this._stageNames,n=B1;for(n.push(e);n.length>0;){const i=n.pop();delete t[i.name];const o=i.length;if(c(o))for(let r=0;r<o;++r)n.push(i.get(r))}return this._stages[e._index]=void 0,this._stagesRemoved=!0,this._textureCacheDirty=!0,e._index=void 0,e._textureCache=void 0,e.destroy(),!0};js.prototype.contains=function(e){return c(e)&&c(e._index)&&e._textureCache===this._textureCache};js.prototype.get=function(e){z1(this);const t=this._stages,n=t.length;return A.typeOf.number.greaterThanOrEquals("stages length",n,0),A.typeOf.number.greaterThanOrEquals("index",e,0),A.typeOf.number.lessThan("index",e,n),t[e]};js.prototype.removeAll=function(){const e=this._stages,t=e.length;for(let n=0;n<t;++n)this.remove(e[n]);e.length=0};js.prototype.getStageByName=function(e){return this._stageNames[e]};js.prototype.update=function(e,t,n){z1(this);const i=this._activeStages,o=this._activeStages=this._previousActiveStages;this._previousActiveStages=i;const r=this._stages;let s=o.length=r.length,a,l,u=0;for(a=0;a<s;++a)l=r[a],l.ready&&l.enabled&&l._isSupported(e)&&(o[u++]=l);o.length=u;let h=u!==i.length;if(!h){for(a=0;a<u;++a)if(o[a]!==i[a]){h=!0;break}}const f=this._ao,_=this._bloom,g=this._autoExposure,m=this._tonemapping,b=this._fxaa;m.enabled=n;const T=f.enabled&&f._isSupported(e),x=_.enabled&&_._isSupported(e),C=m.enabled&&m._isSupported(e),w=b.enabled&&b._isSupported(e);if((h||this._textureCacheDirty||T!==this._aoEnabled||x!==this._bloomEnabled||C!==this._tonemappingEnabled||w!==this._fxaaEnabled)&&(this._textureCache.updateDependencies(),this._aoEnabled=T,this._bloomEnabled=x,this._tonemappingEnabled=C,this._fxaaEnabled=w,this._textureCacheDirty=!1),c(this._randomTexture)&&!T&&(this._randomTexture.destroy(),this._randomTexture=void 0),!c(this._randomTexture)&&T){s=256*256*3;const v=new Uint8Array(s);for(a=0;a<s;a+=3)v[a]=Math.floor(Math.random()*255);this._randomTexture=new xt({context:e,pixelFormat:Ve.RGB,pixelDatatype:Me.UNSIGNED_BYTE,source:{arrayBufferView:v,width:256,height:256},sampler:new un({wrapS:Fn.REPEAT,wrapT:Fn.REPEAT,minificationFilter:en.NEAREST,magnificationFilter:Yo.NEAREST})})}for(this._textureCache.update(e),b.update(e,t),f.update(e,t),_.update(e,t),m.update(e,t),this._autoExposureEnabled&&g.update(e,t),s=r.length,a=0;a<s;++a)r[a].update(e,t);for(u=0,a=0;a<s;++a)l=r[a],l.ready&&l.enabled&&l._isSupported(e)&&u++;h=u!==o.length,h&&this.update(e,t,n)};js.prototype.clear=function(e){this._textureCache.clear(e),this._autoExposureEnabled&&this._autoExposure.clear(e)};function Hf(e){for(;c(e.length);)e=e.get(e.length-1);return e.outputTexture}js.prototype.getOutputTexture=function(e){const t=this.getStageByName(e);if(!!c(t))return Hf(t)};function Yl(e,t,n,i,o){if(c(e.execute)){e.execute(t,n,i,o);return}const r=e.length;let s;if(e.inputPreviousStageTexture)for(Yl(e.get(0),t,n,i,o),s=1;s<r;++s)Yl(e.get(s),t,Hf(e.get(s-1)),i,o);else for(s=0;s<r;++s)Yl(e.get(s),t,n,i,o)}js.prototype.execute=function(e,t,n,i){const o=this._activeStages,r=o.length,s=this._fxaa,a=this._ao,l=this._bloom,u=this._autoExposure,h=this._tonemapping,f=a.enabled&&a._isSupported(e),_=l.enabled&&l._isSupported(e),g=this._autoExposureEnabled,m=h.enabled&&h._isSupported(e),b=s.enabled&&s._isSupported(e);if(!b&&!f&&!_&&!m&&r===0)return;let T=t;f&&a.ready&&(Yl(a,e,T,n,i),T=Hf(a)),_&&l.ready&&(Yl(l,e,T,n,i),T=Hf(l)),g&&u.ready&&Yl(u,e,T,n,i),m&&h.ready&&(Yl(h,e,T,n,i),T=Hf(h));let x=T;if(r>0){Yl(o[0],e,T,n,i);for(let C=1;C<r;++C)Yl(o[C],e,Hf(o[C-1]),n,i);x=Hf(o[r-1])}b&&s.ready&&Yl(s,e,x,n,i)};js.prototype.copy=function(e,t){if(!c(this._copyColorCommand)){const n=this;this._copyColorCommand=e.createViewportQuadCommand(Ep,{uniformMap:{colorTexture:function(){return n.outputTexture}},owner:this})}this._copyColorCommand.framebuffer=t,this._copyColorCommand.execute(e)};js.prototype.isDestroyed=function(){return!1};js.prototype.destroy=function(){return this._fxaa.destroy(),this._ao.destroy(),this._bloom.destroy(),this._autoExposure.destroy(),this._tonemapping.destroy(),this.removeAll(),this._textureCache=this._textureCache&&this._textureCache.destroy(),ve(this)};const xUe={SHIFT:0,CTRL:1,ALT:2},Tc=Object.freeze(xUe),CUe={LEFT_DOWN:0,LEFT_UP:1,LEFT_CLICK:2,LEFT_DOUBLE_CLICK:3,RIGHT_DOWN:5,RIGHT_UP:6,RIGHT_CLICK:7,MIDDLE_DOWN:10,MIDDLE_UP:11,MIDDLE_CLICK:12,MOUSE_MOVE:15,WHEEL:16,PINCH_START:17,PINCH_END:18,PINCH_MOVE:19},pn=Object.freeze(CUe);function sf(e,t,n){const i=e._element;if(i===document)return n.x=t.clientX,n.y=t.clientY,n;const o=i.getBoundingClientRect();return n.x=t.clientX-o.left,n.y=t.clientY-o.top,n}function U1(e,t){let n=e;return c(t)&&(n+=`+${t}`),n}function Xp(e){if(e.shiftKey)return Tc.SHIFT;if(e.ctrlKey)return Tc.CTRL;if(e.altKey)return Tc.ALT}const Vo={LEFT:0,MIDDLE:1,RIGHT:2};function pa(e,t,n,i){function o(r){i(e,r)}Yt.isInternetExplorer()?n.addEventListener(t,o,!1):n.addEventListener(t,o,{capture:!1,passive:!1}),e._removalFunctions.push(function(){n.removeEventListener(t,o,!1)})}function EUe(e){const t=e._element,n=c(t.disableRootEvents)?t:document;Yt.supportsPointerEvents()?(pa(e,"pointerdown",t,PUe),pa(e,"pointerup",t,Z3),pa(e,"pointermove",t,OUe),pa(e,"pointercancel",t,Z3)):(pa(e,"mousedown",t,a6),pa(e,"mouseup",n,c6),pa(e,"mousemove",n,l6),pa(e,"touchstart",t,IUe),pa(e,"touchend",n,Y3),pa(e,"touchmove",n,DUe),pa(e,"touchcancel",n,Y3)),pa(e,"dblclick",t,SUe);let i;"onwheel"in t?i="wheel":document.onmousewheel!==void 0?i="mousewheel":i="DOMMouseScroll",pa(e,i,t,vUe)}function wUe(e){const t=e._removalFunctions;for(let n=0;n<t.length;++n)t[n]()}const G3={position:new H};function k1(e){e._lastSeenTouchEvent=xo()}function V1(e){return xo()-e._lastSeenTouchEvent>da.mouseEmulationIgnoreMilliseconds}function KD(e,t,n){const i=e.x-t.x,o=e.y-t.y;return Math.sqrt(i*i+o*o)<n}function a6(e,t){if(!V1(e))return;const n=t.button;e._buttonDown[n]=!0;let i;if(n===Vo.LEFT)i=pn.LEFT_DOWN;else if(n===Vo.MIDDLE)i=pn.MIDDLE_DOWN;else if(n===Vo.RIGHT)i=pn.RIGHT_DOWN;else return;const o=sf(e,t,e._primaryPosition);H.clone(o,e._primaryStartPosition),H.clone(o,e._primaryPreviousPosition);const r=Xp(t),s=e.getInputAction(i,r);c(s)&&(H.clone(o,G3.position),s(G3),t.preventDefault())}const j3={position:new H},W3={position:new H};function Rv(e,t,n,i){const o=Xp(i),r=e.getInputAction(t,o),s=e.getInputAction(n,o);if(c(r)||c(s)){const a=sf(e,i,e._primaryPosition);if(c(r)&&(H.clone(a,j3.position),r(j3)),c(s)){const l=e._primaryStartPosition;KD(l,a,e._clickPixelTolerance)&&(H.clone(a,W3.position),s(W3))}}}function c6(e,t){if(!V1(e))return;const n=t.button;n!==Vo.LEFT&&n!==Vo.MIDDLE&&n!==Vo.RIGHT||(e._buttonDown[Vo.LEFT]&&(Rv(e,pn.LEFT_UP,pn.LEFT_CLICK,t),e._buttonDown[Vo.LEFT]=!1),e._buttonDown[Vo.MIDDLE]&&(Rv(e,pn.MIDDLE_UP,pn.MIDDLE_CLICK,t),e._buttonDown[Vo.MIDDLE]=!1),e._buttonDown[Vo.RIGHT]&&(Rv(e,pn.RIGHT_UP,pn.RIGHT_CLICK,t),e._buttonDown[Vo.RIGHT]=!1))}const Nv={startPosition:new H,endPosition:new H};function l6(e,t){if(!V1(e))return;const n=Xp(t),i=sf(e,t,e._primaryPosition),o=e._primaryPreviousPosition,r=e.getInputAction(pn.MOUSE_MOVE,n);c(r)&&(H.clone(o,Nv.startPosition),H.clone(i,Nv.endPosition),r(Nv)),H.clone(i,o),(e._buttonDown[Vo.LEFT]||e._buttonDown[Vo.MIDDLE]||e._buttonDown[Vo.RIGHT])&&t.preventDefault()}const q3={position:new H};function SUe(e,t){const n=t.button;let i;if(n===Vo.LEFT)i=pn.LEFT_DOUBLE_CLICK;else return;const o=Xp(t),r=e.getInputAction(i,o);c(r)&&(sf(e,t,q3.position),r(q3))}function vUe(e,t){let n;if(c(t.deltaY)){const r=t.deltaMode;r===t.DOM_DELTA_PIXEL?n=-t.deltaY:r===t.DOM_DELTA_LINE?n=-t.deltaY*40:n=-t.deltaY*120}else t.detail>0?n=t.detail*-120:n=t.wheelDelta;if(!c(n))return;const i=Xp(t),o=e.getInputAction(pn.WHEEL,i);c(o)&&(o(n),t.preventDefault())}function IUe(e,t){k1(e);const n=t.changedTouches;let i;const o=n.length;let r,s;const a=e._positions;for(i=0;i<o;++i)r=n[i],s=r.identifier,a.set(s,sf(e,r,new H));hE(e,t);const l=e._previousPositions;for(i=0;i<o;++i)r=n[i],s=r.identifier,l.set(s,H.clone(a.get(s)))}function Y3(e,t){k1(e);const n=t.changedTouches;let i;const o=n.length;let r,s;const a=e._positions;for(i=0;i<o;++i)r=n[i],s=r.identifier,a.remove(s);hE(e,t);const l=e._previousPositions;for(i=0;i<o;++i)r=n[i],s=r.identifier,l.remove(s)}const $3={position:new H},Mv={position1:new H,position2:new H},X3={position:new H},Q3={position:new H},K3={position:new H};function hE(e,t){const n=Xp(t),i=e._positions,o=i.length;let r,s;const a=e._isPinching;if(o!==1&&e._buttonDown[Vo.LEFT]){if(e._buttonDown[Vo.LEFT]=!1,c(e._touchHoldTimer)&&(clearTimeout(e._touchHoldTimer),e._touchHoldTimer=void 0),r=e.getInputAction(pn.LEFT_UP,n),c(r)&&(H.clone(e._primaryPosition,X3.position),r(X3)),o===0&&!e._isTouchHolding&&(s=e.getInputAction(pn.LEFT_CLICK,n),c(s))){const l=e._primaryStartPosition,u=e._previousPositions.values[0];KD(l,u,e._clickPixelTolerance)&&(H.clone(e._primaryPosition,Q3.position),s(Q3))}e._isTouchHolding=!1}if(o===0&&a&&(e._isPinching=!1,r=e.getInputAction(pn.PINCH_END,n),c(r)&&r()),o===1&&!a){const l=i.values[0];H.clone(l,e._primaryPosition),H.clone(l,e._primaryStartPosition),H.clone(l,e._primaryPreviousPosition),e._buttonDown[Vo.LEFT]=!0,r=e.getInputAction(pn.LEFT_DOWN,n),c(r)&&(H.clone(l,$3.position),r($3)),e._touchHoldTimer=setTimeout(function(){if(!e.isDestroyed()&&(e._touchHoldTimer=void 0,e._isTouchHolding=!0,s=e.getInputAction(pn.RIGHT_CLICK,n),c(s))){const u=e._primaryStartPosition,h=e._previousPositions.values[0];KD(u,h,e._holdPixelTolerance)&&(H.clone(e._primaryPosition,K3.position),s(K3))}},da.touchHoldDelayMilliseconds),t.preventDefault()}o===2&&!a&&(e._isPinching=!0,r=e.getInputAction(pn.PINCH_START,n),c(r)&&(H.clone(i.values[0],Mv.position1),H.clone(i.values[1],Mv.position2),r(Mv),t.preventDefault()))}function DUe(e,t){k1(e);const n=t.changedTouches;let i;const o=n.length;let r,s;const a=e._positions;for(i=0;i<o;++i){r=n[i],s=r.identifier;const u=a.get(s);c(u)&&sf(e,r,u)}u6(e,t);const l=e._previousPositions;for(i=0;i<o;++i)r=n[i],s=r.identifier,H.clone(a.get(s),l.get(s))}const Fv={startPosition:new H,endPosition:new H},sy={distance:{startPosition:new H,endPosition:new H},angleAndHeight:{startPosition:new H,endPosition:new H}};function u6(e,t){const n=Xp(t),i=e._positions,o=e._previousPositions,r=i.length;let s;if(r===1&&e._buttonDown[Vo.LEFT]){const a=i.values[0];H.clone(a,e._primaryPosition);const l=e._primaryPreviousPosition;s=e.getInputAction(pn.MOUSE_MOVE,n),c(s)&&(H.clone(l,Fv.startPosition),H.clone(a,Fv.endPosition),s(Fv)),H.clone(a,l),t.preventDefault()}else if(r===2&&e._isPinching&&(s=e.getInputAction(pn.PINCH_MOVE,n),c(s))){const a=i.values[0],l=i.values[1],u=o.values[0],h=o.values[1],f=l.x-a.x,_=l.y-a.y,g=Math.sqrt(f*f+_*_)*.25,m=h.x-u.x,b=h.y-u.y,T=Math.sqrt(m*m+b*b)*.25,x=(l.y+a.y)*.125,C=(h.y+u.y)*.125,w=Math.atan2(_,f),v=Math.atan2(b,m);H.fromElements(0,T,sy.distance.startPosition),H.fromElements(0,g,sy.distance.endPosition),H.fromElements(v,C,sy.angleAndHeight.startPosition),H.fromElements(w,x,sy.angleAndHeight.endPosition),s(sy)}}function PUe(e,t){if(t.target.setPointerCapture(t.pointerId),t.pointerType==="touch"){const n=e._positions,i=t.pointerId;n.set(i,sf(e,t,new H)),hE(e,t),e._previousPositions.set(i,H.clone(n.get(i)))}else a6(e,t)}function Z3(e,t){if(t.pointerType==="touch"){const n=e._positions,i=t.pointerId;n.remove(i),hE(e,t),e._previousPositions.remove(i)}else c6(e,t)}function OUe(e,t){if(t.pointerType==="touch"){const n=e._positions,i=t.pointerId,o=n.get(i);if(!c(o))return;sf(e,t,o),u6(e,t);const r=e._previousPositions;H.clone(n.get(i),r.get(i))}else l6(e,t)}function da(e){this._inputEvents={},this._buttonDown={LEFT:!1,MIDDLE:!1,RIGHT:!1},this._isPinching=!1,this._isTouchHolding=!1,this._lastSeenTouchEvent=-da.mouseEmulationIgnoreMilliseconds,this._primaryStartPosition=new H,this._primaryPosition=new H,this._primaryPreviousPosition=new H,this._positions=new mt,this._previousPositions=new mt,this._removalFunctions=[],this._touchHoldTimer=void 0,this._clickPixelTolerance=5,this._holdPixelTolerance=25,this._element=y(e,document),EUe(this)}da.prototype.setInputAction=function(e,t,n){if(!c(e))throw new E("action is required.");if(!c(t))throw new E("type is required.");const i=U1(t,n);this._inputEvents[i]=e};da.prototype.getInputAction=function(e,t){if(!c(e))throw new E("type is required.");const n=U1(e,t);return this._inputEvents[n]};da.prototype.removeInputAction=function(e,t){if(!c(e))throw new E("type is required.");const n=U1(e,t);delete this._inputEvents[n]};da.prototype.isDestroyed=function(){return!1};da.prototype.destroy=function(){return wUe(this),ve(this)};da.mouseEmulationIgnoreMilliseconds=800;da.touchHoldDelayMilliseconds=1500;function Qp(e){A.typeOf.object("scene",e),this._scene=e,this._currentTweens=[],this._morphHandler=void 0,this._morphCancelled=!1,this._completeMorph=void 0,this._morphToOrthographic=!1}Qp.prototype.completeMorph=function(){c(this._completeMorph)&&this._completeMorph()};Qp.prototype.morphTo2D=function(e,t){c(this._completeMorph)&&this._completeMorph();const n=this._scene;this._previousMode=n.mode,this._morphToOrthographic=n.camera.frustum instanceof It,!(this._previousMode===oe.SCENE2D||this._previousMode===oe.MORPHING)&&(this._scene.morphStart.raiseEvent(this,this._previousMode,oe.SCENE2D,!0),n._mode=oe.MORPHING,n.camera._setTransform(L.IDENTITY),this._previousMode===oe.COLUMBUS_VIEW?uke(this,e):gke(this,e,t),e===0&&c(this._completeMorph)&&this._completeMorph())};const LUe=new d,RUe=new d,NUe=new d,MUe=new d,FUe=new d,BUe=new d,zUe=new d,UUe=new he,kUe=new L,VUe=new _n,HUe=new It,GUe={position:void 0,direction:void 0,up:void 0,position2D:void 0,direction2D:void 0,up2D:void 0,frustum:void 0};Qp.prototype.morphToColumbusView=function(e,t){c(this._completeMorph)&&this._completeMorph();const n=this._scene;if(this._previousMode=n.mode,this._previousMode===oe.COLUMBUS_VIEW||this._previousMode===oe.MORPHING)return;this._scene.morphStart.raiseEvent(this,this._previousMode,oe.COLUMBUS_VIEW,!0),n.camera._setTransform(L.IDENTITY);let i=LUe;const o=RUe,r=NUe;if(e>0)i.x=0,i.y=-1,i.z=1,i=d.multiplyByScalar(d.normalize(i,i),5*t.maximumRadius,i),d.negate(d.normalize(i,o),o),d.cross(d.UNIT_X,o,r);else{const u=n.camera;if(this._previousMode===oe.SCENE2D)d.clone(u.position,i),i.z=u.frustum.right-u.frustum.left,d.negate(d.UNIT_Z,o),d.clone(d.UNIT_Y,r);else{d.clone(u.positionWC,i),d.clone(u.directionWC,o),d.clone(u.upWC,r);const h=t.scaleToGeodeticSurface(i,zUe),f=zt.eastNorthUpToFixedFrame(h,t,kUe);L.inverseTransformation(f,f),n.mapProjection.project(t.cartesianToCartographic(i,UUe),i),L.multiplyByPointAsVector(f,o,o),L.multiplyByPointAsVector(f,r,r)}}let s;this._morphToOrthographic?(s=HUe,s.width=n.camera.frustum.right-n.camera.frustum.left,s.aspectRatio=n.drawingBufferWidth/n.drawingBufferHeight):(s=VUe,s.aspectRatio=n.drawingBufferWidth/n.drawingBufferHeight,s.fov=R.toRadians(60));const a=GUe;a.position=i,a.direction=o,a.up=r,a.frustum=s;const l=bke(a);hb(this,l),this._previousMode===oe.SCENE2D?yke(this,e,a,l):(a.position2D=L.multiplyByPoint(Ye.TRANSFORM_2D,i,MUe),a.direction2D=L.multiplyByPointAsVector(Ye.TRANSFORM_2D,o,FUe),a.up2D=L.multiplyByPointAsVector(Ye.TRANSFORM_2D,r,BUe),n._mode=oe.MORPHING,T6(this,e,a,l)),e===0&&c(this._completeMorph)&&this._completeMorph()};const H1={position:new d,direction:new d,up:new d,frustum:void 0},d6=new _n;Qp.prototype.morphTo3D=function(e,t){c(this._completeMorph)&&this._completeMorph();const n=this._scene;if(this._previousMode=n.mode,!(this._previousMode===oe.SCENE3D||this._previousMode===oe.MORPHING)){if(this._scene.morphStart.raiseEvent(this,this._previousMode,oe.SCENE3D,!0),n._mode=oe.MORPHING,n.camera._setTransform(L.IDENTITY),this._previousMode===oe.SCENE2D)eke(this,e,t);else{let i;e>0?(i=H1,d.fromDegrees(0,0,5*t.maximumRadius,t,i.position),d.negate(i.position,i.direction),d.normalize(i.direction,i.direction),d.clone(d.UNIT_Z,i.up)):i=h6(this,t);let o;const r=n.camera;r.frustum instanceof It?o=r.frustum.clone():(o=d6,o.aspectRatio=n.drawingBufferWidth/n.drawingBufferHeight,o.fov=R.toRadians(60)),i.frustum=o;const s=x6(i);hb(this,s),ZD(this,e,i,s)}e===0&&c(this._completeMorph)&&this._completeMorph()}};Qp.prototype.isDestroyed=function(){return!1};Qp.prototype.destroy=function(){return fE(this),ve(this)};function hb(e,t){if(e._scene.completeMorphOnUserInput){e._morphHandler=new da(e._scene.canvas);const n=function(){e._morphCancelled=!0,e._scene.camera.cancelFlight(),t(e)};e._completeMorph=n,e._morphHandler.setInputAction(n,pn.LEFT_DOWN),e._morphHandler.setInputAction(n,pn.MIDDLE_DOWN),e._morphHandler.setInputAction(n,pn.RIGHT_DOWN),e._morphHandler.setInputAction(n,pn.WHEEL)}}function fE(e){const t=e._currentTweens;for(let n=0;n<t.length;++n)t[n].cancelTween();e._currentTweens.length=0,e._morphHandler=e._morphHandler&&e._morphHandler.destroy()}const jUe=new he,WUe=new d,qUe=new L;function h6(e,t){const n=e._scene,i=n.camera,o=H1,r=o.position,s=o.direction,a=o.up,l=n.mapProjection.unproject(i.position,jUe);t.cartographicToCartesian(l,r);const u=t.scaleToGeodeticSurface(r,WUe),h=zt.eastNorthUpToFixedFrame(u,t,qUe);return L.multiplyByPointAsVector(h,i.direction,s),L.multiplyByPointAsVector(h,i.up,a),o}const YUe=new d,$Ue=new d,XUe=new d,QUe=new d,KUe=new d,ZUe=new d;function ZD(e,t,n,i){t*=.5;const o=e._scene,r=o.camera,s=d.clone(r.position,YUe),a=d.clone(r.direction,$Ue),l=d.clone(r.up,XUe),u=L.multiplyByPoint(Ye.TRANSFORM_2D_INVERSE,n.position,QUe),h=L.multiplyByPointAsVector(Ye.TRANSFORM_2D_INVERSE,n.direction,KUe),f=L.multiplyByPointAsVector(Ye.TRANSFORM_2D_INVERSE,n.up,ZUe);function _(m){Ac(s,u,m.time,r.position),Ac(a,h,m.time,r.direction),Ac(l,f,m.time,r.up),d.cross(r.direction,r.up,r.right),d.normalize(r.right,r.right)}const g=o.tweens.add({duration:t,easingFunction:ka.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:_,complete:function(){A6(e,o,0,1,t,i)}});e._currentTweens.push(g)}const JUe=new It,f6=new d,p6=new d,m6=new d,G1=new d,_6=new d,g6=new d;function eke(e,t,n){t/=3;const i=e._scene,o=i.camera;let r;t>0?(r=H1,d.fromDegrees(0,0,5*n.maximumRadius,n,r.position),d.negate(r.position,r.direction),d.normalize(r.direction,r.direction),d.clone(d.UNIT_Z,r.up)):(o.position.z=o.frustum.right-o.frustum.left,r=h6(e,n));let s;e._morphToOrthographic?(s=JUe,s.aspectRatio=i.drawingBufferWidth/i.drawingBufferHeight,s.width=o.frustum.right-o.frustum.left):(s=d6,s.aspectRatio=i.drawingBufferWidth/i.drawingBufferHeight,s.fov=R.toRadians(60)),r.frustum=s;const a=x6(r);hb(e,a);let l;e._morphToOrthographic?l=function(){ZD(e,t,r,a)}:l=function(){b6(e,t,r,function(){ZD(e,t,r,a)})},t>0?(i._mode=oe.SCENE2D,o.flyTo({duration:t,destination:d.fromDegrees(0,0,5*n.maximumRadius,n,G1),complete:function(){i._mode=oe.MORPHING,l()}})):l()}function Ac(e,t,n,i){return d.lerp(e,t,n,i)}function y6(e,t,n,i,o){const r=e._scene,s=r.camera;if(s.frustum instanceof It)return;const a=s.frustum.fov,l=R.RADIANS_PER_DEGREE*.5,u=n.position.z*Math.tan(a*.5);s.frustum.far=u/Math.tan(l*.5)+1e7;function h(_){s.frustum.fov=R.lerp(a,l,_.time);const g=u/Math.tan(s.frustum.fov*.5);i(s,g)}const f=r.tweens.add({duration:t,easingFunction:ka.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:h,complete:function(){s.frustum=n.frustum.clone(),o(e)}});e._currentTweens.push(f)}const tke=new d,nke=new d,ike=new d,Bv=new d,oke=new d,rke=new d,ske=new Ki,ake=new nn,cke=new d,lke={position:void 0,direction:void 0,up:void 0,frustum:void 0};function uke(e,t){t*=.5;const n=e._scene,i=n.camera,o=d.clone(i.position,tke),r=d.clone(i.direction,nke),s=d.clone(i.up,ike),a=d.negate(d.UNIT_Z,oke),l=d.clone(d.UNIT_Y,rke),u=Bv;if(t>0)d.clone(d.ZERO,Bv),u.z=5*n.mapProjection.ellipsoid.maximumRadius;else{d.clone(o,Bv);const T=ake;L.multiplyByPoint(Ye.TRANSFORM_2D,o,T.origin),L.multiplyByPointAsVector(Ye.TRANSFORM_2D,r,T.direction);const x=n.globe;if(c(x)){const C=x.pickWorldCoordinates(T,n,!0,cke);c(C)&&(L.multiplyByPoint(Ye.TRANSFORM_2D_INVERSE,C,u),u.z+=d.distance(o,u))}}const h=ske;h.right=u.z*.5,h.left=-h.right,h.top=h.right*(n.drawingBufferHeight/n.drawingBufferWidth),h.bottom=-h.top;const f=lke;f.position=u,f.direction=a,f.up=l,f.frustum=h;const _=C6(f);hb(e,_);function g(T){Ac(o,u,T.time,i.position),Ac(r,a,T.time,i.direction),Ac(s,l,T.time,i.up),d.cross(i.direction,i.up,i.right),d.normalize(i.right,i.right),i._adjustOrthographicFrustum(!0)}function m(T,x){T.position.z=x}const b=n.tweens.add({duration:t,easingFunction:ka.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:g,complete:function(){y6(e,t,f,m,_)}});e._currentTweens.push(b)}const J3=new he,dke={position:new d,direction:new d,up:new d,position2D:new d,direction2D:new d,up2D:new d,frustum:new Ki},hke={position:new d,direction:new d,up:new d,frustum:void 0},fke=new d,pke=new nn,mke=new L,_ke=new d;function gke(e,t,n){t*=.5;const i=e._scene,o=i.camera,r=dke;if(t>0)d.clone(d.ZERO,r.position),r.position.z=5*n.maximumRadius,d.negate(d.UNIT_Z,r.direction),d.clone(d.UNIT_Y,r.up);else{n.cartesianToCartographic(o.positionWC,J3),i.mapProjection.project(J3,r.position),d.negate(d.UNIT_Z,r.direction),d.clone(d.UNIT_Y,r.up);const f=pke;d.clone(r.position2D,f.origin);const _=d.clone(o.directionWC,f.direction),g=n.scaleToGeodeticSurface(o.positionWC,_ke),m=zt.eastNorthUpToFixedFrame(g,n,mke);L.inverseTransformation(m,m),L.multiplyByPointAsVector(m,_,_),L.multiplyByPointAsVector(Ye.TRANSFORM_2D,_,_);const b=i.globe;if(c(b)){const T=b.pickWorldCoordinates(f,i,!0,fke);if(c(T)){const x=d.distance(r.position2D,T);T.x+=x,d.clone(T,r.position2D)}}}function s(f,_){f.position.x=_}L.multiplyByPoint(Ye.TRANSFORM_2D,r.position,r.position2D),L.multiplyByPointAsVector(Ye.TRANSFORM_2D,r.direction,r.direction2D),L.multiplyByPointAsVector(Ye.TRANSFORM_2D,r.up,r.up2D);const a=r.frustum;a.right=r.position.z*.5,a.left=-a.right,a.top=a.right*(i.drawingBufferHeight/i.drawingBufferWidth),a.bottom=-a.top;const l=hke;L.multiplyByPoint(Ye.TRANSFORM_2D_INVERSE,r.position2D,l.position),d.clone(r.direction,l.direction),d.clone(r.up,l.up),l.frustum=a;const u=C6(l);hb(e,u);function h(){y6(e,t,r,s,u)}T6(e,t,r,h)}function b6(e,t,n,i){const o=e._scene,r=o.camera,s=r.frustum.right-r.frustum.left;r.frustum=n.frustum.clone();const a=r.frustum.fov,l=R.RADIANS_PER_DEGREE*.5,u=s*Math.tan(a*.5);r.frustum.far=u/Math.tan(l*.5)+1e7,r.frustum.fov=l;function h(_){r.frustum.fov=R.lerp(l,a,_.time),r.position.z=u/Math.tan(r.frustum.fov*.5)}const f=o.tweens.add({duration:t,easingFunction:ka.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:h,complete:function(){i(e)}});e._currentTweens.push(f)}function yke(e,t,n,i){t*=.5;const o=e._scene,r=o.camera,s=d.clone(n.position,G1),a=d.clone(n.direction,_6),l=d.clone(n.up,g6);o._mode=oe.MORPHING;function u(){r.frustum=n.frustum.clone();const h=d.clone(r.position,f6),f=d.clone(r.direction,p6),_=d.clone(r.up,m6);h.z=s.z;function g(b){Ac(h,s,b.time,r.position),Ac(f,a,b.time,r.direction),Ac(_,l,b.time,r.up),d.cross(r.direction,r.up,r.right),d.normalize(r.right,r.right)}const m=o.tweens.add({duration:t,easingFunction:ka.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:g,complete:function(){i(e)}});e._currentTweens.push(m)}e._morphToOrthographic?u():b6(e,0,n,u)}function T6(e,t,n,i){const o=e._scene,r=o.camera,s=d.clone(r.position,f6),a=d.clone(r.direction,p6),l=d.clone(r.up,m6),u=d.clone(n.position2D,G1),h=d.clone(n.direction2D,_6),f=d.clone(n.up2D,g6);function _(m){Ac(s,u,m.time,r.position),Ac(a,h,m.time,r.direction),Ac(l,f,m.time,r.up),d.cross(r.direction,r.up,r.right),d.normalize(r.right,r.right),r._adjustOrthographicFrustum(!0)}const g=o.tweens.add({duration:t,easingFunction:ka.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:_,complete:function(){A6(e,o,1,0,t,i)}});e._currentTweens.push(g)}function A6(e,t,n,i,o,r){const s={object:t,property:"morphTime",startValue:n,stopValue:i,duration:o,easingFunction:ka.QUARTIC_OUT};c(r)&&(s.complete=function(){r(e)});const a=t.tweens.addProperty(s);e._currentTweens.push(a)}function x6(e){return function(t){const n=t._scene;n._mode=oe.SCENE3D,n.morphTime=oe.getMorphTime(oe.SCENE3D),fE(t);const i=n.camera;(t._previousMode!==oe.MORPHING||t._morphCancelled)&&(t._morphCancelled=!1,d.clone(e.position,i.position),d.clone(e.direction,i.direction),d.clone(e.up,i.up),d.cross(i.direction,i.up,i.right),d.normalize(i.right,i.right),i.frustum=e.frustum.clone());const o=i.frustum;n.frameState.useLogDepth&&(o.near=.1,o.far=1e10);const r=c(t._completeMorph);t._completeMorph=void 0,n.camera.update(n.mode),t._scene.morphComplete.raiseEvent(t,t._previousMode,oe.SCENE3D,r)}}function C6(e){return function(t){const n=t._scene;n._mode=oe.SCENE2D,n.morphTime=oe.getMorphTime(oe.SCENE2D),fE(t);const i=n.camera;d.clone(e.position,i.position),i.position.z=n.mapProjection.ellipsoid.maximumRadius*2,d.clone(e.direction,i.direction),d.clone(e.up,i.up),d.cross(i.direction,i.up,i.right),d.normalize(i.right,i.right),i.frustum=e.frustum.clone();const o=c(t._completeMorph);t._completeMorph=void 0,n.camera.update(n.mode),t._scene.morphComplete.raiseEvent(t,t._previousMode,oe.SCENE2D,o)}}function bke(e){return function(t){const n=t._scene;n._mode=oe.COLUMBUS_VIEW,n.morphTime=oe.getMorphTime(oe.COLUMBUS_VIEW),fE(t);const i=n.camera;(t._previousModeMode!==oe.MORPHING||t._morphCancelled)&&(t._morphCancelled=!1,d.clone(e.position,i.position),d.clone(e.direction,i.direction),d.clone(e.up,i.up),d.cross(i.direction,i.up,i.right),d.normalize(i.right,i.right));const o=i.frustum;n.frameState.useLogDepth&&(o.near=.1,o.far=1e10);const r=c(t._completeMorph);t._completeMorph=void 0,n.camera.update(n.mode),t._scene.morphComplete.raiseEvent(t,t._previousMode,oe.COLUMBUS_VIEW,r)}}const Tke={LEFT_DRAG:0,RIGHT_DRAG:1,MIDDLE_DRAG:2,WHEEL:3,PINCH:4},Gn=Object.freeze(Tke);function _s(e,t){let n=e;return c(t)&&(n+=`+${t}`),n}function Ake(e,t){H.clone(e.distance.startPosition,t.distance.startPosition),H.clone(e.distance.endPosition,t.distance.endPosition),H.clone(e.angleAndHeight.startPosition,t.angleAndHeight.startPosition),H.clone(e.angleAndHeight.endPosition,t.angleAndHeight.endPosition)}function ez(e,t,n){const i=_s(Gn.PINCH,t),o=e._update,r=e._isDown,s=e._eventStartPosition,a=e._pressTime,l=e._releaseTime;o[i]=!0,r[i]=!1,s[i]=new H;let u=e._movement[i];c(u)||(u=e._movement[i]={}),u.distance={startPosition:new H,endPosition:new H},u.angleAndHeight={startPosition:new H,endPosition:new H},u.prevAngle=0,e._eventHandler.setInputAction(function(h){e._buttonsDown++,r[i]=!0,a[i]=new Date,H.lerp(h.position1,h.position2,.5,s[i])},pn.PINCH_START,t),e._eventHandler.setInputAction(function(){e._buttonsDown=Math.max(e._buttonsDown-1,0),r[i]=!1,l[i]=new Date},pn.PINCH_END,t),e._eventHandler.setInputAction(function(h){if(r[i]){o[i]?(Ake(h,u),o[i]=!1,u.prevAngle=u.angleAndHeight.startPosition.x):(H.clone(h.distance.endPosition,u.distance.endPosition),H.clone(h.angleAndHeight.endPosition,u.angleAndHeight.endPosition));let f=u.angleAndHeight.endPosition.x;const _=u.prevAngle,g=Math.PI*2;for(;f>=_+Math.PI;)f-=g;for(;f<_-Math.PI;)f+=g;u.angleAndHeight.endPosition.x=-f*n.clientWidth/12,u.angleAndHeight.startPosition.x=-_*n.clientWidth/12}},pn.PINCH_MOVE,t)}function tz(e,t){const n=_s(Gn.WHEEL,t),i=e._pressTime,o=e._releaseTime,r=e._update;r[n]=!0;let s=e._movement[n];c(s)||(s=e._movement[n]={});let a=e._lastMovement[n];c(a)||(a=e._lastMovement[n]={startPosition:new H,endPosition:new H,valid:!1}),s.startPosition=new H,H.clone(H.ZERO,s.startPosition),s.endPosition=new H,e._eventHandler.setInputAction(function(l){const u=7.5*R.toRadians(l);i[n]=o[n]=new Date,s.endPosition.x=0,s.endPosition.y=u,H.clone(s.endPosition,a.endPosition),a.valid=!0,r[n]=!1},pn.WHEEL,t)}function Pm(e,t,n){const i=_s(n,t),o=e._isDown,r=e._eventStartPosition,s=e._pressTime,a=e._releaseTime;o[i]=!1,r[i]=new H;let l=e._lastMovement[i];c(l)||(l=e._lastMovement[i]={startPosition:new H,endPosition:new H,valid:!1});let u,h;n===Gn.LEFT_DRAG?(u=pn.LEFT_DOWN,h=pn.LEFT_UP):n===Gn.RIGHT_DRAG?(u=pn.RIGHT_DOWN,h=pn.RIGHT_UP):n===Gn.MIDDLE_DRAG&&(u=pn.MIDDLE_DOWN,h=pn.MIDDLE_UP),e._eventHandler.setInputAction(function(f){e._buttonsDown++,l.valid=!1,o[i]=!0,s[i]=new Date,H.clone(f.position,r[i])},u,t),e._eventHandler.setInputAction(function(){e._buttonsDown=Math.max(e._buttonsDown-1,0),o[i]=!1,a[i]=new Date},h,t)}function nz(e,t){H.clone(e.startPosition,t.startPosition),H.clone(e.endPosition,t.endPosition)}function iz(e,t){const n=e._update,i=e._movement,o=e._lastMovement,r=e._isDown;for(const s in Gn)if(Gn.hasOwnProperty(s)){const a=Gn[s];if(c(a)){const l=_s(a,t);n[l]=!0,c(e._lastMovement[l])||(e._lastMovement[l]={startPosition:new H,endPosition:new H,valid:!1}),c(e._movement[l])||(e._movement[l]={startPosition:new H,endPosition:new H})}}e._eventHandler.setInputAction(function(s){for(const a in Gn)if(Gn.hasOwnProperty(a)){const l=Gn[a];if(c(l)){const u=_s(l,t);r[u]&&(n[u]?(nz(i[u],o[u]),o[u].valid=!0,nz(s,i[u]),n[u]=!1):H.clone(s.endPosition,i[u].endPosition))}}H.clone(s.endPosition,e._currentMousePosition)},pn.MOUSE_MOVE,t)}function jc(e){if(!c(e))throw new E("canvas is required.");this._eventHandler=new da(e),this._update={},this._movement={},this._lastMovement={},this._isDown={},this._eventStartPosition={},this._pressTime={},this._releaseTime={},this._buttonsDown=0,this._currentMousePosition=new H,tz(this,void 0),ez(this,void 0,e),Pm(this,void 0,Gn.LEFT_DRAG),Pm(this,void 0,Gn.RIGHT_DRAG),Pm(this,void 0,Gn.MIDDLE_DRAG),iz(this,void 0);for(const t in Tc)if(Tc.hasOwnProperty(t)){const n=Tc[t];c(n)&&(tz(this,n),ez(this,n,e),Pm(this,n,Gn.LEFT_DRAG),Pm(this,n,Gn.RIGHT_DRAG),Pm(this,n,Gn.MIDDLE_DRAG),iz(this,n))}}Object.defineProperties(jc.prototype,{currentMousePosition:{get:function(){return this._currentMousePosition}},anyButtonDown:{get:function(){const e=!this._update[_s(Gn.WHEEL)]||!this._update[_s(Gn.WHEEL,Tc.SHIFT)]||!this._update[_s(Gn.WHEEL,Tc.CTRL)]||!this._update[_s(Gn.WHEEL,Tc.ALT)];return this._buttonsDown>0||e}}});jc.prototype.isMoving=function(e,t){if(!c(e))throw new E("type is required.");const n=_s(e,t);return!this._update[n]};jc.prototype.getMovement=function(e,t){if(!c(e))throw new E("type is required.");const n=_s(e,t);return this._movement[n]};jc.prototype.getLastMovement=function(e,t){if(!c(e))throw new E("type is required.");const n=_s(e,t),i=this._lastMovement[n];if(i.valid)return i};jc.prototype.isButtonDown=function(e,t){if(!c(e))throw new E("type is required.");const n=_s(e,t);return this._isDown[n]};jc.prototype.getStartMousePosition=function(e,t){if(!c(e))throw new E("type is required.");if(e===Gn.WHEEL)return this._currentMousePosition;const n=_s(e,t);return this._eventStartPosition[n]};jc.prototype.getButtonPressTime=function(e,t){if(!c(e))throw new E("type is required.");const n=_s(e,t);return this._pressTime[n]};jc.prototype.getButtonReleaseTime=function(e,t){if(!c(e))throw new E("type is required.");const n=_s(e,t);return this._releaseTime[n]};jc.prototype.reset=function(){for(const e in this._update)this._update.hasOwnProperty(e)&&(this._update[e]=!0)};jc.prototype.isDestroyed=function(){return!1};jc.prototype.destroy=function(){return this._eventHandler=this._eventHandler&&this._eventHandler.destroy(),ve(this)};function aC(e,t,n,i,o,r,s,a,l,u){this._tweens=e,this._tweenjs=t,this._startObject=Je(n),this._stopObject=Je(i),this._duration=o,this._delay=r,this._easingFunction=s,this._update=a,this._complete=l,this.cancel=u,this.needsStart=!0}Object.defineProperties(aC.prototype,{startObject:{get:function(){return this._startObject}},stopObject:{get:function(){return this._stopObject}},duration:{get:function(){return this._duration}},delay:{get:function(){return this._delay}},easingFunction:{get:function(){return this._easingFunction}},update:{get:function(){return this._update}},complete:{get:function(){return this._complete}},tweenjs:{get:function(){return this._tweenjs}}});aC.prototype.cancelTween=function(){this._tweens.remove(this)};function Wc(){this._tweens=[]}Object.defineProperties(Wc.prototype,{length:{get:function(){return this._tweens.length}}});Wc.prototype.add=function(e){if(e=y(e,y.EMPTY_OBJECT),!c(e.startObject)||!c(e.stopObject))throw new E("options.startObject and options.stopObject are required.");if(!c(e.duration)||e.duration<0)throw new E("options.duration is required and must be positive.");if(e.duration===0)return c(e.complete)&&e.complete(),new aC(this);const t=e.duration/qn.SECONDS_PER_MILLISECOND,n=y(e.delay,0),i=n/qn.SECONDS_PER_MILLISECOND,o=y(e.easingFunction,ka.LINEAR_NONE),r=e.startObject,s=new w1e(r);s.to(Je(e.stopObject),t),s.delay(i),s.easing(o),c(e.update)&&s.onUpdate(function(){e.update(r)}),s.onComplete(y(e.complete,null)),s.repeat(y(e._repeat,0));const a=new aC(this,s,e.startObject,e.stopObject,e.duration,n,o,e.update,e.complete,e.cancel);return this._tweens.push(a),a};Wc.prototype.addProperty=function(e){e=y(e,y.EMPTY_OBJECT);const t=e.object,n=e.property,i=e.startValue,o=e.stopValue;if(!c(t)||!c(e.property))throw new E("options.object and options.property are required.");if(!c(t[n]))throw new E("options.object must have the specified property.");if(!c(i)||!c(o))throw new E("options.startValue and options.stopValue are required.");function r(s){t[n]=s.value}return this.add({startObject:{value:i},stopObject:{value:o},duration:y(e.duration,3),delay:e.delay,easingFunction:e.easingFunction,update:r,complete:e.complete,cancel:e.cancel,_repeat:e._repeat})};Wc.prototype.addAlpha=function(e){e=y(e,y.EMPTY_OBJECT);const t=e.material;if(!c(t))throw new E("options.material is required.");const n=[];for(const o in t.uniforms)t.uniforms.hasOwnProperty(o)&&c(t.uniforms[o])&&c(t.uniforms[o].alpha)&&n.push(o);if(n.length===0)throw new E("material has no properties with alpha components.");function i(o){const r=n.length;for(let s=0;s<r;++s)t.uniforms[n[s]].alpha=o.alpha}return this.add({startObject:{alpha:y(e.startValue,0)},stopObject:{alpha:y(e.stopValue,1)},duration:y(e.duration,3),delay:e.delay,easingFunction:e.easingFunction,update:i,complete:e.complete,cancel:e.cancel})};Wc.prototype.addOffsetIncrement=function(e){e=y(e,y.EMPTY_OBJECT);const t=e.material;if(!c(t))throw new E("material is required.");if(!c(t.uniforms.offset))throw new E("material.uniforms must have an offset property.");const n=t.uniforms;return this.addProperty({object:n,property:"offset",startValue:n.offset,stopValue:n.offset+1,duration:e.duration,delay:e.delay,easingFunction:e.easingFunction,update:e.update,cancel:e.cancel,_repeat:1/0})};Wc.prototype.remove=function(e){if(!c(e))return!1;const t=this._tweens.indexOf(e);return t!==-1?(e.tweenjs.stop(),c(e.cancel)&&e.cancel(),this._tweens.splice(t,1),!0):!1};Wc.prototype.removeAll=function(){const e=this._tweens;for(let t=0;t<e.length;++t){const n=e[t];n.tweenjs.stop(),c(n.cancel)&&n.cancel()}e.length=0};Wc.prototype.contains=function(e){return c(e)&&this._tweens.indexOf(e)!==-1};Wc.prototype.get=function(e){if(!c(e))throw new E("index is required.");return this._tweens[e]};Wc.prototype.update=function(e){const t=this._tweens;let n=0;for(e=c(e)?e/qn.SECONDS_PER_MILLISECOND:xo();n<t.length;){const i=t[n],o=i.tweenjs;i.needsStart?(i.needsStart=!1,o.start(e)):o.update(e)?n++:(o.stop(),t.splice(n,1))}};function fb(e){if(!c(e))throw new E("scene is required.");this.enableInputs=!0,this.enableTranslate=!0,this.enableZoom=!0,this.enableRotate=!0,this.enableTilt=!0,this.enableLook=!0,this.inertiaSpin=.9,this.inertiaTranslate=.9,this.inertiaZoom=.8,this.maximumMovementRatio=.1,this.bounceAnimationTime=3,this.minimumZoomDistance=1,this.maximumZoomDistance=Number.POSITIVE_INFINITY,this.translateEventTypes=Gn.LEFT_DRAG,this.zoomEventTypes=[Gn.RIGHT_DRAG,Gn.WHEEL,Gn.PINCH],this.rotateEventTypes=Gn.LEFT_DRAG,this.tiltEventTypes=[Gn.MIDDLE_DRAG,Gn.PINCH,{eventType:Gn.LEFT_DRAG,modifier:Tc.CTRL},{eventType:Gn.RIGHT_DRAG,modifier:Tc.CTRL}],this.lookEventTypes={eventType:Gn.LEFT_DRAG,modifier:Tc.SHIFT},this.minimumPickingTerrainHeight=15e4,this._minimumPickingTerrainHeight=this.minimumPickingTerrainHeight,this.minimumPickingTerrainDistanceWithInertia=4e3,this.minimumCollisionTerrainHeight=15e3,this._minimumCollisionTerrainHeight=this.minimumCollisionTerrainHeight,this.minimumTrackBallHeight=75e5,this._minimumTrackBallHeight=this.minimumTrackBallHeight,this.enableCollisionDetection=!0,this._scene=e,this._globe=void 0,this._ellipsoid=void 0,this._lastGlobeHeight=0,this._aggregator=new jc(e.canvas),this._lastInertiaSpinMovement=void 0,this._lastInertiaZoomMovement=void 0,this._lastInertiaTranslateMovement=void 0,this._lastInertiaTiltMovement=void 0,this._inertiaDisablers={_lastInertiaZoomMovement:["_lastInertiaSpinMovement","_lastInertiaTranslateMovement","_lastInertiaTiltMovement"],_lastInertiaTiltMovement:["_lastInertiaSpinMovement","_lastInertiaTranslateMovement"]},this._tweens=new Wc,this._tween=void 0,this._horizontalRotationAxis=void 0,this._tiltCenterMousePosition=new H(-1,-1),this._tiltCenter=new d,this._rotateMousePosition=new H(-1,-1),this._rotateStartPosition=new d,this._strafeStartPosition=new d,this._strafeMousePosition=new H,this._strafeEndMousePosition=new H,this._zoomMouseStart=new H(-1,-1),this._zoomWorldPosition=new d,this._useZoomWorldPosition=!1,this._panLastMousePosition=new H,this._panLastWorldPosition=new d,this._tiltCVOffMap=!1,this._looking=!1,this._rotating=!1,this._strafing=!1,this._zoomingOnVector=!1,this._zoomingUnderground=!1,this._rotatingZoom=!1,this._adjustedHeightForTerrain=!1,this._cameraUnderground=!1;const t=e.mapProjection;this._maxCoord=t.project(new he(Math.PI,R.PI_OVER_TWO)),this._zoomFactor=5,this._rotateFactor=void 0,this._rotateRateRangeAdjustment=void 0,this._maximumRotateRate=1.77,this._minimumRotateRate=1/5e3,this._minimumZoomRate=20,this._maximumZoomRate=5906376272e3,this._minimumUndergroundPickDistance=2e3,this._maximumUndergroundPickDistance=1e4}function xke(e,t){if(e<0)return 0;const n=(1-t)*25;return Math.exp(-n*e)}function Cke(e){return H.equalsEpsilon(e.startPosition,e.endPosition,R.EPSILON14)}const Eke=.4;function wke(e,t,n,i,o,r,s){let a=r[s];c(a)||(a=r[s]={startPosition:new H,endPosition:new H,motion:new H,inertiaEnabled:!0});const l=e.getButtonPressTime(t,n),u=e.getButtonReleaseTime(t,n),h=l&&u&&(u.getTime()-l.getTime())/1e3,f=new Date,_=u&&(f.getTime()-u.getTime())/1e3;if(l&&u&&h<Eke){const g=xke(_,i),m=e.getLastMovement(t,n);if(!c(m)||Cke(m)||!a.inertiaEnabled||(a.motion.x=(m.endPosition.x-m.startPosition.x)*.5,a.motion.y=(m.endPosition.y-m.startPosition.y)*.5,a.startPosition=H.clone(m.startPosition,a.startPosition),a.endPosition=H.multiplyByScalar(a.motion,g,a.endPosition),a.endPosition=H.add(a.startPosition,a.endPosition,a.endPosition),isNaN(a.endPosition.x)||isNaN(a.endPosition.y)||H.distance(a.startPosition,a.endPosition)<.5))return;if(!e.isButtonDown(t,n)){const b=e.getStartMousePosition(t,n);o(r,b,a)}}}function Ske(e,t){if(c(t)){let n=e[t];c(n)&&(n.inertiaEnabled=!0);const i=e._inertiaDisablers[t];if(c(i)){const o=i.length;for(let r=0;r<o;++r)n=e[i[r]],c(n)&&(n.inertiaEnabled=!1)}}}const oz=[];function Ls(e,t,n,i,o,r){if(!c(n))return;const s=e._aggregator;Array.isArray(n)||(oz[0]=n,n=oz);const a=n.length;for(let l=0;l<a;++l){const u=n[l],h=c(u.eventType)?u.eventType:u,f=u.modifier,_=s.isMoving(h,f)&&s.getMovement(h,f),g=s.getStartMousePosition(h,f);e.enableInputs&&t&&(_?(i(e,g,_),Ske(e,r)):o<1&&wke(s,h,f,o,i,e,r))}}const _A=new nn,vke=new d,Ike=new H,Dke=new d,Pke=new H,Oke=new d,Lke=new d,Rke=new d,Nke=new d,E6=new d,Mke=new d,Fke=new d,Bke=new d,zke=new d,Uke=new d,kke=new d,Vke=new d,Hke=new d,Gke=new d,jke=new d,Lf=new d,rz=new d,sz=new d,zv={orientation:new lr};function j1(e,t,n,i,o,r){let s=1;c(r)&&(s=R.clamp(Math.abs(r),.25,1));const a=n.endPosition.y-n.startPosition.y,u=a>0?e.minimumZoomDistance*s:0,h=e.maximumZoomDistance,f=o-u;let _=i*f;_=R.clamp(_,e._minimumZoomRate,e._maximumZoomRate);let g=a/e._scene.canvas.clientHeight;g=Math.min(g,e.maximumMovementRatio);let m=_*g;if(e.enableCollisionDetection||e.minimumZoomDistance===0||!c(e._globe)){if(m>0&&Math.abs(o-u)<1||m<0&&Math.abs(o-h)<1)return;o-m<u?m=o-u-1:o-m>h&&(m=o-h)}const b=e._scene,T=b.camera,x=b.mode,C=zv.orientation;if(C.heading=T.heading,C.pitch=T.pitch,C.roll=T.roll,T.frustum instanceof It){Math.abs(m)>0&&(T.zoomIn(m),T._adjustOrthographicFrustum(!0));return}const w=y(n.inertiaEnabled,H.equals(t,e._zoomMouseStart));let v=e._zoomingOnVector,P=e._rotatingZoom,N;if(w||(e._zoomMouseStart=H.clone(t,e._zoomMouseStart),c(e._globe)&&x===oe.SCENE2D?(N=T.getPickRay(t,_A).origin,N=d.fromElements(N.y,N.z,N.x)):c(e._globe)&&(N=gd(e,t,vke)),c(N)?(e._useZoomWorldPosition=!0,e._zoomWorldPosition=d.clone(N,e._zoomWorldPosition)):e._useZoomWorldPosition=!1,v=e._zoomingOnVector=!1,P=e._rotatingZoom=!1,e._zoomingUnderground=e._cameraUnderground),!e._useZoomWorldPosition){T.zoomIn(m);return}let k=x===oe.COLUMBUS_VIEW;if(T.positionCartographic.height<2e6&&(P=!0),!w||P){if(x===oe.SCENE2D){const M=e._zoomWorldPosition,U=T.position;if(!d.equals(M,U)&&T.positionCartographic.height<e._maxCoord.x*2){const B=T.position.x,S=d.subtract(M,U,Dke);d.normalize(S,S);const D=d.distance(M,U)*m/(T.getMagnitude()*.5);T.move(S,D*.5),(T.position.x<0&&B>0||T.position.x>0&&B<0)&&(N=T.getPickRay(t,_A).origin,N=d.fromElements(N.y,N.z,N.x),e._zoomWorldPosition=d.clone(N,e._zoomWorldPosition))}}else if(x===oe.SCENE3D){const M=d.normalize(T.position,E6);if(e._cameraUnderground||e._zoomingUnderground||T.positionCartographic.height<3e3&&Math.abs(d.dot(T.direction,M))<.6)k=!0;else{const U=b.canvas,B=Pke;B.x=U.clientWidth/2,B.y=U.clientHeight/2;const S=gd(e,B,Oke);if(!c(S))k=!0;else if(T.positionCartographic.height<1e6)if(d.dot(T.direction,M)>=-.5)k=!0;else{const D=Fke;d.clone(T.position,D);const p=e._zoomWorldPosition;let I=Mke;if(I=d.normalize(p,I),d.dot(I,M)<0)return;const O=jke,F=Uke;d.clone(T.direction,F),d.add(D,d.multiplyByScalar(F,1e3,Lf),O);const V=kke,G=Vke;d.subtract(p,D,V),d.normalize(V,G);const j=d.dot(M,G);if(j>=0){e._zoomMouseStart.x=-1;return}const W=Math.acos(-j),X=d.magnitude(D),q=d.magnitude(p),ee=X-m,Y=d.magnitude(V),ne=Math.asin(R.clamp(Y/q*Math.sin(W),-1,1)),Q=Math.asin(R.clamp(ee/q*Math.sin(W),-1,1)),le=ne-Q+W,pe=Bke;d.normalize(D,pe);let re=zke;re=d.cross(G,pe,re),re=d.normalize(re,re),d.normalize(d.cross(pe,re,Lf),F),d.multiplyByScalar(d.normalize(O,Lf),d.magnitude(O)-m,O),d.normalize(D,D),d.multiplyByScalar(D,ee,D);const de=Hke;d.multiplyByScalar(d.add(d.multiplyByScalar(pe,Math.cos(le)-1,rz),d.multiplyByScalar(F,Math.sin(le),sz),Lf),ee,de),d.add(D,de,D),d.normalize(O,pe),d.normalize(d.cross(pe,re,Lf),F);const fe=Gke;d.multiplyByScalar(d.add(d.multiplyByScalar(pe,Math.cos(le)-1,rz),d.multiplyByScalar(F,Math.sin(le),sz),Lf),d.magnitude(O),fe),d.add(O,fe,O),d.clone(D,T.position),d.normalize(d.subtract(O,D,Lf),T.direction),d.clone(T.direction,T.direction),d.cross(T.direction,T.up,T.right),d.cross(T.right,T.direction,T.up),T.setView(zv);return}else{const D=d.normalize(S,Lke),p=d.normalize(e._zoomWorldPosition,Rke),I=d.dot(p,D);if(I>0&&I<1){const O=R.acosClamped(I),F=d.cross(p,D,Nke),V=Math.abs(O)>R.toRadians(20)?T.positionCartographic.height*.75:T.positionCartographic.height-m,G=m/V;T.rotate(F,O*G)}}}}e._rotatingZoom=!k}if(!w&&k||v){let M;const U=Ao.wgs84ToWindowCoordinates(b,e._zoomWorldPosition,Ike);x!==oe.COLUMBUS_VIEW&&H.equals(t,e._zoomMouseStart)&&c(U)?M=T.getPickRay(U,_A):M=T.getPickRay(t,_A);const B=M.direction;(x===oe.COLUMBUS_VIEW||x===oe.SCENE2D)&&d.fromElements(B.y,B.z,B.x,B),T.move(B,m),e._zoomingOnVector=!0}else T.zoomIn(m);e._cameraUnderground||T.setView(zv)}const Wke=new nn,qke=new nn,Yke=new d;function $ke(e,t,n){const o=e._scene.camera;let r=o.getPickRay(n.startPosition,Wke).origin,s=o.getPickRay(n.endPosition,qke).origin;r=d.fromElements(r.y,r.z,r.x,r),s=d.fromElements(s.y,s.z,s.x,s);const a=d.subtract(r,s,Yke),l=d.magnitude(a);l>0&&(d.normalize(a,a),o.move(a,l))}function az(e,t,n){c(n.distance)&&(n=n.distance);const o=e._scene.camera;j1(e,t,n,e._zoomFactor,o.getMagnitude())}const Xke=new H,Qke=new H;function cz(e,t,n){if(c(n.angleAndHeight)){Kke(e,t,n.angleAndHeight);return}const i=e._scene,o=i.camera,r=i.canvas,s=r.clientWidth,a=r.clientHeight;let l=Xke;l.x=2/s*n.startPosition.x-1,l.y=2/a*(a-n.startPosition.y)-1,l=H.normalize(l,l);let u=Qke;u.x=2/s*n.endPosition.x-1,u.y=2/a*(a-n.endPosition.y)-1,u=H.normalize(u,u);let h=R.acosClamped(l.x);l.y<0&&(h=R.TWO_PI-h);let f=R.acosClamped(u.x);u.y<0&&(f=R.TWO_PI-f);const _=f-h;o.twistRight(_)}function Kke(e,t,n){let i=e._rotateFactor*e._rotateRateRangeAdjustment;i>e._maximumRotateRate&&(i=e._maximumRotateRate),i<e._minimumRotateRate&&(i=e._minimumRotateRate);const o=e._scene,r=o.camera,s=o.canvas;let a=(n.endPosition.x-n.startPosition.x)/s.clientWidth;a=Math.min(a,e.maximumMovementRatio);const l=i*a*Math.PI*4;r.twistRight(l)}function Zke(e){const t=e._scene.mapMode2D===Wh.ROTATE;L.equals(L.IDENTITY,e._scene.camera.transform)?(Ls(e,e.enableTranslate,e.translateEventTypes,$ke,e.inertiaTranslate,"_lastInertiaTranslateMovement"),Ls(e,e.enableZoom,e.zoomEventTypes,az,e.inertiaZoom,"_lastInertiaZoomMovement"),t&&Ls(e,e.enableRotate,e.tiltEventTypes,cz,e.inertiaSpin,"_lastInertiaTiltMovement")):(Ls(e,e.enableZoom,e.zoomEventTypes,az,e.inertiaZoom,"_lastInertiaZoomMovement"),t&&Ls(e,e.enableRotate,e.translateEventTypes,cz,e.inertiaSpin,"_lastInertiaSpinMovement"))}const w6=new nn,Jke=new d,eVe=new d;function gd(e,t,n){const i=e._scene,o=e._globe,r=i.camera;let s;if(i.pickPositionSupported&&(s=i.pickPositionWorldCoordinates(t,Jke)),!c(o))return d.clone(s,n);const a=!e._cameraUnderground,l=r.getPickRay(t,w6),u=o.pickWorldCoordinates(l,i,a,eVe),h=c(s)?d.distance(s,r.positionWC):Number.POSITIVE_INFINITY,f=c(u)?d.distance(u,r.positionWC):Number.POSITIVE_INFINITY;return h<f?d.clone(s,n):d.clone(u,n)}const tVe=new he;function cC(e){const t=e._ellipsoid,n=e._scene,i=n.camera,o=n.mode;let r=0;if(o===oe.SCENE3D){const l=t.cartesianToCartographic(i.position,tVe);c(l)&&(r=l.height)}else r=i.position.z;const s=y(e._scene.globeHeight,0);return Math.abs(s-r)}const nVe=new d;function S6(e,t){const n=t.origin,i=t.direction,o=cC(e),r=d.normalize(n,nVe);let s=Math.abs(d.dot(r,i));return s=Math.max(s,.5)*2,o*s}function v6(e,t,n,i){let o=d.distance(t.origin,n);const r=cC(e),s=R.clamp(r*5,e._minimumUndergroundPickDistance,e._maximumUndergroundPickDistance);return o>s&&(o=Math.min(o,r/5),o=Math.max(o,100)),nn.getPoint(t,o,i)}function I6(e,t,n,i){let o;return c(n)?(o=d.distance(t.origin,n),o>e._maximumUndergroundPickDistance&&(o=cC(e))):o=cC(e),nn.getPoint(t,o,i)}const iVe=new H;function D6(e,t){const n=t.endPosition,i=H.subtract(t.endPosition,t.startPosition,iVe),o=e._strafeEndMousePosition;H.add(o,i,o),t.endPosition=o,W1(e,t,e._strafeStartPosition),t.endPosition=n}const lz=new nn,oVe=new nn,Uv=new d,rVe=new d,sVe=new d,aVe=new d,cVe=new _t(d.UNIT_X,0),lVe=new H,uVe=new H;function dVe(e,t,n){if(d.equals(t,e._translateMousePosition)||(e._looking=!1),d.equals(t,e._strafeMousePosition)||(e._strafing=!1),e._looking){Ra(e,t,n);return}if(e._strafing){D6(e,n);return}const o=e._scene.camera,r=e._cameraUnderground,s=H.clone(n.startPosition,lVe),a=H.clone(n.endPosition,uVe);let l=o.getPickRay(s,lz);const u=d.clone(d.ZERO,aVe),h=d.UNIT_X;let f;if(o.position.z<e._minimumPickingTerrainHeight&&(f=gd(e,s,Uv),c(f)&&(u.x=f.x)),r||u.x>o.position.z&&c(f)){let w=f;r&&(w=I6(e,l,f,Uv)),H.clone(t,e._strafeMousePosition),H.clone(t,e._strafeEndMousePosition),d.clone(w,e._strafeStartPosition),e._strafing=!0,W1(e,n,e._strafeStartPosition);return}const _=_t.fromPointNormal(u,h,cVe);l=o.getPickRay(s,lz);const g=Ei.rayPlane(l,_,Uv),m=o.getPickRay(a,oVe),b=Ei.rayPlane(m,_,rVe);if(!c(g)||!c(b)){e._looking=!0,Ra(e,t,n),H.clone(t,e._translateMousePosition);return}const T=d.subtract(g,b,sVe),x=T.x;T.x=T.y,T.y=T.z,T.z=x;const C=d.magnitude(T);C>R.EPSILON6&&(d.normalize(T,T),o.move(T,C))}const P6=new H,lx=new nn,ux=new d,hVe=new d,O6=new L,fVe=new L,pVe=new d,mVe=new _t(d.UNIT_X,0),kv=new d,JD=new he,L6=new L,_Ve=new _e,gVe=new $,dx=new d;function yVe(e,t,n){if(c(n.angleAndHeight)&&(n=n.angleAndHeight),H.equals(t,e._tiltCenterMousePosition)||(e._tiltCVOffMap=!1,e._looking=!1),e._looking){Ra(e,t,n);return}const o=e._scene.camera;e._tiltCVOffMap||!e.onMap()||Math.abs(o.position.z)>e._minimumPickingTerrainHeight?(e._tiltCVOffMap=!0,bVe(e,t,n)):TVe(e,t,n)}function bVe(e,t,n){const i=e._scene,o=i.camera,r=i.canvas,s=P6;s.x=r.clientWidth/2,s.y=r.clientHeight/2;const a=o.getPickRay(s,lx),l=d.UNIT_X,u=a.origin,h=a.direction;let f;const _=d.dot(l,h);if(Math.abs(_)>R.EPSILON6&&(f=-d.dot(l,u)/_),!c(f)||f<=0){e._looking=!0,Ra(e,t,n),H.clone(t,e._tiltCenterMousePosition);return}const g=d.multiplyByScalar(h,f,ux);d.add(u,g,g);const m=i.mapProjection,b=m.ellipsoid;d.fromElements(g.y,g.z,g.x,g);const T=m.unproject(g,JD);b.cartographicToCartesian(T,g);const x=zt.eastNorthUpToFixedFrame(g,b,O6),C=e._globe,w=e._ellipsoid;e._globe=void 0,e._ellipsoid=ae.UNIT_SPHERE,e._rotateFactor=1,e._rotateRateRangeAdjustment=1;const v=L.clone(o.transform,L6);o._setTransform(x),La(e,t,n,d.UNIT_Z),o._setTransform(v),e._globe=C,e._ellipsoid=w;const P=w.maximumRadius;e._rotateFactor=1/P,e._rotateRateRangeAdjustment=P}function TVe(e,t,n){const i=e._scene,o=i.camera,r=e._cameraUnderground;let s,a;const l=d.UNIT_X;if(H.equals(t,e._tiltCenterMousePosition))s=d.clone(e._tiltCenter,ux);else{if(o.position.z<e._minimumPickingTerrainHeight&&(s=gd(e,t,ux)),!c(s)){a=o.getPickRay(t,lx);const S=a.origin,D=a.direction;let p;const I=d.dot(l,D);if(Math.abs(I)>R.EPSILON6&&(p=-d.dot(l,S)/I),!c(p)||p<=0){e._looking=!0,Ra(e,t,n),H.clone(t,e._tiltCenterMousePosition);return}s=d.multiplyByScalar(D,p,ux),d.add(S,s,s)}r&&(c(a)||(a=o.getPickRay(t,lx)),v6(e,a,s,s)),H.clone(t,e._tiltCenterMousePosition),d.clone(s,e._tiltCenter)}const u=i.canvas,h=P6;h.x=u.clientWidth/2,h.y=e._tiltCenterMousePosition.y,a=o.getPickRay(h,lx);const f=d.clone(d.ZERO,pVe);f.x=s.x;const _=_t.fromPointNormal(f,l,mVe),g=Ei.rayPlane(a,_,hVe),m=o._projection,b=m.ellipsoid;d.fromElements(s.y,s.z,s.x,s);let T=m.unproject(s,JD);b.cartographicToCartesian(T,s);const x=zt.eastNorthUpToFixedFrame(s,b,O6);let C;c(g)?(d.fromElements(g.y,g.z,g.x,g),T=m.unproject(g,JD),b.cartographicToCartesian(T,g),C=zt.eastNorthUpToFixedFrame(g,b,fVe)):C=x;const w=e._globe,v=e._ellipsoid;e._globe=void 0,e._ellipsoid=ae.UNIT_SPHERE,e._rotateFactor=1,e._rotateRateRangeAdjustment=1;let P=d.UNIT_Z;const N=L.clone(o.transform,L6);o._setTransform(x);const k=d.cross(d.UNIT_Z,d.normalize(o.position,kv),kv),M=d.dot(o.right,k);if(La(e,t,n,P,!1,!0),o._setTransform(C),M<0){const S=n.startPosition.y-n.endPosition.y;(r&&S<0||!r&&S>0)&&(P=void 0);const D=o.constrainedAxis;o.constrainedAxis=void 0,La(e,t,n,P,!0,!1),o.constrainedAxis=D}else La(e,t,n,P,!0,!1);if(c(o.constrainedAxis)){const S=d.cross(o.direction,o.constrainedAxis,dx);d.equalsEpsilon(S,d.ZERO,R.EPSILON6)||(d.dot(S,o.right)<0&&d.negate(S,S),d.cross(S,o.direction,o.up),d.cross(o.direction,o.up,o.right),d.normalize(o.up,o.up),d.normalize(o.right,o.right))}o._setTransform(N),e._globe=w,e._ellipsoid=v;const U=v.maximumRadius;e._rotateFactor=1/U,e._rotateRateRangeAdjustment=U;const B=d.clone(o.positionWC,kv);if(e.enableCollisionDetection&&$1(e,!0),!d.equals(o.positionWC,B)){o._setTransform(C),o.worldToCameraCoordinatesPoint(B,B);const S=d.magnitudeSquared(B);d.magnitudeSquared(o.position)>S&&(d.normalize(o.position,o.position),d.multiplyByScalar(o.position,Math.sqrt(S),o.position));const D=d.angleBetween(B,o.position),p=d.cross(B,o.position,B);d.normalize(p,p);const I=_e.fromAxisAngle(p,D,_Ve),O=$.fromQuaternion(I,gVe);$.multiplyByVector(O,o.direction,o.direction),$.multiplyByVector(O,o.up,o.up),d.cross(o.direction,o.up,o.right),d.cross(o.right,o.direction,o.up),o._setTransform(N)}}const R6=new H,N6=new nn,M6=new d;function AVe(e,t,n){c(n.distance)&&(n=n.distance);const i=e._scene,o=i.camera,r=i.canvas,s=e._cameraUnderground;let a;s?a=t:(a=R6,a.x=r.clientWidth/2,a.y=r.clientHeight/2);const l=o.getPickRay(a,N6),u=l.origin,h=l.direction,f=o.position.z;let _;f<e._minimumPickingTerrainHeight&&(_=gd(e,a,M6));let g;if(c(_)&&(g=d.distance(u,_)),s){const m=S6(e,l);c(g)?g=Math.min(g,m):g=m}if(!c(g)){const m=d.UNIT_X;g=-d.dot(m,u)/d.dot(m,h)}j1(e,t,n,e._zoomFactor,g)}function xVe(e){const n=e._scene.camera;if(!L.equals(L.IDENTITY,n.transform))Ls(e,e.enableRotate,e.rotateEventTypes,La,e.inertiaSpin,"_lastInertiaSpinMovement"),Ls(e,e.enableZoom,e.zoomEventTypes,B6,e.inertiaZoom,"_lastInertiaZoomMovement");else{const i=e._tweens;if(e._aggregator.anyButtonDown&&i.removeAll(),Ls(e,e.enableTilt,e.tiltEventTypes,yVe,e.inertiaSpin,"_lastInertiaTiltMovement"),Ls(e,e.enableTranslate,e.translateEventTypes,dVe,e.inertiaTranslate,"_lastInertiaTranslateMovement"),Ls(e,e.enableZoom,e.zoomEventTypes,AVe,e.inertiaZoom,"_lastInertiaZoomMovement"),Ls(e,e.enableLook,e.lookEventTypes,Ra),!e._aggregator.anyButtonDown&&!i.contains(e._tween)){const o=n.createCorrectPositionTween(e.bounceAnimationTime);c(o)&&(e._tween=i.add(o))}i.update()}}const CVe=new nn,EVe=new _t(d.UNIT_X,0),wVe=new d,SVe=new d;function W1(e,t,n){const i=e._scene,o=i.camera,r=o.getPickRay(t.endPosition,CVe);let s=d.clone(o.direction,SVe);i.mode===oe.COLUMBUS_VIEW&&d.fromElements(s.z,s.x,s.y,s);const a=_t.fromPointNormal(n,s,EVe),l=Ei.rayPlane(r,a,wVe);!c(l)||(s=d.subtract(n,l,s),i.mode===oe.COLUMBUS_VIEW&&d.fromElements(s.y,s.z,s.x,s),d.add(o.position,s,o.position))}const uz=new d,F6=new he,eP=new d,tP=new ae,vVe=new d,IVe=new d,DVe=new d;function PVe(e,t,n){const o=e._scene.camera,r=e._cameraUnderground;let s=e._ellipsoid;if(!L.equals(o.transform,L.IDENTITY)){La(e,t,n);return}let a,l;const u=s.geodeticSurfaceNormal(o.position,vVe);if(H.equals(t,e._rotateMousePosition)){if(e._looking)Ra(e,t,n,u);else if(e._rotating)La(e,t,n);else if(e._strafing)D6(e,n);else{if(d.magnitude(o.position)<d.magnitude(e._rotateStartPosition))return;a=d.magnitude(e._rotateStartPosition),l=eP,l.x=l.y=l.z=a,s=ae.fromCartesian3(l,tP),Hv(e,t,n,s)}return}e._looking=!1,e._rotating=!1,e._strafing=!1;const h=s.cartesianToCartographic(o.positionWC,F6).height,f=e._globe;if(c(f)&&h<e._minimumPickingTerrainHeight){const _=gd(e,n.startPosition,DVe);if(c(_)){let g=!1;const m=o.getPickRay(n.startPosition,w6);if(r)g=!0,I6(e,m,_,_);else{const b=s.geodeticSurfaceNormal(_,IVe);Math.abs(d.dot(m.direction,b))<.05?g=!0:g=d.magnitude(o.position)<d.magnitude(_)}g?(H.clone(t,e._strafeEndMousePosition),d.clone(_,e._strafeStartPosition),e._strafing=!0,W1(e,n,e._strafeStartPosition)):(a=d.magnitude(_),l=eP,l.x=l.y=l.z=a,s=ae.fromCartesian3(l,tP),Hv(e,t,n,s),d.clone(_,e._rotateStartPosition))}else e._looking=!0,Ra(e,t,n,u)}else c(o.pickEllipsoid(n.startPosition,e._ellipsoid,uz))?(Hv(e,t,n,e._ellipsoid),d.clone(uz,e._rotateStartPosition)):h>e._minimumTrackBallHeight?(e._rotating=!0,La(e,t,n)):(e._looking=!0,Ra(e,t,n,u));H.clone(t,e._rotateMousePosition)}function La(e,t,n,i,o,r){o=y(o,!1),r=y(r,!1);const s=e._scene,a=s.camera,l=s.canvas,u=a.constrainedAxis;c(i)&&(a.constrainedAxis=i);const h=d.magnitude(a.position);let f=e._rotateFactor*(h-e._rotateRateRangeAdjustment);f>e._maximumRotateRate&&(f=e._maximumRotateRate),f<e._minimumRotateRate&&(f=e._minimumRotateRate);let _=(n.startPosition.x-n.endPosition.x)/l.clientWidth,g=(n.startPosition.y-n.endPosition.y)/l.clientHeight;_=Math.min(_,e.maximumMovementRatio),g=Math.min(g,e.maximumMovementRatio);const m=f*_*Math.PI*2,b=f*g*Math.PI;o||a.rotateRight(m),r||a.rotateUp(b),a.constrainedAxis=u}const Vv=te.clone(te.UNIT_W),dz=te.clone(te.UNIT_W),gA=new d,Om=new d,yA=new d,hz=new d,OVe=new H,LVe=new H,RVe=new H,NVe=new H,MVe=new nn;function Hv(e,t,n,i){const o=e._scene,r=o.camera,s=H.clone(n.startPosition,OVe),a=H.clone(n.endPosition,LVe),l=i.cartesianToCartographic(r.positionWC,F6).height;let u,h;if(!n.inertiaEnabled&&l<e._minimumPickingTerrainHeight&&(u=d.clone(e._panLastWorldPosition,Vv),!c(e._globe)&&!H.equalsEpsilon(s,e._panLastMousePosition)&&(u=gd(e,s,Vv)),!c(e._globe)&&c(u))){const f=d.subtract(u,r.positionWC,Om),_=d.multiplyByScalar(r.directionWC,d.dot(r.directionWC,f),Om),g=d.magnitude(_),m=r.frustum.getPixelDimensions(o.drawingBufferWidth,o.drawingBufferHeight,g,o.pixelRatio,NVe),b=H.subtract(a,s,RVe),T=d.multiplyByScalar(r.rightWC,b.x*m.x,Om),x=d.normalize(r.positionWC,E6),C=r.getPickRay(a,MVe).direction,w=d.subtract(C,d.projectVector(C,r.rightWC,yA),yA),v=d.angleBetween(w,r.directionWC);let P=1;c(r.frustum.fov)&&(P=Math.max(Math.tan(v),.1));let N=Math.abs(d.dot(r.directionWC,x));const k=-b.y*m.y*2/Math.sqrt(P)*(1-N),M=d.multiplyByScalar(C,k,yA);N=Math.abs(d.dot(r.upWC,x));const U=d.multiplyByScalar(r.upWC,-b.y*(1-N)*m.y,hz);h=d.add(u,T,dz),h=d.add(h,M,h),h=d.add(h,U,h),d.clone(h,e._panLastWorldPosition),H.clone(a,e._panLastMousePosition)}if((!c(u)||!c(h))&&(u=r.pickEllipsoid(s,i,Vv),h=r.pickEllipsoid(a,i,dz)),!c(u)||!c(h)){e._rotating=!0,La(e,t,n);return}if(u=r.worldToCameraCoordinates(u,u),h=r.worldToCameraCoordinates(h,h),c(r.constrainedAxis)){const f=r.constrainedAxis,_=d.mostOrthogonalAxis(f,gA);d.cross(_,f,_),d.normalize(_,_);const g=d.cross(f,_,Om),m=d.magnitude(u),b=d.dot(f,u),T=Math.acos(b/m),x=d.multiplyByScalar(f,b,yA);d.subtract(u,x,x),d.normalize(x,x);const C=d.magnitude(h),w=d.dot(f,h),v=Math.acos(w/C),P=d.multiplyByScalar(f,w,hz);d.subtract(h,P,P),d.normalize(P,P);let N=Math.acos(d.dot(x,_));d.dot(x,g)<0&&(N=R.TWO_PI-N);let k=Math.acos(d.dot(P,_));d.dot(P,g)<0&&(k=R.TWO_PI-k);const M=N-k;let U;d.equalsEpsilon(f,r.position,R.EPSILON2)?U=r.right:U=d.cross(f,r.position,gA);const B=d.cross(f,U,gA),S=d.dot(B,d.subtract(u,f,Om)),D=d.dot(B,d.subtract(h,f,Om));let p;S>0&&D>0?p=v-T:S>0&&D<=0?d.dot(r.position,f)>0?p=-T-v:p=T+v:p=T-v,r.rotateRight(M),r.rotateUp(p)}else{d.normalize(u,u),d.normalize(h,h);const f=d.dot(u,h),_=d.cross(u,h,gA);if(f<1&&!d.equalsEpsilon(_,d.ZERO,R.EPSILON14)){const g=Math.acos(f);r.rotate(_,g)}}}const FVe=new d,BVe=new he;let fz=0;function B6(e,t,n){c(n.distance)&&(n=n.distance);const i=n.inertiaEnabled,o=e._ellipsoid,r=e._scene,s=r.camera,a=r.canvas,l=e._cameraUnderground;let u;l?u=t:(u=R6,u.x=a.clientWidth/2,u.y=a.clientHeight/2);const h=s.getPickRay(u,N6);let f;const _=o.cartesianToCartographic(s.position,BVe).height,g=Math.abs(fz)<e.minimumPickingTerrainDistanceWithInertia;(i?g:_<e._minimumPickingTerrainHeight)&&(f=gd(e,u,M6));let b;if(c(f)&&(b=d.distance(h.origin,f),fz=b),l){const x=S6(e,h);c(b)?b=Math.min(b,x):b=x}c(b)||(b=_);const T=d.normalize(s.position,FVe);j1(e,t,n,e._zoomFactor,b,d.dot(T,s.direction))}const z6=new H,hx=new nn,qy=new d,zVe=new d,U6=new L,UVe=new L,k6=new L,kVe=new _e,VVe=new $,q1=new he,Y1=new d;function HVe(e,t,n){const o=e._scene.camera;if(!L.equals(o.transform,L.IDENTITY))return;if(c(n.angleAndHeight)&&(n=n.angleAndHeight),H.equals(t,e._tiltCenterMousePosition)||(e._tiltOnEllipsoid=!1,e._looking=!1),e._looking){const a=e._ellipsoid.geodeticSurfaceNormal(o.position,Y1);Ra(e,t,n,a);return}const s=e._ellipsoid.cartesianToCartographic(o.position,q1);e._tiltOnEllipsoid||s.height>e._minimumCollisionTerrainHeight?(e._tiltOnEllipsoid=!0,jVe(e,t,n)):WVe(e,t,n)}const GVe=new he;function jVe(e,t,n){const i=e._ellipsoid,o=e._scene,r=o.camera,s=e.minimumZoomDistance*.25,a=i.cartesianToCartographic(r.positionWC,GVe).height;if(a-s-1<R.EPSILON3&&n.endPosition.y-n.startPosition.y<0)return;const l=o.canvas,u=z6;u.x=l.clientWidth/2,u.y=l.clientHeight/2;const h=r.getPickRay(u,hx);let f;const _=Ei.rayEllipsoid(h,i);if(c(_))f=nn.getPoint(h,_.start,qy);else if(a>e._minimumTrackBallHeight){const C=Ei.grazingAltitudeLocation(h,i);if(!c(C))return;const w=i.cartesianToCartographic(C,q1);w.height=0,f=i.cartographicToCartesian(w,qy)}else{e._looking=!0;const C=e._ellipsoid.geodeticSurfaceNormal(r.position,Y1);Ra(e,t,n,C),H.clone(t,e._tiltCenterMousePosition);return}const g=zt.eastNorthUpToFixedFrame(f,i,U6),m=e._globe,b=e._ellipsoid;e._globe=void 0,e._ellipsoid=ae.UNIT_SPHERE,e._rotateFactor=1,e._rotateRateRangeAdjustment=1;const T=L.clone(r.transform,k6);r._setTransform(g),La(e,t,n,d.UNIT_Z),r._setTransform(T),e._globe=m,e._ellipsoid=b;const x=b.maximumRadius;e._rotateFactor=1/x,e._rotateRateRangeAdjustment=x}function WVe(e,t,n){const i=e._ellipsoid,o=e._scene,r=o.camera,s=e._cameraUnderground;let a,l,u;if(H.equals(t,e._tiltCenterMousePosition))a=d.clone(e._tiltCenter,qy);else{if(a=gd(e,t,qy),!c(a)){if(l=r.getPickRay(t,hx),u=Ei.rayEllipsoid(l,i),!c(u)){if(i.cartesianToCartographic(r.position,q1).height<=e._minimumTrackBallHeight){e._looking=!0;const D=e._ellipsoid.geodeticSurfaceNormal(r.position,Y1);Ra(e,t,n,D),H.clone(t,e._tiltCenterMousePosition)}return}a=nn.getPoint(l,u.start,qy)}s&&(c(l)||(l=r.getPickRay(t,hx)),v6(e,l,a,a)),H.clone(t,e._tiltCenterMousePosition),d.clone(a,e._tiltCenter)}const h=o.canvas,f=z6;f.x=h.clientWidth/2,f.y=e._tiltCenterMousePosition.y,l=r.getPickRay(f,hx);const _=d.magnitude(a),g=d.fromElements(_,_,_,eP),m=ae.fromCartesian3(g,tP);if(u=Ei.rayEllipsoid(l,m),!c(u))return;const b=d.magnitude(l.origin)>_?u.start:u.stop,T=nn.getPoint(l,b,zVe),x=zt.eastNorthUpToFixedFrame(a,i,U6),C=zt.eastNorthUpToFixedFrame(T,m,UVe),w=e._globe,v=e._ellipsoid;e._globe=void 0,e._ellipsoid=ae.UNIT_SPHERE,e._rotateFactor=1,e._rotateRateRangeAdjustment=1;let P=d.UNIT_Z;const N=L.clone(r.transform,k6);r._setTransform(C);const k=d.cross(T,r.positionWC,dx);if(d.dot(r.rightWC,k)<0){const S=n.startPosition.y-n.endPosition.y;(s&&S<0||!s&&S>0)&&(P=void 0);const D=r.constrainedAxis;r.constrainedAxis=void 0,La(e,t,n,P,!0,!1),r.constrainedAxis=D}else La(e,t,n,P,!0,!1);if(r._setTransform(x),La(e,t,n,P,!1,!0),c(r.constrainedAxis)){const S=d.cross(r.direction,r.constrainedAxis,dx);d.equalsEpsilon(S,d.ZERO,R.EPSILON6)||(d.dot(S,r.right)<0&&d.negate(S,S),d.cross(S,r.direction,r.up),d.cross(r.direction,r.up,r.right),d.normalize(r.up,r.up),d.normalize(r.right,r.right))}r._setTransform(N),e._globe=w,e._ellipsoid=v;const U=v.maximumRadius;e._rotateFactor=1/U,e._rotateRateRangeAdjustment=U;const B=d.clone(r.positionWC,dx);if(e.enableCollisionDetection&&$1(e,!0),!d.equals(r.positionWC,B)){r._setTransform(C),r.worldToCameraCoordinatesPoint(B,B);const S=d.magnitudeSquared(B);d.magnitudeSquared(r.position)>S&&(d.normalize(r.position,r.position),d.multiplyByScalar(r.position,Math.sqrt(S),r.position));const D=d.angleBetween(B,r.position),p=d.cross(B,r.position,B);d.normalize(p,p);const I=_e.fromAxisAngle(p,D,kVe),O=$.fromQuaternion(I,VVe);$.multiplyByVector(O,r.direction,r.direction),$.multiplyByVector(O,r.up,r.up),d.cross(r.direction,r.up,r.right),d.cross(r.right,r.direction,r.up),r._setTransform(N)}}const qVe=new H,YVe=new H,pz=new nn,mz=new nn,$Ve=new d,XVe=new d;function Ra(e,t,n,i){const r=e._scene.camera,s=qVe;s.x=n.startPosition.x,s.y=0;const a=YVe;a.x=n.endPosition.x,a.y=0;let l=r.getPickRay(s,pz),u=r.getPickRay(a,mz),h=0,f,_;r.frustum instanceof It?(f=l.origin,_=u.origin,d.add(r.direction,f,f),d.add(r.direction,_,_),d.subtract(f,r.position,f),d.subtract(_,r.position,_),d.normalize(f,f),d.normalize(_,_)):(f=l.direction,_=u.direction);let g=d.dot(f,_);g<1&&(h=Math.acos(g)),h=n.startPosition.x>n.endPosition.x?-h:h;const m=e._horizontalRotationAxis;if(c(i)?r.look(i,-h):c(m)?r.look(m,-h):r.lookLeft(h),s.x=0,s.y=n.startPosition.y,a.x=0,a.y=n.endPosition.y,l=r.getPickRay(s,pz),u=r.getPickRay(a,mz),h=0,r.frustum instanceof It?(f=l.origin,_=u.origin,d.add(r.direction,f,f),d.add(r.direction,_,_),d.subtract(f,r.position,f),d.subtract(_,r.position,_),d.normalize(f,f),d.normalize(_,_)):(f=l.direction,_=u.direction),g=d.dot(f,_),g<1&&(h=Math.acos(g)),h=n.startPosition.y>n.endPosition.y?-h:h,i=y(i,m),c(i)){const b=r.direction,T=d.negate(i,$Ve),x=d.equalsEpsilon(b,i,R.EPSILON2),C=d.equalsEpsilon(b,T,R.EPSILON2);if(!x&&!C){g=d.dot(b,i);let w=R.acosClamped(g);h>0&&h>w&&(h=w-R.EPSILON4),g=d.dot(b,T),w=R.acosClamped(g),h<0&&-h>w&&(h=-w+R.EPSILON4);const v=d.cross(i,b,XVe);r.look(v,h)}else(x&&h<0||C&&h>0)&&r.look(r.right,-h)}else r.lookUp(h)}function QVe(e){Ls(e,e.enableRotate,e.rotateEventTypes,PVe,e.inertiaSpin,"_lastInertiaSpinMovement"),Ls(e,e.enableZoom,e.zoomEventTypes,B6,e.inertiaZoom,"_lastInertiaZoomMovement"),Ls(e,e.enableTilt,e.tiltEventTypes,HVe,e.inertiaSpin,"_lastInertiaTiltMovement"),Ls(e,e.enableLook,e.lookEventTypes,Ra)}const KVe=new L,ZVe=new he;function $1(e,t){e._adjustedHeightForTerrain=!0;const n=e._scene,i=n.mode,o=n.globe;if(i===oe.SCENE2D||i===oe.MORPHING)return;const r=n.camera,s=y(o==null?void 0:o.ellipsoid,ae.WGS84),a=n.mapProjection;let l,u;L.equals(r.transform,L.IDENTITY)||(l=L.clone(r.transform,KVe),u=d.magnitude(r.position),r._setTransform(L.IDENTITY));const h=ZVe;i===oe.SCENE3D?s.cartesianToCartographic(r.position,h):a.unproject(r.position,h);let f=!1;if(h.height<e._minimumCollisionTerrainHeight){const _=e._scene.globeHeight;if(c(_)){const g=_+e.minimumZoomDistance,m=_-e._lastGlobeHeight,b=m/e._lastGlobeHeight;h.height<g&&(t||Math.abs(b)<=.1)&&(h.height=g,i===oe.SCENE3D?s.cartographicToCartesian(h,r.position):a.project(h,r.position),f=!0),t||Math.abs(b)<=.1?e._lastGlobeHeight=_:e._lastGlobeHeight+=m*.1}}c(l)&&(r._setTransform(l),f&&(d.normalize(r.position,r.position),d.negate(r.position,r.direction),d.multiplyByScalar(r.position,Math.max(u,e.minimumZoomDistance),r.position),d.normalize(r.direction,r.direction),d.cross(r.direction,r.up,r.right),d.cross(r.right,r.direction,r.up)))}fb.prototype.onMap=function(){const e=this._scene,t=e.mode,n=e.camera;return t===oe.COLUMBUS_VIEW?Math.abs(n.position.x)-this._maxCoord.x<0&&Math.abs(n.position.y)-this._maxCoord.y<0:!0};const JVe=new d,e4e=new d;fb.prototype.update=function(){const e=this._scene,{camera:t,globe:n,mode:i}=e;L.equals(t.transform,L.IDENTITY)?(this._globe=n,this._ellipsoid=c(this._globe)?this._globe.ellipsoid:e.mapProjection.ellipsoid):(this._globe=void 0,this._ellipsoid=ae.UNIT_SPHERE);const{verticalExaggeration:o,verticalExaggerationRelativeHeight:r}=e;this._minimumCollisionTerrainHeight=oa.getHeight(this.minimumCollisionTerrainHeight,o,r),this._minimumPickingTerrainHeight=oa.getHeight(this.minimumPickingTerrainHeight,o,r),this._minimumTrackBallHeight=oa.getHeight(this.minimumTrackBallHeight,o,r),this._cameraUnderground=e.cameraUnderground&&c(this._globe);const s=this._ellipsoid.maximumRadius;this._rotateFactor=1/s,this._rotateRateRangeAdjustment=s,this._adjustedHeightForTerrain=!1;const a=d.clone(t.positionWC,JVe),l=d.clone(t.directionWC,e4e);if(i===oe.SCENE2D?Zke(this):i===oe.COLUMBUS_VIEW?(this._horizontalRotationAxis=d.UNIT_Z,xVe(this)):i===oe.SCENE3D&&(this._horizontalRotationAxis=void 0,QVe(this)),this.enableCollisionDetection&&!this._adjustedHeightForTerrain){const u=!d.equals(a,t.positionWC)||!d.equals(l,t.directionWC);$1(this,u)}this._aggregator.reset()};fb.prototype.isDestroyed=function(){return!1};fb.prototype.destroy=function(){return this._tweens.removeAll(),this._aggregator=this._aggregator&&this._aggregator.destroy(),ve(this)};const t4e=`uniform sampler2D colorTexture;
|
|
uniform sampler2D colorTexture2;
|
|
|
|
uniform vec2 center;
|
|
uniform float radius;
|
|
|
|
in vec2 v_textureCoordinates;
|
|
|
|
void main()
|
|
{
|
|
vec4 color0 = texture(colorTexture, v_textureCoordinates);
|
|
vec4 color1 = texture(colorTexture2, v_textureCoordinates);
|
|
|
|
float x = length(gl_FragCoord.xy - center) / radius;
|
|
float t = smoothstep(0.5, 0.8, x);
|
|
out_FragColor = mix(color0 + color1, color1, t);
|
|
}
|
|
`,n4e=`uniform sampler2D colorTexture;
|
|
|
|
uniform float avgLuminance;
|
|
uniform float threshold;
|
|
uniform float offset;
|
|
|
|
in vec2 v_textureCoordinates;
|
|
|
|
float key(float avg)
|
|
{
|
|
float guess = 1.5 - (1.5 / (avg * 0.1 + 1.0));
|
|
return max(0.0, guess) + 0.1;
|
|
}
|
|
|
|
// See section 9. "The bright-pass filter" of Realtime HDR Rendering
|
|
// http://www.cg.tuwien.ac.at/research/publications/2007/Luksch_2007_RHR/Luksch_2007_RHR-RealtimeHDR%20.pdf
|
|
|
|
void main()
|
|
{
|
|
vec4 color = texture(colorTexture, v_textureCoordinates);
|
|
vec3 xyz = czm_RGBToXYZ(color.rgb);
|
|
float luminance = xyz.r;
|
|
|
|
float scaledLum = key(avgLuminance) * luminance / avgLuminance;
|
|
float brightLum = max(scaledLum - threshold, 0.0);
|
|
float brightness = brightLum / (offset + brightLum);
|
|
|
|
xyz.r = brightness;
|
|
out_FragColor = vec4(czm_XYZToRGB(xyz), 1.0);
|
|
}
|
|
`;function Od(){this._sceneFramebuffer=new Eu;const e=.125,t=new Array(6);t[0]=new Wn({fragmentShader:Ep,textureScale:e,forcePowerOfTwo:!0,sampleMode:wp.LINEAR});const n=t[1]=new Wn({fragmentShader:n4e,uniforms:{avgLuminance:.5,threshold:.25,offset:.1},textureScale:e,forcePowerOfTwo:!0}),i=this;this._delta=1,this._sigma=2,this._blurStep=new H,t[2]=new Wn({fragmentShader:$D,uniforms:{step:function(){return i._blurStep.x=i._blurStep.y=1/n.outputTexture.width,i._blurStep},delta:function(){return i._delta},sigma:function(){return i._sigma},direction:0},textureScale:e,forcePowerOfTwo:!0}),t[3]=new Wn({fragmentShader:$D,uniforms:{step:function(){return i._blurStep.x=i._blurStep.y=1/n.outputTexture.width,i._blurStep},delta:function(){return i._delta},sigma:function(){return i._sigma},direction:1},textureScale:e,forcePowerOfTwo:!0}),t[4]=new Wn({fragmentShader:Ep,sampleMode:wp.LINEAR}),this._uCenter=new H,this._uRadius=void 0,t[5]=new Wn({fragmentShader:t4e,uniforms:{center:function(){return i._uCenter},radius:function(){return i._uRadius},colorTexture2:function(){return i._sceneFramebuffer.framebuffer.getColorTexture(0)}}}),this._stages=new Cs({stages:t});const o=new Su(this),r=t.length;for(let s=0;s<r;++s)t[s]._textureCache=o;this._textureCache=o,this.length=t.length}Od.prototype.get=function(e){return this._stages.get(e)};Od.prototype.getStageByName=function(e){const t=this._stages.length;for(let n=0;n<t;++n){const i=this._stages.get(n);if(i.name===e)return i}};const i4e=new te,_z=new H,o4e=new H,gz=new L;function r4e(e,t,n){const i=t.uniformState,o=i.sunPositionWC,r=i.view,s=i.viewProjection,a=i.projection;let l=L.computeViewportTransformation(n,0,1,gz);const u=L.multiplyByPoint(r,o,i4e);let h=zt.pointToGLWindowCoordinates(s,l,o,_z);u.x+=R.SOLAR_RADIUS;const f=zt.pointToGLWindowCoordinates(a,l,u,u),_=H.magnitude(H.subtract(f,h,f))*30*2,g=o4e;g.x=_,g.y=_,e._uCenter=H.clone(h,e._uCenter),e._uRadius=Math.max(g.x,g.y)*.15;const m=t.drawingBufferWidth,b=t.drawingBufferHeight,T=e._stages,x=T.get(0),C=x.outputTexture.width,w=x.outputTexture.height,v=new Re;v.width=C,v.height=w,l=L.computeViewportTransformation(v,0,1,gz),h=zt.pointToGLWindowCoordinates(s,l,o,_z),g.x*=C/m,g.y*=w/b;const P=x.scissorRectangle;P.x=Math.max(h.x-g.x*.5,0),P.y=Math.max(h.y-g.y*.5,0),P.width=Math.min(g.x,m),P.height=Math.min(g.y,b);for(let N=1;N<4;++N)Re.clone(P,T.get(N).scissorRectangle)}Od.prototype.clear=function(e,t,n){this._sceneFramebuffer.clear(e,t,n),this._textureCache.clear(e)};Od.prototype.update=function(e){const t=e.context,n=e.viewport,i=this._sceneFramebuffer;i.update(t,n);const o=i.framebuffer;return this._textureCache.update(t),this._stages.update(t,!1),r4e(this,t,n),o};Od.prototype.execute=function(e){const t=this._sceneFramebuffer.framebuffer.getColorTexture(0),n=this._stages,i=n.length;n.get(0).execute(e,t);for(let o=1;o<i;++o)n.get(o).execute(e,n.get(o-1).outputTexture)};Od.prototype.copy=function(e,t){if(!c(this._copyColorCommand)){const n=this;this._copyColorCommand=e.createViewportQuadCommand(Ep,{uniformMap:{colorTexture:function(){return n._stages.get(n._stages.length-1).outputTexture}},owner:this})}this._copyColorCommand.framebuffer=t,this._copyColorCommand.execute(e)};Od.prototype.isDestroyed=function(){return!1};Od.prototype.destroy=function(){return this._textureCache.destroy(),this._stages.destroy(),ve(this)};function V6(){this._cachedShowFrustumsShaders={}}function s4e(e){const t={},n=e.vertexAttributes;for(const i in n)n.hasOwnProperty(i)&&(t[i]=n[i].index);return t}function a4e(e,t){const n=e.context,i=t,o=i.fragmentShaderSource.clone(),r=[];o.sources=o.sources.map(function(h){h=Oe.replaceMain(h,"czm_Debug_main");const f=/out_FragData_(\d+)/g;let _;for(;(_=f.exec(h))!==null;)r.indexOf(_[1])===-1&&r.push(_[1]);return h});const s=r.length;let a="";a+=`uniform vec3 debugShowCommandsColor;
|
|
`,a+=`uniform vec3 debugShowFrustumsColor;
|
|
`,a+=`void main()
|
|
{
|
|
czm_Debug_main();
|
|
`;let l;if(s>0)for(l=0;l<s;++l)a+=` out_FragData_${r[l]}.rgb *= debugShowCommandsColor;
|
|
`,a+=` out_FragData_${r[l]}.rgb *= debugShowFrustumsColor;
|
|
`;else a+=` out_FragColor.rgb *= debugShowCommandsColor;
|
|
`,a+=` out_FragColor.rgb *= debugShowFrustumsColor;
|
|
`;a+="}",o.sources.push(a);const u=s4e(i);return Jt.fromCache({context:n,vertexShaderSource:i.vertexShaderSource,fragmentShaderSource:o,attributeLocations:u})}const ay=new z;function c4e(e,t){let n;return c(t.uniformMap)?n=t.uniformMap:n={},c(n.debugShowCommandsColor)||c(n.debugShowFrustumsColor)||(n.debugShowCommandsColor=function(){return e.debugShowCommands?(c(t._debugColor)||(t._debugColor=z.fromRandom()),t._debugColor):z.WHITE},n.debugShowFrustumsColor=function(){return e.debugShowFrustums?(ay.red=t.debugOverlappingFrustums&1<<0?1:0,ay.green=t.debugOverlappingFrustums&1<<1?1:0,ay.blue=t.debugOverlappingFrustums&1<<2?1:0,ay.alpha=1,ay):z.WHITE}),n}const l4e=new Ze;V6.prototype.executeDebugShowFrustumsCommand=function(e,t,n){const i=t.shaderProgram.id;let o=this._cachedShowFrustumsShaders[i];c(o)||(o=a4e(e,t.shaderProgram),this._cachedShowFrustumsShaders[i]=o);const r=Ze.shallowClone(t,l4e);r.shaderProgram=o,r.uniformMap=c4e(e,t),r.execute(e.context,n)};function Sp(e,t,n){this._primitive=e,this._tileIndex=t,this._sampleIndex=n,this._metadata={},this._orientedBoundingBox=new Ct}Sp.fromKeyframeNode=function(e,t,n,i){A.typeOf.object("primitive",e),A.typeOf.number("tileIndex",t),A.typeOf.number("sampleIndex",n),A.typeOf.object("keyframeNode",i);const o=new Sp(e,t,n),{spatialNode:r,metadata:s}=i;return o._metadata=u4e(e,s,n),o._orientedBoundingBox=h4e(e,r,n,o._orientedBoundingBox),o};function u4e(e,t,n){if(!c(t))return;const{names:i,types:o}=e.provider,r={};for(let s=0;s<i.length;s++){const a=i[s],l=bt.getComponentCount(o[s]),u=t[s].slice(n*l,(n+1)*l);r[a]=u}return r}const yz=new d,d4e=new d;function h4e(e,t,n,i){const o=t.dimensions,r=o.x*o.y,s=Math.floor(n/r),a=n-s*r,l=Math.floor(a/o.x),u=a-l*o.x,h=d.fromElements(u,l,s,yz),f=d.divideComponents(d.subtract(h,e._paddingBefore,yz),e.dimensions,d4e);return e._shape.computeOrientedBoundingBoxForSample(t,e.dimensions,f,i)}Object.defineProperties(Sp.prototype,{metadata:{get:function(){return this._metadata}},primitive:{get:function(){return this._primitive}},sampleIndex:{get:function(){return this._sampleIndex}},tileIndex:{get:function(){return this._tileIndex}},orientedBoundingBox:{get:function(){return this._orientedBoundingBox.clone()}}});Sp.prototype.hasProperty=function(e){return c(this._metadata[e])};Sp.prototype.getNames=function(){return Object.keys(this._metadata)};Sp.prototype.getProperty=function(e){return this._metadata[e]};const f4e=`struct Ray {
|
|
vec3 pos;
|
|
vec3 dir;
|
|
vec3 rawDir;
|
|
};
|
|
|
|
#if defined(JITTER)
|
|
/**
|
|
* Generate a pseudo-random value for a given 2D screen coordinate.
|
|
* Similar to https://www.shadertoy.com/view/4djSRW with a modified hashscale.
|
|
*/
|
|
float hash(vec2 p)
|
|
{
|
|
vec3 p3 = fract(vec3(p.xyx) * 50.0);
|
|
p3 += dot(p3, p3.yzx + 19.19);
|
|
return fract((p3.x + p3.y) * p3.z);
|
|
}
|
|
#endif
|
|
|
|
float minComponent(in vec3 v) {
|
|
return min(min(v.x, v.y), v.z);
|
|
}
|
|
|
|
float maxComponent(in vec3 v) {
|
|
return max(max(v.x, v.y), v.z);
|
|
}
|
|
|
|
struct PointJacobianT {
|
|
vec3 point;
|
|
mat3 jacobianT;
|
|
};
|
|
`,p4e=`// See Intersection.glsl for the definition of intersectScene
|
|
// See IntersectionUtils.glsl for the definition of nextIntersection
|
|
// See convertUvToBox.glsl, convertUvToCylinder.glsl, or convertUvToEllipsoid.glsl
|
|
// for the definition of convertUvToShapeUvSpace. The appropriate function is
|
|
// selected based on the VoxelPrimitive shape type, and added to the shader in
|
|
// Scene/VoxelRenderResources.js.
|
|
// See Octree.glsl for the definitions of TraversalData, SampleData,
|
|
// traverseOctreeFromBeginning, and traverseOctreeFromExisting
|
|
// See Megatexture.glsl for the definition of accumulatePropertiesFromMegatexture
|
|
|
|
#define STEP_COUNT_MAX 1000 // Harcoded value because GLSL doesn't like variable length loops
|
|
#if defined(PICKING_VOXEL)
|
|
#define ALPHA_ACCUM_MAX 0.1
|
|
#else
|
|
#define ALPHA_ACCUM_MAX 0.98 // Must be > 0.0 and <= 1.0
|
|
#endif
|
|
|
|
uniform mat3 u_transformDirectionViewToLocal;
|
|
uniform vec3 u_cameraPositionUv;
|
|
uniform float u_stepSize;
|
|
|
|
#if defined(PICKING)
|
|
uniform vec4 u_pickColor;
|
|
#endif
|
|
|
|
vec3 getSampleSize(in int level) {
|
|
vec3 sampleCount = exp2(float(level)) * vec3(u_dimensions);
|
|
vec3 sampleSizeUv = 1.0 / sampleCount;
|
|
return scaleShapeUvToShapeSpace(sampleSizeUv);
|
|
}
|
|
|
|
#define MINIMUM_STEP_SCALAR (0.02)
|
|
#define SHIFT_FRACTION (0.001)
|
|
|
|
/**
|
|
* Given a coordinate within a tile, and sample spacings along a ray through
|
|
* the coordinate, find the distance to the points where the ray entered and
|
|
* exited the voxel cell, along with the surface normals at those points.
|
|
* The surface normals are returned in shape space coordinates.
|
|
*/
|
|
RayShapeIntersection getVoxelIntersection(in vec3 tileUv, in vec3 sampleSizeAlongRay) {
|
|
vec3 voxelCoord = tileUv * vec3(u_dimensions);
|
|
vec3 directions = sign(sampleSizeAlongRay);
|
|
vec3 positiveDirections = max(directions, 0.0);
|
|
vec3 entryCoord = mix(ceil(voxelCoord), floor(voxelCoord), positiveDirections);
|
|
vec3 exitCoord = entryCoord + directions;
|
|
|
|
vec3 distanceFromEntry = -abs((entryCoord - voxelCoord) * sampleSizeAlongRay);
|
|
float lastEntry = maxComponent(distanceFromEntry);
|
|
bvec3 isLastEntry = equal(distanceFromEntry, vec3(lastEntry));
|
|
vec3 entryNormal = -1.0 * vec3(isLastEntry) * directions;
|
|
vec4 entry = vec4(entryNormal, lastEntry);
|
|
|
|
vec3 distanceToExit = abs((exitCoord - voxelCoord) * sampleSizeAlongRay);
|
|
float firstExit = minComponent(distanceToExit);
|
|
bvec3 isFirstExit = equal(distanceToExit, vec3(firstExit));
|
|
vec3 exitNormal = vec3(isFirstExit) * directions;
|
|
vec4 exit = vec4(exitNormal, firstExit);
|
|
|
|
return RayShapeIntersection(entry, exit);
|
|
}
|
|
|
|
vec4 getStepSize(in SampleData sampleData, in Ray viewRay, in RayShapeIntersection shapeIntersection, in mat3 jacobianT, in float currentT) {
|
|
// The Jacobian is computed in a space where the shape spans [-1, 1].
|
|
// But the ray is marched in a space where the shape fills [0, 1].
|
|
// So we need to scale the Jacobian by 2.
|
|
vec3 gradient = 2.0 * viewRay.rawDir * jacobianT;
|
|
vec3 sampleSizeAlongRay = getSampleSize(sampleData.tileCoords.w) / gradient;
|
|
|
|
RayShapeIntersection voxelIntersection = getVoxelIntersection(sampleData.tileUv, sampleSizeAlongRay);
|
|
|
|
// Transform normal from shape space to Cartesian space
|
|
vec3 voxelNormal = normalize(jacobianT * voxelIntersection.entry.xyz);
|
|
// Compare with the shape intersection, to choose the appropriate normal
|
|
vec4 voxelEntry = vec4(voxelNormal, currentT + voxelIntersection.entry.w);
|
|
vec4 entry = intersectionMax(shapeIntersection.entry, voxelEntry);
|
|
|
|
float fixedStep = minComponent(abs(sampleSizeAlongRay)) * u_stepSize;
|
|
float shift = fixedStep * SHIFT_FRACTION;
|
|
float dt = voxelIntersection.exit.w + shift;
|
|
if ((currentT + dt) > shapeIntersection.exit.w) {
|
|
// Stop at end of shape
|
|
dt = shapeIntersection.exit.w - currentT + shift;
|
|
}
|
|
float stepSize = clamp(dt, fixedStep * MINIMUM_STEP_SCALAR, fixedStep + shift);
|
|
|
|
return vec4(entry.xyz, stepSize);
|
|
}
|
|
|
|
vec2 packIntToVec2(int value) {
|
|
float shifted = float(value) / 255.0;
|
|
float lowBits = fract(shifted);
|
|
float highBits = floor(shifted) / 255.0;
|
|
return vec2(highBits, lowBits);
|
|
}
|
|
|
|
vec2 packFloatToVec2(float value) {
|
|
float lowBits = fract(value);
|
|
float highBits = floor(value) / 255.0;
|
|
return vec2(highBits, lowBits);
|
|
}
|
|
|
|
int getSampleIndex(in vec3 tileUv) {
|
|
ivec3 voxelDimensions = u_dimensions;
|
|
vec3 sampleCoordinate = tileUv * vec3(voxelDimensions);
|
|
// tileUv = 1.0 is a valid coordinate but sampleIndex = voxelDimensions is not.
|
|
// (tileUv = 1.0 corresponds to the last sample, at index = voxelDimensions - 1).
|
|
// Clamp to [0, voxelDimensions - 0.5) to avoid numerical error before flooring
|
|
vec3 maxCoordinate = vec3(voxelDimensions) - vec3(0.5);
|
|
sampleCoordinate = clamp(sampleCoordinate, vec3(0.0), maxCoordinate);
|
|
ivec3 sampleIndex = ivec3(floor(sampleCoordinate));
|
|
#if defined(PADDING)
|
|
voxelDimensions += u_paddingBefore + u_paddingAfter;
|
|
sampleIndex += u_paddingBefore;
|
|
#endif
|
|
// Convert to a 1D index for lookup in a 1D data array
|
|
return sampleIndex.x + voxelDimensions.x * (sampleIndex.y + voxelDimensions.y * sampleIndex.z);
|
|
}
|
|
|
|
void main()
|
|
{
|
|
vec4 fragCoord = gl_FragCoord;
|
|
vec2 screenCoord = (fragCoord.xy - czm_viewport.xy) / czm_viewport.zw; // [0,1]
|
|
vec3 eyeDirection = normalize(czm_windowToEyeCoordinates(fragCoord).xyz);
|
|
vec3 viewDirWorld = normalize(czm_inverseViewRotation * eyeDirection); // normalize again just in case
|
|
vec3 viewDirUv = normalize(u_transformDirectionViewToLocal * eyeDirection); // normalize again just in case
|
|
vec3 viewPosUv = u_cameraPositionUv;
|
|
#if defined(SHAPE_ELLIPSOID)
|
|
// viewDirUv has been scaled to a space where the ellipsoid is a sphere.
|
|
// Undo this scaling to get the raw direction.
|
|
vec3 rawDir = viewDirUv * u_ellipsoidRadiiUv;
|
|
Ray viewRayUv = Ray(viewPosUv, viewDirUv, rawDir);
|
|
#else
|
|
Ray viewRayUv = Ray(viewPosUv, viewDirUv, viewDirUv);
|
|
#endif
|
|
|
|
Intersections ix;
|
|
RayShapeIntersection shapeIntersection = intersectScene(screenCoord, viewRayUv, ix);
|
|
|
|
// Exit early if the scene was completely missed.
|
|
if (shapeIntersection.entry.w == NO_HIT) {
|
|
discard;
|
|
}
|
|
|
|
float currentT = shapeIntersection.entry.w;
|
|
float endT = shapeIntersection.exit.w;
|
|
vec3 positionUv = viewPosUv + currentT * viewDirUv;
|
|
PointJacobianT pointJacobian = convertUvToShapeUvSpaceDerivative(positionUv);
|
|
|
|
// Traverse the tree from the start position
|
|
TraversalData traversalData;
|
|
SampleData sampleDatas[SAMPLE_COUNT];
|
|
traverseOctreeFromBeginning(pointJacobian.point, traversalData, sampleDatas);
|
|
vec4 step = getStepSize(sampleDatas[0], viewRayUv, shapeIntersection, pointJacobian.jacobianT, currentT);
|
|
|
|
#if defined(JITTER)
|
|
float noise = hash(screenCoord); // [0,1]
|
|
currentT += noise * step.w;
|
|
positionUv += noise * step.w * viewDirUv;
|
|
#endif
|
|
|
|
FragmentInput fragmentInput;
|
|
#if defined(STATISTICS)
|
|
setStatistics(fragmentInput.metadata.statistics);
|
|
#endif
|
|
|
|
vec4 colorAccum = vec4(0.0);
|
|
|
|
for (int stepCount = 0; stepCount < STEP_COUNT_MAX; ++stepCount) {
|
|
// Read properties from the megatexture based on the traversal state
|
|
Properties properties = accumulatePropertiesFromMegatexture(sampleDatas);
|
|
|
|
// Prepare the custom shader inputs
|
|
copyPropertiesToMetadata(properties, fragmentInput.metadata);
|
|
fragmentInput.voxel.positionUv = positionUv;
|
|
fragmentInput.voxel.positionShapeUv = pointJacobian.point;
|
|
fragmentInput.voxel.positionUvLocal = sampleDatas[0].tileUv;
|
|
fragmentInput.voxel.viewDirUv = viewDirUv;
|
|
fragmentInput.voxel.viewDirWorld = viewDirWorld;
|
|
fragmentInput.voxel.surfaceNormal = step.xyz;
|
|
fragmentInput.voxel.travelDistance = step.w;
|
|
fragmentInput.voxel.stepCount = stepCount;
|
|
fragmentInput.voxel.tileIndex = sampleDatas[0].megatextureIndex;
|
|
fragmentInput.voxel.sampleIndex = getSampleIndex(sampleDatas[0].tileUv);
|
|
|
|
// Run the custom shader
|
|
czm_modelMaterial materialOutput;
|
|
fragmentMain(fragmentInput, materialOutput);
|
|
|
|
// Sanitize the custom shader output
|
|
vec4 color = vec4(materialOutput.diffuse, materialOutput.alpha);
|
|
color.rgb = max(color.rgb, vec3(0.0));
|
|
color.a = clamp(color.a, 0.0, 1.0);
|
|
|
|
// Pre-multiplied alpha blend
|
|
colorAccum += (1.0 - colorAccum.a) * vec4(color.rgb * color.a, color.a);
|
|
|
|
// Stop traversing if the alpha has been fully saturated
|
|
if (colorAccum.a > ALPHA_ACCUM_MAX) {
|
|
colorAccum.a = ALPHA_ACCUM_MAX;
|
|
break;
|
|
}
|
|
|
|
if (step.w == 0.0) {
|
|
// Shape is infinitely thin. The ray may have hit the edge of a
|
|
// foreground voxel. Step ahead slightly to check for more voxels
|
|
step.w == 0.00001;
|
|
}
|
|
|
|
// Keep raymarching
|
|
currentT += step.w;
|
|
positionUv = viewPosUv + currentT * viewDirUv;
|
|
|
|
// Check if there's more intersections.
|
|
if (currentT > endT) {
|
|
#if (INTERSECTION_COUNT == 1)
|
|
break;
|
|
#else
|
|
shapeIntersection = nextIntersection(ix);
|
|
if (shapeIntersection.entry.w == NO_HIT) {
|
|
break;
|
|
} else {
|
|
// Found another intersection. Resume raymarching there
|
|
currentT = shapeIntersection.entry.w;
|
|
endT = shapeIntersection.exit.w;
|
|
positionUv = viewPosUv + currentT * viewDirUv;
|
|
}
|
|
#endif
|
|
}
|
|
|
|
// Traverse the tree from the current ray position.
|
|
// This is similar to traverseOctreeFromBeginning but is faster when the ray is in the same tile as the previous step.
|
|
pointJacobian = convertUvToShapeUvSpaceDerivative(positionUv);
|
|
traverseOctreeFromExisting(pointJacobian.point, traversalData, sampleDatas);
|
|
step = getStepSize(sampleDatas[0], viewRayUv, shapeIntersection, pointJacobian.jacobianT, currentT);
|
|
}
|
|
|
|
// Convert the alpha from [0,ALPHA_ACCUM_MAX] to [0,1]
|
|
colorAccum.a /= ALPHA_ACCUM_MAX;
|
|
|
|
#if defined(PICKING)
|
|
// If alpha is 0.0 there is nothing to pick
|
|
if (colorAccum.a == 0.0) {
|
|
discard;
|
|
}
|
|
out_FragColor = u_pickColor;
|
|
#elif defined(PICKING_VOXEL)
|
|
// If alpha is 0.0 there is nothing to pick
|
|
if (colorAccum.a == 0.0) {
|
|
discard;
|
|
}
|
|
vec2 megatextureId = packIntToVec2(sampleDatas[0].megatextureIndex);
|
|
vec2 sampleIndex = packIntToVec2(getSampleIndex(sampleDatas[0].tileUv));
|
|
out_FragColor = vec4(megatextureId, sampleIndex);
|
|
#else
|
|
out_FragColor = colorAccum;
|
|
#endif
|
|
}
|
|
`,m4e=`in vec2 position;
|
|
|
|
uniform vec4 u_ndcSpaceAxisAlignedBoundingBox;
|
|
|
|
void main() {
|
|
vec2 aabbMin = u_ndcSpaceAxisAlignedBoundingBox.xy;
|
|
vec2 aabbMax = u_ndcSpaceAxisAlignedBoundingBox.zw;
|
|
vec2 translation = 0.5 * (aabbMax + aabbMin);
|
|
vec2 scale = 0.5 * (aabbMax - aabbMin);
|
|
gl_Position = vec4(position * scale + translation, 0.0, 1.0);
|
|
}
|
|
`,_4e=`/* Intersection defines
|
|
#define INTERSECTION_COUNT ###
|
|
*/
|
|
|
|
#define NO_HIT (-czm_infinity)
|
|
#define INF_HIT (czm_infinity * 0.5)
|
|
|
|
struct RayShapeIntersection {
|
|
vec4 entry;
|
|
vec4 exit;
|
|
};
|
|
|
|
vec4 intersectionMin(in vec4 intersect0, in vec4 intersect1)
|
|
{
|
|
if (intersect0.w == NO_HIT) {
|
|
return intersect1;
|
|
} else if (intersect1.w == NO_HIT) {
|
|
return intersect0;
|
|
}
|
|
return (intersect0.w <= intersect1.w) ? intersect0 : intersect1;
|
|
}
|
|
|
|
vec4 intersectionMax(in vec4 intersect0, in vec4 intersect1)
|
|
{
|
|
return (intersect0.w >= intersect1.w) ? intersect0 : intersect1;
|
|
}
|
|
|
|
RayShapeIntersection intersectIntersections(in Ray ray, in RayShapeIntersection intersect0, in RayShapeIntersection intersect1)
|
|
{
|
|
bool missed = (intersect0.entry.w == NO_HIT) ||
|
|
(intersect1.entry.w == NO_HIT) ||
|
|
(intersect0.exit.w < intersect1.entry.w) ||
|
|
(intersect0.entry.w > intersect1.exit.w);
|
|
if (missed) {
|
|
vec4 miss = vec4(normalize(ray.dir), NO_HIT);
|
|
return RayShapeIntersection(miss, miss);
|
|
}
|
|
|
|
vec4 entry = intersectionMax(intersect0.entry, intersect1.entry);
|
|
vec4 exit = intersectionMin(intersect0.exit, intersect1.exit);
|
|
|
|
return RayShapeIntersection(entry, exit);
|
|
}
|
|
|
|
struct Intersections {
|
|
// Don't access these member variables directly - call the functions instead.
|
|
|
|
// Store an array of ray-surface intersections. Each intersection is composed of:
|
|
// .xyz for the surface normal at the intersection point
|
|
// .w for the T value
|
|
// The scale of the normal encodes the shape intersection type:
|
|
// length(intersection.xyz) = 1: positive shape entry
|
|
// length(intersection.xyz) = 2: positive shape exit
|
|
// length(intersection.xyz) = 3: negative shape entry
|
|
// length(intersection.xyz) = 4: negative shape exit
|
|
// INTERSECTION_COUNT is the number of ray-*shape* (volume) intersections,
|
|
// so we need twice as many to track ray-*surface* intersections
|
|
vec4 intersections[INTERSECTION_COUNT * 2];
|
|
|
|
#if (INTERSECTION_COUNT > 1)
|
|
// Maintain state for future nextIntersection calls
|
|
int index;
|
|
int surroundCount;
|
|
bool surroundIsPositive;
|
|
#endif
|
|
};
|
|
|
|
RayShapeIntersection getFirstIntersection(in Intersections ix)
|
|
{
|
|
return RayShapeIntersection(ix.intersections[0], ix.intersections[1]);
|
|
}
|
|
|
|
vec4 encodeIntersectionType(vec4 intersection, int index, bool entry)
|
|
{
|
|
float scale = float(index > 0) * 2.0 + float(!entry) + 1.0;
|
|
return vec4(intersection.xyz * scale, intersection.w);
|
|
}
|
|
|
|
// Use defines instead of real functions because WebGL1 cannot access array with non-constant index.
|
|
#define setIntersection(/*inout Intersections*/ ix, /*int*/ index, /*float*/ t, /*bool*/ positive, /*bool*/ enter) (ix).intersections[(index)] = vec4(0.0, float(!positive) * 2.0 + float(!enter) + 1.0, 0.0, (t))
|
|
#define setIntersectionPair(/*inout Intersections*/ ix, /*int*/ index, /*vec2*/ entryExit) (ix).intersections[(index) * 2 + 0] = vec4(0.0, float((index) > 0) * 2.0 + 1.0, 0.0, (entryExit).x); (ix).intersections[(index) * 2 + 1] = vec4(0.0, float((index) > 0) * 2.0 + 2.0, 0.0, (entryExit).y)
|
|
#define setSurfaceIntersection(/*inout Intersections*/ ix, /*int*/ index, /*vec4*/ intersection, /*bool*/ positive, /*bool*/ enter) (ix).intersections[(index)] = encodeIntersectionType((intersection), int(!positive), (enter))
|
|
#define setShapeIntersection(/*inout Intersections*/ ix, /*int*/ index, /*RayShapeIntersection*/ intersection) (ix).intersections[(index) * 2 + 0] = encodeIntersectionType((intersection).entry, (index), true); (ix).intersections[(index) * 2 + 1] = encodeIntersectionType((intersection).exit, (index), false)
|
|
|
|
#if (INTERSECTION_COUNT > 1)
|
|
void initializeIntersections(inout Intersections ix) {
|
|
// Sort the intersections from min T to max T with bubble sort.
|
|
// Note: If this sorting function changes, some of the intersection test may
|
|
// need to be updated. Search for "bubble sort" to find those areas.
|
|
const int sortPasses = INTERSECTION_COUNT * 2 - 1;
|
|
for (int n = sortPasses; n > 0; --n) {
|
|
for (int i = 0; i < sortPasses; ++i) {
|
|
// The loop should be: for (i = 0; i < n; ++i) {...} but WebGL1 cannot
|
|
// loop with non-constant condition, so it has to break early instead
|
|
if (i >= n) { break; }
|
|
|
|
vec4 intersect0 = ix.intersections[i + 0];
|
|
vec4 intersect1 = ix.intersections[i + 1];
|
|
|
|
bool inOrder = intersect0.w <= intersect1.w;
|
|
|
|
ix.intersections[i + 0] = inOrder ? intersect0 : intersect1;
|
|
ix.intersections[i + 1] = inOrder ? intersect1 : intersect0;
|
|
}
|
|
}
|
|
|
|
// Prepare initial state for nextIntersection
|
|
ix.index = 0;
|
|
ix.surroundCount = 0;
|
|
ix.surroundIsPositive = false;
|
|
}
|
|
#endif
|
|
|
|
#if (INTERSECTION_COUNT > 1)
|
|
RayShapeIntersection nextIntersection(inout Intersections ix) {
|
|
vec4 surfaceIntersection = vec4(0.0, 0.0, 0.0, NO_HIT);
|
|
RayShapeIntersection shapeIntersection = RayShapeIntersection(surfaceIntersection, surfaceIntersection);
|
|
|
|
const int passCount = INTERSECTION_COUNT * 2;
|
|
|
|
if (ix.index == passCount) {
|
|
return shapeIntersection;
|
|
}
|
|
|
|
for (int i = 0; i < passCount; ++i) {
|
|
// The loop should be: for (i = ix.index; i < passCount; ++i) {...} but WebGL1 cannot
|
|
// loop with non-constant condition, so it has to continue instead.
|
|
if (i < ix.index) {
|
|
continue;
|
|
}
|
|
|
|
ix.index = i + 1;
|
|
|
|
surfaceIntersection = ix.intersections[i];
|
|
int intersectionType = int(length(surfaceIntersection.xyz) - 0.5);
|
|
bool currShapeIsPositive = intersectionType < 2;
|
|
bool enter = intMod(intersectionType, 2) == 0;
|
|
|
|
ix.surroundCount += enter ? +1 : -1;
|
|
ix.surroundIsPositive = currShapeIsPositive ? enter : ix.surroundIsPositive;
|
|
|
|
// entering positive or exiting negative
|
|
if (ix.surroundCount == 1 && ix.surroundIsPositive && enter == currShapeIsPositive) {
|
|
shapeIntersection.entry = surfaceIntersection;
|
|
}
|
|
|
|
// exiting positive or entering negative after being inside positive
|
|
bool exitPositive = !enter && currShapeIsPositive && ix.surroundCount == 0;
|
|
bool enterNegativeFromPositive = enter && !currShapeIsPositive && ix.surroundCount == 2 && ix.surroundIsPositive;
|
|
if (exitPositive || enterNegativeFromPositive) {
|
|
shapeIntersection.exit = surfaceIntersection;
|
|
|
|
// entry and exit have been found, so the loop can stop
|
|
if (exitPositive) {
|
|
// After exiting positive shape there is nothing left to intersect, so jump to the end index.
|
|
ix.index = passCount;
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
|
|
return shapeIntersection;
|
|
}
|
|
#endif
|
|
|
|
// NOTE: initializeIntersections, nextIntersection aren't even declared unless INTERSECTION_COUNT > 1
|
|
`,g4e=`// See IntersectionUtils.glsl for the definitions of Ray, Intersections,
|
|
// setIntersectionPair, INF_HIT, NO_HIT
|
|
|
|
/* intersectDepth defines (set in Scene/VoxelRenderResources.js)
|
|
#define DEPTH_INTERSECTION_INDEX ###
|
|
*/
|
|
|
|
uniform mat4 u_transformPositionViewToUv;
|
|
|
|
void intersectDepth(in vec2 screenCoord, in Ray ray, inout Intersections ix) {
|
|
float logDepthOrDepth = czm_unpackDepth(texture(czm_globeDepthTexture, screenCoord));
|
|
if (logDepthOrDepth != 0.0) {
|
|
// Calculate how far the ray must travel before it hits the depth buffer.
|
|
vec4 eyeCoordinateDepth = czm_screenToEyeCoordinates(screenCoord, logDepthOrDepth);
|
|
eyeCoordinateDepth /= eyeCoordinateDepth.w;
|
|
vec3 depthPositionUv = vec3(u_transformPositionViewToUv * eyeCoordinateDepth);
|
|
float t = dot(depthPositionUv - ray.pos, ray.dir);
|
|
setIntersectionPair(ix, DEPTH_INTERSECTION_INDEX, vec2(t, +INF_HIT));
|
|
} else {
|
|
// There's no depth at this location.
|
|
setIntersectionPair(ix, DEPTH_INTERSECTION_INDEX, vec2(NO_HIT));
|
|
}
|
|
}
|
|
`,y4e=`// See IntersectionUtils.glsl for the definitions of Ray, Intersections, INF_HIT,
|
|
// NO_HIT, setShapeIntersection
|
|
|
|
/* Clipping plane defines (set in Scene/VoxelRenderResources.js)
|
|
#define CLIPPING_PLANES_UNION
|
|
#define CLIPPING_PLANES_COUNT
|
|
#define CLIPPING_PLANES_INTERSECTION_INDEX
|
|
*/
|
|
|
|
uniform sampler2D u_clippingPlanesTexture;
|
|
uniform mat4 u_clippingPlanesMatrix;
|
|
|
|
// Plane is in Hessian Normal Form
|
|
vec4 intersectPlane(in Ray ray, in vec4 plane) {
|
|
vec3 n = plane.xyz; // normal
|
|
float w = plane.w; // -dot(pointOnPlane, normal)
|
|
|
|
float a = dot(ray.pos, n);
|
|
float b = dot(ray.dir, n);
|
|
float t = -(w + a) / b;
|
|
|
|
return vec4(n, t);
|
|
}
|
|
|
|
void intersectClippingPlanes(in Ray ray, inout Intersections ix) {
|
|
vec4 backSide = vec4(-ray.dir, -INF_HIT);
|
|
vec4 farSide = vec4(ray.dir, +INF_HIT);
|
|
RayShapeIntersection clippingVolume;
|
|
|
|
#if (CLIPPING_PLANES_COUNT == 1)
|
|
// Union and intersection are the same when there's one clipping plane, and the code
|
|
// is more simplified.
|
|
vec4 planeUv = getClippingPlane(u_clippingPlanesTexture, 0, u_clippingPlanesMatrix);
|
|
vec4 intersection = intersectPlane(ray, planeUv);
|
|
bool reflects = dot(ray.dir, intersection.xyz) < 0.0;
|
|
clippingVolume.entry = reflects ? backSide : intersection;
|
|
clippingVolume.exit = reflects ? intersection : farSide;
|
|
setShapeIntersection(ix, CLIPPING_PLANES_INTERSECTION_INDEX, clippingVolume);
|
|
#elif defined(CLIPPING_PLANES_UNION)
|
|
vec4 firstTransmission = vec4(ray.dir, +INF_HIT);
|
|
vec4 lastReflection = vec4(-ray.dir, -INF_HIT);
|
|
for (int i = 0; i < CLIPPING_PLANES_COUNT; i++) {
|
|
vec4 planeUv = getClippingPlane(u_clippingPlanesTexture, i, u_clippingPlanesMatrix);
|
|
vec4 intersection = intersectPlane(ray, planeUv);
|
|
if (dot(ray.dir, planeUv.xyz) > 0.0) {
|
|
firstTransmission = intersection.w <= firstTransmission.w ? intersection : firstTransmission;
|
|
} else {
|
|
lastReflection = intersection.w >= lastReflection.w ? intersection : lastReflection;
|
|
}
|
|
}
|
|
clippingVolume.entry = backSide;
|
|
clippingVolume.exit = lastReflection;
|
|
setShapeIntersection(ix, CLIPPING_PLANES_INTERSECTION_INDEX + 0, clippingVolume);
|
|
clippingVolume.entry = firstTransmission;
|
|
clippingVolume.exit = farSide;
|
|
setShapeIntersection(ix, CLIPPING_PLANES_INTERSECTION_INDEX + 1, clippingVolume);
|
|
#else // intersection
|
|
vec4 lastTransmission = vec4(ray.dir, -INF_HIT);
|
|
vec4 firstReflection = vec4(-ray.dir, +INF_HIT);
|
|
for (int i = 0; i < CLIPPING_PLANES_COUNT; i++) {
|
|
vec4 planeUv = getClippingPlane(u_clippingPlanesTexture, i, u_clippingPlanesMatrix);
|
|
vec4 intersection = intersectPlane(ray, planeUv);
|
|
if (dot(ray.dir, planeUv.xyz) > 0.0) {
|
|
lastTransmission = intersection.w > lastTransmission.w ? intersection : lastTransmission;
|
|
} else {
|
|
firstReflection = intersection.w < firstReflection.w ? intersection: firstReflection;
|
|
}
|
|
}
|
|
if (lastTransmission.w < firstReflection.w) {
|
|
clippingVolume.entry = lastTransmission;
|
|
clippingVolume.exit = firstReflection;
|
|
} else {
|
|
clippingVolume.entry = vec4(-ray.dir, NO_HIT);
|
|
clippingVolume.exit = vec4(ray.dir, NO_HIT);
|
|
}
|
|
setShapeIntersection(ix, CLIPPING_PLANES_INTERSECTION_INDEX, clippingVolume);
|
|
#endif
|
|
}
|
|
`,bz=`// See IntersectionUtils.glsl for the definitions of Ray, NO_HIT, INF_HIT,
|
|
// RayShapeIntersection
|
|
|
|
vec4 intersectLongitude(in Ray ray, in float angle, in bool positiveNormal) {
|
|
float normalSign = positiveNormal ? 1.0 : -1.0;
|
|
vec2 planeNormal = vec2(-sin(angle), cos(angle)) * normalSign;
|
|
|
|
vec2 position = ray.pos.xy;
|
|
vec2 direction = ray.dir.xy;
|
|
float approachRate = dot(direction, planeNormal);
|
|
float distance = -dot(position, planeNormal);
|
|
|
|
float t = (approachRate == 0.0)
|
|
? NO_HIT
|
|
: distance / approachRate;
|
|
|
|
return vec4(planeNormal, 0.0, t);
|
|
}
|
|
|
|
RayShapeIntersection intersectHalfSpace(in Ray ray, in float angle, in bool positiveNormal)
|
|
{
|
|
vec4 intersection = intersectLongitude(ray, angle, positiveNormal);
|
|
vec4 farSide = vec4(normalize(ray.dir), INF_HIT);
|
|
|
|
bool hitFront = (intersection.w > 0.0) == (dot(ray.pos.xy, intersection.xy) > 0.0);
|
|
if (!hitFront) {
|
|
return RayShapeIntersection(intersection, farSide);
|
|
} else {
|
|
return RayShapeIntersection(-1.0 * farSide, intersection);
|
|
}
|
|
}
|
|
|
|
void intersectFlippedWedge(in Ray ray, in vec2 minMaxAngle, out RayShapeIntersection intersections[2])
|
|
{
|
|
intersections[0] = intersectHalfSpace(ray, minMaxAngle.x, false);
|
|
intersections[1] = intersectHalfSpace(ray, minMaxAngle.y, true);
|
|
}
|
|
|
|
bool hitPositiveHalfPlane(in Ray ray, in vec4 intersection, in bool positiveNormal) {
|
|
float normalSign = positiveNormal ? 1.0 : -1.0;
|
|
vec2 planeDirection = vec2(intersection.y, -intersection.x) * normalSign;
|
|
vec2 hit = ray.pos.xy + intersection.w * ray.dir.xy;
|
|
return dot(hit, planeDirection) > 0.0;
|
|
}
|
|
|
|
void intersectHalfPlane(in Ray ray, in float angle, out RayShapeIntersection intersections[2]) {
|
|
vec4 intersection = intersectLongitude(ray, angle, true);
|
|
vec4 farSide = vec4(normalize(ray.dir), INF_HIT);
|
|
|
|
if (hitPositiveHalfPlane(ray, intersection, true)) {
|
|
intersections[0].entry = -1.0 * farSide;
|
|
intersections[0].exit = vec4(-1.0 * intersection.xy, 0.0, intersection.w);
|
|
intersections[1].entry = intersection;
|
|
intersections[1].exit = farSide;
|
|
} else {
|
|
vec4 miss = vec4(normalize(ray.dir), NO_HIT);
|
|
intersections[0].entry = -1.0 * farSide;
|
|
intersections[0].exit = farSide;
|
|
intersections[1].entry = miss;
|
|
intersections[1].exit = miss;
|
|
}
|
|
}
|
|
|
|
RayShapeIntersection intersectRegularWedge(in Ray ray, in vec2 minMaxAngle)
|
|
{
|
|
// Note: works for maxAngle > minAngle + pi, where the "regular wedge"
|
|
// is actually a negative volume.
|
|
// Compute intersections with the two planes.
|
|
// Normals will point toward the "outside" (negative space)
|
|
vec4 intersect1 = intersectLongitude(ray, minMaxAngle.x, false);
|
|
vec4 intersect2 = intersectLongitude(ray, minMaxAngle.y, true);
|
|
|
|
// Choose intersection with smallest T as the "first", the other as "last"
|
|
// Note: first or last could be in the "shadow" wedge, beyond the tip
|
|
bool inOrder = intersect1.w <= intersect2.w;
|
|
vec4 first = inOrder ? intersect1 : intersect2;
|
|
vec4 last = inOrder ? intersect2 : intersect1;
|
|
|
|
bool firstIsAhead = first.w >= 0.0;
|
|
bool startedInsideFirst = dot(ray.pos.xy, first.xy) < 0.0;
|
|
bool exitFromInside = firstIsAhead == startedInsideFirst;
|
|
bool lastIsAhead = last.w > 0.0;
|
|
bool startedOutsideLast = dot(ray.pos.xy, last.xy) >= 0.0;
|
|
bool enterFromOutside = lastIsAhead == startedOutsideLast;
|
|
|
|
vec4 farSide = vec4(normalize(ray.dir), INF_HIT);
|
|
vec4 miss = vec4(normalize(ray.dir), NO_HIT);
|
|
|
|
if (exitFromInside && enterFromOutside) {
|
|
// Ray crosses both faces of negative wedge, exiting then entering the positive shape
|
|
return RayShapeIntersection(first, last);
|
|
} else if (!exitFromInside && enterFromOutside) {
|
|
// Ray starts inside wedge. last is in shadow wedge, and first is actually the entry
|
|
return RayShapeIntersection(-1.0 * farSide, first);
|
|
} else if (exitFromInside && !enterFromOutside) {
|
|
// First intersection was in the shadow wedge, so last is actually the exit
|
|
return RayShapeIntersection(last, farSide);
|
|
} else { // !exitFromInside && !enterFromOutside
|
|
// Both intersections were in the shadow wedge
|
|
return RayShapeIntersection(miss, miss);
|
|
}
|
|
}
|
|
`,b4e=`// See IntersectionUtils.glsl for the definitions of Ray, RayShapeIntersection,
|
|
// NO_HIT, Intersections
|
|
|
|
/* Box defines (set in Scene/VoxelBoxShape.js)
|
|
#define BOX_INTERSECTION_INDEX ### // always 0
|
|
*/
|
|
|
|
uniform vec3 u_renderMinBounds;
|
|
uniform vec3 u_renderMaxBounds;
|
|
|
|
RayShapeIntersection intersectBox(in Ray ray, in vec3 minBound, in vec3 maxBound)
|
|
{
|
|
// Consider the box as the intersection of the space between 3 pairs of parallel planes
|
|
// Compute the distance along the ray to each plane
|
|
vec3 t0 = (minBound - ray.pos) / ray.dir;
|
|
vec3 t1 = (maxBound - ray.pos) / ray.dir;
|
|
|
|
// Identify candidate entries/exits based on distance from ray.pos
|
|
vec3 entries = min(t0, t1);
|
|
vec3 exits = max(t0, t1);
|
|
|
|
vec3 directions = sign(ray.dir);
|
|
|
|
// The actual intersection points are the furthest entry and the closest exit
|
|
float lastEntry = maxComponent(entries);
|
|
bvec3 isLastEntry = equal(entries, vec3(lastEntry));
|
|
vec3 entryNormal = -1.0 * vec3(isLastEntry) * directions;
|
|
vec4 entry = vec4(entryNormal, lastEntry);
|
|
|
|
float firstExit = minComponent(exits);
|
|
bvec3 isFirstExit = equal(exits, vec3(firstExit));
|
|
vec3 exitNormal = vec3(isLastEntry) * directions;
|
|
vec4 exit = vec4(exitNormal, firstExit);
|
|
|
|
if (entry.w > exit.w) {
|
|
entry.w = NO_HIT;
|
|
exit.w = NO_HIT;
|
|
}
|
|
|
|
return RayShapeIntersection(entry, exit);
|
|
}
|
|
|
|
void intersectShape(in Ray ray, inout Intersections ix)
|
|
{
|
|
RayShapeIntersection intersection = intersectBox(ray, u_renderMinBounds, u_renderMaxBounds);
|
|
setShapeIntersection(ix, BOX_INTERSECTION_INDEX, intersection);
|
|
}
|
|
`,T4e=`// See IntersectionUtils.glsl for the definitions of Ray, NO_HIT, Intersections,
|
|
// RayShapeIntersection, setSurfaceIntersection, setShapeIntersection,
|
|
// intersectIntersections
|
|
// See IntersectLongitude.glsl for the definitions of intersectHalfPlane,
|
|
// intersectFlippedWedge, intersectRegularWedge
|
|
|
|
/* Cylinder defines (set in Scene/VoxelCylinderShape.js)
|
|
#define CYLINDER_HAS_RENDER_BOUNDS_RADIUS_MIN
|
|
#define CYLINDER_HAS_RENDER_BOUNDS_RADIUS_FLAT
|
|
#define CYLINDER_HAS_RENDER_BOUNDS_ANGLE
|
|
#define CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_UNDER_HALF
|
|
#define CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_OVER_HALF
|
|
#define CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_EQUAL_ZERO
|
|
|
|
#define CYLINDER_INTERSECTION_INDEX_RADIUS_MAX
|
|
#define CYLINDER_INTERSECTION_INDEX_RADIUS_MIN
|
|
#define CYLINDER_INTERSECTION_INDEX_ANGLE
|
|
*/
|
|
|
|
// Cylinder uniforms
|
|
uniform vec2 u_cylinderRenderRadiusMinMax;
|
|
uniform vec2 u_cylinderRenderHeightMinMax;
|
|
#if defined(CYLINDER_HAS_RENDER_BOUNDS_ANGLE)
|
|
uniform vec2 u_cylinderRenderAngleMinMax;
|
|
#endif
|
|
|
|
/**
|
|
* Find the intersection of a ray with the volume defined by two planes of constant z
|
|
*/
|
|
RayShapeIntersection intersectHeightBounds(in Ray ray, in vec2 minMaxHeight, in bool convex)
|
|
{
|
|
float zPosition = ray.pos.z;
|
|
float zDirection = ray.dir.z;
|
|
|
|
float tmin = (minMaxHeight.x - zPosition) / zDirection;
|
|
float tmax = (minMaxHeight.y - zPosition) / zDirection;
|
|
|
|
// Normals point outside the volume
|
|
float signFlip = convex ? 1.0 : -1.0;
|
|
vec4 intersectMin = vec4(0.0, 0.0, -1.0 * signFlip, tmin);
|
|
vec4 intersectMax = vec4(0.0, 0.0, 1.0 * signFlip, tmax);
|
|
|
|
bool topEntry = zDirection < 0.0;
|
|
vec4 entry = topEntry ? intersectMax : intersectMin;
|
|
vec4 exit = topEntry ? intersectMin : intersectMax;
|
|
|
|
return RayShapeIntersection(entry, exit);
|
|
}
|
|
|
|
/**
|
|
* Find the intersection of a ray with a right cylindrical surface of a given radius
|
|
* about the z-axis.
|
|
*/
|
|
RayShapeIntersection intersectCylinder(in Ray ray, in float radius, in bool convex)
|
|
{
|
|
vec2 position = ray.pos.xy;
|
|
vec2 direction = ray.dir.xy;
|
|
|
|
float a = dot(direction, direction);
|
|
float b = dot(position, direction);
|
|
float c = dot(position, position) - radius * radius;
|
|
float determinant = b * b - a * c;
|
|
|
|
if (determinant < 0.0) {
|
|
vec4 miss = vec4(normalize(ray.dir), NO_HIT);
|
|
return RayShapeIntersection(miss, miss);
|
|
}
|
|
|
|
determinant = sqrt(determinant);
|
|
float t1 = (-b - determinant) / a;
|
|
float t2 = (-b + determinant) / a;
|
|
float signFlip = convex ? 1.0 : -1.0;
|
|
vec4 intersect1 = vec4(normalize(position + t1 * direction) * signFlip, 0.0, t1);
|
|
vec4 intersect2 = vec4(normalize(position + t2 * direction) * signFlip, 0.0, t2);
|
|
|
|
return RayShapeIntersection(intersect1, intersect2);
|
|
}
|
|
|
|
/**
|
|
* Find the intersection of a ray with a right cylindrical solid of given
|
|
* radius and height bounds. NOTE: The shape is assumed to be convex.
|
|
*/
|
|
RayShapeIntersection intersectBoundedCylinder(in Ray ray, in float radius, in vec2 minMaxHeight)
|
|
{
|
|
RayShapeIntersection cylinderIntersection = intersectCylinder(ray, radius, true);
|
|
RayShapeIntersection heightBoundsIntersection = intersectHeightBounds(ray, minMaxHeight, true);
|
|
return intersectIntersections(ray, cylinderIntersection, heightBoundsIntersection);
|
|
}
|
|
|
|
void intersectShape(Ray ray, inout Intersections ix)
|
|
{
|
|
// Position is converted from [0,1] to [-1,+1] because shape intersections assume unit space is [-1,+1].
|
|
// Direction is scaled as well to be in sync with position.
|
|
ray.pos = ray.pos * 2.0 - 1.0;
|
|
ray.dir *= 2.0;
|
|
|
|
RayShapeIntersection outerIntersect = intersectBoundedCylinder(ray, u_cylinderRenderRadiusMinMax.y, u_cylinderRenderHeightMinMax);
|
|
|
|
setShapeIntersection(ix, CYLINDER_INTERSECTION_INDEX_RADIUS_MAX, outerIntersect);
|
|
|
|
if (outerIntersect.entry.w == NO_HIT) {
|
|
return;
|
|
}
|
|
|
|
#if defined(CYLINDER_HAS_RENDER_BOUNDS_RADIUS_FLAT)
|
|
// When the cylinder is perfectly thin it's necessary to sandwich the
|
|
// inner cylinder intersection inside the outer cylinder intersection.
|
|
|
|
// Without this special case,
|
|
// [outerMin, outerMax, innerMin, innerMax] will bubble sort to
|
|
// [outerMin, innerMin, outerMax, innerMax] which will cause the back
|
|
// side of the cylinder to be invisible because it will think the ray
|
|
// is still inside the inner (negative) cylinder after exiting the
|
|
// outer (positive) cylinder.
|
|
|
|
// With this special case,
|
|
// [outerMin, innerMin, innerMax, outerMax] will bubble sort to
|
|
// [outerMin, innerMin, innerMax, outerMax] which will work correctly.
|
|
|
|
// Note: If initializeIntersections() changes its sorting function
|
|
// from bubble sort to something else, this code may need to change.
|
|
RayShapeIntersection innerIntersect = intersectCylinder(ray, 1.0, false);
|
|
setSurfaceIntersection(ix, 0, outerIntersect.entry, true, true); // positive, enter
|
|
setSurfaceIntersection(ix, 1, innerIntersect.entry, false, true); // negative, enter
|
|
setSurfaceIntersection(ix, 2, innerIntersect.exit, false, false); // negative, exit
|
|
setSurfaceIntersection(ix, 3, outerIntersect.exit, true, false); // positive, exit
|
|
#elif defined(CYLINDER_HAS_RENDER_BOUNDS_RADIUS_MIN)
|
|
RayShapeIntersection innerIntersect = intersectCylinder(ray, u_cylinderRenderRadiusMinMax.x, false);
|
|
setShapeIntersection(ix, CYLINDER_INTERSECTION_INDEX_RADIUS_MIN, innerIntersect);
|
|
#endif
|
|
|
|
#if defined(CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_UNDER_HALF)
|
|
RayShapeIntersection wedgeIntersect = intersectRegularWedge(ray, u_cylinderRenderAngleMinMax);
|
|
setShapeIntersection(ix, CYLINDER_INTERSECTION_INDEX_ANGLE, wedgeIntersect);
|
|
#elif defined(CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_OVER_HALF)
|
|
RayShapeIntersection wedgeIntersects[2];
|
|
intersectFlippedWedge(ray, u_cylinderRenderAngleMinMax, wedgeIntersects);
|
|
setShapeIntersection(ix, CYLINDER_INTERSECTION_INDEX_ANGLE + 0, wedgeIntersects[0]);
|
|
setShapeIntersection(ix, CYLINDER_INTERSECTION_INDEX_ANGLE + 1, wedgeIntersects[1]);
|
|
#elif defined(CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_EQUAL_ZERO)
|
|
RayShapeIntersection wedgeIntersects[2];
|
|
intersectHalfPlane(ray, u_cylinderRenderAngleMinMax.x, wedgeIntersects);
|
|
setShapeIntersection(ix, CYLINDER_INTERSECTION_INDEX_ANGLE + 0, wedgeIntersects[0]);
|
|
setShapeIntersection(ix, CYLINDER_INTERSECTION_INDEX_ANGLE + 1, wedgeIntersects[1]);
|
|
#endif
|
|
}
|
|
`,A4e=`// See IntersectionUtils.glsl for the definitions of Ray, NO_HIT, INF_HIT, Intersections,
|
|
// RayShapeIntersection, setSurfaceIntersection, setShapeIntersection
|
|
// See IntersectLongitude.glsl for the definitions of intersectHalfPlane,
|
|
// intersectFlippedWedge, intersectRegularWedge
|
|
|
|
/* Ellipsoid defines (set in Scene/VoxelEllipsoidShape.js)
|
|
#define ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE
|
|
#define ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_EQUAL_ZERO
|
|
#define ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_UNDER_HALF
|
|
#define ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_OVER_HALF
|
|
#define ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_UNDER_HALF
|
|
#define ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_EQUAL_HALF
|
|
#define ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_OVER_HALF
|
|
#define ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_UNDER_HALF
|
|
#define ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_EQUAL_HALF
|
|
#define ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_OVER_HALF
|
|
#define ELLIPSOID_INTERSECTION_INDEX_LONGITUDE
|
|
#define ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MAX
|
|
#define ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MIN
|
|
#define ELLIPSOID_INTERSECTION_INDEX_HEIGHT_MAX
|
|
#define ELLIPSOID_INTERSECTION_INDEX_HEIGHT_MIN
|
|
*/
|
|
|
|
#if defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE)
|
|
uniform vec2 u_ellipsoidRenderLongitudeMinMax;
|
|
#endif
|
|
uniform float u_eccentricitySquared;
|
|
uniform vec2 u_ellipsoidRenderLatitudeSinMinMax;
|
|
uniform vec2 u_clipMinMaxHeight;
|
|
|
|
RayShapeIntersection intersectZPlane(in Ray ray, in float z) {
|
|
float t = -ray.pos.z / ray.dir.z;
|
|
|
|
bool startsOutside = sign(ray.pos.z) == sign(z);
|
|
bool entry = (t >= 0.0) != startsOutside;
|
|
|
|
vec4 intersect = vec4(0.0, 0.0, z, t);
|
|
vec4 farSide = vec4(normalize(ray.dir), INF_HIT);
|
|
|
|
if (entry) {
|
|
return RayShapeIntersection(intersect, farSide);
|
|
} else {
|
|
return RayShapeIntersection(-1.0 * farSide, intersect);
|
|
}
|
|
}
|
|
|
|
RayShapeIntersection intersectHeight(in Ray ray, in float relativeHeight, in bool convex)
|
|
{
|
|
// Scale the ray by the ellipsoid axes to make it a unit sphere
|
|
// Note: approximating ellipsoid + height as an ellipsoid
|
|
vec3 radiiCorrection = u_ellipsoidRadiiUv / (u_ellipsoidRadiiUv + relativeHeight);
|
|
vec3 position = ray.pos * radiiCorrection;
|
|
vec3 direction = ray.dir * radiiCorrection;
|
|
|
|
float a = dot(direction, direction); // ~ 1.0 (or maybe 4.0 if ray is scaled)
|
|
float b = dot(direction, position); // roughly inside [-1.0, 1.0] when zoomed in
|
|
float c = dot(position, position) - 1.0; // ~ 0.0 when zoomed in.
|
|
float determinant = b * b - a * c; // ~ b * b when zoomed in
|
|
|
|
if (determinant < 0.0) {
|
|
vec4 miss = vec4(normalize(direction), NO_HIT);
|
|
return RayShapeIntersection(miss, miss);
|
|
}
|
|
|
|
determinant = sqrt(determinant);
|
|
|
|
// Compute larger root using standard formula
|
|
float signB = b < 0.0 ? -1.0 : 1.0;
|
|
// The other root may suffer from subtractive cancellation in the standard formula.
|
|
// Compute it from the first root instead.
|
|
float t1 = (-b - signB * determinant) / a;
|
|
float t2 = c / (a * t1);
|
|
float tmin = min(t1, t2);
|
|
float tmax = max(t1, t2);
|
|
|
|
float directionScale = convex ? 1.0 : -1.0;
|
|
vec3 d1 = directionScale * normalize(position + tmin * direction);
|
|
vec3 d2 = directionScale * normalize(position + tmax * direction);
|
|
|
|
return RayShapeIntersection(vec4(d1, tmin), vec4(d2, tmax));
|
|
}
|
|
|
|
/**
|
|
* Given a circular cone around the z-axis, with apex at the origin,
|
|
* find the parametric distance(s) along a ray where that ray intersects
|
|
* the cone.
|
|
* The cone opening angle is described by the squared cosine of
|
|
* its half-angle (the angle between the Z-axis and the surface)
|
|
*/
|
|
vec2 intersectDoubleEndedCone(in Ray ray, in float cosSqrHalfAngle)
|
|
{
|
|
vec3 o = ray.pos;
|
|
vec3 d = ray.dir;
|
|
float sinSqrHalfAngle = 1.0 - cosSqrHalfAngle;
|
|
|
|
float aSin = d.z * d.z * sinSqrHalfAngle;
|
|
float aCos = -dot(d.xy, d.xy) * cosSqrHalfAngle;
|
|
float a = aSin + aCos;
|
|
|
|
float bSin = d.z * o.z * sinSqrHalfAngle;
|
|
float bCos = -dot(o.xy, d.xy) * cosSqrHalfAngle;
|
|
float b = bSin + bCos;
|
|
|
|
float cSin = o.z * o.z * sinSqrHalfAngle;
|
|
float cCos = -dot(o.xy, o.xy) * cosSqrHalfAngle;
|
|
float c = cSin + cCos;
|
|
// determinant = b * b - a * c. But bSin * bSin = aSin * cSin.
|
|
// Avoid subtractive cancellation by expanding to eliminate these terms
|
|
float determinant = 2.0 * bSin * bCos + bCos * bCos - aSin * cCos - aCos * cSin - aCos * cCos;
|
|
|
|
if (determinant < 0.0) {
|
|
return vec2(NO_HIT);
|
|
} else if (a == 0.0) {
|
|
// Ray is parallel to cone surface
|
|
return (b == 0.0)
|
|
? vec2(NO_HIT) // Ray is on cone surface
|
|
: vec2(-0.5 * c / b, NO_HIT);
|
|
}
|
|
|
|
determinant = sqrt(determinant);
|
|
|
|
// Compute larger root using standard formula
|
|
float signB = b < 0.0 ? -1.0 : 1.0;
|
|
float t1 = (-b - signB * determinant) / a;
|
|
// The other root may suffer from subtractive cancellation in the standard formula.
|
|
// Compute it from the first root instead.
|
|
float t2 = c / (a * t1);
|
|
float tmin = min(t1, t2);
|
|
float tmax = max(t1, t2);
|
|
return vec2(tmin, tmax);
|
|
}
|
|
|
|
/**
|
|
* Given a point on a conical surface, find the surface normal at that point.
|
|
*/
|
|
vec3 getConeNormal(in vec3 p, in bool convex) {
|
|
// Start with radial component pointing toward z-axis
|
|
vec2 radial = -abs(p.z) * normalize(p.xy);
|
|
// Z component points toward opening of cone
|
|
float zSign = (p.z < 0.0) ? -1.0 : 1.0;
|
|
float z = length(p.xy) * zSign;
|
|
// Flip normal if shape is convex
|
|
float flip = (convex) ? -1.0 : 1.0;
|
|
return normalize(vec3(radial, z) * flip);
|
|
}
|
|
|
|
/**
|
|
* Compute the shift between the ellipsoid origin and the apex of a cone of latitude
|
|
*/
|
|
float getLatitudeConeShift(in float sinLatitude) {
|
|
// Find prime vertical radius of curvature:
|
|
// the distance along the ellipsoid normal to the intersection with the z-axis
|
|
float x2 = u_eccentricitySquared * sinLatitude * sinLatitude;
|
|
float primeVerticalRadius = inversesqrt(1.0 - x2);
|
|
|
|
// Compute a shift from the origin to the intersection of the cone with the z-axis
|
|
return primeVerticalRadius * u_eccentricitySquared * sinLatitude;
|
|
}
|
|
|
|
void intersectFlippedCone(in Ray ray, in float cosHalfAngle, out RayShapeIntersection intersections[2]) {
|
|
// Undo the scaling from ellipsoid to sphere
|
|
ray.pos = ray.pos * u_ellipsoidRadiiUv;
|
|
ray.dir = ray.dir * u_ellipsoidRadiiUv;
|
|
// Shift the ray to account for the latitude cone not being centered at the Earth center
|
|
ray.pos.z += getLatitudeConeShift(cosHalfAngle);
|
|
|
|
float cosSqrHalfAngle = cosHalfAngle * cosHalfAngle;
|
|
vec2 intersect = intersectDoubleEndedCone(ray, cosSqrHalfAngle);
|
|
|
|
vec4 miss = vec4(normalize(ray.dir), NO_HIT);
|
|
vec4 farSide = vec4(normalize(ray.dir), INF_HIT);
|
|
|
|
// Initialize output with no intersections
|
|
intersections[0].entry = -1.0 * farSide;
|
|
intersections[0].exit = farSide;
|
|
intersections[1].entry = miss;
|
|
intersections[1].exit = miss;
|
|
|
|
if (intersect.x == NO_HIT) {
|
|
return;
|
|
}
|
|
|
|
// Find the points of intersection
|
|
float tmin = intersect.x;
|
|
float tmax = intersect.y;
|
|
vec3 p0 = ray.pos + tmin * ray.dir;
|
|
vec3 p1 = ray.pos + tmax * ray.dir;
|
|
|
|
vec4 intersect0 = vec4(getConeNormal(p0, true), tmin);
|
|
vec4 intersect1 = vec4(getConeNormal(p1, true), tmax);
|
|
|
|
bool p0InShadowCone = sign(p0.z) != sign(cosHalfAngle);
|
|
bool p1InShadowCone = sign(p1.z) != sign(cosHalfAngle);
|
|
|
|
if (p0InShadowCone && p1InShadowCone) {
|
|
// no valid intersections
|
|
} else if (p0InShadowCone) {
|
|
intersections[0].exit = intersect1;
|
|
} else if (p1InShadowCone) {
|
|
intersections[0].entry = intersect0;
|
|
} else {
|
|
intersections[0].exit = intersect0;
|
|
intersections[1].entry = intersect1;
|
|
intersections[1].exit = farSide;
|
|
}
|
|
}
|
|
|
|
RayShapeIntersection intersectRegularCone(in Ray ray, in float cosHalfAngle, in bool convex) {
|
|
// Undo the scaling from ellipsoid to sphere
|
|
ray.pos = ray.pos * u_ellipsoidRadiiUv;
|
|
ray.dir = ray.dir * u_ellipsoidRadiiUv;
|
|
// Shift the ray to account for the latitude cone not being centered at the Earth center
|
|
ray.pos.z += getLatitudeConeShift(cosHalfAngle);
|
|
|
|
float cosSqrHalfAngle = cosHalfAngle * cosHalfAngle;
|
|
vec2 intersect = intersectDoubleEndedCone(ray, cosSqrHalfAngle);
|
|
|
|
vec4 miss = vec4(normalize(ray.dir), NO_HIT);
|
|
vec4 farSide = vec4(normalize(ray.dir), INF_HIT);
|
|
|
|
if (intersect.x == NO_HIT) {
|
|
return RayShapeIntersection(miss, miss);
|
|
}
|
|
|
|
// Find the points of intersection
|
|
float tmin = intersect.x;
|
|
float tmax = intersect.y;
|
|
vec3 p0 = ray.pos + tmin * ray.dir;
|
|
vec3 p1 = ray.pos + tmax * ray.dir;
|
|
|
|
vec4 intersect0 = vec4(getConeNormal(p0, convex), tmin);
|
|
vec4 intersect1 = vec4(getConeNormal(p1, convex), tmax);
|
|
|
|
bool p0InShadowCone = sign(p0.z) != sign(cosHalfAngle);
|
|
bool p1InShadowCone = sign(p1.z) != sign(cosHalfAngle);
|
|
|
|
if (p0InShadowCone && p1InShadowCone) {
|
|
return RayShapeIntersection(miss, miss);
|
|
} else if (p0InShadowCone) {
|
|
return RayShapeIntersection(intersect1, farSide);
|
|
} else if (p1InShadowCone) {
|
|
return RayShapeIntersection(-1.0 * farSide, intersect0);
|
|
} else {
|
|
return RayShapeIntersection(intersect0, intersect1);
|
|
}
|
|
}
|
|
|
|
void intersectShape(in Ray ray, inout Intersections ix) {
|
|
// Position is converted from [0,1] to [-1,+1] because shape intersections assume unit space is [-1,+1].
|
|
// Direction is scaled as well to be in sync with position.
|
|
ray.pos = ray.pos * 2.0 - 1.0;
|
|
ray.dir *= 2.0;
|
|
|
|
// Outer ellipsoid
|
|
RayShapeIntersection outerIntersect = intersectHeight(ray, u_clipMinMaxHeight.y, true);
|
|
setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_HEIGHT_MAX, outerIntersect);
|
|
|
|
// Exit early if the outer ellipsoid was missed.
|
|
if (outerIntersect.entry.w == NO_HIT) {
|
|
return;
|
|
}
|
|
|
|
// Inner ellipsoid
|
|
RayShapeIntersection innerIntersect = intersectHeight(ray, u_clipMinMaxHeight.x, false);
|
|
|
|
if (innerIntersect.entry.w == NO_HIT) {
|
|
setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_HEIGHT_MIN, innerIntersect);
|
|
} else {
|
|
// When the ellipsoid is large and thin it's possible for floating point math
|
|
// to cause the ray to intersect the inner ellipsoid before the outer ellipsoid.
|
|
// To prevent this from happening, clamp innerIntersect to outerIntersect and
|
|
// sandwich the inner ellipsoid intersection inside the outer ellipsoid intersection.
|
|
|
|
// Without this special case,
|
|
// [outerMin, outerMax, innerMin, innerMax] will bubble sort to
|
|
// [outerMin, innerMin, outerMax, innerMax] which will cause the back
|
|
// side of the ellipsoid to be invisible because it will think the ray
|
|
// is still inside the inner (negative) ellipsoid after exiting the
|
|
// outer (positive) ellipsoid.
|
|
|
|
// With this special case,
|
|
// [outerMin, innerMin, innerMax, outerMax] will bubble sort to
|
|
// [outerMin, innerMin, innerMax, outerMax] which will work correctly.
|
|
|
|
// Note: If initializeIntersections() changes its sorting function
|
|
// from bubble sort to something else, this code may need to change.
|
|
innerIntersect.entry.w = max(innerIntersect.entry.w, outerIntersect.entry.w);
|
|
innerIntersect.exit.w = min(innerIntersect.exit.w, outerIntersect.exit.w);
|
|
setSurfaceIntersection(ix, 0, outerIntersect.entry, true, true); // positive, enter
|
|
setSurfaceIntersection(ix, 1, innerIntersect.entry, false, true); // negative, enter
|
|
setSurfaceIntersection(ix, 2, innerIntersect.exit, false, false); // negative, exit
|
|
setSurfaceIntersection(ix, 3, outerIntersect.exit, true, false); // positive, exit
|
|
}
|
|
|
|
// Bottom cone
|
|
#if defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_UNDER_HALF)
|
|
RayShapeIntersection bottomConeIntersection = intersectRegularCone(ray, u_ellipsoidRenderLatitudeSinMinMax.x, false);
|
|
setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MIN, bottomConeIntersection);
|
|
#elif defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_EQUAL_HALF)
|
|
RayShapeIntersection bottomConeIntersection = intersectZPlane(ray, -1.0);
|
|
setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MIN, bottomConeIntersection);
|
|
#elif defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_OVER_HALF)
|
|
RayShapeIntersection bottomConeIntersections[2];
|
|
intersectFlippedCone(ray, u_ellipsoidRenderLatitudeSinMinMax.x, bottomConeIntersections);
|
|
setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MIN + 0, bottomConeIntersections[0]);
|
|
setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MIN + 1, bottomConeIntersections[1]);
|
|
#endif
|
|
|
|
// Top cone
|
|
#if defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_UNDER_HALF)
|
|
RayShapeIntersection topConeIntersections[2];
|
|
intersectFlippedCone(ray, u_ellipsoidRenderLatitudeSinMinMax.y, topConeIntersections);
|
|
setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MAX + 0, topConeIntersections[0]);
|
|
setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MAX + 1, topConeIntersections[1]);
|
|
#elif defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_EQUAL_HALF)
|
|
RayShapeIntersection topConeIntersection = intersectZPlane(ray, 1.0);
|
|
setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MAX, topConeIntersection);
|
|
#elif defined(ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_OVER_HALF)
|
|
RayShapeIntersection topConeIntersection = intersectRegularCone(ray, u_ellipsoidRenderLatitudeSinMinMax.y, false);
|
|
setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MAX, topConeIntersection);
|
|
#endif
|
|
|
|
// Wedge
|
|
#if defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_EQUAL_ZERO)
|
|
RayShapeIntersection wedgeIntersects[2];
|
|
intersectHalfPlane(ray, u_ellipsoidRenderLongitudeMinMax.x, wedgeIntersects);
|
|
setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LONGITUDE + 0, wedgeIntersects[0]);
|
|
setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LONGITUDE + 1, wedgeIntersects[1]);
|
|
#elif defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_UNDER_HALF)
|
|
RayShapeIntersection wedgeIntersect = intersectRegularWedge(ray, u_ellipsoidRenderLongitudeMinMax);
|
|
setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LONGITUDE, wedgeIntersect);
|
|
#elif defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_OVER_HALF)
|
|
RayShapeIntersection wedgeIntersects[2];
|
|
intersectFlippedWedge(ray, u_ellipsoidRenderLongitudeMinMax, wedgeIntersects);
|
|
setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LONGITUDE + 0, wedgeIntersects[0]);
|
|
setShapeIntersection(ix, ELLIPSOID_INTERSECTION_INDEX_LONGITUDE + 1, wedgeIntersects[1]);
|
|
#endif
|
|
}
|
|
`,Gv=`// Main intersection function for Voxel scenes.
|
|
// See IntersectBox.glsl, IntersectCylinder.glsl, or IntersectEllipsoid.glsl
|
|
// for the definition of intersectShape. The appropriate function is selected
|
|
// based on the VoxelPrimitive shape type, and added to the shader in
|
|
// Scene/VoxelRenderResources.js.
|
|
// See also IntersectClippingPlane.glsl and IntersectDepth.glsl.
|
|
// See IntersectionUtils.glsl for the definitions of Ray, NO_HIT,
|
|
// getFirstIntersection, initializeIntersections, nextIntersection.
|
|
|
|
/* Intersection defines (set in Scene/VoxelRenderResources.js)
|
|
#define INTERSECTION_COUNT ###
|
|
*/
|
|
|
|
RayShapeIntersection intersectScene(in vec2 screenCoord, in Ray ray, out Intersections ix) {
|
|
// Do a ray-shape intersection to find the exact starting and ending points.
|
|
intersectShape(ray, ix);
|
|
|
|
// Exit early if the positive shape was completely missed or behind the ray.
|
|
RayShapeIntersection intersection = getFirstIntersection(ix);
|
|
if (intersection.entry.w == NO_HIT) {
|
|
// Positive shape was completely missed - so exit early.
|
|
return intersection;
|
|
}
|
|
|
|
// Clipping planes
|
|
#if defined(CLIPPING_PLANES)
|
|
intersectClippingPlanes(ray, ix);
|
|
#endif
|
|
|
|
// Depth
|
|
#if defined(DEPTH_TEST)
|
|
intersectDepth(screenCoord, ray, ix);
|
|
#endif
|
|
|
|
// Find the first intersection that's in front of the ray
|
|
#if (INTERSECTION_COUNT > 1)
|
|
initializeIntersections(ix);
|
|
for (int i = 0; i < INTERSECTION_COUNT; ++i) {
|
|
intersection = nextIntersection(ix);
|
|
if (intersection.exit.w > 0.0) {
|
|
// Set start to 0.0 when ray is inside the shape.
|
|
intersection.entry.w = max(intersection.entry.w, 0.0);
|
|
break;
|
|
}
|
|
}
|
|
#else
|
|
// Set start to 0.0 when ray is inside the shape.
|
|
intersection.entry.w = max(intersection.entry.w, 0.0);
|
|
#endif
|
|
|
|
return intersection;
|
|
}
|
|
`,x4e=`/* Box defines (set in Scene/VoxelBoxShape.js)
|
|
#define BOX_HAS_SHAPE_BOUNDS
|
|
*/
|
|
|
|
#if defined(BOX_HAS_SHAPE_BOUNDS)
|
|
uniform vec3 u_boxUvToShapeUvScale;
|
|
uniform vec3 u_boxUvToShapeUvTranslate;
|
|
#endif
|
|
|
|
PointJacobianT convertUvToShapeSpaceDerivative(in vec3 positionUv) {
|
|
// For BOX, UV space = shape space, so we can use positionUv as-is,
|
|
// and the Jacobian is the identity matrix, except that a step of 1
|
|
// only spans half the shape space [-1, 1], so the identity is scaled.
|
|
return PointJacobianT(positionUv, mat3(0.5));
|
|
}
|
|
|
|
vec3 convertShapeToShapeUvSpace(in vec3 positionShape) {
|
|
#if defined(BOX_HAS_SHAPE_BOUNDS)
|
|
return positionShape * u_boxUvToShapeUvScale + u_boxUvToShapeUvTranslate;
|
|
#else
|
|
return positionShape;
|
|
#endif
|
|
}
|
|
|
|
PointJacobianT convertUvToShapeUvSpaceDerivative(in vec3 positionUv) {
|
|
PointJacobianT pointJacobian = convertUvToShapeSpaceDerivative(positionUv);
|
|
pointJacobian.point = convertShapeToShapeUvSpace(pointJacobian.point);
|
|
return pointJacobian;
|
|
}
|
|
|
|
vec3 convertShapeUvToUvSpace(in vec3 shapeUv) {
|
|
#if defined(BOX_HAS_SHAPE_BOUNDS)
|
|
return (shapeUv - u_boxUvToShapeUvTranslate) / u_boxUvToShapeUvScale;
|
|
#else
|
|
return shapeUv;
|
|
#endif
|
|
}
|
|
|
|
vec3 scaleShapeUvToShapeSpace(in vec3 shapeUv) {
|
|
#if defined(BOX_HAS_SHAPE_BOUNDS)
|
|
return shapeUv / u_boxUvToShapeUvScale;
|
|
#else
|
|
return shapeUv;
|
|
#endif
|
|
}`,C4e=`/* Cylinder defines (set in Scene/VoxelCylinderShape.js)
|
|
#define CYLINDER_HAS_SHAPE_BOUNDS_RADIUS
|
|
#define CYLINDER_HAS_SHAPE_BOUNDS_HEIGHT
|
|
#define CYLINDER_HAS_SHAPE_BOUNDS_ANGLE
|
|
#define CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_DISCONTINUITY
|
|
#define CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MAX_DISCONTINUITY
|
|
#define CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_MAX_REVERSED
|
|
*/
|
|
|
|
#if defined(CYLINDER_HAS_SHAPE_BOUNDS_RADIUS)
|
|
uniform vec2 u_cylinderUvToShapeUvRadius; // x = scale, y = offset
|
|
#endif
|
|
#if defined(CYLINDER_HAS_SHAPE_BOUNDS_HEIGHT)
|
|
uniform vec2 u_cylinderUvToShapeUvHeight; // x = scale, y = offset
|
|
#endif
|
|
#if defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE)
|
|
uniform vec2 u_cylinderUvToShapeUvAngle; // x = scale, y = offset
|
|
#endif
|
|
#if defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_DISCONTINUITY) || defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MAX_DISCONTINUITY)
|
|
uniform vec2 u_cylinderShapeUvAngleMinMax;
|
|
#endif
|
|
#if defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_DISCONTINUITY) || defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MAX_DISCONTINUITY) || defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_MAX_REVERSED)
|
|
uniform float u_cylinderShapeUvAngleRangeZeroMid;
|
|
#endif
|
|
|
|
PointJacobianT convertUvToShapeSpaceDerivative(in vec3 positionUv) {
|
|
// Convert from Cartesian UV space [0, 1] to Cartesian local space [-1, 1]
|
|
vec3 position = positionUv * 2.0 - 1.0;
|
|
|
|
float radius = length(position.xy); // [0, 1]
|
|
vec3 radial = normalize(vec3(position.xy, 0.0));
|
|
|
|
// Shape space height is defined within [0, 1]
|
|
float height = positionUv.z; // [0, 1]
|
|
vec3 z = vec3(0.0, 0.0, 1.0);
|
|
|
|
float angle = atan(position.y, position.x);
|
|
vec3 east = normalize(vec3(-position.y, position.x, 0.0));
|
|
|
|
vec3 point = vec3(radius, height, angle);
|
|
mat3 jacobianT = mat3(radial, z, east / length(position.xy));
|
|
return PointJacobianT(point, jacobianT);
|
|
}
|
|
|
|
vec3 convertShapeToShapeUvSpace(in vec3 positionShape) {
|
|
float radius = positionShape.x;
|
|
#if defined(CYLINDER_HAS_SHAPE_BOUNDS_RADIUS)
|
|
radius = radius * u_cylinderUvToShapeUvRadius.x + u_cylinderUvToShapeUvRadius.y;
|
|
#endif
|
|
|
|
float height = positionShape.y;
|
|
#if defined(CYLINDER_HAS_SHAPE_BOUNDS_HEIGHT)
|
|
height = height * u_cylinderUvToShapeUvHeight.x + u_cylinderUvToShapeUvHeight.y;
|
|
#endif
|
|
|
|
float angle = (positionShape.z + czm_pi) / czm_twoPi;
|
|
#if defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE)
|
|
#if defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_MAX_REVERSED)
|
|
// Comparing against u_cylinderShapeUvAngleMinMax has precision problems. u_cylinderShapeUvAngleRangeZeroMid is more conservative.
|
|
angle += float(angle < u_cylinderShapeUvAngleRangeZeroMid);
|
|
#endif
|
|
|
|
// Avoid flickering from reading voxels from both sides of the -pi/+pi discontinuity.
|
|
#if defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_DISCONTINUITY)
|
|
angle = angle > u_cylinderShapeUvAngleRangeZeroMid ? u_cylinderShapeUvAngleMinMax.x : angle;
|
|
#elif defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MAX_DISCONTINUITY)
|
|
angle = angle < u_cylinderShapeUvAngleRangeZeroMid ? u_cylinderShapeUvAngleMinMax.y : angle;
|
|
#endif
|
|
|
|
angle = angle * u_cylinderUvToShapeUvAngle.x + u_cylinderUvToShapeUvAngle.y;
|
|
#endif
|
|
|
|
return vec3(radius, height, angle);
|
|
}
|
|
|
|
PointJacobianT convertUvToShapeUvSpaceDerivative(in vec3 positionUv) {
|
|
PointJacobianT pointJacobian = convertUvToShapeSpaceDerivative(positionUv);
|
|
pointJacobian.point = convertShapeToShapeUvSpace(pointJacobian.point);
|
|
return pointJacobian;
|
|
}
|
|
|
|
vec3 scaleShapeUvToShapeSpace(in vec3 shapeUv) {
|
|
float radius = shapeUv.x;
|
|
#if defined(CYLINDER_HAS_SHAPE_BOUNDS_RADIUS)
|
|
radius /= u_cylinderUvToShapeUvRadius.x;
|
|
#endif
|
|
|
|
float height = shapeUv.y;
|
|
#if defined(CYLINDER_HAS_SHAPE_BOUNDS_HEIGHT)
|
|
height /= u_cylinderUvToShapeUvHeight.x;
|
|
#endif
|
|
|
|
float angle = shapeUv.z * czm_twoPi;
|
|
#if defined(CYLINDER_HAS_SHAPE_BOUNDS_ANGLE)
|
|
angle /= u_cylinderUvToShapeUvAngle.x;
|
|
#endif
|
|
|
|
return vec3(radius, height, angle);
|
|
}
|
|
`,E4e=`/* Ellipsoid defines (set in Scene/VoxelEllipsoidShape.js)
|
|
#define ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MIN_DISCONTINUITY
|
|
#define ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MAX_DISCONTINUITY
|
|
#define ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE
|
|
#define ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE_MIN_MAX_REVERSED
|
|
#define ELLIPSOID_HAS_SHAPE_BOUNDS_LATITUDE
|
|
*/
|
|
|
|
uniform vec3 u_ellipsoidRadiiUv; // [0,1]
|
|
uniform vec2 u_evoluteScale; // (radiiUv.x ^ 2 - radiiUv.z ^ 2) * vec2(1.0, -1.0) / radiiUv;
|
|
uniform vec3 u_ellipsoidInverseRadiiSquaredUv;
|
|
#if defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MIN_DISCONTINUITY) || defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MAX_DISCONTINUITY) || defined(ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE_MIN_MAX_REVERSED)
|
|
uniform vec3 u_ellipsoidShapeUvLongitudeMinMaxMid;
|
|
#endif
|
|
#if defined(ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE)
|
|
uniform vec2 u_ellipsoidUvToShapeUvLongitude; // x = scale, y = offset
|
|
#endif
|
|
#if defined(ELLIPSOID_HAS_SHAPE_BOUNDS_LATITUDE)
|
|
uniform vec2 u_ellipsoidUvToShapeUvLatitude; // x = scale, y = offset
|
|
#endif
|
|
uniform float u_ellipsoidInverseHeightDifferenceUv;
|
|
|
|
// robust iterative solution without trig functions
|
|
// https://github.com/0xfaded/ellipse_demo/issues/1
|
|
// https://stackoverflow.com/questions/22959698/distance-from-given-point-to-given-ellipse
|
|
// Extended to return radius of curvature along with the point
|
|
vec3 nearestPointAndRadiusOnEllipse(vec2 pos, vec2 radii) {
|
|
vec2 p = abs(pos);
|
|
vec2 inverseRadii = 1.0 / radii;
|
|
|
|
// We describe the ellipse parametrically: v = radii * vec2(cos(t), sin(t))
|
|
// but store the cos and sin of t in a vec2 for efficiency.
|
|
// Initial guess: t = pi/4
|
|
vec2 tTrigs = vec2(0.7071067811865476);
|
|
// Initial guess of point on ellipsoid
|
|
vec2 v = radii * tTrigs;
|
|
// Center of curvature of the ellipse at v
|
|
vec2 evolute = u_evoluteScale * tTrigs * tTrigs * tTrigs;
|
|
|
|
const int iterations = 3;
|
|
for (int i = 0; i < iterations; ++i) {
|
|
// Find the (approximate) intersection of p - evolute with the ellipsoid.
|
|
vec2 q = normalize(p - evolute) * length(v - evolute);
|
|
// Update the estimate of t.
|
|
tTrigs = (q + evolute) * inverseRadii;
|
|
tTrigs = normalize(clamp(tTrigs, 0.0, 1.0));
|
|
v = radii * tTrigs;
|
|
evolute = u_evoluteScale * tTrigs * tTrigs * tTrigs;
|
|
}
|
|
|
|
return vec3(v * sign(pos), length(v - evolute));
|
|
}
|
|
|
|
PointJacobianT convertUvToShapeSpaceDerivative(in vec3 positionUv) {
|
|
// Convert from UV space [0, 1] to local space [-1, 1]
|
|
vec3 position = positionUv * 2.0 - 1.0;
|
|
// Undo the scaling from ellipsoid to sphere
|
|
position = position * u_ellipsoidRadiiUv;
|
|
|
|
float longitude = atan(position.y, position.x);
|
|
vec3 east = normalize(vec3(-position.y, position.x, 0.0));
|
|
|
|
// Convert the 3D position to a 2D position relative to the ellipse (radii.x, radii.z)
|
|
// (assume radii.y == radii.x) and find the nearest point on the ellipse and its normal
|
|
float distanceFromZAxis = length(position.xy);
|
|
vec2 posEllipse = vec2(distanceFromZAxis, position.z);
|
|
vec3 surfacePointAndRadius = nearestPointAndRadiusOnEllipse(posEllipse, u_ellipsoidRadiiUv.xz);
|
|
vec2 surfacePoint = surfacePointAndRadius.xy;
|
|
|
|
vec2 normal2d = normalize(surfacePoint * u_ellipsoidInverseRadiiSquaredUv.xz);
|
|
float latitude = atan(normal2d.y, normal2d.x);
|
|
vec3 north = vec3(-normal2d.y * normalize(position.xy), abs(normal2d.x));
|
|
|
|
float heightSign = length(posEllipse) < length(surfacePoint) ? -1.0 : 1.0;
|
|
float height = heightSign * length(posEllipse - surfacePoint);
|
|
vec3 up = normalize(cross(east, north));
|
|
|
|
vec3 point = vec3(longitude, latitude, height);
|
|
mat3 jacobianT = mat3(east / distanceFromZAxis, north / (surfacePointAndRadius.z + height), up);
|
|
return PointJacobianT(point, jacobianT);
|
|
}
|
|
|
|
vec3 convertShapeToShapeUvSpace(in vec3 positionShape) {
|
|
// Longitude: shift & scale to [0, 1]
|
|
float longitude = (positionShape.x + czm_pi) / czm_twoPi;
|
|
|
|
// Correct the angle when max < min
|
|
// Technically this should compare against min longitude - but it has precision problems so compare against the middle of empty space.
|
|
#if defined(ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE_MIN_MAX_REVERSED)
|
|
longitude += float(longitude < u_ellipsoidShapeUvLongitudeMinMaxMid.z);
|
|
#endif
|
|
|
|
// Avoid flickering from reading voxels from both sides of the -pi/+pi discontinuity.
|
|
#if defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MIN_DISCONTINUITY)
|
|
longitude = longitude > u_ellipsoidShapeUvLongitudeMinMaxMid.z ? u_ellipsoidShapeUvLongitudeMinMaxMid.x : longitude;
|
|
#endif
|
|
#if defined(ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MAX_DISCONTINUITY)
|
|
longitude = longitude < u_ellipsoidShapeUvLongitudeMinMaxMid.z ? u_ellipsoidShapeUvLongitudeMinMaxMid.y : longitude;
|
|
#endif
|
|
|
|
#if defined(ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE)
|
|
longitude = longitude * u_ellipsoidUvToShapeUvLongitude.x + u_ellipsoidUvToShapeUvLongitude.y;
|
|
#endif
|
|
|
|
// Latitude: shift and scale to [0, 1]
|
|
float latitude = (positionShape.y + czm_piOverTwo) / czm_pi;
|
|
#if defined(ELLIPSOID_HAS_SHAPE_BOUNDS_LATITUDE)
|
|
latitude = latitude * u_ellipsoidUvToShapeUvLatitude.x + u_ellipsoidUvToShapeUvLatitude.y;
|
|
#endif
|
|
|
|
// Height: scale to the range [0, 1]
|
|
float height = 1.0 + positionShape.z * u_ellipsoidInverseHeightDifferenceUv;
|
|
|
|
return vec3(longitude, latitude, height);
|
|
}
|
|
|
|
PointJacobianT convertUvToShapeUvSpaceDerivative(in vec3 positionUv) {
|
|
PointJacobianT pointJacobian = convertUvToShapeSpaceDerivative(positionUv);
|
|
pointJacobian.point = convertShapeToShapeUvSpace(pointJacobian.point);
|
|
return pointJacobian;
|
|
}
|
|
|
|
vec3 scaleShapeUvToShapeSpace(in vec3 shapeUv) {
|
|
// Convert from [0, 1] to radians [-pi, pi]
|
|
float longitude = shapeUv.x * czm_twoPi;
|
|
#if defined (ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE)
|
|
longitude /= u_ellipsoidUvToShapeUvLongitude.x;
|
|
#endif
|
|
|
|
// Convert from [0, 1] to radians [-pi/2, pi/2]
|
|
float latitude = shapeUv.y * czm_pi;
|
|
#if defined(ELLIPSOID_HAS_SHAPE_BOUNDS_LATITUDE)
|
|
latitude /= u_ellipsoidUvToShapeUvLatitude.x;
|
|
#endif
|
|
|
|
float height = shapeUv.z / u_ellipsoidInverseHeightDifferenceUv;
|
|
|
|
return vec3(longitude, latitude, height);
|
|
}
|
|
`,w4e=`// These octree flags must be in sync with GpuOctreeFlag in VoxelTraversal.js
|
|
#define OCTREE_FLAG_INTERNAL 0
|
|
#define OCTREE_FLAG_LEAF 1
|
|
#define OCTREE_FLAG_PACKED_LEAF_FROM_PARENT 2
|
|
|
|
#define OCTREE_MAX_LEVELS 32 // Harcoded value because GLSL doesn't like variable length loops
|
|
|
|
uniform sampler2D u_octreeInternalNodeTexture;
|
|
uniform vec2 u_octreeInternalNodeTexelSizeUv;
|
|
uniform int u_octreeInternalNodeTilesPerRow;
|
|
#if (SAMPLE_COUNT > 1)
|
|
uniform sampler2D u_octreeLeafNodeTexture;
|
|
uniform vec2 u_octreeLeafNodeTexelSizeUv;
|
|
uniform int u_octreeLeafNodeTilesPerRow;
|
|
#endif
|
|
|
|
struct OctreeNodeData {
|
|
int data;
|
|
int flag;
|
|
};
|
|
|
|
struct TraversalData {
|
|
ivec4 octreeCoords;
|
|
int parentOctreeIndex;
|
|
};
|
|
|
|
struct SampleData {
|
|
int megatextureIndex;
|
|
ivec4 tileCoords;
|
|
vec3 tileUv;
|
|
#if (SAMPLE_COUNT > 1)
|
|
float weight;
|
|
#endif
|
|
};
|
|
|
|
// Integer mod: For WebGL1 only
|
|
int intMod(in int a, in int b) {
|
|
return a - (b * (a / b));
|
|
}
|
|
int normU8_toInt(in float value) {
|
|
return int(value * 255.0);
|
|
}
|
|
int normU8x2_toInt(in vec2 value) {
|
|
return int(value.x * 255.0) + 256 * int(value.y * 255.0);
|
|
}
|
|
float normU8x2_toFloat(in vec2 value) {
|
|
return float(normU8x2_toInt(value)) / 65535.0;
|
|
}
|
|
|
|
OctreeNodeData getOctreeNodeData(in vec2 octreeUv) {
|
|
vec4 texData = texture(u_octreeInternalNodeTexture, octreeUv);
|
|
|
|
OctreeNodeData data;
|
|
data.data = normU8x2_toInt(texData.xy);
|
|
data.flag = normU8x2_toInt(texData.zw);
|
|
return data;
|
|
}
|
|
|
|
OctreeNodeData getOctreeChildData(in int parentOctreeIndex, in ivec3 childCoord) {
|
|
int childIndex = childCoord.z * 4 + childCoord.y * 2 + childCoord.x;
|
|
int octreeCoordX = intMod(parentOctreeIndex, u_octreeInternalNodeTilesPerRow) * 9 + 1 + childIndex;
|
|
int octreeCoordY = parentOctreeIndex / u_octreeInternalNodeTilesPerRow;
|
|
vec2 octreeUv = u_octreeInternalNodeTexelSizeUv * vec2(float(octreeCoordX) + 0.5, float(octreeCoordY) + 0.5);
|
|
return getOctreeNodeData(octreeUv);
|
|
}
|
|
|
|
int getOctreeParentIndex(in int octreeIndex) {
|
|
int octreeCoordX = intMod(octreeIndex, u_octreeInternalNodeTilesPerRow) * 9;
|
|
int octreeCoordY = octreeIndex / u_octreeInternalNodeTilesPerRow;
|
|
vec2 octreeUv = u_octreeInternalNodeTexelSizeUv * vec2(float(octreeCoordX) + 0.5, float(octreeCoordY) + 0.5);
|
|
vec4 parentData = texture(u_octreeInternalNodeTexture, octreeUv);
|
|
int parentOctreeIndex = normU8x2_toInt(parentData.xy);
|
|
return parentOctreeIndex;
|
|
}
|
|
|
|
/**
|
|
* Convert a position in the uv-space of the tileset bounding shape
|
|
* into the uv-space of a tile within the tileset
|
|
*/
|
|
vec3 getTileUv(in vec3 shapePosition, in ivec4 octreeCoords) {
|
|
// PERFORMANCE_IDEA: use bit-shifting (only in WebGL2)
|
|
float dimAtLevel = exp2(float(octreeCoords.w));
|
|
return shapePosition * dimAtLevel - vec3(octreeCoords.xyz);
|
|
}
|
|
|
|
vec3 getClampedTileUv(in vec3 shapePosition, in ivec4 octreeCoords) {
|
|
vec3 tileUv = getTileUv(shapePosition, octreeCoords);
|
|
return clamp(tileUv, vec3(0.0), vec3(1.0));
|
|
}
|
|
|
|
void getOctreeLeafSampleData(in OctreeNodeData data, in ivec4 octreeCoords, out SampleData sampleData) {
|
|
sampleData.megatextureIndex = data.data;
|
|
sampleData.tileCoords = (data.flag == OCTREE_FLAG_PACKED_LEAF_FROM_PARENT)
|
|
? ivec4(octreeCoords.xyz / 2, octreeCoords.w - 1)
|
|
: octreeCoords;
|
|
}
|
|
|
|
#if (SAMPLE_COUNT > 1)
|
|
void getOctreeLeafSampleDatas(in OctreeNodeData data, in ivec4 octreeCoords, out SampleData sampleDatas[SAMPLE_COUNT]) {
|
|
int leafIndex = data.data;
|
|
int leafNodeTexelCount = 2;
|
|
// Adding 0.5 moves to the center of the texel
|
|
float leafCoordXStart = float(intMod(leafIndex, u_octreeLeafNodeTilesPerRow) * leafNodeTexelCount) + 0.5;
|
|
float leafCoordY = float(leafIndex / u_octreeLeafNodeTilesPerRow) + 0.5;
|
|
|
|
// Get an interpolation weight and a flag to determine whether to read the parent texture
|
|
vec2 leafUv0 = u_octreeLeafNodeTexelSizeUv * vec2(leafCoordXStart + 0.0, leafCoordY);
|
|
vec4 leafData0 = texture(u_octreeLeafNodeTexture, leafUv0);
|
|
float lerp = normU8x2_toFloat(leafData0.xy);
|
|
sampleDatas[0].weight = 1.0 - lerp;
|
|
sampleDatas[1].weight = lerp;
|
|
// TODO: this looks wrong? Should be comparing to OCTREE_FLAG_PACKED_LEAF_FROM_PARENT
|
|
sampleDatas[0].tileCoords = (normU8_toInt(leafData0.z) == 1)
|
|
? ivec4(octreeCoords.xyz / 2, octreeCoords.w - 1)
|
|
: octreeCoords;
|
|
sampleDatas[1].tileCoords = (normU8_toInt(leafData0.w) == 1)
|
|
? ivec4(octreeCoords.xyz / 2, octreeCoords.w - 1)
|
|
: octreeCoords;
|
|
|
|
// Get megatexture indices for both samples
|
|
vec2 leafUv1 = u_octreeLeafNodeTexelSizeUv * vec2(leafCoordXStart + 1.0, leafCoordY);
|
|
vec4 leafData1 = texture(u_octreeLeafNodeTexture, leafUv1);
|
|
sampleDatas[0].megatextureIndex = normU8x2_toInt(leafData1.xy);
|
|
sampleDatas[1].megatextureIndex = normU8x2_toInt(leafData1.zw);
|
|
}
|
|
#endif
|
|
|
|
OctreeNodeData traverseOctreeDownwards(in vec3 shapePosition, inout TraversalData traversalData) {
|
|
float sizeAtLevel = exp2(-1.0 * float(traversalData.octreeCoords.w));
|
|
vec3 start = vec3(traversalData.octreeCoords.xyz) * sizeAtLevel;
|
|
vec3 end = start + vec3(sizeAtLevel);
|
|
OctreeNodeData childData;
|
|
|
|
for (int i = 0; i < OCTREE_MAX_LEVELS; ++i) {
|
|
// Find out which octree child contains the position
|
|
// 0 if before center, 1 if after
|
|
vec3 center = 0.5 * (start + end);
|
|
vec3 childCoord = step(center, shapePosition);
|
|
|
|
// Get octree coords for the next level down
|
|
ivec4 octreeCoords = traversalData.octreeCoords;
|
|
traversalData.octreeCoords = ivec4(octreeCoords.xyz * 2 + ivec3(childCoord), octreeCoords.w + 1);
|
|
|
|
childData = getOctreeChildData(traversalData.parentOctreeIndex, ivec3(childCoord));
|
|
|
|
if (childData.flag != OCTREE_FLAG_INTERNAL) {
|
|
// leaf tile - stop traversing
|
|
break;
|
|
}
|
|
|
|
// interior tile - keep going deeper
|
|
start = mix(start, center, childCoord);
|
|
end = mix(center, end, childCoord);
|
|
traversalData.parentOctreeIndex = childData.data;
|
|
}
|
|
|
|
return childData;
|
|
}
|
|
|
|
/**
|
|
* Transform a given position to an octree tile coordinate and a position within that tile,
|
|
* and find the corresponding megatexture index and texture coordinates
|
|
*/
|
|
void traverseOctreeFromBeginning(in vec3 shapePosition, out TraversalData traversalData, out SampleData sampleDatas[SAMPLE_COUNT]) {
|
|
traversalData.octreeCoords = ivec4(0);
|
|
traversalData.parentOctreeIndex = 0;
|
|
|
|
OctreeNodeData nodeData = getOctreeNodeData(vec2(0.0));
|
|
if (nodeData.flag != OCTREE_FLAG_LEAF) {
|
|
nodeData = traverseOctreeDownwards(shapePosition, traversalData);
|
|
}
|
|
|
|
#if (SAMPLE_COUNT == 1)
|
|
getOctreeLeafSampleData(nodeData, traversalData.octreeCoords, sampleDatas[0]);
|
|
sampleDatas[0].tileUv = getClampedTileUv(shapePosition, sampleDatas[0].tileCoords);
|
|
#else
|
|
getOctreeLeafSampleDatas(nodeData, traversalData.octreeCoords, sampleDatas);
|
|
sampleDatas[0].tileUv = getClampedTileUv(shapePosition, sampleDatas[0].tileCoords);
|
|
sampleDatas[1].tileUv = getClampedTileUv(shapePosition, sampleDatas[1].tileCoords);
|
|
#endif
|
|
}
|
|
|
|
bool inRange(in vec3 v, in vec3 minVal, in vec3 maxVal) {
|
|
return clamp(v, minVal, maxVal) == v;
|
|
}
|
|
|
|
bool insideTile(in vec3 shapePosition, in ivec4 octreeCoords) {
|
|
vec3 tileUv = getTileUv(shapePosition, octreeCoords);
|
|
bool inside = inRange(tileUv, vec3(0.0), vec3(1.0));
|
|
// Assume (!) the position is always inside the root tile.
|
|
return inside || octreeCoords.w == 0;
|
|
}
|
|
|
|
void traverseOctreeFromExisting(in vec3 shapePosition, inout TraversalData traversalData, inout SampleData sampleDatas[SAMPLE_COUNT]) {
|
|
if (insideTile(shapePosition, traversalData.octreeCoords)) {
|
|
for (int i = 0; i < SAMPLE_COUNT; i++) {
|
|
sampleDatas[0].tileUv = getClampedTileUv(shapePosition, sampleDatas[0].tileCoords);
|
|
}
|
|
return;
|
|
}
|
|
|
|
// Go up tree until we find a parent tile containing shapePosition
|
|
for (int i = 0; i < OCTREE_MAX_LEVELS; ++i) {
|
|
traversalData.octreeCoords.xyz /= 2;
|
|
traversalData.octreeCoords.w -= 1;
|
|
|
|
if (insideTile(shapePosition, traversalData.octreeCoords)) {
|
|
break;
|
|
}
|
|
|
|
traversalData.parentOctreeIndex = getOctreeParentIndex(traversalData.parentOctreeIndex);
|
|
}
|
|
|
|
// Go down tree
|
|
OctreeNodeData nodeData = traverseOctreeDownwards(shapePosition, traversalData);
|
|
|
|
#if (SAMPLE_COUNT == 1)
|
|
getOctreeLeafSampleData(nodeData, traversalData.octreeCoords, sampleDatas[0]);
|
|
sampleDatas[0].tileUv = getClampedTileUv(shapePosition, sampleDatas[0].tileCoords);
|
|
#else
|
|
getOctreeLeafSampleDatas(nodeData, traversalData.octreeCoords, sampleDatas);
|
|
sampleDatas[0].tileUv = getClampedTileUv(shapePosition, sampleDatas[0].tileCoords);
|
|
sampleDatas[1].tileUv = getClampedTileUv(shapePosition, sampleDatas[1].tileCoords);
|
|
#endif
|
|
}
|
|
`,S4e=`// See Octree.glsl for the definitions of SampleData and intMod
|
|
|
|
/* Megatexture defines (set in Scene/VoxelRenderResources.js)
|
|
#define SAMPLE_COUNT ###
|
|
#define NEAREST_SAMPLING
|
|
#define PADDING
|
|
*/
|
|
|
|
uniform ivec2 u_megatextureSliceDimensions; // number of slices per tile, in two dimensions
|
|
uniform ivec2 u_megatextureTileDimensions; // number of tiles per megatexture, in two dimensions
|
|
uniform vec2 u_megatextureVoxelSizeUv;
|
|
uniform vec2 u_megatextureSliceSizeUv;
|
|
uniform vec2 u_megatextureTileSizeUv;
|
|
|
|
uniform ivec3 u_dimensions; // does not include padding
|
|
#if defined(PADDING)
|
|
uniform ivec3 u_paddingBefore;
|
|
uniform ivec3 u_paddingAfter;
|
|
#endif
|
|
|
|
// Integer min, max, clamp: For WebGL1 only
|
|
int intMin(int a, int b) {
|
|
return a <= b ? a : b;
|
|
}
|
|
int intMax(int a, int b) {
|
|
return a >= b ? a : b;
|
|
}
|
|
int intClamp(int v, int minVal, int maxVal) {
|
|
return intMin(intMax(v, minVal), maxVal);
|
|
}
|
|
|
|
vec2 index1DTo2DTexcoord(int index, ivec2 dimensions, vec2 uvScale)
|
|
{
|
|
int indexX = intMod(index, dimensions.x);
|
|
int indexY = index / dimensions.x;
|
|
return vec2(indexX, indexY) * uvScale;
|
|
}
|
|
|
|
/*
|
|
How is 3D data stored in a 2D megatexture?
|
|
|
|
In this example there is only one loaded tile and it has 2x2x2 voxels (8 voxels total).
|
|
The data is sliced by Z. The data at Z = 0 is placed in texels (0,0), (0,1), (1,0), (1,1) and
|
|
the data at Z = 1 is placed in texels (2,0), (2,1), (3,0), (3,1).
|
|
Note that there could be empty space in the megatexture because it's a power of two.
|
|
|
|
0 1 2 3
|
|
+---+---+---+---+
|
|
| | | | | 3
|
|
+---+---+---+---+
|
|
| | | | | 2
|
|
+-------+-------+
|
|
|010|110|011|111| 1
|
|
|--- ---|--- ---|
|
|
|000|100|001|101| 0
|
|
+-------+-------+
|
|
|
|
When doing linear interpolation the megatexture needs to be sampled twice: once for
|
|
the Z slice above the voxel coordinate and once for the slice below. The two slices
|
|
are interpolated with fract(coord.z - 0.5). For example, a Z coordinate of 1.0 is
|
|
halfway between two Z slices so the interpolation factor is 0.5. Below is a side view
|
|
of the 3D voxel grid with voxel coordinates on the left side.
|
|
|
|
2 +---+
|
|
|001|
|
|
1 +-z-+
|
|
|000|
|
|
0 +---+
|
|
|
|
When doing nearest neighbor the megatexture only needs to be sampled once at the closest Z slice.
|
|
*/
|
|
|
|
Properties getPropertiesFromMegatexture(in SampleData sampleData) {
|
|
int tileIndex = sampleData.megatextureIndex;
|
|
vec3 voxelCoord = sampleData.tileUv * vec3(u_dimensions);
|
|
ivec3 voxelDimensions = u_dimensions;
|
|
|
|
#if defined(PADDING)
|
|
voxelDimensions += u_paddingBefore + u_paddingAfter;
|
|
voxelCoord += vec3(u_paddingBefore);
|
|
#endif
|
|
|
|
#if defined(NEAREST_SAMPLING)
|
|
// Round to the center of the nearest voxel
|
|
voxelCoord = floor(voxelCoord) + vec3(0.5);
|
|
#endif
|
|
|
|
// Tile location
|
|
vec2 tileUvOffset = index1DTo2DTexcoord(tileIndex, u_megatextureTileDimensions, u_megatextureTileSizeUv);
|
|
|
|
// Slice location
|
|
float slice = voxelCoord.z - 0.5;
|
|
int sliceIndex = int(floor(slice));
|
|
int sliceIndex0 = intClamp(sliceIndex, 0, voxelDimensions.z - 1);
|
|
vec2 sliceUvOffset0 = index1DTo2DTexcoord(sliceIndex0, u_megatextureSliceDimensions, u_megatextureSliceSizeUv);
|
|
|
|
// Voxel location
|
|
vec2 voxelUvOffset = clamp(voxelCoord.xy, vec2(0.5), vec2(voxelDimensions.xy) - vec2(0.5)) * u_megatextureVoxelSizeUv;
|
|
|
|
// Final location in the megatexture
|
|
vec2 uv0 = tileUvOffset + sliceUvOffset0 + voxelUvOffset;
|
|
|
|
#if defined(NEAREST_SAMPLING)
|
|
return getPropertiesFromMegatextureAtUv(uv0);
|
|
#else
|
|
float sliceLerp = fract(slice);
|
|
int sliceIndex1 = intMin(sliceIndex + 1, voxelDimensions.z - 1);
|
|
vec2 sliceUvOffset1 = index1DTo2DTexcoord(sliceIndex1, u_megatextureSliceDimensions, u_megatextureSliceSizeUv);
|
|
vec2 uv1 = tileUvOffset + sliceUvOffset1 + voxelUvOffset;
|
|
Properties properties0 = getPropertiesFromMegatextureAtUv(uv0);
|
|
Properties properties1 = getPropertiesFromMegatextureAtUv(uv1);
|
|
return mixProperties(properties0, properties1, sliceLerp);
|
|
#endif
|
|
}
|
|
|
|
// Convert an array of sample datas to a final weighted properties.
|
|
Properties accumulatePropertiesFromMegatexture(in SampleData sampleDatas[SAMPLE_COUNT]) {
|
|
#if (SAMPLE_COUNT == 1)
|
|
return getPropertiesFromMegatexture(sampleDatas[0]);
|
|
#else
|
|
// When more than one sample is taken the accumulator needs to start at 0
|
|
Properties properties = clearProperties();
|
|
for (int i = 0; i < SAMPLE_COUNT; ++i) {
|
|
float weight = sampleDatas[i].weight;
|
|
|
|
// Avoid reading the megatexture when the weight is 0 as it can be costly.
|
|
if (weight > 0.0) {
|
|
Properties tempProperties = getPropertiesFromMegatexture(sampleDatas[i]);
|
|
tempProperties = scaleProperties(tempProperties, weight);
|
|
properties = sumProperties(properties, tempProperties);
|
|
}
|
|
}
|
|
return properties;
|
|
#endif
|
|
}
|
|
`;function v4e(e){const t=new Es;this.shaderBuilder=t;const n=e._customShader,i=jt(e._uniformMap,n.uniformMap);e._uniformMap=i;const o=n.uniforms;for(const _ in o)if(o.hasOwnProperty(_)){const g=o[_];t.addUniform(g.type,_,ge.FRAGMENT)}t.addUniform("sampler2D","u_megatextureTextures[METADATA_COUNT]",ge.FRAGMENT),this.uniformMap=i;const r=e._clippingPlanes,s=c(r)&&r.enabled?r.length:0;this.clippingPlanes=r,this.clippingPlanesLength=s,t.addVertexLines([m4e]),t.addFragmentLines([n.fragmentShaderText,"#line 0",w4e,f4e,_4e,S4e]),s>0&&(t.addDefine("CLIPPING_PLANES",void 0,ge.FRAGMENT),t.addDefine("CLIPPING_PLANES_COUNT",s,ge.FRAGMENT),r.unionClippingRegions&&t.addDefine("CLIPPING_PLANES_UNION",void 0,ge.FRAGMENT),t.addFragmentLines([y4e])),e._depthTest&&(t.addDefine("DEPTH_TEST",void 0,ge.FRAGMENT),t.addFragmentLines([g4e]));const a=e._provider.shape;a==="BOX"?t.addFragmentLines([x4e,b4e,Gv]):a==="CYLINDER"?t.addFragmentLines([C4e,bz,T4e,Gv]):a==="ELLIPSOID"&&(t.addDefine("SHAPE_ELLIPSOID",void 0,ge.FRAGMENT),t.addFragmentLines([E4e,bz,A4e,Gv])),t.addFragmentLines([p4e]);const l=e._shape,u=l.shaderDefines;for(const _ in u)if(u.hasOwnProperty(_)){let g=u[_];c(g)&&(g=g===!0?void 0:g,t.addDefine(_,g,ge.FRAGMENT))}let h=l.shaderMaximumIntersectionsLength;s>0&&(t.addDefine("CLIPPING_PLANES_INTERSECTION_INDEX",h,ge.FRAGMENT),s===1?h+=1:r.unionClippingRegions?h+=2:h+=1),e._depthTest&&(t.addDefine("DEPTH_INTERSECTION_INDEX",h,ge.FRAGMENT),h+=1),t.addDefine("INTERSECTION_COUNT",h,ge.FRAGMENT),(!d.equals(e.paddingBefore,d.ZERO)||!d.equals(e.paddingAfter,d.ZERO))&&t.addDefine("PADDING",void 0,ge.FRAGMENT),e._useLogDepth&&t.addDefine("LOG_DEPTH_READ_ONLY",void 0,ge.FRAGMENT),e._jitter&&t.addDefine("JITTER",void 0,ge.FRAGMENT),e._nearestSampling&&t.addDefine("NEAREST_SAMPLING",void 0,ge.FRAGMENT);const f=e._traversal;t.addDefine("SAMPLE_COUNT",`${f._sampleCount}`,ge.FRAGMENT)}function I4e(e,t){const{shaderBuilder:n}=e,{names:i,types:o,componentTypes:r,minimumValues:s,maximumValues:a}=t._provider,l=o.length,u=c(s)&&c(a);n.addDefine("METADATA_COUNT",l,ge.FRAGMENT),u&&n.addDefine("STATISTICS",void 0,ge.FRAGMENT);for(let M=0;M<l;M++){const U=i[M],B=o[M],S=`PropertyStatistics_${U}`,D=`PropertyStatistics_${U}`;n.addStruct(S,D,ge.FRAGMENT);const p=bA(B);n.addStructField(S,p,"min"),n.addStructField(S,p,"max")}const h="Statistics",f="Statistics",_="statistics";n.addStruct(h,f,ge.FRAGMENT);for(let M=0;M<l;M++){const U=i[M],B=`PropertyStatistics_${U}`,S=U;n.addStructField(h,B,S)}const g="Metadata",m="Metadata",b="metadata";n.addStruct(g,m,ge.FRAGMENT),n.addStructField(g,f,_);for(let M=0;M<l;M++){const U=i[M],B=o[M],S=bA(B);n.addStructField(g,S,U)}for(let M=0;M<l;M++){const U=i[M],B=o[M],S=P4e(B),D=`VoxelProperty_${U}`,p=`VoxelProperty_${U}`;n.addStruct(D,p,ge.FRAGMENT),n.addStructField(D,S,"partialDerivativeLocal"),n.addStructField(D,S,"partialDerivativeWorld"),n.addStructField(D,S,"partialDerivativeView"),n.addStructField(D,S,"partialDerivativeValid")}const T="Voxel",x="Voxel",C="voxel";n.addStruct(T,x,ge.FRAGMENT);for(let M=0;M<l;M++){const U=i[M],B=`VoxelProperty_${U}`;n.addStructField(T,B,U)}n.addStructField(T,"vec3","positionEC"),n.addStructField(T,"vec3","positionUv"),n.addStructField(T,"vec3","positionShapeUv"),n.addStructField(T,"vec3","positionUvLocal"),n.addStructField(T,"vec3","viewDirUv"),n.addStructField(T,"vec3","viewDirWorld"),n.addStructField(T,"vec3","surfaceNormal"),n.addStructField(T,"float","travelDistance"),n.addStructField(T,"int","stepCount"),n.addStructField(T,"int","tileIndex"),n.addStructField(T,"int","sampleIndex");const w="FragmentInput",v="FragmentInput";n.addStruct(w,v,ge.FRAGMENT),n.addStructField(w,m,b),n.addStructField(w,x,C);const P="Properties",N="Properties",k="properties";n.addStruct(P,N,ge.FRAGMENT);for(let M=0;M<l;M++){const U=i[M],B=o[M],S=bA(B);n.addStructField(P,S,U)}{const M="clearProperties";n.addFunction(M,`${N} clearProperties()`,ge.FRAGMENT),n.addFunctionLines(M,[`${N} ${k};`]);for(let U=0;U<l;U++){const B=i[U],S=o[U];r[U];const D=bA(S);n.addFunctionLines(M,[`${k}.${B} = ${D}(0.0);`])}n.addFunctionLines(M,[`return ${k};`])}{const M="sumProperties";n.addFunction(M,`${N} sumProperties(${N} propertiesA, ${N} propertiesB)`,ge.FRAGMENT),n.addFunctionLines(M,[`${N} ${k};`]);for(let U=0;U<l;U++){const B=i[U];n.addFunctionLines(M,[`${k}.${B} = propertiesA.${B} + propertiesB.${B};`])}n.addFunctionLines(M,[`return ${k};`])}{const M="scaleProperties";n.addFunction(M,`${N} scaleProperties(${N} ${k}, float scale)`,ge.FRAGMENT),n.addFunctionLines(M,[`${N} scaledProperties = ${k};`]);for(let U=0;U<l;U++){const B=i[U];n.addFunctionLines(M,[`scaledProperties.${B} *= scale;`])}n.addFunctionLines(M,["return scaledProperties;"])}{const M="mixProperties";n.addFunction(M,`${N} mixProperties(${N} propertiesA, ${N} propertiesB, float mixFactor)`,ge.FRAGMENT),n.addFunctionLines(M,[`${N} ${k};`]);for(let U=0;U<l;U++){const B=i[U];n.addFunctionLines(M,[`${k}.${B} = mix(propertiesA.${B}, propertiesB.${B}, mixFactor);`])}n.addFunctionLines(M,[`return ${k};`])}{const M="copyPropertiesToMetadata";n.addFunction(M,`void copyPropertiesToMetadata(in ${N} ${k}, inout ${m} ${b})`,ge.FRAGMENT);for(let U=0;U<l;U++){const B=i[U];n.addFunctionLines(M,[`${b}.${B} = ${k}.${B};`])}}if(u){const M="setStatistics";n.addFunction(M,`void setStatistics(inout ${f} ${_})`,ge.FRAGMENT);for(let U=0;U<l;U++){const B=i[U],S=o[U],D=bt.getComponentCount(S);for(let p=0;p<D;p++){const I=O4e(S,p),O=s[U][p],F=a[U][p];n.addFunctionLines(M,[`${_}.${B}.min${I} = ${Tz(O)};`,`${_}.${B}.max${I} = ${Tz(F)};`])}}}{const M="getPropertiesFromMegatextureAtUv";n.addFunction(M,`${N} getPropertiesFromMegatextureAtUv(vec2 texcoord)`,ge.FRAGMENT),n.addFunctionLines(M,[`${N} ${k};`]);for(let U=0;U<l;U++){const B=i[U],S=o[U];r[U];const D=D4e(S);n.addFunctionLines(M,[`properties.${B} = texture(u_megatextureTextures[${U}], texcoord)${D};`])}n.addFunctionLines(M,[`return ${k};`])}}function bA(e){if(e===bt.SCALAR)return"float";if(e===bt.VEC2)return"vec2";if(e===bt.VEC3)return"vec3";if(e===bt.VEC4)return"vec4"}function D4e(e){if(e===bt.SCALAR)return".r";if(e===bt.VEC2)return".ra";if(e===bt.VEC3)return".rgb";if(e===bt.VEC4)return""}function P4e(e){if(e===bt.SCALAR)return"vec3";if(e===bt.VEC2)return"mat2";if(e===bt.VEC3)return"mat3";if(e===bt.VEC4)return"mat4"}function Tz(e){let t=e.toString();return t.indexOf(".")===-1&&(t=`${e}.0`),t}function O4e(e,t){return e===bt.SCALAR?"":`[${t}]`}function L4e(e,t){const n=new v4e(e);I4e(n,e);const{shaderBuilder:i,clippingPlanes:o,clippingPlanesLength:r}=n;if(r>0){const x="getClippingPlane",C=p1(o,t),w=0,v=C.indexOf(")")+1,P=C.indexOf("{",v)+1,N=C.indexOf("}",P),k=C.slice(w,v),M=C.slice(P,N);i.addFunction(x,k,ge.FRAGMENT),i.addFunctionLines(x,[M])}const s=i.clone();s.addDefine("PICKING",void 0,ge.FRAGMENT);const a=i.clone();a.addDefine("PICKING_VOXEL",void 0,ge.FRAGMENT);const l=i.buildShaderProgram(t),u=s.buildShaderProgram(t),h=a.buildShaderProgram(t),f=Ue.fromCache({cull:{enabled:!0,face:Qi.BACK},depthTest:{enabled:!1},depthMask:!1,blending:Zn.PRE_MULTIPLIED_ALPHA_BLEND}),_=t.getViewportQuadVertexArray(),g=e._depthTest,m=new Ze({vertexArray:_,primitiveType:ze.TRIANGLES,renderState:f,shaderProgram:l,uniformMap:n.uniformMap,modelMatrix:e._compoundModelMatrix,pass:xe.VOXELS,executeInClosestFrustum:!0,owner:this,cull:g,occlude:g}),b=Ze.shallowClone(m,new Ze);b.shaderProgram=u,b.pickOnly=!0;const T=Ze.shallowClone(m,new Ze);if(T.shaderProgram=h,T.pickOnly=!0,c(e._drawCommand)){const x=e._drawCommand;x.shaderProgram=x.shaderProgram&&x.shaderProgram.destroy()}if(c(e._drawCommandPick)){const x=e._drawCommandPick;x.shaderProgram=x.shaderProgram&&x.shaderProgram.destroy()}if(c(e._drawCommandPickVoxel)){const x=e._drawCommandPickVoxel;x.shaderProgram=x.shaderProgram&&x.shaderProgram.destroy()}e._drawCommand=m,e._drawCommandPick=b,e._drawCommandPickVoxel=T}function fs(){this.orientedBoundingBox=new Ct,this.boundingSphere=new se,this.boundTransform=new L,this.shapeTransform=new L,this._minBounds=d.clone(fs.DefaultMinBounds,new d),this._maxBounds=d.clone(fs.DefaultMaxBounds,new d),this.shaderUniforms={renderMinBounds:new d,renderMaxBounds:new d,boxUvToShapeUvScale:new d,boxUvToShapeUvTranslate:new d},this.shaderDefines={BOX_INTERSECTION_INDEX:void 0,BOX_HAS_SHAPE_BOUNDS:void 0},this.shaderMaximumIntersectionsLength=0}const R4e=new d,nP=new d,N4e=new $,M4e=new d,F4e=new d,B4e=new d,z4e=new d,Az=L.fromRotationTranslation($.fromUniformScale(.5,new $),new d(.5,.5,.5),new L);fs.prototype.update=function(e,t,n,i,o){i=y(i,fs.DefaultMinBounds),o=y(o,fs.DefaultMaxBounds),A.typeOf.object("modelMatrix",e),A.typeOf.object("minBounds",t),A.typeOf.object("maxBounds",n);const r=fs.DefaultMinBounds,s=fs.DefaultMaxBounds;t=this._minBounds=d.clamp(t,r,s,this._minBounds),n=this._maxBounds=d.clamp(n,r,s,this._maxBounds),i=d.clamp(i,r,s,M4e),o=d.clamp(o,r,s,F4e);const a=d.clamp(t,i,o,B4e),l=d.clamp(n,i,o,z4e),u=L.getScale(e,nP);if(a.x>l.x||a.y>l.y||a.z>l.z||(a.x===l.x)+(a.y===l.y)+(a.z===l.z)>=2||i.x>o.x||i.y>o.y||i.z>o.z||u.x===0||u.y===0||u.z===0)return!1;this.shapeTransform=L.clone(e,this.shapeTransform),this.orientedBoundingBox=X1(a,l,this.shapeTransform,this.orientedBoundingBox),this.boundTransform=L.fromRotationTranslation(this.orientedBoundingBox.halfAxes,this.orientedBoundingBox.center,this.boundTransform),this.boundingSphere=se.fromOrientedBoundingBox(this.orientedBoundingBox,this.boundingSphere);const{shaderUniforms:h,shaderDefines:f}=this;for(const m in f)f.hasOwnProperty(m)&&(f[m]=void 0);const _=!d.equals(t,r)||!d.equals(n,s);let g=0;if(f.BOX_INTERSECTION_INDEX=g,g+=1,h.renderMinBounds=L.multiplyByPoint(Az,a,h.renderMinBounds),h.renderMaxBounds=L.multiplyByPoint(Az,l,h.renderMaxBounds),_){f.BOX_HAS_SHAPE_BOUNDS=!0;const m=t,b=n;h.boxUvToShapeUvScale=d.fromElements(2/(m.x===b.x?1:b.x-m.x),2/(m.y===b.y?1:b.y-m.y),2/(m.z===b.z?1:b.z-m.z),h.boxUvToShapeUvScale),h.boxUvToShapeUvTranslate=d.fromElements(-h.boxUvToShapeUvScale.x*(m.x*.5+.5),-h.boxUvToShapeUvScale.y*(m.y*.5+.5),-h.boxUvToShapeUvScale.z*(m.z*.5+.5),h.boxUvToShapeUvTranslate)}return this.shaderMaximumIntersectionsLength=g,!0};const fx=new d,iP=new d;fs.prototype.computeOrientedBoundingBoxForTile=function(e,t,n,i,o){A.typeOf.number("tileLevel",e),A.typeOf.number("tileX",t),A.typeOf.number("tileY",n),A.typeOf.number("tileZ",i),A.typeOf.object("result",o);const r=this._minBounds,s=this._maxBounds,a=1/Math.pow(2,e),l=d.fromElements(R.lerp(r.x,s.x,a*t),R.lerp(r.y,s.y,a*n),R.lerp(r.z,s.z,a*i),fx),u=d.fromElements(R.lerp(r.x,s.x,a*(t+1)),R.lerp(r.y,s.y,a*(n+1)),R.lerp(r.z,s.z,a*(i+1)),iP);return X1(l,u,this.shapeTransform,o)};const xz=new d;fs.prototype.computeOrientedBoundingBoxForSample=function(e,t,n,i){A.typeOf.object("spatialNode",e),A.typeOf.object("tileDimensions",t),A.typeOf.object("tileUv",n),A.typeOf.object("result",i);const o=1/Math.pow(2,e.level),r=d.divideComponents(d.ONE,t,xz),s=d.multiplyByScalar(r,o,xz),a=d.multiplyByScalar(d.fromElements(e.x+n.x,e.y+n.y,e.z+n.z,fx),o,fx),l=d.add(a,s,iP),u=this._minBounds,h=this._maxBounds,f=d.fromElements(R.lerp(u.x,h.x,a.x),R.lerp(u.y,h.y,a.y),R.lerp(u.z,h.z,a.z),fx),_=d.fromElements(R.lerp(u.x,h.x,l.x),R.lerp(u.y,h.y,l.y),R.lerp(u.z,h.z,l.z),iP);return X1(f,_,this.shapeTransform,i)};fs.DefaultMinBounds=Object.freeze(new d(-1,-1,-1));fs.DefaultMaxBounds=Object.freeze(new d(1,1,1));function X1(e,t,n,i){const o=fs.DefaultMinBounds,r=fs.DefaultMaxBounds;if(d.equals(e,o)&&d.equals(t,r))i.center=L.getTranslation(n,i.center),i.halfAxes=L.getMatrix3(n,i.halfAxes);else{let a=L.getScale(n,nP);const l=d.midpoint(e,t,R4e);i.center=L.multiplyByPoint(n,l,i.center),a=d.fromElements(a.x*.5*(t.x-e.x),a.y*.5*(t.y-e.y),a.z*.5*(t.z-e.z),nP);const u=L.getRotation(n,N4e);i.halfAxes=$.setScale(u,a,i.halfAxes)}return i}function $i(){this.orientedBoundingBox=new Ct,this.boundingSphere=new se,this.boundTransform=new L,this.shapeTransform=new L,this._minimumRadius=$i.DefaultMinBounds.x,this._maximumRadius=$i.DefaultMaxBounds.x,this._minimumHeight=$i.DefaultMinBounds.y,this._maximumHeight=$i.DefaultMaxBounds.y,this._minimumAngle=$i.DefaultMinBounds.z,this._maximumAngle=$i.DefaultMaxBounds.z,this.shaderUniforms={cylinderRenderHeightMinMax:new H,cylinderRenderRadiusMinMax:new H,cylinderRenderAngleMinMax:new H,cylinderUvToShapeUvRadius:new H,cylinderUvToShapeUvHeight:new H,cylinderUvToShapeUvAngle:new H,cylinderShapeUvAngleMinMax:new H,cylinderShapeUvAngleRangeZeroMid:0},this.shaderDefines={CYLINDER_HAS_RENDER_BOUNDS_RADIUS_MIN:void 0,CYLINDER_HAS_RENDER_BOUNDS_RADIUS_FLAT:void 0,CYLINDER_HAS_RENDER_BOUNDS_ANGLE:void 0,CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_EQUAL_ZERO:void 0,CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_UNDER_HALF:void 0,CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_OVER_HALF:void 0,CYLINDER_HAS_SHAPE_BOUNDS_RADIUS:void 0,CYLINDER_HAS_SHAPE_BOUNDS_HEIGHT:void 0,CYLINDER_HAS_SHAPE_BOUNDS_ANGLE:void 0,CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_DISCONTINUITY:void 0,CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MAX_DISCONTINUITY:void 0,CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_MAX_REVERSED:void 0,CYLINDER_INTERSECTION_INDEX_RADIUS_MAX:void 0,CYLINDER_INTERSECTION_INDEX_RADIUS_MIN:void 0,CYLINDER_INTERSECTION_INDEX_ANGLE:void 0},this.shaderMaximumIntersectionsLength=0}const H6=new d;$i.prototype.update=function(e,t,n,i,o){i=y(i,$i.DefaultMinBounds),o=y(o,$i.DefaultMaxBounds),A.typeOf.object("modelMatrix",e),A.typeOf.object("minBounds",t),A.typeOf.object("maxBounds",n);const r=$i.DefaultMinBounds.x,s=$i.DefaultMaxBounds.x,a=$i.DefaultMinBounds.y,l=$i.DefaultMaxBounds.y,u=$i.DefaultMinBounds.z,h=$i.DefaultMaxBounds.z,f=h-u,_=.5*f,g=R.EPSILON10,m=R.EPSILON3,b=R.EPSILON10,T=R.clamp(t.x,r,s),x=R.clamp(n.x,r,s),C=R.clamp(i.x,r,s),w=R.clamp(o.x,r,s),v=Math.max(T,C),P=Math.min(x,w),N=R.clamp(t.y,a,l),k=R.clamp(n.y,a,l),M=R.clamp(i.y,a,l),U=R.clamp(o.y,a,l),B=Math.max(N,M),S=Math.min(k,U),D=R.negativePiToPi(t.z),p=R.negativePiToPi(n.z),I=R.negativePiToPi(i.z),O=R.negativePiToPi(o.z),F=Math.max(D,I),V=Math.min(p,O),G=L.getScale(e,H6);if(P===0||v>P||B>S||R.equalsEpsilon(G.x,0,void 0,g)||R.equalsEpsilon(G.y,0,void 0,g)||R.equalsEpsilon(G.z,0,void 0,g))return!1;this._minimumRadius=T,this._maximumRadius=x,this._minimumHeight=N,this._maximumHeight=k,this._minimumAngle=D,this._maximumAngle=p,this.shapeTransform=L.clone(e,this.shapeTransform),this.orientedBoundingBox=Q1(v,P,B,S,F,V,this.shapeTransform,this.orientedBoundingBox),this.boundTransform=L.fromRotationTranslation(this.orientedBoundingBox.halfAxes,this.orientedBoundingBox.center,this.boundTransform),this.boundingSphere=se.fromOrientedBoundingBox(this.orientedBoundingBox,this.boundingSphere);const X=T===r&&x===s,q=N===a&&k===l,ee=p<D,Y=p-D+ee*f,ne=Y>_+b&&Y<f-b,Q=Y<_-b,le=Y>=_-b&&Y<=_+b,pe=ne||Q||le,re=R.equalsEpsilon(D,u,void 0,m),de=R.equalsEpsilon(p,h,void 0,m),fe=v===r,ye=V<F,Ce=V-F+ye*f,we=Ce>=_-b&&Ce<f-b,Pe=Ce>b&&Ce<_-b,lt=Ce<=b,ft=we||Pe||lt,{shaderUniforms:We,shaderDefines:Fe}=this;for(const st in Fe)Fe.hasOwnProperty(st)&&(Fe[st]=void 0);let Dt=0;if(Fe.CYLINDER_INTERSECTION_INDEX_RADIUS_MAX=Dt,Dt+=1,fe||(Fe.CYLINDER_HAS_RENDER_BOUNDS_RADIUS_MIN=!0,Fe.CYLINDER_INTERSECTION_INDEX_RADIUS_MIN=Dt,Dt+=1),We.cylinderRenderRadiusMinMax=H.fromElements(v,P,We.cylinderRenderRadiusMinMax),v===P&&(Fe.CYLINDER_HAS_RENDER_BOUNDS_RADIUS_FLAT=!0),!X){Fe.CYLINDER_HAS_SHAPE_BOUNDS_RADIUS=!0;const st=x-T;let et=0,hn=1;st!==0&&(et=1/st,hn=-T/st),We.cylinderUvToShapeUvRadius=H.fromElements(et,hn,We.cylinderUvToShapeUvRadius)}if(!q){Fe.CYLINDER_HAS_SHAPE_BOUNDS_HEIGHT=!0;const st=k-N;let et=0,hn=1;st!==0&&(et=2/st,hn=-(N+1)/st),We.cylinderUvToShapeUvHeight=H.fromElements(et,hn,We.cylinderUvToShapeUvHeight)}if(We.cylinderRenderHeightMinMax=H.fromElements(B,S,We.cylinderRenderHeightMinMax),ee&&(Fe.CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_MAX_REVERSED=!0),ft&&(Fe.CYLINDER_HAS_RENDER_BOUNDS_ANGLE=!0,Fe.CYLINDER_INTERSECTION_INDEX_ANGLE=Dt,we?(Fe.CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_UNDER_HALF=!0,Dt+=1):Pe?(Fe.CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_OVER_HALF=!0,Dt+=2):lt&&(Fe.CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_EQUAL_ZERO=!0,Dt+=2),We.cylinderRenderAngleMinMax=H.fromElements(F,V,We.cylinderRenderAngleMinMax)),pe){Fe.CYLINDER_HAS_SHAPE_BOUNDS_ANGLE=!0,re&&(Fe.CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_DISCONTINUITY=!0),de&&(Fe.CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MAX_DISCONTINUITY=!0);const st=(D-u)/f,et=(p-u)/f,hn=1-Y/f;if(We.cylinderShapeUvAngleMinMax=H.fromElements(st,et,We.cylinderShapeUvAngleMinMax),We.cylinderShapeUvAngleRangeZeroMid=(et+.5*hn)%1,Y<=b)We.cylinderUvToShapeUvAngle=H.fromElements(0,1,We.cylinderUvToShapeUvAngle);else{const ot=f/Y,at=-(D-u)/Y;We.cylinderUvToShapeUvAngle=H.fromElements(ot,at,We.cylinderUvToShapeUvAngle)}}return this.shaderMaximumIntersectionsLength=Dt,!0};$i.prototype.computeOrientedBoundingBoxForTile=function(e,t,n,i,o){A.typeOf.number("tileLevel",e),A.typeOf.number("tileX",t),A.typeOf.number("tileY",n),A.typeOf.number("tileZ",i),A.typeOf.object("result",o);const r=this._minimumRadius,s=this._maximumRadius,a=this._minimumHeight,l=this._maximumHeight,u=this._minimumAngle,h=this._maximumAngle,f=1/Math.pow(2,e),_=R.lerp(r,s,t*f),g=R.lerp(r,s,(t+1)*f),m=R.lerp(a,l,n*f),b=R.lerp(a,l,(n+1)*f),T=R.lerp(u,h,i*f),x=R.lerp(u,h,(i+1)*f);return Q1(_,g,m,b,T,x,this.shapeTransform,o)};const Cz=new d,Ez=new d,U4e=new d;$i.prototype.computeOrientedBoundingBoxForSample=function(e,t,n,i){A.typeOf.object("spatialNode",e),A.typeOf.object("tileDimensions",t),A.typeOf.object("tileUv",n),A.typeOf.object("result",i);const o=1/Math.pow(2,e.level),r=d.divideComponents(d.ONE,t,Cz),s=d.multiplyByScalar(r,o,Cz),a=d.multiplyByScalar(d.fromElements(e.x+n.x,e.y+n.y,e.z+n.z,Ez),o,Ez),l=d.add(a,s,U4e),u=this._minimumRadius,h=this._maximumRadius,f=this._minimumHeight,_=this._maximumHeight,g=this._minimumAngle,m=this._maximumAngle,b=R.lerp(u,h,a.x),T=R.lerp(u,h,l.x),x=R.lerp(f,_,a.y),C=R.lerp(f,_,l.y),w=R.lerp(g,m,a.z),v=R.lerp(g,m,l.z);return Q1(b,T,x,C,w,v,this.shapeTransform,i)};$i.DefaultMinBounds=Object.freeze(new d(0,-1,-R.PI));$i.DefaultMaxBounds=Object.freeze(new d(1,1,+R.PI));const k4e=5,V4e=new Array(k4e),H4e=new d,G4e=new $,j4e=new L,W4e=new L,q4e=new L,jv=new L,Y4e=new d,$4e=new d,X4e=new d,G6=new Array(8);for(let e=0;e<8;e++)G6[e]=new d;function wz(e,t,n){return Math.abs(te.dot(e,t))<n}function Q4e(e){const t=L.getColumn(e,0,Y4e),n=L.getColumn(e,1,$4e),i=L.getColumn(e,2,X4e),o=R.EPSILON4;return wz(t,n,o)&&wz(n,i,o)}function K4e(e,t){const n=G6;d.fromElements(-.5,-.5,-.5,n[0]),d.fromElements(-.5,-.5,.5,n[1]),d.fromElements(-.5,.5,-.5,n[2]),d.fromElements(-.5,.5,.5,n[3]),d.fromElements(.5,-.5,-.5,n[4]),d.fromElements(.5,-.5,.5,n[5]),d.fromElements(.5,.5,-.5,n[6]),d.fromElements(.5,.5,.5,n[7]);for(let i=0;i<8;++i)L.multiplyByPoint(e,n[i],n[i]);return Ct.fromPoints(n,t)}function Q1(e,t,n,i,o,r,s,a){const l=$i.DefaultMinBounds,u=$i.DefaultMaxBounds,h=l.x,f=u.x,_=l.y,g=u.y,m=l.z,b=u.z;if(e===h&&t===f&&n===_&&i===g&&o===m&&r===b)return a.center=L.getTranslation(s,a.center),a.halfAxes=L.getMatrix3(s,a.halfAxes),a;r<o&&(r+=R.TWO_PI);const x=r-o,C=o+x*.5,w=V4e;let v=0;w[v++]=o,w[v++]=r,w[v++]=C,x>R.PI&&(w[v++]=C-R.PI_OVER_TWO,w[v++]=C+R.PI_OVER_TWO);let P=1,N=1,k=-1,M=-1;for(let ee=0;ee<v;++ee){const Y=w[ee]-C,ne=Math.cos(Y),Q=Math.sin(Y),le=ne*e,pe=Q*e,re=ne*t,de=Q*t;P=Math.min(P,le),N=Math.min(N,pe),P=Math.min(P,re),N=Math.min(N,de),k=Math.max(k,le),M=Math.max(M,pe),k=Math.max(k,re),M=Math.max(M,de)}const U=k-P,B=M-N,S=i-n,D=(P+k)*.5,p=(N+M)*.5,I=(n+i)*.5,O=d.fromElements(D,p,I,H4e),F=$.fromRotationZ(C,G4e),V=d.fromElements(U,B,S,H6),G=L.fromScale(V,q4e),j=L.fromRotation(F,W4e),W=L.fromTranslation(O,j4e),X=L.multiplyTransformation(j,L.multiplyTransformation(W,G,jv),jv),q=L.multiplyTransformation(s,X,jv);return Q4e(q)?Ct.fromTransformation(q,a):K4e(q,a)}function El(){this.orientedBoundingBox=new Ct,this.boundingSphere=new se,this.boundTransform=new L,this.shapeTransform=new L,this._rectangle=new ce,this._minimumHeight=El.DefaultMinBounds.z,this._maximumHeight=El.DefaultMaxBounds.z,this._ellipsoid=new ae,this._translation=new d,this._rotation=new $,this.shaderUniforms={ellipsoidRadiiUv:new d,eccentricitySquared:0,evoluteScale:new H,ellipsoidInverseRadiiSquaredUv:new d,ellipsoidRenderLongitudeMinMax:new H,ellipsoidShapeUvLongitudeMinMaxMid:new d,ellipsoidUvToShapeUvLongitude:new H,ellipsoidUvToShapeUvLatitude:new H,ellipsoidRenderLatitudeSinMinMax:new H,ellipsoidInverseHeightDifferenceUv:0,clipMinMaxHeight:new H},this.shaderDefines={ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_EQUAL_ZERO:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_UNDER_HALF:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_OVER_HALF:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MIN_DISCONTINUITY:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MAX_DISCONTINUITY:void 0,ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE:void 0,ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE_MIN_MAX_REVERSED:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_UNDER_HALF:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_EQUAL_HALF:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_OVER_HALF:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_UNDER_HALF:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_EQUAL_HALF:void 0,ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_OVER_HALF:void 0,ELLIPSOID_HAS_SHAPE_BOUNDS_LATITUDE:void 0,ELLIPSOID_INTERSECTION_INDEX_LONGITUDE:void 0,ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MAX:void 0,ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MIN:void 0,ELLIPSOID_INTERSECTION_INDEX_HEIGHT_MAX:void 0,ELLIPSOID_INTERSECTION_INDEX_HEIGHT_MIN:void 0},this.shaderMaximumIntersectionsLength=0}const Z4e=new d,J4e=new d,eHe=new d,tHe=new d,nHe=new d,iHe=new d,oHe=new d,rHe=new d,sHe=new $,Sz=new d,vz=new d,aHe=new ce;El.prototype.update=function(e,t,n,i,o){const{DefaultMinBounds:r,DefaultMaxBounds:s}=El;i=y(i,r),o=y(o,s),A.typeOf.object("modelMatrix",e),A.typeOf.object("minBounds",t),A.typeOf.object("maxBounds",n);const a=R.EPSILON10,l=R.EPSILON3,u=R.EPSILON10,h=R.EPSILON10,f=R.EPSILON3,_=L.getScale(e,rHe),g=d.clone(r,Z4e);g.z=-d.minimumComponent(_);const m=d.clamp(t,g,s,J4e),b=d.clamp(n,g,s,eHe),T=d.clamp(i,g,s,tHe),x=d.clamp(o,g,s,nHe),C=d.maximumByComponent(m,T,iHe),w=d.minimumByComponent(b,x,oHe),v=d.add(_,d.fromElements(b.z,b.z,b.z,Sz),Sz),P=d.maximumComponent(v),N=d.add(_,d.fromElements(w.z,w.z,w.z,vz),vz);if(C.y>w.y||C.y===s.y||w.y===r.y||C.z>w.z||R.equalsEpsilon(N,d.ZERO,void 0,a))return!1;this._rectangle=ce.fromRadians(m.x,m.y,b.x,b.y),this._translation=L.getTranslation(e,this._translation),this._rotation=L.getRotation(e,this._rotation),this._ellipsoid=ae.fromCartesian3(_,this._ellipsoid),this._minimumHeight=m.z,this._maximumHeight=b.z;const k=ce.fromRadians(C.x,C.y,w.x,w.y,aHe);this.orientedBoundingBox=K1(k,C.z,w.z,this._ellipsoid,this._translation,this._rotation,this.orientedBoundingBox),this.shapeTransform=L.fromRotationTranslation($.setScale(this._rotation,v,sHe),this._translation,this.shapeTransform),this.boundTransform=L.fromRotationTranslation(this.orientedBoundingBox.halfAxes,this.orientedBoundingBox.center,this.boundTransform),this.boundingSphere=se.fromOrientedBoundingBox(this.orientedBoundingBox,this.boundingSphere);const M=s.x-r.x,U=.5*M,B=w.x<C.x,S=w.x-C.x+B*M,D=S<=u,p=S>=U-u&&S<M-u,I=S>u&&S<U-u,O=D||p||I,F=b.x<m.x,V=b.x-m.x+F*M,G=V>U+u&&V<M-u,j=V>=U-u&&V<=U+u,W=V<U-u,X=G||j||W,q=w.y<-f,ee=w.y>=-f&&w.y<=+f,Y=w.y>+f&&w.y<s.y-h,ne=q||ee||Y,Q=C.y>r.y+h&&C.y<-f,le=C.y>=-f&&C.y<=+f,pe=C.y>+f,re=Q||le||pe,de=ne||re,fe=b.y-m.y,ye=b.y<-f,Ce=b.y>=-f&&b.y<=+f,we=b.y>+f&&b.y<s.y-h,Pe=ye||Ce||we,lt=m.y>r.y+h&&m.y<-f,ft=m.y>=-f&&m.y<=+f,We=m.y>+f,Dt=Pe||(lt||ft||We),{shaderUniforms:st,shaderDefines:et}=this;for(const fi in et)et.hasOwnProperty(fi)&&(et[fi]=void 0);st.ellipsoidRadiiUv=d.divideByScalar(v,P,st.ellipsoidRadiiUv);const{x:hn,z:ot}=st.ellipsoidRadiiUv,at=ot/hn;st.eccentricitySquared=1-at*at,st.evoluteScale=H.fromElements((hn*hn-ot*ot)/hn,(ot*ot-hn*hn)/ot,st.evoluteScale),st.ellipsoidInverseRadiiSquaredUv=d.divideComponents(d.ONE,d.multiplyComponents(st.ellipsoidRadiiUv,st.ellipsoidRadiiUv,st.ellipsoidInverseRadiiSquaredUv),st.ellipsoidInverseRadiiSquaredUv);let Xt=0;et.ELLIPSOID_INTERSECTION_INDEX_HEIGHT_MAX=Xt,Xt+=1,et.ELLIPSOID_INTERSECTION_INDEX_HEIGHT_MIN=Xt,Xt+=1,st.clipMinMaxHeight=H.fromElements((C.z-b.z)/P,(w.z-b.z)/P,st.clipMinMaxHeight);const it=(b.z-m.z)/P;if(st.ellipsoidInverseHeightDifferenceUv=1/it,m.z===b.z&&(st.ellipsoidInverseHeightDifferenceUv=0),O&&(et.ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE=!0,et.ELLIPSOID_INTERSECTION_INDEX_LONGITUDE=Xt,p?(et.ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_UNDER_HALF=!0,Xt+=1):I?(et.ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_OVER_HALF=!0,Xt+=2):D&&(et.ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_EQUAL_ZERO=!0,Xt+=2),st.ellipsoidRenderLongitudeMinMax=H.fromElements(C.x,w.x,st.ellipsoidRenderLongitudeMinMax)),X)if(et.ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE=!0,b.x<m.x&&(et.ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE_MIN_MAX_REVERSED=!0),V<=u)st.ellipsoidUvToShapeUvLongitude=H.fromElements(0,1,st.ellipsoidUvToShapeUvLongitude);else{const Hi=M/V,Ss=-(m.x-r.x)/V;st.ellipsoidUvToShapeUvLongitude=H.fromElements(Hi,Ss,st.ellipsoidUvToShapeUvLongitude)}if(O){const fi=R.equalsEpsilon(C.x,r.x,void 0,l),Hi=R.equalsEpsilon(w.x,s.x,void 0,l);fi&&(et.ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MIN_DISCONTINUITY=!0),Hi&&(et.ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MAX_DISCONTINUITY=!0);const Ss=(m.x-r.x)/M,Qo=(b.x-r.x)/M,No=(w.x-r.x)/M,Gi=1-S/M,Ni=(No+.5*Gi)%1;st.ellipsoidShapeUvLongitudeMinMaxMid=d.fromElements(Ss,Qo,Ni,st.ellipsoidShapeUvLongitudeMinMaxMid)}if(de&&(re&&(et.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN=!0,et.ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MIN=Xt,Q?(et.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_UNDER_HALF=!0,Xt+=1):le?(et.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_EQUAL_HALF=!0,Xt+=1):pe&&(et.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_OVER_HALF=!0,Xt+=2)),ne&&(et.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX=!0,et.ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MAX=Xt,q?(et.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_UNDER_HALF=!0,Xt+=2):ee?(et.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_EQUAL_HALF=!0,Xt+=1):Y&&(et.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_OVER_HALF=!0,Xt+=1)),st.ellipsoidRenderLatitudeSinMinMax=H.fromElements(Math.sin(C.y),Math.sin(w.y),st.ellipsoidRenderLatitudeSinMinMax)),Dt)if(et.ELLIPSOID_HAS_SHAPE_BOUNDS_LATITUDE=!0,fe<h)st.ellipsoidUvToShapeUvLatitude=H.fromElements(0,1,st.ellipsoidUvToShapeUvLatitude);else{const Hi=(s.y-r.y)/fe,Ss=(r.y-m.y)/fe;st.ellipsoidUvToShapeUvLatitude=H.fromElements(Hi,Ss,st.ellipsoidUvToShapeUvLatitude)}return this.shaderMaximumIntersectionsLength=Xt,!0};const j6=new ce;El.prototype.computeOrientedBoundingBoxForTile=function(e,t,n,i,o){A.typeOf.number("tileLevel",e),A.typeOf.number("tileX",t),A.typeOf.number("tileY",n),A.typeOf.number("tileZ",i),A.typeOf.object("result",o);const r=1/Math.pow(2,e),s=t*r,a=(t+1)*r,l=n*r,u=(n+1)*r,h=i*r,f=(i+1)*r,_=ce.subsection(this._rectangle,s,l,a,u,j6),g=R.lerp(this._minimumHeight,this._maximumHeight,h),m=R.lerp(this._minimumHeight,this._maximumHeight,f);return K1(_,g,m,this._ellipsoid,this._translation,this._rotation,o)};const Iz=new d,Dz=new d,cHe=new d;El.prototype.computeOrientedBoundingBoxForSample=function(e,t,n,i){A.typeOf.object("spatialNode",e),A.typeOf.object("tileDimensions",t),A.typeOf.object("tileUv",n),A.typeOf.object("result",i);const o=1/Math.pow(2,e.level),r=d.divideComponents(d.ONE,t,Iz),s=d.multiplyByScalar(r,o,Iz),a=d.multiplyByScalar(d.fromElements(e.x+n.x,e.y+n.y,e.z+n.z,Dz),o,Dz),l=d.add(a,s,cHe),u=ce.subsection(this._rectangle,a.x,a.y,l.x,l.y,j6),h=R.lerp(this._minimumHeight,this._maximumHeight,a.z),f=R.lerp(this._minimumHeight,this._maximumHeight,l.z);return K1(u,h,f,this._ellipsoid,this._translation,this._rotation,i)};function K1(e,t,n,i,o,r,s){return s=Ct.fromRectangle(e,t,n,i,s),s.center=d.add(s.center,o,s.center),s.halfAxes=$.multiply(s.halfAxes,r,s.halfAxes),s}El.DefaultMinBounds=Object.freeze(new d(-R.PI,-R.PI_OVER_TWO,-ae.WGS84.minimumRadius));El.DefaultMaxBounds=Object.freeze(new d(R.PI,R.PI_OVER_TWO,10*ae.WGS84.maximumRadius));const Ca={BOX:"BOX",ELLIPSOID:"ELLIPSOID",CYLINDER:"CYLINDER"};Ca.getMinBounds=function(e){switch(e){case Ca.BOX:return fs.DefaultMinBounds;case Ca.ELLIPSOID:return El.DefaultMinBounds;case Ca.CYLINDER:return $i.DefaultMinBounds;default:throw new E(`Invalid shape type ${e}`)}};Ca.getMaxBounds=function(e){switch(e){case Ca.BOX:return fs.DefaultMaxBounds;case Ca.ELLIPSOID:return El.DefaultMaxBounds;case Ca.CYLINDER:return $i.DefaultMaxBounds;default:throw new E(`Invalid shape type ${e}`)}};Ca.getShapeConstructor=function(e){switch(e){case Ca.BOX:return fs;case Ca.ELLIPSOID:return El;case Ca.CYLINDER:return $i;default:throw new E(`Invalid shape type ${e}`)}};const ah=Object.freeze(Ca);function wl(e){A.typeOf.object("options",e),A.defined("options.comparator",e.comparator),c(e.maximumLength)&&A.typeOf.number.greaterThanOrEquals("options.maximumLength",e.maximumLength,0),this._comparator=e.comparator,this._maximumLength=e.maximumLength,this._array=c(e.maximumLength)?new Array(e.maximumLength):[],this._length=0}Object.defineProperties(wl.prototype,{length:{get:function(){return this._length}},maximumLength:{get:function(){return this._maximumLength},set:function(e){if(c(e)){for(A.typeOf.number.greaterThanOrEquals("maximumLength",e,0);this._length>e;)this.removeMinimum();this._array.length=e}this._maximumLength=e}},internalArray:{get:function(){return this._array}},comparator:{get:function(){return this._comparator}}});wl.prototype.clone=function(){const e=this._maximumLength,t=this._comparator,n=this._array,i=this._length,o=new wl({comparator:t,maximumLength:e});o._length=i;for(let r=0;r<i;r++)o._array[r]=n[r];return o};wl.prototype.reset=function(){this._length=0;const e=this._maximumLength;if(c(e))for(let t=0;t<e;t++)this._array[t]=void 0;else this._array.length=0};wl.prototype.resort=function(){const e=this._length;for(let t=0;t<e;t++)W6(this,t)};wl.prototype.insert=function(e){let t;const n=this._maximumLength;if(c(n)){if(n===0)return;if(this._length===n){const o=this._array[0];if(this._comparator(e,o)<=0)return e;t=this.removeMinimum()}}const i=this._length;return this._array[i]=e,this._length++,W6(this,i),t};wl.prototype.removeMinimum=function(){const e=this._length;if(e===0)return;this._length--;const t=this._array[0];return e>=2&&(this._array[0]=this._array[e-1],q6(this,0)),this._array[e-1]=void 0,t};wl.prototype.removeMaximum=function(){const e=this._length;if(e===0)return;this._length--;let t;if(e<=2)t=this._array[e-1];else{const n=Z1(this,1,2)?1:2;t=this._array[n],this._array[n]=this._array[e-1],e>=4&&q6(this,n)}return this._array[e-1]=void 0,t};wl.prototype.getMinimum=function(){if(this._length!==0)return this._array[0]};wl.prototype.getMaximum=function(){const e=this._length;if(e!==0)return e<=2?this._array[e-1]:this._array[Z1(this,1,2)?1:2]};function lC(e,t,n){const i=e._array,o=i[t];i[t]=i[n],i[n]=o}function Yy(e,t,n){return e._comparator(e._array[t],e._array[n])<0}function Z1(e,t,n){return e._comparator(e._array[t],e._array[n])>0}function W6(e,t){if(t===0)return;const n=Math.floor(R.log2(t+1))%2===0,i=Math.floor((t-1)/2),o=Yy(e,t,i);for(o!==n&&(lC(e,t,i),t=i);t>=3;){const r=Math.floor((t-3)/4);if(Yy(e,t,r)!==o)break;lC(e,t,r),t=r}}function q6(e,t){const n=e._length,i=Math.floor(R.log2(t+1))%2===0;let o;for(;(o=2*t+1)<n;){let r=o;const s=o+1;if(s<n){Yy(e,s,r)===i&&(r=s);const a=2*o+1,l=Math.max(Math.min(n-a,4),0);for(let u=0;u<l;u++){const h=a+u;Yy(e,h,r)===i&&(r=h)}}if(Yy(e,r,t)===i&&(lC(e,r,t),r!==o&&r!==s)){const a=Math.floor((r-1)/2);Z1(e,r,a)===i&&lC(e,r,a)}t=r}}const Y6=Object.freeze({UNLOADED:0,RECEIVING:1,RECEIVED:2,LOADED:3,FAILED:4,UNAVAILABLE:5});function jn(e,t){this.spatialNode=e,this.keyframe=t,this.state=Y6.UNLOADED,this.metadata=[],this.megatextureIndex=-1,this.priority=-Number.MAX_VALUE,this.highPriorityFrameNumber=-1}jn.priorityComparator=function(e,t){return e.priority-t.priority};jn.searchComparator=function(e,t){return e.keyframe-t.keyframe};jn.LoadState=Y6;function Ld(e,t,n,i,o){i===Ot.UNSIGNED_SHORT&&(i=Ot.FLOAT32);const r=e.floatingPointTexture;if(i===Ot.FLOAT32&&!r)throw new Te("Floating point texture not supported");let s;i===Ot.FLOAT32||i===Ot.FLOAT64?s=Me.FLOAT:i===Ot.UINT8&&(s=Me.UNSIGNED_BYTE);let a;n===1?a=e.webgl2?Ve.RED:Ve.LUMINANCE:n===2?a=e.webgl2?Ve.RG:Ve.LUMINANCE_ALPHA:n===3?a=Ve.RGB:n===4&&(a=Ve.RGBA);const l=512*1024*1024,u=128*1024*1024;o=Math.min(y(o,u),l);const h=pt.maximumTextureSize,f=Ot.getSizeInBytes(i),_=Math.floor(o/(n*f)),g=Math.min(h,R.previousPowerOfTwo(Math.floor(Math.sqrt(_)))),m=Math.ceil(Math.sqrt(t.x)),b=Math.ceil(t.z/m),T=m*t.x,x=b*t.y,C=Math.floor(g/T),w=Math.floor(g/x);if(C===0||w===0)throw new Te("Tileset is too large to fit into megatexture");this.channelCount=n,this.componentType=i,this.voxelCountPerTile=d.clone(t,new d),this.maximumTileCount=C*w,this.regionCountPerMegatexture=new H(C,w),this.voxelCountPerRegion=new H(T,x),this.sliceCountPerRegion=new H(m,b),this.voxelSizeUv=new H(1/g,1/g),this.sliceSizeUv=new H(t.x/g,t.y/g),this.regionSizeUv=new H(T/g,x/g),this.texture=new xt({context:e,pixelFormat:a,pixelDatatype:s,flipY:!1,width:g,height:g,sampler:new un({wrapS:Fn.CLAMP_TO_EDGE,wrapT:Fn.CLAMP_TO_EDGE,minificationFilter:en.LINEAR,magnificationFilter:Yo.LINEAR})});const v=Ot.toComponentDatatype(i);this.tileVoxelDataTemp=Z.createTypedArray(v,T*x*n),this.nodes=new Array(this.maximumTileCount);for(let P=0;P<this.maximumTileCount;P++)this.nodes[P]=new lHe(P);for(let P=0;P<this.maximumTileCount;P++){const N=this.nodes[P];N.previousNode=P>0?this.nodes[P-1]:void 0,N.nextNode=P<this.maximumTileCount-1?this.nodes[P+1]:void 0}this.occupiedList=void 0,this.emptyList=this.nodes[0],this.occupiedCount=0}function lHe(e){this.index=e,this.nextNode=void 0,this.previousNode=void 0}Ld.prototype.add=function(e){if(this.isFull())throw new E("Trying to add when there are no empty spots");const t=this.emptyList;this.emptyList=this.emptyList.nextNode,c(this.emptyList)&&(this.emptyList.previousNode=void 0),t.nextNode=this.occupiedList,c(t.nextNode)&&(t.nextNode.previousNode=t),this.occupiedList=t;const n=t.index;return this.writeDataToTexture(n,e),this.occupiedCount++,n};Ld.prototype.remove=function(e){if(e<0||e>=this.maximumTileCount)throw new E("Megatexture index out of bounds");const t=this.nodes[e];c(t.previousNode)&&(t.previousNode.nextNode=t.nextNode),c(t.nextNode)&&(t.nextNode.previousNode=t.previousNode),t.nextNode=this.emptyList,c(t.nextNode)&&(t.nextNode.previousNode=t),t.previousNode=void 0,this.emptyList=t,this.occupiedCount--};Ld.prototype.isFull=function(){return this.emptyList===void 0};Ld.getApproximateTextureMemoryByteLength=function(e,t,n,i){i===Ot.UNSIGNED_SHORT&&(i=Ot.FLOAT32);const o=Ot.getSizeInBytes(i),r=e*t.x*t.y*t.z,s=Math.ceil(Math.sqrt(t.x)),a=Math.ceil(t.z/s),l=s*t.x,u=a*t.y;let h=R.previousPowerOfTwo(Math.floor(Math.sqrt(r)));for(;;){const _=Math.floor(h/l),g=Math.floor(h/u);if(_*g>=e)break;h*=2}return h*h*n*o};Ld.prototype.writeDataToTexture=function(e,t){const n=t.constructor===Uint16Array?new Float32Array(t):t,i=this.voxelCountPerTile,o=this.sliceCountPerRegion,r=this.voxelCountPerRegion,s=this.channelCount,a=this.tileVoxelDataTemp;for(let b=0;b<i.z;b++){const T=b%o.x*i.x,x=Math.floor(b/o.x)*i.y;for(let C=0;C<i.y;C++)for(let w=0;w<i.x;w++){const v=b*i.y*i.x+C*i.x+w,P=(x+C)*r.x+(T+w);for(let N=0;N<s;N++)a[P*s+N]=n[v*s+N]}}const l=this.regionCountPerMegatexture,u=r.x,h=r.y,f=e%l.x*r.x,_=Math.floor(e/l.x)*r.y,m={source:{arrayBufferView:a,width:u,height:h},xOffset:f,yOffset:_};this.texture.copyFrom(m)};Ld.prototype.isDestroyed=function(){return!1};Ld.prototype.destroy=function(){return this.texture=this.texture&&this.texture.destroy(),ve(this)};function Fc(e,t,n,i,o,r,s){this.children=void 0,this.parent=o,this.level=e,this.x=t,this.y=n,this.z=i,this.dimensions=d.clone(s),this.keyframeNodes=[],this.renderableKeyframeNodes=[],this.renderableKeyframeNodeLerp=0,this.renderableKeyframeNodePrevious=void 0,this.renderableKeyframeNodeNext=void 0,this.orientedBoundingBox=new Ct,this.approximateVoxelSize=0,this.screenSpaceError=0,this.visitedFrameNumber=-1,this.computeBoundingVolumes(r)}const uHe=new d;Fc.prototype.computeBoundingVolumes=function(e){this.orientedBoundingBox=e.computeOrientedBoundingBoxForTile(this.level,this.x,this.y,this.z,this.orientedBoundingBox);const t=$.getScale(this.orientedBoundingBox.halfAxes,uHe),n=2*d.maximumComponent(t);this.approximateVoxelSize=n/d.minimumComponent(this.dimensions)};Fc.prototype.constructChildNodes=function(e){const{level:t,x:n,y:i,z:o}=this,r=n*2,s=i*2,a=o*2,l=s+1,u=r+1,h=a+1,f=t+1,_=[[f,r,s,a],[f,u,s,a],[f,r,l,a],[f,u,l,a],[f,r,s,h],[f,u,s,h],[f,r,l,h],[f,u,l,h]];this.children=_.map(([g,m,b,T])=>new Fc(g,m,b,T,this,e,this.dimensions))};Fc.prototype.visibility=function(e,t){const n=this.orientedBoundingBox;return e.cullingVolume.computeVisibilityWithPlaneMask(n,t)};Fc.prototype.computeScreenSpaceError=function(e,t){const n=this.orientedBoundingBox;let i=Math.sqrt(n.distanceSquaredTo(e));i=Math.max(i,R.EPSILON7);const o=this.approximateVoxelSize,r=t*(o/i);this.screenSpaceError=r};const Pz={keyframe:0};function P0(e,t){return Pz.keyframe=e,Hr(t,Pz,jn.searchComparator)}Fc.prototype.computeSurroundingRenderableKeyframeNodes=function(e){let t=this;const n=t.level,i=Math.floor(e),o=Math.ceil(e);let r,s,a=+Number.MAX_VALUE,l=+Number.MAX_VALUE;for(;c(t);){const{renderableKeyframeNodes:f}=t;if(f.length>=1){const _=dHe(i,f),g=f[_],m=o===i||i<g.keyframe?_:Math.min(_+1,f.length-1),b=f[m],T=i-g.keyframe,x=Oz(n-t.level,T);x<a&&(a=x,r=g);const C=b.keyframe-o,w=Oz(n-t.level,C);if(w<l&&(l=w,s=b),T===0&&C===0)break}t=t.parent}if(this.renderableKeyframeNodePrevious=r,this.renderableKeyframeNodeNext=s,!c(r)||!c(s))return;const u=r.keyframe,h=s.keyframe;this.renderableKeyframeNodeLerp=u===h?0:R.clamp((e-u)/(h-u),0,1)};function dHe(e,t){const n=P0(e,t);return n<0?R.clamp(~n-1,0,t.length-1):n}function Oz(e,t){const n=Math.exp(e*4),i=t>=0?1:-200;return e*n+t*i}Fc.prototype.isVisited=function(e){return this.visitedFrameNumber===e};Fc.prototype.createKeyframeNode=function(e){let t=P0(e,this.keyframeNodes);if(t<0){t=~t;const n=new jn(this,e);this.keyframeNodes.splice(t,0,n)}};Fc.prototype.destroyKeyframeNode=function(e,t){const n=e.keyframe,i=P0(n,this.keyframeNodes);if(i<0)throw new E("Keyframe node does not exist.");if(this.keyframeNodes.splice(i,1),e.megatextureIndex!==-1){for(let r=0;r<t.length;r++)t[r].remove(e.megatextureIndex);const o=P0(n,this.renderableKeyframeNodes);if(o<0)throw new E("Renderable keyframe node does not exist.");this.renderableKeyframeNodes.splice(o,1)}e.spatialNode=void 0,e.state=jn.LoadState.UNLOADED,e.metadata={},e.megatextureIndex=-1,e.priority=-Number.MAX_VALUE,e.highPriorityFrameNumber=-1};Fc.prototype.addKeyframeNodeToMegatextures=function(e,t){if(e.state!==jn.LoadState.RECEIVED||e.megatextureIndex!==-1||e.metadata.length!==t.length)throw new E("Keyframe node cannot be added to megatexture");for(let o=0;o<t.length;o++){const r=t[o];e.megatextureIndex=r.add(e.metadata[o])}e.state=jn.LoadState.LOADED;const n=this.renderableKeyframeNodes;let i=P0(e.keyframe,n);if(i>=0)throw new E("Keyframe already renderable");i=~i,n.splice(i,0,e)};Fc.prototype.isRenderable=function(e){const t=this.renderableKeyframeNodePrevious,n=this.renderableKeyframeNodeNext,i=this.level;return c(t)&&c(n)&&(t.spatialNode.level===i||n.spatialNode.level===i)&&this.visitedFrameNumber===e};function lu(e,t,n,i,o,r,s){this._primitive=e,this.megatextures=new Array(i.length);for(let m=0;m<i.length;m++){const b=i[m],T=bt.getComponentCount(b),x=o[m];this.megatextures[m]=new Ld(t,n,T,x,s)}const a=this.megatextures[0].maximumTileCount;this._simultaneousRequestCount=0,this._debugPrint=!1,this._frameNumber=0;const l=e._shape;this.rootNode=new Fc(0,0,0,0,void 0,l,n),this._priorityQueue=new wl({maximumLength:a,comparator:jn.priorityComparator}),this._highPriorityKeyframeNodes=new Array(a),this._keyframeNodesInMegatexture=new Array(a),this._keyframeCount=r,this._sampleCount=void 0,this._keyframeLocation=0,this._binaryTreeKeyframeWeighting=new Array(r);const u=this._binaryTreeKeyframeWeighting;u[0]=0,u[r-1]=0,oP(u,1,r-2,0);const h=9,f=2048,_=Math.floor(f/h),g=Math.ceil(a/_);this.internalNodeTexture=new xt({context:t,pixelFormat:Ve.RGBA,pixelDatatype:Me.UNSIGNED_BYTE,flipY:!1,width:f,height:g,sampler:new un({minificationFilter:en.NEAREST,magnificationFilter:Yo.NEAREST})}),this.internalNodeTilesPerRow=_,this.internalNodeTexelSizeUv=new H(1/f,1/g),this.leafNodeTexture=void 0,this.leafNodeTilesPerRow=void 0,this.leafNodeTexelSizeUv=new H}lu.prototype.findKeyframeNode=function(e){return this._keyframeNodesInMegatexture.find(function(t){return t.megatextureIndex===e})};function oP(e,t,n,i){if(t>n)return;const o=Math.floor((t+n)/2);e[o]=i,oP(e,t,o-1,i+1),oP(e,o+1,n,i+1)}lu.simultaneousRequestCountMaximum=50;lu.prototype.update=function(e,t,n,i){const o=this._primitive,r=e.context,s=this.megatextures[0].maximumTileCount,a=this._keyframeCount,l=o._levelBlendFactor,u=l>0,h=a>1,f=(u?2:1)*(h?2:1);this._sampleCount=f;const _=f>=2;if(_&&!c(this.leafNodeTexture)){const C=Math.floor(512),w=Math.ceil(s/C);this.leafNodeTexture=new xt({context:r,pixelFormat:Ve.RGBA,pixelDatatype:Me.UNSIGNED_BYTE,flipY:!1,width:1024,height:w,sampler:new un({minificationFilter:en.NEAREST,magnificationFilter:Yo.NEAREST})}),this.leafNodeTexelSizeUv=H.fromElements(1/1024,1/w,this.leafNodeTexelSizeUv),this.leafNodeTilesPerRow=C}else!_&&c(this.leafNodeTexture)&&(this.leafNodeTexture=this.leafNodeTexture.destroy());if(this._keyframeLocation=R.clamp(t,0,a-1),n&&$6(this,this.rootNode),i)return;this._frameNumber=e.frameNumber;const g=xo();pHe(this,e);const m=xo();gHe(this,f,l);const b=xo();if(this._debugPrint){const T=m-g,x=b-m,C=b-g;_He(this,T,x,C)}};lu.prototype.isRenderable=function(e){return e.isRenderable(this._frameNumber)};lu.prototype.isDestroyed=function(){return!1};lu.prototype.destroy=function(){const e=this.megatextures,t=e.length;for(let n=0;n<t;n++)e[n]=e[n]&&e[n].destroy();return this.internalNodeTexture=this.internalNodeTexture&&this.internalNodeTexture.destroy(),this.leafNodeTexture=this.leafNodeTexture&&this.leafNodeTexture.destroy(),ve(this)};function $6(e,t){if(t.computeBoundingVolumes(e._primitive._shape),c(t.children))for(let n=0;n<8;n++){const i=t.children[n];$6(e,i)}}function hHe(e,t){if(e._simultaneousRequestCount>=lu.simultaneousRequestCountMaximum)return;const n=e._primitive._provider;function i(l){e._simultaneousRequestCount--;const u=n.types.length;if(!c(l))t.state=jn.LoadState.UNAVAILABLE;else if(l===jn.LoadState.FAILED)t.state=jn.LoadState.FAILED;else if(!Array.isArray(l)||l.length!==u)t.state=jn.LoadState.FAILED;else{const h=e.megatextures;for(let f=0;f<u;f++){const{voxelCountPerTile:_,channelCount:g}=h[f],{x:m,y:b,z:T}=_,x=m*b*T,C=l[f],w=x*g;if(C.length===w)t.metadata[f]=C,t.state=jn.LoadState.RECEIVED;else{t.state=jn.LoadState.FAILED;break}}}}function o(){e._simultaneousRequestCount--,t.state=jn.LoadState.FAILED}const{keyframe:r,spatialNode:s}=t,a=n.requestData({tileLevel:s.level,tileX:s.x,tileY:s.y,tileZ:s.z,keyframe:r});c(a)?(e._simultaneousRequestCount++,t.state=jn.LoadState.RECEIVING,a.then(i).catch(o)):t.state=jn.LoadState.FAILED}function fHe(e){return e/(1+e)}function pHe(e,t){const n=e._frameNumber,i=e._primitive,o=i._shape,r=i.screenSpaceError,s=e._priorityQueue,a=e._keyframeCount,l=R.clamp(Math.floor(e._keyframeLocation),0,a-2),u=l+1,{camera:h,context:f,pixelRatio:_}=t,{positionWC:g,frustum:m}=h,T=f.drawingBufferHeight/_/m.sseDenominator;function x(B,S){if(B.computeScreenSpaceError(g,T),S=B.visibility(t,S),S===_o.MASK_OUTSIDE)return;if(B.visitedFrameNumber=n,a===1)B.createKeyframeNode(0);else if(B.keyframeNodes.length!==a)for(let F=0;F<a;F++)B.createKeyframeNode(F);const{screenSpaceError:D,keyframeNodes:p}=B,I=fHe(D);let O=!1;for(let F=0;F<p.length;F++){const V=p[F];V.priority=10*I+mHe(l,V.keyframe,u,e),V.state!==jn.LoadState.UNAVAILABLE&&V.state!==jn.LoadState.FAILED&&V.priority!==-Number.MAX_VALUE&&s.insert(V),V.state===jn.LoadState.LOADED&&(O=!0)}if(D<r||!O){B.children=void 0;return}c(B.children)||B.constructChildNodes(o);for(let F=0;F<8;F++){const V=B.children[F];x(V,S)}}s.reset(),x(e.rootNode,_o.MASK_INDETERMINATE);const C=e._highPriorityKeyframeNodes;let w=0,v;for(;s.length>0;)v=s.removeMaximum(),v.highPriorityFrameNumber=n,C[w]=v,w++;const P=e._keyframeNodesInMegatexture,N=e.megatextures[0],k=N.occupiedCount;P.length=k,P.sort(function(B,S){return B.highPriorityFrameNumber===S.highPriorityFrameNumber?S.priority-B.priority:S.highPriorityFrameNumber-B.highPriorityFrameNumber});let M=0,U=0;for(let B=0;B<w;B++)if(v=C[B],!(v.state===jn.LoadState.LOADED||v.spatialNode===void 0)&&(v.state===jn.LoadState.UNLOADED&&hHe(e,v),v.state===jn.LoadState.RECEIVED)){let S=0;if(N.isFull()){S=k-1-M,M++;const D=P[S];D.spatialNode.destroyKeyframeNode(D,e.megatextures)}else S=k+U,U++;v.spatialNode.addKeyframeNodeToMegatextures(v,e.megatextures),P[S]=v}}function mHe(e,t,n,i){const o=Math.min(Math.abs(t-e),Math.abs(t-n)),r=Math.max(e,i._keyframeCount-n-1,1),s=Math.pow(1-o/r,4),a=Math.exp(-i._binaryTreeKeyframeWeighting[t]);return R.lerp(a,s,.15+.85*s)}function _He(e,t,n,i){const o=e._keyframeCount,r=e.rootNode,s=Object.keys(jn.LoadState).length,a=new Array(s),l=new Array(s);let u=0;for(let x=0;x<s;x++){const C=new Array(o);a[x]=C;for(let w=0;w<o;w++)C[w]=0;l[x]=0}function h(x){const C=x.keyframeNodes;for(let w=0;w<C.length;w++){const v=C[w],P=v.keyframe,N=v.state;a[N][P]+=1,l[N]+=1,u++}if(c(x.children))for(let w=0;w<8;w++){const v=x.children[w];h(v)}}h(r);const f=`KEYFRAMES: ${a[jn.LoadState.LOADED]}`,_=`UNLOADED: ${l[jn.LoadState.UNLOADED]} | RECEIVING: ${l[jn.LoadState.RECEIVING]} | RECEIVED: ${l[jn.LoadState.RECEIVED]} | LOADED: ${l[jn.LoadState.LOADED]} | FAILED: ${l[jn.LoadState.FAILED]} | UNAVAILABLE: ${l[jn.LoadState.UNAVAILABLE]} | TOTAL: ${u}`,g=Math.round(t*100)/100,m=Math.round(n*100)/100,b=Math.round(i*100)/100,T=`LOAD: ${g} | OCT: ${m} | ALL: ${b}`;console.log(`${f} || ${_} || ${T}`)}const TA={INTERNAL:0,LEAF:1,PACKED_LEAF_FROM_PARENT:2};function gHe(e,t,n){const i=e._primitive._screenSpaceError,o=e._keyframeLocation,r=e._frameNumber,s=t>=2;let a=0,l=0;const u=[],h=[];function f(g,m,b,T,x){let C=!1;if(c(g.children))for(let w=0;w<8;w++){const v=g.children[w];v.computeSurroundingRenderableKeyframeNodes(o),v.isRenderable(r)&&(C=!0)}if(C){u[x]=TA.INTERNAL<<16|m,u[b]=T,a++,T=m,x=T*9+1;for(let w=0;w<8;w++){const v=g.children[w];m=a,b=m*9+0,f(v,m,b,T,x+w)}}else{if(s){const w=l*5,v=g.renderableKeyframeNodePrevious,P=g.level-v.spatialNode.level,N=v.spatialNode.parent,k=c(N)?N.renderableKeyframeNodePrevious:v,M=yHe(g,i,n),U=P,B=1,S=v.megatextureIndex,D=k.megatextureIndex;h[w+0]=M,h[w+1]=U,h[w+2]=B,h[w+3]=S,h[w+4]=D,u[x]=TA.LEAF<<16|l}else{const w=g.renderableKeyframeNodePrevious,P=g.level-w.spatialNode.level===0?TA.LEAF:TA.PACKED_LEAF_FROM_PARENT;u[x]=P<<16|w.megatextureIndex}l++}}const _=e.rootNode;_.computeSurroundingRenderableKeyframeNodes(o),_.isRenderable(r)&&f(_,0,0,0,0),bHe(u,9,e.internalNodeTilesPerRow,e.internalNodeTexture),s&&THe(h,2,e.leafNodeTilesPerRow,e.leafNodeTexture)}function yHe(e,t,n){if(e.parent===void 0)return 0;const i=e.screenSpaceError,o=e.parent.screenSpaceError,s=((t-i)/(o-i)+n-1)/n;return R.clamp(s,0,1)}function bHe(e,t,n,i){const o=Ve.componentsLength(i.pixelFormat),r=Math.ceil(e.length/t),s=Math.max(1,t*Math.min(r,n)),a=Math.max(1,Math.ceil(r/n)),l=new Uint8Array(s*a*o);for(let f=0;f<e.length;f++){const _=e[f],g=f*o;for(let m=0;m<o;m++)l[g+m]=_>>>m*8&255}const h={source:{arrayBufferView:l,width:s,height:a},xOffset:0,yOffset:0};i.copyFrom(h)}function THe(e,t,n,i){const o=Ve.componentsLength(i.pixelFormat),r=5,s=Math.ceil(e.length/r),a=Math.max(1,t*Math.min(s,n)),l=Math.max(1,Math.ceil(s/n)),u=new Uint8Array(a*l*o);for(let _=0;_<s;_++){const g=e[_*r+0],m=e[_*r+1],b=e[_*r+2],T=e[_*r+3],x=e[_*r+4],C=R.clamp(Math.floor(65536*g),0,65535);u[_*8+0]=C>>>0&255,u[_*8+1]=C>>>8&255,u[_*8+2]=m&255,u[_*8+3]=b&255,u[_*8+4]=T>>>0&255,u[_*8+5]=T>>>8&255,u[_*8+6]=x>>>0&255,u[_*8+7]=x>>>8&255}const f={source:{arrayBufferView:u,width:a,height:l},xOffset:0,yOffset:0};i.copyFrom(f)}lu.getApproximateTextureMemoryByteLength=function(e,t,n,i){let o=0;const r=n.length;for(let s=0;s<r;s++){const a=n[s],l=i[s],u=bt.getComponentCount(a);o+=Ld.getApproximateTextureMemoryByteLength(e,t,u,l)}return o};const AHe={FLOAT:"float",VEC2:"vec2",VEC3:"vec3",VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",MAT2:"mat2",MAT3:"mat3",MAT4:"mat4",SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube"},rP=Object.freeze(AHe);function xHe(e,t,n){const i=new Uint8ClampedArray(e.buffer),o=new ImageData(i,t,n),r=document.createElement("canvas");return r.width=t,r.height=n,r.getContext("2d").putImageData(o,0,0),r}function ag(){this._defaultTexture=void 0,this._textures={},this._loadedImages=[],this._lastUpdatedFrame=-1}ag.prototype.getTexture=function(e){return this._textures[e]};function CHe(e,t,n){n.resource.fetchImage().then(function(i){e._loadedImages.push({id:t,image:i,textureUniform:n})}).catch(function(){const i=e._textures[t];c(i)&&i!==e._defaultTexture&&i.destroy(),e._textures[t]=e._defaultTexture})}ag.prototype.loadTexture2D=function(e,t){c(t.typedArray)?this._loadedImages.push({id:e,textureUniform:t}):CHe(this,e,t)};function EHe(e,t,n){const{id:i,textureUniform:o,image:r}=t,s=n.webgl2?px(o,r,n):wHe(o,r,n),a=e._textures[i];c(a)&&a!==n.defaultTexture&&a.destroy(),e._textures[i]=s}function px(e,t,n){const{typedArray:i,sampler:o}=e,r=c(i)?Q6(e,n):new xt({context:n,source:t,sampler:o});return X6(o)&&r.generateMipmap(),r}function wHe(e,t,n){const{typedArray:i,sampler:o}=e,r=X6(o),s=o.wrapS===Fn.REPEAT||o.wrapS===Fn.MIRRORED_REPEAT||o.wrapT===Fn.REPEAT||o.wrapT===Fn.MIRRORED_REPEAT,{width:a,height:l}=c(i)?e:t,u=[a,l].every(R.isPowerOfTwo);if((r||s)&&!u)if(c(i)){if(e.pixelDatatype===Me.UNSIGNED_BYTE){const f=xHe(i,a,l),_=$I(f);return px({sampler:o},_,n)}}else{const f=$I(t);return px(e,f,n)}else return px(e,t,n);return r?console.warn("Texture requires resizing for mipmaps but pixelDataType cannot be resized. The texture may be rendered incorrectly."):s&&console.warn("Texture requires resizing for wrapping but pixelDataType cannot be resized. The texture may be rendered incorrectly."),Q6(e,n)}function X6(e){return[en.NEAREST_MIPMAP_NEAREST,en.NEAREST_MIPMAP_LINEAR,en.LINEAR_MIPMAP_NEAREST,en.LINEAR_MIPMAP_LINEAR].includes(e.minificationFilter)}function Q6(e,t){const{pixelFormat:n,pixelDatatype:i,width:o,height:r,typedArray:s,sampler:a}=e;return new xt({context:t,pixelFormat:n,pixelDatatype:i,source:{arrayBufferView:s,width:o,height:r},sampler:a,flipY:!1})}ag.prototype.update=function(e){if(e.frameNumber===this._lastUpdatedFrame)return;this._lastUpdatedFrame=e.frameNumber;const t=e.context;this._defaultTexture=t.defaultTexture;const n=this._loadedImages;for(let i=0;i<n.length;i++){const o=n[i];EHe(this,o,t)}n.length=0};ag.prototype.isDestroyed=function(){return!1};ag.prototype.destroy=function(){const e=this._textures;for(const t in e)if(e.hasOwnProperty(t)){const n=e[t];n!==this._defaultTexture&&n.destroy()}return ve(this)};function pb(e){e=y(e,y.EMPTY_OBJECT),this.mode=y(e.mode,RO.MODIFY_MATERIAL),this.lightingModel=e.lightingModel,this.uniforms=y(e.uniforms,y.EMPTY_OBJECT),this.varyings=y(e.varyings,y.EMPTY_OBJECT),this.vertexShaderText=e.vertexShaderText,this.fragmentShaderText=e.fragmentShaderText,this.translucencyMode=y(e.translucencyMode,rD.INHERIT),this._textureManager=new ag,this._defaultTexture=void 0,this.uniformMap=SHe(this),this.usedVariablesVertex={attributeSet:{},featureIdSet:{},metadataSet:{}},this.usedVariablesFragment={attributeSet:{},featureIdSet:{},metadataSet:{},materialSet:{}},DHe(this),PHe(this)}function SHe(e){const t=e.uniforms,n={};for(const i in t)if(t.hasOwnProperty(i)){const o=t[i],r=o.type;if(r===rP.SAMPLER_CUBE)throw new E("CustomShader does not support samplerCube uniforms");r===rP.SAMPLER_2D?(e._textureManager.loadTexture2D(i,o.value),n[i]=vHe(e,i)):n[i]=IHe(e,i)}return n}function vHe(e,t){return function(){return y(e._textureManager.getTexture(t),e._defaultTexture)}}function IHe(e,t){return function(){return e.uniforms[t].value}}function Rf(e,t,n){let i;for(;(i=t.exec(e))!==null;){const o=i[1];n[o]=!0}}function DHe(e){const t=/[vf]sInput\.attributes\.(\w+)/g,n=/[vf]sInput\.featureIds\.(\w+)/g,i=/[vf]sInput\.metadata.(\w+)/g;let o;const r=e.vertexShaderText;c(r)&&(o=e.usedVariablesVertex.attributeSet,Rf(r,t,o),o=e.usedVariablesVertex.featureIdSet,Rf(r,n,o),o=e.usedVariablesVertex.metadataSet,Rf(r,i,o));const s=e.fragmentShaderText;if(c(s)){o=e.usedVariablesFragment.attributeSet,Rf(s,t,o),o=e.usedVariablesFragment.featureIdSet,Rf(s,n,o),o=e.usedVariablesFragment.metadataSet,Rf(s,i,o);const a=/material\.(\w+)/g,l=e.usedVariablesFragment.materialSet;Rf(s,a,l)}}function Lz(e){const t=/^.*MC$/,n=/^.*WC$/,i=/^.*EC$/;return t.test(e)?`${e} (model coordinates)`:n.test(e)?`${e} (Cartesian world coordinates)`:i.test(e)?`${e} (eye coordinates)`:e}function ns(e,t,n,i){if(e.hasOwnProperty(t)){const o=`${Lz(t)} is not available in the ${i} shader. Did you mean ${Lz(n)} instead?`;throw new E(o)}}function PHe(e){const t=e.usedVariablesVertex.attributeSet;ns(t,"position","positionMC","vertex"),ns(t,"normal","normalMC","vertex"),ns(t,"tangent","tangentMC","vertex"),ns(t,"bitangent","bitangentMC","vertex"),ns(t,"positionWC","positionMC","vertex"),ns(t,"positionEC","positionMC","vertex"),ns(t,"normalEC","normalMC","vertex"),ns(t,"tangentEC","tangentMC","vertex"),ns(t,"bitangentEC","bitangentMC","vertex");const n=e.usedVariablesFragment.attributeSet;ns(n,"position","positionEC","fragment"),ns(n,"normal","normalEC","fragment"),ns(n,"tangent","tangentEC","fragment"),ns(n,"bitangent","bitangentEC","fragment"),ns(n,"normalMC","normalEC","fragment"),ns(n,"tangentMC","tangentEC","fragment"),ns(n,"bitangentMC","bitangentEC","fragment")}pb.prototype.setUniform=function(e,t){if(A.typeOf.string("uniformName",e),A.defined("value",t),!c(this.uniforms[e]))throw new E(`Uniform ${e} must be declared in the CustomShader constructor.`);const n=this.uniforms[e];n.type===rP.SAMPLER_2D?this._textureManager.loadTexture2D(e,t):c(t.clone)?n.value=t.clone(n.value):n.value=t};pb.prototype.update=function(e){this._defaultTexture=e.context.defaultTexture,this._textureManager.update(e)};pb.prototype.isDestroyed=function(){return!1};pb.prototype.destroy=function(){this._textureManager=this._textureManager&&this._textureManager.destroy(),ve(this)};function Bc(e){e=y(e,y.EMPTY_OBJECT),this._ready=!1,this._provider=y(e.provider,Bc.DefaultProvider),this._traversal=void 0,this._shape=void 0,this._shapeVisible=!1,this._paddingBefore=new d,this._paddingAfter=new d,this._minBounds=new d,this._minBoundsOld=new d,this._maxBounds=new d,this._maxBoundsOld=new d,this._exaggeratedMinBounds=new d,this._exaggeratedMinBoundsOld=new d,this._exaggeratedMaxBounds=new d,this._exaggeratedMaxBoundsOld=new d,this._minClippingBounds=new d,this._minClippingBoundsOld=new d,this._maxClippingBounds=new d,this._maxClippingBoundsOld=new d,this._clippingPlanes=void 0,this._clippingPlanesState=0,this._clippingPlanesEnabled=!1,this._modelMatrix=L.clone(y(e.modelMatrix,L.IDENTITY)),this._exaggeratedModelMatrix=L.clone(this._modelMatrix),this._compoundModelMatrix=new L,this._compoundModelMatrixOld=new L,this._customShader=y(e.customShader,Bc.DefaultCustomShader),this._customShaderCompilationEvent=new Le,this._shaderDirty=!0,this._drawCommand=void 0,this._drawCommandPick=void 0,this._pickId=void 0,this._clock=e.clock,this._transformPositionWorldToUv=new L,this._transformPositionUvToWorld=new L,this._transformDirectionWorldToLocal=new $,this._transformNormalLocalToWorld=new $,this._jitter=!1,this._nearestSampling=!1,this._levelBlendFactor=0,this._stepSizeMultiplier=1,this._depthTest=!0,this._useLogDepth=void 0,this._screenSpaceError=4,this._debugPolylines=new la,this._debugDraw=!1,this._disableRender=!1,this._disableUpdate=!1,this._uniforms={octreeInternalNodeTexture:void 0,octreeInternalNodeTilesPerRow:0,octreeInternalNodeTexelSizeUv:new H,octreeLeafNodeTexture:void 0,octreeLeafNodeTilesPerRow:0,octreeLeafNodeTexelSizeUv:new H,megatextureTextures:[],megatextureSliceDimensions:new H,megatextureTileDimensions:new H,megatextureVoxelSizeUv:new H,megatextureSliceSizeUv:new H,megatextureTileSizeUv:new H,dimensions:new d,paddingBefore:new d,paddingAfter:new d,transformPositionViewToUv:new L,transformPositionUvToView:new L,transformDirectionViewToLocal:new $,transformNormalLocalToWorld:new $,cameraPositionUv:new d,ndcSpaceAxisAlignedBoundingBox:new te,clippingPlanesTexture:void 0,clippingPlanesMatrix:new L,stepSize:0,pickColor:new z},this._shapeDefinesOld={},this._uniformMap={};const t=this._uniforms,n=this._uniformMap;for(const o in t)if(t.hasOwnProperty(o)){const r=`u_${o}`;n[r]=function(){return t[o]}}const i=this._provider;OHe(this,i)}function OHe(e,t){const{shape:n,minBounds:i=ah.getMinBounds(n),maxBounds:o=ah.getMaxBounds(n)}=t;e.minBounds=i,e.maxBounds=o,e.minClippingBounds=ah.getMinBounds(n),e.maxClippingBounds=ah.getMaxBounds(n),e._exaggeratedMinBounds=d.clone(e._minBounds,e._exaggeratedMinBounds),e._exaggeratedMaxBounds=d.clone(e._maxBounds,e._exaggeratedMaxBounds),e._exaggeratedModelMatrix=L.clone(e._modelMatrix,e._exaggeratedModelMatrix),K6(e,t);const r=ah.getShapeConstructor(n);e._shape=new r,e._shapeVisible=Z6(e,e._shape)}Object.defineProperties(Bc.prototype,{ready:{get:function(){return this._ready}},provider:{get:function(){return this._provider}},boundingSphere:{get:function(){return this._shape.boundingSphere}},orientedBoundingBox:{get:function(){return this._shape.orientedBoundingBox}},modelMatrix:{get:function(){return this._modelMatrix},set:function(e){A.typeOf.object("modelMatrix",e),this._modelMatrix=L.clone(e,this._modelMatrix)}},shape:{get:function(){return this._provider.shape}},dimensions:{get:function(){return this._provider.dimensions}},minimumValues:{get:function(){return this._provider.minimumValues}},maximumValues:{get:function(){return this._provider.maximumValues}},show:{get:function(){return!this._disableRender},set:function(e){A.typeOf.bool("show",e),this._disableRender=!e}},disableUpdate:{get:function(){return this._disableUpdate},set:function(e){A.typeOf.bool("disableUpdate",e),this._disableUpdate=e}},debugDraw:{get:function(){return this._debugDraw},set:function(e){A.typeOf.bool("debugDraw",e),this._debugDraw=e}},depthTest:{get:function(){return this._depthTest},set:function(e){A.typeOf.bool("depthTest",e),this._depthTest!==e&&(this._depthTest=e,this._shaderDirty=!0)}},jitter:{get:function(){return this._jitter},set:function(e){A.typeOf.bool("jitter",e),this._jitter!==e&&(this._jitter=e,this._shaderDirty=!0)}},nearestSampling:{get:function(){return this._nearestSampling},set:function(e){A.typeOf.bool("nearestSampling",e),this._nearestSampling!==e&&(this._nearestSampling=e,this._shaderDirty=!0)}},levelBlendFactor:{get:function(){return this._levelBlendFactor},set:function(e){A.typeOf.number("levelBlendFactor",e),this._levelBlendFactor=R.clamp(e,0,1)}},screenSpaceError:{get:function(){return this._screenSpaceError},set:function(e){A.typeOf.number("screenSpaceError",e),this._screenSpaceError=e}},stepSize:{get:function(){return this._stepSizeMultiplier},set:function(e){A.typeOf.number("stepSize",e),this._stepSizeMultiplier=e}},minBounds:{get:function(){return this._minBounds},set:function(e){A.defined("minBounds",e),this._minBounds=d.clone(e,this._minBounds)}},maxBounds:{get:function(){return this._maxBounds},set:function(e){A.defined("maxBounds",e),this._maxBounds=d.clone(e,this._maxBounds)}},minClippingBounds:{get:function(){return this._minClippingBounds},set:function(e){A.defined("minClippingBounds",e),this._minClippingBounds=d.clone(e,this._minClippingBounds)}},maxClippingBounds:{get:function(){return this._maxClippingBounds},set:function(e){A.defined("maxClippingBounds",e),this._maxClippingBounds=d.clone(e,this._maxClippingBounds)}},clippingPlanes:{get:function(){return this._clippingPlanes},set:function(e){Li.setOwner(e,this,"_clippingPlanes")}},customShader:{get:function(){return this._customShader},set:function(e){if(this._customShader!==e){const t=this._uniformMap,i=this._customShader.uniformMap;for(const o in i)i.hasOwnProperty(o)&&delete t[o];c(e)?this._customShader=e:this._customShader=Bc.DefaultCustomShader,this._shaderDirty=!0}}},customShaderCompilationEvent:{get:function(){return this._customShaderCompilationEvent}}});const LHe=new d,RHe=new te,NHe=new te,MHe=new d,FHe=new d,BHe=new $,zHe=new $,UHe=new L,kHe=new L,VHe=new L,HHe=L.fromRotationTranslation($.fromUniformScale(.5,new $),new d(.5,.5,.5),new L),GHe=L.fromRotationTranslation($.fromUniformScale(2,new $),new d(-1,-1,-1),new L);Bc.prototype.update=function(e){const t=this._provider;this._customShader.update(e);const n=e.context;if(!this._ready){XHe(this,t,n),e.afterRender.push(()=>(this._ready=!0,!0));return}YHe(this,e);const i=K6(this,t),o=this._shape;if(i&&(this._shapeVisible=Z6(this,o),ZHe(this,o)&&(this._shaderDirty=!0)),!this._shapeVisible)return;const r=JHe(t.timeIntervalCollection,this._clock),s=this._traversal,a=s._sampleCount;if(s.update(e,r,i,this._disableUpdate),a!==s._sampleCount&&(this._shaderDirty=!0),!s.isRenderable(s.rootNode)||(this._debugDraw&&a5e(this,e),this._disableRender))return;this._useLogDepth!==e.useLogDepth&&(this._useLogDepth=e.useLogDepth,this._shaderDirty=!0),e5e(this,e)&&(this._shaderDirty=!0);const u=s.leafNodeTexture,h=this._uniforms;c(u)&&(h.octreeLeafNodeTexture=s.leafNodeTexture,h.octreeLeafNodeTexelSizeUv=H.clone(s.leafNodeTexelSizeUv,h.octreeLeafNodeTexelSizeUv),h.octreeLeafNodeTilesPerRow=s.leafNodeTilesPerRow),this._shaderDirty&&(L4e(this,n),this._shaderDirty=!1);const f=n.uniformState.viewProjection,_=o.orientedBoundingBox,g=i5e(_,f,NHe);if(g.x===1||g.y===1||g.z===-1||g.w===-1)return;h.ndcSpaceAxisAlignedBoundingBox=te.clone(g,h.ndcSpaceAxisAlignedBoundingBox);const b=n.uniformState.inverseView;h.transformPositionViewToUv=L.multiplyTransformation(this._transformPositionWorldToUv,b,h.transformPositionViewToUv);const T=n.uniformState.view;h.transformPositionUvToView=L.multiplyTransformation(T,this._transformPositionUvToWorld,h.transformPositionUvToView);const x=n.uniformState.inverseViewRotation;h.transformDirectionViewToLocal=$.multiply(this._transformDirectionWorldToLocal,x,h.transformDirectionViewToLocal),h.transformNormalLocalToWorld=$.clone(this._transformNormalLocalToWorld,h.transformNormalLocalToWorld);const C=e.camera.positionWC;h.cameraPositionUv=L.multiplyByPoint(this._transformPositionWorldToUv,C,h.cameraPositionUv),h.stepSize=this._stepSizeMultiplier;const w=e.passes.pick?this._drawCommandPick:e.passes.pickVoxel?this._drawCommandPickVoxel:this._drawCommand;w.boundingVolume=o.boundingSphere,e.commandList.push(w)};const jHe=new d,Wv=new d,WHe=new he,qHe=new d;function YHe(e,t){if(e._exaggeratedMinBounds=d.clone(e._minBounds,e._exaggeratedMinBounds),e._exaggeratedMaxBounds=d.clone(e._maxBounds,e._exaggeratedMaxBounds),e.shape===ah.ELLIPSOID){const n=t.verticalExaggerationRelativeHeight,i=t.verticalExaggeration;e._exaggeratedMinBounds.z=(e._minBounds.z-n)*i+n,e._exaggeratedMaxBounds.z=(e._maxBounds.z-n)*i+n}else if(e.shape===ah.BOX){const n=d.fromElements(1,1,t.verticalExaggeration,jHe);e._exaggeratedModelMatrix=L.multiplyByScale(e._modelMatrix,n,e._exaggeratedModelMatrix),e._exaggeratedModelMatrix=L.multiplyByTranslation(e._exaggeratedModelMatrix,$He(e,t),e._exaggeratedModelMatrix)}}function $He(e,t){const{shapeTransform:n=L.IDENTITY,globalTransform:i=L.IDENTITY}=e._provider,o=L.getTranslation(n,Wv),r=L.multiplyByPoint(e._modelMatrix,o,Wv),s=L.multiplyByPoint(i,r,Wv),l=ae.WGS84.cartesianToCartographic(s,WHe);let u=0;c(l)&&(u=l.height);const h=oa.getHeight(u,t.verticalExaggeration,t.verticalExaggerationRelativeHeight);return d.fromElements(0,0,(h-u)/t.verticalExaggeration,qHe)}function XHe(e,t,n){const i=e._uniforms;e._pickId=n.createPickId({primitive:e}),i.pickColor=z.clone(e._pickId.color,i.pickColor);const{shaderDefines:o,shaderUniforms:r}=e._shape;e._shapeDefinesOld=Je(o,!0);const s=e._uniformMap;for(const a in r)if(r.hasOwnProperty(a)){const l=`u_${a}`;c(s[l])&&$n(`VoxelPrimitive: Uniform name "${l}" is already defined`),s[l]=function(){return r[a]}}i.dimensions=d.clone(t.dimensions,i.dimensions),e._paddingBefore=d.clone(y(t.paddingBefore,d.ZERO),e._paddingBefore),i.paddingBefore=d.clone(e._paddingBefore,i.paddingBefore),e._paddingAfter=d.clone(y(t.paddingAfter,d.ZERO),e._paddingBefore),i.paddingAfter=d.clone(e._paddingAfter,i.paddingAfter),e._traversal=QHe(e,t,n),KHe(e._traversal,i)}function K6(e,t){const n=y(t.shapeTransform,L.IDENTITY),i=y(t.globalTransform,L.IDENTITY);return L.multiplyTransformation(i,e._exaggeratedModelMatrix,e._compoundModelMatrix),L.multiplyTransformation(e._compoundModelMatrix,n,e._compoundModelMatrix),Nf(e,"_compoundModelMatrix","_compoundModelMatrixOld")+Nf(e,"_minBounds","_minBoundsOld")+Nf(e,"_maxBounds","_maxBoundsOld")+Nf(e,"_exaggeratedMinBounds","_exaggeratedMinBoundsOld")+Nf(e,"_exaggeratedMaxBounds","_exaggeratedMaxBoundsOld")+Nf(e,"_minClippingBounds","_minClippingBoundsOld")+Nf(e,"_maxClippingBounds","_maxClippingBoundsOld")>0}function Nf(e,t,n){const i=e[t],o=e[n],r=!i.equals(o);return r&&i.clone(o),r?1:0}function Z6(e,t,n){if(!t.update(e._compoundModelMatrix,e._exaggeratedMinBounds,e._exaggeratedMaxBounds,e.minClippingBounds,e.maxClippingBounds))return!1;const o=t.shapeTransform,r=L.inverse(o,UHe),s=L.getRotation(o,BHe),a=L.getScale(o,MHe),l=d.maximumComponent(a),u=d.divideByScalar(a,l,FHe),h=$.multiplyByScale(s,u,zHe);return e._transformPositionWorldToUv=L.multiplyTransformation(HHe,r,e._transformPositionWorldToUv),e._transformPositionUvToWorld=L.multiplyTransformation(o,GHe,e._transformPositionUvToWorld),e._transformDirectionWorldToLocal=L.getMatrix3(r,e._transformDirectionWorldToLocal),e._transformNormalLocalToWorld=$.inverseTranspose(h,e._transformNormalLocalToWorld),!0}function QHe(e,t,n){const i=d.clone(t.dimensions,LHe);d.add(i,e._paddingBefore,i),d.add(i,e._paddingAfter,i);const o=t.maximumTileCount,r=c(o)?lu.getApproximateTextureMemoryByteLength(o,i,t.types,t.componentTypes):void 0,s=y(t.keyframeCount,1);return new lu(e,n,i,t.types,t.componentTypes,s,r)}function KHe(e,t){t.octreeInternalNodeTexture=e.internalNodeTexture,t.octreeInternalNodeTexelSizeUv=H.clone(e.internalNodeTexelSizeUv,t.octreeInternalNodeTexelSizeUv),t.octreeInternalNodeTilesPerRow=e.internalNodeTilesPerRow;const n=e.megatextures,i=n[0],o=n.length;t.megatextureTextures=new Array(o);for(let r=0;r<o;r++)t.megatextureTextures[r]=n[r].texture;t.megatextureSliceDimensions=H.clone(i.sliceCountPerRegion,t.megatextureSliceDimensions),t.megatextureTileDimensions=H.clone(i.regionCountPerMegatexture,t.megatextureTileDimensions),t.megatextureVoxelSizeUv=H.clone(i.voxelSizeUv,t.megatextureVoxelSizeUv),t.megatextureSliceSizeUv=H.clone(i.sliceSizeUv,t.megatextureSliceSizeUv),t.megatextureTileSizeUv=H.clone(i.regionSizeUv,t.megatextureTileSizeUv)}function ZHe(e,t){const n=t.shaderDefines,i=Object.keys(n).some(o=>n[o]!==e._shapeDefinesOld[o]);return i&&(e._shapeDefinesOld=Je(n,!0)),i}function JHe(e,t){if(!c(e)||!c(t))return 0;let n=t.currentTime,i,o=e.indexOf(n);o>=0?i=e.get(o):(o=~o,o===e.length?(o=e.length-1,i=e.get(o),n=i.stop):(i=e.get(o),n=i.start));const r=ie.secondsDifference(i.stop,i.start),a=ie.secondsDifference(n,i.start)/r;return o+a}function e5e(e,t){const n=e.clippingPlanes;if(!c(n))return!1;n.update(t);const{clippingPlanesState:i,enabled:o}=n;if(o){const r=e._uniforms;r.clippingPlanesTexture=n.texture,r.clippingPlanesMatrix=L.transpose(L.multiplyTransformation(L.inverse(n.modelMatrix,r.clippingPlanesMatrix),e._transformPositionUvToWorld,r.clippingPlanesMatrix),r.clippingPlanesMatrix)}return e._clippingPlanesState===i&&e._clippingPlanesEnabled===o?!1:(e._clippingPlanesState=i,e._clippingPlanesEnabled=o,!0)}Bc.prototype.isDestroyed=function(){return!1};Bc.prototype.destroy=function(){const e=this._drawCommand;c(e)&&(e.shaderProgram=e.shaderProgram&&e.shaderProgram.destroy());const t=this._drawCommandPick;return c(t)&&(t.shaderProgram=t.shaderProgram&&t.shaderProgram.destroy()),this._pickId=this._pickId&&this._pickId.destroy(),this._traversal=this._traversal&&this._traversal.destroy(),this._clippingPlanes=this._clippingPlanes&&this._clippingPlanes.destroy(),ve(this)};const Rz=new Array(new te(-1,-1,-1,1),new te(1,-1,-1,1),new te(-1,1,-1,1),new te(1,1,-1,1),new te(-1,-1,1,1),new te(1,-1,1,1),new te(-1,1,1,1),new te(1,1,1,1)),t5e=new Array(1,2,4,0,3,5,0,3,6,1,2,7,0,5,6,1,4,7,2,4,7,3,5,6),n5e=new Array(new te,new te,new te,new te,new te,new te,new te,new te);function i5e(e,t,n){const i=L.fromRotationTranslation(e.halfAxes,e.center,kHe),o=L.multiply(t,i,VHe);let r=+Number.MAX_VALUE,s=-Number.MAX_VALUE,a=+Number.MAX_VALUE,l=-Number.MAX_VALUE,u;const h=n5e,f=Rz.length;for(u=0;u<f;u++)L.multiplyByVector(o,Rz[u],h[u]);for(u=0;u<f;u++){const _=h[u];if(_.z>=-_.w){const g=_.x/_.w,m=_.y/_.w;r=Math.min(r,g),s=Math.max(s,g),a=Math.min(a,m),l=Math.max(l,m)}else for(let g=0;g<3;g++){const m=t5e[u*3+g],b=h[m];if(b.z>=-b.w){const T=_.z+_.w,x=b.z+b.w,C=T/(T-x),w=te.lerp(_,b,C,RHe),v=w.x/w.w,P=w.y/w.w;r=Math.min(r,v),s=Math.max(s,v),a=Math.min(a,P),l=Math.max(l,P)}}}return r=R.clamp(r,-1,1),a=R.clamp(a,-1,1),s=R.clamp(s,-1,1),l=R.clamp(l,-1,1),n=te.fromElements(r,a,s,l,n),n}const J1=3e7,o5e=new d(J1,0,0),r5e=new d(0,J1,0),s5e=new d(0,0,J1);function a5e(e,t){const n=e._traversal,i=e._debugPolylines;i.removeAll();function o(l,u,h,f){i.add({positions:[l,u],width:f,material:Se.fromType("Color",{color:h})})}function r(l,u,h){const f=l.computeCorners();o(f[0],f[1],u,h),o(f[2],f[3],u,h),o(f[4],f[5],u,h),o(f[6],f[7],u,h),o(f[0],f[2],u,h),o(f[4],f[6],u,h),o(f[1],f[3],u,h),o(f[5],f[7],u,h),o(f[0],f[4],u,h),o(f[2],f[6],u,h),o(f[1],f[5],u,h),o(f[3],f[7],u,h)}function s(l){if(!n.isRenderable(l))return;const u=l.level,f=Math.max(1,5/Math.pow(2,u)),g=[z.RED,z.LIME,z.BLUE][u%3];if(r(l.orientedBoundingBox,g,f),c(l.children))for(let m=0;m<8;m++)s(l.children[m])}r(e._shape.orientedBoundingBox,z.WHITE,5),s(n.rootNode);const a=10;o(d.ZERO,o5e,z.RED,a),o(d.ZERO,r5e,z.LIME,a),o(d.ZERO,s5e,z.BLUE,a),i.update(t)}Bc.DefaultCustomShader=new pb({fragmentShaderText:`void fragmentMain(FragmentInput fsInput, inout czm_modelMaterial material)
|
|
{
|
|
material.diffuse = vec3(1.0);
|
|
material.alpha = 1.0;
|
|
}`});function J6(){this.ready=!0,this.shape=ah.BOX,this.dimensions=new d(1,1,1),this.names=["data"],this.types=[bt.SCALAR],this.componentTypes=[Ot.FLOAT32],this.maximumTileCount=1}J6.prototype.requestData=function(e){if(!((c(e)?y(e.tileLevel,0):0)>=1))return Promise.resolve([new Float32Array(1)])};Bc.DefaultProvider=new J6;const uC=function(e){return function(){e.frameState.afterRender.push(function(){e.requestRender()})}};function gn(e){e=y(e,y.EMPTY_OBJECT);const t=e.canvas;let n=e.creditContainer,i=e.creditViewport;const o=Je(e.contextOptions);if(!c(t))throw new E("options and options.canvas are required.");const r=c(n),s=new Va(t,o);r||(n=document.createElement("div"),n.style.position="absolute",n.style.bottom="0",n.style["text-shadow"]="0 0 2px #000000",n.style.color="#ffffff",n.style["font-size"]="10px",n.style["padding-right"]="5px",t.parentNode.appendChild(n)),c(i)||(i=t.parentNode),this._id=Wr(),this._jobScheduler=new Sh,this._frameState=new _Be(s,new ki(n," \u2022 ",i),this._jobScheduler),this._frameState.scene3DOnly=y(e.scene3DOnly,!1),this._removeCreditContainer=!r,this._creditContainer=n,this._canvas=t,this._context=s,this._computeEngine=new yC(s),this._globe=void 0,this._globeTranslucencyState=new Wp,this._primitives=new eo,this._groundPrimitives=new eo,this._globeHeight=void 0,this._globeHeightDirty=!0,this._cameraUnderground=!1,this._removeUpdateHeightCallback=void 0,this._logDepthBuffer=gn.defaultLogDepthBuffer&&s.fragmentDepth,this._logDepthBufferDirty=!0,this._tweens=new Wc,this._shaderFrameCount=0,this._sunPostProcess=void 0,this._computeCommandList=[],this._overlayCommandList=[],this._useOIT=y(e.orderIndependentTranslucency,!0),this._executeOITFunction=void 0,this._depthPlane=new lb(e.depthPlaneEllipsoidOffset),this._clearColorCommand=new bi({color:new z,stencil:0,owner:this}),this._depthClearCommand=new bi({depth:1,owner:this}),this._stencilClearCommand=new bi({stencil:0}),this._classificationStencilClearCommand=new bi({stencil:0,renderState:Ue.fromCache({stencilMask:At.CLASSIFICATION_MASK})}),this._depthOnlyRenderStateCache={},this._transitioner=new Qp(this),this._preUpdate=new Le,this._postUpdate=new Le,this._renderError=new Le,this._preRender=new Le,this._postRender=new Le,this._minimumDisableDepthTestDistance=0,this._debugInspector=new V6,this._msaaSamples=y(e.msaaSamples,1),this.rethrowRenderErrors=!1,this.completeMorphOnUserInput=!0,this.morphStart=new Le,this.morphComplete=new Le,this.skyBox=void 0,this.skyAtmosphere=void 0,this.sun=void 0,this.sunBloom=!0,this._sunBloom=void 0,this.moon=void 0,this.backgroundColor=z.clone(z.BLACK),this._mode=oe.SCENE3D,this._mapProjection=c(e.mapProjection)?e.mapProjection:new co,this.morphTime=1,this.farToNearRatio=1e3,this.logarithmicDepthFarToNearRatio=1e9,this.nearToFarDistance2D=175e4,this.verticalExaggeration=1,this.verticalExaggerationRelativeHeight=0,this.debugCommandFilter=void 0,this.debugShowCommands=!1,this.debugShowFrustums=!1,this.debugShowFramesPerSecond=!1,this.debugShowDepthFrustum=1,this.debugShowFrustumPlanes=!1,this._debugShowFrustumPlanes=!1,this._debugFrustumPlanes=void 0,this.useDepthPicking=!0,this.pickTranslucentDepth=!1,this.cameraEventWaitTime=500,this.atmosphere=new OMe,this.fog=new RW,this._shadowMapCamera=new Ye(this),this.shadowMap=new Wa({context:s,lightCamera:this._shadowMapCamera,enabled:y(e.shadows,!1)}),this.invertClassification=!1,this.invertClassificationColor=z.clone(z.WHITE),this._actualInvertClassificationColor=z.clone(this._invertClassificationColor),this._invertClassification=new kl,this.focalLength=void 0,this.eyeSeparation=void 0,this.postProcessStages=new js,this._brdfLutGenerator=new ab,this._performanceDisplay=void 0,this._debugVolume=void 0,this._screenSpaceCameraController=new fb(this),this._cameraUnderground=!1,this._mapMode2D=y(e.mapMode2D,Wh.INFINITE_SCROLL),this._environmentState={skyBoxCommand:void 0,skyAtmosphereCommand:void 0,sunDrawCommand:void 0,sunComputeCommand:void 0,moonCommand:void 0,isSunVisible:!1,isMoonVisible:!1,isReadyForAtmosphere:!1,isSkyAtmosphereVisible:!1,clearGlobeDepth:!1,useDepthPlane:!1,renderTranslucentDepthForPick:!1,originalFramebuffer:void 0,useGlobeDepthFramebuffer:!1,useOIT:!1,useInvertClassification:!1,usePostProcess:!1,usePostProcessSelected:!1,useWebVR:!1},this._useWebVR=!1,this._cameraVR=void 0,this._aspectRatioVR=void 0,this.requestRenderMode=y(e.requestRenderMode,!1),this._renderRequested=!0,this.maximumRenderTimeChange=y(e.maximumRenderTimeChange,0),this._lastRenderTime=void 0,this._frameRateMonitor=void 0,this._removeRequestListenerCallback=Nn.requestCompletedEvent.addEventListener(uC(this)),this._removeTaskProcessorListenerCallback=Kn.taskCompletedEvent.addEventListener(uC(this)),this._removeGlobeCallbacks=[],this._removeTerrainProviderReadyListener=void 0;const a=new Re(0,0,s.drawingBufferWidth,s.drawingBufferHeight),l=new Ye(this);this._logDepthBuffer&&(l.frustum.near=.1,l.frustum.far=1e10),this.preloadFlightCamera=new Ye(this),this.preloadFlightCullingVolume=void 0,this._picking=new Or(this),this._defaultView=new db(this,l,a),this._view=this._defaultView,this._hdr=void 0,this._hdrDirty=void 0,this.highDynamicRange=!1,this.gamma=2.2,this.sphericalHarmonicCoefficients=void 0,this.specularEnvironmentMaps=void 0,this._specularEnvironmentMapAtlas=void 0,this.light=new bC,eq(this,0,ie.now()),this.updateFrameState(),this.initializeFrame()}gn.defaultLogDepthBuffer=!0;function c5e(e,t){for(let i=0;i<e._removeGlobeCallbacks.length;++i)e._removeGlobeCallbacks[i]();e._removeGlobeCallbacks.length=0;const n=[];c(t)&&(n.push(t.imageryLayersUpdatedEvent.addEventListener(uC(e))),n.push(t.terrainProviderChanged.addEventListener(uC(e)))),e._removeGlobeCallbacks=n}Object.defineProperties(gn.prototype,{canvas:{get:function(){return this._canvas}},drawingBufferHeight:{get:function(){return this._context.drawingBufferHeight}},drawingBufferWidth:{get:function(){return this._context.drawingBufferWidth}},maximumAliasedLineWidth:{get:function(){return pt.maximumAliasedLineWidth}},maximumCubeMapSize:{get:function(){return pt.maximumCubeMapSize}},pickPositionSupported:{get:function(){return this._context.depthTexture}},sampleHeightSupported:{get:function(){return this._context.depthTexture}},clampToHeightSupported:{get:function(){return this._context.depthTexture}},invertClassificationSupported:{get:function(){return this._context.depthTexture}},specularEnvironmentMapsSupported:{get:function(){return yl.isSupported(this._context)}},globe:{get:function(){return this._globe},set:function(e){this._globe=this._globe&&this._globe.destroy(),this._globe=e,c5e(this,e)}},primitives:{get:function(){return this._primitives}},groundPrimitives:{get:function(){return this._groundPrimitives}},camera:{get:function(){return this._view.camera},set:function(e){this._view.camera=e}},view:{get:function(){return this._view},set:function(e){this._view=e}},defaultView:{get:function(){return this._defaultView}},picking:{get:function(){return this._picking}},screenSpaceCameraController:{get:function(){return this._screenSpaceCameraController}},mapProjection:{get:function(){return this._mapProjection}},jobScheduler:{get:function(){return this._jobScheduler}},frameState:{get:function(){return this._frameState}},environmentState:{get:function(){return this._environmentState}},tweens:{get:function(){return this._tweens}},imageryLayers:{get:function(){if(!!c(this.globe))return this.globe.imageryLayers}},terrainProvider:{get:function(){if(!!c(this.globe))return this.globe.terrainProvider},set:function(e){this._removeTerrainProviderReadyListener=this._removeTerrainProviderReadyListener&&this._removeTerrainProviderReadyListener(),c(this.globe)&&(this.globe.terrainProvider=e)}},terrainProviderChanged:{get:function(){if(!!c(this.globe))return this.globe.terrainProviderChanged}},preUpdate:{get:function(){return this._preUpdate}},postUpdate:{get:function(){return this._postUpdate}},renderError:{get:function(){return this._renderError}},preRender:{get:function(){return this._preRender}},postRender:{get:function(){return this._postRender}},lastRenderTime:{get:function(){return this._lastRenderTime}},context:{get:function(){return this._context}},debugFrustumStatistics:{get:function(){return this._view.debugFrustumStatistics}},scene3DOnly:{get:function(){return this._frameState.scene3DOnly}},orderIndependentTranslucency:{get:function(){return this._useOIT}},id:{get:function(){return this._id}},mode:{get:function(){return this._mode},set:function(e){if(this.scene3DOnly&&e!==oe.SCENE3D)throw new E("Only SceneMode.SCENE3D is valid when scene3DOnly is true.");if(e===oe.SCENE2D)this.morphTo2D(0);else if(e===oe.SCENE3D)this.morphTo3D(0);else if(e===oe.COLUMBUS_VIEW)this.morphToColumbusView(0);else throw new E("value must be a valid SceneMode enumeration.");this._mode=e}},frustumCommandsList:{get:function(){return this._view.frustumCommandsList}},numberOfFrustums:{get:function(){return this._view.frustumCommandsList.length}},useWebVR:{get:function(){return this._useWebVR},set:function(e){if(this.camera.frustum instanceof It)throw new E("VR is unsupported with an orthographic projection.");this._useWebVR=e,this._useWebVR?(this._frameState.creditDisplay.container.style.visibility="hidden",this._cameraVR=new Ye(this),c(this._deviceOrientationCameraController)||(this._deviceOrientationCameraController=new oE(this)),this._aspectRatioVR=this.camera.frustum.aspectRatio):(this._frameState.creditDisplay.container.style.visibility="visible",this._cameraVR=void 0,this._deviceOrientationCameraController=this._deviceOrientationCameraController&&!this._deviceOrientationCameraController.isDestroyed()&&this._deviceOrientationCameraController.destroy(),this.camera.frustum.aspectRatio=this._aspectRatioVR,this.camera.frustum.xOffset=0)}},mapMode2D:{get:function(){return this._mapMode2D}},splitPosition:{get:function(){return this._frameState.splitPosition},set:function(e){this._frameState.splitPosition=e}},minimumDisableDepthTestDistance:{get:function(){return this._minimumDisableDepthTestDistance},set:function(e){if(!c(e)||e<0)throw new E("minimumDisableDepthTestDistance must be greater than or equal to 0.0.");this._minimumDisableDepthTestDistance=e}},logarithmicDepthBuffer:{get:function(){return this._logDepthBuffer},set:function(e){e=this._context.fragmentDepth&&e,this._logDepthBuffer!==e&&(this._logDepthBuffer=e,this._logDepthBufferDirty=!0)}},gamma:{get:function(){return this._context.uniformState.gamma},set:function(e){this._context.uniformState.gamma=e}},highDynamicRange:{get:function(){return this._hdr},set:function(e){const t=this._context,n=e&&t.depthTexture&&(t.colorBufferFloat||t.colorBufferHalfFloat);this._hdrDirty=n!==this._hdr,this._hdr=n}},highDynamicRangeSupported:{get:function(){const e=this._context;return e.depthTexture&&(e.colorBufferFloat||e.colorBufferHalfFloat)}},cameraUnderground:{get:function(){return this._cameraUnderground}},msaaSamples:{get:function(){return this._msaaSamples},set:function(e){e=Math.min(e,pt.maximumSamples),this._msaaSamples=e}},msaaSupported:{get:function(){return this._context.msaa}},pixelRatio:{get:function(){return this._frameState.pixelRatio},set:function(e){this._frameState.pixelRatio=e}},opaqueFrustumNearOffset:{get:function(){return .9999}},globeHeight:{get:function(){return this._globeHeight}}});gn.prototype.getCompressedTextureFormatSupported=function(e){const t=this.context;return(e==="WEBGL_compressed_texture_s3tc"||e==="s3tc")&&t.s3tc||(e==="WEBGL_compressed_texture_pvrtc"||e==="pvrtc")&&t.pvrtc||(e==="WEBGL_compressed_texture_etc"||e==="etc")&&t.etc||(e==="WEBGL_compressed_texture_etc1"||e==="etc1")&&t.etc1||(e==="WEBGL_compressed_texture_astc"||e==="astc")&&t.astc||(e==="EXT_texture_compression_bptc"||e==="bc7")&&t.bc7};function Nz(e,t,n){const i=e._frameState,o=e._context,r=e._view.oit,s=i.shadowState.lightShadowMaps,a=i.shadowState.lightShadowsEnabled;let l=t.derivedCommands;c(t.pickId)&&(l.picking=sd.createPickDerivedCommand(e,t,o,l.picking)),t.pickOnly||(l.depth=sd.createDepthOnlyDerivedCommand(e,t,o,l.depth)),l.originalCommand=t,e._hdr&&(l.hdr=sd.createHdrCommand(t,o,l.hdr),t=l.hdr.command,l=t.derivedCommands),a&&t.receiveShadows&&(l.shadows=Wa.createReceiveDerivedCommand(s,t,n,o,l.shadows)),t.pass===xe.TRANSLUCENT&&c(r)&&r.isSupported()&&(a&&t.receiveShadows?(l.oit=c(l.oit)?l.oit:{},l.oit.shadows=r.createDerivedCommands(l.shadows.receiveCommand,o,l.oit.shadows)):l.oit=r.createDerivedCommands(t,o,l.oit))}gn.prototype.updateDerivedCommands=function(e){if(!c(e.derivedCommands))return;const t=this._frameState,n=this._context;let i=!1;const o=t.shadowState.lastDirtyTime;e.lastDirtyTime!==o&&(e.lastDirtyTime=o,e.dirty=!0,i=!0);const r=t.useLogDepth,s=this._hdr,a=e.derivedCommands,l=c(a.logDepth),u=c(a.hdr),h=c(a.originalCommand),f=r&&!l,_=s&&!u,g=(!r||!s)&&!h;if(e.dirty=e.dirty||f||_||g,e.dirty){e.dirty=!1;const m=t.shadowState.shadowMaps;t.shadowState.shadowsEnabled&&e.castShadows&&(a.shadows=Wa.createCastDerivedCommand(m,e,i,n,a.shadows)),(l||f)&&(a.logDepth=sd.createLogDepthCommand(e,n,a.logDepth),Nz(this,a.logDepth.command,i)),(h||g)&&Nz(this,e,i)}};const l5e=new jp({pass:wr.RENDER}),qv=new jp({pass:wr.PRELOAD}),Yv=new jp({pass:wr.PRELOAD_FLIGHT}),u5e=new jp({pass:wr.REQUEST_RENDER_MODE_DEFER_CHECK}),Mz=new se;let $v;function d5e(e){const t=e.globe;if(e._mode===oe.SCENE3D&&c(t)&&t.show&&!e._cameraUnderground&&!e._globeTranslucencyState.translucent){const n=t.ellipsoid,i=e.frameState.minimumTerrainHeight;return Mz.radius=n.minimumRadius+i,$v=ms.fromBoundingSphere(Mz,e.camera.positionWC,$v),$v}}gn.prototype.clearPasses=function(e){e.render=!1,e.pick=!1,e.pickVoxel=!1,e.depth=!1,e.postProcess=!1,e.offscreen=!1};function eq(e,t,n){const i=e._frameState;i.frameNumber=t,i.time=ie.clone(n,i.time)}gn.prototype.updateFrameState=function(){const e=this.camera,t=this._frameState;t.commandList.length=0,t.shadowMaps.length=0,t.brdfLutGenerator=this._brdfLutGenerator,t.environmentMap=this.skyBox&&this.skyBox._cubeMap,t.mode=this._mode,t.morphTime=this.morphTime,t.mapProjection=this.mapProjection,t.camera=e,t.cullingVolume=e.frustum.computeCullingVolume(e.positionWC,e.directionWC,e.upWC),t.occluder=d5e(this),t.minimumTerrainHeight=0,t.minimumDisableDepthTestDistance=this._minimumDisableDepthTestDistance,t.invertClassification=this.invertClassification,t.useLogDepth=this._logDepthBuffer&&!(this.camera.frustum instanceof It||this.camera.frustum instanceof Ki),t.light=this.light,t.cameraUnderground=this._cameraUnderground,t.globeTranslucencyState=this._globeTranslucencyState;const{globe:n}=this;c(n)&&n._terrainExaggerationChanged&&(this.verticalExaggeration=n._terrainExaggeration,this.verticalExaggerationRelativeHeight=n._terrainExaggerationRelativeHeight,n._terrainExaggerationChanged=!1),t.verticalExaggeration=this.verticalExaggeration,t.verticalExaggerationRelativeHeight=this.verticalExaggerationRelativeHeight,c(this._specularEnvironmentMapAtlas)&&this._specularEnvironmentMapAtlas.ready?(t.specularEnvironmentMaps=this._specularEnvironmentMapAtlas.texture,t.specularEnvironmentMapsMaximumLOD=this._specularEnvironmentMapAtlas.maximumMipmapLevel):(t.specularEnvironmentMaps=void 0,t.specularEnvironmentMapsMaximumLOD=void 0),t.sphericalHarmonicCoefficients=this.sphericalHarmonicCoefficients,this._actualInvertClassificationColor=z.clone(this.invertClassificationColor,this._actualInvertClassificationColor),kl.isTranslucencySupported(this._context)||(this._actualInvertClassificationColor.alpha=1),t.invertClassificationColor=this._actualInvertClassificationColor,c(this.globe)?t.maximumScreenSpaceError=this.globe.maximumScreenSpaceError:t.maximumScreenSpaceError=2,this.clearPasses(t.passes),t.tilesetPassState=void 0};gn.prototype.isVisible=function(e,t,n){return c(e)&&(!c(e.boundingVolume)||!e.cull||t.computeVisibility(e.boundingVolume)!==Bt.OUTSIDE&&(!c(n)||!e.occlude||!e.boundingVolume.isOccluded(n)))};let mx=new L(0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,1);mx=L.inverseTransformation(mx,mx);function h5e(e,t,n,i){const o=t._frameState,r=o.context,s=e.boundingVolume;c(t._debugVolume)&&t._debugVolume.destroy();let a,l=d.clone(s.center);if(o.mode!==oe.SCENE3D){l=L.multiplyByPoint(mx,l,l);const _=o.mapProjection,g=_.unproject(l);l=_.ellipsoid.cartographicToCartesian(g)}if(c(s.radius)){const _=s.radius;a=ti.toWireframe(va.createGeometry(new va({radii:new d(_,_,_),vertexFormat:tn.FLAT_VERTEX_FORMAT}))),t._debugVolume=new Mt({geometryInstances:new Gt({geometry:a,modelMatrix:L.fromTranslation(l),attributes:{color:new $t(1,0,0,1)}}),appearance:new tn({flat:!0,translucent:!1}),asynchronous:!1})}else{const _=s.halfAxes;a=ti.toWireframe(rr.createGeometry(rr.fromDimensions({dimensions:new d(2,2,2),vertexFormat:tn.FLAT_VERTEX_FORMAT}))),t._debugVolume=new Mt({geometryInstances:new Gt({geometry:a,modelMatrix:L.fromRotationTranslation(_,l,new L),attributes:{color:new $t(1,0,0,1)}}),appearance:new tn({flat:!0,translucent:!1}),asynchronous:!1})}const u=o.commandList,h=o.commandList=[];t._debugVolume.update(o),e=h[0],o.useLogDepth&&(e=sd.createLogDepthCommand(e,r).command);let f;c(i)&&(f=n.framebuffer,n.framebuffer=i),e.execute(r,n),c(f)&&(n.framebuffer=f),o.commandList=u}function Mr(e,t,n,i,o){const r=t._frameState;if(c(t.debugCommandFilter)&&!t.debugCommandFilter(e))return;if(e instanceof bi){e.execute(n,i);return}e.debugShowBoundingVolume&&c(e.boundingVolume)&&h5e(e,t,i,o),r.useLogDepth&&c(e.derivedCommands.logDepth)&&(e=e.derivedCommands.logDepth.command);const s=r.passes;if(!s.pick&&!s.pickVoxel&&!s.depth&&t._hdr&&c(e.derivedCommands)&&c(e.derivedCommands.hdr)&&(e=e.derivedCommands.hdr.command),s.pick||s.depth){if(s.pick&&!s.depth&&c(e.derivedCommands.picking)){e=e.derivedCommands.picking.pickCommand,e.execute(n,i);return}else if(c(e.derivedCommands.depth)){e=e.derivedCommands.depth.depthOnlyCommand,e.execute(n,i);return}}if(t.debugShowCommands||t.debugShowFrustums){t._debugInspector.executeDebugShowFrustumsCommand(t,e,i);return}r.shadowState.lightShadowsEnabled&&e.receiveShadows&&c(e.derivedCommands.shadows)?e.derivedCommands.shadows.receiveCommand.execute(n,i):e.execute(n,i)}function cy(e,t,n,i){const o=t._frameState;let r=e.derivedCommands;!c(r)||(o.useLogDepth&&c(r.logDepth)&&(e=r.logDepth.command),r=e.derivedCommands,c(r.picking)?(e=r.picking.pickCommand,e.execute(n,i)):c(r.depth)&&(e=r.depth.depthOnlyCommand,e.execute(n,i)))}function tq(e,t,n){return t.boundingVolume.distanceSquaredTo(n)-e.boundingVolume.distanceSquaredTo(n)}function f5e(e,t,n){return e.boundingVolume.distanceSquaredTo(n)-t.boundingVolume.distanceSquaredTo(n)+R.EPSILON12}function p5e(e,t,n,i,o){const r=e.context;x1(i,tq,e.camera.positionWC),c(o)&&t(o.unclassifiedCommand,e,r,n);const s=i.length;for(let a=0;a<s;++a)t(i[a],e,r,n)}function m5e(e,t,n,i,o){const r=e.context;x1(i,f5e,e.camera.positionWC),c(o)&&t(o.unclassifiedCommand,e,r,n);const s=i.length;for(let a=0;a<s;++a)t(i[a],e,r,n)}function _5e(e,t,n,i){const o=e.context;x1(i,tq,e.camera.positionWC);const r=i.length;for(let s=0;s<r;++s)t(i[s],e,o,n)}const g5e=new _n,y5e=new xs,b5e=new It,T5e=new Ki;function sP(e,t){const{camera:n,context:i,frameState:o}=e,{uniformState:r}=i;r.updateCamera(n);let s;c(n.frustum.fov)?s=n.frustum.clone(g5e):c(n.frustum.infiniteProjectionMatrix)?s=n.frustum.clone(y5e):c(n.frustum.width)?s=n.frustum.clone(b5e):s=n.frustum.clone(T5e),s.near=n.frustum.near,s.far=n.frustum.far,r.updateFrustum(s),r.updatePass(xe.ENVIRONMENT);const a=o.passes,l=a.pick||a.pickVoxel,u=e._environmentState,h=e._view,f=u.renderTranslucentDepthForPick,_=u.useWebVR;if(!l){const D=u.skyBoxCommand;if(c(D)&&Mr(D,e,i,t),u.isSkyAtmosphereVisible&&Mr(u.skyAtmosphereCommand,e,i,t),u.isSunVisible&&(u.sunDrawCommand.execute(i,t),e.sunBloom&&!_)){let p;u.useGlobeDepthFramebuffer?p=h.globeDepth.framebuffer:u.usePostProcess?p=h.sceneFramebuffer.framebuffer:p=u.originalFramebuffer,e._sunPostProcess.execute(i),e._sunPostProcess.copy(i,p),t.framebuffer=p}u.isMoonVisible&&u.moonCommand.execute(i,t)}let g;u.useOIT?(c(e._executeOITFunction)||(e._executeOITFunction=function(D,p,I,O,F){h.globeDepth.prepareColorTextures(i),h.oit.executeCommands(D,p,I,O,F)}),g=e._executeOITFunction):a.render?g=p5e:g=m5e;const m=h.frustumCommandsList,b=m.length,T=u.clearGlobeDepth,x=u.useDepthPlane,C=e._globeTranslucencyState,w=C.translucent,v=e._view.globeTranslucencyFramebuffer,P=e._depthClearCommand,N=e._stencilClearCommand,k=e._classificationStencilClearCommand,M=e._depthPlane,U=u.usePostProcessSelected,B=n.position.z;let S;for(let D=0;D<b;++D){const p=b-D-1,I=m[p];e.mode===oe.SCENE2D?(n.position.z=B-I.near+1,s.far=Math.max(1,I.far-I.near),s.near=1,r.update(o),r.updateFrustum(s)):(s.near=p!==0?I.near*e.opaqueFrustumNearOffset:I.near,s.far=I.far,r.updateFrustum(s)),P.execute(i,t),i.stencilBuffer&&N.execute(i,t),r.updatePass(xe.GLOBE);let O=I.commands[xe.GLOBE],F=I.indices[xe.GLOBE];if(w)C.executeGlobeCommands(I,Mr,v,e,t);else for(S=0;S<F;++S)Mr(O[S],e,i,t);const V=h.globeDepth;if(c(V)&&u.useGlobeDepthFramebuffer&&V.executeCopyDepth(i,t),!u.renderTranslucentDepthForPick)if(r.updatePass(xe.TERRAIN_CLASSIFICATION),O=I.commands[xe.TERRAIN_CLASSIFICATION],F=I.indices[xe.TERRAIN_CLASSIFICATION],w)C.executeGlobeClassificationCommands(I,Mr,v,e,t);else for(S=0;S<F;++S)Mr(O[S],e,i,t);if(T&&(P.execute(i,t),x&&M.execute(i,t)),!u.useInvertClassification||l||u.renderTranslucentDepthForPick){for(r.updatePass(xe.CESIUM_3D_TILE),O=I.commands[xe.CESIUM_3D_TILE],F=I.indices[xe.CESIUM_3D_TILE],S=0;S<F;++S)Mr(O[S],e,i,t);if(F>0&&(c(V)&&u.useGlobeDepthFramebuffer&&(V.prepareColorTextures(i,T),V.executeUpdateDepth(i,t,T,V.depthStencilTexture)),!u.renderTranslucentDepthForPick))for(r.updatePass(xe.CESIUM_3D_TILE_CLASSIFICATION),O=I.commands[xe.CESIUM_3D_TILE_CLASSIFICATION],F=I.indices[xe.CESIUM_3D_TILE_CLASSIFICATION],S=0;S<F;++S)Mr(O[S],e,i,t)}else{e._invertClassification.clear(i,t);const X=t.framebuffer;for(t.framebuffer=e._invertClassification._fbo.framebuffer,r.updatePass(xe.CESIUM_3D_TILE),O=I.commands[xe.CESIUM_3D_TILE],F=I.indices[xe.CESIUM_3D_TILE],S=0;S<F;++S)Mr(O[S],e,i,t);for(c(V)&&u.useGlobeDepthFramebuffer&&(e._invertClassification.prepareTextures(i),V.executeUpdateDepth(i,t,T,e._invertClassification._fbo.getDepthStencilTexture())),r.updatePass(xe.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW),O=I.commands[xe.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW],F=I.indices[xe.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW],S=0;S<F;++S)Mr(O[S],e,i,t);for(t.framebuffer=X,e._invertClassification.executeClassified(i,t),o.invertClassificationColor.alpha===1&&e._invertClassification.executeUnclassified(i,t),F>0&&i.stencilBuffer&&k.execute(i,t),r.updatePass(xe.CESIUM_3D_TILE_CLASSIFICATION),O=I.commands[xe.CESIUM_3D_TILE_CLASSIFICATION],F=I.indices[xe.CESIUM_3D_TILE_CLASSIFICATION],S=0;S<F;++S)Mr(O[S],e,i,t)}for(F>0&&i.stencilBuffer&&N.execute(i,t),r.updatePass(xe.VOXELS),O=I.commands[xe.VOXELS],F=I.indices[xe.VOXELS],O.length=F,_5e(e,Mr,t,O),r.updatePass(xe.OPAQUE),O=I.commands[xe.OPAQUE],F=I.indices[xe.OPAQUE],S=0;S<F;++S)Mr(O[S],e,i,t);p!==0&&e.mode!==oe.SCENE2D&&(s.near=I.near,r.updateFrustum(s));let G;if(!l&&u.useInvertClassification&&o.invertClassificationColor.alpha<1&&(G=e._invertClassification),r.updatePass(xe.TRANSLUCENT),O=I.commands[xe.TRANSLUCENT],O.length=I.indices[xe.TRANSLUCENT],g(e,Mr,t,O,G),I.indices[xe.CESIUM_3D_TILE_CLASSIFICATION]>0&&h.translucentTileClassification.isSupported()&&(h.translucentTileClassification.executeTranslucentCommands(e,Mr,t,O,V.depthStencilTexture),h.translucentTileClassification.executeClassificationCommands(e,Mr,t,I)),i.depthTexture&&e.useDepthPicking&&(u.useGlobeDepthFramebuffer||f)){const X=V.depthStencilTexture,q=e._picking.getPickDepth(e,p);q.update(i,X),q.executeCopyDepth(i,t)}if(l||!U)continue;const W=t.framebuffer;if(t.framebuffer=h.sceneFramebuffer.getIdFramebuffer(),s.near=p!==0?I.near*e.opaqueFrustumNearOffset:I.near,s.far=I.far,r.updateFrustum(s),r.updatePass(xe.GLOBE),O=I.commands[xe.GLOBE],F=I.indices[xe.GLOBE],w)C.executeGlobeCommands(I,cy,v,e,t);else for(S=0;S<F;++S)cy(O[S],e,i,t);for(T&&(P.framebuffer=t.framebuffer,P.execute(i,t),P.framebuffer=void 0),T&&x&&M.execute(i,t),r.updatePass(xe.CESIUM_3D_TILE),O=I.commands[xe.CESIUM_3D_TILE],F=I.indices[xe.CESIUM_3D_TILE],S=0;S<F;++S)cy(O[S],e,i,t);for(r.updatePass(xe.OPAQUE),O=I.commands[xe.OPAQUE],F=I.indices[xe.OPAQUE],S=0;S<F;++S)cy(O[S],e,i,t);for(r.updatePass(xe.TRANSLUCENT),O=I.commands[xe.TRANSLUCENT],F=I.indices[xe.TRANSLUCENT],S=0;S<F;++S)cy(O[S],e,i,t);t.framebuffer=W}}function nq(e){e.context.uniformState.updatePass(xe.COMPUTE);const n=e._environmentState.sunComputeCommand;c(n)&&n.execute(e._computeEngine);const i=e._computeCommandList,o=i.length;for(let r=0;r<o;++r)i[r].execute(e._computeEngine)}function A5e(e,t){e.context.uniformState.updatePass(xe.OVERLAY);const i=e.context,o=e._overlayCommandList,r=o.length;for(let s=0;s<r;++s)o[s].execute(i,t)}function x5e(e,t,n){const i=n.shadowMapCullingVolume,o=n.isPointLight,r=n.passes,s=r.length,a=t.length;for(let l=0;l<a;++l){const u=t[l];if(e.updateDerivedCommands(u),u.castShadows&&(u.pass===xe.GLOBE||u.pass===xe.CESIUM_3D_TILE||u.pass===xe.OPAQUE||u.pass===xe.TRANSLUCENT)&&e.isVisible(u,i))if(o)for(let h=0;h<s;++h)r[h].commandList.push(u);else if(s===1)r[0].commandList.push(u);else{let h=!1;for(let f=s-1;f>=0;--f){const _=r[f].cullingVolume;if(e.isVisible(u,_))r[f].commandList.push(u),h=!0;else if(h)break}}}}function iq(e){const t=e.frameState,n=t.shadowState.shadowMaps,i=n.length;if(!t.shadowState.shadowsEnabled)return;const o=e.context,r=o.uniformState;for(let s=0;s<i;++s){const a=n[s];if(a.outOfView)continue;const l=a.passes,u=l.length;for(let f=0;f<u;++f)l[f].commandList.length=0;const h=e.frameState.commandList;x5e(e,h,a);for(let f=0;f<u;++f){const _=a.passes[f];r.updateCamera(_.camera),a.updatePass(o,f);const g=_.commandList.length;for(let m=0;m<g;++m){const b=_.commandList[m];r.updatePass(b.pass),Mr(b.derivedCommands.shadows.castCommands[s],e,o,_.passState)}}}}const C5e=new d;gn.prototype.updateAndExecuteCommands=function(e,t){const i=this._frameState.mode;this._environmentState.useWebVR?E5e(this,e,t):i!==oe.SCENE2D||this._mapMode2D===Wh.ROTATE?nh(!0,this,e,t):(eL(this,e,t),R5e(this,e))};function E5e(e,t,n){const i=e._view,o=i.camera,s=e._environmentState.renderTranslucentDepthForPick;eL(e,t,n),oq(e),i.createPotentiallyVisibleSet(e),nq(e),s||iq(e);const a=t.viewport;a.x=0,a.y=0,a.width=a.width*.5;const l=Ye.clone(o,e._cameraVR);l.frustum=o.frustum;const u=o.frustum.near,h=u*y(e.focalLength,5),f=y(e.eyeSeparation,h/30),_=d.multiplyByScalar(l.right,f*.5,C5e);o.frustum.aspectRatio=a.width/a.height;const g=.5*f*u/h;d.add(l.position,_,o.position),o.frustum.xOffset=g,sP(e,t),a.x=a.width,d.subtract(l.position,_,o.position),o.frustum.xOffset=-g,sP(e,t),Ye.clone(l,o)}const w5e=new he(Math.PI,R.PI_OVER_TWO),S5e=new d,v5e=new d,I5e=new L,D5e=new L,P5e=new d,O5e=new d,L5e=new Re;function R5e(e,t){const n=e.context,i=e.frameState,o=e.camera,r=t.viewport,s=Re.clone(r,L5e);t.viewport=s;const a=w5e,l=S5e;e.mapProjection.project(a,l);const h=d.clone(o.position,v5e),f=L.clone(o.transform,D5e),_=o.frustum.clone();o._setTransform(L.IDENTITY);const g=L.computeViewportTransformation(s,0,1,I5e),m=o.frustum.projectionMatrix,b=o.positionWC.y,T=d.fromElements(R.sign(b)*l.x-b,0,-o.positionWC.x,P5e),x=zt.pointToGLWindowCoordinates(m,g,T,O5e);x.x=Math.floor(x.x);const C=s.x,w=s.width;if(b===0||x.x<=C||x.x>=C+w)nh(!0,e,t);else if(Math.abs(C+w*.5-x.x)<1)s.width=x.x-s.x,o.position.x*=R.sign(o.position.x),o.frustum.right=0,i.cullingVolume=o.frustum.computeCullingVolume(o.positionWC,o.directionWC,o.upWC),n.uniformState.update(i),nh(!0,e,t),s.x=x.x,o.position.x=-o.position.x,o.frustum.right=-o.frustum.left,o.frustum.left=0,i.cullingVolume=o.frustum.computeCullingVolume(o.positionWC,o.directionWC,o.upWC),n.uniformState.update(i),nh(!1,e,t);else if(x.x>C+w*.5){s.width=x.x-C;const v=o.frustum.right;o.frustum.right=l.x-b,i.cullingVolume=o.frustum.computeCullingVolume(o.positionWC,o.directionWC,o.upWC),n.uniformState.update(i),nh(!0,e,t),s.x=x.x,s.width=C+w-x.x,o.position.x=-o.position.x,o.frustum.left=-o.frustum.right,o.frustum.right=v-o.frustum.right*2,i.cullingVolume=o.frustum.computeCullingVolume(o.positionWC,o.directionWC,o.upWC),n.uniformState.update(i),nh(!1,e,t)}else{s.x=x.x,s.width=C+w-x.x;const v=o.frustum.left;o.frustum.left=-l.x-b,i.cullingVolume=o.frustum.computeCullingVolume(o.positionWC,o.directionWC,o.upWC),n.uniformState.update(i),nh(!0,e,t),s.x=C,s.width=x.x-C,o.position.x=-o.position.x,o.frustum.right=-o.frustum.left,o.frustum.left=v-o.frustum.left*2,i.cullingVolume=o.frustum.computeCullingVolume(o.positionWC,o.directionWC,o.upWC),n.uniformState.update(i),nh(!1,e,t)}o._setTransform(f),d.clone(h,o.position),o.frustum=_.clone(),t.viewport=r}function nh(e,t,n,i){const o=t._environmentState,r=t._view,s=o.renderTranslucentDepthForPick;e||(t.frameState.commandList.length=0),oq(t),r.createPotentiallyVisibleSet(t),e&&(c(i)&&eL(t,n,i),nq(t),s||iq(t)),sP(t,n)}const Fz=new _o;gn.prototype.updateEnvironment=function(){const e=this._frameState,t=this._view,n=this._environmentState,i=e.passes.render,o=e.passes.offscreen,r=this.atmosphere,s=this.skyAtmosphere,a=this.globe,l=this._globeTranslucencyState;if(!i||this._mode!==oe.SCENE2D&&t.camera.frustum instanceof It||!l.environmentVisible)n.skyAtmosphereCommand=void 0,n.skyBoxCommand=void 0,n.sunDrawCommand=void 0,n.sunComputeCommand=void 0,n.moonCommand=void 0;else{if(c(s)){if(c(a))s.setDynamicLighting(aW.fromGlobeFlags(a)),n.isReadyForAtmosphere=n.isReadyForAtmosphere||!a.show||a._surface._tilesToRender.length>0;else{const x=r.dynamicLighting;s.setDynamicLighting(x),n.isReadyForAtmosphere=!0}n.skyAtmosphereCommand=s.update(e,a),c(n.skyAtmosphereCommand)&&this.updateDerivedCommands(n.skyAtmosphereCommand)}else n.skyAtmosphereCommand=void 0;n.skyBoxCommand=c(this.skyBox)?this.skyBox.update(e,this._hdr):void 0;const T=c(this.sun)?this.sun.update(e,t.passState,this._hdr):void 0;n.sunDrawCommand=c(T)?T.drawCommand:void 0,n.sunComputeCommand=c(T)?T.computeCommand:void 0,n.moonCommand=c(this.moon)?this.moon.update(e):void 0}const u=n.clearGlobeDepth=c(a)&&a.show&&(!a.depthTestAgainstTerrain||this.mode===oe.SCENE2D);(n.useDepthPlane=u&&this.mode===oe.SCENE3D&&l.useDepthPlane)&&this._depthPlane.update(e),n.renderTranslucentDepthForPick=!1,n.useWebVR=this._useWebVR&&this.mode!==oe.SCENE2D&&!o;const f=e.mode===oe.SCENE3D&&!l.sunVisibleThroughGlobe?e.occluder:void 0;let _=e.cullingVolume;const g=Fz.planes;for(let T=0;T<5;++T)g[T]=_.planes[T];_=Fz,n.isSkyAtmosphereVisible=c(n.skyAtmosphereCommand)&&n.isReadyForAtmosphere,n.isSunVisible=this.isVisible(n.sunDrawCommand,_,f),n.isMoonVisible=this.isVisible(n.moonCommand,_,f);const m=this.specularEnvironmentMaps;let b=this._specularEnvironmentMapAtlas;c(m)&&(!c(b)||b.url!==m)?(b=b&&b.destroy(),this._specularEnvironmentMapAtlas=new yl(m)):!c(m)&&c(b)&&(b.destroy(),this._specularEnvironmentMapAtlas=void 0),c(this._specularEnvironmentMapAtlas)&&this._specularEnvironmentMapAtlas.update(e)};function N5e(e){const t=e._frameState;e.debugShowFrustumPlanes!==e._debugShowFrustumPlanes&&(e.debugShowFrustumPlanes?e._debugFrustumPlanes=new ph({camera:e.camera,updateOnChange:!1,frustumSplits:t.frustumSplits}):e._debugFrustumPlanes=e._debugFrustumPlanes&&e._debugFrustumPlanes.destroy(),e._debugShowFrustumPlanes=e.debugShowFrustumPlanes),c(e._debugFrustumPlanes)&&e._debugFrustumPlanes.update(t)}function M5e(e){const t=e._frameState,n=t.shadowMaps,i=n.length,o=i>0&&!t.passes.pick&&!t.passes.pickVoxel&&e.mode===oe.SCENE3D;if(o!==t.shadowState.shadowsEnabled&&(++t.shadowState.lastDirtyTime,t.shadowState.shadowsEnabled=o),t.shadowState.lightShadowsEnabled=!1,!!o){for(let r=0;r<i;++r)if(n[r]!==t.shadowState.shadowMaps[r]){++t.shadowState.lastDirtyTime;break}t.shadowState.shadowMaps.length=0,t.shadowState.lightShadowMaps.length=0;for(let r=0;r<i;++r){const s=n[r];s.update(t),t.shadowState.shadowMaps.push(s),s.fromLightSource&&(t.shadowState.lightShadowMaps.push(s),t.shadowState.lightShadowsEnabled=!0),s.dirty&&(++t.shadowState.lastDirtyTime,s.dirty=!1)}}}function oq(e){const t=e._frameState;e._groundPrimitives.update(t),e._primitives.update(t),N5e(e),M5e(e),e._globe&&e._globe.render(t)}function eL(e,t,n){const i=e._context,o=e._frameState,r=e._environmentState,s=e._view,a=e._frameState.passes,l=a.pick||a.pickVoxel;c(s.globeDepth)&&(s.globeDepth.picking=l);const u=r.useWebVR;r.originalFramebuffer=t.framebuffer,c(e.sun)&&e.sunBloom!==e._sunBloom?(e.sunBloom&&!u?e._sunPostProcess=new Od:c(e._sunPostProcess)&&(e._sunPostProcess=e._sunPostProcess.destroy()),e._sunBloom=e.sunBloom):!c(e.sun)&&c(e._sunPostProcess)&&(e._sunPostProcess=e._sunPostProcess.destroy(),e._sunBloom=!1);const h=e._clearColorCommand;z.clone(n,h.color),h.execute(i,t);const f=r.useGlobeDepthFramebuffer=c(s.globeDepth);f&&(s.globeDepth.update(i,t,s.viewport,e.msaaSamples,e._hdr,r.clearGlobeDepth),s.globeDepth.clear(i,t,n));const _=s.oit,g=r.useOIT=!l&&c(_)&&_.isSupported();g&&(_.update(i,t,s.globeDepth.colorFramebufferManager,e._hdr,e.msaaSamples),_.clear(i,t,n),r.useOIT=_.isSupported());const m=e.postProcessStages;let b=r.usePostProcess=!l&&(e._hdr||m.length>0||m.ambientOcclusion.enabled||m.fxaa.enabled||m.bloom.enabled);if(r.usePostProcessSelected=!1,b&&(s.sceneFramebuffer.update(i,s.viewport,e._hdr,e.msaaSamples),s.sceneFramebuffer.clear(i,t,n),m.update(i,o.useLogDepth,e._hdr),m.clear(i),b=r.usePostProcess=m.ready,r.usePostProcessSelected=b&&m.hasSelected),r.isSunVisible&&e.sunBloom&&!u?(t.framebuffer=e._sunPostProcess.update(t),e._sunPostProcess.clear(i,t,n)):f?t.framebuffer=s.globeDepth.framebuffer:b&&(t.framebuffer=s.sceneFramebuffer.framebuffer),c(t.framebuffer)&&h.execute(i,t),r.useInvertClassification=!l&&c(t.framebuffer)&&e.invertClassification){let x;if(e.frameState.invertClassificationColor.alpha===1&&r.useGlobeDepthFramebuffer&&(x=s.globeDepth.framebuffer),c(x)||i.depthTexture){if(e._invertClassification.previousFramebuffer=x,e._invertClassification.update(i,e.msaaSamples,s.globeDepth.colorFramebufferManager),e._invertClassification.clear(i,t),e.frameState.invertClassificationColor.alpha<1&&g){const C=e._invertClassification.unclassifiedCommand,w=C.derivedCommands;w.oit=_.createDerivedCommands(C,i,w.oit)}}else r.useInvertClassification=!1}e._globeTranslucencyState.translucent&&s.globeTranslucencyFramebuffer.updateAndClear(e._hdr,s.viewport,i,t)}gn.prototype.resolveFramebuffers=function(e){const t=this._context,n=this._environmentState,i=this._view,o=i.globeDepth;c(o)&&o.prepareColorTextures(t);const r=n.useOIT,s=n.useGlobeDepthFramebuffer,a=n.usePostProcess,l=n.originalFramebuffer,u=s?o.colorFramebufferManager:void 0,h=i.sceneFramebuffer._colorFramebuffer,f=i.sceneFramebuffer.idFramebuffer;r&&(e.framebuffer=a?h.framebuffer:l,i.oit.execute(t,e));const _=i.translucentTileClassification;if(_.hasTranslucentDepth&&_.isSupported()&&_.execute(this,e),a){i.sceneFramebuffer.prepareColorTextures(t);let g=h;s&&!r&&(g=u);const m=this.postProcessStages,b=g.getColorTexture(0),T=f.getColorTexture(0),x=y(u,h).getDepthStencilTexture();m.execute(t,b,x,T),m.copy(t,l)}!r&&!a&&s&&(e.framebuffer=l,o.executeCopyColor(t,e))};function F5e(e){const t=e._frameState.afterRender;for(let n=0,i=t.length;n<i;++n)t[n]()&&e.requestRender();t.length=0}function B5e(e){if(e.mode===oe.MORPHING)return;const n=e.camera.positionCartographic;return e.getHeight(n)}gn.prototype.getHeight=function(e,t){if(!c(e))return;const n=t===gt.CLAMP_TO_TERRAIN||t===gt.RELATIVE_TO_TERRAIN,i=t===gt.CLAMP_TO_3D_TILE||t===gt.RELATIVE_TO_3D_TILE;if(!c(e))return;let o=Number.NEGATIVE_INFINITY;if(!n){const s=this.primitives.length;for(let a=0;a<s;++a){const l=this.primitives.get(a);if(!l.isCesium3DTileset||!l.show||!l.enableCollision)continue;const u=l.getHeight(e,this);c(u)&&u>o&&(o=u)}}const r=this._globe;if(!i&&c(r)&&r.show){const s=r.getHeight(e);s>o&&(o=s)}if(o>Number.NEGATIVE_INFINITY)return o};const Xv=new he;gn.prototype.updateHeight=function(e,t,n){var g;A.typeOf.func("callback",t);const i=()=>{he.clone(e,Xv);const m=this.getHeight(e,n);c(m)&&(Xv.height=m,t(Xv))},o=n===gt.CLAMP_TO_TERRAIN||n===gt.RELATIVE_TO_TERRAIN,r=n===gt.CLAMP_TO_3D_TILE||n===gt.RELATIVE_TO_3D_TILE;let s;!r&&c(this.globe)&&(s=this.globe._surface.updateHeight(e,i));let a={};const l=(g=this.globe)==null?void 0:g.ellipsoid,u=m=>{if(o||m.isDestroyed()||!m.isCesium3DTileset)return;const b=m.updateHeight(e,i,l);a[m.id]=b};if(!o){const m=this.primitives.length;for(let b=0;b<m;++b){const T=this.primitives.get(b);u(T)}}const h=this.primitives.primitiveAdded.addEventListener(u),f=this.primitives.primitiveRemoved.addEventListener(m=>{m.isDestroyed()||!m.isCesium3DTileset||(c(a[m.id])&&a[m.id](),delete a[m.id])});return()=>{s=s&&s(),Object.values(a).forEach(m=>m()),a={},h(),f()}};function z5e(e){const t=e.camera,n=e._mode,i=e._screenSpaceCameraController,o=t.positionCartographic;if(!c(o))return!1;if(!i.onMap()&&o.height<0)return!0;if(n===oe.SCENE2D||n===oe.MORPHING)return!1;const r=e._globeHeight;return c(r)&&o.height<r}gn.prototype.initializeFrame=function(){if(this._shaderFrameCount++===120&&(this._shaderFrameCount=0,this._context.shaderCache.destroyReleasedShaderPrograms(),this._context.textureCache.destroyReleasedTextures()),this._tweens.update(),this._globeHeightDirty){c(this._removeUpdateHeightCallback)&&(this._removeUpdateHeightCallback(),this._removeUpdateHeightCallback=void 0),this._globeHeight=B5e(this),this._globeHeightDirty=!1;const e=this.camera.positionCartographic;this._removeUpdateHeightCallback=this.updateHeight(e,t=>{this.isDestroyed()||(this._globeHeight=t.height)})}this._cameraUnderground=z5e(this),this._globeTranslucencyState.update(this),this._screenSpaceCameraController.update(),c(this._deviceOrientationCameraController)&&this._deviceOrientationCameraController.update(),this.camera.update(this._mode),this.camera._updateCameraChanged()};function U5e(e,t){if(e.debugShowFramesPerSecond){if(!c(e._performanceDisplay)){const n=document.createElement("div");n.className="cesium-performanceDisplay-defaultContainer",e._canvas.parentNode.appendChild(n);const o=new rE({container:n});e._performanceDisplay=o,e._performanceContainer=n}e._performanceDisplay.throttled=e.requestRenderMode,e._performanceDisplay.update(t)}else c(e._performanceDisplay)&&(e._performanceDisplay=e._performanceDisplay&&e._performanceDisplay.destroy(),e._performanceContainer.parentNode.removeChild(e._performanceContainer))}function k5e(e){e._jobScheduler.resetBudgets();const t=e._frameState;e.primitives.prePassesUpdate(t),c(e.globe)&&e.globe.update(t),e._picking.update(),t.creditDisplay.update()}function V5e(e){const t=e._frameState;e.primitives.postPassesUpdate(t),Nn.update()}const H5e=new z;function G5e(e){const t=e._frameState,n=e.context,i=n.uniformState,o=e._defaultView;e._view=o,e.updateFrameState(),t.passes.render=!0,t.passes.postProcess=e.postProcessStages.hasSelected,t.tilesetPassState=l5e;let r=y(e.backgroundColor,z.BLACK);e._hdr&&(r=z.clone(r,H5e),r.red=Math.pow(r.red,e.gamma),r.green=Math.pow(r.green,e.gamma),r.blue=Math.pow(r.blue,e.gamma)),t.backgroundColor=r,t.atmosphere=e.atmosphere,e.fog.update(t),i.update(t);const s=e.shadowMap;c(s)&&s.enabled&&(!c(e.light)||e.light instanceof bC?d.negate(i.sunDirectionWC,e._shadowMapCamera.direction):d.clone(e.light.direction,e._shadowMapCamera.direction),t.shadowMaps.push(s)),e._computeCommandList.length=0,e._overlayCommandList.length=0;const a=o.viewport;a.x=0,a.y=0,a.width=n.drawingBufferWidth,a.height=n.drawingBufferHeight;const l=o.passState;l.framebuffer=void 0,l.blendingEnabled=void 0,l.scissorTest=void 0,l.viewport=Re.clone(a,l.viewport),c(e.globe)&&e.globe.beginFrame(t),e.updateEnvironment(),e.updateAndExecuteCommands(l,r),e.resolveFramebuffers(l),l.framebuffer=void 0,A5e(e,l),c(e.globe)&&(e.globe.endFrame(t),e.globe.tilesLoaded||(e._renderRequested=!0)),n.endFrame()}function Mf(e,t){try{t(e)}catch(n){if(e._renderError.raiseEvent(e,n),e.rethrowRenderErrors)throw n}}function j5e(e){return e._picking.updateMostDetailedRayPicks(e)}gn.prototype.render=function(e){this._preUpdate.raiseEvent(this,e);const t=this._frameState;t.newFrame=!1,c(e)||(e=ie.now());const n=this._view.checkForCameraUpdates(this);n&&(this._globeHeightDirty=!0);let i=!this.requestRenderMode||this._renderRequested||n||this._logDepthBufferDirty||this._hdrDirty||this.mode===oe.MORPHING;if(!i&&c(this.maximumRenderTimeChange)&&c(this._lastRenderTime)){const o=Math.abs(ie.secondsDifference(this._lastRenderTime,e));i=i||o>this.maximumRenderTimeChange}if(i){this._lastRenderTime=ie.clone(e,this._lastRenderTime),this._renderRequested=!1,this._logDepthBufferDirty=!1,this._hdrDirty=!1;const o=R.incrementWrap(t.frameNumber,15e6,1);eq(this,o,e),t.newFrame=!0}Mf(this,k5e),this.primitives.show&&(Mf(this,j5e),Mf(this,W5e),Mf(this,q5e),i||Mf(this,Y5e)),this._postUpdate.raiseEvent(this,e),i&&(this._preRender.raiseEvent(this,e),t.creditDisplay.beginFrame(),Mf(this,G5e)),U5e(this,i),Mf(this,V5e),F5e(this),i&&(this._postRender.raiseEvent(this,e),t.creditDisplay.endFrame())};gn.prototype.forceRender=function(e){this._renderRequested=!0,this.render(e)};gn.prototype.requestRender=function(){this._renderRequested=!0};gn.prototype.clampLineWidth=function(e){return Math.max(pt.minimumAliasedLineWidth,Math.min(e,pt.maximumAliasedLineWidth))};gn.prototype.pick=function(e,t,n){return this._picking.pick(this,e,t,n)};gn.prototype.pickVoxel=function(e,t,n){const i=this.pick(e,t,n);if(!c(i))return;const o=i.primitive;if(!(o instanceof Bc))return;const r=this._picking.pickVoxelCoordinate(this,e,t,n),s=255*r[0]+r[1],a=o._traversal.findKeyframeNode(s);if(!c(a))return;const l=255*r[2]+r[3];return Sp.fromKeyframeNode(o,s,l,a)};gn.prototype.pickPositionWorldCoordinates=function(e,t){return this._picking.pickPositionWorldCoordinates(this,e,t)};gn.prototype.pickPosition=function(e,t){return this._picking.pickPosition(this,e,t)};gn.prototype.drillPick=function(e,t,n,i){return this._picking.drillPick(this,e,t,n,i)};function W5e(e){const t=e._frameState;qv.camera=t.camera,qv.cullingVolume=t.cullingVolume,e.primitives.updateForPass(t,qv)}function q5e(e){const t=e._frameState;if(!t.camera.canPreloadFlight())return;Yv.camera=e.preloadFlightCamera,Yv.cullingVolume=e.preloadFlightCullingVolume,e.primitives.updateForPass(t,Yv)}function Y5e(e){e.primitives.updateForPass(e._frameState,u5e)}gn.prototype.pickFromRay=function(e,t,n){return this._picking.pickFromRay(this,e,t,n)};gn.prototype.drillPickFromRay=function(e,t,n,i){return this._picking.drillPickFromRay(this,e,t,n,i)};gn.prototype.pickFromRayMostDetailed=function(e,t,n){return this._picking.pickFromRayMostDetailed(this,e,t,n)};gn.prototype.drillPickFromRayMostDetailed=function(e,t,n,i){return this._picking.drillPickFromRayMostDetailed(this,e,t,n,i)};gn.prototype.sampleHeight=function(e,t,n){return this._picking.sampleHeight(this,e,t,n)};gn.prototype.clampToHeight=function(e,t,n,i){return this._picking.clampToHeight(this,e,t,n,i)};gn.prototype.sampleHeightMostDetailed=function(e,t,n){return this._picking.sampleHeightMostDetailed(this,e,t,n)};gn.prototype.clampToHeightMostDetailed=function(e,t,n){return this._picking.clampToHeightMostDetailed(this,e,t,n)};gn.prototype.cartesianToCanvasCoordinates=function(e,t){return Ao.wgs84ToWindowCoordinates(this,e,t)};gn.prototype.completeMorph=function(){this._transitioner.completeMorph()};gn.prototype.morphTo2D=function(e){let t;const n=this.globe;c(n)?t=n.ellipsoid:t=this.mapProjection.ellipsoid,e=y(e,2),this._transitioner.morphTo2D(e,t)};gn.prototype.morphToColumbusView=function(e){let t;const n=this.globe;c(n)?t=n.ellipsoid:t=this.mapProjection.ellipsoid,e=y(e,2),this._transitioner.morphToColumbusView(e,t)};gn.prototype.morphTo3D=function(e){let t;const n=this.globe;c(n)?t=n.ellipsoid:t=this.mapProjection.ellipsoid,e=y(e,2),this._transitioner.morphTo3D(e,t)};function $5e(e,t){if(e._removeTerrainProviderReadyListener=e._removeTerrainProviderReadyListener&&e._removeTerrainProviderReadyListener(),t.ready){c(e.globe)&&(e.globe.terrainProvider=t.provider);return}e.globe.terrainProvider=void 0,e._removeTerrainProviderReadyListener=t.readyEvent.addEventListener(n=>{c(e)&&c(e.globe)&&(e.globe.terrainProvider=n),e._removeTerrainProviderReadyListener()})}gn.prototype.setTerrain=function(e){return A.typeOf.object("terrain",e),$5e(this,e),e};gn.prototype.isDestroyed=function(){return!1};gn.prototype.destroy=function(){this._tweens.removeAll(),this._computeEngine=this._computeEngine&&this._computeEngine.destroy(),this._screenSpaceCameraController=this._screenSpaceCameraController&&this._screenSpaceCameraController.destroy(),this._deviceOrientationCameraController=this._deviceOrientationCameraController&&!this._deviceOrientationCameraController.isDestroyed()&&this._deviceOrientationCameraController.destroy(),this._primitives=this._primitives&&this._primitives.destroy(),this._groundPrimitives=this._groundPrimitives&&this._groundPrimitives.destroy(),this._globe=this._globe&&this._globe.destroy(),this._removeTerrainProviderReadyListener=this._removeTerrainProviderReadyListener&&this._removeTerrainProviderReadyListener(),this.skyBox=this.skyBox&&this.skyBox.destroy(),this.skyAtmosphere=this.skyAtmosphere&&this.skyAtmosphere.destroy(),this._debugSphere=this._debugSphere&&this._debugSphere.destroy(),this.sun=this.sun&&this.sun.destroy(),this._sunPostProcess=this._sunPostProcess&&this._sunPostProcess.destroy(),this._depthPlane=this._depthPlane&&this._depthPlane.destroy(),this._transitioner=this._transitioner&&this._transitioner.destroy(),this._debugFrustumPlanes=this._debugFrustumPlanes&&this._debugFrustumPlanes.destroy(),this._brdfLutGenerator=this._brdfLutGenerator&&this._brdfLutGenerator.destroy(),this._picking=this._picking&&this._picking.destroy(),this._defaultView=this._defaultView&&this._defaultView.destroy(),this._view=void 0,this._removeCreditContainer&&this._canvas.parentNode.removeChild(this._creditContainer),this.postProcessStages=this.postProcessStages&&this.postProcessStages.destroy(),this._context=this._context&&this._context.destroy(),this._frameState.creditDisplay=this._frameState.creditDisplay&&this._frameState.creditDisplay.destroy(),c(this._performanceDisplay)&&(this._performanceDisplay=this._performanceDisplay&&this._performanceDisplay.destroy(),this._performanceContainer.parentNode.removeChild(this._performanceContainer)),this._removeRequestListenerCallback(),this._removeTaskProcessorListenerCallback();for(let e=0;e<this._removeGlobeCallbacks.length;++e)this._removeGlobeCallbacks[e]();return this._removeGlobeCallbacks.length=0,c(this._removeUpdateHeightCallback)&&(this._removeUpdateHeightCallback(),this._removeUpdateHeightCallback=void 0),ve(this)};function cg(e){e=y(e,ae.WGS84),this.show=!0,this.perFragmentAtmosphere=!1,this._ellipsoid=e;const t=1.025,n=d.multiplyByScalar(e.radii,t,new d);this._scaleMatrix=L.fromScale(n),this._modelMatrix=new L,this._command=new Ze({owner:this,modelMatrix:this._modelMatrix}),this._spSkyFromSpace=void 0,this._spSkyFromAtmosphere=void 0,this._flags=void 0,this.atmosphereLightIntensity=50,this.atmosphereRayleighCoefficient=new d(55e-7,13e-6,284e-7),this.atmosphereMieCoefficient=new d(21e-6,21e-6,21e-6),this.atmosphereRayleighScaleHeight=1e4,this.atmosphereMieScaleHeight=3200,this.atmosphereMieAnisotropy=.9,this.hueShift=0,this.saturationShift=0,this.brightnessShift=0,this._hueSaturationBrightness=new d;const i=new d;i.x=e.maximumRadius*t,i.y=e.maximumRadius,i.z=0,this._radiiAndDynamicAtmosphereColor=i;const o=this;this._command.uniformMap={u_radiiAndDynamicAtmosphereColor:function(){return o._radiiAndDynamicAtmosphereColor},u_hsbShift:function(){return o._hueSaturationBrightness.x=o.hueShift,o._hueSaturationBrightness.y=o.saturationShift,o._hueSaturationBrightness.z=o.brightnessShift,o._hueSaturationBrightness},u_atmosphereLightIntensity:function(){return o.atmosphereLightIntensity},u_atmosphereRayleighCoefficient:function(){return o.atmosphereRayleighCoefficient},u_atmosphereMieCoefficient:function(){return o.atmosphereMieCoefficient},u_atmosphereRayleighScaleHeight:function(){return o.atmosphereRayleighScaleHeight},u_atmosphereMieScaleHeight:function(){return o.atmosphereMieScaleHeight},u_atmosphereMieAnisotropy:function(){return o.atmosphereMieAnisotropy}}}Object.defineProperties(cg.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}});cg.prototype.setDynamicLighting=function(e){this._radiiAndDynamicAtmosphereColor.z=e};const Qv=new L;cg.prototype.update=function(e,t){if(!this.show)return;const n=e.mode;if(n!==oe.SCENE3D&&n!==oe.MORPHING||!e.passes.render)return;const i=L.fromRotationTranslation(e.context.uniformState.inverseViewRotation,d.ZERO,Qv),o=L.multiplyTransformation(i,Cr.Y_UP_TO_Z_UP,Qv),r=L.multiply(this._scaleMatrix,o,Qv);L.clone(r,this._modelMatrix);const s=e.context,a=X5e(this),l=e.globeTranslucencyState.translucent,u=this.perFragmentAtmosphere||l||!c(t)||!t.show,h=this._command;if(!c(h.vertexArray)){const _=va.createGeometry(new va({radii:new d(1,1,1),slicePartitions:256,stackPartitions:256,vertexFormat:Ee.POSITION_ONLY}));h.vertexArray=Ci.fromGeometry({context:s,geometry:_,attributeLocations:ti.createAttributeLocations(_),bufferUsage:ke.STATIC_DRAW}),h.renderState=Ue.fromCache({cull:{enabled:!0,face:Qi.FRONT},blending:Zn.ALPHA_BLEND,depthMask:!1})}const f=a|u<<2|l<<3;if(f!==this._flags){this._flags=f;const _=[];a&&_.push("COLOR_CORRECT"),u&&_.push("PER_FRAGMENT_ATMOSPHERE"),l&&_.push("GLOBE_TRANSLUCENT");const g=new Oe({defines:_,sources:[tC,PB,z1e]}),m=new Oe({defines:_,sources:[tC,PB,B1e]});this._spSkyAtmosphere=Jt.fromCache({context:s,vertexShaderSource:g,fragmentShaderSource:m}),h.shaderProgram=this._spSkyAtmosphere}return h};function X5e(e){return!(R.equalsEpsilon(e.hueShift,0,R.EPSILON7)&&R.equalsEpsilon(e.saturationShift,0,R.EPSILON7)&&R.equalsEpsilon(e.brightnessShift,0,R.EPSILON7))}cg.prototype.isDestroyed=function(){return!1};cg.prototype.destroy=function(){const e=this._command;return e.vertexArray=e.vertexArray&&e.vertexArray.destroy(),this._spSkyAtmosphere=this._spSkyAtmosphere&&this._spSkyAtmosphere.destroy(),ve(this)};function pE(e){this.sources=e.sources,this._sources=void 0,this.show=y(e.show,!0),this._command=new Ze({modelMatrix:L.clone(L.IDENTITY),owner:this}),this._cubeMap=void 0,this._attributeLocations=void 0,this._useHdr=void 0}pE.prototype.update=function(e,t){const n=this;if(!this.show||e.mode!==oe.SCENE3D&&e.mode!==oe.MORPHING||!e.passes.render)return;const i=e.context;if(this._sources!==this.sources){this._sources=this.sources;const r=this.sources;if(!c(r.positiveX)||!c(r.negativeX)||!c(r.positiveY)||!c(r.negativeY)||!c(r.positiveZ)||!c(r.negativeZ))throw new E("this.sources is required and must have positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ properties.");if(typeof r.positiveX!=typeof r.negativeX||typeof r.positiveX!=typeof r.positiveY||typeof r.positiveX!=typeof r.negativeY||typeof r.positiveX!=typeof r.positiveZ||typeof r.positiveX!=typeof r.negativeZ)throw new E("this.sources properties must all be the same type.");typeof r.positiveX=="string"?aee(i,this._sources).then(function(s){n._cubeMap=n._cubeMap&&n._cubeMap.destroy(),n._cubeMap=s}):(this._cubeMap=this._cubeMap&&this._cubeMap.destroy(),this._cubeMap=new Sl({context:i,source:r}))}const o=this._command;if(!c(o.vertexArray)){o.uniformMap={u_cubeMap:function(){return n._cubeMap}};const r=rr.createGeometry(rr.fromDimensions({dimensions:new d(2,2,2),vertexFormat:Ee.POSITION_ONLY})),s=this._attributeLocations=ti.createAttributeLocations(r);o.vertexArray=Ci.fromGeometry({context:i,geometry:r,attributeLocations:s,bufferUsage:ke.STATIC_DRAW}),o.renderState=Ue.fromCache({blending:Zn.ALPHA_BLEND})}if(!c(o.shaderProgram)||this._useHdr!==t){const r=new Oe({defines:[t?"HDR":""],sources:[U1e]});o.shaderProgram=Jt.fromCache({context:i,vertexShaderSource:k1e,fragmentShaderSource:r,attributeLocations:this._attributeLocations}),this._useHdr=t}if(!!c(this._cubeMap))return o};pE.prototype.isDestroyed=function(){return!1};pE.prototype.destroy=function(){const e=this._command;return e.vertexArray=e.vertexArray&&e.vertexArray.destroy(),e.shaderProgram=e.shaderProgram&&e.shaderProgram.destroy(),this._cubeMap=this._cubeMap&&this._cubeMap.destroy(),ve(this)};function mb(){this.show=!0,this._drawCommand=new Ze({primitiveType:ze.TRIANGLES,boundingVolume:new se,owner:this}),this._commands={drawCommand:this._drawCommand,computeCommand:void 0},this._boundingVolume=new se,this._boundingVolume2D=new se,this._texture=void 0,this._drawingBufferWidth=void 0,this._drawingBufferHeight=void 0,this._radiusTS=void 0,this._size=void 0,this.glowFactor=1,this._glowFactorDirty=!1,this._useHdr=void 0;const e=this;this._uniformMap={u_texture:function(){return e._texture},u_size:function(){return e._size}}}Object.defineProperties(mb.prototype,{glowFactor:{get:function(){return this._glowFactor},set:function(e){e=Math.max(e,0),this._glowFactor=e,this._glowFactorDirty=!0}}});const Q5e=new H,K5e=new H,Z5e=new te,ly=new te;mb.prototype.update=function(e,t,n){if(!this.show)return;const i=e.mode;if(i===oe.SCENE2D||i===oe.MORPHING||!e.passes.render)return;const o=e.context,r=t.viewport.width,s=t.viewport.height;if(!c(this._texture)||r!==this._drawingBufferWidth||s!==this._drawingBufferHeight||this._glowFactorDirty||n!==this._useHdr){this._texture=this._texture&&this._texture.destroy(),this._drawingBufferWidth=r,this._drawingBufferHeight=s,this._glowFactorDirty=!1,this._useHdr=n;let v=Math.max(r,s);v=Math.pow(2,Math.ceil(Math.log(v)/Math.log(2))-2),v=Math.max(1,v);const P=n?o.halfFloatingPointTexture?Me.HALF_FLOAT:Me.FLOAT:Me.UNSIGNED_BYTE;this._texture=new xt({context:o,width:v,height:v,pixelFormat:Ve.RGBA,pixelDatatype:P}),this._glowLengthTS=this._glowFactor*5,this._radiusTS=1/(1+2*this._glowLengthTS)*.5;const N=this,k={u_radiusTS:function(){return N._radiusTS}};this._commands.computeCommand=new A_({fragmentShaderSource:H1e,outputTexture:this._texture,uniformMap:k,persists:!1,owner:this,postExecute:function(){N._commands.computeCommand=void 0}})}const a=this._drawCommand;if(!c(a.vertexArray)){const v={direction:0},P=new Uint8Array(4*2);P[0]=0,P[1]=0,P[2]=255,P[3]=0,P[4]=255,P[5]=255,P[6]=0,P[7]=255;const N=ct.createVertexBuffer({context:o,typedArray:P,usage:ke.STATIC_DRAW}),k=[{index:v.direction,vertexBuffer:N,componentsPerAttribute:2,normalize:!0,componentDatatype:Z.UNSIGNED_BYTE}],M=ct.createIndexBuffer({context:o,typedArray:new Uint16Array([0,1,2,0,2,3]),usage:ke.STATIC_DRAW,indexDatatype:je.UNSIGNED_SHORT});a.vertexArray=new Ci({context:o,attributes:k,indexBuffer:M}),a.shaderProgram=Jt.fromCache({context:o,vertexShaderSource:G1e,fragmentShaderSource:V1e,attributeLocations:v}),a.renderState=Ue.fromCache({blending:Zn.ALPHA_BLEND}),a.uniformMap=this._uniformMap}const l=o.uniformState.sunPositionWC,u=o.uniformState.sunPositionColumbusView,h=this._boundingVolume,f=this._boundingVolume2D;d.clone(l,h.center),f.center.x=u.z,f.center.y=u.x,f.center.z=u.y,h.radius=R.SOLAR_RADIUS+R.SOLAR_RADIUS*this._glowLengthTS,f.radius=h.radius,i===oe.SCENE3D?se.clone(h,a.boundingVolume):i===oe.COLUMBUS_VIEW&&se.clone(f,a.boundingVolume);const _=Ao.computeActualWgs84Position(e,l,ly),g=d.magnitude(d.subtract(_,e.camera.position,ly)),m=o.uniformState.projection,b=Z5e;b.x=0,b.y=0,b.z=-g,b.w=1;const T=L.multiplyByVector(m,b,ly),x=Ao.clipToGLWindowCoordinates(t.viewport,T,Q5e);b.x=R.SOLAR_RADIUS;const C=L.multiplyByVector(m,b,ly),w=Ao.clipToGLWindowCoordinates(t.viewport,C,K5e);return this._size=H.magnitude(H.subtract(w,x,ly)),this._size=2*this._size*(1+2*this._glowLengthTS),this._size=Math.ceil(this._size),this._commands};mb.prototype.isDestroyed=function(){return!1};mb.prototype.destroy=function(){const e=this._drawCommand;return e.vertexArray=e.vertexArray&&e.vertexArray.destroy(),e.shaderProgram=e.shaderProgram&&e.shaderProgram.destroy(),this._texture=this._texture&&this._texture.destroy(),ve(this)};function Lm(e){return Zt(`Assets/Textures/SkyBox/tycho2t3_80_${e}.jpg`)}function J5e(e){e._renderLoopRunning=!0;let t=0;function n(i){if(!e.isDestroyed())if(e._useDefaultRenderLoop)try{const o=e._targetFrameRate;if(!c(o))e.resize(),e.render(),requestAnimationFrame(n);else{const r=1e3/o,s=i-t;s>r&&(e.resize(),e.render(),t=i-s%r),requestAnimationFrame(n)}}catch(o){if(e._useDefaultRenderLoop=!1,e._renderLoopRunning=!1,e._showRenderLoopErrors){const r="An error occurred while rendering. Rendering has stopped.";e.showErrorPanel(r,void 0,o)}}else e._renderLoopRunning=!1}requestAnimationFrame(n)}function rq(e){let t=e._useBrowserRecommendedResolution?1:window.devicePixelRatio;return t*=e._resolutionScale,c(e._scene)&&(e._scene.pixelRatio=t),t}function sq(e){const t=e._canvas;let n=t.clientWidth,i=t.clientHeight;const o=rq(e);e._canvasClientWidth=n,e._canvasClientHeight=i,n*=o,i*=o,t.width=n,t.height=i,e._canRender=n!==0&&i!==0,e._lastDevicePixelRatio=window.devicePixelRatio}function aq(e){const t=e._canvas,n=t.width,i=t.height;if(n!==0&&i!==0){const o=e._scene.camera.frustum;c(o.aspectRatio)?o.aspectRatio=n/i:(o.top=o.right*(i/n),o.bottom=-o.top)}}function Kp(e,t){if(!c(e))throw new E("container is required.");e=Do(e),t=y(t,y.EMPTY_OBJECT);const n=document.createElement("div");n.className="cesium-widget",e.appendChild(n);const i=document.createElement("canvas"),o=Yt.supportsImageRenderingPixelated();this._supportsImageRenderingPixelated=o,o&&(i.style.imageRendering=Yt.imageRenderingValue()),i.oncontextmenu=function(){return!1},i.onselectstart=function(){return!1};function r(){i!==i.ownerDocument.activeElement&&i.ownerDocument.activeElement.blur()}y(t.blurActiveElementOnCanvasFocus,!0)&&(i.addEventListener("mousedown",r),i.addEventListener("pointerdown",r)),n.appendChild(i);const a=document.createElement("div");a.className="cesium-widget-credits";const l=c(t.creditContainer)?Do(t.creditContainer):n;l.appendChild(a);const u=c(t.creditViewport)?Do(t.creditViewport):n,h=y(t.showRenderLoopErrors,!0),f=y(t.useBrowserRecommendedResolution,!0);this._element=n,this._container=e,this._canvas=i,this._canvasClientWidth=0,this._canvasClientHeight=0,this._lastDevicePixelRatio=0,this._creditViewport=u,this._creditContainer=l,this._innerCreditContainer=a,this._canRender=!1,this._renderLoopRunning=!1,this._showRenderLoopErrors=h,this._resolutionScale=1,this._useBrowserRecommendedResolution=f,this._forceResize=!1,this._clock=c(t.clock)?t.clock:new tb,sq(this);try{const _=new gn({canvas:i,contextOptions:t.contextOptions,creditContainer:a,creditViewport:u,mapProjection:t.mapProjection,orderIndependentTranslucency:t.orderIndependentTranslucency,scene3DOnly:y(t.scene3DOnly,!1),shadows:t.shadows,mapMode2D:t.mapMode2D,requestRenderMode:t.requestRenderMode,maximumRenderTimeChange:t.maximumRenderTimeChange,depthPlaneEllipsoidOffset:t.depthPlaneEllipsoidOffset,msaaSamples:t.msaaSamples});this._scene=_,_.camera.constrainedAxis=d.UNIT_Z,rq(this),aq(this);const g=y(_.mapProjection.ellipsoid,ae.WGS84);let m=t.globe;c(m)||(m=new Ul(g)),m!==!1&&(_.globe=m,_.globe.shadows=y(t.terrainShadows,Vi.RECEIVE_ONLY));let b=t.skyBox;c(b)||(b=new pE({sources:{positiveX:Lm("px"),negativeX:Lm("mx"),positiveY:Lm("py"),negativeY:Lm("my"),positiveZ:Lm("pz"),negativeZ:Lm("mz")}})),b!==!1&&(_.skyBox=b,_.sun=new mb,_.moon=new sb);let T=t.skyAtmosphere;c(T)||(T=new cg(g),T.show=t.globe!==!1&&m.show),T!==!1&&(_.skyAtmosphere=T);let x=t.baseLayer;if(t.globe!==!1&&x!==!1&&(c(x)||(x=Qt.fromWorldImagery()),_.imageryLayers.add(x)),c(t.terrainProvider)&&t.globe!==!1&&(_.terrainProvider=t.terrainProvider),c(t.terrain)&&t.globe!==!1){if(c(t.terrainProvider))throw new E("Specify either options.terrainProvider or options.terrain.");_.setTerrain(t.terrain)}this._screenSpaceEventHandler=new da(i),c(t.sceneMode)&&(t.sceneMode===oe.SCENE2D&&this._scene.morphTo2D(0),t.sceneMode===oe.COLUMBUS_VIEW&&this._scene.morphToColumbusView(0)),this._useDefaultRenderLoop=void 0,this.useDefaultRenderLoop=y(t.useDefaultRenderLoop,!0),this._targetFrameRate=void 0,this.targetFrameRate=t.targetFrameRate;const C=this;this._onRenderError=function(w,v){if(C._useDefaultRenderLoop=!1,C._renderLoopRunning=!1,C._showRenderLoopErrors){const P="An error occurred while rendering. Rendering has stopped.";C.showErrorPanel(P,void 0,v)}},_.renderError.addEventListener(this._onRenderError)}catch(_){if(h){const g="Error constructing CesiumWidget.",m='Visit <a href="http://get.webgl.org">http://get.webgl.org</a> to verify that your web browser and hardware support WebGL. Consider trying a different web browser or updating your video drivers. Detailed error information is below:';this.showErrorPanel(g,m,_)}throw _}}Object.defineProperties(Kp.prototype,{container:{get:function(){return this._container}},canvas:{get:function(){return this._canvas}},creditContainer:{get:function(){return this._creditContainer}},creditViewport:{get:function(){return this._creditViewport}},scene:{get:function(){return this._scene}},imageryLayers:{get:function(){return this._scene.imageryLayers}},terrainProvider:{get:function(){return this._scene.terrainProvider},set:function(e){this._scene.terrainProvider=e}},creditDisplay:{get:function(){return this._scene.frameState.creditDisplay}},camera:{get:function(){return this._scene.camera}},clock:{get:function(){return this._clock}},screenSpaceEventHandler:{get:function(){return this._screenSpaceEventHandler}},targetFrameRate:{get:function(){return this._targetFrameRate},set:function(e){if(e<=0)throw new E("targetFrameRate must be greater than 0, or undefined.");this._targetFrameRate=e}},useDefaultRenderLoop:{get:function(){return this._useDefaultRenderLoop},set:function(e){this._useDefaultRenderLoop!==e&&(this._useDefaultRenderLoop=e,e&&!this._renderLoopRunning&&J5e(this))}},resolutionScale:{get:function(){return this._resolutionScale},set:function(e){if(e<=0)throw new E("resolutionScale must be greater than 0.");this._resolutionScale!==e&&(this._resolutionScale=e,this._forceResize=!0)}},useBrowserRecommendedResolution:{get:function(){return this._useBrowserRecommendedResolution},set:function(e){this._useBrowserRecommendedResolution!==e&&(this._useBrowserRecommendedResolution=e,this._forceResize=!0)}}});Kp.prototype.showErrorPanel=function(e,t,n){const i=this._element,o=document.createElement("div");o.className="cesium-widget-errorPanel";const r=document.createElement("div");r.className="cesium-widget-errorPanel-content",o.appendChild(r);const s=document.createElement("div");s.className="cesium-widget-errorPanel-header",s.appendChild(document.createTextNode(e)),r.appendChild(s);const a=document.createElement("div");a.className="cesium-widget-errorPanel-scroll",r.appendChild(a);function l(){a.style.maxHeight=`${Math.max(Math.round(i.clientHeight*.9-100),30)}px`}l(),c(window.addEventListener)&&window.addEventListener("resize",l,!1);const u=c(t),h=c(n);if(u||h){const g=document.createElement("div");if(g.className="cesium-widget-errorPanel-message",a.appendChild(g),h){let m=DD(n);u||(typeof n=="string"&&(n=new Error(n)),t=DD({name:n.name,message:n.message}),m=n.stack),typeof console<"u"&&console.error(`${e}
|
|
${t}
|
|
${m}`);const b=document.createElement("div");b.className="cesium-widget-errorPanel-message-details collapsed";const T=document.createElement("span");T.className="cesium-widget-errorPanel-more-details",T.appendChild(document.createTextNode("See more...")),b.appendChild(T),b.onclick=function(x){b.removeChild(T),b.appendChild(document.createTextNode(m)),b.className="cesium-widget-errorPanel-message-details",r.className="cesium-widget-errorPanel-content expanded",b.onclick=void 0},a.appendChild(b)}g.innerHTML=`<p>${t}</p>`}const f=document.createElement("div");f.className="cesium-widget-errorPanel-buttonPanel",r.appendChild(f);const _=document.createElement("button");_.setAttribute("type","button"),_.className="cesium-button",_.appendChild(document.createTextNode("OK")),_.onclick=function(){c(l)&&c(window.removeEventListener)&&window.removeEventListener("resize",l,!1),i.removeChild(o)},f.appendChild(_),i.appendChild(o)};Kp.prototype.isDestroyed=function(){return!1};Kp.prototype.destroy=function(){c(this._scene)&&(this._scene.renderError.removeEventListener(this._onRenderError),this._scene=this._scene.destroy()),this._container.removeChild(this._element),this._creditContainer.removeChild(this._innerCreditContainer),ve(this)};Kp.prototype.resize=function(){const e=this._canvas;!this._forceResize&&this._canvasClientWidth===e.clientWidth&&this._canvasClientHeight===e.clientHeight&&this._lastDevicePixelRatio===window.devicePixelRatio||(this._forceResize=!1,sq(this),aq(this),this._scene.requestRender())};Kp.prototype.render=function(){if(this._canRender){this._scene.initializeFrame();const e=this._clock.tick();this._scene.render(e)}else this._clock.tick()};function ad(e,t){this._tilingScheme=e,this._maximumLevel=t,this._rootNodes=[]}const zf=new ce;function e8e(e,t,n,i){const o=i.length;for(let r=0;r<o;++r){const s=i[r];if(s.x===t&&s.y===n&&s.level===e)return!0}return!1}ad.prototype.addAvailableTileRange=function(e,t,n,i,o){const r=this._tilingScheme,s=this._rootNodes;if(e===0)for(let _=n;_<=o;++_)for(let g=t;g<=i;++g)e8e(e,g,_,s)||s.push(new Hm(r,void 0,0,g,_));r.tileXYToRectangle(t,n,e,zf);const a=zf.west,l=zf.north;r.tileXYToRectangle(i,o,e,zf);const u=zf.east,h=zf.south,f=new r8e(e,a,h,u,l);for(let _=0;_<s.length;++_){const g=s[_];tL(g.extent,f)&&s8e(this._maximumLevel,g,f)}};ad.prototype.computeMaximumLevelAtPosition=function(e){let t;for(let n=0;n<this._rootNodes.length;++n){const i=this._rootNodes[n];if(Gm(i.extent,e)){t=i;break}}return c(t)?Cy(void 0,t,e):-1};const t8e=[],n8e=[],i8e=new ce,o8e=new ce;ad.prototype.computeBestAvailableLevelOverRectangle=function(e){const t=t8e;t.length=0,e.east<e.west?(t.push(ce.fromRadians(-Math.PI,e.south,e.east,e.north,i8e)),t.push(ce.fromRadians(e.west,e.south,Math.PI,e.north,o8e))):t.push(e);const n=n8e;n.length=0;let i;for(i=0;i<this._rootNodes.length;++i)Ey(n,this._rootNodes[i],t);for(i=n.length-1;i>=0;--i)if(c(n[i])&&n[i].length===0)return i;return 0};const Bz=new he;ad.prototype.isTileAvailable=function(e,t,n){const i=this._tilingScheme.tileXYToRectangle(t,n,e,zf);return ce.center(i,Bz),this.computeMaximumLevelAtPosition(Bz)>=e};ad.prototype.computeChildMaskForTile=function(e,t,n){const i=e+1;if(i>=this._maximumLevel)return 0;let o=0;return o|=this.isTileAvailable(i,2*t,2*n+1)?1:0,o|=this.isTileAvailable(i,2*t+1,2*n+1)?2:0,o|=this.isTileAvailable(i,2*t,2*n)?4:0,o|=this.isTileAvailable(i,2*t+1,2*n)?8:0,o};function Hm(e,t,n,i,o){this.tilingScheme=e,this.parent=t,this.level=n,this.x=i,this.y=o,this.extent=e.tileXYToRectangle(i,o,n),this.rectangles=[],this._sw=void 0,this._se=void 0,this._nw=void 0,this._ne=void 0}Object.defineProperties(Hm.prototype,{nw:{get:function(){return this._nw||(this._nw=new Hm(this.tilingScheme,this,this.level+1,this.x*2,this.y*2)),this._nw}},ne:{get:function(){return this._ne||(this._ne=new Hm(this.tilingScheme,this,this.level+1,this.x*2+1,this.y*2)),this._ne}},sw:{get:function(){return this._sw||(this._sw=new Hm(this.tilingScheme,this,this.level+1,this.x*2,this.y*2+1)),this._sw}},se:{get:function(){return this._se||(this._se=new Hm(this.tilingScheme,this,this.level+1,this.x*2+1,this.y*2+1)),this._se}}});function r8e(e,t,n,i,o){this.level=e,this.west=t,this.south=n,this.east=i,this.north=o}function tL(e,t){const n=Math.max(e.west,t.west),i=Math.max(e.south,t.south),o=Math.min(e.east,t.east),r=Math.min(e.north,t.north);return i<r&&n<o}function s8e(e,t,n){for(;t.level<e;)if(AA(t.nw.extent,n))t=t.nw;else if(AA(t.ne.extent,n))t=t.ne;else if(AA(t.sw.extent,n))t=t.sw;else if(AA(t.se.extent,n))t=t.se;else break;if(t.rectangles.length===0||t.rectangles[t.rectangles.length-1].level<=n.level)t.rectangles.push(n);else{let i=Hr(t.rectangles,n.level,a8e);i<0&&(i=~i),t.rectangles.splice(i,0,n)}}function a8e(e,t){return e.level-t}function AA(e,t){return t.west>=e.west&&t.east<=e.east&&t.south>=e.south&&t.north<=e.north}function Gm(e,t){return t.longitude>=e.west&&t.longitude<=e.east&&t.latitude>=e.south&&t.latitude<=e.north}function Cy(e,t,n){let i=0,o=!1;for(;!o;){const r=t._nw&&Gm(t._nw.extent,n),s=t._ne&&Gm(t._ne.extent,n),a=t._sw&&Gm(t._sw.extent,n),l=t._se&&Gm(t._se.extent,n);if(r+s+a+l>1){r&&(i=Math.max(i,Cy(t,t._nw,n))),s&&(i=Math.max(i,Cy(t,t._ne,n))),a&&(i=Math.max(i,Cy(t,t._sw,n))),l&&(i=Math.max(i,Cy(t,t._se,n)));break}else r?t=t._nw:s?t=t._ne:a?t=t._sw:l?t=t._se:o=!0}for(;t!==e;){const r=t.rectangles;for(let s=r.length-1;s>=0&&r[s].level>i;--s){const a=r[s];Gm(a,n)&&(i=a.level)}t=t.parent}return i}function Ey(e,t,n){if(!t)return;let i,o=!1;for(i=0;i<n.length;++i)o=o||tL(t.extent,n[i]);if(!o)return;const r=t.rectangles;for(i=0;i<r.length;++i){const s=r[i];e[s.level]||(e[s.level]=n),e[s.level]=c8e(e[s.level],s)}Ey(e,t._nw,n),Ey(e,t._ne,n),Ey(e,t._sw,n),Ey(e,t._se,n)}function c8e(e,t){const n=[];for(let i=0;i<e.length;++i){const o=e[i];tL(o,t)?(o.west<t.west&&n.push(new ce(o.west,o.south,t.west,o.north)),o.east>t.east&&n.push(new ce(t.east,o.south,o.east,o.north)),o.south<t.south&&n.push(new ce(Math.max(t.west,o.west),o.south,Math.min(t.east,o.east),t.south)),o.north>t.north&&n.push(new ce(Math.max(t.west,o.west),t.north,Math.min(t.east,o.east),o.north))):n.push(o)}return n}const mE={};mE.clipTriangleAtAxisAlignedThreshold=function(e,t,n,i,o,r){if(!c(e))throw new E("threshold is required.");if(!c(t))throw new E("keepAbove is required.");if(!c(n))throw new E("u0 is required.");if(!c(i))throw new E("u1 is required.");if(!c(o))throw new E("u2 is required.");c(r)?r.length=0:r=[];let s,a,l;t?(s=n<e,a=i<e,l=o<e):(s=n>e,a=i>e,l=o>e);const u=s+a+l;let h,f,_,g,m,b;return u===1?s?(h=(e-n)/(i-n),f=(e-n)/(o-n),r.push(1),r.push(2),f!==1&&(r.push(-1),r.push(0),r.push(2),r.push(f)),h!==1&&(r.push(-1),r.push(0),r.push(1),r.push(h))):a?(_=(e-i)/(o-i),g=(e-i)/(n-i),r.push(2),r.push(0),g!==1&&(r.push(-1),r.push(1),r.push(0),r.push(g)),_!==1&&(r.push(-1),r.push(1),r.push(2),r.push(_))):l&&(m=(e-o)/(n-o),b=(e-o)/(i-o),r.push(0),r.push(1),b!==1&&(r.push(-1),r.push(2),r.push(1),r.push(b)),m!==1&&(r.push(-1),r.push(2),r.push(0),r.push(m))):u===2?!s&&n!==e?(g=(e-i)/(n-i),m=(e-o)/(n-o),r.push(0),r.push(-1),r.push(1),r.push(0),r.push(g),r.push(-1),r.push(2),r.push(0),r.push(m)):!a&&i!==e?(b=(e-o)/(i-o),h=(e-n)/(i-n),r.push(1),r.push(-1),r.push(2),r.push(1),r.push(b),r.push(-1),r.push(0),r.push(1),r.push(h)):!l&&o!==e&&(f=(e-n)/(o-n),_=(e-i)/(o-i),r.push(2),r.push(-1),r.push(0),r.push(2),r.push(f),r.push(-1),r.push(1),r.push(2),r.push(_)):u!==3&&(r.push(0),r.push(1),r.push(2)),r};mE.computeBarycentricCoordinates=function(e,t,n,i,o,r,s,a,l){if(!c(e))throw new E("x is required.");if(!c(t))throw new E("y is required.");if(!c(n))throw new E("x1 is required.");if(!c(i))throw new E("y1 is required.");if(!c(o))throw new E("x2 is required.");if(!c(r))throw new E("y2 is required.");if(!c(s))throw new E("x3 is required.");if(!c(a))throw new E("y3 is required.");const u=n-s,h=s-o,f=r-a,_=i-a,g=1/(f*u+h*_),m=t-a,b=e-s,T=(f*b+h*m)*g,x=(-_*b+u*m)*g,C=1-T-x;return c(l)?(l.x=T,l.y=x,l.z=C,l):new d(T,x,C)};mE.computeLineSegmentLineSegmentIntersection=function(e,t,n,i,o,r,s,a,l){A.typeOf.number("x00",e),A.typeOf.number("y00",t),A.typeOf.number("x01",n),A.typeOf.number("y01",i),A.typeOf.number("x10",o),A.typeOf.number("y10",r),A.typeOf.number("x11",s),A.typeOf.number("y11",a);const u=(s-o)*(t-r)-(a-r)*(e-o),h=(n-e)*(t-r)-(i-t)*(e-o),f=(a-r)*(n-e)-(s-o)*(i-t);if(f===0)return;const _=u/f,g=h/f;if(_>=0&&_<=1&&g>=0&&g<=1)return c(l)||(l=new H),l.x=e+_*(n-e),l.y=t+_*(i-t),l};const cq=mE;function Yh(e){if(!c(e)||!c(e.quantizedVertices))throw new E("options.quantizedVertices is required.");if(!c(e.indices))throw new E("options.indices is required.");if(!c(e.minimumHeight))throw new E("options.minimumHeight is required.");if(!c(e.maximumHeight))throw new E("options.maximumHeight is required.");if(!c(e.maximumHeight))throw new E("options.maximumHeight is required.");if(!c(e.boundingSphere))throw new E("options.boundingSphere is required.");if(!c(e.horizonOcclusionPoint))throw new E("options.horizonOcclusionPoint is required.");if(!c(e.westIndices))throw new E("options.westIndices is required.");if(!c(e.southIndices))throw new E("options.southIndices is required.");if(!c(e.eastIndices))throw new E("options.eastIndices is required.");if(!c(e.northIndices))throw new E("options.northIndices is required.");if(!c(e.westSkirtHeight))throw new E("options.westSkirtHeight is required.");if(!c(e.southSkirtHeight))throw new E("options.southSkirtHeight is required.");if(!c(e.eastSkirtHeight))throw new E("options.eastSkirtHeight is required.");if(!c(e.northSkirtHeight))throw new E("options.northSkirtHeight is required.");this._quantizedVertices=e.quantizedVertices,this._encodedNormals=e.encodedNormals,this._indices=e.indices,this._minimumHeight=e.minimumHeight,this._maximumHeight=e.maximumHeight,this._boundingSphere=e.boundingSphere,this._orientedBoundingBox=e.orientedBoundingBox,this._horizonOcclusionPoint=e.horizonOcclusionPoint,this._credits=e.credits;const t=this._quantizedVertices.length/3,n=this._uValues=this._quantizedVertices.subarray(0,t),i=this._vValues=this._quantizedVertices.subarray(t,2*t);this._heightValues=this._quantizedVertices.subarray(2*t,3*t);function o(s,a){return i[s]-i[a]}function r(s,a){return n[s]-n[a]}this._westIndices=CA(e.westIndices,o,t),this._southIndices=CA(e.southIndices,r,t),this._eastIndices=CA(e.eastIndices,o,t),this._northIndices=CA(e.northIndices,r,t),this._westSkirtHeight=e.westSkirtHeight,this._southSkirtHeight=e.southSkirtHeight,this._eastSkirtHeight=e.eastSkirtHeight,this._northSkirtHeight=e.northSkirtHeight,this._childTileMask=y(e.childTileMask,15),this._createdByUpsampling=y(e.createdByUpsampling,!1),this._waterMask=e.waterMask,this._mesh=void 0}Object.defineProperties(Yh.prototype,{credits:{get:function(){return this._credits}},waterMask:{get:function(){return this._waterMask}},childTileMask:{get:function(){return this._childTileMask}},canUpsample:{get:function(){return c(this._mesh)}}});const xA=[];function CA(e,t,n){xA.length=e.length;let i=!1;for(let o=0,r=e.length;o<r;++o)xA[o]=e[o],i=i||o>0&&t(e[o-1],e[o])>0;return i?(xA.sort(t),je.createTypedArray(n,xA)):e}const lq="createVerticesFromQuantizedTerrainMesh",l8e=new Kn(lq),u8e=new Kn(lq,xu.maximumAsynchronousTasks);Yh.prototype.createMesh=function(e){e=y(e,y.EMPTY_OBJECT),A.typeOf.object("options.tilingScheme",e.tilingScheme),A.typeOf.number("options.x",e.x),A.typeOf.number("options.y",e.y),A.typeOf.number("options.level",e.level);const t=e.tilingScheme,n=e.x,i=e.y,o=e.level,r=y(e.exaggeration,1),s=y(e.exaggerationRelativeHeight,0),a=y(e.throttle,!0),l=t.ellipsoid,u=t.tileXYToRectangle(n,i,o),f=(a?u8e:l8e).scheduleTask({minimumHeight:this._minimumHeight,maximumHeight:this._maximumHeight,quantizedVertices:this._quantizedVertices,octEncodedNormals:this._encodedNormals,includeWebMercatorT:!0,indices:this._indices,westIndices:this._westIndices,southIndices:this._southIndices,eastIndices:this._eastIndices,northIndices:this._northIndices,westSkirtHeight:this._westSkirtHeight,southSkirtHeight:this._southSkirtHeight,eastSkirtHeight:this._eastSkirtHeight,northSkirtHeight:this._northSkirtHeight,rectangle:u,relativeToCenter:this._boundingSphere.center,ellipsoid:l,exaggeration:r,exaggerationRelativeHeight:s});if(!c(f))return;const _=this;return Promise.resolve(f).then(function(g){const m=_._quantizedVertices.length/3,b=m+_._westIndices.length+_._southIndices.length+_._eastIndices.length+_._northIndices.length,T=je.createTypedArray(b,g.indices),x=new Float32Array(g.vertices),C=g.center,w=g.minimumHeight,v=g.maximumHeight,P=_._boundingSphere,N=_._orientedBoundingBox,k=y(d.clone(g.occludeePointInScaledSpace),_._horizonOcclusionPoint),M=g.vertexStride,U=Oo.clone(g.encoding);return _._mesh=new YC(C,x,T,g.indexCountWithoutSkirts,m,w,v,P,k,M,N,U,g.westIndicesSouthToNorth,g.southIndicesEastToWest,g.eastIndicesNorthToSouth,g.northIndicesWestToEast),_._quantizedVertices=void 0,_._encodedNormals=void 0,_._indices=void 0,_._uValues=void 0,_._vValues=void 0,_._heightValues=void 0,_._westIndices=void 0,_._southIndices=void 0,_._eastIndices=void 0,_._northIndices=void 0,_._mesh})};const d8e=new Kn("upsampleQuantizedTerrainMesh",xu.maximumAsynchronousTasks);Yh.prototype.upsample=function(e,t,n,i,o,r,s){if(!c(e))throw new E("tilingScheme is required.");if(!c(t))throw new E("thisX is required.");if(!c(n))throw new E("thisY is required.");if(!c(i))throw new E("thisLevel is required.");if(!c(o))throw new E("descendantX is required.");if(!c(r))throw new E("descendantY is required.");if(!c(s))throw new E("descendantLevel is required.");if(s-i>1)throw new E("Upsampling through more than one level at a time is not currently supported.");const l=this._mesh;if(!c(this._mesh))return;const u=t*2!==o,h=n*2===r,f=e.ellipsoid,_=e.tileXYToRectangle(o,r,s),g=d8e.scheduleTask({vertices:l.vertices,vertexCountWithoutSkirts:l.vertexCountWithoutSkirts,indices:l.indices,indexCountWithoutSkirts:l.indexCountWithoutSkirts,encoding:l.encoding,minimumHeight:this._minimumHeight,maximumHeight:this._maximumHeight,isEastChild:u,isNorthChild:h,childRectangle:_,ellipsoid:f});if(!c(g))return;let m=Math.min(this._westSkirtHeight,this._eastSkirtHeight);m=Math.min(m,this._southSkirtHeight),m=Math.min(m,this._northSkirtHeight);const b=u?m*.5:this._westSkirtHeight,T=h?m*.5:this._southSkirtHeight,x=u?this._eastSkirtHeight:m*.5,C=h?this._northSkirtHeight:m*.5,w=this._credits;return Promise.resolve(g).then(function(v){const P=new Uint16Array(v.vertices),N=je.createTypedArray(P.length/3,v.indices);let k;return c(v.encodedNormals)&&(k=new Uint8Array(v.encodedNormals)),new Yh({quantizedVertices:P,indices:N,encodedNormals:k,minimumHeight:v.minimumHeight,maximumHeight:v.maximumHeight,boundingSphere:se.clone(v.boundingSphere),orientedBoundingBox:Ct.clone(v.orientedBoundingBox),horizonOcclusionPoint:d.clone(v.horizonOcclusionPoint),westIndices:v.westIndices,southIndices:v.southIndices,eastIndices:v.eastIndices,northIndices:v.northIndices,westSkirtHeight:b,southSkirtHeight:T,eastSkirtHeight:x,northSkirtHeight:C,childTileMask:0,credits:w,createdByUpsampling:!0})})};const aP=32767,uq=new d;Yh.prototype.interpolateHeight=function(e,t,n){let i=R.clamp((t-e.west)/e.width,0,1);i*=aP;let o=R.clamp((n-e.south)/e.height,0,1);return o*=aP,c(this._mesh)?m8e(this,i,o):_8e(this,i,o)};function dq(e,t,n,i,o,r,s,a){const l=Math.min(n,o,s),u=Math.max(n,o,s),h=Math.min(i,r,a),f=Math.max(i,r,a);return e>=l&&e<=u&&t>=h&&t<=f}const h8e=new H,f8e=new H,p8e=new H;function m8e(e,t,n){const i=e._mesh,o=i.vertices,r=i.encoding,s=i.indices;for(let a=0,l=s.length;a<l;a+=3){const u=s[a],h=s[a+1],f=s[a+2],_=r.decodeTextureCoordinates(o,u,h8e),g=r.decodeTextureCoordinates(o,h,f8e),m=r.decodeTextureCoordinates(o,f,p8e);if(dq(t,n,_.x,_.y,g.x,g.y,m.x,m.y)){const b=cq.computeBarycentricCoordinates(t,n,_.x,_.y,g.x,g.y,m.x,m.y,uq);if(b.x>=-1e-15&&b.y>=-1e-15&&b.z>=-1e-15){const T=r.decodeHeight(o,u),x=r.decodeHeight(o,h),C=r.decodeHeight(o,f);return b.x*T+b.y*x+b.z*C}}}}function _8e(e,t,n){const i=e._uValues,o=e._vValues,r=e._heightValues,s=e._indices;for(let a=0,l=s.length;a<l;a+=3){const u=s[a],h=s[a+1],f=s[a+2],_=i[u],g=i[h],m=i[f],b=o[u],T=o[h],x=o[f];if(dq(t,n,_,b,g,T,m,x)){const C=cq.computeBarycentricCoordinates(t,n,_,b,g,T,m,x,uq);if(C.x>=-1e-15&&C.y>=-1e-15&&C.z>=-1e-15){const w=C.x*r[u]+C.y*r[h]+C.z*r[f];return R.lerp(e._minimumHeight,e._maximumHeight,w/aP)}}}}Yh.prototype.isChildAvailable=function(e,t,n,i){if(!c(e))throw new E("thisX is required.");if(!c(t))throw new E("thisY is required.");if(!c(n))throw new E("childX is required.");if(!c(i))throw new E("childY is required.");let o=2;return n!==e*2&&++o,i!==t*2&&(o-=2),(this._childTileMask&1<<o)!==0};Yh.prototype.wasCreatedByUpsampling=function(){return this._createdByUpsampling};function g8e(e){this.resource=e.resource,this.version=e.version,this.isHeightmap=e.isHeightmap,this.tileUrlTemplates=e.tileUrlTemplates,this.availability=e.availability,this.hasVertexNormals=e.hasVertexNormals,this.hasWaterMask=e.hasWaterMask,this.hasMetadata=e.hasMetadata,this.availabilityLevels=e.availabilityLevels,this.availabilityTilesLoaded=e.availabilityTilesLoaded,this.littleEndianExtensionSize=e.littleEndianExtensionSize,this.availabilityPromiseCache={}}function hq(e){this.requestVertexNormals=y(e.requestVertexNormals,!1),this.requestWaterMask=y(e.requestWaterMask,!1),this.requestMetadata=y(e.requestMetadata,!0),this.ellipsoid=e.ellipsoid,this.heightmapWidth=65,this.heightmapStructure=void 0,this.hasWaterMask=!1,this.hasMetadata=!1,this.hasVertexNormals=!1,this.scheme=void 0,this.lastResource=void 0,this.layerJsonResource=void 0,this.previousError=void 0,this.availability=void 0,this.tilingScheme=void 0,this.levelZeroMaximumGeometricError=void 0,this.heightmapStructure=void 0,this.layers=[],this.attribution="",this.overallAvailability=[],this.overallMaxZoom=0,this.tileCredits=[]}hq.prototype.build=function(e){e._heightmapWidth=this.heightmapWidth,e._scheme=this.scheme;const t=c(this.lastResource.credits)?this.lastResource.credits:[];e._tileCredits=t.concat(this.tileCredits),e._availability=this.availability,e._tilingScheme=this.tilingScheme,e._requestWaterMask=this.requestWaterMask,e._levelZeroMaximumGeometricError=this.levelZeroMaximumGeometricError,e._heightmapStructure=this.heightmapStructure,e._layers=this.layers,e._hasWaterMask=this.hasWaterMask,e._hasVertexNormals=this.hasVertexNormals,e._hasMetadata=this.hasMetadata};async function fq(e,t,n){if(!t.format){const b="The tile format is not specified in the layer.json file.";throw e.previousError=Er.reportError(e.previousError,n,c(n)?n._errorEvent:void 0,b),new Te(b)}if(!t.tiles||t.tiles.length===0){const b="The layer.json file does not specify any tile URL templates.";throw e.previousError=Er.reportError(e.previousError,n,c(n)?n._errorEvent:void 0,b),new Te(b)}let i=!1,o=!1,r=!1,s=!0,a=!1;if(t.format==="heightmap-1.0")a=!0,c(e.heightmapStructure)||(e.heightmapStructure={heightScale:1/5,heightOffset:-1e3,elementsPerHeight:1,stride:1,elementMultiplier:256,isBigEndian:!1,lowestEncodedHeight:0,highestEncodedHeight:256*256-1}),o=!0,e.requestWaterMask=!0;else if(t.format.indexOf("quantized-mesh-1.")!==0){const b=`The tile format "${t.format}" is invalid or not supported.`;throw e.previousError=Er.reportError(e.previousError,n,c(n)?n._errorEvent:void 0,b),new Te(b)}const l=t.tiles,u=t.maxzoom;if(e.overallMaxZoom=Math.max(e.overallMaxZoom,u),!t.projection||t.projection==="EPSG:4326")e.tilingScheme=new Yr({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:1,ellipsoid:e.ellipsoid});else if(t.projection==="EPSG:3857")e.tilingScheme=new ws({numberOfLevelZeroTilesX:1,numberOfLevelZeroTilesY:1,ellipsoid:e.ellipsoid});else{const b=`The projection "${t.projection}" is invalid or not supported.`;throw e.previousError=Er.reportError(e.previousError,n,c(n)?n._errorEvent:void 0,b),new Te(b)}if(e.levelZeroMaximumGeometricError=so.getEstimatedLevelZeroGeometricErrorForAHeightmap(e.tilingScheme.ellipsoid,e.heightmapWidth,e.tilingScheme.getNumberOfXTilesAtLevel(0)),!t.scheme||t.scheme==="tms"||t.scheme==="slippyMap")e.scheme=t.scheme;else{const b=`The scheme "${t.scheme}" is invalid or not supported.`;throw e.previousError=Er.reportError(e.previousError,n,c(n)?n._errorEvent:void 0,b),new Te(b)}let h;c(t.extensions)&&t.extensions.indexOf("octvertexnormals")!==-1?i=!0:c(t.extensions)&&t.extensions.indexOf("vertexnormals")!==-1&&(i=!0,s=!1),c(t.extensions)&&t.extensions.indexOf("watermask")!==-1&&(o=!0),c(t.extensions)&&t.extensions.indexOf("metadata")!==-1&&(r=!0);const f=t.metadataAvailability,_=t.available;let g;if(c(_)&&!c(f)){g=new ad(e.tilingScheme,_.length);for(let b=0;b<_.length;++b){const T=_[b],x=e.tilingScheme.getNumberOfYTilesAtLevel(b);c(e.overallAvailability[b])||(e.overallAvailability[b]=[]);for(let C=0;C<T.length;++C){const w=T[C],v=x-w.endY-1,P=x-w.startY-1;e.overallAvailability[b].push([w.startX,v,w.endX,P]),g.addAvailableTileRange(b,w.startX,v,w.endX,P)}}}else c(f)&&(h=new ad(e.tilingScheme,u),g=new ad(e.tilingScheme,u),e.overallAvailability[0]=[[0,0,1,0]],g.addAvailableTileRange(0,0,0,1,0));e.hasWaterMask=e.hasWaterMask||o,e.hasVertexNormals=e.hasVertexNormals||i,e.hasMetadata=e.hasMetadata||r,c(t.attribution)&&(e.attribution.length>0&&(e.attribution+=" "),e.attribution+=t.attribution),e.layers.push(new g8e({resource:e.lastResource,version:t.version,isHeightmap:a,tileUrlTemplates:l,availability:g,hasVertexNormals:i,hasWaterMask:o,hasMetadata:r,availabilityLevels:f,availabilityTilesLoaded:h,littleEndianExtensionSize:s}));const m=t.parentUrl;return c(m)?c(g)?(e.lastResource=e.lastResource.getDerivedResource({url:m}),e.lastResource.appendForwardSlash(),e.layerJsonResource=e.lastResource.getDerivedResource({url:"layer.json"}),await nL(e),!0):(console.log("A layer.json can't have a parentUrl if it does't have an available array."),!0):!0}function y8e(e,t,n){let i=`An error occurred while accessing ${e.layerJsonResource.url}.`;if(c(t)&&(i+=`
|
|
${t.message}`),e.previousError=Er.reportError(e.previousError,n,c(n)?n._errorEvent:void 0,i),e.previousError.retry)return nL(e,n);throw new Te(i)}async function b8e(e,t,n){await fq(e,t,n);const i=e.overallAvailability.length;if(i>0){const o=e.availability=new ad(e.tilingScheme,e.overallMaxZoom);for(let r=0;r<i;++r){const s=e.overallAvailability[r];for(let a=0;a<s.length;++a){const l=s[a];o.addAvailableTileRange(r,l[0],l[1],l[2],l[3])}}}if(e.attribution.length>0){const o=new Wt(e.attribution);e.tileCredits.push(o)}return!0}async function nL(e,t){try{const n=await e.layerJsonResource.fetchJson();return b8e(e,n,t)}catch(n){return c(n)&&n.statusCode===404?(await fq(e,{tilejson:"2.1.0",format:"heightmap-1.0",version:"1.0.0",scheme:"tms",tiles:["{z}/{x}/{y}.terrain?v={version}"]},t),!0):y8e(e,n,t)}}function zc(e){e=y(e,y.EMPTY_OBJECT),this._heightmapWidth=void 0,this._heightmapStructure=void 0,this._hasWaterMask=!1,this._hasVertexNormals=!1,this._hasMetadata=!1,this._scheme=void 0,this._ellipsoid=e.ellipsoid,this._requestVertexNormals=y(e.requestVertexNormals,!1),this._requestWaterMask=y(e.requestWaterMask,!1),this._requestMetadata=y(e.requestMetadata,!0),this._errorEvent=new Le;let t=e.credit;typeof t=="string"&&(t=new Wt(t)),this._credit=t,this._availability=void 0,this._tilingScheme=void 0,this._levelZeroMaximumGeometricError=void 0,this._layers=void 0,this._tileCredits=void 0}const Kv={OCT_VERTEX_NORMALS:1,WATER_MASK:2,METADATA:4};function zz(e){return!c(e)||e.length===0?{Accept:"application/vnd.quantized-mesh,application/octet-stream;q=0.9,*/*;q=0.01"}:{Accept:`application/vnd.quantized-mesh;extensions=${e.join("-")},application/octet-stream;q=0.9,*/*;q=0.01`}}function T8e(e,t,n,i,o){const r=new Uint16Array(t,0,e._heightmapWidth*e._heightmapWidth);return new Cl({buffer:r,childTileMask:new Uint8Array(t,r.byteLength,1)[0],waterMask:new Uint8Array(t,r.byteLength+1,t.byteLength-r.byteLength-1),width:e._heightmapWidth,height:e._heightmapWidth,structure:e._heightmapStructure,credits:e._tileCredits})}function A8e(e,t,n,i,o,r){const s=r.littleEndianExtensionSize;let a=0;const l=3,u=l+1,h=Float64Array.BYTES_PER_ELEMENT*l,f=Float64Array.BYTES_PER_ELEMENT*u,_=3,g=Uint16Array.BYTES_PER_ELEMENT*_,m=3;let b=Uint16Array.BYTES_PER_ELEMENT,T=b*m;const x=new DataView(t),C=new d(x.getFloat64(a,!0),x.getFloat64(a+8,!0),x.getFloat64(a+16,!0));a+=h;const w=x.getFloat32(a,!0);a+=Float32Array.BYTES_PER_ELEMENT;const v=x.getFloat32(a,!0);a+=Float32Array.BYTES_PER_ELEMENT;const P=new se(new d(x.getFloat64(a,!0),x.getFloat64(a+8,!0),x.getFloat64(a+16,!0)),x.getFloat64(a+h,!0));a+=f;const N=new d(x.getFloat64(a,!0),x.getFloat64(a+8,!0),x.getFloat64(a+16,!0));a+=h;const k=x.getUint32(a,!0);a+=Uint32Array.BYTES_PER_ELEMENT;const M=new Uint16Array(t,a,k*3);a+=k*g,k>64*1024&&(b=Uint32Array.BYTES_PER_ELEMENT,T=b*m);const U=M.subarray(0,k),B=M.subarray(k,2*k),S=M.subarray(k*2,3*k);En.zigZagDeltaDecode(U,B,S),a%b!==0&&(a+=b-a%b);const D=x.getUint32(a,!0);a+=Uint32Array.BYTES_PER_ELEMENT;const p=je.createTypedArrayFromArrayBuffer(k,t,a,D*m);a+=D*T;let I=0;const O=p.length;for(let re=0;re<O;++re){const de=p[re];p[re]=I-de,de===0&&++I}const F=x.getUint32(a,!0);a+=Uint32Array.BYTES_PER_ELEMENT;const V=je.createTypedArrayFromArrayBuffer(k,t,a,F);a+=F*b;const G=x.getUint32(a,!0);a+=Uint32Array.BYTES_PER_ELEMENT;const j=je.createTypedArrayFromArrayBuffer(k,t,a,G);a+=G*b;const W=x.getUint32(a,!0);a+=Uint32Array.BYTES_PER_ELEMENT;const X=je.createTypedArrayFromArrayBuffer(k,t,a,W);a+=W*b;const q=x.getUint32(a,!0);a+=Uint32Array.BYTES_PER_ELEMENT;const ee=je.createTypedArrayFromArrayBuffer(k,t,a,q);a+=q*b;let Y,ne;for(;a<x.byteLength;){const re=x.getUint8(a,!0);a+=Uint8Array.BYTES_PER_ELEMENT;const de=x.getUint32(a,s);if(a+=Uint32Array.BYTES_PER_ELEMENT,re===Kv.OCT_VERTEX_NORMALS&&e._requestVertexNormals)Y=new Uint8Array(t,a,k*2);else if(re===Kv.WATER_MASK&&e._requestWaterMask)ne=new Uint8Array(t,a,de);else if(re===Kv.METADATA&&e._requestMetadata){const fe=x.getUint32(a,!0);if(fe>0){const Ce=sa(new Uint8Array(t),a+Uint32Array.BYTES_PER_ELEMENT,fe).available;if(c(Ce))for(let we=0;we<Ce.length;++we){const Pe=n+we+1,lt=Ce[we],ft=e._tilingScheme.getNumberOfYTilesAtLevel(Pe);for(let We=0;We<lt.length;++We){const Fe=lt[We],Dt=ft-Fe.endY-1,st=ft-Fe.startY-1;e.availability.addAvailableTileRange(Pe,Fe.startX,Dt,Fe.endX,st),r.availability.addAvailableTileRange(Pe,Fe.startX,Dt,Fe.endX,st)}}}r.availabilityTilesLoaded.addAvailableTileRange(n,i,o,i,o)}a+=de}const Q=e.getLevelMaximumGeometricError(n)*5,le=e._tilingScheme.tileXYToRectangle(i,o,n),pe=Ct.fromRectangle(le,w,v,e._tilingScheme.ellipsoid);return new Yh({center:C,minimumHeight:w,maximumHeight:v,boundingSphere:P,orientedBoundingBox:pe,horizonOcclusionPoint:N,quantizedVertices:M,encodedNormals:Y,indices:p,westIndices:V,southIndices:j,eastIndices:X,northIndices:ee,westSkirtHeight:Q,southSkirtHeight:Q,eastSkirtHeight:Q,northSkirtHeight:Q,childTileMask:e.availability.computeChildMaskForTile(n,i,o),waterMask:ne,credits:e._tileCredits})}zc.prototype.requestTileGeometry=function(e,t,n,i){const o=this._layers;let r;const s=o.length;let a=!1,l=Promise.resolve();if(s===1)r=o[0];else for(let u=0;u<s;++u){const h=o[u];if(!c(h.availability)||h.availability.isTileAvailable(n,e,t)){r=h;break}const f=iL(this,e,t,n,h,u===0);f.result&&(a=!0,l=l.then(()=>f.promise))}return!c(r)&&a?l.then(()=>new Promise(u=>{setTimeout(()=>{const h=this.requestTileGeometry(e,t,n,i);u(h)},0)})):pq(this,e,t,n,r,i)};function pq(e,t,n,i,o,r){if(!c(o))return Promise.reject(new Te("Terrain tile doesn't exist"));const s=o.tileUrlTemplates;if(s.length===0)return;let a;!e._scheme||e._scheme==="tms"?a=e._tilingScheme.getNumberOfYTilesAtLevel(i)-n-1:a=n;const l=[];e._requestVertexNormals&&o.hasVertexNormals&&l.push(o.littleEndianExtensionSize?"octvertexnormals":"vertexnormals"),e._requestWaterMask&&o.hasWaterMask&&l.push("watermask"),e._requestMetadata&&o.hasMetadata&&l.push("metadata");let u,h;const f=s[(t+a+i)%s.length],_=o.resource;c(_._ionEndpoint)&&!c(_._ionEndpoint.externalType)?(l.length!==0&&(h={extensions:l.join("-")}),u=zz(void 0)):u=zz(l);const g=_.getDerivedResource({url:f,templateValues:{version:o.version,z:i,x:t,y:a},queryParameters:h,headers:u,request:r}).fetchArrayBuffer();if(!!c(g))return g.then(function(m){return c(m)?c(e._heightmapStructure)?T8e(e,m):A8e(e,m,i,t,n,o):Promise.reject(new Te("Mesh buffer doesn't exist."))})}Object.defineProperties(zc.prototype,{errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){return this._credit}},tilingScheme:{get:function(){return this._tilingScheme}},hasWaterMask:{get:function(){return this._hasWaterMask&&this._requestWaterMask}},hasVertexNormals:{get:function(){return this._hasVertexNormals&&this._requestVertexNormals}},hasMetadata:{get:function(){return this._hasMetadata&&this._requestMetadata}},requestVertexNormals:{get:function(){return this._requestVertexNormals}},requestWaterMask:{get:function(){return this._requestWaterMask}},requestMetadata:{get:function(){return this._requestMetadata}},availability:{get:function(){return this._availability}}});zc.prototype.getLevelMaximumGeometricError=function(e){return this._levelZeroMaximumGeometricError/(1<<e)};zc.fromIonAssetId=async function(e,t){A.defined("assetId",e);const n=await ar.fromAssetId(e);return zc.fromUrl(n,t)};zc.fromUrl=async function(e,t){A.defined("url",e),t=y(t,y.EMPTY_OBJECT),e=await Promise.resolve(e);const n=Ae.createIfNeeded(e);n.appendForwardSlash();const i=new hq(t);i.lastResource=n,i.layerJsonResource=i.lastResource.getDerivedResource({url:"layer.json"}),await nL(i);const o=new zc(t);return i.build(o),o};zc.prototype.getTileDataAvailable=function(e,t,n){if(!c(this._availability))return;if(n>this._availability._maximumLevel)return!1;if(this._availability.isTileAvailable(n,e,t))return!0;if(!this._hasMetadata)return!1;const i=this._layers,o=i.length;for(let r=0;r<o;++r)if(iL(this,e,t,n,i[r],r===0).result)return;return!1};zc.prototype.loadTileDataAvailability=function(e,t,n){if(!c(this._availability)||n>this._availability._maximumLevel||this._availability.isTileAvailable(n,e,t)||!this._hasMetadata)return;const i=this._layers,o=i.length;for(let r=0;r<o;++r){const s=iL(this,e,t,n,i[r],r===0);if(c(s.promise))return s.promise}};function cP(e,t,n,i){if(i===0)return;const o=e.availabilityLevels,r=i%o===0?i-o:(i/o|0)*o,s=1<<i-r,a=t/s|0,l=n/s|0;return{level:r,x:a,y:l}}function iL(e,t,n,i,o,r){if(!c(o.availabilityLevels))return{result:!1};let s;const a=function(){delete o.availabilityPromiseCache[s]},l=o.availabilityTilesLoaded,u=o.availability;let h=cP(o,t,n,i);for(;c(h);){if(u.isTileAvailable(h.level,h.x,h.y)&&!l.isTileAvailable(h.level,h.x,h.y)){let f;if(!r&&(s=`${h.level}-${h.x}-${h.y}`,f=o.availabilityPromiseCache[s],!c(f))){const _=new iu({throttle:!1,throttleByServer:!0,type:Ip.TERRAIN});f=pq(e,h.x,h.y,h.level,o,_),c(f)&&(o.availabilityPromiseCache[s]=f,f.then(a))}return{result:!0,promise:f}}h=cP(o,h.x,h.y,h.level)}return{result:!1}}zc._getAvailabilityTile=cP;const x8e={SEARCH:0,AUTOCOMPLETE:1},oL=Object.freeze(x8e);function _b(){E.throwInstantiationError()}Object.defineProperties(_b.prototype,{credit:{get:E.throwInstantiationError}});_b.getCreditsFromResult=function(e){if(c(e.attributions))return e.attributions.map(Wt.getIonCredit)};_b.prototype.geocode=E.throwInstantiationError;function rL(e){A.defined("url",e),this._url=Ae.createIfNeeded(e),this._url.appendForwardSlash()}Object.defineProperties(rL.prototype,{url:{get:function(){return this._url}},credit:{get:function(){}}});rL.prototype.geocode=async function(e,t){return A.typeOf.string("query",e),this._url.getDerivedResource({url:t===oL.AUTOCOMPLETE?"autocomplete":"search",queryParameters:{text:e}}).fetchJson().then(function(i){return i.features.map(function(o){let r;const s=o.bbox;if(c(s))r=ce.fromDegrees(s[0],s[1],s[2],s[3]);else{const a=o.geometry.coordinates[0],l=o.geometry.coordinates[1];r=d.fromDegrees(a,l)}return{displayName:o.properties.label,destination:r,attributions:i.attributions}})})};function sL(e){e=y(e,y.EMPTY_OBJECT),A.typeOf.object("options.scene",e.scene);const t=y(e.accessToken,Zf.defaultAccessToken),n=Ae.createIfNeeded(y(e.server,Zf.defaultServer));n.appendForwardSlash();const i=Zf.getDefaultTokenCredit(t);c(i)&&e.scene.frameState.creditDisplay.addStaticCredit(Wt.clone(i));const o=n.getDerivedResource({url:"v1/geocode"});c(t)&&o.appendQueryParameters({access_token:t}),this._accessToken=t,this._server=n,this._pelias=new rL(o)}Object.defineProperties(sL.prototype,{credit:{get:function(){}}});sL.prototype.geocode=async function(e,t){return this._pelias.geocode(e,t)};function C8e(e){return e=y(e,y.EMPTY_OBJECT),zc.fromIonAssetId(2426648,{requestVertexNormals:y(e.requestVertexNormals,!1)})}function mq(e){return e=y(e,y.EMPTY_OBJECT),zc.fromIonAssetId(1,{requestVertexNormals:y(e.requestVertexNormals,!1),requestWaterMask:y(e.requestWaterMask,!1)})}async function E8e(e,t,n,i){return c(i)||(i=!1),A.typeOf.object("terrainProvider",e),A.typeOf.number("level",t),A.typeOf.bool("rejectOnTileFail",i),A.defined("positions",n),v8e(e,t,n,i)}function w8e(e,t,n){const i=e[0],o=i.terrainProvider.requestTileGeometry(i.x,i.y,i.level);if(!o)return!1;let r;return n?r=o.then(kz(i)):r=o.then(kz(i)).catch(I8e(i)),e.shift(),t.push(r),!0}function S8e(e){return new Promise(function(t){setTimeout(t,e)})}function lP(e,t,n){return e.length?w8e(e,t,n)?lP(e,t):S8e(100).then(()=>lP(e,t)):Promise.resolve()}function v8e(e,t,n,i){const o=e.tilingScheme;let r;const s=[],a={};for(r=0;r<n.length;++r){const u=o.positionToTileXY(n[r],t);if(!c(u))continue;const h=u.toString();if(!a.hasOwnProperty(h)){const f={x:u.x,y:u.y,level:t,tilingScheme:o,terrainProvider:e,positions:[]};a[h]=f,s.push(f)}a[h].positions.push(n[r])}const l=[];return lP(s,l,i).then(function(){return Promise.all(l).then(function(){return n})})}function Uz(e,t,n){const i=t.interpolateHeight(n,e.longitude,e.latitude);return i===void 0?!1:(e.height=i,!0)}function kz(e){const t=e.positions,n=e.tilingScheme.tileXYToRectangle(e.x,e.y,e.level);return function(i){let o=!1;for(let r=0;r<t.length;++r){const s=t[r];if(!Uz(s,i,n)){o=!0;break}}return o?i.createMesh({tilingScheme:e.tilingScheme,x:e.x,y:e.y,level:e.level,throttle:!1}).then(function(){for(let r=0;r<t.length;++r){const s=t[r];Uz(s,i,n)}}):Promise.resolve()}}function I8e(e){const t=e.positions;return function(){for(let n=0;n<t.length;++n){const i=t[n];i.height=void 0}}}const Zv=new H;async function aL(e,t,n){if(c(n)||(n=!1),!c(e))throw new E("terrainProvider is required.");if(!c(t))throw new E("positions is required.");const i=[],o=[],r=e.availability;if(!c(r))throw new E("sampleTerrainMostDetailed requires a terrain provider that has tile availability.");const s=[];for(let l=0;l<t.length;++l){const u=t[l],h=r.computeMaximumLevelAtPosition(u);if(o[l]=h,h===0){e.tilingScheme.positionToTileXY(u,1,Zv);const _=e.loadTileDataAvailability(Zv.x,Zv.y,1);c(_)&&s.push(_)}let f=i[h];c(f)||(i[h]=f=[]),f.push(u)}await Promise.all(s),await Promise.all(i.map(function(l,u){if(c(l))return E8e(e,u,l,n)}));const a=[];for(let l=0;l<t.length;++l){const u=t[l];r.computeMaximumLevelAtPosition(u)!==o[l]&&a.push(u)}return a.length>0&&await aL(e,a,n),t}const D8e=new Wt("MapQuest, Open Street Map and contributors, CC-BY-SA");function ch(e){e=y(e,y.EMPTY_OBJECT);const t=Ae.createIfNeeded(y(e.url,"https://tile.openstreetmap.org/"));t.appendForwardSlash(),t.url+=`{z}/{x}/{y}${e.retinaTiles?"@2x":""}.${y(e.fileExtension,"png")}`;const n=new ws({ellipsoid:e.ellipsoid}),i=256,o=256,r=y(e.minimumLevel,0),s=e.maximumLevel,a=y(e.rectangle,n.rectangle),l=n.positionToTileXY(ce.southwest(a),r),u=n.positionToTileXY(ce.northeast(a),r),h=(Math.abs(u.x-l.x)+1)*(Math.abs(u.y-l.y)+1);if(h>4)throw new E(`The rectangle and minimumLevel indicate that there are ${h} tiles at the minimum level. Imagery providers with more than four tiles at the minimum level are not supported.`);let f=y(e.credit,D8e);typeof f=="string"&&(f=new Wt(f)),zl.call(this,{url:t,credit:f,tilingScheme:n,tileWidth:i,tileHeight:o,minimumLevel:r,maximumLevel:s,rectangle:a})}c(Object.create)&&(ch.prototype=Object.create(zl.prototype),ch.prototype.constructor=ch);function P8e(e,t,n){return A.typeOf.string("samplerUniformName",e),A.typeOf.string("matrixUniformName",t),A.typeOf.string("styleUniformName",n),` float clipDistance = clip(gl_FragCoord, ${e}, ${t});
|
|
vec4 clippingPlanesEdgeColor = vec4(1.0);
|
|
clippingPlanesEdgeColor.rgb = ${n}.rgb;
|
|
float clippingPlanesEdgeWidth = ${n}.a;
|
|
if (clipDistance > 0.0 && clipDistance < clippingPlanesEdgeWidth)
|
|
{
|
|
out_FragColor = clippingPlanesEdgeColor;
|
|
}
|
|
`}const O8e={modifyFragmentShader:function(t){return t=Oe.replaceMain(t,"czm_splitter_main"),t+=`uniform float czm_splitDirection;
|
|
void main()
|
|
{
|
|
#ifndef SHADOW_MAP
|
|
if (czm_splitDirection < 0.0 && gl_FragCoord.x > czm_splitPosition) discard;
|
|
if (czm_splitDirection > 0.0 && gl_FragCoord.x < czm_splitPosition) discard;
|
|
#endif
|
|
czm_splitter_main();
|
|
}
|
|
`,t},addUniforms:function(t,n){n.czm_splitDirection=function(){return t.splitDirection}}},_q=O8e,Gf={NEEDS_DECODE:0,DECODING:1,READY:2,FAILED:3};function gb(e){A.typeOf.object("options",e),A.typeOf.object("options.arrayBuffer",e.arrayBuffer),this._parsedContent=void 0,this._drawCommand=void 0,this._isTranslucent=!1,this._styleTranslucent=!1,this._constantColor=z.clone(z.DARKGRAY),this._highlightColor=z.clone(z.WHITE),this._pointSize=1,this._rtcCenter=void 0,this._quantizedVolumeScale=void 0,this._quantizedVolumeOffset=void 0,this._styleableShaderAttributes=void 0,this._isQuantized=!1,this._isOctEncoded16P=!1,this._isRGB565=!1,this._hasColors=!1,this._hasNormals=!1,this._hasBatchIds=!1,this._decodingState=Gf.READY,this._dequantizeInShader=!0,this._isQuantizedDraco=!1,this._isOctEncodedDraco=!1,this._quantizedRange=0,this._octEncodedRange=0,this.backFaceCulling=!1,this._backFaceCulling=!1,this.normalShading=!0,this._normalShading=!0,this._opaqueRenderState=void 0,this._translucentRenderState=void 0,this._mode=void 0,this._ready=!1,this._pointsLength=0,this._geometryByteLength=0,this._vertexShaderLoaded=e.vertexShaderLoaded,this._fragmentShaderLoaded=e.fragmentShaderLoaded,this._uniformMapLoaded=e.uniformMapLoaded,this._batchTableLoaded=e.batchTableLoaded,this._pickIdLoaded=e.pickIdLoaded,this._opaquePass=y(e.opaquePass,xe.OPAQUE),this._cull=y(e.cull,!0),this.style=void 0,this._style=void 0,this.styleDirty=!1,this.modelMatrix=L.clone(L.IDENTITY),this._modelMatrix=L.clone(L.IDENTITY),this.time=0,this.shadows=Vi.ENABLED,this._boundingSphere=void 0,this.clippingPlanes=void 0,this.isClipped=!1,this.clippingPlanesDirty=!1,this.clippingPlanesOriginMatrix=void 0,this.attenuation=!1,this._attenuation=!1,this.geometricError=0,this.geometricErrorScale=1,this.maximumAttenuation=this._pointSize,this.splitDirection=y(e.splitDirection,zp.NONE),this._splittingEnabled=!1,this._error=void 0,L8e(this,e)}Object.defineProperties(gb.prototype,{pointsLength:{get:function(){return this._pointsLength}},geometryByteLength:{get:function(){return this._geometryByteLength}},ready:{get:function(){return this._ready}},color:{get:function(){return z.clone(this._highlightColor)},set:function(e){this._highlightColor=z.clone(e,this._highlightColor)}},boundingSphere:{get:function(){if(c(this._drawCommand))return this._drawCommand.boundingVolume},set:function(e){this._boundingSphere=se.clone(e,this._boundingSphere)}}});function L8e(e,t){const n=U5.parse(t.arrayBuffer,t.byteOffset);if(e._parsedContent=n,e._rtcCenter=n.rtcCenter,e._hasNormals=n.hasNormals,e._hasColors=n.hasColors,e._hasBatchIds=n.hasBatchIds,e._isTranslucent=n.isTranslucent,!n.hasBatchIds&&c(n.batchTableBinary)&&(n.styleableProperties=Hn.getBinaryProperties(n.pointsLength,n.batchTableJson,n.batchTableBinary)),c(n.draco)){const a=n.draco;e._decodingState=Gf.NEEDS_DECODE,a.dequantizeInShader=e._dequantizeInShader}const i=n.positions;c(i)&&(e._isQuantized=i.isQuantized,e._quantizedVolumeScale=i.quantizedVolumeScale,e._quantizedVolumeOffset=i.quantizedVolumeOffset,e._quantizedRange=i.quantizedRange);const o=n.normals;c(o)&&(e._isOctEncoded16P=o.octEncoded);const r=n.colors;c(r)&&(c(r.constantColor)&&(e._constantColor=z.clone(r.constantColor,e._constantColor),e._hasColors=!1),e._isRGB565=r.isRGB565);const s=n.batchIds;c(n.batchIds)&&(s.name="BATCH_ID",s.semantic="BATCH_ID",s.setIndex=void 0),n.hasBatchIds&&e._batchTableLoaded(n.batchLength,n.batchTableJson,n.batchTableBinary),e._pointsLength=n.pointsLength}const R8e=new d,N8e=new d,M8e=new d;let Vz,EA;function F8e(e){if(!c(EA)){Vz=new fC(0),EA=new Array(e);for(let t=0;t<e;++t)EA[t]=Vz.random()}return EA}function B8e(e){const n=e.length/3,i=Math.min(n,20),o=F8e(20),r=Number.MAX_VALUE,s=-Number.MAX_VALUE,a=d.fromElements(r,r,r,R8e),l=d.fromElements(s,s,s,N8e);for(let h=0;h<i;++h){const f=Math.floor(o[h]*n),_=d.unpack(e,f*3,M8e);d.minimumByComponent(a,_,a),d.maximumByComponent(l,_,l)}const u=se.fromCornerPoints(a,l);return u.radius+=R.EPSILON2,u}function Hz(e,t){const n=Z.fromTypedArray(e);return n===Z.INT||n===Z.UNSIGNED_INT||n===Z.DOUBLE?($n("Cast pnts property to floats",`Point cloud property "${t}" will be cast to a float array because INT, UNSIGNED_INT, and DOUBLE are not valid WebGL vertex attribute types. Some precision may be lost.`),new Float32Array(e)):e}const z8e=new te,U8e=new te,k8e=new z,gq=0,dC=1,uP=2,yq=3,V8e=4,Jv=new L,H8e=new L;function G8e(e,t){const n=t.context,i=e._parsedContent,o=e._pointsLength,r=i.positions,s=i.colors,a=i.normals,l=i.batchIds,u=i.styleableProperties,h=c(u),f=e._isQuantized,_=e._isQuantizedDraco,g=e._isOctEncoded16P,m=e._isOctEncodedDraco,b=e._quantizedRange,T=e._octEncodedRange,x=e._isRGB565,C=e._isTranslucent,w=e._hasColors,v=e._hasNormals,P=e._hasBatchIds;let N,k;const M=[],U={};if(e._styleableShaderAttributes=U,h){let G=V8e;for(const j in u)if(u.hasOwnProperty(j)){const W=u[j],X=Hz(W.typedArray,j);N=W.componentCount,k=Z.fromTypedArray(X);const q=ct.createVertexBuffer({context:n,typedArray:X,usage:ke.STATIC_DRAW});e._geometryByteLength+=q.sizeInBytes;const ee={index:G,vertexBuffer:q,componentsPerAttribute:N,componentDatatype:k,normalize:!1,offsetInBytes:0,strideInBytes:0};M.push(ee),U[j]={location:G,componentCount:N},++G}}const B=ct.createVertexBuffer({context:n,typedArray:r.typedArray,usage:ke.STATIC_DRAW});e._geometryByteLength+=B.sizeInBytes;let S;w&&(S=ct.createVertexBuffer({context:n,typedArray:s.typedArray,usage:ke.STATIC_DRAW}),e._geometryByteLength+=S.sizeInBytes);let D;v&&(D=ct.createVertexBuffer({context:n,typedArray:a.typedArray,usage:ke.STATIC_DRAW}),e._geometryByteLength+=D.sizeInBytes);let p;P&&(l.typedArray=Hz(l.typedArray,"batchIds"),p=ct.createVertexBuffer({context:n,typedArray:l.typedArray,usage:ke.STATIC_DRAW}),e._geometryByteLength+=p.sizeInBytes);let I=[];if(f?k=Z.UNSIGNED_SHORT:_?k=b<=255?Z.UNSIGNED_BYTE:Z.UNSIGNED_SHORT:k=Z.FLOAT,I.push({index:gq,vertexBuffer:B,componentsPerAttribute:3,componentDatatype:k,normalize:!1,offsetInBytes:0,strideInBytes:0}),e._cull&&(f||_?e._boundingSphere=se.fromCornerPoints(d.ZERO,e._quantizedVolumeScale):e._boundingSphere=B8e(r.typedArray)),w)if(x)I.push({index:dC,vertexBuffer:S,componentsPerAttribute:1,componentDatatype:Z.UNSIGNED_SHORT,normalize:!1,offsetInBytes:0,strideInBytes:0});else{const G=C?4:3;I.push({index:dC,vertexBuffer:S,componentsPerAttribute:G,componentDatatype:Z.UNSIGNED_BYTE,normalize:!0,offsetInBytes:0,strideInBytes:0})}v&&(g?(N=2,k=Z.UNSIGNED_BYTE):m?(N=2,k=T<=255?Z.UNSIGNED_BYTE:Z.UNSIGNED_SHORT):(N=3,k=Z.FLOAT),I.push({index:uP,vertexBuffer:D,componentsPerAttribute:N,componentDatatype:k,normalize:!1,offsetInBytes:0,strideInBytes:0})),P&&I.push({index:yq,vertexBuffer:p,componentsPerAttribute:1,componentDatatype:Z.fromTypedArray(l.typedArray),normalize:!1,offsetInBytes:0,strideInBytes:0}),h&&(I=I.concat(M));const O=new Ci({context:n,attributes:I}),F={depthTest:{enabled:!0}},V={depthTest:{enabled:!0},depthMask:!1,blending:Zn.ALPHA_BLEND};e._opaquePass===xe.CESIUM_3D_TILE&&(F.stencilTest=At.setCesium3DTileBit(),F.stencilMask=At.CESIUM_3D_TILE_MASK,V.stencilTest=At.setCesium3DTileBit(),V.stencilMask=At.CESIUM_3D_TILE_MASK),e._opaqueRenderState=Ue.fromCache(F),e._translucentRenderState=Ue.fromCache(V),e._drawCommand=new Ze({boundingVolume:new se,cull:e._cull,modelMatrix:new L,primitiveType:ze.POINTS,vertexArray:O,count:o,shaderProgram:void 0,uniformMap:void 0,renderState:C?e._translucentRenderState:e._opaqueRenderState,pass:C?xe.TRANSLUCENT:e._opaquePass,owner:e,castShadows:!1,receiveShadows:!1,pickId:e._pickIdLoaded()})}function j8e(e,t){const n=t.context,i=e._isQuantized,o=e._isQuantizedDraco,r=e._isOctEncodedDraco;let s={u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier:function(){const a=z8e;if(a.x=e._attenuation?e.maximumAttenuation:e._pointSize,a.x*=t.pixelRatio,a.y=e.time,e._attenuation){const l=t.camera.frustum;let u;t.mode===oe.SCENE2D||l instanceof It?u=Number.POSITIVE_INFINITY:u=n.drawingBufferHeight/t.camera.frustum.sseDenominator,a.z=e.geometricError*e.geometricErrorScale,a.w=u}return a},u_highlightColor:function(){return e._highlightColor},u_constantColor:function(){return e._constantColor},u_clippingPlanes:function(){const a=e.clippingPlanes;return e.isClipped?a.texture:n.defaultTexture},u_clippingPlanesEdgeStyle:function(){const a=e.clippingPlanes;if(!c(a))return z.TRANSPARENT;const l=z.clone(a.edgeColor,k8e);return l.alpha=a.edgeWidth,l},u_clippingPlanesMatrix:function(){const a=e.clippingPlanes;if(!c(a))return L.IDENTITY;const l=y(e.clippingPlanesOriginMatrix,e._modelMatrix);L.multiply(n.uniformState.view3D,l,Jv);const u=L.multiply(Jv,a.modelMatrix,Jv);return L.inverseTranspose(u,H8e)}};_q.addUniforms(e,s),(i||o||r)&&(s=jt(s,{u_quantizedVolumeScaleAndOctEncodedRange:function(){const a=U8e;if(c(e._quantizedVolumeScale)){const l=d.clone(e._quantizedVolumeScale,a);d.divideByScalar(l,e._quantizedRange,a)}return a.w=e._octEncodedRange,a}})),c(e._uniformMapLoaded)&&(s=e._uniformMapLoaded(s)),e._drawCommand.uniformMap=s}function eI(e,t){const n=/czm_3dtiles_property_(\d+)/g;let i=n.exec(e);for(;i!==null;){const o=parseInt(i[1]);t.indexOf(o)===-1&&t.push(o),i=n.exec(e)}}function tI(e,t){e=e.slice(e.indexOf(`
|
|
`));const n=/czm_3dtiles_builtin_property_(\w+)/g;let i=n.exec(e);for(;i!==null;){const o=i[1];t.indexOf(o)===-1&&t.push(o),i=n.exec(e)}}function nI(e,t){const n=e.numberOfAttributes;for(let i=0;i<n;++i){const o=e.getAttribute(i);if(o.index===t)return o}}const W8e={POSITION:"czm_3dtiles_builtin_property_POSITION",POSITION_ABSOLUTE:"czm_3dtiles_builtin_property_POSITION_ABSOLUTE",COLOR:"czm_3dtiles_builtin_property_COLOR",NORMAL:"czm_3dtiles_builtin_property_NORMAL"};function q8e(e,t,n){let i,o,r;const s=t.context,a=c(n),l=e._isQuantized,u=e._isQuantizedDraco,h=e._isOctEncoded16P,f=e._isOctEncodedDraco,_=e._isRGB565,g=e._isTranslucent,m=e._hasColors,b=e._hasNormals,T=e._hasBatchIds,x=e._backFaceCulling,C=e._normalShading,w=e._drawCommand.vertexArray,v=e.clippingPlanes,P=e._attenuation;let N,k,M,U=g;const B=Je(W8e),S={},D=e._styleableShaderAttributes;for(o in D)D.hasOwnProperty(o)&&(r=D[o],B[o]=`czm_3dtiles_property_${r.location}`,S[r.location]=r);if(a){const re={translucent:!1},de="(vec3 czm_3dtiles_builtin_property_POSITION, vec3 czm_3dtiles_builtin_property_POSITION_ABSOLUTE, vec4 czm_3dtiles_builtin_property_COLOR, vec3 czm_3dtiles_builtin_property_NORMAL)";N=n.getColorShaderFunction(`getColorFromStyle${de}`,B,re),k=n.getShowShaderFunction(`getShowFromStyle${de}`,B,re),M=n.getPointSizeShaderFunction(`getPointSizeFromStyle${de}`,B,re),c(N)&&re.translucent&&(U=!0)}e._styleTranslucent=U;const p=c(N),I=c(k),O=c(M),F=e.isClipped,V=[],G=[];p&&(eI(N,V),tI(N,G)),I&&(eI(k,V),tI(k,G)),O&&(eI(M,V),tI(M,G));const j=G.indexOf("COLOR")>=0,W=G.indexOf("NORMAL")>=0;if(W&&!b)throw new Te("Style references the NORMAL semantic but the point cloud does not have normals");for(o in D)if(D.hasOwnProperty(o)){r=D[o];const re=V.indexOf(r.location)>=0,de=nI(w,r.location);de.enabled=re}const X=m&&(!p||j);if(m){const re=nI(w,dC);re.enabled=X}const q=b&&(C||x||W);if(b){const re=nI(w,uP);re.enabled=q}const ee={a_position:gq};X&&(ee.a_color=dC),q&&(ee.a_normal=uP),T&&(ee.a_batchId=yq);let Y="";const ne=V.length;for(i=0;i<ne;++i){const re=V[i];r=S[re];const de=r.componentCount,fe=`czm_3dtiles_property_${re}`;let ye;de===1?ye="float":ye=`vec${de}`,Y+=`in ${ye} ${fe};
|
|
`,ee[fe]=r.location}j8e(e,t);let Q=`in vec3 a_position;
|
|
out vec4 v_color;
|
|
uniform vec4 u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier;
|
|
uniform vec4 u_constantColor;
|
|
uniform vec4 u_highlightColor;
|
|
`;Q+=`float u_pointSize;
|
|
float tiles3d_tileset_time;
|
|
`,P&&(Q+=`float u_geometricError;
|
|
float u_depthMultiplier;
|
|
`),Q+=Y,X&&(g?Q+=`in vec4 a_color;
|
|
`:_?Q+=`in float a_color;
|
|
const float SHIFT_RIGHT_11 = 1.0 / 2048.0;
|
|
const float SHIFT_RIGHT_5 = 1.0 / 32.0;
|
|
const float SHIFT_LEFT_11 = 2048.0;
|
|
const float SHIFT_LEFT_5 = 32.0;
|
|
const float NORMALIZE_6 = 1.0 / 64.0;
|
|
const float NORMALIZE_5 = 1.0 / 32.0;
|
|
`:Q+=`in vec3 a_color;
|
|
`),q&&(h||f?Q+=`in vec2 a_normal;
|
|
`:Q+=`in vec3 a_normal;
|
|
`),T&&(Q+=`in float a_batchId;
|
|
`),(l||u||f)&&(Q+=`uniform vec4 u_quantizedVolumeScaleAndOctEncodedRange;
|
|
`),p&&(Q+=N),I&&(Q+=k),O&&(Q+=M),Q+=`void main()
|
|
{
|
|
u_pointSize = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.x;
|
|
tiles3d_tileset_time = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.y;
|
|
`,P&&(Q+=` u_geometricError = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.z;
|
|
u_depthMultiplier = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.w;
|
|
`),X?g?Q+=` vec4 color = a_color;
|
|
`:_?Q+=` float compressed = a_color;
|
|
float r = floor(compressed * SHIFT_RIGHT_11);
|
|
compressed -= r * SHIFT_LEFT_11;
|
|
float g = floor(compressed * SHIFT_RIGHT_5);
|
|
compressed -= g * SHIFT_LEFT_5;
|
|
float b = compressed;
|
|
vec3 rgb = vec3(r * NORMALIZE_5, g * NORMALIZE_6, b * NORMALIZE_5);
|
|
vec4 color = vec4(rgb, 1.0);
|
|
`:Q+=` vec4 color = vec4(a_color, 1.0);
|
|
`:Q+=` vec4 color = u_constantColor;
|
|
`,l||u?Q+=` vec3 position = a_position * u_quantizedVolumeScaleAndOctEncodedRange.xyz;
|
|
`:Q+=` vec3 position = a_position;
|
|
`,Q+=` vec3 position_absolute = vec3(czm_model * vec4(position, 1.0));
|
|
`,q?(h?Q+=` vec3 normal = czm_octDecode(a_normal);
|
|
`:f?Q+=` vec3 normal = czm_octDecode(a_normal, u_quantizedVolumeScaleAndOctEncodedRange.w).zxy;
|
|
`:Q+=` vec3 normal = a_normal;
|
|
`,Q+=` vec3 normalEC = czm_normal * normal;
|
|
`):Q+=` vec3 normal = vec3(1.0);
|
|
`,p&&(Q+=` color = getColorFromStyle(position, position_absolute, color, normal);
|
|
`),I&&(Q+=` float show = float(getShowFromStyle(position, position_absolute, color, normal));
|
|
`),O?Q+=` gl_PointSize = getPointSizeFromStyle(position, position_absolute, color, normal) * czm_pixelRatio;
|
|
`:P?Q+=` vec4 positionEC = czm_modelView * vec4(position, 1.0);
|
|
float depth = -positionEC.z;
|
|
gl_PointSize = min((u_geometricError / depth) * u_depthMultiplier, u_pointSize);
|
|
`:Q+=` gl_PointSize = u_pointSize;
|
|
`,Q+=` color = color * u_highlightColor;
|
|
`,q&&C&&(Q+=` float diffuseStrength = czm_getLambertDiffuse(czm_lightDirectionEC, normalEC);
|
|
diffuseStrength = max(diffuseStrength, 0.4);
|
|
color.xyz *= diffuseStrength * czm_lightColor;
|
|
`),Q+=` v_color = color;
|
|
gl_Position = czm_modelViewProjection * vec4(position, 1.0);
|
|
`,q&&x&&(Q+=` float visible = step(-normalEC.z, 0.0);
|
|
gl_Position *= visible;
|
|
gl_PointSize *= visible;
|
|
`),I&&(Q+=` gl_Position.w *= float(show);
|
|
gl_PointSize *= float(show);
|
|
`),Q+=`}
|
|
`;let le=`in vec4 v_color;
|
|
`;F&&(le+=`uniform highp sampler2D u_clippingPlanes;
|
|
uniform mat4 u_clippingPlanesMatrix;
|
|
uniform vec4 u_clippingPlanesEdgeStyle;
|
|
`,le+=`
|
|
`,le+=p1(v,s),le+=`
|
|
`),le+=`void main()
|
|
{
|
|
out_FragColor = czm_gammaCorrect(v_color);
|
|
`,F&&(le+=P8e("u_clippingPlanes","u_clippingPlanesMatrix","u_clippingPlanesEdgeStyle")),le+=`}
|
|
`,e.splitDirection!==zp.NONE&&(le=_q.modifyFragmentShader(le)),c(e._vertexShaderLoaded)&&(Q=e._vertexShaderLoaded(Q)),c(e._fragmentShaderLoaded)&&(le=e._fragmentShaderLoaded(le));const pe=e._drawCommand;c(pe.shaderProgram)&&pe.shaderProgram.destroy(),pe.shaderProgram=Jt.fromCache({context:s,vertexShaderSource:Q,fragmentShaderSource:le,attributeLocations:ee});try{pe.shaderProgram._bind()}catch{throw new Te("Error generating style shader: this may be caused by a type mismatch, index out-of-bounds, or other syntax error.")}}function Y8e(e,t){if(e._decodingState===Gf.READY)return!1;if(e._decodingState===Gf.NEEDS_DECODE){const n=e._parsedContent,i=n.draco,o=Fi.decodePointCloud(i,t);c(o)&&(e._decodingState=Gf.DECODING,o.then(function(r){e._decodingState=Gf.READY;const s=c(r.POSITION)?r.POSITION.array:void 0,a=c(r.RGB)?r.RGB.array:void 0,l=c(r.RGBA)?r.RGBA.array:void 0,u=c(r.NORMAL)?r.NORMAL.array:void 0,h=c(r.BATCH_ID)?r.BATCH_ID.array:void 0,f=c(s)&&c(r.POSITION.data.quantization),_=c(u)&&c(r.NORMAL.data.quantization);if(f){const T=r.POSITION.data.quantization,x=T.range;e._quantizedVolumeScale=d.fromElements(x,x,x),e._quantizedVolumeOffset=d.unpack(T.minValues),e._quantizedRange=(1<<T.quantizationBits)-1,e._isQuantizedDraco=!0}_&&(e._octEncodedRange=(1<<r.NORMAL.data.quantization.quantizationBits)-1,e._isOctEncodedDraco=!0);let g=n.styleableProperties;const m=i.batchTableProperties;for(const T in m)if(m.hasOwnProperty(T)){const x=r[T];c(g)||(g={}),g[T]={typedArray:x.array,componentCount:x.data.componentsPerAttribute}}c(s)&&(n.positions={typedArray:s});const b=y(l,a);c(b)&&(n.colors={typedArray:b}),c(u)&&(n.normals={typedArray:u}),c(h)&&(n.batchIds={typedArray:h}),n.styleableProperties=g}).catch(function(r){e._decodingState=Gf.FAILED,e._error=r}))}return!0}const $8e=new te,X8e=new d;gb.prototype.update=function(e){const t=e.context;if(c(this._error)){const u=this._error;throw this._error=void 0,u}if(Y8e(this,t))return;let i=!1,o=!L.equals(this._modelMatrix,this.modelMatrix);if(this._mode!==e.mode&&(this._mode=e.mode,o=!0),c(this._drawCommand)||(G8e(this,e),o=!0,i=!0,this._ready=!0,this._parsedContent=void 0),o){L.clone(this.modelMatrix,this._modelMatrix);const u=this._drawCommand.modelMatrix;if(L.clone(this._modelMatrix,u),c(this._rtcCenter)&&L.multiplyByTranslation(u,this._rtcCenter,u),c(this._quantizedVolumeOffset)&&L.multiplyByTranslation(u,this._quantizedVolumeOffset,u),e.mode!==oe.SCENE3D){const f=e.mapProjection,_=L.getColumn(u,3,$8e);te.equals(_,te.UNIT_W)||zt.basisTo2D(f,u,u)}const h=this._drawCommand.boundingVolume;if(se.clone(this._boundingSphere,h),this._cull){const f=h.center;L.multiplyByPoint(u,f,f);const _=L.getScale(u,X8e);h.radius*=d.maximumComponent(_)}}this.clippingPlanesDirty&&(this.clippingPlanesDirty=!1,i=!0),this._attenuation!==this.attenuation&&(this._attenuation=this.attenuation,i=!0),this.backFaceCulling!==this._backFaceCulling&&(this._backFaceCulling=this.backFaceCulling,i=!0),this.normalShading!==this._normalShading&&(this._normalShading=this.normalShading,i=!0),(this._style!==this.style||this.styleDirty)&&(this._style=this.style,this.styleDirty=!1,i=!0);const r=this.splitDirection!==zp.NONE;this._splittingEnabled!==r&&(this._splittingEnabled=r,i=!0),i&&q8e(this,e,this._style),this._drawCommand.castShadows=Vi.castShadows(this.shadows),this._drawCommand.receiveShadows=Vi.receiveShadows(this.shadows);const s=this._highlightColor.alpha<1||this._constantColor.alpha<1||this._styleTranslucent;this._drawCommand.renderState=s?this._translucentRenderState:this._opaqueRenderState,this._drawCommand.pass=s?xe.TRANSLUCENT:this._opaquePass;const a=e.commandList,l=e.passes;(l.render||l.pick)&&a.push(this._drawCommand)};gb.prototype.isDestroyed=function(){return!1};gb.prototype.destroy=function(){const e=this._drawCommand;return c(e)&&(e.vertexArray=e.vertexArray&&e.vertexArray.destroy(),e.shaderProgram=e.shaderProgram&&e.shaderProgram.destroy()),ve(this)};function U_(e){A.typeOf.object("terrainProviderPromise",e),this._ready=!1,this._provider=void 0,this._errorEvent=new Le,this._readyEvent=new Le,K8e(this,e)}Object.defineProperties(U_.prototype,{errorEvent:{get:function(){return this._errorEvent}},readyEvent:{get:function(){return this._readyEvent}},ready:{get:function(){return this._ready}},provider:{get:function(){return this._provider}}});U_.fromWorldTerrain=function(e){return new U_(mq(e))};U_.fromWorldBathymetry=function(e){return new U_(C8e(e))};function Q8e(e,t){e.numberOfListeners>0?e.raiseEvent(t):console.error(t)}async function K8e(e,t){let n;try{n=await Promise.resolve(t),e._provider=n,e._ready=!0,e._readyEvent.raiseEvent(n)}catch(i){Q8e(e._errorEvent,i)}}function af(e){e=y(e,y.EMPTY_OBJECT),A.typeOf.object("options.clock",e.clock),A.typeOf.object("options.intervals",e.intervals),this.show=y(e.show,!0),this.modelMatrix=L.clone(y(e.modelMatrix,L.IDENTITY)),this.shadows=y(e.shadows,Vi.ENABLED),this.maximumMemoryUsage=y(e.maximumMemoryUsage,256),this.shading=new q0(e.shading),this.style=e.style,this.frameFailed=new Le,this.frameChanged=new Le,this._clock=e.clock,this._intervals=e.intervals,this._clippingPlanes=void 0,this.clippingPlanes=e.clippingPlanes,this._pointCloudEyeDomeLighting=new Jh,this._loadTimestamp=void 0,this._clippingPlanesState=0,this._styleDirty=!1,this._pickId=void 0,this._totalMemoryUsageInBytes=0,this._frames=[],this._previousInterval=void 0,this._nextInterval=void 0,this._lastRenderedFrame=void 0,this._clockMultiplier=0,this._runningSum=0,this._runningLength=0,this._runningIndex=0,this._runningSamples=new Array(5).fill(0),this._runningAverage=0}Object.defineProperties(af.prototype,{clippingPlanes:{get:function(){return this._clippingPlanes},set:function(e){Li.setOwner(e,this,"_clippingPlanes")}},totalMemoryUsageInBytes:{get:function(){return this._totalMemoryUsageInBytes}},boundingSphere:{get:function(){if(c(this._lastRenderedFrame))return this._lastRenderedFrame.pointCloud.boundingSphere}}});function Z8e(e){return`uniform vec4 czm_pickColor;
|
|
${e}`}function J8e(e){return function(t){return jt(t,{czm_pickColor:function(){return e._pickId.color}})}}function eGe(){return"czm_pickColor"}af.prototype.makeStyleDirty=function(){this._styleDirty=!0};af.prototype._getAverageLoadTime=function(){return this._runningLength===0?.05:this._runningAverage};const tGe=new ie;function cL(e){const t=e._clock,n=t.canAnimate&&t.shouldAnimate,i=t.multiplier;return n?i:0}function vp(e,t){return e._intervals.indexOf(t.start)}function nGe(e,t){const n=e._intervals,i=e._clock,o=cL(e);if(o===0)return;const r=e._getAverageLoadTime(),s=ie.addSeconds(i.currentTime,r*o,tGe);let a=n.indexOf(s);const l=vp(e,t);return a===l&&(o>=0?++a:--a),n.get(a)}function iGe(e){const t=e._intervals,i=e._clock.currentTime,o=t.indexOf(i);return t.get(o)}function oGe(e,t,n){const i=cL(e),o=vp(e,t),r=vp(e,n);return i>=0?o>=r:o<=r}function bq(e,t){return function(n){const i=c(n.message)?n.message:n.toString();e.frameFailed.numberOfListeners>0?e.frameFailed.raiseEvent({uri:t,message:i}):(console.log(`A frame failed to load: ${t}`),console.log(`Error: ${i}`))}}function rGe(e,t,n){const i=vp(e,t),o=e._frames;let r=o[i];if(!c(r)){const s=t.data.transform,a=c(s)?L.fromArray(s):void 0,l=t.data.uri;r={pointCloud:void 0,transform:a,timestamp:xo(),sequential:!0,ready:!1,touchedFrameNumber:n.frameNumber,uri:l},o[i]=r,Ae.fetchArrayBuffer({url:l}).then(function(u){r.pointCloud=new gb({arrayBuffer:u,cull:!0,fragmentShaderLoaded:Z8e,uniformMapLoaded:J8e(e),pickIdLoaded:eGe})}).catch(bq(e,l))}return r}function sGe(e,t){e._runningSum+=t,e._runningSum-=e._runningSamples[e._runningIndex],e._runningSamples[e._runningIndex]=t,e._runningLength=Math.min(e._runningLength+1,e._runningSamples.length),e._runningIndex=(e._runningIndex+1)%e._runningSamples.length,e._runningAverage=e._runningSum/e._runningLength}function aGe(e,t,n,i){t.touchedFrameNumber<i.frameNumber-1&&(t.sequential=!1);const o=t.pointCloud;if(c(o)&&!t.ready){const r=i.commandList,s=r.length;if(Tq(e,t,n,i),o.ready&&(t.ready=!0,e._totalMemoryUsageInBytes+=o.geometryByteLength,r.length=s,t.sequential)){const a=(xo()-t.timestamp)/1e3;sGe(e,a)}}t.touchedFrameNumber=i.frameNumber}const cGe=new L;function lGe(e,t){const n=e.shading;return c(n)&&c(n.baseResolution)?n.baseResolution:c(t.boundingSphere)?R.cbrt(t.boundingSphere.volume()/t.pointsLength):0}function uGe(e){const t=e.shading;return c(t)&&c(t.maximumAttenuation)?t.maximumAttenuation:10}const dGe=new q0;function Tq(e,t,n,i){const o=y(e.shading,dGe),r=t.pointCloud,s=y(t.transform,L.IDENTITY);r.modelMatrix=L.multiplyTransformation(e.modelMatrix,s,cGe),r.style=e.style,r.time=n.timeSinceLoad,r.shadows=e.shadows,r.clippingPlanes=e._clippingPlanes,r.isClipped=n.isClipped,r.attenuation=o.attenuation,r.backFaceCulling=o.backFaceCulling,r.normalShading=o.normalShading,r.geometricError=lGe(e,r),r.geometricErrorScale=o.geometricErrorScale,r.maximumAttenuation=uGe(e);try{r.update(i)}catch(a){bq(e,t.uri)(a)}t.touchedFrameNumber=i.frameNumber}function dP(e,t,n,i){const o=rGe(e,t,i);aGe(e,o,n,i)}function hGe(e){return function(t){return t.touchedFrameNumber<e.frameNumber}}function Aq(e,t){const n=e._frames,i=n.length;for(let o=0;o<i;++o){const r=n[o];if(c(r)&&(!c(t)||t(r))){const s=r.pointCloud;r.ready&&(e._totalMemoryUsageInBytes-=s.geometryByteLength),c(s)&&s.destroy(),r===e._lastRenderedFrame&&(e._lastRenderedFrame=void 0),n[o]=void 0}}}function fGe(e,t){const n=vp(e,t),i=e._frames[n];if(c(i)&&i.ready)return i}function Gz(e,t,n,i,o){return c(n)?n.ready?!0:(dP(e,t,i,o),n.ready):!1}function pGe(e,t,n,i,o){let r,s,a;const l=e._intervals,u=e._frames,h=vp(e,n),f=vp(e,t);if(h>=f){for(r=h;r>=f;--r)if(s=l.get(r),a=u[r],Gz(e,s,a,i,o))return s}else for(r=h;r<=f;++r)if(s=l.get(r),a=u[r],Gz(e,s,a,i,o))return s;return t}function mGe(e,t,n){const i=e._frames,o=i.length;for(let r=0;r<o;++r){const s=i[r];c(s)&&c(s.pointCloud)&&(s.pointCloud.clippingPlanesDirty=t,s.pointCloud.styleDirty=n)}}const Rm={timeSinceLoad:0,isClipped:!1,clippingPlanesDirty:!1};af.prototype.update=function(e){if(e.mode===oe.MORPHING||!this.show)return;c(this._pickId)||(this._pickId=e.context.createPickId({primitive:this})),c(this._loadTimestamp)||(this._loadTimestamp=ie.clone(e.time));const t=Math.max(ie.secondsDifference(e.time,this._loadTimestamp)*1e3,0),n=this._clippingPlanes;let i=0,o=!1;const r=c(n)&&n.enabled;r&&(n.update(e),i=n.clippingPlanesState),this._clippingPlanesState!==i&&(this._clippingPlanesState=i,o=!0);const s=this._styleDirty;this._styleDirty=!1,(o||s)&&mGe(this,o,s),Rm.timeSinceLoad=t,Rm.isClipped=r;const a=this.shading,l=this._pointCloudEyeDomeLighting,u=e.commandList,h=u.length;let f=this._previousInterval,_=this._nextInterval;const g=iGe(this);if(!c(g))return;let m=!1;const b=cL(this),T=b===0;b!==this._clockMultiplier&&(m=!0,this._clockMultiplier=b),(!c(f)||T)&&(f=g),(!c(_)||m||oGe(this,g,_))&&(_=nGe(this,g)),f=pGe(this,f,g,Rm,e);let x=fGe(this,f);c(x)||(dP(this,f,Rm,e),x=this._lastRenderedFrame),c(x)&&Tq(this,x,Rm,e),c(_)&&dP(this,_,Rm,e);const C=this;c(x)&&!c(this._lastRenderedFrame)&&e.afterRender.push(function(){return!0}),c(x)&&x!==this._lastRenderedFrame&&C.frameChanged.numberOfListeners>0&&e.afterRender.push(function(){return C.frameChanged.raiseEvent(C),!0}),this._previousInterval=f,this._nextInterval=_,this._lastRenderedFrame=x;const w=this._totalMemoryUsageInBytes,v=this.maximumMemoryUsage*1024*1024;w>v&&Aq(this,hGe(e));const N=u.length-h;c(a)&&a.attenuation&&a.eyeDomeLighting&&N>0&&l.update(e,h,a,this.boundingSphere)};af.prototype.isDestroyed=function(){return!1};af.prototype.destroy=function(){return Aq(this),this._clippingPlanes=this._clippingPlanes&&this._clippingPlanes.destroy(),this._pickId=this._pickId&&this._pickId.destroy(),ve(this)};async function _E(e,t){const n=t.terrainProvider,i=t.mapProjection,o=i.ellipsoid;let r;const s=t.camera.getRectangleCameraCoordinates(e);if(t.mode===oe.SCENE3D?r=o.cartesianToCartographic(s):r=i.unproject(s),!c(n))return r;const a=n.availability;if(!c(a)||t.mode===oe.SCENE2D)return r;const l=[ce.center(e),ce.southeast(e),ce.southwest(e),ce.northeast(e),ce.northwest(e)],u=await _E._sampleTerrainMostDetailed(n,l);let h=!1;const f=u.reduce(function(g,m){return c(m.height)?(h=!0,Math.max(m.height,g)):g},-Number.MAX_VALUE),_=r;return h&&(_.height+=f),_}_E._sampleTerrainMostDetailed=aL;var wy;typeof ko<"u"&&(wy=ko);(function(){/*!
|
|
* Knockout JavaScript library v3.5.1
|
|
* (c) The Knockout.js team - http://knockoutjs.com/
|
|
* License: MIT (http://www.opensource.org/licenses/mit-license.php)
|
|
*/(function(){(function(e){var t=this||(0,eval)("this"),n=t.document,i=t.navigator,o=t.jQuery,r=t.JSON;o||typeof jQuery>"u"||(o=jQuery),function(s){s(t.ko={})}(function(s,a){function l(S,D){return S===null||typeof S in b?S===D:!1}function u(S,D){var p;return function(){p||(p=m.a.setTimeout(function(){p=e,S()},D))}}function h(S,D){var p;return function(){clearTimeout(p),p=m.a.setTimeout(S,D)}}function f(S,D){D&&D!=="change"?D==="beforeChange"?this.pc(S):this.gb(S,D):this.qc(S)}function _(S,D){D!==null&&D.s&&D.s()}function g(S,D){var p=this.qd,I=p[v];I.ra||(this.Qb&&this.mb[D]?(p.uc(D,S,this.mb[D]),this.mb[D]=null,--this.Qb):I.I[D]||p.uc(D,S,I.J?{da:S}:p.$c(S)),S.Ja&&S.gd())}var m=typeof s<"u"?s:{};m.b=function(S,D){for(var p=S.split("."),I=m,O=0;O<p.length-1;O++)I=I[p[O]];I[p[p.length-1]]=D},m.L=function(S,D,p){S[D]=p},m.version="3.5.1",m.b("version",m.version),m.options={deferUpdates:!1,useOnlyNativeEvents:!1,foreachHidesDestroyed:!1},m.a=function(){function S(Y,ne){for(var Q in Y)O.call(Y,Q)&&ne(Q,Y[Q])}function D(Y,ne){if(ne)for(var Q in ne)O.call(ne,Q)&&(Y[Q]=ne[Q]);return Y}function p(Y,ne){return Y.__proto__=ne,Y}function I(Y,ne,Q,le){var pe=Y[ne].match(q)||[];m.a.D(Q.match(q),function(re){m.a.Na(pe,re,le)}),Y[ne]=pe.join(" ")}var O=Object.prototype.hasOwnProperty,F={__proto__:[]}instanceof Array,V=typeof Symbol=="function",G={},j={};G[i&&/Firefox\/2/i.test(i.userAgent)?"KeyboardEvent":"UIEvents"]=["keyup","keydown","keypress"],G.MouseEvents="click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave".split(" "),S(G,function(Y,ne){if(ne.length)for(var Q=0,le=ne.length;Q<le;Q++)j[ne[Q]]=Y});var W={propertychange:!0},X=n&&function(){for(var Y=3,ne=n.createElement("div"),Q=ne.getElementsByTagName("i");ne.innerHTML="<!--[if gt IE "+ ++Y+"]><i></i><![endif]-->",Q[0];);return 4<Y?Y:e}(),q=/\S+/g,ee;return{Jc:["authenticity_token",/^__RequestVerificationToken(_.*)?$/],D:function(Y,ne,Q){for(var le=0,pe=Y.length;le<pe;le++)ne.call(Q,Y[le],le,Y)},A:typeof Array.prototype.indexOf=="function"?function(Y,ne){return Array.prototype.indexOf.call(Y,ne)}:function(Y,ne){for(var Q=0,le=Y.length;Q<le;Q++)if(Y[Q]===ne)return Q;return-1},Lb:function(Y,ne,Q){for(var le=0,pe=Y.length;le<pe;le++)if(ne.call(Q,Y[le],le,Y))return Y[le];return e},Pa:function(Y,ne){var Q=m.a.A(Y,ne);0<Q?Y.splice(Q,1):Q===0&&Y.shift()},wc:function(Y){var ne=[];return Y&&m.a.D(Y,function(Q){0>m.a.A(ne,Q)&&ne.push(Q)}),ne},Mb:function(Y,ne,Q){var le=[];if(Y)for(var pe=0,re=Y.length;pe<re;pe++)le.push(ne.call(Q,Y[pe],pe));return le},jb:function(Y,ne,Q){var le=[];if(Y)for(var pe=0,re=Y.length;pe<re;pe++)ne.call(Q,Y[pe],pe)&&le.push(Y[pe]);return le},Nb:function(Y,ne){if(ne instanceof Array)Y.push.apply(Y,ne);else for(var Q=0,le=ne.length;Q<le;Q++)Y.push(ne[Q]);return Y},Na:function(Y,ne,Q){var le=m.a.A(m.a.bc(Y),ne);0>le?Q&&Y.push(ne):Q||Y.splice(le,1)},Ba:F,extend:D,setPrototypeOf:p,Ab:F?p:D,P:S,Ga:function(Y,ne,Q){if(!Y)return Y;var le={},pe;for(pe in Y)O.call(Y,pe)&&(le[pe]=ne.call(Q,Y[pe],pe,Y));return le},Tb:function(Y){for(;Y.firstChild;)m.removeNode(Y.firstChild)},Yb:function(Y){Y=m.a.la(Y);for(var ne=(Y[0]&&Y[0].ownerDocument||n).createElement("div"),Q=0,le=Y.length;Q<le;Q++)ne.appendChild(m.oa(Y[Q]));return ne},Ca:function(Y,ne){for(var Q=0,le=Y.length,pe=[];Q<le;Q++){var re=Y[Q].cloneNode(!0);pe.push(ne?m.oa(re):re)}return pe},va:function(Y,ne){if(m.a.Tb(Y),ne)for(var Q=0,le=ne.length;Q<le;Q++)Y.appendChild(ne[Q])},Xc:function(Y,ne){var Q=Y.nodeType?[Y]:Y;if(0<Q.length){for(var le=Q[0],pe=le.parentNode,re=0,de=ne.length;re<de;re++)pe.insertBefore(ne[re],le);for(re=0,de=Q.length;re<de;re++)m.removeNode(Q[re])}},Ua:function(Y,ne){if(Y.length){for(ne=ne.nodeType===8&&ne.parentNode||ne;Y.length&&Y[0].parentNode!==ne;)Y.splice(0,1);for(;1<Y.length&&Y[Y.length-1].parentNode!==ne;)Y.length--;if(1<Y.length){var Q=Y[0],le=Y[Y.length-1];for(Y.length=0;Q!==le;)Y.push(Q),Q=Q.nextSibling;Y.push(le)}}return Y},Zc:function(Y,ne){7>X?Y.setAttribute("selected",ne):Y.selected=ne},Db:function(Y){return Y===null||Y===e?"":Y.trim?Y.trim():Y.toString().replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")},Ud:function(Y,ne){return Y=Y||"",ne.length>Y.length?!1:Y.substring(0,ne.length)===ne},vd:function(Y,ne){if(Y===ne)return!0;if(Y.nodeType===11)return!1;if(ne.contains)return ne.contains(Y.nodeType!==1?Y.parentNode:Y);if(ne.compareDocumentPosition)return(ne.compareDocumentPosition(Y)&16)==16;for(;Y&&Y!=ne;)Y=Y.parentNode;return!!Y},Sb:function(Y){return m.a.vd(Y,Y.ownerDocument.documentElement)},kd:function(Y){return!!m.a.Lb(Y,m.a.Sb)},R:function(Y){return Y&&Y.tagName&&Y.tagName.toLowerCase()},Ac:function(Y){return m.onError?function(){try{return Y.apply(this,arguments)}catch(ne){throw m.onError&&m.onError(ne),ne}}:Y},setTimeout:function(Y,ne){return setTimeout(m.a.Ac(Y),ne)},Gc:function(Y){setTimeout(function(){throw m.onError&&m.onError(Y),Y},0)},B:function(Y,ne,Q){var le=m.a.Ac(Q);if(Q=W[ne],m.options.useOnlyNativeEvents||Q||!o)if(Q||typeof Y.addEventListener!="function")if(typeof Y.attachEvent<"u"){var pe=function(de){le.call(Y,de)},re="on"+ne;Y.attachEvent(re,pe),m.a.K.za(Y,function(){Y.detachEvent(re,pe)})}else throw Error("Browser doesn't support addEventListener or attachEvent");else Y.addEventListener(ne,le,!1);else ee||(ee=typeof o(Y).on=="function"?"on":"bind"),o(Y)[ee](ne,le)},Fb:function(Y,ne){if(!Y||!Y.nodeType)throw Error("element must be a DOM node when calling triggerEvent");var Q;if(m.a.R(Y)==="input"&&Y.type&&ne.toLowerCase()=="click"?(Q=Y.type,Q=Q=="checkbox"||Q=="radio"):Q=!1,m.options.useOnlyNativeEvents||!o||Q)if(typeof n.createEvent=="function")if(typeof Y.dispatchEvent=="function")Q=n.createEvent(j[ne]||"HTMLEvents"),Q.initEvent(ne,!0,!0,t,0,0,0,0,0,!1,!1,!1,!1,0,Y),Y.dispatchEvent(Q);else throw Error("The supplied element doesn't support dispatchEvent");else if(Q&&Y.click)Y.click();else if(typeof Y.fireEvent<"u")Y.fireEvent("on"+ne);else throw Error("Browser doesn't support triggering events");else o(Y).trigger(ne)},f:function(Y){return m.O(Y)?Y():Y},bc:function(Y){return m.O(Y)?Y.v():Y},Eb:function(Y,ne,Q){var le;ne&&(typeof Y.classList=="object"?(le=Y.classList[Q?"add":"remove"],m.a.D(ne.match(q),function(pe){le.call(Y.classList,pe)})):typeof Y.className.baseVal=="string"?I(Y.className,"baseVal",ne,Q):I(Y,"className",ne,Q))},Bb:function(Y,ne){var Q=m.a.f(ne);(Q===null||Q===e)&&(Q="");var le=m.h.firstChild(Y);!le||le.nodeType!=3||m.h.nextSibling(le)?m.h.va(Y,[Y.ownerDocument.createTextNode(Q)]):le.data=Q,m.a.Ad(Y)},Yc:function(Y,ne){if(Y.name=ne,7>=X)try{var Q=Y.name.replace(/[&<>'"]/g,function(le){return"&#"+le.charCodeAt(0)+";"});Y.mergeAttributes(n.createElement("<input name='"+Q+"'/>"),!1)}catch{}},Ad:function(Y){9<=X&&(Y=Y.nodeType==1?Y:Y.parentNode,Y.style&&(Y.style.zoom=Y.style.zoom))},wd:function(Y){if(X){var ne=Y.style.width;Y.style.width=0,Y.style.width=ne}},Pd:function(Y,ne){Y=m.a.f(Y),ne=m.a.f(ne);for(var Q=[],le=Y;le<=ne;le++)Q.push(le);return Q},la:function(Y){for(var ne=[],Q=0,le=Y.length;Q<le;Q++)ne.push(Y[Q]);return ne},Da:function(Y){return V?Symbol(Y):Y},Zd:X===6,$d:X===7,W:X,Lc:function(Y,ne){for(var Q=m.a.la(Y.getElementsByTagName("input")).concat(m.a.la(Y.getElementsByTagName("textarea"))),le=typeof ne=="string"?function(de){return de.name===ne}:function(de){return ne.test(de.name)},pe=[],re=Q.length-1;0<=re;re--)le(Q[re])&&pe.push(Q[re]);return pe},Nd:function(Y){return typeof Y=="string"&&(Y=m.a.Db(Y))?r&&r.parse?r.parse(Y):new Function("return "+Y)():null},hc:function(Y,ne,Q){if(!r||!r.stringify)throw Error("Cannot find JSON.stringify(). Some browsers (e.g., IE < 8) don't support it natively, but you can overcome this by adding a script reference to json2.js, downloadable from http://www.json.org/json2.js");return r.stringify(m.a.f(Y),ne,Q)},Od:function(Y,ne,Q){Q=Q||{};var le=Q.params||{},pe=Q.includeFields||this.Jc,re=Y;if(typeof Y=="object"&&m.a.R(Y)==="form")for(var re=Y.action,de=pe.length-1;0<=de;de--)for(var fe=m.a.Lc(Y,pe[de]),ye=fe.length-1;0<=ye;ye--)le[fe[ye].name]=fe[ye].value;ne=m.a.f(ne);var Ce=n.createElement("form");Ce.style.display="none",Ce.action=re,Ce.method="post";for(var we in ne)Y=n.createElement("input"),Y.type="hidden",Y.name=we,Y.value=m.a.hc(m.a.f(ne[we])),Ce.appendChild(Y);S(le,function(Pe,lt){var ft=n.createElement("input");ft.type="hidden",ft.name=Pe,ft.value=lt,Ce.appendChild(ft)}),n.body.appendChild(Ce),Q.submitter?Q.submitter(Ce):Ce.submit(),setTimeout(function(){Ce.parentNode.removeChild(Ce)},0)}}}(),m.b("utils",m.a),m.b("utils.arrayForEach",m.a.D),m.b("utils.arrayFirst",m.a.Lb),m.b("utils.arrayFilter",m.a.jb),m.b("utils.arrayGetDistinctValues",m.a.wc),m.b("utils.arrayIndexOf",m.a.A),m.b("utils.arrayMap",m.a.Mb),m.b("utils.arrayPushAll",m.a.Nb),m.b("utils.arrayRemoveItem",m.a.Pa),m.b("utils.cloneNodes",m.a.Ca),m.b("utils.createSymbolOrString",m.a.Da),m.b("utils.extend",m.a.extend),m.b("utils.fieldsIncludedWithJsonPost",m.a.Jc),m.b("utils.getFormFields",m.a.Lc),m.b("utils.objectMap",m.a.Ga),m.b("utils.peekObservable",m.a.bc),m.b("utils.postJson",m.a.Od),m.b("utils.parseJson",m.a.Nd),m.b("utils.registerEventHandler",m.a.B),m.b("utils.stringifyJson",m.a.hc),m.b("utils.range",m.a.Pd),m.b("utils.toggleDomNodeCssClass",m.a.Eb),m.b("utils.triggerEvent",m.a.Fb),m.b("utils.unwrapObservable",m.a.f),m.b("utils.objectForEach",m.a.P),m.b("utils.addOrRemoveItem",m.a.Na),m.b("utils.setTextContent",m.a.Bb),m.b("unwrap",m.a.f),Function.prototype.bind||(Function.prototype.bind=function(S){var D=this;if(arguments.length===1)return function(){return D.apply(S,arguments)};var p=Array.prototype.slice.call(arguments,1);return function(){var I=p.slice(0);return I.push.apply(I,arguments),D.apply(S,I)}}),m.a.g=new function(){var S=0,D="__ko__"+new Date().getTime(),p={},I,O;return m.a.W?(I=function(F,V){var G=F[D];if(!G||G==="null"||!p[G]){if(!V)return e;G=F[D]="ko"+S++,p[G]={}}return p[G]},O=function(F){var V=F[D];return V?(delete p[V],F[D]=null,!0):!1}):(I=function(F,V){var G=F[D];return!G&&V&&(G=F[D]={}),G},O=function(F){return F[D]?(delete F[D],!0):!1}),{get:function(F,V){var G=I(F,!1);return G&&G[V]},set:function(F,V,G){(F=I(F,G!==e))&&(F[V]=G)},Ub:function(F,V,G){return F=I(F,!0),F[V]||(F[V]=G)},clear:O,Z:function(){return S+++D}}},m.b("utils.domData",m.a.g),m.b("utils.domData.clear",m.a.g.clear),m.a.K=new function(){function S(V,G){var j=m.a.g.get(V,I);return j===e&&G&&(j=[],m.a.g.set(V,I,j)),j}function D(V){var G=S(V,!1);if(G)for(var G=G.slice(0),j=0;j<G.length;j++)G[j](V);m.a.g.clear(V),m.a.K.cleanExternalData(V),F[V.nodeType]&&p(V.childNodes,!0)}function p(V,G){for(var j=[],W,X=0;X<V.length;X++)if((!G||V[X].nodeType===8)&&(D(j[j.length]=W=V[X]),V[X]!==W))for(;X--&&m.a.A(j,V[X])==-1;);}var I=m.a.g.Z(),O={1:!0,8:!0,9:!0},F={1:!0,9:!0};return{za:function(V,G){if(typeof G!="function")throw Error("Callback must be a function");S(V,!0).push(G)},yb:function(V,G){var j=S(V,!1);j&&(m.a.Pa(j,G),j.length==0&&m.a.g.set(V,I,e))},oa:function(V){return m.u.G(function(){O[V.nodeType]&&(D(V),F[V.nodeType]&&p(V.getElementsByTagName("*")))}),V},removeNode:function(V){m.oa(V),V.parentNode&&V.parentNode.removeChild(V)},cleanExternalData:function(V){o&&typeof o.cleanData=="function"&&o.cleanData([V])}}},m.oa=m.a.K.oa,m.removeNode=m.a.K.removeNode,m.b("cleanNode",m.oa),m.b("removeNode",m.removeNode),m.b("utils.domNodeDisposal",m.a.K),m.b("utils.domNodeDisposal.addDisposeCallback",m.a.K.za),m.b("utils.domNodeDisposal.removeDisposeCallback",m.a.K.yb),function(){var S=[0,"",""],D=[1,"<table>","</table>"],p=[3,"<table><tbody><tr>","</tr></tbody></table>"],I=[1,"<select multiple='multiple'>","</select>"],O={thead:D,tbody:D,tfoot:D,tr:[2,"<table><tbody>","</tbody></table>"],td:p,th:p,option:I,optgroup:I},F=8>=m.a.W;m.a.ua=function(V,G){var j;if(o){if(o.parseHTML)j=o.parseHTML(V,G)||[];else if((j=o.clean([V],G))&&j[0]){for(var W=j[0];W.parentNode&&W.parentNode.nodeType!==11;)W=W.parentNode;W.parentNode&&W.parentNode.removeChild(W)}}else{(j=G)||(j=n);var W=j.parentWindow||j.defaultView||t,X=m.a.Db(V).toLowerCase(),q=j.createElement("div"),ee;for(ee=(X=X.match(/^(?:\x3c!--.*?--\x3e\s*?)*?<([a-z]+)[\s>]/))&&O[X[1]]||S,X=ee[0],ee="ignored<div>"+ee[1]+V+ee[2]+"</div>",typeof W.innerShiv=="function"?q.appendChild(W.innerShiv(ee)):(F&&j.body.appendChild(q),q.innerHTML=ee,F&&q.parentNode.removeChild(q));X--;)q=q.lastChild;j=m.a.la(q.lastChild.childNodes)}return j},m.a.Md=function(V,G){var j=m.a.ua(V,G);return j.length&&j[0].parentElement||m.a.Yb(j)},m.a.fc=function(V,G){if(m.a.Tb(V),G=m.a.f(G),G!==null&&G!==e)if(typeof G!="string"&&(G=G.toString()),o)o(V).html(G);else for(var j=m.a.ua(G,V.ownerDocument),W=0;W<j.length;W++)V.appendChild(j[W])}}(),m.b("utils.parseHtmlFragment",m.a.ua),m.b("utils.setHtml",m.a.fc),m.aa=function(){function S(p,I){if(p){if(p.nodeType==8){var O=m.aa.Uc(p.nodeValue);O!=null&&I.push({ud:p,Kd:O})}else if(p.nodeType==1)for(var O=0,F=p.childNodes,V=F.length;O<V;O++)S(F[O],I)}}var D={};return{Xb:function(p){if(typeof p!="function")throw Error("You can only pass a function to ko.memoization.memoize()");var I=(4294967296*(1+Math.random())|0).toString(16).substring(1)+(4294967296*(1+Math.random())|0).toString(16).substring(1);return D[I]=p,"<!--[ko_memo:"+I+"]-->"},bd:function(p,I){var O=D[p];if(O===e)throw Error("Couldn't find any memo with ID "+p+". Perhaps it's already been unmemoized.");try{return O.apply(null,I||[]),!0}finally{delete D[p]}},cd:function(p,I){var O=[];S(p,O);for(var F=0,V=O.length;F<V;F++){var G=O[F].ud,j=[G];I&&m.a.Nb(j,I),m.aa.bd(O[F].Kd,j),G.nodeValue="",G.parentNode&&G.parentNode.removeChild(G)}},Uc:function(p){return(p=p.match(/^\[ko_memo\:(.*?)\]$/))?p[1]:null}}}(),m.b("memoization",m.aa),m.b("memoization.memoize",m.aa.Xb),m.b("memoization.unmemoize",m.aa.bd),m.b("memoization.parseMemoText",m.aa.Uc),m.b("memoization.unmemoizeDomNodeAndDescendants",m.aa.cd),m.na=function(){function S(){if(O){for(var G=O,j=0,W;V<O;)if(W=I[V++]){if(V>G){if(5e3<=++j){V=O,m.a.Gc(Error("'Too much recursion' after processing "+j+" task groups."));break}G=O}try{W()}catch(X){m.a.Gc(X)}}}}function D(){S(),V=O=I.length=0}var p,I=[],O=0,F=1,V=0;return t.MutationObserver?p=function(G){var j=n.createElement("div");return new MutationObserver(G).observe(j,{attributes:!0}),function(){j.classList.toggle("foo")}}(D):p=n&&"onreadystatechange"in n.createElement("script")?function(G){var j=n.createElement("script");j.onreadystatechange=function(){j.onreadystatechange=null,n.documentElement.removeChild(j),j=null,G()},n.documentElement.appendChild(j)}:function(G){setTimeout(G,0)},{scheduler:p,zb:function(G){return O||m.na.scheduler(D),I[O++]=G,F++},cancel:function(G){G=G-(F-O),G>=V&&G<O&&(I[G]=null)},resetForTesting:function(){var G=O-V;return V=O=I.length=0,G},Sd:S}}(),m.b("tasks",m.na),m.b("tasks.schedule",m.na.zb),m.b("tasks.runEarly",m.na.Sd),m.Ta={throttle:function(S,D){S.throttleEvaluation=D;var p=null;return m.$({read:S,write:function(I){clearTimeout(p),p=m.a.setTimeout(function(){S(I)},D)}})},rateLimit:function(S,D){var p,I,O;typeof D=="number"?p=D:(p=D.timeout,I=D.method),S.Hb=!1,O=typeof I=="function"?I:I=="notifyWhenChangesStop"?h:u,S.ub(function(F){return O(F,p,D)})},deferred:function(S,D){if(D!==!0)throw Error("The 'deferred' extender only accepts the value 'true', because it is not supported to turn deferral off once enabled.");S.Hb||(S.Hb=!0,S.ub(function(p){var I,O=!1;return function(){if(!O){m.na.cancel(I),I=m.na.zb(p);try{O=!0,S.notifySubscribers(e,"dirty")}finally{O=!1}}}}))},notify:function(S,D){S.equalityComparer=D=="always"?null:l}};var b={undefined:1,boolean:1,number:1,string:1};m.b("extenders",m.Ta),m.ic=function(S,D,p){this.da=S,this.lc=D,this.mc=p,this.Ib=!1,this.fb=this.Jb=null,m.L(this,"dispose",this.s),m.L(this,"disposeWhenNodeIsRemoved",this.l)},m.ic.prototype.s=function(){this.Ib||(this.fb&&m.a.K.yb(this.Jb,this.fb),this.Ib=!0,this.mc(),this.da=this.lc=this.mc=this.Jb=this.fb=null)},m.ic.prototype.l=function(S){this.Jb=S,m.a.K.za(S,this.fb=this.s.bind(this))},m.T=function(){m.a.Ab(this,T),T.qb(this)};var T={qb:function(S){S.U={change:[]},S.sc=1},subscribe:function(S,D,p){var I=this;p=p||"change";var O=new m.ic(I,D?S.bind(D):S,function(){m.a.Pa(I.U[p],O),I.hb&&I.hb(p)});return I.Qa&&I.Qa(p),I.U[p]||(I.U[p]=[]),I.U[p].push(O),O},notifySubscribers:function(S,D){if(D=D||"change",D==="change"&&this.Gb(),this.Wa(D)){var p=D==="change"&&this.ed||this.U[D].slice(0);try{m.u.xc();for(var I=0,O;O=p[I];++I)O.Ib||O.lc(S)}finally{m.u.end()}}},ob:function(){return this.sc},Dd:function(S){return this.ob()!==S},Gb:function(){++this.sc},ub:function(S){var D=this,p=m.O(D),I,O,F,V,G;D.gb||(D.gb=D.notifySubscribers,D.notifySubscribers=f);var j=S(function(){D.Ja=!1,p&&V===D&&(V=D.nc?D.nc():D());var W=O||G&&D.sb(F,V);G=O=I=!1,W&&D.gb(F=V)});D.qc=function(W,X){X&&D.Ja||(G=!X),D.ed=D.U.change.slice(0),D.Ja=I=!0,V=W,j()},D.pc=function(W){I||(F=W,D.gb(W,"beforeChange"))},D.rc=function(){G=!0},D.gd=function(){D.sb(F,D.v(!0))&&(O=!0)}},Wa:function(S){return this.U[S]&&this.U[S].length},Bd:function(S){if(S)return this.U[S]&&this.U[S].length||0;var D=0;return m.a.P(this.U,function(p,I){p!=="dirty"&&(D+=I.length)}),D},sb:function(S,D){return!this.equalityComparer||!this.equalityComparer(S,D)},toString:function(){return"[object Object]"},extend:function(S){var D=this;return S&&m.a.P(S,function(p,I){var O=m.Ta[p];typeof O=="function"&&(D=O(D,I)||D)}),D}};m.L(T,"init",T.qb),m.L(T,"subscribe",T.subscribe),m.L(T,"extend",T.extend),m.L(T,"getSubscriptionsCount",T.Bd),m.a.Ba&&m.a.setPrototypeOf(T,Function.prototype),m.T.fn=T,m.Qc=function(S){return S!=null&&typeof S.subscribe=="function"&&typeof S.notifySubscribers=="function"},m.b("subscribable",m.T),m.b("isSubscribable",m.Qc),m.S=m.u=function(){function S(F){p.push(I),I=F}function D(){I=p.pop()}var p=[],I,O=0;return{xc:S,end:D,cc:function(F){if(I){if(!m.Qc(F))throw Error("Only subscribable things can act as dependencies");I.od.call(I.pd,F,F.fd||(F.fd=++O))}},G:function(F,V,G){try{return S(),F.apply(V,G||[])}finally{D()}},qa:function(){if(I)return I.o.qa()},Va:function(){if(I)return I.o.Va()},Ya:function(){if(I)return I.Ya},o:function(){if(I)return I.o}}}(),m.b("computedContext",m.S),m.b("computedContext.getDependenciesCount",m.S.qa),m.b("computedContext.getDependencies",m.S.Va),m.b("computedContext.isInitial",m.S.Ya),m.b("computedContext.registerDependency",m.S.cc),m.b("ignoreDependencies",m.Yd=m.u.G);var x=m.a.Da("_latestValue");m.ta=function(S){function D(){return 0<arguments.length?(D.sb(D[x],arguments[0])&&(D.ya(),D[x]=arguments[0],D.xa()),this):(m.u.cc(D),D[x])}return D[x]=S,m.a.Ba||m.a.extend(D,m.T.fn),m.T.fn.qb(D),m.a.Ab(D,C),m.options.deferUpdates&&m.Ta.deferred(D,!0),D};var C={equalityComparer:l,v:function(){return this[x]},xa:function(){this.notifySubscribers(this[x],"spectate"),this.notifySubscribers(this[x])},ya:function(){this.notifySubscribers(this[x],"beforeChange")}};m.a.Ba&&m.a.setPrototypeOf(C,m.T.fn);var w=m.ta.Ma="__ko_proto__";C[w]=m.ta,m.O=function(S){if((S=typeof S=="function"&&S[w])&&S!==C[w]&&S!==m.o.fn[w])throw Error("Invalid object that looks like an observable; possibly from another Knockout instance");return!!S},m.Za=function(S){return typeof S=="function"&&(S[w]===C[w]||S[w]===m.o.fn[w]&&S.Nc)},m.b("observable",m.ta),m.b("isObservable",m.O),m.b("isWriteableObservable",m.Za),m.b("isWritableObservable",m.Za),m.b("observable.fn",C),m.L(C,"peek",C.v),m.L(C,"valueHasMutated",C.xa),m.L(C,"valueWillMutate",C.ya),m.Ha=function(S){if(S=S||[],typeof S!="object"||!("length"in S))throw Error("The argument passed when initializing an observable array must be an array, or null, or undefined.");return S=m.ta(S),m.a.Ab(S,m.Ha.fn),S.extend({trackArrayChanges:!0})},m.Ha.fn={remove:function(S){for(var D=this.v(),p=[],I=typeof S!="function"||m.O(S)?function(V){return V===S}:S,O=0;O<D.length;O++){var F=D[O];if(I(F)){if(p.length===0&&this.ya(),D[O]!==F)throw Error("Array modified during remove; cannot remove item");p.push(F),D.splice(O,1),O--}}return p.length&&this.xa(),p},removeAll:function(S){if(S===e){var D=this.v(),p=D.slice(0);return this.ya(),D.splice(0,D.length),this.xa(),p}return S?this.remove(function(I){return 0<=m.a.A(S,I)}):[]},destroy:function(S){var D=this.v(),p=typeof S!="function"||m.O(S)?function(F){return F===S}:S;this.ya();for(var I=D.length-1;0<=I;I--){var O=D[I];p(O)&&(O._destroy=!0)}this.xa()},destroyAll:function(S){return S===e?this.destroy(function(){return!0}):S?this.destroy(function(D){return 0<=m.a.A(S,D)}):[]},indexOf:function(S){var D=this();return m.a.A(D,S)},replace:function(S,D){var p=this.indexOf(S);0<=p&&(this.ya(),this.v()[p]=D,this.xa())},sorted:function(S){var D=this().slice(0);return S?D.sort(S):D.sort()},reversed:function(){return this().slice(0).reverse()}},m.a.Ba&&m.a.setPrototypeOf(m.Ha.fn,m.ta.fn),m.a.D("pop push reverse shift sort splice unshift".split(" "),function(S){m.Ha.fn[S]=function(){var D=this.v();this.ya(),this.zc(D,S,arguments);var p=D[S].apply(D,arguments);return this.xa(),p===D?this:p}}),m.a.D(["slice"],function(S){m.Ha.fn[S]=function(){var D=this();return D[S].apply(D,arguments)}}),m.Pc=function(S){return m.O(S)&&typeof S.remove=="function"&&typeof S.push=="function"},m.b("observableArray",m.Ha),m.b("isObservableArray",m.Pc),m.Ta.trackArrayChanges=function(S,D){function p(){function q(){if(G){var ee=[].concat(S.v()||[]),Y;S.Wa("arrayChange")&&((!O||1<G)&&(O=m.a.Pb(j,ee,S.Ob)),Y=O),j=ee,O=null,G=0,Y&&Y.length&&S.notifySubscribers(Y,"arrayChange")}}I?q():(I=!0,V=S.subscribe(function(){++G},null,"spectate"),j=[].concat(S.v()||[]),O=null,F=S.subscribe(q))}if(S.Ob={},D&&typeof D=="object"&&m.a.extend(S.Ob,D),S.Ob.sparse=!0,!S.zc){var I=!1,O=null,F,V,G=0,j,W=S.Qa,X=S.hb;S.Qa=function(q){W&&W.call(S,q),q==="arrayChange"&&p()},S.hb=function(q){X&&X.call(S,q),q!=="arrayChange"||S.Wa("arrayChange")||(F&&F.s(),V&&V.s(),V=F=null,I=!1,j=e)},S.zc=function(q,ee,Y){function ne(Ce,we,Pe){return Q[Q.length]={status:Ce,value:we,index:Pe}}if(I&&!G){var Q=[],le=q.length,pe=Y.length,re=0;switch(ee){case"push":re=le;case"unshift":for(ee=0;ee<pe;ee++)ne("added",Y[ee],re+ee);break;case"pop":re=le-1;case"shift":le&&ne("deleted",q[re],re);break;case"splice":ee=Math.min(Math.max(0,0>Y[0]?le+Y[0]:Y[0]),le);for(var le=pe===1?le:Math.min(ee+(Y[1]||0),le),pe=ee+pe-2,re=Math.max(le,pe),de=[],fe=[],ye=2;ee<re;++ee,++ye)ee<le&&fe.push(ne("deleted",q[ee],ee)),ee<pe&&de.push(ne("added",Y[ye],ee));m.a.Kc(fe,de);break;default:return}O=Q}}}};var v=m.a.Da("_state");m.o=m.$=function(S,D,p){function I(){if(0<arguments.length){if(typeof O=="function")O.apply(F.nb,arguments);else throw Error("Cannot write a value to a ko.computed unless you specify a 'write' option. If you wish to read the current value, don't pass any parameters.");return this}return F.ra||m.u.cc(I),(F.ka||F.J&&I.Xa())&&I.ha(),F.X}if(typeof S=="object"?p=S:(p=p||{},S&&(p.read=S)),typeof p.read!="function")throw Error("Pass a function that returns the value of the ko.computed");var O=p.write,F={X:e,sa:!0,ka:!0,rb:!1,jc:!1,ra:!1,wb:!1,J:!1,Wc:p.read,nb:D||p.owner,l:p.disposeWhenNodeIsRemoved||p.l||null,Sa:p.disposeWhen||p.Sa,Rb:null,I:{},V:0,Ic:null};return I[v]=F,I.Nc=typeof O=="function",m.a.Ba||m.a.extend(I,m.T.fn),m.T.fn.qb(I),m.a.Ab(I,P),p.pure?(F.wb=!0,F.J=!0,m.a.extend(I,N)):p.deferEvaluation&&m.a.extend(I,k),m.options.deferUpdates&&m.Ta.deferred(I,!0),F.l&&(F.jc=!0,F.l.nodeType||(F.l=null)),F.J||p.deferEvaluation||I.ha(),F.l&&I.ja()&&m.a.K.za(F.l,F.Rb=function(){I.s()}),I};var P={equalityComparer:l,qa:function(){return this[v].V},Va:function(){var S=[];return m.a.P(this[v].I,function(D,p){S[p.Ka]=p.da}),S},Vb:function(S){if(!this[v].V)return!1;var D=this.Va();return m.a.A(D,S)!==-1?!0:!!m.a.Lb(D,function(p){return p.Vb&&p.Vb(S)})},uc:function(S,D,p){if(this[v].wb&&D===this)throw Error("A 'pure' computed must not be called recursively");this[v].I[S]=p,p.Ka=this[v].V++,p.La=D.ob()},Xa:function(){var S,D,p=this[v].I;for(S in p)if(Object.prototype.hasOwnProperty.call(p,S)&&(D=p[S],this.Ia&&D.da.Ja||D.da.Dd(D.La)))return!0},Jd:function(){this.Ia&&!this[v].rb&&this.Ia(!1)},ja:function(){var S=this[v];return S.ka||0<S.V},Rd:function(){this.Ja?this[v].ka&&(this[v].sa=!0):this.Hc()},$c:function(S){if(S.Hb){var D=S.subscribe(this.Jd,this,"dirty"),p=S.subscribe(this.Rd,this);return{da:S,s:function(){D.s(),p.s()}}}return S.subscribe(this.Hc,this)},Hc:function(){var S=this,D=S.throttleEvaluation;D&&0<=D?(clearTimeout(this[v].Ic),this[v].Ic=m.a.setTimeout(function(){S.ha(!0)},D)):S.Ia?S.Ia(!0):S.ha(!0)},ha:function(S){var D=this[v],p=D.Sa,I=!1;if(!D.rb&&!D.ra){if(D.l&&!m.a.Sb(D.l)||p&&p()){if(!D.jc){this.s();return}}else D.jc=!1;D.rb=!0;try{I=this.zd(S)}finally{D.rb=!1}return I}},zd:function(S){var D=this[v],I=!1,p=D.wb?e:!D.V,I={qd:this,mb:D.I,Qb:D.V};m.u.xc({pd:I,od:g,o:this,Ya:p}),D.I={},D.V=0;var O=this.yd(D,I);return D.V?I=this.sb(D.X,O):(this.s(),I=!0),I&&(D.J?this.Gb():this.notifySubscribers(D.X,"beforeChange"),D.X=O,this.notifySubscribers(D.X,"spectate"),!D.J&&S&&this.notifySubscribers(D.X),this.rc&&this.rc()),p&&this.notifySubscribers(D.X,"awake"),I},yd:function(S,D){try{var p=S.Wc;return S.nb?p.call(S.nb):p()}finally{m.u.end(),D.Qb&&!S.J&&m.a.P(D.mb,_),S.sa=S.ka=!1}},v:function(S){var D=this[v];return(D.ka&&(S||!D.V)||D.J&&this.Xa())&&this.ha(),D.X},ub:function(S){m.T.fn.ub.call(this,S),this.nc=function(){return this[v].J||(this[v].sa?this.ha():this[v].ka=!1),this[v].X},this.Ia=function(D){this.pc(this[v].X),this[v].ka=!0,D&&(this[v].sa=!0),this.qc(this,!D)}},s:function(){var S=this[v];!S.J&&S.I&&m.a.P(S.I,function(D,p){p.s&&p.s()}),S.l&&S.Rb&&m.a.K.yb(S.l,S.Rb),S.I=e,S.V=0,S.ra=!0,S.sa=!1,S.ka=!1,S.J=!1,S.l=e,S.Sa=e,S.Wc=e,this.Nc||(S.nb=e)}},N={Qa:function(S){var D=this,p=D[v];if(!p.ra&&p.J&&S=="change"){if(p.J=!1,p.sa||D.Xa())p.I=null,p.V=0,D.ha()&&D.Gb();else{var I=[];m.a.P(p.I,function(O,F){I[F.Ka]=O}),m.a.D(I,function(O,F){var V=p.I[O],G=D.$c(V.da);G.Ka=F,G.La=V.La,p.I[O]=G}),D.Xa()&&D.ha()&&D.Gb()}p.ra||D.notifySubscribers(p.X,"awake")}},hb:function(S){var D=this[v];D.ra||S!="change"||this.Wa("change")||(m.a.P(D.I,function(p,I){I.s&&(D.I[p]={da:I.da,Ka:I.Ka,La:I.La},I.s())}),D.J=!0,this.notifySubscribers(e,"asleep"))},ob:function(){var S=this[v];return S.J&&(S.sa||this.Xa())&&this.ha(),m.T.fn.ob.call(this)}},k={Qa:function(S){S!="change"&&S!="beforeChange"||this.v()}};m.a.Ba&&m.a.setPrototypeOf(P,m.T.fn);var M=m.ta.Ma;P[M]=m.o,m.Oc=function(S){return typeof S=="function"&&S[M]===P[M]},m.Fd=function(S){return m.Oc(S)&&S[v]&&S[v].wb},m.b("computed",m.o),m.b("dependentObservable",m.o),m.b("isComputed",m.Oc),m.b("isPureComputed",m.Fd),m.b("computed.fn",P),m.L(P,"peek",P.v),m.L(P,"dispose",P.s),m.L(P,"isActive",P.ja),m.L(P,"getDependenciesCount",P.qa),m.L(P,"getDependencies",P.Va),m.xb=function(S,D){return typeof S=="function"?m.o(S,D,{pure:!0}):(S=m.a.extend({},S),S.pure=!0,m.o(S,D))},m.b("pureComputed",m.xb),function(){function S(I,O,F){if(F=F||new p,I=O(I),typeof I!="object"||I===null||I===e||I instanceof RegExp||I instanceof Date||I instanceof String||I instanceof Number||I instanceof Boolean)return I;var V=I instanceof Array?[]:{};return F.save(I,V),D(I,function(G){var j=O(I[G]);switch(typeof j){case"boolean":case"number":case"string":case"function":V[G]=j;break;case"object":case"undefined":var W=F.get(j);V[G]=W!==e?W:S(j,O,F)}}),V}function D(I,O){if(I instanceof Array){for(var F=0;F<I.length;F++)O(F);typeof I.toJSON=="function"&&O("toJSON")}else for(F in I)O(F)}function p(){this.keys=[],this.values=[]}m.ad=function(I){if(arguments.length==0)throw Error("When calling ko.toJS, pass the object you want to convert.");return S(I,function(O){for(var F=0;m.O(O)&&10>F;F++)O=O();return O})},m.toJSON=function(I,O,F){return I=m.ad(I),m.a.hc(I,O,F)},p.prototype={constructor:p,save:function(I,O){var F=m.a.A(this.keys,I);0<=F?this.values[F]=O:(this.keys.push(I),this.values.push(O))},get:function(I){return I=m.a.A(this.keys,I),0<=I?this.values[I]:e}}}(),m.b("toJS",m.ad),m.b("toJSON",m.toJSON),m.Wd=function(S,D,p){function I(O){var F=m.xb(S,p).extend({ma:"always"}),V=F.subscribe(function(G){G&&(V.s(),O(G))});return F.notifySubscribers(F.v()),V}return typeof Promise!="function"||D?I(D.bind(p)):new Promise(I)},m.b("when",m.Wd),function(){m.w={M:function(S){switch(m.a.R(S)){case"option":return S.__ko__hasDomDataOptionValue__===!0?m.a.g.get(S,m.c.options.$b):7>=m.a.W?S.getAttributeNode("value")&&S.getAttributeNode("value").specified?S.value:S.text:S.value;case"select":return 0<=S.selectedIndex?m.w.M(S.options[S.selectedIndex]):e;default:return S.value}},cb:function(S,D,p){switch(m.a.R(S)){case"option":typeof D=="string"?(m.a.g.set(S,m.c.options.$b,e),"__ko__hasDomDataOptionValue__"in S&&delete S.__ko__hasDomDataOptionValue__,S.value=D):(m.a.g.set(S,m.c.options.$b,D),S.__ko__hasDomDataOptionValue__=!0,S.value=typeof D=="number"?D:"");break;case"select":(D===""||D===null)&&(D=e);for(var I=-1,O=0,F=S.options.length,V;O<F;++O)if(V=m.w.M(S.options[O]),V==D||V===""&&D===e){I=O;break}(p||0<=I||D===e&&1<S.size)&&(S.selectedIndex=I,m.a.W===6&&m.a.setTimeout(function(){S.selectedIndex=I},0));break;default:(D===null||D===e)&&(D=""),S.value=D}}}}(),m.b("selectExtensions",m.w),m.b("selectExtensions.readValue",m.w.M),m.b("selectExtensions.writeValue",m.w.cb),m.m=function(){function S(G){G=m.a.Db(G),G.charCodeAt(0)===123&&(G=G.slice(1,-1)),G+=`
|
|
,`;var j=[],W=G.match(I),X,q=[],ee=0;if(1<W.length){for(var Y=0,ne;ne=W[Y];++Y){var Q=ne.charCodeAt(0);if(Q===44){if(0>=ee){j.push(X&&q.length?{key:X,value:q.join("")}:{unknown:X||q.join("")}),X=ee=0,q=[];continue}}else if(Q===58){if(!ee&&!X&&q.length===1){X=q.pop();continue}}else{if(Q===47&&1<ne.length&&(ne.charCodeAt(1)===47||ne.charCodeAt(1)===42))continue;Q===47&&Y&&1<ne.length?(Q=W[Y-1].match(O))&&!F[Q[0]]&&(G=G.substr(G.indexOf(ne)+1),W=G.match(I),Y=-1,ne="/"):Q===40||Q===123||Q===91?++ee:Q===41||Q===125||Q===93?--ee:X||q.length||Q!==34&&Q!==39||(ne=ne.slice(1,-1))}q.push(ne)}if(0<ee)throw Error("Unbalanced parentheses, braces, or brackets")}return j}var D=["true","false","null","undefined"],p=/^(?:[$_a-z][$\w]*|(.+)(\.\s*[$_a-z][$\w]*|\[.+\]))$/i,I=RegExp(`"(?:\\\\.|[^"])*"|'(?:\\\\.|[^'])*'|\`(?:\\\\.|[^\`])*\`|/\\*(?:[^*]|\\*+[^*/])*\\*+/|//.*
|
|
|/(?:\\\\.|[^/])+/w*|[^\\s:,/][^,"'\`{}()/:[\\]]*[^\\s,"'\`{}()/:[\\]]|[^\\s]`,"g"),O=/[\])"'A-Za-z0-9_$]+$/,F={in:1,return:1,typeof:1},V={};return{Ra:[],wa:V,ac:S,vb:function(G,j){function W(Q,le){var pe;if(!Y){var re=m.getBindingHandler(Q);if(re&&re.preprocess&&!(le=re.preprocess(le,Q,W)))return;(re=V[Q])&&(pe=le,0<=m.a.A(D,pe)?pe=!1:(re=pe.match(p),pe=re===null?!1:re[1]?"Object("+re[1]+")"+re[2]:pe),re=pe),re&&q.push("'"+(typeof V[Q]=="string"?V[Q]:Q)+"':function(_z){"+pe+"=_z}")}ee&&(le="function(){return "+le+" }"),X.push("'"+Q+"':"+le)}j=j||{};var X=[],q=[],ee=j.valueAccessors,Y=j.bindingParams,ne=typeof G=="string"?S(G):G;return m.a.D(ne,function(Q){W(Q.key||Q.unknown,Q.value)}),q.length&&W("_ko_property_writers","{"+q.join(",")+" }"),X.join(",")},Id:function(G,j){for(var W=0;W<G.length;W++)if(G[W].key==j)return!0;return!1},eb:function(G,j,W,X,q){G&&m.O(G)?!m.Za(G)||q&&G.v()===X||G(X):(G=j.get("_ko_property_writers"))&&G[W]&&G[W](X)}}}(),m.b("expressionRewriting",m.m),m.b("expressionRewriting.bindingRewriteValidators",m.m.Ra),m.b("expressionRewriting.parseObjectLiteral",m.m.ac),m.b("expressionRewriting.preProcessBindings",m.m.vb),m.b("expressionRewriting._twoWayBindings",m.m.wa),m.b("jsonExpressionRewriting",m.m),m.b("jsonExpressionRewriting.insertPropertyAccessorsIntoJson",m.m.vb),function(){function S(W){return W.nodeType==8&&F.test(O?W.text:W.nodeValue)}function D(W){return W.nodeType==8&&V.test(O?W.text:W.nodeValue)}function p(W,X){for(var q=W,ee=1,Y=[];q=q.nextSibling;){if(D(q)&&(m.a.g.set(q,j,!0),ee--,ee===0))return Y;Y.push(q),S(q)&&ee++}if(!X)throw Error("Cannot find closing comment tag to match: "+W.nodeValue);return null}function I(W,X){var q=p(W,X);return q?0<q.length?q[q.length-1].nextSibling:W.nextSibling:null}var O=n&&n.createComment("test").text==="<!--test-->",F=O?/^\x3c!--\s*ko(?:\s+([\s\S]+))?\s*--\x3e$/:/^\s*ko(?:\s+([\s\S]+))?\s*$/,V=O?/^\x3c!--\s*\/ko\s*--\x3e$/:/^\s*\/ko\s*$/,G={ul:!0,ol:!0},j="__ko_matchedEndComment__";m.h={ea:{},childNodes:function(W){return S(W)?p(W):W.childNodes},Ea:function(W){if(S(W)){W=m.h.childNodes(W);for(var X=0,q=W.length;X<q;X++)m.removeNode(W[X])}else m.a.Tb(W)},va:function(W,X){if(S(W)){m.h.Ea(W);for(var q=W.nextSibling,ee=0,Y=X.length;ee<Y;ee++)q.parentNode.insertBefore(X[ee],q)}else m.a.va(W,X)},Vc:function(W,X){var q;S(W)?(q=W.nextSibling,W=W.parentNode):q=W.firstChild,q?X!==q&&W.insertBefore(X,q):W.appendChild(X)},Wb:function(W,X,q){q?(q=q.nextSibling,S(W)&&(W=W.parentNode),q?X!==q&&W.insertBefore(X,q):W.appendChild(X)):m.h.Vc(W,X)},firstChild:function(W){if(S(W))return!W.nextSibling||D(W.nextSibling)?null:W.nextSibling;if(W.firstChild&&D(W.firstChild))throw Error("Found invalid end comment, as the first child of "+W);return W.firstChild},nextSibling:function(W){if(S(W)&&(W=I(W)),W.nextSibling&&D(W.nextSibling)){var X=W.nextSibling;if(D(X)&&!m.a.g.get(X,j))throw Error("Found end comment without a matching opening comment, as child of "+W);return null}return W.nextSibling},Cd:S,Vd:function(W){return(W=(O?W.text:W.nodeValue).match(F))?W[1]:null},Sc:function(W){if(G[m.a.R(W)]){var X=W.firstChild;if(X)do if(X.nodeType===1){var q;q=X.firstChild;var ee=null;if(q)do if(ee)ee.push(q);else if(S(q)){var Y=I(q,!0);Y?q=Y:ee=[q]}else D(q)&&(ee=[q]);while(q=q.nextSibling);if(q=ee)for(ee=X.nextSibling,Y=0;Y<q.length;Y++)ee?W.insertBefore(q[Y],ee):W.appendChild(q[Y])}while(X=X.nextSibling)}}}}(),m.b("virtualElements",m.h),m.b("virtualElements.allowedBindings",m.h.ea),m.b("virtualElements.emptyNode",m.h.Ea),m.b("virtualElements.insertAfter",m.h.Wb),m.b("virtualElements.prepend",m.h.Vc),m.b("virtualElements.setDomNodeChildren",m.h.va),function(){m.ga=function(){this.nd={}},m.a.extend(m.ga.prototype,{nodeHasBindings:function(S){switch(S.nodeType){case 1:return S.getAttribute("data-bind")!=null||m.j.getComponentNameForNode(S);case 8:return m.h.Cd(S);default:return!1}},getBindings:function(S,D){var p=this.getBindingsString(S,D),p=p?this.parseBindingsString(p,D,S):null;return m.j.tc(p,S,D,!1)},getBindingAccessors:function(S,D){var p=this.getBindingsString(S,D),p=p?this.parseBindingsString(p,D,S,{valueAccessors:!0}):null;return m.j.tc(p,S,D,!0)},getBindingsString:function(S){switch(S.nodeType){case 1:return S.getAttribute("data-bind");case 8:return m.h.Vd(S);default:return null}},parseBindingsString:function(S,D,p,I){try{var O=this.nd,F=S+(I&&I.valueAccessors||""),V;if(!(V=O[F])){var G,j="with($context){with($data||{}){return{"+m.m.vb(S,I)+"}}}";G=new Function("$context","$element",j),V=O[F]=G}return V(D,p)}catch(W){throw W.message=`Unable to parse bindings.
|
|
Bindings value: `+S+`
|
|
Message: `+W.message,W}}}),m.ga.instance=new m.ga}(),m.b("bindingProvider",m.ga),function(){function S(re){var de=(re=m.a.g.get(re,pe))&&re.N;de&&(re.N=null,de.Tc())}function D(re,de,fe){this.node=re,this.yc=de,this.kb=[],this.H=!1,de.N||m.a.K.za(re,S),fe&&fe.N&&(fe.N.kb.push(re),this.Kb=fe)}function p(re){return function(){return re}}function I(re){return re()}function O(re){return m.a.Ga(m.u.G(re),function(de,fe){return function(){return re()[fe]}})}function F(re,de,fe){return typeof re=="function"?O(re.bind(null,de,fe)):m.a.Ga(re,p)}function V(re,de){return O(this.getBindings.bind(this,re,de))}function G(re,de){var fe=m.h.firstChild(de);if(fe){var ye,Ce=m.ga.instance,we=Ce.preprocessNode;if(we){for(;ye=fe;)fe=m.h.nextSibling(ye),we.call(Ce,ye);fe=m.h.firstChild(de)}for(;ye=fe;)fe=m.h.nextSibling(ye),j(re,ye)}m.i.ma(de,m.i.H)}function j(re,de){var fe=re,ye=de.nodeType===1;ye&&m.h.Sc(de),(ye||m.ga.instance.nodeHasBindings(de))&&(fe=X(de,null,re).bindingContextForDescendants),fe&&!Q[m.a.R(de)]&&G(fe,de)}function W(re){var de=[],fe={},ye=[];return m.a.P(re,function Ce(we){if(!fe[we]){var Pe=m.getBindingHandler(we);Pe&&(Pe.after&&(ye.push(we),m.a.D(Pe.after,function(lt){if(re[lt]){if(m.a.A(ye,lt)!==-1)throw Error("Cannot combine the following bindings, because they have a cyclic dependency: "+ye.join(", "));Ce(lt)}}),ye.length--),de.push({key:we,Mc:Pe})),fe[we]=!0}}),de}function X(re,de,fe){var ye=m.a.g.Ub(re,pe,{}),Ce=ye.hd;if(!de){if(Ce)throw Error("You cannot apply bindings multiple times to the same element.");ye.hd=!0}Ce||(ye.context=fe),ye.Zb||(ye.Zb={});var we;if(de&&typeof de!="function")we=de;else{var Pe=m.ga.instance,lt=Pe.getBindingAccessors||V,ft=m.$(function(){return(we=de?de(fe,re):lt.call(Pe,re,fe))&&(fe[ee]&&fe[ee](),fe[ne]&&fe[ne]()),we},null,{l:re});we&&ft.ja()||(ft=null)}var We=fe,Fe;if(we){var Dt=function(){return m.a.Ga(ft?ft():we,I)},st=ft?function(et){return function(){return I(ft()[et])}}:function(et){return we[et]};Dt.get=function(et){return we[et]&&I(st(et))},Dt.has=function(et){return et in we},m.i.H in we&&m.i.subscribe(re,m.i.H,function(){var et=(0,we[m.i.H])();if(et){var hn=m.h.childNodes(re);hn.length&&et(hn,m.Ec(hn[0]))}}),m.i.pa in we&&(We=m.i.Cb(re,fe),m.i.subscribe(re,m.i.pa,function(){var et=(0,we[m.i.pa])();et&&m.h.firstChild(re)&&et(re)})),ye=W(we),m.a.D(ye,function(et){var hn=et.Mc.init,ot=et.Mc.update,at=et.key;if(re.nodeType===8&&!m.h.ea[at])throw Error("The binding '"+at+"' cannot be used with virtual elements");try{typeof hn=="function"&&m.u.G(function(){var Xt=hn(re,st(at),Dt,We.$data,We);if(Xt&&Xt.controlsDescendantBindings){if(Fe!==e)throw Error("Multiple bindings ("+Fe+" and "+at+") are trying to control descendant bindings of the same element. You cannot use these bindings together on the same element.");Fe=at}}),typeof ot=="function"&&m.$(function(){ot(re,st(at),Dt,We.$data,We)},null,{l:re})}catch(Xt){throw Xt.message='Unable to process binding "'+at+": "+we[at]+`"
|
|
Message: `+Xt.message,Xt}})}return ye=Fe===e,{shouldBindDescendants:ye,bindingContextForDescendants:ye&&We}}function q(re,de){return re&&re instanceof m.fa?re:new m.fa(re,e,e,de)}var ee=m.a.Da("_subscribable"),Y=m.a.Da("_ancestorBindingInfo"),ne=m.a.Da("_dataDependency");m.c={};var Q={script:!0,textarea:!0,template:!0};m.getBindingHandler=function(re){return m.c[re]};var le={};m.fa=function(re,de,fe,ye,Ce){function we(){var st=We?ft():ft,et=m.a.f(st);return de?(m.a.extend(Pe,de),Y in de&&(Pe[Y]=de[Y])):(Pe.$parents=[],Pe.$root=et,Pe.ko=m),Pe[ee]=Fe,lt?et=Pe.$data:(Pe.$rawData=st,Pe.$data=et),fe&&(Pe[fe]=et),ye&&ye(Pe,de,et),de&&de[ee]&&!m.S.o().Vb(de[ee])&&de[ee](),Dt&&(Pe[ne]=Dt),Pe.$data}var Pe=this,lt=re===le,ft=lt?e:re,We=typeof ft=="function"&&!m.O(ft),Fe,Dt=Ce&&Ce.dataDependency;Ce&&Ce.exportDependencies?we():(Fe=m.xb(we),Fe.v(),Fe.ja()?Fe.equalityComparer=null:Pe[ee]=e)},m.fa.prototype.createChildContext=function(re,de,fe,ye){if(!ye&&de&&typeof de=="object"&&(ye=de,de=ye.as,fe=ye.extend),de&&ye&&ye.noChildContext){var Ce=typeof re=="function"&&!m.O(re);return new m.fa(le,this,null,function(we){fe&&fe(we),we[de]=Ce?re():re},ye)}return new m.fa(re,this,de,function(we,Pe){we.$parentContext=Pe,we.$parent=Pe.$data,we.$parents=(Pe.$parents||[]).slice(0),we.$parents.unshift(we.$parent),fe&&fe(we)},ye)},m.fa.prototype.extend=function(re,de){return new m.fa(le,this,null,function(fe){m.a.extend(fe,typeof re=="function"?re(fe):re)},de)};var pe=m.a.g.Z();D.prototype.Tc=function(){this.Kb&&this.Kb.N&&this.Kb.N.sd(this.node)},D.prototype.sd=function(re){m.a.Pa(this.kb,re),!this.kb.length&&this.H&&this.Cc()},D.prototype.Cc=function(){this.H=!0,this.yc.N&&!this.kb.length&&(this.yc.N=null,m.a.K.yb(this.node,S),m.i.ma(this.node,m.i.pa),this.Tc())},m.i={H:"childrenComplete",pa:"descendantsComplete",subscribe:function(re,de,fe,ye,Ce){var we=m.a.g.Ub(re,pe,{});return we.Fa||(we.Fa=new m.T),Ce&&Ce.notifyImmediately&&we.Zb[de]&&m.u.G(fe,ye,[re]),we.Fa.subscribe(fe,ye,de)},ma:function(re,de){var fe=m.a.g.get(re,pe);if(fe&&(fe.Zb[de]=!0,fe.Fa&&fe.Fa.notifySubscribers(re,de),de==m.i.H)){if(fe.N)fe.N.Cc();else if(fe.N===e&&fe.Fa&&fe.Fa.Wa(m.i.pa))throw Error("descendantsComplete event not supported for bindings on this node")}},Cb:function(re,de){var fe=m.a.g.Ub(re,pe,{});return fe.N||(fe.N=new D(re,fe,de[Y])),de[Y]==fe?de:de.extend(function(ye){ye[Y]=fe})}},m.Td=function(re){return(re=m.a.g.get(re,pe))&&re.context},m.ib=function(re,de,fe){return re.nodeType===1&&m.h.Sc(re),X(re,de,q(fe))},m.ld=function(re,de,fe){return fe=q(fe),m.ib(re,F(de,fe,re),fe)},m.Oa=function(re,de){de.nodeType!==1&&de.nodeType!==8||G(q(re),de)},m.vc=function(re,de,fe){if(!o&&t.jQuery&&(o=t.jQuery),2>arguments.length){if(de=n.body,!de)throw Error("ko.applyBindings: could not find document.body; has the document been loaded?")}else if(!de||de.nodeType!==1&&de.nodeType!==8)throw Error("ko.applyBindings: first parameter should be your view model; second parameter should be a DOM node");j(q(re,fe),de)},m.Dc=function(re){return!re||re.nodeType!==1&&re.nodeType!==8?e:m.Td(re)},m.Ec=function(re){return(re=m.Dc(re))?re.$data:e},m.b("bindingHandlers",m.c),m.b("bindingEvent",m.i),m.b("bindingEvent.subscribe",m.i.subscribe),m.b("bindingEvent.startPossiblyAsyncContentBinding",m.i.Cb),m.b("applyBindings",m.vc),m.b("applyBindingsToDescendants",m.Oa),m.b("applyBindingAccessorsToNode",m.ib),m.b("applyBindingsToNode",m.ld),m.b("contextFor",m.Dc),m.b("dataFor",m.Ec)}(),function(S){function D(V,G){var j=Object.prototype.hasOwnProperty.call(O,V)?O[V]:S,W;j?j.subscribe(G):(j=O[V]=new m.T,j.subscribe(G),p(V,function(X,q){var ee=!(!q||!q.synchronous);F[V]={definition:X,Gd:ee},delete O[V],W||ee?j.notifySubscribers(X):m.na.zb(function(){j.notifySubscribers(X)})}),W=!0)}function p(V,G){I("getConfig",[V],function(j){j?I("loadComponent",[V,j],function(W){G(W,j)}):G(null,null)})}function I(V,G,j,W){W||(W=m.j.loaders.slice(0));var X=W.shift();if(X){var q=X[V];if(q){var ee=!1;if(q.apply(X,G.concat(function(Y){ee?j(null):Y!==null?j(Y):I(V,G,j,W)}))!==S&&(ee=!0,!X.suppressLoaderExceptions))throw Error("Component loaders must supply values by invoking the callback, not by returning values synchronously.")}else I(V,G,j,W)}else j(null)}var O={},F={};m.j={get:function(V,G){var j=Object.prototype.hasOwnProperty.call(F,V)?F[V]:S;j?j.Gd?m.u.G(function(){G(j.definition)}):m.na.zb(function(){G(j.definition)}):D(V,G)},Bc:function(V){delete F[V]},oc:I},m.j.loaders=[],m.b("components",m.j),m.b("components.get",m.j.get),m.b("components.clearCachedDefinition",m.j.Bc)}(),function(){function S(j,W,X,q){function ee(){--ne===0&&q(Y)}var Y={},ne=2,Q=X.template;X=X.viewModel,Q?O(W,Q,function(le){m.j.oc("loadTemplate",[j,le],function(pe){Y.template=pe,ee()})}):ee(),X?O(W,X,function(le){m.j.oc("loadViewModel",[j,le],function(pe){Y[G]=pe,ee()})}):ee()}function D(j,W,X){if(typeof W=="function")X(function(ee){return new W(ee)});else if(typeof W[G]=="function")X(W[G]);else if("instance"in W){var q=W.instance;X(function(){return q})}else"viewModel"in W?D(j,W.viewModel,X):j("Unknown viewModel value: "+W)}function p(j){switch(m.a.R(j)){case"script":return m.a.ua(j.text);case"textarea":return m.a.ua(j.value);case"template":if(I(j.content))return m.a.Ca(j.content.childNodes)}return m.a.Ca(j.childNodes)}function I(j){return t.DocumentFragment?j instanceof DocumentFragment:j&&j.nodeType===11}function O(j,W,X){typeof W.require=="string"?a||t.require?(a||t.require)([W.require],function(q){q&&typeof q=="object"&&q.Xd&&q.default&&(q=q.default),X(q)}):j("Uses require, but no AMD loader is present"):X(W)}function F(j){return function(W){throw Error("Component '"+j+"': "+W)}}var V={};m.j.register=function(j,W){if(!W)throw Error("Invalid configuration for "+j);if(m.j.tb(j))throw Error("Component "+j+" is already registered");V[j]=W},m.j.tb=function(j){return Object.prototype.hasOwnProperty.call(V,j)},m.j.unregister=function(j){delete V[j],m.j.Bc(j)},m.j.Fc={getConfig:function(j,W){W(m.j.tb(j)?V[j]:null)},loadComponent:function(j,W,X){var q=F(j);O(q,W,function(ee){S(j,q,ee,X)})},loadTemplate:function(j,W,X){if(j=F(j),typeof W=="string")X(m.a.ua(W));else if(W instanceof Array)X(W);else if(I(W))X(m.a.la(W.childNodes));else if(W.element)if(W=W.element,t.HTMLElement?W instanceof HTMLElement:W&&W.tagName&&W.nodeType===1)X(p(W));else if(typeof W=="string"){var q=n.getElementById(W);q?X(p(q)):j("Cannot find element with ID "+W)}else j("Unknown element type: "+W);else j("Unknown template value: "+W)},loadViewModel:function(j,W,X){D(F(j),W,X)}};var G="createViewModel";m.b("components.register",m.j.register),m.b("components.isRegistered",m.j.tb),m.b("components.unregister",m.j.unregister),m.b("components.defaultLoader",m.j.Fc),m.j.loaders.push(m.j.Fc),m.j.dd=V}(),function(){function S(p,I){var O=p.getAttribute("params");if(O){var O=D.parseBindingsString(O,I,p,{valueAccessors:!0,bindingParams:!0}),O=m.a.Ga(O,function(G){return m.o(G,null,{l:p})}),F=m.a.Ga(O,function(G){var j=G.v();return G.ja()?m.o({read:function(){return m.a.f(G())},write:m.Za(j)&&function(W){G()(W)},l:p}):j});return Object.prototype.hasOwnProperty.call(F,"$raw")||(F.$raw=O),F}return{$raw:{}}}m.j.getComponentNameForNode=function(p){var I=m.a.R(p);if(m.j.tb(I)&&(I.indexOf("-")!=-1||""+p=="[object HTMLUnknownElement]"||8>=m.a.W&&p.tagName===I))return I},m.j.tc=function(p,I,O,F){if(I.nodeType===1){var V=m.j.getComponentNameForNode(I);if(V){if(p=p||{},p.component)throw Error('Cannot use the "component" binding on a custom element matching a component');var G={name:V,params:S(I,O)};p.component=F?function(){return G}:G}}return p};var D=new m.ga;9>m.a.W&&(m.j.register=function(p){return function(I){return p.apply(this,arguments)}}(m.j.register),n.createDocumentFragment=function(p){return function(){var I=p();return m.j.dd,I}}(n.createDocumentFragment))}(),function(){function S(I,O,F){if(O=O.template,!O)throw Error("Component '"+I+"' has no template");I=m.a.Ca(O),m.h.va(F,I)}function D(I,O,F){var V=I.createViewModel;return V?V.call(I,O,F):O}var p=0;m.c.component={init:function(I,O,F,V,G){function j(){var Y=W&&W.dispose;typeof Y=="function"&&Y.call(W),q&&q.s(),X=W=q=null}var W,X,q,ee=m.a.la(m.h.childNodes(I));return m.h.Ea(I),m.a.K.za(I,j),m.o(function(){var Y=m.a.f(O()),ne,Q;if(typeof Y=="string"?ne=Y:(ne=m.a.f(Y.name),Q=m.a.f(Y.params)),!ne)throw Error("No component name specified");var le=m.i.Cb(I,G),pe=X=++p;m.j.get(ne,function(re){if(X===pe){if(j(),!re)throw Error("Unknown component '"+ne+"'");S(ne,re,I);var de=D(re,Q,{element:I,templateNodes:ee});re=le.createChildContext(de,{extend:function(fe){fe.$component=de,fe.$componentTemplateNodes=ee}}),de&&de.koDescendantsComplete&&(q=m.i.subscribe(I,m.i.pa,de.koDescendantsComplete,de)),W=de,m.Oa(re,I)}})},null,{l:I}),{controlsDescendantBindings:!0}}},m.h.ea.component=!0}();var U={class:"className",for:"htmlFor"};m.c.attr={update:function(S,D){var p=m.a.f(D())||{};m.a.P(p,function(I,O){O=m.a.f(O);var F=I.indexOf(":"),F="lookupNamespaceURI"in S&&0<F&&S.lookupNamespaceURI(I.substr(0,F)),V=O===!1||O===null||O===e;V?F?S.removeAttributeNS(F,I):S.removeAttribute(I):O=O.toString(),8>=m.a.W&&I in U?(I=U[I],V?S.removeAttribute(I):S[I]=O):V||(F?S.setAttributeNS(F,I,O):S.setAttribute(I,O)),I==="name"&&m.a.Yc(S,V?"":O)})}},function(){m.c.checked={after:["value","attr"],init:function(S,D,p){function I(){var Y=S.checked,ne=F();if(!m.S.Ya()&&(Y||!G&&!m.S.qa())){var Q=m.u.G(D);if(W){var le=X?Q.v():Q,pe=ee;ee=ne,pe!==ne?Y&&(m.a.Na(le,ne,!0),m.a.Na(le,pe,!1)):m.a.Na(le,ne,Y),X&&m.Za(Q)&&Q(le)}else V&&(ne===e?ne=Y:Y||(ne=e)),m.m.eb(Q,p,"checked",ne,!0)}}function O(){var Y=m.a.f(D()),ne=F();W?(S.checked=0<=m.a.A(Y,ne),ee=ne):S.checked=V&&ne===e?!!Y:F()===Y}var F=m.xb(function(){if(p.has("checkedValue"))return m.a.f(p.get("checkedValue"));if(q)return p.has("value")?m.a.f(p.get("value")):S.value}),V=S.type=="checkbox",G=S.type=="radio";if(V||G){var j=D(),W=V&&m.a.f(j)instanceof Array,X=!(W&&j.push&&j.splice),q=G||W,ee=W?F():e;G&&!S.name&&m.c.uniqueName.init(S,function(){return!0}),m.o(I,null,{l:S}),m.a.B(S,"click",I),m.o(O,null,{l:S}),j=e}}},m.m.wa.checked=!0,m.c.checkedValue={update:function(S,D){S.value=m.a.f(D())}}}(),m.c.class={update:function(S,D){var p=m.a.Db(m.a.f(D()));m.a.Eb(S,S.__ko__cssValue,!1),S.__ko__cssValue=p,m.a.Eb(S,p,!0)}},m.c.css={update:function(S,D){var p=m.a.f(D());p!==null&&typeof p=="object"?m.a.P(p,function(I,O){O=m.a.f(O),m.a.Eb(S,I,O)}):m.c.class.update(S,D)}},m.c.enable={update:function(S,D){var p=m.a.f(D());p&&S.disabled?S.removeAttribute("disabled"):p||S.disabled||(S.disabled=!0)}},m.c.disable={update:function(S,D){m.c.enable.update(S,function(){return!m.a.f(D())})}},m.c.event={init:function(S,D,p,I,O){var F=D()||{};m.a.P(F,function(V){typeof V=="string"&&m.a.B(S,V,function(G){var j,W=D()[V];if(W){try{var X=m.a.la(arguments);I=O.$data,X.unshift(I),j=W.apply(I,X)}finally{j!==!0&&(G.preventDefault?G.preventDefault():G.returnValue=!1)}p.get(V+"Bubble")===!1&&(G.cancelBubble=!0,G.stopPropagation&&G.stopPropagation())}})})}},m.c.foreach={Rc:function(S){return function(){var D=S(),p=m.a.bc(D);return!p||typeof p.length=="number"?{foreach:D,templateEngine:m.ba.Ma}:(m.a.f(D),{foreach:p.data,as:p.as,noChildContext:p.noChildContext,includeDestroyed:p.includeDestroyed,afterAdd:p.afterAdd,beforeRemove:p.beforeRemove,afterRender:p.afterRender,beforeMove:p.beforeMove,afterMove:p.afterMove,templateEngine:m.ba.Ma})}},init:function(S,D){return m.c.template.init(S,m.c.foreach.Rc(D))},update:function(S,D,p,I,O){return m.c.template.update(S,m.c.foreach.Rc(D),p,I,O)}},m.m.Ra.foreach=!1,m.h.ea.foreach=!0,m.c.hasfocus={init:function(S,D,p){function I(V){S.__ko_hasfocusUpdating=!0;var G=S.ownerDocument;if("activeElement"in G){var j;try{j=G.activeElement}catch{j=G.body}V=j===S}G=D(),m.m.eb(G,p,"hasfocus",V,!0),S.__ko_hasfocusLastValue=V,S.__ko_hasfocusUpdating=!1}var O=I.bind(null,!0),F=I.bind(null,!1);m.a.B(S,"focus",O),m.a.B(S,"focusin",O),m.a.B(S,"blur",F),m.a.B(S,"focusout",F),S.__ko_hasfocusLastValue=!1},update:function(S,D){var p=!!m.a.f(D());S.__ko_hasfocusUpdating||S.__ko_hasfocusLastValue===p||(p?S.focus():S.blur(),!p&&S.__ko_hasfocusLastValue&&S.ownerDocument.body.focus(),m.u.G(m.a.Fb,null,[S,p?"focusin":"focusout"]))}},m.m.wa.hasfocus=!0,m.c.hasFocus=m.c.hasfocus,m.m.wa.hasFocus="hasfocus",m.c.html={init:function(){return{controlsDescendantBindings:!0}},update:function(S,D){m.a.fc(S,D())}},function(){function S(D,p,I){m.c[D]={init:function(O,F,V,G,j){var W,X,q={},ee,Y,ne;if(p){G=V.get("as");var Q=V.get("noChildContext");ne=!(G&&Q),q={as:G,noChildContext:Q,exportDependencies:ne}}return Y=(ee=V.get("completeOn")=="render")||V.has(m.i.pa),m.o(function(){var le=m.a.f(F()),pe=!I!=!le,re=!X,de;(ne||pe!==W)&&(Y&&(j=m.i.Cb(O,j)),pe&&((!p||ne)&&(q.dataDependency=m.S.o()),de=p?j.createChildContext(typeof le=="function"?le:F,q):m.S.qa()?j.extend(null,q):j),re&&m.S.qa()&&(X=m.a.Ca(m.h.childNodes(O),!0)),pe?(re||m.h.va(O,m.a.Ca(X)),m.Oa(de,O)):(m.h.Ea(O),ee||m.i.ma(O,m.i.H)),W=pe)},null,{l:O}),{controlsDescendantBindings:!0}}},m.m.Ra[D]=!1,m.h.ea[D]=!0}S("if"),S("ifnot",!1,!0),S("with",!0)}(),m.c.let={init:function(S,D,p,I,O){return D=O.extend(D),m.Oa(D,S),{controlsDescendantBindings:!0}}},m.h.ea.let=!0;var B={};m.c.options={init:function(S){if(m.a.R(S)!=="select")throw Error("options binding applies only to SELECT elements");for(;0<S.length;)S.remove(0);return{controlsDescendantBindings:!0}},update:function(S,D,p){function I(){return m.a.jb(S.options,function(Q){return Q.selected})}function O(Q,le,pe){var re=typeof le;return re=="function"?le(Q):re=="string"?Q[le]:pe}function F(Q,le){if(Y&&W)m.i.ma(S,m.i.H);else if(ee.length){var pe=0<=m.a.A(ee,m.w.M(le[0]));m.a.Zc(le[0],pe),Y&&!pe&&m.u.G(m.a.Fb,null,[S,"change"])}}var V=S.multiple,G=S.length!=0&&V?S.scrollTop:null,j=m.a.f(D()),W=p.get("valueAllowUnset")&&p.has("value"),X=p.get("optionsIncludeDestroyed");D={};var q,ee=[];W||(V?ee=m.a.Mb(I(),m.w.M):0<=S.selectedIndex&&ee.push(m.w.M(S.options[S.selectedIndex]))),j&&(typeof j.length>"u"&&(j=[j]),q=m.a.jb(j,function(Q){return X||Q===e||Q===null||!m.a.f(Q._destroy)}),p.has("optionsCaption")&&(j=m.a.f(p.get("optionsCaption")),j!==null&&j!==e&&q.unshift(B)));var Y=!1;if(D.beforeRemove=function(Q){S.removeChild(Q)},j=F,p.has("optionsAfterRender")&&typeof p.get("optionsAfterRender")=="function"&&(j=function(Q,le){F(0,le),m.u.G(p.get("optionsAfterRender"),null,[le[0],Q!==B?Q:e])}),m.a.ec(S,q,function(Q,le,pe){return pe.length&&(ee=!W&&pe[0].selected?[m.w.M(pe[0])]:[],Y=!0),le=S.ownerDocument.createElement("option"),Q===B?(m.a.Bb(le,p.get("optionsCaption")),m.w.cb(le,e)):(pe=O(Q,p.get("optionsValue"),Q),m.w.cb(le,m.a.f(pe)),Q=O(Q,p.get("optionsText"),pe),m.a.Bb(le,Q)),[le]},D,j),!W){var ne;V?ne=ee.length&&I().length<ee.length:ne=ee.length&&0<=S.selectedIndex?m.w.M(S.options[S.selectedIndex])!==ee[0]:ee.length||0<=S.selectedIndex,ne&&m.u.G(m.a.Fb,null,[S,"change"])}(W||m.S.Ya())&&m.i.ma(S,m.i.H),m.a.wd(S),G&&20<Math.abs(G-S.scrollTop)&&(S.scrollTop=G)}},m.c.options.$b=m.a.g.Z(),m.c.selectedOptions={init:function(S,D,p){function I(){var V=D(),G=[];m.a.D(S.getElementsByTagName("option"),function(j){j.selected&&G.push(m.w.M(j))}),m.m.eb(V,p,"selectedOptions",G)}function O(){var V=m.a.f(D()),G=S.scrollTop;V&&typeof V.length=="number"&&m.a.D(S.getElementsByTagName("option"),function(j){var W=0<=m.a.A(V,m.w.M(j));j.selected!=W&&m.a.Zc(j,W)}),S.scrollTop=G}if(m.a.R(S)!="select")throw Error("selectedOptions binding applies only to SELECT elements");var F;m.i.subscribe(S,m.i.H,function(){F?I():(m.a.B(S,"change",I),F=m.o(O,null,{l:S}))},null,{notifyImmediately:!0})},update:function(){}},m.m.wa.selectedOptions=!0,m.c.style={update:function(S,D){var p=m.a.f(D()||{});m.a.P(p,function(I,O){if(O=m.a.f(O),(O===null||O===e||O===!1)&&(O=""),o)o(S).css(I,O);else if(/^--/.test(I))S.style.setProperty(I,O);else{I=I.replace(/-(\w)/g,function(V,G){return G.toUpperCase()});var F=S.style[I];S.style[I]=O,O===F||S.style[I]!=F||isNaN(O)||(S.style[I]=O+"px")}})}},m.c.submit={init:function(S,D,p,I,O){if(typeof D()!="function")throw Error("The value for a submit binding must be a function");m.a.B(S,"submit",function(F){var V,G=D();try{V=G.call(O.$data,S)}finally{V!==!0&&(F.preventDefault?F.preventDefault():F.returnValue=!1)}})}},m.c.text={init:function(){return{controlsDescendantBindings:!0}},update:function(S,D){m.a.Bb(S,D())}},m.h.ea.text=!0,function(){if(t&&t.navigator){var S=function(q){if(q)return parseFloat(q[1])},D=t.navigator.userAgent,p,I,O,F,V;(p=t.opera&&t.opera.version&&parseInt(t.opera.version()))||(V=S(D.match(/Edge\/([^ ]+)$/)))||S(D.match(/Chrome\/([^ ]+)/))||(I=S(D.match(/Version\/([^ ]+) Safari/)))||(O=S(D.match(/Firefox\/([^ ]+)/)))||(F=m.a.W||S(D.match(/MSIE ([^ ]+)/)))||(F=S(D.match(/rv:([^ )]+)/)))}if(8<=F&&10>F)var G=m.a.g.Z(),j=m.a.g.Z(),W=function(q){var ee=this.activeElement;(ee=ee&&m.a.g.get(ee,j))&&ee(q)},X=function(q,ee){var Y=q.ownerDocument;m.a.g.get(Y,G)||(m.a.g.set(Y,G,!0),m.a.B(Y,"selectionchange",W)),m.a.g.set(q,j,ee)};m.c.textInput={init:function(q,ee,Y){function ne(we,Pe){m.a.B(q,we,Pe)}function Q(){var we=m.a.f(ee());(we===null||we===e)&&(we=""),fe!==e&&we===fe?m.a.setTimeout(Q,4):q.value!==we&&(Ce=!0,q.value=we,Ce=!1,re=q.value)}function le(){de||(fe=q.value,de=m.a.setTimeout(pe,4))}function pe(){clearTimeout(de),fe=de=e;var we=q.value;re!==we&&(re=we,m.m.eb(ee(),Y,"textInput",we))}var re=q.value,de,fe,ye=m.a.W==9?le:pe,Ce=!1;F&&ne("keypress",pe),11>F&&ne("propertychange",function(we){Ce||we.propertyName!=="value"||ye()}),F==8&&(ne("keyup",pe),ne("keydown",pe)),X&&(X(q,ye),ne("dragend",le)),(!F||9<=F)&&ne("input",ye),5>I&&m.a.R(q)==="textarea"?(ne("keydown",le),ne("paste",le),ne("cut",le)):11>p?ne("keydown",le):4>O?(ne("DOMAutoComplete",pe),ne("dragdrop",pe),ne("drop",pe)):V&&q.type==="number"&&ne("keydown",le),ne("change",pe),ne("blur",pe),m.o(Q,null,{l:q})}},m.m.wa.textInput=!0,m.c.textinput={preprocess:function(q,ee,Y){Y("textInput",q)}}}(),m.c.uniqueName={init:function(S,D){if(D()){var p="ko_unique_"+ ++m.c.uniqueName.rd;m.a.Yc(S,p)}}},m.c.uniqueName.rd=0,m.c.using={init:function(S,D,p,I,O){var F;return p.has("as")&&(F={as:p.get("as"),noChildContext:p.get("noChildContext")}),D=O.createChildContext(D,F),m.Oa(D,S),{controlsDescendantBindings:!0}}},m.h.ea.using=!0,m.c.value={init:function(S,D,p){var I=m.a.R(S),O=I=="input";if(!O||S.type!="checkbox"&&S.type!="radio"){var F=[],V=p.get("valueUpdate"),G=!1,j=null;V&&(typeof V=="string"?F=[V]:F=m.a.wc(V),m.a.Pa(F,"change"));var W=function(){j=null,G=!1;var ee=D(),Y=m.w.M(S);m.m.eb(ee,p,"value",Y)};!m.a.W||!O||S.type!="text"||S.autocomplete=="off"||S.form&&S.form.autocomplete=="off"||m.a.A(F,"propertychange")!=-1||(m.a.B(S,"propertychange",function(){G=!0}),m.a.B(S,"focus",function(){G=!1}),m.a.B(S,"blur",function(){G&&W()})),m.a.D(F,function(ee){var Y=W;m.a.Ud(ee,"after")&&(Y=function(){j=m.w.M(S),m.a.setTimeout(W,0)},ee=ee.substring(5)),m.a.B(S,ee,Y)});var X;if(X=O&&S.type=="file"?function(){var ee=m.a.f(D());ee===null||ee===e||ee===""?S.value="":m.u.G(W)}:function(){var ee=m.a.f(D()),Y=m.w.M(S);j!==null&&ee===j?m.a.setTimeout(X,0):(ee!==Y||Y===e)&&(I==="select"?(Y=p.get("valueAllowUnset"),m.w.cb(S,ee,Y),Y||ee===m.w.M(S)||m.u.G(W)):m.w.cb(S,ee))},I==="select"){var q;m.i.subscribe(S,m.i.H,function(){q?p.get("valueAllowUnset")?X():W():(m.a.B(S,"change",W),q=m.o(X,null,{l:S}))},null,{notifyImmediately:!0})}else m.a.B(S,"change",W),m.o(X,null,{l:S})}else m.ib(S,{checkedValue:D})},update:function(){}},m.m.wa.value=!0,m.c.visible={update:function(S,D){var p=m.a.f(D()),I=S.style.display!="none";p&&!I?S.style.display="":!p&&I&&(S.style.display="none")}},m.c.hidden={update:function(S,D){m.c.visible.update(S,function(){return!m.a.f(D())})}},function(S){m.c[S]={init:function(D,p,I,O,F){return m.c.event.init.call(this,D,function(){var V={};return V[S]=p(),V},I,O,F)}}}("click"),m.ca=function(){},m.ca.prototype.renderTemplateSource=function(){throw Error("Override renderTemplateSource")},m.ca.prototype.createJavaScriptEvaluatorBlock=function(){throw Error("Override createJavaScriptEvaluatorBlock")},m.ca.prototype.makeTemplateSource=function(S,D){if(typeof S=="string"){D=D||n;var p=D.getElementById(S);if(!p)throw Error("Cannot find template with ID "+S);return new m.C.F(p)}if(S.nodeType==1||S.nodeType==8)return new m.C.ia(S);throw Error("Unknown template type: "+S)},m.ca.prototype.renderTemplate=function(S,D,p,I){return S=this.makeTemplateSource(S,I),this.renderTemplateSource(S,D,p,I)},m.ca.prototype.isTemplateRewritten=function(S,D){return this.allowTemplateRewriting===!1?!0:this.makeTemplateSource(S,D).data("isRewritten")},m.ca.prototype.rewriteTemplate=function(S,D,p){S=this.makeTemplateSource(S,p),D=D(S.text()),S.text(D),S.data("isRewritten",!0)},m.b("templateEngine",m.ca),m.kc=function(){function S(I,O,F,V){I=m.m.ac(I);for(var G=m.m.Ra,j=0;j<I.length;j++){var W=I[j].key;if(Object.prototype.hasOwnProperty.call(G,W)){var X=G[W];if(typeof X=="function"){if(W=X(I[j].value))throw Error(W)}else if(!X)throw Error("This template engine does not support the '"+W+"' binding within its templates")}}return F="ko.__tr_ambtns(function($context,$element){return(function(){return{ "+m.m.vb(I,{valueAccessors:!0})+" } })()},'"+F.toLowerCase()+"')",V.createJavaScriptEvaluatorBlock(F)+O}var D=/(<([a-z]+\d*)(?:\s+(?!data-bind\s*=\s*)[a-z0-9\-]+(?:=(?:\"[^\"]*\"|\'[^\']*\'|[^>]*))?)*\s+)data-bind\s*=\s*(["'])([\s\S]*?)\3/gi,p=/\x3c!--\s*ko\b\s*([\s\S]*?)\s*--\x3e/g;return{xd:function(I,O,F){O.isTemplateRewritten(I,F)||O.rewriteTemplate(I,function(V){return m.kc.Ld(V,O)},F)},Ld:function(I,O){return I.replace(D,function(F,V,G,j,W){return S(W,V,G,O)}).replace(p,function(F,V){return S(V,"<!-- ko -->","#comment",O)})},md:function(I,O){return m.aa.Xb(function(F,V){var G=F.nextSibling;G&&G.nodeName.toLowerCase()===O&&m.ib(G,I,V)})}}}(),m.b("__tr_ambtns",m.kc.md),function(){m.C={},m.C.F=function(p){if(this.F=p){var I=m.a.R(p);this.ab=I==="script"?1:I==="textarea"?2:I=="template"&&p.content&&p.content.nodeType===11?3:4}},m.C.F.prototype.text=function(){var p=this.ab===1?"text":this.ab===2?"value":"innerHTML";if(arguments.length==0)return this.F[p];var I=arguments[0];p==="innerHTML"?m.a.fc(this.F,I):this.F[p]=I};var S=m.a.g.Z()+"_";m.C.F.prototype.data=function(p){if(arguments.length===1)return m.a.g.get(this.F,S+p);m.a.g.set(this.F,S+p,arguments[1])};var D=m.a.g.Z();m.C.F.prototype.nodes=function(){var p=this.F;if(arguments.length==0){var I=m.a.g.get(p,D)||{},O=I.lb||(this.ab===3?p.content:this.ab===4?p:e);if(!O||I.jd){var F=this.text();F&&F!==I.bb&&(O=m.a.Md(F,p.ownerDocument),m.a.g.set(p,D,{lb:O,bb:F,jd:!0}))}return O}I=arguments[0],this.ab!==e&&this.text(""),m.a.g.set(p,D,{lb:I})},m.C.ia=function(p){this.F=p},m.C.ia.prototype=new m.C.F,m.C.ia.prototype.constructor=m.C.ia,m.C.ia.prototype.text=function(){if(arguments.length==0){var p=m.a.g.get(this.F,D)||{};return p.bb===e&&p.lb&&(p.bb=p.lb.innerHTML),p.bb}m.a.g.set(this.F,D,{bb:arguments[0]})},m.b("templateSources",m.C),m.b("templateSources.domElement",m.C.F),m.b("templateSources.anonymousTemplate",m.C.ia)}(),function(){function S(j,W,X){var q;for(W=m.h.nextSibling(W);j&&(q=j)!==W;)j=m.h.nextSibling(q),X(q,j)}function D(j,W){if(j.length){var X=j[0],q=j[j.length-1],ee=X.parentNode,Y=m.ga.instance,ne=Y.preprocessNode;if(ne){if(S(X,q,function(Q,le){var pe=Q.previousSibling,re=ne.call(Y,Q);re&&(Q===X&&(X=re[0]||le),Q===q&&(q=re[re.length-1]||pe))}),j.length=0,!X)return;X===q?j.push(X):(j.push(X,q),m.a.Ua(j,ee))}S(X,q,function(Q){Q.nodeType!==1&&Q.nodeType!==8||m.vc(W,Q)}),S(X,q,function(Q){Q.nodeType!==1&&Q.nodeType!==8||m.aa.cd(Q,[W])}),m.a.Ua(j,ee)}}function p(j){return j.nodeType?j:0<j.length?j[0]:null}function I(j,W,X,q,ee){ee=ee||{};var Y=(j&&p(j)||X||{}).ownerDocument,ne=ee.templateEngine||F;if(m.kc.xd(X,ne,Y),X=ne.renderTemplate(X,q,ee,Y),typeof X.length!="number"||0<X.length&&typeof X[0].nodeType!="number")throw Error("Template engine must return an array of DOM nodes");switch(Y=!1,W){case"replaceChildren":m.h.va(j,X),Y=!0;break;case"replaceNode":m.a.Xc(j,X),Y=!0;break;case"ignoreTargetNode":break;default:throw Error("Unknown renderMode: "+W)}return Y&&(D(X,q),ee.afterRender&&m.u.G(ee.afterRender,null,[X,q[ee.as||"$data"]]),W=="replaceChildren"&&m.i.ma(j,m.i.H)),X}function O(j,W,X){return m.O(j)?j():typeof j=="function"?j(W,X):j}var F;m.gc=function(j){if(j!=e&&!(j instanceof m.ca))throw Error("templateEngine must inherit from ko.templateEngine");F=j},m.dc=function(j,W,X,q,ee){if(X=X||{},(X.templateEngine||F)==e)throw Error("Set a template engine before calling renderTemplate");if(ee=ee||"replaceChildren",q){var Y=p(q);return m.$(function(){var Q=W&&W instanceof m.fa?W:new m.fa(W,null,null,null,{exportDependencies:!0}),ne=O(j,Q.$data,Q),Q=I(q,ee,ne,Q,X);ee=="replaceNode"&&(q=Q,Y=p(q))},null,{Sa:function(){return!Y||!m.a.Sb(Y)},l:Y&&ee=="replaceNode"?Y.parentNode:Y})}return m.aa.Xb(function(ne){m.dc(j,W,X,ne,"replaceNode")})},m.Qd=function(j,W,X,q,ee){function Y(fe,ye){m.u.G(m.a.ec,null,[q,fe,Q,X,ne,ye]),m.i.ma(q,m.i.H)}function ne(fe,ye){D(ye,le),X.afterRender&&X.afterRender(ye,fe),le=null}function Q(fe,ye){le=ee.createChildContext(fe,{as:pe,noChildContext:X.noChildContext,extend:function(we){we.$index=ye,pe&&(we[pe+"Index"]=ye)}});var Ce=O(j,fe,le);return I(q,"ignoreTargetNode",Ce,le,X)}var le,pe=X.as,re=X.includeDestroyed===!1||m.options.foreachHidesDestroyed&&!X.includeDestroyed;if(re||X.beforeRemove||!m.Pc(W))return m.$(function(){var fe=m.a.f(W)||[];typeof fe.length>"u"&&(fe=[fe]),re&&(fe=m.a.jb(fe,function(ye){return ye===e||ye===null||!m.a.f(ye._destroy)})),Y(fe)},null,{l:q});Y(W.v());var de=W.subscribe(function(fe){Y(W(),fe)},null,"arrayChange");return de.l(q),de};var V=m.a.g.Z(),G=m.a.g.Z();m.c.template={init:function(j,W){var X=m.a.f(W());if(typeof X=="string"||"name"in X)m.h.Ea(j);else if("nodes"in X){if(X=X.nodes||[],m.O(X))throw Error('The "nodes" option must be a plain, non-observable array.');var q=X[0]&&X[0].parentNode;q&&m.a.g.get(q,G)||(q=m.a.Yb(X),m.a.g.set(q,G,!0)),new m.C.ia(j).nodes(q)}else if(X=m.h.childNodes(j),0<X.length)q=m.a.Yb(X),new m.C.ia(j).nodes(q);else throw Error("Anonymous template defined, but no template content was provided");return{controlsDescendantBindings:!0}},update:function(j,W,X,q,ee){var Y=W();W=m.a.f(Y),X=!0,q=null,typeof W=="string"?W={}:(Y="name"in W?W.name:j,"if"in W&&(X=m.a.f(W.if)),X&&"ifnot"in W&&(X=!m.a.f(W.ifnot)),X&&!Y&&(X=!1)),"foreach"in W?q=m.Qd(Y,X&&W.foreach||[],W,j,ee):X?(X=ee,"data"in W&&(X=ee.createChildContext(W.data,{as:W.as,noChildContext:W.noChildContext,exportDependencies:!0})),q=m.dc(Y,X,W,j)):m.h.Ea(j),ee=q,(W=m.a.g.get(j,V))&&typeof W.s=="function"&&W.s(),m.a.g.set(j,V,!ee||ee.ja&&!ee.ja()?e:ee)}},m.m.Ra.template=function(j){return j=m.m.ac(j),j.length==1&&j[0].unknown||m.m.Id(j,"name")?null:"This template engine does not support anonymous templates nested within its templates"},m.h.ea.template=!0}(),m.b("setTemplateEngine",m.gc),m.b("renderTemplate",m.dc),m.a.Kc=function(S,D,p){if(S.length&&D.length){var I,O,F,V,G;for(I=O=0;(!p||I<p)&&(V=S[O]);++O){for(F=0;G=D[F];++F)if(V.value===G.value){V.moved=G.index,G.moved=V.index,D.splice(F,1),I=F=0;break}I+=F}}},m.a.Pb=function(){function S(D,p,I,O,F){var V=Math.min,G=Math.max,j=[],W,X=D.length,q,ee=p.length,Y=ee-X||1,ne=X+ee+1,Q,le,pe;for(W=0;W<=X;W++)for(le=Q,j.push(Q=[]),pe=V(ee,W+Y),q=G(0,W-1);q<=pe;q++)Q[q]=q?W?D[W-1]===p[q-1]?le[q-1]:V(le[q]||ne,Q[q-1]||ne)+1:q+1:W+1;for(V=[],G=[],Y=[],W=X,q=ee;W||q;)ee=j[W][q]-1,q&&ee===j[W][q-1]?G.push(V[V.length]={status:I,value:p[--q],index:q}):W&&ee===j[W-1][q]?Y.push(V[V.length]={status:O,value:D[--W],index:W}):(--q,--W,F.sparse||V.push({status:"retained",value:p[q]}));return m.a.Kc(Y,G,!F.dontLimitMoves&&10*X),V.reverse()}return function(D,p,I){return I=typeof I=="boolean"?{dontLimitMoves:I}:I||{},D=D||[],p=p||[],D.length<p.length?S(D,p,"added","deleted",I):S(p,D,"deleted","added",I)}}(),m.b("utils.compareArrays",m.a.Pb),function(){function S(I,O,F,V,G){var j=[],W=m.$(function(){var X=O(F,G,m.a.Ua(j,I))||[];0<j.length&&(m.a.Xc(j,X),V&&m.u.G(V,null,[F,X,G])),j.length=0,m.a.Nb(j,X)},null,{l:I,Sa:function(){return!m.a.kd(j)}});return{Y:j,$:W.ja()?W:e}}var D=m.a.g.Z(),p=m.a.g.Z();m.a.ec=function(I,O,F,V,G,j){function W(et){Ce={Aa:et,pb:m.ta(le++)},ne.push(Ce),Y||ye.push(Ce)}function X(et){Ce=ee[et],le!==Ce.pb.v()&&fe.push(Ce),Ce.pb(le++),m.a.Ua(Ce.Y,I),ne.push(Ce)}function q(et,hn){if(et)for(var ot=0,at=hn.length;ot<at;ot++)m.a.D(hn[ot].Y,function(Xt){et(Xt,ot,hn[ot].Aa)})}O=O||[],typeof O.length>"u"&&(O=[O]),V=V||{};var ee=m.a.g.get(I,D),Y=!ee,ne=[],Q=0,le=0,pe=[],re=[],de=[],fe=[],ye=[],Ce,we=0;if(Y)m.a.D(O,W);else{if(!j||ee&&ee._countWaitingForRemove){var Pe=m.a.Mb(ee,function(et){return et.Aa});j=m.a.Pb(Pe,O,{dontLimitMoves:V.dontLimitMoves,sparse:!0})}for(var Pe=0,lt,ft,We;lt=j[Pe];Pe++)switch(ft=lt.moved,We=lt.index,lt.status){case"deleted":for(;Q<We;)X(Q++);ft===e&&(Ce=ee[Q],Ce.$&&(Ce.$.s(),Ce.$=e),m.a.Ua(Ce.Y,I).length&&(V.beforeRemove&&(ne.push(Ce),we++,Ce.Aa===p?Ce=null:de.push(Ce)),Ce&&pe.push.apply(pe,Ce.Y))),Q++;break;case"added":for(;le<We;)X(Q++);ft!==e?(re.push(ne.length),X(ft)):W(lt.value)}for(;le<O.length;)X(Q++);ne._countWaitingForRemove=we}m.a.g.set(I,D,ne),q(V.beforeMove,fe),m.a.D(pe,V.beforeRemove?m.oa:m.removeNode);var Fe,Dt,st;try{st=I.ownerDocument.activeElement}catch{}if(re.length)for(;(Pe=re.shift())!=e;){for(Ce=ne[Pe],Fe=e;Pe;)if((Dt=ne[--Pe].Y)&&Dt.length){Fe=Dt[Dt.length-1];break}for(O=0;Q=Ce.Y[O];Fe=Q,O++)m.h.Wb(I,Q,Fe)}for(Pe=0;Ce=ne[Pe];Pe++){for(Ce.Y||m.a.extend(Ce,S(I,F,Ce.Aa,G,Ce.pb)),O=0;Q=Ce.Y[O];Fe=Q,O++)m.h.Wb(I,Q,Fe);!Ce.Ed&&G&&(G(Ce.Aa,Ce.Y,Ce.pb),Ce.Ed=!0,Fe=Ce.Y[Ce.Y.length-1])}for(st&&I.ownerDocument.activeElement!=st&&st.focus(),q(V.beforeRemove,de),Pe=0;Pe<de.length;++Pe)de[Pe].Aa=p;q(V.afterMove,fe),q(V.afterAdd,ye)}}(),m.b("utils.setDomNodeChildrenFromArrayMapping",m.a.ec),m.ba=function(){this.allowTemplateRewriting=!1},m.ba.prototype=new m.ca,m.ba.prototype.constructor=m.ba,m.ba.prototype.renderTemplateSource=function(S,D,p,I){return(D=!(9>m.a.W)&&S.nodes?S.nodes():null)?m.a.la(D.cloneNode(!0).childNodes):(S=S.text(),m.a.ua(S,I))},m.ba.Ma=new m.ba,m.gc(m.ba.Ma),m.b("nativeTemplateEngine",m.ba),function(){m.$a=function(){var D=this.Hd=function(){if(!o||!o.tmpl)return 0;try{if(0<=o.tmpl.tag.tmpl.open.toString().indexOf("__"))return 2}catch{}return 1}();this.renderTemplateSource=function(p,I,O,F){if(F=F||n,O=O||{},2>D)throw Error("Your version of jQuery.tmpl is too old. Please upgrade to jQuery.tmpl 1.0.0pre or later.");var V=p.data("precompiled");return V||(V=p.text()||"",V=o.template(null,"{{ko_with $item.koBindingContext}}"+V+"{{/ko_with}}"),p.data("precompiled",V)),p=[I.$data],I=o.extend({koBindingContext:I},O.templateOptions),I=o.tmpl(V,p,I),I.appendTo(F.createElement("div")),o.fragments={},I},this.createJavaScriptEvaluatorBlock=function(p){return"{{ko_code ((function() { return "+p+" })()) }}"},this.addTemplate=function(p,I){n.write("<script type='text/html' id='"+p+"'>"+I+"<\/script>")},0<D&&(o.tmpl.tag.ko_code={open:"__.push($1 || '');"},o.tmpl.tag.ko_with={open:"with($1) {",close:"} "})},m.$a.prototype=new m.ca,m.$a.prototype.constructor=m.$a;var S=new m.$a;0<S.Hd&&m.gc(S),m.b("jqueryTmplTemplateEngine",m.$a)}()})})()})()})();var _Ge=ko;typeof window<"u"?(ko=window.ko,typeof wy<"u"?window.ko=wy:delete window.ko):(ko=global.ko,typeof wy<"u"?global.ko=wy:delete global.ko);const He=_Ge;/**
|
|
* @license
|
|
* Knockout ES5 plugin - https://github.com/SteveSanderson/knockout-es5
|
|
* Copyright (c) Steve Sanderson
|
|
* MIT license
|
|
*/var hP="__knockoutObservables",fP="__knockoutSubscribable";function xq(e,t){if(!e)throw new Error("When calling ko.track, you must pass an object as the first parameter.");var n=this,i=Cq(e,!0);return t=t||Object.getOwnPropertyNames(e),t.forEach(function(o){if(!(o===hP||o===fP)&&!(o in i)){var r=e[o],s=r instanceof Array,a=n.isObservable(r)?r:s?n.observableArray(r):n.observable(r);Object.defineProperty(e,o,{configurable:!0,enumerable:!0,get:a,set:n.isWriteableObservable(a)?a:void 0}),i[o]=a,s&&yGe(n,a)}}),e}function Cq(e,t){var n=e[hP];return!n&&t&&(n={},Object.defineProperty(e,hP,{value:n})),n}function gGe(e,t,n){var i=this,o={owner:e,deferEvaluation:!0};if(typeof n=="function")o.read=n;else{if("value"in n)throw new Error('For ko.defineProperty, you must not specify a "value" for the property. You must provide a "get" function.');if(typeof n.get!="function")throw new Error('For ko.defineProperty, the third parameter must be either an evaluator function, or an options object containing a function called "get".');o.read=n.get,o.write=n.set}return e[t]=i.computed(o),xq.call(i,e,[t]),e}function yGe(e,t){var n=null;e.computed(function(){n&&(n.dispose(),n=null);var i=t();i instanceof Array&&(n=bGe(e,t,i))})}function bGe(e,t,n){var i=TGe(e,n);return i.subscribe(t)}function TGe(e,t){var n=t[fP];if(!n){n=new e.subscribable,Object.defineProperty(t,fP,{value:n});var i={};AGe(t,n,i),xGe(e,t,n,i)}return n}function AGe(e,t,n){["pop","push","reverse","shift","sort","splice","unshift"].forEach(function(i){var o=e[i];e[i]=function(){var r=o.apply(this,arguments);return n.pause!==!0&&t.notifySubscribers(this),r}})}function xGe(e,t,n,i){["remove","removeAll","destroy","destroyAll","replace"].forEach(function(o){Object.defineProperty(t,o,{enumerable:!1,value:function(){var r;i.pause=!0;try{r=e.observableArray.fn[o].apply(e.observableArray(t),arguments)}finally{i.pause=!1}return n.notifySubscribers(t),r}})})}function Eq(e,t){if(!e)return null;var n=Cq(e,!1);return n&&n[t]||null}function CGe(e,t){var n=Eq(e,t);n&&n.valueHasMutated()}function EGe(e){e.track=xq,e.getObservable=Eq,e.valueHasMutated=CGe,e.defineProperty=gGe}const wGe={attachToKo:EGe},jz="http://www.w3.org/2000/svg",Wz="cesium-svgPath-svg",SGe={register:function(e){e.bindingHandlers.cesiumSvgPath={init:function(t,n){const i=document.createElementNS(jz,"svg:svg");i.setAttribute("class",Wz);const o=document.createElementNS(jz,"path");return i.appendChild(o),e.virtualElements.setDomNodeChildren(t,[i]),e.computed({read:function(){const r=e.unwrap(n());o.setAttribute("d",e.unwrap(r.path));const s=e.unwrap(r.width),a=e.unwrap(r.height);i.setAttribute("width",s),i.setAttribute("height",a),i.setAttribute("viewBox",`0 0 ${s} ${a}`),r.css&&i.setAttribute("class",`${Wz} ${e.unwrap(r.css)}`)},disposeWhenNodeIsRemoved:t}),{controlsDescendantBindings:!0}}},e.virtualElements.allowedBindings.cesiumSvgPath=!0}},vGe=SGe;wGe.attachToKo(He);vGe.register(He);function yb(e){c(e)||(e=new tb),this._clock=e,this._eventHelper=new Tu,this._eventHelper.add(e.onTick,this.synchronize,this),this.systemTime=He.observable(ie.now()),this.systemTime.equalityComparer=ie.equals,this.startTime=He.observable(e.startTime),this.startTime.equalityComparer=ie.equals,this.startTime.subscribe(function(t){e.startTime=t,this.synchronize()},this),this.stopTime=He.observable(e.stopTime),this.stopTime.equalityComparer=ie.equals,this.stopTime.subscribe(function(t){e.stopTime=t,this.synchronize()},this),this.currentTime=He.observable(e.currentTime),this.currentTime.equalityComparer=ie.equals,this.currentTime.subscribe(function(t){e.currentTime=t,this.synchronize()},this),this.multiplier=He.observable(e.multiplier),this.multiplier.subscribe(function(t){e.multiplier=t,this.synchronize()},this),this.clockStep=He.observable(e.clockStep),this.clockStep.subscribe(function(t){e.clockStep=t,this.synchronize()},this),this.clockRange=He.observable(e.clockRange),this.clockRange.subscribe(function(t){e.clockRange=t,this.synchronize()},this),this.canAnimate=He.observable(e.canAnimate),this.canAnimate.subscribe(function(t){e.canAnimate=t,this.synchronize()},this),this.shouldAnimate=He.observable(e.shouldAnimate),this.shouldAnimate.subscribe(function(t){e.shouldAnimate=t,this.synchronize()},this),He.track(this,["systemTime","startTime","stopTime","currentTime","multiplier","clockStep","clockRange","canAnimate","shouldAnimate"])}Object.defineProperties(yb.prototype,{clock:{get:function(){return this._clock}}});yb.prototype.synchronize=function(){const e=this._clock;this.systemTime=ie.now(),this.startTime=e.startTime,this.stopTime=e.stopTime,this.currentTime=e.currentTime,this.multiplier=e.multiplier,this.clockStep=e.clockStep,this.clockRange=e.clockRange,this.canAnimate=e.canAnimate,this.shouldAnimate=e.shouldAnimate};yb.prototype.isDestroyed=function(){return!1};yb.prototype.destroy=function(){this._eventHelper.removeAll(),ve(this)};function Sy(e,t){if(!c(e))throw new E("command is required.");this._command=e,t=y(t,y.EMPTY_OBJECT),this.toggled=y(t.toggled,!1),this.tooltip=y(t.tooltip,""),He.track(this,["toggled","tooltip"])}Object.defineProperties(Sy.prototype,{command:{get:function(){return this._command}}});function mo(e,t){if(!c(e))throw new E("func is required.");t=y(t,!0);const n=new Le,i=new Le;function o(){if(!o.canExecute)throw new E("Cannot execute command, canExecute is false.");const r={args:arguments,cancel:!1};let s;return n.raiseEvent(r),r.cancel||(s=e.apply(null,arguments),i.raiseEvent(s)),s}return o.canExecute=t,He.track(o,["canExecute"]),Object.defineProperties(o,{beforeExecute:{value:n},afterExecute:{value:i}}),o}function fc(e,t,n,i,o){return n.call(i,e[t]),He.getObservable(e,t).subscribe(n,i,o)}function wq(e){e=y(e,y.EMPTY_OBJECT);const t=e.globe,n=y(e.imageryProviderViewModels,[]),i=y(e.terrainProviderViewModels,[]);if(!c(t))throw new E("globe is required");this._globe=t,this.imageryProviderViewModels=n.slice(0),this.terrainProviderViewModels=i.slice(0),this.dropDownVisible=!1,He.track(this,["imageryProviderViewModels","terrainProviderViewModels","dropDownVisible"]);const o=He.getObservable(this,"imageryProviderViewModels"),r=He.pureComputed(function(){const f=o(),_={};let g;for(g=0;g<f.length;g++){const T=f[g],x=T.category;c(_[x])?_[x].push(T):_[x]=[T]}const m=Object.keys(_),b=[];for(g=0;g<m.length;g++){const T=m[g];b.push({name:T,providers:_[T]})}return b});this._imageryProviders=r;const s=He.getObservable(this,"terrainProviderViewModels"),a=He.pureComputed(function(){const f=s(),_={};let g;for(g=0;g<f.length;g++){const T=f[g],x=T.category;c(_[x])?_[x].push(T):_[x]=[T]}const m=Object.keys(_),b=[];for(g=0;g<m.length;g++){const T=m[g];b.push({name:T,providers:_[T]})}return b});this._terrainProviders=a,this.buttonTooltip=void 0,He.defineProperty(this,"buttonTooltip",function(){const f=this.selectedImagery,_=this.selectedTerrain,g=c(f)?f.name:void 0,m=c(_)?_.name:void 0;return c(g)&&c(m)?`${g}
|
|
${m}`:c(g)?g:m}),this.buttonImageUrl=void 0,He.defineProperty(this,"buttonImageUrl",function(){const f=this.selectedImagery;if(c(f))return f.iconUrl}),this.selectedImagery=void 0;const l=He.observable();this._currentImageryLayers=[],He.defineProperty(this,"selectedImagery",{get:function(){return l()},set:function(f){if(l()===f){this.dropDownVisible=!1;return}let _;const g=this._currentImageryLayers,m=g.length,b=this._globe.imageryLayers;let T=!1;for(_=0;_<m;_++){const x=b.length;for(let C=0;C<x;C++){const w=b.get(C);if(w===g[_]){b.remove(w),T=!0;break}}}if(c(f)){const x=f.creationCommand();if(Array.isArray(x)){const C=x.length;for(this._currentImageryLayers=[],_=C-1;_>=0;_--){const w=Qt.fromProviderAsync(x[_]);b.add(w,0),this._currentImageryLayers.push(w)}}else{this._currentImageryLayers=[];const C=Qt.fromProviderAsync(x);if(C.name=f.name,T)b.add(C,0);else{const w=b.get(0);c(w)&&b.remove(w),b.add(C,0)}this._currentImageryLayers.push(C)}}l(f),this.dropDownVisible=!1}}),this.selectedTerrain=void 0;const u=He.observable();He.defineProperty(this,"selectedTerrain",{get:function(){return u()},set:function(f){if(u()===f){this.dropDownVisible=!1;return}let _;if(c(f)&&(_=f.creationCommand()),c(_)&&!c(_.then))this._globe.depthTestAgainstTerrain=!(_ instanceof _d),this._globe.terrainProvider=_;else if(c(_)){let g=!1;const m=this._globe.terrainProviderChanged.addEventListener(()=>{g=!0,m()}),T=new U_(_).readyEvent.addEventListener(x=>{g||(this._globe.depthTestAgainstTerrain=!(x instanceof _d),this._globe.terrainProvider=x,T())})}u(f),this.dropDownVisible=!1}});const h=this;this._toggleDropDown=mo(function(){h.dropDownVisible=!h.dropDownVisible}),this.selectedImagery=y(e.selectedImageryProviderViewModel,n[0]),this.selectedTerrain=y(e.selectedTerrainProviderViewModel,i[0])}Object.defineProperties(wq.prototype,{toggleDropDown:{get:function(){return this._toggleDropDown}},globe:{get:function(){return this._globe}}});function gE(e,t){if(!c(e))throw new E("container is required.");e=Do(e);const n=new wq(t),i=document.createElement("button");i.type="button",i.className="cesium-button cesium-toolbar-button",i.setAttribute("data-bind","attr: { title: buttonTooltip },click: toggleDropDown"),e.appendChild(i);const o=document.createElement("img");o.setAttribute("draggable","false"),o.className="cesium-baseLayerPicker-selected",o.setAttribute("data-bind","attr: { src: buttonImageUrl }, visible: !!buttonImageUrl"),i.appendChild(o);const r=document.createElement("div");r.className="cesium-baseLayerPicker-dropDown",r.setAttribute("data-bind",'css: { "cesium-baseLayerPicker-dropDown-visible" : dropDownVisible }'),e.appendChild(r);const s=document.createElement("div");s.className="cesium-baseLayerPicker-sectionTitle",s.setAttribute("data-bind","visible: imageryProviderViewModels.length > 0"),s.innerHTML="Imagery",r.appendChild(s);const a=document.createElement("div");a.className="cesium-baseLayerPicker-section",a.setAttribute("data-bind","foreach: _imageryProviders"),r.appendChild(a);const l=document.createElement("div");l.className="cesium-baseLayerPicker-category",a.appendChild(l);const u=document.createElement("div");u.className="cesium-baseLayerPicker-categoryTitle",u.setAttribute("data-bind","text: name"),l.appendChild(u);const h=document.createElement("div");h.className="cesium-baseLayerPicker-choices",h.setAttribute("data-bind","foreach: providers"),l.appendChild(h);const f=document.createElement("div");f.className="cesium-baseLayerPicker-item",f.setAttribute("data-bind",'css: { "cesium-baseLayerPicker-selectedItem" : $data === $parents[1].selectedImagery },attr: { title: tooltip },visible: creationCommand.canExecute,click: function($data) { $parents[1].selectedImagery = $data; }'),h.appendChild(f);const _=document.createElement("img");_.className="cesium-baseLayerPicker-itemIcon",_.setAttribute("data-bind","attr: { src: iconUrl }"),_.setAttribute("draggable","false"),f.appendChild(_);const g=document.createElement("div");g.className="cesium-baseLayerPicker-itemLabel",g.setAttribute("data-bind","text: name"),f.appendChild(g);const m=document.createElement("div");m.className="cesium-baseLayerPicker-sectionTitle",m.setAttribute("data-bind","visible: terrainProviderViewModels.length > 0"),m.innerHTML="Terrain",r.appendChild(m);const b=document.createElement("div");b.className="cesium-baseLayerPicker-section",b.setAttribute("data-bind","foreach: _terrainProviders"),r.appendChild(b);const T=document.createElement("div");T.className="cesium-baseLayerPicker-category",b.appendChild(T);const x=document.createElement("div");x.className="cesium-baseLayerPicker-categoryTitle",x.setAttribute("data-bind","text: name"),T.appendChild(x);const C=document.createElement("div");C.className="cesium-baseLayerPicker-choices",C.setAttribute("data-bind","foreach: providers"),T.appendChild(C);const w=document.createElement("div");w.className="cesium-baseLayerPicker-item",w.setAttribute("data-bind",'css: { "cesium-baseLayerPicker-selectedItem" : $data === $parents[1].selectedTerrain },attr: { title: tooltip },visible: creationCommand.canExecute,click: function($data) { $parents[1].selectedTerrain = $data; }'),C.appendChild(w);const v=document.createElement("img");v.className="cesium-baseLayerPicker-itemIcon",v.setAttribute("data-bind","attr: { src: iconUrl }"),v.setAttribute("draggable","false"),w.appendChild(v);const P=document.createElement("div");P.className="cesium-baseLayerPicker-itemLabel",P.setAttribute("data-bind","text: name"),w.appendChild(P),He.applyBindings(n,i),He.applyBindings(n,r),this._viewModel=n,this._container=e,this._element=i,this._dropPanel=r,this._closeDropDown=function(N){i.contains(N.target)||r.contains(N.target)||(n.dropDownVisible=!1)},Yt.supportsPointerEvents()?document.addEventListener("pointerdown",this._closeDropDown,!0):(document.addEventListener("mousedown",this._closeDropDown,!0),document.addEventListener("touchstart",this._closeDropDown,!0))}Object.defineProperties(gE.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});gE.prototype.isDestroyed=function(){return!1};gE.prototype.destroy=function(){return Yt.supportsPointerEvents()?document.removeEventListener("pointerdown",this._closeDropDown,!0):(document.removeEventListener("mousedown",this._closeDropDown,!0),document.removeEventListener("touchstart",this._closeDropDown,!0)),He.cleanNode(this._element),He.cleanNode(this._dropPanel),this._container.removeChild(this._element),this._container.removeChild(this._dropPanel),ve(this)};function yr(e){if(!c(e.name))throw new E("options.name is required.");if(!c(e.tooltip))throw new E("options.tooltip is required.");if(!c(e.iconUrl))throw new E("options.iconUrl is required.");if(typeof e.creationFunction!="function")throw new E("options.creationFunction is required.");let t=e.creationFunction;c(t.canExecute)||(t=mo(t)),this._creationCommand=t,this.name=e.name,this.tooltip=e.tooltip,this.iconUrl=e.iconUrl,this._category=y(e.category,""),He.track(this,["name","tooltip","iconUrl"])}Object.defineProperties(yr.prototype,{creationCommand:{get:function(){return this._creationCommand}},category:{get:function(){return this._category}}});function IGe(){const e=[],t=devicePixelRatio>=2;return e.push(new yr({name:"Bing Maps Aerial",iconUrl:Zt("Widgets/Images/ImageryProviders/bingAerial.png"),tooltip:"Bing Maps aerial imagery, provided by Cesium ion",category:"Cesium ion",creationFunction:function(){return nx({style:tx.AERIAL})}})),e.push(new yr({name:"Bing Maps Aerial with Labels",iconUrl:Zt("Widgets/Images/ImageryProviders/bingAerialLabels.png"),tooltip:"Bing Maps aerial imagery with labels, provided by Cesium ion",category:"Cesium ion",creationFunction:function(){return nx({style:tx.AERIAL_WITH_LABELS})}})),e.push(new yr({name:"Bing Maps Roads",iconUrl:Zt("Widgets/Images/ImageryProviders/bingRoads.png"),tooltip:"Bing Maps standard road maps, provided by Cesium ion",category:"Cesium ion",creationFunction:function(){return nx({style:tx.ROAD})}})),e.push(new yr({name:"ArcGIS World Imagery",iconUrl:Zt("Widgets/Images/ImageryProviders/ArcGisMapServiceWorldImagery.png"),tooltip:`ArcGIS World Imagery provides one meter or better satellite and aerial imagery in many parts of the world and lower resolution satellite imagery worldwide. The map includes 15m TerraColor imagery at small and mid-scales (~1:591M down to ~1:288k) for the world. The map features Maxar imagery at 0.3m resolution for select metropolitan areas around the world, 0.5m resolution across the United States and parts of Western Europe, and 1m resolution imagery across the rest of the world. In addition to commercial sources, the World Imagery map features high-resolution aerial photography contributed by the GIS User Community. This imagery ranges from 0.3m to 0.03m resolution (down to ~1:280 nin select communities). For more information on this map, including the terms of use, visit us online at
|
|
https://www.arcgis.com/home/item.html?id=10df2279f9684e4a9f6a7f08febac2a9`,category:"Other",creationFunction:function(){return Oa.fromBasemapType(g_.SATELLITE,{enablePickFeatures:!1})}})),e.push(new yr({name:"ArcGIS World Hillshade",iconUrl:Zt("Widgets/Images/ImageryProviders/ArcGisMapServiceWorldHillshade.png"),tooltip:`ArcGIS World Hillshade map portrays elevation as an artistic hillshade. This map is designed to be used as a backdrop for topographical, soil, hydro, landcover or other outdoor recreational maps. The map was compiled from a variety of sources from several data providers. The basemap has global coverage down to a scale of ~1:72k. In select areas of the United States and Europe, coverage is available down to ~1:9k. For more information on this map, including the terms of use, visit us online at
|
|
https://www.arcgis.com/home/item.html?id=1b243539f4514b6ba35e7d995890db1d`,category:"Other",creationFunction:function(){return Oa.fromBasemapType(g_.HILLSHADE,{enablePickFeatures:!1})}})),e.push(new yr({name:"Esri World Ocean",iconUrl:Zt("Widgets/Images/ImageryProviders/ArcGisMapServiceWorldOcean.png"),tooltip:`ArcGIS World Ocean map is designed to be used as a base map by marine GIS professionals and as a reference map by anyone interested in ocean data. The base map features marine bathymetry. Land features include inland waters and roads overlaid on land cover and shaded relief imagery. The map was compiled from a variety of best available sources from several data providers, including General Bathymetric Chart of the Oceans GEBCO_08 Grid, National Oceanic and Atmospheric Administration (NOAA), and National Geographic, Garmin, HERE, Geonames.org, and Esri, and various other contributors. The base map currently provides coverage for the world down to a scale of ~1:577k, and coverage down to 1:72k in US coastal areas, and various other areas. Coverage down to ~ 1:9k is available limited areas based on regional hydrographic survey data. The base map was designed and developed by Esri. For more information on this map, including our terms of use, visit us online at
|
|
https://www.arcgis.com/home/item.html?id=1e126e7520f9466c9ca28b8f28b5e500`,category:"Other",creationFunction:function(){return Oa.fromBasemapType(g_.OCEANS,{enablePickFeatures:!1})}})),e.push(new yr({name:"Open\xADStreet\xADMap",iconUrl:Zt("Widgets/Images/ImageryProviders/openStreetMap.png"),tooltip:`OpenStreetMap (OSM) is a collaborative project to create a free editable map of the world.
|
|
http://www.openstreetmap.org`,category:"Other",creationFunction:function(){return new ch({url:"https://tile.openstreetmap.org/"})}})),e.push(new yr({name:"Stadia x Stamen Watercolor",iconUrl:Zt("Widgets/Images/ImageryProviders/stamenWatercolor.png"),tooltip:`Based on the original basemaps created for the Knight Foundation and reminiscent of hand drawn maps, the watercolor maps from Stamen Design apply raster effect area washes and organic edges over a paper texture to add warm pop to any map.
|
|
https://docs.stadiamaps.com/map-styles/stamen-watercolor/`,category:"Other",creationFunction:function(){return new ch({url:"https://tiles.stadiamaps.com/tiles/stamen_watercolor/",fileExtension:"jpg",credit:`© <a href="https://stamen.com/" target="_blank">Stamen Design</a>
|
|
© <a href="https://www.stadiamaps.com/" target="_blank">Stadia Maps</a>
|
|
© <a href="https://openmaptiles.org/" target="_blank">OpenMapTiles</a>
|
|
© <a href="https://www.openstreetmap.org/about/" target="_blank">OpenStreetMap contributors</a>`})}})),e.push(new yr({name:"Stadia x Stamen Toner",iconUrl:Zt("Widgets/Images/ImageryProviders/stamenToner.png"),tooltip:`Based on the original basemaps created for the Knight Foundation and the most popular of the excellent styles from Stamen Design, these high-contrast B+W (black and white) maps are the perfect backdrop for your colorful and eye-catching overlays.
|
|
https://docs.stadiamaps.com/map-styles/stamen-toner/`,category:"Other",creationFunction:function(){return new ch({url:"https://tiles.stadiamaps.com/tiles/stamen_toner/",retinaTiles:t,credit:`© <a href="https://stamen.com/" target="_blank">Stamen Design</a>
|
|
© <a href="https://www.stadiamaps.com/" target="_blank">Stadia Maps</a>
|
|
© <a href="https://openmaptiles.org/" target="_blank">OpenMapTiles</a>
|
|
© <a href="https://www.openstreetmap.org/about/" target="_blank">OpenStreetMap contributors</a>`})}})),e.push(new yr({name:"Stadia Alidade Smooth",iconUrl:Zt("Widgets/Images/ImageryProviders/stadiaAlidadeSmooth.png"),tooltip:`Stadia's custom Alidade Smooth style is designed for maps that use a lot of markers or overlays. It features a muted color scheme and fewer points of interest to allow your added data to shine.
|
|
https://docs.stadiamaps.com/map-styles/alidade-smooth/`,category:"Other",creationFunction:function(){return new ch({url:"https://tiles.stadiamaps.com/tiles/alidade_smooth/",retinaTiles:t,credit:`© <a href="https://www.stadiamaps.com/" target="_blank">Stadia Maps</a>
|
|
© <a href="https://openmaptiles.org/" target="_blank">OpenMapTiles</a>
|
|
© <a href="https://www.openstreetmap.org/about/" target="_blank">OpenStreetMap contributors</a>`})}})),e.push(new yr({name:"Stadia Alidade Smooth Dark",iconUrl:Zt("Widgets/Images/ImageryProviders/stadiaAlidadeSmoothDark.png"),tooltip:`Stadia Alidade Smooth Dark, like its lighter cousin, is also designed to stay out of the way. It just flips the dark mode switch on the color scheme. With the lights out, your data can now literally shine.
|
|
https://docs.stadiamaps.com/map-styles/alidade-smooth-dark/`,category:"Other",creationFunction:function(){return new ch({url:"https://tiles.stadiamaps.com/tiles/alidade_smooth_dark/",retinaTiles:t,credit:`© <a href="https://www.stadiamaps.com/" target="_blank">Stadia Maps</a>
|
|
© <a href="https://openmaptiles.org/" target="_blank">OpenMapTiles</a>
|
|
© <a href="https://www.openstreetmap.org/about/" target="_blank">OpenStreetMap contributors</a>`})}})),e.push(new yr({name:"Sentinel-2",iconUrl:Zt("Widgets/Images/ImageryProviders/sentinel-2.png"),tooltip:"Sentinel-2 cloudless by EOX IT Services GmbH (Contains modified Copernicus Sentinel data 2016 and 2017).",category:"Cesium ion",creationFunction:function(){return xa.fromAssetId(3954)}})),e.push(new yr({name:"Blue Marble",iconUrl:Zt("Widgets/Images/ImageryProviders/blueMarble.png"),tooltip:"Blue Marble Next Generation July, 2004 imagery from NASA.",category:"Cesium ion",creationFunction:function(){return xa.fromAssetId(3845)}})),e.push(new yr({name:"Earth at night",iconUrl:Zt("Widgets/Images/ImageryProviders/earthAtNight.png"),tooltip:"The Earth at night, also known as The Black Marble, is a 500 meter resolution global composite imagery layer released by NASA.",category:"Cesium ion",creationFunction:function(){return xa.fromAssetId(3812)}})),e.push(new yr({name:"Natural Earth\xA0II",iconUrl:Zt("Widgets/Images/ImageryProviders/naturalEarthII.png"),tooltip:`Natural Earth II, darkened for contrast.
|
|
http://www.naturalearthdata.com/`,category:"Cesium ion",creationFunction:function(){return ra.fromUrl(Zt("Assets/Textures/NaturalEarthII"))}})),e}function DGe(){const e=[];return e.push(new yr({name:"WGS84 Ellipsoid",iconUrl:Zt("Widgets/Images/TerrainProviders/Ellipsoid.png"),tooltip:"WGS84 standard ellipsoid, also known as EPSG:4326",category:"Cesium ion",creationFunction:function(){return new _d}})),e.push(new yr({name:"Cesium World Terrain",iconUrl:Zt("Widgets/Images/TerrainProviders/CesiumWorldTerrain.png"),tooltip:"High-resolution global terrain tileset curated from several datasources and hosted by Cesium ion",category:"Cesium ion",creationFunction:function(){return mq({requestWaterMask:!0,requestVertexNormals:!0})}})),e}const $f="http://www.w3.org/2000/svg",Sq="http://www.w3.org/1999/xlink";let wA;const uy=z.fromCssColorString("rgba(247,250,255,0.384)"),SA=z.fromCssColorString("rgba(143,191,255,0.216)"),iI=z.fromCssColorString("rgba(153,197,255,0.098)"),vA=z.fromCssColorString("rgba(255,255,255,0.086)"),PGe=z.fromCssColorString("rgba(255,255,255,0.267)"),OGe=z.fromCssColorString("rgba(255,255,255,0)"),qz=z.fromCssColorString("rgba(66,67,68,0.3)"),Yz=z.fromCssColorString("rgba(0,0,0,0.5)");function Kd(e){return z.fromCssColorString(window.getComputedStyle(e).getPropertyValue("color"))}const O0={animation_pathReset:{tagName:"path",transform:"translate(16,16) scale(0.85) translate(-16,-16)",d:"M24.316,5.318,9.833,13.682,9.833,5.5,5.5,5.5,5.5,25.5,9.833,25.5,9.833,17.318,24.316,25.682z"},animation_pathPause:{tagName:"path",transform:"translate(16,16) scale(0.85) translate(-16,-16)",d:"M13,5.5,7.5,5.5,7.5,25.5,13,25.5zM24.5,5.5,19,5.5,19,25.5,24.5,25.5z"},animation_pathPlay:{tagName:"path",transform:"translate(16,16) scale(0.85) translate(-16,-16)",d:"M6.684,25.682L24.316,15.5L6.684,5.318V25.682z"},animation_pathPlayReverse:{tagName:"path",transform:"translate(16,16) scale(-0.85,0.85) translate(-16,-16)",d:"M6.684,25.682L24.316,15.5L6.684,5.318V25.682z"},animation_pathLoop:{tagName:"path",transform:"translate(16,16) scale(0.85) translate(-16,-16)",d:"M24.249,15.499c-0.009,4.832-3.918,8.741-8.75,8.75c-2.515,0-4.768-1.064-6.365-2.763l2.068-1.442l-7.901-3.703l0.744,8.694l2.193-1.529c2.244,2.594,5.562,4.242,9.26,4.242c6.767,0,12.249-5.482,12.249-12.249H24.249zM15.499,6.75c2.516,0,4.769,1.065,6.367,2.764l-2.068,1.443l7.901,3.701l-0.746-8.693l-2.192,1.529c-2.245-2.594-5.562-4.245-9.262-4.245C8.734,3.25,3.25,8.734,3.249,15.499H6.75C6.758,10.668,10.668,6.758,15.499,6.75z"},animation_pathClock:{tagName:"path",transform:"translate(16,16) scale(0.85) translate(-16,-15.5)",d:"M15.5,2.374C8.251,2.375,2.376,8.251,2.374,15.5C2.376,22.748,8.251,28.623,15.5,28.627c7.249-0.004,13.124-5.879,13.125-13.127C28.624,8.251,22.749,2.375,15.5,2.374zM15.5,25.623C9.909,25.615,5.385,21.09,5.375,15.5C5.385,9.909,9.909,5.384,15.5,5.374c5.59,0.01,10.115,4.535,10.124,10.125C25.615,21.09,21.091,25.615,15.5,25.623zM8.625,15.5c-0.001-0.552-0.448-0.999-1.001-1c-0.553,0-1,0.448-1,1c0,0.553,0.449,1,1,1C8.176,16.5,8.624,16.053,8.625,15.5zM8.179,18.572c-0.478,0.277-0.642,0.889-0.365,1.367c0.275,0.479,0.889,0.641,1.365,0.365c0.479-0.275,0.643-0.887,0.367-1.367C9.27,18.461,8.658,18.297,8.179,18.572zM9.18,10.696c-0.479-0.276-1.09-0.112-1.366,0.366s-0.111,1.09,0.365,1.366c0.479,0.276,1.09,0.113,1.367-0.366C9.821,11.584,9.657,10.973,9.18,10.696zM22.822,12.428c0.478-0.275,0.643-0.888,0.366-1.366c-0.275-0.478-0.89-0.642-1.366-0.366c-0.479,0.278-0.642,0.89-0.366,1.367C21.732,12.54,22.344,12.705,22.822,12.428zM12.062,21.455c-0.478-0.275-1.089-0.111-1.366,0.367c-0.275,0.479-0.111,1.09,0.366,1.365c0.478,0.277,1.091,0.111,1.365-0.365C12.704,22.344,12.54,21.732,12.062,21.455zM12.062,9.545c0.479-0.276,0.642-0.888,0.366-1.366c-0.276-0.478-0.888-0.642-1.366-0.366s-0.642,0.888-0.366,1.366C10.973,9.658,11.584,9.822,12.062,9.545zM22.823,18.572c-0.48-0.275-1.092-0.111-1.367,0.365c-0.275,0.479-0.112,1.092,0.367,1.367c0.477,0.275,1.089,0.113,1.365-0.365C23.464,19.461,23.3,18.848,22.823,18.572zM19.938,7.813c-0.477-0.276-1.091-0.111-1.365,0.366c-0.275,0.48-0.111,1.091,0.366,1.367s1.089,0.112,1.366-0.366C20.581,8.702,20.418,8.089,19.938,7.813zM23.378,14.5c-0.554,0.002-1.001,0.45-1.001,1c0.001,0.552,0.448,1,1.001,1c0.551,0,1-0.447,1-1C24.378,14.949,23.929,14.5,23.378,14.5zM15.501,6.624c-0.552,0-1,0.448-1,1l-0.466,7.343l-3.004,1.96c-0.478,0.277-0.642,0.889-0.365,1.365c0.275,0.479,0.889,0.643,1.365,0.367l3.305-1.676C15.39,16.99,15.444,17,15.501,17c0.828,0,1.5-0.671,1.5-1.5l-0.5-7.876C16.501,7.072,16.053,6.624,15.501,6.624zM15.501,22.377c-0.552,0-1,0.447-1,1s0.448,1,1,1s1-0.447,1-1S16.053,22.377,15.501,22.377zM18.939,21.455c-0.479,0.277-0.643,0.889-0.366,1.367c0.275,0.477,0.888,0.643,1.366,0.365c0.478-0.275,0.642-0.889,0.366-1.365C20.028,21.344,19.417,21.18,18.939,21.455z"},animation_pathWingButton:{tagName:"path",d:"m 4.5,0.5 c -2.216,0 -4,1.784 -4,4 l 0,24 c 0,2.216 1.784,4 4,4 l 13.71875,0 C 22.478584,27.272785 27.273681,22.511272 32.5,18.25 l 0,-13.75 c 0,-2.216 -1.784,-4 -4,-4 l -24,0 z"},animation_pathPointer:{tagName:"path",d:"M-15,-65,-15,-55,15,-55,15,-65,0,-95z"},animation_pathSwooshFX:{tagName:"path",d:"m 85,0 c 0,16.617 -4.813944,35.356 -13.131081,48.4508 h 6.099803 c 8.317138,-13.0948 13.13322,-28.5955 13.13322,-45.2124 0,-46.94483 -38.402714,-85.00262 -85.7743869,-85.00262 -1.0218522,0 -2.0373001,0.0241 -3.0506131,0.0589 45.958443,1.59437 82.723058,35.77285 82.723058,81.70532 z"}};function rl(e){const t=document.createElementNS($f,e.tagName);for(const n in e)if(e.hasOwnProperty(n)&&n!=="tagName")if(n==="children"){const i=e.children.length;for(let o=0;o<i;++o)t.appendChild(rl(e.children[o]))}else n.indexOf("xlink:")===0?t.setAttributeNS(Sq,n.substring(6),e[n]):n==="textContent"?t.textContent=e[n]:t.setAttribute(n,e[n]);return t}function oI(e,t,n){const i=document.createElementNS($f,"text");i.setAttribute("x",e),i.setAttribute("y",t),i.setAttribute("class","cesium-animation-svgText");const o=document.createElementNS($f,"tspan");return o.textContent=n,i.appendChild(o),i}function LGe(e,t,n){e.setAttribute("transform",`translate(100,100) rotate(${n})`),t.setAttribute("transform",`rotate(${n})`)}const IA=new z;function po(e,t){const n=t.alpha,i=1-n;return IA.red=e.red*i+t.red*n,IA.green=e.green*i+t.green*n,IA.blue=e.blue*i+t.blue*n,IA.toCssColorString()}function rI(e,t,n){const i=O0[n],o={tagName:"g",class:"cesium-animation-rectButton",transform:`translate(${e},${t})`,children:[{tagName:"rect",class:"cesium-animation-buttonGlow",width:32,height:32,rx:2,ry:2},{tagName:"rect",class:"cesium-animation-buttonMain",width:32,height:32,rx:4,ry:4},{class:"cesium-animation-buttonPath",id:n,tagName:i.tagName,transform:i.transform,d:i.d},{tagName:"title",textContent:""}]};return rl(o)}function RGe(e,t,n){const i=O0[n],o=O0.animation_pathWingButton,r={tagName:"g",class:"cesium-animation-rectButton",transform:`translate(${e},${t})`,children:[{class:"cesium-animation-buttonGlow",id:"animation_pathWingButton",tagName:o.tagName,d:o.d},{class:"cesium-animation-buttonMain",id:"animation_pathWingButton",tagName:o.tagName,d:o.d},{class:"cesium-animation-buttonPath",id:n,tagName:i.tagName,transform:i.transform,d:i.d},{tagName:"title",textContent:""}]};return rl(r)}function NGe(e,t){const n=e._viewModel,i=n.shuttleRingDragging;if(!(i&&wA!==e))if(t.type==="mousedown"||i&&t.type==="mousemove"||t.type==="touchstart"&&t.touches.length===1||i&&t.type==="touchmove"&&t.touches.length===1){const o=e._centerX,r=e._centerY,a=e._svgNode.getBoundingClientRect();let l,u;if(t.type==="touchstart"||t.type==="touchmove"?(l=t.touches[0].clientX,u=t.touches[0].clientY):(l=t.clientX,u=t.clientY),!i&&(l>a.right||l<a.left||u<a.top||u>a.bottom))return;const h=e._shuttleRingPointer.getBoundingClientRect(),f=l-o-a.left,_=u-r-a.top;let g=Math.atan2(_,f)*180/Math.PI+90;g>180&&(g-=360);const m=n.shuttleRingAngle;i||l<h.right&&l>h.left&&u>h.top&&u<h.bottom?(wA=e,n.shuttleRingDragging=!0,n.shuttleRingAngle=g):g<m?n.slower():g>m&&n.faster(),t.preventDefault()}else e===wA&&(wA=void 0),n.shuttleRingDragging=!1}function Xu(e,t){this._viewModel=t,this.svgElement=e,this._enabled=void 0,this._toggled=void 0;const n=this;this._clickFunction=function(){const i=n._viewModel.command;i.canExecute&&i()},e.addEventListener("click",this._clickFunction,!0),this._subscriptions=[fc(t,"toggled",this.setToggled,this),fc(t,"tooltip",this.setTooltip,this),fc(t.command,"canExecute",this.setEnabled,this)]}Xu.prototype.destroy=function(){this.svgElement.removeEventListener("click",this._clickFunction,!0);const e=this._subscriptions;for(let t=0,n=e.length;t<n;t++)e[t].dispose();ve(this)};Xu.prototype.isDestroyed=function(){return!1};Xu.prototype.setEnabled=function(e){if(this._enabled!==e){if(this._enabled=e,!e){this.svgElement.setAttribute("class","cesium-animation-buttonDisabled");return}if(this._toggled){this.svgElement.setAttribute("class","cesium-animation-rectButton cesium-animation-buttonToggled");return}this.svgElement.setAttribute("class","cesium-animation-rectButton")}};Xu.prototype.setToggled=function(e){this._toggled!==e&&(this._toggled=e,this._enabled&&(e?this.svgElement.setAttribute("class","cesium-animation-rectButton cesium-animation-buttonToggled"):this.svgElement.setAttribute("class","cesium-animation-rectButton")))};Xu.prototype.setTooltip=function(e){this.svgElement.getElementsByTagName("title")[0].textContent=e};function lg(e,t){if(!c(e))throw new E("container is required.");if(!c(t))throw new E("viewModel is required.");e=Do(e),this._viewModel=t,this._container=e,this._centerX=0,this._centerY=0,this._defsElement=void 0,this._svgNode=void 0,this._topG=void 0,this._lastHeight=void 0,this._lastWidth=void 0;const n=e.ownerDocument,i=document.createElement("style");i.textContent=".cesium-animation-rectButton .cesium-animation-buttonGlow { filter: url(#animation_blurred); }.cesium-animation-rectButton .cesium-animation-buttonMain { fill: url(#animation_buttonNormal); }.cesium-animation-buttonToggled .cesium-animation-buttonMain { fill: url(#animation_buttonToggled); }.cesium-animation-rectButton:hover .cesium-animation-buttonMain { fill: url(#animation_buttonHovered); }.cesium-animation-buttonDisabled .cesium-animation-buttonMain { fill: url(#animation_buttonDisabled); }.cesium-animation-shuttleRingG .cesium-animation-shuttleRingSwoosh { fill: url(#animation_shuttleRingSwooshGradient); }.cesium-animation-shuttleRingG:hover .cesium-animation-shuttleRingSwoosh { fill: url(#animation_shuttleRingSwooshHovered); }.cesium-animation-shuttleRingPointer { fill: url(#animation_shuttleRingPointerGradient); }.cesium-animation-shuttleRingPausePointer { fill: url(#animation_shuttleRingPointerPaused); }.cesium-animation-knobOuter { fill: url(#animation_knobOuter); }.cesium-animation-knobInner { fill: url(#animation_knobInner); }",n.head.insertBefore(i,n.head.childNodes[0]);const o=document.createElement("div");o.className="cesium-animation-theme",o.innerHTML='<div class="cesium-animation-themeNormal"></div><div class="cesium-animation-themeHover"></div><div class="cesium-animation-themeSelect"></div><div class="cesium-animation-themeDisabled"></div><div class="cesium-animation-themeKnob"></div><div class="cesium-animation-themePointer"></div><div class="cesium-animation-themeSwoosh"></div><div class="cesium-animation-themeSwooshHover"></div>',this._theme=o,this._themeNormal=o.childNodes[0],this._themeHover=o.childNodes[1],this._themeSelect=o.childNodes[2],this._themeDisabled=o.childNodes[3],this._themeKnob=o.childNodes[4],this._themePointer=o.childNodes[5],this._themeSwoosh=o.childNodes[6],this._themeSwooshHover=o.childNodes[7];const r=document.createElementNS($f,"svg:svg");this._svgNode=r,r.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink",Sq);const s=document.createElementNS($f,"g");this._topG=s,this._realtimeSVG=new Xu(RGe(3,4,"animation_pathClock"),t.playRealtimeViewModel),this._playReverseSVG=new Xu(rI(44,99,"animation_pathPlayReverse"),t.playReverseViewModel),this._playForwardSVG=new Xu(rI(124,99,"animation_pathPlay"),t.playForwardViewModel),this._pauseSVG=new Xu(rI(84,99,"animation_pathPause"),t.pauseViewModel);const a=document.createElementNS($f,"g");a.appendChild(this._realtimeSVG.svgElement),a.appendChild(this._playReverseSVG.svgElement),a.appendChild(this._playForwardSVG.svgElement),a.appendChild(this._pauseSVG.svgElement);const l=rl({tagName:"circle",class:"cesium-animation-shuttleRingBack",cx:100,cy:100,r:99});this._shuttleRingBackPanel=l;const u=O0.animation_pathSwooshFX,h=O0.animation_pathPointer,f=rl({tagName:"g",class:"cesium-animation-shuttleRingSwoosh",children:[{tagName:u.tagName,transform:"translate(100,97) scale(-1,1)",id:"animation_pathSwooshFX",d:u.d},{tagName:u.tagName,transform:"translate(100,97)",id:"animation_pathSwooshFX",d:u.d},{tagName:"line",x1:100,y1:8,x2:100,y2:22}]});this._shuttleRingSwooshG=f,this._shuttleRingPointer=rl({class:"cesium-animation-shuttleRingPointer",id:"animation_pathPointer",tagName:h.tagName,d:h.d});const _=rl({tagName:"g",transform:"translate(100,100)"});this._knobOuter=rl({tagName:"circle",class:"cesium-animation-knobOuter",cx:0,cy:0,r:71});const g=61,m=rl({tagName:"circle",class:"cesium-animation-knobInner",cx:0,cy:0,r:g});this._knobDate=oI(0,-24,""),this._knobTime=oI(0,-7,""),this._knobStatus=oI(0,-41,"");const b=rl({tagName:"circle",class:"cesium-animation-blank",cx:0,cy:0,r:g}),T=document.createElementNS($f,"g");T.setAttribute("class","cesium-animation-shuttleRingG"),e.appendChild(o),s.appendChild(T),s.appendChild(_),s.appendChild(a),T.appendChild(l),T.appendChild(f),T.appendChild(this._shuttleRingPointer),_.appendChild(this._knobOuter),_.appendChild(m),_.appendChild(this._knobDate),_.appendChild(this._knobTime),_.appendChild(this._knobStatus),_.appendChild(b),r.appendChild(s),e.appendChild(r);const x=this;function C(k){NGe(x,k)}this._mouseCallback=C,l.addEventListener("mousedown",C,!0),l.addEventListener("touchstart",C,!0),f.addEventListener("mousedown",C,!0),f.addEventListener("touchstart",C,!0),n.addEventListener("mousemove",C,!0),n.addEventListener("touchmove",C,!0),n.addEventListener("mouseup",C,!0),n.addEventListener("touchend",C,!0),n.addEventListener("touchcancel",C,!0),this._shuttleRingPointer.addEventListener("mousedown",C,!0),this._shuttleRingPointer.addEventListener("touchstart",C,!0),this._knobOuter.addEventListener("mousedown",C,!0),this._knobOuter.addEventListener("touchstart",C,!0);const w=this._knobTime.childNodes[0],v=this._knobDate.childNodes[0],P=this._knobStatus.childNodes[0];let N;this._subscriptions=[fc(t.pauseViewModel,"toggled",function(k){N!==k&&(N=k,N?x._shuttleRingPointer.setAttribute("class","cesium-animation-shuttleRingPausePointer"):x._shuttleRingPointer.setAttribute("class","cesium-animation-shuttleRingPointer"))}),fc(t,"shuttleRingAngle",function(k){LGe(x._shuttleRingPointer,x._knobOuter,k)}),fc(t,"dateLabel",function(k){v.textContent!==k&&(v.textContent=k)}),fc(t,"timeLabel",function(k){w.textContent!==k&&(w.textContent=k)}),fc(t,"multiplierLabel",function(k){P.textContent!==k&&(P.textContent=k)})],this.applyThemeChanges(),this.resize()}Object.defineProperties(lg.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});lg.prototype.isDestroyed=function(){return!1};lg.prototype.destroy=function(){c(this._observer)&&(this._observer.disconnect(),this._observer=void 0);const e=this._container.ownerDocument,t=this._mouseCallback;this._shuttleRingBackPanel.removeEventListener("mousedown",t,!0),this._shuttleRingBackPanel.removeEventListener("touchstart",t,!0),this._shuttleRingSwooshG.removeEventListener("mousedown",t,!0),this._shuttleRingSwooshG.removeEventListener("touchstart",t,!0),e.removeEventListener("mousemove",t,!0),e.removeEventListener("touchmove",t,!0),e.removeEventListener("mouseup",t,!0),e.removeEventListener("touchend",t,!0),e.removeEventListener("touchcancel",t,!0),this._shuttleRingPointer.removeEventListener("mousedown",t,!0),this._shuttleRingPointer.removeEventListener("touchstart",t,!0),this._knobOuter.removeEventListener("mousedown",t,!0),this._knobOuter.removeEventListener("touchstart",t,!0),this._container.removeChild(this._svgNode),this._container.removeChild(this._theme),this._realtimeSVG.destroy(),this._playReverseSVG.destroy(),this._playForwardSVG.destroy(),this._pauseSVG.destroy();const n=this._subscriptions;for(let i=0,o=n.length;i<o;i++)n[i].dispose();return ve(this)};lg.prototype.resize=function(){const e=this._container.clientWidth,t=this._container.clientHeight;if(e===this._lastWidth&&t===this._lastHeight)return;const n=this._svgNode,i=200,o=132;let r=e,s=t;e===0&&t===0?(r=i,s=o):e===0?(s=t,r=i*(t/o)):t===0&&(r=e,s=o*(e/i));const a=r/i,l=s/o;n.style.cssText=`width: ${r}px; height: ${s}px; position: absolute; bottom: 0; left: 0; overflow: hidden;`,n.setAttribute("width",r),n.setAttribute("height",s),n.setAttribute("viewBox",`0 0 ${r} ${s}`),this._topG.setAttribute("transform",`scale(${a},${l})`),this._centerX=Math.max(1,100*a),this._centerY=Math.max(1,100*l),this._lastHeight=e,this._lastWidth=t};lg.prototype.applyThemeChanges=function(){const e=this._container.ownerDocument;if(!e.body.contains(this._container)){if(c(this._observer))return;const h=this;h._observer=new MutationObserver(function(){e.body.contains(h._container)&&(h._observer.disconnect(),h._observer=void 0,h.applyThemeChanges())}),h._observer.observe(e,{childList:!0,subtree:!0});return}const t=Kd(this._themeNormal),n=Kd(this._themeHover),i=Kd(this._themeSelect),o=Kd(this._themeDisabled),r=Kd(this._themeKnob),s=Kd(this._themePointer),a=Kd(this._themeSwoosh),l=Kd(this._themeSwooshHover),u=rl({tagName:"defs",children:[{id:"animation_buttonNormal",tagName:"linearGradient",x1:"50%",y1:"0%",x2:"50%",y2:"100%",children:[{tagName:"stop",offset:"0%","stop-color":po(t,uy)},{tagName:"stop",offset:"12%","stop-color":po(t,SA)},{tagName:"stop",offset:"46%","stop-color":po(t,iI)},{tagName:"stop",offset:"81%","stop-color":po(t,vA)}]},{id:"animation_buttonHovered",tagName:"linearGradient",x1:"50%",y1:"0%",x2:"50%",y2:"100%",children:[{tagName:"stop",offset:"0%","stop-color":po(n,uy)},{tagName:"stop",offset:"12%","stop-color":po(n,SA)},{tagName:"stop",offset:"46%","stop-color":po(n,iI)},{tagName:"stop",offset:"81%","stop-color":po(n,vA)}]},{id:"animation_buttonToggled",tagName:"linearGradient",x1:"50%",y1:"0%",x2:"50%",y2:"100%",children:[{tagName:"stop",offset:"0%","stop-color":po(i,uy)},{tagName:"stop",offset:"12%","stop-color":po(i,SA)},{tagName:"stop",offset:"46%","stop-color":po(i,iI)},{tagName:"stop",offset:"81%","stop-color":po(i,vA)}]},{id:"animation_buttonDisabled",tagName:"linearGradient",x1:"50%",y1:"0%",x2:"50%",y2:"100%",children:[{tagName:"stop",offset:"0%","stop-color":po(o,PGe)},{tagName:"stop",offset:"75%","stop-color":po(o,OGe)}]},{id:"animation_blurred",tagName:"filter",width:"200%",height:"200%",x:"-50%",y:"-50%",children:[{tagName:"feGaussianBlur",stdDeviation:4,in:"SourceGraphic"}]},{id:"animation_shuttleRingSwooshGradient",tagName:"linearGradient",x1:"50%",y1:"0%",x2:"50%",y2:"100%",children:[{tagName:"stop",offset:"0%","stop-opacity":.2,"stop-color":a.toCssColorString()},{tagName:"stop",offset:"85%","stop-opacity":.85,"stop-color":a.toCssColorString()},{tagName:"stop",offset:"95%","stop-opacity":.05,"stop-color":a.toCssColorString()}]},{id:"animation_shuttleRingSwooshHovered",tagName:"linearGradient",x1:"50%",y1:"0%",x2:"50%",y2:"100%",children:[{tagName:"stop",offset:"0%","stop-opacity":.2,"stop-color":l.toCssColorString()},{tagName:"stop",offset:"85%","stop-opacity":.85,"stop-color":l.toCssColorString()},{tagName:"stop",offset:"95%","stop-opacity":.05,"stop-color":l.toCssColorString()}]},{id:"animation_shuttleRingPointerGradient",tagName:"linearGradient",x1:"0%",y1:"50%",x2:"100%",y2:"50%",children:[{tagName:"stop",offset:"0%","stop-color":s.toCssColorString()},{tagName:"stop",offset:"40%","stop-color":s.toCssColorString()},{tagName:"stop",offset:"60%","stop-color":po(s,Yz)},{tagName:"stop",offset:"100%","stop-color":po(s,Yz)}]},{id:"animation_shuttleRingPointerPaused",tagName:"linearGradient",x1:"0%",y1:"50%",x2:"100%",y2:"50%",children:[{tagName:"stop",offset:"0%","stop-color":"#CCC"},{tagName:"stop",offset:"40%","stop-color":"#CCC"},{tagName:"stop",offset:"60%","stop-color":"#555"},{tagName:"stop",offset:"100%","stop-color":"#555"}]},{id:"animation_knobOuter",tagName:"linearGradient",x1:"20%",y1:"0%",x2:"90%",y2:"100%",children:[{tagName:"stop",offset:"5%","stop-color":po(r,uy)},{tagName:"stop",offset:"60%","stop-color":po(r,qz)},{tagName:"stop",offset:"85%","stop-color":po(r,SA)}]},{id:"animation_knobInner",tagName:"linearGradient",x1:"20%",y1:"0%",x2:"90%",y2:"100%",children:[{tagName:"stop",offset:"5%","stop-color":po(r,qz)},{tagName:"stop",offset:"60%","stop-color":po(r,uy)},{tagName:"stop",offset:"85%","stop-color":po(r,vA)}]}]});c(this._defsElement)?this._svgNode.replaceChild(u,this._defsElement):this._svgNode.appendChild(u),this._defsElement=u};const MGe=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],vh=15,T_=105;function vq(e,t){return e-t}function sI(e,t){const n=Hr(t,e,vq);return n<0?~n:n}function FGe(e,t){if(Math.abs(e)<=vh)return e/vh;const n=vh,i=T_;let o;const r=0;let s;return e>0?(o=Math.log(t[t.length-1]),s=(o-r)/(i-n),Math.exp(r+s*(e-n))):(o=Math.log(-t[0]),s=(o-r)/(i-n),-Math.exp(r+s*(Math.abs(e)-n)))}function BGe(e,t,n){if(n.clockStep===as.SYSTEM_CLOCK)return vh;if(Math.abs(e)<=1)return e*vh;const i=t[t.length-1];e>i?e=i:e<-i&&(e=-i);const o=vh,r=T_;let s;const a=0;let l;return e>0?(s=Math.log(i),l=(s-a)/(r-o),(Math.log(e)-a)/l+o):(s=Math.log(-t[0]),l=(s-a)/(r-o),-((Math.log(Math.abs(e))-a)/l+o))}function xc(e){if(!c(e))throw new E("clockViewModel is required.");const t=this;this._clockViewModel=e,this._allShuttleRingTicks=[],this._dateFormatter=xc.defaultDateFormatter,this._timeFormatter=xc.defaultTimeFormatter,this.shuttleRingDragging=!1,this.snapToTicks=!1,He.track(this,["_allShuttleRingTicks","_dateFormatter","_timeFormatter","shuttleRingDragging","snapToTicks"]),this._sortedFilteredPositiveTicks=[],this.setShuttleRingTicks(xc.defaultTicks),this.timeLabel=void 0,He.defineProperty(this,"timeLabel",function(){return t._timeFormatter(t._clockViewModel.currentTime,t)}),this.dateLabel=void 0,He.defineProperty(this,"dateLabel",function(){return t._dateFormatter(t._clockViewModel.currentTime,t)}),this.multiplierLabel=void 0,He.defineProperty(this,"multiplierLabel",function(){const s=t._clockViewModel;if(s.clockStep===as.SYSTEM_CLOCK)return"Today";const a=s.multiplier;return a%1===0?`${a.toFixed(0)}x`:`${a.toFixed(3).replace(/0{0,3}$/,"")}x`}),this.shuttleRingAngle=void 0,He.defineProperty(this,"shuttleRingAngle",{get:function(){return BGe(e.multiplier,t._allShuttleRingTicks,e)},set:function(s){s=Math.max(Math.min(s,T_),-T_);const a=t._allShuttleRingTicks,l=t._clockViewModel;if(l.clockStep=as.SYSTEM_CLOCK_MULTIPLIER,Math.abs(s)===T_){l.multiplier=s>0?a[a.length-1]:a[0];return}let u=FGe(s,a);if(t.snapToTicks)u=a[sI(u,a)];else if(u!==0){const h=Math.abs(u);if(h>100){const f=h.toFixed(0).length-2,_=Math.pow(10,f);u=Math.round(u/_)*_|0}else h>vh?u=Math.round(u):h>1?u=+u.toFixed(1):h>0&&(u=+u.toFixed(2))}l.multiplier=u}}),this._canAnimate=void 0,He.defineProperty(this,"_canAnimate",function(){const s=t._clockViewModel,a=s.clockRange;if(t.shuttleRingDragging||a===rp.UNBOUNDED)return!0;const l=s.multiplier,u=s.currentTime,h=s.startTime;let f=!1;if(a===rp.LOOP_STOP)f=ie.greaterThan(u,h)||u.equals(h)&&l>0;else{const _=s.stopTime;f=ie.greaterThan(u,h)&&ie.lessThan(u,_)||u.equals(h)&&l>0||u.equals(_)&&l<0}return f||(s.shouldAnimate=!1),f}),this._isSystemTimeAvailable=void 0,He.defineProperty(this,"_isSystemTimeAvailable",function(){const s=t._clockViewModel;if(s.clockRange===rp.UNBOUNDED)return!0;const l=s.systemTime;return ie.greaterThanOrEquals(l,s.startTime)&&ie.lessThanOrEquals(l,s.stopTime)}),this._isAnimating=void 0,He.defineProperty(this,"_isAnimating",function(){return t._clockViewModel.shouldAnimate&&(t._canAnimate||t.shuttleRingDragging)});const n=mo(function(){const s=t._clockViewModel;s.shouldAnimate?s.shouldAnimate=!1:t._canAnimate&&(s.shouldAnimate=!0)});this._pauseViewModel=new Sy(n,{toggled:He.computed(function(){return!t._isAnimating}),tooltip:"Pause"});const i=mo(function(){const s=t._clockViewModel,a=s.multiplier;a>0&&(s.multiplier=-a),s.shouldAnimate=!0});this._playReverseViewModel=new Sy(i,{toggled:He.computed(function(){return t._isAnimating&&e.multiplier<0}),tooltip:"Play Reverse"});const o=mo(function(){const s=t._clockViewModel,a=s.multiplier;a<0&&(s.multiplier=-a),s.shouldAnimate=!0});this._playForwardViewModel=new Sy(o,{toggled:He.computed(function(){return t._isAnimating&&e.multiplier>0&&e.clockStep!==as.SYSTEM_CLOCK}),tooltip:"Play Forward"});const r=mo(function(){t._clockViewModel.clockStep=as.SYSTEM_CLOCK},He.getObservable(this,"_isSystemTimeAvailable"));this._playRealtimeViewModel=new Sy(r,{toggled:He.computed(function(){return e.clockStep===as.SYSTEM_CLOCK}),tooltip:He.computed(function(){return t._isSystemTimeAvailable?"Today (real-time)":"Current time not in range"})}),this._slower=mo(function(){const s=t._clockViewModel,a=t._allShuttleRingTicks,l=s.multiplier,u=sI(l,a)-1;u>=0&&(s.multiplier=a[u])}),this._faster=mo(function(){const s=t._clockViewModel,a=t._allShuttleRingTicks,l=s.multiplier,u=sI(l,a)+1;u<a.length&&(s.multiplier=a[u])})}xc.defaultDateFormatter=function(e,t){const n=ie.toGregorianDate(e);return`${MGe[n.month-1]} ${n.day} ${n.year}`};xc.defaultTicks=[.001,.002,.005,.01,.02,.05,.1,.25,.5,1,2,5,10,15,30,60,120,300,600,900,1800,3600,7200,14400,21600,43200,86400,172800,345600,604800];xc.defaultTimeFormatter=function(e,t){const n=ie.toGregorianDate(e),i=Math.round(n.millisecond);return Math.abs(t._clockViewModel.multiplier)<1?`${n.hour.toString().padStart(2,"0")}:${n.minute.toString().padStart(2,"0")}:${n.second.toString().padStart(2,"0")}.${i.toString().padStart(3,"0")}`:`${n.hour.toString().padStart(2,"0")}:${n.minute.toString().padStart(2,"0")}:${n.second.toString().padStart(2,"0")} UTC`};xc.prototype.getShuttleRingTicks=function(){return this._sortedFilteredPositiveTicks.slice(0)};xc.prototype.setShuttleRingTicks=function(e){if(!c(e))throw new E("positiveTicks is required.");let t,n,i;const o={},r=this._sortedFilteredPositiveTicks;for(r.length=0,t=0,n=e.length;t<n;++t)i=e[t],o.hasOwnProperty(i)||(o[i]=!0,r.push(i));r.sort(vq);const s=[];for(n=r.length,t=n-1;t>=0;--t)i=r[t],i!==0&&s.push(-i);Array.prototype.push.apply(s,r),this._allShuttleRingTicks=s};Object.defineProperties(xc.prototype,{slower:{get:function(){return this._slower}},faster:{get:function(){return this._faster}},clockViewModel:{get:function(){return this._clockViewModel}},pauseViewModel:{get:function(){return this._pauseViewModel}},playReverseViewModel:{get:function(){return this._playReverseViewModel}},playForwardViewModel:{get:function(){return this._playForwardViewModel}},playRealtimeViewModel:{get:function(){return this._playRealtimeViewModel}},dateFormatter:{get:function(){return this._dateFormatter},set:function(e){if(typeof e!="function")throw new E("dateFormatter must be a function");this._dateFormatter=e}},timeFormatter:{get:function(){return this._timeFormatter},set:function(e){if(typeof e!="function")throw new E("timeFormatter must be a function");this._timeFormatter=e}}});xc._maxShuttleRingAngle=T_;xc._realtimeShuttleRingAngle=vh;function yE(e,t){c(t)||(t=document.body),t=Do(t);const n=this,i=He.observable(Tr.fullscreen),o=He.observable(Tr.enabled),r=t.ownerDocument;this.isFullscreen=void 0,He.defineProperty(this,"isFullscreen",{get:function(){return i()}}),this.isFullscreenEnabled=void 0,He.defineProperty(this,"isFullscreenEnabled",{get:function(){return o()},set:function(s){o(s&&Tr.enabled)}}),this.tooltip=void 0,He.defineProperty(this,"tooltip",function(){return this.isFullscreenEnabled?i()?"Exit full screen":"Full screen":"Full screen unavailable"}),this._command=mo(function(){Tr.fullscreen?Tr.exitFullscreen():Tr.requestFullscreen(n._fullscreenElement)},He.getObservable(this,"isFullscreenEnabled")),this._fullscreenElement=y(Do(e),r.body),this._callback=function(){i(Tr.fullscreen)},r.addEventListener(Tr.changeEventName,this._callback)}Object.defineProperties(yE.prototype,{fullscreenElement:{get:function(){return this._fullscreenElement},set:function(e){if(!(e instanceof Element))throw new E("value must be a valid Element.");this._fullscreenElement=e}},command:{get:function(){return this._command}}});yE.prototype.isDestroyed=function(){return!1};yE.prototype.destroy=function(){document.removeEventListener(Tr.changeEventName,this._callback),ve(this)};const zGe="M 83.96875 17.5625 L 83.96875 17.59375 L 76.65625 24.875 L 97.09375 24.96875 L 76.09375 45.96875 L 81.9375 51.8125 L 102.78125 30.9375 L 102.875 51.15625 L 110.15625 43.875 L 110.1875 17.59375 L 83.96875 17.5625 z M 44.125 17.59375 L 17.90625 17.625 L 17.9375 43.90625 L 25.21875 51.1875 L 25.3125 30.96875 L 46.15625 51.8125 L 52 45.96875 L 31 25 L 51.4375 24.90625 L 44.125 17.59375 z M 46.0625 76.03125 L 25.1875 96.875 L 25.09375 76.65625 L 17.8125 83.9375 L 17.8125 110.21875 L 44 110.25 L 51.3125 102.9375 L 30.90625 102.84375 L 51.875 81.875 L 46.0625 76.03125 z M 82 76.15625 L 76.15625 82 L 97.15625 103 L 76.71875 103.0625 L 84.03125 110.375 L 110.25 110.34375 L 110.21875 84.0625 L 102.9375 76.8125 L 102.84375 97 L 82 76.15625 z",UGe="M 104.34375 17.5625 L 83.5 38.4375 L 83.40625 18.21875 L 76.125 25.5 L 76.09375 51.78125 L 102.3125 51.8125 L 102.3125 51.78125 L 109.625 44.5 L 89.1875 44.40625 L 110.1875 23.40625 L 104.34375 17.5625 z M 23.75 17.59375 L 17.90625 23.4375 L 38.90625 44.4375 L 18.5 44.53125 L 25.78125 51.8125 L 52 51.78125 L 51.96875 25.53125 L 44.6875 18.25 L 44.625 38.46875 L 23.75 17.59375 z M 25.6875 76.03125 L 18.375 83.3125 L 38.78125 83.40625 L 17.8125 104.40625 L 23.625 110.25 L 44.5 89.375 L 44.59375 109.59375 L 51.875 102.3125 L 51.875 76.0625 L 25.6875 76.03125 z M 102.375 76.15625 L 76.15625 76.1875 L 76.1875 102.4375 L 83.46875 109.71875 L 83.5625 89.53125 L 104.40625 110.375 L 110.25 104.53125 L 89.25 83.53125 L 109.6875 83.46875 L 102.375 76.15625 z";function bE(e,t){if(!c(e))throw new E("container is required.");e=Do(e);const n=new yE(t,e);n._exitFullScreenPath=UGe,n._enterFullScreenPath=zGe;const i=document.createElement("button");i.type="button",i.className="cesium-button cesium-fullscreenButton",i.setAttribute("data-bind","attr: { title: tooltip },click: command,enable: isFullscreenEnabled,cesiumSvgPath: { path: isFullscreen ? _exitFullScreenPath : _enterFullScreenPath, width: 128, height: 128 }"),e.appendChild(i),He.applyBindings(n,i),this._container=e,this._viewModel=n,this._element=i}Object.defineProperties(bE.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});bE.prototype.isDestroyed=function(){return!1};bE.prototype.destroy=function(){return this._viewModel.destroy(),He.cleanNode(this._element),this._container.removeChild(this._element),ve(this)};const $z=1e3;function Uc(e){if(!c(e)||!c(e.scene))throw new E("options.scene is required.");c(e.geocoderServices)?this._geocoderServices=e.geocoderServices:this._geocoderServices=[new sL({scene:e.scene})],this._viewContainer=e.container,this._scene=e.scene,this._flightDuration=e.flightDuration,this._searchText="",this._isSearchInProgress=!1,this._wasGeocodeCancelled=!1,this._previousCredits=[],this._complete=new Le,this._suggestions=[],this._selectedSuggestion=void 0,this._showSuggestions=!0,this._handleArrowDown=Qz,this._handleArrowUp=Xz;const t=this;this._suggestionsVisible=He.pureComputed(function(){const o=He.getObservable(t,"_suggestions")().length>0,r=He.getObservable(t,"_showSuggestions")();return o&&r}),this._searchCommand=mo(function(i){if(i=y(i,oL.SEARCH),t._focusTextbox=!1,c(t._selectedSuggestion))return t.activateSuggestion(t._selectedSuggestion),!1;if(t.hideSuggestions(),t.isSearchInProgress)WGe(t);else return GGe(t,t._geocoderServices,i)}),this.deselectSuggestion=function(){t._selectedSuggestion=void 0},this.handleKeyDown=function(i,o){const r=o.key==="ArrowDown"||o.key==="Down"||o.keyCode===40,s=o.key==="ArrowUp"||o.key==="Up"||o.keyCode===38;return(r||s)&&o.preventDefault(),!0},this.handleKeyUp=function(i,o){const r=o.key==="ArrowDown"||o.key==="Down"||o.keyCode===40,s=o.key==="ArrowUp"||o.key==="Up"||o.keyCode===38,a=o.key==="Enter"||o.keyCode===13;return s?Xz(t):r?Qz(t):a&&t._searchCommand(),!0},this.activateSuggestion=function(i){t.hideSuggestions(),t._searchText=i.displayName;const o=i.destination;Pq(t),t.destinationFound(t,o)},this.hideSuggestions=function(){t._showSuggestions=!1,t._selectedSuggestion=void 0},this.showSuggestions=function(){t._showSuggestions=!0},this.handleMouseover=function(i,o){i!==t._selectedSuggestion&&(t._selectedSuggestion=i)},this.keepExpanded=!1,this.autoComplete=y(e.autocomplete,!0),this.destinationFound=y(e.destinationFound,Uc.flyToDestination),this._focusTextbox=!1,He.track(this,["_searchText","_isSearchInProgress","keepExpanded","_suggestions","_selectedSuggestion","_showSuggestions","_focusTextbox"]);const n=He.getObservable(this,"_searchText");n.extend({rateLimit:{timeout:500}}),this._suggestionSubscription=n.subscribe(function(){Uc._updateSearchSuggestions(t)}),this.isSearchInProgress=void 0,He.defineProperty(this,"isSearchInProgress",{get:function(){return this._isSearchInProgress}}),this.searchText=void 0,He.defineProperty(this,"searchText",{get:function(){return this.isSearchInProgress?"Searching...":this._searchText},set:function(i){if(typeof i!="string")throw new E("value must be a valid string.");this._searchText=i}}),this.flightDuration=void 0,He.defineProperty(this,"flightDuration",{get:function(){return this._flightDuration},set:function(i){if(c(i)&&i<0)throw new E("value must be positive.");this._flightDuration=i}})}Object.defineProperties(Uc.prototype,{complete:{get:function(){return this._complete}},scene:{get:function(){return this._scene}},search:{get:function(){return this._searchCommand}},selectedSuggestion:{get:function(){return this._selectedSuggestion}},suggestions:{get:function(){return this._suggestions}}});Uc.prototype.destroy=function(){this._suggestionSubscription.dispose()};function Xz(e){if(e._suggestions.length===0)return;const t=e._suggestions.indexOf(e._selectedSuggestion);if(t===-1||t===0){e._selectedSuggestion=void 0;return}const n=t-1;e._selectedSuggestion=e._suggestions[n],Uc._adjustSuggestionsScroll(e,n)}function Qz(e){if(e._suggestions.length===0)return;const t=e._suggestions.length,i=(e._suggestions.indexOf(e._selectedSuggestion)+1)%t;e._selectedSuggestion=e._suggestions[i],Uc._adjustSuggestionsScroll(e,i)}function kGe(e,t){const n=c(t)?t.availability:void 0;return c(n)?aL(t,[e]).then(function(i){return e=i[0],e.height+=$z,e}):(e.height+=$z,Promise.resolve(e))}function VGe(e,t){const n=e._scene,o=n.mapProjection.ellipsoid,r=n.camera,s=n.terrainProvider;let a=t,l;return t instanceof ce?R.equalsEpsilon(t.south,t.north,R.EPSILON7)&&R.equalsEpsilon(t.east,t.west,R.EPSILON7)?t=ce.center(t):l=_E(t,n):t=o.cartesianToCartographic(t),c(l)||(l=kGe(t,s)),l.then(function(u){a=o.cartographicToCartesian(u)}).finally(function(){r.flyTo({destination:a,complete:function(){e._complete.raiseEvent()},duration:e._flightDuration,endTransform:L.IDENTITY})})}async function HGe(e,t,n){try{return{state:"fulfilled",value:await e.geocode(t,n),credits:e.credit}}catch(i){return{state:"rejected",reason:i}}}async function GGe(e,t,n){const i=e._searchText;if(Dq(i)){e.showSuggestions();return}e._isSearchInProgress=!0,e._wasGeocodeCancelled=!1;let o,r;for(o=0;o<t.length;o++){if(e._wasGeocodeCancelled)return;if(r=await HGe(t[o],i,n),c(r)&&r.state==="fulfilled"&&r.value.length>0)break}if(e._wasGeocodeCancelled)return;e._isSearchInProgress=!1,uL(e);const s=r.value;if(r.state==="fulfilled"&&c(s)&&s.length>0){e._searchText=s[0].displayName,e.destinationFound(e,s[0].destination);const a=Iq(e,_b.getCreditsFromResult(s[0]));c(a)||lL(e,t[o].credit);return}e._searchText=`${i} (not found)`}function lL(e,t){c(t)&&!e._scene.isDestroyed()&&!e._scene.frameState.creditDisplay.isDestroyed()&&(e._scene.frameState.creditDisplay.addStaticCredit(t),e._previousCredits.push(t))}function Iq(e,t){return c(t)&&t.forEach(n=>lL(e,n)),t}function uL(e){!e._scene.isDestroyed()&&!e._scene.frameState.creditDisplay.isDestroyed()&&e._previousCredits.forEach(t=>{e._scene.frameState.creditDisplay.removeStaticCredit(t)}),e._previousCredits.length=0}function jGe(e,t){const n=Do(e._viewContainer),i=n.getElementsByClassName("search-results")[0],r=n.getElementsByTagName("li")[t];if(t===0){i.scrollTop=0;return}const s=r.offsetTop;s+r.clientHeight>i.clientHeight?i.scrollTop=s+r.clientHeight:s<i.scrollTop&&(i.scrollTop=s)}function WGe(e){e._isSearchInProgress&&(e._isSearchInProgress=!1,e._wasGeocodeCancelled=!0)}function Dq(e){return/^\s*$/.test(e)}function Pq(e){He.getObservable(e,"_suggestions").removeAll()}async function qGe(e){if(!e.autoComplete)return;const t=e._searchText;if(Pq(e),uL(e),!Dq(t))for(const n of e._geocoderServices){const i=await n.geocode(t,oL.AUTOCOMPLETE);if(e._suggestions=e._suggestions.concat(i),i.length>0){let o=!0;i.forEach(r=>{const s=_b.getCreditsFromResult(r);o=o&&!c(s),Iq(e,s)}),o&&lL(e,n.credit)}if(e._suggestions.length>=5)return}}Uc.flyToDestination=VGe;Uc._updateSearchSuggestions=qGe;Uc._adjustSuggestionsScroll=jGe;Uc.prototype.isDestroyed=function(){return!1};Uc.prototype.destroy=function(){return uL(this),ve(this)};const YGe="M29.772,26.433l-7.126-7.126c0.96-1.583,1.523-3.435,1.524-5.421C24.169,8.093,19.478,3.401,13.688,3.399C7.897,3.401,3.204,8.093,3.204,13.885c0,5.789,4.693,10.481,10.484,10.481c1.987,0,3.839-0.563,5.422-1.523l7.128,7.127L29.772,26.433zM7.203,13.885c0.006-3.582,2.903-6.478,6.484-6.486c3.579,0.008,6.478,2.904,6.484,6.486c-0.007,3.58-2.905,6.476-6.484,6.484C10.106,20.361,7.209,17.465,7.203,13.885z",$Ge="M24.778,21.419 19.276,15.917 24.777,10.415 21.949,7.585 16.447,13.087 10.945,7.585 8.117,10.415 13.618,15.917 8.116,21.419 10.946,24.248 16.447,18.746 21.948,24.248z";function TE(e){if(!c(e)||!c(e.container))throw new E("options.container is required.");if(!c(e.scene))throw new E("options.scene is required.");const t=Do(e.container),n=new Uc(e);n._startSearchPath=YGe,n._stopSearchPath=$Ge;const i=document.createElement("form");i.setAttribute("data-bind","submit: search");const o=document.createElement("input");o.type="search",o.className="cesium-geocoder-input",o.setAttribute("placeholder","Enter an address or landmark..."),o.setAttribute("data-bind",'textInput: searchText,disable: isSearchInProgress,event: { keyup: handleKeyUp, keydown: handleKeyDown, mouseover: deselectSuggestion },css: { "cesium-geocoder-input-wide" : keepExpanded || searchText.length > 0 },hasFocus: _focusTextbox'),this._onTextBoxFocus=function(){setTimeout(function(){o.select()},0)},o.addEventListener("focus",this._onTextBoxFocus,!1),i.appendChild(o),this._textBox=o;const r=document.createElement("span");r.className="cesium-geocoder-searchButton",r.setAttribute("data-bind","click: search,cesiumSvgPath: { path: isSearchInProgress ? _stopSearchPath : _startSearchPath, width: 32, height: 32 }"),i.appendChild(r),t.appendChild(i);const s=document.createElement("div");s.className="search-results",s.setAttribute("data-bind","visible: _suggestionsVisible");const a=document.createElement("ul");a.setAttribute("data-bind","foreach: _suggestions");const l=document.createElement("li");a.appendChild(l),l.setAttribute("data-bind","text: $data.displayName, click: $parent.activateSuggestion, event: { mouseover: $parent.handleMouseover}, css: { active: $data === $parent._selectedSuggestion }"),s.appendChild(a),t.appendChild(s),He.applyBindings(n,i),He.applyBindings(n,s),this._container=t,this._searchSuggestionsContainer=s,this._viewModel=n,this._form=i,this._onInputBegin=function(u){let h=u.target;typeof u.composedPath=="function"&&(h=u.composedPath()[0]),t.contains(h)||(n._focusTextbox=!1,n.hideSuggestions())},this._onInputEnd=function(u){n._focusTextbox=!0,n.showSuggestions()},Yt.supportsPointerEvents()?(document.addEventListener("pointerdown",this._onInputBegin,!0),t.addEventListener("pointerup",this._onInputEnd,!0),t.addEventListener("pointercancel",this._onInputEnd,!0)):(document.addEventListener("mousedown",this._onInputBegin,!0),t.addEventListener("mouseup",this._onInputEnd,!0),document.addEventListener("touchstart",this._onInputBegin,!0),t.addEventListener("touchend",this._onInputEnd,!0),t.addEventListener("touchcancel",this._onInputEnd,!0))}Object.defineProperties(TE.prototype,{container:{get:function(){return this._container}},searchSuggestionsContainer:{get:function(){return this._searchSuggestionsContainer}},viewModel:{get:function(){return this._viewModel}}});TE.prototype.isDestroyed=function(){return!1};TE.prototype.destroy=function(){const e=this._container;return Yt.supportsPointerEvents()?(document.removeEventListener("pointerdown",this._onInputBegin,!0),e.removeEventListener("pointerup",this._onInputEnd,!0)):(document.removeEventListener("mousedown",this._onInputBegin,!0),e.removeEventListener("mouseup",this._onInputEnd,!0),document.removeEventListener("touchstart",this._onInputBegin,!0),e.removeEventListener("touchend",this._onInputEnd,!0)),this._viewModel.destroy(),He.cleanNode(this._form),He.cleanNode(this._searchSuggestionsContainer),e.removeChild(this._form),e.removeChild(this._searchSuggestionsContainer),this._textBox.removeEventListener("focus",this._onTextBoxFocus,!1),ve(this)};function Oq(e,t){if(!c(e))throw new E("scene is required.");this._scene=e,this._duration=t;const n=this;this._command=mo(function(){n._scene.camera.flyHome(n._duration)}),this.tooltip="View Home",He.track(this,["tooltip"])}Object.defineProperties(Oq.prototype,{scene:{get:function(){return this._scene}},command:{get:function(){return this._command}},duration:{get:function(){return this._duration},set:function(e){if(c(e)&&e<0)throw new E("value must be positive.");this._duration=e}}});function AE(e,t,n){if(!c(e))throw new E("container is required.");e=Do(e);const i=new Oq(t,n);i._svgPath="M14,4l-10,8.75h20l-4.25-3.7188v-4.6562h-2.812v2.1875l-2.938-2.5625zm-7.0938,9.906v10.094h14.094v-10.094h-14.094zm2.1876,2.313h3.3122v4.25h-3.3122v-4.25zm5.8442,1.281h3.406v6.438h-3.406v-6.438z";const o=document.createElement("button");o.type="button",o.className="cesium-button cesium-toolbar-button cesium-home-button",o.setAttribute("data-bind","attr: { title: tooltip },click: command,cesiumSvgPath: { path: _svgPath, width: 28, height: 28 }"),e.appendChild(o),He.applyBindings(i,o),this._container=e,this._viewModel=i,this._element=o}Object.defineProperties(AE.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});AE.prototype.isDestroyed=function(){return!1};AE.prototype.destroy=function(){return He.cleanNode(this._element),this._container.removeChild(this._element),ve(this)};const XGe="M 13.84375 7.03125 C 11.412798 7.03125 9.46875 8.975298 9.46875 11.40625 L 9.46875 11.59375 L 2.53125 7.21875 L 2.53125 24.0625 L 9.46875 19.6875 C 9.4853444 22.104033 11.423165 24.0625 13.84375 24.0625 L 25.875 24.0625 C 28.305952 24.0625 30.28125 22.087202 30.28125 19.65625 L 30.28125 11.40625 C 30.28125 8.975298 28.305952 7.03125 25.875 7.03125 L 13.84375 7.03125 z",QGe="M 27.34375 1.65625 L 5.28125 27.9375 L 8.09375 30.3125 L 30.15625 4.03125 L 27.34375 1.65625 z M 13.84375 7.03125 C 11.412798 7.03125 9.46875 8.975298 9.46875 11.40625 L 9.46875 11.59375 L 2.53125 7.21875 L 2.53125 24.0625 L 9.46875 19.6875 C 9.4724893 20.232036 9.5676108 20.7379 9.75 21.21875 L 21.65625 7.03125 L 13.84375 7.03125 z M 28.21875 7.71875 L 14.53125 24.0625 L 25.875 24.0625 C 28.305952 24.0625 30.28125 22.087202 30.28125 19.65625 L 30.28125 11.40625 C 30.28125 9.8371439 29.456025 8.4902779 28.21875 7.71875 z";function dL(){this._cameraClicked=new Le,this._closeClicked=new Le,this.maxHeight=500,this.enableCamera=!1,this.isCameraTracking=!1,this.showInfo=!1,this.titleText="",this.description="",He.track(this,["showInfo","titleText","description","maxHeight","enableCamera","isCameraTracking"]),this._loadingIndicatorHtml='<div class="cesium-infoBox-loadingContainer"><span class="cesium-infoBox-loading"></span></div>',this.cameraIconPath=void 0,He.defineProperty(this,"cameraIconPath",{get:function(){return!this.enableCamera||this.isCameraTracking?QGe:XGe}}),He.defineProperty(this,"_bodyless",{get:function(){return!c(this.description)||this.description.length===0}})}dL.prototype.maxHeightOffset=function(e){return`${this.maxHeight-e}px`};Object.defineProperties(dL.prototype,{cameraClicked:{get:function(){return this._cameraClicked}},closeClicked:{get:function(){return this._closeClicked}}});function xE(e){A.defined("container",e),e=Do(e);const t=document.createElement("div");t.className="cesium-infoBox",t.setAttribute("data-bind",'css: { "cesium-infoBox-visible" : showInfo, "cesium-infoBox-bodyless" : _bodyless }'),e.appendChild(t);const n=document.createElement("div");n.className="cesium-infoBox-title",n.setAttribute("data-bind","text: titleText"),t.appendChild(n);const i=document.createElement("button");i.type="button",i.className="cesium-button cesium-infoBox-camera",i.setAttribute("data-bind",'attr: { title: "Focus camera on object" },click: function () { cameraClicked.raiseEvent(this); },enable: enableCamera,cesiumSvgPath: { path: cameraIconPath, width: 32, height: 32 }'),t.appendChild(i);const o=document.createElement("button");o.type="button",o.className="cesium-infoBox-close",o.setAttribute("data-bind","click: function () { closeClicked.raiseEvent(this); }"),o.innerHTML="×",t.appendChild(o);const r=document.createElement("iframe");r.className="cesium-infoBox-iframe",r.setAttribute("sandbox","allow-same-origin allow-popups allow-forms"),r.setAttribute("data-bind","style : { maxHeight : maxHeightOffset(40) }"),r.setAttribute("allowfullscreen",!0),t.appendChild(r);const s=new dL;He.applyBindings(s,t),this._container=e,this._element=t,this._frame=r,this._viewModel=s,this._descriptionSubscription=void 0;const a=this;r.addEventListener("load",function(){const l=r.contentDocument,u=l.createElement("link");u.href=Zt("Widgets/InfoBox/InfoBoxDescription.css"),u.rel="stylesheet",u.type="text/css";const h=l.createElement("div");h.className="cesium-infoBox-description",l.head.appendChild(u),l.body.appendChild(h),a._descriptionSubscription=fc(s,"description",function(f){r.style.height="5px",h.innerHTML=f;let _=null;const g=h.firstElementChild;if(g!==null&&h.childNodes.length===1){const b=window.getComputedStyle(g);if(b!==null){const T=b["background-color"],x=z.fromCssColorString(T);c(x)&&x.alpha!==0&&(_=b["background-color"])}}t.style["background-color"]=_;const m=h.getBoundingClientRect().height;r.style.height=`${m}px`})}),r.setAttribute("src","about:blank")}Object.defineProperties(xE.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}},frame:{get:function(){return this._frame}}});xE.prototype.isDestroyed=function(){return!1};xE.prototype.destroy=function(){const e=this._container;return He.cleanNode(this._element),e.removeChild(this._element),c(this._descriptionSubscription)&&this._descriptionSubscription.dispose(),ve(this)};function Lq(){this.showInstructions=!1;const e=this;this._command=mo(function(){e.showInstructions=!e.showInstructions}),this._showClick=mo(function(){e._touch=!1}),this._showTouch=mo(function(){e._touch=!0}),this._touch=!1,this.tooltip="Navigation Instructions",He.track(this,["tooltip","showInstructions","_touch"])}Object.defineProperties(Lq.prototype,{command:{get:function(){return this._command}},showClick:{get:function(){return this._showClick}},showTouch:{get:function(){return this._showTouch}}});function CE(e){if(!c(e)||!c(e.container))throw new E("options.container is required.");const t=Do(e.container),n=new Lq,i=y(e.instructionsInitiallyVisible,!1);n.showInstructions=i,n._svgPath="M16,1.466C7.973,1.466,1.466,7.973,1.466,16c0,8.027,6.507,14.534,14.534,14.534c8.027,0,14.534-6.507,14.534-14.534C30.534,7.973,24.027,1.466,16,1.466z M17.328,24.371h-2.707v-2.596h2.707V24.371zM17.328,19.003v0.858h-2.707v-1.057c0-3.19,3.63-3.696,3.63-5.963c0-1.034-0.924-1.826-2.134-1.826c-1.254,0-2.354,0.924-2.354,0.924l-1.541-1.915c0,0,1.519-1.584,4.137-1.584c2.487,0,4.796,1.54,4.796,4.136C21.156,16.208,17.328,16.627,17.328,19.003z";const o=document.createElement("span");o.className="cesium-navigationHelpButton-wrapper",t.appendChild(o);const r=document.createElement("button");r.type="button",r.className="cesium-button cesium-toolbar-button cesium-navigation-help-button",r.setAttribute("data-bind","attr: { title: tooltip },click: command,cesiumSvgPath: { path: _svgPath, width: 32, height: 32 }"),o.appendChild(r);const s=document.createElement("div");s.className="cesium-navigation-help",s.setAttribute("data-bind",'css: { "cesium-navigation-help-visible" : showInstructions}'),o.appendChild(s);const a=document.createElement("button");a.type="button",a.className="cesium-navigation-button cesium-navigation-button-left",a.setAttribute("data-bind",'click: showClick, css: {"cesium-navigation-button-selected": !_touch, "cesium-navigation-button-unselected": _touch}');const l=document.createElement("img");l.src=Zt("Widgets/Images/NavigationHelp/Mouse.svg"),l.className="cesium-navigation-button-icon",l.style.width="25px",l.style.height="25px",a.appendChild(l),a.appendChild(document.createTextNode("Mouse"));const u=document.createElement("button");u.type="button",u.className="cesium-navigation-button cesium-navigation-button-right",u.setAttribute("data-bind",'click: showTouch, css: {"cesium-navigation-button-selected": _touch, "cesium-navigation-button-unselected": !_touch}');const h=document.createElement("img");h.src=Zt("Widgets/Images/NavigationHelp/Touch.svg"),h.className="cesium-navigation-button-icon",h.style.width="25px",h.style.height="25px",u.appendChild(h),u.appendChild(document.createTextNode("Touch")),s.appendChild(a),s.appendChild(u);const f=document.createElement("div");f.className="cesium-click-navigation-help cesium-navigation-help-instructions",f.setAttribute("data-bind",'css: { "cesium-click-navigation-help-visible" : !_touch}'),f.innerHTML=` <table> <tr> <td><img src="${Zt("Widgets/Images/NavigationHelp/MouseLeft.svg")}" width="48" height="48" /></td> <td> <div class="cesium-navigation-help-pan">Pan view</div> <div class="cesium-navigation-help-details">Left click + drag</div> </td> </tr> <tr> <td><img src="${Zt("Widgets/Images/NavigationHelp/MouseRight.svg")}" width="48" height="48" /></td> <td> <div class="cesium-navigation-help-zoom">Zoom view</div> <div class="cesium-navigation-help-details">Right click + drag, or</div> <div class="cesium-navigation-help-details">Mouse wheel scroll</div> </td> </tr> <tr> <td><img src="${Zt("Widgets/Images/NavigationHelp/MouseMiddle.svg")}" width="48" height="48" /></td> <td> <div class="cesium-navigation-help-rotate">Rotate view</div> <div class="cesium-navigation-help-details">Middle click + drag, or</div> <div class="cesium-navigation-help-details">CTRL + Left/Right click + drag</div> </td> </tr> </table>`,s.appendChild(f);const _=document.createElement("div");_.className="cesium-touch-navigation-help cesium-navigation-help-instructions",_.setAttribute("data-bind",'css: { "cesium-touch-navigation-help-visible" : _touch}'),_.innerHTML=` <table> <tr> <td><img src="${Zt("Widgets/Images/NavigationHelp/TouchDrag.svg")}" width="70" height="48" /></td> <td> <div class="cesium-navigation-help-pan">Pan view</div> <div class="cesium-navigation-help-details">One finger drag</div> </td> </tr> <tr> <td><img src="${Zt("Widgets/Images/NavigationHelp/TouchZoom.svg")}" width="70" height="48" /></td> <td> <div class="cesium-navigation-help-zoom">Zoom view</div> <div class="cesium-navigation-help-details">Two finger pinch</div> </td> </tr> <tr> <td><img src="${Zt("Widgets/Images/NavigationHelp/TouchTilt.svg")}" width="70" height="48" /></td> <td> <div class="cesium-navigation-help-rotate">Tilt view</div> <div class="cesium-navigation-help-details">Two finger drag, same direction</div> </td> </tr> <tr> <td><img src="${Zt("Widgets/Images/NavigationHelp/TouchRotate.svg")}" width="70" height="48" /></td> <td> <div class="cesium-navigation-help-tilt">Rotate view</div> <div class="cesium-navigation-help-details">Two finger drag, opposite direction</div> </td> </tr> </table>`,s.appendChild(_),He.applyBindings(n,o),this._container=t,this._viewModel=n,this._wrapper=o,this._closeInstructions=function(g){o.contains(g.target)||(n.showInstructions=!1)},Yt.supportsPointerEvents()?document.addEventListener("pointerdown",this._closeInstructions,!0):(document.addEventListener("mousedown",this._closeInstructions,!0),document.addEventListener("touchstart",this._closeInstructions,!0))}Object.defineProperties(CE.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});CE.prototype.isDestroyed=function(){return!1};CE.prototype.destroy=function(){return Yt.supportsPointerEvents()?document.removeEventListener("pointerdown",this._closeInstructions,!0):(document.removeEventListener("mousedown",this._closeInstructions,!0),document.removeEventListener("touchstart",this._closeInstructions,!0)),He.cleanNode(this._wrapper),this._container.removeChild(this._wrapper),ve(this)};function EE(e){if(!c(e))throw new E("scene is required.");this._scene=e,this._orthographic=e.camera.frustum instanceof It,this._flightInProgress=!1,this.dropDownVisible=!1,this.tooltipPerspective="Perspective Projection",this.tooltipOrthographic="Orthographic Projection",this.selectedTooltip=void 0,this.sceneMode=e.mode,He.track(this,["_orthographic","_flightInProgress","sceneMode","dropDownVisible","tooltipPerspective","tooltipOrthographic"]);const t=this;He.defineProperty(this,"selectedTooltip",function(){return t._orthographic?t.tooltipOrthographic:t.tooltipPerspective}),this._toggleDropDown=mo(function(){t.sceneMode===oe.SCENE2D||t._flightInProgress||(t.dropDownVisible=!t.dropDownVisible)}),this._eventHelper=new Tu,this._eventHelper.add(e.morphComplete,function(n,i,o,r){t.sceneMode=o,t._orthographic=o===oe.SCENE2D||t._scene.camera.frustum instanceof It}),this._eventHelper.add(e.preRender,function(){t._flightInProgress=c(e.camera._currentFlight)}),this._switchToPerspective=mo(function(){t.sceneMode!==oe.SCENE2D&&(t._scene.camera.switchToPerspectiveFrustum(),t._orthographic=!1,t.dropDownVisible=!1)}),this._switchToOrthographic=mo(function(){t.sceneMode!==oe.SCENE2D&&(t._scene.camera.switchToOrthographicFrustum(),t._orthographic=!0,t.dropDownVisible=!1)}),this._sceneMode=oe}Object.defineProperties(EE.prototype,{scene:{get:function(){return this._scene}},toggleDropDown:{get:function(){return this._toggleDropDown}},switchToPerspective:{get:function(){return this._switchToPerspective}},switchToOrthographic:{get:function(){return this._switchToOrthographic}},isOrthographicProjection:{get:function(){return this._orthographic}}});EE.prototype.isDestroyed=function(){return!1};EE.prototype.destroy=function(){this._eventHelper.removeAll(),ve(this)};const KGe="M 28.15625,10.4375 9.125,13.21875 13.75,43.25 41.75,55.09375 50.8125,37 54.5,11.9375 z m 0.125,3 19.976451,0.394265 L 43.03125,16.875 22.6875,14.28125 z M 50.971746,15.705477 47.90625,36.03125 42.53125,46 44.84375,19.3125 z M 12.625,16.03125 l 29.15625,3.6875 -2.65625,31 L 16.4375,41.125 z",ZGe="m 31.560594,6.5254438 -20.75,12.4687502 0.1875,24.5625 22.28125,11.8125 19.5,-12 0.65625,-0.375 0,-0.75 0.0312,-23.21875 z m 0.0625,3.125 16.65625,9.5000002 -16.125,10.28125 -17.34375,-9.71875 z m 18.96875,11.1875002 0.15625,20.65625 -17.46875,10.59375 0.15625,-20.28125 z m -37.0625,1.25 17.21875,9.625 -0.15625,19.21875 -16.9375,-9 z";function wE(e,t){if(!c(e))throw new E("container is required.");if(!c(t))throw new E("scene is required.");e=Do(e);const n=new EE(t);n._perspectivePath=KGe,n._orthographicPath=ZGe;const i=document.createElement("span");i.className="cesium-projectionPicker-wrapper cesium-toolbar-button",e.appendChild(i);const o=document.createElement("button");o.type="button",o.className="cesium-button cesium-toolbar-button",o.setAttribute("data-bind",'css: { "cesium-projectionPicker-buttonPerspective": !_orthographic, "cesium-projectionPicker-buttonOrthographic": _orthographic, "cesium-button-disabled" : sceneMode === _sceneMode.SCENE2D || _flightInProgress, "cesium-projectionPicker-selected": dropDownVisible },attr: { title: selectedTooltip },click: toggleDropDown'),o.innerHTML='<!-- ko cesiumSvgPath: { path: _perspectivePath, width: 64, height: 64, css: "cesium-projectionPicker-iconPerspective" } --><!-- /ko --><!-- ko cesiumSvgPath: { path: _orthographicPath, width: 64, height: 64, css: "cesium-projectionPicker-iconOrthographic" } --><!-- /ko -->',i.appendChild(o);const r=document.createElement("button");r.type="button",r.className="cesium-button cesium-toolbar-button cesium-projectionPicker-dropDown-icon",r.setAttribute("data-bind",'css: { "cesium-projectionPicker-visible" : (dropDownVisible && _orthographic), "cesium-projectionPicker-none" : !_orthographic, "cesium-projectionPicker-hidden" : !dropDownVisible },attr: { title: tooltipPerspective },click: switchToPerspective,cesiumSvgPath: { path: _perspectivePath, width: 64, height: 64 }'),i.appendChild(r);const s=document.createElement("button");s.type="button",s.className="cesium-button cesium-toolbar-button cesium-projectionPicker-dropDown-icon",s.setAttribute("data-bind",'css: { "cesium-projectionPicker-visible" : (dropDownVisible && !_orthographic), "cesium-projectionPicker-none" : _orthographic, "cesium-projectionPicker-hidden" : !dropDownVisible},attr: { title: tooltipOrthographic },click: switchToOrthographic,cesiumSvgPath: { path: _orthographicPath, width: 64, height: 64 }'),i.appendChild(s),He.applyBindings(n,i),this._viewModel=n,this._container=e,this._wrapper=i,this._closeDropDown=function(a){i.contains(a.target)||(n.dropDownVisible=!1)},Yt.supportsPointerEvents()?document.addEventListener("pointerdown",this._closeDropDown,!0):(document.addEventListener("mousedown",this._closeDropDown,!0),document.addEventListener("touchstart",this._closeDropDown,!0))}Object.defineProperties(wE.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});wE.prototype.isDestroyed=function(){return!1};wE.prototype.destroy=function(){return this._viewModel.destroy(),Yt.supportsPointerEvents()?document.removeEventListener("pointerdown",this._closeDropDown,!0):(document.removeEventListener("mousedown",this._closeDropDown,!0),document.removeEventListener("touchstart",this._closeDropDown,!0)),He.cleanNode(this._wrapper),this._container.removeChild(this._wrapper),ve(this)};function SE(e,t){if(!c(e))throw new E("scene is required.");this._scene=e;const n=this,i=function(o,r,s,a){n.sceneMode=s,n.dropDownVisible=!1};this._eventHelper=new Tu,this._eventHelper.add(e.morphStart,i),this._duration=y(t,2),this.sceneMode=e.mode,this.dropDownVisible=!1,this.tooltip2D="2D",this.tooltip3D="3D",this.tooltipColumbusView="Columbus View",He.track(this,["sceneMode","dropDownVisible","tooltip2D","tooltip3D","tooltipColumbusView"]),this.selectedTooltip=void 0,He.defineProperty(this,"selectedTooltip",function(){const o=n.sceneMode;return o===oe.SCENE2D?n.tooltip2D:o===oe.SCENE3D?n.tooltip3D:n.tooltipColumbusView}),this._toggleDropDown=mo(function(){n.dropDownVisible=!n.dropDownVisible}),this._morphTo2D=mo(function(){e.morphTo2D(n._duration)}),this._morphTo3D=mo(function(){e.morphTo3D(n._duration)}),this._morphToColumbusView=mo(function(){e.morphToColumbusView(n._duration)}),this._sceneMode=oe}Object.defineProperties(SE.prototype,{scene:{get:function(){return this._scene}},duration:{get:function(){return this._duration},set:function(e){if(e<0)throw new E("duration value must be positive.");this._duration=e}},toggleDropDown:{get:function(){return this._toggleDropDown}},morphTo2D:{get:function(){return this._morphTo2D}},morphTo3D:{get:function(){return this._morphTo3D}},morphToColumbusView:{get:function(){return this._morphToColumbusView}}});SE.prototype.isDestroyed=function(){return!1};SE.prototype.destroy=function(){this._eventHelper.removeAll(),ve(this)};const JGe="m 32.401392,4.9330437 c -7.087603,0 -14.096095,2.884602 -19.10793,7.8946843 -5.0118352,5.010083 -7.9296167,11.987468 -7.9296167,19.072999 0,7.085531 2.9177815,14.097848 7.9296167,19.107931 4.837653,4.835961 11.541408,7.631372 18.374354,7.82482 0.05712,0.01231 0.454119,0.139729 0.454119,0.139729 l 0.03493,-0.104797 c 0.08246,7.84e-4 0.162033,0.03493 0.244525,0.03493 0.08304,0 0.161515,-0.03414 0.244526,-0.03493 l 0.03493,0.104797 c 0,0 0.309474,-0.129487 0.349323,-0.139729 6.867765,-0.168094 13.582903,-2.965206 18.444218,-7.82482 2.558195,-2.5573 4.551081,-5.638134 5.903547,-8.977584 1.297191,-3.202966 2.02607,-6.661489 2.02607,-10.130347 0,-6.237309 -2.366261,-12.31219 -6.322734,-17.116794 -0.0034,-0.02316 0.0049,-0.04488 0,-0.06986 -0.01733,-0.08745 -0.104529,-0.278855 -0.104797,-0.279458 -5.31e-4,-0.0012 -0.522988,-0.628147 -0.523984,-0.62878 -3.47e-4,-2.2e-4 -0.133444,-0.03532 -0.244525,-0.06987 C 51.944299,13.447603 51.751076,13.104317 51.474391,12.827728 46.462556,7.8176457 39.488996,4.9330437 32.401392,4.9330437 z m -2.130866,3.5281554 0.104797,9.6762289 c -4.111695,-0.08361 -7.109829,-0.423664 -9.257041,-0.943171 1.198093,-2.269271 2.524531,-4.124404 3.91241,-5.414496 2.167498,-2.0147811 3.950145,-2.8540169 5.239834,-3.3185619 z m 2.794579,0 c 1.280302,0.4754953 3.022186,1.3285948 5.065173,3.2486979 1.424667,1.338973 2.788862,3.303645 3.982275,5.728886 -2.29082,0.403367 -5.381258,0.621049 -8.942651,0.698645 L 33.065105,8.4611991 z m 5.728886,0.2445256 c 4.004072,1.1230822 7.793098,3.1481363 10.724195,6.0782083 0.03468,0.03466 0.07033,0.06991 0.104797,0.104797 -0.45375,0.313891 -0.923054,0.663002 -1.956205,1.082899 -0.647388,0.263114 -1.906242,0.477396 -2.829511,0.733577 -1.382296,-2.988132 -3.027146,-5.368585 -4.785716,-7.0213781 -0.422866,-0.397432 -0.835818,-0.6453247 -1.25756,-0.9781032 z m -15.33525,0.7685092 c -0.106753,0.09503 -0.207753,0.145402 -0.31439,0.244526 -1.684973,1.5662541 -3.298068,3.8232211 -4.680919,6.5672591 -0.343797,-0.14942 -1.035052,-0.273198 -1.292493,-0.419186 -0.956528,-0.542427 -1.362964,-1.022024 -1.537018,-1.292493 -0.0241,-0.03745 -0.01868,-0.0401 -0.03493,-0.06986 2.250095,-2.163342 4.948824,-3.869984 7.859752,-5.0302421 z m -9.641296,7.0912431 c 0.464973,0.571618 0.937729,1.169056 1.956205,1.746612 0.349907,0.198425 1.107143,0.335404 1.537018,0.523983 -1.20166,3.172984 -1.998037,7.051901 -2.165798,11.772162 C 14.256557,30.361384 12.934823,30.161483 12.280427,29.90959 10.644437,29.279855 9.6888882,28.674891 9.1714586,28.267775 8.6540289,27.860658 8.6474751,27.778724 8.6474751,27.778724 l -0.069864,0.03493 C 9.3100294,23.691285 11.163248,19.798527 13.817445,16.565477 z m 37.552149,0.523984 c 2.548924,3.289983 4.265057,7.202594 4.890513,11.318043 -0.650428,0.410896 -1.756876,1.001936 -3.563088,1.606882 -1.171552,0.392383 -3.163859,0.759153 -4.960377,1.117832 -0.04367,-4.752703 -0.784809,-8.591423 -1.88634,-11.807094 0.917574,-0.263678 2.170552,-0.486495 2.864443,-0.76851 1.274693,-0.518066 2.003942,-1.001558 2.654849,-1.467153 z m -31.439008,2.619917 c 2.487341,0.672766 5.775813,1.137775 10.479669,1.222628 l 0.104797,10.689263 0,0.03493 0,0.733577 c -5.435005,-0.09059 -9.512219,-0.519044 -12.610536,-1.117831 0.106127,-4.776683 0.879334,-8.55791 2.02607,-11.562569 z m 23.264866,0.31439 c 1.073459,3.067541 1.833795,6.821314 1.816476,11.702298 -3.054474,0.423245 -7.062018,0.648559 -11.702298,0.698644 l 0,-0.838373 -0.104796,-10.654331 c 4.082416,-0.0864 7.404468,-0.403886 9.990618,-0.908238 z M 8.2632205,30.922625 c 0.7558676,0.510548 1.5529563,1.013339 3.0041715,1.57195 0.937518,0.360875 2.612202,0.647642 3.91241,0.978102 0.112814,3.85566 0.703989,7.107756 1.606883,9.920754 -1.147172,-0.324262 -2.644553,-0.640648 -3.423359,-0.978102 -1.516688,-0.657177 -2.386627,-1.287332 -2.864443,-1.71168 -0.477816,-0.424347 -0.489051,-0.489051 -0.489051,-0.489051 L 9.8002387,40.319395 C 8.791691,37.621767 8.1584238,34.769583 8.1584238,31.900727 c 0,-0.330153 0.090589,-0.648169 0.1047967,-0.978102 z m 48.2763445,0.419186 c 0.0047,0.188973 0.06986,0.36991 0.06986,0.558916 0,2.938869 -0.620228,5.873558 -1.676747,8.628261 -0.07435,0.07583 -0.06552,0.07411 -0.454119,0.349323 -0.606965,0.429857 -1.631665,1.042044 -3.318562,1.676747 -1.208528,0.454713 -3.204964,0.850894 -5.135038,1.25756 0.84593,-2.765726 1.41808,-6.005357 1.606883,-9.815957 2.232369,-0.413371 4.483758,-0.840201 5.938479,-1.327425 1.410632,-0.472457 2.153108,-0.89469 2.96924,-1.327425 z m -38.530252,2.864443 c 3.208141,0.56697 7.372279,0.898588 12.575603,0.978103 l 0.174662,9.885821 c -4.392517,-0.06139 -8.106722,-0.320566 -10.863925,-0.803441 -1.051954,-2.664695 -1.692909,-6.043794 -1.88634,-10.060483 z m 26.793022,0.31439 c -0.246298,3.923551 -0.877762,7.263679 -1.816476,9.885822 -2.561957,0.361954 -5.766249,0.560708 -9.431703,0.62878 l -0.174661,-9.815957 c 4.491734,-0.04969 8.334769,-0.293032 11.42284,-0.698645 z M 12.035901,44.860585 c 0.09977,0.04523 0.105535,0.09465 0.209594,0.139729 1.337656,0.579602 3.441099,1.058072 5.589157,1.537018 1.545042,3.399208 3.548524,5.969402 5.589157,7.789888 -3.034411,-1.215537 -5.871615,-3.007978 -8.174142,-5.309699 -1.245911,-1.245475 -2.271794,-2.662961 -3.213766,-4.156936 z m 40.69605,0 c -0.941972,1.493975 -1.967855,2.911461 -3.213765,4.156936 -2.74253,2.741571 -6.244106,4.696717 -9.955686,5.868615 0.261347,-0.241079 0.507495,-0.394491 0.768509,-0.663713 1.674841,-1.727516 3.320792,-4.181056 4.645987,-7.265904 2.962447,-0.503021 5.408965,-1.122293 7.161107,-1.781544 0.284034,-0.106865 0.337297,-0.207323 0.593848,-0.31439 z m -31.404076,2.305527 c 2.645807,0.376448 5.701178,0.649995 9.466635,0.698645 l 0.139729,7.789888 c -1.38739,-0.480844 -3.316218,-1.29837 -5.659022,-3.388427 -1.388822,-1.238993 -2.743668,-3.0113 -3.947342,-5.100106 z m 20.365491,0.104797 c -1.04872,2.041937 -2.174337,3.779068 -3.353494,4.995309 -1.853177,1.911459 -3.425515,2.82679 -4.611055,3.353494 l -0.139729,-7.789887 c 3.13091,-0.05714 5.728238,-0.278725 8.104278,-0.558916 z",eje="m 2.9825053,17.550598 0,1.368113 0,26.267766 0,1.368113 1.36811,0 54.9981397,0 1.36811,0 0,-1.368113 0,-26.267766 0,-1.368113 -1.36811,0 -54.9981397,0 -1.36811,0 z m 2.73623,2.736226 10.3292497,0 0,10.466063 -10.3292497,0 0,-10.466063 z m 13.0654697,0 11.69737,0 0,10.466063 -11.69737,0 0,-10.466063 z m 14.43359,0 11.69737,0 0,10.466063 -11.69737,0 0,-10.466063 z m 14.43359,0 10.32926,0 0,10.466063 -10.32926,0 0,-10.466063 z m -41.9326497,13.202288 10.3292497,0 0,10.329252 -10.3292497,0 0,-10.329252 z m 13.0654697,0 11.69737,0 0,10.329252 -11.69737,0 0,-10.329252 z m 14.43359,0 11.69737,0 0,10.329252 -11.69737,0 0,-10.329252 z m 14.43359,0 10.32926,0 0,10.329252 -10.32926,0 0,-10.329252 z",tje="m 14.723969,17.675598 -0.340489,0.817175 -11.1680536,26.183638 -0.817175,1.872692 2.076986,0 54.7506996,0 2.07698,0 -0.81717,-1.872692 -11.16805,-26.183638 -0.34049,-0.817175 -0.91933,0 -32.414586,0 -0.919322,0 z m 1.838643,2.723916 6.196908,0 -2.928209,10.418977 -7.729111,0 4.460412,-10.418977 z m 9.02297,0 4.903049,0 0,10.418977 -7.831258,0 2.928209,-10.418977 z m 7.626964,0 5.584031,0 2.62176,10.418977 -8.205791,0 0,-10.418977 z m 8.410081,0 5.51593,0 4.46042,10.418977 -7.38863,0 -2.58772,-10.418977 z m -30.678091,13.142892 8.103649,0 -2.89416,10.282782 -9.6018026,0 4.3923136,-10.282782 z m 10.929711,0 8.614384,0 0,10.282782 -11.508544,0 2.89416,-10.282782 z m 11.338299,0 8.852721,0 2.58772,10.282782 -11.440441,0 0,-10.282782 z m 11.678781,0 7.86531,0 4.39231,10.282782 -9.6699,0 -2.58772,-10.282782 z";function vE(e,t,n){if(!c(e))throw new E("container is required.");if(!c(t))throw new E("scene is required.");e=Do(e);const i=new SE(t,n);i._globePath=JGe,i._flatMapPath=eje,i._columbusViewPath=tje;const o=document.createElement("span");o.className="cesium-sceneModePicker-wrapper cesium-toolbar-button",e.appendChild(o);const r=document.createElement("button");r.type="button",r.className="cesium-button cesium-toolbar-button",r.setAttribute("data-bind",'css: { "cesium-sceneModePicker-button2D": sceneMode === _sceneMode.SCENE2D, "cesium-sceneModePicker-button3D": sceneMode === _sceneMode.SCENE3D, "cesium-sceneModePicker-buttonColumbusView": sceneMode === _sceneMode.COLUMBUS_VIEW, "cesium-sceneModePicker-selected": dropDownVisible },attr: { title: selectedTooltip },click: toggleDropDown'),r.innerHTML='<!-- ko cesiumSvgPath: { path: _globePath, width: 64, height: 64, css: "cesium-sceneModePicker-slide-svg cesium-sceneModePicker-icon3D" } --><!-- /ko --><!-- ko cesiumSvgPath: { path: _flatMapPath, width: 64, height: 64, css: "cesium-sceneModePicker-slide-svg cesium-sceneModePicker-icon2D" } --><!-- /ko --><!-- ko cesiumSvgPath: { path: _columbusViewPath, width: 64, height: 64, css: "cesium-sceneModePicker-slide-svg cesium-sceneModePicker-iconColumbusView" } --><!-- /ko -->',o.appendChild(r);const s=document.createElement("button");s.type="button",s.className="cesium-button cesium-toolbar-button cesium-sceneModePicker-dropDown-icon",s.setAttribute("data-bind",'css: { "cesium-sceneModePicker-visible" : (dropDownVisible && (sceneMode !== _sceneMode.SCENE3D)) || (!dropDownVisible && (sceneMode === _sceneMode.SCENE3D)), "cesium-sceneModePicker-none" : sceneMode === _sceneMode.SCENE3D, "cesium-sceneModePicker-hidden" : !dropDownVisible },attr: { title: tooltip3D },click: morphTo3D,cesiumSvgPath: { path: _globePath, width: 64, height: 64 }'),o.appendChild(s);const a=document.createElement("button");a.type="button",a.className="cesium-button cesium-toolbar-button cesium-sceneModePicker-dropDown-icon",a.setAttribute("data-bind",'css: { "cesium-sceneModePicker-visible" : (dropDownVisible && (sceneMode !== _sceneMode.SCENE2D)), "cesium-sceneModePicker-none" : sceneMode === _sceneMode.SCENE2D, "cesium-sceneModePicker-hidden" : !dropDownVisible },attr: { title: tooltip2D },click: morphTo2D,cesiumSvgPath: { path: _flatMapPath, width: 64, height: 64 }'),o.appendChild(a);const l=document.createElement("button");l.type="button",l.className="cesium-button cesium-toolbar-button cesium-sceneModePicker-dropDown-icon",l.setAttribute("data-bind",'css: { "cesium-sceneModePicker-visible" : (dropDownVisible && (sceneMode !== _sceneMode.COLUMBUS_VIEW)) || (!dropDownVisible && (sceneMode === _sceneMode.COLUMBUS_VIEW)), "cesium-sceneModePicker-none" : sceneMode === _sceneMode.COLUMBUS_VIEW, "cesium-sceneModePicker-hidden" : !dropDownVisible},attr: { title: tooltipColumbusView },click: morphToColumbusView,cesiumSvgPath: { path: _columbusViewPath, width: 64, height: 64 }'),o.appendChild(l),He.applyBindings(i,o),this._viewModel=i,this._container=e,this._wrapper=o,this._closeDropDown=function(u){o.contains(u.target)||(i.dropDownVisible=!1)},Yt.supportsPointerEvents()?document.addEventListener("pointerdown",this._closeDropDown,!0):(document.addEventListener("mousedown",this._closeDropDown,!0),document.addEventListener("touchstart",this._closeDropDown,!0))}Object.defineProperties(vE.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});vE.prototype.isDestroyed=function(){return!1};vE.prototype.destroy=function(){return this._viewModel.destroy(),Yt.supportsPointerEvents()?document.removeEventListener("pointerdown",this._closeDropDown,!0):(document.removeEventListener("mousedown",this._closeDropDown,!0),document.removeEventListener("touchstart",this._closeDropDown,!0)),He.cleanNode(this._wrapper),this._container.removeChild(this._wrapper),ve(this)};const nje=new H,hC="-1000px";function bb(e,t,n){if(!c(e))throw new E("scene is required.");if(!c(t))throw new E("selectionIndicatorElement is required.");if(!c(n))throw new E("container is required.");this._scene=e,this._screenPositionX=hC,this._screenPositionY=hC,this._tweens=e.tweens,this._container=y(n,document.body),this._selectionIndicatorElement=t,this._scale=1,this.position=void 0,this.showSelection=!1,He.track(this,["position","_screenPositionX","_screenPositionY","_scale","showSelection"]),this.isVisible=void 0,He.defineProperty(this,"isVisible",{get:function(){return this.showSelection&&c(this.position)}}),He.defineProperty(this,"_transform",{get:function(){return`scale(${this._scale})`}}),this.computeScreenSpacePosition=function(i,o){return Ao.wgs84ToWindowCoordinates(e,i,o)}}bb.prototype.update=function(){if(this.showSelection&&c(this.position)){const e=this.computeScreenSpacePosition(this.position,nje);if(!c(e))this._screenPositionX=hC,this._screenPositionY=hC;else{const t=this._container,n=t.parentNode.clientWidth,i=t.parentNode.clientHeight,o=this._selectionIndicatorElement.clientWidth,r=o*.5;e.x=Math.min(Math.max(e.x,-o),n+o)-r,e.y=Math.min(Math.max(e.y,-o),i+o)-r,this._screenPositionX=`${Math.floor(e.x+.25)}px`,this._screenPositionY=`${Math.floor(e.y+.25)}px`}}};bb.prototype.animateAppear=function(){this._tweens.addProperty({object:this,property:"_scale",startValue:2,stopValue:1,duration:.8,easingFunction:ka.EXPONENTIAL_OUT})};bb.prototype.animateDepart=function(){this._tweens.addProperty({object:this,property:"_scale",startValue:this._scale,stopValue:1.5,duration:.8,easingFunction:ka.EXPONENTIAL_OUT})};Object.defineProperties(bb.prototype,{container:{get:function(){return this._container}},selectionIndicatorElement:{get:function(){return this._selectionIndicatorElement}},scene:{get:function(){return this._scene}}});function IE(e,t){if(!c(e))throw new E("container is required.");e=Do(e),this._container=e;const n=document.createElement("div");n.className="cesium-selection-wrapper",n.setAttribute("data-bind",'style: { "top" : _screenPositionY, "left" : _screenPositionX },css: { "cesium-selection-wrapper-visible" : isVisible }'),e.appendChild(n),this._element=n;const i="http://www.w3.org/2000/svg",o="M -34 -34 L -34 -11.25 L -30 -15.25 L -30 -30 L -15.25 -30 L -11.25 -34 L -34 -34 z M 11.25 -34 L 15.25 -30 L 30 -30 L 30 -15.25 L 34 -11.25 L 34 -34 L 11.25 -34 z M -34 11.25 L -34 34 L -11.25 34 L -15.25 30 L -30 30 L -30 15.25 L -34 11.25 z M 34 11.25 L 30 15.25 L 30 30 L 15.25 30 L 11.25 34 L 34 34 L 34 11.25 z",r=document.createElementNS(i,"svg:svg");r.setAttribute("width",160),r.setAttribute("height",160),r.setAttribute("viewBox","0 0 160 160");const s=document.createElementNS(i,"g");s.setAttribute("transform","translate(80,80)"),r.appendChild(s);const a=document.createElementNS(i,"path");a.setAttribute("data-bind","attr: { transform: _transform }"),a.setAttribute("d",o),s.appendChild(a),n.appendChild(r);const l=new bb(t,this._element,this._container);this._viewModel=l,He.applyBindings(this._viewModel,this._element)}Object.defineProperties(IE.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});IE.prototype.isDestroyed=function(){return!1};IE.prototype.destroy=function(){const e=this._container;return He.cleanNode(this._element),e.removeChild(this._element),ve(this)};function Zp(e,t,n){this._color=e,this._height=t,this._base=y(n,0)}Zp.prototype.getHeight=function(){return this._height};Zp.prototype.getBase=function(){return this._base};Zp.prototype.getStartTime=function(){return this._start};Zp.prototype.getStopTime=function(){return this._stop};Zp.prototype.setRange=function(e,t){this._start=e,this._stop=t};Zp.prototype.render=function(e){let t="";if(this._start&&this._stop&&this._color){const n=ie.secondsDifference(this._start,e.epochJulian);let i=Math.round(e.timeBarWidth*e.getAlpha(n));const o=ie.secondsDifference(this._stop,e.epochJulian);let r=Math.round(e.timeBarWidth*e.getAlpha(o))-i;i<0&&(r+=i,i=0),i+r>e.timeBarWidth&&(r=e.timeBarWidth-i),r>0&&(t=`<span class="cesium-timeline-highlight" style="left: ${i.toString()}px; width: ${r.toString()}px; bottom: ${this._base.toString()}px; height: ${this._height}px; background-color: ${this._color};"></span>`)}return t};function Rq(e,t,n,i){this.interval=e,this.height=t,this.color=n||new z(.5,.5,.5,1),this.backgroundColor=i||new z(0,0,0,0)}Rq.prototype.render=function(e,t){const n=this.interval.start,i=this.interval.stop,o=t.startJulian,r=ie.addSeconds(t.startJulian,t.duration,new ie);if(ie.lessThan(n,o)&&ie.greaterThan(i,r))e.fillStyle=this.color.toCssColorString(),e.fillRect(0,t.y,t.timeBarWidth,this.height);else if(ie.lessThanOrEquals(n,r)&&ie.greaterThanOrEquals(i,o)){let s,a,l;for(s=0;s<t.timeBarWidth;++s){const u=ie.addSeconds(t.startJulian,s/t.timeBarWidth*t.duration,new ie);!c(a)&&ie.greaterThanOrEquals(u,n)?a=s:!c(l)&&ie.greaterThanOrEquals(u,i)&&(l=s)}e.fillStyle=this.backgroundColor.toCssColorString(),e.fillRect(0,t.y,t.timeBarWidth,this.height),c(a)&&(c(l)||(l=t.timeBarWidth),e.fillStyle=this.color.toCssColorString(),e.fillRect(a,t.y,Math.max(l-a,1),this.height))}};let aI=1e12;const gc={none:0,scrub:1,slide:2,zoom:3,touchOnly:4},Rs={none:0,scrub:1,slideZoom:2,singleTap:3,ignore:4},Zd=[.001,.002,.005,.01,.02,.05,.1,.25,.5,1,2,5,10,15,30,60,120,300,600,900,1800,3600,7200,14400,21600,43200,86400,172800,345600,604800,1296e3,2592e3,5184e3,7776e3,15552e3,31536e3,63072e3,126144e3,15768e4,31536e4,63072e4,126144e4,15768e5,31536e5,63072e5,126144e5,15768e6,31536e6],ije=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Ws(e,t){if(!c(e))throw new E("container is required.");if(!c(t))throw new E("clock is required.");e=Do(e);const n=e.ownerDocument;this.container=e;const i=n.createElement("div");i.className="cesium-timeline-main",e.appendChild(i),this._topDiv=i,this._endJulian=void 0,this._epochJulian=void 0,this._lastXPos=void 0,this._scrubElement=void 0,this._startJulian=void 0,this._timeBarSecondsSpan=void 0,this._clock=t,this._scrubJulian=t.currentTime,this._mainTicSpan=-1,this._mouseMode=gc.none,this._touchMode=Rs.none,this._touchState={centerX:0,spanX:0},this._mouseX=0,this._timelineDrag=0,this._timelineDragLocation=void 0,this._lastHeight=void 0,this._lastWidth=void 0,this._topDiv.innerHTML='<div class="cesium-timeline-bar"></div><div class="cesium-timeline-trackContainer"><canvas class="cesium-timeline-tracks" width="10" height="1"></canvas></div><div class="cesium-timeline-needle"></div><span class="cesium-timeline-ruler"></span>',this._timeBarEle=this._topDiv.childNodes[0],this._trackContainer=this._topDiv.childNodes[1],this._trackListEle=this._topDiv.childNodes[1].childNodes[0],this._needleEle=this._topDiv.childNodes[2],this._rulerEle=this._topDiv.childNodes[3],this._context=this._trackListEle.getContext("2d"),this._trackList=[],this._highlightRanges=[],this.zoomTo(t.startTime,t.stopTime),this._onMouseDown=oje(this),this._onMouseUp=rje(this),this._onMouseMove=sje(this),this._onMouseWheel=aje(this),this._onTouchStart=cje(this),this._onTouchMove=uje(this),this._onTouchEnd=lje(this);const o=this._timeBarEle;n.addEventListener("mouseup",this._onMouseUp,!1),n.addEventListener("mousemove",this._onMouseMove,!1),o.addEventListener("mousedown",this._onMouseDown,!1),o.addEventListener("DOMMouseScroll",this._onMouseWheel,!1),o.addEventListener("mousewheel",this._onMouseWheel,!1),o.addEventListener("touchstart",this._onTouchStart,!1),o.addEventListener("touchmove",this._onTouchMove,!1),o.addEventListener("touchend",this._onTouchEnd,!1),o.addEventListener("touchcancel",this._onTouchEnd,!1),this._topDiv.oncontextmenu=function(){return!1},t.onTick.addEventListener(this.updateFromClock,this),this.updateFromClock()}Ws.prototype.addEventListener=function(e,t,n){this._topDiv.addEventListener(e,t,n)};Ws.prototype.removeEventListener=function(e,t,n){this._topDiv.removeEventListener(e,t,n)};Ws.prototype.isDestroyed=function(){return!1};Ws.prototype.destroy=function(){this._clock.onTick.removeEventListener(this.updateFromClock,this);const e=this.container.ownerDocument;e.removeEventListener("mouseup",this._onMouseUp,!1),e.removeEventListener("mousemove",this._onMouseMove,!1);const t=this._timeBarEle;t.removeEventListener("mousedown",this._onMouseDown,!1),t.removeEventListener("DOMMouseScroll",this._onMouseWheel,!1),t.removeEventListener("mousewheel",this._onMouseWheel,!1),t.removeEventListener("touchstart",this._onTouchStart,!1),t.removeEventListener("touchmove",this._onTouchMove,!1),t.removeEventListener("touchend",this._onTouchEnd,!1),t.removeEventListener("touchcancel",this._onTouchEnd,!1),this.container.removeChild(this._topDiv),ve(this)};Ws.prototype.addHighlightRange=function(e,t,n){const i=new Zp(e,t,n);return this._highlightRanges.push(i),this.resize(),i};Ws.prototype.addTrack=function(e,t,n,i){const o=new Rq(e,t,n,i);return this._trackList.push(o),this._lastHeight=void 0,this.resize(),o};Ws.prototype.zoomTo=function(e,t){if(!c(e))throw new E("startTime is required.");if(!c(t))throw new E("stopTime is required");if(ie.lessThanOrEquals(t,e))throw new E("Start time must come before end time.");if(this._startJulian=e,this._endJulian=t,this._timeBarSecondsSpan=ie.secondsDifference(t,e),this._clock&&this._clock.clockRange!==rp.UNBOUNDED){const i=this._clock.startTime,o=this._clock.stopTime,r=ie.secondsDifference(o,i),s=ie.secondsDifference(i,this._startJulian),a=ie.secondsDifference(o,this._endJulian);this._timeBarSecondsSpan>=r?(this._timeBarSecondsSpan=r,this._startJulian=this._clock.startTime,this._endJulian=this._clock.stopTime):s>0?(this._endJulian=ie.addSeconds(this._endJulian,s,new ie),this._startJulian=i,this._timeBarSecondsSpan=ie.secondsDifference(this._endJulian,this._startJulian)):a<0&&(this._startJulian=ie.addSeconds(this._startJulian,a,new ie),this._endJulian=o,this._timeBarSecondsSpan=ie.secondsDifference(this._endJulian,this._startJulian))}this._makeTics();const n=document.createEvent("Event");n.initEvent("setzoom",!0,!0),n.startJulian=this._startJulian,n.endJulian=this._endJulian,n.epochJulian=this._epochJulian,n.totalSpan=this._timeBarSecondsSpan,n.mainTicSpan=this._mainTicSpan,this._topDiv.dispatchEvent(n)};Ws.prototype.zoomFrom=function(e){let t=ie.secondsDifference(this._scrubJulian,this._startJulian);e>1||t<0||t>this._timeBarSecondsSpan?t=this._timeBarSecondsSpan*.5:t+=t-this._timeBarSecondsSpan*.5;const n=this._timeBarSecondsSpan-t;this.zoomTo(ie.addSeconds(this._startJulian,t-t*e,new ie),ie.addSeconds(this._endJulian,n*e-n,new ie))};function cI(e){return e<10?`0${e.toString()}`:e.toString()}Ws.prototype.makeLabel=function(e){const t=ie.toGregorianDate(e),n=t.millisecond;let i=" UTC";if(n>0&&this._timeBarSecondsSpan<3600){for(i=Math.floor(n).toString();i.length<3;)i=`0${i}`;i=`.${i}`}return`${ije[t.month-1]} ${t.day} ${t.year} ${cI(t.hour)}:${cI(t.minute)}:${cI(t.second)}${i}`};Ws.prototype.smallestTicInPixels=7;Ws.prototype._makeTics=function(){const e=this._timeBarEle,t=ie.secondsDifference(this._scrubJulian,this._startJulian),n=Math.round(t*this._topDiv.clientWidth/this._timeBarSecondsSpan),i=n-8;let o;const r=this;this._needleEle.style.left=`${n.toString()}px`;let s="";const a=.01,l=31536e6,u=1e-10;let h=0,f=this._timeBarSecondsSpan;f<a?(f=a,this._timeBarSecondsSpan=a,this._endJulian=ie.addSeconds(this._startJulian,a,new ie)):f>l&&(f=l,this._timeBarSecondsSpan=l,this._endJulian=ie.addSeconds(this._startJulian,l,new ie));let _=this._timeBarEle.clientWidth;_<10&&(_=10);const g=this._startJulian,m=Math.min(f/_*1e-5,.4);let b;const T=ie.toGregorianDate(g);f>31536e4?b=ie.fromDate(new Date(Date.UTC(Math.floor(T.year/100)*100,0))):f>31536e3?b=ie.fromDate(new Date(Date.UTC(Math.floor(T.year/10)*10,0))):f>86400?b=ie.fromDate(new Date(Date.UTC(T.year,0))):b=ie.fromDate(new Date(Date.UTC(T.year,T.month,T.day)));const x=ie.secondsDifference(this._startJulian,ie.addSeconds(b,m,new ie));let C=x+f;this._epochJulian=b;function w(W){return Math.floor(x/W)*W}function v(W,X){return Math.ceil(W/X+.5)*X}function P(W){return(W-x)/f}function N(W,X){return W-X*Math.round(W/X)}this._rulerEle.innerHTML=this.makeLabel(ie.addSeconds(this._endJulian,-a,new ie));let k=this._rulerEle.offsetWidth+20;k<30&&(k=180);const M=h;h-=u;const U={startTime:x,startJulian:g,epochJulian:b,duration:f,timeBarWidth:_,getAlpha:P};this._highlightRanges.forEach(function(W){s+=W.render(U)});let B=0,S=0,D=0,p=k/_;p>1&&(p=1),p*=this._timeBarSecondsSpan;let I=-1,O=-1;const F=Zd.length;let V;for(V=0;V<F;++V){const W=Zd[V];if(++I,B=W,W>p&&W>h)break;O<0&&_*(W/this._timeBarSecondsSpan)>=this.smallestTicInPixels&&(O=I)}if(I>0){for(;I>0;)if(--I,Math.abs(N(B,Zd[I]))<1e-5){Zd[I]>=h&&(S=Zd[I]);break}if(O>=0)for(;O<I;){if(Math.abs(N(S,Zd[O]))<1e-5&&Zd[O]>=h){D=Zd[O];break}++O}}h=M,h>u&&D<1e-5&&Math.abs(h-B)>u&&(D=h,h<=B+u&&(S=0));let G=-999999,j;if(_*(D/this._timeBarSecondsSpan)>=3)for(o=w(D);o<=C;o=v(o,D))s+=`<span class="cesium-timeline-ticTiny" style="left: ${Math.round(_*P(o)).toString()}px;"></span>`;if(_*(S/this._timeBarSecondsSpan)>=3)for(o=w(S);o<=C;o=v(o,S))s+=`<span class="cesium-timeline-ticSub" style="left: ${Math.round(_*P(o)).toString()}px;"></span>`;if(_*(B/this._timeBarSecondsSpan)>=2){this._mainTicSpan=B,C+=B,o=w(B);const W=ie.computeTaiMinusUtc(b);for(;o<=C;){let X=ie.addSeconds(g,o-x,new ie);if(B>2.1){const ne=ie.computeTaiMinusUtc(X);Math.abs(ne-W)>.1&&(o+=ne-W,X=ie.addSeconds(g,o-x,new ie))}const q=Math.round(_*P(o)),ee=this.makeLabel(X);this._rulerEle.innerHTML=ee,j=this._rulerEle.offsetWidth,j<10&&(j=k);const Y=q-(j/2-1);Y>G?(G=Y+j+5,s+=`<span class="cesium-timeline-ticMain" style="left: ${q.toString()}px;"></span><span class="cesium-timeline-ticLabel" style="left: ${Y.toString()}px;">${ee}</span>`):s+=`<span class="cesium-timeline-ticSub" style="left: ${q.toString()}px;"></span>`,o=v(o,B)}}else this._mainTicSpan=-1;s+=`<span class="cesium-timeline-icon16" style="left:${i}px;bottom:0;background-position: 0 0;"></span>`,e.innerHTML=s,this._scrubElement=e.lastChild,this._context.clearRect(0,0,this._trackListEle.width,this._trackListEle.height),U.y=0,this._trackList.forEach(function(W){W.render(r._context,U),U.y+=W.height})};Ws.prototype.updateFromClock=function(){this._scrubJulian=this._clock.currentTime;const e=this._scrubElement;if(c(this._scrubElement)){const t=ie.secondsDifference(this._scrubJulian,this._startJulian),n=Math.round(t*this._topDiv.clientWidth/this._timeBarSecondsSpan);this._lastXPos!==n&&(this._lastXPos=n,e.style.left=`${n-8}px`,this._needleEle.style.left=`${n}px`)}c(this._timelineDragLocation)&&(this._setTimeBarTime(this._timelineDragLocation,this._timelineDragLocation*this._timeBarSecondsSpan/this._topDiv.clientWidth),this.zoomTo(ie.addSeconds(this._startJulian,this._timelineDrag,new ie),ie.addSeconds(this._endJulian,this._timelineDrag,new ie)))};Ws.prototype._setTimeBarTime=function(e,t){if(e=Math.round(e),this._scrubJulian=ie.addSeconds(this._startJulian,t,new ie),this._scrubElement){const i=e-8;this._scrubElement.style.left=`${i.toString()}px`,this._needleEle.style.left=`${e.toString()}px`}const n=document.createEvent("Event");n.initEvent("settime",!0,!0),n.clientX=e,n.timeSeconds=t,n.timeJulian=this._scrubJulian,n.clock=this._clock,this._topDiv.dispatchEvent(n)};function oje(e){return function(t){e._mouseMode!==gc.touchOnly&&(t.button===0?(e._mouseMode=gc.scrub,e._scrubElement&&(e._scrubElement.style.backgroundPosition="-16px 0"),e._onMouseMove(t)):(e._mouseX=t.clientX,t.button===2?e._mouseMode=gc.zoom:e._mouseMode=gc.slide)),t.preventDefault()}}function rje(e){return function(t){e._mouseMode=gc.none,e._scrubElement&&(e._scrubElement.style.backgroundPosition="0 0"),e._timelineDrag=0,e._timelineDragLocation=void 0}}function sje(e){return function(t){let n;if(e._mouseMode===gc.scrub){t.preventDefault();const i=t.clientX-e._topDiv.getBoundingClientRect().left;i<0?(e._timelineDragLocation=0,e._timelineDrag=-.01*e._timeBarSecondsSpan):i>e._topDiv.clientWidth?(e._timelineDragLocation=e._topDiv.clientWidth,e._timelineDrag=.01*e._timeBarSecondsSpan):(e._timelineDragLocation=void 0,e._setTimeBarTime(i,i*e._timeBarSecondsSpan/e._topDiv.clientWidth))}else if(e._mouseMode===gc.slide){if(n=e._mouseX-t.clientX,e._mouseX=t.clientX,n!==0){const i=n*e._timeBarSecondsSpan/e._topDiv.clientWidth;e.zoomTo(ie.addSeconds(e._startJulian,i,new ie),ie.addSeconds(e._endJulian,i,new ie))}}else e._mouseMode===gc.zoom&&(n=e._mouseX-t.clientX,e._mouseX=t.clientX,n!==0&&e.zoomFrom(Math.pow(1.01,n)))}}function aje(e){return function(t){let n=t.wheelDeltaY||t.wheelDelta||-t.detail;aI=Math.max(Math.min(Math.abs(n),aI),1),n/=aI,e.zoomFrom(Math.pow(1.05,-n))}}function cje(e){return function(t){const n=t.touches.length;let i,o;const r=e._topDiv.getBoundingClientRect().left;t.preventDefault(),e._mouseMode=gc.touchOnly,n===1?(i=ie.secondsDifference(e._scrubJulian,e._startJulian),o=Math.round(i*e._topDiv.clientWidth/e._timeBarSecondsSpan+r),Math.abs(t.touches[0].clientX-o)<50?(e._touchMode=Rs.scrub,e._scrubElement&&(e._scrubElement.style.backgroundPosition=n===1?"-16px 0":"0 0")):(e._touchMode=Rs.singleTap,e._touchState.centerX=t.touches[0].clientX-r)):n===2?(e._touchMode=Rs.slideZoom,e._touchState.centerX=(t.touches[0].clientX+t.touches[1].clientX)*.5-r,e._touchState.spanX=Math.abs(t.touches[0].clientX-t.touches[1].clientX)):e._touchMode=Rs.ignore}}function lje(e){return function(t){const n=t.touches.length,i=e._topDiv.getBoundingClientRect().left;e._touchMode===Rs.singleTap?(e._touchMode=Rs.scrub,e._onTouchMove(t)):e._touchMode===Rs.scrub&&e._onTouchMove(t),e._mouseMode=gc.touchOnly,n!==1?e._touchMode=n>0?Rs.ignore:Rs.none:e._touchMode===Rs.slideZoom&&(e._touchState.centerX=t.touches[0].clientX-i),e._scrubElement&&(e._scrubElement.style.backgroundPosition="0 0")}}function uje(e){return function(t){let n,i,o,r,s,a,l=1;const u=e._topDiv.getBoundingClientRect().left;e._touchMode===Rs.singleTap&&(e._touchMode=Rs.slideZoom),e._mouseMode=gc.touchOnly,e._touchMode===Rs.scrub?(t.preventDefault(),t.changedTouches.length===1&&(i=t.changedTouches[0].clientX-u,i>=0&&i<=e._topDiv.clientWidth&&e._setTimeBarTime(i,i*e._timeBarSecondsSpan/e._topDiv.clientWidth))):e._touchMode===Rs.slideZoom&&(o=t.touches.length,o===2?(r=(t.touches[0].clientX+t.touches[1].clientX)*.5-u,s=Math.abs(t.touches[0].clientX-t.touches[1].clientX)):o===1&&(r=t.touches[0].clientX-u,s=0),c(r)&&(s>0&&e._touchState.spanX>0?(l=e._touchState.spanX/s,a=ie.addSeconds(e._startJulian,(e._touchState.centerX*e._timeBarSecondsSpan-r*e._timeBarSecondsSpan*l)/e._topDiv.clientWidth,new ie)):(n=e._touchState.centerX-r,a=ie.addSeconds(e._startJulian,n*e._timeBarSecondsSpan/e._topDiv.clientWidth,new ie)),e.zoomTo(a,ie.addSeconds(a,e._timeBarSecondsSpan*l,new ie)),e._touchState.centerX=r,e._touchState.spanX=s))}}Ws.prototype.resize=function(){const e=this.container.clientWidth,t=this.container.clientHeight;if(e===this._lastWidth&&t===this._lastHeight)return;this._trackContainer.style.height=`${t}px`;let n=1;this._trackList.forEach(function(i){n+=i.height}),this._trackListEle.style.height=`${n.toString()}px`,this._trackListEle.width=this._trackListEle.clientWidth,this._trackListEle.height=n,this._makeTics(),this._lastXPos=void 0,this._lastWidth=e,this._lastHeight=t};var dje={webm:"data:video/webm;base64,GkXfowEAAAAAAAAfQoaBAUL3gQFC8oEEQvOBCEKChHdlYm1Ch4EEQoWBAhhTgGcBAAAAAAAVkhFNm3RALE27i1OrhBVJqWZTrIHfTbuMU6uEFlSua1OsggEwTbuMU6uEHFO7a1OsghV17AEAAAAAAACkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmAQAAAAAAAEUq17GDD0JATYCNTGF2ZjU1LjMzLjEwMFdBjUxhdmY1NS4zMy4xMDBzpJBlrrXf3DCDVB8KcgbMpcr+RImIQJBgAAAAAAAWVK5rAQAAAAAAD++uAQAAAAAAADLXgQFzxYEBnIEAIrWcg3VuZIaFVl9WUDiDgQEj44OEAmJaAOABAAAAAAAABrCBsLqBkK4BAAAAAAAPq9eBAnPFgQKcgQAitZyDdW5khohBX1ZPUkJJU4OBAuEBAAAAAAAAEZ+BArWIQOdwAAAAAABiZIEgY6JPbwIeVgF2b3JiaXMAAAAAAoC7AAAAAAAAgLUBAAAAAAC4AQN2b3JiaXMtAAAAWGlwaC5PcmcgbGliVm9yYmlzIEkgMjAxMDExMDEgKFNjaGF1ZmVudWdnZXQpAQAAABUAAABlbmNvZGVyPUxhdmM1NS41Mi4xMDIBBXZvcmJpcyVCQ1YBAEAAACRzGCpGpXMWhBAaQlAZ4xxCzmvsGUJMEYIcMkxbyyVzkCGkoEKIWyiB0JBVAABAAACHQXgUhIpBCCGEJT1YkoMnPQghhIg5eBSEaUEIIYQQQgghhBBCCCGERTlokoMnQQgdhOMwOAyD5Tj4HIRFOVgQgydB6CCED0K4moOsOQghhCQ1SFCDBjnoHITCLCiKgsQwuBaEBDUojILkMMjUgwtCiJqDSTX4GoRnQXgWhGlBCCGEJEFIkIMGQcgYhEZBWJKDBjm4FITLQagahCo5CB+EIDRkFQCQAACgoiiKoigKEBqyCgDIAAAQQFEUx3EcyZEcybEcCwgNWQUAAAEACAAAoEiKpEiO5EiSJFmSJVmSJVmS5omqLMuyLMuyLMsyEBqyCgBIAABQUQxFcRQHCA1ZBQBkAAAIoDiKpViKpWiK54iOCISGrAIAgAAABAAAEDRDUzxHlETPVFXXtm3btm3btm3btm3btm1blmUZCA1ZBQBAAAAQ0mlmqQaIMAMZBkJDVgEACAAAgBGKMMSA0JBVAABAAACAGEoOogmtOd+c46BZDppKsTkdnEi1eZKbirk555xzzsnmnDHOOeecopxZDJoJrTnnnMSgWQqaCa0555wnsXnQmiqtOeeccc7pYJwRxjnnnCateZCajbU555wFrWmOmkuxOeecSLl5UptLtTnnnHPOOeecc84555zqxekcnBPOOeecqL25lpvQxTnnnE/G6d6cEM4555xzzjnnnHPOOeecIDRkFQAABABAEIaNYdwpCNLnaCBGEWIaMulB9+gwCRqDnELq0ehopJQ6CCWVcVJKJwgNWQUAAAIAQAghhRRSSCGFFFJIIYUUYoghhhhyyimnoIJKKqmooowyyyyzzDLLLLPMOuyssw47DDHEEEMrrcRSU2011lhr7jnnmoO0VlprrbVSSimllFIKQkNWAQAgAAAEQgYZZJBRSCGFFGKIKaeccgoqqIDQkFUAACAAgAAAAABP8hzRER3RER3RER3RER3R8RzPESVREiVREi3TMjXTU0VVdWXXlnVZt31b2IVd933d933d+HVhWJZlWZZlWZZlWZZlWZZlWZYgNGQVAAACAAAghBBCSCGFFFJIKcYYc8w56CSUEAgNWQUAAAIACAAAAHAUR3EcyZEcSbIkS9IkzdIsT/M0TxM9URRF0zRV0RVdUTdtUTZl0zVdUzZdVVZtV5ZtW7Z125dl2/d93/d93/d93/d93/d9XQdCQ1YBABIAADqSIymSIimS4ziOJElAaMgqAEAGAEAAAIriKI7jOJIkSZIlaZJneZaomZrpmZ4qqkBoyCoAABAAQAAAAAAAAIqmeIqpeIqoeI7oiJJomZaoqZoryqbsuq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq4LhIasAgAkAAB0JEdyJEdSJEVSJEdygNCQVQCADACAAAAcwzEkRXIsy9I0T/M0TxM90RM901NFV3SB0JBVAAAgAIAAAAAAAAAMybAUy9EcTRIl1VItVVMt1VJF1VNVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVN0zRNEwgNWQkAkAEAkBBTLS3GmgmLJGLSaqugYwxS7KWxSCpntbfKMYUYtV4ah5RREHupJGOKQcwtpNApJq3WVEKFFKSYYyoVUg5SIDRkhQAQmgHgcBxAsixAsiwAAAAAAAAAkDQN0DwPsDQPAAAAAAAAACRNAyxPAzTPAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABA0jRA8zxA8zwAAAAAAAAA0DwP8DwR8EQRAAAAAAAAACzPAzTRAzxRBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABA0jRA8zxA8zwAAAAAAAAAsDwP8EQR0DwRAAAAAAAAACzPAzxRBDzRAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAEOAAABBgIRQasiIAiBMAcEgSJAmSBM0DSJYFTYOmwTQBkmVB06BpME0AAAAAAAAAAAAAJE2DpkHTIIoASdOgadA0iCIAAAAAAAAAAAAAkqZB06BpEEWApGnQNGgaRBEAAAAAAAAAAAAAzzQhihBFmCbAM02IIkQRpgkAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAGHAAAAgwoQwUGrIiAIgTAHA4imUBAIDjOJYFAACO41gWAABYliWKAABgWZooAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAYcAAACDChDBQashIAiAIAcCiKZQHHsSzgOJYFJMmyAJYF0DyApgFEEQAIAAAocAAACLBBU2JxgEJDVgIAUQAABsWxLE0TRZKkaZoniiRJ0zxPFGma53meacLzPM80IYqiaJoQRVE0TZimaaoqME1VFQAAUOAAABBgg6bE4gCFhqwEAEICAByKYlma5nmeJ4qmqZokSdM8TxRF0TRNU1VJkqZ5niiKommapqqyLE3zPFEURdNUVVWFpnmeKIqiaaqq6sLzPE8URdE0VdV14XmeJ4qiaJqq6roQRVE0TdNUTVV1XSCKpmmaqqqqrgtETxRNU1Vd13WB54miaaqqq7ouEE3TVFVVdV1ZBpimaaqq68oyQFVV1XVdV5YBqqqqruu6sgxQVdd1XVmWZQCu67qyLMsCAAAOHAAAAoygk4wqi7DRhAsPQKEhKwKAKAAAwBimFFPKMCYhpBAaxiSEFEImJaXSUqogpFJSKRWEVEoqJaOUUmopVRBSKamUCkIqJZVSAADYgQMA2IGFUGjISgAgDwCAMEYpxhhzTiKkFGPOOScRUoox55yTSjHmnHPOSSkZc8w556SUzjnnnHNSSuacc845KaVzzjnnnJRSSuecc05KKSWEzkEnpZTSOeecEwAAVOAAABBgo8jmBCNBhYasBABSAQAMjmNZmuZ5omialiRpmud5niiapiZJmuZ5nieKqsnzPE8URdE0VZXneZ4oiqJpqirXFUXTNE1VVV2yLIqmaZqq6rowTdNUVdd1XZimaaqq67oubFtVVdV1ZRm2raqq6rqyDFzXdWXZloEsu67s2rIAAPAEBwCgAhtWRzgpGgssNGQlAJABAEAYg5BCCCFlEEIKIYSUUggJAAAYcAAACDChDBQashIASAUAAIyx1lprrbXWQGettdZaa62AzFprrbXWWmuttdZaa6211lJrrbXWWmuttdZaa6211lprrbXWWmuttdZaa6211lprrbXWWmuttdZaa6211lprrbXWWmstpZRSSimllFJKKaWUUkoppZRSSgUA+lU4APg/2LA6wknRWGChISsBgHAAAMAYpRhzDEIppVQIMeacdFRai7FCiDHnJKTUWmzFc85BKCGV1mIsnnMOQikpxVZjUSmEUlJKLbZYi0qho5JSSq3VWIwxqaTWWoutxmKMSSm01FqLMRYjbE2ptdhqq7EYY2sqLbQYY4zFCF9kbC2m2moNxggjWywt1VprMMYY3VuLpbaaizE++NpSLDHWXAAAd4MDAESCjTOsJJ0VjgYXGrISAAgJACAQUooxxhhzzjnnpFKMOeaccw5CCKFUijHGnHMOQgghlIwx5pxzEEIIIYRSSsaccxBCCCGEkFLqnHMQQgghhBBKKZ1zDkIIIYQQQimlgxBCCCGEEEoopaQUQgghhBBCCKmklEIIIYRSQighlZRSCCGEEEIpJaSUUgohhFJCCKGElFJKKYUQQgillJJSSimlEkoJJYQSUikppRRKCCGUUkpKKaVUSgmhhBJKKSWllFJKIYQQSikFAAAcOAAABBhBJxlVFmGjCRcegEJDVgIAZAAAkKKUUiktRYIipRikGEtGFXNQWoqocgxSzalSziDmJJaIMYSUk1Qy5hRCDELqHHVMKQYtlRhCxhik2HJLoXMOAAAAQQCAgJAAAAMEBTMAwOAA4XMQdAIERxsAgCBEZohEw0JweFAJEBFTAUBigkIuAFRYXKRdXECXAS7o4q4DIQQhCEEsDqCABByccMMTb3jCDU7QKSp1IAAAAAAADADwAACQXAAREdHMYWRobHB0eHyAhIiMkAgAAAAAABcAfAAAJCVAREQ0cxgZGhscHR4fICEiIyQBAIAAAgAAAAAggAAEBAQAAAAAAAIAAAAEBB9DtnUBAAAAAAAEPueBAKOFggAAgACjzoEAA4BwBwCdASqwAJAAAEcIhYWIhYSIAgIABhwJ7kPfbJyHvtk5D32ych77ZOQ99snIe+2TkPfbJyHvtk5D32ych77ZOQ99YAD+/6tQgKOFggADgAqjhYIAD4AOo4WCACSADqOZgQArADECAAEQEAAYABhYL/QACIBDmAYAAKOFggA6gA6jhYIAT4AOo5mBAFMAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAGSADqOFggB6gA6jmYEAewAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIAj4AOo5mBAKMAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAKSADqOFggC6gA6jmYEAywAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIAz4AOo4WCAOSADqOZgQDzADECAAEQEAAYABhYL/QACIBDmAYAAKOFggD6gA6jhYIBD4AOo5iBARsAEQIAARAQFGAAYWC/0AAiAQ5gGACjhYIBJIAOo4WCATqADqOZgQFDADECAAEQEAAYABhYL/QACIBDmAYAAKOFggFPgA6jhYIBZIAOo5mBAWsAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAXqADqOFggGPgA6jmYEBkwAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIBpIAOo4WCAbqADqOZgQG7ADECAAEQEAAYABhYL/QACIBDmAYAAKOFggHPgA6jmYEB4wAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIB5IAOo4WCAfqADqOZgQILADECAAEQEAAYABhYL/QACIBDmAYAAKOFggIPgA6jhYICJIAOo5mBAjMAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAjqADqOFggJPgA6jmYECWwAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYICZIAOo4WCAnqADqOZgQKDADECAAEQEAAYABhYL/QACIBDmAYAAKOFggKPgA6jhYICpIAOo5mBAqsAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCArqADqOFggLPgA6jmIEC0wARAgABEBAUYABhYL/QACIBDmAYAKOFggLkgA6jhYIC+oAOo5mBAvsAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAw+ADqOZgQMjADECAAEQEAAYABhYL/QACIBDmAYAAKOFggMkgA6jhYIDOoAOo5mBA0sAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCA0+ADqOFggNkgA6jmYEDcwAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIDeoAOo4WCA4+ADqOZgQObADECAAEQEAAYABhYL/QACIBDmAYAAKOFggOkgA6jhYIDuoAOo5mBA8MAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCA8+ADqOFggPkgA6jhYID+oAOo4WCBA+ADhxTu2sBAAAAAAAAEbuPs4EDt4r3gQHxghEr8IEK",mp4:"data:video/mp4;base64,AAAAHGZ0eXBNNFYgAAACAGlzb21pc28yYXZjMQAAAAhmcmVlAAAGF21kYXTeBAAAbGliZmFhYyAxLjI4AABCAJMgBDIARwAAArEGBf//rdxF6b3m2Ui3lizYINkj7u94MjY0IC0gY29yZSAxNDIgcjIgOTU2YzhkOCAtIEguMjY0L01QRUctNCBBVkMgY29kZWMgLSBDb3B5bGVmdCAyMDAzLTIwMTQgLSBodHRwOi8vd3d3LnZpZGVvbGFuLm9yZy94MjY0Lmh0bWwgLSBvcHRpb25zOiBjYWJhYz0wIHJlZj0zIGRlYmxvY2s9MTowOjAgYW5hbHlzZT0weDE6MHgxMTEgbWU9aGV4IHN1Ym1lPTcgcHN5PTEgcHN5X3JkPTEuMDA6MC4wMCBtaXhlZF9yZWY9MSBtZV9yYW5nZT0xNiBjaHJvbWFfbWU9MSB0cmVsbGlzPTEgOHg4ZGN0PTAgY3FtPTAgZGVhZHpvbmU9MjEsMTEgZmFzdF9wc2tpcD0xIGNocm9tYV9xcF9vZmZzZXQ9LTIgdGhyZWFkcz02IGxvb2thaGVhZF90aHJlYWRzPTEgc2xpY2VkX3RocmVhZHM9MCBucj0wIGRlY2ltYXRlPTEgaW50ZXJsYWNlZD0wIGJsdXJheV9jb21wYXQ9MCBjb25zdHJhaW5lZF9pbnRyYT0wIGJmcmFtZXM9MCB3ZWlnaHRwPTAga2V5aW50PTI1MCBrZXlpbnRfbWluPTI1IHNjZW5lY3V0PTQwIGludHJhX3JlZnJlc2g9MCByY19sb29rYWhlYWQ9NDAgcmM9Y3JmIG1idHJlZT0xIGNyZj0yMy4wIHFjb21wPTAuNjAgcXBtaW49MCBxcG1heD02OSBxcHN0ZXA9NCB2YnZfbWF4cmF0ZT03NjggdmJ2X2J1ZnNpemU9MzAwMCBjcmZfbWF4PTAuMCBuYWxfaHJkPW5vbmUgZmlsbGVyPTAgaXBfcmF0aW89MS40MCBhcT0xOjEuMDAAgAAAAFZliIQL8mKAAKvMnJycnJycnJycnXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXiEASZACGQAjgCEASZACGQAjgAAAAAdBmjgX4GSAIQBJkAIZACOAAAAAB0GaVAX4GSAhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZpgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGagC/AySEASZACGQAjgAAAAAZBmqAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZrAL8DJIQBJkAIZACOAAAAABkGa4C/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmwAvwMkhAEmQAhkAI4AAAAAGQZsgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGbQC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBm2AvwMkhAEmQAhkAI4AAAAAGQZuAL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGboC/AySEASZACGQAjgAAAAAZBm8AvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZvgL8DJIQBJkAIZACOAAAAABkGaAC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmiAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZpAL8DJIQBJkAIZACOAAAAABkGaYC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmoAvwMkhAEmQAhkAI4AAAAAGQZqgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGawC/AySEASZACGQAjgAAAAAZBmuAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZsAL8DJIQBJkAIZACOAAAAABkGbIC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBm0AvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZtgL8DJIQBJkAIZACOAAAAABkGbgCvAySEASZACGQAjgCEASZACGQAjgAAAAAZBm6AnwMkhAEmQAhkAI4AhAEmQAhkAI4AhAEmQAhkAI4AhAEmQAhkAI4AAAAhubW9vdgAAAGxtdmhkAAAAAAAAAAAAAAAAAAAD6AAABDcAAQAAAQAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAzB0cmFrAAAAXHRraGQAAAADAAAAAAAAAAAAAAABAAAAAAAAA+kAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAALAAAACQAAAAAAAkZWR0cwAAABxlbHN0AAAAAAAAAAEAAAPpAAAAAAABAAAAAAKobWRpYQAAACBtZGhkAAAAAAAAAAAAAAAAAAB1MAAAdU5VxAAAAAAALWhkbHIAAAAAAAAAAHZpZGUAAAAAAAAAAAAAAABWaWRlb0hhbmRsZXIAAAACU21pbmYAAAAUdm1oZAAAAAEAAAAAAAAAAAAAACRkaW5mAAAAHGRyZWYAAAAAAAAAAQAAAAx1cmwgAAAAAQAAAhNzdGJsAAAAr3N0c2QAAAAAAAAAAQAAAJ9hdmMxAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAALAAkABIAAAASAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGP//AAAALWF2Y0MBQsAN/+EAFWdCwA3ZAsTsBEAAAPpAADqYA8UKkgEABWjLg8sgAAAAHHV1aWRraEDyXyRPxbo5pRvPAyPzAAAAAAAAABhzdHRzAAAAAAAAAAEAAAAeAAAD6QAAABRzdHNzAAAAAAAAAAEAAAABAAAAHHN0c2MAAAAAAAAAAQAAAAEAAAABAAAAAQAAAIxzdHN6AAAAAAAAAAAAAAAeAAADDwAAAAsAAAALAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAAiHN0Y28AAAAAAAAAHgAAAEYAAANnAAADewAAA5gAAAO0AAADxwAAA+MAAAP2AAAEEgAABCUAAARBAAAEXQAABHAAAASMAAAEnwAABLsAAATOAAAE6gAABQYAAAUZAAAFNQAABUgAAAVkAAAFdwAABZMAAAWmAAAFwgAABd4AAAXxAAAGDQAABGh0cmFrAAAAXHRraGQAAAADAAAAAAAAAAAAAAACAAAAAAAABDcAAAAAAAAAAAAAAAEBAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAkZWR0cwAAABxlbHN0AAAAAAAAAAEAAAQkAAADcAABAAAAAAPgbWRpYQAAACBtZGhkAAAAAAAAAAAAAAAAAAC7gAAAykBVxAAAAAAALWhkbHIAAAAAAAAAAHNvdW4AAAAAAAAAAAAAAABTb3VuZEhhbmRsZXIAAAADi21pbmYAAAAQc21oZAAAAAAAAAAAAAAAJGRpbmYAAAAcZHJlZgAAAAAAAAABAAAADHVybCAAAAABAAADT3N0YmwAAABnc3RzZAAAAAAAAAABAAAAV21wNGEAAAAAAAAAAQAAAAAAAAAAAAIAEAAAAAC7gAAAAAAAM2VzZHMAAAAAA4CAgCIAAgAEgICAFEAVBbjYAAu4AAAADcoFgICAAhGQBoCAgAECAAAAIHN0dHMAAAAAAAAAAgAAADIAAAQAAAAAAQAAAkAAAAFUc3RzYwAAAAAAAAAbAAAAAQAAAAEAAAABAAAAAgAAAAIAAAABAAAAAwAAAAEAAAABAAAABAAAAAIAAAABAAAABgAAAAEAAAABAAAABwAAAAIAAAABAAAACAAAAAEAAAABAAAACQAAAAIAAAABAAAACgAAAAEAAAABAAAACwAAAAIAAAABAAAADQAAAAEAAAABAAAADgAAAAIAAAABAAAADwAAAAEAAAABAAAAEAAAAAIAAAABAAAAEQAAAAEAAAABAAAAEgAAAAIAAAABAAAAFAAAAAEAAAABAAAAFQAAAAIAAAABAAAAFgAAAAEAAAABAAAAFwAAAAIAAAABAAAAGAAAAAEAAAABAAAAGQAAAAIAAAABAAAAGgAAAAEAAAABAAAAGwAAAAIAAAABAAAAHQAAAAEAAAABAAAAHgAAAAIAAAABAAAAHwAAAAQAAAABAAAA4HN0c3oAAAAAAAAAAAAAADMAAAAaAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAACMc3RjbwAAAAAAAAAfAAAALAAAA1UAAANyAAADhgAAA6IAAAO+AAAD0QAAA+0AAAQAAAAEHAAABC8AAARLAAAEZwAABHoAAASWAAAEqQAABMUAAATYAAAE9AAABRAAAAUjAAAFPwAABVIAAAVuAAAFgQAABZ0AAAWwAAAFzAAABegAAAX7AAAGFwAAAGJ1ZHRhAAAAWm1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAALWlsc3QAAAAlqXRvbwAAAB1kYXRhAAAAAQAAAABMYXZmNTUuMzMuMTAw"};const{webm:hje,mp4:fje}=dje,lI=()=>typeof navigator<"u"&&parseFloat((""+(/CPU.*OS ([0-9_]{3,4})[0-9_]{0,1}|(CPU like).*AppleWebKit.*Mobile/i.exec(navigator.userAgent)||[0,""])[1]).replace("undefined","3_2").replace("_",".").replace("_",""))<10&&!window.MSStream,uI=()=>"wakeLock"in navigator;class pje{constructor(){if(this.enabled=!1,uI()){this._wakeLock=null;const t=()=>{this._wakeLock!==null&&document.visibilityState==="visible"&&this.enable()};document.addEventListener("visibilitychange",t),document.addEventListener("fullscreenchange",t)}else lI()?this.noSleepTimer=null:(this.noSleepVideo=document.createElement("video"),this.noSleepVideo.setAttribute("title","No Sleep"),this.noSleepVideo.setAttribute("playsinline",""),this._addSourceToVideo(this.noSleepVideo,"webm",hje),this._addSourceToVideo(this.noSleepVideo,"mp4",fje),this.noSleepVideo.addEventListener("loadedmetadata",()=>{this.noSleepVideo.duration<=1?this.noSleepVideo.setAttribute("loop",""):this.noSleepVideo.addEventListener("timeupdate",()=>{this.noSleepVideo.currentTime>.5&&(this.noSleepVideo.currentTime=Math.random())})}))}_addSourceToVideo(t,n,i){var o=document.createElement("source");o.src=i,o.type=`video/${n}`,t.appendChild(o)}get isEnabled(){return this.enabled}enable(){return uI()?navigator.wakeLock.request("screen").then(t=>{this._wakeLock=t,this.enabled=!0,console.log("Wake Lock active."),this._wakeLock.addEventListener("release",()=>{console.log("Wake Lock released.")})}).catch(t=>{throw this.enabled=!1,console.error(`${t.name}, ${t.message}`),t}):lI()?(this.disable(),console.warn(`
|
|
NoSleep enabled for older iOS devices. This can interrupt
|
|
active or long-running network requests from completing successfully.
|
|
See https://github.com/richtr/NoSleep.js/issues/15 for more details.
|
|
`),this.noSleepTimer=window.setInterval(()=>{document.hidden||(window.location.href=window.location.href.split("#")[0],window.setTimeout(window.stop,0))},15e3),this.enabled=!0,Promise.resolve()):this.noSleepVideo.play().then(n=>(this.enabled=!0,n)).catch(n=>{throw this.enabled=!1,n})}disable(){uI()?(this._wakeLock&&this._wakeLock.release(),this._wakeLock=null):lI()?this.noSleepTimer&&(console.warn(`
|
|
NoSleep now disabled for older iOS devices.
|
|
`),window.clearInterval(this.noSleepTimer),this.noSleepTimer=null):this.noSleepVideo.pause(),this.enabled=!1}}var mje=pje;function _je(e){let t=!1;const n=window.screen;return c(n)&&(c(n.lockOrientation)?t=n.lockOrientation(e):c(n.mozLockOrientation)?t=n.mozLockOrientation(e):c(n.msLockOrientation)?t=n.msLockOrientation(e):c(n.orientation&&n.orientation.lock)&&(t=n.orientation.lock(e))),t}function Nq(){const e=window.screen;c(e)&&(c(e.unlockOrientation)?e.unlockOrientation():c(e.mozUnlockOrientation)?e.mozUnlockOrientation():c(e.msUnlockOrientation)?e.msUnlockOrientation():c(e.orientation&&e.orientation.unlock)&&e.orientation.unlock())}function gje(e,t,n,i){i()||(n()?(t.useWebVR=!1,e._locked&&(Nq(),e._locked=!1),e._noSleep.disable(),Tr.exitFullscreen(),n(!1)):(Tr.fullscreen||Tr.requestFullscreen(e._vrElement),e._noSleep.enable(),e._locked||(e._locked=_je("landscape")),t.useWebVR=!0,n(!0)))}function DE(e,t){if(!c(e))throw new E("scene is required.");const n=this,i=He.observable(Tr.enabled),o=He.observable(!1);this.isVRMode=void 0,He.defineProperty(this,"isVRMode",{get:function(){return o()}}),this.isVREnabled=void 0,He.defineProperty(this,"isVREnabled",{get:function(){return i()},set:function(s){i(s&&Tr.enabled)}}),this.tooltip=void 0,He.defineProperty(this,"tooltip",function(){return i()?o()?"Exit VR mode":"Enter VR mode":"VR mode is unavailable"});const r=He.observable(!1);this._isOrthographic=void 0,He.defineProperty(this,"_isOrthographic",{get:function(){return r()}}),this._eventHelper=new Tu,this._eventHelper.add(e.preRender,function(){r(e.camera.frustum instanceof It)}),this._locked=!1,this._noSleep=new mje,this._command=mo(function(){gje(n,e,o,r)},He.getObservable(this,"isVREnabled")),this._vrElement=y(Do(t),document.body),this._callback=function(){!Tr.fullscreen&&o()&&(e.useWebVR=!1,n._locked&&(Nq(),n._locked=!1),n._noSleep.disable(),o(!1))},document.addEventListener(Tr.changeEventName,this._callback)}Object.defineProperties(DE.prototype,{vrElement:{get:function(){return this._vrElement},set:function(e){if(!(e instanceof Element))throw new E("value must be a valid Element.");this._vrElement=e}},command:{get:function(){return this._command}}});DE.prototype.isDestroyed=function(){return!1};DE.prototype.destroy=function(){this._eventHelper.removeAll(),document.removeEventListener(Tr.changeEventName,this._callback),ve(this)};const yje="M 5.3125 6.375 C 4.008126 6.375 2.96875 7.4141499 2.96875 8.71875 L 2.96875 19.5 C 2.96875 20.8043 4.008126 21.875 5.3125 21.875 L 13.65625 21.875 C 13.71832 20.0547 14.845166 18.59375 16.21875 18.59375 C 17.592088 18.59375 18.71881 20.0552 18.78125 21.875 L 27.09375 21.875 C 28.398125 21.875 29.4375 20.8043 29.4375 19.5 L 29.4375 8.71875 C 29.4375 7.4141499 28.398125 6.375 27.09375 6.375 L 5.3125 6.375 z M 9.625 10.4375 C 11.55989 10.4375 13.125 12.03385 13.125 13.96875 C 13.125 15.90365 11.55989 17.46875 9.625 17.46875 C 7.69011 17.46875 6.125 15.90365 6.125 13.96875 C 6.125 12.03385 7.69011 10.4375 9.625 10.4375 z M 22.46875 10.4375 C 24.40364 10.4375 25.96875 12.03385 25.96875 13.96875 C 25.96875 15.90365 24.40364 17.46875 22.46875 17.46875 C 20.53386 17.46875 18.96875 15.90365 18.96875 13.96875 C 18.96875 12.03385 20.53386 10.4375 22.46875 10.4375 z",bje="M 25.770585,2.4552065 C 15.72282,13.962707 10.699956,19.704407 8.1768352,22.580207 c -1.261561,1.4379 -1.902282,2.1427 -2.21875,2.5 -0.141624,0.1599 -0.208984,0.2355 -0.25,0.2813 l 0.6875,0.75 c 10e-5,-10e-5 0.679191,0.727 0.6875,0.7187 0.01662,-0.016 0.02451,-0.024 0.03125,-0.031 0.01348,-0.014 0.04013,-0.038 0.0625,-0.062 0.04474,-0.05 0.120921,-0.1315 0.28125,-0.3126 0.320657,-0.3619 0.956139,-1.0921 2.2187499,-2.5312 2.5252219,-2.8781 7.5454589,-8.6169 17.5937499,-20.1250005 l -1.5,-1.3125 z m -20.5624998,3.9063 c -1.304375,0 -2.34375,1.0391 -2.34375,2.3437 l 0,10.8125005 c 0,1.3043 1.039375,2.375 2.34375,2.375 l 2.25,0 c 1.9518039,-2.2246 7.4710958,-8.5584 13.5624998,-15.5312005 l -15.8124998,0 z m 21.1249998,0 c -1.855467,2.1245 -2.114296,2.4005 -3.59375,4.0936995 1.767282,0.1815 3.15625,1.685301 3.15625,3.500001 0,1.9349 -1.56511,3.5 -3.5,3.5 -1.658043,0 -3.043426,-1.1411 -3.40625,-2.6875 -1.089617,1.2461 -2.647139,2.9988 -3.46875,3.9375 0.191501,-0.062 0.388502,-0.094 0.59375,-0.094 1.373338,0 2.50006,1.4614 2.5625,3.2812 l 8.3125,0 c 1.304375,0 2.34375,-1.0707 2.34375,-2.375 l 0,-10.8125005 c 0,-1.3046 -1.039375,-2.3437 -2.34375,-2.3437 l -0.65625,0 z M 9.5518351,10.423906 c 1.9348899,0 3.4999999,1.596401 3.4999999,3.531301 0,1.9349 -1.56511,3.5 -3.4999999,3.5 -1.9348899,0 -3.4999999,-1.5651 -3.4999999,-3.5 0,-1.9349 1.56511,-3.531301 3.4999999,-3.531301 z m 4.2187499,10.312601 c -0.206517,0.2356 -0.844218,0.9428 -1.03125,1.1562 l 0.8125,0 c 0.01392,-0.4081 0.107026,-0.7968 0.21875,-1.1562 z";function PE(e,t,n){if(!c(e))throw new E("container is required.");if(!c(t))throw new E("scene is required.");e=Do(e);const i=new DE(t,n);i._exitVRPath=bje,i._enterVRPath=yje;const o=document.createElement("button");o.type="button",o.className="cesium-button cesium-vrButton",o.setAttribute("data-bind",'css: { "cesium-button-disabled" : _isOrthographic }, attr: { title: tooltip },click: command,enable: isVREnabled,cesiumSvgPath: { path: isVRMode ? _exitVRPath : _enterVRPath, width: 32, height: 32 }'),e.appendChild(o),He.applyBindings(i,o),this._container=e,this._viewModel=i,this._element=o}Object.defineProperties(PE.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});PE.prototype.isDestroyed=function(){return!1};PE.prototype.destroy=function(){return this._viewModel.destroy(),He.cleanNode(this._element),this._container.removeChild(this._element),ve(this)};const gh=new se;function Mq(e){const t=e.clock;t.currentTime=e.timeJulian,t.shouldAnimate=!1}function Tje(e){const t=e.getPropertyIds();let n="";return t.forEach(function(i){const o=e.getProperty(i);c(o)&&(n+=`<tr><th>${i}</th><td>${o}</td></tr>`)}),n.length>0&&(n=`<table class="cesium-infoBox-defaultTable"><tbody>${n}</tbody></table>`),n}function Aje(e){let t;const n=[],i=e.getPropertyIds();for(t=0;t<i.length;t++){const r=i[t];/^name$/i.test(r)?n[0]=e.getProperty(r):/name/i.test(r)?n[1]=e.getProperty(r):/^title$/i.test(r)?n[2]=e.getProperty(r):/^(id|identifier)$/i.test(r)?n[3]=e.getProperty(r):/element/i.test(r)?n[4]=e.getProperty(r):/(id|identifier)$/i.test(r)&&(n[5]=e.getProperty(r))}const o=n.length;for(t=0;t<o;t++){const r=n[t];if(c(r)&&r!=="")return r}return"Unnamed Feature"}function Kz(e,t){const n=e.scene.pick(t.position);if(c(n)){const i=y(n.id,n.primitive.id);if(i instanceof Eo)return i;if(n instanceof Ir)return new Eo({name:Aje(n),description:Tje(n),feature:n})}if(c(e.scene.globe))return Eje(e,t.position)}const xje=new ie;function Fq(e,t,n){if(c(n)){const i=n.clock;if(c(i)&&(i.getValue(t),c(e))){const o=i.startTime;let r=i.stopTime;ie.equals(o,r)&&(r=ie.addSeconds(o,R.EPSILON2,xje)),e.updateFromClock(),e.zoomTo(o,r)}}}const Cje=new d;function Eje(e,t){const n=e.scene,i=n.camera.getPickRay(t),o=n.imageryLayers.pickImageryLayerFeatures(i,n);if(!c(o))return;const r=new Eo({id:"Loading...",description:"Loading feature information..."});return o.then(function(s){if(e.selectedEntity!==r)return;if(!c(s)||s.length===0){e.selectedEntity=Zz();return}const a=s[0],l=new Eo({id:a.name,description:a.description});if(c(a.position)){const u=e.scene.globe.ellipsoid.cartographicToCartesian(a.position,Cje);l.position=new hd(u)}e.selectedEntity=l},function(){e.selectedEntity===r&&(e.selectedEntity=Zz())}),r}function Zz(){return new Eo({id:"None",description:"No features found."})}function wje(e,t){const n=e._geocoder,i=e._homeButton,o=e._sceneModePicker,r=e._projectionPicker,s=e._baseLayerPicker,a=e._animation,l=e._timeline,u=e._fullscreenButton,h=e._infoBox,f=e._selectionIndicator,_=t?"hidden":"visible";if(c(n)&&(n.container.style.visibility=_),c(i)&&(i.container.style.visibility=_),c(o)&&(o.container.style.visibility=_),c(r)&&(r.container.style.visibility=_),c(s)&&(s.container.style.visibility=_),c(a)&&(a.container.style.visibility=_),c(l)&&(l.container.style.visibility=_),c(u)&&u.viewModel.isFullscreenEnabled&&(u.container.style.visibility=_),c(h)&&(h.container.style.visibility=_),c(f)&&(f.container.style.visibility=_),e._container){const g=t||!c(u)?0:u.container.clientWidth;e._vrButton.container.style.right=`${g}px`,e.forceResize()}}function xn(e,t){if(!c(e))throw new E("container is required.");e=Do(e),t=y(t,y.EMPTY_OBJECT);const n=(!c(t.globe)||t.globe!==!1)&&(!c(t.baseLayerPicker)||t.baseLayerPicker!==!1);if(!n&&c(t.selectedImageryProviderViewModel))throw new E("options.selectedImageryProviderViewModel is not available when not using the BaseLayerPicker widget. Either specify options.baseLayer instead or set options.baseLayerPicker to true.");if(!n&&c(t.selectedTerrainProviderViewModel))throw new E("options.selectedTerrainProviderViewModel is not available when not using the BaseLayerPicker widget. Either specify options.terrainProvider instead or set options.baseLayerPicker to true.");const i=this,o=document.createElement("div");o.className="cesium-viewer",e.appendChild(o);const r=document.createElement("div");r.className="cesium-viewer-cesiumWidgetContainer",o.appendChild(r);const s=document.createElement("div");s.className="cesium-viewer-bottom",o.appendChild(s);const a=y(t.scene3DOnly,!1);let l,u,h=!1;c(t.clockViewModel)?(u=t.clockViewModel,l=u.clock):(l=new tb,u=new yb(l),h=!0),c(t.shouldAnimate)&&(l.shouldAnimate=t.shouldAnimate);const f=new Kp(r,{baseLayer:n||c(t.baseLayer)||c(t.imageryProvider)?!1:void 0,clock:l,skyBox:t.skyBox,skyAtmosphere:t.skyAtmosphere,sceneMode:t.sceneMode,mapProjection:t.mapProjection,globe:t.globe,orderIndependentTranslucency:t.orderIndependentTranslucency,contextOptions:t.contextOptions,useDefaultRenderLoop:t.useDefaultRenderLoop,targetFrameRate:t.targetFrameRate,showRenderLoopErrors:t.showRenderLoopErrors,useBrowserRecommendedResolution:t.useBrowserRecommendedResolution,creditContainer:c(t.creditContainer)?t.creditContainer:s,creditViewport:t.creditViewport,scene3DOnly:a,shadows:t.shadows,terrainShadows:t.terrainShadows,mapMode2D:t.mapMode2D,blurActiveElementOnCanvasFocus:t.blurActiveElementOnCanvasFocus,requestRenderMode:t.requestRenderMode,maximumRenderTimeChange:t.maximumRenderTimeChange,depthPlaneEllipsoidOffset:t.depthPlaneEllipsoidOffset,msaaSamples:t.msaaSamples});let _=t.dataSources,g=!1;c(_)||(_=new Gs,g=!0);const m=f.scene,b=new ua({scene:m,dataSourceCollection:_}),T=new Tu;T.add(l.onTick,xn.prototype._onTick,this),T.add(m.morphStart,xn.prototype._clearTrackedObject,this);let x;if(!c(t.selectionIndicator)||t.selectionIndicator!==!1){const q=document.createElement("div");q.className="cesium-viewer-selectionIndicatorContainer",o.appendChild(q),x=new IE(q,m)}let C;if(!c(t.infoBox)||t.infoBox!==!1){const q=document.createElement("div");q.className="cesium-viewer-infoBoxContainer",o.appendChild(q),C=new xE(q);const ee=C.viewModel;T.add(ee.cameraClicked,xn.prototype._onInfoBoxCameraClicked,this),T.add(ee.closeClicked,xn.prototype._onInfoBoxClockClicked,this)}const w=document.createElement("div");w.className="cesium-viewer-toolbar",o.appendChild(w);let v;if(!c(t.geocoder)||t.geocoder!==!1){const q=document.createElement("div");q.className="cesium-viewer-geocoderContainer",w.appendChild(q);let ee;c(t.geocoder)&&typeof t.geocoder!="boolean"&&(ee=Array.isArray(t.geocoder)?t.geocoder:[t.geocoder]),v=new TE({container:q,geocoderServices:ee,scene:m}),T.add(v.viewModel.search.beforeExecute,xn.prototype._clearObjects,this)}let P;if((!c(t.homeButton)||t.homeButton!==!1)&&(P=new AE(w,m),c(v)&&T.add(P.viewModel.command.afterExecute,function(){const q=v.viewModel;q.searchText="",q.isSearchInProgress&&q.search()}),T.add(P.viewModel.command.beforeExecute,xn.prototype._clearTrackedObject,this)),t.sceneModePicker===!0&&a)throw new E("options.sceneModePicker is not available when options.scene3DOnly is set to true.");let N;!a&&(!c(t.sceneModePicker)||t.sceneModePicker!==!1)&&(N=new vE(w,m));let k;t.projectionPicker&&(k=new wE(w,m));let M,U;if(n){const q=y(t.imageryProviderViewModels,IGe()),ee=y(t.terrainProviderViewModels,DGe());M=new gE(w,{globe:m.globe,imageryProviderViewModels:q,selectedImageryProviderViewModel:t.selectedImageryProviderViewModel,terrainProviderViewModels:ee,selectedTerrainProviderViewModel:t.selectedTerrainProviderViewModel}),U=w.getElementsByClassName("cesium-baseLayerPicker-dropDown")[0]}if(c(t.baseLayer)&&t.baseLayer!==!1&&(n&&(M.viewModel.selectedImagery=void 0),m.imageryLayers.removeAll(),m.imageryLayers.add(t.baseLayer)),c(t.terrainProvider)&&(n&&(M.viewModel.selectedTerrain=void 0),m.terrainProvider=t.terrainProvider),c(t.terrain)){if(c(t.terrainProvider))throw new E("Specify either options.terrainProvider or options.terrain.");n&&(M.viewModel.selectedTerrain=void 0,m.globe.depthTestAgainstTerrain=!0),m.setTerrain(t.terrain)}let B;if(!c(t.navigationHelpButton)||t.navigationHelpButton!==!1){let q=!0;try{if(c(window.localStorage)){const ee=window.localStorage.getItem("cesium-hasSeenNavHelp");c(ee)&&Boolean(ee)?q=!1:window.localStorage.setItem("cesium-hasSeenNavHelp","true")}}catch{}B=new CE({container:w,instructionsInitiallyVisible:y(t.navigationInstructionsInitiallyVisible,q)})}let S;if(!c(t.animation)||t.animation!==!1){const q=document.createElement("div");q.className="cesium-viewer-animationContainer",o.appendChild(q),S=new lg(q,new xc(u))}let D;if(!c(t.timeline)||t.timeline!==!1){const q=document.createElement("div");q.className="cesium-viewer-timelineContainer",o.appendChild(q),D=new Ws(q,l),D.addEventListener("settime",Mq,!1),D.zoomTo(l.startTime,l.stopTime)}let p,I,O;(!c(t.fullscreenButton)||t.fullscreenButton!==!1)&&(O=document.createElement("div"),O.className="cesium-viewer-fullscreenContainer",o.appendChild(O),p=new bE(O,t.fullscreenElement),I=fc(p.viewModel,"isFullscreenEnabled",function(q){O.style.display=q?"block":"none",c(D)&&(D.container.style.right=`${O.clientWidth}px`,D.resize())}));let F,V,G;if(t.vrButton){const q=document.createElement("div");q.className="cesium-viewer-vrContainer",o.appendChild(q),F=new PE(q,m,t.fullScreenElement),V=fc(F.viewModel,"isVREnabled",function(ee){q.style.display=ee?"block":"none",c(p)&&(q.style.right=`${O.clientWidth}px`),c(D)&&(D.container.style.right=`${q.clientWidth}px`,D.resize())}),G=fc(F.viewModel,"isVRMode",function(ee){wje(i,ee)})}this._baseLayerPickerDropDown=U,this._fullscreenSubscription=I,this._vrSubscription=V,this._vrModeSubscription=G,this._dataSourceChangedListeners={},this._automaticallyTrackDataSourceClocks=y(t.automaticallyTrackDataSourceClocks,!0),this._container=e,this._bottomContainer=s,this._element=o,this._cesiumWidget=f,this._selectionIndicator=x,this._infoBox=C,this._dataSourceCollection=_,this._destroyDataSourceCollection=g,this._dataSourceDisplay=b,this._clockViewModel=u,this._destroyClockViewModel=h,this._toolbar=w,this._homeButton=P,this._sceneModePicker=N,this._projectionPicker=k,this._baseLayerPicker=M,this._navigationHelpButton=B,this._animation=S,this._timeline=D,this._fullscreenButton=p,this._vrButton=F,this._geocoder=v,this._eventHelper=T,this._lastWidth=0,this._lastHeight=0,this._allowDataSourcesToSuspendAnimation=!0,this._entityView=void 0,this._enableInfoOrSelection=c(C)||c(x),this._clockTrackedDataSource=void 0,this._trackedEntity=void 0,this._needTrackedEntityUpdate=!1,this._selectedEntity=void 0,this._zoomIsFlight=!1,this._zoomTarget=void 0,this._zoomPromise=void 0,this._zoomOptions=void 0,this._selectedEntityChanged=new Le,this._trackedEntityChanged=new Le,He.track(this,["_trackedEntity","_selectedEntity","_clockTrackedDataSource"]),T.add(_.dataSourceAdded,xn.prototype._onDataSourceAdded,this),T.add(_.dataSourceRemoved,xn.prototype._onDataSourceRemoved,this),T.add(m.postUpdate,xn.prototype.resize,this),T.add(m.postRender,xn.prototype._postRender,this);const j=_.length;for(let q=0;q<j;q++)this._dataSourceAdded(_,_.get(q));this._dataSourceAdded(void 0,b.defaultDataSource),T.add(_.dataSourceAdded,xn.prototype._dataSourceAdded,this),T.add(_.dataSourceRemoved,xn.prototype._dataSourceRemoved,this);function W(q){const ee=Kz(i,q);c(ee)?K.getValueOrUndefined(ee.position,i.clock.currentTime)?i.trackedEntity=ee:i.zoomTo(ee):c(i.trackedEntity)&&(i.trackedEntity=void 0)}function X(q){i.selectedEntity=Kz(i,q)}f.screenSpaceEventHandler.setInputAction(X,pn.LEFT_CLICK),f.screenSpaceEventHandler.setInputAction(W,pn.LEFT_DOUBLE_CLICK)}Object.defineProperties(xn.prototype,{container:{get:function(){return this._container}},creditDisplay:{get:function(){return this._cesiumWidget.creditDisplay}},bottomContainer:{get:function(){return this._bottomContainer}},cesiumWidget:{get:function(){return this._cesiumWidget}},selectionIndicator:{get:function(){return this._selectionIndicator}},infoBox:{get:function(){return this._infoBox}},geocoder:{get:function(){return this._geocoder}},homeButton:{get:function(){return this._homeButton}},sceneModePicker:{get:function(){return this._sceneModePicker}},projectionPicker:{get:function(){return this._projectionPicker}},baseLayerPicker:{get:function(){return this._baseLayerPicker}},navigationHelpButton:{get:function(){return this._navigationHelpButton}},animation:{get:function(){return this._animation}},timeline:{get:function(){return this._timeline}},fullscreenButton:{get:function(){return this._fullscreenButton}},vrButton:{get:function(){return this._vrButton}},dataSourceDisplay:{get:function(){return this._dataSourceDisplay}},entities:{get:function(){return this._dataSourceDisplay.defaultDataSource.entities}},dataSources:{get:function(){return this._dataSourceCollection}},canvas:{get:function(){return this._cesiumWidget.canvas}},scene:{get:function(){return this._cesiumWidget.scene}},shadows:{get:function(){return this.scene.shadowMap.enabled},set:function(e){this.scene.shadowMap.enabled=e}},terrainShadows:{get:function(){return this.scene.globe.shadows},set:function(e){this.scene.globe.shadows=e}},shadowMap:{get:function(){return this.scene.shadowMap}},imageryLayers:{get:function(){return this.scene.imageryLayers}},terrainProvider:{get:function(){return this.scene.terrainProvider},set:function(e){this.scene.terrainProvider=e}},camera:{get:function(){return this.scene.camera}},postProcessStages:{get:function(){return this.scene.postProcessStages}},clock:{get:function(){return this._clockViewModel.clock}},clockViewModel:{get:function(){return this._clockViewModel}},screenSpaceEventHandler:{get:function(){return this._cesiumWidget.screenSpaceEventHandler}},targetFrameRate:{get:function(){return this._cesiumWidget.targetFrameRate},set:function(e){this._cesiumWidget.targetFrameRate=e}},useDefaultRenderLoop:{get:function(){return this._cesiumWidget.useDefaultRenderLoop},set:function(e){this._cesiumWidget.useDefaultRenderLoop=e}},resolutionScale:{get:function(){return this._cesiumWidget.resolutionScale},set:function(e){this._cesiumWidget.resolutionScale=e}},useBrowserRecommendedResolution:{get:function(){return this._cesiumWidget.useBrowserRecommendedResolution},set:function(e){this._cesiumWidget.useBrowserRecommendedResolution=e}},allowDataSourcesToSuspendAnimation:{get:function(){return this._allowDataSourcesToSuspendAnimation},set:function(e){this._allowDataSourcesToSuspendAnimation=e}},trackedEntity:{get:function(){return this._trackedEntity},set:function(e){if(this._trackedEntity!==e){this._trackedEntity=e,hL(this);const t=this.scene,n=t.mode;!c(e)||!c(e.position)?(this._needTrackedEntityUpdate=!1,(n===oe.COLUMBUS_VIEW||n===oe.SCENE2D)&&(t.screenSpaceCameraController.enableTranslate=!0),(n===oe.COLUMBUS_VIEW||n===oe.SCENE3D)&&(t.screenSpaceCameraController.enableTilt=!0),this._entityView=void 0,this.camera.lookAtTransform(L.IDENTITY)):this._needTrackedEntityUpdate=!0,this._trackedEntityChanged.raiseEvent(e),this.scene.requestRender()}}},selectedEntity:{get:function(){return this._selectedEntity},set:function(e){if(this._selectedEntity!==e){this._selectedEntity=e;const t=c(this._selectionIndicator)?this._selectionIndicator.viewModel:void 0;c(e)?c(t)&&t.animateAppear():c(t)&&t.animateDepart(),this._selectedEntityChanged.raiseEvent(e)}}},selectedEntityChanged:{get:function(){return this._selectedEntityChanged}},trackedEntityChanged:{get:function(){return this._trackedEntityChanged}},clockTrackedDataSource:{get:function(){return this._clockTrackedDataSource},set:function(e){this._clockTrackedDataSource!==e&&(this._clockTrackedDataSource=e,Fq(this._timeline,this.clock,e))}}});xn.prototype.extend=function(e,t){if(!c(e))throw new E("mixin is required.");e(this,t)};xn.prototype.resize=function(){const e=this._cesiumWidget,t=this._container,n=t.clientWidth,i=t.clientHeight,o=c(this._animation),r=c(this._timeline);if(e.resize(),n===this._lastWidth&&i===this._lastHeight)return;const s=i-125,a=this._baseLayerPickerDropDown;if(c(a)&&(a.style.maxHeight=`${s}px`),c(this._geocoder)){const g=this._geocoder.searchSuggestionsContainer;g.style.maxHeight=`${s}px`}c(this._infoBox)&&(this._infoBox.viewModel.maxHeight=s);const l=this._timeline;let u,h=0,f=0,_=0;if(o&&window.getComputedStyle(this._animation.container).visibility!=="hidden"){const g=this._lastWidth;u=this._animation.container,n>900?(h=169,g<=900&&(u.style.width="169px",u.style.height="112px",this._animation.resize())):n>=600?(h=136,(g<600||g>900)&&(u.style.width="136px",u.style.height="90px",this._animation.resize())):(h=106,(g>600||g===0)&&(u.style.width="106px",u.style.height="70px",this._animation.resize())),f=h+5}if(r&&window.getComputedStyle(this._timeline.container).visibility!=="hidden"){const g=this._fullscreenButton,m=this._vrButton,b=l.container,T=b.style;_=b.clientHeight+3,T.left=`${h}px`;let x=0;c(g)&&(x+=g.container.clientWidth),c(m)&&(x+=m.container.clientWidth),T.right=`${x}px`,l.resize()}this._bottomContainer.style.left=`${f}px`,this._bottomContainer.style.bottom=`${_}px`,this._lastWidth=n,this._lastHeight=i};xn.prototype.forceResize=function(){this._lastWidth=0,this.resize()};xn.prototype.render=function(){this._cesiumWidget.render()};xn.prototype.isDestroyed=function(){return!1};xn.prototype.destroy=function(){let e;c(this.screenSpaceEventHandler)&&!this.screenSpaceEventHandler.isDestroyed()&&(this.screenSpaceEventHandler.removeInputAction(pn.LEFT_CLICK),this.screenSpaceEventHandler.removeInputAction(pn.LEFT_DOUBLE_CLICK));const t=this.dataSources,n=t.length;for(e=0;e<n;e++)this._dataSourceRemoved(t,t.get(e));return this._dataSourceRemoved(void 0,this._dataSourceDisplay.defaultDataSource),this._container.removeChild(this._element),this._element.removeChild(this._toolbar),this._eventHelper.removeAll(),c(this._geocoder)&&(this._geocoder=this._geocoder.destroy()),c(this._homeButton)&&(this._homeButton=this._homeButton.destroy()),c(this._sceneModePicker)&&(this._sceneModePicker=this._sceneModePicker.destroy()),c(this._projectionPicker)&&(this._projectionPicker=this._projectionPicker.destroy()),c(this._baseLayerPicker)&&(this._baseLayerPicker=this._baseLayerPicker.destroy()),c(this._animation)&&(this._element.removeChild(this._animation.container),this._animation=this._animation.destroy()),c(this._timeline)&&(this._timeline.removeEventListener("settime",Mq,!1),this._element.removeChild(this._timeline.container),this._timeline=this._timeline.destroy()),c(this._fullscreenButton)&&(this._fullscreenSubscription.dispose(),this._element.removeChild(this._fullscreenButton.container),this._fullscreenButton=this._fullscreenButton.destroy()),c(this._vrButton)&&(this._vrSubscription.dispose(),this._vrModeSubscription.dispose(),this._element.removeChild(this._vrButton.container),this._vrButton=this._vrButton.destroy()),c(this._infoBox)&&(this._element.removeChild(this._infoBox.container),this._infoBox=this._infoBox.destroy()),c(this._selectionIndicator)&&(this._element.removeChild(this._selectionIndicator.container),this._selectionIndicator=this._selectionIndicator.destroy()),this._destroyClockViewModel&&(this._clockViewModel=this._clockViewModel.destroy()),this._dataSourceDisplay=this._dataSourceDisplay.destroy(),this._cesiumWidget=this._cesiumWidget.destroy(),this._destroyDataSourceCollection&&(this._dataSourceCollection=this._dataSourceCollection.destroy()),ve(this)};xn.prototype._dataSourceAdded=function(e,t){t.entities.collectionChanged.addEventListener(xn.prototype._onEntityCollectionChanged,this)};xn.prototype._dataSourceRemoved=function(e,t){const n=t.entities;n.collectionChanged.removeEventListener(xn.prototype._onEntityCollectionChanged,this),c(this.trackedEntity)&&n.getById(this.trackedEntity.id)===this.trackedEntity&&(this.trackedEntity=void 0),c(this.selectedEntity)&&n.getById(this.selectedEntity.id)===this.selectedEntity&&(this.selectedEntity=void 0)};xn.prototype._onTick=function(e){const t=e.currentTime,n=this._dataSourceDisplay.update(t);this._allowDataSourcesToSuspendAnimation&&(this._clockViewModel.canAnimate=n);const i=this._entityView;if(c(i)){const h=this._trackedEntity;this._dataSourceDisplay.getBoundingSphere(h,!1,gh)===rt.DONE&&i.update(t,gh)}let o,r=!1;const s=this.selectedEntity,a=c(s)&&this._enableInfoOrSelection;a&&s.isShowing&&s.isAvailable(t)&&(this._dataSourceDisplay.getBoundingSphere(s,!0,gh)!==rt.FAILED?o=gh.center:c(s.position)&&(o=s.position.getValue(t,o)),r=c(o));const l=c(this._selectionIndicator)?this._selectionIndicator.viewModel:void 0;c(l)&&(l.position=d.clone(o,l.position),l.showSelection=a&&r,l.update());const u=c(this._infoBox)?this._infoBox.viewModel:void 0;c(u)&&(u.showInfo=a,u.enableCamera=r,u.isCameraTracking=this.trackedEntity===this.selectedEntity,a?(u.titleText=y(s.name,s.id),u.description=K.getValueOrDefault(s.description,t,"")):(u.titleText="",u.description=""))};xn.prototype._onEntityCollectionChanged=function(e,t,n){const i=n.length;for(let o=0;o<i;o++){const r=n[o];this.trackedEntity===r&&(this.trackedEntity=void 0),this.selectedEntity===r&&(this.selectedEntity=void 0)}};xn.prototype._onInfoBoxCameraClicked=function(e){if(e.isCameraTracking&&this.trackedEntity===this.selectedEntity)this.trackedEntity=void 0;else{const n=this.selectedEntity.position;c(n)?this.trackedEntity=this.selectedEntity:this.zoomTo(this.selectedEntity)}};xn.prototype._clearTrackedObject=function(){this.trackedEntity=void 0};xn.prototype._onInfoBoxClockClicked=function(e){this.selectedEntity=void 0};xn.prototype._clearObjects=function(){this.trackedEntity=void 0,this.selectedEntity=void 0};xn.prototype._onDataSourceChanged=function(e){this.clockTrackedDataSource===e&&Fq(this.timeline,this.clock,e)};xn.prototype._onDataSourceAdded=function(e,t){this._automaticallyTrackDataSourceClocks&&(this.clockTrackedDataSource=t);const n=t.entities.id,i=this._eventHelper.add(t.changedEvent,xn.prototype._onDataSourceChanged,this);this._dataSourceChangedListeners[n]=i};xn.prototype._onDataSourceRemoved=function(e,t){const n=this.clockTrackedDataSource===t,i=t.entities.id;if(this._dataSourceChangedListeners[i](),this._dataSourceChangedListeners[i]=void 0,n){const o=e.length;this._automaticallyTrackDataSourceClocks&&o>0?this.clockTrackedDataSource=e.get(o-1):this.clockTrackedDataSource=void 0}};xn.prototype.zoomTo=function(e,t){return Bq(this,e,{offset:t},!1)};xn.prototype.flyTo=function(e,t){return Bq(this,e,t,!0)};function Bq(e,t,n,i){if(!c(t))throw new E("zoomTarget is required.");hL(e);const o=new Promise(r=>{e._completeZoom=function(s){r(s)}});return e._zoomPromise=o,e._zoomIsFlight=i,e._zoomOptions=n,Promise.resolve(t).then(function(r){if(e._zoomPromise===o){if(r instanceof Qt){let s;c(r.imageryProvider)?s=Promise.resolve(r.getImageryRectangle()):s=new Promise(a=>{const l=r.readyEvent.addEventListener(()=>{l(),a(r.getImageryRectangle())})}),s.then(function(a){return _E(a,e.scene)}).then(function(a){e._zoomPromise===o&&(e._zoomTarget=a)});return}if(r instanceof hi||r instanceof af||r instanceof Bc){e._zoomTarget=r;return}if(r.isLoading&&c(r.loadingEvent)){const s=r.loadingEvent.addEventListener(function(){s(),e._zoomPromise===o&&(e._zoomTarget=r.entities.values.slice(0))});return}if(Array.isArray(r)){e._zoomTarget=r.slice(0);return}r=y(r.values,r),c(r.entities)&&(r=r.entities.values),Array.isArray(r)?e._zoomTarget=r.slice(0):e._zoomTarget=[r]}}),e.scene.requestRender(),o}function vy(e){e._zoomPromise=void 0,e._zoomTarget=void 0,e._zoomOptions=void 0}function hL(e){const t=e._zoomPromise;c(t)&&(vy(e),e._completeZoom(!1))}xn.prototype._postRender=function(){Sje(this),vje(this)};function Sje(e){const t=e._zoomTarget;if(!c(t)||e.scene.mode===oe.MORPHING)return;const n=e.scene,i=n.camera,o=y(e._zoomOptions,{});let r;function s(h){c(o.offset)||(o.offset=new F_(0,-.5,h.radius)),r={offset:o.offset,duration:o.duration,maximumHeight:o.maximumHeight,complete:function(){e._completeZoom(!0)},cancel:function(){e._completeZoom(!1)}},e._zoomIsFlight?i.flyToBoundingSphere(t.boundingSphere,r):(i.viewBoundingSphere(h,o.offset),i.lookAtTransform(L.IDENTITY),e._completeZoom(!0)),vy(e)}if(t instanceof af){if(c(t.boundingSphere)){s(t.boundingSphere);return}const h=t.frameChanged.addEventListener(function(f){s(f.boundingSphere),h()});return}if(t instanceof hi||t instanceof Bc){s(t.boundingSphere);return}if(t instanceof he){r={destination:n.mapProjection.ellipsoid.cartographicToCartesian(t),duration:o.duration,maximumHeight:o.maximumHeight,complete:function(){e._completeZoom(!0)},cancel:function(){e._completeZoom(!1)}},e._zoomIsFlight?i.flyTo(r):(i.setView(r),e._completeZoom(!0)),vy(e);return}const a=t,l=[];for(let h=0,f=a.length;h<f;h++){const _=e._dataSourceDisplay.getBoundingSphere(a[h],!1,gh);if(_===rt.PENDING)return;_!==rt.FAILED&&l.push(se.clone(gh))}if(l.length===0){hL(e);return}e.trackedEntity=void 0;const u=se.fromBoundingSpheres(l);e._zoomIsFlight?(vy(e),i.flyToBoundingSphere(u,{duration:o.duration,maximumHeight:o.maximumHeight,complete:function(){e._completeZoom(!0)},cancel:function(){e._completeZoom(!1)},offset:o.offset})):(i.viewBoundingSphere(u,o.offset),i.lookAtTransform(L.IDENTITY),vy(e),e._completeZoom(!0))}function vje(e){if(!e._needTrackedEntityUpdate)return;const t=e._trackedEntity,n=e.clock.currentTime,i=K.getValueOrUndefined(t.position,n);if(!c(i))return;const o=e.scene,r=e._dataSourceDisplay.getBoundingSphere(t,!1,gh);if(r===rt.PENDING)return;const s=o.mode;(s===oe.COLUMBUS_VIEW||s===oe.SCENE2D)&&(o.screenSpaceCameraController.enableTranslate=!1),(s===oe.COLUMBUS_VIEW||s===oe.SCENE3D)&&(o.screenSpaceCameraController.enableTilt=!1);const a=r!==rt.FAILED?gh:void 0;e._entityView=new S0(t,o,o.mapProjection.ellipsoid),e._entityView.update(n,a),e._needTrackedEntityUpdate=!1}const Jz="/assets/Point3.3340c5c1.png";const Ije={id:"EnvironmentMap"},Dje={__name:"Map",props:{nowValue:{type:Object,default:()=>({})}},setup(e){const t=e;console.log("production",'"production"'),window.CESIUM_BASE_URL="/CesiumUnminified";var n=null,i=null,o=null;const r=Ps({}),s=Ps(!1),a=Ps("");let l=Ps("");function u(_){const g=_.entities.values;for(let m=0;m<g.length;m++){const b=g[m];b.billboard&&(_.entities.remove(b),--m)}}function h(_){if(_){let m=new og({url:"http://t0.tianditu.com/cia_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=cia&tileMatrixSet=w&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}&style=default&format=tiles&tk=5956e6519f2bb0ae8e57bc834298c9f1",layer:"tdtImgBasicLayer",style:"default",format:"image/jpeg",tileMatrixSetID:"GoogleMapsCompatible",show:!0,maximumLevel:18});var g=new Qt(m);n.imageryLayers.add(g)}else console.log("\u5173\u95EDWMTS\u670D\u52A1(\u515C\u5E95)")}function f(){Zf.defaultAccessToken="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJlZGZlNDYwYy1hYzNkLTQzMGMtYTZhNy1iZjVjNzgxZWE4NzIiLCJpZCI6MjE2NzUyLCJpYXQiOjE3MTYyOTI5MzN9.btze81tzNNWYuzl63jtY46tbes_XynccAz3DDW7Xdf4",n=new xn("EnvironmentMap",{baseLayerPicker:!1,animation:!1,timeline:!1,homeButton:!1,navigationHelpButton:!1,geocoder:!1,infoBox:!1,sceneMode:oe.SCENE2D,selectionIndicator:!1,sceneModePicker:!1,fullscreenButton:!1}),i=new da(n.scene.canvas),n.camera.setView({destination:d.fromDegrees(119,36,1e5)}),n.screenSpaceEventHandler.setInputAction(b=>{const T=n.scene.pick(b.position);if(console.log(T,"pickedObject"),c(T)&&T.id){const x=T.id;console.log(x,"entity"),console.log(T.id._id),a.value=T.id._id;const C=x.position.getValue(ie.now());if(console.log(x,C),C){const w=n.scene.cartesianToCanvasCoordinates(C);console.log(w),s.value=!0,m(w)}}},pn.LEFT_CLICK),n.scene.postRender.addEventListener(()=>{if(s.value){const T=n.entities.values.find(x=>x._id===a.value).position.getValue(ie.now());if(T){const x=n.scene.cartesianToCanvasCoordinates(T);m(x)}}});function m(b){b&&(r.value={position:"absolute",left:`${b.x-110}px`,top:`${b.y-150}px`})}}return zq(()=>t.nowValue,async(_,g)=>{console.log(_,g,"\u6211\u662F\u5730\u56FE\u7EC4\u4EF6\uFF0C\u76D1\u542Cprops");const m=await Xq({msNmae:_});if(m.code==200){if(console.log(m.data[0],Jz),l.value=m.data[0],u(n),o=n.entities.add({id:`${Number(m.data[0].msLongitude).toFixed(0)+Number(m.data[0].msLatitude).toFixed(0)}`,position:d.fromDegrees(Number(m.data[0].msLongitude),Number(m.data[0].msLatitude),10),billboard:{show:!0,image:Jz,scale:.2,color:z.WHITE}}),console.log(o,"_PointValue"),o){const b=o;console.log(b,"entity"),console.log(o._id),a.value=o._id;const T=b.position.getValue(ie.now());if(console.log(b,T),T){const x=n.scene.cartesianToCanvasCoordinates(T);console.log(x),s.value=!0}}n.camera.flyTo({destination:d.fromDegrees(Number(m.data[0].msLongitude),Number(m.data[0].msLatitude),1100),duration:4})}},{deep:!0}),Uq(()=>{f(),h(!0)}),kq(()=>{console.log("\u9500\u6BC1\u5B9E\u4F8B\u548C\u4E8B\u4EF6"),n.destroy(),i.destroy()}),(_,g)=>{const m=ea("CircleClose"),b=ea("el-icon");return _x(),gx("div",Ije,[s.value?(_x(),gx("div",{key:0,style:Vq(r.value),class:"popup"},[Xn(b,{class:"Icon",size:"18px",onClick:g[0]||(g[0]=T=>s.value=!1)},{default:ic(()=>[Xn(m)]),_:1}),is("p",null,jf(gr(l).msName),1),is("p",null," \u7ECF\u5EA6\uFF1A"+jf(gr(l).msLongitude),1),is("p",null," \u7EAC\u5EA6\uFF1A"+jf(gr(l).msLatitude),1)],4)):tU("",!0)])}}},Pje=eU(Dje,[["__scopeId","data-v-bdad52a8"]]);const Oje={class:"EnvironmentBox"},Lje={class:"LeftTree"},Rje={class:"LeftTree_P"},Nje={style:{color:"cornflowerblue"}},Mje={class:"LeftTree_P"},Fje={style:{display:"flex","justify-content":"flex-start"}},Bje={key:0,style:{"margin-left":"10px",color:"#ccc"}},zje={class:"TopForm"},Uje={class:"BottomTable"},kje={class:"PageBox"},Vje={__name:"Environment",setup(e){var t=localStorage.getItem("deptName")||"\u9752\u5C9B\u897F\u6D77\u5CB8\u65B0\u533A";let n=Ps(0),i=Ps(""),o=Ps([]);const r={children:"children",label:"label"};let s=Ps(!1),a=Ps({time:["",""]});const l=Ps(),h=Hq({time:[{validator:(M,U,B)=>{console.log("1",M,"2",U,"3",B),U[0]===""||U[1]===""?B(new Error("\u8BF7\u9009\u62E9\u65F6\u95F4\u6BB5")):B()},trigger:"blur"}]});let f=Ps([]),_=Ps(""),g=Ps(1),m=Ps(10),b=Ps(0);const T=M=>{console.log(M),M.devId&&(_.value=M.devId,i.value=M.label,g.value=1)};function x(){s.value=!s.value}const C=async M=>{!M||await M.validate((U,B)=>{if(U){console.log("submit!"),console.log(a.value);let S={};a.value.time&&(S.startTime=em(a.value.time[0]).format("YYYY-MM-DD"),S.endTime=em(a.value.time[1]).format("YYYY-MM-DD")),S.whetherToDownload="false",S.devId=_.value,console.log(S,"obj"),Tb(S).then(D=>{console.log(D,"res"),f.value=D.rows,b.value=D.total,D.code==200&&(g.value=1,Wq({message:`${D.msg}:\u5DF2\u4E3A\u60A8\u67E5\u8BE2\u5230${S.startTime}\u81F3${S.endTime}\u7684\u6240\u6709\u6570\u636E\uFF0C\u5171${D.total} \u6761\u6570\u636E`,type:"success",duration:5e3}))})}else console.log("error submit!",B)})};function w(){a.value.time=["",""],g.value=1,m.value=10}function v(){let M={};a.value.time[0]!==""&&(M.startTime=em(a.value.time[0]).format("YYYY-MM-DD"),M.endTime=em(a.value.time[1]).format("YYYY-MM-DD")),M.whetherToDownload="true",M.devId=_.value,M.pageNum=g.value,M.pageSize=m.value,console.log(M,"obj"),Tb(M).then(U=>{U.rows.length>0&&U.rows[U.rows.length-1].excelPath&&(console.log(U.rows[U.rows.length-1].excelPath,"res"),Yq(U.rows[U.rows.length-1].excelPath))})}function P(M){console.log(`\u6BCF\u9875 ${M} \u6761`),m.value=M,g.value=1}function N(M){console.log(`\u5F53\u524D\u9875: ${M}`),g.value=M}function k(M){let U=[];return M.forEach((B,S)=>{B.children&&(U=U.concat(B.children))}),U.length}return Gq(()=>{console.log("\u8BB0\u5F55",_.value),a.value.time[0]==""&&_.value?(console.log(typeof a.value.time[0]),Tb({devId:_.value,pageNum:g.value,pageSize:m.value}).then(M=>{f.value=M.rows,b.value=M.total})):_.value&&Tb({devId:_.value,pageNum:g.value,pageSize:m.value,startTime:em(a.value.time[0]).format("YYYY-MM-DD"),endTime:em(a.value.time[1]).format("YYYY-MM-DD")}).then(M=>{f.value=M.rows,b.value=M.total})}),jq(async()=>{const M=await $q({divisions:t});console.log(M),M.code==200&&(o.value=M.data,_.value=M.data[0].children[0].devId,console.log(_.value),i.value=M.data[0].children[0].label,n.value=k(M.data))}),(M,U)=>{const B=ea("el-tree"),S=ea("DArrowLeft"),D=ea("el-icon"),p=ea("DArrowRight"),I=ea("el-date-picker"),O=ea("el-form-item"),F=ea("el-button"),V=ea("Download"),G=ea("el-form"),j=ea("el-table-column"),W=ea("el-table"),X=ea("el-pagination");return _x(),gx("div",Oje,[is("div",Lje,[is("p",Rje,[dg(" \u603B\u8BBE\u5907\u6570\uFF1A"),is("span",Nje,"\u2003"+jf(gr(n)),1)]),is("p",Mje,[dg(" \u5F53\u524D\u9009\u62E9\uFF1A"),is("span",null,"\u2003"+jf(gr(i)),1)]),Xn(B,{"node-key":"devId",style:{width:"100%"},data:gr(o),props:r,accordion:"",onNodeClick:T},{default:ic(({node:q,data:ee})=>[is("div",Fje,[is("span",null,jf(q.label),1),ee.children?(_x(),gx("span",Bje,"("+jf(ee.children.length)+")",1)):tU("",!0)])]),_:1},8,["data"])]),is("div",{class:yL(gr(s)?"CenterBox":"CenterBox_Auto")},[is("div",{class:"Tool",onClick:x},[mL(Xn(D,{color:"#aaa"},{default:ic(()=>[Xn(S)]),_:1},512),[[_L,!gr(s)]]),mL(Xn(D,{color:"#aaa"},{default:ic(()=>[Xn(p)]),_:1},512),[[_L,gr(s)]])]),is("div",zje,[Xn(G,{ref_key:"ruleFormRef",ref:l,rules:h,model:gr(a),"label-width":"auto",style:{"max-width":"100%"},inline:!0,"label-position":"left"},{default:ic(()=>[Xn(O,{label:"\u65E5\u671F\uFF1A",prop:"time"},{default:ic(()=>[Xn(I,{modelValue:gr(a).time,"onUpdate:modelValue":U[0]||(U[0]=q=>gr(a).time=q),type:"daterange","range-separator":"\u81F3","start-placeholder":"\u5F00\u59CB\u65F6\u95F4","end-placeholder":"\u7ED3\u675F\u65F6\u95F4",size:M.size},null,8,["modelValue","size"])]),_:1}),Xn(O,null,{default:ic(()=>[Xn(F,{type:"primary",onClick:U[1]||(U[1]=q=>C(l.value))},{default:ic(()=>[dg("\u67E5\u8BE2")]),_:1}),Xn(F,{onClick:w},{default:ic(()=>[dg("\u91CD\u7F6E")]),_:1}),Xn(F,{onClick:U[2]||(U[2]=q=>v(l.value))},{default:ic(()=>[Xn(D,null,{default:ic(()=>[Xn(V)]),_:1}),dg(" \u4E0B\u8F7D ")]),_:1})]),_:1})]),_:1},8,["rules","model"])]),is("div",Uje,[Xn(W,{data:gr(f),border:"",style:{width:"100%"},height:"700"},{default:ic(()=>[Xn(j,{prop:"datetime",label:"\u65F6\u95F4",width:"180",fixed:"left"}),Xn(j,{prop:"soilEc",label:"\u571F\u58E4EC(S/cm)",width:"115"}),Xn(j,{prop:"soilTemperature",label:"\u571F\u58E4\u6E29\u5EA6(\u2103)",width:"115"}),Xn(j,{prop:"soilPh",label:"\u571F\u58E4PH\u503C(ph)",width:"115"}),Xn(j,{prop:"soilHumidity",label:"\u571F\u58E4\u6E7F\u5EA6(%rh)",width:"120"}),Xn(j,{prop:"co2Concentration",label:"\u4E8C\u6C27\u5316\u78B3\u6D53\u5EA6(ppm)",width:"150"}),Xn(j,{prop:"airHumidity",label:"\u7A7A\u6C14\u6E7F\u5EA6(%rh)",width:"120"}),Xn(j,{prop:"airTemperature",label:"\u7A7A\u6C14\u6E29\u5EA6(\u2103)",width:"120"}),Xn(j,{prop:"lightIllum",label:"\u5149\u7167\u5F3A\u5EA6(lx)",width:"115"}),Xn(j,{prop:"devId",label:"\u8BBE\u5907ID",width:"150"}),Xn(j,{prop:"lat",label:"\u7EAC\u5EA6",fixed:"right"}),Xn(j,{prop:"lng",label:"\u7ECF\u5EA6",fixed:"right"})]),_:1},8,["data"])]),is("div",kje,[Xn(X,{size:"small","current-page":gr(g),"onUpdate:current-page":U[3]||(U[3]=q=>gL(g)?g.value=q:g=q),"page-size":gr(m),"onUpdate:page-size":U[4]||(U[4]=q=>gL(m)?m.value=q:m=q),"page-sizes":[10,25,50],background:"true",layout:"total, sizes, prev, pager, next, jumper",total:gr(b),onSizeChange:P,onCurrentChange:N},null,8,["current-page","page-size","total"])])],2),is("div",{class:yL(gr(s)?"RightBox":"RightBox_None")},[Xn(Pje,{nowValue:gr(i)},null,8,["nowValue"])],2)])}}},Wje=eU(Vje,[["__scopeId","data-v-4acdc40a"]]);export{Wje as default};
|